@opencode-ai/ai 0.0.0-beta-17595 → 0.0.0-beta-17727

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/README.md +17 -6
  2. package/dist/cache-policy.js +3 -5
  3. package/dist/protocols/anthropic-messages.d.ts +26 -28
  4. package/dist/protocols/anthropic-messages.js +21 -9
  5. package/dist/protocols/gemini.d.ts +5 -9
  6. package/dist/protocols/gemini.js +5 -4
  7. package/dist/protocols/open-responses.d.ts +200 -38
  8. package/dist/protocols/open-responses.js +115 -42
  9. package/dist/protocols/openai-chat.d.ts +17 -15
  10. package/dist/protocols/openai-chat.js +8 -2
  11. package/dist/protocols/openai-compatible-chat.d.ts +3 -3
  12. package/dist/protocols/openai-compatible-responses.d.ts +31 -5
  13. package/dist/protocols/openai-responses.d.ts +171 -33
  14. package/dist/protocols/openai-responses.js +4 -2
  15. package/dist/protocols/shared.d.ts +8 -14
  16. package/dist/protocols/shared.js +8 -14
  17. package/dist/protocols/utils/bedrock-cache.js +3 -4
  18. package/dist/protocols/utils/cache.js +3 -6
  19. package/dist/protocols/utils/open-responses-options.d.ts +49 -14
  20. package/dist/protocols/utils/open-responses-options.js +40 -22
  21. package/dist/protocols/utils/openai-options.d.ts +7 -5
  22. package/dist/protocols/utils/openai-options.js +3 -3
  23. package/dist/provider-package.d.ts +0 -5
  24. package/dist/providers/amazon-bedrock-mantle.d.ts +47 -19
  25. package/dist/providers/amazon-bedrock-mantle.js +0 -1
  26. package/dist/providers/amazon-bedrock.d.ts +3 -9
  27. package/dist/providers/amazon-bedrock.js +0 -1
  28. package/dist/providers/anthropic-compatible.d.ts +11 -11
  29. package/dist/providers/anthropic-compatible.js +0 -1
  30. package/dist/providers/anthropic.d.ts +12 -12
  31. package/dist/providers/anthropic.js +0 -1
  32. package/dist/providers/azure.d.ts +44 -16
  33. package/dist/providers/azure.js +0 -1
  34. package/dist/providers/cloudflare.d.ts +11 -11
  35. package/dist/providers/google-vertex-chat.d.ts +5 -5
  36. package/dist/providers/google-vertex-chat.js +0 -1
  37. package/dist/providers/google-vertex-messages.d.ts +11 -11
  38. package/dist/providers/google-vertex-messages.js +0 -1
  39. package/dist/providers/google-vertex-responses.d.ts +33 -7
  40. package/dist/providers/google-vertex-responses.js +1 -2
  41. package/dist/providers/google-vertex.d.ts +5 -7
  42. package/dist/providers/google-vertex.js +1 -2
  43. package/dist/providers/google.d.ts +4 -4
  44. package/dist/providers/google.js +0 -1
  45. package/dist/providers/open-responses-options.d.ts +3 -13
  46. package/dist/providers/openai-compatible-responses.d.ts +33 -7
  47. package/dist/providers/openai-compatible-responses.js +0 -1
  48. package/dist/providers/openai-compatible.d.ts +13 -12
  49. package/dist/providers/openai-compatible.js +1 -1
  50. package/dist/providers/openai-options.d.ts +2 -4
  51. package/dist/providers/openai-options.js +3 -3
  52. package/dist/providers/openai.d.ts +48 -20
  53. package/dist/providers/openai.js +0 -1
  54. package/dist/providers/openrouter.d.ts +16 -17
  55. package/dist/providers/openrouter.js +1 -2
  56. package/dist/providers/xai.d.ts +50 -24
  57. package/dist/providers/xai.js +1 -2
  58. package/dist/route/client.d.ts +2 -6
  59. package/dist/route/client.js +1 -2
  60. package/dist/route/framing.d.ts +2 -2
  61. package/dist/route/protocol.d.ts +1 -2
  62. package/dist/route/protocol.js +1 -2
  63. package/dist/schema/errors.js +2 -1
  64. package/dist/schema/events.d.ts +5 -3
  65. package/dist/schema/events.js +5 -2
  66. package/dist/schema/ids.d.ts +0 -13
  67. package/dist/schema/ids.js +0 -9
  68. package/dist/schema/messages.d.ts +7 -7
  69. package/dist/schema/messages.js +5 -2
  70. package/dist/schema/options.d.ts +6 -22
  71. package/dist/schema/options.js +6 -30
  72. package/dist/testing.d.ts +2 -1
  73. package/dist/testing.js +7 -2
  74. package/package.json +5 -5
