@openclaw/googlechat 2026.9.7 → 2026.10.1-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/.setup/{actions-K6_7xusH.mjs → actions-BtW6Mbtw.mjs} +2 -2
- package/dist/.setup/{approval-auth-DXvh9tfx.mjs → approval-auth-7RuArHyo.mjs} +2 -2
- package/dist/.setup/{approval-handler.runtime-CT2MVoa-.mjs → approval-handler.runtime-D0dWJcjH.mjs} +21 -34
- package/dist/.setup/{channel-DAUmcC2J.mjs → channel-CRIyIoxn.mjs} +9 -9
- package/dist/.setup/{channel-base-inLf3HGV.mjs → channel-base-BdCGLoFe.mjs} +1 -2
- package/dist/.setup/{channel.adapters-DIQot11j.mjs → channel.adapters-CcYyfMMC.mjs} +50 -73
- package/dist/.setup/{channel.runtime-C-B60lWL.mjs → channel.runtime-BEP3QsS4.mjs} +64 -64
- package/dist/.setup/{doctor-contract-wLrnvLUn.mjs → doctor-contract-BzoaiFSD.mjs} +6 -0
- package/dist/.setup/{secret-contract-B7H-kkqq.mjs → secret-contract-020OItNt.mjs} +37 -42
- package/dist/.setup/{secret-contract-api-GavLI-0W.mjs → secret-contract-api-DvHE657z.mjs} +1 -1
- package/dist/.setup/{setup-plugin-api-CAzvWHwN.mjs → setup-plugin-api-5p-SthtR.mjs} +1 -1
- package/dist/.setup/setup-plugin-api-KFtk0y_E.mjs +2 -0
- package/dist/api.js +2 -2
- package/dist/channel-plugin-api.js +1 -1
- package/dist/directory-contract-api.js +1 -1
- package/dist/doctor-contract-api.js +1 -1
- package/dist/secret-contract-api.js +1 -1
- package/dist/setup-entry.js +2 -2
- package/dist/setup-plugin-api.js +1 -1
- package/package.json +5 -5
- package/dist/.setup/setup-plugin-api-DPYc1usm.mjs +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { l as resolveGoogleChatAccount } from "./channel-base-
|
|
2
|
-
import { g as resolveGoogleChatOutboundSpace, x as sendGoogleChatMessage } from "./channel.adapters-
|
|
1
|
+
import { l as resolveGoogleChatAccount } from "./channel-base-BdCGLoFe.mjs";
|
|
2
|
+
import { g as resolveGoogleChatOutboundSpace, x as sendGoogleChatMessage } from "./channel.adapters-CcYyfMMC.mjs";
|
|
3
3
|
import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
4
|
import { jsonResult, readStringArrayParam, readStringParam } from "openclaw/plugin-sdk/channel-actions";
|
|
5
5
|
//#region extensions/googlechat/src/actions.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { l as resolveGoogleChatAccount } from "./channel-base-
|
|
2
|
-
import { m as normalizeGoogleChatTarget, p as isGoogleChatUserTarget } from "./channel.adapters-
|
|
1
|
+
import { l as resolveGoogleChatAccount } from "./channel-base-BdCGLoFe.mjs";
|
|
2
|
+
import { m as normalizeGoogleChatTarget, p as isGoogleChatUserTarget } from "./channel.adapters-CcYyfMMC.mjs";
|
|
3
3
|
import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
4
|
import { createChannelApprovalAuth } from "openclaw/plugin-sdk/approval-auth-runtime";
|
|
5
5
|
//#region extensions/googlechat/src/approval-auth.ts
|
package/dist/.setup/{approval-handler.runtime-CT2MVoa-.mjs → approval-handler.runtime-D0dWJcjH.mjs}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { l as resolveGoogleChatAccount } from "./channel-base-
|
|
2
|
-
import { A as unregisterGoogleChatManualApprovalFollowupSuppression, E as googleChatApprovalControls, O as registerGoogleChatApprovalCardBinding, S as updateGoogleChatMessage, T as buildGoogleChatApprovalActionParameters, g as resolveGoogleChatOutboundSpace, k as registerGoogleChatManualApprovalFollowupSuppression, w as GOOGLECHAT_APPROVAL_ACTION, x as sendGoogleChatMessage } from "./channel.adapters-
|
|
3
|
-
import { n as isGoogleChatNativeApprovalClientEnabled, r as shouldHandleGoogleChatNativeApprovalRequest } from "./channel-
|
|
1
|
+
import { l as resolveGoogleChatAccount } from "./channel-base-BdCGLoFe.mjs";
|
|
2
|
+
import { A as unregisterGoogleChatManualApprovalFollowupSuppression, E as googleChatApprovalControls, O as registerGoogleChatApprovalCardBinding, S as updateGoogleChatMessage, T as buildGoogleChatApprovalActionParameters, g as resolveGoogleChatOutboundSpace, k as registerGoogleChatManualApprovalFollowupSuppression, w as GOOGLECHAT_APPROVAL_ACTION, x as sendGoogleChatMessage } from "./channel.adapters-CcYyfMMC.mjs";
|
|
3
|
+
import { n as isGoogleChatNativeApprovalClientEnabled, r as shouldHandleGoogleChatNativeApprovalRequest } from "./channel-CRIyIoxn.mjs";
|
|
4
4
|
import { n as escapeGoogleChatApprovalCardText, t as buildGoogleChatApprovalTextWidget } from "./approval-card-text-BKg_4mXq.mjs";
|
|
5
5
|
import { buildChannelApprovalNativeTargetKey } from "openclaw/plugin-sdk/approval-native-runtime";
|
|
6
6
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
@@ -18,9 +18,6 @@ function resolveHandlerAccount(params) {
|
|
|
18
18
|
if (!account.enabled || account.credentialSource === "none" || account.tokenStatus === "configured_unavailable") return null;
|
|
19
19
|
return account;
|
|
20
20
|
}
|
|
21
|
-
function buildMetadataText(metadata) {
|
|
22
|
-
return metadata.map((item) => `<b>${escapeGoogleChatApprovalCardText(item.label)}:</b> ${escapeGoogleChatApprovalCardText(item.value)}`).join("<br>");
|
|
23
|
-
}
|
|
24
21
|
function buildPendingSections(view) {
|
|
25
22
|
if (view.approvalKind === "exec") return [{
|
|
26
23
|
header: "Command",
|
|
@@ -41,39 +38,29 @@ function buildPendingSections(view) {
|
|
|
41
38
|
function buildMetadataSection(view) {
|
|
42
39
|
return {
|
|
43
40
|
header: "Details",
|
|
44
|
-
widgets: [buildGoogleChatApprovalTextWidget(
|
|
41
|
+
widgets: [buildGoogleChatApprovalTextWidget([{
|
|
45
42
|
label: "Approval ID",
|
|
46
43
|
value: view.approvalId
|
|
47
|
-
}, ...view.metadata]), "html")]
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
function buildActionSection(params) {
|
|
51
|
-
const { actionFunction, view } = params;
|
|
52
|
-
const actionTokens = [];
|
|
53
|
-
return {
|
|
54
|
-
actionTokens,
|
|
55
|
-
section: { widgets: [{ buttonList: { buttons: view.actions.map((action) => {
|
|
56
|
-
const token = googleChatApprovalControls.createToken();
|
|
57
|
-
actionTokens.push({
|
|
58
|
-
token,
|
|
59
|
-
decision: action.decision
|
|
60
|
-
});
|
|
61
|
-
return {
|
|
62
|
-
text: action.label,
|
|
63
|
-
onClick: { action: {
|
|
64
|
-
function: actionFunction,
|
|
65
|
-
parameters: buildGoogleChatApprovalActionParameters(token),
|
|
66
|
-
loadIndicator: "SPINNER"
|
|
67
|
-
} }
|
|
68
|
-
};
|
|
69
|
-
}) } }] }
|
|
44
|
+
}, ...view.metadata].map((item) => `<b>${escapeGoogleChatApprovalCardText(item.label)}:</b> ${escapeGoogleChatApprovalCardText(item.value)}`).join("<br>"), "html")]
|
|
70
45
|
};
|
|
71
46
|
}
|
|
72
47
|
function buildPendingPayload(params) {
|
|
73
48
|
const { actionFunction, nowMs, view } = params;
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
49
|
+
const actionTokens = [];
|
|
50
|
+
const buttons = view.actions.map((action) => {
|
|
51
|
+
const token = googleChatApprovalControls.createToken();
|
|
52
|
+
actionTokens.push({
|
|
53
|
+
token,
|
|
54
|
+
decision: action.decision
|
|
55
|
+
});
|
|
56
|
+
return {
|
|
57
|
+
text: action.label,
|
|
58
|
+
onClick: { action: {
|
|
59
|
+
function: actionFunction,
|
|
60
|
+
parameters: buildGoogleChatApprovalActionParameters(token),
|
|
61
|
+
loadIndicator: "SPINNER"
|
|
62
|
+
} }
|
|
63
|
+
};
|
|
77
64
|
});
|
|
78
65
|
const title = view.approvalKind === "plugin" ? "Plugin Approval Required" : view.approvalKind === "system-agent" ? "OpenClaw Change Requires Approval" : "Exec Approval Required";
|
|
79
66
|
const subtitle = `Expires in ${Math.max(0, Math.ceil((view.expiresAtMs - nowMs) / 1e3))}s`;
|
|
@@ -87,7 +74,7 @@ function buildPendingPayload(params) {
|
|
|
87
74
|
sections: [
|
|
88
75
|
...buildPendingSections(view),
|
|
89
76
|
buildMetadataSection(view),
|
|
90
|
-
|
|
77
|
+
{ widgets: [{ buttonList: { buttons } }] }
|
|
91
78
|
]
|
|
92
79
|
}
|
|
93
80
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-
|
|
1
|
+
import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-BzoaiFSD.mjs";
|
|
2
2
|
import { n as buildChannelConfigSchema, t as GoogleChatConfigSchema } from "./config-api-CsD0IFxF.mjs";
|
|
3
|
-
import { c as resolveDefaultGoogleChatAccountId, l as resolveGoogleChatAccount, n as createGoogleChatPluginBase, o as inspectGoogleChatAccount, s as listGoogleChatAccountIds, t as GOOGLECHAT_CHANNEL_ID } from "./channel-base-
|
|
4
|
-
import { a as googlechatPairingTextAdapter, f as isGoogleChatSpaceTarget, h as resolveGoogleChatOutboundSessionRoute, i as googlechatOutboundAdapter, m as normalizeGoogleChatTarget, n as googlechatGroupsAdapter, o as googlechatSecurityAdapter, p as isGoogleChatUserTarget, r as googlechatMessageAdapter, s as googlechatThreadingAdapter, t as googlechatDirectoryAdapter } from "./channel.adapters-
|
|
5
|
-
import { n as googleChatApprovalAuth, r as normalizeGoogleChatApproverId, t as getGoogleChatApprovalApprovers } from "./approval-auth-
|
|
6
|
-
import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./secret-contract-
|
|
3
|
+
import { c as resolveDefaultGoogleChatAccountId, l as resolveGoogleChatAccount, n as createGoogleChatPluginBase, o as inspectGoogleChatAccount, s as listGoogleChatAccountIds, t as GOOGLECHAT_CHANNEL_ID } from "./channel-base-BdCGLoFe.mjs";
|
|
4
|
+
import { a as googlechatPairingTextAdapter, f as isGoogleChatSpaceTarget, h as resolveGoogleChatOutboundSessionRoute, i as googlechatOutboundAdapter, m as normalizeGoogleChatTarget, n as googlechatGroupsAdapter, o as googlechatSecurityAdapter, p as isGoogleChatUserTarget, r as googlechatMessageAdapter, s as googlechatThreadingAdapter, t as googlechatDirectoryAdapter } from "./channel.adapters-CcYyfMMC.mjs";
|
|
5
|
+
import { n as googleChatApprovalAuth, r as normalizeGoogleChatApproverId, t as getGoogleChatApprovalApprovers } from "./approval-auth-7RuArHyo.mjs";
|
|
6
|
+
import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./secret-contract-020OItNt.mjs";
|
|
7
7
|
import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk/account-id";
|
|
8
8
|
import { createChatChannelPlugin } from "openclaw/plugin-sdk/channel-core";
|
|
9
9
|
import { buildPassiveProbedChannelStatusSummary } from "openclaw/plugin-sdk/extension-shared";
|
|
@@ -132,7 +132,7 @@ const googleChatApprovalCapability = createApproverRestrictedNativeApprovalCapab
|
|
|
132
132
|
],
|
|
133
133
|
isConfigured: isGoogleChatNativeApprovalClientEnabled,
|
|
134
134
|
shouldHandle: shouldHandleGoogleChatNativeApprovalRequest,
|
|
135
|
-
load: async () => (await import("./approval-handler.runtime-
|
|
135
|
+
load: async () => (await import("./approval-handler.runtime-D0dWJcjH.mjs")).googleChatApprovalNativeRuntime
|
|
136
136
|
})
|
|
137
137
|
});
|
|
138
138
|
//#endregion
|
|
@@ -156,7 +156,7 @@ const collectGoogleChatMutableAllowlistWarnings = createDangerousNameMatchingMut
|
|
|
156
156
|
});
|
|
157
157
|
//#endregion
|
|
158
158
|
//#region extensions/googlechat/src/gateway.ts
|
|
159
|
-
const loadGoogleChatChannelRuntime$1 = createLazyRuntimeNamedExport(() => import("./channel.runtime-
|
|
159
|
+
const loadGoogleChatChannelRuntime$1 = createLazyRuntimeNamedExport(() => import("./channel.runtime-BEP3QsS4.mjs"), "googleChatChannelRuntime");
|
|
160
160
|
const UNRESOLVED_WEBHOOK_URL_ERROR = "Invalid webhookUrl: expected an absolute URL such as https://chat.example.com/googlechat. No inbound webhook route was registered.";
|
|
161
161
|
async function startGoogleChatGatewayAccount(ctx) {
|
|
162
162
|
const account = ctx.account;
|
|
@@ -226,11 +226,11 @@ const googlechatMessageActions = {
|
|
|
226
226
|
describeMessageTool: describeGoogleChatMessageTool,
|
|
227
227
|
supportsAction: ({ action }) => action === "send",
|
|
228
228
|
extractToolSend: ({ args }) => extractToolSend(args, "sendMessage"),
|
|
229
|
-
handleAction: async (ctx) => (await import("./actions-
|
|
229
|
+
handleAction: async (ctx) => (await import("./actions-BtW6Mbtw.mjs")).handleGoogleChatAction(ctx)
|
|
230
230
|
};
|
|
231
231
|
//#endregion
|
|
232
232
|
//#region extensions/googlechat/src/channel.ts
|
|
233
|
-
const loadGoogleChatChannelRuntime = createLazyRuntimeNamedExport(() => import("./channel.runtime-
|
|
233
|
+
const loadGoogleChatChannelRuntime = createLazyRuntimeNamedExport(() => import("./channel.runtime-BEP3QsS4.mjs"), "googleChatChannelRuntime");
|
|
234
234
|
const googlechatPlugin = createChatChannelPlugin({
|
|
235
235
|
base: {
|
|
236
236
|
...createGoogleChatPluginBase({ configSchema: buildChannelConfigSchema(GoogleChatConfigSchema) }),
|
|
@@ -162,8 +162,7 @@ const googlechatSetupAdapter = createPatchedAccountSetupAdapter({
|
|
|
162
162
|
message: "Google Chat requires --token (service account JSON) or --token-file."
|
|
163
163
|
}]
|
|
164
164
|
}),
|
|
165
|
-
buildPatch: (
|
|
166
|
-
const setupInput = input;
|
|
165
|
+
buildPatch: (setupInput) => {
|
|
167
166
|
const patch = setupInput.useEnv ? {} : setupInput.tokenFile ? { serviceAccountFile: setupInput.tokenFile } : setupInput.token ? { serviceAccount: setupInput.token } : {};
|
|
168
167
|
const audienceType = setupInput.audienceType?.trim();
|
|
169
168
|
const audience = setupInput.audience?.trim();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { l as resolveGoogleChatAccount, r as formatGoogleChatAllowFromEntry, u as MAX_GOOGLE_CHAT_SERVICE_ACCOUNT_FILE_BYTES } from "./channel-base-
|
|
1
|
+
import { l as resolveGoogleChatAccount, r as formatGoogleChatAllowFromEntry, u as MAX_GOOGLE_CHAT_SERVICE_ACCOUNT_FILE_BYTES } from "./channel-base-BdCGLoFe.mjs";
|
|
2
2
|
import { buildChannelOutboundSessionRoute } from "openclaw/plugin-sdk/channel-core";
|
|
3
3
|
import { createLazyRuntimeNamedExport } from "openclaw/plugin-sdk/lazy-runtime";
|
|
4
4
|
import { asNullableObjectRecord, isRecord, normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
@@ -131,11 +131,6 @@ function normalizeGoogleAuthHeaders(value) {
|
|
|
131
131
|
if (!(value.headers instanceof Headers)) value.headers = new Headers(value.headers);
|
|
132
132
|
return value;
|
|
133
133
|
}
|
|
134
|
-
function installGoogleAuthHeaderCompatibilityInterceptor(transport) {
|
|
135
|
-
transport.interceptors.request.add({ resolved: async (config) => normalizeGoogleAuthHeaders(config) });
|
|
136
|
-
transport.interceptors.response.add({ resolved: async (response) => normalizeGoogleAuthHeaders(response) });
|
|
137
|
-
return transport;
|
|
138
|
-
}
|
|
139
134
|
function hasProxyAgentShape(value) {
|
|
140
135
|
const record = asNullableObjectRecord(value);
|
|
141
136
|
return record !== null && record.proxy instanceof URL;
|
|
@@ -201,9 +196,6 @@ function shouldBypassGoogleAuthProxy(url, noProxy = []) {
|
|
|
201
196
|
}
|
|
202
197
|
return false;
|
|
203
198
|
}
|
|
204
|
-
function readGoogleAuthProxyUrl(value) {
|
|
205
|
-
return value instanceof URL ? value.toString() : normalizeOptionalString(value);
|
|
206
|
-
}
|
|
207
199
|
function readOptionalTrimmedString(record, fieldName) {
|
|
208
200
|
const value = record[fieldName];
|
|
209
201
|
if (value === void 0 || value === null) return;
|
|
@@ -295,7 +287,7 @@ function resolveGoogleAuthDispatcherPolicy(input, init) {
|
|
|
295
287
|
const tlsOptions = resolveGoogleAuthTlsOptions(googleAuthInit, requestUrl);
|
|
296
288
|
const proxyBypassed = shouldBypassGoogleAuthProxy(requestUrl, Array.isArray(googleAuthInit.noProxy) ? googleAuthInit.noProxy : []);
|
|
297
289
|
const agent = resolveGoogleAuthAgent(googleAuthInit, requestUrl);
|
|
298
|
-
const explicitProxy =
|
|
290
|
+
const explicitProxy = (googleAuthInit.proxy instanceof URL ? googleAuthInit.proxy.toString() : normalizeOptionalString(googleAuthInit.proxy)) ?? (hasProxyAgentShape(agent) ? agent.proxy.toString() : void 0);
|
|
299
291
|
if (!proxyBypassed && explicitProxy) return {
|
|
300
292
|
dispatcherPolicy: {
|
|
301
293
|
allowPrivateProxy: true,
|
|
@@ -366,7 +358,10 @@ async function loadGoogleAuthRuntime() {
|
|
|
366
358
|
}
|
|
367
359
|
async function getGoogleAuthTransport() {
|
|
368
360
|
const { gaxios } = await loadGoogleAuthRuntime();
|
|
369
|
-
|
|
361
|
+
const transport = new gaxios.Gaxios({ fetchImplementation: createGoogleAuthFetch() });
|
|
362
|
+
transport.interceptors.request.add({ resolved: async (config) => normalizeGoogleAuthHeaders(config) });
|
|
363
|
+
transport.interceptors.response.add({ resolved: async (response) => normalizeGoogleAuthHeaders(response) });
|
|
364
|
+
return transport;
|
|
370
365
|
}
|
|
371
366
|
async function resolveValidatedGoogleChatCredentials(account) {
|
|
372
367
|
if (account.credentials) return validateGoogleChatServiceAccountCredentials(account.credentials);
|
|
@@ -385,15 +380,13 @@ const authCache = /* @__PURE__ */ new Map();
|
|
|
385
380
|
let cachedCerts = null;
|
|
386
381
|
let verifyClientPromise = null;
|
|
387
382
|
async function getVerifyClient() {
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
}
|
|
396
|
-
})();
|
|
383
|
+
verifyClientPromise ??= (async () => {
|
|
384
|
+
const { OAuth2Client } = await loadGoogleAuthRuntime();
|
|
385
|
+
return new OAuth2Client({ transporter: await getGoogleAuthTransport() });
|
|
386
|
+
})().catch((error) => {
|
|
387
|
+
verifyClientPromise = null;
|
|
388
|
+
throw error;
|
|
389
|
+
});
|
|
397
390
|
return await verifyClientPromise;
|
|
398
391
|
}
|
|
399
392
|
function buildAuthKey(account) {
|
|
@@ -460,40 +453,39 @@ async function verifyGoogleChatRequest(params) {
|
|
|
460
453
|
reason: "missing audience"
|
|
461
454
|
};
|
|
462
455
|
const audienceType = params.audienceType ?? null;
|
|
463
|
-
if (audienceType
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
const email = normalizeLowercaseStringOrEmpty(payload?.email ?? "");
|
|
469
|
-
if (!payload?.email_verified) return {
|
|
470
|
-
ok: false,
|
|
471
|
-
reason: "email not verified"
|
|
472
|
-
};
|
|
473
|
-
if (email === CHAT_ISSUER) return { ok: true };
|
|
474
|
-
if (!ADDON_ISSUER_PATTERN.test(email)) return {
|
|
475
|
-
ok: false,
|
|
476
|
-
reason: `invalid issuer: ${email}`
|
|
477
|
-
};
|
|
478
|
-
const expectedAddOnPrincipal = normalizeLowercaseStringOrEmpty(params.expectedAddOnPrincipal ?? "");
|
|
479
|
-
if (!expectedAddOnPrincipal) return {
|
|
480
|
-
ok: false,
|
|
481
|
-
reason: "missing add-on principal binding"
|
|
482
|
-
};
|
|
483
|
-
const tokenPrincipal = normalizeLowercaseStringOrEmpty(payload?.sub ?? "");
|
|
484
|
-
if (!tokenPrincipal || tokenPrincipal !== expectedAddOnPrincipal) return {
|
|
485
|
-
ok: false,
|
|
486
|
-
reason: `unexpected add-on principal: ${tokenPrincipal || "<missing>"}`
|
|
487
|
-
};
|
|
488
|
-
return { ok: true };
|
|
489
|
-
} catch (err) {
|
|
490
|
-
return {
|
|
491
|
-
ok: false,
|
|
492
|
-
reason: err instanceof Error ? err.message : "invalid token"
|
|
493
|
-
};
|
|
494
|
-
}
|
|
495
|
-
if (audienceType === "project-number") try {
|
|
456
|
+
if (audienceType !== "app-url" && audienceType !== "project-number") return {
|
|
457
|
+
ok: false,
|
|
458
|
+
reason: "unsupported audience type"
|
|
459
|
+
};
|
|
460
|
+
try {
|
|
496
461
|
const verifyClient = await getVerifyClient();
|
|
462
|
+
if (audienceType === "app-url") {
|
|
463
|
+
const payload = (await verifyClient.verifyIdToken({
|
|
464
|
+
idToken: bearer,
|
|
465
|
+
audience
|
|
466
|
+
})).getPayload();
|
|
467
|
+
const email = normalizeLowercaseStringOrEmpty(payload?.email ?? "");
|
|
468
|
+
if (!payload?.email_verified) return {
|
|
469
|
+
ok: false,
|
|
470
|
+
reason: "email not verified"
|
|
471
|
+
};
|
|
472
|
+
if (email === CHAT_ISSUER) return { ok: true };
|
|
473
|
+
if (!ADDON_ISSUER_PATTERN.test(email)) return {
|
|
474
|
+
ok: false,
|
|
475
|
+
reason: `invalid issuer: ${email}`
|
|
476
|
+
};
|
|
477
|
+
const expectedAddOnPrincipal = normalizeLowercaseStringOrEmpty(params.expectedAddOnPrincipal ?? "");
|
|
478
|
+
if (!expectedAddOnPrincipal) return {
|
|
479
|
+
ok: false,
|
|
480
|
+
reason: "missing add-on principal binding"
|
|
481
|
+
};
|
|
482
|
+
const tokenPrincipal = normalizeLowercaseStringOrEmpty(payload?.sub ?? "");
|
|
483
|
+
if (!tokenPrincipal || tokenPrincipal !== expectedAddOnPrincipal) return {
|
|
484
|
+
ok: false,
|
|
485
|
+
reason: `unexpected add-on principal: ${tokenPrincipal || "<missing>"}`
|
|
486
|
+
};
|
|
487
|
+
return { ok: true };
|
|
488
|
+
}
|
|
497
489
|
const certs = await fetchChatCerts();
|
|
498
490
|
await verifyClient.verifySignedJwtWithCertsAsync(bearer, certs, audience, [CHAT_ISSUER]);
|
|
499
491
|
return { ok: true };
|
|
@@ -503,10 +495,6 @@ async function verifyGoogleChatRequest(params) {
|
|
|
503
495
|
reason: err instanceof Error ? err.message : "invalid token"
|
|
504
496
|
};
|
|
505
497
|
}
|
|
506
|
-
return {
|
|
507
|
-
ok: false,
|
|
508
|
-
reason: "unsupported audience type"
|
|
509
|
-
};
|
|
510
498
|
}
|
|
511
499
|
//#endregion
|
|
512
500
|
//#region extensions/googlechat/src/api.ts
|
|
@@ -541,7 +529,7 @@ async function readGoogleChatErrorResponse(response, label) {
|
|
|
541
529
|
return redactToolPayloadText(text);
|
|
542
530
|
}
|
|
543
531
|
async function withGoogleChatResponse(params) {
|
|
544
|
-
const { account, url, init, auditContext,
|
|
532
|
+
const { account, url, init, auditContext, timeoutMs = GOOGLECHAT_API_TIMEOUT_MS, handleResponse, assertDirectAdapterHandoff, onPlatformSendDispatch } = params;
|
|
545
533
|
assertDirectAdapterHandoff?.();
|
|
546
534
|
const token = await getGoogleChatAccessToken(account);
|
|
547
535
|
if (onPlatformSendDispatch) {
|
|
@@ -563,8 +551,8 @@ async function withGoogleChatResponse(params) {
|
|
|
563
551
|
});
|
|
564
552
|
try {
|
|
565
553
|
if (!response.ok) {
|
|
566
|
-
const text = await readGoogleChatErrorResponse(response,
|
|
567
|
-
throw new GoogleChatApiError(response.status,
|
|
554
|
+
const text = await readGoogleChatErrorResponse(response, "Google Chat API");
|
|
555
|
+
throw new GoogleChatApiError(response.status, `Google Chat API ${response.status}: ${text || response.statusText}`);
|
|
568
556
|
}
|
|
569
557
|
return await handleResponse(response);
|
|
570
558
|
} finally {
|
|
@@ -613,15 +601,6 @@ async function downloadGoogleChatMedia(params) {
|
|
|
613
601
|
}
|
|
614
602
|
});
|
|
615
603
|
}
|
|
616
|
-
/**
|
|
617
|
-
* A Google Chat `thread` must be a `spaces/{space}/threads/{thread}` resource
|
|
618
|
-
* name that belongs to the target space. Reply routing sometimes yields other
|
|
619
|
-
* shapes — a bare id, a `spaces/{space}/messages/{message}` name, or a thread
|
|
620
|
-
* from a different (or wrongly-cased) space — and passing any of those makes the
|
|
621
|
-
* Chat API reject the whole send with `400 INVALID_ARGUMENT`. Accept only a
|
|
622
|
-
* well-formed, same-space thread name; callers drop the rest so the message
|
|
623
|
-
* still delivers to the space (as a new thread) instead of failing outright.
|
|
624
|
-
*/
|
|
625
604
|
function isUsableGoogleChatThreadName(thread, space) {
|
|
626
605
|
return /^spaces\/[^/]+\/threads\/[^/]+$/.test(thread) && thread.startsWith(`${space}/threads/`);
|
|
627
606
|
}
|
|
@@ -731,7 +710,6 @@ async function resolveGoogleChatOutboundSpaceDetails(params) {
|
|
|
731
710
|
const normalized = normalizeGoogleChatTarget(params.target);
|
|
732
711
|
if (!normalized) throw new Error("Missing Google Chat target.");
|
|
733
712
|
const base = stripMessageSuffix(normalized);
|
|
734
|
-
if (isGoogleChatSpaceTarget(base)) return { name: base };
|
|
735
713
|
if (isGoogleChatUserTarget(base)) {
|
|
736
714
|
const dm = await findGoogleChatDirectMessage({
|
|
737
715
|
account: params.account,
|
|
@@ -939,7 +917,7 @@ function projectGoogleChatPlainLiterals(ir) {
|
|
|
939
917
|
}
|
|
940
918
|
let firstTextIndex = lineStart;
|
|
941
919
|
while (firstTextIndex < lineEnd && characters[firstTextIndex] === " ") firstTextIndex += 1;
|
|
942
|
-
if (
|
|
920
|
+
if (!inCode(firstTextIndex)) {
|
|
943
921
|
const character = characters[firstTextIndex];
|
|
944
922
|
if ((character === "*" || character === "-") && characters[firstTextIndex + 1] === " " || character === ">") characters[firstTextIndex] = GOOGLE_CHAT_LITERAL_FALLBACKS.get(character) ?? character;
|
|
945
923
|
}
|
|
@@ -1085,7 +1063,6 @@ function resolveGoogleChatGroupRequireMention(params) {
|
|
|
1085
1063
|
//#region extensions/googlechat/src/ingress-identity.ts
|
|
1086
1064
|
function normalizeGoogleChatUserId(raw) {
|
|
1087
1065
|
const trimmed = normalizeOptionalString(raw) ?? "";
|
|
1088
|
-
if (!trimmed) return "";
|
|
1089
1066
|
return normalizeLowercaseStringOrEmpty(trimmed.replace(/^users\//i, ""));
|
|
1090
1067
|
}
|
|
1091
1068
|
const GOOGLECHAT_EMAIL_KIND = "plugin:googlechat-email";
|
|
@@ -1116,7 +1093,7 @@ const googleChatIngressIdentity = defineStableChannelIngressIdentity({
|
|
|
1116
1093
|
});
|
|
1117
1094
|
//#endregion
|
|
1118
1095
|
//#region extensions/googlechat/src/channel.adapters.ts
|
|
1119
|
-
const loadGoogleChatChannelRuntime = createLazyRuntimeNamedExport(() => import("./channel.runtime-
|
|
1096
|
+
const loadGoogleChatChannelRuntime = createLazyRuntimeNamedExport(() => import("./channel.runtime-BEP3QsS4.mjs"), "googleChatChannelRuntime");
|
|
1120
1097
|
const collectGoogleChatGroupPolicyWarnings = createAllowlistProviderOpenWarningCollector({
|
|
1121
1098
|
providerConfigPresent: (cfg) => cfg.channels?.googlechat !== void 0,
|
|
1122
1099
|
resolveGroupPolicy: (account) => account.config.groupPolicy,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { C as verifyGoogleChatRequest, D as readGoogleChatApprovalActionToken, E as googleChatApprovalControls, S as updateGoogleChatMessage, _ as GoogleChatApiError, b as probeGoogleChat, c as googleChatIngressIdentity, d as isGoogleChatGroupSpace, l as normalizeGoogleChatUserId, u as buildGoogleChatGroupPolicyScope, v as deleteGoogleChatMessage, x as sendGoogleChatMessage, y as downloadGoogleChatMedia } from "./channel.adapters-
|
|
2
|
-
import { n as googleChatApprovalAuth } from "./approval-auth-
|
|
1
|
+
import { C as verifyGoogleChatRequest, D as readGoogleChatApprovalActionToken, E as googleChatApprovalControls, S as updateGoogleChatMessage, _ as GoogleChatApiError, b as probeGoogleChat, c as googleChatIngressIdentity, d as isGoogleChatGroupSpace, l as normalizeGoogleChatUserId, u as buildGoogleChatGroupPolicyScope, v as deleteGoogleChatMessage, x as sendGoogleChatMessage, y as downloadGoogleChatMedia } from "./channel.adapters-CcYyfMMC.mjs";
|
|
2
|
+
import { n as googleChatApprovalAuth } from "./approval-auth-7RuArHyo.mjs";
|
|
3
3
|
import { t as getGoogleChatRuntime } from "./runtime-C5OOOlaP.mjs";
|
|
4
4
|
import { n as escapeGoogleChatApprovalCardText, t as buildGoogleChatApprovalTextWidget } from "./approval-card-text-BKg_4mXq.mjs";
|
|
5
|
-
import { normalizeLowercaseStringOrEmpty,
|
|
5
|
+
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeStringEntries, normalizeTrimmedStringList } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
6
|
import { mergePairLoopGuardConfig } from "openclaw/plugin-sdk/pair-loop-guard-runtime";
|
|
7
7
|
import { PlatformMessageNotDispatchedError, collectErrorGraphCandidates, formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
8
8
|
import { MediaFetchError } from "openclaw/plugin-sdk/media-runtime";
|
|
@@ -664,6 +664,24 @@ async function deliverGoogleChatReply(params) {
|
|
|
664
664
|
}
|
|
665
665
|
}
|
|
666
666
|
//#endregion
|
|
667
|
+
//#region extensions/googlechat/src/monitor-reply-target.ts
|
|
668
|
+
/**
|
|
669
|
+
* Google Chat only accepts a thread resource (`spaces/x/threads/y`) as a reply
|
|
670
|
+
* target. The automatic reply pipeline supplies the inbound *message* resource
|
|
671
|
+
* (`spaces/x/messages/y`) instead, which delivery would read as an intentional
|
|
672
|
+
* retarget and use to discard the typing placeholder. Reconcile that exact
|
|
673
|
+
* source-message target to the effective reply-mode target before delivery,
|
|
674
|
+
* leaving other targets untouched so explicit retargeting still works.
|
|
675
|
+
*/
|
|
676
|
+
function normalizeGoogleChatReplyTarget(params) {
|
|
677
|
+
const sourceMessageName = params.sourceMessageName;
|
|
678
|
+
if (!sourceMessageName || params.payload.replyToId !== sourceMessageName) return params.payload;
|
|
679
|
+
return {
|
|
680
|
+
...params.payload,
|
|
681
|
+
replyToId: params.replyThreadName
|
|
682
|
+
};
|
|
683
|
+
}
|
|
684
|
+
//#endregion
|
|
667
685
|
//#region extensions/googlechat/src/monitor-webhook.ts
|
|
668
686
|
function extractBearerToken(header) {
|
|
669
687
|
const authHeader = Array.isArray(header) ? typeof header[0] === "string" ? header[0] : "" : typeof header === "string" ? header : "";
|
|
@@ -673,21 +691,6 @@ const ADD_ON_PREAUTH_MAX_BYTES = 16384;
|
|
|
673
691
|
const ADD_ON_PREAUTH_TIMEOUT_MS = 3e3;
|
|
674
692
|
const GOOGLECHAT_WEBHOOK_ACCEPTED_HEADER = "x-openclaw-delivery-accepted";
|
|
675
693
|
const GOOGLECHAT_WEBHOOK_ACCEPTED_VALUE = "durable";
|
|
676
|
-
function parseGoogleChatInboundPayloadOrReject(raw, res) {
|
|
677
|
-
if (!isRecord$1(raw)) {
|
|
678
|
-
res.statusCode = 400;
|
|
679
|
-
res.end("invalid payload");
|
|
680
|
-
return null;
|
|
681
|
-
}
|
|
682
|
-
const commonEventObject = isRecord$1(raw.commonEventObject) ? raw.commonEventObject : null;
|
|
683
|
-
const authorizationEventObject = isRecord$1(raw.authorizationEventObject) ? raw.authorizationEventObject : null;
|
|
684
|
-
let addOnBearerToken = "";
|
|
685
|
-
if (commonEventObject?.hostApp === "CHAT" && typeof authorizationEventObject?.systemIdToken === "string") addOnBearerToken = authorizationEventObject.systemIdToken.trim();
|
|
686
|
-
return {
|
|
687
|
-
raw,
|
|
688
|
-
addOnBearerToken
|
|
689
|
-
};
|
|
690
|
-
}
|
|
691
694
|
function logGoogleChatWebhookAuthRejections(rejections) {
|
|
692
695
|
for (const rejection of rejections) rejection.target.runtime.log?.(`[${rejection.target.account.accountId}] Google Chat webhook auth rejected: ${rejection.reason}`);
|
|
693
696
|
}
|
|
@@ -740,23 +743,7 @@ function createGoogleChatWebhookRequestHandler(params) {
|
|
|
740
743
|
inFlightLimiter: params.webhookInFlightLimiter,
|
|
741
744
|
handle: async ({ targets }) => {
|
|
742
745
|
const headerBearer = extractBearerToken(req.headers.authorization);
|
|
743
|
-
let selectedTarget;
|
|
744
|
-
let parsedInbound;
|
|
745
|
-
const readAndParseEvent = async (profile) => {
|
|
746
|
-
const body = await readJsonWebhookBodyOrReject({
|
|
747
|
-
req,
|
|
748
|
-
res,
|
|
749
|
-
profile,
|
|
750
|
-
...profile === "pre-auth" ? {
|
|
751
|
-
maxBytes: ADD_ON_PREAUTH_MAX_BYTES,
|
|
752
|
-
timeoutMs: ADD_ON_PREAUTH_TIMEOUT_MS
|
|
753
|
-
} : {},
|
|
754
|
-
emptyObjectOnEmpty: false,
|
|
755
|
-
invalidJsonMessage: "invalid payload"
|
|
756
|
-
});
|
|
757
|
-
if (!body.ok) return null;
|
|
758
|
-
return parseGoogleChatInboundPayloadOrReject(body.value, res);
|
|
759
|
-
};
|
|
746
|
+
let selectedTarget = null;
|
|
760
747
|
if (headerBearer) {
|
|
761
748
|
selectedTarget = await resolveGoogleChatWebhookTargetWithAuthOrReject({
|
|
762
749
|
targets,
|
|
@@ -764,14 +751,28 @@ function createGoogleChatWebhookRequestHandler(params) {
|
|
|
764
751
|
bearer: headerBearer
|
|
765
752
|
});
|
|
766
753
|
if (!selectedTarget) return true;
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
754
|
+
}
|
|
755
|
+
const body = await readJsonWebhookBodyOrReject({
|
|
756
|
+
req,
|
|
757
|
+
res,
|
|
758
|
+
profile: headerBearer ? "post-auth" : "pre-auth",
|
|
759
|
+
...!headerBearer ? {
|
|
760
|
+
maxBytes: ADD_ON_PREAUTH_MAX_BYTES,
|
|
761
|
+
timeoutMs: ADD_ON_PREAUTH_TIMEOUT_MS
|
|
762
|
+
} : {},
|
|
763
|
+
emptyObjectOnEmpty: false,
|
|
764
|
+
invalidJsonMessage: "invalid payload"
|
|
765
|
+
});
|
|
766
|
+
if (!body.ok) return true;
|
|
767
|
+
const raw = body.value;
|
|
768
|
+
if (!isRecord$1(raw)) {
|
|
769
|
+
res.statusCode = 400;
|
|
770
|
+
res.end("invalid payload");
|
|
771
|
+
return true;
|
|
772
|
+
}
|
|
773
|
+
if (!headerBearer) {
|
|
774
|
+
const addOnBearerToken = isRecord$1(raw.commonEventObject) && raw.commonEventObject.hostApp === "CHAT" && isRecord$1(raw.authorizationEventObject) && typeof raw.authorizationEventObject.systemIdToken === "string" ? raw.authorizationEventObject.systemIdToken.trim() : "";
|
|
775
|
+
if (!addOnBearerToken) {
|
|
775
776
|
logGoogleChatWebhookAuthRejections(targets.map((target) => ({
|
|
776
777
|
target,
|
|
777
778
|
reason: "missing token"
|
|
@@ -783,14 +784,14 @@ function createGoogleChatWebhookRequestHandler(params) {
|
|
|
783
784
|
selectedTarget = await resolveGoogleChatWebhookTargetWithAuthOrReject({
|
|
784
785
|
targets,
|
|
785
786
|
res,
|
|
786
|
-
bearer:
|
|
787
|
+
bearer: addOnBearerToken
|
|
787
788
|
});
|
|
788
|
-
if (!selectedTarget) return true;
|
|
789
789
|
}
|
|
790
|
+
if (!selectedTarget) return true;
|
|
790
791
|
const dispatchTarget = selectedTarget;
|
|
791
792
|
dispatchTarget.statusSink?.({ lastInboundAt: Date.now() });
|
|
792
793
|
try {
|
|
793
|
-
const admission = await dispatchTarget.ingress.receive(
|
|
794
|
+
const admission = await dispatchTarget.ingress.receive(raw);
|
|
794
795
|
if (admission.kind === "invalid") {
|
|
795
796
|
res.statusCode = 400;
|
|
796
797
|
res.end("invalid payload");
|
|
@@ -799,7 +800,7 @@ function createGoogleChatWebhookRequestHandler(params) {
|
|
|
799
800
|
if (admission.kind === "ignored") {
|
|
800
801
|
let event;
|
|
801
802
|
try {
|
|
802
|
-
event = parseGoogleChatInboundPayload(
|
|
803
|
+
event = parseGoogleChatInboundPayload(raw);
|
|
803
804
|
} catch {
|
|
804
805
|
res.statusCode = 400;
|
|
805
806
|
res.end("invalid payload");
|
|
@@ -827,11 +828,7 @@ function createGoogleChatWebhookRequestHandler(params) {
|
|
|
827
828
|
//#endregion
|
|
828
829
|
//#region extensions/googlechat/src/monitor-routing.ts
|
|
829
830
|
const webhookTargets = /* @__PURE__ */ new Map();
|
|
830
|
-
const webhookRateLimiter = createFixedWindowRateLimiter(
|
|
831
|
-
windowMs: WEBHOOK_RATE_LIMIT_DEFAULTS.windowMs,
|
|
832
|
-
maxRequests: WEBHOOK_RATE_LIMIT_DEFAULTS.maxRequests,
|
|
833
|
-
maxTrackedKeys: WEBHOOK_RATE_LIMIT_DEFAULTS.maxTrackedKeys
|
|
834
|
-
});
|
|
831
|
+
const webhookRateLimiter = createFixedWindowRateLimiter(WEBHOOK_RATE_LIMIT_DEFAULTS);
|
|
835
832
|
const webhookInFlightLimiter = createWebhookInFlightLimiter();
|
|
836
833
|
let processGoogleChatEvent$1 = async () => {};
|
|
837
834
|
function setGoogleChatWebhookEventProcessor(processEvent) {
|
|
@@ -873,11 +870,6 @@ setGoogleChatWebhookEventProcessor(processGoogleChatEvent);
|
|
|
873
870
|
function logVerbose(core, runtime, message) {
|
|
874
871
|
if (core.logging.shouldLogVerbose()) runtime.log?.(`[googlechat] ${message}`);
|
|
875
872
|
}
|
|
876
|
-
function normalizeAudienceType(value) {
|
|
877
|
-
const normalized = normalizeOptionalLowercaseString(value);
|
|
878
|
-
if (normalized === "app-url" || normalized === "app_url" || normalized === "app") return "app-url";
|
|
879
|
-
if (normalized === "project-number" || normalized === "project_number" || normalized === "project") return "project-number";
|
|
880
|
-
}
|
|
881
873
|
function resolveBotDisplayName(params) {
|
|
882
874
|
const { accountName, agentId, config } = params;
|
|
883
875
|
if (accountName?.trim()) return accountName.trim();
|
|
@@ -1066,7 +1058,7 @@ async function processGoogleChatEvent(event, target, turnAdoptionLifecycle, conf
|
|
|
1066
1058
|
typingIndicator = "message";
|
|
1067
1059
|
}
|
|
1068
1060
|
let typingMessage;
|
|
1069
|
-
const
|
|
1061
|
+
const effectiveReplyThreadName = account.config.replyToMode && account.config.replyToMode !== "off" ? replyThreadName : void 0;
|
|
1070
1062
|
if (typingIndicator === "message") try {
|
|
1071
1063
|
const botName = resolveBotDisplayName({
|
|
1072
1064
|
accountName: account.config.name,
|
|
@@ -1077,11 +1069,11 @@ async function processGoogleChatEvent(event, target, turnAdoptionLifecycle, conf
|
|
|
1077
1069
|
account,
|
|
1078
1070
|
space: spaceId,
|
|
1079
1071
|
text: `_${botName} is typing..._`,
|
|
1080
|
-
thread:
|
|
1072
|
+
thread: effectiveReplyThreadName
|
|
1081
1073
|
});
|
|
1082
1074
|
if (result?.messageName) typingMessage = createGoogleChatTypingMessage({
|
|
1083
1075
|
messageName: result.messageName,
|
|
1084
|
-
requestedThreadName:
|
|
1076
|
+
requestedThreadName: effectiveReplyThreadName,
|
|
1085
1077
|
deliveredThreadName: result.threadName
|
|
1086
1078
|
});
|
|
1087
1079
|
} catch (err) {
|
|
@@ -1112,14 +1104,22 @@ async function processGoogleChatEvent(event, target, turnAdoptionLifecycle, conf
|
|
|
1112
1104
|
ctxPayload,
|
|
1113
1105
|
delivery: {
|
|
1114
1106
|
durable: (payload, info) => resolveGoogleChatDurableReplyOptions({
|
|
1115
|
-
payload
|
|
1107
|
+
payload: normalizeGoogleChatReplyTarget({
|
|
1108
|
+
payload,
|
|
1109
|
+
sourceMessageName: message.name,
|
|
1110
|
+
replyThreadName: effectiveReplyThreadName
|
|
1111
|
+
}),
|
|
1116
1112
|
infoKind: info.kind,
|
|
1117
1113
|
spaceId,
|
|
1118
1114
|
hasTypingMessage: Boolean(typingMessage)
|
|
1119
1115
|
}),
|
|
1120
1116
|
deliver: async (payload) => {
|
|
1121
1117
|
await deliverGoogleChatReply({
|
|
1122
|
-
payload
|
|
1118
|
+
payload: normalizeGoogleChatReplyTarget({
|
|
1119
|
+
payload,
|
|
1120
|
+
sourceMessageName: message.name,
|
|
1121
|
+
replyThreadName: effectiveReplyThreadName
|
|
1122
|
+
}),
|
|
1123
1123
|
account,
|
|
1124
1124
|
spaceId,
|
|
1125
1125
|
runtime,
|
|
@@ -1167,9 +1167,9 @@ async function startGoogleChatMonitor(options) {
|
|
|
1167
1167
|
options.runtime.error?.(`[${options.account.accountId}] invalid webhook path`);
|
|
1168
1168
|
return async () => {};
|
|
1169
1169
|
}
|
|
1170
|
-
const audienceType =
|
|
1170
|
+
const audienceType = options.account.config.audienceType;
|
|
1171
1171
|
const audience = options.account.config.audience?.trim();
|
|
1172
|
-
if (
|
|
1172
|
+
if (audienceType !== "app-url" && audienceType !== "project-number" || !audience) {
|
|
1173
1173
|
const error = "Google Chat webhook authentication requires channels.googlechat.audienceType and channels.googlechat.audience.";
|
|
1174
1174
|
options.runtime.error?.(`[${options.account.accountId}] ${error}`);
|
|
1175
1175
|
options.statusSink?.(channelBlockedPatch(error, {
|
|
@@ -124,6 +124,12 @@ function createLegacyWebhookListenerDoctorContract(params) {
|
|
|
124
124
|
};
|
|
125
125
|
const prefix = `channels.${params.channelKey}`;
|
|
126
126
|
return {
|
|
127
|
+
historicalWebhookListener: {
|
|
128
|
+
channelId: params.channelKey,
|
|
129
|
+
port: params.defaultPort,
|
|
130
|
+
preserveAuthoredActivation: params.preserveAuthoredActivation,
|
|
131
|
+
...params.defaultHost === void 0 ? {} : { host: params.defaultHost }
|
|
132
|
+
},
|
|
127
133
|
legacyConfigRules: [{
|
|
128
134
|
path: ["channels", params.channelKey],
|
|
129
135
|
message: `${prefix} webhook listeners moved to Gateway routes. Run "openclaw doctor --fix" to preserve explicitly configured listener settings as legacyWebhook.`,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
2
2
|
import { coerceSecretRef } from "openclaw/plugin-sdk/secret-input";
|
|
3
|
-
import {
|
|
3
|
+
import { createChannelSecretContract, hasOwnProperty, pushAssignment, pushInactiveSurfaceWarning } from "openclaw/plugin-sdk/channel-secret-basic-runtime";
|
|
4
4
|
//#region extensions/googlechat/src/secret-contract.ts
|
|
5
5
|
function accountSecretOwner(accountId) {
|
|
6
6
|
return {
|
|
@@ -10,22 +10,6 @@ function accountSecretOwner(accountId) {
|
|
|
10
10
|
disposition: "isolate"
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
|
-
const secretTargetRegistryEntries = createChannelSecretTargetRegistryEntries({
|
|
14
|
-
channelKey: "googlechat",
|
|
15
|
-
account: [{
|
|
16
|
-
path: "serviceAccount",
|
|
17
|
-
targetType: "channels.googlechat.serviceAccount",
|
|
18
|
-
targetTypeAliases: ["channels.googlechat.accounts.*.serviceAccount"],
|
|
19
|
-
secretShape: "secret_input",
|
|
20
|
-
expectedResolvedValue: "string-or-object",
|
|
21
|
-
accountIdPathSegmentIndex: 3
|
|
22
|
-
}],
|
|
23
|
-
channel: [{
|
|
24
|
-
path: "serviceAccount",
|
|
25
|
-
secretShape: "secret_input",
|
|
26
|
-
expectedResolvedValue: "string-or-object"
|
|
27
|
-
}]
|
|
28
|
-
});
|
|
29
13
|
function collectGoogleChatAccountAssignment(params) {
|
|
30
14
|
const ref = coerceSecretRef(params.target.serviceAccount, params.defaults);
|
|
31
15
|
if (!ref) return;
|
|
@@ -47,35 +31,46 @@ function collectGoogleChatAccountAssignment(params) {
|
|
|
47
31
|
}
|
|
48
32
|
});
|
|
49
33
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
34
|
+
const channelSecrets = createChannelSecretContract({
|
|
35
|
+
channelKey: "googlechat",
|
|
36
|
+
account: [{
|
|
37
|
+
path: "serviceAccount",
|
|
38
|
+
targetType: "channels.googlechat.serviceAccount",
|
|
39
|
+
targetTypeAliases: ["channels.googlechat.accounts.*.serviceAccount"],
|
|
40
|
+
secretShape: "secret_input",
|
|
41
|
+
expectedResolvedValue: "string-or-object",
|
|
42
|
+
accountIdPathSegmentIndex: 3
|
|
43
|
+
}],
|
|
44
|
+
channel: [{
|
|
45
|
+
path: "serviceAccount",
|
|
46
|
+
secretShape: "secret_input",
|
|
47
|
+
expectedResolvedValue: "string-or-object"
|
|
48
|
+
}],
|
|
49
|
+
collect(params) {
|
|
50
|
+
const { channel: googleChat, surface } = params;
|
|
51
|
+
const topLevelServiceAccountOwners = !surface.channelEnabled ? [] : !surface.hasExplicitAccounts ? ["default"] : surface.accounts.filter(({ account, enabled }) => enabled && !hasOwnProperty(account, "serviceAccount")).map(({ accountId }) => accountId);
|
|
66
52
|
collectGoogleChatAccountAssignment({
|
|
67
|
-
target:
|
|
68
|
-
path:
|
|
53
|
+
target: googleChat,
|
|
54
|
+
path: "channels.googlechat",
|
|
69
55
|
defaults: params.defaults,
|
|
70
56
|
context: params.context,
|
|
71
|
-
ownerAccountIds:
|
|
72
|
-
inactiveReason: "
|
|
57
|
+
ownerAccountIds: topLevelServiceAccountOwners,
|
|
58
|
+
inactiveReason: "no enabled account inherits this top-level Google Chat serviceAccount."
|
|
73
59
|
});
|
|
60
|
+
if (!surface.hasExplicitAccounts) return;
|
|
61
|
+
for (const { accountId, account, enabled } of surface.accounts) {
|
|
62
|
+
if (!hasOwnProperty(account, "serviceAccount")) continue;
|
|
63
|
+
collectGoogleChatAccountAssignment({
|
|
64
|
+
target: account,
|
|
65
|
+
path: `channels.googlechat.accounts.${accountId}`,
|
|
66
|
+
defaults: params.defaults,
|
|
67
|
+
context: params.context,
|
|
68
|
+
ownerAccountIds: enabled ? [accountId] : [],
|
|
69
|
+
inactiveReason: "Google Chat account is disabled."
|
|
70
|
+
});
|
|
71
|
+
}
|
|
74
72
|
}
|
|
75
|
-
}
|
|
76
|
-
const
|
|
77
|
-
secretTargetRegistryEntries,
|
|
78
|
-
collectRuntimeConfigAssignments
|
|
79
|
-
};
|
|
73
|
+
});
|
|
74
|
+
const { secretTargetRegistryEntries, collectRuntimeConfigAssignments } = channelSecrets;
|
|
80
75
|
//#endregion
|
|
81
76
|
export { collectRuntimeConfigAssignments as n, secretTargetRegistryEntries as r, channelSecrets as t };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries, t as channelSecrets } from "./secret-contract-
|
|
1
|
+
import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries, t as channelSecrets } from "./secret-contract-020OItNt.mjs";
|
|
2
2
|
import "../secret-contract-api.js";
|
|
3
3
|
export { channelSecrets, collectRuntimeConfigAssignments, secretTargetRegistryEntries };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as createGoogleChatPluginBase } from "./channel-base-
|
|
1
|
+
import { n as createGoogleChatPluginBase } from "./channel-base-BdCGLoFe.mjs";
|
|
2
2
|
//#region extensions/googlechat/src/channel.setup.ts
|
|
3
3
|
const googlechatSetupPlugin = createGoogleChatPluginBase();
|
|
4
4
|
//#endregion
|
package/dist/api.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as googlechatSetupAdapter, i as googlechatSetupWizard } from "./.setup/channel-base-
|
|
2
|
-
import { t as googlechatPlugin } from "./.setup/channel-
|
|
1
|
+
import { a as googlechatSetupAdapter, i as googlechatSetupWizard } from "./.setup/channel-base-BdCGLoFe.mjs";
|
|
2
|
+
import { t as googlechatPlugin } from "./.setup/channel-CRIyIoxn.mjs";
|
|
3
3
|
export { googlechatPlugin, googlechatSetupAdapter, googlechatSetupWizard };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as googlechatPlugin } from "./.setup/channel-
|
|
1
|
+
import { t as googlechatPlugin } from "./.setup/channel-CRIyIoxn.mjs";
|
|
2
2
|
export { googlechatPlugin };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as googlechatDirectoryAdapter } from "./.setup/channel.adapters-
|
|
1
|
+
import { t as googlechatDirectoryAdapter } from "./.setup/channel.adapters-CcYyfMMC.mjs";
|
|
2
2
|
//#region extensions/googlechat/directory-contract-api.ts
|
|
3
3
|
const googlechatDirectoryContractPlugin = {
|
|
4
4
|
id: "googlechat",
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./.setup/doctor-contract-
|
|
1
|
+
import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./.setup/doctor-contract-BzoaiFSD.mjs";
|
|
2
2
|
export { legacyConfigRules, normalizeCompatibilityConfig };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries, t as channelSecrets } from "./.setup/secret-contract-
|
|
1
|
+
import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries, t as channelSecrets } from "./.setup/secret-contract-020OItNt.mjs";
|
|
2
2
|
export { channelSecrets, collectRuntimeConfigAssignments, secretTargetRegistryEntries };
|
package/dist/setup-entry.js
CHANGED
|
@@ -4,11 +4,11 @@ import { fileURLToPath } from "node:url";
|
|
|
4
4
|
var setup_entry_default = defineBundledChannelSetupEntry({
|
|
5
5
|
importMetaUrl: import.meta.url,
|
|
6
6
|
plugin: {
|
|
7
|
-
specifier: fileURLToPath(new URL(".setup/setup-plugin-api-
|
|
7
|
+
specifier: fileURLToPath(new URL(".setup/setup-plugin-api-KFtk0y_E.mjs", import.meta.url).href),
|
|
8
8
|
exportName: "googlechatSetupPlugin"
|
|
9
9
|
},
|
|
10
10
|
secrets: {
|
|
11
|
-
specifier: fileURLToPath(new URL(".setup/secret-contract-api-
|
|
11
|
+
specifier: fileURLToPath(new URL(".setup/secret-contract-api-DvHE657z.mjs", import.meta.url).href),
|
|
12
12
|
exportName: "channelSecrets"
|
|
13
13
|
}
|
|
14
14
|
});
|
package/dist/setup-plugin-api.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as googlechatSetupPlugin } from "./.setup/setup-plugin-api-
|
|
1
|
+
import { t as googlechatSetupPlugin } from "./.setup/setup-plugin-api-5p-SthtR.mjs";
|
|
2
2
|
export { googlechatSetupPlugin };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/googlechat",
|
|
3
|
-
"version": "2026.
|
|
3
|
+
"version": "2026.10.1-beta.1",
|
|
4
4
|
"description": "OpenClaw Google Chat channel plugin for spaces and direct messages.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"zod": "4.6.5"
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
15
|
-
"openclaw": ">=2026.
|
|
15
|
+
"openclaw": ">=2026.10.1-beta.1"
|
|
16
16
|
},
|
|
17
17
|
"peerDependenciesMeta": {
|
|
18
18
|
"openclaw": {
|
|
@@ -132,13 +132,13 @@
|
|
|
132
132
|
"clawhubSpec": "clawhub:@openclaw/googlechat",
|
|
133
133
|
"npmSpec": "@openclaw/googlechat",
|
|
134
134
|
"defaultChoice": "npm",
|
|
135
|
-
"minHostVersion": ">=2026.
|
|
135
|
+
"minHostVersion": ">=2026.9.8"
|
|
136
136
|
},
|
|
137
137
|
"compat": {
|
|
138
|
-
"pluginApi": ">=2026.
|
|
138
|
+
"pluginApi": ">=2026.10.1-beta.1"
|
|
139
139
|
},
|
|
140
140
|
"build": {
|
|
141
|
-
"openclawVersion": "2026.
|
|
141
|
+
"openclawVersion": "2026.10.1-beta.1"
|
|
142
142
|
},
|
|
143
143
|
"release": {
|
|
144
144
|
"publishToClawHub": true,
|