@opencode/ai 2.0.18 → 2.0.20

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 (94) hide show
  1. package/README.md +24 -12
  2. package/dist/cache-policy.js +7 -0
  3. package/dist/experimental/evaluation.d.ts +7 -0
  4. package/dist/experimental/evaluation.js +2 -0
  5. package/dist/experimental/system-one.js +10 -7
  6. package/dist/generation.d.ts +1 -1
  7. package/dist/generation.js +23 -18
  8. package/dist/index.d.ts +1 -1
  9. package/dist/index.js +1 -1
  10. package/dist/llm.d.ts +1 -1
  11. package/dist/promise.d.ts +3 -3
  12. package/dist/promise.js +4 -3
  13. package/dist/protocols/alibaba-chat.d.ts +8 -2
  14. package/dist/protocols/alibaba-responses.d.ts +14 -14
  15. package/dist/protocols/anthropic-messages.js +2 -15
  16. package/dist/protocols/bedrock-converse.d.ts +1 -1
  17. package/dist/protocols/bedrock-converse.js +38 -12
  18. package/dist/protocols/deepgram-speech.js +9 -7
  19. package/dist/protocols/deepgram-transcription.js +4 -10
  20. package/dist/protocols/elevenlabs-transcription.d.ts +28 -0
  21. package/dist/protocols/elevenlabs-transcription.js +137 -0
  22. package/dist/protocols/gemini.js +1 -10
  23. package/dist/protocols/google-speech.js +9 -2
  24. package/dist/protocols/google-transcription.js +4 -0
  25. package/dist/protocols/google-video.js +11 -2
  26. package/dist/protocols/meta-messages.d.ts +5 -1
  27. package/dist/protocols/meta-messages.js +11 -4
  28. package/dist/protocols/meta-responses.d.ts +16 -16
  29. package/dist/protocols/mistral-chat.d.ts +6 -0
  30. package/dist/protocols/mistral-chat.js +8 -5
  31. package/dist/protocols/open-responses.d.ts +31 -31
  32. package/dist/protocols/openai-chat.d.ts +53 -10
  33. package/dist/protocols/openai-chat.js +21 -8
  34. package/dist/protocols/openai-compatible-chat.d.ts +7 -2
  35. package/dist/protocols/openai-compatible-responses.d.ts +2 -2
  36. package/dist/protocols/openai-responses.d.ts +22 -22
  37. package/dist/protocols/openai-speech.js +6 -1
  38. package/dist/protocols/openai-transcription.js +1 -1
  39. package/dist/protocols/runway-video.js +2 -1
  40. package/dist/protocols/utils/claude-model.d.ts +8 -0
  41. package/dist/protocols/utils/claude-model.js +15 -0
  42. package/dist/protocols/utils/gemini-generate-content.d.ts +6 -0
  43. package/dist/protocols/utils/gemini-generate-content.js +33 -0
  44. package/dist/protocols/utils/media-input.d.ts +4 -3
  45. package/dist/protocols/utils/media-input.js +5 -4
  46. package/dist/protocols/utils/speaker-turns.d.ts +3 -0
  47. package/dist/protocols/utils/speaker-turns.js +9 -0
  48. package/dist/protocols/utils/speech-stream.d.ts +1 -0
  49. package/dist/protocols/utils/speech-stream.js +1 -0
  50. package/dist/protocols/utils/tool-stream.d.ts +4 -3
  51. package/dist/protocols/utils/tool-stream.js +1 -1
  52. package/dist/protocols/xai-responses.d.ts +14 -14
  53. package/dist/protocols/xai-video.js +7 -1
  54. package/dist/protocols/zai-chat.d.ts +8 -2
  55. package/dist/provider-error.d.ts +6 -0
  56. package/dist/provider-error.js +65 -2
  57. package/dist/providers/alibaba.d.ts +9 -4
  58. package/dist/providers/amazon-bedrock-mantle.d.ts +9 -4
  59. package/dist/providers/anthropic-compatible.js +3 -2
  60. package/dist/providers/azure.d.ts +11 -6
  61. package/dist/providers/baseten.d.ts +14 -4
  62. package/dist/providers/cerebras.d.ts +14 -4
  63. package/dist/providers/cloudflare-ai-gateway.d.ts +18 -8
  64. package/dist/providers/cloudflare-workers-ai.d.ts +14 -4
  65. package/dist/providers/deepinfra.d.ts +14 -4
  66. package/dist/providers/deepseek.d.ts +14 -4
  67. package/dist/providers/elevenlabs.d.ts +5 -0
  68. package/dist/providers/elevenlabs.js +4 -0
  69. package/dist/providers/fireworks.d.ts +14 -4
  70. package/dist/providers/google-vertex-chat.d.ts +7 -2
  71. package/dist/providers/google-vertex-responses.d.ts +2 -2
  72. package/dist/providers/groq.d.ts +15 -4
  73. package/dist/providers/meta.d.ts +14 -5
  74. package/dist/providers/minimax.d.ts +9 -4
  75. package/dist/providers/moonshot.d.ts +9 -4
  76. package/dist/providers/openai-compatible-responses.d.ts +2 -2
  77. package/dist/providers/openai-compatible.d.ts +7 -2
  78. package/dist/providers/openai.d.ts +9 -4
  79. package/dist/providers/openrouter.d.ts +27 -6
  80. package/dist/providers/togetherai.d.ts +14 -4
  81. package/dist/providers/xai.d.ts +7 -2
  82. package/dist/providers/xai.js +3 -3
  83. package/dist/providers/zai-coding-plan.d.ts +9 -4
  84. package/dist/providers/zai.d.ts +7 -2
  85. package/dist/route/client.d.ts +1 -1
  86. package/dist/route/executor.js +12 -8
  87. package/dist/route/media-protocol.d.ts +13 -3
  88. package/dist/route/media-protocol.js +16 -6
  89. package/dist/route/media.js +18 -4
  90. package/dist/schema/events.d.ts +30 -30
  91. package/dist/testing.d.ts +8 -8
  92. package/dist/transcription.d.ts +1 -1
  93. package/dist/transcription.js +1 -1
  94. package/package.json +3 -3
