@openclaw/googlechat 2026.9.6 → 2026.9.8

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.
Files changed (35) hide show
  1. package/assets/icon.png +0 -0
  2. package/dist/.setup/actions-K6_7xusH.mjs +56 -0
  3. package/dist/.setup/{approval-auth-C6NmZR0i.mjs → approval-auth-DXvh9tfx.mjs} +2 -2
  4. package/dist/.setup/approval-card-text-BKg_4mXq.mjs +12 -0
  5. package/dist/.setup/{approval-handler.runtime-DPTrNUbd.mjs → approval-handler.runtime-CT2MVoa-.mjs} +42 -81
  6. package/dist/.setup/{channel-E2g6ySbf.mjs → channel-DAUmcC2J.mjs} +34 -82
  7. package/dist/.setup/{channel-base-B3EzcV7X.mjs → channel-base-inLf3HGV.mjs} +15 -36
  8. package/dist/.setup/{channel.adapters-CSAwKSvQ.mjs → channel.adapters-DIQot11j.mjs} +85 -172
  9. package/dist/.setup/{channel.runtime-BdzxoqvE.mjs → channel.runtime-C-B60lWL.mjs} +84 -161
  10. package/dist/.setup/doctor-contract-wLrnvLUn.mjs +294 -0
  11. package/dist/.setup/runtime-C5OOOlaP.mjs +8 -0
  12. package/dist/.setup/{secret-contract-DmWM0kwM.mjs → secret-contract-B7H-kkqq.mjs} +4 -11
  13. package/dist/.setup/{secret-contract-api-DHLd5XO3.mjs → secret-contract-api-GavLI-0W.mjs} +1 -1
  14. package/dist/.setup/{setup-plugin-api-C0zTOlHy.mjs → setup-plugin-api-CAzvWHwN.mjs} +1 -1
  15. package/dist/.setup/{setup-plugin-api-DWL3ZytB.mjs → setup-plugin-api-DPYc1usm.mjs} +1 -1
  16. package/dist/api.js +2 -2
  17. package/dist/channel-plugin-api.js +1 -1
  18. package/dist/directory-contract-api.js +1 -1
  19. package/dist/doctor-contract-api.js +1 -1
  20. package/dist/runtime-api.js +2 -3
  21. package/dist/secret-contract-api.js +1 -1
  22. package/dist/setup-entry.js +2 -2
  23. package/dist/setup-plugin-api.js +1 -1
  24. package/node_modules/google-auth-library/node_modules/gcp-metadata/build/src/gcp-residency.d.ts +13 -4
  25. package/node_modules/google-auth-library/node_modules/gcp-metadata/build/src/gcp-residency.js +24 -19
  26. package/node_modules/google-auth-library/node_modules/gcp-metadata/build/src/gcp-residency.js.map +1 -1
  27. package/node_modules/google-auth-library/node_modules/gcp-metadata/build/src/index.js +65 -37
  28. package/node_modules/google-auth-library/node_modules/gcp-metadata/build/src/index.js.map +1 -1
  29. package/node_modules/google-auth-library/node_modules/gcp-metadata/package.json +1 -1
  30. package/node_modules/google-auth-library/package.json +6 -6
  31. package/package.json +5 -5
  32. package/dist/.setup/actions-BM-Gd-H7.mjs +0 -72
  33. package/dist/.setup/approval-card-text-ChngxXdJ.mjs +0 -6
  34. package/dist/.setup/doctor-contract-BLvSmTXT.mjs +0 -115
  35. package/dist/.setup/runtime-api-Cc5ZuXih.mjs +0 -24
