skybridge 0.17.4 → 0.19.0
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 +4 -0
- package/dist/cli/use-version.d.ts +1 -0
- package/dist/cli/use-version.js +33 -0
- package/dist/cli/use-version.js.map +1 -0
- package/dist/commands/dev.d.ts +7 -0
- package/dist/commands/dev.js +30 -0
- package/dist/commands/dev.js.map +1 -0
- package/dist/web/hooks/use-files.d.ts +1 -1
- package/dist/web/hooks/use-files.js +1 -1
- package/dist/web/hooks/use-files.js.map +1 -1
- package/dist/web/hooks/use-files.test.js +4 -4
- package/dist/web/hooks/use-files.test.js.map +1 -1
- package/dist/web/types.d.ts +1 -1
- package/package.json +2 -1
package/bin/run.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useVersion: () => string | undefined;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { useEffect, useState } from "react";
|
|
5
|
+
function findPackageJson(startDir) {
|
|
6
|
+
let currentDir = startDir;
|
|
7
|
+
const root = path.parse(currentDir).root;
|
|
8
|
+
while (currentDir !== root) {
|
|
9
|
+
const packageJsonPath = path.join(currentDir, "package.json");
|
|
10
|
+
if (existsSync(packageJsonPath)) {
|
|
11
|
+
return packageJsonPath;
|
|
12
|
+
}
|
|
13
|
+
currentDir = path.dirname(currentDir);
|
|
14
|
+
}
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
function getPackageVersion() {
|
|
18
|
+
const currentFileDir = path.dirname(fileURLToPath(import.meta.url));
|
|
19
|
+
const packageJsonPath = findPackageJson(currentFileDir);
|
|
20
|
+
if (!packageJsonPath) {
|
|
21
|
+
return "";
|
|
22
|
+
}
|
|
23
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
|
|
24
|
+
return packageJson.version || "";
|
|
25
|
+
}
|
|
26
|
+
export const useVersion = () => {
|
|
27
|
+
const [version, setVersion] = useState();
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
setVersion(getPackageVersion());
|
|
30
|
+
}, []);
|
|
31
|
+
return version;
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=use-version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-version.js","sourceRoot":"","sources":["../../src/cli/use-version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,SAAS,eAAe,CAAC,QAAgB;IACvC,IAAI,UAAU,GAAG,QAAQ,CAAC;IAC1B,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC;IAEzC,OAAO,UAAU,KAAK,IAAI,EAAE,CAAC;QAC3B,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;QAC9D,IAAI,UAAU,CAAC,eAAe,CAAC,EAAE,CAAC;YAChC,OAAO,eAAe,CAAC;QACzB,CAAC;QACD,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACxC,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,iBAAiB;IACxB,MAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IACpE,MAAM,eAAe,GAAG,eAAe,CAAC,cAAc,CAAC,CAAC;IAExD,IAAI,CAAC,eAAe,EAAE,CAAC;QACrB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC,CAAC;IACvE,OAAO,WAAW,CAAC,OAAO,IAAI,EAAE,CAAC;AACnC,CAAC;AAED,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,EAAE;IAC7B,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,EAAU,CAAC;IAEjD,SAAS,CAAC,GAAG,EAAE;QACb,UAAU,CAAC,iBAAiB,EAAE,CAAC,CAAC;IAClC,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { spawn } from "node:child_process";
|
|
3
|
+
import { Command } from "@oclif/core";
|
|
4
|
+
import { Box, render, Text } from "ink";
|
|
5
|
+
import { useEffect } from "react";
|
|
6
|
+
import { useVersion } from "../cli/use-version.js";
|
|
7
|
+
export default class Dev extends Command {
|
|
8
|
+
static description = "Start development server";
|
|
9
|
+
static examples = ["skybridge dev"];
|
|
10
|
+
static flags = {};
|
|
11
|
+
async run() {
|
|
12
|
+
console.clear();
|
|
13
|
+
const App = () => {
|
|
14
|
+
const version = useVersion();
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
const nodemon = spawn("nodemon", ["--quiet"], {
|
|
17
|
+
stdio: ["ignore", "ignore", "inherit"],
|
|
18
|
+
});
|
|
19
|
+
return () => {
|
|
20
|
+
if (nodemon && !nodemon.killed) {
|
|
21
|
+
nodemon.kill();
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
}, []);
|
|
25
|
+
return (_jsxs(Box, { flexDirection: "column", padding: 1, marginLeft: 1, children: [_jsxs(Box, { marginBottom: 1, children: [_jsxs(Text, { color: "cyan", bold: true, children: ["\u26F0", " ", "Welcome to Skybridge"] }), _jsxs(Text, { color: "cyan", children: [" v", 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" })] }) })] }));
|
|
26
|
+
};
|
|
27
|
+
render(_jsx(App, {}), { exitOnCtrlC: true, patchConsole: false });
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=dev.js.map
|
|
@@ -0,0 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ACH,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-files.js","sourceRoot":"","sources":["../../../src/web/hooks/use-files.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,QAAQ;IACtB,OAAO;QACL,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,UAAU;QAChC,
|
|
1
|
+
{"version":3,"file":"use-files.js","sourceRoot":"","sources":["../../../src/web/hooks/use-files.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,QAAQ;IACtB,OAAO;QACL,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,UAAU;QAChC,cAAc,EAAE,MAAM,CAAC,MAAM,CAAC,kBAAkB;KACjD,CAAC;AACJ,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { renderHook } from "@testing-library/react";
|
|
2
2
|
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
3
3
|
import { useFiles } from "./use-files.js";
|
|
4
|
-
describe("
|
|
4
|
+
describe("useFiles", () => {
|
|
5
5
|
const OpenaiMock = {
|
|
6
6
|
uploadFile: vi.fn(),
|
|
7
|
-
|
|
7
|
+
getFileDownloadUrl: vi.fn(),
|
|
8
8
|
};
|
|
9
9
|
beforeEach(() => {
|
|
10
10
|
vi.stubGlobal("openai", OpenaiMock);
|
|
@@ -22,8 +22,8 @@ describe("useLocale", () => {
|
|
|
22
22
|
it("should download a file from ChatGPT", () => {
|
|
23
23
|
const fileId = "123";
|
|
24
24
|
const { result } = renderHook(() => useFiles());
|
|
25
|
-
result.current.
|
|
26
|
-
expect(OpenaiMock.
|
|
25
|
+
result.current.getDownloadUrl({ fileId });
|
|
26
|
+
expect(OpenaiMock.getFileDownloadUrl).toHaveBeenCalledWith({ fileId });
|
|
27
27
|
});
|
|
28
28
|
});
|
|
29
29
|
//# sourceMappingURL=use-files.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-files.test.js","sourceRoot":"","sources":["../../../src/web/hooks/use-files.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"use-files.test.js","sourceRoot":"","sources":["../../../src/web/hooks/use-files.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;IACxB,MAAM,UAAU,GAAG;QACjB,UAAU,EAAE,EAAE,CAAC,EAAE,EAAE;QACnB,kBAAkB,EAAE,EAAE,CAAC,EAAE,EAAE;KAC5B,CAAC;IAEF,UAAU,CAAC,GAAG,EAAE;QACd,EAAE,CAAC,UAAU,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACb,EAAE,CAAC,gBAAgB,EAAE,CAAC;QACtB,EAAE,CAAC,aAAa,EAAE,CAAC;IACrB,CAAC,CAAC,CAAC;IAEH,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,EAAE,EAAE,UAAU,CAAC,CAAC;IAE3C,EAAE,CAAC,iCAAiC,EAAE,GAAG,EAAE;QACzC,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC;QAEhD,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QACjC,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,oBAAoB,CAAC,SAAS,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,qCAAqC,EAAE,GAAG,EAAE;QAC7C,MAAM,MAAM,GAAG,KAAK,CAAC;QACrB,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC;QAEhD,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;QAC1C,MAAM,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;IACzE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/web/types.d.ts
CHANGED
|
@@ -110,7 +110,7 @@ export type OpenAiMethods<WidgetState extends UnknownObject = UnknownObject> = {
|
|
|
110
110
|
* Downloads a file from the host that was previously uploaded.
|
|
111
111
|
* Only files uploaded by the same connector instance can be downloaded.
|
|
112
112
|
*/
|
|
113
|
-
|
|
113
|
+
getFileDownloadUrl: (file: FileMetadata) => Promise<{
|
|
114
114
|
downloadUrl: string;
|
|
115
115
|
}>;
|
|
116
116
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "skybridge",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0",
|
|
4
4
|
"description": "Skybridge is a framework for building ChatGPT apps",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
"es-toolkit": "^1.43.0",
|
|
42
42
|
"express": "^5.2.1",
|
|
43
43
|
"handlebars": "^4.7.8",
|
|
44
|
+
"ink": "^6.6.0",
|
|
44
45
|
"superjson": "^2.2.6",
|
|
45
46
|
"vite": "^7.3.1",
|
|
46
47
|
"zustand": "^5.0.9"
|