@elizaos/plugin-google-chat 2.0.0-alpha.6 → 2.0.11-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.
- package/LICENSE +21 -0
- package/README.md +74 -0
- package/auto-enable.ts +21 -0
- package/package.json +39 -13
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1115
- package/dist/index.js.map +0 -17
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Shaw Walters and elizaOS Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# @elizaos/plugin-google-chat
|
|
2
|
+
|
|
3
|
+
Google Chat connector for elizaOS agents. Sends and receives messages in Google Workspace spaces, DMs, and threads via the Google Chat REST API.
|
|
4
|
+
|
|
5
|
+
This package is a runtime plugin consumed by an elizaOS agent. It registers two services and a `MessageConnector` (`source: "google-chat"`); there are no actions or providers. For agent/contributor-facing detail, see [CLAUDE.md](./CLAUDE.md).
|
|
6
|
+
|
|
7
|
+
## What it provides
|
|
8
|
+
|
|
9
|
+
- Send/receive messages in spaces, threaded replies, and 1:1 DMs.
|
|
10
|
+
- Emoji reactions (`sendReaction` / `deleteReaction`), message edit (`updateMessage`) and delete (`deleteMessage`).
|
|
11
|
+
- Attachment upload (multipart to `https://chat.googleapis.com/upload/v1`) and download (`?alt=media`).
|
|
12
|
+
- Multiple concurrent bot accounts via one service instance.
|
|
13
|
+
- Inbound webhook events through `GoogleChatService.processWebhookEvent()`. This plugin does not mount its own HTTP route — the host runtime forwards events to it at the configured `webhookPath`.
|
|
14
|
+
|
|
15
|
+
Auth uses a Google service account with scope `https://www.googleapis.com/auth/chat.bot`. There is no OAuth user flow.
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
import googleChatPlugin from "@elizaos/plugin-google-chat";
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Add the plugin to the runtime's plugin list, or let auto-enable activate it when a `connectors.googlechat` block is present in the character config (see `auto-enable.ts`).
|
|
24
|
+
|
|
25
|
+
## Configuration
|
|
26
|
+
|
|
27
|
+
Resolution order: per-account character config > top-level `character.settings.googleChat` > `GOOGLE_CHAT_ACCOUNTS` JSON env var > single-account env vars (only for the `default` account).
|
|
28
|
+
|
|
29
|
+
| Env var | Required | Default | Description |
|
|
30
|
+
|---|---|---|---|
|
|
31
|
+
| `GOOGLE_CHAT_SERVICE_ACCOUNT` | One of three | — | Inline service account JSON string |
|
|
32
|
+
| `GOOGLE_CHAT_SERVICE_ACCOUNT_FILE` | One of three | — | Path to service account JSON key file |
|
|
33
|
+
| `GOOGLE_APPLICATION_CREDENTIALS` | One of three | — | ADC credentials file path (standard Google env var) |
|
|
34
|
+
| `GOOGLE_CHAT_AUDIENCE` | Yes | — | Audience value for webhook token verification by the host |
|
|
35
|
+
| `GOOGLE_CHAT_AUDIENCE_TYPE` | No | `app-url` | `app-url` or `project-number` |
|
|
36
|
+
| `GOOGLE_CHAT_WEBHOOK_PATH` | No | `/googlechat` | Webhook path for incoming events |
|
|
37
|
+
| `GOOGLE_CHAT_SPACES` | No | — | Comma-separated initial space resource names (`spaces/xxx`) |
|
|
38
|
+
| `GOOGLE_CHAT_REQUIRE_MENTION` | No | `true` | Only respond in spaces when @mentioned |
|
|
39
|
+
| `GOOGLE_CHAT_BOT_USER` | No | — | Bot user resource name (`users/xxx`) |
|
|
40
|
+
| `GOOGLE_CHAT_ENABLED` | No | `true` | Master switch for this plugin |
|
|
41
|
+
| `GOOGLE_CHAT_ACCOUNTS` | No | — | JSON array/object for multi-account config |
|
|
42
|
+
| `GOOGLE_CHAT_DEFAULT_ACCOUNT_ID` | No | `default` | Active account when multiple are configured |
|
|
43
|
+
|
|
44
|
+
Character-level config (`character.settings.googleChat`) accepts all `GoogleChatAccountConfig` fields (`src/config.ts`): per-space overrides, DM policies, reaction-notification modes, `textChunkLimit` (default 4096), `mediaMaxMb` (default 50), and heartbeat visibility.
|
|
45
|
+
|
|
46
|
+
## Events
|
|
47
|
+
|
|
48
|
+
Emitted via `runtime.emitEvent` (constants in `GoogleChatEventTypes`, `src/types.ts`):
|
|
49
|
+
|
|
50
|
+
| Event | Fired when |
|
|
51
|
+
|---|---|
|
|
52
|
+
| `GOOGLE_CHAT_MESSAGE_RECEIVED` | Webhook receives a `MESSAGE` event |
|
|
53
|
+
| `GOOGLE_CHAT_MESSAGE_SENT` | `sendMessage` succeeds |
|
|
54
|
+
| `GOOGLE_CHAT_SPACE_JOINED` | Bot added to a space |
|
|
55
|
+
| `GOOGLE_CHAT_SPACE_LEFT` | Bot removed from a space |
|
|
56
|
+
| `GOOGLE_CHAT_REACTION_SENT` | `sendReaction` succeeds |
|
|
57
|
+
| `GOOGLE_CHAT_CONNECTION_READY` | Account connected at startup |
|
|
58
|
+
|
|
59
|
+
`GOOGLE_CHAT_REACTION_RECEIVED` and `GOOGLE_CHAT_WEBHOOK_READY` are declared in the enum but not currently emitted.
|
|
60
|
+
|
|
61
|
+
## Commands
|
|
62
|
+
|
|
63
|
+
From `package.json`:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
bun run --cwd plugins/plugin-google-chat build # bunx tsc -p tsconfig.json
|
|
67
|
+
bun run --cwd plugins/plugin-google-chat test # vitest run
|
|
68
|
+
bun run --cwd plugins/plugin-google-chat lint # biome check --write --unsafe
|
|
69
|
+
bun run --cwd plugins/plugin-google-chat typecheck # tsgo --noEmit
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Messages longer than 4,000 chars (`MAX_GOOGLE_CHAT_MESSAGE_LENGTH`) can be split with `splitMessageForGoogleChat` (`src/types.ts`), which breaks on newline or word boundaries.
|
|
73
|
+
|
|
74
|
+
This plugin is separate from `@elizaos/plugin-google` (OAuth for Drive/Calendar). Auth scopes and audience models differ — do not merge.
|
package/auto-enable.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Auto-enable check for @elizaos/plugin-google-chat.
|
|
2
|
+
//
|
|
3
|
+
// Plugin manifest entry-point — referenced by package.json's
|
|
4
|
+
// `elizaos.plugin.autoEnableModule`. Keep this module light: env reads only,
|
|
5
|
+
// no service init, no transitive imports of the full plugin runtime. The
|
|
6
|
+
// auto-enable engine loads dozens of these per boot.
|
|
7
|
+
import type { PluginAutoEnableContext } from "@elizaos/core";
|
|
8
|
+
|
|
9
|
+
/** Enable when a `googlechat` connector block is present and not explicitly disabled. */
|
|
10
|
+
export function shouldEnable(ctx: PluginAutoEnableContext): boolean {
|
|
11
|
+
const c = (ctx.config.connectors as Record<string, unknown> | undefined)
|
|
12
|
+
?.googlechat;
|
|
13
|
+
if (!c || typeof c !== "object") return false;
|
|
14
|
+
const config = c as Record<string, unknown>;
|
|
15
|
+
if (config.enabled === false) return false;
|
|
16
|
+
// The full per-connector field check (service account credentials / project)
|
|
17
|
+
// lives in the central engine's isConnectorConfigured. We delegate to a
|
|
18
|
+
// simple "block present + not explicitly disabled" check here; the central
|
|
19
|
+
// engine's stricter check remains as a fallback during migration.
|
|
20
|
+
return true;
|
|
21
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elizaos/plugin-google-chat",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.11-beta.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -9,38 +9,63 @@
|
|
|
9
9
|
"./package.json": "./package.json",
|
|
10
10
|
".": {
|
|
11
11
|
"types": "./dist/index.d.ts",
|
|
12
|
+
"eliza-source": {
|
|
13
|
+
"types": "./src/index.ts",
|
|
14
|
+
"import": "./src/index.ts",
|
|
15
|
+
"default": "./src/index.ts"
|
|
16
|
+
},
|
|
12
17
|
"import": "./dist/index.js",
|
|
13
18
|
"default": "./dist/index.js"
|
|
19
|
+
},
|
|
20
|
+
"./*.css": "./dist/*.css",
|
|
21
|
+
"./*": {
|
|
22
|
+
"types": "./dist/*.d.ts",
|
|
23
|
+
"eliza-source": {
|
|
24
|
+
"types": "./src/*.ts",
|
|
25
|
+
"import": "./src/*.ts",
|
|
26
|
+
"default": "./src/*.ts"
|
|
27
|
+
},
|
|
28
|
+
"import": "./dist/*.js",
|
|
29
|
+
"default": "./dist/*.js"
|
|
14
30
|
}
|
|
15
31
|
},
|
|
16
32
|
"files": [
|
|
17
|
-
"dist"
|
|
33
|
+
"dist",
|
|
34
|
+
"auto-enable.ts"
|
|
18
35
|
],
|
|
36
|
+
"elizaos": {
|
|
37
|
+
"plugin": {
|
|
38
|
+
"autoEnableModule": "./auto-enable.ts",
|
|
39
|
+
"capabilities": [
|
|
40
|
+
"messaging"
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
},
|
|
19
44
|
"publishConfig": {
|
|
20
45
|
"access": "public"
|
|
21
46
|
},
|
|
22
47
|
"scripts": {
|
|
23
48
|
"build": "bun run build.ts",
|
|
24
|
-
"test": "vitest run
|
|
49
|
+
"test": "vitest run",
|
|
25
50
|
"test:watch": "vitest --config vitest.config.ts",
|
|
26
51
|
"lint": "bunx @biomejs/biome check --write --unsafe .",
|
|
27
52
|
"lint:check": "bunx @biomejs/biome check .",
|
|
28
53
|
"format": "bunx @biomejs/biome format --write .",
|
|
29
54
|
"format:check": "bunx @biomejs/biome format .",
|
|
30
|
-
"typecheck": "
|
|
55
|
+
"typecheck": "tsgo --noEmit"
|
|
31
56
|
},
|
|
32
57
|
"dependencies": {
|
|
33
|
-
"@elizaos/core": "2.0.
|
|
34
|
-
"google-auth-library": "^
|
|
35
|
-
"zod": "^4.3
|
|
58
|
+
"@elizaos/core": "2.0.11-beta.7",
|
|
59
|
+
"google-auth-library": "^10.0.0",
|
|
60
|
+
"zod": "^4.4.3"
|
|
36
61
|
},
|
|
37
62
|
"devDependencies": {
|
|
38
|
-
"@
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
63
|
+
"@biomejs/biome": "^2.4.14",
|
|
64
|
+
"@types/node": "^22.19.17",
|
|
65
|
+
"typescript": "^6.0.3",
|
|
66
|
+
"vitest": "^4.0.0"
|
|
42
67
|
},
|
|
43
|
-
"
|
|
68
|
+
"eliza": {
|
|
44
69
|
"platforms": [
|
|
45
70
|
"node"
|
|
46
71
|
],
|
|
@@ -109,5 +134,6 @@
|
|
|
109
134
|
"sensitive": false
|
|
110
135
|
}
|
|
111
136
|
}
|
|
112
|
-
}
|
|
137
|
+
},
|
|
138
|
+
"gitHead": "cdbc876f793d96073d7eb0d09715a031ce0cd32e"
|
|
113
139
|
}
|
package/dist/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
// stub
|