fix(kimi): honor K3 thinking off (#109335)

* fix(kimi): honor K3 thinking off

* chore: defer Kimi release note

* test(kimi): narrow live reasoning blocks
This commit is contained in:
Peter Steinberger
2026-07-16 13:50:15 -07:00
committed by GitHub
parent 6dc3e6055f
commit 2409df768c
13 changed files with 425 additions and 61 deletions
@@ -132,6 +132,24 @@ describe("provider public artifacts", () => {
});
});
it("loads Kimi Code K3 thinking policy before runtime registration", () => {
const surface = resolveBundledProviderPolicySurface("kimi");
expect(
surface?.resolveThinkingProfile?.({
provider: "kimi",
modelId: "k3",
}),
).toEqual({
levels: [
{ id: "off", label: "off" },
{ id: "max", label: "max" },
],
defaultLevel: "max",
preserveWhenCatalogReasoningFalse: true,
});
});
it("loads trusted official external provider policy before runtime registration", () => {
const bundledPluginsDir = fs.mkdtempSync(
path.join(os.tmpdir(), "openclaw-empty-bundled-plugins-"),
+15 -6
View File
@@ -1,3 +1,4 @@
import path from "node:path";
// Extracts provider public artifacts from plugin metadata.
import { normalizeProviderId } from "@openclaw/model-catalog-core/provider-id";
import { resolveBundledPluginsDir } from "./bundled-dir.js";
@@ -8,10 +9,10 @@ import {
type BundledProviderPolicySurface,
} from "./provider-policy-surface.js";
function resolveBundledProviderPolicyPluginId(
function resolveBundledProviderPolicyPlugin(
providerId: string,
options: { manifestRegistry?: Pick<PluginManifestRegistry, "plugins"> } = {},
): string | null {
): PluginManifestRegistry["plugins"][number] | null {
const normalizedProviderId = normalizeProviderId(providerId);
if (!normalizedProviderId) {
return null;
@@ -29,7 +30,7 @@ function resolveBundledProviderPolicyPluginId(
continue;
}
if (pluginOwnsProviderPolicyRef(plugin, normalizedProviderId)) {
return plugin.id;
return plugin;
}
}
@@ -73,11 +74,19 @@ export function resolveBundledProviderPolicySurface(
if (directSurface) {
return directSurface;
}
const ownerPluginId = resolveBundledProviderPolicyPluginId(normalizedProviderId, options);
if (!ownerPluginId || ownerPluginId === normalizedProviderId) {
const ownerPlugin = resolveBundledProviderPolicyPlugin(normalizedProviderId, options);
if (ownerPlugin) {
const ownerSurface = resolveDirectBundledProviderPolicySurface(ownerPlugin.id);
if (ownerSurface) {
return ownerSurface;
}
}
if (!ownerPlugin) {
return null;
}
return resolveDirectBundledProviderPolicySurface(ownerPluginId);
// A stable plugin id can differ from its stock directory name. Use the
// registry-owned root basename so its pre-runtime policy stays discoverable.
return resolveDirectBundledProviderPolicySurface(path.basename(ownerPlugin.rootDir));
}
/** Resolves provider policy hooks from bundled or trusted official plugin artifacts. */