@dexto/core 1.2.4 → 1.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +60 -0
- package/dist/agent/DextoAgent.cjs +579 -345
- package/dist/agent/DextoAgent.d.ts +131 -83
- package/dist/agent/DextoAgent.d.ts.map +1 -1
- package/dist/agent/DextoAgent.js +573 -336
- package/dist/agent/agentCard.cjs +4 -2
- package/dist/agent/agentCard.d.ts +0 -1
- package/dist/agent/agentCard.d.ts.map +1 -1
- package/dist/agent/agentCard.js +4 -2
- package/dist/agent/index.cjs +3 -7
- package/dist/agent/index.d.ts +3 -3
- package/dist/agent/index.d.ts.map +1 -1
- package/dist/agent/index.js +7 -6
- package/dist/agent/schemas.cjs +164 -64
- package/dist/agent/schemas.d.ts +2605 -517
- package/dist/agent/schemas.d.ts.map +1 -1
- package/dist/agent/schemas.js +167 -64
- package/dist/agent/state-manager.cjs +28 -23
- package/dist/agent/state-manager.d.ts +4 -1
- package/dist/agent/state-manager.d.ts.map +1 -1
- package/dist/agent/state-manager.js +28 -23
- package/dist/{preferences/constants.cjs → agent/types.cjs} +2 -14
- package/dist/agent/types.d.ts +54 -0
- package/dist/agent/types.d.ts.map +1 -0
- package/dist/agent/types.js +0 -0
- package/dist/approval/errors.cjs +89 -8
- package/dist/approval/errors.d.ts +5 -3
- package/dist/approval/errors.d.ts.map +1 -1
- package/dist/approval/errors.js +89 -8
- package/dist/approval/{providers/factory.d.ts → factory.d.ts} +2 -2
- package/dist/approval/factory.d.ts.map +1 -0
- package/dist/approval/{providers/factory.js → factory.js} +1 -1
- package/dist/approval/index.cjs +4 -6
- package/dist/approval/index.d.ts +3 -5
- package/dist/approval/index.d.ts.map +1 -1
- package/dist/approval/index.js +4 -5
- package/dist/approval/manager.cjs +140 -37
- package/dist/approval/manager.d.ts +56 -17
- package/dist/approval/manager.d.ts.map +1 -1
- package/dist/approval/manager.js +141 -38
- package/dist/approval/schemas.cjs +9 -1
- package/dist/approval/schemas.d.ts +120 -35
- package/dist/approval/schemas.d.ts.map +1 -1
- package/dist/approval/schemas.js +9 -2
- package/dist/approval/types.cjs +14 -2
- package/dist/approval/types.d.ts +64 -12
- package/dist/approval/types.d.ts.map +1 -1
- package/dist/approval/types.js +12 -1
- package/dist/context/compression/middle-removal.cjs +11 -11
- package/dist/context/compression/middle-removal.d.ts +3 -1
- package/dist/context/compression/middle-removal.d.ts.map +1 -1
- package/dist/context/compression/middle-removal.js +11 -11
- package/dist/context/compression/oldest-removal.cjs +18 -5
- package/dist/context/compression/oldest-removal.d.ts +3 -1
- package/dist/context/compression/oldest-removal.d.ts.map +1 -1
- package/dist/context/compression/oldest-removal.js +18 -5
- package/dist/context/manager.cjs +94 -67
- package/dist/context/manager.d.ts +13 -10
- package/dist/context/manager.d.ts.map +1 -1
- package/dist/context/manager.js +94 -67
- package/dist/context/utils.cjs +79 -65
- package/dist/context/utils.d.ts +15 -12
- package/dist/context/utils.d.ts.map +1 -1
- package/dist/context/utils.js +45 -31
- package/dist/errors/DextoRuntimeError.d.ts +5 -5
- package/dist/errors/DextoRuntimeError.d.ts.map +1 -1
- package/dist/errors/result-bridge.cjs +2 -3
- package/dist/errors/result-bridge.d.ts +5 -3
- package/dist/errors/result-bridge.d.ts.map +1 -1
- package/dist/errors/result-bridge.js +1 -2
- package/dist/errors/types.cjs +1 -2
- package/dist/errors/types.d.ts +5 -8
- package/dist/errors/types.d.ts.map +1 -1
- package/dist/errors/types.js +1 -2
- package/dist/events/index.cjs +125 -55
- package/dist/events/index.d.ts +204 -97
- package/dist/events/index.d.ts.map +1 -1
- package/dist/events/index.js +123 -55
- package/dist/filesystem/filesystem-service.cjs +40 -30
- package/dist/filesystem/filesystem-service.d.ts +9 -1
- package/dist/filesystem/filesystem-service.d.ts.map +1 -1
- package/dist/filesystem/filesystem-service.js +40 -30
- package/dist/filesystem/path-validator.cjs +4 -3
- package/dist/filesystem/path-validator.d.ts +3 -1
- package/dist/filesystem/path-validator.d.ts.map +1 -1
- package/dist/filesystem/path-validator.js +4 -3
- package/dist/filesystem/types.d.ts +3 -3
- package/dist/filesystem/types.d.ts.map +1 -1
- package/dist/index.browser.cjs +7 -0
- package/dist/index.browser.d.ts +2 -0
- package/dist/index.browser.d.ts.map +1 -1
- package/dist/index.browser.js +4 -0
- package/dist/index.cjs +0 -7
- package/dist/index.d.ts +12 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -4
- package/dist/llm/formatters/anthropic.cjs +32 -21
- package/dist/llm/formatters/anthropic.d.ts +3 -0
- package/dist/llm/formatters/anthropic.d.ts.map +1 -1
- package/dist/llm/formatters/anthropic.js +32 -21
- package/dist/llm/formatters/factory.cjs +6 -7
- package/dist/llm/formatters/factory.d.ts +2 -1
- package/dist/llm/formatters/factory.d.ts.map +1 -1
- package/dist/llm/formatters/factory.js +4 -5
- package/dist/llm/formatters/openai.cjs +38 -9
- package/dist/llm/formatters/openai.d.ts +3 -0
- package/dist/llm/formatters/openai.d.ts.map +1 -1
- package/dist/llm/formatters/openai.js +38 -9
- package/dist/llm/formatters/vercel.cjs +49 -8
- package/dist/llm/formatters/vercel.d.ts +3 -0
- package/dist/llm/formatters/vercel.d.ts.map +1 -1
- package/dist/llm/formatters/vercel.js +49 -8
- package/dist/llm/registry.cjs +153 -17
- package/dist/llm/registry.d.ts +5 -2
- package/dist/llm/registry.d.ts.map +1 -1
- package/dist/llm/registry.js +143 -7
- package/dist/llm/resolver.cjs +4 -4
- package/dist/llm/resolver.d.ts +3 -2
- package/dist/llm/resolver.d.ts.map +1 -1
- package/dist/llm/resolver.js +4 -4
- package/dist/llm/schemas.cjs +6 -3
- package/dist/llm/schemas.d.ts +51 -17
- package/dist/llm/schemas.d.ts.map +1 -1
- package/dist/llm/schemas.js +5 -3
- package/dist/llm/services/anthropic.cjs +216 -183
- package/dist/llm/services/anthropic.d.ts +3 -1
- package/dist/llm/services/anthropic.d.ts.map +1 -1
- package/dist/llm/services/anthropic.js +217 -184
- package/dist/llm/services/factory.cjs +15 -9
- package/dist/llm/services/factory.d.ts +2 -1
- package/dist/llm/services/factory.d.ts.map +1 -1
- package/dist/llm/services/factory.js +15 -9
- package/dist/llm/services/openai.cjs +262 -225
- package/dist/llm/services/openai.d.ts +3 -1
- package/dist/llm/services/openai.d.ts.map +1 -1
- package/dist/llm/services/openai.js +263 -226
- package/dist/llm/services/test-utils.integration.cjs +58 -12
- package/dist/llm/services/test-utils.integration.d.ts.map +1 -1
- package/dist/llm/services/test-utils.integration.js +58 -12
- package/dist/llm/services/types.d.ts +9 -0
- package/dist/llm/services/types.d.ts.map +1 -1
- package/dist/llm/services/vercel.cjs +163 -111
- package/dist/llm/services/vercel.d.ts +3 -1
- package/dist/llm/services/vercel.d.ts.map +1 -1
- package/dist/llm/services/vercel.js +157 -105
- package/dist/llm/tokenizer/factory.cjs +2 -2
- package/dist/llm/tokenizer/factory.d.ts +3 -1
- package/dist/llm/tokenizer/factory.d.ts.map +1 -1
- package/dist/llm/tokenizer/factory.js +2 -2
- package/dist/llm/tokenizer/openai.cjs +16 -9
- package/dist/llm/tokenizer/openai.d.ts +4 -1
- package/dist/llm/tokenizer/openai.d.ts.map +1 -1
- package/dist/llm/tokenizer/openai.js +16 -9
- package/dist/llm/validation.cjs +8 -9
- package/dist/llm/validation.d.ts +3 -1
- package/dist/llm/validation.d.ts.map +1 -1
- package/dist/llm/validation.js +5 -6
- package/dist/logger/factory.cjs +54 -0
- package/dist/logger/factory.d.ts +36 -0
- package/dist/logger/factory.d.ts.map +1 -0
- package/dist/logger/factory.js +31 -0
- package/dist/logger/index.cjs +42 -3
- package/dist/logger/index.d.ts +17 -1
- package/dist/logger/index.d.ts.map +1 -1
- package/dist/logger/index.js +26 -1
- package/dist/logger/logger.cjs +30 -17
- package/dist/logger/logger.d.ts.map +1 -1
- package/dist/logger/logger.js +30 -17
- package/dist/logger/v2/dexto-logger.cjs +141 -0
- package/dist/logger/v2/dexto-logger.d.ts +54 -0
- package/dist/logger/v2/dexto-logger.d.ts.map +1 -0
- package/dist/logger/v2/dexto-logger.js +118 -0
- package/dist/{preferences → logger/v2}/error-codes.cjs +11 -10
- package/dist/logger/v2/error-codes.d.ts +13 -0
- package/dist/logger/v2/error-codes.d.ts.map +1 -0
- package/dist/logger/v2/error-codes.js +13 -0
- package/dist/logger/v2/errors.cjs +107 -0
- package/dist/logger/v2/errors.d.ts +32 -0
- package/dist/logger/v2/errors.d.ts.map +1 -0
- package/dist/logger/v2/errors.js +84 -0
- package/dist/logger/v2/schemas.cjs +57 -0
- package/dist/logger/v2/schemas.d.ts +147 -0
- package/dist/logger/v2/schemas.d.ts.map +1 -0
- package/dist/logger/v2/schemas.js +33 -0
- package/dist/logger/v2/transport-factory.cjs +53 -0
- package/dist/logger/v2/transport-factory.d.ts +21 -0
- package/dist/logger/v2/transport-factory.d.ts.map +1 -0
- package/dist/logger/v2/transport-factory.js +29 -0
- package/dist/logger/v2/transports/console-transport.cjs +79 -0
- package/dist/logger/v2/transports/console-transport.d.ts +23 -0
- package/dist/logger/v2/transports/console-transport.d.ts.map +1 -0
- package/dist/logger/v2/transports/console-transport.js +46 -0
- package/dist/logger/v2/transports/file-transport.cjs +161 -0
- package/dist/logger/v2/transports/file-transport.d.ts +46 -0
- package/dist/logger/v2/transports/file-transport.d.ts.map +1 -0
- package/dist/logger/v2/transports/file-transport.js +128 -0
- package/dist/logger/v2/types.cjs +49 -0
- package/dist/logger/v2/types.d.ts +123 -0
- package/dist/logger/v2/types.d.ts.map +1 -0
- package/dist/logger/v2/types.js +26 -0
- package/dist/mcp/manager.cjs +88 -78
- package/dist/mcp/manager.d.ts +3 -1
- package/dist/mcp/manager.d.ts.map +1 -1
- package/dist/mcp/manager.js +88 -78
- package/dist/mcp/mcp-client.cjs +109 -79
- package/dist/mcp/mcp-client.d.ts +3 -0
- package/dist/mcp/mcp-client.d.ts.map +1 -1
- package/dist/mcp/mcp-client.js +102 -72
- package/dist/memory/manager.cjs +9 -7
- package/dist/memory/manager.d.ts +3 -1
- package/dist/memory/manager.d.ts.map +1 -1
- package/dist/memory/manager.js +9 -7
- package/dist/memory/schemas.d.ts +6 -6
- package/dist/plugins/manager.cjs +21 -19
- package/dist/plugins/manager.d.ts +3 -1
- package/dist/plugins/manager.d.ts.map +1 -1
- package/dist/plugins/manager.js +21 -19
- package/dist/plugins/schemas.d.ts +9 -9
- package/dist/plugins/types.d.ts +2 -2
- package/dist/plugins/types.d.ts.map +1 -1
- package/dist/process/command-validator.cjs +30 -20
- package/dist/process/command-validator.d.ts +4 -1
- package/dist/process/command-validator.d.ts.map +1 -1
- package/dist/process/command-validator.js +30 -20
- package/dist/process/process-service.cjs +23 -21
- package/dist/process/process-service.d.ts +3 -1
- package/dist/process/process-service.d.ts.map +1 -1
- package/dist/process/process-service.js +23 -21
- package/dist/prompts/prompt-manager.cjs +25 -18
- package/dist/prompts/prompt-manager.d.ts +3 -1
- package/dist/prompts/prompt-manager.d.ts.map +1 -1
- package/dist/prompts/prompt-manager.js +25 -18
- package/dist/prompts/providers/custom-prompt-provider.cjs +11 -7
- package/dist/prompts/providers/custom-prompt-provider.d.ts +3 -1
- package/dist/prompts/providers/custom-prompt-provider.d.ts.map +1 -1
- package/dist/prompts/providers/custom-prompt-provider.js +11 -7
- package/dist/prompts/providers/file-prompt-provider.cjs +14 -12
- package/dist/prompts/providers/file-prompt-provider.d.ts +3 -1
- package/dist/prompts/providers/file-prompt-provider.d.ts.map +1 -1
- package/dist/prompts/providers/file-prompt-provider.js +14 -12
- package/dist/prompts/providers/mcp-prompt-provider.cjs +7 -6
- package/dist/prompts/providers/mcp-prompt-provider.d.ts +3 -1
- package/dist/prompts/providers/mcp-prompt-provider.d.ts.map +1 -1
- package/dist/prompts/providers/mcp-prompt-provider.js +7 -6
- package/dist/prompts/providers/starter-prompt-provider.cjs +7 -5
- package/dist/prompts/providers/starter-prompt-provider.d.ts +3 -1
- package/dist/prompts/providers/starter-prompt-provider.d.ts.map +1 -1
- package/dist/prompts/providers/starter-prompt-provider.js +7 -5
- package/dist/prompts/schemas.d.ts +3 -3
- package/dist/resources/handlers/blob-handler.cjs +15 -11
- package/dist/resources/handlers/blob-handler.d.ts +3 -1
- package/dist/resources/handlers/blob-handler.d.ts.map +1 -1
- package/dist/resources/handlers/blob-handler.js +15 -11
- package/dist/resources/handlers/factory.cjs +3 -3
- package/dist/resources/handlers/factory.d.ts +2 -1
- package/dist/resources/handlers/factory.d.ts.map +1 -1
- package/dist/resources/handlers/factory.js +3 -3
- package/dist/resources/handlers/filesystem-handler.cjs +10 -8
- package/dist/resources/handlers/filesystem-handler.d.ts +3 -1
- package/dist/resources/handlers/filesystem-handler.d.ts.map +1 -1
- package/dist/resources/handlers/filesystem-handler.js +10 -8
- package/dist/resources/internal-provider.cjs +28 -20
- package/dist/resources/internal-provider.d.ts +3 -1
- package/dist/resources/internal-provider.d.ts.map +1 -1
- package/dist/resources/internal-provider.js +28 -20
- package/dist/resources/manager.cjs +34 -25
- package/dist/resources/manager.d.ts +3 -1
- package/dist/resources/manager.d.ts.map +1 -1
- package/dist/resources/manager.js +34 -25
- package/dist/resources/schemas.d.ts +6 -6
- package/dist/search/search-service.cjs +8 -6
- package/dist/search/search-service.d.ts +3 -1
- package/dist/search/search-service.d.ts.map +1 -1
- package/dist/search/search-service.js +8 -6
- package/dist/session/chat-session.cjs +40 -27
- package/dist/session/chat-session.d.ts +10 -7
- package/dist/session/chat-session.d.ts.map +1 -1
- package/dist/session/chat-session.js +40 -27
- package/dist/session/history/database.cjs +18 -11
- package/dist/session/history/database.d.ts +3 -1
- package/dist/session/history/database.d.ts.map +1 -1
- package/dist/session/history/database.js +18 -11
- package/dist/session/history/factory.cjs +2 -2
- package/dist/session/history/factory.d.ts +5 -1
- package/dist/session/history/factory.d.ts.map +1 -1
- package/dist/session/history/factory.js +2 -2
- package/dist/session/session-manager.cjs +37 -53
- package/dist/session/session-manager.d.ts +3 -17
- package/dist/session/session-manager.d.ts.map +1 -1
- package/dist/session/session-manager.js +37 -53
- package/dist/session/title-generator.cjs +3 -2
- package/dist/session/title-generator.d.ts +2 -1
- package/dist/session/title-generator.d.ts.map +1 -1
- package/dist/session/title-generator.js +3 -2
- package/dist/storage/blob/factory.cjs +9 -18
- package/dist/storage/blob/factory.d.ts +5 -4
- package/dist/storage/blob/factory.d.ts.map +1 -1
- package/dist/storage/blob/factory.js +8 -17
- package/dist/storage/blob/local-blob-store.cjs +25 -32
- package/dist/storage/blob/local-blob-store.d.ts +3 -2
- package/dist/storage/blob/local-blob-store.d.ts.map +1 -1
- package/dist/storage/blob/local-blob-store.js +25 -32
- package/dist/storage/blob/memory-blob-store.cjs +326 -0
- package/dist/storage/blob/memory-blob-store.d.ts +66 -0
- package/dist/storage/blob/memory-blob-store.d.ts.map +1 -0
- package/dist/storage/blob/memory-blob-store.js +303 -0
- package/dist/storage/blob/schemas.cjs +3 -1
- package/dist/storage/blob/schemas.d.ts +6 -6
- package/dist/storage/blob/schemas.d.ts.map +1 -1
- package/dist/storage/blob/schemas.js +3 -1
- package/dist/storage/cache/factory.cjs +7 -8
- package/dist/storage/cache/factory.d.ts +4 -1
- package/dist/storage/cache/factory.d.ts.map +1 -1
- package/dist/storage/cache/factory.js +4 -5
- package/dist/storage/cache/redis-store.cjs +4 -1
- package/dist/storage/cache/redis-store.d.ts +3 -1
- package/dist/storage/cache/redis-store.d.ts.map +1 -1
- package/dist/storage/cache/redis-store.js +4 -1
- package/dist/storage/database/factory.cjs +13 -16
- package/dist/storage/database/factory.d.ts +5 -3
- package/dist/storage/database/factory.d.ts.map +1 -1
- package/dist/storage/database/factory.js +9 -12
- package/dist/storage/database/postgres-store.cjs +4 -1
- package/dist/storage/database/postgres-store.d.ts +3 -1
- package/dist/storage/database/postgres-store.d.ts.map +1 -1
- package/dist/storage/database/postgres-store.js +4 -1
- package/dist/storage/database/schemas.cjs +3 -4
- package/dist/storage/database/schemas.d.ts +8 -16
- package/dist/storage/database/schemas.d.ts.map +1 -1
- package/dist/storage/database/schemas.js +3 -4
- package/dist/storage/database/sqlite-store.cjs +17 -45
- package/dist/storage/database/sqlite-store.d.ts +3 -3
- package/dist/storage/database/sqlite-store.d.ts.map +1 -1
- package/dist/storage/database/sqlite-store.js +17 -45
- package/dist/storage/schemas.cjs +3 -1
- package/dist/storage/schemas.d.ts +16 -23
- package/dist/storage/schemas.d.ts.map +1 -1
- package/dist/storage/schemas.js +3 -1
- package/dist/storage/storage-manager.cjs +15 -15
- package/dist/storage/storage-manager.d.ts +6 -6
- package/dist/storage/storage-manager.d.ts.map +1 -1
- package/dist/storage/storage-manager.js +15 -15
- package/dist/systemPrompt/contributors.cjs +15 -15
- package/dist/systemPrompt/contributors.d.ts +5 -3
- package/dist/systemPrompt/contributors.d.ts.map +1 -1
- package/dist/systemPrompt/contributors.js +15 -15
- package/dist/systemPrompt/manager.cjs +11 -8
- package/dist/systemPrompt/manager.d.ts +4 -2
- package/dist/systemPrompt/manager.d.ts.map +1 -1
- package/dist/systemPrompt/manager.js +11 -8
- package/dist/systemPrompt/schemas.cjs +21 -1
- package/dist/systemPrompt/schemas.d.ts +53 -53
- package/dist/systemPrompt/schemas.d.ts.map +1 -1
- package/dist/systemPrompt/schemas.js +11 -1
- package/dist/telemetry/decorators.cjs +54 -15
- package/dist/telemetry/decorators.d.ts.map +1 -1
- package/dist/telemetry/decorators.js +54 -15
- package/dist/telemetry/utils.cjs +21 -14
- package/dist/telemetry/utils.d.ts +7 -3
- package/dist/telemetry/utils.d.ts.map +1 -1
- package/dist/telemetry/utils.js +21 -14
- package/dist/tools/confirmation/allowed-tools-provider/factory.cjs +2 -2
- package/dist/tools/confirmation/allowed-tools-provider/factory.d.ts +2 -1
- package/dist/tools/confirmation/allowed-tools-provider/factory.d.ts.map +1 -1
- package/dist/tools/confirmation/allowed-tools-provider/factory.js +2 -2
- package/dist/tools/confirmation/allowed-tools-provider/storage.cjs +7 -6
- package/dist/tools/confirmation/allowed-tools-provider/storage.d.ts +3 -1
- package/dist/tools/confirmation/allowed-tools-provider/storage.d.ts.map +1 -1
- package/dist/tools/confirmation/allowed-tools-provider/storage.js +7 -6
- package/dist/tools/errors.cjs +2 -1
- package/dist/tools/errors.d.ts.map +1 -1
- package/dist/tools/errors.js +2 -1
- package/dist/tools/internal-tools/constants.cjs +2 -1
- package/dist/tools/internal-tools/constants.d.ts +1 -1
- package/dist/tools/internal-tools/constants.d.ts.map +1 -1
- package/dist/tools/internal-tools/constants.js +2 -1
- package/dist/tools/internal-tools/implementations/bash-exec-tool.cjs +1 -1
- package/dist/tools/internal-tools/implementations/bash-exec-tool.js +1 -1
- package/dist/tools/internal-tools/implementations/delegate-to-url-tool.cjs +192 -0
- package/dist/tools/internal-tools/implementations/delegate-to-url-tool.d.ts +33 -0
- package/dist/tools/internal-tools/implementations/delegate-to-url-tool.d.ts.map +1 -0
- package/dist/tools/internal-tools/implementations/delegate-to-url-tool.js +169 -0
- package/dist/tools/internal-tools/provider.cjs +21 -17
- package/dist/tools/internal-tools/provider.d.ts +3 -1
- package/dist/tools/internal-tools/provider.d.ts.map +1 -1
- package/dist/tools/internal-tools/provider.js +21 -17
- package/dist/tools/internal-tools/registry.cjs +5 -0
- package/dist/tools/internal-tools/registry.d.ts.map +1 -1
- package/dist/tools/internal-tools/registry.js +5 -0
- package/dist/tools/schemas.cjs +16 -4
- package/dist/tools/schemas.d.ts +21 -9
- package/dist/tools/schemas.d.ts.map +1 -1
- package/dist/tools/schemas.js +15 -4
- package/dist/tools/tool-manager.cjs +64 -47
- package/dist/tools/tool-manager.d.ts +4 -2
- package/dist/tools/tool-manager.d.ts.map +1 -1
- package/dist/tools/tool-manager.js +61 -44
- package/dist/tools/types.d.ts +0 -4
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/utils/env-file.cjs +118 -0
- package/dist/utils/env-file.d.ts +5 -0
- package/dist/utils/env-file.d.ts.map +1 -0
- package/dist/utils/env-file.js +85 -0
- package/dist/utils/error-conversion.cjs +23 -1
- package/dist/utils/error-conversion.d.ts +2 -1
- package/dist/utils/error-conversion.d.ts.map +1 -1
- package/dist/utils/error-conversion.js +23 -1
- package/dist/utils/execution-context.d.ts.map +1 -1
- package/dist/utils/fs-walk.d.ts.map +1 -1
- package/dist/utils/index.cjs +7 -9
- package/dist/utils/index.d.ts +3 -4
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +3 -4
- package/dist/utils/path.cjs +22 -57
- package/dist/utils/path.d.ts +8 -7
- package/dist/utils/path.d.ts.map +1 -1
- package/dist/utils/path.js +21 -54
- package/dist/utils/result.cjs +37 -14
- package/dist/utils/result.d.ts.map +1 -1
- package/dist/utils/result.js +37 -14
- package/dist/utils/schema.cjs +2 -3
- package/dist/utils/schema.d.ts +2 -1
- package/dist/utils/schema.d.ts.map +1 -1
- package/dist/utils/schema.js +1 -2
- package/dist/utils/service-initializer.cjs +87 -61
- package/dist/utils/service-initializer.d.ts +4 -2
- package/dist/utils/service-initializer.d.ts.map +1 -1
- package/dist/utils/service-initializer.js +69 -43
- package/package.json +7 -3
- package/dist/Dexto.cjs +0 -251
- package/dist/Dexto.d.ts +0 -191
- package/dist/Dexto.d.ts.map +0 -1
- package/dist/Dexto.js +0 -228
- package/dist/agent/registry/error-codes.cjs +0 -44
- package/dist/agent/registry/error-codes.d.ts +0 -21
- package/dist/agent/registry/error-codes.d.ts.map +0 -1
- package/dist/agent/registry/error-codes.js +0 -21
- package/dist/agent/registry/errors.cjs +0 -188
- package/dist/agent/registry/errors.d.ts +0 -63
- package/dist/agent/registry/errors.d.ts.map +0 -1
- package/dist/agent/registry/errors.js +0 -165
- package/dist/agent/registry/registry.cjs +0 -479
- package/dist/agent/registry/registry.d.ts +0 -130
- package/dist/agent/registry/registry.d.ts.map +0 -1
- package/dist/agent/registry/registry.js +0 -453
- package/dist/agent/registry/types.cjs +0 -74
- package/dist/agent/registry/types.d.ts +0 -142
- package/dist/agent/registry/types.d.ts.map +0 -1
- package/dist/agent/registry/types.js +0 -48
- package/dist/agent/registry/user-registry.cjs +0 -140
- package/dist/agent/registry/user-registry.d.ts +0 -34
- package/dist/agent/registry/user-registry.d.ts.map +0 -1
- package/dist/agent/registry/user-registry.js +0 -105
- package/dist/approval/providers/event-based-approval-provider.cjs +0 -156
- package/dist/approval/providers/event-based-approval-provider.d.ts +0 -39
- package/dist/approval/providers/event-based-approval-provider.d.ts.map +0 -1
- package/dist/approval/providers/event-based-approval-provider.js +0 -133
- package/dist/approval/providers/factory.d.ts.map +0 -1
- package/dist/approval/providers/noop-approval-provider.cjs +0 -54
- package/dist/approval/providers/noop-approval-provider.d.ts +0 -18
- package/dist/approval/providers/noop-approval-provider.d.ts.map +0 -1
- package/dist/approval/providers/noop-approval-provider.js +0 -31
- package/dist/config/agent-resolver.cjs +0 -153
- package/dist/config/agent-resolver.d.ts +0 -14
- package/dist/config/agent-resolver.d.ts.map +0 -1
- package/dist/config/agent-resolver.js +0 -123
- package/dist/config/error-codes.cjs +0 -39
- package/dist/config/error-codes.d.ts +0 -16
- package/dist/config/error-codes.d.ts.map +0 -1
- package/dist/config/error-codes.js +0 -16
- package/dist/config/errors.cjs +0 -126
- package/dist/config/errors.d.ts +0 -34
- package/dist/config/errors.d.ts.map +0 -1
- package/dist/config/errors.js +0 -103
- package/dist/config/index.cjs +0 -26
- package/dist/config/index.d.ts +0 -4
- package/dist/config/index.d.ts.map +0 -1
- package/dist/config/index.js +0 -3
- package/dist/config/loader.cjs +0 -119
- package/dist/config/loader.d.ts +0 -16
- package/dist/config/loader.d.ts.map +0 -1
- package/dist/config/loader.js +0 -86
- package/dist/config/writer.cjs +0 -182
- package/dist/config/writer.d.ts +0 -35
- package/dist/config/writer.d.ts.map +0 -1
- package/dist/config/writer.js +0 -147
- package/dist/preferences/constants.d.ts +0 -2
- package/dist/preferences/constants.d.ts.map +0 -1
- package/dist/preferences/constants.js +0 -5
- package/dist/preferences/error-codes.d.ts +0 -8
- package/dist/preferences/error-codes.d.ts.map +0 -1
- package/dist/preferences/error-codes.js +0 -12
- package/dist/preferences/errors.cjs +0 -75
- package/dist/preferences/errors.d.ts +0 -18
- package/dist/preferences/errors.d.ts.map +0 -1
- package/dist/preferences/errors.js +0 -51
- package/dist/preferences/index.cjs +0 -55
- package/dist/preferences/index.d.ts +0 -6
- package/dist/preferences/index.d.ts.map +0 -1
- package/dist/preferences/index.js +0 -32
- package/dist/preferences/loader.cjs +0 -138
- package/dist/preferences/loader.d.ts +0 -51
- package/dist/preferences/loader.d.ts.map +0 -1
- package/dist/preferences/loader.js +0 -110
- package/dist/preferences/schemas.cjs +0 -75
- package/dist/preferences/schemas.d.ts +0 -110
- package/dist/preferences/schemas.d.ts.map +0 -1
- package/dist/preferences/schemas.js +0 -49
- package/dist/utils/api-key-store.cjs +0 -56
- package/dist/utils/api-key-store.d.ts +0 -24
- package/dist/utils/api-key-store.d.ts.map +0 -1
- package/dist/utils/api-key-store.js +0 -31
- package/dist/utils/env.cjs +0 -154
- package/dist/utils/env.d.ts +0 -28
- package/dist/utils/env.d.ts.map +0 -1
- package/dist/utils/env.js +0 -119
- package/dist/utils/port-utils.cjs +0 -37
- package/dist/utils/port-utils.d.ts +0 -10
- package/dist/utils/port-utils.d.ts.map +0 -1
- package/dist/utils/port-utils.js +0 -14
- package/dist/utils/port-utils.spec.cjs +0 -26
- package/dist/utils/port-utils.spec.js +0 -25
- /package/dist/approval/{providers/factory.cjs → factory.cjs} +0 -0
|
@@ -1,479 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var registry_exports = {};
|
|
30
|
-
__export(registry_exports, {
|
|
31
|
-
LocalAgentRegistry: () => LocalAgentRegistry,
|
|
32
|
-
getAgentRegistry: () => getAgentRegistry
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(registry_exports);
|
|
35
|
-
var import_fs = require("fs");
|
|
36
|
-
var import_fs2 = require("fs");
|
|
37
|
-
var import_path = __toESM(require("path"), 1);
|
|
38
|
-
var import_logger = require("../../logger/index.cjs");
|
|
39
|
-
var import_path2 = require("../../utils/path.cjs");
|
|
40
|
-
var import_loader = require("../../preferences/loader.cjs");
|
|
41
|
-
var import_writer = require("../../config/writer.cjs");
|
|
42
|
-
var import_types = require("./types.js");
|
|
43
|
-
var import_errors = require("./errors.js");
|
|
44
|
-
var import_user_registry = require("./user-registry.js");
|
|
45
|
-
let cachedRegistry = null;
|
|
46
|
-
class LocalAgentRegistry {
|
|
47
|
-
_registry = null;
|
|
48
|
-
/**
|
|
49
|
-
* Lazy load registry from JSON file
|
|
50
|
-
*/
|
|
51
|
-
getRegistry() {
|
|
52
|
-
if (this._registry === null) {
|
|
53
|
-
this._registry = this.loadRegistry();
|
|
54
|
-
}
|
|
55
|
-
return this._registry;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Load and merge bundled + user registries
|
|
59
|
-
* Uses fail-fast approach - throws RegistryError for any loading issues
|
|
60
|
-
*/
|
|
61
|
-
loadRegistry() {
|
|
62
|
-
let jsonPath;
|
|
63
|
-
try {
|
|
64
|
-
jsonPath = (0, import_path2.resolveBundledScript)("agents/agent-registry.json");
|
|
65
|
-
} catch (error) {
|
|
66
|
-
throw import_errors.RegistryError.registryNotFound(
|
|
67
|
-
"agents/agent-registry.json",
|
|
68
|
-
error instanceof Error ? error.message : String(error)
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
if (!(0, import_fs.existsSync)(jsonPath)) {
|
|
72
|
-
throw import_errors.RegistryError.registryNotFound(jsonPath, "File doesn't exist");
|
|
73
|
-
}
|
|
74
|
-
let bundledRegistry;
|
|
75
|
-
try {
|
|
76
|
-
const jsonData = (0, import_fs.readFileSync)(jsonPath, "utf-8");
|
|
77
|
-
const rawRegistry = JSON.parse(jsonData);
|
|
78
|
-
bundledRegistry = import_types.RegistrySchema.parse((0, import_types.normalizeRegistryJson)(rawRegistry));
|
|
79
|
-
} catch (error) {
|
|
80
|
-
throw import_errors.RegistryError.registryParseError(
|
|
81
|
-
jsonPath,
|
|
82
|
-
error instanceof Error ? error.message : String(error)
|
|
83
|
-
);
|
|
84
|
-
}
|
|
85
|
-
const userRegistry = (0, import_user_registry.loadUserRegistry)();
|
|
86
|
-
const merged = (0, import_user_registry.mergeRegistries)(bundledRegistry, userRegistry);
|
|
87
|
-
import_logger.logger.debug(
|
|
88
|
-
`Loaded registry: ${Object.keys(bundledRegistry.agents).length} bundled, ${Object.keys(userRegistry.agents).length} custom`
|
|
89
|
-
);
|
|
90
|
-
return merged;
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Check if agent exists in registry by ID
|
|
94
|
-
*/
|
|
95
|
-
hasAgent(agentId) {
|
|
96
|
-
const registry = this.getRegistry();
|
|
97
|
-
return agentId in registry.agents;
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Get available agents with their metadata from registry
|
|
101
|
-
*/
|
|
102
|
-
getAvailableAgents() {
|
|
103
|
-
const registry = this.getRegistry();
|
|
104
|
-
return registry.agents;
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Validate custom agent ID doesn't conflict with bundled registry
|
|
108
|
-
* @throws RegistryError if ID conflicts with builtin agent
|
|
109
|
-
*/
|
|
110
|
-
validateCustomAgentId(agentId) {
|
|
111
|
-
let jsonPath;
|
|
112
|
-
try {
|
|
113
|
-
jsonPath = (0, import_path2.resolveBundledScript)("agents/agent-registry.json");
|
|
114
|
-
} catch (error) {
|
|
115
|
-
throw import_errors.RegistryError.registryNotFound(
|
|
116
|
-
"agents/agent-registry.json",
|
|
117
|
-
error instanceof Error ? error.message : String(error)
|
|
118
|
-
);
|
|
119
|
-
}
|
|
120
|
-
try {
|
|
121
|
-
const jsonData = (0, import_fs.readFileSync)(jsonPath, "utf-8");
|
|
122
|
-
const bundledRegistry = import_types.RegistrySchema.parse(
|
|
123
|
-
(0, import_types.normalizeRegistryJson)(JSON.parse(jsonData))
|
|
124
|
-
);
|
|
125
|
-
if (agentId in bundledRegistry.agents) {
|
|
126
|
-
throw import_errors.RegistryError.customAgentNameConflict(agentId);
|
|
127
|
-
}
|
|
128
|
-
} catch (error) {
|
|
129
|
-
if (error instanceof Error && /name conflicts with builtin agent/.test(error.message)) {
|
|
130
|
-
throw error;
|
|
131
|
-
}
|
|
132
|
-
throw import_errors.RegistryError.registryParseError(
|
|
133
|
-
jsonPath,
|
|
134
|
-
error instanceof Error ? error.message : String(error)
|
|
135
|
-
);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
/**
|
|
139
|
-
* Resolve main config file for installed agent
|
|
140
|
-
* Handles both directory agents (with main field) and single-file agents
|
|
141
|
-
*/
|
|
142
|
-
resolveMainConfig(agentDir, agentId) {
|
|
143
|
-
const registry = this.getRegistry();
|
|
144
|
-
const agentData = registry.agents[agentId];
|
|
145
|
-
if (!agentData) {
|
|
146
|
-
const available = Object.keys(registry.agents);
|
|
147
|
-
throw import_errors.RegistryError.agentNotFound(agentId, available);
|
|
148
|
-
}
|
|
149
|
-
if (agentData.source.endsWith("/")) {
|
|
150
|
-
if (!agentData.main) {
|
|
151
|
-
throw import_errors.RegistryError.agentInvalidEntry(
|
|
152
|
-
agentId,
|
|
153
|
-
"directory entry missing main field"
|
|
154
|
-
);
|
|
155
|
-
}
|
|
156
|
-
const mainConfigPath = import_path.default.join(agentDir, agentData.main);
|
|
157
|
-
if (!(0, import_fs.existsSync)(mainConfigPath)) {
|
|
158
|
-
throw import_errors.RegistryError.mainConfigMissing(agentId, mainConfigPath);
|
|
159
|
-
}
|
|
160
|
-
return mainConfigPath;
|
|
161
|
-
} else {
|
|
162
|
-
const filename = import_path.default.basename(agentData.source);
|
|
163
|
-
const configPath = import_path.default.join(agentDir, filename);
|
|
164
|
-
if (!(0, import_fs.existsSync)(configPath)) {
|
|
165
|
-
throw import_errors.RegistryError.configNotFound(configPath);
|
|
166
|
-
}
|
|
167
|
-
return configPath;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
/**
|
|
171
|
-
* Install agent atomically using temp + rename pattern
|
|
172
|
-
* @param agentId ID of the agent to install
|
|
173
|
-
* @param injectPreferences Whether to inject global preferences into installed agent (default: true)
|
|
174
|
-
*/
|
|
175
|
-
async installAgent(agentId, injectPreferences = true) {
|
|
176
|
-
import_logger.logger.info(`Installing agent: ${agentId}`);
|
|
177
|
-
const registry = this.getRegistry();
|
|
178
|
-
const agentData = registry.agents[agentId];
|
|
179
|
-
if (!agentData) {
|
|
180
|
-
const available = Object.keys(registry.agents);
|
|
181
|
-
throw import_errors.RegistryError.agentNotFound(agentId, available);
|
|
182
|
-
}
|
|
183
|
-
const globalAgentsDir = (0, import_path2.getDextoGlobalPath)("agents");
|
|
184
|
-
const targetDir = import_path.default.resolve(globalAgentsDir, agentId);
|
|
185
|
-
const relTarget = import_path.default.relative(globalAgentsDir, targetDir);
|
|
186
|
-
if (relTarget.startsWith("..") || import_path.default.isAbsolute(relTarget)) {
|
|
187
|
-
throw import_errors.RegistryError.installationFailed(
|
|
188
|
-
agentId,
|
|
189
|
-
"invalid agentId: path traversal detected"
|
|
190
|
-
);
|
|
191
|
-
}
|
|
192
|
-
if ((0, import_fs.existsSync)(targetDir)) {
|
|
193
|
-
import_logger.logger.info(`Agent '${agentId}' already installed`);
|
|
194
|
-
return this.resolveMainConfig(targetDir, agentId);
|
|
195
|
-
}
|
|
196
|
-
await import_fs2.promises.mkdir(globalAgentsDir, { recursive: true });
|
|
197
|
-
const sourcePath = (0, import_path2.resolveBundledScript)(`agents/${agentData.source}`);
|
|
198
|
-
const tempDir = `${targetDir}.tmp.${Date.now()}`;
|
|
199
|
-
try {
|
|
200
|
-
if (agentData.source.endsWith("/")) {
|
|
201
|
-
await (0, import_path2.copyDirectory)(sourcePath, tempDir);
|
|
202
|
-
} else {
|
|
203
|
-
await import_fs2.promises.mkdir(tempDir, { recursive: true });
|
|
204
|
-
const targetFile = import_path.default.join(tempDir, import_path.default.basename(sourcePath));
|
|
205
|
-
await import_fs2.promises.copyFile(sourcePath, targetFile);
|
|
206
|
-
}
|
|
207
|
-
const mainConfigPath = this.resolveMainConfig(tempDir, agentId);
|
|
208
|
-
if (!(0, import_fs.existsSync)(mainConfigPath)) {
|
|
209
|
-
throw import_errors.RegistryError.installationValidationFailed(agentId, mainConfigPath);
|
|
210
|
-
}
|
|
211
|
-
await import_fs2.promises.rename(tempDir, targetDir);
|
|
212
|
-
import_logger.logger.info(`\u2713 Installed agent '${agentId}' to ${targetDir}`);
|
|
213
|
-
if (injectPreferences) {
|
|
214
|
-
try {
|
|
215
|
-
const preferences = await (0, import_loader.loadGlobalPreferences)();
|
|
216
|
-
await (0, import_writer.writePreferencesToAgent)(targetDir, preferences);
|
|
217
|
-
import_logger.logger.info(`\u2713 Applied global preferences to installed agent '${agentId}'`);
|
|
218
|
-
} catch (error) {
|
|
219
|
-
import_logger.logger.warn(
|
|
220
|
-
`Failed to inject preferences to '${agentId}': ${error instanceof Error ? error.message : String(error)}`
|
|
221
|
-
);
|
|
222
|
-
console.log(
|
|
223
|
-
`\u26A0\uFE0F Warning: Could not apply preferences to '${agentId}' - agent will use bundled settings`
|
|
224
|
-
);
|
|
225
|
-
}
|
|
226
|
-
} else {
|
|
227
|
-
import_logger.logger.info(
|
|
228
|
-
`Skipped preference injection for '${agentId}' (injectPreferences=false)`
|
|
229
|
-
);
|
|
230
|
-
}
|
|
231
|
-
return this.resolveMainConfig(targetDir, agentId);
|
|
232
|
-
} catch (error) {
|
|
233
|
-
try {
|
|
234
|
-
if ((0, import_fs.existsSync)(tempDir)) {
|
|
235
|
-
await import_fs2.promises.rm(tempDir, { recursive: true, force: true });
|
|
236
|
-
}
|
|
237
|
-
} catch (cleanupError) {
|
|
238
|
-
import_logger.logger.error(
|
|
239
|
-
`Failed to clean up temp directory: ${cleanupError instanceof Error ? cleanupError.message : String(cleanupError)}. Skipping cleanup...`
|
|
240
|
-
);
|
|
241
|
-
}
|
|
242
|
-
throw import_errors.RegistryError.installationFailed(
|
|
243
|
-
agentId,
|
|
244
|
-
error instanceof Error ? error.message : String(error)
|
|
245
|
-
);
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
/**
|
|
249
|
-
* Install a custom agent from a local file path
|
|
250
|
-
* @param agentId Unique identifier for the custom agent
|
|
251
|
-
* @param sourcePath Absolute path to agent YAML file or directory
|
|
252
|
-
* @param metadata Agent metadata (name for display, description, author, tags, main)
|
|
253
|
-
* @param injectPreferences Whether to inject global preferences (default: true)
|
|
254
|
-
* @returns Path to the installed agent's main config file
|
|
255
|
-
*/
|
|
256
|
-
async installCustomAgentFromPath(agentId, sourcePath, metadata, injectPreferences = true) {
|
|
257
|
-
import_logger.logger.info(`Installing custom agent '${agentId}' from ${sourcePath}`);
|
|
258
|
-
this.validateCustomAgentId(agentId);
|
|
259
|
-
if (!(0, import_fs.existsSync)(sourcePath)) {
|
|
260
|
-
throw import_errors.RegistryError.configNotFound(sourcePath);
|
|
261
|
-
}
|
|
262
|
-
const globalAgentsDir = (0, import_path2.getDextoGlobalPath)("agents");
|
|
263
|
-
const targetDir = import_path.default.resolve(globalAgentsDir, agentId);
|
|
264
|
-
const relTarget = import_path.default.relative(globalAgentsDir, targetDir);
|
|
265
|
-
if (relTarget.startsWith("..") || import_path.default.isAbsolute(relTarget)) {
|
|
266
|
-
throw import_errors.RegistryError.installationFailed(
|
|
267
|
-
agentId,
|
|
268
|
-
"invalid agentId: path traversal detected"
|
|
269
|
-
);
|
|
270
|
-
}
|
|
271
|
-
if ((0, import_fs.existsSync)(targetDir)) {
|
|
272
|
-
throw import_errors.RegistryError.agentAlreadyExists(agentId);
|
|
273
|
-
}
|
|
274
|
-
await import_fs2.promises.mkdir(globalAgentsDir, { recursive: true });
|
|
275
|
-
const stats = await import_fs2.promises.stat(sourcePath);
|
|
276
|
-
const isDirectory = stats.isDirectory();
|
|
277
|
-
const configFileName = isDirectory ? void 0 : `${agentId}.yml`;
|
|
278
|
-
if (!metadata.description) {
|
|
279
|
-
throw import_errors.RegistryError.installationFailed(agentId, "description is required");
|
|
280
|
-
}
|
|
281
|
-
if (isDirectory && !metadata.main) {
|
|
282
|
-
throw import_errors.RegistryError.installationFailed(
|
|
283
|
-
agentId,
|
|
284
|
-
"main field is required for directory-based agents"
|
|
285
|
-
);
|
|
286
|
-
}
|
|
287
|
-
const displayName = metadata.name || agentId.split("-").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
288
|
-
const registryEntry = {
|
|
289
|
-
id: agentId,
|
|
290
|
-
name: displayName,
|
|
291
|
-
description: metadata.description,
|
|
292
|
-
author: metadata.author,
|
|
293
|
-
tags: metadata.tags,
|
|
294
|
-
source: isDirectory ? `${agentId}/` : configFileName,
|
|
295
|
-
main: metadata.main
|
|
296
|
-
};
|
|
297
|
-
const tempDir = `${targetDir}.tmp.${Date.now()}`;
|
|
298
|
-
try {
|
|
299
|
-
if (isDirectory) {
|
|
300
|
-
await (0, import_path2.copyDirectory)(sourcePath, tempDir);
|
|
301
|
-
} else {
|
|
302
|
-
await import_fs2.promises.mkdir(tempDir, { recursive: true });
|
|
303
|
-
const targetFile = import_path.default.join(tempDir, configFileName);
|
|
304
|
-
await import_fs2.promises.copyFile(sourcePath, targetFile);
|
|
305
|
-
}
|
|
306
|
-
const tempMainConfigPath = isDirectory ? import_path.default.join(tempDir, metadata.main) : import_path.default.join(tempDir, configFileName);
|
|
307
|
-
if (!(0, import_fs.existsSync)(tempMainConfigPath)) {
|
|
308
|
-
throw import_errors.RegistryError.installationValidationFailed(agentId, tempMainConfigPath);
|
|
309
|
-
}
|
|
310
|
-
await import_fs2.promises.rename(tempDir, targetDir);
|
|
311
|
-
import_logger.logger.info(`\u2713 Installed custom agent '${agentId}' to ${targetDir}`);
|
|
312
|
-
const mainConfigPath = isDirectory && metadata.main ? import_path.default.join(targetDir, metadata.main) : import_path.default.join(targetDir, configFileName);
|
|
313
|
-
try {
|
|
314
|
-
await (0, import_user_registry.addAgentToUserRegistry)(agentId, registryEntry);
|
|
315
|
-
import_logger.logger.info(`\u2713 Added '${agentId}' to user registry`);
|
|
316
|
-
this._registry = null;
|
|
317
|
-
} catch (registryError) {
|
|
318
|
-
try {
|
|
319
|
-
if ((0, import_fs.existsSync)(targetDir)) {
|
|
320
|
-
await import_fs2.promises.rm(targetDir, { recursive: true, force: true });
|
|
321
|
-
import_logger.logger.info(`Rolled back installation: removed ${targetDir}`);
|
|
322
|
-
}
|
|
323
|
-
} catch (rollbackError) {
|
|
324
|
-
import_logger.logger.error(
|
|
325
|
-
`Rollback failed for '${agentId}': ${rollbackError instanceof Error ? rollbackError.message : String(rollbackError)}`
|
|
326
|
-
);
|
|
327
|
-
}
|
|
328
|
-
throw registryError;
|
|
329
|
-
}
|
|
330
|
-
if (injectPreferences) {
|
|
331
|
-
try {
|
|
332
|
-
const preferences = await (0, import_loader.loadGlobalPreferences)();
|
|
333
|
-
await (0, import_writer.writePreferencesToAgent)(targetDir, preferences);
|
|
334
|
-
import_logger.logger.info(`\u2713 Applied global preferences to custom agent '${agentId}'`);
|
|
335
|
-
} catch (error) {
|
|
336
|
-
import_logger.logger.warn(
|
|
337
|
-
`Failed to inject preferences to '${agentId}': ${error instanceof Error ? error.message : String(error)}`
|
|
338
|
-
);
|
|
339
|
-
console.log(
|
|
340
|
-
`\u26A0\uFE0F Warning: Could not apply preferences to '${agentId}' - agent will use default settings`
|
|
341
|
-
);
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
return mainConfigPath;
|
|
345
|
-
} catch (error) {
|
|
346
|
-
try {
|
|
347
|
-
if ((0, import_fs.existsSync)(tempDir)) {
|
|
348
|
-
await import_fs2.promises.rm(tempDir, { recursive: true, force: true });
|
|
349
|
-
}
|
|
350
|
-
} catch (cleanupError) {
|
|
351
|
-
import_logger.logger.error(
|
|
352
|
-
`Failed to clean up temp directory: ${cleanupError instanceof Error ? cleanupError.message : String(cleanupError)}. Skipping cleanup...`
|
|
353
|
-
);
|
|
354
|
-
}
|
|
355
|
-
throw import_errors.RegistryError.installationFailed(
|
|
356
|
-
agentId,
|
|
357
|
-
error instanceof Error ? error.message : String(error)
|
|
358
|
-
);
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
/**
|
|
362
|
-
* Resolve a registry agent ID to a config path
|
|
363
|
-
* NOTE: Only handles registry IDs, not file paths (routing done in loadAgentConfig)
|
|
364
|
-
* Handles installing agent if needed
|
|
365
|
-
* @param agentId ID of the agent to resolve
|
|
366
|
-
* @param autoInstall Whether to automatically install missing agents from registry (default: true)
|
|
367
|
-
* @param injectPreferences Whether to inject preferences during auto-installation (default: true)
|
|
368
|
-
*/
|
|
369
|
-
async resolveAgent(agentId, autoInstall = true, injectPreferences = true) {
|
|
370
|
-
import_logger.logger.debug(`Resolving registry agent: ${agentId}`);
|
|
371
|
-
const globalAgentsDir = (0, import_path2.getDextoGlobalPath)("agents");
|
|
372
|
-
const installedPath = import_path.default.resolve(globalAgentsDir, agentId);
|
|
373
|
-
const relInstalled = import_path.default.relative(globalAgentsDir, installedPath);
|
|
374
|
-
if (relInstalled.startsWith("..") || import_path.default.isAbsolute(relInstalled)) {
|
|
375
|
-
throw import_errors.RegistryError.agentNotFound(agentId, Object.keys(this.getRegistry().agents));
|
|
376
|
-
}
|
|
377
|
-
if ((0, import_fs.existsSync)(installedPath)) {
|
|
378
|
-
const mainConfig = this.resolveMainConfig(installedPath, agentId);
|
|
379
|
-
import_logger.logger.debug(`Resolved installed agent '${agentId}' to: ${mainConfig}`);
|
|
380
|
-
return mainConfig;
|
|
381
|
-
}
|
|
382
|
-
import_logger.logger.debug(`Agent '${agentId}' not found in installed path: ${installedPath}`);
|
|
383
|
-
if (this.hasAgent(agentId)) {
|
|
384
|
-
if (autoInstall) {
|
|
385
|
-
import_logger.logger.info(`Installing agent '${agentId}' from registry...`);
|
|
386
|
-
return await this.installAgent(agentId, injectPreferences);
|
|
387
|
-
} else {
|
|
388
|
-
const registry2 = this.getRegistry();
|
|
389
|
-
const available2 = Object.keys(registry2.agents);
|
|
390
|
-
throw import_errors.RegistryError.agentNotInstalledAutoInstallDisabled(agentId, available2);
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
const registry = this.getRegistry();
|
|
394
|
-
const available = Object.keys(registry.agents);
|
|
395
|
-
throw import_errors.RegistryError.agentNotFound(agentId, available);
|
|
396
|
-
}
|
|
397
|
-
/**
|
|
398
|
-
* Get list of currently installed agents
|
|
399
|
-
*/
|
|
400
|
-
async getInstalledAgents() {
|
|
401
|
-
const globalAgentsDir = (0, import_path2.getDextoGlobalPath)("agents");
|
|
402
|
-
if (!(0, import_fs.existsSync)(globalAgentsDir)) {
|
|
403
|
-
return [];
|
|
404
|
-
}
|
|
405
|
-
try {
|
|
406
|
-
const entries = await import_fs2.promises.readdir(globalAgentsDir, { withFileTypes: true });
|
|
407
|
-
return entries.filter((entry) => entry.isDirectory()).map((entry) => entry.name).filter((name) => !name.startsWith(".tmp") && !name.includes(".tmp."));
|
|
408
|
-
} catch (error) {
|
|
409
|
-
import_logger.logger.error(`Failed to read installed agents directory: ${error}`);
|
|
410
|
-
return [];
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
/**
|
|
414
|
-
* Check if an agent is safe to uninstall (not the default agent from preferences)
|
|
415
|
-
*/
|
|
416
|
-
async isAgentSafeToUninstall(agentId) {
|
|
417
|
-
try {
|
|
418
|
-
const preferences = await (0, import_loader.loadGlobalPreferences)();
|
|
419
|
-
const defaultAgent = preferences.defaults.defaultAgent;
|
|
420
|
-
return agentId !== defaultAgent;
|
|
421
|
-
} catch {
|
|
422
|
-
import_logger.logger.warn("Could not load preferences, using fallback protection for default-agent");
|
|
423
|
-
return agentId !== "default-agent";
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
|
-
/**
|
|
427
|
-
* Uninstall an agent by removing its directory
|
|
428
|
-
* For custom agents: also removes from user registry
|
|
429
|
-
* For builtin agents: only removes from disk
|
|
430
|
-
* @param agentId ID of the agent to uninstall
|
|
431
|
-
* @param force Whether to force uninstall even if agent is protected (default: false)
|
|
432
|
-
*/
|
|
433
|
-
async uninstallAgent(agentId, force = false) {
|
|
434
|
-
const globalAgentsDir = (0, import_path2.getDextoGlobalPath)("agents");
|
|
435
|
-
const agentDir = import_path.default.resolve(globalAgentsDir, agentId);
|
|
436
|
-
const relAgent = import_path.default.relative(globalAgentsDir, agentDir);
|
|
437
|
-
if (relAgent.startsWith("..") || import_path.default.isAbsolute(relAgent)) {
|
|
438
|
-
throw import_errors.RegistryError.uninstallationFailed(
|
|
439
|
-
agentId,
|
|
440
|
-
"invalid agentId: path traversal detected"
|
|
441
|
-
);
|
|
442
|
-
}
|
|
443
|
-
import_logger.logger.info(`Uninstalling agent: ${agentId} from ${agentDir}`);
|
|
444
|
-
if (!(0, import_fs.existsSync)(agentDir)) {
|
|
445
|
-
throw import_errors.RegistryError.agentNotInstalled(agentId);
|
|
446
|
-
}
|
|
447
|
-
if (!force && !await this.isAgentSafeToUninstall(agentId)) {
|
|
448
|
-
throw import_errors.RegistryError.agentProtected(agentId);
|
|
449
|
-
}
|
|
450
|
-
const registry = this.getRegistry();
|
|
451
|
-
const agentData = registry.agents[agentId];
|
|
452
|
-
const isCustomAgent = agentData?.type === "custom";
|
|
453
|
-
try {
|
|
454
|
-
await import_fs2.promises.rm(agentDir, { recursive: true, force: true });
|
|
455
|
-
import_logger.logger.info(`\u2713 Removed agent '${agentId}' from ${agentDir}`);
|
|
456
|
-
if (isCustomAgent) {
|
|
457
|
-
await (0, import_user_registry.removeAgentFromUserRegistry)(agentId);
|
|
458
|
-
import_logger.logger.info(`\u2713 Removed custom agent '${agentId}' from user registry`);
|
|
459
|
-
this._registry = null;
|
|
460
|
-
}
|
|
461
|
-
} catch (error) {
|
|
462
|
-
throw import_errors.RegistryError.uninstallationFailed(
|
|
463
|
-
agentId,
|
|
464
|
-
error instanceof Error ? error.message : String(error)
|
|
465
|
-
);
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
function getAgentRegistry() {
|
|
470
|
-
if (cachedRegistry === null) {
|
|
471
|
-
cachedRegistry = new LocalAgentRegistry();
|
|
472
|
-
}
|
|
473
|
-
return cachedRegistry;
|
|
474
|
-
}
|
|
475
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
476
|
-
0 && (module.exports = {
|
|
477
|
-
LocalAgentRegistry,
|
|
478
|
-
getAgentRegistry
|
|
479
|
-
});
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import { Registry, AgentRegistry, AgentRegistryEntry } from './types.js';
|
|
2
|
-
/**
|
|
3
|
-
* Local agent registry implementation
|
|
4
|
-
*
|
|
5
|
-
* TODO: ARCHITECTURAL REFACTOR - Move registry, preferences, and agent resolution to CLI
|
|
6
|
-
*
|
|
7
|
-
* PROBLEM: Registry operations are CLI concerns but live in Core, causing:
|
|
8
|
-
* - Missing analytics for auto-install (when running `dexto`, registry installs agents but doesn't track)
|
|
9
|
-
* - Wrong separation of concerns (Core = execution engine, not discovery/setup)
|
|
10
|
-
* - Registry manages ~/.dexto/agents filesystem which is CLI-level setup
|
|
11
|
-
*
|
|
12
|
-
* THE RIGHT ARCHITECTURE:
|
|
13
|
-
*
|
|
14
|
-
* Move to CLI:
|
|
15
|
-
* 1. Agent Registry (packages/core/src/agent/registry/) → packages/cli/src/registry/
|
|
16
|
-
* - installAgent(), uninstallAgent(), resolveAgent(), listAgents()
|
|
17
|
-
* - Can directly call capture() for analytics
|
|
18
|
-
* - Manages ~/.dexto/agents installation directory
|
|
19
|
-
*
|
|
20
|
-
* 2. Global Preferences (packages/core/src/preferences/) → packages/cli/src/preferences/
|
|
21
|
-
* - User's default LLM, model, default agent
|
|
22
|
-
* - Used by `dexto setup` command
|
|
23
|
-
* - Manages ~/.dexto/preferences.json
|
|
24
|
-
*
|
|
25
|
-
* 3. Agent Resolution (packages/core/src/config/agent-resolver.ts) → packages/cli/src/agent-resolver.ts
|
|
26
|
-
* - Discovery logic: check registry, trigger installs, apply preferences
|
|
27
|
-
* - Returns resolved config PATH to core
|
|
28
|
-
*
|
|
29
|
-
* Core keeps:
|
|
30
|
-
* - config/loader.ts - Load YAML from path
|
|
31
|
-
* - config/schemas.ts - Zod validation
|
|
32
|
-
* - Agent execution (DextoAgent, LLM, tools, MCP)
|
|
33
|
-
*
|
|
34
|
-
* FLOW AFTER REFACTOR:
|
|
35
|
-
* CLI index.ts:
|
|
36
|
-
* → CLI: resolveAgentPath() (discovery logic)
|
|
37
|
-
* → CLI: registry.resolveAgent()
|
|
38
|
-
* → CLI: registry.installAgent() if needed
|
|
39
|
-
* → CLI: capture('dexto_install_agent', ...) ✓ Natural!
|
|
40
|
-
* → Core: new DextoAgent(configPath) (just loads & runs)
|
|
41
|
-
*
|
|
42
|
-
* BENEFITS:
|
|
43
|
-
* - Clear separation: CLI = setup/discovery, Core = execution
|
|
44
|
-
* - Analytics naturally colocated with operations
|
|
45
|
-
* - Core is portable (no CLI dependencies)
|
|
46
|
-
* - No circular deps (CLI → Core, correct direction)
|
|
47
|
-
*
|
|
48
|
-
* ESTIMATE: ~3-4 hours (mostly moving code + updating imports)
|
|
49
|
-
*/
|
|
50
|
-
export declare class LocalAgentRegistry implements AgentRegistry {
|
|
51
|
-
private _registry;
|
|
52
|
-
/**
|
|
53
|
-
* Lazy load registry from JSON file
|
|
54
|
-
*/
|
|
55
|
-
getRegistry(): Registry;
|
|
56
|
-
/**
|
|
57
|
-
* Load and merge bundled + user registries
|
|
58
|
-
* Uses fail-fast approach - throws RegistryError for any loading issues
|
|
59
|
-
*/
|
|
60
|
-
private loadRegistry;
|
|
61
|
-
/**
|
|
62
|
-
* Check if agent exists in registry by ID
|
|
63
|
-
*/
|
|
64
|
-
hasAgent(agentId: string): boolean;
|
|
65
|
-
/**
|
|
66
|
-
* Get available agents with their metadata from registry
|
|
67
|
-
*/
|
|
68
|
-
getAvailableAgents(): Record<string, AgentRegistryEntry>;
|
|
69
|
-
/**
|
|
70
|
-
* Validate custom agent ID doesn't conflict with bundled registry
|
|
71
|
-
* @throws RegistryError if ID conflicts with builtin agent
|
|
72
|
-
*/
|
|
73
|
-
private validateCustomAgentId;
|
|
74
|
-
/**
|
|
75
|
-
* Resolve main config file for installed agent
|
|
76
|
-
* Handles both directory agents (with main field) and single-file agents
|
|
77
|
-
*/
|
|
78
|
-
resolveMainConfig(agentDir: string, agentId: string): string;
|
|
79
|
-
/**
|
|
80
|
-
* Install agent atomically using temp + rename pattern
|
|
81
|
-
* @param agentId ID of the agent to install
|
|
82
|
-
* @param injectPreferences Whether to inject global preferences into installed agent (default: true)
|
|
83
|
-
*/
|
|
84
|
-
installAgent(agentId: string, injectPreferences?: boolean): Promise<string>;
|
|
85
|
-
/**
|
|
86
|
-
* Install a custom agent from a local file path
|
|
87
|
-
* @param agentId Unique identifier for the custom agent
|
|
88
|
-
* @param sourcePath Absolute path to agent YAML file or directory
|
|
89
|
-
* @param metadata Agent metadata (name for display, description, author, tags, main)
|
|
90
|
-
* @param injectPreferences Whether to inject global preferences (default: true)
|
|
91
|
-
* @returns Path to the installed agent's main config file
|
|
92
|
-
*/
|
|
93
|
-
installCustomAgentFromPath(agentId: string, sourcePath: string, metadata: {
|
|
94
|
-
name?: string;
|
|
95
|
-
description: string;
|
|
96
|
-
author: string;
|
|
97
|
-
tags: string[];
|
|
98
|
-
main?: string;
|
|
99
|
-
}, injectPreferences?: boolean): Promise<string>;
|
|
100
|
-
/**
|
|
101
|
-
* Resolve a registry agent ID to a config path
|
|
102
|
-
* NOTE: Only handles registry IDs, not file paths (routing done in loadAgentConfig)
|
|
103
|
-
* Handles installing agent if needed
|
|
104
|
-
* @param agentId ID of the agent to resolve
|
|
105
|
-
* @param autoInstall Whether to automatically install missing agents from registry (default: true)
|
|
106
|
-
* @param injectPreferences Whether to inject preferences during auto-installation (default: true)
|
|
107
|
-
*/
|
|
108
|
-
resolveAgent(agentId: string, autoInstall?: boolean, injectPreferences?: boolean): Promise<string>;
|
|
109
|
-
/**
|
|
110
|
-
* Get list of currently installed agents
|
|
111
|
-
*/
|
|
112
|
-
getInstalledAgents(): Promise<string[]>;
|
|
113
|
-
/**
|
|
114
|
-
* Check if an agent is safe to uninstall (not the default agent from preferences)
|
|
115
|
-
*/
|
|
116
|
-
private isAgentSafeToUninstall;
|
|
117
|
-
/**
|
|
118
|
-
* Uninstall an agent by removing its directory
|
|
119
|
-
* For custom agents: also removes from user registry
|
|
120
|
-
* For builtin agents: only removes from disk
|
|
121
|
-
* @param agentId ID of the agent to uninstall
|
|
122
|
-
* @param force Whether to force uninstall even if agent is protected (default: false)
|
|
123
|
-
*/
|
|
124
|
-
uninstallAgent(agentId: string, force?: boolean): Promise<void>;
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* Get cached registry instance (singleton pattern)
|
|
128
|
-
*/
|
|
129
|
-
export declare function getAgentRegistry(): LocalAgentRegistry;
|
|
130
|
-
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/agent/registry/registry.ts"],"names":[],"mappings":"AAOA,OAAO,EACH,QAAQ,EAER,aAAa,EACb,kBAAkB,EAErB,MAAM,YAAY,CAAC;AAYpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,qBAAa,kBAAmB,YAAW,aAAa;IACpD,OAAO,CAAC,SAAS,CAAyB;IAE1C;;OAEG;IACH,WAAW,IAAI,QAAQ;IAOvB;;;OAGG;IACH,OAAO,CAAC,YAAY;IAyCpB;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAKlC;;OAEG;IACH,kBAAkB,IAAI,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC;IAKxD;;;OAGG;IACH,OAAO,CAAC,qBAAqB;IAgC7B;;;OAGG;IACH,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM;IAqC5D;;;;OAIG;IACG,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,iBAAiB,GAAE,OAAc,GAAG,OAAO,CAAC,MAAM,CAAC;IAqGvF;;;;;;;OAOG;IACG,0BAA0B,CAC5B,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE;QACN,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,WAAW,EAAE,MAAM,CAAC;QACpB,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,EAAE,CAAC;QACf,IAAI,CAAC,EAAE,MAAM,CAAC;KACjB,EACD,iBAAiB,GAAE,OAAc,GAClC,OAAO,CAAC,MAAM,CAAC;IAqKlB;;;;;;;OAOG;IACG,YAAY,CACd,OAAO,EAAE,MAAM,EACf,WAAW,GAAE,OAAc,EAC3B,iBAAiB,GAAE,OAAc,GAClC,OAAO,CAAC,MAAM,CAAC;IAsClB;;OAEG;IACG,kBAAkB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAsB7C;;OAEG;YACW,sBAAsB;IAYpC;;;;;;OAMG;IACG,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,GAAE,OAAe,GAAG,OAAO,CAAC,IAAI,CAAC;CA8C/E;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,kBAAkB,CAKrD"}
|