@openclaw/kimi-provider 2026.7.2-beta.7 → 2026.8.1-beta.2
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/dist/stream.js +41 -41
- package/package.json +4 -4
package/dist/stream.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isKimiK3ModelId } from "./provider-policy-api.js";
|
|
2
2
|
import { normalizeOptionalLowercaseString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
3
|
import { streamSimple } from "openclaw/plugin-sdk/llm";
|
|
4
|
-
import {
|
|
4
|
+
import { createPayloadPatchStreamWrapper, normalizeOpenAICompatibleReasoningReplay } from "openclaw/plugin-sdk/provider-stream-shared";
|
|
5
5
|
//#region extensions/kimi-coding/stream.ts
|
|
6
6
|
const TOOL_CALLS_SECTION_BEGIN = "<|tool_calls_section_begin|>";
|
|
7
7
|
const TOOL_CALLS_SECTION_END = "<|tool_calls_section_end|>";
|
|
@@ -219,7 +219,45 @@ function createKimiToolCallMarkupWrapper(baseStreamFn) {
|
|
|
219
219
|
};
|
|
220
220
|
}
|
|
221
221
|
function createKimiThinkingWrapper(baseStreamFn, thinkingConfig, k3ThinkingConfig) {
|
|
222
|
-
const
|
|
222
|
+
const payloadWrapper = createPayloadPatchStreamWrapper(baseStreamFn ?? streamSimple, ({ payload: payloadObj, model }) => {
|
|
223
|
+
if (model.api === "anthropic-messages" && isKimiK3ModelId(model.id)) {
|
|
224
|
+
const outputConfig = payloadObj.output_config;
|
|
225
|
+
if (k3ThinkingConfig.type === "disabled") {
|
|
226
|
+
payloadObj.thinking = { type: "disabled" };
|
|
227
|
+
if (outputConfig && typeof outputConfig === "object" && !Array.isArray(outputConfig)) {
|
|
228
|
+
const nextOutputConfig = { ...outputConfig };
|
|
229
|
+
delete nextOutputConfig.effort;
|
|
230
|
+
if (Object.keys(nextOutputConfig).length > 0) payloadObj.output_config = nextOutputConfig;
|
|
231
|
+
else delete payloadObj.output_config;
|
|
232
|
+
} else delete payloadObj.output_config;
|
|
233
|
+
} else {
|
|
234
|
+
payloadObj.thinking = {
|
|
235
|
+
type: "adaptive",
|
|
236
|
+
display: "summarized"
|
|
237
|
+
};
|
|
238
|
+
payloadObj.output_config = outputConfig && typeof outputConfig === "object" && !Array.isArray(outputConfig) ? {
|
|
239
|
+
...outputConfig,
|
|
240
|
+
effort: k3ThinkingConfig.effort
|
|
241
|
+
} : { effort: k3ThinkingConfig.effort };
|
|
242
|
+
}
|
|
243
|
+
delete payloadObj.reasoning;
|
|
244
|
+
delete payloadObj.reasoning_effort;
|
|
245
|
+
delete payloadObj.reasoningEffort;
|
|
246
|
+
stripAnthropicCacheControlMarkers(payloadObj);
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
const normalized = typeof thinkingConfig === "string" ? { type: thinkingConfig } : thinkingConfig;
|
|
250
|
+
payloadObj.thinking = model.api === "anthropic-messages" ? { ...normalized } : { type: normalized.type };
|
|
251
|
+
if (model.api === "anthropic-messages") ensureKimiAnthropicMaxTokens(payloadObj, normalized);
|
|
252
|
+
else normalizeOpenAICompatibleReasoningReplay(payloadObj, {
|
|
253
|
+
thinkingEnabled: normalized.type === "enabled",
|
|
254
|
+
shouldBackfillAssistantMessage: (message) => Array.isArray(message.tool_calls) && message.tool_calls.length > 0
|
|
255
|
+
});
|
|
256
|
+
delete payloadObj.reasoning;
|
|
257
|
+
delete payloadObj.reasoning_effort;
|
|
258
|
+
delete payloadObj.reasoningEffort;
|
|
259
|
+
stripAnthropicCacheControlMarkers(payloadObj);
|
|
260
|
+
});
|
|
223
261
|
return (model, context, options) => {
|
|
224
262
|
const runtimeModel = model.api === "anthropic-messages" && isKimiK3ModelId(model.id) ? {
|
|
225
263
|
...model,
|
|
@@ -228,45 +266,7 @@ function createKimiThinkingWrapper(baseStreamFn, thinkingConfig, k3ThinkingConfi
|
|
|
228
266
|
allowEmptySignature: true
|
|
229
267
|
}
|
|
230
268
|
} : model;
|
|
231
|
-
return
|
|
232
|
-
if (model.api === "anthropic-messages" && isKimiK3ModelId(model.id)) {
|
|
233
|
-
const outputConfig = payloadObj.output_config;
|
|
234
|
-
if (k3ThinkingConfig.type === "disabled") {
|
|
235
|
-
payloadObj.thinking = { type: "disabled" };
|
|
236
|
-
if (outputConfig && typeof outputConfig === "object" && !Array.isArray(outputConfig)) {
|
|
237
|
-
const nextOutputConfig = { ...outputConfig };
|
|
238
|
-
delete nextOutputConfig.effort;
|
|
239
|
-
if (Object.keys(nextOutputConfig).length > 0) payloadObj.output_config = nextOutputConfig;
|
|
240
|
-
else delete payloadObj.output_config;
|
|
241
|
-
} else delete payloadObj.output_config;
|
|
242
|
-
} else {
|
|
243
|
-
payloadObj.thinking = {
|
|
244
|
-
type: "adaptive",
|
|
245
|
-
display: "summarized"
|
|
246
|
-
};
|
|
247
|
-
payloadObj.output_config = outputConfig && typeof outputConfig === "object" && !Array.isArray(outputConfig) ? {
|
|
248
|
-
...outputConfig,
|
|
249
|
-
effort: k3ThinkingConfig.effort
|
|
250
|
-
} : { effort: k3ThinkingConfig.effort };
|
|
251
|
-
}
|
|
252
|
-
delete payloadObj.reasoning;
|
|
253
|
-
delete payloadObj.reasoning_effort;
|
|
254
|
-
delete payloadObj.reasoningEffort;
|
|
255
|
-
stripAnthropicCacheControlMarkers(payloadObj);
|
|
256
|
-
return;
|
|
257
|
-
}
|
|
258
|
-
const normalized = typeof thinkingConfig === "string" ? { type: thinkingConfig } : thinkingConfig;
|
|
259
|
-
payloadObj.thinking = model.api === "anthropic-messages" ? { ...normalized } : { type: normalized.type };
|
|
260
|
-
if (model.api === "anthropic-messages") ensureKimiAnthropicMaxTokens(payloadObj, normalized);
|
|
261
|
-
else normalizeOpenAICompatibleReasoningReplay(payloadObj, {
|
|
262
|
-
thinkingEnabled: normalized.type === "enabled",
|
|
263
|
-
shouldBackfillAssistantMessage: (message) => Array.isArray(message.tool_calls) && message.tool_calls.length > 0
|
|
264
|
-
});
|
|
265
|
-
delete payloadObj.reasoning;
|
|
266
|
-
delete payloadObj.reasoning_effort;
|
|
267
|
-
delete payloadObj.reasoningEffort;
|
|
268
|
-
stripAnthropicCacheControlMarkers(payloadObj);
|
|
269
|
-
});
|
|
269
|
+
return payloadWrapper(runtimeModel, context, options);
|
|
270
270
|
};
|
|
271
271
|
}
|
|
272
272
|
function stripContentBlockCacheControl(block) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/kimi-provider",
|
|
3
|
-
"version": "2026.
|
|
3
|
+
"version": "2026.8.1-beta.2",
|
|
4
4
|
"description": "OpenClaw Kimi provider plugin.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
"minHostVersion": ">=2026.6.8"
|
|
19
19
|
},
|
|
20
20
|
"compat": {
|
|
21
|
-
"pluginApi": ">=2026.
|
|
21
|
+
"pluginApi": ">=2026.8.1-beta.2"
|
|
22
22
|
},
|
|
23
23
|
"build": {
|
|
24
|
-
"openclawVersion": "2026.
|
|
24
|
+
"openclawVersion": "2026.8.1-beta.2",
|
|
25
25
|
"bundledDist": false
|
|
26
26
|
},
|
|
27
27
|
"release": {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"README.md"
|
|
39
39
|
],
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"openclaw": ">=2026.
|
|
41
|
+
"openclaw": ">=2026.8.1-beta.2"
|
|
42
42
|
},
|
|
43
43
|
"peerDependenciesMeta": {
|
|
44
44
|
"openclaw": {
|