skybridge 0.0.0-dev.fe84ef2 → 0.0.0-dev.ff23e30

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 (160) hide show
  1. package/dist/src/server/devtoolsStaticServer.d.ts +15 -0
  2. package/dist/src/server/devtoolsStaticServer.js +38 -0
  3. package/dist/src/server/devtoolsStaticServer.js.map +1 -0
  4. package/dist/src/server/index.d.ts +3 -2
  5. package/dist/src/server/index.js +1 -0
  6. package/dist/src/server/index.js.map +1 -1
  7. package/dist/src/server/inferUtilityTypes.d.ts +10 -0
  8. package/dist/src/server/server.d.ts +43 -17
  9. package/dist/src/server/server.js +54 -34
  10. package/dist/src/server/server.js.map +1 -1
  11. package/dist/src/server/templateHelper.d.ts +3 -0
  12. package/dist/src/server/templateHelper.js +5 -4
  13. package/dist/src/server/templateHelper.js.map +1 -1
  14. package/dist/src/server/templates/development.hbs +3 -2
  15. package/dist/src/server/templates/production.hbs +1 -0
  16. package/dist/src/server/widgetsDevServer.js +3 -3
  17. package/dist/src/server/widgetsDevServer.js.map +1 -1
  18. package/dist/src/test/utils.d.ts +54 -8
  19. package/dist/src/test/utils.js +86 -8
  20. package/dist/src/test/utils.js.map +1 -1
  21. package/dist/src/test/widget.test.js +83 -27
  22. package/dist/src/test/widget.test.js.map +1 -1
  23. package/dist/src/web/bridges/adaptors/apps-sdk-adaptor.d.ts +12 -0
  24. package/dist/src/web/bridges/adaptors/apps-sdk-adaptor.js +30 -0
  25. package/dist/src/web/bridges/adaptors/apps-sdk-adaptor.js.map +1 -0
  26. package/dist/src/web/bridges/adaptors/mcp-app-adaptor.d.ts +15 -0
  27. package/dist/src/web/bridges/adaptors/mcp-app-adaptor.js +108 -0
  28. package/dist/src/web/bridges/adaptors/mcp-app-adaptor.js.map +1 -0
  29. package/dist/src/web/bridges/apps-sdk-bridge.d.ts +10 -0
  30. package/dist/src/web/bridges/apps-sdk-bridge.js +46 -0
  31. package/dist/src/web/bridges/apps-sdk-bridge.js.map +1 -0
  32. package/dist/src/web/bridges/hooks/use-adaptor.d.ts +2 -0
  33. package/dist/src/web/bridges/hooks/use-adaptor.js +8 -0
  34. package/dist/src/web/bridges/hooks/use-adaptor.js.map +1 -0
  35. package/dist/src/web/bridges/hooks/use-apps-sdk-bridge.d.ts +2 -0
  36. package/dist/src/web/bridges/hooks/use-apps-sdk-bridge.js +7 -0
  37. package/dist/src/web/bridges/hooks/use-apps-sdk-bridge.js.map +1 -0
  38. package/dist/src/web/bridges/hooks/use-bridge.d.ts +2 -0
  39. package/dist/src/web/bridges/hooks/use-bridge.js +8 -0
  40. package/dist/src/web/bridges/hooks/use-bridge.js.map +1 -0
  41. package/dist/src/web/bridges/hooks/use-mcp-app-bridge.d.ts +5 -0
  42. package/dist/src/web/bridges/hooks/use-mcp-app-bridge.js +7 -0
  43. package/dist/src/web/bridges/hooks/use-mcp-app-bridge.js.map +1 -0
  44. package/dist/src/web/bridges/hooks/use-mcp-app-bridge.test.js +41 -0
  45. package/dist/src/web/bridges/hooks/use-mcp-app-bridge.test.js.map +1 -0
  46. package/dist/src/web/bridges/index.d.ts +4 -0
  47. package/dist/src/web/bridges/index.js +5 -0
  48. package/dist/src/web/bridges/index.js.map +1 -0
  49. package/dist/src/web/bridges/mcp-app-bridge.d.ts +38 -0
  50. package/dist/src/web/bridges/mcp-app-bridge.js +162 -0
  51. package/dist/src/web/bridges/mcp-app-bridge.js.map +1 -0
  52. package/dist/src/web/bridges/types.d.ts +56 -0
  53. package/dist/src/web/bridges/types.js +2 -0
  54. package/dist/src/web/bridges/types.js.map +1 -0
  55. package/dist/src/web/create-store.js +2 -18
  56. package/dist/src/web/create-store.js.map +1 -1
  57. package/dist/src/web/create-store.test.js +70 -0
  58. package/dist/src/web/create-store.test.js.map +1 -0
  59. package/dist/src/web/data-llm.js +6 -4
  60. package/dist/src/web/data-llm.js.map +1 -1
  61. package/dist/src/web/data-llm.test.js.map +1 -1
  62. package/dist/src/web/generate-helpers.d.ts +9 -7
  63. package/dist/src/web/generate-helpers.js +4 -2
  64. package/dist/src/web/generate-helpers.js.map +1 -1
  65. package/dist/src/web/generate-helpers.test-d.js +59 -3
  66. package/dist/src/web/generate-helpers.test-d.js.map +1 -1
  67. package/dist/src/web/generate-helpers.test.js +1 -1
  68. package/dist/src/web/generate-helpers.test.js.map +1 -1
  69. package/dist/src/web/helpers/state.d.ts +3 -1
  70. package/dist/src/web/helpers/state.js +7 -4
  71. package/dist/src/web/helpers/state.js.map +1 -1
  72. package/dist/src/web/helpers/state.test.js +53 -0
  73. package/dist/src/web/helpers/state.test.js.map +1 -0
  74. package/dist/src/web/hooks/index.d.ts +4 -5
  75. package/dist/src/web/hooks/index.js +3 -4
  76. package/dist/src/web/hooks/index.js.map +1 -1
  77. package/dist/src/web/hooks/test/utils.d.ts +10 -0
  78. package/dist/src/web/hooks/test/utils.js +40 -0
  79. package/dist/src/web/hooks/test/utils.js.map +1 -0
  80. package/dist/src/web/hooks/use-call-tool.d.ts +1 -1
  81. package/dist/src/web/hooks/use-call-tool.js +12 -4
  82. package/dist/src/web/hooks/use-call-tool.js.map +1 -1
  83. package/dist/src/web/hooks/use-call-tool.test-d.js +1 -1
  84. package/dist/src/web/hooks/use-call-tool.test-d.js.map +1 -1
  85. package/dist/src/web/hooks/use-call-tool.test.js +35 -15
  86. package/dist/src/web/hooks/use-call-tool.test.js.map +1 -1
  87. package/dist/src/web/hooks/use-display-mode.d.ts +1 -1
  88. package/dist/src/web/hooks/use-display-mode.js +6 -3
  89. package/dist/src/web/hooks/use-display-mode.js.map +1 -1
  90. package/dist/src/web/hooks/use-display-mode.test.js +3 -2
  91. package/dist/src/web/hooks/use-display-mode.test.js.map +1 -1
  92. package/dist/src/web/hooks/use-files.test.js +1 -1
  93. package/dist/src/web/hooks/use-files.test.js.map +1 -1
  94. package/dist/src/web/hooks/use-layout.d.ts +22 -0
  95. package/dist/src/web/hooks/use-layout.js +23 -0
  96. package/dist/src/web/hooks/use-layout.js.map +1 -0
  97. package/dist/src/web/hooks/use-layout.test.d.ts +1 -0
  98. package/dist/src/web/hooks/use-layout.test.js +95 -0
  99. package/dist/src/web/hooks/use-layout.test.js.map +1 -0
  100. package/dist/src/web/hooks/use-open-external.test.js +2 -2
  101. package/dist/src/web/hooks/use-open-external.test.js.map +1 -1
  102. package/dist/src/web/hooks/use-openai-global.d.ts +3 -2
  103. package/dist/src/web/hooks/use-openai-global.js +3 -20
  104. package/dist/src/web/hooks/use-openai-global.js.map +1 -1
  105. package/dist/src/web/hooks/use-request-modal.d.ts +6 -3
  106. package/dist/src/web/hooks/use-request-modal.js +6 -1
  107. package/dist/src/web/hooks/use-request-modal.js.map +1 -1
  108. package/dist/src/web/hooks/use-request-modal.test.js +37 -4
  109. package/dist/src/web/hooks/use-request-modal.test.js.map +1 -1
  110. package/dist/src/web/hooks/use-send-follow-up-message.js +3 -6
  111. package/dist/src/web/hooks/use-send-follow-up-message.js.map +1 -1
  112. package/dist/src/web/hooks/use-tool-info.d.ts +13 -2
  113. package/dist/src/web/hooks/use-tool-info.js +15 -11
  114. package/dist/src/web/hooks/use-tool-info.js.map +1 -1
  115. package/dist/src/web/hooks/use-tool-info.test-d.js +40 -5
  116. package/dist/src/web/hooks/use-tool-info.test-d.js.map +1 -1
  117. package/dist/src/web/hooks/use-tool-info.test.js +119 -48
  118. package/dist/src/web/hooks/use-tool-info.test.js.map +1 -1
  119. package/dist/src/web/hooks/use-user.d.ts +18 -0
  120. package/dist/src/web/hooks/use-user.js +19 -0
  121. package/dist/src/web/hooks/use-user.js.map +1 -0
  122. package/dist/src/web/hooks/use-user.test.d.ts +1 -0
  123. package/dist/src/web/hooks/use-user.test.js +93 -0
  124. package/dist/src/web/hooks/use-user.test.js.map +1 -0
  125. package/dist/src/web/hooks/use-widget-state.js +3 -3
  126. package/dist/src/web/hooks/use-widget-state.js.map +1 -1
  127. package/dist/src/web/hooks/use-widget-state.test.js +3 -2
  128. package/dist/src/web/hooks/use-widget-state.test.js.map +1 -1
  129. package/dist/src/web/index.d.ts +5 -4
  130. package/dist/src/web/index.js +5 -4
  131. package/dist/src/web/index.js.map +1 -1
  132. package/dist/src/web/plugin/plugin.js +10 -4
  133. package/dist/src/web/plugin/plugin.js.map +1 -1
  134. package/dist/src/web/plugin/transform-data-llm.js +6 -3
  135. package/dist/src/web/plugin/transform-data-llm.js.map +1 -1
  136. package/dist/src/web/proxy.js +6 -1
  137. package/dist/src/web/proxy.js.map +1 -1
  138. package/dist/src/web/types.d.ts +30 -14
  139. package/dist/src/web/types.js.map +1 -1
  140. package/package.json +15 -8
  141. package/LICENSE +0 -674
  142. package/README.md +0 -415
  143. package/dist/src/web/hooks/use-locale.d.ts +0 -1
  144. package/dist/src/web/hooks/use-locale.js +0 -5
  145. package/dist/src/web/hooks/use-locale.js.map +0 -1
  146. package/dist/src/web/hooks/use-locale.test.js +0 -21
  147. package/dist/src/web/hooks/use-locale.test.js.map +0 -1
  148. package/dist/src/web/hooks/use-theme.d.ts +0 -1
  149. package/dist/src/web/hooks/use-theme.js +0 -5
  150. package/dist/src/web/hooks/use-theme.js.map +0 -1
  151. package/dist/src/web/hooks/use-theme.test.js +0 -26
  152. package/dist/src/web/hooks/use-theme.test.js.map +0 -1
  153. package/dist/src/web/hooks/use-user-agent.d.ts +0 -1
  154. package/dist/src/web/hooks/use-user-agent.js +0 -5
  155. package/dist/src/web/hooks/use-user-agent.js.map +0 -1
  156. package/dist/src/web/hooks/use-user-agent.test.js +0 -31
  157. package/dist/src/web/hooks/use-user-agent.test.js.map +0 -1
  158. /package/dist/src/web/{hooks/use-locale.test.d.ts → bridges/hooks/use-mcp-app-bridge.test.d.ts} +0 -0
  159. /package/dist/src/web/{hooks/use-theme.test.d.ts → create-store.test.d.ts} +0 -0
  160. /package/dist/src/web/{hooks/use-user-agent.test.d.ts → helpers/state.test.d.ts} +0 -0
