skybridge 0.0.0-dev.ea1eaa2 → 0.0.0-dev.ea4a1cd
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/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 +3 -1
- package/dist/src/server/index.js +1 -1
- package/dist/src/server/index.js.map +1 -1
- 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 +71 -9
- package/dist/src/server/server.js +65 -29
- package/dist/src/server/server.js.map +1 -1
- package/dist/src/server/templateHelper.d.ts +12 -8
- package/dist/src/server/templateHelper.js +5 -12
- package/dist/src/server/templateHelper.js.map +1 -1
- package/dist/src/server/templates/development.hbs +13 -0
- package/dist/src/server/templates/production.hbs +7 -0
- package/dist/src/server/widgetsDevServer.d.ts +5 -2
- package/dist/src/server/widgetsDevServer.js +7 -5
- package/dist/src/server/widgetsDevServer.js.map +1 -1
- package/dist/src/test/utils.d.ts +108 -1
- package/dist/src/test/utils.js +202 -3
- package/dist/src/test/utils.js.map +1 -1
- package/dist/src/test/widget.test.js +102 -28
- 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/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 +70 -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 +209 -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 +11 -0
- package/dist/src/web/hooks/index.js +12 -0
- package/dist/src/web/hooks/index.js.map +1 -0
- 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 +100 -0
- package/dist/src/web/hooks/use-call-tool.js +68 -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 +191 -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 +10 -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 +41 -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-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.d.ts +1 -0
- package/dist/src/web/hooks/use-open-external.js +8 -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 +50 -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 +9 -0
- package/dist/src/web/hooks/use-request-modal.js +14 -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 +57 -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 +8 -0
- package/dist/src/web/hooks/use-send-follow-up-message.js.map +1 -0
- package/dist/src/web/hooks/use-tool-info.d.ts +36 -0
- package/dist/src/web/hooks/use-tool-info.js +26 -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 +109 -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 +130 -0
- package/dist/src/web/hooks/use-tool-info.test.js.map +1 -0
- 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.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 +61 -0
- package/dist/src/web/hooks/use-widget-state.test.js.map +1 -0
- package/dist/src/web/index.d.ts +7 -3
- package/dist/src/web/index.js +7 -3
- package/dist/src/web/index.js.map +1 -1
- package/dist/src/web/mount-widget.js +12 -3
- package/dist/src/web/mount-widget.js.map +1 -1
- 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 +96 -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/src/web/types.d.ts +73 -19
- package/dist/src/web/types.js +1 -0
- package/dist/src/web/types.js.map +1 -1
- package/dist/vitest.config.js +0 -1
- package/dist/vitest.config.js.map +1 -1
- package/package.json +42 -27
- package/README.md +0 -3
- package/dist/src/server/middleware.d.ts +0 -3
- package/dist/src/server/middleware.js +0 -47
- package/dist/src/server/middleware.js.map +0 -1
- package/dist/src/test/setup.js +0 -9
- package/dist/src/test/setup.js.map +0 -1
- package/dist/src/web/use-openai-global.d.ts +0 -2
- package/dist/src/web/use-openai-global.js +0 -21
- package/dist/src/web/use-openai-global.js.map +0 -1
- package/dist/src/web/use-tool-output.d.ts +0 -3
- package/dist/src/web/use-tool-output.js +0 -5
- package/dist/src/web/use-tool-output.js.map +0 -1
- /package/dist/src/{test/setup.d.ts → web/bridges/hooks/use-mcp-app-bridge.test.d.ts} +0 -0
package/dist/src/web/types.d.ts
CHANGED
|
@@ -1,14 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import "react";
|
|
2
|
+
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
|
|
3
|
+
import type { WidgetHostType } from "../server/index.js";
|
|
4
|
+
declare module "react" {
|
|
5
|
+
interface HTMLAttributes<T> {
|
|
6
|
+
"data-llm"?: string;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export type UnknownObject = Record<string, unknown>;
|
|
10
|
+
export type Prettify<T> = {
|
|
11
|
+
[K in keyof T]: T[K];
|
|
12
|
+
} & {};
|
|
13
|
+
export type Objectify<T> = T & UnknownObject;
|
|
14
|
+
type RequiredKeys<T> = {
|
|
15
|
+
[K in keyof T]-?: Record<string, never> extends Pick<T, K> ? never : K;
|
|
16
|
+
}[keyof T];
|
|
17
|
+
export type HasRequiredKeys<T> = RequiredKeys<T> extends never ? false : true;
|
|
18
|
+
type WidgetState = UnknownObject;
|
|
19
|
+
type FileMetadata = {
|
|
20
|
+
fileId: string;
|
|
21
|
+
};
|
|
12
22
|
export declare const TOOL_RESPONSE_EVENT_TYPE = "openai:tool_response";
|
|
13
23
|
export declare class ToolResponseEvent extends CustomEvent<{
|
|
14
24
|
tool: {
|
|
@@ -20,36 +30,58 @@ export declare class ToolResponseEvent extends CustomEvent<{
|
|
|
20
30
|
}
|
|
21
31
|
declare global {
|
|
22
32
|
interface Window {
|
|
23
|
-
|
|
33
|
+
skybridge: SkybridgeProperties;
|
|
34
|
+
openai: OpenAiMethods<WidgetState> & OpenAiProperties;
|
|
24
35
|
}
|
|
25
36
|
interface WindowEventMap {
|
|
26
37
|
[SET_GLOBALS_EVENT_TYPE]: SetGlobalsEvent;
|
|
27
38
|
}
|
|
28
39
|
}
|
|
29
|
-
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> = {
|
|
30
44
|
theme: Theme;
|
|
31
45
|
userAgent: UserAgent;
|
|
32
46
|
locale: string;
|
|
33
47
|
maxHeight: number;
|
|
34
48
|
displayMode: DisplayMode;
|
|
35
49
|
safeArea: SafeArea;
|
|
50
|
+
view: View;
|
|
36
51
|
toolInput: ToolInput;
|
|
37
|
-
toolOutput: ToolOutput |
|
|
52
|
+
toolOutput: ToolOutput | {
|
|
53
|
+
text: string;
|
|
54
|
+
} | null;
|
|
38
55
|
toolResponseMetadata: ToolResponseMetadata | null;
|
|
39
56
|
widgetState: WidgetState | null;
|
|
40
57
|
};
|
|
58
|
+
export type CallToolArgs = Record<string, unknown> | null;
|
|
41
59
|
export type CallToolResponse = {
|
|
60
|
+
content: CallToolResult["content"];
|
|
61
|
+
structuredContent: Record<string, unknown>;
|
|
62
|
+
isError: boolean;
|
|
42
63
|
result: string;
|
|
64
|
+
meta: Record<string, unknown>;
|
|
43
65
|
};
|
|
44
|
-
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> = {
|
|
45
77
|
/** Calls a tool on your MCP. Returns the full response. */
|
|
46
|
-
callTool: (name: string, args:
|
|
78
|
+
callTool: <ToolArgs extends CallToolArgs = null, ToolResponse extends CallToolResponse = CallToolResponse>(name: string, args: ToolArgs) => Promise<ToolResponse>;
|
|
47
79
|
/** Triggers a followup turn in the ChatGPT conversation */
|
|
48
80
|
sendFollowUpMessage: (args: {
|
|
49
81
|
prompt: string;
|
|
50
82
|
}) => Promise<void>;
|
|
51
83
|
/** Opens an external link, redirects web page or mobile app */
|
|
52
|
-
openExternal(
|
|
84
|
+
openExternal(args: {
|
|
53
85
|
href: string;
|
|
54
86
|
}): void;
|
|
55
87
|
/** For transitioning an app from inline to fullscreen or pip */
|
|
@@ -62,16 +94,38 @@ type API<WidgetState extends UnknownObject> = {
|
|
|
62
94
|
*/
|
|
63
95
|
mode: DisplayMode;
|
|
64
96
|
}>;
|
|
97
|
+
/**
|
|
98
|
+
* Sets the widget state.
|
|
99
|
+
* This state is persisted across widget renders.
|
|
100
|
+
*/
|
|
65
101
|
setWidgetState: (state: WidgetState) => Promise<void>;
|
|
102
|
+
/**
|
|
103
|
+
* Opens a modal portaled outside of the widget iFrame.
|
|
104
|
+
* This ensures the modal is correctly displayed and not limited to the widget's area.
|
|
105
|
+
*/
|
|
106
|
+
requestModal: (args: RequestModalOptions) => Promise<void>;
|
|
107
|
+
/** Uploads a new file to the host */
|
|
108
|
+
uploadFile: (file: File) => Promise<FileMetadata>;
|
|
109
|
+
/**
|
|
110
|
+
* Downloads a file from the host that was previously uploaded.
|
|
111
|
+
* Only files uploaded by the same connector instance can be downloaded.
|
|
112
|
+
*/
|
|
113
|
+
downloadFile: (file: FileMetadata) => Promise<{
|
|
114
|
+
downloadUrl: string;
|
|
115
|
+
}>;
|
|
66
116
|
};
|
|
67
117
|
export declare const SET_GLOBALS_EVENT_TYPE = "openai:set_globals";
|
|
68
118
|
export declare class SetGlobalsEvent extends CustomEvent<{
|
|
69
|
-
globals: Partial<
|
|
119
|
+
globals: Partial<OpenAiProperties>;
|
|
70
120
|
}> {
|
|
71
121
|
readonly type = "openai:set_globals";
|
|
72
122
|
}
|
|
73
123
|
export type CallTool = (name: string, args: Record<string, unknown>) => Promise<CallToolResponse>;
|
|
74
|
-
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
|
+
};
|
|
75
129
|
export type Theme = "light" | "dark";
|
|
76
130
|
export type SafeAreaInsets = {
|
|
77
131
|
top: number;
|
package/dist/src/web/types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/web/types.ts"],"names":[],"mappings":"
|
|
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/dist/vitest.config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vitest.config.js","sourceRoot":"","sources":["../vitest.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,eAAe,YAAY,CAAC;IAC1B,IAAI,EAAE;QACJ,WAAW,EAAE,OAAO;QACpB,OAAO,EAAE,IAAI;
|
|
1
|
+
{"version":3,"file":"vitest.config.js","sourceRoot":"","sources":["../vitest.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,eAAe,YAAY,CAAC;IAC1B,IAAI,EAAE;QACJ,WAAW,EAAE,OAAO;QACpB,OAAO,EAAE,IAAI;KACd;CACF,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,27 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "skybridge",
|
|
3
|
-
"version": "0.0.0-dev.
|
|
3
|
+
"version": "0.0.0-dev.ea4a1cd",
|
|
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"
|
|
8
12
|
],
|
|
9
13
|
"exports": {
|
|
10
14
|
"./server": {
|
|
11
|
-
"types": "./dist/server/index.d.ts",
|
|
12
|
-
"default": "./dist/server/index.js"
|
|
15
|
+
"types": "./dist/src/server/index.d.ts",
|
|
16
|
+
"default": "./dist/src/server/index.js"
|
|
13
17
|
},
|
|
14
18
|
"./web": {
|
|
15
|
-
"types": "./dist/web/index.d.ts",
|
|
16
|
-
"default": "./dist/web/index.js"
|
|
19
|
+
"types": "./dist/src/web/index.d.ts",
|
|
20
|
+
"default": "./dist/src/web/index.js"
|
|
17
21
|
}
|
|
18
22
|
},
|
|
19
|
-
"scripts": {
|
|
20
|
-
"build": "tsc",
|
|
21
|
-
"test": "vitest",
|
|
22
|
-
"test:ui": "vitest --ui",
|
|
23
|
-
"test:run": "vitest run"
|
|
24
|
-
},
|
|
25
23
|
"keywords": [
|
|
26
24
|
"chatgpt",
|
|
27
25
|
"app",
|
|
@@ -31,29 +29,46 @@
|
|
|
31
29
|
"author": "Frédéric Barthelet",
|
|
32
30
|
"license": "ISC",
|
|
33
31
|
"peerDependencies": {
|
|
34
|
-
"
|
|
35
|
-
"react
|
|
32
|
+
"@modelcontextprotocol/sdk": ">=1.25.1",
|
|
33
|
+
"react": ">=18.3.1",
|
|
34
|
+
"react-dom": ">=18.3.1"
|
|
36
35
|
},
|
|
37
36
|
"dependencies": {
|
|
38
|
-
"@
|
|
37
|
+
"@babel/core": "^7.28.5",
|
|
39
38
|
"cors": "^2.8.5",
|
|
40
|
-
"
|
|
39
|
+
"dequal": "^2.0.3",
|
|
40
|
+
"express": "^5.2.1",
|
|
41
41
|
"handlebars": "^4.7.8",
|
|
42
|
-
"
|
|
43
|
-
"
|
|
42
|
+
"superjson": "^2.2.6",
|
|
43
|
+
"vite": "^7.3.0",
|
|
44
|
+
"zustand": "^5.0.9"
|
|
44
45
|
},
|
|
45
46
|
"devDependencies": {
|
|
47
|
+
"@modelcontextprotocol/ext-apps": "^0.2.2",
|
|
48
|
+
"@modelcontextprotocol/sdk": "^1.25.1",
|
|
49
|
+
"@testing-library/dom": "^10.4.1",
|
|
50
|
+
"@testing-library/react": "^16.3.1",
|
|
46
51
|
"@total-typescript/tsconfig": "^1.0.4",
|
|
52
|
+
"@types/babel__core": "^7.20.5",
|
|
47
53
|
"@types/cors": "^2.8.19",
|
|
48
|
-
"@types/express": "^5.0.
|
|
49
|
-
"@types/
|
|
50
|
-
"@types/
|
|
51
|
-
"@types/react
|
|
52
|
-
"@types/
|
|
53
|
-
"@vitest/ui": "^2.1.
|
|
54
|
-
"jsdom": "^
|
|
54
|
+
"@types/express": "^5.0.6",
|
|
55
|
+
"@types/jsdom": "^27.0.0",
|
|
56
|
+
"@types/node": "^22.19.3",
|
|
57
|
+
"@types/react": "^19.2.7",
|
|
58
|
+
"@types/react-dom": "^19.2.3",
|
|
59
|
+
"@vitest/ui": "^2.1.9",
|
|
60
|
+
"jsdom": "^27.4.0",
|
|
55
61
|
"typescript": "^5.9.3",
|
|
56
|
-
"vitest": "^2.1.
|
|
62
|
+
"vitest": "^2.1.9",
|
|
63
|
+
"zod": "^4.3.5"
|
|
57
64
|
},
|
|
58
|
-
"
|
|
59
|
-
|
|
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,47 +0,0 @@
|
|
|
1
|
-
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
|
|
2
|
-
import {} from "express";
|
|
3
|
-
export const mcp = (server) => async (req, res, next) => {
|
|
4
|
-
// Only handle requests to the /mcp path
|
|
5
|
-
if (req.path !== "/mcp") {
|
|
6
|
-
return next();
|
|
7
|
-
}
|
|
8
|
-
if (req.method === "POST") {
|
|
9
|
-
try {
|
|
10
|
-
const transport = new StreamableHTTPServerTransport({
|
|
11
|
-
sessionIdGenerator: undefined,
|
|
12
|
-
});
|
|
13
|
-
res.on("close", () => {
|
|
14
|
-
transport.close();
|
|
15
|
-
});
|
|
16
|
-
await server.connect(transport);
|
|
17
|
-
await transport.handleRequest(req, res, req.body);
|
|
18
|
-
}
|
|
19
|
-
catch (error) {
|
|
20
|
-
console.error("Error handling MCP request:", error);
|
|
21
|
-
if (!res.headersSent) {
|
|
22
|
-
res.status(500).json({
|
|
23
|
-
jsonrpc: "2.0",
|
|
24
|
-
error: {
|
|
25
|
-
code: -32603,
|
|
26
|
-
message: "Internal server error",
|
|
27
|
-
},
|
|
28
|
-
id: null,
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
else if (req.method === "GET" || req.method === "DELETE") {
|
|
34
|
-
res.writeHead(405).end(JSON.stringify({
|
|
35
|
-
jsonrpc: "2.0",
|
|
36
|
-
error: {
|
|
37
|
-
code: -32000,
|
|
38
|
-
message: "Method not allowed.",
|
|
39
|
-
},
|
|
40
|
-
id: null,
|
|
41
|
-
}));
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
next();
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
//# sourceMappingURL=middleware.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"middleware.js","sourceRoot":"","sources":["../../../src/server/middleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AACnG,OAAO,EAAkD,MAAM,SAAS,CAAC;AAIzE,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,MAAiB,EAAE,EAAE,CAAC,KAAK,EAAE,GAAY,EAAE,GAAa,EAAE,IAAkB,EAAE,EAAE;IAClG,wCAAwC;IACxC,IAAI,GAAG,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;QACxB,OAAO,IAAI,EAAE,CAAC;IAChB,CAAC;IAED,IAAI,GAAG,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;QAC1B,IAAI,CAAC;YACH,MAAM,SAAS,GAAG,IAAI,6BAA6B,CAAC;gBAClD,kBAAkB,EAAE,SAAS;aAC9B,CAAC,CAAC;YAEH,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;gBACnB,SAAS,CAAC,KAAK,EAAE,CAAC;YACpB,CAAC,CAAC,CAAC;YAEH,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;YAEhC,MAAM,SAAS,CAAC,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;QACpD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,6BAA6B,EAAE,KAAK,CAAC,CAAC;YACpD,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC;gBACrB,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;oBACnB,OAAO,EAAE,KAAK;oBACd,KAAK,EAAE;wBACL,IAAI,EAAE,CAAC,KAAK;wBACZ,OAAO,EAAE,uBAAuB;qBACjC;oBACD,EAAE,EAAE,IAAI;iBACT,CAAC,CAAC;YACL,CAAC;QACH,CAAC;IACH,CAAC;SAAM,IAAI,GAAG,CAAC,MAAM,KAAK,KAAK,IAAI,GAAG,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC3D,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG,CACpB,IAAI,CAAC,SAAS,CAAC;YACb,OAAO,EAAE,KAAK;YACd,KAAK,EAAE;gBACL,IAAI,EAAE,CAAC,KAAK;gBACZ,OAAO,EAAE,qBAAqB;aAC/B;YACD,EAAE,EAAE,IAAI;SACT,CAAC,CACH,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,IAAI,EAAE,CAAC;IACT,CAAC;AACH,CAAC,CAAC"}
|
package/dist/src/test/setup.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../../src/test/setup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE5B,+CAA+C;AAC/C,MAAM,CAAC,OAAO,GAAG;IACf,GAAG,OAAO;IACV,KAAK,EAAE,EAAE,CAAC,EAAE,EAAE;IACd,IAAI,EAAE,EAAE,CAAC,EAAE,EAAE;IACb,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE;CACb,CAAC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { useSyncExternalStore } from "react";
|
|
2
|
-
import { SET_GLOBALS_EVENT_TYPE, SetGlobalsEvent } from "./types.js";
|
|
3
|
-
export function useOpenAiGlobal(key) {
|
|
4
|
-
return useSyncExternalStore((onChange) => {
|
|
5
|
-
const handleSetGlobal = (event) => {
|
|
6
|
-
const value = event.detail.globals[key];
|
|
7
|
-
if (value === undefined) {
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
console.dir(event.detail.globals, { depth: Infinity });
|
|
11
|
-
onChange();
|
|
12
|
-
};
|
|
13
|
-
window.addEventListener(SET_GLOBALS_EVENT_TYPE, handleSetGlobal, {
|
|
14
|
-
passive: true,
|
|
15
|
-
});
|
|
16
|
-
return () => {
|
|
17
|
-
window.removeEventListener(SET_GLOBALS_EVENT_TYPE, handleSetGlobal);
|
|
18
|
-
};
|
|
19
|
-
}, () => window.openai?.[key]);
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=use-openai-global.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-openai-global.js","sourceRoot":"","sources":["../../../src/web/use-openai-global.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAsB,MAAM,YAAY,CAAC;AAEzF,MAAM,UAAU,eAAe,CAAgC,GAAM;IACnE,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,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;YACvD,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,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAC3B,CAAC;AACJ,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-tool-output.js","sourceRoot":"","sources":["../../../src/web/use-tool-output.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,MAAM,UAAU,aAAa;IAC3B,OAAO,eAAe,CAAC,YAAY,CAAC,CAAC;AACvC,CAAC"}
|
|
File without changes
|