opc-agent 0.3.0 → 0.4.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.
Files changed (47) hide show
  1. package/dist/channels/voice.d.ts +43 -0
  2. package/dist/channels/voice.js +67 -0
  3. package/dist/channels/webhook.d.ts +40 -0
  4. package/dist/channels/webhook.js +193 -0
  5. package/dist/cli.js +95 -13
  6. package/dist/core/a2a.d.ts +46 -0
  7. package/dist/core/a2a.js +99 -0
  8. package/dist/core/hitl.d.ts +41 -0
  9. package/dist/core/hitl.js +100 -0
  10. package/dist/core/performance.d.ts +50 -0
  11. package/dist/core/performance.js +148 -0
  12. package/dist/core/versioning.d.ts +29 -0
  13. package/dist/core/versioning.js +114 -0
  14. package/dist/core/workflow.d.ts +59 -0
  15. package/dist/core/workflow.js +174 -0
  16. package/dist/index.d.ts +13 -0
  17. package/dist/index.js +18 -1
  18. package/dist/schema/oad.d.ts +352 -15
  19. package/dist/schema/oad.js +41 -2
  20. package/dist/templates/executive-assistant.d.ts +20 -0
  21. package/dist/templates/executive-assistant.js +70 -0
  22. package/dist/templates/financial-advisor.d.ts +15 -0
  23. package/dist/templates/financial-advisor.js +60 -0
  24. package/dist/templates/legal-assistant.d.ts +15 -0
  25. package/dist/templates/legal-assistant.js +70 -0
  26. package/package.json +46 -46
  27. package/src/channels/voice.ts +106 -0
  28. package/src/channels/webhook.ts +199 -0
  29. package/src/cli.ts +101 -13
  30. package/src/core/a2a.ts +143 -0
  31. package/src/core/hitl.ts +138 -0
  32. package/src/core/performance.ts +187 -0
  33. package/src/core/versioning.ts +106 -0
  34. package/src/core/workflow.ts +235 -0
  35. package/src/index.ts +15 -0
  36. package/src/schema/oad.ts +45 -1
  37. package/src/templates/executive-assistant.ts +71 -0
  38. package/src/templates/financial-advisor.ts +60 -0
  39. package/src/templates/legal-assistant.ts +71 -0
  40. package/tests/a2a.test.ts +66 -0
  41. package/tests/hitl.test.ts +71 -0
  42. package/tests/performance.test.ts +115 -0
  43. package/tests/templates.test.ts +77 -0
  44. package/tests/versioning.test.ts +75 -0
  45. package/tests/voice.test.ts +61 -0
  46. package/tests/webhook.test.ts +29 -0
  47. package/tests/workflow.test.ts +143 -0
