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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/LICENSE +21 -0
  2. package/dist/node/index.cjs +1 -0
  3. package/dist/node/index.d.ts +1724 -0
  4. package/dist/node/index.d.ts.map +1 -0
  5. package/dist/node/index.js +2 -0
  6. package/dist/node/index.js.map +1 -0
  7. package/package.json +48 -0
  8. package/src/conversation-history/__tests__/conversation-history-plugin.test.ts +221 -0
  9. package/src/conversation-history/__tests__/history-storages.test.ts +115 -0
  10. package/src/conversation-history/conversation-history-helpers.ts +120 -0
  11. package/src/conversation-history/conversation-history-plugin.ts +294 -0
  12. package/src/conversation-history/index.ts +11 -0
  13. package/src/conversation-history/storages/database-storage.ts +96 -0
  14. package/src/conversation-history/storages/file-storage.ts +95 -0
  15. package/src/conversation-history/storages/index.ts +3 -0
  16. package/src/conversation-history/storages/memory-storage.ts +44 -0
  17. package/src/conversation-history/types.ts +64 -0
  18. package/src/error-handling/__tests__/error-handling-plugin.test.ts +201 -0
  19. package/src/error-handling/context-adapter.ts +48 -0
  20. package/src/error-handling/error-handling-helpers.ts +53 -0
  21. package/src/error-handling/error-handling-plugin.ts +293 -0
  22. package/src/error-handling/index.ts +9 -0
  23. package/src/error-handling/types.ts +82 -0
  24. package/src/execution-analytics/__tests__/execution-analytics-plugin.test.ts +224 -0
  25. package/src/execution-analytics/analytics-aggregation.ts +88 -0
  26. package/src/execution-analytics/execution-analytics-helpers.ts +83 -0
  27. package/src/execution-analytics/execution-analytics-plugin.ts +315 -0
  28. package/src/execution-analytics/index.ts +9 -0
  29. package/src/execution-analytics/types.ts +97 -0
  30. package/src/index.ts +8 -0
  31. package/src/limits/__tests__/limits-plugin.test.ts +712 -0
  32. package/src/limits/index.ts +9 -0
  33. package/src/limits/limits-helpers.ts +185 -0
  34. package/src/limits/limits-plugin.ts +196 -0
  35. package/src/limits/types.ts +73 -0
  36. package/src/limits/validation.ts +81 -0
  37. package/src/logging/__tests__/formatters.test.ts +48 -0
  38. package/src/logging/__tests__/logging-plugin.test.ts +464 -0
  39. package/src/logging/__tests__/logging-storages.test.ts +95 -0
  40. package/src/logging/formatters.ts +28 -0
  41. package/src/logging/index.ts +15 -0
  42. package/src/logging/logging-helpers.ts +223 -0
  43. package/src/logging/logging-plugin.ts +288 -0
  44. package/src/logging/storages/console-storage.ts +44 -0
  45. package/src/logging/storages/file-storage.ts +44 -0
  46. package/src/logging/storages/index.ts +4 -0
  47. package/src/logging/storages/remote-storage.ts +78 -0
  48. package/src/logging/storages/silent-storage.ts +18 -0
  49. package/src/logging/types.ts +106 -0
  50. package/src/performance/__tests__/memory-storage.test.ts +86 -0
  51. package/src/performance/__tests__/performance-plugin.test.ts +208 -0
  52. package/src/performance/__tests__/system-metrics-collector.test.ts +33 -0
  53. package/src/performance/collectors/system-metrics-collector.ts +69 -0
  54. package/src/performance/index.ts +12 -0
  55. package/src/performance/performance-helpers.ts +86 -0
  56. package/src/performance/performance-plugin.ts +274 -0
  57. package/src/performance/storages/index.ts +1 -0
  58. package/src/performance/storages/memory-storage.ts +88 -0
  59. package/src/performance/types.ts +160 -0
  60. package/src/usage/__tests__/aggregate-usage-stats.test.ts +136 -0
  61. package/src/usage/__tests__/memory-storage.test.ts +83 -0
  62. package/src/usage/__tests__/silent-storage.test.ts +44 -0
  63. package/src/usage/__tests__/usage-plugin-helpers.test.ts +155 -0
  64. package/src/usage/__tests__/usage-plugin.test.ts +358 -0
  65. package/src/usage/aggregate-usage-stats.ts +142 -0
  66. package/src/usage/index.ts +14 -0
  67. package/src/usage/storages/file-storage.ts +115 -0
  68. package/src/usage/storages/index.ts +4 -0
  69. package/src/usage/storages/memory-storage.ts +61 -0
  70. package/src/usage/storages/remote-storage.ts +143 -0
  71. package/src/usage/storages/silent-storage.ts +38 -0
  72. package/src/usage/types.ts +132 -0
  73. package/src/usage/usage-plugin-helpers.ts +116 -0
  74. package/src/usage/usage-plugin.ts +296 -0
  75. package/src/webhook/__tests__/webhook-plugin.test.ts +560 -0
  76. package/src/webhook/http-client.ts +141 -0
  77. package/src/webhook/index.ts +9 -0
  78. package/src/webhook/transformer.ts +209 -0
  79. package/src/webhook/types.ts +201 -0
  80. package/src/webhook/webhook-helpers.ts +60 -0
  81. package/src/webhook/webhook-plugin.ts +298 -0
  82. package/src/webhook/webhook-queue.ts +148 -0
