From aad7b678b027b87ed359a58948f2c7c5bf757c30 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sun, 26 Apr 2026 09:45:03 +0100 Subject: [PATCH] fix: pass config to plugin command specs --- src/plugins/command-specs.ts | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/src/plugins/command-specs.ts b/src/plugins/command-specs.ts index 3b8aaf25b8a..e1742289302 100644 --- a/src/plugins/command-specs.ts +++ b/src/plugins/command-specs.ts @@ -1,20 +1,34 @@ import { getLoadedChannelPlugin } from "../channels/plugins/index.js"; -import { resolveReadOnlyChannelCommandDefaults } from "../channels/plugins/read-only.js"; +import { resolveReadOnlyChannelCommandDefaults } from "../channels/plugins/read-only-command-defaults.js"; +import type { OpenClawConfig } from "../config/types.openclaw.js"; import { normalizeOptionalLowercaseString } from "../shared/string-coerce.js"; import { listProviderPluginCommandSpecs } from "./command-registry-state.js"; -export function getPluginCommandSpecs(provider?: string): Array<{ +export function getPluginCommandSpecs( + provider?: string, + options: { + env?: NodeJS.ProcessEnv; + stateDir?: string; + workspaceDir?: string; + config?: OpenClawConfig; + } = {}, +): Array<{ name: string; description: string; acceptsArgs: boolean; }> { const providerName = normalizeOptionalLowercaseString(provider); + const commandDefaults = + providerName && options.config + ? resolveReadOnlyChannelCommandDefaults(providerName, { + ...options, + config: options.config, + }) + : undefined; if ( providerName && - ( - getLoadedChannelPlugin(providerName)?.commands ?? - resolveReadOnlyChannelCommandDefaults(providerName) - )?.nativeCommandsAutoEnabled !== true + (getLoadedChannelPlugin(providerName)?.commands ?? commandDefaults) + ?.nativeCommandsAutoEnabled !== true ) { return []; }