skybridge 0.0.0-dev.f025fa9 → 0.0.0-dev.f0394fc
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +126 -120
- package/dist/cli/build-helpers.d.ts +11 -0
- package/dist/cli/build-helpers.js +113 -0
- package/dist/cli/build-helpers.js.map +1 -0
- package/dist/cli/build-helpers.test.js +143 -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 +84 -0
- package/dist/cli/build-steps.js.map +1 -0
- package/dist/cli/build-steps.test.js +72 -0
- package/dist/cli/build-steps.test.js.map +1 -0
- package/dist/cli/detect-port.d.ts +2 -2
- package/dist/cli/detect-port.js +8 -20
- package/dist/cli/detect-port.js.map +1 -1
- package/dist/cli/header.d.ts +1 -1
- package/dist/cli/header.js +1 -1
- package/dist/cli/header.js.map +1 -1
- package/dist/cli/resolve-skybridge-config.d.ts +6 -0
- package/dist/cli/resolve-skybridge-config.js +28 -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 +90 -0
- package/dist/cli/run-plain.js.map +1 -0
- package/dist/cli/telemetry.js +2 -0
- package/dist/cli/telemetry.js.map +1 -1
- package/dist/cli/tunnel-control-server.d.ts +9 -0
- package/dist/cli/tunnel-control-server.js +31 -0
- package/dist/cli/tunnel-control-server.js.map +1 -0
- package/dist/cli/tunnel-control-server.test.js +39 -0
- package/dist/cli/tunnel-control-server.test.js.map +1 -0
- package/dist/cli/tunnel-handler.d.ts +3 -0
- package/dist/cli/tunnel-handler.js +48 -0
- package/dist/cli/tunnel-handler.js.map +1 -0
- package/dist/cli/tunnel-handler.test.js +105 -0
- package/dist/cli/tunnel-handler.test.js.map +1 -0
- package/dist/cli/tunnel.d.ts +57 -0
- package/dist/cli/tunnel.js +154 -0
- package/dist/cli/tunnel.js.map +1 -0
- package/dist/cli/tunnel.test.js +190 -0
- package/dist/cli/tunnel.test.js.map +1 -0
- package/dist/cli/types.d.ts +5 -0
- package/dist/cli/types.js +2 -0
- package/dist/cli/types.js.map +1 -0
- package/dist/cli/use-execute-steps.d.ts +1 -1
- package/dist/cli/use-execute-steps.js.map +1 -1
- package/dist/cli/use-messages.d.ts +3 -0
- package/dist/cli/use-messages.js +11 -0
- package/dist/cli/use-messages.js.map +1 -0
- package/dist/cli/use-nodemon.d.ts +26 -7
- package/dist/cli/use-nodemon.js +97 -67
- package/dist/cli/use-nodemon.js.map +1 -1
- package/dist/cli/use-open-browser.d.ts +1 -0
- package/dist/cli/use-open-browser.js +44 -0
- package/dist/cli/use-open-browser.js.map +1 -0
- package/dist/cli/use-tunnel.d.ts +14 -0
- package/dist/cli/use-tunnel.js +131 -0
- package/dist/cli/use-tunnel.js.map +1 -0
- package/dist/cli/use-typescript-check.d.ts +9 -2
- package/dist/cli/use-typescript-check.js +91 -51
- package/dist/cli/use-typescript-check.js.map +1 -1
- package/dist/commands/build.d.ts +0 -3
- package/dist/commands/build.js +3 -18
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/create.d.ts +9 -0
- package/dist/commands/create.js +30 -0
- package/dist/commands/create.js.map +1 -0
- package/dist/commands/dev.d.ts +4 -0
- package/dist/commands/dev.js +96 -4
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/start.js +13 -10
- package/dist/commands/start.js.map +1 -1
- package/dist/commands/telemetry/disable.js.map +1 -1
- package/dist/commands/telemetry/enable.js.map +1 -1
- package/dist/commands/telemetry/status.js.map +1 -1
- package/dist/context-warnings.d.ts +5 -0
- package/dist/context-warnings.js +31 -0
- package/dist/context-warnings.js.map +1 -0
- package/dist/context-warnings.test.js +28 -0
- package/dist/context-warnings.test.js.map +1 -0
- package/dist/server/app.d.ts +211 -0
- package/dist/server/app.js +277 -0
- package/dist/server/app.js.map +1 -0
- package/dist/server/app.test.d.ts +1 -0
- package/dist/server/app.test.js +178 -0
- package/dist/server/app.test.js.map +1 -0
- package/dist/server/asset-base-url-transform-plugin.d.ts +6 -6
- package/dist/server/asset-base-url-transform-plugin.js +25 -11
- package/dist/server/asset-base-url-transform-plugin.js.map +1 -1
- package/dist/server/asset-base-url-transform-plugin.test.js +92 -14
- package/dist/server/asset-base-url-transform-plugin.test.js.map +1 -1
- package/dist/server/auth/discovery.d.ts +33 -0
- package/dist/server/auth/discovery.js +56 -0
- package/dist/server/auth/discovery.js.map +1 -0
- package/dist/server/auth/discovery.test.d.ts +1 -0
- package/dist/server/auth/discovery.test.js +93 -0
- package/dist/server/auth/discovery.test.js.map +1 -0
- package/dist/server/auth/index.d.ts +48 -0
- package/dist/server/auth/index.js +2 -0
- package/dist/server/auth/index.js.map +1 -0
- package/dist/server/auth/providers/auth0.d.ts +40 -0
- package/dist/server/auth/providers/auth0.js +36 -0
- package/dist/server/auth/providers/auth0.js.map +1 -0
- package/dist/server/auth/providers/auth0.test.d.ts +1 -0
- package/dist/server/auth/providers/auth0.test.js +50 -0
- package/dist/server/auth/providers/auth0.test.js.map +1 -0
- package/dist/server/auth/providers/authplane.d.ts +49 -0
- package/dist/server/auth/providers/authplane.js +57 -0
- package/dist/server/auth/providers/authplane.js.map +1 -0
- package/dist/server/auth/providers/authplane.test.d.ts +1 -0
- package/dist/server/auth/providers/authplane.test.js +143 -0
- package/dist/server/auth/providers/authplane.test.js.map +1 -0
- package/dist/server/auth/providers/clerk.d.ts +51 -0
- package/dist/server/auth/providers/clerk.js +19 -0
- package/dist/server/auth/providers/clerk.js.map +1 -0
- package/dist/server/auth/providers/clerk.test.d.ts +1 -0
- package/dist/server/auth/providers/clerk.test.js +30 -0
- package/dist/server/auth/providers/clerk.test.js.map +1 -0
- package/dist/server/auth/providers/custom.d.ts +42 -0
- package/dist/server/auth/providers/custom.js +59 -0
- package/dist/server/auth/providers/custom.js.map +1 -0
- package/dist/server/auth/providers/custom.test.d.ts +1 -0
- package/dist/server/auth/providers/custom.test.js +161 -0
- package/dist/server/auth/providers/custom.test.js.map +1 -0
- package/dist/server/auth/providers/descope.d.ts +44 -0
- package/dist/server/auth/providers/descope.js +44 -0
- package/dist/server/auth/providers/descope.js.map +1 -0
- package/dist/server/auth/providers/descope.test.d.ts +1 -0
- package/dist/server/auth/providers/descope.test.js +62 -0
- package/dist/server/auth/providers/descope.test.js.map +1 -0
- package/dist/server/auth/providers/shared.d.ts +2 -0
- package/dist/server/auth/providers/shared.js +6 -0
- package/dist/server/auth/providers/shared.js.map +1 -0
- package/dist/server/auth/providers/shared.test.d.ts +1 -0
- package/dist/server/auth/providers/shared.test.js +10 -0
- package/dist/server/auth/providers/shared.test.js.map +1 -0
- package/dist/server/auth/providers/stytch.d.ts +25 -0
- package/dist/server/auth/providers/stytch.js +16 -0
- package/dist/server/auth/providers/stytch.js.map +1 -0
- package/dist/server/auth/providers/verify-spy.d.ts +12 -0
- package/dist/server/auth/providers/verify-spy.js +21 -0
- package/dist/server/auth/providers/verify-spy.js.map +1 -0
- package/dist/server/auth/providers/workos.d.ts +34 -0
- package/dist/server/auth/providers/workos.js +16 -0
- package/dist/server/auth/providers/workos.js.map +1 -0
- package/dist/server/auth/security-schemes.d.ts +23 -0
- package/dist/server/auth/security-schemes.js +64 -0
- package/dist/server/auth/security-schemes.js.map +1 -0
- package/dist/server/auth/security-schemes.test.d.ts +1 -0
- package/dist/server/auth/security-schemes.test.js +99 -0
- package/dist/server/auth/security-schemes.test.js.map +1 -0
- package/dist/server/auth/setup.d.ts +6 -0
- package/dist/server/auth/setup.js +91 -0
- package/dist/server/auth/setup.js.map +1 -0
- package/dist/server/auth/setup.test.d.ts +1 -0
- package/dist/server/auth/setup.test.js +514 -0
- package/dist/server/auth/setup.test.js.map +1 -0
- package/dist/server/auth/verify.d.ts +48 -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 +165 -0
- package/dist/server/auth/verify.test.js.map +1 -0
- package/dist/server/auth-extra.test-d.d.ts +1 -0
- package/dist/server/auth-extra.test-d.js +130 -0
- package/dist/server/auth-extra.test-d.js.map +1 -0
- package/dist/server/auth.d.ts +57 -0
- package/dist/server/auth.js +27 -0
- package/dist/server/auth.js.map +1 -0
- package/dist/server/build-manifest.test.d.ts +1 -0
- package/dist/server/build-manifest.test.js +28 -0
- package/dist/server/build-manifest.test.js.map +1 -0
- package/dist/server/content-helpers.d.ts +67 -0
- package/dist/server/content-helpers.js +79 -0
- package/dist/server/content-helpers.js.map +1 -0
- package/dist/server/content-helpers.test.d.ts +1 -0
- package/dist/server/content-helpers.test.js +70 -0
- package/dist/server/content-helpers.test.js.map +1 -0
- package/dist/server/events.d.ts +113 -0
- package/dist/server/events.js +318 -0
- package/dist/server/events.js.map +1 -0
- package/dist/server/events.test.d.ts +1 -0
- package/dist/server/events.test.js +172 -0
- package/dist/server/events.test.js.map +1 -0
- package/dist/server/express.d.ts +26 -5
- package/dist/server/express.js +84 -43
- package/dist/server/express.js.map +1 -1
- package/dist/server/express.test.js +597 -24
- package/dist/server/express.test.js.map +1 -1
- package/dist/server/file-ref.d.ts +28 -0
- package/dist/server/file-ref.js +27 -0
- package/dist/server/file-ref.js.map +1 -0
- package/dist/server/form-input.d.ts +120 -0
- package/dist/server/form-input.js +89 -0
- package/dist/server/form-input.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 -3
- package/dist/server/index.js +19 -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 +229 -0
- package/dist/server/mcp-errors.test.js.map +1 -0
- package/dist/server/metric.d.ts +16 -0
- package/dist/server/metric.js +62 -0
- package/dist/server/metric.js.map +1 -0
- package/dist/server/middleware.d.ts +51 -13
- package/dist/server/middleware.js +33 -0
- package/dist/server/middleware.js.map +1 -1
- package/dist/server/middleware.test-d.js +1 -1
- package/dist/server/middleware.test-d.js.map +1 -1
- package/dist/server/middleware.test.js +291 -73
- package/dist/server/middleware.test.js.map +1 -1
- package/dist/server/register-tool.test.d.ts +1 -0
- package/dist/server/register-tool.test.js +230 -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 +602 -85
- package/dist/server/server.js +743 -219
- package/dist/server/server.js.map +1 -1
- package/dist/server/skills-integration.test.d.ts +1 -0
- package/dist/server/skills-integration.test.js +86 -0
- package/dist/server/skills-integration.test.js.map +1 -0
- package/dist/server/skills.d.ts +27 -0
- package/dist/server/skills.js +188 -0
- package/dist/server/skills.js.map +1 -0
- package/dist/server/skills.test.d.ts +1 -0
- package/dist/server/skills.test.js +243 -0
- package/dist/server/skills.test.js.map +1 -0
- package/dist/server/templateHelper.d.ts +2 -7
- package/dist/server/templateHelper.js +3 -22
- package/dist/server/templateHelper.js.map +1 -1
- package/dist/server/templates.generated.d.ts +4 -0
- package/dist/server/templates.generated.js +43 -0
- package/dist/server/templates.generated.js.map +1 -0
- package/dist/server/tool-extra.test.d.ts +1 -0
- package/dist/server/tool-extra.test.js +167 -0
- package/dist/server/tool-extra.test.js.map +1 -0
- package/dist/server/tunnel-proxy-router.d.ts +7 -0
- package/dist/server/tunnel-proxy-router.js +110 -0
- package/dist/server/tunnel-proxy-router.js.map +1 -0
- package/dist/server/tunnel-proxy-router.test.d.ts +1 -0
- package/dist/server/tunnel-proxy-router.test.js +229 -0
- package/dist/server/tunnel-proxy-router.test.js.map +1 -0
- package/dist/server/view-name.test-d.d.ts +1 -0
- package/dist/server/view-name.test-d.js +8 -0
- package/dist/server/view-name.test-d.js.map +1 -0
- package/dist/server/view-resource-resolution.test.d.ts +6 -0
- package/dist/server/view-resource-resolution.test.js +176 -0
- package/dist/server/view-resource-resolution.test.js.map +1 -0
- package/dist/server/viewsDevServer.d.ts +14 -0
- package/dist/server/viewsDevServer.js +48 -0
- package/dist/server/viewsDevServer.js.map +1 -0
- package/dist/test/utils.d.ts +21 -31
- package/dist/test/utils.js +222 -198
- package/dist/test/utils.js.map +1 -1
- package/dist/test/view.test.d.ts +1 -0
- package/dist/test/view.test.js +540 -0
- package/dist/test/view.test.js.map +1 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +3 -0
- package/dist/version.js.map +1 -0
- package/dist/views/index.d.ts +10 -0
- package/dist/views/index.js +3 -0
- package/dist/views/index.js.map +1 -0
- package/dist/views/scan-views.d.ts +16 -0
- package/dist/views/scan-views.js +88 -0
- package/dist/views/scan-views.js.map +1 -0
- package/dist/views/scan-views.test.d.ts +1 -0
- package/dist/views/scan-views.test.js +99 -0
- package/dist/views/scan-views.test.js.map +1 -0
- package/dist/views/validate-view.d.ts +1 -0
- package/dist/views/validate-view.js +9 -0
- package/dist/views/validate-view.js.map +1 -0
- package/dist/views/validate-view.test.d.ts +1 -0
- package/dist/views/validate-view.test.js +24 -0
- package/dist/views/validate-view.test.js.map +1 -0
- package/dist/web/bridges/adaptor.d.ts +62 -0
- package/dist/web/bridges/adaptor.js +477 -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 +281 -0
- package/dist/web/bridges/adaptor.test.js.map +1 -0
- package/dist/web/bridges/apps-sdk/bridge.d.ts +6 -1
- package/dist/web/bridges/apps-sdk/bridge.js +15 -3
- package/dist/web/bridges/apps-sdk/bridge.js.map +1 -1
- package/dist/web/bridges/apps-sdk/index.d.ts +0 -1
- package/dist/web/bridges/apps-sdk/index.js +0 -1
- package/dist/web/bridges/apps-sdk/index.js.map +1 -1
- package/dist/web/bridges/apps-sdk/types.d.ts +18 -7
- package/dist/web/bridges/apps-sdk/types.js.map +1 -1
- package/dist/web/bridges/apps-sdk/use-apps-sdk-context.d.ts +11 -0
- package/dist/web/bridges/apps-sdk/use-apps-sdk-context.js +11 -0
- package/dist/web/bridges/apps-sdk/use-apps-sdk-context.js.map +1 -1
- package/dist/web/bridges/get-adaptor.d.ts +7 -0
- package/dist/web/bridges/get-adaptor.js +9 -7
- package/dist/web/bridges/get-adaptor.js.map +1 -1
- package/dist/web/bridges/get-adaptor.test.d.ts +1 -0
- package/dist/web/bridges/get-adaptor.test.js +32 -0
- package/dist/web/bridges/get-adaptor.test.js.map +1 -0
- package/dist/web/bridges/index.js.map +1 -1
- package/dist/web/bridges/mcp-app/bridge.d.ts +15 -2
- package/dist/web/bridges/mcp-app/bridge.js +80 -7
- package/dist/web/bridges/mcp-app/bridge.js.map +1 -1
- package/dist/web/bridges/mcp-app/bridge.test.d.ts +1 -0
- package/dist/web/bridges/mcp-app/bridge.test.js +17 -0
- package/dist/web/bridges/mcp-app/bridge.test.js.map +1 -0
- package/dist/web/bridges/mcp-app/index.d.ts +0 -1
- package/dist/web/bridges/mcp-app/index.js +0 -1
- package/dist/web/bridges/mcp-app/index.js.map +1 -1
- package/dist/web/bridges/mcp-app/types.d.ts +19 -2
- package/dist/web/bridges/mcp-app/types.js.map +1 -1
- package/dist/web/bridges/mcp-app/use-mcp-app-context.d.ts +13 -1
- package/dist/web/bridges/mcp-app/use-mcp-app-context.js +12 -0
- package/dist/web/bridges/mcp-app/use-mcp-app-context.js.map +1 -1
- package/dist/web/bridges/mcp-app/use-mcp-app-context.test.js +1 -1
- package/dist/web/bridges/mcp-app/use-mcp-app-context.test.js.map +1 -1
- package/dist/web/bridges/mcp-app/view-tools.test.d.ts +1 -0
- package/dist/web/bridges/mcp-app/view-tools.test.js +143 -0
- package/dist/web/bridges/mcp-app/view-tools.test.js.map +1 -0
- package/dist/web/bridges/types.d.ts +182 -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 +1 -1
- package/dist/web/components/modal-provider.js +5 -6
- package/dist/web/components/modal-provider.js.map +1 -1
- package/dist/web/create-store.d.ts +26 -0
- package/dist/web/create-store.js +43 -3
- package/dist/web/create-store.js.map +1 -1
- package/dist/web/create-store.test.js +24 -23
- package/dist/web/create-store.test.js.map +1 -1
- package/dist/web/data-llm.d.ts +35 -2
- package/dist/web/data-llm.js +34 -5
- package/dist/web/data-llm.js.map +1 -1
- package/dist/web/data-llm.test.js +48 -29
- package/dist/web/data-llm.test.js.map +1 -1
- package/dist/web/generate-helpers.d.ts +40 -32
- package/dist/web/generate-helpers.js +38 -30
- 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 +11 -2
- package/dist/web/hooks/index.js +11 -2
- package/dist/web/hooks/index.js.map +1 -1
- package/dist/web/hooks/openai-extensions.test.d.ts +1 -0
- package/dist/web/hooks/openai-extensions.test.js +107 -0
- package/dist/web/hooks/openai-extensions.test.js.map +1 -0
- package/dist/web/hooks/test/utils.d.ts +7 -2
- package/dist/web/hooks/test/utils.js +14 -3
- package/dist/web/hooks/test/utils.js.map +1 -1
- package/dist/web/hooks/use-call-tool.d.ts +47 -2
- package/dist/web/hooks/use-call-tool.js +43 -10
- 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 +75 -29
- package/dist/web/hooks/use-call-tool.test.js.map +1 -1
- package/dist/web/hooks/use-deep-link.d.ts +22 -0
- package/dist/web/hooks/use-deep-link.js +34 -0
- package/dist/web/hooks/use-deep-link.js.map +1 -0
- package/dist/web/hooks/use-display-mode.d.ts +20 -0
- package/dist/web/hooks/use-display-mode.js +20 -0
- package/dist/web/hooks/use-display-mode.js.map +1 -1
- package/dist/web/hooks/use-display-mode.test-d.js.map +1 -1
- package/dist/web/hooks/use-display-mode.test.js +57 -21
- package/dist/web/hooks/use-display-mode.test.js.map +1 -1
- package/dist/web/hooks/use-download.d.ts +3 -0
- package/dist/web/hooks/use-download.js +7 -0
- package/dist/web/hooks/use-download.js.map +1 -0
- package/dist/web/hooks/use-download.test.d.ts +1 -0
- package/dist/web/hooks/use-download.test.js +103 -0
- package/dist/web/hooks/use-download.test.js.map +1 -0
- package/dist/web/hooks/use-file-resource.d.ts +37 -0
- package/dist/web/hooks/use-file-resource.js +98 -0
- package/dist/web/hooks/use-file-resource.js.map +1 -0
- package/dist/web/hooks/use-file-resource.test.d.ts +1 -0
- package/dist/web/hooks/use-file-resource.test.js +65 -0
- package/dist/web/hooks/use-file-resource.test.js.map +1 -0
- package/dist/web/hooks/use-files.d.ts +34 -1
- package/dist/web/hooks/use-files.js +33 -0
- package/dist/web/hooks/use-files.js.map +1 -1
- package/dist/web/hooks/use-files.test.js +31 -3
- package/dist/web/hooks/use-files.test.js.map +1 -1
- package/dist/web/hooks/use-host.d.ts +44 -0
- package/dist/web/hooks/use-host.js +45 -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-model-context.d.ts +44 -0
- package/dist/web/hooks/use-model-context.js +63 -0
- package/dist/web/hooks/use-model-context.js.map +1 -0
- package/dist/web/hooks/use-open-external.d.ts +17 -0
- package/dist/web/hooks/use-open-external.js +16 -0
- package/dist/web/hooks/use-open-external.js.map +1 -1
- package/dist/web/hooks/use-open-external.test.js +15 -5
- package/dist/web/hooks/use-open-external.test.js.map +1 -1
- package/dist/web/hooks/use-open-file.d.ts +20 -0
- package/dist/web/hooks/use-open-file.js +25 -0
- package/dist/web/hooks/use-open-file.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 +16 -1
- package/dist/web/hooks/use-request-modal.js +19 -4
- package/dist/web/hooks/use-request-modal.js.map +1 -1
- package/dist/web/hooks/use-request-modal.test.js +16 -2
- package/dist/web/hooks/use-request-modal.test.js.map +1 -1
- package/dist/web/hooks/use-request-size.d.ts +20 -0
- package/dist/web/hooks/use-request-size.js +24 -0
- package/dist/web/hooks/use-request-size.js.map +1 -0
- package/dist/web/hooks/use-request-size.test.d.ts +1 -0
- package/dist/web/hooks/use-request-size.test.js +47 -0
- package/dist/web/hooks/use-request-size.test.js.map +1 -0
- package/dist/web/hooks/use-send-follow-up-message.d.ts +25 -1
- package/dist/web/hooks/use-send-follow-up-message.js +25 -2
- package/dist/web/hooks/use-send-follow-up-message.js.map +1 -1
- package/dist/web/hooks/use-set-open-in-app-url.d.ts +17 -0
- package/dist/web/hooks/use-set-open-in-app-url.js +17 -0
- package/dist/web/hooks/use-set-open-in-app-url.js.map +1 -1
- package/dist/web/hooks/use-set-open-in-app-url.test.js +26 -12
- package/dist/web/hooks/use-set-open-in-app-url.test.js.map +1 -1
- package/dist/web/hooks/use-tool-info.d.ts +46 -14
- package/dist/web/hooks/use-tool-info.js +29 -7
- package/dist/web/hooks/use-tool-info.js.map +1 -1
- package/dist/web/hooks/use-tool-info.test-d.js +11 -34
- package/dist/web/hooks/use-tool-info.test-d.js.map +1 -1
- package/dist/web/hooks/use-tool-info.test.js +42 -37
- package/dist/web/hooks/use-tool-info.test.js.map +1 -1
- package/dist/web/hooks/use-user.d.ts +5 -2
- package/dist/web/hooks/use-user.js +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 +1 -2
- package/dist/web/index.js +1 -2
- package/dist/web/index.js.map +1 -1
- package/dist/web/mount-view.d.ts +21 -0
- package/dist/web/mount-view.js +43 -0
- package/dist/web/mount-view.js.map +1 -0
- package/dist/web/proxy.js.map +1 -1
- package/dist/web/types.d.ts +4 -0
- package/dist/web/types.js.map +1 -1
- package/package.json +50 -28
- package/tsconfig.base.json +5 -0
- package/dist/server/templates/development.hbs +0 -12
- package/dist/server/templates/production.hbs +0 -6
- package/dist/server/widgetsDevServer.d.ts +0 -13
- package/dist/server/widgetsDevServer.js +0 -57
- package/dist/server/widgetsDevServer.js.map +0 -1
- package/dist/test/widget.test.js +0 -263
- package/dist/test/widget.test.js.map +0 -1
- package/dist/web/bridges/apps-sdk/adaptor.d.ts +0 -22
- package/dist/web/bridges/apps-sdk/adaptor.js +0 -75
- package/dist/web/bridges/apps-sdk/adaptor.js.map +0 -1
- package/dist/web/bridges/mcp-app/adaptor.d.ts +0 -38
- package/dist/web/bridges/mcp-app/adaptor.js +0 -184
- package/dist/web/bridges/mcp-app/adaptor.js.map +0 -1
- package/dist/web/hooks/use-layout.d.ts +0 -22
- package/dist/web/hooks/use-layout.js +0 -23
- package/dist/web/hooks/use-layout.js.map +0 -1
- package/dist/web/hooks/use-layout.test.js +0 -96
- package/dist/web/hooks/use-layout.test.js.map +0 -1
- package/dist/web/hooks/use-widget-state.d.ts +0 -4
- package/dist/web/hooks/use-widget-state.js +0 -32
- package/dist/web/hooks/use-widget-state.js.map +0 -1
- package/dist/web/hooks/use-widget-state.test.js +0 -64
- package/dist/web/hooks/use-widget-state.test.js.map +0 -1
- package/dist/web/mount-widget.d.ts +0 -1
- package/dist/web/mount-widget.js +0 -27
- package/dist/web/mount-widget.js.map +0 -1
- package/dist/web/plugin/data-llm.test.js +0 -81
- package/dist/web/plugin/data-llm.test.js.map +0 -1
- package/dist/web/plugin/plugin.d.ts +0 -2
- package/dist/web/plugin/plugin.js +0 -54
- package/dist/web/plugin/plugin.js.map +0 -1
- package/dist/web/plugin/transform-data-llm.d.ts +0 -12
- package/dist/web/plugin/transform-data-llm.js +0 -96
- package/dist/web/plugin/transform-data-llm.js.map +0 -1
- package/dist/web/plugin/transform-data-llm.test.js +0 -81
- package/dist/web/plugin/transform-data-llm.test.js.map +0 -1
- package/dist/web/plugin/validate-widget.d.ts +0 -5
- package/dist/web/plugin/validate-widget.js +0 -27
- package/dist/web/plugin/validate-widget.js.map +0 -1
- package/dist/web/plugin/validate-widget.test.js +0 -42
- package/dist/web/plugin/validate-widget.test.js.map +0 -1
- /package/dist/{test/widget.test.d.ts → cli/build-helpers.test.d.ts} +0 -0
- /package/dist/{web/hooks/use-layout.test.d.ts → cli/build-steps.test.d.ts} +0 -0
- /package/dist/{web/hooks/use-widget-state.test.d.ts → cli/tunnel-control-server.test.d.ts} +0 -0
- /package/dist/{web/plugin/data-llm.test.d.ts → cli/tunnel-handler.test.d.ts} +0 -0
- /package/dist/{web/plugin/transform-data-llm.test.d.ts → cli/tunnel.test.d.ts} +0 -0
- /package/dist/{web/plugin/validate-widget.test.d.ts → context-warnings.test.d.ts} +0 -0
package/dist/server/server.d.ts
CHANGED
|
@@ -1,45 +1,221 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import { McpServer as McpServerBase, type
|
|
3
|
-
import type
|
|
4
|
-
import
|
|
5
|
-
import type {
|
|
6
|
-
import type {
|
|
7
|
-
import
|
|
1
|
+
import type { McpUiToolMeta } from "@modelcontextprotocol/ext-apps";
|
|
2
|
+
import { type ContentBlock, type Icon, type Implementation, type InputRequiredResult, McpServer as McpServerBase, type RequestMeta, type ResourceLink, type ServerOptions, type ServerResult, type StandardSchemaV1, type StandardSchemaWithJSON, type ToolAnnotations } from "@modelcontextprotocol/server";
|
|
3
|
+
import type express from "express";
|
|
4
|
+
import { z } from "zod/v4";
|
|
5
|
+
import type { ResourceMetadataUrlResolver } from "./auth/setup.js";
|
|
6
|
+
import type { ExtraClaims } from "./auth.js";
|
|
7
|
+
import { type EventConfig, type EventHooks, type InferEventSchema } from "./events.js";
|
|
8
|
+
import type { McpExtra, McpExtraFor, McpMethodString, McpMiddlewareEntry, McpMiddlewareFilter, McpMiddlewareFn, McpResultFor, McpTypedMiddlewareFn, McpWildcard } 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
|
+
*/
|
|
8
17
|
export type ToolDef<TInput = unknown, TOutput = unknown, TResponseMetadata = unknown> = {
|
|
9
18
|
input: TInput;
|
|
10
19
|
output: TOutput;
|
|
11
20
|
responseMetadata: TResponseMetadata;
|
|
12
21
|
};
|
|
13
22
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
23
|
+
* Content Security Policy origins attached to a view's resource. Each list is
|
|
24
|
+
* passed through to the host's CSP for the view iframe; omit a field to inherit
|
|
25
|
+
* the host's default for that directive.
|
|
17
26
|
*/
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
27
|
+
export interface ViewCsp {
|
|
28
|
+
/** Origins for static assets (images, fonts, scripts, styles). */
|
|
29
|
+
resourceDomains?: string[];
|
|
30
|
+
/** Origins the view may contact via fetch/XHR. */
|
|
31
|
+
connectDomains?: string[];
|
|
32
|
+
/** Origins allowed for iframe embeds (opts into stricter plugin review). */
|
|
33
|
+
frameDomains?: string[];
|
|
34
|
+
/** Origins that can receive openExternal redirects without the safe-link modal. */
|
|
23
35
|
redirectDomains?: string[];
|
|
36
|
+
/** Origins allowed in `<base href>` tags (mcp-apps only). */
|
|
37
|
+
baseUriDomains?: string[];
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Registry of view component names. The Skybridge Vite plugin augments this
|
|
41
|
+
* interface in the generated `.skybridge/views.d.ts` with one key per view
|
|
42
|
+
* file, which narrows {@link ViewName} from `string` to the concrete union.
|
|
43
|
+
*/
|
|
44
|
+
export interface ViewNameRegistry {
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Resolve view component names from a registry: the union of its keys, or
|
|
48
|
+
* `string` when the registry is empty. The empty case happens before
|
|
49
|
+
* `.skybridge/views.d.ts` is generated; falling back to `string` keeps valid
|
|
50
|
+
* view names from erroring on a fresh checkout, and narrowing kicks in once
|
|
51
|
+
* the generated file augments the registry.
|
|
52
|
+
*/
|
|
53
|
+
export type ViewNameFor<Registry> = [keyof Registry & string] extends [never] ? string : keyof Registry & string;
|
|
54
|
+
/** Union of valid view component names. Narrowed by {@link ViewNameRegistry}. */
|
|
55
|
+
export type ViewName = ViewNameFor<ViewNameRegistry>;
|
|
56
|
+
/**
|
|
57
|
+
* Pass under `view` in a tool's `registerTool` config to render the tool's
|
|
58
|
+
* result through a Skybridge view instead of a plain text response.
|
|
59
|
+
*/
|
|
60
|
+
export interface ViewConfig {
|
|
61
|
+
/** Filename of the view module (without extension) — matches a file in your `viewsDir`. */
|
|
62
|
+
component: ViewName;
|
|
63
|
+
/** Human-readable label the host may show alongside the view. */
|
|
64
|
+
description?: string;
|
|
65
|
+
/** Request a visible border around the view (forwarded as `ui.prefersBorder`). */
|
|
66
|
+
prefersBorder?: boolean;
|
|
67
|
+
/** Override the iframe's served domain (advanced; forwarded as `ui.domain`). */
|
|
68
|
+
domain?: string;
|
|
69
|
+
/** Per-view CSP overrides — see {@link ViewCsp}. */
|
|
70
|
+
csp?: ViewCsp;
|
|
71
|
+
/** Free-form metadata forwarded on the view resource's `_meta`. */
|
|
72
|
+
_meta?: Record<string, unknown>;
|
|
73
|
+
}
|
|
74
|
+
export type SecurityScheme = {
|
|
75
|
+
type: "noauth";
|
|
76
|
+
} | {
|
|
77
|
+
type: "oauth2";
|
|
78
|
+
scopes?: string[];
|
|
24
79
|
};
|
|
25
|
-
/**
|
|
26
|
-
type
|
|
27
|
-
|
|
80
|
+
/** A display mode ChatGPT can render a view in. ChatGPT doesn't support `pip`. */
|
|
81
|
+
export type OpenAIDisplayMode = "inline" | "fullscreen";
|
|
82
|
+
/** A sidebar shortcut that calls another tool of the same server. */
|
|
83
|
+
export interface OpenAIQuickAction {
|
|
84
|
+
title: string;
|
|
85
|
+
icons: [Icon, ...Icon[]];
|
|
86
|
+
target: {
|
|
87
|
+
type: "tool";
|
|
88
|
+
name: string;
|
|
89
|
+
arguments?: Record<string, unknown>;
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* A place in ChatGPT where users can open the tool's view without the model.
|
|
94
|
+
*
|
|
95
|
+
* - `global`: an entry in the sidebar, opened fullscreen.
|
|
96
|
+
* - `thread`: a tab in a conversation's side panel.
|
|
97
|
+
* - `file`: a viewer for files with these extensions, such as `".stl"`.
|
|
98
|
+
* ChatGPT calls the tool with `{ file: { name, resourceUri } }`.
|
|
99
|
+
* - `settings`: an entry in the plugin settings.
|
|
100
|
+
*
|
|
101
|
+
* ChatGPT calls the tool with `{}` for global and thread entrypoints, so the
|
|
102
|
+
* tool must not require any input.
|
|
103
|
+
*/
|
|
104
|
+
export type OpenAIEntrypoint = {
|
|
105
|
+
type: "global";
|
|
106
|
+
quickAction?: OpenAIQuickAction;
|
|
107
|
+
} | {
|
|
108
|
+
type: "thread";
|
|
109
|
+
} | {
|
|
110
|
+
type: "file";
|
|
111
|
+
extensions: string[];
|
|
112
|
+
} | {
|
|
113
|
+
type: "settings";
|
|
114
|
+
searchTerms?: string[];
|
|
28
115
|
};
|
|
29
|
-
/**
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
116
|
+
/**
|
|
117
|
+
* ChatGPT-only tool options, emitted as `_meta["openai/ui"]` on the tool and
|
|
118
|
+
* on its view resource. Every field is optional: ChatGPT applies the defaults
|
|
119
|
+
* of the OpenAI MCP extensions spec when one is omitted. Requires `view`.
|
|
120
|
+
*
|
|
121
|
+
* @see https://github.com/openai/mcp-extensions/blob/main/docs/spec.md
|
|
122
|
+
*/
|
|
123
|
+
export interface OpenAIToolConfig {
|
|
124
|
+
/** Places where users can open the view directly. */
|
|
125
|
+
entrypoints?: OpenAIEntrypoint[];
|
|
126
|
+
/**
|
|
127
|
+
* Display modes the view supports, read before the view loads. Defaults to
|
|
128
|
+
* `[preferredDisplayMode]` when that is set, otherwise to both modes.
|
|
129
|
+
*/
|
|
130
|
+
availableDisplayModes?: OpenAIDisplayMode[];
|
|
131
|
+
/**
|
|
132
|
+
* Display mode the view prefers to open in. Setting it alone makes it the
|
|
133
|
+
* only available mode, so also set `availableDisplayModes` to keep the other.
|
|
134
|
+
*/
|
|
135
|
+
preferredDisplayMode?: OpenAIDisplayMode;
|
|
136
|
+
/** Display mode the view opens in first when the model calls the tool. */
|
|
137
|
+
preferredModelDisplayMode?: OpenAIDisplayMode;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Declarative per-tool auth. Enforced when the server has an `oauth` provider:
|
|
141
|
+
* anonymous or under-scoped calls are rejected before the handler runs. Omit
|
|
142
|
+
* `auth` entirely for the secure default (sign-in required, no specific scope).
|
|
143
|
+
*/
|
|
144
|
+
export type ToolAuth = {
|
|
145
|
+
/**
|
|
146
|
+
* When `true`, the tool is callable signed out; the token is still used when
|
|
147
|
+
* one is present. Omit (or `false`) to require sign-in.
|
|
148
|
+
*/
|
|
149
|
+
allowsAnonymous?: boolean;
|
|
150
|
+
/** OAuth scopes the caller's token must carry to invoke the tool. */
|
|
151
|
+
scopes?: string[];
|
|
38
152
|
};
|
|
39
|
-
|
|
153
|
+
/**
|
|
154
|
+
* Options forwarded to the built-in `express.json()` body parser. Derived
|
|
155
|
+
* from Express's own types so the public API doesn't depend on `body-parser`.
|
|
156
|
+
*/
|
|
157
|
+
export type JsonOptions = NonNullable<Parameters<typeof express.json>[0]>;
|
|
158
|
+
/**
|
|
159
|
+
* The Skybridge-specific options an {@link McpServer} is built with. A
|
|
160
|
+
* {@link Skybridge} app derives them from its config; pass them directly only
|
|
161
|
+
* when constructing an `McpServer` by hand.
|
|
162
|
+
*/
|
|
163
|
+
export interface SkybridgeServerOptions {
|
|
164
|
+
/** Whether an OAuth provider guards `/mcp`; enables per-tool scheme enforcement. */
|
|
165
|
+
oauth?: boolean;
|
|
166
|
+
/**
|
|
167
|
+
* @experimental Serve Agent Skills from `src/skills` over MCP (SEP-2640).
|
|
168
|
+
* API may change.
|
|
169
|
+
*/
|
|
170
|
+
skills?: boolean;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Well-known keys recognized by host runtimes when set on a tool's `_meta`.
|
|
174
|
+
* Use {@link ToolMeta} to also pass arbitrary custom metadata alongside these.
|
|
175
|
+
*
|
|
176
|
+
* @see https://developers.openai.com/plugins/reference#tool-descriptor-parameters
|
|
177
|
+
*/
|
|
178
|
+
export interface KnownToolMeta {
|
|
179
|
+
/** ChatGPT: allow the rendered view to call this tool from inside its iframe. */
|
|
180
|
+
"openai/widgetAccessible"?: boolean;
|
|
181
|
+
/** ChatGPT: status text shown while the tool is running (e.g. `"Searching trips"`). */
|
|
182
|
+
"openai/toolInvocation/invoking"?: string;
|
|
183
|
+
/** ChatGPT: status text shown once the tool returns (e.g. `"Found 3 trips"`). */
|
|
184
|
+
"openai/toolInvocation/invoked"?: string;
|
|
185
|
+
/** ChatGPT: input parameters that hold file references — the host attaches uploaded files to them. */
|
|
186
|
+
"openai/fileParams"?: string[];
|
|
187
|
+
/** MCP Apps: control whether the tool is exposed to the model, the app, or both. */
|
|
188
|
+
ui?: Pick<McpUiToolMeta, "visibility">;
|
|
189
|
+
}
|
|
190
|
+
/** {@link KnownToolMeta} merged with arbitrary string-keyed metadata for custom flags. */
|
|
191
|
+
export type ToolMeta = KnownToolMeta & Record<string, unknown>;
|
|
192
|
+
/**
|
|
193
|
+
* Convenient return type for tool handlers — a plain string, a single
|
|
194
|
+
* {@link ContentBlock}, or an array. Skybridge normalizes it to the MCP
|
|
195
|
+
* `content: ContentBlock[]` shape before responding.
|
|
196
|
+
*/
|
|
197
|
+
export type HandlerContent = string | ContentBlock | ContentBlock[];
|
|
198
|
+
/**
|
|
199
|
+
* Type-level marker interface for cross-package type inference.
|
|
200
|
+
*
|
|
201
|
+
* Consumers infer tool types via the structural `$types` property rather than
|
|
202
|
+
* the `McpServer` class generic, because class-generic inference breaks when
|
|
203
|
+
* `McpServer` comes from different package installations (e.g. a consumer
|
|
204
|
+
* with its own `skybridge` dep vs. the in-tree workspace version).
|
|
205
|
+
*
|
|
206
|
+
* Inspired by tRPC's `_def` pattern and Hono's type markers.
|
|
207
|
+
*/
|
|
208
|
+
export interface McpServerTypes<TTools extends Record<string, ToolDef>> {
|
|
209
|
+
readonly tools: TTools;
|
|
210
|
+
}
|
|
40
211
|
type Simplify<T> = {
|
|
41
212
|
[K in keyof T]: T[K];
|
|
42
213
|
};
|
|
214
|
+
type ShapeOutput<Shape extends Record<string, StandardSchemaWithJSON>> = Simplify<{
|
|
215
|
+
[K in keyof Shape as undefined extends StandardSchemaV1.InferOutput<Shape[K]> ? never : K]: StandardSchemaV1.InferOutput<Shape[K]>;
|
|
216
|
+
} & {
|
|
217
|
+
[K in keyof Shape as undefined extends StandardSchemaV1.InferOutput<Shape[K]> ? K : never]?: StandardSchemaV1.InferOutput<Shape[K]>;
|
|
218
|
+
}>;
|
|
43
219
|
type ExtractStructuredContent<T> = T extends {
|
|
44
220
|
structuredContent: infer SC;
|
|
45
221
|
} ? Simplify<SC> : never;
|
|
@@ -50,59 +226,254 @@ type ExtractMeta<T> = [Extract<T, {
|
|
|
50
226
|
}> extends {
|
|
51
227
|
_meta: infer M;
|
|
52
228
|
} ? Simplify<M> : unknown;
|
|
53
|
-
|
|
54
|
-
* Type-level marker interface for cross-package type inference.
|
|
55
|
-
* This enables TypeScript to infer tool types across package boundaries
|
|
56
|
-
* using structural typing on the $types property, rather than relying on
|
|
57
|
-
* class generic inference which fails when McpServer comes from different
|
|
58
|
-
* package installations.
|
|
59
|
-
*
|
|
60
|
-
* Inspired by tRPC's _def pattern and Hono's type markers.
|
|
61
|
-
*/
|
|
62
|
-
export interface McpServerTypes<TTools extends Record<string, ToolDef>> {
|
|
63
|
-
readonly tools: TTools;
|
|
64
|
-
}
|
|
65
|
-
type ShapeOutput<Shape extends ZodRawShapeCompat> = Simplify<{
|
|
66
|
-
[K in keyof Shape as undefined extends SchemaOutput<Shape[K]> ? never : K]: SchemaOutput<Shape[K]>;
|
|
67
|
-
} & {
|
|
68
|
-
[K in keyof Shape as undefined extends SchemaOutput<Shape[K]> ? K : never]?: SchemaOutput<Shape[K]>;
|
|
69
|
-
}>;
|
|
70
|
-
type AddTool<TTools, TName extends string, TInput extends ZodRawShapeCompat, TOutput, TResponseMetadata = unknown> = McpServer<TTools & {
|
|
229
|
+
type AddTool<TTools, TName extends string, TInput extends Record<string, StandardSchemaWithJSON>, TOutput, TResponseMetadata = unknown, TAuthExtra extends ExtraClaims = ExtraClaims> = McpServer<TTools & {
|
|
71
230
|
[K in TName]: ToolDef<ShapeOutput<TInput>, TOutput, TResponseMetadata>;
|
|
72
|
-
}>;
|
|
73
|
-
|
|
231
|
+
}, TAuthExtra>;
|
|
232
|
+
interface ToolConfigBase<TInput extends Record<string, StandardSchemaWithJSON> | StandardSchemaWithJSON> {
|
|
233
|
+
name: string;
|
|
74
234
|
title?: string;
|
|
75
235
|
description?: string;
|
|
76
236
|
inputSchema?: TInput;
|
|
77
|
-
outputSchema?:
|
|
237
|
+
outputSchema?: Record<string, StandardSchemaWithJSON> | StandardSchemaWithJSON;
|
|
78
238
|
annotations?: ToolAnnotations;
|
|
79
|
-
|
|
239
|
+
/**
|
|
240
|
+
* Icons for the tool, a standard MCP field. Hosts choose whether and where
|
|
241
|
+
* to show them. ChatGPT asks for them on every entrypoint tool, as a
|
|
242
|
+
* monochrome SVG on a 20x20 viewport that uses `currentColor`.
|
|
243
|
+
*/
|
|
244
|
+
icons?: Icon[];
|
|
245
|
+
view?: ViewConfig;
|
|
246
|
+
/** ChatGPT-only options. See {@link OpenAIToolConfig}. */
|
|
247
|
+
openai?: OpenAIToolConfig;
|
|
248
|
+
_meta?: ToolMeta;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* The auth face of a tool config: either the high-level `auth` shorthand or the
|
|
252
|
+
* low-level `securitySchemes` escape hatch, never both.
|
|
253
|
+
*/
|
|
254
|
+
type ToolAuthConfig = {
|
|
255
|
+
auth?: ToolAuth;
|
|
256
|
+
securitySchemes?: never;
|
|
257
|
+
} | {
|
|
258
|
+
auth?: never;
|
|
259
|
+
/**
|
|
260
|
+
* Declares which auth schemes this tool supports (e.g. `noauth`, `oauth2`).
|
|
261
|
+
* Lets clients label tools that require sign-in before calling, and pass
|
|
262
|
+
* the right scopes through the OAuth flow. Listing both `noauth` and
|
|
263
|
+
* `oauth2` signals that the tool works for anonymous callers and gives
|
|
264
|
+
* enhanced behavior to authenticated ones.
|
|
265
|
+
*/
|
|
266
|
+
securitySchemes?: SecurityScheme[];
|
|
80
267
|
};
|
|
81
|
-
type
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
268
|
+
type ToolConfig<TInput extends Record<string, StandardSchemaWithJSON> | StandardSchemaWithJSON> = ToolConfigBase<TInput> & ToolAuthConfig;
|
|
269
|
+
declare const fileEntrypointInput: {
|
|
270
|
+
file: z.ZodObject<{
|
|
271
|
+
name: z.ZodString;
|
|
272
|
+
resourceUri: z.ZodString;
|
|
273
|
+
}, z.core.$strip>;
|
|
274
|
+
};
|
|
275
|
+
type FileEntrypointInput = typeof fileEntrypointInput;
|
|
276
|
+
/** A ChatGPT file viewer, registered with `server.registerFileViewer`. */
|
|
277
|
+
export type OpenAIFileViewerConfig<TName extends string = string> = Omit<ToolConfigBase<FileEntrypointInput>, "inputSchema" | "openai" | "view"> & ToolAuthConfig & {
|
|
278
|
+
name: TName;
|
|
279
|
+
/** File extensions the viewer opens, each starting with `.`. */
|
|
280
|
+
extensions: string[];
|
|
281
|
+
view: ViewConfig;
|
|
282
|
+
/** Display modes. The file entrypoint is set from `extensions`. */
|
|
283
|
+
openai?: Omit<OpenAIToolConfig, "entrypoints">;
|
|
284
|
+
};
|
|
285
|
+
/**
|
|
286
|
+
* Optional client-supplied hints attached to `params._meta` on every tool call
|
|
287
|
+
* by the ChatGPT host. Hints only: never use for authorization, and tolerate
|
|
288
|
+
* absence.
|
|
289
|
+
* @see https://developers.openai.com/plugins/reference#_meta-fields-the-client-provides
|
|
290
|
+
*/
|
|
291
|
+
export interface ClientHintsMeta {
|
|
292
|
+
/** Requested locale (BCP-47, e.g. `"en-US"`). */
|
|
293
|
+
"openai/locale"?: string;
|
|
294
|
+
/** Browser user-agent */
|
|
295
|
+
"openai/userAgent"?: string;
|
|
296
|
+
/** Coarse user location. May be partially populated. */
|
|
297
|
+
"openai/userLocation"?: {
|
|
298
|
+
city?: string;
|
|
299
|
+
region?: string;
|
|
300
|
+
country?: string;
|
|
301
|
+
timezone?: string;
|
|
302
|
+
longitude?: number;
|
|
303
|
+
latitude?: number;
|
|
304
|
+
};
|
|
305
|
+
/** Anonymized user id. */
|
|
306
|
+
"openai/subject"?: string;
|
|
307
|
+
/** Anonymized conversation id, stable within a ChatGPT session. */
|
|
308
|
+
"openai/session"?: string;
|
|
309
|
+
/** Anonymized organization id, when the user account is part of an organization. */
|
|
310
|
+
"openai/organization"?: string;
|
|
311
|
+
/** Stable id for the currently mounted widget instance. */
|
|
312
|
+
"openai/widgetSessionId"?: string;
|
|
313
|
+
/**
|
|
314
|
+
* Set by ChatGPT desktop on tool calls from a view opened through a file
|
|
315
|
+
* entrypoint. `path` is the absolute path of the opened file. Any MCP client
|
|
316
|
+
* can send this key: never use it for authorization, and resolve the path
|
|
317
|
+
* and keep it inside an allowed directory before touching the filesystem.
|
|
318
|
+
*/
|
|
319
|
+
"openai/resource"?: {
|
|
320
|
+
path?: string;
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
type ToolHandlerExtra<TAuthExtra extends ExtraClaims = ExtraClaims> = Omit<McpExtra<TAuthExtra>, "mcpReq"> & {
|
|
324
|
+
mcpReq: Omit<McpExtra<TAuthExtra>["mcpReq"], "_meta"> & {
|
|
325
|
+
_meta?: RequestMeta & ClientHintsMeta;
|
|
326
|
+
};
|
|
327
|
+
};
|
|
328
|
+
/** Composer at-mention search, registered with `server.registerMentions`. */
|
|
329
|
+
export interface OpenAIMentionsConfig<TAuthExtra extends ExtraClaims = ExtraClaims> {
|
|
330
|
+
/** Name of the tool ChatGPT calls for each search. */
|
|
331
|
+
name: string;
|
|
332
|
+
description?: string;
|
|
333
|
+
/** Returns the items matching the typed text, which may be empty. */
|
|
334
|
+
handler: (params: {
|
|
335
|
+
query: string;
|
|
336
|
+
}, extra: ToolHandlerExtra<TAuthExtra>) => Promise<{
|
|
337
|
+
items: ResourceLink[];
|
|
338
|
+
}> | {
|
|
339
|
+
items: ResourceLink[];
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
/** One setting, registered with `server.registerSettings`. */
|
|
343
|
+
export interface OpenAISettingsField {
|
|
344
|
+
/** A boolean, string, string enum, number or integer schema, without a default. */
|
|
345
|
+
schema: z.ZodType<boolean | string | number>;
|
|
346
|
+
title: string;
|
|
347
|
+
description?: string;
|
|
348
|
+
}
|
|
349
|
+
/** Values of every setting, keyed by field name. */
|
|
350
|
+
export type OpenAISettingsValues<TFields extends Record<string, OpenAISettingsField>> = {
|
|
351
|
+
[K in keyof TFields]-?: Exclude<z.output<TFields[K]["schema"]>, undefined>;
|
|
352
|
+
};
|
|
353
|
+
/** App settings in ChatGPT, registered with `server.registerSettings`. */
|
|
354
|
+
export interface OpenAISettingsConfig<TFields extends Record<string, OpenAISettingsField>, TAuthExtra extends ExtraClaims = ExtraClaims> {
|
|
355
|
+
fields: TFields;
|
|
356
|
+
/** Sections of the settings page. Fields left out appear under "Other settings". */
|
|
357
|
+
layout?: {
|
|
358
|
+
kind: "group";
|
|
359
|
+
title: string;
|
|
360
|
+
items: ({
|
|
361
|
+
kind: "property";
|
|
362
|
+
property: Extract<keyof TFields, string>;
|
|
363
|
+
} | {
|
|
364
|
+
kind: "tool";
|
|
365
|
+
tool: string;
|
|
366
|
+
title: string;
|
|
367
|
+
description?: string;
|
|
368
|
+
})[];
|
|
369
|
+
}[];
|
|
370
|
+
/** Returns the current value of every field. */
|
|
371
|
+
read: (extra: ToolHandlerExtra<TAuthExtra>) => OpenAISettingsValues<TFields> | Promise<OpenAISettingsValues<TFields>>;
|
|
372
|
+
/** Saves the changed fields and returns the value of every field. */
|
|
373
|
+
update: (set: Partial<OpenAISettingsValues<TFields>>, extra: ToolHandlerExtra<TAuthExtra>) => OpenAISettingsValues<TFields> | Promise<OpenAISettingsValues<TFields>>;
|
|
374
|
+
/** Name of the read tool. Defaults to `settings.read`. */
|
|
375
|
+
readTool?: string;
|
|
376
|
+
/** Name of the update tool. Defaults to `settings.update`. */
|
|
377
|
+
updateTool?: string;
|
|
378
|
+
}
|
|
379
|
+
type ToolHandler<TInput extends Record<string, StandardSchemaWithJSON>, TReturn extends {
|
|
380
|
+
content?: HandlerContent;
|
|
381
|
+
} = {
|
|
382
|
+
content?: HandlerContent;
|
|
383
|
+
}, TAuthExtra extends ExtraClaims = ExtraClaims> = (args: ShapeOutput<TInput>, extra: ToolHandlerExtra<TAuthExtra>) => TReturn | InputRequiredResult | Promise<TReturn | InputRequiredResult>;
|
|
384
|
+
/**
|
|
385
|
+
* Coerce a tool handler's return value into an MCP `content` array. Strings
|
|
386
|
+
* become a single `TextContent`; a single block is wrapped in an array;
|
|
387
|
+
* `undefined` produces `[]`. Mostly used internally — exported so consumers
|
|
388
|
+
* who build content lazily can apply the same normalization.
|
|
389
|
+
*/
|
|
390
|
+
export declare function normalizeContent(content: HandlerContent | undefined): ContentBlock[];
|
|
391
|
+
interface McpServerBaseOmitted extends Omit<McpServerBase, "registerTool" | "connect"> {
|
|
392
|
+
}
|
|
393
|
+
declare const McpServerBaseOmitted: new (...args: ConstructorParameters<typeof McpServerBase>) => McpServerBaseOmitted;
|
|
394
|
+
/**
|
|
395
|
+
* Prime the build-time Vite manifest before user code constructs its
|
|
396
|
+
* `McpServer`. Called from the generated `dist/__entry.js`; not part of the
|
|
397
|
+
* user-facing API.
|
|
398
|
+
*
|
|
399
|
+
* @internal
|
|
400
|
+
*/
|
|
401
|
+
export declare function __setBuildManifest(manifest: Record<string, {
|
|
402
|
+
file: string;
|
|
403
|
+
}>): void;
|
|
404
|
+
export declare function __setSkillsManifest(manifest: SkillsManifest): void;
|
|
405
|
+
/**
|
|
406
|
+
* Typed registration sugar over the MCP SDK's `McpServer`: a tool registry
|
|
407
|
+
* that carries input/output/meta shapes, view resources, per-tool security
|
|
408
|
+
* schemes, and prompt/resource registration. A {@link Skybridge} app builds
|
|
409
|
+
* one of these per request and hands it to your `handler`; chain
|
|
410
|
+
* {@link McpServer.registerTool} calls on it and return the result.
|
|
411
|
+
*
|
|
412
|
+
* The `TTools` generic accumulates each registered tool's input/output/meta
|
|
413
|
+
* shape, so `typeof app` carries enough information for view-side helpers
|
|
414
|
+
* like {@link generateHelpers} to produce fully-typed hooks.
|
|
415
|
+
*
|
|
416
|
+
* @typeParam TTools - Accumulated tool registry. Filled in by `registerTool`
|
|
417
|
+
* chaining; you almost never set this manually.
|
|
418
|
+
*
|
|
419
|
+
* @example
|
|
420
|
+
* ```ts
|
|
421
|
+
* export const app = new Skybridge({
|
|
422
|
+
* name: "my-app",
|
|
423
|
+
* version: "1.0.0",
|
|
424
|
+
* handler: (server) =>
|
|
425
|
+
* server.registerTool({
|
|
426
|
+
* name: "search",
|
|
427
|
+
* inputSchema: { query: z.string() },
|
|
428
|
+
* view: { component: "search" },
|
|
429
|
+
* }, async ({ query }) => ({ content: `Results for ${query}` })),
|
|
430
|
+
* });
|
|
431
|
+
* ```
|
|
432
|
+
*
|
|
433
|
+
* @see https://docs.skybridge.tech/api-reference/mcp-server
|
|
434
|
+
*/
|
|
435
|
+
export declare class McpServer<TTools extends Record<string, ToolDef> = Record<never, ToolDef>, TAuthExtra extends ExtraClaims = ExtraClaims> extends McpServerBaseOmitted {
|
|
85
436
|
readonly $types: McpServerTypes<TTools>;
|
|
86
|
-
private
|
|
87
|
-
private
|
|
88
|
-
private mcpMiddlewareEntries;
|
|
89
|
-
private mcpMiddlewareApplied;
|
|
90
|
-
use(...handlers: RequestHandler[]): this;
|
|
91
|
-
use(path: string, ...handlers: RequestHandler[]): this;
|
|
437
|
+
private claimedViews;
|
|
438
|
+
private viewMetaBuilders;
|
|
92
439
|
/**
|
|
93
|
-
*
|
|
440
|
+
* Maps a view resource's query-less path to its canonical registered URI
|
|
441
|
+
* (the one carrying the `?v=` cache key). Lets `resources/read` resolve the
|
|
442
|
+
* underlying view no matter which version param the consumer sends, since
|
|
443
|
+
* the param is only a cache key, not part of the resource's identity.
|
|
94
444
|
*/
|
|
95
|
-
|
|
445
|
+
private viewUriByPath;
|
|
446
|
+
private viteManifest;
|
|
447
|
+
private oauthEnabled;
|
|
448
|
+
private resolveResourceMetadataUrl?;
|
|
449
|
+
private readonly toolSecuritySchemes;
|
|
450
|
+
private readonly userMiddlewareEntries;
|
|
451
|
+
private eventRegistry?;
|
|
452
|
+
constructor(serverInfo: Implementation, options?: ServerOptions, skybridgeOptions?: SkybridgeServerOptions);
|
|
96
453
|
/**
|
|
97
|
-
*
|
|
454
|
+
* The per-tool security schemes collected during registration, keyed by tool
|
|
455
|
+
* name. Read by the OAuth layer to decide whether anonymous requests are
|
|
456
|
+
* allowed and which schemes gate a given `tools/call`.
|
|
457
|
+
*
|
|
458
|
+
* @internal
|
|
98
459
|
*/
|
|
460
|
+
get securitySchemesByTool(): ReadonlyMap<string, SecurityScheme[] | undefined>;
|
|
461
|
+
/**
|
|
462
|
+
* Inject the resolver the app uses to build the protected-resource metadata
|
|
463
|
+
* URL, so tool handlers can emit in-band auth challenges.
|
|
464
|
+
*
|
|
465
|
+
* @internal
|
|
466
|
+
*/
|
|
467
|
+
setResourceMetadataUrlResolver(resolve: ResourceMetadataUrlResolver): this;
|
|
468
|
+
private setupSkills;
|
|
469
|
+
/** Register MCP protocol-level middleware (catch-all). */
|
|
470
|
+
mcpMiddleware(handler: McpMiddlewareFn<TAuthExtra>): this;
|
|
471
|
+
/** Register MCP protocol-level middleware for all requests (`extra` is `McpExtra`). */
|
|
99
472
|
mcpMiddleware(filter: "request", handler: (request: {
|
|
100
473
|
method: string;
|
|
101
474
|
params: Record<string, unknown>;
|
|
102
|
-
}, extra: McpExtra
|
|
103
|
-
/**
|
|
104
|
-
* Register MCP protocol-level middleware for all notifications (`extra` is `undefined`).
|
|
105
|
-
*/
|
|
475
|
+
}, extra: McpExtra<TAuthExtra>, next: () => Promise<ServerResult>) => Promise<unknown> | unknown): this;
|
|
476
|
+
/** Register MCP protocol-level middleware for all notifications (`extra` is `undefined`). */
|
|
106
477
|
mcpMiddleware(filter: "notification", handler: (request: {
|
|
107
478
|
method: string;
|
|
108
479
|
params: Record<string, unknown>;
|
|
@@ -111,7 +482,7 @@ export declare class McpServer<TTools extends Record<string, ToolDef> = Record<n
|
|
|
111
482
|
* Register MCP protocol-level middleware for an exact method.
|
|
112
483
|
* Narrows `params`, `extra`, and `next()` result based on the method string.
|
|
113
484
|
*/
|
|
114
|
-
mcpMiddleware<M extends McpMethodString>(filter: M, handler: McpTypedMiddlewareFn<M>): this;
|
|
485
|
+
mcpMiddleware<M extends McpMethodString>(filter: M, handler: McpTypedMiddlewareFn<M, TAuthExtra>): this;
|
|
115
486
|
/**
|
|
116
487
|
* Register MCP protocol-level middleware for a wildcard pattern (e.g. `"tools/*"`).
|
|
117
488
|
* `next()` returns the union of result types for matching methods.
|
|
@@ -119,29 +490,175 @@ export declare class McpServer<TTools extends Record<string, ToolDef> = Record<n
|
|
|
119
490
|
mcpMiddleware<W extends McpWildcard>(filter: W, handler: (request: {
|
|
120
491
|
method: string;
|
|
121
492
|
params: Record<string, unknown>;
|
|
122
|
-
}, extra: McpExtraFor<W>, next: () => Promise<McpResultFor<W>>) => Promise<unknown> | unknown): this;
|
|
493
|
+
}, extra: McpExtraFor<W, TAuthExtra>, next: () => Promise<McpResultFor<W>>) => Promise<unknown> | unknown): this;
|
|
123
494
|
/**
|
|
124
495
|
* Register MCP protocol-level middleware with a method filter.
|
|
125
496
|
* Filter can be an exact method (`"tools/call"`), wildcard (`"tools/*"`),
|
|
126
497
|
* category (`"request"` | `"notification"`), or an array of those.
|
|
127
498
|
*/
|
|
128
|
-
mcpMiddleware(filter: McpMiddlewareFilter, handler: McpMiddlewareFn): this;
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
private
|
|
499
|
+
mcpMiddleware(filter: McpMiddlewareFilter, handler: McpMiddlewareFn<TAuthExtra>): this;
|
|
500
|
+
/**
|
|
501
|
+
* This instance's protocol-level middleware: the framework's own entries
|
|
502
|
+
* (view `_meta` on `resources/list`, version-agnostic view resolution on
|
|
503
|
+
* `resources/read`, the top-level `securitySchemes` mirror on `tools/list`)
|
|
504
|
+
* followed by the ones registered via {@link McpServer.mcpMiddleware}.
|
|
505
|
+
*
|
|
506
|
+
* @internal
|
|
507
|
+
*/
|
|
508
|
+
protocolMiddlewareEntries(): McpMiddlewareEntry[];
|
|
509
|
+
private enforceOneToolPerView;
|
|
510
|
+
private resolveViewRequestContext;
|
|
511
|
+
private registerViewResources;
|
|
512
|
+
private registerViewResource;
|
|
513
|
+
private serveLegacyAppsSdkUrl;
|
|
514
|
+
private decorateToolHandler;
|
|
515
|
+
private computeViewVersionParam;
|
|
516
|
+
private lookupViewFile;
|
|
143
517
|
private lookupDistFile;
|
|
144
|
-
|
|
518
|
+
/**
|
|
519
|
+
* Inject the Vite manifest as a value rather than letting `readManifest()`
|
|
520
|
+
* load it from disk. Required for runtimes without a usable filesystem
|
|
521
|
+
* (Cloudflare Workers, etc.) — the user's `skybridge build` emits the
|
|
522
|
+
* manifest as a JS module which the entry imports and passes here.
|
|
523
|
+
*/
|
|
524
|
+
setViteManifest(manifest: Record<string, {
|
|
525
|
+
file: string;
|
|
526
|
+
}>): this;
|
|
145
527
|
private readManifest;
|
|
528
|
+
/**
|
|
529
|
+
* @experimental Register an MCP Events type that hosts can subscribe to, per
|
|
530
|
+
* the Triggers & Events working group draft. Skybridge serves `events/list`,
|
|
531
|
+
* `events/subscribe` and `events/unsubscribe`, checks auth and arguments,
|
|
532
|
+
* verifies the callback URL, then hands each subscription to `onSubscribe`.
|
|
533
|
+
* Delivering the events is up to you, for example with {@link deliverEvent}.
|
|
534
|
+
* API may change.
|
|
535
|
+
*
|
|
536
|
+
* @example
|
|
537
|
+
* ```ts
|
|
538
|
+
* server.registerEvent(
|
|
539
|
+
* {
|
|
540
|
+
* name: "comment.created",
|
|
541
|
+
* description: "Fires when someone comments on a document",
|
|
542
|
+
* inputSchema: { documentId: z.string() },
|
|
543
|
+
* payloadSchema: { documentId: z.string(), excerpt: z.string() },
|
|
544
|
+
* },
|
|
545
|
+
* {
|
|
546
|
+
* onSubscribe: ({ documentId }, { subscription }) =>
|
|
547
|
+
* webhooks.upsert({ ...subscription, filter: { documentId } }),
|
|
548
|
+
* onUnsubscribe: (_args, { subscription }) =>
|
|
549
|
+
* webhooks.remove(subscription.id),
|
|
550
|
+
* },
|
|
551
|
+
* );
|
|
552
|
+
* ```
|
|
553
|
+
*
|
|
554
|
+
* @see https://docs.skybridge.tech/api-reference/register-event
|
|
555
|
+
*/
|
|
556
|
+
registerEvent<TInput extends Record<string, StandardSchemaWithJSON> | StandardSchemaWithJSON = Record<never, StandardSchemaWithJSON>>(config: EventConfig<TInput>, hooks: EventHooks<InferEventSchema<TInput>, McpExtra<TAuthExtra>>): this;
|
|
557
|
+
/**
|
|
558
|
+
* Register a ChatGPT file viewer, from the OpenAI MCP extensions: a tool
|
|
559
|
+
* with a file entrypoint for `extensions` and a view. ChatGPT desktop calls
|
|
560
|
+
* it with the file the user opened, as `{ file: { name, resourceUri } }`.
|
|
561
|
+
* Read and save the file from the view with `useFileResource`.
|
|
562
|
+
*
|
|
563
|
+
* @example
|
|
564
|
+
* ```ts
|
|
565
|
+
* server.registerFileViewer(
|
|
566
|
+
* {
|
|
567
|
+
* name: "part-viewer",
|
|
568
|
+
* title: "Part Viewer",
|
|
569
|
+
* extensions: [".stl", ".step"],
|
|
570
|
+
* view: { component: "part-viewer" },
|
|
571
|
+
* },
|
|
572
|
+
* async ({ file }) => ({ structuredContent: { name: file.name } }),
|
|
573
|
+
* );
|
|
574
|
+
* ```
|
|
575
|
+
*
|
|
576
|
+
* @see https://docs.skybridge.tech/api-reference/register-file-viewer
|
|
577
|
+
*/
|
|
578
|
+
registerFileViewer<TName extends string, TReturn extends {
|
|
579
|
+
content?: HandlerContent;
|
|
580
|
+
}>(config: OpenAIFileViewerConfig<TName>, cb: ToolHandler<FileEntrypointInput, TReturn, TAuthExtra>): AddTool<TTools, TName, FileEntrypointInput, ExtractStructuredContent<TReturn>, ExtractMeta<TReturn>, TAuthExtra>;
|
|
581
|
+
/**
|
|
582
|
+
* Register the composer at-mention search for ChatGPT, from the OpenAI MCP
|
|
583
|
+
* extensions. When the user types `@` and your app name, ChatGPT calls
|
|
584
|
+
* `handler` with the typed text and lists the returned resource links.
|
|
585
|
+
* Skybridge registers it as a tool hidden from the model.
|
|
586
|
+
*
|
|
587
|
+
* @example
|
|
588
|
+
* ```ts
|
|
589
|
+
* server.registerMentions({
|
|
590
|
+
* name: "search_parts",
|
|
591
|
+
* handler: async ({ query }) => ({
|
|
592
|
+
* items: findParts(query).map((part) => ({
|
|
593
|
+
* type: "resource_link",
|
|
594
|
+
* uri: `parts://${part.id}`,
|
|
595
|
+
* name: part.name,
|
|
596
|
+
* })),
|
|
597
|
+
* }),
|
|
598
|
+
* });
|
|
599
|
+
* ```
|
|
600
|
+
*
|
|
601
|
+
* @see https://docs.skybridge.tech/api-reference/register-mentions
|
|
602
|
+
*/
|
|
603
|
+
registerMentions(config: OpenAIMentionsConfig<TAuthExtra>): this;
|
|
604
|
+
/**
|
|
605
|
+
* Register app settings for ChatGPT, from the OpenAI MCP extensions.
|
|
606
|
+
* Skybridge registers a read tool and an update tool from `fields`, and
|
|
607
|
+
* advertises them in the `openai/settings` server capability. ChatGPT shows
|
|
608
|
+
* the settings page and calls `update` with the changed fields only. Store
|
|
609
|
+
* the values yourself, for example per user.
|
|
610
|
+
*
|
|
611
|
+
* @example
|
|
612
|
+
* ```ts
|
|
613
|
+
* server.registerSettings({
|
|
614
|
+
* fields: {
|
|
615
|
+
* units: { title: "Units", schema: z.enum(["mm", "in"]) },
|
|
616
|
+
* showGrid: { title: "Show grid", schema: z.boolean() },
|
|
617
|
+
* },
|
|
618
|
+
* read: (extra) => loadSettings(extra),
|
|
619
|
+
* update: (set, extra) => saveSettings(set, extra),
|
|
620
|
+
* });
|
|
621
|
+
* ```
|
|
622
|
+
*
|
|
623
|
+
* @see https://docs.skybridge.tech/api-reference/register-settings
|
|
624
|
+
*/
|
|
625
|
+
registerSettings<TFields extends Record<string, OpenAISettingsField>>(config: OpenAISettingsConfig<TFields, TAuthExtra>): this;
|
|
626
|
+
/**
|
|
627
|
+
* Register a tool. Pass a `config` describing the tool (name, schemas,
|
|
628
|
+
* optional {@link ViewConfig}, optional {@link ToolMeta}) and a handler that
|
|
629
|
+
* returns the tool's result.
|
|
630
|
+
*
|
|
631
|
+
* Chain calls to build up a server: each call returns a new `McpServer`
|
|
632
|
+
* type that captures the tool's input/output/`_meta` shape so the
|
|
633
|
+
* resulting `typeof server` can drive {@link generateHelpers}.
|
|
634
|
+
*
|
|
635
|
+
* The handler's return shape determines the output types: the
|
|
636
|
+
* `structuredContent` field becomes the tool's typed output, and `_meta`
|
|
637
|
+
* becomes its `responseMetadata`. The `content` field is normalized through
|
|
638
|
+
* {@link normalizeContent}.
|
|
639
|
+
*
|
|
640
|
+
* @example
|
|
641
|
+
* ```ts
|
|
642
|
+
* server.registerTool({
|
|
643
|
+
* name: "search",
|
|
644
|
+
* inputSchema: { query: z.string() },
|
|
645
|
+
* outputSchema: { results: z.array(z.string()) },
|
|
646
|
+
* view: { component: "search" },
|
|
647
|
+
* }, async ({ query }) => ({
|
|
648
|
+
* content: `Found results for ${query}`,
|
|
649
|
+
* structuredContent: { results: [...] },
|
|
650
|
+
* }));
|
|
651
|
+
* ```
|
|
652
|
+
*
|
|
653
|
+
* @see https://docs.skybridge.tech/api-reference/register-tool
|
|
654
|
+
*/
|
|
655
|
+
registerTool<TName extends string, InputArgs extends Record<string, StandardSchemaWithJSON>, TReturn extends {
|
|
656
|
+
content?: HandlerContent;
|
|
657
|
+
}>(config: ToolConfig<InputArgs> & {
|
|
658
|
+
name: TName;
|
|
659
|
+
}, cb: ToolHandler<InputArgs, TReturn, TAuthExtra>): AddTool<TTools, TName, InputArgs, ExtractStructuredContent<TReturn>, ExtractMeta<TReturn>, TAuthExtra>;
|
|
660
|
+
registerTool<InputArgs extends Record<string, StandardSchemaWithJSON>>(config: ToolConfig<InputArgs>, cb: ToolHandler<InputArgs, {
|
|
661
|
+
content?: HandlerContent;
|
|
662
|
+
}, TAuthExtra>): this;
|
|
146
663
|
}
|
|
147
664
|
export {};
|