recker 1.0.4 → 1.0.6
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 +1 -1
- package/dist/ai/adaptive-timeout.d.ts +51 -0
- package/dist/ai/adaptive-timeout.d.ts.map +1 -0
- package/dist/ai/adaptive-timeout.js +208 -0
- package/dist/ai/client.d.ts +24 -0
- package/dist/ai/client.d.ts.map +1 -0
- package/dist/ai/client.js +289 -0
- package/dist/ai/index.d.ts +10 -0
- package/dist/ai/index.d.ts.map +1 -0
- package/dist/ai/index.js +6 -0
- package/dist/ai/providers/anthropic.d.ts +64 -0
- package/dist/ai/providers/anthropic.d.ts.map +1 -0
- package/dist/ai/providers/anthropic.js +367 -0
- package/dist/ai/providers/base.d.ts +49 -0
- package/dist/ai/providers/base.d.ts.map +1 -0
- package/dist/ai/providers/base.js +145 -0
- package/dist/ai/providers/index.d.ts +7 -0
- package/dist/ai/providers/index.d.ts.map +1 -0
- package/dist/ai/providers/index.js +3 -0
- package/dist/ai/providers/openai.d.ts +65 -0
- package/dist/ai/providers/openai.d.ts.map +1 -0
- package/dist/ai/providers/openai.js +298 -0
- package/dist/ai/rate-limiter.d.ts +44 -0
- package/dist/ai/rate-limiter.d.ts.map +1 -0
- package/dist/ai/rate-limiter.js +212 -0
- package/dist/bench/generator.d.ts +19 -0
- package/dist/bench/generator.d.ts.map +1 -0
- package/dist/bench/generator.js +86 -0
- package/dist/bench/stats.d.ts +35 -0
- package/dist/bench/stats.d.ts.map +1 -0
- package/dist/bench/stats.js +60 -0
- package/dist/cache/memory-storage.d.ts.map +1 -1
- package/dist/cache/memory-storage.js +0 -5
- package/dist/cli/handler.d.ts +11 -0
- package/dist/cli/handler.d.ts.map +1 -0
- package/dist/cli/handler.js +92 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +255 -0
- package/dist/cli/presets.d.ts +2 -0
- package/dist/cli/presets.d.ts.map +1 -0
- package/dist/cli/presets.js +67 -0
- package/dist/cli/tui/ai-chat.d.ts +3 -0
- package/dist/cli/tui/ai-chat.d.ts.map +1 -0
- package/dist/cli/tui/ai-chat.js +100 -0
- package/dist/cli/tui/load-dashboard.d.ts +3 -0
- package/dist/cli/tui/load-dashboard.d.ts.map +1 -0
- package/dist/cli/tui/load-dashboard.js +117 -0
- package/dist/cli/tui/shell.d.ts +27 -0
- package/dist/cli/tui/shell.d.ts.map +1 -0
- package/dist/cli/tui/shell.js +386 -0
- package/dist/cli/tui/websocket.d.ts +2 -0
- package/dist/cli/tui/websocket.d.ts.map +1 -0
- package/dist/cli/tui/websocket.js +87 -0
- package/dist/contract/index.d.ts +2 -2
- package/dist/contract/index.d.ts.map +1 -1
- package/dist/core/client.d.ts +1 -0
- package/dist/core/client.d.ts.map +1 -1
- package/dist/core/client.js +4 -2
- package/dist/core/request-promise.d.ts +1 -1
- package/dist/core/request-promise.d.ts.map +1 -1
- package/dist/mcp/contract.d.ts +1 -1
- package/dist/mcp/contract.d.ts.map +1 -1
- package/dist/plugins/cache.d.ts.map +1 -1
- package/dist/plugins/cache.js +0 -7
- package/dist/plugins/scrape.d.ts.map +1 -1
- package/dist/plugins/scrape.js +9 -14
- package/dist/protocols/ftp.d.ts +28 -5
- package/dist/protocols/ftp.d.ts.map +1 -1
- package/dist/protocols/ftp.js +549 -136
- package/dist/protocols/sftp.d.ts +4 -2
- package/dist/protocols/sftp.d.ts.map +1 -1
- package/dist/protocols/sftp.js +16 -2
- package/dist/protocols/telnet.d.ts +37 -5
- package/dist/protocols/telnet.d.ts.map +1 -1
- package/dist/protocols/telnet.js +434 -58
- package/dist/runner/request-runner.d.ts.map +1 -1
- package/dist/runner/request-runner.js +0 -1
- package/dist/scrape/document.d.ts +3 -2
- package/dist/scrape/document.d.ts.map +1 -1
- package/dist/scrape/document.js +15 -3
- package/dist/testing/index.d.ts +2 -0
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +1 -0
- package/dist/testing/mock-udp-server.d.ts +44 -0
- package/dist/testing/mock-udp-server.d.ts.map +1 -0
- package/dist/testing/mock-udp-server.js +188 -0
- package/dist/transport/base-udp.d.ts +36 -0
- package/dist/transport/base-udp.d.ts.map +1 -0
- package/dist/transport/base-udp.js +188 -0
- package/dist/transport/udp-response.d.ts +65 -0
- package/dist/transport/udp-response.d.ts.map +1 -0
- package/dist/transport/udp-response.js +269 -0
- package/dist/transport/udp.d.ts +22 -0
- package/dist/transport/udp.d.ts.map +1 -0
- package/dist/transport/udp.js +260 -0
- package/dist/types/ai.d.ts +268 -0
- package/dist/types/ai.d.ts.map +1 -0
- package/dist/types/ai.js +1 -0
- package/dist/types/udp.d.ts +138 -0
- package/dist/types/udp.d.ts.map +1 -0
- package/dist/types/udp.js +1 -0
- package/dist/udp/index.d.ts +6 -0
- package/dist/udp/index.d.ts.map +1 -0
- package/dist/udp/index.js +3 -0
- package/dist/utils/chart.d.ts +15 -0
- package/dist/utils/chart.d.ts.map +1 -0
- package/dist/utils/chart.js +94 -0
- package/dist/utils/colors.d.ts +27 -0
- package/dist/utils/colors.d.ts.map +1 -0
- package/dist/utils/colors.js +50 -0
- package/dist/utils/optional-require.d.ts +20 -0
- package/dist/utils/optional-require.d.ts.map +1 -0
- package/dist/utils/optional-require.js +105 -0
- package/package.json +53 -12
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"anthropic.d.ts","sourceRoot":"","sources":["../../../src/ai/providers/anthropic.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EACX,UAAU,EACV,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,aAAa,EACb,cAAc,EAIf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,cAAc,EACd,sBAAsB,EAMvB,MAAM,WAAW,CAAC;AAKnB,MAAM,WAAW,eAAgB,SAAQ,cAAc;IAErD,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAKD,UAAU,gBAAgB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AAS,CAAC,iBAAiB,CAAC,QAAQ,EAAE,WAAW,EAAE,GAAG,gBAAgB,EAAE;IA0BxE,OAAO,CAAC,gBAAgB;IAuDxB,OAAO,CAAC,cAAc;IAStB,OAAO,CAAC,eAAe;IAYjB,IAAI,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC;IAa/C,MAAM,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC;IAY/C,KAAK,CAAC,QAAQ,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC;IAW3D,OAAO,CAAC,aAAa;YAmCP,WAAW;YAsBX,WAAW;IA8BzB,SAAS,CAAC,aAAa,CAAC,IAAI,EAAE,mBAAmB,EAAE,OAAO,EAAE,sBAAsB,GAAG,UAAU;IAiD/F,SAAS,CAAC,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,sBAAsB,GAAG,WAAW,GAAG,IAAI;YAKjF,oBAAoB;CAyHpC"}
|
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
import { BaseAIProvider, AIError, RateLimitError, ContextLengthError, OverloadedError, AuthenticationError, } from './base.js';
|
|
2
|
+
export class AnthropicProvider extends BaseAIProvider {
|
|
3
|
+
anthropicConfig;
|
|
4
|
+
constructor(config = {}) {
|
|
5
|
+
super({ ...config, name: 'anthropic' });
|
|
6
|
+
this.anthropicConfig = config;
|
|
7
|
+
}
|
|
8
|
+
getEnvApiKey() {
|
|
9
|
+
return process.env.ANTHROPIC_API_KEY;
|
|
10
|
+
}
|
|
11
|
+
getBaseUrl() {
|
|
12
|
+
return this.config.baseUrl || 'https://api.anthropic.com/v1';
|
|
13
|
+
}
|
|
14
|
+
buildHeaders() {
|
|
15
|
+
return {
|
|
16
|
+
'Content-Type': 'application/json',
|
|
17
|
+
'x-api-key': this.getApiKey(),
|
|
18
|
+
'anthropic-version': this.anthropicConfig.version || '2025-01-01',
|
|
19
|
+
...this.config.headers,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
transformMessages(messages) {
|
|
23
|
+
const filtered = messages.filter((m) => m.role !== 'system');
|
|
24
|
+
return filtered.map((msg) => {
|
|
25
|
+
if (msg.role === 'tool') {
|
|
26
|
+
return {
|
|
27
|
+
role: 'user',
|
|
28
|
+
content: [
|
|
29
|
+
{
|
|
30
|
+
type: 'tool_result',
|
|
31
|
+
tool_use_id: msg.tool_call_id || '',
|
|
32
|
+
content: typeof msg.content === 'string' ? msg.content : JSON.stringify(msg.content),
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
role: msg.role === 'user' ? 'user' : 'assistant',
|
|
39
|
+
content: this.transformContent(msg),
|
|
40
|
+
};
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
transformContent(msg) {
|
|
44
|
+
if (typeof msg.content === 'string') {
|
|
45
|
+
if (msg.tool_calls?.length) {
|
|
46
|
+
const parts = [{ type: 'text', text: msg.content }];
|
|
47
|
+
for (const tc of msg.tool_calls) {
|
|
48
|
+
parts.push({
|
|
49
|
+
type: 'tool_use',
|
|
50
|
+
id: tc.id,
|
|
51
|
+
name: tc.function.name,
|
|
52
|
+
input: JSON.parse(tc.function.arguments || '{}'),
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
return parts;
|
|
56
|
+
}
|
|
57
|
+
return msg.content;
|
|
58
|
+
}
|
|
59
|
+
if (!msg.content)
|
|
60
|
+
return '';
|
|
61
|
+
return msg.content.map((part) => {
|
|
62
|
+
if (part.type === 'text') {
|
|
63
|
+
return { type: 'text', text: part.text };
|
|
64
|
+
}
|
|
65
|
+
if (part.type === 'image_url') {
|
|
66
|
+
const match = part.image_url.url.match(/^data:([^;]+);base64,(.+)$/);
|
|
67
|
+
if (match) {
|
|
68
|
+
return {
|
|
69
|
+
type: 'image',
|
|
70
|
+
source: {
|
|
71
|
+
type: 'base64',
|
|
72
|
+
media_type: match[1],
|
|
73
|
+
data: match[2],
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
return { type: 'text', text: `[Image: ${part.image_url.url}]` };
|
|
78
|
+
}
|
|
79
|
+
if (part.type === 'image') {
|
|
80
|
+
return {
|
|
81
|
+
type: 'image',
|
|
82
|
+
source: {
|
|
83
|
+
type: 'base64',
|
|
84
|
+
media_type: part.mediaType,
|
|
85
|
+
data: Buffer.from(part.data).toString('base64'),
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
return { type: 'text', text: '' };
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
transformTools(tools) {
|
|
93
|
+
if (!tools)
|
|
94
|
+
return undefined;
|
|
95
|
+
return tools.map((tool) => ({
|
|
96
|
+
name: tool.function.name,
|
|
97
|
+
description: tool.function.description,
|
|
98
|
+
input_schema: tool.function.parameters || { type: 'object', properties: {} },
|
|
99
|
+
}));
|
|
100
|
+
}
|
|
101
|
+
getSystemPrompt(options) {
|
|
102
|
+
const systemMessage = options.messages.find((m) => m.role === 'system');
|
|
103
|
+
if (options.systemPrompt)
|
|
104
|
+
return options.systemPrompt;
|
|
105
|
+
if (systemMessage) {
|
|
106
|
+
return typeof systemMessage.content === 'string'
|
|
107
|
+
? systemMessage.content
|
|
108
|
+
: systemMessage.content?.map((p) => (p.type === 'text' ? p.text : '')).join('');
|
|
109
|
+
}
|
|
110
|
+
return undefined;
|
|
111
|
+
}
|
|
112
|
+
async chat(options) {
|
|
113
|
+
const context = {
|
|
114
|
+
startTime: performance.now(),
|
|
115
|
+
tokenCount: 0,
|
|
116
|
+
};
|
|
117
|
+
const body = this.buildChatBody(options, false);
|
|
118
|
+
const response = await this.makeRequest('/messages', body, options.signal);
|
|
119
|
+
const data = await response.json();
|
|
120
|
+
return this.parseResponse(data, context);
|
|
121
|
+
}
|
|
122
|
+
async stream(options) {
|
|
123
|
+
const context = {
|
|
124
|
+
startTime: performance.now(),
|
|
125
|
+
tokenCount: 0,
|
|
126
|
+
};
|
|
127
|
+
const body = this.buildChatBody(options, true);
|
|
128
|
+
const response = await this.makeRequest('/messages', body, options.signal);
|
|
129
|
+
return this.parseAnthropicStream(response, context);
|
|
130
|
+
}
|
|
131
|
+
async embed(_options) {
|
|
132
|
+
throw new AIError('Anthropic does not support embeddings. Use a different provider.', 'anthropic', 'not_supported', 400, false);
|
|
133
|
+
}
|
|
134
|
+
buildChatBody(options, stream) {
|
|
135
|
+
const body = {
|
|
136
|
+
model: options.model || this.config.defaultModel || 'claude-sonnet-4-20250514',
|
|
137
|
+
messages: this.transformMessages(options.messages),
|
|
138
|
+
max_tokens: options.maxTokens || 4096,
|
|
139
|
+
};
|
|
140
|
+
const systemPrompt = this.getSystemPrompt(options);
|
|
141
|
+
if (systemPrompt)
|
|
142
|
+
body.system = systemPrompt;
|
|
143
|
+
if (options.temperature !== undefined)
|
|
144
|
+
body.temperature = options.temperature;
|
|
145
|
+
if (options.topP !== undefined)
|
|
146
|
+
body.top_p = options.topP;
|
|
147
|
+
if (options.stop)
|
|
148
|
+
body.stop_sequences = options.stop;
|
|
149
|
+
if (options.tools)
|
|
150
|
+
body.tools = this.transformTools(options.tools);
|
|
151
|
+
if (options.toolChoice) {
|
|
152
|
+
if (options.toolChoice === 'auto') {
|
|
153
|
+
body.tool_choice = { type: 'auto' };
|
|
154
|
+
}
|
|
155
|
+
else if (options.toolChoice === 'none') {
|
|
156
|
+
}
|
|
157
|
+
else if (options.toolChoice === 'required') {
|
|
158
|
+
body.tool_choice = { type: 'any' };
|
|
159
|
+
}
|
|
160
|
+
else if (typeof options.toolChoice === 'object') {
|
|
161
|
+
body.tool_choice = {
|
|
162
|
+
type: 'tool',
|
|
163
|
+
name: options.toolChoice.function.name,
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
if (stream)
|
|
168
|
+
body.stream = true;
|
|
169
|
+
return body;
|
|
170
|
+
}
|
|
171
|
+
async makeRequest(endpoint, body, signal) {
|
|
172
|
+
const url = `${this.getBaseUrl()}${endpoint}`;
|
|
173
|
+
const headers = this.buildHeaders();
|
|
174
|
+
const response = await fetch(url, {
|
|
175
|
+
method: 'POST',
|
|
176
|
+
headers,
|
|
177
|
+
body: JSON.stringify(body),
|
|
178
|
+
signal,
|
|
179
|
+
});
|
|
180
|
+
if (!response.ok) {
|
|
181
|
+
await this.handleError(response);
|
|
182
|
+
}
|
|
183
|
+
return response;
|
|
184
|
+
}
|
|
185
|
+
async handleError(response) {
|
|
186
|
+
let errorData = {};
|
|
187
|
+
try {
|
|
188
|
+
errorData = await response.json();
|
|
189
|
+
}
|
|
190
|
+
catch {
|
|
191
|
+
}
|
|
192
|
+
const message = errorData.error?.message || response.statusText;
|
|
193
|
+
const errorType = errorData.error?.type;
|
|
194
|
+
switch (response.status) {
|
|
195
|
+
case 401:
|
|
196
|
+
throw new AuthenticationError('anthropic');
|
|
197
|
+
case 429:
|
|
198
|
+
const retryAfter = parseInt(response.headers.get('retry-after') || '0', 10);
|
|
199
|
+
throw new RateLimitError('anthropic', retryAfter || undefined);
|
|
200
|
+
case 400:
|
|
201
|
+
if (errorType === 'invalid_request_error' && message.includes('context')) {
|
|
202
|
+
throw new ContextLengthError('anthropic');
|
|
203
|
+
}
|
|
204
|
+
break;
|
|
205
|
+
case 503:
|
|
206
|
+
case 529:
|
|
207
|
+
throw new OverloadedError('anthropic');
|
|
208
|
+
}
|
|
209
|
+
throw new AIError(message, 'anthropic', errorType, response.status, response.status >= 500);
|
|
210
|
+
}
|
|
211
|
+
parseResponse(data, context) {
|
|
212
|
+
let content = '';
|
|
213
|
+
const toolCalls = [];
|
|
214
|
+
for (const block of data.content) {
|
|
215
|
+
if (block.type === 'text') {
|
|
216
|
+
content += block.text;
|
|
217
|
+
}
|
|
218
|
+
else if (block.type === 'tool_use') {
|
|
219
|
+
toolCalls.push({
|
|
220
|
+
id: block.id,
|
|
221
|
+
type: 'function',
|
|
222
|
+
function: {
|
|
223
|
+
name: block.name,
|
|
224
|
+
arguments: JSON.stringify(block.input),
|
|
225
|
+
},
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
const usage = {
|
|
230
|
+
inputTokens: data.usage.input_tokens,
|
|
231
|
+
outputTokens: data.usage.output_tokens,
|
|
232
|
+
totalTokens: data.usage.input_tokens + data.usage.output_tokens,
|
|
233
|
+
};
|
|
234
|
+
context.tokenCount = usage.outputTokens;
|
|
235
|
+
const finishReasonMap = {
|
|
236
|
+
end_turn: 'stop',
|
|
237
|
+
max_tokens: 'length',
|
|
238
|
+
stop_sequence: 'stop',
|
|
239
|
+
tool_use: 'tool_calls',
|
|
240
|
+
};
|
|
241
|
+
return {
|
|
242
|
+
content,
|
|
243
|
+
usage,
|
|
244
|
+
latency: this.calculateLatency(context),
|
|
245
|
+
model: data.model,
|
|
246
|
+
provider: 'anthropic',
|
|
247
|
+
cached: false,
|
|
248
|
+
finishReason: finishReasonMap[data.stop_reason] || 'stop',
|
|
249
|
+
toolCalls: toolCalls.length > 0 ? toolCalls : undefined,
|
|
250
|
+
raw: data,
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
parseStreamEvent(_chunk, _context) {
|
|
254
|
+
return null;
|
|
255
|
+
}
|
|
256
|
+
async *parseAnthropicStream(response, context) {
|
|
257
|
+
const reader = response.body?.getReader();
|
|
258
|
+
if (!reader) {
|
|
259
|
+
throw new Error('Response body is not readable');
|
|
260
|
+
}
|
|
261
|
+
const decoder = new TextDecoder();
|
|
262
|
+
let buffer = '';
|
|
263
|
+
let currentToolCallId = '';
|
|
264
|
+
let currentToolCallName = '';
|
|
265
|
+
let currentToolCallArgs = '';
|
|
266
|
+
try {
|
|
267
|
+
while (true) {
|
|
268
|
+
const { done, value } = await reader.read();
|
|
269
|
+
if (done)
|
|
270
|
+
break;
|
|
271
|
+
buffer += decoder.decode(value, { stream: true });
|
|
272
|
+
const lines = buffer.split('\n');
|
|
273
|
+
buffer = lines.pop() || '';
|
|
274
|
+
for (const line of lines) {
|
|
275
|
+
const trimmed = line.trim();
|
|
276
|
+
if (!trimmed || !trimmed.startsWith('data: '))
|
|
277
|
+
continue;
|
|
278
|
+
const jsonStr = trimmed.slice(6);
|
|
279
|
+
if (jsonStr === '[DONE]')
|
|
280
|
+
continue;
|
|
281
|
+
try {
|
|
282
|
+
const event = JSON.parse(jsonStr);
|
|
283
|
+
switch (event.type) {
|
|
284
|
+
case 'content_block_start':
|
|
285
|
+
if (event.content_block.type === 'tool_use') {
|
|
286
|
+
currentToolCallId = event.content_block.id;
|
|
287
|
+
currentToolCallName = event.content_block.name;
|
|
288
|
+
currentToolCallArgs = '';
|
|
289
|
+
}
|
|
290
|
+
break;
|
|
291
|
+
case 'content_block_delta':
|
|
292
|
+
if (event.delta.type === 'text_delta' && event.delta.text) {
|
|
293
|
+
if (!context.firstTokenTime) {
|
|
294
|
+
context.firstTokenTime = performance.now();
|
|
295
|
+
}
|
|
296
|
+
context.tokenCount++;
|
|
297
|
+
yield { type: 'text', content: event.delta.text };
|
|
298
|
+
}
|
|
299
|
+
else if (event.delta.type === 'input_json_delta' && event.delta.partial_json) {
|
|
300
|
+
currentToolCallArgs += event.delta.partial_json;
|
|
301
|
+
yield {
|
|
302
|
+
type: 'tool_call_delta',
|
|
303
|
+
index: event.index,
|
|
304
|
+
delta: { arguments: event.delta.partial_json },
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
break;
|
|
308
|
+
case 'content_block_stop':
|
|
309
|
+
if (currentToolCallId) {
|
|
310
|
+
yield {
|
|
311
|
+
type: 'tool_call',
|
|
312
|
+
toolCall: {
|
|
313
|
+
id: currentToolCallId,
|
|
314
|
+
type: 'function',
|
|
315
|
+
function: {
|
|
316
|
+
name: currentToolCallName,
|
|
317
|
+
arguments: currentToolCallArgs,
|
|
318
|
+
},
|
|
319
|
+
},
|
|
320
|
+
};
|
|
321
|
+
currentToolCallId = '';
|
|
322
|
+
currentToolCallName = '';
|
|
323
|
+
currentToolCallArgs = '';
|
|
324
|
+
}
|
|
325
|
+
break;
|
|
326
|
+
case 'message_delta':
|
|
327
|
+
if (event.usage) {
|
|
328
|
+
yield {
|
|
329
|
+
type: 'usage',
|
|
330
|
+
usage: {
|
|
331
|
+
inputTokens: 0,
|
|
332
|
+
outputTokens: event.usage.output_tokens,
|
|
333
|
+
totalTokens: event.usage.output_tokens,
|
|
334
|
+
},
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
if (event.delta.stop_reason) {
|
|
338
|
+
const finishReasonMap = {
|
|
339
|
+
end_turn: 'stop',
|
|
340
|
+
max_tokens: 'length',
|
|
341
|
+
stop_sequence: 'stop',
|
|
342
|
+
tool_use: 'tool_calls',
|
|
343
|
+
};
|
|
344
|
+
yield {
|
|
345
|
+
type: 'done',
|
|
346
|
+
finishReason: finishReasonMap[event.delta.stop_reason] || 'stop',
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
break;
|
|
350
|
+
case 'error':
|
|
351
|
+
yield {
|
|
352
|
+
type: 'error',
|
|
353
|
+
error: new AIError(event.error.message, 'anthropic', event.error.type),
|
|
354
|
+
};
|
|
355
|
+
break;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
catch {
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
finally {
|
|
364
|
+
reader.releaseLock();
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { AIProvider, ChatOptions, ChatMessage, AIResponse, AIStream, StreamEvent, EmbedOptions, EmbedResponse, ProviderConfig, TokenUsage, AILatency, ToolCall } from '../../types/ai.js';
|
|
2
|
+
export interface ProviderRequestContext {
|
|
3
|
+
startTime: number;
|
|
4
|
+
firstTokenTime?: number;
|
|
5
|
+
tokenCount: number;
|
|
6
|
+
}
|
|
7
|
+
export interface BaseProviderConfig extends ProviderConfig {
|
|
8
|
+
name: AIProvider;
|
|
9
|
+
}
|
|
10
|
+
export declare abstract class BaseAIProvider {
|
|
11
|
+
protected config: BaseProviderConfig;
|
|
12
|
+
constructor(config: BaseProviderConfig);
|
|
13
|
+
get name(): AIProvider;
|
|
14
|
+
abstract chat(options: ChatOptions): Promise<AIResponse>;
|
|
15
|
+
abstract stream(options: ChatOptions): Promise<AIStream>;
|
|
16
|
+
abstract embed(options: EmbedOptions): Promise<EmbedResponse>;
|
|
17
|
+
protected getApiKey(): string;
|
|
18
|
+
protected abstract getEnvApiKey(): string | undefined;
|
|
19
|
+
protected abstract getBaseUrl(): string;
|
|
20
|
+
protected buildHeaders(): Record<string, string>;
|
|
21
|
+
protected abstract transformMessages(messages: ChatMessage[]): unknown[];
|
|
22
|
+
protected abstract parseResponse(response: unknown, context: ProviderRequestContext): AIResponse;
|
|
23
|
+
protected abstract parseStreamEvent(chunk: string, context: ProviderRequestContext): StreamEvent | null;
|
|
24
|
+
protected calculateLatency(context: ProviderRequestContext): AILatency;
|
|
25
|
+
protected emptyUsage(): TokenUsage;
|
|
26
|
+
protected parseSSEStream(response: Response, context: ProviderRequestContext): AIStream;
|
|
27
|
+
protected parseToolCalls(rawToolCalls: unknown[]): ToolCall[];
|
|
28
|
+
}
|
|
29
|
+
export declare class AIError extends Error {
|
|
30
|
+
readonly provider: AIProvider;
|
|
31
|
+
readonly code?: string | undefined;
|
|
32
|
+
readonly status?: number | undefined;
|
|
33
|
+
readonly retryable: boolean;
|
|
34
|
+
constructor(message: string, provider: AIProvider, code?: string | undefined, status?: number | undefined, retryable?: boolean);
|
|
35
|
+
}
|
|
36
|
+
export declare class RateLimitError extends AIError {
|
|
37
|
+
readonly retryAfter?: number | undefined;
|
|
38
|
+
constructor(provider: AIProvider, retryAfter?: number | undefined);
|
|
39
|
+
}
|
|
40
|
+
export declare class ContextLengthError extends AIError {
|
|
41
|
+
constructor(provider: AIProvider);
|
|
42
|
+
}
|
|
43
|
+
export declare class OverloadedError extends AIError {
|
|
44
|
+
constructor(provider: AIProvider);
|
|
45
|
+
}
|
|
46
|
+
export declare class AuthenticationError extends AIError {
|
|
47
|
+
constructor(provider: AIProvider);
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/ai/providers/base.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,WAAW,EACX,UAAU,EACV,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,aAAa,EACb,cAAc,EACd,UAAU,EACV,SAAS,EACT,QAAQ,EACT,MAAM,mBAAmB,CAAC;AAK3B,MAAM,WAAW,sBAAsB;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;CACpB;AAKD,MAAM,WAAW,kBAAmB,SAAQ,cAAc;IAExD,IAAI,EAAE,UAAU,CAAC;CAClB;AAKD,8BAAsB,cAAc;IAClC,SAAS,CAAC,MAAM,EAAE,kBAAkB,CAAC;gBAEzB,MAAM,EAAE,kBAAkB;IAOtC,IAAI,IAAI,IAAI,UAAU,CAErB;IAKD,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC;IAKxD,QAAQ,CAAC,MAAM,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC;IAKxD,QAAQ,CAAC,KAAK,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC;IAK7D,SAAS,CAAC,SAAS,IAAI,MAAM;IAW7B,SAAS,CAAC,QAAQ,CAAC,YAAY,IAAI,MAAM,GAAG,SAAS;IAKrD,SAAS,CAAC,QAAQ,CAAC,UAAU,IAAI,MAAM;IAKvC,SAAS,CAAC,YAAY,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAUhD,SAAS,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class BaseAIProvider {
|
|
2
|
+
config;
|
|
3
|
+
constructor(config) {
|
|
4
|
+
this.config = config;
|
|
5
|
+
}
|
|
6
|
+
get name() {
|
|
7
|
+
return this.config.name;
|
|
8
|
+
}
|
|
9
|
+
getApiKey() {
|
|
10
|
+
const key = this.config.apiKey || this.getEnvApiKey();
|
|
11
|
+
if (!key) {
|
|
12
|
+
throw new Error(`API key not configured for provider: ${this.config.name}`);
|
|
13
|
+
}
|
|
14
|
+
return key;
|
|
15
|
+
}
|
|
16
|
+
buildHeaders() {
|
|
17
|
+
return {
|
|
18
|
+
'Content-Type': 'application/json',
|
|
19
|
+
...this.config.headers,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
calculateLatency(context) {
|
|
23
|
+
const now = performance.now();
|
|
24
|
+
const total = now - context.startTime;
|
|
25
|
+
const ttft = context.firstTokenTime
|
|
26
|
+
? context.firstTokenTime - context.startTime
|
|
27
|
+
: total;
|
|
28
|
+
const tps = context.tokenCount > 0 && total > 0
|
|
29
|
+
? (context.tokenCount / total) * 1000
|
|
30
|
+
: 0;
|
|
31
|
+
return { ttft, tps, total };
|
|
32
|
+
}
|
|
33
|
+
emptyUsage() {
|
|
34
|
+
return {
|
|
35
|
+
inputTokens: 0,
|
|
36
|
+
outputTokens: 0,
|
|
37
|
+
totalTokens: 0,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
async *parseSSEStream(response, context) {
|
|
41
|
+
const reader = response.body?.getReader();
|
|
42
|
+
if (!reader) {
|
|
43
|
+
throw new Error('Response body is not readable');
|
|
44
|
+
}
|
|
45
|
+
const decoder = new TextDecoder();
|
|
46
|
+
let buffer = '';
|
|
47
|
+
try {
|
|
48
|
+
while (true) {
|
|
49
|
+
const { done, value } = await reader.read();
|
|
50
|
+
if (done)
|
|
51
|
+
break;
|
|
52
|
+
buffer += decoder.decode(value, { stream: true });
|
|
53
|
+
const lines = buffer.split('\n');
|
|
54
|
+
buffer = lines.pop() || '';
|
|
55
|
+
for (const line of lines) {
|
|
56
|
+
const trimmed = line.trim();
|
|
57
|
+
if (!trimmed || trimmed === 'data: [DONE]')
|
|
58
|
+
continue;
|
|
59
|
+
if (trimmed.startsWith('data: ')) {
|
|
60
|
+
const data = trimmed.slice(6);
|
|
61
|
+
try {
|
|
62
|
+
const event = this.parseStreamEvent(data, context);
|
|
63
|
+
if (event) {
|
|
64
|
+
if (event.type === 'text' && !context.firstTokenTime) {
|
|
65
|
+
context.firstTokenTime = performance.now();
|
|
66
|
+
}
|
|
67
|
+
yield event;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (buffer.trim()) {
|
|
76
|
+
const trimmed = buffer.trim();
|
|
77
|
+
if (trimmed.startsWith('data: ') && trimmed !== 'data: [DONE]') {
|
|
78
|
+
const data = trimmed.slice(6);
|
|
79
|
+
try {
|
|
80
|
+
const event = this.parseStreamEvent(data, context);
|
|
81
|
+
if (event)
|
|
82
|
+
yield event;
|
|
83
|
+
}
|
|
84
|
+
catch {
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
finally {
|
|
90
|
+
reader.releaseLock();
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
parseToolCalls(rawToolCalls) {
|
|
94
|
+
if (!Array.isArray(rawToolCalls))
|
|
95
|
+
return [];
|
|
96
|
+
return rawToolCalls.map((tc) => ({
|
|
97
|
+
id: tc.id || '',
|
|
98
|
+
type: 'function',
|
|
99
|
+
function: {
|
|
100
|
+
name: tc.function?.name || '',
|
|
101
|
+
arguments: tc.function?.arguments || '{}',
|
|
102
|
+
},
|
|
103
|
+
}));
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
export class AIError extends Error {
|
|
107
|
+
provider;
|
|
108
|
+
code;
|
|
109
|
+
status;
|
|
110
|
+
retryable;
|
|
111
|
+
constructor(message, provider, code, status, retryable = false) {
|
|
112
|
+
super(message);
|
|
113
|
+
this.provider = provider;
|
|
114
|
+
this.code = code;
|
|
115
|
+
this.status = status;
|
|
116
|
+
this.retryable = retryable;
|
|
117
|
+
this.name = 'AIError';
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
export class RateLimitError extends AIError {
|
|
121
|
+
retryAfter;
|
|
122
|
+
constructor(provider, retryAfter) {
|
|
123
|
+
super('Rate limit exceeded', provider, 'rate_limit', 429, true);
|
|
124
|
+
this.retryAfter = retryAfter;
|
|
125
|
+
this.name = 'RateLimitError';
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
export class ContextLengthError extends AIError {
|
|
129
|
+
constructor(provider) {
|
|
130
|
+
super('Context length exceeded', provider, 'context_length_exceeded', 400, true);
|
|
131
|
+
this.name = 'ContextLengthError';
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
export class OverloadedError extends AIError {
|
|
135
|
+
constructor(provider) {
|
|
136
|
+
super('Provider is overloaded', provider, 'overloaded', 503, true);
|
|
137
|
+
this.name = 'OverloadedError';
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
export class AuthenticationError extends AIError {
|
|
141
|
+
constructor(provider) {
|
|
142
|
+
super('Authentication failed', provider, 'authentication_error', 401, false);
|
|
143
|
+
this.name = 'AuthenticationError';
|
|
144
|
+
}
|
|
145
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { BaseAIProvider, AIError, RateLimitError, ContextLengthError, OverloadedError, AuthenticationError } from './base.js';
|
|
2
|
+
export type { ProviderRequestContext, BaseProviderConfig } from './base.js';
|
|
3
|
+
export { OpenAIProvider } from './openai.js';
|
|
4
|
+
export type { OpenAIConfig } from './openai.js';
|
|
5
|
+
export { AnthropicProvider } from './anthropic.js';
|
|
6
|
+
export type { AnthropicConfig } from './anthropic.js';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ai/providers/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAC9H,YAAY,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE5E,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { ChatOptions, ChatMessage, AIResponse, AIStream, StreamEvent, EmbedOptions, EmbedResponse, ProviderConfig } from '../../types/ai.js';
|
|
2
|
+
import { BaseAIProvider, ProviderRequestContext } from './base.js';
|
|
3
|
+
export interface OpenAIConfig extends ProviderConfig {
|
|
4
|
+
organization?: string;
|
|
5
|
+
}
|
|
6
|
+
interface OpenAIMessage {
|
|
7
|
+
role: 'system' | 'user' | 'assistant' | 'tool';
|
|
8
|
+
content: string | OpenAIContentPart[] | null;
|
|
9
|
+
name?: string;
|
|
10
|
+
tool_call_id?: string;
|
|
11
|
+
tool_calls?: OpenAIToolCall[];
|
|
12
|
+
}
|
|
13
|
+
interface OpenAIContentPart {
|
|
14
|
+
type: 'text' | 'image_url';
|
|
15
|
+
text?: string;
|
|
16
|
+
image_url?: {
|
|
17
|
+
url: string;
|
|
18
|
+
detail?: string;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
interface OpenAIToolCall {
|
|
22
|
+
id: string;
|
|
23
|
+
type: 'function';
|
|
24
|
+
function: {
|
|
25
|
+
name: string;
|
|
26
|
+
arguments: string;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
interface OpenAICompletion {
|
|
30
|
+
id: string;
|
|
31
|
+
object: string;
|
|
32
|
+
created: number;
|
|
33
|
+
model: string;
|
|
34
|
+
choices: Array<{
|
|
35
|
+
index: number;
|
|
36
|
+
message: OpenAIMessage;
|
|
37
|
+
finish_reason: 'stop' | 'length' | 'tool_calls' | 'content_filter';
|
|
38
|
+
}>;
|
|
39
|
+
usage?: {
|
|
40
|
+
prompt_tokens: number;
|
|
41
|
+
completion_tokens: number;
|
|
42
|
+
total_tokens: number;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export declare class OpenAIProvider extends BaseAIProvider {
|
|
46
|
+
private openaiConfig;
|
|
47
|
+
constructor(config?: OpenAIConfig);
|
|
48
|
+
protected getEnvApiKey(): string | undefined;
|
|
49
|
+
protected getBaseUrl(): string;
|
|
50
|
+
protected buildHeaders(): Record<string, string>;
|
|
51
|
+
protected transformMessages(messages: ChatMessage[]): OpenAIMessage[];
|
|
52
|
+
private transformContent;
|
|
53
|
+
private transformTools;
|
|
54
|
+
chat(options: ChatOptions): Promise<AIResponse>;
|
|
55
|
+
stream(options: ChatOptions): Promise<AIStream>;
|
|
56
|
+
embed(options: EmbedOptions): Promise<EmbedResponse>;
|
|
57
|
+
private prepareMessages;
|
|
58
|
+
private buildChatBody;
|
|
59
|
+
private makeRequest;
|
|
60
|
+
private handleError;
|
|
61
|
+
protected parseResponse(data: OpenAICompletion, context: ProviderRequestContext): AIResponse;
|
|
62
|
+
protected parseStreamEvent(chunk: string, context: ProviderRequestContext): StreamEvent | null;
|
|
63
|
+
}
|
|
64
|
+
export {};
|
|
65
|
+
//# sourceMappingURL=openai.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openai.d.ts","sourceRoot":"","sources":["../../../src/ai/providers/openai.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EACX,UAAU,EACV,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,aAAa,EACb,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