skybridge 0.0.0-dev.ecf87cf → 0.0.0-dev.ed005a8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +155 -0
- package/bin/run.js +5 -0
- 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 +49 -0
- package/dist/cli/detect-port.js.map +1 -0
- package/dist/cli/header.d.ts +4 -0
- package/dist/cli/header.js +6 -0
- package/dist/cli/header.js.map +1 -0
- 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.d.ts +2 -0
- package/dist/cli/run-command.js +43 -0
- package/dist/cli/run-command.js.map +1 -0
- 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.d.ts +7 -0
- package/dist/cli/telemetry.js +123 -0
- 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.map +1 -0
- package/dist/cli/use-execute-steps.d.ts +11 -0
- package/dist/cli/use-execute-steps.js +36 -0
- package/dist/cli/use-execute-steps.js.map +1 -0
- 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 +92 -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 +6 -0
- package/dist/commands/build.js +31 -0
- package/dist/commands/build.js.map +1 -0
- 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 +13 -0
- package/dist/commands/dev.js +128 -0
- package/dist/commands/dev.js.map +1 -0
- package/dist/commands/start.d.ts +9 -0
- package/dist/commands/start.js +55 -0
- package/dist/commands/start.js.map +1 -0
- package/dist/commands/telemetry/disable.d.ts +5 -0
- package/dist/commands/telemetry/disable.js +14 -0
- package/dist/commands/telemetry/disable.js.map +1 -0
- package/dist/commands/telemetry/enable.d.ts +5 -0
- package/dist/commands/telemetry/enable.js +14 -0
- package/dist/commands/telemetry/enable.js.map +1 -0
- package/dist/commands/telemetry/status.d.ts +5 -0
- package/dist/commands/telemetry/status.js +14 -0
- package/dist/commands/telemetry/status.js.map +1 -0
- 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.js +97 -0
- package/dist/server/app.test.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.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.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.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.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.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.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.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.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.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.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.js +149 -0
- package/dist/server/auth/verify.test.js.map +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.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 +31 -0
- package/dist/server/express.js +107 -0
- package/dist/server/express.js.map +1 -0
- package/dist/server/express.test.d.ts +1 -0
- package/dist/server/express.test.js +608 -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 +22 -0
- package/dist/server/index.js +18 -0
- package/dist/server/index.js.map +1 -0
- package/dist/{src/server → server}/inferUtilityTypes.d.ts +6 -6
- package/dist/server/inferUtilityTypes.js.map +1 -0
- 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 +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 +601 -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 +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 +420 -0
- package/dist/server/server.js +546 -0
- package/dist/server/server.js.map +1 -0
- 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/{src/server → server}/templateHelper.d.ts +2 -7
- package/dist/server/templateHelper.js +11 -0
- package/dist/server/templateHelper.js.map +1 -0
- 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/{src/test → test}/utils.d.ts +21 -31
- package/dist/test/utils.js +266 -0
- package/dist/test/utils.js.map +1 -0
- 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 +15 -0
- package/dist/web/bridges/apps-sdk/bridge.js +58 -0
- package/dist/web/bridges/apps-sdk/bridge.js.map +1 -0
- package/dist/web/bridges/apps-sdk/index.d.ts +4 -0
- package/dist/web/bridges/apps-sdk/index.js +4 -0
- package/dist/web/bridges/apps-sdk/index.js.map +1 -0
- package/dist/web/bridges/apps-sdk/types.d.ts +133 -0
- package/dist/{src/web → web/bridges/apps-sdk}/types.js +0 -1
- package/dist/web/bridges/apps-sdk/types.js.map +1 -0
- package/dist/web/bridges/apps-sdk/use-apps-sdk-context.d.ts +13 -0
- package/dist/web/bridges/apps-sdk/use-apps-sdk-context.js +18 -0
- package/dist/web/bridges/apps-sdk/use-apps-sdk-context.js.map +1 -0
- package/dist/web/bridges/get-adaptor.d.ts +9 -0
- package/dist/web/bridges/get-adaptor.js +10 -0
- package/dist/web/bridges/get-adaptor.js.map +1 -0
- 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.d.ts +5 -0
- package/dist/web/bridges/index.js +6 -0
- package/dist/web/bridges/index.js.map +1 -0
- package/dist/web/bridges/mcp-app/bridge.d.ts +39 -0
- package/dist/web/bridges/mcp-app/bridge.js +168 -0
- package/dist/web/bridges/mcp-app/bridge.js.map +1 -0
- 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 +3 -0
- package/dist/web/bridges/mcp-app/index.js +3 -0
- package/dist/web/bridges/mcp-app/index.js.map +1 -0
- package/dist/web/bridges/mcp-app/types.d.ts +10 -0
- package/dist/web/bridges/mcp-app/types.js +2 -0
- package/dist/web/bridges/mcp-app/types.js.map +1 -0
- package/dist/web/bridges/mcp-app/use-mcp-app-context.d.ts +19 -0
- package/dist/web/bridges/mcp-app/use-mcp-app-context.js +19 -0
- package/dist/web/bridges/mcp-app/use-mcp-app-context.js.map +1 -0
- package/dist/web/bridges/mcp-app/use-mcp-app-context.test.d.ts +1 -0
- package/dist/web/bridges/mcp-app/use-mcp-app-context.test.js +26 -0
- package/dist/web/bridges/mcp-app/use-mcp-app-context.test.js.map +1 -0
- 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 +219 -0
- package/dist/web/bridges/types.js +15 -0
- package/dist/web/bridges/types.js.map +1 -0
- 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 +7 -0
- package/dist/web/bridges/use-host-context.js +13 -0
- package/dist/web/bridges/use-host-context.js.map +1 -0
- 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 +29 -0
- package/dist/web/create-store.js +64 -0
- package/dist/web/create-store.js.map +1 -0
- package/dist/web/create-store.test.d.ts +1 -0
- package/dist/web/create-store.test.js +132 -0
- package/dist/web/create-store.test.js.map +1 -0
- package/dist/web/data-llm.d.ts +47 -0
- package/dist/{src/web → web}/data-llm.js +39 -7
- package/dist/web/data-llm.js.map +1 -0
- package/dist/web/data-llm.test.d.ts +1 -0
- package/dist/web/data-llm.test.js +155 -0
- package/dist/web/data-llm.test.js.map +1 -0
- package/dist/{src/web → web}/generate-helpers.d.ts +41 -32
- package/dist/{src/web → web}/generate-helpers.js +36 -28
- package/dist/web/generate-helpers.js.map +1 -0
- package/dist/web/generate-helpers.test-d.d.ts +1 -0
- package/dist/{src/web → web}/generate-helpers.test-d.js +35 -30
- package/dist/web/generate-helpers.test-d.js.map +1 -0
- package/dist/web/generate-helpers.test.d.ts +1 -0
- package/dist/{src/web → web}/generate-helpers.test.js +2 -2
- package/dist/web/generate-helpers.test.js.map +1 -0
- package/dist/{src/web → web}/helpers/state.d.ts +2 -2
- package/dist/web/helpers/state.js +45 -0
- package/dist/web/helpers/state.js.map +1 -0
- package/dist/web/helpers/state.test.d.ts +1 -0
- package/dist/{src/web → web}/helpers/state.test.js +9 -9
- package/dist/web/helpers/state.test.js.map +1 -0
- package/dist/web/hooks/index.d.ts +16 -0
- package/dist/web/hooks/index.js +17 -0
- package/dist/web/hooks/index.js.map +1 -0
- package/dist/web/hooks/test/utils.d.ts +21 -0
- package/dist/web/hooks/test/utils.js +75 -0
- package/dist/web/hooks/test/utils.js.map +1 -0
- package/dist/{src/web → web}/hooks/use-call-tool.d.ts +47 -1
- package/dist/web/hooks/use-call-tool.js +96 -0
- package/dist/web/hooks/use-call-tool.js.map +1 -0
- package/dist/web/hooks/use-call-tool.test-d.d.ts +1 -0
- package/dist/web/hooks/use-call-tool.test-d.js.map +1 -0
- package/dist/web/hooks/use-call-tool.test.d.ts +1 -0
- package/dist/{src/web → web}/hooks/use-call-tool.test.js +84 -24
- package/dist/web/hooks/use-call-tool.test.js.map +1 -0
- package/dist/web/hooks/use-display-mode.d.ts +24 -0
- package/dist/web/hooks/use-display-mode.js +29 -0
- package/dist/web/hooks/use-display-mode.js.map +1 -0
- 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.d.ts +1 -0
- package/dist/web/hooks/use-display-mode.test.js +77 -0
- package/dist/web/hooks/use-display-mode.test.js.map +1 -0
- 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 +39 -0
- package/dist/web/hooks/use-files.js +42 -0
- package/dist/web/hooks/use-files.js.map +1 -0
- package/dist/web/hooks/use-files.test.d.ts +1 -0
- package/dist/web/hooks/use-files.test.js +62 -0
- package/dist/web/hooks/use-files.test.js.map +1 -0
- 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 -0
- package/dist/web/hooks/use-open-external.js +24 -0
- package/dist/web/hooks/use-open-external.js.map +1 -0
- package/dist/web/hooks/use-open-external.test.d.ts +1 -0
- package/dist/web/hooks/use-open-external.test.js +75 -0
- package/dist/web/hooks/use-open-external.test.js.map +1 -0
- 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 +24 -0
- package/dist/web/hooks/use-request-modal.js +31 -0
- package/dist/web/hooks/use-request-modal.js.map +1 -0
- package/dist/web/hooks/use-request-modal.test.d.ts +1 -0
- package/dist/{src/web → web}/hooks/use-request-modal.test.js +16 -2
- package/dist/web/hooks/use-request-modal.test.js.map +1 -0
- 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 -0
- package/dist/web/hooks/use-send-follow-up-message.js +25 -0
- package/dist/web/hooks/use-send-follow-up-message.js.map +1 -0
- 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 +57 -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 +68 -0
- package/dist/web/hooks/use-tool-info.js +48 -0
- package/dist/web/hooks/use-tool-info.js.map +1 -0
- package/dist/web/hooks/use-tool-info.test-d.d.ts +1 -0
- package/dist/{src/web → web}/hooks/use-tool-info.test-d.js +19 -6
- package/dist/web/hooks/use-tool-info.test-d.js.map +1 -0
- package/dist/web/hooks/use-tool-info.test.d.ts +1 -0
- package/dist/web/hooks/use-tool-info.test.js +135 -0
- package/dist/web/hooks/use-tool-info.test.js.map +1 -0
- package/dist/{src/web → web}/hooks/use-user.d.ts +5 -2
- package/dist/web/hooks/use-user.js +38 -0
- package/dist/web/hooks/use-user.js.map +1 -0
- package/dist/web/hooks/use-user.test.d.ts +1 -0
- package/dist/web/hooks/use-user.test.js +170 -0
- package/dist/web/hooks/use-user.test.js.map +1 -0
- 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/{src/web → web}/index.d.ts +1 -2
- package/dist/{src/web → web}/index.js +1 -2
- package/dist/web/index.js.map +1 -0
- 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/{src/web → web}/proxy.js +0 -1
- package/dist/web/proxy.js.map +1 -0
- package/dist/web/types.d.ts +20 -0
- package/dist/web/types.js +2 -0
- package/dist/web/types.js.map +1 -0
- package/package.json +86 -41
- package/tsconfig.base.json +33 -0
- package/dist/src/server/devtoolsStaticServer.d.ts +0 -15
- package/dist/src/server/devtoolsStaticServer.js +0 -38
- package/dist/src/server/devtoolsStaticServer.js.map +0 -1
- package/dist/src/server/index.d.ts +0 -5
- package/dist/src/server/index.js +0 -4
- package/dist/src/server/index.js.map +0 -1
- package/dist/src/server/inferUtilityTypes.js.map +0 -1
- package/dist/src/server/server.d.ts +0 -74
- package/dist/src/server/server.js +0 -82
- package/dist/src/server/server.js.map +0 -1
- package/dist/src/server/templateHelper.js +0 -30
- package/dist/src/server/templateHelper.js.map +0 -1
- package/dist/src/server/templates/development.hbs +0 -13
- package/dist/src/server/templates/production.hbs +0 -7
- package/dist/src/server/widgetsDevServer.d.ts +0 -12
- package/dist/src/server/widgetsDevServer.js +0 -39
- package/dist/src/server/widgetsDevServer.js.map +0 -1
- package/dist/src/test/utils.js +0 -242
- package/dist/src/test/utils.js.map +0 -1
- package/dist/src/test/widget.test.js +0 -146
- package/dist/src/test/widget.test.js.map +0 -1
- package/dist/src/web/bridges/apps-sdk-adapter.d.ts +0 -2
- package/dist/src/web/bridges/apps-sdk-adapter.js +0 -4
- package/dist/src/web/bridges/apps-sdk-adapter.js.map +0 -1
- package/dist/src/web/bridges/apps-sdk-bridge.d.ts +0 -8
- package/dist/src/web/bridges/apps-sdk-bridge.js +0 -41
- package/dist/src/web/bridges/apps-sdk-bridge.js.map +0 -1
- package/dist/src/web/bridges/get-bridge-methods.d.ts +0 -2
- package/dist/src/web/bridges/get-bridge-methods.js +0 -8
- package/dist/src/web/bridges/get-bridge-methods.js.map +0 -1
- package/dist/src/web/bridges/hooks/use-apps-sdk-bridge.d.ts +0 -2
- package/dist/src/web/bridges/hooks/use-apps-sdk-bridge.js +0 -7
- package/dist/src/web/bridges/hooks/use-apps-sdk-bridge.js.map +0 -1
- package/dist/src/web/bridges/hooks/use-bridge.d.ts +0 -2
- package/dist/src/web/bridges/hooks/use-bridge.js +0 -90
- package/dist/src/web/bridges/hooks/use-bridge.js.map +0 -1
- package/dist/src/web/bridges/hooks/use-mcp-app-bridge.d.ts +0 -4
- package/dist/src/web/bridges/hooks/use-mcp-app-bridge.js +0 -7
- package/dist/src/web/bridges/hooks/use-mcp-app-bridge.js.map +0 -1
- package/dist/src/web/bridges/hooks/use-mcp-app-bridge.test.js +0 -58
- package/dist/src/web/bridges/hooks/use-mcp-app-bridge.test.js.map +0 -1
- package/dist/src/web/bridges/index.d.ts +0 -4
- package/dist/src/web/bridges/index.js +0 -5
- package/dist/src/web/bridges/index.js.map +0 -1
- package/dist/src/web/bridges/mcp-app-adapter.d.ts +0 -2
- package/dist/src/web/bridges/mcp-app-adapter.js +0 -12
- package/dist/src/web/bridges/mcp-app-adapter.js.map +0 -1
- package/dist/src/web/bridges/mcp-app-bridge.d.ts +0 -30
- package/dist/src/web/bridges/mcp-app-bridge.js +0 -139
- package/dist/src/web/bridges/mcp-app-bridge.js.map +0 -1
- package/dist/src/web/bridges/types.d.ts +0 -32
- package/dist/src/web/bridges/types.js.map +0 -1
- package/dist/src/web/create-store.d.ts +0 -3
- package/dist/src/web/create-store.js +0 -25
- package/dist/src/web/create-store.js.map +0 -1
- package/dist/src/web/create-store.test.js +0 -70
- package/dist/src/web/create-store.test.js.map +0 -1
- package/dist/src/web/data-llm.d.ts +0 -14
- package/dist/src/web/data-llm.js.map +0 -1
- package/dist/src/web/data-llm.test.js +0 -76
- package/dist/src/web/data-llm.test.js.map +0 -1
- package/dist/src/web/generate-helpers.js.map +0 -1
- package/dist/src/web/generate-helpers.test-d.js.map +0 -1
- package/dist/src/web/generate-helpers.test.js.map +0 -1
- package/dist/src/web/helpers/state.js +0 -40
- package/dist/src/web/helpers/state.js.map +0 -1
- package/dist/src/web/helpers/state.test.js.map +0 -1
- package/dist/src/web/hooks/index.d.ts +0 -11
- package/dist/src/web/hooks/index.js +0 -12
- package/dist/src/web/hooks/index.js.map +0 -1
- package/dist/src/web/hooks/use-call-tool.js +0 -60
- package/dist/src/web/hooks/use-call-tool.js.map +0 -1
- package/dist/src/web/hooks/use-call-tool.test-d.js.map +0 -1
- package/dist/src/web/hooks/use-call-tool.test.js.map +0 -1
- package/dist/src/web/hooks/use-display-mode.d.ts +0 -4
- package/dist/src/web/hooks/use-display-mode.js +0 -10
- package/dist/src/web/hooks/use-display-mode.js.map +0 -1
- package/dist/src/web/hooks/use-display-mode.test.js +0 -41
- package/dist/src/web/hooks/use-display-mode.test.js.map +0 -1
- package/dist/src/web/hooks/use-files.d.ts +0 -10
- package/dist/src/web/hooks/use-files.js +0 -7
- package/dist/src/web/hooks/use-files.js.map +0 -1
- package/dist/src/web/hooks/use-files.test.js +0 -29
- package/dist/src/web/hooks/use-files.test.js.map +0 -1
- package/dist/src/web/hooks/use-layout.d.ts +0 -22
- package/dist/src/web/hooks/use-layout.js +0 -23
- package/dist/src/web/hooks/use-layout.js.map +0 -1
- package/dist/src/web/hooks/use-layout.test.js +0 -46
- package/dist/src/web/hooks/use-layout.test.js.map +0 -1
- package/dist/src/web/hooks/use-open-external.d.ts +0 -1
- package/dist/src/web/hooks/use-open-external.js +0 -6
- package/dist/src/web/hooks/use-open-external.js.map +0 -1
- package/dist/src/web/hooks/use-open-external.test.js +0 -24
- package/dist/src/web/hooks/use-open-external.test.js.map +0 -1
- package/dist/src/web/hooks/use-openai-global.d.ts +0 -3
- package/dist/src/web/hooks/use-openai-global.js +0 -6
- package/dist/src/web/hooks/use-openai-global.js.map +0 -1
- package/dist/src/web/hooks/use-request-modal.d.ts +0 -9
- package/dist/src/web/hooks/use-request-modal.js +0 -14
- package/dist/src/web/hooks/use-request-modal.js.map +0 -1
- package/dist/src/web/hooks/use-request-modal.test.js.map +0 -1
- package/dist/src/web/hooks/use-send-follow-up-message.d.ts +0 -1
- package/dist/src/web/hooks/use-send-follow-up-message.js +0 -11
- package/dist/src/web/hooks/use-send-follow-up-message.js.map +0 -1
- package/dist/src/web/hooks/use-tool-info.d.ts +0 -25
- package/dist/src/web/hooks/use-tool-info.js +0 -20
- package/dist/src/web/hooks/use-tool-info.js.map +0 -1
- package/dist/src/web/hooks/use-tool-info.test-d.js.map +0 -1
- package/dist/src/web/hooks/use-tool-info.test.js +0 -60
- package/dist/src/web/hooks/use-tool-info.test.js.map +0 -1
- package/dist/src/web/hooks/use-user.js +0 -19
- package/dist/src/web/hooks/use-user.js.map +0 -1
- package/dist/src/web/hooks/use-user.test.js +0 -44
- package/dist/src/web/hooks/use-user.test.js.map +0 -1
- package/dist/src/web/hooks/use-widget-state.d.ts +0 -4
- package/dist/src/web/hooks/use-widget-state.js +0 -32
- package/dist/src/web/hooks/use-widget-state.js.map +0 -1
- package/dist/src/web/hooks/use-widget-state.test.js +0 -61
- package/dist/src/web/hooks/use-widget-state.test.js.map +0 -1
- package/dist/src/web/index.js.map +0 -1
- package/dist/src/web/mount-widget.d.ts +0 -1
- package/dist/src/web/mount-widget.js +0 -19
- package/dist/src/web/mount-widget.js.map +0 -1
- package/dist/src/web/plugin/data-llm.test.js +0 -81
- package/dist/src/web/plugin/data-llm.test.js.map +0 -1
- package/dist/src/web/plugin/plugin.d.ts +0 -2
- package/dist/src/web/plugin/plugin.js +0 -39
- package/dist/src/web/plugin/plugin.js.map +0 -1
- package/dist/src/web/plugin/transform-data-llm.d.ts +0 -12
- package/dist/src/web/plugin/transform-data-llm.js +0 -93
- package/dist/src/web/plugin/transform-data-llm.js.map +0 -1
- package/dist/src/web/plugin/transform-data-llm.test.js +0 -81
- package/dist/src/web/plugin/transform-data-llm.test.js.map +0 -1
- package/dist/src/web/proxy.js.map +0 -1
- package/dist/src/web/types.d.ts +0 -151
- package/dist/src/web/types.js.map +0 -1
- package/dist/vitest.config.d.ts +0 -2
- package/dist/vitest.config.js +0 -8
- package/dist/vitest.config.js.map +0 -1
- /package/dist/{src/test/widget.test.d.ts → cli/build-helpers.test.d.ts} +0 -0
- /package/dist/{src/web/bridges/hooks/use-mcp-app-bridge.test.d.ts → cli/build-steps.test.d.ts} +0 -0
- /package/dist/{src/web/create-store.test.d.ts → cli/tunnel-control-server.test.d.ts} +0 -0
- /package/dist/{src/web/data-llm.test.d.ts → cli/tunnel-handler.test.d.ts} +0 -0
- /package/dist/{src/web/generate-helpers.test-d.d.ts → cli/tunnel.test.d.ts} +0 -0
- /package/dist/{src/web/bridges → cli}/types.js +0 -0
- /package/dist/{src/web/generate-helpers.test.d.ts → context-warnings.test.d.ts} +0 -0
- /package/dist/{src/web/helpers/state.test.d.ts → server/app.test.d.ts} +0 -0
- /package/dist/{src/web/hooks/use-call-tool.test-d.d.ts → server/asset-base-url-transform-plugin.test.d.ts} +0 -0
- /package/dist/{src/web/hooks/use-display-mode.test.d.ts → server/auth/discovery.test.d.ts} +0 -0
- /package/dist/{src/web/hooks/use-files.test.d.ts → server/auth/providers/auth0.test.d.ts} +0 -0
- /package/dist/{src/web/hooks/use-layout.test.d.ts → server/auth/providers/authplane.test.d.ts} +0 -0
- /package/dist/{src/web/hooks/use-open-external.test.d.ts → server/auth/providers/clerk.test.d.ts} +0 -0
- /package/dist/{src/web/hooks/use-request-modal.test.d.ts → server/auth/providers/custom.test.d.ts} +0 -0
- /package/dist/{src/web/hooks/use-tool-info.test-d.d.ts → server/auth/providers/descope.test.d.ts} +0 -0
- /package/dist/{src/web/hooks/use-tool-info.test.d.ts → server/auth/providers/shared.test.d.ts} +0 -0
- /package/dist/{src/web/hooks/use-user.test.d.ts → server/auth/security-schemes.test.d.ts} +0 -0
- /package/dist/{src/web/hooks/use-widget-state.test.d.ts → server/auth/setup.test.d.ts} +0 -0
- /package/dist/{src/web/plugin/data-llm.test.d.ts → server/auth/verify.test.d.ts} +0 -0
- /package/dist/{src/web/hooks/use-call-tool.test.d.ts → server/auth-extra.test-d.d.ts} +0 -0
- /package/dist/{src/web/plugin/transform-data-llm.test.d.ts → server/build-manifest.test.d.ts} +0 -0
- /package/dist/{src/server → server}/inferUtilityTypes.js +0 -0
- /package/dist/{src/web → web}/hooks/use-call-tool.test-d.js +0 -0
- /package/dist/{src/web → web}/proxy.d.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"view-resource-resolution.test.js","sourceRoot":"","sources":["../../src/server/view-resource-resolution.test.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EACL,MAAM,EACN,iBAAiB,EACjB,6BAA6B,GAC9B,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAkB,SAAS,EAAE,MAAM,YAAY,CAAC;AAE3E,EAAE,CAAC,IAAI,CAAC,qBAAqB,EAAE,GAAG,EAAE,CAAC,CAAC;IACpC,oBAAoB,EAAE,GAAG,EAAE,CACzB,CAAC,CAAC,IAAa,EAAE,IAAa,EAAE,IAAgB,EAAE,EAAE,CAClD,IAAI,EAAE,CAAmB;CAC9B,CAAC,CAAC,CAAC;AACJ,EAAE,CAAC,IAAI,CAAC,qBAAqB,EAAE,GAAG,EAAE,CAAC,CAAC;IACpC,cAAc,EAAE,CAAC,WAAoB,EAAE,EAAE,CACvC,CAAC,CAAC,IAAa,EAAE,IAAa,EAAE,IAAgB,EAAE,EAAE,CAClD,IAAI,EAAE,CAAmB;CAC9B,CAAC,CAAC,CAAC;AAUJ,+EAA+E;AAC/E,0EAA0E;AAC1E,4EAA4E;AAC5E,+EAA+E;AAC/E,wBAAwB;AAExB,SAAS,QAAQ,CAAC,QAAqC;IACrD,OAAO,IAAI,SAAS,CAAC;QACnB,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,OAAO;QAChB,OAAO,EAAE,CAAC,MAAM,EAAE,EAAE;YAClB,QAAQ,CAAC,MAAM,CAAC,CAAC;YACjB,OAAO,MAAM,CAAC;QAChB,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAED,KAAK,UA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AAM,EAAE,QAAQ,EAAE,GAAG,MAAM,OAAO,CAAC,cAAc,CAAC,CAAC;QAE3D,MAAM,SAAS,GAAG,iCAAiC,CAAC;QACpD,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC;QAEnE,MAAM,CAAC,QAAQ,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QACjC,MAAM,OAAO,GAAG,QAAQ,CAAC,CAAC,CAIzB,CAAC;QACF,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;QAC3D,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;QAC/C,2EAA2E;QAC3E,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAEpC,MAAM,QAAQ,EAAE,CAAC;IACnB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import http from \"node:http\";\nimport {\n Client,\n InMemoryTransport,\n StreamableHTTPClientTransport,\n} from \"@modelcontextprotocol/client\";\nimport type { RequestHandler } from \"express\";\nimport { afterEach, describe, expect, it, vi } from \"vitest\";\nimport { __setBuildManifest, type McpServer, Skybridge } from \"./index.js\";\n\nvi.mock(\"@skybridge/devtools\", () => ({\n devtoolsStaticServer: () =>\n ((_req: unknown, _res: unknown, next: () => void) =>\n next()) as RequestHandler,\n}));\nvi.mock(\"./viewsDevServer.js\", () => ({\n viewsDevServer: (_httpServer: unknown) =>\n ((_req: unknown, _res: unknown, next: () => void) =>\n next()) as RequestHandler,\n}));\n\n// Mirror what the Skybridge Vite plugin generates in `.skybridge/views.d.ts`:\n// narrow `ViewName` so `component: \"widget\"` typechecks against the registry.\ndeclare module \"./server.js\" {\n interface ViewNameRegistry {\n widget: true;\n }\n}\n\n// SKY-435: a view resource must resolve no matter the `?v=` query param value.\n// The version param is a content-derived cache key for external consumers\n// (it busts host/CDN caches when the bundle changes); it is not part of the\n// resource's identity, so a stale, absent, or arbitrary param must still serve\n// the underlying asset.\n\nfunction buildApp(register: (server: McpServer) => void) {\n return new Skybridge({\n name: \"test\",\n version: \"1.0.0\",\n handler: (server) => {\n register(server);\n return server;\n },\n });\n}\n\nasync function connect(register: (server: McpServer) => void) {\n const instance = await buildApp(register).createServerInstance();\n const client = new Client({ name: \"test-client\", version: \"1.0.0\" });\n const [clientTransport, serverTransport] =\n InMemoryTransport.createLinkedPair();\n await instance.connect(serverTransport);\n await client.connect(clientTransport);\n return {\n client,\n teardown: async () => {\n await client.close();\n await instance.close();\n },\n };\n}\n\nlet openHttpServer: http.Server | undefined;\nafterEach(() => openHttpServer?.close());\n\n// Connect over real HTTP so forwarded proxy headers reach the resource handler.\nasync function connectHttp(\n register: (server: McpServer) => void,\n headers: Record<string, string>,\n) {\n const { createApp } = await import(\"./express.js\");\n const app = buildApp(register);\n const httpServer = http.createServer();\n await createApp({ app, httpServer });\n const listening = http.createServer(app.express);\n await new Promise<void>((resolve) => listening.listen(0, resolve));\n openHttpServer = listening;\n const port = (listening.address() as { port: number }).port;\n\n const client = new Client({ name: \"test-client\", version: \"1.0.0\" });\n const transport = new StreamableHTTPClientTransport(\n new URL(`http://localhost:${port}/mcp`),\n { requestInit: { headers } },\n );\n await client.connect(transport);\n return {\n client,\n teardown: async () => {\n await client.close();\n },\n };\n}\n\nfunction registerWidget(server: McpServer) {\n server.registerTool(\n { name: \"show\", description: \"show\", view: { component: \"widget\" } },\n () => ({ content: [{ type: \"text\" as const, text: \"ok\" }] }),\n );\n}\n\n/** Narrow a read-resource content entry to its text variant. */\nfunction textContent(contents: Array<{ uri: string }>): {\n uri: string;\n text: string;\n} {\n return contents[0] as { uri: string; text: string };\n}\n\ndescribe(\"view resource resolution (cache key)\", () => {\n afterEach(() => {\n delete process.env.NODE_ENV;\n });\n\n it(\"resolves regardless of the ?v= param and echoes the requested URI\", async () => {\n const { client, teardown } = await connect(registerWidget);\n\n const { resources } = await client.listResources();\n const listed = resources.find((r) =>\n r.uri.startsWith(\"ui://views/ext-apps/widget.html\"),\n );\n // Dev build advertises no cache key.\n expect(listed?.uri).toBe(\"ui://views/ext-apps/widget.html\");\n\n // A stale/arbitrary/absent param all resolve the same underlying asset,\n // and the response echoes the URI the consumer asked for (never rewritten).\n for (const uri of [\n \"ui://views/ext-apps/widget.html?v=stale123\",\n \"ui://views/ext-apps/widget.html?v=whatever-else\",\n \"ui://views/ext-apps/widget.html\",\n ]) {\n const { contents } = await client.readResource({ uri });\n expect(contents).toHaveLength(1);\n const content = textContent(contents);\n expect(typeof content.text).toBe(\"string\");\n expect(content.text.length).toBeGreaterThan(0);\n expect(content.uri).toBe(uri);\n }\n\n await teardown();\n });\n\n it(\"resolves a stale cache key when the canonical URI carries ?v= (prod)\", async () => {\n process.env.NODE_ENV = \"production\";\n __setBuildManifest({\n \"src/views/widget.tsx\": {\n isEntry: true,\n name: \"widget\",\n file: \"assets/widget-ABC123.js\",\n },\n \"style.css\": { file: \"assets/style-XYZ.css\" },\n } as unknown as Record<string, { file: string }>);\n\n const { client, teardown } = await connect(registerWidget);\n\n const { resources } = await client.listResources();\n const listed = resources.find((r) =>\n r.uri.startsWith(\"ui://views/ext-apps/widget.html\"),\n );\n // Production advertises a content-derived cache key.\n expect(listed?.uri).toMatch(\n /^ui:\\/\\/views\\/ext-apps\\/widget\\.html\\?v=[0-9a-f]{8}$/,\n );\n\n // A consumer holding a stale key still resolves the current asset.\n const staleUri = \"ui://views/ext-apps/widget.html?v=00000000\";\n const { contents } = await client.readResource({ uri: staleUri });\n expect(contents).toHaveLength(1);\n const content = textContent(contents);\n expect(typeof content.text).toBe(\"string\");\n expect(content.uri).toBe(staleUri);\n\n await teardown();\n });\n\n it(\"still throws for an unknown view path\", async () => {\n const { client, teardown } = await connect(registerWidget);\n\n await expect(\n client.readResource({ uri: \"ui://views/ext-apps/nope.html?v=1\" }),\n ).rejects.toThrow();\n\n await teardown();\n });\n\n // A proxy routing the request under a path prefix sends x-forwarded-prefix;\n // the view's asset URLs must carry that prefix (and the forwarded origin) so\n // they resolve back through the same routing. Per-request, so one process can\n // serve many hosts/prefixes at once.\n it(\"prefixes emitted asset URLs with x-forwarded-prefix (prod)\", async () => {\n process.env.NODE_ENV = \"production\";\n __setBuildManifest({\n \"src/views/widget.tsx\": {\n isEntry: true,\n name: \"widget\",\n file: \"assets/widget-ABC123.js\",\n },\n \"style.css\": { file: \"assets/style-XYZ.css\" },\n } as unknown as Record<string, { file: string }>);\n\n const { client, teardown } = await connectHttp(registerWidget, {\n \"x-forwarded-host\": \"foo.com\",\n \"x-forwarded-proto\": \"https\",\n \"x-forwarded-prefix\": \"/v1/canary\",\n });\n try {\n const { contents } = await client.readResource({\n uri: \"ui://views/ext-apps/widget.html\",\n });\n const { text } = textContent(contents);\n // Forwarded origin + prefix. (`assets/assets` is the existing layout: the\n // manifest `file` already carries `assets/` and the template prepends\n // `/assets/`; build.tsx's `_redirects` collapses it on the asset host.)\n expect(text).toContain(\n \"https://foo.com/v1/canary/assets/assets/widget-ABC123.js\",\n );\n expect(text).toContain(\n \"https://foo.com/v1/canary/assets/assets/style-XYZ.css\",\n );\n // No unprefixed asset URL leaks through.\n expect(text).not.toContain(\"foo.com/assets/\");\n } finally {\n await teardown();\n }\n });\n\n // Back-compat: older Skybridge advertised the view at `ui://views/apps-sdk/...`\n // via openai/outputTemplate. We no longer advertise it, but apps published then\n // have it cached, so the read must still resolve to the ext-apps content.\n it(\"resolves the legacy apps-sdk URL to the ext-apps content\", async () => {\n const { client, teardown } = await connect(registerWidget);\n\n const legacyUri = \"ui://views/apps-sdk/widget.html\";\n const { contents } = await client.readResource({ uri: legacyUri });\n\n expect(contents).toHaveLength(1);\n const content = contents[0] as {\n uri: string;\n text: string;\n mimeType: string;\n };\n expect(content.mimeType).toBe(\"text/html;profile=mcp-app\");\n expect(content.text.length).toBeGreaterThan(0);\n // The response echoes the requested (legacy) URI, never the canonical one.\n expect(content.uri).toBe(legacyUri);\n\n await teardown();\n });\n});\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type http from "node:http";
|
|
2
|
+
import { type Router } from "express";
|
|
3
|
+
/**
|
|
4
|
+
* Vite dev-server middleware for view assets.
|
|
5
|
+
*
|
|
6
|
+
* MUST be mounted at the Express app root so Vite can intercept
|
|
7
|
+
* `/@vite/client`, `/@react-refresh`, and `/_skybridge/view/...` imports:
|
|
8
|
+
*
|
|
9
|
+
* const app = express();
|
|
10
|
+
* if (env.NODE_ENV !== "production") {
|
|
11
|
+
* app.use(await viewsDevServer(httpServer));
|
|
12
|
+
* }
|
|
13
|
+
*/
|
|
14
|
+
export declare const viewsDevServer: (httpServer: http.Server) => Promise<Router>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import cors from "cors";
|
|
3
|
+
import express, {} from "express";
|
|
4
|
+
import { assetBaseUrlTransformPlugin } from "./asset-base-url-transform-plugin.js";
|
|
5
|
+
/**
|
|
6
|
+
* Vite dev-server middleware for view assets.
|
|
7
|
+
*
|
|
8
|
+
* MUST be mounted at the Express app root so Vite can intercept
|
|
9
|
+
* `/@vite/client`, `/@react-refresh`, and `/_skybridge/view/...` imports:
|
|
10
|
+
*
|
|
11
|
+
* const app = express();
|
|
12
|
+
* if (env.NODE_ENV !== "production") {
|
|
13
|
+
* app.use(await viewsDevServer(httpServer));
|
|
14
|
+
* }
|
|
15
|
+
*/
|
|
16
|
+
export const viewsDevServer = async (httpServer) => {
|
|
17
|
+
const router = express.Router();
|
|
18
|
+
const { createServer, loadConfigFromFile } = await import("vite");
|
|
19
|
+
const root = process.cwd();
|
|
20
|
+
const configFile = path.join(root, "vite.config.ts");
|
|
21
|
+
const configResult = await loadConfigFromFile({ command: "serve", mode: "development" }, configFile, root);
|
|
22
|
+
const { build, preview, plugins: userPlugins = [], server: userServer, ...devConfig } = configResult?.config || {};
|
|
23
|
+
const vite = await createServer({
|
|
24
|
+
...devConfig,
|
|
25
|
+
// Pass `false` so Vite skips re-resolving a config file — we already
|
|
26
|
+
// loaded and spread the user's config above.
|
|
27
|
+
configFile: false,
|
|
28
|
+
appType: "custom",
|
|
29
|
+
server: {
|
|
30
|
+
// Keep the user's server options (e.g. forwardConsole) but force the
|
|
31
|
+
// three settings skybridge's Express integration requires.
|
|
32
|
+
...userServer,
|
|
33
|
+
allowedHosts: true,
|
|
34
|
+
middlewareMode: true,
|
|
35
|
+
hmr: {
|
|
36
|
+
server: httpServer,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
root,
|
|
40
|
+
// optimizeDeps is set by the skybridge Vite plugin (entries + include)
|
|
41
|
+
// so it can derive the view glob from `viewsDir`.
|
|
42
|
+
plugins: [...userPlugins, assetBaseUrlTransformPlugin()],
|
|
43
|
+
});
|
|
44
|
+
router.use(cors());
|
|
45
|
+
router.use("/", vite.middlewares);
|
|
46
|
+
return router;
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=viewsDevServer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viewsDevServer.js","sourceRoot":"","sources":["../../src/server/viewsDevServer.ts"],"names":[],"mappings":"AACA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,OAAO,EAAE,EAAe,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,2BAA2B,EAAE,MAAM,sCAAsC,CAAC;AAEnF;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,EACjC,UAAuB,EACN,EAAE;IACnB,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAEhC,MAAM,EAAE,YAAY,EAAE,kBAAkB,EAAE,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,CAAC;IAElE,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAC3B,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;IAErD,MAAM,YAAY,GAAG,MAAM,kBAAkB,CAC3C,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,EACzC,UAAU,EACV,IAAI,CACL,CAAC;IAEF,MAAM,EACJ,KAAK,EACL,OAAO,EACP,OAAO,EAAE,WAAW,GAAG,EAAE,EACzB,MAAM,EAAE,UAAU,EAClB,GAAG,SAAS,EACb,GAAG,YAAY,EAAE,MAAM,IAAI,EAAE,CAAC;IAE/B,MAAM,IAAI,GAAG,MAAM,YAAY,CAAC;QAC9B,GAAG,SAAS;QACZ,qEAAqE;QACrE,6CAA6C;QAC7C,UAAU,EAAE,KAAK;QACjB,OAAO,EAAE,QAAQ;QACjB,MAAM,EAAE;YACN,qEAAqE;YACrE,2DAA2D;YAC3D,GAAG,UAAU;YACb,YAAY,EAAE,IAAI;YAClB,cAAc,EAAE,IAAI;YACpB,GAAG,EAAE;gBACH,MAAM,EAAE,UAAU;aACnB;SACF;QACD,IAAI;QACJ,uEAAuE;QACvE,kDAAkD;QAClD,OAAO,EAAE,CAAC,GAAG,WAAW,EAAE,2BAA2B,EAAE,CAAC;KACzD,CAAC,CAAC;IAEH,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;IACnB,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IAElC,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC","sourcesContent":["import type http from \"node:http\";\nimport path from \"node:path\";\nimport cors from \"cors\";\nimport express, { type Router } from \"express\";\nimport { assetBaseUrlTransformPlugin } from \"./asset-base-url-transform-plugin.js\";\n\n/**\n * Vite dev-server middleware for view assets.\n *\n * MUST be mounted at the Express app root so Vite can intercept\n * `/@vite/client`, `/@react-refresh`, and `/_skybridge/view/...` imports:\n *\n * const app = express();\n * if (env.NODE_ENV !== \"production\") {\n * app.use(await viewsDevServer(httpServer));\n * }\n */\nexport const viewsDevServer = async (\n httpServer: http.Server,\n): Promise<Router> => {\n const router = express.Router();\n\n const { createServer, loadConfigFromFile } = await import(\"vite\");\n\n const root = process.cwd();\n const configFile = path.join(root, \"vite.config.ts\");\n\n const configResult = await loadConfigFromFile(\n { command: \"serve\", mode: \"development\" },\n configFile,\n root,\n );\n\n const {\n build,\n preview,\n plugins: userPlugins = [],\n server: userServer,\n ...devConfig\n } = configResult?.config || {};\n\n const vite = await createServer({\n ...devConfig,\n // Pass `false` so Vite skips re-resolving a config file — we already\n // loaded and spread the user's config above.\n configFile: false,\n appType: \"custom\",\n server: {\n // Keep the user's server options (e.g. forwardConsole) but force the\n // three settings skybridge's Express integration requires.\n ...userServer,\n allowedHosts: true,\n middlewareMode: true,\n hmr: {\n server: httpServer,\n },\n },\n root,\n // optimizeDeps is set by the skybridge Vite plugin (entries + include)\n // so it can derive the view glob from `viewsDir`.\n plugins: [...userPlugins, assetBaseUrlTransformPlugin()],\n });\n\n router.use(cors());\n router.use(\"/\", vite.middlewares);\n\n return router;\n};\n"]}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import { type MockInstance } from "vitest";
|
|
2
|
+
import { Skybridge } from "../server/app.js";
|
|
2
3
|
import { McpServer } from "../server/server.js";
|
|
3
|
-
/**
|
|
4
|
-
* Creates a real McpServer instance for testing
|
|
5
|
-
*/
|
|
6
4
|
export declare function createMockMcpServer(): {
|
|
7
5
|
server: McpServer;
|
|
8
6
|
mockRegisterResource: MockInstance<McpServer["registerResource"]>;
|
|
9
|
-
mockRegisterTool: MockInstance
|
|
7
|
+
mockRegisterTool: MockInstance;
|
|
10
8
|
};
|
|
11
|
-
export declare function
|
|
12
|
-
"search-
|
|
9
|
+
export declare function createTestApp(): Skybridge<Record<never, import("../server/server.js").ToolDef> & {
|
|
10
|
+
"search-trip": import("../server/server.js").ToolDef<{
|
|
13
11
|
destination: string;
|
|
14
12
|
departureDate?: string | undefined;
|
|
15
13
|
maxPrice?: number | undefined;
|
|
@@ -30,9 +28,9 @@ export declare function createTestServer(): McpServer<Record<never, import("../s
|
|
|
30
28
|
images: string[];
|
|
31
29
|
}, unknown>;
|
|
32
30
|
} & {
|
|
33
|
-
"no-input-
|
|
31
|
+
"no-input-view": import("../server/server.js").ToolDef<{}, {}, unknown>;
|
|
34
32
|
} & {
|
|
35
|
-
"inferred-output-
|
|
33
|
+
"inferred-output-view": import("../server/server.js").ToolDef<{
|
|
36
34
|
query: string;
|
|
37
35
|
}, {
|
|
38
36
|
inferredResults: {
|
|
@@ -60,7 +58,7 @@ export declare function createTestServer(): McpServer<Record<never, import("../s
|
|
|
60
58
|
fetchedAt: string;
|
|
61
59
|
}, unknown>;
|
|
62
60
|
} & {
|
|
63
|
-
"
|
|
61
|
+
"view-with-metadata": import("../server/server.js").ToolDef<{
|
|
64
62
|
resourceId: string;
|
|
65
63
|
}, {
|
|
66
64
|
data: {
|
|
@@ -82,7 +80,7 @@ export declare function createTestServer(): McpServer<Record<never, import("../s
|
|
|
82
80
|
source: string;
|
|
83
81
|
}>;
|
|
84
82
|
} & {
|
|
85
|
-
"
|
|
83
|
+
"view-with-mixed-returns": import("../server/server.js").ToolDef<{
|
|
86
84
|
shouldSucceed: boolean;
|
|
87
85
|
}, {
|
|
88
86
|
error: string;
|
|
@@ -94,18 +92,18 @@ export declare function createTestServer(): McpServer<Record<never, import("../s
|
|
|
94
92
|
processedAt: number;
|
|
95
93
|
region: string;
|
|
96
94
|
}>;
|
|
97
|
-
}>;
|
|
98
|
-
export declare function
|
|
99
|
-
"search-
|
|
95
|
+
}, undefined, import("../server/auth.js").ExtraClaims>;
|
|
96
|
+
export declare function createMinimalTestApp(): Skybridge<Record<never, import("../server/server.js").ToolDef> & {
|
|
97
|
+
"search-trip": import("../server/server.js").ToolDef<{
|
|
100
98
|
destination: string;
|
|
101
99
|
}, {
|
|
102
100
|
results: {
|
|
103
101
|
id: string;
|
|
104
102
|
}[];
|
|
105
103
|
}, unknown>;
|
|
106
|
-
}>;
|
|
107
|
-
export declare function
|
|
108
|
-
"interface-
|
|
104
|
+
}, undefined, import("../server/auth.js").ExtraClaims>;
|
|
105
|
+
export declare function createInterfaceTestApp(): Skybridge<Record<never, import("../server/server.js").ToolDef> & {
|
|
106
|
+
"interface-view": import("../server/server.js").ToolDef<{
|
|
109
107
|
id: string;
|
|
110
108
|
}, {
|
|
111
109
|
itemName: string;
|
|
@@ -114,22 +112,14 @@ export declare function createInterfaceTestServer(): McpServer<Record<never, imp
|
|
|
114
112
|
processedBy: string;
|
|
115
113
|
version: number;
|
|
116
114
|
}>;
|
|
117
|
-
}>;
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
host: string;
|
|
125
|
-
};
|
|
115
|
+
}, undefined, import("../server/auth.js").ExtraClaims>;
|
|
116
|
+
export declare function createMockExtra(host: string, options?: {
|
|
117
|
+
headers?: Record<string, string | string[]>;
|
|
118
|
+
url?: URL | string;
|
|
119
|
+
}): {
|
|
120
|
+
http: {
|
|
121
|
+
req: Request;
|
|
126
122
|
};
|
|
127
123
|
};
|
|
128
|
-
/**
|
|
129
|
-
* Sets up environment variables for testing
|
|
130
|
-
*/
|
|
131
124
|
export declare function setTestEnv(env: Record<string, string>): void;
|
|
132
|
-
/**
|
|
133
|
-
* Resets environment variables
|
|
134
|
-
*/
|
|
135
125
|
export declare function resetTestEnv(): void;
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import { McpServer as McpServerBase } from "@modelcontextprotocol/server";
|
|
2
|
+
import { vi } from "vitest";
|
|
3
|
+
import * as z from "zod";
|
|
4
|
+
import { Skybridge } from "../server/app.js";
|
|
5
|
+
import { McpServer } from "../server/server.js";
|
|
6
|
+
export function createMockMcpServer() {
|
|
7
|
+
const server = new McpServer({
|
|
8
|
+
name: "alpic-openai-app",
|
|
9
|
+
version: "0.0.1",
|
|
10
|
+
});
|
|
11
|
+
const mockRegisterResource = vi.spyOn(server, "registerResource");
|
|
12
|
+
const mockRegisterTool = vi.spyOn(McpServerBase.prototype, "registerTool");
|
|
13
|
+
return {
|
|
14
|
+
server,
|
|
15
|
+
mockRegisterResource,
|
|
16
|
+
mockRegisterTool,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export function createTestApp() {
|
|
20
|
+
return new Skybridge({
|
|
21
|
+
name: "test-app",
|
|
22
|
+
version: "1.0.0",
|
|
23
|
+
handler: (server) => server
|
|
24
|
+
.registerTool({
|
|
25
|
+
name: "search-trip",
|
|
26
|
+
description: "Search for trips",
|
|
27
|
+
inputSchema: {
|
|
28
|
+
destination: z.string(),
|
|
29
|
+
departureDate: z.string().optional(),
|
|
30
|
+
maxPrice: z.number().optional(),
|
|
31
|
+
},
|
|
32
|
+
outputSchema: {
|
|
33
|
+
results: z.array(z.object({
|
|
34
|
+
id: z.string(),
|
|
35
|
+
name: z.string(),
|
|
36
|
+
price: z.number(),
|
|
37
|
+
})),
|
|
38
|
+
totalCount: z.number(),
|
|
39
|
+
},
|
|
40
|
+
view: { component: "search-trip" },
|
|
41
|
+
}, async ({ destination }) => {
|
|
42
|
+
return {
|
|
43
|
+
content: [
|
|
44
|
+
{ type: "text", text: `Found trips to ${destination}` },
|
|
45
|
+
],
|
|
46
|
+
structuredContent: {
|
|
47
|
+
results: [{ id: "1", name: "Trip", price: 1000 }],
|
|
48
|
+
totalCount: 1,
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
})
|
|
52
|
+
.registerTool({
|
|
53
|
+
name: "get-trip-details",
|
|
54
|
+
description: "Get trip details",
|
|
55
|
+
inputSchema: {
|
|
56
|
+
tripId: z.string(),
|
|
57
|
+
},
|
|
58
|
+
outputSchema: {
|
|
59
|
+
name: z.string(),
|
|
60
|
+
description: z.string(),
|
|
61
|
+
images: z.array(z.string()),
|
|
62
|
+
},
|
|
63
|
+
view: { component: "get-trip-details" },
|
|
64
|
+
}, async ({ tripId }) => {
|
|
65
|
+
return {
|
|
66
|
+
content: [{ type: "text", text: `Details for ${tripId}` }],
|
|
67
|
+
structuredContent: {
|
|
68
|
+
name: "Trip",
|
|
69
|
+
description: "A great trip",
|
|
70
|
+
images: ["image1.jpg"],
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
})
|
|
74
|
+
.registerTool({
|
|
75
|
+
name: "no-input-view",
|
|
76
|
+
description: "View with no input",
|
|
77
|
+
inputSchema: {},
|
|
78
|
+
outputSchema: {},
|
|
79
|
+
view: { component: "no-input-view" },
|
|
80
|
+
}, async () => {
|
|
81
|
+
return {
|
|
82
|
+
content: [{ type: "text", text: "No input needed" }],
|
|
83
|
+
structuredContent: {},
|
|
84
|
+
};
|
|
85
|
+
})
|
|
86
|
+
.registerTool({
|
|
87
|
+
name: "inferred-output-view",
|
|
88
|
+
description: "View with output inferred from callback",
|
|
89
|
+
inputSchema: {
|
|
90
|
+
query: z.string(),
|
|
91
|
+
},
|
|
92
|
+
view: { component: "inferred-output-view" },
|
|
93
|
+
}, async ({ query }) => {
|
|
94
|
+
return {
|
|
95
|
+
content: [{ type: "text", text: `Query: ${query}` }],
|
|
96
|
+
structuredContent: {
|
|
97
|
+
inferredResults: [{ id: "inferred-1", score: 0.95 }],
|
|
98
|
+
inferredCount: 1,
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
})
|
|
102
|
+
.registerTool({
|
|
103
|
+
name: "calculate-price",
|
|
104
|
+
description: "Calculate trip price",
|
|
105
|
+
inputSchema: {
|
|
106
|
+
tripId: z.string(),
|
|
107
|
+
passengers: z.number(),
|
|
108
|
+
},
|
|
109
|
+
outputSchema: {
|
|
110
|
+
totalPrice: z.number(),
|
|
111
|
+
currency: z.string(),
|
|
112
|
+
},
|
|
113
|
+
}, async ({ tripId, passengers }) => {
|
|
114
|
+
return {
|
|
115
|
+
content: [{ type: "text", text: `Price for ${tripId}` }],
|
|
116
|
+
structuredContent: {
|
|
117
|
+
totalPrice: 1000 * passengers,
|
|
118
|
+
currency: "USD",
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
})
|
|
122
|
+
.registerTool({
|
|
123
|
+
name: "inferred-tool",
|
|
124
|
+
description: "Tool with output inferred from callback",
|
|
125
|
+
inputSchema: {
|
|
126
|
+
itemId: z.string(),
|
|
127
|
+
},
|
|
128
|
+
}, async ({ itemId }) => {
|
|
129
|
+
return {
|
|
130
|
+
content: [{ type: "text", text: `Item: ${itemId}` }],
|
|
131
|
+
structuredContent: {
|
|
132
|
+
itemDetails: { name: "Inferred Item", available: true },
|
|
133
|
+
fetchedAt: "2024-01-01",
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
})
|
|
137
|
+
.registerTool({
|
|
138
|
+
name: "view-with-metadata",
|
|
139
|
+
description: "View that returns response metadata",
|
|
140
|
+
inputSchema: {
|
|
141
|
+
resourceId: z.string(),
|
|
142
|
+
},
|
|
143
|
+
view: { component: "view-with-metadata" },
|
|
144
|
+
}, async ({ resourceId }) => {
|
|
145
|
+
return {
|
|
146
|
+
content: [{ type: "text", text: `Resource: ${resourceId}` }],
|
|
147
|
+
structuredContent: {
|
|
148
|
+
data: { id: resourceId, loaded: true },
|
|
149
|
+
},
|
|
150
|
+
_meta: {
|
|
151
|
+
requestId: "req-123",
|
|
152
|
+
timestamp: 1704067200000,
|
|
153
|
+
cached: false,
|
|
154
|
+
},
|
|
155
|
+
};
|
|
156
|
+
})
|
|
157
|
+
.registerTool({
|
|
158
|
+
name: "tool-with-metadata",
|
|
159
|
+
description: "Tool that returns response metadata",
|
|
160
|
+
inputSchema: {
|
|
161
|
+
query: z.string(),
|
|
162
|
+
},
|
|
163
|
+
}, async ({ query }) => {
|
|
164
|
+
return {
|
|
165
|
+
content: [{ type: "text", text: `Query: ${query}` }],
|
|
166
|
+
structuredContent: {
|
|
167
|
+
results: [query],
|
|
168
|
+
},
|
|
169
|
+
_meta: {
|
|
170
|
+
executionTime: 150,
|
|
171
|
+
source: "cache",
|
|
172
|
+
},
|
|
173
|
+
};
|
|
174
|
+
})
|
|
175
|
+
.registerTool({
|
|
176
|
+
name: "view-with-mixed-returns",
|
|
177
|
+
description: "View with mixed return paths (some with _meta, some without)",
|
|
178
|
+
inputSchema: {
|
|
179
|
+
shouldSucceed: z.boolean(),
|
|
180
|
+
},
|
|
181
|
+
view: { component: "view-with-mixed-returns" },
|
|
182
|
+
}, async ({ shouldSucceed }) => {
|
|
183
|
+
if (!shouldSucceed) {
|
|
184
|
+
return {
|
|
185
|
+
content: [{ type: "text", text: "Error occurred" }],
|
|
186
|
+
structuredContent: { error: "Something went wrong" },
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
return {
|
|
190
|
+
content: [{ type: "text", text: "Success" }],
|
|
191
|
+
structuredContent: { data: "result" },
|
|
192
|
+
_meta: {
|
|
193
|
+
processedAt: 1704067200000,
|
|
194
|
+
region: "eu-west-1",
|
|
195
|
+
},
|
|
196
|
+
};
|
|
197
|
+
}),
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
export function createMinimalTestApp() {
|
|
201
|
+
return new Skybridge({
|
|
202
|
+
name: "test-app",
|
|
203
|
+
version: "1.0.0",
|
|
204
|
+
handler: (server) => server.registerTool({
|
|
205
|
+
name: "search-trip",
|
|
206
|
+
description: "Search for trips",
|
|
207
|
+
inputSchema: {
|
|
208
|
+
destination: z.string(),
|
|
209
|
+
},
|
|
210
|
+
outputSchema: {
|
|
211
|
+
results: z.array(z.object({ id: z.string() })),
|
|
212
|
+
},
|
|
213
|
+
view: { component: "search-trip" },
|
|
214
|
+
}, async ({ destination }) => {
|
|
215
|
+
return {
|
|
216
|
+
content: [{ type: "text", text: `Found trips to ${destination}` }],
|
|
217
|
+
structuredContent: { results: [{ id: "1" }] },
|
|
218
|
+
};
|
|
219
|
+
}),
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
export function createInterfaceTestApp() {
|
|
223
|
+
return new Skybridge({
|
|
224
|
+
name: "interface-test-app",
|
|
225
|
+
version: "1.0.0",
|
|
226
|
+
handler: (server) => server.registerTool({
|
|
227
|
+
name: "interface-view",
|
|
228
|
+
description: "View with interface-typed output",
|
|
229
|
+
inputSchema: {
|
|
230
|
+
id: z.string(),
|
|
231
|
+
},
|
|
232
|
+
view: { component: "interface-view" },
|
|
233
|
+
}, async ({ id }) => {
|
|
234
|
+
return {
|
|
235
|
+
content: [{ type: "text", text: `Item ${id}` }],
|
|
236
|
+
structuredContent: {
|
|
237
|
+
itemName: "Test Item",
|
|
238
|
+
quantity: 42,
|
|
239
|
+
},
|
|
240
|
+
_meta: {
|
|
241
|
+
processedBy: "test",
|
|
242
|
+
version: 1,
|
|
243
|
+
},
|
|
244
|
+
};
|
|
245
|
+
}),
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
export function createMockExtra(host, options) {
|
|
249
|
+
const headers = new Headers();
|
|
250
|
+
headers.set("host", host);
|
|
251
|
+
for (const [key, value] of Object.entries(options?.headers ?? {})) {
|
|
252
|
+
headers.set(key, Array.isArray(value) ? value.join(", ") : value);
|
|
253
|
+
}
|
|
254
|
+
return {
|
|
255
|
+
http: {
|
|
256
|
+
req: new Request(String(options?.url ?? `https://${host}`), { headers }),
|
|
257
|
+
},
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
export function setTestEnv(env) {
|
|
261
|
+
Object.assign(process.env, env);
|
|
262
|
+
}
|
|
263
|
+
export function resetTestEnv() {
|
|
264
|
+
delete process.env.NODE_ENV;
|
|
265
|
+
}
|
|
266
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/test/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAqB,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC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AAW,EAAE,MAAM;oBACnB,OAAO,EAAE,CAAC;iBACX;aACF,CAAC;QACJ,CAAC,CACF;KACJ,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,eAAe,CAC7B,IAAY,EACZ,OAGC;IAED,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;IAC9B,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAC1B,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,IAAI,EAAE,CAAC,EAAE,CAAC;QAClE,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IACpE,CAAC;IACD,OAAO;QACL,IAAI,EAAE;YACJ,GAAG,EAAE,IAAI,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,GAAG,IAAI,WAAW,IAAI,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,CAAC;SACzE;KACF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,GAA2B;IACpD,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAClC,CAAC;AAED,MAAM,UAAU,YAAY;IAC1B,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC;AAC9B,CAAC","sourcesContent":["import { McpServer as McpServerBase } from \"@modelcontextprotocol/server\";\nimport { type MockInstance, vi } from \"vitest\";\nimport * as z from \"zod\";\nimport { Skybridge } from \"../server/app.js\";\nimport { McpServer, type ViewName } from \"../server/server.js\";\n\nexport function createMockMcpServer(): {\n server: McpServer;\n mockRegisterResource: MockInstance<McpServer[\"registerResource\"]>;\n mockRegisterTool: MockInstance;\n} {\n const server = new McpServer({\n name: \"alpic-openai-app\",\n version: \"0.0.1\",\n });\n\n const mockRegisterResource = vi.spyOn(server, \"registerResource\");\n const mockRegisterTool = vi.spyOn(McpServerBase.prototype, \"registerTool\");\n\n return {\n server,\n mockRegisterResource,\n mockRegisterTool,\n };\n}\n\nexport function createTestApp() {\n return new Skybridge({\n name: \"test-app\",\n version: \"1.0.0\",\n handler: (server) =>\n server\n .registerTool(\n {\n name: \"search-trip\",\n description: \"Search for trips\",\n inputSchema: {\n destination: z.string(),\n departureDate: z.string().optional(),\n maxPrice: z.number().optional(),\n },\n outputSchema: {\n results: z.array(\n z.object({\n id: z.string(),\n name: z.string(),\n price: z.number(),\n }),\n ),\n totalCount: z.number(),\n },\n view: { component: \"search-trip\" as ViewName },\n },\n async ({ destination }) => {\n return {\n content: [\n { type: \"text\", text: `Found trips to ${destination}` },\n ],\n structuredContent: {\n results: [{ id: \"1\", name: \"Trip\", price: 1000 }],\n totalCount: 1,\n },\n };\n },\n )\n .registerTool(\n {\n name: \"get-trip-details\",\n description: \"Get trip details\",\n inputSchema: {\n tripId: z.string(),\n },\n outputSchema: {\n name: z.string(),\n description: z.string(),\n images: z.array(z.string()),\n },\n view: { component: \"get-trip-details\" as ViewName },\n },\n async ({ tripId }) => {\n return {\n content: [{ type: \"text\", text: `Details for ${tripId}` }],\n structuredContent: {\n name: \"Trip\",\n description: \"A great trip\",\n images: [\"image1.jpg\"],\n },\n };\n },\n )\n .registerTool(\n {\n name: \"no-input-view\",\n description: \"View with no input\",\n inputSchema: {},\n outputSchema: {},\n view: { component: \"no-input-view\" as ViewName },\n },\n async () => {\n return {\n content: [{ type: \"text\", text: \"No input needed\" }],\n structuredContent: {},\n };\n },\n )\n .registerTool(\n {\n name: \"inferred-output-view\",\n description: \"View with output inferred from callback\",\n inputSchema: {\n query: z.string(),\n },\n view: { component: \"inferred-output-view\" as ViewName },\n },\n async ({ query }) => {\n return {\n content: [{ type: \"text\", text: `Query: ${query}` }],\n structuredContent: {\n inferredResults: [{ id: \"inferred-1\", score: 0.95 }],\n inferredCount: 1,\n },\n };\n },\n )\n .registerTool(\n {\n name: \"calculate-price\",\n description: \"Calculate trip price\",\n inputSchema: {\n tripId: z.string(),\n passengers: z.number(),\n },\n outputSchema: {\n totalPrice: z.number(),\n currency: z.string(),\n },\n },\n async ({ tripId, passengers }) => {\n return {\n content: [{ type: \"text\", text: `Price for ${tripId}` }],\n structuredContent: {\n totalPrice: 1000 * passengers,\n currency: \"USD\",\n },\n };\n },\n )\n .registerTool(\n {\n name: \"inferred-tool\",\n description: \"Tool with output inferred from callback\",\n inputSchema: {\n itemId: z.string(),\n },\n },\n async ({ itemId }) => {\n return {\n content: [{ type: \"text\", text: `Item: ${itemId}` }],\n structuredContent: {\n itemDetails: { name: \"Inferred Item\", available: true },\n fetchedAt: \"2024-01-01\",\n },\n };\n },\n )\n .registerTool(\n {\n name: \"view-with-metadata\",\n description: \"View that returns response metadata\",\n inputSchema: {\n resourceId: z.string(),\n },\n view: { component: \"view-with-metadata\" as ViewName },\n },\n async ({ resourceId }) => {\n return {\n content: [{ type: \"text\", text: `Resource: ${resourceId}` }],\n structuredContent: {\n data: { id: resourceId, loaded: true },\n },\n _meta: {\n requestId: \"req-123\",\n timestamp: 1704067200000,\n cached: false,\n },\n };\n },\n )\n .registerTool(\n {\n name: \"tool-with-metadata\",\n description: \"Tool that returns response metadata\",\n inputSchema: {\n query: z.string(),\n },\n },\n async ({ query }) => {\n return {\n content: [{ type: \"text\", text: `Query: ${query}` }],\n structuredContent: {\n results: [query],\n },\n _meta: {\n executionTime: 150,\n source: \"cache\",\n },\n };\n },\n )\n .registerTool(\n {\n name: \"view-with-mixed-returns\",\n description:\n \"View with mixed return paths (some with _meta, some without)\",\n inputSchema: {\n shouldSucceed: z.boolean(),\n },\n view: { component: \"view-with-mixed-returns\" as ViewName },\n },\n async ({ shouldSucceed }) => {\n if (!shouldSucceed) {\n return {\n content: [{ type: \"text\", text: \"Error occurred\" }],\n structuredContent: { error: \"Something went wrong\" },\n };\n }\n return {\n content: [{ type: \"text\", text: \"Success\" }],\n structuredContent: { data: \"result\" },\n _meta: {\n processedAt: 1704067200000,\n region: \"eu-west-1\",\n },\n };\n },\n ),\n });\n}\n\nexport function createMinimalTestApp() {\n return new Skybridge({\n name: \"test-app\",\n version: \"1.0.0\",\n handler: (server) =>\n server.registerTool(\n {\n name: \"search-trip\",\n description: \"Search for trips\",\n inputSchema: {\n destination: z.string(),\n },\n outputSchema: {\n results: z.array(z.object({ id: z.string() })),\n },\n view: { component: \"search-trip\" as ViewName },\n },\n async ({ destination }) => {\n return {\n content: [{ type: \"text\", text: `Found trips to ${destination}` }],\n structuredContent: { results: [{ id: \"1\" }] },\n };\n },\n ),\n });\n}\n\ninterface InterfaceOutput {\n itemName: string;\n quantity: number;\n}\n\ninterface InterfaceMeta {\n processedBy: string;\n version: number;\n}\n\ninterface InterfaceReturnType {\n content: [{ type: \"text\"; text: string }];\n structuredContent: InterfaceOutput;\n _meta: InterfaceMeta;\n}\n\nexport function createInterfaceTestApp() {\n return new Skybridge({\n name: \"interface-test-app\",\n version: \"1.0.0\",\n handler: (server) =>\n server.registerTool(\n {\n name: \"interface-view\" as const,\n description: \"View with interface-typed output\",\n inputSchema: {\n id: z.string(),\n },\n view: { component: \"interface-view\" as ViewName },\n },\n async ({ id }): Promise<InterfaceReturnType> => {\n return {\n content: [{ type: \"text\", text: `Item ${id}` }],\n structuredContent: {\n itemName: \"Test Item\",\n quantity: 42,\n },\n _meta: {\n processedBy: \"test\",\n version: 1,\n },\n };\n },\n ),\n });\n}\n\nexport function createMockExtra(\n host: string,\n options?: {\n headers?: Record<string, string | string[]>;\n url?: URL | string;\n },\n) {\n const headers = new Headers();\n headers.set(\"host\", host);\n for (const [key, value] of Object.entries(options?.headers ?? {})) {\n headers.set(key, Array.isArray(value) ? value.join(\", \") : value);\n }\n return {\n http: {\n req: new Request(String(options?.url ?? `https://${host}`), { headers }),\n },\n };\n}\n\nexport function setTestEnv(env: Record<string, string>) {\n Object.assign(process.env, env);\n}\n\nexport function resetTestEnv() {\n delete process.env.NODE_ENV;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|