skybridge 0.0.0-dev.eea25a3 → 0.0.0-dev.eeae3ca
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +152 -0
- package/bin/run.js +5 -0
- 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.d.ts +4 -0
- package/dist/cli/header.js +6 -0
- package/dist/cli/header.js.map +1 -0
- package/dist/cli/run-command.d.ts +2 -0
- package/dist/cli/run-command.js +43 -0
- package/dist/cli/run-command.js.map +1 -0
- package/dist/cli/telemetry.d.ts +7 -0
- package/dist/cli/telemetry.js +123 -0
- package/dist/cli/telemetry.js.map +1 -0
- package/dist/cli/tunnel-control-server.d.ts +9 -0
- package/dist/cli/tunnel-control-server.js +31 -0
- package/dist/cli/tunnel-control-server.js.map +1 -0
- package/dist/cli/tunnel-control-server.test.js +39 -0
- package/dist/cli/tunnel-control-server.test.js.map +1 -0
- package/dist/cli/tunnel-handler.d.ts +3 -0
- package/dist/cli/tunnel-handler.js +48 -0
- package/dist/cli/tunnel-handler.js.map +1 -0
- package/dist/cli/tunnel-handler.test.js +105 -0
- package/dist/cli/tunnel-handler.test.js.map +1 -0
- package/dist/cli/tunnel.d.ts +57 -0
- package/dist/cli/tunnel.js +154 -0
- package/dist/cli/tunnel.js.map +1 -0
- package/dist/cli/tunnel.test.js +190 -0
- package/dist/cli/tunnel.test.js.map +1 -0
- package/dist/cli/types.d.ts +5 -0
- package/dist/cli/types.js.map +1 -0
- package/dist/cli/use-execute-steps.d.ts +11 -0
- package/dist/cli/use-execute-steps.js +36 -0
- package/dist/cli/use-execute-steps.js.map +1 -0
- package/dist/cli/use-messages.d.ts +3 -0
- package/dist/cli/use-messages.js +11 -0
- package/dist/cli/use-messages.js.map +1 -0
- package/dist/cli/use-nodemon.d.ts +2 -0
- package/dist/cli/use-nodemon.js +73 -0
- package/dist/cli/use-nodemon.js.map +1 -0
- package/dist/cli/use-open-browser.d.ts +1 -0
- package/dist/cli/use-open-browser.js +44 -0
- package/dist/cli/use-open-browser.js.map +1 -0
- package/dist/cli/use-tunnel.d.ts +14 -0
- package/dist/cli/use-tunnel.js +131 -0
- package/dist/cli/use-tunnel.js.map +1 -0
- package/dist/cli/use-typescript-check.d.ts +9 -0
- package/dist/cli/use-typescript-check.js +94 -0
- package/dist/cli/use-typescript-check.js.map +1 -0
- package/dist/commands/build.d.ts +9 -0
- package/dist/commands/build.js +102 -0
- package/dist/commands/build.js.map +1 -0
- package/dist/commands/dev.d.ts +12 -0
- package/dist/commands/dev.js +80 -0
- package/dist/commands/dev.js.map +1 -0
- package/dist/commands/start.d.ts +9 -0
- package/dist/commands/start.js +49 -0
- package/dist/commands/start.js.map +1 -0
- package/dist/commands/telemetry/disable.d.ts +5 -0
- package/dist/commands/telemetry/disable.js +14 -0
- package/dist/commands/telemetry/disable.js.map +1 -0
- package/dist/commands/telemetry/enable.d.ts +5 -0
- package/dist/commands/telemetry/enable.js +14 -0
- package/dist/commands/telemetry/enable.js.map +1 -0
- package/dist/commands/telemetry/status.d.ts +5 -0
- package/dist/commands/telemetry/status.js +14 -0
- package/dist/commands/telemetry/status.js.map +1 -0
- package/dist/server/asset-base-url-transform-plugin.d.ts +10 -0
- package/dist/server/asset-base-url-transform-plugin.js +33 -0
- package/dist/server/asset-base-url-transform-plugin.js.map +1 -0
- package/dist/server/asset-base-url-transform-plugin.test.js +84 -0
- package/dist/server/asset-base-url-transform-plugin.test.js.map +1 -0
- package/dist/server/content-helpers.d.ts +27 -0
- package/dist/server/content-helpers.js +46 -0
- package/dist/server/content-helpers.js.map +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 +11 -0
- package/dist/server/express.js +101 -0
- package/dist/server/express.js.map +1 -0
- package/dist/server/express.test.js +430 -0
- package/dist/server/express.test.js.map +1 -0
- package/dist/server/file-ref.d.ts +8 -0
- package/dist/server/file-ref.js +8 -0
- package/dist/server/file-ref.js.map +1 -0
- package/dist/server/index.d.ts +7 -0
- package/dist/server/index.js +5 -0
- package/dist/server/index.js.map +1 -0
- package/dist/{src/server → server}/inferUtilityTypes.d.ts +6 -6
- package/dist/server/inferUtilityTypes.js.map +1 -0
- package/dist/server/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 +124 -0
- package/dist/server/middleware.js +93 -0
- package/dist/server/middleware.js.map +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.js +493 -0
- package/dist/server/middleware.test.js.map +1 -0
- package/dist/server/server.d.ts +199 -0
- package/dist/server/server.js +468 -0
- package/dist/server/server.js.map +1 -0
- package/dist/{src/server → server}/templateHelper.d.ts +5 -7
- package/dist/server/templateHelper.js +11 -0
- package/dist/server/templateHelper.js.map +1 -0
- package/dist/server/templates.generated.d.ts +4 -0
- package/dist/server/templates.generated.js +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.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/{src/test → test}/utils.d.ts +13 -21
- package/dist/{src/test → test}/utils.js +42 -37
- package/dist/test/utils.js.map +1 -0
- package/dist/test/view.test.js +523 -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 +26 -0
- package/dist/web/bridges/apps-sdk/adaptor.js +102 -0
- package/dist/web/bridges/apps-sdk/adaptor.js.map +1 -0
- package/dist/web/bridges/apps-sdk/bridge.d.ts +10 -0
- package/dist/{src/web/bridges/apps-sdk-bridge.js → web/bridges/apps-sdk/bridge.js} +21 -16
- package/dist/web/bridges/apps-sdk/bridge.js.map +1 -0
- package/dist/web/bridges/apps-sdk/index.d.ts +5 -0
- package/dist/web/bridges/apps-sdk/index.js +5 -0
- package/dist/web/bridges/apps-sdk/index.js.map +1 -0
- package/dist/web/bridges/apps-sdk/types.d.ts +133 -0
- package/dist/{src/web → web/bridges/apps-sdk}/types.js +0 -1
- package/dist/web/bridges/apps-sdk/types.js.map +1 -0
- package/dist/web/bridges/apps-sdk/use-apps-sdk-context.d.ts +2 -0
- package/dist/{src/web/bridges/hooks/use-apps-sdk-bridge.js → web/bridges/apps-sdk/use-apps-sdk-context.js} +3 -3
- package/dist/web/bridges/apps-sdk/use-apps-sdk-context.js.map +1 -0
- package/dist/web/bridges/get-adaptor.d.ts +2 -0
- package/dist/web/bridges/get-adaptor.js +8 -0
- package/dist/web/bridges/get-adaptor.js.map +1 -0
- package/dist/web/bridges/index.d.ts +5 -0
- package/dist/web/bridges/index.js +6 -0
- package/dist/web/bridges/index.js.map +1 -0
- package/dist/web/bridges/mcp-app/adaptor.d.ts +50 -0
- package/dist/web/bridges/mcp-app/adaptor.js +271 -0
- package/dist/web/bridges/mcp-app/adaptor.js.map +1 -0
- package/dist/web/bridges/mcp-app/bridge.d.ts +26 -0
- package/dist/web/bridges/mcp-app/bridge.js +102 -0
- package/dist/web/bridges/mcp-app/bridge.js.map +1 -0
- package/dist/web/bridges/mcp-app/index.d.ts +4 -0
- package/dist/web/bridges/mcp-app/index.js +4 -0
- package/dist/web/bridges/mcp-app/index.js.map +1 -0
- package/dist/web/bridges/mcp-app/types.d.ts +8 -0
- package/dist/web/bridges/mcp-app/types.js.map +1 -0
- package/dist/web/bridges/mcp-app/use-mcp-app-context.d.ts +7 -0
- package/dist/web/bridges/mcp-app/use-mcp-app-context.js +7 -0
- package/dist/web/bridges/mcp-app/use-mcp-app-context.js.map +1 -0
- package/dist/web/bridges/mcp-app/use-mcp-app-context.test.js +26 -0
- package/dist/web/bridges/mcp-app/use-mcp-app-context.test.js.map +1 -0
- package/dist/web/bridges/types.d.ts +117 -0
- package/dist/web/bridges/types.js +2 -0
- package/dist/web/bridges/types.js.map +1 -0
- package/dist/web/bridges/use-host-context.d.ts +2 -0
- package/dist/web/bridges/use-host-context.js +8 -0
- package/dist/web/bridges/use-host-context.js.map +1 -0
- package/dist/web/components/modal-provider.d.ts +4 -0
- package/dist/web/components/modal-provider.js +45 -0
- package/dist/web/components/modal-provider.js.map +1 -0
- package/dist/web/create-store.js +38 -0
- package/dist/web/create-store.js.map +1 -0
- package/dist/web/create-store.test.js +129 -0
- package/dist/web/create-store.test.js.map +1 -0
- package/dist/{src/web → web}/data-llm.d.ts +1 -1
- package/dist/{src/web → web}/data-llm.js +11 -7
- package/dist/web/data-llm.js.map +1 -0
- package/dist/web/data-llm.test.js +142 -0
- package/dist/web/data-llm.test.js.map +1 -0
- package/dist/{src/web → web}/generate-helpers.d.ts +22 -19
- package/dist/{src/web → web}/generate-helpers.js +20 -18
- package/dist/web/generate-helpers.js.map +1 -0
- package/dist/{src/web → web}/generate-helpers.test-d.js +30 -27
- package/dist/web/generate-helpers.test-d.js.map +1 -0
- package/dist/web/generate-helpers.test.js.map +1 -0
- package/dist/{src/web → web}/helpers/state.d.ts +2 -2
- package/dist/web/helpers/state.js +45 -0
- package/dist/web/helpers/state.js.map +1 -0
- package/dist/{src/web → web}/helpers/state.test.js +9 -9
- package/dist/web/helpers/state.test.js.map +1 -0
- package/dist/{src/web → web}/hooks/index.d.ts +5 -3
- package/dist/{src/web → web}/hooks/index.js +4 -2
- package/dist/web/hooks/index.js.map +1 -0
- package/dist/web/hooks/test/utils.d.ts +16 -0
- package/dist/web/hooks/test/utils.js +64 -0
- package/dist/web/hooks/test/utils.js.map +1 -0
- package/dist/{src/web → web}/hooks/use-call-tool.d.ts +2 -1
- package/dist/{src/web → web}/hooks/use-call-tool.js +12 -6
- package/dist/web/hooks/use-call-tool.js.map +1 -0
- package/dist/web/hooks/use-call-tool.test-d.js.map +1 -0
- package/dist/{src/web → web}/hooks/use-call-tool.test.js +23 -5
- package/dist/web/hooks/use-call-tool.test.js.map +1 -0
- package/dist/web/hooks/use-display-mode.d.ts +4 -0
- package/dist/web/hooks/use-display-mode.js +9 -0
- package/dist/web/hooks/use-display-mode.js.map +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 -0
- package/dist/web/hooks/use-files.d.ts +7 -0
- package/dist/web/hooks/use-files.js +10 -0
- package/dist/web/hooks/use-files.js.map +1 -0
- package/dist/web/hooks/use-files.test.d.ts +1 -0
- package/dist/web/hooks/use-files.test.js +54 -0
- package/dist/web/hooks/use-files.test.js.map +1 -0
- package/dist/{src/web → web}/hooks/use-layout.d.ts +2 -2
- package/dist/{src/web → web}/hooks/use-layout.js +4 -4
- package/dist/web/hooks/use-layout.js.map +1 -0
- package/dist/web/hooks/use-layout.test.d.ts +1 -0
- package/dist/web/hooks/use-layout.test.js +96 -0
- package/dist/web/hooks/use-layout.test.js.map +1 -0
- package/dist/web/hooks/use-open-external.d.ts +3 -0
- package/dist/web/hooks/use-open-external.js +8 -0
- package/dist/web/hooks/use-open-external.js.map +1 -0
- package/dist/web/hooks/use-open-external.test.d.ts +1 -0
- package/dist/web/hooks/use-open-external.test.js +65 -0
- package/dist/web/hooks/use-open-external.test.js.map +1 -0
- package/dist/web/hooks/use-request-close.d.ts +2 -0
- package/dist/web/hooks/use-request-close.js +8 -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 +9 -0
- package/dist/web/hooks/use-request-modal.js +16 -0
- package/dist/web/hooks/use-request-modal.js.map +1 -0
- package/dist/web/hooks/use-request-modal.test.d.ts +1 -0
- package/dist/{src/web → web}/hooks/use-request-modal.test.js +5 -1
- package/dist/web/hooks/use-request-modal.test.js.map +1 -0
- package/dist/web/hooks/use-request-size.d.ts +3 -0
- package/dist/web/hooks/use-request-size.js +8 -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 +2 -0
- package/dist/web/hooks/use-send-follow-up-message.js +8 -0
- package/dist/web/hooks/use-send-follow-up-message.js.map +1 -0
- package/dist/web/hooks/use-set-open-in-app-url.d.ts +1 -0
- package/dist/web/hooks/use-set-open-in-app-url.js +8 -0
- package/dist/web/hooks/use-set-open-in-app-url.js.map +1 -0
- package/dist/web/hooks/use-set-open-in-app-url.test.d.ts +1 -0
- package/dist/web/hooks/use-set-open-in-app-url.test.js +43 -0
- package/dist/web/hooks/use-set-open-in-app-url.test.js.map +1 -0
- package/dist/{src/web → web}/hooks/use-tool-info.d.ts +12 -1
- package/dist/web/hooks/use-tool-info.js +26 -0
- package/dist/web/hooks/use-tool-info.js.map +1 -0
- package/dist/web/hooks/use-tool-info.test-d.d.ts +1 -0
- package/dist/{src/web → web}/hooks/use-tool-info.test-d.js +40 -4
- package/dist/web/hooks/use-tool-info.test-d.js.map +1 -0
- package/dist/web/hooks/use-tool-info.test.d.ts +1 -0
- package/dist/{src/web → web}/hooks/use-tool-info.test.js +26 -58
- package/dist/web/hooks/use-tool-info.test.js.map +1 -0
- package/dist/{src/web → web}/hooks/use-user.d.ts +1 -1
- package/dist/web/hooks/use-user.js +35 -0
- package/dist/web/hooks/use-user.js.map +1 -0
- package/dist/web/hooks/use-user.test.d.ts +1 -0
- package/dist/web/hooks/use-user.test.js +122 -0
- package/dist/web/hooks/use-user.test.js.map +1 -0
- package/dist/web/hooks/use-view-state.d.ts +4 -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/{src/web → web}/index.d.ts +1 -2
- package/dist/{src/web → web}/index.js +1 -2
- package/dist/web/index.js.map +1 -0
- package/dist/web/mount-view.d.ts +1 -0
- package/dist/{src/web/mount-widget.js → web/mount-view.js} +11 -3
- package/dist/web/mount-view.js.map +1 -0
- package/dist/web/plugin/data-llm.test.d.ts +1 -0
- package/dist/web/plugin/data-llm.test.js.map +1 -0
- package/dist/web/plugin/plugin.d.ts +5 -0
- package/dist/web/plugin/plugin.js +163 -0
- package/dist/web/plugin/plugin.js.map +1 -0
- 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/{src/web → web}/plugin/transform-data-llm.js +7 -4
- package/dist/web/plugin/transform-data-llm.js.map +1 -0
- package/dist/web/plugin/transform-data-llm.test.d.ts +1 -0
- package/dist/web/plugin/transform-data-llm.test.js.map +1 -0
- 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/{src/web → web}/proxy.js +0 -1
- package/dist/web/proxy.js.map +1 -0
- package/dist/web/types.d.ts +16 -0
- package/dist/web/types.js +2 -0
- package/dist/web/types.js.map +1 -0
- package/package.json +75 -40
- package/tsconfig.base.json +33 -0
- package/dist/src/server/devtoolsStaticServer.d.ts +0 -15
- package/dist/src/server/devtoolsStaticServer.js +0 -38
- package/dist/src/server/devtoolsStaticServer.js.map +0 -1
- package/dist/src/server/index.d.ts +0 -5
- package/dist/src/server/index.js +0 -4
- package/dist/src/server/index.js.map +0 -1
- package/dist/src/server/inferUtilityTypes.js.map +0 -1
- package/dist/src/server/server.d.ts +0 -74
- package/dist/src/server/server.js +0 -82
- package/dist/src/server/server.js.map +0 -1
- package/dist/src/server/templateHelper.js +0 -30
- package/dist/src/server/templateHelper.js.map +0 -1
- package/dist/src/server/templates/development.hbs +0 -13
- package/dist/src/server/templates/production.hbs +0 -7
- package/dist/src/server/widgetsDevServer.d.ts +0 -12
- package/dist/src/server/widgetsDevServer.js +0 -39
- package/dist/src/server/widgetsDevServer.js.map +0 -1
- package/dist/src/test/utils.js.map +0 -1
- package/dist/src/test/widget.test.js +0 -146
- package/dist/src/test/widget.test.js.map +0 -1
- package/dist/src/web/bridges/apps-sdk-adapter.d.ts +0 -4
- package/dist/src/web/bridges/apps-sdk-adapter.js +0 -10
- package/dist/src/web/bridges/apps-sdk-adapter.js.map +0 -1
- package/dist/src/web/bridges/apps-sdk-bridge.d.ts +0 -8
- package/dist/src/web/bridges/apps-sdk-bridge.js.map +0 -1
- package/dist/src/web/bridges/get-bridge-methods.d.ts +0 -2
- package/dist/src/web/bridges/get-bridge-methods.js +0 -8
- package/dist/src/web/bridges/get-bridge-methods.js.map +0 -1
- package/dist/src/web/bridges/hooks/types.d.ts +0 -6
- package/dist/src/web/bridges/hooks/types.js.map +0 -1
- package/dist/src/web/bridges/hooks/use-apps-sdk-bridge.d.ts +0 -2
- package/dist/src/web/bridges/hooks/use-apps-sdk-bridge.js.map +0 -1
- package/dist/src/web/bridges/hooks/use-bridge.d.ts +0 -2
- package/dist/src/web/bridges/hooks/use-bridge.js +0 -19
- package/dist/src/web/bridges/hooks/use-bridge.js.map +0 -1
- package/dist/src/web/bridges/hooks/use-mcp-app-bridge.d.ts +0 -4
- package/dist/src/web/bridges/hooks/use-mcp-app-bridge.js +0 -7
- package/dist/src/web/bridges/hooks/use-mcp-app-bridge.js.map +0 -1
- package/dist/src/web/bridges/hooks/use-mcp-app-bridge.test.js +0 -58
- package/dist/src/web/bridges/hooks/use-mcp-app-bridge.test.js.map +0 -1
- package/dist/src/web/bridges/index.d.ts +0 -4
- package/dist/src/web/bridges/index.js +0 -5
- package/dist/src/web/bridges/index.js.map +0 -1
- package/dist/src/web/bridges/mcp-app-adapter.d.ts +0 -6
- package/dist/src/web/bridges/mcp-app-adapter.js +0 -81
- package/dist/src/web/bridges/mcp-app-adapter.js.map +0 -1
- package/dist/src/web/bridges/mcp-app-bridge.d.ts +0 -39
- package/dist/src/web/bridges/mcp-app-bridge.js +0 -166
- package/dist/src/web/bridges/mcp-app-bridge.js.map +0 -1
- package/dist/src/web/bridges/types.d.ts +0 -46
- package/dist/src/web/bridges/types.js.map +0 -1
- package/dist/src/web/create-store.js +0 -25
- package/dist/src/web/create-store.js.map +0 -1
- package/dist/src/web/create-store.test.js +0 -70
- package/dist/src/web/create-store.test.js.map +0 -1
- package/dist/src/web/data-llm.js.map +0 -1
- package/dist/src/web/data-llm.test.js +0 -76
- package/dist/src/web/data-llm.test.js.map +0 -1
- package/dist/src/web/generate-helpers.js.map +0 -1
- package/dist/src/web/generate-helpers.test-d.js.map +0 -1
- package/dist/src/web/generate-helpers.test.js.map +0 -1
- package/dist/src/web/helpers/state.js +0 -40
- package/dist/src/web/helpers/state.js.map +0 -1
- package/dist/src/web/helpers/state.test.js.map +0 -1
- package/dist/src/web/hooks/index.js.map +0 -1
- package/dist/src/web/hooks/use-call-tool.js.map +0 -1
- package/dist/src/web/hooks/use-call-tool.test-d.js.map +0 -1
- package/dist/src/web/hooks/use-call-tool.test.js.map +0 -1
- package/dist/src/web/hooks/use-display-mode.d.ts +0 -4
- package/dist/src/web/hooks/use-display-mode.js +0 -10
- package/dist/src/web/hooks/use-display-mode.js.map +0 -1
- package/dist/src/web/hooks/use-display-mode.test.js.map +0 -1
- package/dist/src/web/hooks/use-files.d.ts +0 -10
- package/dist/src/web/hooks/use-files.js +0 -7
- package/dist/src/web/hooks/use-files.js.map +0 -1
- package/dist/src/web/hooks/use-files.test.js +0 -29
- package/dist/src/web/hooks/use-files.test.js.map +0 -1
- package/dist/src/web/hooks/use-layout.js.map +0 -1
- package/dist/src/web/hooks/use-layout.test.js +0 -46
- package/dist/src/web/hooks/use-layout.test.js.map +0 -1
- package/dist/src/web/hooks/use-open-external.d.ts +0 -1
- package/dist/src/web/hooks/use-open-external.js +0 -6
- package/dist/src/web/hooks/use-open-external.js.map +0 -1
- package/dist/src/web/hooks/use-open-external.test.js +0 -24
- package/dist/src/web/hooks/use-open-external.test.js.map +0 -1
- package/dist/src/web/hooks/use-openai-global.d.ts +0 -3
- package/dist/src/web/hooks/use-openai-global.js +0 -6
- package/dist/src/web/hooks/use-openai-global.js.map +0 -1
- package/dist/src/web/hooks/use-request-modal.d.ts +0 -9
- package/dist/src/web/hooks/use-request-modal.js +0 -14
- package/dist/src/web/hooks/use-request-modal.js.map +0 -1
- package/dist/src/web/hooks/use-request-modal.test.js.map +0 -1
- package/dist/src/web/hooks/use-send-follow-up-message.d.ts +0 -1
- package/dist/src/web/hooks/use-send-follow-up-message.js +0 -6
- package/dist/src/web/hooks/use-send-follow-up-message.js.map +0 -1
- package/dist/src/web/hooks/use-tool-info.js +0 -20
- package/dist/src/web/hooks/use-tool-info.js.map +0 -1
- package/dist/src/web/hooks/use-tool-info.test-d.js.map +0 -1
- package/dist/src/web/hooks/use-tool-info.test.js.map +0 -1
- package/dist/src/web/hooks/use-user.js +0 -19
- package/dist/src/web/hooks/use-user.js.map +0 -1
- package/dist/src/web/hooks/use-user.test.js +0 -44
- package/dist/src/web/hooks/use-user.test.js.map +0 -1
- package/dist/src/web/hooks/use-widget-state.d.ts +0 -4
- package/dist/src/web/hooks/use-widget-state.js +0 -32
- package/dist/src/web/hooks/use-widget-state.js.map +0 -1
- package/dist/src/web/hooks/use-widget-state.test.js +0 -61
- package/dist/src/web/hooks/use-widget-state.test.js.map +0 -1
- package/dist/src/web/index.js.map +0 -1
- package/dist/src/web/mount-widget.d.ts +0 -1
- package/dist/src/web/mount-widget.js.map +0 -1
- package/dist/src/web/plugin/data-llm.test.js.map +0 -1
- package/dist/src/web/plugin/plugin.d.ts +0 -2
- package/dist/src/web/plugin/plugin.js +0 -39
- package/dist/src/web/plugin/plugin.js.map +0 -1
- package/dist/src/web/plugin/transform-data-llm.js.map +0 -1
- package/dist/src/web/plugin/transform-data-llm.test.js.map +0 -1
- package/dist/src/web/proxy.js.map +0 -1
- package/dist/src/web/types.d.ts +0 -149
- package/dist/src/web/types.js.map +0 -1
- package/dist/vitest.config.d.ts +0 -2
- package/dist/vitest.config.js +0 -8
- package/dist/vitest.config.js.map +0 -1
- /package/dist/{src/test/widget.test.d.ts → cli/tunnel-control-server.test.d.ts} +0 -0
- /package/dist/{src/web/bridges/hooks/use-mcp-app-bridge.test.d.ts → cli/tunnel-handler.test.d.ts} +0 -0
- /package/dist/{src/web/create-store.test.d.ts → cli/tunnel.test.d.ts} +0 -0
- /package/dist/{src/web/bridges/hooks → cli}/types.js +0 -0
- /package/dist/{src/web/data-llm.test.d.ts → server/asset-base-url-transform-plugin.test.d.ts} +0 -0
- /package/dist/{src/web/generate-helpers.test-d.d.ts → server/content-helpers.test.d.ts} +0 -0
- /package/dist/{src/web/generate-helpers.test.d.ts → server/express.test.d.ts} +0 -0
- /package/dist/{src/server → server}/inferUtilityTypes.js +0 -0
- /package/dist/{src/web/helpers/state.test.d.ts → server/middleware.test-d.d.ts} +0 -0
- /package/dist/{src/web/hooks/use-call-tool.test-d.d.ts → server/middleware.test.d.ts} +0 -0
- /package/dist/{src/web/hooks/use-call-tool.test.d.ts → server/tunnel-proxy-router.test.d.ts} +0 -0
- /package/dist/{src/web/hooks/use-display-mode.test.d.ts → test/view.test.d.ts} +0 -0
- /package/dist/{src/web/bridges → web/bridges/mcp-app}/types.js +0 -0
- /package/dist/{src/web/hooks/use-files.test.d.ts → web/bridges/mcp-app/use-mcp-app-context.test.d.ts} +0 -0
- /package/dist/{src/web → web}/create-store.d.ts +0 -0
- /package/dist/{src/web/hooks/use-layout.test.d.ts → web/create-store.test.d.ts} +0 -0
- /package/dist/{src/web/plugin → web}/data-llm.test.d.ts +0 -0
- /package/dist/{src/web/hooks/use-open-external.test.d.ts → web/generate-helpers.test-d.d.ts} +0 -0
- /package/dist/{src/web/hooks/use-request-modal.test.d.ts → web/generate-helpers.test.d.ts} +0 -0
- /package/dist/{src/web → web}/generate-helpers.test.js +0 -0
- /package/dist/{src/web/hooks/use-tool-info.test-d.d.ts → web/helpers/state.test.d.ts} +0 -0
- /package/dist/{src/web/hooks/use-tool-info.test.d.ts → web/hooks/use-call-tool.test-d.d.ts} +0 -0
- /package/dist/{src/web → web}/hooks/use-call-tool.test-d.js +0 -0
- /package/dist/{src/web/hooks/use-user.test.d.ts → web/hooks/use-call-tool.test.d.ts} +0 -0
- /package/dist/{src/web/hooks/use-widget-state.test.d.ts → web/hooks/use-display-mode.test-d.d.ts} +0 -0
- /package/dist/{src/web/plugin/transform-data-llm.test.d.ts → web/hooks/use-display-mode.test.d.ts} +0 -0
- /package/dist/{src/web → web}/hooks/use-display-mode.test.js +0 -0
- /package/dist/{src/web → web}/plugin/data-llm.test.js +0 -0
- /package/dist/{src/web → web}/plugin/transform-data-llm.d.ts +0 -0
- /package/dist/{src/web → web}/plugin/transform-data-llm.test.js +0 -0
- /package/dist/{src/web → web}/proxy.d.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transform-data-llm.test.js","sourceRoot":"","sources":["../../../src/web/plugin/transform-data-llm.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAA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itest\";\nimport { transform } from \"./transform-data-llm.js\";\n\ndescribe(\"data-llm plugin\", () => {\n it(\"should transform JSX element with data-llm string attribute\", async () => {\n const code = `\n function Component() {\n return <div data-llm=\"Test description\">Content</div>;\n }\n `;\n\n const result = await transform(code, \"test.tsx\");\n\n expect(result).not.toBeNull();\n expect(result?.code).toContain(\"DataLLM\");\n expect(result?.code).toContain('content=\"Test description\"');\n expect(result?.code).not.toContain(\"data-llm\");\n });\n\n it(\"should transform JSX element with data-llm expression attribute\", async () => {\n const code = `\n function Component() {\n const desc = \"Dynamic description\";\n return <div data-llm={desc}>Content</div>;\n }\n `;\n\n const result = await transform(code, \"test.tsx\");\n\n expect(result).not.toBeNull();\n expect(result?.code).toContain(\"DataLLM\");\n expect(result?.code).toContain(\"content={desc}\");\n expect(result?.code).not.toContain(\"data-llm\");\n });\n\n it(\"should add import for DataLLM when not present\", async () => {\n const code = `\n function Component() {\n return <div data-llm=\"Test\">Content</div>;\n }\n `;\n\n const result = await transform(code, \"test.tsx\");\n\n expect(result).not.toBeNull();\n expect(result?.code).toContain('import { DataLLM } from \"skybridge/web\"');\n });\n\n it(\"should handle DataLLM imports correctly\", async () => {\n // No duplicate import\n const codeWithImport = `\n import { DataLLM } from \"skybridge/web\";\n function Component() {\n return <div data-llm=\"Test\">Content</div>;\n }\n `;\n const result1 = await transform(codeWithImport, \"test.tsx\");\n expect(\n result1?.code.match(/import.*DataLLM.*from.*skybridge\\/web/g),\n ).toHaveLength(1);\n\n // Preserve other imports and add missing DataLLM\n const codeWithOthers = `\n import React from \"react\";\n import { useState } from \"react\";\n function Component() {\n return <div data-llm=\"Test\">Content</div>;\n }\n `;\n const result2 = await transform(codeWithOthers, \"test.tsx\");\n expect(result2?.code).toContain('import React from \"react\"');\n expect(result2?.code).toContain('import { useState } from \"react\"');\n expect(result2?.code).toContain('import { DataLLM } from \"skybridge/web\"');\n });\n\n it(\"should handle complex JSX with multiple data-llm attributes\", async () => {\n const code = `\n function Component() {\n return (\n <div>\n <section data-llm=\"Section 1\">\n <p>Content 1</p>\n </section>\n <section data-llm=\"Section 2\">\n <p>Content 2</p>\n </section>\n </div>\n );\n }\n `;\n\n const result = await transform(code, \"test.tsx\");\n\n expect(result).toMatchSnapshot();\n });\n});\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function hasDefaultExport(code: string, _filePath?: string): boolean;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
function stripComments(code) {
|
|
2
|
+
return code.replace(/\/\/.*$/gm, "").replace(/\/\*[\s\S]*?\*\//g, "");
|
|
3
|
+
}
|
|
4
|
+
export function hasDefaultExport(code, _filePath) {
|
|
5
|
+
const stripped = stripComments(code);
|
|
6
|
+
return (/export\s+default\s/.test(stripped) ||
|
|
7
|
+
/export\s*\{[^}]*\bas\s+default\b[^}]*}/.test(stripped));
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=validate-view.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-view.js","sourceRoot":"","sources":["../../../src/web/plugin/validate-view.ts"],"names":[],"mappings":"AAAA,SAAS,aAAa,CAAC,IAAY;IACjC,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,mBAAmB,EAAE,EAAE,CAAC,CAAC;AACxE,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,IAAY,EAAE,SAAkB;IAC/D,MAAM,QAAQ,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;IACrC,OAAO,CACL,oBAAoB,CAAC,IAAI,CAAC,QAAQ,CAAC;QACnC,wCAAwC,CAAC,IAAI,CAAC,QAAQ,CAAC,CACxD,CAAC;AACJ,CAAC","sourcesContent":["function stripComments(code: string): string {\n return code.replace(/\\/\\/.*$/gm, \"\").replace(/\\/\\*[\\s\\S]*?\\*\\//g, \"\");\n}\n\nexport function hasDefaultExport(code: string, _filePath?: string): boolean {\n const stripped = stripComments(code);\n return (\n /export\\s+default\\s/.test(stripped) ||\n /export\\s*\\{[^}]*\\bas\\s+default\\b[^}]*}/.test(stripped)\n );\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { hasDefaultExport } from "./validate-view.js";
|
|
3
|
+
describe("hasDefaultExport", () => {
|
|
4
|
+
it("detects export default declaration", () => {
|
|
5
|
+
expect(hasDefaultExport("export default MyView;")).toBe(true);
|
|
6
|
+
});
|
|
7
|
+
it("detects export default function", () => {
|
|
8
|
+
expect(hasDefaultExport("export default function MyView() {}")).toBe(true);
|
|
9
|
+
});
|
|
10
|
+
it("detects re-export as default", () => {
|
|
11
|
+
expect(hasDefaultExport("export { Foo as default };")).toBe(true);
|
|
12
|
+
});
|
|
13
|
+
it("returns false when no default export", () => {
|
|
14
|
+
expect(hasDefaultExport("export const Foo = 1;")).toBe(false);
|
|
15
|
+
});
|
|
16
|
+
it("ignores commented-out default exports", () => {
|
|
17
|
+
const code = `
|
|
18
|
+
// export default MyView;
|
|
19
|
+
/* export default MyView; */
|
|
20
|
+
`;
|
|
21
|
+
expect(hasDefaultExport(code)).toBe(false);
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
//# sourceMappingURL=validate-view.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-view.test.js","sourceRoot":"","sources":["../../../src/web/plugin/validate-view.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAChC,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE;QAC5C,MAAM,CAAC,gBAAgB,CAAC,wBAAwB,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,iCAAiC,EAAE,GAAG,EAAE;QACzC,MAAM,CAAC,gBAAgB,CAAC,qCAAqC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7E,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8BAA8B,EAAE,GAAG,EAAE;QACtC,MAAM,CAAC,gBAAgB,CAAC,4BAA4B,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,sCAAsC,EAAE,GAAG,EAAE;QAC9C,MAAM,CAAC,gBAAgB,CAAC,uBAAuB,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,uCAAuC,EAAE,GAAG,EAAE;QAC/C,MAAM,IAAI,GAAG;;;KAGZ,CAAC;QACF,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { describe, expect, it } from \"vitest\";\nimport { hasDefaultExport } from \"./validate-view.js\";\n\ndescribe(\"hasDefaultExport\", () => {\n it(\"detects export default declaration\", () => {\n expect(hasDefaultExport(\"export default MyView;\")).toBe(true);\n });\n\n it(\"detects export default function\", () => {\n expect(hasDefaultExport(\"export default function MyView() {}\")).toBe(true);\n });\n\n it(\"detects re-export as default\", () => {\n expect(hasDefaultExport(\"export { Foo as default };\")).toBe(true);\n });\n\n it(\"returns false when no default export\", () => {\n expect(hasDefaultExport(\"export const Foo = 1;\")).toBe(false);\n });\n\n it(\"ignores commented-out default exports\", () => {\n const code = `\n // export default MyView;\n /* export default MyView; */\n `;\n expect(hasDefaultExport(code)).toBe(false);\n });\n});\n"]}
|
|
@@ -6,7 +6,6 @@ const colors = {
|
|
|
6
6
|
};
|
|
7
7
|
export function installOpenAILoggingProxy() {
|
|
8
8
|
if (typeof window === "undefined" || !window.openai) {
|
|
9
|
-
console.warn("[openai-proxy] window.openai not found, skipping proxy installation");
|
|
10
9
|
return;
|
|
11
10
|
}
|
|
12
11
|
const descriptor = Object.getOwnPropertyDescriptor(window, "openai");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proxy.js","sourceRoot":"","sources":["../../src/web/proxy.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,GAAG;IACb,KAAK,EAAE,SAAS;IAChB,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,SAAS;CACR,CAAC;AAEX,MAAM,UAAU,yBAAyB;IACvC,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;QACpD,OAAO;IACT,CAAC;IAED,MAAM,UAAU,GAAG,MAAM,CAAC,wBAAwB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACrE,IAAI,UAAU,EAAE,YAAY,KAAK,KAAK,IAAI,UAAU,EAAE,QAAQ,KAAK,KAAK,EAAE,CAAC;QACzE,OAAO,CAAC,IAAI,CACV,2FAA2F,CAC5F,CAAC;QACF,OAAO;IACT,CAAC;IAED,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC;IAErC,MAAM,OAAO,GAAwC;QACnD,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ;YACxB,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;YAElD,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE,CAAC;gBAChC,OAAO,KAAK,CAAC;YACf,CAAC;YAED,OAAO,CAAC,GAAG,IAAe,EAAE,EAAE;gBAC5B,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;gBAEhC,OAAO,CA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EACxB,UAAU,MAAM,CAAC,IAAI,EAAE,EACvB,UAAU,MAAM,CAAC,OAAO,qBAAqB,EAC7C,GAAG,EACH,KAAK,CACN,CAAC;YAEF,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;QACpD,CAAC;KACF,CAAC;IAEF,MAAM,CAAC,MAAM,GAAG,IAAI,KAAK,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IAEnD,OAAO,CAAC,GAAG,CACT,8DAA8D,EAC9D,UAAU,MAAM,CAAC,KAAK,EAAE,EACxB,UAAU,MAAM,CAAC,IAAI,EAAE,CACxB,CAAC;AACJ,CAAC","sourcesContent":["const colors = {\n brand: \"#6366f1\",\n info: \"#22223b\",\n success: \"#22c55e\",\n error: \"#ef4444\",\n} as const;\n\nexport function installOpenAILoggingProxy() {\n if (typeof window === \"undefined\" || !window.openai) {\n return;\n }\n\n const descriptor = Object.getOwnPropertyDescriptor(window, \"openai\");\n if (descriptor?.configurable === false || descriptor?.writable === false) {\n console.warn(\n \"[openai-proxy] window.openai is not configurable or writable, skipping proxy installation\",\n );\n return;\n }\n\n const originalOpenAI = window.openai;\n\n const handler: ProxyHandler<typeof originalOpenAI> = {\n get(target, prop, receiver) {\n const value = Reflect.get(target, prop, receiver);\n\n if (typeof value !== \"function\") {\n return value;\n }\n\n return (...args: unknown[]) => {\n const methodName = String(prop);\n\n console.group(\n `%c[openai] %cmethod %c${methodName}`,\n `color: ${colors.brand}; font-weight: normal`,\n `color: ${colors.info}; font-weight: normal`,\n `color: ${colors.success}`,\n );\n console.log(\"%c← args:\", `color: ${colors.info}`, args);\n\n const result = value.apply(target, args);\n\n if (result && typeof result.then === \"function\") {\n return result.then(\n (resolved: unknown) => {\n console.log(\n \"%c→ resolved:\",\n `color: ${colors.success}`,\n resolved,\n );\n console.groupEnd();\n return resolved;\n },\n (error: unknown) => {\n console.error(\"%c→ rejected:\", `color: ${colors.error}`, error);\n console.groupEnd();\n throw error;\n },\n );\n }\n\n console.log(\"%c→ returned:\", `color: ${colors.success}`, result);\n console.groupEnd();\n\n return result;\n };\n },\n\n set(target, prop, value, receiver) {\n console.log(\n `%c[openai] %cupdate %c${String(prop)}`,\n `color: ${colors.brand}`,\n `color: ${colors.info}`,\n `color: ${colors.success}; font-weight: bold`,\n \"←\",\n value,\n );\n\n return Reflect.set(target, prop, value, receiver);\n },\n };\n\n window.openai = new Proxy(originalOpenAI, handler);\n\n console.log(\n \"%c[openai-proxy] %cInstalled logging proxy for window.openai\",\n `color: ${colors.brand}`,\n `color: ${colors.info}`,\n );\n}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import "react";
|
|
2
|
+
declare module "react" {
|
|
3
|
+
interface HTMLAttributes<T> {
|
|
4
|
+
"data-llm"?: string;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
export type UnknownObject = Record<string, unknown>;
|
|
8
|
+
export type Prettify<T> = {
|
|
9
|
+
[K in keyof T]: T[K];
|
|
10
|
+
} & {};
|
|
11
|
+
export type Objectify<T> = T & UnknownObject;
|
|
12
|
+
type RequiredKeys<T> = {
|
|
13
|
+
[K in keyof T]-?: Record<string, never> extends Pick<T, K> ? never : K;
|
|
14
|
+
}[keyof T];
|
|
15
|
+
export type HasRequiredKeys<T> = RequiredKeys<T> extends never ? false : true;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/web/types.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,CAAC","sourcesContent":["import \"react\";\n\ndeclare module \"react\" {\n interface HTMLAttributes<T> {\n \"data-llm\"?: string;\n }\n}\n\nexport type UnknownObject = Record<string, unknown>;\n\nexport type Prettify<T> = { [K in keyof T]: T[K] } & {};\nexport type Objectify<T> = T & UnknownObject;\n\ntype RequiredKeys<T> = {\n [K in keyof T]-?: Record<string, never> extends Pick<T, K> ? never : K;\n}[keyof T];\nexport type HasRequiredKeys<T> = RequiredKeys<T> extends never ? false : true;\n"]}
|
package/package.json
CHANGED
|
@@ -1,34 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "skybridge",
|
|
3
|
-
"version": "0.0.0-dev.
|
|
4
|
-
"description": "Skybridge is a framework for building ChatGPT
|
|
3
|
+
"version": "0.0.0-dev.eeae3ca",
|
|
4
|
+
"description": "Skybridge is a framework for building ChatGPT and MCP Apps",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/alpic-ai/skybridge.git"
|
|
8
8
|
},
|
|
9
9
|
"type": "module",
|
|
10
|
+
"engines": {
|
|
11
|
+
"node": ">=22.0.0"
|
|
12
|
+
},
|
|
10
13
|
"files": [
|
|
11
|
-
"dist"
|
|
14
|
+
"dist",
|
|
15
|
+
"README.md",
|
|
16
|
+
"tsconfig.base.json"
|
|
12
17
|
],
|
|
13
18
|
"exports": {
|
|
19
|
+
"./tsconfig": "./tsconfig.base.json",
|
|
20
|
+
"./tsconfig.json": "./tsconfig.base.json",
|
|
14
21
|
"./server": {
|
|
15
|
-
"types": "./dist/
|
|
16
|
-
"default": "./dist/
|
|
22
|
+
"types": "./dist/server/index.d.ts",
|
|
23
|
+
"default": "./dist/server/index.js"
|
|
17
24
|
},
|
|
18
25
|
"./web": {
|
|
19
|
-
"types": "./dist/
|
|
20
|
-
"default": "./dist/
|
|
26
|
+
"types": "./dist/web/index.d.ts",
|
|
27
|
+
"default": "./dist/web/index.js"
|
|
28
|
+
},
|
|
29
|
+
"./vite": {
|
|
30
|
+
"types": "./dist/web/plugin/plugin.d.ts",
|
|
31
|
+
"default": "./dist/web/plugin/plugin.js"
|
|
21
32
|
}
|
|
22
33
|
},
|
|
23
|
-
"scripts": {
|
|
24
|
-
"build": "tsc && pnpm run build:templates",
|
|
25
|
-
"build:templates": "cp -r src/server/templates dist/src/server/",
|
|
26
|
-
"format": "biome check --write --error-on-warnings",
|
|
27
|
-
"test": "pnpm run test:unit && pnpm run test:type && pnpm run test:format",
|
|
28
|
-
"test:unit": "vitest run",
|
|
29
|
-
"test:type": "tsc --noEmit",
|
|
30
|
-
"test:format": "biome ci"
|
|
31
|
-
},
|
|
32
34
|
"keywords": [
|
|
33
35
|
"chatgpt",
|
|
34
36
|
"app",
|
|
@@ -38,38 +40,71 @@
|
|
|
38
40
|
"author": "Frédéric Barthelet",
|
|
39
41
|
"license": "ISC",
|
|
40
42
|
"peerDependencies": {
|
|
41
|
-
"@modelcontextprotocol/sdk": ">=1.
|
|
43
|
+
"@modelcontextprotocol/sdk": ">=1.27.0",
|
|
44
|
+
"@skybridge/devtools": "^1.0.0",
|
|
45
|
+
"nodemon": ">=3.0.0",
|
|
42
46
|
"react": ">=18.0.0",
|
|
43
|
-
"react-dom": ">=18.0.0"
|
|
47
|
+
"react-dom": ">=18.0.0",
|
|
48
|
+
"vite": ">=7.3.1"
|
|
44
49
|
},
|
|
45
50
|
"dependencies": {
|
|
46
|
-
"@babel/core": "^7.
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
51
|
+
"@babel/core": "^7.29.0",
|
|
52
|
+
"@modelcontextprotocol/ext-apps": "^1.3.2",
|
|
53
|
+
"@oclif/core": "^4.10.3",
|
|
54
|
+
"ci-info": "^4.4.0",
|
|
55
|
+
"cors": "^2.8.6",
|
|
56
|
+
"cross-spawn": "^7.0.6",
|
|
57
|
+
"dequal": "^2.0.3",
|
|
58
|
+
"es-toolkit": "^1.45.1",
|
|
59
|
+
"express": "^5.2.1",
|
|
60
|
+
"handlebars": "^4.7.9",
|
|
61
|
+
"ink": "^7.0.0",
|
|
62
|
+
"open": "^11.0.0",
|
|
63
|
+
"posthog-node": "^5.28.9",
|
|
50
64
|
"superjson": "^2.2.6",
|
|
51
|
-
"
|
|
52
|
-
"zustand": "^5.0.9"
|
|
65
|
+
"zustand": "^5.0.12"
|
|
53
66
|
},
|
|
54
67
|
"devDependencies": {
|
|
55
|
-
"@
|
|
56
|
-
"@modelcontextprotocol/ext-apps": "^0.2.2",
|
|
57
|
-
"@modelcontextprotocol/sdk": "^1.24.3",
|
|
68
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
58
69
|
"@testing-library/dom": "^10.4.1",
|
|
59
|
-
"@testing-library/react": "^16.3.
|
|
70
|
+
"@testing-library/react": "^16.3.2",
|
|
60
71
|
"@total-typescript/tsconfig": "^1.0.4",
|
|
61
72
|
"@types/babel__core": "^7.20.5",
|
|
62
73
|
"@types/cors": "^2.8.19",
|
|
63
|
-
"@types/
|
|
64
|
-
"@types/
|
|
65
|
-
"@types/
|
|
66
|
-
"@types/
|
|
67
|
-
"@types/react
|
|
68
|
-
"@
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
74
|
+
"@types/cross-spawn": "^6.0.6",
|
|
75
|
+
"@types/express": "^5.0.6",
|
|
76
|
+
"@types/jsdom": "^28.0.1",
|
|
77
|
+
"@types/node": "^24.12.0",
|
|
78
|
+
"@types/react": "^19.2.14",
|
|
79
|
+
"@types/react-dom": "^19.2.3",
|
|
80
|
+
"@vitest/ui": "^4.1.4",
|
|
81
|
+
"jsdom": "^29.0.1",
|
|
82
|
+
"shx": "^0.4.0",
|
|
83
|
+
"ts-node": "^10.9.2",
|
|
84
|
+
"typescript": "^6.0.2",
|
|
85
|
+
"vite": "^8.0.0",
|
|
86
|
+
"vitest": "^4.1.4",
|
|
87
|
+
"zod": "^4.3.6"
|
|
73
88
|
},
|
|
74
|
-
"
|
|
75
|
-
|
|
89
|
+
"bin": {
|
|
90
|
+
"sb": "./bin/run.js",
|
|
91
|
+
"skybridge": "./bin/run.js"
|
|
92
|
+
},
|
|
93
|
+
"oclif": {
|
|
94
|
+
"bin": "skybridge",
|
|
95
|
+
"commands": "./dist/commands",
|
|
96
|
+
"dirname": "skybridge",
|
|
97
|
+
"topicSeparator": " ",
|
|
98
|
+
"hooks": {
|
|
99
|
+
"finally": "./dist/cli/telemetry"
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
"scripts": {
|
|
103
|
+
"build": "shx rm -rf dist && pnpm run build:templates && tsc",
|
|
104
|
+
"build:templates": "node scripts/precompile-templates.mjs",
|
|
105
|
+
"format": "biome check --write --error-on-warnings",
|
|
106
|
+
"test": "pnpm run test:unit && pnpm run test:format",
|
|
107
|
+
"test:unit": "pnpm run build:templates && vitest run",
|
|
108
|
+
"test:format": "biome ci"
|
|
109
|
+
}
|
|
110
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
// Module resolution options
|
|
4
|
+
"module": "NodeNext",
|
|
5
|
+
"esModuleInterop": true,
|
|
6
|
+
"verbatimModuleSyntax": true,
|
|
7
|
+
|
|
8
|
+
// Output options
|
|
9
|
+
"rootDir": "${configDir}/src",
|
|
10
|
+
"outDir": "${configDir}/dist",
|
|
11
|
+
"noEmit": false,
|
|
12
|
+
"incremental": true,
|
|
13
|
+
"sourceMap": true,
|
|
14
|
+
|
|
15
|
+
// Language and environment options
|
|
16
|
+
"target": "ES2022",
|
|
17
|
+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
18
|
+
"jsx": "react-jsx",
|
|
19
|
+
|
|
20
|
+
// Type declarations
|
|
21
|
+
"types": ["node", "vite/client"],
|
|
22
|
+
|
|
23
|
+
// Strictness and checking options
|
|
24
|
+
"strict": true,
|
|
25
|
+
"skipLibCheck": true,
|
|
26
|
+
"forceConsistentCasingInFileNames": true,
|
|
27
|
+
|
|
28
|
+
// Code quality & diagnostics
|
|
29
|
+
"noUnusedLocals": true,
|
|
30
|
+
"noUnusedParameters": true,
|
|
31
|
+
"noFallthroughCasesInSwitch": true
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { type RequestHandler } from "express";
|
|
2
|
-
/**
|
|
3
|
-
* Serve the built devtools React app
|
|
4
|
-
* This router serves static files from the devtools's dist directory.
|
|
5
|
-
* It should be installed at the application root, like so:
|
|
6
|
-
*
|
|
7
|
-
* const app = express();
|
|
8
|
-
*
|
|
9
|
-
* if (env.NODE_ENV !== "production") {
|
|
10
|
-
* app.use(await devtoolsStaticServer(server));
|
|
11
|
-
* app.use(await widgetsDevServer());
|
|
12
|
-
* ^^^^^^^^ Make sure to install the devtoolsStaticServer before the widgetsDevServer
|
|
13
|
-
* }
|
|
14
|
-
*/
|
|
15
|
-
export declare const devtoolsStaticServer: () => Promise<RequestHandler>;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from "node:fs";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import { fileURLToPath } from "node:url";
|
|
4
|
-
import cors from "cors";
|
|
5
|
-
import express, {} from "express";
|
|
6
|
-
/**
|
|
7
|
-
* Serve the built devtools React app
|
|
8
|
-
* This router serves static files from the devtools's dist directory.
|
|
9
|
-
* It should be installed at the application root, like so:
|
|
10
|
-
*
|
|
11
|
-
* const app = express();
|
|
12
|
-
*
|
|
13
|
-
* if (env.NODE_ENV !== "production") {
|
|
14
|
-
* app.use(await devtoolsStaticServer(server));
|
|
15
|
-
* app.use(await widgetsDevServer());
|
|
16
|
-
* ^^^^^^^^ Make sure to install the devtoolsStaticServer before the widgetsDevServer
|
|
17
|
-
* }
|
|
18
|
-
*/
|
|
19
|
-
export const devtoolsStaticServer = async () => {
|
|
20
|
-
const router = express.Router();
|
|
21
|
-
const currentDir = path.dirname(fileURLToPath(import.meta.url));
|
|
22
|
-
const devtoolsPath = path.join(currentDir, "..", "devtools");
|
|
23
|
-
router.use(cors());
|
|
24
|
-
router.use(express.static(devtoolsPath));
|
|
25
|
-
router.get("/", (_req, res, next) => {
|
|
26
|
-
const indexHtmlPath = path.join(devtoolsPath, "index.html");
|
|
27
|
-
try {
|
|
28
|
-
const indexHtml = readFileSync(indexHtmlPath, "utf-8");
|
|
29
|
-
res.setHeader("Content-Type", "text/html");
|
|
30
|
-
res.send(indexHtml);
|
|
31
|
-
}
|
|
32
|
-
catch (error) {
|
|
33
|
-
next(error);
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
return router;
|
|
37
|
-
};
|
|
38
|
-
//# sourceMappingURL=devtoolsStaticServer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"devtoolsStaticServer.js","sourceRoot":"","sources":["../../../src/server/devtoolsStaticServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,OAAO,EAAE,EAAuB,MAAM,SAAS,CAAC;AAEvD;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,IAA6B,EAAE;IACtE,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAChC,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAChE,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC;IAE7D,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;IAEnB,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC;IAEzC,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;QAClC,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;QAC5D,IAAI,CAAC;YACH,MAAM,SAAS,GAAG,YAAY,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;YACvD,GAAG,CAAC,SAAS,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;YAC3C,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACtB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,KAAK,CAAC,CAAC;QACd,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { devtoolsStaticServer } from "./devtoolsStaticServer.js";
|
|
2
|
-
export type { AnyToolRegistry, InferTools, ToolInput, ToolNames, ToolOutput, ToolResponseMetadata, } from "./inferUtilityTypes.js";
|
|
3
|
-
export type { McpServerTypes, ToolDef, WidgetHostType } from "./server.js";
|
|
4
|
-
export { McpServer } from "./server.js";
|
|
5
|
-
export { widgetsDevServer } from "./widgetsDevServer.js";
|
package/dist/src/server/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAUjE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"inferUtilityTypes.js","sourceRoot":"","sources":["../../../src/server/inferUtilityTypes.ts"],"names":[],"mappings":""}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { McpServer as McpServerBase, type RegisteredTool } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
-
import type { AnySchema, SchemaOutput, ZodRawShapeCompat } from "@modelcontextprotocol/sdk/server/zod-compat.js";
|
|
3
|
-
import type { RequestHandlerExtra } from "@modelcontextprotocol/sdk/shared/protocol.js";
|
|
4
|
-
import type { CallToolResult, Resource, ServerNotification, ServerRequest, ToolAnnotations } from "@modelcontextprotocol/sdk/types.js";
|
|
5
|
-
export type ToolDef<TInput = unknown, TOutput = unknown, TResponseMetadata = unknown> = {
|
|
6
|
-
input: TInput;
|
|
7
|
-
output: TOutput;
|
|
8
|
-
responseMetadata: TResponseMetadata;
|
|
9
|
-
};
|
|
10
|
-
export type WidgetHostType = "apps-sdk" | "mcp-app";
|
|
11
|
-
type McpServerOriginalResourceConfig = Omit<Resource, "uri" | "name" | "mimeType">;
|
|
12
|
-
type McpServerOriginalToolConfig = Omit<Parameters<typeof McpServerBase.prototype.registerTool<ZodRawShapeCompat, ZodRawShapeCompat>>[1], "inputSchema" | "outputSchema">;
|
|
13
|
-
type Simplify<T> = {
|
|
14
|
-
[K in keyof T]: T[K];
|
|
15
|
-
};
|
|
16
|
-
type ExtractStructuredContent<T> = T extends {
|
|
17
|
-
structuredContent: infer SC;
|
|
18
|
-
} ? Simplify<SC> : never;
|
|
19
|
-
type ExtractMeta<T> = [Extract<T, {
|
|
20
|
-
_meta: unknown;
|
|
21
|
-
}>] extends [never] ? unknown : Extract<T, {
|
|
22
|
-
_meta: unknown;
|
|
23
|
-
}> extends {
|
|
24
|
-
_meta: infer M;
|
|
25
|
-
} ? Simplify<M> : unknown;
|
|
26
|
-
/**
|
|
27
|
-
* Type-level marker interface for cross-package type inference.
|
|
28
|
-
* This enables TypeScript to infer tool types across package boundaries
|
|
29
|
-
* using structural typing on the $types property, rather than relying on
|
|
30
|
-
* class generic inference which fails when McpServer comes from different
|
|
31
|
-
* package installations.
|
|
32
|
-
*
|
|
33
|
-
* Inspired by tRPC's _def pattern and Hono's type markers.
|
|
34
|
-
*/
|
|
35
|
-
export interface McpServerTypes<TTools extends Record<string, ToolDef>> {
|
|
36
|
-
readonly tools: TTools;
|
|
37
|
-
}
|
|
38
|
-
type ShapeOutput<Shape extends ZodRawShapeCompat> = Simplify<{
|
|
39
|
-
[K in keyof Shape as undefined extends SchemaOutput<Shape[K]> ? never : K]: SchemaOutput<Shape[K]>;
|
|
40
|
-
} & {
|
|
41
|
-
[K in keyof Shape as undefined extends SchemaOutput<Shape[K]> ? K : never]?: SchemaOutput<Shape[K]>;
|
|
42
|
-
}>;
|
|
43
|
-
type AddTool<TTools, TName extends string, TInput extends ZodRawShapeCompat, TOutput, TResponseMetadata = unknown> = McpServer<TTools & {
|
|
44
|
-
[K in TName]: ToolDef<ShapeOutput<TInput>, TOutput, TResponseMetadata>;
|
|
45
|
-
}>;
|
|
46
|
-
type ToolConfig<TInput extends ZodRawShapeCompat | AnySchema> = {
|
|
47
|
-
title?: string;
|
|
48
|
-
description?: string;
|
|
49
|
-
inputSchema?: TInput;
|
|
50
|
-
outputSchema?: ZodRawShapeCompat | AnySchema;
|
|
51
|
-
annotations?: ToolAnnotations;
|
|
52
|
-
_meta?: Record<string, unknown>;
|
|
53
|
-
};
|
|
54
|
-
type ToolHandler<TInput extends ZodRawShapeCompat, TReturn extends {
|
|
55
|
-
content: CallToolResult["content"];
|
|
56
|
-
} = CallToolResult> = (args: ShapeOutput<TInput>, extra: RequestHandlerExtra<ServerRequest, ServerNotification>) => TReturn | Promise<TReturn>;
|
|
57
|
-
export declare class McpServer<TTools extends Record<string, ToolDef> = Record<never, ToolDef>> extends McpServerBase {
|
|
58
|
-
readonly $types: McpServerTypes<TTools>;
|
|
59
|
-
registerWidget<TName extends string, TInput extends ZodRawShapeCompat, TReturn extends {
|
|
60
|
-
content: CallToolResult["content"];
|
|
61
|
-
}>(name: TName, resourceConfig: McpServerOriginalResourceConfig, toolConfig: McpServerOriginalToolConfig & {
|
|
62
|
-
inputSchema?: TInput;
|
|
63
|
-
outputSchema?: ZodRawShapeCompat | AnySchema;
|
|
64
|
-
}, toolCallback: ToolHandler<TInput, TReturn>): AddTool<TTools, TName, TInput, ExtractStructuredContent<TReturn>, ExtractMeta<TReturn>>;
|
|
65
|
-
registerTool<TName extends string, InputArgs extends ZodRawShapeCompat, TReturn extends {
|
|
66
|
-
content: CallToolResult["content"];
|
|
67
|
-
}>(name: TName, config: ToolConfig<InputArgs>, cb: ToolHandler<InputArgs, TReturn>): AddTool<TTools, TName, InputArgs, ExtractStructuredContent<TReturn>, ExtractMeta<TReturn>>;
|
|
68
|
-
registerTool<InputArgs extends ZodRawShapeCompat>(name: string, config: ToolConfig<InputArgs>, cb: ToolHandler<InputArgs>): RegisteredTool;
|
|
69
|
-
private registerWidgetResource;
|
|
70
|
-
private lookupDistFile;
|
|
71
|
-
private lookupDistFileWithIndexFallback;
|
|
72
|
-
private readManifest;
|
|
73
|
-
}
|
|
74
|
-
export {};
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from "node:fs";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import { McpServer as McpServerBase, } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
4
|
-
import { templateHelper } from "./templateHelper.js";
|
|
5
|
-
export class McpServer extends McpServerBase {
|
|
6
|
-
registerWidget(name, resourceConfig, toolConfig, toolCallback) {
|
|
7
|
-
const resourceMetadata = {
|
|
8
|
-
...(resourceConfig._meta ?? {}),
|
|
9
|
-
};
|
|
10
|
-
if (toolConfig.description !== undefined) {
|
|
11
|
-
resourceMetadata["openai/widgetDescription"] = toolConfig.description;
|
|
12
|
-
}
|
|
13
|
-
const appsSdkResourceConfig = {
|
|
14
|
-
hostType: "apps-sdk",
|
|
15
|
-
uri: `ui://widgets/apps-sdk/${name}.html`,
|
|
16
|
-
mimeType: "text/html+skybridge",
|
|
17
|
-
};
|
|
18
|
-
const extAppsResourceConfig = {
|
|
19
|
-
hostType: "mcp-app",
|
|
20
|
-
uri: `ui://widgets/ext-apps/${name}.html`,
|
|
21
|
-
mimeType: "text/html;profile=mcp-app",
|
|
22
|
-
};
|
|
23
|
-
[appsSdkResourceConfig, extAppsResourceConfig].forEach(({ hostType, uri, mimeType }) => {
|
|
24
|
-
this.registerWidgetResource({
|
|
25
|
-
name,
|
|
26
|
-
hostType,
|
|
27
|
-
widgetUri: uri,
|
|
28
|
-
mimeType,
|
|
29
|
-
resourceConfig,
|
|
30
|
-
resourceMetadata,
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
const toolMeta = {
|
|
34
|
-
...toolConfig._meta,
|
|
35
|
-
"openai/outputTemplate": appsSdkResourceConfig.uri,
|
|
36
|
-
// "ui/resourceUri": extAppsResourceConfig.uri,
|
|
37
|
-
};
|
|
38
|
-
this.registerTool(name, {
|
|
39
|
-
...toolConfig,
|
|
40
|
-
_meta: toolMeta,
|
|
41
|
-
}, toolCallback);
|
|
42
|
-
return this;
|
|
43
|
-
}
|
|
44
|
-
registerTool(name, config, cb) {
|
|
45
|
-
super.registerTool(name, config, cb);
|
|
46
|
-
return this;
|
|
47
|
-
}
|
|
48
|
-
registerWidgetResource({ name, hostType, widgetUri, mimeType, resourceConfig, resourceMetadata, }) {
|
|
49
|
-
this.registerResource(name, widgetUri, { ...resourceConfig, _meta: resourceMetadata }, async (uri, extra) => {
|
|
50
|
-
const serverUrl = process.env.NODE_ENV === "production"
|
|
51
|
-
? `https://${extra?.requestInfo?.headers?.["x-forwarded-host"] ?? extra?.requestInfo?.headers?.host}`
|
|
52
|
-
: `http://localhost:3000`;
|
|
53
|
-
const html = process.env.NODE_ENV === "production"
|
|
54
|
-
? templateHelper.renderProduction({
|
|
55
|
-
hostType,
|
|
56
|
-
serverUrl,
|
|
57
|
-
widgetFile: this.lookupDistFileWithIndexFallback(`src/widgets/${name}`),
|
|
58
|
-
styleFile: this.lookupDistFile("style.css"),
|
|
59
|
-
})
|
|
60
|
-
: templateHelper.renderDevelopment({
|
|
61
|
-
hostType,
|
|
62
|
-
serverUrl,
|
|
63
|
-
widgetName: name,
|
|
64
|
-
});
|
|
65
|
-
return { contents: [{ uri: uri.href, mimeType, text: html }] };
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
lookupDistFile(key) {
|
|
69
|
-
const manifest = this.readManifest();
|
|
70
|
-
return manifest[key]?.file;
|
|
71
|
-
}
|
|
72
|
-
lookupDistFileWithIndexFallback(basePath) {
|
|
73
|
-
const manifest = this.readManifest();
|
|
74
|
-
const flatFileKey = `${basePath}.tsx`;
|
|
75
|
-
const indexFileKey = `${basePath}/index.tsx`;
|
|
76
|
-
return manifest[flatFileKey]?.file ?? manifest[indexFileKey]?.file;
|
|
77
|
-
}
|
|
78
|
-
readManifest() {
|
|
79
|
-
return JSON.parse(readFileSync(path.join(process.cwd(), "dist", "assets", ".vite", "manifest.json"), "utf-8"));
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
//# sourceMappingURL=server.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../../src/server/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EACL,SAAS,IAAI,aAAa,GAG3B,MAAM,yCAAyC,CAAC;AAcjD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAqIrD,MAAM,OAAO,SAEX,SAAQ,aAAa;IAGrB,cAAc,CAKZ,IAAW,EACX,cAA+C,EAC/C,UAGC,EACD,YAA0C;QAQ1C,MAAM,gBAAgB,GAAiB;YACrC,GAAG,CAAC,cAAc,CAAC,KAAK,IAAI,EAAE,CAAC;SAChC,CAAC;QACF,IAAI,UAAU,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;YACzC,gBAAgB,CAAC,0BAA0B,CAAC,GAAG,UAAU,CAAC,WAAW,CAAC;QACxE,CAAC;QAED,MAAM,qBAAqB,GAAyB;YAClD,QAAQ,EAAE,UAAU;YACpB,GAAG,EAAE,yBAAyB,IAAI,OAAO;YACzC,QAAQ,EAAE,qBAAqB;SAChC,CAAC;QAEF,MAAM,qBAAqB,GAAyB;YAClD,QAAQ,EAAE,SAAS;YACnB,GAAG,EAAE,yBAAyB,IAAI,OAAO;YACzC,QAAQ,EAA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0 @@
|
|
|
1
|
-
import { readFileSync } from "node:fs";
|
|
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);
|
|
7
|
-
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
|
-
renderProduction(data) {
|
|
21
|
-
const template = this.loadTemplate("production");
|
|
22
|
-
return template(data);
|
|
23
|
-
}
|
|
24
|
-
renderDevelopment(data) {
|
|
25
|
-
const template = this.loadTemplate("development");
|
|
26
|
-
return template(data);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
export const templateHelper = new TemplateHelper();
|
|
30
|
-
//# sourceMappingURL=templateHelper.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"templateHelper.js","sourceRoot":"","sources":["../../../src/server/templateHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,UAAU,MAAM,YAAY,CAAC;AAGpC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAEtC,MAAM,cAAc;IACV,aAAa,GAAG,IAAI,GAAG,EAAsC,CAAC;IAE9D,YAAY,CAAC,YAAoB;QACvC,MAAM,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QACpD,IAAI,MAAM,EAAE,CAAC;YACX,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,MAAM,YAAY,GAAG,IAAI,CAAC,SAAS,EAAE,WAAW,EAAE,GAAG,YAAY,MAAM,CAAC,CAAC;QACzE,MAAM,cAAc,GAAG,YAAY,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QAC3D,MAAM,QAAQ,GAAG,UAAU,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;QAEpD,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;QAC/C,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,gBAAgB,CAAC,IAKhB;QACC,MAAM,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;QACjD,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC;IAED,iBAAiB,CAAC,IAIjB;QACC,MAAM,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;QAClD,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC;CACF;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,cAAc,EAAE,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<base href="{{serverUrl}}" />
|
|
2
|
-
<script type="module">window.skybridge = { hostType: "{{hostType}}" };</script>
|
|
3
|
-
<script type="module">
|
|
4
|
-
import { injectIntoGlobalHook } from "{{serverUrl}}/@react-refresh";
|
|
5
|
-
injectIntoGlobalHook(window); window.$RefreshReg$ = () => {};
|
|
6
|
-
window.$RefreshSig$ = () => (type) => type;
|
|
7
|
-
window.__vite_plugin_react_preamble_installed__ = true;
|
|
8
|
-
</script>
|
|
9
|
-
<script type="module" src="{{serverUrl}}/@vite/client"></script>
|
|
10
|
-
<div id="root"></div>
|
|
11
|
-
<script type="module" id="dev-widget-entry">
|
|
12
|
-
import('{{serverUrl}}/src/widgets/{{widgetName}}');
|
|
13
|
-
</script>
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
<base href="{{serverUrl}}" />
|
|
2
|
-
<script type="module">window.skybridge = { hostType: "{{hostType}}" };</script>
|
|
3
|
-
<div id="root"></div>
|
|
4
|
-
<script type="module">
|
|
5
|
-
import('{{serverUrl}}/assets/{{widgetFile}}');
|
|
6
|
-
</script>
|
|
7
|
-
<link rel="stylesheet" crossorigin href="{{serverUrl}}/assets/{{styleFile}}" />
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { type RequestHandler } from "express";
|
|
2
|
-
/**
|
|
3
|
-
* Install Vite dev server
|
|
4
|
-
* This router MUST be installed at the application root, like so:
|
|
5
|
-
*
|
|
6
|
-
* const app = express();
|
|
7
|
-
*
|
|
8
|
-
* if (env.NODE_ENV !== "production") {
|
|
9
|
-
* app.use(await widgetsRouter());
|
|
10
|
-
* }
|
|
11
|
-
*/
|
|
12
|
-
export declare const widgetsDevServer: () => Promise<RequestHandler>;
|