skybridge 0.0.0-dev.b33fb3f → 0.0.0-dev.b570187
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/README.md +413 -1
- package/dist/src/emulator/dist/assets/index-BZr5jCa4.js +9 -0
- package/dist/src/emulator/dist/assets/index-DmQYZ06G.css +1 -0
- package/dist/src/emulator/dist/index.html +14 -0
- package/dist/src/emulator/dist/vite.svg +1 -0
- package/dist/src/emulator/eslint.config.d.ts +2 -0
- package/dist/src/emulator/eslint.config.js +23 -0
- package/dist/src/emulator/eslint.config.js.map +1 -0
- package/dist/src/emulator/postcss.config.d.ts +7 -0
- package/dist/src/emulator/postcss.config.js +7 -0
- package/dist/src/emulator/postcss.config.js.map +1 -0
- package/dist/src/emulator/src/App.d.ts +2 -0
- package/dist/src/emulator/src/App.js +100 -0
- package/dist/src/emulator/src/App.js.map +1 -0
- package/dist/src/emulator/src/components/Inspector.d.ts +8 -0
- package/dist/src/emulator/src/components/Inspector.js +14 -0
- package/dist/src/emulator/src/components/Inspector.js.map +1 -0
- package/dist/src/emulator/src/components/Logs.d.ts +10 -0
- package/dist/src/emulator/src/components/Logs.js +5 -0
- package/dist/src/emulator/src/components/Logs.js.map +1 -0
- package/dist/src/emulator/src/components/ToolList.d.ts +7 -0
- package/dist/src/emulator/src/components/ToolList.js +8 -0
- package/dist/src/emulator/src/components/ToolList.js.map +1 -0
- package/dist/src/emulator/src/components/Widget.d.ts +9 -0
- package/dist/src/emulator/src/components/Widget.js +10 -0
- package/dist/src/emulator/src/components/Widget.js.map +1 -0
- package/dist/src/emulator/src/lib/utils.d.ts +2 -0
- package/dist/src/emulator/src/lib/utils.js +6 -0
- package/dist/src/emulator/src/lib/utils.js.map +1 -0
- package/dist/src/emulator/src/main.d.ts +1 -0
- package/dist/src/emulator/src/main.js +7 -0
- package/dist/src/emulator/src/main.js.map +1 -0
- package/dist/src/emulator/src/types.d.ts +20 -0
- package/dist/src/emulator/src/types.js +2 -0
- package/dist/src/emulator/src/types.js.map +1 -0
- package/dist/src/emulator/tailwind.config.d.ts +50 -0
- package/dist/src/emulator/tailwind.config.js +51 -0
- package/dist/src/emulator/tailwind.config.js.map +1 -0
- package/dist/src/emulator/vite.config.d.ts +2 -0
- package/dist/src/emulator/vite.config.js +7 -0
- package/dist/src/emulator/vite.config.js.map +1 -0
- package/dist/src/server/emulatorStaticServer.d.ts +14 -0
- package/dist/src/server/emulatorStaticServer.js +41 -0
- package/dist/src/server/emulatorStaticServer.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 +54 -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 +45 -9
- package/dist/src/server/server.js +27 -11
- package/dist/src/server/server.js.map +1 -1
- package/dist/src/server/templateHelper.d.ts +9 -8
- package/dist/src/server/templateHelper.js +0 -8
- package/dist/src/server/templateHelper.js.map +1 -1
- package/dist/src/server/templates/development.hbs +8 -0
- package/dist/src/server/templates/production.hbs +3 -2
- package/dist/src/server/widgetsDevServer.d.ts +5 -2
- package/dist/src/server/widgetsDevServer.js +6 -3
- package/dist/src/server/widgetsDevServer.js.map +1 -1
- package/dist/src/test/utils.d.ts +61 -0
- package/dist/src/test/utils.js +122 -1
- package/dist/src/test/utils.js.map +1 -1
- package/dist/src/test/widget.test.js +24 -6
- package/dist/src/test/widget.test.js.map +1 -1
- 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.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 +113 -0
- package/dist/src/web/generate-helpers.js +109 -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 +153 -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 +171 -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/{use-openai-global.d.ts → hooks/use-openai-global.d.ts} +1 -1
- package/dist/src/web/{use-openai-global.js → hooks/use-openai-global.js} +4 -2
- 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 +22 -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 +74 -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 +5 -2
- package/dist/src/web/index.js +5 -2
- 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 +33 -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 +48 -0
- package/dist/src/web/proxy.js.map +1 -0
- package/dist/src/web/types.d.ts +53 -15
- 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 +17 -7
- 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/server/templates/vite-client.hbs +0 -7
- package/dist/src/test/setup.js +0 -9
- package/dist/src/test/setup.js.map +0 -1
- 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/create-store.test.d.ts} +0 -0
package/dist/src/web/types.d.ts
CHANGED
|
@@ -1,14 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
export type
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import "react";
|
|
2
|
+
declare module "react" {
|
|
3
|
+
interface HTMLAttributes<T extends Element = HTMLElement> {
|
|
4
|
+
"data-llm"?: string;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
export type UnknownObject = Record<string, unknown>;
|
|
8
|
+
export type Prettify<T> = {
|
|
9
|
+
[K in keyof T]: T[K];
|
|
10
|
+
} & {};
|
|
11
|
+
export type Objectify<T> = T & UnknownObject;
|
|
12
|
+
type RequiredKeys<T> = {
|
|
13
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? never : K;
|
|
14
|
+
}[keyof T];
|
|
15
|
+
export type HasRequiredKeys<T> = RequiredKeys<T> extends never ? false : true;
|
|
16
|
+
type WidgetState = UnknownObject;
|
|
17
|
+
type FileMetadata = {
|
|
18
|
+
fileId: string;
|
|
19
|
+
};
|
|
12
20
|
export declare const TOOL_RESPONSE_EVENT_TYPE = "openai:tool_response";
|
|
13
21
|
export declare class ToolResponseEvent extends CustomEvent<{
|
|
14
22
|
tool: {
|
|
@@ -26,7 +34,7 @@ declare global {
|
|
|
26
34
|
[SET_GLOBALS_EVENT_TYPE]: SetGlobalsEvent;
|
|
27
35
|
}
|
|
28
36
|
}
|
|
29
|
-
export type OpenAiGlobals<ToolInput extends UnknownObject =
|
|
37
|
+
export type OpenAiGlobals<ToolInput extends UnknownObject = {}, ToolOutput extends UnknownObject = UnknownObject, ToolResponseMetadata extends UnknownObject = UnknownObject, WidgetState extends UnknownObject = UnknownObject> = {
|
|
30
38
|
theme: Theme;
|
|
31
39
|
userAgent: UserAgent;
|
|
32
40
|
locale: string;
|
|
@@ -34,22 +42,32 @@ export type OpenAiGlobals<ToolInput extends UnknownObject = UnknownObject, ToolO
|
|
|
34
42
|
displayMode: DisplayMode;
|
|
35
43
|
safeArea: SafeArea;
|
|
36
44
|
toolInput: ToolInput;
|
|
37
|
-
toolOutput: ToolOutput |
|
|
45
|
+
toolOutput: ToolOutput | {
|
|
46
|
+
text: string;
|
|
47
|
+
} | null;
|
|
38
48
|
toolResponseMetadata: ToolResponseMetadata | null;
|
|
39
49
|
widgetState: WidgetState | null;
|
|
40
50
|
};
|
|
51
|
+
export type CallToolArgs = Record<string, unknown> | null;
|
|
41
52
|
export type CallToolResponse = {
|
|
53
|
+
content: {
|
|
54
|
+
type: "text";
|
|
55
|
+
text: string;
|
|
56
|
+
}[];
|
|
57
|
+
structuredContent: Record<string, unknown>;
|
|
58
|
+
isError: boolean;
|
|
42
59
|
result: string;
|
|
60
|
+
meta: Record<string, unknown>;
|
|
43
61
|
};
|
|
44
62
|
type API<WidgetState extends UnknownObject> = {
|
|
45
63
|
/** Calls a tool on your MCP. Returns the full response. */
|
|
46
|
-
callTool: (name: string, args:
|
|
64
|
+
callTool: <ToolArgs extends CallToolArgs = null, ToolResponse extends CallToolResponse = CallToolResponse>(name: string, args: ToolArgs) => Promise<ToolResponse>;
|
|
47
65
|
/** Triggers a followup turn in the ChatGPT conversation */
|
|
48
66
|
sendFollowUpMessage: (args: {
|
|
49
67
|
prompt: string;
|
|
50
68
|
}) => Promise<void>;
|
|
51
69
|
/** Opens an external link, redirects web page or mobile app */
|
|
52
|
-
openExternal(
|
|
70
|
+
openExternal(args: {
|
|
53
71
|
href: string;
|
|
54
72
|
}): void;
|
|
55
73
|
/** For transitioning an app from inline to fullscreen or pip */
|
|
@@ -62,7 +80,27 @@ type API<WidgetState extends UnknownObject> = {
|
|
|
62
80
|
*/
|
|
63
81
|
mode: DisplayMode;
|
|
64
82
|
}>;
|
|
83
|
+
/**
|
|
84
|
+
* Sets the widget state.
|
|
85
|
+
* This state is persisted across widget renders.
|
|
86
|
+
*/
|
|
65
87
|
setWidgetState: (state: WidgetState) => Promise<void>;
|
|
88
|
+
/**
|
|
89
|
+
* Opens a modal portaled outside of the widget iFrame.
|
|
90
|
+
* This ensures the modal is correctly displayed and not limited to the widget's area.
|
|
91
|
+
*/
|
|
92
|
+
requestModal: (args: {
|
|
93
|
+
title: string;
|
|
94
|
+
}) => Promise<void>;
|
|
95
|
+
/** Uploads a new file to the host */
|
|
96
|
+
uploadFile: (file: File) => Promise<FileMetadata>;
|
|
97
|
+
/**
|
|
98
|
+
* Downloads a file from the host that was previously uploaded.
|
|
99
|
+
* Only files uploaded by the same connector instance can be downloaded.
|
|
100
|
+
*/
|
|
101
|
+
downloadFile: (file: FileMetadata) => Promise<{
|
|
102
|
+
downloadUrl: string;
|
|
103
|
+
}>;
|
|
66
104
|
};
|
|
67
105
|
export declare const SET_GLOBALS_EVENT_TYPE = "openai:set_globals";
|
|
68
106
|
export declare class SetGlobalsEvent extends CustomEvent<{
|
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;AAuBf,MAAM,CAAC,MAAM,wBAAwB,GAAG,sBAAsB,CAAC;AAC/D,MAAM,OAAO,iBAAkB,SAAQ,WAErC;IACkB,IAAI,GAAG,wBAAwB,CAAC;CACnD;AA8FD,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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "skybridge",
|
|
3
|
-
"version": "0.0.0-dev.
|
|
3
|
+
"version": "0.0.0-dev.b570187",
|
|
4
4
|
"description": "Skybridge is a framework for building ChatGPT apps",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -17,11 +17,15 @@
|
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
19
|
"scripts": {
|
|
20
|
-
"build": "
|
|
20
|
+
"build": "tsc && pnpm run build:templates && pnpm run build:emulator",
|
|
21
21
|
"build:templates": "cp -r src/server/templates dist/src/server/",
|
|
22
|
-
"
|
|
23
|
-
"test
|
|
24
|
-
"test:
|
|
22
|
+
"build:emulator": "pnpm --filter emulator build && cp -r src/emulator/dist dist/src/emulator/",
|
|
23
|
+
"test": "pnpm run test:unit && pnpm run test:type",
|
|
24
|
+
"test:unit": "vitest run",
|
|
25
|
+
"test:type": "tsc --noEmit",
|
|
26
|
+
"docs:dev": "pnpm --filter @skybridge/docs start",
|
|
27
|
+
"docs:build": "pnpm --filter @skybridge/docs build",
|
|
28
|
+
"docs:serve": "pnpm --filter @skybridge/docs serve"
|
|
25
29
|
},
|
|
26
30
|
"keywords": [
|
|
27
31
|
"chatgpt",
|
|
@@ -36,21 +40,27 @@
|
|
|
36
40
|
"react-dom": ">=18.0.0"
|
|
37
41
|
},
|
|
38
42
|
"dependencies": {
|
|
43
|
+
"@babel/core": "^7.28.5",
|
|
39
44
|
"@modelcontextprotocol/sdk": "^1.20.0",
|
|
40
45
|
"cors": "^2.8.5",
|
|
41
46
|
"express": "^5.1.0",
|
|
42
47
|
"handlebars": "^4.7.8",
|
|
48
|
+
"superjson": "^2.2.6",
|
|
43
49
|
"vite": "^7.1.11",
|
|
44
|
-
"zod": "^3.25.51"
|
|
50
|
+
"zod": "^3.25.51",
|
|
51
|
+
"zustand": "^5.0.9"
|
|
45
52
|
},
|
|
46
53
|
"devDependencies": {
|
|
54
|
+
"@testing-library/dom": "^10.4.1",
|
|
55
|
+
"@testing-library/react": "^16.3.0",
|
|
47
56
|
"@total-typescript/tsconfig": "^1.0.4",
|
|
57
|
+
"@types/babel__core": "^7.20.5",
|
|
48
58
|
"@types/cors": "^2.8.19",
|
|
49
59
|
"@types/express": "^5.0.3",
|
|
60
|
+
"@types/jsdom": "^21.1.6",
|
|
50
61
|
"@types/node": "^22.15.30",
|
|
51
62
|
"@types/react": "^19.2.2",
|
|
52
63
|
"@types/react-dom": "^19.2.2",
|
|
53
|
-
"@types/jsdom": "^21.1.6",
|
|
54
64
|
"@vitest/ui": "^2.1.8",
|
|
55
65
|
"jsdom": "^25.0.1",
|
|
56
66
|
"typescript": "^5.9.3",
|
|
@@ -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"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
<script type="module">import { injectIntoGlobalHook } from "{{serverUrl}}/@react-refresh";
|
|
2
|
-
injectIntoGlobalHook(window); window.$RefreshReg$ = () => {};
|
|
3
|
-
window.$RefreshSig$ = () => (type) => type;
|
|
4
|
-
window.__vite_plugin_react_preamble_installed__ = true;
|
|
5
|
-
</script>
|
|
6
|
-
|
|
7
|
-
<script type="module" src="{{serverUrl}}/@vite/client"></script>
|
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 +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
|