skybridge 0.0.0-dev.db67c37 → 0.0.0-dev.dbab7df
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +126 -116
- package/dist/cli/build-helpers.d.ts +11 -0
- package/dist/cli/build-helpers.js +107 -0
- package/dist/cli/build-helpers.js.map +1 -0
- package/dist/cli/build-helpers.test.js +132 -0
- package/dist/cli/build-helpers.test.js.map +1 -0
- package/dist/cli/build-steps.d.ts +2 -0
- package/dist/cli/build-steps.js +73 -0
- package/dist/cli/build-steps.js.map +1 -0
- package/dist/cli/build-steps.test.js +52 -0
- package/dist/cli/build-steps.test.js.map +1 -0
- package/dist/cli/detect-port.d.ts +2 -2
- package/dist/cli/detect-port.js +9 -20
- package/dist/cli/detect-port.js.map +1 -1
- package/dist/cli/header.d.ts +1 -1
- package/dist/cli/header.js +1 -1
- package/dist/cli/header.js.map +1 -1
- package/dist/cli/resolve-skybridge-config.d.ts +5 -0
- package/dist/cli/resolve-skybridge-config.js +18 -0
- package/dist/cli/resolve-skybridge-config.js.map +1 -0
- package/dist/cli/run-command.js.map +1 -1
- package/dist/cli/run-plain.d.ts +18 -0
- package/dist/cli/run-plain.js +89 -0
- package/dist/cli/run-plain.js.map +1 -0
- package/dist/cli/telemetry.js.map +1 -1
- package/dist/cli/tunnel-control-server.d.ts +9 -0
- package/dist/cli/tunnel-control-server.js +31 -0
- package/dist/cli/tunnel-control-server.js.map +1 -0
- package/dist/cli/tunnel-control-server.test.js +39 -0
- package/dist/cli/tunnel-control-server.test.js.map +1 -0
- package/dist/cli/tunnel-handler.d.ts +3 -0
- package/dist/cli/tunnel-handler.js +48 -0
- package/dist/cli/tunnel-handler.js.map +1 -0
- package/dist/cli/tunnel-handler.test.js +105 -0
- package/dist/cli/tunnel-handler.test.js.map +1 -0
- package/dist/cli/tunnel.d.ts +57 -0
- package/dist/cli/tunnel.js +154 -0
- package/dist/cli/tunnel.js.map +1 -0
- package/dist/cli/tunnel.test.js +190 -0
- package/dist/cli/tunnel.test.js.map +1 -0
- package/dist/cli/types.d.ts +5 -0
- package/dist/cli/types.js +2 -0
- package/dist/cli/types.js.map +1 -0
- package/dist/cli/use-execute-steps.d.ts +1 -1
- package/dist/cli/use-execute-steps.js.map +1 -1
- package/dist/cli/use-messages.d.ts +3 -0
- package/dist/cli/use-messages.js +11 -0
- package/dist/cli/use-messages.js.map +1 -0
- package/dist/cli/use-nodemon.d.ts +16 -6
- package/dist/cli/use-nodemon.js +74 -59
- package/dist/cli/use-nodemon.js.map +1 -1
- package/dist/cli/use-open-browser.d.ts +1 -0
- package/dist/cli/use-open-browser.js +44 -0
- package/dist/cli/use-open-browser.js.map +1 -0
- package/dist/cli/use-tunnel.d.ts +14 -0
- package/dist/cli/use-tunnel.js +131 -0
- package/dist/cli/use-tunnel.js.map +1 -0
- package/dist/cli/use-typescript-check.d.ts +9 -2
- package/dist/cli/use-typescript-check.js +89 -51
- package/dist/cli/use-typescript-check.js.map +1 -1
- package/dist/commands/build.d.ts +0 -3
- package/dist/commands/build.js +3 -18
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/create.d.ts +9 -0
- package/dist/commands/create.js +30 -0
- package/dist/commands/create.js.map +1 -0
- package/dist/commands/dev.d.ts +4 -1
- package/dist/commands/dev.js +94 -8
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/start.js +13 -10
- package/dist/commands/start.js.map +1 -1
- package/dist/commands/telemetry/disable.js.map +1 -1
- package/dist/commands/telemetry/enable.js.map +1 -1
- package/dist/commands/telemetry/status.js.map +1 -1
- package/dist/context-warnings.d.ts +5 -0
- package/dist/context-warnings.js +31 -0
- package/dist/context-warnings.js.map +1 -0
- package/dist/context-warnings.test.js +28 -0
- package/dist/context-warnings.test.js.map +1 -0
- package/dist/server/app.d.ts +180 -0
- package/dist/server/app.js +266 -0
- package/dist/server/app.js.map +1 -0
- package/dist/server/asset-base-url-transform-plugin.d.ts +6 -6
- package/dist/server/asset-base-url-transform-plugin.js +25 -11
- package/dist/server/asset-base-url-transform-plugin.js.map +1 -1
- package/dist/server/asset-base-url-transform-plugin.test.js +92 -14
- package/dist/server/asset-base-url-transform-plugin.test.js.map +1 -1
- package/dist/server/auth/discovery.d.ts +33 -0
- package/dist/server/auth/discovery.js +56 -0
- package/dist/server/auth/discovery.js.map +1 -0
- package/dist/server/auth/discovery.test.d.ts +1 -0
- package/dist/server/auth/discovery.test.js +93 -0
- package/dist/server/auth/discovery.test.js.map +1 -0
- package/dist/server/auth/index.d.ts +30 -0
- package/dist/server/auth/index.js +2 -0
- package/dist/server/auth/index.js.map +1 -0
- package/dist/server/auth/providers/auth0.d.ts +40 -0
- package/dist/server/auth/providers/auth0.js +31 -0
- package/dist/server/auth/providers/auth0.js.map +1 -0
- package/dist/server/auth/providers/auth0.test.d.ts +1 -0
- package/dist/server/auth/providers/auth0.test.js +50 -0
- package/dist/server/auth/providers/auth0.test.js.map +1 -0
- package/dist/server/auth/providers/authplane.d.ts +49 -0
- package/dist/server/auth/providers/authplane.js +57 -0
- package/dist/server/auth/providers/authplane.js.map +1 -0
- package/dist/server/auth/providers/authplane.test.d.ts +1 -0
- package/dist/server/auth/providers/authplane.test.js +140 -0
- package/dist/server/auth/providers/authplane.test.js.map +1 -0
- package/dist/server/auth/providers/clerk.d.ts +51 -0
- package/dist/server/auth/providers/clerk.js +19 -0
- package/dist/server/auth/providers/clerk.js.map +1 -0
- package/dist/server/auth/providers/clerk.test.d.ts +1 -0
- package/dist/server/auth/providers/clerk.test.js +30 -0
- package/dist/server/auth/providers/clerk.test.js.map +1 -0
- package/dist/server/auth/providers/custom.d.ts +40 -0
- package/dist/server/auth/providers/custom.js +56 -0
- package/dist/server/auth/providers/custom.js.map +1 -0
- package/dist/server/auth/providers/custom.test.d.ts +1 -0
- package/dist/server/auth/providers/custom.test.js +158 -0
- package/dist/server/auth/providers/custom.test.js.map +1 -0
- package/dist/server/auth/providers/descope.d.ts +44 -0
- package/dist/server/auth/providers/descope.js +44 -0
- package/dist/server/auth/providers/descope.js.map +1 -0
- package/dist/server/auth/providers/descope.test.d.ts +1 -0
- package/dist/server/auth/providers/descope.test.js +62 -0
- package/dist/server/auth/providers/descope.test.js.map +1 -0
- package/dist/server/auth/providers/shared.d.ts +2 -0
- package/dist/server/auth/providers/shared.js +6 -0
- package/dist/server/auth/providers/shared.js.map +1 -0
- package/dist/server/auth/providers/shared.test.d.ts +1 -0
- package/dist/server/auth/providers/shared.test.js +10 -0
- package/dist/server/auth/providers/shared.test.js.map +1 -0
- package/dist/server/auth/providers/stytch.d.ts +25 -0
- package/dist/server/auth/providers/stytch.js +16 -0
- package/dist/server/auth/providers/stytch.js.map +1 -0
- package/dist/server/auth/providers/verify-spy.d.ts +12 -0
- package/dist/server/auth/providers/verify-spy.js +21 -0
- package/dist/server/auth/providers/verify-spy.js.map +1 -0
- package/dist/server/auth/providers/workos.d.ts +33 -0
- package/dist/server/auth/providers/workos.js +15 -0
- package/dist/server/auth/providers/workos.js.map +1 -0
- package/dist/server/auth/security-schemes.d.ts +23 -0
- package/dist/server/auth/security-schemes.js +64 -0
- package/dist/server/auth/security-schemes.js.map +1 -0
- package/dist/server/auth/security-schemes.test.d.ts +1 -0
- package/dist/server/auth/security-schemes.test.js +99 -0
- package/dist/server/auth/security-schemes.test.js.map +1 -0
- package/dist/server/auth/setup.d.ts +6 -0
- package/dist/server/auth/setup.js +91 -0
- package/dist/server/auth/setup.js.map +1 -0
- package/dist/server/auth/setup.test.d.ts +1 -0
- package/dist/server/auth/setup.test.js +512 -0
- package/dist/server/auth/setup.test.js.map +1 -0
- package/dist/server/auth/verify.d.ts +46 -0
- package/dist/server/auth/verify.js +62 -0
- package/dist/server/auth/verify.js.map +1 -0
- package/dist/server/auth/verify.test.d.ts +1 -0
- package/dist/server/auth/verify.test.js +149 -0
- package/dist/server/auth/verify.test.js.map +1 -0
- package/dist/server/auth-extra.test-d.d.ts +1 -0
- package/dist/server/auth-extra.test-d.js +70 -0
- package/dist/server/auth-extra.test-d.js.map +1 -0
- package/dist/server/auth.d.ts +57 -0
- package/dist/server/auth.js +27 -0
- package/dist/server/auth.js.map +1 -0
- package/dist/server/build-manifest.test.d.ts +1 -0
- package/dist/server/build-manifest.test.js +28 -0
- package/dist/server/build-manifest.test.js.map +1 -0
- package/dist/server/content-helpers.d.ts +67 -0
- package/dist/server/content-helpers.js +79 -0
- package/dist/server/content-helpers.js.map +1 -0
- package/dist/server/content-helpers.test.d.ts +1 -0
- package/dist/server/content-helpers.test.js +70 -0
- package/dist/server/content-helpers.test.js.map +1 -0
- package/dist/server/express.d.ts +9 -5
- package/dist/server/express.js +49 -44
- package/dist/server/express.js.map +1 -1
- package/dist/server/express.test.js +470 -25
- package/dist/server/express.test.js.map +1 -1
- package/dist/server/file-ref.d.ts +28 -0
- package/dist/server/file-ref.js +27 -0
- package/dist/server/file-ref.js.map +1 -0
- package/dist/server/host.d.ts +2 -0
- package/dist/server/host.js +11 -0
- package/dist/server/host.js.map +1 -0
- package/dist/server/host.test.d.ts +1 -0
- package/dist/server/host.test.js +13 -0
- package/dist/server/host.test.js.map +1 -0
- package/dist/server/index.d.ts +21 -4
- package/dist/server/index.js +16 -2
- package/dist/server/index.js.map +1 -1
- package/dist/server/inferUtilityTypes.d.ts +6 -6
- package/dist/server/inferUtilityTypes.js.map +1 -1
- package/dist/server/mcp-errors.test.d.ts +1 -0
- package/dist/server/mcp-errors.test.js +37 -0
- package/dist/server/mcp-errors.test.js.map +1 -0
- package/dist/server/metric.d.ts +14 -0
- package/dist/server/metric.js +62 -0
- package/dist/server/metric.js.map +1 -0
- package/dist/server/middleware.d.ts +80 -14
- package/dist/server/middleware.js +33 -0
- package/dist/server/middleware.js.map +1 -1
- package/dist/server/middleware.test-d.js +44 -21
- package/dist/server/middleware.test-d.js.map +1 -1
- package/dist/server/middleware.test.js +229 -53
- package/dist/server/middleware.test.js.map +1 -1
- package/dist/server/register-tool.test.d.ts +1 -0
- package/dist/server/register-tool.test.js +23 -0
- package/dist/server/register-tool.test.js.map +1 -0
- package/dist/server/requestOrigin.d.ts +7 -0
- package/dist/server/requestOrigin.js +25 -0
- package/dist/server/requestOrigin.js.map +1 -0
- package/dist/server/server.d.ts +377 -95
- package/dist/server/server.js +521 -209
- package/dist/server/server.js.map +1 -1
- package/dist/server/skills-integration.test.d.ts +1 -0
- package/dist/server/skills-integration.test.js +79 -0
- package/dist/server/skills-integration.test.js.map +1 -0
- package/dist/server/skills.d.ts +27 -0
- package/dist/server/skills.js +188 -0
- package/dist/server/skills.js.map +1 -0
- package/dist/server/skills.test.d.ts +1 -0
- package/dist/server/skills.test.js +243 -0
- package/dist/server/skills.test.js.map +1 -0
- package/dist/server/templateHelper.d.ts +5 -8
- package/dist/server/templateHelper.js +3 -22
- package/dist/server/templateHelper.js.map +1 -1
- package/dist/server/templates.generated.d.ts +4 -0
- package/dist/server/templates.generated.js +47 -0
- package/dist/server/templates.generated.js.map +1 -0
- package/dist/server/tool-extra.test.d.ts +1 -0
- package/dist/server/tool-extra.test.js +72 -0
- package/dist/server/tool-extra.test.js.map +1 -0
- package/dist/server/tunnel-proxy-router.d.ts +7 -0
- package/dist/server/tunnel-proxy-router.js +110 -0
- package/dist/server/tunnel-proxy-router.js.map +1 -0
- package/dist/server/tunnel-proxy-router.test.d.ts +1 -0
- package/dist/server/tunnel-proxy-router.test.js +229 -0
- package/dist/server/tunnel-proxy-router.test.js.map +1 -0
- package/dist/server/view-name.test-d.d.ts +1 -0
- package/dist/server/view-name.test-d.js +8 -0
- package/dist/server/view-name.test-d.js.map +1 -0
- package/dist/server/view-resource-resolution.test.d.ts +6 -0
- package/dist/server/view-resource-resolution.test.js +172 -0
- package/dist/server/view-resource-resolution.test.js.map +1 -0
- package/dist/server/viewsDevServer.d.ts +14 -0
- package/dist/server/viewsDevServer.js +48 -0
- package/dist/server/viewsDevServer.js.map +1 -0
- package/dist/standard-schema.d.ts +3 -0
- package/dist/standard-schema.js +2 -0
- package/dist/standard-schema.js.map +1 -0
- package/dist/test/utils.d.ts +21 -31
- package/dist/test/utils.js +55 -45
- package/dist/test/utils.js.map +1 -1
- package/dist/test/view.test.d.ts +1 -0
- package/dist/test/view.test.js +536 -0
- package/dist/test/view.test.js.map +1 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +3 -0
- package/dist/version.js.map +1 -0
- package/dist/views/index.d.ts +3 -0
- package/dist/views/index.js +3 -0
- package/dist/views/index.js.map +1 -0
- package/dist/views/scan-views.d.ts +16 -0
- package/dist/views/scan-views.js +88 -0
- package/dist/views/scan-views.js.map +1 -0
- package/dist/views/scan-views.test.d.ts +1 -0
- package/dist/views/scan-views.test.js +99 -0
- package/dist/views/scan-views.test.js.map +1 -0
- package/dist/views/validate-view.d.ts +1 -0
- package/dist/views/validate-view.js +9 -0
- package/dist/views/validate-view.js.map +1 -0
- package/dist/views/validate-view.test.d.ts +1 -0
- package/dist/views/validate-view.test.js +24 -0
- package/dist/views/validate-view.test.js.map +1 -0
- package/dist/web/bridges/adaptor.d.ts +51 -0
- package/dist/web/bridges/adaptor.js +327 -0
- package/dist/web/bridges/adaptor.js.map +1 -0
- package/dist/web/bridges/adaptor.test.d.ts +1 -0
- package/dist/web/bridges/adaptor.test.js +225 -0
- package/dist/web/bridges/adaptor.test.js.map +1 -0
- package/dist/web/bridges/apps-sdk/bridge.d.ts +7 -2
- package/dist/web/bridges/apps-sdk/bridge.js +15 -3
- package/dist/web/bridges/apps-sdk/bridge.js.map +1 -1
- package/dist/web/bridges/apps-sdk/index.d.ts +1 -2
- package/dist/web/bridges/apps-sdk/index.js +0 -1
- package/dist/web/bridges/apps-sdk/index.js.map +1 -1
- package/dist/web/bridges/apps-sdk/types.d.ts +22 -9
- package/dist/web/bridges/apps-sdk/types.js.map +1 -1
- package/dist/web/bridges/apps-sdk/use-apps-sdk-context.d.ts +11 -0
- package/dist/web/bridges/apps-sdk/use-apps-sdk-context.js +11 -0
- package/dist/web/bridges/apps-sdk/use-apps-sdk-context.js.map +1 -1
- package/dist/web/bridges/get-adaptor.d.ts +7 -0
- package/dist/web/bridges/get-adaptor.js +9 -7
- package/dist/web/bridges/get-adaptor.js.map +1 -1
- package/dist/web/bridges/get-adaptor.test.d.ts +1 -0
- package/dist/web/bridges/get-adaptor.test.js +32 -0
- package/dist/web/bridges/get-adaptor.test.js.map +1 -0
- package/dist/web/bridges/index.js.map +1 -1
- package/dist/web/bridges/mcp-app/bridge.d.ts +27 -31
- package/dist/web/bridges/mcp-app/bridge.js +111 -203
- package/dist/web/bridges/mcp-app/bridge.js.map +1 -1
- package/dist/web/bridges/mcp-app/bridge.test.d.ts +1 -0
- package/dist/web/bridges/mcp-app/bridge.test.js +17 -0
- package/dist/web/bridges/mcp-app/bridge.test.js.map +1 -0
- package/dist/web/bridges/mcp-app/index.d.ts +0 -1
- package/dist/web/bridges/mcp-app/index.js +0 -1
- package/dist/web/bridges/mcp-app/index.js.map +1 -1
- package/dist/web/bridges/mcp-app/types.d.ts +2 -0
- package/dist/web/bridges/mcp-app/types.js.map +1 -1
- package/dist/web/bridges/mcp-app/use-mcp-app-context.d.ts +17 -3
- package/dist/web/bridges/mcp-app/use-mcp-app-context.js +14 -2
- package/dist/web/bridges/mcp-app/use-mcp-app-context.js.map +1 -1
- package/dist/web/bridges/mcp-app/use-mcp-app-context.test.js +1 -41
- package/dist/web/bridges/mcp-app/use-mcp-app-context.test.js.map +1 -1
- package/dist/web/bridges/mcp-app/view-tools.test.d.ts +1 -0
- package/dist/web/bridges/mcp-app/view-tools.test.js +143 -0
- package/dist/web/bridges/mcp-app/view-tools.test.js.map +1 -0
- package/dist/web/bridges/types.d.ts +131 -11
- package/dist/web/bridges/types.js +14 -1
- package/dist/web/bridges/types.js.map +1 -1
- package/dist/web/bridges/types.test.d.ts +1 -0
- package/dist/web/bridges/types.test.js +19 -0
- package/dist/web/bridges/types.test.js.map +1 -0
- package/dist/web/bridges/use-host-context.d.ts +5 -0
- package/dist/web/bridges/use-host-context.js +5 -0
- package/dist/web/bridges/use-host-context.js.map +1 -1
- package/dist/web/components/modal-provider.d.ts +1 -1
- package/dist/web/components/modal-provider.js +5 -6
- package/dist/web/components/modal-provider.js.map +1 -1
- package/dist/web/create-store.d.ts +26 -0
- package/dist/web/create-store.js +43 -3
- package/dist/web/create-store.js.map +1 -1
- package/dist/web/create-store.test.js +30 -24
- package/dist/web/create-store.test.js.map +1 -1
- package/dist/web/data-llm.d.ts +35 -2
- package/dist/web/data-llm.js +31 -3
- package/dist/web/data-llm.js.map +1 -1
- package/dist/web/data-llm.test.js +43 -29
- package/dist/web/data-llm.test.js.map +1 -1
- package/dist/web/generate-helpers.d.ts +32 -27
- package/dist/web/generate-helpers.js +29 -24
- package/dist/web/generate-helpers.js.map +1 -1
- package/dist/web/generate-helpers.test-d.js +33 -31
- package/dist/web/generate-helpers.test-d.js.map +1 -1
- package/dist/web/generate-helpers.test.js +2 -2
- package/dist/web/generate-helpers.test.js.map +1 -1
- package/dist/web/helpers/state.d.ts +2 -2
- package/dist/web/helpers/state.js +11 -11
- package/dist/web/helpers/state.js.map +1 -1
- package/dist/web/helpers/state.test.js +9 -9
- package/dist/web/helpers/state.test.js.map +1 -1
- package/dist/web/hooks/index.d.ts +7 -2
- package/dist/web/hooks/index.js +7 -2
- package/dist/web/hooks/index.js.map +1 -1
- package/dist/web/hooks/test/utils.d.ts +7 -2
- package/dist/web/hooks/test/utils.js +18 -3
- package/dist/web/hooks/test/utils.js.map +1 -1
- package/dist/web/hooks/use-call-tool.d.ts +45 -0
- package/dist/web/hooks/use-call-tool.js +28 -0
- package/dist/web/hooks/use-call-tool.js.map +1 -1
- package/dist/web/hooks/use-call-tool.test-d.js.map +1 -1
- package/dist/web/hooks/use-call-tool.test.js +64 -29
- package/dist/web/hooks/use-call-tool.test.js.map +1 -1
- package/dist/web/hooks/use-display-mode.d.ts +20 -0
- package/dist/web/hooks/use-display-mode.js +20 -0
- package/dist/web/hooks/use-display-mode.js.map +1 -1
- package/dist/web/hooks/use-display-mode.test-d.js.map +1 -1
- package/dist/web/hooks/use-display-mode.test.js +57 -21
- package/dist/web/hooks/use-display-mode.test.js.map +1 -1
- package/dist/web/hooks/use-download.d.ts +3 -0
- package/dist/web/hooks/use-download.js +7 -0
- package/dist/web/hooks/use-download.js.map +1 -0
- package/dist/web/hooks/use-download.test.d.ts +1 -0
- package/dist/web/hooks/use-download.test.js +103 -0
- package/dist/web/hooks/use-download.test.js.map +1 -0
- package/dist/web/hooks/use-files.d.ts +34 -1
- package/dist/web/hooks/use-files.js +33 -0
- package/dist/web/hooks/use-files.js.map +1 -1
- package/dist/web/hooks/use-files.test.js +31 -3
- package/dist/web/hooks/use-files.test.js.map +1 -1
- package/dist/web/hooks/use-host.d.ts +22 -0
- package/dist/web/hooks/use-host.js +30 -0
- package/dist/web/hooks/use-host.js.map +1 -0
- package/dist/web/hooks/use-host.test.d.ts +1 -0
- package/dist/web/hooks/use-host.test.js +59 -0
- package/dist/web/hooks/use-host.test.js.map +1 -0
- package/dist/web/hooks/use-open-external.d.ts +17 -0
- package/dist/web/hooks/use-open-external.js +16 -0
- package/dist/web/hooks/use-open-external.js.map +1 -1
- package/dist/web/hooks/use-open-external.test.js +29 -14
- package/dist/web/hooks/use-open-external.test.js.map +1 -1
- package/dist/web/hooks/use-register-view-tool.d.ts +37 -0
- package/dist/web/hooks/use-register-view-tool.js +50 -0
- package/dist/web/hooks/use-register-view-tool.js.map +1 -0
- package/dist/web/hooks/use-request-close.d.ts +16 -0
- package/dist/web/hooks/use-request-close.js +21 -0
- package/dist/web/hooks/use-request-close.js.map +1 -0
- package/dist/web/hooks/use-request-close.test.d.ts +1 -0
- package/dist/web/hooks/use-request-close.test.js +47 -0
- package/dist/web/hooks/use-request-close.test.js.map +1 -0
- package/dist/web/hooks/use-request-modal.d.ts +16 -1
- package/dist/web/hooks/use-request-modal.js +19 -4
- package/dist/web/hooks/use-request-modal.js.map +1 -1
- package/dist/web/hooks/use-request-modal.test.js +16 -2
- package/dist/web/hooks/use-request-modal.test.js.map +1 -1
- package/dist/web/hooks/use-request-size.d.ts +20 -0
- package/dist/web/hooks/use-request-size.js +24 -0
- package/dist/web/hooks/use-request-size.js.map +1 -0
- package/dist/web/hooks/use-request-size.test.d.ts +1 -0
- package/dist/web/hooks/use-request-size.test.js +47 -0
- package/dist/web/hooks/use-request-size.test.js.map +1 -0
- package/dist/web/hooks/use-send-follow-up-message.d.ts +19 -1
- package/dist/web/hooks/use-send-follow-up-message.js +19 -2
- package/dist/web/hooks/use-send-follow-up-message.js.map +1 -1
- package/dist/web/hooks/use-set-open-in-app-url.d.ts +17 -0
- package/dist/web/hooks/use-set-open-in-app-url.js +17 -0
- package/dist/web/hooks/use-set-open-in-app-url.js.map +1 -1
- package/dist/web/hooks/use-set-open-in-app-url.test.js +29 -9
- package/dist/web/hooks/use-set-open-in-app-url.test.js.map +1 -1
- package/dist/web/hooks/use-tool-info.d.ts +46 -14
- package/dist/web/hooks/use-tool-info.js +29 -7
- package/dist/web/hooks/use-tool-info.js.map +1 -1
- package/dist/web/hooks/use-tool-info.test-d.js +11 -34
- package/dist/web/hooks/use-tool-info.test-d.js.map +1 -1
- package/dist/web/hooks/use-tool-info.test.js +42 -37
- package/dist/web/hooks/use-tool-info.test.js.map +1 -1
- package/dist/web/hooks/use-user.d.ts +5 -2
- package/dist/web/hooks/use-user.js +23 -4
- package/dist/web/hooks/use-user.js.map +1 -1
- package/dist/web/hooks/use-user.test.js +104 -28
- package/dist/web/hooks/use-user.test.js.map +1 -1
- package/dist/web/hooks/use-view-state.d.ts +25 -0
- package/dist/web/hooks/use-view-state.js +42 -0
- package/dist/web/hooks/use-view-state.js.map +1 -0
- package/dist/web/hooks/use-view-state.test.d.ts +1 -0
- package/dist/web/hooks/use-view-state.test.js +212 -0
- package/dist/web/hooks/use-view-state.test.js.map +1 -0
- package/dist/web/hooks/use-viewport.d.ts +20 -0
- package/dist/web/hooks/use-viewport.js +21 -0
- package/dist/web/hooks/use-viewport.js.map +1 -0
- package/dist/web/hooks/use-viewport.test.d.ts +1 -0
- package/dist/web/hooks/use-viewport.test.js +109 -0
- package/dist/web/hooks/use-viewport.test.js.map +1 -0
- package/dist/web/index.d.ts +2 -2
- package/dist/web/index.js +1 -2
- package/dist/web/index.js.map +1 -1
- package/dist/web/mount-view.d.ts +21 -0
- package/dist/web/{mount-widget.js → mount-view.js} +22 -2
- package/dist/web/mount-view.js.map +1 -0
- package/dist/web/proxy.js.map +1 -1
- package/dist/web/types.d.ts +4 -0
- package/dist/web/types.js.map +1 -1
- package/package.json +47 -27
- package/tsconfig.base.json +5 -0
- package/dist/server/const.d.ts +0 -1
- package/dist/server/const.js +0 -2
- package/dist/server/const.js.map +0 -1
- package/dist/server/templates/development.hbs +0 -67
- package/dist/server/templates/production.hbs +0 -6
- package/dist/server/widgetsDevServer.d.ts +0 -12
- package/dist/server/widgetsDevServer.js +0 -63
- package/dist/server/widgetsDevServer.js.map +0 -1
- package/dist/test/widget.test.js +0 -261
- package/dist/test/widget.test.js.map +0 -1
- package/dist/web/bridges/apps-sdk/adaptor.d.ts +0 -22
- package/dist/web/bridges/apps-sdk/adaptor.js +0 -71
- package/dist/web/bridges/apps-sdk/adaptor.js.map +0 -1
- package/dist/web/bridges/mcp-app/adaptor.d.ts +0 -36
- package/dist/web/bridges/mcp-app/adaptor.js +0 -190
- package/dist/web/bridges/mcp-app/adaptor.js.map +0 -1
- package/dist/web/hooks/use-layout.d.ts +0 -22
- package/dist/web/hooks/use-layout.js +0 -23
- package/dist/web/hooks/use-layout.js.map +0 -1
- package/dist/web/hooks/use-layout.test.js +0 -96
- package/dist/web/hooks/use-layout.test.js.map +0 -1
- package/dist/web/hooks/use-widget-state.d.ts +0 -4
- package/dist/web/hooks/use-widget-state.js +0 -32
- package/dist/web/hooks/use-widget-state.js.map +0 -1
- package/dist/web/hooks/use-widget-state.test.js +0 -62
- package/dist/web/hooks/use-widget-state.test.js.map +0 -1
- package/dist/web/mount-widget.d.ts +0 -1
- package/dist/web/mount-widget.js.map +0 -1
- package/dist/web/plugin/data-llm.test.js +0 -81
- package/dist/web/plugin/data-llm.test.js.map +0 -1
- package/dist/web/plugin/plugin.d.ts +0 -2
- package/dist/web/plugin/plugin.js +0 -54
- package/dist/web/plugin/plugin.js.map +0 -1
- package/dist/web/plugin/transform-data-llm.d.ts +0 -12
- package/dist/web/plugin/transform-data-llm.js +0 -96
- package/dist/web/plugin/transform-data-llm.js.map +0 -1
- package/dist/web/plugin/transform-data-llm.test.js +0 -81
- package/dist/web/plugin/transform-data-llm.test.js.map +0 -1
- package/dist/web/plugin/validate-widget.d.ts +0 -5
- package/dist/web/plugin/validate-widget.js +0 -27
- package/dist/web/plugin/validate-widget.js.map +0 -1
- package/dist/web/plugin/validate-widget.test.js +0 -42
- package/dist/web/plugin/validate-widget.test.js.map +0 -1
- /package/dist/{test/widget.test.d.ts → cli/build-helpers.test.d.ts} +0 -0
- /package/dist/{web/hooks/use-layout.test.d.ts → cli/build-steps.test.d.ts} +0 -0
- /package/dist/{web/hooks/use-widget-state.test.d.ts → cli/tunnel-control-server.test.d.ts} +0 -0
- /package/dist/{web/plugin/data-llm.test.d.ts → cli/tunnel-handler.test.d.ts} +0 -0
- /package/dist/{web/plugin/transform-data-llm.test.d.ts → cli/tunnel.test.d.ts} +0 -0
- /package/dist/{web/plugin/validate-widget.test.d.ts → context-warnings.test.d.ts} +0 -0
package/dist/server/server.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import crypto from "node:crypto";
|
|
2
2
|
import { readFileSync } from "node:fs";
|
|
3
|
-
import http from "node:http";
|
|
4
3
|
import path from "node:path";
|
|
5
|
-
import { McpServer as McpServerBase, } from "@modelcontextprotocol/
|
|
4
|
+
import { McpServer as McpServerBase, } from "@modelcontextprotocol/server";
|
|
6
5
|
import { mergeWith, union } from "es-toolkit";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
6
|
+
import { warnOnLargeToolOutput } from "../context-warnings.js";
|
|
7
|
+
import { authToSecuritySchemes, evaluateSecuritySchemes, inBandChallengeResult, } from "./auth/security-schemes.js";
|
|
8
|
+
import { hostFromUserAgent } from "./host.js";
|
|
9
|
+
import { captureToolError } from "./middleware.js";
|
|
10
|
+
import { resolveServerOrigin } from "./requestOrigin.js";
|
|
11
|
+
import { discoverSkills, registerSkills, SKILLS_EXTENSION_KEY, } from "./skills.js";
|
|
10
12
|
import { templateHelper } from "./templateHelper.js";
|
|
11
13
|
const mergeWithUnion = (target, source) => {
|
|
12
14
|
return mergeWith(target, source, (targetVal, sourceVal) => {
|
|
@@ -15,245 +17,555 @@ const mergeWithUnion = (target, source) => {
|
|
|
15
17
|
}
|
|
16
18
|
});
|
|
17
19
|
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
this.customMiddleware.push({
|
|
32
|
-
handlers: [pathOrHandler, ...handlers],
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
return this;
|
|
20
|
+
const SKILLS_DIR = "src/skills";
|
|
21
|
+
/**
|
|
22
|
+
* Normalize an `x-forwarded-prefix` value into a leading-slash, no-trailing-slash
|
|
23
|
+
* path. Takes the first hop of a comma-separated proxy chain.
|
|
24
|
+
* "/v1/", "v1", "/v1, /internal" → "/v1"; "", "/", undefined → "".
|
|
25
|
+
*/
|
|
26
|
+
function normalizeForwardedPrefix(raw) {
|
|
27
|
+
const firstHop = raw?.split(",")[0]?.trim() ?? "";
|
|
28
|
+
const trimmed = firstHop.replace(/\/+$/, "");
|
|
29
|
+
if (trimmed === "") {
|
|
30
|
+
return "";
|
|
36
31
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
32
|
+
return trimmed.startsWith("/") ? trimmed : `/${trimmed}`;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Drop the query string from a `ui://` view URI, leaving the bare path. The
|
|
36
|
+
* `?v=` cache key is the only query we append, so a plain split is enough and
|
|
37
|
+
* sidesteps `URL` normalization quirks on the non-special `ui:` scheme.
|
|
38
|
+
*/
|
|
39
|
+
function stripQuery(uri) {
|
|
40
|
+
const queryIndex = uri.indexOf("?");
|
|
41
|
+
return queryIndex === -1 ? uri : uri.slice(0, queryIndex);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Coerce a tool handler's return value into an MCP `content` array. Strings
|
|
45
|
+
* become a single `TextContent`; a single block is wrapped in an array;
|
|
46
|
+
* `undefined` produces `[]`. Mostly used internally — exported so consumers
|
|
47
|
+
* who build content lazily can apply the same normalization.
|
|
48
|
+
*/
|
|
49
|
+
export function normalizeContent(content) {
|
|
50
|
+
if (content === undefined) {
|
|
51
|
+
return [];
|
|
52
|
+
}
|
|
53
|
+
if (typeof content === "string") {
|
|
54
|
+
return [{ type: "text", text: content }];
|
|
55
|
+
}
|
|
56
|
+
if (Array.isArray(content)) {
|
|
57
|
+
return content;
|
|
58
|
+
}
|
|
59
|
+
return [content];
|
|
60
|
+
}
|
|
61
|
+
const McpServerBaseOmitted = McpServerBase;
|
|
62
|
+
// Side channel populated by `dist/__entry.js` before user code is imported.
|
|
63
|
+
// Set at module scope rather than passed through the constructor because the
|
|
64
|
+
// wrapper has the manifest before the user's `new McpServer(...)` runs, and
|
|
65
|
+
// threading it through every call site (including user templates) is exactly
|
|
66
|
+
// the boilerplate this design is trying to hide.
|
|
67
|
+
let pendingBuildManifest = null;
|
|
68
|
+
/**
|
|
69
|
+
* Prime the build-time Vite manifest before user code constructs its
|
|
70
|
+
* `McpServer`. Called from the generated `dist/__entry.js`; not part of the
|
|
71
|
+
* user-facing API.
|
|
72
|
+
*
|
|
73
|
+
* @internal
|
|
74
|
+
*/
|
|
75
|
+
export function __setBuildManifest(manifest) {
|
|
76
|
+
pendingBuildManifest = manifest;
|
|
77
|
+
}
|
|
78
|
+
let pendingSkillsManifest = null;
|
|
79
|
+
let discoveredSkills = null;
|
|
80
|
+
let warnedOnMissingSkills = false;
|
|
81
|
+
export function __setSkillsManifest(manifest) {
|
|
82
|
+
pendingSkillsManifest = manifest;
|
|
83
|
+
discoveredSkills = null;
|
|
84
|
+
}
|
|
85
|
+
// Pure and `this`-free so it can run inside the `super(...)` call, before `this`
|
|
86
|
+
// exists — the capability must be present for the `initialize` response.
|
|
87
|
+
function withSkillsCapability(options, skybridgeOptions) {
|
|
88
|
+
if (!skybridgeOptions?.skills) {
|
|
89
|
+
return options;
|
|
90
|
+
}
|
|
91
|
+
return {
|
|
92
|
+
...options,
|
|
93
|
+
capabilities: {
|
|
94
|
+
...options?.capabilities,
|
|
95
|
+
extensions: {
|
|
96
|
+
...options?.capabilities?.extensions,
|
|
97
|
+
[SKILLS_EXTENSION_KEY]: { directoryRead: true },
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Typed registration sugar over the MCP SDK's `McpServer`: a tool registry
|
|
104
|
+
* that carries input/output/meta shapes, view resources, per-tool security
|
|
105
|
+
* schemes, and prompt/resource registration. A {@link Skybridge} app builds
|
|
106
|
+
* one of these per request and hands it to your setup factory; chain
|
|
107
|
+
* {@link McpServer.registerTool} calls on it and return the result.
|
|
108
|
+
*
|
|
109
|
+
* The `TTools` generic accumulates each registered tool's input/output/meta
|
|
110
|
+
* shape, so `typeof app` carries enough information for view-side helpers
|
|
111
|
+
* like {@link generateHelpers} to produce fully-typed hooks.
|
|
112
|
+
*
|
|
113
|
+
* @typeParam TTools - Accumulated tool registry. Filled in by `registerTool`
|
|
114
|
+
* chaining; you almost never set this manually.
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* ```ts
|
|
118
|
+
* export const app = new Skybridge({ name: "my-app", version: "1.0.0" }, (server) =>
|
|
119
|
+
* server.registerTool({
|
|
120
|
+
* name: "search",
|
|
121
|
+
* inputSchema: { query: z.string() },
|
|
122
|
+
* view: { component: "search" },
|
|
123
|
+
* }, async ({ query }) => ({ content: `Results for ${query}` })),
|
|
124
|
+
* );
|
|
125
|
+
* ```
|
|
126
|
+
*
|
|
127
|
+
* @see https://docs.skybridge.tech/api-reference/mcp-server
|
|
128
|
+
*/
|
|
129
|
+
export class McpServer extends McpServerBaseOmitted {
|
|
130
|
+
claimedViews = new Map();
|
|
131
|
+
viewMetaBuilders = new Map();
|
|
132
|
+
/**
|
|
133
|
+
* Maps a view resource's query-less path to its canonical registered URI
|
|
134
|
+
* (the one carrying the `?v=` cache key). Lets `resources/read` resolve the
|
|
135
|
+
* underlying view no matter which version param the consumer sends, since
|
|
136
|
+
* the param is only a cache key, not part of the resource's identity.
|
|
137
|
+
*/
|
|
138
|
+
viewUriByPath = new Map();
|
|
139
|
+
viteManifest = null;
|
|
140
|
+
diskManifest = null;
|
|
141
|
+
oauthEnabled = false;
|
|
142
|
+
resolveResourceMetadataUrl;
|
|
143
|
+
toolSecuritySchemes = new Map();
|
|
144
|
+
constructor(serverInfo, options, skybridgeOptions) {
|
|
145
|
+
super(serverInfo, withSkillsCapability(options, skybridgeOptions));
|
|
146
|
+
this.oauthEnabled = Boolean(skybridgeOptions?.oauth);
|
|
147
|
+
// Pick up the manifest if `dist/__entry.js` primed it before importing
|
|
148
|
+
// user code. Explicit `setViteManifest` calls still win because they
|
|
149
|
+
// happen after construction.
|
|
150
|
+
if (pendingBuildManifest) {
|
|
151
|
+
this.setViteManifest(pendingBuildManifest);
|
|
58
152
|
}
|
|
153
|
+
this.setupSkills(Boolean(skybridgeOptions?.skills));
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* The per-tool security schemes collected during registration, keyed by tool
|
|
157
|
+
* name. Read by the OAuth layer to decide whether anonymous requests are
|
|
158
|
+
* allowed and which schemes gate a given `tools/call`.
|
|
159
|
+
*
|
|
160
|
+
* @internal
|
|
161
|
+
*/
|
|
162
|
+
get securitySchemesByTool() {
|
|
163
|
+
return this.toolSecuritySchemes;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Inject the resolver the app uses to build the protected-resource metadata
|
|
167
|
+
* URL, so tool handlers can emit in-band auth challenges.
|
|
168
|
+
*
|
|
169
|
+
* @internal
|
|
170
|
+
*/
|
|
171
|
+
setResourceMetadataUrlResolver(resolve) {
|
|
172
|
+
this.resolveResourceMetadataUrl = resolve;
|
|
59
173
|
return this;
|
|
60
174
|
}
|
|
61
|
-
|
|
62
|
-
|
|
175
|
+
registerResource(...args) {
|
|
176
|
+
return this.applyInherited("registerResource", args);
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Register a prompt. Signature owned by Skybridge (not inherited) so a
|
|
180
|
+
* typed wrapper can land in a minor without a type-level break.
|
|
181
|
+
*/
|
|
182
|
+
registerPrompt(name, config, cb) {
|
|
183
|
+
return this.applyInherited("registerPrompt", [
|
|
184
|
+
name,
|
|
185
|
+
config,
|
|
186
|
+
cb,
|
|
187
|
+
]);
|
|
188
|
+
}
|
|
189
|
+
applyInherited(method, args) {
|
|
190
|
+
const base = McpServerBase.prototype[method];
|
|
191
|
+
return base.apply(this, args);
|
|
192
|
+
}
|
|
193
|
+
skillRegistrar() {
|
|
194
|
+
const registerResource = this.registerResource.bind(this);
|
|
195
|
+
return { registerResource, server: this.server };
|
|
196
|
+
}
|
|
197
|
+
setupSkills(enabled) {
|
|
198
|
+
if (!enabled) {
|
|
63
199
|
return;
|
|
64
200
|
}
|
|
65
|
-
|
|
66
|
-
if (
|
|
67
|
-
|
|
201
|
+
discoveredSkills ??= pendingSkillsManifest ?? discoverSkills(SKILLS_DIR);
|
|
202
|
+
if (discoveredSkills.length === 0 && !warnedOnMissingSkills) {
|
|
203
|
+
warnedOnMissingSkills = true;
|
|
204
|
+
console.warn(`skybridge: the "skills" option is enabled but no skills were found in "${SKILLS_DIR}". Add a <name>/SKILL.md there, or remove the option.`);
|
|
68
205
|
}
|
|
69
|
-
|
|
70
|
-
const entries = this.mcpMiddlewareEntries;
|
|
71
|
-
// Wrap existing handlers and proxy future .set() for lazy SDK registration
|
|
72
|
-
const instrumentMap = (map, isNotification) => {
|
|
73
|
-
for (const [method, handler] of map) {
|
|
74
|
-
map.set(method, buildMiddlewareChain(method, isNotification, handler, entries));
|
|
75
|
-
}
|
|
76
|
-
const originalSet = map.set.bind(map);
|
|
77
|
-
map.set = (method, handler) => originalSet(method, buildMiddlewareChain(method, isNotification, handler, entries));
|
|
78
|
-
};
|
|
79
|
-
instrumentMap(requestHandlers, false);
|
|
80
|
-
instrumentMap(notificationHandlers, true);
|
|
206
|
+
registerSkills(this.skillRegistrar(), discoveredSkills);
|
|
81
207
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
208
|
+
/**
|
|
209
|
+
* The framework's own protocol-level middleware for this instance: view
|
|
210
|
+
* `_meta` on `resources/list`, version-agnostic view resolution on
|
|
211
|
+
* `resources/read`, and the top-level `securitySchemes` mirror on
|
|
212
|
+
* `tools/list`. Composed by {@link Skybridge} around user middleware.
|
|
213
|
+
*
|
|
214
|
+
* @internal
|
|
215
|
+
*/
|
|
216
|
+
protocolMiddlewareEntries() {
|
|
217
|
+
// Surface view-resource _meta on `resources/list` (per ext-apps spec:
|
|
218
|
+
// hosts/checkers read CSP & domain at list time before fetching content).
|
|
219
|
+
const viewListMetaEntry = {
|
|
220
|
+
filter: "resources/list",
|
|
221
|
+
handler: async (_req, extra, next) => {
|
|
222
|
+
const result = (await next());
|
|
223
|
+
for (const resource of result.resources) {
|
|
224
|
+
const builder = this.viewMetaBuilders.get(resource.uri);
|
|
225
|
+
if (!builder) {
|
|
226
|
+
continue;
|
|
227
|
+
}
|
|
228
|
+
const meta = builder(extra);
|
|
229
|
+
resource._meta = {
|
|
230
|
+
...(resource._meta ?? {}),
|
|
231
|
+
...meta,
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
return result;
|
|
235
|
+
},
|
|
236
|
+
};
|
|
237
|
+
// Resolve a view's `resources/read` by its query-less path so the
|
|
238
|
+
// underlying asset is served no matter the `?v=` value (stale cache key,
|
|
239
|
+
// no param, etc.). The version param is a cache-busting hint for external
|
|
240
|
+
// consumers; it must not gate resolution. We rewrite the lookup URI to the
|
|
241
|
+
// canonical registered one, then restore the requested URI on the response
|
|
242
|
+
// so the consumer-facing URI is never rewritten.
|
|
243
|
+
const viewReadResolveEntry = {
|
|
244
|
+
filter: "resources/read",
|
|
245
|
+
handler: async (req, _extra, next) => {
|
|
246
|
+
const requested = req.params.uri;
|
|
247
|
+
if (typeof requested !== "string") {
|
|
248
|
+
return next();
|
|
249
|
+
}
|
|
250
|
+
const path = stripQuery(requested);
|
|
251
|
+
const canonical = this.viewUriByPath.get(path);
|
|
252
|
+
if (!canonical) {
|
|
253
|
+
return next();
|
|
254
|
+
}
|
|
255
|
+
req.params.uri = canonical;
|
|
256
|
+
try {
|
|
257
|
+
const result = (await next());
|
|
258
|
+
for (const content of result.contents ?? []) {
|
|
259
|
+
if (typeof content.uri === "string" &&
|
|
260
|
+
stripQuery(content.uri) === stripQuery(canonical)) {
|
|
261
|
+
content.uri = requested;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
return result;
|
|
265
|
+
}
|
|
266
|
+
finally {
|
|
267
|
+
// Restore the shared request params so middleware outer to us never
|
|
268
|
+
// observes the rewritten lookup URI after next() unwinds.
|
|
269
|
+
req.params.uri = requested;
|
|
270
|
+
}
|
|
271
|
+
},
|
|
272
|
+
};
|
|
273
|
+
// ChatGPT reads `securitySchemes` at the tool descriptor top level (SEP-1488,
|
|
274
|
+
// still Draft), but the SDK's registerTool strips unknown top-level fields, so
|
|
275
|
+
// it's stashed in `_meta` at registration. This restores it to the top level
|
|
276
|
+
// on tools/list output. Remove once SEP-1488 lands and the SDK preserves it.
|
|
277
|
+
// { name: "checkout", _meta: { securitySchemes: [{ type: "oauth2" }] } }
|
|
278
|
+
// -> { name: "checkout", _meta: {…}, securitySchemes: [{ type: "oauth2" }] }
|
|
279
|
+
const toolsListSecuritySchemesEntry = {
|
|
280
|
+
filter: "tools/list",
|
|
281
|
+
handler: async (_req, _extra, next) => {
|
|
282
|
+
const result = (await next());
|
|
283
|
+
for (const tool of result.tools) {
|
|
284
|
+
const schemes = tool._meta?.securitySchemes;
|
|
285
|
+
if (schemes && !("securitySchemes" in tool)) {
|
|
286
|
+
tool.securitySchemes = schemes;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
return result;
|
|
290
|
+
},
|
|
291
|
+
};
|
|
292
|
+
return [
|
|
293
|
+
viewListMetaEntry,
|
|
294
|
+
viewReadResolveEntry,
|
|
295
|
+
toolsListSecuritySchemesEntry,
|
|
296
|
+
];
|
|
85
297
|
}
|
|
86
|
-
|
|
87
|
-
this.
|
|
88
|
-
if (
|
|
89
|
-
|
|
90
|
-
server: this,
|
|
91
|
-
customMiddleware: this.customMiddleware,
|
|
92
|
-
});
|
|
298
|
+
enforceOneToolPerView(component, toolName) {
|
|
299
|
+
const existingTool = this.claimedViews.get(component);
|
|
300
|
+
if (existingTool) {
|
|
301
|
+
throw new Error(`skybridge: view "${component}" is already used by tool "${existingTool}". Tool "${toolName}" cannot also reference it — each view backs exactly one tool.`);
|
|
93
302
|
}
|
|
94
|
-
|
|
95
|
-
return new Promise((resolve, reject) => {
|
|
96
|
-
const server = http.createServer(express);
|
|
97
|
-
server.on("error", (error) => {
|
|
98
|
-
console.error("Failed to start server:", error);
|
|
99
|
-
reject(error);
|
|
100
|
-
});
|
|
101
|
-
const port = parseInt(process.env.__PORT ?? "3000", 10);
|
|
102
|
-
server.listen(port, () => {
|
|
103
|
-
resolve();
|
|
104
|
-
});
|
|
105
|
-
});
|
|
303
|
+
this.claimedViews.set(component, toolName);
|
|
106
304
|
}
|
|
107
|
-
|
|
108
|
-
const
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
resource_domains: resourceDomains,
|
|
123
|
-
connect_domains: connectDomains,
|
|
124
|
-
},
|
|
125
|
-
"openai/widgetDomain": domain,
|
|
126
|
-
"openai/widgetDescription": resourceConfig.description,
|
|
127
|
-
};
|
|
128
|
-
const fromUi = {
|
|
129
|
-
"openai/widgetCSP": {
|
|
130
|
-
resource_domains: userCsp?.resourceDomains,
|
|
131
|
-
connect_domains: userCsp?.connectDomains,
|
|
132
|
-
frame_domains: userCsp?.frameDomains,
|
|
133
|
-
redirect_domains: userCsp?.redirectDomains,
|
|
134
|
-
},
|
|
135
|
-
"openai/widgetDomain": userUi?.domain,
|
|
136
|
-
"openai/widgetPrefersBorder": userUi?.prefersBorder,
|
|
137
|
-
};
|
|
138
|
-
const directOpenaiKeys = Object.fromEntries(Object.entries(userMeta ?? {}).filter(([key]) => key.startsWith("openai/")));
|
|
139
|
-
return mergeWithUnion(mergeWithUnion(mergeWithUnion(defaults, fromUi), directOpenaiKeys), { "openai/widgetDomain": overrides.domain });
|
|
140
|
-
},
|
|
141
|
-
};
|
|
142
|
-
this.registerWidgetResource({
|
|
143
|
-
name,
|
|
144
|
-
widgetConfig,
|
|
145
|
-
resourceConfig,
|
|
146
|
-
});
|
|
147
|
-
toolMeta["openai/outputTemplate"] = widgetConfig.uri;
|
|
148
|
-
}
|
|
149
|
-
if (!resourceConfig.hosts || resourceConfig.hosts.includes("mcp-app")) {
|
|
150
|
-
const widgetConfig = {
|
|
151
|
-
hostType: "mcp-app",
|
|
152
|
-
uri: `ui://widgets/ext-apps/${name}.html`,
|
|
153
|
-
mimeType: "text/html;profile=mcp-app",
|
|
154
|
-
buildContentMeta: ({ resourceDomains, connectDomains, domain }, overrides) => {
|
|
155
|
-
const defaults = {
|
|
156
|
-
ui: {
|
|
157
|
-
csp: {
|
|
158
|
-
resourceDomains,
|
|
159
|
-
connectDomains,
|
|
160
|
-
},
|
|
161
|
-
domain,
|
|
162
|
-
},
|
|
163
|
-
};
|
|
164
|
-
return mergeWithUnion(defaults, {
|
|
165
|
-
ui: { ...userMeta?.ui, ...overrides },
|
|
166
|
-
});
|
|
167
|
-
},
|
|
168
|
-
};
|
|
169
|
-
this.registerWidgetResource({
|
|
170
|
-
name,
|
|
171
|
-
widgetConfig,
|
|
172
|
-
resourceConfig,
|
|
173
|
-
});
|
|
174
|
-
// @ts-expect-error - For backwards compatibility with Claude current implementation of the specs
|
|
175
|
-
toolMeta["ui/resourceUri"] = widgetConfig.uri;
|
|
176
|
-
toolMeta.ui = { resourceUri: widgetConfig.uri };
|
|
305
|
+
resolveViewRequestContext(ctx) {
|
|
306
|
+
const isProduction = process.env.NODE_ENV === "production";
|
|
307
|
+
const header = (key) => ctx?.http?.req?.headers.get(key) ?? undefined;
|
|
308
|
+
const isClaude = hostFromUserAgent(header("user-agent")) === "claude";
|
|
309
|
+
const serverUrl = resolveServerOrigin(header);
|
|
310
|
+
// Path prefix the proxy routed this request under (e.g. `foo.com/v1`). Read
|
|
311
|
+
// per-request so one process can serve many hosts/prefixes at once: the
|
|
312
|
+
// origin is recovered from x-forwarded-host, the prefix from
|
|
313
|
+
// x-forwarded-prefix. Empty when served at the origin root.
|
|
314
|
+
const assetsBasePath = normalizeForwardedPrefix(header("x-forwarded-prefix"));
|
|
315
|
+
const connectDomains = [serverUrl];
|
|
316
|
+
if (!isProduction) {
|
|
317
|
+
const wsUrl = new URL(serverUrl);
|
|
318
|
+
wsUrl.protocol = wsUrl.protocol === "https:" ? "wss:" : "ws:";
|
|
319
|
+
connectDomains.push(wsUrl.origin);
|
|
177
320
|
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
super.registerTool(name, config, cb);
|
|
186
|
-
return this;
|
|
187
|
-
}
|
|
188
|
-
registerWidgetResource({ name, widgetConfig, resourceConfig, }) {
|
|
189
|
-
const { hostType, uri: widgetUri, mimeType, buildContentMeta, } = widgetConfig;
|
|
190
|
-
this.registerResource(name, widgetUri, { ...resourceConfig, _meta: resourceConfig._meta }, async (uri, extra) => {
|
|
191
|
-
const isProduction = process.env.NODE_ENV === "production";
|
|
192
|
-
const useForwardedHost = process.env.SKYBRIDGE_USE_FORWARDED_HOST === "true";
|
|
193
|
-
const isClaude = extra?.requestInfo?.headers?.["user-agent"] === "Claude-User";
|
|
194
|
-
const hostFromHeaders = extra?.requestInfo?.headers?.["x-forwarded-host"] ??
|
|
195
|
-
extra?.requestInfo?.headers?.host;
|
|
196
|
-
const useExternalHost = isProduction || useForwardedHost || isClaude;
|
|
197
|
-
const devPort = process.env.__PORT || "3000";
|
|
198
|
-
const serverUrl = useExternalHost
|
|
199
|
-
? `https://${hostFromHeaders}`
|
|
200
|
-
: `http://localhost:${devPort}`;
|
|
201
|
-
const html = isProduction
|
|
202
|
-
? templateHelper.renderProduction({
|
|
203
|
-
hostType,
|
|
204
|
-
serverUrl,
|
|
205
|
-
widgetFile: this.lookupDistFileWithIndexFallback(`src/widgets/${name}`),
|
|
206
|
-
styleFile: this.lookupDistFile("style.css"),
|
|
207
|
-
})
|
|
208
|
-
: templateHelper.renderDevelopment({
|
|
209
|
-
hostType,
|
|
210
|
-
serverUrl,
|
|
211
|
-
useLocalNetworkAccess: !useExternalHost,
|
|
212
|
-
widgetName: name,
|
|
213
|
-
});
|
|
214
|
-
const connectDomains = [serverUrl];
|
|
215
|
-
if (!isProduction) {
|
|
216
|
-
const hmrPort = process.env.__SKYBRIDGE_HMR_PORT ?? DEFAULT_HMR_PORT;
|
|
217
|
-
const VITE_HMR_WEBSOCKET_DEFAULT_URL = `ws://localhost:${hmrPort}`;
|
|
218
|
-
connectDomains.push(VITE_HMR_WEBSOCKET_DEFAULT_URL);
|
|
219
|
-
}
|
|
220
|
-
const pathname = extra?.requestInfo?.url?.pathname ?? "";
|
|
221
|
-
const url = `https://${hostFromHeaders}${pathname}`;
|
|
321
|
+
let contentMetaOverrides = {};
|
|
322
|
+
if (isClaude) {
|
|
323
|
+
const pathname = ctx?.http?.req ? new URL(ctx.http.req.url).pathname : "";
|
|
324
|
+
const rawUrl = header("x-alpic-forwarded-url") ?? `${serverUrl}${pathname}`;
|
|
325
|
+
// Strip a lone trailing slash so the hash matches the connector URL
|
|
326
|
+
// as registered with Claude (which has no trailing slash on bare origins).
|
|
327
|
+
const url = rawUrl.endsWith("/") ? rawUrl.slice(0, -1) : rawUrl;
|
|
222
328
|
const hash = crypto
|
|
223
329
|
.createHash("sha256")
|
|
224
330
|
.update(url)
|
|
225
331
|
.digest("hex")
|
|
226
332
|
.slice(0, 32);
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
333
|
+
contentMetaOverrides = { domain: `${hash}.claudemcpcontent.com` };
|
|
334
|
+
}
|
|
335
|
+
return { serverUrl, assetsBasePath, connectDomains, contentMetaOverrides };
|
|
336
|
+
}
|
|
337
|
+
registerViewResources(toolName, view, toolMeta) {
|
|
338
|
+
// Append a content-derived version param so hosts (e.g. ChatGPT) bust
|
|
339
|
+
// their cache when the bundle changes, but keep the URI stable across
|
|
340
|
+
// `tools/list` calls when the bundle hasn't changed.
|
|
341
|
+
const versionParam = this.computeViewVersionParam(view.component);
|
|
342
|
+
const viewResource = {
|
|
343
|
+
hostType: "mcp-app",
|
|
344
|
+
uri: `ui://views/ext-apps/${view.component}.html${versionParam}`,
|
|
345
|
+
mimeType: "text/html;profile=mcp-app",
|
|
346
|
+
buildContentMeta: ({ resourceDomains, connectDomains, domain, baseUriDomains }, overrides) => {
|
|
347
|
+
const defaults = {
|
|
348
|
+
ui: {
|
|
349
|
+
csp: {
|
|
350
|
+
resourceDomains,
|
|
351
|
+
connectDomains,
|
|
352
|
+
baseUriDomains,
|
|
353
|
+
},
|
|
354
|
+
domain,
|
|
355
|
+
},
|
|
356
|
+
};
|
|
357
|
+
const fromView = {
|
|
358
|
+
ui: {
|
|
359
|
+
...(view.description && { description: view.description }),
|
|
360
|
+
...(view.prefersBorder !== undefined && {
|
|
361
|
+
prefersBorder: view.prefersBorder,
|
|
362
|
+
}),
|
|
363
|
+
...(view.domain && { domain: view.domain }),
|
|
364
|
+
csp: {
|
|
365
|
+
...(view.csp?.resourceDomains && {
|
|
366
|
+
resourceDomains: view.csp.resourceDomains,
|
|
367
|
+
}),
|
|
368
|
+
...(view.csp?.connectDomains && {
|
|
369
|
+
connectDomains: view.csp.connectDomains,
|
|
370
|
+
}),
|
|
371
|
+
...(view.csp?.frameDomains && {
|
|
372
|
+
frameDomains: view.csp.frameDomains,
|
|
373
|
+
}),
|
|
374
|
+
...(view.csp?.baseUriDomains && {
|
|
375
|
+
baseUriDomains: view.csp.baseUriDomains,
|
|
376
|
+
}),
|
|
377
|
+
},
|
|
378
|
+
},
|
|
379
|
+
};
|
|
380
|
+
const ui = mergeWithUnion(mergeWithUnion(defaults, fromView), {
|
|
381
|
+
ui: overrides,
|
|
382
|
+
});
|
|
383
|
+
const base = {
|
|
384
|
+
...ui,
|
|
385
|
+
...(view.description && {
|
|
386
|
+
"openai/widgetDescription": view.description,
|
|
387
|
+
}),
|
|
388
|
+
...(view.csp?.redirectDomains && {
|
|
389
|
+
"openai/widgetCSP": { redirect_domains: view.csp.redirectDomains },
|
|
390
|
+
}),
|
|
391
|
+
};
|
|
392
|
+
if (view._meta) {
|
|
393
|
+
return { ...base, ...view._meta };
|
|
230
394
|
}
|
|
231
|
-
|
|
232
|
-
|
|
395
|
+
return base;
|
|
396
|
+
},
|
|
397
|
+
};
|
|
398
|
+
this.registerViewResource({ name: toolName, viewResource, view });
|
|
399
|
+
// Advertise via the MCP Apps standard pointer only — ChatGPT renders from
|
|
400
|
+
// ui.resourceUri (verified), and not emitting openai/outputTemplate lets us
|
|
401
|
+
// retire the legacy apps-sdk resource later. The legacy apps-sdk URL is still
|
|
402
|
+
// served (see registerViewResource) so already-published apps keep resolving.
|
|
403
|
+
// @ts-expect-error - For backwards compatibility with Claude current implementation of the specs
|
|
404
|
+
toolMeta["ui/resourceUri"] = viewResource.uri;
|
|
405
|
+
toolMeta.ui = { ...toolMeta.ui, resourceUri: viewResource.uri };
|
|
406
|
+
}
|
|
407
|
+
registerViewResource({ name, viewResource, view, }) {
|
|
408
|
+
const { hostType, uri: viewUri, mimeType, buildContentMeta } = viewResource;
|
|
409
|
+
const buildMeta = (extra) => {
|
|
410
|
+
const { serverUrl, connectDomains, contentMetaOverrides } = this.resolveViewRequestContext(extra);
|
|
411
|
+
return buildContentMeta({
|
|
233
412
|
resourceDomains: [serverUrl],
|
|
234
413
|
connectDomains,
|
|
235
414
|
domain: serverUrl,
|
|
236
415
|
baseUriDomains: [serverUrl],
|
|
237
416
|
}, contentMetaOverrides);
|
|
417
|
+
};
|
|
418
|
+
this.viewMetaBuilders.set(viewUri, buildMeta);
|
|
419
|
+
this.viewUriByPath.set(stripQuery(viewUri), viewUri);
|
|
420
|
+
this.serveLegacyAppsSdkUrl(view.component, viewUri);
|
|
421
|
+
this.registerResource(name, viewUri, { description: view.description }, async (uri, extra) => {
|
|
422
|
+
const isProduction = process.env.NODE_ENV === "production";
|
|
423
|
+
const { serverUrl, assetsBasePath } = this.resolveViewRequestContext(extra);
|
|
424
|
+
// The view resolves all assets (template imports + runtime lazy chunks
|
|
425
|
+
// via `window.skybridge.serverUrl`) against this base, so it carries the
|
|
426
|
+
// proxy path prefix. CSP domains in `buildMeta` stay the bare origin.
|
|
427
|
+
const viewBase = `${serverUrl}${assetsBasePath}`;
|
|
428
|
+
const html = isProduction
|
|
429
|
+
? templateHelper.renderProduction({
|
|
430
|
+
hostType,
|
|
431
|
+
serverUrl: viewBase,
|
|
432
|
+
viewFile: this.lookupViewFile(view.component),
|
|
433
|
+
styleFile: this.lookupDistFile("style.css") ?? "",
|
|
434
|
+
})
|
|
435
|
+
: templateHelper.renderDevelopment({
|
|
436
|
+
hostType,
|
|
437
|
+
serverUrl: viewBase,
|
|
438
|
+
viewName: view.component,
|
|
439
|
+
});
|
|
238
440
|
return {
|
|
239
441
|
contents: [
|
|
240
|
-
{ uri: uri.href, mimeType, text: html, _meta:
|
|
442
|
+
{ uri: uri.href, mimeType, text: html, _meta: buildMeta(extra) },
|
|
241
443
|
],
|
|
242
444
|
};
|
|
243
445
|
});
|
|
244
446
|
}
|
|
447
|
+
serveLegacyAppsSdkUrl(component, canonicalUri) {
|
|
448
|
+
this.viewUriByPath.set(`ui://views/apps-sdk/${component}.html`, canonicalUri);
|
|
449
|
+
this.viewUriByPath.set(`ui://widgets/apps-sdk/${component}.html`, canonicalUri);
|
|
450
|
+
this.viewUriByPath.set(`ui://widgets/ext-apps/${component}.html`, canonicalUri);
|
|
451
|
+
}
|
|
452
|
+
decorateToolHandler(cb, { attachViewUUID, securitySchemes, toolName, }) {
|
|
453
|
+
return async (args, extra) => {
|
|
454
|
+
if (this.oauthEnabled) {
|
|
455
|
+
const failure = evaluateSecuritySchemes(securitySchemes, extra.http?.authInfo);
|
|
456
|
+
if (failure) {
|
|
457
|
+
const header = (key) => extra.http?.req?.headers.get(key) ?? undefined;
|
|
458
|
+
return inBandChallengeResult(failure, this.resolveResourceMetadataUrl?.(header));
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
let result;
|
|
462
|
+
try {
|
|
463
|
+
result = await cb(args, extra);
|
|
464
|
+
}
|
|
465
|
+
catch (error) {
|
|
466
|
+
captureToolError(extra, error);
|
|
467
|
+
throw error;
|
|
468
|
+
}
|
|
469
|
+
warnOnLargeToolOutput(result, toolName);
|
|
470
|
+
return {
|
|
471
|
+
...result,
|
|
472
|
+
content: normalizeContent(result.content),
|
|
473
|
+
...(attachViewUUID && {
|
|
474
|
+
_meta: {
|
|
475
|
+
...result._meta,
|
|
476
|
+
viewUUID: crypto.randomUUID(),
|
|
477
|
+
},
|
|
478
|
+
}),
|
|
479
|
+
};
|
|
480
|
+
};
|
|
481
|
+
}
|
|
482
|
+
computeViewVersionParam(viewName) {
|
|
483
|
+
if (process.env.NODE_ENV !== "production") {
|
|
484
|
+
return "";
|
|
485
|
+
}
|
|
486
|
+
try {
|
|
487
|
+
const viewFile = this.lookupViewFile(viewName);
|
|
488
|
+
const styleFile = this.lookupDistFile("style.css") ?? "";
|
|
489
|
+
const hash = crypto
|
|
490
|
+
.createHash("sha256")
|
|
491
|
+
.update(viewFile)
|
|
492
|
+
.update("\0")
|
|
493
|
+
.update(styleFile)
|
|
494
|
+
.digest("hex")
|
|
495
|
+
.slice(0, 8);
|
|
496
|
+
return `?v=${hash}`;
|
|
497
|
+
}
|
|
498
|
+
catch {
|
|
499
|
+
return "";
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
lookupViewFile(viewName) {
|
|
503
|
+
const manifest = this.readManifest();
|
|
504
|
+
for (const entry of Object.values(manifest)) {
|
|
505
|
+
if (entry?.isEntry && entry.name === viewName && entry.file) {
|
|
506
|
+
return entry.file;
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
throw new Error(`View "${viewName}" not found in Vite manifest. Did the build complete successfully? Look for an entry with name "${viewName}" in dist/assets/.vite/manifest.json.`);
|
|
510
|
+
}
|
|
245
511
|
lookupDistFile(key) {
|
|
246
512
|
const manifest = this.readManifest();
|
|
247
513
|
return manifest[key]?.file;
|
|
248
514
|
}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
515
|
+
/**
|
|
516
|
+
* Inject the Vite manifest as a value rather than letting `readManifest()`
|
|
517
|
+
* load it from disk. Required for runtimes without a usable filesystem
|
|
518
|
+
* (Cloudflare Workers, etc.) — the user's `skybridge build` emits the
|
|
519
|
+
* manifest as a JS module which the entry imports and passes here.
|
|
520
|
+
*/
|
|
521
|
+
setViteManifest(manifest) {
|
|
522
|
+
this.viteManifest = manifest;
|
|
523
|
+
return this;
|
|
254
524
|
}
|
|
255
525
|
readManifest() {
|
|
256
|
-
|
|
526
|
+
if (this.viteManifest) {
|
|
527
|
+
return this.viteManifest;
|
|
528
|
+
}
|
|
529
|
+
this.diskManifest ??= JSON.parse(readFileSync(path.join(process.cwd(), "dist", "assets", ".vite", "manifest.json"), "utf-8"));
|
|
530
|
+
return this.diskManifest ?? {};
|
|
531
|
+
}
|
|
532
|
+
registerTool(rawConfig, rawCb) {
|
|
533
|
+
const baseFn = McpServerBase.prototype.registerTool;
|
|
534
|
+
const config = rawConfig;
|
|
535
|
+
const cb = rawCb;
|
|
536
|
+
const { name, view, auth, securitySchemes: rawSecuritySchemes, _meta: userToolMeta, ...toolFields } = config;
|
|
537
|
+
const authNeedsProvider = auth !== undefined &&
|
|
538
|
+
(!auth.allowsAnonymous || Boolean(auth.scopes?.length));
|
|
539
|
+
if (rawSecuritySchemes === undefined &&
|
|
540
|
+
authNeedsProvider &&
|
|
541
|
+
!this.oauthEnabled) {
|
|
542
|
+
throw new Error(`Tool "${name}" sets \`auth: ${JSON.stringify(auth)}\` but the server has no \`oauth\` provider configured.`);
|
|
543
|
+
}
|
|
544
|
+
const securitySchemes = rawSecuritySchemes ??
|
|
545
|
+
(auth && this.oauthEnabled ? authToSecuritySchemes(auth) : undefined);
|
|
546
|
+
const toolMeta = { ...userToolMeta };
|
|
547
|
+
this.toolSecuritySchemes.set(name, securitySchemes);
|
|
548
|
+
if (securitySchemes) {
|
|
549
|
+
// SEP-1488 puts `securitySchemes` at the top level of the tool
|
|
550
|
+
// descriptor, but the SDK's `registerTool` drops unknown top-level
|
|
551
|
+
// fields, so the canonical spot isn't reachable without intercepting
|
|
552
|
+
// `tools/list`. Use the `_meta` back-compat mirror documented in the
|
|
553
|
+
// Apps SDK reference until SEP-1488 lands in the spec.
|
|
554
|
+
toolMeta.securitySchemes = securitySchemes;
|
|
555
|
+
}
|
|
556
|
+
if (view) {
|
|
557
|
+
this.enforceOneToolPerView(view.component, name);
|
|
558
|
+
this.registerViewResources(name, view, toolMeta);
|
|
559
|
+
}
|
|
560
|
+
const wrappedCb = this.decorateToolHandler(cb, {
|
|
561
|
+
attachViewUUID: Boolean(view),
|
|
562
|
+
securitySchemes,
|
|
563
|
+
toolName: name,
|
|
564
|
+
});
|
|
565
|
+
baseFn.call(this, name, { ...toolFields, _meta: toolMeta }, toolFields.inputSchema === undefined
|
|
566
|
+
? (extra) => wrappedCb({}, extra)
|
|
567
|
+
: wrappedCb);
|
|
568
|
+
return this;
|
|
257
569
|
}
|
|
258
570
|
}
|
|
259
571
|
//# sourceMappingURL=server.js.map
|