@elizaos/plugin-google-chat 2.0.3-beta.5 → 2.0.3-beta.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,16 @@
1
+ import type { IAgentRuntime } from "@elizaos/core";
2
+ import type { GoogleChatSettings } from "./types.js";
3
+ export declare const DEFAULT_GOOGLE_CHAT_ACCOUNT_ID = "default";
4
+ export type GoogleChatAccountConfig = Partial<Omit<GoogleChatSettings, "spaces" | "accountId">> & {
5
+ accountId?: string;
6
+ id?: string;
7
+ spaces?: string[] | string;
8
+ serviceAccountKey?: string;
9
+ serviceAccountKeyFile?: string;
10
+ };
11
+ export declare function normalizeGoogleChatAccountId(accountId?: unknown): string;
12
+ export declare function listGoogleChatAccountIds(runtime: IAgentRuntime): string[];
13
+ export declare function resolveDefaultGoogleChatAccountId(runtime: IAgentRuntime): string;
14
+ export declare function readGoogleChatAccountId(...sources: unknown[]): string | undefined;
15
+ export declare function resolveGoogleChatAccountSettings(runtime: IAgentRuntime, requestedAccountId?: string | null): GoogleChatSettings;
16
+ //# sourceMappingURL=accounts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accounts.d.ts","sourceRoot":"","sources":["../src/accounts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,EAA0B,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAE7E,eAAO,MAAM,8BAA8B,YAAY,CAAC;AAExD,MAAM,MAAM,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC,kBAAkB,EAAE,QAAQ,GAAG,WAAW,CAAC,CAAC,GAAG;IAChG,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IAC3B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC,CAAC;AAyEF,wBAAgB,4BAA4B,CAAC,SAAS,CAAC,EAAE,OAAO,GAAG,MAAM,CAIxE;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,EAAE,CAuBzE;AAED,wBAAgB,iCAAiC,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,CAQhF;AAED,wBAAgB,uBAAuB,CAAC,GAAG,OAAO,EAAE,OAAO,EAAE,GAAG,MAAM,GAAG,SAAS,CA6BjF;AAED,wBAAgB,gCAAgC,CAC9C,OAAO,EAAE,aAAa,EACtB,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,GACjC,kBAAkB,CA2DpB"}
@@ -0,0 +1,163 @@
1
+ export const DEFAULT_GOOGLE_CHAT_ACCOUNT_ID = "default";
2
+ function stringSetting(runtime, key) {
3
+ const value = runtime.getSetting(key);
4
+ return typeof value === "string" && value.trim() ? value.trim() : undefined;
5
+ }
6
+ function envOrSetting(runtime, key) {
7
+ return stringSetting(runtime, key) ?? process.env[key];
8
+ }
9
+ function characterConfig(runtime) {
10
+ const settings = runtime.character.settings;
11
+ const raw = settings?.googleChat ?? settings?.["google-chat"];
12
+ return raw && typeof raw === "object" ? raw : {};
13
+ }
14
+ function parseAccountsJson(runtime) {
15
+ const raw = stringSetting(runtime, "GOOGLE_CHAT_ACCOUNTS");
16
+ if (!raw)
17
+ return {};
18
+ try {
19
+ const parsed = JSON.parse(raw);
20
+ if (Array.isArray(parsed)) {
21
+ return Object.fromEntries(parsed
22
+ .filter((item) => Boolean(item) && typeof item === "object")
23
+ .map((item) => [normalizeGoogleChatAccountId(item.accountId ?? item.id), item]));
24
+ }
25
+ return parsed && typeof parsed === "object"
26
+ ? parsed
27
+ : {};
28
+ }
29
+ catch {
30
+ return {};
31
+ }
32
+ }
33
+ function allAccountConfigs(runtime) {
34
+ return {
35
+ ...(characterConfig(runtime).accounts ?? {}),
36
+ ...parseAccountsJson(runtime),
37
+ };
38
+ }
39
+ function accountConfig(runtime, accountId) {
40
+ const accounts = allAccountConfigs(runtime);
41
+ return accounts[accountId] ?? accounts[normalizeGoogleChatAccountId(accountId)] ?? {};
42
+ }
43
+ function boolValue(value, fallback = false) {
44
+ if (typeof value === "boolean")
45
+ return value;
46
+ if (typeof value === "string")
47
+ return value.trim().toLowerCase() !== "false";
48
+ return fallback;
49
+ }
50
+ function spaceList(value) {
51
+ if (Array.isArray(value))
52
+ return value.map((space) => String(space).trim()).filter(Boolean);
53
+ if (typeof value === "string") {
54
+ return value
55
+ .split(",")
56
+ .map((space) => space.trim())
57
+ .filter(Boolean);
58
+ }
59
+ return [];
60
+ }
61
+ export function normalizeGoogleChatAccountId(accountId) {
62
+ if (typeof accountId !== "string")
63
+ return DEFAULT_GOOGLE_CHAT_ACCOUNT_ID;
64
+ const trimmed = accountId.trim();
65
+ return trimmed || DEFAULT_GOOGLE_CHAT_ACCOUNT_ID;
66
+ }
67
+ export function listGoogleChatAccountIds(runtime) {
68
+ const ids = new Set();
69
+ const config = characterConfig(runtime);
70
+ if (envOrSetting(runtime, "GOOGLE_CHAT_SERVICE_ACCOUNT") ||
71
+ envOrSetting(runtime, "GOOGLE_CHAT_SERVICE_ACCOUNT_FILE") ||
72
+ process.env.GOOGLE_APPLICATION_CREDENTIALS ||
73
+ config.serviceAccount ||
74
+ config.serviceAccountFile ||
75
+ config.serviceAccountKey ||
76
+ config.serviceAccountKeyFile) {
77
+ ids.add(DEFAULT_GOOGLE_CHAT_ACCOUNT_ID);
78
+ }
79
+ for (const id of Object.keys(allAccountConfigs(runtime))) {
80
+ ids.add(normalizeGoogleChatAccountId(id));
81
+ }
82
+ return Array.from(ids.size ? ids : new Set([DEFAULT_GOOGLE_CHAT_ACCOUNT_ID])).sort((a, b) => a.localeCompare(b));
83
+ }
84
+ export function resolveDefaultGoogleChatAccountId(runtime) {
85
+ const requested = stringSetting(runtime, "GOOGLE_CHAT_DEFAULT_ACCOUNT_ID") ??
86
+ stringSetting(runtime, "GOOGLE_CHAT_ACCOUNT_ID");
87
+ if (requested)
88
+ return normalizeGoogleChatAccountId(requested);
89
+ const ids = listGoogleChatAccountIds(runtime);
90
+ return ids.includes(DEFAULT_GOOGLE_CHAT_ACCOUNT_ID) ? DEFAULT_GOOGLE_CHAT_ACCOUNT_ID : ids[0];
91
+ }
92
+ export function readGoogleChatAccountId(...sources) {
93
+ for (const source of sources) {
94
+ if (!source || typeof source !== "object")
95
+ continue;
96
+ const record = source;
97
+ const parameters = record.parameters && typeof record.parameters === "object"
98
+ ? record.parameters
99
+ : {};
100
+ const data = record.data && typeof record.data === "object"
101
+ ? record.data
102
+ : {};
103
+ const metadata = record.metadata && typeof record.metadata === "object"
104
+ ? record.metadata
105
+ : {};
106
+ const googleChat = data.googleChat && typeof data.googleChat === "object"
107
+ ? data.googleChat
108
+ : {};
109
+ const value = record.accountId ??
110
+ parameters.accountId ??
111
+ data.accountId ??
112
+ googleChat.accountId ??
113
+ metadata.accountId;
114
+ if (typeof value === "string" && value.trim())
115
+ return normalizeGoogleChatAccountId(value);
116
+ }
117
+ return undefined;
118
+ }
119
+ export function resolveGoogleChatAccountSettings(runtime, requestedAccountId) {
120
+ const accountId = normalizeGoogleChatAccountId(requestedAccountId ?? resolveDefaultGoogleChatAccountId(runtime));
121
+ const base = characterConfig(runtime);
122
+ const account = accountConfig(runtime, accountId);
123
+ const allowEnv = accountId === DEFAULT_GOOGLE_CHAT_ACCOUNT_ID;
124
+ const webhookPath = account.webhookPath ??
125
+ base.webhookPath ??
126
+ (allowEnv ? envOrSetting(runtime, "GOOGLE_CHAT_WEBHOOK_PATH") : undefined) ??
127
+ "/googlechat";
128
+ return {
129
+ accountId,
130
+ serviceAccount: account.serviceAccount ??
131
+ account.serviceAccountKey ??
132
+ base.serviceAccount ??
133
+ base.serviceAccountKey ??
134
+ (allowEnv ? envOrSetting(runtime, "GOOGLE_CHAT_SERVICE_ACCOUNT") : undefined),
135
+ serviceAccountFile: account.serviceAccountFile ??
136
+ account.serviceAccountKeyFile ??
137
+ base.serviceAccountFile ??
138
+ base.serviceAccountKeyFile ??
139
+ (allowEnv ? envOrSetting(runtime, "GOOGLE_CHAT_SERVICE_ACCOUNT_FILE") : undefined),
140
+ audienceType: (account.audienceType ??
141
+ base.audienceType ??
142
+ (allowEnv ? envOrSetting(runtime, "GOOGLE_CHAT_AUDIENCE_TYPE") : undefined) ??
143
+ "app-url"),
144
+ audience: account.audience ??
145
+ base.audience ??
146
+ (allowEnv ? envOrSetting(runtime, "GOOGLE_CHAT_AUDIENCE") : undefined) ??
147
+ "",
148
+ webhookPath: webhookPath.startsWith("/") ? webhookPath : `/${webhookPath}`,
149
+ spaces: spaceList(account.spaces ??
150
+ base.spaces ??
151
+ (allowEnv ? envOrSetting(runtime, "GOOGLE_CHAT_SPACES") : undefined)),
152
+ requireMention: boolValue(account.requireMention ??
153
+ base.requireMention ??
154
+ (allowEnv ? envOrSetting(runtime, "GOOGLE_CHAT_REQUIRE_MENTION") : undefined), true),
155
+ enabled: boolValue(account.enabled ??
156
+ base.enabled ??
157
+ (allowEnv ? envOrSetting(runtime, "GOOGLE_CHAT_ENABLED") : undefined), true),
158
+ botUser: account.botUser ??
159
+ base.botUser ??
160
+ (allowEnv ? envOrSetting(runtime, "GOOGLE_CHAT_BOT_USER") : undefined),
161
+ };
162
+ }
163
+ //# sourceMappingURL=accounts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accounts.js","sourceRoot":"","sources":["../src/accounts.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,8BAA8B,GAAG,SAAS,CAAC;AAcxD,SAAS,aAAa,CAAC,OAAsB,EAAE,GAAW;IACxD,MAAM,KAAK,GAAG,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;IACtC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,C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":"","sources":["../../src/actions/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // Google Chat messaging routes through MESSAGE connector hooks.
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/actions/index.ts"],"names":[],"mappings":";AAAA,gEAAgE"}
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Google Chat plugin configuration types.
3
+ *
4
+ * These types define the configuration schema for the Google Chat plugin.
5
+ * Shared base types are imported from @elizaos/core.
6
+ */
7
+ import type { BlockStreamingCoalesceConfig, ChannelHeartbeatVisibilityConfig, DmConfig, DmPolicy, GroupPolicy, GroupToolPolicyBySenderConfig, GroupToolPolicyConfig, MarkdownConfig, ProviderCommandsConfig } from "@elizaos/core";
8
+ export type GoogleChatReactionNotificationMode = "off" | "own" | "all" | "allowlist";
9
+ export type GoogleChatActionConfig = {
10
+ reactions?: boolean;
11
+ sendMessage?: boolean;
12
+ /** Enable Card messages for structured responses (default: true). */
13
+ cards?: boolean;
14
+ };
15
+ export type GoogleChatSpaceConfig = {
16
+ enabled?: boolean;
17
+ requireMention?: boolean;
18
+ tools?: GroupToolPolicyConfig;
19
+ toolsBySender?: GroupToolPolicyBySenderConfig;
20
+ };
21
+ export type GoogleChatAccountConfig = {
22
+ /** Optional display name for this account (used in CLI/UI lists). */
23
+ name?: string;
24
+ /** Optional provider capability tags used for agent/runtime guidance. */
25
+ capabilities?: string[];
26
+ /** Markdown formatting overrides (tables). */
27
+ markdown?: MarkdownConfig;
28
+ /** Override native command registration for Google Chat (bool or "auto"). */
29
+ commands?: ProviderCommandsConfig;
30
+ /** Allow channel-initiated config writes (default: true). */
31
+ configWrites?: boolean;
32
+ /** If false, do not start this Google Chat account. Default: true. */
33
+ enabled?: boolean;
34
+ /**
35
+ * Path to Google service account JSON key file.
36
+ * Required for Google Chat API authentication.
37
+ */
38
+ serviceAccountKeyFile?: string;
39
+ /** Service account credentials as inline JSON (alternative to keyFile). */
40
+ serviceAccountKey?: string;
41
+ /** Project ID for Google Cloud project (auto-detected from key if not set). */
42
+ projectId?: string;
43
+ /** Webhook mode: endpoint path for Pub/Sub push (default: /google-chat/webhook). */
44
+ webhookPath?: string;
45
+ /** Pub/Sub subscription name for pull mode (alternative to webhook push). */
46
+ pubsubSubscription?: string;
47
+ /** Direct message (1:1 DM) access policy (default: pairing). */
48
+ dmPolicy?: DmPolicy;
49
+ /** Optional allowlist for Google Chat DM senders (user resource name). */
50
+ allowFrom?: Array<string | number>;
51
+ /** Optional allowlist for Google Chat space senders (user resource name). */
52
+ groupAllowFrom?: Array<string | number>;
53
+ /**
54
+ * Controls how space messages are handled:
55
+ * - "open": spaces bypass allowFrom, only @mention-gating applies
56
+ * - "disabled": block all space messages
57
+ * - "allowlist": only allow messages from senders in groupAllowFrom/allowFrom
58
+ */
59
+ groupPolicy?: GroupPolicy;
60
+ /** Max space messages to keep as history context (0 disables). */
61
+ historyLimit?: number;
62
+ /** Max DM turns to keep as history context. */
63
+ dmHistoryLimit?: number;
64
+ /** Per-DM config overrides keyed by user ID. */
65
+ dms?: Record<string, DmConfig>;
66
+ /** Outbound text chunk size (chars). Default: 4096 (Google Chat limit). */
67
+ textChunkLimit?: number;
68
+ /** Chunking mode: "length" (default) splits by size; "newline" splits on every newline. */
69
+ chunkMode?: "length" | "newline";
70
+ /** Disable block streaming for this account. */
71
+ blockStreaming?: boolean;
72
+ /** Merge streamed block replies before sending. */
73
+ blockStreamingCoalesce?: BlockStreamingCoalesceConfig;
74
+ /** Maximum media file size in MB. Default: 50. */
75
+ mediaMaxMb?: number;
76
+ /** Per-action tool gating. */
77
+ actions?: GoogleChatActionConfig;
78
+ /** Reaction notification mode (off|own|all|allowlist). Default: off. */
79
+ reactionNotifications?: GoogleChatReactionNotificationMode;
80
+ /** Allowlist for reaction notifications when mode is allowlist. */
81
+ reactionAllowlist?: Array<string | number>;
82
+ /** Per-space config overrides keyed by space name (spaces/xxx). */
83
+ spaces?: Record<string, GoogleChatSpaceConfig>;
84
+ /** Heartbeat visibility settings for this channel. */
85
+ heartbeat?: ChannelHeartbeatVisibilityConfig;
86
+ };
87
+ export type GoogleChatConfig = {
88
+ /** Optional per-account Google Chat configuration (multi-account). */
89
+ accounts?: Record<string, GoogleChatAccountConfig>;
90
+ } & GoogleChatAccountConfig;
91
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,4BAA4B,EAC5B,gCAAgC,EAChC,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,6BAA6B,EAC7B,qBAAqB,EACrB,cAAc,EACd,sBAAsB,EACvB,MAAM,eAAe,CAAC;AAMvB,MAAM,MAAM,kCAAkC,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,WAAW,CAAC;AAMrF,MAAM,MAAM,sBAAsB,GAAG;IACnC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,qEAAqE;IACrE,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAMF,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,KAAK,CAAC,EAAE,qBAAqB,CAAC;IAC9B,aAAa,CAAC,EAAE,6BAA6B,CAAC;CAC/C,CAAC;AAMF,MAAM,MAAM,uBAAuB,GAAG;IACpC,qEAAqE;IACrE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,yEAAyE;IACzE,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,sBAAsB,CAAC;IAClC,6DAA6D;IAC7D,YAAY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,MAAM,GAAG,MAAM,CAAC,CAAC;IAC3C,mEAAmE;IACnE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC;IAC/C,sDAAsD;IACtD,SAAS,CAAC,EAAE,gCAAgC,CAAC;CAC9C,CAAC;AAMF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,sEAAsE;IACtE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC;CACpD,GAAG,uBAAuB,CAAC"}
package/dist/config.js ADDED
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Google Chat plugin configuration types.
3
+ *
4
+ * These types define the configuration schema for the Google Chat plugin.
5
+ * Shared base types are imported from @elizaos/core.
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Google Chat ConnectorAccountManager provider.
3
+ *
4
+ * Adapts the multi-account scaffolding in `accounts.ts` to the
5
+ * `ConnectorAccountProvider` contract from
6
+ * `@elizaos/core/connectors/account-manager`.
7
+ *
8
+ * Source of truth for accounts is character settings (`character.settings.googleChat`)
9
+ * + GOOGLE_CHAT_ACCOUNTS JSON env var + single-account env vars
10
+ * (GOOGLE_CHAT_SERVICE_ACCOUNT, GOOGLE_CHAT_SERVICE_ACCOUNT_FILE).
11
+ *
12
+ * AccountKey is the service-account email (best-effort extracted from the
13
+ * service-account JSON when available, otherwise the configured accountId).
14
+ * Role is `AGENT` since service-account creds authenticate the bot, not a user.
15
+ *
16
+ * Note: this overlaps with plugin-google's OAuth scopes but is a separate
17
+ * plugin scoped to Google Workspace Chat — keep separate.
18
+ */
19
+ import type { ConnectorAccountProvider, IAgentRuntime } from "@elizaos/core";
20
+ export declare const GOOGLE_CHAT_PROVIDER_ID = "google-chat";
21
+ export declare function createGoogleChatConnectorAccountProvider(runtime: IAgentRuntime): ConnectorAccountProvider;
22
+ //# sourceMappingURL=connector-account-provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connector-account-provider.d.ts","sourceRoot":"","sources":["../src/connector-account-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAIV,wBAAwB,EACxB,aAAa,EACd,MAAM,eAAe,CAAC;AASvB,eAAO,MAAM,uBAAuB,gBAAgB,CAAC;AAsCrD,wBAAgB,wCAAwC,CACtD,OAAO,EAAE,aAAa,GACrB,wBAAwB,CAqC1B"}
@@ -0,0 +1,89 @@
1
+ /**
2
+ * Google Chat ConnectorAccountManager provider.
3
+ *
4
+ * Adapts the multi-account scaffolding in `accounts.ts` to the
5
+ * `ConnectorAccountProvider` contract from
6
+ * `@elizaos/core/connectors/account-manager`.
7
+ *
8
+ * Source of truth for accounts is character settings (`character.settings.googleChat`)
9
+ * + GOOGLE_CHAT_ACCOUNTS JSON env var + single-account env vars
10
+ * (GOOGLE_CHAT_SERVICE_ACCOUNT, GOOGLE_CHAT_SERVICE_ACCOUNT_FILE).
11
+ *
12
+ * AccountKey is the service-account email (best-effort extracted from the
13
+ * service-account JSON when available, otherwise the configured accountId).
14
+ * Role is `AGENT` since service-account creds authenticate the bot, not a user.
15
+ *
16
+ * Note: this overlaps with plugin-google's OAuth scopes but is a separate
17
+ * plugin scoped to Google Workspace Chat — keep separate.
18
+ */
19
+ import { DEFAULT_GOOGLE_CHAT_ACCOUNT_ID, listGoogleChatAccountIds, normalizeGoogleChatAccountId, resolveGoogleChatAccountSettings, } from "./accounts.js";
20
+ export const GOOGLE_CHAT_PROVIDER_ID = "google-chat";
21
+ function extractServiceAccountEmail(serviceAccount) {
22
+ if (!serviceAccount)
23
+ return undefined;
24
+ try {
25
+ const parsed = JSON.parse(serviceAccount);
26
+ return typeof parsed.client_email === "string" ? parsed.client_email : undefined;
27
+ }
28
+ catch {
29
+ return undefined;
30
+ }
31
+ }
32
+ function toConnectorAccount(settings) {
33
+ const now = Date.now();
34
+ const configured = Boolean(settings.serviceAccount || settings.serviceAccountFile);
35
+ const email = extractServiceAccountEmail(settings.serviceAccount);
36
+ return {
37
+ id: normalizeGoogleChatAccountId(settings.accountId),
38
+ provider: GOOGLE_CHAT_PROVIDER_ID,
39
+ label: email ?? settings.botUser ?? settings.accountId ?? DEFAULT_GOOGLE_CHAT_ACCOUNT_ID,
40
+ role: "AGENT",
41
+ purpose: ["messaging"],
42
+ accessGate: "open",
43
+ status: settings.enabled !== false && configured ? "connected" : "disabled",
44
+ externalId: email ?? undefined,
45
+ displayHandle: email ?? settings.botUser ?? undefined,
46
+ createdAt: now,
47
+ updatedAt: now,
48
+ metadata: {
49
+ audienceType: settings.audienceType,
50
+ audience: settings.audience,
51
+ webhookPath: settings.webhookPath,
52
+ requireMention: settings.requireMention,
53
+ botUser: settings.botUser ?? "",
54
+ },
55
+ };
56
+ }
57
+ export function createGoogleChatConnectorAccountProvider(runtime) {
58
+ return {
59
+ provider: GOOGLE_CHAT_PROVIDER_ID,
60
+ label: "Google Chat",
61
+ listAccounts: async (_manager) => {
62
+ const ids = listGoogleChatAccountIds(runtime);
63
+ if (ids.length === 0) {
64
+ return [
65
+ toConnectorAccount(resolveGoogleChatAccountSettings(runtime, DEFAULT_GOOGLE_CHAT_ACCOUNT_ID)),
66
+ ];
67
+ }
68
+ return ids.map((id) => toConnectorAccount(resolveGoogleChatAccountSettings(runtime, id)));
69
+ },
70
+ createAccount: async (input, _manager) => {
71
+ return {
72
+ ...input,
73
+ provider: GOOGLE_CHAT_PROVIDER_ID,
74
+ role: input.role ?? "AGENT",
75
+ purpose: input.purpose ?? ["messaging"],
76
+ accessGate: input.accessGate ?? "open",
77
+ status: input.status ?? "pending",
78
+ };
79
+ },
80
+ patchAccount: async (_accountId, patch, _manager) => {
81
+ return { ...patch, provider: GOOGLE_CHAT_PROVIDER_ID };
82
+ },
83
+ deleteAccount: async (_accountId, _manager) => {
84
+ // Provider-layer account deletion returns cleanly; service-account credentials live in
85
+ // character settings; deletion of those is out of band.
86
+ },
87
+ };
88
+ }
89
+ //# sourceMappingURL=connector-account-provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connector-account-provider.js","sourceRoot":"","sources":["../src/connector-account-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AASH,OAAO,EACL,8BAA8B,EAC9B,wBAAwB,EACxB,4BAA4B,EAC5B,gCAAgC,GACjC,MAAM,eAAe,CAAC;AAGvB,MAAM,CAAC,MAAM,uBAAuB,GAAG,aAAa,CAAC;AAErD,SAAS,0BAA0B,CAAC,cAAuB;IACzD,IAAI,CAAC,cAAc;QAAE,OAAO,SAAS,CAAC;IACtC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAA8B,CAAC;QACvE,OAAO,OAAO,MAAM,CAAC,YAAY,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC;IACnF,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAED,SAAS,kBAAkB,CAAC,QAA4B;IACtD,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACvB,MAAM,UAAU,GAAG,OAAO,CAAC,QAAQ,CAAC,cAAc,IAAI,QAAQ,CAAC,kBAAkB,CAAC,CAAC;IACnF,MAAM,KAAK,GAAG,0BAA0B,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;IAClE,OAAO;QACL,EAAE,EAAE,4BAA4B,CAAC,QAAQ,CAAC,SAAS,CAAC;QACpD,QAAQ,EAAE,uBAAuB;QACjC,KAAK,EAAE,KAAK,IAAI,QAAQ,CAAC,OAAO,IAAI,QAAQ,CAAC,SAAS,IAAI,8BAA8B;QACxF,IAAI,EAAE,OAAO;QACb,OAAO,E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,OAAO;gBAC3B,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,CAAC,WAAW,CAAC;gBACvC,UAAU,EAAE,KAAK,CAAC,UAAU,IAAI,MAAM;gBACtC,MAAM,EAAE,KAAK,CAAC,MAAM,IAAI,SAAS;aAClC,CAAC;QACJ,CAAC;QACD,YAAY,EAAE,KAAK,EACjB,UAAkB,EAClB,KAA4B,EAC5B,QAAiC,EACjC,EAAE;YACF,OAAO,EAAE,GAAG,KAAK,EAAE,QAAQ,EAAE,uBAAuB,EAAE,CAAC;QACzD,CAAC;QACD,aAAa,EAAE,KAAK,EAAE,UAAkB,EAAE,QAAiC,EAAE,EAAE;YAC7E,uFAAuF;YACvF,wDAAwD;QAC1D,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Google Chat Plugin for ElizaOS
3
+ *
4
+ * Provides Google Chat messaging integration for ElizaOS agents,
5
+ * supporting spaces, direct messages, threads, and reactions.
6
+ */
7
+ import type { Plugin } from "@elizaos/core";
8
+ import { GoogleChatService } from "./service.js";
9
+ export * from "./accounts.js";
10
+ export * from "./types.js";
11
+ export { GoogleChatService };
12
+ /**
13
+ * Google Chat plugin definition
14
+ */
15
+ declare const googleChatPlugin: Plugin;
16
+ export default googleChatPlugin;
17
+ export type { GoogleChatAccountConfig, GoogleChatActionConfig, GoogleChatConfig, GoogleChatReactionNotificationMode, GoogleChatSpaceConfig, } from "./config.js";
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAiB,MAAM,EAAE,MAAM,eAAe,CAAC;AAG3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAGjD,cAAc,eAAe,CAAC;AAI9B,cAAc,YAAY,CAAC;AAE3B,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAE7B;;GAEG;AACH,QAAA,MAAM,gBAAgB,EAAE,MA6EvB,CAAC;AAEF,eAAe,gBAAgB,CAAC;AAGhC,YAAY,EACV,uBAAuB,EACvB,sBAAsB,EACtB,gBAAgB,EAChB,kCAAkC,EAClC,qBAAqB,GACtB,MAAM,aAAa,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Google Chat Plugin for ElizaOS
3
+ *
4
+ * Provides Google Chat messaging integration for ElizaOS agents,
5
+ * supporting spaces, direct messages, threads, and reactions.
6
+ */
7
+ import { getConnectorAccountManager, logger } from "@elizaos/core";
8
+ import { createGoogleChatConnectorAccountProvider } from "./connector-account-provider.js";
9
+ import { GoogleChatService } from "./service.js";
10
+ import { GoogleChatWorkflowCredentialProvider } from "./workflow-credential-provider.js";
11
+ export * from "./accounts.js";
12
+ // Message, space listing, and reaction operations route through MESSAGE via
13
+ // the MessageConnector registered by GoogleChatService.
14
+ // Export types
15
+ export * from "./types.js";
16
+ // Export service
17
+ export { GoogleChatService };
18
+ /**
19
+ * Google Chat plugin definition
20
+ */
21
+ const googleChatPlugin = {
22
+ name: "google-chat",
23
+ description: "Google Chat integration plugin for ElizaOS agents",
24
+ services: [GoogleChatService, GoogleChatWorkflowCredentialProvider],
25
+ actions: [],
26
+ providers: [],
27
+ tests: [],
28
+ // Self-declared auto-enable: activate when the "googlechat" connector is
29
+ // configured under config.connectors. The hardcoded CONNECTOR_PLUGINS map
30
+ // in plugin-auto-enable-engine.ts still serves as a fallback.
31
+ autoEnable: {
32
+ connectorKeys: ["googlechat"],
33
+ },
34
+ async dispose(runtime) {
35
+ await runtime.getService(GoogleChatService.serviceType)?.stop();
36
+ await runtime
37
+ .getService(GoogleChatWorkflowCredentialProvider.serviceType)
38
+ ?.stop();
39
+ },
40
+ /**
41
+ * Plugin initialization hook
42
+ */
43
+ init: async (config, runtime) => {
44
+ logger.info("Initializing Google Chat plugin...");
45
+ try {
46
+ const manager = getConnectorAccountManager(runtime);
47
+ manager.registerProvider(createGoogleChatConnectorAccountProvider(runtime));
48
+ }
49
+ catch (err) {
50
+ logger.warn({
51
+ src: "plugin:google-chat",
52
+ err: err instanceof Error ? err.message : String(err),
53
+ }, "Failed to register Google Chat provider with ConnectorAccountManager");
54
+ }
55
+ // Log configuration status
56
+ const serviceAccount = config.GOOGLE_CHAT_SERVICE_ACCOUNT || process.env.GOOGLE_CHAT_SERVICE_ACCOUNT;
57
+ const serviceAccountFile = config.GOOGLE_CHAT_SERVICE_ACCOUNT_FILE || process.env.GOOGLE_CHAT_SERVICE_ACCOUNT_FILE;
58
+ const hasCredentials = Boolean(serviceAccount || serviceAccountFile || process.env.GOOGLE_APPLICATION_CREDENTIALS);
59
+ logger.info(`Google Chat plugin configuration:`);
60
+ logger.info(` - Credentials configured: ${hasCredentials ? "Yes" : "No"}`);
61
+ logger.info(` - Audience type: ${config.GOOGLE_CHAT_AUDIENCE_TYPE || process.env.GOOGLE_CHAT_AUDIENCE_TYPE || "(not set)"}`);
62
+ logger.info(` - Audience: ${config.GOOGLE_CHAT_AUDIENCE || process.env.GOOGLE_CHAT_AUDIENCE ? "(set)" : "(not set)"}`);
63
+ logger.info(` - Webhook path: ${config.GOOGLE_CHAT_WEBHOOK_PATH || process.env.GOOGLE_CHAT_WEBHOOK_PATH || "/googlechat"}`);
64
+ if (!hasCredentials) {
65
+ logger.warn("Google Chat service account credentials not configured. " +
66
+ "Set GOOGLE_CHAT_SERVICE_ACCOUNT, GOOGLE_CHAT_SERVICE_ACCOUNT_FILE, or GOOGLE_APPLICATION_CREDENTIALS.");
67
+ }
68
+ logger.info("Google Chat plugin initialized");
69
+ },
70
+ };
71
+ export default googleChatPlugin;
72
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,0BAA0B,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACnE,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"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/providers/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // Google Chat spaces are exposed through MESSAGE list_channels.
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/providers/index.ts"],"names":[],"mappings":";AAAA,gEAAgE"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Google Chat service implementation for ElizaOS.
3
+ */
4
+ import { type Content, type IAgentRuntime, Service } from "@elizaos/core";
5
+ import { type GoogleChatEvent, type GoogleChatMessageSendOptions, type GoogleChatReaction, type GoogleChatSendResult, type GoogleChatSettings, type GoogleChatSpace, type IGoogleChatService } from "./types.js";
6
+ export declare class GoogleChatService extends Service implements IGoogleChatService {
7
+ static serviceType: string;
8
+ capabilityDescription: string;
9
+ private states;
10
+ private defaultAccountId;
11
+ static start(runtime: IAgentRuntime): Promise<GoogleChatService>;
12
+ static registerSendHandlers(runtime: IAgentRuntime, service: GoogleChatService, accountId?: string): void;
13
+ stop(): Promise<void>;
14
+ private loadSettings;
15
+ private validateSettings;
16
+ private createAuth;
17
+ private testConnection;
18
+ isConnected(): boolean;
19
+ getAccountId(runtime?: IAgentRuntime): string;
20
+ getBotUser(): string | undefined;
21
+ getAccessToken(accountId?: string): Promise<string>;
22
+ private fetchApi;
23
+ getSpaces(accountId?: string): Promise<GoogleChatSpace[]>;
24
+ sendMessage(options: GoogleChatMessageSendOptions): Promise<GoogleChatSendResult>;
25
+ updateMessage(messageName: string, text: string, accountId?: string): Promise<{
26
+ success: boolean;
27
+ messageName?: string;
28
+ error?: string;
29
+ }>;
30
+ deleteMessage(messageName: string, accountId?: string): Promise<{
31
+ success: boolean;
32
+ error?: string;
33
+ }>;
34
+ sendReaction(messageName: string, emoji: string, accountId?: string): Promise<{
35
+ success: boolean;
36
+ name?: string;
37
+ error?: string;
38
+ }>;
39
+ deleteReaction(reactionName: string, accountId?: string): Promise<{
40
+ success: boolean;
41
+ error?: string;
42
+ }>;
43
+ listReactions(messageName: string, limit?: number, accountId?: string): Promise<GoogleChatReaction[]>;
44
+ findDirectMessage(userName: string, accountId?: string): Promise<GoogleChatSpace | null>;
45
+ uploadAttachment(space: string, filename: string, buffer: Buffer, contentType?: string, accountId?: string): Promise<{
46
+ attachmentUploadToken?: string;
47
+ }>;
48
+ downloadMedia(resourceName: string, maxBytes?: number, accountId?: string): Promise<{
49
+ buffer: Buffer;
50
+ contentType?: string;
51
+ }>;
52
+ getSettings(): GoogleChatSettings | null;
53
+ sendDirectMessage(target: string, content: Content): Promise<void>;
54
+ sendRoomMessage(target: string, content: Content): Promise<void>;
55
+ private handleSendMessage;
56
+ private sendConnectorDirectMessage;
57
+ private sendConnectorContent;
58
+ private listConnectorSpaces;
59
+ processWebhookEvent(event: GoogleChatEvent, accountId?: string): Promise<void>;
60
+ private getState;
61
+ }
62
+ //# sourceMappingURL=service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,KAAK,OAAO,EAEZ,KAAK,aAAa,EAMlB,OAAO,EAGR,MAAM,eAAe,CAAC;AAUvB,OAAO,EAKL,KAAK,eAAe,EAEpB,KAAK,4BAA4B,EACjC,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,eAAe,EAEpB,KAAK,kBAAkB,EAIxB,MAAM,YAAY,CAAC;AAkLpB,qBAAa,iBAAkB,SAAQ,OAAQ,YAAW,kBAAkB;IAC1E,MAAM,CAAC,WAAW,SAA4B;IAE9C,qBAAqB,SAC0D;IAE/E,OAAO,CAAC,MAAM,CAA6C;IAC3D,OAAO,CAAC,gBAAgB,CAAkC;WAE7C,KAAK,CAA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