@vybestack/llxprt-code-core 0.6.2 → 0.7.0-nightly.251207.a6190e71e

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.
Files changed (92) hide show
  1. package/dist/src/auth/precedence.js +9 -10
  2. package/dist/src/auth/precedence.js.map +1 -1
  3. package/dist/src/auth/types.d.ts +6 -6
  4. package/dist/src/core/geminiChat.d.ts +8 -0
  5. package/dist/src/core/geminiChat.js +63 -5
  6. package/dist/src/core/geminiChat.js.map +1 -1
  7. package/dist/src/core/turn.js +12 -8
  8. package/dist/src/core/turn.js.map +1 -1
  9. package/dist/src/ide/ide-client.js +4 -2
  10. package/dist/src/ide/ide-client.js.map +1 -1
  11. package/dist/src/index.d.ts +1 -0
  12. package/dist/src/index.js +1 -0
  13. package/dist/src/index.js.map +1 -1
  14. package/dist/src/parsers/TextToolCallParser.d.ts +0 -15
  15. package/dist/src/parsers/TextToolCallParser.js +21 -5
  16. package/dist/src/parsers/TextToolCallParser.js.map +1 -1
  17. package/dist/src/providers/BaseProvider.d.ts +3 -0
  18. package/dist/src/providers/BaseProvider.js +11 -0
  19. package/dist/src/providers/BaseProvider.js.map +1 -1
  20. package/dist/src/providers/IProvider.d.ts +3 -0
  21. package/dist/src/providers/ProviderManager.js +6 -0
  22. package/dist/src/providers/ProviderManager.js.map +1 -1
  23. package/dist/src/providers/anthropic/AnthropicProvider.d.ts +0 -1
  24. package/dist/src/providers/anthropic/AnthropicProvider.js +233 -22
  25. package/dist/src/providers/anthropic/AnthropicProvider.js.map +1 -1
  26. package/dist/src/providers/anthropic/schemaConverter.d.ts +63 -0
  27. package/dist/src/providers/anthropic/schemaConverter.js +189 -0
  28. package/dist/src/providers/anthropic/schemaConverter.js.map +1 -0
  29. package/dist/src/providers/gemini/GeminiProvider.js +108 -11
  30. package/dist/src/providers/gemini/GeminiProvider.js.map +1 -1
  31. package/dist/src/providers/gemini/thoughtSignatures.d.ts +51 -0
  32. package/dist/src/providers/gemini/thoughtSignatures.js +189 -0
  33. package/dist/src/providers/gemini/thoughtSignatures.js.map +1 -0
  34. package/dist/src/providers/openai/OpenAIProvider.d.ts +78 -1
  35. package/dist/src/providers/openai/OpenAIProvider.js +1159 -190
  36. package/dist/src/providers/openai/OpenAIProvider.js.map +1 -1
  37. package/dist/src/providers/openai/ToolCallNormalizer.d.ts +6 -0
  38. package/dist/src/providers/openai/ToolCallNormalizer.js +16 -2
  39. package/dist/src/providers/openai/ToolCallNormalizer.js.map +1 -1
  40. package/dist/src/providers/openai/schemaConverter.d.ts +67 -0
  41. package/dist/src/providers/openai/schemaConverter.js +191 -0
  42. package/dist/src/providers/openai/schemaConverter.js.map +1 -0
  43. package/dist/src/providers/openai-responses/OpenAIResponsesProvider.d.ts +0 -4
  44. package/dist/src/providers/openai-responses/OpenAIResponsesProvider.js +3 -75
  45. package/dist/src/providers/openai-responses/OpenAIResponsesProvider.js.map +1 -1
  46. package/dist/src/providers/openai-responses/schemaConverter.d.ts +65 -0
  47. package/dist/src/providers/openai-responses/schemaConverter.js +195 -0
  48. package/dist/src/providers/openai-responses/schemaConverter.js.map +1 -0
  49. package/dist/src/providers/openai-vercel/OpenAIVercelProvider.d.ts +146 -0
  50. package/dist/src/providers/openai-vercel/OpenAIVercelProvider.js +1177 -0
  51. package/dist/src/providers/openai-vercel/OpenAIVercelProvider.js.map +1 -0
  52. package/dist/src/providers/openai-vercel/errors.d.ts +46 -0
  53. package/dist/src/providers/openai-vercel/errors.js +137 -0
  54. package/dist/src/providers/openai-vercel/errors.js.map +1 -0
  55. package/dist/src/providers/openai-vercel/index.d.ts +22 -0
  56. package/dist/src/providers/openai-vercel/index.js +23 -0
  57. package/dist/src/providers/openai-vercel/index.js.map +1 -0
  58. package/dist/src/providers/openai-vercel/messageConversion.d.ts +36 -0
  59. package/dist/src/providers/openai-vercel/messageConversion.js +410 -0
  60. package/dist/src/providers/openai-vercel/messageConversion.js.map +1 -0
  61. package/dist/src/providers/openai-vercel/schemaConverter.d.ts +66 -0
  62. package/dist/src/providers/openai-vercel/schemaConverter.js +191 -0
  63. package/dist/src/providers/openai-vercel/schemaConverter.js.map +1 -0
  64. package/dist/src/providers/openai-vercel/toolIdUtils.d.ts +33 -0
  65. package/dist/src/providers/openai-vercel/toolIdUtils.js +117 -0
  66. package/dist/src/providers/openai-vercel/toolIdUtils.js.map +1 -0
  67. package/dist/src/providers/reasoning/reasoningUtils.d.ts +43 -0
  68. package/dist/src/providers/reasoning/reasoningUtils.js +92 -0
  69. package/dist/src/providers/reasoning/reasoningUtils.js.map +1 -0
  70. package/dist/src/providers/utils/localEndpoint.js +6 -2
  71. package/dist/src/providers/utils/localEndpoint.js.map +1 -1
  72. package/dist/src/runtime/AgentRuntimeContext.d.ts +27 -0
  73. package/dist/src/runtime/AgentRuntimeContext.js.map +1 -1
  74. package/dist/src/runtime/createAgentRuntimeContext.js +27 -1
  75. package/dist/src/runtime/createAgentRuntimeContext.js.map +1 -1
  76. package/dist/src/services/history/IContent.d.ts +6 -0
  77. package/dist/src/services/history/IContent.js.map +1 -1
  78. package/dist/src/settings/types.d.ts +1 -1
  79. package/dist/src/tools/IToolFormatter.d.ts +1 -1
  80. package/dist/src/tools/ToolFormatter.js +14 -2
  81. package/dist/src/tools/ToolFormatter.js.map +1 -1
  82. package/dist/src/tools/ToolIdStrategy.d.ts +72 -0
  83. package/dist/src/tools/ToolIdStrategy.js +107 -0
  84. package/dist/src/tools/ToolIdStrategy.js.map +1 -0
  85. package/dist/src/tools/todo-schemas.d.ts +4 -4
  86. package/dist/src/utils/filesearch/ignore.js +3 -2
  87. package/dist/src/utils/filesearch/ignore.js.map +1 -1
  88. package/dist/src/utils/gitIgnoreParser.js +2 -1
  89. package/dist/src/utils/gitIgnoreParser.js.map +1 -1
  90. package/dist/src/utils/schemaValidator.js +41 -6
  91. package/dist/src/utils/schemaValidator.js.map +1 -1
  92. package/package.json +3 -1
