@frontmcp/uipack 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +246 -0
- package/LICENSE +201 -0
- package/README.md +150 -0
- package/adapters/index.d.ts +13 -0
- package/adapters/index.d.ts.map +1 -0
- package/adapters/index.js +462 -0
- package/adapters/platform-meta.d.ts +166 -0
- package/adapters/platform-meta.d.ts.map +1 -0
- package/adapters/response-builder.d.ts +108 -0
- package/adapters/response-builder.d.ts.map +1 -0
- package/adapters/serving-mode.d.ts +107 -0
- package/adapters/serving-mode.d.ts.map +1 -0
- package/base-template/bridge.d.ts +90 -0
- package/base-template/bridge.d.ts.map +1 -0
- package/base-template/default-base-template.d.ts +92 -0
- package/base-template/default-base-template.d.ts.map +1 -0
- package/base-template/index.d.ts +15 -0
- package/base-template/index.d.ts.map +1 -0
- package/base-template/index.js +1398 -0
- package/base-template/polyfills.d.ts +31 -0
- package/base-template/polyfills.d.ts.map +1 -0
- package/base-template/theme-styles.d.ts +74 -0
- package/base-template/theme-styles.d.ts.map +1 -0
- package/bridge-runtime/iife-generator.d.ts +62 -0
- package/bridge-runtime/iife-generator.d.ts.map +1 -0
- package/bridge-runtime/index.d.ts +10 -0
- package/bridge-runtime/index.d.ts.map +1 -0
- package/bridge-runtime/index.js +883 -0
- package/build/cdn-resources.d.ts +243 -0
- package/build/cdn-resources.d.ts.map +1 -0
- package/build/index.d.ts +295 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +6861 -0
- package/build/widget-manifest.d.ts +362 -0
- package/build/widget-manifest.d.ts.map +1 -0
- package/bundler/cache.d.ts +173 -0
- package/bundler/cache.d.ts.map +1 -0
- package/bundler/file-cache/component-builder.d.ts +167 -0
- package/bundler/file-cache/component-builder.d.ts.map +1 -0
- package/bundler/file-cache/hash-calculator.d.ts +155 -0
- package/bundler/file-cache/hash-calculator.d.ts.map +1 -0
- package/bundler/file-cache/index.d.ts +12 -0
- package/bundler/file-cache/index.d.ts.map +1 -0
- package/bundler/file-cache/storage/filesystem.d.ts +149 -0
- package/bundler/file-cache/storage/filesystem.d.ts.map +1 -0
- package/bundler/file-cache/storage/index.d.ts +11 -0
- package/bundler/file-cache/storage/index.d.ts.map +1 -0
- package/bundler/file-cache/storage/interface.d.ts +152 -0
- package/bundler/file-cache/storage/interface.d.ts.map +1 -0
- package/bundler/file-cache/storage/redis.d.ts +139 -0
- package/bundler/file-cache/storage/redis.d.ts.map +1 -0
- package/bundler/index.d.ts +35 -0
- package/bundler/index.d.ts.map +1 -0
- package/bundler/index.js +2947 -0
- package/bundler/sandbox/enclave-adapter.d.ts +121 -0
- package/bundler/sandbox/enclave-adapter.d.ts.map +1 -0
- package/bundler/sandbox/executor.d.ts +14 -0
- package/bundler/sandbox/executor.d.ts.map +1 -0
- package/bundler/sandbox/policy.d.ts +62 -0
- package/bundler/sandbox/policy.d.ts.map +1 -0
- package/bundler/types.d.ts +702 -0
- package/bundler/types.d.ts.map +1 -0
- package/dependency/cdn-registry.d.ts +98 -0
- package/dependency/cdn-registry.d.ts.map +1 -0
- package/dependency/import-map.d.ts +186 -0
- package/dependency/import-map.d.ts.map +1 -0
- package/dependency/import-parser.d.ts +82 -0
- package/dependency/import-parser.d.ts.map +1 -0
- package/dependency/index.d.ts +17 -0
- package/dependency/index.d.ts.map +1 -0
- package/dependency/index.js +3215 -0
- package/dependency/resolver.d.ts +164 -0
- package/dependency/resolver.d.ts.map +1 -0
- package/dependency/schemas.d.ts +486 -0
- package/dependency/schemas.d.ts.map +1 -0
- package/dependency/template-loader.d.ts +204 -0
- package/dependency/template-loader.d.ts.map +1 -0
- package/dependency/template-processor.d.ts +118 -0
- package/dependency/template-processor.d.ts.map +1 -0
- package/dependency/types.d.ts +739 -0
- package/dependency/types.d.ts.map +1 -0
- package/esm/adapters/index.d.ts +13 -0
- package/esm/adapters/index.d.ts.map +1 -0
- package/esm/adapters/index.js +427 -0
- package/esm/adapters/platform-meta.d.ts +166 -0
- package/esm/adapters/platform-meta.d.ts.map +1 -0
- package/esm/adapters/response-builder.d.ts +108 -0
- package/esm/adapters/response-builder.d.ts.map +1 -0
- package/esm/adapters/serving-mode.d.ts +107 -0
- package/esm/adapters/serving-mode.d.ts.map +1 -0
- package/esm/base-template/bridge.d.ts +90 -0
- package/esm/base-template/bridge.d.ts.map +1 -0
- package/esm/base-template/default-base-template.d.ts +92 -0
- package/esm/base-template/default-base-template.d.ts.map +1 -0
- package/esm/base-template/index.d.ts +15 -0
- package/esm/base-template/index.d.ts.map +1 -0
- package/esm/base-template/index.js +1364 -0
- package/esm/base-template/polyfills.d.ts +31 -0
- package/esm/base-template/polyfills.d.ts.map +1 -0
- package/esm/base-template/theme-styles.d.ts +74 -0
- package/esm/base-template/theme-styles.d.ts.map +1 -0
- package/esm/bridge-runtime/iife-generator.d.ts +62 -0
- package/esm/bridge-runtime/iife-generator.d.ts.map +1 -0
- package/esm/bridge-runtime/index.d.ts +10 -0
- package/esm/bridge-runtime/index.d.ts.map +1 -0
- package/esm/bridge-runtime/index.js +853 -0
- package/esm/build/cdn-resources.d.ts +243 -0
- package/esm/build/cdn-resources.d.ts.map +1 -0
- package/esm/build/index.d.ts +295 -0
- package/esm/build/index.d.ts.map +1 -0
- package/esm/build/index.js +6786 -0
- package/esm/build/widget-manifest.d.ts +362 -0
- package/esm/build/widget-manifest.d.ts.map +1 -0
- package/esm/bundler/cache.d.ts +173 -0
- package/esm/bundler/cache.d.ts.map +1 -0
- package/esm/bundler/file-cache/component-builder.d.ts +167 -0
- package/esm/bundler/file-cache/component-builder.d.ts.map +1 -0
- package/esm/bundler/file-cache/hash-calculator.d.ts +155 -0
- package/esm/bundler/file-cache/hash-calculator.d.ts.map +1 -0
- package/esm/bundler/file-cache/index.d.ts +12 -0
- package/esm/bundler/file-cache/index.d.ts.map +1 -0
- package/esm/bundler/file-cache/storage/filesystem.d.ts +149 -0
- package/esm/bundler/file-cache/storage/filesystem.d.ts.map +1 -0
- package/esm/bundler/file-cache/storage/index.d.ts +11 -0
- package/esm/bundler/file-cache/storage/index.d.ts.map +1 -0
- package/esm/bundler/file-cache/storage/interface.d.ts +152 -0
- package/esm/bundler/file-cache/storage/interface.d.ts.map +1 -0
- package/esm/bundler/file-cache/storage/redis.d.ts +139 -0
- package/esm/bundler/file-cache/storage/redis.d.ts.map +1 -0
- package/esm/bundler/index.d.ts +35 -0
- package/esm/bundler/index.d.ts.map +1 -0
- package/esm/bundler/index.js +2882 -0
- package/esm/bundler/sandbox/enclave-adapter.d.ts +121 -0
- package/esm/bundler/sandbox/enclave-adapter.d.ts.map +1 -0
- package/esm/bundler/sandbox/executor.d.ts +14 -0
- package/esm/bundler/sandbox/executor.d.ts.map +1 -0
- package/esm/bundler/sandbox/policy.d.ts +62 -0
- package/esm/bundler/sandbox/policy.d.ts.map +1 -0
- package/esm/bundler/types.d.ts +702 -0
- package/esm/bundler/types.d.ts.map +1 -0
- package/esm/dependency/cdn-registry.d.ts +98 -0
- package/esm/dependency/cdn-registry.d.ts.map +1 -0
- package/esm/dependency/import-map.d.ts +186 -0
- package/esm/dependency/import-map.d.ts.map +1 -0
- package/esm/dependency/import-parser.d.ts +82 -0
- package/esm/dependency/import-parser.d.ts.map +1 -0
- package/esm/dependency/index.d.ts +17 -0
- package/esm/dependency/index.d.ts.map +1 -0
- package/esm/dependency/index.js +3096 -0
- package/esm/dependency/resolver.d.ts +164 -0
- package/esm/dependency/resolver.d.ts.map +1 -0
- package/esm/dependency/schemas.d.ts +486 -0
- package/esm/dependency/schemas.d.ts.map +1 -0
- package/esm/dependency/template-loader.d.ts +204 -0
- package/esm/dependency/template-loader.d.ts.map +1 -0
- package/esm/dependency/template-processor.d.ts +118 -0
- package/esm/dependency/template-processor.d.ts.map +1 -0
- package/esm/dependency/types.d.ts +739 -0
- package/esm/dependency/types.d.ts.map +1 -0
- package/esm/handlebars/expression-extractor.d.ts +147 -0
- package/esm/handlebars/expression-extractor.d.ts.map +1 -0
- package/esm/handlebars/helpers.d.ts +339 -0
- package/esm/handlebars/helpers.d.ts.map +1 -0
- package/esm/handlebars/index.d.ts +195 -0
- package/esm/handlebars/index.d.ts.map +1 -0
- package/esm/handlebars/index.js +587 -0
- package/esm/index.d.ts +50 -0
- package/esm/index.d.ts.map +1 -0
- package/esm/index.js +12434 -0
- package/esm/package.json +68 -0
- package/esm/registry/index.d.ts +46 -0
- package/esm/registry/index.d.ts.map +1 -0
- package/esm/registry/index.js +6237 -0
- package/esm/registry/render-template.d.ts +91 -0
- package/esm/registry/render-template.d.ts.map +1 -0
- package/esm/registry/tool-ui.registry.d.ts +294 -0
- package/esm/registry/tool-ui.registry.d.ts.map +1 -0
- package/esm/registry/uri-utils.d.ts +56 -0
- package/esm/registry/uri-utils.d.ts.map +1 -0
- package/esm/renderers/cache.d.ts +145 -0
- package/esm/renderers/cache.d.ts.map +1 -0
- package/esm/renderers/html.renderer.d.ts +123 -0
- package/esm/renderers/html.renderer.d.ts.map +1 -0
- package/esm/renderers/index.d.ts +36 -0
- package/esm/renderers/index.d.ts.map +1 -0
- package/esm/renderers/index.js +1654 -0
- package/esm/renderers/mdx.renderer.d.ts +120 -0
- package/esm/renderers/mdx.renderer.d.ts.map +1 -0
- package/esm/renderers/registry.d.ts +133 -0
- package/esm/renderers/registry.d.ts.map +1 -0
- package/esm/renderers/types.d.ts +342 -0
- package/esm/renderers/types.d.ts.map +1 -0
- package/esm/renderers/utils/detect.d.ts +107 -0
- package/esm/renderers/utils/detect.d.ts.map +1 -0
- package/esm/renderers/utils/hash.d.ts +40 -0
- package/esm/renderers/utils/hash.d.ts.map +1 -0
- package/esm/renderers/utils/index.d.ts +9 -0
- package/esm/renderers/utils/index.d.ts.map +1 -0
- package/esm/renderers/utils/transpiler.d.ts +89 -0
- package/esm/renderers/utils/transpiler.d.ts.map +1 -0
- package/esm/runtime/adapters/html.adapter.d.ts +59 -0
- package/esm/runtime/adapters/html.adapter.d.ts.map +1 -0
- package/esm/runtime/adapters/index.d.ts +26 -0
- package/esm/runtime/adapters/index.d.ts.map +1 -0
- package/esm/runtime/adapters/mdx.adapter.d.ts +73 -0
- package/esm/runtime/adapters/mdx.adapter.d.ts.map +1 -0
- package/esm/runtime/adapters/types.d.ts +95 -0
- package/esm/runtime/adapters/types.d.ts.map +1 -0
- package/esm/runtime/csp.d.ts +48 -0
- package/esm/runtime/csp.d.ts.map +1 -0
- package/esm/runtime/index.d.ts +17 -0
- package/esm/runtime/index.d.ts.map +1 -0
- package/esm/runtime/index.js +4976 -0
- package/esm/runtime/mcp-bridge.d.ts +101 -0
- package/esm/runtime/mcp-bridge.d.ts.map +1 -0
- package/esm/runtime/renderer-runtime.d.ts +133 -0
- package/esm/runtime/renderer-runtime.d.ts.map +1 -0
- package/esm/runtime/sanitizer.d.ts +172 -0
- package/esm/runtime/sanitizer.d.ts.map +1 -0
- package/esm/runtime/types.d.ts +415 -0
- package/esm/runtime/types.d.ts.map +1 -0
- package/esm/runtime/wrapper.d.ts +421 -0
- package/esm/runtime/wrapper.d.ts.map +1 -0
- package/esm/styles/index.d.ts +8 -0
- package/esm/styles/index.d.ts.map +1 -0
- package/esm/styles/index.js +171 -0
- package/esm/styles/variants.d.ts +51 -0
- package/esm/styles/variants.d.ts.map +1 -0
- package/esm/theme/cdn.d.ts +195 -0
- package/esm/theme/cdn.d.ts.map +1 -0
- package/esm/theme/index.d.ts +18 -0
- package/esm/theme/index.d.ts.map +1 -0
- package/esm/theme/index.js +700 -0
- package/esm/theme/platforms.d.ts +107 -0
- package/esm/theme/platforms.d.ts.map +1 -0
- package/esm/theme/presets/github-openai.d.ts +50 -0
- package/esm/theme/presets/github-openai.d.ts.map +1 -0
- package/esm/theme/presets/index.d.ts +11 -0
- package/esm/theme/presets/index.d.ts.map +1 -0
- package/esm/theme/theme.d.ts +396 -0
- package/esm/theme/theme.d.ts.map +1 -0
- package/esm/tool-template/builder.d.ts +213 -0
- package/esm/tool-template/builder.d.ts.map +1 -0
- package/esm/tool-template/index.d.ts +16 -0
- package/esm/tool-template/index.d.ts.map +1 -0
- package/esm/tool-template/index.js +3518 -0
- package/esm/types/index.d.ts +14 -0
- package/esm/types/index.d.ts.map +1 -0
- package/esm/types/index.js +75 -0
- package/esm/types/ui-config.d.ts +641 -0
- package/esm/types/ui-config.d.ts.map +1 -0
- package/esm/types/ui-runtime.d.ts +1008 -0
- package/esm/types/ui-runtime.d.ts.map +1 -0
- package/esm/typings/cache/cache-adapter.d.ts +125 -0
- package/esm/typings/cache/cache-adapter.d.ts.map +1 -0
- package/esm/typings/cache/index.d.ts +10 -0
- package/esm/typings/cache/index.d.ts.map +1 -0
- package/esm/typings/cache/memory-cache.d.ts +92 -0
- package/esm/typings/cache/memory-cache.d.ts.map +1 -0
- package/esm/typings/dts-parser.d.ts +90 -0
- package/esm/typings/dts-parser.d.ts.map +1 -0
- package/esm/typings/index.d.ts +48 -0
- package/esm/typings/index.d.ts.map +1 -0
- package/esm/typings/index.js +812 -0
- package/esm/typings/schemas.d.ts +232 -0
- package/esm/typings/schemas.d.ts.map +1 -0
- package/esm/typings/type-fetcher.d.ts +89 -0
- package/esm/typings/type-fetcher.d.ts.map +1 -0
- package/esm/typings/types.d.ts +320 -0
- package/esm/typings/types.d.ts.map +1 -0
- package/esm/utils/escape-html.d.ts +58 -0
- package/esm/utils/escape-html.d.ts.map +1 -0
- package/esm/utils/index.d.ts +10 -0
- package/esm/utils/index.d.ts.map +1 -0
- package/esm/utils/index.js +40 -0
- package/esm/utils/safe-stringify.d.ts +30 -0
- package/esm/utils/safe-stringify.d.ts.map +1 -0
- package/esm/validation/error-box.d.ts +56 -0
- package/esm/validation/error-box.d.ts.map +1 -0
- package/esm/validation/index.d.ts +13 -0
- package/esm/validation/index.d.ts.map +1 -0
- package/esm/validation/index.js +542 -0
- package/esm/validation/schema-paths.d.ts +118 -0
- package/esm/validation/schema-paths.d.ts.map +1 -0
- package/esm/validation/template-validator.d.ts +143 -0
- package/esm/validation/template-validator.d.ts.map +1 -0
- package/esm/validation/wrapper.d.ts +97 -0
- package/esm/validation/wrapper.d.ts.map +1 -0
- package/handlebars/expression-extractor.d.ts +147 -0
- package/handlebars/expression-extractor.d.ts.map +1 -0
- package/handlebars/helpers.d.ts +339 -0
- package/handlebars/helpers.d.ts.map +1 -0
- package/handlebars/index.d.ts +195 -0
- package/handlebars/index.d.ts.map +1 -0
- package/handlebars/index.js +666 -0
- package/index.d.ts +50 -0
- package/index.d.ts.map +1 -0
- package/index.js +12683 -0
- package/package.json +66 -0
- package/registry/index.d.ts +46 -0
- package/registry/index.d.ts.map +1 -0
- package/registry/index.js +6280 -0
- package/registry/render-template.d.ts +91 -0
- package/registry/render-template.d.ts.map +1 -0
- package/registry/tool-ui.registry.d.ts +294 -0
- package/registry/tool-ui.registry.d.ts.map +1 -0
- package/registry/uri-utils.d.ts +56 -0
- package/registry/uri-utils.d.ts.map +1 -0
- package/renderers/cache.d.ts +145 -0
- package/renderers/cache.d.ts.map +1 -0
- package/renderers/html.renderer.d.ts +123 -0
- package/renderers/html.renderer.d.ts.map +1 -0
- package/renderers/index.d.ts +36 -0
- package/renderers/index.d.ts.map +1 -0
- package/renderers/index.js +1706 -0
- package/renderers/mdx.renderer.d.ts +120 -0
- package/renderers/mdx.renderer.d.ts.map +1 -0
- package/renderers/registry.d.ts +133 -0
- package/renderers/registry.d.ts.map +1 -0
- package/renderers/types.d.ts +342 -0
- package/renderers/types.d.ts.map +1 -0
- package/renderers/utils/detect.d.ts +107 -0
- package/renderers/utils/detect.d.ts.map +1 -0
- package/renderers/utils/hash.d.ts +40 -0
- package/renderers/utils/hash.d.ts.map +1 -0
- package/renderers/utils/index.d.ts +9 -0
- package/renderers/utils/index.d.ts.map +1 -0
- package/renderers/utils/transpiler.d.ts +89 -0
- package/renderers/utils/transpiler.d.ts.map +1 -0
- package/runtime/adapters/html.adapter.d.ts +59 -0
- package/runtime/adapters/html.adapter.d.ts.map +1 -0
- package/runtime/adapters/index.d.ts +26 -0
- package/runtime/adapters/index.d.ts.map +1 -0
- package/runtime/adapters/mdx.adapter.d.ts +73 -0
- package/runtime/adapters/mdx.adapter.d.ts.map +1 -0
- package/runtime/adapters/types.d.ts +95 -0
- package/runtime/adapters/types.d.ts.map +1 -0
- package/runtime/csp.d.ts +48 -0
- package/runtime/csp.d.ts.map +1 -0
- package/runtime/index.d.ts +17 -0
- package/runtime/index.d.ts.map +1 -0
- package/runtime/index.js +5052 -0
- package/runtime/mcp-bridge.d.ts +101 -0
- package/runtime/mcp-bridge.d.ts.map +1 -0
- package/runtime/renderer-runtime.d.ts +133 -0
- package/runtime/renderer-runtime.d.ts.map +1 -0
- package/runtime/sanitizer.d.ts +172 -0
- package/runtime/sanitizer.d.ts.map +1 -0
- package/runtime/types.d.ts +415 -0
- package/runtime/types.d.ts.map +1 -0
- package/runtime/wrapper.d.ts +421 -0
- package/runtime/wrapper.d.ts.map +1 -0
- package/styles/index.d.ts +8 -0
- package/styles/index.d.ts.map +1 -0
- package/styles/index.js +222 -0
- package/styles/variants.d.ts +51 -0
- package/styles/variants.d.ts.map +1 -0
- package/theme/cdn.d.ts +195 -0
- package/theme/cdn.d.ts.map +1 -0
- package/theme/index.d.ts +18 -0
- package/theme/index.d.ts.map +1 -0
- package/theme/index.js +757 -0
- package/theme/platforms.d.ts +107 -0
- package/theme/platforms.d.ts.map +1 -0
- package/theme/presets/github-openai.d.ts +50 -0
- package/theme/presets/github-openai.d.ts.map +1 -0
- package/theme/presets/index.d.ts +11 -0
- package/theme/presets/index.d.ts.map +1 -0
- package/theme/theme.d.ts +396 -0
- package/theme/theme.d.ts.map +1 -0
- package/tool-template/builder.d.ts +213 -0
- package/tool-template/builder.d.ts.map +1 -0
- package/tool-template/index.d.ts +16 -0
- package/tool-template/index.d.ts.map +1 -0
- package/tool-template/index.js +3562 -0
- package/types/index.d.ts +14 -0
- package/types/index.d.ts.map +1 -0
- package/types/index.js +108 -0
- package/types/ui-config.d.ts +641 -0
- package/types/ui-config.d.ts.map +1 -0
- package/types/ui-runtime.d.ts +1008 -0
- package/types/ui-runtime.d.ts.map +1 -0
- package/typings/cache/cache-adapter.d.ts +125 -0
- package/typings/cache/cache-adapter.d.ts.map +1 -0
- package/typings/cache/index.d.ts +10 -0
- package/typings/cache/index.d.ts.map +1 -0
- package/typings/cache/memory-cache.d.ts +92 -0
- package/typings/cache/memory-cache.d.ts.map +1 -0
- package/typings/dts-parser.d.ts +90 -0
- package/typings/dts-parser.d.ts.map +1 -0
- package/typings/index.d.ts +48 -0
- package/typings/index.d.ts.map +1 -0
- package/typings/index.js +868 -0
- package/typings/schemas.d.ts +232 -0
- package/typings/schemas.d.ts.map +1 -0
- package/typings/type-fetcher.d.ts +89 -0
- package/typings/type-fetcher.d.ts.map +1 -0
- package/typings/types.d.ts +320 -0
- package/typings/types.d.ts.map +1 -0
- package/utils/escape-html.d.ts +58 -0
- package/utils/escape-html.d.ts.map +1 -0
- package/utils/index.d.ts +10 -0
- package/utils/index.d.ts.map +1 -0
- package/utils/index.js +70 -0
- package/utils/safe-stringify.d.ts +30 -0
- package/utils/safe-stringify.d.ts.map +1 -0
- package/validation/error-box.d.ts +56 -0
- package/validation/error-box.d.ts.map +1 -0
- package/validation/index.d.ts +13 -0
- package/validation/index.d.ts.map +1 -0
- package/validation/index.js +583 -0
- package/validation/schema-paths.d.ts +118 -0
- package/validation/schema-paths.d.ts.map +1 -0
- package/validation/template-validator.d.ts +143 -0
- package/validation/template-validator.d.ts.map +1 -0
- package/validation/wrapper.d.ts +97 -0
- package/validation/wrapper.d.ts.map +1 -0
|
@@ -0,0 +1,1008 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Widget Runtime Types
|
|
3
|
+
*
|
|
4
|
+
* Core types for the Tool UI widget system. These types define:
|
|
5
|
+
* - UI rendering modes (html, react, mdx, markdown, auto)
|
|
6
|
+
* - Bundling strategies (static vs dynamic)
|
|
7
|
+
* - Widget manifests for caching and discovery
|
|
8
|
+
* - Runtime payloads for tool responses
|
|
9
|
+
* - CSP directives for security
|
|
10
|
+
*
|
|
11
|
+
* This module is the canonical source for widget types.
|
|
12
|
+
* Both `@frontmcp/sdk` and external consumers (like AgentLink)
|
|
13
|
+
* should import types from here.
|
|
14
|
+
*
|
|
15
|
+
* @packageDocumentation
|
|
16
|
+
*/
|
|
17
|
+
import type { WidgetServingMode as _WidgetServingMode } from './ui-config';
|
|
18
|
+
import type { ZodTypeAny } from 'zod';
|
|
19
|
+
export type { TemplateHelpers, TemplateContext, TemplateBuilderFn, UIContentSecurityPolicy, WidgetDisplayMode, WidgetServingMode, } from './ui-config';
|
|
20
|
+
type WidgetServingMode = _WidgetServingMode;
|
|
21
|
+
/**
|
|
22
|
+
* UI renderer type for widget templates.
|
|
23
|
+
*
|
|
24
|
+
* - `'html'`: Plain HTML template (with optional Handlebars enhancement)
|
|
25
|
+
* - `'react'`: React component (SSR + optional hydration)
|
|
26
|
+
* - `'mdx'`: MDX template (Markdown + JSX components)
|
|
27
|
+
* - `'markdown'`: Pure Markdown (rendered via markdown engine)
|
|
28
|
+
* - `'auto'`: Auto-detect from template; loads all renderers at runtime
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* // Explicit HTML mode
|
|
33
|
+
* ui: {
|
|
34
|
+
* template: '<div>{{output.value}}</div>',
|
|
35
|
+
* uiType: 'html'
|
|
36
|
+
* }
|
|
37
|
+
*
|
|
38
|
+
* // Auto-detect (loads all renderers)
|
|
39
|
+
* ui: {
|
|
40
|
+
* template: MyReactComponent,
|
|
41
|
+
* uiType: 'auto'
|
|
42
|
+
* }
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export type UIType = 'html' | 'react' | 'mdx' | 'markdown' | 'auto';
|
|
46
|
+
/**
|
|
47
|
+
* Widget bundling strategy.
|
|
48
|
+
*
|
|
49
|
+
* - `'static'`: Widget shell is pre-compiled at startup and cached.
|
|
50
|
+
* Tool responses reference the cached widget via `ui://widget/{toolName}`.
|
|
51
|
+
* Data is injected at runtime via FrontMCP Bridge. **Default mode.**
|
|
52
|
+
*
|
|
53
|
+
* - `'dynamic'`: Fresh HTML is generated for each tool invocation.
|
|
54
|
+
* Use for debugging or when template logic depends on invocation context.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```typescript
|
|
58
|
+
* // Static mode (default, recommended)
|
|
59
|
+
* ui: {
|
|
60
|
+
* template: WeatherWidget,
|
|
61
|
+
* bundlingMode: 'static'
|
|
62
|
+
* }
|
|
63
|
+
*
|
|
64
|
+
* // Dynamic mode (debugging, fresh per call)
|
|
65
|
+
* ui: {
|
|
66
|
+
* template: (ctx) => `<div>${ctx.output.debug}</div>`,
|
|
67
|
+
* bundlingMode: 'dynamic'
|
|
68
|
+
* }
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
export type BundlingMode = 'static' | 'dynamic';
|
|
72
|
+
/**
|
|
73
|
+
* Resource loading mode for widget dependencies.
|
|
74
|
+
*
|
|
75
|
+
* - `'cdn'`: Load React/MDX/Handlebars from CDN URLs (light, fast).
|
|
76
|
+
* Requires network access. Best for most platforms.
|
|
77
|
+
*
|
|
78
|
+
* - `'inline'`: Embed all scripts directly in the HTML (self-contained).
|
|
79
|
+
* Works in network-blocked environments (e.g., Claude Artifacts).
|
|
80
|
+
* Results in larger HTML payloads.
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* ```typescript
|
|
84
|
+
* // CDN mode (default, lightweight)
|
|
85
|
+
* ui: {
|
|
86
|
+
* template: WeatherWidget,
|
|
87
|
+
* resourceMode: 'cdn'
|
|
88
|
+
* }
|
|
89
|
+
*
|
|
90
|
+
* // Inline mode (network-blocked environments)
|
|
91
|
+
* ui: {
|
|
92
|
+
* template: WeatherWidget,
|
|
93
|
+
* resourceMode: 'inline'
|
|
94
|
+
* }
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
export type ResourceMode = 'cdn' | 'inline';
|
|
98
|
+
/**
|
|
99
|
+
* Widget output mode - determines what is returned in tool responses.
|
|
100
|
+
*
|
|
101
|
+
* - `'code-only'`: Return just the transpiled/rendered content.
|
|
102
|
+
* The host platform (OpenAI, etc.) provides the runtime wrapper.
|
|
103
|
+
* Best for capable platforms that handle their own rendering.
|
|
104
|
+
*
|
|
105
|
+
* - `'full-ssr'`: Return complete SSR'd HTML with embedded data.
|
|
106
|
+
* Self-contained output for limited/unknown MCP clients.
|
|
107
|
+
* Includes FrontMCP Bridge, scripts, and all necessary runtime.
|
|
108
|
+
*
|
|
109
|
+
* - `'dual-payload'`: Return TWO TextContent blocks for Claude Artifacts.
|
|
110
|
+
* Block 0: Pure JSON stringified data (for programmatic parsing).
|
|
111
|
+
* Block 1: Markdown-wrapped HTML (```html...```) for visual rendering.
|
|
112
|
+
* Uses cloudflare CDN for all resources (Claude sandbox restriction).
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* ```typescript
|
|
116
|
+
* // For OpenAI - just return the rendered content
|
|
117
|
+
* const result = await buildWidgetOutput({
|
|
118
|
+
* uiConfig,
|
|
119
|
+
* toolName: 'weather',
|
|
120
|
+
* outputMode: 'code-only',
|
|
121
|
+
* output: { temperature: 72 },
|
|
122
|
+
* });
|
|
123
|
+
* // result.content = '<div class="weather">72°F</div>'
|
|
124
|
+
*
|
|
125
|
+
* // For unknown clients - return full HTML
|
|
126
|
+
* const result = await buildWidgetOutput({
|
|
127
|
+
* uiConfig,
|
|
128
|
+
* toolName: 'weather',
|
|
129
|
+
* outputMode: 'full-ssr',
|
|
130
|
+
* output: { temperature: 72 },
|
|
131
|
+
* });
|
|
132
|
+
* // result.html = '<!DOCTYPE html>...'
|
|
133
|
+
*
|
|
134
|
+
* // For Claude - return dual-payload
|
|
135
|
+
* const result = await buildWidgetOutput({
|
|
136
|
+
* uiConfig,
|
|
137
|
+
* toolName: 'weather',
|
|
138
|
+
* outputMode: 'dual-payload',
|
|
139
|
+
* output: { temperature: 72 },
|
|
140
|
+
* });
|
|
141
|
+
* // result.content = [
|
|
142
|
+
* // { type: 'text', text: '{"temperature":72}' },
|
|
143
|
+
* // { type: 'text', text: 'Here is the weather:\n\n```html\n<!DOCTYPE html>...\n```' }
|
|
144
|
+
* // ]
|
|
145
|
+
* ```
|
|
146
|
+
*/
|
|
147
|
+
export type OutputMode = 'code-only' | 'full-ssr' | 'dual-payload';
|
|
148
|
+
/**
|
|
149
|
+
* Display mode for widget presentation.
|
|
150
|
+
*
|
|
151
|
+
* Note: This is an alias for `WidgetDisplayMode` from ui-config.ts.
|
|
152
|
+
* Prefer using `WidgetDisplayMode` for new code.
|
|
153
|
+
*/
|
|
154
|
+
export type DisplayMode = 'inline' | 'fullscreen' | 'pip';
|
|
155
|
+
/**
|
|
156
|
+
* Content Security Policy directives for widget sandboxes.
|
|
157
|
+
*
|
|
158
|
+
* More granular than `UIContentSecurityPolicy`, this type
|
|
159
|
+
* maps directly to CSP header directives.
|
|
160
|
+
*
|
|
161
|
+
* @example
|
|
162
|
+
* ```typescript
|
|
163
|
+
* const csp: CSPDirectives = {
|
|
164
|
+
* scriptSrc: ["'self'", "'unsafe-inline'", "https://unpkg.com"],
|
|
165
|
+
* styleSrc: ["'self'", "'unsafe-inline'"],
|
|
166
|
+
* connectSrc: ["https://api.example.com"],
|
|
167
|
+
* };
|
|
168
|
+
* ```
|
|
169
|
+
*/
|
|
170
|
+
export interface CSPDirectives {
|
|
171
|
+
/**
|
|
172
|
+
* Script source directives (CSP script-src).
|
|
173
|
+
* @example ["'self'", "'unsafe-inline'", "https://unpkg.com"]
|
|
174
|
+
*/
|
|
175
|
+
scriptSrc: string[];
|
|
176
|
+
/**
|
|
177
|
+
* Style source directives (CSP style-src).
|
|
178
|
+
* @example ["'self'", "'unsafe-inline'"]
|
|
179
|
+
*/
|
|
180
|
+
styleSrc: string[];
|
|
181
|
+
/**
|
|
182
|
+
* Connection source directives (CSP connect-src).
|
|
183
|
+
* Controls fetch/XHR/WebSocket destinations.
|
|
184
|
+
* @example ["https://api.example.com"]
|
|
185
|
+
*/
|
|
186
|
+
connectSrc: string[];
|
|
187
|
+
/**
|
|
188
|
+
* Image source directives (CSP img-src).
|
|
189
|
+
* @example ["'self'", "data:", "https://images.example.com"]
|
|
190
|
+
*/
|
|
191
|
+
imgSrc?: string[];
|
|
192
|
+
/**
|
|
193
|
+
* Font source directives (CSP font-src).
|
|
194
|
+
* @example ["'self'", "https://fonts.gstatic.com"]
|
|
195
|
+
*/
|
|
196
|
+
fontSrc?: string[];
|
|
197
|
+
/**
|
|
198
|
+
* Default source directive (CSP default-src).
|
|
199
|
+
* @example ["'self'"]
|
|
200
|
+
*/
|
|
201
|
+
defaultSrc?: string[];
|
|
202
|
+
/**
|
|
203
|
+
* Frame source directives (CSP frame-src).
|
|
204
|
+
* @example ["'none'"]
|
|
205
|
+
*/
|
|
206
|
+
frameSrc?: string[];
|
|
207
|
+
/**
|
|
208
|
+
* Object source directives (CSP object-src).
|
|
209
|
+
* @example ["'none'"]
|
|
210
|
+
*/
|
|
211
|
+
objectSrc?: string[];
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* CDN configuration for a single script resource.
|
|
215
|
+
*/
|
|
216
|
+
export interface CDNResource {
|
|
217
|
+
/**
|
|
218
|
+
* CDN URL for the script.
|
|
219
|
+
*/
|
|
220
|
+
url: string;
|
|
221
|
+
/**
|
|
222
|
+
* Subresource integrity hash (SRI).
|
|
223
|
+
* @example "sha384-..."
|
|
224
|
+
*/
|
|
225
|
+
integrity?: string;
|
|
226
|
+
/**
|
|
227
|
+
* Crossorigin attribute.
|
|
228
|
+
* @default "anonymous"
|
|
229
|
+
*/
|
|
230
|
+
crossorigin?: 'anonymous' | 'use-credentials';
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* External assets required by a renderer type.
|
|
234
|
+
*
|
|
235
|
+
* Supports two modes:
|
|
236
|
+
* - CDN mode: Light payloads, scripts loaded from CDN URLs
|
|
237
|
+
* - Inline mode: Self-contained, scripts embedded in HTML
|
|
238
|
+
*
|
|
239
|
+
* @example
|
|
240
|
+
* ```typescript
|
|
241
|
+
* // CDN mode (lightweight)
|
|
242
|
+
* const assets: RendererAssets = {
|
|
243
|
+
* mode: 'cdn',
|
|
244
|
+
* react: { url: 'https://unpkg.com/react@18/umd/react.production.min.js' },
|
|
245
|
+
* reactDom: { url: 'https://unpkg.com/react-dom@18/umd/react-dom.production.min.js' },
|
|
246
|
+
* };
|
|
247
|
+
*
|
|
248
|
+
* // Inline mode (self-contained)
|
|
249
|
+
* const assets: RendererAssets = {
|
|
250
|
+
* mode: 'inline',
|
|
251
|
+
* inlineReact: '/* minified react code *\/',
|
|
252
|
+
* inlineReactDom: '/* minified react-dom code *\/',
|
|
253
|
+
* };
|
|
254
|
+
* ```
|
|
255
|
+
*/
|
|
256
|
+
export interface RendererAssets {
|
|
257
|
+
/**
|
|
258
|
+
* Resource loading mode.
|
|
259
|
+
* - 'cdn': Load scripts from CDN URLs (light, requires network)
|
|
260
|
+
* - 'inline': Embed scripts in HTML (heavy, works offline)
|
|
261
|
+
* @default 'cdn'
|
|
262
|
+
*/
|
|
263
|
+
mode: ResourceMode;
|
|
264
|
+
/**
|
|
265
|
+
* React UMD runtime CDN (for 'react' UI type).
|
|
266
|
+
*/
|
|
267
|
+
react?: CDNResource;
|
|
268
|
+
/**
|
|
269
|
+
* ReactDOM UMD runtime CDN (for 'react' UI type with hydration).
|
|
270
|
+
*/
|
|
271
|
+
reactDom?: CDNResource;
|
|
272
|
+
/**
|
|
273
|
+
* Markdown rendering engine CDN (for 'markdown' or 'mdx' types).
|
|
274
|
+
*/
|
|
275
|
+
markdown?: CDNResource;
|
|
276
|
+
/**
|
|
277
|
+
* MDX runtime CDN (for 'mdx' type).
|
|
278
|
+
*/
|
|
279
|
+
mdxRuntime?: CDNResource;
|
|
280
|
+
/**
|
|
281
|
+
* Handlebars runtime CDN (for enhanced HTML templates).
|
|
282
|
+
*/
|
|
283
|
+
handlebars?: CDNResource;
|
|
284
|
+
/**
|
|
285
|
+
* Tailwind CSS CDN.
|
|
286
|
+
*/
|
|
287
|
+
tailwind?: CDNResource;
|
|
288
|
+
/**
|
|
289
|
+
* Inline React runtime (for inline mode).
|
|
290
|
+
* Contains minified React UMD bundle.
|
|
291
|
+
*/
|
|
292
|
+
inlineReact?: string;
|
|
293
|
+
/**
|
|
294
|
+
* Inline ReactDOM runtime (for inline mode).
|
|
295
|
+
* Contains minified ReactDOM UMD bundle.
|
|
296
|
+
*/
|
|
297
|
+
inlineReactDom?: string;
|
|
298
|
+
/**
|
|
299
|
+
* Inline Handlebars runtime (for inline mode).
|
|
300
|
+
*/
|
|
301
|
+
inlineHandlebars?: string;
|
|
302
|
+
/**
|
|
303
|
+
* Inline Markdown engine (for inline mode).
|
|
304
|
+
*/
|
|
305
|
+
inlineMarkdown?: string;
|
|
306
|
+
/**
|
|
307
|
+
* Inline bundle content (compiled widget template).
|
|
308
|
+
* Contains the pre-bundled renderer + template code.
|
|
309
|
+
*/
|
|
310
|
+
inlineBundle?: string;
|
|
311
|
+
/**
|
|
312
|
+
* Content hash of the bundled widget code.
|
|
313
|
+
* Used for cache invalidation.
|
|
314
|
+
*/
|
|
315
|
+
bundleHash?: string;
|
|
316
|
+
/**
|
|
317
|
+
* @deprecated Use `react.url` instead
|
|
318
|
+
*/
|
|
319
|
+
reactRuntime?: string;
|
|
320
|
+
/**
|
|
321
|
+
* @deprecated Use `reactDom.url` instead
|
|
322
|
+
*/
|
|
323
|
+
reactDomRuntime?: string;
|
|
324
|
+
/**
|
|
325
|
+
* @deprecated Use `markdown.url` instead
|
|
326
|
+
*/
|
|
327
|
+
markdownEngine?: string;
|
|
328
|
+
/**
|
|
329
|
+
* @deprecated Use `handlebars.url` instead
|
|
330
|
+
*/
|
|
331
|
+
handlebarsRuntime?: string;
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* Widget manifest describing a pre-compiled static widget.
|
|
335
|
+
*
|
|
336
|
+
* The manifest is embedded in the widget HTML and also cached
|
|
337
|
+
* separately for quick lookups. It contains all metadata needed
|
|
338
|
+
* for the runtime to render the widget correctly.
|
|
339
|
+
*
|
|
340
|
+
* @example
|
|
341
|
+
* ```json
|
|
342
|
+
* {
|
|
343
|
+
* "tool": "weather.get",
|
|
344
|
+
* "uiType": "react",
|
|
345
|
+
* "bundlingMode": "static",
|
|
346
|
+
* "displayMode": "inline",
|
|
347
|
+
* "widgetAccessible": true,
|
|
348
|
+
* "schema": { "type": "object", "properties": {...} },
|
|
349
|
+
* "csp": { "scriptSrc": ["'self'"], ... },
|
|
350
|
+
* "rendererAssets": { "reactRuntime": "https://..." },
|
|
351
|
+
* "hash": "sha256-abc123..."
|
|
352
|
+
* }
|
|
353
|
+
* ```
|
|
354
|
+
*/
|
|
355
|
+
export interface WidgetManifest {
|
|
356
|
+
/**
|
|
357
|
+
* Tool name (unique identifier).
|
|
358
|
+
* @example "weather.get"
|
|
359
|
+
*/
|
|
360
|
+
tool: string;
|
|
361
|
+
/**
|
|
362
|
+
* UI renderer type.
|
|
363
|
+
*/
|
|
364
|
+
uiType: UIType;
|
|
365
|
+
/**
|
|
366
|
+
* Bundling mode used to create this widget.
|
|
367
|
+
*/
|
|
368
|
+
bundlingMode: BundlingMode;
|
|
369
|
+
/**
|
|
370
|
+
* Preferred display mode for the widget.
|
|
371
|
+
*/
|
|
372
|
+
displayMode: DisplayMode;
|
|
373
|
+
/**
|
|
374
|
+
* Whether the widget can invoke tools via MCP bridge.
|
|
375
|
+
* When true, widget has access to `window.mcpBridge.callTool()`.
|
|
376
|
+
*/
|
|
377
|
+
widgetAccessible: boolean;
|
|
378
|
+
/**
|
|
379
|
+
* JSON Schema describing the tool's output structure.
|
|
380
|
+
* Used for type hints and validation.
|
|
381
|
+
*/
|
|
382
|
+
schema: object;
|
|
383
|
+
/**
|
|
384
|
+
* Content Security Policy directives.
|
|
385
|
+
*/
|
|
386
|
+
csp: CSPDirectives;
|
|
387
|
+
/**
|
|
388
|
+
* External assets required by the renderer.
|
|
389
|
+
*/
|
|
390
|
+
rendererAssets: RendererAssets;
|
|
391
|
+
/**
|
|
392
|
+
* SHA-256 hash of the manifest + HTML content.
|
|
393
|
+
* Used for cache validation and ETag generation.
|
|
394
|
+
*/
|
|
395
|
+
hash: string;
|
|
396
|
+
/**
|
|
397
|
+
* Timestamp when the manifest was created (ISO 8601).
|
|
398
|
+
*/
|
|
399
|
+
createdAt?: string;
|
|
400
|
+
/**
|
|
401
|
+
* Human-readable description of the widget.
|
|
402
|
+
*/
|
|
403
|
+
description?: string;
|
|
404
|
+
/**
|
|
405
|
+
* Widget URI in the MCP resource format.
|
|
406
|
+
* @example "ui://widget/weather.get.html"
|
|
407
|
+
*/
|
|
408
|
+
uri?: string;
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* UI metadata fields emitted in tool response `_meta`.
|
|
412
|
+
*
|
|
413
|
+
* All UI-related data goes in `_meta`, NOT in the `content` array.
|
|
414
|
+
* The MCP client reads these fields to render the widget.
|
|
415
|
+
*
|
|
416
|
+
* @example
|
|
417
|
+
* ```typescript
|
|
418
|
+
* // Tool response structure
|
|
419
|
+
* {
|
|
420
|
+
* content: [{ type: 'text', text: 'Weather data retrieved' }],
|
|
421
|
+
* _meta: {
|
|
422
|
+
* // UI type for renderer selection
|
|
423
|
+
* 'ui/type': 'react',
|
|
424
|
+
*
|
|
425
|
+
* // Transpiled widget code (for capable clients like OpenAI)
|
|
426
|
+
* 'ui/content': '<div class="weather">72°F Sunny</div>',
|
|
427
|
+
*
|
|
428
|
+
* // OR full HTML (for limited clients)
|
|
429
|
+
* 'ui/html': '<!DOCTYPE html>...',
|
|
430
|
+
*
|
|
431
|
+
* // Content hash for caching
|
|
432
|
+
* 'ui/hash': 'sha256-abc123...',
|
|
433
|
+
*
|
|
434
|
+
* // Display mode hint
|
|
435
|
+
* 'ui/displayMode': 'inline',
|
|
436
|
+
*
|
|
437
|
+
* // Widget can call tools
|
|
438
|
+
* 'ui/widgetAccessible': true,
|
|
439
|
+
*
|
|
440
|
+
* // OpenAI-specific CSP
|
|
441
|
+
* 'openai/widgetCSP': { connect_domains: ['api.weather.com'] },
|
|
442
|
+
* }
|
|
443
|
+
* }
|
|
444
|
+
* ```
|
|
445
|
+
*/
|
|
446
|
+
export interface UIMetaFields {
|
|
447
|
+
/**
|
|
448
|
+
* UI renderer type.
|
|
449
|
+
* Maps to `_meta['ui/type']`.
|
|
450
|
+
*/
|
|
451
|
+
'ui/type': UIType;
|
|
452
|
+
/**
|
|
453
|
+
* Transpiled widget content (code-only mode).
|
|
454
|
+
* Just the rendered template without wrapper HTML.
|
|
455
|
+
* Use for capable clients (OpenAI) that provide their own runtime.
|
|
456
|
+
* Maps to `_meta['ui/content']`.
|
|
457
|
+
*/
|
|
458
|
+
'ui/content'?: string;
|
|
459
|
+
/**
|
|
460
|
+
* Full HTML document (full-ssr mode).
|
|
461
|
+
* Complete self-contained HTML with scripts, bridge, etc.
|
|
462
|
+
* Use for limited/unknown MCP clients.
|
|
463
|
+
* Maps to `_meta['ui/html']`.
|
|
464
|
+
*/
|
|
465
|
+
'ui/html'?: string;
|
|
466
|
+
/**
|
|
467
|
+
* Content hash for cache validation.
|
|
468
|
+
* Maps to `_meta['ui/hash']`.
|
|
469
|
+
*/
|
|
470
|
+
'ui/hash': string;
|
|
471
|
+
/**
|
|
472
|
+
* Display mode hint.
|
|
473
|
+
* Maps to `_meta['ui/displayMode']`.
|
|
474
|
+
*/
|
|
475
|
+
'ui/displayMode'?: DisplayMode;
|
|
476
|
+
/**
|
|
477
|
+
* Whether widget can invoke tools via MCP bridge.
|
|
478
|
+
* Maps to `_meta['ui/widgetAccessible']`.
|
|
479
|
+
*/
|
|
480
|
+
'ui/widgetAccessible'?: boolean;
|
|
481
|
+
/**
|
|
482
|
+
* Widget description for accessibility.
|
|
483
|
+
* Maps to `_meta['ui/description']`.
|
|
484
|
+
*/
|
|
485
|
+
'ui/description'?: string;
|
|
486
|
+
/**
|
|
487
|
+
* Resource mode used (cdn or inline).
|
|
488
|
+
* Maps to `_meta['ui/resourceMode']`.
|
|
489
|
+
*/
|
|
490
|
+
'ui/resourceMode'?: ResourceMode;
|
|
491
|
+
}
|
|
492
|
+
/**
|
|
493
|
+
* OpenAI-specific meta fields.
|
|
494
|
+
* These are in addition to the standard UI fields.
|
|
495
|
+
*/
|
|
496
|
+
export interface OpenAIMetaFields {
|
|
497
|
+
/**
|
|
498
|
+
* OpenAI CSP configuration.
|
|
499
|
+
* Maps to `_meta['openai/widgetCSP']`.
|
|
500
|
+
*/
|
|
501
|
+
'openai/widgetCSP'?: {
|
|
502
|
+
connect_domains?: string[];
|
|
503
|
+
resource_domains?: string[];
|
|
504
|
+
};
|
|
505
|
+
/**
|
|
506
|
+
* OpenAI widget accessible flag.
|
|
507
|
+
* Maps to `_meta['openai/widgetAccessible']`.
|
|
508
|
+
*/
|
|
509
|
+
'openai/widgetAccessible'?: boolean;
|
|
510
|
+
/**
|
|
511
|
+
* OpenAI widget description.
|
|
512
|
+
* Maps to `_meta['openai/widgetDescription']`.
|
|
513
|
+
*/
|
|
514
|
+
'openai/widgetDescription'?: string;
|
|
515
|
+
/**
|
|
516
|
+
* OpenAI display mode.
|
|
517
|
+
* Maps to `_meta['openai/displayMode']`.
|
|
518
|
+
*/
|
|
519
|
+
'openai/displayMode'?: 'inline' | 'fullscreen' | 'pip';
|
|
520
|
+
}
|
|
521
|
+
/**
|
|
522
|
+
* Combined meta fields for tool responses.
|
|
523
|
+
* Includes both standard UI fields and platform-specific fields.
|
|
524
|
+
*/
|
|
525
|
+
export type ToolResponseMeta = Partial<UIMetaFields> & Partial<OpenAIMetaFields> & Record<string, unknown>;
|
|
526
|
+
/**
|
|
527
|
+
* @deprecated Use UIMetaFields instead. RuntimePayload is being replaced
|
|
528
|
+
* with explicit _meta field types.
|
|
529
|
+
*/
|
|
530
|
+
export interface RuntimePayload {
|
|
531
|
+
/**
|
|
532
|
+
* Resolved UI type for this invocation.
|
|
533
|
+
* @deprecated Use UIMetaFields['ui/type']
|
|
534
|
+
*/
|
|
535
|
+
type: UIType;
|
|
536
|
+
/**
|
|
537
|
+
* Rendered/compiled content.
|
|
538
|
+
* @deprecated Use UIMetaFields['ui/content']
|
|
539
|
+
*/
|
|
540
|
+
content: string;
|
|
541
|
+
/**
|
|
542
|
+
* Content hash for cache validation.
|
|
543
|
+
* @deprecated Use UIMetaFields['ui/hash']
|
|
544
|
+
*/
|
|
545
|
+
hash: string;
|
|
546
|
+
/**
|
|
547
|
+
* Hydration data for React components.
|
|
548
|
+
*/
|
|
549
|
+
hydrationData?: unknown;
|
|
550
|
+
/**
|
|
551
|
+
* Structured tool output (JSON-serializable).
|
|
552
|
+
*/
|
|
553
|
+
toolOutput?: unknown;
|
|
554
|
+
/**
|
|
555
|
+
* Additional metadata for the runtime.
|
|
556
|
+
*/
|
|
557
|
+
metadata?: Record<string, unknown>;
|
|
558
|
+
}
|
|
559
|
+
/**
|
|
560
|
+
* Widget template types supported by the system.
|
|
561
|
+
*
|
|
562
|
+
* - String: HTML/MDX/Markdown content
|
|
563
|
+
* - Builder function: Receives context, returns HTML string
|
|
564
|
+
* - React component: SSR'd with props from context
|
|
565
|
+
*/
|
|
566
|
+
export type WidgetTemplate = string | ((ctx: WidgetTemplateContext) => string) | React.ComponentType<WidgetTemplateContext>;
|
|
567
|
+
/**
|
|
568
|
+
* Context passed to widget templates.
|
|
569
|
+
*
|
|
570
|
+
* This is a more specific version of `TemplateContext` with
|
|
571
|
+
* explicit typing for widget rendering.
|
|
572
|
+
*/
|
|
573
|
+
export interface WidgetTemplateContext<Input = Record<string, unknown>, Output = unknown> {
|
|
574
|
+
/**
|
|
575
|
+
* Tool input arguments.
|
|
576
|
+
*/
|
|
577
|
+
input: Input;
|
|
578
|
+
/**
|
|
579
|
+
* Tool output/result.
|
|
580
|
+
*/
|
|
581
|
+
output: Output;
|
|
582
|
+
/**
|
|
583
|
+
* Structured content parsed from output (if schema provided).
|
|
584
|
+
*/
|
|
585
|
+
structuredContent?: unknown;
|
|
586
|
+
/**
|
|
587
|
+
* Template helper functions.
|
|
588
|
+
*/
|
|
589
|
+
helpers: WidgetTemplateHelpers;
|
|
590
|
+
}
|
|
591
|
+
/**
|
|
592
|
+
* Helper functions available in widget templates.
|
|
593
|
+
*/
|
|
594
|
+
export interface WidgetTemplateHelpers {
|
|
595
|
+
/**
|
|
596
|
+
* Escape HTML special characters to prevent XSS.
|
|
597
|
+
* Handles null/undefined by returning empty string.
|
|
598
|
+
*/
|
|
599
|
+
escapeHtml(str: unknown): string;
|
|
600
|
+
/**
|
|
601
|
+
* Format a date for display.
|
|
602
|
+
* @param date - Date object or ISO string
|
|
603
|
+
* @param format - Optional format string
|
|
604
|
+
*/
|
|
605
|
+
formatDate(date: Date | string, format?: string): string;
|
|
606
|
+
/**
|
|
607
|
+
* Format a number as currency.
|
|
608
|
+
* @param amount - Numeric amount
|
|
609
|
+
* @param currency - ISO 4217 currency code (default: 'USD')
|
|
610
|
+
*/
|
|
611
|
+
formatCurrency(amount: number, currency?: string): string;
|
|
612
|
+
/**
|
|
613
|
+
* Generate a unique ID for DOM elements.
|
|
614
|
+
* @param prefix - Optional prefix
|
|
615
|
+
*/
|
|
616
|
+
uniqueId(prefix?: string): string;
|
|
617
|
+
/**
|
|
618
|
+
* Safely embed JSON data in HTML.
|
|
619
|
+
* Escapes script-breaking characters.
|
|
620
|
+
*/
|
|
621
|
+
jsonEmbed(data: unknown): string;
|
|
622
|
+
/**
|
|
623
|
+
* Conditionally join class names.
|
|
624
|
+
* @param classes - Class names (falsy values are filtered)
|
|
625
|
+
*/
|
|
626
|
+
classNames(...classes: (string | false | undefined | null)[]): string;
|
|
627
|
+
/**
|
|
628
|
+
* Format a number with locale-aware separators.
|
|
629
|
+
*/
|
|
630
|
+
formatNumber(value: number, options?: Intl.NumberFormatOptions): string;
|
|
631
|
+
}
|
|
632
|
+
/**
|
|
633
|
+
* Widget configuration for tool UI templates.
|
|
634
|
+
*
|
|
635
|
+
* This is the main configuration type used in tool decorators
|
|
636
|
+
* and standalone widget compilation.
|
|
637
|
+
*
|
|
638
|
+
* @example
|
|
639
|
+
* ```typescript
|
|
640
|
+
* const config: WidgetConfig = {
|
|
641
|
+
* template: WeatherWidget,
|
|
642
|
+
* uiType: 'react',
|
|
643
|
+
* bundlingMode: 'static',
|
|
644
|
+
* displayMode: 'inline',
|
|
645
|
+
* widgetAccessible: true,
|
|
646
|
+
* csp: { connectSrc: ['https://api.weather.com'] },
|
|
647
|
+
* };
|
|
648
|
+
* ```
|
|
649
|
+
*/
|
|
650
|
+
export interface WidgetConfig<Input = Record<string, unknown>, Output = unknown> {
|
|
651
|
+
/**
|
|
652
|
+
* Widget template.
|
|
653
|
+
*
|
|
654
|
+
* Supports:
|
|
655
|
+
* - HTML string (with optional Handlebars syntax)
|
|
656
|
+
* - MDX string
|
|
657
|
+
* - Template builder function
|
|
658
|
+
* - React component
|
|
659
|
+
*/
|
|
660
|
+
template: WidgetTemplate | ((ctx: WidgetTemplateContext<Input, Output>) => string);
|
|
661
|
+
/**
|
|
662
|
+
* UI renderer type.
|
|
663
|
+
*
|
|
664
|
+
* - `'html'`: HTML with optional Handlebars
|
|
665
|
+
* - `'react'`: React component (SSR)
|
|
666
|
+
* - `'mdx'`: MDX template
|
|
667
|
+
* - `'markdown'`: Pure Markdown
|
|
668
|
+
* - `'auto'`: Auto-detect from template (default)
|
|
669
|
+
*
|
|
670
|
+
* @default 'auto'
|
|
671
|
+
*/
|
|
672
|
+
uiType?: UIType;
|
|
673
|
+
/**
|
|
674
|
+
* Bundling mode.
|
|
675
|
+
*
|
|
676
|
+
* - `'static'`: Pre-compile widget shell, inject data at runtime (default)
|
|
677
|
+
* - `'dynamic'`: Generate fresh HTML per tool invocation
|
|
678
|
+
*
|
|
679
|
+
* @default 'static'
|
|
680
|
+
*/
|
|
681
|
+
bundlingMode?: BundlingMode;
|
|
682
|
+
/**
|
|
683
|
+
* Display mode preference.
|
|
684
|
+
*
|
|
685
|
+
* - `'inline'`: Render inline in conversation (default)
|
|
686
|
+
* - `'fullscreen'`: Request fullscreen display
|
|
687
|
+
* - `'pip'`: Picture-in-picture mode
|
|
688
|
+
*
|
|
689
|
+
* @default 'inline'
|
|
690
|
+
*/
|
|
691
|
+
displayMode?: DisplayMode;
|
|
692
|
+
/**
|
|
693
|
+
* Resource loading mode.
|
|
694
|
+
*
|
|
695
|
+
* - `'cdn'`: Load React/MDX/Handlebars from CDN URLs (lightweight)
|
|
696
|
+
* - `'inline'`: Embed all scripts in HTML (self-contained)
|
|
697
|
+
*
|
|
698
|
+
* Use 'cdn' for most platforms (OpenAI, ChatGPT, Cursor).
|
|
699
|
+
* Use 'inline' for network-blocked environments (Claude Artifacts).
|
|
700
|
+
*
|
|
701
|
+
* @default 'cdn'
|
|
702
|
+
*/
|
|
703
|
+
resourceMode?: ResourceMode;
|
|
704
|
+
/**
|
|
705
|
+
* Content Security Policy overrides.
|
|
706
|
+
*
|
|
707
|
+
* Merged with auto-generated CSP based on uiType.
|
|
708
|
+
*/
|
|
709
|
+
csp?: Partial<CSPDirectives>;
|
|
710
|
+
/**
|
|
711
|
+
* Whether widget can invoke tools via MCP bridge.
|
|
712
|
+
*
|
|
713
|
+
* When true, widget gets access to `window.mcpBridge.callTool()`.
|
|
714
|
+
*
|
|
715
|
+
* @default false
|
|
716
|
+
*/
|
|
717
|
+
widgetAccessible?: boolean;
|
|
718
|
+
/**
|
|
719
|
+
* Human-readable description shown to users.
|
|
720
|
+
* Maps to OpenAI's `openai/widgetDescription`.
|
|
721
|
+
*/
|
|
722
|
+
widgetDescription?: string;
|
|
723
|
+
/**
|
|
724
|
+
* Runtime options for specific renderers.
|
|
725
|
+
*/
|
|
726
|
+
runtimeOptions?: WidgetRuntimeOptions;
|
|
727
|
+
/**
|
|
728
|
+
* Custom MDX components available in templates.
|
|
729
|
+
*/
|
|
730
|
+
mdxComponents?: Record<string, any>;
|
|
731
|
+
/**
|
|
732
|
+
* Status messages during tool invocation (OpenAI-specific).
|
|
733
|
+
*/
|
|
734
|
+
invocationStatus?: {
|
|
735
|
+
/** Status text while tool is executing */
|
|
736
|
+
invoking?: string;
|
|
737
|
+
/** Status text after execution completes */
|
|
738
|
+
invoked?: string;
|
|
739
|
+
};
|
|
740
|
+
/**
|
|
741
|
+
* How the widget HTML should be served to the client.
|
|
742
|
+
*
|
|
743
|
+
* - `'inline'`: HTML embedded directly in tool response `_meta['ui/html']`
|
|
744
|
+
* - `'static'`: Pre-compiled at startup, via `ui://` resource URI (MCP resources/read)
|
|
745
|
+
* - `'hybrid'`: Shell pre-compiled at startup, component in response
|
|
746
|
+
* - `'direct-url'`: HTTP endpoint on MCP server
|
|
747
|
+
* - `'custom-url'`: Custom URL (CDN or external hosting)
|
|
748
|
+
*
|
|
749
|
+
* @default 'inline'
|
|
750
|
+
*/
|
|
751
|
+
servingMode?: WidgetServingMode;
|
|
752
|
+
/**
|
|
753
|
+
* Custom URL for widget serving when `servingMode: 'custom-url'`.
|
|
754
|
+
* The URL can include `{token}` placeholder which will be replaced
|
|
755
|
+
* with the widget access token.
|
|
756
|
+
*
|
|
757
|
+
* @example 'https://cdn.example.com/widgets/weather.html?token={token}'
|
|
758
|
+
*/
|
|
759
|
+
customWidgetUrl?: string;
|
|
760
|
+
/**
|
|
761
|
+
* Path for direct URL serving when `servingMode: 'direct-url'`.
|
|
762
|
+
* This path is appended to the MCP server's base URL.
|
|
763
|
+
*
|
|
764
|
+
* @example '/widgets/weather'
|
|
765
|
+
*/
|
|
766
|
+
directPath?: string;
|
|
767
|
+
/**
|
|
768
|
+
* Whether to show a border around the UI widget.
|
|
769
|
+
* MCP Apps spec: `_meta.ui.prefersBorder`
|
|
770
|
+
*
|
|
771
|
+
* @default undefined (host decides)
|
|
772
|
+
*/
|
|
773
|
+
prefersBorder?: boolean;
|
|
774
|
+
/**
|
|
775
|
+
* Dedicated sandbox domain for the widget.
|
|
776
|
+
* MCP Apps spec: `_meta.ui.domain`
|
|
777
|
+
*
|
|
778
|
+
* @example 'sandbox.example.com'
|
|
779
|
+
*/
|
|
780
|
+
sandboxDomain?: string;
|
|
781
|
+
/**
|
|
782
|
+
* Enable client-side React hydration after server-side rendering (SSR).
|
|
783
|
+
*
|
|
784
|
+
* **Default: `false`**
|
|
785
|
+
*
|
|
786
|
+
* When `false` (default):
|
|
787
|
+
* - SSR output is static HTML
|
|
788
|
+
* - No React runtime loaded on client
|
|
789
|
+
* - Interactivity via FrontMCP Bridge
|
|
790
|
+
*
|
|
791
|
+
* When `true`:
|
|
792
|
+
* - React/ReactDOM scripts included
|
|
793
|
+
* - Client attempts hydration
|
|
794
|
+
* - May cause hydration errors in MCP clients
|
|
795
|
+
*
|
|
796
|
+
* @default false
|
|
797
|
+
*/
|
|
798
|
+
hydrate?: boolean;
|
|
799
|
+
}
|
|
800
|
+
/**
|
|
801
|
+
* Runtime options for widget renderers.
|
|
802
|
+
*/
|
|
803
|
+
export interface WidgetRuntimeOptions {
|
|
804
|
+
/**
|
|
805
|
+
* Enable React hydration after SSR.
|
|
806
|
+
*
|
|
807
|
+
* **Default: false**
|
|
808
|
+
*
|
|
809
|
+
* When false (recommended):
|
|
810
|
+
* - SSR output is static HTML
|
|
811
|
+
* - No React runtime loaded on client
|
|
812
|
+
* - Interactivity via FrontMCP Bridge
|
|
813
|
+
*
|
|
814
|
+
* When true:
|
|
815
|
+
* - React/ReactDOM scripts included
|
|
816
|
+
* - Client attempts hydration
|
|
817
|
+
* - May cause hydration errors in MCP clients
|
|
818
|
+
*/
|
|
819
|
+
hydrate?: boolean;
|
|
820
|
+
/**
|
|
821
|
+
* Markdown rendering options.
|
|
822
|
+
*/
|
|
823
|
+
markdown?: {
|
|
824
|
+
/** Enable GitHub-flavored markdown */
|
|
825
|
+
gfm?: boolean;
|
|
826
|
+
/** Syntax highlighting theme */
|
|
827
|
+
highlightTheme?: string;
|
|
828
|
+
/** Custom renderer overrides */
|
|
829
|
+
rendererOverrides?: Record<string, unknown>;
|
|
830
|
+
};
|
|
831
|
+
/**
|
|
832
|
+
* Handlebars options (for HTML templates).
|
|
833
|
+
*/
|
|
834
|
+
handlebars?: {
|
|
835
|
+
/** Custom helpers to register */
|
|
836
|
+
helpers?: Record<string, (...args: unknown[]) => string>;
|
|
837
|
+
/** Custom partials */
|
|
838
|
+
partials?: Record<string, string>;
|
|
839
|
+
/** Strict mode (error on missing variables) */
|
|
840
|
+
strict?: boolean;
|
|
841
|
+
};
|
|
842
|
+
}
|
|
843
|
+
/**
|
|
844
|
+
* Result of building a widget manifest.
|
|
845
|
+
*
|
|
846
|
+
* Returned by `buildToolWidgetManifest()` and used
|
|
847
|
+
* by `ToolUIRegistry` for caching.
|
|
848
|
+
*
|
|
849
|
+
* The result contains both:
|
|
850
|
+
* - `content`: Just the rendered template (for capable clients like OpenAI)
|
|
851
|
+
* - `html`: Complete HTML document (for limited/unknown clients)
|
|
852
|
+
*
|
|
853
|
+
* Choose which to use based on the target client capabilities.
|
|
854
|
+
*/
|
|
855
|
+
export interface BuildManifestResult {
|
|
856
|
+
/**
|
|
857
|
+
* Rendered template content (transpiled code).
|
|
858
|
+
*
|
|
859
|
+
* This is just the template output WITHOUT the wrapper HTML.
|
|
860
|
+
* Use this for capable clients (OpenAI, etc.) that provide
|
|
861
|
+
* their own runtime environment.
|
|
862
|
+
*
|
|
863
|
+
* @example
|
|
864
|
+
* For a React component, this would be the SSR'd HTML:
|
|
865
|
+
* `<div class="weather-card"><h1>72°F</h1><p>Sunny</p></div>`
|
|
866
|
+
*/
|
|
867
|
+
content: string;
|
|
868
|
+
/**
|
|
869
|
+
* Complete HTML document string.
|
|
870
|
+
*
|
|
871
|
+
* Contains embedded manifest, FrontMCP Bridge, scripts, and template.
|
|
872
|
+
* Use this for limited/unknown MCP clients that need a
|
|
873
|
+
* self-contained HTML document.
|
|
874
|
+
*
|
|
875
|
+
* @example
|
|
876
|
+
* `<!DOCTYPE html><html>...<body>{{content}}</body></html>`
|
|
877
|
+
*/
|
|
878
|
+
html: string;
|
|
879
|
+
/**
|
|
880
|
+
* Widget manifest (also embedded in HTML).
|
|
881
|
+
*/
|
|
882
|
+
manifest: WidgetManifest;
|
|
883
|
+
/**
|
|
884
|
+
* Content hash for cache validation.
|
|
885
|
+
*/
|
|
886
|
+
hash: string;
|
|
887
|
+
/**
|
|
888
|
+
* Resolved renderer type.
|
|
889
|
+
*/
|
|
890
|
+
rendererType: UIType;
|
|
891
|
+
/**
|
|
892
|
+
* Transpiled component code for client-side rendering.
|
|
893
|
+
*
|
|
894
|
+
* For React/MDX templates, this contains the transpiled component
|
|
895
|
+
* that can be embedded in the widget HTML for client-side re-rendering
|
|
896
|
+
* when tool output becomes available.
|
|
897
|
+
*
|
|
898
|
+
* This is used by `wrapStaticWidgetUniversal` for static mode.
|
|
899
|
+
*/
|
|
900
|
+
componentCode?: string;
|
|
901
|
+
/**
|
|
902
|
+
* Size of content in bytes.
|
|
903
|
+
*/
|
|
904
|
+
contentSize: number;
|
|
905
|
+
/**
|
|
906
|
+
* Size of full HTML in bytes.
|
|
907
|
+
*/
|
|
908
|
+
htmlSize: number;
|
|
909
|
+
/**
|
|
910
|
+
* Estimated gzipped size of full HTML.
|
|
911
|
+
*/
|
|
912
|
+
gzipSize: number;
|
|
913
|
+
/**
|
|
914
|
+
* @deprecated Use `htmlSize` instead
|
|
915
|
+
*/
|
|
916
|
+
size: number;
|
|
917
|
+
}
|
|
918
|
+
/**
|
|
919
|
+
* Options for building a widget manifest.
|
|
920
|
+
*/
|
|
921
|
+
export interface BuildManifestOptions<Input = Record<string, unknown>, Output = unknown> {
|
|
922
|
+
/**
|
|
923
|
+
* Tool name (unique identifier).
|
|
924
|
+
*/
|
|
925
|
+
toolName: string;
|
|
926
|
+
/**
|
|
927
|
+
* Widget configuration.
|
|
928
|
+
*/
|
|
929
|
+
uiConfig: WidgetConfig<Input, Output>;
|
|
930
|
+
/**
|
|
931
|
+
* JSON Schema for tool output.
|
|
932
|
+
* Used for validation and type hints.
|
|
933
|
+
*/
|
|
934
|
+
schema?: object;
|
|
935
|
+
/**
|
|
936
|
+
* Theme configuration override.
|
|
937
|
+
*/
|
|
938
|
+
theme?: any;
|
|
939
|
+
/**
|
|
940
|
+
* Sample input for SSR (static mode).
|
|
941
|
+
* Used during pre-compilation.
|
|
942
|
+
*/
|
|
943
|
+
sampleInput?: Input;
|
|
944
|
+
/**
|
|
945
|
+
* Sample output for SSR (static mode).
|
|
946
|
+
* Used during pre-compilation.
|
|
947
|
+
*/
|
|
948
|
+
sampleOutput?: Output;
|
|
949
|
+
/**
|
|
950
|
+
* Zod schema for output validation.
|
|
951
|
+
*
|
|
952
|
+
* When provided in development mode (NODE_ENV !== 'production'),
|
|
953
|
+
* the template will be validated against this schema to catch
|
|
954
|
+
* Handlebars expressions referencing non-existent fields.
|
|
955
|
+
*
|
|
956
|
+
* @example
|
|
957
|
+
* ```typescript
|
|
958
|
+
* outputSchema: z.object({
|
|
959
|
+
* temperature: z.number(),
|
|
960
|
+
* conditions: z.string(),
|
|
961
|
+
* })
|
|
962
|
+
* ```
|
|
963
|
+
*/
|
|
964
|
+
outputSchema?: ZodTypeAny;
|
|
965
|
+
/**
|
|
966
|
+
* Zod schema for input validation.
|
|
967
|
+
*
|
|
968
|
+
* When provided in development mode (NODE_ENV !== 'production'),
|
|
969
|
+
* the template will also validate {{input.*}} expressions.
|
|
970
|
+
*/
|
|
971
|
+
inputSchema?: ZodTypeAny;
|
|
972
|
+
}
|
|
973
|
+
/**
|
|
974
|
+
* Check if a value is a valid UIType.
|
|
975
|
+
*/
|
|
976
|
+
export declare function isUIType(value: unknown): value is UIType;
|
|
977
|
+
/**
|
|
978
|
+
* Check if a value is a valid BundlingMode.
|
|
979
|
+
*/
|
|
980
|
+
export declare function isBundlingMode(value: unknown): value is BundlingMode;
|
|
981
|
+
/**
|
|
982
|
+
* Check if a value is a valid ResourceMode.
|
|
983
|
+
*/
|
|
984
|
+
export declare function isResourceMode(value: unknown): value is ResourceMode;
|
|
985
|
+
/**
|
|
986
|
+
* Check if a value is a valid DisplayMode.
|
|
987
|
+
*/
|
|
988
|
+
export declare function isDisplayMode(value: unknown): value is DisplayMode;
|
|
989
|
+
/**
|
|
990
|
+
* Check if a value is a valid OutputMode.
|
|
991
|
+
*/
|
|
992
|
+
export declare function isOutputMode(value: unknown): value is OutputMode;
|
|
993
|
+
/**
|
|
994
|
+
* Default CSP directives for different UI types.
|
|
995
|
+
*/
|
|
996
|
+
export declare const DEFAULT_CSP_BY_TYPE: Record<UIType, CSPDirectives>;
|
|
997
|
+
/**
|
|
998
|
+
* Default renderer assets for different UI types.
|
|
999
|
+
*/
|
|
1000
|
+
export declare const DEFAULT_RENDERER_ASSETS: Record<UIType, Partial<RendererAssets>>;
|
|
1001
|
+
/**
|
|
1002
|
+
* React namespace declaration for type safety.
|
|
1003
|
+
* This allows React.ComponentType to work without importing React.
|
|
1004
|
+
*/
|
|
1005
|
+
declare namespace React {
|
|
1006
|
+
type ComponentType<P = any> = (props: P) => any;
|
|
1007
|
+
}
|
|
1008
|
+
//# sourceMappingURL=ui-runtime.d.ts.map
|