skybridge 0.0.0-dev.f3e11a3 → 0.0.0-dev.f3fc72c
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 -0
- package/dist/src/server/index.d.ts +0 -1
- package/dist/src/server/index.js +0 -1
- package/dist/src/server/index.js.map +1 -1
- package/dist/src/server/server.d.ts +28 -1
- package/dist/src/server/server.js +53 -15
- package/dist/src/server/server.js.map +1 -1
- package/dist/src/server/templates/development.hbs +55 -2
- package/dist/src/server/templates/production.hbs +1 -1
- package/dist/src/server/widgetsDevServer.d.ts +2 -2
- package/dist/src/server/widgetsDevServer.js +11 -3
- package/dist/src/server/widgetsDevServer.js.map +1 -1
- package/dist/src/test/widget.test.js +103 -12
- 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 +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.d.ts +2 -3
- package/dist/src/web/bridges/hooks/use-bridge.js +5 -24
- 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 +1 -1
- 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 -0
- package/dist/src/web/bridges/index.js +1 -0
- package/dist/src/web/bridges/index.js.map +1 -1
- package/dist/src/web/bridges/mcp-app-bridge.d.ts +19 -7
- package/dist/src/web/bridges/mcp-app-bridge.js +58 -26
- package/dist/src/web/bridges/mcp-app-bridge.js.map +1 -1
- package/dist/src/web/bridges/types.d.ts +57 -0
- package/dist/src/web/bridges/types.js +2 -0
- package/dist/src/web/bridges/types.js.map +1 -0
- package/dist/src/web/data-llm.js +4 -2
- package/dist/src/web/data-llm.js.map +1 -1
- package/dist/src/web/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.d.ts +1 -1
- package/dist/src/web/hooks/use-call-tool.js +12 -4
- package/dist/src/web/hooks/use-call-tool.js.map +1 -1
- package/dist/src/web/hooks/use-call-tool.test-d.js +1 -1
- package/dist/src/web/hooks/use-call-tool.test-d.js.map +1 -1
- package/dist/src/web/hooks/use-call-tool.test.js +28 -3
- package/dist/src/web/hooks/use-call-tool.test.js.map +1 -1
- package/dist/src/web/hooks/use-display-mode.d.ts +1 -1
- package/dist/src/web/hooks/use-display-mode.js +6 -3
- package/dist/src/web/hooks/use-display-mode.js.map +1 -1
- package/dist/src/web/hooks/use-layout.js +3 -3
- package/dist/src/web/hooks/use-layout.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 +3 -6
- package/dist/src/web/hooks/use-send-follow-up-message.js.map +1 -1
- package/dist/src/web/hooks/use-tool-info.d.ts +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.js +2 -2
- package/dist/src/web/hooks/use-user.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/dist/src/web/types.d.ts +3 -5
- package/dist/src/web/types.js.map +1 -1
- package/package.json +29 -26
- package/dist/src/server/devtoolsStaticServer.d.ts +0 -15
- package/dist/src/server/devtoolsStaticServer.js +0 -38
- package/dist/src/server/devtoolsStaticServer.js.map +0 -1
|
@@ -1,44 +1,93 @@
|
|
|
1
|
-
import { renderHook } from "@testing-library/react";
|
|
1
|
+
import { renderHook, waitFor } from "@testing-library/react";
|
|
2
2
|
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
3
|
+
import { McpAppAdaptor } from "../bridges/adaptors/mcp-app-adaptor.js";
|
|
4
|
+
import { McpAppBridge } from "../bridges/mcp-app-bridge.js";
|
|
5
|
+
import { getMcpAppHostPostMessageMock } from "./test/utils.js";
|
|
3
6
|
import { useUser } from "./use-user.js";
|
|
4
7
|
describe("useUser", () => {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
describe("apps-sdk host type", () => {
|
|
9
|
+
let OpenaiMock;
|
|
10
|
+
beforeEach(() => {
|
|
11
|
+
OpenaiMock = {
|
|
12
|
+
locale: "en-US",
|
|
13
|
+
userAgent: {
|
|
14
|
+
device: { type: "desktop" },
|
|
15
|
+
capabilities: { hover: true, touch: false },
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
vi.stubGlobal("openai", OpenaiMock);
|
|
19
|
+
vi.stubGlobal("skybridge", { hostType: "apps-sdk" });
|
|
20
|
+
});
|
|
21
|
+
afterEach(() => {
|
|
22
|
+
vi.unstubAllGlobals();
|
|
23
|
+
vi.resetAllMocks();
|
|
24
|
+
});
|
|
25
|
+
it("should return locale and userAgent from window.openai", () => {
|
|
26
|
+
const { result } = renderHook(() => useUser());
|
|
27
|
+
expect(result.current.locale).toBe("en-US");
|
|
28
|
+
expect(result.current.userAgent).toEqual({
|
|
10
29
|
device: { type: "desktop" },
|
|
11
30
|
capabilities: { hover: true, touch: false },
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
it("should return mobile userAgent when set to mobile", () => {
|
|
34
|
+
OpenaiMock.userAgent = {
|
|
35
|
+
device: { type: "mobile" },
|
|
36
|
+
capabilities: { hover: false, touch: true },
|
|
37
|
+
};
|
|
38
|
+
const { result } = renderHook(() => useUser());
|
|
39
|
+
expect(result.current.userAgent.device.type).toBe("mobile");
|
|
40
|
+
expect(result.current.userAgent.capabilities.touch).toBe(true);
|
|
41
|
+
});
|
|
42
|
+
it("should return different locale when set", () => {
|
|
43
|
+
OpenaiMock.locale = "es-ES";
|
|
44
|
+
const { result } = renderHook(() => useUser());
|
|
45
|
+
expect(result.current.locale).toBe("es-ES");
|
|
27
46
|
});
|
|
28
47
|
});
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
48
|
+
describe("mcp-app host type", () => {
|
|
49
|
+
beforeEach(() => {
|
|
50
|
+
vi.stubGlobal("skybridge", { hostType: "mcp-app" });
|
|
51
|
+
});
|
|
52
|
+
afterEach(() => {
|
|
53
|
+
vi.unstubAllGlobals();
|
|
54
|
+
vi.resetAllMocks();
|
|
55
|
+
McpAppBridge.resetInstance();
|
|
56
|
+
McpAppAdaptor.resetInstance();
|
|
57
|
+
});
|
|
58
|
+
it("should return locale and userAgent from mcp host context", async () => {
|
|
59
|
+
vi.stubGlobal("parent", {
|
|
60
|
+
postMessage: getMcpAppHostPostMessageMock({
|
|
61
|
+
locale: "fr-FR",
|
|
62
|
+
platform: "web",
|
|
63
|
+
deviceCapabilities: { hover: true, touch: false },
|
|
64
|
+
}),
|
|
65
|
+
});
|
|
66
|
+
const { result } = renderHook(() => useUser());
|
|
67
|
+
await waitFor(() => {
|
|
68
|
+
expect(result.current.locale).toBe("fr-FR");
|
|
69
|
+
expect(result.current.userAgent).toEqual({
|
|
70
|
+
device: { type: "desktop" },
|
|
71
|
+
capabilities: { hover: true, touch: false },
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
it("should maintain userAgent referential stability when data has not changed", async () => {
|
|
76
|
+
vi.stubGlobal("parent", {
|
|
77
|
+
postMessage: getMcpAppHostPostMessageMock({
|
|
78
|
+
locale: "en-US",
|
|
79
|
+
platform: "web",
|
|
80
|
+
deviceCapabilities: { hover: true, touch: false },
|
|
81
|
+
}),
|
|
82
|
+
});
|
|
83
|
+
const { result, rerender } = renderHook(() => useUser());
|
|
84
|
+
await waitFor(() => {
|
|
85
|
+
expect(result.current.userAgent).toBeDefined();
|
|
86
|
+
});
|
|
87
|
+
const initialUserAgent = result.current.userAgent;
|
|
88
|
+
rerender();
|
|
89
|
+
expect(result.current.userAgent).toBe(initialUserAgent);
|
|
90
|
+
});
|
|
42
91
|
});
|
|
43
92
|
});
|
|
44
93
|
//# sourceMappingURL=use-user.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-user.test.js","sourceRoot":"","sources":["../../../../src/web/hooks/use-user.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"use-user.test.js","sourceRoot":"","sources":["../../../../src/web/hooks/use-user.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE5D,OAAO,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE;IACvB,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;QAClC,IAAI,UAGH,CAAC;QAEF,UAAU,CAAC,GAAG,EAAE;YACd,UAAU,GAAG;gBACX,MAAM,EAAE,OAAO;gBACf,SAAS,EAAE;oBACT,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;oBAC3B,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE;iBAC5C;aACF,CAAC;YACF,EAAE,CAAC,UAAU,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;YACpC,EAA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,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC;oBACvC,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;oBAC3B,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE;iBAC5C,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,2EAA2E,EAAE,KAAK,IAAI,EAAE;YACzF,EAAE,CAAC,UAAU,CAAC,QAAQ,EAAE;gBACtB,WAAW,EAAE,4BAA4B,CAAC;oBACxC,MAAM,EAAE,OAAO;oBACf,QAAQ,EAAE,KAAK;oBACf,kBAAkB,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE;iBAClD,CAAC;aACH,CAAC,CAAC;YACH,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;YAEzD,MAAM,OAAO,CAAC,GAAG,EAAE;gBACjB,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,CAAC;YACjD,CAAC,CAAC,CAAC;YAEH,MAAM,gBAAgB,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC;YAElD,QAAQ,EAAE,CAAC;YAEX,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAC1D,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -8,10 +8,12 @@ function createBabelPlugin(t) {
|
|
|
8
8
|
state.hasDataLLMImport = false;
|
|
9
9
|
state.needsDataLLMImport = false;
|
|
10
10
|
for (const node of path.node.body) {
|
|
11
|
-
if (!t.isImportDeclaration(node))
|
|
11
|
+
if (!t.isImportDeclaration(node)) {
|
|
12
12
|
continue;
|
|
13
|
-
|
|
13
|
+
}
|
|
14
|
+
if (node.source.value !== LLM_IMPORT_SOURCE) {
|
|
14
15
|
continue;
|
|
16
|
+
}
|
|
15
17
|
const hasSpecifier = node.specifiers.some((s) => t.isImportSpecifier(s) &&
|
|
16
18
|
t.isIdentifier(s.imported, { name: "DataLLM" }));
|
|
17
19
|
if (hasSpecifier) {
|
|
@@ -34,8 +36,9 @@ function createBabelPlugin(t) {
|
|
|
34
36
|
const attributes = opening.attributes;
|
|
35
37
|
const llmAttributeIndex = attributes.findIndex((attribute) => t.isJSXAttribute(attribute) &&
|
|
36
38
|
t.isJSXIdentifier(attribute.name, { name: "data-llm" }));
|
|
37
|
-
if (llmAttributeIndex === -1)
|
|
39
|
+
if (llmAttributeIndex === -1) {
|
|
38
40
|
return;
|
|
41
|
+
}
|
|
39
42
|
const llmAttribute = attributes[llmAttributeIndex];
|
|
40
43
|
let contentExpression;
|
|
41
44
|
if (t.isStringLiteral(llmAttribute.value)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform-data-llm.js","sourceRoot":"","sources":["../../../../src/web/plugin/transform-data-llm.ts"],"names":[],"mappings":"AAEA,MAAM,iBAAiB,GAAG,eAAe,CAAC;AAO1C,SAAS,iBAAiB,CAAC,CAAe;IACxC,OAAO;QACL,IAAI,EAAE,gBAAgB;QAEtB,OAAO,EAAE;YACP,OAAO,EAAE;gBACP,KAAK,CAAC,IAAI,EAAE,KAAK;oBACf,KAAK,CAAC,gBAAgB,GAAG,KAAK,CAAC;oBAC/B,KAAK,CAAC,kBAAkB,GAAG,KAAK,CAAC;oBAEjC,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;wBAClC,IAAI,CAAC,CAAC,CAAC,mBAAmB,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"transform-data-llm.js","sourceRoot":"","sources":["../../../../src/web/plugin/transform-data-llm.ts"],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,MAAM,CAAC,aAAa,CAAC,CAAC;IAEhE,MAAM,YAAY,GAAqB;QACrC,OAAO,EAAE,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;QAC/B,UAAU,EAAE;YACV,OAAO,EAAE,CAAC,KAAK,EAAE,YAAY,CAAC;SAC/B;QACD,QAAQ,EAAE,EAAE;QACZ,cAAc,EAAE,EAAE;KACnB,CAAC;IAEF,MAAM,MAAM,GAAG,aAAa,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;IAEjD,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QAC5B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO;QACL,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,GAAG,EAAE,MAAM,CAAC,GAAG,IAAI,IAAI;KACxB,CAAC;AACJ,CAAC,CAAC"}
|
package/dist/src/web/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import "react";
|
|
2
|
+
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
|
|
2
3
|
import type { WidgetHostType } from "../server/index.js";
|
|
3
4
|
declare module "react" {
|
|
4
5
|
interface HTMLAttributes<T> {
|
|
@@ -56,14 +57,11 @@ export type OpenAiProperties<ToolInput extends UnknownObject = Record<never, unk
|
|
|
56
57
|
};
|
|
57
58
|
export type CallToolArgs = Record<string, unknown> | null;
|
|
58
59
|
export type CallToolResponse = {
|
|
59
|
-
content:
|
|
60
|
-
type: "text";
|
|
61
|
-
text: string;
|
|
62
|
-
}[];
|
|
60
|
+
content: CallToolResult["content"];
|
|
63
61
|
structuredContent: Record<string, unknown>;
|
|
64
62
|
isError: boolean;
|
|
65
63
|
result: string;
|
|
66
|
-
|
|
64
|
+
_meta?: CallToolResult["_meta"];
|
|
67
65
|
};
|
|
68
66
|
export type RequestModalOptions = {
|
|
69
67
|
title?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/web/types.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/web/types.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,CAAC;AAyBf,MAAM,CAAC,MAAM,wBAAwB,GAAG,sBAAsB,CAAC;AAC/D,MAAM,OAAO,iBAAkB,SAAQ,WAErC;IACkB,IAAI,GAAG,wBAAwB,CAAC;CACnD;AAuGD,sDAAsD;AACtD,MAAM,CAAC,MAAM,sBAAsB,GAAG,oBAAoB,CAAC;AAC3D,MAAM,OAAO,eAAgB,SAAQ,WAEnC;IACkB,IAAI,GAAG,sBAAsB,CAAC;CACjD"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "skybridge",
|
|
3
|
-
"version": "0.0.0-dev.
|
|
3
|
+
"version": "0.0.0-dev.f3fc72c",
|
|
4
4
|
"description": "Skybridge is a framework for building ChatGPT apps",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/alpic-ai/skybridge.git"
|
|
8
|
+
},
|
|
5
9
|
"type": "module",
|
|
6
10
|
"files": [
|
|
7
11
|
"dist"
|
|
@@ -16,15 +20,6 @@
|
|
|
16
20
|
"default": "./dist/src/web/index.js"
|
|
17
21
|
}
|
|
18
22
|
},
|
|
19
|
-
"scripts": {
|
|
20
|
-
"build": "tsc && pnpm run build:templates",
|
|
21
|
-
"build:templates": "cp -r src/server/templates dist/src/server/",
|
|
22
|
-
"format": "biome check --write --error-on-warnings",
|
|
23
|
-
"test": "pnpm run test:unit && pnpm run test:type && pnpm run test:format",
|
|
24
|
-
"test:unit": "vitest run",
|
|
25
|
-
"test:type": "tsc --noEmit",
|
|
26
|
-
"test:format": "biome ci"
|
|
27
|
-
},
|
|
28
23
|
"keywords": [
|
|
29
24
|
"chatgpt",
|
|
30
25
|
"app",
|
|
@@ -41,31 +36,39 @@
|
|
|
41
36
|
"dependencies": {
|
|
42
37
|
"@babel/core": "^7.28.5",
|
|
43
38
|
"cors": "^2.8.5",
|
|
44
|
-
"
|
|
39
|
+
"dequal": "^2.0.3",
|
|
40
|
+
"es-toolkit": "^1.43.0",
|
|
41
|
+
"express": "^5.2.1",
|
|
45
42
|
"handlebars": "^4.7.8",
|
|
46
43
|
"superjson": "^2.2.6",
|
|
47
|
-
"vite": "^7.1
|
|
44
|
+
"vite": "^7.3.1",
|
|
48
45
|
"zustand": "^5.0.9"
|
|
49
46
|
},
|
|
50
47
|
"devDependencies": {
|
|
51
|
-
"@biomejs/biome": "2.3.8",
|
|
52
48
|
"@modelcontextprotocol/ext-apps": "^0.2.2",
|
|
53
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
49
|
+
"@modelcontextprotocol/sdk": "^1.25.2",
|
|
54
50
|
"@testing-library/dom": "^10.4.1",
|
|
55
|
-
"@testing-library/react": "^16.3.
|
|
51
|
+
"@testing-library/react": "^16.3.1",
|
|
56
52
|
"@total-typescript/tsconfig": "^1.0.4",
|
|
57
53
|
"@types/babel__core": "^7.20.5",
|
|
58
54
|
"@types/cors": "^2.8.19",
|
|
59
|
-
"@types/express": "^5.0.
|
|
60
|
-
"@types/jsdom": "^
|
|
61
|
-
"@types/
|
|
62
|
-
"@types/react": "^19.2.
|
|
63
|
-
"@
|
|
64
|
-
"
|
|
65
|
-
"jsdom": "^25.0.1",
|
|
55
|
+
"@types/express": "^5.0.6",
|
|
56
|
+
"@types/jsdom": "^27.0.0",
|
|
57
|
+
"@types/react": "^19.2.7",
|
|
58
|
+
"@types/react-dom": "^19.2.3",
|
|
59
|
+
"@vitest/ui": "^4.0.16",
|
|
60
|
+
"jsdom": "^27.4.0",
|
|
66
61
|
"typescript": "^5.9.3",
|
|
67
|
-
"vitest": "^
|
|
68
|
-
"zod": "^4.
|
|
62
|
+
"vitest": "^4.0.16",
|
|
63
|
+
"zod": "^4.3.5"
|
|
69
64
|
},
|
|
70
|
-
"
|
|
71
|
-
|
|
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
|
+
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { type RequestHandler } from "express";
|
|
2
|
-
/**
|
|
3
|
-
* Serve the built devtools React app
|
|
4
|
-
* This router serves static files from the devtools's dist directory.
|
|
5
|
-
* It should be installed at the application root, like so:
|
|
6
|
-
*
|
|
7
|
-
* const app = express();
|
|
8
|
-
*
|
|
9
|
-
* if (env.NODE_ENV !== "production") {
|
|
10
|
-
* app.use(await devtoolsStaticServer(server));
|
|
11
|
-
* app.use(await widgetsDevServer());
|
|
12
|
-
* ^^^^^^^^ Make sure to install the devtoolsStaticServer before the widgetsDevServer
|
|
13
|
-
* }
|
|
14
|
-
*/
|
|
15
|
-
export declare const devtoolsStaticServer: () => Promise<RequestHandler>;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from "node:fs";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import { fileURLToPath } from "node:url";
|
|
4
|
-
import cors from "cors";
|
|
5
|
-
import express, {} from "express";
|
|
6
|
-
/**
|
|
7
|
-
* Serve the built devtools React app
|
|
8
|
-
* This router serves static files from the devtools's dist directory.
|
|
9
|
-
* It should be installed at the application root, like so:
|
|
10
|
-
*
|
|
11
|
-
* const app = express();
|
|
12
|
-
*
|
|
13
|
-
* if (env.NODE_ENV !== "production") {
|
|
14
|
-
* app.use(await devtoolsStaticServer(server));
|
|
15
|
-
* app.use(await widgetsDevServer());
|
|
16
|
-
* ^^^^^^^^ Make sure to install the devtoolsStaticServer before the widgetsDevServer
|
|
17
|
-
* }
|
|
18
|
-
*/
|
|
19
|
-
export const devtoolsStaticServer = async () => {
|
|
20
|
-
const router = express.Router();
|
|
21
|
-
const currentDir = path.dirname(fileURLToPath(import.meta.url));
|
|
22
|
-
const devtoolsPath = path.join(currentDir, "..", "devtools");
|
|
23
|
-
router.use(cors());
|
|
24
|
-
router.use(express.static(devtoolsPath));
|
|
25
|
-
router.get("/", (_req, res, next) => {
|
|
26
|
-
const indexHtmlPath = path.join(devtoolsPath, "index.html");
|
|
27
|
-
try {
|
|
28
|
-
const indexHtml = readFileSync(indexHtmlPath, "utf-8");
|
|
29
|
-
res.setHeader("Content-Type", "text/html");
|
|
30
|
-
res.send(indexHtml);
|
|
31
|
-
}
|
|
32
|
-
catch (error) {
|
|
33
|
-
next(error);
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
return router;
|
|
37
|
-
};
|
|
38
|
-
//# sourceMappingURL=devtoolsStaticServer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"devtoolsStaticServer.js","sourceRoot":"","sources":["../../../src/server/devtoolsStaticServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,OAAO,EAAE,EAAuB,MAAM,SAAS,CAAC;AAEvD;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,IAA6B,EAAE;IACtE,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAChC,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAChE,MAAM,YAAY,GAAG,IAAI,CAA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