mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 09:20:43 +00:00
perf(outbound): narrow loaded target channel reads
This commit is contained in:
@@ -45,4 +45,10 @@ describe("tryResolveLoadedOutboundTarget", () => {
|
||||
}),
|
||||
).toEqual({ ok: true, to: "123456789" });
|
||||
});
|
||||
|
||||
it("trims channel ids before reading the loaded registry", () => {
|
||||
tryResolveLoadedOutboundTarget({ channel: " telegram " as never, to: "123" });
|
||||
|
||||
expect(mocks.getLoadedChannelPlugin).toHaveBeenCalledWith("telegram");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -2,19 +2,16 @@ import { getLoadedChannelPluginForRead } from "../../channels/plugins/registry-l
|
||||
import type { ChannelPlugin } from "../../channels/plugins/types.plugin.js";
|
||||
import type { ChannelOutboundTargetMode } from "../../channels/plugins/types.public.js";
|
||||
import type { OpenClawConfig } from "../../config/types.openclaw.js";
|
||||
import { normalizeOptionalString } from "../../shared/string-coerce.js";
|
||||
import type { GatewayMessageChannel } from "../../utils/message-channel.js";
|
||||
import {
|
||||
isDeliverableMessageChannel,
|
||||
normalizeMessageChannel,
|
||||
} from "../../utils/message-channel.js";
|
||||
import {
|
||||
resolveOutboundTargetWithPlugin,
|
||||
type OutboundTargetResolution,
|
||||
} from "./targets-resolve-shared.js";
|
||||
|
||||
function resolveLoadedOutboundChannelPlugin(channel: string): ChannelPlugin | undefined {
|
||||
const normalized = normalizeMessageChannel(channel);
|
||||
if (!normalized || !isDeliverableMessageChannel(normalized)) {
|
||||
const normalized = normalizeOptionalString(channel);
|
||||
if (!normalized) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user