@opencode/ai 0.0.0-beta-19500 → 0.0.0-dev-19274

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 (114) hide show
  1. package/README.md +0 -200
  2. package/dist/protocols/anthropic-messages.d.ts +1 -24
  3. package/dist/protocols/anthropic-messages.js +12 -58
  4. package/dist/protocols/meta-messages.d.ts +0 -6
  5. package/dist/protocols/open-responses-channel.d.ts +0 -2
  6. package/dist/protocols/open-responses-channel.js +2 -2
  7. package/dist/protocols/open-responses-continuation.d.ts +3 -7
  8. package/dist/protocols/open-responses-continuation.js +7 -16
  9. package/dist/protocols/open-responses.d.ts +9 -141
  10. package/dist/protocols/open-responses.js +7 -29
  11. package/dist/provider-package.d.ts +0 -4
  12. package/dist/providers/amazon-bedrock-mantle.d.ts +62 -4
  13. package/dist/providers/amazon-bedrock-mantle.js +20 -23
  14. package/dist/providers/amazon-bedrock.js +3 -3
  15. package/dist/providers/anthropic-compatible.d.ts +2 -7
  16. package/dist/providers/anthropic-compatible.js +12 -18
  17. package/dist/providers/anthropic.d.ts +2 -7
  18. package/dist/providers/anthropic.js +9 -12
  19. package/dist/providers/azure.d.ts +2 -1
  20. package/dist/providers/azure.js +14 -14
  21. package/dist/providers/baseten.d.ts +3 -2
  22. package/dist/providers/baseten.js +6 -6
  23. package/dist/providers/cerebras.d.ts +3 -2
  24. package/dist/providers/cerebras.js +6 -6
  25. package/dist/providers/cloudflare-ai-gateway.d.ts +2 -1
  26. package/dist/providers/cloudflare-ai-gateway.js +10 -16
  27. package/dist/providers/cloudflare-workers-ai.d.ts +2 -1
  28. package/dist/providers/cloudflare-workers-ai.js +9 -15
  29. package/dist/providers/deepinfra.d.ts +3 -2
  30. package/dist/providers/deepinfra.js +6 -6
  31. package/dist/providers/deepseek.d.ts +3 -2
  32. package/dist/providers/deepseek.js +6 -6
  33. package/dist/providers/fireworks.d.ts +3 -2
  34. package/dist/providers/fireworks.js +6 -6
  35. package/dist/providers/google-vertex-chat.d.ts +3 -2
  36. package/dist/providers/google-vertex-chat.js +12 -12
  37. package/dist/providers/google-vertex-messages.d.ts +3 -8
  38. package/dist/providers/google-vertex-messages.js +12 -12
  39. package/dist/providers/google-vertex-responses.d.ts +3 -2
  40. package/dist/providers/google-vertex-responses.js +12 -12
  41. package/dist/providers/google-vertex-shared.js +3 -14
  42. package/dist/providers/google-vertex.d.ts +2 -1
  43. package/dist/providers/google-vertex.js +12 -18
  44. package/dist/providers/google.d.ts +3 -2
  45. package/dist/providers/google.js +6 -6
  46. package/dist/providers/groq.d.ts +3 -2
  47. package/dist/providers/groq.js +6 -6
  48. package/dist/providers/index.d.ts +0 -3
  49. package/dist/providers/index.js +0 -3
  50. package/dist/providers/meta.d.ts +3 -8
  51. package/dist/providers/meta.js +6 -6
  52. package/dist/providers/minimax/chat.js +6 -6
  53. package/dist/providers/minimax/responses.js +6 -6
  54. package/dist/providers/minimax.d.ts +3 -8
  55. package/dist/providers/minimax.js +6 -6
  56. package/dist/providers/mistral.d.ts +3 -2
  57. package/dist/providers/mistral.js +6 -6
  58. package/dist/providers/openai-compatible-responses.d.ts +3 -2
  59. package/dist/providers/openai-compatible-responses.js +7 -7
  60. package/dist/providers/openai-compatible.d.ts +3 -2
  61. package/dist/providers/openai-compatible.js +7 -7
  62. package/dist/providers/openai.d.ts +3 -2
  63. package/dist/providers/openai.js +9 -9
  64. package/dist/providers/openrouter.d.ts +3 -2
  65. package/dist/providers/openrouter.js +6 -6
  66. package/dist/providers/togetherai.d.ts +3 -2
  67. package/dist/providers/togetherai.js +6 -6
  68. package/dist/providers/xai.d.ts +3 -2
  69. package/dist/providers/xai.js +6 -10
  70. package/dist/providers/zai.d.ts +8 -133
  71. package/dist/providers/zai.js +0 -32
  72. package/dist/route/client.js +2 -5
  73. package/dist/route/transport/websocket.js +2 -6
  74. package/dist/schema/errors.d.ts +0 -12
  75. package/dist/schema/errors.js +0 -11
  76. package/dist/schema/options.d.ts +0 -2
  77. package/dist/schema/options.js +0 -2
  78. package/package.json +3 -3
  79. package/dist/protocols/alibaba-chat.d.ts +0 -225
  80. package/dist/protocols/alibaba-chat.js +0 -75
  81. package/dist/protocols/alibaba-messages.d.ts +0 -350
  82. package/dist/protocols/alibaba-messages.js +0 -40
  83. package/dist/protocols/alibaba-responses.d.ts +0 -255
  84. package/dist/protocols/alibaba-responses.js +0 -80
  85. package/dist/protocols/zai-chat.d.ts +0 -202
  86. package/dist/protocols/zai-chat.js +0 -49
  87. package/dist/protocols/zai-messages.d.ts +0 -344
  88. package/dist/protocols/zai-messages.js +0 -27
  89. package/dist/providers/alibaba/chat.d.ts +0 -1
  90. package/dist/providers/alibaba/chat.js +0 -1
  91. package/dist/providers/alibaba/messages.d.ts +0 -3
  92. package/dist/providers/alibaba/messages.js +0 -1
  93. package/dist/providers/alibaba/responses.d.ts +0 -3
  94. package/dist/providers/alibaba/responses.js +0 -1
  95. package/dist/providers/alibaba.d.ts +0 -711
  96. package/dist/providers/alibaba.js +0 -94
  97. package/dist/providers/moonshot/chat.d.ts +0 -1
  98. package/dist/providers/moonshot/chat.js +0 -1
  99. package/dist/providers/moonshot/messages.d.ts +0 -4
  100. package/dist/providers/moonshot/messages.js +0 -8
  101. package/dist/providers/moonshot/responses.d.ts +0 -4
  102. package/dist/providers/moonshot/responses.js +0 -8
  103. package/dist/providers/moonshot.d.ts +0 -596
  104. package/dist/providers/moonshot.js +0 -90
  105. package/dist/providers/zai/chat.d.ts +0 -1
  106. package/dist/providers/zai/chat.js +0 -1
  107. package/dist/providers/zai-coding-plan/chat.d.ts +0 -1
  108. package/dist/providers/zai-coding-plan/chat.js +0 -1
  109. package/dist/providers/zai-coding-plan/messages.d.ts +0 -4
  110. package/dist/providers/zai-coding-plan/messages.js +0 -8
  111. package/dist/providers/zai-coding-plan/responses.d.ts +0 -4
  112. package/dist/providers/zai-coding-plan/responses.js +0 -8
  113. package/dist/providers/zai-coding-plan.d.ts +0 -577
  114. package/dist/providers/zai-coding-plan.js +0 -63
