@robota-sdk/agent-plugin 3.0.0-beta.65 → 3.0.0-beta.66
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +92 -0
- package/dist/node/index.cjs +1 -1
- package/dist/node/index.d.ts +1 -1
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node/index.js +1 -1
- package/dist/node/index.js.map +1 -1
- package/package.json +4 -2
- package/src/conversation-history/conversation-history-helpers.ts +2 -0
- package/src/conversation-history/conversation-history-plugin.ts +8 -6
- package/src/conversation-history/storages/database-storage.ts +2 -1
- package/src/conversation-history/storages/file-storage.ts +2 -1
- package/src/error-handling/error-handling-helpers.ts +1 -0
- package/src/error-handling/error-handling-plugin.ts +15 -14
- package/src/execution-analytics/execution-analytics-plugin.ts +18 -7
- package/src/limits/limits-helpers.ts +2 -1
- package/src/limits/limits-plugin.ts +10 -8
- package/src/limits/validation.ts +1 -0
- package/src/logging/logging-helpers.ts +2 -0
- package/src/logging/logging-plugin.ts +10 -9
- package/src/logging/storages/console-storage.ts +4 -2
- package/src/logging/storages/file-storage.ts +4 -2
- package/src/logging/storages/remote-storage.ts +4 -2
- package/src/performance/collectors/system-metrics-collector.ts +2 -1
- package/src/performance/performance-helpers.ts +2 -0
- package/src/performance/performance-plugin.ts +9 -7
- package/src/performance/storages/memory-storage.ts +5 -1
- package/src/usage/storages/file-storage.ts +3 -1
- package/src/usage/storages/memory-storage.ts +2 -1
- package/src/usage/storages/remote-storage.ts +3 -1
- package/src/usage/storages/silent-storage.ts +2 -1
- package/src/usage/usage-plugin-helpers.ts +1 -0
- package/src/usage/usage-plugin.ts +9 -7
- package/src/webhook/http-client.ts +1 -0
- package/src/webhook/transformer.ts +6 -6
- package/src/webhook/types.ts +7 -4
- package/src/webhook/webhook-helpers.ts +1 -0
- package/src/webhook/webhook-plugin.ts +2 -1
- package/src/webhook/webhook-queue.ts +2 -1
package/README.md
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# Agent Plugin
|
|
2
|
+
|
|
3
|
+
Consolidated plugin package providing 8 official plugin implementations for the Robota SDK.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @robota-sdk/agent-plugin
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Available Plugins
|
|
12
|
+
|
|
13
|
+
| Plugin | Purpose |
|
|
14
|
+
| --------------------------- | ---------------------------------------------------------- |
|
|
15
|
+
| `ConversationHistoryPlugin` | Persistent conversation history (Memory / File / Database) |
|
|
16
|
+
| `ErrorHandlingPlugin` | Error recovery and retry strategies |
|
|
17
|
+
| `ExecutionAnalyticsPlugin` | Execution metrics and analytics aggregation |
|
|
18
|
+
| `LimitsPlugin` | Rate limiting and quota enforcement |
|
|
19
|
+
| `LoggingPlugin` | Multi-backend logging (Console / File / Remote / Silent) |
|
|
20
|
+
| `PerformancePlugin` | System performance metrics collection |
|
|
21
|
+
| `UsagePlugin` | Token usage and cost tracking (Memory / File / Remote) |
|
|
22
|
+
| `WebhookPlugin` | HTTP webhook notifications with HMAC signing |
|
|
23
|
+
|
|
24
|
+
## Quick Start
|
|
25
|
+
|
|
26
|
+
```typescript
|
|
27
|
+
import { Robota } from '@robota-sdk/agent-core';
|
|
28
|
+
import { ConversationHistoryPlugin, LoggingPlugin, UsagePlugin } from '@robota-sdk/agent-plugin';
|
|
29
|
+
|
|
30
|
+
const agent = new Robota({
|
|
31
|
+
// ...provider config...
|
|
32
|
+
plugins: [
|
|
33
|
+
new ConversationHistoryPlugin({ storage: 'memory' }),
|
|
34
|
+
new LoggingPlugin({ backend: 'console', level: 'info' }),
|
|
35
|
+
new UsagePlugin({ storage: 'memory' }),
|
|
36
|
+
],
|
|
37
|
+
});
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Plugin Reference
|
|
41
|
+
|
|
42
|
+
### ConversationHistoryPlugin
|
|
43
|
+
|
|
44
|
+
Persists conversation history across sessions.
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
new ConversationHistoryPlugin({ storage: 'memory' | 'file' | 'database' });
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### LoggingPlugin
|
|
51
|
+
|
|
52
|
+
Logs agent activity to one or more backends.
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
new LoggingPlugin({
|
|
56
|
+
backend: 'console' | 'file' | 'remote' | 'silent',
|
|
57
|
+
level: 'info' | 'debug' | 'warn' | 'error',
|
|
58
|
+
});
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### UsagePlugin
|
|
62
|
+
|
|
63
|
+
Tracks token usage and estimates cost.
|
|
64
|
+
|
|
65
|
+
```typescript
|
|
66
|
+
new UsagePlugin({ storage: 'memory' | 'file' | 'remote' | 'silent' });
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### LimitsPlugin
|
|
70
|
+
|
|
71
|
+
Enforces rate limits and usage quotas.
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
new LimitsPlugin({ maxTokensPerMinute: 100000, maxRequestsPerMinute: 60 });
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### WebhookPlugin
|
|
78
|
+
|
|
79
|
+
Fires HTTP webhooks on agent lifecycle events with optional HMAC signing.
|
|
80
|
+
|
|
81
|
+
```typescript
|
|
82
|
+
new WebhookPlugin({ url: 'https://example.com/hook', secret: 'my-secret' });
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Dependencies
|
|
86
|
+
|
|
87
|
+
- `@robota-sdk/agent-core` — plugin interface, core types
|
|
88
|
+
|
|
89
|
+
## Links
|
|
90
|
+
|
|
91
|
+
- [npm](https://www.npmjs.com/package/@robota-sdk/agent-plugin)
|
|
92
|
+
- [GitHub](https://github.com/woojubb/robota)
|
package/dist/node/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require(`@robota-sdk/agent-core`),l=require(`jssha`);l=s(l,1);var u=class{conversations=new Map;maxConversations;constructor(e=100){this.maxConversations=e}async save(e,t){if(this.conversations.size>=this.maxConversations&&!this.conversations.has(e)){let e=this.conversations.keys().next().value;e&&this.conversations.delete(e)}this.conversations.set(e,{...t})}async load(e){return this.conversations.get(e)}async list(){return Array.from(this.conversations.keys())}async delete(e){return this.conversations.delete(e)}async clear(){this.conversations.clear()}},d=class{filePath;logger;constructor(e){this.filePath=e,this.logger=(0,c.createLogger)(`FileHistoryStorage`)}async save(e,t){try{this.logger.warn(`File storage not fully implemented yet`,{conversationId:e,filePath:this.filePath})}catch(t){throw new c.StorageError(`Failed to save conversation to file`,{conversationId:e,filePath:this.filePath,error:t instanceof Error?t.message:String(t)})}}async load(e){try{this.logger.warn(`File storage not fully implemented yet`,{conversationId:e,filePath:this.filePath});return}catch(t){throw new c.StorageError(`Failed to load conversation from file`,{conversationId:e,filePath:this.filePath,error:t instanceof Error?t.message:String(t)})}}async list(){try{return this.logger.warn(`File storage not fully implemented yet`,{filePath:this.filePath}),[]}catch(e){throw new c.StorageError(`Failed to list conversations from file`,{filePath:this.filePath,error:e instanceof Error?e.message:String(e)})}}async delete(e){try{return this.logger.warn(`File storage not fully implemented yet`,{conversationId:e,filePath:this.filePath}),!1}catch(t){throw new c.StorageError(`Failed to delete conversation from file`,{conversationId:e,filePath:this.filePath,error:t instanceof Error?t.message:String(t)})}}async clear(){try{this.logger.warn(`File storage not fully implemented yet`,{filePath:this.filePath})}catch(e){throw new c.StorageError(`Failed to clear conversations from file`,{filePath:this.filePath,error:e instanceof Error?e.message:String(e)})}}},f=class{connectionString;logger;constructor(e){this.connectionString=e,this.logger=(0,c.createLogger)(`DatabaseHistoryStorage`)}async save(e,t){try{this.logger.warn(`Database storage not fully implemented yet`,{conversationId:e,connectionString:this.maskConnectionString()})}catch(t){throw new c.StorageError(`Failed to save conversation to database`,{conversationId:e,error:t instanceof Error?t.message:String(t)})}}async load(e){try{this.logger.warn(`Database storage not fully implemented yet`,{conversationId:e,connectionString:this.maskConnectionString()});return}catch(t){throw new c.StorageError(`Failed to load conversation from database`,{conversationId:e,error:t instanceof Error?t.message:String(t)})}}async list(){try{return this.logger.warn(`Database storage not fully implemented yet`,{connectionString:this.maskConnectionString()}),[]}catch(e){throw new c.StorageError(`Failed to list conversations from database`,{error:e instanceof Error?e.message:String(e)})}}async delete(e){try{return this.logger.warn(`Database storage not fully implemented yet`,{conversationId:e,connectionString:this.maskConnectionString()}),!1}catch(t){throw new c.StorageError(`Failed to delete conversation from database`,{conversationId:e,error:t instanceof Error?t.message:String(t)})}}async clear(){try{this.logger.warn(`Database storage not fully implemented yet`,{connectionString:this.maskConnectionString()})}catch(e){throw new c.StorageError(`Failed to clear conversations from database`,{error:e instanceof Error?e.message:String(e)})}}maskConnectionString(){return this.connectionString.replace(/(:\/\/[^:]+:)[^@]+(@)/,`$1***$2`)}};function ee(e){if(!e.storage)throw new c.ConfigurationError(`Storage strategy is required`);if(![`memory`,`file`,`database`].includes(e.storage))throw new c.ConfigurationError(`Invalid storage strategy`,{validStrategies:[`memory`,`file`,`database`],provided:e.storage});if(e.storage===`file`&&!e.filePath)throw new c.ConfigurationError(`File path is required for file storage strategy`);if(e.storage===`database`&&!e.connectionString)throw new c.ConfigurationError(`Connection string is required for database storage strategy`);if(e.maxConversations!==void 0&&e.maxConversations<=0)throw new c.ConfigurationError(`Max conversations must be positive`);if(e.maxMessagesPerConversation!==void 0&&e.maxMessagesPerConversation<=0)throw new c.ConfigurationError(`Max messages per conversation must be positive`)}async function p(e,t,n,r){try{let n=await e.load(t);return r.debug(`Loaded conversation`,{conversationId:t,found:!!n,messageCount:n?.messages.length??0}),n}catch(e){throw new c.PluginError(`Failed to load conversation`,n,{conversationId:t,error:e instanceof Error?e.message:String(e)})}}async function te(e,t,n,r){if(t.size===0)return;let i=Array.from(t);r.debug(`Saving pending conversations`,{count:i.length});for(let n of i)try{let r=await e.load(n);r&&await e.save(n,r),t.delete(n)}catch(e){r.error(`Failed to save pending conversation`,{conversationId:n,error:e instanceof Error?e.message:String(e)})}}function m(e,t,n,r){switch(e){case`memory`:return new u(t);case`file`:return new d(n);case`database`:return new f(r);default:throw new c.ConfigurationError(`Unknown storage strategy`,{strategy:e})}}var ne=class extends c.AbstractPlugin{name=`ConversationHistoryPlugin`;version=`1.0.0`;storage;pluginOptions;logger;currentConversationId;batchSaveTimer;pendingSaves=new Set;constructor(e){super(),this.logger=(0,c.createLogger)(`ConversationHistoryPlugin`),this.category=c.PluginCategory.STORAGE,this.priority=c.PluginPriority.HIGH,ee(e),this.pluginOptions={enabled:e.enabled??!0,storage:e.storage,maxConversations:e.maxConversations??100,maxMessagesPerConversation:e.maxMessagesPerConversation??1e3,filePath:e.filePath??`./conversations.json`,connectionString:e.connectionString??``,autoSave:e.autoSave??!0,saveInterval:e.saveInterval??3e4,category:e.category??c.PluginCategory.STORAGE,priority:e.priority??c.PluginPriority.HIGH,moduleEvents:e.moduleEvents??[],subscribeToAllModuleEvents:e.subscribeToAllModuleEvents??!1},this.storage=m(this.pluginOptions.storage,this.pluginOptions.maxConversations,this.pluginOptions.filePath,this.pluginOptions.connectionString),this.pluginOptions.autoSave||this.setupBatchSaving(),this.logger.info(`ConversationHistoryPlugin initialized`,{storage:this.pluginOptions.storage,maxConversations:this.pluginOptions.maxConversations,autoSave:this.pluginOptions.autoSave})}async startConversation(e){try{this.currentConversationId=e;let t={conversationId:e,messages:[],startTime:new Date,lastUpdated:new Date,metadata:{}};await this.storage.save(e,t),this.pluginOptions.autoSave||this.pendingSaves.add(e),this.logger.debug(`Started new conversation`,{conversationId:e})}catch(t){throw new c.PluginError(`Failed to start conversation`,this.name,{conversationId:e,error:t instanceof Error?t.message:String(t)})}}async addMessage(e){if(!this.currentConversationId)throw new c.PluginError(`No active conversation`,this.name);try{let t=await this.storage.load(this.currentConversationId)||{conversationId:this.currentConversationId,messages:[],startTime:new Date,lastUpdated:new Date,metadata:{}};t.messages.push(e),t.messages.length>this.pluginOptions.maxMessagesPerConversation&&(t.messages=t.messages.slice(-this.pluginOptions.maxMessagesPerConversation)),t.lastUpdated=new Date,await this.storage.save(this.currentConversationId,t),this.pluginOptions.autoSave||this.pendingSaves.add(this.currentConversationId),this.logger.debug(`Added message to conversation`,{conversationId:this.currentConversationId,messageRole:e.role,messageLength:e.content?.length??0})}catch(e){throw new c.PluginError(`Failed to add message to conversation`,this.name,{conversationId:this.currentConversationId,error:e instanceof Error?e.message:String(e)})}}async loadConversation(e){return p(this.storage,e,this.name,this.logger)}async getHistory(e){return(await this.loadConversation(e))?.messages??[]}async listConversations(){try{return await this.storage.list()}catch(e){throw new c.PluginError(`Failed to list conversations`,this.name,{error:e instanceof Error?e.message:String(e)})}}async deleteConversation(e){try{let t=await this.storage.delete(e);return this.pendingSaves.delete(e),this.logger.debug(`Deleted conversation`,{conversationId:e,deleted:t}),t}catch(t){throw new c.PluginError(`Failed to delete conversation`,this.name,{conversationId:e,error:t instanceof Error?t.message:String(t)})}}async clearAllConversations(){try{await this.storage.clear(),this.pendingSaves.clear(),this.logger.info(`Cleared all conversations`)}catch(e){throw new c.PluginError(`Failed to clear conversations`,this.name,{error:e instanceof Error?e.message:String(e)})}}async savePending(){await te(this.storage,this.pendingSaves,this.name,this.logger)}async destroy(){try{(0,c.stopPeriodicTask)(this.batchSaveTimer),this.batchSaveTimer=void 0,await this.savePending(),this.logger.info(`ConversationHistoryPlugin destroyed`)}catch(e){this.logger.error(`Error during plugin cleanup`,{error:e instanceof Error?e.message:String(e)})}}setupBatchSaving(){this.batchSaveTimer=(0,c.startPeriodicTask)(this.logger,{name:`ConversationHistoryPlugin.savePending`,intervalMs:this.pluginOptions.saveInterval},async()=>{await this.savePending()})}};function h(e){return{...e.executionId&&{executionId:e.executionId},...e.sessionId&&{sessionId:e.sessionId},...e.userId&&{userId:e.userId},...e.attempt!==void 0&&{attempt:e.attempt},...e.originalError&&{originalError:e.originalError}}}function g(e,t){return{...h(e),...t&&{...t}}}function re(e){if(!e.strategy)throw new c.ConfigurationError(`Error handling strategy is required`);if(![`simple`,`circuit-breaker`,`exponential-backoff`,`silent`].includes(e.strategy))throw new c.ConfigurationError(`Invalid error handling strategy`,{validStrategies:[`simple`,`circuit-breaker`,`exponential-backoff`,`silent`],provided:e.strategy});if(e.maxRetries!==void 0&&e.maxRetries<0)throw new c.ConfigurationError(`Max retries must be non-negative`);if(e.retryDelay!==void 0&&e.retryDelay<=0)throw new c.ConfigurationError(`Retry delay must be positive`)}function ie(e,t,n){return e===`exponential-backoff`?t*2**(n-1):t}function ae(e,t,n){return e?Date.now()-t>n?{open:!1,shouldReset:!0}:{open:!0,shouldReset:!1}:{open:!1,shouldReset:!1}}function oe(e){return new Promise(t=>setTimeout(t,e))}var _=class extends c.AbstractPlugin{name=`ErrorHandlingPlugin`;version=`1.0.0`;pluginOptions;logger;failureCount=0;circuitBreakerOpen=!1;lastFailureTime=0;constructor(e){super(),this.logger=(0,c.createLogger)(`ErrorHandlingPlugin`),re(e),this.pluginOptions={enabled:e.enabled??!0,strategy:e.strategy,maxRetries:e.maxRetries??3,retryDelay:e.retryDelay??1e3,logErrors:e.logErrors??!0,failureThreshold:e.failureThreshold??5,circuitBreakerTimeout:e.circuitBreakerTimeout??6e4,category:e.category??c.PluginCategory.ERROR_HANDLING,priority:e.priority??c.PluginPriority.HIGH,moduleEvents:e.moduleEvents??[],subscribeToAllModuleEvents:e.subscribeToAllModuleEvents??!1,...e.customErrorHandler&&{customErrorHandler:e.customErrorHandler}},this.logger.info(`ErrorHandlingPlugin initialized`,{strategy:this.pluginOptions.strategy,maxRetries:this.pluginOptions.maxRetries,failureThreshold:this.pluginOptions.failureThreshold})}async handleError(e,t={}){if(this.pluginOptions.logErrors&&this.logger.error(`Error occurred`,{error:e.message,stack:e.stack,context:t}),this.pluginOptions.customErrorHandler)try{await this.pluginOptions.customErrorHandler(e,t);return}catch(e){this.logger.error(`Custom error handler failed`,{handlerError:e instanceof Error?e.message:String(e)})}switch(this.pluginOptions.strategy){case`circuit-breaker`:await this.handleCircuitBreaker(e,t);break;case`exponential-backoff`:await this.handleExponentialBackoff(e,t);break;case`simple`:await this.handleSimple(e,t);break;case`silent`:break}}async executeWithRetry(e,t={}){let n,r=0;for(;r<=this.pluginOptions.maxRetries;)try{if(this.pluginOptions.strategy===`circuit-breaker`){let e=ae(this.circuitBreakerOpen,this.lastFailureTime,this.pluginOptions.circuitBreakerTimeout);if(e.shouldReset&&(this.circuitBreakerOpen=!1,this.failureCount=0,this.logger.info(`Circuit breaker timeout passed, attempting to close`)),e.open)throw new c.PluginError(`Circuit breaker is open`,this.name,h(t))}let n=await e();return r>0&&(this.failureCount=0,this.circuitBreakerOpen=!1,this.logger.info(`Operation succeeded after retry`,{attempt:r,context:t})),n}catch(e){if(n=e instanceof Error?e:Error(String(e)),r++,r<=this.pluginOptions.maxRetries){await this.handleError(n,{...t,attempt:r});let e=ie(this.pluginOptions.strategy,this.pluginOptions.retryDelay,r);this.logger.debug(`Retrying operation`,{attempt:r,delay:e,context:t}),await oe(e)}else await this.handleError(n,{...t,finalAttempt:!0})}throw new c.PluginError(`Operation failed after ${this.pluginOptions.maxRetries} retries`,this.name,g(t,{originalError:n?.message||`Unknown error`}))}resetCircuitBreaker(){this.failureCount=0,this.circuitBreakerOpen=!1,this.lastFailureTime=0,this.logger.info(`Circuit breaker reset`)}getStats(){return{...super.getStats(),failureCount:this.failureCount,circuitBreakerOpen:this.circuitBreakerOpen,lastFailureTime:this.lastFailureTime,totalRetries:0,successfulRecoveries:0}}async destroy(){this.logger.info(`ErrorHandlingPlugin destroyed`)}async handleSimple(e,t){this.logger.debug(`Simple error handling applied`,{error:e.message,context:t})}async handleCircuitBreaker(e,t){this.failureCount++,this.lastFailureTime=Date.now(),this.failureCount>=this.pluginOptions.failureThreshold&&(this.circuitBreakerOpen=!0,this.logger.warn(`Circuit breaker opened`,{failureCount:this.failureCount,threshold:this.pluginOptions.failureThreshold,context:t}))}async handleExponentialBackoff(e,t){this.failureCount++,this.logger.debug(`Exponential backoff error handling applied`,{error:e.message,failureCount:this.failureCount,context:t})}};function v(e,t){if(e.length===0)return{totalExecutions:0,successfulExecutions:0,failedExecutions:0,successRate:0,averageDuration:0,totalDuration:0,operationStats:{},errorStats:{},timeRange:t||{start:new Date,end:new Date}};let n=e.length,r=e.filter(e=>e.success).length,i=n-r,a=e.reduce((e,t)=>e+t.duration,0),o=a/n,s={};for(let t of e){s[t.operation]||(s[t.operation]={count:0,successCount:0,failureCount:0,totalDuration:0,averageDuration:0});let e=s[t.operation];e&&(e.count++,e.totalDuration+=t.duration,t.success?e.successCount++:e.failureCount++)}for(let e in s){let t=s[e];t&&t.count>0&&(t.averageDuration=t.totalDuration/t.count)}let c={};for(let t of e.filter(e=>!e.success&&e.error)){let e=t.error.type;c[e]=(c[e]||0)+1}return{totalExecutions:n,successfulExecutions:r,failedExecutions:i,successRate:n>0?r/n:0,averageDuration:o,totalDuration:a,operationStats:s,errorStats:c,timeRange:t||{start:e[0]?.startTime||new Date,end:e[e.length-1]?.endTime||new Date}}}function se(e,t){e.maxEntries!==void 0&&e.maxEntries<1&&(t.maxEntries=1e3),e.performanceThreshold!==void 0&&e.performanceThreshold<0&&(t.performanceThreshold=5e3)}function y(e,t){return`${e}-${Date.now()}-${t}`}function b(e,t,n,r,i){let a=Date.now()-t.startTime,o=r?{message:n.message,...n.stack&&{stack:n.stack},type:n.constructor.name}:void 0;return{executionId:e,operation:t.operation,startTime:new Date(t.startTime),endTime:new Date,duration:a,success:!1,...o&&{error:o},metadata:{errorSource:`onError-hook`,contextType:i?typeof i:`none`,hasContext:!!i}}}function x(e,t,n){for(let[r,i]of e.entries())if(i.operation===t){if(t===`run`&&n&&i.input!==n)continue;return{executionId:r,executionData:i}}}var S=class extends c.AbstractPlugin{name=`ExecutionAnalyticsPlugin`;version=`1.0.0`;pluginOptions;logger;activeExecutions=new Map;executionHistory=[];executionCounter=0;initialized=!1;constructor(e={}){super(),this.category=c.PluginCategory.MONITORING,this.priority=c.PluginPriority.NORMAL,this.pluginOptions={enabled:e.enabled??!0,maxEntries:e.maxEntries||1e3,trackErrors:e.trackErrors??!0,performanceThreshold:e.performanceThreshold||5e3,enableWarnings:e.enableWarnings??!0,category:e.category??c.PluginCategory.MONITORING,priority:e.priority??c.PluginPriority.NORMAL,moduleEvents:e.moduleEvents??[],subscribeToAllModuleEvents:e.subscribeToAllModuleEvents??!1},se(e,this.pluginOptions),this.logger=(0,c.createLogger)(`ExecutionAnalyticsPlugin`),this.beforeRun=this.beforeRun.bind(this),this.afterRun=this.afterRun.bind(this),this.beforeProviderCall=this.beforeProviderCall.bind(this),this.afterProviderCall=this.afterProviderCall.bind(this),this.initialized=!0}beforeRun=async(e,t)=>{this.activeExecutions.set(y(`exec`,++this.executionCounter),{startTime:Date.now(),operation:`run`,input:e.substring(0,100)})};afterRun=async(e,t,n)=>{let r=x(this.activeExecutions,`run`,e);if(!r)return;let{executionId:i,executionData:a}=r,o=Date.now()-a.startTime;this.recordStats({executionId:i,operation:`run`,startTime:new Date(a.startTime),endTime:new Date,duration:o,success:!0,metadata:{inputLength:e.length,responseLength:t.length,hasOptions:!!n,modelName:String(n?.metadata?.model||`unknown`)}}),this.activeExecutions.delete(i),this.pluginOptions.enableWarnings&&o>this.pluginOptions.performanceThreshold&&this.logger.warn(`Slow run execution detected`,{executionId:i,duration:o,threshold:this.pluginOptions.performanceThreshold})};beforeProviderCall=async e=>{this.activeExecutions.set(y(`provider`,++this.executionCounter),{startTime:Date.now(),operation:`provider-call`,input:e[0]?.content||`N/A`})};afterProviderCall=async(e,t)=>{let n=x(this.activeExecutions,`provider-call`,e[0]?.content||``);if(!n)return;let{executionId:r,executionData:i}=n,a=Date.now()-i.startTime;this.recordStats({executionId:r,operation:`provider-call`,startTime:new Date(i.startTime),endTime:new Date,duration:a,success:!0,metadata:{inputLength:e[0]?.content?.length||0,responseLength:t.content?.length||0,hasToolCalls:!!((0,c.isAssistantMessage)(t)&&t.toolCalls&&t.toolCalls.length>0),toolCallCount:(0,c.isAssistantMessage)(t)&&t.toolCalls?t.toolCalls.length:0}}),this.activeExecutions.delete(r),this.pluginOptions.enableWarnings&&a>this.pluginOptions.performanceThreshold&&this.logger.warn(`Slow provider call detected`,{executionId:r,duration:a,threshold:this.pluginOptions.performanceThreshold})};async beforeToolCall(e,t){this.activeExecutions.set(y(`tool`,++this.executionCounter),{startTime:Date.now(),operation:`tool-call`,input:e})}async afterToolCall(e,t,n){let r=x(this.activeExecutions,`tool-call`,e);if(!r)return;let{executionId:i,executionData:a}=r,o=Date.now()-a.startTime,s=!n?.error,c=n?.error&&this.pluginOptions.trackErrors?{message:String(n.error),type:`ToolExecutionError`}:void 0;this.recordStats({executionId:i,operation:`tool-call`,startTime:new Date(a.startTime),endTime:new Date,duration:o,success:s,...c&&{error:c},metadata:{toolName:e,parameterCount:Object.keys(t).length,resultType:typeof n,hasError:!!n?.error}}),this.activeExecutions.delete(i)}async onError(e,t){let n=Array.from(this.activeExecutions.entries())[0];if(n){let[r,i]=n;this.recordStats(b(r,i,e,this.pluginOptions.trackErrors,t)),this.activeExecutions.delete(r)}}getExecutionStats(e,t){let n=this.executionHistory;return e&&(n=n.filter(t=>t.operation===e)),t&&(n=n.filter(e=>e.startTime>=t.start&&e.startTime<=t.end)),[...n]}getAggregatedStats(e){return v(this.getExecutionStats(void 0,e),e)}clearStats(){this.executionHistory=[],this.activeExecutions.clear(),this.executionCounter=0}getActiveExecutions(){let e=Date.now();return Array.from(this.activeExecutions.entries()).map(([t,n])=>({executionId:t,operation:n.operation,duration:e-n.startTime}))}getPluginStats(){let e=this.executionHistory[0],t=this.executionHistory[this.executionHistory.length-1];return{totalRecorded:this.executionHistory.length,activeExecutions:this.activeExecutions.size,memoryUsage:this.executionHistory.length+this.activeExecutions.size,...e&&{oldestRecord:e.startTime},...t&&{newestRecord:t.endTime}}}async destroy(){this.clearStats()}getExecutionData(){return[...this.executionHistory]}getAnalyticsStats(){return this.getAggregatedStats()}clearExecutionData(){this.clearStats()}getStatus(){return{name:this.name,version:this.version,enabled:this.enabled,initialized:this.initialized,category:this.category,priority:this.priority,subscribedEventsCount:this.subscribedEvents.length,hasEventEmitter:!!this.eventEmitter}}getStats(){let e=this.executionHistory[this.executionHistory.length-1],t=this.executionHistory[0];return{enabled:this.enabled,calls:this.executionHistory.length,errors:this.executionHistory.filter(e=>!e.success).length,...e?.endTime&&{lastActivity:e.endTime},totalRecorded:this.executionHistory.length,activeExecutions:this.activeExecutions.size,memoryUsage:this.executionHistory.length+this.activeExecutions.size,...t&&{oldestRecord:t.startTime},...e&&{newestRecord:e.endTime}}}recordStats(e){this.executionHistory.push(e),this.executionHistory.length>this.pluginOptions.maxEntries&&this.executionHistory.shift()}};function C(e,t,n){if(e.strategy===`none`){n.info(`LimitsPlugin configured with "none" strategy - no rate limiting will be applied`);return}if(!e.strategy)throw new c.PluginError(`Strategy must be specified for limits plugin. Use "none" to disable rate limiting, or choose from: token-bucket, sliding-window, fixed-window`,t,{availableStrategies:[`none`,`token-bucket`,`sliding-window`,`fixed-window`]});let r=[`none`,`token-bucket`,`sliding-window`,`fixed-window`];if(!r.includes(e.strategy))throw new c.PluginError(`Invalid strategy "${e.strategy}". Must be one of: ${r.join(`, `)}`,t,{provided:e.strategy,validStrategies:r});if(e.strategy===`token-bucket`){if(e.bucketSize!==void 0&&e.bucketSize<=0)throw new c.PluginError(`Bucket size must be positive for token-bucket strategy`,t,{strategy:e.strategy,bucketSize:e.bucketSize});if(e.refillRate!==void 0&&e.refillRate<0)throw new c.PluginError(`Refill rate must be non-negative for token-bucket strategy`,t,{strategy:e.strategy,refillRate:e.refillRate})}if([`sliding-window`,`fixed-window`].includes(e.strategy)&&e.timeWindow!==void 0&&e.timeWindow<=0)throw new c.PluginError(`Time window must be positive for ${e.strategy} strategy`,t,{strategy:e.strategy,timeWindow:e.timeWindow});if(e.maxRequests!==void 0&&e.maxRequests<0)throw new c.PluginError(`Max requests must be non-negative`,t,{strategy:e.strategy,maxRequests:e.maxRequests});if(e.maxTokens!==void 0&&e.maxTokens<0)throw new c.PluginError(`Max tokens must be non-negative`,t,{strategy:e.strategy,maxTokens:e.maxTokens});if(e.maxCost!==void 0&&e.maxCost<0)throw new c.PluginError(`Max cost must be non-negative`,t,{strategy:e.strategy,maxCost:e.maxCost});if(e.tokenCostPer1000!==void 0&&e.tokenCostPer1000<0)throw new c.PluginError(`Token cost per 1000 must be non-negative`,t,{strategy:e.strategy,tokenCostPer1000:e.tokenCostPer1000})}const ce={"gpt-4":.03,"gpt-4-turbo":.01,"gpt-3.5-turbo":.002,"claude-3-opus":.015,"claude-3-sonnet":.003,"claude-3-haiku":25e-5};function le(e,t,n){return e/1e3*(ce[t]??n)}function ue(e){return Math.ceil(e.reduce((e,t)=>e+(t.content?.length||0),0)/4)+100}function de(e,t,n,r,i,a){let o=(t-e.lastRefill)/1e3;if(e.tokens=Math.min(i.bucketSize,e.tokens+o*i.refillRate),e.lastRefill=t,e.tokens<n)throw new c.PluginError(`Token bucket depleted. Available: ${Math.floor(e.tokens)}, Required: ${n}`,a,{availableTokens:e.tokens,requiredTokens:n});if(t-e.windowStart>=i.timeWindow&&(e.requests=0,e.cost=0,e.windowStart=t),e.requests>=i.maxRequests)throw new c.PluginError(`Request limit exceeded. Max: ${i.maxRequests}`,a,{currentRequests:e.requests,maxRequests:i.maxRequests});if(e.cost+r>i.maxCost)throw new c.PluginError(`Cost limit exceeded. Current: $${e.cost.toFixed(4)}, Estimated: $${r.toFixed(4)}, Max: $${i.maxCost}`,a,{currentCost:e.cost,estimatedCost:r,maxCost:i.maxCost});e.tokens-=n,e.requests++}function fe(e,t,n,r,i,a){if(t-e.windowStart<i.timeWindow){if(e.tokens+n>i.maxTokens)throw new c.PluginError(`Token limit exceeded in sliding window. Current: ${e.tokens}, Estimated: ${n}, Max: ${i.maxTokens}`,a,{currentTokens:e.tokens,estimatedTokens:n,maxTokens:i.maxTokens});if(e.count>=i.maxRequests)throw new c.PluginError(`Request limit exceeded in sliding window. Current: ${e.count}, Max: ${i.maxRequests}`,a,{currentRequests:e.count,maxRequests:i.maxRequests});if(e.cost+r>i.maxCost)throw new c.PluginError(`Cost limit exceeded in sliding window. Current: $${e.cost.toFixed(4)}, Estimated: $${r.toFixed(4)}, Max: $${i.maxCost}`,a,{currentCost:e.cost,estimatedCost:r,maxCost:i.maxCost})}else e.count=0,e.tokens=0,e.cost=0,e.windowStart=t;e.count++}function pe(e,t,n,r,i,a){if(t-e.windowStart>=i.timeWindow&&(e.count=0,e.tokens=0,e.cost=0,e.windowStart=t),e.tokens+n>i.maxTokens)throw new c.PluginError(`Token limit exceeded in fixed window. Current: ${e.tokens}, Estimated: ${n}, Max: ${i.maxTokens}`,a,{currentTokens:e.tokens,estimatedTokens:n,maxTokens:i.maxTokens});if(e.count>=i.maxRequests)throw new c.PluginError(`Request limit exceeded in fixed window. Current: ${e.count}, Max: ${i.maxRequests}`,a,{currentRequests:e.count,maxRequests:i.maxRequests});if(e.cost+r>i.maxCost)throw new c.PluginError(`Cost limit exceeded in fixed window. Current: $${e.cost.toFixed(4)}, Estimated: $${r.toFixed(4)}, Max: $${i.maxCost}`,a,{currentCost:e.cost,estimatedCost:r,maxCost:i.maxCost});e.count++}var me=class extends c.AbstractPlugin{name=`LimitsPlugin`;version=`1.0.0`;pluginOptions;logger;windows=new Map;buckets=new Map;constructor(e){super(),this.logger=(0,c.createLogger)(`LimitsPlugin`),C(e,this.name,this.logger),this.pluginOptions={enabled:e.enabled??!0,strategy:e.strategy,maxTokens:e.maxTokens??1e5,maxRequests:e.maxRequests??1e3,timeWindow:e.timeWindow??36e5,maxCost:e.maxCost??10,tokenCostPer1000:e.tokenCostPer1000??.002,refillRate:e.refillRate??100,bucketSize:e.bucketSize??1e4,costCalculator:e.costCalculator??((e,t)=>le(e,t,this.pluginOptions.tokenCostPer1000)),category:e.category??c.PluginCategory.LIMITS,priority:e.priority??c.PluginPriority.NORMAL,moduleEvents:e.moduleEvents??[],subscribeToAllModuleEvents:e.subscribeToAllModuleEvents??!1}}async beforeExecution(e){if(this.pluginOptions.strategy===`none`)return;let t=this.getKey(e),n=Date.now(),r=ue(e.messages??[]),i=this.pluginOptions.costCalculator(r,this.resolveModelName(e));switch(this.pluginOptions.strategy){case`token-bucket`:de(this.getBucket(t),n,r,i,this.pluginOptions,this.name);break;case`sliding-window`:fe(this.getWindow(t),n,r,i,this.pluginOptions,this.name);break;case`fixed-window`:pe(this.getWindow(t),n,r,i,this.pluginOptions,this.name);break}}async afterExecution(e,t){if(this.pluginOptions.strategy===`none`)return;let n=this.getKey(e),r=t?.tokensUsed||0,i=this.pluginOptions.costCalculator(r,this.resolveModelName(e));switch(this.pluginOptions.strategy){case`token-bucket`:this.getBucket(n).cost+=i;break;case`sliding-window`:case`fixed-window`:{let e=this.getWindow(n);e.tokens+=r,e.cost+=i;break}}}getBucket(e){return this.buckets.has(e)||this.buckets.set(e,{tokens:this.pluginOptions.bucketSize,lastRefill:Date.now(),requests:0,cost:0,windowStart:Date.now()}),this.buckets.get(e)}getWindow(e){return this.windows.has(e)||this.windows.set(e,{count:0,tokens:0,cost:0,windowStart:Date.now()}),this.windows.get(e)}getKey(e){return e.userId||e.sessionId||e.executionId||`default`}resolveModelName(e){let t=e.config?.model;return typeof t==`string`&&t.length>0?t:`unknown`}getLimitsStatus(e){if(e){let t=this.buckets.get(e),n=this.windows.get(e);return{strategy:this.pluginOptions.strategy,key:e,bucket:t?{availableTokens:Math.floor(t.tokens),requests:t.requests,cost:t.cost}:null,window:n?{count:n.count,tokens:n.tokens,cost:n.cost,windowStart:n.windowStart}:null}}return{strategy:this.pluginOptions.strategy,totalKeys:this.buckets.size+this.windows.size,bucketKeys:Array.from(this.buckets.keys()),windowKeys:Array.from(this.windows.keys())}}resetLimits(e){e?(this.buckets.delete(e),this.windows.delete(e)):(this.buckets.clear(),this.windows.clear())}},w=class{format(e){let t=e.timestamp.toISOString(),n=e.level.toUpperCase().padStart(5),r=e.context?` | ${JSON.stringify(e.context)}`:``,i=e.metadata?` | ${JSON.stringify(e.metadata)}`:``;return`[${t}] ${n} | ${e.message}${r}${i}`}},T=class{format(e){return JSON.stringify({...e,timestamp:e.timestamp.toISOString()})}},E=class{formatter;logger;constructor(e,t){this.formatter=e||new w,this.logger=t||c.SilentLogger}async write(e){let t=this.formatter.format(e);switch(e.level){case`debug`:this.logger.debug(t);break;case`info`:this.logger.info(t);break;case`warn`:this.logger.warn(t);break;case`error`:this.logger.error(t);break}}async flush(){}async close(){}},D=class{filePath;formatter;logger;constructor(e,t){this.filePath=e,this.formatter=t||new T,this.logger=(0,c.createLogger)(`FileLogStorage`)}async write(e){try{this.logger.warn(`File logging not fully implemented yet`,{filePath:this.filePath,entry:this.formatter.format(e)})}catch(e){throw new c.PluginError(`Failed to write log to file`,`LoggingPlugin`,{filePath:this.filePath,error:e instanceof Error?e.message:String(e)})}}async flush(){this.logger.warn(`File flush not fully implemented yet`)}async close(){this.logger.warn(`File close not fully implemented yet`)}},O=class{url;formatter;batchSize;flushInterval;pendingLogs=[];flushTimer;logger;constructor(e,t={}){this.url=e,this.formatter=new T,this.batchSize=10,this.flushInterval=5e3,this.logger=(0,c.createLogger)(`RemoteLogStorage`),this.flushTimer=(0,c.startPeriodicTask)(this.logger,{name:`RemoteLogStorage.flush`,intervalMs:this.flushInterval},async()=>{await this.flush()})}async write(e){this.pendingLogs.push(e),this.pendingLogs.length>=this.batchSize&&await this.flush()}async flush(){if(this.pendingLogs.length===0)return;let e=[...this.pendingLogs];this.pendingLogs=[];try{this.logger.warn(`Remote logging not fully implemented yet`,{url:this.url,logCount:e.length,logs:e.map(e=>this.formatter.format(e))})}catch(t){throw new c.PluginError(`Failed to send logs to remote endpoint`,`LoggingPlugin`,{url:this.url,logCount:e.length,error:t instanceof Error?t.message:String(t)})}}async close(){(0,c.stopPeriodicTask)(this.flushTimer),this.flushTimer=void 0,await this.flush()}},k=class{async write(e){}async flush(){}async close(){}};function A(e){if(!e.strategy)throw new c.ConfigurationError(`Logging strategy is required`);if(![`console`,`file`,`remote`,`silent`].includes(e.strategy))throw new c.ConfigurationError(`Invalid logging strategy`,{validStrategies:[`console`,`file`,`remote`,`silent`],provided:e.strategy});if(e.level&&![`debug`,`info`,`warn`,`error`].includes(e.level))throw new c.ConfigurationError(`Invalid log level`,{validLevels:[`debug`,`info`,`warn`,`error`],provided:e.level});if(e.strategy===`file`&&!e.filePath)throw new c.ConfigurationError(`File path is required for file logging strategy`);if(e.strategy===`remote`&&!e.remoteEndpoint)throw new c.ConfigurationError(`Remote endpoint is required for remote logging strategy`);if(e.maxLogs!==void 0&&e.maxLogs<=0)throw new c.ConfigurationError(`Max logs must be positive`);if(e.batchSize!==void 0&&e.batchSize<=0)throw new c.ConfigurationError(`Batch size must be positive`);if(e.flushInterval!==void 0&&e.flushInterval<=0)throw new c.ConfigurationError(`Flush interval must be positive`)}function j(e,t,n,r,i){switch(e){case`console`:return new E(i);case`file`:return new D(t,i);case`remote`:return new O(n,{timeout:r});case`silent`:return new k;default:throw new c.ConfigurationError(`Unknown logging strategy`,{strategy:e})}}const M=new Map([[c.EVENT_EMITTER_EVENTS.MODULE_INITIALIZE_START,{level:`info`,message:`Module initialization started`,operation:`module_initialize_start`}],[c.EVENT_EMITTER_EVENTS.MODULE_INITIALIZE_COMPLETE,{level:`info`,message:`Module initialization completed`,operation:`module_initialize_complete`}],[c.EVENT_EMITTER_EVENTS.MODULE_INITIALIZE_ERROR,{level:`error`,message:`Module initialization failed`,operation:`module_initialize_error`}],[c.EVENT_EMITTER_EVENTS.MODULE_EXECUTION_START,{level:`debug`,message:`Module execution started`,operation:`module_execution_start`}],[c.EVENT_EMITTER_EVENTS.MODULE_EXECUTION_COMPLETE,{level:`debug`,message:`Module execution completed`,operation:`module_execution_complete`}],[c.EVENT_EMITTER_EVENTS.MODULE_EXECUTION_ERROR,{level:`error`,message:`Module execution failed`,operation:`module_execution_error`}],[c.EVENT_EMITTER_EVENTS.MODULE_DISPOSE_START,{level:`debug`,message:`Module disposal started`,operation:`module_dispose_start`}],[c.EVENT_EMITTER_EVENTS.MODULE_DISPOSE_COMPLETE,{level:`info`,message:`Module disposal completed`,operation:`module_dispose_complete`}],[c.EVENT_EMITTER_EVENTS.MODULE_DISPOSE_ERROR,{level:`error`,message:`Module disposal failed`,operation:`module_dispose_error`}]]);function N(e){let t=typeof e==`object`&&e?e:{};return{moduleName:typeof t.moduleName==`string`?t.moduleName:`unknown`,moduleType:typeof t.moduleType==`string`?t.moduleType:`unknown`,...typeof t.duration==`number`&&{duration:t.duration},...typeof t.success==`boolean`&&{success:t.success}}}async function P(e,t,n,r){await e.info(`Execution started`,{userInput:n.substring(0,100)},{executionId:t,operation:`execution_start`,...r})}async function F(e,t,n,r){await e.info(`Execution completed`,{duration:n},{executionId:t,operation:`execution_complete`,...n!==void 0&&{duration:n},...r})}async function I(e,t,n,r,i,a){let o=i?`Tool executed successfully`:`Tool execution failed`,s=i?`info`:`error`,c={executionId:n,operation:`tool_execution`,...r!==void 0&&{duration:r},...a&&typeof a==`object`?a:{}};await e.log(s,o,{toolName:t,success:i??!1},c)}var L=class extends c.AbstractPlugin{name=`LoggingPlugin`;version=`1.0.0`;storage;pluginOptions;logger;simpleLogger;logLevels=[`debug`,`info`,`warn`,`error`];constructor(e){super(),this.logger=(0,c.createLogger)(`LoggingPlugin`),this.simpleLogger=e.logger||c.SilentLogger,this.category=c.PluginCategory.LOGGING,this.priority=c.PluginPriority.HIGH,A(e),this.pluginOptions={enabled:e.enabled??!0,strategy:e.strategy,level:e.level??`info`,filePath:e.filePath??`./agent.log`,remoteEndpoint:e.remoteEndpoint??``,remoteHeaders:e.remoteHeaders??{},maxLogs:e.maxLogs??1e4,includeStackTrace:e.includeStackTrace??!0,...e.formatter&&{formatter:e.formatter},batchSize:e.batchSize??100,flushInterval:e.flushInterval??3e4,category:e.category??c.PluginCategory.LOGGING,priority:e.priority??c.PluginPriority.HIGH,moduleEvents:e.moduleEvents??[],subscribeToAllModuleEvents:e.subscribeToAllModuleEvents??!1},this.storage=j(this.pluginOptions.strategy,this.pluginOptions.filePath,this.pluginOptions.remoteEndpoint,this.pluginOptions.flushInterval,this.pluginOptions.formatter),this.logger.info(`LoggingPlugin initialized`,{strategy:this.pluginOptions.strategy,level:this.pluginOptions.level,maxLogs:this.pluginOptions.maxLogs})}async onModuleEvent(e,t){try{let n=M.get(e);if(!n)return;let{moduleName:r,moduleType:i,duration:a,success:o}=N(t.data),s={moduleName:r,moduleType:i};a!==void 0&&(s.duration=a),o!==void 0&&(s.success=o);let c={operation:n.operation};t.executionId&&(c.executionId=t.executionId),a!==void 0&&(c.duration=a),n.level===`error`?await this.error(n.message,t.error,s,c):await this.log(n.level,n.message,s,c)}catch(t){this.simpleLogger.error(`LoggingPlugin failed to handle module event ${e}:`,t instanceof Error?t:Error(String(t)))}}async log(e,t,n,r){if(this.shouldLog(e))try{let i={timestamp:new Date,level:e,message:t,...n&&{context:n},...r&&{metadata:r}};await this.storage.write(i)}catch(e){this.simpleLogger.error(`Logging failed:`,e instanceof Error?e:Error(String(e)))}}async debug(e,t,n){await this.log(`debug`,e,t,n)}async info(e,t,n){await this.log(`info`,e,t,n)}async warn(e,t,n){await this.log(`warn`,e,t,n)}async error(e,t,n,r){let i={...n,...t&&this.pluginOptions.includeStackTrace?{errorMessage:t.message,errorStack:t.stack}:{}};await this.log(`error`,e,i,r)}async logExecutionStart(e,t,n){await P(this,e,t,n)}async logExecutionComplete(e,t,n){await F(this,e,t,n)}async logToolExecution(e,t,n,r,i){await I(this,e,t,n,r,i)}async flush(){try{await this.storage.flush()}catch(e){throw new c.PluginError(`Failed to flush logs`,this.name,{error:e instanceof Error?e.message:String(e)})}}async destroy(){try{await this.storage.close(),this.logger.info(`LoggingPlugin destroyed`)}catch(e){this.logger.error(`Error during plugin cleanup`,{error:e instanceof Error?e.message:String(e)})}}shouldLog(e){let t=this.logLevels.indexOf(this.pluginOptions.level);return this.logLevels.indexOf(e)>=t}},R=class{logger;constructor(){this.logger=(0,c.createLogger)(`NodeSystemMetricsCollector`)}async getMemoryUsage(){try{let e=process.memoryUsage();return{used:e.rss,free:0,total:e.rss+e.external,heap:{used:e.heapUsed,total:e.heapTotal}}}catch(e){this.logger.warn(`Failed to get memory usage`,{error:e instanceof Error?e.message:String(e)});return}}async getCPUUsage(){try{let e=process.cpuUsage();return{user:e.user,system:e.system,percent:0}}catch(e){this.logger.warn(`Failed to get CPU usage`,{error:e instanceof Error?e.message:String(e)});return}}async getNetworkStats(){try{this.logger.warn(`Network stats monitoring not fully implemented yet`);return}catch(e){this.logger.warn(`Failed to get network stats`,{error:e instanceof Error?e.message:String(e)});return}}},z=class{entries=[];maxEntries;constructor(e=5e3){this.maxEntries=e}async save(e){this.entries.length>=this.maxEntries&&(this.entries=this.entries.slice(-this.maxEntries+1)),this.entries.push({...e})}async getMetrics(e,t){let n=[...this.entries];return e&&(n=n.filter(t=>t.operation===e)),t&&(n=n.filter(e=>e.timestamp>=t.start&&e.timestamp<=t.end)),n}async getAggregatedStats(e){let t=await this.getMetrics(void 0,e);if(t.length===0)return{totalOperations:0,averageDuration:0,minDuration:0,maxDuration:0,successRate:0,errorRate:0,operationStats:{},timeRangeStats:{startTime:e?.start||new Date,endTime:e?.end||new Date,period:`empty`}};let n=t.map(e=>e.duration),r=t.filter(e=>e.success).length,i=t.reduce((e,t)=>e+t.errorCount,0);return{totalOperations:t.length,averageDuration:n.reduce((e,t)=>e+t,0)/n.length,minDuration:Math.min(...n),maxDuration:Math.max(...n),successRate:r/t.length,errorRate:i/t.length,operationStats:{},timeRangeStats:{startTime:e?.start||t[0]?.timestamp||new Date,endTime:e?.end||t[t.length-1]?.timestamp||new Date,period:`memory`}}}async clear(){this.entries=[]}async flush(){}async close(){}};function he(e){if(!e.strategy)throw new c.ConfigurationError(`Performance monitoring strategy is required`);if(![`memory`,`file`,`prometheus`,`remote`,`silent`].includes(e.strategy))throw new c.ConfigurationError(`Invalid performance monitoring strategy`,{validStrategies:[`memory`,`file`,`prometheus`,`remote`,`silent`],provided:e.strategy})}function ge(e,t){switch(e){case`memory`:return new z(t);default:throw new c.ConfigurationError(`Performance monitoring strategy is not implemented`,{provided:e})}}const _e=new Map([[c.EVENT_EMITTER_EVENTS.MODULE_INITIALIZE_COMPLETE,{operation:`module_initialization`,phase:`initialization`,isError:!1}],[c.EVENT_EMITTER_EVENTS.MODULE_INITIALIZE_ERROR,{operation:`module_initialization`,phase:`initialization`,isError:!0}],[c.EVENT_EMITTER_EVENTS.MODULE_EXECUTION_COMPLETE,{operation:`module_execution`,phase:`execution`,isError:!1}],[c.EVENT_EMITTER_EVENTS.MODULE_EXECUTION_ERROR,{operation:`module_execution`,phase:`execution`,isError:!0}],[c.EVENT_EMITTER_EVENTS.MODULE_DISPOSE_COMPLETE,{operation:`module_disposal`,phase:`disposal`,isError:!1}],[c.EVENT_EMITTER_EVENTS.MODULE_DISPOSE_ERROR,{operation:`module_disposal`,phase:`disposal`,isError:!0}]]);function ve(e){let t=typeof e==`object`&&e?e:{};return{moduleName:typeof t.moduleName==`string`?t.moduleName:`unknown`,moduleType:typeof t.moduleType==`string`?t.moduleType:`unknown`,...typeof t.duration==`number`&&{duration:t.duration},...typeof t.success==`boolean`&&{success:t.success}}}var ye=class extends c.AbstractPlugin{name=`PerformancePlugin`;version=`1.0.0`;storage;metricsCollector;pluginOptions;logger;constructor(e){super(),this.logger=(0,c.createLogger)(`PerformancePlugin`),this.category=c.PluginCategory.MONITORING,this.priority=c.PluginPriority.NORMAL,he(e),this.pluginOptions={enabled:e.enabled??!0,strategy:e.strategy,filePath:e.filePath??`./performance-metrics.json`,remoteEndpoint:e.remoteEndpoint??``,prometheusEndpoint:e.prometheusEndpoint??`/metrics`,remoteHeaders:e.remoteHeaders??{},maxEntries:e.maxEntries??5e3,monitorMemory:e.monitorMemory??!0,monitorCPU:e.monitorCPU??!0,monitorNetwork:e.monitorNetwork??!1,batchSize:e.batchSize??100,flushInterval:e.flushInterval??3e4,aggregateStats:e.aggregateStats??!0,aggregationInterval:e.aggregationInterval??6e4,performanceThreshold:e.performanceThreshold??1e3,category:e.category??c.PluginCategory.MONITORING,priority:e.priority??c.PluginPriority.NORMAL,moduleEvents:e.moduleEvents??[],subscribeToAllModuleEvents:e.subscribeToAllModuleEvents??!1},this.storage=ge(this.pluginOptions.strategy,this.pluginOptions.maxEntries),this.metricsCollector=new R,this.logger.info(`PerformancePlugin initialized`,{strategy:this.pluginOptions.strategy,monitorMemory:this.pluginOptions.monitorMemory,monitorCPU:this.pluginOptions.monitorCPU,performanceThreshold:this.pluginOptions.performanceThreshold})}async onModuleEvent(e,t){try{let n=_e.get(e);if(!n)return;let{moduleName:r,moduleType:i,duration:a,success:o}=ve(t.data);if(a===void 0)return;await this.recordMetrics({operation:n.operation,duration:a,success:n.isError?!1:o??!0,errorCount:+!!n.isError,...t.executionId&&{executionId:t.executionId},metadata:{moduleName:r,moduleType:i,phase:n.phase,...n.isError&&{error:t.error?.message||`unknown error`}}})}catch{}}async recordMetrics(e){try{let t=this.pluginOptions.monitorMemory?await this.metricsCollector.getMemoryUsage():void 0,n=this.pluginOptions.monitorCPU?await this.metricsCollector.getCPUUsage():void 0,r=this.pluginOptions.monitorNetwork?await this.metricsCollector.getNetworkStats():void 0,i={...e,timestamp:new Date,...t&&{memoryUsage:t},...n&&{cpuUsage:n},...r&&{networkStats:r}};await this.storage.save(i),i.duration>this.pluginOptions.performanceThreshold&&this.logger.warn(`Performance threshold exceeded`,{operation:i.operation,duration:i.duration,threshold:this.pluginOptions.performanceThreshold,executionId:i.executionId}),this.logger.debug(`Performance metrics recorded`,{operation:i.operation,duration:i.duration,success:i.success,memoryUsed:i.memoryUsage?.heap.used})}catch(e){throw new c.PluginError(`Failed to record performance metrics`,this.name,{error:e instanceof Error?e.message:String(e)})}}async getMetrics(e,t){try{return await this.storage.getMetrics(e,t)}catch(n){throw new c.PluginError(`Failed to get performance metrics`,this.name,{operation:e||`all`,timeRange:t?`${t.start.toISOString()}-${t.end.toISOString()}`:`all`,error:n instanceof Error?n.message:String(n)})}}async getAggregatedStats(e){try{return await this.storage.getAggregatedStats(e)}catch(t){throw new c.PluginError(`Failed to get aggregated performance stats`,this.name,{timeRange:e?`${e.start.toISOString()}-${e.end.toISOString()}`:`all`,error:t instanceof Error?t.message:String(t)})}}async clearMetrics(){try{await this.storage.clear(),this.logger.info(`Performance metrics cleared`)}catch(e){throw new c.PluginError(`Failed to clear performance metrics`,this.name,{error:e instanceof Error?e.message:String(e)})}}async destroy(){try{await this.storage.close(),this.logger.info(`PerformancePlugin destroyed`)}catch(e){this.logger.error(`Error during plugin cleanup`,{error:e instanceof Error?e.message:String(e)})}}};function B(e){if(!e)return`all`;let t=(e.end.getTime()-e.start.getTime())/36e5;return t<=1?`hour`:t<=24?`day`:t<=168?`week`:`month`}function be(e,t){if(t)return{startTime:t.start,endTime:t.end,period:B(t)};if(e.length>0){let t=e[0]?.timestamp,n=e[e.length-1]?.timestamp,r=new Date;return{startTime:t??r,endTime:n??r,period:B(void 0)}}let n=new Date;return{startTime:n,endTime:n,period:B(void 0)}}function V(e,t){let n=be(e,t),r={totalRequests:e.length,totalTokens:e.reduce((e,t)=>e+t.tokensUsed.total,0),totalCost:e.reduce((e,t)=>e+(t.cost?.total??0),0),totalDuration:e.reduce((e,t)=>e+t.duration,0),successRate:e.length>0?e.filter(e=>e.success).length/e.length:0,providerStats:{},modelStats:{},toolStats:{},timeRangeStats:n};for(let t of e){r.providerStats[t.provider]||(r.providerStats[t.provider]={requests:0,tokens:0,cost:0,duration:0});let e=r.providerStats[t.provider];e&&(e.requests+=t.requestCount,e.tokens+=t.tokensUsed.total,e.cost+=t.cost?.total??0,e.duration+=t.duration)}for(let t of e){r.modelStats[t.model]||(r.modelStats[t.model]={requests:0,tokens:0,cost:0,duration:0});let e=r.modelStats[t.model];e&&(e.requests+=t.requestCount,e.tokens+=t.tokensUsed.total,e.cost+=t.cost?.total??0,e.duration+=t.duration)}for(let t of e){let e=t.toolsUsed;if(e)for(let n of e){r.toolStats[n]||(r.toolStats[n]={usageCount:0,successCount:0,totalDuration:0});let e=r.toolStats[n];e.usageCount+=1,t.success&&(e.successCount+=1),e.totalDuration+=t.duration}}return r}var H=class{entries=[];maxEntries;constructor(e=1e4){this.maxEntries=e}async save(e){this.entries.length>=this.maxEntries&&(this.entries=this.entries.slice(-this.maxEntries+1)),this.entries.push({...e})}async getStats(e,t){let n=[...this.entries];return e&&(n=n.filter(t=>t.conversationId===e)),t&&(n=n.filter(e=>e.timestamp>=t.start&&e.timestamp<=t.end)),n}async getAggregatedStats(e){return V(await this.getStats(void 0,e),e)}async clear(){this.entries=[]}async flush(){}async close(){}},U=class{filePath;logger;constructor(e){this.filePath=e,this.logger=(0,c.createLogger)(`FileUsageStorage`)}async save(e){try{this.logger.warn(`File usage storage not fully implemented yet`,{filePath:this.filePath,entry:{timestamp:e.timestamp.toISOString(),provider:e.provider,model:e.model,tokens:e.tokensUsed.total,cost:e.cost?.total,success:e.success}})}catch(e){throw new c.StorageError(`Failed to save usage stats to file`,{filePath:this.filePath,error:e instanceof Error?e.message:String(e)})}}async getStats(e,t){try{return this.logger.warn(`File usage storage not fully implemented yet`,{filePath:this.filePath,conversationId:e,timeRange:t}),[]}catch(t){throw new c.StorageError(`Failed to load usage stats from file`,{filePath:this.filePath,conversationId:e||`all`,error:t instanceof Error?t.message:String(t)})}}async getAggregatedStats(e){try{return V(await this.getStats(void 0,e),e)}catch(e){throw new c.StorageError(`Failed to get aggregated usage stats from file`,{filePath:this.filePath,error:e instanceof Error?e.message:String(e)})}}async clear(){try{this.logger.warn(`File usage storage not fully implemented yet`,{filePath:this.filePath,operation:`clear`})}catch(e){throw new c.StorageError(`Failed to clear usage stats from file`,{filePath:this.filePath,error:e instanceof Error?e.message:String(e)})}}async flush(){try{this.logger.warn(`File usage storage flush not fully implemented yet`,{filePath:this.filePath})}catch(e){throw new c.StorageError(`Failed to flush usage stats to file`,{filePath:this.filePath,error:e instanceof Error?e.message:String(e)})}}async close(){try{this.logger.warn(`File usage storage close not fully implemented yet`,{filePath:this.filePath})}catch(e){throw new c.StorageError(`Failed to close usage stats file`,{filePath:this.filePath,error:e instanceof Error?e.message:String(e)})}}},W=class{apiUrl;batchSize;flushInterval;batch=[];timer;logger;constructor(e,t,n,r={},i=50,a=6e4){this.apiUrl=e,this.batchSize=i,this.flushInterval=a,this.logger=(0,c.createLogger)(`RemoteUsageStorage`),this.timer=(0,c.startPeriodicTask)(this.logger,{name:`RemoteUsageStorage.flush`,intervalMs:this.flushInterval},async()=>{await this.flush()})}async save(e){this.batch.push(e),this.batch.length>=this.batchSize&&await this.flush()}async getStats(e,t){try{return this.logger.warn(`Remote usage storage not fully implemented yet`,{endpoint:this.apiUrl,operation:`getStats`,conversationId:e,timeRange:t}),[]}catch(t){throw new c.StorageError(`Failed to get usage stats from remote endpoint`,{endpoint:this.apiUrl,conversationId:e||`all`,error:t instanceof Error?t.message:String(t)})}}async getAggregatedStats(e){try{return V(await this.getStats(void 0,e),e)}catch(e){throw new c.StorageError(`Failed to get aggregated usage stats from remote endpoint`,{endpoint:this.apiUrl,error:e instanceof Error?e.message:String(e)})}}async clear(){try{this.logger.warn(`Remote usage storage not fully implemented yet`,{endpoint:this.apiUrl,operation:`clear`})}catch(e){throw new c.StorageError(`Failed to clear usage stats from remote endpoint`,{endpoint:this.apiUrl,error:e instanceof Error?e.message:String(e)})}}async flush(){if(this.batch.length===0)return;let e=[...this.batch];this.batch=[];try{this.logger.warn(`Remote usage storage not fully implemented yet`,{endpoint:this.apiUrl,operation:`flush`,batchSize:e.length,sample:e.slice(0,3).map(e=>({timestamp:e.timestamp.toISOString(),provider:e.provider,model:e.model,tokens:e.tokensUsed.total,cost:e.cost?.total,success:e.success}))})}catch(t){throw this.batch=[...e,...this.batch],new c.StorageError(`Failed to send usage stats to remote endpoint`,{endpoint:this.apiUrl,batchSize:e.length,error:t instanceof Error?t.message:String(t)})}}async close(){(0,c.stopPeriodicTask)(this.timer),this.timer=void 0,await this.flush()}},G=class{async save(e){}async getStats(e,t){return[]}async getAggregatedStats(e){return V([],e)}async clear(){}async flush(){}async close(){}};function xe(e){return{enabled:e.enabled??!0,strategy:e.strategy,filePath:e.filePath??`./usage-stats.json`,remoteEndpoint:e.remoteEndpoint??``,remoteHeaders:e.remoteHeaders??{},maxEntries:e.maxEntries??1e4,trackCosts:e.trackCosts??!0,...e.costRates&&{costRates:e.costRates},batchSize:e.batchSize??50,flushInterval:e.flushInterval??6e4,aggregateStats:e.aggregateStats??!0,aggregationInterval:e.aggregationInterval??3e5,category:e.category??c.PluginCategory.MONITORING,priority:e.priority??c.PluginPriority.NORMAL,moduleEvents:e.moduleEvents??[],subscribeToAllModuleEvents:e.subscribeToAllModuleEvents??!1}}function Se(e,t,n){if(!e||!e[t])return;let r=e[t],i=n.input*r.input,a=n.output*r.output;return{input:i,output:a,total:i+a}}const K=[`memory`,`file`,`remote`,`silent`];function Ce(e){if(!e.strategy)throw new c.ConfigurationError(`Usage tracking strategy is required`);if(!K.includes(e.strategy))throw new c.ConfigurationError(`Invalid usage tracking strategy`,{validStrategies:[...K],provided:e.strategy});if(e.strategy===`file`&&!e.filePath)throw new c.ConfigurationError(`File path is required for file usage tracking strategy`);if(e.strategy===`remote`&&!e.remoteEndpoint)throw new c.ConfigurationError(`Remote endpoint is required for remote usage tracking strategy`);if(e.maxEntries!==void 0&&e.maxEntries<=0)throw new c.ConfigurationError(`Max entries must be positive`);if(e.batchSize!==void 0&&e.batchSize<=0)throw new c.ConfigurationError(`Batch size must be positive`);if(e.flushInterval!==void 0&&e.flushInterval<=0)throw new c.ConfigurationError(`Flush interval must be positive`);if(e.aggregationInterval!==void 0&&e.aggregationInterval<=0)throw new c.ConfigurationError(`Aggregation interval must be positive`)}const we=new Set([c.EVENT_EMITTER_EVENTS.MODULE_INITIALIZE_COMPLETE,c.EVENT_EMITTER_EVENTS.MODULE_EXECUTION_COMPLETE,c.EVENT_EMITTER_EVENTS.MODULE_DISPOSE_COMPLETE]),Te=new Set([c.EVENT_EMITTER_EVENTS.MODULE_INITIALIZE_ERROR,c.EVENT_EMITTER_EVENTS.MODULE_EXECUTION_ERROR,c.EVENT_EMITTER_EVENTS.MODULE_DISPOSE_ERROR]);function Ee(e){return we.has(e)}function De(e){return Te.has(e)}function q(e,t){if(e&&typeof e==`object`&&t in e){let n=e[t];if(typeof n==`string`)return n}return`unknown`}function Oe(e){return e.includes(`initialize`)?`initialization`:e.includes(`execution`)?`execution`:`disposal`}var ke=class extends c.AbstractPlugin{name=`UsagePlugin`;version=`1.0.0`;storage;pluginOptions;logger;aggregationTimer;constructor(e){super(),this.logger=(0,c.createLogger)(`UsagePlugin`),this.category=c.PluginCategory.MONITORING,this.priority=c.PluginPriority.NORMAL,Ce(e),this.pluginOptions=xe(e),this.storage=this.createStorage(),this.pluginOptions.aggregateStats&&this.setupAggregation(),this.logger.info(`UsagePlugin initialized`,{strategy:this.pluginOptions.strategy,trackCosts:this.pluginOptions.trackCosts,maxEntries:this.pluginOptions.maxEntries})}async onModuleEvent(e,t){try{let n=Ee(e),r=De(e);if(!n&&!r)return;let i=t.data;if(!i||!(`duration`in i)||typeof i.duration!=`number`)return;await this.recordModuleUsage(e,t,i.duration,n)}catch{}}async recordModuleUsage(e,t,n,r){let i=t.data,a=q(i,`moduleName`),o=q(i,`moduleType`),s={moduleName:a,moduleType:o,operation:Oe(e)};r||(s.error=t.error?.message||`unknown error`),await this.recordUsage({provider:`module`,model:o,tokensUsed:{input:0,output:0,total:0},requestCount:1,duration:n,success:r,...t.executionId&&{executionId:t.executionId},...t.sessionId&&{conversationId:t.sessionId},metadata:s})}async recordUsage(e){try{let t=this.pluginOptions.trackCosts?Se(this.pluginOptions.costRates,e.model,e.tokensUsed):void 0,n={...e,timestamp:new Date,...t&&{cost:t}};await this.storage.save(n),this.logger.debug(`Usage recorded`,{provider:n.provider,model:n.model,tokens:n.tokensUsed.total,cost:n.cost?.total,success:n.success})}catch(e){throw new c.PluginError(`Failed to record usage`,this.name,{error:e instanceof Error?e.message:String(e)})}}async getUsageStats(e,t){try{return await this.storage.getStats(e,t)}catch(n){throw new c.PluginError(`Failed to get usage stats`,this.name,{conversationId:e||`all`,timeRange:t?`${t.start.toISOString()}-${t.end.toISOString()}`:`all`,error:n instanceof Error?n.message:String(n)})}}async getAggregatedStats(e){try{return await this.storage.getAggregatedStats(e)}catch(t){throw new c.PluginError(`Failed to get aggregated usage stats`,this.name,{timeRange:e?`${e.start.toISOString()}-${e.end.toISOString()}`:`all`,error:t instanceof Error?t.message:String(t)})}}async clearStats(){try{await this.storage.clear(),this.logger.info(`Usage statistics cleared`)}catch(e){throw new c.PluginError(`Failed to clear usage stats`,this.name,{error:e instanceof Error?e.message:String(e)})}}async flush(){try{await this.storage.flush()}catch(e){throw new c.PluginError(`Failed to flush usage stats`,this.name,{error:e instanceof Error?e.message:String(e)})}}async destroy(){try{this.aggregationTimer&&clearInterval(this.aggregationTimer),await this.storage.close(),this.logger.info(`UsagePlugin destroyed`)}catch(e){this.logger.error(`Error during plugin cleanup`,{error:e instanceof Error?e.message:String(e)})}}createStorage(){switch(this.pluginOptions.strategy){case`memory`:return new H(this.pluginOptions.maxEntries);case`file`:return new U(this.pluginOptions.filePath);case`remote`:return new W(this.pluginOptions.remoteEndpoint,``,3e4,this.pluginOptions.remoteHeaders||{},this.pluginOptions.batchSize,this.pluginOptions.flushInterval);case`silent`:return new G;default:throw new c.ConfigurationError(`Unknown usage tracking strategy`,{strategy:this.pluginOptions.strategy})}}setupAggregation(){this.aggregationTimer=(0,c.startPeriodicTask)(this.logger,{name:`UsagePlugin.aggregate`,intervalMs:this.pluginOptions.aggregationInterval},async()=>{let e=await this.getAggregatedStats();this.logger.debug(`Periodic usage aggregation`,{totalRequests:e.totalRequests,totalTokens:e.totalTokens,totalCost:e.totalCost,successRate:e.successRate})})}},J=class{static contextToWebhook(e){return{executionId:e.executionId,sessionId:e.sessionId,userId:e.userId}}static resultToWebhook(e){return{response:e.response,content:e.content,duration:e.duration,tokensUsed:e.tokensUsed,toolsExecuted:e.toolsExecuted,success:e.success,usage:e.usage,toolCalls:e.toolCalls,error:e.error}}static createExecutionData(e,t){let n={response:t.response||void 0,duration:t.duration||void 0,tokensUsed:t.tokensUsed||void 0,toolsExecuted:t.toolsExecuted||void 0,success:t.success===void 0?void 0:t.success};return{executionId:e.executionId,sessionId:e.sessionId,userId:e.userId,result:n}}static createConversationData(e,t){let n=t.toolCalls?.map(e=>({id:e.id||``,name:e.name||``,arguments:JSON.stringify(e.arguments||{}),result:String(e.result||``)}))||[],r={response:t.content||t.response||void 0,tokensUsed:t.usage?.totalTokens||t.tokensUsed||void 0,toolCalls:n.length>0?n:void 0};return{executionId:e.executionId,sessionId:e.sessionId,userId:e.userId,conversation:r}}static createToolData(e,t){let n=this.safeGetProperty(t,`toolName`)||`unknown`,r=this.safeGetProperty(t,`toolId`)||this.safeGetProperty(t,`executionId`)||`unknown`,i=this.safeGetProperty(t,`error`),a=this.safeGetProperty(t,`duration`),o=this.safeGetProperty(t,`result`),s={name:String(n),id:String(r),success:!i,duration:typeof a==`number`?a:void 0,result:i?void 0:String(o||``),error:i?i instanceof Error?i.message:String(i):void 0};return{executionId:e.executionId,sessionId:e.sessionId,userId:e.userId,tool:s}}static createErrorData(e,t){let n={message:t instanceof Error?t.message:String(t),stack:t instanceof Error?t.stack:void 0,type:t instanceof Error?t.constructor.name:`Unknown`,context:e?{executionId:e.executionId||``,sessionId:e.sessionId||``,userId:e.userId||``}:void 0};return{executionId:e.executionId,sessionId:e.sessionId,userId:e.userId,error:n}}static safeGetProperty(e,t){if(!(!e||typeof e!=`object`||!e||Array.isArray(e)))return e[t]}static defaultPayloadTransformer(e,t){return t}},Y=class{logger;constructor(e){this.logger=e}async sendRequest(e){let{endpoint:t,payload:n,attempt:r}=e,i=t.timeout??5e3,a=t.retries??3;try{let e=JSON.stringify(n),a={"Content-Type":`application/json`,"User-Agent":`robota-webhook/1.0.0`,...t.headers};t.secret&&(a[`X-Webhook-Signature`]=this.generateSignature(e,t.secret));let o=await this.makeHttpRequest(t.url,{method:`POST`,headers:a,body:e,timeout:i});if(!o.ok)throw Error(`HTTP ${o.status}: ${o.statusText}`);this.logger.debug(`Webhook sent successfully`,{url:t.url,event:n.event,attempt:r,status:o.status})}catch(i){if(this.logger.error(`Webhook request failed`,{url:t.url,event:n.event,attempt:r,error:i instanceof Error?i.message:String(i)}),r<a){let t={...e,attempt:r+1},n=Math.min(1e3*2**(r-1),1e4);return await this.delay(n),this.sendRequest(t)}throw i}}generateSignature(e,t){let n=new l.default(`SHA-256`,`TEXT`,{hmacKey:{value:t,format:`TEXT`}});return n.update(e),n.getHash(`HEX`).toLowerCase()}async makeHttpRequest(e,t){let n=new AbortController,r=setTimeout(()=>n.abort(),t.timeout);try{return await fetch(e,{method:t.method,headers:t.headers,body:t.body,signal:n.signal})}finally{clearTimeout(r)}}delay(e){return new Promise(t=>setTimeout(t,e))}};const X={START:`${c.EXECUTION_EVENT_PREFIX}.${c.EXECUTION_EVENTS.START}`,COMPLETE:`${c.EXECUTION_EVENT_PREFIX}.${c.EXECUTION_EVENTS.COMPLETE}`,ERROR:`${c.EXECUTION_EVENT_PREFIX}.${c.EXECUTION_EVENTS.ERROR}`},Z={COMPLETE:`conversation.complete`},Q={EXECUTED:`tool.executed`},$={OCCURRED:`error.occurred`};function Ae(e,t,n){for(let r of e){if(!r.url)throw new c.PluginError(`Webhook endpoint URL is required`,t);let e;try{e=new URL(r.url)}catch{throw new c.PluginError(`Invalid webhook URL: ${r.url}`,t)}if(e.protocol!==`https:`&&e.protocol!==`http:`)throw new c.PluginError(`Webhook endpoint URL must use http or https: ${r.url}`,t);if(r.events){for(let e of r.events)if(!n.includes(e))throw new c.PluginError(`Invalid webhook event: ${e}`,t)}}}var je=class{logger;httpClient;maxConcurrency;requestQueue=[];batchQueue=[];batchTimer;activeConcurrency=0;totalSentCount=0;totalErrorCount=0;totalResponseTime=0;constructor(e,t,n){this.logger=e,this.httpClient=t,this.maxConcurrency=n}get queueLength(){return this.requestQueue.length}get batchQueueLength(){return this.batchQueue.length}setupBatching(e,t){this.batchTimer=setInterval(()=>{this.drainBatch(t)},e)}async enqueueBatch(e,t,n){this.batchQueue.push(e),this.batchQueue.length>=t&&await this.drainBatch(n)}async sendToEndpoints(e,t,n=!0){let r=t(e.event);if(r.length===0)return;let i=r.map(t=>({endpoint:t,payload:e,attempt:1,timestamp:new Date}));n?(this.requestQueue.push(...i),this.processQueue()):await Promise.allSettled(i.map(e=>{let t=Date.now();return this.httpClient.sendRequest(e).then(()=>{this.totalSentCount++,this.totalResponseTime+=Date.now()-t}).catch(e=>{throw this.totalErrorCount++,e})}))}processQueue(){for(;this.requestQueue.length>0&&this.activeConcurrency<this.maxConcurrency;){let e=this.requestQueue.shift();if(!e)break;this.activeConcurrency++;let t=Date.now();this.httpClient.sendRequest(e).then(()=>{this.totalSentCount++,this.totalResponseTime+=Date.now()-t}).catch(t=>{this.totalErrorCount++;let n=t instanceof Error?t.message:String(t);this.logger.error(`Webhook request failed`,{endpoint:e.endpoint.url,event:e.payload.event,error:n})}).finally(()=>{this.activeConcurrency--,this.requestQueue.length>0&&this.processQueue()})}}async drainBatch(e){if(this.batchQueue.length===0)return;let t=[...this.batchQueue];this.batchQueue=[],this.logger.debug(`Flushing webhook batch`,{payloadCount:t.length});for(let n of t)await this.sendToEndpoints(n,e)}clearQueues(){this.requestQueue=[],this.batchQueue=[]}stopBatchTimer(){this.batchTimer&&=(clearInterval(this.batchTimer),void 0)}},Me=class extends c.AbstractPlugin{name=`WebhookPlugin`;version=`1.0.0`;pluginOptions;logger;queue;constructor(e){if(super(),this.category=c.PluginCategory.NOTIFICATION,this.priority=c.PluginPriority.LOW,!e.endpoints||e.endpoints.length===0)throw new c.PluginError(`At least one webhook endpoint is required`,this.name);this.pluginOptions={enabled:e.enabled??!0,events:[X.COMPLETE,Z.COMPLETE,Q.EXECUTED,$.OCCURRED],defaultTimeout:5e3,defaultRetries:3,async:!0,maxConcurrency:3,batching:{enabled:!1,maxSize:10,flushInterval:5e3},payloadTransformer:J.defaultPayloadTransformer,category:e.category??c.PluginCategory.NOTIFICATION,priority:e.priority??c.PluginPriority.LOW,moduleEvents:e.moduleEvents??[],subscribeToAllModuleEvents:e.subscribeToAllModuleEvents??!1,...e},this.logger=(0,c.createLogger)(`${this.name}`);let t=new Y(this.logger);this.queue=new je(this.logger,t,this.pluginOptions.maxConcurrency),Ae(this.pluginOptions.endpoints,this.name,[X.START,X.COMPLETE,X.ERROR,Z.COMPLETE,Q.EXECUTED,$.OCCURRED,`custom`]),this.pluginOptions.batching.enabled&&this.queue.setupBatching(this.pluginOptions.batching.flushInterval,this.getEndpointsForEvent.bind(this)),this.logger.info(`WebhookPlugin initialized`,{endpointCount:this.pluginOptions.endpoints.length,events:this.pluginOptions.events,batching:this.pluginOptions.batching.enabled})}async afterExecution(e,t){let n=J.contextToWebhook(e),r=J.resultToWebhook(t),i=J.createExecutionData(n,r);await this.sendWebhook(X.COMPLETE,i)}async afterConversation(e,t){let n=J.contextToWebhook(e),r=J.resultToWebhook(t),i=J.createConversationData(n,r);await this.sendWebhook(Z.COMPLETE,i)}async afterToolExecution(e,t){let n=J.contextToWebhook(e);if(t.toolCalls&&t.toolCalls.length>0)for(let e of t.toolCalls){let r={toolName:e.name||``,toolId:e.id||``,result:e.result,success:e.result!==null,duration:t.duration},i=J.createToolData(n,r);await this.sendWebhook(Q.EXECUTED,i)}}async onError(e,t){let n=t?{executionId:t.executionId,sessionId:t.sessionId,userId:t.userId}:{executionId:void 0,sessionId:void 0,userId:void 0},r=J.createErrorData(n,e);await this.sendWebhook($.OCCURRED,r),await this.sendWebhook(X.ERROR,r)}async sendWebhook(e,t,n){if(!this.pluginOptions.events.includes(e))return;let r={event:e,timestamp:new Date().toISOString(),data:this.pluginOptions.payloadTransformer(e,t),...n&&{metadata:n}};t.executionId&&(r.executionId=t.executionId),t.sessionId&&(r.sessionId=t.sessionId),t.userId&&(r.userId=t.userId),this.logger.debug(`Sending webhook`,{event:e,endpointCount:this.getEndpointsForEvent(e).length}),this.pluginOptions.batching.enabled?await this.queue.enqueueBatch(r,this.pluginOptions.batching.maxSize,this.getEndpointsForEvent.bind(this)):await this.queue.sendToEndpoints(r,this.getEndpointsForEvent.bind(this),this.pluginOptions.async)}async sendCustomWebhook(e,t){await this.sendWebhook(`custom`,e,t)}getStats(){return{...super.getStats(),endpointCount:this.pluginOptions.endpoints.length,queueLength:this.queue.queueLength,batchQueueLength:this.queue.batchQueueLength,activeConcurrency:this.queue.activeConcurrency,supportedEvents:this.pluginOptions.events,totalSent:this.queue.totalSentCount,totalErrors:this.queue.totalErrorCount,averageResponseTime:this.queue.totalSentCount>0?this.queue.totalResponseTime/this.queue.totalSentCount:0}}clearQueue(){this.queue.clearQueues(),this.logger.info(`Webhook queues cleared`)}async destroy(){this.queue.stopBatchTimer(),await this.queue.drainBatch(this.getEndpointsForEvent.bind(this)),this.clearQueue(),this.logger.info(`WebhookPlugin destroyed`)}getEndpointsForEvent(e){return this.pluginOptions.endpoints.filter(t=>!t.events||t.events.length===0?!0:t.events.includes(e))}};exports.ConsoleLogFormatter=w,exports.ConsoleLogStorage=E,exports.ConversationHistoryPlugin=ne,exports.DatabaseHistoryStorage=f,exports.ErrorHandlingPlugin=_,exports.ExecutionAnalyticsPlugin=S,exports.FileHistoryStorage=d,exports.FileLogStorage=D,exports.FileUsageStorage=U,exports.JsonLogFormatter=T,exports.LimitsPlugin=me,exports.LoggingPlugin=L,exports.MemoryHistoryStorage=u,exports.MemoryPerformanceStorage=z,exports.MemoryUsageStorage=H,exports.NodeSystemMetricsCollector=R,exports.PerformancePlugin=ye,exports.RemoteLogStorage=O,exports.RemoteUsageStorage=W,exports.SilentLogStorage=k,exports.SilentUsageStorage=G,exports.UsagePlugin=ke,exports.WebhookHttpClient=Y,exports.WebhookPlugin=Me,exports.WebhookTransformer=J,exports.aggregateExecutionStats=v,exports.aggregateUsageStats=V,exports.createPluginErrorContext=g,exports.toErrorContext=h;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require(`@robota-sdk/agent-core`),l=require(`jssha`);l=s(l,1);var u=class{conversations=new Map;maxConversations;constructor(e=100){this.maxConversations=e}async save(e,t){if(this.conversations.size>=this.maxConversations&&!this.conversations.has(e)){let e=this.conversations.keys().next().value;e&&this.conversations.delete(e)}this.conversations.set(e,{...t})}async load(e){return this.conversations.get(e)}async list(){return Array.from(this.conversations.keys())}async delete(e){return this.conversations.delete(e)}async clear(){this.conversations.clear()}},d=class{filePath;logger;constructor(e){this.filePath=e,this.logger=(0,c.createLogger)(`FileHistoryStorage`)}async save(e,t){try{this.logger.warn(`File storage not fully implemented yet`,{conversationId:e,filePath:this.filePath})}catch(t){throw new c.StorageError(`Failed to save conversation to file`,{conversationId:e,filePath:this.filePath,error:t instanceof Error?t.message:String(t)})}}async load(e){try{this.logger.warn(`File storage not fully implemented yet`,{conversationId:e,filePath:this.filePath});return}catch(t){throw new c.StorageError(`Failed to load conversation from file`,{conversationId:e,filePath:this.filePath,error:t instanceof Error?t.message:String(t)})}}async list(){try{return this.logger.warn(`File storage not fully implemented yet`,{filePath:this.filePath}),[]}catch(e){throw new c.StorageError(`Failed to list conversations from file`,{filePath:this.filePath,error:e instanceof Error?e.message:String(e)})}}async delete(e){try{return this.logger.warn(`File storage not fully implemented yet`,{conversationId:e,filePath:this.filePath}),!1}catch(t){throw new c.StorageError(`Failed to delete conversation from file`,{conversationId:e,filePath:this.filePath,error:t instanceof Error?t.message:String(t)})}}async clear(){try{this.logger.warn(`File storage not fully implemented yet`,{filePath:this.filePath})}catch(e){throw new c.StorageError(`Failed to clear conversations from file`,{filePath:this.filePath,error:e instanceof Error?e.message:String(e)})}}},f=class{connectionString;logger;constructor(e){this.connectionString=e,this.logger=(0,c.createLogger)(`DatabaseHistoryStorage`)}async save(e,t){try{this.logger.warn(`Database storage not fully implemented yet`,{conversationId:e,connectionString:this.maskConnectionString()})}catch(t){throw new c.StorageError(`Failed to save conversation to database`,{conversationId:e,error:t instanceof Error?t.message:String(t)})}}async load(e){try{this.logger.warn(`Database storage not fully implemented yet`,{conversationId:e,connectionString:this.maskConnectionString()});return}catch(t){throw new c.StorageError(`Failed to load conversation from database`,{conversationId:e,error:t instanceof Error?t.message:String(t)})}}async list(){try{return this.logger.warn(`Database storage not fully implemented yet`,{connectionString:this.maskConnectionString()}),[]}catch(e){throw new c.StorageError(`Failed to list conversations from database`,{error:e instanceof Error?e.message:String(e)})}}async delete(e){try{return this.logger.warn(`Database storage not fully implemented yet`,{conversationId:e,connectionString:this.maskConnectionString()}),!1}catch(t){throw new c.StorageError(`Failed to delete conversation from database`,{conversationId:e,error:t instanceof Error?t.message:String(t)})}}async clear(){try{this.logger.warn(`Database storage not fully implemented yet`,{connectionString:this.maskConnectionString()})}catch(e){throw new c.StorageError(`Failed to clear conversations from database`,{error:e instanceof Error?e.message:String(e)})}}maskConnectionString(){return this.connectionString.replace(/(:\/\/[^:]+:)[^@]+(@)/,`$1***$2`)}};function ee(e){if(!e.storage)throw new c.ConfigurationError(`Storage strategy is required`);if(![`memory`,`file`,`database`].includes(e.storage))throw new c.ConfigurationError(`Invalid storage strategy`,{validStrategies:[`memory`,`file`,`database`],provided:e.storage});if(e.storage===`file`&&!e.filePath)throw new c.ConfigurationError(`File path is required for file storage strategy`);if(e.storage===`database`&&!e.connectionString)throw new c.ConfigurationError(`Connection string is required for database storage strategy`);if(e.maxConversations!==void 0&&e.maxConversations<=0)throw new c.ConfigurationError(`Max conversations must be positive`);if(e.maxMessagesPerConversation!==void 0&&e.maxMessagesPerConversation<=0)throw new c.ConfigurationError(`Max messages per conversation must be positive`)}async function p(e,t,n,r){try{let n=await e.load(t);return r.debug(`Loaded conversation`,{conversationId:t,found:!!n,messageCount:n?.messages.length??0}),n}catch(e){throw new c.PluginError(`Failed to load conversation`,n,{conversationId:t,error:e instanceof Error?e.message:String(e)})}}async function te(e,t,n,r){if(t.size===0)return;let i=Array.from(t);r.debug(`Saving pending conversations`,{count:i.length});for(let n of i)try{let r=await e.load(n);r&&await e.save(n,r),t.delete(n)}catch(e){r.error(`Failed to save pending conversation`,{conversationId:n,error:e instanceof Error?e.message:String(e)})}}function m(e,t,n,r){switch(e){case`memory`:return new u(t);case`file`:return new d(n);case`database`:return new f(r);default:throw new c.ConfigurationError(`Unknown storage strategy`,{strategy:e})}}var ne=class extends c.AbstractPlugin{name=`ConversationHistoryPlugin`;version=`1.0.0`;storage;pluginOptions;logger;currentConversationId;batchSaveTimer;pendingSaves=new Set;constructor(e){super(),this.logger=(0,c.createLogger)(`ConversationHistoryPlugin`),this.category=c.PluginCategory.STORAGE,this.priority=c.PluginPriority.HIGH,ee(e),this.pluginOptions={enabled:e.enabled??!0,storage:e.storage,maxConversations:e.maxConversations??100,maxMessagesPerConversation:e.maxMessagesPerConversation??1e3,filePath:e.filePath??`./conversations.json`,connectionString:e.connectionString??``,autoSave:e.autoSave??!0,saveInterval:e.saveInterval??3e4,category:e.category??c.PluginCategory.STORAGE,priority:e.priority??c.PluginPriority.HIGH,moduleEvents:e.moduleEvents??[],subscribeToAllModuleEvents:e.subscribeToAllModuleEvents??!1},this.storage=m(this.pluginOptions.storage,this.pluginOptions.maxConversations,this.pluginOptions.filePath,this.pluginOptions.connectionString),this.pluginOptions.autoSave||this.setupBatchSaving(),this.logger.info(`ConversationHistoryPlugin initialized`,{storage:this.pluginOptions.storage,maxConversations:this.pluginOptions.maxConversations,autoSave:this.pluginOptions.autoSave})}async startConversation(e){try{this.currentConversationId=e;let t={conversationId:e,messages:[],startTime:new Date,lastUpdated:new Date,metadata:{}};await this.storage.save(e,t),this.pluginOptions.autoSave||this.pendingSaves.add(e),this.logger.debug(`Started new conversation`,{conversationId:e})}catch(t){throw new c.PluginError(`Failed to start conversation`,this.name,{conversationId:e,error:t instanceof Error?t.message:String(t)})}}async addMessage(e){if(!this.currentConversationId)throw new c.PluginError(`No active conversation`,this.name);try{let t=await this.storage.load(this.currentConversationId)||{conversationId:this.currentConversationId,messages:[],startTime:new Date,lastUpdated:new Date,metadata:{}};t.messages.push(e),t.messages.length>this.pluginOptions.maxMessagesPerConversation&&(t.messages=t.messages.slice(-this.pluginOptions.maxMessagesPerConversation)),t.lastUpdated=new Date,await this.storage.save(this.currentConversationId,t),this.pluginOptions.autoSave||this.pendingSaves.add(this.currentConversationId),this.logger.debug(`Added message to conversation`,{conversationId:this.currentConversationId,messageRole:e.role,messageLength:e.content?.length??0})}catch(e){throw new c.PluginError(`Failed to add message to conversation`,this.name,{conversationId:this.currentConversationId,error:e instanceof Error?e.message:String(e)})}}async loadConversation(e){return p(this.storage,e,this.name,this.logger)}async getHistory(e){return(await this.loadConversation(e))?.messages??[]}async listConversations(){try{return await this.storage.list()}catch(e){throw new c.PluginError(`Failed to list conversations`,this.name,{error:e instanceof Error?e.message:String(e)})}}async deleteConversation(e){try{let t=await this.storage.delete(e);return this.pendingSaves.delete(e),this.logger.debug(`Deleted conversation`,{conversationId:e,deleted:t}),t}catch(t){throw new c.PluginError(`Failed to delete conversation`,this.name,{conversationId:e,error:t instanceof Error?t.message:String(t)})}}async clearAllConversations(){try{await this.storage.clear(),this.pendingSaves.clear(),this.logger.info(`Cleared all conversations`)}catch(e){throw new c.PluginError(`Failed to clear conversations`,this.name,{error:e instanceof Error?e.message:String(e)})}}async savePending(){await te(this.storage,this.pendingSaves,this.name,this.logger)}async destroy(){try{(0,c.stopPeriodicTask)(this.batchSaveTimer),this.batchSaveTimer=void 0,await this.savePending(),this.logger.info(`ConversationHistoryPlugin destroyed`)}catch(e){this.logger.error(`Error during plugin cleanup`,{error:e instanceof Error?e.message:String(e)})}}setupBatchSaving(){this.batchSaveTimer=(0,c.startPeriodicTask)(this.logger,{name:`ConversationHistoryPlugin.savePending`,intervalMs:this.pluginOptions.saveInterval},async()=>{await this.savePending()})}};function h(e){return{...e.executionId&&{executionId:e.executionId},...e.sessionId&&{sessionId:e.sessionId},...e.userId&&{userId:e.userId},...e.attempt!==void 0&&{attempt:e.attempt},...e.originalError&&{originalError:e.originalError}}}function g(e,t){return{...h(e),...t&&{...t}}}function re(e){if(!e.strategy)throw new c.ConfigurationError(`Error handling strategy is required`);if(![`simple`,`circuit-breaker`,`exponential-backoff`,`silent`].includes(e.strategy))throw new c.ConfigurationError(`Invalid error handling strategy`,{validStrategies:[`simple`,`circuit-breaker`,`exponential-backoff`,`silent`],provided:e.strategy});if(e.maxRetries!==void 0&&e.maxRetries<0)throw new c.ConfigurationError(`Max retries must be non-negative`);if(e.retryDelay!==void 0&&e.retryDelay<=0)throw new c.ConfigurationError(`Retry delay must be positive`)}function ie(e,t,n){return e===`exponential-backoff`?t*2**(n-1):t}function ae(e,t,n){return e?Date.now()-t>n?{open:!1,shouldReset:!0}:{open:!0,shouldReset:!1}:{open:!1,shouldReset:!1}}function oe(e){return new Promise(t=>setTimeout(t,e))}var _=class extends c.AbstractPlugin{name=`ErrorHandlingPlugin`;version=`1.0.0`;pluginOptions;logger;failureCount=0;circuitBreakerOpen=!1;lastFailureTime=0;constructor(e){super(),this.logger=(0,c.createLogger)(`ErrorHandlingPlugin`),re(e),this.pluginOptions={enabled:e.enabled??!0,strategy:e.strategy,maxRetries:e.maxRetries??3,retryDelay:e.retryDelay??1e3,logErrors:e.logErrors??!0,failureThreshold:e.failureThreshold??5,circuitBreakerTimeout:e.circuitBreakerTimeout??6e4,category:e.category??c.PluginCategory.ERROR_HANDLING,priority:e.priority??c.PluginPriority.HIGH,moduleEvents:e.moduleEvents??[],subscribeToAllModuleEvents:e.subscribeToAllModuleEvents??!1,...e.customErrorHandler&&{customErrorHandler:e.customErrorHandler}},this.logger.info(`ErrorHandlingPlugin initialized`,{strategy:this.pluginOptions.strategy,maxRetries:this.pluginOptions.maxRetries,failureThreshold:this.pluginOptions.failureThreshold})}async handleError(e,t={}){if(this.pluginOptions.logErrors&&this.logger.error(`Error occurred`,{error:e.message,stack:e.stack,context:t}),this.pluginOptions.customErrorHandler)try{await this.pluginOptions.customErrorHandler(e,t);return}catch(e){this.logger.error(`Custom error handler failed`,{handlerError:e instanceof Error?e.message:String(e)})}switch(this.pluginOptions.strategy){case`circuit-breaker`:await this.handleCircuitBreaker(e,t);break;case`exponential-backoff`:await this.handleExponentialBackoff(e,t);break;case`simple`:await this.handleSimple(e,t);break;case`silent`:break}}async executeWithRetry(e,t={}){let n,r=0;for(;r<=this.pluginOptions.maxRetries;)try{if(this.pluginOptions.strategy===`circuit-breaker`){let e=ae(this.circuitBreakerOpen,this.lastFailureTime,this.pluginOptions.circuitBreakerTimeout);if(e.shouldReset&&(this.circuitBreakerOpen=!1,this.failureCount=0,this.logger.info(`Circuit breaker timeout passed, attempting to close`)),e.open)throw new c.PluginError(`Circuit breaker is open`,this.name,h(t))}let n=await e();return r>0&&(this.failureCount=0,this.circuitBreakerOpen=!1,this.logger.info(`Operation succeeded after retry`,{attempt:r,context:t})),n}catch(e){if(n=e instanceof Error?e:Error(String(e)),r++,r<=this.pluginOptions.maxRetries){await this.handleError(n,{...t,attempt:r});let e=ie(this.pluginOptions.strategy,this.pluginOptions.retryDelay,r);this.logger.debug(`Retrying operation`,{attempt:r,delay:e,context:t}),await oe(e)}else await this.handleError(n,{...t,finalAttempt:!0})}throw new c.PluginError(`Operation failed after ${this.pluginOptions.maxRetries} retries`,this.name,g(t,{originalError:n?.message||`Unknown error`}))}resetCircuitBreaker(){this.failureCount=0,this.circuitBreakerOpen=!1,this.lastFailureTime=0,this.logger.info(`Circuit breaker reset`)}getStats(){return{...super.getStats(),failureCount:this.failureCount,circuitBreakerOpen:this.circuitBreakerOpen,lastFailureTime:this.lastFailureTime,totalRetries:0,successfulRecoveries:0}}async destroy(){this.logger.info(`ErrorHandlingPlugin destroyed`)}async handleSimple(e,t){this.logger.debug(`Simple error handling applied`,{error:e.message,context:t})}async handleCircuitBreaker(e,t){this.failureCount++,this.lastFailureTime=Date.now(),this.failureCount>=this.pluginOptions.failureThreshold&&(this.circuitBreakerOpen=!0,this.logger.warn(`Circuit breaker opened`,{failureCount:this.failureCount,threshold:this.pluginOptions.failureThreshold,context:t}))}async handleExponentialBackoff(e,t){this.failureCount++,this.logger.debug(`Exponential backoff error handling applied`,{error:e.message,failureCount:this.failureCount,context:t})}};function v(e,t){if(e.length===0)return{totalExecutions:0,successfulExecutions:0,failedExecutions:0,successRate:0,averageDuration:0,totalDuration:0,operationStats:{},errorStats:{},timeRange:t||{start:new Date,end:new Date}};let n=e.length,r=e.filter(e=>e.success).length,i=n-r,a=e.reduce((e,t)=>e+t.duration,0),o=a/n,s={};for(let t of e){s[t.operation]||(s[t.operation]={count:0,successCount:0,failureCount:0,totalDuration:0,averageDuration:0});let e=s[t.operation];e&&(e.count++,e.totalDuration+=t.duration,t.success?e.successCount++:e.failureCount++)}for(let e in s){let t=s[e];t&&t.count>0&&(t.averageDuration=t.totalDuration/t.count)}let c={};for(let t of e.filter(e=>!e.success&&e.error)){let e=t.error.type;c[e]=(c[e]||0)+1}return{totalExecutions:n,successfulExecutions:r,failedExecutions:i,successRate:n>0?r/n:0,averageDuration:o,totalDuration:a,operationStats:s,errorStats:c,timeRange:t||{start:e[0]?.startTime||new Date,end:e[e.length-1]?.endTime||new Date}}}function se(e,t){e.maxEntries!==void 0&&e.maxEntries<1&&(t.maxEntries=1e3),e.performanceThreshold!==void 0&&e.performanceThreshold<0&&(t.performanceThreshold=5e3)}function y(e,t){return`${e}-${Date.now()}-${t}`}function b(e,t,n,r,i){let a=Date.now()-t.startTime,o=r?{message:n.message,...n.stack&&{stack:n.stack},type:n.constructor.name}:void 0;return{executionId:e,operation:t.operation,startTime:new Date(t.startTime),endTime:new Date,duration:a,success:!1,...o&&{error:o},metadata:{errorSource:`onError-hook`,contextType:i?typeof i:`none`,hasContext:!!i}}}function x(e,t,n){for(let[r,i]of e.entries())if(i.operation===t){if(t===`run`&&n&&i.input!==n)continue;return{executionId:r,executionData:i}}}var S=class extends c.AbstractPlugin{name=`ExecutionAnalyticsPlugin`;version=`1.0.0`;pluginOptions;logger;activeExecutions=new Map;executionHistory=[];executionCounter=0;initialized=!1;constructor(e={}){super(),this.category=c.PluginCategory.MONITORING,this.priority=c.PluginPriority.NORMAL,this.pluginOptions={enabled:e.enabled??!0,maxEntries:e.maxEntries||1e3,trackErrors:e.trackErrors??!0,performanceThreshold:e.performanceThreshold||5e3,enableWarnings:e.enableWarnings??!0,category:e.category??c.PluginCategory.MONITORING,priority:e.priority??c.PluginPriority.NORMAL,moduleEvents:e.moduleEvents??[],subscribeToAllModuleEvents:e.subscribeToAllModuleEvents??!1},se(e,this.pluginOptions),this.logger=(0,c.createLogger)(`ExecutionAnalyticsPlugin`),this.beforeRun=this.beforeRun.bind(this),this.afterRun=this.afterRun.bind(this),this.beforeProviderCall=this.beforeProviderCall.bind(this),this.afterProviderCall=this.afterProviderCall.bind(this),this.initialized=!0}beforeRun=async(e,t)=>{this.activeExecutions.set(y(`exec`,++this.executionCounter),{startTime:Date.now(),operation:`run`,input:e.substring(0,100)})};afterRun=async(e,t,n)=>{let r=x(this.activeExecutions,`run`,e);if(!r)return;let{executionId:i,executionData:a}=r,o=Date.now()-a.startTime;this.recordStats({executionId:i,operation:`run`,startTime:new Date(a.startTime),endTime:new Date,duration:o,success:!0,metadata:{inputLength:e.length,responseLength:t.length,hasOptions:!!n,modelName:String(n?.metadata?.model||`unknown`)}}),this.activeExecutions.delete(i),this.pluginOptions.enableWarnings&&o>this.pluginOptions.performanceThreshold&&this.logger.warn(`Slow run execution detected`,{executionId:i,duration:o,threshold:this.pluginOptions.performanceThreshold})};beforeProviderCall=async e=>{this.activeExecutions.set(y(`provider`,++this.executionCounter),{startTime:Date.now(),operation:`provider-call`,input:e[0]?.content||`N/A`})};afterProviderCall=async(e,t)=>{let n=x(this.activeExecutions,`provider-call`,e[0]?.content||``);if(!n)return;let{executionId:r,executionData:i}=n,a=Date.now()-i.startTime;this.recordStats({executionId:r,operation:`provider-call`,startTime:new Date(i.startTime),endTime:new Date,duration:a,success:!0,metadata:{inputLength:e[0]?.content?.length||0,responseLength:t.content?.length||0,hasToolCalls:!!((0,c.isAssistantMessage)(t)&&t.toolCalls&&t.toolCalls.length>0),toolCallCount:(0,c.isAssistantMessage)(t)&&t.toolCalls?t.toolCalls.length:0}}),this.activeExecutions.delete(r),this.pluginOptions.enableWarnings&&a>this.pluginOptions.performanceThreshold&&this.logger.warn(`Slow provider call detected`,{executionId:r,duration:a,threshold:this.pluginOptions.performanceThreshold})};async beforeToolCall(e,t){this.activeExecutions.set(y(`tool`,++this.executionCounter),{startTime:Date.now(),operation:`tool-call`,input:e})}async afterToolCall(e,t,n){let r=x(this.activeExecutions,`tool-call`,e);if(!r)return;let{executionId:i,executionData:a}=r,o=Date.now()-a.startTime,s=!n?.error,c=n?.error&&this.pluginOptions.trackErrors?{message:String(n.error),type:`ToolExecutionError`}:void 0;this.recordStats({executionId:i,operation:`tool-call`,startTime:new Date(a.startTime),endTime:new Date,duration:o,success:s,...c&&{error:c},metadata:{toolName:e,parameterCount:Object.keys(t).length,resultType:typeof n,hasError:!!n?.error}}),this.activeExecutions.delete(i)}async onError(e,t){let n=Array.from(this.activeExecutions.entries())[0];if(n){let[r,i]=n;this.recordStats(b(r,i,e,this.pluginOptions.trackErrors,t)),this.activeExecutions.delete(r)}}getExecutionStats(e,t){let n=this.executionHistory;return e&&(n=n.filter(t=>t.operation===e)),t&&(n=n.filter(e=>e.startTime>=t.start&&e.startTime<=t.end)),[...n]}getAggregatedStats(e){return v(this.getExecutionStats(void 0,e),e)}clearStats(){this.executionHistory=[],this.activeExecutions.clear(),this.executionCounter=0}getActiveExecutions(){let e=Date.now();return Array.from(this.activeExecutions.entries()).map(([t,n])=>({executionId:t,operation:n.operation,duration:e-n.startTime}))}getPluginStats(){let e=this.executionHistory[0],t=this.executionHistory[this.executionHistory.length-1];return{totalRecorded:this.executionHistory.length,activeExecutions:this.activeExecutions.size,memoryUsage:this.executionHistory.length+this.activeExecutions.size,...e&&{oldestRecord:e.startTime},...t&&{newestRecord:t.endTime}}}async destroy(){this.clearStats()}getExecutionData(){return[...this.executionHistory]}getAnalyticsStats(){return this.getAggregatedStats()}clearExecutionData(){this.clearStats()}getStatus(){return{name:this.name,version:this.version,enabled:this.enabled,initialized:this.initialized,category:this.category,priority:this.priority,subscribedEventsCount:this.subscribedEvents.length,hasEventEmitter:!!this.eventEmitter}}getStats(){let e=this.executionHistory[this.executionHistory.length-1],t=this.executionHistory[0];return{enabled:this.enabled,calls:this.executionHistory.length,errors:this.executionHistory.filter(e=>!e.success).length,...e?.endTime&&{lastActivity:e.endTime},totalRecorded:this.executionHistory.length,activeExecutions:this.activeExecutions.size,memoryUsage:this.executionHistory.length+this.activeExecutions.size,...t&&{oldestRecord:t.startTime},...e&&{newestRecord:e.endTime}}}recordStats(e){this.executionHistory.push(e),this.executionHistory.length>this.pluginOptions.maxEntries&&this.executionHistory.shift()}};const C={"gpt-4":.03,"gpt-4-turbo":.01,"gpt-3.5-turbo":.002,"claude-3-opus":.015,"claude-3-sonnet":.003,"claude-3-haiku":25e-5};function ce(e,t,n){return e/1e3*(C[t]??n)}function le(e){return Math.ceil(e.reduce((e,t)=>e+(t.content?.length||0),0)/4)+100}function ue(e,t,n,r,i,a){let o=(t-e.lastRefill)/1e3;if(e.tokens=Math.min(i.bucketSize,e.tokens+o*i.refillRate),e.lastRefill=t,e.tokens<n)throw new c.PluginError(`Token bucket depleted. Available: ${Math.floor(e.tokens)}, Required: ${n}`,a,{availableTokens:e.tokens,requiredTokens:n});if(t-e.windowStart>=i.timeWindow&&(e.requests=0,e.cost=0,e.windowStart=t),e.requests>=i.maxRequests)throw new c.PluginError(`Request limit exceeded. Max: ${i.maxRequests}`,a,{currentRequests:e.requests,maxRequests:i.maxRequests});if(e.cost+r>i.maxCost)throw new c.PluginError(`Cost limit exceeded. Current: $${e.cost.toFixed(4)}, Estimated: $${r.toFixed(4)}, Max: $${i.maxCost}`,a,{currentCost:e.cost,estimatedCost:r,maxCost:i.maxCost});e.tokens-=n,e.requests++}function de(e,t,n,r,i,a){if(t-e.windowStart<i.timeWindow){if(e.tokens+n>i.maxTokens)throw new c.PluginError(`Token limit exceeded in sliding window. Current: ${e.tokens}, Estimated: ${n}, Max: ${i.maxTokens}`,a,{currentTokens:e.tokens,estimatedTokens:n,maxTokens:i.maxTokens});if(e.count>=i.maxRequests)throw new c.PluginError(`Request limit exceeded in sliding window. Current: ${e.count}, Max: ${i.maxRequests}`,a,{currentRequests:e.count,maxRequests:i.maxRequests});if(e.cost+r>i.maxCost)throw new c.PluginError(`Cost limit exceeded in sliding window. Current: $${e.cost.toFixed(4)}, Estimated: $${r.toFixed(4)}, Max: $${i.maxCost}`,a,{currentCost:e.cost,estimatedCost:r,maxCost:i.maxCost})}else e.count=0,e.tokens=0,e.cost=0,e.windowStart=t;e.count++}function fe(e,t,n,r,i,a){if(t-e.windowStart>=i.timeWindow&&(e.count=0,e.tokens=0,e.cost=0,e.windowStart=t),e.tokens+n>i.maxTokens)throw new c.PluginError(`Token limit exceeded in fixed window. Current: ${e.tokens}, Estimated: ${n}, Max: ${i.maxTokens}`,a,{currentTokens:e.tokens,estimatedTokens:n,maxTokens:i.maxTokens});if(e.count>=i.maxRequests)throw new c.PluginError(`Request limit exceeded in fixed window. Current: ${e.count}, Max: ${i.maxRequests}`,a,{currentRequests:e.count,maxRequests:i.maxRequests});if(e.cost+r>i.maxCost)throw new c.PluginError(`Cost limit exceeded in fixed window. Current: $${e.cost.toFixed(4)}, Estimated: $${r.toFixed(4)}, Max: $${i.maxCost}`,a,{currentCost:e.cost,estimatedCost:r,maxCost:i.maxCost});e.count++}function pe(e,t,n){if(e.strategy===`none`){n.info(`LimitsPlugin configured with "none" strategy - no rate limiting will be applied`);return}if(!e.strategy)throw new c.PluginError(`Strategy must be specified for limits plugin. Use "none" to disable rate limiting, or choose from: token-bucket, sliding-window, fixed-window`,t,{availableStrategies:[`none`,`token-bucket`,`sliding-window`,`fixed-window`]});let r=[`none`,`token-bucket`,`sliding-window`,`fixed-window`];if(!r.includes(e.strategy))throw new c.PluginError(`Invalid strategy "${e.strategy}". Must be one of: ${r.join(`, `)}`,t,{provided:e.strategy,validStrategies:r});if(e.strategy===`token-bucket`){if(e.bucketSize!==void 0&&e.bucketSize<=0)throw new c.PluginError(`Bucket size must be positive for token-bucket strategy`,t,{strategy:e.strategy,bucketSize:e.bucketSize});if(e.refillRate!==void 0&&e.refillRate<0)throw new c.PluginError(`Refill rate must be non-negative for token-bucket strategy`,t,{strategy:e.strategy,refillRate:e.refillRate})}if([`sliding-window`,`fixed-window`].includes(e.strategy)&&e.timeWindow!==void 0&&e.timeWindow<=0)throw new c.PluginError(`Time window must be positive for ${e.strategy} strategy`,t,{strategy:e.strategy,timeWindow:e.timeWindow});if(e.maxRequests!==void 0&&e.maxRequests<0)throw new c.PluginError(`Max requests must be non-negative`,t,{strategy:e.strategy,maxRequests:e.maxRequests});if(e.maxTokens!==void 0&&e.maxTokens<0)throw new c.PluginError(`Max tokens must be non-negative`,t,{strategy:e.strategy,maxTokens:e.maxTokens});if(e.maxCost!==void 0&&e.maxCost<0)throw new c.PluginError(`Max cost must be non-negative`,t,{strategy:e.strategy,maxCost:e.maxCost});if(e.tokenCostPer1000!==void 0&&e.tokenCostPer1000<0)throw new c.PluginError(`Token cost per 1000 must be non-negative`,t,{strategy:e.strategy,tokenCostPer1000:e.tokenCostPer1000})}var me=class extends c.AbstractPlugin{name=`LimitsPlugin`;version=`1.0.0`;pluginOptions;logger;windows=new Map;buckets=new Map;constructor(e){super(),this.logger=(0,c.createLogger)(`LimitsPlugin`),pe(e,this.name,this.logger),this.pluginOptions={enabled:e.enabled??!0,strategy:e.strategy,maxTokens:e.maxTokens??1e5,maxRequests:e.maxRequests??1e3,timeWindow:e.timeWindow??36e5,maxCost:e.maxCost??10,tokenCostPer1000:e.tokenCostPer1000??.002,refillRate:e.refillRate??100,bucketSize:e.bucketSize??1e4,costCalculator:e.costCalculator??((e,t)=>ce(e,t,this.pluginOptions.tokenCostPer1000)),category:e.category??c.PluginCategory.LIMITS,priority:e.priority??c.PluginPriority.NORMAL,moduleEvents:e.moduleEvents??[],subscribeToAllModuleEvents:e.subscribeToAllModuleEvents??!1}}async beforeExecution(e){if(this.pluginOptions.strategy===`none`)return;let t=this.getKey(e),n=Date.now(),r=le(e.messages??[]),i=this.pluginOptions.costCalculator(r,this.resolveModelName(e));switch(this.pluginOptions.strategy){case`token-bucket`:ue(this.getBucket(t),n,r,i,this.pluginOptions,this.name);break;case`sliding-window`:de(this.getWindow(t),n,r,i,this.pluginOptions,this.name);break;case`fixed-window`:fe(this.getWindow(t),n,r,i,this.pluginOptions,this.name);break}}async afterExecution(e,t){if(this.pluginOptions.strategy===`none`)return;let n=this.getKey(e),r=t?.tokensUsed||0,i=this.pluginOptions.costCalculator(r,this.resolveModelName(e));switch(this.pluginOptions.strategy){case`token-bucket`:this.getBucket(n).cost+=i;break;case`sliding-window`:case`fixed-window`:{let e=this.getWindow(n);e.tokens+=r,e.cost+=i;break}}}getBucket(e){return this.buckets.has(e)||this.buckets.set(e,{tokens:this.pluginOptions.bucketSize,lastRefill:Date.now(),requests:0,cost:0,windowStart:Date.now()}),this.buckets.get(e)}getWindow(e){return this.windows.has(e)||this.windows.set(e,{count:0,tokens:0,cost:0,windowStart:Date.now()}),this.windows.get(e)}getKey(e){return e.userId||e.sessionId||e.executionId||`default`}resolveModelName(e){let t=e.config?.model;return typeof t==`string`&&t.length>0?t:`unknown`}getLimitsStatus(e){if(e){let t=this.buckets.get(e),n=this.windows.get(e);return{strategy:this.pluginOptions.strategy,key:e,bucket:t?{availableTokens:Math.floor(t.tokens),requests:t.requests,cost:t.cost}:null,window:n?{count:n.count,tokens:n.tokens,cost:n.cost,windowStart:n.windowStart}:null}}return{strategy:this.pluginOptions.strategy,totalKeys:this.buckets.size+this.windows.size,bucketKeys:Array.from(this.buckets.keys()),windowKeys:Array.from(this.windows.keys())}}resetLimits(e){e?(this.buckets.delete(e),this.windows.delete(e)):(this.buckets.clear(),this.windows.clear())}},w=class{format(e){let t=e.timestamp.toISOString(),n=e.level.toUpperCase().padStart(5),r=e.context?` | ${JSON.stringify(e.context)}`:``,i=e.metadata?` | ${JSON.stringify(e.metadata)}`:``;return`[${t}] ${n} | ${e.message}${r}${i}`}},T=class{format(e){return JSON.stringify({...e,timestamp:e.timestamp.toISOString()})}},E=class{formatter;logger;constructor(e,t){this.formatter=e||new w,this.logger=t||c.SilentLogger}async write(e){let t=this.formatter.format(e);switch(e.level){case`debug`:this.logger.debug(t);break;case`info`:this.logger.info(t);break;case`warn`:this.logger.warn(t);break;case`error`:this.logger.error(t);break}}async flush(){}async close(){}},D=class{filePath;formatter;logger;constructor(e,t){this.filePath=e,this.formatter=t||new T,this.logger=(0,c.createLogger)(`FileLogStorage`)}async write(e){try{this.logger.warn(`File logging not fully implemented yet`,{filePath:this.filePath,entry:this.formatter.format(e)})}catch(e){throw new c.PluginError(`Failed to write log to file`,`LoggingPlugin`,{filePath:this.filePath,error:e instanceof Error?e.message:String(e)})}}async flush(){this.logger.warn(`File flush not fully implemented yet`)}async close(){this.logger.warn(`File close not fully implemented yet`)}},O=class{url;formatter;batchSize;flushInterval;pendingLogs=[];flushTimer;logger;constructor(e,t={}){this.url=e,this.formatter=new T,this.batchSize=10,this.flushInterval=5e3,this.logger=(0,c.createLogger)(`RemoteLogStorage`),this.flushTimer=(0,c.startPeriodicTask)(this.logger,{name:`RemoteLogStorage.flush`,intervalMs:this.flushInterval},async()=>{await this.flush()})}async write(e){this.pendingLogs.push(e),this.pendingLogs.length>=this.batchSize&&await this.flush()}async flush(){if(this.pendingLogs.length===0)return;let e=[...this.pendingLogs];this.pendingLogs=[];try{this.logger.warn(`Remote logging not fully implemented yet`,{url:this.url,logCount:e.length,logs:e.map(e=>this.formatter.format(e))})}catch(t){throw new c.PluginError(`Failed to send logs to remote endpoint`,`LoggingPlugin`,{url:this.url,logCount:e.length,error:t instanceof Error?t.message:String(t)})}}async close(){(0,c.stopPeriodicTask)(this.flushTimer),this.flushTimer=void 0,await this.flush()}},k=class{async write(e){}async flush(){}async close(){}};function A(e){if(!e.strategy)throw new c.ConfigurationError(`Logging strategy is required`);if(![`console`,`file`,`remote`,`silent`].includes(e.strategy))throw new c.ConfigurationError(`Invalid logging strategy`,{validStrategies:[`console`,`file`,`remote`,`silent`],provided:e.strategy});if(e.level&&![`debug`,`info`,`warn`,`error`].includes(e.level))throw new c.ConfigurationError(`Invalid log level`,{validLevels:[`debug`,`info`,`warn`,`error`],provided:e.level});if(e.strategy===`file`&&!e.filePath)throw new c.ConfigurationError(`File path is required for file logging strategy`);if(e.strategy===`remote`&&!e.remoteEndpoint)throw new c.ConfigurationError(`Remote endpoint is required for remote logging strategy`);if(e.maxLogs!==void 0&&e.maxLogs<=0)throw new c.ConfigurationError(`Max logs must be positive`);if(e.batchSize!==void 0&&e.batchSize<=0)throw new c.ConfigurationError(`Batch size must be positive`);if(e.flushInterval!==void 0&&e.flushInterval<=0)throw new c.ConfigurationError(`Flush interval must be positive`)}function j(e,t,n,r,i){switch(e){case`console`:return new E(i);case`file`:return new D(t,i);case`remote`:return new O(n,{timeout:r});case`silent`:return new k;default:throw new c.ConfigurationError(`Unknown logging strategy`,{strategy:e})}}const M=new Map([[c.EVENT_EMITTER_EVENTS.MODULE_INITIALIZE_START,{level:`info`,message:`Module initialization started`,operation:`module_initialize_start`}],[c.EVENT_EMITTER_EVENTS.MODULE_INITIALIZE_COMPLETE,{level:`info`,message:`Module initialization completed`,operation:`module_initialize_complete`}],[c.EVENT_EMITTER_EVENTS.MODULE_INITIALIZE_ERROR,{level:`error`,message:`Module initialization failed`,operation:`module_initialize_error`}],[c.EVENT_EMITTER_EVENTS.MODULE_EXECUTION_START,{level:`debug`,message:`Module execution started`,operation:`module_execution_start`}],[c.EVENT_EMITTER_EVENTS.MODULE_EXECUTION_COMPLETE,{level:`debug`,message:`Module execution completed`,operation:`module_execution_complete`}],[c.EVENT_EMITTER_EVENTS.MODULE_EXECUTION_ERROR,{level:`error`,message:`Module execution failed`,operation:`module_execution_error`}],[c.EVENT_EMITTER_EVENTS.MODULE_DISPOSE_START,{level:`debug`,message:`Module disposal started`,operation:`module_dispose_start`}],[c.EVENT_EMITTER_EVENTS.MODULE_DISPOSE_COMPLETE,{level:`info`,message:`Module disposal completed`,operation:`module_dispose_complete`}],[c.EVENT_EMITTER_EVENTS.MODULE_DISPOSE_ERROR,{level:`error`,message:`Module disposal failed`,operation:`module_dispose_error`}]]);function N(e){let t=typeof e==`object`&&e?e:{};return{moduleName:typeof t.moduleName==`string`?t.moduleName:`unknown`,moduleType:typeof t.moduleType==`string`?t.moduleType:`unknown`,...typeof t.duration==`number`&&{duration:t.duration},...typeof t.success==`boolean`&&{success:t.success}}}async function P(e,t,n,r){await e.info(`Execution started`,{userInput:n.substring(0,100)},{executionId:t,operation:`execution_start`,...r})}async function F(e,t,n,r){await e.info(`Execution completed`,{duration:n},{executionId:t,operation:`execution_complete`,...n!==void 0&&{duration:n},...r})}async function I(e,t,n,r,i,a){let o=i?`Tool executed successfully`:`Tool execution failed`,s=i?`info`:`error`,c={executionId:n,operation:`tool_execution`,...r!==void 0&&{duration:r},...a&&typeof a==`object`?a:{}};await e.log(s,o,{toolName:t,success:i??!1},c)}var L=class extends c.AbstractPlugin{name=`LoggingPlugin`;version=`1.0.0`;storage;pluginOptions;logger;simpleLogger;logLevels=[`debug`,`info`,`warn`,`error`];constructor(e){super(),this.logger=(0,c.createLogger)(`LoggingPlugin`),this.simpleLogger=e.logger||c.SilentLogger,this.category=c.PluginCategory.LOGGING,this.priority=c.PluginPriority.HIGH,A(e),this.pluginOptions={enabled:e.enabled??!0,strategy:e.strategy,level:e.level??`info`,filePath:e.filePath??`./agent.log`,remoteEndpoint:e.remoteEndpoint??``,remoteHeaders:e.remoteHeaders??{},maxLogs:e.maxLogs??1e4,includeStackTrace:e.includeStackTrace??!0,...e.formatter&&{formatter:e.formatter},batchSize:e.batchSize??100,flushInterval:e.flushInterval??3e4,category:e.category??c.PluginCategory.LOGGING,priority:e.priority??c.PluginPriority.HIGH,moduleEvents:e.moduleEvents??[],subscribeToAllModuleEvents:e.subscribeToAllModuleEvents??!1},this.storage=j(this.pluginOptions.strategy,this.pluginOptions.filePath,this.pluginOptions.remoteEndpoint,this.pluginOptions.flushInterval,this.pluginOptions.formatter),this.logger.info(`LoggingPlugin initialized`,{strategy:this.pluginOptions.strategy,level:this.pluginOptions.level,maxLogs:this.pluginOptions.maxLogs})}async onModuleEvent(e,t){try{let n=M.get(e);if(!n)return;let{moduleName:r,moduleType:i,duration:a,success:o}=N(t.data),s={moduleName:r,moduleType:i};a!==void 0&&(s.duration=a),o!==void 0&&(s.success=o);let c={operation:n.operation};t.executionId&&(c.executionId=t.executionId),a!==void 0&&(c.duration=a),n.level===`error`?await this.error(n.message,t.error,s,c):await this.log(n.level,n.message,s,c)}catch(t){this.simpleLogger.error(`LoggingPlugin failed to handle module event ${e}:`,t instanceof Error?t:Error(String(t)))}}async log(e,t,n,r){if(this.shouldLog(e))try{let i={timestamp:new Date,level:e,message:t,...n&&{context:n},...r&&{metadata:r}};await this.storage.write(i)}catch(e){this.simpleLogger.error(`Logging failed:`,e instanceof Error?e:Error(String(e)))}}async debug(e,t,n){await this.log(`debug`,e,t,n)}async info(e,t,n){await this.log(`info`,e,t,n)}async warn(e,t,n){await this.log(`warn`,e,t,n)}async error(e,t,n,r){let i={...n,...t&&this.pluginOptions.includeStackTrace?{errorMessage:t.message,errorStack:t.stack}:{}};await this.log(`error`,e,i,r)}async logExecutionStart(e,t,n){await P(this,e,t,n)}async logExecutionComplete(e,t,n){await F(this,e,t,n)}async logToolExecution(e,t,n,r,i){await I(this,e,t,n,r,i)}async flush(){try{await this.storage.flush()}catch(e){throw new c.PluginError(`Failed to flush logs`,this.name,{error:e instanceof Error?e.message:String(e)})}}async destroy(){try{await this.storage.close(),this.logger.info(`LoggingPlugin destroyed`)}catch(e){this.logger.error(`Error during plugin cleanup`,{error:e instanceof Error?e.message:String(e)})}}shouldLog(e){let t=this.logLevels.indexOf(this.pluginOptions.level);return this.logLevels.indexOf(e)>=t}},R=class{logger;constructor(){this.logger=(0,c.createLogger)(`NodeSystemMetricsCollector`)}async getMemoryUsage(){try{let e=process.memoryUsage();return{used:e.rss,free:0,total:e.rss+e.external,heap:{used:e.heapUsed,total:e.heapTotal}}}catch(e){this.logger.warn(`Failed to get memory usage`,{error:e instanceof Error?e.message:String(e)});return}}async getCPUUsage(){try{let e=process.cpuUsage();return{user:e.user,system:e.system,percent:0}}catch(e){this.logger.warn(`Failed to get CPU usage`,{error:e instanceof Error?e.message:String(e)});return}}async getNetworkStats(){try{this.logger.warn(`Network stats monitoring not fully implemented yet`);return}catch(e){this.logger.warn(`Failed to get network stats`,{error:e instanceof Error?e.message:String(e)});return}}},z=class{entries=[];maxEntries;constructor(e=5e3){this.maxEntries=e}async save(e){this.entries.length>=this.maxEntries&&(this.entries=this.entries.slice(-this.maxEntries+1)),this.entries.push({...e})}async getMetrics(e,t){let n=[...this.entries];return e&&(n=n.filter(t=>t.operation===e)),t&&(n=n.filter(e=>e.timestamp>=t.start&&e.timestamp<=t.end)),n}async getAggregatedStats(e){let t=await this.getMetrics(void 0,e);if(t.length===0)return{totalOperations:0,averageDuration:0,minDuration:0,maxDuration:0,successRate:0,errorRate:0,operationStats:{},timeRangeStats:{startTime:e?.start||new Date,endTime:e?.end||new Date,period:`empty`}};let n=t.map(e=>e.duration),r=t.filter(e=>e.success).length,i=t.reduce((e,t)=>e+t.errorCount,0);return{totalOperations:t.length,averageDuration:n.reduce((e,t)=>e+t,0)/n.length,minDuration:Math.min(...n),maxDuration:Math.max(...n),successRate:r/t.length,errorRate:i/t.length,operationStats:{},timeRangeStats:{startTime:e?.start||t[0]?.timestamp||new Date,endTime:e?.end||t[t.length-1]?.timestamp||new Date,period:`memory`}}}async clear(){this.entries=[]}async flush(){}async close(){}};function he(e){if(!e.strategy)throw new c.ConfigurationError(`Performance monitoring strategy is required`);if(![`memory`,`file`,`prometheus`,`remote`,`silent`].includes(e.strategy))throw new c.ConfigurationError(`Invalid performance monitoring strategy`,{validStrategies:[`memory`,`file`,`prometheus`,`remote`,`silent`],provided:e.strategy})}function ge(e,t){switch(e){case`memory`:return new z(t);default:throw new c.ConfigurationError(`Performance monitoring strategy is not implemented`,{provided:e})}}const _e=new Map([[c.EVENT_EMITTER_EVENTS.MODULE_INITIALIZE_COMPLETE,{operation:`module_initialization`,phase:`initialization`,isError:!1}],[c.EVENT_EMITTER_EVENTS.MODULE_INITIALIZE_ERROR,{operation:`module_initialization`,phase:`initialization`,isError:!0}],[c.EVENT_EMITTER_EVENTS.MODULE_EXECUTION_COMPLETE,{operation:`module_execution`,phase:`execution`,isError:!1}],[c.EVENT_EMITTER_EVENTS.MODULE_EXECUTION_ERROR,{operation:`module_execution`,phase:`execution`,isError:!0}],[c.EVENT_EMITTER_EVENTS.MODULE_DISPOSE_COMPLETE,{operation:`module_disposal`,phase:`disposal`,isError:!1}],[c.EVENT_EMITTER_EVENTS.MODULE_DISPOSE_ERROR,{operation:`module_disposal`,phase:`disposal`,isError:!0}]]);function ve(e){let t=typeof e==`object`&&e?e:{};return{moduleName:typeof t.moduleName==`string`?t.moduleName:`unknown`,moduleType:typeof t.moduleType==`string`?t.moduleType:`unknown`,...typeof t.duration==`number`&&{duration:t.duration},...typeof t.success==`boolean`&&{success:t.success}}}var ye=class extends c.AbstractPlugin{name=`PerformancePlugin`;version=`1.0.0`;storage;metricsCollector;pluginOptions;logger;constructor(e){super(),this.logger=(0,c.createLogger)(`PerformancePlugin`),this.category=c.PluginCategory.MONITORING,this.priority=c.PluginPriority.NORMAL,he(e),this.pluginOptions={enabled:e.enabled??!0,strategy:e.strategy,filePath:e.filePath??`./performance-metrics.json`,remoteEndpoint:e.remoteEndpoint??``,prometheusEndpoint:e.prometheusEndpoint??`/metrics`,remoteHeaders:e.remoteHeaders??{},maxEntries:e.maxEntries??5e3,monitorMemory:e.monitorMemory??!0,monitorCPU:e.monitorCPU??!0,monitorNetwork:e.monitorNetwork??!1,batchSize:e.batchSize??100,flushInterval:e.flushInterval??3e4,aggregateStats:e.aggregateStats??!0,aggregationInterval:e.aggregationInterval??6e4,performanceThreshold:e.performanceThreshold??1e3,category:e.category??c.PluginCategory.MONITORING,priority:e.priority??c.PluginPriority.NORMAL,moduleEvents:e.moduleEvents??[],subscribeToAllModuleEvents:e.subscribeToAllModuleEvents??!1},this.storage=ge(this.pluginOptions.strategy,this.pluginOptions.maxEntries),this.metricsCollector=new R,this.logger.info(`PerformancePlugin initialized`,{strategy:this.pluginOptions.strategy,monitorMemory:this.pluginOptions.monitorMemory,monitorCPU:this.pluginOptions.monitorCPU,performanceThreshold:this.pluginOptions.performanceThreshold})}async onModuleEvent(e,t){try{let n=_e.get(e);if(!n)return;let{moduleName:r,moduleType:i,duration:a,success:o}=ve(t.data);if(a===void 0)return;await this.recordMetrics({operation:n.operation,duration:a,success:n.isError?!1:o??!0,errorCount:+!!n.isError,...t.executionId&&{executionId:t.executionId},metadata:{moduleName:r,moduleType:i,phase:n.phase,...n.isError&&{error:t.error?.message||`unknown error`}}})}catch{}}async recordMetrics(e){try{let t=this.pluginOptions.monitorMemory?await this.metricsCollector.getMemoryUsage():void 0,n=this.pluginOptions.monitorCPU?await this.metricsCollector.getCPUUsage():void 0,r=this.pluginOptions.monitorNetwork?await this.metricsCollector.getNetworkStats():void 0,i={...e,timestamp:new Date,...t&&{memoryUsage:t},...n&&{cpuUsage:n},...r&&{networkStats:r}};await this.storage.save(i),i.duration>this.pluginOptions.performanceThreshold&&this.logger.warn(`Performance threshold exceeded`,{operation:i.operation,duration:i.duration,threshold:this.pluginOptions.performanceThreshold,executionId:i.executionId}),this.logger.debug(`Performance metrics recorded`,{operation:i.operation,duration:i.duration,success:i.success,memoryUsed:i.memoryUsage?.heap.used})}catch(e){throw new c.PluginError(`Failed to record performance metrics`,this.name,{error:e instanceof Error?e.message:String(e)})}}async getMetrics(e,t){try{return await this.storage.getMetrics(e,t)}catch(n){throw new c.PluginError(`Failed to get performance metrics`,this.name,{operation:e||`all`,timeRange:t?`${t.start.toISOString()}-${t.end.toISOString()}`:`all`,error:n instanceof Error?n.message:String(n)})}}async getAggregatedStats(e){try{return await this.storage.getAggregatedStats(e)}catch(t){throw new c.PluginError(`Failed to get aggregated performance stats`,this.name,{timeRange:e?`${e.start.toISOString()}-${e.end.toISOString()}`:`all`,error:t instanceof Error?t.message:String(t)})}}async clearMetrics(){try{await this.storage.clear(),this.logger.info(`Performance metrics cleared`)}catch(e){throw new c.PluginError(`Failed to clear performance metrics`,this.name,{error:e instanceof Error?e.message:String(e)})}}async destroy(){try{await this.storage.close(),this.logger.info(`PerformancePlugin destroyed`)}catch(e){this.logger.error(`Error during plugin cleanup`,{error:e instanceof Error?e.message:String(e)})}}};function B(e){if(!e)return`all`;let t=(e.end.getTime()-e.start.getTime())/36e5;return t<=1?`hour`:t<=24?`day`:t<=168?`week`:`month`}function be(e,t){if(t)return{startTime:t.start,endTime:t.end,period:B(t)};if(e.length>0){let t=e[0]?.timestamp,n=e[e.length-1]?.timestamp,r=new Date;return{startTime:t??r,endTime:n??r,period:B(void 0)}}let n=new Date;return{startTime:n,endTime:n,period:B(void 0)}}function V(e,t){let n=be(e,t),r={totalRequests:e.length,totalTokens:e.reduce((e,t)=>e+t.tokensUsed.total,0),totalCost:e.reduce((e,t)=>e+(t.cost?.total??0),0),totalDuration:e.reduce((e,t)=>e+t.duration,0),successRate:e.length>0?e.filter(e=>e.success).length/e.length:0,providerStats:{},modelStats:{},toolStats:{},timeRangeStats:n};for(let t of e){r.providerStats[t.provider]||(r.providerStats[t.provider]={requests:0,tokens:0,cost:0,duration:0});let e=r.providerStats[t.provider];e&&(e.requests+=t.requestCount,e.tokens+=t.tokensUsed.total,e.cost+=t.cost?.total??0,e.duration+=t.duration)}for(let t of e){r.modelStats[t.model]||(r.modelStats[t.model]={requests:0,tokens:0,cost:0,duration:0});let e=r.modelStats[t.model];e&&(e.requests+=t.requestCount,e.tokens+=t.tokensUsed.total,e.cost+=t.cost?.total??0,e.duration+=t.duration)}for(let t of e){let e=t.toolsUsed;if(e)for(let n of e){r.toolStats[n]||(r.toolStats[n]={usageCount:0,successCount:0,totalDuration:0});let e=r.toolStats[n];e.usageCount+=1,t.success&&(e.successCount+=1),e.totalDuration+=t.duration}}return r}var H=class{entries=[];maxEntries;constructor(e=1e4){this.maxEntries=e}async save(e){this.entries.length>=this.maxEntries&&(this.entries=this.entries.slice(-this.maxEntries+1)),this.entries.push({...e})}async getStats(e,t){let n=[...this.entries];return e&&(n=n.filter(t=>t.conversationId===e)),t&&(n=n.filter(e=>e.timestamp>=t.start&&e.timestamp<=t.end)),n}async getAggregatedStats(e){return V(await this.getStats(void 0,e),e)}async clear(){this.entries=[]}async flush(){}async close(){}},U=class{filePath;logger;constructor(e){this.filePath=e,this.logger=(0,c.createLogger)(`FileUsageStorage`)}async save(e){try{this.logger.warn(`File usage storage not fully implemented yet`,{filePath:this.filePath,entry:{timestamp:e.timestamp.toISOString(),provider:e.provider,model:e.model,tokens:e.tokensUsed.total,cost:e.cost?.total,success:e.success}})}catch(e){throw new c.StorageError(`Failed to save usage stats to file`,{filePath:this.filePath,error:e instanceof Error?e.message:String(e)})}}async getStats(e,t){try{return this.logger.warn(`File usage storage not fully implemented yet`,{filePath:this.filePath,conversationId:e,timeRange:t}),[]}catch(t){throw new c.StorageError(`Failed to load usage stats from file`,{filePath:this.filePath,conversationId:e||`all`,error:t instanceof Error?t.message:String(t)})}}async getAggregatedStats(e){try{return V(await this.getStats(void 0,e),e)}catch(e){throw new c.StorageError(`Failed to get aggregated usage stats from file`,{filePath:this.filePath,error:e instanceof Error?e.message:String(e)})}}async clear(){try{this.logger.warn(`File usage storage not fully implemented yet`,{filePath:this.filePath,operation:`clear`})}catch(e){throw new c.StorageError(`Failed to clear usage stats from file`,{filePath:this.filePath,error:e instanceof Error?e.message:String(e)})}}async flush(){try{this.logger.warn(`File usage storage flush not fully implemented yet`,{filePath:this.filePath})}catch(e){throw new c.StorageError(`Failed to flush usage stats to file`,{filePath:this.filePath,error:e instanceof Error?e.message:String(e)})}}async close(){try{this.logger.warn(`File usage storage close not fully implemented yet`,{filePath:this.filePath})}catch(e){throw new c.StorageError(`Failed to close usage stats file`,{filePath:this.filePath,error:e instanceof Error?e.message:String(e)})}}},W=class{apiUrl;batchSize;flushInterval;batch=[];timer;logger;constructor(e,t,n,r={},i=50,a=6e4){this.apiUrl=e,this.batchSize=i,this.flushInterval=a,this.logger=(0,c.createLogger)(`RemoteUsageStorage`),this.timer=(0,c.startPeriodicTask)(this.logger,{name:`RemoteUsageStorage.flush`,intervalMs:this.flushInterval},async()=>{await this.flush()})}async save(e){this.batch.push(e),this.batch.length>=this.batchSize&&await this.flush()}async getStats(e,t){try{return this.logger.warn(`Remote usage storage not fully implemented yet`,{endpoint:this.apiUrl,operation:`getStats`,conversationId:e,timeRange:t}),[]}catch(t){throw new c.StorageError(`Failed to get usage stats from remote endpoint`,{endpoint:this.apiUrl,conversationId:e||`all`,error:t instanceof Error?t.message:String(t)})}}async getAggregatedStats(e){try{return V(await this.getStats(void 0,e),e)}catch(e){throw new c.StorageError(`Failed to get aggregated usage stats from remote endpoint`,{endpoint:this.apiUrl,error:e instanceof Error?e.message:String(e)})}}async clear(){try{this.logger.warn(`Remote usage storage not fully implemented yet`,{endpoint:this.apiUrl,operation:`clear`})}catch(e){throw new c.StorageError(`Failed to clear usage stats from remote endpoint`,{endpoint:this.apiUrl,error:e instanceof Error?e.message:String(e)})}}async flush(){if(this.batch.length===0)return;let e=[...this.batch];this.batch=[];try{this.logger.warn(`Remote usage storage not fully implemented yet`,{endpoint:this.apiUrl,operation:`flush`,batchSize:e.length,sample:e.slice(0,3).map(e=>({timestamp:e.timestamp.toISOString(),provider:e.provider,model:e.model,tokens:e.tokensUsed.total,cost:e.cost?.total,success:e.success}))})}catch(t){throw this.batch=[...e,...this.batch],new c.StorageError(`Failed to send usage stats to remote endpoint`,{endpoint:this.apiUrl,batchSize:e.length,error:t instanceof Error?t.message:String(t)})}}async close(){(0,c.stopPeriodicTask)(this.timer),this.timer=void 0,await this.flush()}},G=class{async save(e){}async getStats(e,t){return[]}async getAggregatedStats(e){return V([],e)}async clear(){}async flush(){}async close(){}};function xe(e){return{enabled:e.enabled??!0,strategy:e.strategy,filePath:e.filePath??`./usage-stats.json`,remoteEndpoint:e.remoteEndpoint??``,remoteHeaders:e.remoteHeaders??{},maxEntries:e.maxEntries??1e4,trackCosts:e.trackCosts??!0,...e.costRates&&{costRates:e.costRates},batchSize:e.batchSize??50,flushInterval:e.flushInterval??6e4,aggregateStats:e.aggregateStats??!0,aggregationInterval:e.aggregationInterval??3e5,category:e.category??c.PluginCategory.MONITORING,priority:e.priority??c.PluginPriority.NORMAL,moduleEvents:e.moduleEvents??[],subscribeToAllModuleEvents:e.subscribeToAllModuleEvents??!1}}function Se(e,t,n){if(!e||!e[t])return;let r=e[t],i=n.input*r.input,a=n.output*r.output;return{input:i,output:a,total:i+a}}const K=[`memory`,`file`,`remote`,`silent`];function Ce(e){if(!e.strategy)throw new c.ConfigurationError(`Usage tracking strategy is required`);if(!K.includes(e.strategy))throw new c.ConfigurationError(`Invalid usage tracking strategy`,{validStrategies:[...K],provided:e.strategy});if(e.strategy===`file`&&!e.filePath)throw new c.ConfigurationError(`File path is required for file usage tracking strategy`);if(e.strategy===`remote`&&!e.remoteEndpoint)throw new c.ConfigurationError(`Remote endpoint is required for remote usage tracking strategy`);if(e.maxEntries!==void 0&&e.maxEntries<=0)throw new c.ConfigurationError(`Max entries must be positive`);if(e.batchSize!==void 0&&e.batchSize<=0)throw new c.ConfigurationError(`Batch size must be positive`);if(e.flushInterval!==void 0&&e.flushInterval<=0)throw new c.ConfigurationError(`Flush interval must be positive`);if(e.aggregationInterval!==void 0&&e.aggregationInterval<=0)throw new c.ConfigurationError(`Aggregation interval must be positive`)}const we=new Set([c.EVENT_EMITTER_EVENTS.MODULE_INITIALIZE_COMPLETE,c.EVENT_EMITTER_EVENTS.MODULE_EXECUTION_COMPLETE,c.EVENT_EMITTER_EVENTS.MODULE_DISPOSE_COMPLETE]),Te=new Set([c.EVENT_EMITTER_EVENTS.MODULE_INITIALIZE_ERROR,c.EVENT_EMITTER_EVENTS.MODULE_EXECUTION_ERROR,c.EVENT_EMITTER_EVENTS.MODULE_DISPOSE_ERROR]);function Ee(e){return we.has(e)}function De(e){return Te.has(e)}function q(e,t){if(e&&typeof e==`object`&&t in e){let n=e[t];if(typeof n==`string`)return n}return`unknown`}function Oe(e){return e.includes(`initialize`)?`initialization`:e.includes(`execution`)?`execution`:`disposal`}var ke=class extends c.AbstractPlugin{name=`UsagePlugin`;version=`1.0.0`;storage;pluginOptions;logger;aggregationTimer;constructor(e){super(),this.logger=(0,c.createLogger)(`UsagePlugin`),this.category=c.PluginCategory.MONITORING,this.priority=c.PluginPriority.NORMAL,Ce(e),this.pluginOptions=xe(e),this.storage=this.createStorage(),this.pluginOptions.aggregateStats&&this.setupAggregation(),this.logger.info(`UsagePlugin initialized`,{strategy:this.pluginOptions.strategy,trackCosts:this.pluginOptions.trackCosts,maxEntries:this.pluginOptions.maxEntries})}async onModuleEvent(e,t){try{let n=Ee(e),r=De(e);if(!n&&!r)return;let i=t.data;if(!i||!(`duration`in i)||typeof i.duration!=`number`)return;await this.recordModuleUsage(e,t,i.duration,n)}catch{}}async recordModuleUsage(e,t,n,r){let i=t.data,a=q(i,`moduleName`),o=q(i,`moduleType`),s={moduleName:a,moduleType:o,operation:Oe(e)};r||(s.error=t.error?.message||`unknown error`),await this.recordUsage({provider:`module`,model:o,tokensUsed:{input:0,output:0,total:0},requestCount:1,duration:n,success:r,...t.executionId&&{executionId:t.executionId},...t.sessionId&&{conversationId:t.sessionId},metadata:s})}async recordUsage(e){try{let t=this.pluginOptions.trackCosts?Se(this.pluginOptions.costRates,e.model,e.tokensUsed):void 0,n={...e,timestamp:new Date,...t&&{cost:t}};await this.storage.save(n),this.logger.debug(`Usage recorded`,{provider:n.provider,model:n.model,tokens:n.tokensUsed.total,cost:n.cost?.total,success:n.success})}catch(e){throw new c.PluginError(`Failed to record usage`,this.name,{error:e instanceof Error?e.message:String(e)})}}async getUsageStats(e,t){try{return await this.storage.getStats(e,t)}catch(n){throw new c.PluginError(`Failed to get usage stats`,this.name,{conversationId:e||`all`,timeRange:t?`${t.start.toISOString()}-${t.end.toISOString()}`:`all`,error:n instanceof Error?n.message:String(n)})}}async getAggregatedStats(e){try{return await this.storage.getAggregatedStats(e)}catch(t){throw new c.PluginError(`Failed to get aggregated usage stats`,this.name,{timeRange:e?`${e.start.toISOString()}-${e.end.toISOString()}`:`all`,error:t instanceof Error?t.message:String(t)})}}async clearStats(){try{await this.storage.clear(),this.logger.info(`Usage statistics cleared`)}catch(e){throw new c.PluginError(`Failed to clear usage stats`,this.name,{error:e instanceof Error?e.message:String(e)})}}async flush(){try{await this.storage.flush()}catch(e){throw new c.PluginError(`Failed to flush usage stats`,this.name,{error:e instanceof Error?e.message:String(e)})}}async destroy(){try{this.aggregationTimer&&clearInterval(this.aggregationTimer),await this.storage.close(),this.logger.info(`UsagePlugin destroyed`)}catch(e){this.logger.error(`Error during plugin cleanup`,{error:e instanceof Error?e.message:String(e)})}}createStorage(){switch(this.pluginOptions.strategy){case`memory`:return new H(this.pluginOptions.maxEntries);case`file`:return new U(this.pluginOptions.filePath);case`remote`:return new W(this.pluginOptions.remoteEndpoint,``,3e4,this.pluginOptions.remoteHeaders||{},this.pluginOptions.batchSize,this.pluginOptions.flushInterval);case`silent`:return new G;default:throw new c.ConfigurationError(`Unknown usage tracking strategy`,{strategy:this.pluginOptions.strategy})}}setupAggregation(){this.aggregationTimer=(0,c.startPeriodicTask)(this.logger,{name:`UsagePlugin.aggregate`,intervalMs:this.pluginOptions.aggregationInterval},async()=>{let e=await this.getAggregatedStats();this.logger.debug(`Periodic usage aggregation`,{totalRequests:e.totalRequests,totalTokens:e.totalTokens,totalCost:e.totalCost,successRate:e.successRate})})}},J=class{logger;constructor(e){this.logger=e}async sendRequest(e){let{endpoint:t,payload:n,attempt:r}=e,i=t.timeout??5e3,a=t.retries??3;try{let e=JSON.stringify(n),a={"Content-Type":`application/json`,"User-Agent":`robota-webhook/1.0.0`,...t.headers};t.secret&&(a[`X-Webhook-Signature`]=this.generateSignature(e,t.secret));let o=await this.makeHttpRequest(t.url,{method:`POST`,headers:a,body:e,timeout:i});if(!o.ok)throw Error(`HTTP ${o.status}: ${o.statusText}`);this.logger.debug(`Webhook sent successfully`,{url:t.url,event:n.event,attempt:r,status:o.status})}catch(i){if(this.logger.error(`Webhook request failed`,{url:t.url,event:n.event,attempt:r,error:i instanceof Error?i.message:String(i)}),r<a){let t={...e,attempt:r+1},n=Math.min(1e3*2**(r-1),1e4);return await this.delay(n),this.sendRequest(t)}throw i}}generateSignature(e,t){let n=new l.default(`SHA-256`,`TEXT`,{hmacKey:{value:t,format:`TEXT`}});return n.update(e),n.getHash(`HEX`).toLowerCase()}async makeHttpRequest(e,t){let n=new AbortController,r=setTimeout(()=>n.abort(),t.timeout);try{return await fetch(e,{method:t.method,headers:t.headers,body:t.body,signal:n.signal})}finally{clearTimeout(r)}}delay(e){return new Promise(t=>setTimeout(t,e))}},Y=class{static contextToWebhook(e){return{executionId:e.executionId,sessionId:e.sessionId,userId:e.userId}}static resultToWebhook(e){return{response:e.response,content:e.content,duration:e.duration,tokensUsed:e.tokensUsed,toolsExecuted:e.toolsExecuted,success:e.success,usage:e.usage,toolCalls:e.toolCalls,error:e.error}}static createExecutionData(e,t){let n={response:t.response||void 0,duration:t.duration||void 0,tokensUsed:t.tokensUsed||void 0,toolsExecuted:t.toolsExecuted||void 0,success:t.success===void 0?void 0:t.success};return{executionId:e.executionId,sessionId:e.sessionId,userId:e.userId,result:n}}static createConversationData(e,t){let n=t.toolCalls?.map(e=>({id:e.id||``,name:e.name||``,arguments:JSON.stringify(e.arguments||{}),result:String(e.result||``)}))||[],r={response:t.content||t.response||void 0,tokensUsed:t.usage?.totalTokens||t.tokensUsed||void 0,toolCalls:n.length>0?n:void 0};return{executionId:e.executionId,sessionId:e.sessionId,userId:e.userId,conversation:r}}static createToolData(e,t){let n=this.safeGetProperty(t,`toolName`)||`unknown`,r=this.safeGetProperty(t,`toolId`)||this.safeGetProperty(t,`executionId`)||`unknown`,i=this.safeGetProperty(t,`error`),a=this.safeGetProperty(t,`duration`),o=this.safeGetProperty(t,`result`),s={name:String(n),id:String(r),success:!i,duration:typeof a==`number`?a:void 0,result:i?void 0:String(o||``),error:i?i instanceof Error?i.message:String(i):void 0};return{executionId:e.executionId,sessionId:e.sessionId,userId:e.userId,tool:s}}static createErrorData(e,t){let n={message:t instanceof Error?t.message:String(t),stack:t instanceof Error?t.stack:void 0,type:t instanceof Error?t.constructor.name:`Unknown`,context:e?{executionId:e.executionId||``,sessionId:e.sessionId||``,userId:e.userId||``}:void 0};return{executionId:e.executionId,sessionId:e.sessionId,userId:e.userId,error:n}}static safeGetProperty(e,t){if(!(!e||typeof e!=`object`||!e||Array.isArray(e)))return e[t]}static defaultPayloadTransformer(e,t){return t}};const X={START:`${c.EXECUTION_EVENT_PREFIX}.${c.EXECUTION_EVENTS.START}`,COMPLETE:`${c.EXECUTION_EVENT_PREFIX}.${c.EXECUTION_EVENTS.COMPLETE}`,ERROR:`${c.EXECUTION_EVENT_PREFIX}.${c.EXECUTION_EVENTS.ERROR}`},Z={COMPLETE:`conversation.complete`},Q={EXECUTED:`tool.executed`},$={OCCURRED:`error.occurred`};function Ae(e,t,n){for(let r of e){if(!r.url)throw new c.PluginError(`Webhook endpoint URL is required`,t);let e;try{e=new URL(r.url)}catch{throw new c.PluginError(`Invalid webhook URL: ${r.url}`,t)}if(e.protocol!==`https:`&&e.protocol!==`http:`)throw new c.PluginError(`Webhook endpoint URL must use http or https: ${r.url}`,t);if(r.events){for(let e of r.events)if(!n.includes(e))throw new c.PluginError(`Invalid webhook event: ${e}`,t)}}}var je=class{logger;httpClient;maxConcurrency;requestQueue=[];batchQueue=[];batchTimer;activeConcurrency=0;totalSentCount=0;totalErrorCount=0;totalResponseTime=0;constructor(e,t,n){this.logger=e,this.httpClient=t,this.maxConcurrency=n}get queueLength(){return this.requestQueue.length}get batchQueueLength(){return this.batchQueue.length}setupBatching(e,t){this.batchTimer=setInterval(()=>{this.drainBatch(t)},e)}async enqueueBatch(e,t,n){this.batchQueue.push(e),this.batchQueue.length>=t&&await this.drainBatch(n)}async sendToEndpoints(e,t,n=!0){let r=t(e.event);if(r.length===0)return;let i=r.map(t=>({endpoint:t,payload:e,attempt:1,timestamp:new Date}));n?(this.requestQueue.push(...i),this.processQueue()):await Promise.allSettled(i.map(e=>{let t=Date.now();return this.httpClient.sendRequest(e).then(()=>{this.totalSentCount++,this.totalResponseTime+=Date.now()-t}).catch(e=>{throw this.totalErrorCount++,e})}))}processQueue(){for(;this.requestQueue.length>0&&this.activeConcurrency<this.maxConcurrency;){let e=this.requestQueue.shift();if(!e)break;this.activeConcurrency++;let t=Date.now();this.httpClient.sendRequest(e).then(()=>{this.totalSentCount++,this.totalResponseTime+=Date.now()-t}).catch(t=>{this.totalErrorCount++;let n=t instanceof Error?t.message:String(t);this.logger.error(`Webhook request failed`,{endpoint:e.endpoint.url,event:e.payload.event,error:n})}).finally(()=>{this.activeConcurrency--,this.requestQueue.length>0&&this.processQueue()})}}async drainBatch(e){if(this.batchQueue.length===0)return;let t=[...this.batchQueue];this.batchQueue=[],this.logger.debug(`Flushing webhook batch`,{payloadCount:t.length});for(let n of t)await this.sendToEndpoints(n,e)}clearQueues(){this.requestQueue=[],this.batchQueue=[]}stopBatchTimer(){this.batchTimer&&=(clearInterval(this.batchTimer),void 0)}},Me=class extends c.AbstractPlugin{name=`WebhookPlugin`;version=`1.0.0`;pluginOptions;logger;queue;constructor(e){if(super(),this.category=c.PluginCategory.NOTIFICATION,this.priority=c.PluginPriority.LOW,!e.endpoints||e.endpoints.length===0)throw new c.PluginError(`At least one webhook endpoint is required`,this.name);this.pluginOptions={enabled:e.enabled??!0,events:[X.COMPLETE,Z.COMPLETE,Q.EXECUTED,$.OCCURRED],defaultTimeout:5e3,defaultRetries:3,async:!0,maxConcurrency:3,batching:{enabled:!1,maxSize:10,flushInterval:5e3},payloadTransformer:Y.defaultPayloadTransformer,category:e.category??c.PluginCategory.NOTIFICATION,priority:e.priority??c.PluginPriority.LOW,moduleEvents:e.moduleEvents??[],subscribeToAllModuleEvents:e.subscribeToAllModuleEvents??!1,...e},this.logger=(0,c.createLogger)(`${this.name}`);let t=new J(this.logger);this.queue=new je(this.logger,t,this.pluginOptions.maxConcurrency),Ae(this.pluginOptions.endpoints,this.name,[X.START,X.COMPLETE,X.ERROR,Z.COMPLETE,Q.EXECUTED,$.OCCURRED,`custom`]),this.pluginOptions.batching.enabled&&this.queue.setupBatching(this.pluginOptions.batching.flushInterval,this.getEndpointsForEvent.bind(this)),this.logger.info(`WebhookPlugin initialized`,{endpointCount:this.pluginOptions.endpoints.length,events:this.pluginOptions.events,batching:this.pluginOptions.batching.enabled})}async afterExecution(e,t){let n=Y.contextToWebhook(e),r=Y.resultToWebhook(t),i=Y.createExecutionData(n,r);await this.sendWebhook(X.COMPLETE,i)}async afterConversation(e,t){let n=Y.contextToWebhook(e),r=Y.resultToWebhook(t),i=Y.createConversationData(n,r);await this.sendWebhook(Z.COMPLETE,i)}async afterToolExecution(e,t){let n=Y.contextToWebhook(e);if(t.toolCalls&&t.toolCalls.length>0)for(let e of t.toolCalls){let r={toolName:e.name||``,toolId:e.id||``,result:e.result,success:e.result!==null,duration:t.duration},i=Y.createToolData(n,r);await this.sendWebhook(Q.EXECUTED,i)}}async onError(e,t){let n=t?{executionId:t.executionId,sessionId:t.sessionId,userId:t.userId}:{executionId:void 0,sessionId:void 0,userId:void 0},r=Y.createErrorData(n,e);await this.sendWebhook($.OCCURRED,r),await this.sendWebhook(X.ERROR,r)}async sendWebhook(e,t,n){if(!this.pluginOptions.events.includes(e))return;let r={event:e,timestamp:new Date().toISOString(),data:this.pluginOptions.payloadTransformer(e,t),...n&&{metadata:n}};t.executionId&&(r.executionId=t.executionId),t.sessionId&&(r.sessionId=t.sessionId),t.userId&&(r.userId=t.userId),this.logger.debug(`Sending webhook`,{event:e,endpointCount:this.getEndpointsForEvent(e).length}),this.pluginOptions.batching.enabled?await this.queue.enqueueBatch(r,this.pluginOptions.batching.maxSize,this.getEndpointsForEvent.bind(this)):await this.queue.sendToEndpoints(r,this.getEndpointsForEvent.bind(this),this.pluginOptions.async)}async sendCustomWebhook(e,t){await this.sendWebhook(`custom`,e,t)}getStats(){return{...super.getStats(),endpointCount:this.pluginOptions.endpoints.length,queueLength:this.queue.queueLength,batchQueueLength:this.queue.batchQueueLength,activeConcurrency:this.queue.activeConcurrency,supportedEvents:this.pluginOptions.events,totalSent:this.queue.totalSentCount,totalErrors:this.queue.totalErrorCount,averageResponseTime:this.queue.totalSentCount>0?this.queue.totalResponseTime/this.queue.totalSentCount:0}}clearQueue(){this.queue.clearQueues(),this.logger.info(`Webhook queues cleared`)}async destroy(){this.queue.stopBatchTimer(),await this.queue.drainBatch(this.getEndpointsForEvent.bind(this)),this.clearQueue(),this.logger.info(`WebhookPlugin destroyed`)}getEndpointsForEvent(e){return this.pluginOptions.endpoints.filter(t=>!t.events||t.events.length===0?!0:t.events.includes(e))}};exports.ConsoleLogFormatter=w,exports.ConsoleLogStorage=E,exports.ConversationHistoryPlugin=ne,exports.DatabaseHistoryStorage=f,exports.ErrorHandlingPlugin=_,exports.ExecutionAnalyticsPlugin=S,exports.FileHistoryStorage=d,exports.FileLogStorage=D,exports.FileUsageStorage=U,exports.JsonLogFormatter=T,exports.LimitsPlugin=me,exports.LoggingPlugin=L,exports.MemoryHistoryStorage=u,exports.MemoryPerformanceStorage=z,exports.MemoryUsageStorage=H,exports.NodeSystemMetricsCollector=R,exports.PerformancePlugin=ye,exports.RemoteLogStorage=O,exports.RemoteUsageStorage=W,exports.SilentLogStorage=k,exports.SilentUsageStorage=G,exports.UsagePlugin=ke,exports.WebhookHttpClient=J,exports.WebhookPlugin=Me,exports.WebhookTransformer=Y,exports.aggregateExecutionStats=v,exports.aggregateUsageStats=V,exports.createPluginErrorContext=g,exports.toErrorContext=h;
|
package/dist/node/index.d.ts
CHANGED
|
@@ -1481,7 +1481,7 @@ interface IWebhookExecutionResult {
|
|
|
1481
1481
|
usage?: {
|
|
1482
1482
|
totalTokens?: number | undefined;
|
|
1483
1483
|
} | undefined;
|
|
1484
|
-
toolCalls?:
|
|
1484
|
+
toolCalls?: IPluginExecutionResult['toolCalls'];
|
|
1485
1485
|
results?: Array<{
|
|
1486
1486
|
toolName?: string | undefined;
|
|
1487
1487
|
toolId?: string | undefined;
|
package/dist/node/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/conversation-history/types.ts","../../src/conversation-history/conversation-history-plugin.ts","../../src/conversation-history/storages/memory-storage.ts","../../src/conversation-history/storages/file-storage.ts","../../src/conversation-history/storages/database-storage.ts","../../src/error-handling/types.ts","../../src/error-handling/error-handling-plugin.ts","../../src/error-handling/context-adapter.ts","../../src/execution-analytics/types.ts","../../src/execution-analytics/execution-analytics-plugin.ts","../../src/execution-analytics/analytics-aggregation.ts","../../src/limits/types.ts","../../src/limits/limits-plugin.ts","../../src/logging/types.ts","../../src/logging/logging-plugin.ts","../../src/logging/storages/console-storage.ts","../../src/logging/storages/file-storage.ts","../../src/logging/storages/remote-storage.ts","../../src/logging/storages/silent-storage.ts","../../src/logging/formatters.ts","../../src/performance/types.ts","../../src/performance/performance-plugin.ts","../../src/performance/storages/memory-storage.ts","../../src/performance/collectors/system-metrics-collector.ts","../../src/usage/types.ts","../../src/usage/usage-plugin.ts","../../src/usage/aggregate-usage-stats.ts","../../src/usage/storages/memory-storage.ts","../../src/usage/storages/file-storage.ts","../../src/usage/storages/remote-storage.ts","../../src/usage/storages/silent-storage.ts","../../src/webhook/types.ts","../../src/webhook/webhook-plugin.ts","../../src/webhook/transformer.ts","../../src/webhook/http-client.ts"],"mappings":";;;;;AAKA;KAAY,uBAAA;;;AAAuB;UAKlB,iCAAA,SAA0C,cAAc;EAAtB;EAEjD,OAAA,EAAS,uBAAA;EAF8D;EAIvE,gBAAA;EAFA;EAIA,0BAAA;EAFA;EAIA,QAAA;EAAA;EAEA,gBAAA;EAEA;EAAA,QAAA;EAEY;EAAZ,YAAA;AAAA;;;;UAMe,yBAAA;EACf,cAAA;EACA,QAAA,EAAU,iBAAA;EACV,SAAA,EAAW,IAAA;EACX,WAAA,EAAa,IAAA;EACb,QAAA,GAAW,MAAA,qCAA2C,IAAA;AAAA;;;;UAMvC,eAAA;EACf,IAAA,CAAK,cAAA,UAAwB,KAAA,EAAO,yBAAA,GAA4B,OAAA;EAChE,IAAA,CAAK,cAAA,WAAyB,OAAA,CAAQ,yBAAA;EACtC,IAAA,IAAQ,OAAA;EACR,MAAA,CAAO,cAAA,WAAyB,OAAA;EAChC,KAAA,IAAS,OAAA;AAAA;AAXiD;AAM5D;;AAN4D,UAiB3C,+BAAA,SAAwC,YAAA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Ba,kBAAA;;;;SAIJ,gBAAA,CAAiB,OAAA,EAAS,uBAAA,GAA0B,wBAAA;EjClBlD;;;EAAA,OiC6BF,eAAA,CAAgB,MAAA,EAAQ,sBAAA,GAAyB,uBAAA;EjCrBxD;;;EAAA,OiCsCO,mBAAA,CACL,OAAA,EAAS,wBAAA,EACT,MAAA,EAAQ,uBAAA,GACP,iBAAA;EjCrCS;AAMd;;EANc,OiCyDL,sBAAA,CACL,OAAA,EAAS,wBAAA,EACT,MAAA,EAAQ,uBAAA,GACP,iBAAA;EjCpDO;;;;;;;;;;;;EAAA,OiCuFH,cAAA,CACL,OAAA,EAAS,wBAAA,EACT,UAAA,EAAY,WAAA,GACX,iBAAA;EjCxFU;;;EAAA,OiC2HN,eAAA,CAAgB,OAAA,EAAS,wBAAA,EAA0B,KAAA,EAAO,KAAA,GAAQ,iBAAA;EjC1Hf;AAAA;AAM5D;;;;;;;;;;EAN4D,eiC4J3C,eAAA;EjCjJC;;;EAAA,OiC2JT,yBAAA,CACL,MAAA,EAAQ,iBAAA,EACR,IAAA,EAAM,iBAAA,GACL,iBAAA;AAAA;;;;AjCvM8B;AAKnC;ckCOa,iBAAA;EAAA,QACH,MAAA;cAEI,MAAA,EAAQ,OAAA;ElCVqC;;;EkCiBnD,WAAA,CAAY,OAAA,EAAS,eAAA,GAAkB,OAAA;ElCX7C;;;EAAA,QkCiFQ,iBAAA;ElCzER;;AAAY;EAAZ,QkCoFc,eAAA;ElC9E0B;;;EAAA,QkC2GhC,KAAA;AAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/conversation-history/types.ts","../../src/conversation-history/conversation-history-plugin.ts","../../src/conversation-history/storages/memory-storage.ts","../../src/conversation-history/storages/file-storage.ts","../../src/conversation-history/storages/database-storage.ts","../../src/error-handling/types.ts","../../src/error-handling/error-handling-plugin.ts","../../src/error-handling/context-adapter.ts","../../src/execution-analytics/types.ts","../../src/execution-analytics/execution-analytics-plugin.ts","../../src/execution-analytics/analytics-aggregation.ts","../../src/limits/types.ts","../../src/limits/limits-plugin.ts","../../src/logging/types.ts","../../src/logging/logging-plugin.ts","../../src/logging/storages/console-storage.ts","../../src/logging/storages/file-storage.ts","../../src/logging/storages/remote-storage.ts","../../src/logging/storages/silent-storage.ts","../../src/logging/formatters.ts","../../src/performance/types.ts","../../src/performance/performance-plugin.ts","../../src/performance/storages/memory-storage.ts","../../src/performance/collectors/system-metrics-collector.ts","../../src/usage/types.ts","../../src/usage/usage-plugin.ts","../../src/usage/aggregate-usage-stats.ts","../../src/usage/storages/memory-storage.ts","../../src/usage/storages/file-storage.ts","../../src/usage/storages/remote-storage.ts","../../src/usage/storages/silent-storage.ts","../../src/webhook/types.ts","../../src/webhook/webhook-plugin.ts","../../src/webhook/transformer.ts","../../src/webhook/http-client.ts"],"mappings":";;;;;AAKA;KAAY,uBAAA;;;AAAuB;UAKlB,iCAAA,SAA0C,cAAc;EAAtB;EAEjD,OAAA,EAAS,uBAAA;EAF8D;EAIvE,gBAAA;EAFA;EAIA,0BAAA;EAFA;EAIA,QAAA;EAAA;EAEA,gBAAA;EAEA;EAAA,QAAA;EAEY;EAAZ,YAAA;AAAA;;;;UAMe,yBAAA;EACf,cAAA;EACA,QAAA,EAAU,iBAAA;EACV,SAAA,EAAW,IAAA;EACX,WAAA,EAAa,IAAA;EACb,QAAA,GAAW,MAAA,qCAA2C,IAAA;AAAA;;;;UAMvC,eAAA;EACf,IAAA,CAAK,cAAA,UAAwB,KAAA,EAAO,yBAAA,GAA4B,OAAA;EAChE,IAAA,CAAK,cAAA,WAAyB,OAAA,CAAQ,yBAAA;EACtC,IAAA,IAAQ,OAAA;EACR,MAAA,CAAO,cAAA,WAAyB,OAAA;EAChC,KAAA,IAAS,OAAA;AAAA;AAXiD;AAM5D;;AAN4D,UAiB3C,+BAAA,SAAwC,YAAA;EAVnB;EAYpC,kBAAA;EAXsC;EAatC,aAAA;EAZQ;EAcR,eAAA,EAAiB,uBAAA;EAZR;EAcT,Y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