refactor: trim provider internal exports

This commit is contained in:
Peter Steinberger
2026-05-01 11:26:20 +01:00
parent bfa48c4025
commit 19cb778451
5 changed files with 12 additions and 14 deletions

View File

@@ -51,8 +51,8 @@ function isSupportedRegion(region: string): boolean {
// Bearer token resolution
// ---------------------------------------------------------------------------
export type MantleBearerTokenProvider = () => Promise<string>;
export type MantleBearerTokenProviderFactory = (opts?: {
type MantleBearerTokenProvider = () => Promise<string>;
type MantleBearerTokenProviderFactory = (opts?: {
region?: string;
expiresInSeconds?: number;
}) => MantleBearerTokenProvider;

View File

@@ -10,7 +10,7 @@ import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/text-runtim
// Types & constants
// ---------------------------------------------------------------------------
export type BedrockEmbeddingClient = {
type BedrockEmbeddingClient = {
region: string;
model: string;
dimensions?: number;
@@ -162,7 +162,7 @@ async function loadCredentialProviderSdk(): Promise<AwsCredentialProviderSdk | n
const MODEL_PREFIX_RE = /^(?:bedrock|amazon-bedrock|aws)\//;
const REGION_RE = /bedrock-runtime\.([a-z0-9-]+)\./;
export function normalizeBedrockEmbeddingModel(model: string): string {
function normalizeBedrockEmbeddingModel(model: string): string {
const trimmed = model.trim();
return trimmed ? trimmed.replace(MODEL_PREFIX_RE, "") : DEFAULT_BEDROCK_EMBEDDING_MODEL;
}
@@ -337,7 +337,7 @@ export async function createBedrockEmbeddingProvider(
// Client resolution
// ---------------------------------------------------------------------------
export function resolveBedrockEmbeddingClient(
function resolveBedrockEmbeddingClient(
options: MemoryEmbeddingProviderCreateOptions,
): BedrockEmbeddingClient {
const model = normalizeBedrockEmbeddingModel(options.model);

View File

@@ -165,7 +165,7 @@ function toCanonicalAnthropicModelRef(ref: string): string {
: ref;
}
export function normalizeAnthropicProviderConfig<T extends { api?: string; models?: unknown[] }>(
function normalizeAnthropicProviderConfig<T extends { api?: string; models?: unknown[] }>(
providerConfig: T,
): T {
if (

View File

@@ -12,7 +12,7 @@ export const DEFAULT_AZURE_SPEECH_AUDIO_FORMAT = "audio-24khz-48kbitrate-mono-mp
export const DEFAULT_AZURE_SPEECH_VOICE_NOTE_FORMAT = "ogg-24khz-16bit-mono-opus";
export const DEFAULT_AZURE_SPEECH_TELEPHONY_FORMAT = "raw-8khz-8bit-mono-mulaw";
export type AzureSpeechVoiceEntry = {
type AzureSpeechVoiceEntry = {
ShortName?: string;
DisplayName?: string;
LocalName?: string;
@@ -52,11 +52,11 @@ function azureSpeechUrl(params: {
return `${baseUrl}${params.path}`;
}
export function escapeXmlText(text: string): string {
function escapeXmlText(text: string): string {
return text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
}
export function escapeXmlAttr(value: string): string {
function escapeXmlAttr(value: string): string {
return escapeXmlText(value).replace(/"/g, "&quot;").replace(/'/g, "&apos;");
}

View File

@@ -8,7 +8,7 @@ import {
resolveCloudflareAiGatewayBaseUrl,
} from "./models.js";
export type CloudflareAiGatewayCredential =
type CloudflareAiGatewayCredential =
| {
type?: string;
keyRef?: unknown;
@@ -20,9 +20,7 @@ export type CloudflareAiGatewayCredential =
}
| undefined;
export function resolveCloudflareAiGatewayApiKey(
cred: CloudflareAiGatewayCredential,
): string | undefined {
function resolveCloudflareAiGatewayApiKey(cred: CloudflareAiGatewayCredential): string | undefined {
if (!cred || cred.type !== "api_key") {
return undefined;
}
@@ -35,7 +33,7 @@ export function resolveCloudflareAiGatewayApiKey(
return normalizeOptionalString(cred.key);
}
export function resolveCloudflareAiGatewayMetadata(cred: CloudflareAiGatewayCredential): {
function resolveCloudflareAiGatewayMetadata(cred: CloudflareAiGatewayCredential): {
accountId?: string;
gatewayId?: string;
} {