@dexto/core 1.1.11 → 1.2.1
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 +24 -4
- package/dist/Dexto.cjs +4 -14
- package/dist/Dexto.d.ts +8 -29
- package/dist/Dexto.d.ts.map +1 -1
- package/dist/Dexto.js +4 -12
- package/dist/agent/DextoAgent.cjs +92 -3
- package/dist/agent/DextoAgent.d.ts +12 -4
- package/dist/agent/DextoAgent.d.ts.map +1 -1
- package/dist/agent/DextoAgent.js +52 -3
- package/dist/agent/agentCard.js +1 -0
- package/dist/agent/error-codes.cjs +1 -0
- package/dist/agent/error-codes.d.ts +1 -0
- package/dist/agent/error-codes.d.ts.map +1 -1
- package/dist/agent/error-codes.js +2 -0
- package/dist/agent/errors.cjs +13 -0
- package/dist/agent/errors.d.ts +4 -0
- package/dist/agent/errors.d.ts.map +1 -1
- package/dist/agent/errors.js +14 -0
- package/dist/agent/index.js +1 -0
- package/dist/agent/registry/error-codes.js +1 -0
- package/dist/agent/registry/errors.js +1 -0
- package/dist/agent/registry/registry.js +1 -0
- package/dist/agent/registry/types.js +1 -0
- package/dist/agent/registry/user-registry.js +1 -0
- package/dist/agent/schemas.cjs +6 -1
- package/dist/agent/schemas.d.ts +113 -3
- package/dist/agent/schemas.d.ts.map +1 -1
- package/dist/agent/schemas.js +7 -1
- package/dist/agent/state-manager.js +1 -0
- package/dist/approval/error-codes.js +1 -0
- package/dist/approval/errors.js +1 -0
- package/dist/approval/index.js +1 -0
- package/dist/approval/manager.cjs +30 -0
- package/dist/approval/manager.d.ts +23 -1
- package/dist/approval/manager.d.ts.map +1 -1
- package/dist/approval/manager.js +31 -0
- package/dist/approval/providers/event-based-approval-provider.js +1 -0
- package/dist/approval/providers/factory.js +1 -0
- package/dist/approval/providers/noop-approval-provider.js +1 -0
- package/dist/approval/schemas.cjs +36 -0
- package/dist/approval/schemas.d.ts +173 -0
- package/dist/approval/schemas.d.ts.map +1 -1
- package/dist/approval/schemas.js +33 -0
- package/dist/approval/types.cjs +1 -0
- package/dist/approval/types.d.ts +27 -1
- package/dist/approval/types.d.ts.map +1 -1
- package/dist/approval/types.js +2 -0
- package/dist/chunk-C6A6W6XS.js +53 -0
- package/dist/config/agent-resolver.js +1 -0
- package/dist/config/error-codes.js +1 -0
- package/dist/config/errors.js +1 -0
- package/dist/config/loader.js +1 -0
- package/dist/config/writer.js +1 -0
- package/dist/context/compression/middle-removal.js +1 -0
- package/dist/context/compression/oldest-removal.js +1 -0
- package/dist/context/error-codes.js +1 -0
- package/dist/context/errors.js +1 -0
- package/dist/context/index.js +1 -0
- package/dist/context/manager.cjs +36 -1
- package/dist/context/manager.d.ts.map +1 -1
- package/dist/context/manager.js +27 -1
- package/dist/context/media-helpers.js +1 -0
- package/dist/context/utils.cjs +102 -6
- package/dist/context/utils.d.ts +35 -2
- package/dist/context/utils.d.ts.map +1 -1
- package/dist/context/utils.js +100 -6
- package/dist/errors/DextoBaseError.js +1 -0
- package/dist/errors/DextoRuntimeError.js +1 -0
- package/dist/errors/DextoValidationError.js +1 -0
- package/dist/errors/index.js +1 -0
- package/dist/errors/result-bridge.js +1 -0
- package/dist/errors/types.cjs +3 -0
- package/dist/errors/types.d.ts +7 -2
- package/dist/errors/types.d.ts.map +1 -1
- package/dist/errors/types.js +4 -0
- package/dist/events/index.cjs +1 -0
- package/dist/events/index.d.ts +6 -2
- package/dist/events/index.d.ts.map +1 -1
- package/dist/events/index.js +2 -0
- package/dist/filesystem/error-codes.cjs +53 -0
- package/dist/filesystem/error-codes.d.ts +31 -0
- package/dist/filesystem/error-codes.d.ts.map +1 -0
- package/dist/filesystem/error-codes.js +30 -0
- package/dist/filesystem/errors.cjs +303 -0
- package/dist/filesystem/errors.d.ts +109 -0
- package/dist/filesystem/errors.d.ts.map +1 -0
- package/dist/filesystem/errors.js +280 -0
- package/dist/filesystem/filesystem-service.cjs +482 -0
- package/dist/filesystem/filesystem-service.d.ts +57 -0
- package/dist/filesystem/filesystem-service.d.ts.map +1 -0
- package/dist/filesystem/filesystem-service.js +449 -0
- package/dist/filesystem/index.cjs +37 -0
- package/dist/filesystem/index.d.ts +11 -0
- package/dist/filesystem/index.d.ts.map +1 -0
- package/dist/filesystem/index.js +11 -0
- package/dist/filesystem/path-validator.cjs +172 -0
- package/dist/filesystem/path-validator.d.ts +53 -0
- package/dist/filesystem/path-validator.d.ts.map +1 -0
- package/dist/filesystem/path-validator.js +139 -0
- package/dist/filesystem/types.cjs +16 -0
- package/dist/filesystem/types.d.ts +171 -0
- package/dist/filesystem/types.d.ts.map +1 -0
- package/dist/filesystem/types.js +0 -0
- package/dist/index.browser.js +1 -0
- package/dist/index.cjs +3 -3
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/llm/error-codes.js +1 -0
- package/dist/llm/errors.js +1 -0
- package/dist/llm/formatters/anthropic.js +1 -0
- package/dist/llm/formatters/factory.js +1 -0
- package/dist/llm/formatters/openai.js +1 -0
- package/dist/llm/formatters/vercel.js +1 -0
- package/dist/llm/registry.cjs +15 -15
- package/dist/llm/registry.d.ts +1 -1
- package/dist/llm/registry.js +16 -15
- package/dist/llm/resolver.js +1 -0
- package/dist/llm/schemas.cjs +6 -2
- package/dist/llm/schemas.d.ts +10 -0
- package/dist/llm/schemas.d.ts.map +1 -1
- package/dist/llm/schemas.js +7 -2
- package/dist/llm/services/anthropic.cjs +67 -0
- package/dist/llm/services/anthropic.d.ts +6 -0
- package/dist/llm/services/anthropic.d.ts.map +1 -1
- package/dist/llm/services/anthropic.js +27 -0
- package/dist/llm/services/factory.js +1 -0
- package/dist/llm/services/openai.cjs +87 -0
- package/dist/llm/services/openai.d.ts +6 -0
- package/dist/llm/services/openai.d.ts.map +1 -1
- package/dist/llm/services/openai.js +47 -0
- package/dist/llm/services/test-utils.integration.cjs +1 -1
- package/dist/llm/services/test-utils.integration.js +2 -1
- package/dist/llm/services/vercel.cjs +144 -97
- package/dist/llm/services/vercel.d.ts +6 -1
- package/dist/llm/services/vercel.d.ts.map +1 -1
- package/dist/llm/services/vercel.js +105 -98
- package/dist/llm/tokenizer/anthropic.js +1 -0
- package/dist/llm/tokenizer/default.js +1 -0
- package/dist/llm/tokenizer/factory.js +1 -0
- package/dist/llm/tokenizer/google.js +1 -0
- package/dist/llm/tokenizer/openai.cjs +1 -1
- package/dist/llm/tokenizer/openai.d.ts +1 -1
- package/dist/llm/tokenizer/openai.js +2 -1
- package/dist/llm/tokenizer/types.js +1 -0
- package/dist/llm/types.d.ts +2 -2
- package/dist/llm/types.d.ts.map +1 -1
- package/dist/llm/types.js +1 -0
- package/dist/llm/validation.js +1 -0
- package/dist/logger/browser.js +1 -0
- package/dist/logger/logger.d.ts +42 -0
- package/dist/logger/logger.d.ts.map +1 -1
- package/dist/logger/logger.js +1 -0
- package/dist/mcp/error-codes.cjs +1 -0
- package/dist/mcp/error-codes.d.ts +1 -0
- package/dist/mcp/error-codes.d.ts.map +1 -1
- package/dist/mcp/error-codes.js +2 -0
- package/dist/mcp/errors.cjs +12 -0
- package/dist/mcp/errors.d.ts +7 -0
- package/dist/mcp/errors.d.ts.map +1 -1
- package/dist/mcp/errors.js +13 -0
- package/dist/mcp/manager.cjs +66 -16
- package/dist/mcp/manager.d.ts +7 -0
- package/dist/mcp/manager.d.ts.map +1 -1
- package/dist/mcp/manager.js +67 -16
- package/dist/mcp/mcp-client.js +1 -0
- package/dist/mcp/resolver.js +1 -0
- package/dist/mcp/schemas.js +1 -0
- package/dist/mcp/types.d.ts +1 -1
- package/dist/mcp/types.d.ts.map +1 -1
- package/dist/memory/error-codes.js +1 -0
- package/dist/memory/errors.js +1 -0
- package/dist/memory/index.js +1 -0
- package/dist/memory/manager.js +1 -0
- package/dist/memory/schemas.js +1 -0
- package/dist/plugins/builtins/content-policy.js +1 -0
- package/dist/plugins/builtins/response-sanitizer.js +1 -0
- package/dist/plugins/error-codes.js +1 -0
- package/dist/plugins/index.js +1 -0
- package/dist/plugins/loader.js +1 -0
- package/dist/plugins/manager.js +1 -0
- package/dist/plugins/registrations/builtins.js +1 -0
- package/dist/plugins/schemas.js +1 -0
- package/dist/preferences/constants.js +1 -0
- package/dist/preferences/error-codes.js +1 -0
- package/dist/preferences/errors.js +1 -0
- package/dist/preferences/index.js +1 -0
- package/dist/preferences/loader.cjs +3 -1
- package/dist/preferences/loader.d.ts +10 -1
- package/dist/preferences/loader.d.ts.map +1 -1
- package/dist/preferences/loader.js +4 -1
- package/dist/preferences/schemas.cjs +2 -1
- package/dist/preferences/schemas.d.ts +8 -0
- package/dist/preferences/schemas.d.ts.map +1 -1
- package/dist/preferences/schemas.js +3 -1
- package/dist/process/command-validator.cjs +544 -0
- package/dist/process/command-validator.d.ts +46 -0
- package/dist/process/command-validator.d.ts.map +1 -0
- package/dist/process/command-validator.js +521 -0
- package/dist/process/error-codes.cjs +47 -0
- package/dist/process/error-codes.d.ts +25 -0
- package/dist/process/error-codes.d.ts.map +1 -0
- package/dist/process/error-codes.js +24 -0
- package/dist/process/errors.cjs +244 -0
- package/dist/process/errors.d.ts +87 -0
- package/dist/process/errors.d.ts.map +1 -0
- package/dist/process/errors.js +221 -0
- package/dist/process/index.cjs +37 -0
- package/dist/process/index.d.ts +11 -0
- package/dist/process/index.d.ts.map +1 -0
- package/dist/process/index.js +11 -0
- package/dist/process/process-service.cjs +443 -0
- package/dist/process/process-service.d.ts +62 -0
- package/dist/process/process-service.d.ts.map +1 -0
- package/dist/process/process-service.js +410 -0
- package/dist/process/types.cjs +16 -0
- package/dist/process/types.d.ts +107 -0
- package/dist/process/types.d.ts.map +1 -0
- package/dist/process/types.js +0 -0
- package/dist/prompts/error-codes.js +1 -0
- package/dist/prompts/errors.js +1 -0
- package/dist/prompts/index.js +1 -0
- package/dist/prompts/name-validation.js +1 -0
- package/dist/prompts/prompt-manager.js +1 -0
- package/dist/prompts/providers/custom-prompt-provider.js +1 -0
- package/dist/prompts/providers/file-prompt-provider.js +1 -0
- package/dist/prompts/providers/mcp-prompt-provider.js +1 -0
- package/dist/prompts/providers/starter-prompt-provider.js +1 -0
- package/dist/prompts/schemas.js +1 -0
- package/dist/prompts/utils.js +1 -0
- package/dist/resources/error-codes.js +1 -0
- package/dist/resources/errors.js +1 -0
- package/dist/resources/handlers/blob-handler.js +1 -0
- package/dist/resources/handlers/factory.js +1 -0
- package/dist/resources/handlers/filesystem-handler.cjs +1 -1
- package/dist/resources/handlers/filesystem-handler.d.ts.map +1 -1
- package/dist/resources/handlers/filesystem-handler.js +2 -1
- package/dist/resources/index.js +1 -0
- package/dist/resources/internal-provider.js +1 -0
- package/dist/resources/manager.js +1 -0
- package/dist/resources/reference-parser.js +1 -0
- package/dist/resources/schemas.js +1 -0
- package/dist/search/index.js +1 -0
- package/dist/search/search-service.js +1 -0
- package/dist/session/chat-session.cjs +2 -2
- package/dist/session/chat-session.d.ts +2 -2
- package/dist/session/chat-session.js +3 -2
- package/dist/session/error-codes.js +1 -0
- package/dist/session/errors.js +1 -0
- package/dist/session/history/database.js +1 -0
- package/dist/session/history/factory.js +1 -0
- package/dist/session/history/memory.js +1 -0
- package/dist/session/index.js +1 -0
- package/dist/session/schemas.js +1 -0
- package/dist/session/session-manager.d.ts +6 -0
- package/dist/session/session-manager.d.ts.map +1 -1
- package/dist/session/session-manager.js +1 -0
- package/dist/session/title-generator.js +1 -0
- package/dist/storage/blob/factory.cjs +3 -3
- package/dist/storage/blob/factory.d.ts +3 -1
- package/dist/storage/blob/factory.d.ts.map +1 -1
- package/dist/storage/blob/factory.js +4 -3
- package/dist/storage/blob/local-blob-store.cjs +18 -2
- package/dist/storage/blob/local-blob-store.d.ts +2 -1
- package/dist/storage/blob/local-blob-store.d.ts.map +1 -1
- package/dist/storage/blob/local-blob-store.js +19 -2
- package/dist/storage/blob/schemas.js +1 -0
- package/dist/storage/cache/factory.js +1 -0
- package/dist/storage/cache/memory-cache-store.js +1 -0
- package/dist/storage/cache/redis-store.js +1 -0
- package/dist/storage/cache/schemas.js +1 -0
- package/dist/storage/database/factory.cjs +7 -5
- package/dist/storage/database/factory.d.ts +3 -1
- package/dist/storage/database/factory.d.ts.map +1 -1
- package/dist/storage/database/factory.js +8 -5
- package/dist/storage/database/memory-database-store.js +1 -0
- package/dist/storage/database/postgres-store.js +1 -0
- package/dist/storage/database/schemas.cjs +1 -1
- package/dist/storage/database/schemas.js +2 -1
- package/dist/storage/database/sqlite-store.cjs +20 -2
- package/dist/storage/database/sqlite-store.d.ts +2 -1
- package/dist/storage/database/sqlite-store.d.ts.map +1 -1
- package/dist/storage/database/sqlite-store.js +21 -2
- package/dist/storage/error-codes.cjs +1 -0
- package/dist/storage/error-codes.d.ts +1 -0
- package/dist/storage/error-codes.d.ts.map +1 -1
- package/dist/storage/error-codes.js +2 -0
- package/dist/storage/errors.cjs +15 -0
- package/dist/storage/errors.d.ts +4 -0
- package/dist/storage/errors.d.ts.map +1 -1
- package/dist/storage/errors.js +16 -0
- package/dist/storage/index.js +1 -0
- package/dist/storage/schemas.js +1 -0
- package/dist/storage/storage-manager.cjs +7 -5
- package/dist/storage/storage-manager.d.ts +5 -2
- package/dist/storage/storage-manager.d.ts.map +1 -1
- package/dist/storage/storage-manager.js +8 -5
- package/dist/systemPrompt/contributors.js +1 -0
- package/dist/systemPrompt/error-codes.js +1 -0
- package/dist/systemPrompt/errors.js +1 -0
- package/dist/systemPrompt/in-built-prompts.js +1 -0
- package/dist/systemPrompt/index.js +1 -0
- package/dist/systemPrompt/manager.js +1 -0
- package/dist/systemPrompt/registry.js +1 -0
- package/dist/systemPrompt/schemas.js +1 -0
- package/dist/telemetry/decorators.cjs +175 -0
- package/dist/telemetry/decorators.d.ts +17 -0
- package/dist/telemetry/decorators.d.ts.map +1 -0
- package/dist/telemetry/decorators.js +157 -0
- package/dist/telemetry/exporters.cjs +108 -0
- package/dist/telemetry/exporters.d.ts +29 -0
- package/dist/telemetry/exporters.d.ts.map +1 -0
- package/dist/telemetry/exporters.js +85 -0
- package/dist/telemetry/index.cjs +28 -0
- package/dist/telemetry/index.d.ts +2 -0
- package/dist/telemetry/index.d.ts.map +1 -0
- package/dist/telemetry/index.js +5 -0
- package/dist/telemetry/schemas.cjs +71 -0
- package/dist/telemetry/schemas.d.ts +54 -0
- package/dist/telemetry/schemas.d.ts.map +1 -0
- package/dist/telemetry/schemas.js +48 -0
- package/dist/telemetry/telemetry.cjs +228 -0
- package/dist/telemetry/telemetry.d.ts +74 -0
- package/dist/telemetry/telemetry.d.ts.map +1 -0
- package/dist/telemetry/telemetry.js +205 -0
- package/dist/telemetry/types.cjs +16 -0
- package/dist/telemetry/types.d.ts +22 -0
- package/dist/telemetry/types.d.ts.map +1 -0
- package/dist/telemetry/types.js +0 -0
- package/dist/telemetry/utils.cjs +87 -0
- package/dist/telemetry/utils.d.ts +21 -0
- package/dist/telemetry/utils.d.ts.map +1 -0
- package/dist/telemetry/utils.js +62 -0
- package/dist/tools/confirmation/allowed-tools-provider/factory.js +1 -0
- package/dist/tools/confirmation/allowed-tools-provider/in-memory.js +1 -0
- package/dist/tools/confirmation/allowed-tools-provider/storage.js +1 -0
- package/dist/tools/error-codes.js +1 -0
- package/dist/tools/errors.js +1 -0
- package/dist/tools/index.js +1 -0
- package/dist/tools/internal-tools/constants.cjs +39 -0
- package/dist/tools/internal-tools/constants.d.ts +12 -0
- package/dist/tools/internal-tools/constants.d.ts.map +1 -0
- package/dist/tools/internal-tools/constants.js +16 -0
- package/dist/tools/internal-tools/implementations/ask-user-tool.js +1 -0
- package/dist/tools/internal-tools/implementations/bash-exec-tool.cjs +106 -0
- package/dist/tools/internal-tools/implementations/bash-exec-tool.d.ts +13 -0
- package/dist/tools/internal-tools/implementations/bash-exec-tool.d.ts.map +1 -0
- package/dist/tools/internal-tools/implementations/bash-exec-tool.js +73 -0
- package/dist/tools/internal-tools/implementations/bash-output-tool.cjs +49 -0
- package/dist/tools/internal-tools/implementations/bash-output-tool.d.ts +12 -0
- package/dist/tools/internal-tools/implementations/bash-output-tool.d.ts.map +1 -0
- package/dist/tools/internal-tools/implementations/bash-output-tool.js +26 -0
- package/dist/tools/internal-tools/implementations/edit-file-tool.cjs +62 -0
- package/dist/tools/internal-tools/implementations/edit-file-tool.d.ts +12 -0
- package/dist/tools/internal-tools/implementations/edit-file-tool.d.ts.map +1 -0
- package/dist/tools/internal-tools/implementations/edit-file-tool.js +39 -0
- package/dist/tools/internal-tools/implementations/glob-files-tool.cjs +57 -0
- package/dist/tools/internal-tools/implementations/glob-files-tool.d.ts +12 -0
- package/dist/tools/internal-tools/implementations/glob-files-tool.d.ts.map +1 -0
- package/dist/tools/internal-tools/implementations/glob-files-tool.js +34 -0
- package/dist/tools/internal-tools/implementations/grep-content-tool.cjs +71 -0
- package/dist/tools/internal-tools/implementations/grep-content-tool.d.ts +12 -0
- package/dist/tools/internal-tools/implementations/grep-content-tool.d.ts.map +1 -0
- package/dist/tools/internal-tools/implementations/grep-content-tool.js +48 -0
- package/dist/tools/internal-tools/implementations/kill-process-tool.cjs +47 -0
- package/dist/tools/internal-tools/implementations/kill-process-tool.d.ts +12 -0
- package/dist/tools/internal-tools/implementations/kill-process-tool.d.ts.map +1 -0
- package/dist/tools/internal-tools/implementations/kill-process-tool.js +24 -0
- package/dist/tools/internal-tools/implementations/read-file-tool.cjs +55 -0
- package/dist/tools/internal-tools/implementations/read-file-tool.d.ts +12 -0
- package/dist/tools/internal-tools/implementations/read-file-tool.d.ts.map +1 -0
- package/dist/tools/internal-tools/implementations/read-file-tool.js +32 -0
- package/dist/tools/internal-tools/implementations/search-history-tool.js +1 -0
- package/dist/tools/internal-tools/implementations/write-file-tool.cjs +56 -0
- package/dist/tools/internal-tools/implementations/write-file-tool.d.ts +12 -0
- package/dist/tools/internal-tools/implementations/write-file-tool.d.ts.map +1 -0
- package/dist/tools/internal-tools/implementations/write-file-tool.js +33 -0
- package/dist/tools/internal-tools/index.cjs +3 -1
- package/dist/tools/internal-tools/index.d.ts +1 -0
- package/dist/tools/internal-tools/index.d.ts.map +1 -1
- package/dist/tools/internal-tools/index.js +1 -0
- package/dist/tools/internal-tools/provider.js +1 -0
- package/dist/tools/internal-tools/registry.cjs +40 -4
- package/dist/tools/internal-tools/registry.d.ts +5 -9
- package/dist/tools/internal-tools/registry.d.ts.map +1 -1
- package/dist/tools/internal-tools/registry.js +41 -3
- package/dist/tools/schemas.cjs +18 -5
- package/dist/tools/schemas.d.ts +30 -1
- package/dist/tools/schemas.d.ts.map +1 -1
- package/dist/tools/schemas.js +15 -2
- package/dist/tools/tool-manager.cjs +158 -19
- package/dist/tools/tool-manager.d.ts +48 -2
- package/dist/tools/tool-manager.d.ts.map +1 -1
- package/dist/tools/tool-manager.js +118 -19
- package/dist/utils/api-key-resolver.js +1 -0
- package/dist/utils/api-key-store.js +1 -0
- package/dist/utils/async-context.js +1 -0
- package/dist/utils/debug.js +1 -0
- package/dist/utils/env.js +1 -0
- package/dist/utils/error-conversion.js +1 -0
- package/dist/utils/execution-context.js +1 -0
- package/dist/utils/fs-walk.js +1 -0
- package/dist/utils/path.js +1 -0
- package/dist/utils/port-utils.js +1 -0
- package/dist/utils/redactor.js +1 -0
- package/dist/utils/result.js +1 -0
- package/dist/utils/safe-stringify.js +1 -0
- package/dist/utils/schema-metadata.js +1 -0
- package/dist/utils/schema.js +1 -0
- package/dist/utils/service-initializer.cjs +42 -4
- package/dist/utils/service-initializer.d.ts +2 -1
- package/dist/utils/service-initializer.d.ts.map +1 -1
- package/dist/utils/service-initializer.js +33 -4
- package/dist/utils/user-info.js +1 -0
- package/dist/utils/zod-schema-converter.js +1 -0
- package/package.json +11 -1
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var errors_exports = {};
|
|
20
|
+
__export(errors_exports, {
|
|
21
|
+
ProcessError: () => ProcessError
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(errors_exports);
|
|
24
|
+
var import_errors = require("../errors/index.js");
|
|
25
|
+
var import_types = require("../errors/types.js");
|
|
26
|
+
var import_error_codes = require("./error-codes.js");
|
|
27
|
+
class ProcessError {
|
|
28
|
+
constructor() {
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Invalid command error
|
|
32
|
+
*/
|
|
33
|
+
static invalidCommand(command, reason) {
|
|
34
|
+
return new import_errors.DextoRuntimeError(
|
|
35
|
+
import_error_codes.ProcessErrorCode.INVALID_COMMAND,
|
|
36
|
+
import_types.ErrorScope.PROCESS,
|
|
37
|
+
import_types.ErrorType.USER,
|
|
38
|
+
`Invalid command: ${command}. ${reason}`,
|
|
39
|
+
{ command, reason }
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Command blocked error
|
|
44
|
+
*/
|
|
45
|
+
static commandBlocked(command, reason) {
|
|
46
|
+
return new import_errors.DextoRuntimeError(
|
|
47
|
+
import_error_codes.ProcessErrorCode.COMMAND_BLOCKED,
|
|
48
|
+
import_types.ErrorScope.PROCESS,
|
|
49
|
+
import_types.ErrorType.FORBIDDEN,
|
|
50
|
+
`Command is blocked: ${command}. ${reason}`,
|
|
51
|
+
{ command, reason }
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Command too long error
|
|
56
|
+
*/
|
|
57
|
+
static commandTooLong(length, maxLength) {
|
|
58
|
+
return new import_errors.DextoRuntimeError(
|
|
59
|
+
import_error_codes.ProcessErrorCode.COMMAND_TOO_LONG,
|
|
60
|
+
import_types.ErrorScope.PROCESS,
|
|
61
|
+
import_types.ErrorType.USER,
|
|
62
|
+
`Command too long: ${length} characters. Maximum allowed: ${maxLength}`,
|
|
63
|
+
{ length, maxLength }
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Command injection detected error
|
|
68
|
+
*/
|
|
69
|
+
static commandInjection(command, pattern) {
|
|
70
|
+
return new import_errors.DextoRuntimeError(
|
|
71
|
+
import_error_codes.ProcessErrorCode.INJECTION_DETECTED,
|
|
72
|
+
import_types.ErrorScope.PROCESS,
|
|
73
|
+
import_types.ErrorType.FORBIDDEN,
|
|
74
|
+
`Potential command injection detected in: ${command}. Pattern: ${pattern}`,
|
|
75
|
+
{ command, pattern }
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Command approval required error
|
|
80
|
+
*/
|
|
81
|
+
static approvalRequired(command, reason) {
|
|
82
|
+
return new import_errors.DextoRuntimeError(
|
|
83
|
+
import_error_codes.ProcessErrorCode.APPROVAL_REQUIRED,
|
|
84
|
+
import_types.ErrorScope.PROCESS,
|
|
85
|
+
import_types.ErrorType.FORBIDDEN,
|
|
86
|
+
`Command requires approval: ${command}${reason ? `. ${reason}` : ""}`,
|
|
87
|
+
{ command, reason },
|
|
88
|
+
"Provide an approval function to execute dangerous commands"
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Command approval denied error
|
|
93
|
+
*/
|
|
94
|
+
static approvalDenied(command) {
|
|
95
|
+
return new import_errors.DextoRuntimeError(
|
|
96
|
+
import_error_codes.ProcessErrorCode.APPROVAL_DENIED,
|
|
97
|
+
import_types.ErrorScope.PROCESS,
|
|
98
|
+
import_types.ErrorType.FORBIDDEN,
|
|
99
|
+
`Command approval denied by user: ${command}`,
|
|
100
|
+
{ command }
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Command execution failed error
|
|
105
|
+
*/
|
|
106
|
+
static executionFailed(command, cause) {
|
|
107
|
+
return new import_errors.DextoRuntimeError(
|
|
108
|
+
import_error_codes.ProcessErrorCode.EXECUTION_FAILED,
|
|
109
|
+
import_types.ErrorScope.PROCESS,
|
|
110
|
+
import_types.ErrorType.SYSTEM,
|
|
111
|
+
`Command execution failed: ${command}. ${cause}`,
|
|
112
|
+
{ command, cause }
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Command timeout error
|
|
117
|
+
*/
|
|
118
|
+
static timeout(command, timeout) {
|
|
119
|
+
return new import_errors.DextoRuntimeError(
|
|
120
|
+
import_error_codes.ProcessErrorCode.TIMEOUT,
|
|
121
|
+
import_types.ErrorScope.PROCESS,
|
|
122
|
+
import_types.ErrorType.TIMEOUT,
|
|
123
|
+
`Command timed out after ${timeout}ms: ${command}`,
|
|
124
|
+
{ command, timeout },
|
|
125
|
+
"Increase timeout or optimize the command"
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Permission denied error
|
|
130
|
+
*/
|
|
131
|
+
static permissionDenied(command) {
|
|
132
|
+
return new import_errors.DextoRuntimeError(
|
|
133
|
+
import_error_codes.ProcessErrorCode.PERMISSION_DENIED,
|
|
134
|
+
import_types.ErrorScope.PROCESS,
|
|
135
|
+
import_types.ErrorType.FORBIDDEN,
|
|
136
|
+
`Permission denied: ${command}`,
|
|
137
|
+
{ command }
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Command not found error
|
|
142
|
+
*/
|
|
143
|
+
static commandNotFound(command) {
|
|
144
|
+
return new import_errors.DextoRuntimeError(
|
|
145
|
+
import_error_codes.ProcessErrorCode.COMMAND_NOT_FOUND,
|
|
146
|
+
import_types.ErrorScope.PROCESS,
|
|
147
|
+
import_types.ErrorType.NOT_FOUND,
|
|
148
|
+
`Command not found: ${command}`,
|
|
149
|
+
{ command },
|
|
150
|
+
"Ensure the command is installed and available in PATH"
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Invalid working directory error
|
|
155
|
+
*/
|
|
156
|
+
static invalidWorkingDirectory(path, reason) {
|
|
157
|
+
return new import_errors.DextoRuntimeError(
|
|
158
|
+
import_error_codes.ProcessErrorCode.WORKING_DIRECTORY_INVALID,
|
|
159
|
+
import_types.ErrorScope.PROCESS,
|
|
160
|
+
import_types.ErrorType.USER,
|
|
161
|
+
`Invalid working directory: ${path}. ${reason}`,
|
|
162
|
+
{ path, reason }
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Process not found error
|
|
167
|
+
*/
|
|
168
|
+
static processNotFound(processId) {
|
|
169
|
+
return new import_errors.DextoRuntimeError(
|
|
170
|
+
import_error_codes.ProcessErrorCode.PROCESS_NOT_FOUND,
|
|
171
|
+
import_types.ErrorScope.PROCESS,
|
|
172
|
+
import_types.ErrorType.NOT_FOUND,
|
|
173
|
+
`Process not found: ${processId}`,
|
|
174
|
+
{ processId }
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Too many concurrent processes error
|
|
179
|
+
*/
|
|
180
|
+
static tooManyProcesses(current, max) {
|
|
181
|
+
return new import_errors.DextoRuntimeError(
|
|
182
|
+
import_error_codes.ProcessErrorCode.TOO_MANY_PROCESSES,
|
|
183
|
+
import_types.ErrorScope.PROCESS,
|
|
184
|
+
import_types.ErrorType.USER,
|
|
185
|
+
`Too many concurrent processes: ${current}. Maximum allowed: ${max}`,
|
|
186
|
+
{ current, max },
|
|
187
|
+
"Wait for running processes to complete or increase the limit"
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Kill process failed error
|
|
192
|
+
*/
|
|
193
|
+
static killFailed(processId, cause) {
|
|
194
|
+
return new import_errors.DextoRuntimeError(
|
|
195
|
+
import_error_codes.ProcessErrorCode.KILL_FAILED,
|
|
196
|
+
import_types.ErrorScope.PROCESS,
|
|
197
|
+
import_types.ErrorType.SYSTEM,
|
|
198
|
+
`Failed to kill process ${processId}: ${cause}`,
|
|
199
|
+
{ processId, cause }
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Output buffer full error
|
|
204
|
+
*/
|
|
205
|
+
static outputBufferFull(processId, size, maxSize) {
|
|
206
|
+
return new import_errors.DextoRuntimeError(
|
|
207
|
+
import_error_codes.ProcessErrorCode.OUTPUT_BUFFER_FULL,
|
|
208
|
+
import_types.ErrorScope.PROCESS,
|
|
209
|
+
import_types.ErrorType.SYSTEM,
|
|
210
|
+
`Output buffer full for process ${processId}: ${size} bytes. Maximum: ${maxSize}`,
|
|
211
|
+
{ processId, size, maxSize },
|
|
212
|
+
"Process output exceeded buffer limit"
|
|
213
|
+
);
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Invalid configuration error
|
|
217
|
+
*/
|
|
218
|
+
static invalidConfig(reason) {
|
|
219
|
+
return new import_errors.DextoRuntimeError(
|
|
220
|
+
import_error_codes.ProcessErrorCode.INVALID_CONFIG,
|
|
221
|
+
import_types.ErrorScope.PROCESS,
|
|
222
|
+
import_types.ErrorType.USER,
|
|
223
|
+
`Invalid Process configuration: ${reason}`,
|
|
224
|
+
{ reason }
|
|
225
|
+
);
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Service not initialized error
|
|
229
|
+
*/
|
|
230
|
+
static notInitialized() {
|
|
231
|
+
return new import_errors.DextoRuntimeError(
|
|
232
|
+
import_error_codes.ProcessErrorCode.SERVICE_NOT_INITIALIZED,
|
|
233
|
+
import_types.ErrorScope.PROCESS,
|
|
234
|
+
import_types.ErrorType.SYSTEM,
|
|
235
|
+
"ProcessService has not been initialized",
|
|
236
|
+
{},
|
|
237
|
+
"Initialize the ProcessService before using it"
|
|
238
|
+
);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
242
|
+
0 && (module.exports = {
|
|
243
|
+
ProcessError
|
|
244
|
+
});
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Process Service Errors
|
|
3
|
+
*
|
|
4
|
+
* Error classes for process execution and management
|
|
5
|
+
*/
|
|
6
|
+
import { DextoRuntimeError } from '../errors/index.js';
|
|
7
|
+
export interface ProcessErrorContext {
|
|
8
|
+
command?: string;
|
|
9
|
+
processId?: string;
|
|
10
|
+
timeout?: number;
|
|
11
|
+
[key: string]: unknown;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Factory class for creating Process-related errors
|
|
15
|
+
*/
|
|
16
|
+
export declare class ProcessError {
|
|
17
|
+
private constructor();
|
|
18
|
+
/**
|
|
19
|
+
* Invalid command error
|
|
20
|
+
*/
|
|
21
|
+
static invalidCommand(command: string, reason: string): DextoRuntimeError;
|
|
22
|
+
/**
|
|
23
|
+
* Command blocked error
|
|
24
|
+
*/
|
|
25
|
+
static commandBlocked(command: string, reason: string): DextoRuntimeError;
|
|
26
|
+
/**
|
|
27
|
+
* Command too long error
|
|
28
|
+
*/
|
|
29
|
+
static commandTooLong(length: number, maxLength: number): DextoRuntimeError;
|
|
30
|
+
/**
|
|
31
|
+
* Command injection detected error
|
|
32
|
+
*/
|
|
33
|
+
static commandInjection(command: string, pattern: string): DextoRuntimeError;
|
|
34
|
+
/**
|
|
35
|
+
* Command approval required error
|
|
36
|
+
*/
|
|
37
|
+
static approvalRequired(command: string, reason?: string): DextoRuntimeError;
|
|
38
|
+
/**
|
|
39
|
+
* Command approval denied error
|
|
40
|
+
*/
|
|
41
|
+
static approvalDenied(command: string): DextoRuntimeError;
|
|
42
|
+
/**
|
|
43
|
+
* Command execution failed error
|
|
44
|
+
*/
|
|
45
|
+
static executionFailed(command: string, cause: string): DextoRuntimeError;
|
|
46
|
+
/**
|
|
47
|
+
* Command timeout error
|
|
48
|
+
*/
|
|
49
|
+
static timeout(command: string, timeout: number): DextoRuntimeError;
|
|
50
|
+
/**
|
|
51
|
+
* Permission denied error
|
|
52
|
+
*/
|
|
53
|
+
static permissionDenied(command: string): DextoRuntimeError;
|
|
54
|
+
/**
|
|
55
|
+
* Command not found error
|
|
56
|
+
*/
|
|
57
|
+
static commandNotFound(command: string): DextoRuntimeError;
|
|
58
|
+
/**
|
|
59
|
+
* Invalid working directory error
|
|
60
|
+
*/
|
|
61
|
+
static invalidWorkingDirectory(path: string, reason: string): DextoRuntimeError;
|
|
62
|
+
/**
|
|
63
|
+
* Process not found error
|
|
64
|
+
*/
|
|
65
|
+
static processNotFound(processId: string): DextoRuntimeError;
|
|
66
|
+
/**
|
|
67
|
+
* Too many concurrent processes error
|
|
68
|
+
*/
|
|
69
|
+
static tooManyProcesses(current: number, max: number): DextoRuntimeError;
|
|
70
|
+
/**
|
|
71
|
+
* Kill process failed error
|
|
72
|
+
*/
|
|
73
|
+
static killFailed(processId: string, cause: string): DextoRuntimeError;
|
|
74
|
+
/**
|
|
75
|
+
* Output buffer full error
|
|
76
|
+
*/
|
|
77
|
+
static outputBufferFull(processId: string, size: number, maxSize: number): DextoRuntimeError;
|
|
78
|
+
/**
|
|
79
|
+
* Invalid configuration error
|
|
80
|
+
*/
|
|
81
|
+
static invalidConfig(reason: string): DextoRuntimeError;
|
|
82
|
+
/**
|
|
83
|
+
* Service not initialized error
|
|
84
|
+
*/
|
|
85
|
+
static notInitialized(): DextoRuntimeError;
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/process/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAIvD,MAAM,WAAW,mBAAmB;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B;AAED;;GAEG;AACH,qBAAa,YAAY;IACrB,OAAO;IAIP;;OAEG;IACH,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,iBAAiB;IAUzE;;OAEG;IACH,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,iBAAiB;IAUzE;;OAEG;IACH,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,iBAAiB;IAU3E;;OAEG;IACH,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,iBAAiB;IAU5E;;OAEG;IACH,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,iBAAiB;IAW5E;;OAEG;IACH,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,iBAAiB;IAUzD;;OAEG;IACH,MAAM,CAAC,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,iBAAiB;IAUzE;;OAEG;IACH,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,iBAAiB;IAWnE;;OAEG;IACH,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,iBAAiB;IAU3D;;OAEG;IACH,MAAM,CAAC,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,iBAAiB;IAW1D;;OAEG;IACH,MAAM,CAAC,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,iBAAiB;IAU/E;;OAEG;IACH,MAAM,CAAC,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,iBAAiB;IAU5D;;OAEG;IACH,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,iBAAiB;IAWxE;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,iBAAiB;IAUtE;;OAEG;IACH,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,iBAAiB;IAW5F;;OAEG;IACH,MAAM,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,iBAAiB;IAUvD;;OAEG;IACH,MAAM,CAAC,cAAc,IAAI,iBAAiB;CAU7C"}
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import "../chunk-C6A6W6XS.js";
|
|
2
|
+
import { DextoRuntimeError } from "../errors/index.js";
|
|
3
|
+
import { ErrorScope, ErrorType } from "../errors/types.js";
|
|
4
|
+
import { ProcessErrorCode } from "./error-codes.js";
|
|
5
|
+
class ProcessError {
|
|
6
|
+
constructor() {
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Invalid command error
|
|
10
|
+
*/
|
|
11
|
+
static invalidCommand(command, reason) {
|
|
12
|
+
return new DextoRuntimeError(
|
|
13
|
+
ProcessErrorCode.INVALID_COMMAND,
|
|
14
|
+
ErrorScope.PROCESS,
|
|
15
|
+
ErrorType.USER,
|
|
16
|
+
`Invalid command: ${command}. ${reason}`,
|
|
17
|
+
{ command, reason }
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Command blocked error
|
|
22
|
+
*/
|
|
23
|
+
static commandBlocked(command, reason) {
|
|
24
|
+
return new DextoRuntimeError(
|
|
25
|
+
ProcessErrorCode.COMMAND_BLOCKED,
|
|
26
|
+
ErrorScope.PROCESS,
|
|
27
|
+
ErrorType.FORBIDDEN,
|
|
28
|
+
`Command is blocked: ${command}. ${reason}`,
|
|
29
|
+
{ command, reason }
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Command too long error
|
|
34
|
+
*/
|
|
35
|
+
static commandTooLong(length, maxLength) {
|
|
36
|
+
return new DextoRuntimeError(
|
|
37
|
+
ProcessErrorCode.COMMAND_TOO_LONG,
|
|
38
|
+
ErrorScope.PROCESS,
|
|
39
|
+
ErrorType.USER,
|
|
40
|
+
`Command too long: ${length} characters. Maximum allowed: ${maxLength}`,
|
|
41
|
+
{ length, maxLength }
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Command injection detected error
|
|
46
|
+
*/
|
|
47
|
+
static commandInjection(command, pattern) {
|
|
48
|
+
return new DextoRuntimeError(
|
|
49
|
+
ProcessErrorCode.INJECTION_DETECTED,
|
|
50
|
+
ErrorScope.PROCESS,
|
|
51
|
+
ErrorType.FORBIDDEN,
|
|
52
|
+
`Potential command injection detected in: ${command}. Pattern: ${pattern}`,
|
|
53
|
+
{ command, pattern }
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Command approval required error
|
|
58
|
+
*/
|
|
59
|
+
static approvalRequired(command, reason) {
|
|
60
|
+
return new DextoRuntimeError(
|
|
61
|
+
ProcessErrorCode.APPROVAL_REQUIRED,
|
|
62
|
+
ErrorScope.PROCESS,
|
|
63
|
+
ErrorType.FORBIDDEN,
|
|
64
|
+
`Command requires approval: ${command}${reason ? `. ${reason}` : ""}`,
|
|
65
|
+
{ command, reason },
|
|
66
|
+
"Provide an approval function to execute dangerous commands"
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Command approval denied error
|
|
71
|
+
*/
|
|
72
|
+
static approvalDenied(command) {
|
|
73
|
+
return new DextoRuntimeError(
|
|
74
|
+
ProcessErrorCode.APPROVAL_DENIED,
|
|
75
|
+
ErrorScope.PROCESS,
|
|
76
|
+
ErrorType.FORBIDDEN,
|
|
77
|
+
`Command approval denied by user: ${command}`,
|
|
78
|
+
{ command }
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Command execution failed error
|
|
83
|
+
*/
|
|
84
|
+
static executionFailed(command, cause) {
|
|
85
|
+
return new DextoRuntimeError(
|
|
86
|
+
ProcessErrorCode.EXECUTION_FAILED,
|
|
87
|
+
ErrorScope.PROCESS,
|
|
88
|
+
ErrorType.SYSTEM,
|
|
89
|
+
`Command execution failed: ${command}. ${cause}`,
|
|
90
|
+
{ command, cause }
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Command timeout error
|
|
95
|
+
*/
|
|
96
|
+
static timeout(command, timeout) {
|
|
97
|
+
return new DextoRuntimeError(
|
|
98
|
+
ProcessErrorCode.TIMEOUT,
|
|
99
|
+
ErrorScope.PROCESS,
|
|
100
|
+
ErrorType.TIMEOUT,
|
|
101
|
+
`Command timed out after ${timeout}ms: ${command}`,
|
|
102
|
+
{ command, timeout },
|
|
103
|
+
"Increase timeout or optimize the command"
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Permission denied error
|
|
108
|
+
*/
|
|
109
|
+
static permissionDenied(command) {
|
|
110
|
+
return new DextoRuntimeError(
|
|
111
|
+
ProcessErrorCode.PERMISSION_DENIED,
|
|
112
|
+
ErrorScope.PROCESS,
|
|
113
|
+
ErrorType.FORBIDDEN,
|
|
114
|
+
`Permission denied: ${command}`,
|
|
115
|
+
{ command }
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Command not found error
|
|
120
|
+
*/
|
|
121
|
+
static commandNotFound(command) {
|
|
122
|
+
return new DextoRuntimeError(
|
|
123
|
+
ProcessErrorCode.COMMAND_NOT_FOUND,
|
|
124
|
+
ErrorScope.PROCESS,
|
|
125
|
+
ErrorType.NOT_FOUND,
|
|
126
|
+
`Command not found: ${command}`,
|
|
127
|
+
{ command },
|
|
128
|
+
"Ensure the command is installed and available in PATH"
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Invalid working directory error
|
|
133
|
+
*/
|
|
134
|
+
static invalidWorkingDirectory(path, reason) {
|
|
135
|
+
return new DextoRuntimeError(
|
|
136
|
+
ProcessErrorCode.WORKING_DIRECTORY_INVALID,
|
|
137
|
+
ErrorScope.PROCESS,
|
|
138
|
+
ErrorType.USER,
|
|
139
|
+
`Invalid working directory: ${path}. ${reason}`,
|
|
140
|
+
{ path, reason }
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Process not found error
|
|
145
|
+
*/
|
|
146
|
+
static processNotFound(processId) {
|
|
147
|
+
return new DextoRuntimeError(
|
|
148
|
+
ProcessErrorCode.PROCESS_NOT_FOUND,
|
|
149
|
+
ErrorScope.PROCESS,
|
|
150
|
+
ErrorType.NOT_FOUND,
|
|
151
|
+
`Process not found: ${processId}`,
|
|
152
|
+
{ processId }
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Too many concurrent processes error
|
|
157
|
+
*/
|
|
158
|
+
static tooManyProcesses(current, max) {
|
|
159
|
+
return new DextoRuntimeError(
|
|
160
|
+
ProcessErrorCode.TOO_MANY_PROCESSES,
|
|
161
|
+
ErrorScope.PROCESS,
|
|
162
|
+
ErrorType.USER,
|
|
163
|
+
`Too many concurrent processes: ${current}. Maximum allowed: ${max}`,
|
|
164
|
+
{ current, max },
|
|
165
|
+
"Wait for running processes to complete or increase the limit"
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Kill process failed error
|
|
170
|
+
*/
|
|
171
|
+
static killFailed(processId, cause) {
|
|
172
|
+
return new DextoRuntimeError(
|
|
173
|
+
ProcessErrorCode.KILL_FAILED,
|
|
174
|
+
ErrorScope.PROCESS,
|
|
175
|
+
ErrorType.SYSTEM,
|
|
176
|
+
`Failed to kill process ${processId}: ${cause}`,
|
|
177
|
+
{ processId, cause }
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Output buffer full error
|
|
182
|
+
*/
|
|
183
|
+
static outputBufferFull(processId, size, maxSize) {
|
|
184
|
+
return new DextoRuntimeError(
|
|
185
|
+
ProcessErrorCode.OUTPUT_BUFFER_FULL,
|
|
186
|
+
ErrorScope.PROCESS,
|
|
187
|
+
ErrorType.SYSTEM,
|
|
188
|
+
`Output buffer full for process ${processId}: ${size} bytes. Maximum: ${maxSize}`,
|
|
189
|
+
{ processId, size, maxSize },
|
|
190
|
+
"Process output exceeded buffer limit"
|
|
191
|
+
);
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Invalid configuration error
|
|
195
|
+
*/
|
|
196
|
+
static invalidConfig(reason) {
|
|
197
|
+
return new DextoRuntimeError(
|
|
198
|
+
ProcessErrorCode.INVALID_CONFIG,
|
|
199
|
+
ErrorScope.PROCESS,
|
|
200
|
+
ErrorType.USER,
|
|
201
|
+
`Invalid Process configuration: ${reason}`,
|
|
202
|
+
{ reason }
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Service not initialized error
|
|
207
|
+
*/
|
|
208
|
+
static notInitialized() {
|
|
209
|
+
return new DextoRuntimeError(
|
|
210
|
+
ProcessErrorCode.SERVICE_NOT_INITIALIZED,
|
|
211
|
+
ErrorScope.PROCESS,
|
|
212
|
+
ErrorType.SYSTEM,
|
|
213
|
+
"ProcessService has not been initialized",
|
|
214
|
+
{},
|
|
215
|
+
"Initialize the ProcessService before using it"
|
|
216
|
+
);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
export {
|
|
220
|
+
ProcessError
|
|
221
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var process_exports = {};
|
|
20
|
+
__export(process_exports, {
|
|
21
|
+
CommandValidator: () => import_command_validator.CommandValidator,
|
|
22
|
+
ProcessError: () => import_errors.ProcessError,
|
|
23
|
+
ProcessErrorCode: () => import_error_codes.ProcessErrorCode,
|
|
24
|
+
ProcessService: () => import_process_service.ProcessService
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(process_exports);
|
|
27
|
+
var import_process_service = require("./process-service.js");
|
|
28
|
+
var import_command_validator = require("./command-validator.js");
|
|
29
|
+
var import_errors = require("./errors.js");
|
|
30
|
+
var import_error_codes = require("./error-codes.js");
|
|
31
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
32
|
+
0 && (module.exports = {
|
|
33
|
+
CommandValidator,
|
|
34
|
+
ProcessError,
|
|
35
|
+
ProcessErrorCode,
|
|
36
|
+
ProcessService
|
|
37
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Process Module
|
|
3
|
+
*
|
|
4
|
+
* Exports process service, types, errors, and utilities
|
|
5
|
+
*/
|
|
6
|
+
export { ProcessService } from './process-service.js';
|
|
7
|
+
export { CommandValidator } from './command-validator.js';
|
|
8
|
+
export { ProcessError } from './errors.js';
|
|
9
|
+
export { ProcessErrorCode } from './error-codes.js';
|
|
10
|
+
export type { ProcessConfig, ExecuteOptions, ProcessResult, ProcessHandle, ProcessOutput, ProcessInfo, CommandValidation, OutputBuffer, } from './types.js';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/process/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,YAAY,EACR,aAAa,EACb,cAAc,EACd,aAAa,EACb,aAAa,EACb,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,YAAY,GACf,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import "../chunk-C6A6W6XS.js";
|
|
2
|
+
import { ProcessService } from "./process-service.js";
|
|
3
|
+
import { CommandValidator } from "./command-validator.js";
|
|
4
|
+
import { ProcessError } from "./errors.js";
|
|
5
|
+
import { ProcessErrorCode } from "./error-codes.js";
|
|
6
|
+
export {
|
|
7
|
+
CommandValidator,
|
|
8
|
+
ProcessError,
|
|
9
|
+
ProcessErrorCode,
|
|
10
|
+
ProcessService
|
|
11
|
+
};
|