@dexto/core 1.2.3 → 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
package/dist/approval/types.d.ts
CHANGED
|
@@ -34,6 +34,26 @@ export declare enum ApprovalStatus {
|
|
|
34
34
|
DENIED = "denied",
|
|
35
35
|
CANCELLED = "cancelled"
|
|
36
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Reason for denial or cancellation
|
|
39
|
+
* Provides context about why an approval was not granted
|
|
40
|
+
*/
|
|
41
|
+
export declare enum DenialReason {
|
|
42
|
+
/** User explicitly clicked deny/reject */
|
|
43
|
+
USER_DENIED = "user_denied",
|
|
44
|
+
/** System denied due to policy (auto-deny mode, alwaysDeny list) */
|
|
45
|
+
SYSTEM_DENIED = "system_denied",
|
|
46
|
+
/** Request timed out waiting for user response */
|
|
47
|
+
TIMEOUT = "timeout",
|
|
48
|
+
/** User cancelled the request */
|
|
49
|
+
USER_CANCELLED = "user_cancelled",
|
|
50
|
+
/** System cancelled (session ended, agent stopped) */
|
|
51
|
+
SYSTEM_CANCELLED = "system_cancelled",
|
|
52
|
+
/** Validation failed (form validation, schema mismatch) */
|
|
53
|
+
VALIDATION_FAILED = "validation_failed",
|
|
54
|
+
/** Elicitation disabled in configuration */
|
|
55
|
+
ELICITATION_DISABLED = "elicitation_disabled"
|
|
56
|
+
}
|
|
37
57
|
/**
|
|
38
58
|
* Tool confirmation specific metadata
|
|
39
59
|
* Derived from ToolConfirmationMetadataSchema
|
|
@@ -140,27 +160,59 @@ export type ApprovalResponse = z.output<typeof ApprovalResponseSchema>;
|
|
|
140
160
|
*/
|
|
141
161
|
export type ApprovalRequestDetails = z.output<typeof ApprovalRequestDetailsSchema>;
|
|
142
162
|
/**
|
|
143
|
-
*
|
|
144
|
-
|
|
145
|
-
|
|
163
|
+
* Handler interface for processing approval requests.
|
|
164
|
+
*
|
|
165
|
+
* This is the core abstraction for approval handling in Dexto. When tool confirmation
|
|
166
|
+
* mode is 'manual', a handler must be provided to process approval requests.
|
|
167
|
+
*
|
|
168
|
+
* The handler is a callable interface that:
|
|
169
|
+
* - Processes approval requests and returns responses
|
|
170
|
+
* - Manages pending approval state (for cancellation)
|
|
171
|
+
* - Provides lifecycle management methods
|
|
172
|
+
*
|
|
173
|
+
* @example
|
|
174
|
+
* ```typescript
|
|
175
|
+
* const handler: ApprovalHandler = Object.assign(
|
|
176
|
+
* async (request: ApprovalRequest) => {
|
|
177
|
+
* console.log(`Approve tool: ${request.metadata.toolName}?`);
|
|
178
|
+
* // In real implementation, wait for user input
|
|
179
|
+
* return {
|
|
180
|
+
* approvalId: request.approvalId,
|
|
181
|
+
* status: ApprovalStatus.APPROVED,
|
|
182
|
+
* sessionId: request.sessionId,
|
|
183
|
+
* };
|
|
184
|
+
* },
|
|
185
|
+
* {
|
|
186
|
+
* cancel: (id: string) => { },
|
|
187
|
+
* cancelAll: () => { },
|
|
188
|
+
* getPending: () => [] as string[],
|
|
189
|
+
* }
|
|
190
|
+
* );
|
|
191
|
+
* ```
|
|
192
|
+
*/
|
|
193
|
+
export interface ApprovalHandler {
|
|
146
194
|
/**
|
|
147
|
-
*
|
|
148
|
-
* @param request The approval request
|
|
195
|
+
* Process an approval request
|
|
196
|
+
* @param request The approval request to handle
|
|
149
197
|
* @returns Promise resolving to the approval response
|
|
150
198
|
*/
|
|
151
|
-
|
|
199
|
+
(request: ApprovalRequest): Promise<ApprovalResponse>;
|
|
152
200
|
/**
|
|
153
|
-
* Cancel a pending approval request
|
|
201
|
+
* Cancel a specific pending approval request (optional)
|
|
154
202
|
* @param approvalId The ID of the approval to cancel
|
|
203
|
+
* @remarks Not all handlers support cancellation (e.g., auto-approve handlers)
|
|
155
204
|
*/
|
|
156
|
-
|
|
205
|
+
cancel?(approvalId: string): void;
|
|
157
206
|
/**
|
|
158
|
-
* Cancel all pending approval requests
|
|
207
|
+
* Cancel all pending approval requests (optional)
|
|
208
|
+
* @remarks Not all handlers support cancellation (e.g., auto-approve handlers)
|
|
159
209
|
*/
|
|
160
|
-
|
|
210
|
+
cancelAll?(): void;
|
|
161
211
|
/**
|
|
162
|
-
* Get list of pending approval request IDs
|
|
212
|
+
* Get list of pending approval request IDs (optional)
|
|
213
|
+
* @returns Array of approval IDs currently pending
|
|
214
|
+
* @remarks Not all handlers track pending requests (e.g., auto-approve handlers)
|
|
163
215
|
*/
|
|
164
|
-
|
|
216
|
+
getPending?(): string[];
|
|
165
217
|
}
|
|
166
218
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/approval/types.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EACR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AAI,MAAM,EAAE,CAAC;CAC3B"}
|
package/dist/approval/types.js
CHANGED
|
@@ -12,7 +12,18 @@ var ApprovalStatus = /* @__PURE__ */ ((ApprovalStatus2) => {
|
|
|
12
12
|
ApprovalStatus2["CANCELLED"] = "cancelled";
|
|
13
13
|
return ApprovalStatus2;
|
|
14
14
|
})(ApprovalStatus || {});
|
|
15
|
+
var DenialReason = /* @__PURE__ */ ((DenialReason2) => {
|
|
16
|
+
DenialReason2["USER_DENIED"] = "user_denied";
|
|
17
|
+
DenialReason2["SYSTEM_DENIED"] = "system_denied";
|
|
18
|
+
DenialReason2["TIMEOUT"] = "timeout";
|
|
19
|
+
DenialReason2["USER_CANCELLED"] = "user_cancelled";
|
|
20
|
+
DenialReason2["SYSTEM_CANCELLED"] = "system_cancelled";
|
|
21
|
+
DenialReason2["VALIDATION_FAILED"] = "validation_failed";
|
|
22
|
+
DenialReason2["ELICITATION_DISABLED"] = "elicitation_disabled";
|
|
23
|
+
return DenialReason2;
|
|
24
|
+
})(DenialReason || {});
|
|
15
25
|
export {
|
|
16
26
|
ApprovalStatus,
|
|
17
|
-
ApprovalType
|
|
27
|
+
ApprovalType,
|
|
28
|
+
DenialReason
|
|
18
29
|
};
|
|
@@ -23,17 +23,20 @@ __export(middle_removal_exports, {
|
|
|
23
23
|
module.exports = __toCommonJS(middle_removal_exports);
|
|
24
24
|
var import_utils = require("../utils.cjs");
|
|
25
25
|
var import_errors = require("../errors.js");
|
|
26
|
+
var import_types5 = require("../../logger/v2/types.js");
|
|
26
27
|
class MiddleRemovalStrategy {
|
|
27
28
|
preserveStart;
|
|
28
29
|
preserveEnd;
|
|
30
|
+
logger;
|
|
29
31
|
/**
|
|
30
32
|
* Creates an instance of MiddleRemovalStrategy.
|
|
31
33
|
*
|
|
32
34
|
* @param options Configuration options for preserving messages.
|
|
33
35
|
*/
|
|
34
|
-
constructor(options = {}) {
|
|
36
|
+
constructor(options = {}, logger) {
|
|
35
37
|
this.preserveStart = options.preserveStart ?? 4;
|
|
36
38
|
this.preserveEnd = options.preserveEnd ?? 5;
|
|
39
|
+
this.logger = logger.createChild(import_types5.DextoLogComponent.CONTEXT);
|
|
37
40
|
if (this.preserveStart < 0 || this.preserveEnd < 0) {
|
|
38
41
|
throw import_errors.ContextError.preserveValuesNegative();
|
|
39
42
|
}
|
|
@@ -48,7 +51,7 @@ class MiddleRemovalStrategy {
|
|
|
48
51
|
* @returns The potentially compressed message history.
|
|
49
52
|
*/
|
|
50
53
|
compress(history, tokenizer, maxHistoryTokens) {
|
|
51
|
-
const initialTokenCount = (0, import_utils.countMessagesTokens)(history, tokenizer);
|
|
54
|
+
const initialTokenCount = (0, import_utils.countMessagesTokens)(history, tokenizer, void 0, this.logger);
|
|
52
55
|
if (initialTokenCount <= maxHistoryTokens) {
|
|
53
56
|
return history;
|
|
54
57
|
}
|
|
@@ -59,13 +62,8 @@ class MiddleRemovalStrategy {
|
|
|
59
62
|
removableIndices.push(i);
|
|
60
63
|
}
|
|
61
64
|
} else {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
totalMessages,
|
|
65
|
-
"PreserveStart:",
|
|
66
|
-
this.preserveStart,
|
|
67
|
-
"PreserveEnd:",
|
|
68
|
-
this.preserveEnd
|
|
65
|
+
this.logger.warn(
|
|
66
|
+
`MiddleRemovalStrategy: Not enough messages to apply middle removal based on preserve counts. History length: ${totalMessages}, PreserveStart: ${this.preserveStart}, PreserveEnd: ${this.preserveEnd}`
|
|
69
67
|
);
|
|
70
68
|
return history;
|
|
71
69
|
}
|
|
@@ -78,11 +76,13 @@ class MiddleRemovalStrategy {
|
|
|
78
76
|
currentTokenCount = (0, import_utils.countMessagesTokens)(
|
|
79
77
|
currentHistory.filter((_, i) => !removedIndices.has(i)),
|
|
80
78
|
// Calculate tokens based on remaining messages
|
|
81
|
-
tokenizer
|
|
79
|
+
tokenizer,
|
|
80
|
+
void 0,
|
|
81
|
+
this.logger
|
|
82
82
|
);
|
|
83
83
|
}
|
|
84
84
|
if (currentTokenCount > maxHistoryTokens) {
|
|
85
|
-
|
|
85
|
+
this.logger.warn(
|
|
86
86
|
`MiddleRemovalStrategy: Unable to compress below max tokens (${maxHistoryTokens}). Final token count: ${currentTokenCount}`
|
|
87
87
|
);
|
|
88
88
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ITokenizer } from '../../llm/tokenizer/types.js';
|
|
2
2
|
import { InternalMessage } from '../types.js';
|
|
3
3
|
import { ICompressionStrategy } from './types.js';
|
|
4
|
+
import { IDextoLogger } from '../../logger/v2/types.js';
|
|
4
5
|
/**
|
|
5
6
|
* Configuration options for the MiddleRemovalStrategy.
|
|
6
7
|
*/
|
|
@@ -25,12 +26,13 @@ export interface MiddleRemovalStrategyOptions {
|
|
|
25
26
|
export declare class MiddleRemovalStrategy implements ICompressionStrategy {
|
|
26
27
|
private readonly preserveStart;
|
|
27
28
|
private readonly preserveEnd;
|
|
29
|
+
private readonly logger;
|
|
28
30
|
/**
|
|
29
31
|
* Creates an instance of MiddleRemovalStrategy.
|
|
30
32
|
*
|
|
31
33
|
* @param options Configuration options for preserving messages.
|
|
32
34
|
*/
|
|
33
|
-
constructor(options
|
|
35
|
+
constructor(options: MiddleRemovalStrategyOptions | undefined, logger: IDextoLogger);
|
|
34
36
|
/**
|
|
35
37
|
* Compresses the history by removing messages from the middle if the total
|
|
36
38
|
* token count exceeds the specified maximum.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middle-removal.d.ts","sourceRoot":"","sources":["../../../src/context/compression/middle-removal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"middle-removal.d.ts","sourceRoot":"","sources":["../../../src/context/compression/middle-removal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAGlD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAGxD;;GAEG;AACH,MAAM,WAAW,4BAA4B;IACzC;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;GAKG;AACH,qBAAa,qBAAsB,YAAW,oBAAoB;IAC9D,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAS;IACvC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAe;IAEtC;;;;OAIG;gBACS,OAAO,EAAE,4BAA4B,YAAK,EAAE,MAAM,EAAE,YAAY;IAS5E;;;;;;;;OAQG;IACH,QAAQ,CACJ,OAAO,EAAE,eAAe,EAAE,EAC1B,SAAS,EAAE,UAAU,EACrB,gBAAgB,EAAE,MAAM,GACzB,eAAe,EAAE;CAmDvB"}
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import "../../chunk-C6A6W6XS.js";
|
|
2
2
|
import { countMessagesTokens } from "../utils.js";
|
|
3
3
|
import { ContextError } from "../errors.js";
|
|
4
|
+
import { DextoLogComponent } from "../../logger/v2/types.js";
|
|
4
5
|
class MiddleRemovalStrategy {
|
|
5
6
|
preserveStart;
|
|
6
7
|
preserveEnd;
|
|
8
|
+
logger;
|
|
7
9
|
/**
|
|
8
10
|
* Creates an instance of MiddleRemovalStrategy.
|
|
9
11
|
*
|
|
10
12
|
* @param options Configuration options for preserving messages.
|
|
11
13
|
*/
|
|
12
|
-
constructor(options = {}) {
|
|
14
|
+
constructor(options = {}, logger) {
|
|
13
15
|
this.preserveStart = options.preserveStart ?? 4;
|
|
14
16
|
this.preserveEnd = options.preserveEnd ?? 5;
|
|
17
|
+
this.logger = logger.createChild(DextoLogComponent.CONTEXT);
|
|
15
18
|
if (this.preserveStart < 0 || this.preserveEnd < 0) {
|
|
16
19
|
throw ContextError.preserveValuesNegative();
|
|
17
20
|
}
|
|
@@ -26,7 +29,7 @@ class MiddleRemovalStrategy {
|
|
|
26
29
|
* @returns The potentially compressed message history.
|
|
27
30
|
*/
|
|
28
31
|
compress(history, tokenizer, maxHistoryTokens) {
|
|
29
|
-
const initialTokenCount = countMessagesTokens(history, tokenizer);
|
|
32
|
+
const initialTokenCount = countMessagesTokens(history, tokenizer, void 0, this.logger);
|
|
30
33
|
if (initialTokenCount <= maxHistoryTokens) {
|
|
31
34
|
return history;
|
|
32
35
|
}
|
|
@@ -37,13 +40,8 @@ class MiddleRemovalStrategy {
|
|
|
37
40
|
removableIndices.push(i);
|
|
38
41
|
}
|
|
39
42
|
} else {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
totalMessages,
|
|
43
|
-
"PreserveStart:",
|
|
44
|
-
this.preserveStart,
|
|
45
|
-
"PreserveEnd:",
|
|
46
|
-
this.preserveEnd
|
|
43
|
+
this.logger.warn(
|
|
44
|
+
`MiddleRemovalStrategy: Not enough messages to apply middle removal based on preserve counts. History length: ${totalMessages}, PreserveStart: ${this.preserveStart}, PreserveEnd: ${this.preserveEnd}`
|
|
47
45
|
);
|
|
48
46
|
return history;
|
|
49
47
|
}
|
|
@@ -56,11 +54,13 @@ class MiddleRemovalStrategy {
|
|
|
56
54
|
currentTokenCount = countMessagesTokens(
|
|
57
55
|
currentHistory.filter((_, i) => !removedIndices.has(i)),
|
|
58
56
|
// Calculate tokens based on remaining messages
|
|
59
|
-
tokenizer
|
|
57
|
+
tokenizer,
|
|
58
|
+
void 0,
|
|
59
|
+
this.logger
|
|
60
60
|
);
|
|
61
61
|
}
|
|
62
62
|
if (currentTokenCount > maxHistoryTokens) {
|
|
63
|
-
|
|
63
|
+
this.logger.warn(
|
|
64
64
|
`MiddleRemovalStrategy: Unable to compress below max tokens (${maxHistoryTokens}). Final token count: ${currentTokenCount}`
|
|
65
65
|
);
|
|
66
66
|
}
|
|
@@ -23,15 +23,18 @@ __export(oldest_removal_exports, {
|
|
|
23
23
|
module.exports = __toCommonJS(oldest_removal_exports);
|
|
24
24
|
var import_utils = require("../utils.js");
|
|
25
25
|
var import_errors = require("../errors.js");
|
|
26
|
+
var import_types5 = require("../../logger/v2/types.js");
|
|
26
27
|
class OldestRemovalStrategy {
|
|
27
28
|
minMessagesToKeep;
|
|
29
|
+
logger;
|
|
28
30
|
/**
|
|
29
31
|
* Creates an instance of OldestRemovalStrategy.
|
|
30
32
|
*
|
|
31
33
|
* @param options Configuration options for preserving messages.
|
|
32
34
|
*/
|
|
33
|
-
constructor(options = {}) {
|
|
35
|
+
constructor(options = {}, logger) {
|
|
34
36
|
this.minMessagesToKeep = options.minMessagesToKeep ?? 4;
|
|
37
|
+
this.logger = logger.createChild(import_types5.DextoLogComponent.CONTEXT);
|
|
35
38
|
if (this.minMessagesToKeep < 0) {
|
|
36
39
|
throw import_errors.ContextError.minMessagesNegative();
|
|
37
40
|
}
|
|
@@ -47,17 +50,27 @@ class OldestRemovalStrategy {
|
|
|
47
50
|
*/
|
|
48
51
|
compress(history, tokenizer, maxHistoryTokens) {
|
|
49
52
|
let currentHistory = [...history];
|
|
50
|
-
let currentTokenCount = (0, import_utils.countMessagesTokens)(
|
|
53
|
+
let currentTokenCount = (0, import_utils.countMessagesTokens)(
|
|
54
|
+
currentHistory,
|
|
55
|
+
tokenizer,
|
|
56
|
+
void 0,
|
|
57
|
+
this.logger
|
|
58
|
+
);
|
|
51
59
|
while (currentHistory.length > this.minMessagesToKeep && currentTokenCount > maxHistoryTokens) {
|
|
52
60
|
currentHistory.shift();
|
|
53
|
-
currentTokenCount = (0, import_utils.countMessagesTokens)(
|
|
61
|
+
currentTokenCount = (0, import_utils.countMessagesTokens)(
|
|
62
|
+
currentHistory,
|
|
63
|
+
tokenizer,
|
|
64
|
+
void 0,
|
|
65
|
+
this.logger
|
|
66
|
+
);
|
|
54
67
|
}
|
|
55
68
|
if (currentTokenCount > maxHistoryTokens && currentHistory.length <= this.minMessagesToKeep) {
|
|
56
|
-
|
|
69
|
+
this.logger.warn(
|
|
57
70
|
`OldestRemovalStrategy: Could not compress below max tokens (${maxHistoryTokens}) without violating minMessagesToKeep (${this.minMessagesToKeep}). Final token count: ${currentTokenCount}, Messages: ${currentHistory.length}`
|
|
58
71
|
);
|
|
59
72
|
} else if (currentTokenCount > maxHistoryTokens) {
|
|
60
|
-
|
|
73
|
+
this.logger.warn(
|
|
61
74
|
`OldestRemovalStrategy: Unable to compress below max tokens (${maxHistoryTokens}). Final token count: ${currentTokenCount}`
|
|
62
75
|
);
|
|
63
76
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ITokenizer } from '../../llm/tokenizer/types.js';
|
|
2
2
|
import { InternalMessage } from '../types.js';
|
|
3
3
|
import { ICompressionStrategy } from './types.js';
|
|
4
|
+
import { IDextoLogger } from '../../logger/v2/types.js';
|
|
4
5
|
/**
|
|
5
6
|
* Configuration options for the OldestRemovalStrategy.
|
|
6
7
|
*/
|
|
@@ -20,12 +21,13 @@ export interface OldestRemovalStrategyOptions {
|
|
|
20
21
|
*/
|
|
21
22
|
export declare class OldestRemovalStrategy implements ICompressionStrategy {
|
|
22
23
|
private readonly minMessagesToKeep;
|
|
24
|
+
private readonly logger;
|
|
23
25
|
/**
|
|
24
26
|
* Creates an instance of OldestRemovalStrategy.
|
|
25
27
|
*
|
|
26
28
|
* @param options Configuration options for preserving messages.
|
|
27
29
|
*/
|
|
28
|
-
constructor(options
|
|
30
|
+
constructor(options: OldestRemovalStrategyOptions | undefined, logger: IDextoLogger);
|
|
29
31
|
/**
|
|
30
32
|
* Compresses the history by removing the oldest messages if the total
|
|
31
33
|
* token count exceeds the specified maximum, while respecting minMessagesToKeep.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oldest-removal.d.ts","sourceRoot":"","sources":["../../../src/context/compression/oldest-removal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"oldest-removal.d.ts","sourceRoot":"","sources":["../../../src/context/compression/oldest-removal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAGlD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAGxD;;GAEG;AACH,MAAM,WAAW,4BAA4B;IACzC;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED;;;;GAIG;AACH,qBAAa,qBAAsB,YAAW,oBAAoB;IAC9D,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAS;IAC3C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAe;IACtC;;;;OAIG;gBACS,OAAO,EAAE,4BAA4B,YAAK,EAAE,MAAM,EAAE,YAAY;IAQ5E;;;;;;;;OAQG;IACH,QAAQ,CACJ,OAAO,EAAE,eAAe,EAAE,EAC1B,SAAS,EAAE,UAAU,EACrB,gBAAgB,EAAE,MAAM,GACzB,eAAe,EAAE;CAuCvB"}
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import "../../chunk-C6A6W6XS.js";
|
|
2
2
|
import { countMessagesTokens } from "../utils.js";
|
|
3
3
|
import { ContextError } from "../errors.js";
|
|
4
|
+
import { DextoLogComponent } from "../../logger/v2/types.js";
|
|
4
5
|
class OldestRemovalStrategy {
|
|
5
6
|
minMessagesToKeep;
|
|
7
|
+
logger;
|
|
6
8
|
/**
|
|
7
9
|
* Creates an instance of OldestRemovalStrategy.
|
|
8
10
|
*
|
|
9
11
|
* @param options Configuration options for preserving messages.
|
|
10
12
|
*/
|
|
11
|
-
constructor(options = {}) {
|
|
13
|
+
constructor(options = {}, logger) {
|
|
12
14
|
this.minMessagesToKeep = options.minMessagesToKeep ?? 4;
|
|
15
|
+
this.logger = logger.createChild(DextoLogComponent.CONTEXT);
|
|
13
16
|
if (this.minMessagesToKeep < 0) {
|
|
14
17
|
throw ContextError.minMessagesNegative();
|
|
15
18
|
}
|
|
@@ -25,17 +28,27 @@ class OldestRemovalStrategy {
|
|
|
25
28
|
*/
|
|
26
29
|
compress(history, tokenizer, maxHistoryTokens) {
|
|
27
30
|
let currentHistory = [...history];
|
|
28
|
-
let currentTokenCount = countMessagesTokens(
|
|
31
|
+
let currentTokenCount = countMessagesTokens(
|
|
32
|
+
currentHistory,
|
|
33
|
+
tokenizer,
|
|
34
|
+
void 0,
|
|
35
|
+
this.logger
|
|
36
|
+
);
|
|
29
37
|
while (currentHistory.length > this.minMessagesToKeep && currentTokenCount > maxHistoryTokens) {
|
|
30
38
|
currentHistory.shift();
|
|
31
|
-
currentTokenCount = countMessagesTokens(
|
|
39
|
+
currentTokenCount = countMessagesTokens(
|
|
40
|
+
currentHistory,
|
|
41
|
+
tokenizer,
|
|
42
|
+
void 0,
|
|
43
|
+
this.logger
|
|
44
|
+
);
|
|
32
45
|
}
|
|
33
46
|
if (currentTokenCount > maxHistoryTokens && currentHistory.length <= this.minMessagesToKeep) {
|
|
34
|
-
|
|
47
|
+
this.logger.warn(
|
|
35
48
|
`OldestRemovalStrategy: Could not compress below max tokens (${maxHistoryTokens}) without violating minMessagesToKeep (${this.minMessagesToKeep}). Final token count: ${currentTokenCount}, Messages: ${currentHistory.length}`
|
|
36
49
|
);
|
|
37
50
|
} else if (currentTokenCount > maxHistoryTokens) {
|
|
38
|
-
|
|
51
|
+
this.logger.warn(
|
|
39
52
|
`OldestRemovalStrategy: Unable to compress below max tokens (${maxHistoryTokens}). Final token count: ${currentTokenCount}`
|
|
40
53
|
);
|
|
41
54
|
}
|