@@ -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 additive `AI.Usage` contract, `inputTokens` and `outputTokens`
23
- * are the non-cached input and visible output only. The provider-supplied
24
- * `total` is the source of truth when present; the computed fallback
25
- * under-counts cache and reasoning by design and exists mainly so
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.native` for debugging.
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 downstream
155
- * `decodeChunk` sees one JSON string per element. The SSE channel emits a
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. Lift one-line `const invalid =
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, mirroring Anthropic.
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
- // Bedrock-Claude enforces the same 4-breakpoint cap as the Anthropic Messages
13
- // API. Callers pass a shared counter through every `block()` call site so the
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 helpers for provider cache-marker lowering. Anthropic and Bedrock
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
- // Returns `"1h"` for any `ttlSeconds >= 3600`, otherwise `undefined` (the
6
- // provider default 5m). Anthropic & Bedrock both treat anything shorter than
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;
@@ -1,21 +1,56 @@
1
1
  import { Schema } from "effect";
2
- import { TextVerbosity, type LLMRequest } from "../../schema/index.js";
2
+ import type { LLMRequest } from "../../schema/index.js";
3
+ export declare const ReasoningEfforts: readonly ["none", "minimal", "low", "medium", "high", "xhigh", "max"];
4
+ export type ReasoningEffort = (typeof ReasoningEfforts)[number] | (string & {});
5
+ export declare const ReasoningEffort: Schema.declare<ReasoningEffort, ReasoningEffort>;
6
+ export declare const TextVerbosities: readonly ["low", "medium", "high"];
7
+ export type TextVerbosity = (typeof TextVerbosities)[number] | (string & {});
8
+ export declare const TextVerbosity: Schema.declare<TextVerbosity, TextVerbosity>;
3
9
  export declare const ResponseIncludables: 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"];
4
- export type ResponseIncludable = (typeof ResponseIncludables)[number];
10
+ export type ResponseIncludable = (typeof ResponseIncludables)[number] | (string & {});
5
11
  export declare const ServiceTiers: readonly ["auto", "default", "flex", "priority"];
6
12
  export type ServiceTier = (typeof ServiceTiers)[number];
7
- export declare const ReasoningEffort: Schema.String;
8
- export declare const TextVerbositySchema: Schema.Literals<readonly ["low", "medium", "high"]>;
9
- export declare const ResponseIncludableSchema: Schema.Literals<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"]>;
13
+ export declare const Truncations: readonly ["auto", "disabled"];
14
+ export type Truncation = (typeof Truncations)[number];
15
+ export declare const TextVerbositySchema: Schema.declare<TextVerbosity, TextVerbosity>;
16
+ export declare const ResponseIncludableSchema: Schema.declare<ResponseIncludable, ResponseIncludable>;
10
17
  export declare const ServiceTierSchema: Schema.Literals<readonly ["auto", "default", "flex", "priority"]>;
