@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
package/dist/node/index.d.cts
CHANGED
|
@@ -44,12 +44,18 @@ interface IToolCall {
|
|
|
44
44
|
arguments: string;
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
|
+
/** State of a message in conversation history */
|
|
48
|
+
type TMessageState = 'complete' | 'interrupted';
|
|
47
49
|
/**
|
|
48
50
|
* Base message contract shared by all message variants.
|
|
49
51
|
*/
|
|
50
52
|
interface IBaseMessage {
|
|
53
|
+
/** Unique message identifier */
|
|
54
|
+
id: string;
|
|
51
55
|
/** Message creation timestamp */
|
|
52
56
|
timestamp: Date;
|
|
57
|
+
/** Whether this message is complete or was interrupted */
|
|
58
|
+
state: TMessageState;
|
|
53
59
|
/** Additional metadata */
|
|
54
60
|
metadata?: TUniversalMessageMetadata;
|
|
55
61
|
}
|
|
@@ -81,8 +87,49 @@ interface IToolMessage extends IBaseMessage {
|
|
|
81
87
|
}
|
|
82
88
|
/**
|
|
83
89
|
* Universal message union used across the SDK as the canonical contract.
|
|
90
|
+
* Used for AI provider communication. Extracted from IHistoryEntry[] via filtering.
|
|
84
91
|
*/
|
|
85
92
|
type TUniversalMessage = IUserMessage | IAssistantMessage | ISystemMessage | IToolMessage;
|
|
93
|
+
/**
|
|
94
|
+
* Universal history entry — the base type for all records in conversation history.
|
|
95
|
+
*
|
|
96
|
+
* History is a universal timeline that records everything: AI chat messages,
|
|
97
|
+
* system events, skill invocations, permission decisions, etc.
|
|
98
|
+
* AI provider receives only chat entries (filtered and converted to TUniversalMessage).
|
|
99
|
+
* TUI can render any range of entries.
|
|
100
|
+
*
|
|
101
|
+
* - append-only, read-only
|
|
102
|
+
* - category + type for classification (free-form strings, no pre-defined enum)
|
|
103
|
+
* - data holds type-specific structured content
|
|
104
|
+
*/
|
|
105
|
+
interface IHistoryEntry<T = unknown> {
|
|
106
|
+
/** Unique entry identifier */
|
|
107
|
+
id: string;
|
|
108
|
+
/** Entry creation timestamp */
|
|
109
|
+
timestamp: Date;
|
|
110
|
+
/** Top-level classification: 'chat', 'event', etc. */
|
|
111
|
+
category: string;
|
|
112
|
+
/** Sub-classification within category. Free-form, not pre-defined. */
|
|
113
|
+
type: string;
|
|
114
|
+
/** Type-specific structured data */
|
|
115
|
+
data?: T;
|
|
116
|
+
}
|
|
117
|
+
/** Check if a history entry is a chat message (for AI provider filtering). */
|
|
118
|
+
declare function isChatEntry(entry: IHistoryEntry): boolean;
|
|
119
|
+
/**
|
|
120
|
+
* Convert a chat history entry to TUniversalMessage for AI provider consumption.
|
|
121
|
+
* Only call on entries where isChatEntry() returns true.
|
|
122
|
+
*/
|
|
123
|
+
declare function chatEntryToMessage(entry: IHistoryEntry): TUniversalMessage;
|
|
124
|
+
/**
|
|
125
|
+
* Convert a TUniversalMessage to an IHistoryEntry for storage.
|
|
126
|
+
*/
|
|
127
|
+
declare function messageToHistoryEntry(message: TUniversalMessage): IHistoryEntry;
|
|
128
|
+
/**
|
|
129
|
+
* Filter history entries and convert chat entries to TUniversalMessage[].
|
|
130
|
+
* Used when passing conversation to AI provider.
|
|
131
|
+
*/
|
|
132
|
+
declare function getMessagesForAPI(history: IHistoryEntry[]): TUniversalMessage[];
|
|
86
133
|
/**
|
|
87
134
|
* Type guards for the canonical TUniversalMessage union.
|
|
88
135
|
*
|
|
@@ -155,6 +202,42 @@ interface IPluginContext {
|
|
|
155
202
|
error?: Error;
|
|
156
203
|
executionContext?: TContextData;
|
|
157
204
|
}
|
|
205
|
+
/**
|
|
206
|
+
* Type utility functions for safe type checking and validation
|
|
207
|
+
* @internal
|
|
208
|
+
*/
|
|
209
|
+
declare const TypeUtils: {
|
|
210
|
+
isPrimitive: (value: TUniversalValue) => value is TPrimitiveValue;
|
|
211
|
+
isArray: (value: TUniversalValue) => value is TUniversalArrayValue;
|
|
212
|
+
isObject: (value: TUniversalValue) => value is IUniversalObjectValue;
|
|
213
|
+
isUniversalValue: (value: TUniversalValue) => value is TUniversalValue;
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
interface IProviderFunctionCallingCapability {
|
|
217
|
+
supported: boolean;
|
|
218
|
+
reason?: string;
|
|
219
|
+
}
|
|
220
|
+
interface IProviderNativeWebToolCapability {
|
|
221
|
+
supported: boolean;
|
|
222
|
+
enabled: boolean;
|
|
223
|
+
source?: string;
|
|
224
|
+
reason?: string;
|
|
225
|
+
}
|
|
226
|
+
interface IProviderNativeWebToolCapabilities {
|
|
227
|
+
webSearch: IProviderNativeWebToolCapability;
|
|
228
|
+
webFetch: IProviderNativeWebToolCapability;
|
|
229
|
+
}
|
|
230
|
+
interface IProviderCapabilities {
|
|
231
|
+
functionCalling: IProviderFunctionCallingCapability;
|
|
232
|
+
nativeWebTools: IProviderNativeWebToolCapabilities;
|
|
233
|
+
}
|
|
234
|
+
interface IProviderNativeWebToolRequest {
|
|
235
|
+
webSearch?: boolean;
|
|
236
|
+
webFetch?: boolean;
|
|
237
|
+
}
|
|
238
|
+
declare function createDefaultProviderCapabilities(functionCallingSupported: boolean): IProviderCapabilities;
|
|
239
|
+
declare function getProviderCapabilities(provider: IAIProvider): IProviderCapabilities;
|
|
240
|
+
declare function assertProviderNativeWebToolsAvailable(providerName: string, capabilities: IProviderCapabilities, request: IProviderNativeWebToolRequest | undefined): void;
|
|
158
241
|
|
|
159
242
|
/**
|
|
160
243
|
* Reusable type definitions for provider layer
|
|
@@ -187,6 +270,7 @@ interface IToolSchema {
|
|
|
187
270
|
type: 'object';
|
|
188
271
|
properties: Record<string, IParameterSchema>;
|
|
189
272
|
required?: string[];
|
|
273
|
+
additionalProperties?: boolean | IParameterSchema;
|
|
190
274
|
};
|
|
191
275
|
}
|
|
192
276
|
/**
|
|
@@ -299,6 +383,10 @@ interface IChatOptions extends IProviderSpecificOptions {
|
|
|
299
383
|
* should use streaming internally and call this for each text chunk,
|
|
300
384
|
* while still returning the complete assembled message. */
|
|
301
385
|
onTextDelta?: TTextDeltaCallback;
|
|
386
|
+
/** AbortSignal for cancelling the provider call */
|
|
387
|
+
signal?: AbortSignal;
|
|
388
|
+
/** Provider-native hosted web tools requested for this call */
|
|
389
|
+
nativeWebTools?: IProviderNativeWebToolRequest;
|
|
302
390
|
}
|
|
303
391
|
/**
|
|
304
392
|
* Provider-agnostic AI Provider interface
|
|
@@ -340,6 +428,15 @@ interface IAIProvider {
|
|
|
340
428
|
* @returns true if tool calling is supported
|
|
341
429
|
*/
|
|
342
430
|
supportsTools(): boolean;
|
|
431
|
+
/**
|
|
432
|
+
* Report provider-neutral capability state.
|
|
433
|
+
* Providers without native web support can omit this and use default capability helpers.
|
|
434
|
+
*/
|
|
435
|
+
getCapabilities?(): IProviderCapabilities;
|
|
436
|
+
/**
|
|
437
|
+
* Optional generic hook for enabling provider-native hosted web behavior.
|
|
438
|
+
*/
|
|
439
|
+
configureNativeWebTools?(request: IProviderNativeWebToolRequest): IProviderCapabilities;
|
|
343
440
|
/**
|
|
344
441
|
* Validate provider configuration
|
|
345
442
|
* @returns true if configuration is valid
|
|
@@ -481,6 +578,78 @@ interface IEventServiceOwnerBinding {
|
|
|
481
578
|
ownerPath: IOwnerPathSegment[];
|
|
482
579
|
}
|
|
483
580
|
|
|
581
|
+
/**
|
|
582
|
+
* Abstract base for event services.
|
|
583
|
+
* Concrete implementations decide how events are delivered.
|
|
584
|
+
*/
|
|
585
|
+
declare abstract class AbstractEventService implements IEventService {
|
|
586
|
+
private listeners;
|
|
587
|
+
abstract emit(eventType: string, data: IBaseEventData, context?: IEventContext): void;
|
|
588
|
+
subscribe(listener: TEventListener): void;
|
|
589
|
+
unsubscribe(listener: TEventListener): void;
|
|
590
|
+
protected notifyListeners(eventType: string, data: IBaseEventData, context?: IEventContext): void;
|
|
591
|
+
}
|
|
592
|
+
/**
|
|
593
|
+
* Default no-op event service (production-safe).
|
|
594
|
+
* When injected, emit() intentionally does nothing.
|
|
595
|
+
*/
|
|
596
|
+
declare class DefaultEventService extends AbstractEventService {
|
|
597
|
+
emit(_eventType: string, _data: IBaseEventData, _context?: IEventContext): void;
|
|
598
|
+
}
|
|
599
|
+
/**
|
|
600
|
+
* Singleton default event service instance.
|
|
601
|
+
*/
|
|
602
|
+
declare const DEFAULT_ABSTRACT_EVENT_SERVICE: IEventService;
|
|
603
|
+
/**
|
|
604
|
+
* Check if a given service is the default no-op implementation.
|
|
605
|
+
*/
|
|
606
|
+
declare function isDefaultEventService(service: IEventService): boolean;
|
|
607
|
+
/**
|
|
608
|
+
* Compose a full event name from owner prefix and local name.
|
|
609
|
+
* Local names must not contain dots.
|
|
610
|
+
*/
|
|
611
|
+
declare function composeEventName(ownerType: string, localName: string): string;
|
|
612
|
+
/**
|
|
613
|
+
* A scoped event service that always emits with an owner binding applied.
|
|
614
|
+
*/
|
|
615
|
+
declare class StructuredEventService extends AbstractEventService {
|
|
616
|
+
private readonly base;
|
|
617
|
+
private readonly binding;
|
|
618
|
+
constructor(base: IEventService, binding: IEventServiceOwnerBinding);
|
|
619
|
+
emit(eventType: string, data: IBaseEventData, context?: IEventContext): void;
|
|
620
|
+
subscribe(listener: TEventListener): void;
|
|
621
|
+
unsubscribe(listener: TEventListener): void;
|
|
622
|
+
}
|
|
623
|
+
/**
|
|
624
|
+
* Bind an EventService to an explicit owner path.
|
|
625
|
+
* This is the standard entry point for scoped emission (path-only architecture).
|
|
626
|
+
*/
|
|
627
|
+
declare function bindWithOwnerPath(base: IEventService, binding: IEventServiceOwnerBinding): IEventService;
|
|
628
|
+
/**
|
|
629
|
+
* Alias for bindWithOwnerPath for historical call sites.
|
|
630
|
+
* Intentionally forwards to the single authoritative implementation.
|
|
631
|
+
*/
|
|
632
|
+
declare function bindEventServiceOwner(base: IEventService, binding: IEventServiceOwnerBinding): IEventService;
|
|
633
|
+
/**
|
|
634
|
+
* Observable EventService that notifies subscribed listeners.
|
|
635
|
+
*/
|
|
636
|
+
declare class ObservableEventService extends AbstractEventService {
|
|
637
|
+
emit(eventType: string, data: IBaseEventData, context?: IEventContext): void;
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
declare const TASK_EVENTS: {
|
|
641
|
+
readonly ASSIGNED: "assigned";
|
|
642
|
+
readonly COMPLETED: "completed";
|
|
643
|
+
};
|
|
644
|
+
declare const TASK_EVENT_PREFIX: "task";
|
|
645
|
+
|
|
646
|
+
declare const USER_EVENTS: {
|
|
647
|
+
readonly MESSAGE: "message";
|
|
648
|
+
readonly INPUT: "input";
|
|
649
|
+
};
|
|
650
|
+
declare const USER_EVENT_PREFIX: "user";
|
|
651
|
+
type TUserEvent = (typeof USER_EVENTS)[keyof typeof USER_EVENTS];
|
|
652
|
+
|
|
484
653
|
type TToolContextExtensionValue = TUniversalValue | Date | Error | TLoggerData | TContextData | TToolParameters | TToolMetadata;
|
|
485
654
|
/**
|
|
486
655
|
* Tool metadata structure - specific type definition
|
|
@@ -593,57 +762,6 @@ interface IParameterValidationResult {
|
|
|
593
762
|
* Generic tool executor function
|
|
594
763
|
*/
|
|
595
764
|
type TToolExecutor<TParams = TToolParameters, TResult = TUniversalValue> = (parameters: TParams, context?: IToolExecutionContext) => Promise<TResult>;
|
|
596
|
-
/**
|
|
597
|
-
* OpenAPI specification configuration
|
|
598
|
-
*/
|
|
599
|
-
interface IOpenAPIToolConfig {
|
|
600
|
-
/** OpenAPI 3.0 specification */
|
|
601
|
-
spec: {
|
|
602
|
-
openapi: string;
|
|
603
|
-
info: {
|
|
604
|
-
title: string;
|
|
605
|
-
version: string;
|
|
606
|
-
description?: string;
|
|
607
|
-
};
|
|
608
|
-
servers?: Array<{
|
|
609
|
-
url: string;
|
|
610
|
-
description?: string;
|
|
611
|
-
}>;
|
|
612
|
-
paths: Record<string, Record<string, string | number | boolean | Record<string, string | number | boolean>>>;
|
|
613
|
-
components?: Record<string, Record<string, string | number | boolean>>;
|
|
614
|
-
};
|
|
615
|
-
/** Operation ID from the OpenAPI spec */
|
|
616
|
-
operationId: string;
|
|
617
|
-
/** Base URL for API calls */
|
|
618
|
-
baseURL: string;
|
|
619
|
-
/** Authentication configuration */
|
|
620
|
-
auth?: {
|
|
621
|
-
type: 'bearer' | 'apiKey' | 'basic';
|
|
622
|
-
token?: string;
|
|
623
|
-
apiKey?: string;
|
|
624
|
-
header?: string;
|
|
625
|
-
username?: string;
|
|
626
|
-
password?: string;
|
|
627
|
-
};
|
|
628
|
-
}
|
|
629
|
-
/**
|
|
630
|
-
* MCP (Model Context Protocol) configuration
|
|
631
|
-
*/
|
|
632
|
-
interface IMCPToolConfig {
|
|
633
|
-
/** MCP server endpoint */
|
|
634
|
-
endpoint: string;
|
|
635
|
-
/** Protocol version */
|
|
636
|
-
version?: string;
|
|
637
|
-
/** Authentication configuration */
|
|
638
|
-
auth?: {
|
|
639
|
-
type: 'bearer' | 'apiKey';
|
|
640
|
-
token: string;
|
|
641
|
-
};
|
|
642
|
-
/** Tool-specific configuration */
|
|
643
|
-
toolConfig?: Record<string, string | number | boolean>;
|
|
644
|
-
/** Timeout in milliseconds */
|
|
645
|
-
timeout?: number;
|
|
646
|
-
}
|
|
647
765
|
/**
|
|
648
766
|
* Base tool interface
|
|
649
767
|
*/
|
|
@@ -707,23 +825,6 @@ interface IToolRegistry {
|
|
|
707
825
|
*/
|
|
708
826
|
clear(): void;
|
|
709
827
|
}
|
|
710
|
-
/**
|
|
711
|
-
* Tool factory interface
|
|
712
|
-
*/
|
|
713
|
-
interface IToolFactory {
|
|
714
|
-
/**
|
|
715
|
-
* Create function tool from schema and function
|
|
716
|
-
*/
|
|
717
|
-
createFunctionTool(schema: IToolSchema, fn: TToolExecutor): IFunctionTool;
|
|
718
|
-
/**
|
|
719
|
-
* Create tool from OpenAPI specification
|
|
720
|
-
*/
|
|
721
|
-
createOpenAPITool(config: IOpenAPIToolConfig): ITool;
|
|
722
|
-
/**
|
|
723
|
-
* Create MCP tool
|
|
724
|
-
*/
|
|
725
|
-
createMCPTool(config: IMCPToolConfig): ITool;
|
|
726
|
-
}
|
|
727
828
|
|
|
728
829
|
declare const EXECUTION_EVENT_NAMES: {
|
|
729
830
|
readonly START: "execution.start";
|
|
@@ -864,6 +965,24 @@ interface ILogger {
|
|
|
864
965
|
* - Inject a real logger explicitly if you want output.
|
|
865
966
|
*/
|
|
866
967
|
declare const SilentLogger: ILogger;
|
|
968
|
+
/**
|
|
969
|
+
* Console logger implementation
|
|
970
|
+
* @internal
|
|
971
|
+
*/
|
|
972
|
+
declare class ConsoleLogger implements ILogger {
|
|
973
|
+
private level?;
|
|
974
|
+
private packageName;
|
|
975
|
+
private sinkLogger;
|
|
976
|
+
constructor(packageName: string, logger?: ILogger);
|
|
977
|
+
debug(...args: Array<TUniversalValue | TLoggerData | Error>): void;
|
|
978
|
+
info(...args: Array<TUniversalValue | TLoggerData | Error>): void;
|
|
979
|
+
warn(...args: Array<TUniversalValue | TLoggerData | Error>): void;
|
|
980
|
+
error(...args: Array<TUniversalValue | TLoggerData | Error>): void;
|
|
981
|
+
log(...args: Array<TUniversalValue | TLoggerData | Error>): void;
|
|
982
|
+
private getLevel;
|
|
983
|
+
private shouldLog;
|
|
984
|
+
private forward;
|
|
985
|
+
}
|
|
867
986
|
/**
|
|
868
987
|
* Create a named logger instance for a package or module.
|
|
869
988
|
* Use this to create loggers with a specific name prefix for easy log filtering.
|
|
@@ -1513,6 +1632,7 @@ interface IAgentConfig {
|
|
|
1513
1632
|
responseFormat?: IResponseFormatConfig;
|
|
1514
1633
|
safetySettings?: ISafetySetting[];
|
|
1515
1634
|
timeout?: number;
|
|
1635
|
+
maxExecutionRounds?: number;
|
|
1516
1636
|
retryAttempts?: number;
|
|
1517
1637
|
rateLimiting?: {
|
|
1518
1638
|
enabled?: boolean;
|
|
@@ -1549,7 +1669,20 @@ interface IRunOptions {
|
|
|
1549
1669
|
sessionId?: string;
|
|
1550
1670
|
userId?: string;
|
|
1551
1671
|
metadata?: TMetadata;
|
|
1672
|
+
/** AbortSignal for cancelling execution */
|
|
1673
|
+
signal?: AbortSignal;
|
|
1674
|
+
/** Per-run streaming text callback. Prefer this over mutating provider callback state. */
|
|
1675
|
+
onTextDelta?: TTextDeltaCallback;
|
|
1676
|
+
/** Per-run replay event callback for provider/tool execution boundaries. */
|
|
1677
|
+
onExecutionEvent?: TExecutionEventCallback;
|
|
1678
|
+
/**
|
|
1679
|
+
* Maximum model/tool rounds for this run.
|
|
1680
|
+
* Use 0 for no core round cap.
|
|
1681
|
+
*/
|
|
1682
|
+
maxExecutionRounds?: number;
|
|
1552
1683
|
}
|
|
1684
|
+
type TExecutionEventData = Record<string, unknown>;
|
|
1685
|
+
type TExecutionEventCallback = (event: string, data: TExecutionEventData) => void;
|
|
1553
1686
|
/**
|
|
1554
1687
|
* Generic agent interface with type parameters for enhanced type safety
|
|
1555
1688
|
*
|
|
@@ -1595,6 +1728,56 @@ interface ISafetySetting {
|
|
|
1595
1728
|
[key: string]: TConfigValue;
|
|
1596
1729
|
}
|
|
1597
1730
|
|
|
1731
|
+
interface IProviderConfig$1 {
|
|
1732
|
+
name: string;
|
|
1733
|
+
model: string;
|
|
1734
|
+
apiKey?: string;
|
|
1735
|
+
baseURL?: string;
|
|
1736
|
+
timeout?: number;
|
|
1737
|
+
options?: Record<string, TUniversalValue>;
|
|
1738
|
+
}
|
|
1739
|
+
interface IProviderProfileDefaults {
|
|
1740
|
+
model?: string;
|
|
1741
|
+
apiKey?: string;
|
|
1742
|
+
baseURL?: string;
|
|
1743
|
+
timeout?: number;
|
|
1744
|
+
options?: Record<string, TUniversalValue>;
|
|
1745
|
+
}
|
|
1746
|
+
interface IProviderProfileConfig {
|
|
1747
|
+
type?: string;
|
|
1748
|
+
model?: string;
|
|
1749
|
+
apiKey?: string;
|
|
1750
|
+
baseURL?: string;
|
|
1751
|
+
timeout?: number;
|
|
1752
|
+
options?: Record<string, TUniversalValue>;
|
|
1753
|
+
}
|
|
1754
|
+
interface IProviderProbeResult {
|
|
1755
|
+
ok: boolean;
|
|
1756
|
+
message: string;
|
|
1757
|
+
models?: string[];
|
|
1758
|
+
}
|
|
1759
|
+
type TProviderSetupField = 'baseURL' | 'model' | 'apiKey';
|
|
1760
|
+
interface IProviderSetupStepDefinition {
|
|
1761
|
+
key: TProviderSetupField;
|
|
1762
|
+
title: string;
|
|
1763
|
+
defaultValue?: string;
|
|
1764
|
+
required?: boolean;
|
|
1765
|
+
masked?: boolean;
|
|
1766
|
+
}
|
|
1767
|
+
interface IProviderDefinition {
|
|
1768
|
+
type: string;
|
|
1769
|
+
aliases?: readonly string[];
|
|
1770
|
+
displayName?: string;
|
|
1771
|
+
description?: string;
|
|
1772
|
+
defaults?: IProviderProfileDefaults;
|
|
1773
|
+
setupSteps?: readonly IProviderSetupStepDefinition[];
|
|
1774
|
+
requiresApiKey?: boolean;
|
|
1775
|
+
createProvider: (config: IProviderConfig$1) => IAIProvider;
|
|
1776
|
+
probeProfile?: (profile: IProviderProfileConfig) => Promise<IProviderProbeResult>;
|
|
1777
|
+
}
|
|
1778
|
+
declare function findProviderDefinition(definitions: readonly IProviderDefinition[], type: string): IProviderDefinition | undefined;
|
|
1779
|
+
declare function formatSupportedProviderTypes(definitions: readonly IProviderDefinition[]): string;
|
|
1780
|
+
|
|
1598
1781
|
/**
|
|
1599
1782
|
* Provider-agnostic media output reference.
|
|
1600
1783
|
* Providers must not return raw binary payloads in this contract.
|
|
@@ -1818,6 +2001,75 @@ interface IAgentFactory {
|
|
|
1818
2001
|
mergeConfig(base: IAgentConfig, override: Partial<IAgentConfig>): IAgentConfig;
|
|
1819
2002
|
}
|
|
1820
2003
|
|
|
2004
|
+
/**
|
|
2005
|
+
* OpenAPI specification configuration
|
|
2006
|
+
*/
|
|
2007
|
+
interface IOpenAPIToolConfig {
|
|
2008
|
+
/** OpenAPI 3.0 specification */
|
|
2009
|
+
spec: {
|
|
2010
|
+
openapi: string;
|
|
2011
|
+
info: {
|
|
2012
|
+
title: string;
|
|
2013
|
+
version: string;
|
|
2014
|
+
description?: string;
|
|
2015
|
+
};
|
|
2016
|
+
servers?: Array<{
|
|
2017
|
+
url: string;
|
|
2018
|
+
description?: string;
|
|
2019
|
+
}>;
|
|
2020
|
+
paths: Record<string, Record<string, string | number | boolean | Record<string, string | number | boolean>>>;
|
|
2021
|
+
components?: Record<string, Record<string, string | number | boolean>>;
|
|
2022
|
+
};
|
|
2023
|
+
/** Operation ID from the OpenAPI spec */
|
|
2024
|
+
operationId: string;
|
|
2025
|
+
/** Base URL for API calls */
|
|
2026
|
+
baseURL: string;
|
|
2027
|
+
/** Authentication configuration */
|
|
2028
|
+
auth?: {
|
|
2029
|
+
type: 'bearer' | 'apiKey' | 'basic';
|
|
2030
|
+
token?: string;
|
|
2031
|
+
apiKey?: string;
|
|
2032
|
+
header?: string;
|
|
2033
|
+
username?: string;
|
|
2034
|
+
password?: string;
|
|
2035
|
+
};
|
|
2036
|
+
}
|
|
2037
|
+
/**
|
|
2038
|
+
* MCP (Model Context Protocol) configuration
|
|
2039
|
+
*/
|
|
2040
|
+
interface IMCPToolConfig {
|
|
2041
|
+
/** MCP server endpoint */
|
|
2042
|
+
endpoint: string;
|
|
2043
|
+
/** Protocol version */
|
|
2044
|
+
version?: string;
|
|
2045
|
+
/** Authentication configuration */
|
|
2046
|
+
auth?: {
|
|
2047
|
+
type: 'bearer' | 'apiKey';
|
|
2048
|
+
token: string;
|
|
2049
|
+
};
|
|
2050
|
+
/** Tool-specific configuration */
|
|
2051
|
+
toolConfig?: Record<string, string | number | boolean>;
|
|
2052
|
+
/** Timeout in milliseconds */
|
|
2053
|
+
timeout?: number;
|
|
2054
|
+
}
|
|
2055
|
+
/**
|
|
2056
|
+
* Tool factory interface
|
|
2057
|
+
*/
|
|
2058
|
+
interface IToolFactory {
|
|
2059
|
+
/**
|
|
2060
|
+
* Create function tool from schema and function
|
|
2061
|
+
*/
|
|
2062
|
+
createFunctionTool(schema: IToolSchema, fn: TToolExecutor): IFunctionTool;
|
|
2063
|
+
/**
|
|
2064
|
+
* Create tool from OpenAPI specification
|
|
2065
|
+
*/
|
|
2066
|
+
createOpenAPITool(config: IOpenAPIToolConfig): ITool;
|
|
2067
|
+
/**
|
|
2068
|
+
* Create MCP tool
|
|
2069
|
+
*/
|
|
2070
|
+
createMCPTool(config: IMCPToolConfig): ITool;
|
|
2071
|
+
}
|
|
2072
|
+
|
|
1821
2073
|
/**
|
|
1822
2074
|
* Execution step definition for tools that support step-by-step progress reporting
|
|
1823
2075
|
*/
|
|
@@ -2384,72 +2636,13 @@ interface IExecutorAwareProviderConfig {
|
|
|
2384
2636
|
[key: string]: string | number | boolean | IExecutor | undefined;
|
|
2385
2637
|
}
|
|
2386
2638
|
/**
|
|
2387
|
-
* Base AI provider implementation with proper type constraints
|
|
2388
|
-
* All AI providers should extend this class
|
|
2389
|
-
*
|
|
2390
|
-
* ========================================
|
|
2391
|
-
* CRITICAL IMPLEMENTATION GUIDELINES
|
|
2392
|
-
* ========================================
|
|
2393
|
-
*
|
|
2394
|
-
* ALL AI PROVIDER IMPLEMENTATIONS (OpenAI, Anthropic, Google, etc.) MUST:
|
|
2395
|
-
*
|
|
2396
|
-
* 1. EXTEND THIS CLASS:
|
|
2397
|
-
* ```typescript
|
|
2398
|
-
* export class OpenAIProvider extends AbstractAIProvider {
|
|
2399
|
-
* override readonly name = 'openai';
|
|
2400
|
-
* override readonly version = '1.0.0';
|
|
2401
|
-
* ```
|
|
2402
|
-
*
|
|
2403
|
-
* 2. USE IMPORTS FROM @robota-sdk/agent-core:
|
|
2404
|
-
* ```typescript
|
|
2405
|
-
* import { AbstractAIProvider } from '@robota-sdk/agent-core';
|
|
2406
|
-
* import type {
|
|
2407
|
-
* TUniversalMessage,
|
|
2408
|
-
* ChatOptions,
|
|
2409
|
-
* IToolCall,
|
|
2410
|
-
* ToolSchema,
|
|
2411
|
-
* AssistantMessage
|
|
2412
|
-
* } from '@robota-sdk/agent-core';
|
|
2413
|
-
* ```
|
|
2414
|
-
*
|
|
2415
|
-
* 3. USE OVERRIDE KEYWORD FOR ALL INHERITED METHODS:
|
|
2416
|
-
* - override async chat(...)
|
|
2417
|
-
* - override async *chatStream(...)
|
|
2418
|
-
* - override supportsTools()
|
|
2419
|
-
* - override validateConfig()
|
|
2420
|
-
* - override async dispose()
|
|
2421
|
-
*
|
|
2422
|
-
* 4. DO NOT REDEFINE TYPES THAT EXIST IN @robota-sdk/agent-core:
|
|
2423
|
-
* - TUniversalMessage
|
|
2424
|
-
* - ChatOptions
|
|
2425
|
-
* - IToolCall
|
|
2426
|
-
* - ToolSchema
|
|
2427
|
-
* - AssistantMessage
|
|
2428
|
-
* - SystemMessage
|
|
2429
|
-
* - UserMessage
|
|
2430
|
-
* - ToolMessage
|
|
2639
|
+
* Base AI provider implementation with proper type constraints.
|
|
2640
|
+
* All AI providers should extend this class.
|
|
2431
2641
|
*
|
|
2432
|
-
*
|
|
2433
|
-
*
|
|
2434
|
-
* - For regular messages: content can be string or null
|
|
2435
|
-
* - Always preserve null values from API responses
|
|
2642
|
+
* Subclasses MUST: extend this class, use override keyword, call super() in constructor,
|
|
2643
|
+
* not redefine types that exist in agent-core, handle null message content correctly.
|
|
2436
2644
|
*
|
|
2437
|
-
*
|
|
2438
|
-
* ```typescript
|
|
2439
|
-
* constructor(options: IProviderOptions) {
|
|
2440
|
-
* super();
|
|
2441
|
-
* // provider-specific initialization
|
|
2442
|
-
* }
|
|
2443
|
-
* ```
|
|
2444
|
-
*
|
|
2445
|
-
* This ensures ExecutionService can properly identify providers
|
|
2446
|
-
* and prevents type conflicts across the codebase.
|
|
2447
|
-
*
|
|
2448
|
-
* ========================================
|
|
2449
|
-
*
|
|
2450
|
-
* @template TConfig - Provider configuration type (defaults to IProviderConfig for type safety)
|
|
2451
|
-
* @template TUniversalMessage - Message type (defaults to TUniversalMessage for backward compatibility)
|
|
2452
|
-
* @template TResponse - Response type (defaults to TUniversalMessage for backward compatibility)
|
|
2645
|
+
* @template TConfig - Provider configuration type
|
|
2453
2646
|
*/
|
|
2454
2647
|
declare abstract class AbstractAIProvider<TConfig = IProviderConfig> implements IAIProvider {
|
|
2455
2648
|
abstract readonly name: string;
|
|
@@ -2470,6 +2663,15 @@ declare abstract class AbstractAIProvider<TConfig = IProviderConfig> implements
|
|
|
2470
2663
|
* @returns Promise resolving to a response
|
|
2471
2664
|
*/
|
|
2472
2665
|
abstract chat(messages: TUniversalMessage[], options?: IChatOptions): Promise<TUniversalMessage>;
|
|
2666
|
+
/**
|
|
2667
|
+
* Wrap an async iterable to yield to the macrotask queue periodically.
|
|
2668
|
+
* Providers MUST use this when iterating over streaming events to ensure
|
|
2669
|
+
* the main thread event loop stays responsive (ESC abort, Ctrl+C, etc.).
|
|
2670
|
+
*
|
|
2671
|
+
* Usage in provider:
|
|
2672
|
+
* for await (const event of this.streamWithAbort(stream, signal)) { ... }
|
|
2673
|
+
*/
|
|
2674
|
+
protected streamWithAbort<T>(source: AsyncIterable<T>, signal?: AbortSignal): AsyncGenerator<T>;
|
|
2473
2675
|
/**
|
|
2474
2676
|
* Each provider must implement streaming chat using their own native SDK types internally
|
|
2475
2677
|
* @param messages - Array of messages from conversation history
|
|
@@ -2496,30 +2698,24 @@ declare abstract class AbstractAIProvider<TConfig = IProviderConfig> implements
|
|
|
2496
2698
|
* @returns true if tool calling is supported
|
|
2497
2699
|
*/
|
|
2498
2700
|
supportsTools(): boolean;
|
|
2701
|
+
getCapabilities(): IProviderCapabilities;
|
|
2499
2702
|
/**
|
|
2500
2703
|
* Default implementation - providers can override for specific validation
|
|
2501
2704
|
* @returns true if configuration is valid
|
|
2502
2705
|
*/
|
|
2503
2706
|
validateConfig(): boolean;
|
|
2504
|
-
/**
|
|
2505
|
-
* Utility method for validating TUniversalMessage array
|
|
2506
|
-
* @param messages - Messages to validate
|
|
2507
|
-
*/
|
|
2707
|
+
/** Validate that messages is a non-empty array with valid roles. */
|
|
2508
2708
|
protected validateMessages(messages: TUniversalMessage[]): void;
|
|
2509
|
-
/**
|
|
2510
|
-
* Utility method for validating tool schemas
|
|
2511
|
-
* @param tools - Tool schemas to validate
|
|
2512
|
-
*/
|
|
2709
|
+
/** Validate tool schemas. No-ops if tools is undefined. */
|
|
2513
2710
|
protected validateTools(tools?: IToolSchema[]): void;
|
|
2711
|
+
protected validateNativeWebTools(request?: IProviderNativeWebToolRequest): void;
|
|
2514
2712
|
/**
|
|
2515
2713
|
* Execute chat via executor.
|
|
2516
|
-
*
|
|
2517
2714
|
* Subclasses should call this only when an executor is configured.
|
|
2518
2715
|
*/
|
|
2519
2716
|
protected executeViaExecutorOrDirect(messages: TUniversalMessage[], options?: IChatOptions): Promise<TUniversalMessage>;
|
|
2520
2717
|
/**
|
|
2521
2718
|
* Execute streaming chat via executor.
|
|
2522
|
-
*
|
|
2523
2719
|
* Subclasses should call this only when an executor is configured.
|
|
2524
2720
|
*/
|
|
2525
2721
|
protected executeStreamViaExecutorOrDirect(messages: TUniversalMessage[], options?: IChatOptions): AsyncIterable<TUniversalMessage>;
|
|
@@ -2636,55 +2832,26 @@ declare abstract class AbstractExecutor implements IExecutor {
|
|
|
2636
2832
|
protected validateResponse(response: TUniversalMessage): void;
|
|
2637
2833
|
}
|
|
2638
2834
|
|
|
2639
|
-
interface IOpenAIMessage {
|
|
2640
|
-
role: 'system' | 'user' | 'assistant' | 'tool';
|
|
2641
|
-
content: string | null;
|
|
2642
|
-
tool_calls?: {
|
|
2643
|
-
id: string;
|
|
2644
|
-
type: 'function';
|
|
2645
|
-
function: {
|
|
2646
|
-
name: string;
|
|
2647
|
-
arguments: string;
|
|
2648
|
-
};
|
|
2649
|
-
}[];
|
|
2650
|
-
tool_call_id?: string;
|
|
2651
|
-
name?: string;
|
|
2652
|
-
}
|
|
2653
|
-
interface IAnthropicProviderMessage {
|
|
2654
|
-
role: 'user' | 'assistant';
|
|
2655
|
-
content: string;
|
|
2656
|
-
}
|
|
2657
|
-
interface IGoogleProviderMessage {
|
|
2658
|
-
role: 'user' | 'model';
|
|
2659
|
-
parts: {
|
|
2660
|
-
text: string;
|
|
2661
|
-
}[];
|
|
2662
|
-
}
|
|
2663
2835
|
/**
|
|
2664
|
-
* Provider message format
|
|
2836
|
+
* Provider message format type.
|
|
2837
|
+
*
|
|
2838
|
+
* Provider packages own concrete message shapes. Core only carries the generic
|
|
2839
|
+
* conversion hook and never branches on provider names.
|
|
2665
2840
|
*/
|
|
2666
|
-
type TProviderMessage =
|
|
2841
|
+
type TProviderMessage = TUniversalMessage | IUniversalObjectValue;
|
|
2842
|
+
type TMessageFormatConverter<TMessage extends TProviderMessage = TProviderMessage> = (messages: readonly TUniversalMessage[]) => TMessage[];
|
|
2843
|
+
type TMessageConverterRegistry = Readonly<Record<string, TMessageFormatConverter>>;
|
|
2667
2844
|
/**
|
|
2668
2845
|
* Universal message converter utility
|
|
2669
|
-
*
|
|
2846
|
+
*
|
|
2847
|
+
* The converter is registry-based so provider-specific message conversion is
|
|
2848
|
+
* injected by provider packages or callers instead of being hardcoded in core.
|
|
2670
2849
|
*/
|
|
2671
2850
|
declare class MessageConverter {
|
|
2672
2851
|
/**
|
|
2673
|
-
* Convert messages
|
|
2674
|
-
*/
|
|
2675
|
-
static toProviderFormat(messages: TUniversalMessage[], providerName: string): TProviderMessage[];
|
|
2676
|
-
/**
|
|
2677
|
-
* Convert to OpenAI format
|
|
2852
|
+
* Convert messages using an injected converter or converter registry.
|
|
2678
2853
|
*/
|
|
2679
|
-
|
|
2680
|
-
/**
|
|
2681
|
-
* Convert to Anthropic format
|
|
2682
|
-
*/
|
|
2683
|
-
private static toAnthropicFormat;
|
|
2684
|
-
/**
|
|
2685
|
-
* Convert to Google format
|
|
2686
|
-
*/
|
|
2687
|
-
private static toGoogleFormat;
|
|
2854
|
+
static toProviderFormat(messages: TUniversalMessage[], converter?: TMessageFormatConverter | string, registry?: TMessageConverterRegistry): TProviderMessage[];
|
|
2688
2855
|
/**
|
|
2689
2856
|
* Convert to universal format (no conversion)
|
|
2690
2857
|
*/
|
|
@@ -2730,7 +2897,7 @@ declare class Validator {
|
|
|
2730
2897
|
/**
|
|
2731
2898
|
* Validate API key format (basic check)
|
|
2732
2899
|
*/
|
|
2733
|
-
static validateApiKey(apiKey: string
|
|
2900
|
+
static validateApiKey(apiKey: string): ISimpleValidationResult;
|
|
2734
2901
|
}
|
|
2735
2902
|
declare const validateAgentConfig: typeof Validator.validateAgentConfig;
|
|
2736
2903
|
declare const validateUserInput: typeof Validator.validateUserInput;
|
|
@@ -2919,6 +3086,132 @@ declare function stopPeriodicTask(timer: TTimerId | undefined): void;
|
|
|
2919
3086
|
*/
|
|
2920
3087
|
type TTimerId = ReturnType<typeof setTimeout>;
|
|
2921
3088
|
|
|
3089
|
+
/** Create a user message. */
|
|
3090
|
+
declare function createUserMessage(content: string, options?: {
|
|
3091
|
+
name?: string;
|
|
3092
|
+
metadata?: TUniversalMessageMetadata;
|
|
3093
|
+
parts?: TUniversalMessagePart[];
|
|
3094
|
+
}): IUserMessage;
|
|
3095
|
+
/** Create an assistant message. */
|
|
3096
|
+
declare function createAssistantMessage(content: string | null, options?: {
|
|
3097
|
+
toolCalls?: IToolCall[];
|
|
3098
|
+
metadata?: TUniversalMessageMetadata;
|
|
3099
|
+
parts?: TUniversalMessagePart[];
|
|
3100
|
+
state?: TMessageState;
|
|
3101
|
+
}): IAssistantMessage;
|
|
3102
|
+
/** Create a system message. */
|
|
3103
|
+
declare function createSystemMessage(content: string, options?: {
|
|
3104
|
+
name?: string;
|
|
3105
|
+
metadata?: TUniversalMessageMetadata;
|
|
3106
|
+
parts?: TUniversalMessagePart[];
|
|
3107
|
+
}): ISystemMessage;
|
|
3108
|
+
/** Create a tool message. */
|
|
3109
|
+
declare function createToolMessage(content: string, options: {
|
|
3110
|
+
toolCallId: string;
|
|
3111
|
+
name?: string;
|
|
3112
|
+
metadata?: TUniversalMessageMetadata;
|
|
3113
|
+
parts?: TUniversalMessagePart[];
|
|
3114
|
+
}): IToolMessage;
|
|
3115
|
+
|
|
3116
|
+
/** API message format for provider consumption */
|
|
3117
|
+
interface IProviderApiMessage {
|
|
3118
|
+
role: string;
|
|
3119
|
+
content: string | null;
|
|
3120
|
+
tool_calls?: Array<{
|
|
3121
|
+
id: string;
|
|
3122
|
+
type: 'function';
|
|
3123
|
+
function: {
|
|
3124
|
+
name: string;
|
|
3125
|
+
arguments: string;
|
|
3126
|
+
};
|
|
3127
|
+
}>;
|
|
3128
|
+
tool_call_id?: string;
|
|
3129
|
+
}
|
|
3130
|
+
/**
|
|
3131
|
+
* Conversation store with duplicate prevention and API format conversion.
|
|
3132
|
+
* @public
|
|
3133
|
+
*/
|
|
3134
|
+
declare class ConversationStore implements IConversationHistory {
|
|
3135
|
+
private history;
|
|
3136
|
+
private pendingAssistant;
|
|
3137
|
+
constructor(maxMessages?: number);
|
|
3138
|
+
addMessage(message: TUniversalMessage): void;
|
|
3139
|
+
addUserMessage(content: string, metadata?: TUniversalMessageMetadata, parts?: TUniversalMessagePart[]): void;
|
|
3140
|
+
addAssistantMessage(content: string | null, toolCalls?: IToolCall[], metadata?: TUniversalMessageMetadata, parts?: TUniversalMessagePart[]): void;
|
|
3141
|
+
addSystemMessage(content: string, metadata?: TUniversalMessageMetadata, parts?: TUniversalMessagePart[]): void;
|
|
3142
|
+
addToolMessage(content: string, toolCallId: string, toolName?: string, metadata?: TUniversalMessageMetadata, parts?: TUniversalMessagePart[]): void;
|
|
3143
|
+
addToolMessageWithId(content: string, toolCallId: string, toolName: string, metadata?: TUniversalMessageMetadata, parts?: TUniversalMessagePart[]): void;
|
|
3144
|
+
/** Add a raw history entry (events, etc.) */
|
|
3145
|
+
addEntry(entry: IHistoryEntry): void;
|
|
3146
|
+
/** Get all history entries (universal timeline) */
|
|
3147
|
+
getHistory(): IHistoryEntry[];
|
|
3148
|
+
getMessages(): TUniversalMessage[];
|
|
3149
|
+
getMessagesByRole(role: TUniversalMessageRole): TUniversalMessage[];
|
|
3150
|
+
getRecentMessages(count: number): TUniversalMessage[];
|
|
3151
|
+
getMessageCount(): number;
|
|
3152
|
+
/** Begin a new assistant response. Must be called before provider call.
|
|
3153
|
+
* Ensures pendingAssistant exists so commitAssistant always has data to save. */
|
|
3154
|
+
beginAssistant(): void;
|
|
3155
|
+
/** Append streaming text delta to pending assistant response */
|
|
3156
|
+
appendStreaming(delta: string): void;
|
|
3157
|
+
/** Append a tool call to pending assistant response (deduplicates by id) */
|
|
3158
|
+
appendToolCall(toolCall: IToolCall): void;
|
|
3159
|
+
/**
|
|
3160
|
+
* Commit pending assistant response to history.
|
|
3161
|
+
* Precondition: beginAssistant() must have been called before the provider call.
|
|
3162
|
+
* History is append-only — this always adds a message.
|
|
3163
|
+
*/
|
|
3164
|
+
commitAssistant(state: TMessageState, metadata?: TUniversalMessageMetadata): void;
|
|
3165
|
+
/** Discard pending assistant response without saving */
|
|
3166
|
+
discardPending(): void;
|
|
3167
|
+
/** Returns true if there is accumulated pending assistant state (streaming or tool calls) */
|
|
3168
|
+
hasPendingAssistant(): boolean;
|
|
3169
|
+
/** Get pending assistant content (empty string if no content streamed yet) */
|
|
3170
|
+
getPendingContent(): string;
|
|
3171
|
+
getMessagesForAPI(): IProviderApiMessage[];
|
|
3172
|
+
clear(): void;
|
|
3173
|
+
}
|
|
3174
|
+
|
|
3175
|
+
/** Interface for managing conversation history. @public */
|
|
3176
|
+
interface IConversationHistory {
|
|
3177
|
+
addMessage(message: TUniversalMessage): void;
|
|
3178
|
+
addUserMessage(content: string, metadata?: TUniversalMessageMetadata, parts?: TUniversalMessagePart[]): void;
|
|
3179
|
+
addAssistantMessage(content: string | null, toolCalls?: IToolCall[], metadata?: TUniversalMessageMetadata, parts?: TUniversalMessagePart[]): void;
|
|
3180
|
+
addSystemMessage(content: string, metadata?: TUniversalMessageMetadata, parts?: TUniversalMessagePart[]): void;
|
|
3181
|
+
addToolMessageWithId(content: string, toolCallId: string, toolName: string, metadata?: TUniversalMessageMetadata, parts?: TUniversalMessagePart[]): void;
|
|
3182
|
+
addEntry(entry: IHistoryEntry): void;
|
|
3183
|
+
getHistory(): IHistoryEntry[];
|
|
3184
|
+
getMessages(): TUniversalMessage[];
|
|
3185
|
+
getMessagesByRole(role: TUniversalMessageRole): TUniversalMessage[];
|
|
3186
|
+
getRecentMessages(count: number): TUniversalMessage[];
|
|
3187
|
+
clear(): void;
|
|
3188
|
+
getMessageCount(): number;
|
|
3189
|
+
}
|
|
3190
|
+
/** Configuration options for ConversationHistory manager */
|
|
3191
|
+
interface IConversationHistoryOptions {
|
|
3192
|
+
maxMessagesPerConversation?: number;
|
|
3193
|
+
maxConversations?: number;
|
|
3194
|
+
}
|
|
3195
|
+
/** Multi-session conversation history manager. @public */
|
|
3196
|
+
declare class ConversationHistory {
|
|
3197
|
+
private conversations;
|
|
3198
|
+
private logger;
|
|
3199
|
+
private readonly maxMessagesPerConversation;
|
|
3200
|
+
private readonly maxConversations;
|
|
3201
|
+
constructor(options?: IConversationHistoryOptions);
|
|
3202
|
+
getConversationStore(conversationId: string): ConversationStore;
|
|
3203
|
+
hasConversation(conversationId: string): boolean;
|
|
3204
|
+
removeConversation(conversationId: string): boolean;
|
|
3205
|
+
clearAll(): void;
|
|
3206
|
+
getStats(): {
|
|
3207
|
+
totalConversations: number;
|
|
3208
|
+
conversationIds: string[];
|
|
3209
|
+
totalMessages: number;
|
|
3210
|
+
};
|
|
3211
|
+
/** @internal */
|
|
3212
|
+
private cleanupOldConversations;
|
|
3213
|
+
}
|
|
3214
|
+
|
|
2922
3215
|
/**
|
|
2923
3216
|
* Local executor that directly delegates to AI provider instances
|
|
2924
3217
|
*
|
|
@@ -3047,7 +3340,6 @@ interface IEventEmitterHierarchicalEventData extends IEventEmitterEventData {
|
|
|
3047
3340
|
actualResult?: IToolResult;
|
|
3048
3341
|
};
|
|
3049
3342
|
}
|
|
3050
|
-
|
|
3051
3343
|
/** Event emitter configuration */
|
|
3052
3344
|
interface IEventEmitterPluginOptions extends IPluginOptions {
|
|
3053
3345
|
events?: TEventName[];
|
|
@@ -3104,17 +3396,49 @@ declare class EventEmitterPlugin extends AbstractPlugin<IEventEmitterPluginOptio
|
|
|
3104
3396
|
off(eventType: TEventName, handlerIdOrListener: string | TEventEmitterListener): boolean;
|
|
3105
3397
|
emit(eventType: TEventName, eventData?: Partial<IEventEmitterEventData>): Promise<void>;
|
|
3106
3398
|
private processEvent;
|
|
3107
|
-
private executeHandler;
|
|
3108
3399
|
flushBuffer(): Promise<void>;
|
|
3109
3400
|
getStats(): IEventEmitterPluginStats;
|
|
3110
3401
|
clearAllListeners(): void;
|
|
3111
3402
|
destroy(): Promise<void>;
|
|
3112
|
-
private validateOptions;
|
|
3113
3403
|
}
|
|
3114
3404
|
|
|
3405
|
+
/**
|
|
3406
|
+
* Configuration and tool management delegate for the Robota agent.
|
|
3407
|
+
*
|
|
3408
|
+
* Extracted from robota.ts to keep the main class under 300 lines.
|
|
3409
|
+
*/
|
|
3410
|
+
|
|
3115
3411
|
/** Agent statistics metadata type */
|
|
3116
3412
|
type TAgentStatsMetadata = Record<string, string | number | boolean | Date | string[]>;
|
|
3117
3413
|
|
|
3414
|
+
/** Shared model configuration shape used in setModel / getModel. */
|
|
3415
|
+
type TModelConfig = {
|
|
3416
|
+
provider: string;
|
|
3417
|
+
model: string;
|
|
3418
|
+
temperature?: number;
|
|
3419
|
+
maxTokens?: number;
|
|
3420
|
+
topP?: number;
|
|
3421
|
+
systemMessage?: string;
|
|
3422
|
+
};
|
|
3423
|
+
/** Return shape of getConfiguration(). */
|
|
3424
|
+
type TConfigurationSnapshot = {
|
|
3425
|
+
version: number;
|
|
3426
|
+
tools: Array<{
|
|
3427
|
+
name: string;
|
|
3428
|
+
parameters?: string[];
|
|
3429
|
+
}>;
|
|
3430
|
+
updatedAt: number;
|
|
3431
|
+
};
|
|
3432
|
+
/** Return shape of getModuleStats(). */
|
|
3433
|
+
type TModuleStats = {
|
|
3434
|
+
totalExecutions: number;
|
|
3435
|
+
successfulExecutions: number;
|
|
3436
|
+
failedExecutions: number;
|
|
3437
|
+
averageExecutionTime: number;
|
|
3438
|
+
lastExecutionTime?: Date;
|
|
3439
|
+
} | undefined;
|
|
3440
|
+
/** Shorthand for the plugin contract type used throughout this class. */
|
|
3441
|
+
type TPlugin = IPluginContract<IPluginOptions, IPluginStats> & IPluginHooks;
|
|
3118
3442
|
/**
|
|
3119
3443
|
* Core AI agent integrating multiple AI providers, tools, and plugins
|
|
3120
3444
|
* into a unified conversational interface.
|
|
@@ -3144,50 +3468,33 @@ declare class Robota extends AbstractAgent<IAgentConfig, IRunOptions, TUniversal
|
|
|
3144
3468
|
private pluginManager;
|
|
3145
3469
|
private configManager;
|
|
3146
3470
|
constructor(config: IAgentConfig);
|
|
3147
|
-
private initDelegates;
|
|
3148
|
-
private emitCreatedEvent;
|
|
3149
3471
|
run(input: string, options?: IRunOptions): Promise<string>;
|
|
3150
3472
|
runStream(input: string, options?: IRunOptions): AsyncGenerator<string, void, undefined>;
|
|
3151
3473
|
private executionDeps;
|
|
3152
3474
|
getHistory(): TUniversalMessage[];
|
|
3475
|
+
getFullHistory(): IHistoryEntry[];
|
|
3476
|
+
addHistoryEntry(entry: IHistoryEntry): void;
|
|
3153
3477
|
clearHistory(): void;
|
|
3478
|
+
injectMessage(role: 'user' | 'assistant' | 'system' | 'tool', content: string, options?: {
|
|
3479
|
+
toolCallId?: string;
|
|
3480
|
+
name?: string;
|
|
3481
|
+
}): void;
|
|
3154
3482
|
updateTools(next: Array<IToolWithEventService>): Promise<{
|
|
3155
3483
|
version: number;
|
|
3156
3484
|
}>;
|
|
3157
3485
|
updateConfiguration(patch: Partial<IAgentConfig>): Promise<{
|
|
3158
3486
|
version: number;
|
|
3159
3487
|
}>;
|
|
3160
|
-
getConfiguration(): Promise<
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
name: string;
|
|
3164
|
-
parameters?: string[];
|
|
3165
|
-
}>;
|
|
3166
|
-
updatedAt: number;
|
|
3167
|
-
}>;
|
|
3168
|
-
setModel(mc: {
|
|
3169
|
-
provider: string;
|
|
3170
|
-
model: string;
|
|
3171
|
-
temperature?: number;
|
|
3172
|
-
maxTokens?: number;
|
|
3173
|
-
topP?: number;
|
|
3174
|
-
systemMessage?: string;
|
|
3175
|
-
}): void;
|
|
3176
|
-
getModel(): {
|
|
3177
|
-
provider: string;
|
|
3178
|
-
model: string;
|
|
3179
|
-
temperature?: number;
|
|
3180
|
-
maxTokens?: number;
|
|
3181
|
-
topP?: number;
|
|
3182
|
-
systemMessage?: string;
|
|
3183
|
-
};
|
|
3488
|
+
getConfiguration(): Promise<TConfigurationSnapshot>;
|
|
3489
|
+
setModel(mc: TModelConfig): void;
|
|
3490
|
+
getModel(): TModelConfig;
|
|
3184
3491
|
registerTool(tool: AbstractTool): void;
|
|
3185
3492
|
unregisterTool(toolName: string): void;
|
|
3186
3493
|
getConfig(): IAgentConfig;
|
|
3187
|
-
addPlugin(plugin:
|
|
3494
|
+
addPlugin(plugin: TPlugin): void;
|
|
3188
3495
|
removePlugin(pluginName: string): boolean;
|
|
3189
|
-
getPlugin(pluginName: string):
|
|
3190
|
-
getPlugins():
|
|
3496
|
+
getPlugin(pluginName: string): TPlugin | undefined;
|
|
3497
|
+
getPlugins(): TPlugin[];
|
|
3191
3498
|
getPluginNames(): string[];
|
|
3192
3499
|
registerModule(module: IModule, options?: {
|
|
3193
3500
|
autoInitialize?: boolean;
|
|
@@ -3210,13 +3517,7 @@ declare class Robota extends AbstractAgent<IAgentConfig, IRunOptions, TUniversal
|
|
|
3210
3517
|
error?: Error;
|
|
3211
3518
|
duration?: number;
|
|
3212
3519
|
}>;
|
|
3213
|
-
getModuleStats(moduleName: string):
|
|
3214
|
-
totalExecutions: number;
|
|
3215
|
-
successfulExecutions: number;
|
|
3216
|
-
failedExecutions: number;
|
|
3217
|
-
averageExecutionTime: number;
|
|
3218
|
-
lastExecutionTime?: Date;
|
|
3219
|
-
} | undefined;
|
|
3520
|
+
getModuleStats(moduleName: string): TModuleStats;
|
|
3220
3521
|
getStats(): {
|
|
3221
3522
|
name: string;
|
|
3222
3523
|
version: string;
|
|
@@ -3235,7 +3536,6 @@ declare class Robota extends AbstractAgent<IAgentConfig, IRunOptions, TUniversal
|
|
|
3235
3536
|
private ensureFullyInitialized;
|
|
3236
3537
|
private doAsyncInit;
|
|
3237
3538
|
private emitAgentEvent;
|
|
3238
|
-
private buildOwnerPath;
|
|
3239
3539
|
}
|
|
3240
3540
|
|
|
3241
3541
|
/**
|
|
@@ -3356,6 +3656,7 @@ interface IAgentLifecycleEvents {
|
|
|
3356
3656
|
/** Called when agent is destroyed */
|
|
3357
3657
|
onDestroy?: (agentId: string) => Promise<void> | void;
|
|
3358
3658
|
}
|
|
3659
|
+
|
|
3359
3660
|
/**
|
|
3360
3661
|
* Agent Factory for creating and managing agents
|
|
3361
3662
|
* Instance-based for isolated agent factory management
|
|
@@ -3429,97 +3730,18 @@ declare class AgentFactory {
|
|
|
3429
3730
|
isValid: boolean;
|
|
3430
3731
|
errors: string[];
|
|
3431
3732
|
};
|
|
3432
|
-
/**
|
|
3433
|
-
* Apply default configuration values
|
|
3434
|
-
*/
|
|
3435
|
-
private applyDefaults;
|
|
3436
|
-
/**
|
|
3437
|
-
* Generate unique agent ID
|
|
3438
|
-
*/
|
|
3439
|
-
private generateAgentId;
|
|
3440
|
-
/**
|
|
3441
|
-
* Update creation statistics
|
|
3442
|
-
*/
|
|
3443
|
-
private updateCreationStats;
|
|
3444
|
-
}
|
|
3445
|
-
|
|
3446
|
-
/**
|
|
3447
|
-
* Conversation session implementations.
|
|
3448
|
-
*
|
|
3449
|
-
* Extracted from conversation-history-manager.ts.
|
|
3450
|
-
*/
|
|
3451
|
-
|
|
3452
|
-
/** API message format for provider consumption */
|
|
3453
|
-
interface IProviderApiMessage {
|
|
3454
|
-
role: string;
|
|
3455
|
-
content: string | null;
|
|
3456
|
-
tool_calls?: Array<{
|
|
3457
|
-
id: string;
|
|
3458
|
-
type: 'function';
|
|
3459
|
-
function: {
|
|
3460
|
-
name: string;
|
|
3461
|
-
arguments: string;
|
|
3462
|
-
};
|
|
3463
|
-
}>;
|
|
3464
|
-
tool_call_id?: string;
|
|
3465
|
-
}
|
|
3466
|
-
/**
|
|
3467
|
-
* Conversation session with duplicate prevention and API format conversion.
|
|
3468
|
-
* @public
|
|
3469
|
-
*/
|
|
3470
|
-
declare class ConversationSession implements IConversationHistory {
|
|
3471
|
-
private history;
|
|
3472
|
-
private toolCallIds;
|
|
3473
|
-
constructor(maxMessages?: number);
|
|
3474
|
-
addMessage(message: TUniversalMessage): void;
|
|
3475
|
-
addUserMessage(content: string, metadata?: TUniversalMessageMetadata, parts?: TUniversalMessagePart[]): void;
|
|
3476
|
-
addAssistantMessage(content: string | null, toolCalls?: IToolCall[], metadata?: TUniversalMessageMetadata, parts?: TUniversalMessagePart[]): void;
|
|
3477
|
-
addSystemMessage(content: string, metadata?: TUniversalMessageMetadata, parts?: TUniversalMessagePart[]): void;
|
|
3478
|
-
addToolMessage(content: string, toolCallId: string, toolName?: string, metadata?: TUniversalMessageMetadata, parts?: TUniversalMessagePart[]): void;
|
|
3479
|
-
addToolMessageWithId(content: string, toolCallId: string, toolName: string, metadata?: TUniversalMessageMetadata, parts?: TUniversalMessagePart[]): void;
|
|
3480
|
-
getMessages(): TUniversalMessage[];
|
|
3481
|
-
getMessagesByRole(role: TUniversalMessageRole): TUniversalMessage[];
|
|
3482
|
-
getRecentMessages(count: number): TUniversalMessage[];
|
|
3483
|
-
getMessageCount(): number;
|
|
3484
|
-
getMessagesForAPI(): IProviderApiMessage[];
|
|
3485
|
-
clear(): void;
|
|
3486
3733
|
}
|
|
3487
3734
|
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
getMessages(): TUniversalMessage[];
|
|
3496
|
-
getMessagesByRole(role: TUniversalMessageRole): TUniversalMessage[];
|
|
3497
|
-
getRecentMessages(count: number): TUniversalMessage[];
|
|
3498
|
-
clear(): void;
|
|
3499
|
-
getMessageCount(): number;
|
|
3500
|
-
}
|
|
3501
|
-
/** Configuration options for ConversationHistory manager */
|
|
3502
|
-
interface IConversationHistoryOptions {
|
|
3503
|
-
maxMessagesPerConversation?: number;
|
|
3504
|
-
maxConversations?: number;
|
|
3505
|
-
}
|
|
3506
|
-
/** Multi-session conversation history manager. @public */
|
|
3507
|
-
declare class ConversationHistory {
|
|
3508
|
-
private conversations;
|
|
3509
|
-
private logger;
|
|
3510
|
-
private readonly maxMessagesPerConversation;
|
|
3511
|
-
private readonly maxConversations;
|
|
3512
|
-
constructor(options?: IConversationHistoryOptions);
|
|
3513
|
-
getConversationSession(conversationId: string): ConversationSession;
|
|
3514
|
-
hasConversation(conversationId: string): boolean;
|
|
3515
|
-
removeConversation(conversationId: string): boolean;
|
|
3516
|
-
clearAll(): void;
|
|
3517
|
-
getStats(): {
|
|
3518
|
-
totalConversations: number;
|
|
3519
|
-
conversationIds: string[];
|
|
3520
|
-
totalMessages: number;
|
|
3735
|
+
interface IAssistantUsageMetadata {
|
|
3736
|
+
inputTokens: number;
|
|
3737
|
+
outputTokens: number;
|
|
3738
|
+
usage: {
|
|
3739
|
+
totalTokens: number;
|
|
3740
|
+
inputTokens: number;
|
|
3741
|
+
outputTokens: number;
|
|
3521
3742
|
};
|
|
3522
3743
|
}
|
|
3744
|
+
declare function collectAssistantUsageMetadata(message: TUniversalMessage): IAssistantUsageMetadata | undefined;
|
|
3523
3745
|
|
|
3524
3746
|
declare class EventHistoryModule implements IEventHistoryModule {
|
|
3525
3747
|
private readonly store;
|
|
@@ -3997,11 +4219,13 @@ interface IExecutionProxyConfig {
|
|
|
3997
4219
|
task?: boolean;
|
|
3998
4220
|
};
|
|
3999
4221
|
}
|
|
4222
|
+
/** Internal target shape for proxy interception */
|
|
4223
|
+
type TExecutionProxyTarget = Record<string, TUniversalValue>;
|
|
4224
|
+
/** Internal args shape for proxy interception */
|
|
4225
|
+
type TExecutionProxyArgs = TUniversalValue[];
|
|
4000
4226
|
/**
|
|
4001
4227
|
* Metadata extractor function type
|
|
4002
4228
|
*/
|
|
4003
|
-
type TExecutionProxyTarget = Record<string, TUniversalValue>;
|
|
4004
|
-
type TExecutionProxyArgs = TUniversalValue[];
|
|
4005
4229
|
type TMetadataExtractor = (target: TExecutionProxyTarget, methodName: string, args: TExecutionProxyArgs) => Record<string, TUniversalValue>;
|
|
4006
4230
|
/**
|
|
4007
4231
|
* Method configuration for proxy
|
|
@@ -4013,6 +4237,7 @@ interface IMethodConfig {
|
|
|
4013
4237
|
extractMetadata?: TMetadataExtractor;
|
|
4014
4238
|
extractResult?: (result: TUniversalValue) => Record<string, TUniversalValue>;
|
|
4015
4239
|
}
|
|
4240
|
+
|
|
4016
4241
|
/**
|
|
4017
4242
|
* ExecutionProxy - Automatic event emission using Proxy pattern
|
|
4018
4243
|
*
|
|
@@ -4129,7 +4354,7 @@ declare function evaluatePermission(toolName: string, toolArgs: TToolArgs, mode:
|
|
|
4129
4354
|
* Permission mode definitions for Robota CLI
|
|
4130
4355
|
*
|
|
4131
4356
|
* Matches Claude Code-compatible permission modes:
|
|
4132
|
-
* - plan: read-only tools only (Read, Glob, Grep auto; Write, Edit, Bash denied)
|
|
4357
|
+
* - plan: read-only tools only (Read, Glob, Grep, WebFetch, WebSearch auto; Write, Edit, Bash denied)
|
|
4133
4358
|
* - default: safe reads auto, writes and bash need approval
|
|
4134
4359
|
* - acceptEdits: reads + writes auto, bash needs approval
|
|
4135
4360
|
* - bypassPermissions: all tools auto
|
|
@@ -4138,7 +4363,7 @@ declare function evaluatePermission(toolName: string, toolArgs: TToolArgs, mode:
|
|
|
4138
4363
|
/**
|
|
4139
4364
|
* Tool names known to the permission system
|
|
4140
4365
|
*/
|
|
4141
|
-
type TKnownToolName = 'Bash' | 'Read' | 'Write' | 'Edit' | 'Glob' | 'Grep';
|
|
4366
|
+
type TKnownToolName = 'Bash' | 'Read' | 'Write' | 'Edit' | 'Glob' | 'Grep' | 'WebFetch' | 'WebSearch';
|
|
4142
4367
|
/**
|
|
4143
4368
|
* Permission mode → tool policy matrix
|
|
4144
4369
|
* Maps each mode to a decision for each known tool.
|
|
@@ -4175,22 +4400,78 @@ interface IContextWindowState {
|
|
|
4175
4400
|
remainingPercentage: number;
|
|
4176
4401
|
}
|
|
4177
4402
|
|
|
4403
|
+
/**
|
|
4404
|
+
* Claude model definitions — SSOT for model metadata.
|
|
4405
|
+
* Source: https://platform.claude.com/docs/en/about-claude/models/overview
|
|
4406
|
+
*/
|
|
4407
|
+
interface IModelDefinition {
|
|
4408
|
+
/** Human-readable model name */
|
|
4409
|
+
name: string;
|
|
4410
|
+
/** API model identifier */
|
|
4411
|
+
id: string;
|
|
4412
|
+
/** Context window size in tokens */
|
|
4413
|
+
contextWindow: number;
|
|
4414
|
+
/** Maximum output tokens */
|
|
4415
|
+
maxOutput: number;
|
|
4416
|
+
}
|
|
4417
|
+
/**
|
|
4418
|
+
* Known Claude models (4.5+).
|
|
4419
|
+
* Keyed by API model ID for fast lookup.
|
|
4420
|
+
*/
|
|
4421
|
+
declare const CLAUDE_MODELS: Record<string, IModelDefinition>;
|
|
4422
|
+
declare const DEFAULT_CONTEXT_WINDOW = 200000;
|
|
4423
|
+
/** Get context window size for a model ID. Falls back to DEFAULT_CONTEXT_WINDOW. */
|
|
4424
|
+
declare function getModelContextWindow(modelId: string): number;
|
|
4425
|
+
declare const DEFAULT_MAX_OUTPUT = 16384;
|
|
4426
|
+
/** Get max output tokens for a model ID. Falls back to DEFAULT_MAX_OUTPUT. */
|
|
4427
|
+
declare function getModelMaxOutput(modelId: string): number;
|
|
4428
|
+
/** Get human-readable model name for a model ID. Falls back to the ID itself. */
|
|
4429
|
+
declare function getModelName(modelId: string): string;
|
|
4430
|
+
/** Format token count as human-readable (e.g., 200K, 1M, 1.2M). Minimum unit is K. */
|
|
4431
|
+
declare function formatTokenCount(tokens: number): string;
|
|
4432
|
+
|
|
4178
4433
|
/**
|
|
4179
4434
|
* Hook system types — Claude Code compatible event/hook model.
|
|
4180
4435
|
*/
|
|
4181
4436
|
/** Hook lifecycle events */
|
|
4182
|
-
type THookEvent = 'PreToolUse' | 'PostToolUse' | 'SessionStart' | 'Stop' | 'PreCompact' | 'PostCompact';
|
|
4183
|
-
/**
|
|
4184
|
-
|
|
4185
|
-
|
|
4437
|
+
type THookEvent = 'PreToolUse' | 'PostToolUse' | 'SessionStart' | 'SessionEnd' | 'Stop' | 'StopFailure' | 'PreCompact' | 'PostCompact' | 'UserPromptSubmit' | 'SubagentStart' | 'SubagentStop' | 'WorktreeCreate' | 'WorktreeRemove';
|
|
4438
|
+
/** Claude Code compatible session end reasons. */
|
|
4439
|
+
type TSessionEndReason = 'clear' | 'resume' | 'logout' | 'prompt_input_exit' | 'bypass_permissions_disabled' | 'other';
|
|
4440
|
+
/** Command hook — executes a shell command */
|
|
4441
|
+
interface ICommandHookDefinition {
|
|
4186
4442
|
type: 'command';
|
|
4187
4443
|
command: string;
|
|
4444
|
+
timeout?: number;
|
|
4445
|
+
}
|
|
4446
|
+
/** HTTP hook — sends an HTTP request */
|
|
4447
|
+
interface IHttpHookDefinition {
|
|
4448
|
+
type: 'http';
|
|
4449
|
+
url: string;
|
|
4450
|
+
headers?: Record<string, string>;
|
|
4451
|
+
timeout?: number;
|
|
4188
4452
|
}
|
|
4453
|
+
/** Prompt hook — evaluates a prompt via an AI model */
|
|
4454
|
+
interface IPromptHookDefinition {
|
|
4455
|
+
type: 'prompt';
|
|
4456
|
+
prompt: string;
|
|
4457
|
+
model?: string;
|
|
4458
|
+
}
|
|
4459
|
+
/** Agent hook — delegates to a sub-agent */
|
|
4460
|
+
interface IAgentHookDefinition {
|
|
4461
|
+
type: 'agent';
|
|
4462
|
+
agent: string;
|
|
4463
|
+
maxTurns?: number;
|
|
4464
|
+
timeout?: number;
|
|
4465
|
+
}
|
|
4466
|
+
/** Discriminated union of all hook definition types */
|
|
4467
|
+
type IHookDefinition = ICommandHookDefinition | IHttpHookDefinition | IPromptHookDefinition | IAgentHookDefinition;
|
|
4189
4468
|
/** A hook group — matcher + array of hook definitions */
|
|
4190
4469
|
interface IHookGroup {
|
|
4191
4470
|
/** Regex pattern to match tool name (empty string = match all) */
|
|
4192
4471
|
matcher: string;
|
|
4193
4472
|
hooks: IHookDefinition[];
|
|
4473
|
+
/** Environment variables injected into hook child processes for this group */
|
|
4474
|
+
env?: Record<string, string>;
|
|
4194
4475
|
}
|
|
4195
4476
|
/** Complete hooks configuration: event → array of hook groups */
|
|
4196
4477
|
type THooksConfig = Partial<Record<THookEvent, IHookGroup[]>>;
|
|
@@ -4206,6 +4487,28 @@ interface IHookInput {
|
|
|
4206
4487
|
trigger?: 'auto' | 'manual';
|
|
4207
4488
|
/** Compaction summary text (PostCompact only) */
|
|
4208
4489
|
compact_summary?: string;
|
|
4490
|
+
/** User message text (UserPromptSubmit only) */
|
|
4491
|
+
user_message?: string;
|
|
4492
|
+
/** User prompt text — Claude Code compatible alias for user_message (UserPromptSubmit only) */
|
|
4493
|
+
prompt?: string;
|
|
4494
|
+
/** Assistant response text (Stop only) */
|
|
4495
|
+
response?: string;
|
|
4496
|
+
/** Last assistant message text (StopFailure only) */
|
|
4497
|
+
last_assistant_message?: string;
|
|
4498
|
+
/** Stop hook recursion guard (Stop/StopFailure only) */
|
|
4499
|
+
stop_hook_active?: boolean;
|
|
4500
|
+
/** Session end reason (SessionEnd only) */
|
|
4501
|
+
reason?: TSessionEndReason | string;
|
|
4502
|
+
/** Session transcript path when available (SessionEnd/SubagentStop only) */
|
|
4503
|
+
transcript_path?: string;
|
|
4504
|
+
/** Subagent identifier (SubagentStart/SubagentStop only) */
|
|
4505
|
+
agent_id?: string;
|
|
4506
|
+
/** Subagent type/name (SubagentStart/SubagentStop only) */
|
|
4507
|
+
agent_type?: string;
|
|
4508
|
+
/** Subagent transcript path when available (SubagentStop only) */
|
|
4509
|
+
agent_transcript_path?: string;
|
|
4510
|
+
/** Additional environment variables to pass to hook child processes */
|
|
4511
|
+
env?: Record<string, string>;
|
|
4209
4512
|
}
|
|
4210
4513
|
/** Hook execution result */
|
|
4211
4514
|
interface IHookResult {
|
|
@@ -4214,11 +4517,21 @@ interface IHookResult {
|
|
|
4214
4517
|
stdout: string;
|
|
4215
4518
|
stderr: string;
|
|
4216
4519
|
}
|
|
4520
|
+
/** Strategy interface for hook type executors */
|
|
4521
|
+
interface IHookTypeExecutor {
|
|
4522
|
+
/** The hook type this executor handles */
|
|
4523
|
+
type: IHookDefinition['type'];
|
|
4524
|
+
/** Execute a hook definition with the given input */
|
|
4525
|
+
execute(definition: IHookDefinition, input: IHookInput): Promise<IHookResult>;
|
|
4526
|
+
}
|
|
4217
4527
|
|
|
4218
4528
|
/**
|
|
4219
|
-
* Hook runner — executes
|
|
4529
|
+
* Hook runner — executes hooks for lifecycle events using the strategy pattern.
|
|
4530
|
+
*
|
|
4531
|
+
* Dispatches to registered IHookTypeExecutor implementations by definition type.
|
|
4532
|
+
* Default executors: CommandExecutor (shell), HttpExecutor (HTTP POST).
|
|
4220
4533
|
*
|
|
4221
|
-
*
|
|
4534
|
+
* Exit code semantics:
|
|
4222
4535
|
* - 0: allow/proceed
|
|
4223
4536
|
* - 2: block/deny (stderr contains reason)
|
|
4224
4537
|
* - other: proceed (logged as warning)
|
|
@@ -4229,10 +4542,19 @@ interface IHookResult {
|
|
|
4229
4542
|
*
|
|
4230
4543
|
* For PreToolUse: if any hook returns exit code 2, the tool call is blocked.
|
|
4231
4544
|
* Returns { blocked: true, reason: string } if blocked, { blocked: false } otherwise.
|
|
4545
|
+
*
|
|
4546
|
+
* @param config - Hooks configuration mapping events to hook groups
|
|
4547
|
+
* @param event - The lifecycle event being fired
|
|
4548
|
+
* @param input - Hook input data passed to executors
|
|
4549
|
+
* @param executors - Optional array of hook type executors (defaults to command + http)
|
|
4232
4550
|
*/
|
|
4233
|
-
|
|
4551
|
+
/** Result of running hooks for an event. */
|
|
4552
|
+
interface IRunHooksResult {
|
|
4234
4553
|
blocked: boolean;
|
|
4235
4554
|
reason?: string;
|
|
4236
|
-
|
|
4555
|
+
/** Collected stdout from all successful hooks (exit code 0). */
|
|
4556
|
+
stdout: string;
|
|
4557
|
+
}
|
|
4558
|
+
declare function runHooks(config: THooksConfig | undefined, event: THookEvent, input: IHookInput, executors?: IHookTypeExecutor[]): Promise<IRunHooksResult>;
|
|
4237
4559
|
|
|
4238
|
-
export { AGENT_EVENTS, AGENT_EVENT_PREFIX, AbstractAIProvider, AbstractAgent, AbstractExecutor, AbstractManager, AbstractPlugin, AbstractTool, AgentFactory, AgentTemplates, AuthenticationError, CacheIntegrityError, CircuitBreakerOpenError, ConfigurationError, ConversationHistory,
|
|
4560
|
+
export { AGENT_EVENTS, AGENT_EVENT_PREFIX, AbstractAIProvider, AbstractAgent, AbstractEventService, AbstractExecutor, AbstractManager, AbstractPlugin, AbstractTool, AgentFactory, AgentTemplates, AuthenticationError, CLAUDE_MODELS, CacheIntegrityError, CircuitBreakerOpenError, ConfigurationError, ConsoleLogger, ConversationHistory, ConversationStore, DEFAULT_ABSTRACT_EVENT_SERVICE, DEFAULT_CONTEXT_WINDOW, DEFAULT_MAX_OUTPUT, DefaultEventService, EVENT_EMITTER_EVENTS, EXECUTION_EVENTS, EXECUTION_EVENT_PREFIX, ErrorUtils, EventEmitterPlugin, EventHistoryModule, ExecutionProxy, type IAIProvider, type IAIProviderInstance, type IAIProviderManager, type IAbstractTool, type IAbstractToolOptions, type IAgent, type IAgentConfig, type IAgentCreationOptions, type IAgentCreationStats, type IAgentEventData, type IAgentFactory, type IAgentFactoryOptions, type IAgentHookDefinition, type IAgentLifecycleEvents, type IAgentTemplate, type IAssistantMessage, type IAssistantUsageMetadata, type IBaseEventData, type IBaseMessage, type ICacheEntry, type ICacheKey, type ICacheOptions, type ICacheStats, type ICacheStorage, type IChatExecutionRequest, type IChatOptions, type ICommandHookDefinition, type IConfigValidationResult, type IContextOptions, type IContextTokenUsage, type IContextWindowState, type IConversationContext, type IConversationResponse, type IConversationService, type IConversationServiceOptions, type IEventContext, type IEventEmitterEventData, type IEventEmitterHierarchicalEventData, type IEventEmitterMetrics, type IEventEmitterMetricsSnapshot, type IEventEmitterPlugin, type IEventEmitterPluginOptions, type IEventHistoryModule, type IEventHistoryRecord, type IEventHistorySnapshot, type IEventObjectValue, type IEventService, type IEventServiceOwnerBinding, type IExecutionEventData, type IExecutionService, type IExecutionServiceOptions, type IExecutor, type IExecutorAwareProviderConfig, type IFunctionTool, type IHistoryEntry, type IHookDefinition, type IHookGroup, type IHookInput, type IHookResult, type IHookTypeExecutor, type IHttpHookDefinition, type IImageComposeRequest, type IImageEditRequest, type IImageGenerationProvider, type IImageGenerationRequest, type IImageGenerationResult, type IInlineImageInputSource, type IInlineImageMessagePart, type ILocalExecutorConfig, type ILogger, type IMCPToolConfig, type IMediaOutputRef, type IModelDefinition, type IOpenAPIToolConfig, type IOwnerPathSegment, type IParameterSchema, type IParameterValidationResult, type IPermissionLists, type IPlugin, type IPluginConfig, type IPluginContext, type IPluginContract, type IPluginData, type IPluginErrorContext, type IPluginExecutionContext, type IPluginExecutionResult, type IPluginHooks, type IPluginOptions, type IPluginStats, type IProgressReportingTool, type IPromptHookDefinition, type IProviderCapabilities, type IProviderConfig$1 as IProviderConfig, type IProviderDefinition, type IProviderFunctionCallingCapability, type IProviderMediaError, type IProviderNativeWebToolCapabilities, type IProviderNativeWebToolCapability, type IProviderNativeWebToolRequest, type IProviderOptions, type IProviderProbeResult, type IProviderProfileConfig, type IProviderProfileDefaults, type IProviderRequest, type IProviderSetupStepDefinition, type IProviderSpecificOptions, type IRawProviderResponse, type IRemoteExecutorConfig, type IRunOptions, type ISimpleValidationResult, type IStreamExecutionRequest, type IStreamingChunk, type ISystemMessage, type ITemplateApplicationResult, type ITextMessagePart, type ITokenUsage, type ITool, type IToolCall, type IToolContract, type IToolEventData, type IToolExecutionContext, type IToolExecutionRequest, type IToolExecutionResult, type IToolExecutionService, type IToolExecutionStep, type IToolFactory, type IToolManager, type IToolMessage, type IToolRegistry, type IToolResult, type IToolSchema, type IToolWithEventService, type IUniversalObjectValue, type IUriImageInputSource, type IUriImageMessagePart, type IUserMessage, type IUtilLogEntry, type IValidationIssue, type IValidationOptions, type IValidationResult, type IVideoGenerationProvider, type IVideoGenerationRequest, type IVideoJobAccepted, type IVideoJobSnapshot, type IWorkflowConfig, type IWorkflowConversionOptions, type IWorkflowConversionResult, type IWorkflowConverter, type IWorkflowData, type IWorkflowMetadata, type IWorkflowValidator, InMemoryEventEmitterMetrics, LocalExecutor, MODE_POLICY, MessageConverter, ModelNotAvailableError, NetworkError, ObservableEventService, PluginCategory, PluginError, PluginPriority, ProviderError, RateLimitError, Robota, RobotaError, SilentLogger, StorageError, StructuredEventService, TASK_EVENTS, TASK_EVENT_PREFIX, type TAgentCreationMetadata, type TComplexConfigValue, type TConfigData, type TConfigValue, type TContextData, type TConversationContextMetadata, type TErrorContextData, type TErrorExternalInput, type TEventEmitterListener, type TEventExtensionValue, type TEventListener, type TEventLoggerData, type TEventName, type TEventUniversalValue, type TExecutionEventName, type TExecutionMetadata, type THookEvent, type THooksConfig, type TImageInputSource, type TJSONSchemaEnum, type TJSONSchemaKind, type TKnownToolName, type TLoggerData, type TManagerToolParameters, type TMessageConverterRegistry, type TMessageFormatConverter, type TMessageState, type TMetadata, type TMetadataValue, TOOL_EVENTS, TOOL_EVENT_PREFIX, type TParameterDefaultValue, type TPermissionDecision, type TPermissionMode, type TPrimitiveValue, type TProviderConfigValue, type TProviderLoggingData, type TProviderMediaResult, type TProviderMessage, type TProviderOptionValueBase, type TProviderSetupField, TRUST_TO_MODE, type TResponseMetadata, type TSessionEndReason, type TTextDeltaCallback, type TTimerId, type TToolArgs, type TToolExecutionFunction, type TToolExecutionParameters, type TToolExecutor, type TToolMetadata, type TToolParameters, type TToolProgressCallback, type TTrustLevel, type TUniversalArrayValue, type TUniversalMessage, type TUniversalMessageMetadata, type TUniversalMessagePart, type TUniversalMessageRole, type TUniversalValue, type TUserEvent, type TUtilLogLevel, ToolExecutionError, TypeUtils, UNKNOWN_TOOL_FALLBACK, USER_EVENTS, USER_EVENT_PREFIX, ValidationError, ValidationSeverity, Validator, assertProviderNativeWebToolsAvailable, bindEventServiceOwner, bindWithOwnerPath, chatEntryToMessage, collectAssistantUsageMetadata, composeEventName, createAssistantMessage, createDefaultProviderCapabilities, createExecutionProxy, createLogger, createSystemMessage, createToolMessage, createUserMessage, evaluatePermission, findProviderDefinition, formatSupportedProviderTypes, formatTokenCount, getGlobalLogLevel, getMessagesForAPI, getModelContextWindow, getModelMaxOutput, getModelName, getProviderCapabilities, getToolEstimatedDuration, getToolExecutionSteps, isAssistantMessage, isChatEntry, isDefaultEventService, isImageGenerationProvider, isProgressReportingTool, isSystemMessage, isToolMessage, isUserMessage, isVideoGenerationProvider, logger, messageToHistoryEntry, runHooks, setGlobalLogLevel, setToolProgressCallback, startPeriodicTask, stopPeriodicTask, validateAgentConfig, validateApiKey, validateModelName, validateProviderName, validateUserInput, withEventEmission };
|