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.
- package/dist/src/server/devtoolsStaticServer.d.ts +15 -0
- package/dist/src/server/devtoolsStaticServer.js +38 -0
- package/dist/src/server/devtoolsStaticServer.js.map +1 -0
- package/dist/src/server/index.d.ts +3 -2
- package/dist/src/server/index.js +1 -0
- package/dist/src/server/index.js.map +1 -1
- package/dist/src/server/inferUtilityTypes.d.ts +10 -0
- package/dist/src/server/server.d.ts +43 -17
- package/dist/src/server/server.js +54 -34
- package/dist/src/server/server.js.map +1 -1
- package/dist/src/server/templateHelper.d.ts +3 -0
- package/dist/src/server/templateHelper.js +5 -4
- package/dist/src/server/templateHelper.js.map +1 -1
- package/dist/src/server/templates/development.hbs +3 -2
- package/dist/src/server/templates/production.hbs +1 -0
- package/dist/src/server/widgetsDevServer.js +3 -3
- package/dist/src/server/widgetsDevServer.js.map +1 -1
- package/dist/src/test/utils.d.ts +54 -8
- package/dist/src/test/utils.js +86 -8
- package/dist/src/test/utils.js.map +1 -1
- package/dist/src/test/widget.test.js +83 -27
- package/dist/src/test/widget.test.js.map +1 -1
- package/dist/src/web/bridges/adaptors/apps-sdk-adaptor.d.ts +12 -0
- package/dist/src/web/bridges/adaptors/apps-sdk-adaptor.js +30 -0
- package/dist/src/web/bridges/adaptors/apps-sdk-adaptor.js.map +1 -0
- package/dist/src/web/bridges/adaptors/mcp-app-adaptor.d.ts +15 -0
- package/dist/src/web/bridges/adaptors/mcp-app-adaptor.js +108 -0
- package/dist/src/web/bridges/adaptors/mcp-app-adaptor.js.map +1 -0
- package/dist/src/web/bridges/apps-sdk-bridge.d.ts +10 -0
- package/dist/src/web/bridges/apps-sdk-bridge.js +46 -0
- package/dist/src/web/bridges/apps-sdk-bridge.js.map +1 -0
- package/dist/src/web/bridges/hooks/use-adaptor.d.ts +2 -0
- package/dist/src/web/bridges/hooks/use-adaptor.js +8 -0
- package/dist/src/web/bridges/hooks/use-adaptor.js.map +1 -0
- package/dist/src/web/bridges/hooks/use-apps-sdk-bridge.d.ts +2 -0
- package/dist/src/web/bridges/hooks/use-apps-sdk-bridge.js +7 -0
- package/dist/src/web/bridges/hooks/use-apps-sdk-bridge.js.map +1 -0
- package/dist/src/web/bridges/hooks/use-bridge.d.ts +2 -0
- package/dist/src/web/bridges/hooks/use-bridge.js +8 -0
- package/dist/src/web/bridges/hooks/use-bridge.js.map +1 -0
- package/dist/src/web/bridges/hooks/use-mcp-app-bridge.d.ts +5 -0
- package/dist/src/web/bridges/hooks/use-mcp-app-bridge.js +7 -0
- package/dist/src/web/bridges/hooks/use-mcp-app-bridge.js.map +1 -0
- package/dist/src/web/bridges/hooks/use-mcp-app-bridge.test.js +41 -0
- package/dist/src/web/bridges/hooks/use-mcp-app-bridge.test.js.map +1 -0
- package/dist/src/web/bridges/index.d.ts +4 -0
- package/dist/src/web/bridges/index.js +5 -0
- package/dist/src/web/bridges/index.js.map +1 -0
- package/dist/src/web/bridges/mcp-app-bridge.d.ts +38 -0
- package/dist/src/web/bridges/mcp-app-bridge.js +162 -0
- package/dist/src/web/bridges/mcp-app-bridge.js.map +1 -0
- package/dist/src/web/bridges/types.d.ts +56 -0
- package/dist/src/web/bridges/types.js +2 -0
- package/dist/src/web/bridges/types.js.map +1 -0
- package/dist/src/web/create-store.js +2 -18
- package/dist/src/web/create-store.js.map +1 -1
- package/dist/src/web/create-store.test.js +70 -0
- package/dist/src/web/create-store.test.js.map +1 -0
- package/dist/src/web/data-llm.js +6 -4
- package/dist/src/web/data-llm.js.map +1 -1
- package/dist/src/web/data-llm.test.js.map +1 -1
- package/dist/src/web/generate-helpers.d.ts +9 -7
- package/dist/src/web/generate-helpers.js +4 -2
- package/dist/src/web/generate-helpers.js.map +1 -1
- package/dist/src/web/generate-helpers.test-d.js +59 -3
- package/dist/src/web/generate-helpers.test-d.js.map +1 -1
- package/dist/src/web/generate-helpers.test.js +1 -1
- package/dist/src/web/generate-helpers.test.js.map +1 -1
- package/dist/src/web/helpers/state.d.ts +3 -1
- package/dist/src/web/helpers/state.js +7 -4
- package/dist/src/web/helpers/state.js.map +1 -1
- package/dist/src/web/helpers/state.test.js +53 -0
- package/dist/src/web/helpers/state.test.js.map +1 -0
- package/dist/src/web/hooks/index.d.ts +4 -5
- package/dist/src/web/hooks/index.js +3 -4
- package/dist/src/web/hooks/index.js.map +1 -1
- package/dist/src/web/hooks/test/utils.d.ts +10 -0
- package/dist/src/web/hooks/test/utils.js +40 -0
- package/dist/src/web/hooks/test/utils.js.map +1 -0
- package/dist/src/web/hooks/use-call-tool.d.ts +1 -1
- package/dist/src/web/hooks/use-call-tool.js +12 -4
- package/dist/src/web/hooks/use-call-tool.js.map +1 -1
- package/dist/src/web/hooks/use-call-tool.test-d.js +1 -1
- package/dist/src/web/hooks/use-call-tool.test-d.js.map +1 -1
- package/dist/src/web/hooks/use-call-tool.test.js +35 -15
- package/dist/src/web/hooks/use-call-tool.test.js.map +1 -1
- package/dist/src/web/hooks/use-display-mode.d.ts +1 -1
- package/dist/src/web/hooks/use-display-mode.js +6 -3
- package/dist/src/web/hooks/use-display-mode.js.map +1 -1
- package/dist/src/web/hooks/use-display-mode.test.js +3 -2
- package/dist/src/web/hooks/use-display-mode.test.js.map +1 -1
- package/dist/src/web/hooks/use-files.test.js +1 -1
- package/dist/src/web/hooks/use-files.test.js.map +1 -1
- package/dist/src/web/hooks/use-layout.d.ts +22 -0
- package/dist/src/web/hooks/use-layout.js +23 -0
- package/dist/src/web/hooks/use-layout.js.map +1 -0
- package/dist/src/web/hooks/use-layout.test.d.ts +1 -0
- package/dist/src/web/hooks/use-layout.test.js +95 -0
- package/dist/src/web/hooks/use-layout.test.js.map +1 -0
- package/dist/src/web/hooks/use-open-external.test.js +2 -2
- package/dist/src/web/hooks/use-open-external.test.js.map +1 -1
- package/dist/src/web/hooks/use-openai-global.d.ts +3 -2
- package/dist/src/web/hooks/use-openai-global.js +3 -20
- package/dist/src/web/hooks/use-openai-global.js.map +1 -1
- package/dist/src/web/hooks/use-request-modal.d.ts +6 -3
- package/dist/src/web/hooks/use-request-modal.js +6 -1
- package/dist/src/web/hooks/use-request-modal.js.map +1 -1
- package/dist/src/web/hooks/use-request-modal.test.js +37 -4
- package/dist/src/web/hooks/use-request-modal.test.js.map +1 -1
- package/dist/src/web/hooks/use-send-follow-up-message.js +3 -6
- package/dist/src/web/hooks/use-send-follow-up-message.js.map +1 -1
- package/dist/src/web/hooks/use-tool-info.d.ts +13 -2
- package/dist/src/web/hooks/use-tool-info.js +15 -11
- package/dist/src/web/hooks/use-tool-info.js.map +1 -1
- package/dist/src/web/hooks/use-tool-info.test-d.js +40 -5
- package/dist/src/web/hooks/use-tool-info.test-d.js.map +1 -1
- package/dist/src/web/hooks/use-tool-info.test.js +119 -48
- package/dist/src/web/hooks/use-tool-info.test.js.map +1 -1
- package/dist/src/web/hooks/use-user.d.ts +18 -0
- package/dist/src/web/hooks/use-user.js +19 -0
- package/dist/src/web/hooks/use-user.js.map +1 -0
- package/dist/src/web/hooks/use-user.test.d.ts +1 -0
- package/dist/src/web/hooks/use-user.test.js +93 -0
- package/dist/src/web/hooks/use-user.test.js.map +1 -0
- package/dist/src/web/hooks/use-widget-state.js +3 -3
- package/dist/src/web/hooks/use-widget-state.js.map +1 -1
- package/dist/src/web/hooks/use-widget-state.test.js +3 -2
- package/dist/src/web/hooks/use-widget-state.test.js.map +1 -1
- package/dist/src/web/index.d.ts +5 -4
- package/dist/src/web/index.js +5 -4
- package/dist/src/web/index.js.map +1 -1
- package/dist/src/web/plugin/plugin.js +10 -4
- package/dist/src/web/plugin/plugin.js.map +1 -1
- package/dist/src/web/plugin/transform-data-llm.js +6 -3
- package/dist/src/web/plugin/transform-data-llm.js.map +1 -1
- package/dist/src/web/proxy.js +6 -1
- package/dist/src/web/proxy.js.map +1 -1
- package/dist/src/web/types.d.ts +30 -14
- package/dist/src/web/types.js.map +1 -1
- package/package.json +15 -8
- package/LICENSE +0 -674
- package/README.md +0 -415
- package/dist/src/web/hooks/use-locale.d.ts +0 -1
- package/dist/src/web/hooks/use-locale.js +0 -5
- package/dist/src/web/hooks/use-locale.js.map +0 -1
- package/dist/src/web/hooks/use-locale.test.js +0 -21
- package/dist/src/web/hooks/use-locale.test.js.map +0 -1
- package/dist/src/web/hooks/use-theme.d.ts +0 -1
- package/dist/src/web/hooks/use-theme.js +0 -5
- package/dist/src/web/hooks/use-theme.js.map +0 -1
- package/dist/src/web/hooks/use-theme.test.js +0 -26
- package/dist/src/web/hooks/use-theme.test.js.map +0 -1
- package/dist/src/web/hooks/use-user-agent.d.ts +0 -1
- package/dist/src/web/hooks/use-user-agent.js +0 -5
- package/dist/src/web/hooks/use-user-agent.js.map +0 -1
- package/dist/src/web/hooks/use-user-agent.test.js +0 -31
- package/dist/src/web/hooks/use-user-agent.test.js.map +0 -1
- /package/dist/src/web/{hooks/use-locale.test.d.ts → bridges/hooks/use-mcp-app-bridge.test.d.ts} +0 -0
- /package/dist/src/web/{hooks/use-theme.test.d.ts → create-store.test.d.ts} +0 -0
- /package/dist/src/web/{hooks/use-user-agent.test.d.ts → helpers/state.test.d.ts} +0 -0
package/dist/src/web/types.d.ts
CHANGED
|
@@ -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
|
|
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]-?:
|
|
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
|
-
|
|
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
|
|
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
|
|
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<
|
|
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;
|
|
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.
|
|
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
|
-
"
|
|
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
|
-
"
|
|
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
|
}
|