Skip to content

Commit a3ae5c8

Browse files
committed
refactor(plugin-sdk): rename plain text tool-call compat wrapper
1 parent 23d38e4 commit a3ae5c8

12 files changed

Lines changed: 141 additions & 190 deletions

docs/plugins/sdk-provider-plugins.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ API key auth, and dynamic model resolution.
368368
Each family builder is composed from lower-level public helpers exported from the same package, which you can reach for when a provider needs to go off the common pattern:
369369

370370
- `openclaw/plugin-sdk/provider-model-shared` - `ProviderReplayFamily`, `buildProviderReplayFamilyHooks(...)`, and the raw replay builders (`buildOpenAICompatibleReplayPolicy`, `buildAnthropicReplayPolicyForModel`, `buildGoogleGeminiReplayPolicy`, `buildHybridAnthropicOrOpenAIReplayPolicy`). Also exports Gemini replay helpers (`sanitizeGoogleGeminiReplayHistory`, `resolveTaggedReasoningOutputMode`) and endpoint/model helpers (`resolveProviderEndpoint`, `normalizeProviderId`, `normalizeGooglePreviewModelId`).
371-
- `openclaw/plugin-sdk/provider-stream` - `ProviderStreamFamily`, `buildProviderStreamFamilyHooks(...)`, `composeProviderStreamWrappers(...)`, plus the shared OpenAI/Codex wrappers (`createOpenAIAttributionHeadersWrapper`, `createOpenAIFastModeWrapper`, `createOpenAIServiceTierWrapper`, `createOpenAIResponsesContextManagementWrapper`, `createCodexNativeWebSearchWrapper`), DeepSeek V4 OpenAI-compatible wrapper (`createDeepSeekV4OpenAICompatibleThinkingWrapper`), Anthropic Messages thinking prefill cleanup (`createAnthropicThinkingPrefillPayloadWrapper`), plain-text tool-call promotion (`createPlainTextToolCallPromotionWrapper`), and shared proxy/provider wrappers (`createOpenRouterWrapper`, `createToolStreamWrapper`, `createMinimaxFastModeWrapper`).
371+
- `openclaw/plugin-sdk/provider-stream` - `ProviderStreamFamily`, `buildProviderStreamFamilyHooks(...)`, `composeProviderStreamWrappers(...)`, plus the shared OpenAI/Codex wrappers (`createOpenAIAttributionHeadersWrapper`, `createOpenAIFastModeWrapper`, `createOpenAIServiceTierWrapper`, `createOpenAIResponsesContextManagementWrapper`, `createCodexNativeWebSearchWrapper`), DeepSeek V4 OpenAI-compatible wrapper (`createDeepSeekV4OpenAICompatibleThinkingWrapper`), Anthropic Messages thinking prefill cleanup (`createAnthropicThinkingPrefillPayloadWrapper`), plain-text tool-call compat (`createPlainTextToolCallCompatWrapper`), and shared proxy/provider wrappers (`createOpenRouterWrapper`, `createToolStreamWrapper`, `createMinimaxFastModeWrapper`).
372372
- `openclaw/plugin-sdk/provider-tools` - `ProviderToolCompatFamily`, `buildProviderToolCompatFamilyHooks("deepseek" | "gemini" | "openai")`, and underlying provider schema helpers.
373373

374374
Some stream helpers stay provider-local on purpose. `@openclaw/anthropic-provider` keeps `wrapAnthropicProviderStream`, `resolveAnthropicBetas`, `resolveAnthropicFastMode`, `resolveAnthropicServiceTier`, and the lower-level Anthropic wrapper builders in its own public `api.ts` / `contract-api.ts` seam because they encode Claude OAuth beta handling and `context1m` gating. The xAI plugin similarly keeps native xAI Responses shaping in its own `wrapStreamFn` (`/fast` aliases, default `tool_stream`, unsupported strict-tool cleanup, xAI-specific reasoning-payload removal).

