@opencode/ai 0.0.0-dev-21799 → 0.0.0-dev-21801

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist/protocols/alibaba-messages.d.ts +34 -0
  2. package/dist/protocols/alibaba-responses.d.ts +3 -0
  3. package/dist/protocols/anthropic-messages.d.ts +102 -0
  4. package/dist/protocols/anthropic-messages.js +32 -8
  5. package/dist/protocols/meta-messages.d.ts +34 -0
  6. package/dist/protocols/meta-messages.js +12 -0
  7. package/dist/protocols/meta-responses.d.ts +6 -0
  8. package/dist/protocols/meta-responses.js +29 -1
  9. package/dist/protocols/open-responses.d.ts +27 -0
  10. package/dist/protocols/open-responses.js +7 -18
  11. package/dist/protocols/openai-compatible-responses.d.ts +3 -0
  12. package/dist/protocols/openai-responses.d.ts +18 -0
  13. package/dist/protocols/shared.d.ts +1 -1
  14. package/dist/protocols/shared.js +2 -2
  15. package/dist/protocols/xai-responses.d.ts +3 -0
  16. package/dist/protocols/xai-responses.js +9 -0
  17. package/dist/protocols/zai-messages.d.ts +34 -0
  18. package/dist/providers/alibaba.d.ts +37 -0
  19. package/dist/providers/amazon-bedrock-mantle.d.ts +37 -0
  20. package/dist/providers/anthropic-compatible.d.ts +34 -0
  21. package/dist/providers/anthropic.d.ts +34 -0
  22. package/dist/providers/azure.d.ts +6 -0
  23. package/dist/providers/cloudflare-ai-gateway.d.ts +74 -0
  24. package/dist/providers/google-vertex-messages.d.ts +34 -0
  25. package/dist/providers/google-vertex-responses.d.ts +3 -0
  26. package/dist/providers/meta.d.ts +37 -0
  27. package/dist/providers/minimax.d.ts +37 -0
  28. package/dist/providers/moonshot.d.ts +37 -0
  29. package/dist/providers/openai-compatible-responses.d.ts +3 -0
  30. package/dist/providers/openai.d.ts +3 -0
  31. package/dist/providers/zai-coding-plan.d.ts +37 -0
  32. package/dist/route/client.js +11 -0
  33. package/package.json +3 -3
