@openclaw/googlechat 2026.7.1 → 2026.7.2-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,76 @@
1
+ import { l as resolveGoogleChatAccount, o as listEnabledGoogleChatAccounts } from "./channel-base-fY2AAQj5.js";
2
+ import { m as resolveGoogleChatOutboundSpace, v as sendGoogleChatMessage } from "./channel.adapters-Dhy4lV4f.js";
3
+ import { extractToolSend } from "openclaw/plugin-sdk/tool-send";
4
+ import { jsonResult, readStringArrayParam, readStringParam } from "openclaw/plugin-sdk/channel-actions";
5
+ //#region extensions/googlechat/src/actions.ts
6
+ const providerId = "googlechat";
7
+ function listEnabledAccounts(cfg) {
8
+ return listEnabledGoogleChatAccounts(cfg).filter((account) => account.enabled && account.credentialSource !== "none");
9
+ }
10
+ const OUTBOUND_MEDIA_KEYS = [
11
+ "media",
12
+ "mediaUrl",
13
+ "path",
14
+ "filePath",
15
+ "fileUrl"
16
+ ];
17
+ const STRUCTURED_ATTACHMENT_MEDIA_KEYS = [...OUTBOUND_MEDIA_KEYS, "url"];
18
+ function hasGoogleChatOutboundAttachment(params) {
19
+ if (OUTBOUND_MEDIA_KEYS.some((key) => readStringParam(params, key) !== void 0)) return true;
20
+ if (readStringArrayParam(params, "mediaUrls") !== void 0) return true;
21
+ if (!Array.isArray(params.attachments)) return false;
22
+ return params.attachments.some((attachment) => {
23
+ if (!attachment || typeof attachment !== "object" || Array.isArray(attachment)) return false;
24
+ const record = attachment;
25
+ return STRUCTURED_ATTACHMENT_MEDIA_KEYS.some((key) => readStringParam(record, key) !== void 0);
26
+ });
27
+ }
28
+ const googlechatMessageActions = {
29
+ describeMessageTool: ({ cfg, accountId }) => {
30
+ if ((accountId ? [resolveGoogleChatAccount({
31
+ cfg,
32
+ accountId
33
+ })].filter((account) => account.enabled && account.credentialSource !== "none") : listEnabledAccounts(cfg)).length === 0) return null;
34
+ return { actions: ["send"] };
35
+ },
36
+ supportsAction: ({ action }) => action === "send",
37
+ extractToolSend: ({ args }) => {
38
+ return extractToolSend(args, "sendMessage");
39
+ },
40
+ handleAction: async ({ action, params, cfg, accountId }) => {
41
+ if (action === "upload-file") throw new Error("Google Chat outbound attachments require user OAuth and are not supported by this service-account channel.");
42
+ if (action === "send") {
43
+ if (hasGoogleChatOutboundAttachment(params)) throw new Error("Google Chat outbound attachments require user OAuth and are not supported by this service-account channel.");
44
+ }
45
+ const account = resolveGoogleChatAccount({
46
+ cfg,
47
+ accountId
48
+ });
49
+ if (account.credentialSource === "none") throw new Error("Google Chat credentials are missing.");
50
+ if (action === "send") {
51
+ const to = readStringParam(params, "to", { required: true });
52
+ const content = readStringParam(params, "message", {
53
+ required: true,
54
+ allowEmpty: true
55
+ });
56
+ const threadId = readStringParam(params, "threadId") ?? readStringParam(params, "replyTo");
57
+ const space = await resolveGoogleChatOutboundSpace({
58
+ account,
59
+ target: to
60
+ });
61
+ return jsonResult({
62
+ ok: true,
63
+ to: space,
64
+ ...await sendGoogleChatMessage({
65
+ account,
66
+ space,
67
+ text: content,
68
+ thread: threadId ?? void 0
69
+ })
70
+ });
71
+ }
72
+ throw new Error(`Action ${action} is not supported for provider ${providerId}.`);
73
+ }
74
+ };
75
+ //#endregion
76
+ export { googlechatMessageActions };
package/dist/api.js CHANGED
@@ -1,3 +1,3 @@
1
- import { a as googlechatSetupAdapter, i as googlechatSetupWizard } from "./channel-base-DJICAvKH.js";
2
- import { t as googlechatPlugin } from "./channel-_o671C-U.js";
1
+ import { a as googlechatSetupAdapter, i as googlechatSetupWizard } from "./channel-base-fY2AAQj5.js";
2
+ import { t as googlechatPlugin } from "./channel-CST-JKw9.js";
3
3
  export { googlechatPlugin, googlechatSetupAdapter, googlechatSetupWizard };
