fix(discord): narrow binding runtime imports

This commit is contained in:
Peter Steinberger
2026-04-06 04:37:13 +01:00
parent 12f3c36ba8
commit 4a690b452a
6 changed files with 23 additions and 6 deletions

View File

@@ -12,7 +12,7 @@ import { hasControlCommand } from "openclaw/plugin-sdk/command-detection";
import { shouldHandleTextCommands } from "openclaw/plugin-sdk/command-surface";
import { loadConfig } from "openclaw/plugin-sdk/config-runtime";
import { isDangerousNameMatchingEnabled } from "openclaw/plugin-sdk/config-runtime";
import type { SessionBindingRecord } from "openclaw/plugin-sdk/conversation-runtime";
import type { SessionBindingRecord } from "openclaw/plugin-sdk/conversation-binding-runtime";
import { enqueueSystemEvent, recordChannelActivity } from "openclaw/plugin-sdk/infra-runtime";
import {
recordPendingHistoryEntryIfEnabled,
@@ -65,7 +65,7 @@ export type {
const DISCORD_BOUND_THREAD_SYSTEM_PREFIXES = ["⚙️", "🤖", "🧰"];
let conversationRuntimePromise:
| Promise<typeof import("openclaw/plugin-sdk/conversation-runtime")>
| Promise<typeof import("openclaw/plugin-sdk/conversation-binding-runtime")>
| undefined;
let pluralkitRuntimePromise: Promise<typeof import("../pluralkit.js")> | undefined;
let discordSendRuntimePromise: Promise<typeof import("../send.js")> | undefined;
@@ -74,7 +74,7 @@ let systemEventsRuntimePromise: Promise<typeof import("./system-events.js")> | u
let discordThreadingRuntimePromise: Promise<typeof import("./threading.js")> | undefined;
async function loadConversationRuntime() {
conversationRuntimePromise ??= import("openclaw/plugin-sdk/conversation-runtime");
conversationRuntimePromise ??= import("openclaw/plugin-sdk/conversation-binding-runtime");
return await conversationRuntimePromise;
}

View File

@@ -1,5 +1,5 @@
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
import * as conversationRuntime from "openclaw/plugin-sdk/conversation-runtime";
import * as conversationRuntime from "openclaw/plugin-sdk/conversation-binding-runtime";
import type { ResolvedAgentRoute } from "openclaw/plugin-sdk/routing";
import {
resolveDiscordBoundConversationRoute,

View File

@@ -231,15 +231,16 @@ function resolveDiscordGuildNativeCommandAuthorized(params: {
configured: hasAccessRestrictions,
allowed: memberAllowed,
};
const fallbackAuthorizers = [policyAuthorizer, ownerAuthorizer, memberAuthorizer];
return resolveCommandAuthorizedFromAuthorizers({
useAccessGroups: params.useAccessGroups,
authorizers: params.useAccessGroups
? params.commandsAllowFromAccess.configured
? [commandAllowlistAuthorizer]
: [policyAuthorizer, ownerAuthorizer, memberAuthorizer]
: fallbackAuthorizers
: params.commandsAllowFromAccess.configured
? [commandAllowlistAuthorizer]
: [memberAuthorizer],
: fallbackAuthorizers,
modeWhenAccessGroupsOff: "configured",
});
}

View File

@@ -211,6 +211,10 @@
"types": "./dist/plugin-sdk/media-generation-runtime.d.ts",
"default": "./dist/plugin-sdk/media-generation-runtime.js"
},
"./plugin-sdk/conversation-binding-runtime": {
"types": "./dist/plugin-sdk/conversation-binding-runtime.d.ts",
"default": "./dist/plugin-sdk/conversation-binding-runtime.js"
},
"./plugin-sdk/conversation-runtime": {
"types": "./dist/plugin-sdk/conversation-runtime.d.ts",
"default": "./dist/plugin-sdk/conversation-runtime.js"

View File

@@ -42,6 +42,7 @@
"ssrf-runtime",
"media-runtime",
"media-generation-runtime",
"conversation-binding-runtime",
"conversation-runtime",
"matrix-runtime-heavy",
"matrix-runtime-shared",

View File

@@ -0,0 +1,11 @@
export {
ensureConfiguredBindingRouteReady,
resolveConfiguredBindingRoute,
type ConfiguredBindingRouteResult,
} from "../channels/plugins/binding-routing.js";
export {
type SessionBindingRecord,
getSessionBindingService,
} from "../infra/outbound/session-binding-service.js";
export { isPluginOwnedSessionBindingRecord } from "../plugins/conversation-binding.js";
export { buildPairingReply } from "../pairing/pairing-messages.js";