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