@@ -0,0 +1,146 @@
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
+ private getAiJsonSchema;
52
+ private getAiTool;
53
+ /**
54
+ * Normalize tool IDs from various formats to OpenAI-style format.
55
+ * Kept for compatibility with existing history/tool logic.
56
+ */
57
+ private normalizeToOpenAIToolId;
58
+ /**
59
+ * Normalize tool IDs from OpenAI-style format to history format.
60
+ */
61
+ private normalizeToHistoryToolId;
62
+ /**
63
+ * Convert internal history IContent[] to AI SDK ModelMessage[].
64
+ *
65
+ * This implementation uses textual tool replay for past tool calls/results.
66
+ * New tool calls in the current response still use structured ToolCallBlocks.
67
+ *
68
+ * For Kimi K2 models, uses ToolIdStrategy to generate proper tool IDs
69
+ * in the format functions.{name}:{index} instead of call_xxx.
70
+ */
71
+ private convertToModelMessages;
72
+ /**
73
+ * Build an AI SDK ToolSet from already-normalized OpenAI-style tool definitions.
74
+ *
75
+ * Input is the array produced by convertToolsToOpenAIVercel().
76
+ */
77
+ private buildVercelTools;
78
+ private mapUsageToMetadata;
79
+ /**
80
+ * Extract thinking content from <think>, <thinking>, or <analysis> tags
81
+ * and return it as a ThinkingBlock. Returns null if no thinking tags found.
82
+ *
83
+ * This must be called BEFORE sanitizeText which strips these tags.
84
+ *
85
+ * Handles two formats:
86
+ * 1. Standard: <think>Full thinking paragraph here...</think>
87
+ * 2. Fragmented (Synthetic API): <think>word</think><think>word</think>...
88
+ *
89
+ * For fragmented format, joins with spaces. For standard, joins with newlines.
90
+ */
91
+ private extractThinkTagsAsBlock;
92
+ /**
93
+ * Sanitize text content from provider response by removing thinking tags and artifacts.
94
+ * This prevents <think>...</think> tags from leaking into visible output.
95
+ */
96
+ private sanitizeText;
97
+ /**
98
+ * Get a short preview of a message's content for debug logging.
99
+ */
100
+ private getContentPreview;
101
+ /**
102
+ * Core chat completion implementation using AI SDK v5.
103
+ *
104
+ * This replaces the original OpenAI SDK v5 client usage with:
105
+ * - createOpenAI({ apiKey, baseURL })
106
+ * - openai.chat(modelId)
107
+ * - generateText / streamText
108
+ */
109
+ protected generateChatCompletionWithOptions(options: NormalizedGenerateChatOptions): AsyncIterableIterator<IContent>;
110
+ /**
111
+ * Models listing – uses HTTP GET /models via fetch instead of the OpenAI SDK.
112
+ * Falls back to a small static list if the request fails.
113
+ */
114
+ getModels(): Promise<IModel[]>;
115
+ private getFallbackModels;
116
+ getDefaultModel(): string;
117
+ getCurrentModel(): string;
118
+ clearClientCache(runtimeKey?: string): void;
119
+ clearState(): void;
120
+ getServerTools(): string[];
121
+ invokeServerTool(toolName: string, _params: unknown, _config?: unknown, _signal?: AbortSignal): Promise<unknown>;
122
+ getToolFormat(): string;
123
+ /**
124
+ * Detects the tool call format based on the model being used.
125
+ * Mirrors OpenAIProvider behavior so existing ToolFormatter logic works.
126
+ */
127
+ private detectToolFormat;
128
+ parseToolResponse(response: unknown): unknown;
129
+ /**
130
+ * Disallow memoization of model params to preserve stateless behavior.
131
+ */
132
+ setModelParams(_params: Record<string, unknown> | undefined): void;
133
+ /**
134
+ * Gets model parameters from SettingsService per call (stateless).
135
+ * Mirrors OpenAIProvider.getModelParams for compatibility.
136
+ */
137
+ getModelParams(): Record<string, unknown> | undefined;
138
+ /**
139
+ * Determines whether a response should be retried based on error codes.
140
+ *
141
+ * This is retained for compatibility with existing retryWithBackoff
142
+ * callers, even though AI SDK's generateText/streamText have their
143
+ * own built-in retry logic.
144
+ */
145
+ shouldRetryResponse(error: unknown): boolean;
146
+ }