diff --git a/docs/.generated/plugin-sdk-api-baseline.sha256 b/docs/.generated/plugin-sdk-api-baseline.sha256 index ee9d46892d0..13f4915848e 100644 --- a/docs/.generated/plugin-sdk-api-baseline.sha256 +++ b/docs/.generated/plugin-sdk-api-baseline.sha256 @@ -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 diff --git a/scripts/plugin-sdk-surface-report.mjs b/scripts/plugin-sdk-surface-report.mjs index 6b614fa55bb..7e1adce3421 100644 --- a/scripts/plugin-sdk-surface-report.mjs +++ b/scripts/plugin-sdk-surface-report.mjs @@ -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, diff --git a/src/agents/anthropic-payload-policy.ts b/src/agents/anthropic-payload-policy.ts index 4d046bf19f1..665a3343237 100644 --- a/src/agents/anthropic-payload-policy.ts +++ b/src/agents/anthropic-payload-policy.ts @@ -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, 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, ): void { diff --git a/src/agents/auth-profiles/constants.ts b/src/agents/auth-profiles/constants.ts index 9e0ba5207f8..bf32e0397a4 100644 --- a/src/agents/auth-profiles/constants.ts +++ b/src/agents/auth-profiles/constants.ts @@ -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 = { diff --git a/src/agents/cli-credentials.ts b/src/agents/cli-credentials.ts index 3d8adbb4719..5e0c9343e9c 100644 --- a/src/agents/cli-credentials.ts +++ b/src/agents/cli-credentials.ts @@ -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; diff --git a/src/agents/gpt5-prompt-overlay.ts b/src/agents/gpt5-prompt-overlay.ts index 5c081d1bf47..7d0c33a0ed3 100644 --- a/src/agents/gpt5-prompt-overlay.ts +++ b/src/agents/gpt5-prompt-overlay.ts @@ -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 = ` 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. `; +/** @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, @@ -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; diff --git a/src/agents/model-auth-markers.ts b/src/agents/model-auth-markers.ts index 547b6d6160b..c592caad065 100644 --- a/src/agents/model-auth-markers.ts +++ b/src/agents/model-auth-markers.ts @@ -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 diff --git a/src/agents/openai-text-verbosity.ts b/src/agents/openai-text-verbosity.ts index cd5ba92274c..11cc76f4350 100644 --- a/src/agents/openai-text-verbosity.ts +++ b/src/agents/openai-text-verbosity.ts @@ -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 | undefined, ): OpenAITextVerbosity | undefined { diff --git a/src/agents/pi-embedded-runner/anthropic-family-tool-payload-compat.ts b/src/agents/pi-embedded-runner/anthropic-family-tool-payload-compat.ts index 398dc96c910..96990cc76df 100644 --- a/src/agents/pi-embedded-runner/anthropic-family-tool-payload-compat.ts +++ b/src/agents/pi-embedded-runner/anthropic-family-tool-payload-compat.ts @@ -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 { diff --git a/src/agents/pi-embedded-runner/minimax-stream-wrappers.ts b/src/agents/pi-embedded-runner/minimax-stream-wrappers.ts index 6890be2235c..b8a6e37071d 100644 --- a/src/agents/pi-embedded-runner/minimax-stream-wrappers.ts +++ b/src/agents/pi-embedded-runner/minimax-stream-wrappers.ts @@ -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) => { diff --git a/src/agents/pi-embedded-runner/moonshot-thinking-stream-wrappers.ts b/src/agents/pi-embedded-runner/moonshot-thinking-stream-wrappers.ts index 77a3a09df7d..5e108ce6bf8 100644 --- a/src/agents/pi-embedded-runner/moonshot-thinking-stream-wrappers.ts +++ b/src/agents/pi-embedded-runner/moonshot-thinking-stream-wrappers.ts @@ -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, diff --git a/src/agents/pi-embedded-runner/openai-stream-wrappers.ts b/src/agents/pi-embedded-runner/openai-stream-wrappers.ts index ece348ed847..ce6ab89c772 100644 --- a/src/agents/pi-embedded-runner/openai-stream-wrappers.ts +++ b/src/agents/pi-embedded-runner/openai-stream-wrappers.ts @@ -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 | 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 | 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 | 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 }, diff --git a/src/agents/pi-embedded-runner/openrouter-model-capabilities.ts b/src/agents/pi-embedded-runner/openrouter-model-capabilities.ts index 74c66323474..4ef13c844ad 100644 --- a/src/agents/pi-embedded-runner/openrouter-model-capabilities.ts +++ b/src/agents/pi-embedded-runner/openrouter-model-capabilities.ts @@ -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 { 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, diff --git a/src/agents/pi-embedded-runner/proxy-stream-wrappers.ts b/src/agents/pi-embedded-runner/proxy-stream-wrappers.ts index b7c5616faf7..5a658728561 100644 --- a/src/agents/pi-embedded-runner/proxy-stream-wrappers.ts +++ b/src/agents/pi-embedded-runner/proxy-stream-wrappers.ts @@ -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, diff --git a/src/agents/pi-embedded-runner/zai-stream-wrappers.ts b/src/agents/pi-embedded-runner/zai-stream-wrappers.ts index e9778c31a82..6fb2ece7f34 100644 --- a/src/agents/pi-embedded-runner/zai-stream-wrappers.ts +++ b/src/agents/pi-embedded-runner/zai-stream-wrappers.ts @@ -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; diff --git a/src/plugin-sdk/oauth-utils.ts b/src/plugin-sdk/oauth-utils.ts index 6642cd5f502..8e9093d1a48 100644 --- a/src/plugin-sdk/oauth-utils.ts +++ b/src/plugin-sdk/oauth-utils.ts @@ -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 { 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"); diff --git a/src/plugin-sdk/provider-auth.ts b/src/plugin-sdk/provider-auth.ts index ef42a5a86c4..7e4a17faa48 100644 --- a/src/plugin-sdk/provider-auth.ts +++ b/src/plugin-sdk/provider-auth.ts @@ -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; diff --git a/src/plugin-sdk/provider-model-shared.ts b/src/plugin-sdk/provider-model-shared.ts index abf12a36232..308c7a085c4 100644 --- a/src/plugin-sdk/provider-model-shared.ts +++ b/src/plugin-sdk/provider-model-shared.ts @@ -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", }); diff --git a/src/plugin-sdk/provider-stream-shared.ts b/src/plugin-sdk/provider-stream-shared.ts index 3222bc6efc2..0b9faac5220 100644 --- a/src/plugin-sdk/provider-stream-shared.ts +++ b/src/plugin-sdk/provider-stream-shared.ts @@ -20,6 +20,7 @@ export function composeProviderStreamWrappers( ); } +/** @deprecated Bundled provider stream helper; do not use from third-party plugins. */ export function defaultToolStreamExtraParams( extraParams?: Record, ): Record { @@ -107,6 +108,7 @@ function stripTrailingAssistantPrefillMessages(payload: Record) return stripped; } +/** @deprecated Anthropic-family provider stream helper; do not use from third-party plugins. */ export function stripTrailingAnthropicAssistantPrefillWhenThinking( payload: Record, ): 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[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; 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 { diff --git a/src/plugin-sdk/provider-stream.ts b/src/plugin-sdk/provider-stream.ts index 08183596598..e8c6a7e47f2 100644 --- a/src/plugin-sdk/provider-stream.ts +++ b/src/plugin-sdk/provider-stream.ts @@ -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"); diff --git a/src/plugins/provider-auth-token.ts b/src/plugins/provider-auth-token.ts index 1b8426a26d1..409e1d53ca6 100644 --- a/src/plugins/provider-auth-token.ts +++ b/src/plugins/provider-auth-token.ts @@ -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) { diff --git a/src/plugins/provider-model-compat.ts b/src/plugins/provider-model-compat.ts index e088669c8d9..7f4e5a52c40 100644 --- a/src/plugins/provider-model-compat.ts +++ b/src/plugins/provider-model-compat.ts @@ -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( model: T, patch: ModelCompatConfig, diff --git a/src/plugins/provider-replay-helpers.ts b/src/plugins/provider-replay-helpers.ts index 8df8cbd2b77..c4edd59988c 100644 --- a/src/plugins/provider-replay-helpers.ts +++ b/src/plugins/provider-replay-helpers.ts @@ -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"; }