@opencode-ai/ai 0.0.0-next-15809 → 0.0.0-next-15811
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.
- package/dist/llm.d.ts +12 -0
- package/dist/protocols/anthropic-messages.js +8 -1
- package/dist/protocols/bedrock-converse.js +2 -1
- package/dist/protocols/openai-chat.js +1 -1
- package/dist/protocols/openai-responses.js +2 -1
- package/dist/protocols/utils/tool-stream.d.ts +491 -7
- package/dist/protocols/utils/tool-stream.js +30 -23
- package/dist/route/client.d.ts +12 -0
- package/dist/schema/events.d.ts +283 -0
- package/dist/schema/events.js +17 -0
- package/package.json +3 -3
package/dist/llm.d.ts
CHANGED
|
@@ -89,6 +89,7 @@ export declare class GenerateObjectResponse<T> {
|
|
|
89
89
|
readonly [x: string]: unknown;
|
|
90
90
|
};
|
|
91
91
|
} | undefined;
|
|
92
|
+
readonly providerExecuted?: boolean | undefined;
|
|
92
93
|
} | Schema.Struct.ReadonlySide<{
|
|
93
94
|
readonly type: Schema.tag<"tool-input-delta">;
|
|
94
95
|
readonly id: Schema.String;
|
|
@@ -103,6 +104,17 @@ export declare class GenerateObjectResponse<T> {
|
|
|
103
104
|
readonly [x: string]: unknown;
|
|
104
105
|
};
|
|
105
106
|
} | undefined;
|
|
107
|
+
} | {
|
|
108
|
+
readonly type: "tool-input-error";
|
|
109
|
+
readonly name: string;
|
|
110
|
+
readonly id: string;
|
|
111
|
+
readonly message: string;
|
|
112
|
+
readonly raw: string;
|
|
113
|
+
readonly providerMetadata?: {
|
|
114
|
+
readonly [x: string]: {
|
|
115
|
+
readonly [x: string]: unknown;
|
|
116
|
+
};
|
|
117
|
+
} | undefined;
|
|
106
118
|
} | {
|
|
107
119
|
readonly type: "tool-call";
|
|
108
120
|
readonly name: string;
|
|
@@ -591,7 +591,14 @@ const onContentBlockStart = (state, event) => {
|
|
|
591
591
|
providerExecuted: block.type === "server_tool_use",
|
|
592
592
|
}),
|
|
593
593
|
},
|
|
594
|
-
[
|
|
594
|
+
[
|
|
595
|
+
...events,
|
|
596
|
+
LLMEvent.toolInputStart({
|
|
597
|
+
id: block.id ?? String(event.index),
|
|
598
|
+
name: block.name ?? "",
|
|
599
|
+
providerExecuted: block.type === "server_tool_use" ? true : undefined,
|
|
600
|
+
}),
|
|
601
|
+
],
|
|
595
602
|
];
|
|
596
603
|
}
|
|
597
604
|
if (block.type === "text" && block.text) {
|
|
@@ -433,7 +433,8 @@ const step = (state, event) => Effect.gen(function* () {
|
|
|
433
433
|
return [
|
|
434
434
|
{
|
|
435
435
|
...state,
|
|
436
|
-
hasToolCalls: resultEvents.some(LLMEvent.is.toolCall)
|
|
436
|
+
hasToolCalls: resultEvents.some((event) => LLMEvent.is.toolCall(event) || LLMEvent.is.toolInputError(event)) ||
|
|
437
|
+
state.hasToolCalls,
|
|
437
438
|
lifecycle,
|
|
438
439
|
tools: result.tools,
|
|
439
440
|
reasoningSignatures: Object.fromEntries(Object.entries(state.reasoningSignatures).filter(([key]) => key !== String(index))),
|
|
@@ -391,7 +391,7 @@ const step = (state, event) => Effect.gen(function* () {
|
|
|
391
391
|
events.push(...result.events);
|
|
392
392
|
}
|
|
393
393
|
// Finalize accumulated tool inputs eagerly when finish_reason arrives so
|
|
394
|
-
//
|
|
394
|
+
// valid calls and malformed local calls settle independently.
|
|
395
395
|
const finished = finishReason !== undefined && state.finishReason === undefined && Object.keys(tools).length > 0
|
|
396
396
|
? yield* ToolStream.finishAll(ADAPTER, tools)
|
|
397
397
|
: undefined;
|
|
@@ -661,7 +661,8 @@ const onOutputItemDone = Effect.fn("OpenAIResponses.onOutputItemDone")(function*
|
|
|
661
661
|
{
|
|
662
662
|
...state,
|
|
663
663
|
lifecycle,
|
|
664
|
-
hasFunctionCall: resultEvents.some(LLMEvent.is.toolCall)
|
|
664
|
+
hasFunctionCall: resultEvents.some((event) => LLMEvent.is.toolCall(event) || LLMEvent.is.toolInputError(event)) ||
|
|
665
|
+
state.hasFunctionCall,
|
|
665
666
|
tools: result.tools,
|
|
666
667
|
},
|
|
667
668
|
events,
|
|
@@ -61,15 +61,84 @@ export declare const appendOrStart: <K extends StreamKey>(route: string, tools:
|
|
|
61
61
|
export declare const appendExisting: <K extends StreamKey>(route: string, tools: State<K>, key: K, text: string, missingToolMessage: string) => AppendOutcome<K> | LLMError;
|
|
62
62
|
/**
|
|
63
63
|
* Finalize one pending tool call: parse the accumulated raw JSON, remove it
|
|
64
|
-
* from state, and return
|
|
65
|
-
* a no-op because some providers emit stop events for
|
|
64
|
+
* from state, and return either a call or a non-executable local input error.
|
|
65
|
+
* Missing keys are a no-op because some providers emit stop events for
|
|
66
|
+
* non-tool content blocks.
|
|
66
67
|
*/
|
|
67
68
|
export declare const finish: <K extends StreamKey>(route: string, tools: State<K>, key: K) => Effect.Effect<{
|
|
68
69
|
tools: Partial<Record<K, PendingTool>>;
|
|
69
70
|
events?: undefined;
|
|
70
71
|
} | {
|
|
71
72
|
tools: Partial<Record<K, PendingTool>>;
|
|
72
|
-
events: ({
|
|
73
|
+
events: readonly (import("effect/Schema").Struct.ReadonlySide<{
|
|
74
|
+
readonly type: import("effect/Schema").tag<"step-start">;
|
|
75
|
+
readonly index: import("effect/Schema").Number;
|
|
76
|
+
}, "Type"> | {
|
|
77
|
+
readonly type: "text-start";
|
|
78
|
+
readonly id: string;
|
|
79
|
+
readonly providerMetadata?: {
|
|
80
|
+
readonly [x: string]: {
|
|
81
|
+
readonly [x: string]: unknown;
|
|
82
|
+
};
|
|
83
|
+
} | undefined;
|
|
84
|
+
} | {
|
|
85
|
+
readonly type: "text-delta";
|
|
86
|
+
readonly text: string;
|
|
87
|
+
readonly id: string;
|
|
88
|
+
readonly providerMetadata?: {
|
|
89
|
+
readonly [x: string]: {
|
|
90
|
+
readonly [x: string]: unknown;
|
|
91
|
+
};
|
|
92
|
+
} | undefined;
|
|
93
|
+
} | {
|
|
94
|
+
readonly type: "text-end";
|
|
95
|
+
readonly id: string;
|
|
96
|
+
readonly providerMetadata?: {
|
|
97
|
+
readonly [x: string]: {
|
|
98
|
+
readonly [x: string]: unknown;
|
|
99
|
+
};
|
|
100
|
+
} | undefined;
|
|
101
|
+
} | {
|
|
102
|
+
readonly type: "reasoning-start";
|
|
103
|
+
readonly id: string;
|
|
104
|
+
readonly providerMetadata?: {
|
|
105
|
+
readonly [x: string]: {
|
|
106
|
+
readonly [x: string]: unknown;
|
|
107
|
+
};
|
|
108
|
+
} | undefined;
|
|
109
|
+
} | {
|
|
110
|
+
readonly type: "reasoning-delta";
|
|
111
|
+
readonly text: string;
|
|
112
|
+
readonly id: string;
|
|
113
|
+
readonly providerMetadata?: {
|
|
114
|
+
readonly [x: string]: {
|
|
115
|
+
readonly [x: string]: unknown;
|
|
116
|
+
};
|
|
117
|
+
} | undefined;
|
|
118
|
+
} | {
|
|
119
|
+
readonly type: "reasoning-end";
|
|
120
|
+
readonly id: string;
|
|
121
|
+
readonly providerMetadata?: {
|
|
122
|
+
readonly [x: string]: {
|
|
123
|
+
readonly [x: string]: unknown;
|
|
124
|
+
};
|
|
125
|
+
} | undefined;
|
|
126
|
+
} | {
|
|
127
|
+
readonly type: "tool-input-start";
|
|
128
|
+
readonly name: string;
|
|
129
|
+
readonly id: string;
|
|
130
|
+
readonly providerMetadata?: {
|
|
131
|
+
readonly [x: string]: {
|
|
132
|
+
readonly [x: string]: unknown;
|
|
133
|
+
};
|
|
134
|
+
} | undefined;
|
|
135
|
+
readonly providerExecuted?: boolean | undefined;
|
|
136
|
+
} | import("effect/Schema").Struct.ReadonlySide<{
|
|
137
|
+
readonly type: import("effect/Schema").tag<"tool-input-delta">;
|
|
138
|
+
readonly id: import("effect/Schema").String;
|
|
139
|
+
readonly name: import("effect/Schema").String;
|
|
140
|
+
readonly text: import("effect/Schema").String;
|
|
141
|
+
}, "Type"> | {
|
|
73
142
|
readonly type: "tool-input-end";
|
|
74
143
|
readonly name: string;
|
|
75
144
|
readonly id: string;
|
|
@@ -78,6 +147,17 @@ export declare const finish: <K extends StreamKey>(route: string, tools: State<K
|
|
|
78
147
|
readonly [x: string]: unknown;
|
|
79
148
|
};
|
|
80
149
|
} | undefined;
|
|
150
|
+
} | {
|
|
151
|
+
readonly type: "tool-input-error";
|
|
152
|
+
readonly name: string;
|
|
153
|
+
readonly id: string;
|
|
154
|
+
readonly message: string;
|
|
155
|
+
readonly raw: string;
|
|
156
|
+
readonly providerMetadata?: {
|
|
157
|
+
readonly [x: string]: {
|
|
158
|
+
readonly [x: string]: unknown;
|
|
159
|
+
};
|
|
160
|
+
} | undefined;
|
|
81
161
|
} | {
|
|
82
162
|
readonly type: "tool-call";
|
|
83
163
|
readonly name: string;
|
|
@@ -89,6 +169,88 @@ export declare const finish: <K extends StreamKey>(route: string, tools: State<K
|
|
|
89
169
|
};
|
|
90
170
|
} | undefined;
|
|
91
171
|
readonly providerExecuted?: boolean | undefined;
|
|
172
|
+
} | {
|
|
173
|
+
readonly type: "tool-result";
|
|
174
|
+
readonly name: string;
|
|
175
|
+
readonly id: string;
|
|
176
|
+
readonly result: import("effect/Schema").Struct.ReadonlySide<{
|
|
177
|
+
readonly type: import("effect/Schema").Literal<"json">;
|
|
178
|
+
readonly value: import("effect/Schema").Unknown;
|
|
179
|
+
}, "Type"> | import("effect/Schema").Struct.ReadonlySide<{
|
|
180
|
+
readonly type: import("effect/Schema").Literal<"text">;
|
|
181
|
+
readonly value: import("effect/Schema").Unknown;
|
|
182
|
+
}, "Type"> | import("effect/Schema").Struct.ReadonlySide<{
|
|
183
|
+
readonly type: import("effect/Schema").Literal<"error">;
|
|
184
|
+
readonly value: import("effect/Schema").Unknown;
|
|
185
|
+
}, "Type"> | import("effect/Schema").Struct.ReadonlySide<{
|
|
186
|
+
readonly type: import("effect/Schema").Literal<"content">;
|
|
187
|
+
readonly value: import("effect/Schema").$Array<import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
|
|
188
|
+
readonly type: import("effect/Schema").Literal<"text">;
|
|
189
|
+
readonly text: import("effect/Schema").String;
|
|
190
|
+
}>, import("effect/Schema").Struct<{
|
|
191
|
+
readonly type: import("effect/Schema").Literal<"file">;
|
|
192
|
+
readonly uri: import("effect/Schema").String;
|
|
193
|
+
readonly mime: import("effect/Schema").String;
|
|
194
|
+
readonly name: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").String>>, import("effect/Schema").optionalKey<import("effect/Schema").String>, never, never>;
|
|
195
|
+
}>]>>;
|
|
196
|
+
}, "Type">;
|
|
197
|
+
readonly providerMetadata?: {
|
|
198
|
+
readonly [x: string]: {
|
|
199
|
+
readonly [x: string]: unknown;
|
|
200
|
+
};
|
|
201
|
+
} | undefined;
|
|
202
|
+
readonly providerExecuted?: boolean | undefined;
|
|
203
|
+
readonly output?: import("effect/Schema").Struct.ReadonlySide<{
|
|
204
|
+
readonly structured: import("effect/Schema").Unknown;
|
|
205
|
+
readonly content: import("effect/Schema").$Array<import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
|
|
206
|
+
readonly type: import("effect/Schema").Literal<"text">;
|
|
207
|
+
readonly text: import("effect/Schema").String;
|
|
208
|
+
}>, import("effect/Schema").Struct<{
|
|
209
|
+
readonly type: import("effect/Schema").Literal<"file">;
|
|
210
|
+
readonly uri: import("effect/Schema").String;
|
|
211
|
+
readonly mime: import("effect/Schema").String;
|
|
212
|
+
readonly name: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").String>>, import("effect/Schema").optionalKey<import("effect/Schema").String>, never, never>;
|
|
213
|
+
}>]>>;
|
|
214
|
+
}, "Type"> | undefined;
|
|
215
|
+
} | {
|
|
216
|
+
readonly type: "tool-error";
|
|
217
|
+
readonly name: string;
|
|
218
|
+
readonly id: string;
|
|
219
|
+
readonly message: string;
|
|
220
|
+
readonly error?: unknown;
|
|
221
|
+
readonly providerMetadata?: {
|
|
222
|
+
readonly [x: string]: {
|
|
223
|
+
readonly [x: string]: unknown;
|
|
224
|
+
};
|
|
225
|
+
} | undefined;
|
|
226
|
+
} | {
|
|
227
|
+
readonly type: "step-finish";
|
|
228
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
229
|
+
readonly index: number;
|
|
230
|
+
readonly providerMetadata?: {
|
|
231
|
+
readonly [x: string]: {
|
|
232
|
+
readonly [x: string]: unknown;
|
|
233
|
+
};
|
|
234
|
+
} | undefined;
|
|
235
|
+
readonly usage?: import("../..").Usage | undefined;
|
|
236
|
+
} | {
|
|
237
|
+
readonly type: "finish";
|
|
238
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
239
|
+
readonly providerMetadata?: {
|
|
240
|
+
readonly [x: string]: {
|
|
241
|
+
readonly [x: string]: unknown;
|
|
242
|
+
};
|
|
243
|
+
} | undefined;
|
|
244
|
+
readonly usage?: import("../..").Usage | undefined;
|
|
245
|
+
} | {
|
|
246
|
+
readonly type: "provider-error";
|
|
247
|
+
readonly message: string;
|
|
248
|
+
readonly providerMetadata?: {
|
|
249
|
+
readonly [x: string]: {
|
|
250
|
+
readonly [x: string]: unknown;
|
|
251
|
+
};
|
|
252
|
+
} | undefined;
|
|
253
|
+
readonly classification?: "context-overflow" | undefined;
|
|
92
254
|
})[];
|
|
93
255
|
}, LLMError, never>;
|
|
94
256
|
/**
|
|
@@ -101,7 +263,75 @@ export declare const finishWithInput: <K extends StreamKey>(route: string, tools
|
|
|
101
263
|
events?: undefined;
|
|
102
264
|
} | {
|
|
103
265
|
tools: Partial<Record<K, PendingTool>>;
|
|
104
|
-
events: ({
|
|
266
|
+
events: readonly (import("effect/Schema").Struct.ReadonlySide<{
|
|
267
|
+
readonly type: import("effect/Schema").tag<"step-start">;
|
|
268
|
+
readonly index: import("effect/Schema").Number;
|
|
269
|
+
}, "Type"> | {
|
|
270
|
+
readonly type: "text-start";
|
|
271
|
+
readonly id: string;
|
|
272
|
+
readonly providerMetadata?: {
|
|
273
|
+
readonly [x: string]: {
|
|
274
|
+
readonly [x: string]: unknown;
|
|
275
|
+
};
|
|
276
|
+
} | undefined;
|
|
277
|
+
} | {
|
|
278
|
+
readonly type: "text-delta";
|
|
279
|
+
readonly text: string;
|
|
280
|
+
readonly id: string;
|
|
281
|
+
readonly providerMetadata?: {
|
|
282
|
+
readonly [x: string]: {
|
|
283
|
+
readonly [x: string]: unknown;
|
|
284
|
+
};
|
|
285
|
+
} | undefined;
|
|
286
|
+
} | {
|
|
287
|
+
readonly type: "text-end";
|
|
288
|
+
readonly id: string;
|
|
289
|
+
readonly providerMetadata?: {
|
|
290
|
+
readonly [x: string]: {
|
|
291
|
+
readonly [x: string]: unknown;
|
|
292
|
+
};
|
|
293
|
+
} | undefined;
|
|
294
|
+
} | {
|
|
295
|
+
readonly type: "reasoning-start";
|
|
296
|
+
readonly id: string;
|
|
297
|
+
readonly providerMetadata?: {
|
|
298
|
+
readonly [x: string]: {
|
|
299
|
+
readonly [x: string]: unknown;
|
|
300
|
+
};
|
|
301
|
+
} | undefined;
|
|
302
|
+
} | {
|
|
303
|
+
readonly type: "reasoning-delta";
|
|
304
|
+
readonly text: string;
|
|
305
|
+
readonly id: string;
|
|
306
|
+
readonly providerMetadata?: {
|
|
307
|
+
readonly [x: string]: {
|
|
308
|
+
readonly [x: string]: unknown;
|
|
309
|
+
};
|
|
310
|
+
} | undefined;
|
|
311
|
+
} | {
|
|
312
|
+
readonly type: "reasoning-end";
|
|
313
|
+
readonly id: string;
|
|
314
|
+
readonly providerMetadata?: {
|
|
315
|
+
readonly [x: string]: {
|
|
316
|
+
readonly [x: string]: unknown;
|
|
317
|
+
};
|
|
318
|
+
} | undefined;
|
|
319
|
+
} | {
|
|
320
|
+
readonly type: "tool-input-start";
|
|
321
|
+
readonly name: string;
|
|
322
|
+
readonly id: string;
|
|
323
|
+
readonly providerMetadata?: {
|
|
324
|
+
readonly [x: string]: {
|
|
325
|
+
readonly [x: string]: unknown;
|
|
326
|
+
};
|
|
327
|
+
} | undefined;
|
|
328
|
+
readonly providerExecuted?: boolean | undefined;
|
|
329
|
+
} | import("effect/Schema").Struct.ReadonlySide<{
|
|
330
|
+
readonly type: import("effect/Schema").tag<"tool-input-delta">;
|
|
331
|
+
readonly id: import("effect/Schema").String;
|
|
332
|
+
readonly name: import("effect/Schema").String;
|
|
333
|
+
readonly text: import("effect/Schema").String;
|
|
334
|
+
}, "Type"> | {
|
|
105
335
|
readonly type: "tool-input-end";
|
|
106
336
|
readonly name: string;
|
|
107
337
|
readonly id: string;
|
|
@@ -110,6 +340,17 @@ export declare const finishWithInput: <K extends StreamKey>(route: string, tools
|
|
|
110
340
|
readonly [x: string]: unknown;
|
|
111
341
|
};
|
|
112
342
|
} | undefined;
|
|
343
|
+
} | {
|
|
344
|
+
readonly type: "tool-input-error";
|
|
345
|
+
readonly name: string;
|
|
346
|
+
readonly id: string;
|
|
347
|
+
readonly message: string;
|
|
348
|
+
readonly raw: string;
|
|
349
|
+
readonly providerMetadata?: {
|
|
350
|
+
readonly [x: string]: {
|
|
351
|
+
readonly [x: string]: unknown;
|
|
352
|
+
};
|
|
353
|
+
} | undefined;
|
|
113
354
|
} | {
|
|
114
355
|
readonly type: "tool-call";
|
|
115
356
|
readonly name: string;
|
|
@@ -121,16 +362,166 @@ export declare const finishWithInput: <K extends StreamKey>(route: string, tools
|
|
|
121
362
|
};
|
|
122
363
|
} | undefined;
|
|
123
364
|
readonly providerExecuted?: boolean | undefined;
|
|
365
|
+
} | {
|
|
366
|
+
readonly type: "tool-result";
|
|
367
|
+
readonly name: string;
|
|
368
|
+
readonly id: string;
|
|
369
|
+
readonly result: import("effect/Schema").Struct.ReadonlySide<{
|
|
370
|
+
readonly type: import("effect/Schema").Literal<"json">;
|
|
371
|
+
readonly value: import("effect/Schema").Unknown;
|
|
372
|
+
}, "Type"> | import("effect/Schema").Struct.ReadonlySide<{
|
|
373
|
+
readonly type: import("effect/Schema").Literal<"text">;
|
|
374
|
+
readonly value: import("effect/Schema").Unknown;
|
|
375
|
+
}, "Type"> | import("effect/Schema").Struct.ReadonlySide<{
|
|
376
|
+
readonly type: import("effect/Schema").Literal<"error">;
|
|
377
|
+
readonly value: import("effect/Schema").Unknown;
|
|
378
|
+
}, "Type"> | import("effect/Schema").Struct.ReadonlySide<{
|
|
379
|
+
readonly type: import("effect/Schema").Literal<"content">;
|
|
380
|
+
readonly value: import("effect/Schema").$Array<import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
|
|
381
|
+
readonly type: import("effect/Schema").Literal<"text">;
|
|
382
|
+
readonly text: import("effect/Schema").String;
|
|
383
|
+
}>, import("effect/Schema").Struct<{
|
|
384
|
+
readonly type: import("effect/Schema").Literal<"file">;
|
|
385
|
+
readonly uri: import("effect/Schema").String;
|
|
386
|
+
readonly mime: import("effect/Schema").String;
|
|
387
|
+
readonly name: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").String>>, import("effect/Schema").optionalKey<import("effect/Schema").String>, never, never>;
|
|
388
|
+
}>]>>;
|
|
389
|
+
}, "Type">;
|
|
390
|
+
readonly providerMetadata?: {
|
|
391
|
+
readonly [x: string]: {
|
|
392
|
+
readonly [x: string]: unknown;
|
|
393
|
+
};
|
|
394
|
+
} | undefined;
|
|
395
|
+
readonly providerExecuted?: boolean | undefined;
|
|
396
|
+
readonly output?: import("effect/Schema").Struct.ReadonlySide<{
|
|
397
|
+
readonly structured: import("effect/Schema").Unknown;
|
|
398
|
+
readonly content: import("effect/Schema").$Array<import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
|
|
399
|
+
readonly type: import("effect/Schema").Literal<"text">;
|
|
400
|
+
readonly text: import("effect/Schema").String;
|
|
401
|
+
}>, import("effect/Schema").Struct<{
|
|
402
|
+
readonly type: import("effect/Schema").Literal<"file">;
|
|
403
|
+
readonly uri: import("effect/Schema").String;
|
|
404
|
+
readonly mime: import("effect/Schema").String;
|
|
405
|
+
readonly name: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").String>>, import("effect/Schema").optionalKey<import("effect/Schema").String>, never, never>;
|
|
406
|
+
}>]>>;
|
|
407
|
+
}, "Type"> | undefined;
|
|
408
|
+
} | {
|
|
409
|
+
readonly type: "tool-error";
|
|
410
|
+
readonly name: string;
|
|
411
|
+
readonly id: string;
|
|
412
|
+
readonly message: string;
|
|
413
|
+
readonly error?: unknown;
|
|
414
|
+
readonly providerMetadata?: {
|
|
415
|
+
readonly [x: string]: {
|
|
416
|
+
readonly [x: string]: unknown;
|
|
417
|
+
};
|
|
418
|
+
} | undefined;
|
|
419
|
+
} | {
|
|
420
|
+
readonly type: "step-finish";
|
|
421
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
422
|
+
readonly index: number;
|
|
423
|
+
readonly providerMetadata?: {
|
|
424
|
+
readonly [x: string]: {
|
|
425
|
+
readonly [x: string]: unknown;
|
|
426
|
+
};
|
|
427
|
+
} | undefined;
|
|
428
|
+
readonly usage?: import("../..").Usage | undefined;
|
|
429
|
+
} | {
|
|
430
|
+
readonly type: "finish";
|
|
431
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
432
|
+
readonly providerMetadata?: {
|
|
433
|
+
readonly [x: string]: {
|
|
434
|
+
readonly [x: string]: unknown;
|
|
435
|
+
};
|
|
436
|
+
} | undefined;
|
|
437
|
+
readonly usage?: import("../..").Usage | undefined;
|
|
438
|
+
} | {
|
|
439
|
+
readonly type: "provider-error";
|
|
440
|
+
readonly message: string;
|
|
441
|
+
readonly providerMetadata?: {
|
|
442
|
+
readonly [x: string]: {
|
|
443
|
+
readonly [x: string]: unknown;
|
|
444
|
+
};
|
|
445
|
+
} | undefined;
|
|
446
|
+
readonly classification?: "context-overflow" | undefined;
|
|
124
447
|
})[];
|
|
125
448
|
}, LLMError, never>;
|
|
126
449
|
/**
|
|
127
450
|
* Finalize every pending tool call at once. OpenAI Chat has this shape: it does
|
|
128
|
-
* not emit per-tool stop events, so all accumulated calls finish
|
|
129
|
-
* receives a terminal `finish_reason`.
|
|
451
|
+
* not emit per-tool stop events, so all accumulated calls finish independently
|
|
452
|
+
* when the choice receives a terminal `finish_reason`.
|
|
130
453
|
*/
|
|
131
454
|
export declare const finishAll: <K extends StreamKey>(route: string, tools: State<K>) => Effect.Effect<{
|
|
132
455
|
tools: Partial<Record<K, PendingTool>>;
|
|
133
|
-
events: ({
|
|
456
|
+
events: (import("effect/Schema").Struct.ReadonlySide<{
|
|
457
|
+
readonly type: import("effect/Schema").tag<"step-start">;
|
|
458
|
+
readonly index: import("effect/Schema").Number;
|
|
459
|
+
}, "Type"> | {
|
|
460
|
+
readonly type: "text-start";
|
|
461
|
+
readonly id: string;
|
|
462
|
+
readonly providerMetadata?: {
|
|
463
|
+
readonly [x: string]: {
|
|
464
|
+
readonly [x: string]: unknown;
|
|
465
|
+
};
|
|
466
|
+
} | undefined;
|
|
467
|
+
} | {
|
|
468
|
+
readonly type: "text-delta";
|
|
469
|
+
readonly text: string;
|
|
470
|
+
readonly id: string;
|
|
471
|
+
readonly providerMetadata?: {
|
|
472
|
+
readonly [x: string]: {
|
|
473
|
+
readonly [x: string]: unknown;
|
|
474
|
+
};
|
|
475
|
+
} | undefined;
|
|
476
|
+
} | {
|
|
477
|
+
readonly type: "text-end";
|
|
478
|
+
readonly id: string;
|
|
479
|
+
readonly providerMetadata?: {
|
|
480
|
+
readonly [x: string]: {
|
|
481
|
+
readonly [x: string]: unknown;
|
|
482
|
+
};
|
|
483
|
+
} | undefined;
|
|
484
|
+
} | {
|
|
485
|
+
readonly type: "reasoning-start";
|
|
486
|
+
readonly id: string;
|
|
487
|
+
readonly providerMetadata?: {
|
|
488
|
+
readonly [x: string]: {
|
|
489
|
+
readonly [x: string]: unknown;
|
|
490
|
+
};
|
|
491
|
+
} | undefined;
|
|
492
|
+
} | {
|
|
493
|
+
readonly type: "reasoning-delta";
|
|
494
|
+
readonly text: string;
|
|
495
|
+
readonly id: string;
|
|
496
|
+
readonly providerMetadata?: {
|
|
497
|
+
readonly [x: string]: {
|
|
498
|
+
readonly [x: string]: unknown;
|
|
499
|
+
};
|
|
500
|
+
} | undefined;
|
|
501
|
+
} | {
|
|
502
|
+
readonly type: "reasoning-end";
|
|
503
|
+
readonly id: string;
|
|
504
|
+
readonly providerMetadata?: {
|
|
505
|
+
readonly [x: string]: {
|
|
506
|
+
readonly [x: string]: unknown;
|
|
507
|
+
};
|
|
508
|
+
} | undefined;
|
|
509
|
+
} | {
|
|
510
|
+
readonly type: "tool-input-start";
|
|
511
|
+
readonly name: string;
|
|
512
|
+
readonly id: string;
|
|
513
|
+
readonly providerMetadata?: {
|
|
514
|
+
readonly [x: string]: {
|
|
515
|
+
readonly [x: string]: unknown;
|
|
516
|
+
};
|
|
517
|
+
} | undefined;
|
|
518
|
+
readonly providerExecuted?: boolean | undefined;
|
|
519
|
+
} | import("effect/Schema").Struct.ReadonlySide<{
|
|
520
|
+
readonly type: import("effect/Schema").tag<"tool-input-delta">;
|
|
521
|
+
readonly id: import("effect/Schema").String;
|
|
522
|
+
readonly name: import("effect/Schema").String;
|
|
523
|
+
readonly text: import("effect/Schema").String;
|
|
524
|
+
}, "Type"> | {
|
|
134
525
|
readonly type: "tool-input-end";
|
|
135
526
|
readonly name: string;
|
|
136
527
|
readonly id: string;
|
|
@@ -139,6 +530,17 @@ export declare const finishAll: <K extends StreamKey>(route: string, tools: Stat
|
|
|
139
530
|
readonly [x: string]: unknown;
|
|
140
531
|
};
|
|
141
532
|
} | undefined;
|
|
533
|
+
} | {
|
|
534
|
+
readonly type: "tool-input-error";
|
|
535
|
+
readonly name: string;
|
|
536
|
+
readonly id: string;
|
|
537
|
+
readonly message: string;
|
|
538
|
+
readonly raw: string;
|
|
539
|
+
readonly providerMetadata?: {
|
|
540
|
+
readonly [x: string]: {
|
|
541
|
+
readonly [x: string]: unknown;
|
|
542
|
+
};
|
|
543
|
+
} | undefined;
|
|
142
544
|
} | {
|
|
143
545
|
readonly type: "tool-call";
|
|
144
546
|
readonly name: string;
|
|
@@ -150,6 +552,88 @@ export declare const finishAll: <K extends StreamKey>(route: string, tools: Stat
|
|
|
150
552
|
};
|
|
151
553
|
} | undefined;
|
|
152
554
|
readonly providerExecuted?: boolean | undefined;
|
|
555
|
+
} | {
|
|
556
|
+
readonly type: "tool-result";
|
|
557
|
+
readonly name: string;
|
|
558
|
+
readonly id: string;
|
|
559
|
+
readonly result: import("effect/Schema").Struct.ReadonlySide<{
|
|
560
|
+
readonly type: import("effect/Schema").Literal<"json">;
|
|
561
|
+
readonly value: import("effect/Schema").Unknown;
|
|
562
|
+
}, "Type"> | import("effect/Schema").Struct.ReadonlySide<{
|
|
563
|
+
readonly type: import("effect/Schema").Literal<"text">;
|
|
564
|
+
readonly value: import("effect/Schema").Unknown;
|
|
565
|
+
}, "Type"> | import("effect/Schema").Struct.ReadonlySide<{
|
|
566
|
+
readonly type: import("effect/Schema").Literal<"error">;
|
|
567
|
+
readonly value: import("effect/Schema").Unknown;
|
|
568
|
+
}, "Type"> | import("effect/Schema").Struct.ReadonlySide<{
|
|
569
|
+
readonly type: import("effect/Schema").Literal<"content">;
|
|
570
|
+
readonly value: import("effect/Schema").$Array<import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
|
|
571
|
+
readonly type: import("effect/Schema").Literal<"text">;
|
|
572
|
+
readonly text: import("effect/Schema").String;
|
|
573
|
+
}>, import("effect/Schema").Struct<{
|
|
574
|
+
readonly type: import("effect/Schema").Literal<"file">;
|
|
575
|
+
readonly uri: import("effect/Schema").String;
|
|
576
|
+
readonly mime: import("effect/Schema").String;
|
|
577
|
+
readonly name: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").String>>, import("effect/Schema").optionalKey<import("effect/Schema").String>, never, never>;
|
|
578
|
+
}>]>>;
|
|
579
|
+
}, "Type">;
|
|
580
|
+
readonly providerMetadata?: {
|
|
581
|
+
readonly [x: string]: {
|
|
582
|
+
readonly [x: string]: unknown;
|
|
583
|
+
};
|
|
584
|
+
} | undefined;
|
|
585
|
+
readonly providerExecuted?: boolean | undefined;
|
|
586
|
+
readonly output?: import("effect/Schema").Struct.ReadonlySide<{
|
|
587
|
+
readonly structured: import("effect/Schema").Unknown;
|
|
588
|
+
readonly content: import("effect/Schema").$Array<import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
|
|
589
|
+
readonly type: import("effect/Schema").Literal<"text">;
|
|
590
|
+
readonly text: import("effect/Schema").String;
|
|
591
|
+
}>, import("effect/Schema").Struct<{
|
|
592
|
+
readonly type: import("effect/Schema").Literal<"file">;
|
|
593
|
+
readonly uri: import("effect/Schema").String;
|
|
594
|
+
readonly mime: import("effect/Schema").String;
|
|
595
|
+
readonly name: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").String>>, import("effect/Schema").optionalKey<import("effect/Schema").String>, never, never>;
|
|
596
|
+
}>]>>;
|
|
597
|
+
}, "Type"> | undefined;
|
|
598
|
+
} | {
|
|
599
|
+
readonly type: "tool-error";
|
|
600
|
+
readonly name: string;
|
|
601
|
+
readonly id: string;
|
|
602
|
+
readonly message: string;
|
|
603
|
+
readonly error?: unknown;
|
|
604
|
+
readonly providerMetadata?: {
|
|
605
|
+
readonly [x: string]: {
|
|
606
|
+
readonly [x: string]: unknown;
|
|
607
|
+
};
|
|
608
|
+
} | undefined;
|
|
609
|
+
} | {
|
|
610
|
+
readonly type: "step-finish";
|
|
611
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
612
|
+
readonly index: number;
|
|
613
|
+
readonly providerMetadata?: {
|
|
614
|
+
readonly [x: string]: {
|
|
615
|
+
readonly [x: string]: unknown;
|
|
616
|
+
};
|
|
617
|
+
} | undefined;
|
|
618
|
+
readonly usage?: import("../..").Usage | undefined;
|
|
619
|
+
} | {
|
|
620
|
+
readonly type: "finish";
|
|
621
|
+
readonly reason: "length" | "stop" | "tool-calls" | "content-filter" | "error" | "unknown";
|
|
622
|
+
readonly providerMetadata?: {
|
|
623
|
+
readonly [x: string]: {
|
|
624
|
+
readonly [x: string]: unknown;
|
|
625
|
+
};
|
|
626
|
+
} | undefined;
|
|
627
|
+
readonly usage?: import("../..").Usage | undefined;
|
|
628
|
+
} | {
|
|
629
|
+
readonly type: "provider-error";
|
|
630
|
+
readonly message: string;
|
|
631
|
+
readonly providerMetadata?: {
|
|
632
|
+
readonly [x: string]: {
|
|
633
|
+
readonly [x: string]: unknown;
|
|
634
|
+
};
|
|
635
|
+
} | undefined;
|
|
636
|
+
readonly classification?: "context-overflow" | undefined;
|
|
153
637
|
})[];
|
|
154
638
|
}, LLMError, never>;
|
|
155
639
|
export * as ToolStream from "./tool-stream";
|