refactor: trim provider helper exports

This commit is contained in:
Peter Steinberger
2026-05-01 16:56:44 +01:00
parent e7f47f61ab
commit ea4d0a3ce7
12 changed files with 31 additions and 37 deletions

View File

@@ -39,7 +39,7 @@ function readStringValue(value: unknown): string | undefined {
return undefined;
}
export function resolveOllamaDiscoveryApiKey(params: {
function resolveOllamaDiscoveryApiKey(params: {
env: NodeJS.ProcessEnv;
baseUrl?: string;
explicitApiKey?: string;
@@ -169,7 +169,7 @@ export function shouldUseSyntheticOllamaAuth(
return isLocalOllamaBaseUrl(readProviderBaseUrl(providerConfig));
}
export function hasMeaningfulExplicitOllamaConfig(
function hasMeaningfulExplicitOllamaConfig(
providerConfig: ModelProviderConfig | undefined,
): boolean {
if (!providerConfig) {

View File

@@ -1,6 +1,6 @@
import { normalizeProviderId } from "openclaw/plugin-sdk/provider-model-shared";
export const OLLAMA_PROVIDER_ID = "ollama";
const OLLAMA_PROVIDER_ID = "ollama";
function uniqueModelPrefixCandidates(providerId?: string): string[] {
const candidates = [providerId, normalizeProviderId(providerId ?? ""), OLLAMA_PROVIDER_ID]

View File

@@ -65,7 +65,7 @@ function providerWizardByKey() {
describe("OpenAI plugin manifest", () => {
it("opts into staging bundled runtime dependencies", () => {
expect(packageJson.dependencies?.["@mariozechner/pi-ai"]).toBe("0.70.6");
expect(packageJson.dependencies?.["@mariozechner/pi-ai"]).toBe("0.71.1");
expect(packageJson.dependencies?.ws).toBe("^8.20.0");
expect(packageJson.openclaw?.bundle?.stageRuntimeDependencies).toBe(true);
});

View File

@@ -12,7 +12,7 @@ const OPENAI_PROVIDER_IDS = new Set(["openai", "openai-codex"]);
export const OPENAI_FRIENDLY_PROMPT_OVERLAY = GPT5_FRIENDLY_PROMPT_OVERLAY;
export const OPENAI_GPT5_BEHAVIOR_CONTRACT = GPT5_BEHAVIOR_CONTRACT;
export type OpenAIPromptOverlayMode = Gpt5PromptOverlayMode;
type OpenAIPromptOverlayMode = Gpt5PromptOverlayMode;
export function resolveOpenAIPromptOverlayMode(
pluginConfig?: Record<string, unknown>,

View File

@@ -31,7 +31,7 @@ import {
trimToUndefined,
} from "./realtime-provider-shared.js";
export type OpenAIRealtimeVoice =
type OpenAIRealtimeVoice =
| "alloy"
| "ash"
| "ballad"
@@ -776,5 +776,3 @@ export function buildOpenAIRealtimeVoiceProvider(): RealtimeVoiceProviderPlugin
createBrowserSession: createOpenAIRealtimeBrowserSession,
};
}
export type { OpenAIRealtimeVoiceProviderConfig };

View File

@@ -1,13 +1,17 @@
import { defineSingleProviderPluginEntry } from "openclaw/plugin-sdk/provider-entry";
import { applyQwenNativeStreamingUsageCompat } from "./api.js";
import { buildQwenMediaUnderstandingProvider } from "./media-understanding-provider.js";
import { isQwenCodingPlanBaseUrl, QWEN_36_PLUS_MODEL_ID, QWEN_BASE_URL } from "./models.js";
import {
isQwenCodingPlanBaseUrl,
QWEN_36_PLUS_MODEL_ID,
QWEN_BASE_URL,
QWEN_DEFAULT_MODEL_REF,
} from "./models.js";
import {
applyQwenConfig,
applyQwenConfigCn,
applyQwenStandardConfig,
applyQwenStandardConfigCn,
QWEN_DEFAULT_MODEL_REF,
} from "./onboard.js";
import { buildQwenProvider } from "./provider-catalog.js";
import { wrapQwenProviderStream } from "./stream.js";

View File

@@ -11,14 +11,6 @@ import {
} from "./models.js";
import { buildQwenProvider } from "./provider-catalog.js";
export {
QWEN_CN_BASE_URL,
QWEN_DEFAULT_MODEL_REF,
QWEN_GLOBAL_BASE_URL,
QWEN_STANDARD_CN_BASE_URL,
QWEN_STANDARD_GLOBAL_BASE_URL,
};
const qwenPresetAppliers = createModelCatalogPresetAppliers<[string]>({
primaryModelRef: QWEN_DEFAULT_MODEL_REF,
resolveParams: (_cfg: OpenClawConfig, baseUrl: string) => {
@@ -39,11 +31,11 @@ const qwenPresetAppliers = createModelCatalogPresetAppliers<[string]>({
},
});
export function applyQwenProviderConfig(cfg: OpenClawConfig): OpenClawConfig {
function applyQwenProviderConfig(cfg: OpenClawConfig): OpenClawConfig {
return qwenPresetAppliers.applyProviderConfig(cfg, QWEN_GLOBAL_BASE_URL);
}
export function applyQwenProviderConfigCn(cfg: OpenClawConfig): OpenClawConfig {
function applyQwenProviderConfigCn(cfg: OpenClawConfig): OpenClawConfig {
return qwenPresetAppliers.applyProviderConfig(cfg, QWEN_CN_BASE_URL);
}
@@ -55,11 +47,11 @@ export function applyQwenConfigCn(cfg: OpenClawConfig): OpenClawConfig {
return qwenPresetAppliers.applyConfig(cfg, QWEN_CN_BASE_URL);
}
export function applyQwenStandardProviderConfig(cfg: OpenClawConfig): OpenClawConfig {
function applyQwenStandardProviderConfig(cfg: OpenClawConfig): OpenClawConfig {
return qwenPresetAppliers.applyProviderConfig(cfg, QWEN_STANDARD_GLOBAL_BASE_URL);
}
export function applyQwenStandardProviderConfigCn(cfg: OpenClawConfig): OpenClawConfig {
function applyQwenStandardProviderConfigCn(cfg: OpenClawConfig): OpenClawConfig {
return qwenPresetAppliers.applyProviderConfig(cfg, QWEN_STANDARD_CN_BASE_URL);
}

View File

@@ -10,16 +10,16 @@ import {
} from "./tool-config-shared.js";
import { type XaiWebSearchResponse } from "./web-search-shared.js";
export const XAI_CODE_EXECUTION_ENDPOINT = XAI_RESPONSES_ENDPOINT;
export const XAI_DEFAULT_CODE_EXECUTION_MODEL = "grok-4-1-fast";
const XAI_CODE_EXECUTION_ENDPOINT = XAI_RESPONSES_ENDPOINT;
const XAI_DEFAULT_CODE_EXECUTION_MODEL = "grok-4-1-fast";
export type XaiCodeExecutionResponse = XaiWebSearchResponse & {
type XaiCodeExecutionResponse = XaiWebSearchResponse & {
output?: Array<{
type?: string;
}>;
};
export type XaiCodeExecutionResult = {
type XaiCodeExecutionResult = {
content: string;
citations: string[];
usedCodeExecution: boolean;

View File

@@ -13,7 +13,7 @@ import {
resolveSecretInputString,
} from "openclaw/plugin-sdk/secret-input";
export type XaiFallbackAuth = {
type XaiFallbackAuth = {
apiKey: string;
source: string;
};

View File

@@ -11,15 +11,15 @@ import type { XaiWebSearchResponse } from "./web-search-response.types.js";
export { extractXaiWebSearchContent } from "./responses-tool-shared.js";
export type { XaiWebSearchResponse } from "./web-search-response.types.js";
export const XAI_WEB_SEARCH_ENDPOINT = XAI_RESPONSES_ENDPOINT;
export const XAI_DEFAULT_WEB_SEARCH_MODEL = "grok-4-1-fast";
const XAI_WEB_SEARCH_ENDPOINT = XAI_RESPONSES_ENDPOINT;
const XAI_DEFAULT_WEB_SEARCH_MODEL = "grok-4-1-fast";
type XaiWebSearchConfig = Record<string, unknown> & {
model?: unknown;
inlineCitations?: unknown;
};
export type XaiWebSearchResult = {
type XaiWebSearchResult = {
content: string;
citations: string[];
inlineCitations?: XaiWebSearchResponse["inline_citations"];
@@ -51,7 +51,7 @@ export function buildXaiWebSearchPayload(params: {
};
}
export function resolveXaiSearchConfig(searchConfig?: Record<string, unknown>): XaiWebSearchConfig {
function resolveXaiSearchConfig(searchConfig?: Record<string, unknown>): XaiWebSearchConfig {
return (
(isRecord(searchConfig?.grok) ? (searchConfig.grok as XaiWebSearchConfig) : undefined) ?? {}
);

View File

@@ -10,13 +10,13 @@ function cloneRecord<T extends JsonRecord | undefined>(value: T): T {
return { ...value } as T;
}
export function resolveLegacyXSearchConfig(config?: OpenClawConfig): JsonRecord | undefined {
function resolveLegacyXSearchConfig(config?: OpenClawConfig): JsonRecord | undefined {
const web = config?.tools?.web as Record<string, unknown> | undefined;
const xSearch = web?.x_search;
return isRecord(xSearch) ? cloneRecord(xSearch) : undefined;
}
export function resolvePluginXSearchConfig(config?: OpenClawConfig): JsonRecord | undefined {
function resolvePluginXSearchConfig(config?: OpenClawConfig): JsonRecord | undefined {
const pluginConfig = config?.plugins?.entries?.xai?.config;
if (!isRecord(pluginConfig?.xSearch)) {
return undefined;

View File

@@ -11,10 +11,10 @@ import {
} from "./tool-config-shared.js";
import { type XaiWebSearchResponse } from "./web-search-shared.js";
export const XAI_X_SEARCH_ENDPOINT = XAI_RESPONSES_ENDPOINT;
const XAI_X_SEARCH_ENDPOINT = XAI_RESPONSES_ENDPOINT;
export const XAI_DEFAULT_X_SEARCH_MODEL = "grok-4-1-fast-non-reasoning";
export type XaiXSearchConfig = {
type XaiXSearchConfig = {
apiKey?: unknown;
model?: unknown;
inlineCitations?: unknown;
@@ -31,13 +31,13 @@ export type XaiXSearchOptions = {
enableVideoUnderstanding?: boolean;
};
export type XaiXSearchResult = {
type XaiXSearchResult = {
content: string;
citations: string[];
inlineCitations?: XaiWebSearchResponse["inline_citations"];
};
export function resolveXaiXSearchConfig(config?: Record<string, unknown>): XaiXSearchConfig {
function resolveXaiXSearchConfig(config?: Record<string, unknown>): XaiXSearchConfig {
return coerceXaiToolConfig(config) as XaiXSearchConfig;
}