opc-agent 3.0.1 → 4.0.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/README.md +404 -74
- package/README.zh-CN.md +82 -0
- package/dist/channels/dingtalk.d.ts +17 -0
- package/dist/channels/dingtalk.js +38 -0
- package/dist/channels/googlechat.d.ts +14 -0
- package/dist/channels/googlechat.js +37 -0
- package/dist/channels/imessage.d.ts +13 -0
- package/dist/channels/imessage.js +28 -0
- package/dist/channels/irc.d.ts +20 -0
- package/dist/channels/irc.js +71 -0
- package/dist/channels/line.d.ts +14 -0
- package/dist/channels/line.js +28 -0
- package/dist/channels/matrix.d.ts +15 -0
- package/dist/channels/matrix.js +28 -0
- package/dist/channels/mattermost.d.ts +18 -0
- package/dist/channels/mattermost.js +49 -0
- package/dist/channels/msteams.d.ts +14 -0
- package/dist/channels/msteams.js +28 -0
- package/dist/channels/nostr.d.ts +14 -0
- package/dist/channels/nostr.js +28 -0
- package/dist/channels/qq.d.ts +15 -0
- package/dist/channels/qq.js +28 -0
- package/dist/channels/signal.d.ts +14 -0
- package/dist/channels/signal.js +28 -0
- package/dist/channels/sms.d.ts +15 -0
- package/dist/channels/sms.js +28 -0
- package/dist/channels/twitch.d.ts +17 -0
- package/dist/channels/twitch.js +59 -0
- package/dist/channels/voice-call.d.ts +27 -0
- package/dist/channels/voice-call.js +82 -0
- package/dist/channels/whatsapp.d.ts +14 -0
- package/dist/channels/whatsapp.js +28 -0
- package/dist/cli/chat.d.ts +2 -0
- package/dist/cli/chat.js +134 -0
- package/dist/cli/setup.d.ts +4 -0
- package/dist/cli/setup.js +303 -0
- package/dist/cli.js +142 -6
- package/dist/core/api-server.d.ts +25 -0
- package/dist/core/api-server.js +286 -0
- package/dist/core/audio.d.ts +50 -0
- package/dist/core/audio.js +68 -0
- package/dist/core/context-discovery.d.ts +16 -0
- package/dist/core/context-discovery.js +107 -0
- package/dist/core/context-refs.d.ts +29 -0
- package/dist/core/context-refs.js +162 -0
- package/dist/core/gateway.d.ts +53 -0
- package/dist/core/gateway.js +80 -0
- package/dist/core/heartbeat.d.ts +19 -0
- package/dist/core/heartbeat.js +50 -0
- package/dist/core/hooks.d.ts +28 -0
- package/dist/core/hooks.js +82 -0
- package/dist/core/ide-bridge.d.ts +53 -0
- package/dist/core/ide-bridge.js +97 -0
- package/dist/core/node-network.d.ts +23 -0
- package/dist/core/node-network.js +77 -0
- package/dist/core/profiles.d.ts +27 -0
- package/dist/core/profiles.js +131 -0
- package/dist/core/sandbox.d.ts +25 -0
- package/dist/core/sandbox.js +84 -1
- package/dist/core/session-manager.d.ts +33 -0
- package/dist/core/session-manager.js +157 -0
- package/dist/core/vision.d.ts +45 -0
- package/dist/core/vision.js +177 -0
- package/dist/hub/brain-seed.d.ts +14 -0
- package/dist/hub/brain-seed.js +77 -0
- package/dist/hub/client.d.ts +25 -0
- package/dist/hub/client.js +44 -0
- package/dist/index.d.ts +66 -1
- package/dist/index.js +95 -3
- package/dist/memory/context-compressor.d.ts +43 -0
- package/dist/memory/context-compressor.js +167 -0
- package/dist/memory/index.d.ts +4 -0
- package/dist/memory/index.js +5 -1
- package/dist/memory/user-profiler.d.ts +50 -0
- package/dist/memory/user-profiler.js +201 -0
- package/dist/providers/index.d.ts +1 -1
- package/dist/providers/index.js +54 -1
- package/dist/scheduler/cron-engine.d.ts +41 -0
- package/dist/scheduler/cron-engine.js +200 -0
- package/dist/scheduler/index.d.ts +3 -0
- package/dist/scheduler/index.js +7 -0
- package/dist/schema/oad.d.ts +12 -12
- package/dist/security/approvals.d.ts +53 -0
- package/dist/security/approvals.js +115 -0
- package/dist/security/elevated.d.ts +41 -0
- package/dist/security/elevated.js +89 -0
- package/dist/security/index.d.ts +6 -0
- package/dist/security/index.js +7 -1
- package/dist/security/secrets.d.ts +34 -0
- package/dist/security/secrets.js +115 -0
- package/dist/skills/builtin/index.d.ts +6 -0
- package/dist/skills/builtin/index.js +402 -0
- package/dist/skills/marketplace.d.ts +30 -0
- package/dist/skills/marketplace.js +142 -0
- package/dist/skills/types.d.ts +34 -0
- package/dist/skills/types.js +16 -0
- package/dist/studio/server.d.ts +25 -0
- package/dist/studio/server.js +780 -0
- package/dist/studio/templates-data.d.ts +21 -0
- package/dist/studio/templates-data.js +148 -0
- package/dist/studio-ui/index.html +2502 -1073
- package/dist/tools/builtin/browser.d.ts +47 -0
- package/dist/tools/builtin/browser.js +284 -0
- package/dist/tools/builtin/home-assistant.d.ts +12 -0
- package/dist/tools/builtin/home-assistant.js +126 -0
- package/dist/tools/builtin/index.d.ts +7 -1
- package/dist/tools/builtin/index.js +23 -2
- package/dist/tools/builtin/rl-tools.d.ts +13 -0
- package/dist/tools/builtin/rl-tools.js +228 -0
- package/dist/tools/builtin/vision.d.ts +6 -0
- package/dist/tools/builtin/vision.js +61 -0
- package/dist/tools/builtin/web-search.d.ts +9 -0
- package/dist/tools/builtin/web-search.js +150 -0
- package/dist/tools/document-processor.d.ts +39 -0
- package/dist/tools/document-processor.js +188 -0
- package/dist/tools/image-generator.d.ts +42 -0
- package/dist/tools/image-generator.js +136 -0
- package/dist/tools/web-scraper.d.ts +20 -0
- package/dist/tools/web-scraper.js +148 -0
- package/dist/tools/web-search.d.ts +51 -0
- package/dist/tools/web-search.js +152 -0
- package/install.ps1 +154 -0
- package/install.sh +164 -0
- package/package.json +63 -52
- package/src/channels/dingtalk.ts +46 -0
- package/src/channels/googlechat.ts +42 -0
- package/src/channels/imessage.ts +32 -0
- package/src/channels/irc.ts +82 -0
- package/src/channels/line.ts +33 -0
- package/src/channels/matrix.ts +34 -0
- package/src/channels/mattermost.ts +57 -0
- package/src/channels/msteams.ts +33 -0
- package/src/channels/nostr.ts +33 -0
- package/src/channels/qq.ts +34 -0
- package/src/channels/signal.ts +33 -0
- package/src/channels/sms.ts +34 -0
- package/src/channels/twitch.ts +65 -0
- package/src/channels/voice-call.ts +100 -0
- package/src/channels/whatsapp.ts +33 -0
- package/src/cli/chat.ts +99 -0
- package/src/cli/setup.ts +314 -0
- package/src/cli.ts +148 -6
- package/src/core/api-server.ts +277 -0
- package/src/core/audio.ts +98 -0
- package/src/core/context-discovery.ts +85 -0
- package/src/core/context-refs.ts +140 -0
- package/src/core/gateway.ts +106 -0
- package/src/core/heartbeat.ts +51 -0
- package/src/core/hooks.ts +105 -0
- package/src/core/ide-bridge.ts +133 -0
- package/src/core/node-network.ts +86 -0
- package/src/core/profiles.ts +122 -0
- package/src/core/sandbox.ts +100 -0
- package/src/core/session-manager.ts +137 -0
- package/src/core/vision.ts +180 -0
- package/src/hub/brain-seed.ts +54 -0
- package/src/hub/client.ts +60 -0
- package/src/index.ts +86 -1
- package/src/memory/context-compressor.ts +189 -0
- package/src/memory/index.ts +4 -0
- package/src/memory/user-profiler.ts +215 -0
- package/src/providers/index.ts +64 -1
- package/src/scheduler/cron-engine.ts +191 -0
- package/src/scheduler/index.ts +2 -0
- package/src/security/approvals.ts +143 -0
- package/src/security/elevated.ts +105 -0
- package/src/security/index.ts +6 -0
- package/src/security/secrets.ts +129 -0
- package/src/skills/builtin/index.ts +408 -0
- package/src/skills/marketplace.ts +113 -0
- package/src/skills/types.ts +42 -0
- package/src/studio/server.ts +1591 -791
- package/src/studio/templates-data.ts +178 -0
- package/src/studio-ui/index.html +2502 -1073
- package/src/tools/builtin/browser.ts +299 -0
- package/src/tools/builtin/home-assistant.ts +116 -0
- package/src/tools/builtin/index.ts +37 -28
- package/src/tools/builtin/rl-tools.ts +243 -0
- package/src/tools/builtin/vision.ts +64 -0
- package/src/tools/builtin/web-search.ts +126 -0
- package/src/tools/document-processor.ts +213 -0
- package/src/tools/image-generator.ts +150 -0
- package/src/tools/web-scraper.ts +179 -0
- package/src/tools/web-search.ts +180 -0
- package/tests/api-server.test.ts +148 -0
- package/tests/approvals.test.ts +89 -0
- package/tests/audio.test.ts +40 -0
- package/tests/browser.test.ts +179 -0
- package/tests/builtin-tools.test.ts +83 -83
- package/tests/channels-extra.test.ts +45 -0
- package/tests/context-compressor.test.ts +172 -0
- package/tests/context-refs.test.ts +121 -0
- package/tests/cron-engine.test.ts +101 -0
- package/tests/document-processor.test.ts +69 -0
- package/tests/e2e-nocode.test.ts +442 -0
- package/tests/elevated.test.ts +69 -0
- package/tests/gateway.test.ts +63 -71
- package/tests/home-assistant.test.ts +40 -0
- package/tests/hooks.test.ts +79 -0
- package/tests/ide-bridge.test.ts +38 -0
- package/tests/image-generator.test.ts +84 -0
- package/tests/node-network.test.ts +74 -0
- package/tests/profiles.test.ts +61 -0
- package/tests/rl-tools.test.ts +93 -0
- package/tests/sandbox-manager.test.ts +46 -0
- package/tests/secrets.test.ts +107 -0
- package/tests/settings-api.test.ts +148 -0
- package/tests/setup.test.ts +73 -0
- package/tests/studio.test.ts +402 -229
- package/tests/tools/builtin-extended.test.ts +138 -138
- package/tests/user-profiler.test.ts +169 -0
- package/tests/v090-features.test.ts +254 -0
- package/tests/vision.test.ts +61 -0
- package/tests/voice-call.test.ts +47 -0
- package/tests/voice-interaction.test.ts +38 -0
- package/tests/web-search.test.ts +155 -0
package/README.zh-CN.md
CHANGED
|
@@ -24,6 +24,22 @@ OPC Agent 是一个 **TypeScript 优先的开放智能体框架**,由 [跃盟
|
|
|
24
24
|
|
|
25
25
|
## ⚡ 快速开始(30 秒上手)
|
|
26
26
|
|
|
27
|
+
### 一键安装(推荐)
|
|
28
|
+
|
|
29
|
+
**macOS / Linux:**
|
|
30
|
+
```bash
|
|
31
|
+
curl -fsSL https://raw.githubusercontent.com/Deepleaper/opc-agent/main/install.sh | bash
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**Windows (PowerShell):**
|
|
35
|
+
```powershell
|
|
36
|
+
irm https://raw.githubusercontent.com/Deepleaper/opc-agent/main/install.ps1 | iex
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
> 自动安装 Node.js + OPC Agent + Ollama(可选),全程有引导提示。
|
|
40
|
+
|
|
41
|
+
### 手动安装
|
|
42
|
+
|
|
27
43
|
```bash
|
|
28
44
|
# 1. 安装 CLI
|
|
29
45
|
npm install -g opc-agent
|
|
@@ -386,6 +402,72 @@ spec:
|
|
|
386
402
|
maxLatencyMs: 5000
|
|
387
403
|
```
|
|
388
404
|
|
|
405
|
+
## 🔍 与其他 Agent 框架的差异
|
|
406
|
+
|
|
407
|
+
OPC Agent 的核心设计哲学是**记忆进化 + 全渠道 + 工位模板 + 生产工具链四件套**。与大多数 Agent 框架关注"如何编排多个 Agent 对话"不同,OPC 更关注的是:一个 Agent 如何在真实生产环境中**持续进化、随处触达、开箱即用**。这决定了我们在架构选择上的一系列差异。
|
|
408
|
+
|
|
409
|
+
#### vs Hermes Agent
|
|
410
|
+
|
|
411
|
+
**设计思路差异**:Hermes 是 Python 单体框架,围绕 Nous Research 的模型生态构建,强调自学习进化和 RL 训练。OPC 是 TypeScript 模块化四件套(Brain / Agent / Channel / CLI),强调工程化和开箱即用。
|
|
412
|
+
|
|
413
|
+
**OPC 的优势**:记忆进化三件套(learn → recall → evolve 自动聚类提炼)、三层 Brain Seed 预置知识体系、25 个内置渠道(vs Hermes 16+)、100+ 工位模板、原生 A2A + AG-UI 协议支持、OpenAI 兼容 API Server。
|
|
414
|
+
|
|
415
|
+
**Hermes 的优势**:Python 生态更成熟、GRPO + LoRA 的 RL 训练管线更完善、Nous Research 社区生态更大、Docker 沙箱隔离方案更成熟。
|
|
416
|
+
|
|
417
|
+
**适合谁**:如果你需要 Python 生态和 RL 训练能力,选 Hermes;如果你需要 TypeScript 全栈、记忆进化、全渠道触达和生产工具链,选 OPC。
|
|
418
|
+
|
|
419
|
+
#### vs OpenClaw
|
|
420
|
+
|
|
421
|
+
**设计思路差异**:OpenClaw 是重量级 runtime + 配置驱动,提供完整的 Gateway 运行时环境,适合"安装一次、配置运行"的场景。OPC 是轻量 CLI + 代码优先,四件套可独立使用,适合开发者自由组合。
|
|
422
|
+
|
|
423
|
+
**OPC 的优势**:模块化四件套可按需引入、100+ 工位模板、记忆进化系统、25 个内置渠道、`opc init/dev/test/deploy` 全生命周期 CLI、A2A/AG-UI 协议支持。
|
|
424
|
+
|
|
425
|
+
**OpenClaw 的优势**:开箱即用的 runtime 体验、Puppeteer 浏览器自动化、成熟的权限和安全沙箱、配置驱动上手门槛低。
|
|
426
|
+
|
|
427
|
+
**适合谁**:如果你偏好"配置即运行"的一体化方案,选 OpenClaw;如果你偏好代码优先、模块自由组合、需要记忆进化和工位体系,选 OPC。
|
|
428
|
+
|
|
429
|
+
#### vs CrewAI
|
|
430
|
+
|
|
431
|
+
**设计思路差异**:CrewAI 采用 Crew 编排模式——定义 Agent 角色、分配 Task、按流程执行。OPC 采用工位(Seat)+ 大脑(Brain)模式——每个 Agent 有独立记忆和工位模板,通过 Brain 实现知识积累和进化。
|
|
432
|
+
|
|
433
|
+
**OPC 的优势**:记忆进化(不只是短期/长期记忆,而是自动聚类提炼)、Brain Seed 预置知识、25 个内置渠道(CrewAI 需自行接入)、100+ 工位模板、TypeScript 原生。
|
|
434
|
+
|
|
435
|
+
**CrewAI 的优势**:Crew + Flow 编排模式直观易懂、Python 生态、100K+ 用户的成熟社区、Enterprise 版本功能丰富。
|
|
436
|
+
|
|
437
|
+
**适合谁**:如果你需要多 Agent 任务编排且偏好 Python,选 CrewAI;如果你需要单 Agent 深度进化、全渠道部署、TypeScript 生态,选 OPC。
|
|
438
|
+
|
|
439
|
+
#### vs AutoGen
|
|
440
|
+
|
|
441
|
+
**设计思路差异**:AutoGen 是微软主导的对话驱动多 Agent 框架,核心是 Agent 之间的对话协作和 UserProxy 人机交互。OPC 是任务驱动的工位模式,强调单 Agent 的记忆进化和生产部署能力。
|
|
442
|
+
|
|
443
|
+
**OPC 的优势**:记忆进化系统、Brain Seed、25 个内置渠道、100+ 工位模板、全生命周期 CLI、YAML 声明式配置。
|
|
444
|
+
|
|
445
|
+
**AutoGen 的优势**:微软生态支持、分布式 Agent 能力、AutoGen Studio 可视化、UserProxy 人机交互模式成熟、Python/C# 双语言支持、社区活跃。
|
|
446
|
+
|
|
447
|
+
**适合谁**:如果你需要多 Agent 对话协作和微软生态集成,选 AutoGen;如果你需要记忆进化、全渠道触达、工位模板和 TypeScript 工具链,选 OPC。
|
|
448
|
+
|
|
449
|
+
#### 功能速查表
|
|
450
|
+
|
|
451
|
+
| 功能 | OPC Agent | Hermes Agent | OpenClaw | CrewAI | AutoGen |
|
|
452
|
+
|---|:-:|:-:|:-:|:-:|:-:|
|
|
453
|
+
| **语言** | TypeScript | Python | TypeScript | Python | Python/C# |
|
|
454
|
+
| **记忆进化 (evolve)** | ✅ | 🔶 | ❌ | ❌ | ❌ |
|
|
455
|
+
| **Brain Seed 预置知识** | ✅ 三层 | ❌ | ❌ | ❌ | ❌ |
|
|
456
|
+
| **内置渠道** | 25 | 16+ | 2 | ❌ | ❌ |
|
|
457
|
+
| **工位模板** | 100+ | ❌ | ❌ | ❌ | ❌ |
|
|
458
|
+
| **CLI 全生命周期** | ✅ 20+ 命令 | 🔶 | 🔶 | 🔶 | 🔶 |
|
|
459
|
+
| **A2A + AG-UI** | ✅ | 🔶 / ❌ | ❌ | ❌ | ❌ |
|
|
460
|
+
| **多 Agent 协作** | ✅ | ✅ | 🔶 | ✅ | ✅ |
|
|
461
|
+
| **RL 训练** | ✅ 反馈优化 | ✅ GRPO+LoRA | ❌ | ❌ | ❌ |
|
|
462
|
+
| **浏览器自动化** | ✅ | ✅ | ✅ | ❌ | ❌ |
|
|
463
|
+
| **可视化** | ✅ OPC Studio | ✅ Dashboard | ❌ | 🔶 | ✅ Studio |
|
|
464
|
+
| **社区成熟度** | 🚧 早期 | ✅ 活跃 | 🚧 小众 | ✅ 大规模 | ✅ 大规模 |
|
|
465
|
+
| **许可证** | Apache-2.0 | MIT | MIT | Apache-2.0 | MIT |
|
|
466
|
+
|
|
467
|
+
> 对比基于各项目公开文档(截至 2026 年 4 月)。各框架都在快速迭代,如有偏差欢迎 [Issue 指正](https://github.com/Deepleaper/opc-agent/issues)。
|
|
468
|
+
|
|
469
|
+
---
|
|
470
|
+
|
|
389
471
|
## 🤝 贡献指南
|
|
390
472
|
|
|
391
473
|
欢迎所有形式的贡献!
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BaseChannel } from './index';
|
|
2
|
+
export interface DingTalkChannelConfig {
|
|
3
|
+
webhookUrl: string;
|
|
4
|
+
secret?: string;
|
|
5
|
+
appKey?: string;
|
|
6
|
+
appSecret?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare class DingTalkChannel extends BaseChannel {
|
|
9
|
+
readonly type = "dingtalk";
|
|
10
|
+
private config;
|
|
11
|
+
private running;
|
|
12
|
+
constructor(config: DingTalkChannelConfig);
|
|
13
|
+
start(): Promise<void>;
|
|
14
|
+
stop(): Promise<void>;
|
|
15
|
+
send(chatId: string, text: string): Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=dingtalk.d.ts.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DingTalkChannel = void 0;
|
|
4
|
+
const index_1 = require("./index");
|
|
5
|
+
class DingTalkChannel extends index_1.BaseChannel {
|
|
6
|
+
type = 'dingtalk';
|
|
7
|
+
config;
|
|
8
|
+
running = false;
|
|
9
|
+
constructor(config) {
|
|
10
|
+
super();
|
|
11
|
+
if (!config.webhookUrl) {
|
|
12
|
+
throw new Error('DingTalkChannel requires webhookUrl in config');
|
|
13
|
+
}
|
|
14
|
+
this.config = config;
|
|
15
|
+
}
|
|
16
|
+
async start() {
|
|
17
|
+
this.running = true;
|
|
18
|
+
}
|
|
19
|
+
async stop() {
|
|
20
|
+
this.running = false;
|
|
21
|
+
}
|
|
22
|
+
async send(chatId, text) {
|
|
23
|
+
if (!this.running) {
|
|
24
|
+
throw new Error('DingTalkChannel: not started. Call start() first.');
|
|
25
|
+
}
|
|
26
|
+
const body = JSON.stringify({ msgtype: 'text', text: { content: text } });
|
|
27
|
+
const res = await fetch(this.config.webhookUrl, {
|
|
28
|
+
method: 'POST',
|
|
29
|
+
headers: { 'Content-Type': 'application/json' },
|
|
30
|
+
body,
|
|
31
|
+
});
|
|
32
|
+
if (!res.ok) {
|
|
33
|
+
throw new Error(`DingTalk webhook failed: ${res.status}`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.DingTalkChannel = DingTalkChannel;
|
|
38
|
+
//# sourceMappingURL=dingtalk.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BaseChannel } from './index';
|
|
2
|
+
export interface GoogleChatChannelConfig {
|
|
3
|
+
webhookUrl: string;
|
|
4
|
+
}
|
|
5
|
+
export declare class GoogleChatChannel extends BaseChannel {
|
|
6
|
+
readonly type = "googlechat";
|
|
7
|
+
private config;
|
|
8
|
+
private running;
|
|
9
|
+
constructor(config: GoogleChatChannelConfig);
|
|
10
|
+
start(): Promise<void>;
|
|
11
|
+
stop(): Promise<void>;
|
|
12
|
+
send(spaceId: string, text: string): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=googlechat.d.ts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GoogleChatChannel = void 0;
|
|
4
|
+
const index_1 = require("./index");
|
|
5
|
+
class GoogleChatChannel extends index_1.BaseChannel {
|
|
6
|
+
type = 'googlechat';
|
|
7
|
+
config;
|
|
8
|
+
running = false;
|
|
9
|
+
constructor(config) {
|
|
10
|
+
super();
|
|
11
|
+
if (!config.webhookUrl) {
|
|
12
|
+
throw new Error('GoogleChatChannel requires webhookUrl in config');
|
|
13
|
+
}
|
|
14
|
+
this.config = config;
|
|
15
|
+
}
|
|
16
|
+
async start() {
|
|
17
|
+
this.running = true;
|
|
18
|
+
}
|
|
19
|
+
async stop() {
|
|
20
|
+
this.running = false;
|
|
21
|
+
}
|
|
22
|
+
async send(spaceId, text) {
|
|
23
|
+
if (!this.running) {
|
|
24
|
+
throw new Error('GoogleChatChannel: not started. Call start() first.');
|
|
25
|
+
}
|
|
26
|
+
const res = await fetch(this.config.webhookUrl, {
|
|
27
|
+
method: 'POST',
|
|
28
|
+
headers: { 'Content-Type': 'application/json' },
|
|
29
|
+
body: JSON.stringify({ text }),
|
|
30
|
+
});
|
|
31
|
+
if (!res.ok) {
|
|
32
|
+
throw new Error(`Google Chat webhook failed: ${res.status}`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.GoogleChatChannel = GoogleChatChannel;
|
|
37
|
+
//# sourceMappingURL=googlechat.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BaseChannel } from './index';
|
|
2
|
+
export interface IMessageChannelConfig {
|
|
3
|
+
applescriptPath?: string;
|
|
4
|
+
}
|
|
5
|
+
export declare class IMessageChannel extends BaseChannel {
|
|
6
|
+
readonly type = "imessage";
|
|
7
|
+
private config;
|
|
8
|
+
constructor(config?: IMessageChannelConfig);
|
|
9
|
+
start(): Promise<void>;
|
|
10
|
+
stop(): Promise<void>;
|
|
11
|
+
send(chatId: string, text: string): Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=imessage.d.ts.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IMessageChannel = void 0;
|
|
4
|
+
const index_1 = require("./index");
|
|
5
|
+
class IMessageChannel extends index_1.BaseChannel {
|
|
6
|
+
type = 'imessage';
|
|
7
|
+
config;
|
|
8
|
+
constructor(config = {}) {
|
|
9
|
+
super();
|
|
10
|
+
this.config = config;
|
|
11
|
+
}
|
|
12
|
+
async start() {
|
|
13
|
+
try {
|
|
14
|
+
require('macOS iMessage CLI');
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
throw new Error('Install macOS iMessage CLI to use the IMessageChannel. Run: npm install macOS iMessage CLI');
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
async stop() {
|
|
21
|
+
// cleanup
|
|
22
|
+
}
|
|
23
|
+
async send(chatId, text) {
|
|
24
|
+
throw new Error('IMessageChannel: not yet connected. Call start() first.');
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.IMessageChannel = IMessageChannel;
|
|
28
|
+
//# sourceMappingURL=imessage.js.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { BaseChannel } from './index';
|
|
2
|
+
export interface IRCChannelConfig {
|
|
3
|
+
host: string;
|
|
4
|
+
port?: number;
|
|
5
|
+
nick: string;
|
|
6
|
+
channels: string[];
|
|
7
|
+
tls?: boolean;
|
|
8
|
+
password?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare class IRCChannel extends BaseChannel {
|
|
11
|
+
readonly type = "irc";
|
|
12
|
+
private config;
|
|
13
|
+
private client;
|
|
14
|
+
private running;
|
|
15
|
+
constructor(config: IRCChannelConfig);
|
|
16
|
+
start(): Promise<void>;
|
|
17
|
+
stop(): Promise<void>;
|
|
18
|
+
send(target: string, text: string): Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=irc.d.ts.map
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IRCChannel = void 0;
|
|
4
|
+
const index_1 = require("./index");
|
|
5
|
+
class IRCChannel extends index_1.BaseChannel {
|
|
6
|
+
type = 'irc';
|
|
7
|
+
config;
|
|
8
|
+
client = null;
|
|
9
|
+
running = false;
|
|
10
|
+
constructor(config) {
|
|
11
|
+
super();
|
|
12
|
+
if (!config.host || !config.nick || !config.channels?.length) {
|
|
13
|
+
throw new Error('IRCChannel requires host, nick, and channels in config');
|
|
14
|
+
}
|
|
15
|
+
this.config = config;
|
|
16
|
+
}
|
|
17
|
+
async start() {
|
|
18
|
+
let IRC;
|
|
19
|
+
try {
|
|
20
|
+
IRC = require('irc-framework');
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
throw new Error('Install irc-framework to use the IRCChannel. Run: npm install irc-framework');
|
|
24
|
+
}
|
|
25
|
+
this.client = new IRC.Client();
|
|
26
|
+
this.client.connect({
|
|
27
|
+
host: this.config.host,
|
|
28
|
+
port: this.config.port ?? (this.config.tls ? 6697 : 6667),
|
|
29
|
+
nick: this.config.nick,
|
|
30
|
+
tls: this.config.tls ?? false,
|
|
31
|
+
password: this.config.password,
|
|
32
|
+
});
|
|
33
|
+
await new Promise((resolve, reject) => {
|
|
34
|
+
this.client.on('registered', () => {
|
|
35
|
+
for (const ch of this.config.channels) {
|
|
36
|
+
this.client.join(ch);
|
|
37
|
+
}
|
|
38
|
+
resolve();
|
|
39
|
+
});
|
|
40
|
+
this.client.on('error', (err) => reject(new Error(`IRC connection error: ${err.message || err}`)));
|
|
41
|
+
});
|
|
42
|
+
this.running = true;
|
|
43
|
+
this.client.on('privmsg', async (event) => {
|
|
44
|
+
if (!this.handler)
|
|
45
|
+
return;
|
|
46
|
+
const msg = {
|
|
47
|
+
id: Date.now().toString(),
|
|
48
|
+
role: 'user',
|
|
49
|
+
content: event.message,
|
|
50
|
+
timestamp: Date.now(),
|
|
51
|
+
metadata: { channel: event.target, nick: event.nick },
|
|
52
|
+
};
|
|
53
|
+
await this.handler(msg);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
async stop() {
|
|
57
|
+
if (this.client) {
|
|
58
|
+
this.client.quit('Goodbye');
|
|
59
|
+
this.client = null;
|
|
60
|
+
}
|
|
61
|
+
this.running = false;
|
|
62
|
+
}
|
|
63
|
+
async send(target, text) {
|
|
64
|
+
if (!this.running || !this.client) {
|
|
65
|
+
throw new Error('IRCChannel: not started. Call start() first.');
|
|
66
|
+
}
|
|
67
|
+
this.client.say(target, text);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
exports.IRCChannel = IRCChannel;
|
|
71
|
+
//# sourceMappingURL=irc.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BaseChannel } from './index';
|
|
2
|
+
export interface LINEChannelConfig {
|
|
3
|
+
channelAccessToken?: string;
|
|
4
|
+
channelSecret?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare class LINEChannel extends BaseChannel {
|
|
7
|
+
readonly type = "line";
|
|
8
|
+
private config;
|
|
9
|
+
constructor(config?: LINEChannelConfig);
|
|
10
|
+
start(): Promise<void>;
|
|
11
|
+
stop(): Promise<void>;
|
|
12
|
+
send(chatId: string, text: string): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=line.d.ts.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LINEChannel = void 0;
|
|
4
|
+
const index_1 = require("./index");
|
|
5
|
+
class LINEChannel extends index_1.BaseChannel {
|
|
6
|
+
type = 'line';
|
|
7
|
+
config;
|
|
8
|
+
constructor(config = {}) {
|
|
9
|
+
super();
|
|
10
|
+
this.config = config;
|
|
11
|
+
}
|
|
12
|
+
async start() {
|
|
13
|
+
try {
|
|
14
|
+
require('@line/bot-sdk');
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
throw new Error('Install @line/bot-sdk to use the LINEChannel. Run: npm install @line/bot-sdk');
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
async stop() {
|
|
21
|
+
// cleanup
|
|
22
|
+
}
|
|
23
|
+
async send(chatId, text) {
|
|
24
|
+
throw new Error('LINEChannel: not yet connected. Call start() first.');
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.LINEChannel = LINEChannel;
|
|
28
|
+
//# sourceMappingURL=line.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BaseChannel } from './index';
|
|
2
|
+
export interface MatrixChannelConfig {
|
|
3
|
+
homeserverUrl?: string;
|
|
4
|
+
accessToken?: string;
|
|
5
|
+
userId?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare class MatrixChannel extends BaseChannel {
|
|
8
|
+
readonly type = "matrix";
|
|
9
|
+
private config;
|
|
10
|
+
constructor(config?: MatrixChannelConfig);
|
|
11
|
+
start(): Promise<void>;
|
|
12
|
+
stop(): Promise<void>;
|
|
13
|
+
send(chatId: string, text: string): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=matrix.d.ts.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MatrixChannel = void 0;
|
|
4
|
+
const index_1 = require("./index");
|
|
5
|
+
class MatrixChannel extends index_1.BaseChannel {
|
|
6
|
+
type = 'matrix';
|
|
7
|
+
config;
|
|
8
|
+
constructor(config = {}) {
|
|
9
|
+
super();
|
|
10
|
+
this.config = config;
|
|
11
|
+
}
|
|
12
|
+
async start() {
|
|
13
|
+
try {
|
|
14
|
+
require('matrix-js-sdk');
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
throw new Error('Install matrix-js-sdk to use the MatrixChannel. Run: npm install matrix-js-sdk');
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
async stop() {
|
|
21
|
+
// cleanup
|
|
22
|
+
}
|
|
23
|
+
async send(chatId, text) {
|
|
24
|
+
throw new Error('MatrixChannel: not yet connected. Call start() first.');
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.MatrixChannel = MatrixChannel;
|
|
28
|
+
//# sourceMappingURL=matrix.js.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { BaseChannel } from './index';
|
|
2
|
+
export interface MattermostChannelConfig {
|
|
3
|
+
serverUrl: string;
|
|
4
|
+
token: string;
|
|
5
|
+
teamId?: string;
|
|
6
|
+
defaultChannelId?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare class MattermostChannel extends BaseChannel {
|
|
9
|
+
readonly type = "mattermost";
|
|
10
|
+
private config;
|
|
11
|
+
private running;
|
|
12
|
+
private ws;
|
|
13
|
+
constructor(config: MattermostChannelConfig);
|
|
14
|
+
start(): Promise<void>;
|
|
15
|
+
stop(): Promise<void>;
|
|
16
|
+
send(channelId: string, text: string): Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=mattermost.d.ts.map
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MattermostChannel = void 0;
|
|
4
|
+
const index_1 = require("./index");
|
|
5
|
+
class MattermostChannel extends index_1.BaseChannel {
|
|
6
|
+
type = 'mattermost';
|
|
7
|
+
config;
|
|
8
|
+
running = false;
|
|
9
|
+
ws = null;
|
|
10
|
+
constructor(config) {
|
|
11
|
+
super();
|
|
12
|
+
if (!config.serverUrl || !config.token) {
|
|
13
|
+
throw new Error('MattermostChannel requires serverUrl and token in config');
|
|
14
|
+
}
|
|
15
|
+
this.config = config;
|
|
16
|
+
}
|
|
17
|
+
async start() {
|
|
18
|
+
// Verify connection by hitting the API
|
|
19
|
+
const res = await fetch(`${this.config.serverUrl}/api/v4/users/me`, {
|
|
20
|
+
headers: { Authorization: `Bearer ${this.config.token}` },
|
|
21
|
+
}).catch(() => null);
|
|
22
|
+
this.running = true;
|
|
23
|
+
}
|
|
24
|
+
async stop() {
|
|
25
|
+
if (this.ws) {
|
|
26
|
+
this.ws.close();
|
|
27
|
+
this.ws = null;
|
|
28
|
+
}
|
|
29
|
+
this.running = false;
|
|
30
|
+
}
|
|
31
|
+
async send(channelId, text) {
|
|
32
|
+
if (!this.running) {
|
|
33
|
+
throw new Error('MattermostChannel: not started. Call start() first.');
|
|
34
|
+
}
|
|
35
|
+
const res = await fetch(`${this.config.serverUrl}/api/v4/posts`, {
|
|
36
|
+
method: 'POST',
|
|
37
|
+
headers: {
|
|
38
|
+
Authorization: `Bearer ${this.config.token}`,
|
|
39
|
+
'Content-Type': 'application/json',
|
|
40
|
+
},
|
|
41
|
+
body: JSON.stringify({ channel_id: channelId, message: text }),
|
|
42
|
+
});
|
|
43
|
+
if (!res.ok) {
|
|
44
|
+
throw new Error(`Mattermost API failed: ${res.status}`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.MattermostChannel = MattermostChannel;
|
|
49
|
+
//# sourceMappingURL=mattermost.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BaseChannel } from './index';
|
|
2
|
+
export interface MSTeamsChannelConfig {
|
|
3
|
+
appId?: string;
|
|
4
|
+
appPassword?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare class MSTeamsChannel extends BaseChannel {
|
|
7
|
+
readonly type = "msteams";
|
|
8
|
+
private config;
|
|
9
|
+
constructor(config?: MSTeamsChannelConfig);
|
|
10
|
+
start(): Promise<void>;
|
|
11
|
+
stop(): Promise<void>;
|
|
12
|
+
send(chatId: string, text: string): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=msteams.d.ts.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MSTeamsChannel = void 0;
|
|
4
|
+
const index_1 = require("./index");
|
|
5
|
+
class MSTeamsChannel extends index_1.BaseChannel {
|
|
6
|
+
type = 'msteams';
|
|
7
|
+
config;
|
|
8
|
+
constructor(config = {}) {
|
|
9
|
+
super();
|
|
10
|
+
this.config = config;
|
|
11
|
+
}
|
|
12
|
+
async start() {
|
|
13
|
+
try {
|
|
14
|
+
require('botframework-connector');
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
throw new Error('Install botframework-connector to use the MSTeamsChannel. Run: npm install botframework-connector');
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
async stop() {
|
|
21
|
+
// cleanup
|
|
22
|
+
}
|
|
23
|
+
async send(chatId, text) {
|
|
24
|
+
throw new Error('MSTeamsChannel: not yet connected. Call start() first.');
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.MSTeamsChannel = MSTeamsChannel;
|
|
28
|
+
//# sourceMappingURL=msteams.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BaseChannel } from './index';
|
|
2
|
+
export interface NostrChannelConfig {
|
|
3
|
+
privateKey?: string;
|
|
4
|
+
relays?: string[];
|
|
5
|
+
}
|
|
6
|
+
export declare class NostrChannel extends BaseChannel {
|
|
7
|
+
readonly type = "nostr";
|
|
8
|
+
private config;
|
|
9
|
+
constructor(config?: NostrChannelConfig);
|
|
10
|
+
start(): Promise<void>;
|
|
11
|
+
stop(): Promise<void>;
|
|
12
|
+
send(chatId: string, text: string): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=nostr.d.ts.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NostrChannel = void 0;
|
|
4
|
+
const index_1 = require("./index");
|
|
5
|
+
class NostrChannel extends index_1.BaseChannel {
|
|
6
|
+
type = 'nostr';
|
|
7
|
+
config;
|
|
8
|
+
constructor(config = {}) {
|
|
9
|
+
super();
|
|
10
|
+
this.config = config;
|
|
11
|
+
}
|
|
12
|
+
async start() {
|
|
13
|
+
try {
|
|
14
|
+
require('nostr-tools');
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
throw new Error('Install nostr-tools to use the NostrChannel. Run: npm install nostr-tools');
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
async stop() {
|
|
21
|
+
// cleanup
|
|
22
|
+
}
|
|
23
|
+
async send(chatId, text) {
|
|
24
|
+
throw new Error('NostrChannel: not yet connected. Call start() first.');
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.NostrChannel = NostrChannel;
|
|
28
|
+
//# sourceMappingURL=nostr.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BaseChannel } from './index';
|
|
2
|
+
export interface QQChannelConfig {
|
|
3
|
+
appId?: string;
|
|
4
|
+
token?: string;
|
|
5
|
+
sandbox?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare class QQChannel extends BaseChannel {
|
|
8
|
+
readonly type = "qq";
|
|
9
|
+
private config;
|
|
10
|
+
constructor(config?: QQChannelConfig);
|
|
11
|
+
start(): Promise<void>;
|
|
12
|
+
stop(): Promise<void>;
|
|
13
|
+
send(chatId: string, text: string): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=qq.d.ts.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.QQChannel = void 0;
|
|
4
|
+
const index_1 = require("./index");
|
|
5
|
+
class QQChannel extends index_1.BaseChannel {
|
|
6
|
+
type = 'qq';
|
|
7
|
+
config;
|
|
8
|
+
constructor(config = {}) {
|
|
9
|
+
super();
|
|
10
|
+
this.config = config;
|
|
11
|
+
}
|
|
12
|
+
async start() {
|
|
13
|
+
try {
|
|
14
|
+
require('qq-bot-sdk');
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
throw new Error('Install qq-bot-sdk to use the QQChannel. Run: npm install qq-bot-sdk');
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
async stop() {
|
|
21
|
+
// cleanup
|
|
22
|
+
}
|
|
23
|
+
async send(chatId, text) {
|
|
24
|
+
throw new Error('QQChannel: not yet connected. Call start() first.');
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.QQChannel = QQChannel;
|
|
28
|
+
//# sourceMappingURL=qq.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BaseChannel } from './index';
|
|
2
|
+
export interface SignalChannelConfig {
|
|
3
|
+
signalCliPath?: string;
|
|
4
|
+
phoneNumber?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare class SignalChannel extends BaseChannel {
|
|
7
|
+
readonly type = "signal";
|
|
8
|
+
private config;
|
|
9
|
+
constructor(config?: SignalChannelConfig);
|
|
10
|
+
start(): Promise<void>;
|
|
11
|
+
stop(): Promise<void>;
|
|
12
|
+
send(chatId: string, text: string): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=signal.d.ts.map
|