@@ -1,94 +0,0 @@
1
- import { Struct } from "effect";
2
- import { AlibabaChat } from "../protocols/alibaba-chat.js";
3
- import { AlibabaMessages } from "../protocols/alibaba-messages.js";
4
- import { AlibabaResponses } from "../protocols/alibaba-responses.js";
5
- import { AuthOptions } from "../route/auth-options.js";
6
- import { Route } from "../route/client.js";
7
- import { Endpoint } from "../route/endpoint.js";
8
- import { Framing } from "../route/framing.js";
9
- import { ProviderConfigurationError, ProviderID, ToolDefinition } from "../schema/index.js";
10
- export const id = ProviderID.make("alibaba");
11
- const hosts = new Map([
12
- ["ap-southeast-1", "dashscope-intl.aliyuncs.com"],
13
- ["cn-beijing", "dashscope.aliyuncs.com"],
14
- ["cn-hongkong", "cn-hongkong.dashscope.aliyuncs.com"],
15
- ["us-east-1", "dashscope-us.aliyuncs.com"],
16
- ]);
17
- const chatRoute = Route.make({
18
- id: "alibaba-chat",
19
- provider: id,
20
- providerMetadataKey: "alibaba",
21
- protocol: AlibabaChat.protocol,
22
- endpoint: Endpoint.path("/chat/completions"),
23
- framing: Framing.sse,
24
- });
25
- const messagesRoute = Route.make({
26
- id: "alibaba-messages",
27
- provider: id,
28
- providerMetadataKey: "alibaba",
29
- protocol: AlibabaMessages.protocol,
30
- endpoint: Endpoint.path("/messages"),
31
- framing: Framing.sse,
32
- headers: () => ({ "anthropic-version": "2023-06-01" }),
33
- });
34
- const responsesRoute = Route.make({
35
- id: "alibaba-responses",
36
- provider: id,
37
- providerMetadataKey: "alibaba",
38
- protocol: AlibabaResponses.protocol,
39
- endpoint: Endpoint.path("/responses"),
40
- framing: Framing.sse,
41
- });
42
- export const routes = [chatRoute, messagesRoute, responsesRoute];
43
- export const configure = (input) => {
44
- const { apiKey: _key, auth: _auth, region, workspaceID, baseURL, ...rest } = input;
45
- const host = region === undefined
46
- ? undefined
47
- : workspaceID === undefined
48
- ? hosts.get(region)
49
- : `${workspaceID}.${region}.maas.aliyuncs.com`;
50
- if (baseURL === undefined) {
51
- if (region === undefined)
52
- throw new ProviderConfigurationError({ provider: id, message: "Alibaba requires region or baseURL" });
53
- if (host === undefined)
54
- throw new ProviderConfigurationError({
55
- provider: id,
56
- message: `Alibaba region ${region} requires workspaceID or baseURL`,
57
- });
58
- }
59
- const opts = { ...rest, auth: AuthOptions.bearer(input, ["DASHSCOPE_API_KEY", "ALIBABA_API_KEY"]) };
60
- const common = { ...opts, endpoint: { baseURL: baseURL ?? `https://${host}/compatible-mode/v1` } };
61
- const chat = (id) => chatRoute.with(common).model({ id, compatibility: AlibabaChat.compatibility });
62
- const messages = (id) => messagesRoute
63
- .with({
64
- ...opts,
65
- endpoint: { baseURL: baseURL ?? `https://${host}/apps/anthropic/v1` },
66
- })
67
- .model({ id, compatibility: { requireSignature: false } });
68
- const responses = (id) => responsesRoute.with(common).model({ id });
69
- return { id, model: chat, chat, messages, responses, configure };
70
- };
71
- export const provider = { id, configure };
72
- export const model = (id, input) => fromSettings(input).chat(id);
73
- export const messagesModel = (id, input) => fromSettings(input).messages(id);
74
- export const responsesModel = (id, input) => fromSettings(input).responses(id);
75
- function fromSettings(input) {
76
- const { body, ...rest } = input;
77
- return configure({
78
- ...rest,
79
- http: body === undefined ? undefined : { body },
80
- providerOptions: Struct.omit(rest, ["apiKey", "baseURL", "headers", "region", "workspaceID"]),
81
- });
82
- }
83
- export const webSearch = () => hostedTool("web_search", "Search the web with Alibaba's hosted search tool.");
84
- export const webExtractor = () => hostedTool("web_extractor", "Extract web page content with Alibaba's hosted tool.");
85
- export const codeInterpreter = () => hostedTool("code_interpreter", "Execute code with Alibaba's hosted interpreter.");
86
- function hostedTool(type, description) {
87
- return ToolDefinition.make({
88
- name: type,
89
- description,
90
- inputSchema: { type: "object", properties: {} },
91
- native: { alibaba: { type } },
92
- });
93
- }
94
- export * as Alibaba from "./alibaba.js";
@@ -1 +0,0 @@
1
- export { model, type Settings } from "../moonshot.js";
@@ -1 +0,0 @@
1
- export { model } from "../moonshot.js";
@@ -1,4 +0,0 @@
1
- import type { ProviderPackage } from "../../provider-package.js";
2
- import { Moonshot } from "../moonshot.js";
3
- export type Settings = Moonshot.Settings<Moonshot.MessagesOptionsInput>;
4
- export declare const model: ProviderPackage.Definition<Settings, Moonshot.MessagesOptionsInput>["model"];
@@ -1,8 +0,0 @@
1
- import { Moonshot } from "../moonshot.js";
2
- export const model = (modelID, { apiKey, baseURL, body, headers, ...providerOptions }) => Moonshot.configure({
3
- apiKey,
4
- baseURL,
5
- headers,
6
- http: body === undefined ? undefined : { body: { ...body } },
7
- providerOptions,
8
- }).messages(modelID);
@@ -1,4 +0,0 @@
1
- import type { ProviderPackage } from "../../provider-package.js";
2
- import { Moonshot } from "../moonshot.js";
3
- export type Settings = Moonshot.Settings<Moonshot.ResponsesOptionsInput>;
4
- export declare const model: ProviderPackage.Definition<Settings, Moonshot.ResponsesOptionsInput>["model"];
@@ -1,8 +0,0 @@
1
- import { Moonshot } from "../moonshot.js";
2
- export const model = (modelID, { apiKey, baseURL, body, headers, ...providerOptions }) => Moonshot.configure({
3
- apiKey,
4
- baseURL,
5
- headers,
6
- http: body === undefined ? undefined : { body: { ...body } },
7
- providerOptions,
8
- }).responses(modelID);