skybridge 0.0.0-dev.908f6e0 → 0.0.0-dev.90b5f61
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 +153 -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.js +1 -1
- package/dist/cli/header.js.map +1 -1
- package/dist/cli/run-command.js.map +1 -1
- package/dist/cli/telemetry.d.ts +3 -35
- package/dist/cli/telemetry.js +17 -78
- package/dist/cli/telemetry.js.map +1 -1
- package/dist/cli/tunnel-control-server.d.ts +9 -0
- package/dist/cli/tunnel-control-server.js +31 -0
- package/dist/cli/tunnel-control-server.js.map +1 -0
- package/dist/cli/tunnel-control-server.test.js +39 -0
- package/dist/cli/tunnel-control-server.test.js.map +1 -0
- package/dist/cli/tunnel-handler.d.ts +3 -0
- package/dist/cli/tunnel-handler.js +48 -0
- package/dist/cli/tunnel-handler.js.map +1 -0
- package/dist/cli/tunnel-handler.test.js +105 -0
- package/dist/cli/tunnel-handler.test.js.map +1 -0
- package/dist/cli/tunnel.d.ts +57 -0
- package/dist/cli/tunnel.js +154 -0
- package/dist/cli/tunnel.js.map +1 -0
- package/dist/cli/tunnel.test.d.ts +1 -0
- package/dist/cli/tunnel.test.js +190 -0
- package/dist/cli/tunnel.test.js.map +1 -0
- package/dist/cli/types.d.ts +5 -0
- package/dist/cli/types.js +2 -0
- package/dist/cli/types.js.map +1 -0
- package/dist/cli/use-execute-steps.d.ts +2 -1
- package/dist/cli/use-execute-steps.js +6 -1
- package/dist/cli/use-execute-steps.js.map +1 -1
- package/dist/cli/use-messages.d.ts +3 -0
- package/dist/cli/use-messages.js +11 -0
- package/dist/cli/use-messages.js.map +1 -0
- package/dist/cli/use-nodemon.d.ts +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.js +65 -20
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/dev.d.ts +6 -1
- package/dist/commands/dev.js +69 -9
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/start.d.ts +3 -1
- package/dist/commands/start.js +31 -15
- package/dist/commands/start.js.map +1 -1
- package/dist/commands/telemetry/disable.d.ts +5 -0
- package/dist/commands/telemetry/disable.js +14 -0
- package/dist/commands/telemetry/disable.js.map +1 -0
- package/dist/commands/telemetry/enable.d.ts +5 -0
- package/dist/commands/telemetry/enable.js +14 -0
- package/dist/commands/telemetry/enable.js.map +1 -0
- package/dist/commands/telemetry/status.d.ts +5 -0
- package/dist/commands/telemetry/status.js +14 -0
- package/dist/commands/telemetry/status.js.map +1 -0
- package/dist/server/asset-base-url-transform-plugin.d.ts +10 -0
- package/dist/server/asset-base-url-transform-plugin.js +33 -0
- package/dist/server/asset-base-url-transform-plugin.js.map +1 -0
- package/dist/server/asset-base-url-transform-plugin.test.d.ts +1 -0
- package/dist/server/asset-base-url-transform-plugin.test.js +84 -0
- package/dist/server/asset-base-url-transform-plugin.test.js.map +1 -0
- package/dist/server/content-helpers.d.ts +27 -0
- package/dist/server/content-helpers.js +46 -0
- package/dist/server/content-helpers.js.map +1 -0
- package/dist/server/content-helpers.test.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/index.d.ts +5 -3
- package/dist/server/index.js +3 -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 +124 -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 +160 -63
- package/dist/server/server.js +393 -63
- 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 +523 -0
- package/dist/test/view.test.js.map +1 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +3 -0
- package/dist/version.js.map +1 -0
- package/dist/web/bridges/apps-sdk/adaptor.d.ts +18 -6
- package/dist/web/bridges/apps-sdk/adaptor.js +71 -8
- package/dist/web/bridges/apps-sdk/adaptor.js.map +1 -1
- package/dist/web/bridges/apps-sdk/bridge.d.ts +1 -1
- package/dist/web/bridges/apps-sdk/bridge.js.map +1 -1
- package/dist/web/bridges/apps-sdk/index.d.ts +1 -1
- package/dist/web/bridges/apps-sdk/index.js.map +1 -1
- package/dist/web/bridges/apps-sdk/types.d.ts +38 -26
- package/dist/web/bridges/apps-sdk/types.js.map +1 -1
- package/dist/web/bridges/apps-sdk/use-apps-sdk-context.js.map +1 -1
- package/dist/web/bridges/get-adaptor.js.map +1 -1
- package/dist/web/bridges/index.js.map +1 -1
- package/dist/web/bridges/mcp-app/adaptor.d.ts +39 -8
- package/dist/web/bridges/mcp-app/adaptor.js +180 -54
- package/dist/web/bridges/mcp-app/adaptor.js.map +1 -1
- package/dist/web/bridges/mcp-app/bridge.d.ts +13 -30
- package/dist/web/bridges/mcp-app/bridge.js +43 -196
- package/dist/web/bridges/mcp-app/bridge.js.map +1 -1
- package/dist/web/bridges/mcp-app/index.js.map +1 -1
- package/dist/web/bridges/mcp-app/types.js.map +1 -1
- package/dist/web/bridges/mcp-app/use-mcp-app-context.d.ts +5 -3
- package/dist/web/bridges/mcp-app/use-mcp-app-context.js +2 -2
- package/dist/web/bridges/mcp-app/use-mcp-app-context.js.map +1 -1
- package/dist/web/bridges/mcp-app/use-mcp-app-context.test.js +1 -41
- package/dist/web/bridges/mcp-app/use-mcp-app-context.test.js.map +1 -1
- package/dist/web/bridges/types.d.ts +54 -11
- package/dist/web/bridges/types.js.map +1 -1
- package/dist/web/bridges/use-host-context.js.map +1 -1
- package/dist/web/components/modal-provider.d.ts +4 -0
- package/dist/web/components/modal-provider.js +45 -0
- package/dist/web/components/modal-provider.js.map +1 -0
- package/dist/web/create-store.js +17 -3
- package/dist/web/create-store.js.map +1 -1
- package/dist/web/create-store.test.js +23 -20
- package/dist/web/create-store.test.js.map +1 -1
- package/dist/web/data-llm.d.ts +1 -1
- package/dist/web/data-llm.js +3 -3
- package/dist/web/data-llm.js.map +1 -1
- package/dist/web/data-llm.test.js +33 -30
- package/dist/web/data-llm.test.js.map +1 -1
- package/dist/web/generate-helpers.d.ts +20 -18
- package/dist/web/generate-helpers.js +20 -18
- package/dist/web/generate-helpers.js.map +1 -1
- package/dist/web/generate-helpers.test-d.js +26 -26
- package/dist/web/generate-helpers.test-d.js.map +1 -1
- package/dist/web/generate-helpers.test.js.map +1 -1
- package/dist/web/helpers/state.d.ts +2 -2
- package/dist/web/helpers/state.js +11 -11
- package/dist/web/helpers/state.js.map +1 -1
- package/dist/web/helpers/state.test.js +9 -9
- package/dist/web/helpers/state.test.js.map +1 -1
- package/dist/web/hooks/index.d.ts +5 -2
- package/dist/web/hooks/index.js +4 -1
- package/dist/web/hooks/index.js.map +1 -1
- package/dist/web/hooks/test/utils.js +4 -0
- package/dist/web/hooks/test/utils.js.map +1 -1
- package/dist/web/hooks/use-call-tool.js.map +1 -1
- package/dist/web/hooks/use-call-tool.test-d.js.map +1 -1
- package/dist/web/hooks/use-call-tool.test.js +0 -4
- package/dist/web/hooks/use-call-tool.test.js.map +1 -1
- package/dist/web/hooks/use-display-mode.d.ts +3 -3
- package/dist/web/hooks/use-display-mode.js.map +1 -1
- package/dist/web/hooks/use-display-mode.test-d.d.ts +1 -0
- package/dist/web/hooks/use-display-mode.test-d.js +8 -0
- package/dist/web/hooks/use-display-mode.test-d.js.map +1 -0
- package/dist/web/hooks/use-display-mode.test.js.map +1 -1
- package/dist/web/hooks/use-files.d.ts +3 -6
- package/dist/web/hooks/use-files.js +5 -2
- package/dist/web/hooks/use-files.js.map +1 -1
- package/dist/web/hooks/use-files.test.js +28 -3
- package/dist/web/hooks/use-files.test.js.map +1 -1
- package/dist/web/hooks/use-layout.js.map +1 -1
- package/dist/web/hooks/use-layout.test.js +3 -3
- package/dist/web/hooks/use-layout.test.js.map +1 -1
- package/dist/web/hooks/use-open-external.d.ts +3 -1
- package/dist/web/hooks/use-open-external.js +1 -1
- package/dist/web/hooks/use-open-external.js.map +1 -1
- package/dist/web/hooks/use-open-external.test.js +26 -11
- package/dist/web/hooks/use-open-external.test.js.map +1 -1
- package/dist/web/hooks/use-request-close.d.ts +2 -0
- package/dist/web/hooks/use-request-close.js +8 -0
- package/dist/web/hooks/use-request-close.js.map +1 -0
- package/dist/web/hooks/use-request-close.test.d.ts +1 -0
- package/dist/web/hooks/use-request-close.test.js +52 -0
- package/dist/web/hooks/use-request-close.test.js.map +1 -0
- package/dist/web/hooks/use-request-modal.d.ts +3 -3
- package/dist/web/hooks/use-request-modal.js +10 -8
- package/dist/web/hooks/use-request-modal.js.map +1 -1
- package/dist/web/hooks/use-request-modal.test.js +5 -1
- package/dist/web/hooks/use-request-modal.test.js.map +1 -1
- package/dist/web/hooks/use-request-size.d.ts +3 -0
- package/dist/web/hooks/use-request-size.js +8 -0
- package/dist/web/hooks/use-request-size.js.map +1 -0
- package/dist/web/hooks/use-request-size.test.d.ts +1 -0
- package/dist/web/hooks/use-request-size.test.js +65 -0
- package/dist/web/hooks/use-request-size.test.js.map +1 -0
- package/dist/web/hooks/use-send-follow-up-message.d.ts +2 -1
- package/dist/web/hooks/use-send-follow-up-message.js +2 -2
- package/dist/web/hooks/use-send-follow-up-message.js.map +1 -1
- package/dist/web/hooks/use-set-open-in-app-url.d.ts +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.js.map +1 -1
- package/dist/web/hooks/use-tool-info.test-d.js.map +1 -1
- package/dist/web/hooks/use-tool-info.test.js +1 -1
- package/dist/web/hooks/use-tool-info.test.js.map +1 -1
- package/dist/web/hooks/use-user.js +18 -2
- package/dist/web/hooks/use-user.js.map +1 -1
- package/dist/web/hooks/use-user.test.js +29 -1
- package/dist/web/hooks/use-user.test.js.map +1 -1
- package/dist/web/hooks/use-view-state.d.ts +4 -0
- package/dist/web/hooks/use-view-state.js +32 -0
- package/dist/web/hooks/use-view-state.js.map +1 -0
- package/dist/web/hooks/use-view-state.test.d.ts +1 -0
- package/dist/web/hooks/use-view-state.test.js +177 -0
- package/dist/web/hooks/use-view-state.test.js.map +1 -0
- package/dist/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 +1 -0
- package/dist/web/{mount-widget.js → mount-view.js} +11 -3
- 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 +4 -1
- package/dist/web/plugin/plugin.js +135 -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.js.map +1 -1
- package/package.json +48 -32
- package/tsconfig.base.json +33 -0
- package/dist/commands/telemetry.d.ts +0 -9
- package/dist/commands/telemetry.js +0 -40
- package/dist/commands/telemetry.js.map +0 -1
- package/dist/hooks/prerun.d.ts +0 -11
- package/dist/hooks/prerun.js +0 -21
- package/dist/hooks/prerun.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 -255
- package/dist/test/widget.test.js.map +0 -1
- package/dist/web/hooks/use-widget-state.d.ts +0 -4
- package/dist/web/hooks/use-widget-state.js +0 -32
- package/dist/web/hooks/use-widget-state.js.map +0 -1
- package/dist/web/hooks/use-widget-state.test.js +0 -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.map +0 -1
- /package/dist/{test/widget.test.d.ts → cli/tunnel-control-server.test.d.ts} +0 -0
- /package/dist/{web/hooks/use-widget-state.test.d.ts → cli/tunnel-handler.test.d.ts} +0 -0
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.90b5f61",
|
|
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.22.3"
|
|
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,45 +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": ">=0.35.14 <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
|
-
"
|
|
40
|
-
"
|
|
51
|
+
"@babel/core": "^7.29.0",
|
|
52
|
+
"@modelcontextprotocol/ext-apps": "^1.7.1",
|
|
53
|
+
"@oclif/core": "^4.11.2",
|
|
54
|
+
"ci-info": "^4.4.0",
|
|
55
|
+
"cors": "^2.8.6",
|
|
56
|
+
"cross-spawn": "^7.0.6",
|
|
41
57
|
"dequal": "^2.0.3",
|
|
42
|
-
"es-toolkit": "^1.
|
|
58
|
+
"es-toolkit": "^1.46.1",
|
|
43
59
|
"express": "^5.2.1",
|
|
44
|
-
"handlebars": "^4.7.
|
|
45
|
-
"ink": "^
|
|
46
|
-
"
|
|
60
|
+
"handlebars": "^4.7.9",
|
|
61
|
+
"ink": "^7.0.3",
|
|
62
|
+
"open": "^11.0.0",
|
|
63
|
+
"posthog-node": "^5.34.1",
|
|
47
64
|
"superjson": "^2.2.6",
|
|
48
|
-
"
|
|
49
|
-
"zustand": "^5.0.10"
|
|
65
|
+
"zustand": "^5.0.13"
|
|
50
66
|
},
|
|
51
67
|
"devDependencies": {
|
|
52
|
-
"@modelcontextprotocol/
|
|
53
|
-
"@modelcontextprotocol/sdk": "^1.25.2",
|
|
68
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
54
69
|
"@testing-library/dom": "^10.4.1",
|
|
55
|
-
"@testing-library/react": "^16.3.
|
|
70
|
+
"@testing-library/react": "^16.3.2",
|
|
56
71
|
"@total-typescript/tsconfig": "^1.0.4",
|
|
57
72
|
"@types/babel__core": "^7.20.5",
|
|
58
73
|
"@types/cors": "^2.8.19",
|
|
74
|
+
"@types/cross-spawn": "^6.0.6",
|
|
59
75
|
"@types/express": "^5.0.6",
|
|
60
|
-
"@types/jsdom": "^
|
|
61
|
-
"@types/node": "^24.
|
|
62
|
-
"@types/react": "^19.2.
|
|
76
|
+
"@types/jsdom": "^28.0.3",
|
|
77
|
+
"@types/node": "^24.12.4",
|
|
78
|
+
"@types/react": "^19.2.14",
|
|
63
79
|
"@types/react-dom": "^19.2.3",
|
|
64
|
-
"@vitest/ui": "^4.
|
|
65
|
-
"jsdom": "^
|
|
80
|
+
"@vitest/ui": "^4.1.6",
|
|
81
|
+
"jsdom": "^29.1.1",
|
|
66
82
|
"shx": "^0.4.0",
|
|
67
83
|
"ts-node": "^10.9.2",
|
|
68
|
-
"typescript": "^
|
|
69
|
-
"
|
|
70
|
-
"
|
|
84
|
+
"typescript": "^6.0.3",
|
|
85
|
+
"vite": "^8.0.0",
|
|
86
|
+
"vitest": "^4.1.6",
|
|
87
|
+
"zod": "^4.4.3"
|
|
71
88
|
},
|
|
72
89
|
"bin": {
|
|
73
90
|
"sb": "./bin/run.js",
|
|
@@ -79,16 +96,15 @@
|
|
|
79
96
|
"dirname": "skybridge",
|
|
80
97
|
"topicSeparator": " ",
|
|
81
98
|
"hooks": {
|
|
82
|
-
"
|
|
99
|
+
"finally": "./dist/cli/telemetry"
|
|
83
100
|
}
|
|
84
101
|
},
|
|
85
102
|
"scripts": {
|
|
86
|
-
"build": "shx rm -rf dist &&
|
|
87
|
-
"build:templates": "
|
|
103
|
+
"build": "shx rm -rf dist && pnpm run build:templates && tsc",
|
|
104
|
+
"build:templates": "node scripts/precompile-templates.mjs",
|
|
88
105
|
"format": "biome check --write --error-on-warnings",
|
|
89
|
-
"test": "pnpm run test:unit && pnpm run test:
|
|
90
|
-
"test:unit": "vitest run",
|
|
91
|
-
"test:type": "tsc --noEmit",
|
|
106
|
+
"test": "pnpm run test:unit && pnpm run test:format",
|
|
107
|
+
"test:unit": "pnpm run build:templates && vitest run",
|
|
92
108
|
"test:format": "biome ci"
|
|
93
109
|
}
|
|
94
110
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
// Module resolution options
|
|
4
|
+
"module": "NodeNext",
|
|
5
|
+
"esModuleInterop": true,
|
|
6
|
+
"verbatimModuleSyntax": true,
|
|
7
|
+
|
|
8
|
+
// Output options
|
|
9
|
+
"rootDir": "${configDir}/src",
|
|
10
|
+
"outDir": "${configDir}/dist",
|
|
11
|
+
"noEmit": false,
|
|
12
|
+
"incremental": true,
|
|
13
|
+
"sourceMap": true,
|
|
14
|
+
|
|
15
|
+
// Language and environment options
|
|
16
|
+
"target": "ES2022",
|
|
17
|
+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
18
|
+
"jsx": "react-jsx",
|
|
19
|
+
|
|
20
|
+
// Type declarations
|
|
21
|
+
"types": ["node", "vite/client"],
|
|
22
|
+
|
|
23
|
+
// Strictness and checking options
|
|
24
|
+
"strict": true,
|
|
25
|
+
"skipLibCheck": true,
|
|
26
|
+
"forceConsistentCasingInFileNames": true,
|
|
27
|
+
|
|
28
|
+
// Code quality & diagnostics
|
|
29
|
+
"noUnusedLocals": true,
|
|
30
|
+
"noUnusedParameters": true,
|
|
31
|
+
"noFallthroughCasesInSwitch": true
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Command } from "@oclif/core";
|
|
2
|
-
export default class Telemetry extends Command {
|
|
3
|
-
static args: {
|
|
4
|
-
action: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
|
|
5
|
-
};
|
|
6
|
-
static description: string;
|
|
7
|
-
static examples: string[];
|
|
8
|
-
run(): Promise<void>;
|
|
9
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Args, Command } from "@oclif/core";
|
|
3
|
-
import { Box, render, Text } from "ink";
|
|
4
|
-
import { getCI, getGlobalConfigPath, getMachineId, getProjectId, isEnabled, setEnabled, } from "../cli/telemetry.js";
|
|
5
|
-
export default class Telemetry extends Command {
|
|
6
|
-
static args = {
|
|
7
|
-
action: Args.string({
|
|
8
|
-
description: "Action to perform: status, enable, or disable",
|
|
9
|
-
options: ["status", "enable", "disable"],
|
|
10
|
-
}),
|
|
11
|
-
};
|
|
12
|
-
static description = "Manage Skybridge telemetry settings";
|
|
13
|
-
static examples = [
|
|
14
|
-
"skybridge telemetry status",
|
|
15
|
-
"skybridge telemetry enable",
|
|
16
|
-
"skybridge telemetry disable",
|
|
17
|
-
];
|
|
18
|
-
async run() {
|
|
19
|
-
const { args } = await this.parse(Telemetry);
|
|
20
|
-
const action = args.action || "status";
|
|
21
|
-
if (action === "enable") {
|
|
22
|
-
setEnabled(true);
|
|
23
|
-
const App = () => (_jsxs(Box, { flexDirection: "column", padding: 1, children: [_jsxs(Box, { children: [_jsx(Text, { color: "green", children: "\u2713" }), _jsx(Text, { children: " Telemetry has been " }), _jsx(Text, { color: "green", bold: true, children: "enabled" })] }), _jsx(Box, { marginTop: 1, children: _jsxs(Text, { color: "gray", children: ["Config saved to: ", getGlobalConfigPath()] }) })] }));
|
|
24
|
-
render(_jsx(App, {}));
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
if (action === "disable") {
|
|
28
|
-
setEnabled(false);
|
|
29
|
-
const App = () => (_jsxs(Box, { flexDirection: "column", padding: 1, children: [_jsxs(Box, { children: [_jsx(Text, { color: "yellow", children: "\u2713" }), _jsx(Text, { children: " Telemetry has been " }), _jsx(Text, { color: "yellow", bold: true, children: "disabled" })] }), _jsx(Box, { marginTop: 1, children: _jsxs(Text, { color: "gray", children: ["Config saved to: ", getGlobalConfigPath()] }) }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { color: "gray", children: "You can also set SKYBRIDGE_TELEMETRY_DISABLED=1 to disable telemetry via environment variable." }) })] }));
|
|
30
|
-
render(_jsx(App, {}));
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
// Status (default)
|
|
34
|
-
const enabled = isEnabled();
|
|
35
|
-
const ciInfo = getCI();
|
|
36
|
-
const App = () => (_jsxs(Box, { flexDirection: "column", padding: 1, children: [_jsx(Text, { bold: true, underline: true, children: "Skybridge Telemetry" }), _jsxs(Box, { marginTop: 1, flexDirection: "column", children: [_jsxs(Box, { children: [_jsx(Text, { children: "Status: " }), enabled ? (_jsx(Text, { color: "green", bold: true, children: "Enabled" })) : (_jsx(Text, { color: "yellow", bold: true, children: "Disabled" }))] }), _jsxs(Box, { marginTop: 1, children: [_jsx(Text, { color: "gray", children: "Machine ID: " }), _jsx(Text, { children: getMachineId() })] }), _jsxs(Box, { children: [_jsx(Text, { color: "gray", children: "Project ID: " }), _jsx(Text, { children: getProjectId() })] }), _jsxs(Box, { children: [_jsx(Text, { color: "gray", children: "CI Environment: " }), _jsx(Text, { children: ciInfo.isCI ? ciInfo.name || "Yes" : "No" })] }), _jsxs(Box, { marginTop: 1, children: [_jsx(Text, { color: "gray", children: "Config file: " }), _jsx(Text, { children: getGlobalConfigPath() })] })] }), _jsxs(Box, { marginTop: 1, flexDirection: "column", children: [_jsx(Text, { color: "gray", children: "To opt out, run: skybridge telemetry disable" }), _jsx(Text, { color: "gray", children: "Or set: SKYBRIDGE_TELEMETRY_DISABLED=1" }), _jsx(Text, { color: "gray", children: "Debug mode: SKYBRIDGE_TELEMETRY_DEBUG=1" })] })] }));
|
|
37
|
-
render(_jsx(App, {}));
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
//# sourceMappingURL=telemetry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"telemetry.js","sourceRoot":"","sources":["../../src/commands/telemetry.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACxC,OAAO,EACL,KAAK,EACL,mBAAmB,EACnB,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,UAAU,GACX,MAAM,qBAAqB,CAAC;AAE7B,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,OAAO;IAC5C,MAAM,CAAU,IAAI,GAAG;QACrB,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC;YAClB,WAAW,EAAE,+CAA+C;YAC5D,OAAO,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,CAAC;SACzC,CAAC;KACH,CAAC;IAEF,MAAM,CAAU,WAAW,GAAG,qCAAqC,CAAC;IAEpE,MAAM,CAAU,QAAQ,GAAG;QACzB,4BAA4B;QAC5B,4BAA4B;QAC5B,6BAA6B;KAC9B,CAAC;IAEK,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QAC7C,MAAM,MAAM,GA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Q,aACvC,KAAC,IAAI,IAAC,KAAK,EAAC,MAAM,6DAAoD,EACtE,KAAC,IAAI,IAAC,KAAK,EAAC,MAAM,uDAA8C,EAChE,KAAC,IAAI,IAAC,KAAK,EAAC,MAAM,wDAA+C,IAC7D,IACF,CACP,CAAC;QAEF,MAAM,CAAC,KAAC,GAAG,KAAG,CAAC,CAAC;IAClB,CAAC"}
|
package/dist/hooks/prerun.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Hook } from "@oclif/core";
|
|
2
|
-
/**
|
|
3
|
-
* Oclif prerun hook that automatically tracks telemetry for all commands.
|
|
4
|
-
* This hook runs before any command executes, ensuring telemetry is captured
|
|
5
|
-
* even for long-running commands (dev, start) or commands that exit early.
|
|
6
|
-
*
|
|
7
|
-
* Note: For commands like 'build' that have distinct success/failure outcomes,
|
|
8
|
-
* additional outcome tracking may be done within the command itself.
|
|
9
|
-
*/
|
|
10
|
-
declare const hook: Hook<"prerun">;
|
|
11
|
-
export default hook;
|
package/dist/hooks/prerun.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { trackCommand } from "../cli/telemetry.js";
|
|
2
|
-
/**
|
|
3
|
-
* Oclif prerun hook that automatically tracks telemetry for all commands.
|
|
4
|
-
* This hook runs before any command executes, ensuring telemetry is captured
|
|
5
|
-
* even for long-running commands (dev, start) or commands that exit early.
|
|
6
|
-
*
|
|
7
|
-
* Note: For commands like 'build' that have distinct success/failure outcomes,
|
|
8
|
-
* additional outcome tracking may be done within the command itself.
|
|
9
|
-
*/
|
|
10
|
-
const hook = async (options) => {
|
|
11
|
-
// Skip tracking the telemetry command itself to avoid noise
|
|
12
|
-
if (options.Command?.id === "telemetry") {
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
const commandId = options.Command?.id ?? "unknown";
|
|
16
|
-
const version = options.config.version;
|
|
17
|
-
// Track the command invocation (fire and forget - don't block command execution)
|
|
18
|
-
trackCommand(commandId, version);
|
|
19
|
-
};
|
|
20
|
-
export default hook;
|
|
21
|
-
//# sourceMappingURL=prerun.js.map
|
package/dist/hooks/prerun.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prerun.js","sourceRoot":"","sources":["../../src/hooks/prerun.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD;;;;;;;GAOG;AACH,MAAM,IAAI,GAAmB,KAAK,EAAE,OAAO,EAAE,EAAE;IAC7C,4DAA4D;IAC5D,IAAI,OAAO,CAAC,OAAO,EAAE,EAAE,KAAK,WAAW,EAAE,CAAC;QACxC,OAAO;IACT,CAAC;IAED,MAAM,SAAS,GAAG,OAAO,CAAC,OAAO,EAAE,EAAE,IAAI,SAAS,CAAC;IACnD,MAAM,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC;IAEvC,iFAAiF;IACjF,YAAY,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;AACnC,CAAC,CAAC;AAEF,eAAe,IAAI,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>;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { existsSync } from "node:fs";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import cors from "cors";
|
|
4
|
-
import express, {} from "express";
|
|
5
|
-
/**
|
|
6
|
-
* Install Vite dev server
|
|
7
|
-
* This router MUST be installed at the application root, like so:
|
|
8
|
-
*
|
|
9
|
-
* const app = express();
|
|
10
|
-
*
|
|
11
|
-
* if (env.NODE_ENV !== "production") {
|
|
12
|
-
* app.use(await widgetsRouter());
|
|
13
|
-
* }
|
|
14
|
-
*/
|
|
15
|
-
export const widgetsDevServer = async () => {
|
|
16
|
-
const router = express.Router();
|
|
17
|
-
const { createServer, searchForWorkspaceRoot, loadConfigFromFile } = await import("vite");
|
|
18
|
-
// Since 0.16.0, the template is a single package that does not rely on workspace.
|
|
19
|
-
// It means that, when starting the server, the working dir is the template root
|
|
20
|
-
// hence we don't need to walk up the tree to find the workspace, which does not exist anymore.
|
|
21
|
-
let webAppRoot = path.join(process.cwd(), "web");
|
|
22
|
-
// fallback to the old behavior for backward compatibility
|
|
23
|
-
const hasWebAppRoot = existsSync(webAppRoot);
|
|
24
|
-
if (!hasWebAppRoot) {
|
|
25
|
-
const workspaceRoot = searchForWorkspaceRoot(process.cwd());
|
|
26
|
-
webAppRoot = path.join(workspaceRoot, "web");
|
|
27
|
-
}
|
|
28
|
-
const configResult = await loadConfigFromFile({ command: "serve", mode: "development" }, path.join(webAppRoot, "vite.config.ts"), webAppRoot);
|
|
29
|
-
const { build, preview, ...devConfig } = configResult?.config || {};
|
|
30
|
-
const vite = await createServer({
|
|
31
|
-
...devConfig,
|
|
32
|
-
configFile: false, // Keep this to prevent vite from trying to resolve path in the target config file
|
|
33
|
-
appType: "custom",
|
|
34
|
-
server: {
|
|
35
|
-
allowedHosts: true,
|
|
36
|
-
middlewareMode: true,
|
|
37
|
-
},
|
|
38
|
-
root: webAppRoot,
|
|
39
|
-
optimizeDeps: {
|
|
40
|
-
include: ["react", "react-dom/client"],
|
|
41
|
-
},
|
|
42
|
-
});
|
|
43
|
-
router.use(cors());
|
|
44
|
-
router.use("/", vite.middlewares);
|
|
45
|
-
return router;
|
|
46
|
-
};
|
|
47
|
-
//# sourceMappingURL=widgetsDevServer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"widgetsDevServer.js","sourceRoot":"","sources":["../../src/server/widgetsDevServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,IAAI,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