@openclaw/googlechat 2026.6.2-beta.1 → 2026.6.5-beta.1
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.
- package/dist/{actions-DisAY2Ac.js → actions-DvYC089V.js} +2 -3
- package/dist/api.js +2 -2
- package/dist/approval-auth-C-vWY4bY.js +27 -0
- package/dist/approval-handler.runtime-CWeVJAQF.js +272 -0
- package/dist/{channel-AbgtAg3y.js → channel-BY9hwCh2.js} +158 -28
- package/dist/{channel-base-DpPD0ef1.js → channel-base-Qh87GFW_.js} +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{api-DPvlxpWa.js → channel.adapters-BQoq1F4R.js} +435 -7
- package/dist/{channel.runtime-C4eLDKR3.js → channel.runtime-CbSK_Zox.js} +117 -3
- package/dist/directory-contract-api.js +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/npm-shrinkwrap.json +3 -3
- package/package.json +4 -4
- package/dist/channel.adapters-LlD3wKl5.js +0 -280
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/googlechat",
|
|
3
|
-
"version": "2026.6.
|
|
3
|
+
"version": "2026.6.5-beta.1",
|
|
4
4
|
"description": "OpenClaw Google Chat channel plugin for spaces and direct messages.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"zod": "4.4.3"
|
|
14
14
|
},
|
|
15
15
|
"peerDependencies": {
|
|
16
|
-
"openclaw": ">=2026.6.
|
|
16
|
+
"openclaw": ">=2026.6.5-beta.1"
|
|
17
17
|
},
|
|
18
18
|
"peerDependenciesMeta": {
|
|
19
19
|
"openclaw": {
|
|
@@ -71,10 +71,10 @@
|
|
|
71
71
|
"minHostVersion": ">=2026.4.10"
|
|
72
72
|
},
|
|
73
73
|
"compat": {
|
|
74
|
-
"pluginApi": ">=2026.6.
|
|
74
|
+
"pluginApi": ">=2026.6.5-beta.1"
|
|
75
75
|
},
|
|
76
76
|
"build": {
|
|
77
|
-
"openclawVersion": "2026.6.
|
|
77
|
+
"openclawVersion": "2026.6.5-beta.1"
|
|
78
78
|
},
|
|
79
79
|
"release": {
|
|
80
80
|
"publishToClawHub": true,
|
|
@@ -1,280 +0,0 @@
|
|
|
1
|
-
import { c as resolveGoogleChatAccount, r as formatGoogleChatAllowFromEntry } from "./channel-base-DpPD0ef1.js";
|
|
2
|
-
import { T as resolveChannelMediaMaxBytes, _ as missingTargetError, g as loadOutboundMediaFromUrl, i as PAIRING_APPROVED_MESSAGE, o as chunkTextForOutbound, x as readRemoteMediaBuffer } from "./runtime-api-BbVoWRxq.js";
|
|
3
|
-
import { a as findGoogleChatDirectMessage } from "./api-DPvlxpWa.js";
|
|
4
|
-
import { createLazyRuntimeNamedExport } from "openclaw/plugin-sdk/lazy-runtime";
|
|
5
|
-
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
|
-
import { createMessageReceiptFromOutboundResults, defineChannelMessageAdapter, sanitizeForPlainText } from "openclaw/plugin-sdk/channel-outbound";
|
|
7
|
-
import { adaptScopedAccountAccessor } from "openclaw/plugin-sdk/channel-config-helpers";
|
|
8
|
-
import { composeAccountWarningCollectors, createAllowlistProviderOpenWarningCollector, resolveChannelGroupRequireMention } from "openclaw/plugin-sdk/channel-policy";
|
|
9
|
-
import { createChannelDirectoryAdapter, listResolvedDirectoryGroupEntriesFromMapKeys, listResolvedDirectoryUserEntriesFromAllowFrom } from "openclaw/plugin-sdk/directory-runtime";
|
|
10
|
-
//#region extensions/googlechat/src/targets.ts
|
|
11
|
-
function normalizeGoogleChatTarget(raw) {
|
|
12
|
-
const trimmed = raw?.trim();
|
|
13
|
-
if (!trimmed) return;
|
|
14
|
-
const normalized = trimmed.replace(/^(googlechat|google-chat|gchat):/i, "").replace(/^user:(users\/)?/i, "users/").replace(/^space:(spaces\/)?/i, "spaces/");
|
|
15
|
-
if (isGoogleChatUserTarget(normalized)) {
|
|
16
|
-
const suffix = normalized.slice(6);
|
|
17
|
-
return suffix.includes("@") ? `users/${normalizeLowercaseStringOrEmpty(suffix)}` : normalized;
|
|
18
|
-
}
|
|
19
|
-
if (isGoogleChatSpaceTarget(normalized)) return normalized;
|
|
20
|
-
if (normalized.includes("@")) return `users/${normalizeLowercaseStringOrEmpty(normalized)}`;
|
|
21
|
-
return normalized;
|
|
22
|
-
}
|
|
23
|
-
function isGoogleChatUserTarget(value) {
|
|
24
|
-
return normalizeLowercaseStringOrEmpty(value).startsWith("users/");
|
|
25
|
-
}
|
|
26
|
-
function isGoogleChatSpaceTarget(value) {
|
|
27
|
-
return normalizeLowercaseStringOrEmpty(value).startsWith("spaces/");
|
|
28
|
-
}
|
|
29
|
-
function stripMessageSuffix(target) {
|
|
30
|
-
const index = target.indexOf("/messages/");
|
|
31
|
-
if (index === -1) return target;
|
|
32
|
-
return target.slice(0, index);
|
|
33
|
-
}
|
|
34
|
-
async function resolveGoogleChatOutboundSpace(params) {
|
|
35
|
-
const normalized = normalizeGoogleChatTarget(params.target);
|
|
36
|
-
if (!normalized) throw new Error("Missing Google Chat target.");
|
|
37
|
-
const base = stripMessageSuffix(normalized);
|
|
38
|
-
if (isGoogleChatSpaceTarget(base)) return base;
|
|
39
|
-
if (isGoogleChatUserTarget(base)) {
|
|
40
|
-
const dm = await findGoogleChatDirectMessage({
|
|
41
|
-
account: params.account,
|
|
42
|
-
userName: base
|
|
43
|
-
});
|
|
44
|
-
if (!dm?.name) throw new Error(`No Google Chat DM found for ${base}`);
|
|
45
|
-
return dm.name;
|
|
46
|
-
}
|
|
47
|
-
return base;
|
|
48
|
-
}
|
|
49
|
-
//#endregion
|
|
50
|
-
//#region extensions/googlechat/src/group-policy.ts
|
|
51
|
-
function resolveGoogleChatGroupRequireMention(params) {
|
|
52
|
-
return resolveChannelGroupRequireMention({
|
|
53
|
-
cfg: params.cfg,
|
|
54
|
-
channel: "googlechat",
|
|
55
|
-
groupId: params.groupId,
|
|
56
|
-
accountId: params.accountId
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
//#endregion
|
|
60
|
-
//#region extensions/googlechat/src/channel.adapters.ts
|
|
61
|
-
const loadGoogleChatChannelRuntime = createLazyRuntimeNamedExport(() => import("./channel.runtime-C4eLDKR3.js"), "googleChatChannelRuntime");
|
|
62
|
-
function createGoogleChatSendReceipt(params) {
|
|
63
|
-
const messageId = params.messageId?.trim();
|
|
64
|
-
return createMessageReceiptFromOutboundResults({
|
|
65
|
-
results: messageId ? [{
|
|
66
|
-
channel: "googlechat",
|
|
67
|
-
messageId,
|
|
68
|
-
chatId: params.chatId,
|
|
69
|
-
conversationId: params.chatId
|
|
70
|
-
}] : [],
|
|
71
|
-
threadId: params.chatId,
|
|
72
|
-
kind: params.kind
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
const formatAllowFromEntry = formatGoogleChatAllowFromEntry;
|
|
76
|
-
const collectGoogleChatSecurityWarnings = composeAccountWarningCollectors(createAllowlistProviderOpenWarningCollector({
|
|
77
|
-
providerConfigPresent: (cfg) => cfg.channels?.googlechat !== void 0,
|
|
78
|
-
resolveGroupPolicy: (account) => account.config.groupPolicy,
|
|
79
|
-
buildOpenWarning: {
|
|
80
|
-
surface: "Google Chat spaces",
|
|
81
|
-
openBehavior: "allows any space to trigger (mention-gated)",
|
|
82
|
-
remediation: "Set channels.googlechat.groupPolicy=\"allowlist\" and configure channels.googlechat.groups"
|
|
83
|
-
}
|
|
84
|
-
}), (account) => account.config.dm?.policy === "open" && "- Google Chat DMs are open to anyone. Set channels.googlechat.dm.policy=\"pairing\" or \"allowlist\".");
|
|
85
|
-
const googlechatGroupsAdapter = { resolveRequireMention: resolveGoogleChatGroupRequireMention };
|
|
86
|
-
const googlechatDirectoryAdapter = createChannelDirectoryAdapter({
|
|
87
|
-
listPeers: async (params) => listResolvedDirectoryUserEntriesFromAllowFrom({
|
|
88
|
-
...params,
|
|
89
|
-
resolveAccount: adaptScopedAccountAccessor(resolveGoogleChatAccount),
|
|
90
|
-
resolveAllowFrom: (account) => account.config.dm?.allowFrom,
|
|
91
|
-
normalizeId: (entry) => normalizeGoogleChatTarget(entry) ?? entry
|
|
92
|
-
}),
|
|
93
|
-
listGroups: async (params) => listResolvedDirectoryGroupEntriesFromMapKeys({
|
|
94
|
-
...params,
|
|
95
|
-
resolveAccount: adaptScopedAccountAccessor(resolveGoogleChatAccount),
|
|
96
|
-
resolveGroups: (account) => account.config.groups
|
|
97
|
-
})
|
|
98
|
-
});
|
|
99
|
-
const googlechatSecurityAdapter = {
|
|
100
|
-
dm: {
|
|
101
|
-
channelKey: "googlechat",
|
|
102
|
-
resolvePolicy: (account) => account.config.dm?.policy,
|
|
103
|
-
resolveAllowFrom: (account) => account.config.dm?.allowFrom,
|
|
104
|
-
allowFromPathSuffix: "dm.",
|
|
105
|
-
normalizeEntry: (raw) => formatAllowFromEntry(raw)
|
|
106
|
-
},
|
|
107
|
-
collectWarnings: collectGoogleChatSecurityWarnings
|
|
108
|
-
};
|
|
109
|
-
const googlechatThreadingAdapter = {
|
|
110
|
-
scopedAccountReplyToMode: {
|
|
111
|
-
resolveAccount: (cfg, accountId) => resolveGoogleChatAccount({
|
|
112
|
-
cfg,
|
|
113
|
-
accountId
|
|
114
|
-
}),
|
|
115
|
-
resolveReplyToMode: (account, _chatType) => account.config.replyToMode,
|
|
116
|
-
fallback: "off"
|
|
117
|
-
},
|
|
118
|
-
buildToolContext: ({ cfg, accountId, context, hasRepliedRef }) => {
|
|
119
|
-
const currentChannelId = normalizeGoogleChatTarget(context.To);
|
|
120
|
-
const replyToId = normalizeOptionalString(context.ReplyToIdFull) ?? normalizeOptionalString(context.ReplyToId);
|
|
121
|
-
return {
|
|
122
|
-
currentChannelId,
|
|
123
|
-
currentMessageId: replyToId,
|
|
124
|
-
currentThreadTs: replyToId,
|
|
125
|
-
replyToMode: resolveGoogleChatAccount({
|
|
126
|
-
cfg,
|
|
127
|
-
accountId
|
|
128
|
-
}).config.replyToMode,
|
|
129
|
-
hasRepliedRef
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
};
|
|
133
|
-
const googlechatPairingTextAdapter = {
|
|
134
|
-
idLabel: "googlechatUserId",
|
|
135
|
-
message: PAIRING_APPROVED_MESSAGE,
|
|
136
|
-
normalizeAllowEntry: (entry) => formatAllowFromEntry(entry),
|
|
137
|
-
notify: async ({ cfg, id, message, accountId }) => {
|
|
138
|
-
const account = resolveGoogleChatAccount({
|
|
139
|
-
cfg,
|
|
140
|
-
accountId
|
|
141
|
-
});
|
|
142
|
-
if (account.credentialSource === "none") return;
|
|
143
|
-
const user = normalizeGoogleChatTarget(id) ?? id;
|
|
144
|
-
const space = await resolveGoogleChatOutboundSpace({
|
|
145
|
-
account,
|
|
146
|
-
target: isGoogleChatUserTarget(user) ? user : `users/${user}`
|
|
147
|
-
});
|
|
148
|
-
const { sendGoogleChatMessage } = await loadGoogleChatChannelRuntime();
|
|
149
|
-
await sendGoogleChatMessage({
|
|
150
|
-
account,
|
|
151
|
-
space,
|
|
152
|
-
text: message
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
};
|
|
156
|
-
const googlechatOutboundAdapter = {
|
|
157
|
-
base: {
|
|
158
|
-
deliveryMode: "direct",
|
|
159
|
-
chunker: chunkTextForOutbound,
|
|
160
|
-
chunkerMode: "markdown",
|
|
161
|
-
textChunkLimit: 4e3,
|
|
162
|
-
sanitizeText: ({ text }) => sanitizeForPlainText(text),
|
|
163
|
-
resolveTarget: ({ to }) => {
|
|
164
|
-
const trimmed = normalizeOptionalString(to) ?? "";
|
|
165
|
-
if (trimmed) {
|
|
166
|
-
const normalized = normalizeGoogleChatTarget(trimmed);
|
|
167
|
-
if (!normalized) return {
|
|
168
|
-
ok: false,
|
|
169
|
-
error: missingTargetError("Google Chat", "<spaces/{space}|users/{user}>")
|
|
170
|
-
};
|
|
171
|
-
return {
|
|
172
|
-
ok: true,
|
|
173
|
-
to: normalized
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
return {
|
|
177
|
-
ok: false,
|
|
178
|
-
error: missingTargetError("Google Chat", "<spaces/{space}|users/{user}>")
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
},
|
|
182
|
-
attachedResults: {
|
|
183
|
-
channel: "googlechat",
|
|
184
|
-
sendText: async ({ cfg, to, text, accountId, replyToId, threadId }) => {
|
|
185
|
-
const account = resolveGoogleChatAccount({
|
|
186
|
-
cfg,
|
|
187
|
-
accountId
|
|
188
|
-
});
|
|
189
|
-
const space = await resolveGoogleChatOutboundSpace({
|
|
190
|
-
account,
|
|
191
|
-
target: to
|
|
192
|
-
});
|
|
193
|
-
const thread = typeof threadId === "number" ? String(threadId) : threadId ?? replyToId ?? void 0;
|
|
194
|
-
const { sendGoogleChatMessage } = await loadGoogleChatChannelRuntime();
|
|
195
|
-
const messageId = (await sendGoogleChatMessage({
|
|
196
|
-
account,
|
|
197
|
-
space,
|
|
198
|
-
text,
|
|
199
|
-
thread
|
|
200
|
-
}))?.messageName ?? "";
|
|
201
|
-
return {
|
|
202
|
-
messageId,
|
|
203
|
-
chatId: space,
|
|
204
|
-
receipt: createGoogleChatSendReceipt({
|
|
205
|
-
messageId,
|
|
206
|
-
chatId: space,
|
|
207
|
-
kind: "text"
|
|
208
|
-
})
|
|
209
|
-
};
|
|
210
|
-
},
|
|
211
|
-
sendMedia: async ({ cfg, to, text, mediaUrl, mediaAccess, mediaLocalRoots, mediaReadFile, accountId, replyToId, threadId }) => {
|
|
212
|
-
if (!mediaUrl) throw new Error("Google Chat mediaUrl is required.");
|
|
213
|
-
const account = resolveGoogleChatAccount({
|
|
214
|
-
cfg,
|
|
215
|
-
accountId
|
|
216
|
-
});
|
|
217
|
-
const space = await resolveGoogleChatOutboundSpace({
|
|
218
|
-
account,
|
|
219
|
-
target: to
|
|
220
|
-
});
|
|
221
|
-
const thread = typeof threadId === "number" ? String(threadId) : threadId ?? replyToId ?? void 0;
|
|
222
|
-
const effectiveMaxBytes = resolveChannelMediaMaxBytes({
|
|
223
|
-
cfg,
|
|
224
|
-
resolveChannelLimitMb: ({ cfg: cfgLocal, accountId: accountIdLocal }) => (cfgLocal.channels?.googlechat)?.accounts?.[accountIdLocal]?.mediaMaxMb ?? (cfgLocal.channels?.googlechat)?.mediaMaxMb,
|
|
225
|
-
accountId
|
|
226
|
-
}) ?? (account.config.mediaMaxMb ?? 20) * 1024 * 1024;
|
|
227
|
-
const loaded = /^https?:\/\//i.test(mediaUrl) ? await readRemoteMediaBuffer({
|
|
228
|
-
url: mediaUrl,
|
|
229
|
-
maxBytes: effectiveMaxBytes
|
|
230
|
-
}) : await loadOutboundMediaFromUrl(mediaUrl, {
|
|
231
|
-
maxBytes: effectiveMaxBytes,
|
|
232
|
-
mediaAccess,
|
|
233
|
-
mediaLocalRoots,
|
|
234
|
-
mediaReadFile
|
|
235
|
-
});
|
|
236
|
-
const { sendGoogleChatMessage, uploadGoogleChatAttachment } = await loadGoogleChatChannelRuntime();
|
|
237
|
-
const upload = await uploadGoogleChatAttachment({
|
|
238
|
-
account,
|
|
239
|
-
space,
|
|
240
|
-
filename: loaded.fileName ?? "attachment",
|
|
241
|
-
buffer: loaded.buffer,
|
|
242
|
-
contentType: loaded.contentType
|
|
243
|
-
});
|
|
244
|
-
const messageId = (await sendGoogleChatMessage({
|
|
245
|
-
account,
|
|
246
|
-
space,
|
|
247
|
-
text,
|
|
248
|
-
thread,
|
|
249
|
-
attachments: upload.attachmentUploadToken ? [{
|
|
250
|
-
attachmentUploadToken: upload.attachmentUploadToken,
|
|
251
|
-
contentName: loaded.fileName
|
|
252
|
-
}] : void 0
|
|
253
|
-
}))?.messageName ?? "";
|
|
254
|
-
return {
|
|
255
|
-
messageId,
|
|
256
|
-
chatId: space,
|
|
257
|
-
receipt: createGoogleChatSendReceipt({
|
|
258
|
-
messageId,
|
|
259
|
-
chatId: space,
|
|
260
|
-
kind: "media"
|
|
261
|
-
})
|
|
262
|
-
};
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
};
|
|
266
|
-
const googlechatMessageAdapter = defineChannelMessageAdapter({
|
|
267
|
-
id: "googlechat",
|
|
268
|
-
durableFinal: { capabilities: {
|
|
269
|
-
text: true,
|
|
270
|
-
media: true,
|
|
271
|
-
thread: true,
|
|
272
|
-
messageSendingHooks: true
|
|
273
|
-
} },
|
|
274
|
-
send: {
|
|
275
|
-
text: googlechatOutboundAdapter.attachedResults.sendText,
|
|
276
|
-
media: googlechatOutboundAdapter.attachedResults.sendMedia
|
|
277
|
-
}
|
|
278
|
-
});
|
|
279
|
-
//#endregion
|
|
280
|
-
export { googlechatPairingTextAdapter as a, isGoogleChatSpaceTarget as c, resolveGoogleChatOutboundSpace as d, googlechatOutboundAdapter as i, isGoogleChatUserTarget as l, googlechatGroupsAdapter as n, googlechatSecurityAdapter as o, googlechatMessageAdapter as r, googlechatThreadingAdapter as s, googlechatDirectoryAdapter as t, normalizeGoogleChatTarget as u };
|