@@ -0,0 +1,294 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __exportAll = (all, no_symbols) => {
7
+ let target = {};
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
13
+ return target;
14
+ };
15
+ var __copyProps = (to, from, except, desc) => {
16
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
17
+ key = keys[i];
18
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
19
+ get: ((k) => from[k]).bind(null, key),
20
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
21
+ });
22
+ }
23
+ return to;
24
+ };
25
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
26
+ //#endregion
27
+ //#region packages/normalization-core/src/record-coerce.ts
28
+ /** Type guard for non-array object records at browser-safe boundaries. */
29
+ function isRecord(value) {
30
+ return value !== null && typeof value === "object" && !Array.isArray(value);
31
+ }
32
+ /** Returns a non-array record or null. */
33
+ function asNullableRecord(value) {
34
+ return isRecord(value) ? value : null;
35
+ }
36
+ //#endregion
37
+ //#region src/config/channel-config-normalization.ts
38
+ /** Applies one channel-specific doctor migration to every object-shaped account. */
39
+ function normalizeChannelAccounts(params) {
40
+ const rawAccounts = asNullableRecord(params.entry.accounts);
41
+ if (!rawAccounts) return {
42
+ entry: params.entry,
43
+ changed: false
44
+ };
45
+ let changed = false;
46
+ const accounts = { ...rawAccounts };
47
+ for (const [accountId, value] of Object.entries(rawAccounts)) {
48
+ const account = asNullableRecord(value);
49
+ if (!account) continue;
50
+ const normalized = params.normalizeAccount({
51
+ account,
52
+ accountId,
53
+ pathPrefix: `${params.pathPrefix}.accounts.${accountId}`,
54
+ changes: params.changes
55
+ });
56
+ if (normalized.changed) {
57
+ accounts[accountId] = normalized.entry;
58
+ changed = true;
59
+ }
60
+ }
61
+ return changed ? {
62
+ entry: {
63
+ ...params.entry,
64
+ accounts
65
+ },
66
+ changed: true
67
+ } : {
68
+ entry: params.entry,
69
+ changed: false
70
+ };
71
+ }
72
+ /** Applies the same channel-specific doctor migration at root and account scope. */
73
+ function normalizeChannelConfigEntries$1(params) {
74
+ const changes = params.changes ?? [];
75
+ const channels = params.cfg.channels;
76
+ const entry = asNullableRecord(channels?.[params.channelId]);
77
+ if (!entry) return {
78
+ config: params.cfg,
79
+ changes
80
+ };
81
+ const channelPath = `channels.${params.channelId}`;
82
+ const root = params.normalizeEntry({
83
+ entry,
84
+ pathPrefix: channelPath,
85
+ changes
86
+ });
87
+ const accounts = normalizeChannelAccounts({
88
+ entry: root.entry,
89
+ pathPrefix: channelPath,
90
+ changes,
91
+ normalizeAccount: (accountParams) => params.normalizeEntry({
92
+ entry: accountParams.account,
93
+ accountId: accountParams.accountId,
94
+ pathPrefix: accountParams.pathPrefix,
95
+ changes: accountParams.changes
96
+ })
97
+ });
98
+ if (!root.changed && !accounts.changed) return {
99
+ config: params.cfg,
100
+ changes
101
+ };
102
+ return {
103
+ config: {
104
+ ...params.cfg,
105
+ channels: {
106
+ ...channels,
107
+ [params.channelId]: accounts.entry
108
+ }
109
+ },
110
+ changes
111
+ };
112
+ }
113
+ //#endregion
114
+ //#region src/plugin-sdk/legacy-webhook-listener-migration.ts
115
+ /** Preserve explicitly configured webhook listeners while moving ingress onto Gateway routes. */
116
+ function createLegacyWebhookListenerDoctorContract(params) {
117
+ const portKey = params.portKey ?? "webhookPort";
118
+ const hostKey = params.hostKey === void 0 ? "webhookHost" : params.hostKey;
119
+ const source = (entry) => params.webhookKey ? asNullableRecord(entry[params.webhookKey]) : entry;
120
+ const hasLegacy = (value) => {
121
+ const entry = asNullableRecord(value);
122
+ const listener = entry && source(entry);
123
+ return Boolean(listener && (Object.hasOwn(listener, portKey) || hostKey && Object.hasOwn(listener, hostKey)));
124
+ };
125
+ const prefix = `channels.${params.channelKey}`;
126
+ return {
127
+ legacyConfigRules: [{
128
+ path: ["channels", params.channelKey],
129
+ message: `${prefix} webhook listeners moved to Gateway routes. Run "openclaw doctor --fix" to preserve explicitly configured listener settings as legacyWebhook.`,
130
+ match: (value) => {
131
+ const accounts = asNullableRecord(asNullableRecord(value)?.accounts);
132
+ return hasLegacy(value) || Object.values(accounts ?? {}).some(hasLegacy);
133
+ }
134
+ }],
135
+ normalizeCompatibilityConfig: ({ cfg }) => {
136
+ const root = asNullableRecord(asNullableRecord(cfg.channels)?.[params.channelKey]);
137
+ const inherited = root && source(root);
138
+ const canonicalRoot = asNullableRecord(root?.legacyWebhook);
139
+ return normalizeChannelConfigEntries$1({
140
+ cfg,
141
+ channelId: params.channelKey,
142
+ normalizeEntry: ({ entry, accountId, pathPrefix, changes }) => {
143
+ const listener = source(entry);
144
+ if (!listener || !hasLegacy(entry)) return {
145
+ entry,
146
+ changed: false
147
+ };
148
+ const next = { ...entry };
149
+ const port = Object.hasOwn(listener, portKey) ? listener[portKey] : (accountId ? canonicalRoot?.port ?? inherited?.[portKey] : void 0) ?? params.defaultPort;
150
+ const inheritedHost = accountId ? canonicalRoot ? canonicalRoot.host : (hostKey ? inherited?.[hostKey] : void 0) ?? params.defaultHost : params.defaultHost;
151
+ const host = hostKey ? listener[hostKey] ?? inheritedHost : inheritedHost;
152
+ const legacyPath = [pathPrefix, params.webhookKey].filter(Boolean).join(".");
153
+ if (Object.hasOwn(entry, "legacyWebhook")) changes.push(`Removed ${legacyPath} legacy listener keys; ${pathPrefix}.legacyWebhook is already configured.`);
154
+ else if (accountId && root?.legacyWebhook === false) changes.push(`Removed ${legacyPath} legacy listener keys; ${prefix}.legacyWebhook: false keeps this account's inherited listener disabled.`);
155
+ else {
156
+ next.legacyWebhook = {
157
+ port,
158
+ ...host !== void 0 ? { host } : {}
159
+ };
160
+ changes.push(`Moved ${legacyPath} listener settings to ${pathPrefix}.legacyWebhook. Point the external callback or reverse proxy at the Gateway port and webhook path, verify delivery, then set legacyWebhook: false to disable legacy forwarding.`);
161
+ }
162
+ const updated = params.webhookKey ? { ...listener } : next;
163
+ delete updated[portKey];
164
+ if (hostKey) delete updated[hostKey];
165
+ if (params.webhookKey) {
166
+ if (Object.keys(updated).length) next[params.webhookKey] = updated;
167
+ else delete next[params.webhookKey];
168
+ }
169
+ return {
170
+ entry: next,
171
+ changed: true
172
+ };
173
+ }
174
+ });
175
+ }
176
+ };
177
+ }
178
+ //#endregion
179
+ //#region \0openclaw:bundled-sdk:openclaw/plugin-sdk/runtime-doctor-migrations
180
+ var runtime_doctor_migrations_exports = /* @__PURE__ */ __exportAll({ createLegacyWebhookListenerDoctorContract: () => createLegacyWebhookListenerDoctorContract });
181
+ import * as import_openclaw_plugin_sdk_runtime_doctor_migrations from "openclaw/plugin-sdk/runtime-doctor-migrations";
182
+ __reExport(runtime_doctor_migrations_exports, import_openclaw_plugin_sdk_runtime_doctor_migrations);
183
+ //#endregion
184
+ //#region extensions/googlechat/src/doctor-contract.ts
185
+ const streamingAliasMigration = (0, runtime_doctor_migrations_exports.defineChannelAliasMigration)({
186
+ channelId: "googlechat",
187
+ streaming: {
188
+ defaultMode: "partial",
189
+ deliveryOnly: true
190
+ },
191
+ accountStreamingInheritsDefaultAccount: true,
192
+ dm: {
193
+ root: true,
194
+ accounts: true
195
+ }
196
+ });
197
+ function hasLegacyGoogleChatStreamMode(value) {
198
+ return (0, runtime_doctor_migrations_exports.asObjectRecord)(value)?.streamMode !== void 0;
199
+ }
200
+ function hasRetiredReactions(value) {
201
+ return Object.hasOwn((0, runtime_doctor_migrations_exports.asObjectRecord)((0, runtime_doctor_migrations_exports.asObjectRecord)(value)?.actions) ?? {}, "reactions");
202
+ }
203
+ const groupAllowMigration = (0, runtime_doctor_migrations_exports.defineKeyMoveMigration)({
204
+ scope: ["groups", "*"],
205
+ from: ["allow"],
206
+ to: ["enabled"]
207
+ });
208
+ function normalizeGoogleChatEntry(params) {
209
+ let updated = params.entry;
210
+ let changed = false;
211
+ if (updated.streamMode !== void 0) {
212
+ updated = { ...updated };
213
+ delete updated.streamMode;
214
+ params.changes.push(`Removed ${params.pathPrefix}.streamMode (legacy key no longer used).`);
215
+ changed = true;
216
+ }
217
+ if (hasRetiredReactions(updated)) {
218
+ const actions = { ...(0, runtime_doctor_migrations_exports.asObjectRecord)(updated.actions) };
219
+ delete actions.reactions;
220
+ updated = { ...updated };
221
+ if (Object.keys(actions).length > 0) updated.actions = actions;
222
+ else delete updated.actions;
223
+ params.changes.push(`Removed ${params.pathPrefix}.actions.reactions (Google Chat does not support reactions).`);
224
+ changed = true;
225
+ }
226
+ const groups = groupAllowMigration.normalize({
227
+ ...params,
228
+ entry: updated
229
+ });
230
+ updated = groups.entry;
231
+ changed = changed || groups.changed;
232
+ return {
233
+ entry: updated,
234
+ changed
235
+ };
236
+ }
237
+ const legacyConfigRules = [
238
+ {
239
+ path: ["channels", "googlechat"],
240
+ message: "channels.googlechat.actions.reactions is retired and ignored. Run \"openclaw doctor --fix\".",
241
+ match: hasRetiredReactions
242
+ },
243
+ {
244
+ path: [
245
+ "channels",
246
+ "googlechat",
247
+ "accounts"
248
+ ],
249
+ message: "channels.googlechat.accounts.<id>.actions.reactions is retired and ignored. Run \"openclaw doctor --fix\".",
250
+ match: (value) => (0, runtime_doctor_migrations_exports.hasLegacyAccountStreamingAliases)(value, hasRetiredReactions)
251
+ },
252
+ {
253
+ path: ["channels", "googlechat"],
254
+ message: "channels.googlechat.streamMode is legacy and no longer used; it is removed on load.",
255
+ match: hasLegacyGoogleChatStreamMode
256
+ },
257
+ {
258
+ path: [
259
+ "channels",
260
+ "googlechat",
261
+ "accounts"
262
+ ],
263
+ message: "channels.googlechat.accounts.<id>.streamMode is legacy and no longer used; it is removed on load.",
264
+ match: (value) => (0, runtime_doctor_migrations_exports.hasLegacyAccountStreamingAliases)(value, hasLegacyGoogleChatStreamMode)
265
+ },
266
+ {
267
+ path: ["channels", "googlechat"],
268
+ message: "channels.googlechat.groups.<id>.allow is legacy; use channels.googlechat.groups.<id>.enabled instead. Run \"openclaw doctor --fix\".",
269
+ match: groupAllowMigration.hasLegacy
270
+ },
271
+ {
272
+ path: [
273
+ "channels",
274
+ "googlechat",
275
+ "accounts"
276
+ ],
277
+ message: "channels.googlechat.accounts.<id>.groups.<id>.allow is legacy; use channels.googlechat.accounts.<id>.groups.<id>.enabled instead. Run \"openclaw doctor --fix\".",
278
+ match: (value) => (0, runtime_doctor_migrations_exports.hasLegacyAccountStreamingAliases)(value, groupAllowMigration.hasLegacy)
279
+ },
280
+ ...streamingAliasMigration.legacyConfigRules
281
+ ];
282
+ function normalizeCompatibilityConfig({ cfg }) {
283
+ const retired = (0, runtime_doctor_migrations_exports.normalizeChannelConfigEntries)({
284
+ cfg,
285
+ channelId: "googlechat",
286
+ normalizeEntry: normalizeGoogleChatEntry
287
+ });
288
+ return streamingAliasMigration.normalizeChannelConfig({
289
+ cfg: retired.config,
290
+ changes: retired.changes
291
+ });
292
+ }
293
+ //#endregion
294
+ export { normalizeCompatibilityConfig as n, legacyConfigRules as t };
@@ -0,0 +1,8 @@
1
+ import { createPluginRuntimeStore } from "openclaw/plugin-sdk/runtime-store";
2
+ //#region extensions/googlechat/src/runtime.ts
3
+ const { setRuntime: setGoogleChatRuntime, getRuntime: getGoogleChatRuntime } = createPluginRuntimeStore({
4
+ pluginId: "googlechat",
5
+ errorMessage: "Google Chat runtime not initialized"
6
+ });
7
+ //#endregion
8
+ export { setGoogleChatRuntime as n, getGoogleChatRuntime as t };
@@ -1,6 +1,6 @@
1
- import { coerceSecretRef } from "openclaw/plugin-sdk/secret-input";
2
1
  import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
