fix: pass config to plugin command specs · openclaw/openclaw@aad7b67
steipete
·
2026-04-26
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | import { getLoadedChannelPlugin } from "../channels/plugins/index.js"; |
2 | | -import { resolveReadOnlyChannelCommandDefaults } from "../channels/plugins/read-only.js"; |
| 2 | +import { resolveReadOnlyChannelCommandDefaults } from "../channels/plugins/read-only-command-defaults.js"; |
| 3 | +import type { OpenClawConfig } from "../config/types.openclaw.js"; |
3 | 4 | import { normalizeOptionalLowercaseString } from "../shared/string-coerce.js"; |
4 | 5 | import { listProviderPluginCommandSpecs } from "./command-registry-state.js"; |
5 | 6 | |
6 | | -export function getPluginCommandSpecs(provider?: string): Array<{ |
| 7 | +export function getPluginCommandSpecs( |
| 8 | +provider?: string, |
| 9 | +options: { |
| 10 | +env?: NodeJS.ProcessEnv; |
| 11 | +stateDir?: string; |
| 12 | +workspaceDir?: string; |
| 13 | +config?: OpenClawConfig; |
| 14 | +} = {}, |
| 15 | +): Array<{ |
7 | 16 | name: string; |
8 | 17 | description: string; |
9 | 18 | acceptsArgs: boolean; |
10 | 19 | }> { |
11 | 20 | const providerName = normalizeOptionalLowercaseString(provider); |
| 21 | +const commandDefaults = |
| 22 | +providerName && options.config |
| 23 | + ? resolveReadOnlyChannelCommandDefaults(providerName, { |
| 24 | + ...options, |
| 25 | +config: options.config, |
| 26 | +}) |
| 27 | + : undefined; |
12 | 28 | if ( |
13 | 29 | providerName && |
14 | | -( |
15 | | -getLoadedChannelPlugin(providerName)?.commands ?? |
16 | | -resolveReadOnlyChannelCommandDefaults(providerName) |
17 | | -)?.nativeCommandsAutoEnabled !== true |
| 30 | +(getLoadedChannelPlugin(providerName)?.commands ?? commandDefaults) |
| 31 | +?.nativeCommandsAutoEnabled !== true |
18 | 32 | ) { |
19 | 33 | return []; |
20 | 34 | } |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。