veryfront 0.1.128 → 0.1.129
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/router.d.ts +0 -5
- package/esm/cli/router.d.ts.map +1 -1
- package/esm/cli/router.js +30 -2
- package/esm/cli/shared/update-check.d.ts +4 -0
- package/esm/cli/shared/update-check.d.ts.map +1 -0
- package/esm/cli/shared/update-check.js +97 -0
- package/esm/deno.d.ts +5 -0
- package/esm/deno.js +13 -8
- package/esm/src/channels/control-plane.d.ts.map +1 -1
- package/esm/src/channels/control-plane.js +5 -5
- package/esm/src/channels/invoke.d.ts +1 -1
- package/esm/src/channels/invoke.d.ts.map +1 -1
- package/esm/src/channels/invoke.js +6 -6
- package/esm/src/chat/index.d.ts +12 -24
- package/esm/src/chat/index.d.ts.map +1 -1
- package/esm/src/chat/index.js +5 -25
- package/esm/src/config/env.d.ts.map +1 -1
- package/esm/src/config/env.js +18 -10
- package/esm/src/data/static-data-fetcher.d.ts +3 -0
- package/esm/src/data/static-data-fetcher.d.ts.map +1 -1
- package/esm/src/data/static-data-fetcher.js +29 -25
- package/esm/src/data/static-paths-fetcher.d.ts.map +1 -1
- package/esm/src/data/static-paths-fetcher.js +3 -2
- package/esm/src/errors/logging.d.ts.map +1 -1
- package/esm/src/errors/logging.js +16 -7
- package/esm/src/errors/user-friendly/error-formatter.d.ts.map +1 -1
- package/esm/src/errors/user-friendly/error-formatter.js +9 -25
- package/esm/src/fs/index.d.ts +11 -12
- package/esm/src/fs/index.d.ts.map +1 -1
- package/esm/src/fs/index.js +11 -24
- package/esm/src/html/dev-scripts.d.ts.map +1 -1
- package/esm/src/html/dev-scripts.js +5 -8
- package/esm/src/html/html-escape.d.ts +1 -0
- package/esm/src/html/html-escape.d.ts.map +1 -1
- package/esm/src/html/html-escape.js +3 -0
- package/esm/src/html/html-injection.js +2 -2
- package/esm/src/html/html-shell-generator.d.ts +5 -2
- package/esm/src/html/html-shell-generator.d.ts.map +1 -1
- package/esm/src/html/html-shell-generator.js +41 -30
- package/esm/src/html/hydration-script-builder/dev-client-renderer.js +2 -2
- package/esm/src/html/hydration-script-builder/dev-component-manifest.js +2 -2
- package/esm/src/html/hydration-script-builder/dev-error-logger.d.ts.map +1 -1
- package/esm/src/html/hydration-script-builder/dev-error-logger.js +2 -6
- package/esm/src/html/hydration-script-builder/dev-scripts.js +2 -2
- package/esm/src/html/hydration-script-builder/hydration-data-generator.d.ts +3 -1
- package/esm/src/html/hydration-script-builder/hydration-data-generator.d.ts.map +1 -1
- package/esm/src/html/hydration-script-builder/hydration-data-generator.js +2 -2
- package/esm/src/html/hydration-script-builder/index.d.ts +1 -1
- package/esm/src/html/hydration-script-builder/index.d.ts.map +1 -1
- package/esm/src/html/hydration-script-builder/index.js +1 -1
- package/esm/src/html/hydration-script-builder/prod-hydration.js +2 -2
- 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 +14 -14
- 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-pregeneration.d.ts +17 -1
- package/esm/src/html/styles-builder/css-pregeneration.d.ts.map +1 -1
- package/esm/src/html/styles-builder/css-pregeneration.js +103 -1
- package/esm/src/html/styles-builder/dev-styles.js +2 -2
- package/esm/src/html/utils.d.ts +2 -0
- package/esm/src/html/utils.d.ts.map +1 -1
- package/esm/src/html/utils.js +49 -28
- package/esm/src/integrations/remote-tools.d.ts.map +1 -1
- package/esm/src/integrations/remote-tools.js +32 -39
- package/esm/src/internal-agents/ag-ui-sse.d.ts +0 -1
- package/esm/src/internal-agents/ag-ui-sse.d.ts.map +1 -1
- package/esm/src/internal-agents/ag-ui-sse.js +2 -16
- package/esm/src/internal-agents/control-plane-auth.d.ts.map +1 -1
- package/esm/src/internal-agents/control-plane-auth.js +5 -3
- package/esm/src/internal-agents/request-body.d.ts.map +1 -1
- package/esm/src/internal-agents/request-body.js +6 -3
- package/esm/src/internal-agents/session-manager.d.ts +1 -0
- package/esm/src/internal-agents/session-manager.d.ts.map +1 -1
- package/esm/src/internal-agents/session-manager.js +12 -18
- package/esm/src/issues/core.d.ts.map +1 -1
- package/esm/src/issues/core.js +24 -23
- package/esm/src/issues/schemas/issue.schema.d.ts.map +1 -1
- package/esm/src/issues/schemas/issue.schema.js +2 -1
- package/esm/src/jobs/runtime-env.d.ts.map +1 -1
- package/esm/src/jobs/runtime-env.js +21 -44
- package/esm/src/markdown/index.d.ts +1 -2
- package/esm/src/markdown/index.d.ts.map +1 -1
- package/esm/src/markdown/index.js +1 -6
- package/esm/src/mcp/server.d.ts +0 -1
- package/esm/src/mcp/server.d.ts.map +1 -1
- package/esm/src/mcp/server.js +40 -41
- package/esm/src/mdx/index.d.ts +3 -2
- package/esm/src/mdx/index.d.ts.map +1 -1
- package/esm/src/mdx/index.js +3 -5
- package/esm/src/middleware/builtin/logger.d.ts.map +1 -1
- package/esm/src/middleware/builtin/logger.js +31 -28
- package/esm/src/middleware/builtin/security/rate-limit.d.ts.map +1 -1
- package/esm/src/middleware/builtin/security/rate-limit.js +17 -12
- package/esm/src/middleware/builtin/timeout.d.ts.map +1 -1
- package/esm/src/middleware/builtin/timeout.js +17 -10
- package/esm/src/modules/import-map/default-import-map.d.ts.map +1 -1
- package/esm/src/modules/import-map/default-import-map.js +4 -3
- package/esm/src/oauth/handlers/callback-handler.d.ts +0 -5
- package/esm/src/oauth/handlers/callback-handler.d.ts.map +1 -1
- package/esm/src/oauth/handlers/callback-handler.js +9 -14
- package/esm/src/oauth/handlers/index.d.ts +1 -1
- package/esm/src/oauth/handlers/index.js +1 -1
- package/esm/src/oauth/handlers/init-handler.d.ts.map +1 -1
- package/esm/src/oauth/handlers/init-handler.js +32 -20
- package/esm/src/oauth/providers/index.d.ts +1 -1
- package/esm/src/oauth/providers/index.js +1 -1
- package/esm/src/oauth/schemas/index.d.ts +1 -1
- package/esm/src/oauth/schemas/index.js +1 -1
- package/esm/src/oauth/token-store/index.d.ts +1 -1
- package/esm/src/oauth/token-store/index.js +1 -1
- package/esm/src/oauth/token-store/memory.d.ts +1 -1
- package/esm/src/oauth/token-store/memory.d.ts.map +1 -1
- package/esm/src/oauth/token-store/memory.js +8 -8
- package/esm/src/observability/request-profiler.d.ts +31 -0
- package/esm/src/observability/request-profiler.d.ts.map +1 -0
- package/esm/src/observability/request-profiler.js +94 -0
- package/esm/src/observability/tracing/otlp-setup.d.ts.map +1 -1
- package/esm/src/observability/tracing/otlp-setup.js +16 -21
- package/esm/src/prompt/factory.d.ts.map +1 -1
- package/esm/src/prompt/factory.js +10 -12
- package/esm/src/prompt/registry.d.ts.map +1 -1
- package/esm/src/prompt/registry.js +12 -10
- package/esm/src/prompt/schemas/prompt.schema.d.ts.map +1 -1
- package/esm/src/prompt/schemas/prompt.schema.js +0 -2
- package/esm/src/prompt/types.d.ts +1 -1
- package/esm/src/prompt/types.d.ts.map +1 -1
- package/esm/src/provider/local/ai-sdk-adapter.d.ts.map +1 -1
- package/esm/src/provider/local/ai-sdk-adapter.js +3 -8
- package/esm/src/provider/local/env.d.ts +4 -6
- package/esm/src/provider/local/env.d.ts.map +1 -1
- package/esm/src/provider/local/env.js +14 -1
- package/esm/src/provider/local/local-engine.d.ts.map +1 -1
- package/esm/src/provider/local/local-engine.js +2 -7
- package/esm/src/provider/model-registry.d.ts.map +1 -1
- package/esm/src/provider/model-registry.js +2 -7
- package/esm/src/provider/veryfront-cloud/provider.d.ts.map +1 -1
- package/esm/src/provider/veryfront-cloud/provider.js +1 -7
- package/esm/src/provider/veryfront-cloud/shared.d.ts.map +1 -1
- package/esm/src/provider/veryfront-cloud/shared.js +9 -11
- package/esm/src/proxy/handler.d.ts.map +1 -1
- package/esm/src/proxy/handler.js +56 -57
- package/esm/src/react/compat/hooks-adapter.d.ts +1 -7
- package/esm/src/react/compat/hooks-adapter.d.ts.map +1 -1
- package/esm/src/react/compat/hooks-adapter.js +35 -40
- package/esm/src/react/components/Head.d.ts +1 -26
- package/esm/src/react/components/Head.d.ts.map +1 -1
- package/esm/src/react/components/Head.js +1 -172
- package/esm/src/react/context/index.d.ts +2 -46
- package/esm/src/react/context/index.d.ts.map +1 -1
- package/esm/src/react/context/index.js +1 -44
- package/esm/src/react/head-collector.d.ts +1 -10
- package/esm/src/react/head-collector.d.ts.map +1 -1
- package/esm/src/react/head-collector.js +4 -0
- package/esm/src/react/router/index.d.ts +2 -45
- package/esm/src/react/router/index.d.ts.map +1 -1
- package/esm/src/react/router/index.js +1 -49
- package/esm/src/react/runtime/core.d.ts +49 -0
- package/esm/src/react/runtime/core.d.ts.map +1 -0
- package/esm/src/react/runtime/core.js +200 -0
- package/esm/src/rendering/orchestrator/html.d.ts +2 -0
- package/esm/src/rendering/orchestrator/html.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/html.js +69 -12
- package/esm/src/rendering/orchestrator/ssr-orchestrator.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/ssr-orchestrator.js +4 -0
- package/esm/src/rendering/orchestrator/types.d.ts +4 -0
- package/esm/src/rendering/orchestrator/types.d.ts.map +1 -1
- package/esm/src/repositories/types.d.ts.map +1 -1
- package/esm/src/resource/factory.d.ts.map +1 -1
- package/esm/src/resource/factory.js +12 -9
- package/esm/src/resource/registry.d.ts +3 -3
- package/esm/src/resource/registry.d.ts.map +1 -1
- package/esm/src/resource/registry.js +7 -7
- package/esm/src/schemas/common.d.ts.map +1 -1
- package/esm/src/schemas/common.js +7 -4
- package/esm/src/security/http/config.d.ts +0 -1
- package/esm/src/security/http/config.d.ts.map +1 -1
- package/esm/src/security/http/config.js +3 -16
- package/esm/src/security/http/response/security-handler.d.ts +1 -0
- package/esm/src/security/http/response/security-handler.d.ts.map +1 -1
- package/esm/src/security/http/response/security-handler.js +17 -12
- package/esm/src/security/index.d.ts +4 -2
- package/esm/src/security/index.d.ts.map +1 -1
- package/esm/src/security/index.js +3 -1
- package/esm/src/server/handlers/dev/styles-css.handler.d.ts.map +1 -1
- package/esm/src/server/handlers/dev/styles-css.handler.js +8 -7
- package/esm/src/server/handlers/monitoring/metrics.handler.d.ts.map +1 -1
- package/esm/src/server/handlers/monitoring/metrics.handler.js +3 -1
- package/esm/src/server/handlers/request/module/module-server-handler.d.ts.map +1 -1
- package/esm/src/server/handlers/request/module/module-server-handler.js +18 -15
- package/esm/src/server/handlers/request/prod-hydration-module.handler.d.ts +8 -0
- package/esm/src/server/handlers/request/prod-hydration-module.handler.d.ts.map +1 -0
- package/esm/src/server/handlers/request/prod-hydration-module.handler.js +41 -0
- package/esm/src/server/handlers/request/ssr/ssr.handler.d.ts.map +1 -1
- package/esm/src/server/handlers/request/ssr/ssr.handler.js +3 -0
- package/esm/src/server/production-server.d.ts.map +1 -1
- package/esm/src/server/production-server.js +65 -0
- package/esm/src/server/runtime-handler/handler-context-builder.d.ts +1 -1
- package/esm/src/server/runtime-handler/handler-context-builder.d.ts.map +1 -1
- package/esm/src/server/runtime-handler/index.d.ts +1 -1
- package/esm/src/server/runtime-handler/index.d.ts.map +1 -1
- package/esm/src/server/runtime-handler/index.js +36 -11
- package/esm/src/server/runtime-handler/request-utils.d.ts +7 -0
- package/esm/src/server/runtime-handler/request-utils.d.ts.map +1 -1
- package/esm/src/server/runtime-handler/request-utils.js +10 -0
- package/esm/src/server/services/rendering/ssr.service.d.ts +1 -0
- package/esm/src/server/services/rendering/ssr.service.d.ts.map +1 -1
- package/esm/src/server/services/rendering/ssr.service.js +12 -5
- package/esm/src/server/services/rsc/endpoints/rsc-bundles.generated.js +1 -1
- package/esm/src/skill/allowed-tools.d.ts +3 -8
- package/esm/src/skill/allowed-tools.d.ts.map +1 -1
- package/esm/src/skill/executor.js +2 -2
- package/esm/src/skill/parser.d.ts.map +1 -1
- package/esm/src/skill/parser.js +12 -12
- package/esm/src/skill/path-safety.js +1 -1
- package/esm/src/skill/tools.d.ts.map +1 -1
- package/esm/src/skill/tools.js +18 -11
- package/esm/src/studio/bridge/bridge-bundle.generated.d.ts.map +1 -1
- package/esm/src/studio/bridge/bridge-bundle.generated.js +1 -1
- package/esm/src/task/discovery.d.ts.map +1 -1
- package/esm/src/task/discovery.js +73 -95
- package/esm/src/tool/executor.d.ts.map +1 -1
- package/esm/src/tool/executor.js +8 -7
- package/esm/src/tool/factory.d.ts.map +1 -1
- package/esm/src/tool/factory.js +13 -16
- package/esm/src/transforms/esm/package-registry.d.ts +4 -0
- package/esm/src/transforms/esm/package-registry.d.ts.map +1 -1
- package/esm/src/transforms/esm/package-registry.js +34 -17
- package/esm/src/transforms/import-rewriter/strategies/veryfront-strategy.d.ts.map +1 -1
- package/esm/src/transforms/import-rewriter/strategies/veryfront-strategy.js +2 -1
- package/esm/src/transforms/mdx/esm-module-loader/cache-format.d.ts.map +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/cache-format.js +26 -1
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/index.d.ts +1 -1
- 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 +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/render-sessions.d.ts +1 -0
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/render-sessions.d.ts.map +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/render-sessions.js +3 -0
- package/esm/src/transforms/pipeline/stages/ssr-vf-modules/index.d.ts +1 -1
- package/esm/src/transforms/pipeline/stages/ssr-vf-modules/index.js +1 -1
- package/esm/src/transforms/veryfront-module-urls.d.ts.map +1 -1
- package/esm/src/transforms/veryfront-module-urls.js +7 -3
- package/esm/src/types/entities/getEntityInfo.d.ts.map +1 -1
- package/esm/src/types/entities/getEntityInfo.js +79 -127
- package/esm/src/utils/path-utils.d.ts +1 -1
- package/esm/src/utils/path-utils.d.ts.map +1 -1
- package/esm/src/utils/path-utils.js +16 -7
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/esm/src/utils/version.d.ts.map +1 -1
- package/esm/src/utils/version.js +0 -1
- package/esm/src/workflow/worker/dynamic-job-entrypoint.d.ts.map +1 -1
- package/esm/src/workflow/worker/dynamic-job-entrypoint.js +5 -72
- package/esm/src/workflow/worker/job-entrypoint.d.ts.map +1 -1
- package/esm/src/workflow/worker/job-entrypoint.js +5 -72
- package/esm/src/workflow/worker/shared.d.ts +18 -0
- package/esm/src/workflow/worker/shared.d.ts.map +1 -0
- package/esm/src/workflow/worker/shared.js +77 -0
- package/package.json +1 -1
- package/src/cli/router.ts +41 -2
- package/src/cli/shared/update-check.ts +110 -0
- package/src/deno.js +13 -8
- package/src/src/channels/control-plane.ts +6 -10
- package/src/src/channels/invoke.ts +7 -7
- package/src/src/chat/index.ts +96 -132
- package/src/src/config/env.ts +24 -11
- package/src/src/data/static-data-fetcher.ts +59 -34
- package/src/src/data/static-paths-fetcher.ts +4 -2
- package/src/src/errors/logging.ts +21 -7
- package/src/src/errors/user-friendly/error-formatter.ts +14 -29
- package/src/src/fs/index.ts +21 -30
- package/src/src/html/dev-scripts.ts +5 -9
- package/src/src/html/html-escape.ts +4 -0
- package/src/src/html/html-injection.ts +2 -2
- package/src/src/html/html-shell-generator.ts +60 -26
- package/src/src/html/hydration-script-builder/dev-client-renderer.ts +2 -2
- package/src/src/html/hydration-script-builder/dev-component-manifest.ts +2 -2
- package/src/src/html/hydration-script-builder/dev-error-logger.ts +2 -8
- package/src/src/html/hydration-script-builder/dev-scripts.ts +2 -2
- package/src/src/html/hydration-script-builder/hydration-data-generator.ts +2 -1
- package/src/src/html/hydration-script-builder/index.ts +5 -1
- package/src/src/html/hydration-script-builder/prod-hydration.ts +2 -2
- package/src/src/html/hydration-script-builder/prod-scripts.ts +16 -15
- package/src/src/html/schemas/html.schema.ts +2 -0
- package/src/src/html/styles-builder/css-pregeneration.ts +133 -1
- package/src/src/html/styles-builder/dev-styles.ts +2 -2
- package/src/src/html/utils.ts +62 -29
- package/src/src/integrations/remote-tools.ts +39 -37
- package/src/src/internal-agents/ag-ui-sse.ts +2 -17
- package/src/src/internal-agents/control-plane-auth.ts +8 -6
- package/src/src/internal-agents/request-body.ts +7 -5
- package/src/src/internal-agents/session-manager.ts +16 -20
- package/src/src/issues/core.ts +24 -27
- package/src/src/issues/schemas/issue.schema.ts +3 -1
- package/src/src/jobs/runtime-env.ts +24 -50
- package/src/src/markdown/index.ts +5 -8
- package/src/src/mcp/server.ts +50 -53
- package/src/src/mdx/index.ts +7 -8
- package/src/src/middleware/builtin/logger.ts +44 -29
- package/src/src/middleware/builtin/security/rate-limit.ts +20 -11
- package/src/src/middleware/builtin/timeout.ts +22 -13
- package/src/src/modules/import-map/default-import-map.ts +4 -3
- package/src/src/oauth/handlers/callback-handler.ts +9 -16
- package/src/src/oauth/handlers/index.ts +1 -1
- package/src/src/oauth/handlers/init-handler.ts +56 -27
- package/src/src/oauth/providers/index.ts +1 -1
- package/src/src/oauth/schemas/index.ts +1 -1
- package/src/src/oauth/token-store/index.ts +1 -1
- package/src/src/oauth/token-store/memory.ts +8 -8
- package/src/src/observability/request-profiler.ts +140 -0
- package/src/src/observability/tracing/otlp-setup.ts +16 -22
- package/src/src/prompt/factory.ts +16 -14
- package/src/src/prompt/registry.ts +14 -13
- package/src/src/prompt/schemas/prompt.schema.ts +0 -4
- package/src/src/prompt/types.ts +1 -2
- package/src/src/provider/local/ai-sdk-adapter.ts +3 -10
- package/src/src/provider/local/env.ts +22 -2
- package/src/src/provider/local/local-engine.ts +2 -9
- package/src/src/provider/model-registry.ts +2 -9
- package/src/src/provider/veryfront-cloud/provider.ts +1 -8
- package/src/src/provider/veryfront-cloud/shared.ts +12 -15
- package/src/src/proxy/handler.ts +90 -74
- package/src/src/react/compat/hooks-adapter.ts +43 -44
- package/src/src/react/components/Head.tsx +1 -181
- package/src/src/react/context/index.tsx +2 -83
- package/src/src/react/head-collector.ts +9 -0
- package/src/src/react/router/index.tsx +2 -100
- package/src/src/react/runtime/core.ts +303 -0
- package/src/src/rendering/orchestrator/html.ts +122 -18
- package/src/src/rendering/orchestrator/ssr-orchestrator.ts +8 -0
- package/src/src/rendering/orchestrator/types.ts +4 -0
- package/src/src/repositories/types.ts +0 -4
- package/src/src/resource/factory.ts +15 -11
- package/src/src/resource/registry.ts +7 -7
- package/src/src/schemas/common.ts +8 -5
- package/src/src/security/http/config.ts +3 -19
- package/src/src/security/http/response/security-handler.ts +22 -13
- package/src/src/security/index.ts +4 -7
- package/src/src/server/handlers/dev/styles-css.handler.ts +32 -14
- package/src/src/server/handlers/monitoring/metrics.handler.ts +3 -1
- package/src/src/server/handlers/request/module/module-server-handler.ts +24 -17
- package/src/src/server/handlers/request/prod-hydration-module.handler.ts +61 -0
- package/src/src/server/handlers/request/ssr/ssr.handler.ts +3 -0
- package/src/src/server/production-server.ts +84 -0
- package/src/src/server/runtime-handler/handler-context-builder.ts +1 -1
- package/src/src/server/runtime-handler/index.ts +44 -13
- package/src/src/server/runtime-handler/request-utils.ts +11 -0
- package/src/src/server/services/rendering/ssr.service.ts +31 -18
- package/src/src/server/services/rsc/endpoints/rsc-bundles.generated.ts +1 -1
- package/src/src/skill/allowed-tools.ts +1 -8
- package/src/src/skill/executor.ts +2 -2
- package/src/src/skill/parser.ts +13 -20
- package/src/src/skill/path-safety.ts +1 -1
- package/src/src/skill/tools.ts +27 -20
- package/src/src/studio/bridge/bridge-bundle.generated.ts +1 -1
- package/src/src/task/discovery.ts +97 -97
- package/src/src/tool/executor.ts +10 -8
- package/src/src/tool/factory.ts +21 -22
- package/src/src/tool/types.ts +0 -17
- package/src/src/transforms/esm/package-registry.ts +52 -20
- package/src/src/transforms/import-rewriter/strategies/veryfront-strategy.ts +2 -1
- package/src/src/transforms/mdx/esm-module-loader/cache-format.ts +34 -1
- package/src/src/transforms/mdx/esm-module-loader/module-fetcher/index.ts +1 -1
- package/src/src/transforms/mdx/esm-module-loader/module-fetcher/render-sessions.ts +4 -0
- package/src/src/transforms/pipeline/stages/ssr-vf-modules/index.ts +1 -1
- package/src/src/transforms/veryfront-module-urls.ts +6 -2
- package/src/src/types/entities/getEntityInfo.ts +131 -152
- package/src/src/utils/path-utils.ts +16 -7
- package/src/src/utils/version-constant.ts +1 -1
- package/src/src/utils/version.ts +0 -1
- package/src/src/workflow/worker/dynamic-job-entrypoint.ts +18 -84
- package/src/src/workflow/worker/job-entrypoint.ts +18 -85
- package/src/src/workflow/worker/shared.ts +127 -0
- package/esm/src/prompt/schemas/index.d.ts +0 -7
- package/esm/src/prompt/schemas/index.d.ts.map +0 -1
- package/esm/src/prompt/schemas/index.js +0 -6
- package/esm/src/security/http/handlers-index.d.ts +0 -5
- package/esm/src/security/http/handlers-index.d.ts.map +0 -1
- package/esm/src/security/http/handlers-index.js +0 -3
- package/src/src/prompt/schemas/index.ts +0 -7
- package/src/src/security/http/handlers-index.ts +0 -4
|
@@ -206,12 +206,12 @@ export function normalizeConversationHistoryForRuntime(
|
|
|
206
206
|
|
|
207
207
|
export function resolveChannelInvokeAgent(
|
|
208
208
|
assistantId: string,
|
|
209
|
-
deps: Pick<ChannelInvokeDeps, "getAgent"
|
|
209
|
+
deps: Pick<ChannelInvokeDeps, "getAgent">,
|
|
210
210
|
): Agent | undefined {
|
|
211
211
|
return deps.getAgent(assistantId);
|
|
212
212
|
}
|
|
213
213
|
|
|
214
|
-
function
|
|
214
|
+
function toChannelToolCallState(status: string): "pending" | "completed" | "error" {
|
|
215
215
|
switch (status) {
|
|
216
216
|
case "completed":
|
|
217
217
|
return "completed";
|
|
@@ -281,7 +281,7 @@ export function buildChannelResponseParts(response: AgentResponse): ChannelRespo
|
|
|
281
281
|
id: toolCall.id,
|
|
282
282
|
name: toolCall.name,
|
|
283
283
|
input: toolCall.args,
|
|
284
|
-
state:
|
|
284
|
+
state: toChannelToolCallState(toolCall.status),
|
|
285
285
|
}));
|
|
286
286
|
|
|
287
287
|
if (toolCall.status === "completed" || toolCall.status === "error") {
|
|
@@ -314,7 +314,7 @@ export function buildChannelResponseParts(response: AgentResponse): ChannelRespo
|
|
|
314
314
|
return responseParts;
|
|
315
315
|
}
|
|
316
316
|
|
|
317
|
-
function
|
|
317
|
+
function classifyChannelInvokeError(error: unknown): ChannelInvokeResponse["error"] {
|
|
318
318
|
const veryfrontError = fromError(error);
|
|
319
319
|
|
|
320
320
|
if (veryfrontError?.type === "no_ai_available") {
|
|
@@ -352,12 +352,12 @@ export async function executeChannelInvoke(
|
|
|
352
352
|
};
|
|
353
353
|
}
|
|
354
354
|
|
|
355
|
-
const
|
|
355
|
+
const normalizedHistory = normalizeConversationHistoryForRuntime(payload.conversationHistory);
|
|
356
356
|
await agent.clearMemory();
|
|
357
357
|
|
|
358
358
|
try {
|
|
359
359
|
const result = await agent.generate({
|
|
360
|
-
input:
|
|
360
|
+
input: normalizedHistory,
|
|
361
361
|
context: {
|
|
362
362
|
requestId: payload.dispatchId,
|
|
363
363
|
dispatchId: payload.dispatchId,
|
|
@@ -395,7 +395,7 @@ export async function executeChannelInvoke(
|
|
|
395
395
|
|
|
396
396
|
return {
|
|
397
397
|
ignored: false,
|
|
398
|
-
error:
|
|
398
|
+
error: classifyChannelInvokeError(error),
|
|
399
399
|
};
|
|
400
400
|
}
|
|
401
401
|
}
|
package/src/src/chat/index.ts
CHANGED
|
@@ -47,55 +47,39 @@
|
|
|
47
47
|
* </Message.Root>
|
|
48
48
|
* ```
|
|
49
49
|
*/
|
|
50
|
-
|
|
51
|
-
// veryfront/chat — Chat UI components + hooks
|
|
52
|
-
//
|
|
53
|
-
// Merges components/ai (UI) and agent/react (hooks) into a single
|
|
54
|
-
// product-oriented import path.
|
|
55
|
-
|
|
56
|
-
// ---------------------------------------------------------------------------
|
|
57
|
-
// Core preset + compound
|
|
58
|
-
// ---------------------------------------------------------------------------
|
|
59
50
|
import "../../_dnt.polyfills.js";
|
|
60
51
|
|
|
61
52
|
|
|
62
|
-
export { Chat, ChatComponents } from "../react/components/ai/chat.js";
|
|
63
|
-
export type { ChatProps } from "../react/components/ai/chat.js";
|
|
64
|
-
|
|
65
|
-
// ---------------------------------------------------------------------------
|
|
66
|
-
// Composition building blocks
|
|
67
|
-
// ---------------------------------------------------------------------------
|
|
53
|
+
export { Chat, ChatComponents, type ChatProps } from "../react/components/ai/chat.js";
|
|
68
54
|
|
|
69
55
|
export {
|
|
70
56
|
ChatComposer,
|
|
57
|
+
type ChatComposerProps,
|
|
71
58
|
ChatEmpty,
|
|
59
|
+
type ChatEmptyProps,
|
|
72
60
|
ChatIf,
|
|
61
|
+
type ChatIfProps,
|
|
73
62
|
ChatMessageList,
|
|
63
|
+
type ChatMessageListProps,
|
|
74
64
|
ChatRoot,
|
|
65
|
+
type ChatRootProps,
|
|
75
66
|
ErrorBanner,
|
|
67
|
+
type ErrorBannerProps,
|
|
76
68
|
Message,
|
|
69
|
+
type MessageRootProps,
|
|
77
70
|
ModelAvatar,
|
|
71
|
+
type ModelAvatarProps,
|
|
78
72
|
} from "../react/components/ai/chat.js";
|
|
79
|
-
export type {
|
|
80
|
-
ChatComposerProps,
|
|
81
|
-
ChatEmptyProps,
|
|
82
|
-
ChatIfProps,
|
|
83
|
-
ChatMessageListProps,
|
|
84
|
-
ChatRootProps,
|
|
85
|
-
ErrorBannerProps,
|
|
86
|
-
MessageRootProps,
|
|
87
|
-
ModelAvatarProps,
|
|
88
|
-
} from "../react/components/ai/chat.js";
|
|
89
|
-
|
|
90
|
-
// ---------------------------------------------------------------------------
|
|
91
|
-
// Contexts
|
|
92
|
-
// ---------------------------------------------------------------------------
|
|
93
73
|
|
|
94
74
|
export {
|
|
95
75
|
ChatContextProvider,
|
|
76
|
+
type ChatContextValue,
|
|
96
77
|
ComposerContextProvider,
|
|
78
|
+
type ComposerContextValue,
|
|
97
79
|
MessageContextProvider,
|
|
80
|
+
type MessageContextValue,
|
|
98
81
|
ThreadListContextProvider,
|
|
82
|
+
type ThreadListContextValue,
|
|
99
83
|
useChatContext,
|
|
100
84
|
useChatContextOptional,
|
|
101
85
|
useComposerContext,
|
|
@@ -105,167 +89,147 @@ export {
|
|
|
105
89
|
useThreadListContext,
|
|
106
90
|
useThreadListContextOptional,
|
|
107
91
|
} from "../react/components/ai/chat.js";
|
|
108
|
-
export type {
|
|
109
|
-
ChatContextValue,
|
|
110
|
-
ComposerContextValue,
|
|
111
|
-
MessageContextValue,
|
|
112
|
-
ThreadListContextValue,
|
|
113
|
-
} from "../react/components/ai/chat.js";
|
|
114
|
-
|
|
115
|
-
// ---------------------------------------------------------------------------
|
|
116
|
-
// Sub-components
|
|
117
|
-
// ---------------------------------------------------------------------------
|
|
118
92
|
|
|
119
93
|
export {
|
|
94
|
+
type AttachmentInfo,
|
|
120
95
|
AttachmentPill,
|
|
96
|
+
type AttachmentPillProps,
|
|
121
97
|
BranchPicker,
|
|
98
|
+
type BranchPickerProps,
|
|
122
99
|
ChatSidebar,
|
|
100
|
+
type ChatSidebarProps,
|
|
101
|
+
type ChatTab,
|
|
123
102
|
ChatWithSidebar,
|
|
103
|
+
type ChatWithSidebarAttachmentConfig,
|
|
104
|
+
type ChatWithSidebarChatController,
|
|
105
|
+
type ChatWithSidebarFeatureConfig,
|
|
106
|
+
type ChatWithSidebarGroupedProps,
|
|
107
|
+
type ChatWithSidebarMessageConfig,
|
|
108
|
+
type ChatWithSidebarModelConfig,
|
|
109
|
+
type ChatWithSidebarProps,
|
|
110
|
+
type ChatWithSidebarQuickActionsConfig,
|
|
111
|
+
type ChatWithSidebarSidebarConfig,
|
|
112
|
+
type ChatWithSidebarTabsConfig,
|
|
113
|
+
type ChatWithSidebarVoiceConfig,
|
|
114
|
+
type CodeBlockProps,
|
|
124
115
|
ConversationEmptyState,
|
|
116
|
+
type ConversationEmptyStateProps,
|
|
125
117
|
ConversationScrollButton,
|
|
118
|
+
type ConversationScrollButtonProps,
|
|
126
119
|
downloadMarkdown,
|
|
127
120
|
DropZoneOverlay,
|
|
121
|
+
type DropZoneOverlayProps,
|
|
128
122
|
exportAsMarkdown,
|
|
129
123
|
extractSourcesFromParts,
|
|
130
124
|
FadeIn,
|
|
125
|
+
type FeedbackValue,
|
|
131
126
|
getTextContent,
|
|
132
127
|
groupPartsInOrder,
|
|
133
128
|
InferenceBadge,
|
|
129
|
+
type InferenceBadgeProps,
|
|
134
130
|
InlineCitation,
|
|
131
|
+
type InlineCitationProps,
|
|
135
132
|
isReasoningPart,
|
|
136
133
|
isSkillToolPart,
|
|
137
134
|
isToolPart,
|
|
138
135
|
Loader,
|
|
139
136
|
MessageActions,
|
|
137
|
+
type MessageActionsProps,
|
|
140
138
|
MessageEditForm,
|
|
139
|
+
type MessageEditFormProps,
|
|
141
140
|
MessageFeedback,
|
|
141
|
+
type MessageFeedbackProps,
|
|
142
|
+
type ModelOption,
|
|
142
143
|
ModelSelector,
|
|
144
|
+
type ModelSelectorProps,
|
|
145
|
+
type PartGroup,
|
|
146
|
+
type QuickAction,
|
|
143
147
|
QuickActions,
|
|
148
|
+
type QuickActionsProps,
|
|
144
149
|
ReasoningCard,
|
|
145
150
|
RichCodeBlock,
|
|
146
151
|
Shimmer,
|
|
147
152
|
SkillBadge,
|
|
153
|
+
type SkillBadgeProps,
|
|
154
|
+
type Source,
|
|
148
155
|
Sources,
|
|
156
|
+
type SourcesProps,
|
|
149
157
|
StepIndicator,
|
|
158
|
+
type StepIndicatorProps,
|
|
150
159
|
Suggestion,
|
|
160
|
+
type SuggestionProps,
|
|
151
161
|
Suggestions,
|
|
162
|
+
type SuggestionsProps,
|
|
152
163
|
TabSwitcher,
|
|
164
|
+
type TabSwitcherProps,
|
|
165
|
+
type Thread,
|
|
153
166
|
ToolCallCard,
|
|
154
167
|
ToolStatusBadge,
|
|
155
168
|
UpgradeCTA,
|
|
169
|
+
type UpgradeCTAProps,
|
|
170
|
+
type UploadedFile,
|
|
156
171
|
UploadsPanel,
|
|
172
|
+
type UploadsPanelProps,
|
|
157
173
|
useThreads,
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
AttachmentInfo,
|
|
161
|
-
AttachmentPillProps,
|
|
162
|
-
BranchPickerProps,
|
|
163
|
-
ChatSidebarProps,
|
|
164
|
-
ChatTab,
|
|
165
|
-
ChatWithSidebarAttachmentConfig,
|
|
166
|
-
ChatWithSidebarChatController,
|
|
167
|
-
ChatWithSidebarFeatureConfig,
|
|
168
|
-
ChatWithSidebarGroupedProps,
|
|
169
|
-
ChatWithSidebarMessageConfig,
|
|
170
|
-
ChatWithSidebarModelConfig,
|
|
171
|
-
ChatWithSidebarProps,
|
|
172
|
-
ChatWithSidebarQuickActionsConfig,
|
|
173
|
-
ChatWithSidebarSidebarConfig,
|
|
174
|
-
ChatWithSidebarTabsConfig,
|
|
175
|
-
ChatWithSidebarVoiceConfig,
|
|
176
|
-
CodeBlockProps,
|
|
177
|
-
ConversationEmptyStateProps,
|
|
178
|
-
ConversationScrollButtonProps,
|
|
179
|
-
DropZoneOverlayProps,
|
|
180
|
-
FeedbackValue,
|
|
181
|
-
InferenceBadgeProps,
|
|
182
|
-
InlineCitationProps,
|
|
183
|
-
MessageActionsProps,
|
|
184
|
-
MessageEditFormProps,
|
|
185
|
-
MessageFeedbackProps,
|
|
186
|
-
ModelOption,
|
|
187
|
-
ModelSelectorProps,
|
|
188
|
-
PartGroup,
|
|
189
|
-
QuickAction,
|
|
190
|
-
QuickActionsProps,
|
|
191
|
-
SkillBadgeProps,
|
|
192
|
-
Source,
|
|
193
|
-
SourcesProps,
|
|
194
|
-
StepIndicatorProps,
|
|
195
|
-
SuggestionProps,
|
|
196
|
-
SuggestionsProps,
|
|
197
|
-
TabSwitcherProps,
|
|
198
|
-
Thread,
|
|
199
|
-
UpgradeCTAProps,
|
|
200
|
-
UploadedFile,
|
|
201
|
-
UploadsPanelProps,
|
|
202
|
-
UseThreadsOptions,
|
|
203
|
-
UseThreadsResult,
|
|
174
|
+
type UseThreadsOptions,
|
|
175
|
+
type UseThreadsResult,
|
|
204
176
|
} from "../react/components/ai/chat.js";
|
|
205
177
|
|
|
206
|
-
// Message (standalone bubble, not the chat compound)
|
|
207
178
|
export {
|
|
208
179
|
Message as StandaloneMessage,
|
|
180
|
+
type MessageProps,
|
|
209
181
|
StreamingMessage,
|
|
210
|
-
|
|
211
|
-
export type {
|
|
212
|
-
MessageProps,
|
|
213
|
-
StreamingMessageProps,
|
|
182
|
+
type StreamingMessageProps,
|
|
214
183
|
} from "../react/components/ai/message.js";
|
|
215
184
|
|
|
216
|
-
export { AgentCard } from "../react/components/ai/agent-card.js";
|
|
217
|
-
export type { AgentCardProps } from "../react/components/ai/agent-card.js";
|
|
218
|
-
|
|
185
|
+
export { AgentCard, type AgentCardProps } from "../react/components/ai/agent-card.js";
|
|
219
186
|
export {
|
|
220
187
|
AIErrorBoundary,
|
|
188
|
+
type AIErrorBoundaryProps,
|
|
221
189
|
useAIErrorHandler,
|
|
222
190
|
} from "../react/components/ai/error-boundary.js";
|
|
223
|
-
export type { AIErrorBoundaryProps } from "../react/components/ai/error-boundary.js";
|
|
224
|
-
|
|
225
|
-
// Types only from theme
|
|
226
191
|
export type { AgentTheme, ChatTheme } from "../react/components/ai/theme.js";
|
|
227
192
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
UIMessage,
|
|
247
|
-
UIMessagePart,
|
|
248
|
-
UseChatOptions,
|
|
249
|
-
UseChatResult,
|
|
193
|
+
export {
|
|
194
|
+
type BranchInfo,
|
|
195
|
+
type BrowserInferenceStatus,
|
|
196
|
+
type DynamicToolUIPart,
|
|
197
|
+
type InferenceMode,
|
|
198
|
+
type OnToolCallArg,
|
|
199
|
+
type ReasoningUIPart,
|
|
200
|
+
type StepUIPart,
|
|
201
|
+
type TextUIPart,
|
|
202
|
+
type ToolOutput,
|
|
203
|
+
type ToolResultUIPart,
|
|
204
|
+
type ToolState,
|
|
205
|
+
type ToolUIPart,
|
|
206
|
+
type UIMessage,
|
|
207
|
+
type UIMessagePart,
|
|
208
|
+
useChat,
|
|
209
|
+
type UseChatOptions,
|
|
210
|
+
type UseChatResult,
|
|
250
211
|
} from "../agent/react/use-chat/index.js";
|
|
251
212
|
|
|
252
|
-
export {
|
|
253
|
-
|
|
213
|
+
export {
|
|
214
|
+
useAgent,
|
|
215
|
+
type UseAgentOptions,
|
|
216
|
+
type UseAgentResult,
|
|
217
|
+
} from "../agent/react/use-agent.js";
|
|
254
218
|
|
|
255
|
-
export {
|
|
256
|
-
|
|
257
|
-
UseCompletionOptions,
|
|
258
|
-
UseCompletionResult,
|
|
219
|
+
export {
|
|
220
|
+
useCompletion,
|
|
221
|
+
type UseCompletionOptions,
|
|
222
|
+
type UseCompletionResult,
|
|
259
223
|
} from "../agent/react/use-completion.js";
|
|
260
224
|
|
|
261
|
-
export {
|
|
262
|
-
|
|
263
|
-
UseStreamingOptions,
|
|
264
|
-
UseStreamingResult,
|
|
225
|
+
export {
|
|
226
|
+
useStreaming,
|
|
227
|
+
type UseStreamingOptions,
|
|
228
|
+
type UseStreamingResult,
|
|
265
229
|
} from "../agent/react/use-streaming.js";
|
|
266
230
|
|
|
267
|
-
export {
|
|
268
|
-
|
|
269
|
-
UseVoiceInputOptions,
|
|
270
|
-
UseVoiceInputResult,
|
|
231
|
+
export {
|
|
232
|
+
useVoiceInput,
|
|
233
|
+
type UseVoiceInputOptions,
|
|
234
|
+
type UseVoiceInputResult,
|
|
271
235
|
} from "../agent/react/use-voice-input.js";
|
package/src/src/config/env.ts
CHANGED
|
@@ -14,6 +14,24 @@
|
|
|
14
14
|
import { type EnvironmentConfig, getEnvironmentConfig } from "./environment-config.js";
|
|
15
15
|
import { getEnv } from "../platform/compat/process.js";
|
|
16
16
|
|
|
17
|
+
function toEnabledFlag<T extends string>(enabled: boolean, truthyValue: T): T | undefined {
|
|
18
|
+
return enabled ? truthyValue : undefined;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function toCliBooleanFlag(enabled: boolean): "1" | undefined {
|
|
22
|
+
return toEnabledFlag(enabled, "1");
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function getBaseOtelConfig(env: EnvironmentConfig): {
|
|
26
|
+
veryfrontFlag?: string;
|
|
27
|
+
endpoint?: string;
|
|
28
|
+
} {
|
|
29
|
+
return {
|
|
30
|
+
veryfrontFlag: toCliBooleanFlag(env.otelEnabled),
|
|
31
|
+
endpoint: env.otelEndpoint,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
17
35
|
export function getDisableLruIntervalEnv(env: EnvironmentConfig = getEnvironmentConfig()): boolean {
|
|
18
36
|
return env.disableLruInterval;
|
|
19
37
|
}
|
|
@@ -108,13 +126,13 @@ export function isDenoTestingEnv(env: EnvironmentConfig = getEnvironmentConfig()
|
|
|
108
126
|
}
|
|
109
127
|
|
|
110
128
|
export function getNoColorEnv(env: EnvironmentConfig = getEnvironmentConfig()): string | undefined {
|
|
111
|
-
return env.noColor
|
|
129
|
+
return toCliBooleanFlag(env.noColor);
|
|
112
130
|
}
|
|
113
131
|
|
|
114
132
|
export function getForceColorEnv(
|
|
115
133
|
env: EnvironmentConfig = getEnvironmentConfig(),
|
|
116
134
|
): string | undefined {
|
|
117
|
-
return env.forceColor
|
|
135
|
+
return toCliBooleanFlag(env.forceColor);
|
|
118
136
|
}
|
|
119
137
|
|
|
120
138
|
export function isRscExperimentalEnabled(env: EnvironmentConfig = getEnvironmentConfig()): boolean {
|
|
@@ -143,14 +161,10 @@ export function getOtelTracingConfig(env: EnvironmentConfig = getEnvironmentConf
|
|
|
143
161
|
headers?: string;
|
|
144
162
|
tracesHeaders?: string;
|
|
145
163
|
} {
|
|
146
|
-
const enabledFlag = env.otelEnabled ? "true" : undefined;
|
|
147
|
-
const veryfrontFlag = env.otelEnabled ? "1" : undefined;
|
|
148
|
-
|
|
149
164
|
return {
|
|
150
|
-
enabledFlag,
|
|
151
|
-
|
|
165
|
+
enabledFlag: toEnabledFlag(env.otelEnabled, "true"),
|
|
166
|
+
...getBaseOtelConfig(env),
|
|
152
167
|
serviceName: env.otelServiceName,
|
|
153
|
-
endpoint: env.otelEndpoint,
|
|
154
168
|
tracesEndpoint: env.otelTracesEndpoint,
|
|
155
169
|
exporter: env.otelTracesExporter,
|
|
156
170
|
headers: env.otelHeaders,
|
|
@@ -166,9 +180,8 @@ export function getOtelMetricsConfig(env: EnvironmentConfig = getEnvironmentConf
|
|
|
166
180
|
exporter?: string;
|
|
167
181
|
} {
|
|
168
182
|
return {
|
|
169
|
-
enabledFlag: env.otelMetricsEnabled
|
|
170
|
-
|
|
171
|
-
endpoint: env.otelEndpoint,
|
|
183
|
+
enabledFlag: toCliBooleanFlag(env.otelMetricsEnabled),
|
|
184
|
+
...getBaseOtelConfig(env),
|
|
172
185
|
metricsEndpoint: env.otelMetricsEndpoint,
|
|
173
186
|
exporter: env.otelMetricsExporter,
|
|
174
187
|
};
|
|
@@ -47,24 +47,27 @@ function releaseRevalidationSlot(projectId: string): void {
|
|
|
47
47
|
projectRevalidationCounts.set(projectId, current - 1);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
function
|
|
50
|
+
function resolveProjectId(context: DataContext, fallback: string): string {
|
|
51
51
|
return context.request?.headers?.get("x-project-id") ?? context.url?.hostname ?? fallback;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
type StaticDataHandler = NonNullable<PageWithData["getStaticData"]>;
|
|
55
|
+
|
|
54
56
|
export class StaticDataFetcher {
|
|
55
57
|
private pendingRevalidations = new Map<string, Promise<void>>();
|
|
56
58
|
|
|
57
59
|
constructor(private cacheManager: CacheManager) {}
|
|
58
60
|
|
|
59
61
|
async fetch(pageModule: PageWithData, context: DataContext): Promise<DataResult> {
|
|
60
|
-
|
|
62
|
+
const getStaticData = pageModule.getStaticData;
|
|
63
|
+
if (typeof getStaticData !== "function") return { props: {} };
|
|
61
64
|
|
|
62
65
|
const pathname = context.url?.pathname ?? "unknown";
|
|
63
66
|
const cacheKey = this.cacheManager.createCacheKey(context);
|
|
64
67
|
|
|
65
68
|
// No caching in preview mode (cacheKey is null)
|
|
66
69
|
if (!cacheKey) {
|
|
67
|
-
return withSpan("data.fetch_static", () => this.fetchFreshNoCache(
|
|
70
|
+
return withSpan("data.fetch_static", () => this.fetchFreshNoCache(getStaticData, context), {
|
|
68
71
|
"data.fetch_method": "getStaticData",
|
|
69
72
|
"data.pathname": pathname,
|
|
70
73
|
"data.cache": "disabled",
|
|
@@ -78,33 +81,65 @@ export class StaticDataFetcher {
|
|
|
78
81
|
);
|
|
79
82
|
|
|
80
83
|
if (!cached) {
|
|
81
|
-
return withSpan(
|
|
82
|
-
"data.
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
return withSpan(
|
|
85
|
+
"data.fetch_static",
|
|
86
|
+
() => this.fetchFresh(getStaticData, context, cacheKey),
|
|
87
|
+
{
|
|
88
|
+
"data.fetch_method": "getStaticData",
|
|
89
|
+
"data.pathname": pathname,
|
|
90
|
+
"data.cache": "miss",
|
|
91
|
+
},
|
|
92
|
+
);
|
|
86
93
|
}
|
|
87
94
|
|
|
88
95
|
if (this.cacheManager.shouldRevalidate(cached) && !this.pendingRevalidations.has(cacheKey)) {
|
|
89
96
|
this.pendingRevalidations.set(
|
|
90
97
|
cacheKey,
|
|
91
|
-
this.revalidateInBackground(
|
|
98
|
+
this.revalidateInBackground(getStaticData, context, cacheKey),
|
|
92
99
|
);
|
|
93
100
|
}
|
|
94
101
|
|
|
95
102
|
return cached.data;
|
|
96
103
|
}
|
|
97
104
|
|
|
105
|
+
private createStaticDataContext(
|
|
106
|
+
context: DataContext,
|
|
107
|
+
): Omit<DataContext, "request" | "query"> {
|
|
108
|
+
return { params: context.params, url: context.url };
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
private executeStaticData(
|
|
112
|
+
getStaticData: StaticDataHandler,
|
|
113
|
+
context: DataContext,
|
|
114
|
+
timeoutMs: number,
|
|
115
|
+
label: string,
|
|
116
|
+
): Promise<DataResult> {
|
|
117
|
+
return withTimeoutThrow(
|
|
118
|
+
Promise.resolve(getStaticData(this.createStaticDataContext(context))),
|
|
119
|
+
timeoutMs,
|
|
120
|
+
label,
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
private storeCacheEntry(cacheKey: string, result: DataResult): void {
|
|
125
|
+
this.cacheManager.set(cacheKey, {
|
|
126
|
+
data: result,
|
|
127
|
+
timestamp: Date.now(),
|
|
128
|
+
revalidate: result.revalidate,
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
|
|
98
132
|
private async fetchFreshNoCache(
|
|
99
|
-
|
|
133
|
+
getStaticData: StaticDataHandler,
|
|
100
134
|
context: DataContext,
|
|
101
135
|
): Promise<DataResult> {
|
|
102
136
|
const pathname = context.url?.pathname ?? "unknown";
|
|
103
137
|
const start = performance.now();
|
|
104
138
|
|
|
105
139
|
try {
|
|
106
|
-
return await
|
|
107
|
-
|
|
140
|
+
return await this.executeStaticData(
|
|
141
|
+
getStaticData,
|
|
142
|
+
context,
|
|
108
143
|
DATA_FETCH_TIMEOUT_MS,
|
|
109
144
|
`getStaticData for ${pathname}`,
|
|
110
145
|
);
|
|
@@ -126,13 +161,13 @@ export class StaticDataFetcher {
|
|
|
126
161
|
}
|
|
127
162
|
|
|
128
163
|
private async fetchFresh(
|
|
129
|
-
|
|
164
|
+
getStaticData: StaticDataHandler,
|
|
130
165
|
context: DataContext,
|
|
131
166
|
cacheKey: string,
|
|
132
167
|
): Promise<DataResult> {
|
|
133
168
|
const pathname = context.url?.pathname ?? "unknown";
|
|
134
169
|
// Extract projectId from request headers (set by proxy) for proper circuit breaker isolation
|
|
135
|
-
const projectId =
|
|
170
|
+
const projectId = resolveProjectId(context, "default");
|
|
136
171
|
const start = performance.now();
|
|
137
172
|
|
|
138
173
|
// Circuit breaker per project to prevent cascade failures
|
|
@@ -144,8 +179,9 @@ export class StaticDataFetcher {
|
|
|
144
179
|
|
|
145
180
|
try {
|
|
146
181
|
const result = await circuitBreaker.execute(() =>
|
|
147
|
-
|
|
148
|
-
|
|
182
|
+
this.executeStaticData(
|
|
183
|
+
getStaticData,
|
|
184
|
+
context,
|
|
149
185
|
DATA_FETCH_TIMEOUT_MS,
|
|
150
186
|
`getStaticData for ${pathname}`,
|
|
151
187
|
)
|
|
@@ -154,11 +190,7 @@ export class StaticDataFetcher {
|
|
|
154
190
|
await withSpan(
|
|
155
191
|
SpanNames.DATA_CACHE_SET,
|
|
156
192
|
() => {
|
|
157
|
-
this.
|
|
158
|
-
data: result,
|
|
159
|
-
timestamp: Date.now(),
|
|
160
|
-
revalidate: result.revalidate,
|
|
161
|
-
});
|
|
193
|
+
this.storeCacheEntry(cacheKey, result);
|
|
162
194
|
return Promise.resolve();
|
|
163
195
|
},
|
|
164
196
|
{ "data.cache_key": cacheKey, "data.revalidate": result.revalidate ?? 0 },
|
|
@@ -198,15 +230,13 @@ export class StaticDataFetcher {
|
|
|
198
230
|
}
|
|
199
231
|
|
|
200
232
|
private async revalidateInBackground(
|
|
201
|
-
|
|
233
|
+
getStaticData: StaticDataHandler,
|
|
202
234
|
context: DataContext,
|
|
203
235
|
cacheKey: string,
|
|
204
236
|
): Promise<void> {
|
|
205
|
-
if (typeof pageModule.getStaticData !== "function") return;
|
|
206
|
-
|
|
207
237
|
const pathname = context.url?.pathname ?? "unknown";
|
|
208
238
|
// Use projectId from request headers for proper per-project fairness
|
|
209
|
-
const projectId =
|
|
239
|
+
const projectId = resolveProjectId(context, "unknown");
|
|
210
240
|
|
|
211
241
|
// Check per-project limit before acquiring global semaphore
|
|
212
242
|
if (!acquireRevalidationSlot(projectId)) {
|
|
@@ -225,19 +255,14 @@ export class StaticDataFetcher {
|
|
|
225
255
|
const start = performance.now();
|
|
226
256
|
|
|
227
257
|
try {
|
|
228
|
-
const result = await
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
),
|
|
258
|
+
const result = await this.executeStaticData(
|
|
259
|
+
getStaticData,
|
|
260
|
+
context,
|
|
232
261
|
REVALIDATION_TIMEOUT_MS,
|
|
233
262
|
`getStaticData revalidation for ${pathname}`,
|
|
234
263
|
);
|
|
235
264
|
|
|
236
|
-
this.
|
|
237
|
-
data: result,
|
|
238
|
-
timestamp: Date.now(),
|
|
239
|
-
revalidate: result.revalidate,
|
|
240
|
-
});
|
|
265
|
+
this.storeCacheEntry(cacheKey, result);
|
|
241
266
|
} catch (error) {
|
|
242
267
|
const durationMs = Math.round(performance.now() - start);
|
|
243
268
|
|
|
@@ -4,6 +4,8 @@ import { withSpan } from "../observability/tracing/otlp-setup.js";
|
|
|
4
4
|
import { SpanNames } from "../observability/tracing/span-names.js";
|
|
5
5
|
import type { Span } from "@opentelemetry/api";
|
|
6
6
|
|
|
7
|
+
const EMPTY_STATIC_PATHS_RESULT: StaticPathsResult = { paths: [], fallback: false };
|
|
8
|
+
|
|
7
9
|
export class StaticPathsFetcher {
|
|
8
10
|
fetch(pageModule: PageWithData): Promise<StaticPathsResult | null> {
|
|
9
11
|
const getStaticPaths = pageModule.getStaticPaths;
|
|
@@ -16,14 +18,14 @@ export class StaticPathsFetcher {
|
|
|
16
18
|
async (span?: Span) => {
|
|
17
19
|
try {
|
|
18
20
|
const result = await getStaticPaths();
|
|
19
|
-
const finalResult = result ??
|
|
21
|
+
const finalResult = result ?? EMPTY_STATIC_PATHS_RESULT;
|
|
20
22
|
|
|
21
23
|
span?.setAttribute("data.paths_count", finalResult.paths?.length ?? 0);
|
|
22
24
|
span?.setAttribute("data.fallback", String(finalResult.fallback ?? false));
|
|
23
25
|
|
|
24
26
|
return finalResult;
|
|
25
27
|
} catch (error) {
|
|
26
|
-
serverLogger.error("
|
|
28
|
+
serverLogger.error("DATA_FETCH_STATIC_PATHS_ERROR getStaticPaths failed", {}, error);
|
|
27
29
|
throw error;
|
|
28
30
|
}
|
|
29
31
|
},
|