skybridge 0.0.0-dev.fb2322c → 0.0.0-dev.fb38eb7
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 +8 -4
- package/dist/cli/types.d.ts +5 -0
- package/dist/cli/types.js +2 -0
- package/dist/cli/types.js.map +1 -0
- package/dist/cli/use-nodemon.d.ts +1 -6
- package/dist/cli/use-nodemon.js +7 -3
- package/dist/cli/use-nodemon.js.map +1 -1
- package/dist/cli/use-tunnel.d.ts +8 -0
- package/dist/cli/use-tunnel.js +101 -0
- package/dist/cli/use-tunnel.js.map +1 -0
- package/dist/commands/dev.d.ts +1 -0
- package/dist/commands/dev.js +10 -2
- package/dist/commands/dev.js.map +1 -1
- package/dist/server/asset-base-url-transform-plugin.d.ts +5 -6
- package/dist/server/asset-base-url-transform-plugin.js +8 -9
- package/dist/server/asset-base-url-transform-plugin.js.map +1 -1
- package/dist/server/asset-base-url-transform-plugin.test.js +12 -13
- package/dist/server/asset-base-url-transform-plugin.test.js.map +1 -1
- package/dist/server/express.d.ts +1 -1
- package/dist/server/metric.d.ts +14 -0
- package/dist/server/metric.js +62 -0
- package/dist/server/metric.js.map +1 -0
- package/dist/server/server.js +17 -3
- package/dist/server/server.js.map +1 -1
- package/dist/server/widgetsDevServer.js +1 -6
- package/dist/server/widgetsDevServer.js.map +1 -1
- package/dist/test/widget.test.js +40 -0
- package/dist/test/widget.test.js.map +1 -1
- package/dist/version.d.ts +1 -0
- package/dist/version.js +5 -0
- package/dist/version.js.map +1 -0
- package/dist/web/bridges/mcp-app/adaptor.d.ts +4 -0
- package/dist/web/bridges/mcp-app/adaptor.js +78 -0
- package/dist/web/bridges/mcp-app/adaptor.js.map +1 -1
- package/dist/web/components/modal-provider.js +1 -1
- package/dist/web/components/modal-provider.js.map +1 -1
- package/dist/web/create-store.js +15 -1
- package/dist/web/create-store.js.map +1 -1
- package/dist/web/hooks/use-widget-state.test.js +114 -1
- package/dist/web/hooks/use-widget-state.test.js.map +1 -1
- package/dist/web/plugin/transform-data-llm.js +1 -1
- package/dist/web/plugin/transform-data-llm.js.map +1 -1
- package/package.json +9 -8
package/README.md
CHANGED
|
@@ -4,8 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
<br />
|
|
6
6
|
|
|
7
|
-
# Skybridge
|
|
8
|
-
|
|
9
7
|
**Build ChatGPT & MCP Apps. The Modern TypeScript Way.**
|
|
10
8
|
|
|
11
9
|
The fullstack TypeScript framework for AI-embedded widgets.<br />
|
|
@@ -33,9 +31,9 @@ ChatGPT Apps and MCP Apps let you embed **rich, interactive UIs** directly in AI
|
|
|
33
31
|
|
|
34
32
|
| | |
|
|
35
33
|
|:--|:--|
|
|
36
|
-
|
|
|
34
|
+
| 🌐 **Write once, run everywhere** — Skybridge works seamlessly with ChatGPT (Apps SDK) and MCP-compatible clients. | ✅ **End-to-End Type Safety** — tRPC-style inference from server to widget. Autocomplete everywhere. |
|
|
37
35
|
| 🔄 **Widget-to-Model Sync** — Keep the model aware of UI state with `data-llm`. Dual surfaces, one source of truth. | ⚒️ **React Query-style Hooks** — `isPending`, `isError`, callbacks. State management you already know. |
|
|
38
|
-
|
|
|
36
|
+
| 👨💻 **Full dev environment** — HMR, debug traces, and local devtools. | 📦 **Showcase Examples** — Production-ready examples to learn from and build upon. |
|
|
39
37
|
|
|
40
38
|
<br />
|
|
41
39
|
|
|
@@ -120,14 +118,20 @@ Explore production-ready examples:
|
|
|
120
118
|
|
|
121
119
|
| Example | Description | Demo | Code |
|
|
122
120
|
|------------------------|----------------------------------------------------------------------------------|-----------------------------------------------------|-------------------------------------------------------------------------------------|
|
|
121
|
+
| **Awaze — Cottage Search** | Holiday cottage search and booking experience — browse properties, filter by location, and explore availability | [Try Demo](https://mcp.cottages.com/try) | — |
|
|
123
122
|
| **Capitals Explorer** | Interactive world map with geolocation and Wikipedia integration | [Try Demo](https://capitals.skybridge.tech/try) | [View Code](https://github.com/alpic-ai/skybridge/tree/main/examples/capitals) |
|
|
124
123
|
| **Ecommerce Carousel** | Product carousel with cart, localization, and modals | [Try Demo](https://ecommerce.skybridge.tech/try) | [View Code](https://github.com/alpic-ai/skybridge/tree/main/examples/ecom-carousel) |
|
|
125
124
|
| **Everything** | Comprehensive playground showcasing all hooks and features | [Try Demo](https://everything.skybridge.tech/try) | [View Code](https://github.com/alpic-ai/skybridge/tree/main/examples/everything) |
|
|
126
125
|
| **Investigation Game** | Interactive murder mystery game with multi-screen gameplay and dynamic story progression | [Try Demo](https://investigation-game.skybridge.tech/try) | [View Code](https://github.com/alpic-ai/skybridge/tree/main/examples/investigation-game) |
|
|
127
126
|
| **Productivity** | Data visualization dashboard demonstrating Skybridge capabilities for MCP Apps | [Try Demo](https://productivity.skybridge.tech/try) | [View Code](https://github.com/alpic-ai/skybridge/tree/main/examples/productivity) |
|
|
128
127
|
| **Time's Up** | Word-guessing party game where the user gives hints and the AI tries to guess the secret word | [Try Demo](https://times-up.skybridge.tech/try) | [View Code](https://github.com/alpic-ai/skybridge/tree/main/examples/times-up) |
|
|
128
|
+
| **Lumo — Interactive AI Tutor** | Adaptive educational tutor with Mermaid.js diagrams, mind maps, quizzes, and fill-in-the-blank exercises | [Try Demo](https://lumo-mcp-app-39519fdd.alpic.live/try) | [View Code](https://github.com/connorads/lumo-mcp-app) |
|
|
129
|
+
| **Auth — Auth0** | Full OAuth authentication with Auth0 and personalized coffee shop search | — | [View Code](https://github.com/alpic-ai/skybridge/tree/main/examples/auth-auth0) |
|
|
129
130
|
| **Auth — Clerk** | Full OAuth authentication with Clerk and personalized coffee shop search | — | [View Code](https://github.com/alpic-ai/skybridge/tree/main/examples/auth-clerk) |
|
|
131
|
+
| **Auth — Stytch** | Full OAuth authentication with Stytch and personalized coffee shop search | — | [View Code](https://github.com/alpic-ai/skybridge/tree/main/examples/auth-stytch) |
|
|
130
132
|
| **Auth — WorkOS AuthKit** | Full OAuth authentication with WorkOS AuthKit and personalized coffee shop search | — | [View Code](https://github.com/alpic-ai/skybridge/tree/main/examples/auth-workos) |
|
|
133
|
+
| **Flight Booking** | Flight booking carousel with dynamic search and booking flow | [Try Demo](https://flight-booking.skybridge.tech/try) | [View Code](https://github.com/alpic-ai/skybridge/tree/main/examples/flight-booking) |
|
|
134
|
+
| **Generative UI** | Dynamic UI generation using json-render and Skybridge | [Try Demo](https://generative-ui.skybridge.tech/try) | [View Code](https://github.com/alpic-ai/skybridge/tree/main/examples/generative-ui) |
|
|
131
135
|
| **Manifest Starter** | Starter app with Manifest UI agentic components out-of-the-box | [Try Demo](https://manifest-ui.skybridge.tech/try) | [View Code](https://github.com/alpic-ai/skybridge/tree/main/examples/manifest-ui) |
|
|
132
136
|
|
|
133
137
|
See all examples in the [Showcase](https://docs.skybridge.tech/showcase) or browse the [examples/](examples/) directory.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/cli/types.ts"],"names":[],"mappings":""}
|
package/dist/cli/use-nodemon.js
CHANGED
|
@@ -24,7 +24,7 @@ export function useNodemon(env) {
|
|
|
24
24
|
setMessages((prev) => [
|
|
25
25
|
...prev,
|
|
26
26
|
{ id: randomUUID(), text: message, type: "log" },
|
|
27
|
-
]);
|
|
27
|
+
].slice(-10));
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
30
|
const handleStderrData = (chunk) => {
|
|
@@ -32,8 +32,12 @@ export function useNodemon(env) {
|
|
|
32
32
|
if (message) {
|
|
33
33
|
setMessages((prev) => [
|
|
34
34
|
...prev,
|
|
35
|
-
{
|
|
36
|
-
|
|
35
|
+
{
|
|
36
|
+
id: randomUUID(),
|
|
37
|
+
text: message,
|
|
38
|
+
type: "error",
|
|
39
|
+
},
|
|
40
|
+
].slice(-10));
|
|
37
41
|
}
|
|
38
42
|
};
|
|
39
43
|
const setupStdoutListener = () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-nodemon.js","sourceRoot":"","sources":["../../src/cli/use-nodemon.ts"],"names":[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C;QAEF,OAAO,CAAC,EAAE,CAAC,UAAU,EAAE,GAAG,EAAE;YAC1B,mBAAmB,EAAE,CAAC;YACtB,mBAAmB,EAAE,CAAC;QACxB,CAAC,CAAC,CAAC;QAEH,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,KAAe,EAAE,EAAE;YACxC,MAAM,cAAc,GAAG,yCAAyC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YACnF,WAAW,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;gBACpB,GAAG,IAAI;gBACP,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,SAAS,EAAE;aAC5D,CAAC,CAAC;YACH,mBAAmB,EAAE,CAAC;YACtB,mBAAmB,EAAE,CAAC;QACxB,CAAC,CAAC,CAAC;QAEH,OAAO,GAAG,EAAE;YACV,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;gBACnB,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;YAC/C,CAAC;YACD,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;gBACnB,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;YAC/C,CAAC;YACD,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACvB,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAEV,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import { randomUUID } from "node:crypto";
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
4
|
+
export function useTunnel(port) {
|
|
5
|
+
const [label, setLabel] = useState({
|
|
6
|
+
text: "Starting...",
|
|
7
|
+
color: "yellow",
|
|
8
|
+
});
|
|
9
|
+
const [logs, setLogs] = useState([]);
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
if (port === null) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
const tunnelProcess = spawn("npx", ["--yes", "alpic", "tunnel", "--port", String(port), "--plain"], {
|
|
15
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
16
|
+
});
|
|
17
|
+
let stderrBuffer = "";
|
|
18
|
+
let connected = false;
|
|
19
|
+
const timeout = setTimeout(() => {
|
|
20
|
+
if (!connected) {
|
|
21
|
+
setLabel({
|
|
22
|
+
text: "Tunnel connection timed out after one minute",
|
|
23
|
+
color: "red",
|
|
24
|
+
});
|
|
25
|
+
tunnelProcess.kill();
|
|
26
|
+
}
|
|
27
|
+
}, 60_000);
|
|
28
|
+
const pushLog = (text, type) => {
|
|
29
|
+
const time = new Date().toLocaleTimeString("en-US", {
|
|
30
|
+
hour: "numeric",
|
|
31
|
+
minute: "2-digit",
|
|
32
|
+
second: "2-digit",
|
|
33
|
+
hour12: true,
|
|
34
|
+
});
|
|
35
|
+
setLogs((prev) => [
|
|
36
|
+
...prev,
|
|
37
|
+
{
|
|
38
|
+
id: randomUUID(),
|
|
39
|
+
text: `${time} [tunnel] ${text}`,
|
|
40
|
+
type,
|
|
41
|
+
},
|
|
42
|
+
].slice(-10));
|
|
43
|
+
};
|
|
44
|
+
const handleStdout = (data) => {
|
|
45
|
+
const lines = data.toString().trim().split("\n").filter(Boolean);
|
|
46
|
+
for (const line of lines) {
|
|
47
|
+
if (connected) {
|
|
48
|
+
pushLog(line, "log");
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
const match = line.match(/Forwarding:\s+(https:\/\/\S+)\s*->\s*(\S+)/);
|
|
52
|
+
if (match?.[1]) {
|
|
53
|
+
connected = true;
|
|
54
|
+
clearTimeout(timeout);
|
|
55
|
+
setLabel({ text: line, color: "white" });
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
setLabel({ text: line, color: "yellow" });
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
const handleStderr = (data) => {
|
|
64
|
+
const text = data.toString().trim();
|
|
65
|
+
if (text) {
|
|
66
|
+
stderrBuffer = (stderrBuffer + text).slice(-1024);
|
|
67
|
+
for (const line of text.split("\n").filter(Boolean)) {
|
|
68
|
+
if (connected) {
|
|
69
|
+
pushLog(line, "error");
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
if (tunnelProcess.stdout) {
|
|
75
|
+
tunnelProcess.stdout.on("data", handleStdout);
|
|
76
|
+
}
|
|
77
|
+
if (tunnelProcess.stderr) {
|
|
78
|
+
tunnelProcess.stderr.on("data", handleStderr);
|
|
79
|
+
}
|
|
80
|
+
tunnelProcess.on("error", (err) => {
|
|
81
|
+
clearTimeout(timeout);
|
|
82
|
+
setLabel({ text: err.message, color: "red" });
|
|
83
|
+
});
|
|
84
|
+
tunnelProcess.on("close", (code) => {
|
|
85
|
+
clearTimeout(timeout);
|
|
86
|
+
if (code !== 0 && code !== null) {
|
|
87
|
+
const detail = stderrBuffer.trim() || `exited with code ${code}`;
|
|
88
|
+
setLabel({
|
|
89
|
+
text: `${detail}. Try manually: npx alpic tunnel --port ${port}`,
|
|
90
|
+
color: "red",
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
return () => {
|
|
95
|
+
clearTimeout(timeout);
|
|
96
|
+
tunnelProcess.kill();
|
|
97
|
+
};
|
|
98
|
+
}, [port]);
|
|
99
|
+
return { label: label.text, labelColor: label.color, logs };
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=use-tunnel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-tunnel.js","sourceRoot":"","sources":["../../src/cli/use-tunnel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAA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EAAE,CAAC;QACvB,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAEX,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC;AAC9D,CAAC"}
|
package/dist/commands/dev.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export default class Dev extends Command {
|
|
|
4
4
|
static examples: string[];
|
|
5
5
|
static flags: {
|
|
6
6
|
port: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
tunnel: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
7
8
|
};
|
|
8
9
|
run(): Promise<void>;
|
|
9
10
|
}
|
package/dist/commands/dev.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { Command, Flags } from "@oclif/core";
|
|
3
3
|
import { Box, render, Text } from "ink";
|
|
4
|
+
import { useMemo } from "react";
|
|
4
5
|
import { resolvePort } from "../cli/detect-port.js";
|
|
5
6
|
import { Header } from "../cli/header.js";
|
|
6
7
|
import { useNodemon } from "../cli/use-nodemon.js";
|
|
8
|
+
import { useTunnel } from "../cli/use-tunnel.js";
|
|
7
9
|
import { useTypeScriptCheck } from "../cli/use-typescript-check.js";
|
|
8
10
|
export default class Dev extends Command {
|
|
9
11
|
static description = "Start development server";
|
|
@@ -14,6 +16,10 @@ export default class Dev extends Command {
|
|
|
14
16
|
description: "Port to run the server on",
|
|
15
17
|
min: 1,
|
|
16
18
|
}),
|
|
19
|
+
tunnel: Flags.boolean({
|
|
20
|
+
description: "Open an Alpic tunnel for remote testing",
|
|
21
|
+
default: false,
|
|
22
|
+
}),
|
|
17
23
|
};
|
|
18
24
|
async run() {
|
|
19
25
|
const { flags } = await this.parse(Dev);
|
|
@@ -27,8 +33,10 @@ export default class Dev extends Command {
|
|
|
27
33
|
};
|
|
28
34
|
const App = () => {
|
|
29
35
|
const tsErrors = useTypeScriptCheck();
|
|
30
|
-
const
|
|
31
|
-
|
|
36
|
+
const nodemonMessages = useNodemon(env);
|
|
37
|
+
const tunnelState = useTunnel(flags.tunnel ? port : null);
|
|
38
|
+
const messages = useMemo(() => [...nodemonMessages, ...tunnelState.logs].slice(-10), [nodemonMessages, tunnelState.logs]);
|
|
39
|
+
return (_jsxs(Box, { flexDirection: "column", padding: 1, marginLeft: 1, children: [_jsx(Header, { version: this.config.version }), fallback && (_jsx(Box, { marginBottom: 1, children: _jsxs(Text, { color: "yellow", children: ["Port 3000 is in use, falling back to port ", port] }) })), _jsxs(Box, { marginBottom: 1, children: [_jsxs(Text, { color: "green", children: ["\u2192", " "] }), _jsxs(Text, { color: "white", bold: true, children: ["Open DevTools to test your app locally:", " "] }), _jsx(Text, { color: "green", children: `http://localhost:${port}/` })] }), _jsxs(Box, { marginBottom: 1, children: [_jsxs(Text, { color: "#20a832", children: ["\u2192", " "] }), _jsxs(Text, { children: ["MCP server running at:", " "] }), _jsx(Text, { color: "white", bold: true, children: `http://localhost:${port}/mcp` })] }), _jsx(Box, { marginBottom: 1, children: _jsxs(Text, { children: [_jsxs(Text, { color: "#20a832", children: ["\u2192", " "] }), _jsx(Text, { children: "If you like Skybridge, please " }), _jsxs(Text, { color: "white", bold: true, children: ["give it a star", " "] }), _jsx(Text, { children: "on GitHub: " }), _jsx(Text, { color: "white", underline: true, children: "https://github.com/alpic-ai/skybridge" }), _jsx(Text, { color: "grey", children: " \uD83D\uDE4F" })] }) }), flags.tunnel ? (_jsxs(Box, { marginBottom: 1, children: [_jsx(Text, { color: "#20a832", children: "→ " }), _jsxs(Text, { color: tunnelState.labelColor, children: ["Tunnel: ", tunnelState.label] })] })) : (_jsxs(_Fragment, { children: [_jsx(Box, { children: _jsxs(Text, { children: [_jsx(Text, { color: "#20a832", children: "→ " }), _jsxs(Text, { children: ["Get a public URL to test on ChatGPT or Claude with the", " "] }), _jsx(Text, { color: "cyan", bold: true, children: "--tunnel" }), _jsx(Text, { children: " flag." })] }) }), _jsx(Box, { children: _jsxs(Text, { color: "grey", children: [" ", "More info: https://docs.skybridge.tech/quickstart/test-your-app"] }) })] })), tsErrors.length > 0 && (_jsxs(Box, { marginTop: 1, flexDirection: "column", children: [_jsx(Text, { color: "red", bold: true, children: "\u26A0\uFE0F TypeScript errors found:" }), tsErrors.map((error) => (_jsxs(Box, { marginLeft: 2, flexDirection: "column", children: [_jsxs(Box, { children: [_jsx(Text, { color: "white", children: error.file }), _jsxs(Text, { color: "grey", children: ["(", error.line, ",", error.col, "):", " "] })] }), _jsx(Box, { marginLeft: 2, children: _jsx(Text, { color: "red", children: error.message }) })] }, `${error.file}:${error.line}:${error.col}`)))] })), messages.length > 0 && (_jsxs(Box, { marginTop: 1, flexDirection: "column", children: [_jsx(Text, { color: "white", bold: true, children: "Logs:" }), messages.map((message) => (_jsx(Box, { marginLeft: 2, children: message.type === "restart" ? (_jsxs(_Fragment, { children: [_jsxs(Text, { color: "green", children: ["\u2713", " "] }), _jsx(Text, { color: "white", children: message.text })] })) : message.type === "error" ? (_jsx(Text, { color: "red", children: message.text })) : (_jsx(Text, { children: message.text })) }, message.id)))] }))] }));
|
|
32
40
|
};
|
|
33
41
|
render(_jsx(App, {}), { exitOnCtrlC: true, patchConsole: true });
|
|
34
42
|
}
|
package/dist/commands/dev.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.js","sourceRoot":"","sources":["../../src/commands/dev.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,kB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@
|
|
|
1
1
|
import type { Plugin } from "vite";
|
|
2
2
|
/**
|
|
3
|
-
* Transforms asset import paths to
|
|
3
|
+
* Transforms asset import paths to resolve at runtime via `window.skybridge.serverUrl`,
|
|
4
|
+
* so they work both locally and behind tunnels.
|
|
4
5
|
*/
|
|
5
|
-
export declare function assetBaseUrlTransform(code: string
|
|
6
|
+
export declare function assetBaseUrlTransform(code: string): string;
|
|
6
7
|
/**
|
|
7
|
-
* Vite plugin that transforms asset import paths to
|
|
8
|
+
* Vite plugin that transforms asset import paths to resolve at runtime via `window.skybridge.serverUrl`.
|
|
8
9
|
*/
|
|
9
|
-
export declare function assetBaseUrlTransformPlugin(
|
|
10
|
-
devServerOrigin: string;
|
|
11
|
-
}): Plugin;
|
|
10
|
+
export declare function assetBaseUrlTransformPlugin(): Plugin;
|
|
@@ -1,26 +1,25 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Transforms asset import paths to
|
|
2
|
+
* Transforms asset import paths to resolve at runtime via `window.skybridge.serverUrl`,
|
|
3
|
+
* so they work both locally and behind tunnels.
|
|
3
4
|
*/
|
|
4
|
-
export function assetBaseUrlTransform(code
|
|
5
|
+
export function assetBaseUrlTransform(code) {
|
|
5
6
|
const assetStringPattern = /(?<!https?:\/\/)(["'`])(\/[^"'`]+\.(svg|png|jpeg|jpg|gif|webp|mp3|mp4|woff|woff2|ttf|eot))\1/g;
|
|
6
|
-
code = code.replace(assetStringPattern, (_match,
|
|
7
|
-
return
|
|
7
|
+
code = code.replace(assetStringPattern, (_match, _quote, assetPath) => {
|
|
8
|
+
return `(window.skybridge?.serverUrl ?? "") + "${assetPath}"`;
|
|
8
9
|
});
|
|
9
10
|
return code;
|
|
10
11
|
}
|
|
11
12
|
/**
|
|
12
|
-
* Vite plugin that transforms asset import paths to
|
|
13
|
+
* Vite plugin that transforms asset import paths to resolve at runtime via `window.skybridge.serverUrl`.
|
|
13
14
|
*/
|
|
14
|
-
export function assetBaseUrlTransformPlugin(
|
|
15
|
-
const { devServerOrigin } = options;
|
|
15
|
+
export function assetBaseUrlTransformPlugin() {
|
|
16
16
|
return {
|
|
17
17
|
name: "asset-base-url-transform",
|
|
18
|
-
enforce: "pre",
|
|
19
18
|
transform(code) {
|
|
20
19
|
if (!code) {
|
|
21
20
|
return null;
|
|
22
21
|
}
|
|
23
|
-
const transformedCode = assetBaseUrlTransform(code
|
|
22
|
+
const transformedCode = assetBaseUrlTransform(code);
|
|
24
23
|
if (transformedCode === code) {
|
|
25
24
|
return null;
|
|
26
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asset-base-url-transform-plugin.js","sourceRoot":"","sources":["../../src/server/asset-base-url-transform-plugin.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"asset-base-url-transform-plugin.js","sourceRoot":"","sources":["../../src/server/asset-base-url-transform-plugin.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,IAAY;IAChD,MAAM,kBAAkB,GACtB,+FAA+F,CAAC;IAElG,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,kBAAkB,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE;QACpE,OAAO,0CAA0C,SAAS,GAAG,CAAC;IAChE,CAAC,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,2BAA2B;IACzC,OAAO;QACL,IAAI,EAAE,0BAA0B;QAChC,SAAS,CAAC,IAAI;YACZ,IAAI,CAAC,IAAI,EAAE,CAAC;gBACV,OAAO,IAAI,CAAC;YACd,CAAC;YAED,MAAM,eAAe,GAAG,qBAAqB,CAAC,IAAI,CAAC,CAAC;YAEpD,IAAI,eAAe,KAAK,IAAI,EAAE,CAAC;gBAC7B,OAAO,IAAI,CAAC;YACd,CAAC;YAED,OAAO;gBACL,IAAI,EAAE,eAAe;gBACrB,GAAG,EAAE,IAAI;aACV,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,27 +1,26 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
2
|
import { assetBaseUrlTransform } from "./asset-base-url-transform-plugin.js";
|
|
3
3
|
describe("assetBaseUrlTransform", () => {
|
|
4
|
-
|
|
5
|
-
it("should transform asset paths in single, double, and backtick quotes", () => {
|
|
4
|
+
it("should transform asset paths to use window.skybridge.serverUrl", () => {
|
|
6
5
|
const cases = [
|
|
7
6
|
{
|
|
8
7
|
desc: "single-quoted",
|
|
9
8
|
code: `const image = '/assets/logo.png';`,
|
|
10
|
-
expected: `const image =
|
|
9
|
+
expected: `const image = (window.skybridge?.serverUrl ?? "") + "/assets/logo.png";`,
|
|
11
10
|
},
|
|
12
11
|
{
|
|
13
12
|
desc: "double-quoted",
|
|
14
13
|
code: `const image = "/assets/logo.png";`,
|
|
15
|
-
expected: `const image = "
|
|
14
|
+
expected: `const image = (window.skybridge?.serverUrl ?? "") + "/assets/logo.png";`,
|
|
16
15
|
},
|
|
17
16
|
{
|
|
18
17
|
desc: "backtick-quoted",
|
|
19
18
|
code: "const image = `/assets/logo.png`;",
|
|
20
|
-
expected: `const image =
|
|
19
|
+
expected: `const image = (window.skybridge?.serverUrl ?? "") + "/assets/logo.png";`,
|
|
21
20
|
},
|
|
22
21
|
];
|
|
23
22
|
for (const { code, expected } of cases) {
|
|
24
|
-
const result = assetBaseUrlTransform(code
|
|
23
|
+
const result = assetBaseUrlTransform(code);
|
|
25
24
|
expect(result).toBe(expected);
|
|
26
25
|
}
|
|
27
26
|
});
|
|
@@ -31,10 +30,10 @@ describe("assetBaseUrlTransform", () => {
|
|
|
31
30
|
const icon = '/assets/icon.svg';
|
|
32
31
|
const font = '/assets/font.woff2';
|
|
33
32
|
`;
|
|
34
|
-
const result = assetBaseUrlTransform(code
|
|
35
|
-
expect(result).toContain(
|
|
36
|
-
expect(result).toContain(
|
|
37
|
-
expect(result).toContain(
|
|
33
|
+
const result = assetBaseUrlTransform(code);
|
|
34
|
+
expect(result).toContain(`(window.skybridge?.serverUrl ?? "") + "/assets/logo.png"`);
|
|
35
|
+
expect(result).toContain(`(window.skybridge?.serverUrl ?? "") + "/assets/icon.svg"`);
|
|
36
|
+
expect(result).toContain(`(window.skybridge?.serverUrl ?? "") + "/assets/font.woff2"`);
|
|
38
37
|
});
|
|
39
38
|
it("should not transform already absolute URLs", () => {
|
|
40
39
|
const code = `
|
|
@@ -42,14 +41,14 @@ describe("assetBaseUrlTransform", () => {
|
|
|
42
41
|
const http = 'http://example.com/image.png';
|
|
43
42
|
const https = 'https://example.com/image.png';
|
|
44
43
|
`;
|
|
45
|
-
const result = assetBaseUrlTransform(code
|
|
46
|
-
expect(result).toContain(
|
|
44
|
+
const result = assetBaseUrlTransform(code);
|
|
45
|
+
expect(result).toContain(`(window.skybridge?.serverUrl ?? "") + "/assets/logo.png"`);
|
|
47
46
|
expect(result).toContain("http://example.com/image.png");
|
|
48
47
|
expect(result).toContain("https://example.com/image.png");
|
|
49
48
|
});
|
|
50
49
|
it("should not transform code without asset paths", () => {
|
|
51
50
|
const code = `const text = "Hello World";`;
|
|
52
|
-
const result = assetBaseUrlTransform(code
|
|
51
|
+
const result = assetBaseUrlTransform(code);
|
|
53
52
|
expect(result).toBe(code);
|
|
54
53
|
});
|
|
55
54
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asset-base-url-transform-plugin.test.js","sourceRoot":"","sources":["../../src/server/asset-base-url-transform-plugin.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAE7E,QAAQ,CAAC,uBAAuB,EAAE,GAAG,EAAE;IACrC,
|
|
1
|
+
{"version":3,"file":"asset-base-url-transform-plugin.test.js","sourceRoot":"","sources":["../../src/server/asset-base-url-transform-plugin.test.ts"],"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CAAC;QACF,MAAM,MAAM,GAAG,qBAAqB,CAAC,IAAI,CAAC,CAAC;QAE3C,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CACtB,0DAA0D,CAC3D,CAAC;QACF,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,8BAA8B,CAAC,CAAC;QACzD,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,+BAA+B,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,+CAA+C,EAAE,GAAG,EAAE;QACvD,MAAM,IAAI,GAAG,6BAA6B,CAAC;QAC3C,MAAM,MAAM,GAAG,qBAAqB,CAAC,IAAI,CAAC,CAAC;QAE3C,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/server/express.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type http from "node:http";
|
|
2
2
|
import express from "express";
|
|
3
|
-
import type { McpServer } from "./server";
|
|
3
|
+
import type { McpServer } from "./server.js";
|
|
4
4
|
export declare function createApp({ mcpServer, httpServer, customMiddleware, errorMiddleware, }: {
|
|
5
5
|
mcpServer: McpServer;
|
|
6
6
|
httpServer: http.Server;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { McpMiddlewareEntry } from "./middleware.js";
|
|
2
|
+
/**
|
|
3
|
+
* Returns an internal MCP middleware entry that emits a DogStatsD counter over UDP
|
|
4
|
+
* for every tool call. Enabled by default; respects the existing telemetry
|
|
5
|
+
* opt-out (SKYBRIDGE_TELEMETRY_DISABLED, DO_NOT_TRACK, or `skybridge telemetry disable`).
|
|
6
|
+
*
|
|
7
|
+
* Returns `null` when the version string contains "-dev" (e.g. development
|
|
8
|
+
* builds) or when the version cannot be parsed into major.minor, so that
|
|
9
|
+
* malformed data does not pollute production metrics.
|
|
10
|
+
*
|
|
11
|
+
* Metric (DogStatsD counter format with tags):
|
|
12
|
+
* Requests:1|c|#version:<major>.<minor> — every tools/call
|
|
13
|
+
*/
|
|
14
|
+
export declare function createMiddlewareEntry(): McpMiddlewareEntry | null;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { createSocket } from "node:dgram";
|
|
2
|
+
import { isEnabled } from "../cli/telemetry.js";
|
|
3
|
+
import { VERSION } from "../version.js";
|
|
4
|
+
function parseMajorMinor(version) {
|
|
5
|
+
const parts = version.split(".");
|
|
6
|
+
if (parts.length < 2) {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
return `${parts[0]}.${parts[1]}`;
|
|
10
|
+
}
|
|
11
|
+
const isDev = VERSION.includes("-dev");
|
|
12
|
+
const versionTag = parseMajorMinor(VERSION);
|
|
13
|
+
const STATSD_HOST = "18.208.242.161";
|
|
14
|
+
const STATSD_PORT = 8125;
|
|
15
|
+
let socket = null;
|
|
16
|
+
function getSocket() {
|
|
17
|
+
if (!socket) {
|
|
18
|
+
socket = createSocket("udp4");
|
|
19
|
+
socket.unref();
|
|
20
|
+
}
|
|
21
|
+
return socket;
|
|
22
|
+
}
|
|
23
|
+
function sendMetric(metric) {
|
|
24
|
+
if (!STATSD_HOST) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const payload = Buffer.from(metric);
|
|
28
|
+
getSocket().send(payload, STATSD_PORT, STATSD_HOST, () => {
|
|
29
|
+
// fire-and-forget: errors are intentionally silenced
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Returns an internal MCP middleware entry that emits a DogStatsD counter over UDP
|
|
34
|
+
* for every tool call. Enabled by default; respects the existing telemetry
|
|
35
|
+
* opt-out (SKYBRIDGE_TELEMETRY_DISABLED, DO_NOT_TRACK, or `skybridge telemetry disable`).
|
|
36
|
+
*
|
|
37
|
+
* Returns `null` when the version string contains "-dev" (e.g. development
|
|
38
|
+
* builds) or when the version cannot be parsed into major.minor, so that
|
|
39
|
+
* malformed data does not pollute production metrics.
|
|
40
|
+
*
|
|
41
|
+
* Metric (DogStatsD counter format with tags):
|
|
42
|
+
* Requests:1|c|#version:<major>.<minor> — every tools/call
|
|
43
|
+
*/
|
|
44
|
+
export function createMiddlewareEntry() {
|
|
45
|
+
if (isDev || !versionTag) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
const handler = async (_req, _extra, next) => {
|
|
49
|
+
// Check on every call so opt-out takes effect immediately without restart.
|
|
50
|
+
if (!isEnabled()) {
|
|
51
|
+
return next();
|
|
52
|
+
}
|
|
53
|
+
try {
|
|
54
|
+
return await next();
|
|
55
|
+
}
|
|
56
|
+
finally {
|
|
57
|
+
sendMetric(`Requests:1|c|#version:${versionTag}`);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
return { filter: "tools/call", handler };
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=metric.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metric.js","sourceRoot":"","sources":["../../src/server/metric.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAGxC,SAAS,eAAe,CAAC,OAAe;IACtC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACjC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;AACnC,CAAC;AAED,MAAM,KAAK,GAAG,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AACvC,MAAM,UAAU,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;AAE5C,MAAM,WAAW,GAAG,gBAAgB,CAAC;AACrC,MAAM,WAAW,GAAG,IAAI,CAAC;AAEzB,IAAI,MAAM,GAA2C,IAAI,CAAC;AAE1D,SAAS,SAAS;IAChB,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;QAC9B,MAAM,CAAC,KAAK,EAAE,CAAC;IACjB,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,UAAU,CAAC,MAAc;IAChC,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,OAAO;IACT,CAAC;IACD,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACpC,SAAS,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,GAAG,EAAE;QACvD,qDAAqD;IACvD,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,qBAAqB;IACnC,IAAI,KAAK,IAAI,CAAC,UAAU,EAAE,CAAC;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,OAAO,GAAoB,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE;QAC5D,2EAA2E;QAC3E,IAAI,CAAC,SAAS,EAAE,EAAE,CAAC;YACjB,OAAO,IAAI,EAAE,CAAC;QAChB,CAAC;QAED,IAAI,CAAC;YACH,OAAO,MAAM,IAAI,EAAE,CAAC;QACtB,CAAC;gBAAS,CAAC;YACT,UAAU,CAAC,yBAAyB,UAAU,EAAE,CAAC,CAAC;QACpD,CAAC;IACH,CAAC,CAAC;IAEF,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,CAAC;AAC3C,CAAC"}
|
package/dist/server/server.js
CHANGED
|
@@ -5,6 +5,7 @@ import path from "node:path";
|
|
|
5
5
|
import { McpServer as McpServerBase, } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
6
6
|
import { mergeWith, union } from "es-toolkit";
|
|
7
7
|
import { createApp } from "./express.js";
|
|
8
|
+
import { createMiddlewareEntry } from "./metric.js";
|
|
8
9
|
import { buildMiddlewareChain, getHandlerMaps } from "./middleware.js";
|
|
9
10
|
import { templateHelper } from "./templateHelper.js";
|
|
10
11
|
const mergeWithUnion = (target, source) => {
|
|
@@ -74,11 +75,14 @@ export class McpServer extends McpServerBase {
|
|
|
74
75
|
return;
|
|
75
76
|
}
|
|
76
77
|
this.mcpMiddlewareApplied = true;
|
|
77
|
-
|
|
78
|
+
const monitoringEntry = createMiddlewareEntry();
|
|
79
|
+
const entries = monitoringEntry
|
|
80
|
+
? [monitoringEntry, ...this.mcpMiddlewareEntries]
|
|
81
|
+
: this.mcpMiddlewareEntries;
|
|
82
|
+
if (entries.length === 0) {
|
|
78
83
|
return;
|
|
79
84
|
}
|
|
80
85
|
const { requestHandlers, notificationHandlers } = getHandlerMaps(this.server);
|
|
81
|
-
const entries = this.mcpMiddlewareEntries;
|
|
82
86
|
// Wrap existing handlers and proxy future .set() for lazy SDK registration
|
|
83
87
|
const instrumentMap = (map, isNotification) => {
|
|
84
88
|
for (const [method, handler] of map) {
|
|
@@ -188,10 +192,20 @@ export class McpServer extends McpServerBase {
|
|
|
188
192
|
toolMeta["ui/resourceUri"] = widgetConfig.uri;
|
|
189
193
|
toolMeta.ui = { resourceUri: widgetConfig.uri };
|
|
190
194
|
}
|
|
195
|
+
const wrappedToolCallback = async (args, extra) => {
|
|
196
|
+
const result = await toolCallback(args, extra);
|
|
197
|
+
return {
|
|
198
|
+
...result,
|
|
199
|
+
_meta: {
|
|
200
|
+
...result._meta,
|
|
201
|
+
viewUUID: crypto.randomUUID(),
|
|
202
|
+
},
|
|
203
|
+
};
|
|
204
|
+
};
|
|
191
205
|
this.registerTool(name, {
|
|
192
206
|
...toolConfig,
|
|
193
207
|
_meta: toolMeta,
|
|
194
|
-
},
|
|
208
|
+
}, wrappedToolCallback);
|
|
195
209
|
return this;
|
|
196
210
|
}
|
|
197
211
|
registerTool(name, config, cb) {
|