@opencode/ai 2.3.0 → 2.3.1
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 +65 -18
- package/dist/cache-policy.js +4 -2
- package/dist/effect.d.ts +3 -1
- package/dist/generation.d.ts +10 -10
- package/dist/generation.js +8 -14
- package/dist/image-client.d.ts +56 -59
- package/dist/image-client.js +47 -8
- package/dist/image.d.ts +36 -95
- package/dist/image.js +11 -14
- package/dist/index.d.ts +25 -25
- package/dist/index.js +29 -22
- package/dist/llm.d.ts +4 -1
- package/dist/llm.js +10 -1
- package/dist/media-client.d.ts +18 -6
- package/dist/media-client.js +42 -37
- package/dist/media.d.ts +17 -1
- package/dist/media.js +28 -7
- package/dist/protocols/alibaba-messages.d.ts +24 -2
- package/dist/protocols/alibaba-responses.d.ts +26 -0
- package/dist/protocols/anthropic-messages.d.ts +70 -6
- package/dist/protocols/anthropic-messages.js +74 -9
- package/dist/protocols/assemblyai-transcription.js +7 -6
- package/dist/protocols/cartesia-speech.d.ts +0 -8
- package/dist/protocols/deepgram-speech.d.ts +0 -8
- package/dist/protocols/elevenlabs-speech.d.ts +0 -8
- package/dist/protocols/google-interactions-video.d.ts +4 -9
- package/dist/protocols/google-interactions-video.js +9 -10
- package/dist/protocols/google-speech.d.ts +0 -8
- package/dist/protocols/google-transcription.d.ts +0 -8
- package/dist/protocols/meta-messages.d.ts +24 -2
- package/dist/protocols/meta-responses.d.ts +52 -0
- package/dist/protocols/minimax-video.d.ts +6 -15
- package/dist/protocols/minimax-video.js +25 -27
- package/dist/protocols/open-responses.d.ts +250 -24
- package/dist/protocols/open-responses.js +40 -24
- package/dist/protocols/openai-chat.js +7 -3
- package/dist/protocols/openai-compatible-responses.d.ts +26 -0
- package/dist/protocols/openai-freeform.d.ts +1 -1
- package/dist/protocols/openai-freeform.js +9 -5
- package/dist/protocols/openai-images.d.ts +0 -8
- package/dist/protocols/openai-responses.d.ts +153 -0
- package/dist/protocols/openai-responses.js +68 -7
- package/dist/protocols/openai-speech.d.ts +0 -8
- package/dist/protocols/openai-transcription.d.ts +0 -8
- package/dist/protocols/openrouter-video.d.ts +4 -9
- package/dist/protocols/openrouter-video.js +14 -13
- package/dist/protocols/seedance-video.d.ts +4 -9
- package/dist/protocols/seedance-video.js +13 -12
- package/dist/protocols/utils/gateway-protocol.js +1 -0
- package/dist/protocols/utils/responses-compaction.js +7 -3
- package/dist/protocols/xai-responses.d.ts +26 -0
- package/dist/protocols/xai-video.d.ts +4 -9
- package/dist/protocols/xai-video.js +13 -9
- package/dist/protocols/zai-messages.d.ts +24 -2
- package/dist/providers/alibaba.d.ts +50 -2
- package/dist/providers/amazon-bedrock-mantle.d.ts +50 -2
- package/dist/providers/anthropic-compatible.d.ts +24 -2
- package/dist/providers/anthropic.d.ts +24 -2
- package/dist/providers/azure.d.ts +76 -2
- package/dist/providers/cloudflare-ai-gateway.d.ts +100 -4
- package/dist/providers/digitalocean.d.ts +26 -0
- package/dist/providers/google-vertex-messages.d.ts +24 -2
- package/dist/providers/google-vertex-messages.js +1 -0
- package/dist/providers/google-vertex-responses.d.ts +26 -0
- package/dist/providers/google.d.ts +3 -3
- package/dist/providers/google.js +5 -2
- package/dist/providers/meta.d.ts +50 -2
- package/dist/providers/minimax.d.ts +50 -2
- package/dist/providers/moonshot.d.ts +50 -2
- package/dist/providers/openai-compatible-responses.d.ts +26 -0
- package/dist/providers/openai.d.ts +26 -0
- package/dist/providers/openrouter.d.ts +26 -0
- package/dist/providers/venice.d.ts +26 -0
- package/dist/providers/xai/videos.d.ts +2 -0
- package/dist/providers/xai/videos.js +1 -0
- package/dist/providers/xai.d.ts +4 -3
- package/dist/providers/xai.js +5 -1
- package/dist/providers/zai-coding-plan.d.ts +50 -2
- package/dist/public.d.ts +5 -4
- package/dist/public.js +1 -1
- package/dist/route/client.d.ts +2 -0
- package/dist/route/client.js +5 -1
- package/dist/route/executor-service.d.ts +14 -1
- package/dist/route/executor-service.js +28 -1
- package/dist/route/executor.d.ts +5 -2
- package/dist/route/executor.js +20 -5
- package/dist/route/media-protocol.d.ts +12 -7
- package/dist/route/media-protocol.js +11 -4
- package/dist/route/media.js +12 -3
- package/dist/route/protocol.d.ts +3 -0
- package/dist/schema/events.d.ts +5 -0
- package/dist/schema/messages.d.ts +24 -1
- package/dist/schema/messages.js +26 -2
- package/dist/schema/options.d.ts +10 -2
- package/dist/speech-client.d.ts +5 -5
- package/dist/speech.d.ts +7 -88
- package/dist/speech.js +1 -3
- package/dist/tool-updates.d.ts +34 -0
- package/dist/tool-updates.js +93 -0
- package/dist/tool.d.ts +6 -1
- package/dist/tool.js +1 -1
- package/dist/transcription-client.d.ts +5 -5
- package/dist/transcription.d.ts +7 -88
- package/dist/transcription.js +1 -3
- package/dist/video-client.d.ts +6 -6
- package/dist/video-client.js +13 -11
- package/dist/video.d.ts +17 -73
- package/dist/video.js +9 -8
- package/package.json +7 -3
|
@@ -14,7 +14,8 @@ export const STATUS_PATH = "/videos";
|
|
|
14
14
|
// ---------------------------------------------------------------------------
|
|
15
15
|
// 2. Token and response schemas
|
|
16
16
|
// ---------------------------------------------------------------------------
|
|
17
|
-
|
|
17
|
+
/** The provider's job ID; it is all a later status, result or cancel call needs. */
|
|
18
|
+
export const Token = Schema.String;
|
|
18
19
|
const StartResponse = Schema.Struct({ request_id: Schema.String });
|
|
19
20
|
const VideoStatus = Schema.Struct({
|
|
20
21
|
status: Schema.String,
|
|
@@ -78,7 +79,7 @@ const fromRequest = Effect.fn("XAIVideo.fromRequest")(function* (request) {
|
|
|
78
79
|
// 6. Response decoding
|
|
79
80
|
// ---------------------------------------------------------------------------
|
|
80
81
|
const decodeStart = route.decodeStarted(StartResponse, (value) => ({
|
|
81
|
-
token:
|
|
82
|
+
token: value.request_id,
|
|
82
83
|
snapshot: { id: value.request_id, status: "running" },
|
|
83
84
|
}));
|
|
84
85
|
// `progress` is undocumented but observed live as a 0..100 percentage (recorded cassette: 1 → 10 → 37 → 100).
|
|
@@ -86,22 +87,25 @@ const fraction = (progress) => progress !== undefined && progress !== null && pr
|
|
|
86
87
|
const decodeVideoStatus = route.decodeJson(VideoStatus);
|
|
87
88
|
const decodeStatus = Effect.fn("XAIVideo.decodeStatus")(function* (response, context) {
|
|
88
89
|
const output = yield* decodeVideoStatus(response);
|
|
89
|
-
|
|
90
|
-
|
|
90
|
+
return {
|
|
91
|
+
id: context.token,
|
|
92
|
+
...MediaProtocol.status(STATUS, output.value.status),
|
|
93
|
+
progress: fraction(output.value.progress),
|
|
94
|
+
};
|
|
91
95
|
});
|
|
92
96
|
const decodeResult = Effect.fn("XAIVideo.decodeResult")(function* (response, context) {
|
|
93
97
|
const output = yield* decodeVideoStatus(response);
|
|
94
98
|
const decoded = output.value;
|
|
95
|
-
const status = MediaProtocol.
|
|
99
|
+
const status = MediaProtocol.state(STATUS, decoded.status);
|
|
96
100
|
if (status === "running")
|
|
97
|
-
return yield* output.pending(context.token
|
|
101
|
+
return yield* output.pending(context.token);
|
|
98
102
|
if (status === "failed") {
|
|
99
103
|
const code = decoded.error?.code ?? undefined;
|
|
100
104
|
const message = decoded.error?.message ?? undefined;
|
|
101
105
|
return yield* output.ended("failed", `${route.name} generation failed${code === undefined ? "" : ` (${code})`}${message === undefined ? "" : `: ${message}`}`, MediaProtocol.failure(FAILURE, code));
|
|
102
106
|
}
|
|
103
107
|
if (status !== "completed")
|
|
104
|
-
return yield* output.ended("expired", `${route.name} request ${context.token
|
|
108
|
+
return yield* output.ended("expired", `${route.name} request ${context.token} expired`);
|
|
105
109
|
// `respect_moderation: false` marks a filtered result; a URL may still be present, so only a missing one fails.
|
|
106
110
|
const moderated = decoded.video?.respect_moderation === false;
|
|
107
111
|
const url = decoded.video?.url ?? undefined;
|
|
@@ -119,7 +123,7 @@ const decodeResult = Effect.fn("XAIVideo.decodeResult")(function* (response, con
|
|
|
119
123
|
],
|
|
120
124
|
providerMetadata: {
|
|
121
125
|
xai: {
|
|
122
|
-
requestId: context.token
|
|
126
|
+
requestId: context.token,
|
|
123
127
|
model: decoded.model ?? undefined,
|
|
124
128
|
respectModeration: decoded.video?.respect_moderation ?? undefined,
|
|
125
129
|
},
|
|
@@ -129,7 +133,7 @@ const decodeResult = Effect.fn("XAIVideo.decodeResult")(function* (response, con
|
|
|
129
133
|
// ---------------------------------------------------------------------------
|
|
130
134
|
// 7. Protocol and route
|
|
131
135
|
// ---------------------------------------------------------------------------
|
|
132
|
-
const statusPath = (token) => `${STATUS_PATH}/${token
|
|
136
|
+
const statusPath = (token) => `${STATUS_PATH}/${encodeURIComponent(token)}`;
|
|
133
137
|
export const protocol = MediaProtocol.queued(route, {
|
|
134
138
|
token: Token,
|
|
135
139
|
start: { body: { from: fromRequest }, decode: decodeStart },
|
|
@@ -237,14 +237,36 @@ export declare const protocol: Protocol<{
|
|
|
237
237
|
})[];
|
|
238
238
|
} | {
|
|
239
239
|
readonly role: "system";
|
|
240
|
-
readonly content: readonly {
|
|
240
|
+
readonly content: readonly ({
|
|
241
|
+
readonly type: "tool_addition";
|
|
242
|
+
readonly tool: {
|
|
243
|
+
readonly type: "tool_definition";
|
|
244
|
+
readonly definition: {
|
|
245
|
+
readonly name: string;
|
|
246
|
+
readonly description: string;
|
|
247
|
+
readonly input_schema: {
|
|
248
|
+
readonly [x: string]: unknown;
|
|
249
|
+
};
|
|
250
|
+
readonly cache_control?: {
|
|
251
|
+
readonly type: "ephemeral";
|
|
252
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
253
|
+
} | undefined;
|
|
254
|
+
};
|
|
255
|
+
};
|
|
256
|
+
} | {
|
|
257
|
+
readonly type: "tool_removal";
|
|
258
|
+
readonly tool: {
|
|
259
|
+
readonly type: "tool_reference";
|
|
260
|
+
readonly name: string;
|
|
261
|
+
};
|
|
262
|
+
} | {
|
|
241
263
|
readonly type: "text";
|
|
242
264
|
readonly text: string;
|
|
243
265
|
readonly cache_control?: {
|
|
244
266
|
readonly type: "ephemeral";
|
|
245
267
|
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
246
268
|
} | undefined;
|
|
247
|
-
}[];
|
|
269
|
+
})[];
|
|
248
270
|
readonly output_config?: {
|
|
249
271
|
readonly effort: string;
|
|
250
272
|
} | undefined;
|
|
@@ -448,14 +448,36 @@ export declare const routes: (Route<{
|
|
|
448
448
|
})[];
|
|
449
449
|
} | {
|
|
450
450
|
readonly role: "system";
|
|
451
|
-
readonly content: readonly {
|
|
451
|
+
readonly content: readonly ({
|
|
452
|
+
readonly type: "tool_addition";
|
|
453
|
+
readonly tool: {
|
|
454
|
+
readonly type: "tool_definition";
|
|
455
|
+
readonly definition: {
|
|
456
|
+
readonly name: string;
|
|
457
|
+
readonly description: string;
|
|
458
|
+
readonly input_schema: {
|
|
459
|
+
readonly [x: string]: unknown;
|
|
460
|
+
};
|
|
461
|
+
readonly cache_control?: {
|
|
462
|
+
readonly type: "ephemeral";
|
|
463
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
464
|
+
} | undefined;
|
|
465
|
+
};
|
|
466
|
+
};
|
|
467
|
+
} | {
|
|
468
|
+
readonly type: "tool_removal";
|
|
469
|
+
readonly tool: {
|
|
470
|
+
readonly type: "tool_reference";
|
|
471
|
+
readonly name: string;
|
|
472
|
+
};
|
|
473
|
+
} | {
|
|
452
474
|
readonly type: "text";
|
|
453
475
|
readonly text: string;
|
|
454
476
|
readonly cache_control?: {
|
|
455
477
|
readonly type: "ephemeral";
|
|
456
478
|
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
457
479
|
} | undefined;
|
|
458
|
-
}[];
|
|
480
|
+
})[];
|
|
459
481
|
readonly output_config?: {
|
|
460
482
|
readonly effort: string;
|
|
461
483
|
} | undefined;
|
|
@@ -521,6 +543,32 @@ export declare const routes: (Route<{
|
|
|
521
543
|
readonly reasoning: {
|
|
522
544
|
readonly effort: import("../schema/options.js").ReasoningEffort;
|
|
523
545
|
};
|
|
546
|
+
} | {
|
|
547
|
+
readonly type: "additional_tools";
|
|
548
|
+
readonly role: "developer";
|
|
549
|
+
readonly tools: readonly ({
|
|
550
|
+
readonly type: "custom";
|
|
551
|
+
readonly name: string;
|
|
552
|
+
readonly description: string;
|
|
553
|
+
readonly format: {
|
|
554
|
+
readonly type: "text";
|
|
555
|
+
} | {
|
|
556
|
+
readonly type: "grammar";
|
|
557
|
+
readonly syntax: "lark" | "regex";
|
|
558
|
+
readonly definition: string;
|
|
559
|
+
};
|
|
560
|
+
} | {
|
|
561
|
+
readonly type: "function";
|
|
562
|
+
readonly name: string;
|
|
563
|
+
readonly description: string;
|
|
564
|
+
readonly parameters: {
|
|
565
|
+
readonly [x: string]: unknown;
|
|
566
|
+
};
|
|
567
|
+
readonly strict?: boolean | undefined;
|
|
568
|
+
} | {
|
|
569
|
+
readonly [x: string]: unknown;
|
|
570
|
+
readonly type: string;
|
|
571
|
+
})[];
|
|
524
572
|
} | {
|
|
525
573
|
readonly type: "message";
|
|
526
574
|
readonly role: "system";
|
|
@@ -266,14 +266,36 @@ export declare const routes: (Route<{
|
|
|
266
266
|
})[];
|
|
267
267
|
} | {
|
|
268
268
|
readonly role: "system";
|
|
269
|
-
readonly content: readonly {
|
|
269
|
+
readonly content: readonly ({
|
|
270
|
+
readonly type: "tool_addition";
|
|
271
|
+
readonly tool: {
|
|
272
|
+
readonly type: "tool_definition";
|
|
273
|
+
readonly definition: {
|
|
274
|
+
readonly name: string;
|
|
275
|
+
readonly description: string;
|
|
276
|
+
readonly input_schema: {
|
|
277
|
+
readonly [x: string]: unknown;
|
|
278
|
+
};
|
|
279
|
+
readonly cache_control?: {
|
|
280
|
+
readonly type: "ephemeral";
|
|
281
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
282
|
+
} | undefined;
|
|
283
|
+
};
|
|
284
|
+
};
|
|
285
|
+
} | {
|
|
286
|
+
readonly type: "tool_removal";
|
|
287
|
+
readonly tool: {
|
|
288
|
+
readonly type: "tool_reference";
|
|
289
|
+
readonly name: string;
|
|
290
|
+
};
|
|
291
|
+
} | {
|
|
270
292
|
readonly type: "text";
|
|
271
293
|
readonly text: string;
|
|
272
294
|
readonly cache_control?: {
|
|
273
295
|
readonly type: "ephemeral";
|
|
274
296
|
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
275
297
|
} | undefined;
|
|
276
|
-
}[];
|
|
298
|
+
})[];
|
|
277
299
|
readonly output_config?: {
|
|
278
300
|
readonly effort: string;
|
|
279
301
|
} | undefined;
|
|
@@ -351,6 +373,32 @@ export declare const routes: (Route<{
|
|
|
351
373
|
readonly reasoning: {
|
|
352
374
|
readonly effort: import("../schema/options.js").ReasoningEffort;
|
|
353
375
|
};
|
|
376
|
+
} | {
|
|
377
|
+
readonly type: "additional_tools";
|
|
378
|
+
readonly role: "developer";
|
|
379
|
+
readonly tools: readonly ({
|
|
380
|
+
readonly type: "custom";
|
|
381
|
+
readonly name: string;
|
|
382
|
+
readonly description: string;
|
|
383
|
+
readonly format: {
|
|
384
|
+
readonly type: "text";
|
|
385
|
+
} | {
|
|
386
|
+
readonly type: "grammar";
|
|
387
|
+
readonly syntax: "lark" | "regex";
|
|
388
|
+
readonly definition: string;
|
|
389
|
+
};
|
|
390
|
+
} | {
|
|
391
|
+
readonly type: "function";
|
|
392
|
+
readonly name: string;
|
|
393
|
+
readonly description: string;
|
|
394
|
+
readonly parameters: {
|
|
395
|
+
readonly [x: string]: unknown;
|
|
396
|
+
};
|
|
397
|
+
readonly strict?: boolean | undefined;
|
|
398
|
+
} | {
|
|
399
|
+
readonly [x: string]: unknown;
|
|
400
|
+
readonly type: string;
|
|
401
|
+
})[];
|
|
354
402
|
} | {
|
|
355
403
|
readonly type: "message";
|
|
356
404
|
readonly role: "system";
|
|
@@ -250,14 +250,36 @@ export declare const routes: import("../route.js").Route<{
|
|
|
250
250
|
})[];
|
|
251
251
|
} | {
|
|
252
252
|
readonly role: "system";
|
|
253
|
-
readonly content: readonly {
|
|
253
|
+
readonly content: readonly ({
|
|
254
|
+
readonly type: "tool_addition";
|
|
255
|
+
readonly tool: {
|
|
256
|
+
readonly type: "tool_definition";
|
|
257
|
+
readonly definition: {
|
|
258
|
+
readonly name: string;
|
|
259
|
+
readonly description: string;
|
|
260
|
+
readonly input_schema: {
|
|
261
|
+
readonly [x: string]: unknown;
|
|
262
|
+
};
|
|
263
|
+
readonly cache_control?: {
|
|
264
|
+
readonly type: "ephemeral";
|
|
265
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
266
|
+
} | undefined;
|
|
267
|
+
};
|
|
268
|
+
};
|
|
269
|
+
} | {
|
|
270
|
+
readonly type: "tool_removal";
|
|
271
|
+
readonly tool: {
|
|
272
|
+
readonly type: "tool_reference";
|
|
273
|
+
readonly name: string;
|
|
274
|
+
};
|
|
275
|
+
} | {
|
|
254
276
|
readonly type: "text";
|
|
255
277
|
readonly text: string;
|
|
256
278
|
readonly cache_control?: {
|
|
257
279
|
readonly type: "ephemeral";
|
|
258
280
|
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
259
281
|
} | undefined;
|
|
260
|
-
}[];
|
|
282
|
+
})[];
|
|
261
283
|
readonly output_config?: {
|
|
262
284
|
readonly effort: string;
|
|
263
285
|
} | undefined;
|
|
@@ -235,14 +235,36 @@ export declare const routes: import("../route.js").Route<{
|
|
|
235
235
|
})[];
|
|
236
236
|
} | {
|
|
237
237
|
readonly role: "system";
|
|
238
|
-
readonly content: readonly {
|
|
238
|
+
readonly content: readonly ({
|
|
239
|
+
readonly type: "tool_addition";
|
|
240
|
+
readonly tool: {
|
|
241
|
+
readonly type: "tool_definition";
|
|
242
|
+
readonly definition: {
|
|
243
|
+
readonly name: string;
|
|
244
|
+
readonly description: string;
|
|
245
|
+
readonly input_schema: {
|
|
246
|
+
readonly [x: string]: unknown;
|
|
247
|
+
};
|
|
248
|
+
readonly cache_control?: {
|
|
249
|
+
readonly type: "ephemeral";
|
|
250
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
251
|
+
} | undefined;
|
|
252
|
+
};
|
|
253
|
+
};
|
|
254
|
+
} | {
|
|
255
|
+
readonly type: "tool_removal";
|
|
256
|
+
readonly tool: {
|
|
257
|
+
readonly type: "tool_reference";
|
|
258
|
+
readonly name: string;
|
|
259
|
+
};
|
|
260
|
+
} | {
|
|
239
261
|
readonly type: "text";
|
|
240
262
|
readonly text: string;
|
|
241
263
|
readonly cache_control?: {
|
|
242
264
|
readonly type: "ephemeral";
|
|
243
265
|
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
244
266
|
} | undefined;
|
|
245
|
-
}[];
|
|
267
|
+
})[];
|
|
246
268
|
readonly output_config?: {
|
|
247
269
|
readonly effort: string;
|
|
248
270
|
} | undefined;
|
|
@@ -29,6 +29,32 @@ declare const responsesRoute: Route<{
|
|
|
29
29
|
readonly reasoning: {
|
|
30
30
|
readonly effort: import("../schema/options.js").ReasoningEffort;
|
|
31
31
|
};
|
|
32
|
+
} | {
|
|
33
|
+
readonly type: "additional_tools";
|
|
34
|
+
readonly role: "developer";
|
|
35
|
+
readonly tools: readonly ({
|
|
36
|
+
readonly type: "custom";
|
|
37
|
+
readonly name: string;
|
|
38
|
+
readonly description: string;
|
|
39
|
+
readonly format: {
|
|
40
|
+
readonly type: "text";
|
|
41
|
+
} | {
|
|
42
|
+
readonly type: "grammar";
|
|
43
|
+
readonly syntax: "lark" | "regex";
|
|
44
|
+
readonly definition: string;
|
|
45
|
+
};
|
|
46
|
+
} | {
|
|
47
|
+
readonly type: "function";
|
|
48
|
+
readonly name: string;
|
|
49
|
+
readonly description: string;
|
|
50
|
+
readonly parameters: {
|
|
51
|
+
readonly [x: string]: unknown;
|
|
52
|
+
};
|
|
53
|
+
readonly strict?: boolean | undefined;
|
|
54
|
+
} | {
|
|
55
|
+
readonly [x: string]: unknown;
|
|
56
|
+
readonly type: string;
|
|
57
|
+
})[];
|
|
32
58
|
} | {
|
|
33
59
|
readonly type: "message";
|
|
34
60
|
readonly role: "system";
|
|
@@ -483,14 +509,36 @@ export declare const routes: (Route<{
|
|
|
483
509
|
})[];
|
|
484
510
|
} | {
|
|
485
511
|
readonly role: "system";
|
|
486
|
-
readonly content: readonly {
|
|
512
|
+
readonly content: readonly ({
|
|
513
|
+
readonly type: "tool_addition";
|
|
514
|
+
readonly tool: {
|
|
515
|
+
readonly type: "tool_definition";
|
|
516
|
+
readonly definition: {
|
|
517
|
+
readonly name: string;
|
|
518
|
+
readonly description: string;
|
|
519
|
+
readonly input_schema: {
|
|
520
|
+
readonly [x: string]: unknown;
|
|
521
|
+
};
|
|
522
|
+
readonly cache_control?: {
|
|
523
|
+
readonly type: "ephemeral";
|
|
524
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
525
|
+
} | undefined;
|
|
526
|
+
};
|
|
527
|
+
};
|
|
528
|
+
} | {
|
|
529
|
+
readonly type: "tool_removal";
|
|
530
|
+
readonly tool: {
|
|
531
|
+
readonly type: "tool_reference";
|
|
532
|
+
readonly name: string;
|
|
533
|
+
};
|
|
534
|
+
} | {
|
|
487
535
|
readonly type: "text";
|
|
488
536
|
readonly text: string;
|
|
489
537
|
readonly cache_control?: {
|
|
490
538
|
readonly type: "ephemeral";
|
|
491
539
|
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
492
540
|
} | undefined;
|
|
493
|
-
}[];
|
|
541
|
+
})[];
|
|
494
542
|
readonly output_config?: {
|
|
495
543
|
readonly effort: string;
|
|
496
544
|
} | undefined;
|
|
@@ -742,6 +790,32 @@ export declare const routes: (Route<{
|
|
|
742
790
|
readonly reasoning: {
|
|
743
791
|
readonly effort: import("../schema/options.js").ReasoningEffort;
|
|
744
792
|
};
|
|
793
|
+
} | {
|
|
794
|
+
readonly type: "additional_tools";
|
|
795
|
+
readonly role: "developer";
|
|
796
|
+
readonly tools: readonly ({
|
|
797
|
+
readonly type: "custom";
|
|
798
|
+
readonly name: string;
|
|
799
|
+
readonly description: string;
|
|
800
|
+
readonly format: {
|
|
801
|
+
readonly type: "text";
|
|
802
|
+
} | {
|
|
803
|
+
readonly type: "grammar";
|
|
804
|
+
readonly syntax: "lark" | "regex";
|
|
805
|
+
readonly definition: string;
|
|
806
|
+
};
|
|
807
|
+
} | {
|
|
808
|
+
readonly type: "function";
|
|
809
|
+
readonly name: string;
|
|
810
|
+
readonly description: string;
|
|
811
|
+
readonly parameters: {
|
|
812
|
+
readonly [x: string]: unknown;
|
|
813
|
+
};
|
|
814
|
+
readonly strict?: boolean | undefined;
|
|
815
|
+
} | {
|
|
816
|
+
readonly [x: string]: unknown;
|
|
817
|
+
readonly type: string;
|
|
818
|
+
})[];
|
|
745
819
|
} | {
|
|
746
820
|
readonly type: "message";
|
|
747
821
|
readonly role: "system";
|
|
@@ -35,6 +35,32 @@ export declare const responsesRoute: import("../route.js").Route<{
|
|
|
35
35
|
readonly reasoning: {
|
|
36
36
|
readonly effort: import("../schema/options.js").ReasoningEffort;
|
|
37
37
|
};
|
|
38
|
+
} | {
|
|
39
|
+
readonly type: "additional_tools";
|
|
40
|
+
readonly role: "developer";
|
|
41
|
+
readonly tools: readonly ({
|
|
42
|
+
readonly type: "custom";
|
|
43
|
+
readonly name: string;
|
|
44
|
+
readonly description: string;
|
|
45
|
+
readonly format: {
|
|
46
|
+
readonly type: "text";
|
|
47
|
+
} | {
|
|
48
|
+
readonly type: "grammar";
|
|
49
|
+
readonly syntax: "lark" | "regex";
|
|
50
|
+
readonly definition: string;
|
|
51
|
+
};
|
|
52
|
+
} | {
|
|
53
|
+
readonly type: "function";
|
|
54
|
+
readonly name: string;
|
|
55
|
+
readonly description: string;
|
|
56
|
+
readonly parameters: {
|
|
57
|
+
readonly [x: string]: unknown;
|
|
58
|
+
};
|
|
59
|
+
readonly strict?: boolean | undefined;
|
|
60
|
+
} | {
|
|
61
|
+
readonly [x: string]: unknown;
|
|
62
|
+
readonly type: string;
|
|
63
|
+
})[];
|
|
38
64
|
} | {
|
|
39
65
|
readonly type: "message";
|
|
40
66
|
readonly role: "system";
|
|
@@ -490,14 +516,36 @@ export declare const messagesRoute: import("../route.js").Route<{
|
|
|
490
516
|
})[];
|
|
491
517
|
} | {
|
|
492
518
|
readonly role: "system";
|
|
493
|
-
readonly content: readonly {
|
|
519
|
+
readonly content: readonly ({
|
|
520
|
+
readonly type: "tool_addition";
|
|
521
|
+
readonly tool: {
|
|
522
|
+
readonly type: "tool_definition";
|
|
523
|
+
readonly definition: {
|
|
524
|
+
readonly name: string;
|
|
525
|
+
readonly description: string;
|
|
526
|
+
readonly input_schema: {
|
|
527
|
+
readonly [x: string]: unknown;
|
|
528
|
+
};
|
|
529
|
+
readonly cache_control?: {
|
|
530
|
+
readonly type: "ephemeral";
|
|
531
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
532
|
+
} | undefined;
|
|
533
|
+
};
|
|
534
|
+
};
|
|
535
|
+
} | {
|
|
536
|
+
readonly type: "tool_removal";
|
|
537
|
+
readonly tool: {
|
|
538
|
+
readonly type: "tool_reference";
|
|
539
|
+
readonly name: string;
|
|
540
|
+
};
|
|
541
|
+
} | {
|
|
494
542
|
readonly type: "text";
|
|
495
543
|
readonly text: string;
|
|
496
544
|
readonly cache_control?: {
|
|
497
545
|
readonly type: "ephemeral";
|
|
498
546
|
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
499
547
|
} | undefined;
|
|
500
|
-
}[];
|
|
548
|
+
})[];
|
|
501
549
|
readonly output_config?: {
|
|
502
550
|
readonly effort: string;
|
|
503
551
|
} | undefined;
|
|
@@ -973,14 +1021,36 @@ export declare const routes: (import("../route.js").Route<{
|
|
|
973
1021
|
})[];
|
|
974
1022
|
} | {
|
|
975
1023
|
readonly role: "system";
|
|
976
|
-
readonly content: readonly {
|
|
1024
|
+
readonly content: readonly ({
|
|
1025
|
+
readonly type: "tool_addition";
|
|
1026
|
+
readonly tool: {
|
|
1027
|
+
readonly type: "tool_definition";
|
|
1028
|
+
readonly definition: {
|
|
1029
|
+
readonly name: string;
|
|
1030
|
+
readonly description: string;
|
|
1031
|
+
readonly input_schema: {
|
|
1032
|
+
readonly [x: string]: unknown;
|
|
1033
|
+
};
|
|
1034
|
+
readonly cache_control?: {
|
|
1035
|
+
readonly type: "ephemeral";
|
|
1036
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
1037
|
+
} | undefined;
|
|
1038
|
+
};
|
|
1039
|
+
};
|
|
1040
|
+
} | {
|
|
1041
|
+
readonly type: "tool_removal";
|
|
1042
|
+
readonly tool: {
|
|
1043
|
+
readonly type: "tool_reference";
|
|
1044
|
+
readonly name: string;
|
|
1045
|
+
};
|
|
1046
|
+
} | {
|
|
977
1047
|
readonly type: "text";
|
|
978
1048
|
readonly text: string;
|
|
979
1049
|
readonly cache_control?: {
|
|
980
1050
|
readonly type: "ephemeral";
|
|
981
1051
|
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
982
1052
|
} | undefined;
|
|
983
|
-
}[];
|
|
1053
|
+
})[];
|
|
984
1054
|
readonly output_config?: {
|
|
985
1055
|
readonly effort: string;
|
|
986
1056
|
} | undefined;
|
|
@@ -1232,6 +1302,32 @@ export declare const routes: (import("../route.js").Route<{
|
|
|
1232
1302
|
readonly reasoning: {
|
|
1233
1303
|
readonly effort: import("../schema/options.js").ReasoningEffort;
|
|
1234
1304
|
};
|
|
1305
|
+
} | {
|
|
1306
|
+
readonly type: "additional_tools";
|
|
1307
|
+
readonly role: "developer";
|
|
1308
|
+
readonly tools: readonly ({
|
|
1309
|
+
readonly type: "custom";
|
|
1310
|
+
readonly name: string;
|
|
1311
|
+
readonly description: string;
|
|
1312
|
+
readonly format: {
|
|
1313
|
+
readonly type: "text";
|
|
1314
|
+
} | {
|
|
1315
|
+
readonly type: "grammar";
|
|
1316
|
+
readonly syntax: "lark" | "regex";
|
|
1317
|
+
readonly definition: string;
|
|
1318
|
+
};
|
|
1319
|
+
} | {
|
|
1320
|
+
readonly type: "function";
|
|
1321
|
+
readonly name: string;
|
|
1322
|
+
readonly description: string;
|
|
1323
|
+
readonly parameters: {
|
|
1324
|
+
readonly [x: string]: unknown;
|
|
1325
|
+
};
|
|
1326
|
+
readonly strict?: boolean | undefined;
|
|
1327
|
+
} | {
|
|
1328
|
+
readonly [x: string]: unknown;
|
|
1329
|
+
readonly type: string;
|
|
1330
|
+
})[];
|
|
1235
1331
|
} | {
|
|
1236
1332
|
readonly type: "message";
|
|
1237
1333
|
readonly role: "system";
|
|
@@ -450,6 +450,32 @@ export declare const routes: (Route<{
|
|
|
450
450
|
readonly reasoning: {
|
|
451
451
|
readonly effort: import("../schema/options.js").ReasoningEffort;
|
|
452
452
|
};
|
|
453
|
+
} | {
|
|
454
|
+
readonly type: "additional_tools";
|
|
455
|
+
readonly role: "developer";
|
|
456
|
+
readonly tools: readonly ({
|
|
457
|
+
readonly type: "custom";
|
|
458
|
+
readonly name: string;
|
|
459
|
+
readonly description: string;
|
|
460
|
+
readonly format: {
|
|
461
|
+
readonly type: "text";
|
|
462
|
+
} | {
|
|
463
|
+
readonly type: "grammar";
|
|
464
|
+
readonly syntax: "lark" | "regex";
|
|
465
|
+
readonly definition: string;
|
|
466
|
+
};
|
|
467
|
+
} | {
|
|
468
|
+
readonly type: "function";
|
|
469
|
+
readonly name: string;
|
|
470
|
+
readonly description: string;
|
|
471
|
+
readonly parameters: {
|
|
472
|
+
readonly [x: string]: unknown;
|
|
473
|
+
};
|
|
474
|
+
readonly strict?: boolean | undefined;
|
|
475
|
+
} | {
|
|
476
|
+
readonly [x: string]: unknown;
|
|
477
|
+
readonly type: string;
|
|
478
|
+
})[];
|
|
453
479
|
} | {
|
|
454
480
|
readonly type: "message";
|
|
455
481
|
readonly role: "system";
|
|
@@ -248,14 +248,36 @@ export declare const routes: Route<{
|
|
|
248
248
|
})[];
|
|
249
249
|
} | {
|
|
250
250
|
readonly role: "system";
|
|
251
|
-
readonly content: readonly {
|
|
251
|
+
readonly content: readonly ({
|
|
252
|
+
readonly type: "tool_addition";
|
|
253
|
+
readonly tool: {
|
|
254
|
+
readonly type: "tool_definition";
|
|
255
|
+
readonly definition: {
|
|
256
|
+
readonly name: string;
|
|
257
|
+
readonly description: string;
|
|
258
|
+
readonly input_schema: {
|
|
259
|
+
readonly [x: string]: unknown;
|
|
260
|
+
};
|
|
261
|
+
readonly cache_control?: {
|
|
262
|
+
readonly type: "ephemeral";
|
|
263
|
+
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
264
|
+
} | undefined;
|
|
265
|
+
};
|
|
266
|
+
};
|
|
267
|
+
} | {
|
|
268
|
+
readonly type: "tool_removal";
|
|
269
|
+
readonly tool: {
|
|
270
|
+
readonly type: "tool_reference";
|
|
271
|
+
readonly name: string;
|
|
272
|
+
};
|
|
273
|
+
} | {
|
|
252
274
|
readonly type: "text";
|
|
253
275
|
readonly text: string;
|
|
254
276
|
readonly cache_control?: {
|
|
255
277
|
readonly type: "ephemeral";
|
|
256
278
|
readonly ttl?: `${number}d` | `${number}h` | `${number}m` | `${number}ms` | `${number}s` | undefined;
|
|
257
279
|
} | undefined;
|
|
258
|
-
}[];
|
|
280
|
+
})[];
|
|
259
281
|
readonly output_config?: {
|
|
260
282
|
readonly effort: string;
|
|
261
283
|
} | undefined;
|
|
@@ -27,6 +27,7 @@ const route = Route.make({
|
|
|
27
27
|
},
|
|
28
28
|
stream: AnthropicMessages.protocol.stream,
|
|
29
29
|
supportsEffortUpdates: AnthropicMessages.protocol.supportsEffortUpdates,
|
|
30
|
+
toolUpdates: AnthropicMessages.protocol.toolUpdates,
|
|
30
31
|
}),
|
|
31
32
|
endpoint: Endpoint.path(({ request }) => `/${request.model.id}:streamRawPredict`),
|
|
32
33
|
auth: Auth.none,
|