@opencode/ai 0.0.0-dev-21713 → 0.0.0-dev-21730

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 (31) hide show
  1. package/README.md +29 -2
  2. package/dist/experimental/cloudflare-run-evaluation.d.ts +15 -0
  3. package/dist/experimental/cloudflare-run-evaluation.js +43 -0
  4. package/dist/experimental/system-one.d.ts +100 -2
  5. package/dist/experimental/system-one.js +62 -57
  6. package/dist/protocols/alibaba-images.d.ts +19 -0
  7. package/dist/protocols/alibaba-images.js +76 -0
  8. package/dist/protocols/cloudflare-workers-ai-images.d.ts +17 -0
  9. package/dist/protocols/cloudflare-workers-ai-images.js +72 -0
  10. package/dist/protocols/openai-images.d.ts +15 -5
  11. package/dist/protocols/openai-images.js +23 -23
  12. package/dist/provider-error.js +3 -1
  13. package/dist/providers/alibaba.d.ts +2 -0
  14. package/dist/providers/alibaba.js +5 -1
  15. package/dist/providers/baseten.d.ts +13 -0
  16. package/dist/providers/baseten.js +15 -2
  17. package/dist/providers/cloudflare-ai-gateway.d.ts +5 -0
  18. package/dist/providers/cloudflare-ai-gateway.js +24 -1
  19. package/dist/providers/cloudflare-workers-ai.d.ts +7 -0
  20. package/dist/providers/cloudflare-workers-ai.js +31 -5
  21. package/dist/providers/digitalocean.d.ts +9 -0
  22. package/dist/providers/digitalocean.js +16 -2
  23. package/dist/providers/opencode.js +1 -0
  24. package/dist/providers/openrouter.js +1 -0
  25. package/dist/providers/typesafe-ai.js +1 -0
  26. package/dist/providers/vercel-ai-gateway.d.ts +3 -0
  27. package/dist/providers/vercel-ai-gateway.js +6 -1
  28. package/dist/route/media-protocol.d.ts +1 -0
  29. package/dist/route/media-protocol.js +12 -8
  30. package/dist/utils/media-type.js +18 -1
  31. package/package.json +3 -3
@@ -20,8 +20,25 @@ export const detectMediaType = (bytes) => {
20
20
  }
21
21
  if (startsWith(bytes, [0x25, 0x50, 0x44, 0x46]))
22
22
  return "application/pdf";
23
- if (bytes.length >= 12 && ascii(bytes, 4, 8) === "ftyp")
23
+ if (bytes.length >= 12 && ascii(bytes, 4, 8) === "ftyp") {
24
+ // AVIF, HEIC, QuickTime and M4A share MP4's container; the major brand tells them apart, and generic HEIF brands
25
+ // list `avif`/`avis` among the compatible brands that follow the minor version.
26
+ const brand = ascii(bytes, 8, 12);
27
+ const boxEnd = Math.min(new DataView(bytes.buffer, bytes.byteOffset).getUint32(0), bytes.length);
28
+ const compatible = Array.from({ length: Math.floor((boxEnd - 16) / 4) }, (_, index) => ascii(bytes, 16 + index * 4, 20 + index * 4));
29
+ const generic = brand === "mif1" || brand === "msf1";
30
+ if (brand === "avif" ||
31
+ brand === "avis" ||
32
+ (generic && (compatible.includes("avif") || compatible.includes("avis"))))
33
+ return "image/avif";
34
+ if (generic || ["heic", "heix", "hevc", "hevx"].includes(brand))
35
+ return "image/heic";
36
+ if (brand === "qt ")
37
+ return "video/quicktime";
38
+ if (brand === "M4A ")
39
+ return "audio/mp4";
24
40
  return "video/mp4";
41
+ }
25
42
  if (startsWith(bytes, [0x1a, 0x45, 0xdf, 0xa3]))
26
43
  return "video/webm";
27
44
  if (startsWith(bytes, [0x49, 0x44, 0x33]))
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-21713",
3
+ "version": "0.0.0-dev-21730",
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-21713",
38
+ "@opencode/http-recorder": "0.0.0-dev-21730",
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-21713",
48
+ "@opencode/schema": "0.0.0-dev-21730",
49
49
  "aws4fetch": "1.0.20",
50
50
  "effect": "4.0.1",
51
51
  "google-auth-library": "10.5.0"