docs/plugins/sdk-subpaths.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,8 @@ focused channel/runtime subpaths, `config-contracts`, `string-coerce-runtime`,
179179
| `plugin-sdk/embedding-providers` | General embedding provider types and read helpers, including `EmbeddingProviderAdapter`, `getEmbeddingProvider(...)`, and `listEmbeddingProviders(...)`; plugins register providers through `api.registerEmbeddingProvider(...)` so manifest ownership is enforced |
180180
| `plugin-sdk/provider-tools` | `ProviderToolCompatFamily`, `buildProviderToolCompatFamilyHooks`, and DeepSeek/Gemini/OpenAI schema cleanup + diagnostics |
181181
| `plugin-sdk/provider-usage` | `fetchClaudeUsage` and similar |
182-
| `plugin-sdk/provider-stream` | `ProviderStreamFamily`, `buildProviderStreamFamilyHooks`, `composeProviderStreamWrappers`, stream wrapper types, plain-text tool-call promotion, and shared Anthropic/Bedrock/DeepSeek V4/Google/Kilocode/Moonshot/OpenAI/OpenRouter/Z.A.I/MiniMax/Copilot wrapper helpers |
183-
| `plugin-sdk/provider-stream-shared` | Public shared provider stream wrapper helpers including `composeProviderStreamWrappers`, `createPlainTextToolCallPromotionWrapper`, `createPayloadPatchStreamWrapper`, `createToolStreamWrapper`, and Anthropic/DeepSeek/OpenAI-compatible stream utilities |
182+
| `plugin-sdk/provider-stream` | `ProviderStreamFamily`, `buildProviderStreamFamilyHooks`, `composeProviderStreamWrappers`, stream wrapper types, plain-text tool-call compat, and shared Anthropic/Bedrock/DeepSeek V4/Google/Kilocode/Moonshot/OpenAI/OpenRouter/Z.A.I/MiniMax/Copilot wrapper helpers |
183+
| `plugin-sdk/provider-stream-shared` | Public shared provider stream wrapper helpers including `composeProviderStreamWrappers`, `createPlainTextToolCallCompatWrapper`, `createPayloadPatchStreamWrapper`, `createToolStreamWrapper`, and Anthropic/DeepSeek/OpenAI-compatible stream utilities |
184184
| `plugin-sdk/provider-transport-runtime` | Native provider transport helpers such as guarded fetch, transport message transforms, and writable transport event streams |
185185
| `plugin-sdk/provider-onboard` | Onboarding config patch helpers |
186186
| `plugin-sdk/global-singleton` | Process-local singleton/map/cache helpers |

extensions/lmstudio/src/stream.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { StreamFn } from "@earendil-works/pi-agent-core";
22
import { streamSimple } from "@earendil-works/pi-ai";
33
import { createSubsystemLogger } from "openclaw/plugin-sdk/logging-core";
44
import type { ProviderWrapStreamFnContext } from "openclaw/plugin-sdk/plugin-entry";
5-
import { createPlainTextToolCallPromotionWrapper } from "openclaw/plugin-sdk/provider-stream-shared";
5+
import { createPlainTextToolCallCompatWrapper } from "openclaw/plugin-sdk/provider-stream-shared";
66
import { ssrfPolicyFromHttpBaseUrlAllowedHostname } from "openclaw/plugin-sdk/ssrf-runtime";
77
import { LMSTUDIO_PROVIDER_ID } from "./defaults.js";
88
import { ensureLmstudioModelLoaded } from "./models.fetch.js";
@@ -179,7 +179,7 @@ async function ensureLmstudioModelLoadedBestEffort(params: {
179179

180180
export function wrapLmstudioInferencePreload(ctx: ProviderWrapStreamFnContext): StreamFn {
181181
const underlying = ctx.streamFn ?? streamSimple;
182-
const streamWithPlainTextToolCalls = createPlainTextToolCallPromotionWrapper(underlying);
182+
const streamWithPlainTextToolCalls = createPlainTextToolCallCompatWrapper(underlying);
183183
return (model, context, options) => {
184184
if (model.provider !== LMSTUDIO_PROVIDER_ID) {
185185
return underlying(model, context, options);

extensions/xai/stream.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { streamSimple } from "@earendil-works/pi-ai";
33
import type { ProviderWrapStreamFnContext } from "openclaw/plugin-sdk/plugin-entry";
44
import {
55
composeProviderStreamWrappers,
6-
createPlainTextToolCallPromotionWrapper,
6+
createPlainTextToolCallCompatWrapper,
77
createToolStreamWrapper,
88
} from "openclaw/plugin-sdk/provider-stream-shared";
99

@@ -355,7 +355,7 @@ export function wrapXaiProviderStream(ctx: ProviderWrapStreamFnContext): StreamF
355355
wrappedStreamFn = createXaiFastModeWrapper(wrappedStreamFn, fastMode);
356356
}
357357
wrappedStreamFn = createXaiToolCallArgumentDecodingWrapper(wrappedStreamFn);
358-
wrappedStreamFn = createPlainTextToolCallPromotionWrapper(wrappedStreamFn);
358+
wrappedStreamFn = createPlainTextToolCallCompatWrapper(wrappedStreamFn);
359359
return createToolStreamWrapper(wrappedStreamFn, toolStreamEnabled);
360360
});
361361
}

scripts/lib/plugin-sdk-entrypoints.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,6 @@
278278
"provider-model-shared",
279279
"provider-onboard",
280280
"provider-stream-family",
281-
"provider-stream-runtime-internal",
282281
"provider-stream-shared",
283282
"provider-transport-runtime",
284283
"provider-stream",

scripts/lib/plugin-sdk-private-local-only-subpaths.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
[
22
"codex-native-task-runtime",
3-
"provider-stream-runtime-internal",
43
"qa-channel",
54
"qa-channel-protocol",
65
"qa-lab",

src/plugin-sdk/provider-stream-runtime-internal.test.ts

Lines changed: 0 additions & 163 deletions
This file was deleted.

src/plugin-sdk/provider-stream-runtime-internal.ts

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)