skybridge 0.0.0-dev.efb7a49 → 0.0.0-dev.efba8c5
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 -128
- 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 +8 -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.js.map +1 -1
- 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 -2
- package/dist/cli/use-nodemon.js +84 -72
- 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 +13 -7
- package/dist/cli/use-tunnel.js +103 -73
- package/dist/cli/use-tunnel.js.map +1 -1
- 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 +3 -0
- package/dist/commands/dev.js +90 -6
- 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 +194 -0
- package/dist/server/app.js +266 -0
- package/dist/server/app.js.map +1 -0
- package/dist/server/app.test.d.ts +1 -0
- package/dist/server/app.test.js +97 -0
- package/dist/server/app.test.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 +48 -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 +36 -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 +143 -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 +59 -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 +161 -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 +514 -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 +130 -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 +23 -7
- package/dist/server/express.js +62 -32
- package/dist/server/express.js.map +1 -1
- package/dist/server/express.test.js +429 -73
- 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 +20 -3
- package/dist/server/index.js +17 -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 +41 -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 +51 -13
- package/dist/server/middleware.js +33 -0
- package/dist/server/middleware.js.map +1 -1
- package/dist/server/middleware.test-d.js +1 -1
- package/dist/server/middleware.test-d.js.map +1 -1
- package/dist/server/middleware.test.js +242 -131
- 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 +27 -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 +359 -89
- package/dist/server/server.js +488 -230
- 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 +86 -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 +2 -7
- 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 +43 -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 +88 -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 +176 -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/test/utils.d.ts +21 -31
- package/dist/test/utils.js +222 -198
- package/dist/test/utils.js.map +1 -1
- package/dist/test/view.test.d.ts +1 -0
- package/dist/test/view.test.js +540 -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 +10 -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 +6 -1
- 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 +0 -1
- 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 +18 -6
- 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 +15 -2
- package/dist/web/bridges/mcp-app/bridge.js +73 -7
- 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 +12 -0
- package/dist/web/bridges/mcp-app/use-mcp-app-context.js +12 -0
- 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 -1
- 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 +127 -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 +4 -3
- 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 +24 -23
- 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 +42 -29
- package/dist/web/data-llm.test.js.map +1 -1
- package/dist/web/generate-helpers.d.ts +39 -31
- package/dist/web/generate-helpers.js +36 -28
- 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 +14 -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 +15 -5
- 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 +12 -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 +26 -12
- 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 +6 -3
- package/dist/web/hooks/use-user.js.map +1 -1
- package/dist/web/hooks/use-user.test.js +85 -37
- 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 +1 -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-view.js +43 -0
- 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 +46 -26
- package/tsconfig.base.json +2 -0
- package/dist/server/templates/development.hbs +0 -12
- package/dist/server/templates/production.hbs +0 -6
- package/dist/server/widgetsDevServer.d.ts +0 -13
- package/dist/server/widgetsDevServer.js +0 -57
- package/dist/server/widgetsDevServer.js.map +0 -1
- package/dist/test/widget.test.js +0 -263
- 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 -75
- package/dist/web/bridges/apps-sdk/adaptor.js.map +0 -1
- package/dist/web/bridges/mcp-app/adaptor.d.ts +0 -38
- package/dist/web/bridges/mcp-app/adaptor.js +0 -184
- 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 -64
- 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 +0 -27
- 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.d.ts
CHANGED
|
@@ -1,45 +1,160 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import { McpServer as McpServerBase, type
|
|
3
|
-
import type
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
6
|
-
import type {
|
|
7
|
-
import
|
|
1
|
+
import type { McpUiToolMeta } from "@modelcontextprotocol/ext-apps";
|
|
2
|
+
import { type ContentBlock, type Implementation, McpServer as McpServerBase, type RequestMeta, type ServerOptions, type ServerResult, type StandardSchemaV1, type StandardSchemaWithJSON, type ToolAnnotations } from "@modelcontextprotocol/server";
|
|
3
|
+
import type express from "express";
|
|
4
|
+
import type { ResourceMetadataUrlResolver } from "./auth/setup.js";
|
|
5
|
+
import type { ExtraClaims } from "./auth.js";
|
|
6
|
+
import type { McpExtra, McpExtraFor, McpMethodString, McpMiddlewareEntry, McpMiddlewareFilter, McpMiddlewareFn, McpResultFor, McpTypedMiddlewareFn, McpWildcard } from "./middleware.js";
|
|
7
|
+
import { type SkillsManifest } from "./skills.js";
|
|
8
|
+
/**
|
|
9
|
+
* Type marker for a registered tool — carries its input, output, and response
|
|
10
|
+
* metadata shapes so views can infer types from `typeof server`.
|
|
11
|
+
*
|
|
12
|
+
* You normally never construct this by hand; it is produced by `registerTool`
|
|
13
|
+
* and consumed by helpers like {@link InferTools} and {@link generateHelpers}.
|
|
14
|
+
*/
|
|
8
15
|
export type ToolDef<TInput = unknown, TOutput = unknown, TResponseMetadata = unknown> = {
|
|
9
16
|
input: TInput;
|
|
10
17
|
output: TOutput;
|
|
11
18
|
responseMetadata: TResponseMetadata;
|
|
12
19
|
};
|
|
13
20
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
21
|
+
* Content Security Policy origins attached to a view's resource. Each list is
|
|
22
|
+
* passed through to the host's CSP for the view iframe; omit a field to inherit
|
|
23
|
+
* the host's default for that directive.
|
|
17
24
|
*/
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
25
|
+
export interface ViewCsp {
|
|
26
|
+
/** Origins for static assets (images, fonts, scripts, styles). */
|
|
27
|
+
resourceDomains?: string[];
|
|
28
|
+
/** Origins the view may contact via fetch/XHR. */
|
|
29
|
+
connectDomains?: string[];
|
|
30
|
+
/** Origins allowed for iframe embeds (opts into stricter app review). */
|
|
31
|
+
frameDomains?: string[];
|
|
32
|
+
/** Origins that can receive openExternal redirects without the safe-link modal. */
|
|
23
33
|
redirectDomains?: string[];
|
|
34
|
+
/** Origins allowed in `<base href>` tags (mcp-apps only). */
|
|
35
|
+
baseUriDomains?: string[];
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Registry of view component names. The Skybridge Vite plugin augments this
|
|
39
|
+
* interface in the generated `.skybridge/views.d.ts` with one key per view
|
|
40
|
+
* file, which narrows {@link ViewName} from `string` to the concrete union.
|
|
41
|
+
*/
|
|
42
|
+
export interface ViewNameRegistry {
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Resolve view component names from a registry: the union of its keys, or
|
|
46
|
+
* `string` when the registry is empty. The empty case happens before
|
|
47
|
+
* `.skybridge/views.d.ts` is generated; falling back to `string` keeps valid
|
|
48
|
+
* view names from erroring on a fresh checkout, and narrowing kicks in once
|
|
49
|
+
* the generated file augments the registry.
|
|
50
|
+
*/
|
|
51
|
+
export type ViewNameFor<Registry> = [keyof Registry & string] extends [never] ? string : keyof Registry & string;
|
|
52
|
+
/** Union of valid view component names. Narrowed by {@link ViewNameRegistry}. */
|
|
53
|
+
export type ViewName = ViewNameFor<ViewNameRegistry>;
|
|
54
|
+
/**
|
|
55
|
+
* Pass under `view` in a tool's `registerTool` config to render the tool's
|
|
56
|
+
* result through a Skybridge view instead of a plain text response.
|
|
57
|
+
*/
|
|
58
|
+
export interface ViewConfig {
|
|
59
|
+
/** Filename of the view module (without extension) — matches a file in your `viewsDir`. */
|
|
60
|
+
component: ViewName;
|
|
61
|
+
/** Human-readable label the host may show alongside the view. */
|
|
62
|
+
description?: string;
|
|
63
|
+
/** Request a visible border around the view (forwarded as `ui.prefersBorder`). */
|
|
64
|
+
prefersBorder?: boolean;
|
|
65
|
+
/** Override the iframe's served domain (advanced; forwarded as `ui.domain`). */
|
|
66
|
+
domain?: string;
|
|
67
|
+
/** Per-view CSP overrides — see {@link ViewCsp}. */
|
|
68
|
+
csp?: ViewCsp;
|
|
69
|
+
/** Free-form metadata forwarded on the view resource's `_meta`. */
|
|
70
|
+
_meta?: Record<string, unknown>;
|
|
71
|
+
}
|
|
72
|
+
export type SecurityScheme = {
|
|
73
|
+
type: "noauth";
|
|
74
|
+
} | {
|
|
75
|
+
type: "oauth2";
|
|
76
|
+
scopes?: string[];
|
|
24
77
|
};
|
|
25
|
-
/**
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
export type
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
|
|
78
|
+
/**
|
|
79
|
+
* Declarative per-tool auth. Enforced when the server has an `oauth` provider:
|
|
80
|
+
* anonymous or under-scoped calls are rejected before the handler runs. Omit
|
|
81
|
+
* `auth` entirely for the secure default (sign-in required, no specific scope).
|
|
82
|
+
*/
|
|
83
|
+
export type ToolAuth = {
|
|
84
|
+
/**
|
|
85
|
+
* When `true`, the tool is callable signed out; the token is still used when
|
|
86
|
+
* one is present. Omit (or `false`) to require sign-in.
|
|
87
|
+
*/
|
|
88
|
+
allowsAnonymous?: boolean;
|
|
89
|
+
/** OAuth scopes the caller's token must carry to invoke the tool. */
|
|
90
|
+
scopes?: string[];
|
|
38
91
|
};
|
|
39
|
-
|
|
92
|
+
/**
|
|
93
|
+
* Options forwarded to the built-in `express.json()` body parser. Derived
|
|
94
|
+
* from Express's own types so the public API doesn't depend on `body-parser`.
|
|
95
|
+
*/
|
|
96
|
+
export type JsonOptions = NonNullable<Parameters<typeof express.json>[0]>;
|
|
97
|
+
/**
|
|
98
|
+
* The Skybridge-specific options an {@link McpServer} is built with. A
|
|
99
|
+
* {@link Skybridge} app derives them from its config; pass them directly only
|
|
100
|
+
* when constructing an `McpServer` by hand.
|
|
101
|
+
*/
|
|
102
|
+
export interface SkybridgeServerOptions {
|
|
103
|
+
/** Whether an OAuth provider guards `/mcp`; enables per-tool scheme enforcement. */
|
|
104
|
+
oauth?: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* @experimental Serve Agent Skills from `src/skills` over MCP (SEP-2640).
|
|
107
|
+
* API may change.
|
|
108
|
+
*/
|
|
109
|
+
skills?: boolean;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Well-known keys recognized by host runtimes when set on a tool's `_meta`.
|
|
113
|
+
* Use {@link ToolMeta} to also pass arbitrary custom metadata alongside these.
|
|
114
|
+
*
|
|
115
|
+
* @see https://developers.openai.com/apps-sdk/reference#tool-descriptor-parameters
|
|
116
|
+
*/
|
|
117
|
+
export interface KnownToolMeta {
|
|
118
|
+
/** Apps SDK: allow the rendered view to call this tool from inside its iframe. */
|
|
119
|
+
"openai/widgetAccessible"?: boolean;
|
|
120
|
+
/** Apps SDK: status text shown while the tool is running (e.g. `"Searching trips"`). */
|
|
121
|
+
"openai/toolInvocation/invoking"?: string;
|
|
122
|
+
/** Apps SDK: status text shown once the tool returns (e.g. `"Found 3 trips"`). */
|
|
123
|
+
"openai/toolInvocation/invoked"?: string;
|
|
124
|
+
/** Apps SDK: input parameters that hold file references — the host attaches uploaded files to them. */
|
|
125
|
+
"openai/fileParams"?: string[];
|
|
126
|
+
/** MCP Apps: control whether the tool is exposed to the model, the app, or both. */
|
|
127
|
+
ui?: Pick<McpUiToolMeta, "visibility">;
|
|
128
|
+
}
|
|
129
|
+
/** {@link KnownToolMeta} merged with arbitrary string-keyed metadata for custom flags. */
|
|
130
|
+
export type ToolMeta = KnownToolMeta & Record<string, unknown>;
|
|
131
|
+
/**
|
|
132
|
+
* Convenient return type for tool handlers — a plain string, a single
|
|
133
|
+
* {@link ContentBlock}, or an array. Skybridge normalizes it to the MCP
|
|
134
|
+
* `content: ContentBlock[]` shape before responding.
|
|
135
|
+
*/
|
|
136
|
+
export type HandlerContent = string | ContentBlock | ContentBlock[];
|
|
137
|
+
/**
|
|
138
|
+
* Type-level marker interface for cross-package type inference.
|
|
139
|
+
*
|
|
140
|
+
* Consumers infer tool types via the structural `$types` property rather than
|
|
141
|
+
* the `McpServer` class generic, because class-generic inference breaks when
|
|
142
|
+
* `McpServer` comes from different package installations (e.g. a consumer
|
|
143
|
+
* with its own `skybridge` dep vs. the in-tree workspace version).
|
|
144
|
+
*
|
|
145
|
+
* Inspired by tRPC's `_def` pattern and Hono's type markers.
|
|
146
|
+
*/
|
|
147
|
+
export interface McpServerTypes<TTools extends Record<string, ToolDef>> {
|
|
148
|
+
readonly tools: TTools;
|
|
149
|
+
}
|
|
40
150
|
type Simplify<T> = {
|
|
41
151
|
[K in keyof T]: T[K];
|
|
42
152
|
};
|
|
153
|
+
type ShapeOutput<Shape extends Record<string, StandardSchemaWithJSON>> = Simplify<{
|
|
154
|
+
[K in keyof Shape as undefined extends StandardSchemaV1.InferOutput<Shape[K]> ? never : K]: StandardSchemaV1.InferOutput<Shape[K]>;
|
|
155
|
+
} & {
|
|
156
|
+
[K in keyof Shape as undefined extends StandardSchemaV1.InferOutput<Shape[K]> ? K : never]?: StandardSchemaV1.InferOutput<Shape[K]>;
|
|
157
|
+
}>;
|
|
43
158
|
type ExtractStructuredContent<T> = T extends {
|
|
44
159
|
structuredContent: infer SC;
|
|
45
160
|
} ? Simplify<SC> : never;
|
|
@@ -50,62 +165,169 @@ type ExtractMeta<T> = [Extract<T, {
|
|
|
50
165
|
}> extends {
|
|
51
166
|
_meta: infer M;
|
|
52
167
|
} ? Simplify<M> : unknown;
|
|
53
|
-
|
|
54
|
-
* Type-level marker interface for cross-package type inference.
|
|
55
|
-
* This enables TypeScript to infer tool types across package boundaries
|
|
56
|
-
* using structural typing on the $types property, rather than relying on
|
|
57
|
-
* class generic inference which fails when McpServer comes from different
|
|
58
|
-
* package installations.
|
|
59
|
-
*
|
|
60
|
-
* Inspired by tRPC's _def pattern and Hono's type markers.
|
|
61
|
-
*/
|
|
62
|
-
export interface McpServerTypes<TTools extends Record<string, ToolDef>> {
|
|
63
|
-
readonly tools: TTools;
|
|
64
|
-
}
|
|
65
|
-
type ShapeOutput<Shape extends ZodRawShapeCompat> = Simplify<{
|
|
66
|
-
[K in keyof Shape as undefined extends SchemaOutput<Shape[K]> ? never : K]: SchemaOutput<Shape[K]>;
|
|
67
|
-
} & {
|
|
68
|
-
[K in keyof Shape as undefined extends SchemaOutput<Shape[K]> ? K : never]?: SchemaOutput<Shape[K]>;
|
|
69
|
-
}>;
|
|
70
|
-
type AddTool<TTools, TName extends string, TInput extends ZodRawShapeCompat, TOutput, TResponseMetadata = unknown> = McpServer<TTools & {
|
|
168
|
+
type AddTool<TTools, TName extends string, TInput extends Record<string, StandardSchemaWithJSON>, TOutput, TResponseMetadata = unknown, TAuthExtra extends ExtraClaims = ExtraClaims> = McpServer<TTools & {
|
|
71
169
|
[K in TName]: ToolDef<ShapeOutput<TInput>, TOutput, TResponseMetadata>;
|
|
72
|
-
}>;
|
|
73
|
-
|
|
170
|
+
}, TAuthExtra>;
|
|
171
|
+
interface ToolConfigBase<TInput extends Record<string, StandardSchemaWithJSON> | StandardSchemaWithJSON> {
|
|
172
|
+
name: string;
|
|
74
173
|
title?: string;
|
|
75
174
|
description?: string;
|
|
76
175
|
inputSchema?: TInput;
|
|
77
|
-
outputSchema?:
|
|
176
|
+
outputSchema?: Record<string, StandardSchemaWithJSON> | StandardSchemaWithJSON;
|
|
78
177
|
annotations?: ToolAnnotations;
|
|
79
|
-
|
|
178
|
+
view?: ViewConfig;
|
|
179
|
+
_meta?: ToolMeta;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* The auth face of a tool config: either the high-level `auth` shorthand or the
|
|
183
|
+
* low-level `securitySchemes` escape hatch, never both.
|
|
184
|
+
*/
|
|
185
|
+
type ToolAuthConfig = {
|
|
186
|
+
auth?: ToolAuth;
|
|
187
|
+
securitySchemes?: never;
|
|
188
|
+
} | {
|
|
189
|
+
auth?: never;
|
|
190
|
+
/**
|
|
191
|
+
* Declares which auth schemes this tool supports (e.g. `noauth`, `oauth2`).
|
|
192
|
+
* Lets clients label tools that require sign-in before calling, and pass
|
|
193
|
+
* the right scopes through the OAuth flow. Listing both `noauth` and
|
|
194
|
+
* `oauth2` signals that the tool works for anonymous callers and gives
|
|
195
|
+
* enhanced behavior to authenticated ones.
|
|
196
|
+
*/
|
|
197
|
+
securitySchemes?: SecurityScheme[];
|
|
80
198
|
};
|
|
81
|
-
type
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
199
|
+
type ToolConfig<TInput extends Record<string, StandardSchemaWithJSON> | StandardSchemaWithJSON> = ToolConfigBase<TInput> & ToolAuthConfig;
|
|
200
|
+
/**
|
|
201
|
+
* Optional client-supplied hints attached to `params._meta` on every tool call
|
|
202
|
+
* by the Apps SDK host. Hints only: never use for authorization, and tolerate
|
|
203
|
+
* absence.
|
|
204
|
+
* @see https://developers.openai.com/apps-sdk/reference#_meta-fields-the-client-provides
|
|
205
|
+
*/
|
|
206
|
+
export interface ClientHintsMeta {
|
|
207
|
+
/** Requested locale (BCP-47, e.g. `"en-US"`). */
|
|
208
|
+
"openai/locale"?: string;
|
|
209
|
+
/** Browser user-agent */
|
|
210
|
+
"openai/userAgent"?: string;
|
|
211
|
+
/** Coarse user location. May be partially populated. */
|
|
212
|
+
"openai/userLocation"?: {
|
|
213
|
+
city?: string;
|
|
214
|
+
region?: string;
|
|
215
|
+
country?: string;
|
|
216
|
+
timezone?: string;
|
|
217
|
+
longitude?: number;
|
|
218
|
+
latitude?: number;
|
|
219
|
+
};
|
|
220
|
+
/** Anonymized user id. */
|
|
221
|
+
"openai/subject"?: string;
|
|
222
|
+
/** Anonymized conversation id, stable within a ChatGPT session. */
|
|
223
|
+
"openai/session"?: string;
|
|
224
|
+
/** Anonymized organization id, when the user account is part of an organization. */
|
|
225
|
+
"openai/organization"?: string;
|
|
226
|
+
/** Stable id for the currently mounted widget instance. */
|
|
227
|
+
"openai/widgetSessionId"?: string;
|
|
228
|
+
}
|
|
229
|
+
type ToolHandlerExtra<TAuthExtra extends ExtraClaims = ExtraClaims> = Omit<McpExtra<TAuthExtra>, "mcpReq"> & {
|
|
230
|
+
mcpReq: Omit<McpExtra<TAuthExtra>["mcpReq"], "_meta"> & {
|
|
231
|
+
_meta?: RequestMeta & ClientHintsMeta;
|
|
232
|
+
};
|
|
233
|
+
};
|
|
234
|
+
type ToolHandler<TInput extends Record<string, StandardSchemaWithJSON>, TReturn extends {
|
|
235
|
+
content?: HandlerContent;
|
|
236
|
+
} = {
|
|
237
|
+
content?: HandlerContent;
|
|
238
|
+
}, TAuthExtra extends ExtraClaims = ExtraClaims> = (args: ShapeOutput<TInput>, extra: ToolHandlerExtra<TAuthExtra>) => TReturn | Promise<TReturn>;
|
|
239
|
+
/**
|
|
240
|
+
* Coerce a tool handler's return value into an MCP `content` array. Strings
|
|
241
|
+
* become a single `TextContent`; a single block is wrapped in an array;
|
|
242
|
+
* `undefined` produces `[]`. Mostly used internally — exported so consumers
|
|
243
|
+
* who build content lazily can apply the same normalization.
|
|
244
|
+
*/
|
|
245
|
+
export declare function normalizeContent(content: HandlerContent | undefined): ContentBlock[];
|
|
246
|
+
interface McpServerBaseOmitted extends Omit<McpServerBase, "registerTool" | "connect"> {
|
|
247
|
+
}
|
|
248
|
+
declare const McpServerBaseOmitted: new (...args: ConstructorParameters<typeof McpServerBase>) => McpServerBaseOmitted;
|
|
249
|
+
/**
|
|
250
|
+
* Prime the build-time Vite manifest before user code constructs its
|
|
251
|
+
* `McpServer`. Called from the generated `dist/__entry.js`; not part of the
|
|
252
|
+
* user-facing API.
|
|
253
|
+
*
|
|
254
|
+
* @internal
|
|
255
|
+
*/
|
|
256
|
+
export declare function __setBuildManifest(manifest: Record<string, {
|
|
257
|
+
file: string;
|
|
258
|
+
}>): void;
|
|
259
|
+
export declare function __setSkillsManifest(manifest: SkillsManifest): void;
|
|
260
|
+
/**
|
|
261
|
+
* Typed registration sugar over the MCP SDK's `McpServer`: a tool registry
|
|
262
|
+
* that carries input/output/meta shapes, view resources, per-tool security
|
|
263
|
+
* schemes, and prompt/resource registration. A {@link Skybridge} app builds
|
|
264
|
+
* one of these per request and hands it to your `handler`; chain
|
|
265
|
+
* {@link McpServer.registerTool} calls on it and return the result.
|
|
266
|
+
*
|
|
267
|
+
* The `TTools` generic accumulates each registered tool's input/output/meta
|
|
268
|
+
* shape, so `typeof app` carries enough information for view-side helpers
|
|
269
|
+
* like {@link generateHelpers} to produce fully-typed hooks.
|
|
270
|
+
*
|
|
271
|
+
* @typeParam TTools - Accumulated tool registry. Filled in by `registerTool`
|
|
272
|
+
* chaining; you almost never set this manually.
|
|
273
|
+
*
|
|
274
|
+
* @example
|
|
275
|
+
* ```ts
|
|
276
|
+
* export const app = new Skybridge({
|
|
277
|
+
* name: "my-app",
|
|
278
|
+
* version: "1.0.0",
|
|
279
|
+
* handler: (server) =>
|
|
280
|
+
* server.registerTool({
|
|
281
|
+
* name: "search",
|
|
282
|
+
* inputSchema: { query: z.string() },
|
|
283
|
+
* view: { component: "search" },
|
|
284
|
+
* }, async ({ query }) => ({ content: `Results for ${query}` })),
|
|
285
|
+
* });
|
|
286
|
+
* ```
|
|
287
|
+
*
|
|
288
|
+
* @see https://docs.skybridge.tech/api-reference/mcp-server
|
|
289
|
+
*/
|
|
290
|
+
export declare class McpServer<TTools extends Record<string, ToolDef> = Record<never, ToolDef>, TAuthExtra extends ExtraClaims = ExtraClaims> extends McpServerBaseOmitted {
|
|
85
291
|
readonly $types: McpServerTypes<TTools>;
|
|
86
|
-
private
|
|
87
|
-
private
|
|
88
|
-
private customErrorMiddleware;
|
|
89
|
-
private mcpMiddlewareEntries;
|
|
90
|
-
private mcpMiddlewareApplied;
|
|
91
|
-
use(...handlers: RequestHandler[]): this;
|
|
92
|
-
use(path: string, ...handlers: RequestHandler[]): this;
|
|
93
|
-
useOnError(...handlers: ErrorRequestHandler[]): this;
|
|
94
|
-
useOnError(path: string, ...handlers: ErrorRequestHandler[]): this;
|
|
292
|
+
private claimedViews;
|
|
293
|
+
private viewMetaBuilders;
|
|
95
294
|
/**
|
|
96
|
-
*
|
|
295
|
+
* Maps a view resource's query-less path to its canonical registered URI
|
|
296
|
+
* (the one carrying the `?v=` cache key). Lets `resources/read` resolve the
|
|
297
|
+
* underlying view no matter which version param the consumer sends, since
|
|
298
|
+
* the param is only a cache key, not part of the resource's identity.
|
|
97
299
|
*/
|
|
98
|
-
|
|
300
|
+
private viewUriByPath;
|
|
301
|
+
private viteManifest;
|
|
302
|
+
private oauthEnabled;
|
|
303
|
+
private resolveResourceMetadataUrl?;
|
|
304
|
+
private readonly toolSecuritySchemes;
|
|
305
|
+
private readonly userMiddlewareEntries;
|
|
306
|
+
constructor(serverInfo: Implementation, options?: ServerOptions, skybridgeOptions?: SkybridgeServerOptions);
|
|
99
307
|
/**
|
|
100
|
-
*
|
|
308
|
+
* The per-tool security schemes collected during registration, keyed by tool
|
|
309
|
+
* name. Read by the OAuth layer to decide whether anonymous requests are
|
|
310
|
+
* allowed and which schemes gate a given `tools/call`.
|
|
311
|
+
*
|
|
312
|
+
* @internal
|
|
101
313
|
*/
|
|
314
|
+
get securitySchemesByTool(): ReadonlyMap<string, SecurityScheme[] | undefined>;
|
|
315
|
+
/**
|
|
316
|
+
* Inject the resolver the app uses to build the protected-resource metadata
|
|
317
|
+
* URL, so tool handlers can emit in-band auth challenges.
|
|
318
|
+
*
|
|
319
|
+
* @internal
|
|
320
|
+
*/
|
|
321
|
+
setResourceMetadataUrlResolver(resolve: ResourceMetadataUrlResolver): this;
|
|
322
|
+
private setupSkills;
|
|
323
|
+
/** Register MCP protocol-level middleware (catch-all). */
|
|
324
|
+
mcpMiddleware(handler: McpMiddlewareFn<TAuthExtra>): this;
|
|
325
|
+
/** Register MCP protocol-level middleware for all requests (`extra` is `McpExtra`). */
|
|
102
326
|
mcpMiddleware(filter: "request", handler: (request: {
|
|
103
327
|
method: string;
|
|
104
328
|
params: Record<string, unknown>;
|
|
105
|
-
}, extra: McpExtra
|
|
106
|
-
/**
|
|
107
|
-
* Register MCP protocol-level middleware for all notifications (`extra` is `undefined`).
|
|
108
|
-
*/
|
|
329
|
+
}, extra: McpExtra<TAuthExtra>, next: () => Promise<ServerResult>) => Promise<unknown> | unknown): this;
|
|
330
|
+
/** Register MCP protocol-level middleware for all notifications (`extra` is `undefined`). */
|
|
109
331
|
mcpMiddleware(filter: "notification", handler: (request: {
|
|
110
332
|
method: string;
|
|
111
333
|
params: Record<string, unknown>;
|
|
@@ -114,7 +336,7 @@ export declare class McpServer<TTools extends Record<string, ToolDef> = Record<n
|
|
|
114
336
|
* Register MCP protocol-level middleware for an exact method.
|
|
115
337
|
* Narrows `params`, `extra`, and `next()` result based on the method string.
|
|
116
338
|
*/
|
|
117
|
-
mcpMiddleware<M extends McpMethodString>(filter: M, handler: McpTypedMiddlewareFn<M>): this;
|
|
339
|
+
mcpMiddleware<M extends McpMethodString>(filter: M, handler: McpTypedMiddlewareFn<M, TAuthExtra>): this;
|
|
118
340
|
/**
|
|
119
341
|
* Register MCP protocol-level middleware for a wildcard pattern (e.g. `"tools/*"`).
|
|
120
342
|
* `next()` returns the union of result types for matching methods.
|
|
@@ -122,29 +344,77 @@ export declare class McpServer<TTools extends Record<string, ToolDef> = Record<n
|
|
|
122
344
|
mcpMiddleware<W extends McpWildcard>(filter: W, handler: (request: {
|
|
123
345
|
method: string;
|
|
124
346
|
params: Record<string, unknown>;
|
|
125
|
-
}, extra: McpExtraFor<W>, next: () => Promise<McpResultFor<W>>) => Promise<unknown> | unknown): this;
|
|
347
|
+
}, extra: McpExtraFor<W, TAuthExtra>, next: () => Promise<McpResultFor<W>>) => Promise<unknown> | unknown): this;
|
|
126
348
|
/**
|
|
127
349
|
* Register MCP protocol-level middleware with a method filter.
|
|
128
350
|
* Filter can be an exact method (`"tools/call"`), wildcard (`"tools/*"`),
|
|
129
351
|
* category (`"request"` | `"notification"`), or an array of those.
|
|
130
352
|
*/
|
|
131
|
-
mcpMiddleware(filter: McpMiddlewareFilter, handler: McpMiddlewareFn): this;
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
private
|
|
353
|
+
mcpMiddleware(filter: McpMiddlewareFilter, handler: McpMiddlewareFn<TAuthExtra>): this;
|
|
354
|
+
/**
|
|
355
|
+
* This instance's protocol-level middleware: the framework's own entries
|
|
356
|
+
* (view `_meta` on `resources/list`, version-agnostic view resolution on
|
|
357
|
+
* `resources/read`, the top-level `securitySchemes` mirror on `tools/list`)
|
|
358
|
+
* followed by the ones registered via {@link McpServer.mcpMiddleware}.
|
|
359
|
+
*
|
|
360
|
+
* @internal
|
|
361
|
+
*/
|
|
362
|
+
protocolMiddlewareEntries(): McpMiddlewareEntry[];
|
|
363
|
+
private enforceOneToolPerView;
|
|
364
|
+
private resolveViewRequestContext;
|
|
365
|
+
private registerViewResources;
|
|
366
|
+
private registerViewResource;
|
|
367
|
+
private serveLegacyAppsSdkUrl;
|
|
368
|
+
private decorateToolHandler;
|
|
369
|
+
private computeViewVersionParam;
|
|
370
|
+
private lookupViewFile;
|
|
146
371
|
private lookupDistFile;
|
|
147
|
-
|
|
372
|
+
/**
|
|
373
|
+
* Inject the Vite manifest as a value rather than letting `readManifest()`
|
|
374
|
+
* load it from disk. Required for runtimes without a usable filesystem
|
|
375
|
+
* (Cloudflare Workers, etc.) — the user's `skybridge build` emits the
|
|
376
|
+
* manifest as a JS module which the entry imports and passes here.
|
|
377
|
+
*/
|
|
378
|
+
setViteManifest(manifest: Record<string, {
|
|
379
|
+
file: string;
|
|
380
|
+
}>): this;
|
|
148
381
|
private readManifest;
|
|
382
|
+
/**
|
|
383
|
+
* Register a tool. Pass a `config` describing the tool (name, schemas,
|
|
384
|
+
* optional {@link ViewConfig}, optional {@link ToolMeta}) and a handler that
|
|
385
|
+
* returns the tool's result.
|
|
386
|
+
*
|
|
387
|
+
* Chain calls to build up a server: each call returns a new `McpServer`
|
|
388
|
+
* type that captures the tool's input/output/`_meta` shape so the
|
|
389
|
+
* resulting `typeof server` can drive {@link generateHelpers}.
|
|
390
|
+
*
|
|
391
|
+
* The handler's return shape determines the output types: the
|
|
392
|
+
* `structuredContent` field becomes the tool's typed output, and `_meta`
|
|
393
|
+
* becomes its `responseMetadata`. The `content` field is normalized through
|
|
394
|
+
* {@link normalizeContent}.
|
|
395
|
+
*
|
|
396
|
+
* @example
|
|
397
|
+
* ```ts
|
|
398
|
+
* server.registerTool({
|
|
399
|
+
* name: "search",
|
|
400
|
+
* inputSchema: { query: z.string() },
|
|
401
|
+
* outputSchema: { results: z.array(z.string()) },
|
|
402
|
+
* view: { component: "search" },
|
|
403
|
+
* }, async ({ query }) => ({
|
|
404
|
+
* content: `Found results for ${query}`,
|
|
405
|
+
* structuredContent: { results: [...] },
|
|
406
|
+
* }));
|
|
407
|
+
* ```
|
|
408
|
+
*
|
|
409
|
+
* @see https://docs.skybridge.tech/api-reference/register-tool
|
|
410
|
+
*/
|
|
411
|
+
registerTool<TName extends string, InputArgs extends Record<string, StandardSchemaWithJSON>, TReturn extends {
|
|
412
|
+
content?: HandlerContent;
|
|
413
|
+
}>(config: ToolConfig<InputArgs> & {
|
|
414
|
+
name: TName;
|
|
415
|
+
}, cb: ToolHandler<InputArgs, TReturn, TAuthExtra>): AddTool<TTools, TName, InputArgs, ExtractStructuredContent<TReturn>, ExtractMeta<TReturn>, TAuthExtra>;
|
|
416
|
+
registerTool<InputArgs extends Record<string, StandardSchemaWithJSON>>(config: ToolConfig<InputArgs>, cb: ToolHandler<InputArgs, {
|
|
417
|
+
content?: HandlerContent;
|
|
418
|
+
}, TAuthExtra>): this;
|
|
149
419
|
}
|
|
150
420
|
export {};
|