3
- import { createChannelSecretTargetRegistryEntries, getChannelSurface, hasOwnProperty, pushAssignment, pushInactiveSurfaceWarning, resolveChannelAccountSurface } from "openclaw/plugin-sdk/channel-secret-basic-runtime";
2
+ import { coerceSecretRef } from "openclaw/plugin-sdk/secret-input";
3
+ import { createChannelSecretTargetRegistryEntries, getChannelSurface, 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 {
@@ -26,14 +26,8 @@ const secretTargetRegistryEntries = createChannelSecretTargetRegistryEntries({
26
26
  expectedResolvedValue: "string-or-object"
27
27
  }]
28
28
  });
29
- function resolveSecretInputRef(params) {
30
- return coerceSecretRef(params.value, params.defaults);
31
- }
32
29
  function collectGoogleChatAccountAssignment(params) {
33
- const ref = resolveSecretInputRef({
34
- value: params.target.serviceAccount,
35
- defaults: params.defaults
36
- });
30
+ const ref = coerceSecretRef(params.target.serviceAccount, params.defaults);
37
31
  if (!ref) return;
38
32
  if (params.ownerAccountIds.length === 0) {
39
33
  pushInactiveSurfaceWarning({
@@ -56,8 +50,7 @@ function collectGoogleChatAccountAssignment(params) {
56
50
  function collectRuntimeConfigAssignments(params) {
57
51
  const resolved = getChannelSurface(params.config, "googlechat");
58
52
  if (!resolved) return;
59
- const googleChat = resolved.channel;
60
- const surface = resolveChannelAccountSurface(googleChat);
53
+ const { channel: googleChat, surface } = resolved;
61
54
  const topLevelServiceAccountOwners = !surface.channelEnabled ? [] : !surface.hasExplicitAccounts ? ["default"] : surface.accounts.filter(({ account, enabled }) => enabled && !hasOwnProperty(account, "serviceAccount")).map(({ accountId }) => accountId);
62
55
  collectGoogleChatAccountAssignment({
63
56
  target: googleChat,
@@ -1,3 +1,3 @@
1
- import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries, t as channelSecrets } from "./secret-contract-DmWM0kwM.mjs";
1
+ import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries, t as channelSecrets } from "./secret-contract-B7H-kkqq.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-B3EzcV7X.mjs";
1
+ import { n as createGoogleChatPluginBase } from "./channel-base-inLf3HGV.mjs";
2
2
  //#region extensions/googlechat/src/channel.setup.ts
3
3
  const googlechatSetupPlugin = createGoogleChatPluginBase();
4
4
  //#endregion
@@ -1,2 +1,2 @@
1
- import { t as googlechatSetupPlugin } from "./setup-plugin-api-C0zTOlHy.mjs";
1
+ import { t as googlechatSetupPlugin } from "./setup-plugin-api-CAzvWHwN.mjs";
2
2
  export { googlechatSetupPlugin };
package/dist/api.js CHANGED
@@ -1,3 +1,3 @@
1
- import { a as googlechatSetupAdapter, i as googlechatSetupWizard } from "./.setup/channel-base-B3EzcV7X.mjs";
2
- import { t as googlechatPlugin } from "./.setup/channel-E2g6ySbf.mjs";
1
+ import { a as googlechatSetupAdapter, i as googlechatSetupWizard } from "./.setup/channel-base-inLf3HGV.mjs";
2
+ import { t as googlechatPlugin } from "./.setup/channel-DAUmcC2J.mjs";
3
3
  export { googlechatPlugin, googlechatSetupAdapter, googlechatSetupWizard };
@@ -1,2 +1,2 @@
1
- import { t as googlechatPlugin } from "./.setup/channel-E2g6ySbf.mjs";
1
+ import { t as googlechatPlugin } from "./.setup/channel-DAUmcC2J.mjs";
2
2
  export { googlechatPlugin };
@@ -1,4 +1,4 @@
1
- import { t as googlechatDirectoryAdapter } from "./.setup/channel.adapters-CSAwKSvQ.mjs";
1
+ import { t as googlechatDirectoryAdapter } from "./.setup/channel.adapters-DIQot11j.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-BLvSmTXT.mjs";
1
+ import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./.setup/doctor-contract-wLrnvLUn.mjs";
2
2
  export { legacyConfigRules, normalizeCompatibilityConfig };
@@ -1,3 +1,2 @@
1
- import { n as buildChannelConfigSchema, t as GoogleChatConfigSchema } from "./.setup/config-api-CsD0IFxF.mjs";
2
- import { C as resolveWebhookPath, D as withResolvedWebhookRequestPipeline, E as warnMissingProviderGroupPolicyFallbackOnce, S as resolveInboundMentionDecision, T as runPassiveAccountLifecycle, _ as readReactionParams, a as createAccountStatusSink, b as resolveAllowlistProviderRuntimeGroupPolicy, c as createChannelPairingController, d as fetchWithSsrFGuard, f as isDangerousNameMatchingEnabled, g as readNumberParam, h as readJsonWebhookBodyOrReject, i as chunkTextForOutbound, k as setGoogleChatRuntime, l as createWebhookInFlightLimiter, m as missingTargetError, n as GROUP_POLICY_BLOCKED_LABEL, o as createActionGate, p as jsonResult, r as PAIRING_APPROVED_MESSAGE, s as createChannelMessageReplyPipeline, t as DEFAULT_ACCOUNT_ID, u as extractToolSend, v as readStringParam, w as resolveWebhookTargetWithAuthOrReject, x as resolveDefaultGroupPolicy, y as registerWebhookTargetWithPluginRoute } from "./.setup/runtime-api-Cc5ZuXih.mjs";
3
- export { DEFAULT_ACCOUNT_ID, GROUP_POLICY_BLOCKED_LABEL, GoogleChatConfigSchema, PAIRING_APPROVED_MESSAGE, buildChannelConfigSchema, chunkTextForOutbound, createAccountStatusSink, createActionGate, createChannelMessageReplyPipeline, createChannelPairingController, createWebhookInFlightLimiter, extractToolSend, fetchWithSsrFGuard, isDangerousNameMatchingEnabled, jsonResult, missingTargetError, readJsonWebhookBodyOrReject, readNumberParam, readReactionParams, readStringParam, registerWebhookTargetWithPluginRoute, resolveAllowlistProviderRuntimeGroupPolicy, resolveDefaultGroupPolicy, resolveInboundMentionDecision, resolveWebhookPath, resolveWebhookTargetWithAuthOrReject, runPassiveAccountLifecycle, setGoogleChatRuntime, warnMissingProviderGroupPolicyFallbackOnce, withResolvedWebhookRequestPipeline };
1
+ import { n as setGoogleChatRuntime } from "./.setup/runtime-C5OOOlaP.mjs";
2
+ export { setGoogleChatRuntime };
@@ -1,2 +1,2 @@
1
- import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries, t as channelSecrets } from "./.setup/secret-contract-DmWM0kwM.mjs";
1
+ import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries, t as channelSecrets } from "./.setup/secret-contract-B7H-kkqq.mjs";
2
2
  export { channelSecrets, collectRuntimeConfigAssignments, secretTargetRegistryEntries };
@@ -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-DWL3ZytB.mjs", import.meta.url).href),
7
+ specifier: fileURLToPath(new URL(".setup/setup-plugin-api-DPYc1usm.mjs", import.meta.url).href),
8
8
  exportName: "googlechatSetupPlugin"
9
9
  },
10
10
  secrets: {
11
- specifier: fileURLToPath(new URL(".setup/secret-contract-api-DHLd5XO3.mjs", import.meta.url).href),
11
+ specifier: fileURLToPath(new URL(".setup/secret-contract-api-GavLI-0W.mjs", import.meta.url).href),
12
12
  exportName: "channelSecrets"
13
13
  }
14
14
  });
@@ -1,2 +1,2 @@
1
- import { t as googlechatSetupPlugin } from "./.setup/setup-plugin-api-C0zTOlHy.mjs";
1
+ import { t as googlechatSetupPlugin } from "./.setup/setup-plugin-api-CAzvWHwN.mjs";
2
2
  export { googlechatSetupPlugin };
@@ -21,11 +21,20 @@ export declare const GCE_LINUX_BIOS_PATHS: {
21
21
  BIOS_VENDOR: string;
22
22
  };
23
23
  /**
24
- * Determines if the process is running on a Google Cloud Serverless environment (Cloud Run or Cloud Functions instance).
24
+ * Determines if the process is running on a Google Cloud Serverless environment
25
+ * (Cloud Run Services/Jobs/Worker Pools or Cloud Functions).
25
26
  *
26
- * Uses the:
27
- * - {@link https://cloud.google.com/run/docs/container-contract#env-vars Cloud Run environment variables}.
28
- * - {@link https://cloud.google.com/functions/docs/env-var Cloud Functions environment variables}.
27
+ * Environment variables checked:
28
+ * - `CLOUD_RUN_JOB` is used for Cloud Run Jobs:
29
+ * {@link https://cloud.google.com/run/docs/container-contract#env-vars Cloud Run environment variables}.
30
+ * - `FUNCTION_NAME` is used in older Cloud Functions environments:
31
+ * {@link https://cloud.google.com/functions/docs/env-var Python 3.7 and Go 1.11}.
32
+ * - `K_SERVICE` is used in Cloud Run and newer Cloud Functions environments:
33
+ * {@link https://cloud.google.com/run/docs/container-contract#env-vars Cloud Run environment variables},
34
+ * {@link https://cloud.google.com/functions/docs/env-var Cloud Functions newer runtimes}.
35
+ * - `CLOUD_RUN_WORKER_POOL` is used in Cloud Run Worker Pools:
36
+ * {@link https://cloud.google.com/run/docs/container-contract#env-vars Cloud Run environment variables},
37
+ * {@link https://cloud.google.com/run/docs/deploy-worker-pools Deploy Worker Pools to Cloud Run}.
29
38
  *
30
39
  * @returns {boolean} `true` if the process is running on GCP serverless, `false` otherwise.
31
40
  */
@@ -32,30 +32,35 @@ exports.GCE_LINUX_BIOS_PATHS = {
32
32
  };
33
33
  const GCE_MAC_ADDRESS_REGEX = /^42:01/;
34
34
  /**
35
- * Determines if the process is running on a Google Cloud Serverless environment (Cloud Run or Cloud Functions instance).
35
+ * Environment variables used to detect Google Cloud Serverless environments
36
+ * (Cloud Run Services, Cloud Run Jobs, Cloud Run Worker Pools, and Cloud Functions).
37
+ */
38
+ const SERVERLESS_ENV_VARS = [
39
+ 'CLOUD_RUN_JOB',
40
+ 'FUNCTION_NAME',
41
+ 'K_SERVICE',
42
+ 'CLOUD_RUN_WORKER_POOL',
43
+ ];
44
+ /**
45
+ * Determines if the process is running on a Google Cloud Serverless environment
46
+ * (Cloud Run Services/Jobs/Worker Pools or Cloud Functions).
36
47
  *
37
- * Uses the:
38
- * - {@link https://cloud.google.com/run/docs/container-contract#env-vars Cloud Run environment variables}.
39
- * - {@link https://cloud.google.com/functions/docs/env-var Cloud Functions environment variables}.
48
+ * Environment variables checked:
49
+ * - `CLOUD_RUN_JOB` is used for Cloud Run Jobs:
50
+ * {@link https://cloud.google.com/run/docs/container-contract#env-vars Cloud Run environment variables}.
51
+ * - `FUNCTION_NAME` is used in older Cloud Functions environments:
52
+ * {@link https://cloud.google.com/functions/docs/env-var Python 3.7 and Go 1.11}.
53
+ * - `K_SERVICE` is used in Cloud Run and newer Cloud Functions environments:
54
+ * {@link https://cloud.google.com/run/docs/container-contract#env-vars Cloud Run environment variables},
55
+ * {@link https://cloud.google.com/functions/docs/env-var Cloud Functions newer runtimes}.
56
+ * - `CLOUD_RUN_WORKER_POOL` is used in Cloud Run Worker Pools:
57
+ * {@link https://cloud.google.com/run/docs/container-contract#env-vars Cloud Run environment variables},
58
+ * {@link https://cloud.google.com/run/docs/deploy-worker-pools Deploy Worker Pools to Cloud Run}.
40
59
  *
41
60
  * @returns {boolean} `true` if the process is running on GCP serverless, `false` otherwise.
42
61
  */
43
62
  function isGoogleCloudServerless() {
44
- /**
45
- * `CLOUD_RUN_JOB` is used for Cloud Run Jobs
46
- * - See {@link https://cloud.google.com/run/docs/container-contract#env-vars Cloud Run environment variables}.
47
- *
48
- * `FUNCTION_NAME` is used in older Cloud Functions environments:
49
- * - See {@link https://cloud.google.com/functions/docs/env-var Python 3.7 and Go 1.11}.
50
- *
51
- * `K_SERVICE` is used in Cloud Run and newer Cloud Functions environments:
52
- * - See {@link https://cloud.google.com/run/docs/container-contract#env-vars Cloud Run environment variables}.
53
- * - See {@link https://cloud.google.com/functions/docs/env-var Cloud Functions newer runtimes}.
54
- */
55
- const isGFEnvironment = process.env.CLOUD_RUN_JOB ||
56
- process.env.FUNCTION_NAME ||
57
- process.env.K_SERVICE;
58
- return !!isGFEnvironment;
63
+ return SERVERLESS_ENV_VARS.some(key => Boolean(process.env[key]));
59
64
  }
60
65
  /**
61
66
  * Determines if the process is running on a Linux Google Compute Engine instance.
@@ -1 +1 @@
1
- {"version":3,"file":"gcp-residency.js","sourceRoot":"","sources":["../../src/gcp-residency.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAwBH,0DAkBC;AAOD,gEAcC;AAQD,0EAcC;AAOD,sDAEC;AAOD,gDAEC;AArGD,2BAA0C;AAC1C,2BAA+C;AAE/C;;GAEG;AACU,QAAA,oBAAoB,GAAG;IAClC,SAAS,EAAE,6BAA6B;IACxC,WAAW,EAAE,+BAA+B;CAC7C,CAAC;AAEF,MAAM,qBAAqB,GAAG,QAAQ,CAAC;AAEvC;;;;;;;;GAQG;AACH,SAAgB,uBAAuB;IACrC;;;;;;;;;;OAUG;IACH,MAAM,eAAe,GACnB,OAAO,CAAC,GAAG,CAAC,aAAa;QACzB,OAAO,CAAC,GAAG,CAAC,aAAa;QACzB,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC;IAExB,OAAO,CAAC,CAAC,eAAe,CAAC;AAC3B,CAAC;AAED;;;;GAIG;AACH,SAAgB,0BAA0B;IACxC,IAAI,IAAA,aAAQ,GAAE,KAAK,OAAO;QAAE,OAAO,KAAK,C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AAgB,qBAAqB;IACnC,OAAO,0BAA0B,EAAE,IAAI,+BAA+B,EAAE,CAAC;AAC3E,CAAC;AAED;;;;GAIG;AACH,SAAgB,kBAAkB;IAChC,OAAO,uBAAuB,EAAE,IAAI,qBAAqB,EAAE,CAAC;AAC9D,CAAC"}
@@ -283,6 +283,57 @@ function detectGCPAvailableRetries() {
283
283
  : 0;
284
284
  }
285
285
  let cachedIsAvailableResponse;
286
+ const EXPECTED_NETWORK_ERROR_CODES = new Set([
287
+ 'EHOSTDOWN',
288
+ 'EHOSTUNREACH',
289
+ 'ENETUNREACH',
290
+ 'ENOENT',
291
+ 'ENOTFOUND',
292
+ 'ECONNREFUSED',
293
+ ]);
294
+ const TIMEOUT_NAMES_AND_CODES = new Set([
295
+ 'AbortError',
296
+ 'TimeoutError',
297
+ ]);
298
+ const TIMEOUT_TYPES = new Set([
299
+ 'aborted',
300
+ 'request-timeout',
301
+ ]);
302
+ const MAX_ERROR_DEPTH = 20;
303
+ function isErrorWithDetails(val) {
304
+ return typeof val === 'object' && val !== null;
305
+ }
306
+ /**
307
+ * Recursively extracts and normalizes POSIX/network error codes from potentially
308
+ * nested Error objects (`AggregateError.errors` from `Promise.any`, `.cause`, `.error`).
309
+ * Guards against circular references and deep recursion.
310
+ */
311
+ function getErrorCodes(err, visited = new Set(), depth = 0) {
312
+ if (!isErrorWithDetails(err) || visited.has(err) || depth > MAX_ERROR_DEPTH) {
313
+ return ['UNKNOWN'];
314
+ }
315
+ visited.add(err);
316
+ if (err.name === 'AggregateError' && Array.isArray(err.errors)) {
317
+ if (err.errors.length === 0) {
318
+ return ['UNKNOWN'];
319
+ }
320
+ return err.errors.flatMap(subErr => getErrorCodes(subErr, visited, depth + 1));
321
+ }
322
+ if ((err.name !== undefined && TIMEOUT_NAMES_AND_CODES.has(err.name)) ||
323
+ (err.code !== undefined && TIMEOUT_NAMES_AND_CODES.has(err.code)) ||
324
+ (err.type !== undefined && TIMEOUT_TYPES.has(err.type))) {
325
+ return ['ETIMEDOUT'];
326
+ }
327
+ if ((typeof err.code === 'string' || typeof err.code === 'number') &&
328
+ err.code !== '') {
329
+ return [String(err.code)];
330
+ }
331
+ const nested = err.cause ?? err.error;
332
+ if (nested !== undefined) {
333
+ return getErrorCodes(nested, visited, depth + 1);
334
+ }
335
+ return ['UNKNOWN'];
336
+ }
286
337
  /**
287
338
  * Determine if the metadata server is currently available.
288
339
  */
@@ -319,50 +370,27 @@ async function isAvailable() {
319
370
  return true;
320
371
  }
321
372
  catch (e) {
322
- const err = e;
323
373
  if (process.env.DEBUG_AUTH) {
324
- console.info(err);
374
+ console.info(e);
325
375
  }
326
- if (err.type === 'request-timeout') {
327
- // If running in a GCP environment, metadata endpoint should return
328
- // within ms.
376
+ if (!isErrorWithDetails(e)) {
377
+ process.emitWarning(`received unexpected error = ${String(e)} code = UNKNOWN`, 'MetadataLookupWarning');
329
378
  return false;
330
379
  }
331
- if (err.response && err.response.status === 404) {
380
+ if (e.type === 'request-timeout' || e.response?.status === 404) {
381
+ // If running in a GCP environment, metadata endpoint should return
382
+ // within ms.
332
383
  return false;
333
384
  }
334
- else {
335
- const errObj = e;
336
- const getErrorCodes = (err) => {
337
- if (!err)
338
- return ['UNKNOWN'];
339
- if (err.name === 'AggregateError' && Array.isArray(err.errors)) {
340
- return err.errors.flatMap(getErrorCodes);
341
- }
342
- if (err.code) {
343
- return [err.code.toString()];
344
- }
345
- if (err.cause) {
346
- return getErrorCodes(err.cause);
347
- }
348
- return ['UNKNOWN'];
349
- };
350
- const codes = getErrorCodes(errObj);
351
- const isExpected = codes.every((code) => [
352
- 'EHOSTDOWN',
353
- 'EHOSTUNREACH',
354
- 'ENETUNREACH',
355
- 'ENOENT',
356
- 'ENOTFOUND',
357
- 'ECONNREFUSED',
358
- ].includes(code));
359
- if (!isExpected) {
360
- const code = err.code ? err.code.toString() : 'UNKNOWN';
361
- process.emitWarning(`received unexpected error = ${err.message} code = ${code}`, 'MetadataLookupWarning');
362
- }
363
- // Failure to resolve the metadata service means that it is not available.
364
- return false;
385
+ const codes = getErrorCodes(e);
386
+ const isExpected = codes.length > 0 &&
387
+ codes.every(code => EXPECTED_NETWORK_ERROR_CODES.has(code));
388
+ if (!isExpected) {
389
+ const code = [...new Set(codes)].join(', ');
390
+ process.emitWarning(`received unexpected error = ${e.message} code = ${code}`, 'MetadataLookupWarning');
365
391
  }
392
+ // Failure to resolve the metadata service means that it is not available.
393
+ return false;
366
394
  }
367
395
  })();
368
396
  }