@@ -0,0 +1,30 @@
1
+ import { l as resolveGoogleChatAccount } from "./channel-base-fY2AAQj5.js";
2
+ import { d as isGoogleChatUserTarget, f as normalizeGoogleChatTarget } from "./channel.adapters-Dhy4lV4f.js";
3
+ import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
4
+ import { createChannelApprovalAuth } from "openclaw/plugin-sdk/approval-auth-runtime";
5
+ //#region extensions/googlechat/src/approval-auth.ts
6
+ function normalizeGoogleChatApproverId(value) {
7
+ const normalized = normalizeGoogleChatTarget(String(value));
8
+ if (!normalized || !isGoogleChatUserTarget(normalized)) return;
9
+ const suffix = normalizeLowercaseStringOrEmpty(normalized.slice(6));
10
+ if (!suffix || suffix.includes("@")) return;
11
+ return `users/${suffix}`;
12
+ }
13
+ const googleChatApproval = createChannelApprovalAuth({
14
+ channelLabel: "Google Chat",
15
+ resolveInputs: ({ cfg, accountId }) => {
16
+ const account = resolveGoogleChatAccount({
17
+ cfg,
18
+ accountId
19
+ }).config;
20
+ return {
21
+ allowFrom: account.dm?.allowFrom,
22
+ defaultTo: account.defaultTo
23
+ };
24
+ },
25
+ normalizeApprover: normalizeGoogleChatApproverId
26
+ });
27
+ const getGoogleChatApprovalApprovers = googleChatApproval.resolveApprovers;
28
+ const googleChatApprovalAuth = googleChatApproval.approvalAuth;
29
+ //#endregion
30
+ export { googleChatApprovalAuth as n, normalizeGoogleChatApproverId as r, getGoogleChatApprovalApprovers as t };
@@ -1,6 +1,6 @@
1
- import { l as resolveGoogleChatAccount } from "./channel-base-DJICAvKH.js";
2
- import { F as unregisterGoogleChatManualApprovalFollowupSuppression, M as registerGoogleChatManualApprovalFollowupSuppression, O as createGoogleChatApprovalToken, P as unregisterGoogleChatApprovalCardBindings, T as buildGoogleChatApprovalActionParameters, b as sendGoogleChatMessage, j as registerGoogleChatApprovalCardBinding, p as resolveGoogleChatOutboundSpace, w as GOOGLECHAT_APPROVAL_ACTION, x as updateGoogleChatMessage } from "./channel.adapters-FEj7zUjh.js";
3
- import { n as isGoogleChatNativeApprovalClientEnabled, r as shouldHandleGoogleChatNativeApprovalRequest } from "./channel-_o671C-U.js";
1
+ import { l as resolveGoogleChatAccount } from "./channel-base-fY2AAQj5.js";
2
+ import { M as unregisterGoogleChatManualApprovalFollowupSuppression, O as registerGoogleChatApprovalCardBinding, S as buildGoogleChatApprovalActionParameters, T as createGoogleChatApprovalToken, j as unregisterGoogleChatApprovalCardBindings, k as registerGoogleChatManualApprovalFollowupSuppression, m as resolveGoogleChatOutboundSpace, v as sendGoogleChatMessage, x as GOOGLECHAT_APPROVAL_ACTION, y as updateGoogleChatMessage } from "./channel.adapters-Dhy4lV4f.js";
3
+ import { n as isGoogleChatNativeApprovalClientEnabled, r as shouldHandleGoogleChatNativeApprovalRequest } from "./channel-CST-JKw9.js";
4
4
  import { buildChannelApprovalNativeTargetKey } from "openclaw/plugin-sdk/approval-native-runtime";
5
5
  import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
6
6
  import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
@@ -155,9 +155,10 @@ const googleChatApprovalNativeRuntime = createChannelApprovalNativeRuntimeAdapte
155
155
  cfg,
156
156
  accountId
157
157
  }),
