@opencode/ai 2.1.2 → 2.1.4

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 (140) hide show
  1. package/dist/cache-policy.js +6 -5
  2. package/dist/experimental/evaluation.d.ts +7 -6
  3. package/dist/experimental/evaluation.js +3 -11
  4. package/dist/experimental/realtime.d.ts +59 -0
  5. package/dist/experimental/realtime.js +21 -13
  6. package/dist/experimental.d.ts +1 -1
  7. package/dist/generation.js +1 -1
  8. package/dist/image-client.d.ts +11 -9
  9. package/dist/image.d.ts +158 -150
  10. package/dist/image.js +2 -2
  11. package/dist/llm.d.ts +2 -4
  12. package/dist/llm.js +2 -2
  13. package/dist/media-model.d.ts +2 -2
  14. package/dist/media-model.js +1 -1
  15. package/dist/promise.d.ts +121 -121
  16. package/dist/promise.js +3 -5
  17. package/dist/protocols/alibaba-chat.d.ts +18 -18
  18. package/dist/protocols/alibaba-chat.js +3 -3
  19. package/dist/protocols/alibaba-messages.d.ts +12 -12
  20. package/dist/protocols/alibaba-messages.js +1 -1
  21. package/dist/protocols/alibaba-responses.d.ts +38 -38
  22. package/dist/protocols/anthropic-messages.d.ts +40 -44
  23. package/dist/protocols/anthropic-messages.js +13 -15
  24. package/dist/protocols/bedrock-converse.d.ts +36 -85
  25. package/dist/protocols/bedrock-converse.js +6 -6
  26. package/dist/protocols/bedrock-event-stream.d.ts +6 -1
  27. package/dist/protocols/bedrock-event-stream.js +9 -8
  28. package/dist/protocols/cartesia-speech.d.ts +32 -32
  29. package/dist/protocols/cohere-chat.d.ts +13 -10
  30. package/dist/protocols/cohere-chat.js +2 -2
  31. package/dist/protocols/deepgram-speech.d.ts +32 -32
  32. package/dist/protocols/elevenlabs-speech.d.ts +32 -32
  33. package/dist/protocols/gemini.d.ts +46 -36
  34. package/dist/protocols/gemini.js +12 -15
  35. package/dist/protocols/google-interactions.d.ts +14 -13
  36. package/dist/protocols/google-interactions.js +16 -11
  37. package/dist/protocols/google-speech.d.ts +32 -32
  38. package/dist/protocols/google-transcription.d.ts +32 -32
  39. package/dist/protocols/meta-messages.d.ts +23 -23
  40. package/dist/protocols/meta-responses.d.ts +84 -84
  41. package/dist/protocols/mistral-chat.d.ts +81 -78
  42. package/dist/protocols/mistral-chat.js +3 -5
  43. package/dist/protocols/open-responses-channel.js +47 -46
  44. package/dist/protocols/open-responses-continuation.d.ts +8 -2
  45. package/dist/protocols/open-responses-continuation.js +3 -1
  46. package/dist/protocols/open-responses.d.ts +419 -419
  47. package/dist/protocols/open-responses.js +11 -10
  48. package/dist/protocols/openai-chat.d.ts +68 -67
  49. package/dist/protocols/openai-chat.js +7 -8
  50. package/dist/protocols/openai-compatible-chat.d.ts +13 -14
  51. package/dist/protocols/openai-compatible-responses.d.ts +39 -40
  52. package/dist/protocols/openai-images.d.ts +32 -32
  53. package/dist/protocols/openai-responses.d.ts +253 -253
  54. package/dist/protocols/openai-responses.js +1 -1
  55. package/dist/protocols/openai-speech.d.ts +32 -32
  56. package/dist/protocols/openai-transcription.d.ts +32 -32
  57. package/dist/protocols/openai-transcription.js +12 -7
  58. package/dist/protocols/utils/open-responses-options.d.ts +8 -8
  59. package/dist/protocols/utils/open-responses-options.js +4 -6
  60. package/dist/protocols/utils/partial-json-options.d.ts +0 -1
  61. package/dist/protocols/utils/partial-json-options.js +0 -1
  62. package/dist/protocols/utils/partial-json.js +5 -4
  63. package/dist/protocols/utils/tool-schema.d.ts +0 -3
  64. package/dist/protocols/utils/tool-schema.js +0 -4
  65. package/dist/protocols/utils/tool-stream.d.ts +1 -1
  66. package/dist/protocols/venice-chat.d.ts +52 -53
  67. package/dist/protocols/venice-chat.js +6 -5
  68. package/dist/protocols/xai-images.js +3 -4
  69. package/dist/protocols/xai-responses.d.ts +81 -81
  70. package/dist/protocols/zai-chat.d.ts +33 -30
  71. package/dist/protocols/zai-chat.js +8 -3
  72. package/dist/protocols/zai-messages.d.ts +21 -19
  73. package/dist/protocols/zai-messages.js +3 -2
  74. package/dist/provider-error.js +8 -7
  75. package/dist/providers/alibaba.d.ts +74 -74
  76. package/dist/providers/amazon-bedrock-mantle.d.ts +202 -202
  77. package/dist/providers/amazon-bedrock.d.ts +16 -13
  78. package/dist/providers/anthropic-compatible.d.ts +13 -13
  79. package/dist/providers/anthropic.d.ts +13 -13
  80. package/dist/providers/azure.d.ts +112 -112
  81. package/dist/providers/baseten.d.ts +24 -24
  82. package/dist/providers/cerebras.d.ts +24 -24
  83. package/dist/providers/cloudflare-ai-gateway.d.ts +237 -234
  84. package/dist/providers/cloudflare-ai-gateway.js +3 -6
  85. package/dist/providers/cloudflare-workers-ai.d.ts +24 -24
  86. package/dist/providers/cohere.d.ts +78 -74
  87. package/dist/providers/deepinfra.d.ts +24 -24
  88. package/dist/providers/deepseek.d.ts +24 -24
  89. package/dist/providers/digitalocean.d.ts +36 -36
  90. package/dist/providers/fireworks.d.ts +24 -24
  91. package/dist/providers/google-vertex-chat.d.ts +12 -12
  92. package/dist/providers/google-vertex-interactions.d.ts +3 -3
  93. package/dist/providers/google-vertex-messages.d.ts +20 -20
  94. package/dist/providers/google-vertex-mistral.d.ts +14 -14
  95. package/dist/providers/google-vertex-responses.d.ts +38 -38
  96. package/dist/providers/google-vertex.d.ts +17 -17
  97. package/dist/providers/google-vertex.js +2 -2
  98. package/dist/providers/google.d.ts +79 -79
  99. package/dist/providers/groq.d.ts +24 -24
  100. package/dist/providers/meta.d.ts +189 -189
  101. package/dist/providers/minimax.d.ts +202 -202
  102. package/dist/providers/mistral.d.ts +28 -28
  103. package/dist/providers/moonshot.d.ts +202 -202
  104. package/dist/providers/open-responses-options.d.ts +0 -1
  105. package/dist/providers/open-responses-options.js +1 -1
  106. package/dist/providers/openai-compatible-responses.d.ts +38 -38
  107. package/dist/providers/openai-compatible.d.ts +12 -12
  108. package/dist/providers/openai-compatible.js +1 -1
  109. package/dist/providers/openai-options.d.ts +3 -4
  110. package/dist/providers/openai-options.js +0 -1
  111. package/dist/providers/openai.d.ts +103 -103
  112. package/dist/providers/openrouter.d.ts +171 -112
  113. package/dist/providers/openrouter.js +40 -33
  114. package/dist/providers/togetherai.d.ts +24 -24
  115. package/dist/providers/venice.d.ts +195 -20
  116. package/dist/providers/xai.d.ts +12 -12
  117. package/dist/providers/zai-coding-plan.d.ts +152 -72
  118. package/dist/providers/zai.d.ts +84 -19
  119. package/dist/route/auth-options.d.ts +0 -3
  120. package/dist/route/auth.d.ts +0 -2
  121. package/dist/route/auth.js +0 -2
  122. package/dist/route/client.d.ts +0 -218
  123. package/dist/route/client.js +3 -7
  124. package/dist/route/executor-service.js +1 -1
  125. package/dist/route/transport/http.js +5 -8
  126. package/dist/schema/errors.d.ts +1 -1
  127. package/dist/schema/errors.js +1 -1
  128. package/dist/schema/messages.js +4 -7
  129. package/dist/speech-client.d.ts +11 -9
  130. package/dist/speech.d.ts +158 -150
  131. package/dist/speech.js +2 -2
  132. package/dist/transcription-client.d.ts +11 -9
  133. package/dist/transcription.d.ts +158 -150
  134. package/dist/transcription.js +2 -2
  135. package/dist/video-client.d.ts +11 -9
  136. package/dist/video.d.ts +124 -116
  137. package/dist/video.js +2 -2
  138. package/package.json +7 -6
  139. package/dist/protocols/utils/openai-options.d.ts +0 -16
  140. package/dist/protocols/utils/openai-options.js +0 -15
