@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,524 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { getDirectoryContextString, getEnvironmentContext, } from '@vybestack/llxprt-code-core/utils/environmentContext.js';
|
|
7
|
+
import { buildToolDeclarationsFromView, getEnabledToolNamesForPrompt, } from './clientToolGovernance.js';
|
|
8
|
+
import { DebugLogger } from '@vybestack/llxprt-code-core/debug/index.js';
|
|
9
|
+
import { createContentGenerator, } from '@vybestack/llxprt-code-core/core/contentGenerator.js';
|
|
10
|
+
import { ProxyAgent, setGlobalDispatcher } from 'undici';
|
|
11
|
+
import { LoopDetectionService } from '@vybestack/llxprt-code-core/services/loopDetectionService.js';
|
|
12
|
+
import { ComplexityAnalyzer } from '@vybestack/llxprt-code-core/services/complexity-analyzer.js';
|
|
13
|
+
import { TodoReminderService } from '@vybestack/llxprt-code-core/services/todo-reminder-service.js';
|
|
14
|
+
import { uiTelemetryService } from '@vybestack/llxprt-code-core/telemetry/uiTelemetry.js';
|
|
15
|
+
import { subscribeToAgentRuntimeState } from '@vybestack/llxprt-code-core/runtime/AgentRuntimeState.js';
|
|
16
|
+
import { BaseLLMClient } from './baseLlmClient.js';
|
|
17
|
+
import { coreEvents, CoreEvent, } from '@vybestack/llxprt-code-core/utils/events.js';
|
|
18
|
+
import { estimateTokens as estimateTextTokens } from '@vybestack/llxprt-code-core/utils/toolOutputLimiter.js';
|
|
19
|
+
export { isThinkingSupported, findCompressSplitPoint, } from './clientHelpers.js';
|
|
20
|
+
import { generateJson as clientLlmGenerateJson, generateContent as clientLlmGenerateContent, generateEmbedding as clientLlmGenerateEmbedding, } from './clientLlmUtilities.js';
|
|
21
|
+
import { TodoContinuationService } from './TodoContinuationService.js';
|
|
22
|
+
export { PostTurnAction } from './TodoContinuationService.js';
|
|
23
|
+
import { IdeContextTracker } from './IdeContextTracker.js';
|
|
24
|
+
import { AgentHookManager } from './AgentHookManager.js';
|
|
25
|
+
import { buildSystemInstruction as factoryBuildSystemInstruction, createChatSessionSafe, } from './ChatSessionFactory.js';
|
|
26
|
+
import { MessageStreamOrchestrator, } from './MessageStreamOrchestrator.js';
|
|
27
|
+
export class AgentClient {
|
|
28
|
+
config;
|
|
29
|
+
chat;
|
|
30
|
+
contentGenerator;
|
|
31
|
+
embeddingModel;
|
|
32
|
+
logger;
|
|
33
|
+
generateContentConfig = {
|
|
34
|
+
temperature: 0,
|
|
35
|
+
topP: 1,
|
|
36
|
+
};
|
|
37
|
+
sessionTurnCount = 0;
|
|
38
|
+
MAX_TURNS = 100;
|
|
39
|
+
_pendingConfig;
|
|
40
|
+
_previousHistory;
|
|
41
|
+
_storedHistoryService;
|
|
42
|
+
currentSequenceModel = null;
|
|
43
|
+
loopDetector;
|
|
44
|
+
lastPromptId;
|
|
45
|
+
complexityAnalyzer;
|
|
46
|
+
todoReminderService;
|
|
47
|
+
todoContinuationService;
|
|
48
|
+
ideContextTracker;
|
|
49
|
+
agentHookManager;
|
|
50
|
+
/**
|
|
51
|
+
* Runtime state for stateless operation (Phase 5)
|
|
52
|
+
* @plan PLAN-20251027-STATELESS5.P10
|
|
53
|
+
* @requirement REQ-STAT5-003.1
|
|
54
|
+
* @pseudocode gemini-runtime.md lines 21-42
|
|
55
|
+
*/
|
|
56
|
+
runtimeState;
|
|
57
|
+
_historyService;
|
|
58
|
+
_unsubscribe;
|
|
59
|
+
/**
|
|
60
|
+
* BaseLLMClient for stateless utility operations (generateJson, embeddings, etc.)
|
|
61
|
+
* Lazily initialized when needed
|
|
62
|
+
*/
|
|
63
|
+
_baseLlmClient;
|
|
64
|
+
messageStreamOrchestrator;
|
|
65
|
+
/**
|
|
66
|
+
* @plan PLAN-20251027-STATELESS5.P10
|
|
67
|
+
* @requirement REQ-STAT5-003.1
|
|
68
|
+
* @pseudocode gemini-runtime.md lines 11-66
|
|
69
|
+
*
|
|
70
|
+
* Phase 5 constructor: Accept optional AgentRuntimeState and HistoryService
|
|
71
|
+
* When provided, client operates in stateless mode using runtime state
|
|
72
|
+
* Otherwise falls back to Config-based operation (backward compatibility)
|
|
73
|
+
*/
|
|
74
|
+
constructor(config, runtimeState, historyService) {
|
|
75
|
+
this.config = config;
|
|
76
|
+
if (!runtimeState.provider || runtimeState.provider === '') {
|
|
77
|
+
throw new Error('AgentRuntimeState must have a valid provider');
|
|
78
|
+
}
|
|
79
|
+
if (!runtimeState.model || runtimeState.model === '') {
|
|
80
|
+
throw new Error('AgentRuntimeState must have a valid model');
|
|
81
|
+
}
|
|
82
|
+
this.runtimeState = runtimeState;
|
|
83
|
+
this._historyService = historyService;
|
|
84
|
+
this.logger = new DebugLogger('llxprt:core:client');
|
|
85
|
+
this._unsubscribe = subscribeToAgentRuntimeState(runtimeState.runtimeId, (event) => {
|
|
86
|
+
this.logger.debug('Runtime state changed', event);
|
|
87
|
+
});
|
|
88
|
+
void this._historyService;
|
|
89
|
+
void this._unsubscribe;
|
|
90
|
+
const proxyUrl = runtimeState.proxyUrl;
|
|
91
|
+
if (proxyUrl) {
|
|
92
|
+
setGlobalDispatcher(new ProxyAgent(proxyUrl));
|
|
93
|
+
}
|
|
94
|
+
const embeddingModel = config.getEmbeddingModel();
|
|
95
|
+
this.embeddingModel = embeddingModel ?? runtimeState.model;
|
|
96
|
+
this.loopDetector = new LoopDetectionService(config);
|
|
97
|
+
this.lastPromptId = runtimeState.sessionId;
|
|
98
|
+
// Initialize complexity analyzer with config settings
|
|
99
|
+
const complexitySettings = config.getComplexityAnalyzerSettings();
|
|
100
|
+
this.complexityAnalyzer = new ComplexityAnalyzer({
|
|
101
|
+
complexityThreshold: complexitySettings.complexityThreshold,
|
|
102
|
+
minTasksForSuggestion: complexitySettings.minTasksForSuggestion,
|
|
103
|
+
});
|
|
104
|
+
const complexitySuggestionCooldown = complexitySettings.suggestionCooldownMs ?? 300000;
|
|
105
|
+
this.todoReminderService = new TodoReminderService();
|
|
106
|
+
this.todoContinuationService = new TodoContinuationService({
|
|
107
|
+
config,
|
|
108
|
+
todoReminderService: this.todoReminderService,
|
|
109
|
+
complexitySuggestionCooldown,
|
|
110
|
+
});
|
|
111
|
+
this.ideContextTracker = new IdeContextTracker(config);
|
|
112
|
+
this.agentHookManager = new AgentHookManager(config);
|
|
113
|
+
this.messageStreamOrchestrator = new MessageStreamOrchestrator(this._buildOrchestratorDeps());
|
|
114
|
+
coreEvents.on(CoreEvent.ModelChanged, this.handleModelChanged);
|
|
115
|
+
}
|
|
116
|
+
_buildOrchestratorDeps() {
|
|
117
|
+
return {
|
|
118
|
+
config: this.config,
|
|
119
|
+
getChat: () => this.getChat(),
|
|
120
|
+
logger: this.logger,
|
|
121
|
+
loopDetector: this.loopDetector,
|
|
122
|
+
todoContinuationService: this.todoContinuationService,
|
|
123
|
+
ideContextTracker: this.ideContextTracker,
|
|
124
|
+
agentHookManager: this.agentHookManager,
|
|
125
|
+
getEffectiveModel: () => this._getEffectiveModelForCurrentTurn(),
|
|
126
|
+
getHistory: () => this.getHistory(),
|
|
127
|
+
getSessionTurnCount: () => this.sessionTurnCount,
|
|
128
|
+
incrementSessionTurnCount: () => {
|
|
129
|
+
this.sessionTurnCount++;
|
|
130
|
+
},
|
|
131
|
+
lazyInitialize: () => this.lazyInitialize(),
|
|
132
|
+
startChat: (extraHistory) => this.startChat(extraHistory),
|
|
133
|
+
getPreviousHistory: () => this._previousHistory,
|
|
134
|
+
setChat: (chat) => {
|
|
135
|
+
this.chat = chat;
|
|
136
|
+
},
|
|
137
|
+
hasChat: () => this.chat !== undefined,
|
|
138
|
+
complexityAnalyzer: this.complexityAnalyzer,
|
|
139
|
+
getLastPromptId: () => this.lastPromptId,
|
|
140
|
+
setLastPromptId: (id) => {
|
|
141
|
+
this.lastPromptId = id;
|
|
142
|
+
},
|
|
143
|
+
resetCurrentSequenceModel: () => {
|
|
144
|
+
this.currentSequenceModel = null;
|
|
145
|
+
},
|
|
146
|
+
updateTelemetryTokenCount: () => this.updateTelemetryTokenCount(),
|
|
147
|
+
sendMessageStream: (req, sig, pid, trns, isRetry, is413) => this.sendMessageStream(req, sig, pid, trns, isRetry, is413),
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
handleModelChanged = () => {
|
|
151
|
+
this.currentSequenceModel = null;
|
|
152
|
+
};
|
|
153
|
+
dispose() {
|
|
154
|
+
coreEvents.off(CoreEvent.ModelChanged, this.handleModelChanged);
|
|
155
|
+
if (this._unsubscribe) {
|
|
156
|
+
this._unsubscribe();
|
|
157
|
+
this._unsubscribe = undefined;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
async initialize(contentGeneratorConfig) {
|
|
161
|
+
// Preserve chat history before resetting, but only if we don't already have stored history
|
|
162
|
+
// (e.g., from storeHistoryForLaterUse called before initialize)
|
|
163
|
+
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- intentional falsy coalescing: empty array means "no stored history"
|
|
164
|
+
const previousHistory = this._previousHistory || this.chat?.getHistory();
|
|
165
|
+
// Reset the client to force reinitialization with new auth
|
|
166
|
+
this.contentGenerator = undefined;
|
|
167
|
+
this.chat = undefined;
|
|
168
|
+
// Store the new config and previous history for lazy initialization
|
|
169
|
+
// This ensures the next lazyInitialize() call uses the correct auth config
|
|
170
|
+
// and preserves conversation history across auth transitions
|
|
171
|
+
this._pendingConfig = contentGeneratorConfig;
|
|
172
|
+
this._previousHistory = previousHistory;
|
|
173
|
+
}
|
|
174
|
+
async lazyInitialize() {
|
|
175
|
+
if (this.isInitialized()) {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
// Use pending config if available (from initialize() call), otherwise fall back to current config
|
|
179
|
+
const contentGenConfig = this._pendingConfig ?? this.config.getContentGeneratorConfig();
|
|
180
|
+
if (!contentGenConfig) {
|
|
181
|
+
throw new Error('Content generator config not initialized. Call config.refreshAuth() first.');
|
|
182
|
+
}
|
|
183
|
+
this.contentGenerator = await createContentGenerator(contentGenConfig, this.config, this.config.getSessionId());
|
|
184
|
+
// Don't create chat here - that causes infinite recursion with startChat()
|
|
185
|
+
// The chat will be created when needed
|
|
186
|
+
// Clear pending config after successful initialization
|
|
187
|
+
// Note: We do NOT clear _previousHistory as it may be needed for the chat context
|
|
188
|
+
this._pendingConfig = undefined;
|
|
189
|
+
}
|
|
190
|
+
getContentGenerator() {
|
|
191
|
+
if (!this.contentGenerator) {
|
|
192
|
+
throw new Error('Content generator not initialized');
|
|
193
|
+
}
|
|
194
|
+
return this.contentGenerator;
|
|
195
|
+
}
|
|
196
|
+
getUserTier() {
|
|
197
|
+
return this.contentGenerator?.userTier;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Get or create the BaseLLMClient for stateless utility operations.
|
|
201
|
+
* This is lazily initialized to avoid creating it when not needed.
|
|
202
|
+
*/
|
|
203
|
+
getBaseLlmClient() {
|
|
204
|
+
this._baseLlmClient ??= new BaseLLMClient(this.getContentGenerator());
|
|
205
|
+
return this._baseLlmClient;
|
|
206
|
+
}
|
|
207
|
+
async addHistory(content) {
|
|
208
|
+
// Ensure chat is initialized before adding history
|
|
209
|
+
if (!this.hasChatInitialized()) {
|
|
210
|
+
await this.resetChat();
|
|
211
|
+
}
|
|
212
|
+
this.getChat().addHistory(content);
|
|
213
|
+
}
|
|
214
|
+
async updateSystemInstruction() {
|
|
215
|
+
if (!this.isInitialized()) {
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
const enabledToolNames = getEnabledToolNamesForPrompt(this.config);
|
|
219
|
+
const envParts = await getEnvironmentContext(this.config);
|
|
220
|
+
const model = this.runtimeState.model;
|
|
221
|
+
const systemInstruction = await factoryBuildSystemInstruction(this.config, enabledToolNames, envParts, model);
|
|
222
|
+
this.getChat().setSystemInstruction(systemInstruction);
|
|
223
|
+
const historyService = this.getHistoryService();
|
|
224
|
+
if (historyService) {
|
|
225
|
+
try {
|
|
226
|
+
const systemPromptTokens = await historyService.estimateTokensForText(systemInstruction, model);
|
|
227
|
+
historyService.setBaseTokenOffset(systemPromptTokens);
|
|
228
|
+
}
|
|
229
|
+
catch {
|
|
230
|
+
// Token estimation failed - use fallback
|
|
231
|
+
historyService.setBaseTokenOffset(estimateTextTokens(systemInstruction));
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
getChat() {
|
|
236
|
+
if (!this.chat) {
|
|
237
|
+
throw new Error('Chat not initialized');
|
|
238
|
+
}
|
|
239
|
+
return this.chat;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Get the HistoryService from the current chat session
|
|
243
|
+
* @returns The HistoryService instance, or null if chat is not initialized
|
|
244
|
+
*/
|
|
245
|
+
getHistoryService() {
|
|
246
|
+
// Removed verbose debug logging
|
|
247
|
+
if (!this.hasChatInitialized()) {
|
|
248
|
+
return null;
|
|
249
|
+
}
|
|
250
|
+
const historyService = this.getChat().getHistoryService();
|
|
251
|
+
// Removed verbose debug logging
|
|
252
|
+
return historyService;
|
|
253
|
+
}
|
|
254
|
+
hasChatInitialized() {
|
|
255
|
+
const result = this.chat !== undefined;
|
|
256
|
+
// Removed verbose debug logging
|
|
257
|
+
return result;
|
|
258
|
+
}
|
|
259
|
+
isInitialized() {
|
|
260
|
+
return this.chat !== undefined && this.contentGenerator !== undefined;
|
|
261
|
+
}
|
|
262
|
+
async getHistory() {
|
|
263
|
+
// If we have stored history but no chat, return the stored history
|
|
264
|
+
if (!this.hasChatInitialized() && this._previousHistory) {
|
|
265
|
+
return this._previousHistory;
|
|
266
|
+
}
|
|
267
|
+
// If chat is initialized, get its current history
|
|
268
|
+
if (this.hasChatInitialized()) {
|
|
269
|
+
const chat = this.getChat();
|
|
270
|
+
if (typeof chat.waitForIdle === 'function') {
|
|
271
|
+
await chat.waitForIdle();
|
|
272
|
+
}
|
|
273
|
+
return chat.getHistory();
|
|
274
|
+
}
|
|
275
|
+
// No history available
|
|
276
|
+
return [];
|
|
277
|
+
}
|
|
278
|
+
async setHistory(history, { stripThoughts = false } = {}) {
|
|
279
|
+
const historyToSet = stripThoughts
|
|
280
|
+
? history.map((content) => {
|
|
281
|
+
const newContent = { ...content };
|
|
282
|
+
if (newContent.parts) {
|
|
283
|
+
newContent.parts = newContent.parts.map((part) => {
|
|
284
|
+
if (
|
|
285
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- Client runtime state crosses provider/session boundaries despite declared types.
|
|
286
|
+
part != null &&
|
|
287
|
+
typeof part === 'object' &&
|
|
288
|
+
'thoughtSignature' in part) {
|
|
289
|
+
const newPart = { ...part };
|
|
290
|
+
delete newPart
|
|
291
|
+
.thoughtSignature;
|
|
292
|
+
return newPart;
|
|
293
|
+
}
|
|
294
|
+
return part;
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
return newContent;
|
|
298
|
+
})
|
|
299
|
+
: history;
|
|
300
|
+
// Store the history for later use
|
|
301
|
+
this._previousHistory = historyToSet;
|
|
302
|
+
// If chat is already initialized, update it immediately
|
|
303
|
+
if (this.hasChatInitialized()) {
|
|
304
|
+
this.getChat().setHistory(historyToSet);
|
|
305
|
+
}
|
|
306
|
+
// Otherwise, the history will be used when the chat is initialized
|
|
307
|
+
// Reset IDE context tracking when history changes
|
|
308
|
+
this.ideContextTracker.resetContext();
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Store history for later use when the client is initialized.
|
|
312
|
+
* This is used when resuming a chat before authentication.
|
|
313
|
+
* The history will be restored when lazyInitialize() is called.
|
|
314
|
+
*/
|
|
315
|
+
storeHistoryForLaterUse(history) {
|
|
316
|
+
this.logger.debug('Storing history for later use', {
|
|
317
|
+
historyLength: history.length,
|
|
318
|
+
});
|
|
319
|
+
this._previousHistory = history;
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Store HistoryService instance for reuse after refreshAuth.
|
|
323
|
+
* This preserves the UI's conversation display across provider switches.
|
|
324
|
+
*/
|
|
325
|
+
storeHistoryServiceForReuse(historyService) {
|
|
326
|
+
this.logger.debug('Storing HistoryService for reuse', {
|
|
327
|
+
hasHistoryService: true,
|
|
328
|
+
});
|
|
329
|
+
this._storedHistoryService = historyService;
|
|
330
|
+
}
|
|
331
|
+
async setTools() {
|
|
332
|
+
const toolRegistry = this.config.getToolRegistry();
|
|
333
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- Client runtime state crosses provider/session boundaries despite declared types.
|
|
334
|
+
if (toolRegistry == null) {
|
|
335
|
+
return;
|
|
336
|
+
}
|
|
337
|
+
const toolsView = typeof this.chat?.getToolsView === 'function'
|
|
338
|
+
? this.chat.getToolsView()
|
|
339
|
+
: undefined;
|
|
340
|
+
const toolDeclarations = toolsView
|
|
341
|
+
? buildToolDeclarationsFromView(toolRegistry, toolsView)
|
|
342
|
+
: toolRegistry.getFunctionDeclarations();
|
|
343
|
+
this.todoContinuationService.updateTodoToolAvailabilityFromDeclarations(toolDeclarations);
|
|
344
|
+
// Debug log for intermittent tool issues
|
|
345
|
+
const logger = new DebugLogger('llxprt:client:setTools');
|
|
346
|
+
logger.debug(() => `setTools called, declarations count: ${toolDeclarations.length}`);
|
|
347
|
+
if (toolDeclarations.length === 0) {
|
|
348
|
+
logger.warn(() => `WARNING: setTools called but toolDeclarations is empty!`, {
|
|
349
|
+
stackTrace: new Error().stack,
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
const tools = [{ functionDeclarations: toolDeclarations }];
|
|
353
|
+
// Ensure chat is initialized before setting tools
|
|
354
|
+
if (!this.hasChatInitialized()) {
|
|
355
|
+
await this.resetChat();
|
|
356
|
+
}
|
|
357
|
+
this.getChat().setTools(tools);
|
|
358
|
+
}
|
|
359
|
+
clearTools() {
|
|
360
|
+
delete this.generateContentConfig.tools;
|
|
361
|
+
if (this.chat && typeof this.chat.clearTools === 'function') {
|
|
362
|
+
this.chat.clearTools();
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Updates the UI telemetry service with the current prompt token count from chat.
|
|
367
|
+
* This decouples ChatSession from directly knowing about uiTelemetryService.
|
|
368
|
+
*/
|
|
369
|
+
updateTelemetryTokenCount() {
|
|
370
|
+
if (this.chat) {
|
|
371
|
+
uiTelemetryService.setLastPromptTokenCount(this.chat.getLastPromptTokenCount());
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
async resetChat() {
|
|
375
|
+
// If chat exists, clear its history service
|
|
376
|
+
if (this.chat) {
|
|
377
|
+
const historyService = this.chat.getHistoryService();
|
|
378
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- Client runtime state crosses provider/session boundaries despite declared types.
|
|
379
|
+
if (historyService != null) {
|
|
380
|
+
// Clear the history service directly
|
|
381
|
+
historyService.clear();
|
|
382
|
+
}
|
|
383
|
+
else {
|
|
384
|
+
// Fallback to chat's clearHistory if no history service
|
|
385
|
+
this.chat.clearHistory();
|
|
386
|
+
}
|
|
387
|
+
// Reset the chat's internal state
|
|
388
|
+
this.ideContextTracker.resetContext();
|
|
389
|
+
}
|
|
390
|
+
else {
|
|
391
|
+
// No chat exists yet, create one with empty history
|
|
392
|
+
this.chat = await this.startChat([]);
|
|
393
|
+
}
|
|
394
|
+
this.updateTelemetryTokenCount();
|
|
395
|
+
// Clear the stored history as well
|
|
396
|
+
this._previousHistory = [];
|
|
397
|
+
}
|
|
398
|
+
async resumeChat(history) {
|
|
399
|
+
this.chat = await this.startChat(history);
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* Restore history from a session by ensuring chat and content generator are fully initialized,
|
|
403
|
+
* then adding history items to the HistoryService.
|
|
404
|
+
*
|
|
405
|
+
* P0 Fix: Synchronously initializes chat/content generator if needed before attempting history restore.
|
|
406
|
+
* This ensures the history service is available immediately after the call completes.
|
|
407
|
+
*
|
|
408
|
+
* @param historyItems Array of IContent items from persisted session
|
|
409
|
+
* @returns Promise that resolves when history is fully restored and chat is ready
|
|
410
|
+
* @throws Error if initialization fails (e.g., auth not ready, config missing)
|
|
411
|
+
*/
|
|
412
|
+
async restoreHistory(historyItems) {
|
|
413
|
+
this.logger.debug('restoreHistory called', {
|
|
414
|
+
itemCount: historyItems.length,
|
|
415
|
+
hasContentGenerator: !!this.contentGenerator,
|
|
416
|
+
hasChatInitialized: this.hasChatInitialized(),
|
|
417
|
+
});
|
|
418
|
+
if (historyItems.length === 0) {
|
|
419
|
+
this.logger.warn('restoreHistory called with empty history array');
|
|
420
|
+
return;
|
|
421
|
+
}
|
|
422
|
+
// P0 Fix Part 1: Ensure content generator is initialized
|
|
423
|
+
// This will fail fast if auth/config isn't ready
|
|
424
|
+
if (!this.contentGenerator) {
|
|
425
|
+
try {
|
|
426
|
+
await this.lazyInitialize();
|
|
427
|
+
}
|
|
428
|
+
catch (err) {
|
|
429
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
430
|
+
throw new Error(`Cannot restore history: Content generator initialization failed. ${message}`);
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
// P0 Fix Part 2: Ensure chat is initialized with empty history
|
|
434
|
+
// We create the chat first, then populate it with restored history
|
|
435
|
+
if (!this.hasChatInitialized()) {
|
|
436
|
+
try {
|
|
437
|
+
this.chat = await this.startChat([]);
|
|
438
|
+
}
|
|
439
|
+
catch (err) {
|
|
440
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
441
|
+
throw new Error(`Cannot restore history: Chat initialization failed. ${message}`);
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
// P0 Fix Part 3: Get history service and restore items
|
|
445
|
+
const historyService = this.getHistoryService();
|
|
446
|
+
if (!historyService) {
|
|
447
|
+
throw new Error('Cannot restore history: History service unavailable after chat initialization');
|
|
448
|
+
}
|
|
449
|
+
try {
|
|
450
|
+
// Validate and fix any issues in the history service before adding items
|
|
451
|
+
historyService.validateAndFix();
|
|
452
|
+
// Add all history items
|
|
453
|
+
historyService.addAll(historyItems);
|
|
454
|
+
this.logger.debug('History restored successfully', {
|
|
455
|
+
itemCount: historyItems.length,
|
|
456
|
+
totalTokens: historyService.getTotalTokens(),
|
|
457
|
+
});
|
|
458
|
+
}
|
|
459
|
+
catch (err) {
|
|
460
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
461
|
+
throw new Error(`Failed to add history items to service: ${message}`);
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
getCurrentSequenceModel() {
|
|
465
|
+
return this.currentSequenceModel;
|
|
466
|
+
}
|
|
467
|
+
async addDirectoryContext() {
|
|
468
|
+
if (!this.chat) {
|
|
469
|
+
return;
|
|
470
|
+
}
|
|
471
|
+
this.getChat().addHistory({
|
|
472
|
+
role: 'user',
|
|
473
|
+
parts: [{ text: await getDirectoryContextString(this.config) }],
|
|
474
|
+
});
|
|
475
|
+
}
|
|
476
|
+
async generateDirectMessage(params, promptId) {
|
|
477
|
+
await this.lazyInitialize();
|
|
478
|
+
this.chat ??= await this.startChat([]);
|
|
479
|
+
return this.getChat().generateDirectMessage(params, promptId);
|
|
480
|
+
}
|
|
481
|
+
async startChat(extraHistory) {
|
|
482
|
+
this.ideContextTracker.resetContext();
|
|
483
|
+
await this.lazyInitialize();
|
|
484
|
+
const chat = await createChatSessionSafe({
|
|
485
|
+
config: this.config,
|
|
486
|
+
runtimeState: this.runtimeState,
|
|
487
|
+
contentGenerator: this.getContentGenerator(),
|
|
488
|
+
storedHistoryService: this._storedHistoryService,
|
|
489
|
+
clearStoredHistoryService: () => {
|
|
490
|
+
this._storedHistoryService = undefined;
|
|
491
|
+
},
|
|
492
|
+
extraHistory,
|
|
493
|
+
generateContentConfig: this.generateContentConfig,
|
|
494
|
+
todoContinuationService: this.todoContinuationService,
|
|
495
|
+
toolRegistry: this.config.getToolRegistry(),
|
|
496
|
+
});
|
|
497
|
+
this.chat = chat;
|
|
498
|
+
return chat;
|
|
499
|
+
}
|
|
500
|
+
_getEffectiveModelForCurrentTurn() {
|
|
501
|
+
if (this.currentSequenceModel) {
|
|
502
|
+
return this.currentSequenceModel;
|
|
503
|
+
}
|
|
504
|
+
// In LLxprt, config.getModel() already handles provider-specific model resolution
|
|
505
|
+
// and fallback mode, so we just return it directly
|
|
506
|
+
return this.config.getModel();
|
|
507
|
+
}
|
|
508
|
+
async *sendMessageStream(initialRequest, signal, prompt_id, turns = this.MAX_TURNS, isInvalidStreamRetry = false, is413Retry = false) {
|
|
509
|
+
return yield* this.messageStreamOrchestrator.execute(initialRequest, signal, prompt_id, turns, isInvalidStreamRetry, is413Retry);
|
|
510
|
+
}
|
|
511
|
+
async generateJson(contents, schema, abortSignal, model, config = {}) {
|
|
512
|
+
await this.lazyInitialize();
|
|
513
|
+
return clientLlmGenerateJson(this.config, this.getContentGenerator(), this.getBaseLlmClient(), contents, schema, abortSignal, model, { ...this.generateContentConfig, ...config }, this.lastPromptId ?? this.config.getSessionId());
|
|
514
|
+
}
|
|
515
|
+
async generateContent(contents, generationConfig, abortSignal, model) {
|
|
516
|
+
await this.lazyInitialize();
|
|
517
|
+
return clientLlmGenerateContent(this.config, this.getContentGenerator(), contents, generationConfig, abortSignal, model, this.lastPromptId ?? this.config.getSessionId(), this.generateContentConfig);
|
|
518
|
+
}
|
|
519
|
+
async generateEmbedding(texts) {
|
|
520
|
+
await this.lazyInitialize();
|
|
521
|
+
return clientLlmGenerateEmbedding(this.getBaseLlmClient(), texts, this.embeddingModel);
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/core/client.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAUH,OAAO,EACL,yBAAyB,EACzB,qBAAqB,GACtB,MAAM,yDAAyD,CAAC;AAMjE,OAAO,EACL,6BAA6B,EAC7B,4BAA4B,GAC7B,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,WAAW,EAAE,MAAM,4CAA4C,CAAC;AAGzE,OAAO,EAGL,sBAAsB,GACvB,MAAM,sDAAsD,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,8DAA8D,CAAC;AAEpG,OAAO,EAAE,kBAAkB,EAAE,MAAM,6DAA6D,CAAC;AACjG,OAAO,EAAE,mBAAmB,EAAE,MAAM,+DAA+D,CAAC;AACpG,OAAO,EAAE,kBAAkB,EAAE,MAAM,sDAAsD,CAAC;AAE1F,OAAO,EAAE,4BAA4B,EAAE,MAAM,0DAA0D,CAAC;AACxG,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD,OAAO,EACL,UAAU,EACV,SAAS,GACV,MAAM,6CAA6C,CAAC;A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AC3B,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,iBAAiB,CAAC,KAAe;QACrC,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;QAC5B,OAAO,0BAA0B,CAC/B,IAAI,CAAC,gBAAgB,EAAE,EACvB,KAAK,EACL,IAAI,CAAC,cAAc,CACpB,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { type PartListUnion, type Content } from '@google/genai';
|
|
7
|
+
export declare function isThinkingSupported(model: string): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Returns the index of the content after the fraction of the total characters in the history.
|
|
10
|
+
*
|
|
11
|
+
* Exported for testing purposes.
|
|
12
|
+
*/
|
|
13
|
+
export declare function findCompressSplitPoint(contents: Content[], fraction: number): number;
|
|
14
|
+
export declare function extractPromptText(request: PartListUnion): string;
|
|
15
|
+
export declare function estimateTextOnlyLength(request: PartListUnion): number;
|