skybridge 0.0.0-dev.e523cea → 0.0.0-dev.e52a26e
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 +152 -0
- package/bin/run.js +0 -4
- 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/resolve-views-dir.d.ts +1 -0
- package/dist/cli/resolve-views-dir.js +17 -0
- package/dist/cli/resolve-views-dir.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 +2 -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 +87 -0
- package/dist/commands/build.js.map +1 -0
- package/dist/commands/create.d.ts +9 -0
- package/dist/commands/create.js +30 -0
- package/dist/commands/create.js.map +1 -0
- package/dist/commands/dev.d.ts +6 -1
- package/dist/commands/dev.js +87 -21
- package/dist/commands/dev.js.map +1 -1
- 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 +11 -0
- package/dist/server/asset-base-url-transform-plugin.js +48 -0
- package/dist/server/asset-base-url-transform-plugin.js.map +1 -0
- package/dist/server/asset-base-url-transform-plugin.test.d.ts +1 -0
- package/dist/server/asset-base-url-transform-plugin.test.js +134 -0
- package/dist/server/asset-base-url-transform-plugin.test.js.map +1 -0
- package/dist/server/auth.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 +11 -0
- package/dist/server/express.js +101 -0
- package/dist/server/express.js.map +1 -0
- package/dist/server/express.test.d.ts +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 +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 -61
- package/dist/server/server.js +516 -87
- package/dist/server/server.js.map +1 -1
- package/dist/server/templateHelper.d.ts +5 -7
- package/dist/server/templateHelper.js +3 -22
- package/dist/server/templateHelper.js.map +1 -1
- package/dist/server/templates.generated.d.ts +4 -0
- package/dist/server/templates.generated.js +47 -0
- package/dist/server/templates.generated.js.map +1 -0
- package/dist/server/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 +13 -21
- 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/adaptor.d.ts +50 -0
- package/dist/web/bridges/adaptor.js +314 -0
- package/dist/web/bridges/adaptor.js.map +1 -0
- package/dist/web/bridges/adaptor.test.d.ts +1 -0
- package/dist/web/bridges/adaptor.test.js +205 -0
- package/dist/web/bridges/adaptor.test.js.map +1 -0
- package/dist/web/bridges/apps-sdk/bridge.d.ts +11 -0
- package/dist/web/bridges/{apps-sdk-bridge.js → apps-sdk/bridge.js} +5 -5
- package/dist/web/bridges/apps-sdk/bridge.js.map +1 -0
- package/dist/web/bridges/apps-sdk/index.d.ts +4 -0
- package/dist/web/bridges/apps-sdk/index.js +4 -0
- package/dist/web/bridges/apps-sdk/index.js.map +1 -0
- package/dist/web/bridges/apps-sdk/types.d.ts +133 -0
- package/dist/web/bridges/apps-sdk/types.js +10 -0
- package/dist/web/bridges/apps-sdk/types.js.map +1 -0
- package/dist/web/bridges/apps-sdk/use-apps-sdk-context.d.ts +13 -0
- package/dist/web/bridges/apps-sdk/use-apps-sdk-context.js +18 -0
- package/dist/web/bridges/apps-sdk/use-apps-sdk-context.js.map +1 -0
- package/dist/web/bridges/get-adaptor.d.ts +11 -0
- package/dist/web/bridges/get-adaptor.js +30 -0
- package/dist/web/bridges/get-adaptor.js.map +1 -0
- package/dist/web/bridges/get-adaptor.test.d.ts +1 -0
- package/dist/web/bridges/get-adaptor.test.js +48 -0
- package/dist/web/bridges/get-adaptor.test.js.map +1 -0
- package/dist/web/bridges/host-context-stores.d.ts +27 -0
- package/dist/web/bridges/host-context-stores.js +73 -0
- package/dist/web/bridges/host-context-stores.js.map +1 -0
- package/dist/web/bridges/index.d.ts +5 -4
- package/dist/web/bridges/index.js +5 -4
- package/dist/web/bridges/index.js.map +1 -1
- package/dist/web/bridges/mcp-app/bridge.d.ts +27 -0
- package/dist/web/bridges/mcp-app/bridge.js +100 -0
- package/dist/web/bridges/mcp-app/bridge.js.map +1 -0
- package/dist/web/bridges/mcp-app/bridge.test.d.ts +1 -0
- package/dist/web/bridges/mcp-app/bridge.test.js +21 -0
- package/dist/web/bridges/mcp-app/bridge.test.js.map +1 -0
- package/dist/web/bridges/mcp-app/index.d.ts +3 -0
- package/dist/web/bridges/mcp-app/index.js +3 -0
- package/dist/web/bridges/mcp-app/index.js.map +1 -0
- package/dist/web/bridges/mcp-app/types.d.ts +8 -0
- package/dist/web/bridges/mcp-app/types.js +2 -0
- package/dist/web/bridges/mcp-app/types.js.map +1 -0
- package/dist/web/bridges/mcp-app/use-mcp-app-context.d.ts +19 -0
- package/dist/web/bridges/mcp-app/use-mcp-app-context.js +19 -0
- package/dist/web/bridges/mcp-app/use-mcp-app-context.js.map +1 -0
- package/dist/web/bridges/mcp-app/use-mcp-app-context.test.d.ts +1 -0
- package/dist/web/bridges/mcp-app/use-mcp-app-context.test.js +26 -0
- package/dist/web/bridges/mcp-app/use-mcp-app-context.test.js.map +1 -0
- package/dist/web/bridges/types.d.ts +159 -30
- package/dist/web/bridges/types.js +14 -1
- package/dist/web/bridges/types.js.map +1 -1
- package/dist/web/bridges/types.test.d.ts +1 -0
- package/dist/web/bridges/types.test.js +19 -0
- package/dist/web/bridges/types.test.js.map +1 -0
- package/dist/web/bridges/use-host-context.d.ts +7 -0
- package/dist/web/bridges/use-host-context.js +13 -0
- package/dist/web/bridges/use-host-context.js.map +1 -0
- package/dist/web/components/modal-provider.d.ts +4 -0
- package/dist/web/components/modal-provider.js +46 -0
- package/dist/web/components/modal-provider.js.map +1 -0
- package/dist/web/create-store.d.ts +26 -0
- package/dist/web/create-store.js +47 -8
- package/dist/web/create-store.js.map +1 -1
- package/dist/web/create-store.test.js +114 -53
- 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 +35 -5
- package/dist/web/data-llm.js.map +1 -1
- package/dist/web/data-llm.test.js +134 -65
- package/dist/web/data-llm.test.js.map +1 -1
- package/dist/web/generate-helpers.d.ts +24 -19
- 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 +17 -12
- 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 +6 -3
- package/dist/web/hooks/index.js +5 -2
- package/dist/web/hooks/index.js.map +1 -1
- package/dist/web/hooks/test/utils.d.ts +12 -2
- package/dist/web/hooks/test/utils.js +49 -14
- package/dist/web/hooks/test/utils.js.map +1 -1
- package/dist/web/hooks/use-call-tool.d.ts +48 -2
- package/dist/web/hooks/use-call-tool.js +30 -2
- package/dist/web/hooks/use-call-tool.js.map +1 -1
- package/dist/web/hooks/use-call-tool.test-d.js +1 -1
- package/dist/web/hooks/use-call-tool.test-d.js.map +1 -1
- package/dist/web/hooks/use-call-tool.test.js +64 -30
- 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 +23 -4
- 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 +55 -20
- 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 +103 -0
- package/dist/web/hooks/use-download.test.js.map +1 -0
- package/dist/web/hooks/use-files.d.ts +35 -6
- package/dist/web/hooks/use-files.js +37 -2
- package/dist/web/hooks/use-files.js.map +1 -1
- package/dist/web/hooks/use-files.test.js +40 -7
- package/dist/web/hooks/use-files.test.js.map +1 -1
- package/dist/web/hooks/use-layout.d.ts +4 -2
- package/dist/web/hooks/use-layout.js +6 -4
- package/dist/web/hooks/use-layout.js.map +1 -1
- package/dist/web/hooks/use-layout.test.js +65 -31
- 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 +19 -3
- package/dist/web/hooks/use-open-external.js.map +1 -1
- package/dist/web/hooks/use-open-external.test.js +44 -15
- 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 +46 -0
- package/dist/web/hooks/use-request-close.test.js.map +1 -0
- package/dist/web/hooks/use-request-modal.d.ts +18 -3
- package/dist/web/hooks/use-request-modal.js +25 -8
- package/dist/web/hooks/use-request-modal.js.map +1 -1
- package/dist/web/hooks/use-request-modal.test.js +15 -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 +47 -0
- package/dist/web/hooks/use-request-size.test.js.map +1 -0
- package/dist/web/hooks/use-send-follow-up-message.d.ts +19 -1
- package/dist/web/hooks/use-send-follow-up-message.js +20 -3
- package/dist/web/hooks/use-send-follow-up-message.js.map +1 -1
- package/dist/web/hooks/use-set-open-in-app-url.d.ts +18 -0
- package/dist/web/hooks/use-set-open-in-app-url.js +25 -0
- package/dist/web/hooks/use-set-open-in-app-url.js.map +1 -0
- package/dist/web/hooks/use-set-open-in-app-url.test.d.ts +1 -0
- package/dist/web/hooks/use-set-open-in-app-url.test.js +63 -0
- package/dist/web/hooks/use-set-open-in-app-url.test.js.map +1 -0
- package/dist/web/hooks/use-tool-info.d.ts +33 -0
- package/dist/web/hooks/use-tool-info.js +30 -4
- 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 +40 -30
- package/dist/web/hooks/use-tool-info.test.js.map +1 -1
- package/dist/web/hooks/use-user.d.ts +3 -1
- package/dist/web/hooks/use-user.js +22 -4
- package/dist/web/hooks/use-user.js.map +1 -1
- package/dist/web/hooks/use-user.test.js +104 -29
- 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 +181 -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-view.js +46 -0
- 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 +168 -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 +0 -1
- package/dist/web/proxy.js.map +1 -1
- package/dist/web/types.d.ts +4 -133
- package/dist/web/types.js +0 -9
- package/dist/web/types.js.map +1 -1
- package/package.json +56 -31
- package/tsconfig.base.json +33 -0
- package/dist/cli/use-version.d.ts +0 -1
- package/dist/cli/use-version.js +0 -33
- package/dist/cli/use-version.js.map +0 -1
- package/dist/server/templates/development.hbs +0 -66
- package/dist/server/templates/production.hbs +0 -7
- package/dist/server/widgetsDevServer.d.ts +0 -12
- package/dist/server/widgetsDevServer.js +0 -47
- package/dist/server/widgetsDevServer.js.map +0 -1
- package/dist/test/widget.test.js +0 -234
- package/dist/test/widget.test.js.map +0 -1
- package/dist/web/bridges/adaptors/apps-sdk-adaptor.d.ts +0 -13
- package/dist/web/bridges/adaptors/apps-sdk-adaptor.js +0 -33
- package/dist/web/bridges/adaptors/apps-sdk-adaptor.js.map +0 -1
- package/dist/web/bridges/adaptors/mcp-app-adaptor.d.ts +0 -16
- package/dist/web/bridges/adaptors/mcp-app-adaptor.js +0 -115
- package/dist/web/bridges/adaptors/mcp-app-adaptor.js.map +0 -1
- package/dist/web/bridges/apps-sdk-bridge.d.ts +0 -10
- package/dist/web/bridges/apps-sdk-bridge.js.map +0 -1
- package/dist/web/bridges/hooks/use-adaptor.d.ts +0 -2
- package/dist/web/bridges/hooks/use-adaptor.js +0 -8
- package/dist/web/bridges/hooks/use-adaptor.js.map +0 -1
- package/dist/web/bridges/hooks/use-apps-sdk-bridge.d.ts +0 -2
- package/dist/web/bridges/hooks/use-apps-sdk-bridge.js +0 -7
- package/dist/web/bridges/hooks/use-apps-sdk-bridge.js.map +0 -1
- package/dist/web/bridges/hooks/use-bridge.d.ts +0 -2
- package/dist/web/bridges/hooks/use-bridge.js +0 -8
- package/dist/web/bridges/hooks/use-bridge.js.map +0 -1
- package/dist/web/bridges/hooks/use-mcp-app-bridge.d.ts +0 -5
- package/dist/web/bridges/hooks/use-mcp-app-bridge.js +0 -7
- package/dist/web/bridges/hooks/use-mcp-app-bridge.js.map +0 -1
- package/dist/web/bridges/hooks/use-mcp-app-bridge.test.js +0 -62
- package/dist/web/bridges/hooks/use-mcp-app-bridge.test.js.map +0 -1
- package/dist/web/bridges/mcp-app-bridge.d.ts +0 -46
- package/dist/web/bridges/mcp-app-bridge.js +0 -217
- package/dist/web/bridges/mcp-app-bridge.js.map +0 -1
- package/dist/web/hooks/use-openai-global.d.ts +0 -3
- package/dist/web/hooks/use-openai-global.js +0 -6
- package/dist/web/hooks/use-openai-global.js.map +0 -1
- package/dist/web/hooks/use-widget-state.d.ts +0 -4
- package/dist/web/hooks/use-widget-state.js +0 -32
- package/dist/web/hooks/use-widget-state.js.map +0 -1
- package/dist/web/hooks/use-widget-state.test.js +0 -61
- package/dist/web/hooks/use-widget-state.test.js.map +0 -1
- package/dist/web/mount-widget.d.ts +0 -1
- package/dist/web/mount-widget.js +0 -19
- package/dist/web/mount-widget.js.map +0 -1
- /package/dist/{test/widget.test.d.ts → cli/tunnel-control-server.test.d.ts} +0 -0
- /package/dist/{web/bridges/hooks/use-mcp-app-bridge.test.d.ts → cli/tunnel-handler.test.d.ts} +0 -0
- /package/dist/{web/hooks/use-widget-state.test.d.ts → cli/tunnel.test.d.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform-data-llm.js","sourceRoot":"","sources":["../../../src/web/plugin/transform-data-llm.ts"],"names":[],"mappings":"AAEA,MAAM,iBAAiB,GAAG,eAAe,CAAC;AAO1C,SAAS,iBAAiB,CAAC,CAAe;IACxC,OAAO;QACL,IAAI,EAAE,gBAAgB;QAEtB,OAAO,EAAE;YACP,OAAO,EAAE;gBACP,KAAK,CAAC,IAAI,EAAE,KAAK;oBACf,KAAK,CAAC,gBAAgB,GAAG,KAAK,CAAC;oBAC/B,KAAK,CAAC,kBAAkB,GAAG,KAAK,CAAC;oBAEjC,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;wBAClC,IAAI,CAAC,CAAC,CAAC,mBAAmB,CAAC,IAAI,CAAC,EAAE,CAAC;4BACjC,SAAS;wBACX,CAAC;wBACD,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,KAAK,iBAAiB,EAAE,CAAC;4BAC5C,SAAS;wBACX,CAAC;wBAED,MAAM,YAAY,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CACvC,CAAC,CAAC,EAAE,EAAE,CACJ,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC;4BACtB,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAClD,CAAC;wBAEF,IAAI,YAAY,EAAE,CAAC;4BACjB,KAAK,CAAC,gBAAgB,GAAG,IAAI,CAAC;4BAC9B,MAAM;wBACR,CAAC;oBACH,CAAC;gBACH,CAAC;gBAED,IAAI,CAAC,IAAI,EAAE,KAAK;oBACd,IAAI,KAAK,CAAC,kBAAkB,IAAI,CAAC,KAAK,CAAC,gBAAgB,EAAE,CAAC;wBACxD,MAAM,UAAU,GAAG,CAAC,CAAC,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AO,GAAG,CAAC,CAAC,UAAU,CAC1B,UAAU,EACV,UAAU,EACV,CAAC,iBAAiB,CAAC,EACnB,KAAK,CACN,CAAC;gBAEF,KAAK,CAAC,kBAAkB,GAAG,IAAI,CAAC;gBAChC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;YAC5B,CAAC;SACF;KACF,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,SAAS,GAAG,KAAK,EAAE,IAAY,EAAE,EAAU,EAAE,EAAE;IAC1D,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;QAC7B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,EAAE,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC;QAChC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,yEAAyE;IACzE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,aAAa,EAAE,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,CAAC;IAEhE,MAAM,YAAY,GAAqB;QACrC,OAAO,EAAE,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;QAC/B,UAAU,EAAE;YACV,OAAO,EAAE,CAAC,KAAK,EAAE,YAAY,CAAC;SAC/B;QACD,QAAQ,EAAE,EAAE;QACZ,cAAc,EAAE,EAAE;KACnB,CAAC;IAEF,MAAM,MAAM,GAAG,aAAa,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;IAEjD,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC;QAClB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO;QACL,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,GAAG,EAAE,MAAM,CAAC,GAAG,IAAI,IAAI;KACxB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type { PluginObj, TransformOptions, types } from \"@babel/core\";\n\nconst LLM_IMPORT_SOURCE = \"skybridge/web\";\n\ninterface State {\n hasDataLLMImport?: boolean;\n needsDataLLMImport?: boolean;\n}\n\nfunction createBabelPlugin(t: typeof types): PluginObj<State> {\n return {\n name: \"data-llm-babel\",\n\n visitor: {\n Program: {\n enter(path, state) {\n state.hasDataLLMImport = false;\n state.needsDataLLMImport = false;\n\n for (const node of path.node.body) {\n if (!t.isImportDeclaration(node)) {\n continue;\n }\n if (node.source.value !== LLM_IMPORT_SOURCE) {\n continue;\n }\n\n const hasSpecifier = node.specifiers.some(\n (s) =>\n t.isImportSpecifier(s) &&\n t.isIdentifier(s.imported, { name: \"DataLLM\" }),\n );\n\n if (hasSpecifier) {\n state.hasDataLLMImport = true;\n break;\n }\n }\n },\n\n exit(path, state) {\n if (state.needsDataLLMImport && !state.hasDataLLMImport) {\n const importDecl = t.importDeclaration(\n [\n t.importSpecifier(\n t.identifier(\"DataLLM\"),\n t.identifier(\"DataLLM\"),\n ),\n ],\n t.stringLiteral(LLM_IMPORT_SOURCE),\n );\n\n path.node.body.unshift(importDecl);\n }\n },\n },\n\n JSXElement(path, state) {\n const opening = path.node.openingElement;\n const attributes = opening.attributes;\n\n const llmAttributeIndex = attributes.findIndex(\n (attribute) =>\n t.isJSXAttribute(attribute) &&\n t.isJSXIdentifier(attribute.name, { name: \"data-llm\" }),\n );\n\n if (llmAttributeIndex === -1) {\n return;\n }\n\n const llmAttribute = attributes[\n llmAttributeIndex\n ] as types.JSXAttribute;\n\n let contentExpression: types.Expression;\n\n if (t.isStringLiteral(llmAttribute.value)) {\n contentExpression = llmAttribute.value;\n } else if (t.isJSXExpressionContainer(llmAttribute.value)) {\n contentExpression = llmAttribute.value.expression as types.Expression;\n } else {\n return;\n }\n\n const contentAttr = t.jsxAttribute(\n t.jsxIdentifier(\"content\"),\n t.isStringLiteral(contentExpression)\n ? contentExpression\n : t.jsxExpressionContainer(contentExpression),\n );\n\n const filteredAttributes = attributes.filter(\n (_, index) => index !== llmAttributeIndex,\n );\n const newOpening = t.jsxOpeningElement(\n opening.name,\n filteredAttributes,\n opening.selfClosing,\n );\n\n const elementWithoutLlm = t.jsxElement(\n newOpening,\n path.node.closingElement,\n path.node.children,\n path.node.selfClosing,\n );\n\n const llmOpening = t.jsxOpeningElement(t.jsxIdentifier(\"DataLLM\"), [\n contentAttr,\n ]);\n const llmClosing = t.jsxClosingElement(t.jsxIdentifier(\"DataLLM\"));\n\n const wrapped = t.jsxElement(\n llmOpening,\n llmClosing,\n [elementWithoutLlm],\n false,\n );\n\n state.needsDataLLMImport = true;\n path.replaceWith(wrapped);\n },\n },\n };\n}\n\nexport const transform = async (code: string, id: string) => {\n if (!/\\.(jsx|tsx)$/.test(id)) {\n return null;\n }\n\n if (id.includes(\"node_modules\")) {\n return null;\n }\n\n // Dynamic import to ensure @babel/core is only loaded in Node.js context\n const { types: t, transformSync } = await import(\"@babel/core\");\n\n const babelOptions: TransformOptions = {\n plugins: [createBabelPlugin(t)],\n parserOpts: {\n plugins: [\"jsx\", \"typescript\"],\n },\n filename: id,\n sourceFileName: id,\n };\n\n const result = transformSync(code, babelOptions);\n\n if (!result?.code) {\n return null;\n }\n\n return {\n code: result.code,\n map: result.map || null,\n };\n};\n"]}
|
|
@@ -1 +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,QAAQ,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;IAC/B,EAAE,CAAC,6DAA6D,EAAE,KAAK,IAAI,EAAE;QAC3E,MAAM,IAAI,GAAG;;;;KAIZ,CAAC;QAEF,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QAEjD,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;QAC9B,MAAM,CAAC,M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,CAAC,CAAC;IAEH,EAAE,CAAC,yCAAyC,EAAE,KAAK,IAAI,EAAE;QACvD,sBAAsB;QACtB,MAAM,cAAc,GAAG;;;;;KAKtB,CAAC;QACF,MAAM,OAAO,GAAG,MAAM,SAAS,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;QAC5D,MAAM,CACJ,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,wCAAwC,CAAC,CAC9D,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QAElB,iDAAiD;QACjD,MAAM,cAAc,GAAG;;;;;;KAMtB,CAAC;QACF,MAAM,OAAO,GAAG,MAAM,SAAS,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;QAC5D,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,SAAS,CAAC,2BAA2B,CAAC,CAAC;QAC7D,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,SAAS,CAAC,kCAAkC,CAAC,CAAC;QACpE,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,SAAS,CAAC,yCAAyC,CAAC,CAAC;IAC7E,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,6DAA6D,EAAE,KAAK,IAAI,EAAE;QAC3E,MAAM,IAAI,GAAG;;;;;;;;;;;;;KAaZ,CAAC;QAEF,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QAEjD,MAAM,CAAC,MAAM,CAAC,CAAC,eAAe,EAAE,CAAC;IACnC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { describe, expect, it } from \"vitest\";\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"]}
|
package/dist/web/proxy.js
CHANGED
|
@@ -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");
|
package/dist/web/proxy.js.map
CHANGED
|
@@ -1 +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
|
|
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,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,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ;YAC/B,OAAO,CAAC,GAAG,CACT,yBAAyB,MAAM,CAAC,IAAI,CAAC,EAAE,EACvC,UAAU,MAAM,CAAC,KAAK,EAAE,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"]}
|
package/dist/web/types.d.ts
CHANGED
|
@@ -1,149 +1,20 @@
|
|
|
1
1
|
import "react";
|
|
2
|
-
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
|
|
3
|
-
import type { WidgetHostType } from "../server/index.js";
|
|
4
2
|
declare module "react" {
|
|
5
3
|
interface HTMLAttributes<T> {
|
|
6
4
|
"data-llm"?: string;
|
|
7
5
|
}
|
|
8
6
|
}
|
|
7
|
+
/** Shorthand for an arbitrary plain object — `Record<string, unknown>`. */
|
|
9
8
|
export type UnknownObject = Record<string, unknown>;
|
|
9
|
+
/** Flatten an intersection so it appears as a single object type in hovers and error messages. */
|
|
10
10
|
export type Prettify<T> = {
|
|
11
11
|
[K in keyof T]: T[K];
|
|
12
12
|
} & {};
|
|
13
|
+
/** Widen `T` to also satisfy {@link UnknownObject}, useful for tool input/output narrowing. */
|
|
13
14
|
export type Objectify<T> = T & UnknownObject;
|
|
14
15
|
type RequiredKeys<T> = {
|
|
15
16
|
[K in keyof T]-?: Record<string, never> extends Pick<T, K> ? never : K;
|
|
16
17
|
}[keyof T];
|
|
18
|
+
/** `true` if `T` has at least one required key, `false` if every key is optional. */
|
|
17
19
|
export type HasRequiredKeys<T> = RequiredKeys<T> extends never ? false : true;
|
|
18
|
-
type WidgetState = UnknownObject;
|
|
19
|
-
type FileMetadata = {
|
|
20
|
-
fileId: string;
|
|
21
|
-
};
|
|
22
|
-
export declare const TOOL_RESPONSE_EVENT_TYPE = "openai:tool_response";
|
|
23
|
-
export declare class ToolResponseEvent extends CustomEvent<{
|
|
24
|
-
tool: {
|
|
25
|
-
name: string;
|
|
26
|
-
args: UnknownObject;
|
|
27
|
-
};
|
|
28
|
-
}> {
|
|
29
|
-
readonly type = "openai:tool_response";
|
|
30
|
-
}
|
|
31
|
-
declare global {
|
|
32
|
-
interface Window {
|
|
33
|
-
skybridge: SkybridgeProperties;
|
|
34
|
-
openai: OpenAiMethods<WidgetState> & OpenAiProperties;
|
|
35
|
-
}
|
|
36
|
-
interface WindowEventMap {
|
|
37
|
-
[SET_GLOBALS_EVENT_TYPE]: SetGlobalsEvent;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
export type SkybridgeProperties = {
|
|
41
|
-
hostType: WidgetHostType;
|
|
42
|
-
};
|
|
43
|
-
export type OpenAiProperties<ToolInput extends UnknownObject = Record<never, unknown>, ToolOutput extends UnknownObject = UnknownObject, ToolResponseMetadata extends UnknownObject = UnknownObject, WidgetState extends UnknownObject = UnknownObject> = {
|
|
44
|
-
theme: Theme;
|
|
45
|
-
userAgent: UserAgent;
|
|
46
|
-
locale: string;
|
|
47
|
-
maxHeight: number;
|
|
48
|
-
displayMode: DisplayMode;
|
|
49
|
-
safeArea: SafeArea;
|
|
50
|
-
view: View;
|
|
51
|
-
toolInput: ToolInput;
|
|
52
|
-
toolOutput: ToolOutput | {
|
|
53
|
-
text: string;
|
|
54
|
-
} | null;
|
|
55
|
-
toolResponseMetadata: ToolResponseMetadata | null;
|
|
56
|
-
widgetState: WidgetState | null;
|
|
57
|
-
};
|
|
58
|
-
export type CallToolArgs = Record<string, unknown> | null;
|
|
59
|
-
export type CallToolResponse = {
|
|
60
|
-
content: CallToolResult["content"];
|
|
61
|
-
structuredContent: Record<string, unknown>;
|
|
62
|
-
isError: boolean;
|
|
63
|
-
result: string;
|
|
64
|
-
_meta?: CallToolResult["_meta"];
|
|
65
|
-
};
|
|
66
|
-
export type RequestModalOptions = {
|
|
67
|
-
title?: string;
|
|
68
|
-
params?: Record<string, unknown>;
|
|
69
|
-
anchor?: {
|
|
70
|
-
top?: number;
|
|
71
|
-
left?: number;
|
|
72
|
-
width?: number;
|
|
73
|
-
height?: number;
|
|
74
|
-
};
|
|
75
|
-
};
|
|
76
|
-
export type OpenAiMethods<WidgetState extends UnknownObject = UnknownObject> = {
|
|
77
|
-
/** Calls a tool on your MCP. Returns the full response. */
|
|
78
|
-
callTool: <ToolArgs extends CallToolArgs = null, ToolResponse extends CallToolResponse = CallToolResponse>(name: string, args: ToolArgs) => Promise<ToolResponse>;
|
|
79
|
-
/** Triggers a followup turn in the ChatGPT conversation */
|
|
80
|
-
sendFollowUpMessage: (args: {
|
|
81
|
-
prompt: string;
|
|
82
|
-
}) => Promise<void>;
|
|
83
|
-
/** Opens an external link, redirects web page or mobile app */
|
|
84
|
-
openExternal(args: {
|
|
85
|
-
href: string;
|
|
86
|
-
}): void;
|
|
87
|
-
/** For transitioning an app from inline to fullscreen or pip */
|
|
88
|
-
requestDisplayMode: (args: {
|
|
89
|
-
mode: DisplayMode;
|
|
90
|
-
}) => Promise<{
|
|
91
|
-
/**
|
|
92
|
-
* The granted display mode. The host may reject the request.
|
|
93
|
-
* For mobile, PiP is always coerced to fullscreen.
|
|
94
|
-
*/
|
|
95
|
-
mode: DisplayMode;
|
|
96
|
-
}>;
|
|
97
|
-
/**
|
|
98
|
-
* Sets the widget state.
|
|
99
|
-
* This state is persisted across widget renders.
|
|
100
|
-
*/
|
|
101
|
-
setWidgetState: (state: WidgetState) => Promise<void>;
|
|
102
|
-
/**
|
|
103
|
-
* Opens a modal portaled outside of the widget iFrame.
|
|
104
|
-
* This ensures the modal is correctly displayed and not limited to the widget's area.
|
|
105
|
-
*/
|
|
106
|
-
requestModal: (args: RequestModalOptions) => Promise<void>;
|
|
107
|
-
/** Uploads a new file to the host */
|
|
108
|
-
uploadFile: (file: File) => Promise<FileMetadata>;
|
|
109
|
-
/**
|
|
110
|
-
* Downloads a file from the host that was previously uploaded.
|
|
111
|
-
* Only files uploaded by the same connector instance can be downloaded.
|
|
112
|
-
*/
|
|
113
|
-
downloadFile: (file: FileMetadata) => Promise<{
|
|
114
|
-
downloadUrl: string;
|
|
115
|
-
}>;
|
|
116
|
-
};
|
|
117
|
-
export declare const SET_GLOBALS_EVENT_TYPE = "openai:set_globals";
|
|
118
|
-
export declare class SetGlobalsEvent extends CustomEvent<{
|
|
119
|
-
globals: Partial<OpenAiProperties>;
|
|
120
|
-
}> {
|
|
121
|
-
readonly type = "openai:set_globals";
|
|
122
|
-
}
|
|
123
|
-
export type CallTool = (name: string, args: Record<string, unknown>) => Promise<CallToolResponse>;
|
|
124
|
-
export type DisplayMode = "pip" | "inline" | "fullscreen" | "modal";
|
|
125
|
-
export type View = {
|
|
126
|
-
mode: DisplayMode;
|
|
127
|
-
params?: Record<string, unknown>;
|
|
128
|
-
};
|
|
129
|
-
export type Theme = "light" | "dark";
|
|
130
|
-
export type SafeAreaInsets = {
|
|
131
|
-
top: number;
|
|
132
|
-
bottom: number;
|
|
133
|
-
left: number;
|
|
134
|
-
right: number;
|
|
135
|
-
};
|
|
136
|
-
export type SafeArea = {
|
|
137
|
-
insets: SafeAreaInsets;
|
|
138
|
-
};
|
|
139
|
-
export type DeviceType = "mobile" | "tablet" | "desktop" | "unknown";
|
|
140
|
-
export type UserAgent = {
|
|
141
|
-
device: {
|
|
142
|
-
type: DeviceType;
|
|
143
|
-
};
|
|
144
|
-
capabilities: {
|
|
145
|
-
hover: boolean;
|
|
146
|
-
touch: boolean;
|
|
147
|
-
};
|
|
148
|
-
};
|
|
149
20
|
export {};
|
package/dist/web/types.js
CHANGED
|
@@ -1,11 +1,2 @@
|
|
|
1
1
|
import "react";
|
|
2
|
-
export const TOOL_RESPONSE_EVENT_TYPE = "openai:tool_response";
|
|
3
|
-
export class ToolResponseEvent extends CustomEvent {
|
|
4
|
-
type = TOOL_RESPONSE_EVENT_TYPE;
|
|
5
|
-
}
|
|
6
|
-
// Dispatched when any global changes in the host page
|
|
7
|
-
export const SET_GLOBALS_EVENT_TYPE = "openai:set_globals";
|
|
8
|
-
export class SetGlobalsEvent extends CustomEvent {
|
|
9
|
-
type = SET_GLOBALS_EVENT_TYPE;
|
|
10
|
-
}
|
|
11
2
|
//# sourceMappingURL=types.js.map
|
package/dist/web/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/web/types.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,CAAC
|
|
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\n/** Shorthand for an arbitrary plain object — `Record<string, unknown>`. */\nexport type UnknownObject = Record<string, unknown>;\n\n/** Flatten an intersection so it appears as a single object type in hovers and error messages. */\nexport type Prettify<T> = { [K in keyof T]: T[K] } & {};\n/** Widen `T` to also satisfy {@link UnknownObject}, useful for tool input/output narrowing. */\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];\n/** `true` if `T` has at least one required key, `false` if every key is optional. */\nexport type HasRequiredKeys<T> = RequiredKeys<T> extends never ? false : true;\n"]}
|
package/package.json
CHANGED
|
@@ -1,16 +1,23 @@
|
|
|
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.e52a26e",
|
|
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
22
|
"types": "./dist/server/index.d.ts",
|
|
16
23
|
"default": "./dist/server/index.js"
|
|
@@ -18,6 +25,10 @@
|
|
|
18
25
|
"./web": {
|
|
19
26
|
"types": "./dist/web/index.d.ts",
|
|
20
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
34
|
"keywords": [
|
|
@@ -29,43 +40,51 @@
|
|
|
29
40
|
"author": "Frédéric Barthelet",
|
|
30
41
|
"license": "ISC",
|
|
31
42
|
"peerDependencies": {
|
|
32
|
-
"@modelcontextprotocol/sdk": ">=1.
|
|
43
|
+
"@modelcontextprotocol/sdk": ">=1.27.0",
|
|
44
|
+
"@skybridge/devtools": "^1.0.0",
|
|
45
|
+
"nodemon": ">=3.0.0",
|
|
33
46
|
"react": ">=18.0.0",
|
|
34
|
-
"react-dom": ">=18.0.0"
|
|
47
|
+
"react-dom": ">=18.0.0",
|
|
48
|
+
"vite": ">=7.3.1"
|
|
35
49
|
},
|
|
36
50
|
"dependencies": {
|
|
37
|
-
"@babel/core": "^7.
|
|
38
|
-
"@
|
|
39
|
-
"
|
|
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",
|
|
40
57
|
"dequal": "^2.0.3",
|
|
41
|
-
"es-toolkit": "^1.
|
|
58
|
+
"es-toolkit": "^1.45.1",
|
|
42
59
|
"express": "^5.2.1",
|
|
43
|
-
"handlebars": "^4.7.
|
|
44
|
-
"ink": "^
|
|
60
|
+
"handlebars": "^4.7.9",
|
|
61
|
+
"ink": "^7.0.0",
|
|
62
|
+
"open": "^11.0.0",
|
|
63
|
+
"posthog-node": "^5.28.9",
|
|
45
64
|
"superjson": "^2.2.6",
|
|
46
|
-
"
|
|
47
|
-
"zustand": "^5.0.9"
|
|
65
|
+
"zustand": "^5.0.12"
|
|
48
66
|
},
|
|
49
67
|
"devDependencies": {
|
|
50
|
-
"@modelcontextprotocol/
|
|
51
|
-
"@modelcontextprotocol/sdk": "^1.25.2",
|
|
68
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
52
69
|
"@testing-library/dom": "^10.4.1",
|
|
53
|
-
"@testing-library/react": "^16.3.
|
|
70
|
+
"@testing-library/react": "^16.3.2",
|
|
54
71
|
"@total-typescript/tsconfig": "^1.0.4",
|
|
55
72
|
"@types/babel__core": "^7.20.5",
|
|
56
73
|
"@types/cors": "^2.8.19",
|
|
74
|
+
"@types/cross-spawn": "^6.0.6",
|
|
57
75
|
"@types/express": "^5.0.6",
|
|
58
|
-
"@types/jsdom": "^
|
|
59
|
-
"@types/node": "^24.
|
|
60
|
-
"@types/react": "^19.2.
|
|
76
|
+
"@types/jsdom": "^28.0.1",
|
|
77
|
+
"@types/node": "^24.12.0",
|
|
78
|
+
"@types/react": "^19.2.14",
|
|
61
79
|
"@types/react-dom": "^19.2.3",
|
|
62
|
-
"@vitest/ui": "^4.
|
|
63
|
-
"jsdom": "^
|
|
64
|
-
"shx": "^0.
|
|
80
|
+
"@vitest/ui": "^4.1.4",
|
|
81
|
+
"jsdom": "^29.0.1",
|
|
82
|
+
"shx": "^0.4.0",
|
|
65
83
|
"ts-node": "^10.9.2",
|
|
66
|
-
"typescript": "^
|
|
67
|
-
"
|
|
68
|
-
"
|
|
84
|
+
"typescript": "^6.0.2",
|
|
85
|
+
"vite": "^8.0.0",
|
|
86
|
+
"vitest": "^4.1.4",
|
|
87
|
+
"zod": "^4.3.6"
|
|
69
88
|
},
|
|
70
89
|
"bin": {
|
|
71
90
|
"sb": "./bin/run.js",
|
|
@@ -75,15 +94,21 @@
|
|
|
75
94
|
"bin": "skybridge",
|
|
76
95
|
"commands": "./dist/commands",
|
|
77
96
|
"dirname": "skybridge",
|
|
78
|
-
"topicSeparator": " "
|
|
97
|
+
"topicSeparator": " ",
|
|
98
|
+
"helpClass": {
|
|
99
|
+
"target": "./dist/commands/create",
|
|
100
|
+
"identifier": "SkybridgeHelp"
|
|
101
|
+
},
|
|
102
|
+
"hooks": {
|
|
103
|
+
"finally": "./dist/cli/telemetry"
|
|
104
|
+
}
|
|
79
105
|
},
|
|
80
106
|
"scripts": {
|
|
81
|
-
"build": "shx rm -rf dist &&
|
|
82
|
-
"build:templates": "
|
|
107
|
+
"build": "shx rm -rf dist && pnpm run build:templates && tsc",
|
|
108
|
+
"build:templates": "node scripts/precompile-templates.mjs",
|
|
83
109
|
"format": "biome check --write --error-on-warnings",
|
|
84
|
-
"test": "pnpm run test:unit && pnpm run test:
|
|
85
|
-
"test:unit": "vitest run",
|
|
86
|
-
"test:type": "tsc --noEmit",
|
|
110
|
+
"test": "pnpm run test:unit && pnpm run test:format",
|
|
111
|
+
"test:unit": "pnpm run build:templates && vitest run",
|
|
87
112
|
"test:format": "biome ci"
|
|
88
113
|
}
|
|
89
114
|
}
|
|
@@ -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 +0,0 @@
|
|
|
1
|
-
export declare const useVersion: () => string | undefined;
|
package/dist/cli/use-version.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import { fileURLToPath } from "node:url";
|
|
4
|
-
import { useEffect, useState } from "react";
|
|
5
|
-
function findPackageJson(startDir) {
|
|
6
|
-
let currentDir = startDir;
|
|
7
|
-
const root = path.parse(currentDir).root;
|
|
8
|
-
while (currentDir !== root) {
|
|
9
|
-
const packageJsonPath = path.join(currentDir, "package.json");
|
|
10
|
-
if (existsSync(packageJsonPath)) {
|
|
11
|
-
return packageJsonPath;
|
|
12
|
-
}
|
|
13
|
-
currentDir = path.dirname(currentDir);
|
|
14
|
-
}
|
|
15
|
-
return null;
|
|
16
|
-
}
|
|
17
|
-
function getPackageVersion() {
|
|
18
|
-
const currentFileDir = path.dirname(fileURLToPath(import.meta.url));
|
|
19
|
-
const packageJsonPath = findPackageJson(currentFileDir);
|
|
20
|
-
if (!packageJsonPath) {
|
|
21
|
-
return "";
|
|
22
|
-
}
|
|
23
|
-
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
|
|
24
|
-
return packageJson.version || "";
|
|
25
|
-
}
|
|
26
|
-
export const useVersion = () => {
|
|
27
|
-
const [version, setVersion] = useState();
|
|
28
|
-
useEffect(() => {
|
|
29
|
-
setVersion(getPackageVersion());
|
|
30
|
-
}, []);
|
|
31
|
-
return version;
|
|
32
|
-
};
|
|
33
|
-
//# sourceMappingURL=use-version.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-version.js","sourceRoot":"","sources":["../../src/cli/use-version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,SAAS,eAAe,CAAC,QAAgB;IACvC,IAAI,UAAU,GAAG,QAAQ,CAAC;IAC1B,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC;IAEzC,OAAO,UAAU,KAAK,IAAI,EAAE,CAAC;QAC3B,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;QAC9D,IAAI,UAAU,CAAC,eAAe,CAAC,EAAE,CAAC;YAChC,OAAO,eAAe,CAAC;QACzB,CAAC;QACD,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACxC,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,iBAAiB;IACxB,MAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IACpE,MAAM,eAAe,GAAG,eAAe,CAAC,cAAc,CAAC,CAAC;IAExD,IAAI,CAAC,eAAe,EAAE,CAAC;QACrB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC,CAAC;IACvE,OAAO,WAAW,CAAC,OAAO,IAAI,EAAE,CAAC;AACnC,CAAC;AAED,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,EAAE;IAC7B,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,EAAU,CAAC;IAEjD,SAAS,CAAC,GAAG,EAAE;QACb,UAAU,CAAC,iBAAiB,EAAE,CAAC,CAAC;IAClC,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC"}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
<base href="{{serverUrl}}" />
|
|
2
|
-
<script type="module">window.skybridge = { hostType: "{{hostType}}" };</script>
|
|
3
|
-
<script type="module">
|
|
4
|
-
import { injectIntoGlobalHook } from "{{serverUrl}}/assets/@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
|
-
<script type="module">
|
|
11
|
-
// Checks for browser support and shows error if local network access is denied
|
|
12
|
-
(async () => {
|
|
13
|
-
if (!navigator.permissions?.query) {
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
// Skip for non-http(s) protocols (file://, custom protocols in Electron, etc.)
|
|
18
|
-
const protocol = window.location.protocol;
|
|
19
|
-
const isNonHttpProtocol = protocol !== 'http:' && protocol !== 'https:'
|
|
20
|
-
if (isNonHttpProtocol) {
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const host = window.location.hostname;
|
|
25
|
-
const isLoopback = host === 'localhost'
|
|
26
|
-
|| /^127\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/.test(host)
|
|
27
|
-
|| host === '::1';
|
|
28
|
-
if (isLoopback) {
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
try {
|
|
33
|
-
const status = await navigator.permissions.query({ name: "local-network-access" });
|
|
34
|
-
if (status.state === "denied") {
|
|
35
|
-
const errorDiv = document.createElement("div");
|
|
36
|
-
errorDiv.style.cssText = "background: #fef2f2; border: 2px solid #ef4444; border-radius: 8px; padding: 16px; text-align: center; z-index: 10000; font-family: system-ui, sans-serif;";
|
|
37
|
-
|
|
38
|
-
const errorTitle = document.createElement("div");
|
|
39
|
-
errorTitle.style.cssText = "color: #ef4444; font-size: 18px; font-weight: 600; margin-bottom: 8px;";
|
|
40
|
-
errorTitle.textContent = "Error: Local network access permission is denied.";
|
|
41
|
-
|
|
42
|
-
const errorMessage = document.createElement("div");
|
|
43
|
-
errorMessage.style.cssText = "color: #ef4444; font-size: 14px;";
|
|
44
|
-
errorMessage.textContent = "Local network access is required for your widget to connect to the local dev server. Please enable it in your browser settings. ";
|
|
45
|
-
|
|
46
|
-
const link = document.createElement("a");
|
|
47
|
-
link.href = "https://developer.chrome.com/blog/local-network-access";
|
|
48
|
-
link.target = "_blank";
|
|
49
|
-
link.rel = "noopener noreferrer";
|
|
50
|
-
link.style.cssText = "color: #ef4444; text-decoration: underline;";
|
|
51
|
-
link.textContent = "Learn more";
|
|
52
|
-
errorMessage.appendChild(link);
|
|
53
|
-
|
|
54
|
-
errorDiv.appendChild(errorTitle);
|
|
55
|
-
errorDiv.appendChild(errorMessage);
|
|
56
|
-
document.body.appendChild(errorDiv);
|
|
57
|
-
}
|
|
58
|
-
} catch (e) {
|
|
59
|
-
// Permission API doesn't support local-network-access, ignore silently
|
|
60
|
-
}
|
|
61
|
-
})();
|
|
62
|
-
</script>
|
|
63
|
-
<div id="root"></div>
|
|
64
|
-
<script type="module" id="dev-widget-entry">
|
|
65
|
-
import('{{serverUrl}}/src/widgets/{{widgetName}}');
|
|
66
|
-
</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 Router } 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<Router>;
|