@openclaw/moonshot-provider 2026.9.4 → 2026.9.6
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/activity.svg +30 -0
- package/assets/icon.png +0 -0
- package/dist/{kimi-web-search-provider-CxKQ2WXu.js → .setup/kimi-web-search-provider-c6i-_MVz.mjs} +1 -1
- package/dist/{kimi-web-search-provider.runtime-DouShtPb.js → .setup/kimi-web-search-provider.runtime-DRzTngzG.mjs} +11 -8
- package/dist/{openclaw.plugin-DbeMagEp.js → .setup/openclaw.plugin-CZNy9Kfm.mjs} +7 -5
- package/dist/api.js +2 -1
- package/dist/index.js +3 -3
- package/dist/media-understanding-provider.js +3 -2
- package/dist/onboard.js +2 -1
- package/dist/provider-catalog.js +2 -6
- package/dist/provider-contract-api.js +1 -1
- package/dist/provider-policy-api.js +6 -2
- package/dist/web-search-contract-api.js +1 -1
- package/dist/web-search-provider.js +1 -1
- package/openclaw.plugin.json +11 -3
- package/package.json +7 -5
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
|
2
|
+
<!--
|
|
3
|
+
Adapted from OpenClaw ui/public/provider-icons/ProviderIcon-kimi.svg.
|
|
4
|
+
Source: https://github.com/steipete/CodexBar/blob/215efbd39ad58acb4b0cd637c407d63e6183bc8d/Sources/CodexBar/Resources/ProviderIcon-kimi.svg
|
|
5
|
+
|
|
6
|
+
MIT License
|
|
7
|
+
Copyright (c) 2026 Peter Steinberger
|
|
8
|
+
|
|
9
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
11
|
+
in the Software without restriction, including without limitation the rights
|
|
12
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
14
|
+
furnished to do so, subject to the following conditions:
|
|
15
|
+
|
|
16
|
+
The above copyright notice and this permission notice shall be included in all
|
|
17
|
+
copies or substantial portions of the Software.
|
|
18
|
+
|
|
19
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
25
|
+
SOFTWARE.
|
|
26
|
+
|
|
27
|
+
Names and marks remain the property of their respective owners.
|
|
28
|
+
-->
|
|
29
|
+
<path fill="currentColor" fill-rule="evenodd" stroke="none" transform="translate(0 -0.56)" d="M21.7202 0.939941C22.9502 0.939941 23.9502 1.93994 23.9502 3.16994C23.9502 4.39994 22.9502 5.39994 21.7202 5.39994H19.7502C19.6002 5.39994 19.4902 5.27994 19.4902 5.13994V3.16994C19.4902 1.93994 20.4902 0.939941 21.7202 0.939941ZM9.39 13.9501L17.82 5.59012C17.98 5.43012 17.89 5.12012 17.68 5.12012H13.14C13.14 5.12012 13.04 5.14012 13 5.18012L3.92 14.1901C3.78 14.3301 3.57 14.2101 3.57 13.9801V5.39012C3.57 5.24012 3.47 5.12012 3.35 5.12012H0.219999C0.0999993 5.12012 0 5.24012 0 5.39012V23.9201C0 24.0701 0.0999993 24.1901 0.219999 24.1901H3.35C3.47 24.1901 3.57 24.0701 3.57 23.9201V20.1401C3.57 20.0601 3.6 19.9801 3.65 19.9301L6.47 17.1401C6.54 17.0701 6.63 17.0601 6.71 17.1101L14.24 22.6501C15.47 23.4801 16.85 23.9901 18.25 24.1401C18.37 24.1501 18.48 24.0301 18.48 23.8701V20.3101C18.48 20.1701 18.4 20.0601 18.29 20.0501C17.47 19.9201 16.66 19.6001 15.94 19.1101L9.42 14.3901C9.28 14.3001 9.27 14.0701 9.39 13.9501Z" />
|
|
30
|
+
</svg>
|
package/assets/icon.png
ADDED
|
Binary file
|
package/dist/{kimi-web-search-provider-CxKQ2WXu.js → .setup/kimi-web-search-provider-c6i-_MVz.mjs}
RENAMED
|
@@ -2,7 +2,7 @@ import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
|
2
2
|
import { createWebSearchProviderContractFields } from "openclaw/plugin-sdk/provider-web-search-config-contract";
|
|
3
3
|
//#region extensions/moonshot/src/kimi-web-search-provider.ts
|
|
4
4
|
const KIMI_CREDENTIAL_PATH = "plugins.entries.moonshot.config.webSearch.apiKey";
|
|
5
|
-
const loadKimiWebSearchProviderRuntime = createLazyRuntimeModule(() => import("./kimi-web-search-provider.runtime-
|
|
5
|
+
const loadKimiWebSearchProviderRuntime = createLazyRuntimeModule(() => import("./kimi-web-search-provider.runtime-DRzTngzG.mjs"));
|
|
6
6
|
const KimiSearchSchema = {
|
|
7
7
|
type: "object",
|
|
8
8
|
properties: {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { MOONSHOT_BASE_URL, MOONSHOT_CN_BASE_URL, isNativeMoonshotBaseUrl } from "
|
|
2
|
-
import
|
|
1
|
+
import { MOONSHOT_BASE_URL, MOONSHOT_CN_BASE_URL, isNativeMoonshotBaseUrl } from "../provider-policy-api.js";
|
|
2
|
+
import "../provider-catalog.js";
|
|
3
|
+
import { isRecord, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
4
|
import { createProviderHttpError, readProviderJsonObjectResponse } from "openclaw/plugin-sdk/provider-http";
|
|
4
5
|
import { MAX_SEARCH_COUNT, buildSearchCacheKey, buildUnsupportedSearchFilterResponse, mergeScopedSearchConfig, readCachedSearchPayload, readConfiguredSecretString, readPositiveIntegerParam, readProviderEnvValue, readStringParam, resolveProviderWebSearchPluginConfig, resolveSearchCacheTtlMs, resolveSearchTimeoutSeconds, setProviderWebSearchPluginConfigValue, withTrustedWebSearchEndpoint, wrapWebContent, writeCachedSearchPayload } from "openclaw/plugin-sdk/provider-web-search";
|
|
5
6
|
//#region extensions/moonshot/src/kimi-web-search-provider.runtime.ts
|
|
@@ -42,10 +43,13 @@ function extractKimiMessageText(message) {
|
|
|
42
43
|
if (content) return content;
|
|
43
44
|
return message?.reasoning_content?.trim() || void 0;
|
|
44
45
|
}
|
|
45
|
-
function
|
|
46
|
+
function collectKimiCitations(data, citations) {
|
|
46
47
|
const searchResults = data.search_results ?? [];
|
|
47
48
|
if (!Array.isArray(searchResults)) throwMalformedKimiResponse();
|
|
48
|
-
|
|
49
|
+
for (const entry of searchResults) {
|
|
50
|
+
const url = isRecord(entry) && typeof entry.url === "string" ? entry.url.trim() : "";
|
|
51
|
+
if (url) citations.add(url);
|
|
52
|
+
}
|
|
49
53
|
const choices = data.choices ?? [];
|
|
50
54
|
if (!Array.isArray(choices)) throwMalformedKimiResponse();
|
|
51
55
|
const firstChoice = choices[0];
|
|
@@ -58,14 +62,13 @@ function extractKimiCitations(data) {
|
|
|
58
62
|
try {
|
|
59
63
|
const parsed = JSON.parse(rawArguments);
|
|
60
64
|
const parsedUrl = normalizeOptionalString(parsed.url);
|
|
61
|
-
if (parsedUrl) citations.
|
|
65
|
+
if (parsedUrl) citations.add(parsedUrl);
|
|
62
66
|
for (const result of parsed.search_results ?? []) {
|
|
63
67
|
const resultUrl = normalizeOptionalString(result.url);
|
|
64
|
-
if (resultUrl) citations.
|
|
68
|
+
if (resultUrl) citations.add(resultUrl);
|
|
65
69
|
}
|
|
66
70
|
} catch {}
|
|
67
71
|
}
|
|
68
|
-
return uniqueStrings(citations);
|
|
69
72
|
}
|
|
70
73
|
function hasKimiSearchResults(data) {
|
|
71
74
|
const searchResults = data.search_results ?? [];
|
|
@@ -108,7 +111,7 @@ async function runKimiSearch(params) {
|
|
|
108
111
|
const data = await readProviderJsonObjectResponse(res, "Kimi API error");
|
|
109
112
|
if (!Array.isArray(data.choices)) throwMalformedKimiResponse();
|
|
110
113
|
if (hasKimiSearchResults(data)) hasGroundingEvidence = true;
|
|
111
|
-
|
|
114
|
+
collectKimiCitations(data, collectedCitations);
|
|
112
115
|
if (collectedCitations.size > 0) hasGroundingEvidence = true;
|
|
113
116
|
const choice = data.choices?.[0];
|
|
114
117
|
if (!isRecord(choice) || !isRecord(choice.message)) throwMalformedKimiResponse();
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
//#region extensions/moonshot/openclaw.plugin.json
|
|
2
2
|
var openclaw_plugin_default = {
|
|
3
3
|
id: "moonshot",
|
|
4
|
-
categories: [
|
|
5
|
-
"models",
|
|
6
|
-
"media",
|
|
7
|
-
"web"
|
|
8
|
-
],
|
|
4
|
+
categories: ["models"],
|
|
9
5
|
activation: { "onStartup": false },
|
|
10
6
|
enabledByDefault: true,
|
|
11
7
|
providerCatalogEntry: "./provider-discovery.ts",
|
|
@@ -159,6 +155,12 @@ var openclaw_plugin_default = {
|
|
|
159
155
|
},
|
|
160
156
|
"autoPriority": { "video": 20 }
|
|
161
157
|
} },
|
|
158
|
+
configGroups: [{
|
|
159
|
+
"id": "web-search",
|
|
160
|
+
"title": "Web search",
|
|
161
|
+
"order": 10,
|
|
162
|
+
"properties": ["webSearch"]
|
|
163
|
+
}],
|
|
162
164
|
configSchema: {
|
|
163
165
|
"type": "object",
|
|
164
166
|
"additionalProperties": false,
|
package/dist/api.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import { MOONSHOT_BASE_URL, MOONSHOT_CN_BASE_URL,
|
|
1
|
+
import { MOONSHOT_BASE_URL, MOONSHOT_CN_BASE_URL, isNativeMoonshotBaseUrl } from "./provider-policy-api.js";
|
|
2
|
+
import { MOONSHOT_DEFAULT_MODEL_ID, MOONSHOT_DEFAULT_MODEL_REF, applyMoonshotNativeStreamingUsageCompat, buildMoonshotProvider } from "./provider-catalog.js";
|
|
2
3
|
export { MOONSHOT_BASE_URL, MOONSHOT_CN_BASE_URL, MOONSHOT_DEFAULT_MODEL_ID, MOONSHOT_DEFAULT_MODEL_REF, applyMoonshotNativeStreamingUsageCompat, buildMoonshotProvider, isNativeMoonshotBaseUrl };
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { t as openclaw_plugin_default } from "
|
|
1
|
+
import { t as openclaw_plugin_default } from "./.setup/openclaw.plugin-CZNy9Kfm.mjs";
|
|
2
|
+
import { isMoonshotAlwaysThinkingModelId, isMoonshotK3NativeVideoRoute, resolveThinkingProfile } from "./provider-policy-api.js";
|
|
2
3
|
import { MOONSHOT_DEFAULT_MODEL_REF, buildMoonshotProvider } from "./provider-catalog.js";
|
|
3
4
|
import { moonshotMediaUnderstandingProvider } from "./media-understanding-provider.js";
|
|
4
|
-
import { isMoonshotAlwaysThinkingModelId, isMoonshotK3NativeVideoRoute, resolveThinkingProfile } from "./provider-policy-api.js";
|
|
5
5
|
import { wrapMoonshotStream } from "./native-video.js";
|
|
6
6
|
import { applyMoonshotConfig, applyMoonshotConfigCn } from "./onboard.js";
|
|
7
|
-
import { t as createKimiWebSearchProvider } from "
|
|
7
|
+
import { t as createKimiWebSearchProvider } from "./.setup/kimi-web-search-provider-c6i-_MVz.mjs";
|
|
8
8
|
import { createProviderApiKeyAuthMethod } from "openclaw/plugin-sdk/provider-auth-api-key";
|
|
9
9
|
import { defineSingleProviderPluginEntry } from "openclaw/plugin-sdk/provider-entry";
|
|
10
10
|
import { buildOpenAICompatibleReplayPolicy } from "openclaw/plugin-sdk/provider-model-shared";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { t as openclaw_plugin_default } from "
|
|
2
|
-
import { MOONSHOT_BASE_URL } from "./provider-
|
|
1
|
+
import { t as openclaw_plugin_default } from "./.setup/openclaw.plugin-CZNy9Kfm.mjs";
|
|
2
|
+
import { MOONSHOT_BASE_URL } from "./provider-policy-api.js";
|
|
3
|
+
import "./provider-catalog.js";
|
|
3
4
|
import { describeOpenAiCompatibleVideo } from "openclaw/plugin-sdk/media-understanding";
|
|
4
5
|
//#region extensions/moonshot/media-understanding-provider.ts
|
|
5
6
|
const DEFAULT_MOONSHOT_IMAGE_MODEL = openclaw_plugin_default.mediaUnderstandingProviderMetadata.moonshot.defaultModels.image;
|
package/dist/onboard.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { MOONSHOT_BASE_URL, MOONSHOT_CN_BASE_URL
|
|
1
|
+
import { MOONSHOT_BASE_URL, MOONSHOT_CN_BASE_URL } from "./provider-policy-api.js";
|
|
2
|
+
import { MOONSHOT_DEFAULT_MODEL_ID, MOONSHOT_DEFAULT_MODEL_REF, buildMoonshotProvider } from "./provider-catalog.js";
|
|
2
3
|
import { createDefaultModelsPresetAppliers } from "openclaw/plugin-sdk/provider-onboard";
|
|
3
4
|
//#region extensions/moonshot/onboard.ts
|
|
4
5
|
const moonshotPresetAppliers = createDefaultModelsPresetAppliers({
|
package/dist/provider-catalog.js
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import { t as openclaw_plugin_default } from "
|
|
1
|
+
import { t as openclaw_plugin_default } from "./.setup/openclaw.plugin-CZNy9Kfm.mjs";
|
|
2
|
+
import { MOONSHOT_BASE_URL, MOONSHOT_CN_BASE_URL, isNativeMoonshotBaseUrl } from "./provider-policy-api.js";
|
|
2
3
|
import { applyProviderNativeStreamingUsageCompat, buildManifestModelProviderConfig, readManifestProviderDefaultModelRef } from "openclaw/plugin-sdk/provider-catalog-shared";
|
|
3
4
|
//#region extensions/moonshot/provider-catalog.ts
|
|
4
|
-
const MOONSHOT_BASE_URL = "https://api.moonshot.ai/v1";
|
|
5
|
-
const MOONSHOT_CN_BASE_URL = "https://api.moonshot.cn/v1";
|
|
6
5
|
const MOONSHOT_DEFAULT_MODEL_REF = readManifestProviderDefaultModelRef(openclaw_plugin_default, "moonshot");
|
|
7
6
|
const MOONSHOT_DEFAULT_MODEL_ID = MOONSHOT_DEFAULT_MODEL_REF.slice(9);
|
|
8
|
-
function isNativeMoonshotBaseUrl(baseUrl) {
|
|
9
|
-
return [MOONSHOT_BASE_URL, MOONSHOT_CN_BASE_URL].some((official) => baseUrl === official || baseUrl === `${official}/`);
|
|
10
|
-
}
|
|
11
7
|
function applyMoonshotNativeStreamingUsageCompat(provider) {
|
|
12
8
|
return applyProviderNativeStreamingUsageCompat({
|
|
13
9
|
providerId: "moonshot",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as openclaw_plugin_default } from "
|
|
1
|
+
import { t as openclaw_plugin_default } from "./.setup/openclaw.plugin-CZNy9Kfm.mjs";
|
|
2
2
|
//#region extensions/moonshot/provider-contract-api.ts
|
|
3
3
|
const noopAuth = async () => ({ profiles: [] });
|
|
4
4
|
function createMoonshotProvider() {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { isNativeMoonshotBaseUrl } from "./provider-catalog.js";
|
|
2
1
|
//#region extensions/moonshot/provider-policy-api.ts
|
|
2
|
+
const MOONSHOT_BASE_URL = "https://api.moonshot.ai/v1";
|
|
3
|
+
const MOONSHOT_CN_BASE_URL = "https://api.moonshot.cn/v1";
|
|
3
4
|
const KIMI_K2_7_CODE_MODEL_ID = "kimi-k2.7-code";
|
|
4
5
|
const KIMI_K2_7_CODE_HIGHSPEED_MODEL_ID = "kimi-k2.7-code-highspeed";
|
|
5
6
|
const KIMI_K3_MODEL_ID = "kimi-k3";
|
|
@@ -17,6 +18,9 @@ const ALWAYS_THINKING_PROFILES = {
|
|
|
17
18
|
label: "on"
|
|
18
19
|
}
|
|
19
20
|
};
|
|
21
|
+
function isNativeMoonshotBaseUrl(baseUrl) {
|
|
22
|
+
return [MOONSHOT_BASE_URL, MOONSHOT_CN_BASE_URL].some((official) => baseUrl === official || baseUrl === `${official}/`);
|
|
23
|
+
}
|
|
20
24
|
function isMoonshotK3NativeVideoRoute(route) {
|
|
21
25
|
return route.provider === "moonshot" && route.modelId === "kimi-k3" && route.api === "openai-completions" && isNativeMoonshotBaseUrl(route.baseUrl);
|
|
22
26
|
}
|
|
@@ -43,4 +47,4 @@ function resolveThinkingProfile(context) {
|
|
|
43
47
|
};
|
|
44
48
|
}
|
|
45
49
|
//#endregion
|
|
46
|
-
export { KIMI_K2_7_CODE_HIGHSPEED_MODEL_ID, KIMI_K2_7_CODE_MODEL_ID, KIMI_K3_MODEL_ID, isMoonshotAlwaysThinkingModelId, isMoonshotK3NativeVideoRoute, resolveThinkingProfile };
|
|
50
|
+
export { KIMI_K2_7_CODE_HIGHSPEED_MODEL_ID, KIMI_K2_7_CODE_MODEL_ID, KIMI_K3_MODEL_ID, MOONSHOT_BASE_URL, MOONSHOT_CN_BASE_URL, isMoonshotAlwaysThinkingModelId, isMoonshotK3NativeVideoRoute, isNativeMoonshotBaseUrl, resolveThinkingProfile };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as createKimiWebSearchProvider } from "
|
|
1
|
+
import { t as createKimiWebSearchProvider } from "./.setup/kimi-web-search-provider-c6i-_MVz.mjs";
|
|
2
2
|
export { createKimiWebSearchProvider };
|
package/openclaw.plugin.json
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "moonshot",
|
|
3
3
|
"categories": [
|
|
4
|
-
"models"
|
|
5
|
-
"media",
|
|
6
|
-
"web"
|
|
4
|
+
"models"
|
|
7
5
|
],
|
|
8
6
|
"activation": {
|
|
9
7
|
"onStartup": false
|
|
@@ -219,6 +217,16 @@
|
|
|
219
217
|
}
|
|
220
218
|
}
|
|
221
219
|
},
|
|
220
|
+
"configGroups": [
|
|
221
|
+
{
|
|
222
|
+
"id": "web-search",
|
|
223
|
+
"title": "Web search",
|
|
224
|
+
"order": 10,
|
|
225
|
+
"properties": [
|
|
226
|
+
"webSearch"
|
|
227
|
+
]
|
|
228
|
+
}
|
|
229
|
+
],
|
|
222
230
|
"configSchema": {
|
|
223
231
|
"type": "object",
|
|
224
232
|
"additionalProperties": false,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/moonshot-provider",
|
|
3
|
-
"version": "2026.9.
|
|
3
|
+
"version": "2026.9.6",
|
|
4
4
|
"description": "OpenClaw Moonshot provider plugin",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"openclaw": {
|
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
"minHostVersion": ">=2026.6.9"
|
|
15
15
|
},
|
|
16
16
|
"compat": {
|
|
17
|
-
"pluginApi": ">=2026.9.
|
|
17
|
+
"pluginApi": ">=2026.9.6"
|
|
18
18
|
},
|
|
19
19
|
"build": {
|
|
20
|
-
"openclawVersion": "2026.9.
|
|
20
|
+
"openclawVersion": "2026.9.6",
|
|
21
21
|
"bundledDist": false
|
|
22
22
|
},
|
|
23
23
|
"release": {
|
|
@@ -35,10 +35,12 @@
|
|
|
35
35
|
"files": [
|
|
36
36
|
"dist/**",
|
|
37
37
|
"openclaw.plugin.json",
|
|
38
|
-
"README.md"
|
|
38
|
+
"README.md",
|
|
39
|
+
"assets/icon.png",
|
|
40
|
+
"assets/activity.svg"
|
|
39
41
|
],
|
|
40
42
|
"peerDependencies": {
|
|
41
|
-
"openclaw": ">=2026.9.
|
|
43
|
+
"openclaw": ">=2026.9.6"
|
|
42
44
|
},
|
|
43
45
|
"peerDependenciesMeta": {
|
|
44
46
|
"openclaw": {
|