skybridge 0.0.0-dev.bd84fae → 0.0.0-dev.bd8fdfd
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 -674
- package/README.md +89 -142
- 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/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-nodemon.d.ts +7 -0
- package/dist/cli/use-nodemon.js +76 -0
- package/dist/cli/use-nodemon.js.map +1 -0
- package/dist/cli/use-typescript-check.d.ts +8 -0
- package/dist/cli/use-typescript-check.js +59 -0
- package/dist/cli/use-typescript-check.js.map +1 -0
- package/dist/commands/build.d.ts +9 -0
- package/dist/commands/build.js +46 -0
- package/dist/commands/build.js.map +1 -0
- package/dist/commands/dev.d.ts +10 -0
- package/dist/commands/dev.js +42 -0
- package/dist/commands/dev.js.map +1 -0
- package/dist/commands/start.d.ts +9 -0
- package/dist/commands/start.js +52 -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 +34 -0
- package/dist/server/asset-base-url-transform-plugin.js.map +1 -0
- package/dist/server/asset-base-url-transform-plugin.test.js +56 -0
- package/dist/server/asset-base-url-transform-plugin.test.js.map +1 -0
- package/dist/server/const.d.ts +1 -0
- package/dist/server/const.js +2 -0
- package/dist/server/const.js.map +1 -0
- package/dist/server/express.d.ts +9 -0
- package/dist/server/express.js +72 -0
- package/dist/server/express.js.map +1 -0
- package/dist/server/express.test.js +74 -0
- package/dist/server/express.test.js.map +1 -0
- package/dist/server/index.d.ts +5 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/inferUtilityTypes.d.ts +64 -0
- package/dist/server/inferUtilityTypes.js +2 -0
- package/dist/server/inferUtilityTypes.js.map +1 -0
- package/dist/server/middleware.d.ts +96 -0
- package/dist/server/middleware.js +93 -0
- package/dist/server/middleware.js.map +1 -0
- package/dist/server/middleware.test-d.js +52 -0
- package/dist/server/middleware.test-d.js.map +1 -0
- package/dist/server/middleware.test.js +383 -0
- package/dist/server/middleware.test.js.map +1 -0
- package/dist/server/server.d.ts +139 -0
- package/dist/server/server.js +259 -0
- package/dist/server/server.js.map +1 -0
- package/dist/{src/server → server}/templateHelper.d.ts +4 -0
- package/dist/{src/server → server}/templateHelper.js +5 -4
- package/dist/server/templateHelper.js.map +1 -0
- package/dist/server/templates/development.hbs +67 -0
- package/dist/{src/server → server}/templates/production.hbs +1 -1
- package/dist/{src/server → server}/widgetsDevServer.d.ts +2 -2
- package/dist/server/widgetsDevServer.js +63 -0
- package/dist/server/widgetsDevServer.js.map +1 -0
- package/dist/test/utils.d.ts +135 -0
- package/dist/test/utils.js +242 -0
- package/dist/test/utils.js.map +1 -0
- package/dist/test/widget.test.js +261 -0
- package/dist/test/widget.test.js.map +1 -0
- package/dist/web/bridges/apps-sdk/adaptor.d.ts +22 -0
- package/dist/web/bridges/apps-sdk/adaptor.js +75 -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/web/bridges/apps-sdk/bridge.js +46 -0
- 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 +121 -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/web/bridges/apps-sdk/use-apps-sdk-context.js +7 -0
- 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 +36 -0
- package/dist/web/bridges/mcp-app/adaptor.js +190 -0
- package/dist/web/bridges/mcp-app/adaptor.js.map +1 -0
- package/dist/web/bridges/mcp-app/bridge.d.ts +43 -0
- package/dist/web/bridges/mcp-app/bridge.js +260 -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 +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 +5 -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 +66 -0
- package/dist/web/bridges/mcp-app/use-mcp-app-context.test.js.map +1 -0
- package/dist/web/bridges/types.d.ts +102 -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 +47 -0
- package/dist/web/components/modal-provider.js.map +1 -0
- package/dist/web/create-store.d.ts +3 -0
- package/dist/web/create-store.js +24 -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/web/data-llm.d.ts +14 -0
- package/dist/{src/web/llm-describe.js → web/data-llm.js} +25 -15
- package/dist/web/data-llm.js.map +1 -0
- package/dist/web/data-llm.test.js +141 -0
- package/dist/web/data-llm.test.js.map +1 -0
- package/dist/web/generate-helpers.d.ts +116 -0
- package/dist/web/generate-helpers.js +111 -0
- package/dist/web/generate-helpers.js.map +1 -0
- package/dist/web/generate-helpers.test-d.js +209 -0
- package/dist/web/generate-helpers.test-d.js.map +1 -0
- package/dist/web/generate-helpers.test.js +17 -0
- package/dist/web/generate-helpers.test.js.map +1 -0
- package/dist/web/helpers/state.d.ts +7 -0
- package/dist/web/helpers/state.js +45 -0
- package/dist/web/helpers/state.js.map +1 -0
- package/dist/web/helpers/state.test.js +53 -0
- package/dist/web/helpers/state.test.js.map +1 -0
- package/dist/web/hooks/index.d.ts +11 -0
- package/dist/web/hooks/index.js +12 -0
- 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 +60 -0
- package/dist/web/hooks/test/utils.js.map +1 -0
- package/dist/web/hooks/use-call-tool.d.ts +101 -0
- package/dist/{src/web → web}/hooks/use-call-tool.js +19 -19
- package/dist/web/hooks/use-call-tool.js.map +1 -0
- package/dist/web/hooks/use-call-tool.test-d.d.ts +1 -0
- package/dist/web/hooks/use-call-tool.test-d.js +104 -0
- package/dist/web/hooks/use-call-tool.test-d.js.map +1 -0
- package/dist/web/hooks/use-call-tool.test.d.ts +1 -0
- package/dist/{src/web → web}/hooks/use-call-tool.test.js +40 -13
- 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.d.ts +1 -0
- package/dist/web/hooks/use-display-mode.test-d.js +8 -0
- package/dist/web/hooks/use-display-mode.test-d.js.map +1 -0
- package/dist/web/hooks/use-display-mode.test.d.ts +1 -0
- package/dist/{src/web → web}/hooks/use-display-mode.test.js +3 -2
- package/dist/web/hooks/use-display-mode.test.js.map +1 -0
- package/dist/web/hooks/use-files.d.ts +6 -0
- package/dist/web/hooks/use-files.js +9 -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 +34 -0
- package/dist/web/hooks/use-files.test.js.map +1 -0
- package/dist/web/hooks/use-layout.d.ts +22 -0
- package/dist/web/hooks/use-layout.js +23 -0
- 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 +60 -0
- package/dist/web/hooks/use-open-external.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/web/hooks/use-request-modal.test.js +57 -0
- package/dist/web/hooks/use-request-modal.test.js.map +1 -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/web/hooks/use-tool-info.d.ts +36 -0
- 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 -5
- package/dist/web/hooks/use-tool-info.test-d.js.map +1 -0
- package/dist/web/hooks/use-tool-info.test.d.ts +1 -0
- package/dist/web/hooks/use-tool-info.test.js +130 -0
- package/dist/web/hooks/use-tool-info.test.js.map +1 -0
- package/dist/web/hooks/use-user.d.ts +18 -0
- package/dist/web/hooks/use-user.js +19 -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 +94 -0
- package/dist/web/hooks/use-user.test.js.map +1 -0
- package/dist/web/hooks/use-widget-state.js +32 -0
- package/dist/web/hooks/use-widget-state.js.map +1 -0
- package/dist/web/hooks/use-widget-state.test.d.ts +1 -0
- package/dist/{src/web → web}/hooks/use-widget-state.test.js +12 -8
- package/dist/web/hooks/use-widget-state.test.js.map +1 -0
- package/dist/web/index.d.ts +8 -0
- package/dist/web/index.js +9 -0
- package/dist/web/index.js.map +1 -0
- package/dist/web/mount-widget.js +27 -0
- package/dist/web/mount-widget.js.map +1 -0
- package/dist/web/plugin/data-llm.test.d.ts +1 -0
- package/dist/web/plugin/data-llm.test.js +81 -0
- package/dist/web/plugin/data-llm.test.js.map +1 -0
- package/dist/web/plugin/plugin.js +54 -0
- package/dist/web/plugin/plugin.js.map +1 -0
- package/dist/{src/web/plugin/data-llm.js → web/plugin/transform-data-llm.js} +28 -28
- 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 +81 -0
- package/dist/web/plugin/transform-data-llm.test.js.map +1 -0
- package/dist/web/plugin/validate-widget.d.ts +5 -0
- package/dist/web/plugin/validate-widget.js +27 -0
- package/dist/web/plugin/validate-widget.js.map +1 -0
- package/dist/web/plugin/validate-widget.test.d.ts +1 -0
- package/dist/web/plugin/validate-widget.test.js +42 -0
- package/dist/web/plugin/validate-widget.test.js.map +1 -0
- package/dist/web/proxy.d.ts +1 -0
- package/dist/web/proxy.js +52 -0
- 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 +68 -35
- package/tsconfig.base.json +28 -0
- package/dist/src/server/index.d.ts +0 -2
- package/dist/src/server/index.js.map +0 -1
- package/dist/src/server/server.d.ts +0 -13
- package/dist/src/server/server.js +0 -57
- package/dist/src/server/server.js.map +0 -1
- package/dist/src/server/templateHelper.js.map +0 -1
- package/dist/src/server/templates/development.hbs +0 -12
- package/dist/src/server/widgetsDevServer.js +0 -39
- package/dist/src/server/widgetsDevServer.js.map +0 -1
- package/dist/src/test/utils.d.ts +0 -28
- package/dist/src/test/utils.js +0 -43
- package/dist/src/test/utils.js.map +0 -1
- package/dist/src/test/widget.test.js +0 -90
- package/dist/src/test/widget.test.js.map +0 -1
- package/dist/src/web/hooks/index.d.ts +0 -13
- package/dist/src/web/hooks/index.js +0 -14
- package/dist/src/web/hooks/index.js.map +0 -1
- package/dist/src/web/hooks/use-call-tool.d.ts +0 -62
- package/dist/src/web/hooks/use-call-tool.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 -7
- 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-locale.d.ts +0 -1
- package/dist/src/web/hooks/use-locale.js +0 -5
- package/dist/src/web/hooks/use-locale.js.map +0 -1
- package/dist/src/web/hooks/use-locale.test.js +0 -21
- package/dist/src/web/hooks/use-locale.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 -2
- package/dist/src/web/hooks/use-openai-global.js +0 -23
- package/dist/src/web/hooks/use-openai-global.js.map +0 -1
- package/dist/src/web/hooks/use-request-modal.d.ts +0 -5
- package/dist/src/web/hooks/use-request-modal.js +0 -9
- package/dist/src/web/hooks/use-request-modal.js.map +0 -1
- package/dist/src/web/hooks/use-request-modal.test.js +0 -24
- package/dist/src/web/hooks/use-request-modal.test.js.map +0 -1
- package/dist/src/web/hooks/use-send-follow-up-message.js +0 -11
- package/dist/src/web/hooks/use-send-follow-up-message.js.map +0 -1
- package/dist/src/web/hooks/use-theme.d.ts +0 -1
- package/dist/src/web/hooks/use-theme.js +0 -5
- package/dist/src/web/hooks/use-theme.js.map +0 -1
- package/dist/src/web/hooks/use-theme.test.js +0 -26
- package/dist/src/web/hooks/use-theme.test.js.map +0 -1
- package/dist/src/web/hooks/use-tool-info.d.ts +0 -25
- package/dist/src/web/hooks/use-tool-info.js +0 -22
- package/dist/src/web/hooks/use-tool-info.js.map +0 -1
- package/dist/src/web/hooks/use-tool-info.test-d.js.map +0 -1
- package/dist/src/web/hooks/use-tool-info.test.js +0 -59
- package/dist/src/web/hooks/use-tool-info.test.js.map +0 -1
- package/dist/src/web/hooks/use-tool-output.d.ts +0 -4
- package/dist/src/web/hooks/use-tool-output.js +0 -9
- package/dist/src/web/hooks/use-tool-output.js.map +0 -1
- package/dist/src/web/hooks/use-tool-response-metadata.d.ts +0 -4
- package/dist/src/web/hooks/use-tool-response-metadata.js +0 -8
- package/dist/src/web/hooks/use-tool-response-metadata.js.map +0 -1
- package/dist/src/web/hooks/use-user-agent.d.ts +0 -1
- package/dist/src/web/hooks/use-user-agent.js +0 -5
- package/dist/src/web/hooks/use-user-agent.js.map +0 -1
- package/dist/src/web/hooks/use-user-agent.test.js +0 -31
- package/dist/src/web/hooks/use-user-agent.test.js.map +0 -1
- package/dist/src/web/hooks/use-widget-state.js +0 -54
- package/dist/src/web/hooks/use-widget-state.js.map +0 -1
- package/dist/src/web/hooks/use-widget-state.test.js.map +0 -1
- package/dist/src/web/index.d.ts +0 -5
- package/dist/src/web/index.js +0 -6
- package/dist/src/web/index.js.map +0 -1
- package/dist/src/web/llm-describe.d.ts +0 -13
- package/dist/src/web/llm-describe.js.map +0 -1
- package/dist/src/web/mount-widget.js +0 -14
- package/dist/src/web/mount-widget.js.map +0 -1
- package/dist/src/web/plugin/data-llm.js.map +0 -1
- package/dist/src/web/plugin/plugin.js +0 -33
- package/dist/src/web/plugin/plugin.js.map +0 -1
- package/dist/src/web/types.d.ts +0 -117
- 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 → server/asset-base-url-transform-plugin.test.d.ts} +0 -0
- /package/dist/{src/web/hooks/use-call-tool.test.d.ts → server/express.test.d.ts} +0 -0
- /package/dist/{src/server → server}/index.js +0 -0
- /package/dist/{src/web/hooks/use-display-mode.test.d.ts → server/middleware.test-d.d.ts} +0 -0
- /package/dist/{src/web/hooks/use-locale.test.d.ts → server/middleware.test.d.ts} +0 -0
- /package/dist/{src/web/hooks/use-open-external.test.d.ts → test/widget.test.d.ts} +0 -0
- /package/dist/{src/web/hooks/use-request-modal.test.d.ts → web/bridges/mcp-app/use-mcp-app-context.test.d.ts} +0 -0
- /package/dist/{src/web/hooks/use-theme.test.d.ts → web/create-store.test.d.ts} +0 -0
- /package/dist/{src/web/hooks/use-tool-info.test-d.d.ts → web/data-llm.test.d.ts} +0 -0
- /package/dist/{src/web/hooks/use-tool-info.test.d.ts → web/generate-helpers.test-d.d.ts} +0 -0
- /package/dist/{src/web/hooks/use-user-agent.test.d.ts → web/generate-helpers.test.d.ts} +0 -0
- /package/dist/{src/web/hooks/use-widget-state.test.d.ts → web/helpers/state.test.d.ts} +0 -0
- /package/dist/{src/web → web}/hooks/use-send-follow-up-message.d.ts +0 -0
- /package/dist/{src/web → web}/hooks/use-widget-state.d.ts +0 -0
- /package/dist/{src/web → web}/mount-widget.d.ts +0 -0
- /package/dist/{src/web → web}/plugin/plugin.d.ts +0 -0
- /package/dist/{src/web/plugin/data-llm.d.ts → web/plugin/transform-data-llm.d.ts} +0 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
function hasExportDefault(code) {
|
|
2
|
+
return (/export\s+default\s/.test(code) ||
|
|
3
|
+
/export\s*\{[^}]*\bas\s+default\b[^}]*}/.test(code));
|
|
4
|
+
}
|
|
5
|
+
function hasMountWidgetCall(code) {
|
|
6
|
+
return /mountWidget\s*\(/.test(code);
|
|
7
|
+
}
|
|
8
|
+
function stripComments(code) {
|
|
9
|
+
return code.replace(/\/\/.*$/gm, "").replace(/\/\*[\s\S]*?\*\//g, "");
|
|
10
|
+
}
|
|
11
|
+
export function validateWidget(code, filePath) {
|
|
12
|
+
code = stripComments(code);
|
|
13
|
+
const warnings = [];
|
|
14
|
+
const fileName = filePath.split("/").pop() ?? filePath;
|
|
15
|
+
if (!hasExportDefault(code)) {
|
|
16
|
+
warnings.push({
|
|
17
|
+
message: `Widget file "${fileName}" is missing a default export. Add "export default <ComponentName>" to ensure the widget is properly registered.`,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
if (!hasMountWidgetCall(code)) {
|
|
21
|
+
warnings.push({
|
|
22
|
+
message: `Widget file "${fileName}" is missing a mountWidget() call. Add "mountWidget(<Component />)" to mount the component to the DOM.`,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
return warnings;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=validate-widget.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-widget.js","sourceRoot":"","sources":["../../../src/web/plugin/validate-widget.ts"],"names":[],"mappings":"AAIA,SAAS,gBAAgB,CAAC,IAAY;IACpC,OAAO,CACL,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC;QAC/B,wCAAwC,CAAC,IAAI,CAAC,IAAI,CAAC,CACpD,CAAC;AACJ,CAAC;AAED,SAAS,kBAAkB,CAAC,IAAY;IACtC,OAAO,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACvC,CAAC;AAED,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,cAAc,CAAC,IAAY,EAAE,QAAgB;IAC3D,IAAI,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;IAC3B,MAAM,QAAQ,GAAc,EAAE,CAAC;IAC/B,MAAM,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,QAAQ,CAAC;IAEvD,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;QAC5B,QAAQ,CAAC,IAAI,CAAC;YACZ,OAAO,EAAE,gBAAgB,QAAQ,kHAAkH;SACpJ,CAAC,CAAC;IACL,CAAC;IAED,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC;QAC9B,QAAQ,CAAC,IAAI,CAAC;YACZ,OAAO,EAAE,gBAAgB,QAAQ,wGAAwG;SAC1I,CAAC,CAAC;IACL,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { validateWidget } from "./validate-widget.js";
|
|
3
|
+
describe("validateWidget", () => {
|
|
4
|
+
it("returns no warnings for a valid widget", () => {
|
|
5
|
+
expect(validateWidget("export default MyWidget;\nmountWidget(<MyWidget />);", "src/widgets/my-widget.tsx")).toEqual([]);
|
|
6
|
+
});
|
|
7
|
+
it("accepts all default export syntaxes", () => {
|
|
8
|
+
for (const exportLine of [
|
|
9
|
+
"export default MyWidget;",
|
|
10
|
+
"export default function MyWidget() {}",
|
|
11
|
+
"export { Foo as default };",
|
|
12
|
+
]) {
|
|
13
|
+
expect(validateWidget(`${exportLine}\nmountWidget(<MyWidget />);`, "src/widgets/my-widget.tsx")).toEqual([]);
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
it("warns when export default is missing", () => {
|
|
17
|
+
const warnings = validateWidget("mountWidget(<MyWidget />);", "src/widgets/my-widget.tsx");
|
|
18
|
+
expect(warnings).toHaveLength(1);
|
|
19
|
+
expect(warnings[0]?.message).toContain("missing a default export");
|
|
20
|
+
expect(warnings[0]?.message).toContain("my-widget.tsx");
|
|
21
|
+
});
|
|
22
|
+
it("warns when mountWidget() call is missing", () => {
|
|
23
|
+
const warnings = validateWidget("export default MyWidget;", "src/widgets/my-widget.tsx");
|
|
24
|
+
expect(warnings).toHaveLength(1);
|
|
25
|
+
expect(warnings[0]?.message).toContain("missing a mountWidget() call");
|
|
26
|
+
expect(warnings[0]?.message).toContain("my-widget.tsx");
|
|
27
|
+
});
|
|
28
|
+
it("ignores commented-out code", () => {
|
|
29
|
+
const code = `
|
|
30
|
+
// export default MyWidget;
|
|
31
|
+
// mountWidget(<MyWidget />);
|
|
32
|
+
/* export default MyWidget; */
|
|
33
|
+
/* mountWidget(<MyWidget />); */
|
|
34
|
+
`;
|
|
35
|
+
expect(validateWidget(code, "src/widgets/my-widget.tsx")).toHaveLength(2);
|
|
36
|
+
});
|
|
37
|
+
it("uses filename from path for directory widgets", () => {
|
|
38
|
+
const warnings = validateWidget("", "src/widgets/foo/index.tsx");
|
|
39
|
+
expect(warnings[0]?.message).toContain("index.tsx");
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=validate-widget.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-widget.test.js","sourceRoot":"","sources":["../../../src/web/plugin/validate-widget.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,EAAE,CAAC,wCAAwC,EAAE,GAAG,EAAE;QAChD,MAAM,CACJ,cAAc,CACZ,sDAAsD,EACtD,2BAA2B,CAC5B,CACF,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAChB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,qCAAqC,EAAE,GAAG,EAAE;QAC7C,KAAK,MAAM,UAAU,IAAI;YACvB,0BAA0B;YAC1B,uCAAuC;YACvC,4BAA4B;SAC7B,EAAE,CAAC;YACF,MAAM,CACJ,cAAc,CACZ,GAAG,UAAU,8BAA8B,EAC3C,2BAA2B,CAC5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,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACtD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function installOpenAILoggingProxy(): void;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
const colors = {
|
|
2
|
+
brand: "#6366f1",
|
|
3
|
+
info: "#22223b",
|
|
4
|
+
success: "#22c55e",
|
|
5
|
+
error: "#ef4444",
|
|
6
|
+
};
|
|
7
|
+
export function installOpenAILoggingProxy() {
|
|
8
|
+
if (typeof window === "undefined" || !window.openai) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
const descriptor = Object.getOwnPropertyDescriptor(window, "openai");
|
|
12
|
+
if (descriptor?.configurable === false || descriptor?.writable === false) {
|
|
13
|
+
console.warn("[openai-proxy] window.openai is not configurable or writable, skipping proxy installation");
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
const originalOpenAI = window.openai;
|
|
17
|
+
const handler = {
|
|
18
|
+
get(target, prop, receiver) {
|
|
19
|
+
const value = Reflect.get(target, prop, receiver);
|
|
20
|
+
if (typeof value !== "function") {
|
|
21
|
+
return value;
|
|
22
|
+
}
|
|
23
|
+
return (...args) => {
|
|
24
|
+
const methodName = String(prop);
|
|
25
|
+
console.group(`%c[openai] %cmethod %c${methodName}`, `color: ${colors.brand}; font-weight: normal`, `color: ${colors.info}; font-weight: normal`, `color: ${colors.success}`);
|
|
26
|
+
console.log("%c← args:", `color: ${colors.info}`, args);
|
|
27
|
+
const result = value.apply(target, args);
|
|
28
|
+
if (result && typeof result.then === "function") {
|
|
29
|
+
return result.then((resolved) => {
|
|
30
|
+
console.log("%c→ resolved:", `color: ${colors.success}`, resolved);
|
|
31
|
+
console.groupEnd();
|
|
32
|
+
return resolved;
|
|
33
|
+
}, (error) => {
|
|
34
|
+
console.error("%c→ rejected:", `color: ${colors.error}`, error);
|
|
35
|
+
console.groupEnd();
|
|
36
|
+
throw error;
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
console.log("%c→ returned:", `color: ${colors.success}`, result);
|
|
40
|
+
console.groupEnd();
|
|
41
|
+
return result;
|
|
42
|
+
};
|
|
43
|
+
},
|
|
44
|
+
set(target, prop, value, receiver) {
|
|
45
|
+
console.log(`%c[openai] %cupdate %c${String(prop)}`, `color: ${colors.brand}`, `color: ${colors.info}`, `color: ${colors.success}; font-weight: bold`, "←", value);
|
|
46
|
+
return Reflect.set(target, prop, value, receiver);
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
window.openai = new Proxy(originalOpenAI, handler);
|
|
50
|
+
console.log("%c[openai-proxy] %cInstalled logging proxy for window.openai", `color: ${colors.brand}`, `color: ${colors.info}`);
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=proxy.js.map
|
|
@@ -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,G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,CAAC,GAAG,CAAC,eAAe,EAAE,UAAU,MAAM,CAAC,OAAO,EAAE,EAAE,MAAM,CAAC,CAAC;gBACjE,OAAO,CAAC,QAAQ,EAAE,CAAC;gBAEnB,OAAO,MAAM,CAAC;YAChB,CAAC,CAAC;QACJ,CAAC;QAED,GAAG,CAAC,MAAM,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"}
|
|
@@ -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"}
|
package/package.json
CHANGED
|
@@ -1,31 +1,29 @@
|
|
|
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.bd8fdfd",
|
|
4
|
+
"description": "Skybridge is a framework for building ChatGPT and MCP Apps",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/alpic-ai/skybridge.git"
|
|
8
|
+
},
|
|
5
9
|
"type": "module",
|
|
6
10
|
"files": [
|
|
7
|
-
"dist"
|
|
11
|
+
"dist",
|
|
12
|
+
"README.md",
|
|
13
|
+
"tsconfig.base.json"
|
|
8
14
|
],
|
|
9
15
|
"exports": {
|
|
16
|
+
"./tsconfig": "./tsconfig.base.json",
|
|
17
|
+
"./tsconfig.json": "./tsconfig.base.json",
|
|
10
18
|
"./server": {
|
|
11
|
-
"types": "./dist/
|
|
12
|
-
"default": "./dist/
|
|
19
|
+
"types": "./dist/server/index.d.ts",
|
|
20
|
+
"default": "./dist/server/index.js"
|
|
13
21
|
},
|
|
14
22
|
"./web": {
|
|
15
|
-
"types": "./dist/
|
|
16
|
-
"default": "./dist/
|
|
23
|
+
"types": "./dist/web/index.d.ts",
|
|
24
|
+
"default": "./dist/web/index.js"
|
|
17
25
|
}
|
|
18
26
|
},
|
|
19
|
-
"scripts": {
|
|
20
|
-
"build": "tsc && pnpm run build:templates",
|
|
21
|
-
"build:templates": "cp -r src/server/templates dist/src/server/",
|
|
22
|
-
"test": "pnpm run test:unit && pnpm run test:type",
|
|
23
|
-
"test:unit": "vitest run --silent",
|
|
24
|
-
"test:type": "tsc --noEmit",
|
|
25
|
-
"docs:dev": "pnpm --filter @skybridge/docs start",
|
|
26
|
-
"docs:build": "pnpm --filter @skybridge/docs build",
|
|
27
|
-
"docs:serve": "pnpm --filter @skybridge/docs serve"
|
|
28
|
-
},
|
|
29
27
|
"keywords": [
|
|
30
28
|
"chatgpt",
|
|
31
29
|
"app",
|
|
@@ -35,33 +33,68 @@
|
|
|
35
33
|
"author": "Frédéric Barthelet",
|
|
36
34
|
"license": "ISC",
|
|
37
35
|
"peerDependencies": {
|
|
36
|
+
"@modelcontextprotocol/sdk": ">=1.0.0",
|
|
37
|
+
"@skybridge/devtools": ">=0.26.1",
|
|
38
|
+
"nodemon": ">=3.0.0",
|
|
38
39
|
"react": ">=18.0.0",
|
|
39
|
-
"react-dom": ">=18.0.0"
|
|
40
|
+
"react-dom": ">=18.0.0",
|
|
41
|
+
"vite": "^7.3.1"
|
|
40
42
|
},
|
|
41
43
|
"dependencies": {
|
|
42
|
-
"@babel/core": "^7.
|
|
43
|
-
"@
|
|
44
|
-
"
|
|
45
|
-
"
|
|
44
|
+
"@babel/core": "^7.29.0",
|
|
45
|
+
"@oclif/core": "^4.8.4",
|
|
46
|
+
"ci-info": "^4.4.0",
|
|
47
|
+
"cors": "^2.8.6",
|
|
48
|
+
"dequal": "^2.0.3",
|
|
49
|
+
"es-toolkit": "^1.45.1",
|
|
50
|
+
"express": "^5.2.1",
|
|
46
51
|
"handlebars": "^4.7.8",
|
|
47
|
-
"
|
|
48
|
-
"
|
|
52
|
+
"ink": "^6.8.0",
|
|
53
|
+
"posthog-node": "^5.28.0",
|
|
54
|
+
"superjson": "^2.2.6",
|
|
55
|
+
"zustand": "^5.0.11"
|
|
49
56
|
},
|
|
50
57
|
"devDependencies": {
|
|
58
|
+
"@modelcontextprotocol/ext-apps": "^1.2.0",
|
|
59
|
+
"@modelcontextprotocol/sdk": "^1.27.1",
|
|
51
60
|
"@testing-library/dom": "^10.4.1",
|
|
52
|
-
"@testing-library/react": "^16.3.
|
|
61
|
+
"@testing-library/react": "^16.3.2",
|
|
53
62
|
"@total-typescript/tsconfig": "^1.0.4",
|
|
54
63
|
"@types/babel__core": "^7.20.5",
|
|
55
64
|
"@types/cors": "^2.8.19",
|
|
56
|
-
"@types/express": "^5.0.
|
|
57
|
-
"@types/jsdom": "^
|
|
58
|
-
"@types/node": "^
|
|
59
|
-
"@types/react": "^19.2.
|
|
60
|
-
"@types/react-dom": "^19.2.
|
|
61
|
-
"@vitest/ui": "^
|
|
62
|
-
"jsdom": "^
|
|
65
|
+
"@types/express": "^5.0.6",
|
|
66
|
+
"@types/jsdom": "^28.0.0",
|
|
67
|
+
"@types/node": "^24.12.0",
|
|
68
|
+
"@types/react": "^19.2.14",
|
|
69
|
+
"@types/react-dom": "^19.2.3",
|
|
70
|
+
"@vitest/ui": "^4.0.18",
|
|
71
|
+
"jsdom": "^29.0.0",
|
|
72
|
+
"shx": "^0.4.0",
|
|
73
|
+
"ts-node": "^10.9.2",
|
|
63
74
|
"typescript": "^5.9.3",
|
|
64
|
-
"vitest": "^
|
|
75
|
+
"vitest": "^4.0.18",
|
|
76
|
+
"zod": "^4.3.6"
|
|
77
|
+
},
|
|
78
|
+
"bin": {
|
|
79
|
+
"sb": "./bin/run.js",
|
|
80
|
+
"skybridge": "./bin/run.js"
|
|
65
81
|
},
|
|
66
|
-
"
|
|
67
|
-
|
|
82
|
+
"oclif": {
|
|
83
|
+
"bin": "skybridge",
|
|
84
|
+
"commands": "./dist/commands",
|
|
85
|
+
"dirname": "skybridge",
|
|
86
|
+
"topicSeparator": " ",
|
|
87
|
+
"hooks": {
|
|
88
|
+
"finally": "./dist/cli/telemetry"
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
"scripts": {
|
|
92
|
+
"build": "shx rm -rf dist && tsc && pnpm run build:templates",
|
|
93
|
+
"build:templates": "cp -r src/server/templates dist/server/",
|
|
94
|
+
"format": "biome check --write --error-on-warnings",
|
|
95
|
+
"test": "pnpm run test:unit && pnpm run test:type && pnpm run test:format",
|
|
96
|
+
"test:unit": "vitest run",
|
|
97
|
+
"test:type": "tsc --noEmit",
|
|
98
|
+
"test:format": "biome ci"
|
|
99
|
+
}
|
|
100
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
// Module resolution options
|
|
4
|
+
"module": "NodeNext",
|
|
5
|
+
"esModuleInterop": true,
|
|
6
|
+
"verbatimModuleSyntax": true,
|
|
7
|
+
|
|
8
|
+
// Output options
|
|
9
|
+
"noEmit": false,
|
|
10
|
+
"incremental": true,
|
|
11
|
+
"sourceMap": true,
|
|
12
|
+
|
|
13
|
+
// Language and environment options
|
|
14
|
+
"target": "ES2022",
|
|
15
|
+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
16
|
+
"jsx": "react-jsx",
|
|
17
|
+
|
|
18
|
+
// Strictness and checking options
|
|
19
|
+
"strict": true,
|
|
20
|
+
"skipLibCheck": true,
|
|
21
|
+
"forceConsistentCasingInFileNames": true,
|
|
22
|
+
|
|
23
|
+
// Code quality & diagnostics
|
|
24
|
+
"noUnusedLocals": true,
|
|
25
|
+
"noUnusedParameters": true,
|
|
26
|
+
"noFallthroughCasesInSwitch": true
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { McpServer as McpServerBase, type ToolCallback } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
-
import type { Resource } from "@modelcontextprotocol/sdk/types.js";
|
|
3
|
-
import type { ZodRawShape } from "zod";
|
|
4
|
-
type McpServerOriginalResourceConfig = Omit<Resource, "uri" | "name" | "mimeType">;
|
|
5
|
-
type McpServerOriginalToolConfig = Omit<Parameters<McpServer["registerTool"]>[1], "inputSchema" | "outputSchema">;
|
|
6
|
-
export declare class McpServer extends McpServerBase {
|
|
7
|
-
widget<InputArgs extends ZodRawShape, OutputArgs extends ZodRawShape>(name: string, resourceConfig: McpServerOriginalResourceConfig, toolConfig: McpServerOriginalToolConfig & {
|
|
8
|
-
inputSchema?: InputArgs;
|
|
9
|
-
outputSchema?: OutputArgs;
|
|
10
|
-
}, toolCallback: ToolCallback<InputArgs>): void;
|
|
11
|
-
private lookupDistFile;
|
|
12
|
-
}
|
|
13
|
-
export {};
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { McpServer as McpServerBase, } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
-
import { templateHelper } from "./templateHelper.js";
|
|
3
|
-
import { readFileSync } from "node:fs";
|
|
4
|
-
import path from "node:path";
|
|
5
|
-
export class McpServer extends McpServerBase {
|
|
6
|
-
widget(name, resourceConfig, toolConfig, toolCallback) {
|
|
7
|
-
const uri = `ui://widgets/${name}.html`;
|
|
8
|
-
const resourceMetadata = {
|
|
9
|
-
...(resourceConfig._meta ?? {}),
|
|
10
|
-
};
|
|
11
|
-
if (toolConfig.description !== undefined) {
|
|
12
|
-
resourceMetadata["openai/widgetDescription"] = toolConfig.description;
|
|
13
|
-
}
|
|
14
|
-
this.resource(name, uri, {
|
|
15
|
-
...resourceConfig,
|
|
16
|
-
_meta: resourceMetadata,
|
|
17
|
-
}, async (_uri, extra) => {
|
|
18
|
-
const serverUrl = process.env.NODE_ENV === "production"
|
|
19
|
-
? `https://${extra?.requestInfo?.headers?.["x-forwarded-host"] ??
|
|
20
|
-
extra?.requestInfo?.headers?.host}`
|
|
21
|
-
: `http://localhost:3000`;
|
|
22
|
-
const html = process.env.NODE_ENV === "production"
|
|
23
|
-
? templateHelper.renderProduction({
|
|
24
|
-
serverUrl,
|
|
25
|
-
widgetFile: this.lookupDistFile(`src/widgets/${name}.tsx`),
|
|
26
|
-
styleFile: this.lookupDistFile("style.css"),
|
|
27
|
-
})
|
|
28
|
-
: templateHelper.renderDevelopment({
|
|
29
|
-
serverUrl,
|
|
30
|
-
widgetName: name,
|
|
31
|
-
});
|
|
32
|
-
return {
|
|
33
|
-
contents: [
|
|
34
|
-
{
|
|
35
|
-
uri,
|
|
36
|
-
mimeType: "text/html+skybridge",
|
|
37
|
-
text: html,
|
|
38
|
-
},
|
|
39
|
-
],
|
|
40
|
-
};
|
|
41
|
-
});
|
|
42
|
-
const toolMeta = {
|
|
43
|
-
...toolConfig._meta,
|
|
44
|
-
"openai/outputTemplate": uri,
|
|
45
|
-
"ui/resourceUri": uri,
|
|
46
|
-
};
|
|
47
|
-
this.registerTool(name, {
|
|
48
|
-
...toolConfig,
|
|
49
|
-
_meta: toolMeta,
|
|
50
|
-
}, toolCallback);
|
|
51
|
-
}
|
|
52
|
-
lookupDistFile(key) {
|
|
53
|
-
const manifest = JSON.parse(readFileSync(path.join(process.cwd(), "dist", "assets", ".vite", "manifest.json"), "utf-8"));
|
|
54
|
-
return manifest[key]?.file;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
//# sourceMappingURL=server.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../../src/server/server.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,IAAI,aAAa,GAE3B,MAAM,yCAAyC,CAAC;AAGjD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,IAAI,MAAM,WAAW,CAAC;AA+C7B,MAAM,OAAO,SAAU,SAAQ,aAAa;IAC1C,MAAM,CACJ,IAAY,EACZ,cAA+C,EAC/C,UAGC,EACD,YAAqC;QAErC,MAAM,GAAG,GAAG,gBAAgB,IAAI,OAAO,CAAC;QACxC,MAAM,gBAAgB,GAAiB;YACrC,GAAG,CAAC,cAAc,CAAC,KAAK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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,IAIhB;QACC,MAAM,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;QACjD,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC;IAED,iBAAiB,CAAC,IAA+C;QAC/D,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,12 +0,0 @@
|
|
|
1
|
-
<base href="{{serverUrl}}" />
|
|
2
|
-
<script type="module">
|
|
3
|
-
import { injectIntoGlobalHook } from "{{serverUrl}}/@react-refresh";
|
|
4
|
-
injectIntoGlobalHook(window); window.$RefreshReg$ = () => {};
|
|
5
|
-
window.$RefreshSig$ = () => (type) => type;
|
|
6
|
-
window.__vite_plugin_react_preamble_installed__ = true;
|
|
7
|
-
</script>
|
|
8
|
-
<script type="module" src="{{serverUrl}}/@vite/client"></script>
|
|
9
|
-
<div id="root"></div>
|
|
10
|
-
<script type="module">
|
|
11
|
-
import('{{serverUrl}}/src/widgets/{{widgetName}}.tsx');
|
|
12
|
-
</script>
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import express, {} from "express";
|
|
2
|
-
import cors from "cors";
|
|
3
|
-
import path from "node:path";
|
|
4
|
-
/**
|
|
5
|
-
* Install Vite dev server
|
|
6
|
-
* This router MUST be installed at the application root, like so:
|
|
7
|
-
*
|
|
8
|
-
* const app = express();
|
|
9
|
-
*
|
|
10
|
-
* if (env.NODE_ENV !== "production") {
|
|
11
|
-
* app.use(await widgetsRouter());
|
|
12
|
-
* }
|
|
13
|
-
*/
|
|
14
|
-
export const widgetsDevServer = async () => {
|
|
15
|
-
const router = express.Router();
|
|
16
|
-
const { createServer, searchForWorkspaceRoot, loadConfigFromFile } = await import("vite");
|
|
17
|
-
const workspaceRoot = searchForWorkspaceRoot(process.cwd());
|
|
18
|
-
const webAppRoot = path.join(workspaceRoot, "web");
|
|
19
|
-
const configResult = await loadConfigFromFile({ command: "serve", mode: "development" }, path.join(webAppRoot, "vite.config.ts"), webAppRoot);
|
|
20
|
-
// Remove build-specific options that don't apply to dev server
|
|
21
|
-
const { build, preview, ...devConfig } = configResult?.config || {};
|
|
22
|
-
const vite = await createServer({
|
|
23
|
-
...devConfig,
|
|
24
|
-
configFile: false, // Keep this to prevent vite from trying to resolve path in the target config file
|
|
25
|
-
appType: "custom",
|
|
26
|
-
server: {
|
|
27
|
-
allowedHosts: true,
|
|
28
|
-
middlewareMode: true,
|
|
29
|
-
},
|
|
30
|
-
root: webAppRoot,
|
|
31
|
-
optimizeDeps: {
|
|
32
|
-
include: ["react", "react-dom/client"],
|
|
33
|
-
},
|
|
34
|
-
});
|
|
35
|
-
router.use(cors());
|
|
36
|
-
router.use("/", vite.middlewares);
|
|
37
|
-
return router;
|
|
38
|
-
};
|
|
39
|
-
//# sourceMappingURL=widgetsDevServer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"widgetsDevServer.js","sourceRoot":"","sources":["../../../src/server/widgetsDevServer.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,EAAE,EAAuB,MAAM,SAAS,CAAC;AACvD,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,IAA6B,EAAE;IAClE,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAEhC,MAAM,EAAE,YAAY,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,GAChE,MAAM,MAAM,CAAC,MAAM,CAAC,CAAC;IACvB,MAAM,aAAa,GAAG,sBAAsB,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAC5D,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;IAEnD,MAAM,YAAY,GAAG,MAAM,kBAAkB,CAC3C,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,EACzC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,gBAAgB,CAAC,EACvC,UAAU,CACX,CAAC;IAEF,+DAA+D;IAC/D,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,SAAS,EAAE,GAAG,YAAY,EAAE,MAAM,IAAI,EAAE,CAAC;IAEpE,MAAM,IAAI,GAAG,MAAM,YAAY,CAAC;QAC9B,GAAG,SAAS;QACZ,UAAU,EAAE,KAAK,EAAE,kFAAkF;QACrG,OAAO,EAAE,QAAQ;QACjB,MAAM,EAAE;YACN,YAAY,EAAE,IAAI;YAClB,cAAc,EAAE,IAAI;SACrB;QACD,IAAI,EAAE,UAAU;QAChB,YAAY,EAAE;YACZ,OAAO,EAAE,CAAC,OAAO,EAAE,kBAAkB,CAAC;SACvC;KACF,CAAC,CAAC;IAEH,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;IACnB,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IAElC,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
|
package/dist/src/test/utils.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { type MockInstance } from "vitest";
|
|
2
|
-
import { McpServer } from "../server/server.js";
|
|
3
|
-
/**
|
|
4
|
-
* Creates a real McpServer instance for testing
|
|
5
|
-
*/
|
|
6
|
-
export declare function createMockMcpServer(): {
|
|
7
|
-
server: McpServer;
|
|
8
|
-
mockResource: MockInstance<McpServer["resource"]>;
|
|
9
|
-
mockRegisterTool: MockInstance<McpServer["registerTool"]>;
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* Mock extra parameter for resource callback
|
|
13
|
-
*/
|
|
14
|
-
export declare function createMockExtra(host: string): {
|
|
15
|
-
requestInfo: {
|
|
16
|
-
headers: {
|
|
17
|
-
host: string;
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
* Sets up environment variables for testing
|
|
23
|
-
*/
|
|
24
|
-
export declare function setTestEnv(env: Record<string, string>): void;
|
|
25
|
-
/**
|
|
26
|
-
* Resets environment variables
|
|
27
|
-
*/
|
|
28
|
-
export declare function resetTestEnv(): void;
|
package/dist/src/test/utils.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { vi } from "vitest";
|
|
2
|
-
import { McpServer, McpServer as McpServerBase } from "../server/server.js";
|
|
3
|
-
/**
|
|
4
|
-
* Creates a real McpServer instance for testing
|
|
5
|
-
*/
|
|
6
|
-
export function createMockMcpServer() {
|
|
7
|
-
// Create a real McpServer instance
|
|
8
|
-
const server = new McpServer({
|
|
9
|
-
name: "alpic-openai-app",
|
|
10
|
-
version: "0.0.1",
|
|
11
|
-
}, { capabilities: {} });
|
|
12
|
-
// Mock the underlying methods to track calls
|
|
13
|
-
const mockResource = vi.spyOn(server, "resource");
|
|
14
|
-
const mockRegisterTool = vi.spyOn(server, "registerTool");
|
|
15
|
-
return {
|
|
16
|
-
server,
|
|
17
|
-
mockResource,
|
|
18
|
-
mockRegisterTool,
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Mock extra parameter for resource callback
|
|
23
|
-
*/
|
|
24
|
-
export function createMockExtra(host) {
|
|
25
|
-
return {
|
|
26
|
-
requestInfo: {
|
|
27
|
-
headers: { host },
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Sets up environment variables for testing
|
|
33
|
-
*/
|
|
34
|
-
export function setTestEnv(env) {
|
|
35
|
-
Object.assign(process.env, env);
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Resets environment variables
|
|
39
|
-
*/
|
|
40
|
-
export function resetTestEnv() {
|
|
41
|
-
delete process.env.NODE_ENV;
|
|
42
|
-
}
|
|
43
|
-
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/test/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAqB,MAAM,QAAQ,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAE5E;;GAEG;AACH,MAAM,UAAU,mBAAmB;IAKjC,mCAAmC;IACnC,MAAM,MAAM,GAAG,IAAI,SAAS,CAC1B;QACE,IAAI,EAAE,kBAAkB;QACxB,OAAO,EAAE,OAAO;KACjB,EACD,EAAE,YAAY,EAAE,EAAE,EAAE,CACrB,CAAC;IAEF,6CAA6C;IAC7C,MAAM,YAAY,GAAG,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAClD,MAAM,gBAAgB,GAAG,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAE1D,OAAO;QACL,MAAM;QACN,YAAY;QACZ,gBAAgB;KACjB,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,OAAO;QACL,WAAW,EAAE;YACX,OAAO,EAAE,EAAE,IAAI,EAAE;SAClB;KACF,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,GAA2B;IACpD,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAClC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY;IAC1B,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC;AAC9B,CAAC"}
|