package/dist/testing.d.ts CHANGED
@@ -206,8 +206,8 @@ export declare const complete: (options: {
206
206
  } | {
207
207
  readonly id: string;
208
208
  readonly type: "tool-error";
209
- readonly name: string;
210
209
  readonly message: string;
210
+ readonly name: string;
211
211
  readonly error?: unknown;
212
212
  readonly providerMetadata?: {
213
213
  readonly [x: string]: {
@@ -418,8 +418,8 @@ export declare const stop: (...events: readonly LLMEvent[]) => (({
418
418
  } | {
419
419
  readonly id: string;
420
420
  readonly type: "tool-error";
421
- readonly name: string;
422
421
  readonly message: string;
422
+ readonly name: string;
423
423
  readonly error?: unknown;
424
424
  readonly providerMetadata?: {
425
425
  readonly [x: string]: {
@@ -630,8 +630,8 @@ export declare const toolCalls: (...events: readonly LLMEvent[]) => (({
630
630
  } | {
631
631
  readonly id: string;
632
632
  readonly type: "tool-error";
633
- readonly name: string;
634
633
  readonly message: string;
634
+ readonly name: string;
635
635
  readonly error?: unknown;
636
636
  readonly providerMetadata?: {
637
637
  readonly [x: string]: {
@@ -842,8 +842,8 @@ export declare const text: (value: string, id: string) => (({
842
842
  } | {
843
843
  readonly id: string;
844
844
  readonly type: "tool-error";
845
- readonly name: string;
846
845
  readonly message: string;
846
+ readonly name: string;
847
847
  readonly error?: unknown;
848
848
  readonly providerMetadata?: {
849
849
  readonly [x: string]: {
@@ -1054,8 +1054,8 @@ export declare const textWithUsage: (value: string, id: string, inputTokens: num
1054
1054
  } | {
1055
1055
  readonly id: string;
1056
1056
  readonly type: "tool-error";
1057
- readonly name: string;
1058
1057
  readonly message: string;
1058
+ readonly name: string;
1059
1059
  readonly error?: unknown;
1060
1060
  readonly providerMetadata?: {
1061
1061
  readonly [x: string]: {
@@ -1266,8 +1266,8 @@ export declare const tool: (id: string, name: string, input: unknown) => (({
1266
1266
  } | {
1267
1267
  readonly id: string;
1268
1268
  readonly type: "tool-error";
1269
- readonly name: string;
1270
1269
  readonly message: string;
1270
+ readonly name: string;
1271
1271
  readonly error?: unknown;
1272
1272
  readonly providerMetadata?: {
1273
1273
  readonly [x: string]: {
@@ -1478,8 +1478,8 @@ export declare const failAfter: (error: AIError, ...events: readonly LLMEvent[])
1478
1478
  } | {
1479
1479
  readonly id: string;
1480
1480
  readonly type: "tool-error";
1481
- readonly name: string;
1482
1481
  readonly message: string;
1482
+ readonly name: string;
1483
1483
  readonly error?: unknown;
1484
1484
  readonly providerMetadata?: {
1485
1485
  readonly [x: string]: {
@@ -1690,8 +1690,8 @@ export declare const hangAfter: (...events: readonly LLMEvent[]) => Stream.Strea
1690
1690
  } | {
1691
1691
  readonly id: string;
1692
1692
  readonly type: "tool-error";
1693
- readonly name: string;
1694
1693
  readonly message: string;
1694
+ readonly name: string;
1695
1695
  readonly error?: unknown;
1696
1696
  readonly providerMetadata?: {
1697
1697
  readonly [x: string]: {
@@ -72,7 +72,7 @@ export type TranscriptionRequestInput<Model extends TranscriptionModel = Transcr
72
72
  readonly providerOptions?: NoInfer<TranscriptionModelOptions<Model>>;
73
73
  readonly http?: HttpOptions.Input;
74
74
  };
75
- /** Speaker labels are provider-native (`A`, `0`, `spk:0`, or a known speaker name). */
75
+ /** Speaker labels are provider-native (`A`, `0`, `spk:0`, `speaker_0`, or a known speaker name). */
76
76
  export declare const TranscriptionSegment: Schema.Struct<{
77
77
  readonly text: Schema.String;
78
78
  readonly startSeconds: Schema.Number;
@@ -36,7 +36,7 @@ export class TranscriptionRequest extends Schema.Class("Transcription.Request")(
36
36
  // ---------------------------------------------------------------------------
37
37
  // Response and events
38
38
  // ---------------------------------------------------------------------------
39
- /** Speaker labels are provider-native (`A`, `0`, `spk:0`, or a known speaker name). */
39
+ /** Speaker labels are provider-native (`A`, `0`, `spk:0`, `speaker_0`, or a known speaker name). */
40
40
  export const TranscriptionSegment = Schema.Struct({
41
41
  text: Schema.String,
42
42
  startSeconds: Schema.Number,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
- "version": "2.0.18",
3
+ "version": "2.0.20",
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": "2.0.18",
37
+ "@opencode/http-recorder": "2.0.20",
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": "2.0.18",
47
+ "@opencode/schema": "2.0.20",
48
48
  "aws4fetch": "1.0.20",
49
49
  "effect": "4.0.0-rc.112",
50
50
  "google-auth-library": "10.5.0"