skybridge 0.0.0-dev.ef94389 → 0.0.0-dev.efb7a49

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.
Files changed (54) hide show
  1. package/README.md +13 -5
  2. package/dist/cli/types.d.ts +5 -0
  3. package/dist/cli/types.js +2 -0
  4. package/dist/cli/types.js.map +1 -0
  5. package/dist/cli/use-nodemon.d.ts +1 -6
  6. package/dist/cli/use-nodemon.js +7 -3
  7. package/dist/cli/use-nodemon.js.map +1 -1
  8. package/dist/cli/use-tunnel.d.ts +8 -0
  9. package/dist/cli/use-tunnel.js +101 -0
  10. package/dist/cli/use-tunnel.js.map +1 -0
  11. package/dist/commands/build.js +2 -11
  12. package/dist/commands/build.js.map +1 -1
  13. package/dist/commands/dev.d.ts +1 -1
  14. package/dist/commands/dev.js +9 -7
  15. package/dist/commands/dev.js.map +1 -1
  16. package/dist/server/express.d.ts +8 -2
  17. package/dist/server/express.js +26 -23
  18. package/dist/server/express.js.map +1 -1
  19. package/dist/server/express.test.js +189 -11
  20. package/dist/server/express.test.js.map +1 -1
  21. package/dist/server/index.d.ts +1 -0
  22. package/dist/server/index.js +1 -0
  23. package/dist/server/index.js.map +1 -1
  24. package/dist/server/middleware.test.js +107 -0
  25. package/dist/server/middleware.test.js.map +1 -1
  26. package/dist/server/server.d.ts +5 -8
  27. package/dist/server/server.js +61 -48
  28. package/dist/server/server.js.map +1 -1
  29. package/dist/server/templateHelper.d.ts +2 -1
  30. package/dist/server/templateHelper.js +22 -4
  31. package/dist/server/templateHelper.js.map +1 -1
  32. package/dist/server/templates/development.hbs +12 -0
  33. package/dist/server/templates/production.hbs +6 -0
  34. package/dist/server/widgetsDevServer.d.ts +2 -1
  35. package/dist/server/widgetsDevServer.js +2 -8
  36. package/dist/server/widgetsDevServer.js.map +1 -1
  37. package/dist/test/widget.test.js +17 -15
  38. package/dist/test/widget.test.js.map +1 -1
  39. package/dist/web/bridges/types.d.ts +1 -0
  40. package/dist/web/components/modal-provider.js +1 -3
  41. package/dist/web/components/modal-provider.js.map +1 -1
  42. package/dist/web/hooks/use-request-modal.test.js +5 -1
  43. package/dist/web/hooks/use-request-modal.test.js.map +1 -1
  44. package/dist/web/hooks/use-user.js +18 -2
  45. package/dist/web/hooks/use-user.js.map +1 -1
  46. package/dist/web/hooks/use-user.test.js +28 -0
  47. package/dist/web/hooks/use-user.test.js.map +1 -1
  48. package/package.json +14 -14
  49. package/tsconfig.base.json +3 -0
  50. package/dist/server/const.d.ts +0 -1
  51. package/dist/server/const.js +0 -2
  52. package/dist/server/const.js.map +0 -1
  53. package/dist/server/templates/development.js +0 -27
  54. package/dist/server/templates/production.js +0 -23
@@ -44,6 +44,21 @@ describe("useUser", () => {
44
44
  const { result } = renderHook(() => useUser());
45
45
  expect(result.current.locale).toBe("es-ES");
46
46
  });
47
+ it("should normalize underscore locale to BCP 47 hyphen format", () => {
48
+ OpenaiMock.locale = "fr_FR";
49
+ const { result } = renderHook(() => useUser());
50
+ expect(result.current.locale).toBe("fr-FR");
51
+ });
52
+ it("should canonicalize locale casing", () => {
53
+ OpenaiMock.locale = "en-us";
54
+ const { result } = renderHook(() => useUser());
55
+ expect(result.current.locale).toBe("en-US");
56
+ });
57
+ it("should fall back to en-US for invalid locale", () => {
58
+ OpenaiMock.locale = "not-a-locale-!!";
59
+ const { result } = renderHook(() => useUser());
60
+ expect(result.current.locale).toBe("en-US");
61
+ });
47
62
  });
48
63
  describe("mcp-app host type", () => {
49
64
  beforeEach(() => {
@@ -73,6 +88,19 @@ describe("useUser", () => {
73
88
  });
74
89
  });
75
90
  });