@@ -81,6 +81,23 @@ export declare const routes: (Route<{
81
81
  readonly transformations?: {
82
82
  readonly oversized_image?: "downsize" | "error" | undefined;
83
83
  } | undefined;
84
+ } | {
85
+ readonly type: "video";
86
+ readonly source: {
87
+ readonly type: "base64";
88
+ readonly media_type: string;
89
+ readonly data: string;
90
+ } | {
91
+ readonly type: "url";
92
+ readonly url: string;
93
+ } | {
94
+ readonly type: "file";
95
+ readonly file_id: string;
96
+ };
97
+ readonly cache_control?: {
98
+ readonly type: "ephemeral";
99
+ readonly ttl?: "1h" | "5m" | undefined;
100
+ } | undefined;
84
101
  } | {
85
102
  readonly type: "document";
86
103
  readonly source: {
@@ -137,6 +154,23 @@ export declare const routes: (Route<{
137
154
  readonly transformations?: {
138
155
  readonly oversized_image?: "downsize" | "error" | undefined;
139
156
  } | undefined;
157
+ } | {
158
+ readonly type: "video";
159
+ readonly source: {
160
+ readonly type: "base64";
161
+ readonly media_type: string;
162
+ readonly data: string;
163
+ } | {
164
+ readonly type: "url";
165
+ readonly url: string;
166
+ } | {
167
+ readonly type: "file";
168
+ readonly file_id: string;
169
+ };
170
+ readonly cache_control?: {
171
+ readonly type: "ephemeral";
172
+ readonly ttl?: "1h" | "5m" | undefined;
173
+ } | undefined;
140
174
  } | {
141
175
  readonly type: "document";
142
176
  readonly source: {
@@ -356,6 +390,9 @@ export declare const routes: (Route<{
356
390
  readonly content: readonly ({
357
391
  readonly type: "input_text";
358
392
  readonly text: string;
393
+ } | {
394
+ readonly type: "input_video";
395
+ readonly video_url: string;
359
396
  } | {
360
397
  readonly type: "input_image";
361
398
  readonly image_url: string;
@@ -68,6 +68,9 @@ export declare const routes: import("../route/client.js").Route<{
68
68
  readonly content: readonly ({
69
69
  readonly type: "input_text";
70
70
  readonly text: string;
71
+ } | {
72
+ readonly type: "input_video";
73
+ readonly video_url: string;
71
74
  } | {
72
75
  readonly type: "input_image";
73
76
  readonly image_url: string;
@@ -195,6 +195,9 @@ export declare const routes: (Route<{
195
195
  readonly content: readonly ({
196
196
  readonly type: "input_text";
197
197
  readonly text: string;
198
+ } | {
199
+ readonly type: "input_video";
200
+ readonly video_url: string;
198
201
  } | {
199
202
  readonly type: "input_image";
200
203
  readonly image_url: string;
@@ -72,6 +72,9 @@ export declare const routes: (Route<{
72
72
  readonly content: readonly ({
73
73
  readonly type: "input_text";
74
74
  readonly text: string;
75
+ } | {
76
+ readonly type: "input_video";
77
+ readonly video_url: string;
75
78
  } | {
76
79
  readonly type: "input_image";
77
80
  readonly image_url: string;
@@ -387,6 +390,23 @@ export declare const routes: (Route<{
387
390
  readonly transformations?: {
388
391
  readonly oversized_image?: "downsize" | "error" | undefined;
389
392
  } | undefined;
393
+ } | {
394
+ readonly type: "video";
395
+ readonly source: {
396
+ readonly type: "base64";
397
+ readonly media_type: string;
398
+ readonly data: string;
399
+ } | {
400
+ readonly type: "url";
401
+ readonly url: string;
402
+ } | {
403
+ readonly type: "file";
404
+ readonly file_id: string;
405
+ };
406
+ readonly cache_control?: {
407
+ readonly type: "ephemeral";
408
+ readonly ttl?: "1h" | "5m" | undefined;
409
+ } | undefined;
390
410
  } | {
391
411
  readonly type: "document";
392
412
  readonly source: {
@@ -443,6 +463,23 @@ export declare const routes: (Route<{
443
463
  readonly transformations?: {
444
464
  readonly oversized_image?: "downsize" | "error" | undefined;
445
465
  } | undefined;
466
+ } | {
467
+ readonly type: "video";
468
+ readonly source: {
469
+ readonly type: "base64";
470
+ readonly media_type: string;
471
+ readonly data: string;
472
+ } | {
473
+ readonly type: "url";
474
+ readonly url: string;
475
+ } | {
476
+ readonly type: "file";
477
+ readonly file_id: string;
478
+ };
479
+ readonly cache_control?: {
480
+ readonly type: "ephemeral";
481
+ readonly ttl?: "1h" | "5m" | undefined;
482
+ } | undefined;
446
483
  } | {
447
484
  readonly type: "document";
448
485
  readonly source: {
@@ -216,6 +216,17 @@ const prepareRequest = (request) => {
216
216
  : LLMRequest.update(resolved, { http: mergeHttpOptions(new HttpOptions({ headers }), resolved.http) });
217
217
  };
218
218
  const compile = Effect.fn("LLM.compile")(function* (request, options) {
219
+ const references = request.messages.flatMap((message) => message.content.flatMap((part) => {
220
+ if (part.type === "media") {
221
+ const source = part.media.source;
222
+ return source.type === "url" ? [source.url] : source.type === "ref" ? [source.id] : [];
223
+ }
224
+ if (part.type !== "tool-result" || part.result.type !== "content")
225
+ return [];
226
+ return part.result.value.flatMap((item) => (item.type === "file" ? [item.uri] : []));
227
+ }));
228
+ if (references.some((reference) => /^\s*file:/i.test(reference)))
229
+ return yield* ProviderShared.invalidRequest("Local file references must be read with Media.file(path) before sending");
219
230
  const resolved = prepareRequest(request);
220
231
  const route = resolved.model.route;
221
232
  const body = yield* route.body.from(resolved);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
- "version": "0.0.0-dev-21799",
3
+ "version": "0.0.0-dev-21801",
4
4
  "name": "@opencode/ai",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -35,7 +35,7 @@
35
35
  "devDependencies": {
36
36
  "@clack/prompts": "1.0.0-alpha.1",
37
37
  "@effect/platform-node": "4.0.1",
38
- "@opencode/http-recorder": "0.0.0-dev-21799",
38
+ "@opencode/http-recorder": "0.0.0-dev-21801",
39
39
  "@tsconfig/bun": "1.0.9",
40
40
  "@types/bun": "1.4.3",
41
41
  "@typescript/native": "npm:typescript@7.1.0-beta",
@@ -45,7 +45,7 @@
45
45
  "@aws-sdk/credential-providers": "3.1057.0",
46
46
  "@smithy/eventstream-codec": "4.2.14",
47
47
  "@smithy/util-utf8": "4.2.2",
48
- "@opencode/schema": "0.0.0-dev-21799",
48
+ "@opencode/schema": "0.0.0-dev-21801",
49
49
  "aws4fetch": "1.0.20",
50
50
  "effect": "4.0.1",
51
51
  "google-auth-library": "10.5.0"