@openclaw/googlechat 2026.7.2-beta.2 → 2026.7.2-beta.4
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-B4nbMjmi.js → actions-DBF3ImbA.js} +5 -5
- package/dist/api.js +2 -2
- package/dist/{approval-auth-B2m8ckdj.js → approval-auth-BztBRceh.js} +3 -3
- package/dist/{approval-handler.runtime-DH6QCsS8.js → approval-handler.runtime-CWoYapMp.js} +4 -4
- package/dist/{channel-CST-JKw9.js → channel-DMP6V9MO.js} +18 -17
- package/dist/{channel-base-fY2AAQj5.js → channel-base-BOLIr2sb.js} +138 -49
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel.adapters-Dhy4lV4f.js → channel.adapters-X7Hlcajj.js} +305 -18
- package/dist/{channel.runtime-CE5zWkzP.js → channel.runtime-rGazhnxA.js} +306 -124
- package/dist/directory-contract-api.js +1 -1
- package/dist/{doctor-contract-CvhD0eoX.js → doctor-contract-CWlBAcKf.js} +38 -61
- package/dist/doctor-contract-api.js +1 -1
- package/dist/{runtime-api-1v-DgldF.js → runtime-api-Dh0CNVS4.js} +1 -2
- package/dist/runtime-api.js +2 -2
- package/dist/{secret-contract-D__4IIu_.js → secret-contract-BFYyuE0F.js} +21 -25
- package/dist/secret-contract-api.js +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/node_modules/gaxios/build/cjs/src/gaxios.js +1 -1
- package/node_modules/gaxios/build/cjs/src/gaxios.js.map +1 -1
- package/node_modules/gaxios/build/cjs/test/test.getch.js +66 -0
- package/node_modules/gaxios/build/cjs/test/test.getch.js.map +1 -1
- package/node_modules/gaxios/build/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/node_modules/gaxios/build/esm/src/gaxios.js +1 -1
- package/node_modules/gaxios/build/esm/src/gaxios.js.map +1 -1
- package/node_modules/gaxios/build/esm/test/test.getch.js +66 -0
- package/node_modules/gaxios/build/esm/test/test.getch.js.map +1 -1
- package/node_modules/gaxios/build/esm/tsconfig.tsbuildinfo +1 -1
- package/node_modules/gaxios/package.json +4 -4
- package/node_modules/google-logging-utils/build/src/colours.d.ts +1 -29
- package/node_modules/google-logging-utils/build/src/colours.js +13 -13
- package/node_modules/google-logging-utils/build/src/colours.js.map +1 -1
- package/node_modules/google-logging-utils/build/src/index.d.ts +1 -0
- package/node_modules/google-logging-utils/build/src/index.js +1 -1
- package/node_modules/google-logging-utils/build/src/index.js.map +1 -1
- package/node_modules/google-logging-utils/build/src/logging-utils.d.ts +2 -135
- package/node_modules/google-logging-utils/build/src/logging-utils.js +35 -58
- package/node_modules/google-logging-utils/build/src/logging-utils.js.map +1 -1
- package/node_modules/google-logging-utils/build/src/temporal.js +8 -8
- package/node_modules/google-logging-utils/build/src/temporal.js.map +1 -1
- package/node_modules/google-logging-utils/build/src/types.d.ts +78 -0
- package/node_modules/google-logging-utils/build/src/types.js +16 -0
- package/node_modules/google-logging-utils/build/src/types.js.map +1 -0
- package/node_modules/google-logging-utils/package.json +11 -9
- package/npm-shrinkwrap.json +9 -9
- package/openclaw.plugin.json +403 -499
- package/package.json +81 -22
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { l as resolveGoogleChatAccount, o as listEnabledGoogleChatAccounts } from "./channel-base-
|
|
2
|
-
import { m as resolveGoogleChatOutboundSpace, v as sendGoogleChatMessage } from "./channel.adapters-
|
|
1
|
+
import { l as resolveGoogleChatAccount, o as listEnabledGoogleChatAccounts } from "./channel-base-BOLIr2sb.js";
|
|
2
|
+
import { m as resolveGoogleChatOutboundSpace, v as sendGoogleChatMessage } from "./channel.adapters-X7Hlcajj.js";
|
|
3
3
|
import { extractToolSend } from "openclaw/plugin-sdk/tool-send";
|
|
4
4
|
import { jsonResult, readStringArrayParam, readStringParam } from "openclaw/plugin-sdk/channel-actions";
|
|
5
5
|
//#region extensions/googlechat/src/actions.ts
|
|
6
6
|
const providerId = "googlechat";
|
|
7
7
|
function listEnabledAccounts(cfg) {
|
|
8
|
-
return listEnabledGoogleChatAccounts(cfg).filter((account) => account.enabled && account.credentialSource !== "none");
|
|
8
|
+
return listEnabledGoogleChatAccounts(cfg).filter((account) => account.enabled && account.credentialSource !== "none" && account.tokenStatus !== "configured_unavailable");
|
|
9
9
|
}
|
|
10
10
|
const OUTBOUND_MEDIA_KEYS = [
|
|
11
11
|
"media",
|
|
@@ -30,7 +30,7 @@ const googlechatMessageActions = {
|
|
|
30
30
|
if ((accountId ? [resolveGoogleChatAccount({
|
|
31
31
|
cfg,
|
|
32
32
|
accountId
|
|
33
|
-
})].filter((account) => account.enabled && account.credentialSource !== "none") : listEnabledAccounts(cfg)).length === 0) return null;
|
|
33
|
+
})].filter((account) => account.enabled && account.credentialSource !== "none" && account.tokenStatus !== "configured_unavailable") : listEnabledAccounts(cfg)).length === 0) return null;
|
|
34
34
|
return { actions: ["send"] };
|
|
35
35
|
},
|
|
36
36
|
supportsAction: ({ action }) => action === "send",
|
|
@@ -46,7 +46,7 @@ const googlechatMessageActions = {
|
|
|
46
46
|
cfg,
|
|
47
47
|
accountId
|
|
48
48
|
});
|
|
49
|
-
if (account.credentialSource === "none") throw new Error("Google Chat credentials are missing.");
|
|
49
|
+
if (account.credentialSource === "none" || account.tokenStatus === "configured_unavailable") throw new Error("Google Chat credentials are missing.");
|
|
50
50
|
if (action === "send") {
|
|
51
51
|
const to = readStringParam(params, "to", { required: true });
|
|
52
52
|
const content = readStringParam(params, "message", {
|
package/dist/api.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as googlechatSetupAdapter, i as googlechatSetupWizard } from "./channel-base-
|
|
2
|
-
import { t as googlechatPlugin } from "./channel-
|
|
1
|
+
import { a as googlechatSetupAdapter, i as googlechatSetupWizard } from "./channel-base-BOLIr2sb.js";
|
|
2
|
+
import { t as googlechatPlugin } from "./channel-DMP6V9MO.js";
|
|
3
3
|
export { googlechatPlugin, googlechatSetupAdapter, googlechatSetupWizard };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { l as resolveGoogleChatAccount } from "./channel-base-
|
|
2
|
-
import { d as isGoogleChatUserTarget, f as normalizeGoogleChatTarget } from "./channel.adapters-
|
|
1
|
+
import { l as resolveGoogleChatAccount } from "./channel-base-BOLIr2sb.js";
|
|
2
|
+
import { d as isGoogleChatUserTarget, f as normalizeGoogleChatTarget } from "./channel.adapters-X7Hlcajj.js";
|
|
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
|
|
@@ -18,7 +18,7 @@ const googleChatApproval = createChannelApprovalAuth({
|
|
|
18
18
|
accountId
|
|
19
19
|
}).config;
|
|
20
20
|
return {
|
|
21
|
-
allowFrom: account.
|
|
21
|
+
allowFrom: account.allowFrom,
|
|
22
22
|
defaultTo: account.defaultTo
|
|
23
23
|
};
|
|
24
24
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { l as resolveGoogleChatAccount } from "./channel-base-
|
|
2
|
-
import { M as unregisterGoogleChatManualApprovalFollowupSuppression, O as registerGoogleChatApprovalCardBinding, S as buildGoogleChatApprovalActionParameters, T as createGoogleChatApprovalToken, j as unregisterGoogleChatApprovalCardBindings, k as registerGoogleChatManualApprovalFollowupSuppression, m as resolveGoogleChatOutboundSpace, v as sendGoogleChatMessage, x as GOOGLECHAT_APPROVAL_ACTION, y as updateGoogleChatMessage } from "./channel.adapters-
|
|
3
|
-
import { n as isGoogleChatNativeApprovalClientEnabled, r as shouldHandleGoogleChatNativeApprovalRequest } from "./channel-
|
|
1
|
+
import { l as resolveGoogleChatAccount } from "./channel-base-BOLIr2sb.js";
|
|
2
|
+
import { M as unregisterGoogleChatManualApprovalFollowupSuppression, O as registerGoogleChatApprovalCardBinding, S as buildGoogleChatApprovalActionParameters, T as createGoogleChatApprovalToken, j as unregisterGoogleChatApprovalCardBindings, k as registerGoogleChatManualApprovalFollowupSuppression, m as resolveGoogleChatOutboundSpace, v as sendGoogleChatMessage, x as GOOGLECHAT_APPROVAL_ACTION, y as updateGoogleChatMessage } from "./channel.adapters-X7Hlcajj.js";
|
|
3
|
+
import { n as isGoogleChatNativeApprovalClientEnabled, r as shouldHandleGoogleChatNativeApprovalRequest } from "./channel-DMP6V9MO.js";
|
|
4
4
|
import { buildChannelApprovalNativeTargetKey } from "openclaw/plugin-sdk/approval-native-runtime";
|
|
5
5
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
6
|
import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
@@ -15,7 +15,7 @@ function resolveHandlerAccount(params) {
|
|
|
15
15
|
cfg: params.cfg,
|
|
16
16
|
accountId: params.accountId
|
|
17
17
|
});
|
|
18
|
-
if (!account.enabled || account.credentialSource === "none") return null;
|
|
18
|
+
if (!account.enabled || account.credentialSource === "none" || account.tokenStatus === "configured_unavailable") return null;
|
|
19
19
|
return account;
|
|
20
20
|
}
|
|
21
21
|
function escapeGoogleChatText(text) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { c as resolveDefaultGoogleChatAccountId, l as resolveGoogleChatAccount, n as createGoogleChatPluginBase, s as listGoogleChatAccountIds, t as GOOGLECHAT_CHANNEL_ID } from "./channel-base-
|
|
2
|
-
import { a as googlechatPairingTextAdapter, d as isGoogleChatUserTarget, f as normalizeGoogleChatTarget, i as googlechatOutboundAdapter, n as googlechatGroupsAdapter, o as googlechatSecurityAdapter, p as resolveGoogleChatOutboundSessionRoute, r as googlechatMessageAdapter, s as googlechatThreadingAdapter, t as googlechatDirectoryAdapter, u as isGoogleChatSpaceTarget } from "./channel.adapters-
|
|
1
|
+
import { c as resolveDefaultGoogleChatAccountId, l as resolveGoogleChatAccount, n as createGoogleChatPluginBase, s as listGoogleChatAccountIds, t as GOOGLECHAT_CHANNEL_ID } from "./channel-base-BOLIr2sb.js";
|
|
2
|
+
import { a as googlechatPairingTextAdapter, d as isGoogleChatUserTarget, f as normalizeGoogleChatTarget, i as googlechatOutboundAdapter, n as googlechatGroupsAdapter, o as googlechatSecurityAdapter, p as resolveGoogleChatOutboundSessionRoute, r as googlechatMessageAdapter, s as googlechatThreadingAdapter, t as googlechatDirectoryAdapter, u as isGoogleChatSpaceTarget } from "./channel.adapters-X7Hlcajj.js";
|
|
3
3
|
import { n as buildChannelConfigSchema, t as GoogleChatConfigSchema } from "./config-api-CsD0IFxF.js";
|
|
4
|
-
import { t as DEFAULT_ACCOUNT_ID } from "./runtime-api-
|
|
5
|
-
import { n as googleChatApprovalAuth, r as normalizeGoogleChatApproverId, t as getGoogleChatApprovalApprovers } from "./approval-auth-
|
|
6
|
-
import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-
|
|
7
|
-
import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./secret-contract-
|
|
4
|
+
import { t as DEFAULT_ACCOUNT_ID } from "./runtime-api-Dh0CNVS4.js";
|
|
5
|
+
import { n as googleChatApprovalAuth, r as normalizeGoogleChatApproverId, t as getGoogleChatApprovalApprovers } from "./approval-auth-BztBRceh.js";
|
|
6
|
+
import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-CWlBAcKf.js";
|
|
7
|
+
import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./secret-contract-BFYyuE0F.js";
|
|
8
8
|
import { createChatChannelPlugin } from "openclaw/plugin-sdk/channel-core";
|
|
9
9
|
import { buildPassiveProbedChannelStatusSummary } from "openclaw/plugin-sdk/extension-shared";
|
|
10
10
|
import { createLazyRuntimeNamedExport } from "openclaw/plugin-sdk/lazy-runtime";
|
|
@@ -21,7 +21,7 @@ import { registerChannelRuntimeContext } from "openclaw/plugin-sdk/channel-runti
|
|
|
21
21
|
const DEFAULT_APPROVAL_FORWARDING_MODE = "session";
|
|
22
22
|
function isGoogleChatAccountConfigured(params) {
|
|
23
23
|
const account = resolveGoogleChatAccount(params);
|
|
24
|
-
return account.enabled && account.credentialSource !== "none";
|
|
24
|
+
return account.enabled && account.credentialSource !== "none" && account.tokenStatus !== "configured_unavailable";
|
|
25
25
|
}
|
|
26
26
|
function hasGoogleChatWebhookApprovalAuthConfig(params) {
|
|
27
27
|
const account = resolveGoogleChatAccount(params).config;
|
|
@@ -87,7 +87,7 @@ const googleChatApprovalCapability = createApproverRestrictedNativeApprovalCapab
|
|
|
87
87
|
channelLabel: "Google Chat",
|
|
88
88
|
describeExecApprovalSetup: ({ accountId }) => {
|
|
89
89
|
const prefix = accountId && accountId !== "default" ? `channels.googlechat.accounts.${accountId}` : "channels.googlechat";
|
|
90
|
-
return `Approve it from the Web UI or terminal UI for now. Google Chat supports native approvals for this account when the webhook and service account are configured. Configure \`${prefix}.
|
|
90
|
+
return `Approve it from the Web UI or terminal UI for now. Google Chat supports native approvals for this account when the webhook and service account are configured. Configure \`${prefix}.allowFrom\` or \`${prefix}.defaultTo\` with numeric \`users/{id}\` approvers.`;
|
|
91
91
|
},
|
|
92
92
|
listAccountIds: listGoogleChatAccountIds,
|
|
93
93
|
hasApprovers: ({ cfg, accountId }) => getGoogleChatApprovalApprovers({
|
|
@@ -141,7 +141,7 @@ const googleChatApprovalCapability = createApproverRestrictedNativeApprovalCapab
|
|
|
141
141
|
approvalKind,
|
|
142
142
|
request
|
|
143
143
|
}),
|
|
144
|
-
load: async () => (await import("./approval-handler.runtime-
|
|
144
|
+
load: async () => (await import("./approval-handler.runtime-CWoYapMp.js")).googleChatApprovalNativeRuntime
|
|
145
145
|
})
|
|
146
146
|
});
|
|
147
147
|
const collectGoogleChatMutableAllowlistWarnings = createDangerousNameMatchingMutableAllowlistWarningCollector({
|
|
@@ -164,7 +164,7 @@ const collectGoogleChatMutableAllowlistWarnings = createDangerousNameMatchingMut
|
|
|
164
164
|
});
|
|
165
165
|
//#endregion
|
|
166
166
|
//#region extensions/googlechat/src/gateway.ts
|
|
167
|
-
const loadGoogleChatChannelRuntime$1 = createLazyRuntimeNamedExport(() => import("./channel.runtime-
|
|
167
|
+
const loadGoogleChatChannelRuntime$1 = createLazyRuntimeNamedExport(() => import("./channel.runtime-rGazhnxA.js"), "googleChatChannelRuntime");
|
|
168
168
|
async function startGoogleChatGatewayAccount(ctx) {
|
|
169
169
|
const account = ctx.account;
|
|
170
170
|
const statusSink = createAccountStatusSink({
|
|
@@ -213,7 +213,7 @@ async function startGoogleChatGatewayAccount(ctx) {
|
|
|
213
213
|
statusSink
|
|
214
214
|
}),
|
|
215
215
|
stop: async (unregister) => {
|
|
216
|
-
unregister?.();
|
|
216
|
+
await unregister?.();
|
|
217
217
|
},
|
|
218
218
|
onStop: async () => {
|
|
219
219
|
markStopped();
|
|
@@ -226,22 +226,22 @@ async function startGoogleChatGatewayAccount(ctx) {
|
|
|
226
226
|
}
|
|
227
227
|
//#endregion
|
|
228
228
|
//#region extensions/googlechat/src/channel.ts
|
|
229
|
-
const loadGoogleChatChannelRuntime = createLazyRuntimeNamedExport(() => import("./channel.runtime-
|
|
229
|
+
const loadGoogleChatChannelRuntime = createLazyRuntimeNamedExport(() => import("./channel.runtime-rGazhnxA.js"), "googleChatChannelRuntime");
|
|
230
230
|
const googlechatActions = {
|
|
231
231
|
describeMessageTool: ({ cfg, accountId }) => {
|
|
232
232
|
if ((accountId ? [resolveGoogleChatAccount({
|
|
233
233
|
cfg,
|
|
234
234
|
accountId
|
|
235
|
-
})].filter((account) => account.enabled && account.credentialSource !== "none") : listGoogleChatAccountIds(cfg).map((id) => resolveGoogleChatAccount({
|
|
235
|
+
})].filter((account) => account.enabled && account.credentialSource !== "none" && account.tokenStatus !== "configured_unavailable") : listGoogleChatAccountIds(cfg).map((id) => resolveGoogleChatAccount({
|
|
236
236
|
cfg,
|
|
237
237
|
accountId: id
|
|
238
|
-
})).filter((account) => account.enabled && account.credentialSource !== "none")).length === 0) return null;
|
|
238
|
+
})).filter((account) => account.enabled && account.credentialSource !== "none" && account.tokenStatus !== "configured_unavailable")).length === 0) return null;
|
|
239
239
|
return { actions: ["send"] };
|
|
240
240
|
},
|
|
241
241
|
supportsAction: ({ action }) => action === "send",
|
|
242
242
|
extractToolSend: ({ args }) => extractToolSend(args, "sendMessage"),
|
|
243
243
|
handleAction: async (ctx) => {
|
|
244
|
-
const { googlechatMessageActions } = await import("./actions-
|
|
244
|
+
const { googlechatMessageActions } = await import("./actions-DBF3ImbA.js");
|
|
245
245
|
if (!googlechatMessageActions.handleAction) throw new Error("Google Chat actions are not available.");
|
|
246
246
|
return await googlechatMessageActions.handleAction(ctx);
|
|
247
247
|
}
|
|
@@ -301,7 +301,7 @@ const googlechatPlugin = createChatChannelPlugin({
|
|
|
301
301
|
} },
|
|
302
302
|
actions: googlechatActions,
|
|
303
303
|
doctor: {
|
|
304
|
-
dmAllowFromMode: "
|
|
304
|
+
dmAllowFromMode: "topOnly",
|
|
305
305
|
groupModel: "route",
|
|
306
306
|
groupAllowFromFallbackToAllowFrom: false,
|
|
307
307
|
warnOnEmptyGroupSenderAllowlist: false,
|
|
@@ -348,11 +348,12 @@ const googlechatPlugin = createChatChannelPlugin({
|
|
|
348
348
|
configured: account.credentialSource !== "none",
|
|
349
349
|
extra: {
|
|
350
350
|
credentialSource: account.credentialSource,
|
|
351
|
+
tokenStatus: account.tokenStatus,
|
|
351
352
|
audienceType: account.config.audienceType,
|
|
352
353
|
audience: account.config.audience,
|
|
353
354
|
webhookPath: account.config.webhookPath,
|
|
354
355
|
webhookUrl: account.config.webhookUrl,
|
|
355
|
-
dmPolicy: account.config.
|
|
356
|
+
dmPolicy: account.config.dmPolicy ?? "pairing"
|
|
356
357
|
}
|
|
357
358
|
})
|
|
358
359
|
}),
|
|
@@ -2,23 +2,25 @@ import { safeParseJsonWithSchema, safeParseWithSchema } from "openclaw/plugin-sd
|
|
|
2
2
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeStringifiedOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
3
|
import { DEFAULT_ACCOUNT_ID, createAccountListHelpers, normalizeAccountId, resolveAccountEntry, resolveMergedAccountConfig } from "openclaw/plugin-sdk/account-resolution";
|
|
4
4
|
import { mergePairLoopGuardConfig } from "openclaw/plugin-sdk/pair-loop-guard-runtime";
|
|
5
|
+
import { tryReadSecretFileSync } from "openclaw/plugin-sdk/secret-file-runtime";
|
|
5
6
|
import { isSecretRef } from "openclaw/plugin-sdk/secret-input";
|
|
7
|
+
import { resolveUserPath } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
6
8
|
import { z } from "zod";
|
|
7
9
|
import { describeAccountSnapshot } from "openclaw/plugin-sdk/account-helpers";
|
|
8
10
|
import { formatNormalizedAllowFromEntries } from "openclaw/plugin-sdk/allow-from";
|
|
9
11
|
import { adaptScopedAccountAccessor, createScopedChannelConfigAdapter } from "openclaw/plugin-sdk/channel-config-helpers";
|
|
12
|
+
import { defineChannelSetupContract } from "openclaw/plugin-sdk/channel-setup";
|
|
10
13
|
import { createPatchedAccountSetupAdapter, createSetupInputPresenceValidator } from "openclaw/plugin-sdk/setup-runtime";
|
|
11
14
|
import { DEFAULT_ACCOUNT_ID as DEFAULT_ACCOUNT_ID$1, addWildcardAllowFrom, applySetupAccountConfigPatch, createPromptParsedAllowFromForAccount, createSetupTranslator, createStandardChannelSetupStatus, formatDocsLink, mergeAllowFromEntries, migrateBaseNameToDefaultAccount, splitSetupEntries } from "openclaw/plugin-sdk/setup";
|
|
15
|
+
//#region extensions/googlechat/src/google-auth-limits.ts
|
|
16
|
+
const MAX_GOOGLE_CHAT_SERVICE_ACCOUNT_FILE_BYTES = 64 * 1024;
|
|
17
|
+
//#endregion
|
|
12
18
|
//#region extensions/googlechat/src/accounts.ts
|
|
13
19
|
const ENV_SERVICE_ACCOUNT$1 = "GOOGLE_CHAT_SERVICE_ACCOUNT";
|
|
14
20
|
const ENV_SERVICE_ACCOUNT_FILE$1 = "GOOGLE_CHAT_SERVICE_ACCOUNT_FILE";
|
|
15
21
|
const JsonRecordSchema = z.record(z.string(), z.unknown());
|
|
16
22
|
const { listAccountIds: listGoogleChatAccountIds, resolveDefaultAccountId: resolveDefaultGoogleChatAccountId } = createAccountListHelpers("googlechat", { implicitDefaultAccount: {
|
|
17
|
-
channelKeys: [
|
|
18
|
-
"serviceAccount",
|
|
19
|
-
"serviceAccountRef",
|
|
20
|
-
"serviceAccountFile"
|
|
21
|
-
],
|
|
23
|
+
channelKeys: ["serviceAccount", "serviceAccountFile"],
|
|
22
24
|
envVars: [ENV_SERVICE_ACCOUNT$1, ENV_SERVICE_ACCOUNT_FILE$1]
|
|
23
25
|
} });
|
|
24
26
|
function mergeGoogleChatAccountConfig(cfg, accountId) {
|
|
@@ -32,7 +34,7 @@ function mergeGoogleChatAccountConfig(cfg, accountId) {
|
|
|
32
34
|
});
|
|
33
35
|
const defaultAccountConfig = resolveAccountEntry(raw.accounts, DEFAULT_ACCOUNT_ID) ?? {};
|
|
34
36
|
if (accountId === DEFAULT_ACCOUNT_ID) return base;
|
|
35
|
-
const { enabled: _ignoredEnabled, dangerouslyAllowNameMatching: _ignoredDangerouslyAllowNameMatching, serviceAccount: _ignoredServiceAccount,
|
|
37
|
+
const { enabled: _ignoredEnabled, dangerouslyAllowNameMatching: _ignoredDangerouslyAllowNameMatching, serviceAccount: _ignoredServiceAccount, serviceAccountFile: _ignoredServiceAccountFile, ...defaultAccountShared } = defaultAccountConfig;
|
|
36
38
|
const botLoopProtection = mergePairLoopGuardConfig(defaultAccountShared.botLoopProtection, base.botLoopProtection);
|
|
37
39
|
return {
|
|
38
40
|
...defaultAccountShared,
|
|
@@ -58,29 +60,59 @@ function resolveCredentialsFromConfig(params) {
|
|
|
58
60
|
const inline = parseServiceAccount(account.serviceAccount);
|
|
59
61
|
if (inline) return {
|
|
60
62
|
credentials: inline,
|
|
61
|
-
source: "inline"
|
|
63
|
+
source: "inline",
|
|
64
|
+
status: "available"
|
|
62
65
|
};
|
|
63
66
|
if (isSecretRef(account.serviceAccount)) throw new Error(`channels.googlechat.accounts.${accountId}.serviceAccount: unresolved SecretRef "${account.serviceAccount.source}:${account.serviceAccount.provider}:${account.serviceAccount.id}". Resolve this command against an active gateway runtime snapshot before reading it.`);
|
|
64
|
-
if (isSecretRef(account.serviceAccountRef)) throw new Error(`channels.googlechat.accounts.${accountId}.serviceAccount: unresolved SecretRef "${account.serviceAccountRef.source}:${account.serviceAccountRef.provider}:${account.serviceAccountRef.id}". Resolve this command against an active gateway runtime snapshot before reading it.`);
|
|
65
67
|
const file = normalizeOptionalString(account.serviceAccountFile);
|
|
66
|
-
if (file)
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
if (file) {
|
|
69
|
+
const result = tryReadSecretFileSync(resolveUserPath(file), "Google Chat service account file", {
|
|
70
|
+
maxBytes: MAX_GOOGLE_CHAT_SERVICE_ACCOUNT_FILE_BYTES,
|
|
71
|
+
rejectHardlinks: false,
|
|
72
|
+
rejectSymlink: false
|
|
73
|
+
}, { configPath: `channels.googlechat.accounts.${accountId}.serviceAccountFile` });
|
|
74
|
+
return result.status === "available" ? {
|
|
75
|
+
credentialsFile: file,
|
|
76
|
+
source: "file",
|
|
77
|
+
status: "available"
|
|
78
|
+
} : {
|
|
79
|
+
credentialsFile: file,
|
|
80
|
+
source: "file",
|
|
81
|
+
status: "configured_unavailable",
|
|
82
|
+
diagnostic: result.diagnostic
|
|
83
|
+
};
|
|
84
|
+
}
|
|
70
85
|
if (accountId === DEFAULT_ACCOUNT_ID) {
|
|
71
86
|
const envJson = process.env[ENV_SERVICE_ACCOUNT$1];
|
|
72
87
|
const envInline = parseServiceAccount(envJson);
|
|
73
88
|
if (envInline) return {
|
|
74
89
|
credentials: envInline,
|
|
75
|
-
source: "env"
|
|
90
|
+
source: "env",
|
|
91
|
+
status: "available"
|
|
76
92
|
};
|
|
77
93
|
const envFile = normalizeOptionalString(process.env[ENV_SERVICE_ACCOUNT_FILE$1]);
|
|
78
|
-
if (envFile)
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
94
|
+
if (envFile) {
|
|
95
|
+
const result = tryReadSecretFileSync(resolveUserPath(envFile), "Google Chat service account file", {
|
|
96
|
+
maxBytes: MAX_GOOGLE_CHAT_SERVICE_ACCOUNT_FILE_BYTES,
|
|
97
|
+
rejectHardlinks: false,
|
|
98
|
+
rejectSymlink: false
|
|
99
|
+
}, { configPath: `env.${ENV_SERVICE_ACCOUNT_FILE$1}` });
|
|
100
|
+
return result.status === "available" ? {
|
|
101
|
+
credentialsFile: envFile,
|
|
102
|
+
source: "env",
|
|
103
|
+
status: "available"
|
|
104
|
+
} : {
|
|
105
|
+
credentialsFile: envFile,
|
|
106
|
+
source: "env",
|
|
107
|
+
status: "configured_unavailable",
|
|
108
|
+
diagnostic: result.diagnostic
|
|
109
|
+
};
|
|
110
|
+
}
|
|
82
111
|
}
|
|
83
|
-
return {
|
|
112
|
+
return {
|
|
113
|
+
source: "none",
|
|
114
|
+
status: "missing"
|
|
115
|
+
};
|
|
84
116
|
}
|
|
85
117
|
function resolveGoogleChatAccount(params) {
|
|
86
118
|
const accountId = normalizeAccountId(params.accountId ?? params.cfg.channels?.["googlechat"]?.defaultAccount);
|
|
@@ -99,7 +131,9 @@ function resolveGoogleChatAccount(params) {
|
|
|
99
131
|
config: merged,
|
|
100
132
|
credentialSource: credentials.source,
|
|
101
133
|
credentials: credentials.credentials,
|
|
102
|
-
credentialsFile: credentials.credentialsFile
|
|
134
|
+
credentialsFile: credentials.credentialsFile,
|
|
135
|
+
tokenStatus: credentials.status,
|
|
136
|
+
...credentials.diagnostic ? { credentialDiagnostics: [credentials.diagnostic] } : {}
|
|
103
137
|
};
|
|
104
138
|
}
|
|
105
139
|
function listEnabledGoogleChatAccounts(cfg) {
|
|
@@ -118,11 +152,12 @@ const googlechatSetupAdapter = createPatchedAccountSetupAdapter({
|
|
|
118
152
|
}]
|
|
119
153
|
}),
|
|
120
154
|
buildPatch: (input) => {
|
|
121
|
-
const
|
|
122
|
-
const
|
|
123
|
-
const
|
|
124
|
-
const
|
|
125
|
-
const
|
|
155
|
+
const setupInput = input;
|
|
156
|
+
const patch = setupInput.useEnv ? {} : setupInput.tokenFile ? { serviceAccountFile: setupInput.tokenFile } : setupInput.token ? { serviceAccount: setupInput.token } : {};
|
|
157
|
+
const audienceType = setupInput.audienceType?.trim();
|
|
158
|
+
const audience = setupInput.audience?.trim();
|
|
159
|
+
const webhookPath = setupInput.webhookPath?.trim();
|
|
160
|
+
const webhookUrl = setupInput.webhookUrl?.trim();
|
|
126
161
|
return {
|
|
127
162
|
...patch,
|
|
128
163
|
...audienceType ? { audienceType } : {},
|
|
@@ -132,6 +167,63 @@ const googlechatSetupAdapter = createPatchedAccountSetupAdapter({
|
|
|
132
167
|
};
|
|
133
168
|
}
|
|
134
169
|
});
|
|
170
|
+
const googlechatSetupContract = defineChannelSetupContract({
|
|
171
|
+
fields: {
|
|
172
|
+
token: {
|
|
173
|
+
kind: "string",
|
|
174
|
+
sensitive: true,
|
|
175
|
+
cli: {
|
|
176
|
+
flags: "--token <json>",
|
|
177
|
+
description: "Google Chat service account JSON"
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
tokenFile: {
|
|
181
|
+
kind: "string",
|
|
182
|
+
sensitive: true,
|
|
183
|
+
cli: {
|
|
184
|
+
flags: "--token-file <path>",
|
|
185
|
+
description: "Google Chat service account file"
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
audienceType: {
|
|
189
|
+
kind: "choice",
|
|
190
|
+
choices: ["app-url", "project-number"],
|
|
191
|
+
cli: {
|
|
192
|
+
flags: "--audience-type <type>",
|
|
193
|
+
description: "Google Chat audience type"
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
audience: {
|
|
197
|
+
kind: "string",
|
|
198
|
+
cli: {
|
|
199
|
+
flags: "--audience <value>",
|
|
200
|
+
description: "Google Chat audience value"
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
webhookPath: {
|
|
204
|
+
kind: "string",
|
|
205
|
+
cli: {
|
|
206
|
+
flags: "--webhook-path <path>",
|
|
207
|
+
description: "Google Chat webhook path"
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
webhookUrl: {
|
|
211
|
+
kind: "string",
|
|
212
|
+
cli: {
|
|
213
|
+
flags: "--webhook-url <url>",
|
|
214
|
+
description: "Google Chat webhook URL"
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
useEnv: {
|
|
218
|
+
kind: "boolean",
|
|
219
|
+
cli: {
|
|
220
|
+
flags: "--use-env",
|
|
221
|
+
description: "Use Google Chat environment credentials"
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
legacyAdapter: googlechatSetupAdapter
|
|
226
|
+
});
|
|
135
227
|
//#endregion
|
|
136
228
|
//#region extensions/googlechat/src/setup-surface.ts
|
|
137
229
|
const t = createSetupTranslator();
|
|
@@ -143,34 +235,33 @@ const AUTH_METHOD_FLAG = "__googlechatAuthMethod";
|
|
|
143
235
|
const googlechatDmPolicy = {
|
|
144
236
|
label: "Google Chat",
|
|
145
237
|
channel,
|
|
146
|
-
policyKey: "channels.googlechat.
|
|
147
|
-
allowFromKey: "channels.googlechat.
|
|
238
|
+
policyKey: "channels.googlechat.dmPolicy",
|
|
239
|
+
allowFromKey: "channels.googlechat.allowFrom",
|
|
148
240
|
resolveConfigKeys: (cfg, accountId) => (accountId ?? resolveDefaultGoogleChatAccountId(cfg)) !== DEFAULT_ACCOUNT_ID$1 ? {
|
|
149
|
-
policyKey: `channels.googlechat.accounts.${accountId ?? resolveDefaultGoogleChatAccountId(cfg)}.
|
|
150
|
-
allowFromKey: `channels.googlechat.accounts.${accountId ?? resolveDefaultGoogleChatAccountId(cfg)}.
|
|
241
|
+
policyKey: `channels.googlechat.accounts.${accountId ?? resolveDefaultGoogleChatAccountId(cfg)}.dmPolicy`,
|
|
242
|
+
allowFromKey: `channels.googlechat.accounts.${accountId ?? resolveDefaultGoogleChatAccountId(cfg)}.allowFrom`
|
|
151
243
|
} : {
|
|
152
|
-
policyKey: "channels.googlechat.
|
|
153
|
-
allowFromKey: "channels.googlechat.
|
|
244
|
+
policyKey: "channels.googlechat.dmPolicy",
|
|
245
|
+
allowFromKey: "channels.googlechat.allowFrom"
|
|
154
246
|
},
|
|
155
247
|
getCurrent: (cfg, accountId) => resolveGoogleChatAccount({
|
|
156
248
|
cfg,
|
|
157
249
|
accountId: accountId ?? resolveDefaultGoogleChatAccountId(cfg)
|
|
158
|
-
}).config.
|
|
250
|
+
}).config.dmPolicy ?? "pairing",
|
|
159
251
|
setPolicy: (cfg, policy, accountId) => {
|
|
160
252
|
const resolvedAccountId = accountId ?? resolveDefaultGoogleChatAccountId(cfg);
|
|
161
|
-
const
|
|
253
|
+
const current = resolveGoogleChatAccount({
|
|
162
254
|
cfg,
|
|
163
255
|
accountId: resolvedAccountId
|
|
164
|
-
}).config
|
|
256
|
+
}).config;
|
|
165
257
|
return applySetupAccountConfigPatch({
|
|
166
258
|
cfg,
|
|
167
259
|
channelKey: channel,
|
|
168
260
|
accountId: resolvedAccountId,
|
|
169
|
-
patch: {
|
|
170
|
-
|
|
171
|
-
policy
|
|
172
|
-
|
|
173
|
-
} }
|
|
261
|
+
patch: {
|
|
262
|
+
dmPolicy: policy,
|
|
263
|
+
...policy === "open" ? { allowFrom: addWildcardAllowFrom(current.allowFrom) } : {}
|
|
264
|
+
}
|
|
174
265
|
});
|
|
175
266
|
},
|
|
176
267
|
promptAllowFrom: createPromptParsedAllowFromForAccount({
|
|
@@ -181,18 +272,12 @@ const googlechatDmPolicy = {
|
|
|
181
272
|
getExistingAllowFrom: ({ cfg, accountId }) => resolveGoogleChatAccount({
|
|
182
273
|
cfg,
|
|
183
274
|
accountId
|
|
184
|
-
}).config.
|
|
275
|
+
}).config.allowFrom ?? [],
|
|
185
276
|
applyAllowFrom: ({ cfg, accountId, allowFrom }) => applySetupAccountConfigPatch({
|
|
186
277
|
cfg,
|
|
187
278
|
channelKey: channel,
|
|
188
279
|
accountId,
|
|
189
|
-
patch: {
|
|
190
|
-
...resolveGoogleChatAccount({
|
|
191
|
-
cfg,
|
|
192
|
-
accountId
|
|
193
|
-
}).config.dm,
|
|
194
|
-
allowFrom
|
|
195
|
-
} }
|
|
280
|
+
patch: { allowFrom }
|
|
196
281
|
})
|
|
197
282
|
})
|
|
198
283
|
};
|
|
@@ -354,7 +439,7 @@ const googleChatConfigAdapter = createScopedChannelConfigAdapter({
|
|
|
354
439
|
"botUser",
|
|
355
440
|
"name"
|
|
356
441
|
],
|
|
357
|
-
resolveAllowFrom: (account) => account.config.
|
|
442
|
+
resolveAllowFrom: (account) => account.config.allowFrom,
|
|
358
443
|
formatAllowFrom: (allowFrom) => formatNormalizedAllowFromEntries({
|
|
359
444
|
allowFrom,
|
|
360
445
|
normalizeEntry: formatGoogleChatAllowFromEntry
|
|
@@ -366,6 +451,7 @@ function createGoogleChatPluginBase(params = {}) {
|
|
|
366
451
|
id: GOOGLECHAT_CHANNEL_ID,
|
|
367
452
|
meta: { ...googlechatMeta },
|
|
368
453
|
setup: googlechatSetupAdapter,
|
|
454
|
+
setupContract: googlechatSetupContract,
|
|
369
455
|
setupWizard: googlechatSetupWizard,
|
|
370
456
|
capabilities: {
|
|
371
457
|
chatTypes: [
|
|
@@ -390,10 +476,13 @@ function createGoogleChatPluginBase(params = {}) {
|
|
|
390
476
|
describeAccount: (account) => describeAccountSnapshot({
|
|
391
477
|
account,
|
|
392
478
|
configured: account.credentialSource !== "none",
|
|
393
|
-
extra: {
|
|
479
|
+
extra: {
|
|
480
|
+
credentialSource: account.credentialSource,
|
|
481
|
+
tokenStatus: account.tokenStatus
|
|
482
|
+
}
|
|
394
483
|
})
|
|
395
484
|
}
|
|
396
485
|
};
|
|
397
486
|
}
|
|
398
487
|
//#endregion
|
|
399
|
-
export { googlechatSetupAdapter as a, resolveDefaultGoogleChatAccountId as c, googlechatSetupWizard as i, resolveGoogleChatAccount as l, createGoogleChatPluginBase as n, listEnabledGoogleChatAccounts as o, formatGoogleChatAllowFromEntry as r, listGoogleChatAccountIds as s, GOOGLECHAT_CHANNEL_ID as t };
|
|
488
|
+
export { googlechatSetupAdapter as a, resolveDefaultGoogleChatAccountId as c, googlechatSetupWizard as i, resolveGoogleChatAccount as l, createGoogleChatPluginBase as n, listEnabledGoogleChatAccounts as o, formatGoogleChatAllowFromEntry as r, listGoogleChatAccountIds as s, GOOGLECHAT_CHANNEL_ID as t, MAX_GOOGLE_CHAT_SERVICE_ACCOUNT_FILE_BYTES as u };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as googlechatPlugin } from "./channel-
|
|
1
|
+
import { t as googlechatPlugin } from "./channel-DMP6V9MO.js";
|
|
2
2
|
export { googlechatPlugin };
|