skybridge 0.0.0-dev.e41a369 → 0.0.0-dev.e55cd21
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 +19 -0
- package/dist/src/server/devtoolsStaticServer.js +48 -0
- package/dist/src/server/devtoolsStaticServer.js.map +1 -0
- package/dist/src/server/index.d.ts +2 -2
- package/dist/src/server/index.js +1 -1
- package/dist/src/server/server.d.ts +23 -11
- package/dist/src/server/server.js +51 -31
- package/dist/src/server/server.js.map +1 -1
- package/dist/src/server/templateHelper.d.ts +3 -0
- package/dist/src/server/templateHelper.js +3 -2
- package/dist/src/server/templateHelper.js.map +1 -1
- package/dist/src/server/templates/development.hbs +42 -3
- package/dist/src/server/templates/production.hbs +1 -0
- package/dist/src/server/widgetsDevServer.js +0 -1
- package/dist/src/server/widgetsDevServer.js.map +1 -1
- package/dist/src/test/utils.d.ts +13 -2
- package/dist/src/test/utils.js +20 -0
- package/dist/src/test/utils.js.map +1 -1
- package/dist/src/test/widget.test.js +70 -13
- package/dist/src/test/widget.test.js.map +1 -1
- package/dist/src/web/bridges/adaptors/apps-sdk-adaptor.d.ts +13 -0
- package/dist/src/web/bridges/adaptors/apps-sdk-adaptor.js +33 -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 +16 -0
- package/dist/src/web/bridges/adaptors/mcp-app-adaptor.js +115 -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 +57 -0
- package/dist/src/web/bridges/types.js +2 -0
- package/dist/src/web/bridges/types.js.map +1 -0
- package/dist/src/web/data-llm.js +4 -2
- 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.test-d.js +31 -2
- package/dist/src/web/generate-helpers.test-d.js.map +1 -1
- package/dist/src/web/hooks/index.d.ts +2 -3
- package/dist/src/web/hooks/index.js +2 -3
- 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.js +34 -14
- 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 +1 -0
- package/dist/src/web/hooks/use-display-mode.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.js +95 -0
- package/dist/src/web/hooks/use-layout.test.js.map +1 -0
- package/dist/src/web/hooks/use-open-external.js +5 -3
- package/dist/src/web/hooks/use-open-external.js.map +1 -1
- package/dist/src/web/hooks/use-open-external.test.js +41 -15
- 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 +35 -2
- 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 -4
- package/dist/src/web/hooks/use-tool-info.test-d.js.map +1 -1
- package/dist/src/web/hooks/use-tool-info.test.js +117 -46
- 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.js +93 -0
- package/dist/src/web/hooks/use-user.test.js.map +1 -0
- package/dist/src/web/hooks/use-widget-state.js +2 -2
- package/dist/src/web/hooks/use-widget-state.js.map +1 -1
- package/dist/src/web/hooks/use-widget-state.test.js +1 -0
- package/dist/src/web/hooks/use-widget-state.test.js.map +1 -1
- package/dist/src/web/index.d.ts +1 -0
- package/dist/src/web/index.js +1 -0
- 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 +5 -0
- package/dist/src/web/proxy.js.map +1 -1
- package/dist/src/web/types.d.ts +26 -10
- package/dist/src/web/types.js.map +1 -1
- package/package.json +20 -19
- package/README.md +0 -123
- package/dist/src/server/emulatorStaticServer.d.ts +0 -15
- package/dist/src/server/emulatorStaticServer.js +0 -38
- package/dist/src/server/emulatorStaticServer.js.map +0 -1
- 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 → use-layout.test.d.ts} +0 -0
- /package/dist/src/web/hooks/{use-user-agent.test.d.ts → use-user.test.d.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proxy.js","sourceRoot":"","sources":["../../../src/web/proxy.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,GAAG;IACb,KAAK,EAAE,SAAS;IAChB,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,SAAS;CACR,CAAC;AAEX,MAAM,UAAU,yBAAyB;IACvC,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;QACpD,OAAO,CAAC,IAAI,CACV,qEAAqE,CACtE,CAAC;QACF,OAAO;IACT,CAAC;IAED,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC;IAErC,MAAM,OAAO,GAAwC;QACnD,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ;YACxB,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;YAElD,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE,CAAC;gBAChC,OAAO,KAAK,CAAC;YACf,CAAC;YAED,OAAO,CAAC,GAAG,IAAe,EAAE,EAAE;gBAC5B,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;gBAEhC,OAAO,CAAC,KAAK,CACX,yBAAyB,UAAU,EAAE,EACrC,UAAU,MAAM,CAAC,KAAK,uBAAuB,EAC7C,UAAU,MAAM,CAAC,IAAI,uBAAuB,EAC5C,UAAU,MAAM,CAAC,OAAO,EAAE,CAC3B,CAAC;gBACF,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,UAAU,MAAM,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AAU,MAAM,CAAC,KAAK,EAAE,EACxB,UAAU,MAAM,CAAC,IAAI,EAAE,EACvB,UAAU,MAAM,CAAC,OAAO,qBAAqB,EAC7C,GAAG,EACH,KAAK,CACN,CAAC;YAEF,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;QACpD,CAAC;KACF,CAAC;IAEF,MAAM,CAAC,MAAM,GAAG,IAAI,KAAK,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IAEnD,OAAO,CAAC,GAAG,CACT,8DAA8D,EAC9D,UAAU,MAAM,CAAC,KAAK,EAAE,EACxB,UAAU,MAAM,CAAC,IAAI,EAAE,CACxB,CAAC;AACJ,CAAC"}
|
package/dist/src/web/types.d.ts
CHANGED
|
@@ -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;
|
|
@@ -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 {
|
|
33
|
+
skybridge: SkybridgeProperties;
|
|
31
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,15 +57,22 @@ export type OpenAiProperties<ToolInput extends UnknownObject = {}, ToolOutput ex
|
|
|
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
|
};
|
|
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
|
+
};
|
|
62
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>;
|
|
@@ -89,9 +103,7 @@ export type OpenAiMethods<WidgetState extends UnknownObject = 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
|
/**
|
|
@@ -109,7 +121,11 @@ export declare class SetGlobalsEvent extends CustomEvent<{
|
|
|
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.e55cd21",
|
|
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",
|
|
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 check",
|
|
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,6 +36,7 @@
|
|
|
44
36
|
"dependencies": {
|
|
45
37
|
"@babel/core": "^7.28.5",
|
|
46
38
|
"cors": "^2.8.5",
|
|
39
|
+
"dequal": "^2.0.3",
|
|
47
40
|
"express": "^5.1.0",
|
|
48
41
|
"handlebars": "^4.7.8",
|
|
49
42
|
"superjson": "^2.2.6",
|
|
@@ -51,23 +44,31 @@
|
|
|
51
44
|
"zustand": "^5.0.9"
|
|
52
45
|
},
|
|
53
46
|
"devDependencies": {
|
|
54
|
-
"@
|
|
47
|
+
"@modelcontextprotocol/ext-apps": "^0.2.2",
|
|
55
48
|
"@modelcontextprotocol/sdk": "^1.24.3",
|
|
56
49
|
"@testing-library/dom": "^10.4.1",
|
|
57
|
-
"@testing-library/react": "^16.3.
|
|
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
54
|
"@types/express": "^5.0.3",
|
|
62
|
-
"@types/jsdom": "^
|
|
55
|
+
"@types/jsdom": "^27.0.0",
|
|
63
56
|
"@types/node": "^22.15.30",
|
|
64
57
|
"@types/react": "^19.2.2",
|
|
65
58
|
"@types/react-dom": "^19.2.2",
|
|
66
59
|
"@vitest/ui": "^2.1.8",
|
|
67
|
-
"jsdom": "^
|
|
60
|
+
"jsdom": "^27.4.0",
|
|
68
61
|
"typescript": "^5.9.3",
|
|
69
62
|
"vitest": "^2.1.8",
|
|
70
63
|
"zod": "^4.1.13"
|
|
71
64
|
},
|
|
72
|
-
"
|
|
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,123 +0,0 @@
|
|
|
1
|
-
<div align="center">
|
|
2
|
-
|
|
3
|
-
<img alt="Skybridge" src="docs/static/img/logo.png" width="220">
|
|
4
|
-
|
|
5
|
-
# Skybridge
|
|
6
|
-
|
|
7
|
-
**Build ChatGPT Apps. The Modern TypeScript Way.**
|
|
8
|
-
|
|
9
|
-
The fullstack TypeScript framework for ChatGPT Apps.<br />
|
|
10
|
-
**Type-safe. React-powered. Zero config.**
|
|
11
|
-
|
|
12
|
-
<br />
|
|
13
|
-
|
|
14
|
-
[](https://www.npmjs.com/package/skybridge)
|
|
15
|
-
[](https://www.npmjs.com/package/skybridge)
|
|
16
|
-
[](https://github.com/alpic-ai/skybridge/blob/main/LICENSE)
|
|
17
|
-
|
|
18
|
-
<br />
|
|
19
|
-
|
|
20
|
-
[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)
|
|
21
|
-
|
|
22
|
-
</div>
|
|
23
|
-
|
|
24
|
-
<br />
|
|
25
|
-
|
|
26
|
-
## ✨ Why Skybridge?
|
|
27
|
-
|
|
28
|
-
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.
|
|
29
|
-
|
|
30
|
-
**Skybridge fixes that.**
|
|
31
|
-
|
|
32
|
-
| | |
|
|
33
|
-
|:--|:--|
|
|
34
|
-
| 👨💻 **Full Dev Environment** — HMR, debug traces, and local emulator. No more refresh loops. | ✅ **End-to-End Type Safety** — tRPC-style inference from server to widget. Autocomplete everywhere. |
|
|
35
|
-
| 🔄 **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. |
|
|
36
|
-
|
|
37
|
-
<br />
|
|
38
|
-
|
|
39
|
-
## 🚀 Get Started
|
|
40
|
-
|
|
41
|
-
**Create a new ChatGPT app:**
|
|
42
|
-
|
|
43
|
-
```bash
|
|
44
|
-
gh repo create my-app --template alpic-ai/apps-sdk-template --clone
|
|
45
|
-
cd my-app && pnpm install
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
**Or add to an existing project:**
|
|
49
|
-
|
|
50
|
-
```bash
|
|
51
|
-
npm i skybridge
|
|
52
|
-
yarn add skybridge
|
|
53
|
-
pnpm add skybridge
|
|
54
|
-
bun add skybridge
|
|
55
|
-
deno add skybridge
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
<div align="center">
|
|
59
|
-
|
|
60
|
-
**👉 [Read the Docs](https://skybridge.tech) 👈**
|
|
61
|
-
|
|
62
|
-
</div>
|
|
63
|
-
|
|
64
|
-
<br />
|
|
65
|
-
|
|
66
|
-
## 📦 The Stack
|
|
67
|
-
|
|
68
|
-
- **`skybridge/server`** — Drop-in MCP SDK replacement with widget registration and type inference.
|
|
69
|
-
- **`skybridge/web`** — React hooks and components for ChatGPT's runtime.
|
|
70
|
-
|
|
71
|
-
### Server
|
|
72
|
-
|
|
73
|
-
```ts
|
|
74
|
-
import { McpServer } from "skybridge/server";
|
|
75
|
-
|
|
76
|
-
server.registerWidget("flights", {}, {
|
|
77
|
-
inputSchema: { destination: z.string() },
|
|
78
|
-
}, async ({ destination }) => {
|
|
79
|
-
const flights = await searchFlights(destination);
|
|
80
|
-
return { structuredContent: { flights } };
|
|
81
|
-
});
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
### Widget
|
|
85
|
-
|
|
86
|
-
```tsx
|
|
87
|
-
import { useToolInfo } from "skybridge/web";
|
|
88
|
-
|
|
89
|
-
function FlightsWidget() {
|
|
90
|
-
const { output } = useToolInfo();
|
|
91
|
-
|
|
92
|
-
return output.structuredContent.flights.map(f =>
|
|
93
|
-
<FlightCard key={f.id} flight={f} />
|
|
94
|
-
);
|
|
95
|
-
}
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
<br />
|
|
99
|
-
|
|
100
|
-
## 🎯 Features at a Glance
|
|
101
|
-
|
|
102
|
-
- **Live Reload** — Vite HMR. See changes instantly without reinstalling.
|
|
103
|
-
- **Typed Hooks** — Full autocomplete for tools, inputs, outputs.
|
|
104
|
-
- **Widget → Tool Calls** — Trigger server actions from UI.
|
|
105
|
-
- **Dual Surface Sync** — Keep model aware of what users see with `data-llm`.
|
|
106
|
-
- **React Query-style API** — `isPending`, `isError`, callbacks.
|
|
107
|
-
- **MCP Compatible** — Extends the official SDK. Works with any MCP client.
|
|
108
|
-
|
|
109
|
-
<br />
|
|
110
|
-
|
|
111
|
-
<div align="center">
|
|
112
|
-
|
|
113
|
-
[](https://github.com/alpic-ai/skybridge/discussions)
|
|
114
|
-
[](https://github.com/alpic-ai/skybridge/issues)
|
|
115
|
-
[](https://discord.com/invite/gNAazGueab)
|
|
116
|
-
|
|
117
|
-
See [CONTRIBUTING.md](CONTRIBUTING.md) for setup instructions
|
|
118
|
-
|
|
119
|
-
<br />
|
|
120
|
-
|
|
121
|
-
**[MIT License](LICENSE)** · Made with ❤️ by **[Alpic](https://alpic.ai)**
|
|
122
|
-
|
|
123
|
-
</div>
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { type RequestHandler } from "express";
|
|
2
|
-
/**
|
|
3
|
-
* Serve the built emulator React app
|
|
4
|
-
* This router serves static files from the emulator's dist directory.
|
|
5
|
-
* It should be installed at the application root, like so:
|
|
6
|
-
*
|
|
7
|
-
* const app = express();
|
|
8
|
-
*
|
|
9
|
-
* if (env.NODE_ENV !== "production") {
|
|
10
|
-
* app.use(await emulatorStaticServer(server));
|
|
11
|
-
* app.use(await widgetsDevServer());
|
|
12
|
-
* ^^^^^^^^ Make sure to install the emulatorStaticServer before the widgetsDevServer
|
|
13
|
-
* }
|
|
14
|
-
*/
|
|
15
|
-
export declare const emulatorStaticServer: () => Promise<RequestHandler>;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from "node:fs";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import { fileURLToPath } from "node:url";
|
|
4
|
-
import cors from "cors";
|
|
5
|
-
import express, {} from "express";
|
|
6
|
-
/**
|
|
7
|
-
* Serve the built emulator React app
|
|
8
|
-
* This router serves static files from the emulator's dist directory.
|
|
9
|
-
* It should be installed at the application root, like so:
|
|
10
|
-
*
|
|
11
|
-
* const app = express();
|
|
12
|
-
*
|
|
13
|
-
* if (env.NODE_ENV !== "production") {
|
|
14
|
-
* app.use(await emulatorStaticServer(server));
|
|
15
|
-
* app.use(await widgetsDevServer());
|
|
16
|
-
* ^^^^^^^^ Make sure to install the emulatorStaticServer before the widgetsDevServer
|
|
17
|
-
* }
|
|
18
|
-
*/
|
|
19
|
-
export const emulatorStaticServer = async () => {
|
|
20
|
-
const router = express.Router();
|
|
21
|
-
const currentDir = path.dirname(fileURLToPath(import.meta.url));
|
|
22
|
-
const emulatorPath = path.join(currentDir, "..", "emulator");
|
|
23
|
-
router.use(cors());
|
|
24
|
-
router.use(express.static(emulatorPath));
|
|
25
|
-
router.get("/", (_req, res, next) => {
|
|
26
|
-
const indexHtmlPath = path.join(emulatorPath, "index.html");
|
|
27
|
-
try {
|
|
28
|
-
const indexHtml = readFileSync(indexHtmlPath, "utf-8");
|
|
29
|
-
res.setHeader("Content-Type", "text/html");
|
|
30
|
-
res.send(indexHtml);
|
|
31
|
-
}
|
|
32
|
-
catch (error) {
|
|
33
|
-
next(error);
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
return router;
|
|
37
|
-
};
|
|
38
|
-
//# sourceMappingURL=emulatorStaticServer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"emulatorStaticServer.js","sourceRoot":"","sources":["../../../src/server/emulatorStaticServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,OAAO,EAAE,EAAuB,MAAM,SAAS,CAAC;AAEvD;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,IAA6B,EAAE;IACtE,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAChC,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAChE,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC;IAE7D,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;IAEnB,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC;IAEzC,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;QAClC,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;QAC5D,IAAI,CAAC;YACH,MAAM,SAAS,GAAG,YAAY,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;YACvD,GAAG,CAAC,SAAS,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;YAC3C,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACtB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,KAAK,CAAC,CAAC;QACd,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function useLocale(): string;
|
|
@@ -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,CAAE,CAAC;AACpC,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 +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,CAAE,CAAC;AACnC,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 +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,CAAE,CAAC;AACvC,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":"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;AAEzE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,IAAI,UAEH,CAAC;IAEF,UAAU,CAAC,GAAG,EAAE;QACd,UAAU,GAAG;YACX,SAAS,EAAE;gBACT,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gBAC1B,YAAY,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE;aAC5C;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,mEAAmE,EAAE,GAAG,EAAE;QAC3E,UAAU,CAAC,SAAS,GAAG;YACrB,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC1B,YAAY,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE;SAC5C,CAAC;QACF,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,YAAY,EAAE,CAAC,C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