skybridge 0.0.0-dev.fc2f516 → 0.0.0-dev.fd05cd0

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