11
- export interface Resolved {
12
- readonly instructions?: string;
13
- readonly store?: boolean;
14
- readonly reasoningEffort?: string;
15
- readonly reasoningSummary?: "auto" | "concise" | "detailed";
16
- readonly include?: ReadonlyArray<ResponseIncludable>;
17
- readonly textVerbosity?: Schema.Schema.Type<typeof TextVerbosity>;
18
- readonly serviceTier?: ServiceTier;
19
- }
18
+ export declare const TruncationSchema: Schema.Literals<readonly ["auto", "disabled"]>;
19
+ export declare const AllowedTools: Schema.Struct<{
20
+ readonly toolNames: Schema.$Array<Schema.String>;
21
+ readonly mode: Schema.optional<Schema.Literals<readonly ["auto", "none", "required"]>>;
22
+ }>;
23
+ export type AllowedTools = typeof AllowedTools.Type;
24
+ export declare const StreamOptions: Schema.Struct<{
25
+ readonly includeObfuscation: Schema.optional<Schema.Boolean>;
26
+ }>;
27
+ export declare const Options: Schema.Struct<{
28
+ readonly instructions: Schema.optional<Schema.String>;
29
+ readonly store: Schema.optional<Schema.Boolean>;
30
+ readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
31
+ readonly safetyIdentifier: Schema.optional<Schema.String>;
32
+ readonly streamOptions: Schema.optional<Schema.Struct<{
33
+ readonly includeObfuscation: Schema.optional<Schema.Boolean>;
34
+ }>>;
35
+ readonly topLogprobs: Schema.optional<Schema.Int>;
36
+ readonly reasoningEffort: Schema.optional<Schema.declare<ReasoningEffort, ReasoningEffort>>;
37
+ readonly reasoningSummary: Schema.optional<Schema.Literals<readonly ["auto", "concise", "detailed"]>>;
38
+ readonly include: Schema.optional<Schema.$Array<Schema.declare<ResponseIncludable, ResponseIncludable>>>;
39
+ readonly textVerbosity: Schema.optional<Schema.declare<TextVerbosity, TextVerbosity>>;
40
+ readonly serviceTier: Schema.optional<Schema.Literals<readonly ["auto", "default", "flex", "priority"]>>;
41
+ readonly truncation: Schema.optional<Schema.Literals<readonly ["auto", "disabled"]>>;
42
+ readonly allowedTools: Schema.optional<Schema.Struct<{
43
+ readonly toolNames: Schema.$Array<Schema.String>;
44
+ readonly mode: Schema.optional<Schema.Literals<readonly ["auto", "none", "required"]>>;
45
+ }>>;
46
+ readonly maxToolCalls: Schema.optional<Schema.Int>;
47
+ readonly parallelToolCalls: Schema.optional<Schema.Boolean>;
48
+ }>;
49
+ export type Options = typeof Options.Type;
50
+ export type Resolved = Omit<Options, "allowedTools"> & {
51
+ readonly allowedTools?: AllowedTools & {
52
+ readonly mode: NonNullable<AllowedTools["mode"]>;
53
+ };
54
+ };
20
55
  export declare const resolve: (request: LLMRequest) => Resolved;
21
56
  export * as OpenResponsesOptions from "./open-responses-options.js";
