@cognigy/mcp-server 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.
@@ -0,0 +1,448 @@
1
+ /**
2
+ * Tool definitions for the MCP server
3
+ */
4
+ /**
5
+ * MCP Tool Definitions - 8 high-level workflow tools
6
+ */
7
+ export const tools = [
8
+ // 1. AI Agent Management
9
+ {
10
+ name: 'manage_ai_agents',
11
+ description: 'Create, read, update, delete, list, or hire AI agents. Supports operations: create, get, update, delete, list, hire.',
12
+ inputSchema: {
13
+ type: 'object',
14
+ properties: {
15
+ operation: {
16
+ type: 'string',
17
+ enum: ['create', 'get', 'update', 'delete', 'list', 'hire'],
18
+ description: 'The operation to perform',
19
+ },
20
+ projectId: {
21
+ type: 'string',
22
+ description: 'The project ID (24-character hex string, required for create/list)',
23
+ },
24
+ aiAgentId: {
25
+ type: 'string',
26
+ description: 'The AI agent ID (24-character hex string, required for get/update/delete/hire)',
27
+ },
28
+ name: {
29
+ type: 'string',
30
+ description: 'Name of the AI agent (required for create)',
31
+ },
32
+ description: {
33
+ type: 'string',
34
+ description: 'Description of the AI agent',
35
+ },
36
+ job: {
37
+ type: 'string',
38
+ description: 'Job description for the AI agent',
39
+ },
40
+ tools: {
41
+ type: 'array',
42
+ items: { type: 'string' },
43
+ description: 'Tools available to the AI agent',
44
+ },
45
+ limit: {
46
+ type: 'number',
47
+ description: 'Pagination limit (1-100)',
48
+ },
49
+ skip: {
50
+ type: 'number',
51
+ description: 'Pagination skip offset',
52
+ },
53
+ },
54
+ required: ['operation'],
55
+ },
56
+ },
57
+ // 2. Knowledge Management
58
+ {
59
+ name: 'manage_knowledge',
60
+ description: 'Manage knowledge stores, sources, and search knowledge chunks. Operations: create_store, create_source, search_chunks, list_stores.',
61
+ inputSchema: {
62
+ type: 'object',
63
+ properties: {
64
+ operation: {
65
+ type: 'string',
66
+ enum: ['create_store', 'create_source', 'search_chunks', 'list_stores'],
67
+ description: 'The operation to perform',
68
+ },
69
+ projectId: {
70
+ type: 'string',
71
+ description: 'The project ID (required for create_store/list_stores)',
72
+ },
73
+ knowledgeStoreId: {
74
+ type: 'string',
75
+ description: 'Knowledge store ID (required for create_source/search_chunks)',
76
+ },
77
+ name: {
78
+ type: 'string',
79
+ description: 'Name of the knowledge store (required for create_store)',
80
+ },
81
+ description: {
82
+ type: 'string',
83
+ description: 'Description',
84
+ },
85
+ embeddingModel: {
86
+ type: 'string',
87
+ description: 'Embedding model to use',
88
+ },
89
+ type: {
90
+ type: 'string',
91
+ enum: ['url', 'file', 'text'],
92
+ description: 'Type of knowledge source (required for create_source)',
93
+ },
94
+ content: {
95
+ type: 'string',
96
+ description: 'Content for the knowledge source (URL, file path, or text)',
97
+ },
98
+ query: {
99
+ type: 'string',
100
+ description: 'Search query (required for search_chunks)',
101
+ },
102
+ limit: {
103
+ type: 'number',
104
+ description: 'Result limit',
105
+ },
106
+ },
107
+ required: ['operation'],
108
+ },
109
+ },
110
+ // 3. Conversation Management
111
+ {
112
+ name: 'manage_conversations',
113
+ description: 'List conversations, get conversation details, or retrieve session state. Operations: list, get, get_session_state.',
114
+ inputSchema: {
115
+ type: 'object',
116
+ properties: {
117
+ operation: {
118
+ type: 'string',
119
+ enum: ['list', 'get', 'get_session_state'],
120
+ description: 'The operation to perform',
121
+ },
122
+ projectId: {
123
+ type: 'string',
124
+ description: 'The project ID (required for list)',
125
+ },
126
+ sessionId: {
127
+ type: 'string',
128
+ description: 'The session ID (required for get/get_session_state)',
129
+ },
130
+ startDate: {
131
+ type: 'string',
132
+ description: 'Filter by start date (ISO 8601)',
133
+ },
134
+ endDate: {
135
+ type: 'string',
136
+ description: 'Filter by end date (ISO 8601)',
137
+ },
138
+ channel: {
139
+ type: 'string',
140
+ description: 'Filter by channel (e.g., webchat3, voiceGateway2)',
141
+ },
142
+ limit: {
143
+ type: 'number',
144
+ description: 'Pagination limit',
145
+ },
146
+ skip: {
147
+ type: 'number',
148
+ description: 'Pagination skip',
149
+ },
150
+ },
151
+ required: ['operation'],
152
+ },
153
+ },
154
+ // 4. Flow Management
155
+ {
156
+ name: 'manage_flows',
157
+ description: 'Create, update, list flows and manage flow nodes. Operations: create, update, list, create_node, get_node, update_node.',
158
+ inputSchema: {
159
+ type: 'object',
160
+ properties: {
161
+ operation: {
162
+ type: 'string',
163
+ enum: ['create', 'update', 'list', 'create_node', 'get_node', 'update_node'],
164
+ description: 'The operation to perform',
165
+ },
166
+ projectId: {
167
+ type: 'string',
168
+ description: 'The project ID (required for create/list)',
169
+ },
170
+ flowId: {
171
+ type: 'string',
172
+ description: 'The flow ID (required for update/create_node/get_node/update_node)',
173
+ },
174
+ nodeId: {
175
+ type: 'string',
176
+ description: 'The node ID (required for get_node/update_node)',
177
+ },
178
+ localeId: {
179
+ type: 'string',
180
+ description: 'The locale ID (optional for get_node/update_node)',
181
+ },
182
+ name: {
183
+ type: 'string',
184
+ description: 'Flow name',
185
+ },
186
+ description: {
187
+ type: 'string',
188
+ description: 'Flow description',
189
+ },
190
+ type: {
191
+ type: 'string',
192
+ description: 'Node type (required for create_node)',
193
+ },
194
+ label: {
195
+ type: 'string',
196
+ description: 'Node label',
197
+ },
198
+ config: {
199
+ type: 'object',
200
+ description: 'Node configuration (for create_node/update_node)',
201
+ },
202
+ comment: {
203
+ type: 'string',
204
+ description: 'Node comment (for update_node)',
205
+ },
206
+ limit: {
207
+ type: 'number',
208
+ description: 'Pagination limit',
209
+ },
210
+ skip: {
211
+ type: 'number',
212
+ description: 'Pagination skip',
213
+ },
214
+ },
215
+ required: ['operation'],
216
+ },
217
+ },
218
+ // 5. Intent & NLU Management
219
+ {
220
+ name: 'manage_intents',
221
+ description: 'Create, update, list intents and train NLU models. Operations: create, update, list, train.',
222
+ inputSchema: {
223
+ type: 'object',
224
+ properties: {
225
+ operation: {
226
+ type: 'string',
227
+ enum: ['create', 'update', 'list', 'train'],
228
+ description: 'The operation to perform',
229
+ },
230
+ flowId: {
231
+ type: 'string',
232
+ description: 'The flow ID (required for create/list/train)',
233
+ },
234
+ intentId: {
235
+ type: 'string',
236
+ description: 'The intent ID (required for update)',
237
+ },
238
+ name: {
239
+ type: 'string',
240
+ description: 'Intent name',
241
+ },
242
+ sentences: {
243
+ type: 'array',
244
+ items: { type: 'string' },
245
+ description: 'Training sentences for the intent',
246
+ },
247
+ localeId: {
248
+ type: 'string',
249
+ description: 'Locale ID for training',
250
+ },
251
+ limit: {
252
+ type: 'number',
253
+ description: 'Pagination limit',
254
+ },
255
+ skip: {
256
+ type: 'number',
257
+ description: 'Pagination skip',
258
+ },
259
+ },
260
+ required: ['operation'],
261
+ },
262
+ },
263
+ // 6. Analytics & Monitoring
264
+ {
265
+ name: 'get_analytics',
266
+ description: 'Get analytics data, logs, and audit events. Operations: conversation_count, call_count, logs, audit_events.',
267
+ inputSchema: {
268
+ type: 'object',
269
+ properties: {
270
+ operation: {
271
+ type: 'string',
272
+ enum: ['conversation_count', 'call_count', 'logs', 'audit_events'],
273
+ description: 'The operation to perform',
274
+ },
275
+ projectId: {
276
+ type: 'string',
277
+ description: 'The project ID (required)',
278
+ },
279
+ year: {
280
+ type: 'number',
281
+ description: 'Year for analytics (required for conversation_count/call_count)',
282
+ },
283
+ month: {
284
+ type: 'number',
285
+ description: 'Month for analytics (1-12)',
286
+ },
287
+ channel: {
288
+ type: 'string',
289
+ description: 'Channel filter',
290
+ },
291
+ startDate: {
292
+ type: 'string',
293
+ description: 'Start date filter (ISO 8601)',
294
+ },
295
+ endDate: {
296
+ type: 'string',
297
+ description: 'End date filter (ISO 8601)',
298
+ },
299
+ level: {
300
+ type: 'string',
301
+ enum: ['debug', 'info', 'warn', 'error'],
302
+ description: 'Log level filter',
303
+ },
304
+ userId: {
305
+ type: 'string',
306
+ description: 'User ID filter for audit events',
307
+ },
308
+ limit: {
309
+ type: 'number',
310
+ description: 'Pagination limit',
311
+ },
312
+ skip: {
313
+ type: 'number',
314
+ description: 'Pagination skip',
315
+ },
316
+ },
317
+ required: ['operation', 'projectId'],
318
+ },
319
+ },
320
+ // 7. Project & Endpoint Management
321
+ {
322
+ name: 'manage_projects',
323
+ description: 'Create and list projects, create and list endpoints. Operations: create_project, list_projects, create_endpoint, list_endpoints.',
324
+ inputSchema: {
325
+ type: 'object',
326
+ properties: {
327
+ operation: {
328
+ type: 'string',
329
+ enum: ['create_project', 'list_projects', 'create_endpoint', 'list_endpoints'],
330
+ description: 'The operation to perform',
331
+ },
332
+ projectId: {
333
+ type: 'string',
334
+ description: 'The project ID (required for create_endpoint/list_endpoints)',
335
+ },
336
+ name: {
337
+ type: 'string',
338
+ description: 'Name (required for create_project/create_endpoint)',
339
+ },
340
+ description: {
341
+ type: 'string',
342
+ description: 'Description',
343
+ },
344
+ defaultLocale: {
345
+ type: 'string',
346
+ description: 'Default locale for project',
347
+ },
348
+ channel: {
349
+ type: 'string',
350
+ description: 'Channel type: "rest", "webchat3", "voiceGateway2", etc. (required for create_endpoint)',
351
+ },
352
+ flowId: {
353
+ type: 'string',
354
+ description: 'Flow ID to connect to the endpoint (required for create_endpoint)',
355
+ },
356
+ settings: {
357
+ type: 'object',
358
+ description: 'Optional endpoint settings/configuration',
359
+ },
360
+ limit: {
361
+ type: 'number',
362
+ description: 'Pagination limit',
363
+ },
364
+ skip: {
365
+ type: 'number',
366
+ description: 'Pagination skip',
367
+ },
368
+ },
369
+ required: ['operation'],
370
+ },
371
+ },
372
+ // 8. Extension Management
373
+ {
374
+ name: 'manage_extensions',
375
+ description: 'List extensions and manage custom functions. Operations: list_extensions, create_function, update_function, list_functions.',
376
+ inputSchema: {
377
+ type: 'object',
378
+ properties: {
379
+ operation: {
380
+ type: 'string',
381
+ enum: ['list_extensions', 'create_function', 'update_function', 'list_functions'],
382
+ description: 'The operation to perform',
383
+ },
384
+ projectId: {
385
+ type: 'string',
386
+ description: 'The project ID (required)',
387
+ },
388
+ functionId: {
389
+ type: 'string',
390
+ description: 'The function ID (required for update_function)',
391
+ },
392
+ name: {
393
+ type: 'string',
394
+ description: 'Function name',
395
+ },
396
+ code: {
397
+ type: 'string',
398
+ description: 'Function code',
399
+ },
400
+ description: {
401
+ type: 'string',
402
+ description: 'Function description',
403
+ },
404
+ limit: {
405
+ type: 'number',
406
+ description: 'Pagination limit',
407
+ },
408
+ skip: {
409
+ type: 'number',
410
+ description: 'Pagination skip',
411
+ },
412
+ },
413
+ required: ['operation', 'projectId'],
414
+ },
415
+ },
416
+ // 9. Talk to AI Agent (Iterative Improvement Loop)
417
+ {
418
+ name: 'talk_to_agent',
419
+ description: 'Send a message to a Cognigy AI Agent through its REST endpoint and get the response. Use this to test agent behavior, iterate on improvements, and create a feedback loop. Perfect for testing how an AI Agent responds before and after configuration changes.',
420
+ inputSchema: {
421
+ type: 'object',
422
+ properties: {
423
+ endpointUrl: {
424
+ type: 'string',
425
+ description: 'The REST endpoint URL (e.g., https://endpoint-trial.cognigy.ai/xxxxx)',
426
+ },
427
+ message: {
428
+ type: 'string',
429
+ description: 'The message to send to the AI Agent',
430
+ },
431
+ sessionId: {
432
+ type: 'string',
433
+ description: 'Optional session ID to maintain conversation context. Use same ID for follow-up messages.',
434
+ },
435
+ userId: {
436
+ type: 'string',
437
+ description: 'Optional user ID to identify the conversation participant',
438
+ },
439
+ data: {
440
+ type: 'object',
441
+ description: 'Optional additional data to send with the message',
442
+ },
443
+ },
444
+ required: ['endpointUrl', 'message'],
445
+ },
446
+ },
447
+ ];
448
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAYH;;GAEG;AACH,MAAM,CAAC,MAAM,KAAK,GAAqB;IACrC,yBAAyB;IACzB;QACE,IAAI,EAAE,kBAAkB;QACxB,WAAW,EAAE,sHAAsH;QACnI,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,SAAS,EAAE;oBACT,IAAI,EAAE,QAAQ;oBACd,IAAI,EAAE,CAAC,QAAQ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I,EAAE,QAAQ;oBACd,WAAW,EAAE,mDAAmD;iBACjE;aACF;YACD,QAAQ,EAAE,CAAC,aAAa,EAAE,SAAS,CAAC;SACrC;KACF;CACF,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Simple logger utility for the MCP server
3
+ */
4
+ type LogLevel = 'debug' | 'info' | 'warn' | 'error';
5
+ declare class Logger {
6
+ private level;
7
+ private levels;
8
+ constructor(level?: LogLevel);
9
+ setLevel(level: LogLevel): void;
10
+ private shouldLog;
11
+ private formatMessage;
12
+ debug(message: string, meta?: any): void;
13
+ info(message: string, meta?: any): void;
14
+ warn(message: string, meta?: any): void;
15
+ error(message: string, meta?: any): void;
16
+ }
17
+ export declare const logger: Logger;
18
+ export {};
19
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,KAAK,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAEpD,cAAM,MAAM;IACV,OAAO,CAAC,KAAK,CAAW;IACxB,OAAO,CAAC,MAAM,CAKZ;gBAEU,KAAK,GAAE,QAAiB;IAIpC,QAAQ,CAAC,KAAK,EAAE,QAAQ;IAIxB,OAAO,CAAC,SAAS;IAIjB,OAAO,CAAC,aAAa;IAMrB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG;IAOjC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG;IAOhC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG;IAOhC,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG;CAMlC;AAED,eAAO,MAAM,MAAM,QAAe,CAAC"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Simple logger utility for the MCP server
3
+ */
4
+ class Logger {
5
+ level;
6
+ levels = {
7
+ debug: 0,
8
+ info: 1,
9
+ warn: 2,
10
+ error: 3,
11
+ };
12
+ constructor(level = 'info') {
13
+ this.level = level;
14
+ }
15
+ setLevel(level) {
16
+ this.level = level;
17
+ }
18
+ shouldLog(level) {
19
+ return this.levels[level] >= this.levels[this.level];
20
+ }
21
+ formatMessage(level, message, meta) {
22
+ const timestamp = new Date().toISOString();
23
+ const metaStr = meta ? ` ${JSON.stringify(meta)}` : '';
24
+ return `[${timestamp}] [${level.toUpperCase()}] ${message}${metaStr}`;
25
+ }
26
+ debug(message, meta) {
27
+ if (this.shouldLog('debug')) {
28
+ // Use stderr to avoid polluting stdout (MCP uses stdio protocol)
29
+ console.error(this.formatMessage('debug', message, meta));
30
+ }
31
+ }
32
+ info(message, meta) {
33
+ if (this.shouldLog('info')) {
34
+ // Use stderr to avoid polluting stdout (MCP uses stdio protocol)
35
+ console.error(this.formatMessage('info', message, meta));
36
+ }
37
+ }
38
+ warn(message, meta) {
39
+ if (this.shouldLog('warn')) {
40
+ // Use stderr to avoid polluting stdout (MCP uses stdio protocol)
41
+ console.error(this.formatMessage('warn', message, meta));
42
+ }
43
+ }
44
+ error(message, meta) {
45
+ if (this.shouldLog('error')) {
46
+ // Use stderr to avoid polluting stdout (MCP uses stdio protocol)
47
+ console.error(this.formatMessage('error', message, meta));
48
+ }
49
+ }
50
+ }
51
+ export const logger = new Logger();
52
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,MAAM,MAAM;IACF,KAAK,CAAW;IAChB,MAAM,GAA6B;QACzC,KAAK,EAAE,CAAC;QACR,IAAI,EAAE,CAAC;QACP,IAAI,EAAE,CAAC;QACP,KAAK,EAAE,CAAC;KACT,CAAC;IAEF,YAAY,QAAkB,MAAM;QAClC,IAAI,CAAC,KAAK,GAAG,KAA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AAM,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;QAC3D,CAAC;IACH,CAAC;IAED,KAAK,CAAC,OAAe,EAAE,IAAU;QAC/B,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;YAC5B,iEAAiE;YACjE,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;QAC5D,CAAC;IACH,CAAC;CACF;AAED,MAAM,CAAC,MAAM,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Rate limiter to prevent API abuse
3
+ */
4
+ interface RateLimitConfig {
5
+ maxRequests: number;
6
+ windowMs: number;
7
+ }
8
+ export declare class RateLimiter {
9
+ private requests;
10
+ private config;
11
+ private cleanupInterval?;
12
+ constructor(config: RateLimitConfig);
13
+ /**
14
+ * Stop the cleanup interval (important for tests and graceful shutdown)
15
+ */
16
+ destroy(): void;
17
+ /**
18
+ * Check if a request should be allowed
19
+ * @param key - Identifier for the rate limit bucket (e.g., API key, IP address)
20
+ * @returns true if request is allowed, false if rate limit exceeded
21
+ */
22
+ check(key: string): boolean;
23
+ /**
24
+ * Get remaining requests for a key
25
+ */
26
+ getRemaining(key: string): number;
27
+ /**
28
+ * Clean up expired entries
29
+ */
30
+ private cleanup;
31
+ }
32
+ export {};
33
+ //# sourceMappingURL=rateLimiter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rateLimiter.d.ts","sourceRoot":"","sources":["../../src/utils/rateLimiter.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,UAAU,eAAe;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAOD,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAyC;IACzD,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,eAAe,CAAC,CAAiB;gBAE7B,MAAM,EAAE,eAAe;IAMnC;;OAEG;IACH,OAAO;IAOP;;;;OAIG;IACH,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAuB3B;;OAEG;IACH,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAQjC;;OAEG;IACH,OAAO,CAAC,OAAO;CAQhB"}
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Rate limiter to prevent API abuse
3
+ */
4
+ export class RateLimiter {
5
+ requests = new Map();
6
+ config;
7
+ cleanupInterval;
8
+ constructor(config) {
9
+ this.config = config;
10
+ // Clean up expired entries every minute
11
+ this.cleanupInterval = setInterval(() => this.cleanup(), 60000);
12
+ }
13
+ /**
14
+ * Stop the cleanup interval (important for tests and graceful shutdown)
15
+ */
16
+ destroy() {
17
+ if (this.cleanupInterval) {
18
+ clearInterval(this.cleanupInterval);
19
+ this.cleanupInterval = undefined;
20
+ }
21
+ }
22
+ /**
23
+ * Check if a request should be allowed
24
+ * @param key - Identifier for the rate limit bucket (e.g., API key, IP address)
25
+ * @returns true if request is allowed, false if rate limit exceeded
26
+ */
27
+ check(key) {
28
+ const now = Date.now();
29
+ const record = this.requests.get(key);
30
+ if (!record || now > record.resetTime) {
31
+ // New window, allow request
32
+ this.requests.set(key, {
33
+ count: 1,
34
+ resetTime: now + this.config.windowMs,
35
+ });
36
+ return true;
37
+ }
38
+ if (record.count < this.config.maxRequests) {
39
+ // Within limit, allow request
40
+ record.count++;
41
+ return true;
42
+ }
43
+ // Rate limit exceeded
44
+ return false;
45
+ }
46
+ /**
47
+ * Get remaining requests for a key
48
+ */
49
+ getRemaining(key) {
50
+ const record = this.requests.get(key);
51
+ if (!record || Date.now() > record.resetTime) {
52
+ return this.config.maxRequests;
53
+ }
54
+ return Math.max(0, this.config.maxRequests - record.count);
55
+ }
56
+ /**
57
+ * Clean up expired entries
58
+ */
59
+ cleanup() {
60
+ const now = Date.now();
61
+ for (const [key, record] of this.requests.entries()) {
62
+ if (now > record.resetTime) {
63
+ this.requests.delete(key);
64
+ }
65
+ }
66
+ }
67
+ }
68
+ //# sourceMappingURL=rateLimiter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rateLimiter.js","sourceRoot":"","sources":["../../src/utils/rateLimiter.ts"],"names":[],"mappings":"AAAA;;GAEG;AAYH,MAAM,OAAO,WAAW;IACd,QAAQ,GAA+B,IAAI,GAAG,EAAE,CAAC;IACjD,MAAM,CAAkB;IACxB,eAAe,CAAkB;IAEzC,YAAY,MAAuB;QACjC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,wCAAwC;QACxC,IAAI,CAAC,eAAe,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,KAAK,CAAC,CAAC;IAClE,CAAC;IAED;;OAEG;IACH,OAAO;QACL,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;YACzB,aAAa,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;YACpC,IAAI,CAAC,eAAe,GAAG,SAAS,CAAC;QACnC,CAAC;IACH,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,GAAW;QACf,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACvB,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAEtC,IAAI,CAAC,MAAM,IAAI,GAAG,GAAG,MAAM,CAAC,SAAS,EAAE,CAAC;YACtC,4BAA4B;YAC5B,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE;gBACrB,KAAK,EAAE,CAAC;gBACR,SAAS,EAAE,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ;aACtC,CAAC,CAAC;YACH,OAAO,IAAI,CAAC;QACd,CAAC;QAED,IAAI,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;YAC3C,8BAA8B;YAC9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