@robota-sdk/agent-plugin 3.0.0-beta.64

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 (82) hide show
  1. package/LICENSE +21 -0
  2. package/dist/node/index.cjs +1 -0
  3. package/dist/node/index.d.ts +1724 -0
  4. package/dist/node/index.d.ts.map +1 -0
  5. package/dist/node/index.js +2 -0
  6. package/dist/node/index.js.map +1 -0
  7. package/package.json +48 -0
  8. package/src/conversation-history/__tests__/conversation-history-plugin.test.ts +221 -0
  9. package/src/conversation-history/__tests__/history-storages.test.ts +115 -0
  10. package/src/conversation-history/conversation-history-helpers.ts +120 -0
  11. package/src/conversation-history/conversation-history-plugin.ts +294 -0
  12. package/src/conversation-history/index.ts +11 -0
  13. package/src/conversation-history/storages/database-storage.ts +96 -0
  14. package/src/conversation-history/storages/file-storage.ts +95 -0
  15. package/src/conversation-history/storages/index.ts +3 -0
  16. package/src/conversation-history/storages/memory-storage.ts +44 -0
  17. package/src/conversation-history/types.ts +64 -0
  18. package/src/error-handling/__tests__/error-handling-plugin.test.ts +201 -0
  19. package/src/error-handling/context-adapter.ts +48 -0
  20. package/src/error-handling/error-handling-helpers.ts +53 -0
  21. package/src/error-handling/error-handling-plugin.ts +293 -0
  22. package/src/error-handling/index.ts +9 -0
  23. package/src/error-handling/types.ts +82 -0
  24. package/src/execution-analytics/__tests__/execution-analytics-plugin.test.ts +224 -0
  25. package/src/execution-analytics/analytics-aggregation.ts +88 -0
  26. package/src/execution-analytics/execution-analytics-helpers.ts +83 -0
  27. package/src/execution-analytics/execution-analytics-plugin.ts +315 -0
  28. package/src/execution-analytics/index.ts +9 -0
  29. package/src/execution-analytics/types.ts +97 -0
  30. package/src/index.ts +8 -0
  31. package/src/limits/__tests__/limits-plugin.test.ts +712 -0
  32. package/src/limits/index.ts +9 -0
  33. package/src/limits/limits-helpers.ts +185 -0
  34. package/src/limits/limits-plugin.ts +196 -0
  35. package/src/limits/types.ts +73 -0
  36. package/src/limits/validation.ts +81 -0
  37. package/src/logging/__tests__/formatters.test.ts +48 -0
  38. package/src/logging/__tests__/logging-plugin.test.ts +464 -0
  39. package/src/logging/__tests__/logging-storages.test.ts +95 -0
  40. package/src/logging/formatters.ts +28 -0
  41. package/src/logging/index.ts +15 -0
  42. package/src/logging/logging-helpers.ts +223 -0
  43. package/src/logging/logging-plugin.ts +288 -0
  44. package/src/logging/storages/console-storage.ts +44 -0
  45. package/src/logging/storages/file-storage.ts +44 -0
  46. package/src/logging/storages/index.ts +4 -0
  47. package/src/logging/storages/remote-storage.ts +78 -0
  48. package/src/logging/storages/silent-storage.ts +18 -0
  49. package/src/logging/types.ts +106 -0
  50. package/src/performance/__tests__/memory-storage.test.ts +86 -0
  51. package/src/performance/__tests__/performance-plugin.test.ts +208 -0
  52. package/src/performance/__tests__/system-metrics-collector.test.ts +33 -0
  53. package/src/performance/collectors/system-metrics-collector.ts +69 -0
  54. package/src/performance/index.ts +12 -0
  55. package/src/performance/performance-helpers.ts +86 -0
  56. package/src/performance/performance-plugin.ts +274 -0
  57. package/src/performance/storages/index.ts +1 -0
  58. package/src/performance/storages/memory-storage.ts +88 -0
  59. package/src/performance/types.ts +160 -0
  60. package/src/usage/__tests__/aggregate-usage-stats.test.ts +136 -0
  61. package/src/usage/__tests__/memory-storage.test.ts +83 -0
  62. package/src/usage/__tests__/silent-storage.test.ts +44 -0
  63. package/src/usage/__tests__/usage-plugin-helpers.test.ts +155 -0
  64. package/src/usage/__tests__/usage-plugin.test.ts +358 -0
  65. package/src/usage/aggregate-usage-stats.ts +142 -0
  66. package/src/usage/index.ts +14 -0
  67. package/src/usage/storages/file-storage.ts +115 -0
  68. package/src/usage/storages/index.ts +4 -0
  69. package/src/usage/storages/memory-storage.ts +61 -0
  70. package/src/usage/storages/remote-storage.ts +143 -0
  71. package/src/usage/storages/silent-storage.ts +38 -0
  72. package/src/usage/types.ts +132 -0
  73. package/src/usage/usage-plugin-helpers.ts +116 -0
  74. package/src/usage/usage-plugin.ts +296 -0
  75. package/src/webhook/__tests__/webhook-plugin.test.ts +560 -0
  76. package/src/webhook/http-client.ts +141 -0
  77. package/src/webhook/index.ts +9 -0
  78. package/src/webhook/transformer.ts +209 -0
  79. package/src/webhook/types.ts +201 -0
  80. package/src/webhook/webhook-helpers.ts +60 -0
  81. package/src/webhook/webhook-plugin.ts +298 -0
  82. package/src/webhook/webhook-queue.ts +148 -0