@@ -1,5 +1,8 @@
1
- import { Schema } from "effect";
2
- import { TextVerbosity } from "../../schema/index.js";
1
+ import { Option, Schema } from "effect";
2
+ export const ReasoningEfforts = ["none", "minimal", "low", "medium", "high", "xhigh", "max"];
3
+ export const ReasoningEffort = Schema.declare((value) => typeof value === "string", { title: "ReasoningEffort" });
4
+ export const TextVerbosities = ["low", "medium", "high"];
5
+ export const TextVerbosity = Schema.declare((value) => typeof value === "string", { title: "TextVerbosity" });
3
6
  export const ResponseIncludables = [
4
7
  "file_search_call.results",
5
8
  "web_search_call.results",
@@ -11,31 +14,46 @@ export const ResponseIncludables = [
11
14
  "message.output_text.logprobs",
12
15
  ];
13
16
  export const ServiceTiers = ["auto", "default", "flex", "priority"];
14
- const TEXT_VERBOSITY = new Set(["low", "medium", "high"]);
15
- const INCLUDABLES = new Set(ResponseIncludables);
16
- const SERVICE_TIERS = new Set(ServiceTiers);
17
- const isTextVerbosity = (value) => typeof value === "string" && TEXT_VERBOSITY.has(value);
18
- const isServiceTier = (value) => typeof value === "string" && SERVICE_TIERS.has(value);
19
- export const ReasoningEffort = Schema.String;
17
+ export const Truncations = ["auto", "disabled"];
20
18
  export const TextVerbositySchema = TextVerbosity;
21
- export const ResponseIncludableSchema = Schema.Literals(ResponseIncludables);
19
+ export const ResponseIncludableSchema = Schema.declare((value) => typeof value === "string", { title: "ResponseIncludable" });
22
20
  export const ServiceTierSchema = Schema.Literals(ServiceTiers);
21
+ export const TruncationSchema = Schema.Literals(Truncations);
22
+ export const AllowedTools = Schema.Struct({
23
+ toolNames: Schema.Array(Schema.String),
24
+ mode: Schema.optional(Schema.Literals(["auto", "none", "required"])),
25
+ });
26
+ export const StreamOptions = Schema.Struct({
27
+ includeObfuscation: Schema.optional(Schema.Boolean),
28
+ });
29
+ export const Options = Schema.Struct({
30
+ instructions: Schema.optional(Schema.String),
31
+ store: Schema.optional(Schema.Boolean),
32
+ metadata: Schema.optional(Schema.Record(Schema.String, Schema.String)),
33
+ safetyIdentifier: Schema.optional(Schema.String),
34
+ streamOptions: Schema.optional(StreamOptions),
35
+ topLogprobs: Schema.optional(Schema.Int.check(Schema.isBetween({ minimum: 0, maximum: 20 }))),
36
+ reasoningEffort: Schema.optional(ReasoningEffort),
37
+ reasoningSummary: Schema.optional(Schema.Literals(["auto", "concise", "detailed"])),
38
+ include: Schema.optional(Schema.Array(ResponseIncludableSchema)),
39
+ textVerbosity: Schema.optional(TextVerbositySchema),
40
+ serviceTier: Schema.optional(ServiceTierSchema),
41
+ truncation: Schema.optional(TruncationSchema),
42
+ allowedTools: Schema.optional(AllowedTools),
43
+ maxToolCalls: Schema.optional(Schema.Int),
44
+ parallelToolCalls: Schema.optional(Schema.Boolean),
45
+ });
46
+ const decodeOptions = Schema.decodeUnknownOption(Options);
23
47
  export const resolve = (request) => {
24
- const input = request.providerOptions?.[request.model.route.providerMetadataKey ?? "openresponses"];
25
- const include = Array.isArray(input?.include)
26
- ? input.include.filter((entry) => INCLUDABLES.has(entry))
27
- : [];
28
- const reasoningSummary = input?.reasoningSummary;
48
+ const input = Option.getOrUndefined(decodeOptions(request.providerOptions));
49
+ if (!input)
50
+ return {};
29
51
  return {
30
- instructions: typeof input?.instructions === "string" ? input.instructions : undefined,
31
- store: typeof input?.store === "boolean" ? input.store : undefined,
32
- reasoningEffort: typeof input?.reasoningEffort === "string" ? input.reasoningEffort : undefined,
33
- reasoningSummary: reasoningSummary === "auto" || reasoningSummary === "concise" || reasoningSummary === "detailed"
34
- ? reasoningSummary
52
+ ...input,
53
+ include: input.include?.length ? input.include : undefined,
54
+ allowedTools: input.allowedTools && input.allowedTools.toolNames.length > 0
55
+ ? { ...input.allowedTools, mode: input.allowedTools.mode ?? "auto" }
35
56
  : undefined,
36
- include: include.length > 0 ? include : undefined,
37
- textVerbosity: isTextVerbosity(input?.textVerbosity) ? input.textVerbosity : undefined,
38
- serviceTier: isServiceTier(input?.serviceTier) ? input.serviceTier : undefined,
39
57
  };
40
58
  };
41
59
  export * as OpenResponsesOptions from "./open-responses-options.js";
@@ -1,14 +1,16 @@
1
1
  import { OpenResponsesOptions } from "./open-responses-options.js";
2
2
  export declare const OpenAIReasoningEfforts: readonly ["none", "minimal", "low", "medium", "high", "xhigh", "max"];
3
- export type OpenAIReasoningEffort = string;
3
+ export type OpenAIReasoningEffort = OpenResponsesOptions.ReasoningEffort;
4
+ export declare const OpenAITextVerbosities: readonly ["low", "medium", "high"];
5
+ export type OpenAITextVerbosity = OpenResponsesOptions.TextVerbosity;
4
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"];
5
7
  export type OpenAIResponseIncludable = OpenResponsesOptions.ResponseIncludable;
6
8
  export declare const OpenAIServiceTiers: readonly ["auto", "default", "flex", "priority"];
7
9
  export type OpenAIServiceTier = OpenResponsesOptions.ServiceTier;
8
- export declare const OpenAIReasoningEffort: import("effect/Schema").String;
9
- export declare const OpenAITextVerbosity: import("effect/Schema").Literals<readonly ["low", "medium", "high"]>;
10
- export declare const OpenAIResponseIncludable: import("effect/Schema").Literals<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"]>;
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>;
11
13
  export declare const OpenAIServiceTier: import("effect/Schema").Literals<readonly ["auto", "default", "flex", "priority"]>;
12
14
  export declare const isReasoningEffort: (effort: unknown) => effort is OpenAIReasoningEffort;
13
- export declare const resolve: (request: import("../../schema/messages.js").LLMRequest) => OpenResponsesOptions.Resolved;
15
+ export declare const resolve: (request: import("../../index.js").LLMRequest) => OpenResponsesOptions.Resolved;
14
16
  export * as OpenAIOptions from "./openai-options.js";
@@ -1,12 +1,12 @@
1
- import { ReasoningEfforts } from "../../schema/index.js";
2
1
  import { OpenResponsesOptions } from "./open-responses-options.js";
3
- export const OpenAIReasoningEfforts = ReasoningEfforts;
2
+ export const OpenAIReasoningEfforts = OpenResponsesOptions.ReasoningEfforts;
3
+ export const OpenAITextVerbosities = OpenResponsesOptions.TextVerbosities;
4
4
  // Mirrors OpenAI's `ResponseIncludable` union from the official SDK. Keep this
5
5
  // in lockstep with `openai-node/src/resources/responses/responses.ts`.
6
6
  export const OpenAIResponseIncludables = OpenResponsesOptions.ResponseIncludables;
7
7
  export const OpenAIServiceTiers = OpenResponsesOptions.ServiceTiers;
8
8
  export const OpenAIReasoningEffort = OpenResponsesOptions.ReasoningEffort;
9
- export const OpenAITextVerbosity = OpenResponsesOptions.TextVerbositySchema;
9
+ export const OpenAITextVerbosity = OpenResponsesOptions.TextVerbosity;
10
10
  export const OpenAIResponseIncludable = OpenResponsesOptions.ResponseIncludableSchema;
11
11
  export const OpenAIServiceTier = OpenResponsesOptions.ServiceTierSchema;
12
12
  export const isReasoningEffort = (effort) => typeof effort === "string";
@@ -3,11 +3,6 @@ export interface Settings extends Readonly<Record<string, unknown>> {
3
3
  readonly baseURL?: string;
4
4
  readonly headers?: Readonly<Record<string, string>>;
5
5
  readonly body?: Readonly<Record<string, unknown>>;
6
- readonly limits?: {
7
- readonly context: number;
8
- readonly input?: number;
9
- readonly output: number;
10
- };
11
6
  }
12
7
  export interface Definition<ProviderSettings extends Settings = Settings, Options extends ProviderOptions = ProviderOptions> {
13
8
  readonly model: (modelID: string, settings: ProviderSettings) => LanguageModel<Options>;
@@ -81,7 +81,6 @@ export declare const routes: (RouteDef<{
81
81
  } | undefined;
82
82
  })[];
83
83
  readonly stream: true;
84
- readonly stop?: readonly string[] | undefined;
85
84
  readonly max_completion_tokens?: number | undefined;
86
85
  readonly max_tokens?: number | undefined;
87
86
  readonly tools?: readonly {
@@ -98,9 +97,10 @@ export declare const routes: (RouteDef<{
98
97
  readonly ttl?: string | undefined;
99
98
  } | undefined;
100
99
  }[] | undefined;
100
+ readonly stop?: readonly string[] | undefined;
101
101
  readonly temperature?: number | undefined;
102
102
  readonly seed?: number | undefined;
103
- readonly tool_choice?: "required" | "none" | "auto" | {
103
+ readonly tool_choice?: "required" | "auto" | "none" | {
104
104
  readonly type: "function";
105
105
  readonly function: {
106
106
  readonly name: string;
@@ -112,7 +112,7 @@ export declare const routes: (RouteDef<{
112
112
  readonly include_usage: boolean;
113
113
  } | undefined;
114
114
  readonly prompt_cache_key?: string | undefined;
115
- readonly reasoning_effort?: string | undefined;
115
+ readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
116
116
  readonly frequency_penalty?: number | undefined;
117
117
  readonly presence_penalty?: number | undefined;
118
118
  }, import("../route/transport/http.js").HttpPrepared<string>> | RouteDef<{
@@ -130,6 +130,9 @@ export declare const routes: (RouteDef<{
130
130
  } | {
131
131
  readonly role: "system";
132
132
  readonly content: string;
133
+ } | {
134
+ readonly role: "developer";
135
+ readonly content: string;
133
136
  } | {
134
137
  readonly role: "user";
135
138
  readonly content: readonly ({
@@ -145,17 +148,20 @@ export declare const routes: (RouteDef<{
145
148
  readonly text: string;
146
149
  })[];
147
150
  } | {
151
+ readonly type: "message";
148
152
  readonly content: readonly {
149
153
  readonly type: "output_text";
150
154
  readonly text: string;
151
155
  }[];
152
156
  readonly role: "assistant";
157
+ readonly id?: string | undefined;
153
158
  readonly phase?: "commentary" | "final_answer" | undefined;
154
159
  } | {
155
160
  readonly type: "function_call";
156
- readonly call_id: string;
157
161
  readonly name: string;
158
162
  readonly arguments: string;
163
+ readonly call_id: string;
164
+ readonly id?: string | undefined;
159
165
  } | {
160
166
  readonly type: "function_call_output";
161
167
  readonly call_id: string;
@@ -172,19 +178,24 @@ export declare const routes: (RouteDef<{
172
178
  readonly text: string;
173
179
  })[];
174
180
  } | {
181
+ readonly type: "message";
175
182
  readonly content: readonly {
176
183
  readonly type: "output_text";
177
184
  readonly text: string;
178
185
  }[];
179
186
  readonly role: "assistant";
187
+ readonly id?: string | undefined;
180
188
  readonly phase?: "commentary" | "final_answer" | null | undefined;
181
189
  })[];
182
190
  readonly model: string;
183
191
  readonly stream: true;
192
+ readonly metadata?: {
193
+ readonly [x: string]: string;
194
+ } | undefined;
184
195
  readonly instructions?: string | undefined;
185
196
  readonly reasoning?: {
186
197
  readonly summary?: "auto" | "concise" | "detailed" | undefined;
187
- readonly effort?: string | undefined;
198
+ readonly effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
188
199
  } | undefined;
189
200
  readonly tools?: readonly ({
190
201
  readonly type: "function";
@@ -199,49 +210,66 @@ export declare const routes: (RouteDef<{
199
210
  readonly size?: string | undefined;
200
211
  readonly action?: "generate" | "auto" | "edit" | undefined;
201
212
  readonly output_format?: "png" | "jpeg" | "webp" | undefined;
202
- readonly quality?: "low" | "medium" | "high" | "auto" | undefined;
213
+ readonly quality?: "auto" | "low" | "medium" | "high" | undefined;
203
214
  readonly background?: "auto" | "opaque" | "transparent" | undefined;
204
215
  readonly output_compression?: number | undefined;
205
216
  readonly input_fidelity?: "low" | "high" | undefined;
206
217
  readonly partial_images?: number | undefined;
207
218
  })[] | undefined;
208
219
  readonly text?: {
209
- readonly verbosity?: "low" | "medium" | "high" | undefined;
220
+ readonly verbosity?: import("../protocols/utils/open-responses-options.js").TextVerbosity | undefined;
210
221
  } | undefined;
211
222
  readonly temperature?: number | undefined;
212
- readonly tool_choice?: "required" | "none" | "auto" | {
223
+ readonly tool_choice?: "required" | "auto" | "none" | {
213
224
  readonly type: "function";
214
225
  readonly name: string;
226
+ } | {
227
+ readonly type: "allowed_tools";
228
+ readonly mode: "required" | "auto" | "none";
229
+ readonly tools: readonly {
230
+ readonly type: "function";
231
+ readonly name: string;
232
+ }[];
215
233
  } | {
216
234
  readonly type: "image_generation";
217
235
  } | undefined;
218
236
  readonly top_p?: number | undefined;
219
- readonly include?: 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")[] | undefined;
220
237
  readonly store?: boolean | undefined;
238
+ readonly include?: readonly import("../protocols/utils/open-responses-options.js").ResponseIncludable[] | undefined;
239
+ readonly truncation?: "auto" | "disabled" | undefined;
240
+ readonly stream_options?: {
241
+ readonly include_obfuscation?: boolean | undefined;
242
+ } | undefined;
221
243
  readonly prompt_cache_key?: string | undefined;
244
+ readonly frequency_penalty?: number | undefined;
245
+ readonly presence_penalty?: number | undefined;
246
+ readonly safety_identifier?: string | undefined;
247
+ readonly top_logprobs?: number | undefined;
222
248
  readonly service_tier?: "default" | "auto" | "flex" | "priority" | undefined;
223
249
  readonly max_output_tokens?: number | undefined;
250
+ readonly max_tool_calls?: number | undefined;
251
+ readonly parallel_tool_calls?: boolean | undefined;
224
252
  }, import("../protocols/open-responses-channel.js").Prepared>)[];
225
253
  export declare const configure: (input?: Config) => {
226
254
  id: string & import("effect/Brand").Brand<"AI.ProviderID">;
227
- model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<OpenAIProviderOptionsInput>;
228
- chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<OpenAIProviderOptionsInput>;
229
- responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<OpenAIProviderOptionsInput>;
255
+ model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
256
+ chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
257
+ responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
230
258
  configure: (input?: Config) => /*elided*/ any;
231
259
  };
232
260
  export declare const provider: {
233
261
  id: string & import("effect/Brand").Brand<"AI.ProviderID">;
234
- model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<OpenAIProviderOptionsInput>;
235
- chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<OpenAIProviderOptionsInput>;
236
- responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<OpenAIProviderOptionsInput>;
262
+ model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
263
+ chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
264
+ responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
237
265
  configure: (input?: Config) => {
238
266
  id: string & import("effect/Brand").Brand<"AI.ProviderID">;
239
- model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<OpenAIProviderOptionsInput>;
240
- chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<OpenAIProviderOptionsInput>;
241
- responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<OpenAIProviderOptionsInput>;
267
+ model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
268
+ chat: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
269
+ responses: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
242
270
  configure: /*elided*/ any;
243
271
  };
244
272
  };
245
273
  export declare const chatModel: ProviderPackage.Definition<Settings, OpenAIProviderOptionsInput>["model"];
246
274
  export declare const responsesModel: ProviderPackage.Definition<Settings, OpenAIProviderOptionsInput>["model"];
247
- export declare const model: (modelID: string, settings: Settings) => import("../schema/options.js").LanguageModel<OpenAIProviderOptionsInput>;
275
+ export declare const model: (modelID: string, settings: Settings) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
@@ -58,7 +58,6 @@ const config = (settings) => {
58
58
  credentials: settings.credentials,
59
59
  headers: settings.headers === undefined ? undefined : { ...settings.headers },
60
60
  http: settings.body === undefined ? undefined : { body: { ...settings.body } },
61
- limits: settings.limits,
62
61
  providerOptions: settings.providerOptions,
63
62
  region: settings.region,
64
63
  };
@@ -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
  };
@@ -35,7 +35,6 @@ export const model = (modelID, settings) => {
35
35
  generation: settings.topP === undefined ? undefined : { topP: settings.topP },
36
36
  headers: settings.headers === undefined ? undefined : { ...settings.headers },
37
37
  http: settings.body === undefined ? undefined : { body: { ...settings.body } },
38
- limits: settings.limits,
39
38
  region: settings.region,
40
39
  }).model(modelID);
41
40
  };
@@ -159,14 +159,6 @@ export declare const routes: import("../route/client.js").Route<{
159
159
  }[];
160
160
  })[];
161
161
  readonly stream: true;
162
- readonly system?: readonly {
163
- readonly type: "text";
164
- readonly text: string;
165
- readonly cache_control?: {
166
- readonly type: "ephemeral";
167
- readonly ttl?: "1h" | "5m" | undefined;
168
- } | undefined;
169
- }[] | undefined;
170
162
  readonly tools?: readonly {
171
163
  readonly description: string;
172
164
  readonly name: string;
@@ -178,6 +170,14 @@ export declare const routes: import("../route/client.js").Route<{
178
170
  readonly ttl?: "1h" | "5m" | undefined;
179
171
  } | undefined;
180
172
  }[] | undefined;
173
+ readonly system?: readonly {
174
+ readonly type: "text";
175
+ readonly text: string;
176
+ readonly cache_control?: {
177
+ readonly type: "ephemeral";
178
+ readonly ttl?: "1h" | "5m" | undefined;
179
+ } | undefined;
180
+ }[] | undefined;
181
181
  readonly temperature?: number | undefined;
182
182
  readonly thinking?: {
183
183
  readonly type: "enabled";
@@ -189,7 +189,7 @@ export declare const routes: import("../route/client.js").Route<{
189
189
  readonly type: "disabled";
190
190
  } | undefined;
191
191
  readonly tool_choice?: {
192
- readonly type: "none" | "auto" | "any";
192
+ readonly type: "auto" | "none" | "any";
193
193
  } | {
194
194
  readonly type: "tool";
195
195
  readonly name: string;
@@ -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.ProviderOptionsInput>;
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.ProviderOptionsInput>;
213
+ model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<AnthropicMessages.OptionsInput>;
214
214
  configure: /*elided*/ any;
215
215
  };
216
216
  };
@@ -37,7 +37,6 @@ export const model = (modelID, settings) => {
37
37
  baseURL: settings.baseURL,
38
38
  headers: settings.headers === undefined ? undefined : { ...settings.headers },
39
39
  http: settings.body === undefined ? undefined : { body: { ...settings.body } },
40
- limits: settings.limits,
41
40
  provider: settings.provider,
42
41
  providerOptions: settings.providerOptions,
43
42
  }).model(modelID);
@@ -143,14 +143,6 @@ export declare const routes: import("../route/client.js").Route<{
143
143
  }[];
144
144
  })[];
145
145
  readonly stream: true;
146
- readonly system?: readonly {
147
- readonly type: "text";
148
- readonly text: string;
149
- readonly cache_control?: {
150
- readonly type: "ephemeral";
151
- readonly ttl?: "1h" | "5m" | undefined;
152
- } | undefined;
153
- }[] | undefined;
154
146
  readonly tools?: readonly {
155
147
  readonly description: string;
156
148
  readonly name: string;
@@ -162,6 +154,14 @@ export declare const routes: import("../route/client.js").Route<{
162
154
  readonly ttl?: "1h" | "5m" | undefined;
163
155
  } | undefined;
164
156
  }[] | undefined;
157
+ readonly system?: readonly {
158
+ readonly type: "text";
159
+ readonly text: string;
160
+ readonly cache_control?: {
161
+ readonly type: "ephemeral";
162
+ readonly ttl?: "1h" | "5m" | undefined;
163
+ } | undefined;
164
+ }[] | undefined;
165
165
  readonly temperature?: number | undefined;
166
166
  readonly thinking?: {
167
167
  readonly type: "enabled";
@@ -173,7 +173,7 @@ export declare const routes: import("../route/client.js").Route<{
173
173
  readonly type: "disabled";
174
174
  } | undefined;
175
175
  readonly tool_choice?: {
176
- readonly type: "none" | "auto" | "any";
176
+ readonly type: "auto" | "none" | "any";
177
177
  } | {
178
178
  readonly type: "tool";
179
179
  readonly name: string;
@@ -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.ProviderOptionsInput>;
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.ProviderOptionsInput>;
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.ProviderOptionsInput>;
212
+ model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<AnthropicMessages.OptionsInput>;
213
213
  configure: /*elided*/ any;
214
214
  };
215
215
  };