@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
|
@@ -21,6 +21,9 @@ __export(DextoAgent_exports, {
|
|
|
21
21
|
DextoAgent: () => DextoAgent
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(DextoAgent_exports);
|
|
24
|
+
var import_resources = require("../resources/index.js");
|
|
25
|
+
var import_utils = require("../context/utils.js");
|
|
26
|
+
var import_prompts = require("../prompts/index.js");
|
|
24
27
|
var import_session = require("../session/index.js");
|
|
25
28
|
var import_logger = require("../logger/index.js");
|
|
26
29
|
var import_schemas = require("../llm/schemas.cjs");
|
|
@@ -30,22 +33,26 @@ var import_errors = require("./errors.js");
|
|
|
30
33
|
var import_errors2 = require("../mcp/errors.js");
|
|
31
34
|
var import_result_bridge = require("../errors/result-bridge.cjs");
|
|
32
35
|
var import_result = require("../utils/result.cjs");
|
|
36
|
+
var import_DextoValidationError = require("../errors/DextoValidationError.cjs");
|
|
33
37
|
var import_resolver2 = require("../mcp/resolver.js");
|
|
34
38
|
var import_registry = require("../llm/registry.js");
|
|
35
39
|
var import_service_initializer2 = require("../utils/service-initializer.js");
|
|
36
40
|
var import_schemas2 = require("./schemas.js");
|
|
37
41
|
var import_path = require("../utils/path.js");
|
|
38
42
|
var import_safe_stringify = require("../utils/safe-stringify.cjs");
|
|
39
|
-
var import_registry2 = require("./registry/registry.js");
|
|
40
43
|
var import_loader = require("../config/loader.js");
|
|
44
|
+
var import_fs = require("fs");
|
|
45
|
+
var import_yaml = require("yaml");
|
|
46
|
+
var import_title_generator = require("../session/title-generator.js");
|
|
41
47
|
const requiredServices = [
|
|
42
48
|
"mcpManager",
|
|
43
49
|
"toolManager",
|
|
44
|
-
"
|
|
50
|
+
"systemPromptManager",
|
|
45
51
|
"agentEventBus",
|
|
46
52
|
"stateManager",
|
|
47
53
|
"sessionManager",
|
|
48
|
-
"searchService"
|
|
54
|
+
"searchService",
|
|
55
|
+
"memoryManager"
|
|
49
56
|
];
|
|
50
57
|
class DextoAgent {
|
|
51
58
|
constructor(config, configPath) {
|
|
@@ -59,11 +66,14 @@ class DextoAgent {
|
|
|
59
66
|
* But the main recommended entry points/functions would still be the wrapper methods we define below
|
|
60
67
|
*/
|
|
61
68
|
mcpManager;
|
|
62
|
-
|
|
69
|
+
systemPromptManager;
|
|
63
70
|
agentEventBus;
|
|
71
|
+
promptManager;
|
|
64
72
|
stateManager;
|
|
65
73
|
sessionManager;
|
|
66
74
|
toolManager;
|
|
75
|
+
resourceManager;
|
|
76
|
+
memoryManager;
|
|
67
77
|
services;
|
|
68
78
|
// Search service for conversation search
|
|
69
79
|
searchService;
|
|
@@ -76,6 +86,8 @@ class DextoAgent {
|
|
|
76
86
|
_isStopped = false;
|
|
77
87
|
// Store config for async initialization
|
|
78
88
|
config;
|
|
89
|
+
// Event subscribers (e.g., WebSocket, Webhook handlers)
|
|
90
|
+
eventSubscribers = /* @__PURE__ */ new Set();
|
|
79
91
|
/**
|
|
80
92
|
* Starts the agent by initializing all async services.
|
|
81
93
|
* This method handles storage backends, MCP connections, session manager initialization, and other async operations.
|
|
@@ -100,15 +112,30 @@ class DextoAgent {
|
|
|
100
112
|
Object.assign(this, {
|
|
101
113
|
mcpManager: services.mcpManager,
|
|
102
114
|
toolManager: services.toolManager,
|
|
103
|
-
|
|
115
|
+
resourceManager: services.resourceManager,
|
|
116
|
+
systemPromptManager: services.systemPromptManager,
|
|
104
117
|
agentEventBus: services.agentEventBus,
|
|
105
118
|
stateManager: services.stateManager,
|
|
106
119
|
sessionManager: services.sessionManager,
|
|
120
|
+
memoryManager: services.memoryManager,
|
|
107
121
|
services
|
|
108
122
|
});
|
|
109
123
|
this.searchService = services.searchService;
|
|
124
|
+
const promptManager = new import_prompts.PromptManager(
|
|
125
|
+
this.mcpManager,
|
|
126
|
+
this.resourceManager,
|
|
127
|
+
this.config,
|
|
128
|
+
this.agentEventBus,
|
|
129
|
+
services.storageManager.getDatabase()
|
|
130
|
+
);
|
|
131
|
+
await promptManager.initialize();
|
|
132
|
+
Object.assign(this, { promptManager });
|
|
110
133
|
this._isStarted = true;
|
|
134
|
+
this._isStopped = false;
|
|
111
135
|
import_logger.logger.info("DextoAgent started successfully.");
|
|
136
|
+
for (const subscriber of this.eventSubscribers) {
|
|
137
|
+
subscriber.subscribe(this.agentEventBus);
|
|
138
|
+
}
|
|
112
139
|
const logPath = (0, import_path.getDextoPath)("logs", "dexto.log");
|
|
113
140
|
console.log(`\u{1F4CB} Logs available at: ${logPath}`);
|
|
114
141
|
} catch (error) {
|
|
@@ -143,6 +170,15 @@ class DextoAgent {
|
|
|
143
170
|
const err = error instanceof Error ? error : new Error(String(error));
|
|
144
171
|
shutdownErrors.push(new Error(`SessionManager cleanup failed: ${err.message}`));
|
|
145
172
|
}
|
|
173
|
+
try {
|
|
174
|
+
if (this.services?.pluginManager) {
|
|
175
|
+
await this.services.pluginManager.cleanup();
|
|
176
|
+
import_logger.logger.debug("PluginManager cleaned up successfully");
|
|
177
|
+
}
|
|
178
|
+
} catch (error) {
|
|
179
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
180
|
+
shutdownErrors.push(new Error(`PluginManager cleanup failed: ${err.message}`));
|
|
181
|
+
}
|
|
146
182
|
try {
|
|
147
183
|
if (this.mcpManager) {
|
|
148
184
|
await this.mcpManager.disconnectAll();
|
|
@@ -174,6 +210,30 @@ class DextoAgent {
|
|
|
174
210
|
throw error;
|
|
175
211
|
}
|
|
176
212
|
}
|
|
213
|
+
/**
|
|
214
|
+
* Register an event subscriber that will be automatically re-subscribed on agent restart.
|
|
215
|
+
* Subscribers are typically API layer components (WebSocket, Webhook handlers) that need
|
|
216
|
+
* to receive agent events. If the agent is already started, the subscriber is immediately subscribed.
|
|
217
|
+
*
|
|
218
|
+
* @param subscriber - Object implementing AgentEventSubscriber interface
|
|
219
|
+
*/
|
|
220
|
+
registerSubscriber(subscriber) {
|
|
221
|
+
this.eventSubscribers.add(subscriber);
|
|
222
|
+
if (this._isStarted) {
|
|
223
|
+
subscriber.subscribe(this.agentEventBus);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Restart the agent by stopping and starting it.
|
|
228
|
+
* Automatically re-subscribes all registered event subscribers to the new event bus.
|
|
229
|
+
* This is useful when configuration changes require a full agent restart.
|
|
230
|
+
*
|
|
231
|
+
* @throws Error if restart fails during stop or start phases
|
|
232
|
+
*/
|
|
233
|
+
async restart() {
|
|
234
|
+
await this.stop();
|
|
235
|
+
await this.start();
|
|
236
|
+
}
|
|
177
237
|
/**
|
|
178
238
|
* Checks if the agent has been started.
|
|
179
239
|
* @returns true if agent is started, false otherwise
|
|
@@ -238,7 +298,56 @@ class DextoAgent {
|
|
|
238
298
|
imageDataInput
|
|
239
299
|
)}, hasFile=${Boolean(fileDataInput)}`
|
|
240
300
|
);
|
|
241
|
-
|
|
301
|
+
let finalText = textInput;
|
|
302
|
+
let finalImageData = imageDataInput;
|
|
303
|
+
if (textInput && textInput.includes("@")) {
|
|
304
|
+
try {
|
|
305
|
+
const resources = await this.resourceManager.list();
|
|
306
|
+
const expansion = await (0, import_resources.expandMessageReferences)(
|
|
307
|
+
textInput,
|
|
308
|
+
resources,
|
|
309
|
+
(uri) => this.resourceManager.read(uri)
|
|
310
|
+
);
|
|
311
|
+
if (expansion.unresolvedReferences.length > 0) {
|
|
312
|
+
const unresolvedNames = expansion.unresolvedReferences.map((ref) => ref.originalRef).join(", ");
|
|
313
|
+
import_logger.logger.warn(
|
|
314
|
+
`Could not resolve ${expansion.unresolvedReferences.length} resource reference(s): ${unresolvedNames}`
|
|
315
|
+
);
|
|
316
|
+
}
|
|
317
|
+
const MAX_EXPANDED_SIZE = 5 * 1024 * 1024;
|
|
318
|
+
const expandedSize = Buffer.byteLength(expansion.expandedMessage, "utf-8");
|
|
319
|
+
if (expandedSize > MAX_EXPANDED_SIZE) {
|
|
320
|
+
import_logger.logger.warn(
|
|
321
|
+
`Expanded message size (${(expandedSize / 1024 / 1024).toFixed(2)}MB) exceeds limit (${MAX_EXPANDED_SIZE / 1024 / 1024}MB). Content may be truncated.`
|
|
322
|
+
);
|
|
323
|
+
}
|
|
324
|
+
finalText = expansion.expandedMessage;
|
|
325
|
+
if (expansion.extractedImages.length > 0 && !imageDataInput) {
|
|
326
|
+
const firstImage = expansion.extractedImages[0];
|
|
327
|
+
if (firstImage) {
|
|
328
|
+
finalImageData = {
|
|
329
|
+
image: firstImage.image,
|
|
330
|
+
mimeType: firstImage.mimeType
|
|
331
|
+
};
|
|
332
|
+
import_logger.logger.debug(
|
|
333
|
+
`Using extracted image: ${firstImage.name} (${firstImage.mimeType})`
|
|
334
|
+
);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
} catch (error) {
|
|
338
|
+
import_logger.logger.error(
|
|
339
|
+
`Failed to expand resource references: ${error instanceof Error ? error.message : String(error)}. Continuing with original message.`
|
|
340
|
+
);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
if (!finalText.trim() && !finalImageData && !fileDataInput) {
|
|
344
|
+
import_logger.logger.warn(
|
|
345
|
+
"Resource expansion resulted in empty content. Using original message."
|
|
346
|
+
);
|
|
347
|
+
finalText = textInput;
|
|
348
|
+
}
|
|
349
|
+
void this.maybeGenerateTitle(targetSessionId, finalText, llmConfig);
|
|
350
|
+
const response = await session.run(finalText, finalImageData, fileDataInput, stream);
|
|
242
351
|
this.sessionManager.incrementMessageCount(session.id).catch(
|
|
243
352
|
(error) => import_logger.logger.warn(
|
|
244
353
|
`Failed to increment message count: ${error instanceof Error ? error.message : String(error)}`
|
|
@@ -330,6 +439,82 @@ class DextoAgent {
|
|
|
330
439
|
this.ensureStarted();
|
|
331
440
|
return await this.sessionManager.getSessionMetadata(sessionId);
|
|
332
441
|
}
|
|
442
|
+
/**
|
|
443
|
+
* Sets a human-friendly title for the given session.
|
|
444
|
+
*/
|
|
445
|
+
async setSessionTitle(sessionId, title) {
|
|
446
|
+
this.ensureStarted();
|
|
447
|
+
await this.sessionManager.setSessionTitle(sessionId, title);
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* Gets the human-friendly title for the given session, if any.
|
|
451
|
+
*/
|
|
452
|
+
async getSessionTitle(sessionId) {
|
|
453
|
+
this.ensureStarted();
|
|
454
|
+
return await this.sessionManager.getSessionTitle(sessionId);
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* Background task: generate and persist a session title using the same LLM.
|
|
458
|
+
* Runs only for the first user message (messageCount === 0 and no existing title).
|
|
459
|
+
* Never throws; timeboxed in the generator.
|
|
460
|
+
*/
|
|
461
|
+
async maybeGenerateTitle(sessionId, userText, llmConfig) {
|
|
462
|
+
try {
|
|
463
|
+
const metadata = await this.sessionManager.getSessionMetadata(sessionId);
|
|
464
|
+
if (!metadata) {
|
|
465
|
+
import_logger.logger.debug(
|
|
466
|
+
`[SessionTitle] No session metadata available for ${sessionId}, skipping title generation`
|
|
467
|
+
);
|
|
468
|
+
return;
|
|
469
|
+
}
|
|
470
|
+
if (metadata.title) {
|
|
471
|
+
import_logger.logger.debug(
|
|
472
|
+
`[SessionTitle] Session ${sessionId} already has title '${metadata.title}', skipping`
|
|
473
|
+
);
|
|
474
|
+
return;
|
|
475
|
+
}
|
|
476
|
+
if (!userText || !userText.trim()) {
|
|
477
|
+
import_logger.logger.debug(
|
|
478
|
+
`[SessionTitle] User text empty for session ${sessionId}, skipping title generation`
|
|
479
|
+
);
|
|
480
|
+
return;
|
|
481
|
+
}
|
|
482
|
+
import_logger.logger.debug(
|
|
483
|
+
`[SessionTitle] Checking title generation preconditions for session ${sessionId}`
|
|
484
|
+
);
|
|
485
|
+
const result = await (0, import_title_generator.generateSessionTitle)(
|
|
486
|
+
llmConfig,
|
|
487
|
+
llmConfig.router,
|
|
488
|
+
this.toolManager,
|
|
489
|
+
this.systemPromptManager,
|
|
490
|
+
this.resourceManager,
|
|
491
|
+
userText
|
|
492
|
+
);
|
|
493
|
+
if (result.error) {
|
|
494
|
+
import_logger.logger.debug(
|
|
495
|
+
`[SessionTitle] LLM title generation failed for ${sessionId}: ${result.error}${result.timedOut ? " (timeout)" : ""}`
|
|
496
|
+
);
|
|
497
|
+
}
|
|
498
|
+
let title = result.title;
|
|
499
|
+
if (!title) {
|
|
500
|
+
title = (0, import_title_generator.deriveHeuristicTitle)(userText);
|
|
501
|
+
if (title) {
|
|
502
|
+
import_logger.logger.info(`[SessionTitle] Using heuristic title for ${sessionId}: ${title}`);
|
|
503
|
+
} else {
|
|
504
|
+
import_logger.logger.debug(
|
|
505
|
+
`[SessionTitle] No suitable title derived for session ${sessionId}`
|
|
506
|
+
);
|
|
507
|
+
return;
|
|
508
|
+
}
|
|
509
|
+
} else {
|
|
510
|
+
import_logger.logger.info(`[SessionTitle] Generated LLM title for ${sessionId}: ${title}`);
|
|
511
|
+
}
|
|
512
|
+
await this.sessionManager.setSessionTitle(sessionId, title, { ifUnsetOnly: true });
|
|
513
|
+
this.agentEventBus.emit("dexto:sessionTitleUpdated", { sessionId, title });
|
|
514
|
+
} catch (err) {
|
|
515
|
+
import_logger.logger.silly(`Title generation skipped/failed for ${sessionId}: ${String(err)}`);
|
|
516
|
+
}
|
|
517
|
+
}
|
|
333
518
|
/**
|
|
334
519
|
* Gets the conversation history for a specific session.
|
|
335
520
|
* @param sessionId The session ID
|
|
@@ -342,7 +527,23 @@ class DextoAgent {
|
|
|
342
527
|
if (!session) {
|
|
343
528
|
throw import_session.SessionError.notFound(sessionId);
|
|
344
529
|
}
|
|
345
|
-
|
|
530
|
+
const history = await session.getHistory();
|
|
531
|
+
if (!this.resourceManager) {
|
|
532
|
+
return history;
|
|
533
|
+
}
|
|
534
|
+
return await Promise.all(
|
|
535
|
+
history.map(async (message) => ({
|
|
536
|
+
...message,
|
|
537
|
+
content: await (0, import_utils.expandBlobReferences)(message.content, this.resourceManager).catch(
|
|
538
|
+
(error) => {
|
|
539
|
+
import_logger.logger.warn(
|
|
540
|
+
`Failed to expand blob references in message: ${error instanceof Error ? error.message : String(error)}`
|
|
541
|
+
);
|
|
542
|
+
return message.content;
|
|
543
|
+
}
|
|
544
|
+
)
|
|
545
|
+
}))
|
|
546
|
+
);
|
|
346
547
|
}
|
|
347
548
|
/**
|
|
348
549
|
* Search for messages across all sessions or within a specific session
|
|
@@ -658,6 +859,7 @@ class DextoAgent {
|
|
|
658
859
|
this.stateManager.addMcpServer(name, validatedConfig);
|
|
659
860
|
try {
|
|
660
861
|
await this.mcpManager.connectServer(name, validatedConfig);
|
|
862
|
+
await this.toolManager.refresh();
|
|
661
863
|
this.agentEventBus.emit("dexto:mcpServerConnected", {
|
|
662
864
|
name,
|
|
663
865
|
success: true
|
|
@@ -693,6 +895,7 @@ class DextoAgent {
|
|
|
693
895
|
this.ensureStarted();
|
|
694
896
|
await this.mcpManager.removeClient(name);
|
|
695
897
|
this.stateManager.removeMcpServer(name);
|
|
898
|
+
await this.toolManager.refresh();
|
|
696
899
|
}
|
|
697
900
|
/**
|
|
698
901
|
* Executes a tool from any source (MCP servers, custom tools, or internal tools).
|
|
@@ -741,6 +944,43 @@ class DextoAgent {
|
|
|
741
944
|
this.ensureStarted();
|
|
742
945
|
return this.mcpManager.getFailedConnections();
|
|
743
946
|
}
|
|
947
|
+
// ============= RESOURCE MANAGEMENT =============
|
|
948
|
+
/**
|
|
949
|
+
* Lists all available resources with their info.
|
|
950
|
+
* This includes resources from MCP servers and any custom resource providers.
|
|
951
|
+
*/
|
|
952
|
+
async listResources() {
|
|
953
|
+
this.ensureStarted();
|
|
954
|
+
return await this.resourceManager.list();
|
|
955
|
+
}
|
|
956
|
+
/**
|
|
957
|
+
* Checks if a resource exists by URI.
|
|
958
|
+
*/
|
|
959
|
+
async hasResource(uri) {
|
|
960
|
+
this.ensureStarted();
|
|
961
|
+
return await this.resourceManager.has(uri);
|
|
962
|
+
}
|
|
963
|
+
/**
|
|
964
|
+
* Reads the content of a specific resource by URI.
|
|
965
|
+
*/
|
|
966
|
+
async readResource(uri) {
|
|
967
|
+
this.ensureStarted();
|
|
968
|
+
return await this.resourceManager.read(uri);
|
|
969
|
+
}
|
|
970
|
+
/**
|
|
971
|
+
* Lists resources for a specific MCP server.
|
|
972
|
+
*/
|
|
973
|
+
async listResourcesForServer(serverId) {
|
|
974
|
+
this.ensureStarted();
|
|
975
|
+
const allResources = await this.resourceManager.list();
|
|
976
|
+
const serverResources = Object.values(allResources).filter((resource) => resource.serverName === serverId).map((resource) => {
|
|
977
|
+
const original = resource.metadata?.originalUri ?? resource.uri;
|
|
978
|
+
const name = resource.name ?? resource.uri.split("/").pop() ?? resource.uri;
|
|
979
|
+
const serverName = resource.serverName ?? serverId;
|
|
980
|
+
return { uri: original, name, originalUri: original, serverName };
|
|
981
|
+
});
|
|
982
|
+
return serverResources;
|
|
983
|
+
}
|
|
744
984
|
// ============= PROMPT MANAGEMENT =============
|
|
745
985
|
/**
|
|
746
986
|
* Gets the current system prompt with all dynamic content resolved.
|
|
@@ -771,7 +1011,75 @@ class DextoAgent {
|
|
|
771
1011
|
const context = {
|
|
772
1012
|
mcpManager: this.mcpManager
|
|
773
1013
|
};
|
|
774
|
-
return await this.
|
|
1014
|
+
return await this.systemPromptManager.build(context);
|
|
1015
|
+
}
|
|
1016
|
+
/**
|
|
1017
|
+
* Lists all available prompts from all providers (MCP, internal, starter, custom).
|
|
1018
|
+
* @returns Promise resolving to a PromptSet with all available prompts
|
|
1019
|
+
*/
|
|
1020
|
+
async listPrompts() {
|
|
1021
|
+
this.ensureStarted();
|
|
1022
|
+
return await this.promptManager.list();
|
|
1023
|
+
}
|
|
1024
|
+
/**
|
|
1025
|
+
* Gets the definition of a specific prompt by name.
|
|
1026
|
+
* @param name The name of the prompt
|
|
1027
|
+
* @returns Promise resolving to the prompt definition or null if not found
|
|
1028
|
+
*/
|
|
1029
|
+
async getPromptDefinition(name) {
|
|
1030
|
+
this.ensureStarted();
|
|
1031
|
+
return await this.promptManager.getPromptDefinition(name);
|
|
1032
|
+
}
|
|
1033
|
+
/**
|
|
1034
|
+
* Checks if a prompt exists.
|
|
1035
|
+
* @param name The name of the prompt to check
|
|
1036
|
+
* @returns Promise resolving to true if the prompt exists, false otherwise
|
|
1037
|
+
*/
|
|
1038
|
+
async hasPrompt(name) {
|
|
1039
|
+
this.ensureStarted();
|
|
1040
|
+
return await this.promptManager.has(name);
|
|
1041
|
+
}
|
|
1042
|
+
/**
|
|
1043
|
+
* Gets a prompt with its messages.
|
|
1044
|
+
* @param name The name of the prompt
|
|
1045
|
+
* @param args Optional arguments to pass to the prompt
|
|
1046
|
+
* @returns Promise resolving to the prompt result with messages
|
|
1047
|
+
*/
|
|
1048
|
+
async getPrompt(name, args) {
|
|
1049
|
+
this.ensureStarted();
|
|
1050
|
+
return await this.promptManager.getPrompt(name, args);
|
|
1051
|
+
}
|
|
1052
|
+
/**
|
|
1053
|
+
* Creates a new custom prompt.
|
|
1054
|
+
* @param input The prompt creation input
|
|
1055
|
+
* @returns Promise resolving to the created prompt info
|
|
1056
|
+
*/
|
|
1057
|
+
async createCustomPrompt(input) {
|
|
1058
|
+
this.ensureStarted();
|
|
1059
|
+
return await this.promptManager.createCustomPrompt(input);
|
|
1060
|
+
}
|
|
1061
|
+
/**
|
|
1062
|
+
* Deletes a custom prompt by name.
|
|
1063
|
+
* @param name The name of the custom prompt to delete
|
|
1064
|
+
*/
|
|
1065
|
+
async deleteCustomPrompt(name) {
|
|
1066
|
+
this.ensureStarted();
|
|
1067
|
+
return await this.promptManager.deleteCustomPrompt(name);
|
|
1068
|
+
}
|
|
1069
|
+
/**
|
|
1070
|
+
* Resolves a prompt to its text content with all arguments applied.
|
|
1071
|
+
* This is a high-level method that handles:
|
|
1072
|
+
* - Prompt key resolution (resolving aliases)
|
|
1073
|
+
* - Argument normalization (including special _context field)
|
|
1074
|
+
* - Prompt execution and flattening
|
|
1075
|
+
*
|
|
1076
|
+
* @param name The prompt name or alias
|
|
1077
|
+
* @param options Optional configuration for prompt resolution
|
|
1078
|
+
* @returns Promise resolving to the resolved text and resource URIs
|
|
1079
|
+
*/
|
|
1080
|
+
async resolvePrompt(name, options = {}) {
|
|
1081
|
+
this.ensureStarted();
|
|
1082
|
+
return await this.promptManager.resolvePrompt(name, options);
|
|
775
1083
|
}
|
|
776
1084
|
// ============= CONFIGURATION ACCESS =============
|
|
777
1085
|
/**
|
|
@@ -783,138 +1091,135 @@ class DextoAgent {
|
|
|
783
1091
|
this.ensureStarted();
|
|
784
1092
|
return sessionId ? this.stateManager.getRuntimeConfig(sessionId) : this.stateManager.getRuntimeConfig();
|
|
785
1093
|
}
|
|
786
|
-
// ============= AGENT MANAGEMENT =============
|
|
787
1094
|
/**
|
|
788
|
-
*
|
|
789
|
-
*
|
|
790
|
-
*
|
|
791
|
-
*
|
|
792
|
-
* @returns Promise resolving to object with installed and available agent lists
|
|
793
|
-
*
|
|
794
|
-
* @example
|
|
795
|
-
* ```typescript
|
|
796
|
-
* const agents = await agent.listAgents();
|
|
797
|
-
* console.log(agents.installed); // ['default', 'my-custom-agent']
|
|
798
|
-
* console.log(agents.available); // [{ name: 'productivity', description: '...', ... }]
|
|
799
|
-
* console.log(agents.current?.name); // 'default'
|
|
800
|
-
* ```
|
|
1095
|
+
* Gets the file path of the agent configuration currently in use.
|
|
1096
|
+
* This returns the source agent file path, not session-specific overrides.
|
|
1097
|
+
* @returns The path to the agent configuration file
|
|
1098
|
+
* @throws AgentError if no config path is available
|
|
801
1099
|
*/
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
installedNames.map(async (name) => {
|
|
808
|
-
const registryEntry = availableMap[name];
|
|
809
|
-
if (registryEntry) {
|
|
810
|
-
return {
|
|
811
|
-
name,
|
|
812
|
-
description: registryEntry.description,
|
|
813
|
-
author: registryEntry.author,
|
|
814
|
-
tags: registryEntry.tags
|
|
815
|
-
};
|
|
816
|
-
} else {
|
|
817
|
-
try {
|
|
818
|
-
const config = await (0, import_loader.loadAgentConfig)(name);
|
|
819
|
-
const author = config.agentCard?.provider?.organization;
|
|
820
|
-
const result = {
|
|
821
|
-
name,
|
|
822
|
-
description: config.agentCard?.description || "Local agent",
|
|
823
|
-
tags: []
|
|
824
|
-
};
|
|
825
|
-
if (author) {
|
|
826
|
-
result.author = author;
|
|
827
|
-
}
|
|
828
|
-
return result;
|
|
829
|
-
} catch {
|
|
830
|
-
return {
|
|
831
|
-
name,
|
|
832
|
-
description: "Local agent (config unavailable)",
|
|
833
|
-
tags: []
|
|
834
|
-
};
|
|
835
|
-
}
|
|
836
|
-
}
|
|
837
|
-
})
|
|
838
|
-
);
|
|
839
|
-
const available = Object.entries(availableMap).filter(([name]) => !installedNames.includes(name)).map(([name, entry]) => ({
|
|
840
|
-
name,
|
|
841
|
-
description: entry.description,
|
|
842
|
-
author: entry.author,
|
|
843
|
-
tags: entry.tags
|
|
844
|
-
}));
|
|
845
|
-
return {
|
|
846
|
-
installed,
|
|
847
|
-
available,
|
|
848
|
-
current: { name: null }
|
|
849
|
-
// TODO: Track current agent name
|
|
850
|
-
};
|
|
1100
|
+
getAgentFilePath() {
|
|
1101
|
+
if (!this.configPath) {
|
|
1102
|
+
throw import_errors.AgentError.noConfigPath();
|
|
1103
|
+
}
|
|
1104
|
+
return this.configPath;
|
|
851
1105
|
}
|
|
852
1106
|
/**
|
|
853
|
-
*
|
|
854
|
-
*
|
|
1107
|
+
* Reloads the agent configuration from disk.
|
|
1108
|
+
* This will re-read the config file, validate it, and detect what changed.
|
|
1109
|
+
* Most configuration changes require a full agent restart to take effect.
|
|
855
1110
|
*
|
|
856
|
-
*
|
|
857
|
-
* @returns Promise that resolves when installation is complete
|
|
1111
|
+
* To apply changes: stop the agent and start it again with the new config.
|
|
858
1112
|
*
|
|
859
|
-
* @
|
|
1113
|
+
* @returns Object containing list of changes that require restart
|
|
1114
|
+
* @throws Error if config file cannot be read or is invalid
|
|
860
1115
|
*
|
|
861
|
-
*
|
|
862
|
-
* ```typescript
|
|
863
|
-
* await agent.installAgent('productivity');
|
|
864
|
-
* console.log('Productivity agent installed successfully');
|
|
865
|
-
* ```
|
|
1116
|
+
* TODO: improve hot reload capabilites so that we don't always require a restart
|
|
866
1117
|
*/
|
|
867
|
-
async
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
throw import_errors.AgentError.apiValidationError(`Agent '${agentName}' not found in registry`);
|
|
1118
|
+
async reloadConfig() {
|
|
1119
|
+
if (!this.configPath) {
|
|
1120
|
+
throw import_errors.AgentError.noConfigPath();
|
|
871
1121
|
}
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
1122
|
+
import_logger.logger.info(`Reloading agent configuration from: ${this.configPath}`);
|
|
1123
|
+
const oldConfig = this.config;
|
|
1124
|
+
const newConfig = await (0, import_loader.loadAgentConfig)(this.configPath);
|
|
1125
|
+
const validated = import_schemas2.AgentConfigSchema.parse(newConfig);
|
|
1126
|
+
const restartRequired = this.detectRestartRequiredChanges(oldConfig, validated);
|
|
1127
|
+
this.config = validated;
|
|
1128
|
+
if (restartRequired.length > 0) {
|
|
1129
|
+
import_logger.logger.warn(
|
|
1130
|
+
`Configuration updated. Restart required to apply: ${restartRequired.join(", ")}`
|
|
880
1131
|
);
|
|
1132
|
+
} else {
|
|
1133
|
+
import_logger.logger.info("Agent configuration reloaded successfully (no changes detected)");
|
|
881
1134
|
}
|
|
1135
|
+
return {
|
|
1136
|
+
restartRequired
|
|
1137
|
+
};
|
|
882
1138
|
}
|
|
883
1139
|
/**
|
|
884
|
-
*
|
|
885
|
-
* This
|
|
886
|
-
*
|
|
887
|
-
*
|
|
888
|
-
*
|
|
889
|
-
*
|
|
890
|
-
*
|
|
891
|
-
* @
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
1140
|
+
* Updates and saves the agent configuration to disk.
|
|
1141
|
+
* This merges the updates with the raw config from disk, validates, and writes to file.
|
|
1142
|
+
* IMPORTANT: This preserves environment variable placeholders (e.g., $OPENAI_API_KEY)
|
|
1143
|
+
* to avoid leaking secrets into the config file.
|
|
1144
|
+
* @param updates Partial configuration updates to apply
|
|
1145
|
+
* @param targetPath Optional path to save to (defaults to current config path)
|
|
1146
|
+
* @returns Object containing list of changes that require restart
|
|
1147
|
+
* @throws Error if validation fails or file cannot be written
|
|
1148
|
+
*/
|
|
1149
|
+
async updateAndSaveConfig(updates, targetPath) {
|
|
1150
|
+
const path = targetPath || this.configPath;
|
|
1151
|
+
if (!path) {
|
|
1152
|
+
throw import_errors.AgentError.noConfigPath();
|
|
1153
|
+
}
|
|
1154
|
+
import_logger.logger.info(`Updating and saving agent configuration to: ${path}`);
|
|
1155
|
+
const rawYaml = await import_fs.promises.readFile(path, "utf-8");
|
|
1156
|
+
const doc = (0, import_yaml.parseDocument)(rawYaml);
|
|
1157
|
+
const rawConfig = doc.toJSON();
|
|
1158
|
+
const updatedRawConfig = { ...rawConfig, ...updates };
|
|
1159
|
+
const parsed = import_schemas2.AgentConfigSchema.safeParse(updatedRawConfig);
|
|
1160
|
+
if (!parsed.success) {
|
|
1161
|
+
const result = (0, import_result.fail)((0, import_result.zodToIssues)(parsed.error, "error"));
|
|
1162
|
+
throw new import_DextoValidationError.DextoValidationError(result.issues);
|
|
1163
|
+
}
|
|
1164
|
+
for (const [key, value] of Object.entries(updates)) {
|
|
1165
|
+
doc.set(key, value);
|
|
1166
|
+
}
|
|
1167
|
+
const yamlContent = String(doc);
|
|
1168
|
+
const tmpPath = `${path}.tmp`;
|
|
1169
|
+
await import_fs.promises.writeFile(tmpPath, yamlContent, "utf-8");
|
|
1170
|
+
await import_fs.promises.rename(tmpPath, path);
|
|
1171
|
+
const reloadResult = await this.reloadConfig();
|
|
1172
|
+
import_logger.logger.info(`Agent configuration saved to: ${path}`);
|
|
1173
|
+
return reloadResult;
|
|
1174
|
+
}
|
|
1175
|
+
/**
|
|
1176
|
+
* Detects configuration changes that require a full agent restart.
|
|
1177
|
+
* Returns an array of change descriptions.
|
|
895
1178
|
*
|
|
896
|
-
* @
|
|
897
|
-
*
|
|
898
|
-
*
|
|
899
|
-
*
|
|
900
|
-
* ```
|
|
1179
|
+
* @param oldConfig Previous validated configuration
|
|
1180
|
+
* @param newConfig New validated configuration
|
|
1181
|
+
* @returns Array of restart-required change descriptions
|
|
1182
|
+
* @private
|
|
901
1183
|
*/
|
|
902
|
-
|
|
903
|
-
const
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
);
|
|
915
|
-
throw import_errors.AgentError.apiValidationError(`Failed to create agent '${agentName}'`, error);
|
|
1184
|
+
detectRestartRequiredChanges(oldConfig, newConfig) {
|
|
1185
|
+
const changes = [];
|
|
1186
|
+
if (JSON.stringify(oldConfig.storage) !== JSON.stringify(newConfig.storage)) {
|
|
1187
|
+
changes.push("Storage backend");
|
|
1188
|
+
}
|
|
1189
|
+
if (JSON.stringify(oldConfig.sessions) !== JSON.stringify(newConfig.sessions)) {
|
|
1190
|
+
changes.push("Session configuration");
|
|
1191
|
+
}
|
|
1192
|
+
if (JSON.stringify(oldConfig.systemPrompt) !== JSON.stringify(newConfig.systemPrompt)) {
|
|
1193
|
+
changes.push("System prompt");
|
|
1194
|
+
}
|
|
1195
|
+
if (JSON.stringify(oldConfig.toolConfirmation) !== JSON.stringify(newConfig.toolConfirmation)) {
|
|
1196
|
+
changes.push("Tool confirmation");
|
|
916
1197
|
}
|
|
1198
|
+
if (JSON.stringify(oldConfig.internalTools) !== JSON.stringify(newConfig.internalTools)) {
|
|
1199
|
+
changes.push("Internal tools");
|
|
1200
|
+
}
|
|
1201
|
+
if (JSON.stringify(oldConfig.mcpServers) !== JSON.stringify(newConfig.mcpServers)) {
|
|
1202
|
+
changes.push("MCP servers");
|
|
1203
|
+
}
|
|
1204
|
+
if (oldConfig.llm.provider !== newConfig.llm.provider || oldConfig.llm.model !== newConfig.llm.model || oldConfig.llm.apiKey !== newConfig.llm.apiKey) {
|
|
1205
|
+
changes.push("LLM configuration");
|
|
1206
|
+
}
|
|
1207
|
+
return changes;
|
|
917
1208
|
}
|
|
1209
|
+
// ============= AGENT MANAGEMENT =============
|
|
1210
|
+
// Note: Agent management methods have been moved to the Dexto orchestrator class.
|
|
1211
|
+
// See: /packages/core/src/Dexto.ts
|
|
1212
|
+
//
|
|
1213
|
+
// For agent lifecycle operations (list, install, uninstall, create), use:
|
|
1214
|
+
// ```typescript
|
|
1215
|
+
// await Dexto.listAgents(); // Static
|
|
1216
|
+
// await Dexto.installAgent(name); // Static
|
|
1217
|
+
// await Dexto.installCustomAgent(name, path, metadata); // Static
|
|
1218
|
+
// await Dexto.uninstallAgent(name); // Static
|
|
1219
|
+
//
|
|
1220
|
+
// const dexto = new Dexto();
|
|
1221
|
+
// await dexto.createAgent(name); // Instance method
|
|
1222
|
+
// ```
|
|
918
1223
|
// Future methods could encapsulate more complex agent behaviors:
|
|
919
1224
|
// - Multi-step task execution with progress tracking
|
|
920
1225
|
// - Memory and context management across sessions
|