mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-11 01:14:33 +00:00
refactor: centralize message target resolution
Co-authored-by: Thinh Dinh <tobalsan@users.noreply.github.com>
This commit is contained in:
@@ -13,6 +13,7 @@ import {
|
||||
isDeliverableMessageChannel,
|
||||
normalizeMessageChannel,
|
||||
} from "../../utils/message-channel.js";
|
||||
import { missingTargetError } from "./target-errors.js";
|
||||
|
||||
export type OutboundChannel = DeliverableMessageChannel | "none";
|
||||
|
||||
@@ -145,9 +146,10 @@ export function resolveOutboundTarget(params: {
|
||||
if (trimmed) {
|
||||
return { ok: true, to: trimmed };
|
||||
}
|
||||
const hint = plugin.messaging?.targetHint;
|
||||
return {
|
||||
ok: false,
|
||||
error: new Error(`Delivering to ${plugin.meta.label} requires a destination`),
|
||||
error: missingTargetError(plugin.meta.label ?? params.channel, hint),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user