@@ -0,0 +1,1724 @@
1
+ import { AbstractPlugin, IEventEmitterEventData, ILogger, IPluginErrorContext, IPluginExecutionContext, IPluginExecutionResult, IPluginOptions, IPluginStats, IRunOptions, IToolExecutionResult, PluginCategory, TErrorContextData, TEventName, TExecutionEventName, TLoggerData, TToolParameters, TUniversalMessage } from "@robota-sdk/agent-core";
2
+
3
+ //#region src/conversation-history/types.d.ts
4
+ /**
5
+ * Storage strategy for conversation history
6
+ */
7
+ type THistoryStorageStrategy = 'memory' | 'file' | 'database';
8
+ /**
9
+ * Configuration options for conversation history plugin
10
+ */
11
+ interface IConversationHistoryPluginOptions extends IPluginOptions {
12
+ /** Storage strategy to use */
13
+ storage: THistoryStorageStrategy;
14
+ /** Maximum number of conversations to store */
15
+ maxConversations?: number;
16
+ /** Maximum messages per conversation */
17
+ maxMessagesPerConversation?: number;
18
+ /** File path for file storage strategy */
19
+ filePath?: string;
20
+ /** Database connection string for database storage */
21
+ connectionString?: string;
22
+ /** Whether to auto-save after each message */
23
+ autoSave?: boolean;
24
+ /** Save interval in milliseconds for batch saving */
25
+ saveInterval?: number;
26
+ }
27
+ /**
28
+ * Conversation history entry
29
+ */
30
+ interface IConversationHistoryEntry {
31
+ conversationId: string;
32
+ messages: TUniversalMessage[];
33
+ startTime: Date;
34
+ lastUpdated: Date;
35
+ metadata?: Record<string, string | number | boolean | Date>;
36
+ }
37
+ /**
38
+ * Storage interface for conversation history
39
+ */
40
+ interface IHistoryStorage {
41
+ save(conversationId: string, entry: IConversationHistoryEntry): Promise<void>;
42
+ load(conversationId: string): Promise<IConversationHistoryEntry | undefined>;
43
+ list(): Promise<string[]>;
44
+ delete(conversationId: string): Promise<boolean>;
45
+ clear(): Promise<void>;
46
+ }
47
+ /**
48
+ * Conversation history plugin statistics
49
+ */
50
+ interface IConversationHistoryPluginStats extends IPluginStats {
51
+ /** Total number of conversations stored */
52
+ totalConversations: number;
53
+ /** Total number of messages stored */
54
+ totalMessages: number;
55
+ /** Storage strategy in use */
56
+ storageStrategy: THistoryStorageStrategy;
57
+ /** Last save timestamp */
58
+ lastSaveTime?: Date;
59
+ /** Number of failed saves */
60
+ failedSaves: number;
61
+ }
62
+ //#endregion
63
+ //#region src/conversation-history/conversation-history-plugin.d.ts
64
+ /**
65
+ * Persists conversation history using configurable storage backends.
66
+ *
67
+ * Supports memory, file, and database storage strategies. Messages are
68
+ * automatically trimmed to {@link IConversationHistoryPluginOptions.maxMessagesPerConversation | maxMessagesPerConversation}.
69
+ * When {@link IConversationHistoryPluginOptions.autoSave | autoSave} is
70
+ * disabled, changes are batched and flushed on a timer.
71
+ *
72
+ * @extends AbstractPlugin
73
+ * @see IHistoryStorage - storage backend contract
74
+ * @see IConversationHistoryPluginOptions - configuration options
75
+ *
76
+ * @example
77
+ * ```ts
78
+ * const plugin = new ConversationHistoryPlugin({
79
+ * storage: 'memory',
80
+ * maxMessagesPerConversation: 500,
81
+ * });
82
+ * await plugin.startConversation('conv-1');
83
+ * await plugin.addMessage({ role: 'user', content: 'Hello' });
84
+ * ```
85
+ */
86
+ declare class ConversationHistoryPlugin extends AbstractPlugin<IConversationHistoryPluginOptions, IConversationHistoryPluginStats> {
87
+ name: string;
88
+ version: string;
89
+ private storage;
90
+ private pluginOptions;
91
+ private logger;
92
+ private currentConversationId?;
93
+ private batchSaveTimer?;
94
+ private pendingSaves;
95
+ constructor(options: IConversationHistoryPluginOptions);
96
+ /**
97
+ * Creates a new conversation entry and persists it (or queues for batch save).
98
+ * @throws PluginError if the storage write fails
99
+ */
100
+ startConversation(conversationId: string): Promise<void>;
101
+ /**
102
+ * Appends a message to the active conversation, trimming to the maximum
103
+ * message limit if exceeded.
104
+ * @throws PluginError if no conversation is active or the storage write fails
105
+ */
106
+ addMessage(message: TUniversalMessage): Promise<void>;
107
+ /**
108
+ * Load conversation history
109
+ */
110
+ loadConversation(conversationId: string): Promise<IConversationHistoryEntry | undefined>;
111
+ /**
112
+ * Get conversation history as messages
113
+ */
114
+ getHistory(conversationId: string): Promise<TUniversalMessage[]>;
115
+ /**
116
+ * List all conversation IDs
117
+ */
118
+ listConversations(): Promise<string[]>;
119
+ /**
120
+ * Delete a conversation
121
+ */
122
+ deleteConversation(conversationId: string): Promise<boolean>;
123
+ /**
124
+ * Clear all conversations
125
+ */
126
+ clearAllConversations(): Promise<void>;
127
+ /**
128
+ * Persists all conversations queued since the last save (batch mode only).
129
+ * Individual save failures are logged but do not abort the remaining saves.
130
+ */
131
+ savePending(): Promise<void>;
132
+ /**
133
+ * Stops the batch-save timer and flushes any pending conversation saves.
134
+ */
135
+ destroy(): Promise<void>;
136
+ /**
137
+ * Setup batch saving timer
138
+ */
139
+ private setupBatchSaving;
140
+ }
141
+ //#endregion
142
+ //#region src/conversation-history/storages/memory-storage.d.ts
143
+ /**
144
+ * Memory storage implementation
145
+ */
146
+ declare class MemoryHistoryStorage implements IHistoryStorage {
147
+ private conversations;
148
+ private maxConversations;
149
+ constructor(maxConversations?: number);
150
+ save(conversationId: string, entry: IConversationHistoryEntry): Promise<void>;
151
+ load(conversationId: string): Promise<IConversationHistoryEntry | undefined>;
152
+ list(): Promise<string[]>;
153
+ delete(conversationId: string): Promise<boolean>;
154
+ clear(): Promise<void>;
155
+ }
156
+ //#endregion
157
+ //#region src/conversation-history/storages/file-storage.d.ts
158
+ /**
159
+ * File storage implementation
160
+ */
161
+ declare class FileHistoryStorage implements IHistoryStorage {
162
+ private filePath;
163
+ private logger;
164
+ constructor(filePath: string);
165
+ save(conversationId: string, _entry: IConversationHistoryEntry): Promise<void>;
166
+ load(conversationId: string): Promise<IConversationHistoryEntry | undefined>;
167
+ list(): Promise<string[]>;
168
+ delete(conversationId: string): Promise<boolean>;
169
+ clear(): Promise<void>;
170
+ }
171
+ //#endregion
172
+ //#region src/conversation-history/storages/database-storage.d.ts
173
+ /**
174
+ * Database storage implementation
175
+ */
176
+ declare class DatabaseHistoryStorage implements IHistoryStorage {
177
+ private connectionString;
178
+ private logger;
179
+ constructor(connectionString: string);
180
+ save(conversationId: string, _entry: IConversationHistoryEntry): Promise<void>;
181
+ load(conversationId: string): Promise<IConversationHistoryEntry | undefined>;
182
+ list(): Promise<string[]>;
183
+ delete(conversationId: string): Promise<boolean>;
184
+ clear(): Promise<void>;
185
+ /**
186
+ * Mask sensitive information in connection string for logging
187
+ */
188
+ private maskConnectionString;
189
+ }
190
+ //#endregion
191
+ //#region src/error-handling/types.d.ts
192
+ /**
193
+ * ErrorHandling Plugin - Type definitions for Facade pattern implementation
194
+ *
195
+ * REASON: Complex ErrorContextData compatibility issues require type adapters and unified error handling
196
+ * ALTERNATIVES_CONSIDERED:
197
+ * 1. Modify ErrorContextData type globally (breaks other components)
198
+ * 2. Use type assertions everywhere (reduces type safety)
199
+ * 3. Create complex union types (causes circular dependencies)
200
+ * 4. Redesign PluginError constructor (breaks existing contracts)
201
+ * 5. Remove context from error handling (loses debugging capability)
202
+ * TODO: Consider unified error context system across all plugins
203
+ */
204
+ /**
205
+ * Error handling strategy types
206
+ */
207
+ type TErrorHandlingStrategy = 'simple' | 'circuit-breaker' | 'exponential-backoff' | 'silent';
208
+ /**
209
+ * Base error context for internal operations
210
+ * REASON: Optional properties and index signature for compatibility with both exactOptionalPropertyTypes and logger constraints
211
+ * ALTERNATIVES_CONSIDERED: Union types (breaks interface compatibility), explicit undefined (still triggers index signature rules), removing optional properties (breaks existing usage), type assertions (loses safety), intersection types (complex propagation)
212
+ * TODO: Consider unified error context type system across all plugins
213
+ */
214
+ interface IErrorHandlingContextData {
215
+ executionId?: string;
216
+ sessionId?: string;
217
+ userId?: string;
218
+ attempt?: number;
219
+ finalAttempt?: boolean;
220
+ originalError?: string;
221
+ [key: string]: string | number | boolean | undefined;
222
+ }
223
+ /**
224
+ * Configuration options for error handling plugin
225
+ */
226
+ interface IErrorHandlingPluginOptions extends IPluginOptions {
227
+ /** Error handling strategy to use */
228
+ strategy: TErrorHandlingStrategy;
229
+ /** Maximum number of retry attempts */
230
+ maxRetries?: number;
231
+ /** Initial delay between retries in milliseconds */
232
+ retryDelay?: number;
233
+ /** Whether to log errors */
234
+ logErrors?: boolean;
235
+ /** Circuit breaker failure threshold */
236
+ failureThreshold?: number;
237
+ /** Circuit breaker timeout in milliseconds */
238
+ circuitBreakerTimeout?: number;
239
+ /** Custom error handler function */
240
+ customErrorHandler?: (error: Error, context: IErrorHandlingContextData) => Promise<void>;
241
+ }
242
+ /**
243
+ * Error handling plugin statistics
244
+ */
245
+ interface IErrorHandlingPluginStats extends IPluginStats {
246
+ failureCount: number;
247
+ circuitBreakerOpen: boolean;
248
+ lastFailureTime: number;
249
+ totalRetries: number;
250
+ successfulRecoveries: number;
251
+ }
252
+ /**
253
+ * Error context adapter for PluginError compatibility
254
+ */
255
+ interface IErrorContextAdapter {
256
+ originalError?: string;
257
+ executionId?: string;
258
+ sessionId?: string;
259
+ userId?: string;
260
+ attempt?: number;
261
+ [key: string]: string | number | boolean | Date | Error | string[] | undefined;
262
+ }
263
+ //#endregion
264
+ //#region src/error-handling/error-handling-plugin.d.ts
265
+ /**
266
+ * Provides configurable error recovery using one of four strategies:
267
+ * simple logging, circuit breaker, exponential backoff, or silent.
268
+ *
269
+ * The circuit breaker opens after
270
+ * {@link IErrorHandlingPluginOptions.failureThreshold | failureThreshold}
271
+ * consecutive failures and automatically resets after
272
+ * {@link IErrorHandlingPluginOptions.circuitBreakerTimeout | circuitBreakerTimeout} ms.
273
+ * An optional custom error handler can be injected for application-specific
274
+ * recovery logic.
275
+ *
276
+ * @extends AbstractPlugin
277
+ * @see IErrorHandlingPluginOptions - configuration options
278
+ * @see IErrorHandlingContextData - error context contract
279
+ *
280
+ * @example
281
+ * ```ts
282
+ * const plugin = new ErrorHandlingPlugin({
283
+ * strategy: 'circuit-breaker',
284
+ * failureThreshold: 5,
285
+ * circuitBreakerTimeout: 60000,
286
+ * });
287
+ * const result = await plugin.executeWithRetry(() => fetchData());
288
+ * ```
289
+ */
290
+ declare class ErrorHandlingPlugin extends AbstractPlugin<IErrorHandlingPluginOptions, IErrorHandlingPluginStats> {
291
+ name: string;
292
+ version: string;
293
+ private pluginOptions;
294
+ private logger;
295
+ private failureCount;
296
+ private circuitBreakerOpen;
297
+ private lastFailureTime;
298
+ constructor(options: IErrorHandlingPluginOptions);
299
+ /**
300
+ * Dispatches the error to the active strategy handler. If a custom error
301
+ * handler is configured, it takes precedence over strategy-specific handling.
302
+ */
303
+ handleError(error: Error, context?: IErrorHandlingContextData): Promise<void>;
304
+ /**
305
+ * Executes a function with automatic retries up to
306
+ * {@link IErrorHandlingPluginOptions.maxRetries | maxRetries}. The delay
307
+ * between retries follows the configured strategy (fixed for simple /
308
+ * circuit-breaker, doubling for exponential-backoff).
309
+ *
310
+ * @throws PluginError after all retry attempts are exhausted
311
+ */
312
+ executeWithRetry<T>(fn: () => Promise<T>, context?: IErrorHandlingContextData): Promise<T>;
313
+ /**
314
+ * Resets the circuit breaker to closed state, clearing failure count and
315
+ * last failure timestamp.
316
+ */
317
+ resetCircuitBreaker(): void;
318
+ /**
319
+ * Get error handling statistics
320
+ */
321
+ getStats(): IErrorHandlingPluginStats;
322
+ /**
323
+ * Cleanup resources
324
+ */
325
+ destroy(): Promise<void>;
326
+ private handleSimple;
327
+ private handleCircuitBreaker;
328
+ private handleExponentialBackoff;
329
+ }
330
+ //#endregion
331
+ //#region src/error-handling/context-adapter.d.ts
332
+ /**
333
+ * Convert IErrorHandlingContextData to ErrorContextData-compatible format for PluginError
334
+ * REASON: Simple object spread with known properties to avoid index signature conflicts
335
+ * ALTERNATIVES_CONSIDERED: Complex type adapters (unnecessary), Object.assign (verbose), bracket notation (rejected by TS), type assertions (reduces safety)
336
+ * TODO: Consider unified error context type system across all plugins
337
+ */
338
+ declare function toErrorContext(context: IErrorHandlingContextData): IErrorContextAdapter;
339
+ /**
340
+ * Safe context extraction for PluginError with nested context structure
341
+ *
342
+ * REASON: PluginError context needs flexible data structure for debugging information
343
+ * ALTERNATIVES_CONSIDERED:
344
+ * 1. Strict primitive types (loses debugging information)
345
+ * 2. Interface definitions (too rigid for error contexts)
346
+ * 3. Union types (becomes unwieldy for error data)
347
+ * 4. Generic constraints (too complex for error handling)
348
+ * 5. Type assertions (decreases type safety)
349
+ * TODO: Consider standardized error context interface if patterns emerge
350
+ */
351
+ declare function createPluginErrorContext(context: IErrorHandlingContextData, additionalData?: TErrorContextData): TErrorContextData;
352
+ //#endregion
353
+ //#region src/execution-analytics/types.d.ts
354
+ /**
355
+ * Analytics context data for execution tracking
356
+ */
357
+ interface IExecutionAnalyticsContextData {
358
+ executionId?: string;
359
+ sessionId?: string;
360
+ userId?: string;
361
+ operation?: string;
362
+ toolName?: string;
363
+ parameterCount?: number;
364
+ inputLength?: number;
365
+ responseLength?: number;
366
+ hasOptions?: boolean;
367
+ hasError?: boolean;
368
+ resultType?: string;
369
+ errorSource?: string;
370
+ contextType?: string;
371
+ hasContext?: boolean;
372
+ modelName?: string;
373
+ }
374
+ /**
375
+ * Execution statistics entry
376
+ */
377
+ interface IExecutionStats {
378
+ executionId: string;
379
+ operation: string;
380
+ startTime: Date;
381
+ endTime: Date;
382
+ duration: number;
383
+ success: boolean;
384
+ error?: {
385
+ message: string;
386
+ stack?: string;
387
+ type: string;
388
+ };
389
+ metadata?: Record<string, string | number | boolean | Date | string[]>;
390
+ }
391
+ /**
392
+ * Aggregated execution statistics
393
+ */
394
+ interface IAggregatedExecutionStats {
395
+ totalExecutions: number;
396
+ successfulExecutions: number;
397
+ failedExecutions: number;
398
+ successRate: number;
399
+ averageDuration: number;
400
+ totalDuration: number;
401
+ operationStats: Record<string, {
402
+ count: number;
403
+ successCount: number;
404
+ failureCount: number;
405
+ averageDuration: number;
406
+ totalDuration: number;
407
+ }>;
408
+ errorStats: Record<string, number>;
409
+ timeRange: {
410
+ start: Date;
411
+ end: Date;
412
+ };
413
+ }
414
+ /**
415
+ * Plugin options
416
+ */
417
+ interface IExecutionAnalyticsOptions extends IPluginOptions {
418
+ /** Maximum number of entries to keep in memory */
419
+ maxEntries?: number;
420
+ /** Whether to track error details */
421
+ trackErrors?: boolean;
422
+ /** Performance threshold in milliseconds for warnings */
423
+ performanceThreshold?: number;
424
+ /** Enable performance warnings */
425
+ enableWarnings?: boolean;
426
+ }
427
+ /**
428
+ * Execution analytics plugin statistics
429
+ */
430
+ interface IExecutionAnalyticsPluginStats extends IPluginStats {
431
+ /** Total number of executions recorded */
432
+ totalRecorded: number;
433
+ /** Number of active executions */
434
+ activeExecutions: number;
435
+ /** Memory usage in KB */
436
+ memoryUsage: number;
437
+ /** Oldest record timestamp */
438
+ oldestRecord?: Date;
439
+ /** Newest record timestamp */
440
+ newestRecord?: Date;
441
+ }
442
+ //#endregion
443
+ //#region src/execution-analytics/execution-analytics-plugin.d.ts
444
+ /**
445
+ * Tracks timing and success/failure of agent runs, provider calls, and tool executions.
446
+ * @extends AbstractPlugin
447
+ */
448
+ declare class ExecutionAnalyticsPlugin extends AbstractPlugin<IExecutionAnalyticsOptions, IExecutionAnalyticsPluginStats> {
449
+ name: string;
450
+ version: string;
451
+ private pluginOptions;
452
+ private logger;
453
+ private activeExecutions;
454
+ private executionHistory;
455
+ private executionCounter;
456
+ private initialized;
457
+ constructor(options?: IExecutionAnalyticsOptions);
458
+ beforeRun: (input: string, _options?: IRunOptions) => Promise<void>;
459
+ afterRun: (input: string, response: string, options?: IRunOptions) => Promise<void>;
460
+ beforeProviderCall: (messages: TUniversalMessage[]) => Promise<void>;
461
+ afterProviderCall: (messages: TUniversalMessage[], response: TUniversalMessage) => Promise<void>;
462
+ beforeToolCall(toolName: string, _parameters: TToolParameters): Promise<void>;
463
+ afterToolCall(toolName: string, parameters: TToolParameters, result: IToolExecutionResult): Promise<void>;
464
+ onError(error: Error, context?: IPluginErrorContext): Promise<void>;
465
+ getExecutionStats(operation?: string, timeRange?: {
466
+ start: Date;
467
+ end: Date;
468
+ }): IExecutionStats[];
469
+ getAggregatedStats(timeRange?: {
470
+ start: Date;
471
+ end: Date;
472
+ }): IAggregatedExecutionStats;
473
+ clearStats(): void;
474
+ getActiveExecutions(): Array<{
475
+ executionId: string;
476
+ operation: string;
477
+ duration: number;
478
+ }>;
479
+ getPluginStats(): {
480
+ totalRecorded: number;
481
+ activeExecutions: number;
482
+ memoryUsage: number;
483
+ oldestRecord?: Date;
484
+ newestRecord?: Date;
485
+ };
486
+ destroy(): Promise<void>;
487
+ getExecutionData(): IExecutionStats[];
488
+ getAnalyticsStats(): IAggregatedExecutionStats;
489
+ clearExecutionData(): void;
490
+ getStatus(): {
491
+ name: string;
492
+ version: string;
493
+ enabled: boolean;
494
+ initialized: boolean;
495
+ category: PluginCategory;
496
+ priority: number;
497
+ subscribedEventsCount: number;
498
+ hasEventEmitter: boolean;
499
+ };
500
+ getStats(): IExecutionAnalyticsPluginStats;
501
+ private recordStats;
502
+ }
503
+ //#endregion
504
+ //#region src/execution-analytics/analytics-aggregation.d.ts
505
+ /** Compute aggregated analytics across recorded executions. @internal */
506
+ declare function aggregateExecutionStats(stats: IExecutionStats[], timeRange?: {
507
+ start: Date;
508
+ end: Date;
509
+ }): IAggregatedExecutionStats;
510
+ //#endregion
511
+ //#region src/limits/types.d.ts
512
+ /**
513
+ * Rate limiting strategies
514
+ */
515
+ type TLimitsStrategy = 'token-bucket' | 'sliding-window' | 'fixed-window' | 'none';
516
+ /**
517
+ * Limits plugin configuration
518
+ */
519
+ interface ILimitsPluginOptions extends IPluginOptions {
520
+ /** Rate limiting strategy */
521
+ strategy: TLimitsStrategy;
522
+ /** Maximum tokens per time window */
523
+ maxTokens?: number;
524
+ /** Maximum requests per time window */
525
+ maxRequests?: number;
526
+ /** Time window in milliseconds */
527
+ timeWindow?: number;
528
+ /** Maximum cost per time window (in USD) */
529
+ maxCost?: number;
530
+ /** Token cost per 1000 tokens (in USD) */
531
+ tokenCostPer1000?: number;
532
+ /** Bucket refill rate for token bucket strategy */
533
+ refillRate?: number;
534
+ /** Initial bucket size for token bucket strategy */
535
+ bucketSize?: number;
536
+ /** Custom cost calculator */
537
+ costCalculator?: (tokens: number, model: string) => number;
538
+ }
539
+ /**
540
+ * Plugin limits status data type - supports nested objects and null values for comprehensive status reporting
541
+ *
542
+ * REASON: Status data needs to include nested objects for bucket/window details and null values for missing data
543
+ * ALTERNATIVES_CONSIDERED:
544
+ * 1. Strict primitive types (loses nested status information)
545
+ * 2. Union types without null (breaks null handling)
546
+ * 3. Interface definitions (too rigid for dynamic status)
547
+ * 4. Generic constraints (too complex for status data)
548
+ * 5. Type assertions (decreases type safety)
549
+ * TODO: Consider specific status interfaces if patterns emerge
550
+ */
551
+ type TPluginLimitsStatusData = Record<string, string | number | boolean | Array<string | number | boolean> | Record<string, string | number | boolean> | null>;
552
+ /**
553
+ * Rate limiting window data
554
+ */
555
+ interface ILimitWindow {
556
+ count: number;
557
+ tokens: number;
558
+ cost: number;
559
+ windowStart: number;
560
+ }
561
+ /**
562
+ * Token bucket state
563
+ */
564
+ interface ITokenBucket {
565
+ tokens: number;
566
+ lastRefill: number;
567
+ requests: number;
568
+ cost: number;
569
+ windowStart: number;
570
+ }
571
+ //#endregion
572
+ //#region src/limits/limits-plugin.d.ts
573
+ interface ILimitsPluginExecutionContext extends IPluginExecutionContext {
574
+ config?: {
575
+ model?: string;
576
+ maxTokens?: number;
577
+ temperature?: number;
578
+ };
579
+ conversationId?: string;
580
+ }
581
+ interface ILimitsPluginExecutionResult {
582
+ tokensUsed?: number;
583
+ cost?: number;
584
+ success?: boolean;
585
+ [key: string]: string | number | boolean | undefined;
586
+ }
587
+ /**
588
+ * Enforces rate limiting on token usage, request frequency, and cost.
589
+ * @extends AbstractPlugin
590
+ */
591
+ declare class LimitsPlugin extends AbstractPlugin<ILimitsPluginOptions> {
592
+ name: string;
593
+ version: string;
594
+ private pluginOptions;
595
+ private logger;
596
+ private windows;
597
+ private buckets;
598
+ constructor(options: ILimitsPluginOptions);
599
+ beforeExecution(context: IPluginExecutionContext): Promise<void>;
600
+ afterExecution(context: IPluginExecutionContext, result: IPluginExecutionResult): Promise<void>;
601
+ private getBucket;
602
+ private getWindow;
603
+ private getKey;
604
+ private resolveModelName;
605
+ getLimitsStatus(key?: string): TPluginLimitsStatusData;
606
+ resetLimits(key?: string): void;
607
+ }
608
+ //#endregion
609
+ //#region src/logging/types.d.ts
610
+ /**
611
+ * Logging strategy types
612
+ */
613
+ type TLoggingStrategy = 'console' | 'file' | 'remote' | 'silent';
614
+ /**
615
+ * Log levels
616
+ */
617
+ type TLogLevel = 'debug' | 'info' | 'warn' | 'error';
618
+ /**
619
+ * Log entry structure
620
+ */
621
+ interface ILogEntry {
622
+ timestamp: Date;
623
+ level: TLogLevel;
624
+ message: string;
625
+ context?: Record<string, string | number | boolean | Date | undefined>;
626
+ metadata?: {
627
+ executionId?: string;
628
+ conversationId?: string;
629
+ userId?: string;
630
+ sessionId?: string;
631
+ operation?: string;
632
+ duration?: number;
633
+ };
634
+ }
635
+ /**
636
+ * Configuration options for logging plugin
637
+ */
638
+ interface ILoggingPluginOptions extends IPluginOptions {
639
+ /** Logging strategy to use */
640
+ strategy: TLoggingStrategy;
641
+ /** Minimum log level to capture */
642
+ level?: TLogLevel;
643
+ /** File path for file strategy */
644
+ filePath?: string;
645
+ /** Remote endpoint for remote strategy */
646
+ remoteEndpoint?: string;
647
+ /** Headers for remote logging */
648
+ remoteHeaders?: Record<string, string>;
649
+ /** Maximum number of logs to keep in memory */
650
+ maxLogs?: number;
651
+ /** Whether to include stack traces in error logs */
652
+ includeStackTrace?: boolean;
653
+ /** Custom log formatter */
654
+ formatter?: ILogFormatter;
655
+ /** Logger instance for internal plugin logging */
656
+ logger?: ILogger;
657
+ /** Batch size for remote logging */
658
+ batchSize?: number;
659
+ /** Flush interval for batched logging in milliseconds */
660
+ flushInterval?: number;
661
+ }
662
+ /**
663
+ * Log formatter interface
664
+ */
665
+ interface ILogFormatter {
666
+ format(entry: ILogEntry): string;
667
+ }
668
+ /**
669
+ * Log storage interface
670
+ */
671
+ interface ILogStorage {
672
+ write(entry: ILogEntry): Promise<void>;
673
+ flush(): Promise<void>;
674
+ close(): Promise<void>;
675
+ }
676
+ /** Structured context data for log entries */
677
+ interface ILoggingContextData extends Record<string, string | number | boolean | Date | undefined> {
678
+ userInput?: string;
679
+ duration?: number;
680
+ toolName?: string;
681
+ success?: boolean;
682
+ executionId?: string;
683
+ operation?: string;
684
+ errorMessage?: string;
685
+ errorStack?: string;
686
+ inputLength?: number;
687
+ responseLength?: number;
688
+ hasOptions?: boolean;
689
+ modelName?: string;
690
+ }
691
+ /**
692
+ * Logging plugin statistics
693
+ */
694
+ interface ILoggingPluginStats extends IPluginStats {
695
+ /** Total number of logs written */
696
+ logsWritten: number;
697
+ /** Number of failed log writes */
698
+ failedWrites: number;
699
+ /** Current log level */
700
+ currentLevel: TLogLevel;
701
+ /** Storage strategy in use */
702
+ strategy: TLoggingStrategy;
703
+ /** Last flush timestamp */
704
+ lastFlushTime?: Date;
705
+ }
706
+ //#endregion
707
+ //#region src/logging/logging-plugin.d.ts
708
+ /** Logs agent operations using configurable storage backends (console/file/remote/silent). */
709
+ declare class LoggingPlugin extends AbstractPlugin<ILoggingPluginOptions, ILoggingPluginStats> {
710
+ name: string;
711
+ version: string;
712
+ private storage;
713
+ private pluginOptions;
714
+ private logger;
715
+ private simpleLogger;
716
+ private logLevels;
717
+ constructor(options: ILoggingPluginOptions);
718
+ /**
719
+ * Routes module lifecycle events (initialize, execute, dispose) to the
720
+ * appropriate log level. Errors are logged but never re-thrown.
721
+ */
722
+ onModuleEvent(eventName: TEventName, eventData: IEventEmitterEventData): Promise<void>;
723
+ /**
724
+ * Writes a log entry to the configured storage if the level meets the
725
+ * current threshold. Logging failures are swallowed to prevent cascading errors.
726
+ */
727
+ log(level: TLogLevel, message: string, context?: ILoggingContextData, metadata?: ILogEntry['metadata']): Promise<void>;
728
+ /** Log debug message */
729
+ debug(message: string, context?: ILoggingContextData, metadata?: ILogEntry['metadata']): Promise<void>;
730
+ /** Log info message */
731
+ info(message: string, context?: ILoggingContextData, metadata?: ILogEntry['metadata']): Promise<void>;
732
+ /** Log warning message */
733
+ warn(message: string, context?: ILoggingContextData, metadata?: ILogEntry['metadata']): Promise<void>;
734
+ /**
735
+ * Log error message
736
+ */
737
+ error(message: string, error?: Error, context?: ILoggingContextData, metadata?: ILogEntry['metadata']): Promise<void>;
738
+ /**
739
+ * Logs the start of an agent execution, truncating user input to 100 characters.
740
+ */
741
+ logExecutionStart(executionId: string, userInput: string, metadata?: ILogEntry['metadata']): Promise<void>;
742
+ /**
743
+ * Logs the completion of an agent execution with its duration.
744
+ */
745
+ logExecutionComplete(executionId: string, duration: number, metadata?: ILogEntry['metadata']): Promise<void>;
746
+ /**
747
+ * Logs a tool execution result at info (success) or error (failure) level.
748
+ */
749
+ logToolExecution(toolName: string, executionId: string, duration?: number, success?: boolean, metadata?: ILogEntry['metadata']): Promise<void>;
750
+ /**
751
+ * Flushes any buffered log entries to the underlying storage.
752
+ * @throws PluginError if the flush operation fails
753
+ */
754
+ flush(): Promise<void>;
755
+ /**
756
+ * Closes the underlying storage and releases resources.
757
+ */
758
+ destroy(): Promise<void>;
759
+ /** Check if message should be logged based on level */
760
+ private shouldLog;
761
+ }
762
+ //#endregion
763
+ //#region src/logging/storages/console-storage.d.ts
764
+ /**
765
+ * Console log storage
766
+ */
767
+ declare class ConsoleLogStorage implements ILogStorage {
768
+ private formatter;
769
+ private logger;
770
+ constructor(formatter?: ILogFormatter, logger?: ILogger);
771
+ write(entry: ILogEntry): Promise<void>;
772
+ flush(): Promise<void>;
773
+ close(): Promise<void>;
774
+ }
775
+ //#endregion
776
+ //#region src/logging/storages/file-storage.d.ts
777
+ /**
778
+ * File log storage (placeholder implementation)
779
+ */
780
+ declare class FileLogStorage implements ILogStorage {
781
+ private filePath;
782
+ private formatter;
783
+ private logger;
784
+ constructor(filePath: string, formatter?: ILogFormatter);
785
+ write(entry: ILogEntry): Promise<void>;
786
+ flush(): Promise<void>;
787
+ close(): Promise<void>;
788
+ }
789
+ //#endregion
790
+ //#region src/logging/storages/remote-storage.d.ts
791
+ /**
792
+ * Remote log storage with batching
793
+ */
794
+ declare class RemoteLogStorage implements ILogStorage {
795
+ private url;
796
+ private formatter;
797
+ private batchSize;
798
+ private flushInterval;
799
+ private pendingLogs;
800
+ private flushTimer;
801
+ private logger;
802
+ constructor(url: string, _options?: {
803
+ timeout?: number;
804
+ });
805
+ write(entry: ILogEntry): Promise<void>;
806
+ flush(): Promise<void>;
807
+ close(): Promise<void>;
808
+ }
809
+ //#endregion
810
+ //#region src/logging/storages/silent-storage.d.ts
811
+ /**
812
+ * Silent log storage (no-op)
813
+ */
814
+ declare class SilentLogStorage implements ILogStorage {
815
+ write(_entry: ILogEntry): Promise<void>;
816
+ flush(): Promise<void>;
817
+ close(): Promise<void>;
818
+ }
819
+ //#endregion
820
+ //#region src/logging/formatters.d.ts
821
+ /**
822
+ * Default console formatter
823
+ */
824
+ declare class ConsoleLogFormatter implements ILogFormatter {
825
+ format(entry: ILogEntry): string;
826
+ }
827
+ /**
828
+ * JSON formatter for file/remote logging
829
+ */
830
+ declare class JsonLogFormatter implements ILogFormatter {
831
+ format(entry: ILogEntry): string;
832
+ }
833
+ //#endregion
834
+ //#region src/performance/types.d.ts
835
+ /**
836
+ * Performance monitoring strategy types
837
+ */
838
+ type TPerformanceMonitoringStrategy = 'memory' | 'file' | 'prometheus' | 'remote' | 'silent';
839
+ /**
840
+ * Performance metrics entry
841
+ */
842
+ interface IPerformanceMetrics {
843
+ executionId?: string;
844
+ conversationId?: string;
845
+ timestamp: Date;
846
+ operation: string;
847
+ duration: number;
848
+ memoryUsage?: {
849
+ used: number;
850
+ free: number;
851
+ total: number;
852
+ heap: {
853
+ used: number;
854
+ total: number;
855
+ };
856
+ };
857
+ cpuUsage?: {
858
+ user: number;
859
+ system: number;
860
+ percent: number;
861
+ };
862
+ networkStats?: {
863
+ requests: number;
864
+ bytesReceived: number;
865
+ bytesSent: number;
866
+ latency: number;
867
+ };
868
+ errorCount: number;
869
+ success: boolean;
870
+ metadata?: Record<string, string | number | boolean | Date>;
871
+ }
872
+ /**
873
+ * Aggregated performance statistics
874
+ */
875
+ interface IAggregatedPerformanceStats {
876
+ totalOperations: number;
877
+ averageDuration: number;
878
+ minDuration: number;
879
+ maxDuration: number;
880
+ successRate: number;
881
+ errorRate: number;
882
+ memoryStats?: {
883
+ averageUsed: number;
884
+ maxUsed: number;
885
+ averageHeapUsed: number;
886
+ maxHeapUsed: number;
887
+ };
888
+ cpuStats?: {
889
+ averagePercent: number;
890
+ maxPercent: number;
891
+ };
892
+ networkStats?: {
893
+ totalRequests: number;
894
+ totalBytesReceived: number;
895
+ totalBytesSent: number;
896
+ averageLatency: number;
897
+ };
898
+ operationStats: Record<string, {
899
+ count: number;
900
+ averageDuration: number;
901
+ successRate: number;
902
+ errorCount: number;
903
+ }>;
904
+ timeRangeStats: {
905
+ startTime: Date;
906
+ endTime: Date;
907
+ period: string;
908
+ };
909
+ }
910
+ /**
911
+ * Configuration options for performance plugin
912
+ */
913
+ interface IPerformancePluginOptions extends IPluginOptions {
914
+ /** Performance monitoring strategy to use */
915
+ strategy: TPerformanceMonitoringStrategy;
916
+ /** File path for file strategy */
917
+ filePath?: string;
918
+ /** Remote endpoint for remote strategy */
919
+ remoteEndpoint?: string;
920
+ /** Prometheus endpoint for prometheus strategy */
921
+ prometheusEndpoint?: string;
922
+ /** Headers for remote monitoring */
923
+ remoteHeaders?: Record<string, string>;
924
+ /** Maximum number of performance entries to keep in memory */
925
+ maxEntries?: number;
926
+ /** Whether to monitor memory usage */
927
+ monitorMemory?: boolean;
928
+ /** Whether to monitor CPU usage */
929
+ monitorCPU?: boolean;
930
+ /** Whether to monitor network stats */
931
+ monitorNetwork?: boolean;
932
+ /** Batch size for remote reporting */
933
+ batchSize?: number;
934
+ /** Flush interval for batched reporting in milliseconds */
935
+ flushInterval?: number;
936
+ /** Whether to aggregate statistics */
937
+ aggregateStats?: boolean;
938
+ /** Aggregation interval in milliseconds */
939
+ aggregationInterval?: number;
940
+ /** Performance threshold in milliseconds to log warnings */
941
+ performanceThreshold?: number;
942
+ }
943
+ /**
944
+ * Performance storage interface
945
+ */
946
+ interface IPerformanceStorage {
947
+ save(entry: IPerformanceMetrics): Promise<void>;
948
+ getMetrics(operation?: string, timeRange?: {
949
+ start: Date;
950
+ end: Date;
951
+ }): Promise<IPerformanceMetrics[]>;
952
+ getAggregatedStats(timeRange?: {
953
+ start: Date;
954
+ end: Date;
955
+ }): Promise<IAggregatedPerformanceStats>;
956
+ clear(): Promise<void>;
957
+ flush(): Promise<void>;
958
+ close(): Promise<void>;
959
+ }
960
+ /**
961
+ * System metrics collector interface
962
+ */
963
+ interface ISystemMetricsCollector {
964
+ getMemoryUsage(): Promise<IPerformanceMetrics['memoryUsage']>;
965
+ getCPUUsage(): Promise<IPerformanceMetrics['cpuUsage']>;
966
+ getNetworkStats(): Promise<IPerformanceMetrics['networkStats']>;
967
+ }
968
+ /**
969
+ * Performance plugin statistics
970
+ */
971
+ interface IPerformancePluginStats extends IPluginStats {
972
+ /** Total number of metrics recorded */
973
+ metricsRecorded: number;
974
+ /** Number of performance threshold violations */
975
+ thresholdViolations: number;
976
+ /** Current monitoring strategy */
977
+ strategy: TPerformanceMonitoringStrategy;
978
+ /** Monitoring status */
979
+ monitoring: {
980
+ memory: boolean;
981
+ cpu: boolean;
982
+ network: boolean;
983
+ };
984
+ /** Last metrics collection timestamp */
985
+ lastCollectionTime?: Date;
986
+ }
987
+ //#endregion
988
+ //#region src/performance/performance-plugin.d.ts
989
+ /**
990
+ * Collects application and system performance metrics during agent execution.
991
+ *
992
+ * Optionally monitors memory, CPU, and network via
993
+ * {@link ISystemMetricsCollector}. Logs a warning when an operation exceeds
994
+ * the configured {@link IPerformancePluginOptions.performanceThreshold | performanceThreshold}.
995
+ * Currently only the `memory` storage strategy is implemented.
996
+ *
997
+ * Lifecycle hooks used: {@link AbstractPlugin.onModuleEvent | onModuleEvent}
998
+ *
999
+ * @extends AbstractPlugin
1000
+ * @see IPerformanceStorage - storage backend contract
1001
+ * @see ISystemMetricsCollector - system metrics collection contract
1002
+ * @see IPerformancePluginOptions - configuration options
1003
+ *
1004
+ * @example
1005
+ * ```ts
1006
+ * const plugin = new PerformancePlugin({
1007
+ * strategy: 'memory',
1008
+ * monitorMemory: true,
1009
+ * performanceThreshold: 2000,
1010
+ * });
1011
+ * await plugin.recordMetrics({ operation: 'run', duration: 1500, success: true, errorCount: 0 });
1012
+ * ```
1013
+ */
1014
+ declare class PerformancePlugin extends AbstractPlugin<IPerformancePluginOptions, IPerformancePluginStats> {
1015
+ name: string;
1016
+ version: string;
1017
+ private storage;
1018
+ private metricsCollector;
1019
+ private pluginOptions;
1020
+ private logger;
1021
+ constructor(options: IPerformancePluginOptions);
1022
+ /**
1023
+ * Records performance metrics from module lifecycle events
1024
+ * (initialization, execution, disposal) including duration and error counts.
1025
+ */
1026
+ onModuleEvent(eventName: TEventName, eventData: IEventEmitterEventData): Promise<void>;
1027
+ /**
1028
+ * Records performance metrics, enriching them with system metrics (memory,
1029
+ * CPU, network) when the corresponding monitoring options are enabled.
1030
+ * @throws PluginError if the storage write fails
1031
+ */
1032
+ recordMetrics(metrics: Omit<IPerformanceMetrics, 'timestamp' | 'memoryUsage' | 'cpuUsage' | 'networkStats'>): Promise<void>;
1033
+ /**
1034
+ * Retrieves recorded metrics, optionally filtered by operation name and time range.
1035
+ * @throws PluginError if the storage read fails
1036
+ */
1037
+ getMetrics(operation?: string, timeRange?: {
1038
+ start: Date;
1039
+ end: Date;
1040
+ }): Promise<IPerformanceMetrics[]>;
1041
+ /**
1042
+ * Get aggregated performance statistics
1043
+ */
1044
+ getAggregatedStats(timeRange?: {
1045
+ start: Date;
1046
+ end: Date;
1047
+ }): Promise<IAggregatedPerformanceStats>;
1048
+ /**
1049
+ * Clear all performance metrics
1050
+ */
1051
+ clearMetrics(): Promise<void>;
1052
+ /**
1053
+ * Closes the underlying storage and releases resources.
1054
+ */
1055
+ destroy(): Promise<void>;
1056
+ }
1057
+ //#endregion
1058
+ //#region src/performance/storages/memory-storage.d.ts
1059
+ declare class MemoryPerformanceStorage implements IPerformanceStorage {
1060
+ private entries;
1061
+ private maxEntries;
1062
+ constructor(maxEntries?: number);
1063
+ save(entry: IPerformanceMetrics): Promise<void>;
1064
+ getMetrics(operation?: string, timeRange?: {
1065
+ start: Date;
1066
+ end: Date;
1067
+ }): Promise<IPerformanceMetrics[]>;
1068
+ getAggregatedStats(timeRange?: {
1069
+ start: Date;
1070
+ end: Date;
1071
+ }): Promise<IAggregatedPerformanceStats>;
1072
+ clear(): Promise<void>;
1073
+ flush(): Promise<void>;
1074
+ close(): Promise<void>;
1075
+ }
1076
+ //#endregion
1077
+ //#region src/performance/collectors/system-metrics-collector.d.ts
1078
+ /**
1079
+ * Node.js system metrics collector
1080
+ */
1081
+ declare class NodeSystemMetricsCollector implements ISystemMetricsCollector {
1082
+ private logger;
1083
+ constructor();
1084
+ getMemoryUsage(): Promise<IPerformanceMetrics['memoryUsage']>;
1085
+ getCPUUsage(): Promise<IPerformanceMetrics['cpuUsage']>;
1086
+ getNetworkStats(): Promise<IPerformanceMetrics['networkStats']>;
1087
+ }
1088
+ //#endregion
1089
+ //#region src/usage/types.d.ts
1090
+ /**
1091
+ * Usage tracking strategy types
1092
+ */
1093
+ type TUsageTrackingStrategy = 'memory' | 'file' | 'remote' | 'silent';
1094
+ /**
1095
+ * Usage statistics entry
1096
+ */
1097
+ interface IUsageStats {
1098
+ conversationId?: string;
1099
+ executionId?: string;
1100
+ timestamp: Date;
1101
+ provider: string;
1102
+ model: string;
1103
+ tokensUsed: {
1104
+ input: number;
1105
+ output: number;
1106
+ total: number;
1107
+ };
1108
+ cost?: {
1109
+ input: number;
1110
+ output: number;
1111
+ total: number;
1112
+ };
1113
+ requestCount: number;
1114
+ duration: number;
1115
+ success: boolean;
1116
+ toolsUsed?: string[];
1117
+ metadata?: Record<string, string | number | boolean | Date>;
1118
+ }
1119
+ /**
1120
+ * Aggregated usage statistics
1121
+ */
1122
+ interface IAggregatedUsageStats {
1123
+ totalRequests: number;
1124
+ totalTokens: number;
1125
+ totalCost: number;
1126
+ totalDuration: number;
1127
+ successRate: number;
1128
+ providerStats: Record<string, {
1129
+ requests: number;
1130
+ tokens: number;
1131
+ cost: number;
1132
+ duration: number;
1133
+ }>;
1134
+ modelStats: Record<string, {
1135
+ requests: number;
1136
+ tokens: number;
1137
+ cost: number;
1138
+ duration: number;
1139
+ }>;
1140
+ toolStats: Record<string, {
1141
+ usageCount: number;
1142
+ successCount: number;
1143
+ totalDuration: number;
1144
+ }>;
1145
+ timeRangeStats: {
1146
+ startTime: Date;
1147
+ endTime: Date;
1148
+ period: string;
1149
+ };
1150
+ }
1151
+ /**
1152
+ * Configuration options for usage plugin
1153
+ */
1154
+ interface IUsagePluginOptions extends IPluginOptions {
1155
+ /** Usage tracking strategy to use */
1156
+ strategy: TUsageTrackingStrategy;
1157
+ /** File path for file strategy */
1158
+ filePath?: string;
1159
+ /** Remote endpoint for remote strategy */
1160
+ remoteEndpoint?: string;
1161
+ /** Headers for remote logging */
1162
+ remoteHeaders?: Record<string, string>;
1163
+ /** Maximum number of usage entries to keep in memory */
1164
+ maxEntries?: number;
1165
+ /** Whether to track token costs */
1166
+ trackCosts?: boolean;
1167
+ /** Cost per token rates for different models */
1168
+ costRates?: Record<string, {
1169
+ input: number;
1170
+ output: number;
1171
+ }>;
1172
+ /** Batch size for remote reporting */
1173
+ batchSize?: number;
1174
+ /** Flush interval for batched reporting in milliseconds */
1175
+ flushInterval?: number;
1176
+ /** Whether to aggregate statistics */
1177
+ aggregateStats?: boolean;
1178
+ /** Aggregation interval in milliseconds */
1179
+ aggregationInterval?: number;
1180
+ }
1181
+ /**
1182
+ * Usage storage interface
1183
+ */
1184
+ interface IUsageStorage {
1185
+ save(entry: IUsageStats): Promise<void>;
1186
+ getStats(conversationId?: string, timeRange?: {
1187
+ start: Date;
1188
+ end: Date;
1189
+ }): Promise<IUsageStats[]>;
1190
+ getAggregatedStats(timeRange?: {
1191
+ start: Date;
1192
+ end: Date;
1193
+ }): Promise<IAggregatedUsageStats>;
1194
+ clear(): Promise<void>;
1195
+ flush(): Promise<void>;
1196
+ close(): Promise<void>;
1197
+ }
1198
+ /**
1199
+ * Usage plugin statistics
1200
+ */
1201
+ interface IUsagePluginStats extends IPluginStats {
1202
+ /** Total number of usage entries tracked */
1203
+ entriesTracked: number;
1204
+ /** Total tokens tracked */
1205
+ totalTokens: number;
1206
+ /** Total cost tracked */
1207
+ totalCost: number;
1208
+ /** Current tracking strategy */
1209
+ strategy: TUsageTrackingStrategy;
1210
+ /** Last tracking timestamp */
1211
+ lastTrackTime?: Date;
1212
+ /** Number of failed tracking attempts */
1213
+ failedTracking: number;
1214
+ }
1215
+ //#endregion
1216
+ //#region src/usage/usage-plugin.d.ts
1217
+ /**
1218
+ * Tracks token usage, request counts, and costs across agent executions.
1219
+ *
1220
+ * Supports memory, file, remote, and silent storage strategies. When
1221
+ * {@link IUsagePluginOptions.trackCosts | trackCosts} is enabled, per-model
1222
+ * cost rates are applied automatically. Periodic aggregation can be enabled
1223
+ * via {@link IUsagePluginOptions.aggregateStats | aggregateStats}.
1224
+ *
1225
+ * Lifecycle hooks used: {@link AbstractPlugin.onModuleEvent | onModuleEvent}
1226
+ *
1227
+ * @extends AbstractPlugin
1228
+ * @see IUsageStorage - storage backend contract
1229
+ * @see IUsagePluginOptions - configuration options
1230
+ *
1231
+ * @example
1232
+ * ```ts
1233
+ * const plugin = new UsagePlugin({
1234
+ * strategy: 'memory',
1235
+ * trackCosts: true,
1236
+ * costRates: { 'gpt-4': { input: 0.03, output: 0.06 } },
1237
+ * });
1238
+ * await plugin.recordUsage({ provider: 'openai', model: 'gpt-4', ... });
1239
+ * ```
1240
+ */
1241
+ declare class UsagePlugin extends AbstractPlugin<IUsagePluginOptions, IUsagePluginStats> {
1242
+ name: string;
1243
+ version: string;
1244
+ private storage;
1245
+ private pluginOptions;
1246
+ private logger;
1247
+ private aggregationTimer?;
1248
+ constructor(options: IUsagePluginOptions);
1249
+ /**
1250
+ * Records usage statistics from module lifecycle events (completion and
1251
+ * error events). Duration-bearing events are recorded with zero token
1252
+ * counts as module events do not involve LLM calls.
1253
+ */
1254
+ onModuleEvent(eventName: TEventName, eventData: IEventEmitterEventData): Promise<void>;
1255
+ private recordModuleUsage;
1256
+ /**
1257
+ * Records a usage entry, calculating cost if cost tracking is enabled and
1258
+ * a rate is configured for the model.
1259
+ * @throws PluginError if the storage write fails
1260
+ */
1261
+ recordUsage(usage: Omit<IUsageStats, 'timestamp' | 'cost'>): Promise<void>;
1262
+ /**
1263
+ * Retrieves usage entries, optionally filtered by conversation and time range.
1264
+ * @throws PluginError if the storage read fails
1265
+ */
1266
+ getUsageStats(conversationId?: string, timeRange?: {
1267
+ start: Date;
1268
+ end: Date;
1269
+ }): Promise<IUsageStats[]>;
1270
+ /**
1271
+ * Returns aggregated totals (requests, tokens, cost, success rate) across
1272
+ * all recorded usage entries within the optional time range.
1273
+ * @throws PluginError if the storage aggregation fails
1274
+ */
1275
+ getAggregatedStats(timeRange?: {
1276
+ start: Date;
1277
+ end: Date;
1278
+ }): Promise<IAggregatedUsageStats>;
1279
+ clearStats(): Promise<void>;
1280
+ flush(): Promise<void>;
1281
+ /**
1282
+ * Stops the aggregation timer and closes the underlying storage.
1283
+ */
1284
+ destroy(): Promise<void>;
1285
+ private createStorage;
1286
+ private setupAggregation;
1287
+ }
1288
+ //#endregion
1289
+ //#region src/usage/aggregate-usage-stats.d.ts
1290
+ interface IUsageTimeRange {
1291
+ start: Date;
1292
+ end: Date;
1293
+ }
1294
+ /**
1295
+ * Aggregate usage statistics into a single summary object.
1296
+ * This is a shared SSOT utility (composition over inheritance).
1297
+ */
1298
+ declare function aggregateUsageStats(stats: readonly IUsageStats[], timeRange?: IUsageTimeRange): IAggregatedUsageStats;
1299
+ //#endregion
1300
+ //#region src/usage/storages/memory-storage.d.ts
1301
+ /**
1302
+ * Memory storage implementation for usage statistics
1303
+ */
1304
+ declare class MemoryUsageStorage implements IUsageStorage {
1305
+ private entries;
1306
+ private maxEntries;
1307
+ constructor(maxEntries?: number);
1308
+ save(entry: IUsageStats): Promise<void>;
1309
+ getStats(conversationId?: string, timeRange?: {
1310
+ start: Date;
1311
+ end: Date;
1312
+ }): Promise<IUsageStats[]>;
1313
+ getAggregatedStats(timeRange?: {
1314
+ start: Date;
1315
+ end: Date;
1316
+ }): Promise<IAggregatedUsageStats>;
1317
+ clear(): Promise<void>;
1318
+ flush(): Promise<void>;
1319
+ close(): Promise<void>;
1320
+ }
1321
+ //#endregion
1322
+ //#region src/usage/storages/file-storage.d.ts
1323
+ /**
1324
+ * File storage implementation for usage statistics
1325
+ */
1326
+ declare class FileUsageStorage implements IUsageStorage {
1327
+ private filePath;
1328
+ private logger;
1329
+ constructor(filePath: string);
1330
+ save(entry: IUsageStats): Promise<void>;
1331
+ getStats(conversationId?: string, timeRange?: {
1332
+ start: Date;
1333
+ end: Date;
1334
+ }): Promise<IUsageStats[]>;
1335
+ getAggregatedStats(timeRange?: {
1336
+ start: Date;
1337
+ end: Date;
1338
+ }): Promise<IAggregatedUsageStats>;
1339
+ clear(): Promise<void>;
1340
+ flush(): Promise<void>;
1341
+ close(): Promise<void>;
1342
+ }
1343
+ //#endregion
1344
+ //#region src/usage/storages/remote-storage.d.ts
1345
+ /**
1346
+ * Remote storage implementation for usage statistics with batching
1347
+ */
1348
+ declare class RemoteUsageStorage implements IUsageStorage {
1349
+ private apiUrl;
1350
+ private batchSize;
1351
+ private flushInterval;
1352
+ private batch;
1353
+ private timer?;
1354
+ private logger;
1355
+ constructor(apiUrl: string, _apiKey: string, _timeout: number, _headers?: Record<string, string>, batchSize?: number, flushInterval?: number);
1356
+ save(entry: IUsageStats): Promise<void>;
1357
+ getStats(conversationId?: string, timeRange?: {
1358
+ start: Date;
1359
+ end: Date;
1360
+ }): Promise<IUsageStats[]>;
1361
+ getAggregatedStats(timeRange?: {
1362
+ start: Date;
1363
+ end: Date;
1364
+ }): Promise<IAggregatedUsageStats>;
1365
+ clear(): Promise<void>;
1366
+ flush(): Promise<void>;
1367
+ close(): Promise<void>;
1368
+ }
1369
+ //#endregion
1370
+ //#region src/usage/storages/silent-storage.d.ts
1371
+ /**
1372
+ * Silent storage implementation for usage statistics (no-op)
1373
+ */
1374
+ declare class SilentUsageStorage implements IUsageStorage {
1375
+ save(_entry: IUsageStats): Promise<void>;
1376
+ getStats(_conversationId?: string, _timeRange?: {
1377
+ start: Date;
1378
+ end: Date;
1379
+ }): Promise<IUsageStats[]>;
1380
+ getAggregatedStats(_timeRange?: {
1381
+ start: Date;
1382
+ end: Date;
1383
+ }): Promise<IAggregatedUsageStats>;
1384
+ clear(): Promise<void>;
1385
+ flush(): Promise<void>;
1386
+ close(): Promise<void>;
1387
+ }
1388
+ //#endregion
1389
+ //#region src/webhook/types.d.ts
1390
+ /**
1391
+ * Webhook plugin type definitions
1392
+ * Clean separation of concerns with domain-specific types
1393
+ */
1394
+ type TWebhookEventName = TExecutionEventName | 'conversation.complete' | 'tool.executed' | 'error.occurred' | 'custom';
1395
+ /**
1396
+ * Base webhook context data
1397
+ */
1398
+ interface IWebhookContextData {
1399
+ executionId?: string | undefined;
1400
+ sessionId?: string | undefined;
1401
+ userId?: string | undefined;
1402
+ }
1403
+ /**
1404
+ * Execution result data for webhooks
1405
+ */
1406
+ interface IWebhookExecutionData {
1407
+ response?: string | undefined;
1408
+ duration?: number | undefined;
1409
+ tokensUsed?: number | undefined;
1410
+ toolsExecuted?: number | undefined;
1411
+ success?: boolean | undefined;
1412
+ }
1413
+ /**
1414
+ * Conversation result data for webhooks
1415
+ */
1416
+ interface IWebhookConversationData {
1417
+ response?: string | undefined;
1418
+ tokensUsed?: number | undefined;
1419
+ toolCalls?: IWebhookToolCallData[] | undefined;
1420
+ }
1421
+ /**
1422
+ * Tool call data for webhooks
1423
+ */
1424
+ interface IWebhookToolCallData {
1425
+ id: string;
1426
+ name: string;
1427
+ arguments: string;
1428
+ result: string;
1429
+ }
1430
+ /**
1431
+ * Tool execution data for webhooks
1432
+ */
1433
+ interface IWebhookToolData {
1434
+ name: string;
1435
+ id: string;
1436
+ success: boolean;
1437
+ duration?: number | undefined;
1438
+ result?: string | undefined;
1439
+ error?: string | undefined;
1440
+ }
1441
+ /**
1442
+ * Error data for webhooks
1443
+ */
1444
+ interface IWebhookErrorData {
1445
+ message: string;
1446
+ stack?: string | undefined;
1447
+ context?: Record<string, string | number | boolean> | undefined;
1448
+ type?: string | undefined;
1449
+ }
1450
+ /**
1451
+ * Complete webhook event data structure
1452
+ */
1453
+ interface IWebhookEventData extends IWebhookContextData {
1454
+ result?: IWebhookExecutionData | undefined;
1455
+ conversation?: IWebhookConversationData | undefined;
1456
+ tool?: IWebhookToolData | undefined;
1457
+ error?: IWebhookErrorData | undefined;
1458
+ }
1459
+ /**
1460
+ * Webhook metadata for additional context
1461
+ */
1462
+ type TWebhookMetadata = Record<string, string | number | boolean | Date | string[]>;
1463
+ /**
1464
+ * Webhook execution context (simplified from base types)
1465
+ */
1466
+ interface IWebhookExecutionContext {
1467
+ executionId?: string | undefined;
1468
+ sessionId?: string | undefined;
1469
+ userId?: string | undefined;
1470
+ }
1471
+ /**
1472
+ * Webhook execution result (simplified from base types)
1473
+ */
1474
+ interface IWebhookExecutionResult {
1475
+ response?: string | undefined;
1476
+ content?: string | undefined;
1477
+ duration?: number | undefined;
1478
+ tokensUsed?: number | undefined;
1479
+ toolsExecuted?: number | undefined;
1480
+ success?: boolean | undefined;
1481
+ usage?: {
1482
+ totalTokens?: number | undefined;
1483
+ } | undefined;
1484
+ toolCalls?: import('@robota-sdk/agent-core').IPluginExecutionResult['toolCalls'];
1485
+ results?: Array<{
1486
+ toolName?: string | undefined;
1487
+ toolId?: string | undefined;
1488
+ executionId?: string | undefined;
1489
+ error?: Error | undefined;
1490
+ duration?: number | undefined;
1491
+ result?: string | number | boolean | undefined;
1492
+ }> | undefined;
1493
+ error?: Error | undefined;
1494
+ }
1495
+ /**
1496
+ * Webhook payload structure
1497
+ */
1498
+ interface IWebhookPayload {
1499
+ event: TWebhookEventName;
1500
+ timestamp: string;
1501
+ executionId?: string;
1502
+ sessionId?: string;
1503
+ userId?: string;
1504
+ data: IWebhookEventData;
1505
+ metadata?: TWebhookMetadata;
1506
+ }
1507
+ /**
1508
+ * Webhook endpoint configuration
1509
+ */
1510
+ interface IWebhookEndpoint {
1511
+ url: string;
1512
+ headers?: Record<string, string>;
1513
+ events?: TWebhookEventName[];
1514
+ retries?: number;
1515
+ timeout?: number;
1516
+ secret?: string;
1517
+ }
1518
+ /**
1519
+ * Webhook plugin configuration options
1520
+ */
1521
+ interface IWebhookPluginOptions extends IPluginOptions {
1522
+ /** Webhook endpoints */
1523
+ endpoints: IWebhookEndpoint[];
1524
+ /** Events to send webhooks for */
1525
+ events?: TWebhookEventName[];
1526
+ /** Default timeout for webhook requests */
1527
+ defaultTimeout?: number;
1528
+ /** Default retry attempts */
1529
+ defaultRetries?: number;
1530
+ /** Whether to use async sending */
1531
+ async?: boolean;
1532
+ /** Maximum concurrent webhook requests */
1533
+ maxConcurrency?: number;
1534
+ /** Whether to batch webhook requests */
1535
+ batching?: {
1536
+ enabled: boolean;
1537
+ maxSize: number;
1538
+ flushInterval: number;
1539
+ };
1540
+ /** Custom payload transformer */
1541
+ payloadTransformer?: (event: TWebhookEventName, data: IWebhookEventData) => IWebhookEventData;
1542
+ }
1543
+ /**
1544
+ * Webhook plugin statistics
1545
+ */
1546
+ interface IWebhookPluginStats extends IPluginStats {
1547
+ endpointCount: number;
1548
+ queueLength: number;
1549
+ batchQueueLength: number;
1550
+ activeConcurrency: number;
1551
+ supportedEvents: TWebhookEventName[];
1552
+ totalSent: number;
1553
+ totalErrors: number;
1554
+ averageResponseTime: number;
1555
+ }
1556
+ /**
1557
+ * Internal webhook request structure
1558
+ */
1559
+ interface IWebhookRequest {
1560
+ endpoint: IWebhookEndpoint;
1561
+ payload: IWebhookPayload;
1562
+ attempt: number;
1563
+ timestamp: Date;
1564
+ }
1565
+ //#endregion
1566
+ //#region src/webhook/webhook-plugin.d.ts
1567
+ /**
1568
+ * Sends HTTP webhook notifications for agent execution lifecycle events.
1569
+ *
1570
+ * Routes events to configured {@link IWebhookEndpoint | endpoints} with
1571
+ * optional event filtering per endpoint. Supports asynchronous delivery with
1572
+ * configurable concurrency, automatic retries via {@link WebhookHttpClient},
1573
+ * and optional payload batching.
1574
+ *
1575
+ * Lifecycle hooks used: {@link AbstractPlugin.afterExecution | afterExecution},
1576
+ * {@link AbstractPlugin.afterConversation | afterConversation},
1577
+ * {@link AbstractPlugin.afterToolExecution | afterToolExecution},
1578
+ * {@link AbstractPlugin.onError | onError}
1579
+ *
1580
+ * @extends AbstractPlugin
1581
+ * @see IWebhookPluginOptions - configuration options
1582
+ * @see WebhookTransformer - payload transformation utilities
1583
+ * @see WebhookHttpClient - HTTP delivery client
1584
+ *
1585
+ * @example
1586
+ * ```ts
1587
+ * const plugin = new WebhookPlugin({
1588
+ * endpoints: [{ url: 'https://example.com/hook' }],
1589
+ * async: true,
1590
+ * maxConcurrency: 3,
1591
+ * });
1592
+ * ```
1593
+ */
1594
+ declare class WebhookPlugin extends AbstractPlugin<IWebhookPluginOptions, IWebhookPluginStats> {
1595
+ name: string;
1596
+ version: string;
1597
+ private pluginOptions;
1598
+ private logger;
1599
+ private queue;
1600
+ constructor(options: IWebhookPluginOptions);
1601
+ /**
1602
+ * Sends an execution-complete webhook after the agent finishes processing.
1603
+ */
1604
+ afterExecution(context: IPluginExecutionContext, result: IPluginExecutionResult): Promise<void>;
1605
+ /**
1606
+ * Sends a conversation-complete webhook after a conversation round finishes.
1607
+ */
1608
+ afterConversation(context: IPluginExecutionContext, result: IPluginExecutionResult): Promise<void>;
1609
+ /**
1610
+ * Sends a tool-executed webhook for each tool call in the result set.
1611
+ */
1612
+ afterToolExecution(context: IPluginExecutionContext, toolResults: IPluginExecutionResult): Promise<void>;
1613
+ /**
1614
+ * Sends both an error-occurred and execution-error webhook on failure.
1615
+ */
1616
+ onError(error: Error, context?: IPluginErrorContext): Promise<void>;
1617
+ /**
1618
+ * Builds a webhook payload and delivers it to all matching endpoints. When
1619
+ * batching is enabled, payloads are queued and flushed at the configured interval.
1620
+ */
1621
+ sendWebhook(event: TWebhookEventName, data: IWebhookEventData, metadata?: TWebhookMetadata): Promise<void>;
1622
+ /**
1623
+ * Sends a webhook with the `custom` event type.
1624
+ */
1625
+ sendCustomWebhook(data: IWebhookEventData, metadata?: TWebhookMetadata): Promise<void>;
1626
+ /**
1627
+ * Get webhook plugin statistics
1628
+ */
1629
+ getStats(): IWebhookPluginStats;
1630
+ /**
1631
+ * Clear webhook queue
1632
+ */
1633
+ clearQueue(): void;
1634
+ /**
1635
+ * Flushes pending batches, clears request queues, and stops the batch timer.
1636
+ */
1637
+ destroy(): Promise<void>;
1638
+ private getEndpointsForEvent;
1639
+ }
1640
+ //#endregion
1641
+ //#region src/webhook/transformer.d.ts
1642
+ /**
1643
+ * Webhook data transformer utility class
1644
+ */
1645
+ declare class WebhookTransformer {
1646
+ /**
1647
+ * Convert IPluginExecutionContext to WebhookExecutionContext
1648
+ */
1649
+ static contextToWebhook(context: IPluginExecutionContext): IWebhookExecutionContext;
1650
+ /**
1651
+ * Convert IPluginExecutionResult to WebhookExecutionResult
1652
+ */
1653
+ static resultToWebhook(result: IPluginExecutionResult): IWebhookExecutionResult;
1654
+ /**
1655
+ * Create execution event data
1656
+ */
1657
+ static createExecutionData(context: IWebhookExecutionContext, result: IWebhookExecutionResult): IWebhookEventData;
1658
+ /**
1659
+ * Create conversation event data
1660
+ */
1661
+ static createConversationData(context: IWebhookExecutionContext, result: IWebhookExecutionResult): IWebhookEventData;
1662
+ /**
1663
+ * Create tool execution event data
1664
+ *
1665
+ * REASON: Tool result structure varies by tool type and provider, needs flexible handling for webhook processing
1666
+ * ALTERNATIVES_CONSIDERED:
1667
+ * 1. Strict tool result interfaces (breaks tool compatibility)
1668
+ * 2. Union types (insufficient for dynamic tool results)
1669
+ * 3. Generic constraints (too complex for webhook processing)
1670
+ * 4. Interface definitions (too rigid for varied tool results)
1671
+ * 5. Type assertions (decreases type safety)
1672
+ * TODO: Consider standardized tool result interface across tools
1673
+ */
1674
+ static createToolData(context: IWebhookExecutionContext, toolResult: TLoggerData): IWebhookEventData;
1675
+ /**
1676
+ * Create error event data
1677
+ */
1678
+ static createErrorData(context: IWebhookExecutionContext, error: Error): IWebhookEventData;
1679
+ /**
1680
+ * Safely get property from object (handles index signature issues)
1681
+ *
1682
+ * REASON: Safe property access for webhook data transformation needs flexible input/output types
1683
+ * ALTERNATIVES_CONSIDERED:
1684
+ * 1. Strict object types (breaks dynamic property access)
1685
+ * 2. Union types (insufficient for property extraction)
1686
+ * 3. Generic constraints (too complex for simple property access)
1687
+ * 4. Interface definitions (too rigid for dynamic objects)
1688
+ * 5. Type assertions (decreases type safety)
1689
+ * TODO: Consider typed property access if patterns emerge
1690
+ */
1691
+ private static safeGetProperty;
1692
+ /**
1693
+ * Default payload transformer for webhook events
1694
+ */
1695
+ static defaultPayloadTransformer(_event: TWebhookEventName, data: IWebhookEventData): IWebhookEventData;
1696
+ }
1697
+ //#endregion
1698
+ //#region src/webhook/http-client.d.ts
1699
+ /**
1700
+ * HTTP client for webhook requests
1701
+ */
1702
+ declare class WebhookHttpClient {
1703
+ private logger;
1704
+ constructor(logger: ILogger);
1705
+ /**
1706
+ * Send a single webhook request with retries
1707
+ */
1708
+ sendRequest(request: IWebhookRequest): Promise<void>;
1709
+ /**
1710
+ * Generate HMAC signature for webhook security using jsSHA (browser compatible)
1711
+ */
1712
+ private generateSignature;
1713
+ /**
1714
+ * Make HTTP request with timeout support
1715
+ */
1716
+ private makeHttpRequest;
1717
+ /**
1718
+ * Delay utility for retry backoff
1719
+ */
1720
+ private delay;
1721
+ }
1722
+ //#endregion
1723
+ export { ConsoleLogFormatter, ConsoleLogStorage, ConversationHistoryPlugin, DatabaseHistoryStorage, ErrorHandlingPlugin, ExecutionAnalyticsPlugin, FileHistoryStorage, FileLogStorage, FileUsageStorage, type IAggregatedExecutionStats, type IAggregatedPerformanceStats, type IAggregatedUsageStats, type IConversationHistoryEntry, type IConversationHistoryPluginOptions, type IConversationHistoryPluginStats, type IErrorContextAdapter, type IErrorHandlingContextData, type IErrorHandlingPluginOptions, type IErrorHandlingPluginStats, type IExecutionAnalyticsContextData, type IExecutionAnalyticsOptions, type IExecutionAnalyticsPluginStats, type IExecutionStats, type IHistoryStorage, type ILimitWindow, type ILimitsPluginExecutionContext, type ILimitsPluginExecutionResult, type ILimitsPluginOptions, type ILogEntry, type ILogFormatter, type ILogStorage, type ILoggingPluginOptions, type ILoggingPluginStats, type IPerformanceMetrics, type IPerformancePluginOptions, type IPerformancePluginStats, type IPerformanceStorage, type ISystemMetricsCollector, type ITokenBucket, type IUsagePluginOptions, type IUsagePluginStats, type IUsageStats, type IUsageStorage, type IWebhookEndpoint, type IWebhookPayload, type IWebhookPluginOptions, JsonLogFormatter, LimitsPlugin, LoggingPlugin, MemoryHistoryStorage, MemoryPerformanceStorage, MemoryUsageStorage, NodeSystemMetricsCollector, PerformancePlugin, RemoteLogStorage, RemoteUsageStorage, SilentLogStorage, SilentUsageStorage, type TErrorHandlingStrategy, type THistoryStorageStrategy, type TLimitsStrategy, type TLogLevel, type TLoggingStrategy, type TPerformanceMonitoringStrategy, type TPluginLimitsStatusData, type TUsageTrackingStrategy, type TWebhookEventName, UsagePlugin, WebhookHttpClient, WebhookPlugin, WebhookTransformer, aggregateExecutionStats, aggregateUsageStats, createPluginErrorContext, toErrorContext };
1724
+ //# sourceMappingURL=index.d.ts.map