veryfront 0.1.1239 → 0.1.1241
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/esm/cli/commands/build/command-help.d.ts.map +1 -1
- package/esm/cli/commands/build/command-help.js +4 -0
- package/esm/cli/commands/build/command.d.ts +3 -1
- package/esm/cli/commands/build/command.d.ts.map +1 -1
- package/esm/cli/commands/build/command.js +13 -5
- package/esm/cli/commands/build/handler.d.ts +17 -0
- package/esm/cli/commands/build/handler.d.ts.map +1 -1
- package/esm/cli/commands/build/handler.js +188 -9
- package/esm/cli/commands/generate/command.d.ts.map +1 -1
- package/esm/cli/commands/generate/command.js +40 -0
- package/esm/cli/commands/push/command.d.ts.map +1 -1
- package/esm/cli/commands/push/command.js +24 -16
- package/esm/cli/shared/ensure-content-processor.d.ts +16 -1
- package/esm/cli/shared/ensure-content-processor.d.ts.map +1 -1
- package/esm/cli/shared/ensure-content-processor.js +39 -5
- package/esm/cli/shared/project-creation.d.ts.map +1 -1
- package/esm/cli/shared/project-creation.js +29 -1
- package/esm/deno.d.ts +14 -5
- package/esm/deno.js +23 -7
- package/esm/extensions/ext-llm-openai/src/openai-chat-stream.d.ts.map +1 -1
- package/esm/extensions/ext-llm-openai/src/openai-chat-stream.js +16 -6
- package/esm/extensions/ext-llm-openai/src/openai-provider.d.ts.map +1 -1
- package/esm/extensions/ext-llm-openai/src/openai-provider.js +11 -2
- package/esm/extensions/ext-llm-openai/src/openai-reasoning-models.d.ts +2 -14
- package/esm/extensions/ext-llm-openai/src/openai-reasoning-models.d.ts.map +1 -1
- package/esm/extensions/ext-llm-openai/src/openai-reasoning-models.js +1 -72
- package/esm/extensions/ext-schema-zod/src/adapter.d.ts.map +1 -1
- package/esm/src/agent/ag-ui/browser-aliases.d.ts +164 -0
- package/esm/src/agent/ag-ui/browser-aliases.d.ts.map +1 -0
- package/esm/src/agent/ag-ui/browser-aliases.js +68 -0
- package/esm/src/agent/ag-ui/chat-ui-chunk-encoder.d.ts +35 -0
- package/esm/src/agent/ag-ui/chat-ui-chunk-encoder.d.ts.map +1 -0
- package/esm/src/agent/ag-ui/{chat-ui-chunk-browser-encoder.js → chat-ui-chunk-encoder.js} +11 -11
- package/esm/src/agent/ag-ui/chunk-encoder-bridge.d.ts +8 -6
- package/esm/src/agent/ag-ui/chunk-encoder-bridge.d.ts.map +1 -1
- package/esm/src/agent/ag-ui/chunk-encoder-bridge.js +5 -4
- package/esm/src/agent/ag-ui/chunk-encoder.d.ts +26 -0
- package/esm/src/agent/ag-ui/chunk-encoder.d.ts.map +1 -0
- package/esm/src/agent/ag-ui/{browser-chunk-encoder.js → chunk-encoder.js} +3 -2
- package/esm/src/agent/ag-ui/{browser-encoder.d.ts → encoder.d.ts} +33 -19
- package/esm/src/agent/ag-ui/encoder.d.ts.map +1 -0
- package/esm/src/agent/ag-ui/{browser-encoder.js → encoder.js} +81 -27
- package/esm/src/agent/ag-ui/finalize-tracker.d.ts +15 -0
- package/esm/src/agent/ag-ui/finalize-tracker.d.ts.map +1 -0
- package/esm/src/agent/ag-ui/{browser-finalize-tracker.js → finalize-tracker.js} +4 -4
- package/esm/src/agent/ag-ui/response-stream.d.ts +36 -0
- package/esm/src/agent/ag-ui/response-stream.d.ts.map +1 -0
- package/esm/src/agent/ag-ui/{browser-response-stream.js → response-stream.js} +6 -3
- package/esm/src/agent/ag-ui/runtime-chat-stream-encoder.d.ts +1 -1
- package/esm/src/agent/ag-ui/runtime-chat-stream-encoder.d.ts.map +1 -1
- package/esm/src/agent/ag-ui/runtime-event-encoder.d.ts +7 -7
- package/esm/src/agent/ag-ui/runtime-event-encoder.d.ts.map +1 -1
- package/esm/src/agent/ag-ui/runtime-event-encoder.js +4 -4
- package/esm/src/agent/ag-ui/runtime-response.d.ts +20 -0
- package/esm/src/agent/ag-ui/runtime-response.d.ts.map +1 -0
- package/esm/src/agent/ag-ui/runtime-response.js +16 -0
- package/esm/src/agent/ag-ui/sse-parser.d.ts +1 -1
- package/esm/src/agent/ag-ui/sse-parser.d.ts.map +1 -1
- package/esm/src/agent/ag-ui/sse-parser.js +3 -3
- package/esm/src/agent/ag-ui/tracked-response.d.ts +11 -0
- package/esm/src/agent/ag-ui/tracked-response.d.ts.map +1 -0
- package/esm/src/agent/ag-ui/{tracked-browser-response.js → tracked-response.js} +6 -4
- package/esm/src/agent/conversation/hosted-lifecycle.d.ts.map +1 -1
- package/esm/src/agent/conversation/hosted-lifecycle.js +2 -1
- package/esm/src/agent/conversation/lifecycle-run-event-adapter.d.ts.map +1 -1
- package/esm/src/agent/conversation/lifecycle-run-event-adapter.js +2 -0
- package/esm/src/agent/conversation/private-run-event.d.ts.map +1 -1
- package/esm/src/agent/conversation/private-run-event.js +174 -3
- package/esm/src/agent/conversation/run-chunk-mirror.d.ts +2 -0
- package/esm/src/agent/conversation/run-chunk-mirror.d.ts.map +1 -1
- package/esm/src/agent/conversation/run-chunk-mirror.js +13 -6
- package/esm/src/agent/conversation/run-events.d.ts +8 -0
- package/esm/src/agent/conversation/run-events.d.ts.map +1 -1
- package/esm/src/agent/conversation/run-events.js +54 -4
- package/esm/src/agent/conversation/run-stream-mirror.d.ts.map +1 -1
- package/esm/src/agent/conversation/run-stream-mirror.js +5 -2
- package/esm/src/agent/hosted/durable-run-event-sink.d.ts +2 -1
- package/esm/src/agent/hosted/durable-run-event-sink.d.ts.map +1 -1
- package/esm/src/agent/hosted/durable-run-event-sink.js +9 -7
- package/esm/src/agent/hosted/prepared-chat-execution.js +2 -2
- package/esm/src/agent/index.d.ts +9 -8
- package/esm/src/agent/index.d.ts.map +1 -1
- package/esm/src/agent/index.js +9 -8
- package/esm/src/agent/memory/memory.d.ts.map +1 -1
- package/esm/src/agent/memory/memory.js +7 -6
- package/esm/src/agent/react/use-chat/types.d.ts +2 -0
- package/esm/src/agent/react/use-chat/types.d.ts.map +1 -1
- package/esm/src/agent/react/use-chat/use-chat.js +3 -2
- package/esm/src/agent/runtime/ag-ui-contract.d.ts +2 -2
- package/esm/src/agent/runtime/ag-ui-contract.d.ts.map +1 -1
- package/esm/src/agent/runtime/ag-ui-contract.js +2 -2
- package/esm/src/agent/runtime/chat-stream-handler.d.ts.map +1 -1
- package/esm/src/agent/runtime/chat-stream-handler.js +34 -4
- package/esm/src/agent/runtime/index.d.ts.map +1 -1
- package/esm/src/agent/runtime/index.js +15 -6
- package/esm/src/agent/streaming/data-stream.d.ts +1 -1
- package/esm/src/agent/streaming/data-stream.d.ts.map +1 -1
- package/esm/src/agent/streaming/fork-runtime-part-mapper.d.ts +1 -1
- package/esm/src/agent/streaming/fork-runtime-part-mapper.d.ts.map +1 -1
- package/esm/src/agent/streaming/lifecycle/live-adapter.d.ts.map +1 -1
- package/esm/src/agent/streaming/lifecycle/live-adapter.js +2 -0
- package/esm/src/agent/streaming/lifecycle/reducer.d.ts.map +1 -1
- package/esm/src/agent/streaming/lifecycle/reducer.js +7 -0
- package/esm/src/agent/streaming/lifecycle/runtime-provider-adapter.js +4 -0
- package/esm/src/build/production-build/templates.d.ts.map +1 -1
- package/esm/src/build/production-build/templates.js +1 -1
- package/esm/src/cache/request-cache-batcher.d.ts +1 -0
- package/esm/src/cache/request-cache-batcher.d.ts.map +1 -1
- package/esm/src/cache/request-cache-batcher.js +21 -7
- package/esm/src/chat/ag-ui.d.ts +1 -1
- package/esm/src/chat/index.d.ts +2 -2
- package/esm/src/chat/index.d.ts.map +1 -1
- package/esm/src/chat/index.js +1 -1
- package/esm/src/config/config-shim.d.ts +1 -1
- package/esm/src/config/config-shim.d.ts.map +1 -1
- package/esm/src/config/config-shim.js +1 -1
- package/esm/src/config/declarative-evaluator-worker-protocol.d.ts.map +1 -1
- package/esm/src/config/env.js +1 -1
- package/esm/src/config/environment-config.js +1 -1
- package/esm/src/config/loader.d.ts.map +1 -1
- package/esm/src/config/loader.js +4 -4
- package/esm/src/config/schemas/config.schema.d.ts +20 -0
- package/esm/src/config/schemas/config.schema.d.ts.map +1 -1
- package/esm/src/config/schemas/config.schema.js +27 -0
- package/esm/src/config/server-external-packages.d.ts +11 -0
- package/esm/src/config/server-external-packages.d.ts.map +1 -0
- package/esm/src/config/server-external-packages.js +53 -0
- package/esm/src/data/data-fetcher.d.ts.map +1 -1
- package/esm/src/data/data-fetcher.js +9 -4
- package/esm/src/data/data-result-validation.d.ts +5 -0
- package/esm/src/data/data-result-validation.d.ts.map +1 -0
- package/esm/src/data/data-result-validation.js +56 -0
- package/esm/src/data/helpers.d.ts +5 -5
- package/esm/src/data/helpers.d.ts.map +1 -1
- package/esm/src/data/helpers.js +22 -68
- package/esm/src/data/index.d.ts +1 -1
- package/esm/src/data/index.d.ts.map +1 -1
- package/esm/src/data/response-metadata.d.ts +23 -0
- package/esm/src/data/response-metadata.d.ts.map +1 -0
- package/esm/src/data/response-metadata.js +311 -0
- package/esm/src/data/schemas/data.schema.d.ts +95 -6
- package/esm/src/data/schemas/data.schema.d.ts.map +1 -1
- package/esm/src/data/schemas/data.schema.js +57 -3
- package/esm/src/data/schemas/index.d.ts +1 -1
- package/esm/src/data/schemas/index.d.ts.map +1 -1
- package/esm/src/data/schemas/index.js +1 -1
- package/esm/src/data/server-data-fetcher.d.ts.map +1 -1
- package/esm/src/data/server-data-fetcher.js +5 -5
- package/esm/src/data/static-data-fetcher.d.ts +2 -2
- package/esm/src/data/static-data-fetcher.d.ts.map +1 -1
- package/esm/src/data/static-data-fetcher.js +6 -3
- package/esm/src/data/types.d.ts +1 -1
- package/esm/src/data/types.d.ts.map +1 -1
- package/esm/src/discovery/discovery-engine.d.ts.map +1 -1
- package/esm/src/discovery/discovery-engine.js +81 -26
- package/esm/src/discovery/handlers/task-handler.d.ts +1 -1
- package/esm/src/discovery/handlers/task-handler.d.ts.map +1 -1
- package/esm/src/discovery/handlers/task-handler.js +6 -3
- package/esm/src/discovery/types.d.ts +6 -4
- package/esm/src/discovery/types.d.ts.map +1 -1
- package/esm/src/errors/error-registry/runtime.d.ts +2 -0
- package/esm/src/errors/error-registry/runtime.d.ts.map +1 -1
- package/esm/src/errors/error-registry/runtime.js +8 -0
- package/esm/src/errors/error-registry.d.ts +1 -0
- package/esm/src/errors/error-registry.d.ts.map +1 -1
- package/esm/src/errors/index.d.ts +1 -1
- package/esm/src/errors/index.d.ts.map +1 -1
- package/esm/src/errors/index.js +1 -1
- package/esm/src/errors/user-friendly/error-wrapper.js +1 -1
- package/esm/src/errors/veryfront-error.d.ts.map +1 -1
- package/esm/src/extensions/index.d.ts +2 -0
- package/esm/src/extensions/index.d.ts.map +1 -1
- package/esm/src/extensions/index.js +1 -0
- package/esm/src/extensions/parser/code-parser.d.ts +9 -0
- package/esm/src/extensions/parser/code-parser.d.ts.map +1 -1
- package/esm/src/extensions/parser/defaults.d.ts +5 -0
- package/esm/src/extensions/parser/defaults.d.ts.map +1 -1
- package/esm/src/extensions/parser/defaults.js +23 -11
- package/esm/src/fs/index.d.ts +50 -1
- package/esm/src/fs/index.d.ts.map +1 -1
- package/esm/src/fs/index.js +50 -1
- package/esm/src/html/html-injection.d.ts +2 -0
- package/esm/src/html/html-injection.d.ts.map +1 -1
- package/esm/src/html/html-injection.js +4 -1
- package/esm/src/html/html-shell-generator.d.ts.map +1 -1
- package/esm/src/html/html-shell-generator.js +11 -3
- package/esm/src/html/hydration-script-builder/hydration-runtime.generated.d.ts.map +1 -1
- package/esm/src/html/hydration-script-builder/hydration-runtime.generated.js +1 -1
- package/esm/src/html/hydration-script-builder/prod-runtime-selection.d.ts +23 -0
- package/esm/src/html/hydration-script-builder/prod-runtime-selection.d.ts.map +1 -0
- package/esm/src/html/hydration-script-builder/prod-runtime-selection.js +55 -0
- package/esm/src/html/hydration-script-builder/prod-scripts.d.ts +2 -0
- package/esm/src/html/hydration-script-builder/prod-scripts.d.ts.map +1 -1
- package/esm/src/html/hydration-script-builder/prod-scripts.js +12 -3
- package/esm/src/html/schemas/html.schema.d.ts +2 -0
- package/esm/src/html/schemas/html.schema.d.ts.map +1 -1
- package/esm/src/html/schemas/html.schema.js +2 -0
- package/esm/src/html/styles-builder/css-hash-cache.d.ts +1 -1
- package/esm/src/html/styles-builder/css-hash-cache.d.ts.map +1 -1
- package/esm/src/html/styles-builder/css-hash-cache.js +1 -1
- package/esm/src/index.client.d.ts +2 -2
- package/esm/src/index.client.d.ts.map +1 -1
- package/esm/src/index.client.js +3 -1
- package/esm/src/index.d.ts +1 -1
- package/esm/src/index.d.ts.map +1 -1
- package/esm/src/internal-agents/ag-ui-sse.d.ts +7 -7
- package/esm/src/internal-agents/ag-ui-sse.d.ts.map +1 -1
- package/esm/src/internal-agents/ag-ui-sse.js +17 -9
- package/esm/src/internal-agents/control-plane-auth.js +1 -1
- package/esm/src/internal-agents/run-stream.d.ts.map +1 -1
- package/esm/src/internal-agents/run-stream.js +15 -9
- package/esm/src/modules/import-map/loader.d.ts.map +1 -1
- package/esm/src/modules/import-map/loader.js +2 -2
- package/esm/src/modules/import-map/merger.js +2 -2
- package/esm/src/modules/import-map/preloader.js +2 -2
- package/esm/src/modules/react-loader/component-loader.d.ts.map +1 -1
- package/esm/src/modules/react-loader/component-loader.js +2 -0
- package/esm/src/modules/react-loader/ssr-module-loader/loader.d.ts +1 -1
- package/esm/src/modules/react-loader/ssr-module-loader/loader.d.ts.map +1 -1
- package/esm/src/modules/react-loader/ssr-module-loader/loader.js +3 -2
- package/esm/src/modules/react-loader/ssr-module-loader/ssr-cache-manager.d.ts.map +1 -1
- package/esm/src/modules/react-loader/ssr-module-loader/ssr-cache-manager.js +7 -1
- package/esm/src/modules/react-loader/ssr-module-loader/types.d.ts +2 -0
- package/esm/src/modules/react-loader/ssr-module-loader/types.d.ts.map +1 -1
- package/esm/src/modules/react-loader/transformed-module-coordinator.d.ts.map +1 -1
- package/esm/src/modules/react-loader/transformed-module-coordinator.js +2 -1
- package/esm/src/modules/react-loader/types.d.ts +2 -0
- package/esm/src/modules/react-loader/types.d.ts.map +1 -1
- package/esm/src/modules/server/module-response-cache.d.ts +1 -0
- package/esm/src/modules/server/module-response-cache.d.ts.map +1 -1
- package/esm/src/modules/server/module-response-cache.js +5 -0
- package/esm/src/modules/server/module-server.d.ts.map +1 -1
- package/esm/src/modules/server/module-server.js +4 -0
- package/esm/src/modules/server/module-transform.d.ts.map +1 -1
- package/esm/src/modules/server/module-transform.js +2 -0
- package/esm/src/observability/metrics/config.js +1 -1
- package/esm/src/observability/request-profiler.js +1 -1
- package/esm/src/observability/telemetry-error.js +2 -2
- package/esm/src/observability/tracing/telemetry-env.js +1 -1
- package/esm/src/platform/adapters/fs/cache/file-cache.d.ts.map +1 -1
- package/esm/src/platform/adapters/fs/cache/file-cache.js +5 -0
- package/esm/src/platform/adapters/fs/veryfront/adapter.d.ts +39 -0
- package/esm/src/platform/adapters/fs/veryfront/adapter.d.ts.map +1 -1
- package/esm/src/platform/adapters/fs/veryfront/adapter.js +209 -40
- package/esm/src/platform/adapters/fs/veryfront/file-list-index.d.ts.map +1 -1
- package/esm/src/platform/adapters/fs/veryfront/file-list-index.js +0 -14
- package/esm/src/platform/adapters/fs/veryfront/read-operations-helpers.d.ts +0 -1
- package/esm/src/platform/adapters/fs/veryfront/read-operations-helpers.d.ts.map +1 -1
- package/esm/src/platform/adapters/fs/veryfront/read-operations-helpers.js +0 -3
- package/esm/src/platform/adapters/fs/veryfront/read-operations.d.ts.map +1 -1
- package/esm/src/platform/adapters/fs/veryfront/read-operations.js +1 -4
- package/esm/src/platform/adapters/fs/veryfront/request-context.d.ts.map +1 -1
- package/esm/src/platform/adapters/fs/veryfront/request-context.js +4 -0
- package/esm/src/platform/adapters/fs/veryfront/stat-operations.d.ts.map +1 -1
- package/esm/src/platform/adapters/fs/veryfront/stat-operations.js +9 -1
- package/esm/src/platform/adapters/fs/veryfront/websocket-manager-helpers.js +1 -1
- package/esm/src/platform/adapters/fs/veryfront/websocket-manager.d.ts +2 -1
- package/esm/src/platform/adapters/fs/veryfront/websocket-manager.d.ts.map +1 -1
- package/esm/src/platform/adapters/fs/veryfront/websocket-manager.js +97 -66
- package/esm/src/platform/compat/dns.d.ts +10 -0
- package/esm/src/platform/compat/dns.d.ts.map +1 -1
- package/esm/src/platform/compat/dns.js +50 -0
- package/esm/src/platform/compat/http/pinned-fetch.d.ts +1 -1
- package/esm/src/platform/compat/process/lifecycle.d.ts +10 -0
- package/esm/src/platform/compat/process/lifecycle.d.ts.map +1 -1
- package/esm/src/platform/compat/process/lifecycle.js +23 -0
- package/esm/src/platform/compat/process.d.ts +1 -1
- package/esm/src/platform/compat/process.d.ts.map +1 -1
- package/esm/src/platform/compat/process.js +1 -1
- package/esm/src/platform/compat/proxy-topology.js +1 -1
- package/esm/src/platform/request-context-access.d.ts +24 -0
- package/esm/src/platform/request-context-access.d.ts.map +1 -0
- package/esm/src/platform/request-context-access.js +26 -0
- package/esm/src/provider/shared/openai-reasoning.d.ts +16 -0
- package/esm/src/provider/shared/openai-reasoning.d.ts.map +1 -0
- package/esm/src/provider/shared/openai-reasoning.js +73 -0
- package/esm/src/provider/types.d.ts +2 -0
- package/esm/src/provider/types.d.ts.map +1 -1
- package/esm/src/provider/veryfront-cloud/provider.d.ts.map +1 -1
- package/esm/src/provider/veryfront-cloud/provider.js +45 -18
- package/esm/src/proxy/handler.d.ts +1 -0
- package/esm/src/proxy/handler.d.ts.map +1 -1
- package/esm/src/proxy/handler.js +17 -4
- package/esm/src/proxy/proxy-error-context.d.ts +1 -0
- package/esm/src/proxy/proxy-error-context.d.ts.map +1 -1
- package/esm/src/proxy/proxy-error-context.js +1 -0
- package/esm/src/proxy/request-host.d.ts +3 -0
- package/esm/src/proxy/request-host.d.ts.map +1 -1
- package/esm/src/proxy/request-host.js +28 -8
- package/esm/src/proxy/routing-invalidation-redis.d.ts.map +1 -1
- package/esm/src/proxy/routing-invalidation-redis.js +38 -4
- package/esm/src/react/components/chat/chat/components/attachments-panel.d.ts +27 -3
- package/esm/src/react/components/chat/chat/components/attachments-panel.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/components/attachments-panel.js +29 -7
- package/esm/src/react/components/chat/chat/components/sidebar.d.ts +15 -6
- package/esm/src/react/components/chat/chat/components/sidebar.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/components/sidebar.js +37 -4
- package/esm/src/react/components/chat/chat/components/sidebar.types.d.ts +12 -1
- package/esm/src/react/components/chat/chat/components/sidebar.types.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/composition/chat-composer.d.ts +3 -1
- package/esm/src/react/components/chat/chat/composition/chat-composer.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/composition/chat-composer.js +17 -6
- package/esm/src/react/components/chat/chat/composition/chat-composer.types.d.ts +12 -5
- package/esm/src/react/components/chat/chat/composition/chat-composer.types.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/composition/chat-root.d.ts +18 -5
- package/esm/src/react/components/chat/chat/composition/chat-root.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/composition/chat-root.js +65 -1
- package/esm/src/react/components/chat/chat/composition/use-composer-value.d.ts +6 -3
- package/esm/src/react/components/chat/chat/composition/use-composer-value.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/composition/use-composer-value.js +56 -5
- package/esm/src/react/components/chat/chat/contexts/chat-context.d.ts +7 -1
- package/esm/src/react/components/chat/chat/contexts/chat-context.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/contexts/conversations-context.d.ts +14 -4
- package/esm/src/react/components/chat/chat/contexts/conversations-context.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/contexts/conversations-context.js +10 -1
- package/esm/src/react/components/chat/chat/index.d.ts +1 -1
- package/esm/src/react/components/chat/chat/index.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/persistence/conversation-codec.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat.d.ts +1 -1
- package/esm/src/react/components/chat/chat.d.ts.map +1 -1
- package/esm/src/react/server-render-context.d.ts.map +1 -1
- package/esm/src/release-assets/dependency-artifact-builder.d.ts.map +1 -1
- package/esm/src/rendering/app-reserved.d.ts +2 -2
- package/esm/src/rendering/app-reserved.d.ts.map +1 -1
- package/esm/src/rendering/app-reserved.js +4 -3
- package/esm/src/rendering/cache/cache-coordinator.d.ts.map +1 -1
- package/esm/src/rendering/cache/cache-coordinator.js +1 -0
- package/esm/src/rendering/cache/cache-payload.d.ts.map +1 -1
- package/esm/src/rendering/cache/cache-payload.js +44 -0
- package/esm/src/rendering/component-handling.d.ts +4 -1
- package/esm/src/rendering/component-handling.d.ts.map +1 -1
- package/esm/src/rendering/component-handling.js +13 -6
- package/esm/src/rendering/layouts/layout-applicator.d.ts.map +1 -1
- package/esm/src/rendering/layouts/layout-applicator.js +3 -1
- package/esm/src/rendering/layouts/layout-collector.d.ts +1 -0
- package/esm/src/rendering/layouts/layout-collector.d.ts.map +1 -1
- package/esm/src/rendering/layouts/layout-collector.js +201 -4
- package/esm/src/rendering/layouts/utils/applicator.d.ts +1 -1
- package/esm/src/rendering/layouts/utils/applicator.d.ts.map +1 -1
- package/esm/src/rendering/layouts/utils/applicator.js +3 -3
- package/esm/src/rendering/layouts/utils/component-loader.d.ts +2 -2
- package/esm/src/rendering/layouts/utils/component-loader.d.ts.map +1 -1
- package/esm/src/rendering/layouts/utils/component-loader.js +12 -4
- package/esm/src/rendering/orchestrator/file-resolver/index.d.ts +3 -1
- package/esm/src/rendering/orchestrator/file-resolver/index.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/file-resolver/index.js +13 -5
- package/esm/src/rendering/orchestrator/html.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/html.js +26 -10
- package/esm/src/rendering/orchestrator/layout.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/layout.js +2 -2
- package/esm/src/rendering/orchestrator/module-loader/dependency-resolver.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/module-loader/dependency-resolver.js +20 -2
- package/esm/src/rendering/orchestrator/module-loader/index.d.ts +2 -0
- package/esm/src/rendering/orchestrator/module-loader/index.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/module-loader/index.js +6 -3
- package/esm/src/rendering/orchestrator/module-loader/module-cache-lookup.d.ts +3 -2
- package/esm/src/rendering/orchestrator/module-loader/module-cache-lookup.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/module-loader/module-cache-lookup.js +6 -6
- package/esm/src/rendering/orchestrator/module-loader/module-persistence.d.ts +1 -0
- package/esm/src/rendering/orchestrator/module-loader/module-persistence.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/module-loader/module-persistence.js +2 -2
- package/esm/src/rendering/orchestrator/module-loader/module-transform-cache.d.ts +2 -0
- package/esm/src/rendering/orchestrator/module-loader/module-transform-cache.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/module-loader/module-transform-cache.js +7 -1
- package/esm/src/rendering/orchestrator/pipeline.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/pipeline.js +58 -10
- package/esm/src/rendering/orchestrator/render-result-assembly.d.ts +3 -0
- package/esm/src/rendering/orchestrator/render-result-assembly.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/render-result-assembly.js +3 -1
- package/esm/src/rendering/page-renderer.d.ts +2 -0
- package/esm/src/rendering/page-renderer.d.ts.map +1 -1
- package/esm/src/rendering/page-renderer.js +4 -1
- package/esm/src/rendering/page-rendering.d.ts +2 -0
- package/esm/src/rendering/page-rendering.d.ts.map +1 -1
- package/esm/src/rendering/page-rendering.js +1 -0
- package/esm/src/rendering/renderer.d.ts.map +1 -1
- package/esm/src/rendering/renderer.js +31 -1
- package/esm/src/rendering/script-page-handling.d.ts +2 -0
- package/esm/src/rendering/script-page-handling.d.ts.map +1 -1
- package/esm/src/rendering/script-page-handling.js +17 -1
- package/esm/src/rendering/shared/context-aware-cache.d.ts.map +1 -1
- package/esm/src/rendering/shared/context-aware-cache.js +3 -0
- package/esm/src/rendering/snippet-renderer.d.ts +10 -0
- package/esm/src/rendering/snippet-renderer.d.ts.map +1 -1
- package/esm/src/rendering/snippet-renderer.js +40 -18
- package/esm/src/rendering/ssr/component-registry.d.ts +1 -1
- package/esm/src/rendering/ssr/component-registry.d.ts.map +1 -1
- package/esm/src/rendering/ssr/component-registry.js +13 -6
- package/esm/src/rendering/ssr-outcome.d.ts +4 -3
- package/esm/src/rendering/ssr-outcome.d.ts.map +1 -1
- package/esm/src/rendering/ssr-outcome.js +25 -8
- package/esm/src/routing/api/handler.d.ts +1 -1
- package/esm/src/routing/api/handler.d.ts.map +1 -1
- package/esm/src/routing/api/handler.js +6 -1
- package/esm/src/runtime/model-call-context.d.ts +37 -2
- package/esm/src/runtime/model-call-context.d.ts.map +1 -1
- package/esm/src/runtime/model-call-context.js +42 -1
- package/esm/src/runtime/runtime-bridge.d.ts.map +1 -1
- package/esm/src/runtime/runtime-bridge.js +108 -8
- package/esm/src/sandbox/shell-tools.d.ts.map +1 -1
- package/esm/src/sandbox/shell-tools.js +16 -6
- package/esm/src/schedule/validation.d.ts +9 -1
- package/esm/src/schedule/validation.d.ts.map +1 -1
- package/esm/src/schedule/validation.js +167 -80
- package/esm/src/schemas/json-value.d.ts.map +1 -1
- package/esm/src/schemas/json-value.js +81 -37
- package/esm/src/security/http/base-handler.js +1 -1
- package/esm/src/security/sandbox/project-worker.d.ts +1 -0
- package/esm/src/security/sandbox/project-worker.d.ts.map +1 -1
- package/esm/src/security/sandbox/project-worker.js +6 -0
- package/esm/src/security/sandbox/worker-read-scope.d.ts +20 -0
- package/esm/src/security/sandbox/worker-read-scope.d.ts.map +1 -0
- package/esm/src/security/sandbox/worker-read-scope.js +127 -0
- package/esm/src/security/sandbox/worker-types.d.ts +12 -0
- package/esm/src/security/sandbox/worker-types.d.ts.map +1 -1
- package/esm/src/server/handlers/dev/dashboard/api.d.ts.map +1 -1
- package/esm/src/server/handlers/dev/dashboard/api.js +70 -3
- package/esm/src/server/handlers/dev/files/esbuild-plugins.d.ts +5 -0
- package/esm/src/server/handlers/dev/files/esbuild-plugins.d.ts.map +1 -1
- package/esm/src/server/handlers/dev/files/esbuild-plugins.js +61 -3
- package/esm/src/server/handlers/dev/framework-candidates.generated.d.ts.map +1 -1
- package/esm/src/server/handlers/dev/framework-candidates.generated.js +227 -29
- package/esm/src/server/handlers/request/api/pages-api-handler.d.ts.map +1 -1
- package/esm/src/server/handlers/request/api/pages-api-handler.js +20 -2
- package/esm/src/server/handlers/request/module/page-data-endpoint-handler.d.ts.map +1 -1
- package/esm/src/server/handlers/request/module/page-data-endpoint-handler.js +32 -15
- package/esm/src/server/handlers/request/prod-hydration-module.handler.d.ts.map +1 -1
- package/esm/src/server/handlers/request/prod-hydration-module.handler.js +10 -3
- package/esm/src/server/handlers/request/project-run-execute.handler.d.ts.map +1 -1
- package/esm/src/server/handlers/request/project-run-execute.handler.js +1 -0
- package/esm/src/server/handlers/request/snippet.handler.d.ts +6 -0
- package/esm/src/server/handlers/request/snippet.handler.d.ts.map +1 -1
- package/esm/src/server/handlers/request/snippet.handler.js +8 -1
- package/esm/src/server/handlers/request/ssr/error-page-fallback.js +1 -0
- package/esm/src/server/handlers/request/ssr/ssr-response-builder.d.ts.map +1 -1
- package/esm/src/server/handlers/request/ssr/ssr-response-builder.js +10 -6
- package/esm/src/server/handlers/request/ssr/ssr.handler.d.ts.map +1 -1
- package/esm/src/server/handlers/request/ssr/ssr.handler.js +22 -10
- package/esm/src/server/handlers/request/static.handler.d.ts.map +1 -1
- package/esm/src/server/handlers/request/static.handler.js +1 -0
- package/esm/src/server/runtime-handler/handler-context-builder.d.ts +2 -0
- package/esm/src/server/runtime-handler/handler-context-builder.d.ts.map +1 -1
- package/esm/src/server/runtime-handler/handler-context-builder.js +1 -0
- package/esm/src/server/runtime-handler/project-runtime-context.d.ts.map +1 -1
- package/esm/src/server/runtime-handler/project-runtime-context.js +6 -2
- package/esm/src/server/runtime-handler/request-tracker.d.ts.map +1 -1
- package/esm/src/server/runtime-handler/request-tracker.js +10 -3
- package/esm/src/server/services/rendering/ssr.service.d.ts +5 -0
- package/esm/src/server/services/rendering/ssr.service.d.ts.map +1 -1
- package/esm/src/server/services/rendering/ssr.service.js +71 -16
- package/esm/src/server/services/rsc/endpoints/rsc-bundles.generated.d.ts.map +1 -1
- package/esm/src/server/services/rsc/endpoints/rsc-bundles.generated.js +2 -2
- package/esm/src/server/services/rsc/orchestrators/handler.d.ts.map +1 -1
- package/esm/src/server/services/rsc/orchestrators/handler.js +1 -0
- package/esm/src/server/services/rsc/orchestrators/render-handler.d.ts +1 -0
- package/esm/src/server/services/rsc/orchestrators/render-handler.d.ts.map +1 -1
- package/esm/src/server/services/rsc/orchestrators/render-handler.js +2 -0
- package/esm/src/server/services/static/static-file.service.d.ts +4 -1
- package/esm/src/server/services/static/static-file.service.d.ts.map +1 -1
- package/esm/src/server/services/static/static-file.service.js +48 -22
- package/esm/src/server/shared/browser-module-bundler.d.ts.map +1 -1
- package/esm/src/server/shared/browser-module-bundler.js +10 -0
- package/esm/src/server/utils/request-host.d.ts +6 -0
- package/esm/src/server/utils/request-host.d.ts.map +1 -1
- package/esm/src/server/utils/request-host.js +42 -1
- package/esm/src/skill/tools.d.ts.map +1 -1
- package/esm/src/task/definition-snapshot.d.ts +8 -0
- package/esm/src/task/definition-snapshot.d.ts.map +1 -0
- package/esm/src/task/definition-snapshot.js +154 -0
- package/esm/src/task/discovery.d.ts.map +1 -1
- package/esm/src/task/discovery.js +47 -21
- package/esm/src/task/types.d.ts +3 -0
- package/esm/src/task/types.d.ts.map +1 -1
- package/esm/src/task/types.js +7 -16
- package/esm/src/tool/remote-mcp.d.ts.map +1 -1
- package/esm/src/tool/remote-mcp.js +86 -5
- package/esm/src/transforms/esm/bundle-recovery.d.ts.map +1 -1
- package/esm/src/transforms/esm/bundle-recovery.js +1 -0
- package/esm/src/transforms/esm/http-cache-helpers.d.ts +3 -1
- package/esm/src/transforms/esm/http-cache-helpers.d.ts.map +1 -1
- package/esm/src/transforms/esm/http-cache-helpers.js +18 -2
- package/esm/src/transforms/esm/http-cache-wrapper.d.ts.map +1 -1
- package/esm/src/transforms/esm/http-cache-wrapper.js +23 -0
- package/esm/src/transforms/esm/specifier-resolver.d.ts.map +1 -1
- package/esm/src/transforms/esm/specifier-resolver.js +2 -1
- package/esm/src/transforms/esm/types.d.ts +2 -0
- package/esm/src/transforms/esm/types.d.ts.map +1 -1
- package/esm/src/transforms/import-rewriter/commonjs-policy.d.ts +22 -0
- package/esm/src/transforms/import-rewriter/commonjs-policy.d.ts.map +1 -0
- package/esm/src/transforms/import-rewriter/commonjs-policy.js +75 -0
- package/esm/src/transforms/import-rewriter/core.d.ts.map +1 -1
- package/esm/src/transforms/import-rewriter/core.js +29 -1
- package/esm/src/transforms/import-rewriter/ssr-adapter.d.ts +2 -0
- package/esm/src/transforms/import-rewriter/ssr-adapter.d.ts.map +1 -1
- package/esm/src/transforms/import-rewriter/ssr-adapter.js +79 -10
- package/esm/src/transforms/import-rewriter/strategies/bare-strategy.d.ts.map +1 -1
- package/esm/src/transforms/import-rewriter/strategies/bare-strategy.js +14 -4
- package/esm/src/transforms/import-rewriter/types.d.ts +2 -0
- package/esm/src/transforms/import-rewriter/types.d.ts.map +1 -1
- package/esm/src/transforms/import-rewriter/url-builder.d.ts +2 -19
- package/esm/src/transforms/import-rewriter/url-builder.d.ts.map +1 -1
- package/esm/src/transforms/import-rewriter/url-builder.js +2 -67
- package/esm/src/transforms/mdx/esm-module-loader/import-transformer.d.ts +3 -2
- package/esm/src/transforms/mdx/esm-module-loader/import-transformer.d.ts.map +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/import-transformer.js +39 -8
- package/esm/src/transforms/mdx/esm-module-loader/jsx/runtime-loader.d.ts.map +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/jsx/runtime-loader.js +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/loader-helpers.d.ts.map +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/loader-helpers.js +1 -0
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/cache-keys.d.ts +3 -3
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/cache-keys.d.ts.map +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/cache-keys.js +14 -6
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/distributed-cache.d.ts +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/distributed-cache.d.ts.map +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/distributed-cache.js +2 -1
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/http-fallback.d.ts +1 -0
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/http-fallback.d.ts.map +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/http-fallback.js +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/index.d.ts +1 -0
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/index.d.ts.map +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/index.js +6 -3
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/module-cache.d.ts +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/module-cache.d.ts.map +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/module-cache.js +2 -2
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/persistence.d.ts +1 -0
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/persistence.d.ts.map +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/persistence.js +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/source-transform.d.ts +1 -0
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/source-transform.d.ts.map +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/source-transform.js +2 -0
- package/esm/src/transforms/mdx/esm-module-loader/module-writer.d.ts +2 -2
- package/esm/src/transforms/mdx/esm-module-loader/module-writer.d.ts.map +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/module-writer.js +15 -7
- package/esm/src/transforms/mdx/esm-module-loader/types.d.ts +4 -0
- package/esm/src/transforms/mdx/esm-module-loader/types.d.ts.map +1 -1
- package/esm/src/transforms/mdx/index.d.ts +1 -0
- package/esm/src/transforms/mdx/index.d.ts.map +1 -1
- package/esm/src/transforms/mdx/index.js +2 -1
- package/esm/src/transforms/pipeline/cache-identity.d.ts +1 -0
- package/esm/src/transforms/pipeline/cache-identity.d.ts.map +1 -1
- package/esm/src/transforms/pipeline/cache-identity.js +15 -0
- package/esm/src/transforms/pipeline/context.d.ts.map +1 -1
- package/esm/src/transforms/pipeline/context.js +2 -0
- package/esm/src/transforms/pipeline/index.d.ts.map +1 -1
- package/esm/src/transforms/pipeline/index.js +1 -0
- package/esm/src/transforms/pipeline/stages/resolve-imports.d.ts.map +1 -1
- package/esm/src/transforms/pipeline/stages/resolve-imports.js +1 -0
- package/esm/src/transforms/pipeline/stages/ssr-http-cache.d.ts.map +1 -1
- package/esm/src/transforms/pipeline/stages/ssr-http-cache.js +1 -0
- package/esm/src/transforms/pipeline/types.d.ts +4 -0
- package/esm/src/transforms/pipeline/types.d.ts.map +1 -1
- package/esm/src/transforms/shared/esm-sh-specifier.d.ts +18 -0
- package/esm/src/transforms/shared/esm-sh-specifier.d.ts.map +1 -0
- package/esm/src/transforms/shared/esm-sh-specifier.js +253 -0
- package/esm/src/transforms/shared/package-specifier.d.ts.map +1 -1
- package/esm/src/transforms/shared/package-specifier.js +9 -2
- package/esm/src/transforms/shared/server-only-packages.d.ts +25 -1
- package/esm/src/transforms/shared/server-only-packages.d.ts.map +1 -1
- package/esm/src/transforms/shared/server-only-packages.js +176 -4
- package/esm/src/types/entities/getEntityInfo.d.ts.map +1 -1
- package/esm/src/types/index.d.ts +5 -0
- package/esm/src/types/index.d.ts.map +1 -1
- package/esm/src/types/server.d.ts +6 -0
- package/esm/src/types/server.d.ts.map +1 -1
- package/esm/src/utils/env-loader.d.ts.map +1 -1
- package/esm/src/utils/env-loader.js +2 -1
- package/esm/src/utils/feature-flags.js +1 -1
- package/esm/src/utils/lru-wrapper.js +2 -2
- package/esm/src/utils/memory/profiler.d.ts +20 -0
- package/esm/src/utils/memory/profiler.d.ts.map +1 -1
- package/esm/src/utils/memory/profiler.js +43 -5
- package/esm/src/utils/perf-timer.js +1 -1
- package/esm/src/utils/redirect-policy.d.ts +18 -0
- package/esm/src/utils/redirect-policy.d.ts.map +1 -0
- package/esm/src/utils/redirect-policy.js +92 -0
- package/esm/src/utils/redis-client.d.ts.map +1 -1
- package/esm/src/utils/redis-client.js +6 -3
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/esm/src/workflow/claude-code/tool.d.ts +27 -27
- package/esm/src/workflow/claude-code/tool.d.ts.map +1 -1
- package/esm/src/workflow/claude-code/wire-protocol.d.ts.map +1 -1
- package/esm/src/workflow/dsl/workflow.d.ts +3 -0
- package/esm/src/workflow/dsl/workflow.d.ts.map +1 -1
- package/esm/src/workflow/dsl/workflow.js +2 -1
- package/esm/src/workflow/executor/workflow-definition-snapshot.d.ts.map +1 -1
- package/esm/src/workflow/executor/workflow-definition-snapshot.js +88 -39
- package/esm/src/workflow/registry.d.ts +4 -1
- package/esm/src/workflow/registry.d.ts.map +1 -1
- package/esm/src/workflow/registry.js +10 -8
- package/esm/src/workflow/types.d.ts +3 -0
- package/esm/src/workflow/types.d.ts.map +1 -1
- package/esm/templates/index.d.ts.map +1 -1
- package/esm/templates/index.js +7 -0
- package/esm/templates/manifest.generated.d.ts.map +1 -1
- package/esm/templates/manifest.generated.js +1 -1
- package/package.json +16 -9
- package/esm/src/agent/ag-ui/browser-chunk-encoder.d.ts +0 -24
- package/esm/src/agent/ag-ui/browser-chunk-encoder.d.ts.map +0 -1
- package/esm/src/agent/ag-ui/browser-encoder.d.ts.map +0 -1
- package/esm/src/agent/ag-ui/browser-finalize-tracker.d.ts +0 -15
- package/esm/src/agent/ag-ui/browser-finalize-tracker.d.ts.map +0 -1
- package/esm/src/agent/ag-ui/browser-response-stream.d.ts +0 -33
- package/esm/src/agent/ag-ui/browser-response-stream.d.ts.map +0 -1
- package/esm/src/agent/ag-ui/chat-ui-chunk-browser-encoder.d.ts +0 -35
- package/esm/src/agent/ag-ui/chat-ui-chunk-browser-encoder.d.ts.map +0 -1
- package/esm/src/agent/ag-ui/runtime-browser-response.d.ts +0 -20
- package/esm/src/agent/ag-ui/runtime-browser-response.d.ts.map +0 -1
- package/esm/src/agent/ag-ui/runtime-browser-response.js +0 -16
- package/esm/src/agent/ag-ui/tracked-browser-response.d.ts +0 -11
- package/esm/src/agent/ag-ui/tracked-browser-response.d.ts.map +0 -1
|
@@ -26,6 +26,7 @@ const MAX_REMOTE_MCP_TOOL_SCHEMA_BYTES = 16_384;
|
|
|
26
26
|
const MAX_REMOTE_MCP_TOOL_SCHEMA_DEPTH = 64;
|
|
27
27
|
const MAX_REMOTE_MCP_TOOL_SCHEMA_NODES = 4_096;
|
|
28
28
|
const MAX_REMOTE_MCP_CURSOR_LENGTH = 4_096;
|
|
29
|
+
const MAX_REMOTE_MCP_CORRELATION_ID_LENGTH = 256;
|
|
29
30
|
const UTF8_ENCODER = new TextEncoder();
|
|
30
31
|
class RemoteMCPHttpError extends Error {
|
|
31
32
|
constructor(status) {
|
|
@@ -39,9 +40,23 @@ class RemoteMCPOAuthExpiredHttpError extends RemoteMCPHttpError {
|
|
|
39
40
|
this.name = "RemoteMCPOAuthExpiredHttpError";
|
|
40
41
|
}
|
|
41
42
|
}
|
|
43
|
+
const JSON_RPC_TOOL_ERROR_RESULT = Symbol("veryfront.remote-mcp.json-rpc-tool-error");
|
|
42
44
|
function isRecord(value) {
|
|
43
45
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
44
46
|
}
|
|
47
|
+
function isJsonRpcErrorObject(value) {
|
|
48
|
+
return isRecord(value) &&
|
|
49
|
+
typeof value.code === "number" &&
|
|
50
|
+
Number.isInteger(value.code) &&
|
|
51
|
+
typeof value.message === "string" &&
|
|
52
|
+
value.message.trim().length > 0;
|
|
53
|
+
}
|
|
54
|
+
function isJsonRpcToolErrorResult(value) {
|
|
55
|
+
if (!isRecord(value))
|
|
56
|
+
return false;
|
|
57
|
+
const candidate = value;
|
|
58
|
+
return candidate[JSON_RPC_TOOL_ERROR_RESULT] === true && isRecord(candidate.result);
|
|
59
|
+
}
|
|
45
60
|
function isResolver(value) {
|
|
46
61
|
return typeof value === "function";
|
|
47
62
|
}
|
|
@@ -186,6 +201,26 @@ function parseJsonText(text) {
|
|
|
186
201
|
const snapshot = snapshotBoundedJsonValue(value);
|
|
187
202
|
return snapshot.success ? snapshot.value : undefined;
|
|
188
203
|
}
|
|
204
|
+
const MCP_ERROR_CODE = /^[a-z][a-z0-9_-]{0,63}$/;
|
|
205
|
+
const MCP_ERROR_CODE_PREFIX = /^\[([a-z][a-z0-9_-]{0,63})\](?:\s|$)/;
|
|
206
|
+
function parseCallToolErrorText(text, context, fallbackCode) {
|
|
207
|
+
const parsed = parseJsonText(text);
|
|
208
|
+
if (parsed !== undefined)
|
|
209
|
+
return parsed;
|
|
210
|
+
const code = fallbackCode && MCP_ERROR_CODE.test(fallbackCode)
|
|
211
|
+
? fallbackCode
|
|
212
|
+
: MCP_ERROR_CODE_PREFIX.exec(text)?.[1] ?? "tool_error";
|
|
213
|
+
return {
|
|
214
|
+
error: code,
|
|
215
|
+
code,
|
|
216
|
+
message: text,
|
|
217
|
+
...(context?.toolCallId
|
|
218
|
+
? {
|
|
219
|
+
correlation_id: context.toolCallId.slice(0, MAX_REMOTE_MCP_CORRELATION_ID_LENGTH),
|
|
220
|
+
}
|
|
221
|
+
: {}),
|
|
222
|
+
};
|
|
223
|
+
}
|
|
189
224
|
function isOauthExpiredMessage(value) {
|
|
190
225
|
const snapshot = snapshotBoundedJsonValue(value);
|
|
191
226
|
const safeValue = snapshot.success ? snapshot.value : undefined;
|
|
@@ -298,6 +333,31 @@ function extractJsonRpcErrorMessage(payload) {
|
|
|
298
333
|
}
|
|
299
334
|
return "Remote MCP server returned an error";
|
|
300
335
|
}
|
|
336
|
+
function extractJsonRpcToolError(payload) {
|
|
337
|
+
const rawError = isRecord(payload.error) ? payload.error : {};
|
|
338
|
+
const dataSnapshot = snapshotBoundedJsonValue(rawError.data);
|
|
339
|
+
const data = dataSnapshot.success ? dataSnapshot.value : undefined;
|
|
340
|
+
const dataRecord = isRecord(data) ? data : undefined;
|
|
341
|
+
const dataCode = typeof dataRecord?.code === "string" && MCP_ERROR_CODE.test(dataRecord.code)
|
|
342
|
+
? dataRecord.code
|
|
343
|
+
: undefined;
|
|
344
|
+
const rawRequestId = typeof dataRecord?.request_id === "string"
|
|
345
|
+
? dataRecord.request_id
|
|
346
|
+
: typeof dataRecord?.requestId === "string"
|
|
347
|
+
? dataRecord.requestId
|
|
348
|
+
: undefined;
|
|
349
|
+
const requestId = rawRequestId && rawRequestId.length <= MAX_REMOTE_MCP_CORRELATION_ID_LENGTH
|
|
350
|
+
? rawRequestId
|
|
351
|
+
: undefined;
|
|
352
|
+
const code = dataCode ?? "remote_mcp_json_rpc_error";
|
|
353
|
+
return {
|
|
354
|
+
error: code,
|
|
355
|
+
code,
|
|
356
|
+
message: extractJsonRpcErrorMessage(payload).slice(0, MAX_ERROR_BODY_LENGTH),
|
|
357
|
+
...(requestId ? { request_id: requestId } : {}),
|
|
358
|
+
...(typeof rawError.code === "number" ? { json_rpc_code: rawError.code } : {}),
|
|
359
|
+
};
|
|
360
|
+
}
|
|
301
361
|
function parseSseEvents(text) {
|
|
302
362
|
const events = [];
|
|
303
363
|
let currentEvent = { data: [] };
|
|
@@ -516,7 +576,7 @@ async function postJsonRpc(endpoint, headers, body, requestFetch, callerSignal,
|
|
|
516
576
|
requestScope.dispose();
|
|
517
577
|
}
|
|
518
578
|
}
|
|
519
|
-
function getJsonRpcResult(payload, expectedId) {
|
|
579
|
+
function getJsonRpcResult(payload, expectedId, preserveToolErrors = false) {
|
|
520
580
|
if (!isRecord(payload)) {
|
|
521
581
|
throw NETWORK_ERROR.create({ detail: "Remote MCP response was not a JSON object" });
|
|
522
582
|
}
|
|
@@ -532,6 +592,17 @@ function getJsonRpcResult(payload, expectedId) {
|
|
|
532
592
|
throw protocolError("Remote MCP response cannot include both result and error");
|
|
533
593
|
}
|
|
534
594
|
if (hasError) {
|
|
595
|
+
if (!isJsonRpcErrorObject(payload.error)) {
|
|
596
|
+
throw protocolError("Remote MCP response included a malformed JSON-RPC error object");
|
|
597
|
+
}
|
|
598
|
+
if (preserveToolErrors) {
|
|
599
|
+
// Tool execution errors are recoverable model-visible results. Discovery
|
|
600
|
+
// and other protocol operations keep the existing NETWORK_ERROR path.
|
|
601
|
+
return {
|
|
602
|
+
[JSON_RPC_TOOL_ERROR_RESULT]: true,
|
|
603
|
+
result: extractJsonRpcToolError(payload),
|
|
604
|
+
};
|
|
605
|
+
}
|
|
535
606
|
throw NETWORK_ERROR.create({ detail: extractJsonRpcErrorMessage(payload) });
|
|
536
607
|
}
|
|
537
608
|
if (!hasResult) {
|
|
@@ -552,9 +623,16 @@ function normalizeCallToolResult(input) {
|
|
|
552
623
|
if (Array.isArray(rawContent)) {
|
|
553
624
|
const text = joinCallToolText(rawContent.filter((item) => isRecord(item)));
|
|
554
625
|
if (isError) {
|
|
555
|
-
const
|
|
556
|
-
? result.
|
|
557
|
-
:
|
|
626
|
+
const contentErrorBody = parseCallToolErrorText(text, input.context, typeof result.error === "string" && result.error.trim().length > 0
|
|
627
|
+
? result.error
|
|
628
|
+
: undefined);
|
|
629
|
+
const structuredErrorBody = result.structuredContent;
|
|
630
|
+
const hasStructuredErrorDetails = Object.hasOwn(result, "structuredContent") &&
|
|
631
|
+
structuredErrorBody !== undefined &&
|
|
632
|
+
structuredErrorBody !== null &&
|
|
633
|
+
!(typeof structuredErrorBody === "string" && structuredErrorBody.trim().length === 0) &&
|
|
634
|
+
!(isRecord(structuredErrorBody) && Object.keys(structuredErrorBody).length === 0);
|
|
635
|
+
const errorBody = hasStructuredErrorDetails ? structuredErrorBody : contentErrorBody;
|
|
558
636
|
return preserveToolExecutionErrorMarker(normalizeKnownToolError(errorBody, input.toolName, input.endpoint, input.context));
|
|
559
637
|
}
|
|
560
638
|
if ("structuredContent" in result) {
|
|
@@ -680,7 +758,10 @@ function createRemoteMCPToolSourceWithFetch(config, getRequestFetch) {
|
|
|
680
758
|
...(meta ? { _meta: meta } : {}),
|
|
681
759
|
},
|
|
682
760
|
}, getRequestFetch(endpoint), context?.abortSignal, MAX_REMOTE_MCP_CALL_RESPONSE_BYTES);
|
|
683
|
-
const result = getJsonRpcResult(payload, requestId);
|
|
761
|
+
const result = getJsonRpcResult(payload, requestId, true);
|
|
762
|
+
if (isJsonRpcToolErrorResult(result)) {
|
|
763
|
+
return preserveToolExecutionErrorMarker(normalizeKnownToolError(result.result, toolName, endpoint, context));
|
|
764
|
+
}
|
|
684
765
|
const resultSnapshot = snapshotBoundedJsonValue(result);
|
|
685
766
|
if (!resultSnapshot.success) {
|
|
686
767
|
throw protocolError("Remote MCP tools/call returned an unbounded JSON result");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundle-recovery.d.ts","sourceRoot":"","sources":["../../../../src/src/transforms/esm/bundle-recovery.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AASH,OAAO,EAEL,KAAK,YAAY,EAKjB,KAAK,wBAAwB,EAC9B,MAAM,yBAAyB,CAAC;AAajC,kFAAkF;AAClF,KAAK,iBAAiB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"bundle-recovery.d.ts","sourceRoot":"","sources":["../../../../src/src/transforms/esm/bundle-recovery.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AASH,OAAO,EAEL,KAAK,YAAY,EAKjB,KAAK,wBAAwB,EAC9B,MAAM,yBAAyB,CAAC;AAajC,kFAAkF;AAClF,KAAK,iBAAiB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;AAwDxF;;;;GAIG;AACH,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,eAAe,EAAE,iBAAiB,EAClC,UAAU,CAAC,EAAE,MAAM,EACnB,gBAAgB,CAAC,EAAE,wBAAwB,GAC1C,OAAO,CAAC,OAAO,CAAC,CAyMlB;AAED;;;GAGG;AACH,wBAAsB,sBAAsB,CAC1C,WAAW,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,EAClD,QAAQ,EAAE,MAAM,EAChB,eAAe,EAAE,iBAAiB,EAClC,gBAAgB,CAAC,EAAE,wBAAwB,GAC1C,OAAO,CAAC,MAAM,EAAE,CAAC,CA2JnB;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CA8B3F"}
|
|
@@ -26,6 +26,7 @@ function createRecoveryCacheOptions(cacheDir, identity) {
|
|
|
26
26
|
cacheDir,
|
|
27
27
|
importMap: identity?.importMap ?? EMPTY_IMPORT_MAP,
|
|
28
28
|
reactVersion: identity?.reactVersion,
|
|
29
|
+
serverExternalPackages: identity?.serverExternalPackages,
|
|
29
30
|
};
|
|
30
31
|
}
|
|
31
32
|
function cacheIdentityForRecovery(url, identity) {
|
|
@@ -26,6 +26,8 @@ export type CacheOptions = {
|
|
|
26
26
|
importMap: ImportMapConfig;
|
|
27
27
|
/** React version to use for esm.sh URLs (defaults to DEFAULT_REACT_VERSION) */
|
|
28
28
|
reactVersion?: string;
|
|
29
|
+
/** Bare npm package roots that the runtime resolves without bundling. */
|
|
30
|
+
serverExternalPackages?: readonly string[];
|
|
29
31
|
/** Absolute request origin used to identify same-origin module-server URLs. */
|
|
30
32
|
moduleServerOrigin?: string;
|
|
31
33
|
/** Request-scoped dependency-pinning state used to isolate module-server URLs. */
|
|
@@ -35,7 +37,7 @@ export type CacheOptions = {
|
|
|
35
37
|
/** Reports completed remote-module fetches as idle-deadline heartbeats. */
|
|
36
38
|
onProgress?: TransformProgressListener;
|
|
37
39
|
};
|
|
38
|
-
export type HttpCacheIdentityOptions = Pick<CacheOptions, "importMap" | "reactVersion">;
|
|
40
|
+
export type HttpCacheIdentityOptions = Pick<CacheOptions, "importMap" | "reactVersion" | "serverExternalPackages">;
|
|
39
41
|
export interface HttpCacheIdentityMetadata extends HttpCacheIdentityOptions {
|
|
40
42
|
url: string;
|
|
41
43
|
/** SHA-256 key for the shared distributed-cache import-map record. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-cache-helpers.d.ts","sourceRoot":"","sources":["../../../../src/src/transforms/esm/http-cache-helpers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAaH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"http-cache-helpers.d.ts","sourceRoot":"","sources":["../../../../src/src/transforms/esm/http-cache-helpers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAaH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAuNhE;;GAEG;AACH,MAAM,WAAW,aAAa,CAAC,CAAC,EAAE,CAAC;IACjC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;IAC3B,GAAG,CAAC,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;IAC5B,MAAM,CAAC,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,OAAO,CAAC,CAAC;IACxB,GAAG,CAAC,KAAK,EAAE,CAAC,GAAG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AAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAEvE;AAED,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAQzD;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,iBAAiB,SAAS,CAAC;AAkCxC,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,CAEhD;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAiCpD;AAED,8EAA8E;AAC9E,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAE5E;AAED,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,eAAe,EAC1B,YAAY,GAAE,MAA8B,GAC3C,MAAM,CA6BR;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAoBrF"}
|
|
@@ -12,6 +12,7 @@ import { buildEsmShUrl } from "../import-rewriter/url-builder.js";
|
|
|
12
12
|
import { parseBarePackageSpecifier } from "../shared/package-specifier.js";
|
|
13
13
|
import { DEFAULT_REACT_VERSION, getReactImportMap } from "./react-cdn.js";
|
|
14
14
|
import { computeHash } from "../../utils/hash-utils.js";
|
|
15
|
+
import { canonicalizeServerExternalPackages } from "../../config/server-external-packages.js";
|
|
15
16
|
const logger = rendererLogger.component("http-cache");
|
|
16
17
|
const ArrayIncludes = Array.prototype.includes;
|
|
17
18
|
const EncodeURIComponent = encodeURIComponent;
|
|
@@ -188,6 +189,7 @@ function compareImportMapKeys(left, right) {
|
|
|
188
189
|
}
|
|
189
190
|
const HTTP_IMPORT_MAP_FINGERPRINT_NAMESPACE = "veryfront:http-import-map:v2";
|
|
190
191
|
const HTTP_CACHE_IDENTITY_NAMESPACE = "veryfront:http-module:v2";
|
|
192
|
+
const HTTP_CACHE_EXTERNAL_IDENTITY_NAMESPACE = "veryfront:http-module:v3";
|
|
191
193
|
const HTTP_CACHE_FILE_HASH_NAMESPACE = "veryfront:http-module-file:v2";
|
|
192
194
|
/** Build an order-independent fingerprint covering imports and scoped imports. */
|
|
193
195
|
export function fingerprintImportMap(importMap) {
|
|
@@ -244,7 +246,10 @@ function getHttpCacheRequestIdentityContext(options) {
|
|
|
244
246
|
* Callers must create a fresh prepared options object for each top-level request.
|
|
245
247
|
*/
|
|
246
248
|
export function prepareHttpCacheRequestOptions(options) {
|
|
247
|
-
const prepared = {
|
|
249
|
+
const prepared = {
|
|
250
|
+
...options,
|
|
251
|
+
serverExternalPackages: canonicalizeServerExternalPackages(options.serverExternalPackages),
|
|
252
|
+
};
|
|
248
253
|
return attachHttpCacheRequestIdentityContext(prepared, {});
|
|
249
254
|
}
|
|
250
255
|
/** Preserve an existing graph snapshot, or create one for an unprepared entry point. */
|
|
@@ -276,7 +281,17 @@ export async function buildHttpCacheIdentity(url, options) {
|
|
|
276
281
|
const normalizedUrl = normalizeHttpUrl(effective.url);
|
|
277
282
|
const importMapFingerprint = await getRequestImportMapFingerprint(url, effective.options);
|
|
278
283
|
const reactVersion = effective.options.reactVersion;
|
|
279
|
-
|
|
284
|
+
const base = `[${JSONStringify(normalizedUrl)},${reactVersion === undefined ? "null" : JSONStringify(reactVersion)},${JSONStringify(importMapFingerprint)}`;
|
|
285
|
+
const serverExternalPackages = canonicalizeServerExternalPackages(effective.options.serverExternalPackages);
|
|
286
|
+
if (!serverExternalPackages)
|
|
287
|
+
return `${HTTP_CACHE_IDENTITY_NAMESPACE}:${base}]`;
|
|
288
|
+
let identity = `${HTTP_CACHE_EXTERNAL_IDENTITY_NAMESPACE}:${base},[`;
|
|
289
|
+
for (let index = 0; index < serverExternalPackages.length; index++) {
|
|
290
|
+
if (index > 0)
|
|
291
|
+
identity += ",";
|
|
292
|
+
identity += JSONStringify(serverExternalPackages[index]);
|
|
293
|
+
}
|
|
294
|
+
return `${identity}]]`;
|
|
280
295
|
}
|
|
281
296
|
/** Build recoverable metadata while reusing the request graph's import-map fingerprint. */
|
|
282
297
|
export async function buildHttpCacheIdentityMetadata(url, options) {
|
|
@@ -285,6 +300,7 @@ export async function buildHttpCacheIdentityMetadata(url, options) {
|
|
|
285
300
|
url: normalizeHttpUrl(effective.url),
|
|
286
301
|
importMap: effective.options.importMap,
|
|
287
302
|
reactVersion: effective.options.reactVersion,
|
|
303
|
+
serverExternalPackages: canonicalizeServerExternalPackages(effective.options.serverExternalPackages),
|
|
288
304
|
importMapFingerprint: await getRequestImportMapFingerprint(url, effective.options),
|
|
289
305
|
};
|
|
290
306
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-cache-wrapper.d.ts","sourceRoot":"","sources":["../../../../src/src/transforms/esm/http-cache-wrapper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAOH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAEL,KAAK,UAAU,EAEf,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EAExB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,YAAY,EAKb,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAwB,KAAK,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"http-cache-wrapper.d.ts","sourceRoot":"","sources":["../../../../src/src/transforms/esm/http-cache-wrapper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAOH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAEL,KAAK,UAAU,EAEf,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EAExB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,YAAY,EAKb,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAwB,KAAK,yBAAyB,EAAE,MAAM,yBA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AC,IAAI,EAAE,UAAU,GAAG,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAcvE,4EAA4E;IACtE,mBAAmB,CACvB,IAAI,EAAE,UAAU,GAAG,MAAM,GACxB,OAAO,CAAC,yBAAyB,GAAG,IAAI,CAAC;IA+B5C;;;;;;OAMG;IACG,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAuB7D;;OAEG;IACG,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;CAItC;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe,iBAAwB,CAAC;AAErD;;;GAGG;AACH,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -20,6 +20,7 @@ import { brand, unbrand, } from "./http-cache-types.js";
|
|
|
20
20
|
import { asBundleHash, assertLocal, assertPortable, CACHE_DIR_TOKEN, VeryfrontError, } from "./http-cache-invariants.js";
|
|
21
21
|
import { looksLikeHtmlContent as looksLikeHtml } from "./html-content.js";
|
|
22
22
|
import { fingerprintImportMap } from "./http-cache-helpers.js";
|
|
23
|
+
import { canonicalizeServerExternalPackages, hasUniqueServerExternalPackages, isValidServerExternalPackageName, MAX_SERVER_EXTERNAL_PACKAGE_COUNT, } from "../../config/server-external-packages.js";
|
|
23
24
|
const logger = rendererLogger.component("http-cache-wrapper");
|
|
24
25
|
/** Maximum number of keys per batch request to distributed cache API */
|
|
25
26
|
const BATCH_FETCH_CHUNK_SIZE = 100;
|
|
@@ -61,6 +62,22 @@ function parseImportMap(value) {
|
|
|
61
62
|
}
|
|
62
63
|
return { imports, scopes };
|
|
63
64
|
}
|
|
65
|
+
function parseServerExternalPackages(value) {
|
|
66
|
+
if (value === undefined)
|
|
67
|
+
return undefined;
|
|
68
|
+
if (!Array.isArray(value) || value.length === 0 ||
|
|
69
|
+
value.length > MAX_SERVER_EXTERNAL_PACKAGE_COUNT)
|
|
70
|
+
return null;
|
|
71
|
+
const packages = value;
|
|
72
|
+
for (let index = 0; index < packages.length; index++) {
|
|
73
|
+
const entry = packages[index];
|
|
74
|
+
if (typeof entry !== "string" || !isValidServerExternalPackageName(entry))
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
if (!hasUniqueServerExternalPackages(packages))
|
|
78
|
+
return null;
|
|
79
|
+
return canonicalizeServerExternalPackages(packages);
|
|
80
|
+
}
|
|
64
81
|
function parseIdentityMetadata(value) {
|
|
65
82
|
try {
|
|
66
83
|
const parsed = JSON.parse(value);
|
|
@@ -68,6 +85,9 @@ function parseIdentityMetadata(value) {
|
|
|
68
85
|
return null;
|
|
69
86
|
if (parsed.reactVersion !== undefined && typeof parsed.reactVersion !== "string")
|
|
70
87
|
return null;
|
|
88
|
+
const serverExternalPackages = parseServerExternalPackages(parsed.serverExternalPackages);
|
|
89
|
+
if (serverExternalPackages === null)
|
|
90
|
+
return null;
|
|
71
91
|
// Backward compatibility for v2 records written before import maps were shared.
|
|
72
92
|
if (parsed.importMap !== undefined) {
|
|
73
93
|
const importMap = parseImportMap(parsed.importMap);
|
|
@@ -75,6 +95,7 @@ function parseIdentityMetadata(value) {
|
|
|
75
95
|
? {
|
|
76
96
|
url: parsed.url,
|
|
77
97
|
reactVersion: parsed.reactVersion,
|
|
98
|
+
...(serverExternalPackages ? { serverExternalPackages } : {}),
|
|
78
99
|
importMap,
|
|
79
100
|
}
|
|
80
101
|
: null;
|
|
@@ -84,6 +105,7 @@ function parseIdentityMetadata(value) {
|
|
|
84
105
|
return {
|
|
85
106
|
url: parsed.url,
|
|
86
107
|
reactVersion: parsed.reactVersion,
|
|
108
|
+
...(serverExternalPackages ? { serverExternalPackages } : {}),
|
|
87
109
|
importMapFingerprint: parsed.importMapFingerprint,
|
|
88
110
|
};
|
|
89
111
|
}
|
|
@@ -300,6 +322,7 @@ class HttpBundleCache {
|
|
|
300
322
|
writes.push(distributed.set(distributedKey("import-map", importMapFingerprint), JSON.stringify(identityMetadata.importMap), ttl), distributed.set(distributedKey("identity", hashStr), JSON.stringify({
|
|
301
323
|
url: identityMetadata.url,
|
|
302
324
|
reactVersion: identityMetadata.reactVersion,
|
|
325
|
+
serverExternalPackages: identityMetadata.serverExternalPackages,
|
|
303
326
|
importMapFingerprint,
|
|
304
327
|
}), ttl));
|
|
305
328
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"specifier-resolver.d.ts","sourceRoot":"","sources":["../../../../src/src/transforms/esm/specifier-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAgBH,OAAO,EACL,KAAK,YAAY,EAWlB,MAAM,yBAAyB,CAAC;AAgDjC,kFAAkF;AAClF,MAAM,MAAM,iBAAiB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"specifier-resolver.d.ts","sourceRoot":"","sources":["../../../../src/src/transforms/esm/specifier-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAgBH,OAAO,EACL,KAAK,YAAY,EAWlB,MAAM,yBAAyB,CAAC;AAgDjC,kFAAkF;AAClF,MAAM,MAAM,iBAAiB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;AAuM/F,sDAAsD;AACtD,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,YAAY,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACpD;AAED,gEAAgE;AAChE,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,OAAO,EAAE,YAAY,EACrB,eAAe,EAAE,iBAAiB,GACjC,OAAO,CAAC,qBAAqB,CAAC,CAoChC;AAED;;;;;GAKG;AACH,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,YAAY,EACrB,eAAe,EAAE,iBAAiB,GACjC,OAAO,CAAC,eAAe,CAAC,CAY1B"}
|
|
@@ -135,7 +135,8 @@ async function resolveSpecifier(specifier, baseUrl, options, cacheHttpModule) {
|
|
|
135
135
|
? stringSlice(specifier, 4)
|
|
136
136
|
: specifier;
|
|
137
137
|
const serverOnlyParsed = parseBarePackageSpecifier(serverOnlyCandidate);
|
|
138
|
-
if (serverOnlyParsed &&
|
|
138
|
+
if (serverOnlyParsed &&
|
|
139
|
+
isServerOnlyPackage(serverOnlyParsed.packageName, options.serverExternalPackages))
|
|
139
140
|
return null;
|
|
140
141
|
if (isInternalBare(specifier)) {
|
|
141
142
|
const mapped = resolveImport(specifier, options.importMap);
|
|
@@ -20,6 +20,8 @@ export interface TransformOptions {
|
|
|
20
20
|
studioEmbed?: boolean;
|
|
21
21
|
/** React version for transforms (from project config, defaults to DEFAULT_REACT_VERSION) */
|
|
22
22
|
reactVersion?: string;
|
|
23
|
+
/** Bare npm package roots that the runtime resolves without bundling. */
|
|
24
|
+
serverExternalPackages?: readonly string[];
|
|
23
25
|
/** Immutable import-map snapshot already selected for this render. */
|
|
24
26
|
preloadedImportMap?: ImportMapConfig;
|
|
25
27
|
/** Adapter used to load and cache the project import map before SSR cache identity. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/src/transforms/esm/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AACrF,OAAO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E,SAAS,MAAM,EAAE,CAAC;IAC3C,sEAAsE;IACtE,kBAAkB,CAAC,EAAE,eAAe,CAAC;IACrC,uFAAuF;IACvF,gBAAgB,CAAC,EAAE,cAAc,CAAC;IAClC,mEAAmE;IACnE,uBAAuB,CAAC,EAAE,uBAAuB,CAAC;IAClD,iDAAiD;IACjD,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,6EAA6E;IAC7E,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,mEAAmE;IACnE,6BAA6B,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACjE,yEAAyE;IACzE,uBAAuB,CAAC,EAAE,4BAA4B,CAAC;IACvD,mEAAmE;IACnE,8BAA8B,CAAC,EAAE,CAC/B,WAAW,EAAE,+BAA+B,KACzC,IAAI,CAAC;IACV,6DAA6D;IAC7D,UAAU,CAAC,EAAE,yBAAyB,CAAC;CACxC;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,cAAc,CAAC;IACxB,OAAO,EAAE,gBAAgB,CAAC;CAC3B"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { loadDefaultCodeParser } from "../../extensions/parser/defaults.js";
|
|
2
|
+
import type { CodeParser } from "../../extensions/parser/index.js";
|
|
3
|
+
interface CommonJsBrowserImportContext {
|
|
4
|
+
filePath: string;
|
|
5
|
+
projectDir?: string;
|
|
6
|
+
serverExternalPackages?: readonly string[];
|
|
7
|
+
}
|
|
8
|
+
type CommonJsCapableParser = CodeParser & {
|
|
9
|
+
findStaticCommonJsImports: NonNullable<CodeParser["findStaticCommonJsImports"]>;
|
|
10
|
+
};
|
|
11
|
+
declare function assertCommonJsCapableParser(parser: CodeParser | undefined): asserts parser is CommonJsCapableParser;
|
|
12
|
+
/** @internal Test-only seams; this module is not a public package entry point. */
|
|
13
|
+
export declare const commonJsPolicyInternals: Readonly<{
|
|
14
|
+
assertCommonJsCapableParser: typeof assertCommonJsCapableParser;
|
|
15
|
+
resetDefaultParserLoaderForTest(): void;
|
|
16
|
+
setDefaultParserLoaderForTest(loader: typeof loadDefaultCodeParser): void;
|
|
17
|
+
}>;
|
|
18
|
+
export declare function throwConfiguredServerExternalBrowserViolation(specifier: string, packageName: string, context: Pick<CommonJsBrowserImportContext, "filePath" | "projectDir">): never;
|
|
19
|
+
/** Enforce declared package boundaries for CommonJS syntax esbuild does not always resolve. */
|
|
20
|
+
export declare function assertNoConfiguredCommonJsBrowserImports(code: string, context: CommonJsBrowserImportContext): Promise<void>;
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=commonjs-policy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commonjs-policy.d.ts","sourceRoot":"","sources":["../../../../src/src/transforms/import-rewriter/commonjs-policy.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAE5E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAMnE,UAAU,4BAA4B;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,sBAAsB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC5C;AAKD,KAAK,qBAAqB,GAAG,UAAU,GAAG;IACxC,yBAAyB,EAAE,WAAW,CAAC,UAAU,CAAC,2BAA2B,CAAC,CAAC,CAAC;CACjF,CAAC;AAEF,iBAAS,2BAA2B,CAClC,MAAM,EAAE,UAAU,GAAG,SAAS,GAC7B,OAAO,CAAC,MAAM,IAAI,qBAAqB,CAQzC;AAED,kFAAkF;AAClF,eAAO,MAAM,uBAAuB;;;0CAMI,OAAO,qBAAqB;EAIlE,CAAC;AAeH,wBAAgB,6CAA6C,CAC3D,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,IAAI,CAAC,4BAA4B,EAAE,UAAU,GAAG,YAAY,CAAC,GACrE,KAAK,CAYP;AAED,+FAA+F;AAC/F,wBAAsB,wCAAwC,CAC5D,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,4BAA4B,GACpC,OAAO,CAAC,IAAI,CAAC,CAgBf"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { SERVER_ONLY_IN_CLIENT } from "../../errors/index.js";
|
|
2
|
+
import { tryResolve } from "../../extensions/contracts.js";
|
|
3
|
+
import { loadDefaultCodeParser } from "../../extensions/parser/defaults.js";
|
|
4
|
+
import { MISSING_EXTENSION_ERROR } from "../../extensions/errors.js";
|
|
5
|
+
import { describeServerExternalBrowserViolation, getConfiguredServerExternalPackage, } from "../shared/server-only-packages.js";
|
|
6
|
+
let defaultCommonJsParser;
|
|
7
|
+
let loadCommonJsParser = loadDefaultCodeParser;
|
|
8
|
+
function assertCommonJsCapableParser(parser) {
|
|
9
|
+
if (typeof parser?.findStaticCommonJsImports === "function")
|
|
10
|
+
return;
|
|
11
|
+
throw MISSING_EXTENSION_ERROR.create({
|
|
12
|
+
message: 'Missing CodeParser capability "findStaticCommonJsImports"',
|
|
13
|
+
detail: "A capable @veryfront/ext-parser-babel extension is required to verify CommonJS browser imports",
|
|
14
|
+
context: { contract: "CodeParser", capability: "findStaticCommonJsImports" },
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
/** @internal Test-only seams; this module is not a public package entry point. */
|
|
18
|
+
export const commonJsPolicyInternals = Object.freeze({
|
|
19
|
+
assertCommonJsCapableParser,
|
|
20
|
+
resetDefaultParserLoaderForTest() {
|
|
21
|
+
defaultCommonJsParser = undefined;
|
|
22
|
+
loadCommonJsParser = loadDefaultCodeParser;
|
|
23
|
+
},
|
|
24
|
+
setDefaultParserLoaderForTest(loader) {
|
|
25
|
+
defaultCommonJsParser = undefined;
|
|
26
|
+
loadCommonJsParser = loader;
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
async function getCommonJsParser() {
|
|
30
|
+
const active = tryResolve("CodeParser");
|
|
31
|
+
if (active?.findStaticCommonJsImports)
|
|
32
|
+
return active;
|
|
33
|
+
defaultCommonJsParser ??= loadCommonJsParser();
|
|
34
|
+
const pending = defaultCommonJsParser;
|
|
35
|
+
try {
|
|
36
|
+
return await pending;
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
if (defaultCommonJsParser === pending)
|
|
40
|
+
defaultCommonJsParser = undefined;
|
|
41
|
+
throw error;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
export function throwConfiguredServerExternalBrowserViolation(specifier, packageName, context) {
|
|
45
|
+
const violation = describeServerExternalBrowserViolation(specifier, context.filePath, context.projectDir);
|
|
46
|
+
throw SERVER_ONLY_IN_CLIENT.create({
|
|
47
|
+
message: violation.message,
|
|
48
|
+
detail: `Declared server external package reached a browser transform: ${packageName}`,
|
|
49
|
+
instance: violation.sourceIdentity,
|
|
50
|
+
context: { packageName },
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
/** Enforce declared package boundaries for CommonJS syntax esbuild does not always resolve. */
|
|
54
|
+
export async function assertNoConfiguredCommonJsBrowserImports(code, context) {
|
|
55
|
+
if (context.serverExternalPackages === undefined ||
|
|
56
|
+
context.serverExternalPackages.length === 0) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const parser = await getCommonJsParser();
|
|
60
|
+
assertCommonJsCapableParser(parser);
|
|
61
|
+
const specifiers = await parser.findStaticCommonJsImports({
|
|
62
|
+
code,
|
|
63
|
+
filePath: context.filePath,
|
|
64
|
+
});
|
|
65
|
+
assertNoConfiguredCommonJsSpecifiers(specifiers, context);
|
|
66
|
+
}
|
|
67
|
+
function assertNoConfiguredCommonJsSpecifiers(specifiers, context) {
|
|
68
|
+
for (let index = 0; index < specifiers.length; index++) {
|
|
69
|
+
const specifier = specifiers[index];
|
|
70
|
+
const packageName = getConfiguredServerExternalPackage(specifier, context.serverExternalPackages);
|
|
71
|
+
if (packageName !== undefined) {
|
|
72
|
+
throwConfiguredServerExternalBrowserViolation(specifier, packageName, context);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../src/src/transforms/import-rewriter/core.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../src/src/transforms/import-rewriter/core.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EACV,qBAAqB,EAErB,cAAc,EAEf,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,cAAc,CAAC;IACxB,UAAU,EAAE,qBAAqB,EAAE,CAAC;CACrC;AA0BD,wBAAsB,4BAA4B,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CAoD7F"}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { getConfiguredServerExternalRuntimeSpecifier, matchConfiguredServerExternalSpecifier, } from "../shared/server-only-packages.js";
|
|
2
|
+
import { isDeno } from "../../platform/compat/runtime.js";
|
|
3
|
+
import { assertNoConfiguredCommonJsBrowserImports, throwConfiguredServerExternalBrowserViolation, } from "./commonjs-policy.js";
|
|
1
4
|
import { applyComputedDynamicImportPinning, applyImportEdits, parseImportEdits, } from "./import-edit.js";
|
|
2
5
|
import { relativeToProjectDir } from "./project-paths.js";
|
|
3
6
|
import { appendDependencyPinningPathKey, appendSameOriginDependencyPinningPathKey, appendSameOriginSSRDependencyPinningPathKey, normalizeExtension, } from "./url-builder.js";
|
|
@@ -11,6 +14,9 @@ function pinSameOriginModuleUrl(specifier, ctx) {
|
|
|
11
14
|
return pinned === specifier ? null : pinned;
|
|
12
15
|
}
|
|
13
16
|
export async function rewriteWithImportRewriteCore(input) {
|
|
17
|
+
if (input.context.target === "browser") {
|
|
18
|
+
await assertNoConfiguredCommonJsBrowserImports(input.code, input.context);
|
|
19
|
+
}
|
|
14
20
|
const parsed = await parseImportEdits(input.code);
|
|
15
21
|
if (parsed.imports.length === 0 && parsed.computedDynamicImports.length === 0) {
|
|
16
22
|
return input.code;
|
|
@@ -49,6 +55,9 @@ export async function rewriteWithImportRewriteCore(input) {
|
|
|
49
55
|
});
|
|
50
56
|
}
|
|
51
57
|
function rewriteOne(specifier, info, ctx, strategies) {
|
|
58
|
+
const configuredExternal = rewriteConfiguredServerExternal(specifier, ctx);
|
|
59
|
+
if (configuredExternal !== undefined)
|
|
60
|
+
return configuredExternal;
|
|
52
61
|
const pinnedModuleUrl = pinSameOriginModuleUrl(specifier, ctx);
|
|
53
62
|
if (pinnedModuleUrl !== null)
|
|
54
63
|
return { specifier: pinnedModuleUrl };
|
|
@@ -56,8 +65,27 @@ function rewriteOne(specifier, info, ctx, strategies) {
|
|
|
56
65
|
if (!strategy.matches(specifier, ctx))
|
|
57
66
|
continue;
|
|
58
67
|
const result = strategy.rewrite(info, ctx);
|
|
59
|
-
if (result.specifier !== null
|
|
68
|
+
if (result.specifier !== null) {
|
|
69
|
+
return rewriteConfiguredServerExternal(result.specifier, ctx) ?? result;
|
|
70
|
+
}
|
|
71
|
+
if (result.statement !== undefined)
|
|
60
72
|
return result;
|
|
61
73
|
}
|
|
62
74
|
return { specifier: null };
|
|
63
75
|
}
|
|
76
|
+
function rewriteConfiguredServerExternal(specifier, ctx) {
|
|
77
|
+
const match = matchConfiguredServerExternalSpecifier(specifier, ctx.serverExternalPackages);
|
|
78
|
+
if (match === undefined)
|
|
79
|
+
return undefined;
|
|
80
|
+
if (ctx.target === "browser") {
|
|
81
|
+
throwConfiguredServerExternalBrowserViolation(specifier, match.packageName, ctx);
|
|
82
|
+
}
|
|
83
|
+
const runtimeSpecifier = getConfiguredServerExternalRuntimeSpecifier(specifier, ctx.serverExternalPackages, isDeno);
|
|
84
|
+
if (runtimeSpecifier !== undefined && runtimeSpecifier !== specifier) {
|
|
85
|
+
return { specifier: runtimeSpecifier };
|
|
86
|
+
}
|
|
87
|
+
// A configured server external is terminal even though preserving the
|
|
88
|
+
// original specifier is represented by a null rewrite. Import maps and
|
|
89
|
+
// special-package strategies must not claim it afterward.
|
|
90
|
+
return { specifier: null };
|
|
91
|
+
}
|
|
@@ -22,6 +22,8 @@ export interface SSRRewriteOptions {
|
|
|
22
22
|
crossProjectRef?: string;
|
|
23
23
|
/** React version to use for import rewrites */
|
|
24
24
|
reactVersion?: string;
|
|
25
|
+
/** Bare npm package roots that the server runtime resolves without bundling. */
|
|
26
|
+
serverExternalPackages?: readonly string[];
|
|
25
27
|
/** Project root directory for dependency pin lookup (used when VERYFRONT_DEPENDENCY_PINNING=1). */
|
|
26
28
|
projectDir?: string;
|
|
27
29
|
/** Project reference used by the best-effort platform range resolver. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ssr-adapter.d.ts","sourceRoot":"","sources":["../../../../src/src/transforms/import-rewriter/ssr-adapter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ssr-adapter.d.ts","sourceRoot":"","sources":["../../../../src/src/transforms/import-rewriter/ssr-adapter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,4BAA4B,EAAE,MAAM,4BAA4B,CAAC;AAQ/E,OAAO,EACL,KAAK,+BAA+B,EAErC,MAAM,4BAA4B,CAAC;AAapC,KAAK,WAAW,GAAG,MAAM,GAAG,MAAM,CAAC;AAInC,MAAM,WAAW,sBAAsB;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,OAAO,GAAG,UAAU,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,wBAAgB,+BAA+B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEpE;A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