skybridge 0.0.0-dev.d9ee984 → 0.0.0-dev.db1ee0e
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/LICENSE +21 -674
- package/README.md +123 -1
- 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 +5 -0
- package/dist/{server → src/server}/index.js +1 -1
- package/dist/src/server/index.js.map +1 -0
- package/dist/src/server/inferUtilityTypes.d.ts +64 -0
- package/dist/src/server/inferUtilityTypes.js +2 -0
- package/dist/src/server/inferUtilityTypes.js.map +1 -0
- package/dist/src/server/server.d.ts +73 -0
- package/dist/src/server/server.js +74 -0
- package/dist/src/server/server.js.map +1 -0
- package/dist/src/server/templateHelper.d.ts +15 -0
- package/dist/src/server/templateHelper.js +30 -0
- package/dist/src/server/templateHelper.js.map +1 -0
- package/dist/src/server/templates/development.hbs +12 -0
- package/dist/src/server/templates/production.hbs +6 -0
- package/dist/{server → src/server}/widgetsDevServer.d.ts +5 -2
- package/dist/{server → src/server}/widgetsDevServer.js +8 -5
- package/dist/src/server/widgetsDevServer.js.map +1 -0
- package/dist/src/test/utils.d.ts +135 -0
- package/dist/src/test/utils.js +242 -0
- package/dist/src/test/utils.js.map +1 -0
- package/dist/src/test/widget.test.d.ts +1 -0
- package/dist/src/test/widget.test.js +134 -0
- package/dist/src/test/widget.test.js.map +1 -0
- package/dist/src/web/bridges/index.d.ts +2 -0
- package/dist/src/web/bridges/index.js +3 -0
- package/dist/src/web/bridges/index.js.map +1 -0
- package/dist/src/web/bridges/use-apps-sdk-bridge.d.ts +2 -0
- package/dist/{web/use-openai-global.js → src/web/bridges/use-apps-sdk-bridge.js} +9 -5
- package/dist/src/web/bridges/use-apps-sdk-bridge.js.map +1 -0
- package/dist/src/web/bridges/use-mcp-app-bridge.d.ts +24 -0
- package/dist/src/web/bridges/use-mcp-app-bridge.js +123 -0
- package/dist/src/web/bridges/use-mcp-app-bridge.js.map +1 -0
- package/dist/src/web/bridges/use-mcp-app-bridge.test.d.ts +1 -0
- package/dist/src/web/bridges/use-mcp-app-bridge.test.js +64 -0
- package/dist/src/web/bridges/use-mcp-app-bridge.test.js.map +1 -0
- package/dist/src/web/create-store.d.ts +3 -0
- package/dist/src/web/create-store.js +25 -0
- package/dist/src/web/create-store.js.map +1 -0
- package/dist/src/web/create-store.test.d.ts +1 -0
- 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.d.ts +14 -0
- package/dist/src/web/data-llm.js +68 -0
- package/dist/src/web/data-llm.js.map +1 -0
- package/dist/src/web/data-llm.test.d.ts +1 -0
- package/dist/src/web/data-llm.test.js +76 -0
- package/dist/src/web/data-llm.test.js.map +1 -0
- package/dist/src/web/generate-helpers.d.ts +115 -0
- package/dist/src/web/generate-helpers.js +111 -0
- package/dist/src/web/generate-helpers.js.map +1 -0
- package/dist/src/web/generate-helpers.test-d.d.ts +1 -0
- package/dist/src/web/generate-helpers.test-d.js +206 -0
- package/dist/src/web/generate-helpers.test-d.js.map +1 -0
- package/dist/src/web/generate-helpers.test.d.ts +1 -0
- package/dist/src/web/generate-helpers.test.js +17 -0
- package/dist/src/web/generate-helpers.test.js.map +1 -0
- package/dist/src/web/helpers/state.d.ts +7 -0
- package/dist/src/web/helpers/state.js +40 -0
- package/dist/src/web/helpers/state.js.map +1 -0
- package/dist/src/web/helpers/state.test.d.ts +1 -0
- 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 +12 -0
- package/dist/src/web/hooks/index.js +13 -0
- package/dist/src/web/hooks/index.js.map +1 -0
- package/dist/src/web/hooks/use-call-tool.d.ts +100 -0
- package/dist/src/web/hooks/use-call-tool.js +60 -0
- package/dist/src/web/hooks/use-call-tool.js.map +1 -0
- package/dist/src/web/hooks/use-call-tool.test-d.d.ts +1 -0
- package/dist/src/web/hooks/use-call-tool.test-d.js +104 -0
- package/dist/src/web/hooks/use-call-tool.test-d.js.map +1 -0
- package/dist/src/web/hooks/use-call-tool.test.d.ts +1 -0
- package/dist/src/web/hooks/use-call-tool.test.js +165 -0
- package/dist/src/web/hooks/use-call-tool.test.js.map +1 -0
- package/dist/src/web/hooks/use-display-mode.d.ts +4 -0
- package/dist/src/web/hooks/use-display-mode.js +7 -0
- package/dist/src/web/hooks/use-display-mode.js.map +1 -0
- package/dist/src/web/hooks/use-display-mode.test.d.ts +1 -0
- package/dist/src/web/hooks/use-display-mode.test.js +40 -0
- package/dist/src/web/hooks/use-display-mode.test.js.map +1 -0
- package/dist/src/web/hooks/use-files.d.ts +10 -0
- package/dist/src/web/hooks/use-files.js +7 -0
- package/dist/src/web/hooks/use-files.js.map +1 -0
- package/dist/src/web/hooks/use-files.test.d.ts +1 -0
- package/dist/src/web/hooks/use-files.test.js +29 -0
- package/dist/src/web/hooks/use-files.test.js.map +1 -0
- package/dist/src/web/hooks/use-locale.d.ts +1 -0
- package/dist/src/web/hooks/use-locale.js +5 -0
- package/dist/src/web/hooks/use-locale.js.map +1 -0
- package/dist/src/web/hooks/use-locale.test.d.ts +1 -0
- package/dist/src/web/hooks/use-locale.test.js +21 -0
- package/dist/src/web/hooks/use-locale.test.js.map +1 -0
- package/dist/src/web/hooks/use-open-external.d.ts +1 -0
- package/dist/src/web/hooks/use-open-external.js +6 -0
- package/dist/src/web/hooks/use-open-external.js.map +1 -0
- package/dist/src/web/hooks/use-open-external.test.d.ts +1 -0
- package/dist/src/web/hooks/use-open-external.test.js +24 -0
- package/dist/src/web/hooks/use-open-external.test.js.map +1 -0
- package/dist/src/web/hooks/use-openai-global.d.ts +3 -0
- package/dist/src/web/hooks/use-openai-global.js +6 -0
- package/dist/src/web/hooks/use-openai-global.js.map +1 -0
- package/dist/src/web/hooks/use-request-modal.d.ts +6 -0
- package/dist/src/web/hooks/use-request-modal.js +9 -0
- package/dist/src/web/hooks/use-request-modal.js.map +1 -0
- package/dist/src/web/hooks/use-request-modal.test.d.ts +1 -0
- package/dist/src/web/hooks/use-request-modal.test.js +24 -0
- package/dist/src/web/hooks/use-request-modal.test.js.map +1 -0
- package/dist/src/web/hooks/use-send-follow-up-message.d.ts +1 -0
- package/dist/src/web/hooks/use-send-follow-up-message.js +11 -0
- package/dist/src/web/hooks/use-send-follow-up-message.js.map +1 -0
- package/dist/src/web/hooks/use-theme.d.ts +1 -0
- package/dist/src/web/hooks/use-theme.js +5 -0
- package/dist/src/web/hooks/use-theme.js.map +1 -0
- package/dist/src/web/hooks/use-theme.test.d.ts +1 -0
- package/dist/src/web/hooks/use-theme.test.js +26 -0
- package/dist/src/web/hooks/use-theme.test.js.map +1 -0
- package/dist/src/web/hooks/use-tool-info.d.ts +25 -0
- package/dist/src/web/hooks/use-tool-info.js +20 -0
- package/dist/src/web/hooks/use-tool-info.js.map +1 -0
- package/dist/src/web/hooks/use-tool-info.test-d.d.ts +1 -0
- package/dist/src/web/hooks/use-tool-info.test-d.js +73 -0
- package/dist/src/web/hooks/use-tool-info.test-d.js.map +1 -0
- package/dist/src/web/hooks/use-tool-info.test.d.ts +1 -0
- package/dist/src/web/hooks/use-tool-info.test.js +59 -0
- package/dist/src/web/hooks/use-tool-info.test.js.map +1 -0
- package/dist/src/web/hooks/use-user-agent.d.ts +1 -0
- package/dist/src/web/hooks/use-user-agent.js +5 -0
- package/dist/src/web/hooks/use-user-agent.js.map +1 -0
- package/dist/src/web/hooks/use-user-agent.test.d.ts +1 -0
- package/dist/src/web/hooks/use-user-agent.test.js +31 -0
- package/dist/src/web/hooks/use-user-agent.test.js.map +1 -0
- package/dist/src/web/hooks/use-widget-state.d.ts +4 -0
- package/dist/src/web/hooks/use-widget-state.js +32 -0
- package/dist/src/web/hooks/use-widget-state.js.map +1 -0
- package/dist/src/web/hooks/use-widget-state.test.d.ts +1 -0
- package/dist/src/web/hooks/use-widget-state.test.js +60 -0
- package/dist/src/web/hooks/use-widget-state.test.js.map +1 -0
- package/dist/src/web/index.d.ts +8 -0
- package/dist/src/web/index.js +9 -0
- package/dist/src/web/index.js.map +1 -0
- package/dist/src/web/mount-widget.js +19 -0
- package/dist/src/web/mount-widget.js.map +1 -0
- package/dist/src/web/plugin/data-llm.test.d.ts +1 -0
- package/dist/src/web/plugin/data-llm.test.js +81 -0
- package/dist/src/web/plugin/data-llm.test.js.map +1 -0
- package/dist/src/web/plugin/plugin.d.ts +2 -0
- package/dist/src/web/plugin/plugin.js +39 -0
- package/dist/src/web/plugin/plugin.js.map +1 -0
- package/dist/src/web/plugin/transform-data-llm.d.ts +12 -0
- package/dist/src/web/plugin/transform-data-llm.js +93 -0
- package/dist/src/web/plugin/transform-data-llm.js.map +1 -0
- package/dist/src/web/plugin/transform-data-llm.test.d.ts +1 -0
- package/dist/src/web/plugin/transform-data-llm.test.js +81 -0
- package/dist/src/web/plugin/transform-data-llm.test.js.map +1 -0
- package/dist/src/web/proxy.d.ts +1 -0
- package/dist/src/web/proxy.js +53 -0
- package/dist/src/web/proxy.js.map +1 -0
- package/dist/{web → src/web}/types.d.ts +56 -18
- package/dist/{web → src/web}/types.js +1 -0
- package/dist/src/web/types.js.map +1 -0
- package/dist/vitest.config.d.ts +2 -0
- package/dist/vitest.config.js +8 -0
- package/dist/vitest.config.js.map +1 -0
- package/package.json +36 -13
- package/dist/server/index.d.ts +0 -3
- package/dist/server/index.js.map +0 -1
- package/dist/server/middleware.d.ts +0 -3
- package/dist/server/middleware.js +0 -47
- package/dist/server/middleware.js.map +0 -1
- package/dist/server/server.d.ts +0 -12
- package/dist/server/server.js +0 -70
- package/dist/server/server.js.map +0 -1
- package/dist/server/widgetsDevServer.js.map +0 -1
- package/dist/web/index.d.ts +0 -4
- package/dist/web/index.js +0 -5
- package/dist/web/index.js.map +0 -1
- package/dist/web/mount-widget.js +0 -10
- package/dist/web/mount-widget.js.map +0 -1
- package/dist/web/types.js.map +0 -1
- package/dist/web/use-openai-global.d.ts +0 -2
- package/dist/web/use-openai-global.js.map +0 -1
- package/dist/web/use-tool-output.d.ts +0 -3
- package/dist/web/use-tool-output.js +0 -5
- package/dist/web/use-tool-output.js.map +0 -1
- /package/dist/{web → src/web}/mount-widget.d.ts +0 -0
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { type MockInstance } from "vitest";
|
|
2
|
+
import { McpServer } from "../server/server.js";
|
|
3
|
+
/**
|
|
4
|
+
* Creates a real McpServer instance for testing
|
|
5
|
+
*/
|
|
6
|
+
export declare function createMockMcpServer(): {
|
|
7
|
+
server: McpServer;
|
|
8
|
+
mockRegisterResource: MockInstance<McpServer["registerResource"]>;
|
|
9
|
+
mockRegisterTool: MockInstance<McpServer["registerTool"]>;
|
|
10
|
+
};
|
|
11
|
+
export declare function createTestServer(): McpServer<Record<never, import("../server/server.js").ToolDef<unknown, unknown, unknown>> & {
|
|
12
|
+
"search-voyage": import("../server/server.js").ToolDef<{
|
|
13
|
+
destination: string;
|
|
14
|
+
departureDate?: string | undefined;
|
|
15
|
+
maxPrice?: number | undefined;
|
|
16
|
+
}, {
|
|
17
|
+
results: {
|
|
18
|
+
id: string;
|
|
19
|
+
name: string;
|
|
20
|
+
price: number;
|
|
21
|
+
}[];
|
|
22
|
+
totalCount: number;
|
|
23
|
+
}, unknown>;
|
|
24
|
+
} & {
|
|
25
|
+
"get-trip-details": import("../server/server.js").ToolDef<{
|
|
26
|
+
tripId: string;
|
|
27
|
+
}, {
|
|
28
|
+
name: string;
|
|
29
|
+
description: string;
|
|
30
|
+
images: string[];
|
|
31
|
+
}, unknown>;
|
|
32
|
+
} & {
|
|
33
|
+
"no-input-widget": import("../server/server.js").ToolDef<{}, {}, unknown>;
|
|
34
|
+
} & {
|
|
35
|
+
"inferred-output-widget": import("../server/server.js").ToolDef<{
|
|
36
|
+
query: string;
|
|
37
|
+
}, {
|
|
38
|
+
inferredResults: {
|
|
39
|
+
id: string;
|
|
40
|
+
score: number;
|
|
41
|
+
}[];
|
|
42
|
+
inferredCount: number;
|
|
43
|
+
}, unknown>;
|
|
44
|
+
} & {
|
|
45
|
+
"calculate-price": import("../server/server.js").ToolDef<{
|
|
46
|
+
tripId: string;
|
|
47
|
+
passengers: number;
|
|
48
|
+
}, {
|
|
49
|
+
totalPrice: number;
|
|
50
|
+
currency: string;
|
|
51
|
+
}, unknown>;
|
|
52
|
+
} & {
|
|
53
|
+
"inferred-tool": import("../server/server.js").ToolDef<{
|
|
54
|
+
itemId: string;
|
|
55
|
+
}, {
|
|
56
|
+
itemDetails: {
|
|
57
|
+
name: string;
|
|
58
|
+
available: boolean;
|
|
59
|
+
};
|
|
60
|
+
fetchedAt: string;
|
|
61
|
+
}, unknown>;
|
|
62
|
+
} & {
|
|
63
|
+
"widget-with-metadata": import("../server/server.js").ToolDef<{
|
|
64
|
+
resourceId: string;
|
|
65
|
+
}, {
|
|
66
|
+
data: {
|
|
67
|
+
id: string;
|
|
68
|
+
loaded: boolean;
|
|
69
|
+
};
|
|
70
|
+
}, {
|
|
71
|
+
requestId: string;
|
|
72
|
+
timestamp: number;
|
|
73
|
+
cached: boolean;
|
|
74
|
+
}>;
|
|
75
|
+
} & {
|
|
76
|
+
"tool-with-metadata": import("../server/server.js").ToolDef<{
|
|
77
|
+
query: string;
|
|
78
|
+
}, {
|
|
79
|
+
results: string[];
|
|
80
|
+
}, {
|
|
81
|
+
executionTime: number;
|
|
82
|
+
source: string;
|
|
83
|
+
}>;
|
|
84
|
+
} & {
|
|
85
|
+
"widget-with-mixed-returns": import("../server/server.js").ToolDef<{
|
|
86
|
+
shouldSucceed: boolean;
|
|
87
|
+
}, {
|
|
88
|
+
error: string;
|
|
89
|
+
data?: undefined;
|
|
90
|
+
} | {
|
|
91
|
+
data: string;
|
|
92
|
+
error?: undefined;
|
|
93
|
+
}, {
|
|
94
|
+
processedAt: number;
|
|
95
|
+
region: string;
|
|
96
|
+
}>;
|
|
97
|
+
}>;
|
|
98
|
+
export declare function createMinimalTestServer(): McpServer<Record<never, import("../server/server.js").ToolDef<unknown, unknown, unknown>> & {
|
|
99
|
+
"search-voyage": import("../server/server.js").ToolDef<{
|
|
100
|
+
destination: string;
|
|
101
|
+
}, {
|
|
102
|
+
results: {
|
|
103
|
+
id: string;
|
|
104
|
+
}[];
|
|
105
|
+
}, unknown>;
|
|
106
|
+
}>;
|
|
107
|
+
export declare function createInterfaceTestServer(): McpServer<Record<never, import("../server/server.js").ToolDef<unknown, unknown, unknown>> & {
|
|
108
|
+
"interface-widget": import("../server/server.js").ToolDef<{
|
|
109
|
+
id: string;
|
|
110
|
+
}, {
|
|
111
|
+
itemName: string;
|
|
112
|
+
quantity: number;
|
|
113
|
+
}, {
|
|
114
|
+
processedBy: string;
|
|
115
|
+
version: number;
|
|
116
|
+
}>;
|
|
117
|
+
}>;
|
|
118
|
+
/**
|
|
119
|
+
* Mock extra parameter for resource callback
|
|
120
|
+
*/
|
|
121
|
+
export declare function createMockExtra(host: string): {
|
|
122
|
+
requestInfo: {
|
|
123
|
+
headers: {
|
|
124
|
+
host: string;
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* Sets up environment variables for testing
|
|
130
|
+
*/
|
|
131
|
+
export declare function setTestEnv(env: Record<string, string>): void;
|
|
132
|
+
/**
|
|
133
|
+
* Resets environment variables
|
|
134
|
+
*/
|
|
135
|
+
export declare function resetTestEnv(): void;
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import { vi } from "vitest";
|
|
2
|
+
import * as z from "zod";
|
|
3
|
+
import { McpServer } from "../server/server.js";
|
|
4
|
+
/**
|
|
5
|
+
* Creates a real McpServer instance for testing
|
|
6
|
+
*/
|
|
7
|
+
export function createMockMcpServer() {
|
|
8
|
+
// Create a real McpServer instance
|
|
9
|
+
const server = new McpServer({
|
|
10
|
+
name: "alpic-openai-app",
|
|
11
|
+
version: "0.0.1",
|
|
12
|
+
}, { capabilities: {} });
|
|
13
|
+
// Mock the underlying methods to track calls
|
|
14
|
+
const mockRegisterResource = vi.spyOn(server, "registerResource");
|
|
15
|
+
const mockRegisterTool = vi.spyOn(server, "registerTool");
|
|
16
|
+
return {
|
|
17
|
+
server,
|
|
18
|
+
mockRegisterResource,
|
|
19
|
+
mockRegisterTool,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export function createTestServer() {
|
|
23
|
+
return new McpServer({ name: "test-app", version: "1.0.0" }, {})
|
|
24
|
+
.registerWidget("search-voyage", {}, {
|
|
25
|
+
description: "Search for voyages",
|
|
26
|
+
inputSchema: {
|
|
27
|
+
destination: z.string(),
|
|
28
|
+
departureDate: z.string().optional(),
|
|
29
|
+
maxPrice: z.number().optional(),
|
|
30
|
+
},
|
|
31
|
+
outputSchema: {
|
|
32
|
+
results: z.array(z.object({
|
|
33
|
+
id: z.string(),
|
|
34
|
+
name: z.string(),
|
|
35
|
+
price: z.number(),
|
|
36
|
+
})),
|
|
37
|
+
totalCount: z.number(),
|
|
38
|
+
},
|
|
39
|
+
}, async ({ destination }) => {
|
|
40
|
+
return {
|
|
41
|
+
content: [{ type: "text", text: `Found trips to ${destination}` }],
|
|
42
|
+
structuredContent: {
|
|
43
|
+
results: [{ id: "1", name: "Trip", price: 1000 }],
|
|
44
|
+
totalCount: 1,
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
})
|
|
48
|
+
.registerWidget("get-trip-details", {}, {
|
|
49
|
+
description: "Get trip details",
|
|
50
|
+
inputSchema: {
|
|
51
|
+
tripId: z.string(),
|
|
52
|
+
},
|
|
53
|
+
outputSchema: {
|
|
54
|
+
name: z.string(),
|
|
55
|
+
description: z.string(),
|
|
56
|
+
images: z.array(z.string()),
|
|
57
|
+
},
|
|
58
|
+
}, async ({ tripId }) => {
|
|
59
|
+
return {
|
|
60
|
+
content: [{ type: "text", text: `Details for ${tripId}` }],
|
|
61
|
+
structuredContent: {
|
|
62
|
+
name: "Trip",
|
|
63
|
+
description: "A great trip",
|
|
64
|
+
images: ["image1.jpg"],
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
})
|
|
68
|
+
.registerWidget("no-input-widget", {}, {
|
|
69
|
+
description: "Widget with no input",
|
|
70
|
+
inputSchema: {},
|
|
71
|
+
outputSchema: {},
|
|
72
|
+
}, async () => {
|
|
73
|
+
return {
|
|
74
|
+
content: [{ type: "text", text: "No input needed" }],
|
|
75
|
+
structuredContent: {},
|
|
76
|
+
};
|
|
77
|
+
})
|
|
78
|
+
.registerWidget("inferred-output-widget", {}, {
|
|
79
|
+
description: "Widget with output inferred from callback",
|
|
80
|
+
inputSchema: {
|
|
81
|
+
query: z.string(),
|
|
82
|
+
},
|
|
83
|
+
}, async ({ query }) => {
|
|
84
|
+
return {
|
|
85
|
+
content: [{ type: "text", text: `Query: ${query}` }],
|
|
86
|
+
structuredContent: {
|
|
87
|
+
inferredResults: [{ id: "inferred-1", score: 0.95 }],
|
|
88
|
+
inferredCount: 1,
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
})
|
|
92
|
+
.registerTool("calculate-price", {
|
|
93
|
+
description: "Calculate trip price",
|
|
94
|
+
inputSchema: {
|
|
95
|
+
tripId: z.string(),
|
|
96
|
+
passengers: z.number(),
|
|
97
|
+
},
|
|
98
|
+
outputSchema: {
|
|
99
|
+
totalPrice: z.number(),
|
|
100
|
+
currency: z.string(),
|
|
101
|
+
},
|
|
102
|
+
}, async ({ tripId, passengers }) => {
|
|
103
|
+
return {
|
|
104
|
+
content: [{ type: "text", text: `Price for ${tripId}` }],
|
|
105
|
+
structuredContent: {
|
|
106
|
+
totalPrice: 1000 * passengers,
|
|
107
|
+
currency: "USD",
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
})
|
|
111
|
+
.registerTool("inferred-tool", {
|
|
112
|
+
description: "Tool with output inferred from callback",
|
|
113
|
+
inputSchema: {
|
|
114
|
+
itemId: z.string(),
|
|
115
|
+
},
|
|
116
|
+
}, async ({ itemId }) => {
|
|
117
|
+
return {
|
|
118
|
+
content: [{ type: "text", text: `Item: ${itemId}` }],
|
|
119
|
+
structuredContent: {
|
|
120
|
+
itemDetails: { name: "Inferred Item", available: true },
|
|
121
|
+
fetchedAt: "2024-01-01",
|
|
122
|
+
},
|
|
123
|
+
};
|
|
124
|
+
})
|
|
125
|
+
.registerWidget("widget-with-metadata", {}, {
|
|
126
|
+
description: "Widget that returns response metadata",
|
|
127
|
+
inputSchema: {
|
|
128
|
+
resourceId: z.string(),
|
|
129
|
+
},
|
|
130
|
+
}, async ({ resourceId }) => {
|
|
131
|
+
return {
|
|
132
|
+
content: [{ type: "text", text: `Resource: ${resourceId}` }],
|
|
133
|
+
structuredContent: {
|
|
134
|
+
data: { id: resourceId, loaded: true },
|
|
135
|
+
},
|
|
136
|
+
_meta: {
|
|
137
|
+
requestId: "req-123",
|
|
138
|
+
timestamp: 1704067200000,
|
|
139
|
+
cached: false,
|
|
140
|
+
},
|
|
141
|
+
};
|
|
142
|
+
})
|
|
143
|
+
.registerTool("tool-with-metadata", {
|
|
144
|
+
description: "Tool that returns response metadata",
|
|
145
|
+
inputSchema: {
|
|
146
|
+
query: z.string(),
|
|
147
|
+
},
|
|
148
|
+
}, async ({ query }) => {
|
|
149
|
+
return {
|
|
150
|
+
content: [{ type: "text", text: `Query: ${query}` }],
|
|
151
|
+
structuredContent: {
|
|
152
|
+
results: [query],
|
|
153
|
+
},
|
|
154
|
+
_meta: {
|
|
155
|
+
executionTime: 150,
|
|
156
|
+
source: "cache",
|
|
157
|
+
},
|
|
158
|
+
};
|
|
159
|
+
})
|
|
160
|
+
.registerWidget("widget-with-mixed-returns", {}, {
|
|
161
|
+
description: "Widget with mixed return paths (some with _meta, some without)",
|
|
162
|
+
inputSchema: {
|
|
163
|
+
shouldSucceed: z.boolean(),
|
|
164
|
+
},
|
|
165
|
+
}, async ({ shouldSucceed }) => {
|
|
166
|
+
if (!shouldSucceed) {
|
|
167
|
+
// Error path - no _meta
|
|
168
|
+
return {
|
|
169
|
+
content: [{ type: "text", text: "Error occurred" }],
|
|
170
|
+
structuredContent: { error: "Something went wrong" },
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
// Success path - has _meta
|
|
174
|
+
return {
|
|
175
|
+
content: [{ type: "text", text: "Success" }],
|
|
176
|
+
structuredContent: { data: "result" },
|
|
177
|
+
_meta: {
|
|
178
|
+
processedAt: 1704067200000,
|
|
179
|
+
region: "eu-west-1",
|
|
180
|
+
},
|
|
181
|
+
};
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
export function createMinimalTestServer() {
|
|
185
|
+
return new McpServer({ name: "test-app", version: "1.0.0" }, {}).registerWidget("search-voyage", {}, {
|
|
186
|
+
description: "Search for voyages",
|
|
187
|
+
inputSchema: {
|
|
188
|
+
destination: z.string(),
|
|
189
|
+
},
|
|
190
|
+
outputSchema: {
|
|
191
|
+
results: z.array(z.object({ id: z.string() })),
|
|
192
|
+
},
|
|
193
|
+
}, async ({ destination }) => {
|
|
194
|
+
return {
|
|
195
|
+
content: [{ type: "text", text: `Found trips to ${destination}` }],
|
|
196
|
+
structuredContent: { results: [{ id: "1" }] },
|
|
197
|
+
};
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
export function createInterfaceTestServer() {
|
|
201
|
+
return new McpServer({ name: "interface-test-app", version: "1.0.0" }, {}).registerWidget("interface-widget", {}, {
|
|
202
|
+
description: "Widget with interface-typed output",
|
|
203
|
+
inputSchema: {
|
|
204
|
+
id: z.string(),
|
|
205
|
+
},
|
|
206
|
+
}, async ({ id }) => {
|
|
207
|
+
return {
|
|
208
|
+
content: [{ type: "text", text: `Item ${id}` }],
|
|
209
|
+
structuredContent: {
|
|
210
|
+
itemName: "Test Item",
|
|
211
|
+
quantity: 42,
|
|
212
|
+
},
|
|
213
|
+
_meta: {
|
|
214
|
+
processedBy: "test",
|
|
215
|
+
version: 1,
|
|
216
|
+
},
|
|
217
|
+
};
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Mock extra parameter for resource callback
|
|
222
|
+
*/
|
|
223
|
+
export function createMockExtra(host) {
|
|
224
|
+
return {
|
|
225
|
+
requestInfo: {
|
|
226
|
+
headers: { host },
|
|
227
|
+
},
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Sets up environment variables for testing
|
|
232
|
+
*/
|
|
233
|
+
export function setTestEnv(env) {
|
|
234
|
+
Object.assign(process.env, env);
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Resets environment variables
|
|
238
|
+
*/
|
|
239
|
+
export function resetTestEnv() {
|
|
240
|
+
delete process.env.NODE_ENV;
|
|
241
|
+
}
|
|
242
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/test/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC/C,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD;;GAEG;AACH,MAAM,UAAU,mBAAmB;IAKjC,mCAAmC;IACnC,MAAM,MAAM,GAAG,IAAI,SAAS,CAC1B;QACE,IAAI,EAAE,kBAAkB;QACxB,OAAO,EAAE,OAAO;KACjB,EACD,EAAE,YAAY,EAAE,EAAE,EAAE,CACrB,CAAC;IAEF,6CAA6C;IAC7C,MAAM,oBAAoB,GAAG,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;IAClE,MAAM,gBAAgB,GAAG,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAE1D,OAAO;QACL,MAAM;QACN,oBAAoB;QACpB,gBAAgB;KACjB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,gBAAgB;IAC9B,OAAO,IAAI,SAAS,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E;aACb;YACD,KAAK,EAAE;gBACL,WAAW,EAAE,MAAM;gBACnB,OAAO,EAAE,CAAC;aACX;SACF,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,OAAO;QACL,WAAW,EAAE;YACX,OAAO,EAAE,EAAE,IAAI,EAAE;SAClB;KACF,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,GAA2B;IACpD,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAClC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY;IAC1B,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, it, vi, } from "vitest";
|
|
2
|
+
import { createMockExtra, createMockMcpServer, resetTestEnv, setTestEnv, } from "./utils.js";
|
|
3
|
+
const mockManifest = {
|
|
4
|
+
"src/widgets/my-widget.tsx": { file: "my-widget.js" },
|
|
5
|
+
"src/widgets/folder-widget/index.tsx": { file: "folder-widget.js" },
|
|
6
|
+
"style.css": { file: "style.css" },
|
|
7
|
+
};
|
|
8
|
+
vi.mock("node:fs", async () => {
|
|
9
|
+
const actual = await vi.importActual("node:fs");
|
|
10
|
+
const readFileSyncImpl = (path, ...args) => {
|
|
11
|
+
if (typeof path === "string" && path.includes("manifest.json")) {
|
|
12
|
+
return JSON.stringify(mockManifest);
|
|
13
|
+
}
|
|
14
|
+
// Type assertion needed because readFileSync has overloads with different parameter types
|
|
15
|
+
// Using @ts-expect-error because the overloads are complex and we're forwarding args
|
|
16
|
+
// @ts-expect-error - readFileSync overloads require complex type handling
|
|
17
|
+
return actual.readFileSync(path, ...args);
|
|
18
|
+
};
|
|
19
|
+
const readFileSync = vi.fn(readFileSyncImpl);
|
|
20
|
+
return {
|
|
21
|
+
readFileSync,
|
|
22
|
+
default: {
|
|
23
|
+
readFileSync,
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
});
|
|
27
|
+
describe("McpServer.registerWidget", () => {
|
|
28
|
+
let server;
|
|
29
|
+
let mockRegisterResource;
|
|
30
|
+
let mockRegisterTool;
|
|
31
|
+
beforeEach(() => {
|
|
32
|
+
({ server, mockRegisterResource, mockRegisterTool } =
|
|
33
|
+
createMockMcpServer());
|
|
34
|
+
});
|
|
35
|
+
afterEach(() => {
|
|
36
|
+
vi.clearAllMocks();
|
|
37
|
+
resetTestEnv();
|
|
38
|
+
});
|
|
39
|
+
it("should generate correct HTML for development mode", async () => {
|
|
40
|
+
setTestEnv({ NODE_ENV: "development" });
|
|
41
|
+
const mockToolCallback = vi.fn();
|
|
42
|
+
const mockRegisterResourceConfig = { description: "Test widget" };
|
|
43
|
+
const mockToolConfig = { description: "Test tool" };
|
|
44
|
+
server.registerWidget("my-widget", mockRegisterResourceConfig, mockToolConfig, mockToolCallback);
|
|
45
|
+
// Get the resource callback function
|
|
46
|
+
const appsSdkResourceCallback = mockRegisterResource.mock
|
|
47
|
+
.calls[0]?.[3];
|
|
48
|
+
expect(appsSdkResourceCallback).toBeDefined();
|
|
49
|
+
const serverUrl = "http://localhost:3000";
|
|
50
|
+
const mockExtra = createMockExtra("__not_used__");
|
|
51
|
+
const result = await appsSdkResourceCallback(new URL("ui://widgets/apps-sdk/my-widget.html"), mockExtra);
|
|
52
|
+
expect(mockRegisterTool).toHaveBeenCalled();
|
|
53
|
+
expect(result).toEqual({
|
|
54
|
+
contents: [
|
|
55
|
+
{
|
|
56
|
+
uri: "ui://widgets/apps-sdk/my-widget.html",
|
|
57
|
+
mimeType: "text/html+skybridge",
|
|
58
|
+
text: expect.stringContaining('<div id="root"></div>'),
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
});
|
|
62
|
+
// Check development-specific content
|
|
63
|
+
expect(result.contents[0]?.text).toContain(`${serverUrl}/@react-refresh`);
|
|
64
|
+
expect(result.contents[0]?.text).toContain(`${serverUrl}/@vite/client`);
|
|
65
|
+
expect(result.contents[0]?.text).toContain(`${serverUrl}/src/widgets/my-widget`);
|
|
66
|
+
expect(result.contents[0]?.text).not.toContain(`${serverUrl}/src/widgets/my-widget.tsx`);
|
|
67
|
+
});
|
|
68
|
+
it("should generate correct HTML for production mode", async () => {
|
|
69
|
+
setTestEnv({ NODE_ENV: "production" });
|
|
70
|
+
const mockToolCallback = vi.fn();
|
|
71
|
+
const mockRegisterResourceConfig = { description: "Test widget" };
|
|
72
|
+
const mockToolConfig = { description: "Test tool" };
|
|
73
|
+
server.registerWidget("my-widget", mockRegisterResourceConfig, mockToolConfig, mockToolCallback);
|
|
74
|
+
// Get the resource callback function
|
|
75
|
+
const appsSdkResourceCallback = mockRegisterResource.mock
|
|
76
|
+
.calls[0]?.[3];
|
|
77
|
+
expect(appsSdkResourceCallback).toBeDefined();
|
|
78
|
+
const serverUrl = "https://myapp.com";
|
|
79
|
+
const mockExtra = createMockExtra(serverUrl);
|
|
80
|
+
const result = await appsSdkResourceCallback(new URL("ui://widgets/apps-sdk/my-widget.html"), mockExtra);
|
|
81
|
+
expect(result).toEqual({
|
|
82
|
+
contents: [
|
|
83
|
+
{
|
|
84
|
+
uri: "ui://widgets/apps-sdk/my-widget.html",
|
|
85
|
+
mimeType: "text/html+skybridge",
|
|
86
|
+
text: expect.stringContaining('<div id="root"></div>'),
|
|
87
|
+
},
|
|
88
|
+
],
|
|
89
|
+
});
|
|
90
|
+
// Check production-specific content
|
|
91
|
+
expect(result.contents[0]?.text).not.toContain(`${serverUrl}@react-refresh`);
|
|
92
|
+
expect(result.contents[0]?.text).not.toContain(`${serverUrl}@vite/client`);
|
|
93
|
+
expect(result.contents[0]?.text).toContain(`${serverUrl}/assets/my-widget.js`);
|
|
94
|
+
expect(result.contents[0]?.text).toContain(`${serverUrl}/assets/style.css`);
|
|
95
|
+
});
|
|
96
|
+
it("should resolve folder-based widgets (barrel files) in production mode", async () => {
|
|
97
|
+
setTestEnv({ NODE_ENV: "production" });
|
|
98
|
+
const mockToolCallback = vi.fn();
|
|
99
|
+
const mockRegisterResourceConfig = { description: "Folder widget" };
|
|
100
|
+
const mockToolConfig = { description: "Folder tool" };
|
|
101
|
+
server.registerWidget("folder-widget", mockRegisterResourceConfig, mockToolConfig, mockToolCallback);
|
|
102
|
+
const appsSdkResourceCallback = mockRegisterResource.mock
|
|
103
|
+
.calls[0]?.[3];
|
|
104
|
+
expect(appsSdkResourceCallback).toBeDefined();
|
|
105
|
+
const serverUrl = "https://myapp.com";
|
|
106
|
+
const mockExtra = createMockExtra(serverUrl);
|
|
107
|
+
const result = await appsSdkResourceCallback(new URL("ui://widgets/apps-sdk/folder-widget.html"), mockExtra);
|
|
108
|
+
// Should resolve to folder-widget.js from the manifest entry "src/widgets/folder-widget/index.tsx"
|
|
109
|
+
expect(result.contents[0]?.text).toContain(`${serverUrl}/assets/folder-widget.js`);
|
|
110
|
+
});
|
|
111
|
+
it("should register resources for both apps-sdk and ext-apps formats", async () => {
|
|
112
|
+
const mockToolCallback = vi.fn();
|
|
113
|
+
const mockRegisterResourceConfig = { description: "Test widget" };
|
|
114
|
+
const mockToolConfig = { description: "Test tool" };
|
|
115
|
+
server.registerWidget("my-widget", mockRegisterResourceConfig, mockToolConfig, mockToolCallback);
|
|
116
|
+
expect(mockRegisterResource).toHaveBeenCalledTimes(2);
|
|
117
|
+
const [, appsSdkUri] = mockRegisterResource.mock.calls[0] ?? [];
|
|
118
|
+
expect(appsSdkUri).toBe("ui://widgets/apps-sdk/my-widget.html");
|
|
119
|
+
const extAppsResourceCallback = mockRegisterResource.mock
|
|
120
|
+
.calls[1]?.[3];
|
|
121
|
+
expect(extAppsResourceCallback).toBeDefined();
|
|
122
|
+
const extAppsResult = await extAppsResourceCallback(new URL("ui://widgets/ext-apps/my-widget.html"), createMockExtra("__not_used__"));
|
|
123
|
+
expect(extAppsResult).toEqual({
|
|
124
|
+
contents: [
|
|
125
|
+
{
|
|
126
|
+
uri: "ui://widgets/ext-apps/my-widget.html",
|
|
127
|
+
mimeType: "text/html;profile=mcp-app",
|
|
128
|
+
text: expect.stringContaining('<div id="root"></div>'),
|
|
129
|
+
},
|
|
130
|
+
],
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
//# sourceMappingURL=widget.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"widget.test.js","sourceRoot":"","sources":["../../../src/test/widget.test.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,SAAS,EACT,UAAU,EACV,QAAQ,EACR,MAAM,EACN,EAAE,EAEF,EAAE,GACH,MAAM,QAAQ,CAAC;AAEhB,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,YAAY,EACZ,UAAU,GACX,MAAM,YAAY,CAAC;AAEpB,MAAM,YAAY,GAAG;IACnB,2BAA2B,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE;IACrD,qCAAqC,EAAE,EAAE,IAAI,EAAE,kBAAkB,EAAE;IACnE,WAAW,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE;CACnC,CAAC;AAEF,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,IAAI,EAAE;IAC5B,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,YAAY,CAA2B,SAAS,CAAC,CAAC;IAC1E,MAAM,gBAAgB,GAAG,CACvB,IAA+C,EAC/C,GAAG,IAAe,EACsB,EAAE;QAC1C,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC;YAC/D,OAAO,IAAI,CAAC,SAAS,CAAC,YAAY,CAEjC,CAAC;QACJ,CAAC;QACD,0FAA0F;QAC1F,qFAAqF;QACrF,0EAA0E;QAC1E,OAAO,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,G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EF,MAAM,CAAC,oBAAoB,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;QAEtD,MAAM,CAAC,EAAE,UAAU,CAAC,GAAG,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QAChE,MAAM,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC;QAEhE,MAAM,uBAAuB,GAAG,oBAAoB,CAAC,IAAI;aACtD,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAKb,CAAC;QACH,MAAM,CAAC,uBAAuB,CAAC,CAAC,WAAW,EAAE,CAAC;QAE9C,MAAM,aAAa,GAAG,MAAM,uBAAuB,CACjD,IAAI,GAAG,CAAC,sCAAsC,CAAC,EAC/C,eAAe,CAAC,cAAc,CAG7B,CACF,CAAC;QACF,MAAM,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC;YAC5B,QAAQ,EAAE;gBACR;oBACE,GAAG,EAAE,sCAAsC;oBAC3C,QAAQ,EAAE,2BAA2B;oBACrC,IAAI,EAAE,MAAM,CAAC,gBAAgB,CAAC,uBAAuB,CAAC;iBACvD;aACF;SACF,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/web/bridges/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { useSyncExternalStore } from "react";
|
|
2
|
-
import { SET_GLOBALS_EVENT_TYPE,
|
|
3
|
-
export function
|
|
2
|
+
import { SET_GLOBALS_EVENT_TYPE, } from "../types.js";
|
|
3
|
+
export function useAppsSdkBridge(key) {
|
|
4
4
|
return useSyncExternalStore((onChange) => {
|
|
5
5
|
const handleSetGlobal = (event) => {
|
|
6
6
|
const value = event.detail.globals[key];
|
|
7
7
|
if (value === undefined) {
|
|
8
8
|
return;
|
|
9
9
|
}
|
|
10
|
-
console.dir(event.detail.globals, { depth: Infinity });
|
|
11
10
|
onChange();
|
|
12
11
|
};
|
|
13
12
|
window.addEventListener(SET_GLOBALS_EVENT_TYPE, handleSetGlobal, {
|
|
@@ -16,6 +15,11 @@ export function useOpenAiGlobal(key) {
|
|
|
16
15
|
return () => {
|
|
17
16
|
window.removeEventListener(SET_GLOBALS_EVENT_TYPE, handleSetGlobal);
|
|
18
17
|
};
|
|
19
|
-
}, () =>
|
|
18
|
+
}, () => {
|
|
19
|
+
if (window.openai === undefined) {
|
|
20
|
+
throw new Error(`window.openai is not available. Make sure you're calling the hook requiring ${key} within the OpenAI iFrame skybridge runtime.`);
|
|
21
|
+
}
|
|
22
|
+
return window.openai[key];
|
|
23
|
+
});
|
|
20
24
|
}
|
|
21
|
-
//# sourceMappingURL=use-
|
|
25
|
+
//# sourceMappingURL=use-apps-sdk-bridge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-apps-sdk-bridge.js","sourceRoot":"","sources":["../../../../src/web/bridges/use-apps-sdk-bridge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EAEL,sBAAsB,GAEvB,MAAM,aAAa,CAAC;AAErB,MAAM,UAAU,gBAAgB,CAC9B,GAAM;IAEN,OAAO,oBAAoB,CACzB,CAAC,QAAQ,EAAE,EAAE;QACX,MAAM,eAAe,GAAG,CAAC,KAAsB,EAAE,EAAE;YACjD,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YACxC,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;gBACxB,OAAO;YACT,CAAC;YAED,QAAQ,EAAE,CAAC;QACb,CAAC,CAAC;QAEF,MAAM,CAAC,gBAAgB,CAAC,sBAAsB,EAAE,eAAe,EAAE;YAC/D,OAAO,EAAE,IAAI;SACd,CAAC,CAAC;QAEH,OAAO,GAAG,EAAE;YACV,MAAM,CAAC,mBAAmB,CAAC,sBAAsB,EAAE,eAAe,CAAC,CAAC;QACtE,CAAC,CAAC;IACJ,CAAC,EACD,GAAG,EAAE;QACH,IAAI,MAAM,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;YAChC,MAAM,IAAI,KAAK,CACb,+EAA+E,GAAG,8CAA8C,CACjI,CAAC;QACJ,CAAC;QAED,OAAO,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAC5B,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { McpUiHostContext, McpUiInitializeRequest } from "@modelcontextprotocol/ext-apps";
|
|
2
|
+
type McpAppInitializationOptions = Pick<McpUiInitializeRequest["params"], "appInfo">;
|
|
3
|
+
export declare class McpAppBridge {
|
|
4
|
+
context: McpUiHostContext | null;
|
|
5
|
+
private listeners;
|
|
6
|
+
private pendingRequests;
|
|
7
|
+
private nextId;
|
|
8
|
+
private initialized;
|
|
9
|
+
private appInitializationOptions;
|
|
10
|
+
private requestTimeout;
|
|
11
|
+
constructor(options: McpAppInitializationOptions, requestTimeout?: number);
|
|
12
|
+
subscribe: (key: keyof McpUiHostContext) => (onChange: () => void) => () => boolean | undefined;
|
|
13
|
+
cleanup(): void;
|
|
14
|
+
private request;
|
|
15
|
+
private emit;
|
|
16
|
+
private setContext;
|
|
17
|
+
private init;
|
|
18
|
+
private handleMessage;
|
|
19
|
+
private connect;
|
|
20
|
+
private notify;
|
|
21
|
+
}
|
|
22
|
+
export declare function getMcpHost(options?: Partial<McpAppInitializationOptions>, requestTimeout?: number): McpAppBridge;
|
|
23
|
+
export declare function useMcpAppBridge<K extends keyof McpUiHostContext>(key: K, options?: Partial<McpAppInitializationOptions>, requestTimeout?: number): McpUiHostContext[K] | undefined;
|
|
24
|
+
export {};
|