@dexto/core 1.5.8 → 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 +293 -154
- package/dist/agent/DextoAgent.d.ts +83 -56
- package/dist/agent/DextoAgent.d.ts.map +1 -1
- package/dist/agent/DextoAgent.js +290 -151
- 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 -104
- package/dist/agent/schemas.d.ts +10 -9199
- package/dist/agent/schemas.d.ts.map +1 -1
- package/dist/agent/schemas.js +1 -109
- 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 +4 -2
- package/dist/context/manager.d.ts +4 -3
- package/dist/context/manager.d.ts.map +1 -1
- package/dist/context/manager.js +4 -2
- package/dist/context/types.d.ts +2 -0
- package/dist/context/types.d.ts.map +1 -1
- package/dist/context/utils.cjs +2 -2
- package/dist/context/utils.d.ts +14 -14
- package/dist/context/utils.d.ts.map +1 -1
- 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 +11 -1
- package/dist/events/index.d.ts +43 -7
- package/dist/events/index.d.ts.map +1 -1
- package/dist/events/index.js +11 -1
- 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 +5 -5
- 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/errors.cjs +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 +49 -54
- 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 +49 -54
- 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/providers/local/schemas.d.ts +10 -10
- package/dist/llm/registry/auto-update.d.ts +2 -2
- package/dist/llm/registry/auto-update.d.ts.map +1 -1
- package/dist/llm/registry/index.d.ts +3 -3
- package/dist/llm/registry/index.d.ts.map +1 -1
- package/dist/llm/resolver.cjs +2 -2
- package/dist/llm/resolver.d.ts +4 -4
- package/dist/llm/resolver.d.ts.map +1 -1
- package/dist/llm/schemas.cjs +67 -104
- package/dist/llm/schemas.d.ts +6 -145
- package/dist/llm/schemas.d.ts.map +1 -1
- package/dist/llm/schemas.js +64 -101
- package/dist/llm/services/factory.cjs +2 -3
- 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 +2 -3
- package/dist/llm/services/vercel.cjs +7 -14
- package/dist/llm/services/vercel.d.ts +6 -7
- package/dist/llm/services/vercel.d.ts.map +1 -1
- package/dist/llm/services/vercel.js +7 -14
- package/dist/llm/validation.cjs +1 -1
- package/dist/llm/validation.d.ts +2 -2
- package/dist/llm/validation.d.ts.map +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.d.ts +2 -2
- package/dist/resources/handlers/filesystem-handler.d.ts.map +1 -1
- 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 +15 -25
- 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 +16 -26
- 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.d.ts +2 -2
- package/dist/session/message-queue.d.ts.map +1 -1
- package/dist/session/session-manager.cjs +67 -9
- package/dist/session/session-manager.d.ts +46 -7
- package/dist/session/session-manager.d.ts.map +1 -1
- package/dist/session/session-manager.js +67 -9
- 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/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 +3 -3
- package/dist/tools/tool-call-metadata.d.ts +1 -1
- package/dist/tools/tool-call-metadata.d.ts.map +1 -1
- package/dist/tools/tool-call-metadata.js +3 -3
- package/dist/tools/tool-manager.cjs +376 -327
- package/dist/tools/tool-manager.d.ts +63 -80
- package/dist/tools/tool-manager.d.ts.map +1 -1
- package/dist/tools/tool-manager.js +376 -331
- package/dist/tools/types.d.ts +112 -13
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/utils/error-conversion.d.ts +2 -2
- package/dist/utils/error-conversion.d.ts.map +1 -1
- 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 +51 -56
- package/dist/utils/service-initializer.d.ts +17 -14
- package/dist/utils/service-initializer.d.ts.map +1 -1
- package/dist/utils/service-initializer.js +51 -56
- 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 +2 -2
- 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/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.cjs +0 -34
- 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 -116
- 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
package/README.md
CHANGED
|
@@ -188,10 +188,19 @@ await manager.disconnectAll();
|
|
|
188
188
|
Delegate tasks to other A2A-compliant agents using the built-in `delegate_to_url` tool.
|
|
189
189
|
|
|
190
190
|
```typescript
|
|
191
|
+
import { builtinToolsFactory } from '@dexto/tools-builtins';
|
|
192
|
+
|
|
193
|
+
const tools = builtinToolsFactory.create({
|
|
194
|
+
type: 'builtin-tools',
|
|
195
|
+
enabledTools: ['delegate_to_url'],
|
|
196
|
+
});
|
|
197
|
+
|
|
191
198
|
const agent = new DextoAgent({
|
|
192
199
|
llm: { /* ... */ },
|
|
193
|
-
|
|
194
|
-
|
|
200
|
+
logger, // provide a per-agent logger instance
|
|
201
|
+
storage, // provide cache/database/blob implementations
|
|
202
|
+
tools,
|
|
203
|
+
permissions: { mode: 'auto-approve' }
|
|
195
204
|
});
|
|
196
205
|
await agent.start();
|
|
197
206
|
|
|
@@ -204,15 +213,18 @@ await agent.generate(`
|
|
|
204
213
|
`, session.id);
|
|
205
214
|
|
|
206
215
|
// Or call the tool directly
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
216
|
+
await agent.executeTool('delegate_to_url', {
|
|
217
|
+
url: 'http://localhost:3001',
|
|
218
|
+
message: 'Extract all tables from the Q4 sales report',
|
|
219
|
+
});
|
|
210
220
|
```
|
|
211
221
|
|
|
212
222
|
**Configuration (YAML):**
|
|
213
223
|
```yaml
|
|
214
|
-
|
|
215
|
-
-
|
|
224
|
+
tools:
|
|
225
|
+
- type: builtin-tools
|
|
226
|
+
enabledTools:
|
|
227
|
+
- delegate_to_url
|
|
216
228
|
```
|
|
217
229
|
|
|
218
230
|
**What it provides:**
|
|
@@ -280,4 +292,3 @@ https://docs.dexto.ai/api/dexto-agent/
|
|
|
280
292
|
## License
|
|
281
293
|
|
|
282
294
|
Elastic License 2.0. See the repository LICENSE for details.
|
|
283
|
-
|
|
@@ -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
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,50 +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 (options?.toolManager) {
|
|
156
|
-
serviceOverrides.toolManager = options.toolManager;
|
|
157
|
-
}
|
|
158
|
-
if (options?.toolManagerFactory) {
|
|
159
|
-
serviceOverrides.toolManagerFactory = options.toolManagerFactory;
|
|
160
|
-
}
|
|
161
|
-
if (Object.keys(serviceOverrides).length > 0) {
|
|
162
|
-
this.serviceOverrides = serviceOverrides;
|
|
163
|
-
}
|
|
164
|
-
if (options?.mcpAuthProviderFactory) {
|
|
165
|
-
this.mcpAuthProviderFactory = options.mcpAuthProviderFactory;
|
|
166
|
-
}
|
|
167
|
-
this.agentEventBus = new import_events2.AgentEventBus();
|
|
168
|
-
this.logger.info("DextoAgent created.");
|
|
169
|
-
}
|
|
141
|
+
let _DextoAgent = class _DextoAgent {
|
|
170
142
|
/**
|
|
171
143
|
* These services are public for use by the outside world
|
|
172
144
|
* This gives users the option to use methods of the services directly if they know what they are doing
|
|
@@ -178,6 +150,7 @@ class DextoAgent {
|
|
|
178
150
|
promptManager;
|
|
179
151
|
stateManager;
|
|
180
152
|
sessionManager;
|
|
153
|
+
workspaceManager;
|
|
181
154
|
toolManager;
|
|
182
155
|
resourceManager;
|
|
183
156
|
memoryManager;
|
|
@@ -200,9 +173,87 @@ class DextoAgent {
|
|
|
200
173
|
// Active stream controllers per session - allows cancel() to abort iterators
|
|
201
174
|
activeStreamControllers = /* @__PURE__ */ new Map();
|
|
202
175
|
// Host overrides for service initialization (e.g. session logger factory)
|
|
203
|
-
|
|
176
|
+
overrides;
|
|
177
|
+
// DI-provided local tools.
|
|
178
|
+
tools;
|
|
179
|
+
compactionStrategy;
|
|
204
180
|
// Logger instance for this agent (dependency injection)
|
|
205
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
|
+
}
|
|
206
257
|
/**
|
|
207
258
|
* Starts the agent by initializing all async services.
|
|
208
259
|
* This method handles storage backends, MCP connections, session manager initialization, and other async operations.
|
|
@@ -218,10 +269,10 @@ class DextoAgent {
|
|
|
218
269
|
this.logger.info("Starting DextoAgent...");
|
|
219
270
|
const services = await (0, import_service_initializer2.createAgentServices)(
|
|
220
271
|
this.config,
|
|
221
|
-
this.configPath,
|
|
222
272
|
this.logger,
|
|
223
273
|
this.agentEventBus,
|
|
224
|
-
this.
|
|
274
|
+
this.overrides,
|
|
275
|
+
this.compactionStrategy
|
|
225
276
|
);
|
|
226
277
|
if (this.mcpAuthProviderFactory) {
|
|
227
278
|
services.mcpManager.setAuthProviderFactory(this.mcpAuthProviderFactory);
|
|
@@ -233,11 +284,11 @@ class DextoAgent {
|
|
|
233
284
|
);
|
|
234
285
|
}
|
|
235
286
|
}
|
|
236
|
-
const needsHandler = this.config.
|
|
287
|
+
const needsHandler = this.config.permissions.mode === "manual" || this.config.elicitation.enabled;
|
|
237
288
|
if (needsHandler && !this.approvalHandler) {
|
|
238
289
|
const reasons = [];
|
|
239
|
-
if (this.config.
|
|
240
|
-
reasons.push('
|
|
290
|
+
if (this.config.permissions.mode === "manual") {
|
|
291
|
+
reasons.push('permissions mode is "manual"');
|
|
241
292
|
}
|
|
242
293
|
if (this.config.elicitation.enabled) {
|
|
243
294
|
reasons.push("elicitation is enabled");
|
|
@@ -246,7 +297,7 @@ class DextoAgent {
|
|
|
246
297
|
`An approval handler is required but not configured (${reasons.join(" and ")}).
|
|
247
298
|
Either:
|
|
248
299
|
\u2022 Call agent.setApprovalHandler() before starting
|
|
249
|
-
\u2022 Set
|
|
300
|
+
\u2022 Set permissions: { mode: "auto-approve" } or { mode: "auto-deny" }
|
|
250
301
|
\u2022 Disable elicitation: { enabled: false }`
|
|
251
302
|
);
|
|
252
303
|
}
|
|
@@ -260,6 +311,7 @@ Either:
|
|
|
260
311
|
systemPromptManager: services.systemPromptManager,
|
|
261
312
|
stateManager: services.stateManager,
|
|
262
313
|
sessionManager: services.sessionManager,
|
|
314
|
+
workspaceManager: services.workspaceManager,
|
|
263
315
|
memoryManager: services.memoryManager,
|
|
264
316
|
services
|
|
265
317
|
});
|
|
@@ -273,9 +325,27 @@ Either:
|
|
|
273
325
|
);
|
|
274
326
|
await promptManager.initialize();
|
|
275
327
|
Object.assign(this, { promptManager });
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
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")) {
|
|
279
349
|
const skillsContributor = new import_contributors.SkillsContributor(
|
|
280
350
|
"skills",
|
|
281
351
|
50,
|
|
@@ -286,6 +356,7 @@ Either:
|
|
|
286
356
|
services.systemPromptManager.addContributor(skillsContributor);
|
|
287
357
|
this.logger.debug("Added SkillsContributor to system prompt");
|
|
288
358
|
}
|
|
359
|
+
services.toolManager.setTools(agentTools);
|
|
289
360
|
await services.toolManager.initialize();
|
|
290
361
|
this.searchService = services.searchService;
|
|
291
362
|
this._isStarted = true;
|
|
@@ -329,13 +400,22 @@ Either:
|
|
|
329
400
|
shutdownErrors.push(new Error(`SessionManager cleanup failed: ${err.message}`));
|
|
330
401
|
}
|
|
331
402
|
try {
|
|
332
|
-
if (this.
|
|
333
|
-
await this.
|
|
334
|
-
this.logger.debug("
|
|
403
|
+
if (this.toolManager) {
|
|
404
|
+
await this.toolManager.cleanup();
|
|
405
|
+
this.logger.debug("ToolManager cleaned up successfully");
|
|
335
406
|
}
|
|
336
407
|
} catch (error) {
|
|
337
408
|
const err = error instanceof Error ? error : new Error(String(error));
|
|
338
|
-
shutdownErrors.push(new 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");
|
|
415
|
+
}
|
|
416
|
+
} catch (error) {
|
|
417
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
418
|
+
shutdownErrors.push(new Error(`HookManager cleanup failed: ${err.message}`));
|
|
339
419
|
}
|
|
340
420
|
try {
|
|
341
421
|
if (this.mcpManager) {
|
|
@@ -346,6 +426,15 @@ Either:
|
|
|
346
426
|
const err = error instanceof Error ? error : new Error(String(error));
|
|
347
427
|
shutdownErrors.push(new Error(`MCPManager disconnect failed: ${err.message}`));
|
|
348
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
|
+
}
|
|
349
438
|
try {
|
|
350
439
|
if (this.services?.storageManager) {
|
|
351
440
|
await this.services.storageManager.disconnect();
|
|
@@ -384,6 +473,26 @@ Either:
|
|
|
384
473
|
subscriber.subscribe(this.agentEventBus);
|
|
385
474
|
}
|
|
386
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
|
+
}
|
|
387
496
|
/**
|
|
388
497
|
* Restart the agent by stopping and starting it.
|
|
389
498
|
* Automatically re-subscribes all registered event subscribers to the new event bus.
|
|
@@ -636,6 +745,14 @@ Either:
|
|
|
636
745
|
};
|
|
637
746
|
this.agentEventBus.on("llm:tool-call", toolCallListener, { signal: cleanupSignal });
|
|
638
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 });
|
|
639
756
|
const toolResultListener = (data) => {
|
|
640
757
|
if (data.sessionId !== sessionId) return;
|
|
641
758
|
eventQueue.push({ name: "llm:tool-result", ...data });
|
|
@@ -1013,6 +1130,36 @@ Either:
|
|
|
1013
1130
|
}
|
|
1014
1131
|
return !!streamController;
|
|
1015
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
|
+
}
|
|
1016
1163
|
// ============= SESSION MANAGEMENT =============
|
|
1017
1164
|
/**
|
|
1018
1165
|
* Creates a new chat session or returns an existing one.
|
|
@@ -1297,7 +1444,11 @@ Either:
|
|
|
1297
1444
|
estimatedTokens: originalTokens,
|
|
1298
1445
|
sessionId
|
|
1299
1446
|
});
|
|
1300
|
-
const summaryMessages = await compactionStrategy.compact(history
|
|
1447
|
+
const summaryMessages = await compactionStrategy.compact(history, {
|
|
1448
|
+
sessionId,
|
|
1449
|
+
model: llmService.getLanguageModel(),
|
|
1450
|
+
logger: session.logger
|
|
1451
|
+
});
|
|
1301
1452
|
if (summaryMessages.length === 0) {
|
|
1302
1453
|
this.logger.debug(`Compaction skipped for session ${sessionId} - nothing to compact`);
|
|
1303
1454
|
this.agentEventBus.emit("context:compacted", {
|
|
@@ -1368,16 +1519,12 @@ Either:
|
|
|
1368
1519
|
);
|
|
1369
1520
|
const history = await contextManager.getHistory();
|
|
1370
1521
|
const runtimeConfig = this.stateManager.getRuntimeConfig(sessionId);
|
|
1371
|
-
const compactionConfig = runtimeConfig.compaction;
|
|
1372
1522
|
const modelContextWindow = contextManager.getMaxInputTokens();
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
}
|
|
1377
|
-
const
|
|
1378
|
-
if (thresholdPercent < 1) {
|
|
1379
|
-
maxContextTokens = Math.floor(maxContextTokens * thresholdPercent);
|
|
1380
|
-
}
|
|
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;
|
|
1381
1528
|
const hasSummary = history.some(
|
|
1382
1529
|
(msg) => msg.metadata?.isSummary === true || msg.metadata?.isSessionSummary === true
|
|
1383
1530
|
);
|
|
@@ -1659,6 +1806,70 @@ Either:
|
|
|
1659
1806
|
throw import_errors3.MCPError.connectionFailed(name, errorMessage);
|
|
1660
1807
|
}
|
|
1661
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
|
+
}
|
|
1662
1873
|
/**
|
|
1663
1874
|
* @deprecated Use `addMcpServer` instead. This method will be removed in a future version.
|
|
1664
1875
|
*/
|
|
@@ -2166,90 +2377,17 @@ Either:
|
|
|
2166
2377
|
this.ensureStarted();
|
|
2167
2378
|
return sessionId ? this.stateManager.getRuntimeConfig(sessionId) : this.stateManager.getRuntimeConfig();
|
|
2168
2379
|
}
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
*/
|
|
2175
|
-
getAgentFilePath() {
|
|
2176
|
-
if (!this.configPath) {
|
|
2177
|
-
throw import_errors2.AgentError.noConfigPath();
|
|
2178
|
-
}
|
|
2179
|
-
return this.configPath;
|
|
2180
|
-
}
|
|
2181
|
-
/**
|
|
2182
|
-
* Reloads the agent configuration with a new config object.
|
|
2183
|
-
* Validates the new config, detects what changed, and automatically
|
|
2184
|
-
* restarts the agent if necessary to apply the changes.
|
|
2185
|
-
*
|
|
2186
|
-
* @param newConfig The new agent configuration to apply
|
|
2187
|
-
* @returns Object containing whether agent was restarted and list of changes applied
|
|
2188
|
-
* @throws Error if config is invalid or restart fails
|
|
2189
|
-
*
|
|
2190
|
-
* TODO: improve hot reload capabilites so that we don't always require a restart
|
|
2191
|
-
*/
|
|
2192
|
-
async reload(newConfig) {
|
|
2193
|
-
this.logger.info("Reloading agent configuration");
|
|
2194
|
-
const oldConfig = this.config;
|
|
2195
|
-
const validated = import_schemas2.AgentConfigSchema.parse(newConfig);
|
|
2196
|
-
const changesApplied = this.detectConfigChanges(oldConfig, validated);
|
|
2197
|
-
this.config = validated;
|
|
2198
|
-
let restarted = false;
|
|
2199
|
-
if (changesApplied.length > 0) {
|
|
2200
|
-
this.logger.info(
|
|
2201
|
-
`Configuration changed. Restarting agent to apply: ${changesApplied.join(", ")}`
|
|
2202
|
-
);
|
|
2203
|
-
await this.restart();
|
|
2204
|
-
restarted = true;
|
|
2205
|
-
this.logger.info("Agent restarted successfully with new configuration");
|
|
2206
|
-
} else {
|
|
2207
|
-
this.logger.info("Agent configuration reloaded successfully (no changes detected)");
|
|
2208
|
-
}
|
|
2209
|
-
return {
|
|
2210
|
-
restarted,
|
|
2211
|
-
changesApplied
|
|
2212
|
-
};
|
|
2213
|
-
}
|
|
2214
|
-
/**
|
|
2215
|
-
* Detects configuration changes that require a full agent restart.
|
|
2216
|
-
* Pure comparison logic - no file I/O.
|
|
2217
|
-
* Returns an array of change descriptions.
|
|
2218
|
-
*
|
|
2219
|
-
* @param oldConfig Previous validated configuration
|
|
2220
|
-
* @param newConfig New validated configuration
|
|
2221
|
-
* @returns Array of restart-required change descriptions
|
|
2222
|
-
*/
|
|
2223
|
-
detectConfigChanges(oldConfig, newConfig) {
|
|
2224
|
-
const changes = [];
|
|
2225
|
-
if (JSON.stringify(oldConfig.storage) !== JSON.stringify(newConfig.storage)) {
|
|
2226
|
-
changes.push("Storage backend");
|
|
2227
|
-
}
|
|
2228
|
-
if (JSON.stringify(oldConfig.sessions) !== JSON.stringify(newConfig.sessions)) {
|
|
2229
|
-
changes.push("Session configuration");
|
|
2230
|
-
}
|
|
2231
|
-
if (JSON.stringify(oldConfig.systemPrompt) !== JSON.stringify(newConfig.systemPrompt)) {
|
|
2232
|
-
changes.push("System prompt");
|
|
2233
|
-
}
|
|
2234
|
-
if (JSON.stringify(oldConfig.toolConfirmation) !== JSON.stringify(newConfig.toolConfirmation)) {
|
|
2235
|
-
changes.push("Tool confirmation");
|
|
2236
|
-
}
|
|
2237
|
-
if (JSON.stringify(oldConfig.internalTools) !== JSON.stringify(newConfig.internalTools)) {
|
|
2238
|
-
changes.push("Internal tools");
|
|
2239
|
-
}
|
|
2240
|
-
if (JSON.stringify(oldConfig.mcpServers) !== JSON.stringify(newConfig.mcpServers)) {
|
|
2241
|
-
changes.push("MCP servers");
|
|
2242
|
-
}
|
|
2243
|
-
if (oldConfig.llm.provider !== newConfig.llm.provider || oldConfig.llm.model !== newConfig.llm.model || oldConfig.llm.apiKey !== newConfig.llm.apiKey) {
|
|
2244
|
-
changes.push("LLM configuration");
|
|
2245
|
-
}
|
|
2246
|
-
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);
|
|
2247
2385
|
}
|
|
2248
2386
|
// ============= APPROVAL HANDLER API =============
|
|
2249
2387
|
/**
|
|
2250
2388
|
* Set a custom approval handler for manual approval mode.
|
|
2251
2389
|
*
|
|
2252
|
-
* When `
|
|
2390
|
+
* When `permissions.mode` is set to 'manual', an approval handler must be
|
|
2253
2391
|
* provided to process tool confirmation requests. The handler will be called
|
|
2254
2392
|
* whenever a tool execution requires user approval.
|
|
2255
2393
|
*
|
|
@@ -2322,10 +2460,11 @@ Either:
|
|
|
2322
2460
|
// - Memory and context management across sessions
|
|
2323
2461
|
// - Tool chaining and workflow automation
|
|
2324
2462
|
// - Agent collaboration and delegation
|
|
2325
|
-
}
|
|
2463
|
+
};
|
|
2326
2464
|
_init = __decoratorStart(null);
|
|
2327
|
-
|
|
2328
|
-
__runInitializers(_init, 1,
|
|
2465
|
+
_DextoAgent = __decorateElement(_init, 0, "DextoAgent", _DextoAgent_decorators, _DextoAgent);
|
|
2466
|
+
__runInitializers(_init, 1, _DextoAgent);
|
|
2467
|
+
let DextoAgent = _DextoAgent;
|
|
2329
2468
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2330
2469
|
0 && (module.exports = {
|
|
2331
2470
|
DextoAgent
|