@opencode/ai 0.0.0-dev-21400 → 0.0.0-dev-21406
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 +2 -4
- package/dist/llm.js +2 -2
- package/dist/promise.d.ts +1 -1
- package/dist/promise.js +3 -5
- package/dist/protocols/alibaba-chat.d.ts +6 -6
- package/dist/protocols/alibaba-chat.js +3 -3
- package/dist/protocols/alibaba-messages.d.ts +1 -1
- package/dist/protocols/alibaba-messages.js +1 -1
- package/dist/protocols/alibaba-responses.d.ts +3 -3
- package/dist/protocols/anthropic-messages.js +10 -12
- package/dist/protocols/bedrock-converse.js +2 -2
- package/dist/protocols/cohere-chat.d.ts +6 -2
- package/dist/protocols/cohere-chat.js +2 -2
- package/dist/protocols/gemini.d.ts +12 -2
- package/dist/protocols/gemini.js +10 -13
- package/dist/protocols/google-interactions.d.ts +2 -1
- package/dist/protocols/google-interactions.js +14 -9
- package/dist/protocols/meta-responses.d.ts +6 -6
- package/dist/protocols/mistral-chat.js +1 -4
- package/dist/protocols/open-responses.d.ts +21 -21
- package/dist/protocols/open-responses.js +3 -3
- package/dist/protocols/openai-chat.d.ts +8 -7
- package/dist/protocols/openai-chat.js +4 -5
- package/dist/protocols/openai-compatible-responses.d.ts +3 -3
- package/dist/protocols/openai-responses.d.ts +18 -18
- package/dist/protocols/utils/open-responses-options.d.ts +8 -8
- package/dist/protocols/utils/open-responses-options.js +4 -6
- package/dist/protocols/utils/partial-json.js +5 -4
- package/dist/protocols/utils/tool-schema.d.ts +0 -3
- package/dist/protocols/utils/tool-schema.js +0 -4
- package/dist/protocols/xai-images.js +3 -4
- package/dist/protocols/xai-responses.d.ts +3 -3
- package/dist/provider-error.js +3 -4
- package/dist/providers/alibaba.d.ts +30 -30
- package/dist/providers/amazon-bedrock-mantle.d.ts +3 -3
- package/dist/providers/amazon-bedrock.d.ts +7 -7
- package/dist/providers/azure.d.ts +6 -6
- package/dist/providers/cloudflare-ai-gateway.d.ts +7 -7
- package/dist/providers/cloudflare-ai-gateway.js +2 -4
- package/dist/providers/cohere.d.ts +6 -2
- package/dist/providers/google-vertex-interactions.d.ts +3 -3
- package/dist/providers/google-vertex-messages.d.ts +18 -18
- package/dist/providers/google-vertex-mistral.d.ts +3 -3
- package/dist/providers/google-vertex-responses.d.ts +3 -3
- package/dist/providers/google.d.ts +66 -66
- package/dist/providers/meta.d.ts +21 -21
- package/dist/providers/minimax.d.ts +195 -195
- package/dist/providers/moonshot.d.ts +3 -3
- package/dist/providers/openai-compatible-responses.d.ts +3 -3
- package/dist/providers/openai-options.d.ts +3 -3
- package/dist/providers/openai.d.ts +3 -3
- package/dist/providers/zai-coding-plan.d.ts +3 -3
- package/dist/route/client.d.ts +0 -216
- package/dist/route/client.js +0 -3
- package/dist/route/transport/http.js +5 -8
- package/package.json +3 -3
- package/dist/protocols/utils/openai-options.d.ts +0 -16
- package/dist/protocols/utils/openai-options.js +0 -15
package/dist/route/client.d.ts
CHANGED
|
@@ -214,222 +214,6 @@ export declare function stream(request: LLMRequest, options?: StreamOptions): St
|
|
|
214
214
|
export declare function generate(request: LLMRequest, options?: StreamOptions): Effect.Effect<LLMResponse, AIError, Service>;
|
|
215
215
|
export declare function compact(request: CheckpointRequest, options: TriggerCompactOptions): Effect.Effect<CompactionCheckpointResponse, AIError, Service>;
|
|
216
216
|
export declare function compact(request: CompactionRequest, options?: EndpointCompactOptions): Effect.Effect<CompactionResponse, AIError, Service>;
|
|
217
|
-
export declare const streamRequest: (request: LLMRequest, options?: StreamOptions) => Stream.Stream<{
|
|
218
|
-
readonly type: "step-start";
|
|
219
|
-
readonly index: number;
|
|
220
|
-
} | {
|
|
221
|
-
readonly type: "text-start";
|
|
222
|
-
readonly id: string;
|
|
223
|
-
readonly providerMetadata?: {
|
|
224
|
-
readonly [x: string]: {
|
|
225
|
-
readonly [x: string]: unknown;
|
|
226
|
-
};
|
|
227
|
-
} | undefined;
|
|
228
|
-
} | {
|
|
229
|
-
readonly type: "text-delta";
|
|
230
|
-
readonly id: string;
|
|
231
|
-
readonly text: string;
|
|
232
|
-
readonly providerMetadata?: {
|
|
233
|
-
readonly [x: string]: {
|
|
234
|
-
readonly [x: string]: unknown;
|
|
235
|
-
};
|
|
236
|
-
} | undefined;
|
|
237
|
-
} | {
|
|
238
|
-
readonly type: "text-end";
|
|
239
|
-
readonly id: string;
|
|
240
|
-
readonly text?: string | undefined;
|
|
241
|
-
readonly providerMetadata?: {
|
|
242
|
-
readonly [x: string]: {
|
|
243
|
-
readonly [x: string]: unknown;
|
|
244
|
-
};
|
|
245
|
-
} | undefined;
|
|
246
|
-
} | {
|
|
247
|
-
readonly type: "reasoning-start";
|
|
248
|
-
readonly id: string;
|
|
249
|
-
readonly providerMetadata?: {
|
|
250
|
-
readonly [x: string]: {
|
|
251
|
-
readonly [x: string]: unknown;
|
|
252
|
-
};
|
|
253
|
-
} | undefined;
|
|
254
|
-
} | {
|
|
255
|
-
readonly type: "reasoning-delta";
|
|
256
|
-
readonly id: string;
|
|
257
|
-
readonly text: string;
|
|
258
|
-
readonly providerMetadata?: {
|
|
259
|
-
readonly [x: string]: {
|
|
260
|
-
readonly [x: string]: unknown;
|
|
261
|
-
};
|
|
262
|
-
} | undefined;
|
|
263
|
-
} | {
|
|
264
|
-
readonly type: "reasoning-end";
|
|
265
|
-
readonly id: string;
|
|
266
|
-
readonly text?: string | undefined;
|
|
267
|
-
readonly providerMetadata?: {
|
|
268
|
-
readonly [x: string]: {
|
|
269
|
-
readonly [x: string]: unknown;
|
|
270
|
-
};
|
|
271
|
-
} | undefined;
|
|
272
|
-
} | {
|
|
273
|
-
readonly type: "tool-input-start";
|
|
274
|
-
readonly id: string;
|
|
275
|
-
readonly name: string;
|
|
276
|
-
readonly namespace?: string | undefined;
|
|
277
|
-
readonly providerExecuted?: boolean | undefined;
|
|
278
|
-
readonly providerMetadata?: {
|
|
279
|
-
readonly [x: string]: {
|
|
280
|
-
readonly [x: string]: unknown;
|
|
281
|
-
};
|
|
282
|
-
} | undefined;
|
|
283
|
-
} | {
|
|
284
|
-
readonly type: "tool-input-delta";
|
|
285
|
-
readonly id: string;
|
|
286
|
-
readonly name: string;
|
|
287
|
-
readonly namespace?: string | undefined;
|
|
288
|
-
readonly text: string;
|
|
289
|
-
readonly input?: unknown;
|
|
290
|
-
} | {
|
|
291
|
-
readonly type: "tool-input-end";
|
|
292
|
-
readonly id: string;
|
|
293
|
-
readonly name: string;
|
|
294
|
-
readonly namespace?: string | undefined;
|
|
295
|
-
readonly providerMetadata?: {
|
|
296
|
-
readonly [x: string]: {
|
|
297
|
-
readonly [x: string]: unknown;
|
|
298
|
-
};
|
|
299
|
-
} | undefined;
|
|
300
|
-
} | {
|
|
301
|
-
readonly type: "tool-input-error";
|
|
302
|
-
readonly id: string;
|
|
303
|
-
readonly name: string;
|
|
304
|
-
readonly namespace?: string | undefined;
|
|
305
|
-
readonly raw: string;
|
|
306
|
-
} | {
|
|
307
|
-
readonly type: "tool-call";
|
|
308
|
-
readonly id: string;
|
|
309
|
-
readonly name: string;
|
|
310
|
-
readonly namespace?: string | undefined;
|
|
311
|
-
readonly input: unknown;
|
|
312
|
-
readonly providerExecuted?: boolean | undefined;
|
|
313
|
-
readonly providerMetadata?: {
|
|
314
|
-
readonly [x: string]: {
|
|
315
|
-
readonly [x: string]: unknown;
|
|
316
|
-
};
|
|
317
|
-
} | undefined;
|
|
318
|
-
} | {
|
|
319
|
-
readonly type: "tool-result";
|
|
320
|
-
readonly id: string;
|
|
321
|
-
readonly name: string;
|
|
322
|
-
readonly namespace?: string | undefined;
|
|
323
|
-
readonly result: {
|
|
324
|
-
readonly type: "json";
|
|
325
|
-
readonly value: unknown;
|
|
326
|
-
} | {
|
|
327
|
-
readonly type: "text";
|
|
328
|
-
readonly value: unknown;
|
|
329
|
-
} | {
|
|
330
|
-
readonly type: "error";
|
|
331
|
-
readonly value: unknown;
|
|
332
|
-
} | {
|
|
333
|
-
readonly type: "content";
|
|
334
|
-
readonly value: readonly ({
|
|
335
|
-
readonly type: "text";
|
|
336
|
-
readonly text: string;
|
|
337
|
-
} | {
|
|
338
|
-
readonly type: "file";
|
|
339
|
-
readonly uri: string;
|
|
340
|
-
readonly mime: string;
|
|
341
|
-
readonly name?: string | undefined;
|
|
342
|
-
})[];
|
|
343
|
-
};
|
|
344
|
-
readonly output?: {
|
|
345
|
-
readonly structured: unknown;
|
|
346
|
-
readonly content: readonly ({
|
|
347
|
-
readonly type: "text";
|
|
348
|
-
readonly text: string;
|
|
349
|
-
} | {
|
|
350
|
-
readonly type: "file";
|
|
351
|
-
readonly uri: string;
|
|
352
|
-
readonly mime: string;
|
|
353
|
-
readonly name?: string | undefined;
|
|
354
|
-
})[];
|
|
355
|
-
} | undefined;
|
|
356
|
-
readonly providerExecuted?: boolean | undefined;
|
|
357
|
-
readonly providerMetadata?: {
|
|
358
|
-
readonly [x: string]: {
|
|
359
|
-
readonly [x: string]: unknown;
|
|
360
|
-
};
|
|
361
|
-
} | undefined;
|
|
362
|
-
} | {
|
|
363
|
-
readonly type: "tool-error";
|
|
364
|
-
readonly id: string;
|
|
365
|
-
readonly name: string;
|
|
366
|
-
readonly namespace?: string | undefined;
|
|
367
|
-
readonly message: string;
|
|
368
|
-
readonly error?: unknown;
|
|
369
|
-
readonly providerMetadata?: {
|
|
370
|
-
readonly [x: string]: {
|
|
371
|
-
readonly [x: string]: unknown;
|
|
372
|
-
};
|
|
373
|
-
} | undefined;
|
|
374
|
-
} | {
|
|
375
|
-
readonly type: "step-finish";
|
|
376
|
-
readonly index: number;
|
|
377
|
-
readonly reason: {
|
|
378
|
-
readonly normalized: "content-filter" | "error" | "length" | "stop" | "tool-calls" | "unknown";
|
|
379
|
-
readonly raw?: string | undefined;
|
|
380
|
-
readonly category?: string | undefined;
|
|
381
|
-
readonly explanation?: string | undefined;
|
|
382
|
-
};
|
|
383
|
-
readonly usage?: import("../schema/events.js").Usage | undefined;
|
|
384
|
-
readonly providerMetadata?: {
|
|
385
|
-
readonly [x: string]: {
|
|
386
|
-
readonly [x: string]: unknown;
|
|
387
|
-
};
|
|
388
|
-
} | undefined;
|
|
389
|
-
} | {
|
|
390
|
-
readonly type: "finish";
|
|
391
|
-
readonly reason: {
|
|
392
|
-
readonly normalized: "content-filter" | "error" | "length" | "stop" | "tool-calls" | "unknown";
|
|
393
|
-
readonly raw?: string | undefined;
|
|
394
|
-
readonly category?: string | undefined;
|
|
395
|
-
readonly explanation?: string | undefined;
|
|
396
|
-
};
|
|
397
|
-
readonly usage?: import("../schema/events.js").Usage | undefined;
|
|
398
|
-
readonly providerMetadata?: {
|
|
399
|
-
readonly [x: string]: {
|
|
400
|
-
readonly [x: string]: unknown;
|
|
401
|
-
};
|
|
402
|
-
} | undefined;
|
|
403
|
-
} | {
|
|
404
|
-
readonly type: "media";
|
|
405
|
-
readonly media: import("../media.js").Asset;
|
|
406
|
-
readonly providerMetadata?: {
|
|
407
|
-
readonly [x: string]: {
|
|
408
|
-
readonly [x: string]: unknown;
|
|
409
|
-
};
|
|
410
|
-
} | undefined;
|
|
411
|
-
} | {
|
|
412
|
-
readonly type: "provider-error";
|
|
413
|
-
readonly message: string;
|
|
414
|
-
readonly classification?: "context-overflow" | "payload-too-large" | undefined;
|
|
415
|
-
readonly providerMetadata?: {
|
|
416
|
-
readonly [x: string]: {
|
|
417
|
-
readonly [x: string]: unknown;
|
|
418
|
-
};
|
|
419
|
-
} | undefined;
|
|
420
|
-
} | ({
|
|
421
|
-
readonly type: "compaction";
|
|
422
|
-
readonly provider: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
423
|
-
readonly id?: string | undefined;
|
|
424
|
-
readonly encrypted?: string | undefined;
|
|
425
|
-
readonly text?: string | null | undefined;
|
|
426
|
-
} & ({
|
|
427
|
-
readonly encrypted: string;
|
|
428
|
-
readonly text?: never;
|
|
429
|
-
} | {
|
|
430
|
-
readonly text: string | null;
|
|
431
|
-
readonly encrypted?: never;
|
|
432
|
-
})), AIError, LLMClientService>;
|
|
433
217
|
export declare const layer: Layer.Layer<Service, never, RequestExecutor.Service>;
|
|
434
218
|
export declare const Route: {
|
|
435
219
|
readonly make: typeof make;
|
package/dist/route/client.js
CHANGED
|
@@ -271,9 +271,6 @@ export function compact(request, options) {
|
|
|
271
271
|
return yield* unsupportedCompaction(request, options?.mechanism);
|
|
272
272
|
});
|
|
273
273
|
}
|
|
274
|
-
export const streamRequest = (request, options) => Stream.unwrap(Effect.gen(function* () {
|
|
275
|
-
return (yield* Service).stream(request, options);
|
|
276
|
-
}));
|
|
277
274
|
export const layer = Layer.effect(Service, Effect.gen(function* () {
|
|
278
275
|
const executor = yield* RequestExecutor.Service;
|
|
279
276
|
const stream = streamRequestWith({ http: executor });
|
|
@@ -6,13 +6,6 @@ import { Framing } from "../framing.js";
|
|
|
6
6
|
import * as ProviderShared from "../../protocols/shared.js";
|
|
7
7
|
import { AIError, DEFAULT_CHUNK_TIMEOUT_MS, DEFAULT_HTTP_TIMEOUT_MS, mergeJsonRecords, TransportError, } from "../../schema/index.js";
|
|
8
8
|
import { RequestExecutor } from "../executor.js";
|
|
9
|
-
const applyQuery = (url, query) => {
|
|
10
|
-
if (!query)
|
|
11
|
-
return url;
|
|
12
|
-
const next = new URL(url);
|
|
13
|
-
Object.entries(query).forEach(([key, value]) => next.searchParams.set(key, value));
|
|
14
|
-
return next.toString();
|
|
15
|
-
};
|
|
16
9
|
const bodyWithOverlay = (body, request, encodeBody) => Effect.gen(function* () {
|
|
17
10
|
if (request.http?.body === undefined)
|
|
18
11
|
return { jsonBody: body, bodyText: encodeBody(body) };
|
|
@@ -23,7 +16,11 @@ const bodyWithOverlay = (body, request, encodeBody) => Effect.gen(function* () {
|
|
|
23
16
|
return yield* ProviderShared.invalidRequest("http.body can only overlay JSON object request bodies");
|
|
24
17
|
});
|
|
25
18
|
export const jsonRequestParts = (input) => Effect.gen(function* () {
|
|
26
|
-
const
|
|
19
|
+
const endpoint = renderEndpoint(input.endpoint, { request: input.request, body: input.body });
|
|
20
|
+
if (input.request.http?.query) {
|
|
21
|
+
Object.entries(input.request.http.query).forEach(([key, value]) => endpoint.searchParams.set(key, value));
|
|
22
|
+
}
|
|
23
|
+
const url = endpoint.toString();
|
|
27
24
|
const body = yield* bodyWithOverlay(input.body, input.request, input.encodeBody);
|
|
28
25
|
const headers = yield* Auth.toEffect(input.auth)({
|
|
29
26
|
request: input.request,
|
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-
|
|
3
|
+
"version": "0.0.0-dev-21406",
|
|
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.1",
|
|
37
|
-
"@opencode/http-recorder": "0.0.0-dev-
|
|
37
|
+
"@opencode/http-recorder": "0.0.0-dev-21406",
|
|
38
38
|
"@tsconfig/bun": "1.0.9",
|
|
39
39
|
"@types/bun": "1.4.0",
|
|
40
40
|
"@typescript/native": "npm:typescript@7.0.2",
|
|
@@ -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": "0.0.0-dev-
|
|
47
|
+
"@opencode/schema": "0.0.0-dev-21406",
|
|
48
48
|
"aws4fetch": "1.0.20",
|
|
49
49
|
"effect": "4.0.1",
|
|
50
50
|
"google-auth-library": "10.5.0"
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { OpenResponsesOptions } from "./open-responses-options.js";
|
|
2
|
-
export declare const OpenAIReasoningEfforts: readonly ["none", "minimal", "low", "medium", "high", "xhigh", "max"];
|
|
3
|
-
export type OpenAIReasoningEffort = OpenResponsesOptions.ReasoningEffort;
|
|
4
|
-
export declare const OpenAITextVerbosities: readonly ["low", "medium", "high"];
|
|
5
|
-
export type OpenAITextVerbosity = OpenResponsesOptions.TextVerbosity;
|
|
6
|
-
export declare const OpenAIResponseIncludables: readonly ["file_search_call.results", "web_search_call.results", "web_search_call.action.sources", "message.input_image.image_url", "computer_call_output.output.image_url", "code_interpreter_call.outputs", "reasoning.encrypted_content", "message.output_text.logprobs"];
|
|
7
|
-
export type OpenAIResponseIncludable = OpenResponsesOptions.ResponseIncludable;
|
|
8
|
-
export declare const OpenAIServiceTiers: readonly ["auto", "default", "flex", "priority", "scale", "fast", "ultrafast"];
|
|
9
|
-
export type OpenAIServiceTier = (typeof OpenAIServiceTiers)[number] | (string & {});
|
|
10
|
-
export declare const OpenAIReasoningEffort: import("effect/Schema").declare<OpenResponsesOptions.ReasoningEffort, OpenResponsesOptions.ReasoningEffort>;
|
|
11
|
-
export declare const OpenAITextVerbosity: import("effect/Schema").declare<OpenResponsesOptions.TextVerbosity, OpenResponsesOptions.TextVerbosity>;
|
|
12
|
-
export declare const OpenAIResponseIncludable: import("effect/Schema").declare<OpenResponsesOptions.ResponseIncludable, OpenResponsesOptions.ResponseIncludable>;
|
|
13
|
-
export declare const OpenAIServiceTier: import("effect/Schema").declare<OpenResponsesOptions.ServiceTier, OpenResponsesOptions.ServiceTier>;
|
|
14
|
-
export declare const isReasoningEffort: (effort: unknown) => effort is OpenAIReasoningEffort;
|
|
15
|
-
export declare const resolve: typeof OpenResponsesOptions.resolve;
|
|
16
|
-
export * as OpenAIOptions from "./openai-options.js";
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { OpenResponsesOptions } from "./open-responses-options.js";
|
|
2
|
-
export const OpenAIReasoningEfforts = OpenResponsesOptions.ReasoningEfforts;
|
|
3
|
-
export const OpenAITextVerbosities = OpenResponsesOptions.TextVerbosities;
|
|
4
|
-
// Mirrors OpenAI's `ResponseIncludable` union from the official SDK. Keep this
|
|
5
|
-
// in lockstep with `openai-node/src/resources/responses/responses.ts`.
|
|
6
|
-
export const OpenAIResponseIncludables = OpenResponsesOptions.ResponseIncludables;
|
|
7
|
-
// Mirrors OpenAI's `ServiceTier` union from the official SDK.
|
|
8
|
-
export const OpenAIServiceTiers = [...OpenResponsesOptions.ServiceTiers, "scale", "fast", "ultrafast"];
|
|
9
|
-
export const OpenAIReasoningEffort = OpenResponsesOptions.ReasoningEffort;
|
|
10
|
-
export const OpenAITextVerbosity = OpenResponsesOptions.TextVerbosity;
|
|
11
|
-
export const OpenAIResponseIncludable = OpenResponsesOptions.ResponseIncludableSchema;
|
|
12
|
-
export const OpenAIServiceTier = OpenResponsesOptions.ServiceTierSchema;
|
|
13
|
-
export const isReasoningEffort = (effort) => typeof effort === "string";
|
|
14
|
-
export const resolve = OpenResponsesOptions.resolve;
|
|
15
|
-
export * as OpenAIOptions from "./openai-options.js";
|