@dexto/core 1.5.7 → 1.6.0
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 +19 -8
- package/dist/agent/DextoAgent.cjs +383 -153
- package/dist/agent/DextoAgent.d.ts +112 -60
- package/dist/agent/DextoAgent.d.ts.map +1 -1
- package/dist/agent/DextoAgent.js +380 -150
- package/dist/{context/compaction/provider.cjs → agent/agent-options.cjs} +2 -2
- package/dist/agent/agent-options.d.ts +53 -0
- package/dist/agent/agent-options.d.ts.map +1 -0
- package/dist/agent/agentCard.cjs +1 -1
- package/dist/agent/errors.cjs +2 -2
- package/dist/agent/errors.d.ts.map +1 -1
- package/dist/agent/index.cjs +1 -6
- package/dist/agent/index.d.ts +3 -2
- package/dist/agent/index.d.ts.map +1 -1
- package/dist/agent/index.js +1 -7
- package/dist/{storage/blob/provider.cjs → agent/runtime-config.cjs} +2 -2
- package/dist/agent/runtime-config.d.ts +53 -0
- package/dist/agent/runtime-config.d.ts.map +1 -0
- package/dist/agent/schemas.cjs +2 -99
- package/dist/agent/schemas.d.ts +10 -9160
- package/dist/agent/schemas.d.ts.map +1 -1
- package/dist/agent/schemas.js +1 -104
- package/dist/agent/state-manager.d.ts +5 -5
- package/dist/agent/state-manager.d.ts.map +1 -1
- package/dist/approval/error-codes.cjs +1 -1
- package/dist/approval/error-codes.d.ts +1 -1
- package/dist/approval/error-codes.d.ts.map +1 -1
- package/dist/approval/error-codes.js +1 -1
- package/dist/approval/errors.cjs +5 -5
- package/dist/approval/errors.d.ts +2 -2
- package/dist/approval/errors.d.ts.map +1 -1
- package/dist/approval/errors.js +5 -5
- package/dist/approval/index.cjs +8 -8
- package/dist/approval/index.d.ts +2 -2
- package/dist/approval/index.d.ts.map +1 -1
- package/dist/approval/index.js +8 -8
- package/dist/approval/manager.cjs +77 -57
- package/dist/approval/manager.d.ts +41 -43
- package/dist/approval/manager.d.ts.map +1 -1
- package/dist/approval/manager.js +75 -55
- package/dist/approval/schemas.cjs +26 -25
- package/dist/approval/schemas.d.ts +35 -15
- package/dist/approval/schemas.d.ts.map +1 -1
- package/dist/approval/schemas.js +22 -21
- package/dist/approval/types.cjs +1 -1
- package/dist/approval/types.d.ts +14 -14
- package/dist/approval/types.d.ts.map +1 -1
- package/dist/approval/types.js +1 -1
- package/dist/context/compaction/index.cjs +2 -23
- package/dist/context/compaction/index.d.ts +1 -7
- package/dist/context/compaction/index.d.ts.map +1 -1
- package/dist/context/compaction/index.js +1 -16
- package/dist/context/compaction/strategies/noop.cjs +19 -1
- package/dist/context/compaction/strategies/noop.d.ts +13 -3
- package/dist/context/compaction/strategies/noop.d.ts.map +1 -1
- package/dist/context/compaction/strategies/noop.js +19 -1
- package/dist/context/compaction/strategies/{reactive-overflow.cjs → reactive-overflow-compaction.cjs} +67 -64
- package/dist/context/compaction/strategies/{reactive-overflow.d.ts → reactive-overflow-compaction.d.ts} +19 -36
- package/dist/context/compaction/strategies/reactive-overflow-compaction.d.ts.map +1 -0
- package/dist/context/compaction/strategies/{reactive-overflow.js → reactive-overflow-compaction.js} +63 -60
- package/dist/context/compaction/types.d.ts +40 -8
- package/dist/context/compaction/types.d.ts.map +1 -1
- package/dist/context/manager.cjs +5 -3
- package/dist/context/manager.d.ts +4 -3
- package/dist/context/manager.d.ts.map +1 -1
- package/dist/context/manager.js +5 -3
- package/dist/context/types.d.ts +2 -0
- package/dist/context/types.d.ts.map +1 -1
- package/dist/context/utils.cjs +70 -43
- package/dist/context/utils.d.ts +14 -14
- package/dist/context/utils.d.ts.map +1 -1
- package/dist/context/utils.js +69 -42
- package/dist/errors/result-bridge.d.ts +2 -2
- package/dist/errors/result-bridge.d.ts.map +1 -1
- package/dist/errors/types.cjs +1 -1
- package/dist/errors/types.d.ts +3 -3
- package/dist/errors/types.d.ts.map +1 -1
- package/dist/errors/types.js +1 -1
- package/dist/events/index.cjs +15 -2
- package/dist/events/index.d.ts +78 -7
- package/dist/events/index.d.ts.map +1 -1
- package/dist/events/index.js +15 -2
- package/dist/{plugins → hooks}/builtins/content-policy.cjs +7 -6
- package/dist/hooks/builtins/content-policy.d.ts +24 -0
- package/dist/hooks/builtins/content-policy.d.ts.map +1 -0
- package/dist/{plugins → hooks}/builtins/content-policy.js +6 -5
- package/dist/{plugins → hooks}/builtins/response-sanitizer.cjs +3 -3
- package/dist/hooks/builtins/response-sanitizer.d.ts +22 -0
- package/dist/hooks/builtins/response-sanitizer.d.ts.map +1 -0
- package/dist/{plugins → hooks}/builtins/response-sanitizer.js +2 -2
- package/dist/hooks/error-codes.cjs +43 -0
- package/dist/hooks/error-codes.d.ts +34 -0
- package/dist/hooks/error-codes.d.ts.map +1 -0
- package/dist/hooks/error-codes.js +20 -0
- package/dist/{storage/cache/providers/memory.cjs → hooks/index.cjs} +15 -18
- package/dist/hooks/index.d.ts +14 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +11 -0
- package/dist/hooks/manager.cjs +354 -0
- package/dist/hooks/manager.d.ts +103 -0
- package/dist/hooks/manager.d.ts.map +1 -0
- package/dist/hooks/manager.js +331 -0
- package/dist/{plugins → hooks}/types.d.ts +36 -34
- package/dist/hooks/types.d.ts.map +1 -0
- package/dist/index.browser.cjs +13 -12
- package/dist/index.browser.d.ts +6 -6
- package/dist/index.browser.d.ts.map +1 -1
- package/dist/index.browser.js +8 -7
- package/dist/index.cjs +5 -7
- package/dist/index.d.ts +2 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -3
- package/dist/llm/curation-config.cjs +82 -0
- package/dist/llm/curation-config.d.ts +13 -0
- package/dist/llm/curation-config.d.ts.map +1 -0
- package/dist/llm/curation-config.js +59 -0
- package/dist/llm/curation.cjs +57 -0
- package/dist/llm/curation.d.ts +16 -0
- package/dist/llm/curation.d.ts.map +1 -0
- package/dist/llm/curation.js +34 -0
- package/dist/llm/errors.cjs +2 -2
- package/dist/llm/errors.d.ts +8 -8
- package/dist/llm/errors.js +1 -1
- package/dist/llm/executor/provider-options.cjs +1 -1
- package/dist/llm/executor/provider-options.js +1 -1
- package/dist/llm/executor/stream-processor.cjs +131 -11
- package/dist/llm/executor/stream-processor.d.ts +7 -5
- package/dist/llm/executor/stream-processor.d.ts.map +1 -1
- package/dist/llm/executor/stream-processor.js +131 -11
- package/dist/llm/executor/turn-executor.cjs +57 -56
- package/dist/llm/executor/turn-executor.d.ts +7 -8
- package/dist/llm/executor/turn-executor.d.ts.map +1 -1
- package/dist/llm/executor/turn-executor.js +57 -56
- package/dist/llm/formatters/vercel.cjs +2 -2
- package/dist/llm/formatters/vercel.d.ts +2 -2
- package/dist/llm/formatters/vercel.d.ts.map +1 -1
- package/dist/llm/index.cjs +14 -3
- package/dist/llm/index.d.ts +3 -1
- package/dist/llm/index.d.ts.map +1 -1
- package/dist/llm/index.js +13 -2
- package/dist/llm/providers/local/schemas.d.ts +10 -10
- package/dist/llm/registry/auto-update.cjs +263 -0
- package/dist/llm/registry/auto-update.d.ts +27 -0
- package/dist/llm/registry/auto-update.d.ts.map +1 -0
- package/dist/llm/registry/auto-update.js +227 -0
- package/dist/llm/registry/index.cjs +806 -0
- package/dist/llm/{registry.d.ts → registry/index.d.ts} +21 -43
- package/dist/llm/registry/index.d.ts.map +1 -0
- package/dist/llm/registry/index.js +756 -0
- package/dist/llm/registry/models.generated.cjs +4861 -0
- package/dist/llm/registry/models.generated.d.ts +431 -0
- package/dist/llm/registry/models.generated.d.ts.map +1 -0
- package/dist/llm/registry/models.generated.js +4838 -0
- package/dist/{storage/database/providers/index.cjs → llm/registry/models.manual.cjs} +22 -12
- package/dist/llm/registry/models.manual.d.ts +22 -0
- package/dist/llm/registry/models.manual.d.ts.map +1 -0
- package/dist/llm/registry/models.manual.js +21 -0
- package/dist/llm/registry/sync.cjs +354 -0
- package/dist/llm/registry/sync.d.ts +41 -0
- package/dist/llm/registry/sync.d.ts.map +1 -0
- package/dist/llm/registry/sync.js +328 -0
- package/dist/llm/resolver.cjs +29 -20
- package/dist/llm/resolver.d.ts +4 -4
- package/dist/llm/resolver.d.ts.map +1 -1
- package/dist/llm/resolver.js +28 -20
- package/dist/llm/schemas.cjs +69 -94
- package/dist/llm/schemas.d.ts +19 -158
- package/dist/llm/schemas.d.ts.map +1 -1
- package/dist/llm/schemas.js +67 -91
- package/dist/llm/services/factory.cjs +6 -7
- package/dist/llm/services/factory.d.ts +3 -4
- package/dist/llm/services/factory.d.ts.map +1 -1
- package/dist/llm/services/factory.js +6 -7
- package/dist/llm/services/vercel.cjs +11 -15
- package/dist/llm/services/vercel.d.ts +7 -7
- package/dist/llm/services/vercel.d.ts.map +1 -1
- package/dist/llm/services/vercel.js +11 -15
- package/dist/llm/types.cjs +1 -1
- package/dist/llm/types.d.ts +1 -1
- package/dist/llm/types.d.ts.map +1 -1
- package/dist/llm/types.js +1 -1
- package/dist/llm/validation.cjs +2 -2
- package/dist/llm/validation.d.ts +2 -2
- package/dist/llm/validation.d.ts.map +1 -1
- package/dist/llm/validation.js +1 -1
- package/dist/logger/browser.cjs +4 -4
- package/dist/logger/browser.d.ts +4 -4
- package/dist/logger/browser.d.ts.map +1 -1
- package/dist/logger/browser.js +3 -3
- package/dist/{context/compaction/providers/noop-provider.cjs → logger/default-logger-factory.cjs} +16 -22
- package/dist/logger/default-logger-factory.d.ts +301 -0
- package/dist/logger/default-logger-factory.d.ts.map +1 -0
- package/dist/logger/default-logger-factory.js +18 -0
- package/dist/logger/factory.d.ts +2 -2
- package/dist/logger/factory.d.ts.map +1 -1
- package/dist/logger/index.cjs +7 -2
- package/dist/logger/index.d.ts +5 -3
- package/dist/logger/index.d.ts.map +1 -1
- package/dist/logger/index.js +8 -2
- package/dist/logger/logger.cjs +4 -4
- package/dist/logger/logger.d.ts +4 -4
- package/dist/logger/logger.d.ts.map +1 -1
- package/dist/logger/logger.js +3 -3
- package/dist/logger/v2/dexto-logger.d.ts +3 -3
- package/dist/logger/v2/dexto-logger.d.ts.map +1 -1
- package/dist/logger/v2/schemas.d.ts +12 -12
- package/dist/logger/v2/test-utils.d.ts +5 -5
- package/dist/logger/v2/test-utils.d.ts.map +1 -1
- package/dist/logger/v2/transport-factory.d.ts +3 -3
- package/dist/logger/v2/transport-factory.d.ts.map +1 -1
- package/dist/logger/v2/transports/console-transport.d.ts +2 -2
- package/dist/logger/v2/transports/console-transport.d.ts.map +1 -1
- package/dist/logger/v2/transports/file-transport.d.ts +2 -2
- package/dist/logger/v2/transports/file-transport.d.ts.map +1 -1
- package/dist/logger/v2/transports/silent-transport.d.ts +2 -2
- package/dist/logger/v2/transports/silent-transport.d.ts.map +1 -1
- package/dist/logger/v2/types.cjs +1 -1
- package/dist/logger/v2/types.d.ts +8 -8
- package/dist/logger/v2/types.d.ts.map +1 -1
- package/dist/logger/v2/types.js +1 -1
- package/dist/mcp/errors.cjs +2 -2
- package/dist/mcp/errors.d.ts.map +1 -1
- package/dist/mcp/manager.cjs +16 -11
- package/dist/mcp/manager.d.ts +16 -13
- package/dist/mcp/manager.d.ts.map +1 -1
- package/dist/mcp/manager.js +17 -12
- package/dist/mcp/mcp-client.cjs +25 -20
- package/dist/mcp/mcp-client.d.ts +5 -5
- package/dist/mcp/mcp-client.d.ts.map +1 -1
- package/dist/mcp/mcp-client.js +20 -15
- package/dist/mcp/resolver.cjs +1 -1
- package/dist/mcp/schemas.cjs +5 -5
- package/dist/mcp/schemas.d.ts +4 -4
- package/dist/mcp/schemas.js +2 -2
- package/dist/mcp/types.d.ts +7 -7
- package/dist/mcp/types.d.ts.map +1 -1
- package/dist/memory/manager.d.ts +2 -2
- package/dist/memory/manager.d.ts.map +1 -1
- package/dist/memory/schemas.d.ts +2 -2
- package/dist/prompts/errors.cjs +3 -3
- package/dist/prompts/errors.d.ts.map +1 -1
- package/dist/prompts/prompt-manager.d.ts +3 -3
- package/dist/prompts/prompt-manager.d.ts.map +1 -1
- package/dist/prompts/providers/config-prompt-provider.cjs +15 -29
- package/dist/prompts/providers/config-prompt-provider.d.ts +3 -3
- package/dist/prompts/providers/config-prompt-provider.d.ts.map +1 -1
- package/dist/prompts/providers/config-prompt-provider.js +15 -29
- package/dist/prompts/providers/custom-prompt-provider.d.ts +2 -2
- package/dist/prompts/providers/custom-prompt-provider.d.ts.map +1 -1
- package/dist/prompts/providers/mcp-prompt-provider.d.ts +2 -2
- package/dist/prompts/providers/mcp-prompt-provider.d.ts.map +1 -1
- package/dist/prompts/schemas.d.ts +4 -4
- package/dist/resources/{internal-provider.cjs → agent-resources-provider.cjs} +16 -16
- package/dist/resources/{internal-provider.d.ts → agent-resources-provider.d.ts} +6 -6
- package/dist/resources/agent-resources-provider.d.ts.map +1 -0
- package/dist/resources/{internal-provider.js → agent-resources-provider.js} +13 -13
- package/dist/resources/errors.cjs +2 -2
- package/dist/resources/errors.d.ts.map +1 -1
- package/dist/resources/handlers/blob-handler.d.ts +2 -2
- package/dist/resources/handlers/blob-handler.d.ts.map +1 -1
- package/dist/resources/handlers/factory.d.ts +3 -3
- package/dist/resources/handlers/factory.d.ts.map +1 -1
- package/dist/resources/handlers/filesystem-handler.cjs +25 -0
- package/dist/resources/handlers/filesystem-handler.d.ts +3 -2
- package/dist/resources/handlers/filesystem-handler.d.ts.map +1 -1
- package/dist/resources/handlers/filesystem-handler.js +25 -0
- package/dist/resources/index.cjs +7 -9
- package/dist/resources/index.d.ts +3 -3
- package/dist/resources/index.d.ts.map +1 -1
- package/dist/resources/index.js +5 -10
- package/dist/resources/manager.cjs +77 -74
- package/dist/resources/manager.d.ts +16 -7
- package/dist/resources/manager.d.ts.map +1 -1
- package/dist/resources/manager.js +77 -74
- package/dist/resources/schemas.cjs +6 -26
- package/dist/resources/schemas.d.ts +8 -100
- package/dist/resources/schemas.d.ts.map +1 -1
- package/dist/resources/schemas.js +4 -23
- package/dist/search/search-service.d.ts +2 -2
- package/dist/search/search-service.d.ts.map +1 -1
- package/dist/session/chat-session.cjs +16 -26
- package/dist/session/chat-session.d.ts +7 -5
- package/dist/session/chat-session.d.ts.map +1 -1
- package/dist/session/chat-session.js +17 -27
- package/dist/session/errors.cjs +2 -2
- package/dist/session/errors.d.ts.map +1 -1
- package/dist/session/history/database.cjs +1 -1
- package/dist/session/history/database.d.ts +4 -4
- package/dist/session/history/database.d.ts.map +1 -1
- package/dist/session/history/factory.d.ts +3 -3
- package/dist/session/history/factory.d.ts.map +1 -1
- package/dist/session/history/memory.d.ts +4 -4
- package/dist/session/history/memory.d.ts.map +1 -1
- package/dist/session/history/types.d.ts +2 -2
- package/dist/session/history/types.d.ts.map +1 -1
- package/dist/session/index.cjs +3 -0
- package/dist/session/index.d.ts +2 -0
- package/dist/session/index.d.ts.map +1 -1
- package/dist/session/index.js +2 -0
- package/dist/session/message-queue.cjs +29 -5
- package/dist/session/message-queue.d.ts +5 -3
- package/dist/session/message-queue.d.ts.map +1 -1
- package/dist/session/message-queue.js +29 -5
- package/dist/session/session-manager.cjs +107 -12
- package/dist/session/session-manager.d.ts +49 -8
- package/dist/session/session-manager.d.ts.map +1 -1
- package/dist/session/session-manager.js +97 -12
- package/dist/session/title-generator.cjs +2 -2
- package/dist/session/title-generator.d.ts +2 -2
- package/dist/session/title-generator.d.ts.map +1 -1
- package/dist/session/types.d.ts +1 -0
- package/dist/session/types.d.ts.map +1 -1
- package/dist/storage/blob/index.cjs +0 -40
- package/dist/storage/blob/index.d.ts +2 -44
- package/dist/storage/blob/index.d.ts.map +1 -1
- package/dist/storage/blob/index.js +0 -30
- package/dist/storage/cache/index.cjs +0 -37
- package/dist/storage/cache/index.d.ts +0 -42
- package/dist/storage/cache/index.d.ts.map +1 -1
- package/dist/storage/cache/index.js +0 -28
- package/dist/storage/database/index.cjs +0 -42
- package/dist/storage/database/index.d.ts +0 -43
- package/dist/storage/database/index.d.ts.map +1 -1
- package/dist/storage/database/index.js +0 -37
- package/dist/storage/error-codes.cjs +1 -6
- package/dist/storage/error-codes.d.ts +2 -7
- package/dist/storage/error-codes.d.ts.map +1 -1
- package/dist/storage/error-codes.js +1 -6
- package/dist/storage/errors.cjs +18 -82
- package/dist/storage/errors.d.ts +4 -24
- package/dist/storage/errors.d.ts.map +1 -1
- package/dist/storage/errors.js +16 -80
- package/dist/storage/index.cjs +8 -69
- package/dist/storage/index.d.ts +11 -66
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +6 -50
- package/dist/storage/storage-manager.cjs +9 -25
- package/dist/storage/storage-manager.d.ts +11 -15
- package/dist/storage/storage-manager.d.ts.map +1 -1
- package/dist/storage/storage-manager.js +8 -23
- package/dist/storage/types.d.ts +0 -1
- package/dist/storage/types.d.ts.map +1 -1
- package/dist/systemPrompt/contributors.d.ts +4 -4
- package/dist/systemPrompt/contributors.d.ts.map +1 -1
- package/dist/systemPrompt/errors.cjs +2 -2
- package/dist/systemPrompt/errors.d.ts.map +1 -1
- package/dist/systemPrompt/manager.cjs +1 -5
- package/dist/systemPrompt/manager.d.ts +2 -3
- package/dist/systemPrompt/manager.d.ts.map +1 -1
- package/dist/systemPrompt/manager.js +1 -5
- package/dist/telemetry/index.cjs +3 -0
- package/dist/telemetry/index.d.ts +2 -0
- package/dist/telemetry/index.d.ts.map +1 -1
- package/dist/telemetry/index.js +2 -0
- package/dist/telemetry/utils.d.ts +4 -4
- package/dist/telemetry/utils.d.ts.map +1 -1
- package/dist/test-utils/in-memory-storage.cjs +288 -0
- package/dist/test-utils/in-memory-storage.js +252 -0
- package/dist/tools/confirmation/allowed-tools-provider/factory.d.ts +3 -3
- package/dist/tools/confirmation/allowed-tools-provider/factory.d.ts.map +1 -1
- package/dist/tools/confirmation/allowed-tools-provider/in-memory.d.ts +2 -2
- package/dist/tools/confirmation/allowed-tools-provider/in-memory.d.ts.map +1 -1
- package/dist/tools/confirmation/allowed-tools-provider/storage.d.ts +4 -4
- package/dist/tools/confirmation/allowed-tools-provider/storage.d.ts.map +1 -1
- package/dist/tools/confirmation/allowed-tools-provider/types.d.ts +2 -2
- package/dist/tools/confirmation/allowed-tools-provider/types.d.ts.map +1 -1
- package/dist/tools/{internal-tools/constants.cjs → define-tool.cjs} +8 -13
- package/dist/tools/define-tool.d.ts +11 -0
- package/dist/tools/define-tool.d.ts.map +1 -0
- package/dist/tools/define-tool.js +7 -0
- package/dist/tools/error-codes.cjs +2 -2
- package/dist/tools/error-codes.d.ts +2 -2
- package/dist/tools/error-codes.d.ts.map +1 -1
- package/dist/tools/error-codes.js +2 -2
- package/dist/tools/errors.cjs +11 -23
- package/dist/tools/errors.d.ts +4 -10
- package/dist/tools/errors.d.ts.map +1 -1
- package/dist/tools/errors.js +9 -21
- package/dist/tools/index.cjs +3 -8
- package/dist/tools/index.d.ts +2 -4
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +2 -7
- package/dist/{storage/blob/providers/index.cjs → tools/pattern-utils.cjs} +11 -9
- package/dist/tools/pattern-utils.d.ts +20 -0
- package/dist/tools/pattern-utils.d.ts.map +1 -0
- package/dist/tools/pattern-utils.js +10 -0
- package/dist/tools/schemas.cjs +14 -40
- package/dist/tools/schemas.d.ts +6 -50
- package/dist/tools/schemas.d.ts.map +1 -1
- package/dist/tools/schemas.js +11 -32
- package/dist/tools/tool-call-metadata.cjs +75 -0
- package/dist/tools/tool-call-metadata.d.ts +16 -0
- package/dist/tools/tool-call-metadata.d.ts.map +1 -0
- package/dist/tools/tool-call-metadata.js +51 -0
- package/dist/tools/tool-manager.cjs +578 -302
- package/dist/tools/tool-manager.d.ts +105 -81
- package/dist/tools/tool-manager.d.ts.map +1 -1
- package/dist/tools/tool-manager.js +578 -306
- package/dist/tools/types.d.ts +112 -13
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/utils/api-key-resolver.cjs +1 -1
- package/dist/utils/api-key-resolver.js +1 -1
- package/dist/utils/env.cjs +49 -0
- package/dist/utils/env.d.ts +4 -0
- package/dist/utils/env.d.ts.map +1 -0
- package/dist/utils/env.js +24 -0
- package/dist/utils/error-conversion.d.ts +2 -2
- package/dist/utils/error-conversion.d.ts.map +1 -1
- package/dist/utils/index.cjs +3 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/path.d.ts +2 -2
- package/dist/utils/path.d.ts.map +1 -1
- package/dist/utils/result.cjs +1 -1
- package/dist/utils/result.d.ts.map +1 -1
- package/dist/utils/schema.cjs +9 -5
- package/dist/utils/schema.d.ts +4 -2
- package/dist/utils/schema.d.ts.map +1 -1
- package/dist/utils/schema.js +9 -5
- package/dist/utils/service-initializer.cjs +58 -51
- package/dist/utils/service-initializer.d.ts +31 -9
- package/dist/utils/service-initializer.d.ts.map +1 -1
- package/dist/utils/service-initializer.js +58 -51
- package/dist/{storage/cache/providers/index.cjs → workspace/error-codes.cjs} +8 -9
- package/dist/workspace/error-codes.d.ts +5 -0
- package/dist/workspace/error-codes.d.ts.map +1 -0
- package/dist/workspace/error-codes.js +7 -0
- package/dist/{storage/blob/factory.cjs → workspace/errors.cjs} +20 -14
- package/dist/workspace/errors.d.ts +5 -0
- package/dist/workspace/errors.d.ts.map +1 -0
- package/dist/workspace/errors.js +21 -0
- package/dist/{image → workspace}/index.cjs +12 -10
- package/dist/workspace/index.d.ts +5 -0
- package/dist/workspace/index.d.ts.map +1 -0
- package/dist/workspace/index.js +9 -0
- package/dist/workspace/manager.cjs +113 -0
- package/dist/workspace/manager.d.ts +18 -0
- package/dist/workspace/manager.d.ts.map +1 -0
- package/dist/workspace/manager.js +90 -0
- package/dist/workspace/types.d.ts +14 -0
- package/dist/workspace/types.d.ts.map +1 -0
- package/package.json +7 -3
- package/dist/context/compaction/factory.cjs +0 -57
- package/dist/context/compaction/factory.d.ts +0 -17
- package/dist/context/compaction/factory.d.ts.map +0 -1
- package/dist/context/compaction/factory.js +0 -34
- package/dist/context/compaction/provider.d.ts +0 -48
- package/dist/context/compaction/provider.d.ts.map +0 -1
- package/dist/context/compaction/providers/noop-provider.d.ts +0 -24
- package/dist/context/compaction/providers/noop-provider.d.ts.map +0 -1
- package/dist/context/compaction/providers/noop-provider.js +0 -24
- package/dist/context/compaction/providers/reactive-overflow-provider.cjs +0 -76
- package/dist/context/compaction/providers/reactive-overflow-provider.d.ts +0 -51
- package/dist/context/compaction/providers/reactive-overflow-provider.d.ts.map +0 -1
- package/dist/context/compaction/providers/reactive-overflow-provider.js +0 -52
- package/dist/context/compaction/registry.cjs +0 -39
- package/dist/context/compaction/registry.d.ts +0 -19
- package/dist/context/compaction/registry.d.ts.map +0 -1
- package/dist/context/compaction/registry.js +0 -16
- package/dist/context/compaction/schemas.cjs +0 -58
- package/dist/context/compaction/schemas.d.ts +0 -69
- package/dist/context/compaction/schemas.d.ts.map +0 -1
- package/dist/context/compaction/schemas.js +0 -34
- package/dist/context/compaction/strategies/reactive-overflow.d.ts.map +0 -1
- package/dist/image/define-image.cjs +0 -146
- package/dist/image/define-image.d.ts +0 -71
- package/dist/image/define-image.d.ts.map +0 -1
- package/dist/image/define-image.js +0 -121
- package/dist/image/index.d.ts +0 -53
- package/dist/image/index.d.ts.map +0 -1
- package/dist/image/index.js +0 -7
- package/dist/image/types.d.ts +0 -246
- package/dist/image/types.d.ts.map +0 -1
- package/dist/llm/registry.cjs +0 -2075
- package/dist/llm/registry.d.ts.map +0 -1
- package/dist/llm/registry.js +0 -2025
- package/dist/llm/services/test-utils.integration.cjs +0 -237
- package/dist/llm/services/test-utils.integration.d.ts +0 -48
- package/dist/llm/services/test-utils.integration.d.ts.map +0 -1
- package/dist/llm/services/test-utils.integration.js +0 -214
- package/dist/plugins/builtins/content-policy.d.ts +0 -26
- package/dist/plugins/builtins/content-policy.d.ts.map +0 -1
- package/dist/plugins/builtins/response-sanitizer.d.ts +0 -25
- package/dist/plugins/builtins/response-sanitizer.d.ts.map +0 -1
- package/dist/plugins/error-codes.cjs +0 -43
- package/dist/plugins/error-codes.d.ts +0 -34
- package/dist/plugins/error-codes.d.ts.map +0 -1
- package/dist/plugins/error-codes.js +0 -20
- package/dist/plugins/index.cjs +0 -61
- package/dist/plugins/index.d.ts +0 -21
- package/dist/plugins/index.d.ts.map +0 -1
- package/dist/plugins/index.js +0 -30
- package/dist/plugins/loader.cjs +0 -171
- package/dist/plugins/loader.d.ts +0 -30
- package/dist/plugins/loader.d.ts.map +0 -1
- package/dist/plugins/loader.js +0 -145
- package/dist/plugins/manager.cjs +0 -473
- package/dist/plugins/manager.d.ts +0 -106
- package/dist/plugins/manager.d.ts.map +0 -1
- package/dist/plugins/manager.js +0 -450
- package/dist/plugins/registrations/builtins.cjs +0 -51
- package/dist/plugins/registrations/builtins.d.ts +0 -17
- package/dist/plugins/registrations/builtins.d.ts.map +0 -1
- package/dist/plugins/registrations/builtins.js +0 -28
- package/dist/plugins/registry.cjs +0 -63
- package/dist/plugins/registry.d.ts +0 -101
- package/dist/plugins/registry.d.ts.map +0 -1
- package/dist/plugins/registry.js +0 -39
- package/dist/plugins/schemas.cjs +0 -73
- package/dist/plugins/schemas.d.ts +0 -195
- package/dist/plugins/schemas.d.ts.map +0 -1
- package/dist/plugins/schemas.js +0 -47
- package/dist/plugins/types.d.ts.map +0 -1
- package/dist/providers/base-registry.cjs +0 -147
- package/dist/providers/base-registry.d.ts +0 -147
- package/dist/providers/base-registry.d.ts.map +0 -1
- package/dist/providers/base-registry.js +0 -123
- package/dist/providers/discovery.cjs +0 -109
- package/dist/providers/discovery.d.ts +0 -96
- package/dist/providers/discovery.d.ts.map +0 -1
- package/dist/providers/discovery.js +0 -84
- package/dist/providers/index.cjs +0 -24
- package/dist/providers/index.d.ts +0 -32
- package/dist/providers/index.d.ts.map +0 -1
- package/dist/providers/index.js +0 -2
- package/dist/resources/internal-provider.d.ts.map +0 -1
- package/dist/storage/blob/factory.d.ts +0 -37
- package/dist/storage/blob/factory.d.ts.map +0 -1
- package/dist/storage/blob/factory.js +0 -15
- package/dist/storage/blob/local-blob-store.cjs +0 -496
- package/dist/storage/blob/local-blob-store.d.ts +0 -58
- package/dist/storage/blob/local-blob-store.d.ts.map +0 -1
- package/dist/storage/blob/local-blob-store.js +0 -463
- package/dist/storage/blob/memory-blob-store.cjs +0 -326
- package/dist/storage/blob/memory-blob-store.d.ts +0 -66
- package/dist/storage/blob/memory-blob-store.d.ts.map +0 -1
- package/dist/storage/blob/memory-blob-store.js +0 -303
- package/dist/storage/blob/provider.d.ts +0 -50
- package/dist/storage/blob/provider.d.ts.map +0 -1
- package/dist/storage/blob/providers/index.d.ts +0 -8
- package/dist/storage/blob/providers/index.d.ts.map +0 -1
- package/dist/storage/blob/providers/index.js +0 -7
- package/dist/storage/blob/providers/local.cjs +0 -39
- package/dist/storage/blob/providers/local.d.ts +0 -17
- package/dist/storage/blob/providers/local.d.ts.map +0 -1
- package/dist/storage/blob/providers/local.js +0 -16
- package/dist/storage/blob/providers/memory.cjs +0 -39
- package/dist/storage/blob/providers/memory.d.ts +0 -17
- package/dist/storage/blob/providers/memory.d.ts.map +0 -1
- package/dist/storage/blob/providers/memory.js +0 -16
- package/dist/storage/blob/registry.cjs +0 -50
- package/dist/storage/blob/registry.d.ts +0 -42
- package/dist/storage/blob/registry.d.ts.map +0 -1
- package/dist/storage/blob/registry.js +0 -26
- package/dist/storage/blob/schemas.cjs +0 -52
- package/dist/storage/blob/schemas.d.ts +0 -85
- package/dist/storage/blob/schemas.d.ts.map +0 -1
- package/dist/storage/blob/schemas.js +0 -26
- package/dist/storage/cache/factory.cjs +0 -38
- package/dist/storage/cache/factory.d.ts +0 -37
- package/dist/storage/cache/factory.d.ts.map +0 -1
- package/dist/storage/cache/factory.js +0 -15
- package/dist/storage/cache/memory-cache-store.cjs +0 -107
- package/dist/storage/cache/memory-cache-store.d.ts +0 -26
- package/dist/storage/cache/memory-cache-store.d.ts.map +0 -1
- package/dist/storage/cache/memory-cache-store.js +0 -84
- package/dist/storage/cache/provider.cjs +0 -16
- package/dist/storage/cache/provider.d.ts +0 -56
- package/dist/storage/cache/provider.d.ts.map +0 -1
- package/dist/storage/cache/provider.js +0 -0
- package/dist/storage/cache/providers/index.d.ts +0 -8
- package/dist/storage/cache/providers/index.d.ts.map +0 -1
- package/dist/storage/cache/providers/index.js +0 -7
- package/dist/storage/cache/providers/memory.d.ts +0 -17
- package/dist/storage/cache/providers/memory.d.ts.map +0 -1
- package/dist/storage/cache/providers/memory.js +0 -17
- package/dist/storage/cache/providers/redis.cjs +0 -66
- package/dist/storage/cache/providers/redis.d.ts +0 -20
- package/dist/storage/cache/providers/redis.d.ts.map +0 -1
- package/dist/storage/cache/providers/redis.js +0 -33
- package/dist/storage/cache/redis-store.cjs +0 -173
- package/dist/storage/cache/redis-store.d.ts +0 -32
- package/dist/storage/cache/redis-store.d.ts.map +0 -1
- package/dist/storage/cache/redis-store.js +0 -150
- package/dist/storage/cache/registry.cjs +0 -50
- package/dist/storage/cache/registry.d.ts +0 -42
- package/dist/storage/cache/registry.d.ts.map +0 -1
- package/dist/storage/cache/registry.js +0 -26
- package/dist/storage/cache/schemas.cjs +0 -81
- package/dist/storage/cache/schemas.d.ts +0 -150
- package/dist/storage/cache/schemas.d.ts.map +0 -1
- package/dist/storage/cache/schemas.js +0 -55
- package/dist/storage/database/factory.cjs +0 -38
- package/dist/storage/database/factory.d.ts +0 -39
- package/dist/storage/database/factory.d.ts.map +0 -1
- package/dist/storage/database/factory.js +0 -15
- package/dist/storage/database/memory-database-store.cjs +0 -122
- package/dist/storage/database/memory-database-store.d.ts +0 -29
- package/dist/storage/database/memory-database-store.d.ts.map +0 -1
- package/dist/storage/database/memory-database-store.js +0 -99
- package/dist/storage/database/postgres-store.cjs +0 -342
- package/dist/storage/database/postgres-store.d.ts +0 -55
- package/dist/storage/database/postgres-store.d.ts.map +0 -1
- package/dist/storage/database/postgres-store.js +0 -319
- package/dist/storage/database/provider.cjs +0 -16
- package/dist/storage/database/provider.d.ts +0 -56
- package/dist/storage/database/provider.d.ts.map +0 -1
- package/dist/storage/database/provider.js +0 -0
- package/dist/storage/database/providers/index.d.ts +0 -9
- package/dist/storage/database/providers/index.d.ts.map +0 -1
- package/dist/storage/database/providers/index.js +0 -9
- package/dist/storage/database/providers/memory.cjs +0 -40
- package/dist/storage/database/providers/memory.d.ts +0 -16
- package/dist/storage/database/providers/memory.d.ts.map +0 -1
- package/dist/storage/database/providers/memory.js +0 -17
- package/dist/storage/database/providers/postgres.cjs +0 -62
- package/dist/storage/database/providers/postgres.d.ts +0 -19
- package/dist/storage/database/providers/postgres.d.ts.map +0 -1
- package/dist/storage/database/providers/postgres.js +0 -29
- package/dist/storage/database/providers/sqlite.cjs +0 -66
- package/dist/storage/database/providers/sqlite.d.ts +0 -20
- package/dist/storage/database/providers/sqlite.d.ts.map +0 -1
- package/dist/storage/database/providers/sqlite.js +0 -33
- package/dist/storage/database/registry.cjs +0 -50
- package/dist/storage/database/registry.d.ts +0 -42
- package/dist/storage/database/registry.d.ts.map +0 -1
- package/dist/storage/database/registry.js +0 -26
- package/dist/storage/database/schemas.cjs +0 -97
- package/dist/storage/database/schemas.d.ts +0 -226
- package/dist/storage/database/schemas.d.ts.map +0 -1
- package/dist/storage/database/schemas.js +0 -70
- package/dist/storage/database/sqlite-store.cjs +0 -270
- package/dist/storage/database/sqlite-store.d.ts +0 -33
- package/dist/storage/database/sqlite-store.d.ts.map +0 -1
- package/dist/storage/database/sqlite-store.js +0 -237
- package/dist/storage/schemas.cjs +0 -57
- package/dist/storage/schemas.d.ts +0 -347
- package/dist/storage/schemas.d.ts.map +0 -1
- package/dist/storage/schemas.js +0 -37
- package/dist/tools/bash-pattern-utils.cjs +0 -91
- package/dist/tools/bash-pattern-utils.d.ts +0 -58
- package/dist/tools/bash-pattern-utils.d.ts.map +0 -1
- package/dist/tools/bash-pattern-utils.js +0 -64
- package/dist/tools/custom-tool-registry.cjs +0 -64
- package/dist/tools/custom-tool-registry.d.ts +0 -126
- package/dist/tools/custom-tool-registry.d.ts.map +0 -1
- package/dist/tools/custom-tool-registry.js +0 -40
- package/dist/tools/custom-tool-schema-registry.cjs +0 -164
- package/dist/tools/custom-tool-schema-registry.d.ts +0 -86
- package/dist/tools/custom-tool-schema-registry.d.ts.map +0 -1
- package/dist/tools/custom-tool-schema-registry.js +0 -140
- package/dist/tools/internal-tools/constants.d.ts +0 -12
- package/dist/tools/internal-tools/constants.d.ts.map +0 -1
- package/dist/tools/internal-tools/constants.js +0 -12
- package/dist/tools/internal-tools/implementations/ask-user-tool.cjs +0 -57
- package/dist/tools/internal-tools/implementations/ask-user-tool.d.ts +0 -18
- package/dist/tools/internal-tools/implementations/ask-user-tool.d.ts.map +0 -1
- package/dist/tools/internal-tools/implementations/ask-user-tool.js +0 -34
- package/dist/tools/internal-tools/implementations/delegate-to-url-tool.cjs +0 -192
- package/dist/tools/internal-tools/implementations/delegate-to-url-tool.d.ts +0 -33
- package/dist/tools/internal-tools/implementations/delegate-to-url-tool.d.ts.map +0 -1
- package/dist/tools/internal-tools/implementations/delegate-to-url-tool.js +0 -169
- package/dist/tools/internal-tools/implementations/get-resource-tool.cjs +0 -113
- package/dist/tools/internal-tools/implementations/get-resource-tool.d.ts +0 -30
- package/dist/tools/internal-tools/implementations/get-resource-tool.d.ts.map +0 -1
- package/dist/tools/internal-tools/implementations/get-resource-tool.js +0 -90
- package/dist/tools/internal-tools/implementations/invoke-skill-tool.cjs +0 -140
- package/dist/tools/internal-tools/implementations/invoke-skill-tool.d.ts +0 -24
- package/dist/tools/internal-tools/implementations/invoke-skill-tool.d.ts.map +0 -1
- package/dist/tools/internal-tools/implementations/invoke-skill-tool.js +0 -117
- package/dist/tools/internal-tools/implementations/list-resources-tool.cjs +0 -91
- package/dist/tools/internal-tools/implementations/list-resources-tool.d.ts +0 -24
- package/dist/tools/internal-tools/implementations/list-resources-tool.d.ts.map +0 -1
- package/dist/tools/internal-tools/implementations/list-resources-tool.js +0 -68
- package/dist/tools/internal-tools/implementations/search-history-tool.cjs +0 -61
- package/dist/tools/internal-tools/implementations/search-history-tool.d.ts +0 -7
- package/dist/tools/internal-tools/implementations/search-history-tool.d.ts.map +0 -1
- package/dist/tools/internal-tools/implementations/search-history-tool.js +0 -38
- package/dist/tools/internal-tools/index.cjs +0 -26
- package/dist/tools/internal-tools/index.d.ts +0 -4
- package/dist/tools/internal-tools/index.d.ts.map +0 -1
- package/dist/tools/internal-tools/index.js +0 -3
- package/dist/tools/internal-tools/provider.cjs +0 -324
- package/dist/tools/internal-tools/provider.d.ts +0 -114
- package/dist/tools/internal-tools/provider.d.ts.map +0 -1
- package/dist/tools/internal-tools/provider.js +0 -301
- package/dist/tools/internal-tools/registry.cjs +0 -71
- package/dist/tools/internal-tools/registry.d.ts +0 -91
- package/dist/tools/internal-tools/registry.d.ts.map +0 -1
- package/dist/tools/internal-tools/registry.js +0 -47
- /package/dist/{context/compaction/provider.js → agent/agent-options.js} +0 -0
- /package/dist/{image/types.js → agent/runtime-config.js} +0 -0
- /package/dist/{image → hooks}/types.cjs +0 -0
- /package/dist/{plugins → hooks}/types.js +0 -0
- /package/dist/{plugins → workspace}/types.cjs +0 -0
- /package/dist/{storage/blob/provider.js → workspace/types.js} +0 -0
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import "../../../chunk-PTJYTZNU.js";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
import { ReactiveOverflowStrategy } from "../strategies/reactive-overflow.js";
|
|
4
|
-
const ReactiveOverflowConfigSchema = z.object({
|
|
5
|
-
type: z.literal("reactive-overflow"),
|
|
6
|
-
enabled: z.boolean().default(true).describe("Enable or disable compaction"),
|
|
7
|
-
/**
|
|
8
|
-
* Maximum context tokens before compaction triggers.
|
|
9
|
-
* When set, overrides the model's context window for compaction threshold.
|
|
10
|
-
* Useful for capping context size below the model's maximum limit.
|
|
11
|
-
*/
|
|
12
|
-
maxContextTokens: z.number().positive().optional().describe(
|
|
13
|
-
"Maximum context tokens before compaction triggers. Overrides model context window when set."
|
|
14
|
-
),
|
|
15
|
-
/**
|
|
16
|
-
* Percentage of context window that triggers compaction (0.1 to 1.0).
|
|
17
|
-
* Default is 1.0 (100%), meaning compaction triggers when context is full.
|
|
18
|
-
*/
|
|
19
|
-
thresholdPercent: z.number().min(0.1).max(1).default(1).describe(
|
|
20
|
-
"Percentage of context window that triggers compaction (0.1 to 1.0, default 1.0)"
|
|
21
|
-
),
|
|
22
|
-
preserveLastNTurns: z.number().int().positive().default(2).describe("Number of recent turns (user+assistant pairs) to preserve"),
|
|
23
|
-
maxSummaryTokens: z.number().int().positive().default(2e3).describe("Maximum tokens for the summary output"),
|
|
24
|
-
summaryPrompt: z.string().optional().describe("Custom summary prompt template. Use {conversation} as placeholder")
|
|
25
|
-
}).strict();
|
|
26
|
-
const reactiveOverflowProvider = {
|
|
27
|
-
type: "reactive-overflow",
|
|
28
|
-
configSchema: ReactiveOverflowConfigSchema,
|
|
29
|
-
metadata: {
|
|
30
|
-
displayName: "Reactive Overflow Compaction",
|
|
31
|
-
description: "Generates summaries when context window overflows, preserving recent turns",
|
|
32
|
-
requiresLLM: true,
|
|
33
|
-
isProactive: false
|
|
34
|
-
},
|
|
35
|
-
create(config, context) {
|
|
36
|
-
if (!context.model) {
|
|
37
|
-
throw new Error("ReactiveOverflowStrategy requires LanguageModel");
|
|
38
|
-
}
|
|
39
|
-
const options = {
|
|
40
|
-
preserveLastNTurns: config.preserveLastNTurns,
|
|
41
|
-
maxSummaryTokens: config.maxSummaryTokens
|
|
42
|
-
};
|
|
43
|
-
if (config.summaryPrompt !== void 0) {
|
|
44
|
-
options.summaryPrompt = config.summaryPrompt;
|
|
45
|
-
}
|
|
46
|
-
return new ReactiveOverflowStrategy(context.model, options, context.logger);
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
export {
|
|
50
|
-
ReactiveOverflowConfigSchema,
|
|
51
|
-
reactiveOverflowProvider
|
|
52
|
-
};
|
|
@@ -1,39 +0,0 @@
|
|
|
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 registry_exports = {};
|
|
20
|
-
__export(registry_exports, {
|
|
21
|
-
compactionRegistry: () => compactionRegistry
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(registry_exports);
|
|
24
|
-
var import_errors = require("../errors.js");
|
|
25
|
-
var import_base_registry = require("../../providers/base-registry.js");
|
|
26
|
-
const compactionErrorFactory = {
|
|
27
|
-
alreadyRegistered: (type) => import_errors.ContextError.compactionProviderAlreadyRegistered(type),
|
|
28
|
-
notFound: (type, availableTypes) => import_errors.ContextError.compactionInvalidType(type, availableTypes)
|
|
29
|
-
};
|
|
30
|
-
class CompactionRegistry extends import_base_registry.BaseRegistry {
|
|
31
|
-
constructor() {
|
|
32
|
-
super(compactionErrorFactory);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
const compactionRegistry = new CompactionRegistry();
|
|
36
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
-
0 && (module.exports = {
|
|
38
|
-
compactionRegistry
|
|
39
|
-
});
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { CompactionProvider } from './provider.js';
|
|
2
|
-
import { BaseRegistry } from '../../providers/base-registry.js';
|
|
3
|
-
/**
|
|
4
|
-
* Global registry for compaction providers.
|
|
5
|
-
*
|
|
6
|
-
* Follows the same pattern as blob storage and tools registries:
|
|
7
|
-
* - Singleton instance exported
|
|
8
|
-
* - Registration before agent initialization
|
|
9
|
-
* - Type-safe provider lookup
|
|
10
|
-
*
|
|
11
|
-
* Extends BaseRegistry for common registry functionality.
|
|
12
|
-
*/
|
|
13
|
-
declare class CompactionRegistry extends BaseRegistry<CompactionProvider<any, any>> {
|
|
14
|
-
constructor();
|
|
15
|
-
}
|
|
16
|
-
/** Global singleton instance */
|
|
17
|
-
export declare const compactionRegistry: CompactionRegistry;
|
|
18
|
-
export {};
|
|
19
|
-
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/context/compaction/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAExD,OAAO,EAAE,YAAY,EAA6B,MAAM,kCAAkC,CAAC;AAY3F;;;;;;;;;GASG;AACH,cAAM,kBAAmB,SAAQ,YAAY,CAAC,kBAAkB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;;CAI1E;AAED,gCAAgC;AAChC,eAAO,MAAM,kBAAkB,oBAA2B,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import "../../chunk-PTJYTZNU.js";
|
|
2
|
-
import { ContextError } from "../errors.js";
|
|
3
|
-
import { BaseRegistry } from "../../providers/base-registry.js";
|
|
4
|
-
const compactionErrorFactory = {
|
|
5
|
-
alreadyRegistered: (type) => ContextError.compactionProviderAlreadyRegistered(type),
|
|
6
|
-
notFound: (type, availableTypes) => ContextError.compactionInvalidType(type, availableTypes)
|
|
7
|
-
};
|
|
8
|
-
class CompactionRegistry extends BaseRegistry {
|
|
9
|
-
constructor() {
|
|
10
|
-
super(compactionErrorFactory);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
const compactionRegistry = new CompactionRegistry();
|
|
14
|
-
export {
|
|
15
|
-
compactionRegistry
|
|
16
|
-
};
|
|
@@ -1,58 +0,0 @@
|
|
|
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 schemas_exports = {};
|
|
20
|
-
__export(schemas_exports, {
|
|
21
|
-
CompactionConfigSchema: () => CompactionConfigSchema,
|
|
22
|
-
DEFAULT_COMPACTION_CONFIG: () => DEFAULT_COMPACTION_CONFIG
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(schemas_exports);
|
|
25
|
-
var import_zod = require("zod");
|
|
26
|
-
const CompactionConfigSchema = import_zod.z.object({
|
|
27
|
-
type: import_zod.z.string().describe("Compaction provider type"),
|
|
28
|
-
enabled: import_zod.z.boolean().default(true).describe("Enable or disable compaction"),
|
|
29
|
-
/**
|
|
30
|
-
* Maximum context tokens before compaction triggers.
|
|
31
|
-
* When set, overrides the model's context window for compaction threshold.
|
|
32
|
-
* Useful for capping context size below the model's maximum limit.
|
|
33
|
-
* Example: Set to 50000 to trigger compaction at 50K tokens even if
|
|
34
|
-
* the model supports 200K tokens.
|
|
35
|
-
*/
|
|
36
|
-
maxContextTokens: import_zod.z.number().positive().optional().describe(
|
|
37
|
-
"Maximum context tokens before compaction triggers. Overrides model context window when set."
|
|
38
|
-
),
|
|
39
|
-
/**
|
|
40
|
-
* Percentage of context window that triggers compaction (0.0 to 1.0).
|
|
41
|
-
* Default is 0.9 (90%), leaving a 10% buffer to avoid context degradation.
|
|
42
|
-
* Set lower values to trigger compaction earlier.
|
|
43
|
-
* Example: 0.8 triggers compaction when 80% of context is used.
|
|
44
|
-
*/
|
|
45
|
-
thresholdPercent: import_zod.z.number().min(0.1).max(1).default(0.9).describe(
|
|
46
|
-
"Percentage of context window that triggers compaction (0.1 to 1.0, default 0.9)"
|
|
47
|
-
)
|
|
48
|
-
}).passthrough().describe("Context compaction configuration");
|
|
49
|
-
const DEFAULT_COMPACTION_CONFIG = {
|
|
50
|
-
type: "reactive-overflow",
|
|
51
|
-
enabled: true,
|
|
52
|
-
thresholdPercent: 0.9
|
|
53
|
-
};
|
|
54
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
55
|
-
0 && (module.exports = {
|
|
56
|
-
CompactionConfigSchema,
|
|
57
|
-
DEFAULT_COMPACTION_CONFIG
|
|
58
|
-
});
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
/**
|
|
3
|
-
* Base compaction configuration schema.
|
|
4
|
-
* Uses discriminated union to support different provider types.
|
|
5
|
-
*
|
|
6
|
-
* Each provider registers its own schema with specific validation rules.
|
|
7
|
-
* This schema accepts any configuration with a 'type' field.
|
|
8
|
-
*/
|
|
9
|
-
export declare const CompactionConfigSchema: z.ZodObject<{
|
|
10
|
-
type: z.ZodString;
|
|
11
|
-
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
12
|
-
/**
|
|
13
|
-
* Maximum context tokens before compaction triggers.
|
|
14
|
-
* When set, overrides the model's context window for compaction threshold.
|
|
15
|
-
* Useful for capping context size below the model's maximum limit.
|
|
16
|
-
* Example: Set to 50000 to trigger compaction at 50K tokens even if
|
|
17
|
-
* the model supports 200K tokens.
|
|
18
|
-
*/
|
|
19
|
-
maxContextTokens: z.ZodOptional<z.ZodNumber>;
|
|
20
|
-
/**
|
|
21
|
-
* Percentage of context window that triggers compaction (0.0 to 1.0).
|
|
22
|
-
* Default is 0.9 (90%), leaving a 10% buffer to avoid context degradation.
|
|
23
|
-
* Set lower values to trigger compaction earlier.
|
|
24
|
-
* Example: 0.8 triggers compaction when 80% of context is used.
|
|
25
|
-
*/
|
|
26
|
-
thresholdPercent: z.ZodDefault<z.ZodNumber>;
|
|
27
|
-
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
28
|
-
type: z.ZodString;
|
|
29
|
-
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
30
|
-
/**
|
|
31
|
-
* Maximum context tokens before compaction triggers.
|
|
32
|
-
* When set, overrides the model's context window for compaction threshold.
|
|
33
|
-
* Useful for capping context size below the model's maximum limit.
|
|
34
|
-
* Example: Set to 50000 to trigger compaction at 50K tokens even if
|
|
35
|
-
* the model supports 200K tokens.
|
|
36
|
-
*/
|
|
37
|
-
maxContextTokens: z.ZodOptional<z.ZodNumber>;
|
|
38
|
-
/**
|
|
39
|
-
* Percentage of context window that triggers compaction (0.0 to 1.0).
|
|
40
|
-
* Default is 0.9 (90%), leaving a 10% buffer to avoid context degradation.
|
|
41
|
-
* Set lower values to trigger compaction earlier.
|
|
42
|
-
* Example: 0.8 triggers compaction when 80% of context is used.
|
|
43
|
-
*/
|
|
44
|
-
thresholdPercent: z.ZodDefault<z.ZodNumber>;
|
|
45
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
46
|
-
type: z.ZodString;
|
|
47
|
-
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
48
|
-
/**
|
|
49
|
-
* Maximum context tokens before compaction triggers.
|
|
50
|
-
* When set, overrides the model's context window for compaction threshold.
|
|
51
|
-
* Useful for capping context size below the model's maximum limit.
|
|
52
|
-
* Example: Set to 50000 to trigger compaction at 50K tokens even if
|
|
53
|
-
* the model supports 200K tokens.
|
|
54
|
-
*/
|
|
55
|
-
maxContextTokens: z.ZodOptional<z.ZodNumber>;
|
|
56
|
-
/**
|
|
57
|
-
* Percentage of context window that triggers compaction (0.0 to 1.0).
|
|
58
|
-
* Default is 0.9 (90%), leaving a 10% buffer to avoid context degradation.
|
|
59
|
-
* Set lower values to trigger compaction earlier.
|
|
60
|
-
* Example: 0.8 triggers compaction when 80% of context is used.
|
|
61
|
-
*/
|
|
62
|
-
thresholdPercent: z.ZodDefault<z.ZodNumber>;
|
|
63
|
-
}, z.ZodTypeAny, "passthrough">>;
|
|
64
|
-
export type CompactionConfigInput = z.output<typeof CompactionConfigSchema>;
|
|
65
|
-
/**
|
|
66
|
-
* Default compaction configuration - uses reactive-overflow strategy
|
|
67
|
-
*/
|
|
68
|
-
export declare const DEFAULT_COMPACTION_CONFIG: CompactionConfigInput;
|
|
69
|
-
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/context/compaction/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB;;;IAI3B;;;;;;OAMG;;IAQH;;;;;OAKG;;;;;IAnBH;;;;;;OAMG;;IAQH;;;;;OAKG;;;;;IAnBH;;;;;;OAMG;;IAQH;;;;;OAKG;;gCAWsC,CAAC;AAElD,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAE5E;;GAEG;AACH,eAAO,MAAM,yBAAyB,EAAE,qBAIvC,CAAC"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import "../../chunk-PTJYTZNU.js";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
const CompactionConfigSchema = z.object({
|
|
4
|
-
type: z.string().describe("Compaction provider type"),
|
|
5
|
-
enabled: z.boolean().default(true).describe("Enable or disable compaction"),
|
|
6
|
-
/**
|
|
7
|
-
* Maximum context tokens before compaction triggers.
|
|
8
|
-
* When set, overrides the model's context window for compaction threshold.
|
|
9
|
-
* Useful for capping context size below the model's maximum limit.
|
|
10
|
-
* Example: Set to 50000 to trigger compaction at 50K tokens even if
|
|
11
|
-
* the model supports 200K tokens.
|
|
12
|
-
*/
|
|
13
|
-
maxContextTokens: z.number().positive().optional().describe(
|
|
14
|
-
"Maximum context tokens before compaction triggers. Overrides model context window when set."
|
|
15
|
-
),
|
|
16
|
-
/**
|
|
17
|
-
* Percentage of context window that triggers compaction (0.0 to 1.0).
|
|
18
|
-
* Default is 0.9 (90%), leaving a 10% buffer to avoid context degradation.
|
|
19
|
-
* Set lower values to trigger compaction earlier.
|
|
20
|
-
* Example: 0.8 triggers compaction when 80% of context is used.
|
|
21
|
-
*/
|
|
22
|
-
thresholdPercent: z.number().min(0.1).max(1).default(0.9).describe(
|
|
23
|
-
"Percentage of context window that triggers compaction (0.1 to 1.0, default 0.9)"
|
|
24
|
-
)
|
|
25
|
-
}).passthrough().describe("Context compaction configuration");
|
|
26
|
-
const DEFAULT_COMPACTION_CONFIG = {
|
|
27
|
-
type: "reactive-overflow",
|
|
28
|
-
enabled: true,
|
|
29
|
-
thresholdPercent: 0.9
|
|
30
|
-
};
|
|
31
|
-
export {
|
|
32
|
-
CompactionConfigSchema,
|
|
33
|
-
DEFAULT_COMPACTION_CONFIG
|
|
34
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"reactive-overflow.d.ts","sourceRoot":"","sources":["../../../../src/context/compaction/strategies/reactive-overflow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,aAAa,EAAE,MAAM,IAAI,CAAC;AACtD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,KAAK,EAAE,eAAe,EAAY,MAAM,gBAAgB,CAAC;AAEhE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACpC;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAE5B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CAC1B;AAsCD;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,wBAAyB,YAAW,mBAAmB;IAChE,QAAQ,CAAC,IAAI,uBAAuB;IAEpC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAgB;IACtC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAoC;IAC5D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAe;gBAE1B,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,uBAAuB,YAAK,EAAE,MAAM,EAAE,YAAY;IAM7F;;;;;;;;;;OAUG;IACG,OAAO,CAAC,OAAO,EAAE,SAAS,eAAe,EAAE,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAiF9E;;;;;;;;;OASG;YACW,aAAa;IAkD3B;;;OAGG;IACH,OAAO,CAAC,sBAAsB;IAuB9B;;;;;;OAMG;IACH,OAAO,CAAC,YAAY;IAwDpB;;;;;OAKG;YACW,eAAe;IAmC7B;;OAEG;IACH,OAAO,CAAC,wBAAwB;IA2ChC;;OAEG;IACH,OAAO,CAAC,qBAAqB;CA0DhC"}
|
|
@@ -1,146 +0,0 @@
|
|
|
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 define_image_exports = {};
|
|
20
|
-
__export(define_image_exports, {
|
|
21
|
-
defineImage: () => defineImage,
|
|
22
|
-
defineProviderCategory: () => defineProviderCategory,
|
|
23
|
-
validateImageDefinition: () => validateImageDefinition
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(define_image_exports);
|
|
26
|
-
function defineImage(definition) {
|
|
27
|
-
if (!definition.name) {
|
|
28
|
-
throw new Error("Image definition must have a name");
|
|
29
|
-
}
|
|
30
|
-
if (!definition.version) {
|
|
31
|
-
throw new Error("Image definition must have a version");
|
|
32
|
-
}
|
|
33
|
-
if (!definition.description) {
|
|
34
|
-
throw new Error("Image definition must have a description");
|
|
35
|
-
}
|
|
36
|
-
for (const [category, config] of Object.entries(definition.providers)) {
|
|
37
|
-
if (!config) continue;
|
|
38
|
-
if (!config.providers && !config.register) {
|
|
39
|
-
throw new Error(
|
|
40
|
-
`Provider category '${category}' must have either 'providers' array or 'register' function`
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
return definition;
|
|
45
|
-
}
|
|
46
|
-
function defineProviderCategory(config) {
|
|
47
|
-
if (!config.providers && !config.register) {
|
|
48
|
-
throw new Error("Provider category must have either providers or register function");
|
|
49
|
-
}
|
|
50
|
-
return config;
|
|
51
|
-
}
|
|
52
|
-
function validateImageDefinition(definition) {
|
|
53
|
-
if (!definition.name || typeof definition.name !== "string") {
|
|
54
|
-
throw new Error("Image name must be a non-empty string");
|
|
55
|
-
}
|
|
56
|
-
if (!definition.version || typeof definition.version !== "string") {
|
|
57
|
-
throw new Error("Image version must be a non-empty string");
|
|
58
|
-
}
|
|
59
|
-
if (!definition.description || typeof definition.description !== "string") {
|
|
60
|
-
throw new Error("Image description must be a non-empty string");
|
|
61
|
-
}
|
|
62
|
-
const versionRegex = /^\d+\.\d+\.\d+(-[a-zA-Z0-9.-]+)?$/;
|
|
63
|
-
if (!versionRegex.test(definition.version)) {
|
|
64
|
-
throw new Error(
|
|
65
|
-
`Image version '${definition.version}' is not valid semver. Expected format: x.y.z`
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
const validTargets = [
|
|
69
|
-
"local-development",
|
|
70
|
-
"cloud-production",
|
|
71
|
-
"edge-serverless",
|
|
72
|
-
"embedded-iot",
|
|
73
|
-
"enterprise",
|
|
74
|
-
"custom"
|
|
75
|
-
];
|
|
76
|
-
if (definition.target && !validTargets.includes(definition.target)) {
|
|
77
|
-
throw new Error(
|
|
78
|
-
`Invalid target '${definition.target}'. Valid targets: ${validTargets.join(", ")}`
|
|
79
|
-
);
|
|
80
|
-
}
|
|
81
|
-
const hasProviders = definition.providers && Object.values(definition.providers).some((config) => config !== void 0);
|
|
82
|
-
if (!hasProviders && !definition.extends) {
|
|
83
|
-
throw new Error(
|
|
84
|
-
"Image must either define at least one provider category or extend a base image"
|
|
85
|
-
);
|
|
86
|
-
}
|
|
87
|
-
for (const [category, config] of Object.entries(definition.providers)) {
|
|
88
|
-
if (!config) continue;
|
|
89
|
-
if (!config.providers && !config.register) {
|
|
90
|
-
throw new Error(
|
|
91
|
-
`Provider category '${category}' must have either 'providers' array or 'register' function`
|
|
92
|
-
);
|
|
93
|
-
}
|
|
94
|
-
if (config.providers && !Array.isArray(config.providers)) {
|
|
95
|
-
throw new Error(`Provider category '${category}' providers must be an array`);
|
|
96
|
-
}
|
|
97
|
-
if (config.register && typeof config.register !== "function") {
|
|
98
|
-
throw new Error(`Provider category '${category}' register must be a function`);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
const validConstraints = [
|
|
102
|
-
"filesystem-required",
|
|
103
|
-
"network-required",
|
|
104
|
-
"offline-capable",
|
|
105
|
-
"serverless-compatible",
|
|
106
|
-
"cold-start-optimized",
|
|
107
|
-
"low-memory",
|
|
108
|
-
"edge-compatible",
|
|
109
|
-
"browser-compatible"
|
|
110
|
-
];
|
|
111
|
-
if (definition.constraints) {
|
|
112
|
-
if (!Array.isArray(definition.constraints)) {
|
|
113
|
-
throw new Error("Image constraints must be an array");
|
|
114
|
-
}
|
|
115
|
-
for (const constraint of definition.constraints) {
|
|
116
|
-
if (!validConstraints.includes(constraint)) {
|
|
117
|
-
throw new Error(
|
|
118
|
-
`Invalid constraint '${constraint}'. Valid constraints: ${validConstraints.join(", ")}`
|
|
119
|
-
);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
if (definition.utils) {
|
|
124
|
-
for (const [name, path] of Object.entries(definition.utils)) {
|
|
125
|
-
if (typeof path !== "string") {
|
|
126
|
-
throw new Error(`Utility '${name}' path must be a string`);
|
|
127
|
-
}
|
|
128
|
-
if (!path.startsWith("./")) {
|
|
129
|
-
throw new Error(
|
|
130
|
-
`Utility '${name}' path must be relative (start with './'). Got: ${path}`
|
|
131
|
-
);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
if (definition.extends) {
|
|
136
|
-
if (typeof definition.extends !== "string") {
|
|
137
|
-
throw new Error("Image extends must be a string (parent image name)");
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
142
|
-
0 && (module.exports = {
|
|
143
|
-
defineImage,
|
|
144
|
-
defineProviderCategory,
|
|
145
|
-
validateImageDefinition
|
|
146
|
-
});
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Image definition helper
|
|
3
|
-
*
|
|
4
|
-
* Provides type-safe API for defining base images.
|
|
5
|
-
*/
|
|
6
|
-
import type { ImageDefinition } from './types.js';
|
|
7
|
-
/**
|
|
8
|
-
* Define a Dexto base image.
|
|
9
|
-
*
|
|
10
|
-
* This function provides type checking and validation for image definitions.
|
|
11
|
-
* Use this in your dexto.image.ts file.
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```typescript
|
|
15
|
-
* // dexto.image.ts
|
|
16
|
-
* import { defineImage } from '@dexto/core';
|
|
17
|
-
* import { localBlobProvider } from './providers/blob.js';
|
|
18
|
-
*
|
|
19
|
-
* export default defineImage({
|
|
20
|
-
* name: 'local',
|
|
21
|
-
* version: '1.0.0',
|
|
22
|
-
* description: 'Local development base image',
|
|
23
|
-
* target: 'local-development',
|
|
24
|
-
*
|
|
25
|
-
* providers: {
|
|
26
|
-
* blobStore: {
|
|
27
|
-
* providers: [localBlobProvider],
|
|
28
|
-
* },
|
|
29
|
-
* },
|
|
30
|
-
*
|
|
31
|
-
* defaults: {
|
|
32
|
-
* storage: {
|
|
33
|
-
* blob: { type: 'local', storePath: './data/blobs' },
|
|
34
|
-
* },
|
|
35
|
-
* },
|
|
36
|
-
*
|
|
37
|
-
* constraints: ['filesystem-required', 'offline-capable'],
|
|
38
|
-
* });
|
|
39
|
-
* ```
|
|
40
|
-
*
|
|
41
|
-
* @param definition - Image definition object
|
|
42
|
-
* @returns The same definition (for type inference)
|
|
43
|
-
*/
|
|
44
|
-
export declare function defineImage(definition: ImageDefinition): ImageDefinition;
|
|
45
|
-
/**
|
|
46
|
-
* Helper to create a provider category configuration.
|
|
47
|
-
*
|
|
48
|
-
* @example
|
|
49
|
-
* ```typescript
|
|
50
|
-
* import { defineProviderCategory } from '@dexto/core';
|
|
51
|
-
*
|
|
52
|
-
* const blobStore = defineProviderCategory({
|
|
53
|
-
* providers: [localBlobProvider, s3BlobProvider],
|
|
54
|
-
* });
|
|
55
|
-
* ```
|
|
56
|
-
*/
|
|
57
|
-
export declare function defineProviderCategory(config: {
|
|
58
|
-
providers?: any[];
|
|
59
|
-
register?: () => void | Promise<void>;
|
|
60
|
-
}): {
|
|
61
|
-
providers?: any[];
|
|
62
|
-
register?: () => void | Promise<void>;
|
|
63
|
-
};
|
|
64
|
-
/**
|
|
65
|
-
* Validate an image definition.
|
|
66
|
-
* Throws if the definition is invalid.
|
|
67
|
-
*
|
|
68
|
-
* Used by bundler to validate images before building.
|
|
69
|
-
*/
|
|
70
|
-
export declare function validateImageDefinition(definition: ImageDefinition): void;
|
|
71
|
-
//# sourceMappingURL=define-image.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"define-image.d.ts","sourceRoot":"","sources":["../../src/image/define-image.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,WAAW,CAAC,UAAU,EAAE,eAAe,GAAG,eAAe,CAuBxE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE;IAC3C,SAAS,CAAC,EAAE,GAAG,EAAE,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACzC;gBAFe,GAAG,EAAE;eACN,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;EAMxC;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,eAAe,GAAG,IAAI,CAiHzE"}
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import "../chunk-PTJYTZNU.js";
|
|
2
|
-
function defineImage(definition) {
|
|
3
|
-
if (!definition.name) {
|
|
4
|
-
throw new Error("Image definition must have a name");
|
|
5
|
-
}
|
|
6
|
-
if (!definition.version) {
|
|
7
|
-
throw new Error("Image definition must have a version");
|
|
8
|
-
}
|
|
9
|
-
if (!definition.description) {
|
|
10
|
-
throw new Error("Image definition must have a description");
|
|
11
|
-
}
|
|
12
|
-
for (const [category, config] of Object.entries(definition.providers)) {
|
|
13
|
-
if (!config) continue;
|
|
14
|
-
if (!config.providers && !config.register) {
|
|
15
|
-
throw new Error(
|
|
16
|
-
`Provider category '${category}' must have either 'providers' array or 'register' function`
|
|
17
|
-
);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return definition;
|
|
21
|
-
}
|
|
22
|
-
function defineProviderCategory(config) {
|
|
23
|
-
if (!config.providers && !config.register) {
|
|
24
|
-
throw new Error("Provider category must have either providers or register function");
|
|
25
|
-
}
|
|
26
|
-
return config;
|
|
27
|
-
}
|
|
28
|
-
function validateImageDefinition(definition) {
|
|
29
|
-
if (!definition.name || typeof definition.name !== "string") {
|
|
30
|
-
throw new Error("Image name must be a non-empty string");
|
|
31
|
-
}
|
|
32
|
-
if (!definition.version || typeof definition.version !== "string") {
|
|
33
|
-
throw new Error("Image version must be a non-empty string");
|
|
34
|
-
}
|
|
35
|
-
if (!definition.description || typeof definition.description !== "string") {
|
|
36
|
-
throw new Error("Image description must be a non-empty string");
|
|
37
|
-
}
|
|
38
|
-
const versionRegex = /^\d+\.\d+\.\d+(-[a-zA-Z0-9.-]+)?$/;
|
|
39
|
-
if (!versionRegex.test(definition.version)) {
|
|
40
|
-
throw new Error(
|
|
41
|
-
`Image version '${definition.version}' is not valid semver. Expected format: x.y.z`
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
const validTargets = [
|
|
45
|
-
"local-development",
|
|
46
|
-
"cloud-production",
|
|
47
|
-
"edge-serverless",
|
|
48
|
-
"embedded-iot",
|
|
49
|
-
"enterprise",
|
|
50
|
-
"custom"
|
|
51
|
-
];
|
|
52
|
-
if (definition.target && !validTargets.includes(definition.target)) {
|
|
53
|
-
throw new Error(
|
|
54
|
-
`Invalid target '${definition.target}'. Valid targets: ${validTargets.join(", ")}`
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
const hasProviders = definition.providers && Object.values(definition.providers).some((config) => config !== void 0);
|
|
58
|
-
if (!hasProviders && !definition.extends) {
|
|
59
|
-
throw new Error(
|
|
60
|
-
"Image must either define at least one provider category or extend a base image"
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
for (const [category, config] of Object.entries(definition.providers)) {
|
|
64
|
-
if (!config) continue;
|
|
65
|
-
if (!config.providers && !config.register) {
|
|
66
|
-
throw new Error(
|
|
67
|
-
`Provider category '${category}' must have either 'providers' array or 'register' function`
|
|
68
|
-
);
|
|
69
|
-
}
|
|
70
|
-
if (config.providers && !Array.isArray(config.providers)) {
|
|
71
|
-
throw new Error(`Provider category '${category}' providers must be an array`);
|
|
72
|
-
}
|
|
73
|
-
if (config.register && typeof config.register !== "function") {
|
|
74
|
-
throw new Error(`Provider category '${category}' register must be a function`);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
const validConstraints = [
|
|
78
|
-
"filesystem-required",
|
|
79
|
-
"network-required",
|
|
80
|
-
"offline-capable",
|
|
81
|
-
"serverless-compatible",
|
|
82
|
-
"cold-start-optimized",
|
|
83
|
-
"low-memory",
|
|
84
|
-
"edge-compatible",
|
|
85
|
-
"browser-compatible"
|
|
86
|
-
];
|
|
87
|
-
if (definition.constraints) {
|
|
88
|
-
if (!Array.isArray(definition.constraints)) {
|
|
89
|
-
throw new Error("Image constraints must be an array");
|
|
90
|
-
}
|
|
91
|
-
for (const constraint of definition.constraints) {
|
|
92
|
-
if (!validConstraints.includes(constraint)) {
|
|
93
|
-
throw new Error(
|
|
94
|
-
`Invalid constraint '${constraint}'. Valid constraints: ${validConstraints.join(", ")}`
|
|
95
|
-
);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
if (definition.utils) {
|
|
100
|
-
for (const [name, path] of Object.entries(definition.utils)) {
|
|
101
|
-
if (typeof path !== "string") {
|
|
102
|
-
throw new Error(`Utility '${name}' path must be a string`);
|
|
103
|
-
}
|
|
104
|
-
if (!path.startsWith("./")) {
|
|
105
|
-
throw new Error(
|
|
106
|
-
`Utility '${name}' path must be relative (start with './'). Got: ${path}`
|
|
107
|
-
);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
if (definition.extends) {
|
|
112
|
-
if (typeof definition.extends !== "string") {
|
|
113
|
-
throw new Error("Image extends must be a string (parent image name)");
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
export {
|
|
118
|
-
defineImage,
|
|
119
|
-
defineProviderCategory,
|
|
120
|
-
validateImageDefinition
|
|
121
|
-
};
|