@gitkraken/core-gitlens 0.36.0 → 0.37.0
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/CHANGELOG.md +18 -1
- package/dist/git/utils/branch.utils.d.ts +14 -0
- package/dist/git/utils/branch.utils.js +37 -1
- package/dist/git/utils/branch.utils.js.map +1 -1
- package/dist/git/utils/branchLanded.utils.d.ts +43 -0
- package/dist/git/utils/branchLanded.utils.js +56 -0
- package/dist/git/utils/branchLanded.utils.js.map +1 -0
- package/dist/plus/ai/models/model.js +58 -4
- package/dist/plus/ai/models/model.js.map +1 -1
- package/dist/plus/ai/providers/anthropicProvider.js +58 -223
- package/dist/plus/ai/providers/anthropicProvider.js.map +1 -1
- package/dist/plus/ai/providers/deepSeekProvider.js +32 -18
- package/dist/plus/ai/providers/deepSeekProvider.js.map +1 -1
- package/dist/plus/ai/providers/geminiProvider.js +25 -189
- package/dist/plus/ai/providers/geminiProvider.js.map +1 -1
- package/dist/plus/ai/providers/mistralProvider.js +31 -73
- package/dist/plus/ai/providers/mistralProvider.js.map +1 -1
- package/dist/plus/ai/providers/xaiProvider.js +9 -11
- package/dist/plus/ai/providers/xaiProvider.js.map +1 -1
- package/dist/plus/git-github/api/github.d.ts +14 -3
- package/dist/plus/git-github/api/github.js +47 -14
- package/dist/plus/git-github/api/github.js.map +1 -1
- package/dist/plus/integrations/integrationService.d.ts +2 -0
- package/dist/plus/integrations/integrationService.js.map +1 -1
- package/dist/plus/integrations/manager.d.ts +24 -5
- package/dist/plus/integrations/models/issuesIntegration.d.ts +2 -1
- package/dist/plus/integrations/models/issuesIntegration.js +6 -3
- package/dist/plus/integrations/models/issuesIntegration.js.map +1 -1
- package/dist/plus/integrations/providers/azureDevOps.d.ts +21 -6
- package/dist/plus/integrations/providers/azureDevOps.js +24 -12
- package/dist/plus/integrations/providers/azureDevOps.js.map +1 -1
- package/dist/plus/integrations/providers/azureDevOpsServer.d.ts +49 -3
- package/dist/plus/integrations/providers/azureDevOpsServer.js +151 -23
- package/dist/plus/integrations/providers/azureDevOpsServer.js.map +1 -1
- package/dist/plus/integrations/providers/linear.d.ts +3 -2
- package/dist/plus/integrations/providers/linear.js +7 -5
- package/dist/plus/integrations/providers/linear.js.map +1 -1
- package/dist/plus/integrations/reads/searchPullRequests.d.ts +2 -0
- package/dist/plus/integrations/reads/searchPullRequests.js +18 -9
- package/dist/plus/integrations/reads/searchPullRequests.js.map +1 -1
- package/docs/integrations.md +27 -6
- package/package.json +1 -1
|
@@ -4,6 +4,57 @@ import { getReducedMaxInputTokens } from "../utils/ai.utils.js";
|
|
|
4
4
|
import { OpenAICompatibleProviderBase } from "./openAICompatibleProviderBase.js";
|
|
5
5
|
//#region ../plus/ai/src/providers/anthropicProvider.ts
|
|
6
6
|
const models = [
|
|
7
|
+
{
|
|
8
|
+
id: "claude-fable-5-2",
|
|
9
|
+
name: "Claude Fable 5.2",
|
|
10
|
+
maxTokens: {
|
|
11
|
+
input: 1e6,
|
|
12
|
+
output: 128e3
|
|
13
|
+
},
|
|
14
|
+
provider: anthropicProviderDescriptor,
|
|
15
|
+
temperature: null
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
id: "claude-opus-5-5",
|
|
19
|
+
name: "Claude Opus 5.5",
|
|
20
|
+
maxTokens: {
|
|
21
|
+
input: 1e6,
|
|
22
|
+
output: 128e3
|
|
23
|
+
},
|
|
24
|
+
provider: anthropicProviderDescriptor,
|
|
25
|
+
temperature: null
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
id: "claude-sonnet-5-5",
|
|
29
|
+
name: "Claude Sonnet 5.5",
|
|
30
|
+
maxTokens: {
|
|
31
|
+
input: 1e6,
|
|
32
|
+
output: 128e3
|
|
33
|
+
},
|
|
34
|
+
provider: anthropicProviderDescriptor,
|
|
35
|
+
temperature: null
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
id: "claude-haiku-5-5",
|
|
39
|
+
name: "Claude Haiku 5.5",
|
|
40
|
+
maxTokens: {
|
|
41
|
+
input: 1e6,
|
|
42
|
+
output: 128e3
|
|
43
|
+
},
|
|
44
|
+
provider: anthropicProviderDescriptor,
|
|
45
|
+
default: true,
|
|
46
|
+
temperature: null
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
id: "claude-fable-5-1",
|
|
50
|
+
name: "Claude Fable 5.1",
|
|
51
|
+
maxTokens: {
|
|
52
|
+
input: 1e6,
|
|
53
|
+
output: 128e3
|
|
54
|
+
},
|
|
55
|
+
provider: anthropicProviderDescriptor,
|
|
56
|
+
temperature: null
|
|
57
|
+
},
|
|
7
58
|
{
|
|
8
59
|
id: "claude-opus-5",
|
|
9
60
|
name: "Claude Opus 5",
|
|
@@ -42,6 +93,7 @@ const models = [
|
|
|
42
93
|
output: 128e3
|
|
43
94
|
},
|
|
44
95
|
provider: anthropicProviderDescriptor,
|
|
96
|
+
hidden: true,
|
|
45
97
|
temperature: null
|
|
46
98
|
},
|
|
47
99
|
{
|
|
@@ -52,6 +104,7 @@ const models = [
|
|
|
52
104
|
output: 128e3
|
|
53
105
|
},
|
|
54
106
|
provider: anthropicProviderDescriptor,
|
|
107
|
+
hidden: true,
|
|
55
108
|
temperature: null
|
|
56
109
|
},
|
|
57
110
|
{
|
|
@@ -61,7 +114,8 @@ const models = [
|
|
|
61
114
|
input: 1e6,
|
|
62
115
|
output: 128e3
|
|
63
116
|
},
|
|
64
|
-
provider: anthropicProviderDescriptor
|
|
117
|
+
provider: anthropicProviderDescriptor,
|
|
118
|
+
hidden: true
|
|
65
119
|
},
|
|
66
120
|
{
|
|
67
121
|
id: "claude-opus-4-6",
|
|
@@ -70,7 +124,8 @@ const models = [
|
|
|
70
124
|
input: 1e6,
|
|
71
125
|
output: 128e3
|
|
72
126
|
},
|
|
73
|
-
provider: anthropicProviderDescriptor
|
|
127
|
+
provider: anthropicProviderDescriptor,
|
|
128
|
+
hidden: true
|
|
74
129
|
},
|
|
75
130
|
{
|
|
76
131
|
id: "claude-haiku-4-5",
|
|
@@ -80,7 +135,7 @@ const models = [
|
|
|
80
135
|
output: 64e3
|
|
81
136
|
},
|
|
82
137
|
provider: anthropicProviderDescriptor,
|
|
83
|
-
|
|
138
|
+
hidden: true
|
|
84
139
|
},
|
|
85
140
|
{
|
|
86
141
|
id: "claude-haiku-4-5-20251001",
|
|
@@ -131,226 +186,6 @@ const models = [
|
|
|
131
186
|
},
|
|
132
187
|
provider: anthropicProviderDescriptor,
|
|
133
188
|
hidden: true
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
id: "claude-opus-4-1",
|
|
137
|
-
name: "Claude Opus 4.1",
|
|
138
|
-
maxTokens: {
|
|
139
|
-
input: 2e5,
|
|
140
|
-
output: 32e3
|
|
141
|
-
},
|
|
142
|
-
provider: anthropicProviderDescriptor,
|
|
143
|
-
hidden: true,
|
|
144
|
-
supportsStructuredOutputs: false
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
id: "claude-opus-4-1-20250805",
|
|
148
|
-
name: "Claude Opus 4.1",
|
|
149
|
-
maxTokens: {
|
|
150
|
-
input: 2e5,
|
|
151
|
-
output: 32e3
|
|
152
|
-
},
|
|
153
|
-
provider: anthropicProviderDescriptor,
|
|
154
|
-
hidden: true,
|
|
155
|
-
supportsStructuredOutputs: false
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
id: "claude-opus-4-0",
|
|
159
|
-
name: "Claude Opus 4",
|
|
160
|
-
maxTokens: {
|
|
161
|
-
input: 2e5,
|
|
162
|
-
output: 32e3
|
|
163
|
-
},
|
|
164
|
-
provider: anthropicProviderDescriptor,
|
|
165
|
-
hidden: true,
|
|
166
|
-
supportsStructuredOutputs: false
|
|
167
|
-
},
|
|
168
|
-
{
|
|
169
|
-
id: "claude-opus-4-20250514",
|
|
170
|
-
name: "Claude Opus 4",
|
|
171
|
-
maxTokens: {
|
|
172
|
-
input: 2e5,
|
|
173
|
-
output: 32e3
|
|
174
|
-
},
|
|
175
|
-
provider: anthropicProviderDescriptor,
|
|
176
|
-
hidden: true,
|
|
177
|
-
supportsStructuredOutputs: false
|
|
178
|
-
},
|
|
179
|
-
{
|
|
180
|
-
id: "claude-sonnet-4-0",
|
|
181
|
-
name: "Claude Sonnet 4",
|
|
182
|
-
maxTokens: {
|
|
183
|
-
input: 2e5,
|
|
184
|
-
output: 64e3
|
|
185
|
-
},
|
|
186
|
-
provider: anthropicProviderDescriptor,
|
|
187
|
-
hidden: true,
|
|
188
|
-
supportsStructuredOutputs: false
|
|
189
|
-
},
|
|
190
|
-
{
|
|
191
|
-
id: "claude-sonnet-4-20250514",
|
|
192
|
-
name: "Claude Sonnet 4",
|
|
193
|
-
maxTokens: {
|
|
194
|
-
input: 2e5,
|
|
195
|
-
output: 64e3
|
|
196
|
-
},
|
|
197
|
-
provider: anthropicProviderDescriptor,
|
|
198
|
-
hidden: true,
|
|
199
|
-
supportsStructuredOutputs: false
|
|
200
|
-
},
|
|
201
|
-
{
|
|
202
|
-
id: "claude-3-7-sonnet-latest",
|
|
203
|
-
name: "Claude Sonnet 3.7",
|
|
204
|
-
maxTokens: {
|
|
205
|
-
input: 2e5,
|
|
206
|
-
output: 64e3
|
|
207
|
-
},
|
|
208
|
-
provider: anthropicProviderDescriptor,
|
|
209
|
-
hidden: true,
|
|
210
|
-
supportsStructuredOutputs: false
|
|
211
|
-
},
|
|
212
|
-
{
|
|
213
|
-
id: "claude-3-7-sonnet-20250219",
|
|
214
|
-
name: "Claude Sonnet 3.7",
|
|
215
|
-
maxTokens: {
|
|
216
|
-
input: 2e5,
|
|
217
|
-
output: 64e3
|
|
218
|
-
},
|
|
219
|
-
provider: anthropicProviderDescriptor,
|
|
220
|
-
hidden: true,
|
|
221
|
-
supportsStructuredOutputs: false
|
|
222
|
-
},
|
|
223
|
-
{
|
|
224
|
-
id: "claude-3-5-sonnet-latest",
|
|
225
|
-
name: "Claude Sonnet 3.5",
|
|
226
|
-
maxTokens: {
|
|
227
|
-
input: 2e5,
|
|
228
|
-
output: 8192
|
|
229
|
-
},
|
|
230
|
-
provider: anthropicProviderDescriptor,
|
|
231
|
-
hidden: true,
|
|
232
|
-
supportsStructuredOutputs: false
|
|
233
|
-
},
|
|
234
|
-
{
|
|
235
|
-
id: "claude-3-5-sonnet-20241022",
|
|
236
|
-
name: "Claude Sonnet 3.5",
|
|
237
|
-
maxTokens: {
|
|
238
|
-
input: 2e5,
|
|
239
|
-
output: 8192
|
|
240
|
-
},
|
|
241
|
-
provider: anthropicProviderDescriptor,
|
|
242
|
-
hidden: true,
|
|
243
|
-
supportsStructuredOutputs: false
|
|
244
|
-
},
|
|
245
|
-
{
|
|
246
|
-
id: "claude-3-5-sonnet-20240620",
|
|
247
|
-
name: "Claude Sonnet 3.5",
|
|
248
|
-
maxTokens: {
|
|
249
|
-
input: 2e5,
|
|
250
|
-
output: 8192
|
|
251
|
-
},
|
|
252
|
-
provider: anthropicProviderDescriptor,
|
|
253
|
-
hidden: true,
|
|
254
|
-
supportsStructuredOutputs: false
|
|
255
|
-
},
|
|
256
|
-
{
|
|
257
|
-
id: "claude-3-5-haiku-latest",
|
|
258
|
-
name: "Claude Haiku 3.5",
|
|
259
|
-
maxTokens: {
|
|
260
|
-
input: 2e5,
|
|
261
|
-
output: 8192
|
|
262
|
-
},
|
|
263
|
-
provider: anthropicProviderDescriptor,
|
|
264
|
-
hidden: true,
|
|
265
|
-
supportsStructuredOutputs: false
|
|
266
|
-
},
|
|
267
|
-
{
|
|
268
|
-
id: "claude-3-5-haiku-20241022",
|
|
269
|
-
name: "Claude Haiku 3.5",
|
|
270
|
-
maxTokens: {
|
|
271
|
-
input: 2e5,
|
|
272
|
-
output: 8192
|
|
273
|
-
},
|
|
274
|
-
provider: anthropicProviderDescriptor,
|
|
275
|
-
hidden: true,
|
|
276
|
-
supportsStructuredOutputs: false
|
|
277
|
-
},
|
|
278
|
-
{
|
|
279
|
-
id: "claude-3-opus-latest",
|
|
280
|
-
name: "Claude Opus 3",
|
|
281
|
-
maxTokens: {
|
|
282
|
-
input: 2e5,
|
|
283
|
-
output: 4096
|
|
284
|
-
},
|
|
285
|
-
provider: anthropicProviderDescriptor,
|
|
286
|
-
hidden: true,
|
|
287
|
-
supportsStructuredOutputs: false
|
|
288
|
-
},
|
|
289
|
-
{
|
|
290
|
-
id: "claude-3-opus-20240229",
|
|
291
|
-
name: "Claude Opus 3",
|
|
292
|
-
maxTokens: {
|
|
293
|
-
input: 2e5,
|
|
294
|
-
output: 4096
|
|
295
|
-
},
|
|
296
|
-
provider: anthropicProviderDescriptor,
|
|
297
|
-
hidden: true,
|
|
298
|
-
supportsStructuredOutputs: false
|
|
299
|
-
},
|
|
300
|
-
{
|
|
301
|
-
id: "claude-3-sonnet-latest",
|
|
302
|
-
name: "Claude Sonnet 3",
|
|
303
|
-
maxTokens: {
|
|
304
|
-
input: 2e5,
|
|
305
|
-
output: 4096
|
|
306
|
-
},
|
|
307
|
-
provider: anthropicProviderDescriptor,
|
|
308
|
-
hidden: true,
|
|
309
|
-
supportsStructuredOutputs: false
|
|
310
|
-
},
|
|
311
|
-
{
|
|
312
|
-
id: "claude-3-sonnet-20240229",
|
|
313
|
-
name: "Claude Sonnet 3",
|
|
314
|
-
maxTokens: {
|
|
315
|
-
input: 2e5,
|
|
316
|
-
output: 4096
|
|
317
|
-
},
|
|
318
|
-
provider: anthropicProviderDescriptor,
|
|
319
|
-
hidden: true,
|
|
320
|
-
supportsStructuredOutputs: false
|
|
321
|
-
},
|
|
322
|
-
{
|
|
323
|
-
id: "claude-3-haiku-latest",
|
|
324
|
-
name: "Claude Haiku 3",
|
|
325
|
-
maxTokens: {
|
|
326
|
-
input: 2e5,
|
|
327
|
-
output: 4096
|
|
328
|
-
},
|
|
329
|
-
provider: anthropicProviderDescriptor,
|
|
330
|
-
hidden: true,
|
|
331
|
-
supportsStructuredOutputs: false
|
|
332
|
-
},
|
|
333
|
-
{
|
|
334
|
-
id: "claude-3-haiku-20240307",
|
|
335
|
-
name: "Claude Haiku 3",
|
|
336
|
-
maxTokens: {
|
|
337
|
-
input: 2e5,
|
|
338
|
-
output: 4096
|
|
339
|
-
},
|
|
340
|
-
provider: anthropicProviderDescriptor,
|
|
341
|
-
hidden: true,
|
|
342
|
-
supportsStructuredOutputs: false
|
|
343
|
-
},
|
|
344
|
-
{
|
|
345
|
-
id: "claude-2.1",
|
|
346
|
-
name: "Claude 2.1",
|
|
347
|
-
maxTokens: {
|
|
348
|
-
input: 2e5,
|
|
349
|
-
output: 4096
|
|
350
|
-
},
|
|
351
|
-
provider: anthropicProviderDescriptor,
|
|
352
|
-
hidden: true,
|
|
353
|
-
supportsStructuredOutputs: false
|
|
354
189
|
}
|
|
355
190
|
];
|
|
356
191
|
var AnthropicProvider = class extends OpenAICompatibleProviderBase {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anthropicProvider.js","names":["provider"],"sources":["../../../../../plus/ai/src/providers/anthropicProvider.ts"],"sourcesContent":["import { anthropicProviderDescriptor as provider } from '../constants.js';\nimport { AIError, AIErrorReason } from '../errors.js';\nimport type { AIActionType, AIModel } from '../models/model.js';\nimport type { AIChatMessage, AIChatMessageRole, AIResponseFormat, AIToolDefinition } from '../models/provider.js';\nimport { getReducedMaxInputTokens } from '../utils/ai.utils.js';\nimport type { ChatCompletionRequest } from './openAICompatibleProviderBase.js';\nimport { OpenAICompatibleProviderBase } from './openAICompatibleProviderBase.js';\n\ntype AnthropicModel = AIModel<typeof provider.id>;\nconst models: AnthropicModel[] = [\n\t{\n\t\tid: 'claude-opus-5',\n\t\tname: 'Claude Opus 5',\n\t\tmaxTokens: { input: 1000000, output: 128000 },\n\t\tprovider: provider,\n\t\ttemperature: null, // Sampling params removed on Opus 4.7+/Sonnet 5 (rejected with 400)\n\t},\n\t{\n\t\tid: 'claude-fable-5',\n\t\tname: 'Claude Fable 5',\n\t\tmaxTokens: { input: 1000000, output: 128000 },\n\t\tprovider: provider,\n\t\t// Requires 30-day data retention; ZDR orgs get a 400 on every request\n\t\ttemperature: null, // Sampling params removed on Opus 4.7+/Sonnet 5 (rejected with 400)\n\t},\n\t{\n\t\tid: 'claude-sonnet-5',\n\t\tname: 'Claude Sonnet 5',\n\t\tmaxTokens: { input: 1000000, output: 128000 },\n\t\tprovider: provider,\n\t\ttemperature: null, // Sampling params removed on Opus 4.7+/Sonnet 5 (rejected with 400)\n\t},\n\t{\n\t\tid: 'claude-opus-4-8',\n\t\tname: 'Claude Opus 4.8',\n\t\tmaxTokens: { input: 1000000, output: 128000 },\n\t\tprovider: provider,\n\t\ttemperature: null, // Sampling params removed on Opus 4.7+/Sonnet 5 (rejected with 400)\n\t},\n\t{\n\t\tid: 'claude-opus-4-7',\n\t\tname: 'Claude Opus 4.7',\n\t\tmaxTokens: { input: 1000000, output: 128000 },\n\t\tprovider: provider,\n\t\ttemperature: null, // Sampling params removed on Opus 4.7+/Sonnet 5 (rejected with 400)\n\t},\n\t{\n\t\tid: 'claude-sonnet-4-6',\n\t\tname: 'Claude Sonnet 4.6',\n\t\tmaxTokens: { input: 1000000, output: 128000 },\n\t\tprovider: provider,\n\t},\n\t{\n\t\tid: 'claude-opus-4-6',\n\t\tname: 'Claude Opus 4.6',\n\t\tmaxTokens: { input: 1000000, output: 128000 },\n\t\tprovider: provider,\n\t},\n\t{\n\t\tid: 'claude-haiku-4-5',\n\t\tname: 'Claude Haiku 4.5',\n\t\tmaxTokens: { input: 200000, output: 64000 },\n\t\tprovider: provider,\n\t\tdefault: true,\n\t},\n\t{\n\t\tid: 'claude-haiku-4-5-20251001',\n\t\tname: 'Claude Haiku 4.5',\n\t\tmaxTokens: { input: 200000, output: 64000 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'claude-sonnet-4-5',\n\t\tname: 'Claude Sonnet 4.5',\n\t\tmaxTokens: { input: 200000, output: 64000 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'claude-sonnet-4-5-20250929',\n\t\tname: 'Claude Sonnet 4.5',\n\t\tmaxTokens: { input: 200000, output: 64000 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'claude-opus-4-5',\n\t\tname: 'Claude Opus 4.5',\n\t\tmaxTokens: { input: 200000, output: 64000 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'claude-opus-4-5-20251101',\n\t\tname: 'Claude Opus 4.5',\n\t\tmaxTokens: { input: 200000, output: 64000 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'claude-opus-4-1',\n\t\tname: 'Claude Opus 4.1',\n\t\tmaxTokens: { input: 200000, output: 32000 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t\t// Structured outputs require the 4.5 generation or newer (this and every entry below)\n\t\tsupportsStructuredOutputs: false,\n\t},\n\t{\n\t\tid: 'claude-opus-4-1-20250805',\n\t\tname: 'Claude Opus 4.1',\n\t\tmaxTokens: { input: 200000, output: 32000 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t\tsupportsStructuredOutputs: false,\n\t},\n\t{\n\t\tid: 'claude-opus-4-0',\n\t\tname: 'Claude Opus 4',\n\t\tmaxTokens: { input: 200000, output: 32000 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t\tsupportsStructuredOutputs: false,\n\t},\n\t{\n\t\tid: 'claude-opus-4-20250514',\n\t\tname: 'Claude Opus 4',\n\t\tmaxTokens: { input: 200000, output: 32000 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t\tsupportsStructuredOutputs: false,\n\t},\n\t{\n\t\tid: 'claude-sonnet-4-0',\n\t\tname: 'Claude Sonnet 4',\n\t\tmaxTokens: { input: 200000, output: 64000 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t\tsupportsStructuredOutputs: false,\n\t},\n\t{\n\t\tid: 'claude-sonnet-4-20250514',\n\t\tname: 'Claude Sonnet 4',\n\t\tmaxTokens: { input: 200000, output: 64000 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t\tsupportsStructuredOutputs: false,\n\t},\n\t{\n\t\tid: 'claude-3-7-sonnet-latest',\n\t\tname: 'Claude Sonnet 3.7',\n\t\tmaxTokens: { input: 200000, output: 64000 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t\tsupportsStructuredOutputs: false,\n\t},\n\t{\n\t\tid: 'claude-3-7-sonnet-20250219',\n\t\tname: 'Claude Sonnet 3.7',\n\t\tmaxTokens: { input: 200000, output: 64000 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t\tsupportsStructuredOutputs: false,\n\t},\n\t{\n\t\tid: 'claude-3-5-sonnet-latest',\n\t\tname: 'Claude Sonnet 3.5',\n\t\tmaxTokens: { input: 200000, output: 8192 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t\tsupportsStructuredOutputs: false,\n\t},\n\t{\n\t\tid: 'claude-3-5-sonnet-20241022',\n\t\tname: 'Claude Sonnet 3.5',\n\t\tmaxTokens: { input: 200000, output: 8192 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t\tsupportsStructuredOutputs: false,\n\t},\n\t{\n\t\tid: 'claude-3-5-sonnet-20240620',\n\t\tname: 'Claude Sonnet 3.5',\n\t\tmaxTokens: { input: 200000, output: 8192 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t\tsupportsStructuredOutputs: false,\n\t},\n\t{\n\t\tid: 'claude-3-5-haiku-latest',\n\t\tname: 'Claude Haiku 3.5',\n\t\tmaxTokens: { input: 200000, output: 8192 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t\tsupportsStructuredOutputs: false,\n\t},\n\t{\n\t\tid: 'claude-3-5-haiku-20241022',\n\t\tname: 'Claude Haiku 3.5',\n\t\tmaxTokens: { input: 200000, output: 8192 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t\tsupportsStructuredOutputs: false,\n\t},\n\t{\n\t\tid: 'claude-3-opus-latest',\n\t\tname: 'Claude Opus 3',\n\t\tmaxTokens: { input: 200000, output: 4096 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t\tsupportsStructuredOutputs: false,\n\t},\n\t{\n\t\tid: 'claude-3-opus-20240229',\n\t\tname: 'Claude Opus 3',\n\t\tmaxTokens: { input: 200000, output: 4096 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t\tsupportsStructuredOutputs: false,\n\t},\n\t{\n\t\tid: 'claude-3-sonnet-latest',\n\t\tname: 'Claude Sonnet 3',\n\t\tmaxTokens: { input: 200000, output: 4096 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t\tsupportsStructuredOutputs: false,\n\t},\n\t{\n\t\tid: 'claude-3-sonnet-20240229',\n\t\tname: 'Claude Sonnet 3',\n\t\tmaxTokens: { input: 200000, output: 4096 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t\tsupportsStructuredOutputs: false,\n\t},\n\t{\n\t\tid: 'claude-3-haiku-latest',\n\t\tname: 'Claude Haiku 3',\n\t\tmaxTokens: { input: 200000, output: 4096 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t\tsupportsStructuredOutputs: false,\n\t},\n\t{\n\t\tid: 'claude-3-haiku-20240307',\n\t\tname: 'Claude Haiku 3',\n\t\tmaxTokens: { input: 200000, output: 4096 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t\tsupportsStructuredOutputs: false,\n\t},\n\t{\n\t\tid: 'claude-2.1',\n\t\tname: 'Claude 2.1',\n\t\tmaxTokens: { input: 200000, output: 4096 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t\tsupportsStructuredOutputs: false,\n\t},\n];\n\nexport class AnthropicProvider extends OpenAICompatibleProviderBase<typeof provider.id> {\n\treadonly id = provider.id;\n\treadonly name = provider.name;\n\treadonly supportsTools = true;\n\tprotected readonly descriptor = provider;\n\tprotected readonly config = {\n\t\tkeyUrl: 'https://console.anthropic.com/account/keys',\n\t\tkeyValidator: /(?:sk-)?[a-zA-Z0-9-_]{32,}/,\n\t};\n\n\tgetModels(): Promise<readonly AIModel<typeof provider.id>[]> {\n\t\treturn Promise.resolve(models);\n\t}\n\n\tprotected getUrl(_model: AIModel<typeof provider.id>): string {\n\t\treturn 'https://api.anthropic.com/v1/messages';\n\t}\n\n\t// Anthropic uses `output_config.format` (no name/strict — enforcement is unconditional) and\n\t// rejects unknown fields, so this must fully replace the base's `response_format` translation\n\tprotected override applyResponseFormat(\n\t\trequest: ChatCompletionRequest,\n\t\t_model: AIModel<typeof provider.id>,\n\t\tresponseFormat: AIResponseFormat,\n\t): void {\n\t\trequest.output_config = { format: { type: 'json_schema', schema: responseFormat.schema } };\n\t}\n\n\tprotected override getHeaders<TAction extends AIActionType>(\n\t\t_action: TAction,\n\t\tapiKey: string,\n\t\t_model: AIModel<typeof provider.id>,\n\t\t_url: string,\n\t): Record<string, string> {\n\t\treturn {\n\t\t\tAccept: 'application/json',\n\t\t\t'Content-Type': 'application/json',\n\t\t\tAuthorization: `Bearer ${apiKey}`,\n\t\t\t'x-api-key': apiKey,\n\t\t\t'anthropic-version': '2023-06-01',\n\t\t};\n\t}\n\n\tprotected override fetchCore<TAction extends AIActionType>(\n\t\taction: TAction,\n\t\tmodel: AIModel<typeof provider.id>,\n\t\tapiKey: string,\n\t\trequest: object,\n\t\tsignal: AbortSignal | undefined,\n\t): Promise<Response> {\n\t\tif ('max_completion_tokens' in request) {\n\t\t\tconst { max_completion_tokens: max, ...rest } = request;\n\t\t\trequest = max ? { max_tokens: max, ...rest } : rest;\n\t\t}\n\t\treturn super.fetchCore(action, model, apiKey, request, signal);\n\t}\n\n\tprotected override extractSystemPrompt(messages: AIChatMessage<AIChatMessageRole>[]): {\n\t\tmessages: AIChatMessage<AIChatMessageRole>[];\n\t\tsystem?: string;\n\t} {\n\t\t// Anthropic's Messages API rejects `system`-role entries in `messages` and requires the initial\n\t\t// system prompt in the top-level `system` field, so pull any such messages out.\n\t\tconst systemMessages = messages.filter(m => m.role === 'system');\n\t\tif (!systemMessages.length) return { messages: messages };\n\n\t\treturn {\n\t\t\tsystem: systemMessages.map(m => m.content).join('\\n\\n'),\n\t\t\tmessages: messages.filter(m => m.role !== 'system'),\n\t\t};\n\t}\n\n\tprotected override async handleFetchFailure<TAction extends AIActionType>(\n\t\trsp: Response,\n\t\taction: TAction,\n\t\tmodel: AIModel<typeof provider.id>,\n\t\tretries: number,\n\t\tmaxInputTokens: number,\n\t\tbody?: string,\n\t\tsentTools?: boolean,\n\t): Promise<{ retry: true; maxInputTokens: number; withoutTools?: boolean }> {\n\t\tif (rsp.status !== 404 && rsp.status !== 429) {\n\t\t\t// Read into `body` (not the response) so `super.handleFetchFailure` below can still\n\t\t\t// use it; consuming the response here would lose Anthropic's error for the fallback.\n\t\t\tbody ??= await rsp\n\t\t\t\t.clone()\n\t\t\t\t.text()\n\t\t\t\t.catch(() => undefined);\n\t\t\tlet json;\n\t\t\ttry {\n\t\t\t\tjson = (body != null ? JSON.parse(body) : undefined) as AnthropicError | undefined;\n\t\t\t} catch {}\n\n\t\t\tdebugger;\n\n\t\t\tif (json?.error?.type === 'invalid_request_error') {\n\t\t\t\tif (json?.error?.message?.includes('prompt is too long')) {\n\t\t\t\t\tif (retries < 3) {\n\t\t\t\t\t\t// Extract actual token count from error to calculate smarter reduction\n\t\t\t\t\t\tconst match = /prompt is too long: (\\d+) tokens/.exec(json?.error?.message);\n\t\t\t\t\t\tconst estimatedTokens = match?.[1] != null ? parseInt(match[1], 10) : undefined;\n\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tretry: true,\n\t\t\t\t\t\t\tmaxInputTokens: getReducedMaxInputTokens(maxInputTokens, retries + 1, estimatedTokens),\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\n\t\t\t\t\tthrow new AIError(\n\t\t\t\t\t\tAIErrorReason.RequestTooLarge,\n\t\t\t\t\t\tnew Error(`(${this.name}) ${rsp.status}: ${json?.error?.message || rsp.statusText}`),\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tif (json?.error?.message?.includes('balance is too low')) {\n\t\t\t\t\tthrow new AIError(\n\t\t\t\t\t\tAIErrorReason.RateLimitOrFundsExceeded,\n\t\t\t\t\t\tnew Error(`(${this.name}) ${rsp.status}: ${json?.error?.message || rsp.statusText}`),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn super.handleFetchFailure(rsp, action, model, retries, maxInputTokens, body, sentTools);\n\t}\n\n\tprotected override serializeTools(tools: readonly AIToolDefinition[]): { tools: unknown[] } {\n\t\t// Anthropic names the schema field `input_schema` and has no `function` envelope.\n\t\treturn {\n\t\t\ttools: tools.map(t => ({ name: t.name, description: t.description, input_schema: t.parameters })),\n\t\t};\n\t}\n\n\tprotected override serializeMessages(messages: AIChatMessage<AIChatMessageRole>[]): unknown[] {\n\t\tconst out: unknown[] = [];\n\n\t\tfor (const m of messages) {\n\t\t\t// Anthropic carries tool results as `tool_result` blocks on a *user* message, not a\n\t\t\t// `tool`-role message. Consecutive results are batched into one user turn, matching how the\n\t\t\t// API expects a multi-tool-call round to be answered.\n\t\t\tif (m.role === 'tool') {\n\t\t\t\t// See the base provider: a result with no call id can't be addressed, so it goes as plain\n\t\t\t\t// text instead of a `tool_use_id: undefined` block the API rejects.\n\t\t\t\tif (m.toolCallId == null) {\n\t\t\t\t\tout.push({ role: 'user', content: m.content });\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tconst block = { type: 'tool_result', tool_use_id: m.toolCallId, content: m.content };\n\t\t\t\tconst last = out.at(-1) as { role?: string; content?: unknown[] } | undefined;\n\t\t\t\tif (last?.role === 'user' && Array.isArray(last.content) && isToolResultBlocks(last.content)) {\n\t\t\t\t\tlast.content.push(block);\n\t\t\t\t} else {\n\t\t\t\t\tout.push({ role: 'user', content: [block] });\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (m.role === 'assistant' && m.toolCalls?.length) {\n\t\t\t\tout.push({\n\t\t\t\t\trole: 'assistant',\n\t\t\t\t\tcontent: [\n\t\t\t\t\t\t...(m.content ? [{ type: 'text', text: m.content }] : []),\n\t\t\t\t\t\t...m.toolCalls.map(c => ({ type: 'tool_use', id: c.id, name: c.name, input: c.args })),\n\t\t\t\t\t],\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tout.push({ role: m.role, content: m.content });\n\t\t}\n\n\t\treturn out;\n\t}\n}\n\n/** Whether an assembled user message's content is a batch of `tool_result` blocks we can append to. */\nfunction isToolResultBlocks(content: unknown[]): content is { type: string }[] {\n\treturn content.every(b => (b as { type?: string })?.type === 'tool_result');\n}\n\ninterface AnthropicError {\n\ttype: 'error';\n\terror: {\n\t\ttype:\n\t\t\t| 'invalid_request_error'\n\t\t\t| 'authentication_error'\n\t\t\t| 'permission_error'\n\t\t\t| 'not_found_error'\n\t\t\t| 'rate_limit_error'\n\t\t\t| 'api_error'\n\t\t\t| 'overloaded_error';\n\t\tmessage: string;\n\t};\n}\n"],"mappings":";;;;;AASA,MAAM,SAA2B;CAChC;EACC,IAAI;EACJ,MAAM;EACN,WAAW;GAAE,OAAO;GAAS,QAAQ;EAAO;EAC5C,UAAUA;EACV,aAAa;CACd;CACA;EACC,IAAI;EACJ,MAAM;EACN,WAAW;GAAE,OAAO;GAAS,QAAQ;EAAO;EAC5C,UAAUA;EAEV,aAAa;CACd;CACA;EACC,IAAI;EACJ,MAAM;EACN,WAAW;GAAE,OAAO;GAAS,QAAQ;EAAO;EAC5C,UAAUA;EACV,aAAa;CACd;CACA;EACC,IAAI;EACJ,MAAM;EACN,WAAW;GAAE,OAAO;GAAS,QAAQ;EAAO;EAC5C,UAAUA;EACV,aAAa;CACd;CACA;EACC,IAAI;EACJ,MAAM;EACN,WAAW;GAAE,OAAO;GAAS,QAAQ;EAAO;EAC5C,UAAUA;EACV,aAAa;CACd;CACA;EACC,IAAI;EACJ,MAAM;EACN,WAAW;GAAE,OAAO;GAAS,QAAQ;EAAO;EAC5C,UAAUA;CACX;CACA;EACC,IAAI;EACJ,MAAM;EACN,WAAW;GAAE,OAAO;GAAS,QAAQ;EAAO;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":["../../../../../plus/ai/src/providers/anthropicProvider.ts"],"sourcesContent":["import { anthropicProviderDescriptor as provider } from '../constants.js';\nimport { AIError, AIErrorReason } from '../errors.js';\nimport type { AIActionType, AIModel } from '../models/model.js';\nimport type { AIChatMessage, AIChatMessageRole, AIResponseFormat, AIToolDefinition } from '../models/provider.js';\nimport { getReducedMaxInputTokens } from '../utils/ai.utils.js';\nimport type { ChatCompletionRequest } from './openAICompatibleProviderBase.js';\nimport { OpenAICompatibleProviderBase } from './openAICompatibleProviderBase.js';\n\ntype AnthropicModel = AIModel<typeof provider.id>;\nconst models: AnthropicModel[] = [\n\t{\n\t\tid: 'claude-fable-5-2',\n\t\tname: 'Claude Fable 5.2',\n\t\tmaxTokens: { input: 1000000, output: 128000 },\n\t\tprovider: provider,\n\t\t// Requires 30-day data retention; ZDR orgs get a 400 on every request\n\t\ttemperature: null, // Sampling params removed on Opus 4.7+/Sonnet 5 (rejected with 400)\n\t},\n\t{\n\t\tid: 'claude-opus-5-5',\n\t\tname: 'Claude Opus 5.5',\n\t\tmaxTokens: { input: 1000000, output: 128000 },\n\t\tprovider: provider,\n\t\ttemperature: null, // Sampling params removed on Opus 4.7+/Sonnet 5 (rejected with 400)\n\t},\n\t{\n\t\tid: 'claude-sonnet-5-5',\n\t\tname: 'Claude Sonnet 5.5',\n\t\tmaxTokens: { input: 1000000, output: 128000 },\n\t\tprovider: provider,\n\t\ttemperature: null, // Sampling params removed on Opus 4.7+/Sonnet 5 (rejected with 400)\n\t},\n\t{\n\t\tid: 'claude-haiku-5-5',\n\t\tname: 'Claude Haiku 5.5',\n\t\tmaxTokens: { input: 1000000, output: 128000 },\n\t\tprovider: provider,\n\t\tdefault: true,\n\t\ttemperature: null, // Sampling params removed on Opus 4.7+/Sonnet 5 (rejected with 400)\n\t},\n\t{\n\t\tid: 'claude-fable-5-1',\n\t\tname: 'Claude Fable 5.1',\n\t\tmaxTokens: { input: 1000000, output: 128000 },\n\t\tprovider: provider,\n\t\t// Requires 30-day data retention; ZDR orgs get a 400 on every request\n\t\ttemperature: null, // Sampling params removed on Opus 4.7+/Sonnet 5 (rejected with 400)\n\t},\n\t{\n\t\tid: 'claude-opus-5',\n\t\tname: 'Claude Opus 5',\n\t\tmaxTokens: { input: 1000000, output: 128000 },\n\t\tprovider: provider,\n\t\ttemperature: null, // Sampling params removed on Opus 4.7+/Sonnet 5 (rejected with 400)\n\t},\n\t{\n\t\tid: 'claude-fable-5',\n\t\tname: 'Claude Fable 5',\n\t\tmaxTokens: { input: 1000000, output: 128000 },\n\t\tprovider: provider,\n\t\t// Requires 30-day data retention; ZDR orgs get a 400 on every request\n\t\ttemperature: null, // Sampling params removed on Opus 4.7+/Sonnet 5 (rejected with 400)\n\t},\n\t{\n\t\tid: 'claude-sonnet-5',\n\t\tname: 'Claude Sonnet 5',\n\t\tmaxTokens: { input: 1000000, output: 128000 },\n\t\tprovider: provider,\n\t\ttemperature: null, // Sampling params removed on Opus 4.7+/Sonnet 5 (rejected with 400)\n\t},\n\t{\n\t\tid: 'claude-opus-4-8',\n\t\tname: 'Claude Opus 4.8',\n\t\tmaxTokens: { input: 1000000, output: 128000 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t\ttemperature: null, // Sampling params removed on Opus 4.7+/Sonnet 5 (rejected with 400)\n\t},\n\t{\n\t\tid: 'claude-opus-4-7',\n\t\tname: 'Claude Opus 4.7',\n\t\tmaxTokens: { input: 1000000, output: 128000 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t\ttemperature: null, // Sampling params removed on Opus 4.7+/Sonnet 5 (rejected with 400)\n\t},\n\t{\n\t\tid: 'claude-sonnet-4-6',\n\t\tname: 'Claude Sonnet 4.6',\n\t\tmaxTokens: { input: 1000000, output: 128000 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'claude-opus-4-6',\n\t\tname: 'Claude Opus 4.6',\n\t\tmaxTokens: { input: 1000000, output: 128000 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'claude-haiku-4-5',\n\t\tname: 'Claude Haiku 4.5',\n\t\tmaxTokens: { input: 200000, output: 64000 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'claude-haiku-4-5-20251001',\n\t\tname: 'Claude Haiku 4.5',\n\t\tmaxTokens: { input: 200000, output: 64000 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t// Anthropic retires Sonnet 4.5 on 2026-11-30 — remove both entries after that date (#6164)\n\t{\n\t\tid: 'claude-sonnet-4-5',\n\t\tname: 'Claude Sonnet 4.5',\n\t\tmaxTokens: { input: 200000, output: 64000 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'claude-sonnet-4-5-20250929',\n\t\tname: 'Claude Sonnet 4.5',\n\t\tmaxTokens: { input: 200000, output: 64000 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'claude-opus-4-5',\n\t\tname: 'Claude Opus 4.5',\n\t\tmaxTokens: { input: 200000, output: 64000 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n\t{\n\t\tid: 'claude-opus-4-5-20251101',\n\t\tname: 'Claude Opus 4.5',\n\t\tmaxTokens: { input: 200000, output: 64000 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t},\n];\n\nexport class AnthropicProvider extends OpenAICompatibleProviderBase<typeof provider.id> {\n\treadonly id = provider.id;\n\treadonly name = provider.name;\n\treadonly supportsTools = true;\n\tprotected readonly descriptor = provider;\n\tprotected readonly config = {\n\t\tkeyUrl: 'https://console.anthropic.com/account/keys',\n\t\tkeyValidator: /(?:sk-)?[a-zA-Z0-9-_]{32,}/,\n\t};\n\n\tgetModels(): Promise<readonly AIModel<typeof provider.id>[]> {\n\t\treturn Promise.resolve(models);\n\t}\n\n\tprotected getUrl(_model: AIModel<typeof provider.id>): string {\n\t\treturn 'https://api.anthropic.com/v1/messages';\n\t}\n\n\t// Anthropic uses `output_config.format` (no name/strict — enforcement is unconditional) and\n\t// rejects unknown fields, so this must fully replace the base's `response_format` translation\n\tprotected override applyResponseFormat(\n\t\trequest: ChatCompletionRequest,\n\t\t_model: AIModel<typeof provider.id>,\n\t\tresponseFormat: AIResponseFormat,\n\t): void {\n\t\trequest.output_config = { format: { type: 'json_schema', schema: responseFormat.schema } };\n\t}\n\n\tprotected override getHeaders<TAction extends AIActionType>(\n\t\t_action: TAction,\n\t\tapiKey: string,\n\t\t_model: AIModel<typeof provider.id>,\n\t\t_url: string,\n\t): Record<string, string> {\n\t\treturn {\n\t\t\tAccept: 'application/json',\n\t\t\t'Content-Type': 'application/json',\n\t\t\tAuthorization: `Bearer ${apiKey}`,\n\t\t\t'x-api-key': apiKey,\n\t\t\t'anthropic-version': '2023-06-01',\n\t\t};\n\t}\n\n\tprotected override fetchCore<TAction extends AIActionType>(\n\t\taction: TAction,\n\t\tmodel: AIModel<typeof provider.id>,\n\t\tapiKey: string,\n\t\trequest: object,\n\t\tsignal: AbortSignal | undefined,\n\t): Promise<Response> {\n\t\tif ('max_completion_tokens' in request) {\n\t\t\tconst { max_completion_tokens: max, ...rest } = request;\n\t\t\trequest = max ? { max_tokens: max, ...rest } : rest;\n\t\t}\n\t\treturn super.fetchCore(action, model, apiKey, request, signal);\n\t}\n\n\tprotected override extractSystemPrompt(messages: AIChatMessage<AIChatMessageRole>[]): {\n\t\tmessages: AIChatMessage<AIChatMessageRole>[];\n\t\tsystem?: string;\n\t} {\n\t\t// Anthropic's Messages API rejects `system`-role entries in `messages` and requires the initial\n\t\t// system prompt in the top-level `system` field, so pull any such messages out.\n\t\tconst systemMessages = messages.filter(m => m.role === 'system');\n\t\tif (!systemMessages.length) return { messages: messages };\n\n\t\treturn {\n\t\t\tsystem: systemMessages.map(m => m.content).join('\\n\\n'),\n\t\t\tmessages: messages.filter(m => m.role !== 'system'),\n\t\t};\n\t}\n\n\tprotected override async handleFetchFailure<TAction extends AIActionType>(\n\t\trsp: Response,\n\t\taction: TAction,\n\t\tmodel: AIModel<typeof provider.id>,\n\t\tretries: number,\n\t\tmaxInputTokens: number,\n\t\tbody?: string,\n\t\tsentTools?: boolean,\n\t): Promise<{ retry: true; maxInputTokens: number; withoutTools?: boolean }> {\n\t\tif (rsp.status !== 404 && rsp.status !== 429) {\n\t\t\t// Read into `body` (not the response) so `super.handleFetchFailure` below can still\n\t\t\t// use it; consuming the response here would lose Anthropic's error for the fallback.\n\t\t\tbody ??= await rsp\n\t\t\t\t.clone()\n\t\t\t\t.text()\n\t\t\t\t.catch(() => undefined);\n\t\t\tlet json;\n\t\t\ttry {\n\t\t\t\tjson = (body != null ? JSON.parse(body) : undefined) as AnthropicError | undefined;\n\t\t\t} catch {}\n\n\t\t\tdebugger;\n\n\t\t\tif (json?.error?.type === 'invalid_request_error') {\n\t\t\t\tif (json?.error?.message?.includes('prompt is too long')) {\n\t\t\t\t\tif (retries < 3) {\n\t\t\t\t\t\t// Extract actual token count from error to calculate smarter reduction\n\t\t\t\t\t\tconst match = /prompt is too long: (\\d+) tokens/.exec(json?.error?.message);\n\t\t\t\t\t\tconst estimatedTokens = match?.[1] != null ? parseInt(match[1], 10) : undefined;\n\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tretry: true,\n\t\t\t\t\t\t\tmaxInputTokens: getReducedMaxInputTokens(maxInputTokens, retries + 1, estimatedTokens),\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\n\t\t\t\t\tthrow new AIError(\n\t\t\t\t\t\tAIErrorReason.RequestTooLarge,\n\t\t\t\t\t\tnew Error(`(${this.name}) ${rsp.status}: ${json?.error?.message || rsp.statusText}`),\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tif (json?.error?.message?.includes('balance is too low')) {\n\t\t\t\t\tthrow new AIError(\n\t\t\t\t\t\tAIErrorReason.RateLimitOrFundsExceeded,\n\t\t\t\t\t\tnew Error(`(${this.name}) ${rsp.status}: ${json?.error?.message || rsp.statusText}`),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn super.handleFetchFailure(rsp, action, model, retries, maxInputTokens, body, sentTools);\n\t}\n\n\tprotected override serializeTools(tools: readonly AIToolDefinition[]): { tools: unknown[] } {\n\t\t// Anthropic names the schema field `input_schema` and has no `function` envelope.\n\t\treturn {\n\t\t\ttools: tools.map(t => ({ name: t.name, description: t.description, input_schema: t.parameters })),\n\t\t};\n\t}\n\n\tprotected override serializeMessages(messages: AIChatMessage<AIChatMessageRole>[]): unknown[] {\n\t\tconst out: unknown[] = [];\n\n\t\tfor (const m of messages) {\n\t\t\t// Anthropic carries tool results as `tool_result` blocks on a *user* message, not a\n\t\t\t// `tool`-role message. Consecutive results are batched into one user turn, matching how the\n\t\t\t// API expects a multi-tool-call round to be answered.\n\t\t\tif (m.role === 'tool') {\n\t\t\t\t// See the base provider: a result with no call id can't be addressed, so it goes as plain\n\t\t\t\t// text instead of a `tool_use_id: undefined` block the API rejects.\n\t\t\t\tif (m.toolCallId == null) {\n\t\t\t\t\tout.push({ role: 'user', content: m.content });\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tconst block = { type: 'tool_result', tool_use_id: m.toolCallId, content: m.content };\n\t\t\t\tconst last = out.at(-1) as { role?: string; content?: unknown[] } | undefined;\n\t\t\t\tif (last?.role === 'user' && Array.isArray(last.content) && isToolResultBlocks(last.content)) {\n\t\t\t\t\tlast.content.push(block);\n\t\t\t\t} else {\n\t\t\t\t\tout.push({ role: 'user', content: [block] });\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (m.role === 'assistant' && m.toolCalls?.length) {\n\t\t\t\tout.push({\n\t\t\t\t\trole: 'assistant',\n\t\t\t\t\tcontent: [\n\t\t\t\t\t\t...(m.content ? [{ type: 'text', text: m.content }] : []),\n\t\t\t\t\t\t...m.toolCalls.map(c => ({ type: 'tool_use', id: c.id, name: c.name, input: c.args })),\n\t\t\t\t\t],\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tout.push({ role: m.role, content: m.content });\n\t\t}\n\n\t\treturn out;\n\t}\n}\n\n/** Whether an assembled user message's content is a batch of `tool_result` blocks we can append to. */\nfunction isToolResultBlocks(content: unknown[]): content is { type: string }[] {\n\treturn content.every(b => (b as { type?: string })?.type === 'tool_result');\n}\n\ninterface AnthropicError {\n\ttype: 'error';\n\terror: {\n\t\ttype:\n\t\t\t| 'invalid_request_error'\n\t\t\t| 'authentication_error'\n\t\t\t| 'permission_error'\n\t\t\t| 'not_found_error'\n\t\t\t| 'rate_limit_error'\n\t\t\t| 'api_error'\n\t\t\t| 'overloaded_error';\n\t\tmessage: string;\n\t};\n}\n"],"mappings":";;;;;AASA,MAAM,SAA2B;CAChC;EACC,IAAI;EACJ,MAAM;EACN,WAAW;GAAE,OAAO;GAAS,QAAQ;EAAO;EAC5C,UAAUA;EAEV,aAAa;CACd;CACA;EACC,IAAI;EACJ,MAAM;EACN,WAAW;GAAE,OAAO;GAAS,QAAQ;EAAO;EAC5C,UAAUA;EACV,aAAa;CACd;CACA;EACC,IAAI;EACJ,MAAM;EACN,WAAW;GAAE,OAAO;GAAS,QAAQ;EAAO;EAC5C,UAAUA;EACV,aAAa;CACd;CACA;EACC,IAAI;EACJ,MAAM;EACN,WAAW;GAAE,OAAO;GAAS,QAAQ;EAAO;EAC5C,UAAUA;EACV,SAAS;EACT,aAAa;CACd;CACA;EACC,IAAI;EACJ,MAAM;EACN,WAAW;GAAE,OAAO;GAAS,QAAQ;EAAO;EAC5C,UAAUA;EAEV,aAAa;CACd;CACA;EACC,IAAI;EACJ,MAAM;EACN,WAAW;GAAE,OAAO;GAAS,QAAQ;EAAO;EAC5C,UAAUA;EACV,aAAa;CACd;CACA;EACC,IAAI;EACJ,MAAM;EACN,WAAW;GAAE,OAAO;GAAS,QAAQ;EAAO;EAC5C,UAAUA;EAEV,aAAa;CACd;CACA;EACC,IAAI;EACJ,MAAM;EACN,WAAW;GAAE,OAAO;GAAS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IAAE,CAAC;IAE5C;GACD;GAEA,IAAI,EAAE,SAAS,eAAe,EAAE,WAAW,QAAQ;IAClD,IAAI,KAAK;KACR,MAAM;KACN,SAAS,CACR,GAAI,EAAE,UAAU,CAAC;MAAE,MAAM;MAAQ,MAAM,EAAE;KAAQ,CAAC,IAAI,CAAC,GACvD,GAAG,EAAE,UAAU,KAAI,OAAM;MAAE,MAAM;MAAY,IAAI,EAAE;MAAI,MAAM,EAAE;MAAM,OAAO,EAAE;KAAK,EAAE,CACtF;IACD,CAAC;IACD;GACD;GAEA,IAAI,KAAK;IAAE,MAAM,EAAE;IAAM,SAAS,EAAE;GAAQ,CAAC;EAC9C;EAEA,OAAO;CACR;AACD;;AAGA,SAAS,mBAAmB,SAAmD;CAC9E,OAAO,QAAQ,OAAM,MAAM,GAAyB,SAAS,aAAa;AAC3E"}
|
|
@@ -1,26 +1,40 @@
|
|
|
1
1
|
import { deepSeekProviderDescriptor } from "../constants.js";
|
|
2
2
|
import { OpenAICompatibleProviderBase } from "./openAICompatibleProviderBase.js";
|
|
3
3
|
//#region ../plus/ai/src/providers/deepSeekProvider.ts
|
|
4
|
-
const models = [
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
const models = [
|
|
5
|
+
{
|
|
6
|
+
id: "deepseek-flash",
|
|
7
|
+
name: "DeepSeek Flash",
|
|
8
|
+
maxTokens: {
|
|
9
|
+
input: 1e6,
|
|
10
|
+
output: 384e3
|
|
11
|
+
},
|
|
12
|
+
provider: deepSeekProviderDescriptor,
|
|
13
|
+
default: true,
|
|
14
|
+
temperature: 0
|
|
10
15
|
},
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
{
|
|
17
|
+
id: "deepseek-v4-pro",
|
|
18
|
+
name: "DeepSeek V4 Pro",
|
|
19
|
+
maxTokens: {
|
|
20
|
+
input: 1e6,
|
|
21
|
+
output: 384e3
|
|
22
|
+
},
|
|
23
|
+
provider: deepSeekProviderDescriptor,
|
|
24
|
+
temperature: 0
|
|
19
25
|
},
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
26
|
+
{
|
|
27
|
+
id: "deepseek-v4-flash",
|
|
28
|
+
name: "DeepSeek V4 Flash",
|
|
29
|
+
maxTokens: {
|
|
30
|
+
input: 1e6,
|
|
31
|
+
output: 384e3
|
|
32
|
+
},
|
|
33
|
+
provider: deepSeekProviderDescriptor,
|
|
34
|
+
hidden: true,
|
|
35
|
+
temperature: 0
|
|
36
|
+
}
|
|
37
|
+
];
|
|
24
38
|
var DeepSeekProvider = class extends OpenAICompatibleProviderBase {
|
|
25
39
|
id = deepSeekProviderDescriptor.id;
|
|
26
40
|
name = deepSeekProviderDescriptor.name;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deepSeekProvider.js","names":["provider"],"sources":["../../../../../plus/ai/src/providers/deepSeekProvider.ts"],"sourcesContent":["import { deepSeekProviderDescriptor as provider } from '../constants.js';\nimport type { AIModel } from '../models/model.js';\nimport { OpenAICompatibleProviderBase } from './openAICompatibleProviderBase.js';\n\ntype DeepSeekModel = AIModel<typeof provider.id>;\nconst models: DeepSeekModel[] = [\n\t{\n\t\tid: 'deepseek-v4-pro',\n\t\tname: 'DeepSeek V4 Pro',\n\t\tmaxTokens: { input: 1000000, output: 384000 }, // DeepSeek publishes \"384K\" only; decimal reading avoids overstating\n\t\tprovider: provider,\n\t\ttemperature: 0.0, // Recommended for Coding/Math\n\t},\n\t{\n\t\tid: 'deepseek-v4-flash',\n\t\tname: 'DeepSeek V4 Flash',\n\t\tmaxTokens: { input: 1000000, output: 384000 },\n\t\tprovider: provider,\n\t\
|
|
1
|
+
{"version":3,"file":"deepSeekProvider.js","names":["provider"],"sources":["../../../../../plus/ai/src/providers/deepSeekProvider.ts"],"sourcesContent":["import { deepSeekProviderDescriptor as provider } from '../constants.js';\nimport type { AIModel } from '../models/model.js';\nimport { OpenAICompatibleProviderBase } from './openAICompatibleProviderBase.js';\n\ntype DeepSeekModel = AIModel<typeof provider.id>;\nconst models: DeepSeekModel[] = [\n\t{\n\t\tid: 'deepseek-flash',\n\t\tname: 'DeepSeek Flash',\n\t\tmaxTokens: { input: 1000000, output: 384000 },\n\t\tprovider: provider,\n\t\tdefault: true,\n\t\ttemperature: 0.0, // Recommended for Coding/Math\n\t},\n\t{\n\t\tid: 'deepseek-v4-pro',\n\t\tname: 'DeepSeek V4 Pro',\n\t\tmaxTokens: { input: 1000000, output: 384000 }, // DeepSeek publishes \"384K\" only; decimal reading avoids overstating\n\t\tprovider: provider,\n\t\ttemperature: 0.0, // Recommended for Coding/Math\n\t},\n\t{\n\t\tid: 'deepseek-v4-flash',\n\t\tname: 'DeepSeek V4 Flash',\n\t\tmaxTokens: { input: 1000000, output: 384000 },\n\t\tprovider: provider,\n\t\thidden: true,\n\t\ttemperature: 0.0, // Recommended for Coding/Math\n\t},\n];\n\nexport class DeepSeekProvider extends OpenAICompatibleProviderBase<typeof provider.id> {\n\treadonly id = provider.id;\n\treadonly name = provider.name;\n\treadonly supportsTools = true;\n\tprotected readonly descriptor = provider;\n\tprotected readonly config = {\n\t\tkeyUrl: 'https://platform.deepseek.com/api_keys',\n\t\tkeyValidator: /(?:sk-)?[a-zA-Z0-9]{32,}/,\n\t};\n\n\tgetModels(): Promise<readonly AIModel<typeof provider.id>[]> {\n\t\treturn Promise.resolve(models);\n\t}\n\n\tprotected getUrl(_model: AIModel<typeof provider.id>): string {\n\t\treturn 'https://api.deepseek.com/v1/chat/completions';\n\t}\n\n\t// DeepSeek's response_format only accepts text|json_object — json_schema is rejected outright\n\tprotected override supportsResponseFormat(_model: AIModel<typeof provider.id>): boolean {\n\t\treturn false;\n\t}\n}\n"],"mappings":";;;AAKA,MAAM,SAA0B;CAC/B;EACC,IAAI;EACJ,MAAM;EACN,WAAW;GAAE,OAAO;GAAS,QAAQ;EAAO;EAC5C,UAAUA;EACV,SAAS;EACT,aAAa;CACd;CACA;EACC,IAAI;EACJ,MAAM;EACN,WAAW;GAAE,OAAO;GAAS,QAAQ;EAAO;EAC5C,UAAUA;EACV,aAAa;CACd;CACA;EACC,IAAI;EACJ,MAAM;EACN,WAAW;GAAE,OAAO;GAAS,QAAQ;EAAO;EAC5C,UAAUA;EACV,QAAQ;EACR,aAAa;CACd;AACD;AAEA,IAAa,mBAAb,cAAsC,6BAAiD;CACtF,KAAcA,2BAAS;CACvB,OAAgBA,2BAAS;CACzB,gBAAyB;CACzB,aAAgCA;CAChC,SAA4B;EAC3B,QAAQ;EACR,cAAc;CACf;CAEA,YAA6D;EAC5D,OAAO,QAAQ,QAAQ,MAAM;CAC9B;CAEA,OAAiB,QAA6C;EAC7D,OAAO;CACR;CAGA,uBAA0C,QAA8C;EACvF,OAAO;CACR;AACD"}
|