@dexto/core 1.1.10 → 1.1.11
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/dist/Dexto.cjs +261 -0
- package/dist/Dexto.d.ts +212 -0
- package/dist/Dexto.d.ts.map +1 -0
- package/dist/Dexto.js +236 -0
- package/dist/agent/DextoAgent.cjs +428 -123
- package/dist/agent/DextoAgent.d.ts +170 -102
- package/dist/agent/DextoAgent.d.ts.map +1 -0
- package/dist/agent/DextoAgent.js +428 -123
- package/dist/agent/agentCard.d.ts +4 -7
- package/dist/agent/agentCard.d.ts.map +1 -0
- package/dist/agent/error-codes.cjs +2 -0
- package/dist/agent/error-codes.d.ts +4 -3
- package/dist/agent/error-codes.d.ts.map +1 -0
- package/dist/agent/error-codes.js +2 -0
- package/dist/agent/errors.cjs +13 -0
- package/dist/agent/errors.d.ts +6 -17
- package/dist/agent/errors.d.ts.map +1 -0
- package/dist/agent/errors.js +13 -0
- package/dist/agent/index.cjs +3 -0
- package/dist/agent/index.d.ts +6 -57
- package/dist/agent/index.d.ts.map +1 -0
- package/dist/agent/index.js +2 -0
- package/dist/agent/registry/error-codes.cjs +2 -0
- package/dist/agent/registry/error-codes.d.ts +4 -3
- package/dist/agent/registry/error-codes.d.ts.map +1 -0
- package/dist/agent/registry/error-codes.js +2 -0
- package/dist/agent/registry/errors.cjs +58 -28
- package/dist/agent/registry/errors.d.ts +32 -36
- package/dist/agent/registry/errors.d.ts.map +1 -0
- package/dist/agent/registry/errors.js +58 -28
- package/dist/agent/registry/registry.cjs +242 -54
- package/dist/agent/registry/registry.d.ts +84 -21
- package/dist/agent/registry/registry.d.ts.map +1 -0
- package/dist/agent/registry/registry.js +251 -55
- package/dist/agent/registry/types.cjs +36 -3
- package/dist/agent/registry/types.d.ts +66 -24
- package/dist/agent/registry/types.d.ts.map +1 -0
- package/dist/agent/registry/types.js +33 -2
- package/dist/agent/registry/user-registry.cjs +140 -0
- package/dist/agent/registry/user-registry.d.ts +34 -0
- package/dist/agent/registry/user-registry.d.ts.map +1 -0
- package/dist/agent/registry/user-registry.js +104 -0
- package/dist/agent/schemas.cjs +17 -3
- package/dist/agent/schemas.d.ts +685 -463
- package/dist/agent/schemas.d.ts.map +1 -0
- package/dist/agent/schemas.js +17 -3
- package/dist/agent/state-manager.d.ts +7 -12
- package/dist/agent/state-manager.d.ts.map +1 -0
- package/dist/approval/error-codes.cjs +44 -0
- package/dist/approval/error-codes.d.ts +21 -0
- package/dist/approval/error-codes.d.ts.map +1 -0
- package/dist/approval/error-codes.js +20 -0
- package/dist/approval/errors.cjs +251 -0
- package/dist/approval/errors.d.ts +110 -0
- package/dist/approval/errors.d.ts.map +1 -0
- package/dist/approval/errors.js +227 -0
- package/dist/approval/index.cjs +84 -0
- package/dist/approval/index.d.ts +12 -0
- package/dist/approval/index.d.ts.map +1 -0
- package/dist/approval/index.js +55 -0
- package/dist/approval/manager.cjs +159 -0
- package/dist/approval/manager.d.ts +109 -0
- package/dist/approval/manager.d.ts.map +1 -0
- package/dist/approval/manager.js +135 -0
- package/dist/approval/providers/event-based-approval-provider.cjs +156 -0
- package/dist/approval/providers/event-based-approval-provider.d.ts +39 -0
- package/dist/approval/providers/event-based-approval-provider.d.ts.map +1 -0
- package/dist/approval/providers/event-based-approval-provider.js +132 -0
- package/dist/approval/providers/factory.cjs +38 -0
- package/dist/approval/providers/factory.d.ts +12 -0
- package/dist/approval/providers/factory.d.ts.map +1 -0
- package/dist/approval/providers/factory.js +14 -0
- package/dist/approval/providers/noop-approval-provider.cjs +54 -0
- package/dist/approval/providers/noop-approval-provider.d.ts +18 -0
- package/dist/approval/providers/noop-approval-provider.d.ts.map +1 -0
- package/dist/approval/providers/noop-approval-provider.js +30 -0
- package/dist/approval/schemas.cjs +168 -0
- package/dist/approval/schemas.d.ts +602 -0
- package/dist/approval/schemas.d.ts.map +1 -0
- package/dist/approval/schemas.js +126 -0
- package/dist/approval/types.cjs +41 -0
- package/dist/approval/types.d.ts +140 -0
- package/dist/approval/types.d.ts.map +1 -0
- package/dist/approval/types.js +16 -0
- package/dist/config/agent-resolver.d.ts +3 -4
- package/dist/config/agent-resolver.d.ts.map +1 -0
- package/dist/config/error-codes.d.ts +2 -3
- package/dist/config/error-codes.d.ts.map +1 -0
- package/dist/config/errors.d.ts +3 -18
- package/dist/config/errors.d.ts.map +1 -0
- package/dist/config/index.d.ts +4 -7
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/loader.d.ts +2 -5
- package/dist/config/loader.d.ts.map +1 -0
- package/dist/config/writer.d.ts +8 -11
- package/dist/config/writer.d.ts.map +1 -0
- package/dist/context/compression/middle-removal.d.ts +3 -6
- package/dist/context/compression/middle-removal.d.ts.map +1 -0
- package/dist/context/compression/oldest-removal.d.ts +3 -6
- package/dist/context/compression/oldest-removal.d.ts.map +1 -0
- package/dist/context/compression/types.d.ts +2 -5
- package/dist/context/compression/types.d.ts.map +1 -0
- package/dist/context/error-codes.d.ts +2 -3
- package/dist/context/error-codes.d.ts.map +1 -0
- package/dist/context/errors.d.ts +3 -18
- package/dist/context/errors.d.ts.map +1 -0
- package/dist/context/index.cjs +11 -0
- package/dist/context/index.d.ts +4 -19
- package/dist/context/index.d.ts.map +1 -0
- package/dist/context/index.js +5 -0
- package/dist/context/manager.cjs +121 -24
- package/dist/context/manager.d.ts +28 -20
- package/dist/context/manager.d.ts.map +1 -0
- package/dist/context/manager.js +127 -25
- package/dist/context/media-helpers.cjs +40 -0
- package/dist/context/media-helpers.d.ts +15 -0
- package/dist/context/media-helpers.d.ts.map +1 -0
- package/dist/context/media-helpers.js +15 -0
- package/dist/context/types.d.ts +27 -10
- package/dist/context/types.d.ts.map +1 -0
- package/dist/context/utils.cjs +811 -71
- package/dist/context/utils.d.ts +78 -15
- package/dist/context/utils.d.ts.map +1 -0
- package/dist/context/utils.js +802 -70
- package/dist/errors/DextoBaseError.d.ts +2 -3
- package/dist/errors/DextoBaseError.d.ts.map +1 -0
- package/dist/errors/DextoRuntimeError.d.ts +5 -16
- package/dist/errors/DextoRuntimeError.d.ts.map +1 -0
- package/dist/errors/DextoValidationError.d.ts +3 -16
- package/dist/errors/DextoValidationError.d.ts.map +1 -0
- package/dist/errors/index.d.ts +7 -14
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/result-bridge.d.ts +3 -18
- package/dist/errors/result-bridge.d.ts.map +1 -0
- package/dist/errors/types.cjs +4 -0
- package/dist/errors/types.d.ts +27 -20
- package/dist/errors/types.d.ts.map +1 -0
- package/dist/errors/types.js +4 -0
- package/dist/events/index.cjs +8 -3
- package/dist/events/index.d.ts +63 -35
- package/dist/events/index.d.ts.map +1 -0
- package/dist/events/index.js +8 -3
- package/dist/index.browser.cjs +36 -0
- package/dist/index.browser.d.ts +24 -51
- package/dist/index.browser.d.ts.map +1 -0
- package/dist/index.browser.js +34 -1
- package/dist/index.cjs +29 -1
- package/dist/index.d.ts +33 -89
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/llm/error-codes.d.ts +2 -3
- package/dist/llm/error-codes.d.ts.map +1 -0
- package/dist/llm/errors.d.ts +3 -18
- package/dist/llm/errors.d.ts.map +1 -0
- package/dist/llm/formatters/anthropic.d.ts +2 -4
- package/dist/llm/formatters/anthropic.d.ts.map +1 -0
- package/dist/llm/formatters/factory.d.ts +3 -6
- package/dist/llm/formatters/factory.d.ts.map +1 -0
- package/dist/llm/formatters/openai.d.ts +2 -4
- package/dist/llm/formatters/openai.d.ts.map +1 -0
- package/dist/llm/formatters/types.d.ts +2 -4
- package/dist/llm/formatters/types.d.ts.map +1 -0
- package/dist/llm/formatters/vercel.d.ts +6 -7
- package/dist/llm/formatters/vercel.d.ts.map +1 -0
- package/dist/llm/index.d.ts +8 -39
- package/dist/llm/index.d.ts.map +1 -0
- package/dist/llm/registry.cjs +15 -1
- package/dist/llm/registry.d.ts +26 -29
- package/dist/llm/registry.d.ts.map +1 -0
- package/dist/llm/registry.js +15 -1
- package/dist/llm/resolver.d.ts +6 -20
- package/dist/llm/resolver.d.ts.map +1 -0
- package/dist/llm/schemas.d.ts +15 -17
- package/dist/llm/schemas.d.ts.map +1 -0
- package/dist/llm/services/anthropic.cjs +24 -11
- package/dist/llm/services/anthropic.d.ts +7 -32
- package/dist/llm/services/anthropic.d.ts.map +1 -0
- package/dist/llm/services/anthropic.js +24 -11
- package/dist/llm/services/factory.cjs +21 -15
- package/dist/llm/services/factory.d.ts +5 -32
- package/dist/llm/services/factory.d.ts.map +1 -0
- package/dist/llm/services/factory.js +21 -15
- package/dist/llm/services/index.d.ts +2 -21
- package/dist/llm/services/index.d.ts.map +1 -0
- package/dist/llm/services/openai.cjs +33 -16
- package/dist/llm/services/openai.d.ts +7 -32
- package/dist/llm/services/openai.d.ts.map +1 -0
- package/dist/llm/services/openai.js +33 -16
- package/dist/llm/services/test-utils.integration.cjs +2 -2
- package/dist/llm/services/test-utils.integration.d.ts +8 -49
- package/dist/llm/services/test-utils.integration.d.ts.map +1 -0
- package/dist/llm/services/test-utils.integration.js +2 -2
- package/dist/llm/services/types.d.ts +5 -22
- package/dist/llm/services/types.d.ts.map +1 -0
- package/dist/llm/services/vercel.cjs +52 -21
- package/dist/llm/services/vercel.d.ts +12 -35
- package/dist/llm/services/vercel.d.ts.map +1 -0
- package/dist/llm/services/vercel.js +53 -22
- package/dist/llm/tokenizer/anthropic.d.ts +2 -4
- package/dist/llm/tokenizer/anthropic.d.ts.map +1 -0
- package/dist/llm/tokenizer/default.d.ts +2 -4
- package/dist/llm/tokenizer/default.d.ts.map +1 -0
- package/dist/llm/tokenizer/factory.d.ts +3 -5
- package/dist/llm/tokenizer/factory.d.ts.map +1 -0
- package/dist/llm/tokenizer/google.d.ts +2 -4
- package/dist/llm/tokenizer/google.d.ts.map +1 -0
- package/dist/llm/tokenizer/openai.d.ts +2 -4
- package/dist/llm/tokenizer/openai.d.ts.map +1 -0
- package/dist/llm/tokenizer/types.d.ts +3 -4
- package/dist/llm/tokenizer/types.d.ts.map +1 -0
- package/dist/llm/types.d.ts +9 -10
- package/dist/llm/types.d.ts.map +1 -0
- package/dist/llm/validation.d.ts +8 -23
- package/dist/llm/validation.d.ts.map +1 -0
- package/dist/logger/browser.d.ts +4 -5
- package/dist/logger/browser.d.ts.map +1 -0
- package/dist/logger/index.d.ts +2 -1
- package/dist/logger/index.d.ts.map +1 -0
- package/dist/logger/logger.cjs +35 -7
- package/dist/logger/logger.d.ts +5 -5
- package/dist/logger/logger.d.ts.map +1 -0
- package/dist/logger/logger.js +35 -7
- package/dist/mcp/error-codes.d.ts +2 -3
- package/dist/mcp/error-codes.d.ts.map +1 -0
- package/dist/mcp/errors.d.ts +2 -17
- package/dist/mcp/errors.d.ts.map +1 -0
- package/dist/mcp/index.d.ts +8 -26
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/manager.cjs +462 -114
- package/dist/mcp/manager.d.ts +117 -58
- package/dist/mcp/manager.d.ts.map +1 -0
- package/dist/mcp/manager.js +462 -114
- package/dist/mcp/mcp-client.cjs +172 -10
- package/dist/mcp/mcp-client.d.ts +36 -14
- package/dist/mcp/mcp-client.d.ts.map +1 -0
- package/dist/mcp/mcp-client.js +176 -10
- package/dist/mcp/resolver.d.ts +5 -20
- package/dist/mcp/resolver.d.ts.map +1 -0
- package/dist/mcp/schemas.cjs +13 -5
- package/dist/mcp/schemas.d.ts +31 -28
- package/dist/mcp/schemas.d.ts.map +1 -0
- package/dist/mcp/schemas.js +10 -5
- package/dist/mcp/types.d.ts +18 -10
- package/dist/mcp/types.d.ts.map +1 -0
- package/dist/memory/error-codes.cjs +39 -0
- package/dist/memory/error-codes.d.ts +15 -0
- package/dist/memory/error-codes.d.ts.map +1 -0
- package/dist/memory/error-codes.js +15 -0
- package/dist/memory/errors.cjs +112 -0
- package/dist/memory/errors.d.ts +16 -0
- package/dist/memory/errors.d.ts.map +1 -0
- package/dist/memory/errors.js +88 -0
- package/dist/memory/index.cjs +43 -0
- package/dist/memory/index.d.ts +6 -0
- package/dist/memory/index.d.ts.map +1 -0
- package/dist/memory/index.js +18 -0
- package/dist/memory/manager.cjs +214 -0
- package/dist/memory/manager.d.ts +56 -0
- package/dist/memory/manager.d.ts.map +1 -0
- package/dist/memory/manager.js +195 -0
- package/dist/memory/schemas.cjs +82 -0
- package/dist/memory/schemas.d.ts +129 -0
- package/dist/memory/schemas.d.ts.map +1 -0
- package/dist/memory/schemas.js +53 -0
- package/dist/memory/types.d.ts +76 -0
- package/dist/memory/types.d.ts.map +1 -0
- package/dist/plugins/builtins/content-policy.cjs +112 -0
- package/dist/plugins/builtins/content-policy.d.ts +26 -0
- package/dist/plugins/builtins/content-policy.d.ts.map +1 -0
- package/dist/plugins/builtins/content-policy.js +88 -0
- package/dist/plugins/builtins/response-sanitizer.cjs +102 -0
- package/dist/plugins/builtins/response-sanitizer.d.ts +25 -0
- package/dist/plugins/builtins/response-sanitizer.d.ts.map +1 -0
- package/dist/plugins/builtins/response-sanitizer.js +78 -0
- package/dist/plugins/error-codes.cjs +39 -0
- package/dist/plugins/error-codes.d.ts +26 -0
- package/dist/plugins/error-codes.d.ts.map +1 -0
- package/dist/plugins/error-codes.js +15 -0
- package/dist/plugins/index.cjs +54 -0
- package/dist/plugins/index.d.ts +19 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +24 -0
- package/dist/plugins/loader.cjs +151 -0
- package/dist/plugins/loader.d.ts +30 -0
- package/dist/plugins/loader.d.ts.map +1 -0
- package/dist/plugins/loader.js +124 -0
- package/dist/plugins/manager.cjs +386 -0
- package/dist/plugins/manager.d.ts +97 -0
- package/dist/plugins/manager.d.ts.map +1 -0
- package/dist/plugins/manager.js +362 -0
- package/dist/plugins/registrations/builtins.cjs +51 -0
- package/dist/plugins/registrations/builtins.d.ts +17 -0
- package/dist/plugins/registrations/builtins.d.ts.map +1 -0
- package/dist/plugins/registrations/builtins.js +27 -0
- package/dist/plugins/schemas.cjs +61 -0
- package/dist/plugins/schemas.d.ts +138 -0
- package/dist/plugins/schemas.d.ts.map +1 -0
- package/dist/plugins/schemas.js +35 -0
- package/dist/plugins/types.d.ts +152 -0
- package/dist/plugins/types.d.ts.map +1 -0
- package/dist/preferences/constants.d.ts +2 -3
- package/dist/preferences/constants.d.ts.map +1 -0
- package/dist/preferences/error-codes.d.ts +2 -3
- package/dist/preferences/error-codes.d.ts.map +1 -0
- package/dist/preferences/errors.d.ts +4 -19
- package/dist/preferences/errors.d.ts.map +1 -0
- package/dist/preferences/index.d.ts +5 -20
- package/dist/preferences/index.d.ts.map +1 -0
- package/dist/preferences/loader.d.ts +9 -12
- package/dist/preferences/loader.d.ts.map +1 -0
- package/dist/preferences/schemas.d.ts +19 -21
- package/dist/preferences/schemas.d.ts.map +1 -0
- package/dist/prompts/error-codes.cjs +38 -0
- package/dist/prompts/error-codes.d.ts +15 -0
- package/dist/prompts/error-codes.d.ts.map +1 -0
- package/dist/prompts/error-codes.js +14 -0
- package/dist/prompts/errors.cjs +144 -0
- package/dist/prompts/errors.d.ts +45 -0
- package/dist/prompts/errors.d.ts.map +1 -0
- package/dist/prompts/errors.js +120 -0
- package/dist/prompts/index.cjs +53 -0
- package/dist/prompts/index.d.ts +13 -0
- package/dist/prompts/index.d.ts.map +1 -0
- package/dist/prompts/index.js +20 -0
- package/dist/prompts/name-validation.cjs +45 -0
- package/dist/prompts/name-validation.d.ts +9 -0
- package/dist/prompts/name-validation.d.ts.map +1 -0
- package/dist/prompts/name-validation.js +18 -0
- package/dist/prompts/prompt-manager.cjs +374 -0
- package/dist/prompts/prompt-manager.d.ts +74 -0
- package/dist/prompts/prompt-manager.d.ts.map +1 -0
- package/dist/prompts/prompt-manager.js +352 -0
- package/dist/prompts/providers/custom-prompt-provider.cjs +283 -0
- package/dist/prompts/providers/custom-prompt-provider.d.ts +36 -0
- package/dist/prompts/providers/custom-prompt-provider.d.ts.map +1 -0
- package/dist/prompts/providers/custom-prompt-provider.js +259 -0
- package/dist/prompts/providers/file-prompt-provider.cjs +399 -0
- package/dist/prompts/providers/file-prompt-provider.d.ts +47 -0
- package/dist/prompts/providers/file-prompt-provider.d.ts.map +1 -0
- package/dist/prompts/providers/file-prompt-provider.js +375 -0
- package/dist/prompts/providers/mcp-prompt-provider.cjs +102 -0
- package/dist/prompts/providers/mcp-prompt-provider.d.ts +35 -0
- package/dist/prompts/providers/mcp-prompt-provider.d.ts.map +1 -0
- package/dist/prompts/providers/mcp-prompt-provider.js +78 -0
- package/dist/prompts/providers/starter-prompt-provider.cjs +170 -0
- package/dist/prompts/providers/starter-prompt-provider.d.ts +45 -0
- package/dist/prompts/providers/starter-prompt-provider.d.ts.map +1 -0
- package/dist/prompts/providers/starter-prompt-provider.js +146 -0
- package/dist/prompts/schemas.cjs +54 -0
- package/dist/prompts/schemas.d.ts +65 -0
- package/dist/prompts/schemas.d.ts.map +1 -0
- package/dist/prompts/schemas.js +30 -0
- package/dist/{storage/backend/cache-backend.cjs → prompts/types.cjs} +2 -2
- package/dist/prompts/types.d.ts +64 -0
- package/dist/prompts/types.d.ts.map +1 -0
- package/dist/prompts/utils.cjs +176 -0
- package/dist/prompts/utils.d.ts +32 -0
- package/dist/prompts/utils.d.ts.map +1 -0
- package/dist/prompts/utils.js +149 -0
- package/dist/resources/error-codes.cjs +38 -0
- package/dist/resources/error-codes.d.ts +13 -0
- package/dist/resources/error-codes.d.ts.map +1 -0
- package/dist/resources/error-codes.js +14 -0
- package/dist/resources/errors.cjs +155 -0
- package/dist/resources/errors.d.ts +48 -0
- package/dist/resources/errors.d.ts.map +1 -0
- package/dist/resources/errors.js +131 -0
- package/dist/resources/handlers/blob-handler.cjs +230 -0
- package/dist/resources/handlers/blob-handler.d.ts +38 -0
- package/dist/resources/handlers/blob-handler.d.ts.map +1 -0
- package/dist/resources/handlers/blob-handler.js +206 -0
- package/dist/resources/handlers/factory.cjs +50 -0
- package/dist/resources/handlers/factory.d.ts +11 -0
- package/dist/resources/handlers/factory.d.ts.map +1 -0
- package/dist/resources/handlers/factory.js +25 -0
- package/dist/resources/handlers/filesystem-handler.cjs +385 -0
- package/dist/resources/handlers/filesystem-handler.d.ts +35 -0
- package/dist/resources/handlers/filesystem-handler.d.ts.map +1 -0
- package/dist/resources/handlers/filesystem-handler.js +351 -0
- package/dist/{storage/backend/database-backend.cjs → resources/handlers/types.cjs} +2 -2
- package/dist/resources/handlers/types.d.ts +15 -0
- package/dist/resources/handlers/types.d.ts.map +1 -0
- package/dist/resources/index.cjs +58 -0
- package/dist/resources/index.d.ts +39 -0
- package/dist/resources/index.d.ts.map +1 -0
- package/dist/resources/index.js +34 -0
- package/dist/resources/internal-provider.cjs +141 -0
- package/dist/resources/internal-provider.d.ts +19 -0
- package/dist/resources/internal-provider.d.ts.map +1 -0
- package/dist/resources/internal-provider.js +117 -0
- package/dist/resources/manager.cjs +221 -0
- package/dist/resources/manager.d.ts +29 -0
- package/dist/resources/manager.d.ts.map +1 -0
- package/dist/resources/manager.js +197 -0
- package/dist/resources/reference-parser.cjs +217 -0
- package/dist/resources/reference-parser.d.ts +33 -0
- package/dist/resources/reference-parser.d.ts.map +1 -0
- package/dist/resources/reference-parser.js +190 -0
- package/dist/resources/schemas.cjs +98 -0
- package/dist/resources/schemas.d.ts +212 -0
- package/dist/resources/schemas.d.ts.map +1 -0
- package/dist/resources/schemas.js +72 -0
- package/dist/resources/types.cjs +16 -0
- package/dist/resources/types.d.ts +57 -0
- package/dist/resources/types.d.ts.map +1 -0
- package/dist/resources/types.js +0 -0
- package/dist/search/index.d.ts +2 -4
- package/dist/search/index.d.ts.map +1 -0
- package/dist/search/search-service.d.ts +5 -9
- package/dist/search/search-service.d.ts.map +1 -0
- package/dist/search/types.d.ts +7 -10
- package/dist/search/types.d.ts.map +1 -0
- package/dist/session/chat-session.cjs +103 -10
- package/dist/session/chat-session.d.ts +30 -41
- package/dist/session/chat-session.d.ts.map +1 -0
- package/dist/session/chat-session.js +103 -10
- package/dist/session/error-codes.d.ts +2 -3
- package/dist/session/error-codes.d.ts.map +1 -0
- package/dist/session/errors.d.ts +2 -17
- package/dist/session/errors.d.ts.map +1 -0
- package/dist/session/history/database.d.ts +6 -9
- package/dist/session/history/database.d.ts.map +1 -0
- package/dist/session/history/factory.d.ts +4 -8
- package/dist/session/history/factory.d.ts.map +1 -0
- package/dist/session/history/memory.cjs +39 -0
- package/dist/session/history/memory.d.ts +14 -0
- package/dist/session/history/memory.d.ts.map +1 -0
- package/dist/session/history/memory.js +15 -0
- package/dist/session/history/types.d.ts +3 -6
- package/dist/session/history/types.d.ts.map +1 -0
- package/dist/session/index.d.ts +3 -50
- package/dist/session/index.d.ts.map +1 -0
- package/dist/session/schemas.d.ts +4 -6
- package/dist/session/schemas.d.ts.map +1 -0
- package/dist/session/session-manager.cjs +63 -29
- package/dist/session/session-manager.d.ts +27 -43
- package/dist/session/session-manager.d.ts.map +1 -0
- package/dist/session/session-manager.js +63 -29
- package/dist/session/title-generator.cjs +140 -0
- package/dist/session/title-generator.d.ts +22 -0
- package/dist/session/title-generator.d.ts.map +1 -0
- package/dist/session/title-generator.js +115 -0
- package/dist/storage/blob/factory.cjs +50 -0
- package/dist/storage/blob/factory.d.ts +8 -0
- package/dist/storage/blob/factory.d.ts.map +1 -0
- package/dist/storage/blob/factory.js +26 -0
- package/dist/storage/blob/local-blob-store.cjs +487 -0
- package/dist/storage/blob/local-blob-store.d.ts +56 -0
- package/dist/storage/blob/local-blob-store.d.ts.map +1 -0
- package/dist/storage/blob/local-blob-store.js +453 -0
- package/dist/storage/blob/schemas.cjs +53 -0
- package/dist/storage/blob/schemas.d.ts +80 -0
- package/dist/storage/blob/schemas.d.ts.map +1 -0
- package/dist/storage/blob/schemas.js +28 -0
- package/dist/storage/blob/types.cjs +16 -0
- package/dist/storage/blob/types.d.ts +154 -0
- package/dist/storage/blob/types.d.ts.map +1 -0
- package/dist/storage/blob/types.js +0 -0
- package/dist/storage/cache/factory.cjs +63 -0
- package/dist/storage/cache/factory.d.ts +8 -0
- package/dist/storage/cache/factory.d.ts.map +1 -0
- package/dist/storage/cache/factory.js +29 -0
- package/dist/storage/cache/memory-cache-store.cjs +107 -0
- package/dist/storage/cache/memory-cache-store.d.ts +26 -0
- package/dist/storage/cache/memory-cache-store.d.ts.map +1 -0
- package/dist/storage/cache/memory-cache-store.js +83 -0
- package/dist/storage/{backend/redis-backend.cjs → cache/redis-store.cjs} +8 -22
- package/dist/storage/{backend/redis-backend.d.ts → cache/redis-store.d.ts} +8 -14
- package/dist/storage/cache/redis-store.d.ts.map +1 -0
- package/dist/storage/{backend/redis-backend.js → cache/redis-store.js} +4 -18
- package/dist/storage/cache/schemas.cjs +77 -0
- package/dist/storage/cache/schemas.d.ts +151 -0
- package/dist/storage/cache/schemas.d.ts.map +1 -0
- package/dist/storage/cache/schemas.js +52 -0
- package/dist/storage/cache/types.cjs +16 -0
- package/dist/storage/{backend/cache-backend.d.cts → cache/types.d.ts} +3 -4
- package/dist/storage/cache/types.d.ts.map +1 -0
- package/dist/storage/cache/types.js +0 -0
- package/dist/storage/database/factory.cjs +84 -0
- package/dist/storage/database/factory.d.ts +8 -0
- package/dist/storage/database/factory.d.ts.map +1 -0
- package/dist/storage/database/factory.js +50 -0
- package/dist/storage/{backend/memory-backend.cjs → database/memory-database-store.cjs} +10 -28
- package/dist/storage/{backend/memory-backend.d.ts → database/memory-database-store.d.ts} +7 -12
- package/dist/storage/database/memory-database-store.d.ts.map +1 -0
- package/dist/storage/{backend/memory-backend.js → database/memory-database-store.js} +6 -24
- package/dist/storage/{backend/postgres-backend.cjs → database/postgres-store.cjs} +11 -11
- package/dist/storage/{backend/postgres-backend.d.ts → database/postgres-store.d.ts} +8 -11
- package/dist/storage/database/postgres-store.d.ts.map +1 -0
- package/dist/storage/{backend/postgres-backend.js → database/postgres-store.js} +7 -7
- package/dist/storage/database/schemas.cjs +89 -0
- package/dist/storage/database/schemas.d.ts +227 -0
- package/dist/storage/database/schemas.d.ts.map +1 -0
- package/dist/storage/database/schemas.js +64 -0
- package/dist/storage/{backend/sqlite-backend.cjs → database/sqlite-store.cjs} +15 -14
- package/dist/storage/{backend/sqlite-backend.d.ts → database/sqlite-store.d.ts} +8 -11
- package/dist/storage/database/sqlite-store.d.ts.map +1 -0
- package/dist/storage/{backend/sqlite-backend.js → database/sqlite-store.js} +11 -10
- package/dist/storage/database/types.cjs +16 -0
- package/dist/storage/{backend/database-backend.d.cts → database/types.d.ts} +3 -4
- package/dist/storage/database/types.d.ts.map +1 -0
- package/dist/storage/database/types.js +0 -0
- package/dist/storage/error-codes.cjs +15 -0
- package/dist/storage/error-codes.d.ts +19 -5
- package/dist/storage/error-codes.d.ts.map +1 -0
- package/dist/storage/error-codes.js +15 -0
- package/dist/storage/errors.cjs +195 -7
- package/dist/storage/errors.d.ts +71 -19
- package/dist/storage/errors.d.ts.map +1 -0
- package/dist/storage/errors.js +189 -1
- package/dist/storage/index.cjs +24 -5
- package/dist/storage/index.d.ts +48 -7
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +20 -4
- package/dist/storage/schemas.cjs +22 -84
- package/dist/storage/schemas.d.ts +98 -574
- package/dist/storage/schemas.d.ts.map +1 -0
- package/dist/storage/schemas.js +25 -84
- package/dist/storage/storage-manager.cjs +131 -116
- package/dist/storage/storage-manager.d.ts +51 -25
- package/dist/storage/storage-manager.d.ts.map +1 -0
- package/dist/storage/storage-manager.js +130 -105
- package/dist/storage/types.d.ts +7 -5
- package/dist/storage/types.d.ts.map +1 -0
- package/dist/systemPrompt/contributors.cjs +54 -0
- package/dist/systemPrompt/contributors.d.ts +30 -15
- package/dist/systemPrompt/contributors.d.ts.map +1 -0
- package/dist/systemPrompt/contributors.js +53 -0
- package/dist/systemPrompt/error-codes.d.ts +2 -3
- package/dist/systemPrompt/error-codes.d.ts.map +1 -0
- package/dist/systemPrompt/errors.d.ts +2 -17
- package/dist/systemPrompt/errors.d.ts.map +1 -0
- package/dist/systemPrompt/in-built-prompts.cjs +13 -15
- package/dist/systemPrompt/in-built-prompts.d.ts +4 -14
- package/dist/systemPrompt/in-built-prompts.d.ts.map +1 -0
- package/dist/systemPrompt/in-built-prompts.js +13 -15
- package/dist/systemPrompt/index.cjs +11 -0
- package/dist/systemPrompt/index.d.ts +7 -14
- package/dist/systemPrompt/index.d.ts.map +1 -0
- package/dist/systemPrompt/index.js +8 -0
- package/dist/systemPrompt/manager.cjs +24 -6
- package/dist/systemPrompt/manager.d.ts +8 -16
- package/dist/systemPrompt/manager.d.ts.map +1 -0
- package/dist/systemPrompt/manager.js +24 -6
- package/dist/systemPrompt/registry.d.ts +6 -16
- package/dist/systemPrompt/registry.d.ts.map +1 -0
- package/dist/systemPrompt/schemas.cjs +17 -3
- package/dist/systemPrompt/schemas.d.ts +204 -30
- package/dist/systemPrompt/schemas.d.ts.map +1 -0
- package/dist/systemPrompt/schemas.js +17 -3
- package/dist/systemPrompt/types.d.ts +3 -12
- package/dist/systemPrompt/types.d.ts.map +1 -0
- package/dist/tools/confirmation/allowed-tools-provider/factory.cjs +1 -1
- package/dist/tools/confirmation/allowed-tools-provider/factory.d.ts +6 -12
- package/dist/tools/confirmation/allowed-tools-provider/factory.d.ts.map +1 -0
- package/dist/tools/confirmation/allowed-tools-provider/factory.js +1 -1
- package/dist/tools/confirmation/allowed-tools-provider/in-memory.d.ts +3 -5
- package/dist/tools/confirmation/allowed-tools-provider/in-memory.d.ts.map +1 -0
- package/dist/tools/confirmation/allowed-tools-provider/storage.cjs +9 -9
- package/dist/tools/confirmation/allowed-tools-provider/storage.d.ts +7 -13
- package/dist/tools/confirmation/allowed-tools-provider/storage.d.ts.map +1 -0
- package/dist/tools/confirmation/allowed-tools-provider/storage.js +9 -9
- package/dist/tools/confirmation/allowed-tools-provider/types.d.ts +2 -3
- package/dist/tools/confirmation/allowed-tools-provider/types.d.ts.map +1 -0
- package/dist/tools/error-codes.d.ts +2 -3
- package/dist/tools/error-codes.d.ts.map +1 -0
- package/dist/tools/errors.d.ts +2 -17
- package/dist/tools/errors.d.ts.map +1 -0
- package/dist/tools/index.cjs +0 -2
- package/dist/tools/index.d.ts +11 -19
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +0 -1
- package/dist/tools/internal-tools/implementations/ask-user-tool.cjs +57 -0
- package/dist/tools/internal-tools/implementations/ask-user-tool.d.ts +18 -0
- package/dist/tools/internal-tools/implementations/ask-user-tool.d.ts.map +1 -0
- package/dist/tools/internal-tools/implementations/ask-user-tool.js +33 -0
- package/dist/tools/internal-tools/implementations/search-history-tool.d.ts +3 -11
- package/dist/tools/internal-tools/implementations/search-history-tool.d.ts.map +1 -0
- package/dist/tools/internal-tools/index.d.ts +3 -13
- package/dist/tools/internal-tools/index.d.ts.map +1 -0
- package/dist/tools/internal-tools/provider.cjs +9 -11
- package/dist/tools/internal-tools/provider.d.ts +6 -20
- package/dist/tools/internal-tools/provider.d.ts.map +1 -0
- package/dist/tools/internal-tools/provider.js +9 -11
- package/dist/tools/internal-tools/registry.cjs +6 -1
- package/dist/tools/internal-tools/registry.d.ts +10 -15
- package/dist/tools/internal-tools/registry.d.ts.map +1 -0
- package/dist/tools/internal-tools/registry.js +6 -1
- package/dist/tools/schemas.cjs +14 -2
- package/dist/tools/schemas.d.ts +12 -8
- package/dist/tools/schemas.d.ts.map +1 -0
- package/dist/tools/schemas.js +10 -2
- package/dist/tools/tool-manager.cjs +174 -14
- package/dist/tools/tool-manager.d.ts +48 -22
- package/dist/tools/tool-manager.d.ts.map +1 -0
- package/dist/tools/tool-manager.js +174 -14
- package/dist/tools/types.d.ts +9 -11
- package/dist/tools/types.d.ts.map +1 -0
- package/dist/utils/api-key-resolver.d.ts +5 -7
- package/dist/utils/api-key-resolver.d.ts.map +1 -0
- package/dist/utils/api-key-store.d.ts +5 -7
- package/dist/utils/api-key-store.d.ts.map +1 -0
- package/dist/utils/async-context.cjs +51 -0
- package/dist/utils/async-context.d.ts +68 -0
- package/dist/utils/async-context.d.ts.map +1 -0
- package/dist/utils/async-context.js +24 -0
- package/dist/utils/debug.cjs +40 -0
- package/dist/utils/debug.d.ts +2 -0
- package/dist/utils/debug.d.ts.map +1 -0
- package/dist/utils/debug.js +16 -0
- package/dist/utils/env.d.ts +4 -5
- package/dist/utils/env.d.ts.map +1 -0
- package/dist/utils/error-conversion.d.ts +2 -3
- package/dist/utils/error-conversion.d.ts.map +1 -0
- package/dist/utils/execution-context.d.ts +5 -6
- package/dist/utils/execution-context.d.ts.map +1 -0
- package/dist/utils/fs-walk.d.ts +2 -3
- package/dist/utils/fs-walk.d.ts.map +1 -0
- package/dist/utils/index.cjs +3 -1
- package/dist/utils/index.d.ts +14 -63
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/path.d.ts +9 -10
- package/dist/utils/path.d.ts.map +1 -0
- package/dist/utils/port-utils.d.ts +2 -3
- package/dist/utils/port-utils.d.ts.map +1 -0
- package/dist/utils/redactor.d.ts +2 -3
- package/dist/utils/redactor.d.ts.map +1 -0
- package/dist/utils/result.d.ts +14 -27
- package/dist/utils/result.d.ts.map +1 -0
- package/dist/utils/safe-stringify.d.ts +2 -3
- package/dist/utils/safe-stringify.d.ts.map +1 -0
- package/dist/utils/schema-metadata.cjs +235 -0
- package/dist/utils/schema-metadata.d.ts +82 -0
- package/dist/utils/schema-metadata.d.ts.map +1 -0
- package/dist/utils/schema-metadata.js +207 -0
- package/dist/utils/schema.d.ts +2 -3
- package/dist/utils/schema.d.ts.map +1 -0
- package/dist/utils/service-initializer.cjs +71 -34
- package/dist/utils/service-initializer.d.ts +18 -43
- package/dist/utils/service-initializer.d.ts.map +1 -0
- package/dist/utils/service-initializer.js +71 -34
- package/dist/utils/user-info.d.ts +2 -3
- package/dist/utils/user-info.d.ts.map +1 -0
- package/dist/utils/zod-schema-converter.d.ts +3 -5
- package/dist/utils/zod-schema-converter.d.ts.map +1 -0
- package/package.json +6 -4
- package/dist/agent/DextoAgent.d.cts +0 -541
- package/dist/agent/agentCard.d.cts +0 -20
- package/dist/agent/error-codes.d.cts +0 -14
- package/dist/agent/errors.d.cts +0 -44
- package/dist/agent/index.d.cts +0 -60
- package/dist/agent/registry/error-codes.d.cts +0 -20
- package/dist/agent/registry/errors.d.cts +0 -67
- package/dist/agent/registry/registry.d.cts +0 -67
- package/dist/agent/registry/types.d.cts +0 -100
- package/dist/agent/schemas.d.cts +0 -1502
- package/dist/agent/state-manager.d.cts +0 -97
- package/dist/config/agent-resolver.d.cts +0 -15
- package/dist/config/error-codes.d.cts +0 -17
- package/dist/config/errors.d.cts +0 -49
- package/dist/config/index.d.cts +0 -7
- package/dist/config/loader.d.cts +0 -19
- package/dist/config/writer.d.cts +0 -38
- package/dist/context/compression/middle-removal.d.cts +0 -48
- package/dist/context/compression/oldest-removal.d.cts +0 -43
- package/dist/context/compression/types.d.cts +0 -21
- package/dist/context/error-codes.d.cts +0 -19
- package/dist/context/errors.d.cts +0 -36
- package/dist/context/index.d.cts +0 -19
- package/dist/context/manager.d.cts +0 -254
- package/dist/context/types.d.cts +0 -113
- package/dist/context/utils.d.cts +0 -79
- package/dist/errors/DextoBaseError.d.cts +0 -15
- package/dist/errors/DextoRuntimeError.d.cts +0 -37
- package/dist/errors/DextoValidationError.d.cts +0 -65
- package/dist/errors/index.d.cts +0 -18
- package/dist/errors/result-bridge.d.cts +0 -39
- package/dist/errors/types.d.cts +0 -62
- package/dist/events/index.d.cts +0 -272
- package/dist/index.browser.d.cts +0 -53
- package/dist/index.d.cts +0 -89
- package/dist/llm/error-codes.d.cts +0 -26
- package/dist/llm/errors.d.cts +0 -58
- package/dist/llm/formatters/anthropic.d.cts +0 -45
- package/dist/llm/formatters/factory.d.cts +0 -12
- package/dist/llm/formatters/openai.d.cts +0 -38
- package/dist/llm/formatters/types.d.cts +0 -43
- package/dist/llm/formatters/vercel.d.cts +0 -48
- package/dist/llm/index.d.cts +0 -39
- package/dist/llm/registry.d.cts +0 -176
- package/dist/llm/resolver.d.cts +0 -34
- package/dist/llm/schemas.d.cts +0 -111
- package/dist/llm/services/anthropic.d.cts +0 -65
- package/dist/llm/services/factory.d.cts +0 -39
- package/dist/llm/services/index.d.cts +0 -21
- package/dist/llm/services/openai.d.cts +0 -65
- package/dist/llm/services/test-utils.integration.d.cts +0 -83
- package/dist/llm/services/types.d.cts +0 -56
- package/dist/llm/services/vercel.d.cts +0 -72
- package/dist/llm/tokenizer/anthropic.d.cts +0 -21
- package/dist/llm/tokenizer/default.d.cts +0 -16
- package/dist/llm/tokenizer/factory.d.cts +0 -12
- package/dist/llm/tokenizer/google.d.cts +0 -31
- package/dist/llm/tokenizer/openai.d.cts +0 -32
- package/dist/llm/tokenizer/types.d.cts +0 -19
- package/dist/llm/types.d.cts +0 -29
- package/dist/llm/validation.d.cts +0 -60
- package/dist/logger/browser.d.cts +0 -29
- package/dist/logger/index.d.cts +0 -1
- package/dist/logger/logger.d.cts +0 -52
- package/dist/mcp/error-codes.d.cts +0 -16
- package/dist/mcp/errors.d.cts +0 -72
- package/dist/mcp/index.d.cts +0 -26
- package/dist/mcp/manager.d.cts +0 -163
- package/dist/mcp/mcp-client.d.cts +0 -108
- package/dist/mcp/resolver.d.cts +0 -22
- package/dist/mcp/schemas.d.cts +0 -266
- package/dist/mcp/types.d.cts +0 -21
- package/dist/preferences/constants.d.cts +0 -3
- package/dist/preferences/error-codes.d.cts +0 -9
- package/dist/preferences/errors.d.cts +0 -33
- package/dist/preferences/index.d.cts +0 -21
- package/dist/preferences/loader.d.cts +0 -45
- package/dist/preferences/schemas.d.cts +0 -104
- package/dist/search/index.d.cts +0 -5
- package/dist/search/search-service.d.cts +0 -47
- package/dist/search/types.d.cts +0 -78
- package/dist/session/chat-session.d.cts +0 -284
- package/dist/session/error-codes.d.cts +0 -13
- package/dist/session/errors.d.cts +0 -58
- package/dist/session/history/database.d.cts +0 -28
- package/dist/session/history/factory.d.cts +0 -11
- package/dist/session/history/types.d.cts +0 -17
- package/dist/session/index.d.cts +0 -53
- package/dist/session/schemas.d.cts +0 -16
- package/dist/session/session-manager.d.cts +0 -219
- package/dist/storage/backend/cache-backend.d.ts +0 -15
- package/dist/storage/backend/database-backend.d.ts +0 -19
- package/dist/storage/backend/memory-backend.d.cts +0 -34
- package/dist/storage/backend/postgres-backend.d.cts +0 -37
- package/dist/storage/backend/redis-backend.d.cts +0 -36
- package/dist/storage/backend/sqlite-backend.d.cts +0 -35
- package/dist/storage/backend/types.d.cts +0 -14
- package/dist/storage/backend/types.d.ts +0 -14
- package/dist/storage/error-codes.d.cts +0 -14
- package/dist/storage/errors.d.cts +0 -63
- package/dist/storage/index.d.cts +0 -7
- package/dist/storage/schemas.d.cts +0 -856
- package/dist/storage/storage-manager.d.cts +0 -52
- package/dist/storage/types.d.cts +0 -5
- package/dist/systemPrompt/contributors.d.cts +0 -44
- package/dist/systemPrompt/error-codes.d.cts +0 -13
- package/dist/systemPrompt/errors.d.cts +0 -55
- package/dist/systemPrompt/in-built-prompts.d.cts +0 -28
- package/dist/systemPrompt/index.d.cts +0 -14
- package/dist/systemPrompt/manager.d.cts +0 -31
- package/dist/systemPrompt/registry.d.cts +0 -20
- package/dist/systemPrompt/schemas.d.cts +0 -401
- package/dist/systemPrompt/types.d.cts +0 -19
- package/dist/tools/confirmation/allowed-tools-provider/factory.d.cts +0 -19
- package/dist/tools/confirmation/allowed-tools-provider/in-memory.d.cts +0 -17
- package/dist/tools/confirmation/allowed-tools-provider/storage.d.cts +0 -26
- package/dist/tools/confirmation/allowed-tools-provider/types.d.cts +0 -35
- package/dist/tools/confirmation/event-based-confirmation-provider.cjs +0 -158
- package/dist/tools/confirmation/event-based-confirmation-provider.d.cts +0 -41
- package/dist/tools/confirmation/event-based-confirmation-provider.d.ts +0 -41
- package/dist/tools/confirmation/event-based-confirmation-provider.js +0 -134
- package/dist/tools/confirmation/factory.cjs +0 -52
- package/dist/tools/confirmation/factory.d.cts +0 -37
- package/dist/tools/confirmation/factory.d.ts +0 -37
- package/dist/tools/confirmation/factory.js +0 -28
- package/dist/tools/confirmation/noop-confirmation-provider.cjs +0 -49
- package/dist/tools/confirmation/noop-confirmation-provider.d.cts +0 -22
- package/dist/tools/confirmation/noop-confirmation-provider.d.ts +0 -22
- package/dist/tools/confirmation/noop-confirmation-provider.js +0 -25
- package/dist/tools/confirmation/types.d.cts +0 -46
- package/dist/tools/confirmation/types.d.ts +0 -46
- package/dist/tools/error-codes.d.cts +0 -18
- package/dist/tools/errors.d.cts +0 -97
- package/dist/tools/index.d.cts +0 -19
- package/dist/tools/internal-tools/implementations/search-history-tool.d.cts +0 -15
- package/dist/tools/internal-tools/index.d.cts +0 -13
- package/dist/tools/internal-tools/provider.d.cts +0 -66
- package/dist/tools/internal-tools/registry.d.cts +0 -45
- package/dist/tools/schemas.d.cts +0 -21
- package/dist/tools/tool-manager.d.cts +0 -106
- package/dist/tools/types.d.cts +0 -66
- package/dist/utils/api-key-resolver.d.cts +0 -23
- package/dist/utils/api-key-store.d.cts +0 -26
- package/dist/utils/env.d.cts +0 -29
- package/dist/utils/error-conversion.d.cts +0 -13
- package/dist/utils/execution-context.d.cts +0 -21
- package/dist/utils/fs-walk.d.cts +0 -9
- package/dist/utils/index.d.cts +0 -63
- package/dist/utils/path.d.cts +0 -54
- package/dist/utils/port-utils.d.cts +0 -11
- package/dist/utils/port-utils.spec.d.cts +0 -2
- package/dist/utils/port-utils.spec.d.ts +0 -2
- package/dist/utils/redactor.d.cts +0 -18
- package/dist/utils/result.d.cts +0 -180
- package/dist/utils/safe-stringify.d.cts +0 -7
- package/dist/utils/schema.d.cts +0 -6
- package/dist/utils/service-initializer.d.cts +0 -63
- package/dist/utils/user-info.d.cts +0 -3
- package/dist/utils/zod-schema-converter.d.cts +0 -13
- /package/dist/{storage/backend → memory}/types.cjs +0 -0
- /package/dist/{storage/backend → memory}/types.js +0 -0
- /package/dist/{tools/confirmation → plugins}/types.cjs +0 -0
- /package/dist/{tools/confirmation → plugins}/types.js +0 -0
- /package/dist/{storage/backend/cache-backend.js → prompts/types.js} +0 -0
- /package/dist/{storage/backend/database-backend.js → resources/handlers/types.js} +0 -0
package/dist/agent/DextoAgent.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { expandMessageReferences } from "../resources/index.js";
|
|
2
|
+
import { expandBlobReferences } from "../context/utils.js";
|
|
3
|
+
import { PromptManager } from "../prompts/index.js";
|
|
1
4
|
import { SessionError } from "../session/index.js";
|
|
2
5
|
import { logger } from "../logger/index.js";
|
|
3
6
|
import { LLMUpdatesSchema } from "../llm/schemas.js";
|
|
@@ -7,6 +10,7 @@ import { AgentError } from "./errors.js";
|
|
|
7
10
|
import { MCPError } from "../mcp/errors.js";
|
|
8
11
|
import { ensureOk } from "../errors/result-bridge.js";
|
|
9
12
|
import { fail, zodToIssues } from "../utils/result.js";
|
|
13
|
+
import { DextoValidationError } from "../errors/DextoValidationError.js";
|
|
10
14
|
import { resolveAndValidateMcpServerConfig } from "../mcp/resolver.js";
|
|
11
15
|
import {
|
|
12
16
|
getSupportedProviders,
|
|
@@ -18,16 +22,19 @@ import { createAgentServices } from "../utils/service-initializer.js";
|
|
|
18
22
|
import { AgentConfigSchema } from "./schemas.js";
|
|
19
23
|
import { getDextoPath } from "../utils/path.js";
|
|
20
24
|
import { safeStringify } from "../utils/safe-stringify.js";
|
|
21
|
-
import { getAgentRegistry } from "./registry/registry.js";
|
|
22
25
|
import { loadAgentConfig } from "../config/loader.js";
|
|
26
|
+
import { promises as fs } from "fs";
|
|
27
|
+
import { parseDocument } from "yaml";
|
|
28
|
+
import { deriveHeuristicTitle, generateSessionTitle } from "../session/title-generator.js";
|
|
23
29
|
const requiredServices = [
|
|
24
30
|
"mcpManager",
|
|
25
31
|
"toolManager",
|
|
26
|
-
"
|
|
32
|
+
"systemPromptManager",
|
|
27
33
|
"agentEventBus",
|
|
28
34
|
"stateManager",
|
|
29
35
|
"sessionManager",
|
|
30
|
-
"searchService"
|
|
36
|
+
"searchService",
|
|
37
|
+
"memoryManager"
|
|
31
38
|
];
|
|
32
39
|
class DextoAgent {
|
|
33
40
|
constructor(config, configPath) {
|
|
@@ -41,11 +48,14 @@ class DextoAgent {
|
|
|
41
48
|
* But the main recommended entry points/functions would still be the wrapper methods we define below
|
|
42
49
|
*/
|
|
43
50
|
mcpManager;
|
|
44
|
-
|
|
51
|
+
systemPromptManager;
|
|
45
52
|
agentEventBus;
|
|
53
|
+
promptManager;
|
|
46
54
|
stateManager;
|
|
47
55
|
sessionManager;
|
|
48
56
|
toolManager;
|
|
57
|
+
resourceManager;
|
|
58
|
+
memoryManager;
|
|
49
59
|
services;
|
|
50
60
|
// Search service for conversation search
|
|
51
61
|
searchService;
|
|
@@ -58,6 +68,8 @@ class DextoAgent {
|
|
|
58
68
|
_isStopped = false;
|
|
59
69
|
// Store config for async initialization
|
|
60
70
|
config;
|
|
71
|
+
// Event subscribers (e.g., WebSocket, Webhook handlers)
|
|
72
|
+
eventSubscribers = /* @__PURE__ */ new Set();
|
|
61
73
|
/**
|
|
62
74
|
* Starts the agent by initializing all async services.
|
|
63
75
|
* This method handles storage backends, MCP connections, session manager initialization, and other async operations.
|
|
@@ -82,15 +94,30 @@ class DextoAgent {
|
|
|
82
94
|
Object.assign(this, {
|
|
83
95
|
mcpManager: services.mcpManager,
|
|
84
96
|
toolManager: services.toolManager,
|
|
85
|
-
|
|
97
|
+
resourceManager: services.resourceManager,
|
|
98
|
+
systemPromptManager: services.systemPromptManager,
|
|
86
99
|
agentEventBus: services.agentEventBus,
|
|
87
100
|
stateManager: services.stateManager,
|
|
88
101
|
sessionManager: services.sessionManager,
|
|
102
|
+
memoryManager: services.memoryManager,
|
|
89
103
|
services
|
|
90
104
|
});
|
|
91
105
|
this.searchService = services.searchService;
|
|
106
|
+
const promptManager = new PromptManager(
|
|
107
|
+
this.mcpManager,
|
|
108
|
+
this.resourceManager,
|
|
109
|
+
this.config,
|
|
110
|
+
this.agentEventBus,
|
|
111
|
+
services.storageManager.getDatabase()
|
|
112
|
+
);
|
|
113
|
+
await promptManager.initialize();
|
|
114
|
+
Object.assign(this, { promptManager });
|
|
92
115
|
this._isStarted = true;
|
|
116
|
+
this._isStopped = false;
|
|
93
117
|
logger.info("DextoAgent started successfully.");
|
|
118
|
+
for (const subscriber of this.eventSubscribers) {
|
|
119
|
+
subscriber.subscribe(this.agentEventBus);
|
|
120
|
+
}
|
|
94
121
|
const logPath = getDextoPath("logs", "dexto.log");
|
|
95
122
|
console.log(`\u{1F4CB} Logs available at: ${logPath}`);
|
|
96
123
|
} catch (error) {
|
|
@@ -125,6 +152,15 @@ class DextoAgent {
|
|
|
125
152
|
const err = error instanceof Error ? error : new Error(String(error));
|
|
126
153
|
shutdownErrors.push(new Error(`SessionManager cleanup failed: ${err.message}`));
|
|
127
154
|
}
|
|
155
|
+
try {
|
|
156
|
+
if (this.services?.pluginManager) {
|
|
157
|
+
await this.services.pluginManager.cleanup();
|
|
158
|
+
logger.debug("PluginManager cleaned up successfully");
|
|
159
|
+
}
|
|
160
|
+
} catch (error) {
|
|
161
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
162
|
+
shutdownErrors.push(new Error(`PluginManager cleanup failed: ${err.message}`));
|
|
163
|
+
}
|
|
128
164
|
try {
|
|
129
165
|
if (this.mcpManager) {
|
|
130
166
|
await this.mcpManager.disconnectAll();
|
|
@@ -156,6 +192,30 @@ class DextoAgent {
|
|
|
156
192
|
throw error;
|
|
157
193
|
}
|
|
158
194
|
}
|
|
195
|
+
/**
|
|
196
|
+
* Register an event subscriber that will be automatically re-subscribed on agent restart.
|
|
197
|
+
* Subscribers are typically API layer components (WebSocket, Webhook handlers) that need
|
|
198
|
+
* to receive agent events. If the agent is already started, the subscriber is immediately subscribed.
|
|
199
|
+
*
|
|
200
|
+
* @param subscriber - Object implementing AgentEventSubscriber interface
|
|
201
|
+
*/
|
|
202
|
+
registerSubscriber(subscriber) {
|
|
203
|
+
this.eventSubscribers.add(subscriber);
|
|
204
|
+
if (this._isStarted) {
|
|
205
|
+
subscriber.subscribe(this.agentEventBus);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Restart the agent by stopping and starting it.
|
|
210
|
+
* Automatically re-subscribes all registered event subscribers to the new event bus.
|
|
211
|
+
* This is useful when configuration changes require a full agent restart.
|
|
212
|
+
*
|
|
213
|
+
* @throws Error if restart fails during stop or start phases
|
|
214
|
+
*/
|
|
215
|
+
async restart() {
|
|
216
|
+
await this.stop();
|
|
217
|
+
await this.start();
|
|
218
|
+
}
|
|
159
219
|
/**
|
|
160
220
|
* Checks if the agent has been started.
|
|
161
221
|
* @returns true if agent is started, false otherwise
|
|
@@ -220,7 +280,56 @@ class DextoAgent {
|
|
|
220
280
|
imageDataInput
|
|
221
281
|
)}, hasFile=${Boolean(fileDataInput)}`
|
|
222
282
|
);
|
|
223
|
-
|
|
283
|
+
let finalText = textInput;
|
|
284
|
+
let finalImageData = imageDataInput;
|
|
285
|
+
if (textInput && textInput.includes("@")) {
|
|
286
|
+
try {
|
|
287
|
+
const resources = await this.resourceManager.list();
|
|
288
|
+
const expansion = await expandMessageReferences(
|
|
289
|
+
textInput,
|
|
290
|
+
resources,
|
|
291
|
+
(uri) => this.resourceManager.read(uri)
|
|
292
|
+
);
|
|
293
|
+
if (expansion.unresolvedReferences.length > 0) {
|
|
294
|
+
const unresolvedNames = expansion.unresolvedReferences.map((ref) => ref.originalRef).join(", ");
|
|
295
|
+
logger.warn(
|
|
296
|
+
`Could not resolve ${expansion.unresolvedReferences.length} resource reference(s): ${unresolvedNames}`
|
|
297
|
+
);
|
|
298
|
+
}
|
|
299
|
+
const MAX_EXPANDED_SIZE = 5 * 1024 * 1024;
|
|
300
|
+
const expandedSize = Buffer.byteLength(expansion.expandedMessage, "utf-8");
|
|
301
|
+
if (expandedSize > MAX_EXPANDED_SIZE) {
|
|
302
|
+
logger.warn(
|
|
303
|
+
`Expanded message size (${(expandedSize / 1024 / 1024).toFixed(2)}MB) exceeds limit (${MAX_EXPANDED_SIZE / 1024 / 1024}MB). Content may be truncated.`
|
|
304
|
+
);
|
|
305
|
+
}
|
|
306
|
+
finalText = expansion.expandedMessage;
|
|
307
|
+
if (expansion.extractedImages.length > 0 && !imageDataInput) {
|
|
308
|
+
const firstImage = expansion.extractedImages[0];
|
|
309
|
+
if (firstImage) {
|
|
310
|
+
finalImageData = {
|
|
311
|
+
image: firstImage.image,
|
|
312
|
+
mimeType: firstImage.mimeType
|
|
313
|
+
};
|
|
314
|
+
logger.debug(
|
|
315
|
+
`Using extracted image: ${firstImage.name} (${firstImage.mimeType})`
|
|
316
|
+
);
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
} catch (error) {
|
|
320
|
+
logger.error(
|
|
321
|
+
`Failed to expand resource references: ${error instanceof Error ? error.message : String(error)}. Continuing with original message.`
|
|
322
|
+
);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
if (!finalText.trim() && !finalImageData && !fileDataInput) {
|
|
326
|
+
logger.warn(
|
|
327
|
+
"Resource expansion resulted in empty content. Using original message."
|
|
328
|
+
);
|
|
329
|
+
finalText = textInput;
|
|
330
|
+
}
|
|
331
|
+
void this.maybeGenerateTitle(targetSessionId, finalText, llmConfig);
|
|
332
|
+
const response = await session.run(finalText, finalImageData, fileDataInput, stream);
|
|
224
333
|
this.sessionManager.incrementMessageCount(session.id).catch(
|
|
225
334
|
(error) => logger.warn(
|
|
226
335
|
`Failed to increment message count: ${error instanceof Error ? error.message : String(error)}`
|
|
@@ -312,6 +421,82 @@ class DextoAgent {
|
|
|
312
421
|
this.ensureStarted();
|
|
313
422
|
return await this.sessionManager.getSessionMetadata(sessionId);
|
|
314
423
|
}
|
|
424
|
+
/**
|
|
425
|
+
* Sets a human-friendly title for the given session.
|
|
426
|
+
*/
|
|
427
|
+
async setSessionTitle(sessionId, title) {
|
|
428
|
+
this.ensureStarted();
|
|
429
|
+
await this.sessionManager.setSessionTitle(sessionId, title);
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* Gets the human-friendly title for the given session, if any.
|
|
433
|
+
*/
|
|
434
|
+
async getSessionTitle(sessionId) {
|
|
435
|
+
this.ensureStarted();
|
|
436
|
+
return await this.sessionManager.getSessionTitle(sessionId);
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* Background task: generate and persist a session title using the same LLM.
|
|
440
|
+
* Runs only for the first user message (messageCount === 0 and no existing title).
|
|
441
|
+
* Never throws; timeboxed in the generator.
|
|
442
|
+
*/
|
|
443
|
+
async maybeGenerateTitle(sessionId, userText, llmConfig) {
|
|
444
|
+
try {
|
|
445
|
+
const metadata = await this.sessionManager.getSessionMetadata(sessionId);
|
|
446
|
+
if (!metadata) {
|
|
447
|
+
logger.debug(
|
|
448
|
+
`[SessionTitle] No session metadata available for ${sessionId}, skipping title generation`
|
|
449
|
+
);
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
452
|
+
if (metadata.title) {
|
|
453
|
+
logger.debug(
|
|
454
|
+
`[SessionTitle] Session ${sessionId} already has title '${metadata.title}', skipping`
|
|
455
|
+
);
|
|
456
|
+
return;
|
|
457
|
+
}
|
|
458
|
+
if (!userText || !userText.trim()) {
|
|
459
|
+
logger.debug(
|
|
460
|
+
`[SessionTitle] User text empty for session ${sessionId}, skipping title generation`
|
|
461
|
+
);
|
|
462
|
+
return;
|
|
463
|
+
}
|
|
464
|
+
logger.debug(
|
|
465
|
+
`[SessionTitle] Checking title generation preconditions for session ${sessionId}`
|
|
466
|
+
);
|
|
467
|
+
const result = await generateSessionTitle(
|
|
468
|
+
llmConfig,
|
|
469
|
+
llmConfig.router,
|
|
470
|
+
this.toolManager,
|
|
471
|
+
this.systemPromptManager,
|
|
472
|
+
this.resourceManager,
|
|
473
|
+
userText
|
|
474
|
+
);
|
|
475
|
+
if (result.error) {
|
|
476
|
+
logger.debug(
|
|
477
|
+
`[SessionTitle] LLM title generation failed for ${sessionId}: ${result.error}${result.timedOut ? " (timeout)" : ""}`
|
|
478
|
+
);
|
|
479
|
+
}
|
|
480
|
+
let title = result.title;
|
|
481
|
+
if (!title) {
|
|
482
|
+
title = deriveHeuristicTitle(userText);
|
|
483
|
+
if (title) {
|
|
484
|
+
logger.info(`[SessionTitle] Using heuristic title for ${sessionId}: ${title}`);
|
|
485
|
+
} else {
|
|
486
|
+
logger.debug(
|
|
487
|
+
`[SessionTitle] No suitable title derived for session ${sessionId}`
|
|
488
|
+
);
|
|
489
|
+
return;
|
|
490
|
+
}
|
|
491
|
+
} else {
|
|
492
|
+
logger.info(`[SessionTitle] Generated LLM title for ${sessionId}: ${title}`);
|
|
493
|
+
}
|
|
494
|
+
await this.sessionManager.setSessionTitle(sessionId, title, { ifUnsetOnly: true });
|
|
495
|
+
this.agentEventBus.emit("dexto:sessionTitleUpdated", { sessionId, title });
|
|
496
|
+
} catch (err) {
|
|
497
|
+
logger.silly(`Title generation skipped/failed for ${sessionId}: ${String(err)}`);
|
|
498
|
+
}
|
|
499
|
+
}
|
|
315
500
|
/**
|
|
316
501
|
* Gets the conversation history for a specific session.
|
|
317
502
|
* @param sessionId The session ID
|
|
@@ -324,7 +509,23 @@ class DextoAgent {
|
|
|
324
509
|
if (!session) {
|
|
325
510
|
throw SessionError.notFound(sessionId);
|
|
326
511
|
}
|
|
327
|
-
|
|
512
|
+
const history = await session.getHistory();
|
|
513
|
+
if (!this.resourceManager) {
|
|
514
|
+
return history;
|
|
515
|
+
}
|
|
516
|
+
return await Promise.all(
|
|
517
|
+
history.map(async (message) => ({
|
|
518
|
+
...message,
|
|
519
|
+
content: await expandBlobReferences(message.content, this.resourceManager).catch(
|
|
520
|
+
(error) => {
|
|
521
|
+
logger.warn(
|
|
522
|
+
`Failed to expand blob references in message: ${error instanceof Error ? error.message : String(error)}`
|
|
523
|
+
);
|
|
524
|
+
return message.content;
|
|
525
|
+
}
|
|
526
|
+
)
|
|
527
|
+
}))
|
|
528
|
+
);
|
|
328
529
|
}
|
|
329
530
|
/**
|
|
330
531
|
* Search for messages across all sessions or within a specific session
|
|
@@ -640,6 +841,7 @@ class DextoAgent {
|
|
|
640
841
|
this.stateManager.addMcpServer(name, validatedConfig);
|
|
641
842
|
try {
|
|
642
843
|
await this.mcpManager.connectServer(name, validatedConfig);
|
|
844
|
+
await this.toolManager.refresh();
|
|
643
845
|
this.agentEventBus.emit("dexto:mcpServerConnected", {
|
|
644
846
|
name,
|
|
645
847
|
success: true
|
|
@@ -675,6 +877,7 @@ class DextoAgent {
|
|
|
675
877
|
this.ensureStarted();
|
|
676
878
|
await this.mcpManager.removeClient(name);
|
|
677
879
|
this.stateManager.removeMcpServer(name);
|
|
880
|
+
await this.toolManager.refresh();
|
|
678
881
|
}
|
|
679
882
|
/**
|
|
680
883
|
* Executes a tool from any source (MCP servers, custom tools, or internal tools).
|
|
@@ -723,6 +926,43 @@ class DextoAgent {
|
|
|
723
926
|
this.ensureStarted();
|
|
724
927
|
return this.mcpManager.getFailedConnections();
|
|
725
928
|
}
|
|
929
|
+
// ============= RESOURCE MANAGEMENT =============
|
|
930
|
+
/**
|
|
931
|
+
* Lists all available resources with their info.
|
|
932
|
+
* This includes resources from MCP servers and any custom resource providers.
|
|
933
|
+
*/
|
|
934
|
+
async listResources() {
|
|
935
|
+
this.ensureStarted();
|
|
936
|
+
return await this.resourceManager.list();
|
|
937
|
+
}
|
|
938
|
+
/**
|
|
939
|
+
* Checks if a resource exists by URI.
|
|
940
|
+
*/
|
|
941
|
+
async hasResource(uri) {
|
|
942
|
+
this.ensureStarted();
|
|
943
|
+
return await this.resourceManager.has(uri);
|
|
944
|
+
}
|
|
945
|
+
/**
|
|
946
|
+
* Reads the content of a specific resource by URI.
|
|
947
|
+
*/
|
|
948
|
+
async readResource(uri) {
|
|
949
|
+
this.ensureStarted();
|
|
950
|
+
return await this.resourceManager.read(uri);
|
|
951
|
+
}
|
|
952
|
+
/**
|
|
953
|
+
* Lists resources for a specific MCP server.
|
|
954
|
+
*/
|
|
955
|
+
async listResourcesForServer(serverId) {
|
|
956
|
+
this.ensureStarted();
|
|
957
|
+
const allResources = await this.resourceManager.list();
|
|
958
|
+
const serverResources = Object.values(allResources).filter((resource) => resource.serverName === serverId).map((resource) => {
|
|
959
|
+
const original = resource.metadata?.originalUri ?? resource.uri;
|
|
960
|
+
const name = resource.name ?? resource.uri.split("/").pop() ?? resource.uri;
|
|
961
|
+
const serverName = resource.serverName ?? serverId;
|
|
962
|
+
return { uri: original, name, originalUri: original, serverName };
|
|
963
|
+
});
|
|
964
|
+
return serverResources;
|
|
965
|
+
}
|
|
726
966
|
// ============= PROMPT MANAGEMENT =============
|
|
727
967
|
/**
|
|
728
968
|
* Gets the current system prompt with all dynamic content resolved.
|
|
@@ -753,7 +993,75 @@ class DextoAgent {
|
|
|
753
993
|
const context = {
|
|
754
994
|
mcpManager: this.mcpManager
|
|
755
995
|
};
|
|
756
|
-
return await this.
|
|
996
|
+
return await this.systemPromptManager.build(context);
|
|
997
|
+
}
|
|
998
|
+
/**
|
|
999
|
+
* Lists all available prompts from all providers (MCP, internal, starter, custom).
|
|
1000
|
+
* @returns Promise resolving to a PromptSet with all available prompts
|
|
1001
|
+
*/
|
|
1002
|
+
async listPrompts() {
|
|
1003
|
+
this.ensureStarted();
|
|
1004
|
+
return await this.promptManager.list();
|
|
1005
|
+
}
|
|
1006
|
+
/**
|
|
1007
|
+
* Gets the definition of a specific prompt by name.
|
|
1008
|
+
* @param name The name of the prompt
|
|
1009
|
+
* @returns Promise resolving to the prompt definition or null if not found
|
|
1010
|
+
*/
|
|
1011
|
+
async getPromptDefinition(name) {
|
|
1012
|
+
this.ensureStarted();
|
|
1013
|
+
return await this.promptManager.getPromptDefinition(name);
|
|
1014
|
+
}
|
|
1015
|
+
/**
|
|
1016
|
+
* Checks if a prompt exists.
|
|
1017
|
+
* @param name The name of the prompt to check
|
|
1018
|
+
* @returns Promise resolving to true if the prompt exists, false otherwise
|
|
1019
|
+
*/
|
|
1020
|
+
async hasPrompt(name) {
|
|
1021
|
+
this.ensureStarted();
|
|
1022
|
+
return await this.promptManager.has(name);
|
|
1023
|
+
}
|
|
1024
|
+
/**
|
|
1025
|
+
* Gets a prompt with its messages.
|
|
1026
|
+
* @param name The name of the prompt
|
|
1027
|
+
* @param args Optional arguments to pass to the prompt
|
|
1028
|
+
* @returns Promise resolving to the prompt result with messages
|
|
1029
|
+
*/
|
|
1030
|
+
async getPrompt(name, args) {
|
|
1031
|
+
this.ensureStarted();
|
|
1032
|
+
return await this.promptManager.getPrompt(name, args);
|
|
1033
|
+
}
|
|
1034
|
+
/**
|
|
1035
|
+
* Creates a new custom prompt.
|
|
1036
|
+
* @param input The prompt creation input
|
|
1037
|
+
* @returns Promise resolving to the created prompt info
|
|
1038
|
+
*/
|
|
1039
|
+
async createCustomPrompt(input) {
|
|
1040
|
+
this.ensureStarted();
|
|
1041
|
+
return await this.promptManager.createCustomPrompt(input);
|
|
1042
|
+
}
|
|
1043
|
+
/**
|
|
1044
|
+
* Deletes a custom prompt by name.
|
|
1045
|
+
* @param name The name of the custom prompt to delete
|
|
1046
|
+
*/
|
|
1047
|
+
async deleteCustomPrompt(name) {
|
|
1048
|
+
this.ensureStarted();
|
|
1049
|
+
return await this.promptManager.deleteCustomPrompt(name);
|
|
1050
|
+
}
|
|
1051
|
+
/**
|
|
1052
|
+
* Resolves a prompt to its text content with all arguments applied.
|
|
1053
|
+
* This is a high-level method that handles:
|
|
1054
|
+
* - Prompt key resolution (resolving aliases)
|
|
1055
|
+
* - Argument normalization (including special _context field)
|
|
1056
|
+
* - Prompt execution and flattening
|
|
1057
|
+
*
|
|
1058
|
+
* @param name The prompt name or alias
|
|
1059
|
+
* @param options Optional configuration for prompt resolution
|
|
1060
|
+
* @returns Promise resolving to the resolved text and resource URIs
|
|
1061
|
+
*/
|
|
1062
|
+
async resolvePrompt(name, options = {}) {
|
|
1063
|
+
this.ensureStarted();
|
|
1064
|
+
return await this.promptManager.resolvePrompt(name, options);
|
|
757
1065
|
}
|
|
758
1066
|
// ============= CONFIGURATION ACCESS =============
|
|
759
1067
|
/**
|
|
@@ -765,138 +1073,135 @@ class DextoAgent {
|
|
|
765
1073
|
this.ensureStarted();
|
|
766
1074
|
return sessionId ? this.stateManager.getRuntimeConfig(sessionId) : this.stateManager.getRuntimeConfig();
|
|
767
1075
|
}
|
|
768
|
-
// ============= AGENT MANAGEMENT =============
|
|
769
1076
|
/**
|
|
770
|
-
*
|
|
771
|
-
*
|
|
772
|
-
*
|
|
773
|
-
*
|
|
774
|
-
* @returns Promise resolving to object with installed and available agent lists
|
|
775
|
-
*
|
|
776
|
-
* @example
|
|
777
|
-
* ```typescript
|
|
778
|
-
* const agents = await agent.listAgents();
|
|
779
|
-
* console.log(agents.installed); // ['default', 'my-custom-agent']
|
|
780
|
-
* console.log(agents.available); // [{ name: 'productivity', description: '...', ... }]
|
|
781
|
-
* console.log(agents.current?.name); // 'default'
|
|
782
|
-
* ```
|
|
1077
|
+
* Gets the file path of the agent configuration currently in use.
|
|
1078
|
+
* This returns the source agent file path, not session-specific overrides.
|
|
1079
|
+
* @returns The path to the agent configuration file
|
|
1080
|
+
* @throws AgentError if no config path is available
|
|
783
1081
|
*/
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
installedNames.map(async (name) => {
|
|
790
|
-
const registryEntry = availableMap[name];
|
|
791
|
-
if (registryEntry) {
|
|
792
|
-
return {
|
|
793
|
-
name,
|
|
794
|
-
description: registryEntry.description,
|
|
795
|
-
author: registryEntry.author,
|
|
796
|
-
tags: registryEntry.tags
|
|
797
|
-
};
|
|
798
|
-
} else {
|
|
799
|
-
try {
|
|
800
|
-
const config = await loadAgentConfig(name);
|
|
801
|
-
const author = config.agentCard?.provider?.organization;
|
|
802
|
-
const result = {
|
|
803
|
-
name,
|
|
804
|
-
description: config.agentCard?.description || "Local agent",
|
|
805
|
-
tags: []
|
|
806
|
-
};
|
|
807
|
-
if (author) {
|
|
808
|
-
result.author = author;
|
|
809
|
-
}
|
|
810
|
-
return result;
|
|
811
|
-
} catch {
|
|
812
|
-
return {
|
|
813
|
-
name,
|
|
814
|
-
description: "Local agent (config unavailable)",
|
|
815
|
-
tags: []
|
|
816
|
-
};
|
|
817
|
-
}
|
|
818
|
-
}
|
|
819
|
-
})
|
|
820
|
-
);
|
|
821
|
-
const available = Object.entries(availableMap).filter(([name]) => !installedNames.includes(name)).map(([name, entry]) => ({
|
|
822
|
-
name,
|
|
823
|
-
description: entry.description,
|
|
824
|
-
author: entry.author,
|
|
825
|
-
tags: entry.tags
|
|
826
|
-
}));
|
|
827
|
-
return {
|
|
828
|
-
installed,
|
|
829
|
-
available,
|
|
830
|
-
current: { name: null }
|
|
831
|
-
// TODO: Track current agent name
|
|
832
|
-
};
|
|
1082
|
+
getAgentFilePath() {
|
|
1083
|
+
if (!this.configPath) {
|
|
1084
|
+
throw AgentError.noConfigPath();
|
|
1085
|
+
}
|
|
1086
|
+
return this.configPath;
|
|
833
1087
|
}
|
|
834
1088
|
/**
|
|
835
|
-
*
|
|
836
|
-
*
|
|
1089
|
+
* Reloads the agent configuration from disk.
|
|
1090
|
+
* This will re-read the config file, validate it, and detect what changed.
|
|
1091
|
+
* Most configuration changes require a full agent restart to take effect.
|
|
837
1092
|
*
|
|
838
|
-
*
|
|
839
|
-
* @returns Promise that resolves when installation is complete
|
|
1093
|
+
* To apply changes: stop the agent and start it again with the new config.
|
|
840
1094
|
*
|
|
841
|
-
* @
|
|
1095
|
+
* @returns Object containing list of changes that require restart
|
|
1096
|
+
* @throws Error if config file cannot be read or is invalid
|
|
842
1097
|
*
|
|
843
|
-
*
|
|
844
|
-
* ```typescript
|
|
845
|
-
* await agent.installAgent('productivity');
|
|
846
|
-
* console.log('Productivity agent installed successfully');
|
|
847
|
-
* ```
|
|
1098
|
+
* TODO: improve hot reload capabilites so that we don't always require a restart
|
|
848
1099
|
*/
|
|
849
|
-
async
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
throw AgentError.apiValidationError(`Agent '${agentName}' not found in registry`);
|
|
1100
|
+
async reloadConfig() {
|
|
1101
|
+
if (!this.configPath) {
|
|
1102
|
+
throw AgentError.noConfigPath();
|
|
853
1103
|
}
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
1104
|
+
logger.info(`Reloading agent configuration from: ${this.configPath}`);
|
|
1105
|
+
const oldConfig = this.config;
|
|
1106
|
+
const newConfig = await loadAgentConfig(this.configPath);
|
|
1107
|
+
const validated = AgentConfigSchema.parse(newConfig);
|
|
1108
|
+
const restartRequired = this.detectRestartRequiredChanges(oldConfig, validated);
|
|
1109
|
+
this.config = validated;
|
|
1110
|
+
if (restartRequired.length > 0) {
|
|
1111
|
+
logger.warn(
|
|
1112
|
+
`Configuration updated. Restart required to apply: ${restartRequired.join(", ")}`
|
|
862
1113
|
);
|
|
1114
|
+
} else {
|
|
1115
|
+
logger.info("Agent configuration reloaded successfully (no changes detected)");
|
|
863
1116
|
}
|
|
1117
|
+
return {
|
|
1118
|
+
restartRequired
|
|
1119
|
+
};
|
|
864
1120
|
}
|
|
865
1121
|
/**
|
|
866
|
-
*
|
|
867
|
-
* This
|
|
868
|
-
*
|
|
869
|
-
*
|
|
870
|
-
*
|
|
871
|
-
*
|
|
872
|
-
*
|
|
873
|
-
* @
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
1122
|
+
* Updates and saves the agent configuration to disk.
|
|
1123
|
+
* This merges the updates with the raw config from disk, validates, and writes to file.
|
|
1124
|
+
* IMPORTANT: This preserves environment variable placeholders (e.g., $OPENAI_API_KEY)
|
|
1125
|
+
* to avoid leaking secrets into the config file.
|
|
1126
|
+
* @param updates Partial configuration updates to apply
|
|
1127
|
+
* @param targetPath Optional path to save to (defaults to current config path)
|
|
1128
|
+
* @returns Object containing list of changes that require restart
|
|
1129
|
+
* @throws Error if validation fails or file cannot be written
|
|
1130
|
+
*/
|
|
1131
|
+
async updateAndSaveConfig(updates, targetPath) {
|
|
1132
|
+
const path = targetPath || this.configPath;
|
|
1133
|
+
if (!path) {
|
|
1134
|
+
throw AgentError.noConfigPath();
|
|
1135
|
+
}
|
|
1136
|
+
logger.info(`Updating and saving agent configuration to: ${path}`);
|
|
1137
|
+
const rawYaml = await fs.readFile(path, "utf-8");
|
|
1138
|
+
const doc = parseDocument(rawYaml);
|
|
1139
|
+
const rawConfig = doc.toJSON();
|
|
1140
|
+
const updatedRawConfig = { ...rawConfig, ...updates };
|
|
1141
|
+
const parsed = AgentConfigSchema.safeParse(updatedRawConfig);
|
|
1142
|
+
if (!parsed.success) {
|
|
1143
|
+
const result = fail(zodToIssues(parsed.error, "error"));
|
|
1144
|
+
throw new DextoValidationError(result.issues);
|
|
1145
|
+
}
|
|
1146
|
+
for (const [key, value] of Object.entries(updates)) {
|
|
1147
|
+
doc.set(key, value);
|
|
1148
|
+
}
|
|
1149
|
+
const yamlContent = String(doc);
|
|
1150
|
+
const tmpPath = `${path}.tmp`;
|
|
1151
|
+
await fs.writeFile(tmpPath, yamlContent, "utf-8");
|
|
1152
|
+
await fs.rename(tmpPath, path);
|
|
1153
|
+
const reloadResult = await this.reloadConfig();
|
|
1154
|
+
logger.info(`Agent configuration saved to: ${path}`);
|
|
1155
|
+
return reloadResult;
|
|
1156
|
+
}
|
|
1157
|
+
/**
|
|
1158
|
+
* Detects configuration changes that require a full agent restart.
|
|
1159
|
+
* Returns an array of change descriptions.
|
|
877
1160
|
*
|
|
878
|
-
* @
|
|
879
|
-
*
|
|
880
|
-
*
|
|
881
|
-
*
|
|
882
|
-
* ```
|
|
1161
|
+
* @param oldConfig Previous validated configuration
|
|
1162
|
+
* @param newConfig New validated configuration
|
|
1163
|
+
* @returns Array of restart-required change descriptions
|
|
1164
|
+
* @private
|
|
883
1165
|
*/
|
|
884
|
-
|
|
885
|
-
const
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
);
|
|
897
|
-
throw AgentError.apiValidationError(`Failed to create agent '${agentName}'`, error);
|
|
1166
|
+
detectRestartRequiredChanges(oldConfig, newConfig) {
|
|
1167
|
+
const changes = [];
|
|
1168
|
+
if (JSON.stringify(oldConfig.storage) !== JSON.stringify(newConfig.storage)) {
|
|
1169
|
+
changes.push("Storage backend");
|
|
1170
|
+
}
|
|
1171
|
+
if (JSON.stringify(oldConfig.sessions) !== JSON.stringify(newConfig.sessions)) {
|
|
1172
|
+
changes.push("Session configuration");
|
|
1173
|
+
}
|
|
1174
|
+
if (JSON.stringify(oldConfig.systemPrompt) !== JSON.stringify(newConfig.systemPrompt)) {
|
|
1175
|
+
changes.push("System prompt");
|
|
1176
|
+
}
|
|
1177
|
+
if (JSON.stringify(oldConfig.toolConfirmation) !== JSON.stringify(newConfig.toolConfirmation)) {
|
|
1178
|
+
changes.push("Tool confirmation");
|
|
898
1179
|
}
|
|
1180
|
+
if (JSON.stringify(oldConfig.internalTools) !== JSON.stringify(newConfig.internalTools)) {
|
|
1181
|
+
changes.push("Internal tools");
|
|
1182
|
+
}
|
|
1183
|
+
if (JSON.stringify(oldConfig.mcpServers) !== JSON.stringify(newConfig.mcpServers)) {
|
|
1184
|
+
changes.push("MCP servers");
|
|
1185
|
+
}
|
|
1186
|
+
if (oldConfig.llm.provider !== newConfig.llm.provider || oldConfig.llm.model !== newConfig.llm.model || oldConfig.llm.apiKey !== newConfig.llm.apiKey) {
|
|
1187
|
+
changes.push("LLM configuration");
|
|
1188
|
+
}
|
|
1189
|
+
return changes;
|
|
899
1190
|
}
|
|
1191
|
+
// ============= AGENT MANAGEMENT =============
|
|
1192
|
+
// Note: Agent management methods have been moved to the Dexto orchestrator class.
|
|
1193
|
+
// See: /packages/core/src/Dexto.ts
|
|
1194
|
+
//
|
|
1195
|
+
// For agent lifecycle operations (list, install, uninstall, create), use:
|
|
1196
|
+
// ```typescript
|
|
1197
|
+
// await Dexto.listAgents(); // Static
|
|
1198
|
+
// await Dexto.installAgent(name); // Static
|
|
1199
|
+
// await Dexto.installCustomAgent(name, path, metadata); // Static
|
|
1200
|
+
// await Dexto.uninstallAgent(name); // Static
|
|
1201
|
+
//
|
|
1202
|
+
// const dexto = new Dexto();
|
|
1203
|
+
// await dexto.createAgent(name); // Instance method
|
|
1204
|
+
// ```
|
|
900
1205
|
// Future methods could encapsulate more complex agent behaviors:
|
|
901
1206
|
// - Multi-step task execution with progress tracking
|
|
902
1207
|
// - Memory and context management across sessions
|