skybridge 0.0.0-dev.fec1c58 → 0.0.0-dev.fef24cf
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 +123 -116
- package/dist/cli/detect-port.d.ts +18 -0
- package/dist/cli/detect-port.js +61 -0
- package/dist/cli/detect-port.js.map +1 -0
- package/dist/cli/header.js +1 -1
- package/dist/cli/header.js.map +1 -1
- package/dist/cli/run-command.js.map +1 -1
- 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.d.ts +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.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 +2 -6
- package/dist/cli/use-nodemon.js +18 -14
- 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 +1 -0
- package/dist/cli/use-typescript-check.js +42 -7
- package/dist/cli/use-typescript-check.js.map +1 -1
- package/dist/commands/build.js +63 -7
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/create.d.ts +9 -0
- package/dist/commands/create.js +30 -0
- package/dist/commands/create.js.map +1 -0
- package/dist/commands/dev.d.ts +4 -1
- package/dist/commands/dev.js +57 -8
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/start.d.ts +3 -1
- package/dist/commands/start.js +30 -9
- 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/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.d.ts +20 -0
- package/dist/server/auth.js +28 -0
- package/dist/server/auth.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 +7 -5
- package/dist/server/express.js +60 -28
- package/dist/server/express.js.map +1 -1
- package/dist/server/express.test.js +381 -25
- package/dist/server/express.test.js.map +1 -1
- package/dist/server/file-ref.d.ts +28 -0
- package/dist/server/file-ref.js +27 -0
- package/dist/server/file-ref.js.map +1 -0
- package/dist/server/index.d.ts +7 -3
- package/dist/server/index.js +5 -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/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 +137 -0
- package/dist/server/middleware.js +93 -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 +493 -0
- package/dist/server/middleware.test.js.map +1 -0
- package/dist/server/server.d.ts +358 -69
- package/dist/server/server.js +469 -102
- package/dist/server/server.js.map +1 -1
- package/dist/server/templateHelper.d.ts +5 -8
- package/dist/server/templateHelper.js +3 -22
- package/dist/server/templateHelper.js.map +1 -1
- package/dist/server/templates.generated.d.ts +4 -0
- package/dist/server/templates.generated.js +47 -0
- package/dist/server/templates.generated.js.map +1 -0
- package/dist/server/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/viewsDevServer.d.ts +14 -0
- package/dist/server/viewsDevServer.js +45 -0
- package/dist/server/viewsDevServer.js.map +1 -0
- package/dist/test/utils.d.ts +16 -244
- package/dist/test/utils.js +42 -37
- package/dist/test/utils.js.map +1 -1
- package/dist/test/view.test.d.ts +1 -0
- package/dist/test/view.test.js +568 -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/web/bridges/apps-sdk/adaptor.d.ts +13 -7
- package/dist/web/bridges/apps-sdk/adaptor.js +62 -29
- package/dist/web/bridges/apps-sdk/adaptor.js.map +1 -1
- package/dist/web/bridges/apps-sdk/bridge.d.ts +2 -1
- package/dist/web/bridges/apps-sdk/bridge.js +1 -0
- package/dist/web/bridges/apps-sdk/bridge.js.map +1 -1
- package/dist/web/bridges/apps-sdk/index.d.ts +1 -1
- package/dist/web/bridges/apps-sdk/index.js.map +1 -1
- package/dist/web/bridges/apps-sdk/types.d.ts +26 -11
- 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 +7 -0
- package/dist/web/bridges/get-adaptor.js.map +1 -1
- package/dist/web/bridges/index.js.map +1 -1
- package/dist/web/bridges/mcp-app/adaptor.d.ts +25 -9
- package/dist/web/bridges/mcp-app/adaptor.js +156 -66
- package/dist/web/bridges/mcp-app/adaptor.js.map +1 -1
- package/dist/web/bridges/mcp-app/bridge.d.ts +14 -30
- package/dist/web/bridges/mcp-app/bridge.js +44 -196
- package/dist/web/bridges/mcp-app/bridge.js.map +1 -1
- package/dist/web/bridges/mcp-app/index.js.map +1 -1
- package/dist/web/bridges/mcp-app/types.js.map +1 -1
- package/dist/web/bridges/mcp-app/use-mcp-app-context.d.ts +17 -3
- package/dist/web/bridges/mcp-app/use-mcp-app-context.js +14 -2
- package/dist/web/bridges/mcp-app/use-mcp-app-context.js.map +1 -1
- package/dist/web/bridges/mcp-app/use-mcp-app-context.test.js +1 -41
- package/dist/web/bridges/mcp-app/use-mcp-app-context.test.js.map +1 -1
- package/dist/web/bridges/types.d.ts +87 -14
- package/dist/web/bridges/types.js.map +1 -1
- 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.js +3 -5
- 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 +21 -18
- package/dist/web/create-store.test.js.map +1 -1
- package/dist/web/data-llm.d.ts +34 -1
- package/dist/web/data-llm.js +31 -3
- package/dist/web/data-llm.js.map +1 -1
- package/dist/web/data-llm.test.js +24 -23
- package/dist/web/data-llm.test.js.map +1 -1
- package/dist/web/generate-helpers.d.ts +22 -18
- package/dist/web/generate-helpers.js +22 -18
- package/dist/web/generate-helpers.js.map +1 -1
- package/dist/web/generate-helpers.test-d.js +26 -26
- package/dist/web/generate-helpers.test-d.js.map +1 -1
- 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 +5 -2
- package/dist/web/hooks/index.js +4 -1
- package/dist/web/hooks/index.js.map +1 -1
- package/dist/web/hooks/test/utils.d.ts +6 -2
- package/dist/web/hooks/test/utils.js +17 -2
- package/dist/web/hooks/test/utils.js.map +1 -1
- package/dist/web/hooks/use-call-tool.d.ts +45 -0
- package/dist/web/hooks/use-call-tool.js +28 -0
- package/dist/web/hooks/use-call-tool.js.map +1 -1
- package/dist/web/hooks/use-call-tool.test-d.js.map +1 -1
- package/dist/web/hooks/use-call-tool.test.js +27 -6
- package/dist/web/hooks/use-call-tool.test.js.map +1 -1
- package/dist/web/hooks/use-display-mode.d.ts +23 -3
- package/dist/web/hooks/use-display-mode.js +20 -0
- package/dist/web/hooks/use-display-mode.js.map +1 -1
- package/dist/web/hooks/use-display-mode.test-d.d.ts +1 -0
- package/dist/web/hooks/use-display-mode.test-d.js +8 -0
- package/dist/web/hooks/use-display-mode.test-d.js.map +1 -0
- package/dist/web/hooks/use-display-mode.test.js.map +1 -1
- package/dist/web/hooks/use-download.d.ts +5 -0
- package/dist/web/hooks/use-download.js +8 -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 +95 -0
- package/dist/web/hooks/use-download.test.js.map +1 -0
- package/dist/web/hooks/use-files.d.ts +34 -1
- package/dist/web/hooks/use-files.js +33 -0
- package/dist/web/hooks/use-files.js.map +1 -1
- package/dist/web/hooks/use-files.test.js +22 -2
- package/dist/web/hooks/use-files.test.js.map +1 -1
- package/dist/web/hooks/use-layout.d.ts +2 -0
- package/dist/web/hooks/use-layout.js +2 -0
- package/dist/web/hooks/use-layout.js.map +1 -1
- package/dist/web/hooks/use-layout.test.js +3 -3
- package/dist/web/hooks/use-layout.test.js.map +1 -1
- package/dist/web/hooks/use-open-external.d.ts +20 -1
- package/dist/web/hooks/use-open-external.js +17 -1
- package/dist/web/hooks/use-open-external.js.map +1 -1
- package/dist/web/hooks/use-open-external.test.js +26 -11
- package/dist/web/hooks/use-open-external.test.js.map +1 -1
- 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 +52 -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 +5 -1
- 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 +65 -0
- package/dist/web/hooks/use-request-size.test.js.map +1 -0
- package/dist/web/hooks/use-send-follow-up-message.d.ts +19 -1
- package/dist/web/hooks/use-send-follow-up-message.js +19 -2
- package/dist/web/hooks/use-send-follow-up-message.js.map +1 -1
- package/dist/web/hooks/use-set-open-in-app-url.d.ts +17 -0
- package/dist/web/hooks/use-set-open-in-app-url.js +17 -0
- package/dist/web/hooks/use-set-open-in-app-url.js.map +1 -1
- package/dist/web/hooks/use-set-open-in-app-url.test.js +5 -11
- package/dist/web/hooks/use-set-open-in-app-url.test.js.map +1 -1
- package/dist/web/hooks/use-tool-info.d.ts +33 -0
- package/dist/web/hooks/use-tool-info.js +26 -0
- package/dist/web/hooks/use-tool-info.js.map +1 -1
- package/dist/web/hooks/use-tool-info.test-d.js.map +1 -1
- package/dist/web/hooks/use-tool-info.test.js +1 -1
- package/dist/web/hooks/use-tool-info.test.js.map +1 -1
- package/dist/web/hooks/use-user.d.ts +2 -0
- package/dist/web/hooks/use-user.js +20 -2
- package/dist/web/hooks/use-user.js.map +1 -1
- package/dist/web/hooks/use-user.test.js +29 -1
- 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 +32 -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 +177 -0
- package/dist/web/hooks/use-view-state.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 +20 -0
- package/dist/web/{mount-widget.js → mount-view.js} +21 -2
- package/dist/web/mount-view.js.map +1 -0
- package/dist/web/plugin/data-llm.test.js.map +1 -1
- package/dist/web/plugin/plugin.d.ts +32 -1
- package/dist/web/plugin/plugin.js +161 -18
- package/dist/web/plugin/plugin.js.map +1 -1
- package/dist/web/plugin/scan-views.d.ts +16 -0
- package/dist/web/plugin/scan-views.js +88 -0
- package/dist/web/plugin/scan-views.js.map +1 -0
- package/dist/web/plugin/scan-views.test.d.ts +1 -0
- package/dist/web/plugin/scan-views.test.js +99 -0
- package/dist/web/plugin/scan-views.test.js.map +1 -0
- package/dist/web/plugin/transform-data-llm.js +1 -1
- package/dist/web/plugin/transform-data-llm.js.map +1 -1
- package/dist/web/plugin/transform-data-llm.test.js.map +1 -1
- package/dist/web/plugin/validate-view.d.ts +1 -0
- package/dist/web/plugin/validate-view.js +9 -0
- package/dist/web/plugin/validate-view.js.map +1 -0
- package/dist/web/plugin/validate-view.test.d.ts +1 -0
- package/dist/web/plugin/validate-view.test.js +24 -0
- package/dist/web/plugin/validate-view.test.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 +42 -25
- package/tsconfig.base.json +33 -0
- package/dist/server/templates/development.hbs +0 -67
- package/dist/server/templates/production.hbs +0 -6
- package/dist/server/widgetsDevServer.d.ts +0 -12
- package/dist/server/widgetsDevServer.js +0 -57
- package/dist/server/widgetsDevServer.js.map +0 -1
- package/dist/test/widget.test.js +0 -261
- package/dist/test/widget.test.js.map +0 -1
- package/dist/web/hooks/use-widget-state.d.ts +0 -4
- package/dist/web/hooks/use-widget-state.js +0 -32
- package/dist/web/hooks/use-widget-state.js.map +0 -1
- package/dist/web/hooks/use-widget-state.test.js +0 -62
- package/dist/web/hooks/use-widget-state.test.js.map +0 -1
- package/dist/web/mount-widget.d.ts +0 -1
- package/dist/web/mount-widget.js.map +0 -1
- /package/dist/{test/widget.test.d.ts → cli/tunnel-control-server.test.d.ts} +0 -0
- /package/dist/{web/hooks/use-widget-state.test.d.ts → cli/tunnel-handler.test.d.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/server/server.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,IA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,IAAI,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;QACnD,CAAC;QAED,MAAM,SAAS,GAAG,IAAI,CAAC,WAAW,CAAC,EAAE,EAAE,EAAE,cAAc,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAE1E,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,GAAG,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,SAAS,CAAC,CAAC;QAEvE,OAAO,IAAI,CAAC;IACd,CAAC;CACF","sourcesContent":["import crypto from \"node:crypto\";\nimport { readFileSync } from \"node:fs\";\nimport http from \"node:http\";\nimport path from \"node:path\";\nimport type {\n McpUiResourceMeta,\n McpUiToolMeta,\n} from \"@modelcontextprotocol/ext-apps\";\nimport {\n Server as SdkServer,\n type ServerOptions,\n} from \"@modelcontextprotocol/sdk/server/index.js\";\nimport { McpServer as McpServerBase } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport type {\n AnySchema,\n SchemaOutput,\n ZodRawShapeCompat,\n} from \"@modelcontextprotocol/sdk/server/zod-compat.js\";\nimport type { RequestHandlerExtra } from \"@modelcontextprotocol/sdk/shared/protocol.js\";\nimport type {\n ContentBlock,\n Implementation,\n RequestMeta,\n ServerNotification,\n ServerRequest,\n ServerResult,\n ToolAnnotations,\n} from \"@modelcontextprotocol/sdk/types.js\";\nimport { mergeWith, union } from \"es-toolkit\";\nimport express, {\n type ErrorRequestHandler,\n type Express,\n type RequestHandler,\n} from \"express\";\nimport { createApp } from \"./express.js\";\nimport { createMiddlewareEntry } from \"./metric.js\";\nimport type {\n McpExtra,\n McpExtraFor,\n McpMethodString,\n McpMiddlewareEntry,\n McpMiddlewareFilter,\n McpMiddlewareFn,\n McpResultFor,\n McpTypedMiddlewareFn,\n McpWildcard,\n} from \"./middleware.js\";\nimport { buildMiddlewareChain, getHandlerMaps } from \"./middleware.js\";\nimport { templateHelper } from \"./templateHelper.js\";\n\nconst mergeWithUnion = <T extends object, S extends object>(\n target: T,\n source: S,\n): T & S => {\n return mergeWith(target, source, (targetVal, sourceVal) => {\n if (Array.isArray(targetVal) && Array.isArray(sourceVal)) {\n return union(targetVal, sourceVal);\n }\n });\n};\n\n/**\n * Type marker for a registered tool — carries its input, output, and response\n * metadata shapes so views can infer types from `typeof server`.\n *\n * You normally never construct this by hand; it is produced by `registerTool`\n * and consumed by helpers like {@link InferTools} and {@link generateHelpers}.\n */\nexport type ToolDef<\n TInput = unknown,\n TOutput = unknown,\n TResponseMetadata = unknown,\n> = {\n input: TInput;\n output: TOutput;\n responseMetadata: TResponseMetadata;\n};\n\n/** Which host runtime a view targets — `\"apps-sdk\"` (ChatGPT) or `\"mcp-app\"` (MCP Apps spec). */\nexport type ViewHostType = \"apps-sdk\" | \"mcp-app\";\n\n/**\n * Content Security Policy origins attached to a view's resource. Each list is\n * passed through to the host's CSP for the view iframe; omit a field to inherit\n * the host's default for that directive.\n */\nexport interface ViewCsp {\n /** Origins for static assets (images, fonts, scripts, styles). */\n resourceDomains?: string[];\n /** Origins the view may contact via fetch/XHR. */\n connectDomains?: string[];\n /** Origins allowed for iframe embeds (opts into stricter app review). */\n frameDomains?: string[];\n /** Origins that can receive openExternal redirects without the safe-link modal. */\n redirectDomains?: string[];\n /** Origins allowed in `<base href>` tags (mcp-apps only). */\n baseUriDomains?: string[];\n}\n\n/**\n * Registry of view component names. The Skybridge Vite plugin augments this\n * interface in the generated `.skybridge/views.d.ts` with one key per view\n * file, which narrows {@link ViewName} from `string` to the concrete union.\n */\n// Must be exported: TS module augmentation only merges with exported\n// declarations. Without `export`, `.skybridge/views.d.ts` augmentation\n// would create a separate interface and `ViewName` would stay `string`.\n// biome-ignore lint/suspicious/noEmptyInterface: register pattern — augmented by `.skybridge/views.d.ts` to narrow ViewName\nexport interface ViewNameRegistry {}\n\n/** Union of valid view component names. Narrowed by {@link ViewNameRegistry}. */\nexport type ViewName = keyof ViewNameRegistry & string;\n\n/**\n * Pass under `view` in a tool's `registerTool` config to render the tool's\n * result through a Skybridge view instead of a plain text response.\n */\nexport interface ViewConfig {\n /** Filename of the view module (without extension) — matches a file in your `viewsDir`. */\n component: ViewName;\n /** Human-readable label the host may show alongside the view. */\n description?: string;\n /** Restrict where the view is rendered. Defaults to all known hosts. */\n hosts?: ViewHostType[];\n /** Apps SDK only: request a visible border around the widget. */\n prefersBorder?: boolean;\n /** Apps SDK only: override the iframe's served domain (advanced). */\n domain?: string;\n /** Per-view CSP overrides — see {@link ViewCsp}. */\n csp?: ViewCsp;\n /** Free-form metadata forwarded on the view resource's `_meta`. */\n _meta?: Record<string, unknown>;\n}\n\nexport type SecurityScheme =\n | { type: \"noauth\" }\n | { type: \"oauth2\"; scopes?: string[] };\n\n/**\n * Well-known keys recognized by host runtimes when set on a tool's `_meta`.\n * Use {@link ToolMeta} to also pass arbitrary custom metadata alongside these.\n *\n * @see https://developers.openai.com/apps-sdk/reference#tool-descriptor-parameters\n */\nexport interface KnownToolMeta {\n /** Apps SDK: allow the rendered view to call this tool from inside its iframe. */\n \"openai/widgetAccessible\"?: boolean;\n /** Apps SDK: status text shown while the tool is running (e.g. `\"Searching trips\"`). */\n \"openai/toolInvocation/invoking\"?: string;\n /** Apps SDK: status text shown once the tool returns (e.g. `\"Found 3 trips\"`). */\n \"openai/toolInvocation/invoked\"?: string;\n /** Apps SDK: input parameters that hold file references — the host attaches uploaded files to them. */\n \"openai/fileParams\"?: string[];\n /** MCP Apps: control whether the tool is exposed to the model, the app, or both. */\n ui?: Pick<McpUiToolMeta, \"visibility\">;\n securitySchemes?: SecurityScheme[];\n}\n\n/** {@link KnownToolMeta} merged with arbitrary string-keyed metadata for custom flags. */\nexport type ToolMeta = KnownToolMeta & Record<string, unknown>;\n\n/**\n * Convenient return type for tool handlers — a plain string, a single\n * {@link ContentBlock}, or an array. Skybridge normalizes it to the MCP\n * `content: ContentBlock[]` shape before responding.\n */\nexport type HandlerContent = string | ContentBlock | ContentBlock[];\n\n/** @see https://developers.openai.com/apps-sdk/reference#tool-descriptor-parameters */\ntype ViteManifestEntry = {\n file: string;\n name?: string;\n src?: string;\n isEntry?: boolean;\n isDynamicEntry?: boolean;\n css?: string[];\n assets?: string[];\n imports?: string[];\n dynamicImports?: string[];\n};\n\ntype OpenaiToolMeta = {\n \"openai/outputTemplate\": string;\n \"openai/widgetAccessible\"?: boolean;\n \"openai/toolInvocation/invoking\"?: string;\n \"openai/toolInvocation/invoked\"?: string;\n \"openai/fileParams\"?: string[];\n};\n\n/** @see https://github.com/modelcontextprotocol/ext-apps/blob/main/specification/draft/apps.mdx#resource-discovery */\ntype McpAppsToolMeta = {\n ui: McpUiToolMeta;\n};\n\ntype SecuritySchemesToolMeta = {\n securitySchemes: SecurityScheme[];\n};\n\ntype InternalToolMeta = Partial<\n OpenaiToolMeta & McpAppsToolMeta & SecuritySchemesToolMeta\n>;\n\n/** @see https://developers.openai.com/apps-sdk/reference#component-resource-_meta-fields */\ntype OpenaiViewCSP = {\n connect_domains: string[];\n resource_domains: string[];\n frame_domains?: string[];\n redirect_domains?: string[];\n};\n\ntype OpenaiResourceMeta = {\n \"openai/widgetDescription\"?: string;\n \"openai/widgetPrefersBorder\"?: boolean;\n \"openai/widgetCSP\"?: OpenaiViewCSP;\n \"openai/widgetDomain\"?: string;\n};\n\n/**\n * MCP Apps CSP extended with upcoming / Skybridge-specific fields.\n * @see https://github.com/modelcontextprotocol/ext-apps/pull/158\n */\ntype ExtendedMcpUiResourceCsp = McpUiResourceMeta[\"csp\"] & {\n /**\n * Origins that can receive openExternal redirects without the safe-link modal.\n * OpenAI-specific; mirrored into the mcp-apps CSP for cross-host parity.\n * @see https://developers.openai.com/apps-sdk/reference#component-resource-_meta-fields\n */\n redirectDomains?: string[];\n};\n\ntype ExtendedMcpUiResourceMeta = Omit<McpUiResourceMeta, \"csp\"> & {\n csp?: ExtendedMcpUiResourceCsp;\n};\n\ntype McpAppsResourceMeta = {\n ui?: ExtendedMcpUiResourceMeta;\n};\n\ntype ResourceMeta = OpenaiResourceMeta | McpAppsResourceMeta;\n\ntype ViewResourceConfig<T extends ResourceMeta = ResourceMeta> = {\n hostType: ViewHostType;\n uri: string;\n mimeType: string;\n buildContentMeta: (\n defaults: {\n resourceDomains: string[];\n connectDomains: string[];\n domain: string;\n baseUriDomains: string[];\n },\n overrides: { domain?: string },\n ) => T;\n};\n\n/**\n * Type-level marker interface for cross-package type inference.\n *\n * Consumers infer tool types via the structural `$types` property rather than\n * the `McpServer` class generic, because class-generic inference breaks when\n * `McpServer` comes from different package installations (e.g. a consumer\n * with its own `skybridge` dep vs. the in-tree workspace version).\n *\n * Inspired by tRPC's `_def` pattern and Hono's type markers.\n */\nexport interface McpServerTypes<TTools extends Record<string, ToolDef>> {\n readonly tools: TTools;\n}\n\ntype Simplify<T> = { [K in keyof T]: T[K] };\n\ntype ShapeOutput<Shape extends ZodRawShapeCompat> = Simplify<\n {\n [K in keyof Shape as undefined extends SchemaOutput<Shape[K]>\n ? never\n : K]: SchemaOutput<Shape[K]>;\n } & {\n [K in keyof Shape as undefined extends SchemaOutput<Shape[K]>\n ? K\n : never]?: SchemaOutput<Shape[K]>;\n }\n>;\n\ntype ExtractStructuredContent<T> = T extends { structuredContent: infer SC }\n ? Simplify<SC>\n : never;\n\ntype ExtractMeta<T> = [Extract<T, { _meta: unknown }>] extends [never]\n ? unknown\n : Extract<T, { _meta: unknown }> extends { _meta: infer M }\n ? Simplify<M>\n : unknown;\n\ntype AddTool<\n TTools,\n TName extends string,\n TInput extends ZodRawShapeCompat,\n TOutput,\n TResponseMetadata = unknown,\n> = McpServer<\n TTools & {\n [K in TName]: ToolDef<ShapeOutput<TInput>, TOutput, TResponseMetadata>;\n }\n>;\n\ninterface ToolConfig<TInput extends ZodRawShapeCompat | AnySchema> {\n name: string;\n title?: string;\n description?: string;\n inputSchema?: TInput;\n outputSchema?: ZodRawShapeCompat | AnySchema;\n annotations?: ToolAnnotations;\n view?: ViewConfig;\n /**\n * Declares which auth schemes this tool supports (e.g. `noauth`, `oauth2`).\n * Lets clients label tools that require sign-in before calling, and pass\n * the right scopes through the OAuth flow. Listing both `noauth` and\n * `oauth2` signals that the tool works for anonymous callers and gives\n * enhanced behavior to authenticated ones.\n */\n securitySchemes?: SecurityScheme[];\n _meta?: ToolMeta;\n}\n\n/**\n * Optional client-supplied hints attached to `params._meta` on every tool call\n * by the Apps SDK host. Hints only: never use for authorization, and tolerate\n * absence.\n * @see https://developers.openai.com/apps-sdk/reference#_meta-fields-the-client-provides\n */\nexport interface ClientHintsMeta {\n /** Requested locale (BCP-47, e.g. `\"en-US\"`). */\n \"openai/locale\"?: string;\n /** Browser user-agent */\n \"openai/userAgent\"?: string;\n /** Coarse user location. May be partially populated. */\n \"openai/userLocation\"?: {\n city?: string;\n region?: string;\n country?: string;\n timezone?: string;\n longitude?: number;\n latitude?: number;\n };\n /** Anonymized user id. */\n \"openai/subject\"?: string;\n /** Anonymized conversation id, stable within a ChatGPT session. */\n \"openai/session\"?: string;\n /** Anonymized organization id, when the user account is part of an organization. */\n \"openai/organization\"?: string;\n /** Stable id for the currently mounted widget instance. */\n \"openai/widgetSessionId\"?: string;\n}\n\ntype ToolHandlerExtra = Omit<\n RequestHandlerExtra<ServerRequest, ServerNotification>,\n \"_meta\"\n> & {\n _meta?: RequestMeta & ClientHintsMeta;\n};\n\ntype ToolHandler<\n TInput extends ZodRawShapeCompat,\n TReturn extends { content?: HandlerContent } = { content?: HandlerContent },\n> = (\n args: ShapeOutput<TInput>,\n extra: ToolHandlerExtra,\n) => TReturn | Promise<TReturn>;\n\ntype ErrorMiddlewareConfig = {\n path?: string;\n handlers: ErrorRequestHandler[];\n};\n\n/**\n * Coerce a tool handler's return value into an MCP `content` array. Strings\n * become a single `TextContent`; a single block is wrapped in an array;\n * `undefined` produces `[]`. Mostly used internally — exported so consumers\n * who build content lazily can apply the same normalization.\n */\nexport function normalizeContent(\n content: HandlerContent | undefined,\n): ContentBlock[] {\n if (content === undefined) {\n return [];\n }\n if (typeof content === \"string\") {\n return [{ type: \"text\", text: content }];\n }\n if (Array.isArray(content)) {\n return content;\n }\n return [content];\n}\n\n// We Omit `registerTool` from the base class at the type level so our\n// unified 2-arg signature can replace the SDK's 3-arg one without an\n// incompatible override. The runtime prototype chain is unaffected.\ninterface McpServerBaseOmitted\n extends Omit<McpServerBase, \"registerTool\" | \"connect\"> {}\nconst McpServerBaseOmitted = McpServerBase as unknown as new (\n ...args: ConstructorParameters<typeof McpServerBase>\n) => McpServerBaseOmitted;\n\n/**\n * The Skybridge server. Extends the MCP SDK's `McpServer` with a typed tool\n * registry, view resources, an embedded Express app, and protocol-level\n * middleware. Construct it with the same `Implementation` info you would pass\n * to the SDK, chain {@link McpServer.registerTool} calls to declare tools,\n * then call {@link McpServer.run} to start the HTTP server.\n *\n * The `TTools` generic accumulates each registered tool's input/output/meta\n * shape, so `typeof server` carries enough information for view-side helpers\n * like {@link generateHelpers} to produce fully-typed hooks.\n *\n * @typeParam TTools - Accumulated tool registry. Filled in by `registerTool`\n * chaining; you almost never set this manually.\n *\n * @example\n * ```ts\n * const server = new McpServer({ name: \"my-app\", version: \"1.0.0\" }, {})\n * .registerTool({\n * name: \"search\",\n * inputSchema: { query: z.string() },\n * view: { component: \"search\" },\n * }, async ({ query }) => ({ content: `Results for ${query}` }));\n *\n * await server.run();\n * export type AppType = typeof server;\n * ```\n *\n * @see https://docs.skybridge.tech/api-reference/mcp-server\n */\nexport class McpServer<\n TTools extends Record<string, ToolDef> = Record<never, ToolDef>,\n> extends McpServerBaseOmitted {\n declare readonly $types: McpServerTypes<TTools>;\n /**\n * The underlying Express app. Use this to extend the HTTP server with\n * custom routes, middleware, or settings — e.g.\n * `server.express.get(\"/health\", ...)`.\n *\n * `express.json()` is pre-applied. Register your handlers before `run()`;\n * after `run()`, dev-mode middleware, the `/mcp` route, and the default\n * error handler are appended in that order.\n *\n * Note: Alpic Cloud only routes traffic to `/mcp` — custom routes work\n * locally and on self-hosted deployments.\n */\n readonly express: Express;\n private customErrorMiddleware: ErrorMiddlewareConfig[] = [];\n private mcpMiddlewareEntries: McpMiddlewareEntry[] = [];\n private mcpMiddlewareApplied = false;\n private claimedViews = new Map<string, string>();\n private viewMetaBuilders = new Map<\n string,\n (extra: McpExtra | undefined) => ResourceMeta\n >();\n private viteManifest: Record<string, ViteManifestEntry> | null = null;\n private readonly serverInfo: Implementation;\n private readonly serverOptions?: ServerOptions;\n\n constructor(serverInfo: Implementation, options?: ServerOptions) {\n super(serverInfo, options);\n this.serverInfo = serverInfo;\n this.serverOptions = options;\n this.express = express();\n this.express.use(express.json());\n }\n\n /**\n * Register Express middleware on the underlying app. Mirrors `app.use` —\n * pass handlers directly or a path-prefixed handler list. Register before\n * {@link McpServer.run}; ordering matches Express.\n *\n * Note: Alpic Cloud only routes traffic to `/mcp`. Custom paths work\n * locally and on self-hosted deployments.\n */\n use(...handlers: RequestHandler[]): this;\n use(path: string, ...handlers: RequestHandler[]): this;\n use(\n pathOrHandler: string | RequestHandler,\n ...handlers: RequestHandler[]\n ): this {\n // Branching is load-bearing: Express's `app.use` overloads can't be\n // resolved against a `string | RequestHandler` union, so we narrow.\n if (typeof pathOrHandler === \"string\") {\n this.express.use(pathOrHandler, ...handlers);\n } else {\n this.express.use(pathOrHandler, ...handlers);\n }\n return this;\n }\n\n /**\n * Register Express error-handling middleware to run after the built-in\n * `/mcp` route (or your custom route). Use this to log or transform errors\n * thrown by tool handlers before the default error handler responds.\n *\n * @example\n * ```ts\n * server.useOnError((err, _req, _res, next) => {\n * logger.error(err);\n * next(err);\n * });\n * ```\n */\n useOnError(...handlers: ErrorRequestHandler[]): this;\n useOnError(path: string, ...handlers: ErrorRequestHandler[]): this;\n useOnError(\n pathOrHandler: string | ErrorRequestHandler,\n ...handlers: ErrorRequestHandler[]\n ): this {\n if (typeof pathOrHandler === \"string\") {\n this.customErrorMiddleware.push({ path: pathOrHandler, handlers });\n } else {\n this.customErrorMiddleware.push({\n handlers: [pathOrHandler, ...handlers],\n });\n }\n return this;\n }\n\n /** Register MCP protocol-level middleware (catch-all). */\n mcpMiddleware(handler: McpMiddlewareFn): this;\n /** Register MCP protocol-level middleware for all requests (`extra` is `McpExtra`). */\n mcpMiddleware(\n filter: \"request\",\n handler: (\n request: { method: string; params: Record<string, unknown> },\n extra: McpExtra,\n next: () => Promise<ServerResult>,\n ) => Promise<unknown> | unknown,\n ): this;\n /** Register MCP protocol-level middleware for all notifications (`extra` is `undefined`). */\n mcpMiddleware(\n filter: \"notification\",\n handler: (\n request: { method: string; params: Record<string, unknown> },\n extra: undefined,\n next: () => Promise<undefined>,\n ) => Promise<unknown> | unknown,\n ): this;\n /**\n * Register MCP protocol-level middleware for an exact method.\n * Narrows `params`, `extra`, and `next()` result based on the method string.\n */\n mcpMiddleware<M extends McpMethodString>(\n filter: M,\n handler: McpTypedMiddlewareFn<M>,\n ): this;\n /**\n * Register MCP protocol-level middleware for a wildcard pattern (e.g. `\"tools/*\"`).\n * `next()` returns the union of result types for matching methods.\n */\n mcpMiddleware<W extends McpWildcard>(\n filter: W,\n handler: (\n request: { method: string; params: Record<string, unknown> },\n extra: McpExtraFor<W>,\n next: () => Promise<McpResultFor<W>>,\n ) => Promise<unknown> | unknown,\n ): this;\n /**\n * Register MCP protocol-level middleware with a method filter.\n * Filter can be an exact method (`\"tools/call\"`), wildcard (`\"tools/*\"`),\n * category (`\"request\"` | `\"notification\"`), or an array of those.\n */\n mcpMiddleware(filter: McpMiddlewareFilter, handler: McpMiddlewareFn): this;\n mcpMiddleware(\n filterOrHandler: McpMiddlewareFilter | McpMiddlewareFn,\n // biome-ignore lint/suspicious/noExplicitAny: overloads narrow the handler type at call sites; implementation must accept all variants\n maybeHandler?: any,\n ): this {\n if (this.mcpMiddlewareApplied) {\n throw new Error(\n \"Cannot register MCP middleware after run() or connect() has been called\",\n );\n }\n\n const handler = maybeHandler as McpMiddlewareFn | undefined;\n\n if (typeof filterOrHandler === \"function\") {\n this.mcpMiddlewareEntries.push({\n filter: null,\n handler: filterOrHandler,\n });\n } else if (handler) {\n this.mcpMiddlewareEntries.push({\n filter: filterOrHandler,\n handler,\n });\n } else {\n throw new Error(\n \"mcpMiddleware requires a handler function when a filter is provided\",\n );\n }\n\n return this;\n }\n\n private applyMcpMiddleware(): void {\n if (this.mcpMiddlewareApplied) {\n return;\n }\n this.mcpMiddlewareApplied = true;\n\n // Surface view-resource _meta on `resources/list` (per ext-apps spec:\n // hosts/checkers read CSP & domain at list time before fetching content).\n const viewListMetaEntry: McpMiddlewareEntry = {\n filter: \"resources/list\",\n handler: async (_req, extra, next) => {\n const result = (await next()) as {\n resources: Array<Record<string, unknown> & { uri: string }>;\n };\n for (const resource of result.resources) {\n const builder = this.viewMetaBuilders.get(resource.uri);\n if (!builder) {\n continue;\n }\n const meta = builder(extra);\n resource._meta = {\n ...((resource._meta as Record<string, unknown>) ?? {}),\n ...meta,\n };\n }\n return result;\n },\n };\n\n const monitoringEntry = createMiddlewareEntry();\n const entries = [\n ...(monitoringEntry ? [monitoringEntry] : []),\n viewListMetaEntry,\n ...this.mcpMiddlewareEntries,\n ];\n\n if (entries.length === 0) {\n return;\n }\n\n const { requestHandlers, notificationHandlers } = getHandlerMaps(\n this.server,\n );\n\n const instrumentMap = (\n map: Map<string, (...args: unknown[]) => Promise<unknown>>,\n isNotification: boolean,\n ) => {\n for (const [method, handler] of map) {\n map.set(\n method,\n buildMiddlewareChain(method, isNotification, handler, entries),\n );\n }\n const originalSet = map.set.bind(map);\n map.set = (\n method: string,\n handler: (...args: unknown[]) => Promise<unknown>,\n ) =>\n originalSet(\n method,\n buildMiddlewareChain(method, isNotification, handler, entries),\n );\n };\n\n instrumentMap(requestHandlers, false);\n instrumentMap(notificationHandlers, true);\n }\n\n /**\n * Connect to an MCP transport (override of the SDK's `connect`). Use this\n * when you're embedding Skybridge in a host that already manages its own\n * transport (e.g. stdio for desktop apps); for HTTP, prefer {@link McpServer.run}\n * which sets the transport up for you. Locks in any middleware registered\n * via {@link McpServer.mcpMiddleware} — further calls to that method will\n * throw afterwards.\n */\n async connect(\n transport: Parameters<typeof McpServerBase.prototype.connect>[0],\n ): Promise<void> {\n this.applyMcpMiddleware();\n return McpServerBase.prototype.connect.call(this, transport);\n }\n\n /**\n * Per-request stateless connect. The SDK's `Protocol` only allows one\n * transport per instance, so we can't reuse this `McpServer` across\n * concurrent requests. The SDK's idiomatic fix is a `() => McpServer`\n * factory, but that would break Skybridge's singleton API — so instead\n * we build a fresh underlying `Server` per request and share the main\n * server's handler maps by reference. The cast is unavoidable: there's\n * no public API to inject handler maps. `getHandlerMaps` validates the\n * read side and fails fast on SDK field renames.\n */\n async connectStatelessTransport(\n transport: Parameters<typeof McpServerBase.prototype.connect>[0],\n ): Promise<void> {\n this.applyMcpMiddleware();\n\n const { requestHandlers, notificationHandlers } = getHandlerMaps(\n this.server,\n );\n const fresh = new SdkServer(this.serverInfo, this.serverOptions);\n const target = fresh as unknown as {\n _requestHandlers: unknown;\n _notificationHandlers: unknown;\n };\n target._requestHandlers = requestHandlers;\n target._notificationHandlers = notificationHandlers;\n\n await fresh.connect(transport);\n }\n\n /**\n * Start the HTTP server. Listens on `process.env.__PORT` (default `3000`),\n * mounts the `/mcp` route, applies any custom Express middleware registered\n * via {@link McpServer.use} / {@link McpServer.useOnError}, and locks in\n * any MCP middleware registered via {@link McpServer.mcpMiddleware}.\n *\n * On Cloudflare Workers / workerd, returns an object exposing `fetch` so\n * the runtime can bridge incoming requests to the Node HTTP server. On\n * Node, returns `undefined` once listening.\n */\n async run(): Promise<{ fetch: (...args: unknown[]) => unknown } | undefined> {\n this.applyMcpMiddleware();\n const httpServer = http.createServer();\n\n await createApp({\n mcpServer: this,\n httpServer,\n errorMiddleware: this.customErrorMiddleware,\n });\n\n httpServer.on(\"request\", this.express);\n const port = parseInt(process.env.__PORT ?? \"3000\", 10);\n await new Promise<void>((resolve, reject) => {\n httpServer.on(\"error\", (error: Error) => {\n console.error(\"Failed to start server:\", error);\n reject(error);\n });\n httpServer.listen(port, () => {\n resolve();\n });\n });\n\n // On workerd, bridge the Node http server to a Workers fetch handler.\n // The specifier is held in a variable to sidestep tsc's module resolution\n // (`cloudflare:node` only exists under wrangler/workerd).\n if (\n typeof navigator !== \"undefined\" &&\n navigator.userAgent === \"Cloudflare-Workers\"\n ) {\n const cloudflareNode = \"cloudflare:node\";\n const { httpServerHandler } = await import(cloudflareNode);\n return httpServerHandler({ port });\n }\n\n const shutdown = () => {\n // Drop both handlers so a second signal falls through to Node's default\n // (force-quit on a second Ctrl+C while drain is hanging).\n process.off(\"SIGTERM\", shutdown);\n process.off(\"SIGINT\", shutdown);\n httpServer.close(() => process.exit(0));\n // Force exit if connections don't drain in time so the port is still\n // released promptly (e.g. for nodemon restarts).\n setTimeout(() => process.exit(0), 3000).unref();\n };\n process.on(\"SIGTERM\", shutdown);\n process.on(\"SIGINT\", shutdown);\n return undefined;\n }\n\n private enforceOneToolPerView(component: string, toolName: string): void {\n const existingTool = this.claimedViews.get(component);\n if (existingTool) {\n throw new Error(\n `skybridge: view \"${component}\" is already used by tool \"${existingTool}\". Tool \"${toolName}\" cannot also reference it — each view backs exactly one tool.`,\n );\n }\n this.claimedViews.set(component, toolName);\n }\n\n private resolveViewRequestContext(extra: McpExtra | undefined): {\n serverUrl: string;\n connectDomains: string[];\n contentMetaOverrides: { domain?: string };\n } {\n const isProduction = process.env.NODE_ENV === \"production\";\n const headers = extra?.requestInfo?.headers || {};\n const header = (key: string) => {\n const val = headers[key];\n return Array.isArray(val) ? val[0] : val;\n };\n const isClaude = header(\"user-agent\") === \"Claude-User\";\n\n let serverUrl: string;\n const forwardedHost = header(\"x-forwarded-host\");\n const origin = header(\"origin\");\n const host = header(\"host\");\n\n if (forwardedHost) {\n const proto = header(\"x-forwarded-proto\") || \"https\";\n serverUrl = `${proto}://${forwardedHost}`;\n } else if (origin) {\n serverUrl = origin;\n } else if (host) {\n const proto = [\"127.0.0.1:\", \"localhost:\"].some((p) => host.startsWith(p))\n ? \"http\"\n : \"https\";\n serverUrl = `${proto}://${host}`;\n } else {\n const devPort = process.env.__PORT || \"3000\";\n serverUrl = `http://localhost:${devPort}`;\n }\n\n const connectDomains = [serverUrl];\n if (!isProduction) {\n const wsUrl = new URL(serverUrl);\n wsUrl.protocol = wsUrl.protocol === \"https:\" ? \"wss:\" : \"ws:\";\n connectDomains.push(wsUrl.origin);\n }\n\n let contentMetaOverrides: { domain?: string } = {};\n if (isClaude) {\n const pathname = extra?.requestInfo?.url?.pathname ?? \"\";\n const rawUrl =\n header(\"x-alpic-forwarded-url\") ?? `${serverUrl}${pathname}`;\n // Strip a lone trailing slash so the hash matches the connector URL\n // as registered with Claude (which has no trailing slash on bare origins).\n const url = rawUrl.endsWith(\"/\") ? rawUrl.slice(0, -1) : rawUrl;\n const hash = crypto\n .createHash(\"sha256\")\n .update(url)\n .digest(\"hex\")\n .slice(0, 32);\n contentMetaOverrides = { domain: `${hash}.claudemcpcontent.com` };\n }\n\n return { serverUrl, connectDomains, contentMetaOverrides };\n }\n\n private registerViewResources(\n toolName: string,\n view: ViewConfig,\n toolMeta: InternalToolMeta,\n ): void {\n const hosts = view.hosts ?? ([\"apps-sdk\", \"mcp-app\"] as const);\n\n // Append a content-derived version param so hosts (e.g. ChatGPT) bust\n // their cache when the bundle changes, but keep the URI stable across\n // `tools/list` calls when the bundle hasn't changed.\n const versionParam = this.computeViewVersionParam(view.component);\n\n if (hosts.includes(\"apps-sdk\")) {\n const viewResource: ViewResourceConfig<OpenaiResourceMeta> = {\n hostType: \"apps-sdk\",\n uri: `ui://views/apps-sdk/${view.component}.html${versionParam}`,\n mimeType: \"text/html+skybridge\",\n buildContentMeta: (\n { resourceDomains, connectDomains, domain },\n overrides,\n ) => {\n const defaults: OpenaiResourceMeta = {\n \"openai/widgetCSP\": {\n resource_domains: resourceDomains,\n connect_domains: connectDomains,\n },\n \"openai/widgetDomain\": domain,\n \"openai/widgetDescription\": view.description,\n };\n\n const fromView: Partial<\n Omit<\n OpenaiResourceMeta,\n \"openai/widgetCSP\" | \"openai/widgetDescription\"\n > & {\n \"openai/widgetCSP\": Partial<OpenaiViewCSP>;\n }\n > = {\n \"openai/widgetCSP\": {\n resource_domains: view.csp?.resourceDomains,\n connect_domains: view.csp?.connectDomains,\n frame_domains: view.csp?.frameDomains,\n redirect_domains: view.csp?.redirectDomains,\n },\n \"openai/widgetDomain\": view.domain,\n \"openai/widgetPrefersBorder\": view.prefersBorder,\n };\n\n const base = mergeWithUnion(mergeWithUnion(defaults, fromView), {\n \"openai/widgetDomain\": overrides.domain,\n });\n\n if (view._meta) {\n return { ...base, ...view._meta } as OpenaiResourceMeta;\n }\n return base;\n },\n };\n this.registerViewResource({\n name: toolName,\n viewResource,\n view,\n });\n toolMeta[\"openai/outputTemplate\"] = viewResource.uri;\n }\n\n if (hosts.includes(\"mcp-app\")) {\n const viewResource: ViewResourceConfig<McpAppsResourceMeta> = {\n hostType: \"mcp-app\",\n uri: `ui://views/ext-apps/${view.component}.html${versionParam}`,\n mimeType: \"text/html;profile=mcp-app\",\n buildContentMeta: (\n { resourceDomains, connectDomains, domain, baseUriDomains },\n overrides,\n ) => {\n const defaults: McpAppsResourceMeta = {\n ui: {\n csp: {\n resourceDomains,\n connectDomains,\n baseUriDomains,\n },\n domain,\n },\n };\n\n const fromView: McpAppsResourceMeta = {\n ui: {\n ...(view.description && { description: view.description }),\n ...(view.prefersBorder !== undefined && {\n prefersBorder: view.prefersBorder,\n }),\n ...(view.domain && { domain: view.domain }),\n csp: {\n ...(view.csp?.resourceDomains && {\n resourceDomains: view.csp.resourceDomains,\n }),\n ...(view.csp?.connectDomains && {\n connectDomains: view.csp.connectDomains,\n }),\n ...(view.csp?.frameDomains && {\n frameDomains: view.csp.frameDomains,\n }),\n ...(view.csp?.baseUriDomains && {\n baseUriDomains: view.csp.baseUriDomains,\n }),\n ...(view.csp?.redirectDomains && {\n redirectDomains: view.csp.redirectDomains,\n }),\n },\n },\n };\n\n const base = mergeWithUnion(mergeWithUnion(defaults, fromView), {\n ui: overrides,\n });\n\n if (view._meta) {\n return { ...base, ...view._meta } as McpAppsResourceMeta;\n }\n return base;\n },\n };\n this.registerViewResource({\n name: toolName,\n viewResource,\n view,\n });\n // @ts-expect-error - For backwards compatibility with Claude current implementation of the specs\n toolMeta[\"ui/resourceUri\"] = viewResource.uri;\n\n toolMeta.ui = { ...toolMeta.ui, resourceUri: viewResource.uri };\n }\n }\n\n private registerViewResource({\n name,\n viewResource,\n view,\n }: {\n name: string;\n viewResource: ViewResourceConfig;\n view: ViewConfig;\n }): void {\n const { hostType, uri: viewUri, mimeType, buildContentMeta } = viewResource;\n\n const buildMeta = (extra: McpExtra | undefined): ResourceMeta => {\n const { serverUrl, connectDomains, contentMetaOverrides } =\n this.resolveViewRequestContext(extra);\n return buildContentMeta(\n {\n resourceDomains: [serverUrl],\n connectDomains,\n domain: serverUrl,\n baseUriDomains: [serverUrl],\n },\n contentMetaOverrides,\n );\n };\n this.viewMetaBuilders.set(viewUri, buildMeta);\n\n this.registerResource(\n name,\n viewUri,\n { description: view.description },\n async (uri, extra) => {\n const isProduction = process.env.NODE_ENV === \"production\";\n const { serverUrl } = this.resolveViewRequestContext(extra);\n\n const html = isProduction\n ? templateHelper.renderProduction({\n hostType,\n serverUrl,\n viewFile: this.lookupViewFile(view.component),\n styleFile: this.lookupDistFile(\"style.css\") ?? \"\",\n })\n : templateHelper.renderDevelopment({\n hostType,\n serverUrl,\n viewName: view.component,\n });\n\n return {\n contents: [\n { uri: uri.href, mimeType, text: html, _meta: buildMeta(extra) },\n ],\n };\n },\n );\n }\n\n private wrapHandler<InputArgs extends ZodRawShapeCompat>(\n cb: ToolHandler<InputArgs>,\n { attachViewUUID }: { attachViewUUID: boolean },\n ): ToolHandler<InputArgs> {\n return async (args, extra) => {\n const result = await cb(args, extra);\n return {\n ...result,\n content: normalizeContent(result.content),\n ...(attachViewUUID && {\n _meta: {\n ...(result as { _meta?: Record<string, unknown> })._meta,\n viewUUID: crypto.randomUUID(),\n },\n }),\n };\n };\n }\n\n private computeViewVersionParam(viewName: string): string {\n if (process.env.NODE_ENV !== \"production\") {\n return \"\";\n }\n try {\n const viewFile = this.lookupViewFile(viewName);\n const styleFile = this.lookupDistFile(\"style.css\") ?? \"\";\n const hash = crypto\n .createHash(\"sha256\")\n .update(viewFile)\n .update(\"\\0\")\n .update(styleFile)\n .digest(\"hex\")\n .slice(0, 8);\n return `?v=${hash}`;\n } catch {\n return \"\";\n }\n }\n\n private lookupViewFile(viewName: string) {\n const manifest = this.readManifest();\n for (const entry of Object.values(manifest)) {\n if (entry?.isEntry && entry.name === viewName && entry.file) {\n return entry.file;\n }\n }\n throw new Error(\n `View \"${viewName}\" not found in Vite manifest. Did the build complete successfully? Look for an entry with name \"${viewName}\" in dist/assets/.vite/manifest.json.`,\n );\n }\n\n private lookupDistFile(key: string) {\n const manifest = this.readManifest();\n return manifest[key]?.file;\n }\n\n /**\n * Inject the Vite manifest as a value rather than letting `readManifest()`\n * load it from disk. Required for runtimes without a usable filesystem\n * (Cloudflare Workers, etc.) — the user's `skybridge build` emits the\n * manifest as a JS module which the entry imports and passes here.\n */\n setViteManifest(manifest: Record<string, { file: string }>): this {\n this.viteManifest = manifest as Record<string, ViteManifestEntry>;\n return this;\n }\n\n private readManifest(): Record<string, ViteManifestEntry> {\n if (this.viteManifest) {\n return this.viteManifest;\n }\n return JSON.parse(\n readFileSync(\n path.join(process.cwd(), \"dist\", \"assets\", \".vite\", \"manifest.json\"),\n \"utf-8\",\n ),\n );\n }\n\n /**\n * Register a tool. Pass a `config` describing the tool (name, schemas,\n * optional {@link ViewConfig}, optional {@link ToolMeta}) and a handler that\n * returns the tool's result.\n *\n * Chain calls to build up a server: each call returns a new `McpServer`\n * type that captures the tool's input/output/`_meta` shape so the\n * resulting `typeof server` can drive {@link generateHelpers}.\n *\n * The handler's return shape determines the output types: the\n * `structuredContent` field becomes the tool's typed output, and `_meta`\n * becomes its `responseMetadata`. The `content` field is normalized through\n * {@link normalizeContent}.\n *\n * @example\n * ```ts\n * server.registerTool({\n * name: \"search\",\n * inputSchema: { query: z.string() },\n * outputSchema: { results: z.array(z.string()) },\n * view: { component: \"search\" },\n * }, async ({ query }) => ({\n * content: `Found results for ${query}`,\n * structuredContent: { results: [...] },\n * }));\n * ```\n *\n * @see https://docs.skybridge.tech/api-reference/register-tool\n */\n registerTool<\n TName extends string,\n InputArgs extends ZodRawShapeCompat,\n TReturn extends { content?: HandlerContent },\n >(\n config: ToolConfig<InputArgs> & { name: TName },\n cb: ToolHandler<InputArgs, TReturn>,\n ): AddTool<\n TTools,\n TName,\n InputArgs,\n ExtractStructuredContent<TReturn>,\n ExtractMeta<TReturn>\n >;\n registerTool<InputArgs extends ZodRawShapeCompat>(\n config: ToolConfig<InputArgs>,\n cb: ToolHandler<InputArgs>,\n ): this;\n registerTool(...args: unknown[]): unknown {\n const baseFn = McpServerBase.prototype.registerTool as (\n ...args: unknown[]\n ) => unknown;\n\n if (typeof args[0] === \"string\") {\n baseFn.call(this, args[0], args[1], args[2]);\n return this;\n }\n\n const config = args[0] as ToolConfig<ZodRawShapeCompat>;\n const cb = args[1] as ToolHandler<ZodRawShapeCompat>;\n\n const {\n name,\n view,\n securitySchemes,\n _meta: userToolMeta,\n ...toolFields\n } = config;\n\n const toolMeta: InternalToolMeta = { ...userToolMeta };\n\n if (securitySchemes) {\n // SEP-1488 puts `securitySchemes` at the top level of the tool\n // descriptor, but the SDK's `registerTool` drops unknown top-level\n // fields, so the canonical spot isn't reachable without intercepting\n // `tools/list`. Use the `_meta` back-compat mirror documented in the\n // Apps SDK reference until SEP-1488 lands in the spec.\n toolMeta.securitySchemes = securitySchemes;\n }\n\n if (view) {\n this.enforceOneToolPerView(view.component, name);\n this.registerViewResources(name, view, toolMeta);\n }\n\n const wrappedCb = this.wrapHandler(cb, { attachViewUUID: Boolean(view) });\n\n baseFn.call(this, name, { ...toolFields, _meta: toolMeta }, wrappedCb);\n\n return this;\n }\n}\n"]}
|
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ViewHostType } from "./server.js";
|
|
2
2
|
declare class TemplateHelper {
|
|
3
|
-
private templateCache;
|
|
4
|
-
private loadTemplate;
|
|
5
3
|
renderProduction(data: {
|
|
6
|
-
hostType:
|
|
4
|
+
hostType: ViewHostType;
|
|
7
5
|
serverUrl: string;
|
|
8
|
-
|
|
6
|
+
viewFile: string;
|
|
9
7
|
styleFile: string;
|
|
10
8
|
}): string;
|
|
11
9
|
renderDevelopment(data: {
|
|
12
|
-
hostType:
|
|
10
|
+
hostType: ViewHostType;
|
|
13
11
|
serverUrl: string;
|
|
14
|
-
|
|
15
|
-
widgetName: string;
|
|
12
|
+
viewName: string;
|
|
16
13
|
}): string;
|
|
17
14
|
}
|
|
18
15
|
export declare const templateHelper: TemplateHelper;
|
|
@@ -1,29 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { dirname, join } from "node:path";
|
|
3
|
-
import { fileURLToPath } from "node:url";
|
|
4
|
-
import Handlebars from "handlebars";
|
|
5
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
6
|
-
const __dirname = dirname(__filename);
|
|
1
|
+
import { developmentTemplate, productionTemplate, } from "./templates.generated.js";
|
|
7
2
|
class TemplateHelper {
|
|
8
|
-
templateCache = new Map();
|
|
9
|
-
loadTemplate(templateName) {
|
|
10
|
-
const cached = this.templateCache.get(templateName);
|
|
11
|
-
if (cached) {
|
|
12
|
-
return cached;
|
|
13
|
-
}
|
|
14
|
-
const templatePath = join(__dirname, "templates", `${templateName}.hbs`);
|
|
15
|
-
const templateSource = readFileSync(templatePath, "utf-8");
|
|
16
|
-
const template = Handlebars.compile(templateSource);
|
|
17
|
-
this.templateCache.set(templateName, template);
|
|
18
|
-
return template;
|
|
19
|
-
}
|
|
20
3
|
renderProduction(data) {
|
|
21
|
-
|
|
22
|
-
return template(data);
|
|
4
|
+
return productionTemplate(data);
|
|
23
5
|
}
|
|
24
6
|
renderDevelopment(data) {
|
|
25
|
-
|
|
26
|
-
return template(data);
|
|
7
|
+
return developmentTemplate(data);
|
|
27
8
|
}
|
|
28
9
|
}
|
|
29
10
|
export const templateHelper = new TemplateHelper();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templateHelper.js","sourceRoot":"","sources":["../../src/server/templateHelper.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"templateHelper.js","sourceRoot":"","sources":["../../src/server/templateHelper.ts"],"names":[],"mappings":"AACA,OAAO,EACL,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,0BAA0B,CAAC;AAElC,MAAM,cAAc;IAClB,gBAAgB,CAAC,IAKhB;QACC,OAAO,kBAAkB,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;IAED,iBAAiB,CAAC,IAIjB;QACC,OAAO,mBAAmB,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;CACF;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,cAAc,EAAE,CAAC","sourcesContent":["import type { ViewHostType } from \"./server.js\";\nimport {\n developmentTemplate,\n productionTemplate,\n} from \"./templates.generated.js\";\n\nclass TemplateHelper {\n renderProduction(data: {\n hostType: ViewHostType;\n serverUrl: string;\n viewFile: string;\n styleFile: string;\n }): string {\n return productionTemplate(data);\n }\n\n renderDevelopment(data: {\n hostType: ViewHostType;\n serverUrl: string;\n viewName: string;\n }): string {\n return developmentTemplate(data);\n }\n}\n\nexport const templateHelper = new TemplateHelper();\n"]}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// AUTO-GENERATED by scripts/precompile-templates.mjs. Do not edit.
|
|
2
|
+
import Handlebars from "handlebars/runtime.js";
|
|
3
|
+
/** @type {HandlebarsTemplateDelegate} */
|
|
4
|
+
export const developmentTemplate = Handlebars.template({ "compiler": [8, ">= 4.3.0"], "main": function (container, depth0, helpers, partials, data) {
|
|
5
|
+
var helper, alias1 = depth0 != null ? depth0 : (container.nullContext || {}), alias2 = container.hooks.helperMissing, alias3 = "function", alias4 = container.escapeExpression, lookupProperty = container.lookupProperty || function (parent, propertyName) {
|
|
6
|
+
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
7
|
+
return parent[propertyName];
|
|
8
|
+
}
|
|
9
|
+
return undefined;
|
|
10
|
+
};
|
|
11
|
+
return "<script type=\"module\">window.skybridge = { hostType: \""
|
|
12
|
+
+ alias4(((helper = (helper = lookupProperty(helpers, "hostType") || (depth0 != null ? lookupProperty(depth0, "hostType") : depth0)) != null ? helper : alias2), (typeof helper === alias3 ? helper.call(alias1, { "name": "hostType", "hash": {}, "data": data, "loc": { "start": { "line": 1, "column": 54 }, "end": { "line": 1, "column": 66 } } }) : helper)))
|
|
13
|
+
+ "\", serverUrl: \""
|
|
14
|
+
+ alias4(((helper = (helper = lookupProperty(helpers, "serverUrl") || (depth0 != null ? lookupProperty(depth0, "serverUrl") : depth0)) != null ? helper : alias2), (typeof helper === alias3 ? helper.call(alias1, { "name": "serverUrl", "hash": {}, "data": data, "loc": { "start": { "line": 1, "column": 81 }, "end": { "line": 1, "column": 94 } } }) : helper)))
|
|
15
|
+
+ "\" };</script>\n<script type=\"module\">\n import { injectIntoGlobalHook } from \""
|
|
16
|
+
+ alias4(((helper = (helper = lookupProperty(helpers, "serverUrl") || (depth0 != null ? lookupProperty(depth0, "serverUrl") : depth0)) != null ? helper : alias2), (typeof helper === alias3 ? helper.call(alias1, { "name": "serverUrl", "hash": {}, "data": data, "loc": { "start": { "line": 3, "column": 40 }, "end": { "line": 3, "column": 53 } } }) : helper)))
|
|
17
|
+
+ "/assets/@react-refresh\";\n injectIntoGlobalHook(window); window.$RefreshReg$ = () => {};\n window.$RefreshSig$ = () => (type) => type;\n window.__vite_plugin_react_preamble_installed__ = true;\n</script>\n<script type=\"module\" src=\""
|
|
18
|
+
+ alias4(((helper = (helper = lookupProperty(helpers, "serverUrl") || (depth0 != null ? lookupProperty(depth0, "serverUrl") : depth0)) != null ? helper : alias2), (typeof helper === alias3 ? helper.call(alias1, { "name": "serverUrl", "hash": {}, "data": data, "loc": { "start": { "line": 8, "column": 27 }, "end": { "line": 8, "column": 40 } } }) : helper)))
|
|
19
|
+
+ "/@vite/client\"></script>\n<div id=\"root\"></div>\n<script type=\"module\" id=\"dev-view-entry\">\n import('"
|
|
20
|
+
+ alias4(((helper = (helper = lookupProperty(helpers, "serverUrl") || (depth0 != null ? lookupProperty(depth0, "serverUrl") : depth0)) != null ? helper : alias2), (typeof helper === alias3 ? helper.call(alias1, { "name": "serverUrl", "hash": {}, "data": data, "loc": { "start": { "line": 11, "column": 10 }, "end": { "line": 11, "column": 23 } } }) : helper)))
|
|
21
|
+
+ "/_skybridge/view/"
|
|
22
|
+
+ alias4(((helper = (helper = lookupProperty(helpers, "viewName") || (depth0 != null ? lookupProperty(depth0, "viewName") : depth0)) != null ? helper : alias2), (typeof helper === alias3 ? helper.call(alias1, { "name": "viewName", "hash": {}, "data": data, "loc": { "start": { "line": 11, "column": 40 }, "end": { "line": 11, "column": 52 } } }) : helper)))
|
|
23
|
+
+ "');\n</script>";
|
|
24
|
+
}, "useData": true });
|
|
25
|
+
/** @type {HandlebarsTemplateDelegate} */
|
|
26
|
+
export const productionTemplate = Handlebars.template({ "compiler": [8, ">= 4.3.0"], "main": function (container, depth0, helpers, partials, data) {
|
|
27
|
+
var helper, alias1 = depth0 != null ? depth0 : (container.nullContext || {}), alias2 = container.hooks.helperMissing, alias3 = "function", alias4 = container.escapeExpression, lookupProperty = container.lookupProperty || function (parent, propertyName) {
|
|
28
|
+
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
29
|
+
return parent[propertyName];
|
|
30
|
+
}
|
|
31
|
+
return undefined;
|
|
32
|
+
};
|
|
33
|
+
return "<script type=\"module\">window.skybridge = { hostType: \""
|
|
34
|
+
+ alias4(((helper = (helper = lookupProperty(helpers, "hostType") || (depth0 != null ? lookupProperty(depth0, "hostType") : depth0)) != null ? helper : alias2), (typeof helper === alias3 ? helper.call(alias1, { "name": "hostType", "hash": {}, "data": data, "loc": { "start": { "line": 1, "column": 54 }, "end": { "line": 1, "column": 66 } } }) : helper)))
|
|
35
|
+
+ "\", serverUrl: \""
|
|
36
|
+
+ alias4(((helper = (helper = lookupProperty(helpers, "serverUrl") || (depth0 != null ? lookupProperty(depth0, "serverUrl") : depth0)) != null ? helper : alias2), (typeof helper === alias3 ? helper.call(alias1, { "name": "serverUrl", "hash": {}, "data": data, "loc": { "start": { "line": 1, "column": 81 }, "end": { "line": 1, "column": 94 } } }) : helper)))
|
|
37
|
+
+ "\" };</script>\n<div id=\"root\"></div>\n<script type=\"module\">\n import('"
|
|
38
|
+
+ alias4(((helper = (helper = lookupProperty(helpers, "serverUrl") || (depth0 != null ? lookupProperty(depth0, "serverUrl") : depth0)) != null ? helper : alias2), (typeof helper === alias3 ? helper.call(alias1, { "name": "serverUrl", "hash": {}, "data": data, "loc": { "start": { "line": 4, "column": 10 }, "end": { "line": 4, "column": 23 } } }) : helper)))
|
|
39
|
+
+ "/assets/"
|
|
40
|
+
+ alias4(((helper = (helper = lookupProperty(helpers, "viewFile") || (depth0 != null ? lookupProperty(depth0, "viewFile") : depth0)) != null ? helper : alias2), (typeof helper === alias3 ? helper.call(alias1, { "name": "viewFile", "hash": {}, "data": data, "loc": { "start": { "line": 4, "column": 31 }, "end": { "line": 4, "column": 43 } } }) : helper)))
|
|
41
|
+
+ "');\n</script>\n<link rel=\"stylesheet\" crossorigin href=\""
|
|
42
|
+
+ alias4(((helper = (helper = lookupProperty(helpers, "serverUrl") || (depth0 != null ? lookupProperty(depth0, "serverUrl") : depth0)) != null ? helper : alias2), (typeof helper === alias3 ? helper.call(alias1, { "name": "serverUrl", "hash": {}, "data": data, "loc": { "start": { "line": 6, "column": 41 }, "end": { "line": 6, "column": 54 } } }) : helper)))
|
|
43
|
+
+ "/assets/"
|
|
44
|
+
+ alias4(((helper = (helper = lookupProperty(helpers, "styleFile") || (depth0 != null ? lookupProperty(depth0, "styleFile") : depth0)) != null ? helper : alias2), (typeof helper === alias3 ? helper.call(alias1, { "name": "styleFile", "hash": {}, "data": data, "loc": { "start": { "line": 6, "column": 62 }, "end": { "line": 6, "column": 75 } } }) : helper)))
|
|
45
|
+
+ "\" />";
|
|
46
|
+
}, "useData": true });
|
|
47
|
+
//# sourceMappingURL=templates.generated.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templates.generated.js","sourceRoot":"","sources":["../../src/server/templates.generated.js"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,OAAO,UAAU,MAAM,uBAAuB,CAAC;AAE/C,yCAAyC;AACzC,MAAM,CAAC,MAAM,mBAAmB,GAAG,UAAU,CAAC,QAAQ,CAAC,EAAC,UAAU,EAAC,CAAC,CAAC,EAAC,UAAU,CAAC,EAAC,MAAM,EAAC,UAAS,SAAS,EAAC,MAAM,EAAC,OAAO,EAAC,QAAQ,EAAC,IAAI;QACpI,IAAI,MAAM,EAAE,MAAM,GAAC,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,WAAW,IAAI,EAAE,CAAC,EAAE,MAAM,GAAC,SAAS,CAAC,KAAK,CAAC,aAAa,EAAE,MAAM,GAAC,UAAU,EAAE,MAAM,GAAC,SAAS,CAAC,gBAAgB,EAAE,cAAc,GAAG,SAAS,CAAC,cAAc,IAAI,UAAS,MAAM,EAAE,YAAY;YAC9O,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,YAAY,CAAC,EAAE,CAAC;gBAC/D,OAAO,MAAM,CAAC,YAAY,CAAC,CAAC;YAC9B,CAAC;YACD,OAAO,SAAS,CAAA;QACpB,CAAC,CAAC;QAEJ,OAAO,2DAA2D;cAC9D,MAAM,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,MAAM,GAAG,cAAc,CAAC,OAAO,EAAC,UAAU,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,cAAc,CAAC,MAAM,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AC,EAAC,OAAO,EAAC,EAAC,MAAM,EAAC,CAAC,EAAC,QAAQ,EAAC,EAAE,EAAC,EAAC,KAAK,EAAC,EAAC,MAAM,EAAC,CAAC,EAAC,QAAQ,EAAC,EAAE,EAAC,EAAC,EAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;cACxU,OAAO,CAAC;IACd,CAAC,EAAC,SAAS,EAAC,IAAI,EAAC,CAAC,CAAC","sourcesContent":["// AUTO-GENERATED by scripts/precompile-templates.mjs. Do not edit.\nimport Handlebars from \"handlebars/runtime.js\";\n\n/** @type {HandlebarsTemplateDelegate} */\nexport const developmentTemplate = Handlebars.template({\"compiler\":[8,\">= 4.3.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3=\"function\", alias4=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) {\n if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {\n return parent[propertyName];\n }\n return undefined\n };\n\n return \"<script type=\\\"module\\\">window.skybridge = { hostType: \\\"\"\n + alias4(((helper = (helper = lookupProperty(helpers,\"hostType\") || (depth0 != null ? lookupProperty(depth0,\"hostType\") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"hostType\",\"hash\":{},\"data\":data,\"loc\":{\"start\":{\"line\":1,\"column\":54},\"end\":{\"line\":1,\"column\":66}}}) : helper)))\n + \"\\\", serverUrl: \\\"\"\n + alias4(((helper = (helper = lookupProperty(helpers,\"serverUrl\") || (depth0 != null ? lookupProperty(depth0,\"serverUrl\") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"serverUrl\",\"hash\":{},\"data\":data,\"loc\":{\"start\":{\"line\":1,\"column\":81},\"end\":{\"line\":1,\"column\":94}}}) : helper)))\n + \"\\\" };</script>\\n<script type=\\\"module\\\">\\n import { injectIntoGlobalHook } from \\\"\"\n + alias4(((helper = (helper = lookupProperty(helpers,\"serverUrl\") || (depth0 != null ? lookupProperty(depth0,\"serverUrl\") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"serverUrl\",\"hash\":{},\"data\":data,\"loc\":{\"start\":{\"line\":3,\"column\":40},\"end\":{\"line\":3,\"column\":53}}}) : helper)))\n + \"/assets/@react-refresh\\\";\\n injectIntoGlobalHook(window); window.$RefreshReg$ = () => {};\\n window.$RefreshSig$ = () => (type) => type;\\n window.__vite_plugin_react_preamble_installed__ = true;\\n</script>\\n<script type=\\\"module\\\" src=\\\"\"\n + alias4(((helper = (helper = lookupProperty(helpers,\"serverUrl\") || (depth0 != null ? lookupProperty(depth0,\"serverUrl\") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"serverUrl\",\"hash\":{},\"data\":data,\"loc\":{\"start\":{\"line\":8,\"column\":27},\"end\":{\"line\":8,\"column\":40}}}) : helper)))\n + \"/@vite/client\\\"></script>\\n<div id=\\\"root\\\"></div>\\n<script type=\\\"module\\\" id=\\\"dev-view-entry\\\">\\n import('\"\n + alias4(((helper = (helper = lookupProperty(helpers,\"serverUrl\") || (depth0 != null ? lookupProperty(depth0,\"serverUrl\") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"serverUrl\",\"hash\":{},\"data\":data,\"loc\":{\"start\":{\"line\":11,\"column\":10},\"end\":{\"line\":11,\"column\":23}}}) : helper)))\n + \"/_skybridge/view/\"\n + alias4(((helper = (helper = lookupProperty(helpers,\"viewName\") || (depth0 != null ? lookupProperty(depth0,\"viewName\") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"viewName\",\"hash\":{},\"data\":data,\"loc\":{\"start\":{\"line\":11,\"column\":40},\"end\":{\"line\":11,\"column\":52}}}) : helper)))\n + \"');\\n</script>\";\n},\"useData\":true});\n/** @type {HandlebarsTemplateDelegate} */\nexport const productionTemplate = Handlebars.template({\"compiler\":[8,\">= 4.3.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3=\"function\", alias4=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) {\n if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {\n return parent[propertyName];\n }\n return undefined\n };\n\n return \"<script type=\\\"module\\\">window.skybridge = { hostType: \\\"\"\n + alias4(((helper = (helper = lookupProperty(helpers,\"hostType\") || (depth0 != null ? lookupProperty(depth0,\"hostType\") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"hostType\",\"hash\":{},\"data\":data,\"loc\":{\"start\":{\"line\":1,\"column\":54},\"end\":{\"line\":1,\"column\":66}}}) : helper)))\n + \"\\\", serverUrl: \\\"\"\n + alias4(((helper = (helper = lookupProperty(helpers,\"serverUrl\") || (depth0 != null ? lookupProperty(depth0,\"serverUrl\") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"serverUrl\",\"hash\":{},\"data\":data,\"loc\":{\"start\":{\"line\":1,\"column\":81},\"end\":{\"line\":1,\"column\":94}}}) : helper)))\n + \"\\\" };</script>\\n<div id=\\\"root\\\"></div>\\n<script type=\\\"module\\\">\\n import('\"\n + alias4(((helper = (helper = lookupProperty(helpers,\"serverUrl\") || (depth0 != null ? lookupProperty(depth0,\"serverUrl\") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"serverUrl\",\"hash\":{},\"data\":data,\"loc\":{\"start\":{\"line\":4,\"column\":10},\"end\":{\"line\":4,\"column\":23}}}) : helper)))\n + \"/assets/\"\n + alias4(((helper = (helper = lookupProperty(helpers,\"viewFile\") || (depth0 != null ? lookupProperty(depth0,\"viewFile\") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"viewFile\",\"hash\":{},\"data\":data,\"loc\":{\"start\":{\"line\":4,\"column\":31},\"end\":{\"line\":4,\"column\":43}}}) : helper)))\n + \"');\\n</script>\\n<link rel=\\\"stylesheet\\\" crossorigin href=\\\"\"\n + alias4(((helper = (helper = lookupProperty(helpers,\"serverUrl\") || (depth0 != null ? lookupProperty(depth0,\"serverUrl\") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"serverUrl\",\"hash\":{},\"data\":data,\"loc\":{\"start\":{\"line\":6,\"column\":41},\"end\":{\"line\":6,\"column\":54}}}) : helper)))\n + \"/assets/\"\n + alias4(((helper = (helper = lookupProperty(helpers,\"styleFile\") || (depth0 != null ? lookupProperty(depth0,\"styleFile\") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"styleFile\",\"hash\":{},\"data\":data,\"loc\":{\"start\":{\"line\":6,\"column\":62},\"end\":{\"line\":6,\"column\":75}}}) : helper)))\n + \"\\\" />\";\n},\"useData\":true});\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Router } from "express";
|
|
2
|
+
/**
|
|
3
|
+
* Builds an Express router that forwards `/__skybridge/tunnel` (POST/DELETE)
|
|
4
|
+
* and `/__skybridge/tunnel/events` (GET, SSE) to the cli's loopback control
|
|
5
|
+
* server. The `/__skybridge/` prefix avoids colliding with user-defined routes.
|
|
6
|
+
*/
|
|
7
|
+
export declare function createTunnelProxyRouter(controlPort: number): Router;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import express, {} from "express";
|
|
2
|
+
/**
|
|
3
|
+
* Builds an Express router that forwards `/__skybridge/tunnel` (POST/DELETE)
|
|
4
|
+
* and `/__skybridge/tunnel/events` (GET, SSE) to the cli's loopback control
|
|
5
|
+
* server. The `/__skybridge/` prefix avoids colliding with user-defined routes.
|
|
6
|
+
*/
|
|
7
|
+
export function createTunnelProxyRouter(controlPort) {
|
|
8
|
+
const router = express.Router();
|
|
9
|
+
const upstream = `http://127.0.0.1:${controlPort}/__skybridge/tunnel`;
|
|
10
|
+
const forwardJson = async (method, res) => {
|
|
11
|
+
try {
|
|
12
|
+
const upstreamRes = await fetch(upstream, { method });
|
|
13
|
+
const body = await upstreamRes.text();
|
|
14
|
+
res
|
|
15
|
+
.status(upstreamRes.status)
|
|
16
|
+
.type(upstreamRes.headers.get("content-type") ?? "application/json")
|
|
17
|
+
.send(body);
|
|
18
|
+
}
|
|
19
|
+
catch (err) {
|
|
20
|
+
res.status(502).json({
|
|
21
|
+
status: "error",
|
|
22
|
+
message: err instanceof Error ? err.message : "Tunnel control unavailable",
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
router.post("/__skybridge/tunnel", (_req, res) => {
|
|
27
|
+
void forwardJson("POST", res);
|
|
28
|
+
});
|
|
29
|
+
router.delete("/__skybridge/tunnel", (_req, res) => {
|
|
30
|
+
void forwardJson("DELETE", res);
|
|
31
|
+
});
|
|
32
|
+
router.get("/__skybridge/tunnel/events", async (req, res) => {
|
|
33
|
+
// Abort the upstream fetch when the client disconnects (or when the dev
|
|
34
|
+
// server shuts down and destroys the response).
|
|
35
|
+
const controller = new AbortController();
|
|
36
|
+
const onClose = () => controller.abort();
|
|
37
|
+
req.on("close", onClose);
|
|
38
|
+
let upstreamRes;
|
|
39
|
+
try {
|
|
40
|
+
upstreamRes = await fetch(`${upstream}/events`, {
|
|
41
|
+
signal: controller.signal,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
catch (err) {
|
|
45
|
+
req.off("close", onClose);
|
|
46
|
+
if (!res.headersSent) {
|
|
47
|
+
res.status(502).json({
|
|
48
|
+
status: "error",
|
|
49
|
+
message: err instanceof Error ? err.message : "Tunnel control unavailable",
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
const upstreamBody = upstreamRes.body;
|
|
55
|
+
if (!upstreamRes.ok || !upstreamBody) {
|
|
56
|
+
req.off("close", onClose);
|
|
57
|
+
res.status(upstreamRes.status).end();
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
res.setHeader("Content-Type", upstreamRes.headers.get("content-type") ?? "text/event-stream");
|
|
61
|
+
res.setHeader("Cache-Control", "no-cache, no-transform");
|
|
62
|
+
res.setHeader("Connection", "keep-alive");
|
|
63
|
+
res.flushHeaders?.();
|
|
64
|
+
const reader = upstreamBody.getReader();
|
|
65
|
+
try {
|
|
66
|
+
while (true) {
|
|
67
|
+
const { value, done } = await reader.read();
|
|
68
|
+
if (done) {
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
if (!res.write(value)) {
|
|
72
|
+
// Race "drain" against "close": Node does not emit "drain" on a
|
|
73
|
+
// destroyed socket, so without the close listener this hangs
|
|
74
|
+
// forever when the client disconnects under backpressure, leaking
|
|
75
|
+
// the upstream fetch and TunnelManager listeners.
|
|
76
|
+
await new Promise((resolve) => {
|
|
77
|
+
const onDrain = () => {
|
|
78
|
+
res.off("close", onClose);
|
|
79
|
+
resolve();
|
|
80
|
+
};
|
|
81
|
+
const onClose = () => {
|
|
82
|
+
res.off("drain", onDrain);
|
|
83
|
+
resolve();
|
|
84
|
+
};
|
|
85
|
+
res.once("drain", onDrain);
|
|
86
|
+
res.once("close", onClose);
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
catch {
|
|
92
|
+
// upstream aborted (typically because the client disconnected) —
|
|
93
|
+
// fall through to end()
|
|
94
|
+
}
|
|
95
|
+
finally {
|
|
96
|
+
req.off("close", onClose);
|
|
97
|
+
// Release the reader so the upstream stream's lifecycle isn't held by
|
|
98
|
+
// a lingering lock on the clean-done path.
|
|
99
|
+
try {
|
|
100
|
+
await reader.cancel();
|
|
101
|
+
}
|
|
102
|
+
catch {
|
|
103
|
+
// ignore — the reader may already be closed
|
|
104
|
+
}
|
|
105
|
+
res.end();
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
return router;
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=tunnel-proxy-router.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tunnel-proxy-router.js","sourceRoot":"","sources":["../../src/server/tunnel-proxy-router.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,EAAE,EAAe,MAAM,SAAS,CAAC;AAE/C;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CAAC,WAAmB;IACzD,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAChC,MAAM,QAAQ,GAAG,oBAAoB,WAAW,qBAAqB,CAAC;IAEtE,MAAM,WAAW,GAAG,KAAK,EACvB,MAAyB,EACzB,GAAqB,EACN,EAAE;QACjB,IAAI,CAAC;YACH,MAAM,WAAW,GAAG,MAAM,KAAK,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;YACtD,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC,IAAI,EAAE,CAAC;YACtC,GAAG;iBACA,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC;iBAC1B,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,kBAAkB,CAAC;iBACnE,IAAI,CAAC,IAAI,CAAC,CAAC;QAChB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;gBACnB,MAAM,EAAE,OAAO;gBACf,OAAO,EACL,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,4BAA4B;aACpE,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC;IAEF,MAAM,CAAC,IAAI,CAAC,qBAAqB,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE;QAC/C,KAAK,WAAW,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAChC,CAAC,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,CAAC;QAAC,MAAM,CAAC;YACP,iEAAiE;YACjE,wBAAwB;QAC1B,CAAC;gBAAS,CAAC;YACT,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAC1B,sEAAsE;YACtE,2CAA2C;YAC3C,IAAI,CAAC;gBACH,MAAM,MAAM,CAAC,MAAM,EAAE,CAAC;YACxB,CAAC;YAAC,MAAM,CAAC;gBACP,4CAA4C;YAC9C,CAAC;YACD,GAAG,CAAC,GAAG,EAAE,CAAC;QACZ,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import express, { type Router } from \"express\";\n\n/**\n * Builds an Express router that forwards `/__skybridge/tunnel` (POST/DELETE)\n * and `/__skybridge/tunnel/events` (GET, SSE) to the cli's loopback control\n * server. The `/__skybridge/` prefix avoids colliding with user-defined routes.\n */\nexport function createTunnelProxyRouter(controlPort: number): Router {\n const router = express.Router();\n const upstream = `http://127.0.0.1:${controlPort}/__skybridge/tunnel`;\n\n const forwardJson = async (\n method: \"POST\" | \"DELETE\",\n res: express.Response,\n ): Promise<void> => {\n try {\n const upstreamRes = await fetch(upstream, { method });\n const body = await upstreamRes.text();\n res\n .status(upstreamRes.status)\n .type(upstreamRes.headers.get(\"content-type\") ?? \"application/json\")\n .send(body);\n } catch (err) {\n res.status(502).json({\n status: \"error\",\n message:\n err instanceof Error ? err.message : \"Tunnel control unavailable\",\n });\n }\n };\n\n router.post(\"/__skybridge/tunnel\", (_req, res) => {\n void forwardJson(\"POST\", res);\n });\n\n router.delete(\"/__skybridge/tunnel\", (_req, res) => {\n void forwardJson(\"DELETE\", res);\n });\n\n router.get(\"/__skybridge/tunnel/events\", async (req, res) => {\n // Abort the upstream fetch when the client disconnects (or when the dev\n // server shuts down and destroys the response).\n const controller = new AbortController();\n const onClose = () => controller.abort();\n req.on(\"close\", onClose);\n\n let upstreamRes: Response;\n try {\n upstreamRes = await fetch(`${upstream}/events`, {\n signal: controller.signal,\n });\n } catch (err) {\n req.off(\"close\", onClose);\n if (!res.headersSent) {\n res.status(502).json({\n status: \"error\",\n message:\n err instanceof Error ? err.message : \"Tunnel control unavailable\",\n });\n }\n return;\n }\n\n const upstreamBody = upstreamRes.body;\n if (!upstreamRes.ok || !upstreamBody) {\n req.off(\"close\", onClose);\n res.status(upstreamRes.status).end();\n return;\n }\n\n res.setHeader(\n \"Content-Type\",\n upstreamRes.headers.get(\"content-type\") ?? \"text/event-stream\",\n );\n res.setHeader(\"Cache-Control\", \"no-cache, no-transform\");\n res.setHeader(\"Connection\", \"keep-alive\");\n res.flushHeaders?.();\n\n const reader = upstreamBody.getReader();\n try {\n while (true) {\n const { value, done } = await reader.read();\n if (done) {\n break;\n }\n if (!res.write(value)) {\n // Race \"drain\" against \"close\": Node does not emit \"drain\" on a\n // destroyed socket, so without the close listener this hangs\n // forever when the client disconnects under backpressure, leaking\n // the upstream fetch and TunnelManager listeners.\n await new Promise<void>((resolve) => {\n const onDrain = () => {\n res.off(\"close\", onClose);\n resolve();\n };\n const onClose = () => {\n res.off(\"drain\", onDrain);\n resolve();\n };\n res.once(\"drain\", onDrain);\n res.once(\"close\", onClose);\n });\n }\n }\n } catch {\n // upstream aborted (typically because the client disconnected) —\n // fall through to end()\n } finally {\n req.off(\"close\", onClose);\n // Release the reader so the upstream stream's lifecycle isn't held by\n // a lingering lock on the clean-done path.\n try {\n await reader.cancel();\n } catch {\n // ignore — the reader may already be closed\n }\n res.end();\n }\n });\n\n return router;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|