@opencode-ai/ai 0.0.0-dev-18167 → 0.0.0-dev-18175
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.
|
@@ -471,7 +471,7 @@ const lowerMessages = Effect.fn("OpenResponses.lowerMessages")(function* (reques
|
|
|
471
471
|
});
|
|
472
472
|
const lowerOptions = (request) => {
|
|
473
473
|
const options = OpenResponsesOptions.resolve(request);
|
|
474
|
-
const cacheKey = ProviderShared.
|
|
474
|
+
const cacheKey = ProviderShared.promptCacheKey(request);
|
|
475
475
|
const parallelToolCalls = resolveParallelToolCalls(request);
|
|
476
476
|
return {
|
|
477
477
|
...(options.instructions ? { instructions: options.instructions } : {}),
|
|
@@ -517,7 +517,7 @@ const detectZaiToolStream = (provider, baseURL, modelID) => {
|
|
|
517
517
|
};
|
|
518
518
|
const lowerOptions = (request, supportsStore) => {
|
|
519
519
|
const options = OpenAIOptions.resolve(request);
|
|
520
|
-
const cacheKey = ProviderShared.
|
|
520
|
+
const cacheKey = ProviderShared.promptCacheKey(request);
|
|
521
521
|
return {
|
|
522
522
|
...(supportsStore && options.store !== undefined ? { store: options.store } : {}),
|
|
523
523
|
// For providers that support `store`, ensure stateless `store:false` is sent
|
|
@@ -11,7 +11,7 @@ export declare const JsonObject: Schema.$Record<Schema.String, Schema.Unknown>;
|
|
|
11
11
|
export declare const optionalArray: <const S extends Schema.Top>(schema: S) => Schema.optional<Schema.$Array<S>>;
|
|
12
12
|
export declare const optionalNull: <const S extends Schema.Top>(schema: S) => Schema.optional<Schema.NullOr<S>>;
|
|
13
13
|
export declare const OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH = 64;
|
|
14
|
-
export declare const
|
|
14
|
+
export declare const promptCacheKey: (request: LLMRequest) => string | undefined;
|
|
15
15
|
/**
|
|
16
16
|
* Streaming tool-call accumulator. Adapters that build a tool call across
|
|
17
17
|
* multiple `tool-input-delta` chunks store the partial JSON input string here
|
package/dist/protocols/shared.js
CHANGED
|
@@ -16,12 +16,12 @@ export const optionalNull = (schema) => Schema.optional(Schema.NullOr(schema));
|
|
|
16
16
|
export const OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH = 64;
|
|
17
17
|
// OpenAI limits `prompt_cache_key` to 64 chars; DeepSeek and Zai inherit the same
|
|
18
18
|
// limit via their OpenAI-compatible APIs. Clamp with unicode-aware slicing.
|
|
19
|
-
export const
|
|
20
|
-
if (
|
|
19
|
+
export const promptCacheKey = (request) => {
|
|
20
|
+
if (request.cache === "none" || request.promptCacheKey === undefined)
|
|
21
21
|
return undefined;
|
|
22
|
-
const chars = Array.from(
|
|
22
|
+
const chars = Array.from(request.promptCacheKey);
|
|
23
23
|
if (chars.length <= OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH)
|
|
24
|
-
return
|
|
24
|
+
return request.promptCacheKey;
|
|
25
25
|
return chars.slice(0, OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH).join("");
|
|
26
26
|
};
|
|
27
27
|
/**
|
|
@@ -8,7 +8,7 @@ import { ProviderID } from "../schema/index.js";
|
|
|
8
8
|
import * as OpenAICompatibleProfiles from "./openai-compatible-profile.js";
|
|
9
9
|
import * as OpenAIChat from "../protocols/openai-chat.js";
|
|
10
10
|
import { newBreakpoints, ttlBucket } from "../protocols/utils/cache.js";
|
|
11
|
-
import { isRecord
|
|
11
|
+
import { isRecord } from "../protocols/shared.js";
|
|
12
12
|
export const profile = OpenAICompatibleProfiles.profiles.openrouter;
|
|
13
13
|
export const id = ProviderID.make(profile.provider);
|
|
14
14
|
const ADAPTER = "openrouter";
|
|
@@ -39,12 +39,10 @@ export const protocol = Protocol.make({
|
|
|
39
39
|
reasoning_details: reasoningDetails,
|
|
40
40
|
};
|
|
41
41
|
});
|
|
42
|
-
const cacheKey = ProviderShared.clampPromptCacheKey(request.promptCacheKey);
|
|
43
42
|
return {
|
|
44
43
|
...body,
|
|
45
44
|
messages,
|
|
46
45
|
...bodyOptions(request.providerOptions),
|
|
47
|
-
...(cacheKey ? { prompt_cache_key: cacheKey } : {}),
|
|
48
46
|
};
|
|
49
47
|
})),
|
|
50
48
|
},
|
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-18175",
|
|
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-rc.111",
|
|
33
|
-
"@opencode-ai/http-recorder": "0.0.0-dev-
|
|
33
|
+
"@opencode-ai/http-recorder": "0.0.0-dev-18175",
|
|
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-18175",
|
|
43
43
|
"aws4fetch": "1.0.20",
|
|
44
44
|
"effect": "4.0.0-rc.111",
|
|
45
45
|
"google-auth-library": "10.5.0"
|