skybridge 0.0.0-dev.6016dca → 0.0.0-dev.6042467
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/bin/run.js +0 -4
- package/dist/cli/telemetry.d.ts +7 -0
- package/dist/cli/telemetry.js +123 -0
- package/dist/cli/telemetry.js.map +1 -0
- package/dist/cli/use-execute-steps.d.ts +1 -1
- package/dist/commands/dev.d.ts +3 -1
- package/dist/commands/dev.js +15 -3
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/telemetry/disable.d.ts +5 -0
- package/dist/commands/telemetry/disable.js +14 -0
- package/dist/commands/telemetry/disable.js.map +1 -0
- package/dist/commands/telemetry/enable.d.ts +5 -0
- package/dist/commands/telemetry/enable.js +14 -0
- package/dist/commands/telemetry/enable.js.map +1 -0
- package/dist/commands/telemetry/status.d.ts +5 -0
- package/dist/commands/telemetry/status.js +14 -0
- package/dist/commands/telemetry/status.js.map +1 -0
- package/dist/server/asset-base-url-transform-plugin.d.ts +11 -0
- package/dist/server/asset-base-url-transform-plugin.js +34 -0
- package/dist/server/asset-base-url-transform-plugin.js.map +1 -0
- package/dist/server/asset-base-url-transform-plugin.test.js +56 -0
- package/dist/server/asset-base-url-transform-plugin.test.js.map +1 -0
- package/dist/server/server.d.ts +2 -0
- package/dist/server/server.js +60 -54
- package/dist/server/server.js.map +1 -1
- package/dist/server/templates/development.hbs +1 -2
- package/dist/server/templates/production.hbs +1 -2
- package/dist/server/widgetsDevServer.js +2 -0
- package/dist/server/widgetsDevServer.js.map +1 -1
- package/dist/test/widget.test.js +23 -2
- package/dist/test/widget.test.js.map +1 -1
- package/dist/web/bridges/apps-sdk/adaptor.d.ts +9 -1
- package/dist/web/bridges/apps-sdk/adaptor.js +25 -0
- package/dist/web/bridges/apps-sdk/adaptor.js.map +1 -1
- package/dist/web/bridges/apps-sdk/bridge.d.ts +5 -5
- package/dist/web/bridges/apps-sdk/bridge.js.map +1 -1
- package/dist/web/bridges/apps-sdk/index.d.ts +2 -2
- package/dist/web/bridges/apps-sdk/index.js +1 -1
- package/dist/web/bridges/apps-sdk/index.js.map +1 -1
- package/dist/web/bridges/apps-sdk/types.d.ts +13 -19
- package/dist/web/bridges/apps-sdk/types.js.map +1 -1
- package/dist/web/bridges/apps-sdk/use-apps-sdk-context.d.ts +2 -0
- package/dist/web/bridges/apps-sdk/{use-apps-sdk-bridge.js → use-apps-sdk-context.js} +2 -2
- package/dist/web/bridges/apps-sdk/use-apps-sdk-context.js.map +1 -0
- package/dist/web/bridges/index.d.ts +2 -2
- package/dist/web/bridges/index.js +2 -2
- package/dist/web/bridges/index.js.map +1 -1
- package/dist/web/bridges/mcp-app/adaptor.d.ts +18 -1
- package/dist/web/bridges/mcp-app/adaptor.js +42 -2
- package/dist/web/bridges/mcp-app/adaptor.js.map +1 -1
- package/dist/web/bridges/mcp-app/bridge.d.ts +5 -5
- package/dist/web/bridges/mcp-app/bridge.js +16 -17
- package/dist/web/bridges/mcp-app/bridge.js.map +1 -1
- package/dist/web/bridges/mcp-app/index.d.ts +2 -2
- package/dist/web/bridges/mcp-app/index.js +1 -1
- package/dist/web/bridges/mcp-app/index.js.map +1 -1
- package/dist/web/bridges/mcp-app/types.d.ts +2 -2
- package/dist/web/bridges/mcp-app/use-mcp-app-context.d.ts +5 -0
- package/dist/web/bridges/mcp-app/{use-mcp-app-bridge.js → use-mcp-app-context.js} +2 -2
- package/dist/web/bridges/mcp-app/use-mcp-app-context.js.map +1 -0
- package/dist/web/bridges/mcp-app/use-mcp-app-context.test.d.ts +1 -0
- package/dist/web/bridges/mcp-app/{use-mcp-app-bridge.test.js → use-mcp-app-context.test.js} +15 -6
- package/dist/web/bridges/mcp-app/use-mcp-app-context.test.js.map +1 -0
- package/dist/web/bridges/types.d.ts +25 -1
- package/dist/web/components/modal-provider.d.ts +4 -0
- package/dist/web/components/modal-provider.js +47 -0
- package/dist/web/components/modal-provider.js.map +1 -0
- package/dist/web/create-store.js +1 -1
- package/dist/web/create-store.js.map +1 -1
- package/dist/web/create-store.test.js +2 -1
- package/dist/web/create-store.test.js.map +1 -1
- package/dist/web/data-llm.js +1 -1
- package/dist/web/data-llm.js.map +1 -1
- package/dist/web/data-llm.test.js +1 -2
- package/dist/web/data-llm.test.js.map +1 -1
- package/dist/web/generate-helpers.d.ts +1 -1
- package/dist/web/generate-helpers.js +1 -1
- package/dist/web/helpers/state.js +1 -1
- package/dist/web/helpers/state.js.map +1 -1
- package/dist/web/hooks/index.d.ts +1 -0
- package/dist/web/hooks/index.js +1 -0
- package/dist/web/hooks/index.js.map +1 -1
- package/dist/web/hooks/use-call-tool.d.ts +1 -1
- package/dist/web/hooks/use-call-tool.js +1 -1
- package/dist/web/hooks/use-call-tool.js.map +1 -1
- package/dist/web/hooks/use-display-mode.js +1 -1
- package/dist/web/hooks/use-display-mode.js.map +1 -1
- package/dist/web/hooks/use-files.d.ts +2 -6
- package/dist/web/hooks/use-files.js +4 -2
- package/dist/web/hooks/use-files.js.map +1 -1
- package/dist/web/hooks/use-files.test.js +1 -0
- package/dist/web/hooks/use-files.test.js.map +1 -1
- package/dist/web/hooks/use-layout.d.ts +2 -2
- package/dist/web/hooks/use-layout.js +1 -1
- package/dist/web/hooks/use-layout.js.map +1 -1
- package/dist/web/hooks/use-layout.test.js +2 -1
- package/dist/web/hooks/use-layout.test.js.map +1 -1
- package/dist/web/hooks/use-open-external.js +1 -1
- package/dist/web/hooks/use-open-external.js.map +1 -1
- package/dist/web/hooks/use-request-modal.d.ts +2 -2
- package/dist/web/hooks/use-request-modal.js +9 -7
- package/dist/web/hooks/use-request-modal.js.map +1 -1
- package/dist/web/hooks/use-send-follow-up-message.js +1 -1
- package/dist/web/hooks/use-send-follow-up-message.js.map +1 -1
- package/dist/web/hooks/use-set-open-in-app-url.d.ts +1 -0
- package/dist/web/hooks/use-set-open-in-app-url.js +8 -0
- package/dist/web/hooks/use-set-open-in-app-url.js.map +1 -0
- package/dist/web/hooks/use-set-open-in-app-url.test.d.ts +1 -0
- package/dist/web/hooks/use-set-open-in-app-url.test.js +49 -0
- package/dist/web/hooks/use-set-open-in-app-url.test.js.map +1 -0
- package/dist/web/hooks/use-tool-info.js +1 -1
- package/dist/web/hooks/use-tool-info.js.map +1 -1
- package/dist/web/hooks/use-tool-info.test.js +4 -3
- package/dist/web/hooks/use-tool-info.test.js.map +1 -1
- package/dist/web/hooks/use-user.d.ts +1 -1
- package/dist/web/hooks/use-user.js +1 -1
- package/dist/web/hooks/use-user.js.map +1 -1
- package/dist/web/hooks/use-user.test.js +2 -1
- package/dist/web/hooks/use-user.test.js.map +1 -1
- package/dist/web/hooks/use-widget-state.js +1 -1
- package/dist/web/hooks/use-widget-state.js.map +1 -1
- package/dist/web/mount-widget.js +9 -1
- package/dist/web/mount-widget.js.map +1 -1
- package/dist/web/plugin/plugin.js +6 -0
- package/dist/web/plugin/plugin.js.map +1 -1
- package/package.json +17 -11
- package/dist/web/bridges/apps-sdk/use-apps-sdk-bridge.d.ts +0 -2
- package/dist/web/bridges/apps-sdk/use-apps-sdk-bridge.js.map +0 -1
- package/dist/web/bridges/mcp-app/use-mcp-app-bridge.d.ts +0 -5
- package/dist/web/bridges/mcp-app/use-mcp-app-bridge.js.map +0 -1
- package/dist/web/bridges/mcp-app/use-mcp-app-bridge.test.js.map +0 -1
- /package/dist/{web/bridges/mcp-app/use-mcp-app-bridge.test.d.ts → server/asset-base-url-transform-plugin.test.d.ts} +0 -0
package/bin/run.js
CHANGED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Hook } from "@oclif/core";
|
|
2
|
+
export declare function isEnabled(): boolean;
|
|
3
|
+
export declare function isDebugMode(): boolean;
|
|
4
|
+
export declare function setEnabled(enabled: boolean): void;
|
|
5
|
+
export declare function getMachineId(): string;
|
|
6
|
+
declare const hook: Hook<"finally">;
|
|
7
|
+
export default hook;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import ci from "ci-info";
|
|
5
|
+
import { PostHog } from "posthog-node";
|
|
6
|
+
const POSTHOG_API_KEY = "phc_rQdkCYr0DO4NcZBQXZnUwsHAbau9zuNwKIpil9FQP6v";
|
|
7
|
+
const POSTHOG_HOST = "https://us.i.posthog.com";
|
|
8
|
+
const ENV_TELEMETRY_DISABLED = "SKYBRIDGE_TELEMETRY_DISABLED";
|
|
9
|
+
const ENV_TELEMETRY_DEBUG = "SKYBRIDGE_TELEMETRY_DEBUG";
|
|
10
|
+
const ENV_DO_NOT_TRACK = "DO_NOT_TRACK";
|
|
11
|
+
const GLOBAL_CONFIG_DIR = join(homedir(), ".skybridge");
|
|
12
|
+
const GLOBAL_CONFIG_FILE = join(GLOBAL_CONFIG_DIR, "config.json");
|
|
13
|
+
let posthogClient = null;
|
|
14
|
+
function getPostHogClient() {
|
|
15
|
+
if (!posthogClient) {
|
|
16
|
+
posthogClient = new PostHog(POSTHOG_API_KEY, {
|
|
17
|
+
host: POSTHOG_HOST,
|
|
18
|
+
flushAt: 1,
|
|
19
|
+
flushInterval: 0,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return posthogClient;
|
|
23
|
+
}
|
|
24
|
+
function readJsonFile(filePath) {
|
|
25
|
+
try {
|
|
26
|
+
if (existsSync(filePath)) {
|
|
27
|
+
const content = readFileSync(filePath, "utf-8");
|
|
28
|
+
return JSON.parse(content);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
// Ignore errors reading config
|
|
33
|
+
}
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
function writeJsonFile(filePath, data) {
|
|
37
|
+
try {
|
|
38
|
+
const dir = join(filePath, "..");
|
|
39
|
+
if (!existsSync(dir)) {
|
|
40
|
+
mkdirSync(dir, { recursive: true });
|
|
41
|
+
}
|
|
42
|
+
writeFileSync(filePath, JSON.stringify(data, null, 2), "utf-8");
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
// Ignore errors writing config
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function getGlobalConfig() {
|
|
49
|
+
const existing = readJsonFile(GLOBAL_CONFIG_FILE);
|
|
50
|
+
if (existing?.machineId && existing?.telemetry !== undefined) {
|
|
51
|
+
return existing;
|
|
52
|
+
}
|
|
53
|
+
const config = {
|
|
54
|
+
machineId: existing?.machineId || crypto.randomUUID(),
|
|
55
|
+
telemetry: {
|
|
56
|
+
enabled: existing?.telemetry?.enabled ?? true,
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
writeJsonFile(GLOBAL_CONFIG_FILE, config);
|
|
60
|
+
return config;
|
|
61
|
+
}
|
|
62
|
+
export function isEnabled() {
|
|
63
|
+
if (process.env[ENV_TELEMETRY_DISABLED] === "1" ||
|
|
64
|
+
process.env[ENV_TELEMETRY_DISABLED]?.toLowerCase() === "true") {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
if (process.env[ENV_DO_NOT_TRACK] === "1" ||
|
|
68
|
+
process.env[ENV_DO_NOT_TRACK]?.toLowerCase() === "true") {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
if (ci.isCI) {
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
const config = getGlobalConfig();
|
|
75
|
+
return config.telemetry.enabled;
|
|
76
|
+
}
|
|
77
|
+
export function isDebugMode() {
|
|
78
|
+
return (process.env[ENV_TELEMETRY_DEBUG] === "1" ||
|
|
79
|
+
process.env[ENV_TELEMETRY_DEBUG]?.toLowerCase() === "true");
|
|
80
|
+
}
|
|
81
|
+
export function setEnabled(enabled) {
|
|
82
|
+
const config = getGlobalConfig();
|
|
83
|
+
config.telemetry.enabled = enabled;
|
|
84
|
+
writeJsonFile(GLOBAL_CONFIG_FILE, config);
|
|
85
|
+
}
|
|
86
|
+
export function getMachineId() {
|
|
87
|
+
if (ci.isCI) {
|
|
88
|
+
return ci.name ?? "unknown-ci";
|
|
89
|
+
}
|
|
90
|
+
return getGlobalConfig().machineId;
|
|
91
|
+
}
|
|
92
|
+
const hook = async ({ id: command, config: { version }, error, }) => {
|
|
93
|
+
if (!isEnabled()) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
const event = {
|
|
97
|
+
version,
|
|
98
|
+
machineId: getMachineId(),
|
|
99
|
+
sessionId: crypto.randomUUID(),
|
|
100
|
+
isCI: ci.isCI,
|
|
101
|
+
nodeVersion: process.version,
|
|
102
|
+
platform: process.platform,
|
|
103
|
+
outcome: error ? "failure" : "success",
|
|
104
|
+
error: error?.message,
|
|
105
|
+
};
|
|
106
|
+
if (isDebugMode()) {
|
|
107
|
+
console.error("[Telemetry Debug] Would send event:", JSON.stringify(event, null, 2));
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
try {
|
|
111
|
+
const client = getPostHogClient();
|
|
112
|
+
client.capture({
|
|
113
|
+
distinctId: event.machineId,
|
|
114
|
+
event: command,
|
|
115
|
+
properties: event,
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
catch {
|
|
119
|
+
// Silently ignore telemetry errors - never block CLI operation
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
export default hook;
|
|
123
|
+
//# sourceMappingURL=telemetry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry.js","sourceRoot":"","sources":["../../src/cli/telemetry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,MAAM,eAAe,G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,MAAM,MAAM,GAAG,gBAAgB,EAAE,CAAC;QAClC,MAAM,CAAC,OAAO,CAAC;YACb,UAAU,EAAE,KAAK,CAAC,SAAS;YAC3B,KAAK,EAAE,OAAO;YACd,UAAU,EAAE,KAAK;SAClB,CAAC,CAAC;IACL,CAAC;IAAC,MAAM,CAAC;QACP,+DAA+D;IACjE,CAAC;AACH,CAAC,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -4,7 +4,7 @@ export interface CommandStep {
|
|
|
4
4
|
}
|
|
5
5
|
export declare const useExecuteSteps: (steps: CommandStep[]) => {
|
|
6
6
|
currentStep: number;
|
|
7
|
-
status: "error" | "
|
|
7
|
+
status: "error" | "success" | "running";
|
|
8
8
|
error: string | null;
|
|
9
9
|
execute: () => Promise<void>;
|
|
10
10
|
};
|
package/dist/commands/dev.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import { Command } from "@oclif/core";
|
|
|
2
2
|
export default class Dev extends Command {
|
|
3
3
|
static description: string;
|
|
4
4
|
static examples: string[];
|
|
5
|
-
static flags: {
|
|
5
|
+
static flags: {
|
|
6
|
+
"use-forwarded-host": import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
7
|
+
};
|
|
6
8
|
run(): Promise<void>;
|
|
7
9
|
}
|
package/dist/commands/dev.js
CHANGED
|
@@ -1,18 +1,30 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Command } from "@oclif/core";
|
|
2
|
+
import { Command, Flags } from "@oclif/core";
|
|
3
3
|
import { Box, render, Text } from "ink";
|
|
4
4
|
import { Header } from "../cli/header.js";
|
|
5
5
|
import { runCommand } from "../cli/run-command.js";
|
|
6
6
|
export default class Dev extends Command {
|
|
7
7
|
static description = "Start development server";
|
|
8
8
|
static examples = ["skybridge"];
|
|
9
|
-
static flags = {
|
|
9
|
+
static flags = {
|
|
10
|
+
"use-forwarded-host": Flags.boolean({
|
|
11
|
+
description: "Uses the forwarded host header to construct widget URLs instead of localhost, useful when accessing the dev server through a tunnel (e.g., ngrok)",
|
|
12
|
+
}),
|
|
13
|
+
};
|
|
10
14
|
async run() {
|
|
15
|
+
const { flags } = await this.parse(Dev);
|
|
16
|
+
const env = {
|
|
17
|
+
...process.env,
|
|
18
|
+
...(flags["use-forwarded-host"]
|
|
19
|
+
? { SKYBRIDGE_USE_FORWARDED_HOST: "true" }
|
|
20
|
+
: {}),
|
|
21
|
+
};
|
|
11
22
|
runCommand("nodemon --quiet", {
|
|
12
23
|
stdio: ["ignore", "ignore", "inherit"],
|
|
24
|
+
env,
|
|
13
25
|
});
|
|
14
26
|
const App = () => {
|
|
15
|
-
return (_jsxs(Box, { flexDirection: "column", padding: 1, marginLeft: 1, children: [_jsx(Header, { version: this.config.version }), _jsxs(Box, { 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:3000/" })] }), _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:3000/mcp" })] }), _jsx(Text, { color: "white", underline: true, children: "To test on ChatGPT:" }), _jsxs(Box, { children: [_jsxs(Text, { color: "#20a832", children: ["\u2192", " "] }), _jsx(Text, { color: "grey", children: "Make your local server accessible with " }), _jsx(Text, { color: "white", bold: true, children: "ngrok http 3000" })] }), _jsx(Box, { marginBottom: 1, children: _jsxs(Text, { children: [_jsxs(Text, { color: "#20a832", children: ["\u2192", " "] }), _jsx(Text, { color: "grey", children: "Connect to ChatGPT with URL " }), _jsx(Text, { color: "white", bold: true, children: "https://xxxxxx.ngrok-free.app/mcp" })] }) }), _jsx(Box, { children: _jsxs(Text, { children: [_jsxs(Text, { color: "#20a832", children: ["\u2192", " "] }), _jsx(Text, { children: "Documentation: " }), _jsx(Text, { color: "white", bold: true, children: "https://skybridge.tech/" })] }) }), _jsx(Box, { marginTop: 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" })] }) })] }));
|
|
27
|
+
return (_jsxs(Box, { flexDirection: "column", padding: 1, marginLeft: 1, children: [_jsx(Header, { version: this.config.version }), _jsxs(Box, { 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:3000/" })] }), _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:3000/mcp" })] }), _jsx(Text, { color: "white", underline: true, children: "To test on ChatGPT:" }), _jsxs(Box, { children: [_jsxs(Text, { color: "#20a832", children: ["\u2192", " "] }), _jsx(Text, { color: "grey", children: "Make your local server accessible with " }), _jsx(Text, { color: "white", bold: true, children: "ngrok http 3000" })] }), _jsx(Box, { marginBottom: 1, children: _jsxs(Text, { children: [_jsxs(Text, { color: "#20a832", children: ["\u2192", " "] }), _jsx(Text, { color: "grey", children: "Connect to ChatGPT with URL " }), _jsx(Text, { color: "white", bold: true, children: "https://xxxxxx.ngrok-free.app/mcp" })] }) }), _jsx(Box, { children: _jsxs(Text, { children: [_jsxs(Text, { color: "#20a832", children: ["\u2192", " "] }), _jsx(Text, { children: "Documentation: " }), _jsx(Text, { color: "white", bold: true, children: "https://docs.skybridge.tech/" })] }) }), _jsx(Box, { marginTop: 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" })] }) })] }));
|
|
16
28
|
};
|
|
17
29
|
render(_jsx(App, {}), { exitOnCtrlC: true, patchConsole: false });
|
|
18
30
|
}
|
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,MAAM,aAAa,CAAC;
|
|
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,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,MAAM,CAAC,OAAO,OAAO,GAAI,SAAQ,OAAO;IACtC,MAAM,CAAU,WAAW,GAAG,0BAA0B,CAAC;IACzD,MAAM,CAAU,QAAQ,GAAG,CAAC,WAAW,CAAC,CAAC;IACzC,MAAM,CAAU,KAAK,GAAG;QACtB,oBAAoB,EAAE,KAAK,CAAC,OAAO,CAAC;YAClC,WAAW,EACT,mJAAmJ;SACtJ,CAAC;KACH,CAAC;IAEK,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAExC,MAAM,GAAG,GAAG;YACV,GAAG,OAAO,CAAC,GAAG;YACd,GAAG,CAAC,KAAK,CAA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,IAAI,IAAQ,EACpC,KAAC,IAAI,IAAC,KAAK,EAAC,MAAM,6CAAoC,EACtD,KAAC,IAAI,IAAC,KAAK,EAAC,OAAO,EAAC,IAAI,wDAEjB,IACF,GACH,EACN,KAAC,GAAG,cACF,MAAC,IAAI,eACH,MAAC,IAAI,IAAC,KAAK,EAAC,SAAS,uBAAG,IAAI,IAAQ,EACpC,KAAC,IAAI,kCAAuB,EAC5B,KAAC,IAAI,IAAC,KAAK,EAAC,OAAO,EAAC,IAAI,mDAEjB,IACF,GACH,EACN,KAAC,GAAG,IAAC,SAAS,EAAE,CAAC,YACf,MAAC,IAAI,eACH,MAAC,IAAI,IAAC,KAAK,EAAC,SAAS,uBAAG,IAAI,IAAQ,EACpC,KAAC,IAAI,iDAAsC,EAC3C,MAAC,IAAI,IAAC,KAAK,EAAC,OAAO,EAAC,IAAI,qCACP,GAAG,IACb,EACP,KAAC,IAAI,8BAAmB,EACxB,KAAC,IAAI,IAAC,KAAK,EAAC,OAAO,EAAC,SAAS,4DAEtB,EACP,KAAC,IAAI,IAAC,KAAK,EAAC,MAAM,8BAAW,IACxB,GACH,IACF,CACP,CAAC;QACJ,CAAC,CAAC;QAEF,MAAM,CAAC,KAAC,GAAG,KAAG,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC,CAAC;IAC9D,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Command } from "@oclif/core";
|
|
3
|
+
import { Box, render, Text } from "ink";
|
|
4
|
+
import { setEnabled } from "../../cli/telemetry.js";
|
|
5
|
+
export default class TelemetryDisable extends Command {
|
|
6
|
+
static description = "Disable Skybridge telemetry on this machine";
|
|
7
|
+
async run() {
|
|
8
|
+
await this.parse(TelemetryDisable);
|
|
9
|
+
setEnabled(false);
|
|
10
|
+
const App = () => (_jsxs(Box, { flexDirection: "column", padding: 1, children: [_jsxs(Box, { children: [_jsx(Text, { color: "yellow", children: "\u2713" }), _jsx(Text, { children: " Telemetry has been " }), _jsx(Text, { color: "yellow", bold: true, children: "disabled" })] }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { color: "gray", children: "Config saved to ~/.skybridge/config.json" }) }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { color: "gray", children: "Skybridge never collects Personally Identifiable Information (PII). If you'd like to help us improve Skybridge by allowing anonymous CLI usage data, please reenable telemetry with: skybridge telemetry enable" }) })] }));
|
|
11
|
+
render(_jsx(App, {}));
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=disable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"disable.js","sourceRoot":"","sources":["../../../src/commands/telemetry/disable.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,OAAO;IACnD,MAAM,CAAU,WAAW,GAAG,6CAA6C,CAAC;IAErE,KAAK,CAAC,GAAG;QACd,MAAM,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;QACnC,UAAU,CAAC,KAAK,CAAC,CAAC;QAElB,MAAM,GAAG,GAAG,GAAG,EAAE,CAAC,CAChB,MAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,OAAO,EAAE,CAAC,aACpC,MAAC,GAAG,eACF,KAAC,IAAI,IAAC,KAAK,EAAC,QAAQ,uBAAS,EAC7B,KAAC,IAAI,uCAA4B,EACjC,KAAC,IAAI,IAAC,KAAK,EAAC,QAAQ,EAAC,IAAI,+BAElB,IACH,EACN,KAAC,GAAG,IAAC,SAAS,EAAE,CAAC,YACf,KAAC,IAAI,IAAC,KAAK,EAAC,MAAM,yDAAgD,GAC9D,EACN,KAAC,GAAG,IAAC,SAAS,EAAE,CAAC,YACf,KAAC,IAAI,IAAC,KAAK,EAAC,MAAM,gOAKX,GACH,IACF,CACP,CAAC;QAEF,MAAM,CAAC,KAAC,GAAG,KAAG,CAAC,CAAC;IAClB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Command } from "@oclif/core";
|
|
3
|
+
import { Box, render, Text } from "ink";
|
|
4
|
+
import { setEnabled } from "../../cli/telemetry.js";
|
|
5
|
+
export default class TelemetryEnable extends Command {
|
|
6
|
+
static description = "Enable Skybridge telemetry on this machine";
|
|
7
|
+
async run() {
|
|
8
|
+
await this.parse(TelemetryEnable);
|
|
9
|
+
setEnabled(true);
|
|
10
|
+
const App = () => (_jsxs(Box, { flexDirection: "column", padding: 1, children: [_jsxs(Box, { children: [_jsx(Text, { color: "green", children: "\u2713" }), _jsx(Text, { children: " Telemetry has been " }), _jsx(Text, { color: "green", bold: true, children: "enabled" })] }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { color: "gray", children: "Config saved to ~/.skybridge/config.json" }) })] }));
|
|
11
|
+
render(_jsx(App, {}));
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=enable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enable.js","sourceRoot":"","sources":["../../../src/commands/telemetry/enable.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,OAAO;IAClD,MAAM,CAAU,WAAW,GAAG,4CAA4C,CAAC;IAEpE,KAAK,CAAC,GAAG;QACd,MAAM,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;QAClC,UAAU,CAAC,IAAI,CAAC,CAAC;QAEjB,MAAM,GAAG,GAAG,GAAG,EAAE,CAAC,CAChB,MAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,OAAO,EAAE,CAAC,aACpC,MAAC,GAAG,eACF,KAAC,IAAI,IAAC,KAAK,EAAC,OAAO,uBAAS,EAC5B,KAAC,IAAI,uCAA4B,EACjC,KAAC,IAAI,IAAC,KAAK,EAAC,OAAO,EAAC,IAAI,8BAEjB,IACH,EACN,KAAC,GAAG,IAAC,SAAS,EAAE,CAAC,YACf,KAAC,IAAI,IAAC,KAAK,EAAC,MAAM,yDAAgD,GAC9D,IACF,CACP,CAAC;QAEF,MAAM,CAAC,KAAC,GAAG,KAAG,CAAC,CAAC;IAClB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Command } from "@oclif/core";
|
|
3
|
+
import { Box, render, Text } from "ink";
|
|
4
|
+
import { getMachineId, isEnabled } from "../../cli/telemetry.js";
|
|
5
|
+
export default class TelemetryStatus extends Command {
|
|
6
|
+
static description = "Get Skybridge current telemetry settings for this machine";
|
|
7
|
+
async run() {
|
|
8
|
+
await this.parse(TelemetryStatus);
|
|
9
|
+
const enabled = isEnabled();
|
|
10
|
+
const App = () => (_jsxs(Box, { flexDirection: "column", padding: 1, children: [_jsx(Text, { bold: true, underline: true, children: "Skybridge Telemetry" }), _jsxs(Box, { marginTop: 1, flexDirection: "column", children: [_jsxs(Box, { children: [_jsx(Text, { children: "Status: " }), enabled ? (_jsx(Text, { color: "green", bold: true, children: "Enabled" })) : (_jsx(Text, { color: "yellow", bold: true, children: "Disabled" }))] }), _jsxs(Box, { marginTop: 1, children: [_jsx(Text, { color: "gray", children: "Machine ID: " }), _jsx(Text, { children: getMachineId() })] })] }), _jsxs(Box, { marginTop: 1, flexDirection: "column", children: [_jsx(Text, { color: "gray", children: "To opt out, run: skybridge telemetry disable" }), _jsx(Text, { color: "gray", children: "Or set: SKYBRIDGE_TELEMETRY_DISABLED=1" }), _jsx(Text, { color: "gray", children: "Debug mode: SKYBRIDGE_TELEMETRY_DEBUG=1" })] })] }));
|
|
11
|
+
render(_jsx(App, {}));
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../../src/commands/telemetry/status.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEjE,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,OAAO;IAClD,MAAM,CAAU,WAAW,GACzB,2DAA2D,CAAC;IAEvD,KAAK,CAAC,GAAG;QACd,MAAM,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;QAClC,MAAM,OAAO,GAAG,SAAS,EAAE,CAAC;QAE5B,MAAM,GAAG,GAAG,GAAG,EAAE,CAAC,CAChB,MAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,OAAO,EAAE,CAAC,aACpC,KAAC,IAAI,IAAC,IAAI,QAAC,SAAS,0CAEb,EAEP,MAAC,GAAG,IAAC,SAAS,EAAE,CAAC,EAAE,aAAa,EAAC,QAAQ,aACvC,MAAC,GAAG,eACF,KAAC,IAAI,2BAAgB,EACpB,OAAO,CAAC,CAAC,CAAC,CACT,KAAC,IAAI,IAAC,KAAK,EAAC,OAAO,EAAC,IAAI,8BAEjB,CACR,CAAC,CAAC,CAAC,CACF,KAAC,IAAI,IAAC,KAAK,EAAC,QAAQ,EAAC,IAAI,+BAElB,CACR,IACG,EAEN,MAAC,GAAG,IAAC,SAAS,EAAE,CAAC,aACf,KAAC,IAAI,IAAC,KAAK,EAAC,MAAM,6BAAoB,EACtC,KAAC,IAAI,cAAE,YAAY,EAAE,GAAQ,IACzB,IACF,EAEN,MAAC,GAAG,IAAC,SAAS,EAAE,CAAC,EAAE,aAAa,EAAC,QAAQ,aACvC,KAAC,IAAI,IAAC,KAAK,EAAC,MAAM,6DAAoD,EACtE,KAAC,IAAI,IAAC,KAAK,EAAC,MAAM,uDAA8C,EAChE,KAAC,IAAI,IAAC,KAAK,EAAC,MAAM,wDAA+C,IAC7D,IACF,CACP,CAAC;QAEF,MAAM,CAAC,KAAC,GAAG,KAAG,CAAC,CAAC;IAClB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Plugin } from "vite";
|
|
2
|
+
/**
|
|
3
|
+
* Transforms asset import paths to use the development server base URL.
|
|
4
|
+
*/
|
|
5
|
+
export declare function assetBaseUrlTransform(code: string, devServerOrigin: string): string;
|
|
6
|
+
/**
|
|
7
|
+
* Vite plugin that transforms asset import paths to use the development server base URL.
|
|
8
|
+
*/
|
|
9
|
+
export declare function assetBaseUrlTransformPlugin(options: {
|
|
10
|
+
devServerOrigin: string;
|
|
11
|
+
}): Plugin;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transforms asset import paths to use the development server base URL.
|
|
3
|
+
*/
|
|
4
|
+
export function assetBaseUrlTransform(code, devServerOrigin) {
|
|
5
|
+
const assetStringPattern = /(?<!https?:\/\/)(["'`])(\/[^"'`]+\.(svg|png|jpeg|jpg|gif|webp|mp3|mp4|woff|woff2|ttf|eot))\1/g;
|
|
6
|
+
code = code.replace(assetStringPattern, (match, quote, assetPath) => {
|
|
7
|
+
return `${quote}${devServerOrigin}${assetPath}${quote}`;
|
|
8
|
+
});
|
|
9
|
+
return code;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Vite plugin that transforms asset import paths to use the development server base URL.
|
|
13
|
+
*/
|
|
14
|
+
export function assetBaseUrlTransformPlugin(options) {
|
|
15
|
+
const { devServerOrigin } = options;
|
|
16
|
+
return {
|
|
17
|
+
name: "asset-base-url-transform",
|
|
18
|
+
enforce: "pre",
|
|
19
|
+
transform(code, id) {
|
|
20
|
+
if (!code) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
const transformedCode = assetBaseUrlTransform(code, devServerOrigin);
|
|
24
|
+
if (transformedCode === code) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
code: transformedCode,
|
|
29
|
+
map: null,
|
|
30
|
+
};
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=asset-base-url-transform-plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asset-base-url-transform-plugin.js","sourceRoot":"","sources":["../../src/server/asset-base-url-transform-plugin.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,UAAU,qBAAqB,CACnC,IAAY,EACZ,eAAuB;IAEvB,MAAM,kBAAkB,GAAG,+FAA+F,CAAC;IAE3H,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,kBAAkB,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE;QAClE,OAAO,GAAG,KAAK,GAAG,eAAe,GAAG,SAAS,GAAG,KAAK,EAAE,CAAC;IAC1D,CAAC,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,2BAA2B,CACzC,OAEC;IAED,MAAM,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC;IAEpC,OAAO;QACL,IAAI,EAAE,0BAA0B;QAChC,OAAO,EAAE,KAAK;QACd,SAAS,CAAC,IAAI,EAAE,EAAE;YAChB,IAAI,CAAC,IAAI,EAAE,CAAC;gBACV,OAAO,IAAI,CAAC;YACd,CAAC;YAED,MAAM,eAAe,GAAG,qBAAqB,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;YAErE,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"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { assetBaseUrlTransform } from "./asset-base-url-transform-plugin.js";
|
|
3
|
+
describe("assetBaseUrlTransform", () => {
|
|
4
|
+
const devServerOrigin = "http://localhost:3000";
|
|
5
|
+
it("should transform asset paths in single, double, and backtick quotes", () => {
|
|
6
|
+
const cases = [
|
|
7
|
+
{
|
|
8
|
+
desc: "single-quoted",
|
|
9
|
+
code: `const image = '/assets/logo.png';`,
|
|
10
|
+
expected: `const image = '${devServerOrigin}/assets/logo.png';`
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
desc: "double-quoted",
|
|
14
|
+
code: `const image = "/assets/logo.png";`,
|
|
15
|
+
expected: `const image = "${devServerOrigin}/assets/logo.png";`
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
desc: "backtick-quoted",
|
|
19
|
+
code: "const image = `/assets/logo.png`;",
|
|
20
|
+
expected: `const image = \`${devServerOrigin}/assets/logo.png\`;`
|
|
21
|
+
},
|
|
22
|
+
];
|
|
23
|
+
for (const { desc, code, expected } of cases) {
|
|
24
|
+
const result = assetBaseUrlTransform(code, devServerOrigin);
|
|
25
|
+
expect(result).toBe(expected);
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
it("should transform multiple asset paths", () => {
|
|
29
|
+
const code = `
|
|
30
|
+
const logo = '/assets/logo.png';
|
|
31
|
+
const icon = '/assets/icon.svg';
|
|
32
|
+
const font = '/assets/font.woff2';
|
|
33
|
+
`;
|
|
34
|
+
const result = assetBaseUrlTransform(code, devServerOrigin);
|
|
35
|
+
expect(result).toContain(`${devServerOrigin}/assets/logo.png`);
|
|
36
|
+
expect(result).toContain(`${devServerOrigin}/assets/icon.svg`);
|
|
37
|
+
expect(result).toContain(`${devServerOrigin}/assets/font.woff2`);
|
|
38
|
+
});
|
|
39
|
+
it("should not transform already absolute URLs", () => {
|
|
40
|
+
const code = `
|
|
41
|
+
const local = '/assets/logo.png';
|
|
42
|
+
const http = 'http://example.com/image.png';
|
|
43
|
+
const https = 'https://example.com/image.png';
|
|
44
|
+
`;
|
|
45
|
+
const result = assetBaseUrlTransform(code, devServerOrigin);
|
|
46
|
+
expect(result).toContain(`${devServerOrigin}/assets/logo.png`);
|
|
47
|
+
expect(result).toContain("http://example.com/image.png");
|
|
48
|
+
expect(result).toContain("https://example.com/image.png");
|
|
49
|
+
});
|
|
50
|
+
it("should not transform code without asset paths", () => {
|
|
51
|
+
const code = `const text = "Hello World";`;
|
|
52
|
+
const result = assetBaseUrlTransform(code, devServerOrigin);
|
|
53
|
+
expect(result).toBe(code);
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
//# sourceMappingURL=asset-base-url-transform-plugin.test.js.map
|
|
@@ -0,0 +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,MAAM,eAAe,GAAG,uBAAuB,CAAC;IAEhD,EAAE,CAAC,qEAAqE,EAAE,GAAG,EAAE;QAC7E,MAAM,KAAK,GAAG;YACZ;gBACE,IAAI,EAAE,eAAe;gBAC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C,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,EAAE,eAAe,CAAC,CAAC;QAE5D,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/server/server.d.ts
CHANGED
|
@@ -31,6 +31,8 @@ export type WidgetResourceMeta = {
|
|
|
31
31
|
export type WidgetHostType = "apps-sdk" | "mcp-app";
|
|
32
32
|
type McpServerOriginalResourceConfig = Omit<Resource, "uri" | "name" | "mimeType" | "_meta"> & {
|
|
33
33
|
_meta?: WidgetResourceMeta;
|
|
34
|
+
/** Restrict host types to a specific subset */
|
|
35
|
+
hosts?: WidgetHostType[];
|
|
34
36
|
};
|
|
35
37
|
type McpServerOriginalToolConfig = Omit<Parameters<typeof McpServerBase.prototype.registerTool<ZodRawShapeCompat, ZodRawShapeCompat>>[1], "inputSchema" | "outputSchema">;
|
|
36
38
|
type Simplify<T> = {
|
package/dist/server/server.js
CHANGED
|
@@ -13,66 +13,71 @@ const mergeWithUnion = (target, source) => {
|
|
|
13
13
|
export class McpServer extends McpServerBase {
|
|
14
14
|
registerWidget(name, resourceConfig, toolConfig, toolCallback) {
|
|
15
15
|
const userMeta = resourceConfig._meta;
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
uri: `ui://widgets/apps-sdk/${name}.html`,
|
|
19
|
-
mimeType: "text/html+skybridge",
|
|
20
|
-
buildContentMeta: ({ resourceDomains, connectDomains, domain }) => {
|
|
21
|
-
const userUi = userMeta?.ui;
|
|
22
|
-
const userCsp = userUi?.csp;
|
|
23
|
-
const defaults = {
|
|
24
|
-
"openai/widgetCSP": {
|
|
25
|
-
resource_domains: resourceDomains,
|
|
26
|
-
connect_domains: connectDomains,
|
|
27
|
-
},
|
|
28
|
-
"openai/widgetDomain": domain,
|
|
29
|
-
"openai/widgetDescription": toolConfig.description,
|
|
30
|
-
};
|
|
31
|
-
const fromUi = {
|
|
32
|
-
"openai/widgetCSP": {
|
|
33
|
-
resource_domains: userCsp?.resourceDomains,
|
|
34
|
-
connect_domains: userCsp?.connectDomains,
|
|
35
|
-
frame_domains: userCsp?.frameDomains,
|
|
36
|
-
redirect_domains: userCsp?.redirectDomains,
|
|
37
|
-
},
|
|
38
|
-
"openai/widgetDomain": userUi?.domain,
|
|
39
|
-
"openai/widgetPrefersBorder": userUi?.prefersBorder,
|
|
40
|
-
};
|
|
41
|
-
const directOpenaiKeys = Object.fromEntries(Object.entries(userMeta ?? {}).filter(([key]) => key.startsWith("openai/")));
|
|
42
|
-
return mergeWithUnion(mergeWithUnion(defaults, fromUi), directOpenaiKeys);
|
|
43
|
-
},
|
|
16
|
+
const toolMeta = {
|
|
17
|
+
...toolConfig._meta,
|
|
44
18
|
};
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
ui
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
19
|
+
if (!resourceConfig.hosts || resourceConfig.hosts.includes("apps-sdk")) {
|
|
20
|
+
const widgetConfig = {
|
|
21
|
+
hostType: "apps-sdk",
|
|
22
|
+
uri: `ui://widgets/apps-sdk/${name}.html`,
|
|
23
|
+
mimeType: "text/html+skybridge",
|
|
24
|
+
buildContentMeta: ({ resourceDomains, connectDomains, domain }) => {
|
|
25
|
+
const userUi = userMeta?.ui;
|
|
26
|
+
const userCsp = userUi?.csp;
|
|
27
|
+
const defaults = {
|
|
28
|
+
"openai/widgetCSP": {
|
|
29
|
+
resource_domains: resourceDomains,
|
|
30
|
+
connect_domains: connectDomains,
|
|
55
31
|
},
|
|
56
|
-
domain,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
32
|
+
"openai/widgetDomain": domain,
|
|
33
|
+
"openai/widgetDescription": toolConfig.description,
|
|
34
|
+
};
|
|
35
|
+
const fromUi = {
|
|
36
|
+
"openai/widgetCSP": {
|
|
37
|
+
resource_domains: userCsp?.resourceDomains,
|
|
38
|
+
connect_domains: userCsp?.connectDomains,
|
|
39
|
+
frame_domains: userCsp?.frameDomains,
|
|
40
|
+
redirect_domains: userCsp?.redirectDomains,
|
|
41
|
+
},
|
|
42
|
+
"openai/widgetDomain": userUi?.domain,
|
|
43
|
+
"openai/widgetPrefersBorder": userUi?.prefersBorder,
|
|
44
|
+
};
|
|
45
|
+
const directOpenaiKeys = Object.fromEntries(Object.entries(userMeta ?? {}).filter(([key]) => key.startsWith("openai/")));
|
|
46
|
+
return mergeWithUnion(mergeWithUnion(defaults, fromUi), directOpenaiKeys);
|
|
47
|
+
},
|
|
48
|
+
};
|
|
63
49
|
this.registerWidgetResource({
|
|
64
50
|
name,
|
|
65
51
|
widgetConfig,
|
|
66
52
|
resourceConfig,
|
|
67
53
|
});
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
54
|
+
toolMeta["openai/outputTemplate"] = widgetConfig.uri;
|
|
55
|
+
}
|
|
56
|
+
if (!resourceConfig.hosts || resourceConfig.hosts.includes("mcp-app")) {
|
|
57
|
+
const widgetConfig = {
|
|
58
|
+
hostType: "mcp-app",
|
|
59
|
+
uri: `ui://widgets/ext-apps/${name}.html`,
|
|
60
|
+
mimeType: "text/html;profile=mcp-app",
|
|
61
|
+
buildContentMeta: ({ resourceDomains, connectDomains, domain }) => {
|
|
62
|
+
const defaults = {
|
|
63
|
+
ui: {
|
|
64
|
+
csp: {
|
|
65
|
+
resourceDomains,
|
|
66
|
+
connectDomains,
|
|
67
|
+
},
|
|
68
|
+
domain,
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
return mergeWithUnion(defaults, { ui: userMeta?.ui });
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
this.registerWidgetResource({
|
|
75
|
+
name,
|
|
76
|
+
widgetConfig,
|
|
77
|
+
resourceConfig,
|
|
78
|
+
});
|
|
79
|
+
toolMeta.ui = { resourceUri: widgetConfig.uri };
|
|
80
|
+
}
|
|
76
81
|
this.registerTool(name, {
|
|
77
82
|
...toolConfig,
|
|
78
83
|
_meta: toolMeta,
|
|
@@ -87,7 +92,8 @@ export class McpServer extends McpServerBase {
|
|
|
87
92
|
const { hostType, uri: widgetUri, mimeType, buildContentMeta, } = widgetConfig;
|
|
88
93
|
this.registerResource(name, widgetUri, { ...resourceConfig, _meta: resourceConfig._meta }, async (uri, extra) => {
|
|
89
94
|
const isProduction = process.env.NODE_ENV === "production";
|
|
90
|
-
const
|
|
95
|
+
const useForwardedHost = process.env.SKYBRIDGE_USE_FORWARDED_HOST === "true";
|
|
96
|
+
const serverUrl = isProduction || useForwardedHost
|
|
91
97
|
? `https://${extra?.requestInfo?.headers?.["x-forwarded-host"] ?? extra?.requestInfo?.headers?.host}`
|
|
92
98
|
: "http://localhost:3000";
|
|
93
99
|
const html = isProduction
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/server/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,IAAI,MAAM,WAAW,CAAC;AAK7B,OAAO,EACL,SAAS,IAAI,aAAa,GAG3B,MAAM,yCAAyC,CAAC;AAcjD,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,MAAM,cAAc,GAAG,C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E,MAAM,EAAE,SAAS;gBACjB,cAAc,EAAE,CAAC,SAAS,CAAC;aAC5B,CAAC,CAAC;YAEH,OAAO;gBACL,QAAQ,EAAE;oBACR,EAAE,GAAG,EAAE,GAAG,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE;iBAC5D;aACF,CAAC;QACJ,CAAC,CACF,CAAC;IACJ,CAAC;IAEO,cAAc,CAAC,GAAW;QAChC,MAAM,QAAQ,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;QACrC,OAAO,QAAQ,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC;IAC7B,CAAC;IAEO,+BAA+B,CAAC,QAAgB;QACtD,MAAM,QAAQ,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;QAErC,MAAM,WAAW,GAAG,GAAG,QAAQ,MAAM,CAAC;QACtC,MAAM,YAAY,GAAG,GAAG,QAAQ,YAAY,CAAC;QAC7C,OAAO,QAAQ,CAAC,WAAW,CAAC,EAAE,IAAI,IAAI,QAAQ,CAAC,YAAY,CAAC,EAAE,IAAI,CAAC;IACrE,CAAC;IAEO,YAAY;QAClB,OAAO,IAAI,CAAC,KAAK,CACf,YAAY,CACV,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,eAAe,CAAC,EACpE,OAAO,CACR,CACF,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
<
|
|
2
|
-
<script type="module">window.skybridge = { hostType: "{{hostType}}" };</script>
|
|
1
|
+
<script type="module">window.skybridge = { hostType: "{{hostType}}", serverUrl: "{{serverUrl}}" };</script>
|
|
3
2
|
<script type="module">
|
|
4
3
|
import { injectIntoGlobalHook } from "{{serverUrl}}/assets/@react-refresh";
|
|
5
4
|
injectIntoGlobalHook(window); window.$RefreshReg$ = () => {};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
<
|
|
2
|
-
<script type="module">window.skybridge = { hostType: "{{hostType}}" };</script>
|
|
1
|
+
<script type="module">window.skybridge = { hostType: "{{hostType}}", serverUrl: "{{serverUrl}}" };</script>
|
|
3
2
|
<div id="root"></div>
|
|
4
3
|
<script type="module">
|
|
5
4
|
import('{{serverUrl}}/assets/{{widgetFile}}');
|