@opencode/ai 0.0.0-dev-20163 → 0.0.0-dev-20165
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.
|
@@ -20,8 +20,10 @@ const decodeChunk = route.decodeFrame(GenerateContentChunk);
|
|
|
20
20
|
// 5. Request body construction
|
|
21
21
|
// ---------------------------------------------------------------------------
|
|
22
22
|
const fromRequest = Effect.fn("GoogleSpeech.fromRequest")(function* (request) {
|
|
23
|
+
if (request.format === "pcm" && request.mode === "generate" && /^gemini-3\.8-.*-tts(?:-|$)/.test(request.model.id))
|
|
24
|
+
return yield* route.unsupported("media.format", `${route.name} returns WAV by default for Gemini 3.8 TTS unary requests; omit the format to accept it`);
|
|
23
25
|
if (request.format !== undefined && request.format !== "pcm")
|
|
24
|
-
return yield* route.unsupported("media.format", `${route.name} only
|
|
26
|
+
return yield* route.unsupported("media.format", `${route.name} only accepts raw PCM as an explicit format; omit it to accept the provider's default output`);
|
|
25
27
|
const voiceName = SpeechStream.voiceID(request.voice);
|
|
26
28
|
return MediaProtocol.json(mergeJsonRecords({
|
|
27
29
|
contents: [{ role: "user", parts: [{ text: request.text }] }],
|
|
@@ -46,10 +48,15 @@ const step = Effect.fn("GoogleSpeech.step")(function* (state, frame) {
|
|
|
46
48
|
const next = { ...GeminiGenerateContent.track(state, chunk), mimeType: state.mimeType ?? audio[0]?.mimeType };
|
|
47
49
|
return [next, audio.flatMap((part) => SpeechStream.delta(next, part.data)[1])];
|
|
48
50
|
});
|
|
49
|
-
const finish = (state) => {
|
|
51
|
+
const finish = (state, context) => {
|
|
50
52
|
const sampleRate = SpeechStream.sampleRate(state.mimeType) ?? DEFAULT_SAMPLE_RATE;
|
|
53
|
+
const output = state.mimeType?.split(";")[0]?.toLowerCase() === "audio/wav"
|
|
54
|
+
? SpeechStream.container("wav", sampleRate)
|
|
55
|
+
: SpeechStream.pcm("pcm_s16le", sampleRate, state.mimeType ?? `audio/L16;codec=pcm;rate=${sampleRate}`);
|
|
56
|
+
if (context.request.format === "pcm" && output.info.format !== "pcm")
|
|
57
|
+
return Effect.fail(route.frameError(`Google Speech returned ${output.info.format} instead of the requested raw PCM`));
|
|
51
58
|
return SpeechStream.finish(route, state, {
|
|
52
|
-
...
|
|
59
|
+
...output,
|
|
53
60
|
usage: GeminiGenerateContent.usage(state.usage),
|
|
54
61
|
providerMetadata: GeminiGenerateContent.providerMetadata(state),
|
|
55
62
|
detail: state.finishReason === undefined ? undefined : `finish reason: ${state.finishReason}`,
|
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-
|
|
3
|
+
"version": "0.0.0-dev-20165",
|
|
4
4
|
"name": "@opencode/ai",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@clack/prompts": "1.0.0-alpha.1",
|
|
36
36
|
"@effect/platform-node": "4.0.0-rc.112",
|
|
37
|
-
"@opencode/http-recorder": "0.0.0-dev-
|
|
37
|
+
"@opencode/http-recorder": "0.0.0-dev-20165",
|
|
38
38
|
"@tsconfig/bun": "1.0.9",
|
|
39
39
|
"@types/bun": "1.4.0",
|
|
40
40
|
"@typescript/native-preview": "7.0.0-dev.20251207.1",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@aws-sdk/credential-providers": "3.1057.0",
|
|
45
45
|
"@smithy/eventstream-codec": "4.2.14",
|
|
46
46
|
"@smithy/util-utf8": "4.2.2",
|
|
47
|
-
"@opencode/schema": "0.0.0-dev-
|
|
47
|
+
"@opencode/schema": "0.0.0-dev-20165",
|
|
48
48
|
"aws4fetch": "1.0.20",
|
|
49
49
|
"effect": "4.0.0-rc.112",
|
|
50
50
|
"google-auth-library": "10.5.0"
|