@@ -1,6 +1,8 @@
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
- interface HTMLAttributes<T extends Element = HTMLElement> {
5
+ interface HTMLAttributes<T> {
4
6
  "data-llm"?: string;
5
7
  }
6
8
  }
@@ -10,7 +12,7 @@ export type Prettify<T> = {
10
12
  } & {};
11
13
  export type Objectify<T> = T & UnknownObject;
12
14
  type RequiredKeys<T> = {
13
- [K in keyof T]-?: {} extends Pick<T, K> ? never : K;
15
+ [K in keyof T]-?: Record<string, never> extends Pick<T, K> ? never : K;
14
16
  }[keyof T];
15
17
  export type HasRequiredKeys<T> = RequiredKeys<T> extends never ? false : true;
16
18
  type WidgetState = UnknownObject;
@@ -28,19 +30,24 @@ export declare class ToolResponseEvent extends CustomEvent<{
28
30
  }
29
31
  declare global {
30
32
  interface Window {
31
- openai: API<WidgetState> & OpenAiGlobals;
33
+ skybridge: SkybridgeProperties;
34
+ openai: OpenAiMethods<WidgetState> & OpenAiProperties;
32
35
  }
33
36
  interface WindowEventMap {
34
37
  [SET_GLOBALS_EVENT_TYPE]: SetGlobalsEvent;
35
38
  }
36
39
  }
