@opencode/ai 0.0.0-dev-1155 → 0.0.0-dev-1169
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/provider-error.js
CHANGED
|
@@ -120,7 +120,7 @@ const RATE_LIMIT_TEXT = /rate increased too quickly|rate[-_\s]?limit|too[_\s]?ma
|
|
|
120
120
|
// Only consulted on 429, where throttles and account caps share a status.
|
|
121
121
|
// Z.ai reports balance, plan expiry, plan limits, and plan model access on 429.
|
|
122
122
|
// Cerebras reports its per-minute token throttle as `token_quota_exceeded`; that is a rate limit.
|
|
123
|
-
const QUOTA_TEXT = /insufficient[-_\s]?(?:quota|balance)|(?<!token_)quota[-_\s]?exceeded|budget exceeded|usage limit|limit exhausted|package has expired|plan does not yet include/i;
|
|
123
|
+
const QUOTA_TEXT = /insufficient[-_\s]?(?:quota|balance)|(?<!token_)quota[-_\s]?exceeded|budget exceeded|usage limit|(?<!rate[-_\s]?)limit exhausted|package has expired|plan does not yet include/i;
|
|
124
124
|
// Policy rejections without a dedicated code, matched against the provider's own
|
|
125
125
|
// explanation only. OpenAI reuses `invalid_prompt` for usage-policy rejections while
|
|
126
126
|
// Bedrock Mantle reuses it for schema validation; Anthropic reports blocked output
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { decisionModel as model } from "../openai-compatible.js";
|
|
@@ -194,6 +194,7 @@ export declare const configure: (input: Config) => {
|
|
|
194
194
|
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, import("../route.js").CompactionOperations | undefined>;
|
|
195
195
|
image: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../image.js").ImageModel<import("../protocols/openai-images.js").OpenAIImageOptions>;
|
|
196
196
|
embedding: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../embedding.js").EmbeddingModel<OpenAIEmbeddingOptionsInput>;
|
|
197
|
+
decision: (modelID: string | ModelID, providerOptions?: ProviderOptions) => import("../decision.js").DecisionModel<import("../decision.js").DecisionOptions>;
|
|
197
198
|
configure: typeof configure;
|
|
198
199
|
};
|
|
199
200
|
export declare const provider: {
|
|
@@ -203,4 +204,5 @@ export declare const provider: {
|
|
|
203
204
|
export declare const model: ProviderPackage.Model<Settings, OpenAIProviderOptionsInput>;
|
|
204
205
|
export declare const imageModel: (modelID: string, settings: Settings) => import("../image.js").ImageModel<import("../protocols/openai-images.js").OpenAIImageOptions>;
|
|
205
206
|
export declare const embeddingModel: (modelID: string, settings: Settings) => import("../embedding.js").EmbeddingModel<OpenAIEmbeddingOptionsInput>;
|
|
207
|
+
export declare const decisionModel: (modelID: string, settings: Settings) => import("../decision.js").DecisionModel<import("../decision.js").DecisionOptions>;
|
|
206
208
|
export * as OpenAICompatible from "./openai-compatible.js";
|
|
@@ -2,6 +2,7 @@ import { mergeProviderOptions, ProviderID, } from "../schema/index.js";
|
|
|
2
2
|
import { OpenAICompatibleChat } from "../protocols/openai-compatible-chat.js";
|
|
3
3
|
import { OpenAIEmbeddings } from "../protocols/openai-embeddings.js";
|
|
4
4
|
import { OpenAIImages } from "../protocols/openai-images.js";
|
|
5
|
+
import { SystemOne } from "../protocols/system-one.js";
|
|
5
6
|
import { MediaRoute } from "../route/media.js";
|
|
6
7
|
import { AuthOptions } from "../route/auth-options.js";
|
|
7
8
|
import { toConfig } from "./settings.js";
|
|
@@ -25,6 +26,13 @@ export const configure = (input) => {
|
|
|
25
26
|
headers: input.headers,
|
|
26
27
|
http: input.http,
|
|
27
28
|
});
|
|
29
|
+
const decisionRoute = SystemOne.route.with({
|
|
30
|
+
provider,
|
|
31
|
+
endpoint: { baseURL },
|
|
32
|
+
auth,
|
|
33
|
+
headers: input.headers,
|
|
34
|
+
http: input.http,
|
|
35
|
+
});
|
|
28
36
|
return {
|
|
29
37
|
id: ProviderID.make(provider),
|
|
30
38
|
model: (modelID) => route.model({ id: modelID }),
|
|
@@ -37,6 +45,8 @@ export const configure = (input) => {
|
|
|
37
45
|
providerOptions: mergeProviderOptions(/gpt-image|chatgpt-image/.test(modelID) ? undefined : { response_format: "b64_json" }, providerOptions),
|
|
38
46
|
}),
|
|
39
47
|
embedding: (modelID, providerOptions) => embeddingRoute.model({ id: modelID, providerOptions }),
|
|
48
|
+
// Compatible hosts follow llama.cpp's System One API, which takes inline media in root `images` (alias of `files`).
|
|
49
|
+
decision: (modelID, providerOptions) => decisionRoute.model({ id: modelID, compatibility: { mediaInput: "root" }, providerOptions }),
|
|
40
50
|
configure,
|
|
41
51
|
};
|
|
42
52
|
};
|
|
@@ -53,6 +63,10 @@ export const embeddingModel = (modelID, settings) => {
|
|
|
53
63
|
const input = config(settings);
|
|
54
64
|
return configure(input).embedding(modelID, input.providerOptions);
|
|
55
65
|
};
|
|
66
|
+
export const decisionModel = (modelID, settings) => {
|
|
67
|
+
const input = config(settings);
|
|
68
|
+
return configure(input).decision(modelID, input.providerOptions);
|
|
69
|
+
};
|
|
56
70
|
function config({ provider, ...settings }) {
|
|
57
71
|
return { ...toConfig(settings), provider };
|
|
58
72
|
}
|
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-1169",
|
|
4
4
|
"name": "@opencode/ai",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -348,6 +348,10 @@
|
|
|
348
348
|
"types": "./dist/providers/openai-compatible-responses.d.ts",
|
|
349
349
|
"import": "./dist/providers/openai-compatible-responses.js"
|
|
350
350
|
},
|
|
351
|
+
"./providers/openai-compatible/decisions": {
|
|
352
|
+
"types": "./dist/providers/openai-compatible/decisions.d.ts",
|
|
353
|
+
"import": "./dist/providers/openai-compatible/decisions.js"
|
|
354
|
+
},
|
|
351
355
|
"./providers/openai-compatible/embeddings": {
|
|
352
356
|
"types": "./dist/providers/openai-compatible/embeddings.d.ts",
|
|
353
357
|
"import": "./dist/providers/openai-compatible/embeddings.js"
|
|
@@ -572,7 +576,7 @@
|
|
|
572
576
|
"devDependencies": {
|
|
573
577
|
"@clack/prompts": "1.0.0-alpha.1",
|
|
574
578
|
"@effect/platform-node": "4.1.0",
|
|
575
|
-
"@opencode/http-recorder": "0.0.0-dev-
|
|
579
|
+
"@opencode/http-recorder": "0.0.0-dev-1169",
|
|
576
580
|
"@tsconfig/bun": "1.0.9",
|
|
577
581
|
"@types/bun": "1.4.3",
|
|
578
582
|
"@typescript/native": "npm:typescript@7.1.0-beta",
|
|
@@ -582,7 +586,7 @@
|
|
|
582
586
|
"@aws-sdk/credential-providers": "3.1057.0",
|
|
583
587
|
"@smithy/eventstream-codec": "4.2.14",
|
|
584
588
|
"@smithy/util-utf8": "4.2.2",
|
|
585
|
-
"@opencode/schema": "0.0.0-dev-
|
|
589
|
+
"@opencode/schema": "0.0.0-dev-1169",
|
|
586
590
|
"aws4fetch": "1.0.20",
|
|
587
591
|
"effect": "4.1.0",
|
|
588
592
|
"google-auth-library": "10.5.0"
|