mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-18 09:24:45 +00:00
docs: deprecate provider-owned sdk helpers
This commit is contained in:
@@ -1,2 +1,2 @@
|
||||
dd840593b93b3ee264cef645f7ba65a04c5049fe71d7d0877c29e95e4a6405f7 plugin-sdk-api-baseline.json
|
||||
bec5bda680942c05400a3d74685202d631682fb6c1b8512da660e5679f65b0e7 plugin-sdk-api-baseline.jsonl
|
||||
a25794a905166b6cc5879855f0220d93a3686b3d7d46ef6eb931cff9f42a9c36 plugin-sdk-api-baseline.json
|
||||
aeaee8496792b31443bdd37ab6b8499c590663500463d3a6a2033c6b804d9c73 plugin-sdk-api-baseline.jsonl
|
||||
|
||||
@@ -27,7 +27,7 @@ const budgets = {
|
||||
process.env.OPENCLAW_PLUGIN_SDK_MAX_PUBLIC_FUNCTION_EXPORTS ?? 4656,
|
||||
),
|
||||
publicDeprecatedExports: Number(
|
||||
process.env.OPENCLAW_PLUGIN_SDK_MAX_PUBLIC_DEPRECATED_EXPORTS ?? 3700,
|
||||
process.env.OPENCLAW_PLUGIN_SDK_MAX_PUBLIC_DEPRECATED_EXPORTS ?? 3800,
|
||||
),
|
||||
publicWildcardReexports: Number(
|
||||
process.env.OPENCLAW_PLUGIN_SDK_MAX_PUBLIC_WILDCARD_REEXPORTS ?? 207,
|
||||
|
||||
@@ -4,8 +4,10 @@ import {
|
||||
stripSystemPromptCacheBoundary,
|
||||
} from "./system-prompt-cache-boundary.js";
|
||||
|
||||
/** @deprecated Anthropic-family provider payload helper; do not use from third-party plugins. */
|
||||
export type AnthropicServiceTier = "auto" | "standard_only";
|
||||
|
||||
/** @deprecated Anthropic-family provider payload helper; do not use from third-party plugins. */
|
||||
export type AnthropicEphemeralCacheControl = {
|
||||
type: "ephemeral";
|
||||
ttl?: "1h";
|
||||
@@ -20,6 +22,7 @@ type AnthropicPayloadPolicyInput = {
|
||||
serviceTier?: AnthropicServiceTier;
|
||||
};
|
||||
|
||||
/** @deprecated Anthropic-family provider payload helper; do not use from third-party plugins. */
|
||||
export type AnthropicPayloadPolicy = {
|
||||
allowsServiceTier: boolean;
|
||||
cacheControl: AnthropicEphemeralCacheControl | undefined;
|
||||
@@ -176,6 +179,7 @@ function applyAnthropicCacheControlToMessages(
|
||||
}
|
||||
}
|
||||
|
||||
/** @deprecated Anthropic-family provider payload helper; do not use from third-party plugins. */
|
||||
export function resolveAnthropicPayloadPolicy(
|
||||
input: AnthropicPayloadPolicyInput,
|
||||
): AnthropicPayloadPolicy {
|
||||
@@ -197,6 +201,7 @@ export function resolveAnthropicPayloadPolicy(
|
||||
};
|
||||
}
|
||||
|
||||
/** @deprecated Anthropic-family provider payload helper; do not use from third-party plugins. */
|
||||
export function applyAnthropicPayloadPolicyToParams(
|
||||
payloadObj: Record<string, unknown>,
|
||||
policy: AnthropicPayloadPolicy,
|
||||
@@ -223,6 +228,7 @@ export function applyAnthropicPayloadPolicyToParams(
|
||||
applyAnthropicCacheControlToMessages(payloadObj.messages, policy.cacheControl);
|
||||
}
|
||||
|
||||
/** @deprecated Anthropic-family provider payload helper; do not use from third-party plugins. */
|
||||
export function applyAnthropicEphemeralCacheControlMarkers(
|
||||
payloadObj: Record<string, unknown>,
|
||||
): void {
|
||||
|
||||
@@ -7,9 +7,12 @@ export {
|
||||
|
||||
export const AUTH_STORE_VERSION = 1;
|
||||
|
||||
/** @deprecated Anthropic provider-owned CLI profile id; do not use from third-party plugins. */
|
||||
export const CLAUDE_CLI_PROFILE_ID = "anthropic:claude-cli";
|
||||
/** @deprecated OpenAI Codex provider-owned CLI profile id; do not use from third-party plugins. */
|
||||
export const CODEX_CLI_PROFILE_ID = "openai-codex:codex-cli";
|
||||
export const OPENAI_CODEX_DEFAULT_PROFILE_ID = "openai-codex:default";
|
||||
/** @deprecated MiniMax provider-owned CLI profile id; do not use from third-party plugins. */
|
||||
export const MINIMAX_CLI_PROFILE_ID = "minimax-portal:minimax-cli";
|
||||
|
||||
export const AUTH_STORE_LOCK_OPTIONS = {
|
||||
|
||||
@@ -450,6 +450,7 @@ export function readClaudeCliCredentials(options?: {
|
||||
return parseClaudeCliOauthCredential(data.claudeAiOauth);
|
||||
}
|
||||
|
||||
/** @deprecated Anthropic provider-owned CLI credential helper; do not use from third-party plugins. */
|
||||
export function readClaudeCliCredentialsCached(options?: {
|
||||
allowKeychainPrompt?: boolean;
|
||||
ttlMs?: number;
|
||||
|
||||
@@ -12,6 +12,7 @@ const OPENAI_FAMILY_GPT5_PROMPT_OVERLAY_PROVIDERS = new Set([
|
||||
"openai-codex",
|
||||
]);
|
||||
|
||||
/** @deprecated OpenAI/Codex provider-owned prompt overlay helper; do not use from third-party plugins. */
|
||||
export const GPT5_FRIENDLY_CHAT_PROMPT_OVERLAY = `## Interaction Style
|
||||
|
||||
Be warm, collaborative, and quietly supportive.
|
||||
@@ -36,6 +37,7 @@ Avoid walls of text, long preambles, and repetitive restatement.
|
||||
Occasional emoji are welcome when they fit naturally, especially for warmth or brief celebration; keep them sparse.
|
||||
Keep replies concise by default; friendly does not mean verbose.`;
|
||||
|
||||
/** @deprecated OpenAI/Codex provider-owned prompt overlay helper; do not use from third-party plugins. */
|
||||
export const GPT5_HEARTBEAT_PROMPT_OVERLAY = `### Heartbeats
|
||||
|
||||
The purpose of heartbeats is to make you feel magical and proactive. Come to life and start proactively doing things that are important.
|
||||
@@ -55,8 +57,10 @@ If the current state is materially unchanged and you do not have something genui
|
||||
If there is a clear standing goal or workstream and no stronger interruption, the wake should usually advance it in some concrete way. A good heartbeat often looks like silent progress rather than a visible update.
|
||||
Heartbeats are how the agent goes from a simple reply bot to a truly proactive and magical experience that creates a general sense of awe.`;
|
||||
|
||||
/** @deprecated OpenAI/Codex provider-owned prompt overlay helper; do not use from third-party plugins. */
|
||||
export const GPT5_FRIENDLY_PROMPT_OVERLAY = `${GPT5_FRIENDLY_CHAT_PROMPT_OVERLAY}\n\n${GPT5_HEARTBEAT_PROMPT_OVERLAY}`;
|
||||
|
||||
/** @deprecated OpenAI/Codex provider-owned prompt overlay helper; do not use from third-party plugins. */
|
||||
export const GPT5_BEHAVIOR_CONTRACT = `<persona_latch>
|
||||
Keep the established persona and tone across turns unless higher-priority instructions override it.
|
||||
Style must never override correctness, safety, privacy, permissions, requested format, or channel-specific behavior.
|
||||
@@ -94,8 +98,10 @@ For code or artifacts, prefer the smallest meaningful gate: test, typecheck, lin
|
||||
If no gate can run, state why.
|
||||
</completion_contract>`;
|
||||
|
||||
/** @deprecated OpenAI/Codex provider-owned prompt overlay helper; do not use from third-party plugins. */
|
||||
export type Gpt5PromptOverlayMode = "friendly" | "off";
|
||||
|
||||
/** @deprecated OpenAI/Codex provider-owned prompt overlay helper; do not use from third-party plugins. */
|
||||
export function normalizeGpt5PromptOverlayMode(value: unknown): Gpt5PromptOverlayMode | undefined {
|
||||
const normalized = normalizeOptionalLowercaseString(value);
|
||||
if (normalized === "off") {
|
||||
@@ -107,6 +113,7 @@ export function normalizeGpt5PromptOverlayMode(value: unknown): Gpt5PromptOverla
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/** @deprecated OpenAI/Codex provider-owned prompt overlay helper; do not use from third-party plugins. */
|
||||
export function resolveGpt5PromptOverlayMode(
|
||||
config?: OpenClawConfig,
|
||||
legacyPluginConfig?: Record<string, unknown>,
|
||||
@@ -125,11 +132,13 @@ export function resolveGpt5PromptOverlayMode(
|
||||
);
|
||||
}
|
||||
|
||||
/** @deprecated OpenAI/Codex provider-owned prompt overlay helper; do not use from third-party plugins. */
|
||||
export function isGpt5ModelId(modelId?: string): boolean {
|
||||
const normalized = normalizeOptionalLowercaseString(modelId);
|
||||
return normalized ? GPT5_MODEL_ID_PATTERN.test(normalized) : false;
|
||||
}
|
||||
|
||||
/** @deprecated OpenAI/Codex provider-owned prompt overlay helper; do not use from third-party plugins. */
|
||||
export function resolveGpt5SystemPromptContribution(params: {
|
||||
config?: OpenClawConfig;
|
||||
providerId?: string;
|
||||
@@ -156,6 +165,7 @@ export function resolveGpt5SystemPromptContribution(params: {
|
||||
};
|
||||
}
|
||||
|
||||
/** @deprecated OpenAI/Codex provider-owned prompt overlay helper; do not use from third-party plugins. */
|
||||
export function renderGpt5PromptOverlay(params: {
|
||||
config?: OpenClawConfig;
|
||||
providerId?: string;
|
||||
|
||||
@@ -2,9 +2,11 @@ import type { SecretRefSource } from "../config/types.secrets.js";
|
||||
import { listOpenClawPluginManifestMetadata } from "../plugins/manifest-metadata-scan.js";
|
||||
import { listKnownProviderEnvApiKeyNames } from "./model-auth-env-vars.js";
|
||||
|
||||
/** @deprecated MiniMax provider-owned marker; do not use from third-party plugins. */
|
||||
export const MINIMAX_OAUTH_MARKER = "minimax-oauth";
|
||||
export const OAUTH_API_KEY_MARKER_PREFIX = "oauth:";
|
||||
export const OLLAMA_LOCAL_AUTH_MARKER = "ollama-local";
|
||||
/** @deprecated Bundled local-provider marker; do not use from third-party plugins. */
|
||||
export const CUSTOM_LOCAL_AUTH_MARKER = "custom-local";
|
||||
export const GCP_VERTEX_CREDENTIALS_MARKER = "gcp-vertex-credentials";
|
||||
export const NON_ENV_SECRETREF_MARKER = "secretref-managed"; // pragma: allowlist secret
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { normalizeOptionalLowercaseString } from "../shared/string-coerce.js";
|
||||
import { log } from "./pi-embedded-runner/logger.js";
|
||||
|
||||
/** @deprecated OpenAI provider-owned stream helper; do not use from third-party plugins. */
|
||||
export type OpenAITextVerbosity = "low" | "medium" | "high";
|
||||
|
||||
function normalizeOpenAITextVerbosity(value: unknown): OpenAITextVerbosity | undefined {
|
||||
@@ -14,6 +15,7 @@ function normalizeOpenAITextVerbosity(value: unknown): OpenAITextVerbosity | und
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/** @deprecated OpenAI provider-owned stream helper; do not use from third-party plugins. */
|
||||
export function resolveOpenAITextVerbosity(
|
||||
extraParams: Record<string, unknown> | undefined,
|
||||
): OpenAITextVerbosity | undefined {
|
||||
|
||||
@@ -124,6 +124,7 @@ function normalizeOpenAiStringModeAnthropicToolChoice(toolChoice: unknown): unkn
|
||||
return toolChoice;
|
||||
}
|
||||
|
||||
/** @deprecated Anthropic-family provider stream helper; do not use from third-party plugins. */
|
||||
export function createAnthropicToolPayloadCompatibilityWrapper(
|
||||
baseStreamFn: StreamFn | undefined,
|
||||
options?: AnthropicToolPayloadCompatibilityOptions,
|
||||
@@ -160,6 +161,7 @@ export function createAnthropicToolPayloadCompatibilityWrapper(
|
||||
};
|
||||
}
|
||||
|
||||
/** @deprecated Anthropic-family provider stream helper; do not use from third-party plugins. */
|
||||
export function createOpenAIAnthropicToolPayloadCompatibilityWrapper(
|
||||
baseStreamFn: StreamFn | undefined,
|
||||
): StreamFn {
|
||||
|
||||
@@ -19,6 +19,7 @@ function isMinimaxAnthropicMessagesModel(model: { api?: unknown; provider?: unkn
|
||||
);
|
||||
}
|
||||
|
||||
/** @deprecated MiniMax provider-owned stream helper; do not use from third-party plugins. */
|
||||
export function createMinimaxFastModeWrapper(
|
||||
baseStreamFn: StreamFn | undefined,
|
||||
fastMode: boolean,
|
||||
@@ -50,6 +51,7 @@ export function createMinimaxFastModeWrapper(
|
||||
* content. Disable thinking in the outgoing payload so MiniMax does not produce
|
||||
* reasoning_content deltas during streaming.
|
||||
*/
|
||||
/** @deprecated MiniMax provider-owned stream helper; do not use from third-party plugins. */
|
||||
export function createMinimaxThinkingDisabledWrapper(baseStreamFn: StreamFn | undefined): StreamFn {
|
||||
const underlying = baseStreamFn ?? streamSimple;
|
||||
return (model, context, options) => {
|
||||
|
||||
@@ -67,6 +67,7 @@ function isPinnedToolChoice(toolChoice: unknown): boolean {
|
||||
return typeValue === "tool" || typeValue === "function";
|
||||
}
|
||||
|
||||
/** @deprecated Moonshot provider-owned stream helper; do not use from third-party plugins. */
|
||||
export function resolveMoonshotThinkingType(params: {
|
||||
configuredThinking: unknown;
|
||||
thinkingLevel?: ThinkLevel;
|
||||
@@ -81,12 +82,14 @@ export function resolveMoonshotThinkingType(params: {
|
||||
return params.thinkingLevel === "off" ? "disabled" : "enabled";
|
||||
}
|
||||
|
||||
/** @deprecated Moonshot provider-owned stream helper; do not use from third-party plugins. */
|
||||
export function resolveMoonshotThinkingKeep(params: {
|
||||
configuredThinking: unknown;
|
||||
}): MoonshotThinkingKeep | undefined {
|
||||
return normalizeMoonshotThinkingKeep(params.configuredThinking);
|
||||
}
|
||||
|
||||
/** @deprecated Moonshot provider-owned stream helper; do not use from third-party plugins. */
|
||||
export function createMoonshotThinkingWrapper(
|
||||
baseStreamFn: StreamFn | undefined,
|
||||
thinkingType?: MoonshotThinkingType,
|
||||
|
||||
@@ -198,6 +198,7 @@ function normalizeOpenAIServiceTier(value: unknown): OpenAIServiceTier | undefin
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/** @deprecated OpenAI provider-owned stream helper; do not use from third-party plugins. */
|
||||
export function resolveOpenAIServiceTier(
|
||||
extraParams: Record<string, unknown> | undefined,
|
||||
): OpenAIServiceTier | undefined {
|
||||
@@ -239,6 +240,7 @@ function normalizeOpenAIFastMode(value: unknown): boolean | undefined {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/** @deprecated OpenAI provider-owned stream helper; do not use from third-party plugins. */
|
||||
export function resolveOpenAIFastMode(
|
||||
extraParams: Record<string, unknown> | undefined,
|
||||
): boolean | undefined {
|
||||
@@ -260,6 +262,7 @@ function applyOpenAIFastModePayloadOverrides(params: {
|
||||
}
|
||||
}
|
||||
|
||||
/** @deprecated OpenAI provider-owned stream helper; do not use from third-party plugins. */
|
||||
export function createOpenAIResponsesContextManagementWrapper(
|
||||
baseStreamFn: StreamFn | undefined,
|
||||
extraParams: Record<string, unknown> | undefined,
|
||||
@@ -295,6 +298,7 @@ export function createOpenAIResponsesContextManagementWrapper(
|
||||
};
|
||||
}
|
||||
|
||||
/** @deprecated OpenAI provider-owned stream helper; do not use from third-party plugins. */
|
||||
export function createOpenAIReasoningCompatibilityWrapper(
|
||||
baseStreamFn: StreamFn | undefined,
|
||||
): StreamFn {
|
||||
@@ -312,6 +316,7 @@ export function createOpenAIReasoningCompatibilityWrapper(
|
||||
};
|
||||
}
|
||||
|
||||
/** @deprecated OpenAI provider-owned stream helper; do not use from third-party plugins. */
|
||||
export function createOpenAIStringContentWrapper(baseStreamFn: StreamFn | undefined): StreamFn {
|
||||
const underlying = baseStreamFn ?? streamSimple;
|
||||
return (model, context, options) => {
|
||||
@@ -327,6 +332,7 @@ export function createOpenAIStringContentWrapper(baseStreamFn: StreamFn | undefi
|
||||
};
|
||||
}
|
||||
|
||||
/** @deprecated OpenAI provider-owned stream helper; do not use from third-party plugins. */
|
||||
export function createOpenAICompletionsStrictMessageKeysWrapper(
|
||||
baseStreamFn: StreamFn | undefined,
|
||||
): StreamFn {
|
||||
@@ -344,6 +350,7 @@ export function createOpenAICompletionsStrictMessageKeysWrapper(
|
||||
};
|
||||
}
|
||||
|
||||
/** @deprecated OpenAI provider-owned stream helper; do not use from third-party plugins. */
|
||||
export function createOpenAICompletionsToolsCompatWrapper(
|
||||
baseStreamFn: StreamFn | undefined,
|
||||
): StreamFn {
|
||||
@@ -360,6 +367,7 @@ export function createOpenAICompletionsToolsCompatWrapper(
|
||||
};
|
||||
}
|
||||
|
||||
/** @deprecated OpenAI provider-owned stream helper; do not use from third-party plugins. */
|
||||
export function createOpenAIThinkingLevelWrapper(
|
||||
baseStreamFn: StreamFn | undefined,
|
||||
thinkingLevel?: ThinkLevel,
|
||||
@@ -407,6 +415,7 @@ export function createOpenAIThinkingLevelWrapper(
|
||||
};
|
||||
}
|
||||
|
||||
/** @deprecated OpenAI provider-owned stream helper; do not use from third-party plugins. */
|
||||
export function createOpenAIFastModeWrapper(baseStreamFn: StreamFn | undefined): StreamFn {
|
||||
const underlying = baseStreamFn ?? streamSimple;
|
||||
return (model, context, options) => {
|
||||
@@ -434,6 +443,7 @@ export function createOpenAIFastModeWrapper(baseStreamFn: StreamFn | undefined):
|
||||
};
|
||||
}
|
||||
|
||||
/** @deprecated OpenAI provider-owned stream helper; do not use from third-party plugins. */
|
||||
export function createOpenAIServiceTierWrapper(
|
||||
baseStreamFn: StreamFn | undefined,
|
||||
serviceTier: OpenAIServiceTier,
|
||||
@@ -451,6 +461,7 @@ export function createOpenAIServiceTierWrapper(
|
||||
};
|
||||
}
|
||||
|
||||
/** @deprecated OpenAI provider-owned stream helper; do not use from third-party plugins. */
|
||||
export function createOpenAITextVerbosityWrapper(
|
||||
baseStreamFn: StreamFn | undefined,
|
||||
verbosity: OpenAITextVerbosity,
|
||||
@@ -482,6 +493,7 @@ export function createOpenAITextVerbosityWrapper(
|
||||
});
|
||||
};
|
||||
}
|
||||
/** @deprecated OpenAI Codex provider-owned stream helper; do not use from third-party plugins. */
|
||||
export function createCodexNativeWebSearchWrapper(
|
||||
baseStreamFn: StreamFn | undefined,
|
||||
params: { config?: OpenClawConfig; agentDir?: string },
|
||||
@@ -534,6 +546,7 @@ export function createCodexNativeWebSearchWrapper(
|
||||
});
|
||||
};
|
||||
}
|
||||
/** @deprecated OpenAI provider-owned stream helper; do not use from third-party plugins. */
|
||||
export function createOpenAIDefaultTransportWrapper(baseStreamFn: StreamFn | undefined): StreamFn {
|
||||
const underlying = baseStreamFn ?? streamSimple;
|
||||
return (model, context, options) => {
|
||||
@@ -545,6 +558,7 @@ export function createOpenAIDefaultTransportWrapper(baseStreamFn: StreamFn | und
|
||||
};
|
||||
}
|
||||
|
||||
/** @deprecated OpenAI provider-owned stream helper; do not use from third-party plugins. */
|
||||
export function createOpenAIAttributionHeadersWrapper(
|
||||
baseStreamFn: StreamFn | undefined,
|
||||
opts?: { codexNativeTransportStreamFn?: StreamFn },
|
||||
|
||||
@@ -270,6 +270,8 @@ function ensureOpenRouterModelCache(): void {
|
||||
* Known cached entries return immediately. Unknown entries wait for at most
|
||||
* one catalog fetch, then leave sync resolution to read from the populated
|
||||
* cache on the same request.
|
||||
*
|
||||
* @deprecated OpenRouter provider-owned catalog helper; do not use from third-party plugins.
|
||||
*/
|
||||
export async function loadOpenRouterModelCapabilities(modelId: string): Promise<void> {
|
||||
ensureOpenRouterModelCache();
|
||||
@@ -292,6 +294,8 @@ export async function loadOpenRouterModelCapabilities(modelId: string): Promise<
|
||||
*
|
||||
* If a model is not found but the cache exists, a background refresh is
|
||||
* triggered in case it's a newly added model not yet in the cache.
|
||||
*
|
||||
* @deprecated OpenRouter provider-owned catalog helper; do not use from third-party plugins.
|
||||
*/
|
||||
export function getOpenRouterModelCapabilities(
|
||||
modelId: string,
|
||||
|
||||
@@ -150,6 +150,7 @@ function normalizeProxyReasoningPayload(payload: unknown, thinkingLevel?: ThinkL
|
||||
}
|
||||
}
|
||||
|
||||
/** @deprecated OpenRouter provider-owned stream helper; do not use from third-party plugins. */
|
||||
export function createOpenRouterSystemCacheWrapper(baseStreamFn: StreamFn | undefined): StreamFn {
|
||||
const underlying = baseStreamFn ?? streamSimple;
|
||||
return (model, context, options) => {
|
||||
@@ -181,6 +182,7 @@ export function createOpenRouterSystemCacheWrapper(baseStreamFn: StreamFn | unde
|
||||
};
|
||||
}
|
||||
|
||||
/** @deprecated OpenRouter provider-owned stream helper; do not use from third-party plugins. */
|
||||
export function createOpenRouterWrapper(
|
||||
baseStreamFn: StreamFn | undefined,
|
||||
thinkingLevel?: ThinkLevel,
|
||||
@@ -214,12 +216,14 @@ export function createOpenRouterWrapper(
|
||||
};
|
||||
}
|
||||
|
||||
/** @deprecated Proxy provider-owned stream helper; do not use from third-party plugins. */
|
||||
export function isProxyReasoningUnsupported(modelId: string): boolean {
|
||||
const trimmed = normalizeOptionalLowercaseString(modelId);
|
||||
const slashIndex = trimmed?.indexOf("/") ?? -1;
|
||||
return slashIndex > 0 && trimmed?.slice(0, slashIndex) === "x-ai";
|
||||
}
|
||||
|
||||
/** @deprecated Kilocode provider-owned stream helper; do not use from third-party plugins. */
|
||||
export function createKilocodeWrapper(
|
||||
baseStreamFn: StreamFn | undefined,
|
||||
thinkingLevel?: ThinkLevel,
|
||||
|
||||
@@ -5,6 +5,8 @@ import { streamWithPayloadPatch } from "./stream-payload-utils.js";
|
||||
/**
|
||||
* Inject `tool_stream=true` so tool-call deltas stream in real time.
|
||||
* Providers can disable this by setting `params.tool_stream=false`.
|
||||
*
|
||||
* @deprecated Provider-owned stream helper; do not use from third-party plugins.
|
||||
*/
|
||||
export function createToolStreamWrapper(
|
||||
baseStreamFn: StreamFn | undefined,
|
||||
@@ -22,4 +24,5 @@ export function createToolStreamWrapper(
|
||||
};
|
||||
}
|
||||
|
||||
/** @deprecated Z.ai provider-owned stream helper; do not use from third-party plugins. */
|
||||
export const createZaiToolStreamWrapper = createToolStreamWrapper;
|
||||
|
||||
@@ -1,13 +1,21 @@
|
||||
import { createHash, randomBytes } from "node:crypto";
|
||||
|
||||
/** Encode a flat object as application/x-www-form-urlencoded form data. */
|
||||
/**
|
||||
* Encode a flat object as application/x-www-form-urlencoded form data.
|
||||
*
|
||||
* @deprecated OAuth provider-owned helper; keep this local to provider plugins instead.
|
||||
*/
|
||||
export function toFormUrlEncoded(data: Record<string, string>): string {
|
||||
return Object.entries(data)
|
||||
.map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`)
|
||||
.join("&");
|
||||
}
|
||||
|
||||
/** Generate a PKCE verifier/challenge pair suitable for OAuth authorization flows. */
|
||||
/**
|
||||
* Generate a PKCE verifier/challenge pair suitable for OAuth authorization flows.
|
||||
*
|
||||
* @deprecated OAuth provider-owned helper; keep this local to provider plugins instead.
|
||||
*/
|
||||
export function generatePkceVerifierChallenge(): { verifier: string; challenge: string } {
|
||||
const verifier = randomBytes(32).toString("base64url");
|
||||
const challenge = createHash("sha256").update(verifier).digest("base64url");
|
||||
|
||||
@@ -94,13 +94,20 @@ export {
|
||||
|
||||
const COPILOT_TOKEN_URL = "https://api.github.com/copilot_internal/v2/token";
|
||||
|
||||
/** @deprecated GitHub Copilot provider-owned helper; do not use from third-party plugins. */
|
||||
export const COPILOT_EDITOR_VERSION = "vscode/1.96.2";
|
||||
/** @deprecated GitHub Copilot provider-owned helper; do not use from third-party plugins. */
|
||||
export const COPILOT_USER_AGENT = "GitHubCopilotChat/0.26.7";
|
||||
/** @deprecated GitHub Copilot provider-owned helper; do not use from third-party plugins. */
|
||||
export const COPILOT_EDITOR_PLUGIN_VERSION = "copilot-chat/0.35.0";
|
||||
/** @deprecated GitHub Copilot provider-owned helper; do not use from third-party plugins. */
|
||||
export const COPILOT_GITHUB_API_VERSION = "2025-04-01";
|
||||
/** @deprecated GitHub Copilot provider-owned helper; do not use from third-party plugins. */
|
||||
export const COPILOT_INTEGRATION_ID = "vscode-chat";
|
||||
/** @deprecated GitHub Copilot provider-owned helper; do not use from third-party plugins. */
|
||||
export const DEFAULT_COPILOT_API_BASE_URL = "https://api.individual.githubcopilot.com";
|
||||
|
||||
/** @deprecated GitHub Copilot provider-owned helper; do not use from third-party plugins. */
|
||||
export type CachedCopilotToken = {
|
||||
token: string;
|
||||
expiresAt: number;
|
||||
@@ -108,6 +115,7 @@ export type CachedCopilotToken = {
|
||||
integrationId?: string;
|
||||
};
|
||||
|
||||
/** @deprecated GitHub Copilot provider-owned helper; do not use from third-party plugins. */
|
||||
export function buildCopilotIdeHeaders(
|
||||
params: {
|
||||
includeApiVersion?: boolean;
|
||||
@@ -177,6 +185,7 @@ function resolveCopilotProxyHost(proxyEp: string): string | null {
|
||||
}
|
||||
}
|
||||
|
||||
/** @deprecated GitHub Copilot provider-owned helper; do not use from third-party plugins. */
|
||||
export function deriveCopilotApiBaseUrlFromToken(token: string): string | null {
|
||||
const trimmed = token.trim();
|
||||
if (!trimmed) {
|
||||
@@ -199,6 +208,7 @@ export function deriveCopilotApiBaseUrlFromToken(token: string): string | null {
|
||||
return resolveProviderEndpoint(baseUrl).endpointClass === "invalid" ? null : baseUrl;
|
||||
}
|
||||
|
||||
/** @deprecated GitHub Copilot provider-owned helper; do not use from third-party plugins. */
|
||||
export async function resolveCopilotApiToken(params: {
|
||||
githubToken: string;
|
||||
env?: NodeJS.ProcessEnv;
|
||||
|
||||
@@ -118,6 +118,7 @@ function getModelProviderHint(modelId: string): string | null {
|
||||
return trimmed.slice(0, slashIndex) || null;
|
||||
}
|
||||
|
||||
/** @deprecated Proxy provider-owned model helper; do not use from third-party plugins. */
|
||||
export function isProxyReasoningUnsupportedModelHint(modelId: string): boolean {
|
||||
return getModelProviderHint(modelId) === "x-ai";
|
||||
}
|
||||
@@ -131,10 +132,12 @@ function isClaudeOpus47ModelId(modelId: string): boolean {
|
||||
return matchesClaudeModelPrefix(modelId, CLAUDE_OPUS_47_MODEL_PREFIXES);
|
||||
}
|
||||
|
||||
/** @deprecated Anthropic provider-owned model helper; do not use from third-party plugins. */
|
||||
export function isClaudeAdaptiveThinkingDefaultModelId(modelId: string): boolean {
|
||||
return matchesClaudeModelPrefix(modelId, CLAUDE_ADAPTIVE_THINKING_DEFAULT_MODEL_PREFIXES);
|
||||
}
|
||||
|
||||
/** @deprecated Anthropic provider-owned model helper; do not use from third-party plugins. */
|
||||
export function resolveClaudeThinkingProfile(modelId: string): ProviderThinkingProfile {
|
||||
if (isClaudeOpus47ModelId(modelId)) {
|
||||
return {
|
||||
@@ -232,18 +235,22 @@ export function buildProviderReplayFamilyHooks(
|
||||
throw new Error("Unsupported provider replay family");
|
||||
}
|
||||
|
||||
/** @deprecated Provider-owned replay hook shortcut; use local provider hooks instead. */
|
||||
export const OPENAI_COMPATIBLE_REPLAY_HOOKS = buildProviderReplayFamilyHooks({
|
||||
family: "openai-compatible",
|
||||
});
|
||||
|
||||
/** @deprecated Anthropic provider-owned replay hook shortcut; use local provider hooks instead. */
|
||||
export const ANTHROPIC_BY_MODEL_REPLAY_HOOKS = buildProviderReplayFamilyHooks({
|
||||
family: "anthropic-by-model",
|
||||
});
|
||||
|
||||
/** @deprecated Anthropic provider-owned replay hook shortcut; use local provider hooks instead. */
|
||||
export const NATIVE_ANTHROPIC_REPLAY_HOOKS = buildProviderReplayFamilyHooks({
|
||||
family: "native-anthropic-by-model",
|
||||
});
|
||||
|
||||
/** @deprecated Google provider-owned replay hook shortcut; use local provider hooks instead. */
|
||||
export const PASSTHROUGH_GEMINI_REPLAY_HOOKS = buildProviderReplayFamilyHooks({
|
||||
family: "passthrough-gemini",
|
||||
});
|
||||
|
||||
@@ -20,6 +20,7 @@ export function composeProviderStreamWrappers(
|
||||
);
|
||||
}
|
||||
|
||||
/** @deprecated Bundled provider stream helper; do not use from third-party plugins. */
|
||||
export function defaultToolStreamExtraParams(
|
||||
extraParams?: Record<string, unknown>,
|
||||
): Record<string, unknown> {
|
||||
@@ -107,6 +108,7 @@ function stripTrailingAssistantPrefillMessages(payload: Record<string, unknown>)
|
||||
return stripped;
|
||||
}
|
||||
|
||||
/** @deprecated Anthropic-family provider stream helper; do not use from third-party plugins. */
|
||||
export function stripTrailingAnthropicAssistantPrefillWhenThinking(
|
||||
payload: Record<string, unknown>,
|
||||
): number {
|
||||
@@ -116,6 +118,7 @@ export function stripTrailingAnthropicAssistantPrefillWhenThinking(
|
||||
return stripTrailingAssistantPrefillMessages(payload);
|
||||
}
|
||||
|
||||
/** @deprecated Anthropic-family provider stream helper; do not use from third-party plugins. */
|
||||
export function createAnthropicThinkingPrefillPayloadWrapper(
|
||||
baseStreamFn: StreamFn | undefined,
|
||||
onStripped?: (stripped: number) => void,
|
||||
@@ -133,8 +136,10 @@ export function createAnthropicThinkingPrefillPayloadWrapper(
|
||||
);
|
||||
}
|
||||
|
||||
/** @deprecated OpenAI-compatible provider stream helper; do not use from third-party plugins. */
|
||||
export type OpenAICompatibleThinkingLevel = ProviderWrapStreamFnContext["thinkingLevel"];
|
||||
|
||||
/** @deprecated OpenAI-compatible provider stream helper; do not use from third-party plugins. */
|
||||
export function isOpenAICompatibleThinkingEnabled(params: {
|
||||
thinkingLevel: OpenAICompatibleThinkingLevel;
|
||||
options: Parameters<StreamFn>[2];
|
||||
@@ -148,7 +153,9 @@ export function isOpenAICompatibleThinkingEnabled(params: {
|
||||
return normalized !== "off" && normalized !== "none";
|
||||
}
|
||||
|
||||
/** @deprecated DeepSeek provider stream helper; do not use from third-party plugins. */
|
||||
export type DeepSeekV4ThinkingLevel = ProviderWrapStreamFnContext["thinkingLevel"];
|
||||
/** @deprecated DeepSeek provider stream helper; do not use from third-party plugins. */
|
||||
export type DeepSeekV4ReasoningEffort = "minimal" | "low" | "medium" | "high" | "xhigh" | "max";
|
||||
|
||||
function isDisabledDeepSeekV4ThinkingLevel(thinkingLevel: DeepSeekV4ThinkingLevel): boolean {
|
||||
@@ -192,6 +199,7 @@ function ensureDeepSeekV4AssistantReasoningContent(payload: Record<string, unkno
|
||||
}
|
||||
}
|
||||
|
||||
/** @deprecated DeepSeek provider stream helper; do not use from third-party plugins. */
|
||||
export function createDeepSeekV4OpenAICompatibleThinkingWrapper(params: {
|
||||
baseStreamFn: StreamFn | undefined;
|
||||
thinkingLevel: DeepSeekV4ThinkingLevel;
|
||||
@@ -224,7 +232,9 @@ export function createDeepSeekV4OpenAICompatibleThinkingWrapper(params: {
|
||||
};
|
||||
}
|
||||
|
||||
/** @deprecated Google provider-owned stream helper; do not use from third-party plugins. */
|
||||
export type GoogleThinkingLevel = "MINIMAL" | "LOW" | "MEDIUM" | "HIGH";
|
||||
/** @deprecated Google provider-owned stream helper; do not use from third-party plugins. */
|
||||
export type GoogleThinkingInputLevel =
|
||||
| "off"
|
||||
| "minimal"
|
||||
@@ -237,28 +247,34 @@ export type GoogleThinkingInputLevel =
|
||||
|
||||
// Gemini 2.5 Pro only works in thinking mode and rejects thinkingBudget=0 with
|
||||
// "Budget 0 is invalid. This model only works in thinking mode."
|
||||
/** @deprecated Google provider-owned stream helper; do not use from third-party plugins. */
|
||||
export function isGoogleThinkingRequiredModel(modelId: string): boolean {
|
||||
return normalizeLowercaseStringOrEmpty(modelId).includes("gemini-2.5-pro");
|
||||
}
|
||||
|
||||
/** @deprecated Google provider-owned stream helper; do not use from third-party plugins. */
|
||||
export function isGoogleGemini25ThinkingBudgetModel(modelId: string): boolean {
|
||||
return /(?:^|\/)gemini-2\.5-/.test(normalizeLowercaseStringOrEmpty(modelId));
|
||||
}
|
||||
|
||||
/** @deprecated Google provider-owned stream helper; do not use from third-party plugins. */
|
||||
export function isGoogleGemini3ProModel(modelId: string): boolean {
|
||||
const normalized = normalizeLowercaseStringOrEmpty(modelId);
|
||||
return /(?:^|\/)gemini-(?:3(?:\.\d+)?-pro|pro-latest)(?:-|$)/.test(normalized);
|
||||
}
|
||||
|
||||
/** @deprecated Google provider-owned stream helper; do not use from third-party plugins. */
|
||||
export function isGoogleGemini3FlashModel(modelId: string): boolean {
|
||||
const normalized = normalizeLowercaseStringOrEmpty(modelId);
|
||||
return /(?:^|\/)gemini-(?:3(?:\.\d+)?-flash|flash(?:-lite)?-latest)(?:-|$)/.test(normalized);
|
||||
}
|
||||
|
||||
/** @deprecated Google provider-owned stream helper; do not use from third-party plugins. */
|
||||
export function isGoogleGemini3ThinkingLevelModel(modelId: string): boolean {
|
||||
return isGoogleGemini3ProModel(modelId) || isGoogleGemini3FlashModel(modelId);
|
||||
}
|
||||
|
||||
/** @deprecated Google provider-owned stream helper; do not use from third-party plugins. */
|
||||
export function resolveGoogleGemini3ThinkingLevel(params: {
|
||||
modelId?: string;
|
||||
thinkingLevel?: GoogleThinkingInputLevel;
|
||||
@@ -329,6 +345,7 @@ export function resolveGoogleGemini3ThinkingLevel(params: {
|
||||
return "HIGH";
|
||||
}
|
||||
|
||||
/** @deprecated Google provider-owned stream helper; do not use from third-party plugins. */
|
||||
export function stripInvalidGoogleThinkingBudget(params: {
|
||||
thinkingConfig: Record<string, unknown>;
|
||||
modelId?: string;
|
||||
@@ -384,6 +401,7 @@ function normalizeGemma4ThinkingLevel(value: unknown): "MINIMAL" | "HIGH" | unde
|
||||
}
|
||||
}
|
||||
|
||||
/** @deprecated Google provider-owned stream helper; do not use from third-party plugins. */
|
||||
export function sanitizeGoogleThinkingPayload(params: {
|
||||
payload: unknown;
|
||||
modelId?: string;
|
||||
@@ -510,6 +528,7 @@ function sanitizeGoogleThinkingConfigContainer(params: {
|
||||
}
|
||||
}
|
||||
|
||||
/** @deprecated Google provider-owned stream helper; do not use from third-party plugins. */
|
||||
export function createGoogleThinkingPayloadWrapper(
|
||||
baseStreamFn: StreamFn | undefined,
|
||||
thinkingLevel?: GoogleThinkingInputLevel,
|
||||
@@ -525,6 +544,7 @@ export function createGoogleThinkingPayloadWrapper(
|
||||
});
|
||||
}
|
||||
|
||||
/** @deprecated Google provider-owned stream helper; do not use from third-party plugins. */
|
||||
export function createGoogleThinkingStreamWrapper(
|
||||
ctx: ProviderWrapStreamFnContext,
|
||||
): NonNullable<ProviderWrapStreamFnContext["streamFn"]> {
|
||||
|
||||
@@ -143,15 +143,22 @@ export function buildProviderStreamFamilyHooks(
|
||||
throw new Error("Unsupported provider stream family");
|
||||
}
|
||||
|
||||
/** @deprecated Google provider-owned stream hook shortcut; use local provider hooks instead. */
|
||||
export const GOOGLE_THINKING_STREAM_HOOKS = buildProviderStreamFamilyHooks("google-thinking");
|
||||
/** @deprecated Kilocode provider-owned stream hook shortcut; use local provider hooks instead. */
|
||||
export const KILOCODE_THINKING_STREAM_HOOKS = buildProviderStreamFamilyHooks("kilocode-thinking");
|
||||
/** @deprecated Moonshot provider-owned stream hook shortcut; use local provider hooks instead. */
|
||||
export const MOONSHOT_THINKING_STREAM_HOOKS = buildProviderStreamFamilyHooks("moonshot-thinking");
|
||||
/** @deprecated MiniMax provider-owned stream hook shortcut; use local provider hooks instead. */
|
||||
export const MINIMAX_FAST_MODE_STREAM_HOOKS = buildProviderStreamFamilyHooks("minimax-fast-mode");
|
||||
/** @deprecated OpenAI provider-owned stream hook shortcut; use local provider hooks instead. */
|
||||
export const OPENAI_RESPONSES_STREAM_HOOKS = buildProviderStreamFamilyHooks(
|
||||
"openai-responses-defaults",
|
||||
);
|
||||
/** @deprecated OpenRouter provider-owned stream hook shortcut; use local provider hooks instead. */
|
||||
export const OPENROUTER_THINKING_STREAM_HOOKS =
|
||||
buildProviderStreamFamilyHooks("openrouter-thinking");
|
||||
/** @deprecated Provider-owned stream hook shortcut; use local provider hooks instead. */
|
||||
export const TOOL_STREAM_DEFAULT_ON_HOOKS =
|
||||
buildProviderStreamFamilyHooks("tool-stream-default-on");
|
||||
|
||||
|
||||
@@ -17,12 +17,14 @@ function normalizeTokenProfileName(raw: string): string {
|
||||
return slug || DEFAULT_TOKEN_PROFILE_NAME;
|
||||
}
|
||||
|
||||
/** @deprecated Provider-owned setup helper; do not use from third-party plugins. */
|
||||
export function buildTokenProfileId(params: { provider: string; name: string }): string {
|
||||
const provider = normalizeProviderId(params.provider);
|
||||
const name = normalizeTokenProfileName(params.name);
|
||||
return `${provider}:${name}`;
|
||||
}
|
||||
|
||||
/** @deprecated Anthropic provider-owned setup helper; do not use from third-party plugins. */
|
||||
export function validateAnthropicSetupToken(raw: string): string | undefined {
|
||||
const trimmed = raw.trim();
|
||||
if (!trimmed) {
|
||||
|
||||
@@ -15,6 +15,7 @@ export function extractModelCompat(
|
||||
return modelOrCompat as ModelCompatConfig;
|
||||
}
|
||||
|
||||
/** @deprecated Provider-owned model compat helper; do not use from third-party plugins. */
|
||||
export function applyModelCompatPatch<T extends { compat?: ModelCompatConfig }>(
|
||||
model: T,
|
||||
patch: ModelCompatConfig,
|
||||
|
||||
@@ -10,6 +10,7 @@ import type {
|
||||
ProviderSanitizeReplayHistoryContext,
|
||||
} from "./types.js";
|
||||
|
||||
/** @deprecated Provider replay helper; prefer provider-local replay hooks. */
|
||||
export function buildOpenAICompatibleReplayPolicy(
|
||||
modelApi: string | null | undefined,
|
||||
options: {
|
||||
@@ -52,6 +53,7 @@ export function buildOpenAICompatibleReplayPolicy(
|
||||
};
|
||||
}
|
||||
|
||||
/** @deprecated Anthropic-family provider replay helper; prefer provider-local replay hooks. */
|
||||
export function buildStrictAnthropicReplayPolicy(
|
||||
options: {
|
||||
dropThinkingBlocks?: boolean;
|
||||
@@ -85,6 +87,8 @@ export function buildStrictAnthropicReplayPolicy(
|
||||
* thinking blocks from prior turns breaks prompt cache prefix matching.
|
||||
*
|
||||
* See: https://platform.claude.com/docs/en/build-with-claude/extended-thinking#differences-in-thinking-across-model-versions
|
||||
*
|
||||
* @deprecated Anthropic-family provider replay helper; prefer provider-local replay hooks.
|
||||
*/
|
||||
export function shouldPreserveThinkingBlocks(modelId?: string): boolean {
|
||||
const id = normalizeLowercaseStringOrEmpty(modelId);
|
||||
@@ -111,6 +115,7 @@ export function shouldPreserveThinkingBlocks(modelId?: string): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @deprecated Anthropic-family provider replay helper; prefer provider-local replay hooks. */
|
||||
export function buildAnthropicReplayPolicyForModel(modelId?: string): ProviderReplayPolicy {
|
||||
const isClaude = normalizeLowercaseStringOrEmpty(modelId).includes("claude");
|
||||
return buildStrictAnthropicReplayPolicy({
|
||||
@@ -118,6 +123,7 @@ export function buildAnthropicReplayPolicyForModel(modelId?: string): ProviderRe
|
||||
});
|
||||
}
|
||||
|
||||
/** @deprecated Anthropic-family provider replay helper; prefer provider-local replay hooks. */
|
||||
export function buildNativeAnthropicReplayPolicyForModel(modelId?: string): ProviderReplayPolicy {
|
||||
const isClaude = normalizeLowercaseStringOrEmpty(modelId).includes("claude");
|
||||
return buildStrictAnthropicReplayPolicy({
|
||||
@@ -127,6 +133,7 @@ export function buildNativeAnthropicReplayPolicyForModel(modelId?: string): Prov
|
||||
});
|
||||
}
|
||||
|
||||
/** @deprecated Provider replay helper; prefer provider-local replay hooks. */
|
||||
export function buildHybridAnthropicOrOpenAIReplayPolicy(
|
||||
ctx: ProviderReplayPolicyContext,
|
||||
options: { anthropicModelDropThinkingBlocks?: boolean } = {},
|
||||
@@ -158,6 +165,7 @@ function markGoogleTurnOrderingMarker(sessionState: ProviderReplaySessionState):
|
||||
});
|
||||
}
|
||||
|
||||
/** @deprecated Google provider replay helper; prefer provider-local replay hooks. */
|
||||
export function buildGoogleGeminiReplayPolicy(): ProviderReplayPolicy {
|
||||
return {
|
||||
sanitizeMode: "full",
|
||||
@@ -175,6 +183,7 @@ export function buildGoogleGeminiReplayPolicy(): ProviderReplayPolicy {
|
||||
};
|
||||
}
|
||||
|
||||
/** @deprecated Google provider replay helper; prefer provider-local replay hooks. */
|
||||
export function buildPassthroughGeminiSanitizingReplayPolicy(
|
||||
modelId?: string,
|
||||
): ProviderReplayPolicy {
|
||||
@@ -194,6 +203,7 @@ export function buildPassthroughGeminiSanitizingReplayPolicy(
|
||||
};
|
||||
}
|
||||
|
||||
/** @deprecated Google provider replay helper; prefer provider-local replay hooks. */
|
||||
export function sanitizeGoogleGeminiReplayHistory(
|
||||
ctx: ProviderSanitizeReplayHistoryContext,
|
||||
): AgentMessage[] {
|
||||
@@ -208,6 +218,7 @@ export function sanitizeGoogleGeminiReplayHistory(
|
||||
return messages;
|
||||
}
|
||||
|
||||
/** @deprecated Provider replay helper; prefer provider-local replay hooks. */
|
||||
export function resolveTaggedReasoningOutputMode(): ProviderReasoningOutputMode {
|
||||
return "tagged";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user