


























@@ -11,7 +11,7 @@ import {
1111createComputedAccountStatusAdapter,
1212createDefaultChannelRuntimeState,
1313} from "openclaw/plugin-sdk/status-helpers";
14-import { googlechatMessageActions } from "./actions.js";
14+import { extractToolSend } from "openclaw/plugin-sdk/tool-send";
1515import { googleChatApprovalAuth } from "./approval-auth.js";
1616import {
1717formatAllowFromEntry,
@@ -35,7 +35,9 @@ import {
3535resolveGoogleChatConfigAccessorAccount,
3636resolveDefaultGoogleChatAccountId,
3737resolveGoogleChatAccount,
38+listGoogleChatAccountIds,
3839type ChannelMessageActionAdapter,
40+type ChannelMessageActionName,
3941type ChannelStatusIssue,
4042type ResolvedGoogleChatAccount,
4143} from "./channel.deps.runtime.js";
@@ -97,9 +99,27 @@ const googleChatConfigAdapter = createScopedChannelConfigAdapter<
9799});
9810099101const googlechatActions: ChannelMessageActionAdapter = {
100-describeMessageTool: (ctx) => googlechatMessageActions.describeMessageTool?.(ctx) ?? null,
101-extractToolSend: (ctx) => googlechatMessageActions.extractToolSend?.(ctx) ?? null,
102+describeMessageTool: ({ cfg, accountId }) => {
103+const accounts = accountId
104+ ? [resolveGoogleChatAccount({ cfg, accountId })].filter(
105+(account) => account.enabled && account.credentialSource !== "none",
106+)
107+ : listGoogleChatAccountIds(cfg)
108+.map((id) => resolveGoogleChatAccount({ cfg, accountId: id }))
109+.filter((account) => account.enabled && account.credentialSource !== "none");
110+if (accounts.length === 0) {
111+return null;
112+}
113+const actions = new Set<ChannelMessageActionName>(["send", "upload-file"]);
114+if (accounts.some((account) => account.config.actions?.reactions !== false)) {
115+actions.add("react");
116+actions.add("reactions");
117+}
118+return { actions: Array.from(actions) };
119+},
120+extractToolSend: ({ args }) => extractToolSend(args, "sendMessage"),
102121handleAction: async (ctx) => {
122+const { googlechatMessageActions } = await import("./actions.js");
103123if (!googlechatMessageActions.handleAction) {
104124throw new Error("Google Chat actions are not available.");
105125}
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。