@vybestack/llxprt-code-core 0.6.1-nightly.251202.1e208436b → 0.6.1-nightly.251203.b119e390d
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/src/auth/precedence.js +9 -10
- package/dist/src/auth/precedence.js.map +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +1 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/providers/BaseProvider.d.ts +3 -0
- package/dist/src/providers/BaseProvider.js +11 -0
- package/dist/src/providers/BaseProvider.js.map +1 -1
- package/dist/src/providers/IProvider.d.ts +3 -0
- package/dist/src/providers/ProviderManager.js +6 -0
- package/dist/src/providers/ProviderManager.js.map +1 -1
- package/dist/src/providers/openai-vercel/OpenAIVercelProvider.d.ts +130 -0
- package/dist/src/providers/openai-vercel/OpenAIVercelProvider.js +943 -0
- package/dist/src/providers/openai-vercel/OpenAIVercelProvider.js.map +1 -0
- package/dist/src/providers/openai-vercel/errors.d.ts +46 -0
- package/dist/src/providers/openai-vercel/errors.js +137 -0
- package/dist/src/providers/openai-vercel/errors.js.map +1 -0
- package/dist/src/providers/openai-vercel/index.d.ts +22 -0
- package/dist/src/providers/openai-vercel/index.js +23 -0
- package/dist/src/providers/openai-vercel/index.js.map +1 -0
- package/dist/src/providers/openai-vercel/messageConversion.d.ts +33 -0
- package/dist/src/providers/openai-vercel/messageConversion.js +394 -0
- package/dist/src/providers/openai-vercel/messageConversion.js.map +1 -0
- package/dist/src/providers/openai-vercel/toolIdUtils.d.ts +33 -0
- package/dist/src/providers/openai-vercel/toolIdUtils.js +117 -0
- package/dist/src/providers/openai-vercel/toolIdUtils.js.map +1 -0
- package/dist/src/utils/filesearch/ignore.js +3 -2
- package/dist/src/utils/filesearch/ignore.js.map +1 -1
- package/dist/src/utils/gitIgnoreParser.js +2 -1
- package/dist/src/utils/gitIgnoreParser.js.map +1 -1
- package/dist/src/utils/schemaValidator.js +41 -6
- package/dist/src/utils/schemaValidator.js.map +1 -1
- package/package.json +3 -1
|
@@ -0,0 +1,130 @@
|
|
|
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 { IContent } from '../../services/history/IContent.js';
|
|
17
|
+
import { IProviderConfig } from '../types/IProviderConfig.js';
|
|
18
|
+
import { BaseProvider, NormalizedGenerateChatOptions } from '../BaseProvider.js';
|
|
19
|
+
import { OAuthManager } from '../../auth/precedence.js';
|
|
20
|
+
import { IModel } from '../IModel.js';
|
|
21
|
+
import { IProvider } from '../IProvider.js';
|
|
22
|
+
/**
|
|
23
|
+
* Vercel OpenAI-based provider using AI SDK v5.
|
|
24
|
+
*
|
|
25
|
+
* NOTE:
|
|
26
|
+
* - No dependency on the official `openai` SDK.
|
|
27
|
+
* - Uses `openai.chat(modelId)` to talk to the Chat Completions API.
|
|
28
|
+
* - Tools are configured via AI SDK `tool()` with JSON schema input.
|
|
29
|
+
*/
|
|
30
|
+
export declare class OpenAIVercelProvider extends BaseProvider implements IProvider {
|
|
31
|
+
private getLogger;
|
|
32
|
+
/**
|
|
33
|
+
* @plan:PLAN-20251023-STATELESS-HARDENING.P08
|
|
34
|
+
* @requirement:REQ-SP4-003
|
|
35
|
+
* Constructor reduced to minimal initialization - no state captured.
|
|
36
|
+
*/
|
|
37
|
+
constructor(apiKey: string | undefined, baseURL?: string, config?: IProviderConfig, oauthManager?: OAuthManager);
|
|
38
|
+
protected supportsOAuth(): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Create an OpenAI provider instance for this call using AI SDK v5.
|
|
41
|
+
*
|
|
42
|
+
* Uses the resolved runtime auth token and baseURL, and still allows
|
|
43
|
+
* local endpoints without authentication (for Ollama-style servers).
|
|
44
|
+
*/
|
|
45
|
+
private createOpenAIClient;
|
|
46
|
+
/**
|
|
47
|
+
* Extract model parameters from normalized options instead of settings service.
|
|
48
|
+
* This mirrors OpenAIProvider but feeds AI SDK call options instead.
|
|
49
|
+
*/
|
|
50
|
+
private extractModelParamsFromOptions;
|
|
51
|
+
/**
|
|
52
|
+
* Tool formatter instances cannot be shared between stateless calls,
|
|
53
|
+
* so construct a fresh one for every invocation.
|
|
54
|
+
*/
|
|
55
|
+
private createToolFormatter;
|
|
56
|
+
private getAiJsonSchema;
|
|
57
|
+
private getAiTool;
|
|
58
|
+
/**
|
|
59
|
+
* Normalize tool IDs from various formats to OpenAI-style format.
|
|
60
|
+
* Kept for compatibility with existing history/tool logic.
|
|
61
|
+
*/
|
|
62
|
+
private normalizeToOpenAIToolId;
|
|
63
|
+
/**
|
|
64
|
+
* Normalize tool IDs from OpenAI-style format to history format.
|
|
65
|
+
*/
|
|
66
|
+
private normalizeToHistoryToolId;
|
|
67
|
+
/**
|
|
68
|
+
* Convert internal history IContent[] to AI SDK ModelMessage[].
|
|
69
|
+
*
|
|
70
|
+
* This implementation uses textual tool replay for past tool calls/results.
|
|
71
|
+
* New tool calls in the current response still use structured ToolCallBlocks.
|
|
72
|
+
*/
|
|
73
|
+
private convertToModelMessages;
|
|
74
|
+
/**
|
|
75
|
+
* Build an AI SDK ToolSet from already-normalized OpenAI-style tool definitions.
|
|
76
|
+
*
|
|
77
|
+
* Input is the same array produced by ToolFormatter.convertGeminiToFormat(…, 'openai'|'qwen').
|
|
78
|
+
*/
|
|
79
|
+
private buildVercelTools;
|
|
80
|
+
private mapUsageToMetadata;
|
|
81
|
+
/**
|
|
82
|
+
* Get a short preview of a message's content for debug logging.
|
|
83
|
+
*/
|
|
84
|
+
private getContentPreview;
|
|
85
|
+
/**
|
|
86
|
+
* Core chat completion implementation using AI SDK v5.
|
|
87
|
+
*
|
|
88
|
+
* This replaces the original OpenAI SDK v5 client usage with:
|
|
89
|
+
* - createOpenAI({ apiKey, baseURL })
|
|
90
|
+
* - openai.chat(modelId)
|
|
91
|
+
* - generateText / streamText
|
|
92
|
+
*/
|
|
93
|
+
protected generateChatCompletionWithOptions(options: NormalizedGenerateChatOptions): AsyncIterableIterator<IContent>;
|
|
94
|
+
/**
|
|
95
|
+
* Models listing – uses HTTP GET /models via fetch instead of the OpenAI SDK.
|
|
96
|
+
* Falls back to a small static list if the request fails.
|
|
97
|
+
*/
|
|
98
|
+
getModels(): Promise<IModel[]>;
|
|
99
|
+
private getFallbackModels;
|
|
100
|
+
getDefaultModel(): string;
|
|
101
|
+
getCurrentModel(): string;
|
|
102
|
+
clearClientCache(runtimeKey?: string): void;
|
|
103
|
+
clearState(): void;
|
|
104
|
+
getServerTools(): string[];
|
|
105
|
+
invokeServerTool(toolName: string, _params: unknown, _config?: unknown, _signal?: AbortSignal): Promise<unknown>;
|
|
106
|
+
getToolFormat(): string;
|
|
107
|
+
/**
|
|
108
|
+
* Detects the tool call format based on the model being used.
|
|
109
|
+
* Mirrors OpenAIProvider behavior so existing ToolFormatter logic works.
|
|
110
|
+
*/
|
|
111
|
+
private detectToolFormat;
|
|
112
|
+
parseToolResponse(response: unknown): unknown;
|
|
113
|
+
/**
|
|
114
|
+
* Disallow memoization of model params to preserve stateless behavior.
|
|
115
|
+
*/
|
|
116
|
+
setModelParams(_params: Record<string, unknown> | undefined): void;
|
|
117
|
+
/**
|
|
118
|
+
* Gets model parameters from SettingsService per call (stateless).
|
|
119
|
+
* Mirrors OpenAIProvider.getModelParams for compatibility.
|
|
120
|
+
*/
|
|
121
|
+
getModelParams(): Record<string, unknown> | undefined;
|
|
122
|
+
/**
|
|
123
|
+
* Determines whether a response should be retried based on error codes.
|
|
124
|
+
*
|
|
125
|
+
* This is retained for compatibility with existing retryWithBackoff
|
|
126
|
+
* callers, even though AI SDK's generateText/streamText have their
|
|
127
|
+
* own built-in retry logic.
|
|
128
|
+
*/
|
|
129
|
+
shouldRetryResponse(error: unknown): boolean;
|
|
130
|
+
}
|