@opencode-ai/ai 0.0.0-dev-17681 → 0.0.0-dev-17688
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/README.md +16 -4
- package/dist/cache-policy.js +3 -5
- package/dist/protocols/anthropic-messages.d.ts +3 -6
- package/dist/protocols/anthropic-messages.js +3 -3
- package/dist/protocols/gemini.d.ts +2 -6
- package/dist/protocols/gemini.js +2 -3
- package/dist/protocols/open-responses.js +1 -1
- package/dist/protocols/openai-responses.js +1 -1
- package/dist/protocols/shared.d.ts +8 -14
- package/dist/protocols/shared.js +8 -14
- package/dist/protocols/utils/bedrock-cache.js +3 -4
- package/dist/protocols/utils/cache.js +3 -6
- package/dist/protocols/utils/open-responses-options.js +1 -1
- package/dist/providers/amazon-bedrock-mantle.d.ts +10 -10
- package/dist/providers/amazon-bedrock.d.ts +3 -9
- package/dist/providers/anthropic-compatible.d.ts +2 -2
- package/dist/providers/anthropic.d.ts +3 -3
- package/dist/providers/azure.d.ts +7 -7
- package/dist/providers/cloudflare.d.ts +2 -2
- package/dist/providers/google-vertex-chat.d.ts +2 -2
- package/dist/providers/google-vertex-messages.d.ts +2 -2
- package/dist/providers/google-vertex-responses.d.ts +2 -2
- package/dist/providers/google-vertex-responses.js +1 -1
- package/dist/providers/google-vertex.d.ts +4 -6
- package/dist/providers/google-vertex.js +1 -1
- package/dist/providers/google.d.ts +3 -3
- package/dist/providers/open-responses-options.d.ts +1 -4
- package/dist/providers/openai-compatible-responses.d.ts +2 -2
- package/dist/providers/openai-compatible.d.ts +9 -9
- package/dist/providers/openai-options.d.ts +2 -4
- package/dist/providers/openai-options.js +3 -3
- package/dist/providers/openai.d.ts +11 -11
- package/dist/providers/openrouter.d.ts +5 -7
- package/dist/providers/openrouter.js +1 -1
- package/dist/providers/xai.d.ts +13 -15
- package/dist/providers/xai.js +1 -1
- package/dist/route/client.d.ts +1 -3
- package/dist/route/framing.d.ts +2 -2
- package/dist/route/protocol.d.ts +1 -2
- package/dist/route/protocol.js +1 -2
- package/dist/schema/messages.d.ts +3 -7
- package/dist/schema/options.d.ts +4 -8
- package/dist/schema/options.js +4 -17
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -237,11 +237,11 @@ Prompt caching is **on by default**. Every `LLMRequest` resolves to `cache: "aut
|
|
|
237
237
|
|
|
238
238
|
### Auto placement
|
|
239
239
|
|
|
240
|
-
`"auto"` places up to four breakpoints — the last tool definition, the first system part, the last system part when distinct, and the final message boundary. These expose successively larger reusable prefixes for tools, the base agent, project instructions, and the active conversation. The rolling final-message boundary
|
|
240
|
+
`"auto"` places up to four breakpoints — the last tool definition, the first system part, the last system part when distinct, and the final message boundary. These expose successively larger reusable prefixes for tools, the base agent, project instructions, and the active conversation. The rolling final-message boundary advances on every request so recent conversation prefixes remain reusable during tool loops.
|
|
241
241
|
|
|
242
242
|
Tools precede every system and conversation block in the provider prefix, so tool definitions must remain byte-stable and deterministically ordered for downstream breakpoints to remain reusable.
|
|
243
243
|
|
|
244
|
-
|
|
244
|
+
Requests below a provider's minimum cacheable size simply do not produce a reusable cache entry.
|
|
245
245
|
|
|
246
246
|
### Opting out
|
|
247
247
|
|
|
@@ -285,6 +285,7 @@ LLM.request({
|
|
|
285
285
|
| ----------------------- | ------------------------------------------------------------------------- |
|
|
286
286
|
| Anthropic Messages | emits up to 4 `cache_control` markers (4-breakpoint cap enforced) |
|
|
287
287
|
| Bedrock Converse | emits up to 4 `cachePoint` blocks (4-breakpoint cap enforced) |
|
|
288
|
+
| OpenRouter | emits up to 4 `cache_control` markers |
|
|
288
289
|
| OpenAI Chat / Responses | no-op (implicit caching above 1024 tokens) |
|
|
289
290
|
| Gemini | no-op (implicit caching on 2.5+; explicit `CachedContent` is out-of-band) |
|
|
290
291
|
|
|
@@ -371,11 +372,23 @@ Request options in order of stability:
|
|
|
371
372
|
|
|
372
373
|
1. **`generation`** — portable knobs (`maxTokens`, `temperature`, `topP`, `topK`, penalties, seed, stop).
|
|
373
374
|
2. **`promptCacheKey`** — stable cache affinity lowered by every protocol that supports it.
|
|
374
|
-
3. **`providerOptions: {
|
|
375
|
+
3. **`providerOptions: { ... }`** — flat options inferred from the selected model (OpenAI `store`, Anthropic `thinking`, Gemini `thinkingConfig`, OpenRouter routing).
|
|
375
376
|
4. **`http: { body, headers, query }`** — last-resort serializable overlays merged into the final HTTP request. Reach for this only when a stable typed path doesn't yet exist.
|
|
376
377
|
|
|
377
378
|
Route/provider defaults are overridden by request-level values for each axis.
|
|
378
379
|
|
|
380
|
+
The selected model supplies the provider-specific option type, so per-request overrides stay flat while the canonical runtime request remains provider-neutral:
|
|
381
|
+
|
|
382
|
+
```ts
|
|
383
|
+
LLM.request({
|
|
384
|
+
model,
|
|
385
|
+
prompt,
|
|
386
|
+
providerOptions: {
|
|
387
|
+
reasoningEffort: "low",
|
|
388
|
+
},
|
|
389
|
+
})
|
|
390
|
+
```
|
|
391
|
+
|
|
379
392
|
## Routes
|
|
380
393
|
|
|
381
394
|
Adding a new model or deployment is usually 5-15 lines using `Route.make({ protocol, endpoint, auth, framing, ... })`. The route owns endpoint/auth/framing and the protocol owns body construction plus stream parsing. Transports are reusable IO templates that receive route endpoint/auth at compile time. Capability/catalog metadata lives outside this low-level package; unsupported request shapes fail during protocol lowering. See `AGENTS.md` for the architectural detail.
|
|
@@ -387,6 +400,5 @@ This package is built on Effect. Public methods return `Effect` or `Stream`; pro
|
|
|
387
400
|
## See also
|
|
388
401
|
|
|
389
402
|
- `AGENTS.md` — architecture, route construction, contributor guide
|
|
390
|
-
- `STATUS.md` — native provider parity status and AI SDK migration gaps
|
|
391
403
|
- `example/tutorial.ts` — runnable end-to-end walkthrough
|
|
392
404
|
- `test/provider/*.test.ts` — fixture-first protocol tests; `*.recorded.test.ts` files cover live cassettes
|
package/dist/cache-policy.js
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
// The default `"auto"` shape places breakpoints at the last tool definition,
|
|
6
6
|
// the first and last distinct system parts, and the conversation tail. This
|
|
7
7
|
// exposes reusable tool, base-agent, project, and session prefixes while
|
|
8
|
-
// advancing the tail after each tool result keeps
|
|
9
|
-
//
|
|
8
|
+
// advancing the tail after each tool result keeps recent conversation prefixes
|
|
9
|
+
// reusable during long agent runs.
|
|
10
10
|
//
|
|
11
11
|
// Manual `cache: CacheHint` placements on individual parts are preserved and
|
|
12
12
|
// count against the four-breakpoint budget; auto only fills remaining slots.
|
|
@@ -20,9 +20,7 @@ const AUTO = {
|
|
|
20
20
|
const NONE = {};
|
|
21
21
|
const BREAKPOINT_CAP = 4;
|
|
22
22
|
// Resolution rules:
|
|
23
|
-
// - undefined → "auto" — caching is on by default.
|
|
24
|
-
// Anthropic 5m-cache write is 1.25x base, read is 0.1x,
|
|
25
|
-
// so a single reuse within 5 minutes already wins.
|
|
23
|
+
// - undefined → "auto" — caching is on by default.
|
|
26
24
|
// - "auto" → tools + first/last system + final message boundary.
|
|
27
25
|
// - "none" → no auto placement; manual `CacheHint`s still flow.
|
|
28
26
|
// - object form → exactly what the caller asked for.
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
2
|
import { Route } from "../route/client.js";
|
|
3
3
|
import { Protocol } from "../route/protocol.js";
|
|
4
|
-
import { type ProviderOptions } from "../schema/index.js";
|
|
5
4
|
import { Lifecycle } from "./utils/lifecycle.js";
|
|
6
5
|
import { ToolStream } from "./utils/tool-stream.js";
|
|
7
6
|
export declare const DEFAULT_BASE_URL = "https://api.anthropic.com/v1";
|
|
@@ -25,9 +24,7 @@ export interface OptionsInput {
|
|
|
25
24
|
readonly thinking?: ThinkingInput;
|
|
26
25
|
readonly effort?: string;
|
|
27
26
|
}
|
|
28
|
-
export type ProviderOptionsInput =
|
|
29
|
-
readonly anthropic?: OptionsInput;
|
|
30
|
-
};
|
|
27
|
+
export type ProviderOptionsInput = OptionsInput;
|
|
31
28
|
export declare const AnthropicMessagesBody: Schema.Struct<{
|
|
32
29
|
model: Schema.String;
|
|
33
30
|
system: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
@@ -207,8 +204,8 @@ export declare const AnthropicMessagesBody: Schema.Struct<{
|
|
|
207
204
|
export type AnthropicMessagesBody = Schema.Schema.Type<typeof AnthropicMessagesBody>;
|
|
208
205
|
/**
|
|
209
206
|
* The Anthropic Messages protocol — request body construction, body schema,
|
|
210
|
-
* and the streaming-event state machine
|
|
211
|
-
*
|
|
207
|
+
* and the streaming-event state machine shared by Anthropic-compatible and
|
|
208
|
+
* Vertex-hosted Messages routes.
|
|
212
209
|
*/
|
|
213
210
|
export declare const protocol: Protocol<{
|
|
214
211
|
readonly max_tokens: number;
|
|
@@ -468,7 +468,7 @@ const lowerMessages = Effect.fn("AnthropicMessages.lowerMessages")(function* (re
|
|
|
468
468
|
return messages;
|
|
469
469
|
});
|
|
470
470
|
const resolveOptions = Effect.fn("AnthropicMessages.resolveOptions")(function* (request) {
|
|
471
|
-
const input = request.providerOptions
|
|
471
|
+
const input = request.providerOptions;
|
|
472
472
|
return {
|
|
473
473
|
thinking: yield* resolveThinking(input?.thinking),
|
|
474
474
|
effort: typeof input?.effort === "string" ? input.effort : undefined,
|
|
@@ -844,8 +844,8 @@ const step = (state, event) => {
|
|
|
844
844
|
// =============================================================================
|
|
845
845
|
/**
|
|
846
846
|
* The Anthropic Messages protocol — request body construction, body schema,
|
|
847
|
-
* and the streaming-event state machine
|
|
848
|
-
*
|
|
847
|
+
* and the streaming-event state machine shared by Anthropic-compatible and
|
|
848
|
+
* Vertex-hosted Messages routes.
|
|
849
849
|
*/
|
|
850
850
|
export const protocol = Protocol.make({
|
|
851
851
|
id: ADAPTER,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
2
|
import { Route } from "../route/client.js";
|
|
3
3
|
import { Protocol } from "../route/protocol.js";
|
|
4
|
-
import { type ProviderOptions } from "../schema/index.js";
|
|
5
4
|
import { Lifecycle } from "./utils/lifecycle.js";
|
|
6
5
|
export declare const DEFAULT_BASE_URL = "https://generativelanguage.googleapis.com/v1beta";
|
|
7
6
|
export interface OptionsInput {
|
|
@@ -18,9 +17,7 @@ export interface OptionsInput {
|
|
|
18
17
|
readonly thinkingLevel?: "minimal" | "low" | "medium" | "high" | (string & {});
|
|
19
18
|
};
|
|
20
19
|
}
|
|
21
|
-
export type ProviderOptionsInput =
|
|
22
|
-
readonly gemini?: OptionsInput;
|
|
23
|
-
};
|
|
20
|
+
export type ProviderOptionsInput = OptionsInput;
|
|
24
21
|
declare const GeminiBody: Schema.Struct<{
|
|
25
22
|
cachedContent: Schema.optional<Schema.String>;
|
|
26
23
|
contents: Schema.$Array<Schema.Struct<{
|
|
@@ -98,8 +95,7 @@ declare const GeminiBody: Schema.Struct<{
|
|
|
98
95
|
export type GeminiBody = Schema.Schema.Type<typeof GeminiBody>;
|
|
99
96
|
/**
|
|
100
97
|
* The Gemini protocol — request body construction, body schema, and the
|
|
101
|
-
* streaming-event state machine
|
|
102
|
-
* registered) Vertex Gemini.
|
|
98
|
+
* streaming-event state machine shared by Google AI Studio and Vertex Gemini.
|
|
103
99
|
*/
|
|
104
100
|
export declare const protocol: Protocol<{
|
|
105
101
|
readonly contents: readonly {
|
package/dist/protocols/gemini.js
CHANGED
|
@@ -293,7 +293,7 @@ const lowerMessages = Effect.fn("Gemini.lowerMessages")(function* (request) {
|
|
|
293
293
|
return contents;
|
|
294
294
|
});
|
|
295
295
|
const resolveOptions = (request) => {
|
|
296
|
-
const input = request.providerOptions
|
|
296
|
+
const input = request.providerOptions;
|
|
297
297
|
const value = input?.thinkingConfig;
|
|
298
298
|
const thinkingConfig = {
|
|
299
299
|
thinkingBudget: ProviderShared.isRecord(value) && typeof value.thinkingBudget === "number" ? value.thinkingBudget : undefined,
|
|
@@ -491,8 +491,7 @@ const step = (state, event) => {
|
|
|
491
491
|
// =============================================================================
|
|
492
492
|
/**
|
|
493
493
|
* The Gemini protocol — request body construction, body schema, and the
|
|
494
|
-
* streaming-event state machine
|
|
495
|
-
* registered) Vertex Gemini.
|
|
494
|
+
* streaming-event state machine shared by Google AI Studio and Vertex Gemini.
|
|
496
495
|
*/
|
|
497
496
|
export const protocol = Protocol.make({
|
|
498
497
|
id: ADAPTER,
|
|
@@ -214,7 +214,7 @@ export const lowerTool = Effect.fn("OpenResponses.lowerTool")(function* (protoco
|
|
|
214
214
|
name: tool.name,
|
|
215
215
|
description: tool.description,
|
|
216
216
|
parameters: ToolSchemaProjection.responses(inputSchema),
|
|
217
|
-
//
|
|
217
|
+
// The common tool definition does not currently express Responses strict-schema policy.
|
|
218
218
|
strict: false,
|
|
219
219
|
};
|
|
220
220
|
});
|
|
@@ -203,6 +203,6 @@ export const route = Route.make({
|
|
|
203
203
|
endpoint,
|
|
204
204
|
auth,
|
|
205
205
|
transport,
|
|
206
|
-
defaults: { providerOptions: {
|
|
206
|
+
defaults: { providerOptions: { store: false } },
|
|
207
207
|
});
|
|
208
208
|
export * as OpenAIResponses from "./openai-responses.js";
|
|
@@ -26,12 +26,10 @@ export interface ToolAccumulator {
|
|
|
26
26
|
* when at least one is defined. Returns `undefined` when neither input nor
|
|
27
27
|
* output is known so routes don't publish a misleading `0`.
|
|
28
28
|
*
|
|
29
|
-
* Under the
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* Anthropic-style providers (which don't surface a total) still get a
|
|
34
|
-
* sensible aggregate on the input + output axes.
|
|
29
|
+
* Under the inclusive `AI.Usage` contract, `inputTokens` includes cached input
|
|
30
|
+
* and `outputTokens` includes reasoning. Protocol mappers normalize those
|
|
31
|
+
* inclusive values before calling this helper. The provider-supplied total is
|
|
32
|
+
* the source of truth when present; otherwise their sum is the canonical total.
|
|
35
33
|
*/
|
|
36
34
|
export declare const totalTokens: (inputTokens: number | undefined, outputTokens: number | undefined, total: number | undefined) => number | undefined;
|
|
37
35
|
/**
|
|
@@ -43,7 +41,7 @@ export declare const totalTokens: (inputTokens: number | undefined, outputTokens
|
|
|
43
41
|
*
|
|
44
42
|
* If `total` is `undefined`, returns `undefined` (we don't fabricate
|
|
45
43
|
* counts). If `subtrahend` is `undefined`, returns `total` unchanged. The
|
|
46
|
-
* provider-native breakdown stays available on `Usage.
|
|
44
|
+
* provider-native breakdown stays available on `Usage.providerMetadata` for debugging.
|
|
47
45
|
*/
|
|
48
46
|
export declare const subtractTokens: (total: number | undefined, subtrahend: number | undefined) => number | undefined;
|
|
49
47
|
/**
|
|
@@ -117,19 +115,15 @@ export declare const toolResultText: (part: ToolResultPart) => string;
|
|
|
117
115
|
export declare const errorText: (error: unknown) => string;
|
|
118
116
|
/**
|
|
119
117
|
* `framing` step for Server-Sent Events. Decodes UTF-8, runs the SSE channel
|
|
120
|
-
* decoder, and drops empty / `[DONE]` keep-alive events so the
|
|
121
|
-
*
|
|
118
|
+
* decoder, and drops empty / `[DONE]` keep-alive events so the protocol event
|
|
119
|
+
* schema sees one JSON string per element. The SSE channel emits a
|
|
122
120
|
* `Retry` control event on its error channel; we drop it here (we don't
|
|
123
121
|
* implement client-driven retries). Decoder failures become provider output
|
|
124
122
|
* errors so the public error channel stays `AIError`.
|
|
125
123
|
*/
|
|
126
124
|
export declare const sseFraming: (bytes: Stream.Stream<Uint8Array, AIError>) => Stream.Stream<string, AIError>;
|
|
127
125
|
/**
|
|
128
|
-
* Canonical invalid-request constructor
|
|
129
|
-
* (message) => invalidRequest(message)` aliases out of every
|
|
130
|
-
* route so the error constructor lives in one place. If we ever extend
|
|
131
|
-
* `InvalidRequestReason` with route context or trace metadata, the change
|
|
132
|
-
* lands here.
|
|
126
|
+
* Canonical invalid-request constructor shared by protocol lowering.
|
|
133
127
|
*/
|
|
134
128
|
export declare const invalidRequest: (message: string) => AIError;
|
|
135
129
|
export declare const matchToolChoice: <Auto, None, Required, Tool>(route: string, toolChoice: NonNullable<LLMRequest["toolChoice"]>, cases: {
|
package/dist/protocols/shared.js
CHANGED
|
@@ -19,12 +19,10 @@ export const optionalNull = (schema) => Schema.optional(Schema.NullOr(schema));
|
|
|
19
19
|
* when at least one is defined. Returns `undefined` when neither input nor
|
|
20
20
|
* output is known so routes don't publish a misleading `0`.
|
|
21
21
|
*
|
|
22
|
-
* Under the
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* Anthropic-style providers (which don't surface a total) still get a
|
|
27
|
-
* sensible aggregate on the input + output axes.
|
|
22
|
+
* Under the inclusive `AI.Usage` contract, `inputTokens` includes cached input
|
|
23
|
+
* and `outputTokens` includes reasoning. Protocol mappers normalize those
|
|
24
|
+
* inclusive values before calling this helper. The provider-supplied total is
|
|
25
|
+
* the source of truth when present; otherwise their sum is the canonical total.
|
|
28
26
|
*/
|
|
29
27
|
export const totalTokens = (inputTokens, outputTokens, total) => {
|
|
30
28
|
if (total !== undefined)
|
|
@@ -42,7 +40,7 @@ export const totalTokens = (inputTokens, outputTokens, total) => {
|
|
|
42
40
|
*
|
|
43
41
|
* If `total` is `undefined`, returns `undefined` (we don't fabricate
|
|
44
42
|
* counts). If `subtrahend` is `undefined`, returns `total` unchanged. The
|
|
45
|
-
* provider-native breakdown stays available on `Usage.
|
|
43
|
+
* provider-native breakdown stays available on `Usage.providerMetadata` for debugging.
|
|
46
44
|
*/
|
|
47
45
|
export const subtractTokens = (total, subtrahend) => {
|
|
48
46
|
if (total === undefined)
|
|
@@ -151,19 +149,15 @@ export const errorText = (error) => {
|
|
|
151
149
|
};
|
|
152
150
|
/**
|
|
153
151
|
* `framing` step for Server-Sent Events. Decodes UTF-8, runs the SSE channel
|
|
154
|
-
* decoder, and drops empty / `[DONE]` keep-alive events so the
|
|
155
|
-
*
|
|
152
|
+
* decoder, and drops empty / `[DONE]` keep-alive events so the protocol event
|
|
153
|
+
* schema sees one JSON string per element. The SSE channel emits a
|
|
156
154
|
* `Retry` control event on its error channel; we drop it here (we don't
|
|
157
155
|
* implement client-driven retries). Decoder failures become provider output
|
|
158
156
|
* errors so the public error channel stays `AIError`.
|
|
159
157
|
*/
|
|
160
158
|
export const sseFraming = (bytes) => bytes.pipe(Stream.decodeText(), Stream.pipeThroughChannel(Sse.decode()), Stream.catchTag("Retry", () => Stream.empty), Stream.catchTag("SseError", (error) => Stream.fail(eventError("sse", error.message))), Stream.filter((event) => event.data.length > 0 && event.data !== "[DONE]"), Stream.map((event) => event.data));
|
|
161
159
|
/**
|
|
162
|
-
* Canonical invalid-request constructor
|
|
163
|
-
* (message) => invalidRequest(message)` aliases out of every
|
|
164
|
-
* route so the error constructor lives in one place. If we ever extend
|
|
165
|
-
* `InvalidRequestReason` with route context or trace metadata, the change
|
|
166
|
-
* lands here.
|
|
160
|
+
* Canonical invalid-request constructor shared by protocol lowering.
|
|
167
161
|
*/
|
|
168
162
|
export const invalidRequest = (message) => new AIError({
|
|
169
163
|
module: "ProviderShared",
|
|
@@ -2,16 +2,15 @@ import { Schema } from "effect";
|
|
|
2
2
|
import { newBreakpoints, ttlBucket } from "./cache.js";
|
|
3
3
|
// Bedrock cache markers are positional: emit a `cachePoint` block immediately
|
|
4
4
|
// after the content the caller wants treated as a cacheable prefix. Bedrock
|
|
5
|
-
// accepts optional `ttl: "5m" | "1h"` on cachePoint
|
|
5
|
+
// accepts optional `ttl: "5m" | "1h"` on cachePoint.
|
|
6
6
|
export const CachePointBlock = Schema.Struct({
|
|
7
7
|
cachePoint: Schema.Struct({
|
|
8
8
|
type: Schema.tag("default"),
|
|
9
9
|
ttl: Schema.optional(Schema.Literals(["5m", "1h"])),
|
|
10
10
|
}),
|
|
11
11
|
});
|
|
12
|
-
//
|
|
13
|
-
//
|
|
14
|
-
// budget is respected across `system`, `messages`, and `tools`.
|
|
12
|
+
// Callers pass a shared counter through every `block()` call site so the
|
|
13
|
+
// four-breakpoint budget is respected across `system`, `messages`, and `tools`.
|
|
15
14
|
export const BEDROCK_BREAKPOINT_CAP = 4;
|
|
16
15
|
export const breakpoints = () => newBreakpoints(BEDROCK_BREAKPOINT_CAP);
|
|
17
16
|
const DEFAULT_5M = { cachePoint: { type: "default" } };
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
// Shared
|
|
2
|
-
// both enforce a 4-breakpoint cap per request and accept the same `5m`/`1h`
|
|
3
|
-
// TTL buckets, so the counter and TTL mapping live here.
|
|
1
|
+
// Shared counter and TTL mapping for provider cache-marker lowering.
|
|
4
2
|
export const newBreakpoints = (cap) => ({ remaining: cap, dropped: 0 });
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
// an hour as 5m.
|
|
3
|
+
// Requests of at least one hour use the explicit `"1h"` bucket; shorter
|
|
4
|
+
// requests omit the wire TTL and use the provider default.
|
|
8
5
|
export const ttlBucket = (ttlSeconds) => ttlSeconds !== undefined && ttlSeconds >= 3600 ? "1h" : undefined;
|
|
@@ -38,7 +38,7 @@ export const Options = Schema.Struct({
|
|
|
38
38
|
});
|
|
39
39
|
const decodeOptions = Schema.decodeUnknownOption(Options);
|
|
40
40
|
export const resolve = (request) => {
|
|
41
|
-
const input = Option.getOrUndefined(decodeOptions(request.providerOptions
|
|
41
|
+
const input = Option.getOrUndefined(decodeOptions(request.providerOptions));
|
|
42
42
|
if (!input)
|
|
43
43
|
return {};
|
|
44
44
|
return {
|
|
@@ -237,24 +237,24 @@ export declare const routes: (RouteDef<{
|
|
|
237
237
|
}, import("../protocols/open-responses-channel.js").Prepared>)[];
|
|
238
238
|
export declare const configure: (input?: Config) => {
|
|
239
239
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
240
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
241
|
-
chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
242
|
-
responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
240
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
241
|
+
chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
242
|
+
responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
243
243
|
configure: (input?: Config) => /*elided*/ any;
|
|
244
244
|
};
|
|
245
245
|
export declare const provider: {
|
|
246
246
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
247
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
248
|
-
chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
249
|
-
responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
247
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
248
|
+
chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
249
|
+
responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
250
250
|
configure: (input?: Config) => {
|
|
251
251
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
252
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
253
|
-
chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
254
|
-
responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
252
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
253
|
+
chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
254
|
+
responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
255
255
|
configure: /*elided*/ any;
|
|
256
256
|
};
|
|
257
257
|
};
|
|
258
258
|
export declare const chatModel: ProviderPackage.Definition<Settings, OpenAIProviderOptionsInput>["model"];
|
|
259
259
|
export declare const responsesModel: ProviderPackage.Definition<Settings, OpenAIProviderOptionsInput>["model"];
|
|
260
|
-
export declare const model: (modelID: string, settings: Settings) => import("../schema/options.js").LanguageModel<
|
|
260
|
+
export declare const model: (modelID: string, settings: Settings) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
@@ -146,25 +146,19 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
146
146
|
export declare const configure: (input?: Config) => {
|
|
147
147
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
148
148
|
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<{
|
|
149
|
-
readonly [x: string]:
|
|
150
|
-
readonly [x: string]: unknown;
|
|
151
|
-
};
|
|
149
|
+
readonly [x: string]: unknown;
|
|
152
150
|
}>;
|
|
153
151
|
configure: (input?: Config) => /*elided*/ any;
|
|
154
152
|
};
|
|
155
153
|
export declare const provider: {
|
|
156
154
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
157
155
|
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<{
|
|
158
|
-
readonly [x: string]:
|
|
159
|
-
readonly [x: string]: unknown;
|
|
160
|
-
};
|
|
156
|
+
readonly [x: string]: unknown;
|
|
161
157
|
}>;
|
|
162
158
|
configure: (input?: Config) => {
|
|
163
159
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
164
160
|
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<{
|
|
165
|
-
readonly [x: string]:
|
|
166
|
-
readonly [x: string]: unknown;
|
|
167
|
-
};
|
|
161
|
+
readonly [x: string]: unknown;
|
|
168
162
|
}>;
|
|
169
163
|
configure: /*elided*/ any;
|
|
170
164
|
};
|
|
@@ -203,14 +203,14 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
203
203
|
}, import("../route/transport/http.js").HttpPrepared<string>>[];
|
|
204
204
|
export declare const configure: (input: Config) => {
|
|
205
205
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
206
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<AnthropicMessages.
|
|
206
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<AnthropicMessages.OptionsInput>;
|
|
207
207
|
configure: (input: Config) => /*elided*/ any;
|
|
208
208
|
};
|
|
209
209
|
export declare const provider: {
|
|
210
210
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
211
211
|
configure: (input: Config) => {
|
|
212
212
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
213
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<AnthropicMessages.
|
|
213
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<AnthropicMessages.OptionsInput>;
|
|
214
214
|
configure: /*elided*/ any;
|
|
215
215
|
};
|
|
216
216
|
};
|
|
@@ -201,15 +201,15 @@ export type Settings = ProviderPackage.Settings & ({
|
|
|
201
201
|
};
|
|
202
202
|
export declare const configure: (input?: Config) => {
|
|
203
203
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
204
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<AnthropicMessages.
|
|
204
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<AnthropicMessages.OptionsInput>;
|
|
205
205
|
configure: (input?: Config) => /*elided*/ any;
|
|
206
206
|
};
|
|
207
207
|
export declare const provider: {
|
|
208
208
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
209
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<AnthropicMessages.
|
|
209
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<AnthropicMessages.OptionsInput>;
|
|
210
210
|
configure: (input?: Config) => {
|
|
211
211
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
212
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<AnthropicMessages.
|
|
212
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<AnthropicMessages.OptionsInput>;
|
|
213
213
|
configure: /*elided*/ any;
|
|
214
214
|
};
|
|
215
215
|
};
|
|
@@ -240,22 +240,22 @@ export declare const routes: (RouteDef<{
|
|
|
240
240
|
}, import("../protocols/open-responses-channel.js").Prepared>)[];
|
|
241
241
|
export declare const configure: (input: Config) => {
|
|
242
242
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
243
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
244
|
-
responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
245
|
-
chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
243
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
244
|
+
responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
245
|
+
chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
246
246
|
configure: (input: Config) => /*elided*/ any;
|
|
247
247
|
};
|
|
248
248
|
export declare const provider: {
|
|
249
249
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
250
250
|
configure: (input: Config) => {
|
|
251
251
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
252
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
253
|
-
responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
254
|
-
chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
252
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
253
|
+
responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
254
|
+
chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
255
255
|
configure: /*elided*/ any;
|
|
256
256
|
};
|
|
257
257
|
};
|
|
258
258
|
export declare const responsesModel: ProviderPackage.Definition<Settings, OpenAIProviderOptionsInput>["model"];
|
|
259
259
|
export declare const chatModel: ProviderPackage.Definition<Settings, OpenAIProviderOptionsInput>["model"];
|
|
260
|
-
export declare const model: (modelID: string, settings: Settings) => import("../schema/options.js").LanguageModel<
|
|
260
|
+
export declare const model: (modelID: string, settings: Settings) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
261
261
|
export {};
|
|
@@ -323,7 +323,7 @@ export declare const CloudflareAIGateway: {
|
|
|
323
323
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
324
324
|
configure: (options: AIGatewayOptions) => {
|
|
325
325
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
326
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
326
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
327
327
|
configure: /*elided*/ any;
|
|
328
328
|
};
|
|
329
329
|
};
|
|
@@ -331,7 +331,7 @@ export declare const CloudflareWorkersAI: {
|
|
|
331
331
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
332
332
|
configure: (options: WorkersAIOptions) => {
|
|
333
333
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
334
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
334
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
335
335
|
configure: /*elided*/ any;
|
|
336
336
|
};
|
|
337
337
|
};
|
|
@@ -117,14 +117,14 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
117
117
|
}, import("../route/transport/http.js").HttpPrepared<string>>[];
|
|
118
118
|
export declare const configure: (input?: Config) => {
|
|
119
119
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
120
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
120
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
121
121
|
configure: (input?: Config) => /*elided*/ any;
|
|
122
122
|
};
|
|
123
123
|
export declare const provider: {
|
|
124
124
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
125
125
|
configure: (input?: Config) => {
|
|
126
126
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
127
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
127
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
128
128
|
configure: /*elided*/ any;
|
|
129
129
|
};
|
|
130
130
|
};
|
|
@@ -201,14 +201,14 @@ export declare const routes: Route<{
|
|
|
201
201
|
}, import("../route/transport/http.js").HttpPrepared<string>>[];
|
|
202
202
|
export declare const configure: (input?: Config) => {
|
|
203
203
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
204
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<AnthropicMessages.
|
|
204
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<AnthropicMessages.OptionsInput>;
|
|
205
205
|
configure: (input?: Config) => /*elided*/ any;
|
|
206
206
|
};
|
|
207
207
|
export declare const provider: {
|
|
208
208
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
209
209
|
configure: (input?: Config) => {
|
|
210
210
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
211
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<AnthropicMessages.
|
|
211
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<AnthropicMessages.OptionsInput>;
|
|
212
212
|
configure: /*elided*/ any;
|
|
213
213
|
};
|
|
214
214
|
};
|
|
@@ -121,14 +121,14 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
121
121
|
}, import("../route/transport/http.js").HttpPrepared<string>>[];
|
|
122
122
|
export declare const configure: (input?: Config) => {
|
|
123
123
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
124
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
124
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
125
125
|
configure: (input?: Config) => /*elided*/ any;
|
|
126
126
|
};
|
|
127
127
|
export declare const provider: {
|
|
128
128
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
129
129
|
configure: (input?: Config) => {
|
|
130
130
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
131
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
131
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
132
132
|
configure: /*elided*/ any;
|
|
133
133
|
};
|
|
134
134
|
};
|
|
@@ -5,7 +5,7 @@ export const id = ProviderID.make("google-vertex");
|
|
|
5
5
|
const route = OpenAICompatibleResponses.route.with({
|
|
6
6
|
id: "google-vertex-responses",
|
|
7
7
|
provider: id,
|
|
8
|
-
providerOptions: {
|
|
8
|
+
providerOptions: { store: false },
|
|
9
9
|
});
|
|
10
10
|
export const routes = [route];
|
|
11
11
|
const configuredRoute = (input) => {
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import type { ProviderPackage } from "../provider-package.js";
|
|
2
2
|
import { Gemini } from "../protocols/gemini.js";
|
|
3
3
|
import { Route, type RouteDefaultsInput } from "../route/client.js";
|
|
4
|
-
import { type ModelID
|
|
4
|
+
import { type ModelID } from "../schema/index.js";
|
|
5
5
|
import { GoogleVertexShared } from "./google-vertex-shared.js";
|
|
6
6
|
export interface GeminiOptionsInput extends Gemini.OptionsInput {
|
|
7
7
|
readonly labels?: Readonly<Record<string, string>>;
|
|
8
8
|
}
|
|
9
|
-
export type GeminiProviderOptionsInput =
|
|
10
|
-
readonly gemini?: GeminiOptionsInput;
|
|
11
|
-
};
|
|
9
|
+
export type GeminiProviderOptionsInput = GeminiOptionsInput;
|
|
12
10
|
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
13
11
|
export type Config = RouteDefaultsInput & GoogleVertexShared.ApiKeyOptions & {
|
|
14
12
|
readonly baseURL?: string;
|
|
@@ -108,14 +106,14 @@ export declare const routes: Route<{
|
|
|
108
106
|
}, import("../route/transport/http.js").HttpPrepared<string>>[];
|
|
109
107
|
export declare const configure: (input?: Config) => {
|
|
110
108
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
111
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
109
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<GeminiOptionsInput>;
|
|
112
110
|
configure: (input?: Config) => /*elided*/ any;
|
|
113
111
|
};
|
|
114
112
|
export declare const provider: {
|
|
115
113
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
116
114
|
configure: (input?: Config) => {
|
|
117
115
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
118
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
116
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<GeminiOptionsInput>;
|
|
119
117
|
configure: /*elided*/ any;
|
|
120
118
|
};
|
|
121
119
|
};
|
|
@@ -10,7 +10,7 @@ import { GoogleVertexShared } from "./google-vertex-shared.js";
|
|
|
10
10
|
export const id = ProviderID.make("google-vertex");
|
|
11
11
|
const fromRequest = Effect.fn("GoogleVertex.fromRequest")(function* (request) {
|
|
12
12
|
const body = yield* Gemini.protocol.body.from(request);
|
|
13
|
-
const value = request.providerOptions?.
|
|
13
|
+
const value = request.providerOptions?.labels;
|
|
14
14
|
const labels = ProviderShared.isRecord(value)
|
|
15
15
|
? Object.fromEntries(Object.entries(value).filter((entry) => typeof entry[1] === "string"))
|
|
16
16
|
: undefined;
|
|
@@ -96,17 +96,17 @@ export interface Settings extends ProviderPackage.Settings {
|
|
|
96
96
|
}
|
|
97
97
|
export declare const configure: (input?: Config) => {
|
|
98
98
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
99
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<Gemini.
|
|
99
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<Gemini.OptionsInput>;
|
|
100
100
|
image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/google-images.js").GoogleImageOptions>;
|
|
101
101
|
configure: (input?: Config) => /*elided*/ any;
|
|
102
102
|
};
|
|
103
103
|
export declare const provider: {
|
|
104
104
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
105
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<Gemini.
|
|
105
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<Gemini.OptionsInput>;
|
|
106
106
|
image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/google-images.js").GoogleImageOptions>;
|
|
107
107
|
configure: (input?: Config) => {
|
|
108
108
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
109
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<Gemini.
|
|
109
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<Gemini.OptionsInput>;
|
|
110
110
|
image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/google-images.js").GoogleImageOptions>;
|
|
111
111
|
configure: /*elided*/ any;
|
|
112
112
|
};
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import type { Options } from "../protocols/utils/open-responses-options.js";
|
|
2
|
-
import type { ProviderOptions } from "../schema/index.js";
|
|
3
2
|
export type OpenResponsesOptionsInput = Options & {
|
|
4
3
|
readonly [key: string]: unknown;
|
|
5
4
|
};
|
|
6
|
-
export type OpenResponsesProviderOptionsInput =
|
|
7
|
-
readonly openresponses?: OpenResponsesOptionsInput;
|
|
8
|
-
};
|
|
5
|
+
export type OpenResponsesProviderOptionsInput = OpenResponsesOptionsInput;
|
|
9
6
|
export * as OpenResponsesProviderOptions from "./open-responses-options.js";
|
|
@@ -119,14 +119,14 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
119
119
|
}, import("../route/transport/http.js").HttpPrepared<string>>[];
|
|
120
120
|
export declare const configure: (input: Config) => {
|
|
121
121
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
122
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
122
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
123
123
|
configure: (input: Config) => /*elided*/ any;
|
|
124
124
|
};
|
|
125
125
|
export declare const provider: {
|
|
126
126
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
127
127
|
configure: (input: Config) => {
|
|
128
128
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
129
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
129
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
130
130
|
configure: /*elided*/ any;
|
|
131
131
|
};
|
|
132
132
|
};
|
|
@@ -118,51 +118,51 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
118
118
|
}, import("../route/transport/http.js").HttpPrepared<string>>[];
|
|
119
119
|
export declare const configure: (input: GenericModelOptions) => {
|
|
120
120
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
121
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
121
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
122
122
|
configure: (input: GenericModelOptions) => /*elided*/ any;
|
|
123
123
|
};
|
|
124
124
|
export declare const provider: {
|
|
125
125
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
126
126
|
configure: (input: GenericModelOptions) => {
|
|
127
127
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
128
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
128
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
129
129
|
configure: /*elided*/ any;
|
|
130
130
|
};
|
|
131
131
|
};
|
|
132
132
|
export declare const model: ProviderPackage.Definition<Settings, OpenAIProviderOptionsInput>["model"];
|
|
133
133
|
export declare const baseten: {
|
|
134
134
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
135
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
135
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
136
136
|
configure: (input?: FamilyModelOptions) => /*elided*/ any;
|
|
137
137
|
};
|
|
138
138
|
export declare const cerebras: {
|
|
139
139
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
140
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
140
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
141
141
|
configure: (input?: FamilyModelOptions) => /*elided*/ any;
|
|
142
142
|
};
|
|
143
143
|
export declare const deepinfra: {
|
|
144
144
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
145
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
145
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
146
146
|
configure: (input?: FamilyModelOptions) => /*elided*/ any;
|
|
147
147
|
};
|
|
148
148
|
export declare const deepseek: {
|
|
149
149
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
150
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
150
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
151
151
|
configure: (input?: FamilyModelOptions) => /*elided*/ any;
|
|
152
152
|
};
|
|
153
153
|
export declare const fireworks: {
|
|
154
154
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
155
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
155
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
156
156
|
configure: (input?: FamilyModelOptions) => /*elided*/ any;
|
|
157
157
|
};
|
|
158
158
|
export declare const groq: {
|
|
159
159
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
160
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
160
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
161
161
|
configure: (input?: FamilyModelOptions) => /*elided*/ any;
|
|
162
162
|
};
|
|
163
163
|
export declare const togetherai: {
|
|
164
164
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
165
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
165
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
166
166
|
configure: (input?: FamilyModelOptions) => /*elided*/ any;
|
|
167
167
|
};
|
|
168
168
|
export {};
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ProviderOptions } from "../schema/index.js";
|
|
2
2
|
import type { OpenResponsesOptionsInput } from "./open-responses-options.js";
|
|
3
3
|
export type { OpenAIResponseIncludable, OpenAIServiceTier } from "../protocols/utils/openai-options.js";
|
|
4
4
|
export type OpenAIOptionsInput = OpenResponsesOptionsInput;
|
|
5
|
-
export type OpenAIProviderOptionsInput =
|
|
6
|
-
readonly openai?: OpenAIOptionsInput;
|
|
7
|
-
};
|
|
5
|
+
export type OpenAIProviderOptionsInput = OpenAIOptionsInput;
|
|
8
6
|
export declare const gpt5DefaultOptions: (modelID: string, options?: {
|
|
9
7
|
readonly textVerbosity?: boolean;
|
|
10
8
|
}) => ProviderOptions | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { mergeProviderOptions } from "../schema/index.js";
|
|
2
2
|
const definedEntries = (input) => Object.entries(input).filter((entry) => entry[1] !== undefined);
|
|
3
3
|
const openAIProviderOptions = (options) => {
|
|
4
|
-
const
|
|
4
|
+
const result = Object.fromEntries(definedEntries({
|
|
5
5
|
store: options?.store,
|
|
6
6
|
reasoningEffort: options?.reasoningEffort,
|
|
7
7
|
reasoningSummary: options?.reasoningSummary,
|
|
@@ -9,9 +9,9 @@ const openAIProviderOptions = (options) => {
|
|
|
9
9
|
textVerbosity: options?.textVerbosity,
|
|
10
10
|
serviceTier: options?.serviceTier,
|
|
11
11
|
}));
|
|
12
|
-
if (Object.keys(
|
|
12
|
+
if (Object.keys(result).length === 0)
|
|
13
13
|
return undefined;
|
|
14
|
-
return
|
|
14
|
+
return result;
|
|
15
15
|
};
|
|
16
16
|
export const gpt5DefaultOptions = (modelID, options = {}) => {
|
|
17
17
|
const id = modelID.toLowerCase();
|
|
@@ -249,29 +249,29 @@ export interface Settings extends ProviderPackage.Settings {
|
|
|
249
249
|
}
|
|
250
250
|
export declare const configure: (input?: Config) => {
|
|
251
251
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
252
|
-
model: (id: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
253
|
-
responses: (id: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
254
|
-
chat: (id: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
252
|
+
model: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
253
|
+
responses: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
254
|
+
chat: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
255
255
|
image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/openai-images.js").OpenAIImageOptions>;
|
|
256
256
|
configure: (input?: Config) => /*elided*/ any;
|
|
257
257
|
};
|
|
258
258
|
export declare const provider: {
|
|
259
259
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
260
|
-
model: (id: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
261
|
-
responses: (id: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
262
|
-
chat: (id: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
260
|
+
model: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
261
|
+
responses: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
262
|
+
chat: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
263
263
|
image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/openai-images.js").OpenAIImageOptions>;
|
|
264
264
|
configure: (input?: Config) => {
|
|
265
265
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
266
|
-
model: (id: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
267
|
-
responses: (id: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
268
|
-
chat: (id: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
266
|
+
model: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
267
|
+
responses: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
268
|
+
chat: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
269
269
|
image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/openai-images.js").OpenAIImageOptions>;
|
|
270
270
|
configure: /*elided*/ any;
|
|
271
271
|
};
|
|
272
272
|
};
|
|
273
273
|
export declare const model: ProviderPackage.Definition<Settings, OpenAIProviderOptionsInput>["model"];
|
|
274
274
|
export declare const chatModel: ProviderPackage.Definition<Settings, OpenAIProviderOptionsInput>["model"];
|
|
275
|
-
export declare const responses: (id: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
276
|
-
export declare const chat: (id: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
275
|
+
export declare const responses: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
276
|
+
export declare const chat: (id: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
277
277
|
export declare const image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/openai-images.js").OpenAIImageOptions>;
|
|
@@ -2,7 +2,7 @@ import { Schema } from "effect";
|
|
|
2
2
|
import { Route, type RouteDefaultsInput } from "../route/client.js";
|
|
3
3
|
import { Protocol } from "../route/protocol.js";
|
|
4
4
|
import { type ProviderAuthOption } from "../route/auth-options.js";
|
|
5
|
-
import { type ModelID
|
|
5
|
+
import { type ModelID } from "../schema/index.js";
|
|
6
6
|
import type { ProviderPackage } from "../provider-package.js";
|
|
7
7
|
import * as OpenAIChat from "../protocols/openai-chat.js";
|
|
8
8
|
export declare const profile: {
|
|
@@ -76,9 +76,7 @@ export interface OpenRouterOptions {
|
|
|
76
76
|
engine?: OpenRouterString<"native" | "exa">;
|
|
77
77
|
}>;
|
|
78
78
|
}
|
|
79
|
-
export type OpenRouterProviderOptionsInput =
|
|
80
|
-
readonly openrouter?: OpenRouterOptions;
|
|
81
|
-
};
|
|
79
|
+
export type OpenRouterProviderOptionsInput = OpenRouterOptions;
|
|
82
80
|
export type LanguageModelOptions = Omit<RouteDefaultsInput, "providerOptions"> & ProviderAuthOption<"optional"> & {
|
|
83
81
|
readonly baseURL?: string;
|
|
84
82
|
readonly providerOptions?: OpenRouterProviderOptionsInput;
|
|
@@ -521,15 +519,15 @@ export declare const routes: Route<{
|
|
|
521
519
|
}, import("../route/transport/http.js").HttpPrepared<string>>[];
|
|
522
520
|
export declare const configure: (input?: LanguageModelOptions) => {
|
|
523
521
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
524
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
522
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<OpenRouterOptions>;
|
|
525
523
|
configure: (input?: LanguageModelOptions) => /*elided*/ any;
|
|
526
524
|
};
|
|
527
525
|
export declare const provider: {
|
|
528
526
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
529
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
527
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<OpenRouterOptions>;
|
|
530
528
|
configure: (input?: LanguageModelOptions) => {
|
|
531
529
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
532
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
530
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<OpenRouterOptions>;
|
|
533
531
|
configure: /*elided*/ any;
|
|
534
532
|
};
|
|
535
533
|
};
|
|
@@ -42,7 +42,7 @@ export const protocol = Protocol.make({
|
|
|
42
42
|
return {
|
|
43
43
|
...body,
|
|
44
44
|
messages,
|
|
45
|
-
...bodyOptions(request.providerOptions
|
|
45
|
+
...bodyOptions(request.providerOptions),
|
|
46
46
|
...(request.promptCacheKey ? { prompt_cache_key: request.promptCacheKey } : {}),
|
|
47
47
|
};
|
|
48
48
|
})),
|
package/dist/providers/xai.d.ts
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { type ProviderAuthOption } from "../route/auth-options.js";
|
|
2
2
|
import { Route, type RouteDefaultsInput } from "../route/client.js";
|
|
3
|
-
import { type ModelID
|
|
3
|
+
import { type ModelID } from "../schema/index.js";
|
|
4
4
|
import type { OpenAIOptionsInput } from "./openai-options.js";
|
|
5
5
|
import type { ProviderPackage } from "../provider-package.js";
|
|
6
6
|
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
7
|
-
export type XAIProviderOptionsInput =
|
|
8
|
-
readonly xai?: OpenAIOptionsInput;
|
|
9
|
-
};
|
|
7
|
+
export type XAIProviderOptionsInput = OpenAIOptionsInput;
|
|
10
8
|
export type LanguageModelOptions = Omit<RouteDefaultsInput, "providerOptions"> & ProviderAuthOption<"optional"> & {
|
|
11
9
|
readonly baseURL?: string;
|
|
12
10
|
readonly providerOptions?: XAIProviderOptionsInput;
|
|
@@ -235,28 +233,28 @@ export declare const routes: (Route<{
|
|
|
235
233
|
}, import("../route/transport/http.js").HttpPrepared<string>>)[];
|
|
236
234
|
export declare const configure: (input?: LanguageModelOptions) => {
|
|
237
235
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
238
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
239
|
-
responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
240
|
-
chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
236
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
237
|
+
responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
238
|
+
chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
241
239
|
image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/xai-images.js").XAIImageOptions>;
|
|
242
240
|
configure: (input?: LanguageModelOptions) => /*elided*/ any;
|
|
243
241
|
};
|
|
244
242
|
export declare const provider: {
|
|
245
243
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
246
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
247
|
-
responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
248
|
-
chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
244
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
245
|
+
responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
246
|
+
chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
249
247
|
image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/xai-images.js").XAIImageOptions>;
|
|
250
248
|
configure: (input?: LanguageModelOptions) => {
|
|
251
249
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
252
|
-
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
253
|
-
responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
254
|
-
chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
250
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
251
|
+
responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
252
|
+
chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
255
253
|
image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/xai-images.js").XAIImageOptions>;
|
|
256
254
|
configure: /*elided*/ any;
|
|
257
255
|
};
|
|
258
256
|
};
|
|
259
257
|
export declare const model: ProviderPackage.Definition<Settings, XAIProviderOptionsInput>["model"];
|
|
260
|
-
export declare const responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
261
|
-
export declare const chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<
|
|
258
|
+
export declare const responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
259
|
+
export declare const chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
|
|
262
260
|
export declare const image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/xai-images.js").XAIImageOptions>;
|
package/dist/providers/xai.js
CHANGED
|
@@ -15,7 +15,7 @@ const responsesRoute = Route.make({
|
|
|
15
15
|
protocol: OpenAIResponses.protocol,
|
|
16
16
|
endpoint: Endpoint.path("/responses", { baseURL: OpenAICompatibleProfiles.profiles.xai.baseURL }),
|
|
17
17
|
transport: OpenAIResponses.httpTransport,
|
|
18
|
-
defaults: { providerOptions: {
|
|
18
|
+
defaults: { providerOptions: { store: false } },
|
|
19
19
|
});
|
|
20
20
|
const chatRoute = Route.make({
|
|
21
21
|
id: "openai-compatible-chat",
|
package/dist/route/client.d.ts
CHANGED
|
@@ -142,9 +142,7 @@ export declare const compileRequest: (request: LLMRequest) => Effect.Effect<{
|
|
|
142
142
|
route: string;
|
|
143
143
|
protocol: string;
|
|
144
144
|
model: LanguageModel<{
|
|
145
|
-
readonly [x: string]:
|
|
146
|
-
readonly [x: string]: unknown;
|
|
147
|
-
};
|
|
145
|
+
readonly [x: string]: unknown;
|
|
148
146
|
}>;
|
|
149
147
|
body: any;
|
|
150
148
|
metadata: {
|
package/dist/route/framing.d.ts
CHANGED
|
@@ -11,8 +11,8 @@ import type { AIError } from "../schema/index.js";
|
|
|
11
11
|
* - AWS event stream — length-prefixed binary frames with CRC checksums.
|
|
12
12
|
* Each emitted frame is one parsed binary event record.
|
|
13
13
|
*
|
|
14
|
-
* The frame type is opaque to this layer; the protocol's
|
|
15
|
-
*
|
|
14
|
+
* The frame type is opaque to this layer; the protocol's event schema decodes
|
|
15
|
+
* each frame before its state machine handles it.
|
|
16
16
|
*/
|
|
17
17
|
export interface Definition<Frame> {
|
|
18
18
|
readonly id: string;
|
package/dist/route/protocol.d.ts
CHANGED
|
@@ -69,8 +69,7 @@ export interface ProtocolStream<Frame, Event, State> {
|
|
|
69
69
|
*
|
|
70
70
|
* Provider implementations should usually call `Protocol.make({ ... })`
|
|
71
71
|
* without explicit type arguments; the schemas and parser functions are the
|
|
72
|
-
* source of truth.
|
|
73
|
-
* cross-cutting concerns such as tracing or instrumentation.
|
|
72
|
+
* source of truth.
|
|
74
73
|
*/
|
|
75
74
|
export declare const make: <Body, Frame, Event, State>(input: Protocol<Body, Frame, Event, State>) => Protocol<Body, Frame, Event, State>;
|
|
76
75
|
export declare const jsonEvent: <const S extends Schema.Top>(schema: S) => Schema.fromJsonString<S>;
|
package/dist/route/protocol.js
CHANGED
|
@@ -9,8 +9,7 @@ import { Schema } from "effect";
|
|
|
9
9
|
*
|
|
10
10
|
* Provider implementations should usually call `Protocol.make({ ... })`
|
|
11
11
|
* without explicit type arguments; the schemas and parser functions are the
|
|
12
|
-
* source of truth.
|
|
13
|
-
* cross-cutting concerns such as tracing or instrumentation.
|
|
12
|
+
* source of truth.
|
|
14
13
|
*/
|
|
15
14
|
export const make = (input) => input;
|
|
16
15
|
export const jsonEvent = (schema) => Schema.fromJsonString(schema);
|
|
@@ -362,13 +362,9 @@ export declare namespace ToolChoice {
|
|
|
362
362
|
declare const LLMRequest_base: Schema.Class<LLMRequest, Schema.Struct<{
|
|
363
363
|
readonly id: Schema.optional<Schema.String>;
|
|
364
364
|
readonly model: Schema.declare<import("./options.js").LanguageModel<{
|
|
365
|
-
readonly [x: string]:
|
|
366
|
-
readonly [x: string]: unknown;
|
|
367
|
-
};
|
|
365
|
+
readonly [x: string]: unknown;
|
|
368
366
|
}>, import("./options.js").LanguageModel<{
|
|
369
|
-
readonly [x: string]:
|
|
370
|
-
readonly [x: string]: unknown;
|
|
371
|
-
};
|
|
367
|
+
readonly [x: string]: unknown;
|
|
372
368
|
}>>;
|
|
373
369
|
readonly system: Schema.$Array<Schema.Struct<{
|
|
374
370
|
readonly type: Schema.Literal<"text">;
|
|
@@ -383,7 +379,7 @@ declare const LLMRequest_base: Schema.Class<LLMRequest, Schema.Struct<{
|
|
|
383
379
|
readonly tools: Schema.$Array<typeof ToolDefinition>;
|
|
384
380
|
readonly toolChoice: Schema.optional<typeof ToolChoice>;
|
|
385
381
|
readonly generation: Schema.optional<typeof GenerationOptions>;
|
|
386
|
-
readonly providerOptions: Schema.optional<Schema.$Record<Schema.String, Schema
|
|
382
|
+
readonly providerOptions: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
387
383
|
readonly http: Schema.optional<typeof HttpOptions>;
|
|
388
384
|
readonly cache: Schema.optional<Schema.Union<readonly [Schema.Literal<"auto">, Schema.Literal<"none">, Schema.Struct<{
|
|
389
385
|
readonly tools: Schema.optional<Schema.Boolean>;
|
package/dist/schema/options.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type { AnyRoute } from "../route/client.js";
|
|
|
4
4
|
export declare const JsonSchema: Schema.$Record<Schema.String, Schema.Unknown>;
|
|
5
5
|
export type JsonSchema = Schema.Schema.Type<typeof JsonSchema>;
|
|
6
6
|
export declare const mergeJsonRecords: (...items: ReadonlyArray<Record<string, unknown> | undefined>) => Record<string, unknown> | undefined;
|
|
7
|
-
export declare const ProviderOptions: Schema.$Record<Schema.String, Schema
|
|
7
|
+
export declare const ProviderOptions: Schema.$Record<Schema.String, Schema.Unknown>;
|
|
8
8
|
export type ProviderOptions = Schema.Schema.Type<typeof ProviderOptions>;
|
|
9
9
|
export declare const mergeProviderOptions: (...items: ReadonlyArray<ProviderOptions | undefined>) => ProviderOptions | undefined;
|
|
10
10
|
declare const HttpOptions_base: Schema.Class<HttpOptions, Schema.Struct<{
|
|
@@ -64,7 +64,7 @@ export declare namespace LanguageModelLimits {
|
|
|
64
64
|
declare const LanguageModelDefaults_base: Schema.Class<LanguageModelDefaults, Schema.Struct<{
|
|
65
65
|
readonly limits: Schema.optional<typeof LanguageModelLimits>;
|
|
66
66
|
readonly generation: Schema.optional<typeof GenerationOptions>;
|
|
67
|
-
readonly providerOptions: Schema.optional<Schema.$Record<Schema.String, Schema
|
|
67
|
+
readonly providerOptions: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
68
68
|
readonly http: Schema.optional<typeof HttpOptions>;
|
|
69
69
|
}>, {}>;
|
|
70
70
|
export declare class LanguageModelDefaults extends LanguageModelDefaults_base {
|
|
@@ -126,13 +126,9 @@ export declare namespace LanguageModel {
|
|
|
126
126
|
export type LanguageModelInput = LanguageModel.Input;
|
|
127
127
|
export type LanguageModelProviderOptions<SelectedModel> = SelectedModel extends LanguageModel<infer Options> ? Options : never;
|
|
128
128
|
export declare const LanguageModelSchema: Schema.declare<LanguageModel<{
|
|
129
|
-
readonly [x: string]:
|
|
130
|
-
readonly [x: string]: unknown;
|
|
131
|
-
};
|
|
129
|
+
readonly [x: string]: unknown;
|
|
132
130
|
}>, LanguageModel<{
|
|
133
|
-
readonly [x: string]:
|
|
134
|
-
readonly [x: string]: unknown;
|
|
135
|
-
};
|
|
131
|
+
readonly [x: string]: unknown;
|
|
136
132
|
}>>;
|
|
137
133
|
declare const CacheHint_base: Schema.Class<CacheHint, Schema.Struct<{
|
|
138
134
|
readonly type: Schema.Literals<readonly ["ephemeral", "persistent"]>;
|
package/dist/schema/options.js
CHANGED
|
@@ -27,20 +27,8 @@ const mergeStringRecords = (...items) => {
|
|
|
27
27
|
const result = Object.fromEntries(defined.flatMap((item) => Object.entries(item).filter((entry) => entry[1] !== undefined)));
|
|
28
28
|
return Object.keys(result).length === 0 ? undefined : result;
|
|
29
29
|
};
|
|
30
|
-
export const ProviderOptions = Schema.Record(Schema.String, Schema.
|
|
31
|
-
export const mergeProviderOptions = (...items) =>
|
|
32
|
-
const result = {};
|
|
33
|
-
for (const item of items) {
|
|
34
|
-
if (!item)
|
|
35
|
-
continue;
|
|
36
|
-
for (const [provider, options] of Object.entries(item)) {
|
|
37
|
-
const merged = mergeJsonRecords(result[provider], options);
|
|
38
|
-
if (merged)
|
|
39
|
-
result[provider] = merged;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
return Object.keys(result).length === 0 ? undefined : result;
|
|
43
|
-
};
|
|
30
|
+
export const ProviderOptions = Schema.Record(Schema.String, Schema.Unknown);
|
|
31
|
+
export const mergeProviderOptions = (...items) => mergeJsonRecords(...items);
|
|
44
32
|
export class HttpOptions extends Schema.Class("AI.HttpOptions")({
|
|
45
33
|
body: Schema.optional(JsonSchema),
|
|
46
34
|
headers: Schema.optional(Schema.Record(Schema.String, Schema.String)),
|
|
@@ -182,10 +170,9 @@ export class CacheHint extends Schema.Class("LLM.CacheHint")({
|
|
|
182
170
|
// Auto-placement policy for prompt caching. The protocol-neutral lowering step
|
|
183
171
|
// reads this and injects `CacheHint`s at the configured boundaries; the
|
|
184
172
|
// per-protocol body builders then translate those hints into wire markers as
|
|
185
|
-
// usual. `"auto"` is the
|
|
173
|
+
// usual. `"auto"` is the default for agent loops — it places
|
|
186
174
|
// breakpoints at the last tool definition, the first and last distinct system
|
|
187
|
-
// parts, and the conversation tail
|
|
188
|
-
// prior cache entry within Anthropic/Bedrock's 20-block lookback during long
|
|
175
|
+
// parts, and the conversation tail so recent prefixes remain reusable during
|
|
189
176
|
// tool loops.
|
|
190
177
|
//
|
|
191
178
|
// Pass `"none"` to opt out entirely (the legacy behavior). Pass the granular
|
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-17688",
|
|
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-beta.107",
|
|
33
|
-
"@opencode-ai/http-recorder": "0.0.0-dev-
|
|
33
|
+
"@opencode-ai/http-recorder": "0.0.0-dev-17688",
|
|
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-
|
|
42
|
+
"@opencode-ai/schema": "0.0.0-dev-17688",
|
|
43
43
|
"aws4fetch": "1.0.20",
|
|
44
44
|
"effect": "4.0.0-beta.107",
|
|
45
45
|
"google-auth-library": "10.5.0"
|