mirror of
https://github.com/moltbot/moltbot.git
synced 2026-04-26 16:06:16 +00:00
fix(xai): wire plugin-owned codeExecution config
This commit is contained in:
committed by
Peter Steinberger
parent
b7ab0ddb55
commit
216796f1e3
@@ -399,6 +399,29 @@ describe("applyPluginAutoEnable", () => {
|
||||
expect(result.changes).toContain("xai tool configured, enabled automatically.");
|
||||
});
|
||||
|
||||
it("auto-enables xai when the plugin-owned codeExecution config is configured", () => {
|
||||
const result = applyPluginAutoEnable({
|
||||
config: {
|
||||
plugins: {
|
||||
entries: {
|
||||
xai: {
|
||||
config: {
|
||||
codeExecution: {
|
||||
enabled: true,
|
||||
model: "grok-4-1-fast",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
env: {},
|
||||
});
|
||||
|
||||
expect(result.config.plugins?.entries?.xai?.enabled).toBe(true);
|
||||
expect(result.changes).toContain("xai tool configured, enabled automatically.");
|
||||
});
|
||||
|
||||
it("auto-enables minimax when minimax-portal profiles exist", () => {
|
||||
const result = applyPluginAutoEnable({
|
||||
config: {
|
||||
|
||||
@@ -149,11 +149,12 @@ function hasPluginOwnedWebSearchConfig(cfg: OpenClawConfig, pluginId: string): b
|
||||
}
|
||||
|
||||
function hasPluginOwnedToolConfig(cfg: OpenClawConfig, pluginId: string): boolean {
|
||||
// x_search is now plugin-owned by xAI, but the persisted config shape still
|
||||
// lives under tools.web.x_search for backward compatibility. Treat that as
|
||||
// plugin configuration so tool/runtime loading can activate xAI generically.
|
||||
if (pluginId === "xai") {
|
||||
return isRecord(cfg.tools?.web?.x_search as Record<string, unknown> | undefined);
|
||||
const pluginConfig = cfg.plugins?.entries?.xai?.config;
|
||||
return Boolean(
|
||||
isRecord(cfg.tools?.web?.x_search as Record<string, unknown> | undefined) ||
|
||||
(isRecord(pluginConfig) && isRecord(pluginConfig.codeExecution)),
|
||||
);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user