158
- shouldHandle: ({ cfg, accountId, request }) => shouldHandleGoogleChatNativeApprovalRequest({
158
+ shouldHandle: ({ cfg, accountId, approvalKind, request }) => shouldHandleGoogleChatNativeApprovalRequest({
159
159
  cfg,
160
160
  accountId,
161
+ approvalKind,
161
162
  request
162
163
  })
163
164
  },
@@ -1,9 +1,10 @@
1
- import { c as resolveDefaultGoogleChatAccountId, l as resolveGoogleChatAccount, n as createGoogleChatPluginBase, s as listGoogleChatAccountIds, t as GOOGLECHAT_CHANNEL_ID } from "./channel-base-DJICAvKH.js";
2
- import { a as googlechatPairingTextAdapter, d as normalizeGoogleChatTarget, f as resolveGoogleChatOutboundSessionRoute, i as googlechatOutboundAdapter, l as isGoogleChatSpaceTarget, n as googlechatGroupsAdapter, o as googlechatSecurityAdapter, r as googlechatMessageAdapter, s as googlechatThreadingAdapter, t as googlechatDirectoryAdapter, u as isGoogleChatUserTarget } from "./channel.adapters-FEj7zUjh.js";
3
- import { a as buildChannelConfigSchema, r as GoogleChatConfigSchema, t as DEFAULT_ACCOUNT_ID } from "./runtime-api-BbVoWRxq.js";
4
- import { n as googleChatApprovalAuth, r as normalizeGoogleChatApproverId, t as getGoogleChatApprovalApprovers } from "./approval-auth-C_BVZZFA.js";
5
- import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-BcEqUZ4j.js";
6
- import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./secret-contract-lCMHqumt.js";
1
+ import { c as resolveDefaultGoogleChatAccountId, l as resolveGoogleChatAccount, n as createGoogleChatPluginBase, s as listGoogleChatAccountIds, t as GOOGLECHAT_CHANNEL_ID } from "./channel-base-fY2AAQj5.js";
2
+ import { a as googlechatPairingTextAdapter, d as isGoogleChatUserTarget, f as normalizeGoogleChatTarget, i as googlechatOutboundAdapter, n as googlechatGroupsAdapter, o as googlechatSecurityAdapter, p as resolveGoogleChatOutboundSessionRoute, r as googlechatMessageAdapter, s as googlechatThreadingAdapter, t as googlechatDirectoryAdapter, u as isGoogleChatSpaceTarget } from "./channel.adapters-Dhy4lV4f.js";
3
+ import { n as buildChannelConfigSchema, t as GoogleChatConfigSchema } from "./config-api-CsD0IFxF.js";
4
+ import { t as DEFAULT_ACCOUNT_ID } from "./runtime-api-1v-DgldF.js";
5
+ import { n as googleChatApprovalAuth, r as normalizeGoogleChatApproverId, t as getGoogleChatApprovalApprovers } from "./approval-auth-B2m8ckdj.js";
6
+ import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-CvhD0eoX.js";
7
+ import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./secret-contract-D__4IIu_.js";
7
8
  import { createChatChannelPlugin } from "openclaw/plugin-sdk/channel-core";
8
9
  import { buildPassiveProbedChannelStatusSummary } from "openclaw/plugin-sdk/extension-shared";
9
10
  import { createLazyRuntimeNamedExport } from "openclaw/plugin-sdk/lazy-runtime";
@@ -14,7 +15,7 @@ import { CHANNEL_APPROVAL_NATIVE_RUNTIME_CONTEXT_CAPABILITY, createLazyChannelAp
14
15
  import { createChannelApproverDmTargetResolver, createChannelNativeOriginTargetResolver, createNativeApprovalChannelRouteGates, shouldSuppressLocalNativeExecApprovalPrompt } from "openclaw/plugin-sdk/approval-native-runtime";
15
16
  import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
16
17
  import { createAccountStatusSink, runPassiveAccountLifecycle } from "openclaw/plugin-sdk/channel-outbound";
17
- import { createDangerousNameMatchingMutableAllowlistWarningCollector } from "openclaw/plugin-sdk/channel-policy";
18
+ import { buildMutableAllowEntryDetector, collectStandardAllowlistLists, createDangerousNameMatchingMutableAllowlistWarningCollector } from "openclaw/plugin-sdk/channel-policy";
18
19
  import { registerChannelRuntimeContext } from "openclaw/plugin-sdk/channel-runtime-context";
19
20
  //#region extensions/googlechat/src/approval-native.ts
20
21
  const DEFAULT_APPROVAL_FORWARDING_MODE = "session";
@@ -134,54 +135,36 @@ const googleChatApprovalCapability = createApproverRestrictedNativeApprovalCapab
134
135
  cfg,
135
136
  accountId
136
137
  }),
