skybridge 0.0.0-dev.3b1b0b4 → 0.0.0-dev.48d02a0
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 +1 -56
- package/dist/src/server/templates/development.hbs +11 -0
- package/dist/src/server/templates/production.hbs +5 -0
- package/dist/src/web/index.d.ts +1 -0
- package/dist/src/web/index.js +1 -0
- package/dist/src/web/index.js.map +1 -1
- package/dist/src/web/plugin.d.ts +2 -0
- package/dist/src/web/plugin.js +29 -0
- package/dist/src/web/plugin.js.map +1 -0
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -1,58 +1,3 @@
|
|
|
1
|
-
<div align="center">
|
|
2
|
-
|
|
3
1
|
# Skybridge
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
[](https://alpic.ai)
|
|
8
|
-
|
|
9
|
-

|
|
10
|
-

|
|
11
|
-

|
|
12
|
-
|
|
13
|
-
</div>
|
|
14
|
-
|
|
15
|
-
Skybridge comes with 2 packages:
|
|
16
|
-
|
|
17
|
-
- `skybridge/server`: A drop-in replacement of the `@modelcontextprotocol/sdk` official `McpServer` class with extra features for widget development.
|
|
18
|
-
- `skybridge/web`: A react library with hooks and components to build widgets on the underlying _OpenAI iFrame skybridge_ runtime.
|
|
19
|
-
|
|
20
|
-
## Quick start
|
|
21
|
-
|
|
22
|
-
To get started in less than a minute, you can [create a new repository](https://github.com/new?template_name=apps-sdk-template&template_owner=alpic-ai) using our [ChatGPT SDK template](https://github.com/alpic-ai/apps-sdk-template). This template includes a basic setup for both the server and the widgets.
|
|
23
|
-
|
|
24
|
-
## Installation
|
|
25
|
-
|
|
26
|
-
```bash
|
|
27
|
-
pnpm add skybridge
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
## Packages
|
|
31
|
-
|
|
32
|
-
### skybridge/server
|
|
33
|
-
|
|
34
|
-
The `skybridge/server` package is a drop-in replacement of the `@modelcontextprotocol/sdk` official `McpServer` class with extra features for widget development. If you're already using the `@modelcontextprotocol/sdk`, you can simply replace your `McpServer` import with `skybridge/server` and you're good to go.
|
|
35
|
-
|
|
36
|
-
### skybridge/web
|
|
37
|
-
|
|
38
|
-
The `skybridge/web` package is a react library with hooks and components to build widgets on the underlying _OpenAI iFrame skybridge_ runtime.
|
|
39
|
-
|
|
40
|
-
**Vite plugin**
|
|
41
|
-
|
|
42
|
-
The `skybridge/web` package comes with a Vite plugin that allows you to build your widgets as regular Vite apps.
|
|
43
|
-
|
|
44
|
-
```ts
|
|
45
|
-
import { defineConfig } from "vite";
|
|
46
|
-
import { skybridge } from "skybridge/web";
|
|
47
|
-
|
|
48
|
-
export default defineConfig({
|
|
49
|
-
plugins: [skybridge()],
|
|
50
|
-
});
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
## Migrate your existing MCP server to a ChatGPT app
|
|
54
|
-
|
|
55
|
-
If you're already using the `@modelcontextprotocol/sdk` to build a MCP server, you can migrate to a ChatGPT app by following these steps:
|
|
56
|
-
|
|
57
|
-
1. Replace your `McpServer` import from `@modelcontextprotocol/sdk` with the same import from `skybridge/server`
|
|
58
|
-
2. Create a new node project named `web` and install the `skybridge` package
|
|
3
|
+
Skybridge is a framework for building ChatGPT apps
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<script type="module">
|
|
2
|
+
import { injectIntoGlobalHook } from "{{serverUrl}}/@react-refresh";
|
|
3
|
+
injectIntoGlobalHook(window); window.$RefreshReg$ = () => {};
|
|
4
|
+
window.$RefreshSig$ = () => (type) => type;
|
|
5
|
+
window.__vite_plugin_react_preamble_installed__ = true;
|
|
6
|
+
</script>
|
|
7
|
+
<script type="module" src="{{serverUrl}}/@vite/client"></script>
|
|
8
|
+
<div id="root"></div>
|
|
9
|
+
<script type="module">
|
|
10
|
+
import('{{serverUrl}}/src/widgets/{{widgetName}}.tsx');
|
|
11
|
+
</script>
|
package/dist/src/web/index.d.ts
CHANGED
package/dist/src/web/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/web/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/web/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { globSync } from "node:fs";
|
|
2
|
+
import { resolve, dirname } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
export function skybridge() {
|
|
5
|
+
return {
|
|
6
|
+
name: "skybridge",
|
|
7
|
+
config() {
|
|
8
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
9
|
+
const input = Object.fromEntries(globSync("src/widgets/*.{js,ts,jsx,tsx,html}").map((file) => [
|
|
10
|
+
file.match(/^src\/widgets\/(.+)\.tsx$/)?.[1] ?? file.slice(10, -3),
|
|
11
|
+
resolve(__dirname, file),
|
|
12
|
+
]));
|
|
13
|
+
return {
|
|
14
|
+
build: {
|
|
15
|
+
minify: true,
|
|
16
|
+
cssCodeSplit: false,
|
|
17
|
+
rollupOptions: {
|
|
18
|
+
input,
|
|
19
|
+
output: {
|
|
20
|
+
entryFileNames: "[name].js",
|
|
21
|
+
assetFileNames: "[name][extname]",
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../../src/web/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGzC,MAAM,UAAU,SAAS;IACvB,OAAO;QACL,IAAI,EAAE,WAAW;QAEjB,MAAM;YACJ,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;YAC1D,MAAM,KAAK,GAAG,MAAM,CAAC,WAAW,CAC9B,QAAQ,CAAC,oCAAoC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;gBAC3D,IAAI,CAAC,KAAK,CAAC,2BAA2B,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;gBAClE,OAAO,CAAC,SAAS,EAAE,IAAI,CAAC;aACzB,CAAC,CACH,CAAC;YAEF,OAAO;gBACL,KAAK,EAAE;oBACL,MAAM,EAAE,IAAI;oBACZ,YAAY,EAAE,KAAK;oBACnB,aAAa,EAAE;wBACb,KAAK;wBACL,MAAM,EAAE;4BACN,cAAc,EAAE,WAAW;4BAC3B,cAAc,EAAE,iBAAiB;yBAClC;qBACF;iBACF;aACF,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "skybridge",
|
|
3
|
-
"version": "0.0.0-dev.
|
|
3
|
+
"version": "0.0.0-dev.48d02a0",
|
|
4
4
|
"description": "Skybridge is a framework for building ChatGPT apps",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
19
|
"scripts": {
|
|
20
|
-
"build": "tsc",
|
|
20
|
+
"build": "tsc && pnpm run build:templates",
|
|
21
|
+
"build:templates": "cp -r src/server/templates dist/src/server/",
|
|
21
22
|
"test": "vitest run --silent"
|
|
22
23
|
},
|
|
23
24
|
"keywords": [
|