mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 11:07:41 +00:00
refactor(core): dedupe shared config and runtime helpers
This commit is contained in:
15
src/plugin-sdk/tool-send.ts
Normal file
15
src/plugin-sdk/tool-send.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
export function extractToolSend(
|
||||
args: Record<string, unknown>,
|
||||
expectedAction = "sendMessage",
|
||||
): { to: string; accountId?: string } | null {
|
||||
const action = typeof args.action === "string" ? args.action.trim() : "";
|
||||
if (action !== expectedAction) {
|
||||
return null;
|
||||
}
|
||||
const to = typeof args.to === "string" ? args.to : undefined;
|
||||
if (!to) {
|
||||
return null;
|
||||
}
|
||||
const accountId = typeof args.accountId === "string" ? args.accountId.trim() : undefined;
|
||||
return { to, accountId };
|
||||
}
|
||||
Reference in New Issue
Block a user