@opencode-ai/ai 0.0.0-dev-18229 → 0.0.0-dev-18231

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.
@@ -2,6 +2,43 @@ import { Protocol } from "../route/protocol.js";
2
2
  import { OpenResponses } from "./open-responses.js";
3
3
  export declare const protocol: Protocol<{
4
4
  readonly input: readonly ({
5
+ readonly [x: string]: unknown;
6
+ readonly id: string;
7
+ readonly type: "web_search_call";
8
+ readonly status?: string | undefined;
9
+ readonly action?: {
10
+ readonly [x: string]: unknown;
11
+ } | null | undefined;
12
+ } | {
13
+ readonly [x: string]: unknown;
14
+ readonly id: string;
15
+ readonly type: "file_search_call";
16
+ readonly status?: string | undefined;
17
+ readonly queries?: readonly string[] | undefined;
18
+ readonly results?: readonly {
19
+ readonly [x: string]: unknown;
20
+ }[] | null | undefined;
21
+ } | {
22
+ readonly [x: string]: unknown;
23
+ readonly id: string;
24
+ readonly type: "code_interpreter_call";
25
+ readonly status?: string | undefined;
26
+ readonly code?: string | null | undefined;
27
+ readonly container_id?: string | null | undefined;
28
+ readonly outputs?: readonly {
29
+ readonly [x: string]: unknown;
30
+ }[] | null | undefined;
31
+ } | {
32
+ readonly [x: string]: unknown;
33
+ readonly id: string;
34
+ readonly type: "mcp_call";
35
+ readonly status?: string | undefined;
36
+ readonly name?: string | undefined;
37
+ readonly output?: string | null | undefined;
38
+ readonly error?: unknown;
39
+ readonly arguments?: string | undefined;
40
+ readonly server_label?: string | undefined;
41
+ } | {
5
42
  readonly type: "reasoning";
6
43
  readonly summary: readonly {
7
44
  readonly type: "summary_text";
@@ -9,9 +46,6 @@ export declare const protocol: Protocol<{
9
46
  }[];
10
47
  readonly id?: string | undefined;
11
48
  readonly encrypted_content?: string | null | undefined;
12
- } | {
13
- readonly type: "item_reference";
14
- readonly id: string;
15
49
  } | {
16
50
  readonly role: "system";
17
51
  readonly content: string;
@@ -65,6 +99,21 @@ export declare const protocol: Protocol<{
65
99
  readonly type: "input_video";
66
100
  readonly video_url: string;
67
101
  })[];
102
+ } | {
103
+ readonly [x: string]: unknown;
104
+ readonly id: string;
105
+ readonly type: "x_search_call";
106
+ readonly status?: string | undefined;
107
+ readonly action?: {
108
+ readonly [x: string]: unknown;
109
+ } | null | undefined;
110
+ } | {
111
+ readonly [x: string]: unknown;
112
+ readonly id: string;
113
+ readonly type: "image_generation_call";
114
+ readonly status?: string | undefined;
115
+ readonly error?: unknown;
116
+ readonly result?: unknown;
68
117
  })[];
69
118
  readonly model: string;
70
119
  readonly stream: true;
@@ -1,12 +1,39 @@
1
+ import { Effect, Schema } from "effect";
1
2
  import { Protocol } from "../route/protocol.js";
2
3
  import { OpenResponses } from "./open-responses.js";
4
+ import { JsonObject, optionalNull, ProviderShared } from "./shared.js";
3
5
  import { ResponsesHostedTools } from "./utils/responses-hosted-tools.js";
4
6
  const ADAPTER = "xai-responses";
5
7
  const NAME = "xAI Responses";
8
+ const XAIResponsesHostedToolItem = Schema.Union([
9
+ Schema.StructWithRest(Schema.Struct({
10
+ type: Schema.tag("x_search_call"),
11
+ id: Schema.String,
12
+ status: Schema.optional(Schema.String),
13
+ action: optionalNull(JsonObject),
14
+ }), [JsonObject]),
15
+ Schema.StructWithRest(Schema.Struct({
16
+ type: Schema.tag("image_generation_call"),
17
+ id: Schema.String,
18
+ status: Schema.optional(Schema.String),
19
+ result: Schema.optional(Schema.Unknown),
20
+ error: Schema.optional(Schema.Unknown),
21
+ }), [JsonObject]),
22
+ ]);
23
+ const XAIResponsesBody = Schema.Struct({
24
+ ...OpenResponses.coreFields,
25
+ input: Schema.Array(Schema.Union([OpenResponses.InputItem, XAIResponsesHostedToolItem])),
26
+ stream: Schema.Literal(true),
27
+ });
6
28
  const extension = {
7
29
  id: ADAPTER,
8
30
  name: NAME,
31
+ lowerHostedToolItem: (item) => (Schema.is(XAIResponsesHostedToolItem)(item) ? item : undefined),
9
32
  };
33
+ const decodeBody = ProviderShared.validateWith(Schema.decodeUnknownEffect(XAIResponsesBody));
34
+ const fromRequest = Effect.fn("XAIResponses.fromRequest")(function* (request) {
35
+ return yield* decodeBody(yield* OpenResponses.fromRequestWithExtension(request, extension));
36
+ });
10
37
  const HOSTED_TOOLS = {
11
38
  web_search_call: { name: "web_search", input: (item) => item.action ?? {} },
12
39
  x_search_call: { name: "x_search", input: (item) => item.action ?? {} },
@@ -30,7 +57,10 @@ const step = (state, event) => {
30
57
  };
31
58
  export const protocol = Protocol.make({
32
59
  id: ADAPTER,
33
- body: OpenResponses.protocol.body,
60
+ body: {
61
+ schema: XAIResponsesBody,
62
+ from: fromRequest,
63
+ },
34
64
  stream: {
35
65
  event: OpenResponses.protocol.stream.event,
36
66
  initial: (request) => OpenResponses.initial(request, extension),
@@ -119,6 +119,43 @@ export declare const routes: (RouteDef<{
119
119
  readonly presence_penalty?: number | undefined;
120
120
  }, import("../route/transport/http.js").HttpPrepared<string>> | RouteDef<{
121
121
  readonly input: readonly ({
122
+ readonly [x: string]: unknown;
123
+ readonly id: string;
124
+ readonly type: "web_search_call";
125
+ readonly status?: string | undefined;
126
+ readonly action?: {
127
+ readonly [x: string]: unknown;
128
+ } | null | undefined;
129
+ } | {
130
+ readonly [x: string]: unknown;
131
+ readonly id: string;
132
+ readonly type: "file_search_call";
133
+ readonly status?: string | undefined;
134
+ readonly queries?: readonly string[] | undefined;
135
+ readonly results?: readonly {
136
+ readonly [x: string]: unknown;
137
+ }[] | null | undefined;
138
+ } | {
139
+ readonly [x: string]: unknown;
140
+ readonly id: string;
141
+ readonly type: "code_interpreter_call";
142
+ readonly status?: string | undefined;
143
+ readonly code?: string | null | undefined;
144
+ readonly container_id?: string | null | undefined;
145
+ readonly outputs?: readonly {
146
+ readonly [x: string]: unknown;
147
+ }[] | null | undefined;
148
+ } | {
149
+ readonly [x: string]: unknown;
150
+ readonly id: string;
151
+ readonly type: "mcp_call";
152
+ readonly status?: string | undefined;
153
+ readonly name?: string | undefined;
154
+ readonly output?: string | null | undefined;
155
+ readonly error?: unknown;
156
+ readonly arguments?: string | undefined;
157
+ readonly server_label?: string | undefined;
158
+ } | {
122
159
  readonly type: "reasoning";
123
160
  readonly summary: readonly {
124
161
  readonly type: "summary_text";
@@ -126,9 +163,6 @@ export declare const routes: (RouteDef<{
126
163
  }[];
127
164
  readonly id?: string | undefined;
128
165
  readonly encrypted_content?: string | null | undefined;
129
- } | {
130
- readonly type: "item_reference";
131
- readonly id: string;
132
166
  } | {
133
167
  readonly role: "system";
134
168
  readonly content: string;
@@ -182,6 +216,34 @@ export declare const routes: (RouteDef<{
182
216
  readonly type: "input_video";
183
217
  readonly video_url: string;
184
218
  })[];
219
+ } | {
220
+ readonly [x: string]: unknown;
221
+ readonly id: string;
222
+ readonly type: "computer_call";
223
+ readonly status?: string | undefined;
224
+ readonly action?: {
225
+ readonly [x: string]: unknown;
226
+ } | null | undefined;
227
+ readonly call_id?: string | undefined;
228
+ readonly pending_safety_checks?: readonly {
229
+ readonly [x: string]: unknown;
230
+ }[] | undefined;
231
+ } | {
232
+ readonly [x: string]: unknown;
233
+ readonly id: string;
234
+ readonly type: "web_search_preview_call";
235
+ readonly status?: string | undefined;
236
+ readonly action?: {
237
+ readonly [x: string]: unknown;
238
+ } | null | undefined;
239
+ } | {
240
+ readonly [x: string]: unknown;
241
+ readonly id: string;
242
+ readonly type: "image_generation_call";
243
+ readonly status?: string | undefined;
244
+ readonly result?: string | null | undefined;
245
+ readonly revised_prompt?: string | null | undefined;
246
+ readonly output_format?: "png" | "jpeg" | "webp" | undefined;
185
247
  })[];
186
248
  readonly model: string;
187
249
  readonly stream: true;
@@ -122,6 +122,43 @@ export declare const routes: (RouteDef<{
122
122
  readonly presence_penalty?: number | undefined;
123
123
  }, import("../route/transport/http.js").HttpPrepared<string>> | RouteDef<{
124
124
  readonly input: readonly ({
125
+ readonly [x: string]: unknown;
126
+ readonly id: string;
127
+ readonly type: "web_search_call";
128
+ readonly status?: string | undefined;
129
+ readonly action?: {
130
+ readonly [x: string]: unknown;
131
+ } | null | undefined;
132
+ } | {
133
+ readonly [x: string]: unknown;
134
+ readonly id: string;
135
+ readonly type: "file_search_call";
136
+ readonly status?: string | undefined;
137
+ readonly queries?: readonly string[] | undefined;
138
+ readonly results?: readonly {
139
+ readonly [x: string]: unknown;
140
+ }[] | null | undefined;
141
+ } | {
142
+ readonly [x: string]: unknown;
143
+ readonly id: string;
144
+ readonly type: "code_interpreter_call";
145
+ readonly status?: string | undefined;
146
+ readonly code?: string | null | undefined;
147
+ readonly container_id?: string | null | undefined;
148
+ readonly outputs?: readonly {
149
+ readonly [x: string]: unknown;
150
+ }[] | null | undefined;
151
+ } | {
152
+ readonly [x: string]: unknown;
153
+ readonly id: string;
154
+ readonly type: "mcp_call";
155
+ readonly status?: string | undefined;
156
+ readonly name?: string | undefined;
157
+ readonly output?: string | null | undefined;
158
+ readonly error?: unknown;
159
+ readonly arguments?: string | undefined;
160
+ readonly server_label?: string | undefined;
161
+ } | {
125
162
  readonly type: "reasoning";
126
163
  readonly summary: readonly {
127
164
  readonly type: "summary_text";
@@ -129,9 +166,6 @@ export declare const routes: (RouteDef<{
129
166
  }[];
130
167
  readonly id?: string | undefined;
131
168
  readonly encrypted_content?: string | null | undefined;
132
- } | {
133
- readonly type: "item_reference";
134
- readonly id: string;
135
169
  } | {
136
170
  readonly role: "system";
137
171
  readonly content: string;
@@ -185,6 +219,34 @@ export declare const routes: (RouteDef<{
185
219
  readonly type: "input_video";
186
220
  readonly video_url: string;
187
221
  })[];
222
+ } | {
223
+ readonly [x: string]: unknown;
224
+ readonly id: string;
225
+ readonly type: "computer_call";
226
+ readonly status?: string | undefined;
227
+ readonly action?: {
228
+ readonly [x: string]: unknown;
229
+ } | null | undefined;
230
+ readonly call_id?: string | undefined;
231
+ readonly pending_safety_checks?: readonly {
232
+ readonly [x: string]: unknown;
233
+ }[] | undefined;
234
+ } | {
235
+ readonly [x: string]: unknown;
236
+ readonly id: string;
237
+ readonly type: "web_search_preview_call";
238
+ readonly status?: string | undefined;
239
+ readonly action?: {
240
+ readonly [x: string]: unknown;
241
+ } | null | undefined;
242
+ } | {
243
+ readonly [x: string]: unknown;
244
+ readonly id: string;
245
+ readonly type: "image_generation_call";
246
+ readonly status?: string | undefined;
247
+ readonly result?: string | null | undefined;
248
+ readonly revised_prompt?: string | null | undefined;
249
+ readonly output_format?: "png" | "jpeg" | "webp" | undefined;
188
250
  })[];
189
251
  readonly model: string;
190
252
  readonly stream: true;
@@ -20,6 +20,43 @@ export interface Settings extends ProviderPackage.Settings {
20
20
  }
21
21
  export declare const routes: import("../route/client.js").Route<{
22
22
  readonly input: readonly ({
23
+ readonly [x: string]: unknown;
24
+ readonly id: string;
25
+ readonly type: "web_search_call";
26
+ readonly status?: string | undefined;
27
+ readonly action?: {
28
+ readonly [x: string]: unknown;
29
+ } | null | undefined;
30
+ } | {
31
+ readonly [x: string]: unknown;
32
+ readonly id: string;
33
+ readonly type: "file_search_call";
34
+ readonly status?: string | undefined;
35
+ readonly queries?: readonly string[] | undefined;
36
+ readonly results?: readonly {
37
+ readonly [x: string]: unknown;
38
+ }[] | null | undefined;
39
+ } | {
40
+ readonly [x: string]: unknown;
41
+ readonly id: string;
42
+ readonly type: "code_interpreter_call";
43
+ readonly status?: string | undefined;
44
+ readonly code?: string | null | undefined;
45
+ readonly container_id?: string | null | undefined;
46
+ readonly outputs?: readonly {
47
+ readonly [x: string]: unknown;
48
+ }[] | null | undefined;
49
+ } | {
50
+ readonly [x: string]: unknown;
51
+ readonly id: string;
52
+ readonly type: "mcp_call";
53
+ readonly status?: string | undefined;
54
+ readonly name?: string | undefined;
55
+ readonly output?: string | null | undefined;
56
+ readonly error?: unknown;
57
+ readonly arguments?: string | undefined;
58
+ readonly server_label?: string | undefined;
59
+ } | {
23
60
  readonly type: "reasoning";
24
61
  readonly summary: readonly {
25
62
  readonly type: "summary_text";
@@ -27,9 +64,6 @@ export declare const routes: import("../route/client.js").Route<{
27
64
  }[];
28
65
  readonly id?: string | undefined;
29
66
  readonly encrypted_content?: string | null | undefined;
30
- } | {
31
- readonly type: "item_reference";
32
- readonly id: string;
33
67
  } | {
34
68
  readonly role: "system";
35
69
  readonly content: string;
@@ -18,6 +18,43 @@ export interface Settings extends ProviderPackage.Settings {
18
18
  }
19
19
  export declare const routes: import("../route/client.js").Route<{
20
20
  readonly input: readonly ({
21
+ readonly [x: string]: unknown;
22
+ readonly id: string;
23
+ readonly type: "web_search_call";
24
+ readonly status?: string | undefined;
25
+ readonly action?: {
26
+ readonly [x: string]: unknown;
27
+ } | null | undefined;
28
+ } | {
29
+ readonly [x: string]: unknown;
30
+ readonly id: string;
31
+ readonly type: "file_search_call";
32
+ readonly status?: string | undefined;
33
+ readonly queries?: readonly string[] | undefined;
34
+ readonly results?: readonly {
35
+ readonly [x: string]: unknown;
36
+ }[] | null | undefined;
37
+ } | {
38
+ readonly [x: string]: unknown;
39
+ readonly id: string;
40
+ readonly type: "code_interpreter_call";
41
+ readonly status?: string | undefined;
42
+ readonly code?: string | null | undefined;
43
+ readonly container_id?: string | null | undefined;
44
+ readonly outputs?: readonly {
45
+ readonly [x: string]: unknown;
46
+ }[] | null | undefined;
47
+ } | {
48
+ readonly [x: string]: unknown;
49
+ readonly id: string;
50
+ readonly type: "mcp_call";
51
+ readonly status?: string | undefined;
52
+ readonly name?: string | undefined;
53
+ readonly output?: string | null | undefined;
54
+ readonly error?: unknown;
55
+ readonly arguments?: string | undefined;
56
+ readonly server_label?: string | undefined;
57
+ } | {
21
58
  readonly type: "reasoning";
22
59
  readonly summary: readonly {
23
60
  readonly type: "summary_text";
@@ -25,9 +62,6 @@ export declare const routes: import("../route/client.js").Route<{
25
62
  }[];
26
63
  readonly id?: string | undefined;
27
64
  readonly encrypted_content?: string | null | undefined;
28
- } | {
29
- readonly type: "item_reference";
30
- readonly id: string;
31
65
  } | {
32
66
  readonly role: "system";
33
67
  readonly content: string;
@@ -107,6 +107,43 @@ export declare const routes: (Route<{
107
107
  readonly presence_penalty?: number | undefined;
108
108
  }, import("../route/transport/http.js").HttpPrepared<string>> | Route<{
109
109
  readonly input: readonly ({
110
+ readonly [x: string]: unknown;
111
+ readonly id: string;
112
+ readonly type: "web_search_call";
113
+ readonly status?: string | undefined;
114
+ readonly action?: {
115
+ readonly [x: string]: unknown;
116
+ } | null | undefined;
117
+ } | {
118
+ readonly [x: string]: unknown;
119
+ readonly id: string;
120
+ readonly type: "file_search_call";
121
+ readonly status?: string | undefined;
122
+ readonly queries?: readonly string[] | undefined;
123
+ readonly results?: readonly {
124
+ readonly [x: string]: unknown;
125
+ }[] | null | undefined;
126
+ } | {
127
+ readonly [x: string]: unknown;
128
+ readonly id: string;
129
+ readonly type: "code_interpreter_call";
130
+ readonly status?: string | undefined;
131
+ readonly code?: string | null | undefined;
132
+ readonly container_id?: string | null | undefined;
133
+ readonly outputs?: readonly {
134
+ readonly [x: string]: unknown;
135
+ }[] | null | undefined;
136
+ } | {
137
+ readonly [x: string]: unknown;
138
+ readonly id: string;
139
+ readonly type: "mcp_call";
140
+ readonly status?: string | undefined;
141
+ readonly name?: string | undefined;
142
+ readonly output?: string | null | undefined;
143
+ readonly error?: unknown;
144
+ readonly arguments?: string | undefined;
145
+ readonly server_label?: string | undefined;
146
+ } | {
110
147
  readonly type: "reasoning";
111
148
  readonly summary: readonly {
112
149
  readonly type: "summary_text";
@@ -114,9 +151,6 @@ export declare const routes: (Route<{
114
151
  }[];
115
152
  readonly id?: string | undefined;
116
153
  readonly encrypted_content?: string | null | undefined;
117
- } | {
118
- readonly type: "item_reference";
119
- readonly id: string;
120
154
  } | {
121
155
  readonly role: "system";
122
156
  readonly content: string;
@@ -170,6 +204,34 @@ export declare const routes: (Route<{
170
204
  readonly type: "input_video";
171
205
  readonly video_url: string;
172
206
  })[];
207
+ } | {
208
+ readonly [x: string]: unknown;
209
+ readonly id: string;
210
+ readonly type: "computer_call";
211
+ readonly status?: string | undefined;
212
+ readonly action?: {
213
+ readonly [x: string]: unknown;
214
+ } | null | undefined;
215
+ readonly call_id?: string | undefined;
216
+ readonly pending_safety_checks?: readonly {
217
+ readonly [x: string]: unknown;
218
+ }[] | undefined;
219
+ } | {
220
+ readonly [x: string]: unknown;
221
+ readonly id: string;
222
+ readonly type: "web_search_preview_call";
223
+ readonly status?: string | undefined;
224
+ readonly action?: {
225
+ readonly [x: string]: unknown;
226
+ } | null | undefined;
227
+ } | {
228
+ readonly [x: string]: unknown;
229
+ readonly id: string;
230
+ readonly type: "image_generation_call";
231
+ readonly status?: string | undefined;
232
+ readonly result?: string | null | undefined;
233
+ readonly revised_prompt?: string | null | undefined;
234
+ readonly output_format?: "png" | "jpeg" | "webp" | undefined;
173
235
  })[];
174
236
  readonly model: string;
175
237
  readonly stream: true;
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-18229",
3
+ "version": "0.0.0-dev-18231",
4
4
  "name": "@opencode-ai/ai",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -30,7 +30,7 @@
30
30
  "devDependencies": {
31
31
  "@clack/prompts": "1.0.0-alpha.1",
32
32
  "@effect/platform-node": "4.0.0-rc.111",
33
- "@opencode-ai/http-recorder": "0.0.0-dev-18229",
33
+ "@opencode-ai/http-recorder": "0.0.0-dev-18231",
34
34
  "@tsconfig/bun": "1.0.9",
35
35
  "@types/bun": "1.3.13",
36
36
  "@typescript/native-preview": "7.0.0-dev.20251207.1",
@@ -39,7 +39,7 @@
39
39
  "dependencies": {
40
40
  "@smithy/eventstream-codec": "4.2.14",
41
41
  "@smithy/util-utf8": "4.2.2",
42
- "@opencode-ai/schema": "0.0.0-dev-18229",
42
+ "@opencode-ai/schema": "0.0.0-dev-18231",
43
43
  "aws4fetch": "1.0.20",
44
44
  "effect": "4.0.0-rc.111",
45
45
  "google-auth-library": "10.5.0"