@opencode/ai 2.1.3 → 2.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/experimental/evaluation.js +3 -10
- package/dist/image-client.d.ts +8 -8
- package/dist/image.d.ts +148 -148
- package/dist/promise.d.ts +120 -120
- package/dist/protocols/alibaba-chat.d.ts +12 -12
- package/dist/protocols/alibaba-messages.d.ts +11 -11
- package/dist/protocols/alibaba-responses.d.ts +35 -35
- package/dist/protocols/anthropic-messages.d.ts +40 -44
- package/dist/protocols/anthropic-messages.js +3 -3
- package/dist/protocols/bedrock-converse.d.ts +30 -32
- package/dist/protocols/bedrock-converse.js +2 -3
- package/dist/protocols/cartesia-speech.d.ts +32 -32
- package/dist/protocols/cohere-chat.d.ts +7 -8
- package/dist/protocols/deepgram-speech.d.ts +32 -32
- package/dist/protocols/elevenlabs-speech.d.ts +32 -32
- package/dist/protocols/gemini.d.ts +34 -34
- package/dist/protocols/gemini.js +2 -2
- package/dist/protocols/google-interactions.d.ts +14 -14
- package/dist/protocols/google-interactions.js +2 -2
- package/dist/protocols/google-speech.d.ts +32 -32
- package/dist/protocols/google-transcription.d.ts +32 -32
- package/dist/protocols/meta-messages.d.ts +23 -23
- package/dist/protocols/meta-responses.d.ts +78 -78
- package/dist/protocols/mistral-chat.d.ts +81 -78
- package/dist/protocols/mistral-chat.js +2 -1
- package/dist/protocols/open-responses-channel.js +47 -46
- package/dist/protocols/open-responses-continuation.d.ts +8 -2
- package/dist/protocols/open-responses-continuation.js +3 -1
- package/dist/protocols/open-responses.d.ts +398 -398
- package/dist/protocols/open-responses.js +8 -7
- package/dist/protocols/openai-chat.d.ts +60 -60
- package/dist/protocols/openai-chat.js +3 -3
- package/dist/protocols/openai-compatible-chat.d.ts +13 -14
- package/dist/protocols/openai-compatible-responses.d.ts +36 -37
- package/dist/protocols/openai-images.d.ts +32 -32
- package/dist/protocols/openai-responses.d.ts +235 -235
- package/dist/protocols/openai-responses.js +1 -1
- package/dist/protocols/openai-speech.d.ts +32 -32
- package/dist/protocols/openai-transcription.d.ts +32 -32
- package/dist/protocols/openai-transcription.js +12 -7
- package/dist/protocols/utils/partial-json-options.d.ts +0 -1
- package/dist/protocols/utils/partial-json-options.js +0 -1
- package/dist/protocols/utils/tool-stream.d.ts +1 -1
- package/dist/protocols/venice-chat.d.ts +52 -53
- package/dist/protocols/venice-chat.js +6 -5
- package/dist/protocols/xai-responses.d.ts +78 -78
- package/dist/protocols/zai-chat.d.ts +33 -30
- package/dist/protocols/zai-chat.js +8 -3
- package/dist/protocols/zai-messages.d.ts +21 -19
- package/dist/protocols/zai-messages.js +3 -2
- package/dist/provider-error.js +5 -3
- package/dist/providers/alibaba.d.ts +69 -69
- package/dist/providers/amazon-bedrock-mantle.d.ts +202 -202
- package/dist/providers/amazon-bedrock.d.ts +15 -15
- package/dist/providers/anthropic-compatible.d.ts +13 -13
- package/dist/providers/anthropic.d.ts +13 -13
- package/dist/providers/azure.d.ts +106 -106
- package/dist/providers/baseten.d.ts +24 -24
- package/dist/providers/cerebras.d.ts +24 -24
- package/dist/providers/cloudflare-ai-gateway.d.ts +230 -227
- package/dist/providers/cloudflare-ai-gateway.js +1 -2
- package/dist/providers/cloudflare-workers-ai.d.ts +24 -24
- package/dist/providers/cohere.d.ts +75 -75
- package/dist/providers/deepinfra.d.ts +24 -24
- package/dist/providers/deepseek.d.ts +24 -24
- package/dist/providers/digitalocean.d.ts +36 -36
- package/dist/providers/fireworks.d.ts +24 -24
- package/dist/providers/google-vertex-chat.d.ts +12 -12
- package/dist/providers/google-vertex-messages.d.ts +13 -13
- package/dist/providers/google-vertex-mistral.d.ts +17 -17
- package/dist/providers/google-vertex-responses.d.ts +35 -35
- package/dist/providers/google-vertex.d.ts +17 -17
- package/dist/providers/google-vertex.js +2 -2
- package/dist/providers/google.d.ts +17 -17
- package/dist/providers/groq.d.ts +24 -24
- package/dist/providers/meta.d.ts +179 -179
- package/dist/providers/minimax.d.ts +71 -71
- package/dist/providers/mistral.d.ts +28 -28
- package/dist/providers/moonshot.d.ts +202 -202
- package/dist/providers/open-responses-options.d.ts +0 -1
- package/dist/providers/open-responses-options.js +1 -1
- package/dist/providers/openai-compatible-responses.d.ts +35 -35
- package/dist/providers/openai-compatible.d.ts +12 -12
- package/dist/providers/openai-compatible.js +1 -1
- package/dist/providers/openai-options.d.ts +0 -1
- package/dist/providers/openai-options.js +0 -1
- package/dist/providers/openai.d.ts +100 -100
- package/dist/providers/openrouter.d.ts +36 -36
- package/dist/providers/togetherai.d.ts +24 -24
- package/dist/providers/venice.d.ts +195 -20
- package/dist/providers/xai.d.ts +12 -12
- package/dist/providers/zai-coding-plan.d.ts +149 -69
- package/dist/providers/zai.d.ts +84 -19
- package/dist/route/auth-options.d.ts +0 -3
- package/dist/route/auth.d.ts +0 -2
- package/dist/route/auth.js +0 -2
- package/dist/route/client.d.ts +0 -2
- package/dist/route/client.js +3 -4
- package/dist/route/executor-service.js +1 -1
- package/dist/speech-client.d.ts +8 -8
- package/dist/speech.d.ts +148 -148
- package/dist/transcription-client.d.ts +8 -8
- package/dist/transcription.d.ts +148 -148
- package/dist/video-client.d.ts +8 -8
- package/dist/video.d.ts +114 -114
- package/package.json +6 -5
|
@@ -3,55 +3,10 @@ import { OpenResponses } from "./open-responses.js";
|
|
|
3
3
|
export declare const protocol: Protocol<{
|
|
4
4
|
readonly model: string;
|
|
5
5
|
readonly input: readonly ({
|
|
6
|
-
readonly [x: string]: unknown;
|
|
7
|
-
readonly type: "web_search_call";
|
|
8
|
-
readonly id: string;
|
|
9
|
-
readonly status?: string | undefined;
|
|
10
|
-
readonly action?: {
|
|
11
|
-
readonly [x: string]: unknown;
|
|
12
|
-
} | null | undefined;
|
|
13
|
-
} | {
|
|
14
|
-
readonly [x: string]: unknown;
|
|
15
|
-
readonly type: "file_search_call";
|
|
16
|
-
readonly id: string;
|
|
17
|
-
readonly status?: string | undefined;
|
|
18
|
-
readonly queries?: readonly string[] | undefined;
|
|
19
|
-
readonly results?: readonly {
|
|
20
|
-
readonly [x: string]: unknown;
|
|
21
|
-
}[] | null | undefined;
|
|
22
|
-
} | {
|
|
23
|
-
readonly [x: string]: unknown;
|
|
24
|
-
readonly type: "code_interpreter_call";
|
|
25
|
-
readonly id: string;
|
|
26
|
-
readonly status?: string | undefined;
|
|
27
|
-
readonly code?: string | null | undefined;
|
|
28
|
-
readonly container_id?: string | null | undefined;
|
|
29
|
-
readonly outputs?: readonly {
|
|
30
|
-
readonly [x: string]: unknown;
|
|
31
|
-
}[] | null | undefined;
|
|
32
|
-
} | {
|
|
33
|
-
readonly [x: string]: unknown;
|
|
34
|
-
readonly type: "mcp_call";
|
|
35
|
-
readonly id: string;
|
|
36
|
-
readonly status?: string | undefined;
|
|
37
|
-
readonly server_label?: string | undefined;
|
|
38
|
-
readonly name?: string | undefined;
|
|
39
|
-
readonly arguments?: string | undefined;
|
|
40
|
-
readonly output?: string | null | undefined;
|
|
41
|
-
readonly error?: unknown;
|
|
42
|
-
} | {
|
|
43
6
|
readonly type: "configuration_update";
|
|
44
7
|
readonly reasoning: {
|
|
45
8
|
readonly effort: import("../schema/options.js").ReasoningEffort;
|
|
46
9
|
};
|
|
47
|
-
} | {
|
|
48
|
-
readonly [x: string]: unknown;
|
|
49
|
-
readonly type: string;
|
|
50
|
-
readonly id: string;
|
|
51
|
-
} | {
|
|
52
|
-
readonly type: "compaction";
|
|
53
|
-
readonly id?: string | null | undefined;
|
|
54
|
-
readonly encrypted_content: string;
|
|
55
10
|
} | {
|
|
56
11
|
readonly type: "message";
|
|
57
12
|
readonly role: "system";
|
|
@@ -60,10 +15,45 @@ export declare const protocol: Protocol<{
|
|
|
60
15
|
readonly type: "message";
|
|
61
16
|
readonly role: "developer";
|
|
62
17
|
readonly content: string;
|
|
18
|
+
} | {
|
|
19
|
+
readonly type: "function_call_output";
|
|
20
|
+
readonly call_id: string;
|
|
21
|
+
readonly output: string | readonly ({
|
|
22
|
+
readonly type: "input_text";
|
|
23
|
+
readonly text: string;
|
|
24
|
+
} | {
|
|
25
|
+
readonly type: "input_video";
|
|
26
|
+
readonly video_url: string;
|
|
27
|
+
} | {
|
|
28
|
+
readonly type: "input_image";
|
|
29
|
+
readonly image_url: string;
|
|
30
|
+
readonly detail?: string | undefined;
|
|
31
|
+
} | {
|
|
32
|
+
readonly type: "input_file";
|
|
33
|
+
readonly filename: string;
|
|
34
|
+
readonly detail?: string | undefined;
|
|
35
|
+
readonly file_data?: string | undefined;
|
|
36
|
+
readonly file_url?: string | undefined;
|
|
37
|
+
})[];
|
|
38
|
+
} | {
|
|
39
|
+
readonly type: "reasoning";
|
|
40
|
+
readonly id?: string | undefined;
|
|
41
|
+
readonly summary: readonly {
|
|
42
|
+
readonly type: "summary_text";
|
|
43
|
+
readonly text: string;
|
|
44
|
+
}[];
|
|
45
|
+
readonly encrypted_content?: string | null | undefined;
|
|
46
|
+
} | {
|
|
47
|
+
readonly type: "compaction";
|
|
48
|
+
readonly id?: string | null | undefined;
|
|
49
|
+
readonly encrypted_content: string;
|
|
63
50
|
} | {
|
|
64
51
|
readonly type: "message";
|
|
65
52
|
readonly role: "user";
|
|
66
53
|
readonly content: readonly ({
|
|
54
|
+
readonly type: "input_text";
|
|
55
|
+
readonly text: string;
|
|
56
|
+
} | {
|
|
67
57
|
readonly type: "input_image";
|
|
68
58
|
readonly image_url: string;
|
|
69
59
|
readonly detail?: string | undefined;
|
|
@@ -73,9 +63,6 @@ export declare const protocol: Protocol<{
|
|
|
73
63
|
readonly detail?: string | undefined;
|
|
74
64
|
readonly file_data?: string | undefined;
|
|
75
65
|
readonly file_url?: string | undefined;
|
|
76
|
-
} | {
|
|
77
|
-
readonly type: "input_text";
|
|
78
|
-
readonly text: string;
|
|
79
66
|
})[];
|
|
80
67
|
readonly id?: string | undefined;
|
|
81
68
|
readonly status?: string | undefined;
|
|
@@ -89,14 +76,6 @@ export declare const protocol: Protocol<{
|
|
|
89
76
|
}[];
|
|
90
77
|
readonly phase?: "commentary" | "final_answer" | null | undefined;
|
|
91
78
|
readonly status?: string | undefined;
|
|
92
|
-
} | {
|
|
93
|
-
readonly type: "reasoning";
|
|
94
|
-
readonly id?: string | undefined;
|
|
95
|
-
readonly summary: readonly {
|
|
96
|
-
readonly type: "summary_text";
|
|
97
|
-
readonly text: string;
|
|
98
|
-
}[];
|
|
99
|
-
readonly encrypted_content?: string | null | undefined;
|
|
100
79
|
} | {
|
|
101
80
|
readonly type: "function_call";
|
|
102
81
|
readonly id?: string | undefined;
|
|
@@ -105,31 +84,49 @@ export declare const protocol: Protocol<{
|
|
|
105
84
|
readonly namespace?: string | undefined;
|
|
106
85
|
readonly arguments: string;
|
|
107
86
|
} | {
|
|
108
|
-
readonly
|
|
109
|
-
readonly
|
|
110
|
-
readonly
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
readonly
|
|
114
|
-
} |
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
readonly
|
|
123
|
-
} |
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
87
|
+
readonly [x: string]: unknown;
|
|
88
|
+
readonly type: "web_search_call";
|
|
89
|
+
readonly id: string;
|
|
90
|
+
readonly status?: string | undefined;
|
|
91
|
+
readonly action?: {
|
|
92
|
+
readonly [x: string]: unknown;
|
|
93
|
+
} | null | undefined;
|
|
94
|
+
} | {
|
|
95
|
+
readonly [x: string]: unknown;
|
|
96
|
+
readonly type: "file_search_call";
|
|
97
|
+
readonly id: string;
|
|
98
|
+
readonly status?: string | undefined;
|
|
99
|
+
readonly queries?: readonly string[] | undefined;
|
|
100
|
+
readonly results?: readonly {
|
|
101
|
+
readonly [x: string]: unknown;
|
|
102
|
+
}[] | null | undefined;
|
|
103
|
+
} | {
|
|
104
|
+
readonly [x: string]: unknown;
|
|
105
|
+
readonly type: "code_interpreter_call";
|
|
106
|
+
readonly id: string;
|
|
107
|
+
readonly status?: string | undefined;
|
|
108
|
+
readonly code?: string | null | undefined;
|
|
109
|
+
readonly container_id?: string | null | undefined;
|
|
110
|
+
readonly outputs?: readonly {
|
|
111
|
+
readonly [x: string]: unknown;
|
|
112
|
+
}[] | null | undefined;
|
|
113
|
+
} | {
|
|
114
|
+
readonly [x: string]: unknown;
|
|
115
|
+
readonly type: "mcp_call";
|
|
116
|
+
readonly id: string;
|
|
117
|
+
readonly status?: string | undefined;
|
|
118
|
+
readonly server_label?: string | undefined;
|
|
119
|
+
readonly name?: string | undefined;
|
|
120
|
+
readonly arguments?: string | undefined;
|
|
121
|
+
readonly output?: string | null | undefined;
|
|
122
|
+
readonly error?: unknown;
|
|
123
|
+
} | {
|
|
124
|
+
readonly [x: string]: unknown;
|
|
125
|
+
readonly type: string;
|
|
126
|
+
readonly id: string;
|
|
127
127
|
})[];
|
|
128
128
|
readonly instructions?: string | undefined;
|
|
129
129
|
readonly tools?: readonly ({
|
|
130
|
-
readonly [x: string]: unknown;
|
|
131
|
-
readonly type: string;
|
|
132
|
-
} | {
|
|
133
130
|
readonly type: "function";
|
|
134
131
|
readonly name: string;
|
|
135
132
|
readonly description: string;
|
|
@@ -137,6 +134,9 @@ export declare const protocol: Protocol<{
|
|
|
137
134
|
readonly [x: string]: unknown;
|
|
138
135
|
};
|
|
139
136
|
readonly strict?: boolean | undefined;
|
|
137
|
+
} | {
|
|
138
|
+
readonly [x: string]: unknown;
|
|
139
|
+
readonly type: string;
|
|
140
140
|
})[] | undefined;
|
|
141
141
|
readonly tool_choice?: "auto" | "none" | "required" | {
|
|
142
142
|
readonly type: "function";
|
|
@@ -1,21 +1,24 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
1
2
|
import { Protocol } from "../route/protocol.js";
|
|
2
3
|
import { OpenAIChat } from "./openai-chat.js";
|
|
3
|
-
|
|
4
|
-
export type
|
|
5
|
-
|
|
6
|
-
readonly
|
|
7
|
-
|
|
4
|
+
import { OpenResponsesOptions } from "./utils/open-responses-options.js";
|
|
5
|
+
export type ReasoningEffort = OpenResponsesOptions.ReasoningEffort;
|
|
6
|
+
declare const Options: Schema.Struct<{
|
|
7
|
+
readonly reasoningEffort: Schema.optional<Schema.declare<OpenResponsesOptions.ReasoningEffort, OpenResponsesOptions.ReasoningEffort>>;
|
|
8
|
+
readonly thinking: Schema.optional<Schema.Struct<{
|
|
9
|
+
readonly type: Schema.optional<Schema.declare<import("../schema/options.js").OpenString<"disabled" | "enabled">, import("../schema/options.js").OpenString<"disabled" | "enabled">>>;
|
|
8
10
|
/** False retains historical reasoning; omission preserves the endpoint's default. */
|
|
9
|
-
readonly clear_thinking
|
|
10
|
-
}
|
|
11
|
-
readonly toolStream
|
|
12
|
-
readonly doSample
|
|
13
|
-
readonly responseFormat
|
|
14
|
-
readonly type: "
|
|
15
|
-
}
|
|
16
|
-
readonly requestID
|
|
17
|
-
readonly userID
|
|
18
|
-
}
|
|
11
|
+
readonly clear_thinking: Schema.optional<Schema.Boolean>;
|
|
12
|
+
}>>;
|
|
13
|
+
readonly toolStream: Schema.optional<Schema.Boolean>;
|
|
14
|
+
readonly doSample: Schema.optional<Schema.Boolean>;
|
|
15
|
+
readonly responseFormat: Schema.optional<Schema.Struct<{
|
|
16
|
+
readonly type: Schema.declare<import("../schema/options.js").OpenString<"json_object" | "text">, import("../schema/options.js").OpenString<"json_object" | "text">>;
|
|
17
|
+
}>>;
|
|
18
|
+
readonly requestID: Schema.optional<Schema.String>;
|
|
19
|
+
readonly userID: Schema.optional<Schema.String>;
|
|
20
|
+
}>;
|
|
21
|
+
export type OptionsInput = typeof Options.Type;
|
|
19
22
|
export declare const compatibility: {
|
|
20
23
|
maxTokensField: "max_tokens";
|
|
21
24
|
supportsStrictMode: false;
|
|
@@ -27,13 +30,6 @@ export declare const protocol: Protocol<{
|
|
|
27
30
|
readonly messages: readonly ({
|
|
28
31
|
readonly role: "system";
|
|
29
32
|
readonly content: string | readonly ({
|
|
30
|
-
readonly type: "text";
|
|
31
|
-
readonly text: string;
|
|
32
|
-
readonly cache_control?: {
|
|
33
|
-
readonly type: "ephemeral";
|
|
34
|
-
readonly ttl?: string | undefined;
|
|
35
|
-
} | undefined;
|
|
36
|
-
} | {
|
|
37
33
|
readonly type: "image_url";
|
|
38
34
|
readonly image_url: {
|
|
39
35
|
readonly url: string;
|
|
@@ -44,17 +40,17 @@ export declare const protocol: Protocol<{
|
|
|
44
40
|
readonly filename: string;
|
|
45
41
|
readonly file_data: string;
|
|
46
42
|
};
|
|
47
|
-
}
|
|
48
|
-
} | {
|
|
49
|
-
readonly role: "user";
|
|
50
|
-
readonly content: string | readonly ({
|
|
43
|
+
} | {
|
|
51
44
|
readonly type: "text";
|
|
52
45
|
readonly text: string;
|
|
53
46
|
readonly cache_control?: {
|
|
54
47
|
readonly type: "ephemeral";
|
|
55
48
|
readonly ttl?: string | undefined;
|
|
56
49
|
} | undefined;
|
|
57
|
-
}
|
|
50
|
+
})[];
|
|
51
|
+
} | {
|
|
52
|
+
readonly role: "user";
|
|
53
|
+
readonly content: string | readonly ({
|
|
58
54
|
readonly type: "image_url";
|
|
59
55
|
readonly image_url: {
|
|
60
56
|
readonly url: string;
|
|
@@ -65,6 +61,13 @@ export declare const protocol: Protocol<{
|
|
|
65
61
|
readonly filename: string;
|
|
66
62
|
readonly file_data: string;
|
|
67
63
|
};
|
|
64
|
+
} | {
|
|
65
|
+
readonly type: "text";
|
|
66
|
+
readonly text: string;
|
|
67
|
+
readonly cache_control?: {
|
|
68
|
+
readonly type: "ephemeral";
|
|
69
|
+
readonly ttl?: string | undefined;
|
|
70
|
+
} | undefined;
|
|
68
71
|
})[];
|
|
69
72
|
} | {
|
|
70
73
|
readonly role: "tool";
|
|
@@ -133,7 +136,7 @@ export declare const protocol: Protocol<{
|
|
|
133
136
|
} | undefined;
|
|
134
137
|
readonly store?: boolean | undefined;
|
|
135
138
|
readonly prompt_cache_key?: string | undefined;
|
|
136
|
-
readonly reasoning_effort?:
|
|
139
|
+
readonly reasoning_effort?: OpenResponsesOptions.ReasoningEffort | undefined;
|
|
137
140
|
readonly tool_stream?: boolean | undefined;
|
|
138
141
|
readonly max_completion_tokens?: number | undefined;
|
|
139
142
|
readonly max_tokens?: number | undefined;
|
|
@@ -144,12 +147,12 @@ export declare const protocol: Protocol<{
|
|
|
144
147
|
readonly seed?: number | undefined;
|
|
145
148
|
readonly stop?: readonly string[] | undefined;
|
|
146
149
|
readonly thinking?: {
|
|
147
|
-
readonly type?:
|
|
150
|
+
readonly type?: import("../schema/options.js").OpenString<"disabled" | "enabled"> | undefined;
|
|
148
151
|
readonly clear_thinking?: boolean | undefined;
|
|
149
152
|
} | undefined;
|
|
150
153
|
readonly do_sample?: boolean | undefined;
|
|
151
154
|
readonly response_format?: {
|
|
152
|
-
readonly type:
|
|
155
|
+
readonly type: import("../schema/options.js").OpenString<"json_object" | "text">;
|
|
153
156
|
} | undefined;
|
|
154
157
|
readonly request_id?: string | undefined;
|
|
155
158
|
readonly user_id?: string | undefined;
|
|
@@ -2,12 +2,17 @@ import { Effect, Schema } from "effect";
|
|
|
2
2
|
import { Protocol } from "../route/protocol.js";
|
|
3
3
|
import { OpenAIChat } from "./openai-chat.js";
|
|
4
4
|
import { ProviderShared } from "./shared.js";
|
|
5
|
+
import { OpenResponsesOptions } from "./utils/open-responses-options.js";
|
|
5
6
|
const Options = Schema.Struct({
|
|
6
|
-
reasoningEffort: Schema.optional(
|
|
7
|
-
thinking: Schema.optional(Schema.Struct({
|
|
7
|
+
reasoningEffort: Schema.optional(OpenResponsesOptions.ReasoningEffort),
|
|
8
|
+
thinking: Schema.optional(Schema.Struct({
|
|
9
|
+
type: Schema.optional(ProviderShared.knownString()),
|
|
10
|
+
/** False retains historical reasoning; omission preserves the endpoint's default. */
|
|
11
|
+
clear_thinking: Schema.optional(Schema.Boolean),
|
|
12
|
+
})),
|
|
8
13
|
toolStream: Schema.optional(Schema.Boolean),
|
|
9
14
|
doSample: Schema.optional(Schema.Boolean),
|
|
10
|
-
responseFormat: Schema.optional(Schema.Struct({ type:
|
|
15
|
+
responseFormat: Schema.optional(Schema.Struct({ type: ProviderShared.knownString() })),
|
|
11
16
|
requestID: Schema.optional(Schema.String),
|
|
12
17
|
userID: Schema.optional(Schema.String),
|
|
13
18
|
});
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
1
2
|
import { Protocol } from "../route/protocol.js";
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
readonly effort
|
|
5
|
-
readonly thinking
|
|
6
|
-
readonly type: "
|
|
7
|
-
}
|
|
8
|
-
}
|
|
3
|
+
import { OpenResponsesOptions } from "./utils/open-responses-options.js";
|
|
4
|
+
declare const Options: Schema.Struct<{
|
|
5
|
+
readonly effort: Schema.optional<Schema.declare<OpenResponsesOptions.ReasoningEffort, OpenResponsesOptions.ReasoningEffort>>;
|
|
6
|
+
readonly thinking: Schema.optional<Schema.Struct<{
|
|
7
|
+
readonly type: Schema.declare<import("../schema/options.js").OpenString<"adaptive" | "disabled" | "enabled">, import("../schema/options.js").OpenString<"adaptive" | "disabled" | "enabled">>;
|
|
8
|
+
}>>;
|
|
9
|
+
}>;
|
|
10
|
+
export type OptionsInput = typeof Options.Type;
|
|
9
11
|
export declare const protocol: Protocol<{
|
|
10
12
|
readonly context_management?: {
|
|
11
13
|
readonly edits: readonly {
|
|
@@ -148,23 +150,15 @@ export declare const protocol: Protocol<{
|
|
|
148
150
|
} | {
|
|
149
151
|
readonly role: "assistant";
|
|
150
152
|
readonly content: readonly ({
|
|
153
|
+
readonly type: "compaction";
|
|
154
|
+
readonly content: string | null;
|
|
155
|
+
} | {
|
|
151
156
|
readonly type: "text";
|
|
152
157
|
readonly text: string;
|
|
153
158
|
readonly cache_control?: {
|
|
154
159
|
readonly type: "ephemeral";
|
|
155
160
|
readonly ttl?: "1h" | "5m" | undefined;
|
|
156
161
|
} | undefined;
|
|
157
|
-
} | {
|
|
158
|
-
readonly type: "code_execution_tool_result" | "web_fetch_tool_result" | "web_search_tool_result";
|
|
159
|
-
readonly tool_use_id: string;
|
|
160
|
-
readonly content: unknown;
|
|
161
|
-
readonly cache_control?: {
|
|
162
|
-
readonly type: "ephemeral";
|
|
163
|
-
readonly ttl?: "1h" | "5m" | undefined;
|
|
164
|
-
} | undefined;
|
|
165
|
-
} | {
|
|
166
|
-
readonly type: "compaction";
|
|
167
|
-
readonly content: string | null;
|
|
168
162
|
} | {
|
|
169
163
|
readonly type: "thinking";
|
|
170
164
|
readonly thinking: string;
|
|
@@ -198,6 +192,14 @@ export declare const protocol: Protocol<{
|
|
|
198
192
|
readonly type: "ephemeral";
|
|
199
193
|
readonly ttl?: "1h" | "5m" | undefined;
|
|
200
194
|
} | undefined;
|
|
195
|
+
} | {
|
|
196
|
+
readonly type: "code_execution_tool_result" | "web_fetch_tool_result" | "web_search_tool_result";
|
|
197
|
+
readonly tool_use_id: string;
|
|
198
|
+
readonly content: unknown;
|
|
199
|
+
readonly cache_control?: {
|
|
200
|
+
readonly type: "ephemeral";
|
|
201
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
202
|
+
} | undefined;
|
|
201
203
|
})[];
|
|
202
204
|
} | {
|
|
203
205
|
readonly role: "system";
|
|
@@ -263,7 +265,7 @@ export declare const protocol: Protocol<{
|
|
|
263
265
|
} | undefined;
|
|
264
266
|
readonly service_tier?: import("../schema/options.js").OpenString<"auto" | "standard_only"> | undefined;
|
|
265
267
|
readonly thinking?: {
|
|
266
|
-
readonly type:
|
|
268
|
+
readonly type: import("../schema/options.js").OpenString<"adaptive" | "disabled" | "enabled">;
|
|
267
269
|
} | undefined;
|
|
268
270
|
}, string, {
|
|
269
271
|
readonly [x: string]: unknown;
|
|
@@ -3,9 +3,10 @@ import { Protocol } from "../route/protocol.js";
|
|
|
3
3
|
import { LLMRequest } from "../schema/index.js";
|
|
4
4
|
import { AnthropicMessages } from "./anthropic-messages.js";
|
|
5
5
|
import { ProviderShared } from "./shared.js";
|
|
6
|
+
import { OpenResponsesOptions } from "./utils/open-responses-options.js";
|
|
6
7
|
const Options = Schema.Struct({
|
|
7
|
-
effort: Schema.optional(
|
|
8
|
-
thinking: Schema.optional(Schema.Struct({ type:
|
|
8
|
+
effort: Schema.optional(OpenResponsesOptions.ReasoningEffort),
|
|
9
|
+
thinking: Schema.optional(Schema.Struct({ type: ProviderShared.knownString() })),
|
|
9
10
|
});
|
|
10
11
|
const Body = Schema.Struct({
|
|
11
12
|
...AnthropicMessages.AnthropicMessagesBody.fields,
|
package/dist/provider-error.js
CHANGED
|
@@ -4,7 +4,9 @@ import { Json } from "./utils/json.js";
|
|
|
4
4
|
import { isRecord } from "./utils/record.js";
|
|
5
5
|
const patterns = [
|
|
6
6
|
/prompt is too long/i,
|
|
7
|
-
/input is too long for requested model/i,
|
|
7
|
+
/input is too long for (?:the )?(?:requested|selected) model/i,
|
|
8
|
+
// OpenCode Go
|
|
9
|
+
/too large for the model'?s configured input limit/i,
|
|
8
10
|
// Cloudflare Workers AI reports this as HTTP 413.
|
|
9
11
|
/exceeded this model context window limit/i,
|
|
10
12
|
/exceeds the context window/i,
|
|
@@ -31,8 +33,8 @@ const patterns = [
|
|
|
31
33
|
/context[_ ]length[_ ]exceeded/i,
|
|
32
34
|
/context length is only \d+ tokens/i,
|
|
33
35
|
/input length.*exceeds.*context length/i,
|
|
34
|
-
// Z.ai code 1261 arrives as `Prompt too long` or `Prompt 超长`.
|
|
35
|
-
/prompt (?:too long|超长)/i,
|
|
36
|
+
// Z.ai code 1261 arrives as `Prompt too long`, `Prompt exceeds max length` or `Prompt 超长`.
|
|
37
|
+
/prompt (?:too long|exceeds max length|超长)/i,
|
|
36
38
|
/too large for model with \d+ maximum context length/i,
|
|
37
39
|
/prompt has [\d,]+ tokens?, but the configured context size is [\d,]+ tokens?/i,
|
|
38
40
|
/model_context_window_exceeded/i,
|
|
@@ -28,13 +28,6 @@ export declare const routes: (Route<{
|
|
|
28
28
|
readonly messages: readonly ({
|
|
29
29
|
readonly role: "system";
|
|
30
30
|
readonly content: string | readonly ({
|
|
31
|
-
readonly type: "text";
|
|
32
|
-
readonly text: string;
|
|
33
|
-
readonly cache_control?: {
|
|
34
|
-
readonly type: "ephemeral";
|
|
35
|
-
readonly ttl?: string | undefined;
|
|
36
|
-
} | undefined;
|
|
37
|
-
} | {
|
|
38
31
|
readonly type: "image_url";
|
|
39
32
|
readonly image_url: {
|
|
40
33
|
readonly url: string;
|
|
@@ -45,17 +38,17 @@ export declare const routes: (Route<{
|
|
|
45
38
|
readonly filename: string;
|
|
46
39
|
readonly file_data: string;
|
|
47
40
|
};
|
|
48
|
-
}
|
|
49
|
-
} | {
|
|
50
|
-
readonly role: "user";
|
|
51
|
-
readonly content: string | readonly ({
|
|
41
|
+
} | {
|
|
52
42
|
readonly type: "text";
|
|
53
43
|
readonly text: string;
|
|
54
44
|
readonly cache_control?: {
|
|
55
45
|
readonly type: "ephemeral";
|
|
56
46
|
readonly ttl?: string | undefined;
|
|
57
47
|
} | undefined;
|
|
58
|
-
}
|
|
48
|
+
})[];
|
|
49
|
+
} | {
|
|
50
|
+
readonly role: "user";
|
|
51
|
+
readonly content: string | readonly ({
|
|
59
52
|
readonly type: "image_url";
|
|
60
53
|
readonly image_url: {
|
|
61
54
|
readonly url: string;
|
|
@@ -66,6 +59,13 @@ export declare const routes: (Route<{
|
|
|
66
59
|
readonly filename: string;
|
|
67
60
|
readonly file_data: string;
|
|
68
61
|
};
|
|
62
|
+
} | {
|
|
63
|
+
readonly type: "text";
|
|
64
|
+
readonly text: string;
|
|
65
|
+
readonly cache_control?: {
|
|
66
|
+
readonly type: "ephemeral";
|
|
67
|
+
readonly ttl?: string | undefined;
|
|
68
|
+
} | undefined;
|
|
69
69
|
})[];
|
|
70
70
|
} | {
|
|
71
71
|
readonly role: "tool";
|
|
@@ -308,12 +308,30 @@ export declare const routes: (Route<{
|
|
|
308
308
|
} | {
|
|
309
309
|
readonly role: "assistant";
|
|
310
310
|
readonly content: readonly ({
|
|
311
|
+
readonly type: "compaction";
|
|
312
|
+
readonly content: string | null;
|
|
313
|
+
} | {
|
|
311
314
|
readonly type: "text";
|
|
312
315
|
readonly text: string;
|
|
313
316
|
readonly cache_control?: {
|
|
314
317
|
readonly type: "ephemeral";
|
|
315
318
|
readonly ttl?: "1h" | "5m" | undefined;
|
|
316
319
|
} | undefined;
|
|
320
|
+
} | {
|
|
321
|
+
readonly type: "thinking";
|
|
322
|
+
readonly thinking: string;
|
|
323
|
+
readonly signature: string;
|
|
324
|
+
readonly cache_control?: {
|
|
325
|
+
readonly type: "ephemeral";
|
|
326
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
327
|
+
} | undefined;
|
|
328
|
+
} | {
|
|
329
|
+
readonly type: "redacted_thinking";
|
|
330
|
+
readonly data: string;
|
|
331
|
+
readonly cache_control?: {
|
|
332
|
+
readonly type: "ephemeral";
|
|
333
|
+
readonly ttl?: "1h" | "5m" | undefined;
|
|
334
|
+
} | undefined;
|
|
317
335
|
} | {
|
|
318
336
|
readonly type: "tool_use";
|
|
319
337
|
readonly id: string;
|
|
@@ -340,24 +358,6 @@ export declare const routes: (Route<{
|
|
|
340
358
|
readonly type: "ephemeral";
|
|
341
359
|
readonly ttl?: "1h" | "5m" | undefined;
|
|
342
360
|
} | undefined;
|
|
343
|
-
} | {
|
|
344
|
-
readonly type: "compaction";
|
|
345
|
-
readonly content: string | null;
|
|
346
|
-
} | {
|
|
347
|
-
readonly type: "thinking";
|
|
348
|
-
readonly thinking: string;
|
|
349
|
-
readonly signature: string;
|
|
350
|
-
readonly cache_control?: {
|
|
351
|
-
readonly type: "ephemeral";
|
|
352
|
-
readonly ttl?: "1h" | "5m" | undefined;
|
|
353
|
-
} | undefined;
|
|
354
|
-
} | {
|
|
355
|
-
readonly type: "redacted_thinking";
|
|
356
|
-
readonly data: string;
|
|
357
|
-
readonly cache_control?: {
|
|
358
|
-
readonly type: "ephemeral";
|
|
359
|
-
readonly ttl?: "1h" | "5m" | undefined;
|
|
360
|
-
} | undefined;
|
|
361
361
|
})[];
|
|
362
362
|
} | {
|
|
363
363
|
readonly role: "system";
|
|
@@ -429,14 +429,6 @@ export declare const routes: (Route<{
|
|
|
429
429
|
}, import("../route/transport/http.js").HttpPrepared<string>, import("../route/client.js").CompactionOperations | undefined> | Route<{
|
|
430
430
|
readonly model: string;
|
|
431
431
|
readonly input: readonly ({
|
|
432
|
-
readonly [x: string]: unknown;
|
|
433
|
-
readonly type: string;
|
|
434
|
-
readonly id: string;
|
|
435
|
-
} | {
|
|
436
|
-
readonly type: "compaction";
|
|
437
|
-
readonly id?: string | null | undefined;
|
|
438
|
-
readonly encrypted_content: string;
|
|
439
|
-
} | {
|
|
440
432
|
readonly type: "configuration_update";
|
|
441
433
|
readonly reasoning: {
|
|
442
434
|
readonly effort: import("../schema/options.js").ReasoningEffort;
|
|
@@ -449,10 +441,45 @@ export declare const routes: (Route<{
|
|
|
449
441
|
readonly type: "message";
|
|
450
442
|
readonly role: "developer";
|
|
451
443
|
readonly content: string;
|
|
444
|
+
} | {
|
|
445
|
+
readonly type: "function_call_output";
|
|
446
|
+
readonly call_id: string;
|
|
447
|
+
readonly output: string | readonly ({
|
|
448
|
+
readonly type: "input_text";
|
|
449
|
+
readonly text: string;
|
|
450
|
+
} | {
|
|
451
|
+
readonly type: "input_video";
|
|
452
|
+
readonly video_url: string;
|
|
453
|
+
} | {
|
|
454
|
+
readonly type: "input_image";
|
|
455
|
+
readonly image_url: string;
|
|
456
|
+
readonly detail?: string | undefined;
|
|
457
|
+
} | {
|
|
458
|
+
readonly type: "input_file";
|
|
459
|
+
readonly filename: string;
|
|
460
|
+
readonly detail?: string | undefined;
|
|
461
|
+
readonly file_data?: string | undefined;
|
|
462
|
+
readonly file_url?: string | undefined;
|
|
463
|
+
})[];
|
|
464
|
+
} | {
|
|
465
|
+
readonly type: "reasoning";
|
|
466
|
+
readonly id?: string | undefined;
|
|
467
|
+
readonly summary: readonly {
|
|
468
|
+
readonly type: "summary_text";
|
|
469
|
+
readonly text: string;
|
|
470
|
+
}[];
|
|
471
|
+
readonly encrypted_content?: string | null | undefined;
|
|
472
|
+
} | {
|
|
473
|
+
readonly type: "compaction";
|
|
474
|
+
readonly id?: string | null | undefined;
|
|
475
|
+
readonly encrypted_content: string;
|
|
452
476
|
} | {
|
|
453
477
|
readonly type: "message";
|
|
454
478
|
readonly role: "user";
|
|
455
479
|
readonly content: readonly ({
|
|
480
|
+
readonly type: "input_text";
|
|
481
|
+
readonly text: string;
|
|
482
|
+
} | {
|
|
456
483
|
readonly type: "input_image";
|
|
457
484
|
readonly image_url: string;
|
|
458
485
|
readonly detail?: string | undefined;
|
|
@@ -462,9 +489,6 @@ export declare const routes: (Route<{
|
|
|
462
489
|
readonly detail?: string | undefined;
|
|
463
490
|
readonly file_data?: string | undefined;
|
|
464
491
|
readonly file_url?: string | undefined;
|
|
465
|
-
} | {
|
|
466
|
-
readonly type: "input_text";
|
|
467
|
-
readonly text: string;
|
|
468
492
|
})[];
|
|
469
493
|
readonly id?: string | undefined;
|
|
470
494
|
readonly status?: string | undefined;
|
|
@@ -478,14 +502,6 @@ export declare const routes: (Route<{
|
|
|
478
502
|
}[];
|
|
479
503
|
readonly phase?: "commentary" | "final_answer" | null | undefined;
|
|
480
504
|
readonly status?: string | undefined;
|
|
481
|
-
} | {
|
|
482
|
-
readonly type: "reasoning";
|
|
483
|
-
readonly id?: string | undefined;
|
|
484
|
-
readonly summary: readonly {
|
|
485
|
-
readonly type: "summary_text";
|
|
486
|
-
readonly text: string;
|
|
487
|
-
}[];
|
|
488
|
-
readonly encrypted_content?: string | null | undefined;
|
|
489
505
|
} | {
|
|
490
506
|
readonly type: "function_call";
|
|
491
507
|
readonly id?: string | undefined;
|
|
@@ -493,26 +509,6 @@ export declare const routes: (Route<{
|
|
|
493
509
|
readonly name: string;
|
|
494
510
|
readonly namespace?: string | undefined;
|
|
495
511
|
readonly arguments: string;
|
|
496
|
-
} | {
|
|
497
|
-
readonly type: "function_call_output";
|
|
498
|
-
readonly call_id: string;
|
|
499
|
-
readonly output: string | readonly ({
|
|
500
|
-
readonly type: "input_image";
|
|
501
|
-
readonly image_url: string;
|
|
502
|
-
readonly detail?: string | undefined;
|
|
503
|
-
} | {
|
|
504
|
-
readonly type: "input_file";
|
|
505
|
-
readonly filename: string;
|
|
506
|
-
readonly detail?: string | undefined;
|
|
507
|
-
readonly file_data?: string | undefined;
|
|
508
|
-
readonly file_url?: string | undefined;
|
|
509
|
-
} | {
|
|
510
|
-
readonly type: "input_text";
|
|
511
|
-
readonly text: string;
|
|
512
|
-
} | {
|
|
513
|
-
readonly type: "input_video";
|
|
514
|
-
readonly video_url: string;
|
|
515
|
-
})[];
|
|
516
512
|
} | {
|
|
517
513
|
readonly [x: string]: unknown;
|
|
518
514
|
readonly type: "web_search_call";
|
|
@@ -550,6 +546,10 @@ export declare const routes: (Route<{
|
|
|
550
546
|
readonly arguments?: string | undefined;
|
|
551
547
|
readonly output?: string | null | undefined;
|
|
552
548
|
readonly error?: unknown;
|
|
549
|
+
} | {
|
|
550
|
+
readonly [x: string]: unknown;
|
|
551
|
+
readonly type: string;
|
|
552
|
+
readonly id: string;
|
|
553
553
|
})[];
|
|
554
554
|
readonly instructions?: string | undefined;
|
|
555
555
|
readonly tools?: readonly ({
|