37
- export type OpenAiGlobals<ToolInput extends UnknownObject = {}, ToolOutput extends UnknownObject = UnknownObject, ToolResponseMetadata extends UnknownObject = UnknownObject, WidgetState extends UnknownObject = UnknownObject> = {
40
+ export type SkybridgeProperties = {
41
+ hostType: WidgetHostType;
42
+ };
43
+ export type OpenAiProperties<ToolInput extends UnknownObject = Record<never, unknown>, ToolOutput extends UnknownObject = UnknownObject, ToolResponseMetadata extends UnknownObject = UnknownObject, WidgetState extends UnknownObject = UnknownObject> = {
38
44
  theme: Theme;
39
45
  userAgent: UserAgent;
40
46
  locale: string;
41
47
  maxHeight: number;
42
48
  displayMode: DisplayMode;
43
49
  safeArea: SafeArea;
50
+ view: View;
44
51
  toolInput: ToolInput;
45
52
  toolOutput: ToolOutput | {
46
53
  text: string;
@@ -50,16 +57,23 @@ export type OpenAiGlobals<ToolInput extends UnknownObject = {}, ToolOutput exten
50
57
  };
51
58
  export type CallToolArgs = Record<string, unknown> | null;
52
59
  export type CallToolResponse = {
53
- content: {
54
- type: "text";
55
- text: string;
56
- }[];
60
+ content: CallToolResult["content"];
57
61
  structuredContent: Record<string, unknown>;
58
62
  isError: boolean;
59
63
  result: string;
60
64
  meta: Record<string, unknown>;
61
65
  };
62
- type API<WidgetState extends UnknownObject> = {
66
+ export type RequestModalOptions = {
67
+ title?: string;
68
+ params?: Record<string, unknown>;
69
+ anchor?: {
70
+ top?: number;
71
+ left?: number;
72
+ width?: number;
73
+ height?: number;
74
+ };
75
+ };
76
+ export type OpenAiMethods<WidgetState extends UnknownObject = UnknownObject> = {
63
77
  /** Calls a tool on your MCP. Returns the full response. */
64
78
  callTool: <ToolArgs extends CallToolArgs = null, ToolResponse extends CallToolResponse = CallToolResponse>(name: string, args: ToolArgs) => Promise<ToolResponse>;
65
79
  /** Triggers a followup turn in the ChatGPT conversation */
@@ -89,9 +103,7 @@ type API<WidgetState extends UnknownObject> = {
89
103
  * Opens a modal portaled outside of the widget iFrame.
90
104
  * This ensures the modal is correctly displayed and not limited to the widget's area.
91
105
  */
92
- requestModal: (args: {
93
- title: string;
94
- }) => Promise<void>;
106
+ requestModal: (args: RequestModalOptions) => Promise<void>;
95
107
  /** Uploads a new file to the host */
96
108
  uploadFile: (file: File) => Promise<FileMetadata>;
97
109
  /**
@@ -104,12 +116,16 @@ type API<WidgetState extends UnknownObject> = {
104
116
  };
105
117
  export declare const SET_GLOBALS_EVENT_TYPE = "openai:set_globals";
106
118
  export declare class SetGlobalsEvent extends CustomEvent<{
107
- globals: Partial<OpenAiGlobals>;
119
+ globals: Partial<OpenAiProperties>;
108
120
  }> {
109
121
  readonly type = "openai:set_globals";
110
122
  }
111
123
  export type CallTool = (name: string, args: Record<string, unknown>) => Promise<CallToolResponse>;
112
- 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
+ };
113
129
  export type Theme = "light" | "dark";
114
130
  export type SafeAreaInsets = {
115
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;AA8FD,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.fe84ef2",
3
+ "version": "0.0.0-dev.ff23e30",
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"
@@ -19,12 +23,11 @@
19
23
  "scripts": {
20
24
  "build": "tsc && pnpm run build:templates",
21
25
  "build:templates": "cp -r src/server/templates dist/src/server/",
22
- "test": "pnpm run test:unit && pnpm run test:type",
26
+ "format": "biome check --write --error-on-warnings",
27
+ "test": "pnpm run test:unit && pnpm run test:type && pnpm run test:format",
23
28
  "test:unit": "vitest run",
24
29
  "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"
30
+ "test:format": "biome ci"
28
31
  },
29
32
  "keywords": [
30
33
  "chatgpt",
@@ -35,21 +38,24 @@
35
38
  "author": "Frédéric Barthelet",
36
39
  "license": "ISC",
37
40
  "peerDependencies": {
41
+ "@modelcontextprotocol/sdk": ">=1.0.0",
38
42
  "react": ">=18.0.0",
39
43
  "react-dom": ">=18.0.0"
40
44
  },
41
45
  "dependencies": {
42
46
  "@babel/core": "^7.28.5",
43
- "@modelcontextprotocol/sdk": "^1.20.0",
44
47
  "cors": "^2.8.5",
48
+ "dequal": "^2.0.3",
45
49
  "express": "^5.1.0",
46
50
  "handlebars": "^4.7.8",
47
51
  "superjson": "^2.2.6",
48
52
  "vite": "^7.1.11",
49
- "zod": "^3.25.51",
50
53
  "zustand": "^5.0.9"
51
54
  },
52
55
  "devDependencies": {
56
+ "@biomejs/biome": "2.3.8",
57
+ "@modelcontextprotocol/ext-apps": "^0.2.2",
58
+ "@modelcontextprotocol/sdk": "^1.24.3",
53
59
  "@testing-library/dom": "^10.4.1",
54
60
  "@testing-library/react": "^16.3.0",
55
61
  "@total-typescript/tsconfig": "^1.0.4",
@@ -63,7 +69,8 @@
63
69
  "@vitest/ui": "^2.1.8",
64
70
  "jsdom": "^25.0.1",
65
71
  "typescript": "^5.9.3",
66
- "vitest": "^2.1.8"
72
+ "vitest": "^2.1.8",
73
+ "zod": "^4.1.13"
67
74
  },
68
75
  "packageManager": "pnpm@10.17.1"
69
76
  }