@robota-sdk/agent-core 3.0.0-beta.14 → 3.0.0-beta.16
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 +2 -0
- package/dist/abstracts/abstract-agent.d.ts.map +1 -1
- package/dist/abstracts/abstract-agent.js.map +1 -1
- package/dist/abstracts/abstract-ai-provider.d.ts +8 -7
- package/dist/abstracts/abstract-ai-provider.d.ts.map +1 -1
- package/dist/abstracts/abstract-ai-provider.js +21 -15
- package/dist/abstracts/abstract-ai-provider.js.map +1 -1
- package/dist/abstracts/abstract-executor.d.ts.map +1 -1
- package/dist/abstracts/abstract-executor.js +20 -12
- package/dist/abstracts/abstract-executor.js.map +1 -1
- package/dist/abstracts/abstract-manager.d.ts.map +1 -1
- package/dist/abstracts/abstract-manager.js.map +1 -1
- package/dist/abstracts/abstract-module-events.d.ts +77 -0
- package/dist/abstracts/abstract-module-events.d.ts.map +1 -0
- package/dist/abstracts/abstract-module-events.js +8 -0
- package/dist/abstracts/abstract-module-events.js.map +1 -0
- package/dist/abstracts/abstract-module-types.d.ts +110 -0
- package/dist/abstracts/abstract-module-types.d.ts.map +1 -0
- package/dist/abstracts/abstract-module-types.js +20 -0
- package/dist/abstracts/abstract-module-types.js.map +1 -0
- package/dist/abstracts/abstract-module.d.ts +13 -312
- package/dist/abstracts/abstract-module.d.ts.map +1 -1
- package/dist/abstracts/abstract-module.js +137 -302
- package/dist/abstracts/abstract-module.js.map +1 -1
- package/dist/abstracts/abstract-module.test.d.ts +2 -0
- package/dist/abstracts/abstract-module.test.d.ts.map +1 -0
- package/dist/abstracts/abstract-module.test.js +150 -0
- package/dist/abstracts/abstract-module.test.js.map +1 -0
- package/dist/abstracts/abstract-plugin-types.d.ts +152 -0
- package/dist/abstracts/abstract-plugin-types.d.ts.map +1 -0
- package/dist/abstracts/abstract-plugin-types.js +29 -0
- package/dist/abstracts/abstract-plugin-types.js.map +1 -0
- package/dist/abstracts/abstract-plugin.d.ts +15 -304
- package/dist/abstracts/abstract-plugin.d.ts.map +1 -1
- package/dist/abstracts/abstract-plugin.js +28 -144
- package/dist/abstracts/abstract-plugin.js.map +1 -1
- package/dist/abstracts/abstract-tool.d.ts +1 -1
- package/dist/abstracts/abstract-tool.d.ts.map +1 -1
- package/dist/abstracts/abstract-tool.js +2 -2
- package/dist/abstracts/abstract-tool.js.map +1 -1
- package/dist/abstracts/abstract-workflow-converter.d.ts.map +1 -1
- package/dist/abstracts/abstract-workflow-converter.js +29 -20
- package/dist/abstracts/abstract-workflow-converter.js.map +1 -1
- package/dist/abstracts/abstract-workflow-converter.test.d.ts +2 -0
- package/dist/abstracts/abstract-workflow-converter.test.d.ts.map +1 -0
- package/dist/abstracts/abstract-workflow-converter.test.js +144 -0
- package/dist/abstracts/abstract-workflow-converter.test.js.map +1 -0
- package/dist/abstracts/abstract-workflow-validator-helpers.d.ts +37 -0
- package/dist/abstracts/abstract-workflow-validator-helpers.d.ts.map +1 -0
- package/dist/abstracts/abstract-workflow-validator-helpers.js +147 -0
- package/dist/abstracts/abstract-workflow-validator-helpers.js.map +1 -0
- package/dist/abstracts/abstract-workflow-validator-helpers.test.d.ts +2 -0
- package/dist/abstracts/abstract-workflow-validator-helpers.test.d.ts.map +1 -0
- package/dist/abstracts/abstract-workflow-validator-helpers.test.js +157 -0
- package/dist/abstracts/abstract-workflow-validator-helpers.test.js.map +1 -0
- package/dist/abstracts/abstract-workflow-validator.d.ts +18 -130
- package/dist/abstracts/abstract-workflow-validator.d.ts.map +1 -1
- package/dist/abstracts/abstract-workflow-validator.js +58 -326
- package/dist/abstracts/abstract-workflow-validator.js.map +1 -1
- package/dist/abstracts/abstract-workflow-validator.test.d.ts +2 -0
- package/dist/abstracts/abstract-workflow-validator.test.d.ts.map +1 -0
- package/dist/abstracts/abstract-workflow-validator.test.js +142 -0
- package/dist/abstracts/abstract-workflow-validator.test.js.map +1 -0
- package/dist/abstracts/index.d.ts +1 -0
- package/dist/abstracts/index.d.ts.map +1 -1
- package/dist/abstracts/index.js +3 -2
- package/dist/abstracts/index.js.map +1 -1
- package/dist/agents/constants.d.ts +1 -1
- package/dist/agents/constants.d.ts.map +1 -1
- package/dist/agents/constants.js +1 -1
- package/dist/agents/constants.js.map +1 -1
- package/dist/agents/index.js +1 -1
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/robota.test.js +36 -36
- package/dist/agents/robota.test.js.map +1 -1
- package/dist/browser/index.d.ts +28 -1
- package/dist/browser/index.js +5 -5
- package/dist/context/index.d.ts +4 -0
- package/dist/context/index.d.ts.map +1 -0
- package/dist/context/index.js +2 -0
- package/dist/context/index.js.map +1 -0
- package/dist/context/models.d.ts +27 -0
- package/dist/context/models.d.ts.map +1 -0
- package/dist/context/models.js +76 -0
- package/dist/context/models.js.map +1 -0
- package/dist/context/models.test.d.ts +2 -0
- package/dist/context/models.test.d.ts.map +1 -0
- package/dist/context/models.test.js +51 -0
- package/dist/context/models.test.js.map +1 -0
- package/dist/context/types.d.ts +25 -0
- package/dist/context/types.d.ts.map +1 -0
- package/dist/context/types.js +8 -0
- package/dist/context/types.js.map +1 -0
- package/dist/core/robota-config-manager.d.ts +78 -0
- package/dist/core/robota-config-manager.d.ts.map +1 -0
- package/dist/core/robota-config-manager.js +216 -0
- package/dist/core/robota-config-manager.js.map +1 -0
- package/dist/core/robota-execution.d.ts +23 -0
- package/dist/core/robota-execution.d.ts.map +1 -0
- package/dist/core/robota-execution.js +81 -0
- package/dist/core/robota-execution.js.map +1 -0
- package/dist/core/robota-initializer.d.ts +37 -0
- package/dist/core/robota-initializer.d.ts.map +1 -0
- package/dist/core/robota-initializer.js +77 -0
- package/dist/core/robota-initializer.js.map +1 -0
- package/dist/core/robota-lifecycle.d.ts +53 -0
- package/dist/core/robota-lifecycle.d.ts.map +1 -0
- package/dist/core/robota-lifecycle.js +73 -0
- package/dist/core/robota-lifecycle.js.map +1 -0
- package/dist/core/robota-module-manager.d.ts +78 -0
- package/dist/core/robota-module-manager.d.ts.map +1 -0
- package/dist/core/robota-module-manager.js +114 -0
- package/dist/core/robota-module-manager.js.map +1 -0
- package/dist/core/robota-plugin-manager.d.ts +40 -0
- package/dist/core/robota-plugin-manager.d.ts.map +1 -0
- package/dist/core/robota-plugin-manager.js +71 -0
- package/dist/core/robota-plugin-manager.js.map +1 -0
- package/dist/core/robota.d.ts +56 -606
- package/dist/core/robota.d.ts.map +1 -1
- package/dist/core/robota.js +210 -1152
- package/dist/core/robota.js.map +1 -1
- package/dist/core/robota.test.d.ts +2 -0
- package/dist/core/robota.test.d.ts.map +1 -0
- package/dist/core/robota.test.js +353 -0
- package/dist/core/robota.test.js.map +1 -0
- package/dist/event-service/event-service.d.ts +61 -0
- package/dist/event-service/event-service.d.ts.map +1 -0
- package/dist/event-service/event-service.js +120 -0
- package/dist/event-service/event-service.js.map +1 -0
- package/dist/event-service/index.d.ts +6 -0
- package/dist/event-service/index.d.ts.map +1 -0
- package/dist/event-service/index.js +4 -0
- package/dist/event-service/index.js.map +1 -0
- package/dist/event-service/interfaces.d.ts +98 -0
- package/dist/event-service/interfaces.d.ts.map +1 -0
- package/dist/event-service/interfaces.js +8 -0
- package/dist/event-service/interfaces.js.map +1 -0
- package/dist/event-service/task-events.d.ts +6 -0
- package/dist/event-service/task-events.d.ts.map +1 -0
- package/dist/event-service/task-events.js +6 -0
- package/dist/event-service/task-events.js.map +1 -0
- package/dist/event-service/user-events.d.ts +7 -0
- package/dist/event-service/user-events.d.ts.map +1 -0
- package/dist/event-service/user-events.js +6 -0
- package/dist/event-service/user-events.js.map +1 -0
- package/dist/executors/local-executor.d.ts +2 -2
- package/dist/executors/local-executor.d.ts.map +1 -1
- package/dist/executors/local-executor.js +7 -7
- package/dist/executors/local-executor.js.map +1 -1
- package/dist/executors/local-executor.test.js +16 -16
- package/dist/executors/local-executor.test.js.map +1 -1
- package/dist/hooks/hook-runner.d.ts +20 -0
- package/dist/hooks/hook-runner.d.ts.map +1 -0
- package/dist/hooks/hook-runner.js +95 -0
- package/dist/hooks/hook-runner.js.map +1 -0
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +3 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/types.d.ts +40 -0
- package/dist/hooks/types.d.ts.map +1 -0
- package/dist/hooks/types.js +5 -0
- package/dist/hooks/types.js.map +1 -0
- package/dist/index.d.ts +49 -75
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +26 -71
- package/dist/index.js.map +1 -1
- package/dist/interfaces/agent.d.ts +3 -2
- package/dist/interfaces/agent.d.ts.map +1 -1
- package/dist/interfaces/cache.d.ts +64 -0
- package/dist/interfaces/cache.d.ts.map +1 -0
- package/dist/interfaces/cache.js +2 -0
- package/dist/interfaces/cache.js.map +1 -0
- package/dist/interfaces/event-service.d.ts +4 -75
- package/dist/interfaces/event-service.d.ts.map +1 -1
- package/dist/interfaces/executor.d.ts.map +1 -1
- package/dist/interfaces/history-module.d.ts.map +1 -1
- package/dist/interfaces/index.d.ts +12 -9
- package/dist/interfaces/index.d.ts.map +1 -1
- package/dist/interfaces/index.js +2 -1
- package/dist/interfaces/index.js.map +1 -1
- package/dist/interfaces/manager.d.ts.map +1 -1
- package/dist/interfaces/media-provider.d.ts +86 -0
- package/dist/interfaces/media-provider.d.ts.map +1 -0
- package/dist/interfaces/media-provider.js +13 -0
- package/dist/interfaces/media-provider.js.map +1 -0
- package/dist/interfaces/messages.d.ts +23 -1
- package/dist/interfaces/messages.d.ts.map +1 -1
- package/dist/interfaces/messages.js.map +1 -1
- package/dist/interfaces/progress-reporting.d.ts.map +1 -1
- package/dist/interfaces/progress-reporting.js +1 -3
- package/dist/interfaces/progress-reporting.js.map +1 -1
- package/dist/interfaces/provider.d.ts +12 -1
- package/dist/interfaces/provider.d.ts.map +1 -1
- package/dist/interfaces/service.d.ts.map +1 -1
- package/dist/interfaces/tool.d.ts +1 -0
- package/dist/interfaces/tool.d.ts.map +1 -1
- package/dist/interfaces/types.d.ts.map +1 -1
- package/dist/interfaces/types.js +6 -6
- package/dist/interfaces/types.js.map +1 -1
- package/dist/interfaces/workflow-converter.d.ts.map +1 -1
- package/dist/interfaces/workflow-validator.d.ts.map +1 -1
- package/dist/interfaces/workflow-validator.js.map +1 -1
- package/dist/managers/agent-factory.d.ts.map +1 -1
- package/dist/managers/agent-factory.js +24 -16
- package/dist/managers/agent-factory.js.map +1 -1
- package/dist/managers/agent-factory.test.js +35 -25
- package/dist/managers/agent-factory.test.js.map +1 -1
- package/dist/managers/agent-templates.d.ts.map +1 -1
- package/dist/managers/agent-templates.js +22 -10
- package/dist/managers/agent-templates.js.map +1 -1
- package/dist/managers/agent-templates.test.d.ts +2 -0
- package/dist/managers/agent-templates.test.d.ts.map +1 -0
- package/dist/managers/agent-templates.test.js +175 -0
- package/dist/managers/agent-templates.test.js.map +1 -0
- package/dist/managers/ai-provider-manager.d.ts.map +1 -1
- package/dist/managers/ai-provider-manager.js +8 -10
- package/dist/managers/ai-provider-manager.js.map +1 -1
- package/dist/managers/ai-provider-manager.test.d.ts +2 -0
- package/dist/managers/ai-provider-manager.test.d.ts.map +1 -0
- package/dist/managers/ai-provider-manager.test.js +327 -0
- package/dist/managers/ai-provider-manager.test.js.map +1 -0
- package/dist/managers/conversation-history-manager.d.ts +13 -425
- package/dist/managers/conversation-history-manager.d.ts.map +1 -1
- package/dist/managers/conversation-history-manager.js +21 -537
- package/dist/managers/conversation-history-manager.js.map +1 -1
- package/dist/managers/conversation-history-manager.test.js +82 -43
- package/dist/managers/conversation-history-manager.test.js.map +1 -1
- package/dist/managers/conversation-message-factory.d.ts +40 -0
- package/dist/managers/conversation-message-factory.d.ts.map +1 -0
- package/dist/managers/conversation-message-factory.js +66 -0
- package/dist/managers/conversation-message-factory.js.map +1 -0
- package/dist/managers/conversation-message-factory.test.d.ts +2 -0
- package/dist/managers/conversation-message-factory.test.d.ts.map +1 -0
- package/dist/managers/conversation-message-factory.test.js +95 -0
- package/dist/managers/conversation-message-factory.test.js.map +1 -0
- package/dist/managers/conversation-session.d.ts +90 -0
- package/dist/managers/conversation-session.d.ts.map +1 -0
- package/dist/managers/conversation-session.js +177 -0
- package/dist/managers/conversation-session.js.map +1 -0
- package/dist/managers/index.d.ts +2 -2
- package/dist/managers/index.d.ts.map +1 -1
- package/dist/managers/index.js +1 -1
- package/dist/managers/index.js.map +1 -1
- package/dist/managers/module-registry-validation.d.ts +38 -0
- package/dist/managers/module-registry-validation.d.ts.map +1 -0
- package/dist/managers/module-registry-validation.js +100 -0
- package/dist/managers/module-registry-validation.js.map +1 -0
- package/dist/managers/module-registry-validation.test.d.ts +2 -0
- package/dist/managers/module-registry-validation.test.d.ts.map +1 -0
- package/dist/managers/module-registry-validation.test.js +144 -0
- package/dist/managers/module-registry-validation.test.js.map +1 -0
- package/dist/managers/module-registry.d.ts +13 -111
- package/dist/managers/module-registry.d.ts.map +1 -1
- package/dist/managers/module-registry.js +74 -344
- package/dist/managers/module-registry.js.map +1 -1
- package/dist/managers/module-type-registry-helpers.d.ts +34 -0
- package/dist/managers/module-type-registry-helpers.d.ts.map +1 -0
- package/dist/managers/module-type-registry-helpers.js +255 -0
- package/dist/managers/module-type-registry-helpers.js.map +1 -0
- package/dist/managers/module-type-registry.d.ts +10 -64
- package/dist/managers/module-type-registry.d.ts.map +1 -1
- package/dist/managers/module-type-registry.js +25 -373
- package/dist/managers/module-type-registry.js.map +1 -1
- package/dist/managers/plugins-helpers.d.ts +18 -0
- package/dist/managers/plugins-helpers.d.ts.map +1 -0
- package/dist/managers/plugins-helpers.js +118 -0
- package/dist/managers/plugins-helpers.js.map +1 -0
- package/dist/managers/plugins-helpers.test.d.ts +2 -0
- package/dist/managers/plugins-helpers.test.d.ts.map +1 -0
- package/dist/managers/plugins-helpers.test.js +68 -0
- package/dist/managers/plugins-helpers.test.js.map +1 -0
- package/dist/managers/plugins.d.ts +16 -109
- package/dist/managers/plugins.d.ts.map +1 -1
- package/dist/managers/plugins.js +29 -220
- package/dist/managers/plugins.js.map +1 -1
- package/dist/managers/plugins.test.d.ts +2 -0
- package/dist/managers/plugins.test.d.ts.map +1 -0
- package/dist/managers/plugins.test.js +160 -0
- package/dist/managers/plugins.test.js.map +1 -0
- package/dist/managers/tool-manager.d.ts +1 -1
- package/dist/managers/tool-manager.d.ts.map +1 -1
- package/dist/managers/tool-manager.js +15 -5
- package/dist/managers/tool-manager.js.map +1 -1
- package/dist/managers/tool-manager.test.js +32 -16
- package/dist/managers/tool-manager.test.js.map +1 -1
- package/dist/node/index.cjs +5 -5
- package/dist/node/index.d.cts +28 -1
- package/dist/node/index.d.ts +28 -1
- package/dist/node/index.js +5 -5
- package/dist/permissions/index.d.ts +7 -0
- package/dist/permissions/index.d.ts.map +1 -0
- package/dist/permissions/index.js +4 -0
- package/dist/permissions/index.js.map +1 -0
- package/dist/permissions/permission-gate.d.ts +38 -0
- package/dist/permissions/permission-gate.d.ts.map +1 -0
- package/dist/permissions/permission-gate.js +119 -0
- package/dist/permissions/permission-gate.js.map +1 -0
- package/dist/permissions/permission-mode.d.ts +25 -0
- package/dist/permissions/permission-mode.d.ts.map +1 -0
- package/dist/permissions/permission-mode.js +58 -0
- package/dist/permissions/permission-mode.js.map +1 -0
- package/dist/permissions/types.d.ts +27 -0
- package/dist/permissions/types.d.ts.map +1 -0
- package/dist/permissions/types.js +9 -0
- package/dist/permissions/types.js.map +1 -0
- package/dist/plugins/event-emitter/metrics.d.ts.map +1 -1
- package/dist/plugins/event-emitter/metrics.js +1 -1
- package/dist/plugins/event-emitter/metrics.js.map +1 -1
- package/dist/plugins/event-emitter/plugin-types.d.ts +88 -0
- package/dist/plugins/event-emitter/plugin-types.d.ts.map +1 -0
- package/dist/plugins/event-emitter/plugin-types.js +2 -0
- package/dist/plugins/event-emitter/plugin-types.js.map +1 -0
- package/dist/plugins/event-emitter/types.d.ts +3 -3
- package/dist/plugins/event-emitter/types.d.ts.map +1 -1
- package/dist/plugins/event-emitter/types.js +4 -4
- package/dist/plugins/event-emitter/types.js.map +1 -1
- package/dist/plugins/event-emitter-plugin.d.ts +9 -184
- package/dist/plugins/event-emitter-plugin.d.ts.map +1 -1
- package/dist/plugins/event-emitter-plugin.js +91 -235
- package/dist/plugins/event-emitter-plugin.js.map +1 -1
- package/dist/schemas/agent-template-schema.d.ts +12 -12
- package/dist/schemas/agent-template-schema.d.ts.map +1 -1
- package/dist/schemas/agent-template-schema.js +35 -33
- package/dist/schemas/agent-template-schema.js.map +1 -1
- package/dist/services/cache/cache-key-builder.d.ts +13 -0
- package/dist/services/cache/cache-key-builder.d.ts.map +1 -0
- package/dist/services/cache/cache-key-builder.js +30 -0
- package/dist/services/cache/cache-key-builder.js.map +1 -0
- package/dist/services/cache/cache-key-builder.test.d.ts +2 -0
- package/dist/services/cache/cache-key-builder.test.d.ts.map +1 -0
- package/dist/services/cache/cache-key-builder.test.js +56 -0
- package/dist/services/cache/cache-key-builder.test.js.map +1 -0
- package/dist/services/cache/execution-cache-service.d.ts +18 -0
- package/dist/services/cache/execution-cache-service.d.ts.map +1 -0
- package/dist/services/cache/execution-cache-service.js +26 -0
- package/dist/services/cache/execution-cache-service.js.map +1 -0
- package/dist/services/cache/execution-cache-service.test.d.ts +2 -0
- package/dist/services/cache/execution-cache-service.test.d.ts.map +1 -0
- package/dist/services/cache/execution-cache-service.test.js +59 -0
- package/dist/services/cache/execution-cache-service.test.js.map +1 -0
- package/dist/services/cache/index.d.ts +4 -0
- package/dist/services/cache/index.d.ts.map +1 -0
- package/dist/services/cache/index.js +4 -0
- package/dist/services/cache/index.js.map +1 -0
- package/dist/services/cache/memory-cache-storage.d.ts +25 -0
- package/dist/services/cache/memory-cache-storage.d.ts.map +1 -0
- package/dist/services/cache/memory-cache-storage.js +89 -0
- package/dist/services/cache/memory-cache-storage.js.map +1 -0
- package/dist/services/cache/memory-cache-storage.test.d.ts +2 -0
- package/dist/services/cache/memory-cache-storage.test.d.ts.map +1 -0
- package/dist/services/cache/memory-cache-storage.test.js +94 -0
- package/dist/services/cache/memory-cache-storage.test.js.map +1 -0
- package/dist/services/conversation-service/conversation-service.test.d.ts +2 -0
- package/dist/services/conversation-service/conversation-service.test.d.ts.map +1 -0
- package/dist/services/conversation-service/conversation-service.test.js +248 -0
- package/dist/services/conversation-service/conversation-service.test.js.map +1 -0
- package/dist/services/conversation-service/index.d.ts +10 -71
- package/dist/services/conversation-service/index.d.ts.map +1 -1
- package/dist/services/conversation-service/index.js +58 -355
- package/dist/services/conversation-service/index.js.map +1 -1
- package/dist/services/conversation-service/message-helpers.d.ts +47 -0
- package/dist/services/conversation-service/message-helpers.d.ts.map +1 -0
- package/dist/services/conversation-service/message-helpers.js +150 -0
- package/dist/services/conversation-service/message-helpers.js.map +1 -0
- package/dist/services/conversation-service/types.d.ts.map +1 -1
- package/dist/services/execution-constants.d.ts +16 -0
- package/dist/services/execution-constants.d.ts.map +1 -0
- package/dist/services/execution-constants.js +16 -0
- package/dist/services/execution-constants.js.map +1 -0
- package/dist/services/execution-event-emitter.d.ts +60 -0
- package/dist/services/execution-event-emitter.d.ts.map +1 -0
- package/dist/services/execution-event-emitter.js +323 -0
- package/dist/services/execution-event-emitter.js.map +1 -0
- package/dist/services/execution-round.d.ts +58 -0
- package/dist/services/execution-round.d.ts.map +1 -0
- package/dist/services/execution-round.js +323 -0
- package/dist/services/execution-round.js.map +1 -0
- package/dist/services/execution-round.test.d.ts +2 -0
- package/dist/services/execution-round.test.d.ts.map +1 -0
- package/dist/services/execution-round.test.js +188 -0
- package/dist/services/execution-round.test.js.map +1 -0
- package/dist/services/execution-service.d.ts +28 -125
- package/dist/services/execution-service.d.ts.map +1 -1
- package/dist/services/execution-service.js +222 -1134
- package/dist/services/execution-service.js.map +1 -1
- package/dist/services/execution-service.test.js +115 -72
- package/dist/services/execution-service.test.js.map +1 -1
- package/dist/services/execution-stream.d.ts +32 -0
- package/dist/services/execution-stream.d.ts.map +1 -0
- package/dist/services/execution-stream.js +268 -0
- package/dist/services/execution-stream.js.map +1 -0
- package/dist/services/execution-types.d.ts +122 -0
- package/dist/services/execution-types.d.ts.map +1 -0
- package/dist/services/execution-types.js +48 -0
- package/dist/services/execution-types.js.map +1 -0
- package/dist/services/history-module.d.ts.map +1 -1
- package/dist/services/history-module.js +1 -1
- package/dist/services/history-module.js.map +1 -1
- package/dist/services/history-module.test.d.ts +2 -0
- package/dist/services/history-module.test.d.ts.map +1 -0
- package/dist/services/history-module.test.js +137 -0
- package/dist/services/history-module.test.js.map +1 -0
- package/dist/services/in-memory-history-store.d.ts.map +1 -1
- package/dist/services/in-memory-history-store.js +1 -1
- package/dist/services/in-memory-history-store.js.map +1 -1
- package/dist/services/index.d.ts +0 -1
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +2 -3
- package/dist/services/index.js.map +1 -1
- package/dist/services/plugin-hook-dispatcher.d.ts +11 -0
- package/dist/services/plugin-hook-dispatcher.d.ts.map +1 -0
- package/dist/services/plugin-hook-dispatcher.js +68 -0
- package/dist/services/plugin-hook-dispatcher.js.map +1 -0
- package/dist/services/plugin-hook-dispatcher.test.d.ts +2 -0
- package/dist/services/plugin-hook-dispatcher.test.d.ts.map +1 -0
- package/dist/services/plugin-hook-dispatcher.test.js +93 -0
- package/dist/services/plugin-hook-dispatcher.test.js.map +1 -0
- package/dist/services/plugin-priority.test.d.ts +2 -0
- package/dist/services/plugin-priority.test.d.ts.map +1 -0
- package/dist/services/plugin-priority.test.js +119 -0
- package/dist/services/plugin-priority.test.js.map +1 -0
- package/dist/services/tool-execution-service.d.ts +1 -0
- package/dist/services/tool-execution-service.d.ts.map +1 -1
- package/dist/services/tool-execution-service.js +89 -46
- package/dist/services/tool-execution-service.js.map +1 -1
- package/dist/services/tool-execution-service.test.d.ts +2 -0
- package/dist/services/tool-execution-service.test.d.ts.map +1 -0
- package/dist/services/tool-execution-service.test.js +358 -0
- package/dist/services/tool-execution-service.test.js.map +1 -0
- package/dist/tool-registry/function-tool.d.ts +54 -0
- package/dist/tool-registry/function-tool.d.ts.map +1 -0
- package/dist/tool-registry/function-tool.js +190 -0
- package/dist/tool-registry/function-tool.js.map +1 -0
- package/dist/tool-registry/index.d.ts +3 -0
- package/dist/tool-registry/index.d.ts.map +1 -0
- package/dist/tool-registry/index.js +3 -0
- package/dist/tool-registry/index.js.map +1 -0
- package/dist/tool-registry/tool-registry.d.ts +54 -0
- package/dist/tool-registry/tool-registry.d.ts.map +1 -0
- package/dist/tool-registry/tool-registry.js +148 -0
- package/dist/tool-registry/tool-registry.js.map +1 -0
- package/dist/utils/errors.d.ts +11 -2
- package/dist/utils/errors.d.ts.map +1 -1
- package/dist/utils/errors.js +13 -2
- package/dist/utils/errors.js.map +1 -1
- package/dist/utils/errors.test.d.ts +2 -0
- package/dist/utils/errors.test.d.ts.map +1 -0
- package/dist/utils/errors.test.js +361 -0
- package/dist/utils/errors.test.js.map +1 -0
- package/dist/utils/execution-proxy.d.ts +7 -3
- package/dist/utils/execution-proxy.d.ts.map +1 -1
- package/dist/utils/execution-proxy.js +64 -42
- package/dist/utils/execution-proxy.js.map +1 -1
- package/dist/utils/execution-proxy.test.d.ts +2 -0
- package/dist/utils/execution-proxy.test.d.ts.map +1 -0
- package/dist/utils/execution-proxy.test.js +179 -0
- package/dist/utils/execution-proxy.test.js.map +1 -0
- package/dist/utils/logger.d.ts +3 -3
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +9 -5
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/message-converter.d.ts +1 -4
- package/dist/utils/message-converter.d.ts.map +1 -1
- package/dist/utils/message-converter.js +13 -12
- package/dist/utils/message-converter.js.map +1 -1
- package/dist/utils/message-converter.test.d.ts +2 -0
- package/dist/utils/message-converter.test.d.ts.map +1 -0
- package/dist/utils/message-converter.test.js +164 -0
- package/dist/utils/message-converter.test.js.map +1 -0
- package/dist/utils/periodic-task.d.ts +1 -1
- package/dist/utils/periodic-task.d.ts.map +1 -1
- package/dist/utils/periodic-task.js +1 -1
- package/dist/utils/periodic-task.js.map +1 -1
- package/dist/utils/periodic-task.test.d.ts +2 -0
- package/dist/utils/periodic-task.test.d.ts.map +1 -0
- package/dist/utils/periodic-task.test.js +87 -0
- package/dist/utils/periodic-task.test.js.map +1 -0
- package/dist/utils/validation.d.ts.map +1 -1
- package/dist/utils/validation.js +17 -11
- package/dist/utils/validation.js.map +1 -1
- package/dist/utils/validation.test.d.ts +2 -0
- package/dist/utils/validation.test.d.ts.map +1 -0
- package/dist/utils/validation.test.js +249 -0
- package/dist/utils/validation.test.js.map +1 -0
- package/package.json +1 -1
|
@@ -1,332 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Abstract class for all plugins with type parameter support.
|
|
3
|
+
*
|
|
4
|
+
* Type definitions live in ./abstract-plugin-types.ts.
|
|
5
|
+
*/
|
|
1
6
|
import type { IRunOptions } from '../interfaces/agent';
|
|
2
7
|
import type { TUniversalMessage } from '../interfaces/messages';
|
|
3
8
|
import type { TToolParameters, IToolExecutionResult, IToolExecutionContext } from '../interfaces/tool';
|
|
4
9
|
import type { IEventEmitterEventData, IEventEmitterPlugin, TEventName } from '../plugins/event-emitter/types';
|
|
10
|
+
import { type ILogger } from '../utils/logger';
|
|
11
|
+
import type { IPluginOptions, IPluginStats, IPluginConfig, IPluginData, IPluginContract, IPluginHooks, IPluginExecutionContext, IPluginExecutionResult, IPluginErrorContext } from './abstract-plugin-types';
|
|
12
|
+
import { PluginCategory, PluginPriority } from './abstract-plugin-types';
|
|
13
|
+
export type { IPluginOptions, IPluginStats, IPluginConfig, IPluginData, IPluginContract, IPluginHooks, IPluginExecutionContext, IPluginExecutionResult, IPluginErrorContext, };
|
|
14
|
+
export type { IPlugin } from './abstract-plugin-types';
|
|
15
|
+
export { PluginCategory, PluginPriority };
|
|
5
16
|
/**
|
|
6
|
-
*
|
|
7
|
-
|
|
8
|
-
export declare enum PluginCategory {
|
|
9
|
-
/** Monitoring and observability */
|
|
10
|
-
MONITORING = "monitoring",
|
|
11
|
-
/** Logging and debugging */
|
|
12
|
-
LOGGING = "logging",
|
|
13
|
-
/** Data storage and persistence */
|
|
14
|
-
STORAGE = "storage",
|
|
15
|
-
/** External notifications and alerts */
|
|
16
|
-
NOTIFICATION = "notification",
|
|
17
|
-
/** Security and access control */
|
|
18
|
-
SECURITY = "security",
|
|
19
|
-
/** Performance optimization */
|
|
20
|
-
PERFORMANCE = "performance",
|
|
21
|
-
/** Error handling and recovery */
|
|
22
|
-
ERROR_HANDLING = "error_handling",
|
|
23
|
-
/** Rate limiting and throttling */
|
|
24
|
-
LIMITS = "limits",
|
|
25
|
-
/** Event processing and coordination */
|
|
26
|
-
EVENT_PROCESSING = "event_processing",
|
|
27
|
-
/** Custom or specialized functionality */
|
|
28
|
-
CUSTOM = "custom"
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Plugin priority levels
|
|
32
|
-
*/
|
|
33
|
-
export declare enum PluginPriority {
|
|
34
|
-
/** Highest priority - executed first */
|
|
35
|
-
CRITICAL = 1000,
|
|
36
|
-
/** High priority */
|
|
37
|
-
HIGH = 800,
|
|
38
|
-
/** Normal priority (default) */
|
|
39
|
-
NORMAL = 500,
|
|
40
|
-
/** Low priority */
|
|
41
|
-
LOW = 200,
|
|
42
|
-
/** Lowest priority - executed last */
|
|
43
|
-
MINIMAL = 100
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Plugin execution context for all plugins
|
|
47
|
-
*/
|
|
48
|
-
export interface IPluginExecutionContext {
|
|
49
|
-
executionId?: string;
|
|
50
|
-
sessionId?: string;
|
|
51
|
-
userId?: string;
|
|
52
|
-
messages?: TUniversalMessage[];
|
|
53
|
-
config?: Record<string, string | number | boolean>;
|
|
54
|
-
metadata?: Record<string, string | number | boolean | Date>;
|
|
55
|
-
[key: string]: string | number | boolean | Date | string[] | number[] | boolean[] | TUniversalMessage[] | Record<string, string | number | boolean> | Record<string, string | number | boolean | Date> | undefined;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Plugin execution result for all plugins
|
|
59
|
-
*/
|
|
60
|
-
export interface IPluginExecutionResult {
|
|
61
|
-
response?: string;
|
|
62
|
-
content?: string;
|
|
63
|
-
duration?: number;
|
|
64
|
-
tokensUsed?: number;
|
|
65
|
-
toolsExecuted?: number;
|
|
66
|
-
success?: boolean;
|
|
67
|
-
usage?: {
|
|
68
|
-
totalTokens?: number;
|
|
69
|
-
promptTokens?: number;
|
|
70
|
-
completionTokens?: number;
|
|
71
|
-
};
|
|
72
|
-
toolCalls?: Array<{
|
|
73
|
-
id?: string;
|
|
74
|
-
name?: string;
|
|
75
|
-
arguments?: Record<string, string | number | boolean>;
|
|
76
|
-
result?: string | number | boolean | null;
|
|
77
|
-
}>;
|
|
78
|
-
results?: Array<{
|
|
79
|
-
id?: string;
|
|
80
|
-
type?: string;
|
|
81
|
-
data?: string | number | boolean | null;
|
|
82
|
-
success?: boolean;
|
|
83
|
-
}>;
|
|
84
|
-
error?: Error;
|
|
85
|
-
metadata?: Record<string, string | number | boolean | Date>;
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Error context for plugin error handling
|
|
89
|
-
*/
|
|
90
|
-
export interface IPluginErrorContext {
|
|
91
|
-
action: string;
|
|
92
|
-
tool?: string;
|
|
93
|
-
parameters?: TToolParameters;
|
|
94
|
-
result?: IToolExecutionResult;
|
|
95
|
-
error?: Error;
|
|
96
|
-
executionId?: string;
|
|
97
|
-
sessionId?: string;
|
|
98
|
-
userId?: string;
|
|
99
|
-
timestamp?: Date;
|
|
100
|
-
attempt?: number;
|
|
101
|
-
stack?: string;
|
|
102
|
-
metadata?: Record<string, string | number | boolean>;
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Plugin configuration interface
|
|
106
|
-
*/
|
|
107
|
-
export interface IPluginConfig extends IPluginOptions {
|
|
108
|
-
options?: Record<string, string | number | boolean>;
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Plugin options that all plugin options should extend
|
|
112
|
-
* This provides a common structure while allowing specific options
|
|
113
|
-
*/
|
|
114
|
-
export interface IPluginOptions {
|
|
115
|
-
/** Whether the plugin is enabled */
|
|
116
|
-
enabled?: boolean;
|
|
117
|
-
/** Plugin category for classification */
|
|
118
|
-
category?: PluginCategory;
|
|
119
|
-
/** Plugin priority for execution order */
|
|
120
|
-
priority?: PluginPriority | number;
|
|
121
|
-
/** Events to subscribe to from modules */
|
|
122
|
-
moduleEvents?: TEventName[];
|
|
123
|
-
/** Whether to subscribe to all module events */
|
|
124
|
-
subscribeToAllModuleEvents?: boolean;
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* Plugin data interface
|
|
128
|
-
*/
|
|
129
|
-
export interface IPluginData {
|
|
130
|
-
name: string;
|
|
131
|
-
version: string;
|
|
132
|
-
enabled: boolean;
|
|
133
|
-
category: PluginCategory;
|
|
134
|
-
priority: number;
|
|
135
|
-
subscribedEvents: TEventName[];
|
|
136
|
-
metadata?: Record<string, string | number | boolean>;
|
|
137
|
-
}
|
|
138
|
-
/**
|
|
139
|
-
* Type-safe plugin interface with specific type parameters
|
|
140
|
-
*
|
|
141
|
-
* @template TOptions - Plugin options type that extends IPluginOptions
|
|
142
|
-
* @template TStats - Plugin statistics type (defaults to IPluginStats for type safety)
|
|
143
|
-
*/
|
|
144
|
-
export interface IPluginContract<TOptions extends IPluginOptions = IPluginOptions, TStats = IPluginStats> {
|
|
145
|
-
name: string;
|
|
146
|
-
version: string;
|
|
147
|
-
enabled: boolean;
|
|
148
|
-
category: PluginCategory;
|
|
149
|
-
priority: number;
|
|
150
|
-
initialize(options?: TOptions): Promise<void>;
|
|
151
|
-
cleanup?(): Promise<void>;
|
|
152
|
-
getData?(): IPluginData;
|
|
153
|
-
getStats?(): TStats;
|
|
154
|
-
subscribeToModuleEvents?(eventEmitter: IEventEmitterPlugin): Promise<void>;
|
|
155
|
-
unsubscribeFromModuleEvents?(eventEmitter: IEventEmitterPlugin): Promise<void>;
|
|
156
|
-
onModuleEvent?(eventName: TEventName, eventData: IEventEmitterEventData): Promise<void> | void;
|
|
157
|
-
}
|
|
158
|
-
/**
|
|
159
|
-
* Plugin statistics base interface with common metrics
|
|
160
|
-
*/
|
|
161
|
-
export interface IPluginStats {
|
|
162
|
-
enabled: boolean;
|
|
163
|
-
calls: number;
|
|
164
|
-
errors: number;
|
|
165
|
-
lastActivity?: Date;
|
|
166
|
-
moduleEventsReceived?: number;
|
|
167
|
-
[key: string]: string | number | boolean | Date | string[] | number[] | boolean[] | Record<string, string | number | boolean | Date> | undefined;
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* Plugin interface extending IPluginContract
|
|
171
|
-
*/
|
|
172
|
-
export interface IPlugin extends IPluginContract<IPluginConfig, IPluginStats> {
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* Plugin lifecycle hooks
|
|
176
|
-
*/
|
|
177
|
-
export interface IPluginHooks {
|
|
178
|
-
/**
|
|
179
|
-
* Called before agent run
|
|
180
|
-
*/
|
|
181
|
-
beforeRun?(input: string, options?: IRunOptions): Promise<void> | void;
|
|
182
|
-
/**
|
|
183
|
-
* Called after agent run
|
|
184
|
-
*/
|
|
185
|
-
afterRun?(input: string, response: string, options?: IRunOptions): Promise<void> | void;
|
|
186
|
-
/**
|
|
187
|
-
* Called before execution with context
|
|
188
|
-
*/
|
|
189
|
-
beforeExecution?(context: IPluginExecutionContext): Promise<void> | void;
|
|
190
|
-
/**
|
|
191
|
-
* Called after execution with context and result
|
|
192
|
-
*/
|
|
193
|
-
afterExecution?(context: IPluginExecutionContext, result: IPluginExecutionResult): Promise<void> | void;
|
|
194
|
-
/**
|
|
195
|
-
* Called before conversation with context
|
|
196
|
-
*/
|
|
197
|
-
beforeConversation?(context: IPluginExecutionContext): Promise<void> | void;
|
|
198
|
-
/**
|
|
199
|
-
* Called after conversation with context and result
|
|
200
|
-
*/
|
|
201
|
-
afterConversation?(context: IPluginExecutionContext, result: IPluginExecutionResult): Promise<void> | void;
|
|
202
|
-
/**
|
|
203
|
-
* Called before tool execution
|
|
204
|
-
*/
|
|
205
|
-
beforeToolCall?(toolName: string, parameters: TToolParameters): Promise<void> | void;
|
|
206
|
-
/**
|
|
207
|
-
* Called before tool execution with context
|
|
208
|
-
*/
|
|
209
|
-
beforeToolExecution?(context: IPluginExecutionContext, toolData: IToolExecutionContext): Promise<void> | void;
|
|
210
|
-
/**
|
|
211
|
-
* Called after tool execution
|
|
212
|
-
*/
|
|
213
|
-
afterToolCall?(toolName: string, parameters: TToolParameters, result: IToolExecutionResult): Promise<void> | void;
|
|
214
|
-
/**
|
|
215
|
-
* Called after tool execution with context
|
|
216
|
-
*/
|
|
217
|
-
afterToolExecution?(context: IPluginExecutionContext, toolResults: IPluginExecutionResult): Promise<void> | void;
|
|
218
|
-
/**
|
|
219
|
-
* Called before AI provider call
|
|
220
|
-
*/
|
|
221
|
-
beforeProviderCall?(messages: TUniversalMessage[]): Promise<void> | void;
|
|
222
|
-
/**
|
|
223
|
-
* Called after AI provider call
|
|
224
|
-
*/
|
|
225
|
-
afterProviderCall?(messages: TUniversalMessage[], response: TUniversalMessage): Promise<void> | void;
|
|
226
|
-
/**
|
|
227
|
-
* Called on streaming chunk
|
|
228
|
-
*/
|
|
229
|
-
onStreamingChunk?(chunk: TUniversalMessage): Promise<void> | void;
|
|
230
|
-
/**
|
|
231
|
-
* Called on error
|
|
232
|
-
*/
|
|
233
|
-
onError?(error: Error, context?: IPluginErrorContext): Promise<void> | void;
|
|
234
|
-
/**
|
|
235
|
-
* Called on message added to history
|
|
236
|
-
*/
|
|
237
|
-
onMessageAdded?(message: TUniversalMessage): Promise<void> | void;
|
|
238
|
-
/**
|
|
239
|
-
* Called when module events are received
|
|
240
|
-
*/
|
|
241
|
-
onModuleEvent?(eventName: TEventName, eventData: IEventEmitterEventData): Promise<void> | void;
|
|
242
|
-
}
|
|
243
|
-
/**
|
|
244
|
-
* Abstract class for all plugins with type parameter support
|
|
245
|
-
* Provides plugin lifecycle management and common functionality
|
|
246
|
-
*
|
|
247
|
-
* Enhanced with:
|
|
248
|
-
* - Plugin classification system (categories and priorities)
|
|
249
|
-
* - EventEmitter integration for module event subscription
|
|
250
|
-
* - Improved statistics tracking
|
|
251
|
-
* - Better error handling and recovery
|
|
252
|
-
*
|
|
17
|
+
* Abstract class for all plugins with type parameter support.
|
|
18
|
+
* Provides plugin lifecycle management and common functionality.
|
|
253
19
|
* @template TOptions - Plugin options type that extends IPluginOptions
|
|
254
|
-
* @template TStats - Plugin statistics type
|
|
20
|
+
* @template TStats - Plugin statistics type
|
|
255
21
|
*/
|
|
256
22
|
export declare abstract class AbstractPlugin<TOptions extends IPluginOptions = IPluginOptions, TStats extends IPluginStats = IPluginStats> implements IPluginContract<TOptions, TStats>, IPluginHooks {
|
|
257
|
-
/** Plugin name */
|
|
258
23
|
abstract readonly name: string;
|
|
259
|
-
/** Plugin version */
|
|
260
24
|
abstract readonly version: string;
|
|
261
|
-
/** Plugin enabled state */
|
|
262
25
|
enabled: boolean;
|
|
263
|
-
/** Plugin category for classification */
|
|
264
26
|
category: PluginCategory;
|
|
265
|
-
/** Plugin priority for execution order */
|
|
266
27
|
priority: number;
|
|
267
|
-
/** Plugin options */
|
|
268
28
|
protected options: TOptions | undefined;
|
|
269
|
-
/** EventEmitter for module event subscription */
|
|
270
29
|
protected eventEmitter: IEventEmitterPlugin | undefined;
|
|
271
|
-
/** Subscribed event types */
|
|
272
30
|
protected subscribedEvents: TEventName[];
|
|
273
|
-
/** Event subscription handlers */
|
|
274
31
|
protected eventHandlers: Map<TEventName, string[]>;
|
|
275
|
-
|
|
32
|
+
protected readonly pluginLogger: ILogger;
|
|
276
33
|
protected stats: {
|
|
277
34
|
calls: number;
|
|
278
35
|
errors: number;
|
|
279
36
|
moduleEventsReceived: number;
|
|
280
37
|
lastActivity: Date | undefined;
|
|
281
38
|
};
|
|
282
|
-
/**
|
|
283
|
-
* Initialize the plugin with type-safe options
|
|
284
|
-
*/
|
|
285
39
|
initialize(options?: TOptions): Promise<void>;
|
|
286
|
-
/**
|
|
287
|
-
* Subscribe to module events through EventEmitter
|
|
288
|
-
*/
|
|
289
40
|
subscribeToModuleEvents(eventEmitter: IEventEmitterPlugin): Promise<void>;
|
|
290
|
-
/**
|
|
291
|
-
* Unsubscribe from module events
|
|
292
|
-
*/
|
|
293
41
|
unsubscribeFromModuleEvents(eventEmitter: IEventEmitterPlugin): Promise<void>;
|
|
294
|
-
/**
|
|
295
|
-
* Cleanup plugin resources
|
|
296
|
-
*/
|
|
297
42
|
dispose(): Promise<void>;
|
|
298
|
-
/**
|
|
299
|
-
* Enable the plugin
|
|
300
|
-
*/
|
|
301
43
|
enable(): void;
|
|
302
|
-
/**
|
|
303
|
-
* Disable the plugin
|
|
304
|
-
*/
|
|
305
44
|
disable(): void;
|
|
306
|
-
/**
|
|
307
|
-
* Check if plugin is enabled
|
|
308
|
-
*/
|
|
309
45
|
isEnabled(): boolean;
|
|
310
|
-
/**
|
|
311
|
-
* Get plugin configuration
|
|
312
|
-
*/
|
|
313
46
|
getConfig(): IPluginConfig;
|
|
314
|
-
/**
|
|
315
|
-
* Update plugin configuration
|
|
316
|
-
*/
|
|
317
47
|
updateConfig(_config: IPluginConfig): void;
|
|
318
|
-
/**
|
|
319
|
-
* Get plugin data - enhanced with classification information
|
|
320
|
-
*/
|
|
321
48
|
getData(): IPluginData;
|
|
322
|
-
/**
|
|
323
|
-
* Clear plugin data - common interface for all plugins
|
|
324
|
-
* This method should be implemented by plugins that store data
|
|
325
|
-
*/
|
|
326
49
|
clearData?(): void;
|
|
327
|
-
/**
|
|
328
|
-
* Get plugin status - enhanced with classification information
|
|
329
|
-
*/
|
|
330
50
|
getStatus(): {
|
|
331
51
|
name: string;
|
|
332
52
|
version: string;
|
|
@@ -337,17 +57,8 @@ export declare abstract class AbstractPlugin<TOptions extends IPluginOptions = I
|
|
|
337
57
|
subscribedEventsCount: number;
|
|
338
58
|
hasEventEmitter: boolean;
|
|
339
59
|
};
|
|
340
|
-
/**
|
|
341
|
-
* Get plugin statistics - enhanced with module event tracking
|
|
342
|
-
*/
|
|
343
60
|
getStats(): TStats;
|
|
344
|
-
/**
|
|
345
|
-
* Update plugin call statistics
|
|
346
|
-
*/
|
|
347
61
|
protected updateCallStats(): void;
|
|
348
|
-
/**
|
|
349
|
-
* Update plugin error statistics
|
|
350
|
-
*/
|
|
351
62
|
protected updateErrorStats(): void;
|
|
352
63
|
beforeRun?(input: string, options?: IRunOptions): Promise<void>;
|
|
353
64
|
afterRun?(input: string, response: string, options?: IRunOptions): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abstract-plugin.d.ts","sourceRoot":"","sources":["../../src/abstracts/abstract-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"abstract-plugin.d.ts","sourceRoot":"","sources":["../../src/abstracts/abstract-plugin.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,123 +1,49 @@
|
|
|
1
1
|
import { EVENT_EMITTER_EVENTS } from '../plugins/event-emitter/types';
|
|
2
|
+
import { createLogger } from '../utils/logger';
|
|
3
|
+
import { PluginCategory, PluginPriority } from './abstract-plugin-types';
|
|
4
|
+
export { PluginCategory, PluginPriority };
|
|
2
5
|
/**
|
|
3
|
-
*
|
|
4
|
-
|
|
5
|
-
export var PluginCategory;
|
|
6
|
-
(function (PluginCategory) {
|
|
7
|
-
/** Monitoring and observability */
|
|
8
|
-
PluginCategory["MONITORING"] = "monitoring";
|
|
9
|
-
/** Logging and debugging */
|
|
10
|
-
PluginCategory["LOGGING"] = "logging";
|
|
11
|
-
/** Data storage and persistence */
|
|
12
|
-
PluginCategory["STORAGE"] = "storage";
|
|
13
|
-
/** External notifications and alerts */
|
|
14
|
-
PluginCategory["NOTIFICATION"] = "notification";
|
|
15
|
-
/** Security and access control */
|
|
16
|
-
PluginCategory["SECURITY"] = "security";
|
|
17
|
-
/** Performance optimization */
|
|
18
|
-
PluginCategory["PERFORMANCE"] = "performance";
|
|
19
|
-
/** Error handling and recovery */
|
|
20
|
-
PluginCategory["ERROR_HANDLING"] = "error_handling";
|
|
21
|
-
/** Rate limiting and throttling */
|
|
22
|
-
PluginCategory["LIMITS"] = "limits";
|
|
23
|
-
/** Event processing and coordination */
|
|
24
|
-
PluginCategory["EVENT_PROCESSING"] = "event_processing";
|
|
25
|
-
/** Custom or specialized functionality */
|
|
26
|
-
PluginCategory["CUSTOM"] = "custom";
|
|
27
|
-
})(PluginCategory || (PluginCategory = {}));
|
|
28
|
-
/**
|
|
29
|
-
* Plugin priority levels
|
|
30
|
-
*/
|
|
31
|
-
export var PluginPriority;
|
|
32
|
-
(function (PluginPriority) {
|
|
33
|
-
/** Highest priority - executed first */
|
|
34
|
-
PluginPriority[PluginPriority["CRITICAL"] = 1000] = "CRITICAL";
|
|
35
|
-
/** High priority */
|
|
36
|
-
PluginPriority[PluginPriority["HIGH"] = 800] = "HIGH";
|
|
37
|
-
/** Normal priority (default) */
|
|
38
|
-
PluginPriority[PluginPriority["NORMAL"] = 500] = "NORMAL";
|
|
39
|
-
/** Low priority */
|
|
40
|
-
PluginPriority[PluginPriority["LOW"] = 200] = "LOW";
|
|
41
|
-
/** Lowest priority - executed last */
|
|
42
|
-
PluginPriority[PluginPriority["MINIMAL"] = 100] = "MINIMAL";
|
|
43
|
-
})(PluginPriority || (PluginPriority = {}));
|
|
44
|
-
/**
|
|
45
|
-
* Abstract class for all plugins with type parameter support
|
|
46
|
-
* Provides plugin lifecycle management and common functionality
|
|
47
|
-
*
|
|
48
|
-
* Enhanced with:
|
|
49
|
-
* - Plugin classification system (categories and priorities)
|
|
50
|
-
* - EventEmitter integration for module event subscription
|
|
51
|
-
* - Improved statistics tracking
|
|
52
|
-
* - Better error handling and recovery
|
|
53
|
-
*
|
|
6
|
+
* Abstract class for all plugins with type parameter support.
|
|
7
|
+
* Provides plugin lifecycle management and common functionality.
|
|
54
8
|
* @template TOptions - Plugin options type that extends IPluginOptions
|
|
55
|
-
* @template TStats - Plugin statistics type
|
|
9
|
+
* @template TStats - Plugin statistics type
|
|
56
10
|
*/
|
|
57
11
|
export class AbstractPlugin {
|
|
58
|
-
/** Plugin enabled state */
|
|
59
12
|
enabled = true;
|
|
60
|
-
/** Plugin category for classification */
|
|
61
13
|
category = PluginCategory.CUSTOM;
|
|
62
|
-
/** Plugin priority for execution order */
|
|
63
14
|
priority = PluginPriority.NORMAL;
|
|
64
|
-
/** Plugin options */
|
|
65
15
|
options;
|
|
66
|
-
/** EventEmitter for module event subscription */
|
|
67
16
|
eventEmitter;
|
|
68
|
-
/** Subscribed event types */
|
|
69
17
|
subscribedEvents = [];
|
|
70
|
-
/** Event subscription handlers */
|
|
71
18
|
eventHandlers = new Map();
|
|
72
|
-
|
|
19
|
+
pluginLogger = createLogger('AbstractPlugin');
|
|
73
20
|
stats = {
|
|
74
21
|
calls: 0,
|
|
75
22
|
errors: 0,
|
|
76
23
|
moduleEventsReceived: 0,
|
|
77
|
-
lastActivity: undefined
|
|
24
|
+
lastActivity: undefined,
|
|
78
25
|
};
|
|
79
|
-
/**
|
|
80
|
-
* Initialize the plugin with type-safe options
|
|
81
|
-
*/
|
|
82
26
|
async initialize(options) {
|
|
83
27
|
this.options = options;
|
|
84
|
-
|
|
85
|
-
if (options && 'enabled' in options && typeof options.enabled === 'boolean') {
|
|
28
|
+
if (options && 'enabled' in options && typeof options.enabled === 'boolean')
|
|
86
29
|
this.enabled = options.enabled;
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
// Set category from options
|
|
92
|
-
if (options?.category) {
|
|
30
|
+
else
|
|
31
|
+
this.enabled = true;
|
|
32
|
+
if (options?.category)
|
|
93
33
|
this.category = options.category;
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
if (options?.priority !== undefined) {
|
|
97
|
-
this.priority = typeof options.priority === 'number'
|
|
98
|
-
? options.priority
|
|
99
|
-
: options.priority;
|
|
100
|
-
}
|
|
101
|
-
// Default implementation - can be overridden
|
|
34
|
+
if (options?.priority !== undefined)
|
|
35
|
+
this.priority = typeof options.priority === 'number' ? options.priority : options.priority;
|
|
102
36
|
}
|
|
103
|
-
/**
|
|
104
|
-
* Subscribe to module events through EventEmitter
|
|
105
|
-
*/
|
|
106
37
|
async subscribeToModuleEvents(eventEmitter) {
|
|
107
38
|
this.eventEmitter = eventEmitter;
|
|
108
|
-
if (!this.options)
|
|
39
|
+
if (!this.options)
|
|
109
40
|
return;
|
|
110
|
-
}
|
|
111
41
|
const eventsToSubscribe = [];
|
|
112
|
-
// Subscribe to all module events if requested
|
|
113
42
|
if (this.options.subscribeToAllModuleEvents) {
|
|
114
43
|
eventsToSubscribe.push(EVENT_EMITTER_EVENTS.MODULE_INITIALIZE_START, EVENT_EMITTER_EVENTS.MODULE_INITIALIZE_COMPLETE, EVENT_EMITTER_EVENTS.MODULE_INITIALIZE_ERROR, EVENT_EMITTER_EVENTS.MODULE_EXECUTION_START, EVENT_EMITTER_EVENTS.MODULE_EXECUTION_COMPLETE, EVENT_EMITTER_EVENTS.MODULE_EXECUTION_ERROR, EVENT_EMITTER_EVENTS.MODULE_DISPOSE_START, EVENT_EMITTER_EVENTS.MODULE_DISPOSE_COMPLETE, EVENT_EMITTER_EVENTS.MODULE_DISPOSE_ERROR);
|
|
115
44
|
}
|
|
116
|
-
|
|
117
|
-
if (this.options.moduleEvents) {
|
|
45
|
+
if (this.options.moduleEvents)
|
|
118
46
|
eventsToSubscribe.push(...this.options.moduleEvents);
|
|
119
|
-
}
|
|
120
|
-
// Subscribe to events (no deduplication; duplicates must surface for debugging)
|
|
121
47
|
for (const eventType of eventsToSubscribe) {
|
|
122
48
|
const handlerId = this.eventEmitter.on(eventType, async (eventData) => {
|
|
123
49
|
try {
|
|
@@ -127,76 +53,46 @@ export class AbstractPlugin {
|
|
|
127
53
|
}
|
|
128
54
|
catch (error) {
|
|
129
55
|
this.stats.errors++;
|
|
130
|
-
|
|
131
|
-
|
|
56
|
+
const safeError = error instanceof Error ? error : new Error(String(error));
|
|
57
|
+
this.pluginLogger.error(`Plugin "${this.name}" failed to handle module event "${String(eventType)}"`, { plugin: this.name, eventType: String(eventType), error: safeError.message });
|
|
132
58
|
}
|
|
133
59
|
});
|
|
134
60
|
const existing = this.eventHandlers.get(eventType);
|
|
135
|
-
if (existing)
|
|
61
|
+
if (existing)
|
|
136
62
|
existing.push(handlerId);
|
|
137
|
-
|
|
138
|
-
else {
|
|
63
|
+
else
|
|
139
64
|
this.eventHandlers.set(eventType, [handlerId]);
|
|
140
|
-
}
|
|
141
65
|
this.subscribedEvents.push(eventType);
|
|
142
66
|
}
|
|
143
67
|
}
|
|
144
|
-
/**
|
|
145
|
-
* Unsubscribe from module events
|
|
146
|
-
*/
|
|
147
68
|
async unsubscribeFromModuleEvents(eventEmitter) {
|
|
148
69
|
for (const [eventType, handlerIds] of this.eventHandlers.entries()) {
|
|
149
|
-
for (const handlerId of handlerIds)
|
|
70
|
+
for (const handlerId of handlerIds)
|
|
150
71
|
eventEmitter.off(eventType, handlerId);
|
|
151
|
-
}
|
|
152
72
|
}
|
|
153
73
|
this.eventHandlers.clear();
|
|
154
74
|
this.subscribedEvents = [];
|
|
155
75
|
this.eventEmitter = undefined;
|
|
156
76
|
}
|
|
157
|
-
/**
|
|
158
|
-
* Cleanup plugin resources
|
|
159
|
-
*/
|
|
160
77
|
async dispose() {
|
|
161
|
-
|
|
162
|
-
if (this.eventEmitter) {
|
|
78
|
+
if (this.eventEmitter)
|
|
163
79
|
await this.unsubscribeFromModuleEvents(this.eventEmitter);
|
|
164
|
-
}
|
|
165
|
-
// Default implementation - can be overridden
|
|
166
80
|
}
|
|
167
|
-
/**
|
|
168
|
-
* Enable the plugin
|
|
169
|
-
*/
|
|
170
81
|
enable() {
|
|
171
82
|
this.enabled = true;
|
|
172
83
|
}
|
|
173
|
-
/**
|
|
174
|
-
* Disable the plugin
|
|
175
|
-
*/
|
|
176
84
|
disable() {
|
|
177
85
|
this.enabled = false;
|
|
178
86
|
}
|
|
179
|
-
/**
|
|
180
|
-
* Check if plugin is enabled
|
|
181
|
-
*/
|
|
182
87
|
isEnabled() {
|
|
183
88
|
return this.enabled;
|
|
184
89
|
}
|
|
185
|
-
/**
|
|
186
|
-
* Get plugin configuration
|
|
187
|
-
*/
|
|
188
90
|
getConfig() {
|
|
189
91
|
return {};
|
|
190
92
|
}
|
|
191
|
-
/**
|
|
192
|
-
* Update plugin configuration
|
|
193
|
-
*/
|
|
194
93
|
updateConfig(_config) {
|
|
195
|
-
|
|
94
|
+
/* override in subclass */
|
|
196
95
|
}
|
|
197
|
-
/**
|
|
198
|
-
* Get plugin data - enhanced with classification information
|
|
199
|
-
*/
|
|
200
96
|
getData() {
|
|
201
97
|
return {
|
|
202
98
|
name: this.name,
|
|
@@ -208,48 +104,36 @@ export class AbstractPlugin {
|
|
|
208
104
|
metadata: {
|
|
209
105
|
moduleEventsReceived: this.stats.moduleEventsReceived,
|
|
210
106
|
totalCalls: this.stats.calls,
|
|
211
|
-
totalErrors: this.stats.errors
|
|
212
|
-
}
|
|
107
|
+
totalErrors: this.stats.errors,
|
|
108
|
+
},
|
|
213
109
|
};
|
|
214
110
|
}
|
|
215
|
-
/**
|
|
216
|
-
* Get plugin status - enhanced with classification information
|
|
217
|
-
*/
|
|
218
111
|
getStatus() {
|
|
219
112
|
return {
|
|
220
113
|
name: this.name,
|
|
221
114
|
version: this.version,
|
|
222
115
|
enabled: this.enabled,
|
|
223
|
-
initialized: true,
|
|
116
|
+
initialized: true,
|
|
224
117
|
category: this.category,
|
|
225
118
|
priority: this.priority,
|
|
226
119
|
subscribedEventsCount: this.subscribedEvents.length,
|
|
227
|
-
hasEventEmitter: !!this.eventEmitter
|
|
120
|
+
hasEventEmitter: !!this.eventEmitter,
|
|
228
121
|
};
|
|
229
122
|
}
|
|
230
|
-
/**
|
|
231
|
-
* Get plugin statistics - enhanced with module event tracking
|
|
232
|
-
*/
|
|
233
123
|
getStats() {
|
|
234
124
|
const baseStats = {
|
|
235
125
|
enabled: this.enabled,
|
|
236
126
|
calls: this.stats.calls,
|
|
237
127
|
errors: this.stats.errors,
|
|
238
128
|
moduleEventsReceived: this.stats.moduleEventsReceived,
|
|
239
|
-
...(this.stats.lastActivity && { lastActivity: this.stats.lastActivity })
|
|
129
|
+
...(this.stats.lastActivity && { lastActivity: this.stats.lastActivity }),
|
|
240
130
|
};
|
|
241
131
|
return baseStats;
|
|
242
132
|
}
|
|
243
|
-
/**
|
|
244
|
-
* Update plugin call statistics
|
|
245
|
-
*/
|
|
246
133
|
updateCallStats() {
|
|
247
134
|
this.stats.calls++;
|
|
248
135
|
this.stats.lastActivity = new Date();
|
|
249
136
|
}
|
|
250
|
-
/**
|
|
251
|
-
* Update plugin error statistics
|
|
252
|
-
*/
|
|
253
137
|
updateErrorStats() {
|
|
254
138
|
this.stats.errors++;
|
|
255
139
|
this.stats.lastActivity = new Date();
|