137
- shouldHandle: ({ cfg, accountId, request }) => shouldHandleGoogleChatNativeApprovalRequest({
138
+ shouldHandle: ({ cfg, accountId, approvalKind, request }) => shouldHandleGoogleChatNativeApprovalRequest({
138
139
  cfg,
139
140
  accountId,
141
+ approvalKind,
140
142
  request
141
143
  }),
142
- load: async () => (await import("./approval-handler.runtime-BnkufknT.js")).googleChatApprovalNativeRuntime
144
+ load: async () => (await import("./approval-handler.runtime-DH6QCsS8.js")).googleChatApprovalNativeRuntime
143
145
  })
144
146
  });
145
- //#endregion
146
- //#region extensions/googlechat/src/doctor.ts
147
- function asObjectRecord(value) {
148
- return value && typeof value === "object" && !Array.isArray(value) ? value : null;
149
- }
150
- function isGoogleChatMutableAllowEntry(raw) {
151
- const text = raw.trim();
152
- if (!text || text === "*") return false;
153
- const withoutPrefix = text.replace(/^(googlechat|google-chat|gchat):/i, "").trim();
154
- if (!withoutPrefix) return false;
155
- return withoutPrefix.replace(/^users\//i, "").includes("@");
156
- }
157
147
  const collectGoogleChatMutableAllowlistWarnings = createDangerousNameMatchingMutableAllowlistWarningCollector({
158
148
  channel: "googlechat",
159
- detector: isGoogleChatMutableAllowEntry,
160
- collectLists: (scope) => {
161
- const lists = [{
162
- pathLabel: `${scope.prefix}.groupAllowFrom`,
163
- list: scope.account.groupAllowFrom
164
- }];
165
- const dm = asObjectRecord(scope.account.dm);
166
- if (dm) lists.push({
167
- pathLabel: `${scope.prefix}.dm.allowFrom`,
168
- list: dm.allowFrom
169
- });
170
- const groups = asObjectRecord(scope.account.groups);
171
- if (groups) for (const [groupKey, groupRaw] of Object.entries(groups)) {
172
- const group = asObjectRecord(groupRaw);
173
- if (!group) continue;
174
- lists.push({
175
- pathLabel: `${scope.prefix}.groups.${groupKey}.users`,
176
- list: group.users
177
- });
178
- }
179
- return lists;
180
- }
149
+ detector: buildMutableAllowEntryDetector({
150
+ prefixes: [
151
+ "googlechat:",
152
+ "google-chat:",
153
+ "gchat:",
154
+ "users/"
155
+ ],
156
+ stableIdPattern: /^[^@]+$/
157
+ }),
158
+ collectLists: (scope) => collectStandardAllowlistLists(scope, {
159
+ includeAllowFrom: false,
160
+ includeDm: true,
161
+ includeGroups: true,
162
+ groupField: "users"
163
+ })
181
164
  });
182
165
  //#endregion
183
166
  //#region extensions/googlechat/src/gateway.ts
184
- const loadGoogleChatChannelRuntime$1 = createLazyRuntimeNamedExport(() => import("./channel.runtime-CYmt7Ybo.js"), "googleChatChannelRuntime");
167
+ const loadGoogleChatChannelRuntime$1 = createLazyRuntimeNamedExport(() => import("./channel.runtime-CE5zWkzP.js"), "googleChatChannelRuntime");
185
168
  async function startGoogleChatGatewayAccount(ctx) {
186
169
  const account = ctx.account;
187
170
  const statusSink = createAccountStatusSink({
@@ -243,27 +226,22 @@ async function startGoogleChatGatewayAccount(ctx) {
243
226
  }
244
227
  //#endregion
245
228
  //#region extensions/googlechat/src/channel.ts
246
- const loadGoogleChatChannelRuntime = createLazyRuntimeNamedExport(() => import("./channel.runtime-CYmt7Ybo.js"), "googleChatChannelRuntime");
229
+ const loadGoogleChatChannelRuntime = createLazyRuntimeNamedExport(() => import("./channel.runtime-CE5zWkzP.js"), "googleChatChannelRuntime");
247
230
  const googlechatActions = {
248
231
  describeMessageTool: ({ cfg, accountId }) => {
249
- const accounts = accountId ? [resolveGoogleChatAccount({
232
+ if ((accountId ? [resolveGoogleChatAccount({
250
233
  cfg,
251
234
  accountId
252
235
  })].filter((account) => account.enabled && account.credentialSource !== "none") : listGoogleChatAccountIds(cfg).map((id) => resolveGoogleChatAccount({
253
236
  cfg,
254
237
  accountId: id
255
- })).filter((account) => account.enabled && account.credentialSource !== "none");
256
- if (accounts.length === 0) return null;
257
- const actions = /* @__PURE__ */ new Set(["send", "upload-file"]);
258
- if (accounts.some((account) => account.config.actions?.reactions !== false)) {
259
- actions.add("react");
260
- actions.add("reactions");
261
- }
262
- return { actions: Array.from(actions) };
238
+ })).filter((account) => account.enabled && account.credentialSource !== "none")).length === 0) return null;
239
+ return { actions: ["send"] };
263
240
  },
241
+ supportsAction: ({ action }) => action === "send",
264
242
  extractToolSend: ({ args }) => extractToolSend(args, "sendMessage"),
265
243
  handleAction: async (ctx) => {
266
- const { googlechatMessageActions } = await import("./actions-BacnMHv0.js");
244
+ const { googlechatMessageActions } = await import("./actions-B4nbMjmi.js");
267
245
  if (!googlechatMessageActions.handleAction) throw new Error("Google Chat actions are not available.");
268
246
  return await googlechatMessageActions.handleAction(ctx);
269
247
  }
@@ -283,6 +261,7 @@ const googlechatPlugin = createChatChannelPlugin({
283
261
  "google-chat",
284
262
  "gchat"
285
263
  ],
264
+ targetIdComparison: "case-sensitive",
286
265
  normalizeTarget: normalizeGoogleChatTarget,
287
266
  resolveOutboundSessionRoute: (params) => resolveGoogleChatOutboundSessionRoute(params),
288
267
  targetResolver: {
@@ -236,7 +236,7 @@ const googlechatSetupWizard = {
236
236
  ]
237
237
  },
238
238
  prepare: async ({ cfg, accountId, credentialValues, prompter }) => {
239
- if (accountId === DEFAULT_ACCOUNT_ID$1 && (Boolean(process.env[ENV_SERVICE_ACCOUNT]) || Boolean(process.env[ENV_SERVICE_ACCOUNT_FILE]))) {
239
+ if (accountId === DEFAULT_ACCOUNT_ID$1 && Boolean(normalizeOptionalString(process.env[ENV_SERVICE_ACCOUNT]) || normalizeOptionalString(process.env[ENV_SERVICE_ACCOUNT_FILE]))) {
240
240
  if (await prompter.confirm({
241
241
  message: t("wizard.googlechat.useEnvPrompt"),
242
242
  initialValue: true
@@ -373,7 +373,6 @@ function createGoogleChatPluginBase(params = {}) {
373
373
  "group",
374
374
  "thread"
375
375
  ],
376
- reactions: true,
377
376
  threads: true,
378
377
  media: true,
379
378
  nativeCommands: false,
@@ -1,5 +1,4 @@
1
- import { buildChannelConfigSchema } from "openclaw/plugin-sdk/channel-config-primitives";
2
- import { GoogleChatConfigSchema } from "openclaw/plugin-sdk/bundled-channel-config-schema";
1
+ import { n as buildChannelConfigSchema, t as GoogleChatConfigSchema } from "./config-api-CsD0IFxF.js";
3
2
  //#region extensions/googlechat/src/config-schema.ts
4
3
  const GoogleChatChannelConfigSchema = buildChannelConfigSchema(GoogleChatConfigSchema);
5
4
  //#endregion
@@ -1,2 +1,2 @@
1
- import { t as googlechatPlugin } from "./channel-_o671C-U.js";
1
+ import { t as googlechatPlugin } from "./channel-CST-JKw9.js";
2
2
  export { googlechatPlugin };