@dexto/core 1.5.7 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -8
- package/dist/agent/DextoAgent.cjs +383 -153
- package/dist/agent/DextoAgent.d.ts +112 -60
- package/dist/agent/DextoAgent.d.ts.map +1 -1
- package/dist/agent/DextoAgent.js +380 -150
- package/dist/{context/compaction/provider.cjs → agent/agent-options.cjs} +2 -2
- package/dist/agent/agent-options.d.ts +53 -0
- package/dist/agent/agent-options.d.ts.map +1 -0
- package/dist/agent/agentCard.cjs +1 -1
- package/dist/agent/errors.cjs +2 -2
- package/dist/agent/errors.d.ts.map +1 -1
- package/dist/agent/index.cjs +1 -6
- package/dist/agent/index.d.ts +3 -2
- package/dist/agent/index.d.ts.map +1 -1
- package/dist/agent/index.js +1 -7
- package/dist/{storage/blob/provider.cjs → agent/runtime-config.cjs} +2 -2
- package/dist/agent/runtime-config.d.ts +53 -0
- package/dist/agent/runtime-config.d.ts.map +1 -0
- package/dist/agent/schemas.cjs +2 -99
- package/dist/agent/schemas.d.ts +10 -9160
- package/dist/agent/schemas.d.ts.map +1 -1
- package/dist/agent/schemas.js +1 -104
- package/dist/agent/state-manager.d.ts +5 -5
- package/dist/agent/state-manager.d.ts.map +1 -1
- package/dist/approval/error-codes.cjs +1 -1
- package/dist/approval/error-codes.d.ts +1 -1
- package/dist/approval/error-codes.d.ts.map +1 -1
- package/dist/approval/error-codes.js +1 -1
- package/dist/approval/errors.cjs +5 -5
- package/dist/approval/errors.d.ts +2 -2
- package/dist/approval/errors.d.ts.map +1 -1
- package/dist/approval/errors.js +5 -5
- package/dist/approval/index.cjs +8 -8
- package/dist/approval/index.d.ts +2 -2
- package/dist/approval/index.d.ts.map +1 -1
- package/dist/approval/index.js +8 -8
- package/dist/approval/manager.cjs +77 -57
- package/dist/approval/manager.d.ts +41 -43
- package/dist/approval/manager.d.ts.map +1 -1
- package/dist/approval/manager.js +75 -55
- package/dist/approval/schemas.cjs +26 -25
- package/dist/approval/schemas.d.ts +35 -15
- package/dist/approval/schemas.d.ts.map +1 -1
- package/dist/approval/schemas.js +22 -21
- package/dist/approval/types.cjs +1 -1
- package/dist/approval/types.d.ts +14 -14
- package/dist/approval/types.d.ts.map +1 -1
- package/dist/approval/types.js +1 -1
- package/dist/context/compaction/index.cjs +2 -23
- package/dist/context/compaction/index.d.ts +1 -7
- package/dist/context/compaction/index.d.ts.map +1 -1
- package/dist/context/compaction/index.js +1 -16
- package/dist/context/compaction/strategies/noop.cjs +19 -1
- package/dist/context/compaction/strategies/noop.d.ts +13 -3
- package/dist/context/compaction/strategies/noop.d.ts.map +1 -1
- package/dist/context/compaction/strategies/noop.js +19 -1
- package/dist/context/compaction/strategies/{reactive-overflow.cjs → reactive-overflow-compaction.cjs} +67 -64
- package/dist/context/compaction/strategies/{reactive-overflow.d.ts → reactive-overflow-compaction.d.ts} +19 -36
- package/dist/context/compaction/strategies/reactive-overflow-compaction.d.ts.map +1 -0
- package/dist/context/compaction/strategies/{reactive-overflow.js → reactive-overflow-compaction.js} +63 -60
- package/dist/context/compaction/types.d.ts +40 -8
- package/dist/context/compaction/types.d.ts.map +1 -1
- package/dist/context/manager.cjs +5 -3
- package/dist/context/manager.d.ts +4 -3
- package/dist/context/manager.d.ts.map +1 -1
- package/dist/context/manager.js +5 -3
- package/dist/context/types.d.ts +2 -0
- package/dist/context/types.d.ts.map +1 -1
- package/dist/context/utils.cjs +70 -43
- package/dist/context/utils.d.ts +14 -14
- package/dist/context/utils.d.ts.map +1 -1
- package/dist/context/utils.js +69 -42
- package/dist/errors/result-bridge.d.ts +2 -2
- package/dist/errors/result-bridge.d.ts.map +1 -1
- package/dist/errors/types.cjs +1 -1
- package/dist/errors/types.d.ts +3 -3
- package/dist/errors/types.d.ts.map +1 -1
- package/dist/errors/types.js +1 -1
- package/dist/events/index.cjs +15 -2
- package/dist/events/index.d.ts +78 -7
- package/dist/events/index.d.ts.map +1 -1
- package/dist/events/index.js +15 -2
- package/dist/{plugins → hooks}/builtins/content-policy.cjs +7 -6
- package/dist/hooks/builtins/content-policy.d.ts +24 -0
- package/dist/hooks/builtins/content-policy.d.ts.map +1 -0
- package/dist/{plugins → hooks}/builtins/content-policy.js +6 -5
- package/dist/{plugins → hooks}/builtins/response-sanitizer.cjs +3 -3
- package/dist/hooks/builtins/response-sanitizer.d.ts +22 -0
- package/dist/hooks/builtins/response-sanitizer.d.ts.map +1 -0
- package/dist/{plugins → hooks}/builtins/response-sanitizer.js +2 -2
- package/dist/hooks/error-codes.cjs +43 -0
- package/dist/hooks/error-codes.d.ts +34 -0
- package/dist/hooks/error-codes.d.ts.map +1 -0
- package/dist/hooks/error-codes.js +20 -0
- package/dist/{storage/cache/providers/memory.cjs → hooks/index.cjs} +15 -18
- package/dist/hooks/index.d.ts +14 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +11 -0
- package/dist/hooks/manager.cjs +354 -0
- package/dist/hooks/manager.d.ts +103 -0
- package/dist/hooks/manager.d.ts.map +1 -0
- package/dist/hooks/manager.js +331 -0
- package/dist/{plugins → hooks}/types.d.ts +36 -34
- package/dist/hooks/types.d.ts.map +1 -0
- package/dist/index.browser.cjs +13 -12
- package/dist/index.browser.d.ts +6 -6
- package/dist/index.browser.d.ts.map +1 -1
- package/dist/index.browser.js +8 -7
- package/dist/index.cjs +5 -7
- package/dist/index.d.ts +2 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -3
- package/dist/llm/curation-config.cjs +82 -0
- package/dist/llm/curation-config.d.ts +13 -0
- package/dist/llm/curation-config.d.ts.map +1 -0
- package/dist/llm/curation-config.js +59 -0
- package/dist/llm/curation.cjs +57 -0
- package/dist/llm/curation.d.ts +16 -0
- package/dist/llm/curation.d.ts.map +1 -0
- package/dist/llm/curation.js +34 -0
- package/dist/llm/errors.cjs +2 -2
- package/dist/llm/errors.d.ts +8 -8
- package/dist/llm/errors.js +1 -1
- package/dist/llm/executor/provider-options.cjs +1 -1
- package/dist/llm/executor/provider-options.js +1 -1
- package/dist/llm/executor/stream-processor.cjs +131 -11
- package/dist/llm/executor/stream-processor.d.ts +7 -5
- package/dist/llm/executor/stream-processor.d.ts.map +1 -1
- package/dist/llm/executor/stream-processor.js +131 -11
- package/dist/llm/executor/turn-executor.cjs +57 -56
- package/dist/llm/executor/turn-executor.d.ts +7 -8
- package/dist/llm/executor/turn-executor.d.ts.map +1 -1
- package/dist/llm/executor/turn-executor.js +57 -56
- package/dist/llm/formatters/vercel.cjs +2 -2
- package/dist/llm/formatters/vercel.d.ts +2 -2
- package/dist/llm/formatters/vercel.d.ts.map +1 -1
- package/dist/llm/index.cjs +14 -3
- package/dist/llm/index.d.ts +3 -1
- package/dist/llm/index.d.ts.map +1 -1
- package/dist/llm/index.js +13 -2
- package/dist/llm/providers/local/schemas.d.ts +10 -10
- package/dist/llm/registry/auto-update.cjs +263 -0
- package/dist/llm/registry/auto-update.d.ts +27 -0
- package/dist/llm/registry/auto-update.d.ts.map +1 -0
- package/dist/llm/registry/auto-update.js +227 -0
- package/dist/llm/registry/index.cjs +806 -0
- package/dist/llm/{registry.d.ts → registry/index.d.ts} +21 -43
- package/dist/llm/registry/index.d.ts.map +1 -0
- package/dist/llm/registry/index.js +756 -0
- package/dist/llm/registry/models.generated.cjs +4861 -0
- package/dist/llm/registry/models.generated.d.ts +431 -0
- package/dist/llm/registry/models.generated.d.ts.map +1 -0
- package/dist/llm/registry/models.generated.js +4838 -0
- package/dist/{storage/database/providers/index.cjs → llm/registry/models.manual.cjs} +22 -12
- package/dist/llm/registry/models.manual.d.ts +22 -0
- package/dist/llm/registry/models.manual.d.ts.map +1 -0
- package/dist/llm/registry/models.manual.js +21 -0
- package/dist/llm/registry/sync.cjs +354 -0
- package/dist/llm/registry/sync.d.ts +41 -0
- package/dist/llm/registry/sync.d.ts.map +1 -0
- package/dist/llm/registry/sync.js +328 -0
- package/dist/llm/resolver.cjs +29 -20
- package/dist/llm/resolver.d.ts +4 -4
- package/dist/llm/resolver.d.ts.map +1 -1
- package/dist/llm/resolver.js +28 -20
- package/dist/llm/schemas.cjs +69 -94
- package/dist/llm/schemas.d.ts +19 -158
- package/dist/llm/schemas.d.ts.map +1 -1
- package/dist/llm/schemas.js +67 -91
- package/dist/llm/services/factory.cjs +6 -7
- package/dist/llm/services/factory.d.ts +3 -4
- package/dist/llm/services/factory.d.ts.map +1 -1
- package/dist/llm/services/factory.js +6 -7
- package/dist/llm/services/vercel.cjs +11 -15
- package/dist/llm/services/vercel.d.ts +7 -7
- package/dist/llm/services/vercel.d.ts.map +1 -1
- package/dist/llm/services/vercel.js +11 -15
- package/dist/llm/types.cjs +1 -1
- package/dist/llm/types.d.ts +1 -1
- package/dist/llm/types.d.ts.map +1 -1
- package/dist/llm/types.js +1 -1
- package/dist/llm/validation.cjs +2 -2
- package/dist/llm/validation.d.ts +2 -2
- package/dist/llm/validation.d.ts.map +1 -1
- package/dist/llm/validation.js +1 -1
- package/dist/logger/browser.cjs +4 -4
- package/dist/logger/browser.d.ts +4 -4
- package/dist/logger/browser.d.ts.map +1 -1
- package/dist/logger/browser.js +3 -3
- package/dist/{context/compaction/providers/noop-provider.cjs → logger/default-logger-factory.cjs} +16 -22
- package/dist/logger/default-logger-factory.d.ts +301 -0
- package/dist/logger/default-logger-factory.d.ts.map +1 -0
- package/dist/logger/default-logger-factory.js +18 -0
- package/dist/logger/factory.d.ts +2 -2
- package/dist/logger/factory.d.ts.map +1 -1
- package/dist/logger/index.cjs +7 -2
- package/dist/logger/index.d.ts +5 -3
- package/dist/logger/index.d.ts.map +1 -1
- package/dist/logger/index.js +8 -2
- package/dist/logger/logger.cjs +4 -4
- package/dist/logger/logger.d.ts +4 -4
- package/dist/logger/logger.d.ts.map +1 -1
- package/dist/logger/logger.js +3 -3
- package/dist/logger/v2/dexto-logger.d.ts +3 -3
- package/dist/logger/v2/dexto-logger.d.ts.map +1 -1
- package/dist/logger/v2/schemas.d.ts +12 -12
- package/dist/logger/v2/test-utils.d.ts +5 -5
- package/dist/logger/v2/test-utils.d.ts.map +1 -1
- package/dist/logger/v2/transport-factory.d.ts +3 -3
- package/dist/logger/v2/transport-factory.d.ts.map +1 -1
- package/dist/logger/v2/transports/console-transport.d.ts +2 -2
- package/dist/logger/v2/transports/console-transport.d.ts.map +1 -1
- package/dist/logger/v2/transports/file-transport.d.ts +2 -2
- package/dist/logger/v2/transports/file-transport.d.ts.map +1 -1
- package/dist/logger/v2/transports/silent-transport.d.ts +2 -2
- package/dist/logger/v2/transports/silent-transport.d.ts.map +1 -1
- package/dist/logger/v2/types.cjs +1 -1
- package/dist/logger/v2/types.d.ts +8 -8
- package/dist/logger/v2/types.d.ts.map +1 -1
- package/dist/logger/v2/types.js +1 -1
- package/dist/mcp/errors.cjs +2 -2
- package/dist/mcp/errors.d.ts.map +1 -1
- package/dist/mcp/manager.cjs +16 -11
- package/dist/mcp/manager.d.ts +16 -13
- package/dist/mcp/manager.d.ts.map +1 -1
- package/dist/mcp/manager.js +17 -12
- package/dist/mcp/mcp-client.cjs +25 -20
- package/dist/mcp/mcp-client.d.ts +5 -5
- package/dist/mcp/mcp-client.d.ts.map +1 -1
- package/dist/mcp/mcp-client.js +20 -15
- package/dist/mcp/resolver.cjs +1 -1
- package/dist/mcp/schemas.cjs +5 -5
- package/dist/mcp/schemas.d.ts +4 -4
- package/dist/mcp/schemas.js +2 -2
- package/dist/mcp/types.d.ts +7 -7
- package/dist/mcp/types.d.ts.map +1 -1
- package/dist/memory/manager.d.ts +2 -2
- package/dist/memory/manager.d.ts.map +1 -1
- package/dist/memory/schemas.d.ts +2 -2
- package/dist/prompts/errors.cjs +3 -3
- package/dist/prompts/errors.d.ts.map +1 -1
- package/dist/prompts/prompt-manager.d.ts +3 -3
- package/dist/prompts/prompt-manager.d.ts.map +1 -1
- package/dist/prompts/providers/config-prompt-provider.cjs +15 -29
- package/dist/prompts/providers/config-prompt-provider.d.ts +3 -3
- package/dist/prompts/providers/config-prompt-provider.d.ts.map +1 -1
- package/dist/prompts/providers/config-prompt-provider.js +15 -29
- package/dist/prompts/providers/custom-prompt-provider.d.ts +2 -2
- package/dist/prompts/providers/custom-prompt-provider.d.ts.map +1 -1
- package/dist/prompts/providers/mcp-prompt-provider.d.ts +2 -2
- package/dist/prompts/providers/mcp-prompt-provider.d.ts.map +1 -1
- package/dist/prompts/schemas.d.ts +4 -4
- package/dist/resources/{internal-provider.cjs → agent-resources-provider.cjs} +16 -16
- package/dist/resources/{internal-provider.d.ts → agent-resources-provider.d.ts} +6 -6
- package/dist/resources/agent-resources-provider.d.ts.map +1 -0
- package/dist/resources/{internal-provider.js → agent-resources-provider.js} +13 -13
- package/dist/resources/errors.cjs +2 -2
- package/dist/resources/errors.d.ts.map +1 -1
- package/dist/resources/handlers/blob-handler.d.ts +2 -2
- package/dist/resources/handlers/blob-handler.d.ts.map +1 -1
- package/dist/resources/handlers/factory.d.ts +3 -3
- package/dist/resources/handlers/factory.d.ts.map +1 -1
- package/dist/resources/handlers/filesystem-handler.cjs +25 -0
- package/dist/resources/handlers/filesystem-handler.d.ts +3 -2
- package/dist/resources/handlers/filesystem-handler.d.ts.map +1 -1
- package/dist/resources/handlers/filesystem-handler.js +25 -0
- package/dist/resources/index.cjs +7 -9
- package/dist/resources/index.d.ts +3 -3
- package/dist/resources/index.d.ts.map +1 -1
- package/dist/resources/index.js +5 -10
- package/dist/resources/manager.cjs +77 -74
- package/dist/resources/manager.d.ts +16 -7
- package/dist/resources/manager.d.ts.map +1 -1
- package/dist/resources/manager.js +77 -74
- package/dist/resources/schemas.cjs +6 -26
- package/dist/resources/schemas.d.ts +8 -100
- package/dist/resources/schemas.d.ts.map +1 -1
- package/dist/resources/schemas.js +4 -23
- package/dist/search/search-service.d.ts +2 -2
- package/dist/search/search-service.d.ts.map +1 -1
- package/dist/session/chat-session.cjs +16 -26
- package/dist/session/chat-session.d.ts +7 -5
- package/dist/session/chat-session.d.ts.map +1 -1
- package/dist/session/chat-session.js +17 -27
- package/dist/session/errors.cjs +2 -2
- package/dist/session/errors.d.ts.map +1 -1
- package/dist/session/history/database.cjs +1 -1
- package/dist/session/history/database.d.ts +4 -4
- package/dist/session/history/database.d.ts.map +1 -1
- package/dist/session/history/factory.d.ts +3 -3
- package/dist/session/history/factory.d.ts.map +1 -1
- package/dist/session/history/memory.d.ts +4 -4
- package/dist/session/history/memory.d.ts.map +1 -1
- package/dist/session/history/types.d.ts +2 -2
- package/dist/session/history/types.d.ts.map +1 -1
- package/dist/session/index.cjs +3 -0
- package/dist/session/index.d.ts +2 -0
- package/dist/session/index.d.ts.map +1 -1
- package/dist/session/index.js +2 -0
- package/dist/session/message-queue.cjs +29 -5
- package/dist/session/message-queue.d.ts +5 -3
- package/dist/session/message-queue.d.ts.map +1 -1
- package/dist/session/message-queue.js +29 -5
- package/dist/session/session-manager.cjs +107 -12
- package/dist/session/session-manager.d.ts +49 -8
- package/dist/session/session-manager.d.ts.map +1 -1
- package/dist/session/session-manager.js +97 -12
- package/dist/session/title-generator.cjs +2 -2
- package/dist/session/title-generator.d.ts +2 -2
- package/dist/session/title-generator.d.ts.map +1 -1
- package/dist/session/types.d.ts +1 -0
- package/dist/session/types.d.ts.map +1 -1
- package/dist/storage/blob/index.cjs +0 -40
- package/dist/storage/blob/index.d.ts +2 -44
- package/dist/storage/blob/index.d.ts.map +1 -1
- package/dist/storage/blob/index.js +0 -30
- package/dist/storage/cache/index.cjs +0 -37
- package/dist/storage/cache/index.d.ts +0 -42
- package/dist/storage/cache/index.d.ts.map +1 -1
- package/dist/storage/cache/index.js +0 -28
- package/dist/storage/database/index.cjs +0 -42
- package/dist/storage/database/index.d.ts +0 -43
- package/dist/storage/database/index.d.ts.map +1 -1
- package/dist/storage/database/index.js +0 -37
- package/dist/storage/error-codes.cjs +1 -6
- package/dist/storage/error-codes.d.ts +2 -7
- package/dist/storage/error-codes.d.ts.map +1 -1
- package/dist/storage/error-codes.js +1 -6
- package/dist/storage/errors.cjs +18 -82
- package/dist/storage/errors.d.ts +4 -24
- package/dist/storage/errors.d.ts.map +1 -1
- package/dist/storage/errors.js +16 -80
- package/dist/storage/index.cjs +8 -69
- package/dist/storage/index.d.ts +11 -66
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +6 -50
- package/dist/storage/storage-manager.cjs +9 -25
- package/dist/storage/storage-manager.d.ts +11 -15
- package/dist/storage/storage-manager.d.ts.map +1 -1
- package/dist/storage/storage-manager.js +8 -23
- package/dist/storage/types.d.ts +0 -1
- package/dist/storage/types.d.ts.map +1 -1
- package/dist/systemPrompt/contributors.d.ts +4 -4
- package/dist/systemPrompt/contributors.d.ts.map +1 -1
- package/dist/systemPrompt/errors.cjs +2 -2
- package/dist/systemPrompt/errors.d.ts.map +1 -1
- package/dist/systemPrompt/manager.cjs +1 -5
- package/dist/systemPrompt/manager.d.ts +2 -3
- package/dist/systemPrompt/manager.d.ts.map +1 -1
- package/dist/systemPrompt/manager.js +1 -5
- package/dist/telemetry/index.cjs +3 -0
- package/dist/telemetry/index.d.ts +2 -0
- package/dist/telemetry/index.d.ts.map +1 -1
- package/dist/telemetry/index.js +2 -0
- package/dist/telemetry/utils.d.ts +4 -4
- package/dist/telemetry/utils.d.ts.map +1 -1
- package/dist/test-utils/in-memory-storage.cjs +288 -0
- package/dist/test-utils/in-memory-storage.js +252 -0
- package/dist/tools/confirmation/allowed-tools-provider/factory.d.ts +3 -3
- package/dist/tools/confirmation/allowed-tools-provider/factory.d.ts.map +1 -1
- package/dist/tools/confirmation/allowed-tools-provider/in-memory.d.ts +2 -2
- package/dist/tools/confirmation/allowed-tools-provider/in-memory.d.ts.map +1 -1
- package/dist/tools/confirmation/allowed-tools-provider/storage.d.ts +4 -4
- package/dist/tools/confirmation/allowed-tools-provider/storage.d.ts.map +1 -1
- package/dist/tools/confirmation/allowed-tools-provider/types.d.ts +2 -2
- package/dist/tools/confirmation/allowed-tools-provider/types.d.ts.map +1 -1
- package/dist/tools/{internal-tools/constants.cjs → define-tool.cjs} +8 -13
- package/dist/tools/define-tool.d.ts +11 -0
- package/dist/tools/define-tool.d.ts.map +1 -0
- package/dist/tools/define-tool.js +7 -0
- package/dist/tools/error-codes.cjs +2 -2
- package/dist/tools/error-codes.d.ts +2 -2
- package/dist/tools/error-codes.d.ts.map +1 -1
- package/dist/tools/error-codes.js +2 -2
- package/dist/tools/errors.cjs +11 -23
- package/dist/tools/errors.d.ts +4 -10
- package/dist/tools/errors.d.ts.map +1 -1
- package/dist/tools/errors.js +9 -21
- package/dist/tools/index.cjs +3 -8
- package/dist/tools/index.d.ts +2 -4
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +2 -7
- package/dist/{storage/blob/providers/index.cjs → tools/pattern-utils.cjs} +11 -9
- package/dist/tools/pattern-utils.d.ts +20 -0
- package/dist/tools/pattern-utils.d.ts.map +1 -0
- package/dist/tools/pattern-utils.js +10 -0
- package/dist/tools/schemas.cjs +14 -40
- package/dist/tools/schemas.d.ts +6 -50
- package/dist/tools/schemas.d.ts.map +1 -1
- package/dist/tools/schemas.js +11 -32
- package/dist/tools/tool-call-metadata.cjs +75 -0
- package/dist/tools/tool-call-metadata.d.ts +16 -0
- package/dist/tools/tool-call-metadata.d.ts.map +1 -0
- package/dist/tools/tool-call-metadata.js +51 -0
- package/dist/tools/tool-manager.cjs +578 -302
- package/dist/tools/tool-manager.d.ts +105 -81
- package/dist/tools/tool-manager.d.ts.map +1 -1
- package/dist/tools/tool-manager.js +578 -306
- package/dist/tools/types.d.ts +112 -13
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/utils/api-key-resolver.cjs +1 -1
- package/dist/utils/api-key-resolver.js +1 -1
- package/dist/utils/env.cjs +49 -0
- package/dist/utils/env.d.ts +4 -0
- package/dist/utils/env.d.ts.map +1 -0
- package/dist/utils/env.js +24 -0
- package/dist/utils/error-conversion.d.ts +2 -2
- package/dist/utils/error-conversion.d.ts.map +1 -1
- package/dist/utils/index.cjs +3 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/path.d.ts +2 -2
- package/dist/utils/path.d.ts.map +1 -1
- package/dist/utils/result.cjs +1 -1
- package/dist/utils/result.d.ts.map +1 -1
- package/dist/utils/schema.cjs +9 -5
- package/dist/utils/schema.d.ts +4 -2
- package/dist/utils/schema.d.ts.map +1 -1
- package/dist/utils/schema.js +9 -5
- package/dist/utils/service-initializer.cjs +58 -51
- package/dist/utils/service-initializer.d.ts +31 -9
- package/dist/utils/service-initializer.d.ts.map +1 -1
- package/dist/utils/service-initializer.js +58 -51
- package/dist/{storage/cache/providers/index.cjs → workspace/error-codes.cjs} +8 -9
- package/dist/workspace/error-codes.d.ts +5 -0
- package/dist/workspace/error-codes.d.ts.map +1 -0
- package/dist/workspace/error-codes.js +7 -0
- package/dist/{storage/blob/factory.cjs → workspace/errors.cjs} +20 -14
- package/dist/workspace/errors.d.ts +5 -0
- package/dist/workspace/errors.d.ts.map +1 -0
- package/dist/workspace/errors.js +21 -0
- package/dist/{image → workspace}/index.cjs +12 -10
- package/dist/workspace/index.d.ts +5 -0
- package/dist/workspace/index.d.ts.map +1 -0
- package/dist/workspace/index.js +9 -0
- package/dist/workspace/manager.cjs +113 -0
- package/dist/workspace/manager.d.ts +18 -0
- package/dist/workspace/manager.d.ts.map +1 -0
- package/dist/workspace/manager.js +90 -0
- package/dist/workspace/types.d.ts +14 -0
- package/dist/workspace/types.d.ts.map +1 -0
- package/package.json +7 -3
- package/dist/context/compaction/factory.cjs +0 -57
- package/dist/context/compaction/factory.d.ts +0 -17
- package/dist/context/compaction/factory.d.ts.map +0 -1
- package/dist/context/compaction/factory.js +0 -34
- package/dist/context/compaction/provider.d.ts +0 -48
- package/dist/context/compaction/provider.d.ts.map +0 -1
- package/dist/context/compaction/providers/noop-provider.d.ts +0 -24
- package/dist/context/compaction/providers/noop-provider.d.ts.map +0 -1
- package/dist/context/compaction/providers/noop-provider.js +0 -24
- package/dist/context/compaction/providers/reactive-overflow-provider.cjs +0 -76
- package/dist/context/compaction/providers/reactive-overflow-provider.d.ts +0 -51
- package/dist/context/compaction/providers/reactive-overflow-provider.d.ts.map +0 -1
- package/dist/context/compaction/providers/reactive-overflow-provider.js +0 -52
- package/dist/context/compaction/registry.cjs +0 -39
- package/dist/context/compaction/registry.d.ts +0 -19
- package/dist/context/compaction/registry.d.ts.map +0 -1
- package/dist/context/compaction/registry.js +0 -16
- package/dist/context/compaction/schemas.cjs +0 -58
- package/dist/context/compaction/schemas.d.ts +0 -69
- package/dist/context/compaction/schemas.d.ts.map +0 -1
- package/dist/context/compaction/schemas.js +0 -34
- package/dist/context/compaction/strategies/reactive-overflow.d.ts.map +0 -1
- package/dist/image/define-image.cjs +0 -146
- package/dist/image/define-image.d.ts +0 -71
- package/dist/image/define-image.d.ts.map +0 -1
- package/dist/image/define-image.js +0 -121
- package/dist/image/index.d.ts +0 -53
- package/dist/image/index.d.ts.map +0 -1
- package/dist/image/index.js +0 -7
- package/dist/image/types.d.ts +0 -246
- package/dist/image/types.d.ts.map +0 -1
- package/dist/llm/registry.cjs +0 -2075
- package/dist/llm/registry.d.ts.map +0 -1
- package/dist/llm/registry.js +0 -2025
- package/dist/llm/services/test-utils.integration.cjs +0 -237
- package/dist/llm/services/test-utils.integration.d.ts +0 -48
- package/dist/llm/services/test-utils.integration.d.ts.map +0 -1
- package/dist/llm/services/test-utils.integration.js +0 -214
- package/dist/plugins/builtins/content-policy.d.ts +0 -26
- package/dist/plugins/builtins/content-policy.d.ts.map +0 -1
- package/dist/plugins/builtins/response-sanitizer.d.ts +0 -25
- package/dist/plugins/builtins/response-sanitizer.d.ts.map +0 -1
- package/dist/plugins/error-codes.cjs +0 -43
- package/dist/plugins/error-codes.d.ts +0 -34
- package/dist/plugins/error-codes.d.ts.map +0 -1
- package/dist/plugins/error-codes.js +0 -20
- package/dist/plugins/index.cjs +0 -61
- package/dist/plugins/index.d.ts +0 -21
- package/dist/plugins/index.d.ts.map +0 -1
- package/dist/plugins/index.js +0 -30
- package/dist/plugins/loader.cjs +0 -171
- package/dist/plugins/loader.d.ts +0 -30
- package/dist/plugins/loader.d.ts.map +0 -1
- package/dist/plugins/loader.js +0 -145
- package/dist/plugins/manager.cjs +0 -473
- package/dist/plugins/manager.d.ts +0 -106
- package/dist/plugins/manager.d.ts.map +0 -1
- package/dist/plugins/manager.js +0 -450
- package/dist/plugins/registrations/builtins.cjs +0 -51
- package/dist/plugins/registrations/builtins.d.ts +0 -17
- package/dist/plugins/registrations/builtins.d.ts.map +0 -1
- package/dist/plugins/registrations/builtins.js +0 -28
- package/dist/plugins/registry.cjs +0 -63
- package/dist/plugins/registry.d.ts +0 -101
- package/dist/plugins/registry.d.ts.map +0 -1
- package/dist/plugins/registry.js +0 -39
- package/dist/plugins/schemas.cjs +0 -73
- package/dist/plugins/schemas.d.ts +0 -195
- package/dist/plugins/schemas.d.ts.map +0 -1
- package/dist/plugins/schemas.js +0 -47
- package/dist/plugins/types.d.ts.map +0 -1
- package/dist/providers/base-registry.cjs +0 -147
- package/dist/providers/base-registry.d.ts +0 -147
- package/dist/providers/base-registry.d.ts.map +0 -1
- package/dist/providers/base-registry.js +0 -123
- package/dist/providers/discovery.cjs +0 -109
- package/dist/providers/discovery.d.ts +0 -96
- package/dist/providers/discovery.d.ts.map +0 -1
- package/dist/providers/discovery.js +0 -84
- package/dist/providers/index.cjs +0 -24
- package/dist/providers/index.d.ts +0 -32
- package/dist/providers/index.d.ts.map +0 -1
- package/dist/providers/index.js +0 -2
- package/dist/resources/internal-provider.d.ts.map +0 -1
- package/dist/storage/blob/factory.d.ts +0 -37
- package/dist/storage/blob/factory.d.ts.map +0 -1
- package/dist/storage/blob/factory.js +0 -15
- package/dist/storage/blob/local-blob-store.cjs +0 -496
- package/dist/storage/blob/local-blob-store.d.ts +0 -58
- package/dist/storage/blob/local-blob-store.d.ts.map +0 -1
- package/dist/storage/blob/local-blob-store.js +0 -463
- package/dist/storage/blob/memory-blob-store.cjs +0 -326
- package/dist/storage/blob/memory-blob-store.d.ts +0 -66
- package/dist/storage/blob/memory-blob-store.d.ts.map +0 -1
- package/dist/storage/blob/memory-blob-store.js +0 -303
- package/dist/storage/blob/provider.d.ts +0 -50
- package/dist/storage/blob/provider.d.ts.map +0 -1
- package/dist/storage/blob/providers/index.d.ts +0 -8
- package/dist/storage/blob/providers/index.d.ts.map +0 -1
- package/dist/storage/blob/providers/index.js +0 -7
- package/dist/storage/blob/providers/local.cjs +0 -39
- package/dist/storage/blob/providers/local.d.ts +0 -17
- package/dist/storage/blob/providers/local.d.ts.map +0 -1
- package/dist/storage/blob/providers/local.js +0 -16
- package/dist/storage/blob/providers/memory.cjs +0 -39
- package/dist/storage/blob/providers/memory.d.ts +0 -17
- package/dist/storage/blob/providers/memory.d.ts.map +0 -1
- package/dist/storage/blob/providers/memory.js +0 -16
- package/dist/storage/blob/registry.cjs +0 -50
- package/dist/storage/blob/registry.d.ts +0 -42
- package/dist/storage/blob/registry.d.ts.map +0 -1
- package/dist/storage/blob/registry.js +0 -26
- package/dist/storage/blob/schemas.cjs +0 -52
- package/dist/storage/blob/schemas.d.ts +0 -85
- package/dist/storage/blob/schemas.d.ts.map +0 -1
- package/dist/storage/blob/schemas.js +0 -26
- package/dist/storage/cache/factory.cjs +0 -38
- package/dist/storage/cache/factory.d.ts +0 -37
- package/dist/storage/cache/factory.d.ts.map +0 -1
- package/dist/storage/cache/factory.js +0 -15
- package/dist/storage/cache/memory-cache-store.cjs +0 -107
- package/dist/storage/cache/memory-cache-store.d.ts +0 -26
- package/dist/storage/cache/memory-cache-store.d.ts.map +0 -1
- package/dist/storage/cache/memory-cache-store.js +0 -84
- package/dist/storage/cache/provider.cjs +0 -16
- package/dist/storage/cache/provider.d.ts +0 -56
- package/dist/storage/cache/provider.d.ts.map +0 -1
- package/dist/storage/cache/provider.js +0 -0
- package/dist/storage/cache/providers/index.d.ts +0 -8
- package/dist/storage/cache/providers/index.d.ts.map +0 -1
- package/dist/storage/cache/providers/index.js +0 -7
- package/dist/storage/cache/providers/memory.d.ts +0 -17
- package/dist/storage/cache/providers/memory.d.ts.map +0 -1
- package/dist/storage/cache/providers/memory.js +0 -17
- package/dist/storage/cache/providers/redis.cjs +0 -66
- package/dist/storage/cache/providers/redis.d.ts +0 -20
- package/dist/storage/cache/providers/redis.d.ts.map +0 -1
- package/dist/storage/cache/providers/redis.js +0 -33
- package/dist/storage/cache/redis-store.cjs +0 -173
- package/dist/storage/cache/redis-store.d.ts +0 -32
- package/dist/storage/cache/redis-store.d.ts.map +0 -1
- package/dist/storage/cache/redis-store.js +0 -150
- package/dist/storage/cache/registry.cjs +0 -50
- package/dist/storage/cache/registry.d.ts +0 -42
- package/dist/storage/cache/registry.d.ts.map +0 -1
- package/dist/storage/cache/registry.js +0 -26
- package/dist/storage/cache/schemas.cjs +0 -81
- package/dist/storage/cache/schemas.d.ts +0 -150
- package/dist/storage/cache/schemas.d.ts.map +0 -1
- package/dist/storage/cache/schemas.js +0 -55
- package/dist/storage/database/factory.cjs +0 -38
- package/dist/storage/database/factory.d.ts +0 -39
- package/dist/storage/database/factory.d.ts.map +0 -1
- package/dist/storage/database/factory.js +0 -15
- package/dist/storage/database/memory-database-store.cjs +0 -122
- package/dist/storage/database/memory-database-store.d.ts +0 -29
- package/dist/storage/database/memory-database-store.d.ts.map +0 -1
- package/dist/storage/database/memory-database-store.js +0 -99
- package/dist/storage/database/postgres-store.cjs +0 -342
- package/dist/storage/database/postgres-store.d.ts +0 -55
- package/dist/storage/database/postgres-store.d.ts.map +0 -1
- package/dist/storage/database/postgres-store.js +0 -319
- package/dist/storage/database/provider.cjs +0 -16
- package/dist/storage/database/provider.d.ts +0 -56
- package/dist/storage/database/provider.d.ts.map +0 -1
- package/dist/storage/database/provider.js +0 -0
- package/dist/storage/database/providers/index.d.ts +0 -9
- package/dist/storage/database/providers/index.d.ts.map +0 -1
- package/dist/storage/database/providers/index.js +0 -9
- package/dist/storage/database/providers/memory.cjs +0 -40
- package/dist/storage/database/providers/memory.d.ts +0 -16
- package/dist/storage/database/providers/memory.d.ts.map +0 -1
- package/dist/storage/database/providers/memory.js +0 -17
- package/dist/storage/database/providers/postgres.cjs +0 -62
- package/dist/storage/database/providers/postgres.d.ts +0 -19
- package/dist/storage/database/providers/postgres.d.ts.map +0 -1
- package/dist/storage/database/providers/postgres.js +0 -29
- package/dist/storage/database/providers/sqlite.cjs +0 -66
- package/dist/storage/database/providers/sqlite.d.ts +0 -20
- package/dist/storage/database/providers/sqlite.d.ts.map +0 -1
- package/dist/storage/database/providers/sqlite.js +0 -33
- package/dist/storage/database/registry.cjs +0 -50
- package/dist/storage/database/registry.d.ts +0 -42
- package/dist/storage/database/registry.d.ts.map +0 -1
- package/dist/storage/database/registry.js +0 -26
- package/dist/storage/database/schemas.cjs +0 -97
- package/dist/storage/database/schemas.d.ts +0 -226
- package/dist/storage/database/schemas.d.ts.map +0 -1
- package/dist/storage/database/schemas.js +0 -70
- package/dist/storage/database/sqlite-store.cjs +0 -270
- package/dist/storage/database/sqlite-store.d.ts +0 -33
- package/dist/storage/database/sqlite-store.d.ts.map +0 -1
- package/dist/storage/database/sqlite-store.js +0 -237
- package/dist/storage/schemas.cjs +0 -57
- package/dist/storage/schemas.d.ts +0 -347
- package/dist/storage/schemas.d.ts.map +0 -1
- package/dist/storage/schemas.js +0 -37
- package/dist/tools/bash-pattern-utils.cjs +0 -91
- package/dist/tools/bash-pattern-utils.d.ts +0 -58
- package/dist/tools/bash-pattern-utils.d.ts.map +0 -1
- package/dist/tools/bash-pattern-utils.js +0 -64
- package/dist/tools/custom-tool-registry.cjs +0 -64
- package/dist/tools/custom-tool-registry.d.ts +0 -126
- package/dist/tools/custom-tool-registry.d.ts.map +0 -1
- package/dist/tools/custom-tool-registry.js +0 -40
- package/dist/tools/custom-tool-schema-registry.cjs +0 -164
- package/dist/tools/custom-tool-schema-registry.d.ts +0 -86
- package/dist/tools/custom-tool-schema-registry.d.ts.map +0 -1
- package/dist/tools/custom-tool-schema-registry.js +0 -140
- package/dist/tools/internal-tools/constants.d.ts +0 -12
- package/dist/tools/internal-tools/constants.d.ts.map +0 -1
- package/dist/tools/internal-tools/constants.js +0 -12
- package/dist/tools/internal-tools/implementations/ask-user-tool.cjs +0 -57
- package/dist/tools/internal-tools/implementations/ask-user-tool.d.ts +0 -18
- package/dist/tools/internal-tools/implementations/ask-user-tool.d.ts.map +0 -1
- package/dist/tools/internal-tools/implementations/ask-user-tool.js +0 -34
- package/dist/tools/internal-tools/implementations/delegate-to-url-tool.cjs +0 -192
- package/dist/tools/internal-tools/implementations/delegate-to-url-tool.d.ts +0 -33
- package/dist/tools/internal-tools/implementations/delegate-to-url-tool.d.ts.map +0 -1
- package/dist/tools/internal-tools/implementations/delegate-to-url-tool.js +0 -169
- package/dist/tools/internal-tools/implementations/get-resource-tool.cjs +0 -113
- package/dist/tools/internal-tools/implementations/get-resource-tool.d.ts +0 -30
- package/dist/tools/internal-tools/implementations/get-resource-tool.d.ts.map +0 -1
- package/dist/tools/internal-tools/implementations/get-resource-tool.js +0 -90
- package/dist/tools/internal-tools/implementations/invoke-skill-tool.cjs +0 -140
- package/dist/tools/internal-tools/implementations/invoke-skill-tool.d.ts +0 -24
- package/dist/tools/internal-tools/implementations/invoke-skill-tool.d.ts.map +0 -1
- package/dist/tools/internal-tools/implementations/invoke-skill-tool.js +0 -117
- package/dist/tools/internal-tools/implementations/list-resources-tool.cjs +0 -91
- package/dist/tools/internal-tools/implementations/list-resources-tool.d.ts +0 -24
- package/dist/tools/internal-tools/implementations/list-resources-tool.d.ts.map +0 -1
- package/dist/tools/internal-tools/implementations/list-resources-tool.js +0 -68
- package/dist/tools/internal-tools/implementations/search-history-tool.cjs +0 -61
- package/dist/tools/internal-tools/implementations/search-history-tool.d.ts +0 -7
- package/dist/tools/internal-tools/implementations/search-history-tool.d.ts.map +0 -1
- package/dist/tools/internal-tools/implementations/search-history-tool.js +0 -38
- package/dist/tools/internal-tools/index.cjs +0 -26
- package/dist/tools/internal-tools/index.d.ts +0 -4
- package/dist/tools/internal-tools/index.d.ts.map +0 -1
- package/dist/tools/internal-tools/index.js +0 -3
- package/dist/tools/internal-tools/provider.cjs +0 -324
- package/dist/tools/internal-tools/provider.d.ts +0 -114
- package/dist/tools/internal-tools/provider.d.ts.map +0 -1
- package/dist/tools/internal-tools/provider.js +0 -301
- package/dist/tools/internal-tools/registry.cjs +0 -71
- package/dist/tools/internal-tools/registry.d.ts +0 -91
- package/dist/tools/internal-tools/registry.d.ts.map +0 -1
- package/dist/tools/internal-tools/registry.js +0 -47
- /package/dist/{context/compaction/provider.js → agent/agent-options.js} +0 -0
- /package/dist/{image/types.js → agent/runtime-config.js} +0 -0
- /package/dist/{image → hooks}/types.cjs +0 -0
- /package/dist/{plugins → hooks}/types.js +0 -0
- /package/dist/{plugins → workspace}/types.cjs +0 -0
- /package/dist/{storage/blob/provider.js → workspace/types.js} +0 -0
|
@@ -80,13 +80,11 @@ var import_events = require("events");
|
|
|
80
80
|
var import_contributors = require("../systemPrompt/contributors.js");
|
|
81
81
|
var import_resources = require("../resources/index.js");
|
|
82
82
|
var import_utils = require("../context/utils.js");
|
|
83
|
+
var import_storage = require("../storage/index.js");
|
|
83
84
|
var import_prompts = require("../prompts/index.js");
|
|
84
85
|
var import_session = require("../session/index.js");
|
|
85
|
-
var import_factory = require("../logger/factory.js");
|
|
86
|
-
var import_types = require("../logger/v2/types.js");
|
|
87
86
|
var import_decorators = require("../telemetry/decorators.js");
|
|
88
87
|
var import_api = require("@opentelemetry/api");
|
|
89
|
-
var import_schemas = require("../llm/schemas.cjs");
|
|
90
88
|
var import_resolver = require("../llm/resolver.js");
|
|
91
89
|
var import_validation = require("../llm/validation.js");
|
|
92
90
|
var import_errors = require("../llm/errors.js");
|
|
@@ -95,14 +93,23 @@ var import_errors3 = require("../mcp/errors.js");
|
|
|
95
93
|
var import_error_codes = require("../mcp/error-codes.js");
|
|
96
94
|
var import_DextoRuntimeError = require("../errors/DextoRuntimeError.js");
|
|
97
95
|
var import_DextoValidationError = require("../errors/DextoValidationError.js");
|
|
98
|
-
var import_result_bridge = require("../errors/result-bridge.
|
|
99
|
-
var import_result = require("../utils/result.
|
|
96
|
+
var import_result_bridge = require("../errors/result-bridge.js");
|
|
97
|
+
var import_result = require("../utils/result.js");
|
|
100
98
|
var import_resolver2 = require("../mcp/resolver.js");
|
|
101
|
-
var import_registry = require("../llm/registry.js");
|
|
99
|
+
var import_registry = require("../llm/registry/index.js");
|
|
102
100
|
var import_service_initializer2 = require("../utils/service-initializer.js");
|
|
103
|
-
var
|
|
101
|
+
var import_schemas = require("../llm/schemas.js");
|
|
102
|
+
var import_schemas2 = require("../mcp/schemas.js");
|
|
103
|
+
var import_schemas3 = require("../memory/schemas.js");
|
|
104
|
+
var import_schemas4 = require("../prompts/schemas.js");
|
|
105
|
+
var import_schemas5 = require("../resources/schemas.js");
|
|
106
|
+
var import_schemas6 = require("../session/schemas.js");
|
|
107
|
+
var import_schemas7 = require("../systemPrompt/schemas.js");
|
|
108
|
+
var import_schemas8 = require("../tools/schemas.js");
|
|
109
|
+
var import_schemas9 = require("../telemetry/schemas.js");
|
|
110
|
+
var import_schemas10 = require("./schemas.js");
|
|
104
111
|
var import_events2 = require("../events/index.js");
|
|
105
|
-
var import_safe_stringify = require("../utils/safe-stringify.
|
|
112
|
+
var import_safe_stringify = require("../utils/safe-stringify.js");
|
|
106
113
|
var import_title_generator = require("../session/title-generator.js");
|
|
107
114
|
var _DextoAgent_decorators, _init;
|
|
108
115
|
const requiredServices = [
|
|
@@ -112,6 +119,7 @@ const requiredServices = [
|
|
|
112
119
|
"agentEventBus",
|
|
113
120
|
"stateManager",
|
|
114
121
|
"sessionManager",
|
|
122
|
+
"workspaceManager",
|
|
115
123
|
"searchService",
|
|
116
124
|
"memoryManager"
|
|
117
125
|
];
|
|
@@ -123,44 +131,14 @@ _DextoAgent_decorators = [(0, import_decorators.InstrumentClass)({
|
|
|
123
131
|
"getConfig",
|
|
124
132
|
"getEffectiveConfig",
|
|
125
133
|
"registerSubscriber",
|
|
134
|
+
"on",
|
|
135
|
+
"once",
|
|
136
|
+
"off",
|
|
137
|
+
"emit",
|
|
126
138
|
"ensureStarted"
|
|
127
139
|
]
|
|
128
140
|
})];
|
|
129
|
-
class
|
|
130
|
-
/**
|
|
131
|
-
* Creates a DextoAgent instance.
|
|
132
|
-
*
|
|
133
|
-
* @param config - Agent configuration (validated and enriched)
|
|
134
|
-
* @param configPath - Optional path to config file (for relative path resolution)
|
|
135
|
-
* @param options - Validation options
|
|
136
|
-
* @param options.strict - When true (default), enforces API key and baseURL requirements.
|
|
137
|
-
* When false, allows missing credentials for interactive configuration.
|
|
138
|
-
*/
|
|
139
|
-
constructor(config, configPath, options) {
|
|
140
|
-
this.configPath = configPath;
|
|
141
|
-
const schema = options?.strict === false ? (0, import_schemas2.createAgentConfigSchema)({ strict: false }) : import_schemas2.AgentConfigSchema;
|
|
142
|
-
this.config = schema.parse(config);
|
|
143
|
-
this.logger = (0, import_factory.createLogger)({
|
|
144
|
-
config: this.config.logger,
|
|
145
|
-
agentId: this.config.agentId,
|
|
146
|
-
component: import_types.DextoLogComponent.AGENT
|
|
147
|
-
});
|
|
148
|
-
const serviceOverrides = {};
|
|
149
|
-
if (options?.sessionLoggerFactory) {
|
|
150
|
-
serviceOverrides.sessionLoggerFactory = options.sessionLoggerFactory;
|
|
151
|
-
}
|
|
152
|
-
if (options && "mcpAuthProviderFactory" in options) {
|
|
153
|
-
serviceOverrides.mcpAuthProviderFactory = options.mcpAuthProviderFactory ?? null;
|
|
154
|
-
}
|
|
155
|
-
if (Object.keys(serviceOverrides).length > 0) {
|
|
156
|
-
this.serviceOverrides = serviceOverrides;
|
|
157
|
-
}
|
|
158
|
-
if (options?.mcpAuthProviderFactory) {
|
|
159
|
-
this.mcpAuthProviderFactory = options.mcpAuthProviderFactory;
|
|
160
|
-
}
|
|
161
|
-
this.agentEventBus = new import_events2.AgentEventBus();
|
|
162
|
-
this.logger.info("DextoAgent created.");
|
|
163
|
-
}
|
|
141
|
+
let _DextoAgent = class _DextoAgent {
|
|
164
142
|
/**
|
|
165
143
|
* These services are public for use by the outside world
|
|
166
144
|
* This gives users the option to use methods of the services directly if they know what they are doing
|
|
@@ -172,6 +150,7 @@ class DextoAgent {
|
|
|
172
150
|
promptManager;
|
|
173
151
|
stateManager;
|
|
174
152
|
sessionManager;
|
|
153
|
+
workspaceManager;
|
|
175
154
|
toolManager;
|
|
176
155
|
resourceManager;
|
|
177
156
|
memoryManager;
|
|
@@ -194,9 +173,87 @@ class DextoAgent {
|
|
|
194
173
|
// Active stream controllers per session - allows cancel() to abort iterators
|
|
195
174
|
activeStreamControllers = /* @__PURE__ */ new Map();
|
|
196
175
|
// Host overrides for service initialization (e.g. session logger factory)
|
|
197
|
-
|
|
176
|
+
overrides;
|
|
177
|
+
// DI-provided local tools.
|
|
178
|
+
tools;
|
|
179
|
+
compactionStrategy;
|
|
198
180
|
// Logger instance for this agent (dependency injection)
|
|
199
181
|
logger;
|
|
182
|
+
/**
|
|
183
|
+
* Validate + normalize runtime settings.
|
|
184
|
+
*
|
|
185
|
+
* This is the single validation boundary for programmatic (code-first) construction.
|
|
186
|
+
* Host layers may validate earlier (e.g. YAML parsing), but core always normalizes
|
|
187
|
+
* runtime settings before use.
|
|
188
|
+
*/
|
|
189
|
+
static validateConfig(options) {
|
|
190
|
+
return {
|
|
191
|
+
agentId: options.agentId,
|
|
192
|
+
llm: import_schemas.LLMConfigSchema.parse(options.llm),
|
|
193
|
+
systemPrompt: import_schemas7.SystemPromptConfigSchema.parse(options.systemPrompt),
|
|
194
|
+
mcpServers: import_schemas2.ServersConfigSchema.parse(options.mcpServers ?? {}),
|
|
195
|
+
sessions: import_schemas6.SessionConfigSchema.parse(options.sessions ?? {}),
|
|
196
|
+
permissions: import_schemas8.PermissionsConfigSchema.parse(options.permissions ?? {}),
|
|
197
|
+
elicitation: import_schemas8.ElicitationConfigSchema.parse(options.elicitation ?? {}),
|
|
198
|
+
resources: import_schemas5.ResourcesConfigSchema.parse(options.resources ?? []),
|
|
199
|
+
prompts: import_schemas4.PromptsSchema.parse(options.prompts),
|
|
200
|
+
...options.agentCard !== void 0 && {
|
|
201
|
+
agentCard: import_schemas10.AgentCardSchema.parse(options.agentCard)
|
|
202
|
+
},
|
|
203
|
+
...options.greeting !== void 0 && { greeting: options.greeting },
|
|
204
|
+
...options.telemetry !== void 0 && {
|
|
205
|
+
telemetry: import_schemas9.OtelConfigurationSchema.parse(options.telemetry)
|
|
206
|
+
},
|
|
207
|
+
...options.memories !== void 0 && {
|
|
208
|
+
memories: import_schemas3.MemoriesConfigSchema.parse(options.memories)
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Creates a DextoAgent instance.
|
|
214
|
+
*
|
|
215
|
+
* Constructor options are DI-first:
|
|
216
|
+
* - runtime settings (validated + defaulted by core)
|
|
217
|
+
* - concrete services (logger/tools/hooks/storage backends)
|
|
218
|
+
* - optional internal service overrides (session logging, auth factories, etc.)
|
|
219
|
+
*/
|
|
220
|
+
constructor(options) {
|
|
221
|
+
const {
|
|
222
|
+
logger,
|
|
223
|
+
storage,
|
|
224
|
+
tools: toolsInput,
|
|
225
|
+
hooks: hooksInput,
|
|
226
|
+
compaction,
|
|
227
|
+
overrides: overridesInput,
|
|
228
|
+
...runtimeSettings
|
|
229
|
+
} = options;
|
|
230
|
+
const tools = toolsInput ?? [];
|
|
231
|
+
const hooks = hooksInput ?? [];
|
|
232
|
+
this.config = _DextoAgent.validateConfig(runtimeSettings);
|
|
233
|
+
this.logger = logger;
|
|
234
|
+
this.tools = tools;
|
|
235
|
+
this.compactionStrategy = compaction ?? null;
|
|
236
|
+
const overrides = { ...overridesInput ?? {} };
|
|
237
|
+
if (overrides.storageManager === void 0) {
|
|
238
|
+
overrides.storageManager = new import_storage.StorageManager(
|
|
239
|
+
{
|
|
240
|
+
cache: storage.cache,
|
|
241
|
+
database: storage.database,
|
|
242
|
+
blobStore: storage.blob
|
|
243
|
+
},
|
|
244
|
+
this.logger
|
|
245
|
+
);
|
|
246
|
+
}
|
|
247
|
+
if (overrides.hooks === void 0) {
|
|
248
|
+
overrides.hooks = hooks;
|
|
249
|
+
}
|
|
250
|
+
this.overrides = overrides;
|
|
251
|
+
if (overrides.mcpAuthProviderFactory !== void 0) {
|
|
252
|
+
this.mcpAuthProviderFactory = overrides.mcpAuthProviderFactory;
|
|
253
|
+
}
|
|
254
|
+
this.agentEventBus = new import_events2.AgentEventBus();
|
|
255
|
+
this.logger.info("DextoAgent created.");
|
|
256
|
+
}
|
|
200
257
|
/**
|
|
201
258
|
* Starts the agent by initializing all async services.
|
|
202
259
|
* This method handles storage backends, MCP connections, session manager initialization, and other async operations.
|
|
@@ -212,10 +269,10 @@ class DextoAgent {
|
|
|
212
269
|
this.logger.info("Starting DextoAgent...");
|
|
213
270
|
const services = await (0, import_service_initializer2.createAgentServices)(
|
|
214
271
|
this.config,
|
|
215
|
-
this.configPath,
|
|
216
272
|
this.logger,
|
|
217
273
|
this.agentEventBus,
|
|
218
|
-
this.
|
|
274
|
+
this.overrides,
|
|
275
|
+
this.compactionStrategy
|
|
219
276
|
);
|
|
220
277
|
if (this.mcpAuthProviderFactory) {
|
|
221
278
|
services.mcpManager.setAuthProviderFactory(this.mcpAuthProviderFactory);
|
|
@@ -227,11 +284,11 @@ class DextoAgent {
|
|
|
227
284
|
);
|
|
228
285
|
}
|
|
229
286
|
}
|
|
230
|
-
const needsHandler = this.config.
|
|
287
|
+
const needsHandler = this.config.permissions.mode === "manual" || this.config.elicitation.enabled;
|
|
231
288
|
if (needsHandler && !this.approvalHandler) {
|
|
232
289
|
const reasons = [];
|
|
233
|
-
if (this.config.
|
|
234
|
-
reasons.push('
|
|
290
|
+
if (this.config.permissions.mode === "manual") {
|
|
291
|
+
reasons.push('permissions mode is "manual"');
|
|
235
292
|
}
|
|
236
293
|
if (this.config.elicitation.enabled) {
|
|
237
294
|
reasons.push("elicitation is enabled");
|
|
@@ -240,7 +297,7 @@ class DextoAgent {
|
|
|
240
297
|
`An approval handler is required but not configured (${reasons.join(" and ")}).
|
|
241
298
|
Either:
|
|
242
299
|
\u2022 Call agent.setApprovalHandler() before starting
|
|
243
|
-
\u2022 Set
|
|
300
|
+
\u2022 Set permissions: { mode: "auto-approve" } or { mode: "auto-deny" }
|
|
244
301
|
\u2022 Disable elicitation: { enabled: false }`
|
|
245
302
|
);
|
|
246
303
|
}
|
|
@@ -254,6 +311,7 @@ Either:
|
|
|
254
311
|
systemPromptManager: services.systemPromptManager,
|
|
255
312
|
stateManager: services.stateManager,
|
|
256
313
|
sessionManager: services.sessionManager,
|
|
314
|
+
workspaceManager: services.workspaceManager,
|
|
257
315
|
memoryManager: services.memoryManager,
|
|
258
316
|
services
|
|
259
317
|
});
|
|
@@ -267,9 +325,27 @@ Either:
|
|
|
267
325
|
);
|
|
268
326
|
await promptManager.initialize();
|
|
269
327
|
Object.assign(this, { promptManager });
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
328
|
+
const toolExecutionStorage = {
|
|
329
|
+
blob: services.storageManager.getBlobStore(),
|
|
330
|
+
database: services.storageManager.getDatabase(),
|
|
331
|
+
cache: services.storageManager.getCache()
|
|
332
|
+
};
|
|
333
|
+
const toolExecutionServices = {
|
|
334
|
+
approval: services.approvalManager,
|
|
335
|
+
search: services.searchService,
|
|
336
|
+
resources: services.resourceManager,
|
|
337
|
+
prompts: promptManager,
|
|
338
|
+
mcp: services.mcpManager,
|
|
339
|
+
taskForker: null
|
|
340
|
+
};
|
|
341
|
+
services.toolManager.setToolExecutionContextFactory((baseContext) => ({
|
|
342
|
+
...baseContext,
|
|
343
|
+
agent: this,
|
|
344
|
+
storage: toolExecutionStorage,
|
|
345
|
+
services: toolExecutionServices
|
|
346
|
+
}));
|
|
347
|
+
const agentTools = this.tools;
|
|
348
|
+
if (agentTools.some((t) => t.id === "invoke_skill")) {
|
|
273
349
|
const skillsContributor = new import_contributors.SkillsContributor(
|
|
274
350
|
"skills",
|
|
275
351
|
50,
|
|
@@ -280,6 +356,7 @@ Either:
|
|
|
280
356
|
services.systemPromptManager.addContributor(skillsContributor);
|
|
281
357
|
this.logger.debug("Added SkillsContributor to system prompt");
|
|
282
358
|
}
|
|
359
|
+
services.toolManager.setTools(agentTools);
|
|
283
360
|
await services.toolManager.initialize();
|
|
284
361
|
this.searchService = services.searchService;
|
|
285
362
|
this._isStarted = true;
|
|
@@ -323,13 +400,22 @@ Either:
|
|
|
323
400
|
shutdownErrors.push(new Error(`SessionManager cleanup failed: ${err.message}`));
|
|
324
401
|
}
|
|
325
402
|
try {
|
|
326
|
-
if (this.
|
|
327
|
-
await this.
|
|
328
|
-
this.logger.debug("
|
|
403
|
+
if (this.toolManager) {
|
|
404
|
+
await this.toolManager.cleanup();
|
|
405
|
+
this.logger.debug("ToolManager cleaned up successfully");
|
|
406
|
+
}
|
|
407
|
+
} catch (error) {
|
|
408
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
409
|
+
shutdownErrors.push(new Error(`ToolManager cleanup failed: ${err.message}`));
|
|
410
|
+
}
|
|
411
|
+
try {
|
|
412
|
+
if (this.services?.hookManager) {
|
|
413
|
+
await this.services.hookManager.cleanup();
|
|
414
|
+
this.logger.debug("HookManager cleaned up successfully");
|
|
329
415
|
}
|
|
330
416
|
} catch (error) {
|
|
331
417
|
const err = error instanceof Error ? error : new Error(String(error));
|
|
332
|
-
shutdownErrors.push(new Error(`
|
|
418
|
+
shutdownErrors.push(new Error(`HookManager cleanup failed: ${err.message}`));
|
|
333
419
|
}
|
|
334
420
|
try {
|
|
335
421
|
if (this.mcpManager) {
|
|
@@ -340,6 +426,15 @@ Either:
|
|
|
340
426
|
const err = error instanceof Error ? error : new Error(String(error));
|
|
341
427
|
shutdownErrors.push(new Error(`MCPManager disconnect failed: ${err.message}`));
|
|
342
428
|
}
|
|
429
|
+
try {
|
|
430
|
+
if (this.resourceManager) {
|
|
431
|
+
this.resourceManager.cleanup();
|
|
432
|
+
this.logger.debug("ResourceManager cleaned up successfully");
|
|
433
|
+
}
|
|
434
|
+
} catch (error) {
|
|
435
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
436
|
+
shutdownErrors.push(new Error(`ResourceManager cleanup failed: ${err.message}`));
|
|
437
|
+
}
|
|
343
438
|
try {
|
|
344
439
|
if (this.services?.storageManager) {
|
|
345
440
|
await this.services.storageManager.disconnect();
|
|
@@ -357,6 +452,7 @@ Either:
|
|
|
357
452
|
} else {
|
|
358
453
|
this.logger.info("DextoAgent stopped successfully.");
|
|
359
454
|
}
|
|
455
|
+
this.agentEventBus.emit("agent:stopped");
|
|
360
456
|
} catch (error) {
|
|
361
457
|
this.logger.error("Failed to stop DextoAgent", {
|
|
362
458
|
error: error instanceof Error ? error.message : String(error)
|
|
@@ -377,6 +473,26 @@ Either:
|
|
|
377
473
|
subscriber.subscribe(this.agentEventBus);
|
|
378
474
|
}
|
|
379
475
|
}
|
|
476
|
+
/**
|
|
477
|
+
* Convenience event subscription APIs (typed delegates to {@link AgentEventBus}).
|
|
478
|
+
*
|
|
479
|
+
* Prefer these over reaching into the internal event bus directly.
|
|
480
|
+
*/
|
|
481
|
+
on(event, listener, options) {
|
|
482
|
+
this.agentEventBus.on(event, listener, options);
|
|
483
|
+
return this;
|
|
484
|
+
}
|
|
485
|
+
once(event, listener, options) {
|
|
486
|
+
this.agentEventBus.once(event, listener, options);
|
|
487
|
+
return this;
|
|
488
|
+
}
|
|
489
|
+
off(event, listener) {
|
|
490
|
+
this.agentEventBus.off(event, listener);
|
|
491
|
+
return this;
|
|
492
|
+
}
|
|
493
|
+
emit(event, ...args) {
|
|
494
|
+
return this.agentEventBus.emit(event, ...args);
|
|
495
|
+
}
|
|
380
496
|
/**
|
|
381
497
|
* Restart the agent by stopping and starting it.
|
|
382
498
|
* Automatically re-subscribes all registered event subscribers to the new event bus.
|
|
@@ -629,6 +745,14 @@ Either:
|
|
|
629
745
|
};
|
|
630
746
|
this.agentEventBus.on("llm:tool-call", toolCallListener, { signal: cleanupSignal });
|
|
631
747
|
listeners.push({ event: "llm:tool-call", listener: toolCallListener });
|
|
748
|
+
const toolCallPartialListener = (data) => {
|
|
749
|
+
if (data.sessionId !== sessionId) return;
|
|
750
|
+
eventQueue.push({ name: "llm:tool-call-partial", ...data });
|
|
751
|
+
};
|
|
752
|
+
this.agentEventBus.on("llm:tool-call-partial", toolCallPartialListener, {
|
|
753
|
+
signal: cleanupSignal
|
|
754
|
+
});
|
|
755
|
+
listeners.push({ event: "llm:tool-call-partial", listener: toolCallPartialListener });
|
|
632
756
|
const toolResultListener = (data) => {
|
|
633
757
|
if (data.sessionId !== sessionId) return;
|
|
634
758
|
eventQueue.push({ name: "llm:tool-result", ...data });
|
|
@@ -1006,6 +1130,36 @@ Either:
|
|
|
1006
1130
|
}
|
|
1007
1131
|
return !!streamController;
|
|
1008
1132
|
}
|
|
1133
|
+
// ============= WORKSPACE MANAGEMENT =============
|
|
1134
|
+
/**
|
|
1135
|
+
* Sets the active workspace for this runtime.
|
|
1136
|
+
* The workspace context is persisted and emitted via the agent event bus.
|
|
1137
|
+
*/
|
|
1138
|
+
async setWorkspace(input) {
|
|
1139
|
+
this.ensureStarted();
|
|
1140
|
+
return await this.workspaceManager.setWorkspace(input);
|
|
1141
|
+
}
|
|
1142
|
+
/**
|
|
1143
|
+
* Gets the currently active workspace, if any.
|
|
1144
|
+
*/
|
|
1145
|
+
async getWorkspace() {
|
|
1146
|
+
this.ensureStarted();
|
|
1147
|
+
return await this.workspaceManager.getWorkspace();
|
|
1148
|
+
}
|
|
1149
|
+
/**
|
|
1150
|
+
* Clears the active workspace for this runtime.
|
|
1151
|
+
*/
|
|
1152
|
+
async clearWorkspace() {
|
|
1153
|
+
this.ensureStarted();
|
|
1154
|
+
await this.workspaceManager.clearWorkspace();
|
|
1155
|
+
}
|
|
1156
|
+
/**
|
|
1157
|
+
* Lists all known workspaces in storage.
|
|
1158
|
+
*/
|
|
1159
|
+
async listWorkspaces() {
|
|
1160
|
+
this.ensureStarted();
|
|
1161
|
+
return await this.workspaceManager.listWorkspaces();
|
|
1162
|
+
}
|
|
1009
1163
|
// ============= SESSION MANAGEMENT =============
|
|
1010
1164
|
/**
|
|
1011
1165
|
* Creates a new chat session or returns an existing one.
|
|
@@ -1279,7 +1433,7 @@ Either:
|
|
|
1279
1433
|
return null;
|
|
1280
1434
|
}
|
|
1281
1435
|
const contributorContext = { mcpManager: this.mcpManager };
|
|
1282
|
-
const tools = await llmService.
|
|
1436
|
+
const tools = await llmService.getEnabledTools();
|
|
1283
1437
|
const beforeEstimate = await contextManager.getContextTokenEstimate(
|
|
1284
1438
|
contributorContext,
|
|
1285
1439
|
tools
|
|
@@ -1290,7 +1444,11 @@ Either:
|
|
|
1290
1444
|
estimatedTokens: originalTokens,
|
|
1291
1445
|
sessionId
|
|
1292
1446
|
});
|
|
1293
|
-
const summaryMessages = await compactionStrategy.compact(history
|
|
1447
|
+
const summaryMessages = await compactionStrategy.compact(history, {
|
|
1448
|
+
sessionId,
|
|
1449
|
+
model: llmService.getLanguageModel(),
|
|
1450
|
+
logger: session.logger
|
|
1451
|
+
});
|
|
1294
1452
|
if (summaryMessages.length === 0) {
|
|
1295
1453
|
this.logger.debug(`Compaction skipped for session ${sessionId} - nothing to compact`);
|
|
1296
1454
|
this.agentEventBus.emit("context:compacted", {
|
|
@@ -1354,28 +1512,24 @@ Either:
|
|
|
1354
1512
|
const contextManager = session.getContextManager();
|
|
1355
1513
|
const contributorContext = { mcpManager: this.mcpManager };
|
|
1356
1514
|
const llmService = session.getLLMService();
|
|
1357
|
-
const tools = await llmService.
|
|
1515
|
+
const tools = await llmService.getEnabledTools();
|
|
1358
1516
|
const tokenEstimate = await contextManager.getContextTokenEstimate(
|
|
1359
1517
|
contributorContext,
|
|
1360
1518
|
tools
|
|
1361
1519
|
);
|
|
1362
1520
|
const history = await contextManager.getHistory();
|
|
1363
1521
|
const runtimeConfig = this.stateManager.getRuntimeConfig(sessionId);
|
|
1364
|
-
const compactionConfig = runtimeConfig.compaction;
|
|
1365
1522
|
const modelContextWindow = contextManager.getMaxInputTokens();
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
}
|
|
1370
|
-
const
|
|
1371
|
-
if (thresholdPercent < 1) {
|
|
1372
|
-
maxContextTokens = Math.floor(maxContextTokens * thresholdPercent);
|
|
1373
|
-
}
|
|
1523
|
+
const compactionStrategy = this.compactionStrategy;
|
|
1524
|
+
const compactionSettings = compactionStrategy?.getSettings();
|
|
1525
|
+
const thresholdPercent = compactionSettings && compactionSettings.enabled ? compactionSettings.thresholdPercent : 1;
|
|
1526
|
+
const modelLimits = compactionStrategy ? compactionStrategy.getModelLimits(modelContextWindow) : { contextWindow: modelContextWindow };
|
|
1527
|
+
const maxContextTokens = thresholdPercent < 1 ? Math.floor(modelLimits.contextWindow * thresholdPercent) : modelLimits.contextWindow;
|
|
1374
1528
|
const hasSummary = history.some(
|
|
1375
1529
|
(msg) => msg.metadata?.isSummary === true || msg.metadata?.isSessionSummary === true
|
|
1376
1530
|
);
|
|
1377
1531
|
const llmConfig = runtimeConfig.llm;
|
|
1378
|
-
const { getModelDisplayName } = await import("../llm/registry.js");
|
|
1532
|
+
const { getModelDisplayName } = await import("../llm/registry/index.js");
|
|
1379
1533
|
const modelDisplayName = getModelDisplayName(llmConfig.model, llmConfig.provider);
|
|
1380
1534
|
const estimatedTokens = tokenEstimate.estimated;
|
|
1381
1535
|
const autoCompactBuffer = thresholdPercent > 0 && thresholdPercent < 1 ? Math.floor(maxContextTokens * (1 - thresholdPercent) / thresholdPercent) : 0;
|
|
@@ -1548,7 +1702,7 @@ Either:
|
|
|
1548
1702
|
/**
|
|
1549
1703
|
* Gets supported models for a specific provider.
|
|
1550
1704
|
* Returns model information including metadata for the specified provider only.
|
|
1551
|
-
* For gateway providers like 'dexto' with supportsAllRegistryModels, returns
|
|
1705
|
+
* For gateway providers like 'dexto-nova' with supportsAllRegistryModels, returns
|
|
1552
1706
|
* all models from all accessible providers with their original provider info.
|
|
1553
1707
|
*
|
|
1554
1708
|
* @param provider The provider to get models for
|
|
@@ -1652,6 +1806,70 @@ Either:
|
|
|
1652
1806
|
throw import_errors3.MCPError.connectionFailed(name, errorMessage);
|
|
1653
1807
|
}
|
|
1654
1808
|
}
|
|
1809
|
+
/**
|
|
1810
|
+
* Updates an existing MCP server configuration and reconnects if needed.
|
|
1811
|
+
* This is used when editing server params (timeout, headers, env, etc.).
|
|
1812
|
+
*
|
|
1813
|
+
* @param name The name of the server to update.
|
|
1814
|
+
* @param config The updated configuration object.
|
|
1815
|
+
* @throws MCPError if validation fails or reconnect fails.
|
|
1816
|
+
*/
|
|
1817
|
+
async updateMcpServer(name, config) {
|
|
1818
|
+
this.ensureStarted();
|
|
1819
|
+
const currentConfig = this.stateManager.getRuntimeConfig().mcpServers[name];
|
|
1820
|
+
if (!currentConfig) {
|
|
1821
|
+
throw import_errors3.MCPError.serverNotFound(name);
|
|
1822
|
+
}
|
|
1823
|
+
const existingServerNames = Object.keys(this.stateManager.getRuntimeConfig().mcpServers);
|
|
1824
|
+
const validation = (0, import_resolver2.resolveAndValidateMcpServerConfig)(name, config, existingServerNames);
|
|
1825
|
+
const validatedConfig = (0, import_result_bridge.ensureOk)(validation, this.logger);
|
|
1826
|
+
this.stateManager.setMcpServer(name, validatedConfig);
|
|
1827
|
+
const shouldEnable = validatedConfig.enabled !== false;
|
|
1828
|
+
const hasClient = this.mcpManager.getClients().has(name);
|
|
1829
|
+
if (!shouldEnable) {
|
|
1830
|
+
if (hasClient) {
|
|
1831
|
+
await this.mcpManager.removeClient(name);
|
|
1832
|
+
await this.toolManager.refresh();
|
|
1833
|
+
}
|
|
1834
|
+
this.logger.info(`MCP server '${name}' updated (disabled)`);
|
|
1835
|
+
return;
|
|
1836
|
+
}
|
|
1837
|
+
try {
|
|
1838
|
+
if (hasClient) {
|
|
1839
|
+
await this.mcpManager.removeClient(name);
|
|
1840
|
+
}
|
|
1841
|
+
await this.mcpManager.connectServer(name, validatedConfig);
|
|
1842
|
+
await this.toolManager.refresh();
|
|
1843
|
+
this.agentEventBus.emit("mcp:server-connected", { name, success: true });
|
|
1844
|
+
this.agentEventBus.emit("tools:available-updated", {
|
|
1845
|
+
tools: Object.keys(await this.toolManager.getAllTools()),
|
|
1846
|
+
source: "mcp"
|
|
1847
|
+
});
|
|
1848
|
+
this.logger.info(`MCP server '${name}' updated and reconnected successfully`);
|
|
1849
|
+
const warnings = validation.issues.filter((i) => i.severity === "warning");
|
|
1850
|
+
if (warnings.length > 0) {
|
|
1851
|
+
this.logger.warn(
|
|
1852
|
+
`MCP server updated with warnings: ${warnings.map((w) => w.message).join(", ")}`
|
|
1853
|
+
);
|
|
1854
|
+
}
|
|
1855
|
+
} catch (error) {
|
|
1856
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
1857
|
+
this.logger.error(`Failed to update MCP server '${name}': ${errorMessage}`);
|
|
1858
|
+
this.stateManager.setMcpServer(name, currentConfig);
|
|
1859
|
+
if (currentConfig.enabled !== false) {
|
|
1860
|
+
try {
|
|
1861
|
+
await this.mcpManager.connectServer(name, currentConfig);
|
|
1862
|
+
await this.toolManager.refresh();
|
|
1863
|
+
} catch (reconnectError) {
|
|
1864
|
+
const reconnectMsg = reconnectError instanceof Error ? reconnectError.message : String(reconnectError);
|
|
1865
|
+
this.logger.error(
|
|
1866
|
+
`Failed to restore MCP server '${name}' after update error: ${reconnectMsg}`
|
|
1867
|
+
);
|
|
1868
|
+
}
|
|
1869
|
+
}
|
|
1870
|
+
throw import_errors3.MCPError.connectionFailed(name, errorMessage);
|
|
1871
|
+
}
|
|
1872
|
+
}
|
|
1655
1873
|
/**
|
|
1656
1874
|
* @deprecated Use `addMcpServer` instead. This method will be removed in a future version.
|
|
1657
1875
|
*/
|
|
@@ -1807,6 +2025,90 @@ Either:
|
|
|
1807
2025
|
this.ensureStarted();
|
|
1808
2026
|
return await this.toolManager.getAllTools();
|
|
1809
2027
|
}
|
|
2028
|
+
/**
|
|
2029
|
+
* Gets tools enabled for LLM context (applies session overrides + global preferences).
|
|
2030
|
+
*/
|
|
2031
|
+
async getEnabledTools(sessionId) {
|
|
2032
|
+
this.ensureStarted();
|
|
2033
|
+
if (sessionId !== void 0 && (!sessionId || typeof sessionId !== "string")) {
|
|
2034
|
+
throw import_errors2.AgentError.apiValidationError("sessionId must be a non-empty string");
|
|
2035
|
+
}
|
|
2036
|
+
return this.toolManager.filterToolsForSession(
|
|
2037
|
+
await this.toolManager.getAllTools(),
|
|
2038
|
+
sessionId
|
|
2039
|
+
);
|
|
2040
|
+
}
|
|
2041
|
+
/**
|
|
2042
|
+
* Get global disabled tools (agent preferences).
|
|
2043
|
+
*/
|
|
2044
|
+
getGlobalDisabledTools() {
|
|
2045
|
+
this.ensureStarted();
|
|
2046
|
+
return this.toolManager.getGlobalDisabledTools();
|
|
2047
|
+
}
|
|
2048
|
+
/**
|
|
2049
|
+
* Set global disabled tools (agent preferences).
|
|
2050
|
+
*/
|
|
2051
|
+
setGlobalDisabledTools(toolNames) {
|
|
2052
|
+
this.ensureStarted();
|
|
2053
|
+
if (!Array.isArray(toolNames) || toolNames.some((name) => !name || typeof name !== "string")) {
|
|
2054
|
+
throw import_errors2.AgentError.apiValidationError("toolNames must be an array of non-empty strings");
|
|
2055
|
+
}
|
|
2056
|
+
this.toolManager.setGlobalDisabledTools(toolNames);
|
|
2057
|
+
}
|
|
2058
|
+
/**
|
|
2059
|
+
* Set session-level disabled tools (session override).
|
|
2060
|
+
*/
|
|
2061
|
+
setSessionDisabledTools(sessionId, toolNames) {
|
|
2062
|
+
this.ensureStarted();
|
|
2063
|
+
if (!sessionId || typeof sessionId !== "string") {
|
|
2064
|
+
throw import_errors2.AgentError.apiValidationError(
|
|
2065
|
+
"sessionId is required and must be a non-empty string"
|
|
2066
|
+
);
|
|
2067
|
+
}
|
|
2068
|
+
if (!Array.isArray(toolNames) || toolNames.some((name) => !name || typeof name !== "string")) {
|
|
2069
|
+
throw import_errors2.AgentError.apiValidationError("toolNames must be an array of non-empty strings");
|
|
2070
|
+
}
|
|
2071
|
+
this.toolManager.setSessionDisabledTools(sessionId, toolNames);
|
|
2072
|
+
}
|
|
2073
|
+
/**
|
|
2074
|
+
* Clear session-level disabled tools (session override).
|
|
2075
|
+
*/
|
|
2076
|
+
clearSessionDisabledTools(sessionId) {
|
|
2077
|
+
this.ensureStarted();
|
|
2078
|
+
if (!sessionId || typeof sessionId !== "string") {
|
|
2079
|
+
throw import_errors2.AgentError.apiValidationError(
|
|
2080
|
+
"sessionId is required and must be a non-empty string"
|
|
2081
|
+
);
|
|
2082
|
+
}
|
|
2083
|
+
this.toolManager.clearSessionDisabledTools(sessionId);
|
|
2084
|
+
}
|
|
2085
|
+
/**
|
|
2086
|
+
* Get session-level auto-approve tools.
|
|
2087
|
+
*/
|
|
2088
|
+
getSessionAutoApproveTools(sessionId) {
|
|
2089
|
+
this.ensureStarted();
|
|
2090
|
+
if (!sessionId || typeof sessionId !== "string") {
|
|
2091
|
+
throw import_errors2.AgentError.apiValidationError(
|
|
2092
|
+
"sessionId is required and must be a non-empty string"
|
|
2093
|
+
);
|
|
2094
|
+
}
|
|
2095
|
+
return this.toolManager.getSessionUserAutoApproveTools(sessionId) ?? [];
|
|
2096
|
+
}
|
|
2097
|
+
/**
|
|
2098
|
+
* Set session-level auto-approve tools (user selection).
|
|
2099
|
+
*/
|
|
2100
|
+
setSessionAutoApproveTools(sessionId, toolNames) {
|
|
2101
|
+
this.ensureStarted();
|
|
2102
|
+
if (!sessionId || typeof sessionId !== "string") {
|
|
2103
|
+
throw import_errors2.AgentError.apiValidationError(
|
|
2104
|
+
"sessionId is required and must be a non-empty string"
|
|
2105
|
+
);
|
|
2106
|
+
}
|
|
2107
|
+
if (!Array.isArray(toolNames) || toolNames.some((name) => !name || typeof name !== "string")) {
|
|
2108
|
+
throw import_errors2.AgentError.apiValidationError("toolNames must be an array of non-empty strings");
|
|
2109
|
+
}
|
|
2110
|
+
this.toolManager.setSessionUserAutoApproveTools(sessionId, toolNames);
|
|
2111
|
+
}
|
|
1810
2112
|
/**
|
|
1811
2113
|
* Gets all connected MCP clients.
|
|
1812
2114
|
* Used by the API layer to inspect client status.
|
|
@@ -2075,90 +2377,17 @@ Either:
|
|
|
2075
2377
|
this.ensureStarted();
|
|
2076
2378
|
return sessionId ? this.stateManager.getRuntimeConfig(sessionId) : this.stateManager.getRuntimeConfig();
|
|
2077
2379
|
}
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
*/
|
|
2084
|
-
getAgentFilePath() {
|
|
2085
|
-
if (!this.configPath) {
|
|
2086
|
-
throw import_errors2.AgentError.noConfigPath();
|
|
2087
|
-
}
|
|
2088
|
-
return this.configPath;
|
|
2089
|
-
}
|
|
2090
|
-
/**
|
|
2091
|
-
* Reloads the agent configuration with a new config object.
|
|
2092
|
-
* Validates the new config, detects what changed, and automatically
|
|
2093
|
-
* restarts the agent if necessary to apply the changes.
|
|
2094
|
-
*
|
|
2095
|
-
* @param newConfig The new agent configuration to apply
|
|
2096
|
-
* @returns Object containing whether agent was restarted and list of changes applied
|
|
2097
|
-
* @throws Error if config is invalid or restart fails
|
|
2098
|
-
*
|
|
2099
|
-
* TODO: improve hot reload capabilites so that we don't always require a restart
|
|
2100
|
-
*/
|
|
2101
|
-
async reload(newConfig) {
|
|
2102
|
-
this.logger.info("Reloading agent configuration");
|
|
2103
|
-
const oldConfig = this.config;
|
|
2104
|
-
const validated = import_schemas2.AgentConfigSchema.parse(newConfig);
|
|
2105
|
-
const changesApplied = this.detectConfigChanges(oldConfig, validated);
|
|
2106
|
-
this.config = validated;
|
|
2107
|
-
let restarted = false;
|
|
2108
|
-
if (changesApplied.length > 0) {
|
|
2109
|
-
this.logger.info(
|
|
2110
|
-
`Configuration changed. Restarting agent to apply: ${changesApplied.join(", ")}`
|
|
2111
|
-
);
|
|
2112
|
-
await this.restart();
|
|
2113
|
-
restarted = true;
|
|
2114
|
-
this.logger.info("Agent restarted successfully with new configuration");
|
|
2115
|
-
} else {
|
|
2116
|
-
this.logger.info("Agent configuration reloaded successfully (no changes detected)");
|
|
2117
|
-
}
|
|
2118
|
-
return {
|
|
2119
|
-
restarted,
|
|
2120
|
-
changesApplied
|
|
2121
|
-
};
|
|
2122
|
-
}
|
|
2123
|
-
/**
|
|
2124
|
-
* Detects configuration changes that require a full agent restart.
|
|
2125
|
-
* Pure comparison logic - no file I/O.
|
|
2126
|
-
* Returns an array of change descriptions.
|
|
2127
|
-
*
|
|
2128
|
-
* @param oldConfig Previous validated configuration
|
|
2129
|
-
* @param newConfig New validated configuration
|
|
2130
|
-
* @returns Array of restart-required change descriptions
|
|
2131
|
-
*/
|
|
2132
|
-
detectConfigChanges(oldConfig, newConfig) {
|
|
2133
|
-
const changes = [];
|
|
2134
|
-
if (JSON.stringify(oldConfig.storage) !== JSON.stringify(newConfig.storage)) {
|
|
2135
|
-
changes.push("Storage backend");
|
|
2136
|
-
}
|
|
2137
|
-
if (JSON.stringify(oldConfig.sessions) !== JSON.stringify(newConfig.sessions)) {
|
|
2138
|
-
changes.push("Session configuration");
|
|
2139
|
-
}
|
|
2140
|
-
if (JSON.stringify(oldConfig.systemPrompt) !== JSON.stringify(newConfig.systemPrompt)) {
|
|
2141
|
-
changes.push("System prompt");
|
|
2142
|
-
}
|
|
2143
|
-
if (JSON.stringify(oldConfig.toolConfirmation) !== JSON.stringify(newConfig.toolConfirmation)) {
|
|
2144
|
-
changes.push("Tool confirmation");
|
|
2145
|
-
}
|
|
2146
|
-
if (JSON.stringify(oldConfig.internalTools) !== JSON.stringify(newConfig.internalTools)) {
|
|
2147
|
-
changes.push("Internal tools");
|
|
2148
|
-
}
|
|
2149
|
-
if (JSON.stringify(oldConfig.mcpServers) !== JSON.stringify(newConfig.mcpServers)) {
|
|
2150
|
-
changes.push("MCP servers");
|
|
2151
|
-
}
|
|
2152
|
-
if (oldConfig.llm.provider !== newConfig.llm.provider || oldConfig.llm.model !== newConfig.llm.model || oldConfig.llm.apiKey !== newConfig.llm.apiKey) {
|
|
2153
|
-
changes.push("LLM configuration");
|
|
2154
|
-
}
|
|
2155
|
-
return changes;
|
|
2380
|
+
getMcpServerConfig(name) {
|
|
2381
|
+
this.ensureStarted();
|
|
2382
|
+
const config = this.stateManager.getRuntimeConfig().mcpServers[name];
|
|
2383
|
+
if (config) return config;
|
|
2384
|
+
return this.mcpManager.getServerConfig(name);
|
|
2156
2385
|
}
|
|
2157
2386
|
// ============= APPROVAL HANDLER API =============
|
|
2158
2387
|
/**
|
|
2159
2388
|
* Set a custom approval handler for manual approval mode.
|
|
2160
2389
|
*
|
|
2161
|
-
* When `
|
|
2390
|
+
* When `permissions.mode` is set to 'manual', an approval handler must be
|
|
2162
2391
|
* provided to process tool confirmation requests. The handler will be called
|
|
2163
2392
|
* whenever a tool execution requires user approval.
|
|
2164
2393
|
*
|
|
@@ -2231,10 +2460,11 @@ Either:
|
|
|
2231
2460
|
// - Memory and context management across sessions
|
|
2232
2461
|
// - Tool chaining and workflow automation
|
|
2233
2462
|
// - Agent collaboration and delegation
|
|
2234
|
-
}
|
|
2463
|
+
};
|
|
2235
2464
|
_init = __decoratorStart(null);
|
|
2236
|
-
|
|
2237
|
-
__runInitializers(_init, 1,
|
|
2465
|
+
_DextoAgent = __decorateElement(_init, 0, "DextoAgent", _DextoAgent_decorators, _DextoAgent);
|
|
2466
|
+
__runInitializers(_init, 1, _DextoAgent);
|
|
2467
|
+
let DextoAgent = _DextoAgent;
|
|
2238
2468
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2239
2469
|
0 && (module.exports = {
|
|
2240
2470
|
DextoAgent
|