@framers/agentos-ext-channel-google-chat 0.1.0 → 0.1.1
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 +96 -21
- package/dist/index.d.ts +40 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +415 -0
- package/dist/index.js.map +1 -0
- package/manifest.json +1 -1
- package/package.json +9 -5
package/LICENSE
CHANGED
|
@@ -1,23 +1,98 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
|
10
|
+
|
|
11
|
+
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
|
12
|
+
|
|
13
|
+
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
|
14
|
+
|
|
15
|
+
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
|
16
|
+
|
|
17
|
+
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
|
18
|
+
|
|
19
|
+
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
|
20
|
+
|
|
21
|
+
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
|
|
22
|
+
|
|
23
|
+
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
|
24
|
+
|
|
25
|
+
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
|
26
|
+
|
|
27
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
|
28
|
+
|
|
29
|
+
2. Grant of Copyright License.
|
|
30
|
+
|
|
31
|
+
Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
|
32
|
+
|
|
33
|
+
3. Grant of Patent License.
|
|
34
|
+
|
|
35
|
+
Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
|
36
|
+
|
|
37
|
+
4. Redistribution.
|
|
38
|
+
|
|
39
|
+
You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
|
40
|
+
|
|
41
|
+
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
|
42
|
+
|
|
43
|
+
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and
|
|
44
|
+
|
|
45
|
+
(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
|
|
46
|
+
|
|
47
|
+
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
|
|
48
|
+
|
|
49
|
+
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
|
50
|
+
|
|
51
|
+
5. Submission of Contributions.
|
|
52
|
+
|
|
53
|
+
Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
|
54
|
+
|
|
55
|
+
6. Trademarks.
|
|
56
|
+
|
|
57
|
+
This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
|
58
|
+
|
|
59
|
+
7. Disclaimer of Warranty.
|
|
60
|
+
|
|
61
|
+
Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
|
62
|
+
|
|
63
|
+
8. Limitation of Liability.
|
|
64
|
+
|
|
65
|
+
In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
|
66
|
+
|
|
67
|
+
9. Accepting Warranty or Additional Liability.
|
|
68
|
+
|
|
69
|
+
While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
|
70
|
+
|
|
71
|
+
END OF TERMS AND CONDITIONS
|
|
72
|
+
|
|
73
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
74
|
+
|
|
75
|
+
To apply the Apache License to your work, attach the following
|
|
76
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
77
|
+
replaced with your own identifying information. (Don't include
|
|
78
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
79
|
+
comment syntax for the file format. We also recommend that a
|
|
80
|
+
file or class name and description of purpose be included on the
|
|
81
|
+
same "printed page" as the copyright notice for easier
|
|
82
|
+
identification within third-party archives.
|
|
83
|
+
|
|
84
|
+
Copyright (c) 2025 Framers
|
|
85
|
+
|
|
86
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
87
|
+
you may not use this file except in compliance with the License.
|
|
88
|
+
You may obtain a copy of the License at
|
|
89
|
+
|
|
90
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
91
|
+
|
|
92
|
+
Unless required by applicable law or agreed to in writing, software
|
|
93
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
94
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
95
|
+
See the License for the specific language governing permissions and
|
|
96
|
+
limitations under the License.
|
|
22
97
|
|
|
23
98
|
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Google Chat Channel Extension for AgentOS.
|
|
3
|
+
*
|
|
4
|
+
* Implements:
|
|
5
|
+
* - Outbound messages via Google Chat API (service account, chat.bot scope)
|
|
6
|
+
* - Inbound messages via Google Chat HTTP webhook (JWT bearer verification)
|
|
7
|
+
*
|
|
8
|
+
* @module @framers/agentos-ext-channel-google-chat
|
|
9
|
+
*/
|
|
10
|
+
import type { ExtensionContext, ExtensionPack } from '@framers/agentos';
|
|
11
|
+
export type GoogleChatAudienceType = 'app-url' | 'project-number';
|
|
12
|
+
export interface GoogleChatChannelOptions {
|
|
13
|
+
serviceAccountJson?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Webhook path handled by this extension.
|
|
16
|
+
* @default "/google-chat-webhook"
|
|
17
|
+
*/
|
|
18
|
+
webhookPath?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Audience verification mode for inbound webhooks.
|
|
21
|
+
* - "app-url": verifyIdToken(audience=webhookUrl)
|
|
22
|
+
* - "project-number": verifySignedJwtWithCertsAsync(audience=projectNumber)
|
|
23
|
+
*/
|
|
24
|
+
audienceType?: GoogleChatAudienceType;
|
|
25
|
+
/**
|
|
26
|
+
* Audience value used for verification:
|
|
27
|
+
* - app-url: the full webhook URL (https://.../google-chat-webhook)
|
|
28
|
+
* - project-number: the numeric GCP project number
|
|
29
|
+
*/
|
|
30
|
+
audience?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Max webhook body size in bytes.
|
|
33
|
+
* @default 1048576 (1MB)
|
|
34
|
+
*/
|
|
35
|
+
maxBodyBytes?: number;
|
|
36
|
+
priority?: number;
|
|
37
|
+
}
|
|
38
|
+
export declare function createExtensionPack(context: ExtensionContext): ExtensionPack;
|
|
39
|
+
export default createExtensionPack;
|
|
40
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAUV,gBAAgB,EAChB,aAAa,EAQd,MAAM,kBAAkB,CAAC;AAE1B,MAAM,MAAM,sBAAsB,GAAG,SAAS,GAAG,gBAAgB,CAAC;AAElE,MAAM,WAAW,wBAAwB;IACvC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,YAAY,CAAC,EAAE,sBAAsB,CAAC;IACtC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAsWD,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,gBAAgB,GAAG,aAAa,CAuG5E;AAED,eAAe,mBAAmB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,415 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
/**
|
|
4
|
+
* @fileoverview Google Chat Channel Extension for AgentOS.
|
|
5
|
+
*
|
|
6
|
+
* Implements:
|
|
7
|
+
* - Outbound messages via Google Chat API (service account, chat.bot scope)
|
|
8
|
+
* - Inbound messages via Google Chat HTTP webhook (JWT bearer verification)
|
|
9
|
+
*
|
|
10
|
+
* @module @framers/agentos-ext-channel-google-chat
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.createExtensionPack = createExtensionPack;
|
|
14
|
+
const google_auth_library_1 = require("google-auth-library");
|
|
15
|
+
const CHAT_SCOPE = 'https://www.googleapis.com/auth/chat.bot';
|
|
16
|
+
const CHAT_ISSUER = 'chat@system.gserviceaccount.com';
|
|
17
|
+
const ADDON_ISSUER_PATTERN = /^service-\\d+@gcp-sa-gsuiteaddons\\.iam\\.gserviceaccount\\.com$/;
|
|
18
|
+
const CHAT_CERTS_URL = 'https://www.googleapis.com/service_accounts/v1/metadata/x509/chat@system.gserviceaccount.com';
|
|
19
|
+
const DEFAULT_WEBHOOK_PATH = '/google-chat-webhook';
|
|
20
|
+
const DEFAULT_MAX_BODY_BYTES = 1024 * 1024;
|
|
21
|
+
const verifyClient = new google_auth_library_1.OAuth2Client();
|
|
22
|
+
let cachedCerts = null;
|
|
23
|
+
function normalizeWebhookPath(raw) {
|
|
24
|
+
const v = typeof raw === 'string' ? raw.trim() : '';
|
|
25
|
+
if (!v)
|
|
26
|
+
return DEFAULT_WEBHOOK_PATH;
|
|
27
|
+
const withSlash = v.startsWith('/') ? v : `/${v}`;
|
|
28
|
+
return withSlash.length > 1 && withSlash.endsWith('/') ? withSlash.slice(0, -1) : withSlash;
|
|
29
|
+
}
|
|
30
|
+
function resolveServiceAccount(options, secrets) {
|
|
31
|
+
if (options.serviceAccountJson)
|
|
32
|
+
return options.serviceAccountJson;
|
|
33
|
+
if (secrets?.['googlechat.serviceAccount'])
|
|
34
|
+
return secrets['googlechat.serviceAccount'];
|
|
35
|
+
// Support both secretIdToEnvVar(GOOGLECHAT_SERVICE_ACCOUNT) and docs env name.
|
|
36
|
+
if (process.env['GOOGLECHAT_SERVICE_ACCOUNT'])
|
|
37
|
+
return process.env['GOOGLECHAT_SERVICE_ACCOUNT'];
|
|
38
|
+
if (process.env['GOOGLE_CHAT_SERVICE_ACCOUNT'])
|
|
39
|
+
return process.env['GOOGLE_CHAT_SERVICE_ACCOUNT'];
|
|
40
|
+
throw new Error('Google Chat service account JSON not found. Provide via options.serviceAccountJson, secrets["googlechat.serviceAccount"], GOOGLECHAT_SERVICE_ACCOUNT, or GOOGLE_CHAT_SERVICE_ACCOUNT.');
|
|
41
|
+
}
|
|
42
|
+
function resolveAudienceType(options) {
|
|
43
|
+
const raw = options.audienceType ?? process.env['GOOGLE_CHAT_AUDIENCE_TYPE'];
|
|
44
|
+
const v = typeof raw === 'string' ? raw.trim().toLowerCase() : '';
|
|
45
|
+
if (v === 'app-url' || v === 'app_url' || v === 'app')
|
|
46
|
+
return 'app-url';
|
|
47
|
+
if (v === 'project-number' || v === 'project_number' || v === 'project')
|
|
48
|
+
return 'project-number';
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
function resolveAudience(options) {
|
|
52
|
+
const raw = options.audience ?? process.env['GOOGLE_CHAT_AUDIENCE'] ?? '';
|
|
53
|
+
return String(raw).trim();
|
|
54
|
+
}
|
|
55
|
+
async function fetchChatCerts() {
|
|
56
|
+
const now = Date.now();
|
|
57
|
+
if (cachedCerts && now - cachedCerts.fetchedAt < 10 * 60 * 1000)
|
|
58
|
+
return cachedCerts.certs;
|
|
59
|
+
const res = await fetch(CHAT_CERTS_URL);
|
|
60
|
+
if (!res.ok)
|
|
61
|
+
throw new Error(`Failed to fetch Chat certs (${res.status})`);
|
|
62
|
+
const certs = (await res.json());
|
|
63
|
+
cachedCerts = { fetchedAt: now, certs };
|
|
64
|
+
return certs;
|
|
65
|
+
}
|
|
66
|
+
async function verifyGoogleChatRequest(params) {
|
|
67
|
+
const bearer = params.bearer.trim();
|
|
68
|
+
if (!bearer)
|
|
69
|
+
return { ok: false, reason: 'missing token' };
|
|
70
|
+
const audience = params.audience.trim();
|
|
71
|
+
if (!audience)
|
|
72
|
+
return { ok: false, reason: 'missing audience' };
|
|
73
|
+
if (params.audienceType === 'app-url') {
|
|
74
|
+
try {
|
|
75
|
+
const ticket = await verifyClient.verifyIdToken({
|
|
76
|
+
idToken: bearer,
|
|
77
|
+
audience,
|
|
78
|
+
});
|
|
79
|
+
const payload = ticket.getPayload();
|
|
80
|
+
const email = String(payload?.email ?? '');
|
|
81
|
+
const ok = Boolean(payload?.email_verified) &&
|
|
82
|
+
(email === CHAT_ISSUER || ADDON_ISSUER_PATTERN.test(email));
|
|
83
|
+
return ok ? { ok: true } : { ok: false, reason: `invalid issuer: ${email}` };
|
|
84
|
+
}
|
|
85
|
+
catch (err) {
|
|
86
|
+
return { ok: false, reason: err instanceof Error ? err.message : 'invalid token' };
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
try {
|
|
90
|
+
const certs = await fetchChatCerts();
|
|
91
|
+
await verifyClient.verifySignedJwtWithCertsAsync(bearer, certs, audience, [CHAT_ISSUER]);
|
|
92
|
+
return { ok: true };
|
|
93
|
+
}
|
|
94
|
+
catch (err) {
|
|
95
|
+
return { ok: false, reason: err instanceof Error ? err.message : 'invalid token' };
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
async function readRequestBody(req, maxBytes) {
|
|
99
|
+
return await new Promise((resolve, reject) => {
|
|
100
|
+
const chunks = [];
|
|
101
|
+
let received = 0;
|
|
102
|
+
req.on('data', (chunk) => {
|
|
103
|
+
received += chunk.length;
|
|
104
|
+
if (received > maxBytes) {
|
|
105
|
+
req.destroy();
|
|
106
|
+
reject(new Error('PAYLOAD_TOO_LARGE'));
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
chunks.push(Buffer.from(chunk));
|
|
110
|
+
});
|
|
111
|
+
req.on('end', () => resolve(Buffer.concat(chunks).toString('utf8')));
|
|
112
|
+
req.on('error', reject);
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
function sendJson(res, status, body) {
|
|
116
|
+
if (res.headersSent)
|
|
117
|
+
return;
|
|
118
|
+
const payload = JSON.stringify(body);
|
|
119
|
+
res.writeHead(status, {
|
|
120
|
+
'Content-Type': 'application/json; charset=utf-8',
|
|
121
|
+
'Content-Length': Buffer.byteLength(payload),
|
|
122
|
+
});
|
|
123
|
+
res.end(payload);
|
|
124
|
+
}
|
|
125
|
+
class GoogleChatService {
|
|
126
|
+
constructor(serviceAccountJson) {
|
|
127
|
+
this.serviceAccountJson = serviceAccountJson;
|
|
128
|
+
this.running = false;
|
|
129
|
+
this.status = 'disconnected';
|
|
130
|
+
this.messageThreadById = new Map();
|
|
131
|
+
const credentials = JSON.parse(serviceAccountJson);
|
|
132
|
+
this.auth = new google_auth_library_1.GoogleAuth({ credentials: credentials, scopes: [CHAT_SCOPE] });
|
|
133
|
+
}
|
|
134
|
+
async initialize() {
|
|
135
|
+
if (this.running)
|
|
136
|
+
return;
|
|
137
|
+
this.running = true;
|
|
138
|
+
this.status = 'connected';
|
|
139
|
+
this.lastError = undefined;
|
|
140
|
+
}
|
|
141
|
+
async shutdown() {
|
|
142
|
+
this.running = false;
|
|
143
|
+
this.status = 'disconnected';
|
|
144
|
+
this.lastError = undefined;
|
|
145
|
+
this.messageThreadById.clear();
|
|
146
|
+
}
|
|
147
|
+
getConnectionInfo() {
|
|
148
|
+
return {
|
|
149
|
+
status: this.status,
|
|
150
|
+
...(this.status === 'error' && this.lastError ? { errorMessage: this.lastError } : null),
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
rememberThread(messageId, threadName) {
|
|
154
|
+
const id = String(messageId ?? '').trim();
|
|
155
|
+
const thread = String(threadName ?? '').trim();
|
|
156
|
+
if (!id || !thread)
|
|
157
|
+
return;
|
|
158
|
+
this.messageThreadById.set(id, thread);
|
|
159
|
+
// simple cap to avoid unbounded growth
|
|
160
|
+
if (this.messageThreadById.size > 5000) {
|
|
161
|
+
const first = this.messageThreadById.keys().next().value;
|
|
162
|
+
if (first)
|
|
163
|
+
this.messageThreadById.delete(first);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
resolveThreadForReply(replyToMessageId) {
|
|
167
|
+
const id = String(replyToMessageId ?? '').trim();
|
|
168
|
+
if (!id)
|
|
169
|
+
return undefined;
|
|
170
|
+
return this.messageThreadById.get(id);
|
|
171
|
+
}
|
|
172
|
+
async sendText(spaceName, text, opts) {
|
|
173
|
+
if (!this.running)
|
|
174
|
+
throw new Error('GoogleChatService not initialized');
|
|
175
|
+
const space = String(spaceName ?? '').trim();
|
|
176
|
+
const bodyText = String(text ?? '').trim();
|
|
177
|
+
if (!space)
|
|
178
|
+
throw new Error('conversationId (space name) is required');
|
|
179
|
+
if (!bodyText)
|
|
180
|
+
throw new Error('text is required');
|
|
181
|
+
const client = await this.auth.getClient();
|
|
182
|
+
const access = await client.getAccessToken();
|
|
183
|
+
const token = typeof access === 'string' ? access : access?.token;
|
|
184
|
+
if (!token)
|
|
185
|
+
throw new Error('Missing Google Chat access token');
|
|
186
|
+
const url = `https://chat.googleapis.com/v1/${space}/messages`;
|
|
187
|
+
const res = await fetch(url, {
|
|
188
|
+
method: 'POST',
|
|
189
|
+
headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' },
|
|
190
|
+
body: JSON.stringify({
|
|
191
|
+
text: bodyText,
|
|
192
|
+
...(opts?.threadName ? { thread: { name: opts.threadName } } : null),
|
|
193
|
+
}),
|
|
194
|
+
});
|
|
195
|
+
if (!res.ok) {
|
|
196
|
+
const errText = await res.text().catch(() => '');
|
|
197
|
+
this.status = 'error';
|
|
198
|
+
this.lastError = `Google Chat send failed (${res.status}): ${errText || 'unknown'}`;
|
|
199
|
+
throw new Error(this.lastError);
|
|
200
|
+
}
|
|
201
|
+
const json = (await res.json().catch(() => null));
|
|
202
|
+
const id = typeof json?.name === 'string' && json.name ? json.name : `google-chat-${Date.now()}`;
|
|
203
|
+
this.status = 'connected';
|
|
204
|
+
this.lastError = undefined;
|
|
205
|
+
return { messageId: id };
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
class GoogleChatChannelAdapter {
|
|
209
|
+
constructor(service) {
|
|
210
|
+
this.service = service;
|
|
211
|
+
this.platform = 'google-chat';
|
|
212
|
+
this.displayName = 'Google Chat';
|
|
213
|
+
this.capabilities = ['text', 'rich_text', 'threads', 'group_chat'];
|
|
214
|
+
this.handlers = new Map();
|
|
215
|
+
}
|
|
216
|
+
async initialize(_auth) {
|
|
217
|
+
// service started in pack onActivate
|
|
218
|
+
}
|
|
219
|
+
async shutdown() {
|
|
220
|
+
this.handlers.clear();
|
|
221
|
+
}
|
|
222
|
+
getConnectionInfo() {
|
|
223
|
+
return this.service.getConnectionInfo();
|
|
224
|
+
}
|
|
225
|
+
async sendMessage(conversationId, content) {
|
|
226
|
+
const textBlock = content.blocks.find((b) => b.type === 'text');
|
|
227
|
+
const text = textBlock && textBlock.type === 'text' ? textBlock.text : '';
|
|
228
|
+
const threadName = this.service.resolveThreadForReply(content.replyToMessageId);
|
|
229
|
+
const result = await this.service.sendText(conversationId, text, { threadName });
|
|
230
|
+
return { messageId: result.messageId, timestamp: new Date().toISOString() };
|
|
231
|
+
}
|
|
232
|
+
async sendTypingIndicator(_conversationId, _isTyping) {
|
|
233
|
+
// not supported by Chat API
|
|
234
|
+
}
|
|
235
|
+
on(handler, eventTypes) {
|
|
236
|
+
this.handlers.set(handler, eventTypes);
|
|
237
|
+
return () => this.handlers.delete(handler);
|
|
238
|
+
}
|
|
239
|
+
emitInbound(event) {
|
|
240
|
+
const spaceName = String(event.space?.name ?? '').trim();
|
|
241
|
+
const message = event.message;
|
|
242
|
+
const messageId = String(message?.name ?? '').trim() || `google-chat-${Date.now()}`;
|
|
243
|
+
const text = String(message?.text ?? '').trim();
|
|
244
|
+
if (!spaceName || !text)
|
|
245
|
+
return;
|
|
246
|
+
const spaceType = String(event.space?.type ?? '').trim().toUpperCase();
|
|
247
|
+
const conversationType = spaceType === 'DM' ? 'direct' : 'group';
|
|
248
|
+
const senderId = String(message?.sender?.name ?? event.user?.name ?? '').trim() || 'unknown';
|
|
249
|
+
const senderName = String(message?.sender?.displayName ?? event.user?.displayName ?? '').trim() || undefined;
|
|
250
|
+
const sender = { id: senderId, displayName: senderName };
|
|
251
|
+
const tsRaw = String(event.eventTime ?? message?.createTime ?? '').trim();
|
|
252
|
+
const timestamp = tsRaw ? new Date(tsRaw).toISOString() : new Date().toISOString();
|
|
253
|
+
const threadName = String(message?.thread?.name ?? '').trim();
|
|
254
|
+
this.service.rememberThread(messageId, threadName);
|
|
255
|
+
const channelMessage = {
|
|
256
|
+
messageId,
|
|
257
|
+
platform: 'google-chat',
|
|
258
|
+
conversationId: spaceName,
|
|
259
|
+
conversationType,
|
|
260
|
+
sender,
|
|
261
|
+
content: [{ type: 'text', text }],
|
|
262
|
+
text,
|
|
263
|
+
timestamp,
|
|
264
|
+
rawEvent: event,
|
|
265
|
+
};
|
|
266
|
+
const evt = {
|
|
267
|
+
type: 'message',
|
|
268
|
+
platform: 'google-chat',
|
|
269
|
+
conversationId: spaceName,
|
|
270
|
+
timestamp,
|
|
271
|
+
data: channelMessage,
|
|
272
|
+
};
|
|
273
|
+
for (const [handler, filter] of this.handlers) {
|
|
274
|
+
if (!filter || filter.includes(evt.type)) {
|
|
275
|
+
Promise.resolve(handler(evt)).catch((err) => console.error('[GoogleChatChannelAdapter] Handler error:', err));
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
class GoogleChatSendMessageTool {
|
|
281
|
+
constructor(service) {
|
|
282
|
+
this.service = service;
|
|
283
|
+
this.id = 'googleChatChannelSendMessage';
|
|
284
|
+
this.name = 'googleChatChannelSendMessage';
|
|
285
|
+
this.displayName = 'Send Google Chat Message';
|
|
286
|
+
this.description = 'Send a text message via the Google Chat channel adapter.';
|
|
287
|
+
this.category = 'communication';
|
|
288
|
+
this.version = '0.1.0';
|
|
289
|
+
this.hasSideEffects = true;
|
|
290
|
+
this.inputSchema = {
|
|
291
|
+
type: 'object',
|
|
292
|
+
required: ['conversationId', 'text'],
|
|
293
|
+
properties: {
|
|
294
|
+
conversationId: { type: 'string', description: 'Target space name (e.g., spaces/AAA...)' },
|
|
295
|
+
text: { type: 'string', description: 'Message text' },
|
|
296
|
+
},
|
|
297
|
+
};
|
|
298
|
+
this.outputSchema = {
|
|
299
|
+
type: 'object',
|
|
300
|
+
properties: {
|
|
301
|
+
messageId: { type: 'string', description: 'Sent message name' },
|
|
302
|
+
conversationId: { type: 'string', description: 'Target space name' },
|
|
303
|
+
},
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
async execute(args, _context) {
|
|
307
|
+
try {
|
|
308
|
+
const result = await this.service.sendText(args.conversationId, args.text);
|
|
309
|
+
return { success: true, output: { messageId: result.messageId, conversationId: args.conversationId } };
|
|
310
|
+
}
|
|
311
|
+
catch (error) {
|
|
312
|
+
return { success: false, error: error?.message || String(error) };
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
validateArgs(args) {
|
|
316
|
+
const errors = [];
|
|
317
|
+
if (!args.conversationId)
|
|
318
|
+
errors.push('conversationId is required');
|
|
319
|
+
if (!args.text)
|
|
320
|
+
errors.push('text is required');
|
|
321
|
+
return { isValid: errors.length === 0, errors };
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
function createExtensionPack(context) {
|
|
325
|
+
const options = (context.options ?? {});
|
|
326
|
+
const serviceAccountJson = resolveServiceAccount(options, options.secrets);
|
|
327
|
+
const webhookPath = normalizeWebhookPath(options.webhookPath ?? process.env['GOOGLE_CHAT_WEBHOOK_PATH']);
|
|
328
|
+
const maxBodyBytes = Number.isFinite(options.maxBodyBytes) && Number(options.maxBodyBytes) > 0 ? Number(options.maxBodyBytes) : DEFAULT_MAX_BODY_BYTES;
|
|
329
|
+
const audienceType = resolveAudienceType(options);
|
|
330
|
+
const audience = resolveAudience(options);
|
|
331
|
+
const service = new GoogleChatService(serviceAccountJson);
|
|
332
|
+
const adapter = new GoogleChatChannelAdapter(service);
|
|
333
|
+
const sendMessageTool = new GoogleChatSendMessageTool(service);
|
|
334
|
+
const priority = options.priority ?? 50;
|
|
335
|
+
const webhookHandler = async (req, res) => {
|
|
336
|
+
const url = new URL(req.url || '/', `http://${req.headers.host || 'localhost'}`);
|
|
337
|
+
if (url.pathname !== webhookPath)
|
|
338
|
+
return false;
|
|
339
|
+
if (req.method === 'GET') {
|
|
340
|
+
sendJson(res, 200, { ok: true });
|
|
341
|
+
return true;
|
|
342
|
+
}
|
|
343
|
+
if (req.method !== 'POST') {
|
|
344
|
+
sendJson(res, 405, { error: 'Method not allowed' });
|
|
345
|
+
return true;
|
|
346
|
+
}
|
|
347
|
+
if (!audienceType || !audience) {
|
|
348
|
+
sendJson(res, 503, {
|
|
349
|
+
error: 'Google Chat webhook verification is not configured. Set GOOGLE_CHAT_AUDIENCE_TYPE and GOOGLE_CHAT_AUDIENCE.',
|
|
350
|
+
});
|
|
351
|
+
return true;
|
|
352
|
+
}
|
|
353
|
+
const authHeader = String(req.headers.authorization ?? '');
|
|
354
|
+
const bearer = authHeader.toLowerCase().startsWith('bearer ') ? authHeader.slice('bearer '.length).trim() : '';
|
|
355
|
+
const verification = await verifyGoogleChatRequest({ bearer, audienceType, audience });
|
|
356
|
+
if (!verification.ok) {
|
|
357
|
+
sendJson(res, 401, { error: `unauthorized: ${verification.reason ?? 'invalid token'}` });
|
|
358
|
+
return true;
|
|
359
|
+
}
|
|
360
|
+
let rawBody = '';
|
|
361
|
+
try {
|
|
362
|
+
rawBody = await readRequestBody(req, maxBodyBytes);
|
|
363
|
+
}
|
|
364
|
+
catch (err) {
|
|
365
|
+
if (err instanceof Error && err.message === 'PAYLOAD_TOO_LARGE') {
|
|
366
|
+
sendJson(res, 413, { error: 'payload too large' });
|
|
367
|
+
return true;
|
|
368
|
+
}
|
|
369
|
+
sendJson(res, 400, { error: 'invalid body' });
|
|
370
|
+
return true;
|
|
371
|
+
}
|
|
372
|
+
let parsed;
|
|
373
|
+
try {
|
|
374
|
+
parsed = JSON.parse(rawBody);
|
|
375
|
+
}
|
|
376
|
+
catch {
|
|
377
|
+
sendJson(res, 400, { error: 'invalid payload' });
|
|
378
|
+
return true;
|
|
379
|
+
}
|
|
380
|
+
// Ack immediately; message handling is async.
|
|
381
|
+
sendJson(res, 200, { ok: true });
|
|
382
|
+
if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {
|
|
383
|
+
const event = parsed;
|
|
384
|
+
const eventType = (event.type ?? event.eventType ?? '').toString();
|
|
385
|
+
if (eventType === 'MESSAGE') {
|
|
386
|
+
adapter.emitInbound(event);
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
return true;
|
|
390
|
+
};
|
|
391
|
+
return {
|
|
392
|
+
name: '@framers/agentos-ext-channel-google-chat',
|
|
393
|
+
version: '0.1.0',
|
|
394
|
+
descriptors: [
|
|
395
|
+
{ id: 'googleChatChannelSendMessage', kind: 'tool', priority, payload: sendMessageTool },
|
|
396
|
+
{ id: 'googleChatChannel', kind: 'messaging-channel', priority, payload: adapter },
|
|
397
|
+
{ id: 'googleChatWebhook', kind: 'http-handler', priority, payload: webhookHandler },
|
|
398
|
+
],
|
|
399
|
+
onActivate: async () => {
|
|
400
|
+
await service.initialize();
|
|
401
|
+
await adapter.initialize({ platform: 'google-chat', credential: serviceAccountJson });
|
|
402
|
+
if (!audienceType || !audience) {
|
|
403
|
+
context.logger?.warn?.('[GoogleChatChannel] GOOGLE_CHAT_AUDIENCE_TYPE / GOOGLE_CHAT_AUDIENCE not configured — inbound webhooks will be rejected (503).');
|
|
404
|
+
}
|
|
405
|
+
context.logger?.info?.(`[GoogleChatChannel] Extension activated (webhook: ${webhookPath})`);
|
|
406
|
+
},
|
|
407
|
+
onDeactivate: async () => {
|
|
408
|
+
await adapter.shutdown();
|
|
409
|
+
await service.shutdown();
|
|
410
|
+
context.logger?.info?.('[GoogleChatChannel] Extension deactivated');
|
|
411
|
+
},
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
exports.default = createExtensionPack;
|
|
415
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,cAAc;AACd;;;;;;;;GAQG;;AA0ZH,kDAuGC;AA9fD,6DAA+D;AAmD/D,MAAM,UAAU,GAAG,0CAA0C,CAAC;AAC9D,MAAM,WAAW,GAAG,iCAAiC,CAAC;AACtD,MAAM,oBAAoB,GAAG,kEAAkE,CAAC;AAChG,MAAM,cAAc,GAClB,8FAA8F,CAAC;AAEjG,MAAM,oBAAoB,GAAG,sBAAsB,CAAC;AACpD,MAAM,sBAAsB,GAAG,IAAI,GAAG,IAAI,CAAC;AAE3C,MAAM,YAAY,GAAG,IAAI,kCAAY,EAAE,CAAC;AACxC,IAAI,WAAW,GAAgE,IAAI,CAAC;AAEpF,SAAS,oBAAoB,CAAC,GAAY;IACxC,MAAM,CAAC,GAAG,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACpD,IAAI,CAAC,CAAC;QAAE,OAAO,oBAAoB,CAAC;IACpC,MAAM,SAAS,GAAG,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;IAClD,OAAO,SAAS,CAAC,MAAM,GAAG,CAAC,IAAI,SAAS,CAAC,QAAQ,CAAC,GAAG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AC;YACJ,CAAC;YACD,OAAO,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,qDAAqD,WAAW,GAAG,CAAC,CAAC;QAC9F,CAAC;QACD,YAAY,EAAE,KAAK,IAAI,EAAE;YACvB,MAAM,OAAO,CAAC,QAAQ,EAAE,CAAC;YACzB,MAAM,OAAO,CAAC,QAAQ,EAAE,CAAC;YACzB,OAAO,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,2CAA2C,CAAC,CAAC;QACtE,CAAC;KACF,CAAC;AACJ,CAAC;AAED,kBAAe,mBAAmB,CAAC"}
|
package/manifest.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "https://agentos.sh/schemas/extension-manifest-v1.json",
|
|
3
3
|
"id": "com.framers.channels.google-chat",
|
|
4
4
|
"name": "Google Chat Channel Extension",
|
|
5
|
-
"version": "0.1.
|
|
5
|
+
"version": "0.1.1",
|
|
6
6
|
"description": "Google Workspace Chat via Cloud API — supports outbound messages + inbound webhooks.",
|
|
7
7
|
"categories": ["channel", "communication"],
|
|
8
8
|
"platforms": ["google-chat"],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@framers/agentos-ext-channel-google-chat",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Google Chat messaging channel adapter for AgentOS (Chat API + webhooks)",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"manifest.json"
|
|
22
22
|
],
|
|
23
23
|
"peerDependencies": {
|
|
24
|
-
"@framers/agentos": "^0.
|
|
24
|
+
"@framers/agentos": "^0.10.28"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"google-auth-library": "^9.15.1"
|
|
@@ -30,20 +30,24 @@
|
|
|
30
30
|
"@types/node": "^20.0.0",
|
|
31
31
|
"typescript": "^5.0.0",
|
|
32
32
|
"vitest": "^1.0.0",
|
|
33
|
-
"@framers/agentos": "0.
|
|
33
|
+
"@framers/agentos": "^0.10.28"
|
|
34
34
|
},
|
|
35
35
|
"engines": {
|
|
36
36
|
"node": ">=18.0.0"
|
|
37
37
|
},
|
|
38
38
|
"repository": {
|
|
39
39
|
"type": "git",
|
|
40
|
-
"url": "https://github.com/
|
|
40
|
+
"url": "git+https://github.com/framerslab/agentos-extensions.git",
|
|
41
41
|
"directory": "registry/curated/channels/google-chat"
|
|
42
42
|
},
|
|
43
|
+
"homepage": "https://github.com/framerslab/agentos-extensions/tree/master/registry/curated/channels/google-chat#readme",
|
|
44
|
+
"bugs": {
|
|
45
|
+
"url": "https://github.com/framerslab/agentos-extensions/issues"
|
|
46
|
+
},
|
|
43
47
|
"scripts": {
|
|
44
48
|
"build": "tsc",
|
|
45
49
|
"dev": "tsc --watch",
|
|
46
|
-
"test": "vitest run",
|
|
50
|
+
"test": "vitest run --passWithNoTests",
|
|
47
51
|
"test:watch": "vitest watch",
|
|
48
52
|
"clean": "rm -rf dist"
|
|
49
53
|
}
|