@@ -0,0 +1,15 @@
1
+ import { BaseSkill } from '../skills/base';
2
+ import type { AgentContext, Message, SkillResult } from '../core/types';
3
+ import type { OADDocument } from '../schema/oad';
4
+ export declare class BudgetAnalysisSkill extends BaseSkill {
5
+ name: string;
6
+ description: string;
7
+ execute(_context: AgentContext, message: Message): Promise<SkillResult>;
8
+ }
9
+ export declare class FinancialPlanningSkill extends BaseSkill {
10
+ name: string;
11
+ description: string;
12
+ execute(_context: AgentContext, message: Message): Promise<SkillResult>;
13
+ }
14
+ export declare function createFinancialAdvisorConfig(): OADDocument;
15
+ //# sourceMappingURL=financial-advisor.d.ts.map
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FinancialPlanningSkill = exports.BudgetAnalysisSkill = void 0;
4
+ exports.createFinancialAdvisorConfig = createFinancialAdvisorConfig;
5
+ const base_1 = require("../skills/base");
6
+ class BudgetAnalysisSkill extends base_1.BaseSkill {
7
+ name = 'budget-analysis';
8
+ description = 'Analyze budgets and expenses';
9
+ async execute(_context, message) {
10
+ const lower = message.content.toLowerCase();
11
+ if (lower.includes('budget') || lower.includes('expense') || lower.includes('cost')) {
12
+ return this.match('I can help analyze your budget. Please share your income and expense categories, and I\'ll provide insights on spending patterns and savings opportunities.', 0.8);
13
+ }
14
+ if (lower.includes('save') || lower.includes('saving')) {
15
+ return this.match('Common savings strategies: 50/30/20 rule (needs/wants/savings), automate transfers, review subscriptions, negotiate bills, and track daily spending.', 0.75);
16
+ }
17
+ return this.noMatch();
18
+ }
19
+ }
20
+ exports.BudgetAnalysisSkill = BudgetAnalysisSkill;
21
+ class FinancialPlanningSkill extends base_1.BaseSkill {
22
+ name = 'financial-planning';
23
+ description = 'Help with financial planning and advice';
24
+ async execute(_context, message) {
25
+ const lower = message.content.toLowerCase();
26
+ if (lower.includes('invest') || lower.includes('portfolio')) {
27
+ return this.match('For investment planning, consider: risk tolerance, time horizon, diversification, asset allocation, and regular rebalancing. This is general guidance — consult a certified financial advisor for personalized advice.', 0.8);
28
+ }
29
+ if (lower.includes('retire') || lower.includes('pension')) {
30
+ return this.match('Retirement planning essentials: estimate target savings (25x annual expenses), maximize employer matching, consider tax-advantaged accounts, and start early for compound growth.', 0.8);
31
+ }
32
+ return this.noMatch();
33
+ }
34
+ }
35
+ exports.FinancialPlanningSkill = FinancialPlanningSkill;
36
+ function createFinancialAdvisorConfig() {
37
+ return {
38
+ apiVersion: 'opc/v1',
39
+ kind: 'Agent',
40
+ metadata: {
41
+ name: 'financial-advisor',
42
+ version: '1.0.0',
43
+ description: 'AI Financial Advisor - budget analysis, expense tracking, financial planning',
44
+ author: 'OPC',
45
+ license: 'Apache-2.0',
46
+ },
47
+ spec: {
48
+ model: 'deepseek-chat',
49
+ systemPrompt: 'You are a financial advisor AI. Help users with budget analysis, expense tracking, and financial planning. Always recommend consulting a certified financial advisor for binding decisions.',
50
+ skills: [
51
+ { name: 'budget-analysis', description: 'Analyze budgets and expenses' },
52
+ { name: 'financial-planning', description: 'Financial planning advice' },
53
+ ],
54
+ channels: [{ type: 'web', port: 3000 }],
55
+ memory: { shortTerm: true, longTerm: false },
56
+ streaming: false,
57
+ },
58
+ };
59
+ }
60
+ //# sourceMappingURL=financial-advisor.js.map
@@ -0,0 +1,15 @@
1
+ import { BaseSkill } from '../skills/base';
2
+ import type { AgentContext, Message, SkillResult } from '../core/types';
3
+ import type { OADDocument } from '../schema/oad';
4
+ export declare class ContractReviewSkill extends BaseSkill {
5
+ name: string;
6
+ description: string;
7
+ execute(_context: AgentContext, message: Message): Promise<SkillResult>;
8
+ }
9
+ export declare class ComplianceCheckSkill extends BaseSkill {
10
+ name: string;
11
+ description: string;
12
+ execute(_context: AgentContext, message: Message): Promise<SkillResult>;
13
+ }
14
+ export declare function createLegalAssistantConfig(): OADDocument;
15
+ //# sourceMappingURL=legal-assistant.d.ts.map
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ComplianceCheckSkill = exports.ContractReviewSkill = void 0;
4
+ exports.createLegalAssistantConfig = createLegalAssistantConfig;
5
+ const base_1 = require("../skills/base");
6
+ const LEGAL_TERMS = {
7
+ 'force majeure': 'A clause that frees parties from obligations due to extraordinary events.',
8
+ 'indemnification': 'One party agrees to compensate the other for certain damages or losses.',
9
+ 'limitation of liability': 'A cap on the amount one party can claim from the other.',
10
+ 'non-compete': 'Restricts a party from competing within a specified scope and timeframe.',
11
+ 'confidentiality': 'Obligations to keep certain information private.',
12
+ 'termination': 'Conditions under which the agreement may be ended.',
13
+ };
14
+ class ContractReviewSkill extends base_1.BaseSkill {
15
+ name = 'contract-review';
16
+ description = 'Review contracts and identify key clauses';
17
+ async execute(_context, message) {
18
+ const lower = message.content.toLowerCase();
19
+ for (const [term, explanation] of Object.entries(LEGAL_TERMS)) {
20
+ if (lower.includes(term)) {
21
+ return this.match(`📋 **${term.toUpperCase()}**: ${explanation}`, 0.85);
22
+ }
23
+ }
24
+ if (lower.includes('review') || lower.includes('contract')) {
25
+ return this.match('I can review contracts for key clauses like force majeure, indemnification, limitation of liability, non-compete, confidentiality, and termination provisions.', 0.7);
26
+ }
27
+ return this.noMatch();
28
+ }
29
+ }
30
+ exports.ContractReviewSkill = ContractReviewSkill;
31
+ class ComplianceCheckSkill extends base_1.BaseSkill {
32
+ name = 'compliance-check';
33
+ description = 'Check compliance with regulations';
34
+ async execute(_context, message) {
35
+ const lower = message.content.toLowerCase();
36
+ if (lower.includes('gdpr') || lower.includes('privacy')) {
37
+ return this.match('GDPR compliance requires: data minimization, consent mechanisms, right to erasure, data protection officer, and breach notification within 72 hours.', 0.9);
38
+ }
39
+ if (lower.includes('compliance') || lower.includes('regulation')) {
40
+ return this.match('I can check compliance with GDPR, CCPA, SOX, HIPAA, and other major regulations. Please specify the regulation and context.', 0.7);
41
+ }
42
+ return this.noMatch();
43
+ }
44
+ }
45
+ exports.ComplianceCheckSkill = ComplianceCheckSkill;
46
+ function createLegalAssistantConfig() {
47
+ return {
48
+ apiVersion: 'opc/v1',
49
+ kind: 'Agent',
50
+ metadata: {
51
+ name: 'legal-assistant',
52
+ version: '1.0.0',
53
+ description: 'AI Legal Assistant - contract review, compliance checking, legal research',
54
+ author: 'OPC',
55
+ license: 'Apache-2.0',
56
+ },
57
+ spec: {
58
+ model: 'deepseek-chat',
59
+ systemPrompt: 'You are a legal assistant AI. Help users review contracts, check compliance, and research legal topics. Always recommend consulting a qualified attorney for binding decisions.',
60
+ skills: [
61
+ { name: 'contract-review', description: 'Review contracts and identify key clauses' },
62
+ { name: 'compliance-check', description: 'Check regulatory compliance' },
63
+ ],
64
+ channels: [{ type: 'web', port: 3000 }],
65
+ memory: { shortTerm: true, longTerm: false },
66
+ streaming: false,
67
+ },
68
+ };
69
+ }
70
+ //# sourceMappingURL=legal-assistant.js.map
package/package.json CHANGED
@@ -1,46 +1,46 @@
1
- {
2
- "name": "opc-agent",
3
- "version": "0.3.0",
4
- "description": "Open Agent Framework — Build, test, and run AI Agents for business workstations",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
7
- "bin": {
8
- "opc": "dist/cli.js"
9
- },
10
- "scripts": {
11
- "build": "tsc",
12
- "test": "vitest run",
13
- "dev": "tsc --watch",
14
- "lint": "tsc --noEmit"
15
- },
16
- "keywords": [
17
- "agent",
18
- "ai",
19
- "llm",
20
- "framework",
21
- "typescript",
22
- "agent-framework"
23
- ],
24
- "author": "Deepleaper",
25
- "license": "Apache-2.0",
26
- "repository": {
27
- "type": "git",
28
- "url": "https://github.com/Deepleaper/opc-agent.git"
29
- },
30
- "dependencies": {
31
- "agentkits": "^0.1.0",
32
- "commander": "^12.0.0",
33
- "express": "^4.21.0",
34
- "js-yaml": "^4.1.0",
35
- "ws": "^8.20.0",
36
- "zod": "^3.23.0"
37
- },
38
- "devDependencies": {
39
- "@types/express": "^4.17.21",
40
- "@types/js-yaml": "^4.0.9",
41
- "@types/node": "^20.11.0",
42
- "@types/ws": "^8.18.1",
43
- "typescript": "^5.5.0",
44
- "vitest": "^2.0.0"
45
- }
46
- }
1
+ {
2
+ "name": "opc-agent",
3
+ "version": "0.4.0",
4
+ "description": "Open Agent Framework — Build, test, and run AI Agents for business workstations",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "bin": {
8
+ "opc": "dist/cli.js"
9
+ },
10
+ "scripts": {
11
+ "build": "tsc",
12
+ "test": "vitest run",
13
+ "dev": "tsc --watch",
14
+ "lint": "tsc --noEmit"
15
+ },
16
+ "keywords": [
17
+ "agent",
18
+ "ai",
19
+ "llm",
20
+ "framework",
21
+ "typescript",
22
+ "agent-framework"
23
+ ],
24
+ "author": "Deepleaper",
25
+ "license": "Apache-2.0",
26
+ "repository": {
27
+ "type": "git",
28
+ "url": "https://github.com/Deepleaper/opc-agent.git"
29
+ },
30
+ "dependencies": {
31
+ "agentkits": "^0.1.0",
32
+ "commander": "^12.0.0",
33
+ "express": "^4.21.0",
34
+ "js-yaml": "^4.1.0",
35
+ "ws": "^8.20.0",
36
+ "zod": "^3.23.0"
37
+ },
38
+ "devDependencies": {
39
+ "@types/express": "^4.17.21",
40
+ "@types/js-yaml": "^4.0.9",
41
+ "@types/node": "^20.11.0",
42
+ "@types/ws": "^8.18.1",
43
+ "typescript": "^5.5.0",
44
+ "vitest": "^2.0.0"
45
+ }
46
+ }
@@ -0,0 +1,106 @@
1
+ import { BaseChannel } from './index';
2
+ import type { Message } from '../core/types';
3
+ import { Logger } from '../core/logger';
4
+
5
+ // ── Voice Channel Types ─────────────────────────────────────
6
+
7
+ export interface STTProvider {
8
+ name: string;
9
+ transcribe(audio: Buffer, options?: STTOptions): Promise<string>;
10
+ }
11
+
12
+ export interface TTSProvider {
13
+ name: string;
14
+ synthesize(text: string, options?: TTSOptions): Promise<Buffer>;
15
+ }
16
+
17
+ export interface STTOptions {
18
+ language?: string;
19
+ model?: string;
20
+ }
21
+
22
+ export interface TTSOptions {
23
+ voice?: string;
24
+ speed?: number;
25
+ language?: string;
26
+ }
27
+
28
+ export interface VoiceChannelConfig {
29
+ sttProvider?: STTProvider;
30
+ ttsProvider?: TTSProvider;
31
+ sampleRate?: number;
32
+ language?: string;
33
+ }
34
+
35
+ // ── Voice Channel ───────────────────────────────────────────
36
+
37
+ export class VoiceChannel extends BaseChannel {
38
+ type = 'voice';
39
+ private config: VoiceChannelConfig;
40
+ private logger = new Logger('voice-channel');
41
+ private running = false;
42
+
43
+ constructor(config?: VoiceChannelConfig) {
44
+ super();
45
+ this.config = config ?? {};
46
+ }
47
+
48
+ async start(): Promise<void> {
49
+ this.running = true;
50
+ this.logger.info('Voice channel started', {
51
+ stt: this.config.sttProvider?.name ?? 'none',
52
+ tts: this.config.ttsProvider?.name ?? 'none',
53
+ });
54
+ }
55
+
56
+ async stop(): Promise<void> {
57
+ this.running = false;
58
+ this.logger.info('Voice channel stopped');
59
+ }
60
+
61
+ isRunning(): boolean {
62
+ return this.running;
63
+ }
64
+
65
+ /** Process audio input: STT → Agent → TTS */
66
+ async processAudio(audio: Buffer): Promise<{ text: string; response: string; audioResponse?: Buffer }> {
67
+ if (!this.handler) throw new Error('No message handler set');
68
+
69
+ // STT
70
+ let text: string;
71
+ if (this.config.sttProvider) {
72
+ text = await this.config.sttProvider.transcribe(audio, { language: this.config.language });
73
+ } else {
74
+ text = audio.toString('utf-8'); // Fallback: treat as text
75
+ }
76
+
77
+ this.logger.debug('STT result', { text });
78
+
79
+ // Create message and send to agent
80
+ const message: Message = {
81
+ id: `voice_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
82
+ role: 'user',
83
+ content: text,
84
+ timestamp: Date.now(),
85
+ metadata: { channel: 'voice' },
86
+ };
87
+
88
+ const response = await this.handler(message);
89
+
90
+ // TTS
91
+ let audioResponse: Buffer | undefined;
92
+ if (this.config.ttsProvider) {
93
+ audioResponse = await this.config.ttsProvider.synthesize(response.content, { language: this.config.language });
94
+ }
95
+
96
+ return { text, response: response.content, audioResponse };
97
+ }
98
+
99
+ setSTTProvider(provider: STTProvider): void {
100
+ this.config.sttProvider = provider;
101
+ }
102
+
103
+ setTTSProvider(provider: TTSProvider): void {
104
+ this.config.ttsProvider = provider;
105
+ }
106
+ }
@@ -0,0 +1,199 @@
1
+ import { BaseChannel } from './index';
2
+ import type { Message } from '../core/types';
3
+ import { Logger } from '../core/logger';
4
+ import * as http from 'http';
5
+ import * as crypto from 'crypto';
6
+
7
+ // ── Webhook Types ───────────────────────────────────────────
8
+
9
+ export interface WebhookConfig {
10
+ port?: number;
11
+ path?: string;
12
+ secret?: string;
13
+ retryAttempts?: number;
14
+ retryDelayMs?: number;
15
+ outgoing?: WebhookOutgoing[];
16
+ }
17
+
18
+ export interface WebhookOutgoing {
19
+ name: string;
20
+ url: string;
21
+ secret?: string;
22
+ events: string[];
23
+ }
24
+
25
+ export interface WebhookPayload {
26
+ event: string;
27
+ data: unknown;
28
+ timestamp: number;
29
+ id: string;
30
+ }
31
+
32
+ // ── Webhook Channel ─────────────────────────────────────────
33
+
34
+ export class WebhookChannel extends BaseChannel {
35
+ type = 'webhook';
36
+ private config: WebhookConfig;
37
+ private server: http.Server | null = null;
38
+ private logger = new Logger('webhook-channel');
39
+ private outgoing: WebhookOutgoing[] = [];
40
+
41
+ constructor(config?: WebhookConfig) {
42
+ super();
43
+ this.config = config ?? {};
44
+ this.outgoing = config?.outgoing ?? [];
45
+ }
46
+
47
+ async start(): Promise<void> {
48
+ const port = this.config.port ?? 3100;
49
+ const path = this.config.path ?? '/webhook';
50
+
51
+ this.server = http.createServer(async (req, res) => {
52
+ if (req.url !== path || req.method !== 'POST') {
53
+ res.writeHead(404);
54
+ res.end('Not found');
55
+ return;
56
+ }
57
+
58
+ try {
59
+ const body = await this.readBody(req);
60
+
61
+ // Verify signature if secret configured
62
+ if (this.config.secret) {
63
+ const signature = req.headers['x-webhook-signature'] as string;
64
+ if (!this.verifySignature(body, signature, this.config.secret)) {
65
+ res.writeHead(401);
66
+ res.end('Invalid signature');
67
+ return;
68
+ }
69
+ }
70
+
71
+ const payload: WebhookPayload = JSON.parse(body);
72
+ const message: Message = {
73
+ id: payload.id ?? `wh_${Date.now()}`,
74
+ role: 'user',
75
+ content: typeof payload.data === 'string' ? payload.data : JSON.stringify(payload.data),
76
+ timestamp: payload.timestamp ?? Date.now(),
77
+ metadata: { channel: 'webhook', event: payload.event },
78
+ };
79
+
80
+ if (this.handler) {
81
+ const response = await this.handler(message);
82
+ res.writeHead(200, { 'Content-Type': 'application/json' });
83
+ res.end(JSON.stringify({ status: 'ok', response: response.content }));
84
+ } else {
85
+ res.writeHead(200, { 'Content-Type': 'application/json' });
86
+ res.end(JSON.stringify({ status: 'ok' }));
87
+ }
88
+ } catch (err) {
89
+ this.logger.error('Webhook error', { error: (err as Error).message });
90
+ res.writeHead(500);
91
+ res.end('Internal error');
92
+ }
93
+ });
94
+
95
+ return new Promise((resolve) => {
96
+ this.server!.listen(port, () => {
97
+ this.logger.info('Webhook channel started', { port, path });
98
+ resolve();
99
+ });
100
+ });
101
+ }
102
+
103
+ async stop(): Promise<void> {
104
+ return new Promise((resolve) => {
105
+ if (this.server) {
106
+ this.server.close(() => {
107
+ this.logger.info('Webhook channel stopped');
108
+ resolve();
109
+ });
110
+ } else {
111
+ resolve();
112
+ }
113
+ });
114
+ }
115
+
116
+ /** Send a webhook to outgoing endpoints */
117
+ async send(event: string, data: unknown): Promise<void> {
118
+ const targets = this.outgoing.filter(o => o.events.includes(event) || o.events.includes('*'));
119
+
120
+ for (const target of targets) {
121
+ const payload: WebhookPayload = {
122
+ event,
123
+ data,
124
+ timestamp: Date.now(),
125
+ id: `wh_out_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`,
126
+ };
127
+
128
+ await this.sendWithRetry(target, payload);
129
+ }
130
+ }
131
+
132
+ private async sendWithRetry(target: WebhookOutgoing, payload: WebhookPayload): Promise<void> {
133
+ const maxRetries = this.config.retryAttempts ?? 3;
134
+ const retryDelay = this.config.retryDelayMs ?? 1000;
135
+ const body = JSON.stringify(payload);
136
+
137
+ for (let attempt = 0; attempt <= maxRetries; attempt++) {
138
+ try {
139
+ await this.httpPost(target.url, body, target.secret);
140
+ return;
141
+ } catch (err) {
142
+ if (attempt === maxRetries) {
143
+ this.logger.error('Webhook delivery failed', { target: target.name, error: (err as Error).message });
144
+ throw err;
145
+ }
146
+ await new Promise(r => setTimeout(r, retryDelay * Math.pow(2, attempt)));
147
+ }
148
+ }
149
+ }
150
+
151
+ private httpPost(url: string, body: string, secret?: string): Promise<void> {
152
+ return new Promise((resolve, reject) => {
153
+ const urlObj = new URL(url);
154
+ const headers: Record<string, string> = { 'Content-Type': 'application/json' };
155
+ if (secret) {
156
+ headers['x-webhook-signature'] = this.createSignature(body, secret);
157
+ }
158
+
159
+ const req = http.request(
160
+ { hostname: urlObj.hostname, port: urlObj.port, path: urlObj.pathname, method: 'POST', headers },
161
+ (res) => {
162
+ if (res.statusCode && res.statusCode >= 200 && res.statusCode < 300) {
163
+ resolve();
164
+ } else {
165
+ reject(new Error(`HTTP ${res.statusCode}`));
166
+ }
167
+ res.resume();
168
+ },
169
+ );
170
+ req.on('error', reject);
171
+ req.write(body);
172
+ req.end();
173
+ });
174
+ }
175
+
176
+ private readBody(req: http.IncomingMessage): Promise<string> {
177
+ return new Promise((resolve, reject) => {
178
+ const chunks: Buffer[] = [];
179
+ req.on('data', (c: Buffer) => chunks.push(c));
180
+ req.on('end', () => resolve(Buffer.concat(chunks).toString()));
181
+ req.on('error', reject);
182
+ });
183
+ }
184
+
185
+ verifySignature(body: string, signature: string, secret: string): boolean {
186
+ if (!signature) return false;
187
+ const expected = this.createSignature(body, secret);
188
+ if (signature.length !== expected.length) return false;
189
+ return crypto.timingSafeEqual(Buffer.from(signature), Buffer.from(expected));
190
+ }
191
+
192
+ createSignature(body: string, secret: string): string {
193
+ return crypto.createHmac('sha256', secret).update(body).digest('hex');
194
+ }
195
+
196
+ addOutgoing(outgoing: WebhookOutgoing): void {
197
+ this.outgoing.push(outgoing);
198
+ }
199
+ }