@framers/agentos-ext-channel-irc 0.1.0

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 ADDED
@@ -0,0 +1,98 @@
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.
97
+
98
+
@@ -0,0 +1,48 @@
1
+ /**
2
+ * @fileoverview IRC Channel Extension for AgentOS.
3
+ *
4
+ * Minimal IRC adapter:
5
+ * - Connect via TCP or TLS
6
+ * - Join configured channels
7
+ * - Inbound: PRIVMSG -> ChannelMessage
8
+ * - Outbound: PRIVMSG
9
+ *
10
+ * @module @framers/agentos-ext-channel-irc
11
+ */
12
+ import type { ExtensionContext, ExtensionPack } from '@framers/agentos';
13
+ export interface IrcChannelOptions {
14
+ host?: string;
15
+ port?: number;
16
+ tls?: boolean;
17
+ nick?: string;
18
+ username?: string;
19
+ realname?: string;
20
+ password?: string;
21
+ channels?: string[];
22
+ /**
23
+ * Identify with NickServ after connect.
24
+ */
25
+ nickServ?: {
26
+ service?: string;
27
+ password?: string;
28
+ };
29
+ /**
30
+ * Auto-reconnect on disconnect.
31
+ * @default true
32
+ */
33
+ autoReconnect?: boolean;
34
+ /**
35
+ * Connect timeout (ms).
36
+ * @default 15000
37
+ */
38
+ connectTimeoutMs?: number;
39
+ /**
40
+ * Max message chunk length.
41
+ * @default 350
42
+ */
43
+ messageChunkMaxChars?: number;
44
+ priority?: number;
45
+ }
46
+ export declare function createExtensionPack(context: ExtensionContext): ExtensionPack;
47
+ export default createExtensionPack;
48
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA;;;;;;;;;;GAUG;AAKH,OAAO,KAAK,EAUV,gBAAgB,EAChB,aAAa,EAOd,MAAM,kBAAkB,CAAC;AAE1B,MAAM,WAAW,iBAAiB;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB;;OAEG;IACH,QAAQ,CAAC,EAAE;QACT,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC;IACF;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;OAGG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAwhBD,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,gBAAgB,GAAG,aAAa,CAwE5E;AAED,eAAe,mBAAmB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,591 @@
1
+ "use strict";
2
+ // @ts-nocheck
3
+ /**
4
+ * @fileoverview IRC Channel Extension for AgentOS.
5
+ *
6
+ * Minimal IRC adapter:
7
+ * - Connect via TCP or TLS
8
+ * - Join configured channels
9
+ * - Inbound: PRIVMSG -> ChannelMessage
10
+ * - Outbound: PRIVMSG
11
+ *
12
+ * @module @framers/agentos-ext-channel-irc
13
+ */
14
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
15
+ if (k2 === undefined) k2 = k;
16
+ var desc = Object.getOwnPropertyDescriptor(m, k);
17
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
18
+ desc = { enumerable: true, get: function() { return m[k]; } };
19
+ }
20
+ Object.defineProperty(o, k2, desc);
21
+ }) : (function(o, m, k, k2) {
22
+ if (k2 === undefined) k2 = k;
23
+ o[k2] = m[k];
24
+ }));
25
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
26
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
27
+ }) : function(o, v) {
28
+ o["default"] = v;
29
+ });
30
+ var __importStar = (this && this.__importStar) || (function () {
31
+ var ownKeys = function(o) {
32
+ ownKeys = Object.getOwnPropertyNames || function (o) {
33
+ var ar = [];
34
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
35
+ return ar;
36
+ };
37
+ return ownKeys(o);
38
+ };
39
+ return function (mod) {
40
+ if (mod && mod.__esModule) return mod;
41
+ var result = {};
42
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
43
+ __setModuleDefault(result, mod);
44
+ return result;
45
+ };
46
+ })();
47
+ Object.defineProperty(exports, "__esModule", { value: true });
48
+ exports.createExtensionPack = createExtensionPack;
49
+ const node_crypto_1 = require("node:crypto");
50
+ const net = __importStar(require("node:net"));
51
+ const tls = __importStar(require("node:tls"));
52
+ function normalizeBool(raw, fallback) {
53
+ if (typeof raw === 'boolean')
54
+ return raw;
55
+ if (typeof raw === 'string') {
56
+ const v = raw.trim().toLowerCase();
57
+ if (v === 'true' || v === '1' || v === 'yes')
58
+ return true;
59
+ if (v === 'false' || v === '0' || v === 'no')
60
+ return false;
61
+ }
62
+ return fallback;
63
+ }
64
+ function normalizeInt(raw, fallback) {
65
+ if (typeof raw === 'number' && Number.isFinite(raw))
66
+ return Math.trunc(raw);
67
+ if (typeof raw === 'string') {
68
+ const parsed = Number.parseInt(raw, 10);
69
+ if (Number.isFinite(parsed))
70
+ return parsed;
71
+ }
72
+ return fallback;
73
+ }
74
+ function normalizeHost(raw) {
75
+ const v = raw.trim();
76
+ if (!v)
77
+ throw new Error('IRC host is required');
78
+ return v;
79
+ }
80
+ function normalizeNick(raw) {
81
+ const v = raw.trim();
82
+ if (!v)
83
+ throw new Error('IRC nick is required');
84
+ return v.replace(/\s+/g, '');
85
+ }
86
+ function normalizeChannel(raw) {
87
+ const trimmed = raw.trim();
88
+ if (!trimmed)
89
+ return '';
90
+ if (trimmed.startsWith('#') || trimmed.startsWith('&'))
91
+ return trimmed;
92
+ return `#${trimmed}`;
93
+ }
94
+ function splitCsv(raw) {
95
+ if (typeof raw !== 'string')
96
+ return [];
97
+ return raw
98
+ .split(',')
99
+ .map((v) => v.trim())
100
+ .filter(Boolean);
101
+ }
102
+ function resolveRequiredString(secretId, envVar, options, secrets) {
103
+ const fromOptions = typeof options[secretId] === 'string' ? String(options[secretId]).trim() : '';
104
+ if (fromOptions)
105
+ return fromOptions;
106
+ const fromSecrets = typeof secrets?.[secretId] === 'string' ? secrets[secretId].trim() : '';
107
+ if (fromSecrets)
108
+ return fromSecrets;
109
+ const fromEnv = String(process.env[envVar] ?? '').trim();
110
+ if (fromEnv)
111
+ return fromEnv;
112
+ throw new Error(`Missing ${secretId}. Provide via options, secrets["${secretId}"], or ${envVar}.`);
113
+ }
114
+ function resolveOptionalString(secretId, envVar, options, secrets) {
115
+ const fromOptions = typeof options[secretId] === 'string' ? String(options[secretId]).trim() : '';
116
+ if (fromOptions)
117
+ return fromOptions;
118
+ const fromSecrets = typeof secrets?.[secretId] === 'string' ? secrets[secretId].trim() : '';
119
+ if (fromSecrets)
120
+ return fromSecrets;
121
+ const fromEnv = String(process.env[envVar] ?? '').trim();
122
+ return fromEnv ? fromEnv : undefined;
123
+ }
124
+ function parseIrcLine(rawLine) {
125
+ const raw = rawLine.replace(/[\r\n]+/g, '').trimEnd();
126
+ let rest = raw;
127
+ let prefix;
128
+ if (rest.startsWith(':')) {
129
+ const idx = rest.indexOf(' ');
130
+ if (idx > 1) {
131
+ prefix = rest.slice(1, idx);
132
+ rest = rest.slice(idx + 1);
133
+ }
134
+ }
135
+ let trailing;
136
+ const trailingIdx = rest.indexOf(' :');
137
+ if (trailingIdx >= 0) {
138
+ trailing = rest.slice(trailingIdx + 2);
139
+ rest = rest.slice(0, trailingIdx);
140
+ }
141
+ const parts = rest.split(' ').filter(Boolean);
142
+ const command = parts.shift() ?? '';
143
+ return { raw, prefix, command, params: parts, trailing };
144
+ }
145
+ function parseNickFromPrefix(prefix) {
146
+ if (!prefix)
147
+ return null;
148
+ const bangIdx = prefix.indexOf('!');
149
+ const atIdx = prefix.indexOf('@');
150
+ if (bangIdx < 0) {
151
+ return { nick: prefix };
152
+ }
153
+ const nick = prefix.slice(0, bangIdx);
154
+ const user = atIdx > bangIdx ? prefix.slice(bangIdx + 1, atIdx) : prefix.slice(bangIdx + 1);
155
+ const host = atIdx > bangIdx ? prefix.slice(atIdx + 1) : undefined;
156
+ return { nick, user: user || undefined, host: host || undefined };
157
+ }
158
+ function extractText(content) {
159
+ const textBlock = content?.blocks?.find((b) => b?.type === 'text' && typeof b.text === 'string');
160
+ const text = typeof textBlock?.text === 'string' ? textBlock.text : '';
161
+ return String(text ?? '').trim();
162
+ }
163
+ function chunkText(text, maxLen) {
164
+ const t = String(text ?? '');
165
+ if (!t)
166
+ return [];
167
+ const cleaned = t.replace(/[\r\n]+/g, ' ').trim();
168
+ if (cleaned.length <= maxLen)
169
+ return [cleaned];
170
+ const chunks = [];
171
+ let i = 0;
172
+ while (i < cleaned.length) {
173
+ chunks.push(cleaned.slice(i, i + maxLen));
174
+ i += maxLen;
175
+ }
176
+ return chunks;
177
+ }
178
+ class IrcService {
179
+ constructor(config, onPrivmsg, logger) {
180
+ this.config = config;
181
+ this.onPrivmsg = onPrivmsg;
182
+ this.logger = logger;
183
+ this.socket = null;
184
+ this.buffer = '';
185
+ this.running = false;
186
+ this.ready = false;
187
+ this.reconnectTimer = null;
188
+ this.currentNick = '';
189
+ this.status = 'disconnected';
190
+ }
191
+ getConnectionInfo() {
192
+ return {
193
+ status: this.status,
194
+ ...(this.connectedSince ? { connectedSince: this.connectedSince } : null),
195
+ ...(this.status === 'error' && this.lastError ? { errorMessage: this.lastError } : null),
196
+ platformInfo: {
197
+ host: this.config.host,
198
+ port: this.config.port,
199
+ tls: this.config.tls,
200
+ nick: this.currentNick || this.config.nick,
201
+ channels: this.config.channels,
202
+ },
203
+ };
204
+ }
205
+ async connect() {
206
+ if (this.running)
207
+ return;
208
+ this.running = true;
209
+ this.status = 'connecting';
210
+ this.lastError = undefined;
211
+ this.ready = false;
212
+ this.currentNick = this.config.nick;
213
+ await this.openSocket();
214
+ }
215
+ async disconnect() {
216
+ this.running = false;
217
+ this.ready = false;
218
+ this.status = 'disconnected';
219
+ this.connectedSince = undefined;
220
+ this.lastError = undefined;
221
+ if (this.reconnectTimer) {
222
+ clearTimeout(this.reconnectTimer);
223
+ this.reconnectTimer = null;
224
+ }
225
+ const sock = this.socket;
226
+ this.socket = null;
227
+ this.buffer = '';
228
+ if (sock) {
229
+ try {
230
+ sock.end('QUIT :shutdown\r\n');
231
+ }
232
+ catch {
233
+ // ignore
234
+ }
235
+ try {
236
+ sock.destroy();
237
+ }
238
+ catch {
239
+ // ignore
240
+ }
241
+ }
242
+ }
243
+ sendPrivmsg(target, text, maxChunkChars) {
244
+ if (!this.socket || !this.ready)
245
+ throw new Error('IRC not connected');
246
+ const safeTarget = String(target ?? '').trim();
247
+ if (!safeTarget)
248
+ throw new Error('IRC target is required');
249
+ const chunks = chunkText(text, maxChunkChars);
250
+ for (const chunk of chunks) {
251
+ this.sendRaw(`PRIVMSG ${safeTarget} :${chunk}`);
252
+ }
253
+ }
254
+ sendRaw(line) {
255
+ const cleaned = String(line ?? '').replace(/[\r\n]+/g, '').trim();
256
+ if (!cleaned)
257
+ return;
258
+ const sock = this.socket;
259
+ if (!sock)
260
+ return;
261
+ sock.write(`${cleaned}\r\n`);
262
+ }
263
+ async openSocket() {
264
+ const timeoutMs = this.config.connectTimeoutMs;
265
+ const sock = this.config.tls
266
+ ? tls.connect({
267
+ host: this.config.host,
268
+ port: this.config.port,
269
+ servername: this.config.host,
270
+ })
271
+ : net.connect({ host: this.config.host, port: this.config.port });
272
+ sock.setEncoding('utf8');
273
+ this.socket = sock;
274
+ try {
275
+ await new Promise((resolve, reject) => {
276
+ const timer = setTimeout(() => {
277
+ cleanup();
278
+ reject(new Error(`IRC connect timed out after ${timeoutMs}ms`));
279
+ }, timeoutMs);
280
+ const onError = (err) => {
281
+ cleanup();
282
+ reject(err);
283
+ };
284
+ const onConnect = () => {
285
+ cleanup();
286
+ resolve();
287
+ };
288
+ const cleanup = () => {
289
+ clearTimeout(timer);
290
+ sock.off('error', onError);
291
+ sock.off('connect', onConnect);
292
+ };
293
+ sock.once('error', onError);
294
+ sock.once('connect', onConnect);
295
+ });
296
+ }
297
+ catch (err) {
298
+ this.status = 'error';
299
+ this.lastError = err instanceof Error ? err.message : String(err);
300
+ this.logger?.warn?.(`[IRC] connect failed: ${this.lastError}`);
301
+ try {
302
+ sock.destroy();
303
+ }
304
+ catch { }
305
+ this.socket = null;
306
+ if (this.running && this.config.autoReconnect)
307
+ this.scheduleReconnect();
308
+ return;
309
+ }
310
+ // Wire events
311
+ sock.on('data', (chunk) => this.onData(chunk));
312
+ sock.on('error', (err) => this.onError(err));
313
+ sock.on('close', () => this.onClose());
314
+ // Handshake
315
+ if (this.config.password)
316
+ this.sendRaw(`PASS ${this.config.password}`);
317
+ this.sendRaw(`NICK ${this.currentNick}`);
318
+ this.sendRaw(`USER ${this.config.username} 0 * :${this.config.realname}`);
319
+ }
320
+ onData(chunk) {
321
+ this.buffer += chunk;
322
+ let idx;
323
+ while ((idx = this.buffer.indexOf('\n')) >= 0) {
324
+ const line = this.buffer.slice(0, idx).replace(/\r$/, '');
325
+ this.buffer = this.buffer.slice(idx + 1);
326
+ const trimmed = line.trim();
327
+ if (!trimmed)
328
+ continue;
329
+ this.onLine(trimmed);
330
+ }
331
+ }
332
+ onLine(line) {
333
+ const msg = parseIrcLine(line);
334
+ const cmd = msg.command.toUpperCase();
335
+ if (cmd === 'PING') {
336
+ const token = msg.trailing || msg.params[0] || '';
337
+ this.sendRaw(`PONG :${token}`);
338
+ return;
339
+ }
340
+ // Welcome — we're ready.
341
+ if (cmd === '001') {
342
+ this.ready = true;
343
+ this.status = 'connected';
344
+ this.connectedSince = new Date().toISOString();
345
+ this.lastError = undefined;
346
+ // Join channels.
347
+ for (const ch of this.config.channels) {
348
+ if (ch)
349
+ this.sendRaw(`JOIN ${ch}`);
350
+ }
351
+ // NickServ identify (optional).
352
+ if (this.config.nickServ?.password) {
353
+ const service = this.config.nickServ.service || 'NickServ';
354
+ this.sendRaw(`PRIVMSG ${service} :IDENTIFY ${this.config.nickServ.password}`);
355
+ }
356
+ return;
357
+ }
358
+ // Nick in use — pick a fallback nick.
359
+ if (cmd === '433') {
360
+ const nextNick = `${this.currentNick}_`;
361
+ if (nextNick.toLowerCase() !== this.currentNick.toLowerCase()) {
362
+ this.currentNick = nextNick;
363
+ this.sendRaw(`NICK ${this.currentNick}`);
364
+ }
365
+ return;
366
+ }
367
+ if (cmd === 'PRIVMSG') {
368
+ const sender = parseNickFromPrefix(msg.prefix);
369
+ if (!sender?.nick)
370
+ return;
371
+ const target = msg.params[0] || '';
372
+ const text = msg.trailing || '';
373
+ if (!target || !text.trim())
374
+ return;
375
+ const remoteUser = {
376
+ id: sender.nick,
377
+ username: sender.nick,
378
+ displayName: sender.nick,
379
+ };
380
+ this.onPrivmsg({ sender: remoteUser, target, text });
381
+ return;
382
+ }
383
+ }
384
+ onError(err) {
385
+ if (!this.running)
386
+ return;
387
+ this.status = 'error';
388
+ this.lastError = err.message;
389
+ this.logger?.warn?.(`[IRC] socket error: ${err.message}`);
390
+ }
391
+ onClose() {
392
+ if (!this.running)
393
+ return;
394
+ this.ready = false;
395
+ this.status = this.config.autoReconnect ? 'reconnecting' : 'disconnected';
396
+ this.connectedSince = undefined;
397
+ if (this.config.autoReconnect)
398
+ this.scheduleReconnect();
399
+ }
400
+ scheduleReconnect() {
401
+ if (this.reconnectTimer)
402
+ return;
403
+ this.reconnectTimer = setTimeout(() => {
404
+ this.reconnectTimer = null;
405
+ if (!this.running)
406
+ return;
407
+ try {
408
+ const sock = this.socket;
409
+ this.socket = null;
410
+ if (sock) {
411
+ try {
412
+ sock.destroy();
413
+ }
414
+ catch { }
415
+ }
416
+ }
417
+ finally {
418
+ void this.openSocket();
419
+ }
420
+ }, 3000);
421
+ if (typeof this.reconnectTimer === 'object' && 'unref' in this.reconnectTimer)
422
+ this.reconnectTimer.unref();
423
+ }
424
+ }
425
+ class IrcChannelAdapter {
426
+ constructor(params) {
427
+ this.platform = 'irc';
428
+ this.displayName = 'IRC';
429
+ this.capabilities = ['text', 'group_chat'];
430
+ this.handlers = new Set();
431
+ this.service = params.service;
432
+ this.maxChunkChars = params.messageChunkMaxChars;
433
+ }
434
+ async initialize(_auth) {
435
+ await this.service.connect();
436
+ }
437
+ async shutdown() {
438
+ await this.service.disconnect();
439
+ }
440
+ getConnectionInfo() {
441
+ return this.service.getConnectionInfo();
442
+ }
443
+ async sendMessage(conversationId, content) {
444
+ const text = extractText(content);
445
+ if (!text)
446
+ throw new Error('IRC sendMessage requires a text block');
447
+ this.service.sendPrivmsg(conversationId, text, this.maxChunkChars);
448
+ return { messageId: `irc-${Date.now()}-${(0, node_crypto_1.randomUUID)()}` };
449
+ }
450
+ async sendTypingIndicator(_conversationId, _isTyping) {
451
+ // IRC has no typing indicator.
452
+ }
453
+ on(handler, eventTypes) {
454
+ const wrapped = (event) => {
455
+ if (eventTypes && eventTypes.length > 0 && !eventTypes.includes(event.type))
456
+ return;
457
+ return handler(event);
458
+ };
459
+ this.handlers.add(wrapped);
460
+ return () => this.handlers.delete(wrapped);
461
+ }
462
+ emit(event) {
463
+ for (const h of Array.from(this.handlers)) {
464
+ try {
465
+ void h(event);
466
+ }
467
+ catch { /* ignore */ }
468
+ }
469
+ }
470
+ handleInbound(sender, target, text) {
471
+ const isChannel = target.startsWith('#') || target.startsWith('&');
472
+ const conversationType = isChannel ? 'group' : 'direct';
473
+ const conversationId = isChannel ? target : sender.id;
474
+ const messageId = `irc-${Date.now()}-${(0, node_crypto_1.randomUUID)()}`;
475
+ const timestamp = new Date().toISOString();
476
+ const trimmed = text.trim();
477
+ const msg = {
478
+ messageId,
479
+ platform: this.platform,
480
+ conversationId,
481
+ conversationType,
482
+ sender,
483
+ content: [{ type: 'text', text: trimmed }],
484
+ text: trimmed,
485
+ timestamp,
486
+ };
487
+ const evt = {
488
+ type: 'message',
489
+ platform: this.platform,
490
+ conversationId,
491
+ timestamp,
492
+ data: msg,
493
+ };
494
+ this.emit(evt);
495
+ }
496
+ }
497
+ class IrcSendMessageTool {
498
+ constructor(adapter) {
499
+ this.adapter = adapter;
500
+ this.id = 'irc-send-message-v1';
501
+ this.name = 'ircSendMessage';
502
+ this.displayName = 'Send IRC Message';
503
+ this.description = 'Send a text message to an IRC channel (e.g. #general) or user nick.';
504
+ this.category = 'communication';
505
+ this.hasSideEffects = true;
506
+ this.inputSchema = {
507
+ type: 'object',
508
+ additionalProperties: false,
509
+ properties: {
510
+ conversationId: { type: 'string', description: 'Target channel (e.g. #general) or nick.' },
511
+ text: { type: 'string', description: 'Message text.' },
512
+ },
513
+ required: ['conversationId', 'text'],
514
+ };
515
+ }
516
+ async execute(params, _context) {
517
+ try {
518
+ const conversationId = String(params?.conversationId ?? '').trim();
519
+ const text = String(params?.text ?? '').trim();
520
+ if (!conversationId)
521
+ return { success: false, error: 'conversationId is required' };
522
+ if (!text)
523
+ return { success: false, error: 'text is required' };
524
+ const result = await this.adapter.sendMessage(conversationId, {
525
+ blocks: [{ type: 'text', text }],
526
+ });
527
+ return { success: true, output: result };
528
+ }
529
+ catch (err) {
530
+ return { success: false, error: err instanceof Error ? err.message : String(err) };
531
+ }
532
+ }
533
+ }
534
+ function createExtensionPack(context) {
535
+ const options = (context.options ?? {});
536
+ const secrets = options.secrets;
537
+ const host = normalizeHost(options.host ?? resolveRequiredString('irc.host', 'IRC_HOST', options, secrets));
538
+ const port = options.port ?? normalizeInt(secrets?.['irc.port'] ?? process.env['IRC_PORT'], 6667);
539
+ const useTls = options.tls ?? normalizeBool(secrets?.['irc.tls'] ?? process.env['IRC_TLS'], false);
540
+ const nick = normalizeNick(options.nick ?? resolveRequiredString('irc.nick', 'IRC_NICK', options, secrets));
541
+ const username = (options.username ?? resolveOptionalString('irc.username', 'IRC_USERNAME', options, secrets) ?? nick).trim();
542
+ const realname = (options.realname ?? resolveOptionalString('irc.realname', 'IRC_REALNAME', options, secrets) ?? 'AgentOS').trim();
543
+ const password = options.password ?? resolveOptionalString('irc.password', 'IRC_PASSWORD', options, secrets);
544
+ const channels = Array.isArray(options.channels) && options.channels.length > 0
545
+ ? options.channels.map(normalizeChannel).filter(Boolean)
546
+ : splitCsv(secrets?.['irc.channels'] ?? process.env['IRC_CHANNELS']).map(normalizeChannel).filter(Boolean);
547
+ if (channels.length === 0) {
548
+ throw new Error('IRC channels not found. Provide via options.channels, secrets["irc.channels"], or IRC_CHANNELS.');
549
+ }
550
+ const nickServPassword = (options.nickServ?.password ?? resolveOptionalString('irc.nickservPassword', 'IRC_NICKSERV_PASSWORD', options, secrets) ?? '').trim();
551
+ const nickServService = (options.nickServ?.service ?? resolveOptionalString('irc.nickservService', 'IRC_NICKSERV_SERVICE', options, secrets) ?? 'NickServ').trim();
552
+ const logger = context.logger;
553
+ let adapter;
554
+ const service = new IrcService({
555
+ host,
556
+ port,
557
+ tls: useTls,
558
+ nick,
559
+ username,
560
+ realname,
561
+ password,
562
+ channels,
563
+ nickServ: nickServPassword ? { service: nickServService, password: nickServPassword } : undefined,
564
+ autoReconnect: options.autoReconnect !== false,
565
+ connectTimeoutMs: options.connectTimeoutMs ?? 15000,
566
+ }, (evt) => adapter.handleInbound(evt.sender, evt.target, evt.text), logger);
567
+ adapter = new IrcChannelAdapter({
568
+ service,
569
+ messageChunkMaxChars: options.messageChunkMaxChars ?? 350,
570
+ });
571
+ const tool = new IrcSendMessageTool(adapter);
572
+ const priority = options.priority ?? 20;
573
+ return {
574
+ name: '@framers/agentos-ext-channel-irc',
575
+ version: '0.1.0',
576
+ descriptors: [
577
+ { id: 'ircChannelSendMessage', kind: 'tool', priority, payload: tool },
578
+ { id: 'ircChannel', kind: 'messaging-channel', priority, payload: adapter },
579
+ ],
580
+ onActivate: async () => {
581
+ await adapter.initialize({ platform: 'irc', credential: password || '' });
582
+ logger?.info?.('[IRCChannel] Extension activated');
583
+ },
584
+ onDeactivate: async () => {
585
+ await adapter.shutdown();
586
+ logger?.info?.('[IRCChannel] Extension deactivated');
587
+ },
588
+ };
589
+ }
590
+ exports.default = createExtensionPack;
591
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,cAAc;AACd;;;;;;;;;;GAUG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAilBH,kDAwEC;AAvpBD,6CAAyC;AACzC,8CAAgC;AAChC,8CAAgC;AAyDhC,SAAS,aAAa,CAAC,GAAY,EAAE,QAAiB;IACpD,IAAI,OAAO,GAAG,KAAK,SAA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M,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,EAAE,CAAC;IAExC,OAAO;QACL,IAAI,EAAE,kCAAkC;QACxC,OAAO,EAAE,OAAO;QAChB,WAAW,EAAE;YACX,EAAE,EAAE,EAAE,uBAAuB,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE;YACtE,EAAE,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,mBAAmB,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE;SAC5E;QACD,UAAU,EAAE,KAAK,IAAI,EAAE;YACrB,MAAM,OAAO,CAAC,UAAU,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,IAAI,EAAE,EAAE,CAAC,CAAC;YAC1E,MAAM,EAAE,IAAI,EAAE,CAAC,kCAAkC,CAAC,CAAC;QACrD,CAAC;QACD,YAAY,EAAE,KAAK,IAAI,EAAE;YACvB,MAAM,OAAO,CAAC,QAAQ,EAAE,CAAC;YACzB,MAAM,EAAE,IAAI,EAAE,CAAC,oCAAoC,CAAC,CAAC;QACvD,CAAC;KACF,CAAC;AACJ,CAAC;AAED,kBAAe,mBAAmB,CAAC"}
package/manifest.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "$schema": "https://agentos.sh/schemas/extension-manifest-v1.json",
3
+ "id": "com.framers.channels.irc",
4
+ "name": "IRC Channel Extension",
5
+ "version": "0.1.0",
6
+ "description": "IRC channel adapter — supports inbound/outbound messages and channel joins.",
7
+ "categories": ["channel", "communication"],
8
+ "platforms": ["irc"],
9
+ "sdk": "node:net",
10
+ "extensions": [
11
+ {
12
+ "kind": "tool",
13
+ "id": "ircChannelSendMessage",
14
+ "displayName": "Send IRC Message"
15
+ },
16
+ {
17
+ "kind": "messaging-channel",
18
+ "id": "ircChannel",
19
+ "displayName": "IRC Channel Adapter"
20
+ }
21
+ ],
22
+ "requiredSecrets": ["irc.host", "irc.port", "irc.nick", "irc.channels"],
23
+ "features": [
24
+ "Outbound messaging (PRIVMSG)",
25
+ "Inbound messaging (PRIVMSG)",
26
+ "Channel join on connect (JOIN)",
27
+ "Automatic PING/PONG keepalive"
28
+ ]
29
+ }
30
+
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "@framers/agentos-ext-channel-irc",
3
+ "version": "0.1.0",
4
+ "description": "IRC messaging channel adapter for AgentOS",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "keywords": [
8
+ "agentos",
9
+ "extension",
10
+ "channel",
11
+ "irc",
12
+ "messaging"
13
+ ],
14
+ "author": {
15
+ "name": "Framers AI",
16
+ "url": "https://frame.dev"
17
+ },
18
+ "license": "MIT",
19
+ "files": [
20
+ "dist",
21
+ "manifest.json"
22
+ ],
23
+ "peerDependencies": {
24
+ "@framers/agentos": "^0.5.2"
25
+ },
26
+ "devDependencies": {
27
+ "@framers/agentos": "^0.6.6",
28
+ "@types/node": "^20.0.0",
29
+ "typescript": "^5.0.0",
30
+ "vitest": "^1.0.0"
31
+ },
32
+ "engines": {
33
+ "node": ">=18.0.0"
34
+ },
35
+ "repository": {
36
+ "type": "git",
37
+ "url": "https://github.com/framersai/agentos-extensions",
38
+ "directory": "registry/curated/channels/irc"
39
+ },
40
+ "scripts": {
41
+ "build": "tsc",
42
+ "dev": "tsc --watch",
43
+ "test": "vitest run",
44
+ "test:watch": "vitest watch",
45
+ "clean": "rm -rf dist"
46
+ }
47
+ }