skybridge 0.0.0-dev.7eec2ca → 0.0.0-dev.80bff2e

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 (128) hide show
  1. package/dist/src/server/devtoolsStaticServer.d.ts +4 -0
  2. package/dist/src/server/devtoolsStaticServer.js +22 -12
  3. package/dist/src/server/devtoolsStaticServer.js.map +1 -1
  4. package/dist/src/server/index.d.ts +1 -1
  5. package/dist/src/server/server.d.ts +1 -0
  6. package/dist/src/server/server.js +13 -9
  7. package/dist/src/server/server.js.map +1 -1
  8. package/dist/src/server/templateHelper.d.ts +3 -2
  9. package/dist/src/server/templateHelper.js.map +1 -1
  10. package/dist/src/server/templates/development.hbs +40 -2
  11. package/dist/src/server/templates/production.hbs +1 -1
  12. package/dist/src/server/widgetsDevServer.js +0 -1
  13. package/dist/src/server/widgetsDevServer.js.map +1 -1
  14. package/dist/src/test/widget.test.js +37 -11
  15. package/dist/src/test/widget.test.js.map +1 -1
  16. package/dist/src/web/bridges/adaptors/apps-sdk-adaptor.d.ts +13 -0
  17. package/dist/src/web/bridges/adaptors/apps-sdk-adaptor.js +33 -0
  18. package/dist/src/web/bridges/adaptors/apps-sdk-adaptor.js.map +1 -0
  19. package/dist/src/web/bridges/adaptors/mcp-app-adaptor.d.ts +16 -0
  20. package/dist/src/web/bridges/adaptors/mcp-app-adaptor.js +115 -0
  21. package/dist/src/web/bridges/adaptors/mcp-app-adaptor.js.map +1 -0
  22. package/dist/src/web/bridges/apps-sdk-bridge.d.ts +10 -0
  23. package/dist/src/web/bridges/apps-sdk-bridge.js +46 -0
  24. package/dist/src/web/bridges/apps-sdk-bridge.js.map +1 -0
  25. package/dist/src/web/bridges/hooks/use-adaptor.d.ts +2 -0
  26. package/dist/src/web/bridges/hooks/use-adaptor.js +8 -0
  27. package/dist/src/web/bridges/hooks/use-adaptor.js.map +1 -0
  28. package/dist/src/web/bridges/hooks/use-apps-sdk-bridge.d.ts +2 -0
  29. package/dist/src/web/bridges/hooks/use-apps-sdk-bridge.js +7 -0
  30. package/dist/src/web/bridges/hooks/use-apps-sdk-bridge.js.map +1 -0
  31. package/dist/src/web/bridges/hooks/use-bridge.d.ts +2 -0
  32. package/dist/src/web/bridges/hooks/use-bridge.js +8 -0
  33. package/dist/src/web/bridges/hooks/use-bridge.js.map +1 -0
  34. package/dist/src/web/bridges/hooks/use-mcp-app-bridge.d.ts +5 -0
  35. package/dist/src/web/bridges/hooks/use-mcp-app-bridge.js +7 -0
  36. package/dist/src/web/bridges/hooks/use-mcp-app-bridge.js.map +1 -0
  37. package/dist/src/web/bridges/hooks/use-mcp-app-bridge.test.js +41 -0
  38. package/dist/src/web/bridges/hooks/use-mcp-app-bridge.test.js.map +1 -0
  39. package/dist/src/web/bridges/index.d.ts +4 -0
  40. package/dist/src/web/bridges/index.js +5 -0
  41. package/dist/src/web/bridges/index.js.map +1 -0
  42. package/dist/src/web/bridges/mcp-app-bridge.d.ts +38 -0
  43. package/dist/src/web/bridges/mcp-app-bridge.js +162 -0
  44. package/dist/src/web/bridges/mcp-app-bridge.js.map +1 -0
  45. package/dist/src/web/bridges/types.d.ts +57 -0
  46. package/dist/src/web/bridges/types.js +2 -0
  47. package/dist/src/web/bridges/types.js.map +1 -0
  48. package/dist/src/web/data-llm.js +4 -2
  49. package/dist/src/web/data-llm.js.map +1 -1
  50. package/dist/src/web/generate-helpers.test-d.js +4 -1
  51. package/dist/src/web/generate-helpers.test-d.js.map +1 -1
  52. package/dist/src/web/hooks/index.d.ts +2 -3
  53. package/dist/src/web/hooks/index.js +2 -3
  54. package/dist/src/web/hooks/index.js.map +1 -1
  55. package/dist/src/web/hooks/test/utils.d.ts +10 -0
  56. package/dist/src/web/hooks/test/utils.js +40 -0
  57. package/dist/src/web/hooks/test/utils.js.map +1 -0
  58. package/dist/src/web/hooks/use-call-tool.js +12 -4
  59. package/dist/src/web/hooks/use-call-tool.js.map +1 -1
  60. package/dist/src/web/hooks/use-call-tool.test.js +26 -0
  61. package/dist/src/web/hooks/use-call-tool.test.js.map +1 -1
  62. package/dist/src/web/hooks/use-display-mode.d.ts +1 -1
  63. package/dist/src/web/hooks/use-display-mode.js +6 -3
  64. package/dist/src/web/hooks/use-display-mode.js.map +1 -1
  65. package/dist/src/web/hooks/use-display-mode.test.js +1 -0
  66. package/dist/src/web/hooks/use-display-mode.test.js.map +1 -1
  67. package/dist/src/web/hooks/use-layout.d.ts +22 -0
  68. package/dist/src/web/hooks/use-layout.js +23 -0
  69. package/dist/src/web/hooks/use-layout.js.map +1 -0
  70. package/dist/src/web/hooks/use-layout.test.js +95 -0
  71. package/dist/src/web/hooks/use-layout.test.js.map +1 -0
  72. package/dist/src/web/hooks/use-open-external.js +5 -3
  73. package/dist/src/web/hooks/use-open-external.js.map +1 -1
  74. package/dist/src/web/hooks/use-open-external.test.js +41 -15
  75. package/dist/src/web/hooks/use-open-external.test.js.map +1 -1
  76. package/dist/src/web/hooks/use-openai-global.d.ts +2 -1
  77. package/dist/src/web/hooks/use-openai-global.js +3 -22
  78. package/dist/src/web/hooks/use-openai-global.js.map +1 -1
  79. package/dist/src/web/hooks/use-request-modal.d.ts +6 -3
  80. package/dist/src/web/hooks/use-request-modal.js +6 -1
  81. package/dist/src/web/hooks/use-request-modal.js.map +1 -1
  82. package/dist/src/web/hooks/use-request-modal.test.js +35 -2
  83. package/dist/src/web/hooks/use-request-modal.test.js.map +1 -1
  84. package/dist/src/web/hooks/use-send-follow-up-message.js +3 -6
  85. package/dist/src/web/hooks/use-send-follow-up-message.js.map +1 -1
  86. package/dist/src/web/hooks/use-tool-info.d.ts +12 -1
  87. package/dist/src/web/hooks/use-tool-info.js +15 -9
  88. package/dist/src/web/hooks/use-tool-info.js.map +1 -1
  89. package/dist/src/web/hooks/use-tool-info.test-d.js +40 -4
  90. package/dist/src/web/hooks/use-tool-info.test-d.js.map +1 -1
  91. package/dist/src/web/hooks/use-tool-info.test.js +117 -46
  92. package/dist/src/web/hooks/use-tool-info.test.js.map +1 -1
  93. package/dist/src/web/hooks/use-user.d.ts +18 -0
  94. package/dist/src/web/hooks/use-user.js +19 -0
  95. package/dist/src/web/hooks/use-user.js.map +1 -0
  96. package/dist/src/web/hooks/use-user.test.js +93 -0
  97. package/dist/src/web/hooks/use-user.test.js.map +1 -0
  98. package/dist/src/web/hooks/use-widget-state.js +2 -2
  99. package/dist/src/web/hooks/use-widget-state.js.map +1 -1
  100. package/dist/src/web/hooks/use-widget-state.test.js +1 -0
  101. package/dist/src/web/hooks/use-widget-state.test.js.map +1 -1
  102. package/dist/src/web/index.d.ts +1 -0
  103. package/dist/src/web/index.js +1 -0
  104. package/dist/src/web/index.js.map +1 -1
  105. package/dist/src/web/plugin/transform-data-llm.js +6 -3
  106. package/dist/src/web/plugin/transform-data-llm.js.map +1 -1
  107. package/dist/src/web/types.d.ts +21 -9
  108. package/dist/src/web/types.js.map +1 -1
  109. package/package.json +30 -29
  110. package/README.md +0 -125
  111. package/dist/src/web/hooks/use-locale.d.ts +0 -1
  112. package/dist/src/web/hooks/use-locale.js +0 -5
  113. package/dist/src/web/hooks/use-locale.js.map +0 -1
  114. package/dist/src/web/hooks/use-locale.test.js +0 -21
  115. package/dist/src/web/hooks/use-locale.test.js.map +0 -1
  116. package/dist/src/web/hooks/use-theme.d.ts +0 -1
  117. package/dist/src/web/hooks/use-theme.js +0 -5
  118. package/dist/src/web/hooks/use-theme.js.map +0 -1
  119. package/dist/src/web/hooks/use-theme.test.js +0 -26
  120. package/dist/src/web/hooks/use-theme.test.js.map +0 -1
  121. package/dist/src/web/hooks/use-user-agent.d.ts +0 -1
  122. package/dist/src/web/hooks/use-user-agent.js +0 -5
  123. package/dist/src/web/hooks/use-user-agent.js.map +0 -1
  124. package/dist/src/web/hooks/use-user-agent.test.js +0 -31
  125. package/dist/src/web/hooks/use-user-agent.test.js.map +0 -1
  126. /package/dist/src/web/{hooks/use-locale.test.d.ts → bridges/hooks/use-mcp-app-bridge.test.d.ts} +0 -0
  127. /package/dist/src/web/hooks/{use-theme.test.d.ts → use-layout.test.d.ts} +0 -0
  128. /package/dist/src/web/hooks/{use-user-agent.test.d.ts → use-user.test.d.ts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/web/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/web/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,cAAc,YAAY,CAAC"}
@@ -8,10 +8,12 @@ function createBabelPlugin(t) {
8
8
  state.hasDataLLMImport = false;
9
9
  state.needsDataLLMImport = false;
10
10
  for (const node of path.node.body) {
11
- if (!t.isImportDeclaration(node))
11
+ if (!t.isImportDeclaration(node)) {
12
12
  continue;
13
- if (node.source.value !== LLM_IMPORT_SOURCE)
13
+ }
14
+ if (node.source.value !== LLM_IMPORT_SOURCE) {
14
15
  continue;
16
+ }
15
17
  const hasSpecifier = node.specifiers.some((s) => t.isImportSpecifier(s) &&
16
18
  t.isIdentifier(s.imported, { name: "DataLLM" }));
17
19
  if (hasSpecifier) {
@@ -34,8 +36,9 @@ function createBabelPlugin(t) {
34
36
  const attributes = opening.attributes;
35
37
  const llmAttributeIndex = attributes.findIndex((attribute) => t.isJSXAttribute(attribute) &&
36
38
  t.isJSXIdentifier(attribute.name, { name: "data-llm" }));
37
- if (llmAttributeIndex === -1)
39
+ if (llmAttributeIndex === -1) {
38
40
  return;
41
+ }
39
42
  const llmAttribute = attributes[llmAttributeIndex];
40
43
  let contentExpression;
41
44
  if (t.isStringLiteral(llmAttribute.value)) {
@@ -1 +1 @@
1
- {"version":3,"file":"transform-data-llm.js","sourceRoot":"","sources":["../../../../src/web/plugin/transform-data-llm.ts"],"names":[],"mappings":"AAEA,MAAM,iBAAiB,GAAG,eAAe,CAAC;AAO1C,SAAS,iBAAiB,CAAC,CAAe;IACxC,OAAO;QACL,IAAI,EAAE,gBAAgB;QAEtB,OAAO,EAAE;YACP,OAAO,EAAE;gBACP,KAAK,CAAC,IAAI,EAAE,KAAK;oBACf,KAAK,CAAC,gBAAgB,GAAG,KAAK,CAAC;oBAC/B,KAAK,CAAC,kBAAkB,GAAG,KAAK,CAAC;oBAEjC,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;wBAClC,IAAI,CAAC,CAAC,CAAC,mBAAmB,CAAC,IAAI,CAAC;4BAAE,SAAS;wBAC3C,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,KAAK,iBAAiB;4BAAE,SAAS;wBAEtD,MAAM,YAAY,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CACvC,CAAC,CAAC,EAAE,EAAE,CACJ,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC;4BACtB,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAClD,CAAC;wBAEF,IAAI,YAAY,EAAE,CAAC;4BACjB,KAAK,CAAC,gBAAgB,GAAG,IAAI,CAAC;4BAC9B,MAAM;wBACR,CAAC;oBACH,CAA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AC,CAAC;IAEjD,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QAC5B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO;QACL,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,GAAG,EAAE,MAAM,CAAC,GAAG,IAAI,IAAI;KACxB,CAAC;AACJ,CAAC,CAAC"}
@@ -1,4 +1,6 @@
1
1
  import "react";
2
+ import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
3
+ import type { WidgetHostType } from "../server/index.js";
2
4
  declare module "react" {
3
5
  interface HTMLAttributes<T> {
4
6
  "data-llm"?: string;
@@ -36,7 +38,7 @@ declare global {
36
38
  }
37
39
  }
38
40
  export type SkybridgeProperties = {
39
- host: "apps-sdk" | "ext-apps";
41
+ hostType: WidgetHostType;
40
42
  };
41
43
  export type OpenAiProperties<ToolInput extends UnknownObject = Record<never, unknown>, ToolOutput extends UnknownObject = UnknownObject, ToolResponseMetadata extends UnknownObject = UnknownObject, WidgetState extends UnknownObject = UnknownObject> = {
42
44
  theme: Theme;
@@ -45,6 +47,7 @@ export type OpenAiProperties<ToolInput extends UnknownObject = Record<never, unk
45
47
  maxHeight: number;
46
48
  displayMode: DisplayMode;
47
49
  safeArea: SafeArea;
50
+ view: View;
48
51
  toolInput: ToolInput;
49
52
  toolOutput: ToolOutput | {
50
53
  text: string;
@@ -54,15 +57,22 @@ export type OpenAiProperties<ToolInput extends UnknownObject = Record<never, unk
54
57
  };
55
58
  export type CallToolArgs = Record<string, unknown> | null;
56
59
  export type CallToolResponse = {
57
- content: {
58
- type: "text";
59
- text: string;
60
- }[];
60
+ content: CallToolResult["content"];
61
61
  structuredContent: Record<string, unknown>;
62
62
  isError: boolean;
63
63
  result: string;
64
64
  meta: Record<string, unknown>;
65
65
  };
66
+ export type RequestModalOptions = {
67
+ title?: string;
68
+ params?: Record<string, unknown>;
69
+ anchor?: {
70
+ top?: number;
71
+ left?: number;
72
+ width?: number;
73
+ height?: number;
74
+ };
75
+ };
66
76
  export type OpenAiMethods<WidgetState extends UnknownObject = UnknownObject> = {
67
77
  /** Calls a tool on your MCP. Returns the full response. */
68
78
  callTool: <ToolArgs extends CallToolArgs = null, ToolResponse extends CallToolResponse = CallToolResponse>(name: string, args: ToolArgs) => Promise<ToolResponse>;
@@ -93,9 +103,7 @@ export type OpenAiMethods<WidgetState extends UnknownObject = UnknownObject> = {
93
103
  * Opens a modal portaled outside of the widget iFrame.
94
104
  * This ensures the modal is correctly displayed and not limited to the widget's area.
95
105
  */
96
- requestModal: (args: {
97
- title: string;
98
- }) => Promise<void>;
106
+ requestModal: (args: RequestModalOptions) => Promise<void>;
99
107
  /** Uploads a new file to the host */
100
108
  uploadFile: (file: File) => Promise<FileMetadata>;
101
109
  /**
@@ -113,7 +121,11 @@ export declare class SetGlobalsEvent extends CustomEvent<{
113
121
  readonly type = "openai:set_globals";
114
122
  }
115
123
  export type CallTool = (name: string, args: Record<string, unknown>) => Promise<CallToolResponse>;
116
- export type DisplayMode = "pip" | "inline" | "fullscreen";
124
+ export type DisplayMode = "pip" | "inline" | "fullscreen" | "modal";
125
+ export type View = {
126
+ mode: DisplayMode;
127
+ params?: Record<string, unknown>;
128
+ };
117
129
  export type Theme = "light" | "dark";
118
130
  export type SafeAreaInsets = {
119
131
  top: number;
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/web/types.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,CAAC;AAuBf,MAAM,CAAC,MAAM,wBAAwB,GAAG,sBAAsB,CAAC;AAC/D,MAAM,OAAO,iBAAkB,SAAQ,WAErC;IACkB,IAAI,GAAG,wBAAwB,CAAC;CACnD;AAmGD,sDAAsD;AACtD,MAAM,CAAC,MAAM,sBAAsB,GAAG,oBAAoB,CAAC;AAC3D,MAAM,OAAO,eAAgB,SAAQ,WAEnC;IACkB,IAAI,GAAG,sBAAsB,CAAC;CACjD"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/web/types.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,CAAC;AAyBf,MAAM,CAAC,MAAM,wBAAwB,GAAG,sBAAsB,CAAC;AAC/D,MAAM,OAAO,iBAAkB,SAAQ,WAErC;IACkB,IAAI,GAAG,wBAAwB,CAAC;CACnD;AAuGD,sDAAsD;AACtD,MAAM,CAAC,MAAM,sBAAsB,GAAG,oBAAoB,CAAC;AAC3D,MAAM,OAAO,eAAgB,SAAQ,WAEnC;IACkB,IAAI,GAAG,sBAAsB,CAAC;CACjD"}
package/package.json CHANGED
@@ -1,7 +1,11 @@
1
1
  {
2
2
  "name": "skybridge",
3
- "version": "0.0.0-dev.7eec2ca",
3
+ "version": "0.0.0-dev.80bff2e",
4
4
  "description": "Skybridge is a framework for building ChatGPT apps",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/alpic-ai/skybridge.git"
8
+ },
5
9
  "type": "module",
6
10
  "files": [
7
11
  "dist"
@@ -16,18 +20,6 @@
16
20
  "default": "./dist/src/web/index.js"
17
21
  }
18
22
  },
19
- "scripts": {
20
- "build": "tsc && pnpm run build:templates",
21
- "build:templates": "cp -r src/server/templates dist/src/server/",
22
- "format": "biome check --write --error-on-warnings",
23
- "test": "pnpm run test:unit && pnpm run test:type && pnpm run test:format",
24
- "test:unit": "vitest run",
25
- "test:type": "tsc --noEmit",
26
- "test:format": "biome ci",
27
- "docs:dev": "pnpm --filter @skybridge/docs start",
28
- "docs:build": "pnpm --filter @skybridge/docs build",
29
- "docs:serve": "pnpm --filter @skybridge/docs serve"
30
- },
31
23
  "keywords": [
32
24
  "chatgpt",
33
25
  "app",
@@ -44,30 +36,39 @@
44
36
  "dependencies": {
45
37
  "@babel/core": "^7.28.5",
46
38
  "cors": "^2.8.5",
47
- "express": "^5.1.0",
39
+ "dequal": "^2.0.3",
40
+ "express": "^5.2.1",
48
41
  "handlebars": "^4.7.8",
49
42
  "superjson": "^2.2.6",
50
- "vite": "^7.1.11",
43
+ "vite": "^7.3.0",
51
44
  "zustand": "^5.0.9"
52
45
  },
53
46
  "devDependencies": {
54
- "@biomejs/biome": "2.3.8",
55
- "@modelcontextprotocol/sdk": "^1.24.3",
47
+ "@modelcontextprotocol/ext-apps": "^0.2.2",
48
+ "@modelcontextprotocol/sdk": "^1.25.1",
56
49
  "@testing-library/dom": "^10.4.1",
57
- "@testing-library/react": "^16.3.0",
50
+ "@testing-library/react": "^16.3.1",
58
51
  "@total-typescript/tsconfig": "^1.0.4",
59
52
  "@types/babel__core": "^7.20.5",
60
53
  "@types/cors": "^2.8.19",
61
- "@types/express": "^5.0.3",
62
- "@types/jsdom": "^21.1.6",
63
- "@types/node": "^22.15.30",
64
- "@types/react": "^19.2.2",
65
- "@types/react-dom": "^19.2.2",
66
- "@vitest/ui": "^2.1.8",
67
- "jsdom": "^25.0.1",
54
+ "@types/express": "^5.0.6",
55
+ "@types/jsdom": "^27.0.0",
56
+ "@types/node": "^22.19.3",
57
+ "@types/react": "^19.2.7",
58
+ "@types/react-dom": "^19.2.3",
59
+ "@vitest/ui": "^4.0.16",
60
+ "jsdom": "^27.4.0",
68
61
  "typescript": "^5.9.3",
69
- "vitest": "^2.1.8",
70
- "zod": "^4.1.13"
62
+ "vitest": "^4.0.16",
63
+ "zod": "^4.3.5"
71
64
  },
72
- "packageManager": "pnpm@10.17.1"
73
- }
65
+ "scripts": {
66
+ "build": "tsc && pnpm run build:templates",
67
+ "build:templates": "cp -r src/server/templates dist/src/server/",
68
+ "format": "biome check --write --error-on-warnings",
69
+ "test": "pnpm run test:unit && pnpm run test:type && pnpm run test:format",
70
+ "test:unit": "vitest run",
71
+ "test:type": "tsc --noEmit",
72
+ "test:format": "biome ci"
73
+ }
74
+ }
package/README.md DELETED
@@ -1,125 +0,0 @@
1
- <div align="center">
2
-
3
- <img alt="Skybridge" src="docs/static/img/github-banner.png" width="100%">
4
-
5
- <br />
6
-
7
- # Skybridge
8
-
9
- **Build ChatGPT Apps. The Modern TypeScript Way.**
10
-
11
- The fullstack TypeScript framework for ChatGPT Apps.<br />
12
- **Type-safe. React-powered. Zero config.**
13
-
14
- <br />
15
-
16
- [![NPM Version](https://img.shields.io/npm/v/skybridge?color=e90060&style=for-the-badge)](https://www.npmjs.com/package/skybridge)
17
- [![NPM Downloads](https://img.shields.io/npm/dm/skybridge?color=e90060&style=for-the-badge)](https://www.npmjs.com/package/skybridge)
18
- [![GitHub License](https://img.shields.io/github/license/alpic-ai/skybridge?color=e90060&style=for-the-badge)](https://github.com/alpic-ai/skybridge/blob/main/LICENSE)
19
-
20
- <br />
21
-
22
- [Documentation](https://skybridge.tech) · [Quick Start](https://github.com/new?template_name=apps-sdk-template&template_owner=alpic-ai) · [Examples](https://github.com/alpic-ai/apps-sdk-template)
23
-
24
- </div>
25
-
26
- <br />
27
-
28
- ## ✨ Why Skybridge?
29
-
30
- ChatGPT Apps let you embed **rich, interactive UIs** directly in conversations. But the raw SDK is low-level—no hooks, no type safety, no dev tools, and no HMR.
31
-
32
- **Skybridge fixes that.**
33
-
34
- | | |
35
- |:--|:--|
36
- | 👨‍💻 **Full Dev Environment** — HMR, debug traces, and local devtools. No more refresh loops. | ✅ **End-to-End Type Safety** — tRPC-style inference from server to widget. Autocomplete everywhere. |
37
- | 🔄 **Widget-to-Model Sync** — Keep the model aware of UI state with `data-llm`. Dual surfaces, one source of truth. | ⚒️ **React Query-style Hooks** — `isPending`, `isError`, callbacks. State management you already know. |
38
-
39
- <br />
40
-
41
- ## 🚀 Get Started
42
-
43
- **Create a new ChatGPT app:**
44
-
45
- ```bash
46
- gh repo create my-app --template alpic-ai/apps-sdk-template --clone
47
- cd my-app && pnpm install
48
- ```
49
-
50
- **Or add to an existing project:**
51
-
52
- ```bash
53
- npm i skybridge
54
- yarn add skybridge
55
- pnpm add skybridge
56
- bun add skybridge
57
- deno add skybridge
58
- ```
59
-
60
- <div align="center">
61
-
62
- **👉 [Read the Docs](https://skybridge.tech) 👈**
63
-
64
- </div>
65
-
66
- <br />
67
-
68
- ## 📦 The Stack
69
-
70
- - **`skybridge/server`** — Drop-in MCP SDK replacement with widget registration and type inference.
71
- - **`skybridge/web`** — React hooks and components for ChatGPT's runtime.
72
-
73
- ### Server
74
-
75
- ```ts
76
- import { McpServer } from "skybridge/server";
77
-
78
- server.registerWidget("flights", {}, {
79
- inputSchema: { destination: z.string() },
80
- }, async ({ destination }) => {
81
- const flights = await searchFlights(destination);
82
- return { structuredContent: { flights } };
83
- });
84
- ```
85
-
86
- ### Widget
87
-
88
- ```tsx
89
- import { useToolInfo } from "skybridge/web";
90
-
91
- function FlightsWidget() {
92
- const { output } = useToolInfo();
93
-
94
- return output.structuredContent.flights.map(f =>
95
- <FlightCard key={f.id} flight={f} />
96
- );
97
- }
98
- ```
99
-
100
- <br />
101
-
102
- ## 🎯 Features at a Glance
103
-
104
- - **Live Reload** — Vite HMR. See changes instantly without reinstalling.
105
- - **Typed Hooks** — Full autocomplete for tools, inputs, outputs.
106
- - **Widget → Tool Calls** — Trigger server actions from UI.
107
- - **Dual Surface Sync** — Keep model aware of what users see with `data-llm`.
108
- - **React Query-style API** — `isPending`, `isError`, callbacks.
109
- - **MCP Compatible** — Extends the official SDK. Works with any MCP client.
110
-
111
- <br />
112
-
113
- <div align="center">
114
-
115
- [![GitHub Discussions](https://img.shields.io/badge/Discussions-Ask%20Questions-blue?style=flat-square&logo=github)](https://github.com/alpic-ai/skybridge/discussions)
116
- [![GitHub Issues](https://img.shields.io/badge/Issues-Report%20Bugs-red?style=flat-square&logo=github)](https://github.com/alpic-ai/skybridge/issues)
117
- [![Discord](https://img.shields.io/badge/Discord-Chat-5865F2?style=flat-square&logo=discord&logoColor=white)](https://discord.com/invite/gNAazGueab)
118
-
119
- See [CONTRIBUTING.md](CONTRIBUTING.md) for setup instructions
120
-
121
- <br />
122
-
123
- **[MIT License](LICENSE)** · Made with ❤️ by **[Alpic](https://alpic.ai)**
124
-
125
- </div>
@@ -1 +0,0 @@
1
- export declare function useLocale(): string;
@@ -1,5 +0,0 @@
1
- import { useOpenAiGlobal } from "./use-openai-global.js";
2
- export function useLocale() {
3
- return useOpenAiGlobal("locale");
4
- }
5
- //# sourceMappingURL=use-locale.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-locale.js","sourceRoot":"","sources":["../../../../src/web/hooks/use-locale.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,MAAM,UAAU,SAAS;IACvB,OAAO,eAAe,CAAC,QAAQ,CAAC,CAAC;AACnC,CAAC"}
@@ -1,21 +0,0 @@
1
- import { renderHook } from "@testing-library/react";
2
- import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
3
- import { useLocale } from "./use-locale.js";
4
- describe("useLocale", () => {
5
- let OpenaiMock;
6
- beforeEach(() => {
7
- OpenaiMock = {
8
- locale: "en-US",
9
- };
10
- vi.stubGlobal("openai", OpenaiMock);
11
- });
12
- afterEach(() => {
13
- vi.unstubAllGlobals();
14
- vi.resetAllMocks();
15
- });
16
- it("should return the current locale from window.openai.locale", () => {
17
- const { result } = renderHook(() => useLocale());
18
- expect(result.current).toBe("en-US");
19
- });
20
- });
21
- //# sourceMappingURL=use-locale.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-locale.test.js","sourceRoot":"","sources":["../../../../src/web/hooks/use-locale.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;IACzB,IAAI,UAEH,CAAC;IAEF,UAAU,CAAC,GAAG,EAAE;QACd,UAAU,GAAG;YACX,MAAM,EAAE,OAAO;SAChB,CAAC;QACF,EAAE,CAAC,UAAU,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACb,EAAE,CAAC,gBAAgB,EAAE,CAAC;QACtB,EAAE,CAAC,aAAa,EAAE,CAAC;IACrB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,4DAA4D,EAAE,GAAG,EAAE;QACpE,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,SAAS,EAAE,CAAC,CAAC;QAEjD,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- export declare function useTheme(): import("../types.js").Theme;
@@ -1,5 +0,0 @@
1
- import { useOpenAiGlobal } from "./use-openai-global.js";
2
- export function useTheme() {
3
- return useOpenAiGlobal("theme");
4
- }
5
- //# sourceMappingURL=use-theme.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-theme.js","sourceRoot":"","sources":["../../../../src/web/hooks/use-theme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,MAAM,UAAU,QAAQ;IACtB,OAAO,eAAe,CAAC,OAAO,CAAC,CAAC;AAClC,CAAC"}
@@ -1,26 +0,0 @@
1
- import { renderHook } from "@testing-library/react";
2
- import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
3
- import { useTheme } from "./use-theme.js";
4
- describe("useTheme", () => {
5
- let OpenaiMock;
6
- beforeEach(() => {
7
- OpenaiMock = {
8
- theme: "light",
9
- };
10
- vi.stubGlobal("openai", OpenaiMock);
11
- });
12
- afterEach(() => {
13
- vi.unstubAllGlobals();
14
- vi.resetAllMocks();
15
- });
16
- it("should return the current theme from window.openai.theme", () => {
17
- const { result } = renderHook(() => useTheme());
18
- expect(result.current).toBe("light");
19
- });
20
- it("should return dark theme when set to dark", () => {
21
- OpenaiMock.theme = "dark";
22
- const { result } = renderHook(() => useTheme());
23
- expect(result.current).toBe("dark");
24
- });
25
- });
26
- //# sourceMappingURL=use-theme.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-theme.test.js","sourceRoot":"","sources":["../../../../src/web/hooks/use-theme.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;IACxB,IAAI,UAEH,CAAC;IAEF,UAAU,CAAC,GAAG,EAAE;QACd,UAAU,GAAG;YACX,KAAK,EAAE,OAAO;SACf,CAAC;QACF,EAAE,CAAC,UAAU,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACb,EAAE,CAAC,gBAAgB,EAAE,CAAC;QACtB,EAAE,CAAC,aAAa,EAAE,CAAC;IACrB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,0DAA0D,EAAE,GAAG,EAAE;QAClE,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC;QAEhD,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,2CAA2C,EAAE,GAAG,EAAE;QACnD,UAAU,CAAC,KAAK,GAAG,MAAM,CAAC;QAC1B,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC;QAEhD,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- export declare function useUserAgent(): import("../types.js").UserAgent;
@@ -1,5 +0,0 @@
1
- import { useOpenAiGlobal } from "./use-openai-global.js";
2
- export function useUserAgent() {
3
- return useOpenAiGlobal("userAgent");
4
- }
5
- //# sourceMappingURL=use-user-agent.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-user-agent.js","sourceRoot":"","sources":["../../../../src/web/hooks/use-user-agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,MAAM,UAAU,YAAY;IAC1B,OAAO,eAAe,CAAC,WAAW,CAAC,CAAC;AACtC,CAAC"}
@@ -1,31 +0,0 @@
1
- import { renderHook } from "@testing-library/react";
2
- import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
3
- import { useUserAgent } from "./use-user-agent.js";
4
- describe("useUserAgent", () => {
5
- let OpenaiMock;
6
- beforeEach(() => {
7
- OpenaiMock = {
8
- userAgent: {
9
- device: { type: "mobile" },
10
- capabilities: { hover: false, touch: true },
11
- },
12
- };
13
- vi.stubGlobal("openai", OpenaiMock);
14
- });
15
- afterEach(() => {
16
- vi.unstubAllGlobals();
17
- vi.resetAllMocks();
18
- });
19
- it("should return the current user agent from window.openai.userAgent", () => {
20
- OpenaiMock.userAgent = {
21
- device: { type: "mobile" },
22
- capabilities: { hover: false, touch: true },
23
- };
24
- const { result } = renderHook(() => useUserAgent());
25
- expect(result.current).toEqual({
26
- device: { type: "mobile" },
27
- capabilities: { hover: false, touch: true },
28
- });
29
- });
30
- });
31
- //# sourceMappingURL=use-user-agent.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-user-agent.test.js","sourceRoot":"","sources":["../../../../src/web/hooks/use-user-agent.test.ts"],"names":[],"mappings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