@frontmcp/ui 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +438 -0
- package/package.json +147 -0
- package/src/adapters/index.d.ts +10 -0
- package/src/adapters/index.js +18 -0
- package/src/adapters/index.js.map +1 -0
- package/src/adapters/platform-meta.d.ts +165 -0
- package/src/adapters/platform-meta.js +310 -0
- package/src/adapters/platform-meta.js.map +1 -0
- package/src/base-template/bridge.d.ts +89 -0
- package/src/base-template/bridge.js +452 -0
- package/src/base-template/bridge.js.map +1 -0
- package/src/base-template/default-base-template.d.ts +91 -0
- package/src/base-template/default-base-template.js +435 -0
- package/src/base-template/default-base-template.js.map +1 -0
- package/src/base-template/index.d.ts +14 -0
- package/src/base-template/index.js +30 -0
- package/src/base-template/index.js.map +1 -0
- package/src/base-template/polyfills.d.ts +30 -0
- package/src/base-template/polyfills.js +190 -0
- package/src/base-template/polyfills.js.map +1 -0
- package/src/base-template/theme-styles.d.ts +73 -0
- package/src/base-template/theme-styles.js +95 -0
- package/src/base-template/theme-styles.js.map +1 -0
- package/src/bridge/adapters/base-adapter.d.ts +103 -0
- package/src/bridge/adapters/base-adapter.js +314 -0
- package/src/bridge/adapters/base-adapter.js.map +1 -0
- package/src/bridge/adapters/claude.adapter.d.ts +66 -0
- package/src/bridge/adapters/claude.adapter.js +145 -0
- package/src/bridge/adapters/claude.adapter.js.map +1 -0
- package/src/bridge/adapters/ext-apps.adapter.d.ts +142 -0
- package/src/bridge/adapters/ext-apps.adapter.js +416 -0
- package/src/bridge/adapters/ext-apps.adapter.js.map +1 -0
- package/src/bridge/adapters/gemini.adapter.d.ts +63 -0
- package/src/bridge/adapters/gemini.adapter.js +160 -0
- package/src/bridge/adapters/gemini.adapter.js.map +1 -0
- package/src/bridge/adapters/generic.adapter.d.ts +55 -0
- package/src/bridge/adapters/generic.adapter.js +108 -0
- package/src/bridge/adapters/generic.adapter.js.map +1 -0
- package/src/bridge/adapters/index.d.ts +25 -0
- package/src/bridge/adapters/index.js +65 -0
- package/src/bridge/adapters/index.js.map +1 -0
- package/src/bridge/adapters/openai.adapter.d.ts +64 -0
- package/src/bridge/adapters/openai.adapter.js +194 -0
- package/src/bridge/adapters/openai.adapter.js.map +1 -0
- package/src/bridge/core/adapter-registry.d.ts +121 -0
- package/src/bridge/core/adapter-registry.js +271 -0
- package/src/bridge/core/adapter-registry.js.map +1 -0
- package/src/bridge/core/bridge-factory.d.ts +198 -0
- package/src/bridge/core/bridge-factory.js +428 -0
- package/src/bridge/core/bridge-factory.js.map +1 -0
- package/src/bridge/core/index.d.ts +9 -0
- package/src/bridge/core/index.js +22 -0
- package/src/bridge/core/index.js.map +1 -0
- package/src/bridge/index.d.ts +61 -0
- package/src/bridge/index.js +94 -0
- package/src/bridge/index.js.map +1 -0
- package/src/bridge/runtime/iife-generator.d.ts +61 -0
- package/src/bridge/runtime/iife-generator.js +940 -0
- package/src/bridge/runtime/iife-generator.js.map +1 -0
- package/src/bridge/runtime/index.d.ts +8 -0
- package/src/bridge/runtime/index.js +16 -0
- package/src/bridge/runtime/index.js.map +1 -0
- package/src/bridge/types.d.ts +385 -0
- package/src/bridge/types.js +11 -0
- package/src/bridge/types.js.map +1 -0
- package/src/build/cdn-resources.d.ts +140 -0
- package/src/build/cdn-resources.js +314 -0
- package/src/build/cdn-resources.js.map +1 -0
- package/src/build/index.d.ts +294 -0
- package/src/build/index.js +325 -0
- package/src/build/index.js.map +1 -0
- package/src/build/widget-manifest.d.ts +212 -0
- package/src/build/widget-manifest.js +652 -0
- package/src/build/widget-manifest.js.map +1 -0
- package/src/bundler/bundler.d.ts +110 -0
- package/src/bundler/bundler.js +432 -0
- package/src/bundler/bundler.js.map +1 -0
- package/src/bundler/cache.d.ts +172 -0
- package/src/bundler/cache.js +250 -0
- package/src/bundler/cache.js.map +1 -0
- package/src/bundler/index.d.ts +41 -0
- package/src/bundler/index.js +73 -0
- package/src/bundler/index.js.map +1 -0
- package/src/bundler/sandbox/enclave-adapter.d.ts +120 -0
- package/src/bundler/sandbox/enclave-adapter.js +339 -0
- package/src/bundler/sandbox/enclave-adapter.js.map +1 -0
- package/src/bundler/sandbox/executor.d.ts +13 -0
- package/src/bundler/sandbox/executor.js +22 -0
- package/src/bundler/sandbox/executor.js.map +1 -0
- package/src/bundler/sandbox/policy.d.ts +61 -0
- package/src/bundler/sandbox/policy.js +238 -0
- package/src/bundler/sandbox/policy.js.map +1 -0
- package/src/bundler/types.d.ts +347 -0
- package/src/bundler/types.js +132 -0
- package/src/bundler/types.js.map +1 -0
- package/src/components/alert.d.ts +71 -0
- package/src/components/alert.js +189 -0
- package/src/components/alert.js.map +1 -0
- package/src/components/alert.schema.d.ts +114 -0
- package/src/components/alert.schema.js +105 -0
- package/src/components/alert.schema.js.map +1 -0
- package/src/components/avatar.d.ts +76 -0
- package/src/components/avatar.js +176 -0
- package/src/components/avatar.js.map +1 -0
- package/src/components/avatar.schema.d.ts +169 -0
- package/src/components/avatar.schema.js +103 -0
- package/src/components/avatar.schema.js.map +1 -0
- package/src/components/badge.d.ts +70 -0
- package/src/components/badge.js +149 -0
- package/src/components/badge.js.map +1 -0
- package/src/components/badge.schema.d.ts +109 -0
- package/src/components/badge.schema.js +96 -0
- package/src/components/badge.schema.js.map +1 -0
- package/src/components/button.d.ts +111 -0
- package/src/components/button.js +336 -0
- package/src/components/button.js.map +1 -0
- package/src/components/button.schema.d.ts +148 -0
- package/src/components/button.schema.js +121 -0
- package/src/components/button.schema.js.map +1 -0
- package/src/components/card.d.ts +60 -0
- package/src/components/card.js +117 -0
- package/src/components/card.js.map +1 -0
- package/src/components/card.schema.d.ts +113 -0
- package/src/components/card.schema.js +98 -0
- package/src/components/card.schema.js.map +1 -0
- package/src/components/form.d.ts +239 -0
- package/src/components/form.js +420 -0
- package/src/components/form.js.map +1 -0
- package/src/components/form.schema.d.ts +441 -0
- package/src/components/form.schema.js +406 -0
- package/src/components/form.schema.js.map +1 -0
- package/src/components/index.d.ts +29 -0
- package/src/components/index.js +98 -0
- package/src/components/index.js.map +1 -0
- package/src/components/list.d.ts +127 -0
- package/src/components/list.js +279 -0
- package/src/components/list.js.map +1 -0
- package/src/components/list.schema.d.ts +134 -0
- package/src/components/list.schema.js +168 -0
- package/src/components/list.schema.js.map +1 -0
- package/src/components/modal.d.ts +111 -0
- package/src/components/modal.js +260 -0
- package/src/components/modal.js.map +1 -0
- package/src/components/modal.schema.d.ts +186 -0
- package/src/components/modal.schema.js +167 -0
- package/src/components/modal.schema.js.map +1 -0
- package/src/components/table.d.ts +105 -0
- package/src/components/table.js +283 -0
- package/src/components/table.js.map +1 -0
- package/src/components/table.schema.d.ts +159 -0
- package/src/components/table.schema.js +173 -0
- package/src/components/table.schema.js.map +1 -0
- package/src/handlebars/helpers.d.ts +348 -0
- package/src/handlebars/helpers.js +605 -0
- package/src/handlebars/helpers.js.map +1 -0
- package/src/handlebars/index.d.ts +193 -0
- package/src/handlebars/index.js +350 -0
- package/src/handlebars/index.js.map +1 -0
- package/src/index.d.ts +50 -0
- package/src/index.js +192 -0
- package/src/index.js.map +1 -0
- package/src/layouts/base.d.ts +88 -0
- package/src/layouts/base.js +227 -0
- package/src/layouts/base.js.map +1 -0
- package/src/layouts/index.d.ts +7 -0
- package/src/layouts/index.js +25 -0
- package/src/layouts/index.js.map +1 -0
- package/src/layouts/presets.d.ts +133 -0
- package/src/layouts/presets.js +277 -0
- package/src/layouts/presets.js.map +1 -0
- package/src/pages/consent.d.ts +116 -0
- package/src/pages/consent.js +218 -0
- package/src/pages/consent.js.map +1 -0
- package/src/pages/error.d.ts +100 -0
- package/src/pages/error.js +263 -0
- package/src/pages/error.js.map +1 -0
- package/src/pages/index.d.ts +8 -0
- package/src/pages/index.js +27 -0
- package/src/pages/index.js.map +1 -0
- package/src/react/Alert.d.ts +101 -0
- package/src/react/Alert.js +51 -0
- package/src/react/Alert.js.map +1 -0
- package/src/react/Badge.d.ts +100 -0
- package/src/react/Badge.js +55 -0
- package/src/react/Badge.js.map +1 -0
- package/src/react/Button.d.ts +108 -0
- package/src/react/Button.js +52 -0
- package/src/react/Button.js.map +1 -0
- package/src/react/Card.d.ts +103 -0
- package/src/react/Card.js +55 -0
- package/src/react/Card.js.map +1 -0
- package/src/react/hooks/context.d.ts +178 -0
- package/src/react/hooks/context.js +287 -0
- package/src/react/hooks/context.js.map +1 -0
- package/src/react/hooks/index.d.ts +41 -0
- package/src/react/hooks/index.js +61 -0
- package/src/react/hooks/index.js.map +1 -0
- package/src/react/hooks/tools.d.ts +283 -0
- package/src/react/hooks/tools.js +465 -0
- package/src/react/hooks/tools.js.map +1 -0
- package/src/react/index.d.ts +80 -0
- package/src/react/index.js +113 -0
- package/src/react/index.js.map +1 -0
- package/src/react/types.d.ts +105 -0
- package/src/react/types.js +12 -0
- package/src/react/types.js.map +1 -0
- package/src/react/utils.d.ts +42 -0
- package/src/react/utils.js +99 -0
- package/src/react/utils.js.map +1 -0
- package/src/registry/index.d.ts +45 -0
- package/src/registry/index.js +67 -0
- package/src/registry/index.js.map +1 -0
- package/src/registry/render-template.d.ts +86 -0
- package/src/registry/render-template.js +239 -0
- package/src/registry/render-template.js.map +1 -0
- package/src/registry/tool-ui.registry.d.ts +260 -0
- package/src/registry/tool-ui.registry.js +438 -0
- package/src/registry/tool-ui.registry.js.map +1 -0
- package/src/registry/uri-utils.d.ts +55 -0
- package/src/registry/uri-utils.js +97 -0
- package/src/registry/uri-utils.js.map +1 -0
- package/src/render/index.d.ts +7 -0
- package/src/render/index.js +14 -0
- package/src/render/index.js.map +1 -0
- package/src/render/prerender.d.ts +56 -0
- package/src/render/prerender.js +98 -0
- package/src/render/prerender.js.map +1 -0
- package/src/renderers/cache.d.ts +144 -0
- package/src/renderers/cache.js +240 -0
- package/src/renderers/cache.js.map +1 -0
- package/src/renderers/html.renderer.d.ts +122 -0
- package/src/renderers/html.renderer.js +204 -0
- package/src/renderers/html.renderer.js.map +1 -0
- package/src/renderers/index.d.ts +35 -0
- package/src/renderers/index.js +70 -0
- package/src/renderers/index.js.map +1 -0
- package/src/renderers/mdx.renderer.d.ts +119 -0
- package/src/renderers/mdx.renderer.js +305 -0
- package/src/renderers/mdx.renderer.js.map +1 -0
- package/src/renderers/react.renderer.d.ts +95 -0
- package/src/renderers/react.renderer.js +260 -0
- package/src/renderers/react.renderer.js.map +1 -0
- package/src/renderers/registry.d.ts +133 -0
- package/src/renderers/registry.js +232 -0
- package/src/renderers/registry.js.map +1 -0
- package/src/renderers/types.d.ts +341 -0
- package/src/renderers/types.js +9 -0
- package/src/renderers/types.js.map +1 -0
- package/src/renderers/utils/detect.d.ts +106 -0
- package/src/renderers/utils/detect.js +267 -0
- package/src/renderers/utils/detect.js.map +1 -0
- package/src/renderers/utils/hash.d.ts +39 -0
- package/src/renderers/utils/hash.js +75 -0
- package/src/renderers/utils/hash.js.map +1 -0
- package/src/renderers/utils/index.d.ts +8 -0
- package/src/renderers/utils/index.js +28 -0
- package/src/renderers/utils/index.js.map +1 -0
- package/src/renderers/utils/transpiler.d.ts +88 -0
- package/src/renderers/utils/transpiler.js +215 -0
- package/src/renderers/utils/transpiler.js.map +1 -0
- package/src/runtime/adapters/html.adapter.d.ts +58 -0
- package/src/runtime/adapters/html.adapter.js +131 -0
- package/src/runtime/adapters/html.adapter.js.map +1 -0
- package/src/runtime/adapters/index.d.ts +25 -0
- package/src/runtime/adapters/index.js +54 -0
- package/src/runtime/adapters/index.js.map +1 -0
- package/src/runtime/adapters/mdx.adapter.d.ts +72 -0
- package/src/runtime/adapters/mdx.adapter.js +241 -0
- package/src/runtime/adapters/mdx.adapter.js.map +1 -0
- package/src/runtime/adapters/react.adapter.d.ts +69 -0
- package/src/runtime/adapters/react.adapter.js +245 -0
- package/src/runtime/adapters/react.adapter.js.map +1 -0
- package/src/runtime/adapters/types.d.ts +94 -0
- package/src/runtime/adapters/types.js +11 -0
- package/src/runtime/adapters/types.js.map +1 -0
- package/src/runtime/csp.d.ts +37 -0
- package/src/runtime/csp.js +140 -0
- package/src/runtime/csp.js.map +1 -0
- package/src/runtime/index.d.ts +16 -0
- package/src/runtime/index.js +72 -0
- package/src/runtime/index.js.map +1 -0
- package/src/runtime/mcp-bridge.d.ts +100 -0
- package/src/runtime/mcp-bridge.js +581 -0
- package/src/runtime/mcp-bridge.js.map +1 -0
- package/src/runtime/renderer-runtime.d.ts +132 -0
- package/src/runtime/renderer-runtime.js +389 -0
- package/src/runtime/renderer-runtime.js.map +1 -0
- package/src/runtime/sanitizer.d.ts +171 -0
- package/src/runtime/sanitizer.js +318 -0
- package/src/runtime/sanitizer.js.map +1 -0
- package/src/runtime/types.d.ts +414 -0
- package/src/runtime/types.js +12 -0
- package/src/runtime/types.js.map +1 -0
- package/src/runtime/wrapper.d.ts +375 -0
- package/src/runtime/wrapper.js +1793 -0
- package/src/runtime/wrapper.js.map +1 -0
- package/src/styles/index.d.ts +7 -0
- package/src/styles/index.js +11 -0
- package/src/styles/index.js.map +1 -0
- package/src/styles/variants.d.ts +50 -0
- package/src/styles/variants.js +175 -0
- package/src/styles/variants.js.map +1 -0
- package/src/theme/cdn.d.ts +194 -0
- package/src/theme/cdn.js +375 -0
- package/src/theme/cdn.js.map +1 -0
- package/src/theme/index.d.ts +17 -0
- package/src/theme/index.js +57 -0
- package/src/theme/index.js.map +1 -0
- package/src/theme/platforms.d.ts +106 -0
- package/src/theme/platforms.js +161 -0
- package/src/theme/platforms.js.map +1 -0
- package/src/theme/presets/github-openai.d.ts +49 -0
- package/src/theme/presets/github-openai.js +189 -0
- package/src/theme/presets/github-openai.js.map +1 -0
- package/src/theme/presets/index.d.ts +10 -0
- package/src/theme/presets/index.js +17 -0
- package/src/theme/presets/index.js.map +1 -0
- package/src/theme/theme.d.ts +395 -0
- package/src/theme/theme.js +332 -0
- package/src/theme/theme.js.map +1 -0
- package/src/tool-template/builder.d.ts +212 -0
- package/src/tool-template/builder.js +397 -0
- package/src/tool-template/builder.js.map +1 -0
- package/src/tool-template/index.d.ts +15 -0
- package/src/tool-template/index.js +38 -0
- package/src/tool-template/index.js.map +1 -0
- package/src/types/index.d.ts +13 -0
- package/src/types/index.js +26 -0
- package/src/types/index.js.map +1 -0
- package/src/types/ui-config.d.ts +357 -0
- package/src/types/ui-config.js +12 -0
- package/src/types/ui-config.js.map +1 -0
- package/src/types/ui-runtime.d.ts +965 -0
- package/src/types/ui-runtime.js +117 -0
- package/src/types/ui-runtime.js.map +1 -0
- package/src/validation/error-box.d.ts +55 -0
- package/src/validation/error-box.js +75 -0
- package/src/validation/error-box.js.map +1 -0
- package/src/validation/index.d.ts +12 -0
- package/src/validation/index.js +21 -0
- package/src/validation/index.js.map +1 -0
- package/src/validation/wrapper.d.ts +96 -0
- package/src/validation/wrapper.js +117 -0
- package/src/validation/wrapper.js.map +1 -0
- package/src/web-components/core/attribute-parser.d.ts +85 -0
- package/src/web-components/core/attribute-parser.js +189 -0
- package/src/web-components/core/attribute-parser.js.map +1 -0
- package/src/web-components/core/base-element.d.ts +197 -0
- package/src/web-components/core/base-element.js +289 -0
- package/src/web-components/core/base-element.js.map +1 -0
- package/src/web-components/core/index.d.ts +8 -0
- package/src/web-components/core/index.js +18 -0
- package/src/web-components/core/index.js.map +1 -0
- package/src/web-components/elements/fmcp-alert.d.ts +45 -0
- package/src/web-components/elements/fmcp-alert.js +93 -0
- package/src/web-components/elements/fmcp-alert.js.map +1 -0
- package/src/web-components/elements/fmcp-badge.d.ts +46 -0
- package/src/web-components/elements/fmcp-badge.js +99 -0
- package/src/web-components/elements/fmcp-badge.js.map +1 -0
- package/src/web-components/elements/fmcp-button.d.ts +124 -0
- package/src/web-components/elements/fmcp-button.js +233 -0
- package/src/web-components/elements/fmcp-button.js.map +1 -0
- package/src/web-components/elements/fmcp-card.d.ts +52 -0
- package/src/web-components/elements/fmcp-card.js +115 -0
- package/src/web-components/elements/fmcp-card.js.map +1 -0
- package/src/web-components/elements/fmcp-input.d.ts +95 -0
- package/src/web-components/elements/fmcp-input.js +248 -0
- package/src/web-components/elements/fmcp-input.js.map +1 -0
- package/src/web-components/elements/fmcp-select.d.ts +99 -0
- package/src/web-components/elements/fmcp-select.js +243 -0
- package/src/web-components/elements/fmcp-select.js.map +1 -0
- package/src/web-components/elements/index.d.ts +12 -0
- package/src/web-components/elements/index.js +34 -0
- package/src/web-components/elements/index.js.map +1 -0
- package/src/web-components/index.d.ts +49 -0
- package/src/web-components/index.js +75 -0
- package/src/web-components/index.js.map +1 -0
- package/src/web-components/register.d.ts +56 -0
- package/src/web-components/register.js +80 -0
- package/src/web-components/register.js.map +1 -0
- package/src/web-components/types.d.ts +121 -0
- package/src/web-components/types.js +25 -0
- package/src/web-components/types.js.map +1 -0
- package/src/widgets/index.d.ts +7 -0
- package/src/widgets/index.js +24 -0
- package/src/widgets/index.js.map +1 -0
- package/src/widgets/progress.d.ts +132 -0
- package/src/widgets/progress.js +303 -0
- package/src/widgets/progress.js.map +1 -0
- package/src/widgets/resource.d.ts +162 -0
- package/src/widgets/resource.js +340 -0
- package/src/widgets/resource.js.map +1 -0
package/package.json
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@frontmcp/ui",
|
|
3
|
+
"version": "0.5.0",
|
|
4
|
+
"description": "FrontMCP UI - Comprehensive UI library for authentication and authorization flows with multi-framework support (HTML, React, MDX)",
|
|
5
|
+
"author": "AgentFront <info@agentfront.dev>",
|
|
6
|
+
"homepage": "https://docs.agentfront.dev",
|
|
7
|
+
"license": "Apache-2.0",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"mcp",
|
|
10
|
+
"ui",
|
|
11
|
+
"tailwind",
|
|
12
|
+
"htmx",
|
|
13
|
+
"oauth",
|
|
14
|
+
"authentication",
|
|
15
|
+
"authorization",
|
|
16
|
+
"consent",
|
|
17
|
+
"agentfront",
|
|
18
|
+
"frontmcp",
|
|
19
|
+
"framework",
|
|
20
|
+
"typescript",
|
|
21
|
+
"react",
|
|
22
|
+
"mdx",
|
|
23
|
+
"jsx",
|
|
24
|
+
"ssr"
|
|
25
|
+
],
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "git+https://github.com/agentfront/frontmcp.git"
|
|
29
|
+
},
|
|
30
|
+
"bugs": {
|
|
31
|
+
"url": "https://github.com/agentfront/frontmcp/issues"
|
|
32
|
+
},
|
|
33
|
+
"main": "./src/index.js",
|
|
34
|
+
"types": "./src/index.d.ts",
|
|
35
|
+
"exports": {
|
|
36
|
+
"./package.json": "./package.json",
|
|
37
|
+
".": {
|
|
38
|
+
"types": "./src/index.d.ts",
|
|
39
|
+
"import": "./src/index.js",
|
|
40
|
+
"default": "./src/index.js"
|
|
41
|
+
},
|
|
42
|
+
"./types": {
|
|
43
|
+
"types": "./src/types/index.d.ts",
|
|
44
|
+
"import": "./src/types/index.js",
|
|
45
|
+
"default": "./src/types/index.js"
|
|
46
|
+
},
|
|
47
|
+
"./adapters": {
|
|
48
|
+
"types": "./src/adapters/index.d.ts",
|
|
49
|
+
"import": "./src/adapters/index.js",
|
|
50
|
+
"default": "./src/adapters/index.js"
|
|
51
|
+
},
|
|
52
|
+
"./build": {
|
|
53
|
+
"types": "./src/build/index.d.ts",
|
|
54
|
+
"import": "./src/build/index.js",
|
|
55
|
+
"default": "./src/build/index.js"
|
|
56
|
+
},
|
|
57
|
+
"./renderers": {
|
|
58
|
+
"types": "./src/renderers/index.d.ts",
|
|
59
|
+
"import": "./src/renderers/index.js",
|
|
60
|
+
"default": "./src/renderers/index.js"
|
|
61
|
+
},
|
|
62
|
+
"./components": {
|
|
63
|
+
"types": "./src/components/index.d.ts",
|
|
64
|
+
"import": "./src/components/index.js",
|
|
65
|
+
"default": "./src/components/index.js"
|
|
66
|
+
},
|
|
67
|
+
"./runtime": {
|
|
68
|
+
"types": "./src/runtime/index.d.ts",
|
|
69
|
+
"import": "./src/runtime/index.js",
|
|
70
|
+
"default": "./src/runtime/index.js"
|
|
71
|
+
},
|
|
72
|
+
"./theme": {
|
|
73
|
+
"types": "./src/theme/index.d.ts",
|
|
74
|
+
"import": "./src/theme/index.js",
|
|
75
|
+
"default": "./src/theme/index.js"
|
|
76
|
+
},
|
|
77
|
+
"./bridge": {
|
|
78
|
+
"types": "./src/bridge/index.d.ts",
|
|
79
|
+
"import": "./src/bridge/index.js",
|
|
80
|
+
"default": "./src/bridge/index.js"
|
|
81
|
+
},
|
|
82
|
+
"./web-components": {
|
|
83
|
+
"types": "./src/web-components/index.d.ts",
|
|
84
|
+
"import": "./src/web-components/index.js",
|
|
85
|
+
"default": "./src/web-components/index.js"
|
|
86
|
+
},
|
|
87
|
+
"./react": {
|
|
88
|
+
"types": "./src/react/index.d.ts",
|
|
89
|
+
"import": "./src/react/index.js",
|
|
90
|
+
"default": "./src/react/index.js"
|
|
91
|
+
},
|
|
92
|
+
"./render": {
|
|
93
|
+
"types": "./src/render/index.d.ts",
|
|
94
|
+
"import": "./src/render/index.js",
|
|
95
|
+
"default": "./src/render/index.js"
|
|
96
|
+
},
|
|
97
|
+
"./styles": {
|
|
98
|
+
"types": "./src/styles/index.d.ts",
|
|
99
|
+
"import": "./src/styles/index.js",
|
|
100
|
+
"default": "./src/styles/index.js"
|
|
101
|
+
},
|
|
102
|
+
"./bundler": {
|
|
103
|
+
"types": "./src/bundler/index.d.ts",
|
|
104
|
+
"import": "./src/bundler/index.js",
|
|
105
|
+
"default": "./src/bundler/index.js"
|
|
106
|
+
},
|
|
107
|
+
"./handlebars": {
|
|
108
|
+
"types": "./src/handlebars/index.d.ts",
|
|
109
|
+
"import": "./src/handlebars/index.js",
|
|
110
|
+
"default": "./src/handlebars/index.js"
|
|
111
|
+
},
|
|
112
|
+
"./registry": {
|
|
113
|
+
"types": "./src/registry/index.d.ts",
|
|
114
|
+
"import": "./src/registry/index.js",
|
|
115
|
+
"default": "./src/registry/index.js"
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
"dependencies": {
|
|
119
|
+
"@swc/core": "^1.5.0",
|
|
120
|
+
"enclave-vm": "^1.0.1",
|
|
121
|
+
"esbuild": "^0.24.0",
|
|
122
|
+
"handlebars": "^4.7.8",
|
|
123
|
+
"tslib": "^2.3.0",
|
|
124
|
+
"zod": "^4.0.0"
|
|
125
|
+
},
|
|
126
|
+
"peerDependencies": {
|
|
127
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
128
|
+
"react-dom": "^18.0.0 || ^19.0.0"
|
|
129
|
+
},
|
|
130
|
+
"peerDependenciesMeta": {
|
|
131
|
+
"react": {
|
|
132
|
+
"optional": true
|
|
133
|
+
},
|
|
134
|
+
"react-dom": {
|
|
135
|
+
"optional": true
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
"optionalDependencies": {
|
|
139
|
+
"@mdx-js/mdx": "^3.1.0"
|
|
140
|
+
},
|
|
141
|
+
"devDependencies": {
|
|
142
|
+
"@types/react": "^19.0.0",
|
|
143
|
+
"@types/react-dom": "^19.0.0",
|
|
144
|
+
"typescript": "^5.9.3"
|
|
145
|
+
},
|
|
146
|
+
"type": "commonjs"
|
|
147
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @frontmcp/ui Adapters
|
|
3
|
+
*
|
|
4
|
+
* Platform-specific adapters for building UI metadata.
|
|
5
|
+
* These adapters are SDK-independent and can be used by external systems
|
|
6
|
+
* like AgentLink without requiring @frontmcp/sdk.
|
|
7
|
+
*
|
|
8
|
+
* @packageDocumentation
|
|
9
|
+
*/
|
|
10
|
+
export { type AIPlatformType, type UIMetadata, type BuildUIMetaOptions, type BuildToolDiscoveryMetaOptions, buildUIMeta, buildToolDiscoveryMeta, buildOpenAICSP, } from './platform-meta';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @frontmcp/ui Adapters
|
|
4
|
+
*
|
|
5
|
+
* Platform-specific adapters for building UI metadata.
|
|
6
|
+
* These adapters are SDK-independent and can be used by external systems
|
|
7
|
+
* like AgentLink without requiring @frontmcp/sdk.
|
|
8
|
+
*
|
|
9
|
+
* @packageDocumentation
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.buildOpenAICSP = exports.buildToolDiscoveryMeta = exports.buildUIMeta = void 0;
|
|
13
|
+
var platform_meta_1 = require("./platform-meta");
|
|
14
|
+
// Builder Functions
|
|
15
|
+
Object.defineProperty(exports, "buildUIMeta", { enumerable: true, get: function () { return platform_meta_1.buildUIMeta; } });
|
|
16
|
+
Object.defineProperty(exports, "buildToolDiscoveryMeta", { enumerable: true, get: function () { return platform_meta_1.buildToolDiscoveryMeta; } });
|
|
17
|
+
Object.defineProperty(exports, "buildOpenAICSP", { enumerable: true, get: function () { return platform_meta_1.buildOpenAICSP; } });
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/adapters/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AAEH,iDAWyB;AAJvB,oBAAoB;AACpB,4GAAA,WAAW,OAAA;AACX,uHAAA,sBAAsB,OAAA;AACtB,+GAAA,cAAc,OAAA","sourcesContent":["/**\n * @frontmcp/ui Adapters\n *\n * Platform-specific adapters for building UI metadata.\n * These adapters are SDK-independent and can be used by external systems\n * like AgentLink without requiring @frontmcp/sdk.\n *\n * @packageDocumentation\n */\n\nexport {\n // Platform Types\n type AIPlatformType,\n // Metadata Types\n type UIMetadata,\n type BuildUIMetaOptions,\n type BuildToolDiscoveryMetaOptions,\n // Builder Functions\n buildUIMeta,\n buildToolDiscoveryMeta,\n buildOpenAICSP,\n} from './platform-meta';\n"]}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform Metadata Adapters
|
|
3
|
+
*
|
|
4
|
+
* Build platform-specific _meta fields for tool UI responses.
|
|
5
|
+
* Adapts the UI configuration to the format expected by each
|
|
6
|
+
* AI platform (OpenAI, Claude, Gemini, etc.).
|
|
7
|
+
*
|
|
8
|
+
* This module is SDK-independent and can be used by external systems
|
|
9
|
+
* like AgentLink without requiring @frontmcp/sdk.
|
|
10
|
+
*
|
|
11
|
+
* @packageDocumentation
|
|
12
|
+
*/
|
|
13
|
+
import type { UITemplateConfig, UIContentSecurityPolicy } from '../types';
|
|
14
|
+
/**
|
|
15
|
+
* Supported AI platform types.
|
|
16
|
+
* Used to determine which metadata format to generate.
|
|
17
|
+
*/
|
|
18
|
+
export type AIPlatformType = 'openai' | 'claude' | 'gemini' | 'cursor' | 'continue' | 'cody' | 'generic-mcp' | 'ext-apps' | 'unknown';
|
|
19
|
+
/**
|
|
20
|
+
* UI metadata to include in tool response _meta field.
|
|
21
|
+
* Contains both universal fields and platform-specific annotations.
|
|
22
|
+
*/
|
|
23
|
+
export interface UIMetadata {
|
|
24
|
+
/** Inline rendered HTML (universal) */
|
|
25
|
+
'ui/html'?: string;
|
|
26
|
+
/** MIME type for the HTML content */
|
|
27
|
+
'ui/mimeType'?: string;
|
|
28
|
+
/** Widget token for authenticated operations */
|
|
29
|
+
'ui/widgetToken'?: string;
|
|
30
|
+
/** Direct URL to widget (for direct-url serving mode) */
|
|
31
|
+
'ui/directUrl'?: string;
|
|
32
|
+
/** Renderer type for the widget (html, react, mdx, markdown, auto) */
|
|
33
|
+
'ui/type'?: string;
|
|
34
|
+
/** Manifest URI for accessing widget configuration */
|
|
35
|
+
'ui/manifestUri'?: string;
|
|
36
|
+
/** Hash of the widget content for cache validation */
|
|
37
|
+
'ui/contentHash'?: string;
|
|
38
|
+
/** Required renderer assets for lazy loading */
|
|
39
|
+
'ui/requiredRenderers'?: string[];
|
|
40
|
+
/** OpenAI: Resource URI for widget template */
|
|
41
|
+
'openai/outputTemplate'?: string;
|
|
42
|
+
/** OpenAI: Whether widget can invoke tools */
|
|
43
|
+
'openai/widgetAccessible'?: boolean;
|
|
44
|
+
/** OpenAI: Whether tool result can produce a widget (CRITICAL for ChatGPT) */
|
|
45
|
+
'openai/resultCanProduceWidget'?: boolean;
|
|
46
|
+
/** OpenAI: CSP configuration */
|
|
47
|
+
'openai/widgetCSP'?: {
|
|
48
|
+
connect_domains?: string[];
|
|
49
|
+
resource_domains?: string[];
|
|
50
|
+
};
|
|
51
|
+
/** OpenAI: Display mode preference */
|
|
52
|
+
'openai/displayMode'?: string;
|
|
53
|
+
/** OpenAI: Widget description */
|
|
54
|
+
'openai/widgetDescription'?: string;
|
|
55
|
+
/** OpenAI: Status text while tool is executing */
|
|
56
|
+
'openai/toolInvocation/invoking'?: string;
|
|
57
|
+
/** OpenAI: Status text after tool execution completes */
|
|
58
|
+
'openai/toolInvocation/invoked'?: string;
|
|
59
|
+
/** Claude: Widget description */
|
|
60
|
+
'claude/widgetDescription'?: string;
|
|
61
|
+
/** Gemini: Widget description */
|
|
62
|
+
'gemini/widgetDescription'?: string;
|
|
63
|
+
/** IDE: Resource URI for widget template */
|
|
64
|
+
'ide/outputTemplate'?: string;
|
|
65
|
+
/** IDE: Widget description */
|
|
66
|
+
'ide/widgetDescription'?: string;
|
|
67
|
+
/** MCP Apps: Resource URI for UI template */
|
|
68
|
+
'ui/resourceUri'?: string;
|
|
69
|
+
/** MCP Apps: CSP configuration */
|
|
70
|
+
'ui/csp'?: {
|
|
71
|
+
connectDomains?: string[];
|
|
72
|
+
resourceDomains?: string[];
|
|
73
|
+
};
|
|
74
|
+
/** MCP Apps: Dedicated sandbox domain */
|
|
75
|
+
'ui/domain'?: string;
|
|
76
|
+
/** MCP Apps: Whether to show border around UI */
|
|
77
|
+
'ui/prefersBorder'?: boolean;
|
|
78
|
+
/** MCP Apps: Display mode */
|
|
79
|
+
'ui/displayMode'?: 'inline' | 'fullscreen' | 'pip';
|
|
80
|
+
/** Allow additional platform-specific fields */
|
|
81
|
+
[key: string]: unknown;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Options for building UI metadata.
|
|
85
|
+
*/
|
|
86
|
+
export interface BuildUIMetaOptions<In = unknown, Out = unknown> {
|
|
87
|
+
/** Tool UI configuration */
|
|
88
|
+
uiConfig: UITemplateConfig<In, Out>;
|
|
89
|
+
/** Detected platform type */
|
|
90
|
+
platformType: AIPlatformType;
|
|
91
|
+
/** Rendered HTML content */
|
|
92
|
+
html: string;
|
|
93
|
+
/** Widget access token */
|
|
94
|
+
token?: string;
|
|
95
|
+
/** Direct URL for widget serving */
|
|
96
|
+
directUrl?: string;
|
|
97
|
+
/** Renderer type for the widget (html, react, mdx, markdown, auto) */
|
|
98
|
+
rendererType?: string;
|
|
99
|
+
/** Hash of the widget content for cache validation */
|
|
100
|
+
contentHash?: string;
|
|
101
|
+
/** Manifest URI for accessing widget configuration */
|
|
102
|
+
manifestUri?: string;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Build platform-specific UI metadata for tool response.
|
|
106
|
+
*
|
|
107
|
+
* For inline serving mode (default), HTML is embedded directly in `_meta['ui/html']`.
|
|
108
|
+
* For static mode, the static widget URI is provided in tools/list
|
|
109
|
+
* and the tool response contains only structured data.
|
|
110
|
+
*
|
|
111
|
+
* @example
|
|
112
|
+
* ```typescript
|
|
113
|
+
* import { buildUIMeta } from '@frontmcp/ui/adapters';
|
|
114
|
+
*
|
|
115
|
+
* const meta = buildUIMeta({
|
|
116
|
+
* uiConfig: { template: (ctx) => `<div>${ctx.output.value}</div>` },
|
|
117
|
+
* platformType: 'openai',
|
|
118
|
+
* html: '<div>Hello World</div>',
|
|
119
|
+
* });
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
export declare function buildUIMeta<In = unknown, Out = unknown>(options: BuildUIMetaOptions<In, Out>): UIMetadata;
|
|
123
|
+
/**
|
|
124
|
+
* Build OpenAI CSP format.
|
|
125
|
+
*/
|
|
126
|
+
export declare function buildOpenAICSP(csp: UIContentSecurityPolicy): {
|
|
127
|
+
connect_domains?: string[];
|
|
128
|
+
resource_domains?: string[];
|
|
129
|
+
};
|
|
130
|
+
/**
|
|
131
|
+
* Build metadata for tool discovery (tools/list response).
|
|
132
|
+
* This includes fields that should be present at discovery time,
|
|
133
|
+
* not in individual tool call responses.
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* ```typescript
|
|
137
|
+
* import { buildToolDiscoveryMeta } from '@frontmcp/ui/adapters';
|
|
138
|
+
*
|
|
139
|
+
* const toolMeta = buildToolDiscoveryMeta({
|
|
140
|
+
* uiConfig: { template: MyWidget, widgetAccessible: true },
|
|
141
|
+
* platformType: 'openai',
|
|
142
|
+
* staticWidgetUri: 'ui://widget/my_tool.html',
|
|
143
|
+
* });
|
|
144
|
+
*
|
|
145
|
+
* // Use in tools/list response
|
|
146
|
+
* const tool = {
|
|
147
|
+
* name: 'my_tool',
|
|
148
|
+
* description: '...',
|
|
149
|
+
* inputSchema: {...},
|
|
150
|
+
* _meta: toolMeta,
|
|
151
|
+
* };
|
|
152
|
+
* ```
|
|
153
|
+
*/
|
|
154
|
+
export interface BuildToolDiscoveryMetaOptions<In = unknown, Out = unknown> {
|
|
155
|
+
/** Tool UI configuration */
|
|
156
|
+
uiConfig: UITemplateConfig<In, Out>;
|
|
157
|
+
/** Detected platform type */
|
|
158
|
+
platformType: AIPlatformType;
|
|
159
|
+
/** Static widget URI (e.g., ui://widget/my_tool.html) */
|
|
160
|
+
staticWidgetUri: string;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Build tool discovery metadata (for tools/list response).
|
|
164
|
+
*/
|
|
165
|
+
export declare function buildToolDiscoveryMeta<In = unknown, Out = unknown>(options: BuildToolDiscoveryMetaOptions<In, Out>): UIMetadata;
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Platform Metadata Adapters
|
|
4
|
+
*
|
|
5
|
+
* Build platform-specific _meta fields for tool UI responses.
|
|
6
|
+
* Adapts the UI configuration to the format expected by each
|
|
7
|
+
* AI platform (OpenAI, Claude, Gemini, etc.).
|
|
8
|
+
*
|
|
9
|
+
* This module is SDK-independent and can be used by external systems
|
|
10
|
+
* like AgentLink without requiring @frontmcp/sdk.
|
|
11
|
+
*
|
|
12
|
+
* @packageDocumentation
|
|
13
|
+
*/
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.buildUIMeta = buildUIMeta;
|
|
16
|
+
exports.buildOpenAICSP = buildOpenAICSP;
|
|
17
|
+
exports.buildToolDiscoveryMeta = buildToolDiscoveryMeta;
|
|
18
|
+
// ============================================
|
|
19
|
+
// Main Builder Function
|
|
20
|
+
// ============================================
|
|
21
|
+
/**
|
|
22
|
+
* Build platform-specific UI metadata for tool response.
|
|
23
|
+
*
|
|
24
|
+
* For inline serving mode (default), HTML is embedded directly in `_meta['ui/html']`.
|
|
25
|
+
* For static mode, the static widget URI is provided in tools/list
|
|
26
|
+
* and the tool response contains only structured data.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```typescript
|
|
30
|
+
* import { buildUIMeta } from '@frontmcp/ui/adapters';
|
|
31
|
+
*
|
|
32
|
+
* const meta = buildUIMeta({
|
|
33
|
+
* uiConfig: { template: (ctx) => `<div>${ctx.output.value}</div>` },
|
|
34
|
+
* platformType: 'openai',
|
|
35
|
+
* html: '<div>Hello World</div>',
|
|
36
|
+
* });
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
function buildUIMeta(options) {
|
|
40
|
+
const { uiConfig, platformType, html, token, directUrl, rendererType, contentHash, manifestUri } = options;
|
|
41
|
+
const meta = {};
|
|
42
|
+
// Add manifest-related fields if provided
|
|
43
|
+
if (rendererType) {
|
|
44
|
+
meta['ui/type'] = rendererType;
|
|
45
|
+
}
|
|
46
|
+
if (contentHash) {
|
|
47
|
+
meta['ui/contentHash'] = contentHash;
|
|
48
|
+
}
|
|
49
|
+
if (manifestUri) {
|
|
50
|
+
meta['ui/manifestUri'] = manifestUri;
|
|
51
|
+
}
|
|
52
|
+
// For inline mode, embed HTML directly in response
|
|
53
|
+
// This is the only serving mode that uses buildUIMeta
|
|
54
|
+
// (static mode returns structured data only, no UI _meta)
|
|
55
|
+
meta['ui/html'] = html;
|
|
56
|
+
// Always include MIME type for platforms that need it
|
|
57
|
+
meta['ui/mimeType'] = getMimeType(platformType);
|
|
58
|
+
// Include token if provided
|
|
59
|
+
if (token) {
|
|
60
|
+
meta['ui/widgetToken'] = token;
|
|
61
|
+
}
|
|
62
|
+
// Include direct URL if provided
|
|
63
|
+
if (directUrl) {
|
|
64
|
+
meta['ui/directUrl'] = directUrl;
|
|
65
|
+
}
|
|
66
|
+
// Platform-specific fields
|
|
67
|
+
switch (platformType) {
|
|
68
|
+
case 'openai':
|
|
69
|
+
return buildOpenAIMeta(meta, uiConfig);
|
|
70
|
+
case 'claude':
|
|
71
|
+
return buildClaudeMeta(meta, uiConfig);
|
|
72
|
+
case 'gemini':
|
|
73
|
+
return buildGeminiMeta(meta, uiConfig);
|
|
74
|
+
case 'cursor':
|
|
75
|
+
case 'continue':
|
|
76
|
+
case 'cody':
|
|
77
|
+
return buildIDEMeta(meta, uiConfig);
|
|
78
|
+
case 'generic-mcp':
|
|
79
|
+
return buildGenericMeta(meta, uiConfig);
|
|
80
|
+
case 'ext-apps':
|
|
81
|
+
return buildExtAppsMeta(meta, uiConfig);
|
|
82
|
+
default:
|
|
83
|
+
// Unknown platform - just return universal fields
|
|
84
|
+
return meta;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
// ============================================
|
|
88
|
+
// Helper Functions
|
|
89
|
+
// ============================================
|
|
90
|
+
/**
|
|
91
|
+
* Get MIME type based on platform.
|
|
92
|
+
*/
|
|
93
|
+
function getMimeType(platformType) {
|
|
94
|
+
switch (platformType) {
|
|
95
|
+
case 'openai':
|
|
96
|
+
return 'text/html+skybridge';
|
|
97
|
+
default:
|
|
98
|
+
return 'text/html+mcp';
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Build OpenAI-specific metadata for tool CALL response (inline mode).
|
|
103
|
+
*
|
|
104
|
+
* NOTE: Per OpenAI's pizzaz example, the call response should only include
|
|
105
|
+
* invocation status in _meta. The outputTemplate, resultCanProduceWidget, etc.
|
|
106
|
+
* are discovery-time fields that belong in tools/list _meta, NOT in call response.
|
|
107
|
+
*
|
|
108
|
+
* For static mode: OpenAI fetches the widget HTML from the outputTemplate URI
|
|
109
|
+
* (set in tools/list) and injects structuredContent as window.openai.toolOutput.
|
|
110
|
+
* For inline mode: HTML is embedded directly in _meta['ui/html'].
|
|
111
|
+
*/
|
|
112
|
+
function buildOpenAIMeta(meta, uiConfig) {
|
|
113
|
+
// Only include invocation status in call response _meta
|
|
114
|
+
// (per pizzaz example - they don't include outputTemplate in call response)
|
|
115
|
+
if (uiConfig.invocationStatus?.invoking) {
|
|
116
|
+
meta['openai/toolInvocation/invoking'] = uiConfig.invocationStatus.invoking;
|
|
117
|
+
}
|
|
118
|
+
if (uiConfig.invocationStatus?.invoked) {
|
|
119
|
+
meta['openai/toolInvocation/invoked'] = uiConfig.invocationStatus.invoked;
|
|
120
|
+
}
|
|
121
|
+
return meta;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Build OpenAI CSP format.
|
|
125
|
+
*/
|
|
126
|
+
function buildOpenAICSP(csp) {
|
|
127
|
+
const result = {};
|
|
128
|
+
if (csp.connectDomains?.length) {
|
|
129
|
+
result.connect_domains = csp.connectDomains;
|
|
130
|
+
}
|
|
131
|
+
if (csp.resourceDomains?.length) {
|
|
132
|
+
result.resource_domains = csp.resourceDomains;
|
|
133
|
+
}
|
|
134
|
+
return result;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Build Claude-specific metadata.
|
|
138
|
+
* Claude widgets are network-blocked, so we don't include URI references.
|
|
139
|
+
*/
|
|
140
|
+
function buildClaudeMeta(meta, uiConfig) {
|
|
141
|
+
// Claude uses inline HTML only (network-blocked)
|
|
142
|
+
// Don't include resource URI since Claude can't fetch it
|
|
143
|
+
if (uiConfig.widgetDescription) {
|
|
144
|
+
meta['claude/widgetDescription'] = uiConfig.widgetDescription;
|
|
145
|
+
}
|
|
146
|
+
return meta;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Build Gemini-specific metadata.
|
|
150
|
+
*/
|
|
151
|
+
function buildGeminiMeta(meta, uiConfig) {
|
|
152
|
+
// Gemini support is limited - include inline HTML
|
|
153
|
+
// Future: Add Gemini-specific fields when they're defined
|
|
154
|
+
if (uiConfig.widgetDescription) {
|
|
155
|
+
meta['gemini/widgetDescription'] = uiConfig.widgetDescription;
|
|
156
|
+
}
|
|
157
|
+
return meta;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Build IDE-specific metadata (Cursor, Continue, Cody).
|
|
161
|
+
* For inline mode, HTML is embedded directly in _meta['ui/html'].
|
|
162
|
+
*/
|
|
163
|
+
function buildIDEMeta(meta, uiConfig) {
|
|
164
|
+
if (uiConfig.widgetDescription) {
|
|
165
|
+
meta['ide/widgetDescription'] = uiConfig.widgetDescription;
|
|
166
|
+
}
|
|
167
|
+
return meta;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Build generic MCP client metadata.
|
|
171
|
+
* For inline mode, HTML is embedded directly in _meta['ui/html'].
|
|
172
|
+
*/
|
|
173
|
+
function buildGenericMeta(meta, uiConfig) {
|
|
174
|
+
if (uiConfig.widgetAccessible) {
|
|
175
|
+
meta['openai/widgetAccessible'] = true;
|
|
176
|
+
}
|
|
177
|
+
if (uiConfig.csp) {
|
|
178
|
+
meta['openai/widgetCSP'] = buildOpenAICSP(uiConfig.csp);
|
|
179
|
+
}
|
|
180
|
+
return meta;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Build MCP Apps (ext-apps) metadata per specification.
|
|
184
|
+
* For inline mode, HTML is embedded directly in _meta['ui/html'].
|
|
185
|
+
*
|
|
186
|
+
* Per MCP Apps spec: https://github.com/modelcontextprotocol/ext-apps
|
|
187
|
+
* - ui/csp: Content security policy for sandboxed iframe
|
|
188
|
+
* - ui/displayMode: How the UI should be displayed
|
|
189
|
+
* - ui/prefersBorder: Whether to show border around UI
|
|
190
|
+
* - ui/domain: Optional dedicated sandbox domain
|
|
191
|
+
*/
|
|
192
|
+
function buildExtAppsMeta(meta, uiConfig) {
|
|
193
|
+
// MCP Apps uses text/html+mcp MIME type
|
|
194
|
+
meta['ui/mimeType'] = 'text/html+mcp';
|
|
195
|
+
// CSP configuration (uses camelCase per MCP Apps spec)
|
|
196
|
+
if (uiConfig.csp) {
|
|
197
|
+
const csp = {};
|
|
198
|
+
if (uiConfig.csp.connectDomains?.length) {
|
|
199
|
+
csp.connectDomains = uiConfig.csp.connectDomains;
|
|
200
|
+
}
|
|
201
|
+
if (uiConfig.csp.resourceDomains?.length) {
|
|
202
|
+
csp.resourceDomains = uiConfig.csp.resourceDomains;
|
|
203
|
+
}
|
|
204
|
+
if (Object.keys(csp).length > 0) {
|
|
205
|
+
meta['ui/csp'] = csp;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
// Display mode preference
|
|
209
|
+
if (uiConfig.displayMode) {
|
|
210
|
+
// Map generic display modes to MCP Apps specific values
|
|
211
|
+
const displayModeMap = {
|
|
212
|
+
inline: 'inline',
|
|
213
|
+
fullscreen: 'fullscreen',
|
|
214
|
+
pip: 'pip',
|
|
215
|
+
// Map OpenAI-style values
|
|
216
|
+
widget: 'inline',
|
|
217
|
+
panel: 'fullscreen',
|
|
218
|
+
};
|
|
219
|
+
const mappedMode = displayModeMap[uiConfig.displayMode];
|
|
220
|
+
if (mappedMode) {
|
|
221
|
+
meta['ui/displayMode'] = mappedMode;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
// Border preference (default: true for visual clarity in sandbox)
|
|
225
|
+
if (uiConfig.prefersBorder !== undefined) {
|
|
226
|
+
meta['ui/prefersBorder'] = uiConfig.prefersBorder;
|
|
227
|
+
}
|
|
228
|
+
// Dedicated sandbox domain (optional)
|
|
229
|
+
if (uiConfig.sandboxDomain) {
|
|
230
|
+
meta['ui/domain'] = uiConfig.sandboxDomain;
|
|
231
|
+
}
|
|
232
|
+
return meta;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Build tool discovery metadata (for tools/list response).
|
|
236
|
+
*/
|
|
237
|
+
function buildToolDiscoveryMeta(options) {
|
|
238
|
+
const { uiConfig, platformType, staticWidgetUri } = options;
|
|
239
|
+
const meta = {};
|
|
240
|
+
switch (platformType) {
|
|
241
|
+
case 'openai':
|
|
242
|
+
// OpenAI-specific discovery fields
|
|
243
|
+
meta['openai/outputTemplate'] = staticWidgetUri;
|
|
244
|
+
meta['openai/resultCanProduceWidget'] = true;
|
|
245
|
+
if (uiConfig.widgetAccessible) {
|
|
246
|
+
meta['openai/widgetAccessible'] = true;
|
|
247
|
+
}
|
|
248
|
+
if (uiConfig.csp) {
|
|
249
|
+
meta['openai/widgetCSP'] = buildOpenAICSP(uiConfig.csp);
|
|
250
|
+
}
|
|
251
|
+
if (uiConfig.displayMode) {
|
|
252
|
+
meta['openai/displayMode'] = uiConfig.displayMode;
|
|
253
|
+
}
|
|
254
|
+
if (uiConfig.widgetDescription) {
|
|
255
|
+
meta['openai/widgetDescription'] = uiConfig.widgetDescription;
|
|
256
|
+
}
|
|
257
|
+
break;
|
|
258
|
+
case 'generic-mcp':
|
|
259
|
+
// Generic MCP uses OpenAI-like format
|
|
260
|
+
meta['openai/outputTemplate'] = staticWidgetUri;
|
|
261
|
+
meta['openai/resultCanProduceWidget'] = true;
|
|
262
|
+
if (uiConfig.widgetAccessible) {
|
|
263
|
+
meta['openai/widgetAccessible'] = true;
|
|
264
|
+
}
|
|
265
|
+
if (uiConfig.csp) {
|
|
266
|
+
meta['openai/widgetCSP'] = buildOpenAICSP(uiConfig.csp);
|
|
267
|
+
}
|
|
268
|
+
break;
|
|
269
|
+
case 'ext-apps':
|
|
270
|
+
// MCP Apps discovery metadata per specification
|
|
271
|
+
meta['ui/resourceUri'] = staticWidgetUri;
|
|
272
|
+
meta['ui/mimeType'] = 'text/html+mcp';
|
|
273
|
+
if (uiConfig.csp) {
|
|
274
|
+
const csp = {};
|
|
275
|
+
if (uiConfig.csp.connectDomains?.length) {
|
|
276
|
+
csp.connectDomains = uiConfig.csp.connectDomains;
|
|
277
|
+
}
|
|
278
|
+
if (uiConfig.csp.resourceDomains?.length) {
|
|
279
|
+
csp.resourceDomains = uiConfig.csp.resourceDomains;
|
|
280
|
+
}
|
|
281
|
+
if (Object.keys(csp).length > 0) {
|
|
282
|
+
meta['ui/csp'] = csp;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
if (uiConfig.displayMode) {
|
|
286
|
+
const displayModeMap = {
|
|
287
|
+
inline: 'inline',
|
|
288
|
+
fullscreen: 'fullscreen',
|
|
289
|
+
pip: 'pip',
|
|
290
|
+
};
|
|
291
|
+
const mappedMode = displayModeMap[uiConfig.displayMode];
|
|
292
|
+
if (mappedMode) {
|
|
293
|
+
meta['ui/displayMode'] = mappedMode;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
if (uiConfig.prefersBorder !== undefined) {
|
|
297
|
+
meta['ui/prefersBorder'] = uiConfig.prefersBorder;
|
|
298
|
+
}
|
|
299
|
+
if (uiConfig.sandboxDomain) {
|
|
300
|
+
meta['ui/domain'] = uiConfig.sandboxDomain;
|
|
301
|
+
}
|
|
302
|
+
break;
|
|
303
|
+
// Claude, Gemini, IDEs don't need discovery metadata
|
|
304
|
+
// They use inline HTML at call time
|
|
305
|
+
default:
|
|
306
|
+
break;
|
|
307
|
+
}
|
|
308
|
+
return meta;
|
|
309
|
+
}
|
|
310
|
+
//# sourceMappingURL=platform-meta.js.map
|