skybridge 0.0.0-dev.5eba71f → 0.0.0-dev.5ebb048
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/server.js +1 -1
- package/dist/src/server/server.js.map +1 -1
- package/dist/src/server/widgetsDevServer.js +0 -1
- package/dist/src/server/widgetsDevServer.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 +4 -2
- package/dist/src/web/bridges/apps-sdk-bridge.js +19 -14
- package/dist/src/web/bridges/apps-sdk-bridge.js.map +1 -1
- 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-bridge.js +3 -14
- package/dist/src/web/bridges/hooks/use-bridge.js.map +1 -1
- package/dist/src/web/bridges/hooks/use-mcp-app-bridge.d.ts +3 -2
- package/dist/src/web/bridges/hooks/use-mcp-app-bridge.js.map +1 -1
- package/dist/src/web/bridges/hooks/use-mcp-app-bridge.test.js +9 -26
- package/dist/src/web/bridges/hooks/use-mcp-app-bridge.test.js.map +1 -1
- package/dist/src/web/bridges/index.d.ts +1 -1
- package/dist/src/web/bridges/index.js +1 -1
- package/dist/src/web/bridges/index.js.map +1 -1
- package/dist/src/web/bridges/mcp-app-bridge.d.ts +15 -7
- package/dist/src/web/bridges/mcp-app-bridge.js +44 -21
- package/dist/src/web/bridges/mcp-app-bridge.js.map +1 -1
- package/dist/src/web/bridges/types.d.ts +23 -9
- package/dist/src/web/data-llm.js +4 -2
- package/dist/src/web/data-llm.js.map +1 -1
- package/dist/src/web/generate-helpers.test-d.js +4 -1
- package/dist/src/web/generate-helpers.test-d.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.js +12 -6
- package/dist/src/web/hooks/use-call-tool.js.map +1 -1
- package/dist/src/web/hooks/use-call-tool.test.js +23 -0
- package/dist/src/web/hooks/use-call-tool.test.js.map +1 -1
- package/dist/src/web/hooks/use-display-mode.d.ts +3 -3
- package/dist/src/web/hooks/use-display-mode.js +3 -3
- package/dist/src/web/hooks/use-display-mode.js.map +1 -1
- package/dist/src/web/hooks/use-layout.test.js +87 -38
- package/dist/src/web/hooks/use-layout.test.js.map +1 -1
- 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-send-follow-up-message.js +4 -2
- package/dist/src/web/hooks/use-send-follow-up-message.js.map +1 -1
- package/dist/src/web/hooks/use-tool-info.d.ts +12 -1
- package/dist/src/web/hooks/use-tool-info.js +15 -9
- 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 -47
- package/dist/src/web/hooks/use-tool-info.test.js.map +1 -1
- package/dist/src/web/hooks/use-user.test.js +83 -34
- package/dist/src/web/hooks/use-user.test.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/package.json +4 -4
- package/dist/src/web/bridges/apps-sdk-adapter.d.ts +0 -4
- package/dist/src/web/bridges/apps-sdk-adapter.js +0 -10
- package/dist/src/web/bridges/apps-sdk-adapter.js.map +0 -1
- package/dist/src/web/bridges/get-bridge-methods.d.ts +0 -2
- package/dist/src/web/bridges/get-bridge-methods.js +0 -8
- package/dist/src/web/bridges/get-bridge-methods.js.map +0 -1
- package/dist/src/web/bridges/hooks/types.d.ts +0 -6
- package/dist/src/web/bridges/hooks/types.js +0 -2
- package/dist/src/web/bridges/hooks/types.js.map +0 -1
- package/dist/src/web/bridges/mcp-app-adapter.d.ts +0 -6
- package/dist/src/web/bridges/mcp-app-adapter.js +0 -77
- package/dist/src/web/bridges/mcp-app-adapter.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "skybridge",
|
|
3
|
-
"version": "0.0.0-dev.
|
|
3
|
+
"version": "0.0.0-dev.5ebb048",
|
|
4
4
|
"description": "Skybridge is a framework for building ChatGPT apps",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@babel/core": "^7.28.5",
|
|
47
47
|
"cors": "^2.8.5",
|
|
48
|
+
"dequal": "^2.0.3",
|
|
48
49
|
"express": "^5.1.0",
|
|
49
50
|
"handlebars": "^4.7.8",
|
|
50
51
|
"superjson": "^2.2.6",
|
|
@@ -52,16 +53,15 @@
|
|
|
52
53
|
"zustand": "^5.0.9"
|
|
53
54
|
},
|
|
54
55
|
"devDependencies": {
|
|
55
|
-
"@biomejs/biome": "2.3.8",
|
|
56
56
|
"@modelcontextprotocol/ext-apps": "^0.2.2",
|
|
57
57
|
"@modelcontextprotocol/sdk": "^1.24.3",
|
|
58
58
|
"@testing-library/dom": "^10.4.1",
|
|
59
|
-
"@testing-library/react": "^16.3.
|
|
59
|
+
"@testing-library/react": "^16.3.1",
|
|
60
60
|
"@total-typescript/tsconfig": "^1.0.4",
|
|
61
61
|
"@types/babel__core": "^7.20.5",
|
|
62
62
|
"@types/cors": "^2.8.19",
|
|
63
63
|
"@types/express": "^5.0.3",
|
|
64
|
-
"@types/jsdom": "^21.1.
|
|
64
|
+
"@types/jsdom": "^21.1.7",
|
|
65
65
|
"@types/node": "^22.15.30",
|
|
66
66
|
"@types/react": "^19.2.2",
|
|
67
67
|
"@types/react-dom": "^19.2.2",
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { CallToolResponse, Methods } from "./types.js";
|
|
2
|
-
export declare const callTool: <ToolArgs extends Record<string, unknown> | null = null, ToolResponse extends CallToolResponse = CallToolResponse>(name: string, args: ToolArgs) => Promise<ToolResponse>;
|
|
3
|
-
export declare const requestDisplayMode: Methods["requestDisplayMode"];
|
|
4
|
-
export declare const sendFollowUpMessage: Methods["sendFollowUpMessage"];
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export const callTool = async (name, args) => {
|
|
2
|
-
return window.openai.callTool(name, args);
|
|
3
|
-
};
|
|
4
|
-
export const requestDisplayMode = ({ mode }) => {
|
|
5
|
-
return window.openai.requestDisplayMode({ mode });
|
|
6
|
-
};
|
|
7
|
-
export const sendFollowUpMessage = (prompt) => {
|
|
8
|
-
return window.openai.sendFollowUpMessage({ prompt });
|
|
9
|
-
};
|
|
10
|
-
//# sourceMappingURL=apps-sdk-adapter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"apps-sdk-adapter.js","sourceRoot":"","sources":["../../../../src/web/bridges/apps-sdk-adapter.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAK,EAI3B,IAAY,EACZ,IAAc,EACS,EAAE;IACzB,OAAO,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAyB,IAAI,EAAE,IAAI,CAAC,CAAC;AACpE,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAkC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE;IAC5E,OAAO,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;AACpD,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAmC,CAAC,MAAM,EAAE,EAAE;IAC5E,OAAO,MAAM,CAAC,MAAM,CAAC,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;AACvD,CAAC,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import * as AppsSdkAdapter from "./apps-sdk-adapter.js";
|
|
2
|
-
import * as McpAppAdapter from "./mcp-app-adapter.js";
|
|
3
|
-
export const getBridgeMethods = () => {
|
|
4
|
-
return window.skybridge.hostType === "apps-sdk"
|
|
5
|
-
? AppsSdkAdapter
|
|
6
|
-
: McpAppAdapter;
|
|
7
|
-
};
|
|
8
|
-
//# sourceMappingURL=get-bridge-methods.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-bridge-methods.js","sourceRoot":"","sources":["../../../../src/web/bridges/get-bridge-methods.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,cAAc,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,aAAa,MAAM,sBAAsB,CAAC;AAGtD,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAY,EAAE;IAC5C,OAAO,MAAM,CAAC,SAAS,CAAC,QAAQ,KAAK,UAAU;QAC7C,CAAC,CAAC,cAAc;QAChB,CAAC,CAAC,aAAa,CAAC;AACpB,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/web/bridges/hooks/types.ts"],"names":[],"mappings":""}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { BridgeExternalStore } from "./hooks/types.js";
|
|
2
|
-
import type { BridgeInterface, CallToolResponse, Methods } from "./types.js";
|
|
3
|
-
export declare const callTool: <ToolArgs extends Record<string, unknown> | null = null, ToolResponse extends CallToolResponse = CallToolResponse>(name: string, args: ToolArgs) => Promise<ToolResponse>;
|
|
4
|
-
export declare const requestDisplayMode: Methods["requestDisplayMode"];
|
|
5
|
-
export declare const sendFollowUpMessage: Methods["sendFollowUpMessage"];
|
|
6
|
-
export declare const getMcpAppAdapter: () => { [K in keyof BridgeInterface]: BridgeExternalStore<K>; };
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { McpAppBridge } from "./mcp-app-bridge.js";
|
|
2
|
-
export const callTool = async (name, args) => {
|
|
3
|
-
const bridge = McpAppBridge.getInstance();
|
|
4
|
-
const response = await bridge.request({
|
|
5
|
-
method: "tools/call",
|
|
6
|
-
params: {
|
|
7
|
-
name,
|
|
8
|
-
arguments: args ?? undefined,
|
|
9
|
-
},
|
|
10
|
-
});
|
|
11
|
-
const result = response.content
|
|
12
|
-
.filter((content) => content.type === "text")
|
|
13
|
-
.map(({ text }) => text)
|
|
14
|
-
.join("\n");
|
|
15
|
-
return {
|
|
16
|
-
content: response.content,
|
|
17
|
-
structuredContent: response.structuredContent ?? {},
|
|
18
|
-
isError: response.isError ?? false,
|
|
19
|
-
result,
|
|
20
|
-
meta: response._meta ?? {},
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
export const requestDisplayMode = ({ mode }) => {
|
|
24
|
-
const bridge = McpAppBridge.getInstance();
|
|
25
|
-
if (mode !== "modal") {
|
|
26
|
-
return bridge.request({
|
|
27
|
-
method: "ui/request-display-mode",
|
|
28
|
-
params: { mode },
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
throw new Error("Modal display mode is not accessible in MCP App.");
|
|
32
|
-
};
|
|
33
|
-
export const sendFollowUpMessage = async (prompt) => {
|
|
34
|
-
const bridge = McpAppBridge.getInstance();
|
|
35
|
-
await bridge.request({
|
|
36
|
-
method: "ui/message",
|
|
37
|
-
params: {
|
|
38
|
-
role: "user",
|
|
39
|
-
content: [
|
|
40
|
-
{
|
|
41
|
-
type: "text",
|
|
42
|
-
text: prompt,
|
|
43
|
-
},
|
|
44
|
-
],
|
|
45
|
-
},
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
|
-
const createExternalStore = (keys, getSnapshot) => {
|
|
49
|
-
const bridge = McpAppBridge.getInstance();
|
|
50
|
-
return {
|
|
51
|
-
subscribe: bridge.subscribe(keys),
|
|
52
|
-
getSnapshot: () => {
|
|
53
|
-
const context = Object.fromEntries(keys.map((k) => [k, bridge.getSnapshot(k)]));
|
|
54
|
-
return getSnapshot(context);
|
|
55
|
-
},
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
export const getMcpAppAdapter = () => ({
|
|
59
|
-
theme: createExternalStore(["theme"], ({ theme }) => theme ?? "light"),
|
|
60
|
-
locale: createExternalStore(["locale"], ({ locale }) => locale ?? "en-US"),
|
|
61
|
-
safeArea: createExternalStore(["safeAreaInsets"], ({ safeAreaInsets }) => ({
|
|
62
|
-
insets: safeAreaInsets ?? { top: 0, right: 0, bottom: 0, left: 0 },
|
|
63
|
-
})),
|
|
64
|
-
displayMode: createExternalStore(["displayMode"], ({ displayMode }) => displayMode ?? "inline"),
|
|
65
|
-
maxHeight: createExternalStore(["viewport"], ({ viewport }) => viewport?.maxHeight ?? window.innerHeight),
|
|
66
|
-
userAgent: createExternalStore(["platform", "deviceCapabilities"], ({ platform, deviceCapabilities }) => ({
|
|
67
|
-
device: {
|
|
68
|
-
type: platform === "web" ? "desktop" : (platform ?? "unknown"),
|
|
69
|
-
},
|
|
70
|
-
capabilities: {
|
|
71
|
-
hover: true,
|
|
72
|
-
touch: true,
|
|
73
|
-
...deviceCapabilities,
|
|
74
|
-
},
|
|
75
|
-
})),
|
|
76
|
-
});
|
|
77
|
-
//# sourceMappingURL=mcp-app-adapter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-app-adapter.js","sourceRoot":"","sources":["../../../../src/web/bridges/mcp-app-adapter.ts"],"names":[],"mappings":"AAaA,OA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