New:Socket for Asana Is Now Available.Learn more
Sign In

@opencode-ai/ai

Package Overview
Dependencies
Maintainers
2
Versions
972
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@opencode-ai/ai - npm Package Compare versions

Comparing version
0.0.0-dev-18167
to
0.0.0-dev-18171
+1
-1
dist/protocols/open-responses.js

@@ -474,3 +474,3 @@ import { Effect, Schema } from "effect";

const options = OpenResponsesOptions.resolve(request);
const cacheKey = ProviderShared.clampPromptCacheKey(request.promptCacheKey);
const cacheKey = ProviderShared.promptCacheKey(request);
const parallelToolCalls = resolveParallelToolCalls(request);

@@ -477,0 +477,0 @@ return {

@@ -520,3 +520,3 @@ import { Effect, Schema } from "effect";

const options = OpenAIOptions.resolve(request);
const cacheKey = ProviderShared.clampPromptCacheKey(request.promptCacheKey);
const cacheKey = ProviderShared.promptCacheKey(request);
return {

@@ -523,0 +523,0 @@ ...(supportsStore && options.store !== undefined ? { store: options.store } : {}),

@@ -14,3 +14,3 @@ import { Tool } from "@opencode-ai/schema/tool";

export declare const OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH = 64;
export declare const clampPromptCacheKey: (key: string | undefined) => string | undefined;
export declare const promptCacheKey: (request: LLMRequest) => string | undefined;
/**

@@ -17,0 +17,0 @@ * Streaming tool-call accumulator. Adapters that build a tool call across

@@ -19,8 +19,8 @@ import { Buffer } from "node:buffer";

// limit via their OpenAI-compatible APIs. Clamp with unicode-aware slicing.
export const clampPromptCacheKey = (key) => {
if (key === undefined)
export const promptCacheKey = (request) => {
if (request.cache === "none" || request.promptCacheKey === undefined)
return undefined;
const chars = Array.from(key);
const chars = Array.from(request.promptCacheKey);
if (chars.length <= OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH)
return key;
return request.promptCacheKey;
return chars.slice(0, OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH).join("");

@@ -27,0 +27,0 @@ };

@@ -11,3 +11,3 @@ import { Effect, Schema } from "effect";

import { newBreakpoints, ttlBucket } from "../protocols/utils/cache.js";
import { isRecord, ProviderShared } from "../protocols/shared.js";
import { isRecord } from "../protocols/shared.js";
export const profile = OpenAICompatibleProfiles.profiles.openrouter;

@@ -43,3 +43,2 @@ export const id = ProviderID.make(profile.provider);

});
const cacheKey = ProviderShared.clampPromptCacheKey(request.promptCacheKey);
return {

@@ -49,3 +48,2 @@ ...body,

...bodyOptions(request.providerOptions),
...(cacheKey ? { prompt_cache_key: cacheKey } : {}),
};

@@ -52,0 +50,0 @@ })),

{
"$schema": "https://json.schemastore.org/package.json",
"version": "0.0.0-dev-18167",
"version": "0.0.0-dev-18171",
"name": "@opencode-ai/ai",

@@ -33,3 +33,3 @@ "type": "module",

"@effect/platform-node": "4.0.0-rc.111",
"@opencode-ai/http-recorder": "0.0.0-dev-18167",
"@opencode-ai/http-recorder": "0.0.0-dev-18171",
"@tsconfig/bun": "1.0.9",

@@ -43,3 +43,3 @@ "@types/bun": "1.3.13",

"@smithy/util-utf8": "4.2.2",
"@opencode-ai/schema": "0.0.0-dev-18167",
"@opencode-ai/schema": "0.0.0-dev-18171",
"aws4fetch": "1.0.20",

@@ -46,0 +46,0 @@ "effect": "4.0.0-rc.111",