@openclaw/xiaomi-provider 2026.9.6 → 2026.9.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/assets/icon.png CHANGED
Binary file
package/dist/index.js CHANGED
@@ -8,6 +8,7 @@ import { buildOpenAICompatibleLiveProviderCatalog } from "openclaw/plugin-sdk/pr
8
8
  import { applyModelCompatPatch, buildProviderReplayFamilyHooks } from "openclaw/plugin-sdk/provider-model-shared";
9
9
  import { createDeepSeekV4OpenAICompatibleThinkingWrapper } from "openclaw/plugin-sdk/provider-stream-shared";
10
10
  import { PROVIDER_LABELS } from "openclaw/plugin-sdk/provider-usage";
11
+ import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
11
12
  //#region extensions/xiaomi/index.ts
12
13
  const PAYG_FLAG_NAME = "--xiaomi-api-key";
13
14
  const PAYG_OPTION_KEY = "xiaomiApiKey";
@@ -34,20 +35,11 @@ const XIAOMI_PROVIDER_HOOKS = {
34
35
  resolveThinkingProfile: ({ modelId }) => resolveMiMoThinkingProfile(modelId),
35
36
  isModernModelRef: ({ modelId }) => Boolean(resolveMiMoThinkingProfile(modelId))
36
37
  };
