@opencode/ai 0.0.0-dev-20855 → 0.0.0-dev-20857
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/protocols/alibaba-chat.d.ts +2 -2
- package/dist/protocols/alibaba-messages.d.ts +1 -1
- package/dist/protocols/mistral-chat.js +3 -1
- package/dist/protocols/shared.d.ts +1 -0
- package/dist/protocols/shared.js +4 -1
- package/dist/providers/alibaba.d.ts +5 -5
- package/dist/schema/options.js +3 -2
- package/package.json +3 -3
|
@@ -10,7 +10,7 @@ declare const Options: Schema.Struct<{
|
|
|
10
10
|
readonly preserveThinking: Schema.optional<Schema.Boolean>;
|
|
11
11
|
readonly clearThinking: Schema.optional<Schema.Boolean>;
|
|
12
12
|
readonly thinking: Schema.optional<Schema.Struct<{
|
|
13
|
-
readonly type: Schema.declare<
|
|
13
|
+
readonly type: Schema.declare<(string & {}) | "disabled" | "adaptive", (string & {}) | "disabled" | "adaptive">;
|
|
14
14
|
}>>;
|
|
15
15
|
readonly toolStream: Schema.optional<Schema.Boolean>;
|
|
16
16
|
readonly parallelToolCalls: Schema.optional<Schema.Boolean>;
|
|
@@ -140,7 +140,7 @@ export declare const protocol: Protocol<{
|
|
|
140
140
|
readonly temperature?: number | undefined;
|
|
141
141
|
readonly seed?: number | undefined;
|
|
142
142
|
readonly thinking?: {
|
|
143
|
-
readonly type:
|
|
143
|
+
readonly type: (string & {}) | "disabled" | "adaptive";
|
|
144
144
|
} | undefined;
|
|
145
145
|
readonly tool_choice?: "required" | "auto" | "none" | {
|
|
146
146
|
readonly type: "function";
|
|
@@ -5,7 +5,7 @@ import { OpenResponsesOptions } from "./utils/open-responses-options.js";
|
|
|
5
5
|
declare const Options: Schema.Struct<{
|
|
6
6
|
readonly effort: Schema.optional<Schema.declare<OpenResponsesOptions.ReasoningEffort, OpenResponsesOptions.ReasoningEffort>>;
|
|
7
7
|
readonly thinking: Schema.optional<Schema.Struct<{
|
|
8
|
-
readonly type: Schema.declare<"enabled" | "disabled"
|
|
8
|
+
readonly type: Schema.declare<(string & {}) | "enabled" | "disabled", (string & {}) | "enabled" | "disabled">;
|
|
9
9
|
readonly budgetTokens: Schema.optional<Schema.Int>;
|
|
10
10
|
readonly budget_tokens: Schema.optional<Schema.Int>;
|
|
11
11
|
}>>;
|
|
@@ -317,7 +317,9 @@ export const fromRequest = Effect.fn("MistralChat.fromRequest")(function* (reque
|
|
|
317
317
|
frequency_penalty: request.generation?.frequencyPenalty,
|
|
318
318
|
presence_penalty: request.generation?.presencePenalty,
|
|
319
319
|
stop: request.generation?.stop,
|
|
320
|
-
prompt_cache_key:
|
|
320
|
+
prompt_cache_key: ProviderShared.sendsPromptCacheKey(request)
|
|
321
|
+
? (options.promptCacheKey ?? request.promptCacheKey)
|
|
322
|
+
: undefined,
|
|
321
323
|
safe_prompt: options.safePrompt,
|
|
322
324
|
document_image_limit: options.documentImageLimit,
|
|
323
325
|
document_page_limit: options.documentPageLimit,
|
|
@@ -14,6 +14,7 @@ export declare const lenient: <const S extends Schema.Top>(schema: S) => Schema.
|
|
|
14
14
|
/** Provider-defined string enum: known values for autocomplete, any string accepted at runtime. */
|
|
15
15
|
export declare const knownString: <Known extends string>() => Schema.declare<OpenString<Known>, OpenString<Known>>;
|
|
16
16
|
export declare const OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH = 64;
|
|
17
|
+
export declare const sendsPromptCacheKey: (request: LLMRequest) => boolean;
|
|
17
18
|
export declare const promptCacheKey: (request: LLMRequest) => string | undefined;
|
|
18
19
|
/**
|
|
19
20
|
* Streaming tool-call accumulator. Adapters that build a tool call across
|
package/dist/protocols/shared.js
CHANGED
|
@@ -17,10 +17,13 @@ export const knownString = () => Schema.declare((value) => typeof value === "str
|
|
|
17
17
|
expected: "string",
|
|
18
18
|
});
|
|
19
19
|
export const OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH = 64;
|
|
20
|
+
// Body-level `prompt_cache_key` is off when caching is disabled or the model
|
|
21
|
+
// explicitly rejects the field. Header-based affinity is unaffected.
|
|
22
|
+
export const sendsPromptCacheKey = (request) => request.cache !== "none" && request.model.compatibility?.supportsPromptCacheKey !== false;
|
|
20
23
|
// OpenAI limits `prompt_cache_key` to 64 chars; DeepSeek and Zai inherit the same
|
|
21
24
|
// limit via their OpenAI-compatible APIs. Clamp with unicode-aware slicing.
|
|
22
25
|
export const promptCacheKey = (request) => {
|
|
23
|
-
if (request
|
|
26
|
+
if (!sendsPromptCacheKey(request) || request.promptCacheKey === undefined)
|
|
24
27
|
return undefined;
|
|
25
28
|
const chars = Array.from(request.promptCacheKey);
|
|
26
29
|
if (chars.length <= OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH)
|
|
@@ -129,7 +129,7 @@ export declare const routes: (Route<{
|
|
|
129
129
|
readonly temperature?: number | undefined;
|
|
130
130
|
readonly seed?: number | undefined;
|
|
131
131
|
readonly thinking?: {
|
|
132
|
-
readonly type:
|
|
132
|
+
readonly type: (string & {}) | "disabled" | "adaptive";
|
|
133
133
|
} | undefined;
|
|
134
134
|
readonly tool_choice?: "required" | "auto" | "none" | {
|
|
135
135
|
readonly type: "function";
|
|
@@ -611,7 +611,7 @@ export declare const configure: (input: Config) => {
|
|
|
611
611
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
612
612
|
model: (id: string | ModelID) => import("../schema/options.js").LanguageModel<{
|
|
613
613
|
readonly thinking?: {
|
|
614
|
-
readonly type:
|
|
614
|
+
readonly type: (string & {}) | "disabled" | "adaptive";
|
|
615
615
|
} | undefined;
|
|
616
616
|
readonly thinkingBudget?: number | undefined;
|
|
617
617
|
readonly parallelToolCalls?: boolean | undefined;
|
|
@@ -636,7 +636,7 @@ export declare const configure: (input: Config) => {
|
|
|
636
636
|
}, import("../route/client.js").CompactionOperations | undefined>;
|
|
637
637
|
chat: (id: string | ModelID) => import("../schema/options.js").LanguageModel<{
|
|
638
638
|
readonly thinking?: {
|
|
639
|
-
readonly type:
|
|
639
|
+
readonly type: (string & {}) | "disabled" | "adaptive";
|
|
640
640
|
} | undefined;
|
|
641
641
|
readonly thinkingBudget?: number | undefined;
|
|
642
642
|
readonly parallelToolCalls?: boolean | undefined;
|
|
@@ -675,7 +675,7 @@ export declare const provider: {
|
|
|
675
675
|
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
676
676
|
model: (id: string | ModelID) => import("../schema/options.js").LanguageModel<{
|
|
677
677
|
readonly thinking?: {
|
|
678
|
-
readonly type:
|
|
678
|
+
readonly type: (string & {}) | "disabled" | "adaptive";
|
|
679
679
|
} | undefined;
|
|
680
680
|
readonly thinkingBudget?: number | undefined;
|
|
681
681
|
readonly parallelToolCalls?: boolean | undefined;
|
|
@@ -700,7 +700,7 @@ export declare const provider: {
|
|
|
700
700
|
}, import("../route/client.js").CompactionOperations | undefined>;
|
|
701
701
|
chat: (id: string | ModelID) => import("../schema/options.js").LanguageModel<{
|
|
702
702
|
readonly thinking?: {
|
|
703
|
-
readonly type:
|
|
703
|
+
readonly type: (string & {}) | "disabled" | "adaptive";
|
|
704
704
|
} | undefined;
|
|
705
705
|
readonly thinkingBudget?: number | undefined;
|
|
706
706
|
readonly parallelToolCalls?: boolean | undefined;
|
package/dist/schema/options.js
CHANGED
|
@@ -130,8 +130,9 @@ export class LanguageModelCompatibility extends Schema.Class("LLM.LanguageModelC
|
|
|
130
130
|
supportsStore: Schema.optional(Schema.Boolean),
|
|
131
131
|
supportsUsageInStreaming: Schema.optional(Schema.Boolean),
|
|
132
132
|
supportsStrictMode: Schema.optional(Schema.Boolean),
|
|
133
|
-
// Accepts `prompt_cache_key` in the
|
|
134
|
-
//
|
|
133
|
+
// Accepts `prompt_cache_key` in the request body. Chat omits the key unless
|
|
134
|
+
// this is true; other protocols omit it only when this is false.
|
|
135
|
+
// Session-affinity headers still flow regardless.
|
|
135
136
|
supportsPromptCacheKey: Schema.optional(Schema.Boolean),
|
|
136
137
|
zaiToolStream: Schema.optional(Schema.Boolean),
|
|
137
138
|
requireSignature: Schema.optional(Schema.Boolean),
|
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-20857",
|
|
4
4
|
"name": "@opencode/ai",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@clack/prompts": "1.0.0-alpha.1",
|
|
36
36
|
"@effect/platform-node": "4.0.1",
|
|
37
|
-
"@opencode/http-recorder": "0.0.0-dev-
|
|
37
|
+
"@opencode/http-recorder": "0.0.0-dev-20857",
|
|
38
38
|
"@tsconfig/bun": "1.0.9",
|
|
39
39
|
"@types/bun": "1.4.0",
|
|
40
40
|
"@typescript/native-preview": "7.0.0-dev.20251207.1",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@aws-sdk/credential-providers": "3.1057.0",
|
|
45
45
|
"@smithy/eventstream-codec": "4.2.14",
|
|
46
46
|
"@smithy/util-utf8": "4.2.2",
|
|
47
|
-
"@opencode/schema": "0.0.0-dev-
|
|
47
|
+
"@opencode/schema": "0.0.0-dev-20857",
|
|
48
48
|
"aws4fetch": "1.0.20",
|
|
49
49
|
"effect": "4.0.1",
|
|
50
50
|
"google-auth-library": "10.5.0"
|