@@ -28,13 +28,6 @@ export declare const routes: (Route<{
28
28
  readonly messages: readonly ({
29
29
  readonly role: "system";
30
30
  readonly content: string | readonly ({
31
- readonly type: "text";
32
- readonly text: string;
33
- readonly cache_control?: {
34
- readonly type: "ephemeral";
35
- readonly ttl?: string | undefined;
36
- } | undefined;
37
- } | {
38
31
  readonly type: "image_url";
39
32
  readonly image_url: {
40
33
  readonly url: string;
@@ -45,17 +38,17 @@ export declare const routes: (Route<{
45
38
  readonly filename: string;
46
39
  readonly file_data: string;
47
40
  };
48
- })[];
49
- } | {
50
- readonly role: "user";
51
- readonly content: string | readonly ({
41
+ } | {
52
42
  readonly type: "text";
53
43
  readonly text: string;
54
44
  readonly cache_control?: {
55
45
  readonly type: "ephemeral";
56
46
  readonly ttl?: string | undefined;
57
47
  } | undefined;
58
- } | {
48
+ })[];
49
+ } | {
50
+ readonly role: "user";
51
+ readonly content: string | readonly ({
59
52
  readonly type: "image_url";
60
53
  readonly image_url: {
61
54
  readonly url: string;
@@ -66,6 +59,13 @@ export declare const routes: (Route<{
66
59
  readonly filename: string;
67
60
  readonly file_data: string;
68
61
  };
62
+ } | {
63
+ readonly type: "text";
64
+ readonly text: string;
65
+ readonly cache_control?: {
66
+ readonly type: "ephemeral";
67
+ readonly ttl?: string | undefined;
68
+ } | undefined;
69
69
  })[];
70
70
  } | {
71
71
  readonly role: "tool";
@@ -149,13 +149,13 @@ export declare const routes: (Route<{
149
149
  readonly preserve_thinking?: boolean | undefined;
150
150
  readonly clear_thinking?: boolean | undefined;
151
151
  readonly thinking?: {
152
- readonly type: "adaptive" | "disabled" | (string & {});
152
+ readonly type: import("../schema/options.js").OpenString<"adaptive" | "disabled">;
153
153
  } | undefined;
154
154
  readonly parallel_tool_calls?: boolean | undefined;
155
155
  readonly repetition_penalty?: number | undefined;
156
156
  readonly top_k?: number | undefined;
157
157
  readonly response_format?: {
158
- readonly type: "json_object" | "json_schema" | "text" | (string & {});
158
+ readonly type: import("../schema/options.js").OpenString<"json_object" | "json_schema" | "text">;
159
159
  readonly json_schema?: {
160
160
  readonly [x: string]: unknown;
161
161
  } | undefined;
@@ -163,7 +163,7 @@ export declare const routes: (Route<{
163
163
  readonly enable_search?: boolean | undefined;
164
164
  readonly search_options?: {
165
165
  readonly forced_search?: boolean | undefined;
166
- readonly search_strategy?: "agent" | "agent_max" | "max" | "turbo" | (string & {}) | undefined;
166
+ readonly search_strategy?: import("../schema/options.js").OpenString<"agent" | "agent_max" | "max" | "turbo"> | undefined;
167
167
  readonly enable_search_extension?: boolean | undefined;
168
168
  } | undefined;
169
169
  }, import("../route/transport/http.js").HttpPrepared<string>, import("../route/client.js").CompactionOperations | undefined> | Route<{
@@ -308,23 +308,15 @@ export declare const routes: (Route<{
308
308
  } | {
309
309
  readonly role: "assistant";
310
310
  readonly content: readonly ({
311
+ readonly type: "compaction";
312
+ readonly content: string | null;
313
+ } | {
311
314
  readonly type: "text";
312
315
  readonly text: string;
313
316
  readonly cache_control?: {
314
317
  readonly type: "ephemeral";
315
318
  readonly ttl?: "1h" | "5m" | undefined;
316
319
  } | undefined;
317
- } | {
318
- readonly type: "code_execution_tool_result" | "web_fetch_tool_result" | "web_search_tool_result";
319
- readonly tool_use_id: string;
320
- readonly content: unknown;
321
- readonly cache_control?: {
322
- readonly type: "ephemeral";
323
- readonly ttl?: "1h" | "5m" | undefined;
324
- } | undefined;
325
- } | {
326
- readonly type: "compaction";
327
- readonly content: string | null;
328
320
  } | {
329
321
  readonly type: "thinking";
330
322
  readonly thinking: string;
@@ -358,6 +350,14 @@ export declare const routes: (Route<{
358
350
  readonly type: "ephemeral";
359
351
  readonly ttl?: "1h" | "5m" | undefined;
360
352
  } | undefined;
353
+ } | {
354
+ readonly type: "code_execution_tool_result" | "web_fetch_tool_result" | "web_search_tool_result";
355
+ readonly tool_use_id: string;
356
+ readonly content: unknown;
357
+ readonly cache_control?: {
358
+ readonly type: "ephemeral";
359
+ readonly ttl?: "1h" | "5m" | undefined;
360
+ } | undefined;
361
361
  })[];
362
362
  } | {
363
363
  readonly role: "system";
@@ -429,14 +429,6 @@ export declare const routes: (Route<{
429
429
  }, import("../route/transport/http.js").HttpPrepared<string>, import("../route/client.js").CompactionOperations | undefined> | Route<{
430
430
  readonly model: string;
431
431
  readonly input: readonly ({
432
- readonly [x: string]: unknown;
433
- readonly type: string;
434
- readonly id: string;
435
- } | {
436
- readonly type: "compaction";
437
- readonly id?: string | null | undefined;
438
- readonly encrypted_content: string;
439
- } | {
440
432
  readonly type: "configuration_update";
441
433
  readonly reasoning: {
442
434
  readonly effort: import("../schema/options.js").ReasoningEffort;
@@ -449,10 +441,45 @@ export declare const routes: (Route<{
449
441
  readonly type: "message";
450
442
  readonly role: "developer";
451
443
  readonly content: string;
444
+ } | {
445
+ readonly type: "function_call_output";
446
+ readonly call_id: string;
447
+ readonly output: string | readonly ({
448
+ readonly type: "input_text";
449
+ readonly text: string;
450
+ } | {
451
+ readonly type: "input_video";
452
+ readonly video_url: string;
453
+ } | {
454
+ readonly type: "input_image";
455
+ readonly image_url: string;
456
+ readonly detail?: string | undefined;
457
+ } | {
458
+ readonly type: "input_file";
459
+ readonly filename: string;
460
+ readonly detail?: string | undefined;
461
+ readonly file_data?: string | undefined;
462
+ readonly file_url?: string | undefined;
463
+ })[];
464
+ } | {
465
+ readonly type: "reasoning";
466
+ readonly id?: string | undefined;
467
+ readonly summary: readonly {
468
+ readonly type: "summary_text";
469
+ readonly text: string;
470
+ }[];
471
+ readonly encrypted_content?: string | null | undefined;
472
+ } | {
473
+ readonly type: "compaction";
474
+ readonly id?: string | null | undefined;
475
+ readonly encrypted_content: string;
452
476
  } | {
453
477
  readonly type: "message";
454
478
  readonly role: "user";
455
479
  readonly content: readonly ({
480
+ readonly type: "input_text";
481
+ readonly text: string;
482
+ } | {
456
483
  readonly type: "input_image";
457
484
  readonly image_url: string;
458
485
  readonly detail?: string | undefined;
@@ -462,9 +489,6 @@ export declare const routes: (Route<{
462
489
  readonly detail?: string | undefined;
463
490
  readonly file_data?: string | undefined;
464
491
  readonly file_url?: string | undefined;
465
- } | {
466
- readonly type: "input_text";
467
- readonly text: string;
468
492
  })[];
469
493
  readonly id?: string | undefined;
470
494
  readonly status?: string | undefined;
@@ -478,14 +502,6 @@ export declare const routes: (Route<{
478
502
  }[];
479
503
  readonly phase?: "commentary" | "final_answer" | null | undefined;
480
504
  readonly status?: string | undefined;
481
- } | {
482
- readonly type: "reasoning";
483
- readonly id?: string | undefined;
484
- readonly summary: readonly {
485
- readonly type: "summary_text";
486
- readonly text: string;
487
- }[];
488
- readonly encrypted_content?: string | null | undefined;
489
505
  } | {
490
506
  readonly type: "function_call";
491
507
  readonly id?: string | undefined;
@@ -493,26 +509,6 @@ export declare const routes: (Route<{
493
509
  readonly name: string;
494
510
  readonly namespace?: string | undefined;
495
511
  readonly arguments: string;
496
- } | {
497
- readonly type: "function_call_output";
498
- readonly call_id: string;
499
- readonly output: string | readonly ({
500
- readonly type: "input_image";
501
- readonly image_url: string;
502
- readonly detail?: string | undefined;
503
- } | {
504
- readonly type: "input_file";
505
- readonly filename: string;
506
- readonly detail?: string | undefined;
507
- readonly file_data?: string | undefined;
508
- readonly file_url?: string | undefined;
509
- } | {
510
- readonly type: "input_text";
511
- readonly text: string;
512
- } | {
513
- readonly type: "input_video";
514
- readonly video_url: string;
515
- })[];
516
512
  } | {
517
513
  readonly [x: string]: unknown;
518
514
  readonly type: "web_search_call";
@@ -550,6 +546,10 @@ export declare const routes: (Route<{
550
546
  readonly arguments?: string | undefined;
551
547
  readonly output?: string | null | undefined;
552
548
  readonly error?: unknown;
549
+ } | {
550
+ readonly [x: string]: unknown;
551
+ readonly type: string;
552
+ readonly id: string;
553
553
  })[];
554
554
  readonly instructions?: string | undefined;
555
555
  readonly tools?: readonly ({
@@ -585,15 +585,15 @@ export declare const routes: (Route<{
585
585
  } | undefined;
586
586
  readonly top_logprobs?: number | undefined;
587
587
  readonly truncation?: "auto" | "disabled" | undefined;
588
- readonly service_tier?: import("../protocols/utils/open-responses-options.js").ServiceTier | undefined;
588
+ readonly service_tier?: import("../schema/options.js").OpenString<"auto" | "default" | "flex" | "priority"> | undefined;
589
589
  readonly prompt_cache_key?: string | undefined;
590
- readonly include?: readonly import("../protocols/utils/open-responses-options.js").ResponseIncludable[] | undefined;
590
+ readonly include?: readonly import("../schema/options.js").OpenString<"code_interpreter_call.outputs" | "computer_call_output.output.image_url" | "file_search_call.results" | "message.input_image.image_url" | "message.output_text.logprobs" | "reasoning.encrypted_content" | "web_search_call.action.sources" | "web_search_call.results">[] | undefined;
591
591
  readonly reasoning?: {
592
592
  readonly effort?: import("../schema/options.js").ReasoningEffort | undefined;
593
593
  readonly summary?: "auto" | "concise" | "detailed" | undefined;
594
594
  } | undefined;
595
595
  readonly text?: {
596
- readonly verbosity?: import("../protocols/utils/open-responses-options.js").TextVerbosity | undefined;
596
+ readonly verbosity?: import("../schema/options.js").OpenString<"high" | "low" | "medium"> | undefined;
597
597
  } | undefined;
598
598
  readonly max_output_tokens?: number | undefined;
599
599
  readonly max_tool_calls?: number | undefined;
@@ -616,13 +616,13 @@ export declare const configure: (input: Config) => {
616
616
  readonly preserveThinking?: boolean | undefined;
617
617
  readonly clearThinking?: boolean | undefined;
618
618
  readonly thinking?: {
619
- readonly type: "adaptive" | "disabled" | (string & {});
619
+ readonly type: import("../schema/options.js").OpenString<"adaptive" | "disabled">;
620
620
  } | undefined;
621
621
  readonly toolStream?: boolean | undefined;
622
622
  readonly parallelToolCalls?: boolean | undefined;
623
623
  readonly repetitionPenalty?: number | undefined;
624
624
  readonly responseFormat?: {
625
- readonly type: "json_object" | "json_schema" | "text" | (string & {});
625
+ readonly type: import("../schema/options.js").OpenString<"json_object" | "json_schema" | "text">;
626
626
  readonly json_schema?: {
627
627
  readonly [x: string]: unknown;
628
628
  } | undefined;
@@ -630,7 +630,7 @@ export declare const configure: (input: Config) => {
630
630
  readonly enableSearch?: boolean | undefined;
631
631
  readonly searchOptions?: {
632
632
  readonly forced_search?: boolean | undefined;
633
- readonly search_strategy?: "agent" | "agent_max" | "max" | "turbo" | (string & {}) | undefined;
633
+ readonly search_strategy?: import("../schema/options.js").OpenString<"agent" | "agent_max" | "max" | "turbo"> | undefined;
634
634
  readonly enable_search_extension?: boolean | undefined;
635
635
  } | undefined;
636
636
  }, import("../route/client.js").CompactionOperations | undefined>;
@@ -641,13 +641,13 @@ export declare const configure: (input: Config) => {
641
641
  readonly preserveThinking?: boolean | undefined;
642
642
  readonly clearThinking?: boolean | undefined;
643
643
  readonly thinking?: {
644
- readonly type: "adaptive" | "disabled" | (string & {});
644
+ readonly type: import("../schema/options.js").OpenString<"adaptive" | "disabled">;
645
645
  } | undefined;
646
646
  readonly toolStream?: boolean | undefined;
647
647
  readonly parallelToolCalls?: boolean | undefined;
648
648
  readonly repetitionPenalty?: number | undefined;
649
649
  readonly responseFormat?: {
650
- readonly type: "json_object" | "json_schema" | "text" | (string & {});
650
+ readonly type: import("../schema/options.js").OpenString<"json_object" | "json_schema" | "text">;
651
651
  readonly json_schema?: {
652
652
  readonly [x: string]: unknown;
653
653
  } | undefined;
@@ -655,7 +655,7 @@ export declare const configure: (input: Config) => {
655
655
  readonly enableSearch?: boolean | undefined;
656
656
  readonly searchOptions?: {
657
657
  readonly forced_search?: boolean | undefined;
658
- readonly search_strategy?: "agent" | "agent_max" | "max" | "turbo" | (string & {}) | undefined;
658
+ readonly search_strategy?: import("../schema/options.js").OpenString<"agent" | "agent_max" | "max" | "turbo"> | undefined;
659
659
  readonly enable_search_extension?: boolean | undefined;
660
660
  } | undefined;
661
661
  }, import("../route/client.js").CompactionOperations | undefined>;