fix: break plugin command spec import cycle · openclaw/openclaw@2f5e5e9
steipete
·
2026-04-26
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -2454,7 +2454,8 @@ describe("spawnAcpDirect", () => {
|
2454 | 2454 | conversation: expect.objectContaining({ |
2455 | 2455 | channel: "telegram", |
2456 | 2456 | accountId: "default", |
2457 | | -conversationId: "-1003342490704:topic:2", |
| 2457 | +conversationId: "2", |
| 2458 | +parentConversationId: "-1003342490704", |
2458 | 2459 | }), |
2459 | 2460 | }), |
2460 | 2461 | ); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -79,7 +79,7 @@ vi.mock("../../auto-reply/commands-registry.js", () => ({
|
79 | 79 | vi.mock("../../auto-reply/skill-commands.js", () => ({ |
80 | 80 | listSkillCommandsForAgents: vi.fn(() => mockSkillCommands), |
81 | 81 | })); |
82 | | -vi.mock("../../plugins/command-registry-state.js", () => ({ |
| 82 | +vi.mock("../../plugins/command-specs.js", () => ({ |
83 | 83 | getPluginCommandSpecs: vi.fn((provider?: string) => { |
84 | 84 | if (provider === "whatsapp") { |
85 | 85 | return []; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -9,7 +9,7 @@ import { listSkillCommandsForAgents } from "../../auto-reply/skill-commands.js";
|
9 | 9 | import { getChannelPlugin } from "../../channels/plugins/index.js"; |
10 | 10 | import { loadConfig } from "../../config/config.js"; |
11 | 11 | import type { OpenClawConfig } from "../../config/types.openclaw.js"; |
12 | | -import { getPluginCommandSpecs } from "../../plugins/command-registry-state.js"; |
| 12 | +import { getPluginCommandSpecs } from "../../plugins/command-specs.js"; |
13 | 13 | import { listPluginCommands } from "../../plugins/commands.js"; |
14 | 14 | import { normalizeOptionalLowercaseString } from "../../shared/string-coerce.js"; |
15 | 15 | import type { CommandEntry, CommandsListResult } from "../protocol/index.js"; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -77,10 +77,8 @@ export {
|
77 | 77 | listSkillCommandsForWorkspace, |
78 | 78 | resolveSkillCommandInvocation, |
79 | 79 | } from "../auto-reply/skill-commands.js"; |
80 | | -export { |
81 | | -getPluginCommandSpecs, |
82 | | -listProviderPluginCommandSpecs, |
83 | | -} from "../plugins/command-registration.js"; |
| 80 | +export { getPluginCommandSpecs } from "../plugins/command-specs.js"; |
| 81 | +export { listProviderPluginCommandSpecs } from "../plugins/command-registry-state.js"; |
84 | 82 | export type { SkillCommandSpec } from "../agents/skills.js"; |
85 | 83 | export { |
86 | 84 | buildModelsProviderData, |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -6,7 +6,6 @@ import {
|
6 | 6 | import { |
7 | 7 | clearPluginCommands, |
8 | 8 | clearPluginCommandsForPlugin, |
9 | | -getPluginCommandSpecs, |
10 | 9 | isPluginCommandRegistryLocked, |
11 | 10 | listProviderPluginCommandSpecs, |
12 | 11 | pluginCommands, |
@@ -197,10 +196,5 @@ export function registerPluginCommand(
|
197 | 196 | return { ok: true }; |
198 | 197 | } |
199 | 198 | |
200 | | -export { |
201 | | -clearPluginCommands, |
202 | | -clearPluginCommandsForPlugin, |
203 | | -getPluginCommandSpecs, |
204 | | -listProviderPluginCommandSpecs, |
205 | | -}; |
| 199 | +export { clearPluginCommands, clearPluginCommandsForPlugin, listProviderPluginCommandSpecs }; |
206 | 200 | export type { RegisteredPluginCommand }; |
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | | -import { getLoadedChannelPlugin } from "../channels/plugins/index.js"; |
2 | | -import { resolveReadOnlyChannelCommandDefaults } from "../channels/plugins/read-only-command-defaults.js"; |
3 | 1 | import { resolveGlobalSingleton } from "../shared/global-singleton.js"; |
4 | 2 | import { normalizeOptionalLowercaseString } from "../shared/string-coerce.js"; |
5 | 3 | import type { OpenClawPluginCommandDefinition } from "./types.js"; |
@@ -83,24 +81,6 @@ function resolvePluginNativeName(
|
83 | 81 | return command.name; |
84 | 82 | } |
85 | 83 | |
86 | | -export function getPluginCommandSpecs(provider?: string): Array<{ |
87 | | -name: string; |
88 | | -description: string; |
89 | | -acceptsArgs: boolean; |
90 | | -}> { |
91 | | -const providerName = normalizeOptionalLowercaseString(provider); |
92 | | -if ( |
93 | | -providerName && |
94 | | -( |
95 | | -getLoadedChannelPlugin(providerName)?.commands ?? |
96 | | -resolveReadOnlyChannelCommandDefaults(providerName) |
97 | | -)?.nativeCommandsAutoEnabled !== true |
98 | | -) { |
99 | | -return []; |
100 | | -} |
101 | | -return listProviderPluginCommandSpecs(provider); |
102 | | -} |
103 | | - |
104 | 84 | /** Resolve plugin command specs for a provider's native naming surface without support gating. */ |
105 | 85 | export function listProviderPluginCommandSpecs(provider?: string): Array<{ |
106 | 86 | name: string; |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +import { getLoadedChannelPlugin } from "../channels/plugins/index.js"; |
| 2 | +import { resolveReadOnlyChannelCommandDefaults } from "../channels/plugins/read-only.js"; |
| 3 | +import { normalizeOptionalLowercaseString } from "../shared/string-coerce.js"; |
| 4 | +import { listProviderPluginCommandSpecs } from "./command-registry-state.js"; |
| 5 | + |
| 6 | +export function getPluginCommandSpecs(provider?: string): Array<{ |
| 7 | +name: string; |
| 8 | +description: string; |
| 9 | +acceptsArgs: boolean; |
| 10 | +}> { |
| 11 | +const providerName = normalizeOptionalLowercaseString(provider); |
| 12 | +if ( |
| 13 | +providerName && |
| 14 | +( |
| 15 | +getLoadedChannelPlugin(providerName)?.commands ?? |
| 16 | +resolveReadOnlyChannelCommandDefaults(providerName) |
| 17 | +)?.nativeCommandsAutoEnabled !== true |
| 18 | +) { |
| 19 | +return []; |
| 20 | +} |
| 21 | +return listProviderPluginCommandSpecs(provider); |
| 22 | +} |
| Original file line number | Diff line number | Diff line change |
|---|
@@ -12,7 +12,6 @@ import { normalizeLowercaseStringOrEmpty } from "../shared/string-coerce.js";
|
12 | 12 | import { |
13 | 13 | clearPluginCommands, |
14 | 14 | clearPluginCommandsForPlugin, |
15 | | -getPluginCommandSpecs, |
16 | 15 | listPluginInvocationKeys, |
17 | 16 | listProviderPluginCommandSpecs, |
18 | 17 | registerPluginCommand, |
@@ -24,6 +23,7 @@ import {
|
24 | 23 | setPluginCommandRegistryLocked, |
25 | 24 | type RegisteredPluginCommand, |
26 | 25 | } from "./command-registry-state.js"; |
| 26 | +import { getPluginCommandSpecs } from "./command-specs.js"; |
27 | 27 | import { |
28 | 28 | detachPluginConversationBinding, |
29 | 29 | getCurrentPluginConversationBinding, |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -22,7 +22,8 @@ import {
|
22 | 22 | type DetachedTaskLifecycleRuntime, |
23 | 23 | } from "../tasks/detached-task-runtime-state.js"; |
24 | 24 | import { withEnv } from "../test-utils/env.js"; |
25 | | -import { clearPluginCommands, getPluginCommandSpecs } from "./command-registry-state.js"; |
| 25 | +import { clearPluginCommands } from "./command-registry-state.js"; |
| 26 | +import { getPluginCommandSpecs } from "./command-specs.js"; |
26 | 27 | import { |
27 | 28 | getGlobalHookRunner, |
28 | 29 | getGlobalPluginRegistry, |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。