@opencode-ai/ai
Advanced tools
@@ -1,2 +0,2 @@ | ||
| import { Effect, Schema } from "effect"; | ||
| import { Effect, Encoding, Schema } from "effect"; | ||
| import { ProviderShared } from "../shared.js"; | ||
@@ -47,2 +47,7 @@ // Bedrock Converse accepts image `format` as the file extension and | ||
| }); | ||
| const mediaBase64 = Effect.fn("BedrockMedia.mediaBase64")(function* (part) { | ||
| const media = ProviderShared.normalizeMedia(part); | ||
| const bytes = yield* Effect.fromResult(Encoding.decodeBase64(media.base64)).pipe(Effect.mapError((cause) => ProviderShared.invalidRequest("Bedrock Converse media data must be valid base64", cause))); | ||
| return Encoding.encodeBase64(bytes); | ||
| }); | ||
| // Route by MIME. Known image/document formats lower into a typed block; anything | ||
@@ -57,4 +62,3 @@ // else fails with a clear error instead of silently degrading to a malformed | ||
| if (imageFormat) { | ||
| const media = ProviderShared.normalizeMedia(part); | ||
| return { image: { format: imageFormat, source: { bytes: media.base64 } } }; | ||
| return { image: { format: imageFormat, source: { bytes: yield* mediaBase64(part) } } }; | ||
| } | ||
@@ -67,4 +71,3 @@ if (mime.startsWith("image/")) | ||
| return yield* ProviderShared.invalidRequest("Bedrock Converse document media requires a filename"); | ||
| const media = ProviderShared.normalizeMedia(part); | ||
| return documentBlock(part.filename, documentFormat, media.base64); | ||
| return documentBlock(part.filename, documentFormat, yield* mediaBase64(part)); | ||
| } | ||
@@ -71,0 +74,0 @@ return yield* ProviderShared.invalidRequest(`Bedrock Converse does not support media type ${part.mediaType}`); |
+3
-3
| { | ||
| "$schema": "https://json.schemastore.org/package.json", | ||
| "version": "0.0.0-dev-18710", | ||
| "version": "0.0.0-dev-18711", | ||
| "name": "@opencode-ai/ai", | ||
@@ -33,3 +33,3 @@ "type": "module", | ||
| "@effect/platform-node": "4.0.0-rc.112", | ||
| "@opencode-ai/http-recorder": "0.0.0-dev-18710", | ||
| "@opencode-ai/http-recorder": "0.0.0-dev-18711", | ||
| "@tsconfig/bun": "1.0.9", | ||
@@ -43,3 +43,3 @@ "@types/bun": "1.3.13", | ||
| "@smithy/util-utf8": "4.2.2", | ||
| "@opencode-ai/schema": "0.0.0-dev-18710", | ||
| "@opencode-ai/schema": "0.0.0-dev-18711", | ||
| "aws4fetch": "1.0.20", | ||
@@ -46,0 +46,0 @@ "effect": "4.0.0-rc.112", |
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
1550525
0.02%35746
0.01%+ Added
- Removed