@elizaos/plugin-google-chat 2.0.0-beta.1 → 2.0.3-beta.2
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 +50 -136
- package/auto-enable.ts +1 -1
- package/package.json +21 -4
- package/dist/src/accounts.d.ts +0 -16
- package/dist/src/accounts.d.ts.map +0 -1
- package/dist/src/accounts.js +0 -163
- package/dist/src/accounts.js.map +0 -1
- package/dist/src/actions/index.d.ts +0 -1
- package/dist/src/actions/index.d.ts.map +0 -1
- package/dist/src/actions/index.js +0 -3
- package/dist/src/actions/index.js.map +0 -1
- package/dist/src/config.d.ts +0 -91
- package/dist/src/config.d.ts.map +0 -1
- package/dist/src/config.js +0 -8
- package/dist/src/config.js.map +0 -1
- package/dist/src/connector-account-provider.d.ts +0 -22
- package/dist/src/connector-account-provider.d.ts.map +0 -1
- package/dist/src/connector-account-provider.js +0 -89
- package/dist/src/connector-account-provider.js.map +0 -1
- package/dist/src/index.d.ts +0 -18
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/index.js +0 -66
- package/dist/src/index.js.map +0 -1
- package/dist/src/providers/index.d.ts +0 -1
- package/dist/src/providers/index.d.ts.map +0 -1
- package/dist/src/providers/index.js +0 -3
- package/dist/src/providers/index.js.map +0 -1
- package/dist/src/service.d.ts +0 -62
- package/dist/src/service.d.ts.map +0 -1
- package/dist/src/service.js +0 -724
- package/dist/src/service.js.map +0 -1
- package/dist/src/types.d.ts +0 -216
- package/dist/src/types.d.ts.map +0 -1
- package/dist/src/types.js +0 -144
- package/dist/src/types.js.map +0 -1
- package/dist/src/workflow-credential-provider.d.ts +0 -21
- package/dist/src/workflow-credential-provider.d.ts.map +0 -1
- package/dist/src/workflow-credential-provider.js +0 -57
- package/dist/src/workflow-credential-provider.js.map +0 -1
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
CHANGED
|
@@ -1,160 +1,74 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @elizaos/plugin-google-chat
|
|
2
2
|
|
|
3
|
-
Google Chat
|
|
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
4
|
|
|
5
|
-
|
|
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
6
|
|
|
7
|
-
|
|
8
|
-
- **Direct Messages**: Support for 1:1 DM conversations
|
|
9
|
-
- **Spaces**: Manage presence in Google Chat spaces
|
|
10
|
-
- **Threads**: Reply in threaded conversations
|
|
11
|
-
- **Reactions**: Add and remove emoji reactions
|
|
12
|
-
- **Attachments**: Upload and download media files
|
|
13
|
-
- **Webhook Support**: Receive messages via configurable webhook endpoint
|
|
7
|
+
## What it provides
|
|
14
8
|
|
|
15
|
-
|
|
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`.
|
|
16
14
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
npm install @elizaos-plugins/plugin-google-chat
|
|
21
|
-
```
|
|
22
|
-
## Prerequisites
|
|
23
|
-
|
|
24
|
-
1. **Google Cloud Project**: Create a project in the [Google Cloud Console](https://console.cloud.google.com/)
|
|
25
|
-
|
|
26
|
-
2. **Enable Google Chat API**:
|
|
27
|
-
- Go to APIs & Services > Library
|
|
28
|
-
- Search for "Google Chat API" and enable it
|
|
29
|
-
|
|
30
|
-
3. **Create a Chat App**:
|
|
31
|
-
- Go to APIs & Services > Chat API > Configuration
|
|
32
|
-
- Configure your Chat app with a webhook URL
|
|
33
|
-
|
|
34
|
-
4. **Service Account**:
|
|
35
|
-
- Go to IAM & Admin > Service Accounts
|
|
36
|
-
- Create a service account with Chat API access
|
|
37
|
-
- Download the JSON key file
|
|
38
|
-
|
|
39
|
-
5. **Configure the Chat App**:
|
|
40
|
-
- Set the App URL (webhook endpoint)
|
|
41
|
-
- Configure the audience type and value
|
|
42
|
-
|
|
43
|
-
## Configuration
|
|
44
|
-
|
|
45
|
-
### Environment Variables
|
|
46
|
-
|
|
47
|
-
| Variable | Description | Required |
|
|
48
|
-
|----------|-------------|----------|
|
|
49
|
-
| `GOOGLE_CHAT_SERVICE_ACCOUNT` | Service account JSON string | One of these |
|
|
50
|
-
| `GOOGLE_CHAT_SERVICE_ACCOUNT_FILE` | Path to service account JSON file | required |
|
|
51
|
-
| `GOOGLE_APPLICATION_CREDENTIALS` | Default credentials path | |
|
|
52
|
-
| `GOOGLE_CHAT_AUDIENCE_TYPE` | Audience type: `app-url` or `project-number` | Yes |
|
|
53
|
-
| `GOOGLE_CHAT_AUDIENCE` | Audience value for token verification | Yes |
|
|
54
|
-
| `GOOGLE_CHAT_WEBHOOK_PATH` | Webhook path (default: `/googlechat`) | No |
|
|
55
|
-
| `GOOGLE_CHAT_SPACES` | Comma-separated list of spaces | No |
|
|
56
|
-
| `GOOGLE_CHAT_REQUIRE_MENTION` | Require @mention in spaces (default: `true`) | No |
|
|
57
|
-
| `GOOGLE_CHAT_BOT_USER` | Bot user resource name | No |
|
|
58
|
-
| `GOOGLE_CHAT_ENABLED` | Enable/disable plugin (default: `true`) | No |
|
|
59
|
-
|
|
60
|
-
### Audience Configuration
|
|
61
|
-
|
|
62
|
-
**App URL (Recommended)**:
|
|
63
|
-
- Set `GOOGLE_CHAT_AUDIENCE_TYPE=app-url`
|
|
64
|
-
- Set `GOOGLE_CHAT_AUDIENCE` to your Chat app's App URL from the Cloud Console
|
|
65
|
-
|
|
66
|
-
**Project Number**:
|
|
67
|
-
- Set `GOOGLE_CHAT_AUDIENCE_TYPE=project-number`
|
|
68
|
-
- Set `GOOGLE_CHAT_AUDIENCE` to your Google Cloud project number
|
|
15
|
+
Auth uses a Google service account with scope `https://www.googleapis.com/auth/chat.bot`. There is no OAuth user flow.
|
|
69
16
|
|
|
70
17
|
## Usage
|
|
71
18
|
|
|
72
|
-
### TypeScript
|
|
73
|
-
|
|
74
19
|
```typescript
|
|
75
|
-
import googleChatPlugin from "@elizaos
|
|
76
|
-
|
|
77
|
-
const agent = createAgent({
|
|
78
|
-
plugins: [googleChatPlugin],
|
|
79
|
-
// ... other config
|
|
80
|
-
});
|
|
81
|
-
```
|
|
82
|
-
# Register with ElizaOS runtime
|
|
20
|
+
import googleChatPlugin from "@elizaos/plugin-google-chat";
|
|
83
21
|
```
|
|
84
|
-
## Actions
|
|
85
22
|
|
|
86
|
-
|
|
87
|
-
`source: "google-chat"`.
|
|
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`).
|
|
88
24
|
|
|
89
|
-
|
|
90
|
-
|----------------|-----------|-------------|
|
|
91
|
-
| `MESSAGE` | `send` | Send or thread a message in a Google Chat space |
|
|
92
|
-
| `MESSAGE` | `react` | Add or remove a reaction when the connector supports it |
|
|
93
|
-
| `MESSAGE` | `list_channels` | List spaces the bot is a member of |
|
|
94
|
-
|
|
95
|
-
## Providers
|
|
25
|
+
## Configuration
|
|
96
26
|
|
|
97
|
-
|
|
98
|
-
|
|
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.
|
|
99
45
|
|
|
100
46
|
## Events
|
|
101
47
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
|
105
|
-
|
|
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 |
|
|
106
54
|
| `GOOGLE_CHAT_SPACE_JOINED` | Bot added to a space |
|
|
107
55
|
| `GOOGLE_CHAT_SPACE_LEFT` | Bot removed from a space |
|
|
108
|
-
| `GOOGLE_CHAT_REACTION_SENT` |
|
|
109
|
-
| `GOOGLE_CHAT_CONNECTION_READY` |
|
|
110
|
-
|
|
111
|
-
## Message Limits
|
|
112
|
-
|
|
113
|
-
- **Maximum message length**: 4,000 characters
|
|
114
|
-
- **Attachments**: 20 MB per file (configurable)
|
|
115
|
-
- Messages exceeding the limit are automatically chunked
|
|
116
|
-
|
|
117
|
-
## Webhook Security
|
|
118
|
-
|
|
119
|
-
The plugin verifies incoming webhook requests using Google's authentication:
|
|
120
|
-
|
|
121
|
-
1. **App URL mode**: Verifies ID token against the configured app URL
|
|
122
|
-
2. **Project Number mode**: Verifies JWT with Google's public certificates
|
|
123
|
-
|
|
124
|
-
Requests that fail verification are rejected with 401 Unauthorized.
|
|
56
|
+
| `GOOGLE_CHAT_REACTION_SENT` | `sendReaction` succeeds |
|
|
57
|
+
| `GOOGLE_CHAT_CONNECTION_READY` | Account connected at startup |
|
|
125
58
|
|
|
126
|
-
|
|
59
|
+
`GOOGLE_CHAT_REACTION_RECEIVED` and `GOOGLE_CHAT_WEBHOOK_READY` are declared in the enum but not currently emitted.
|
|
127
60
|
|
|
128
|
-
|
|
61
|
+
## Commands
|
|
129
62
|
|
|
130
|
-
|
|
131
|
-
- **Messages**: `spaces/{space_id}/messages/{message_id}`
|
|
132
|
-
- **Users**: `users/{user_id}` or `users/app` for the bot
|
|
133
|
-
- **Threads**: `spaces/{space_id}/threads/{thread_id}`
|
|
134
|
-
- **Reactions**: `spaces/{space_id}/messages/{message_id}/reactions/{reaction_id}`
|
|
63
|
+
From `package.json`:
|
|
135
64
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
3. Ensure the service account has Chat API permissions
|
|
143
|
-
4. Verify audience type and value match your Chat app configuration
|
|
144
|
-
|
|
145
|
-
### Webhook Not Receiving Messages
|
|
146
|
-
|
|
147
|
-
1. Verify your webhook URL is accessible from the internet
|
|
148
|
-
2. Check that the webhook path matches your configuration
|
|
149
|
-
3. Ensure your server responds with 200 OK to POST requests
|
|
150
|
-
4. Verify the Chat app is properly configured in Cloud Console
|
|
151
|
-
|
|
152
|
-
### Permission Denied
|
|
153
|
-
|
|
154
|
-
1. Check service account permissions
|
|
155
|
-
2. Verify the bot is added to the target space
|
|
156
|
-
3. Ensure proper IAM roles are assigned
|
|
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
|
+
```
|
|
157
71
|
|
|
158
|
-
|
|
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.
|
|
159
73
|
|
|
160
|
-
|
|
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
CHANGED
|
@@ -8,7 +8,7 @@ import type { PluginAutoEnableContext } from "@elizaos/core";
|
|
|
8
8
|
|
|
9
9
|
/** Enable when a `googlechat` connector block is present and not explicitly disabled. */
|
|
10
10
|
export function shouldEnable(ctx: PluginAutoEnableContext): boolean {
|
|
11
|
-
const c = (ctx.config
|
|
11
|
+
const c = (ctx.config.connectors as Record<string, unknown> | undefined)
|
|
12
12
|
?.googlechat;
|
|
13
13
|
if (!c || typeof c !== "object") return false;
|
|
14
14
|
const config = c as Record<string, unknown>;
|
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.3-beta.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -9,8 +9,24 @@
|
|
|
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": [
|
|
@@ -36,10 +52,10 @@
|
|
|
36
52
|
"lint:check": "bunx @biomejs/biome check .",
|
|
37
53
|
"format": "bunx @biomejs/biome format --write .",
|
|
38
54
|
"format:check": "bunx @biomejs/biome format .",
|
|
39
|
-
"typecheck": "
|
|
55
|
+
"typecheck": "tsgo --noEmit"
|
|
40
56
|
},
|
|
41
57
|
"dependencies": {
|
|
42
|
-
"@elizaos/core": "2.0.
|
|
58
|
+
"@elizaos/core": "2.0.3-beta.2",
|
|
43
59
|
"google-auth-library": "^10.0.0",
|
|
44
60
|
"zod": "^4.4.3"
|
|
45
61
|
},
|
|
@@ -118,5 +134,6 @@
|
|
|
118
134
|
"sensitive": false
|
|
119
135
|
}
|
|
120
136
|
}
|
|
121
|
-
}
|
|
137
|
+
},
|
|
138
|
+
"gitHead": "82fe0f44215954c2417328203f5bd6510985c1fc"
|
|
122
139
|
}
|
package/dist/src/accounts.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/dist/src/accounts.js
DELETED
|
@@ -1,163 +0,0 @@
|
|
|
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
|
package/dist/src/accounts.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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,CAAC,CAAC,SAAS,CAAC;AAC9E,CAAC;AAED,SAAS,YAAY,CAAC,OAAsB,EAAE,GAAW;IACvD,OAAO,aAAa,CAAC,OAAO,EAAE,GAAG,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACzD,CAAC;AAED,SAAS,eAAe,CAAC,OAAsB;IAC7C,MAAM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AAC,CAAC,SAAS,CAAC;YACtE,EAAE;QACJ,WAAW,EAAE,WAAW,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,WAAW,EAAE;QAC1E,MAAM,EAAE,SAAS,CACf,OAAO,CAAC,MAAM;YACZ,IAAI,CAAC,MAAM;YACX,CAAC,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,OAAO,EAAE,oBAAoB,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CACvE;QACD,cAAc,EAAE,SAAS,CACvB,OAAO,CAAC,cAAc;YACpB,IAAI,CAAC,cAAc;YACnB,CAAC,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,OAAO,EAAE,6BAA6B,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,EAC/E,IAAI,CACL;QACD,OAAO,EAAE,SAAS,CAChB,OAAO,CAAC,OAAO;YACb,IAAI,CAAC,OAAO;YACZ,CAAC,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,OAAO,EAAE,qBAAqB,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,EACvE,IAAI,CACL;QACD,OAAO,EACL,OAAO,CAAC,OAAO;YACf,IAAI,CAAC,OAAO;YACZ,CAAC,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,OAAO,EAAE,sBAAsB,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;KACzE,CAAC;AACJ,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/actions/index.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/actions/index.ts"],"names":[],"mappings":";AAAA,gEAAgE"}
|
package/dist/src/config.d.ts
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
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
|
package/dist/src/config.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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,M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,QAAQ,CAAC,CAAC;IAC/B,2EAA2E;IAC3E,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,2FAA2F;IAC3F,SAAS,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;IACjC,gDAAgD;IAChD,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,mDAAmD;IACnD,sBAAsB,CAAC,EAAE,4BAA4B,CAAC;IACtD,kDAAkD;IAClD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,8BAA8B;IAC9B,OAAO,CAAC,EAAE,sBAAsB,CAAC;IACjC,wEAAwE;IACxE,qBAAqB,CAAC,EAAE,kCAAkC,CAAC;IAC3D,mEAAmE;IACnE,iBAAiB,CAAC,EAAE,KAAK,CAAC,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/src/config.js
DELETED
package/dist/src/config.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
|
@@ -1,22 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|