Files
openclaw/extensions/mistral/index.ts
Peter Steinberger 6aa27d6ecd refactor: retire August compat windows (embedding API, pi aliases, target parser, spawning hook, setup exports, WhatsApp inbound aliases) (#124416)
* refactor(plugin-sdk): retire embedded Pi aliases

* refactor(channels): retire explicit target compatibility

* refactor(plugins): retire subagent spawning hook

* refactor(plugin-sdk): retire shipped channel setup exports

* refactor(whatsapp): retire inbound callback aliases

Proof: focused build and WhatsApp E2E green; broad WhatsApp suite 188/189 files green. extensions/whatsapp/src/monitor-inbox.policy.test.ts flakes only in the parallel batch and passes isolated (10/10).

* refactor(plugin-sdk): retire memory embedding registrar

Migrate every bundled provider and manifest to registerEmbeddingProvider and contracts.embeddingProviders. Preserve memory-specific batching, local-service acquisition, index identity, and auto-selection through the canonical generic registry adapter, then remove the parallel registrar, registry, diagnostics, contracts, tests, and docs.

* chore(plugin-sdk): tighten retired surface budgets

Pin the post-retirement public SDK surface to 144 entrypoints, 4,312 exports, 2,564 callable exports, and 1,133 deprecated exports; agent-harness-runtime now permits exactly nine deprecated exports.
2026-08-15 22:43:47 -07:00

55 lines
2.1 KiB
TypeScript

import { adaptMemoryEmbeddingProviderAdapter } from "openclaw/plugin-sdk/memory-core-host-engine-embeddings";
import { defineSingleProviderPluginEntry } from "openclaw/plugin-sdk/provider-entry";
import {
applyMistralModelCompat,
MISTRAL_MEDIUM_3_5_ID,
MISTRAL_SMALL_4_ID,
MISTRAL_SMALL_LATEST_ID,
} from "./api.js";
import { mistralMediaUnderstandingProvider } from "./media-understanding-provider.js";
import { mistralMemoryEmbeddingProviderAdapter } from "./memory-embedding-adapter.js";
import { applyMistralConfig } from "./onboard.js";
import manifest from "./openclaw.plugin.json" with { type: "json" };
import { buildMistralRealtimeTranscriptionProvider } from "./realtime-transcription-provider.js";
const PROVIDER_ID = "mistral";
function buildMistralReplayPolicy() {
return {
sanitizeToolCallIds: true,
toolCallIdMode: "strict9" as const,
};
}
export default defineSingleProviderPluginEntry({
id: PROVIDER_ID,
name: "Mistral Provider",
description: "Official Mistral provider plugin",
manifest,
provider: {
label: "Mistral",
docsPath: "/providers/models",
manifestAuth: { applyConfig: applyMistralConfig },
catalog: {
allowExplicitBaseUrl: true,
liveModelDiscovery: true,
},
matchesContextOverflowError: ({ errorMessage }) =>
/\bmistral\b.*(?:input.*too long|token limit.*exceeded)/i.test(errorMessage),
normalizeResolvedModel: ({ model }) => applyMistralModelCompat(model),
resolveThinkingProfile: ({ modelId }) =>
modelId === MISTRAL_SMALL_LATEST_ID ||
modelId === MISTRAL_SMALL_4_ID ||
modelId === MISTRAL_MEDIUM_3_5_ID
? { levels: [{ id: "off" }, { id: "high" }], defaultLevel: "off" }
: undefined,
buildReplayPolicy: () => buildMistralReplayPolicy(),
},
register(api) {
api.registerEmbeddingProvider(
adaptMemoryEmbeddingProviderAdapter(mistralMemoryEmbeddingProviderAdapter),
);
api.registerMediaUnderstandingProvider(mistralMediaUnderstandingProvider);
api.registerRealtimeTranscriptionProvider(buildMistralRealtimeTranscriptionProvider());
},
});