@@ -0,0 +1,9 @@
1
+ export { ExecutionAnalyticsPlugin } from './execution-analytics-plugin';
2
+ export { aggregateExecutionStats } from './analytics-aggregation';
3
+ export type {
4
+ IExecutionAnalyticsOptions,
5
+ IExecutionStats,
6
+ IAggregatedExecutionStats,
7
+ IExecutionAnalyticsPluginStats,
8
+ IExecutionAnalyticsContextData,
9
+ } from './types';
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Analytics context data for execution tracking
3
+ */
4
+ export interface IExecutionAnalyticsContextData {
5
+ executionId?: string;
6
+ sessionId?: string;
7
+ userId?: string;
8
+ operation?: string;
9
+ toolName?: string;
10
+ parameterCount?: number;
11
+ inputLength?: number;
12
+ responseLength?: number;
13
+ hasOptions?: boolean;
14
+ hasError?: boolean;
15
+ resultType?: string;
16
+ errorSource?: string;
17
+ contextType?: string;
18
+ hasContext?: boolean;
19
+ modelName?: string;
20
+ }
21
+
22
+ /**
23
+ * Execution statistics entry
24
+ */
25
+ export interface IExecutionStats {
26
+ executionId: string;
27
+ operation: string;
28
+ startTime: Date;
29
+ endTime: Date;
30
+ duration: number;
31
+ success: boolean;
32
+ error?: {
33
+ message: string;
34
+ stack?: string;
35
+ type: string;
36
+ };
37
+ metadata?: Record<string, string | number | boolean | Date | string[]>;
38
+ }
39
+
40
+ /**
41
+ * Aggregated execution statistics
42
+ */
43
+ export interface IAggregatedExecutionStats {
44
+ totalExecutions: number;
45
+ successfulExecutions: number;
46
+ failedExecutions: number;
47
+ successRate: number;
48
+ averageDuration: number;
49
+ totalDuration: number;
50
+ operationStats: Record<
51
+ string,
52
+ {
53
+ count: number;
54
+ successCount: number;
55
+ failureCount: number;
56
+ averageDuration: number;
57
+ totalDuration: number;
58
+ }
59
+ >;
60
+ errorStats: Record<string, number>;
61
+ timeRange: {
62
+ start: Date;
63
+ end: Date;
64
+ };
65
+ }
66
+
67
+ import type { IPluginOptions, IPluginStats } from '@robota-sdk/agent-core';
68
+
69
+ /**
70
+ * Plugin options
71
+ */
72
+ export interface IExecutionAnalyticsOptions extends IPluginOptions {
73
+ /** Maximum number of entries to keep in memory */
74
+ maxEntries?: number;
75
+ /** Whether to track error details */
76
+ trackErrors?: boolean;
77
+ /** Performance threshold in milliseconds for warnings */
78
+ performanceThreshold?: number;
79
+ /** Enable performance warnings */
80
+ enableWarnings?: boolean;
81
+ }
82
+
83
+ /**
84
+ * Execution analytics plugin statistics
85
+ */
86
+ export interface IExecutionAnalyticsPluginStats extends IPluginStats {
87
+ /** Total number of executions recorded */
88
+ totalRecorded: number;
89
+ /** Number of active executions */
90
+ activeExecutions: number;
91
+ /** Memory usage in KB */
92
+ memoryUsage: number;
93
+ /** Oldest record timestamp */
94
+ oldestRecord?: Date;
95
+ /** Newest record timestamp */
96
+ newestRecord?: Date;
97
+ }
package/src/index.ts ADDED
@@ -0,0 +1,8 @@
1
+ export * from './conversation-history/index.js';
2
+ export * from './error-handling/index.js';
3
+ export * from './execution-analytics/index.js';
4
+ export * from './limits/index.js';
5
+ export * from './logging/index.js';
6
+ export * from './performance/index.js';
7
+ export * from './usage/index.js';
8
+ export * from './webhook/index.js';