91
+ it("should normalize underscore locale to BCP 47 hyphen format", async () => {
92
+ vi.stubGlobal("parent", {
93
+ postMessage: getMcpAppHostPostMessageMock({
94
+ locale: "fr_FR",
95
+ platform: "web",
96
+ deviceCapabilities: { hover: true, touch: false },
97
+ }),
98
+ });
99
+ const { result } = renderHook(() => useUser());
100
+ await waitFor(() => {
101
+ expect(result.current.locale).toBe("fr-FR");
102
+ });
103
+ });
76
104
  it("should maintain userAgent referential stability when data has not changed", async () => {
77
105
  vi.stubGlobal("parent", {
78
106
  postMessage: getMcpAppHostPostMessageMock({
@@ -1 +1 @@
1
- {"version":3,"file":"use-user.test.js","sourceRoot":"","sources":["../../../src/web/hooks/use-user.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE5D,OAAO,EACL,4BAA4B,EAC5B,kBAAkB,GACnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE;IACvB,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;QAClC,IAAI,UAGH,CAAC;QAEF,UAAU,CAAC,GAAG,EAAE;YACd,UAAU,GAAG;gBACX,MAAM,EAAE,OAAO;gBACf,SAAS,EAAE;oBACT,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;oBAC3B,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE;iBAC5C;aACF,CAAC;YACF,EAAE,CAAC,UAAU,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;YACpC,EAAE,CAAC,UAAU,CAAC,WAAW,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC,CAAC;QACvD,CAAC,CAAC,CAAC;QAEH,SAAS,CAAC,GAAG,EAAE;YACb,EAAE,CAAC,gBAAgB,EAAE,CAAC;YACtB,EAAE,CAAC,aAAa,EAAE,CAAC;QACrB,CAA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,OAAO;oBACf,QAAQ,EAAE,KAAK;oBACf,kBAAkB,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE;iBAClD,CAAC;aACH,CAAC,CAAC;YACH,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;YAEzD,MAAM,OAAO,CAAC,GAAG,EAAE;gBACjB,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,CAAC;YACjD,CAAC,CAAC,CAAC;YAEH,MAAM,gBAAgB,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC;YAElD,QAAQ,EAAE,CAAC;YAEX,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAC1D,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skybridge",
3
- "version": "0.0.0-dev.ef94389",
3
+ "version": "0.0.0-dev.efb7a49",
4
4
  "description": "Skybridge is a framework for building ChatGPT and MCP Apps",
5
5
  "repository": {
6
6
  "type": "git",
@@ -34,7 +34,7 @@
34
34
  "license": "ISC",
35
35
  "peerDependencies": {
36
36
  "@modelcontextprotocol/sdk": ">=1.0.0",
37
- "@skybridge/devtools": ">=0.26.1",
37
+ "@skybridge/devtools": ">=0.35.14 <1.0.0",
38
38
  "nodemon": ">=3.0.0",
39
39
  "react": ">=18.0.0",
40
40
  "react-dom": ">=18.0.0",
@@ -42,37 +42,37 @@
42
42
  },
43
43
  "dependencies": {
44
44
  "@babel/core": "^7.29.0",
45
- "@modelcontextprotocol/ext-apps": "^1.2.2",
46
- "@oclif/core": "^4.9.0",
45
+ "@modelcontextprotocol/ext-apps": "^1.3.2",
46
+ "@oclif/core": "^4.10.3",
47
47
  "ci-info": "^4.4.0",
48
48
  "cors": "^2.8.6",
49
49
  "dequal": "^2.0.3",
50
50
  "es-toolkit": "^1.45.1",
51
51
  "express": "^5.2.1",
52
- "handlebars": "^4.7.8",
52
+ "handlebars": "^4.7.9",
53
53
  "ink": "^6.8.0",
54
- "posthog-node": "^5.28.2",
54
+ "posthog-node": "^5.28.9",
55
55
  "superjson": "^2.2.6",
56
56
  "zustand": "^5.0.12"
57
57
  },
58
58
  "devDependencies": {
59
- "@modelcontextprotocol/sdk": "^1.27.1",
59
+ "@modelcontextprotocol/sdk": "^1.29.0",
60
60
  "@testing-library/dom": "^10.4.1",
61
61
  "@testing-library/react": "^16.3.2",
62
62
  "@total-typescript/tsconfig": "^1.0.4",
63
63
  "@types/babel__core": "^7.20.5",
64
64
  "@types/cors": "^2.8.19",
65
65
  "@types/express": "^5.0.6",
66
- "@types/jsdom": "^28.0.0",
66
+ "@types/jsdom": "^28.0.1",
67
67
  "@types/node": "^24.12.0",
68
68
  "@types/react": "^19.2.14",
69
69
  "@types/react-dom": "^19.2.3",
70
- "@vitest/ui": "^4.1.0",
71
- "jsdom": "^29.0.0",
70
+ "@vitest/ui": "^4.1.2",
71
+ "jsdom": "^29.0.1",
72
72
  "shx": "^0.4.0",
73
73
  "ts-node": "^10.9.2",
74
- "typescript": "^5.9.3",
75
- "vitest": "^4.1.0",
74
+ "typescript": "^6.0.2",
75
+ "vitest": "^4.1.2",
76
76
  "zod": "^4.3.6"
77
77
  },
78
78
  "bin": {
@@ -90,10 +90,10 @@
90
90
  },
91
91
  "scripts": {
92
92
  "build": "shx rm -rf dist && tsc && pnpm run build:templates",
93
- "build:templates": "node scripts/precompile-templates.mjs",
93
+ "build:templates": "cp -r src/server/templates dist/server/",
94
94
  "format": "biome check --write --error-on-warnings",
95
95
  "test": "pnpm run test:unit && pnpm run test:type && pnpm run test:format",
96
- "test:unit": "pnpm run build:templates && vitest run",
96
+ "test:unit": "vitest run",
97
97
  "test:type": "tsc --noEmit",
98
98
  "test:format": "biome ci"
99
99
  }
@@ -15,6 +15,9 @@
15
15
  "lib": ["ES2022", "DOM", "DOM.Iterable"],
16
16
  "jsx": "react-jsx",
17
17
 
18
+ // Type declarations
19
+ "types": ["node", "vite/client"],
20
+
18
21
  // Strictness and checking options
19
22
  "strict": true,
20
23
  "skipLibCheck": true,
@@ -1 +0,0 @@
1
- export declare const DEFAULT_HMR_PORT = 24678;
@@ -1,2 +0,0 @@
1
- export const DEFAULT_HMR_PORT = 24678;
2
- //# sourceMappingURL=const.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"const.js","sourceRoot":"","sources":["../../src/server/const.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,CAAC"}
@@ -1,27 +0,0 @@
1
- import Handlebars from "handlebars/runtime.js";
2
- export default Handlebars.template({"1":function(container,depth0,helpers,partials,data) {
3
- return "<script type=\"module\">\n // Checks for browser support and shows error if local network access is denied\n (async () => {\n if (!navigator.permissions?.query) {\n return;\n }\n\n // Skip for non-http(s) protocols (file://, custom protocols in Electron, etc.)\n const protocol = window.location.protocol;\n const isNonHttpProtocol = protocol !== 'http:' && protocol !== 'https:'\n if (isNonHttpProtocol) {\n return;\n }\n\n const host = window.location.hostname;\n const isLoopback = host === 'localhost'\n || /^127\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})$/.test(host)\n || host === '::1';\n if (isLoopback) {\n return;\n }\n \n try {\n const status = await navigator.permissions.query({ name: \"local-network-access\" });\n if (status.state === \"denied\") {\n const errorDiv = document.createElement(\"div\");\n 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;\";\n\n const errorTitle = document.createElement(\"div\");\n errorTitle.style.cssText = \"color: #ef4444; font-size: 18px; font-weight: 600; margin-bottom: 8px;\";\n errorTitle.textContent = \"Error: Local network access permission is denied.\";\n\n const errorMessage = document.createElement(\"div\");\n errorMessage.style.cssText = \"color: #ef4444; font-size: 14px;\";\n errorMessage.textContent = \"Local network access is required for your widget to connect to the local dev server. Please enable it in your browser settings. \";\n\n const link = document.createElement(\"a\");\n link.href = \"https://developer.chrome.com/blog/local-network-access\";\n link.target = \"_blank\";\n link.rel = \"noopener noreferrer\";\n link.style.cssText = \"color: #ef4444; text-decoration: underline;\";\n link.textContent = \"Learn more\";\n errorMessage.appendChild(link);\n\n errorDiv.appendChild(errorTitle);\n errorDiv.appendChild(errorMessage);\n document.body.appendChild(errorDiv);\n }\n } catch (e) {\n // Permission API doesn't support local-network-access, ignore silently\n }\n })();\n</script>\n";
4
- },"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) {
5
- var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) {
6
- if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
7
- return parent[propertyName];
8
- }
9
- return undefined
10
- };
11
-
12
- return "<script type=\"module\">window.skybridge = { hostType: \""
13
- + alias4(((helper = (helper = lookupProperty(helpers,"hostType") || (depth0 != null ? lookupProperty(depth0,"hostType") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"hostType","hash":{},"data":data,"loc":{"start":{"line":1,"column":54},"end":{"line":1,"column":66}}}) : helper)))
14
- + "\", serverUrl: \""
15
- + alias4(((helper = (helper = lookupProperty(helpers,"serverUrl") || (depth0 != null ? lookupProperty(depth0,"serverUrl") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"serverUrl","hash":{},"data":data,"loc":{"start":{"line":1,"column":81},"end":{"line":1,"column":94}}}) : helper)))
16
- + "\" };</script>\n<script type=\"module\">\n import { injectIntoGlobalHook } from \""
17
- + alias4(((helper = (helper = lookupProperty(helpers,"serverUrl") || (depth0 != null ? lookupProperty(depth0,"serverUrl") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"serverUrl","hash":{},"data":data,"loc":{"start":{"line":3,"column":40},"end":{"line":3,"column":53}}}) : helper)))
18
- + "/assets/@react-refresh\";\n injectIntoGlobalHook(window); window.$RefreshReg$ = () => {};\n window.$RefreshSig$ = () => (type) => type;\n window.__vite_plugin_react_preamble_installed__ = true;\n</script>\n<script type=\"module\" src=\""
19
- + alias4(((helper = (helper = lookupProperty(helpers,"serverUrl") || (depth0 != null ? lookupProperty(depth0,"serverUrl") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"serverUrl","hash":{},"data":data,"loc":{"start":{"line":8,"column":27},"end":{"line":8,"column":40}}}) : helper)))
20
- + "/@vite/client\"></script>\n"
21
- + ((stack1 = lookupProperty(helpers,"if").call(alias1,(depth0 != null ? lookupProperty(depth0,"useLocalNetworkAccess") : depth0),{"name":"if","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":9,"column":0},"end":{"line":63,"column":7}}})) != null ? stack1 : "")
22
- + "<div id=\"root\"></div>\n<script type=\"module\" id=\"dev-widget-entry\">\n import('"
23
- + alias4(((helper = (helper = lookupProperty(helpers,"serverUrl") || (depth0 != null ? lookupProperty(depth0,"serverUrl") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"serverUrl","hash":{},"data":data,"loc":{"start":{"line":66,"column":10},"end":{"line":66,"column":23}}}) : helper)))
24
- + "/src/widgets/"
25
- + alias4(((helper = (helper = lookupProperty(helpers,"widgetName") || (depth0 != null ? lookupProperty(depth0,"widgetName") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"widgetName","hash":{},"data":data,"loc":{"start":{"line":66,"column":36},"end":{"line":66,"column":50}}}) : helper)))
26
- + "');\n</script>";
27
- },"useData":true});
@@ -1,23 +0,0 @@
1
- import Handlebars from "handlebars/runtime.js";
2
- export default Handlebars.template({"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) {
3
- var helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) {
4
- if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
5
- return parent[propertyName];
6
- }
7
- return undefined
8
- };
9
-
10
- return "<script type=\"module\">window.skybridge = { hostType: \""
11
- + alias4(((helper = (helper = lookupProperty(helpers,"hostType") || (depth0 != null ? lookupProperty(depth0,"hostType") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"hostType","hash":{},"data":data,"loc":{"start":{"line":1,"column":54},"end":{"line":1,"column":66}}}) : helper)))
12
- + "\", serverUrl: \""
13
- + alias4(((helper = (helper = lookupProperty(helpers,"serverUrl") || (depth0 != null ? lookupProperty(depth0,"serverUrl") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"serverUrl","hash":{},"data":data,"loc":{"start":{"line":1,"column":81},"end":{"line":1,"column":94}}}) : helper)))
14
- + "\" };</script>\n<div id=\"root\"></div>\n<script type=\"module\">\n import('"
15
- + alias4(((helper = (helper = lookupProperty(helpers,"serverUrl") || (depth0 != null ? lookupProperty(depth0,"serverUrl") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"serverUrl","hash":{},"data":data,"loc":{"start":{"line":4,"column":10},"end":{"line":4,"column":23}}}) : helper)))
16
- + "/assets/"
17
- + alias4(((helper = (helper = lookupProperty(helpers,"widgetFile") || (depth0 != null ? lookupProperty(depth0,"widgetFile") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"widgetFile","hash":{},"data":data,"loc":{"start":{"line":4,"column":31},"end":{"line":4,"column":45}}}) : helper)))
18
- + "');\n</script>\n<link rel=\"stylesheet\" crossorigin href=\""
19
- + alias4(((helper = (helper = lookupProperty(helpers,"serverUrl") || (depth0 != null ? lookupProperty(depth0,"serverUrl") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"serverUrl","hash":{},"data":data,"loc":{"start":{"line":6,"column":41},"end":{"line":6,"column":54}}}) : helper)))
20
- + "/assets/"
21
- + alias4(((helper = (helper = lookupProperty(helpers,"styleFile") || (depth0 != null ? lookupProperty(depth0,"styleFile") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"styleFile","hash":{},"data":data,"loc":{"start":{"line":6,"column":62},"end":{"line":6,"column":75}}}) : helper)))
22
- + "\" />";
23
- },"useData":true});