From 861fcb1575190cc1ddec81adda9b19afbd5cdbbb Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Wed, 18 Mar 2026 04:24:18 +0000 Subject: [PATCH] fix: restore rebased full gate --- extensions/bluebubbles/runtime-api.ts | 4 +++ extensions/bluebubbles/src/group-policy.ts | 2 +- extensions/discord/src/runtime-api.ts | 18 ++++++------- .../mattermost/src/mattermost/monitor.ts | 7 ++++- src/channels/plugins/actions/actions.test.ts | 13 --------- src/commands/config-validation.test.ts | 4 ++- .../runner.vision-skip.test.ts | 27 +++++++++++++------ src/plugin-sdk/bluebubbles.ts | 2 +- src/plugin-sdk/compat.ts | 2 +- src/plugin-sdk/googlechat.ts | 2 +- src/plugin-sdk/provider-web-search.ts | 27 +++++++++---------- 11 files changed, 57 insertions(+), 51 deletions(-) create mode 100644 extensions/bluebubbles/runtime-api.ts diff --git a/extensions/bluebubbles/runtime-api.ts b/extensions/bluebubbles/runtime-api.ts new file mode 100644 index 00000000000..24139381e05 --- /dev/null +++ b/extensions/bluebubbles/runtime-api.ts @@ -0,0 +1,4 @@ +export { + resolveBlueBubblesGroupRequireMention, + resolveBlueBubblesGroupToolPolicy, +} from "./src/group-policy.js"; diff --git a/extensions/bluebubbles/src/group-policy.ts b/extensions/bluebubbles/src/group-policy.ts index d3b42cd45b4..34a95441c4a 100644 --- a/extensions/bluebubbles/src/group-policy.ts +++ b/extensions/bluebubbles/src/group-policy.ts @@ -3,7 +3,7 @@ import { resolveChannelGroupToolsPolicy, type GroupToolPolicyConfig, } from "openclaw/plugin-sdk/channel-policy"; -import type { OpenClawConfig } from "./runtime-api.js"; +import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime"; type BlueBubblesGroupContext = { cfg: OpenClawConfig; diff --git a/extensions/discord/src/runtime-api.ts b/extensions/discord/src/runtime-api.ts index 32fbf43e5e5..637aebb2cb1 100644 --- a/extensions/discord/src/runtime-api.ts +++ b/extensions/discord/src/runtime-api.ts @@ -1,6 +1,8 @@ export { buildComputedAccountStatusSnapshot, buildTokenChannelStatusSummary, + listDiscordDirectoryGroupsFromConfig, + listDiscordDirectoryPeersFromConfig, PAIRING_APPROVED_MESSAGE, projectCredentialSnapshotFields, resolveConfiguredFromCredentialStatuses, @@ -12,6 +14,7 @@ export { readNumberParam, readStringArrayParam, readStringParam, + resolvePollMaxSelections, type ActionGate, type ChannelPlugin, type OpenClawConfig, @@ -19,9 +22,11 @@ export { export { DiscordConfigSchema } from "openclaw/plugin-sdk/discord-core"; export { readBooleanParam } from "openclaw/plugin-sdk/boolean-param"; export { - listDiscordDirectoryGroupsFromConfig, - listDiscordDirectoryPeersFromConfig, -} from "./directory-config.js"; + assertMediaNotDataUrl, + parseAvailableTags, + readReactionParams, + withNormalizedTimestamp, +} from "openclaw/plugin-sdk/discord-core"; export { createHybridChannelConfigAdapter, createScopedChannelConfigAdapter, @@ -41,13 +46,6 @@ export type { ChannelMessageActionName, } from "openclaw/plugin-sdk/channel-runtime"; export type { DiscordConfig } from "openclaw/plugin-sdk/discord"; -export { - assertMediaNotDataUrl, - parseAvailableTags, - readReactionParams, - resolvePollMaxSelections, - withNormalizedTimestamp, -} from "openclaw/plugin-sdk/discord-core"; export type { DiscordAccountConfig, DiscordActionConfig } from "openclaw/plugin-sdk/discord"; export { hasConfiguredSecretInput, diff --git a/extensions/mattermost/src/mattermost/monitor.ts b/extensions/mattermost/src/mattermost/monitor.ts index 4cd74216811..a1109a41a8d 100644 --- a/extensions/mattermost/src/mattermost/monitor.ts +++ b/extensions/mattermost/src/mattermost/monitor.ts @@ -84,7 +84,11 @@ import { import { runWithReconnect } from "./reconnect.js"; import { deliverMattermostReplyPayload } from "./reply-delivery.js"; import { sendMessageMattermost } from "./send.js"; -import { cleanupSlashCommands } from "./slash-commands.js"; +import { + cleanupSlashCommands, + isSlashCommandsEnabled, + resolveSlashCommandConfig, +} from "./slash-commands.js"; import { deactivateSlashCommands, getSlashCommandState } from "./slash-state.js"; export { @@ -269,6 +273,7 @@ export async function monitorMattermostProvider(opts: MonitorMattermostOpts = {} const botUserId = botUser.id; const botUsername = botUser.username?.trim() || undefined; runtime.log?.(`mattermost connected as ${botUsername ? `@${botUsername}` : botUserId}`); + const slashEnabled = isSlashCommandsEnabled(resolveSlashCommandConfig(account.config.commands)); await registerMattermostMonitorSlashCommands({ client, diff --git a/src/channels/plugins/actions/actions.test.ts b/src/channels/plugins/actions/actions.test.ts index aa5768dab5d..0752c1e7a4e 100644 --- a/src/channels/plugins/actions/actions.test.ts +++ b/src/channels/plugins/actions/actions.test.ts @@ -201,22 +201,9 @@ async function expectSlackSendRejected(params: Record, error: R beforeEach(async () => { vi.resetModules(); -<<<<<<< HEAD - ({ discordMessageActions } = - await import("../../../../extensions/discord/src/channel-actions.js")); - ({ handleDiscordMessageAction } = - await import("../../../../extensions/discord/src/actions/handle-action.js")); - ({ telegramMessageActions } = - await import("../../../../extensions/telegram/src/channel-actions.js")); -||||||| parent of 69827439b1 (fix: stabilize rebased full gate) - ({ discordMessageActions } = await import("./discord.js")); - ({ handleDiscordMessageAction } = await import("./discord/handle-action.js")); - ({ telegramMessageActions } = await import("./telegram.js")); -======= ({ discordMessageActions } = await import("../../../../extensions/discord/runtime-api.js")); ({ handleDiscordMessageAction } = await import("./discord/handle-action.js")); ({ telegramMessageActions } = await import("../../../../extensions/telegram/runtime-api.js")); ->>>>>>> 69827439b1 (fix: stabilize rebased full gate) ({ signalMessageActions } = await import("../../../../extensions/signal/src/message-actions.js")); ({ createSlackActions } = await import("../../../../extensions/slack/src/channel-actions.js")); vi.clearAllMocks(); diff --git a/src/commands/config-validation.test.ts b/src/commands/config-validation.test.ts index 2c4852ba8b6..c77b63e0c64 100644 --- a/src/commands/config-validation.test.ts +++ b/src/commands/config-validation.test.ts @@ -2,7 +2,9 @@ import { beforeEach, describe, expect, it, vi } from "vitest"; import type { PluginCompatibilityNotice } from "../plugins/status.js"; const readConfigFileSnapshot = vi.fn(); -const buildPluginCompatibilityNotices = vi.fn((): PluginCompatibilityNotice[] => []); +const buildPluginCompatibilityNotices = vi.fn<(_params?: unknown) => PluginCompatibilityNotice[]>( + () => [], +); vi.mock("../config/config.js", () => ({ readConfigFileSnapshot, diff --git a/src/media-understanding/runner.vision-skip.test.ts b/src/media-understanding/runner.vision-skip.test.ts index 8a289b845e4..97f1a0cd77c 100644 --- a/src/media-understanding/runner.vision-skip.test.ts +++ b/src/media-understanding/runner.vision-skip.test.ts @@ -1,12 +1,6 @@ -import { describe, expect, it, vi } from "vitest"; +import { beforeEach, describe, expect, it, vi } from "vitest"; import type { MsgContext } from "../auto-reply/templating.js"; import type { OpenClawConfig } from "../config/config.js"; -import { - buildProviderRegistry, - createMediaAttachmentCache, - normalizeMediaAttachments, - runCapability, -} from "./runner.js"; const catalog = [ { @@ -17,17 +11,34 @@ const catalog = [ }, ]; +const loadModelCatalog = vi.hoisted(() => vi.fn(async () => catalog)); + vi.mock("../agents/model-catalog.js", async () => { const actual = await vi.importActual( "../agents/model-catalog.js", ); return { ...actual, - loadModelCatalog: vi.fn(async () => catalog), + loadModelCatalog, }; }); +let buildProviderRegistry: typeof import("./runner.js").buildProviderRegistry; +let createMediaAttachmentCache: typeof import("./runner.js").createMediaAttachmentCache; +let normalizeMediaAttachments: typeof import("./runner.js").normalizeMediaAttachments; +let runCapability: typeof import("./runner.js").runCapability; + describe("runCapability image skip", () => { + beforeEach(async () => { + vi.resetModules(); + ({ + buildProviderRegistry, + createMediaAttachmentCache, + normalizeMediaAttachments, + runCapability, + } = await import("./runner.js")); + }); + it("skips image understanding when the active model supports vision", async () => { const ctx: MsgContext = { MediaPath: "/tmp/image.png", MediaType: "image/png" }; const media = normalizeMediaAttachments(ctx); diff --git a/src/plugin-sdk/bluebubbles.ts b/src/plugin-sdk/bluebubbles.ts index 346ac01c829..58438157dda 100644 --- a/src/plugin-sdk/bluebubbles.ts +++ b/src/plugin-sdk/bluebubbles.ts @@ -28,7 +28,7 @@ export { buildChannelConfigSchema } from "../channels/plugins/config-schema.js"; export { resolveBlueBubblesGroupRequireMention, resolveBlueBubblesGroupToolPolicy, -} from "../../extensions/bluebubbles/src/group-policy.js"; +} from "../../extensions/bluebubbles/runtime-api.js"; export { formatPairingApproveHint } from "../channels/plugins/helpers.js"; export { resolveChannelMediaMaxBytes } from "../channels/plugins/media-limits.js"; export { diff --git a/src/plugin-sdk/compat.ts b/src/plugin-sdk/compat.ts index 83a2a21e75e..5e2bcd11f58 100644 --- a/src/plugin-sdk/compat.ts +++ b/src/plugin-sdk/compat.ts @@ -46,5 +46,5 @@ export { mapAllowlistResolutionInputs } from "./allowlist-resolution.js"; export { resolveBlueBubblesGroupRequireMention, resolveBlueBubblesGroupToolPolicy, -} from "../../extensions/bluebubbles/src/group-policy.js"; +} from "../../extensions/bluebubbles/runtime-api.js"; export { collectBlueBubblesStatusIssues } from "../channels/plugins/status-issues/bluebubbles.js"; diff --git a/src/plugin-sdk/googlechat.ts b/src/plugin-sdk/googlechat.ts index ade38097fad..fb7b0033603 100644 --- a/src/plugin-sdk/googlechat.ts +++ b/src/plugin-sdk/googlechat.ts @@ -20,7 +20,7 @@ export { export { buildComputedAccountStatusSnapshot } from "./status-helpers.js"; export { buildChannelConfigSchema } from "../channels/plugins/config-schema.js"; export { createAccountStatusSink, runPassiveAccountLifecycle } from "./channel-lifecycle.js"; -export { resolveGoogleChatGroupRequireMention } from "../../extensions/googlechat/src/group-policy.js"; +export { resolveGoogleChatGroupRequireMention } from "../../extensions/googlechat/runtime-api.js"; export { formatPairingApproveHint } from "../channels/plugins/helpers.js"; export { resolveChannelMediaMaxBytes } from "../channels/plugins/media-limits.js"; export { diff --git a/src/plugin-sdk/provider-web-search.ts b/src/plugin-sdk/provider-web-search.ts index c130aebb9b2..36de7dbc775 100644 --- a/src/plugin-sdk/provider-web-search.ts +++ b/src/plugin-sdk/provider-web-search.ts @@ -1,6 +1,5 @@ // Public web-search registration helpers for provider plugins. -import type { OpenClawConfig } from "../config/config.js"; import type { WebSearchCredentialResolutionSource, WebSearchProviderPlugin, @@ -8,22 +7,12 @@ import type { } from "../plugins/types.js"; export { readNumberParam, readStringArrayParam, readStringParam } from "../agents/tools/common.js"; export { resolveCitationRedirectUrl } from "../agents/tools/web-search-citation-redirect.js"; -export { - getScopedCredentialValue, - getTopLevelCredentialValue, - resolveProviderWebSearchPluginConfig, - setScopedCredentialValue, - setProviderWebSearchPluginConfigValue, - setTopLevelCredentialValue, -} from "../agents/tools/web-search-provider-config.js"; -export type { SearchConfigRecord } from "../agents/tools/web-search-provider-common.js"; -export { resolveWebSearchProviderCredential } from "../agents/tools/web-search-provider-credentials.js"; -export { withTrustedWebToolsEndpoint } from "../agents/tools/web-guarded-fetch.js"; export { buildSearchCacheKey, DEFAULT_SEARCH_COUNT, - MAX_SEARCH_COUNT, + FRESHNESS_TO_RECENCY, isoToPerplexityDate, + MAX_SEARCH_COUNT, normalizeFreshness, normalizeToIsoDate, readCachedSearchPayload, @@ -37,6 +26,17 @@ export { withTrustedWebSearchEndpoint, writeCachedSearchPayload, } from "../agents/tools/web-search-provider-common.js"; +export { + getScopedCredentialValue, + getTopLevelCredentialValue, + resolveProviderWebSearchPluginConfig, + setScopedCredentialValue, + setProviderWebSearchPluginConfigValue, + setTopLevelCredentialValue, +} from "../agents/tools/web-search-provider-config.js"; +export type { SearchConfigRecord } from "../agents/tools/web-search-provider-common.js"; +export { resolveWebSearchProviderCredential } from "../agents/tools/web-search-provider-credentials.js"; +export { withTrustedWebToolsEndpoint } from "../agents/tools/web-guarded-fetch.js"; export { DEFAULT_CACHE_TTL_MINUTES, DEFAULT_TIMEOUT_SECONDS, @@ -51,7 +51,6 @@ export { enablePluginInConfig } from "../plugins/enable.js"; export { formatCliCommand } from "../cli/command-format.js"; export { wrapWebContent } from "../security/external-content.js"; export type { - OpenClawConfig, WebSearchCredentialResolutionSource, WebSearchProviderPlugin, WebSearchProviderToolDefinition,