@robota-sdk/agent-core 3.0.0-beta.8 → 3.0.0-beta.81
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 +844 -0
- package/LICENSE +661 -21
- package/README.md +153 -26
- package/dist/browser/bounded-output-DpjpS98g.js +2 -0
- package/dist/browser/bounded-output-DpjpS98g.js.map +1 -0
- package/dist/browser/command-executor-cI7XJ374.js +2 -0
- package/dist/browser/command-executor-cI7XJ374.js.map +1 -0
- package/dist/browser/http-executor-CHy6UeBU.js +2 -0
- package/dist/browser/http-executor-CHy6UeBU.js.map +1 -0
- package/dist/browser/index.d.ts +6381 -3394
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/browser/index.js +13 -5
- package/dist/browser/index.js.map +1 -0
- package/dist/browser/verdict-decoder-Dk_w2NG9.js +2 -0
- package/dist/browser/verdict-decoder-Dk_w2NG9.js.map +1 -0
- package/dist/node/bounded-output-DpjpS98g.js +2 -0
- package/dist/node/bounded-output-DpjpS98g.js.map +1 -0
- package/dist/node/command-executor-Aat_q7P2.cjs +1 -0
- package/dist/node/command-executor-DV-H2oD6.js +2 -0
- package/dist/node/command-executor-DV-H2oD6.js.map +1 -0
- package/dist/node/http-executor-71JiIdFP.cjs +1 -0
- package/dist/node/http-executor-cWzI2svn.js +2 -0
- package/dist/node/http-executor-cWzI2svn.js.map +1 -0
- package/dist/node/index-CiFlpr7-.d.cts +6893 -0
- package/dist/node/index-CiFlpr7-.d.cts.map +1 -0
- package/dist/node/index-DFlMw376.d.ts +6893 -0
- package/dist/node/index-DFlMw376.d.ts.map +1 -0
- package/dist/node/index.cjs +12 -5
- package/dist/node/index.d.cts +3 -4238
- package/dist/node/index.d.ts +3 -4238
- package/dist/node/index.js +13 -5
- package/dist/node/index.js.map +1 -0
- package/dist/node/node.cjs +1 -0
- package/dist/node/node.d.cts +236 -0
- package/dist/node/node.d.cts.map +1 -0
- package/dist/node/node.d.ts +236 -0
- package/dist/node/node.d.ts.map +1 -0
- package/dist/node/node.js +2 -0
- package/dist/node/node.js.map +1 -0
- package/dist/node/project-tool-schema-DrDjGKnH.cjs +1 -0
- package/dist/node/project-tool-schema-_UKfY7yO.js +2 -0
- package/dist/node/project-tool-schema-_UKfY7yO.js.map +1 -0
- package/dist/node/rolldown-runtime-DK3Fl9T5.js +1 -0
- package/dist/node/rolldown-runtime-DWNI8pZO.cjs +1 -0
- package/dist/node/testing/index.cjs +1 -0
- package/dist/node/testing/index.d.cts +96 -0
- package/dist/node/testing/index.d.cts.map +1 -0
- package/dist/node/testing/index.d.ts +96 -0
- package/dist/node/testing/index.d.ts.map +1 -0
- package/dist/node/testing/index.js +2 -0
- package/dist/node/testing/index.js.map +1 -0
- package/dist/node/types-gNrckgFE.d.cts +335 -0
- package/dist/node/types-gNrckgFE.d.cts.map +1 -0
- package/dist/node/types-gNrckgFE.d.ts +335 -0
- package/dist/node/types-gNrckgFE.d.ts.map +1 -0
- package/dist/node/verdict-decoder-Dk_w2NG9.js +2 -0
- package/dist/node/verdict-decoder-Dk_w2NG9.js.map +1 -0
- package/dist/node/verdict-decoder-Estx9MtY.cjs +1 -0
- package/package.json +89 -23
- 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/browser/builtin-templates.json +0 -107
- 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/node/builtin-templates.json +0 -107
- 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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-gNrckgFE.d.ts","names":[],"sources":["../../src/interfaces/universal-value.ts","../../src/interfaces/model-effort-capability.ts","../../src/interfaces/trace-context.ts","../../src/hooks/types.ts"],"mappings":";;;;;;;;;;;;;;;;;KAiBY;KAEA,kBAAkB,kBAAkB,OAAO,uBAAuB;KAElE,uBAAuB;UAElB;GACd,cAAc;;;;;KCvBL;;cAGC;iBAUG,cAAc,OAAO,8BAA8B,SAAS;;KAKhE,wBAAwB;;UAGnB;EACf,2BAA2B;EAC3B,eAAe;;EAEf;;;UAIe;EACf;EACA;EACA,QAAQ,SAAS,eAAe;;KAGtB;;UAGK;EACf,WAAW;EACX,WAAW;EACX,aAAa;EACb;;;KAIU;WACG;WAAwB;;WACxB;WAA2B;;;KAG9B;WACC;;WAA6B;WAAkC;;;UAG3D;WACN,YAAY;WACZ,eAAe;WACf,kBAAkB;;;KAIjB,+BAA+B,SAAS;;iBAGpC,yBACd,YAAY,wBACZ,SAAS,KAAK,qCACb;;;;iBAkBa,mBACd,OAAO,uCACP,iBACA,WAAW,wBACV;;;;;;;;;;;;KCjFS;;UAGK;WACN;;;UAIM;;WAEN;;WAEA;;WAEA;;;;;WAKA,6BAA6B;;;;;;WAM7B,4BAA4B;;;UAItB;;WAEN;;WAEA;;;;;;;;;;;;;;;;;KCxBC;;KAmBA;;UAIK;EACf;EACA;EACA;;;UAIe;EACf;EACA;EACA,UAAU;EACV;;;UAIe;EACf;EACA;EACA;;;UAIe;EACf;EACA;EACA;EACA;;;;;;;;UASe;EACf;;EAEA;;;KAIU,kBACR,yBACA,sBACA,wBACA,uBACA;;;;;UAMa;EACf;;EAEA;;;;;;;KAQU,cAAc,OAAO,eAAe,mBAAmB,QAAQ;;UAG1D;;EAEf;EACA,OAAO;;EAEP,MAAM;;;KAII,eAAe,QAAQ,OAAO,YAAY;;UAGrC;EACf;EACA;EACA,iBAAiB;EACjB;EACA,aAAa;EACb;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA,SAAS;;EAET;;EAEA;;EAEA;;EAEA;;EAEA;;;;;EAKA;;;;;EAKA;;;;;EAKA,SAAS;;EAET;;;;;;;EAOA;;EAEA,MAAM;;;;;;;;;KAUI;;;;;;;;;;;;;;UAeK;WACN;;WAEA,QAAQ;WACR;;;UAIM;WACN;;WAEA,QAAQ;WACR;;;;;;;;UASM;WACN;;WAEA,QAAQ;WACR,MAAM;WACN;;;;;;;;;;;KAYC,eAAe,oBAAoB,mBAAmB;;UAGjD;;EAEf,MAAM;;EAEN,QAAQ,YAAY,iBAAiB,OAAO,aAAa,QAAQ"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e={deny:3,defer:2,ask:1,allow:0};function t(t){return typeof t==`string`&&t in e}function n(e){if(!(typeof e!=`object`||!e)&&`additionalContext`in e)return String(e.additionalContext)}function r(e,r){let a=i(e);if(a===null){let t=e.trim();return{context:t?[t]:[]}}if(a.continue===!1)return{context:[],blockReason:typeof a.stopReason==`string`?a.stopReason:`Blocked by hook (continue: false)`};let o=a.hookSpecificOutput,s=[];if(r===`UserPromptSubmit`){let e=n(o);if(a.decision===`block`)return{context:e?[e]:[],blockReason:`Blocked by hook (decision: block)`};e&&s.push(e)}let c,l;if(r===`PreToolUse`&&typeof o==`object`&&o){let e=o;if(t(e.permissionDecision)){if(c=e.permissionDecision,c===`deny`)return{context:[],blockReason:`Blocked by hook (permissionDecision: deny)`,permissionDecision:c};e.updatedInput!==void 0&&(l=e.updatedInput)}}return typeof a.systemMessage==`string`&&a.systemMessage&&s.push(a.systemMessage),{context:s,...c!==void 0&&{permissionDecision:c},...l!==void 0&&{updatedInput:l}}}function i(e){let t=e.trim();if(!t.startsWith(`{`))return null;try{return JSON.parse(t)}catch{return null}}function a(e,t){if(typeof e!=`object`||!e||Array.isArray(e))return null;let n=e;if(n.continue===!1)return typeof n.stopReason==`string`&&n.stopReason?n.stopReason:`Blocked by hook (continue: false)`;if(t===`UserPromptSubmit`&&n.decision===`block`)return typeof n.reason==`string`&&n.reason?n.reason:`Blocked by hook (decision: block)`;if(t===`PreToolUse`){let e=n.hookSpecificOutput;if(typeof e==`object`&&e&&e.permissionDecision===`deny`)return`Blocked by hook (permissionDecision: deny)`}return null}function o(e){let t=e.replace(/\s+/g,` `).trim();return t.length>200?`${t.slice(0,200)}…`:t}function s(e,t,n){let r;try{r=JSON.parse(e)}catch(n){return{outcome:`error`,source:t,kind:`malformed-response`,reason:`Hook response is not valid JSON (${n instanceof Error?n.message:String(n)}): ${o(e)}`}}return c(r,t,n,e)}function c(e,t,n,r){if(typeof e!=`object`||!e||Array.isArray(e))return{outcome:`error`,source:t,kind:`malformed-response`,reason:`Hook response is not a JSON object: ${o(r)}`};let{ok:i,reason:s}=e;if(i===!0)return{outcome:`allow`,source:t,stdout:r};if(i===!1)return{outcome:`deny`,source:t,reason:typeof s==`string`&&s?s:`Blocked by ${t} hook`};let c=a(e,n);return c===null?{outcome:`error`,source:t,kind:`malformed-response`,reason:i===void 0?`Hook response has no boolean "ok" field: ${o(r)}`:`Hook response "ok" is ${typeof i}, not boolean: ${o(r)}`}:{outcome:`deny`,source:t,reason:c}}export{e as n,r,s as t};
|
|
2
|
+
//# sourceMappingURL=verdict-decoder-Dk_w2NG9.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verdict-decoder-Dk_w2NG9.js","names":[],"sources":["../../src/hooks/response-protocol.ts","../../src/hooks/verdict-decoder.ts"],"sourcesContent":["/**\n * The Claude Code hook RESPONSE protocol: what an approving hook's stdout may say.\n *\n * This is a different contract from the outcome union in `types.ts`. The outcome says whether the\n * hook reached a verdict at all; this says what a response additionally requests — `continue: false`,\n * a `permissionDecision`, an `updatedInput`, injected context.\n *\n * `interpretAllowOutcome` is the whole interpretation of one approving body (issue #2191): what to\n * inject, whether it blocks, which `permissionDecision` it states and the `updatedInput` riding with\n * it. `runHooks` only loops and aggregates — priority across hooks and the result shape stay there.\n *\n * The two contracts are mostly independent, with ONE crossing point: `explicitBlockDirective` below. A body may\n * carry a directive that unambiguously means \"block\" while the `{ ok, reason }` verdict beside it is\n * undecodable, and that body HAS rendered a verdict — discarding it because a sibling field was\n * malformed would be fail-open in an enforcement gate, which is the defect SEC-015 exists to remove\n * rather than relocate.\n */\n\nimport type { THookEvent } from './types.js';\n\nexport type TPermissionDecision = 'allow' | 'deny' | 'ask' | 'defer';\n\n/** Permission decision priority: deny=3 > defer=2 > ask=1 > allow=0 */\nexport const PERMISSION_PRIORITY: Record<string, number> = { deny: 3, defer: 2, ask: 1, allow: 0 };\n\n/**\n * What one `allow` outcome's stdout asks of the runner — declarative, so the runner aggregates and\n * this module decides what a body MEANS.\n */\nexport interface IAllowInterpretation {\n /** Text to append to the collected stdout: raw output, injected context, a system message. */\n readonly context: readonly string[];\n /** Present when the body blocks. `context` is still appended before the runner returns. */\n readonly blockReason?: string;\n /** PreToolUse only: the decision the body states, when it is one the protocol names. */\n readonly permissionDecision?: TPermissionDecision;\n /** PreToolUse only: an input rewrite riding alongside a named `permissionDecision`. */\n readonly updatedInput?: Record<string, unknown>;\n}\n\nfunction isPermissionDecision(value: unknown): value is TPermissionDecision {\n return typeof value === 'string' && value in PERMISSION_PRIORITY;\n}\n\nfunction additionalContextOf(specific: unknown): string | undefined {\n if (specific === null || typeof specific !== 'object') return undefined;\n if (!('additionalContext' in specific)) return undefined;\n return String((specific as Record<string, unknown>)['additionalContext']);\n}\n\n/** Decode one approving hook's stdout per the protocol (Claude Code compatible) for `event`. */\nexport function interpretAllowOutcome(stdout: string, event: THookEvent): IAllowInterpretation {\n const json = parseHookJson(stdout);\n if (json === null) {\n // Raw text stdout (non-JSON)\n const raw = stdout.trim();\n return { context: raw ? [raw] : [] };\n }\n // Common: continue: false → block\n if (json['continue'] === false) {\n return {\n context: [],\n blockReason:\n typeof json['stopReason'] === 'string'\n ? json['stopReason']\n : 'Blocked by hook (continue: false)',\n };\n }\n const specific = json['hookSpecificOutput'];\n const context: string[] = [];\n if (event === 'UserPromptSubmit') {\n const additional = additionalContextOf(specific);\n // decision: \"block\" → block, carrying the context the hook attached\n if (json['decision'] === 'block') {\n return {\n context: additional ? [additional] : [],\n blockReason: 'Blocked by hook (decision: block)',\n };\n }\n // additionalContext without block → inject into stdout\n if (additional) context.push(additional);\n }\n let permissionDecision: TPermissionDecision | undefined;\n let updatedInput: Record<string, unknown> | undefined;\n if (event === 'PreToolUse' && specific !== null && typeof specific === 'object') {\n const record = specific as Record<string, unknown>;\n if (isPermissionDecision(record['permissionDecision'])) {\n permissionDecision = record['permissionDecision'];\n // deny → immediate block; nothing else in the body is read\n if (permissionDecision === 'deny') {\n return {\n context: [],\n blockReason: 'Blocked by hook (permissionDecision: deny)',\n permissionDecision,\n };\n }\n if (record['updatedInput'] !== undefined) {\n updatedInput = record['updatedInput'] as Record<string, unknown>;\n }\n }\n }\n // systemMessage → inject into stdout for AI context\n if (typeof json['systemMessage'] === 'string' && json['systemMessage']) {\n context.push(json['systemMessage']);\n }\n return {\n context,\n ...(permissionDecision !== undefined && { permissionDecision }),\n ...(updatedInput !== undefined && { updatedInput }),\n };\n}\n\n/** Parse hook stdout as JSON if it starts with '{', otherwise return null. */\nfunction parseHookJson(stdout: string): Record<string, unknown> | null {\n const trimmed = stdout.trim();\n if (!trimmed.startsWith('{')) return null;\n try {\n return JSON.parse(trimmed) as Record<string, unknown>;\n } catch {\n // allow-fallback: hook stdout may be plain text; malformed JSON means raw stdout\n return null;\n }\n}\n\n/**\n * The reason an explicitly-blocking response gives, or `null` when the body requests no block ON\n * THIS EVENT.\n *\n * These three directives are the vocabulary `HOOK-CATALOG.md` names as blocking triggers, and each\n * is a decision the hook stated outright — unlike `ok`, which can be malformed into meaning nothing.\n * A body carrying one has spoken, whatever else in it did not decode.\n *\n * Scoped by event exactly as `runHooks` scopes them (issue #2196): `continue: false` blocks on every\n * event; `decision: \"block\"` is the `UserPromptSubmit` vocabulary; `permissionDecision: \"deny\"` is\n * the `PreToolUse` vocabulary. The decoder used to read all three on any event, so a body like\n * `{\"ok\": \"maybe\", \"decision\": \"block\"}` denied a tool call the runner would not have blocked — one\n * vocabulary, two sets of rules. Now there is one set.\n */\nexport function explicitBlockDirective(body: unknown, event: THookEvent): string | null {\n if (typeof body !== 'object' || body === null || Array.isArray(body)) return null;\n const record = body as Record<string, unknown>;\n\n if (record['continue'] === false) {\n return typeof record['stopReason'] === 'string' && record['stopReason']\n ? record['stopReason']\n : 'Blocked by hook (continue: false)';\n }\n if (event === 'UserPromptSubmit' && record['decision'] === 'block') {\n return typeof record['reason'] === 'string' && record['reason']\n ? record['reason']\n : 'Blocked by hook (decision: block)';\n }\n if (event === 'PreToolUse') {\n const specific = record['hookSpecificOutput'];\n if (typeof specific === 'object' && specific !== null) {\n if ((specific as Record<string, unknown>)['permissionDecision'] === 'deny') {\n return 'Blocked by hook (permissionDecision: deny)';\n }\n }\n }\n return null;\n}\n","/**\n * SEC-015 — the one decoder for a `{ ok, reason }` hook verdict.\n *\n * The HTTP, prompt, and agent executors all receive a hook's answer as this shape, and all three\n * decoded it the same wrong way: `(body as { ok: boolean }).ok` followed by a truthiness test. That\n * is not a decode, it is a coercion, and it fails in both directions — `{\"ok\": \"false\"}` is truthy\n * so the gate was disabled, while `{}` and `{\"ok\": null}` are falsy so a tool call was blocked by a\n * verdict no endpoint issued.\n *\n * `ok` must therefore be EXACTLY `true` or EXACTLY `false`. Everything else is the absence of a\n * verdict, not a quiet vote for one — UNLESS the same body carries an explicit block directive from\n * the Claude Code response protocol (`continue: false`, `decision: \"block\"`,\n * `permissionDecision: \"deny\"`), which is a decision the hook stated outright and which an\n * undecodable `ok` beside it does not retract — read with the same per-event scoping `runHooks`\n * applies (issue #2196), so decoder and runner cannot disagree about when a directive means anything.\n */\n\nimport { explicitBlockDirective } from './response-protocol.js';\n\nimport type { THookDefinition, THookEvent, THookOutcome } from './types.js';\n\n/** How much of an undecodable payload to quote back. Enough to identify it, not enough to flood a log. */\nconst REASON_EXCERPT_LIMIT = 200;\n\n/** A one-line, length-capped rendering of whatever arrived, for the `error` reason. */\nfunction excerpt(raw: string): string {\n const collapsed = raw.replace(/\\s+/g, ' ').trim();\n return collapsed.length > REASON_EXCERPT_LIMIT\n ? `${collapsed.slice(0, REASON_EXCERPT_LIMIT)}…`\n : collapsed;\n}\n\n/**\n * Decode a hook's RAW response text into an outcome — parsing included.\n *\n * Parsing lives here rather than at each call site because it was the same three lines in the HTTP,\n * prompt and agent executors, which is the shape this module exists to collapse. A body that is not\n * JSON and a body whose `ok` is not a boolean are both \"no verdict could be read\", and both quote\n * the payload back the same way.\n *\n * @param raw - The response text as it arrived.\n * @param source - The executor doing the decoding, carried onto the outcome for diagnostics.\n * @param event - The event the hook answered, which decides WHICH block directives count\n * (issue #2196): the decoder scopes them exactly as `runHooks` does.\n */\nexport function decodeHookVerdict(\n raw: string,\n source: THookDefinition['type'],\n event: THookEvent,\n): THookOutcome {\n let body: unknown;\n try {\n body = JSON.parse(raw) as unknown;\n } catch (err: unknown) {\n return {\n outcome: 'error',\n source,\n kind: 'malformed-response',\n reason: `Hook response is not valid JSON (${err instanceof Error ? err.message : String(err)}): ${excerpt(raw)}`,\n };\n }\n return decodeParsedVerdict(body, source, event, raw);\n}\n\n/** The decode proper, once the text is known to be JSON. Separated only so each half stays readable. */\nfunction decodeParsedVerdict(\n body: unknown,\n source: THookDefinition['type'],\n event: THookEvent,\n raw: string,\n): THookOutcome {\n if (typeof body !== 'object' || body === null || Array.isArray(body)) {\n return {\n outcome: 'error',\n source,\n kind: 'malformed-response',\n reason: `Hook response is not a JSON object: ${excerpt(raw)}`,\n };\n }\n\n const { ok, reason } = body as { ok?: unknown; reason?: unknown };\n\n if (ok === true) {\n return { outcome: 'allow', source, stdout: raw };\n }\n\n if (ok === false) {\n return {\n outcome: 'deny',\n source,\n reason: typeof reason === 'string' && reason ? reason : `Blocked by ${source} hook`,\n };\n }\n\n // Neither boolean, so the `{ ok }` verdict is undecodable. Before calling that \"no verdict\", ask\n // whether the SAME body carries an explicit block directive — `continue: false`,\n // `decision: \"block\"`, `permissionDecision: \"deny\"`. Those are unambiguous statements the hook\n // made outright, and an endpoint that wrote `{\"ok\": \"false\", \"continue\": false}` plainly meant to\n // block. Discarding that because `ok` was a string would be fail-open in an enforcement gate: the\n // same class of defect as reading the string as approval, pointed the other way. Which of the\n // three count is the event's call — the same scoping `runHooks` applies (issue #2196).\n const directive = explicitBlockDirective(body, event);\n if (directive !== null) {\n return { outcome: 'deny', source, reason: directive };\n }\n\n // Nothing in the body decided anything. Deliberately NOT folded into either verdict.\n return {\n outcome: 'error',\n source,\n kind: 'malformed-response',\n reason:\n ok === undefined\n ? `Hook response has no boolean \"ok\" field: ${excerpt(raw)}`\n : `Hook response \"ok\" is ${typeof ok}, not boolean: ${excerpt(raw)}`,\n };\n}\n"],"mappings":"AAuBA,MAAa,EAA8C,CAAE,KAAM,EAAG,MAAO,EAAG,IAAK,EAAG,MAAO,CAAE,EAiBjG,SAAS,EAAqB,EAA8C,CAC1E,OAAO,OAAO,GAAU,UAAY,KAAS,CAC/C,CAEA,SAAS,EAAoB,EAAuC,CAC9D,KAAqB,OAAO,GAAa,WAAzC,IACE,sBAAuB,EAC7B,OAAO,OAAQ,EAAqC,iBAAoB,CAC1E,CAGA,SAAgB,EAAsB,EAAgB,EAAyC,CAC7F,IAAM,EAAO,EAAc,CAAM,EACjC,GAAI,IAAS,KAAM,CAEjB,IAAM,EAAM,EAAO,KAAK,EACxB,MAAO,CAAE,QAAS,EAAM,CAAC,CAAG,EAAI,CAAC,CAAE,CACrC,CAEA,GAAI,EAAK,WAAgB,GACvB,MAAO,CACL,QAAS,CAAC,EACV,YACE,OAAO,EAAK,YAAkB,SAC1B,EAAK,WACL,mCACR,EAEF,IAAM,EAAW,EAAK,mBAChB,EAAoB,CAAC,EAC3B,GAAI,IAAU,mBAAoB,CAChC,IAAM,EAAa,EAAoB,CAAQ,EAE/C,GAAI,EAAK,WAAgB,QACvB,MAAO,CACL,QAAS,EAAa,CAAC,CAAU,EAAI,CAAC,EACtC,YAAa,mCACf,EAGE,GAAY,EAAQ,KAAK,CAAU,CACzC,CACA,IAAI,EACA,EACJ,GAAI,IAAU,cAAqC,OAAO,GAAa,UAAzC,EAAmD,CAC/E,IAAM,EAAS,EACf,GAAI,EAAqB,EAAO,kBAAqB,EAAG,CAGtD,GAFA,EAAqB,EAAO,mBAExB,IAAuB,OACzB,MAAO,CACL,QAAS,CAAC,EACV,YAAa,6CACb,oBACF,EAEE,EAAO,eAAoB,IAAA,KAC7B,EAAe,EAAO,aAE1B,CACF,CAKA,OAHI,OAAO,EAAK,eAAqB,UAAY,EAAK,eACpD,EAAQ,KAAK,EAAK,aAAgB,EAE7B,CACL,UACA,GAAI,IAAuB,IAAA,IAAa,CAAE,oBAAmB,EAC7D,GAAI,IAAiB,IAAA,IAAa,CAAE,cAAa,CACnD,CACF,CAGA,SAAS,EAAc,EAAgD,CACrE,IAAM,EAAU,EAAO,KAAK,EAC5B,GAAI,CAAC,EAAQ,WAAW,GAAG,EAAG,OAAO,KACrC,GAAI,CACF,OAAO,KAAK,MAAM,CAAO,CAC3B,MAAQ,CAEN,OAAO,IACT,CACF,CAgBA,SAAgB,EAAuB,EAAe,EAAkC,CACtF,GAAI,OAAO,GAAS,WAAY,GAAiB,MAAM,QAAQ,CAAI,EAAG,OAAO,KAC7E,IAAM,EAAS,EAEf,GAAI,EAAO,WAAgB,GACzB,OAAO,OAAO,EAAO,YAAkB,UAAY,EAAO,WACtD,EAAO,WACP,oCAEN,GAAI,IAAU,oBAAsB,EAAO,WAAgB,QACzD,OAAO,OAAO,EAAO,QAAc,UAAY,EAAO,OAClD,EAAO,OACP,oCAEN,GAAI,IAAU,aAAc,CAC1B,IAAM,EAAW,EAAO,mBACxB,GAAI,OAAO,GAAa,UAAY,GAC7B,EAAqC,qBAA0B,OAClE,MAAO,4CAGb,CACA,OAAO,IACT,CCxIA,SAAS,EAAQ,EAAqB,CACpC,IAAM,EAAY,EAAI,QAAQ,OAAQ,GAAG,CAAC,CAAC,KAAK,EAChD,OAAO,EAAU,OAAS,IACtB,GAAG,EAAU,MAAM,EAAG,GAAoB,EAAE,GAC5C,CACN,CAeA,SAAgB,EACd,EACA,EACA,EACc,CACd,IAAI,EACJ,GAAI,CACF,EAAO,KAAK,MAAM,CAAG,CACvB,OAAS,EAAc,CACrB,MAAO,CACL,QAAS,QACT,SACA,KAAM,qBACN,OAAQ,oCAAoC,aAAe,MAAQ,EAAI,QAAU,OAAO,CAAG,EAAE,KAAK,EAAQ,CAAG,GAC/G,CACF,CACA,OAAO,EAAoB,EAAM,EAAQ,EAAO,CAAG,CACrD,CAGA,SAAS,EACP,EACA,EACA,EACA,EACc,CACd,GAAI,OAAO,GAAS,WAAY,GAAiB,MAAM,QAAQ,CAAI,EACjE,MAAO,CACL,QAAS,QACT,SACA,KAAM,qBACN,OAAQ,uCAAuC,EAAQ,CAAG,GAC5D,EAGF,GAAM,CAAE,KAAI,UAAW,EAEvB,GAAI,IAAO,GACT,MAAO,CAAE,QAAS,QAAS,SAAQ,OAAQ,CAAI,EAGjD,GAAI,IAAO,GACT,MAAO,CACL,QAAS,OACT,SACA,OAAQ,OAAO,GAAW,UAAY,EAAS,EAAS,cAAc,EAAO,MAC/E,EAUF,IAAM,EAAY,EAAuB,EAAM,CAAK,EAMpD,OALI,IAAc,KAKX,CACL,QAAS,QACT,SACA,KAAM,qBACN,OACE,IAAO,IAAA,GACH,4CAA4C,EAAQ,CAAG,IACvD,yBAAyB,OAAO,EAAG,iBAAiB,EAAQ,CAAG,GACvE,EAZS,CAAE,QAAS,OAAQ,SAAQ,OAAQ,CAAU,CAaxD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=class extends Error{context;constructor(e,t){super(e),this.context=t,this.name=this.constructor.name,Object.setPrototypeOf(this,new.target.prototype)}},t=class extends e{code=`CONFIGURATION_ERROR`;category=`user`;recoverable=!1;constructor(e,t){super(`Configuration Error: ${e}`,t)}},n=class extends e{field;code=`VALIDATION_ERROR`;category=`user`;recoverable=!1;constructor(e,t,n){super(`Validation Error: ${e}`,n),this.field=t}},r=class extends e{issues;attempts;code=`STRUCTURED_OUTPUT_ERROR`;category=`provider`;recoverable=!0;constructor(e,t,n,r){super(`Structured Output Error: ${e}`,r),this.issues=t,this.attempts=n}},i=class extends e{provider;originalError;code=`PROVIDER_ERROR`;category=`provider`;recoverable=!0;status;type;constructor(e,t,n,r,i){super(`Provider Error (${t}): ${e}`,r),this.provider=t,this.originalError=n,i?.status!==void 0&&(this.status=i.status),i?.type!==void 0&&(this.type=i.type)}},a=class extends e{provider;code=`AUTHENTICATION_ERROR`;category=`user`;recoverable=!1;constructor(e,t,n){super(`Authentication Error: ${e}`,n),this.provider=t}},o=class extends e{retryAfter;provider;code=`RATE_LIMIT_ERROR`;category=`provider`;recoverable=!0;constructor(e,t,n,r){super(`Rate Limit Error: ${e}`,r),this.retryAfter=t,this.provider=n}},s=class extends e{originalError;code=`NETWORK_ERROR`;category=`system`;recoverable=!0;constructor(e,t,n){super(`Network Error: ${e}`,n),this.originalError=t}},c=class extends e{toolName;originalError;code=`TOOL_EXECUTION_ERROR`;category=`system`;recoverable=!1;constructor(e,t,n,r){super(`Tool Execution Error (${t}): ${e}`,r),this.toolName=t,this.originalError=n}},l=class extends e{toolName;callCount;maxSameToolInputs;code=`SAME_TOOL_INPUT_LOOP`;category=`system`;recoverable=!0;constructor(e,t,n,r){super(`Tool "${e}" was called with identical input ${t} times, past the maxSameToolInputs limit of ${n} — stopping the turn to break the loop`,r),this.toolName=e,this.callCount=t,this.maxSameToolInputs=n}},u=class extends e{availableModels;code=`MODEL_NOT_AVAILABLE`;category=`user`;recoverable=!1;constructor(e,t,n,r){super(`Model "${e}" is not available for provider "${t}"`,r),this.availableModels=n}},d=class extends e{code=`CIRCUIT_BREAKER_OPEN`;category=`system`;recoverable=!0;constructor(e=`Circuit breaker is open`,t){super(e,t)}},f=class extends e{pluginName;code=`PLUGIN_ERROR`;category=`system`;recoverable=!1;constructor(e,t,n){super(`Plugin Error (${t}): ${e}`,n),this.pluginName=t}},p=class extends e{code=`STORAGE_ERROR`;category=`system`;recoverable=!0;constructor(e,t){super(`Storage Error: ${e}`,t)}},m=class extends e{code=`CACHE_INTEGRITY_ERROR`;category=`system`;recoverable=!1;constructor(e,t){super(`Cache Integrity Error: ${e}`,t)}},h=class extends e{executable;code=`UNSUPPORTED_SHELL`;category=`user`;recoverable=!1;constructor(e){super(`Unsupported shell executable: ${e}`,{executable:e}),this.executable=e}};function g(e){return e===`darwin`?'Host OS: macOS (POSIX, BSD userland). Use BSD-flavored utilities: `sed -i ""` needs an empty backup arg, `date`/`grep`/`stat` flags differ from GNU. Prefer portable POSIX flags; avoid Linux/GNU-only options.':e===`linux`?"Host OS: Linux (POSIX, usually GNU coreutils, but distro/user setup varies). Prefer portable POSIX flags; do not assume a specific distro, and probe with `command -v` before relying on a non-standard tool.":`Host OS: ${e}; active shell family: POSIX sh/bash. Write portable POSIX syntax and avoid host-specific flags.`}function _(e,t){let n=b(e)===`bash`?`bash`:`sh`;return{command:e,kind:n,platform:t,commandArgs:e=>[`-c`,e],interactiveArgs:[],label:`${n} on ${t}`,syntaxHint:g(t)}}function v(e,t){return{command:e,kind:`powershell`,platform:t,commandArgs:e=>[`-NoProfile`,`-Command`,e],interactiveArgs:[`-NoProfile`],label:`PowerShell on ${t}`,syntaxHint:`Host OS: ${t}; active shell family: PowerShell. Write PowerShell syntax (not bash): e.g. \`Get-ChildItem\` not \`ls -la\`, \`\$env:VAR\` not \`\$VAR\`.`}}function y(e,t){return{command:e,kind:`cmd`,platform:t,commandArgs:e=>[`/d`,`/s`,`/c`,e],interactiveArgs:[],label:`cmd.exe on ${t}`,syntaxHint:`Host OS: ${t}; active shell family: Windows cmd.exe. Write cmd.exe syntax.`}}function b(e){return(e.split(/[\\/]/).at(-1)?.toLowerCase()??``).replace(/\.exe$/i,``)}function x(e,t){switch(b(e)){case`sh`:case`bash`:return _(e,t);case`powershell`:case`pwsh`:return v(e,t);case`cmd`:return y(e,t);default:throw new h(e)}}function S(e){let t=e?.trim();return t===void 0||t.length===0?void 0:t}function C(e={}){let t=e.env??process.env,n=e.platform??process.platform,r=S(e.executable);return r===void 0?n===`win32`?v(`powershell.exe`,n):_(S(t.SHELL)??`/bin/sh`,n):x(r,n)}const w=/^(?!0{32}$)[0-9a-f]{32}$/,T=/^(?!0{16}$)[0-9a-f]{16}$/;function E(e){return e.replaceAll(`-`,``).slice(0,16)}const D=E;function O(e){return T.test(e)}function k(e,t){if(!(!w.test(e)||!T.test(t)))return`00-${e}-${t}-01`}function A(e,t){if(e.allowedOrigins.length===0)return;let n=k(e.traceId,E(t));if(n!==void 0)return{traceparent:n,allowedOrigins:[...e.allowedOrigins]}}function j(e,t){return A(e,t)}function M(e,t,n){if(t?.subprocessClasses?.includes(e)!==!0)return;let r=k(t.traceId,n);return r===void 0?void 0:{TRACEPARENT:r}}function N(e,t,n={}){if(t===void 0||n.TRACEPARENT!==void 0)return{...e,...n};let{TRACESTATE:r,...i}=e;return{...i,...t,...n}}function P(e,t){if(e===void 0||t===void 0)return{};let n;try{n=new URL(e).origin}catch{return{}}return n===`null`||!t.allowedOrigins.includes(n)?{}:{traceparent:t.traceparent}}const F=e=>`\n…[output truncated: ${e} byte(s) dropped]`;function I(e){let t=e.retain??`head`,n=e.truncationMarker??F,r=Math.max(0,Math.floor(e.maxBytes)),i=new TextEncoder,a=[],o=0,s=0,c=e=>{let t=r-o;if(t<=0)return;let n=e.byteLength<=t?e:e.subarray(0,t);a.push(n),o+=n.byteLength},l=e=>{let t=e.byteLength<=r?e:e.subarray(e.byteLength-r);for(a.push(t),o+=t.byteLength;o>r&&a.length>0;){let e=a[0],t=o-r;e.byteLength<=t?(a.shift(),o-=e.byteLength):(a[0]=e.subarray(t),o-=t)}};return{append(e){let n=typeof e==`string`?i.encode(e):e;s+=n.byteLength,t===`head`?c(n):l(n)},get retainedBytes(){return o},get totalBytes(){return s},get droppedBytes(){return s-o},get truncated(){return s>o},toString(){let e=new Uint8Array(o),r=0;for(let t of a)e.set(t,r),r+=t.byteLength;a=a.length>1?[e]:a;let i=new TextDecoder().decode(e);if(s<=o)return i;let c=n(s-o);return t===`head`?`${i}${c}`:`${c.replace(/^\n/,``)}\n${i}`}}}const L={deny:3,defer:2,ask:1,allow:0};function R(e){return typeof e==`string`&&e in L}function z(e){if(!(typeof e!=`object`||!e)&&`additionalContext`in e)return String(e.additionalContext)}function B(e,t){let n=V(e);if(n===null){let t=e.trim();return{context:t?[t]:[]}}if(n.continue===!1)return{context:[],blockReason:typeof n.stopReason==`string`?n.stopReason:`Blocked by hook (continue: false)`};let r=n.hookSpecificOutput,i=[];if(t===`UserPromptSubmit`){let e=z(r);if(n.decision===`block`)return{context:e?[e]:[],blockReason:`Blocked by hook (decision: block)`};e&&i.push(e)}let a,o;if(t===`PreToolUse`&&typeof r==`object`&&r){let e=r;if(R(e.permissionDecision)){if(a=e.permissionDecision,a===`deny`)return{context:[],blockReason:`Blocked by hook (permissionDecision: deny)`,permissionDecision:a};e.updatedInput!==void 0&&(o=e.updatedInput)}}return typeof n.systemMessage==`string`&&n.systemMessage&&i.push(n.systemMessage),{context:i,...a!==void 0&&{permissionDecision:a},...o!==void 0&&{updatedInput:o}}}function V(e){let t=e.trim();if(!t.startsWith(`{`))return null;try{return JSON.parse(t)}catch{return null}}function H(e,t){if(typeof e!=`object`||!e||Array.isArray(e))return null;let n=e;if(n.continue===!1)return typeof n.stopReason==`string`&&n.stopReason?n.stopReason:`Blocked by hook (continue: false)`;if(t===`UserPromptSubmit`&&n.decision===`block`)return typeof n.reason==`string`&&n.reason?n.reason:`Blocked by hook (decision: block)`;if(t===`PreToolUse`){let e=n.hookSpecificOutput;if(typeof e==`object`&&e&&e.permissionDecision===`deny`)return`Blocked by hook (permissionDecision: deny)`}return null}function U(e){let t=e.replace(/\s+/g,` `).trim();return t.length>200?`${t.slice(0,200)}…`:t}function W(e,t,n){let r;try{r=JSON.parse(e)}catch(n){return{outcome:`error`,source:t,kind:`malformed-response`,reason:`Hook response is not valid JSON (${n instanceof Error?n.message:String(n)}): ${U(e)}`}}return G(r,t,n,e)}function G(e,t,n,r){if(typeof e!=`object`||!e||Array.isArray(e))return{outcome:`error`,source:t,kind:`malformed-response`,reason:`Hook response is not a JSON object: ${U(r)}`};let{ok:i,reason:a}=e;if(i===!0)return{outcome:`allow`,source:t,stdout:r};if(i===!1)return{outcome:`deny`,source:t,reason:typeof a==`string`&&a?a:`Blocked by ${t} hook`};let o=H(e,n);return o===null?{outcome:`error`,source:t,kind:`malformed-response`,reason:i===void 0?`Hook response has no boolean "ok" field: ${U(r)}`:`Hook response "ok" is ${typeof i}, not boolean: ${U(r)}`}:{outcome:`deny`,source:t,reason:o}}Object.defineProperty(exports,"A",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"D",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"E",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"O",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"T",{enumerable:!0,get:function(){return e}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return I}}),Object.defineProperty(exports,"k",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return P}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return B}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return W}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return N}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"w",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return t}});
|
package/package.json
CHANGED
|
@@ -1,24 +1,85 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@robota-sdk/agent-core",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.81",
|
|
4
4
|
"description": "Complete AI agent implementation with unified core and tools functionality - conversation management, plugin system, and advanced agent features",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/node/index.js",
|
|
7
|
-
"module": "dist/node/index.mjs",
|
|
8
7
|
"types": "dist/node/index.d.ts",
|
|
9
8
|
"exports": {
|
|
10
9
|
".": {
|
|
11
|
-
"
|
|
10
|
+
"source": "./src/index.ts",
|
|
12
11
|
"node": {
|
|
13
|
-
"import":
|
|
14
|
-
|
|
12
|
+
"import": {
|
|
13
|
+
"types": "./dist/node/index.d.ts",
|
|
14
|
+
"default": "./dist/node/index.js"
|
|
15
|
+
},
|
|
16
|
+
"require": {
|
|
17
|
+
"types": "./dist/node/index.d.cts",
|
|
18
|
+
"default": "./dist/node/index.cjs"
|
|
19
|
+
}
|
|
15
20
|
},
|
|
16
21
|
"browser": {
|
|
17
|
-
"import":
|
|
22
|
+
"import": {
|
|
23
|
+
"types": "./dist/browser/index.d.ts",
|
|
24
|
+
"default": "./dist/browser/index.js"
|
|
25
|
+
}
|
|
18
26
|
},
|
|
19
27
|
"default": {
|
|
20
|
-
"import":
|
|
21
|
-
|
|
28
|
+
"import": {
|
|
29
|
+
"types": "./dist/node/index.d.ts",
|
|
30
|
+
"default": "./dist/node/index.js"
|
|
31
|
+
},
|
|
32
|
+
"require": {
|
|
33
|
+
"types": "./dist/node/index.d.cts",
|
|
34
|
+
"default": "./dist/node/index.cjs"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"./node": {
|
|
39
|
+
"source": "./src/node.ts",
|
|
40
|
+
"node": {
|
|
41
|
+
"import": {
|
|
42
|
+
"types": "./dist/node/node.d.ts",
|
|
43
|
+
"default": "./dist/node/node.js"
|
|
44
|
+
},
|
|
45
|
+
"require": {
|
|
46
|
+
"types": "./dist/node/node.d.cts",
|
|
47
|
+
"default": "./dist/node/node.cjs"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"browser": null,
|
|
51
|
+
"default": {
|
|
52
|
+
"import": {
|
|
53
|
+
"types": "./dist/node/node.d.ts",
|
|
54
|
+
"default": "./dist/node/node.js"
|
|
55
|
+
},
|
|
56
|
+
"require": {
|
|
57
|
+
"types": "./dist/node/node.d.cts",
|
|
58
|
+
"default": "./dist/node/node.cjs"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"./testing": {
|
|
63
|
+
"source": "./src/testing/index.ts",
|
|
64
|
+
"node": {
|
|
65
|
+
"import": {
|
|
66
|
+
"types": "./dist/node/testing/index.d.ts",
|
|
67
|
+
"default": "./dist/node/testing/index.js"
|
|
68
|
+
},
|
|
69
|
+
"require": {
|
|
70
|
+
"types": "./dist/node/testing/index.d.cts",
|
|
71
|
+
"default": "./dist/node/testing/index.cjs"
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
"default": {
|
|
75
|
+
"import": {
|
|
76
|
+
"types": "./dist/node/testing/index.d.ts",
|
|
77
|
+
"default": "./dist/node/testing/index.js"
|
|
78
|
+
},
|
|
79
|
+
"require": {
|
|
80
|
+
"types": "./dist/node/testing/index.d.cts",
|
|
81
|
+
"default": "./dist/node/testing/index.cjs"
|
|
82
|
+
}
|
|
22
83
|
}
|
|
23
84
|
}
|
|
24
85
|
},
|
|
@@ -66,36 +127,41 @@
|
|
|
66
127
|
"complete-agent"
|
|
67
128
|
],
|
|
68
129
|
"author": "Robota SDK Team",
|
|
69
|
-
"license": "
|
|
130
|
+
"license": "AGPL-3.0-only OR LicenseRef-Commercial",
|
|
70
131
|
"dependencies": {
|
|
71
|
-
"jssha": "^3.3.
|
|
72
|
-
"zod": "^3.
|
|
132
|
+
"jssha": "^3.3.2",
|
|
133
|
+
"zod": "^3.25.76"
|
|
73
134
|
},
|
|
74
135
|
"devDependencies": {
|
|
75
136
|
"@types/swagger-schema-official": "^2.0.25",
|
|
76
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
77
|
-
"@typescript-eslint/parser": "^
|
|
78
|
-
"@vitest/coverage-v8": "^
|
|
79
|
-
"eslint": "^8.
|
|
137
|
+
"@typescript-eslint/eslint-plugin": "^7.0.0",
|
|
138
|
+
"@typescript-eslint/parser": "^7.0.0",
|
|
139
|
+
"@vitest/coverage-v8": "^3.2.6",
|
|
140
|
+
"eslint": "^8.57.1",
|
|
80
141
|
"openapi-types": "^12.1.3",
|
|
81
|
-
"rimraf": "^5.0.
|
|
82
|
-
"
|
|
83
|
-
"typescript": "^
|
|
84
|
-
"vitest": "^
|
|
142
|
+
"rimraf": "^5.0.10",
|
|
143
|
+
"tsdown": "^0.22.14",
|
|
144
|
+
"typescript": "^6.0.3",
|
|
145
|
+
"vitest": "^3.2.6"
|
|
85
146
|
},
|
|
86
147
|
"publishConfig": {
|
|
87
148
|
"access": "public"
|
|
88
149
|
},
|
|
150
|
+
"volta": {
|
|
151
|
+
"extends": "../../package.json"
|
|
152
|
+
},
|
|
89
153
|
"scripts": {
|
|
90
|
-
"build": "
|
|
91
|
-
"
|
|
154
|
+
"build": "rimraf dist && tsdown",
|
|
155
|
+
"build:js": "pnpm run build",
|
|
156
|
+
"build:types": "pnpm run build",
|
|
157
|
+
"dev": "tsdown --watch",
|
|
92
158
|
"clean": "rimraf dist",
|
|
93
159
|
"test": "vitest run --passWithNoTests",
|
|
94
160
|
"test:watch": "vitest",
|
|
95
161
|
"test:coverage": "vitest run --coverage",
|
|
96
162
|
"lint": "eslint src --ext .ts,.tsx",
|
|
163
|
+
"typecheck": "tsgo -p tsconfig.json --noEmit && tsgo -p tsconfig.examples.json --noEmit",
|
|
97
164
|
"lint:fix": "eslint src --ext .ts,.tsx --fix",
|
|
98
|
-
"scenario:verify": "pnpm exec tsx examples/verify-offline.ts"
|
|
99
|
-
"scenario:record": "node ../../scripts/harness/record-owner-scenario.mjs --scope packages/agents --output examples/scenarios/offline-verify.record.json -- pnpm scenario:verify"
|
|
165
|
+
"scenario:verify": "pnpm exec tsx examples/verify-offline.ts"
|
|
100
166
|
}
|
|
101
167
|
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Abstract Agent Base Class
|
|
3
|
-
*
|
|
4
|
-
* 🎯 ABSTRACT CLASS - DO NOT DEPEND ON CONCRETE IMPLEMENTATIONS
|
|
5
|
-
*
|
|
6
|
-
* This class defines the foundational lifecycle for agent implementations.
|
|
7
|
-
* Subclasses provide provider/tool-specific behavior while inheriting the
|
|
8
|
-
* shared guarantees around initialization, history, and disposal.
|
|
9
|
-
*/
|
|
10
|
-
import type { IAgent, IAgentConfig, TUniversalMessage, IRunOptions } from '../interfaces/agent';
|
|
11
|
-
export declare abstract class AbstractAgent<TConfig = IAgentConfig, TContext = IRunOptions, TMessage = TUniversalMessage> implements IAgent<TConfig, TContext, TMessage> {
|
|
12
|
-
protected history: TMessage[];
|
|
13
|
-
protected isInitialized: boolean;
|
|
14
|
-
protected config?: TConfig;
|
|
15
|
-
/**
|
|
16
|
-
* Initialize the agent (subclass responsibility)
|
|
17
|
-
*/
|
|
18
|
-
protected abstract initialize(): Promise<void>;
|
|
19
|
-
/**
|
|
20
|
-
* Configure the agent with type-safe configuration
|
|
21
|
-
*/
|
|
22
|
-
configure(config: TConfig): Promise<void>;
|
|
23
|
-
/**
|
|
24
|
-
* Run agent with user input and type-safe context
|
|
25
|
-
*/
|
|
26
|
-
abstract run(input: string, context?: TContext): Promise<string>;
|
|
27
|
-
/**
|
|
28
|
-
* Run agent with streaming response and type-safe context
|
|
29
|
-
*/
|
|
30
|
-
abstract runStream(input: string, context?: TContext): AsyncGenerator<string, void, never>;
|
|
31
|
-
/**
|
|
32
|
-
* Get conversation history with type-safe messages
|
|
33
|
-
*/
|
|
34
|
-
getHistory(): TMessage[];
|
|
35
|
-
/**
|
|
36
|
-
* Clear conversation history
|
|
37
|
-
*/
|
|
38
|
-
clearHistory(): void;
|
|
39
|
-
/**
|
|
40
|
-
* Add message to history
|
|
41
|
-
*/
|
|
42
|
-
protected addMessage(message: TMessage): void;
|
|
43
|
-
/**
|
|
44
|
-
* Validate user input
|
|
45
|
-
*/
|
|
46
|
-
protected validateInput(input: string): void;
|
|
47
|
-
/**
|
|
48
|
-
* Ensure agent is initialized before running
|
|
49
|
-
*/
|
|
50
|
-
protected ensureInitialized(): Promise<void>;
|
|
51
|
-
/**
|
|
52
|
-
* Cleanup resources
|
|
53
|
-
*/
|
|
54
|
-
dispose(): Promise<void>;
|
|
55
|
-
}
|
|
56
|
-
//# sourceMappingURL=abstract-agent.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"abstract-agent.d.ts","sourceRoot":"","sources":["../../src/abstracts/abstract-agent.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEhG,8BAAsB,aAAa,CAC/B,OAAO,GAAG,YAAY,EACtB,QAAQ,GAAG,WAAW,EACtB,QAAQ,GAAG,iBAAiB,CAC9B,YAAW,MAAM,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC;IAC5C,SAAS,CAAC,OAAO,EAAE,QAAQ,EAAE,CAAM;IACnC,SAAS,CAAC,aAAa,UAAS;IAChC,SAAS,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAE3B;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAE9C;;OAEG;IACG,SAAS,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAK/C;;OAEG;IACH,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC;IAEhE;;OAEG;IACH,QAAQ,CAAC,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,QAAQ,GAAG,cAAc,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC;IAE1F;;OAEG;IACH,UAAU,IAAI,QAAQ,EAAE;IAIxB;;OAEG;IACH,YAAY,IAAI,IAAI;IAIpB;;OAEG;IACH,SAAS,CAAC,UAAU,CAAC,OAAO,EAAE,QAAQ,GAAG,IAAI;IAI7C;;OAEG;IACH,SAAS,CAAC,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAM5C;;OAEG;cACa,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;IAOlD;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAIjC"}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
export class AbstractAgent {
|
|
2
|
-
history = [];
|
|
3
|
-
isInitialized = false;
|
|
4
|
-
config;
|
|
5
|
-
/**
|
|
6
|
-
* Configure the agent with type-safe configuration
|
|
7
|
-
*/
|
|
8
|
-
async configure(config) {
|
|
9
|
-
this.config = config;
|
|
10
|
-
await this.ensureInitialized();
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Get conversation history with type-safe messages
|
|
14
|
-
*/
|
|
15
|
-
getHistory() {
|
|
16
|
-
return [...this.history];
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Clear conversation history
|
|
20
|
-
*/
|
|
21
|
-
clearHistory() {
|
|
22
|
-
this.history = [];
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Add message to history
|
|
26
|
-
*/
|
|
27
|
-
addMessage(message) {
|
|
28
|
-
this.history.push(message);
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Validate user input
|
|
32
|
-
*/
|
|
33
|
-
validateInput(input) {
|
|
34
|
-
if (!input || typeof input !== 'string') {
|
|
35
|
-
throw new Error('Input must be a non-empty string');
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Ensure agent is initialized before running
|
|
40
|
-
*/
|
|
41
|
-
async ensureInitialized() {
|
|
42
|
-
if (!this.isInitialized) {
|
|
43
|
-
await this.initialize();
|
|
44
|
-
this.isInitialized = true;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Cleanup resources
|
|
49
|
-
*/
|
|
50
|
-
async dispose() {
|
|
51
|
-
this.clearHistory();
|
|
52
|
-
this.isInitialized = false;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
//# sourceMappingURL=abstract-agent.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"abstract-agent.js","sourceRoot":"","sources":["../../src/abstracts/abstract-agent.ts"],"names":[],"mappings":"AAWA,MAAM,OAAgB,aAAa;IAKrB,OAAO,GAAe,EAAE,CAAC;IACzB,aAAa,GAAG,KAAK,CAAC;IACtB,MAAM,CAAW;IAO3B;;OAEG;IACH,KAAK,CAAC,SAAS,CAAC,MAAe;QAC3B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,MAAM,IAAI,CAAC,iBAAiB,EAAE,CAAC;IACnC,CAAC;IAYD;;OAEG;IACH,UAAU;QACN,OAAO,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC;IAC7B,CAAC;IAED;;OAEG;IACH,YAAY;QACR,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;IACtB,CAAC;IAED;;OAEG;IACO,UAAU,CAAC,OAAiB;QAClC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC/B,CAAC;IAED;;OAEG;IACO,aAAa,CAAC,KAAa;QACjC,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YACtC,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;QACxD,CAAC;IACL,CAAC;IAED;;OAEG;IACO,KAAK,CAAC,iBAAiB;QAC7B,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;YACtB,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC;YACxB,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;QAC9B,CAAC;IACL,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,OAAO;QACT,IAAI,CAAC,YAAY,EAAE,CAAC;QACpB,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;IAC/B,CAAC;CACJ"}
|
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Abstract AI Provider Base Class
|
|
3
|
-
*
|
|
4
|
-
* 🎯 ABSTRACT CLASS - DO NOT DEPEND ON CONCRETE IMPLEMENTATIONS
|
|
5
|
-
*
|
|
6
|
-
* Defines the shared contract and helper utilities for all AI provider implementations.
|
|
7
|
-
* Concrete providers should extend this class and inject their own dependencies.
|
|
8
|
-
*/
|
|
9
|
-
import type { IAIProvider, IToolSchema, IChatOptions, IProviderRequest, IRawProviderResponse } from '../interfaces/provider';
|
|
10
|
-
import type { IExecutor } from '../interfaces/executor';
|
|
11
|
-
import type { TUniversalMessage } from '../interfaces/messages';
|
|
12
|
-
import type { ILogger } from '../utils/logger';
|
|
13
|
-
/**
|
|
14
|
-
* Provider logging data type
|
|
15
|
-
* Used for storing logging information in provider operations
|
|
16
|
-
*/
|
|
17
|
-
export type TProviderLoggingData = Record<string, string | number | boolean | Date | string[]>;
|
|
18
|
-
/**
|
|
19
|
-
* Provider configuration base interface
|
|
20
|
-
*/
|
|
21
|
-
export interface IProviderConfig {
|
|
22
|
-
apiKey?: string;
|
|
23
|
-
baseUrl?: string;
|
|
24
|
-
timeout?: number;
|
|
25
|
-
[key: string]: string | number | boolean | undefined;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Enhanced provider configuration that supports executor injection
|
|
29
|
-
*/
|
|
30
|
-
export interface IExecutorAwareProviderConfig {
|
|
31
|
-
apiKey?: string;
|
|
32
|
-
baseUrl?: string;
|
|
33
|
-
timeout?: number;
|
|
34
|
-
/**
|
|
35
|
-
* Optional executor for handling AI requests
|
|
36
|
-
* When provided, the provider will delegate all chat operations to this executor
|
|
37
|
-
* instead of making direct API calls. This enables remote execution capabilities.
|
|
38
|
-
*/
|
|
39
|
-
executor?: IExecutor;
|
|
40
|
-
[key: string]: string | number | boolean | IExecutor | undefined;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Base AI provider implementation with proper type constraints
|
|
44
|
-
* All AI providers should extend this class
|
|
45
|
-
*
|
|
46
|
-
* ========================================
|
|
47
|
-
* CRITICAL IMPLEMENTATION GUIDELINES
|
|
48
|
-
* ========================================
|
|
49
|
-
*
|
|
50
|
-
* ALL AI PROVIDER IMPLEMENTATIONS (OpenAI, Anthropic, Google, etc.) MUST:
|
|
51
|
-
*
|
|
52
|
-
* 1. EXTEND THIS CLASS:
|
|
53
|
-
* ```typescript
|
|
54
|
-
* export class OpenAIProvider extends AbstractAIProvider {
|
|
55
|
-
* override readonly name = 'openai';
|
|
56
|
-
* override readonly version = '1.0.0';
|
|
57
|
-
* ```
|
|
58
|
-
*
|
|
59
|
-
* 2. USE IMPORTS FROM @robota-sdk/agents:
|
|
60
|
-
* ```typescript
|
|
61
|
-
* import { AbstractAIProvider } from '@robota-sdk/agents';
|
|
62
|
-
* import type {
|
|
63
|
-
* TUniversalMessage,
|
|
64
|
-
* ChatOptions,
|
|
65
|
-
* IToolCall,
|
|
66
|
-
* ToolSchema,
|
|
67
|
-
* AssistantMessage
|
|
68
|
-
* } from '@robota-sdk/agents';
|
|
69
|
-
* ```
|
|
70
|
-
*
|
|
71
|
-
* 3. USE OVERRIDE KEYWORD FOR ALL INHERITED METHODS:
|
|
72
|
-
* - override async chat(...)
|
|
73
|
-
* - override async *chatStream(...)
|
|
74
|
-
* - override supportsTools()
|
|
75
|
-
* - override validateConfig()
|
|
76
|
-
* - override async dispose()
|
|
77
|
-
*
|
|
78
|
-
* 4. DO NOT REDEFINE TYPES THAT EXIST IN @robota-sdk/agents:
|
|
79
|
-
* - TUniversalMessage
|
|
80
|
-
* - ChatOptions
|
|
81
|
-
* - IToolCall
|
|
82
|
-
* - ToolSchema
|
|
83
|
-
* - AssistantMessage
|
|
84
|
-
* - SystemMessage
|
|
85
|
-
* - UserMessage
|
|
86
|
-
* - ToolMessage
|
|
87
|
-
*
|
|
88
|
-
* 5. HANDLE MESSAGE CONTENT PROPERLY:
|
|
89
|
-
* - For tool calls: content should be null (not empty string)
|
|
90
|
-
* - For regular messages: content can be string or null
|
|
91
|
-
* - Always preserve null values from API responses
|
|
92
|
-
*
|
|
93
|
-
* 6. CALL SUPER() IN CONSTRUCTOR:
|
|
94
|
-
* ```typescript
|
|
95
|
-
* constructor(options: IProviderOptions) {
|
|
96
|
-
* super();
|
|
97
|
-
* // provider-specific initialization
|
|
98
|
-
* }
|
|
99
|
-
* ```
|
|
100
|
-
*
|
|
101
|
-
* This ensures ExecutionService can properly identify providers
|
|
102
|
-
* and prevents type conflicts across the codebase.
|
|
103
|
-
*
|
|
104
|
-
* ========================================
|
|
105
|
-
*
|
|
106
|
-
* @template TConfig - Provider configuration type (defaults to IProviderConfig for type safety)
|
|
107
|
-
* @template TUniversalMessage - Message type (defaults to TUniversalMessage for backward compatibility)
|
|
108
|
-
* @template TResponse - Response type (defaults to TUniversalMessage for backward compatibility)
|
|
109
|
-
*/
|
|
110
|
-
export declare abstract class AbstractAIProvider<TConfig = IProviderConfig> implements IAIProvider {
|
|
111
|
-
abstract readonly name: string;
|
|
112
|
-
abstract readonly version: string;
|
|
113
|
-
protected config?: TConfig;
|
|
114
|
-
protected executor?: IExecutor;
|
|
115
|
-
protected readonly logger: ILogger;
|
|
116
|
-
constructor(logger?: ILogger);
|
|
117
|
-
/**
|
|
118
|
-
* Configure the provider with type-safe configuration
|
|
119
|
-
*/
|
|
120
|
-
configure(config: TConfig): Promise<void>;
|
|
121
|
-
/**
|
|
122
|
-
* Each provider must implement chat using their own native SDK types internally
|
|
123
|
-
* @param messages - Array of messages from conversation history
|
|
124
|
-
* @param options - Chat options including tools, model settings, etc.
|
|
125
|
-
* @returns Promise resolving to a response
|
|
126
|
-
*/
|
|
127
|
-
abstract chat(messages: TUniversalMessage[], options?: IChatOptions): Promise<TUniversalMessage>;
|
|
128
|
-
/**
|
|
129
|
-
* Each provider must implement streaming chat using their own native SDK types internally
|
|
130
|
-
* @param messages - Array of messages from conversation history
|
|
131
|
-
* @param options - Chat options including tools, model settings, etc.
|
|
132
|
-
* @returns AsyncIterable of response chunks
|
|
133
|
-
*/
|
|
134
|
-
abstract chatStream?(messages: TUniversalMessage[], options?: IChatOptions): AsyncIterable<TUniversalMessage>;
|
|
135
|
-
/**
|
|
136
|
-
* Provider-agnostic raw response API.
|
|
137
|
-
*
|
|
138
|
-
* This is the canonical "raw payload" entrypoint required by the AIProvider contract.
|
|
139
|
-
* The default implementation delegates to `chat()` and adapts the result into a
|
|
140
|
-
* RawProviderResponse shape.
|
|
141
|
-
*/
|
|
142
|
-
generateResponse(payload: IProviderRequest): Promise<IRawProviderResponse>;
|
|
143
|
-
/**
|
|
144
|
-
* Provider-agnostic raw streaming API.
|
|
145
|
-
*
|
|
146
|
-
* If a provider does not implement chatStream, it does not support streaming.
|
|
147
|
-
*/
|
|
148
|
-
generateStreamingResponse(payload: IProviderRequest): AsyncIterable<IRawProviderResponse>;
|
|
149
|
-
/**
|
|
150
|
-
* Default implementation - most modern providers support tools
|
|
151
|
-
* @returns true if tool calling is supported
|
|
152
|
-
*/
|
|
153
|
-
supportsTools(): boolean;
|
|
154
|
-
/**
|
|
155
|
-
* Default implementation - providers can override for specific validation
|
|
156
|
-
* @returns true if configuration is valid
|
|
157
|
-
*/
|
|
158
|
-
validateConfig(): boolean;
|
|
159
|
-
/**
|
|
160
|
-
* Utility method for validating TUniversalMessage array
|
|
161
|
-
* @param messages - Messages to validate
|
|
162
|
-
*/
|
|
163
|
-
protected validateMessages(messages: TUniversalMessage[]): void;
|
|
164
|
-
/**
|
|
165
|
-
* Utility method for validating tool schemas
|
|
166
|
-
* @param tools - Tool schemas to validate
|
|
167
|
-
*/
|
|
168
|
-
protected validateTools(tools?: IToolSchema[]): void;
|
|
169
|
-
/**
|
|
170
|
-
* Execute chat via executor.
|
|
171
|
-
*
|
|
172
|
-
* Subclasses should call this only when an executor is configured.
|
|
173
|
-
*/
|
|
174
|
-
protected executeViaExecutorOrDirect(messages: TUniversalMessage[], options?: IChatOptions): Promise<TUniversalMessage>;
|
|
175
|
-
/**
|
|
176
|
-
* Execute streaming chat via executor.
|
|
177
|
-
*
|
|
178
|
-
* Subclasses should call this only when an executor is configured.
|
|
179
|
-
*/
|
|
180
|
-
protected executeStreamViaExecutorOrDirect(messages: TUniversalMessage[], options?: IChatOptions): AsyncIterable<TUniversalMessage>;
|
|
181
|
-
/**
|
|
182
|
-
* Clean up resources when provider is no longer needed
|
|
183
|
-
* Override this method in subclasses for additional cleanup
|
|
184
|
-
*/
|
|
185
|
-
dispose(): Promise<void>;
|
|
186
|
-
}
|
|
187
|
-
//# sourceMappingURL=abstract-ai-provider.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"abstract-ai-provider.d.ts","sourceRoot":"","sources":["../../src/abstracts/abstract-ai-provider.ts"],"names":[],"mappings":"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"}
|