@robota-sdk/agent-core 3.0.0-beta.6 → 3.0.0-beta.60
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/CHANGELOG.md +81 -0
- package/README.md +34 -11
- package/dist/browser/index.d.ts +646 -324
- package/dist/browser/index.js +10 -4
- package/dist/node/index.cjs +10 -4
- package/dist/node/index.d.cts +646 -324
- package/dist/node/index.d.ts +646 -324
- package/dist/node/index.js +10 -4
- package/package.json +5 -3
- package/dist/abstracts/abstract-agent.d.ts +0 -56
- package/dist/abstracts/abstract-agent.d.ts.map +0 -1
- package/dist/abstracts/abstract-agent.js +0 -55
- package/dist/abstracts/abstract-agent.js.map +0 -1
- package/dist/abstracts/abstract-ai-provider.d.ts +0 -187
- package/dist/abstracts/abstract-ai-provider.d.ts.map +0 -1
- package/dist/abstracts/abstract-ai-provider.js +0 -252
- package/dist/abstracts/abstract-ai-provider.js.map +0 -1
- package/dist/abstracts/abstract-executor.d.ts +0 -110
- package/dist/abstracts/abstract-executor.d.ts.map +0 -1
- package/dist/abstracts/abstract-executor.js +0 -156
- package/dist/abstracts/abstract-executor.js.map +0 -1
- package/dist/abstracts/abstract-manager.d.ts +0 -42
- package/dist/abstracts/abstract-manager.d.ts.map +0 -1
- package/dist/abstracts/abstract-manager.js +0 -49
- package/dist/abstracts/abstract-manager.js.map +0 -1
- package/dist/abstracts/abstract-module.d.ts +0 -365
- package/dist/abstracts/abstract-module.d.ts.map +0 -1
- package/dist/abstracts/abstract-module.js +0 -474
- package/dist/abstracts/abstract-module.js.map +0 -1
- package/dist/abstracts/abstract-plugin.d.ts +0 -369
- package/dist/abstracts/abstract-plugin.d.ts.map +0 -1
- package/dist/abstracts/abstract-plugin.js +0 -258
- package/dist/abstracts/abstract-plugin.js.map +0 -1
- package/dist/abstracts/abstract-tool.d.ts +0 -175
- package/dist/abstracts/abstract-tool.d.ts.map +0 -1
- package/dist/abstracts/abstract-tool.js +0 -140
- package/dist/abstracts/abstract-tool.js.map +0 -1
- package/dist/abstracts/abstract-workflow-converter.d.ts +0 -136
- package/dist/abstracts/abstract-workflow-converter.d.ts.map +0 -1
- package/dist/abstracts/abstract-workflow-converter.js +0 -252
- package/dist/abstracts/abstract-workflow-converter.js.map +0 -1
- package/dist/abstracts/abstract-workflow-validator.d.ts +0 -203
- package/dist/abstracts/abstract-workflow-validator.d.ts.map +0 -1
- package/dist/abstracts/abstract-workflow-validator.js +0 -447
- package/dist/abstracts/abstract-workflow-validator.js.map +0 -1
- package/dist/abstracts/index.d.ts +0 -6
- package/dist/abstracts/index.d.ts.map +0 -1
- package/dist/abstracts/index.js +0 -9
- package/dist/abstracts/index.js.map +0 -1
- package/dist/agents/constants.d.ts +0 -23
- package/dist/agents/constants.d.ts.map +0 -1
- package/dist/agents/constants.js +0 -22
- package/dist/agents/constants.js.map +0 -1
- package/dist/agents/index.d.ts +0 -1
- package/dist/agents/index.d.ts.map +0 -1
- package/dist/agents/index.js +0 -4
- package/dist/agents/index.js.map +0 -1
- package/dist/agents/robota.test.d.ts +0 -2
- package/dist/agents/robota.test.d.ts.map +0 -1
- package/dist/agents/robota.test.js +0 -416
- package/dist/agents/robota.test.js.map +0 -1
- package/dist/core/robota.d.ts +0 -694
- package/dist/core/robota.d.ts.map +0 -1
- package/dist/core/robota.js +0 -1277
- package/dist/core/robota.js.map +0 -1
- package/dist/executors/local-executor.d.ts +0 -96
- package/dist/executors/local-executor.d.ts.map +0 -1
- package/dist/executors/local-executor.js +0 -197
- package/dist/executors/local-executor.js.map +0 -1
- package/dist/executors/local-executor.test.d.ts +0 -2
- package/dist/executors/local-executor.test.d.ts.map +0 -1
- package/dist/executors/local-executor.test.js +0 -192
- package/dist/executors/local-executor.test.js.map +0 -1
- package/dist/index.d.ts +0 -274
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -235
- package/dist/index.js.map +0 -1
- package/dist/interfaces/agent.d.ts +0 -198
- package/dist/interfaces/agent.d.ts.map +0 -1
- package/dist/interfaces/agent.js +0 -2
- package/dist/interfaces/agent.js.map +0 -1
- package/dist/interfaces/event-service.d.ts +0 -79
- package/dist/interfaces/event-service.d.ts.map +0 -1
- package/dist/interfaces/event-service.js +0 -2
- package/dist/interfaces/event-service.js.map +0 -1
- package/dist/interfaces/executor.d.ts +0 -128
- package/dist/interfaces/executor.d.ts.map +0 -1
- package/dist/interfaces/executor.js +0 -2
- package/dist/interfaces/executor.js.map +0 -1
- package/dist/interfaces/history-module.d.ts +0 -19
- package/dist/interfaces/history-module.d.ts.map +0 -1
- package/dist/interfaces/history-module.js +0 -2
- package/dist/interfaces/history-module.js.map +0 -1
- package/dist/interfaces/index.d.ts +0 -13
- package/dist/interfaces/index.d.ts.map +0 -1
- package/dist/interfaces/index.js +0 -4
- package/dist/interfaces/index.js.map +0 -1
- package/dist/interfaces/manager.d.ts +0 -142
- package/dist/interfaces/manager.d.ts.map +0 -1
- package/dist/interfaces/manager.js +0 -2
- package/dist/interfaces/manager.js.map +0 -1
- package/dist/interfaces/messages.d.ts +0 -75
- package/dist/interfaces/messages.d.ts.map +0 -1
- package/dist/interfaces/messages.js +0 -29
- package/dist/interfaces/messages.js.map +0 -1
- package/dist/interfaces/progress-reporting.d.ts +0 -86
- package/dist/interfaces/progress-reporting.d.ts.map +0 -1
- package/dist/interfaces/progress-reporting.js +0 -37
- package/dist/interfaces/progress-reporting.js.map +0 -1
- package/dist/interfaces/provider.d.ts +0 -217
- package/dist/interfaces/provider.d.ts.map +0 -1
- package/dist/interfaces/provider.js +0 -2
- package/dist/interfaces/provider.js.map +0 -1
- package/dist/interfaces/service.d.ts +0 -205
- package/dist/interfaces/service.d.ts.map +0 -1
- package/dist/interfaces/service.js +0 -6
- package/dist/interfaces/service.js.map +0 -1
- package/dist/interfaces/tool.d.ts +0 -248
- package/dist/interfaces/tool.d.ts.map +0 -1
- package/dist/interfaces/tool.js +0 -2
- package/dist/interfaces/tool.js.map +0 -1
- package/dist/interfaces/types.d.ts +0 -71
- package/dist/interfaces/types.d.ts.map +0 -1
- package/dist/interfaces/types.js +0 -33
- package/dist/interfaces/types.js.map +0 -1
- package/dist/interfaces/workflow-converter.d.ts +0 -193
- package/dist/interfaces/workflow-converter.d.ts.map +0 -1
- package/dist/interfaces/workflow-converter.js +0 -11
- package/dist/interfaces/workflow-converter.js.map +0 -1
- package/dist/interfaces/workflow-validator.d.ts +0 -209
- package/dist/interfaces/workflow-validator.d.ts.map +0 -1
- package/dist/interfaces/workflow-validator.js +0 -16
- package/dist/interfaces/workflow-validator.js.map +0 -1
- package/dist/managers/agent-factory.d.ts +0 -132
- package/dist/managers/agent-factory.d.ts.map +0 -1
- package/dist/managers/agent-factory.js +0 -284
- package/dist/managers/agent-factory.js.map +0 -1
- package/dist/managers/agent-factory.test.d.ts +0 -2
- package/dist/managers/agent-factory.test.d.ts.map +0 -1
- package/dist/managers/agent-factory.test.js +0 -249
- package/dist/managers/agent-factory.test.js.map +0 -1
- package/dist/managers/agent-templates.d.ts +0 -84
- package/dist/managers/agent-templates.d.ts.map +0 -1
- package/dist/managers/agent-templates.js +0 -159
- package/dist/managers/agent-templates.js.map +0 -1
- package/dist/managers/ai-provider-manager.d.ts +0 -80
- package/dist/managers/ai-provider-manager.d.ts.map +0 -1
- package/dist/managers/ai-provider-manager.js +0 -226
- package/dist/managers/ai-provider-manager.js.map +0 -1
- package/dist/managers/conversation-history-manager.d.ts +0 -455
- package/dist/managers/conversation-history-manager.d.ts.map +0 -1
- package/dist/managers/conversation-history-manager.js +0 -578
- package/dist/managers/conversation-history-manager.js.map +0 -1
- package/dist/managers/conversation-history-manager.test.d.ts +0 -2
- package/dist/managers/conversation-history-manager.test.d.ts.map +0 -1
- package/dist/managers/conversation-history-manager.test.js +0 -374
- package/dist/managers/conversation-history-manager.test.js.map +0 -1
- package/dist/managers/index.d.ts +0 -8
- package/dist/managers/index.d.ts.map +0 -1
- package/dist/managers/index.js +0 -8
- package/dist/managers/index.js.map +0 -1
- package/dist/managers/module-registry.d.ts +0 -161
- package/dist/managers/module-registry.d.ts.map +0 -1
- package/dist/managers/module-registry.js +0 -519
- package/dist/managers/module-registry.js.map +0 -1
- package/dist/managers/module-type-registry.d.ts +0 -113
- package/dist/managers/module-type-registry.d.ts.map +0 -1
- package/dist/managers/module-type-registry.js +0 -439
- package/dist/managers/module-type-registry.js.map +0 -1
- package/dist/managers/plugins.d.ts +0 -166
- package/dist/managers/plugins.d.ts.map +0 -1
- package/dist/managers/plugins.js +0 -339
- package/dist/managers/plugins.js.map +0 -1
- package/dist/managers/tool-manager.d.ts +0 -70
- package/dist/managers/tool-manager.d.ts.map +0 -1
- package/dist/managers/tool-manager.js +0 -138
- package/dist/managers/tool-manager.js.map +0 -1
- package/dist/managers/tool-manager.test.d.ts +0 -2
- package/dist/managers/tool-manager.test.d.ts.map +0 -1
- package/dist/managers/tool-manager.test.js +0 -186
- package/dist/managers/tool-manager.test.js.map +0 -1
- package/dist/plugins/conversation-history/conversation-history-plugin.d.ts +0 -67
- package/dist/plugins/conversation-history/conversation-history-plugin.d.ts.map +0 -1
- package/dist/plugins/conversation-history/conversation-history-plugin.js +0 -270
- package/dist/plugins/conversation-history/conversation-history-plugin.js.map +0 -1
- package/dist/plugins/conversation-history/index.d.ts +0 -3
- package/dist/plugins/conversation-history/index.d.ts.map +0 -1
- package/dist/plugins/conversation-history/index.js +0 -2
- package/dist/plugins/conversation-history/index.js.map +0 -1
- package/dist/plugins/conversation-history/storages/database-storage.d.ts +0 -19
- package/dist/plugins/conversation-history/storages/database-storage.d.ts.map +0 -1
- package/dist/plugins/conversation-history/storages/database-storage.js +0 -94
- package/dist/plugins/conversation-history/storages/database-storage.js.map +0 -1
- package/dist/plugins/conversation-history/storages/file-storage.d.ts +0 -15
- package/dist/plugins/conversation-history/storages/file-storage.d.ts.map +0 -1
- package/dist/plugins/conversation-history/storages/file-storage.js +0 -94
- package/dist/plugins/conversation-history/storages/file-storage.js.map +0 -1
- package/dist/plugins/conversation-history/storages/index.d.ts +0 -4
- package/dist/plugins/conversation-history/storages/index.d.ts.map +0 -1
- package/dist/plugins/conversation-history/storages/index.js +0 -4
- package/dist/plugins/conversation-history/storages/index.js.map +0 -1
- package/dist/plugins/conversation-history/storages/memory-storage.d.ts +0 -15
- package/dist/plugins/conversation-history/storages/memory-storage.d.ts.map +0 -1
- package/dist/plugins/conversation-history/storages/memory-storage.js +0 -33
- package/dist/plugins/conversation-history/storages/memory-storage.js.map +0 -1
- package/dist/plugins/conversation-history/types.d.ts +0 -61
- package/dist/plugins/conversation-history/types.d.ts.map +0 -1
- package/dist/plugins/conversation-history/types.js +0 -2
- package/dist/plugins/conversation-history/types.js.map +0 -1
- package/dist/plugins/error-handling/context-adapter.d.ts +0 -30
- package/dist/plugins/error-handling/context-adapter.d.ts.map +0 -1
- package/dist/plugins/error-handling/context-adapter.js +0 -41
- package/dist/plugins/error-handling/context-adapter.js.map +0 -1
- package/dist/plugins/error-handling/error-handling-plugin.d.ts +0 -49
- package/dist/plugins/error-handling/error-handling-plugin.d.ts.map +0 -1
- package/dist/plugins/error-handling/error-handling-plugin.js +0 -229
- package/dist/plugins/error-handling/error-handling-plugin.js.map +0 -1
- package/dist/plugins/error-handling/index.d.ts +0 -10
- package/dist/plugins/error-handling/index.d.ts.map +0 -1
- package/dist/plugins/error-handling/index.js +0 -10
- package/dist/plugins/error-handling/index.js.map +0 -1
- package/dist/plugins/error-handling/types.d.ts +0 -73
- package/dist/plugins/error-handling/types.d.ts.map +0 -1
- package/dist/plugins/error-handling/types.js +0 -14
- package/dist/plugins/error-handling/types.js.map +0 -1
- package/dist/plugins/event-emitter/metrics.d.ts +0 -17
- package/dist/plugins/event-emitter/metrics.d.ts.map +0 -1
- package/dist/plugins/event-emitter/metrics.js +0 -17
- package/dist/plugins/event-emitter/metrics.js.map +0 -1
- package/dist/plugins/event-emitter/types.d.ts +0 -112
- package/dist/plugins/event-emitter/types.d.ts.map +0 -1
- package/dist/plugins/event-emitter/types.js +0 -65
- package/dist/plugins/event-emitter/types.js.map +0 -1
- package/dist/plugins/event-emitter-plugin.d.ts +0 -222
- package/dist/plugins/event-emitter-plugin.d.ts.map +0 -1
- package/dist/plugins/event-emitter-plugin.js +0 -432
- package/dist/plugins/event-emitter-plugin.js.map +0 -1
- package/dist/plugins/event-emitter-plugin.test.d.ts +0 -2
- package/dist/plugins/event-emitter-plugin.test.d.ts.map +0 -1
- package/dist/plugins/event-emitter-plugin.test.js +0 -94
- package/dist/plugins/event-emitter-plugin.test.js.map +0 -1
- package/dist/plugins/execution/execution-analytics-plugin.d.ts +0 -129
- package/dist/plugins/execution/execution-analytics-plugin.d.ts.map +0 -1
- package/dist/plugins/execution/execution-analytics-plugin.js +0 -517
- package/dist/plugins/execution/execution-analytics-plugin.js.map +0 -1
- package/dist/plugins/execution/index.d.ts +0 -3
- package/dist/plugins/execution/index.d.ts.map +0 -1
- package/dist/plugins/execution/index.js +0 -2
- package/dist/plugins/execution/index.js.map +0 -1
- package/dist/plugins/execution/types.d.ts +0 -90
- package/dist/plugins/execution/types.d.ts.map +0 -1
- package/dist/plugins/execution/types.js +0 -2
- package/dist/plugins/execution/types.js.map +0 -1
- package/dist/plugins/index.d.ts +0 -10
- package/dist/plugins/index.d.ts.map +0 -1
- package/dist/plugins/index.js +0 -11
- package/dist/plugins/index.js.map +0 -1
- package/dist/plugins/limits/types.d.ts +0 -61
- package/dist/plugins/limits/types.d.ts.map +0 -1
- package/dist/plugins/limits/types.js +0 -2
- package/dist/plugins/limits/types.js.map +0 -1
- package/dist/plugins/limits-plugin.d.ts +0 -113
- package/dist/plugins/limits-plugin.d.ts.map +0 -1
- package/dist/plugins/limits-plugin.js +0 -380
- package/dist/plugins/limits-plugin.js.map +0 -1
- package/dist/plugins/logging/formatters.d.ts +0 -14
- package/dist/plugins/logging/formatters.d.ts.map +0 -1
- package/dist/plugins/logging/formatters.js +0 -24
- package/dist/plugins/logging/formatters.js.map +0 -1
- package/dist/plugins/logging/index.d.ts +0 -3
- package/dist/plugins/logging/index.d.ts.map +0 -1
- package/dist/plugins/logging/index.js +0 -2
- package/dist/plugins/logging/index.js.map +0 -1
- package/dist/plugins/logging/logging-plugin.d.ts +0 -91
- package/dist/plugins/logging/logging-plugin.d.ts.map +0 -1
- package/dist/plugins/logging/logging-plugin.js +0 -335
- package/dist/plugins/logging/logging-plugin.js.map +0 -1
- package/dist/plugins/logging/storages/console-storage.d.ts +0 -14
- package/dist/plugins/logging/storages/console-storage.d.ts.map +0 -1
- package/dist/plugins/logging/storages/console-storage.js +0 -38
- package/dist/plugins/logging/storages/console-storage.js.map +0 -1
- package/dist/plugins/logging/storages/file-storage.d.ts +0 -14
- package/dist/plugins/logging/storages/file-storage.d.ts.map +0 -1
- package/dist/plugins/logging/storages/file-storage.js +0 -41
- package/dist/plugins/logging/storages/file-storage.js.map +0 -1
- package/dist/plugins/logging/storages/index.d.ts +0 -5
- package/dist/plugins/logging/storages/index.d.ts.map +0 -1
- package/dist/plugins/logging/storages/index.js +0 -5
- package/dist/plugins/logging/storages/index.js.map +0 -1
- package/dist/plugins/logging/storages/remote-storage.d.ts +0 -20
- package/dist/plugins/logging/storages/remote-storage.d.ts.map +0 -1
- package/dist/plugins/logging/storages/remote-storage.js +0 -61
- package/dist/plugins/logging/storages/remote-storage.js.map +0 -1
- package/dist/plugins/logging/storages/silent-storage.d.ts +0 -10
- package/dist/plugins/logging/storages/silent-storage.d.ts.map +0 -1
- package/dist/plugins/logging/storages/silent-storage.js +0 -15
- package/dist/plugins/logging/storages/silent-storage.js.map +0 -1
- package/dist/plugins/logging/types.d.ts +0 -84
- package/dist/plugins/logging/types.d.ts.map +0 -1
- package/dist/plugins/logging/types.js +0 -2
- package/dist/plugins/logging/types.js.map +0 -1
- package/dist/plugins/performance/collectors/system-metrics-collector.d.ts +0 -12
- package/dist/plugins/performance/collectors/system-metrics-collector.d.ts.map +0 -1
- package/dist/plugins/performance/collectors/system-metrics-collector.js +0 -65
- package/dist/plugins/performance/collectors/system-metrics-collector.js.map +0 -1
- package/dist/plugins/performance/index.d.ts +0 -5
- package/dist/plugins/performance/index.d.ts.map +0 -1
- package/dist/plugins/performance/index.js +0 -4
- package/dist/plugins/performance/index.js.map +0 -1
- package/dist/plugins/performance/performance-plugin.d.ts +0 -49
- package/dist/plugins/performance/performance-plugin.d.ts.map +0 -1
- package/dist/plugins/performance/performance-plugin.js +0 -293
- package/dist/plugins/performance/performance-plugin.js.map +0 -1
- package/dist/plugins/performance/storages/index.d.ts +0 -2
- package/dist/plugins/performance/storages/index.d.ts.map +0 -1
- package/dist/plugins/performance/storages/index.js +0 -4
- package/dist/plugins/performance/storages/index.js.map +0 -1
- package/dist/plugins/performance/storages/memory-storage.d.ts +0 -19
- package/dist/plugins/performance/storages/memory-storage.d.ts.map +0 -1
- package/dist/plugins/performance/storages/memory-storage.js +0 -69
- package/dist/plugins/performance/storages/memory-storage.js.map +0 -1
- package/dist/plugins/performance/types.d.ts +0 -154
- package/dist/plugins/performance/types.d.ts.map +0 -1
- package/dist/plugins/performance/types.js +0 -2
- package/dist/plugins/performance/types.js.map +0 -1
- package/dist/plugins/usage/aggregate-usage-stats.d.ts +0 -12
- package/dist/plugins/usage/aggregate-usage-stats.d.ts.map +0 -1
- package/dist/plugins/usage/aggregate-usage-stats.js +0 -115
- package/dist/plugins/usage/aggregate-usage-stats.js.map +0 -1
- package/dist/plugins/usage/index.d.ts +0 -5
- package/dist/plugins/usage/index.d.ts.map +0 -1
- package/dist/plugins/usage/index.js +0 -4
- package/dist/plugins/usage/index.js.map +0 -1
- package/dist/plugins/usage/storages/file-storage.d.ts +0 -22
- package/dist/plugins/usage/storages/file-storage.d.ts.map +0 -1
- package/dist/plugins/usage/storages/file-storage.js +0 -111
- package/dist/plugins/usage/storages/file-storage.js.map +0 -1
- package/dist/plugins/usage/storages/index.d.ts +0 -5
- package/dist/plugins/usage/storages/index.d.ts.map +0 -1
- package/dist/plugins/usage/storages/index.js +0 -5
- package/dist/plugins/usage/storages/index.js.map +0 -1
- package/dist/plugins/usage/storages/memory-storage.d.ts +0 -22
- package/dist/plugins/usage/storages/memory-storage.d.ts.map +0 -1
- package/dist/plugins/usage/storages/memory-storage.js +0 -42
- package/dist/plugins/usage/storages/memory-storage.js.map +0 -1
- package/dist/plugins/usage/storages/remote-storage.d.ts +0 -26
- package/dist/plugins/usage/storages/remote-storage.d.ts.map +0 -1
- package/dist/plugins/usage/storages/remote-storage.js +0 -115
- package/dist/plugins/usage/storages/remote-storage.js.map +0 -1
- package/dist/plugins/usage/storages/silent-storage.d.ts +0 -19
- package/dist/plugins/usage/storages/silent-storage.d.ts.map +0 -1
- package/dist/plugins/usage/storages/silent-storage.js +0 -26
- package/dist/plugins/usage/storages/silent-storage.js.map +0 -1
- package/dist/plugins/usage/types.d.ts +0 -127
- package/dist/plugins/usage/types.d.ts.map +0 -1
- package/dist/plugins/usage/types.js +0 -2
- package/dist/plugins/usage/types.js.map +0 -1
- package/dist/plugins/usage/usage-plugin.d.ts +0 -67
- package/dist/plugins/usage/usage-plugin.d.ts.map +0 -1
- package/dist/plugins/usage/usage-plugin.js +0 -309
- package/dist/plugins/usage/usage-plugin.js.map +0 -1
- package/dist/plugins/webhook/http-client.d.ts +0 -30
- package/dist/plugins/webhook/http-client.d.ts.map +0 -1
- package/dist/plugins/webhook/http-client.js +0 -110
- package/dist/plugins/webhook/http-client.js.map +0 -1
- package/dist/plugins/webhook/index.d.ts +0 -9
- package/dist/plugins/webhook/index.d.ts.map +0 -1
- package/dist/plugins/webhook/index.js +0 -9
- package/dist/plugins/webhook/index.js.map +0 -1
- package/dist/plugins/webhook/transformer.d.ts +0 -63
- package/dist/plugins/webhook/transformer.d.ts.map +0 -1
- package/dist/plugins/webhook/transformer.js +0 -157
- package/dist/plugins/webhook/transformer.js.map +0 -1
- package/dist/plugins/webhook/types.d.ts +0 -183
- package/dist/plugins/webhook/types.d.ts.map +0 -1
- package/dist/plugins/webhook/types.js +0 -2
- package/dist/plugins/webhook/types.js.map +0 -1
- package/dist/plugins/webhook/webhook-plugin.d.ts +0 -92
- package/dist/plugins/webhook/webhook-plugin.d.ts.map +0 -1
- package/dist/plugins/webhook/webhook-plugin.js +0 -328
- package/dist/plugins/webhook/webhook-plugin.js.map +0 -1
- package/dist/schemas/agent-template-schema.d.ts +0 -137
- package/dist/schemas/agent-template-schema.d.ts.map +0 -1
- package/dist/schemas/agent-template-schema.js +0 -87
- package/dist/schemas/agent-template-schema.js.map +0 -1
- package/dist/services/conversation-service/index.d.ts +0 -88
- package/dist/services/conversation-service/index.d.ts.map +0 -1
- package/dist/services/conversation-service/index.js +0 -441
- package/dist/services/conversation-service/index.js.map +0 -1
- package/dist/services/conversation-service/types.d.ts +0 -32
- package/dist/services/conversation-service/types.d.ts.map +0 -1
- package/dist/services/conversation-service/types.js +0 -8
- package/dist/services/conversation-service/types.js.map +0 -1
- package/dist/services/event-service.d.ts +0 -61
- package/dist/services/event-service.d.ts.map +0 -1
- package/dist/services/event-service.js +0 -110
- package/dist/services/event-service.js.map +0 -1
- package/dist/services/event-service.test.d.ts +0 -2
- package/dist/services/event-service.test.d.ts.map +0 -1
- package/dist/services/event-service.test.js +0 -86
- package/dist/services/event-service.test.js.map +0 -1
- package/dist/services/execution-service.d.ts +0 -151
- package/dist/services/execution-service.d.ts.map +0 -1
- package/dist/services/execution-service.js +0 -1262
- package/dist/services/execution-service.js.map +0 -1
- package/dist/services/execution-service.test.d.ts +0 -2
- package/dist/services/execution-service.test.d.ts.map +0 -1
- package/dist/services/execution-service.test.js +0 -338
- package/dist/services/execution-service.test.js.map +0 -1
- package/dist/services/history-module.d.ts +0 -15
- package/dist/services/history-module.d.ts.map +0 -1
- package/dist/services/history-module.js +0 -42
- package/dist/services/history-module.js.map +0 -1
- package/dist/services/in-memory-history-store.d.ts +0 -12
- package/dist/services/in-memory-history-store.d.ts.map +0 -1
- package/dist/services/in-memory-history-store.js +0 -41
- package/dist/services/in-memory-history-store.js.map +0 -1
- package/dist/services/index.d.ts +0 -7
- package/dist/services/index.d.ts.map +0 -1
- package/dist/services/index.js +0 -13
- package/dist/services/index.js.map +0 -1
- package/dist/services/task-events.d.ts +0 -6
- package/dist/services/task-events.d.ts.map +0 -1
- package/dist/services/task-events.js +0 -6
- package/dist/services/task-events.js.map +0 -1
- package/dist/services/tool-execution-service.d.ts +0 -74
- package/dist/services/tool-execution-service.d.ts.map +0 -1
- package/dist/services/tool-execution-service.js +0 -189
- package/dist/services/tool-execution-service.js.map +0 -1
- package/dist/services/user-events.d.ts +0 -7
- package/dist/services/user-events.d.ts.map +0 -1
- package/dist/services/user-events.js +0 -6
- package/dist/services/user-events.js.map +0 -1
- package/dist/tools/implementations/function-tool/index.d.ts +0 -9
- package/dist/tools/implementations/function-tool/index.d.ts.map +0 -1
- package/dist/tools/implementations/function-tool/index.js +0 -13
- package/dist/tools/implementations/function-tool/index.js.map +0 -1
- package/dist/tools/implementations/function-tool/schema-converter.d.ts +0 -32
- package/dist/tools/implementations/function-tool/schema-converter.d.ts.map +0 -1
- package/dist/tools/implementations/function-tool/schema-converter.js +0 -164
- package/dist/tools/implementations/function-tool/schema-converter.js.map +0 -1
- package/dist/tools/implementations/function-tool/types.d.ts +0 -72
- package/dist/tools/implementations/function-tool/types.d.ts.map +0 -1
- package/dist/tools/implementations/function-tool/types.js +0 -14
- package/dist/tools/implementations/function-tool/types.js.map +0 -1
- package/dist/tools/implementations/function-tool.d.ts +0 -49
- package/dist/tools/implementations/function-tool.d.ts.map +0 -1
- package/dist/tools/implementations/function-tool.js +0 -223
- package/dist/tools/implementations/function-tool.js.map +0 -1
- package/dist/tools/implementations/index.d.ts +0 -4
- package/dist/tools/implementations/index.d.ts.map +0 -1
- package/dist/tools/implementations/index.js +0 -5
- package/dist/tools/implementations/index.js.map +0 -1
- package/dist/tools/implementations/mcp-tool.d.ts +0 -72
- package/dist/tools/implementations/mcp-tool.d.ts.map +0 -1
- package/dist/tools/implementations/mcp-tool.js +0 -246
- package/dist/tools/implementations/mcp-tool.js.map +0 -1
- package/dist/tools/implementations/openapi-tool.d.ts +0 -56
- package/dist/tools/implementations/openapi-tool.d.ts.map +0 -1
- package/dist/tools/implementations/openapi-tool.js +0 -324
- package/dist/tools/implementations/openapi-tool.js.map +0 -1
- package/dist/tools/implementations/relay-mcp-tool.d.ts +0 -38
- package/dist/tools/implementations/relay-mcp-tool.d.ts.map +0 -1
- package/dist/tools/implementations/relay-mcp-tool.js +0 -46
- package/dist/tools/implementations/relay-mcp-tool.js.map +0 -1
- package/dist/tools/index.d.ts +0 -3
- package/dist/tools/index.d.ts.map +0 -1
- package/dist/tools/index.js +0 -4
- package/dist/tools/index.js.map +0 -1
- package/dist/tools/registry/index.d.ts +0 -2
- package/dist/tools/registry/index.d.ts.map +0 -1
- package/dist/tools/registry/index.js +0 -3
- package/dist/tools/registry/index.js.map +0 -1
- package/dist/tools/registry/tool-registry.d.ts +0 -54
- package/dist/tools/registry/tool-registry.d.ts.map +0 -1
- package/dist/tools/registry/tool-registry.js +0 -146
- package/dist/tools/registry/tool-registry.js.map +0 -1
- package/dist/utils/errors.d.ts +0 -155
- package/dist/utils/errors.d.ts.map +0 -1
- package/dist/utils/errors.js +0 -203
- package/dist/utils/errors.js.map +0 -1
- package/dist/utils/execution-proxy.d.ts +0 -75
- package/dist/utils/execution-proxy.d.ts.map +0 -1
- package/dist/utils/execution-proxy.js +0 -230
- package/dist/utils/execution-proxy.js.map +0 -1
- package/dist/utils/index.d.ts +0 -11
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/index.js +0 -7
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/logger.d.ts +0 -74
- package/dist/utils/logger.d.ts.map +0 -1
- package/dist/utils/logger.js +0 -143
- package/dist/utils/logger.js.map +0 -1
- package/dist/utils/message-converter.d.ts +0 -68
- package/dist/utils/message-converter.d.ts.map +0 -1
- package/dist/utils/message-converter.js +0 -87
- package/dist/utils/message-converter.js.map +0 -1
- package/dist/utils/periodic-task.d.ts +0 -14
- package/dist/utils/periodic-task.d.ts.map +0 -1
- package/dist/utils/periodic-task.js +0 -26
- package/dist/utils/periodic-task.js.map +0 -1
- package/dist/utils/validation.d.ts +0 -40
- package/dist/utils/validation.d.ts.map +0 -1
- package/dist/utils/validation.js +0 -162
- package/dist/utils/validation.js.map +0 -1
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
|
|
2
|
-
import { Tools } from './tool-manager';
|
|
3
|
-
import { ToolExecutionError } from '../utils/errors';
|
|
4
|
-
describe('Tools (ToolManager)', () => {
|
|
5
|
-
let toolManager;
|
|
6
|
-
const mockToolSchema = {
|
|
7
|
-
name: 'testTool',
|
|
8
|
-
description: 'A test tool',
|
|
9
|
-
parameters: {
|
|
10
|
-
type: 'object',
|
|
11
|
-
properties: {
|
|
12
|
-
input: {
|
|
13
|
-
type: 'string',
|
|
14
|
-
description: 'Test input'
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
required: ['input']
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
const mockExecutor = async (params) => {
|
|
21
|
-
return `Processed: ${params.input}`;
|
|
22
|
-
};
|
|
23
|
-
beforeEach(async () => {
|
|
24
|
-
toolManager = new Tools();
|
|
25
|
-
await toolManager.initialize();
|
|
26
|
-
});
|
|
27
|
-
afterEach(async () => {
|
|
28
|
-
await toolManager.dispose();
|
|
29
|
-
});
|
|
30
|
-
describe('Initialization and Disposal', () => {
|
|
31
|
-
it('should initialize successfully', async () => {
|
|
32
|
-
const newManager = new Tools();
|
|
33
|
-
await expect(newManager.initialize()).resolves.not.toThrow();
|
|
34
|
-
await newManager.dispose();
|
|
35
|
-
});
|
|
36
|
-
it('should dispose successfully', async () => {
|
|
37
|
-
await expect(toolManager.dispose()).resolves.not.toThrow();
|
|
38
|
-
});
|
|
39
|
-
it('should clear all tools on disposal', async () => {
|
|
40
|
-
toolManager.addTool(mockToolSchema, mockExecutor);
|
|
41
|
-
expect(toolManager.getToolCount()).toBe(1);
|
|
42
|
-
await toolManager.dispose();
|
|
43
|
-
await toolManager.initialize();
|
|
44
|
-
expect(toolManager.getToolCount()).toBe(0);
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
describe('Tool Registration', () => {
|
|
48
|
-
it('should register a tool successfully', () => {
|
|
49
|
-
toolManager.addTool(mockToolSchema, mockExecutor);
|
|
50
|
-
expect(toolManager.hasTool('testTool')).toBe(true);
|
|
51
|
-
expect(toolManager.getToolCount()).toBe(1);
|
|
52
|
-
});
|
|
53
|
-
it('should get tool schema correctly', () => {
|
|
54
|
-
toolManager.addTool(mockToolSchema, mockExecutor);
|
|
55
|
-
const schema = toolManager.getToolSchema('testTool');
|
|
56
|
-
expect(schema).toEqual(mockToolSchema);
|
|
57
|
-
});
|
|
58
|
-
it('should get tool instance correctly', () => {
|
|
59
|
-
toolManager.addTool(mockToolSchema, mockExecutor);
|
|
60
|
-
const tool = toolManager.getTool('testTool');
|
|
61
|
-
expect(tool).toBeDefined();
|
|
62
|
-
expect(tool?.schema).toEqual(mockToolSchema);
|
|
63
|
-
});
|
|
64
|
-
it('should remove a tool successfully', () => {
|
|
65
|
-
toolManager.addTool(mockToolSchema, mockExecutor);
|
|
66
|
-
expect(toolManager.hasTool('testTool')).toBe(true);
|
|
67
|
-
toolManager.removeTool('testTool');
|
|
68
|
-
expect(toolManager.hasTool('testTool')).toBe(false);
|
|
69
|
-
expect(toolManager.getToolCount()).toBe(0);
|
|
70
|
-
});
|
|
71
|
-
it('should handle multiple tools', () => {
|
|
72
|
-
const schema2 = {
|
|
73
|
-
name: 'testTool2',
|
|
74
|
-
description: 'Another test tool',
|
|
75
|
-
parameters: {
|
|
76
|
-
type: 'object',
|
|
77
|
-
properties: {
|
|
78
|
-
value: { type: 'number' }
|
|
79
|
-
},
|
|
80
|
-
required: ['value']
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
toolManager.addTool(mockToolSchema, mockExecutor);
|
|
84
|
-
toolManager.addTool(schema2, async (params) => typeof params.value === 'number' ? params.value * 2 : 0);
|
|
85
|
-
expect(toolManager.getToolCount()).toBe(2);
|
|
86
|
-
expect(toolManager.hasTool('testTool')).toBe(true);
|
|
87
|
-
expect(toolManager.hasTool('testTool2')).toBe(true);
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
describe('Tool Execution', () => {
|
|
91
|
-
beforeEach(() => {
|
|
92
|
-
toolManager.addTool(mockToolSchema, mockExecutor);
|
|
93
|
-
});
|
|
94
|
-
it('should execute tool successfully', async () => {
|
|
95
|
-
const result = await toolManager.executeTool('testTool', { input: 'test' });
|
|
96
|
-
expect(result).toBe('Processed: test');
|
|
97
|
-
});
|
|
98
|
-
it('should throw error for non-existent tool', async () => {
|
|
99
|
-
await expect(toolManager.executeTool('nonExistent', { input: 'test' })).rejects.toThrow(ToolExecutionError);
|
|
100
|
-
});
|
|
101
|
-
it('should throw error for tool execution failure', async () => {
|
|
102
|
-
const failingExecutor = async () => {
|
|
103
|
-
throw new Error('Execution failed');
|
|
104
|
-
};
|
|
105
|
-
const failingSchema = {
|
|
106
|
-
name: 'failingTool',
|
|
107
|
-
description: 'A failing tool',
|
|
108
|
-
parameters: {
|
|
109
|
-
type: 'object',
|
|
110
|
-
properties: {},
|
|
111
|
-
required: []
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
toolManager.addTool(failingSchema, failingExecutor);
|
|
115
|
-
await expect(toolManager.executeTool('failingTool', {})).rejects.toThrow(ToolExecutionError);
|
|
116
|
-
});
|
|
117
|
-
});
|
|
118
|
-
describe('Tool Filtering', () => {
|
|
119
|
-
beforeEach(() => {
|
|
120
|
-
const schemas = [
|
|
121
|
-
{ name: 'tool1', description: 'Tool 1', parameters: { type: 'object', properties: {}, required: [] } },
|
|
122
|
-
{ name: 'tool2', description: 'Tool 2', parameters: { type: 'object', properties: {}, required: [] } },
|
|
123
|
-
{ name: 'tool3', description: 'Tool 3', parameters: { type: 'object', properties: {}, required: [] } }
|
|
124
|
-
];
|
|
125
|
-
schemas.forEach(schema => {
|
|
126
|
-
toolManager.addTool(schema, async () => 'result');
|
|
127
|
-
});
|
|
128
|
-
});
|
|
129
|
-
it('should return all tools when no filter is set', () => {
|
|
130
|
-
const tools = toolManager.getTools();
|
|
131
|
-
expect(tools).toHaveLength(3);
|
|
132
|
-
expect(tools.map(t => t.name)).toEqual(['tool1', 'tool2', 'tool3']);
|
|
133
|
-
});
|
|
134
|
-
it('should filter tools by allowed list', () => {
|
|
135
|
-
toolManager.setAllowedTools(['tool1', 'tool3']);
|
|
136
|
-
const tools = toolManager.getTools();
|
|
137
|
-
expect(tools).toHaveLength(2);
|
|
138
|
-
expect(tools.map(t => t.name)).toEqual(['tool1', 'tool3']);
|
|
139
|
-
});
|
|
140
|
-
it('should get and set allowed tools correctly', () => {
|
|
141
|
-
expect(toolManager.getAllowedTools()).toBeUndefined();
|
|
142
|
-
toolManager.setAllowedTools(['tool1', 'tool2']);
|
|
143
|
-
expect(toolManager.getAllowedTools()).toEqual(['tool1', 'tool2']);
|
|
144
|
-
});
|
|
145
|
-
it('should prevent execution of non-allowed tools', async () => {
|
|
146
|
-
toolManager.setAllowedTools(['tool1']);
|
|
147
|
-
await expect(toolManager.executeTool('tool2', {})).rejects.toThrow(ToolExecutionError);
|
|
148
|
-
});
|
|
149
|
-
it('should allow execution of allowed tools', async () => {
|
|
150
|
-
toolManager.setAllowedTools(['tool1']);
|
|
151
|
-
await expect(toolManager.executeTool('tool1', {})).resolves.toBe('result');
|
|
152
|
-
});
|
|
153
|
-
});
|
|
154
|
-
describe('Registry Access', () => {
|
|
155
|
-
it('should provide access to tool registry', () => {
|
|
156
|
-
const registry = toolManager.getRegistry();
|
|
157
|
-
expect(registry).toBeDefined();
|
|
158
|
-
expect(typeof registry.register).toBe('function');
|
|
159
|
-
expect(typeof registry.get).toBe('function');
|
|
160
|
-
});
|
|
161
|
-
it('should return correct tool count', () => {
|
|
162
|
-
expect(toolManager.getToolCount()).toBe(0);
|
|
163
|
-
toolManager.addTool(mockToolSchema, mockExecutor);
|
|
164
|
-
expect(toolManager.getToolCount()).toBe(1);
|
|
165
|
-
toolManager.addTool({ name: 'tool2', description: 'Tool 2', parameters: { type: 'object', properties: {}, required: [] } }, async () => 'result');
|
|
166
|
-
expect(toolManager.getToolCount()).toBe(2);
|
|
167
|
-
});
|
|
168
|
-
});
|
|
169
|
-
describe('Error Handling', () => {
|
|
170
|
-
it('should handle undefined tool schema gracefully', () => {
|
|
171
|
-
const schema = toolManager.getToolSchema('nonExistent');
|
|
172
|
-
expect(schema).toBeUndefined();
|
|
173
|
-
});
|
|
174
|
-
it('should handle undefined tool instance gracefully', () => {
|
|
175
|
-
const tool = toolManager.getTool('nonExistent');
|
|
176
|
-
expect(tool).toBeUndefined();
|
|
177
|
-
});
|
|
178
|
-
it('should handle checking non-existent tool', () => {
|
|
179
|
-
expect(toolManager.hasTool('nonExistent')).toBe(false);
|
|
180
|
-
});
|
|
181
|
-
it('should handle removing non-existent tool gracefully', () => {
|
|
182
|
-
expect(() => toolManager.removeTool('nonExistent')).not.toThrow();
|
|
183
|
-
});
|
|
184
|
-
});
|
|
185
|
-
});
|
|
186
|
-
//# sourceMappingURL=tool-manager.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tool-manager.test.js","sourceRoot":"","sources":["../../src/managers/tool-manager.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACrE,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAGvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACjC,IAAI,WAAkB,CAAC;IAEvB,MAAM,cAAc,GAAgB;QAChC,IAAI,EAAE,UAAU;QAChB,WAAW,EAAE,aAAa;QAC1B,UAAU,EAAE;YACR,IAAI,EAAE,QAAQ;YACd,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CAAC,CAAC,aAAa,EAAE,CAAC;QACnC,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,kDAAkD,EAAE,GAAG,EAAE;YACxD,MAAM,IAAI,GAAG,WAAW,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;YAChD,MAAM,CAAC,IAAI,CAAC,CAAC,aAAa,EAAE,CAAC;QACjC,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,0CAA0C,EAAE,GAAG,EAAE;YAChD,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC3D,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,qDAAqD,EAAE,GAAG,EAAE;YAC3D,MAAM,CAAC,GAAG,EAAE,CAAC,WAAW,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;QACtE,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { AbstractPlugin } from '../../abstracts/abstract-plugin';
|
|
2
|
-
import { TUniversalMessage } from '../../interfaces/agent';
|
|
3
|
-
import { IConversationHistoryPluginOptions, IConversationHistoryPluginStats, IConversationHistoryEntry } from './types';
|
|
4
|
-
/**
|
|
5
|
-
* Plugin for managing conversation history
|
|
6
|
-
* Saves and loads conversation history using configurable storage strategies
|
|
7
|
-
*/
|
|
8
|
-
export declare class ConversationHistoryPlugin extends AbstractPlugin<IConversationHistoryPluginOptions, IConversationHistoryPluginStats> {
|
|
9
|
-
name: string;
|
|
10
|
-
version: string;
|
|
11
|
-
private storage;
|
|
12
|
-
private pluginOptions;
|
|
13
|
-
private logger;
|
|
14
|
-
private currentConversationId?;
|
|
15
|
-
private batchSaveTimer?;
|
|
16
|
-
private pendingSaves;
|
|
17
|
-
constructor(options: IConversationHistoryPluginOptions);
|
|
18
|
-
/**
|
|
19
|
-
* Start a new conversation
|
|
20
|
-
*/
|
|
21
|
-
startConversation(conversationId: string): Promise<void>;
|
|
22
|
-
/**
|
|
23
|
-
* Add a message to the current conversation
|
|
24
|
-
*/
|
|
25
|
-
addMessage(message: TUniversalMessage): Promise<void>;
|
|
26
|
-
/**
|
|
27
|
-
* Load conversation history
|
|
28
|
-
*/
|
|
29
|
-
loadConversation(conversationId: string): Promise<IConversationHistoryEntry | undefined>;
|
|
30
|
-
/**
|
|
31
|
-
* Get conversation history as messages
|
|
32
|
-
*/
|
|
33
|
-
getHistory(conversationId: string): Promise<TUniversalMessage[]>;
|
|
34
|
-
/**
|
|
35
|
-
* List all conversation IDs
|
|
36
|
-
*/
|
|
37
|
-
listConversations(): Promise<string[]>;
|
|
38
|
-
/**
|
|
39
|
-
* Delete a conversation
|
|
40
|
-
*/
|
|
41
|
-
deleteConversation(conversationId: string): Promise<boolean>;
|
|
42
|
-
/**
|
|
43
|
-
* Clear all conversations
|
|
44
|
-
*/
|
|
45
|
-
clearAllConversations(): Promise<void>;
|
|
46
|
-
/**
|
|
47
|
-
* Save pending conversations (for batch mode)
|
|
48
|
-
*/
|
|
49
|
-
savePending(): Promise<void>;
|
|
50
|
-
/**
|
|
51
|
-
* Cleanup resources
|
|
52
|
-
*/
|
|
53
|
-
destroy(): Promise<void>;
|
|
54
|
-
/**
|
|
55
|
-
* Validate plugin options
|
|
56
|
-
*/
|
|
57
|
-
private validateOptions;
|
|
58
|
-
/**
|
|
59
|
-
* Create storage instance based on strategy
|
|
60
|
-
*/
|
|
61
|
-
private createStorage;
|
|
62
|
-
/**
|
|
63
|
-
* Setup batch saving timer
|
|
64
|
-
*/
|
|
65
|
-
private setupBatchSaving;
|
|
66
|
-
}
|
|
67
|
-
//# sourceMappingURL=conversation-history-plugin.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"conversation-history-plugin.d.ts","sourceRoot":"","sources":["../../../src/plugins/conversation-history/conversation-history-plugin.ts"],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;IACH,OAAO,CAAC,eAAe;IA0BvB;;OAEG;IACH,OAAO,CAAC,aAAa;IAarB;;OAEG;IACH,OAAO,CAAC,gBAAgB;CAS3B"}
|
|
@@ -1,270 +0,0 @@
|
|
|
1
|
-
import { AbstractPlugin, PluginCategory, PluginPriority } from '../../abstracts/abstract-plugin';
|
|
2
|
-
import { createLogger } from '../../utils/logger';
|
|
3
|
-
import { PluginError, ConfigurationError } from '../../utils/errors';
|
|
4
|
-
import { startPeriodicTask, stopPeriodicTask } from '../../utils/periodic-task';
|
|
5
|
-
import { MemoryHistoryStorage, FileHistoryStorage, DatabaseHistoryStorage } from './storages/index';
|
|
6
|
-
/**
|
|
7
|
-
* Plugin for managing conversation history
|
|
8
|
-
* Saves and loads conversation history using configurable storage strategies
|
|
9
|
-
*/
|
|
10
|
-
export class ConversationHistoryPlugin extends AbstractPlugin {
|
|
11
|
-
name = 'ConversationHistoryPlugin';
|
|
12
|
-
version = '1.0.0';
|
|
13
|
-
storage;
|
|
14
|
-
pluginOptions;
|
|
15
|
-
logger;
|
|
16
|
-
currentConversationId;
|
|
17
|
-
batchSaveTimer;
|
|
18
|
-
pendingSaves = new Set();
|
|
19
|
-
constructor(options) {
|
|
20
|
-
super();
|
|
21
|
-
this.logger = createLogger('ConversationHistoryPlugin');
|
|
22
|
-
// Set plugin classification
|
|
23
|
-
this.category = PluginCategory.STORAGE;
|
|
24
|
-
this.priority = PluginPriority.HIGH;
|
|
25
|
-
// Validate options
|
|
26
|
-
this.validateOptions(options);
|
|
27
|
-
// Set defaults
|
|
28
|
-
this.pluginOptions = {
|
|
29
|
-
enabled: options.enabled ?? true,
|
|
30
|
-
storage: options.storage,
|
|
31
|
-
maxConversations: options.maxConversations ?? 100,
|
|
32
|
-
maxMessagesPerConversation: options.maxMessagesPerConversation ?? 1000,
|
|
33
|
-
filePath: options.filePath ?? './conversations.json',
|
|
34
|
-
connectionString: options.connectionString ?? '',
|
|
35
|
-
autoSave: options.autoSave ?? true,
|
|
36
|
-
saveInterval: options.saveInterval ?? 30000, // 30 seconds
|
|
37
|
-
// Add plugin options defaults
|
|
38
|
-
category: options.category ?? PluginCategory.STORAGE,
|
|
39
|
-
priority: options.priority ?? PluginPriority.HIGH,
|
|
40
|
-
moduleEvents: options.moduleEvents ?? [],
|
|
41
|
-
subscribeToAllModuleEvents: options.subscribeToAllModuleEvents ?? false,
|
|
42
|
-
};
|
|
43
|
-
// Initialize storage
|
|
44
|
-
this.storage = this.createStorage();
|
|
45
|
-
// Setup batch saving if not auto-saving
|
|
46
|
-
if (!this.pluginOptions.autoSave) {
|
|
47
|
-
this.setupBatchSaving();
|
|
48
|
-
}
|
|
49
|
-
this.logger.info('ConversationHistoryPlugin initialized', {
|
|
50
|
-
storage: this.pluginOptions.storage,
|
|
51
|
-
maxConversations: this.pluginOptions.maxConversations,
|
|
52
|
-
autoSave: this.pluginOptions.autoSave
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Start a new conversation
|
|
57
|
-
*/
|
|
58
|
-
async startConversation(conversationId) {
|
|
59
|
-
try {
|
|
60
|
-
this.currentConversationId = conversationId;
|
|
61
|
-
const entry = {
|
|
62
|
-
conversationId,
|
|
63
|
-
messages: [],
|
|
64
|
-
startTime: new Date(),
|
|
65
|
-
lastUpdated: new Date(),
|
|
66
|
-
metadata: {}
|
|
67
|
-
};
|
|
68
|
-
if (this.pluginOptions.autoSave) {
|
|
69
|
-
await this.storage.save(conversationId, entry);
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
this.pendingSaves.add(conversationId);
|
|
73
|
-
}
|
|
74
|
-
this.logger.debug('Started new conversation', { conversationId });
|
|
75
|
-
}
|
|
76
|
-
catch (error) {
|
|
77
|
-
throw new PluginError('Failed to start conversation', this.name, { conversationId, error: error instanceof Error ? error.message : String(error) });
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Add a message to the current conversation
|
|
82
|
-
*/
|
|
83
|
-
async addMessage(message) {
|
|
84
|
-
if (!this.currentConversationId) {
|
|
85
|
-
throw new PluginError('No active conversation', this.name);
|
|
86
|
-
}
|
|
87
|
-
try {
|
|
88
|
-
const entry = await this.storage.load(this.currentConversationId) || {
|
|
89
|
-
conversationId: this.currentConversationId,
|
|
90
|
-
messages: [],
|
|
91
|
-
startTime: new Date(),
|
|
92
|
-
lastUpdated: new Date(),
|
|
93
|
-
metadata: {}
|
|
94
|
-
};
|
|
95
|
-
// Add message and trim if necessary
|
|
96
|
-
entry.messages.push(message);
|
|
97
|
-
if (entry.messages.length > this.pluginOptions.maxMessagesPerConversation) {
|
|
98
|
-
entry.messages = entry.messages.slice(-this.pluginOptions.maxMessagesPerConversation);
|
|
99
|
-
}
|
|
100
|
-
entry.lastUpdated = new Date();
|
|
101
|
-
if (this.pluginOptions.autoSave) {
|
|
102
|
-
await this.storage.save(this.currentConversationId, entry);
|
|
103
|
-
}
|
|
104
|
-
else {
|
|
105
|
-
this.pendingSaves.add(this.currentConversationId);
|
|
106
|
-
}
|
|
107
|
-
this.logger.debug('Added message to conversation', {
|
|
108
|
-
conversationId: this.currentConversationId,
|
|
109
|
-
messageRole: message.role,
|
|
110
|
-
messageLength: message.content?.length ?? 0
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
catch (error) {
|
|
114
|
-
throw new PluginError('Failed to add message to conversation', this.name, {
|
|
115
|
-
conversationId: this.currentConversationId,
|
|
116
|
-
error: error instanceof Error ? error.message : String(error)
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Load conversation history
|
|
122
|
-
*/
|
|
123
|
-
async loadConversation(conversationId) {
|
|
124
|
-
try {
|
|
125
|
-
const entry = await this.storage.load(conversationId);
|
|
126
|
-
this.logger.debug('Loaded conversation', {
|
|
127
|
-
conversationId,
|
|
128
|
-
found: !!entry,
|
|
129
|
-
messageCount: entry?.messages.length ?? 0
|
|
130
|
-
});
|
|
131
|
-
return entry;
|
|
132
|
-
}
|
|
133
|
-
catch (error) {
|
|
134
|
-
throw new PluginError('Failed to load conversation', this.name, { conversationId, error: error instanceof Error ? error.message : String(error) });
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* Get conversation history as messages
|
|
139
|
-
*/
|
|
140
|
-
async getHistory(conversationId) {
|
|
141
|
-
const entry = await this.loadConversation(conversationId);
|
|
142
|
-
return entry?.messages ?? [];
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* List all conversation IDs
|
|
146
|
-
*/
|
|
147
|
-
async listConversations() {
|
|
148
|
-
try {
|
|
149
|
-
return await this.storage.list();
|
|
150
|
-
}
|
|
151
|
-
catch (error) {
|
|
152
|
-
throw new PluginError('Failed to list conversations', this.name, { error: error instanceof Error ? error.message : String(error) });
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* Delete a conversation
|
|
157
|
-
*/
|
|
158
|
-
async deleteConversation(conversationId) {
|
|
159
|
-
try {
|
|
160
|
-
const deleted = await this.storage.delete(conversationId);
|
|
161
|
-
this.pendingSaves.delete(conversationId);
|
|
162
|
-
this.logger.debug('Deleted conversation', { conversationId, deleted });
|
|
163
|
-
return deleted;
|
|
164
|
-
}
|
|
165
|
-
catch (error) {
|
|
166
|
-
throw new PluginError('Failed to delete conversation', this.name, { conversationId, error: error instanceof Error ? error.message : String(error) });
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* Clear all conversations
|
|
171
|
-
*/
|
|
172
|
-
async clearAllConversations() {
|
|
173
|
-
try {
|
|
174
|
-
await this.storage.clear();
|
|
175
|
-
this.pendingSaves.clear();
|
|
176
|
-
this.logger.info('Cleared all conversations');
|
|
177
|
-
}
|
|
178
|
-
catch (error) {
|
|
179
|
-
throw new PluginError('Failed to clear conversations', this.name, { error: error instanceof Error ? error.message : String(error) });
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* Save pending conversations (for batch mode)
|
|
184
|
-
*/
|
|
185
|
-
async savePending() {
|
|
186
|
-
if (this.pendingSaves.size === 0)
|
|
187
|
-
return;
|
|
188
|
-
const conversationIds = Array.from(this.pendingSaves);
|
|
189
|
-
this.logger.debug('Saving pending conversations', { count: conversationIds.length });
|
|
190
|
-
for (const conversationId of conversationIds) {
|
|
191
|
-
try {
|
|
192
|
-
const entry = await this.storage.load(conversationId);
|
|
193
|
-
if (entry) {
|
|
194
|
-
await this.storage.save(conversationId, entry);
|
|
195
|
-
}
|
|
196
|
-
this.pendingSaves.delete(conversationId);
|
|
197
|
-
}
|
|
198
|
-
catch (error) {
|
|
199
|
-
this.logger.error('Failed to save pending conversation', {
|
|
200
|
-
conversationId,
|
|
201
|
-
error: error instanceof Error ? error.message : String(error)
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
/**
|
|
207
|
-
* Cleanup resources
|
|
208
|
-
*/
|
|
209
|
-
async destroy() {
|
|
210
|
-
try {
|
|
211
|
-
stopPeriodicTask(this.batchSaveTimer);
|
|
212
|
-
this.batchSaveTimer = undefined;
|
|
213
|
-
// Save any pending conversations
|
|
214
|
-
await this.savePending();
|
|
215
|
-
this.logger.info('ConversationHistoryPlugin destroyed');
|
|
216
|
-
}
|
|
217
|
-
catch (error) {
|
|
218
|
-
this.logger.error('Error during plugin cleanup', {
|
|
219
|
-
error: error instanceof Error ? error.message : String(error)
|
|
220
|
-
});
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
/**
|
|
224
|
-
* Validate plugin options
|
|
225
|
-
*/
|
|
226
|
-
validateOptions(options) {
|
|
227
|
-
if (!options.storage) {
|
|
228
|
-
throw new ConfigurationError('Storage strategy is required');
|
|
229
|
-
}
|
|
230
|
-
if (!['memory', 'file', 'database'].includes(options.storage)) {
|
|
231
|
-
throw new ConfigurationError('Invalid storage strategy', { validStrategies: ['memory', 'file', 'database'], provided: options.storage });
|
|
232
|
-
}
|
|
233
|
-
if (options.storage === 'file' && !options.filePath) {
|
|
234
|
-
throw new ConfigurationError('File path is required for file storage strategy');
|
|
235
|
-
}
|
|
236
|
-
if (options.storage === 'database' && !options.connectionString) {
|
|
237
|
-
throw new ConfigurationError('Connection string is required for database storage strategy');
|
|
238
|
-
}
|
|
239
|
-
if (options.maxConversations !== undefined && options.maxConversations <= 0) {
|
|
240
|
-
throw new ConfigurationError('Max conversations must be positive');
|
|
241
|
-
}
|
|
242
|
-
if (options.maxMessagesPerConversation !== undefined && options.maxMessagesPerConversation <= 0) {
|
|
243
|
-
throw new ConfigurationError('Max messages per conversation must be positive');
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
/**
|
|
247
|
-
* Create storage instance based on strategy
|
|
248
|
-
*/
|
|
249
|
-
createStorage() {
|
|
250
|
-
switch (this.pluginOptions.storage) {
|
|
251
|
-
case 'memory':
|
|
252
|
-
return new MemoryHistoryStorage(this.pluginOptions.maxConversations);
|
|
253
|
-
case 'file':
|
|
254
|
-
return new FileHistoryStorage(this.pluginOptions.filePath);
|
|
255
|
-
case 'database':
|
|
256
|
-
return new DatabaseHistoryStorage(this.pluginOptions.connectionString);
|
|
257
|
-
default:
|
|
258
|
-
throw new ConfigurationError('Unknown storage strategy', { strategy: this.pluginOptions.storage });
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
/**
|
|
262
|
-
* Setup batch saving timer
|
|
263
|
-
*/
|
|
264
|
-
setupBatchSaving() {
|
|
265
|
-
this.batchSaveTimer = startPeriodicTask(this.logger, { name: 'ConversationHistoryPlugin.savePending', intervalMs: this.pluginOptions.saveInterval }, async () => {
|
|
266
|
-
await this.savePending();
|
|
267
|
-
});
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
//# sourceMappingURL=conversation-history-plugin.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"conversation-history-plugin.js","sourceRoot":"","sources":["../../../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Aa,CAAC,OAAO,EAAE,CAAC,CAAC;QAC3G,CAAC;IACL,CAAC;IAED;;OAEG;IACK,gBAAgB;QACpB,IAAI,CAAC,cAAc,GAAG,iBAAiB,CACnC,IAAI,CAAC,MAAM,EACX,EAAE,IAAI,EAAE,uCAAuC,EAAE,UAAU,EAAE,IAAI,CAAC,aAAa,CAAC,YAAY,EAAE,EAC9F,KAAK,IAAI,EAAE;YACP,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;QAC7B,CAAC,CACJ,CAAC;IACN,CAAC;CACJ"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/conversation-history/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EACH,KAAK,iCAAiC,EACtC,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAC5B,KAAK,eAAe,EACvB,MAAM,SAAS,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plugins/conversation-history/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { IHistoryStorage, IConversationHistoryEntry } from '../types';
|
|
2
|
-
/**
|
|
3
|
-
* Database storage implementation
|
|
4
|
-
*/
|
|
5
|
-
export declare class DatabaseHistoryStorage implements IHistoryStorage {
|
|
6
|
-
private connectionString;
|
|
7
|
-
private logger;
|
|
8
|
-
constructor(connectionString: string);
|
|
9
|
-
save(conversationId: string, _entry: IConversationHistoryEntry): Promise<void>;
|
|
10
|
-
load(conversationId: string): Promise<IConversationHistoryEntry | undefined>;
|
|
11
|
-
list(): Promise<string[]>;
|
|
12
|
-
delete(conversationId: string): Promise<boolean>;
|
|
13
|
-
clear(): Promise<void>;
|
|
14
|
-
/**
|
|
15
|
-
* Mask sensitive information in connection string for logging
|
|
16
|
-
*/
|
|
17
|
-
private maskConnectionString;
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=database-storage.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"database-storage.d.ts","sourceRoot":"","sources":["../../../../src/plugins/conversation-history/storages/database-storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAI3E;;GAEG;AACH,qBAAa,sBAAuB,YAAW,eAAe;IAC1D,OAAO,CAAC,gBAAgB,CAAS;IACjC,OAAO,CAAC,MAAM,CAAU;gBAEZ,gBAAgB,EAAE,MAAM;IAK9B,IAAI,CAAC,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC;IAe9E,IAAI,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,yBAAyB,GAAG,SAAS,CAAC;IAgB5E,IAAI,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAczB,MAAM,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAgBhD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAa5B;;OAEG;IACH,OAAO,CAAC,oBAAoB;CAG/B"}
|