@vybestack/llxprt-code-core 0.1.23 → 0.2.2-nightly.250908.fb8099b7
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/README.md +21 -17
- package/dist/src/adapters/IStreamAdapter.d.ts +3 -3
- package/dist/src/auth/oauth-errors.d.ts +173 -0
- package/dist/src/auth/oauth-errors.js +461 -0
- package/dist/src/auth/oauth-errors.js.map +1 -0
- package/dist/src/auth/precedence.d.ts +1 -5
- package/dist/src/auth/precedence.js +28 -48
- package/dist/src/auth/precedence.js.map +1 -1
- package/dist/src/auth/token-store.js +2 -2
- package/dist/src/auth/token-store.js.map +1 -1
- package/dist/src/auth/types.d.ts +4 -4
- package/dist/src/code_assist/codeAssist.js +19 -6
- package/dist/src/code_assist/codeAssist.js.map +1 -1
- package/dist/src/code_assist/oauth2.d.ts +7 -0
- package/dist/src/code_assist/oauth2.js +82 -32
- package/dist/src/code_assist/oauth2.js.map +1 -1
- package/dist/src/code_assist/server.js +15 -4
- package/dist/src/code_assist/server.js.map +1 -1
- package/dist/src/code_assist/setup.js +9 -0
- package/dist/src/code_assist/setup.js.map +1 -1
- package/dist/src/config/index.d.ts +7 -0
- package/dist/src/config/index.js +8 -0
- package/dist/src/config/index.js.map +1 -0
- package/dist/src/core/client.d.ts +15 -20
- package/dist/src/core/client.js +98 -124
- package/dist/src/core/client.js.map +1 -1
- package/dist/src/core/compression-config.d.ts +10 -0
- package/dist/src/core/compression-config.js +17 -0
- package/dist/src/core/compression-config.js.map +1 -0
- package/dist/src/core/coreToolScheduler.js +50 -15
- package/dist/src/core/coreToolScheduler.js.map +1 -1
- package/dist/src/core/geminiChat.d.ts +68 -9
- package/dist/src/core/geminiChat.js +940 -405
- package/dist/src/core/geminiChat.js.map +1 -1
- package/dist/src/core/nonInteractiveToolExecutor.js +70 -19
- package/dist/src/core/nonInteractiveToolExecutor.js.map +1 -1
- package/dist/src/core/prompts.js +35 -25
- package/dist/src/core/prompts.js.map +1 -1
- package/dist/src/core/turn.d.ts +1 -0
- package/dist/src/core/turn.js +8 -6
- package/dist/src/core/turn.js.map +1 -1
- package/dist/src/ide/ide-client.d.ts +1 -1
- package/dist/src/ide/ide-client.js +12 -6
- package/dist/src/ide/ide-client.js.map +1 -1
- package/dist/src/index.d.ts +4 -2
- package/dist/src/index.js +5 -2
- package/dist/src/index.js.map +1 -1
- package/dist/src/prompt-config/TemplateEngine.js +17 -0
- package/dist/src/prompt-config/TemplateEngine.js.map +1 -1
- package/dist/src/prompt-config/defaults/core-defaults.js +39 -32
- package/dist/src/prompt-config/defaults/core-defaults.js.map +1 -1
- package/dist/src/prompt-config/defaults/core.md +2 -0
- package/dist/src/prompt-config/defaults/provider-defaults.js +34 -27
- package/dist/src/prompt-config/defaults/provider-defaults.js.map +1 -1
- package/dist/src/prompt-config/defaults/providers/gemini/core.md +270 -0
- package/dist/src/prompt-config/defaults/providers/gemini/models/gemini-2.5-flash/core.md +12 -0
- package/dist/src/prompt-config/defaults/providers/gemini/models/gemini-2.5-flash/gemini-2-5-flash/core.md +12 -0
- package/dist/src/prompt-config/types.d.ts +2 -0
- package/dist/src/providers/BaseProvider.d.ts +39 -13
- package/dist/src/providers/BaseProvider.js +102 -28
- package/dist/src/providers/BaseProvider.js.map +1 -1
- package/dist/src/providers/IProvider.d.ts +17 -3
- package/dist/src/providers/LoggingProviderWrapper.d.ts +10 -3
- package/dist/src/providers/LoggingProviderWrapper.js +33 -27
- package/dist/src/providers/LoggingProviderWrapper.js.map +1 -1
- package/dist/src/providers/ProviderContentGenerator.d.ts +2 -2
- package/dist/src/providers/ProviderContentGenerator.js +9 -6
- package/dist/src/providers/ProviderContentGenerator.js.map +1 -1
- package/dist/src/providers/ProviderManager.d.ts +4 -0
- package/dist/src/providers/ProviderManager.js +6 -0
- package/dist/src/providers/ProviderManager.js.map +1 -1
- package/dist/src/providers/anthropic/AnthropicProvider.d.ts +34 -21
- package/dist/src/providers/anthropic/AnthropicProvider.js +505 -492
- package/dist/src/providers/anthropic/AnthropicProvider.js.map +1 -1
- package/dist/src/providers/gemini/GeminiProvider.d.ts +23 -9
- package/dist/src/providers/gemini/GeminiProvider.js +344 -515
- package/dist/src/providers/gemini/GeminiProvider.js.map +1 -1
- package/dist/src/providers/openai/ConversationCache.d.ts +3 -3
- package/dist/src/providers/openai/IChatGenerateParams.d.ts +9 -4
- package/dist/src/providers/openai/OpenAIProvider.d.ts +46 -96
- package/dist/src/providers/openai/OpenAIProvider.js +532 -1393
- package/dist/src/providers/openai/OpenAIProvider.js.map +1 -1
- package/dist/src/providers/openai/buildResponsesRequest.d.ts +3 -3
- package/dist/src/providers/openai/buildResponsesRequest.js +67 -37
- package/dist/src/providers/openai/buildResponsesRequest.js.map +1 -1
- package/dist/src/providers/openai/estimateRemoteTokens.d.ts +2 -2
- package/dist/src/providers/openai/estimateRemoteTokens.js +21 -8
- package/dist/src/providers/openai/estimateRemoteTokens.js.map +1 -1
- package/dist/src/providers/openai/parseResponsesStream.d.ts +6 -2
- package/dist/src/providers/openai/parseResponsesStream.js +99 -391
- package/dist/src/providers/openai/parseResponsesStream.js.map +1 -1
- package/dist/src/providers/openai/syntheticToolResponses.d.ts +5 -5
- package/dist/src/providers/openai/syntheticToolResponses.js +102 -91
- package/dist/src/providers/openai/syntheticToolResponses.js.map +1 -1
- package/dist/src/providers/openai-responses/OpenAIResponsesProvider.d.ts +89 -0
- package/dist/src/providers/openai-responses/OpenAIResponsesProvider.js +451 -0
- package/dist/src/providers/openai-responses/OpenAIResponsesProvider.js.map +1 -0
- package/dist/src/providers/openai-responses/index.d.ts +1 -0
- package/dist/src/providers/openai-responses/index.js +2 -0
- package/dist/src/providers/openai-responses/index.js.map +1 -0
- package/dist/src/providers/tokenizers/OpenAITokenizer.js +3 -3
- package/dist/src/providers/tokenizers/OpenAITokenizer.js.map +1 -1
- package/dist/src/providers/types.d.ts +1 -1
- package/dist/src/services/ClipboardService.d.ts +19 -0
- package/dist/src/services/ClipboardService.js +66 -0
- package/dist/src/services/ClipboardService.js.map +1 -0
- package/dist/src/services/history/ContentConverters.d.ts +43 -0
- package/dist/src/services/history/ContentConverters.js +325 -0
- package/dist/src/services/history/ContentConverters.js.map +1 -0
- package/dist/src/{providers/IMessage.d.ts → services/history/HistoryEvents.d.ts} +16 -22
- package/dist/src/{providers/IMessage.js → services/history/HistoryEvents.js} +1 -1
- package/dist/src/services/history/HistoryEvents.js.map +1 -0
- package/dist/src/services/history/HistoryService.d.ts +220 -0
- package/dist/src/services/history/HistoryService.js +673 -0
- package/dist/src/services/history/HistoryService.js.map +1 -0
- package/dist/src/services/history/IContent.d.ts +183 -0
- package/dist/src/services/history/IContent.js +104 -0
- package/dist/src/services/history/IContent.js.map +1 -0
- package/dist/src/services/index.d.ts +1 -0
- package/dist/src/services/index.js +1 -0
- package/dist/src/services/index.js.map +1 -1
- package/dist/src/telemetry/types.d.ts +16 -4
- package/dist/src/telemetry/types.js.map +1 -1
- package/dist/src/tools/IToolFormatter.d.ts +2 -2
- package/dist/src/tools/ToolFormatter.d.ts +42 -4
- package/dist/src/tools/ToolFormatter.js +159 -37
- package/dist/src/tools/ToolFormatter.js.map +1 -1
- package/dist/src/tools/doubleEscapeUtils.d.ts +57 -0
- package/dist/src/tools/doubleEscapeUtils.js +241 -0
- package/dist/src/tools/doubleEscapeUtils.js.map +1 -0
- package/dist/src/tools/read-file.d.ts +6 -1
- package/dist/src/tools/read-file.js +25 -11
- package/dist/src/tools/read-file.js.map +1 -1
- package/dist/src/tools/todo-schemas.d.ts +4 -4
- package/dist/src/tools/tools.js +13 -0
- package/dist/src/tools/tools.js.map +1 -1
- package/dist/src/tools/write-file.d.ts +6 -1
- package/dist/src/tools/write-file.js +48 -26
- package/dist/src/tools/write-file.js.map +1 -1
- package/dist/src/types/modelParams.d.ts +8 -0
- package/dist/src/utils/bfsFileSearch.js +2 -6
- package/dist/src/utils/bfsFileSearch.js.map +1 -1
- package/dist/src/utils/schemaValidator.js +16 -1
- package/dist/src/utils/schemaValidator.js.map +1 -1
- package/package.json +8 -7
- package/dist/src/providers/IMessage.js.map +0 -1
- package/dist/src/providers/adapters/GeminiCompatibleWrapper.d.ts +0 -69
- package/dist/src/providers/adapters/GeminiCompatibleWrapper.js +0 -577
- package/dist/src/providers/adapters/GeminiCompatibleWrapper.js.map +0 -1
@@ -3,7 +3,6 @@
|
|
3
3
|
* Copyright 2025 Vybestack LLC
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
5
5
|
*/
|
6
|
-
import { ContentGeneratorRole } from '../../index.js';
|
7
6
|
import { DebugLogger } from '../../debug/DebugLogger.js';
|
8
7
|
/**
|
9
8
|
* Creates synthetic tool responses for cancelled tool calls to maintain
|
@@ -24,14 +23,20 @@ export class SyntheticToolResponseHandler {
|
|
24
23
|
*/
|
25
24
|
static createSyntheticResponses(cancelledTools) {
|
26
25
|
return cancelledTools.map((tool) => ({
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
26
|
+
speaker: 'tool',
|
27
|
+
blocks: [
|
28
|
+
{
|
29
|
+
type: 'tool_response',
|
30
|
+
callId: tool.toolCallId,
|
31
|
+
toolName: tool.toolName || 'unknown',
|
32
|
+
result: 'Tool execution cancelled by user',
|
33
|
+
error: 'Cancelled by user',
|
34
|
+
},
|
35
|
+
],
|
36
|
+
metadata: {
|
37
|
+
synthetic: true,
|
38
|
+
reason: 'cancelled_by_user',
|
39
|
+
},
|
35
40
|
}));
|
36
41
|
}
|
37
42
|
/**
|
@@ -44,25 +49,33 @@ export class SyntheticToolResponseHandler {
|
|
44
49
|
const toolCallIds = new Set();
|
45
50
|
const toolResponseIds = new Set();
|
46
51
|
const syntheticResponseIds = new Set();
|
47
|
-
// Collect all tool call IDs from
|
52
|
+
// Collect all tool call IDs from AI messages
|
48
53
|
messages.forEach((msg) => {
|
49
|
-
if (msg.
|
50
|
-
msg.
|
51
|
-
if (
|
52
|
-
|
54
|
+
if (msg.speaker === 'ai') {
|
55
|
+
msg.blocks.forEach((block) => {
|
56
|
+
if (block.type === 'tool_call') {
|
57
|
+
const toolCallBlock = block;
|
58
|
+
if (toolCallBlock.id) {
|
59
|
+
toolCallIds.add(toolCallBlock.id);
|
60
|
+
}
|
53
61
|
}
|
54
62
|
});
|
55
63
|
}
|
56
64
|
});
|
57
65
|
// Collect all tool response IDs (including synthetic ones)
|
58
66
|
messages.forEach((msg) => {
|
59
|
-
if (msg.
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
67
|
+
if (msg.speaker === 'tool') {
|
68
|
+
msg.blocks.forEach((block) => {
|
69
|
+
if (block.type === 'tool_response') {
|
70
|
+
const toolResponseBlock = block;
|
71
|
+
toolResponseIds.add(toolResponseBlock.callId);
|
72
|
+
// Track synthetic responses separately for debugging
|
73
|
+
if (msg.metadata?.synthetic ||
|
74
|
+
toolResponseBlock.result === 'Tool execution cancelled by user') {
|
75
|
+
syntheticResponseIds.add(toolResponseBlock.callId);
|
76
|
+
}
|
77
|
+
}
|
78
|
+
});
|
66
79
|
}
|
67
80
|
});
|
68
81
|
// Log if we found existing synthetic responses
|
@@ -86,82 +99,77 @@ export class SyntheticToolResponseHandler {
|
|
86
99
|
*/
|
87
100
|
static patchMessageHistory(messages) {
|
88
101
|
logger.debug(() => `patchMessageHistory called with ${messages.length} messages`);
|
89
|
-
logger.debug(() => `Message
|
102
|
+
logger.debug(() => `Message speakers: ${messages
|
103
|
+
.map((m) => {
|
104
|
+
const toolCalls = m.blocks.filter((b) => b.type === 'tool_call').length;
|
105
|
+
const toolResponses = m.blocks.filter((b) => b.type === 'tool_response').length;
|
106
|
+
return `${m.speaker}${toolCalls > 0 ? `(${toolCalls} tools)` : ''}${toolResponses > 0 ? `(${toolResponses} responses)` : ''}`;
|
107
|
+
})
|
108
|
+
.join(', ')}`);
|
90
109
|
// First identify missing tool responses from original messages
|
91
110
|
const missingToolIds = this.identifyMissingToolResponses(messages);
|
92
111
|
logger.debug(() => `Missing tool IDs: ${JSON.stringify(missingToolIds)}`);
|
93
112
|
// Always create a deep copy to avoid mutation issues with immutable objects
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
...('_cancelled' in msg
|
129
|
-
? {
|
130
|
-
_cancelled: msg
|
131
|
-
._cancelled,
|
132
|
-
}
|
133
|
-
: {}),
|
134
|
-
...('name' in msg
|
135
|
-
? { name: msg.name }
|
136
|
-
: {}),
|
137
|
-
});
|
138
|
-
return copiedMsg;
|
139
|
-
});
|
113
|
+
const deepCopyMessages = messages.map((msg) => ({
|
114
|
+
speaker: msg.speaker,
|
115
|
+
blocks: msg.blocks.map((block) => {
|
116
|
+
// Deep copy each block
|
117
|
+
if (block.type === 'tool_call') {
|
118
|
+
const tcBlock = block;
|
119
|
+
return {
|
120
|
+
type: 'tool_call',
|
121
|
+
id: tcBlock.id,
|
122
|
+
name: tcBlock.name,
|
123
|
+
parameters: JSON.parse(JSON.stringify(tcBlock.parameters)),
|
124
|
+
description: tcBlock.description,
|
125
|
+
};
|
126
|
+
}
|
127
|
+
else if (block.type === 'tool_response') {
|
128
|
+
const trBlock = block;
|
129
|
+
return {
|
130
|
+
type: 'tool_response',
|
131
|
+
callId: trBlock.callId,
|
132
|
+
toolName: trBlock.toolName,
|
133
|
+
result: JSON.parse(JSON.stringify(trBlock.result)),
|
134
|
+
error: trBlock.error,
|
135
|
+
isComplete: trBlock.isComplete,
|
136
|
+
};
|
137
|
+
}
|
138
|
+
else {
|
139
|
+
// For other block types, use structured cloning
|
140
|
+
return JSON.parse(JSON.stringify(block));
|
141
|
+
}
|
142
|
+
}),
|
143
|
+
metadata: msg.metadata
|
144
|
+
? JSON.parse(JSON.stringify(msg.metadata))
|
145
|
+
: undefined,
|
146
|
+
}));
|
140
147
|
if (missingToolIds.length === 0) {
|
141
148
|
return deepCopyMessages;
|
142
149
|
}
|
143
|
-
// Find the last
|
144
|
-
let
|
150
|
+
// Find the last AI message with tool calls
|
151
|
+
let lastAIIndex = -1;
|
145
152
|
for (let i = deepCopyMessages.length - 1; i >= 0; i--) {
|
146
|
-
if (deepCopyMessages[i].
|
147
|
-
deepCopyMessages[i].
|
148
|
-
|
153
|
+
if (deepCopyMessages[i].speaker === 'ai' &&
|
154
|
+
deepCopyMessages[i].blocks.some((b) => b.type === 'tool_call')) {
|
155
|
+
lastAIIndex = i;
|
149
156
|
break;
|
150
157
|
}
|
151
158
|
}
|
152
|
-
if (
|
159
|
+
if (lastAIIndex === -1) {
|
153
160
|
return deepCopyMessages;
|
154
161
|
}
|
155
|
-
// Extract tool names from the
|
162
|
+
// Extract tool names from the AI message
|
156
163
|
const toolNameMap = new Map();
|
157
|
-
const
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
164
|
+
const aiMsg = deepCopyMessages[lastAIIndex];
|
165
|
+
aiMsg.blocks.forEach((block) => {
|
166
|
+
if (block.type === 'tool_call') {
|
167
|
+
const toolCallBlock = block;
|
168
|
+
if (toolCallBlock.id && toolCallBlock.name) {
|
169
|
+
toolNameMap.set(toolCallBlock.id, toolCallBlock.name);
|
162
170
|
}
|
163
|
-
}
|
164
|
-
}
|
171
|
+
}
|
172
|
+
});
|
165
173
|
// Create synthetic responses with tool names
|
166
174
|
const cancelledTools = missingToolIds.map((id) => ({
|
167
175
|
toolCallId: id,
|
@@ -171,15 +179,13 @@ export class SyntheticToolResponseHandler {
|
|
171
179
|
logger.debug(() => `Created ${syntheticResponses.length} synthetic responses`);
|
172
180
|
syntheticResponses.forEach((sr) => {
|
173
181
|
logger.debug(() => `Synthetic response: ${JSON.stringify({
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
_synthetic: sr._synthetic,
|
178
|
-
_cancelled: sr._cancelled,
|
182
|
+
speaker: sr.speaker,
|
183
|
+
blocks: sr.blocks,
|
184
|
+
synthetic: sr.metadata?.synthetic,
|
179
185
|
})}`);
|
180
186
|
});
|
181
|
-
// Insert synthetic responses right after the
|
182
|
-
deepCopyMessages.splice(
|
187
|
+
// Insert synthetic responses right after the AI message
|
188
|
+
deepCopyMessages.splice(lastAIIndex + 1, 0, ...syntheticResponses);
|
183
189
|
logger.debug(() => `Final message count after patching: ${deepCopyMessages.length}`);
|
184
190
|
return deepCopyMessages;
|
185
191
|
}
|
@@ -191,8 +197,13 @@ export class SyntheticToolResponseHandler {
|
|
191
197
|
*/
|
192
198
|
static addCancellationNotice(messages, cancelledCount) {
|
193
199
|
const notice = {
|
194
|
-
|
195
|
-
|
200
|
+
speaker: 'ai',
|
201
|
+
blocks: [
|
202
|
+
{
|
203
|
+
type: 'text',
|
204
|
+
text: `${cancelledCount} tool execution${cancelledCount > 1 ? 's were' : ' was'} cancelled. You can retry specific tools or continue with the conversation.`,
|
205
|
+
},
|
206
|
+
],
|
196
207
|
};
|
197
208
|
return [...messages, notice];
|
198
209
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"syntheticToolResponses.js","sourceRoot":"","sources":["../../../../src/providers/openai/syntheticToolResponses.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
1
|
+
{"version":3,"file":"syntheticToolResponses.js","sourceRoot":"","sources":["../../../../src/providers/openai/syntheticToolResponses.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAWzD;;;;;;;;GAQG;AACH,yCAAyC;AACzC,MAAM,MAAM,GAAG,IAAI,WAAW,CAAC,mCAAmC,CAAC,CAAC;AAEpE,MAAM,OAAO,4B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,kBAAkB,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE;YAChC,MAAM,CAAC,KAAK,CACV,GAAG,EAAE,CACH,uBAAuB,IAAI,CAAC,SAAS,CAAC;gBACpC,OAAO,EAAE,EAAE,CAAC,OAAO;gBACnB,MAAM,EAAE,EAAE,CAAC,MAAM;gBACjB,SAAS,EAAE,EAAE,CAAC,QAAQ,EAAE,SAAS;aAClC,CAAC,EAAE,CACP,CAAC;QACJ,CAAC,CAAC,CAAC;QAEH,wDAAwD;QACxD,gBAAgB,CAAC,MAAM,CAAC,WAAW,GAAG,CAAC,EAAE,CAAC,EAAE,GAAG,kBAAkB,CAAC,CAAC;QACnE,MAAM,CAAC,KAAK,CACV,GAAG,EAAE,CAAC,uCAAuC,gBAAgB,CAAC,MAAM,EAAE,CACvE,CAAC;QAEF,OAAO,gBAAgB,CAAC;IAC1B,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,qBAAqB,CAC1B,QAAoB,EACpB,cAAsB;QAEtB,MAAM,MAAM,GAAa;YACvB,OAAO,EAAE,IAAI;YACb,MAAM,EAAE;gBACN;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,GAAG,cAAc,kBAAkB,cAAc,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,6EAA6E;iBAC7J;aACF;SACF,CAAC;QAEF,OAAO,CAAC,GAAG,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC/B,CAAC;CACF"}
|
@@ -0,0 +1,89 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright 2025 Vybestack LLC
|
3
|
+
*
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
* you may not use this file except in compliance with the License.
|
6
|
+
* You may obtain a copy of the License at
|
7
|
+
*
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
*
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
* See the License for the specific language governing permissions and
|
14
|
+
* limitations under the License.
|
15
|
+
*/
|
16
|
+
import { IModel } from '../IModel.js';
|
17
|
+
import { IContent } from '../../services/history/IContent.js';
|
18
|
+
import { ToolFormat } from '../../tools/IToolFormatter.js';
|
19
|
+
import { IProviderConfig } from '../types/IProviderConfig.js';
|
20
|
+
import { ConversationCache } from '../openai/ConversationCache.js';
|
21
|
+
import { BaseProvider } from '../BaseProvider.js';
|
22
|
+
export declare class OpenAIResponsesProvider extends BaseProvider {
|
23
|
+
/**
|
24
|
+
* Converts Gemini schema format (with uppercase Type enums) to standard JSON Schema format
|
25
|
+
*/
|
26
|
+
private convertGeminiSchemaToStandard;
|
27
|
+
private logger;
|
28
|
+
private currentModel;
|
29
|
+
private conversationCache;
|
30
|
+
private modelParams?;
|
31
|
+
constructor(apiKey: string | undefined, baseURL?: string, config?: IProviderConfig);
|
32
|
+
/**
|
33
|
+
* This provider does not support OAuth
|
34
|
+
*/
|
35
|
+
protected supportsOAuth(): boolean;
|
36
|
+
getToolFormat(): ToolFormat;
|
37
|
+
getModels(): Promise<IModel[]>;
|
38
|
+
setModel(modelId: string): void;
|
39
|
+
getCurrentModel(): string;
|
40
|
+
getDefaultModel(): string;
|
41
|
+
setApiKey(apiKey: string): void;
|
42
|
+
setBaseUrl(baseUrl?: string): void;
|
43
|
+
setConfig(config: IProviderConfig): void;
|
44
|
+
setToolFormatOverride(format: ToolFormat | null): void;
|
45
|
+
/**
|
46
|
+
* Get the conversation cache instance
|
47
|
+
*/
|
48
|
+
getConversationCache(): ConversationCache;
|
49
|
+
/**
|
50
|
+
* OpenAI Responses API always requires payment (API key)
|
51
|
+
*/
|
52
|
+
isPaidMode(): boolean;
|
53
|
+
clearState(): void;
|
54
|
+
/**
|
55
|
+
* Get the list of server tools supported by this provider
|
56
|
+
*/
|
57
|
+
getServerTools(): string[];
|
58
|
+
/**
|
59
|
+
* Invoke a server tool (native provider tool)
|
60
|
+
*/
|
61
|
+
invokeServerTool(_toolName: string, _params: unknown, _config?: unknown): Promise<unknown>;
|
62
|
+
/**
|
63
|
+
* Set model parameters to be included in API calls
|
64
|
+
*/
|
65
|
+
setModelParams(params: Record<string, unknown> | undefined): void;
|
66
|
+
/**
|
67
|
+
* Get current model parameters
|
68
|
+
*/
|
69
|
+
getModelParams(): Record<string, unknown> | undefined;
|
70
|
+
/**
|
71
|
+
* Initialize provider configuration from SettingsService
|
72
|
+
*/
|
73
|
+
private initializeFromSettings;
|
74
|
+
/**
|
75
|
+
* Check if the provider is authenticated using any available method
|
76
|
+
*/
|
77
|
+
isAuthenticated(): Promise<boolean>;
|
78
|
+
/**
|
79
|
+
* Generate chat completion with IContent interface
|
80
|
+
* Direct implementation for OpenAI Responses API with IContent interface
|
81
|
+
*/
|
82
|
+
generateChatCompletion(content: IContent[], tools?: Array<{
|
83
|
+
functionDeclarations: Array<{
|
84
|
+
name: string;
|
85
|
+
description?: string;
|
86
|
+
parameters?: unknown;
|
87
|
+
}>;
|
88
|
+
}>, _toolFormat?: string): AsyncIterableIterator<IContent>;
|
89
|
+
}
|