37
- function trimConfiguredBaseUrl(ctx, providerId) {
38
- const configuredProvider = ctx.config.models?.providers?.[providerId];
39
- return (typeof configuredProvider?.baseUrl === "string" ? configuredProvider.baseUrl.trim() : "") || void 0;
40
- }
41
- function hasConfiguredProviderEntry(ctx, providerId) {
42
- const configuredProvider = ctx.config.models?.providers?.[providerId];
43
- return Boolean(configuredProvider && typeof configuredProvider === "object");
44
- }
45
38
  async function resolveXiaomiCatalog(params) {
46
39
  const auth = params.ctx.resolveProviderApiKey(params.providerId);
47
40
  if (!auth.apiKey) return null;
48
- if (params.requireConfiguredProvider === true && !hasConfiguredProviderEntry(params.ctx, params.providerId)) return null;
49
- const explicitBaseUrl = trimConfiguredBaseUrl(params.ctx, params.providerId);
50
- if (params.requireBaseUrl === true && !explicitBaseUrl) return null;
41
+ const explicitBaseUrl = normalizeOptionalString(params.ctx.config.models?.providers?.[params.providerId]?.baseUrl);
42
+ if (params.requiresRegion && !explicitBaseUrl) return null;
51
43
  return await buildOpenAICompatibleLiveProviderCatalog({
52
44
  discoveryMode: "strict",
53
45
  providerId: params.providerId,
@@ -73,11 +65,8 @@ function assertCompatibleXiaomiKey(params) {
73
65
  const message = buildXiaomiKeyMismatchMessage(params);
74
66
  if (message) throw new Error(message);
75
67
  }
76
- function resolveProfileId(providerId) {
77
- return `${providerId}:default`;
78
- }
79
68
  async function runXiaomiApiKeyAuth(ctx, params) {
80
- const profileId = resolveProfileId(params.providerId);
69
+ const profileId = `${params.providerId}:default`;
81
70
  const { apiKey, input, mode } = await captureProviderApiKey(ctx, {
82
71
  token: normalizeOptionalSecretInput(ctx.opts?.[params.optionKey]) ?? normalizeOptionalSecretInput(ctx.opts?.token),
83
72
  tokenProvider: normalizeOptionalSecretInput(ctx.opts?.[params.optionKey]) ? params.providerId : normalizeOptionalSecretInput(ctx.opts?.tokenProvider),
@@ -113,7 +102,7 @@ async function runXiaomiApiKeyAuthNonInteractive(ctx, params) {
113
102
  actualKey: resolved.key,
114
103
  expectedKind: params.expectedKind
115
104
  });
116
- const profileId = resolveProfileId(params.providerId);
105
+ const profileId = `${params.providerId}:default`;
117
106
  if (!await persistProviderApiKey(ctx, profileId, {
118
107
  provider: params.providerId,
119
108
  resolved
@@ -200,8 +189,7 @@ var xiaomi_default = definePluginEntry({
200
189
  ctx,
201
190
  providerId: provider.id,
202
191
  buildProvider: provider.buildProvider,
203
- requireConfiguredProvider: provider.requiresRegion,
204
- requireBaseUrl: provider.requiresRegion
192
+ requiresRegion: provider.requiresRegion
205
193
  })
206
194
  },
207
195
  staticCatalog: {
@@ -1,7 +1,7 @@
1
+ import { asOptionalRecord, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
1
2
  import { resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
2
3
  import { normalizeResolvedSecretInputString } from "openclaw/plugin-sdk/secret-input";
3
4
  import { resolveSpeechProviderApiKey } from "openclaw/plugin-sdk/speech-provider";
4
- import { asOptionalRecord, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
5
5
  //#region extensions/xiaomi/speech-provider.ts
6
6
  const DEFAULT_XIAOMI_TTS_BASE_URL = "https://api.xiaomimimo.com/v1";
7
7
  const DEFAULT_XIAOMI_TTS_MODEL = "mimo-v2.5-tts";
@@ -25,7 +25,7 @@ function normalizeXiaomiTtsBaseUrl(baseUrl) {
25
25
  }
26
26
  function normalizeXiaomiTtsFormat(value) {
27
27
  const normalized = normalizeOptionalString(value)?.toLowerCase();
28
- return XIAOMI_TTS_FORMATS.includes(normalized) ? normalized : void 0;
28
+ return XIAOMI_TTS_FORMATS.find((format) => format === normalized);
29
29
  }
30
30
  function resolveXiaomiTtsConfigRecord(rawConfig) {
31
31
  const providers = asOptionalRecord(rawConfig.providers);
@@ -45,22 +45,8 @@ function normalizeXiaomiTtsProviderConfig(rawConfig) {
45
45
  style: normalizeOptionalString(raw?.style)
46
46
  };
47
47
  }
48
- function readXiaomiTtsProviderConfig(config) {
49
- const normalized = normalizeXiaomiTtsProviderConfig({});
50
- return {
51
- apiKey: normalizeResolvedSecretInputString({
52
- value: config.apiKey,
53
- path: "tts.providers.xiaomi.apiKey"
54
- }) ?? normalized.apiKey,
55
- baseUrl: normalizeXiaomiTtsBaseUrl(normalizeOptionalString(config.baseUrl) ?? normalized.baseUrl),
56
- model: normalizeOptionalString(config.model) ?? normalizeOptionalString(config.modelId) ?? normalized.model,
57
- voice: normalizeOptionalString(config.speakerVoice) ?? normalizeOptionalString(config.speakerVoiceId) ?? normalizeOptionalString(config.voice) ?? normalizeOptionalString(config.voiceId) ?? normalized.voice,
58
- format: normalizeXiaomiTtsFormat(config.format) ?? normalized.format,
59
- style: normalizeOptionalString(config.style) ?? normalized.style
60
- };
61
- }
62
48
  function resolveXiaomiTtsProviderConfig(config) {
63
- const providerConfig = readXiaomiTtsProviderConfig(config);
49
+ const providerConfig = normalizeXiaomiTtsProviderConfig({ xiaomi: config });
64
50
  const resolvedKey = resolveSpeechProviderApiKey(providerConfig.apiKey, process.env.XIAOMI_API_KEY);
65
51
  return {
66
52
  ...providerConfig,
@@ -147,7 +133,7 @@ function buildXiaomiTtsAudio(params) {
147
133
  async function xiaomiTTS(params) {
148
134
  const { text, apiKey, baseUrl, model, voice, format, style, timeoutMs } = params;
149
135
  const requestTimeoutMs = resolveTimerTimeoutMs(timeoutMs, 1);
150
- const { canonicalizeBase64 } = await import("openclaw/plugin-sdk/media-runtime");
136
+ const { canonicalizeBase64 } = await import("openclaw/plugin-sdk/blob-runtime");
151
137
  const { assertOkOrThrowProviderError, readProviderJsonResponse } = await import("openclaw/plugin-sdk/provider-http");
152
138
  const { fetchWithSsrFGuard, ssrfPolicyFromHttpBaseUrlAllowedHostname } = await import("openclaw/plugin-sdk/ssrf-runtime");
153
139
  const controller = new AbortController();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/xiaomi-provider",
3
- "version": "2026.9.6",
3
+ "version": "2026.9.8",
4
4
  "description": "OpenClaw Xiaomi provider plugin.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -18,10 +18,10 @@
18
18
  "minHostVersion": ">=2026.7.2"
19
19
  },
20
20
  "compat": {
21
- "pluginApi": ">=2026.9.6"
21
+ "pluginApi": ">=2026.9.8"
22
22
  },
23
23
  "build": {
24
- "openclawVersion": "2026.9.6",
24
+ "openclawVersion": "2026.9.8",
25
25
  "bundledDist": false
26
26
  },
27
27
  "release": {
@@ -40,7 +40,7 @@
40
40
  "assets/activity.svg"
41
41
  ],
42
42
  "peerDependencies": {
43
- "openclaw": ">=2026.9.6"
43
+ "openclaw": ">=2026.9.8"
44
44
  },
45
45
  "peerDependenciesMeta": {
46
46
  "openclaw": {