skybridge 0.0.0-dev.f49389e โ 0.0.0-dev.f615683
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 +73 -148
- package/dist/src/emulator/assets/index-BjyctK8j.js +133 -0
- package/dist/src/emulator/assets/index-BlZAHQDQ.css +1 -0
- package/dist/src/emulator/favicon.ico +0 -0
- package/dist/src/emulator/index.html +14 -0
- package/dist/src/server/emulatorStaticServer.d.ts +15 -0
- package/dist/src/server/emulatorStaticServer.js +38 -0
- package/dist/src/server/emulatorStaticServer.js.map +1 -0
- package/dist/src/server/index.d.ts +1 -2
- package/dist/src/server/index.js +1 -2
- package/dist/src/server/index.js.map +1 -1
- package/dist/src/server/inferUtilityTypes.d.ts +54 -0
- package/dist/src/server/inferUtilityTypes.js +2 -0
- package/dist/src/server/inferUtilityTypes.js.map +1 -0
- package/dist/src/server/server.d.ts +52 -9
- package/dist/src/server/server.js +12 -4
- package/dist/src/server/server.js.map +1 -1
- package/dist/src/server/templateHelper.js +2 -2
- package/dist/src/server/templateHelper.js.map +1 -1
- package/dist/src/server/widgetsDevServer.js +2 -2
- package/dist/src/server/widgetsDevServer.js.map +1 -1
- package/dist/src/test/utils.d.ts +62 -1
- package/dist/src/test/utils.js +124 -3
- package/dist/src/test/utils.js.map +1 -1
- package/dist/src/test/widget.test.js +19 -20
- package/dist/src/test/widget.test.js.map +1 -1
- package/dist/src/web/create-store.d.ts +3 -0
- package/dist/src/web/create-store.js +25 -0
- package/dist/src/web/create-store.js.map +1 -0
- package/dist/src/web/create-store.test.js +70 -0
- package/dist/src/web/create-store.test.js.map +1 -0
- package/dist/src/web/data-llm.d.ts +14 -0
- package/dist/src/web/data-llm.js +68 -0
- package/dist/src/web/data-llm.js.map +1 -0
- package/dist/src/web/data-llm.test.d.ts +1 -0
- package/dist/src/web/data-llm.test.js +76 -0
- package/dist/src/web/data-llm.test.js.map +1 -0
- package/dist/src/web/generate-helpers.d.ts +113 -0
- package/dist/src/web/generate-helpers.js +109 -0
- package/dist/src/web/generate-helpers.js.map +1 -0
- package/dist/src/web/generate-helpers.test-d.d.ts +1 -0
- package/dist/src/web/generate-helpers.test-d.js +154 -0
- package/dist/src/web/generate-helpers.test-d.js.map +1 -0
- package/dist/src/web/generate-helpers.test.d.ts +1 -0
- package/dist/src/web/generate-helpers.test.js +17 -0
- package/dist/src/web/generate-helpers.test.js.map +1 -0
- package/dist/src/web/helpers/state.d.ts +7 -0
- package/dist/src/web/helpers/state.js +40 -0
- package/dist/src/web/helpers/state.js.map +1 -0
- package/dist/src/web/helpers/state.test.d.ts +1 -0
- package/dist/src/web/helpers/state.test.js +53 -0
- package/dist/src/web/helpers/state.test.js.map +1 -0
- package/dist/src/web/hooks/index.d.ts +2 -3
- package/dist/src/web/hooks/index.js +2 -3
- package/dist/src/web/hooks/index.js.map +1 -1
- package/dist/src/web/hooks/use-call-tool.d.ts +63 -25
- package/dist/src/web/hooks/use-call-tool.js +14 -20
- package/dist/src/web/hooks/use-call-tool.js.map +1 -1
- package/dist/src/web/hooks/use-call-tool.test-d.d.ts +1 -0
- package/dist/src/web/hooks/use-call-tool.test-d.js +104 -0
- package/dist/src/web/hooks/use-call-tool.test-d.js.map +1 -0
- package/dist/src/web/hooks/use-call-tool.test.js +19 -12
- package/dist/src/web/hooks/use-call-tool.test.js.map +1 -1
- package/dist/src/web/hooks/use-display-mode.js.map +1 -1
- package/dist/src/web/hooks/use-display-mode.test.js +2 -2
- package/dist/src/web/hooks/use-display-mode.test.js.map +1 -1
- package/dist/src/web/hooks/use-files.d.ts +10 -0
- package/dist/src/web/hooks/use-files.js +7 -0
- package/dist/src/web/hooks/use-files.js.map +1 -0
- package/dist/src/web/hooks/use-files.test.d.ts +1 -0
- package/dist/src/web/hooks/use-files.test.js +29 -0
- package/dist/src/web/hooks/use-files.test.js.map +1 -0
- package/dist/src/web/hooks/use-locale.test.js +2 -2
- package/dist/src/web/hooks/use-locale.test.js.map +1 -1
- package/dist/src/web/hooks/use-open-external.test.js +2 -2
- package/dist/src/web/hooks/use-open-external.test.js.map +1 -1
- package/dist/src/web/hooks/use-openai-global.d.ts +2 -2
- package/dist/src/web/hooks/use-openai-global.js +4 -2
- package/dist/src/web/hooks/use-openai-global.js.map +1 -1
- package/dist/src/web/hooks/use-request-modal.d.ts +3 -2
- package/dist/src/web/hooks/use-request-modal.js.map +1 -1
- package/dist/src/web/hooks/use-request-modal.test.js +2 -2
- package/dist/src/web/hooks/use-request-modal.test.js.map +1 -1
- package/dist/src/web/hooks/use-theme.test.js +2 -2
- package/dist/src/web/hooks/use-theme.test.js.map +1 -1
- package/dist/src/web/hooks/use-tool-info.d.ts +24 -4
- package/dist/src/web/hooks/use-tool-info.js +17 -4
- package/dist/src/web/hooks/use-tool-info.js.map +1 -1
- package/dist/src/web/hooks/use-tool-info.test-d.d.ts +1 -0
- package/dist/src/web/hooks/use-tool-info.test-d.js +73 -0
- package/dist/src/web/hooks/use-tool-info.test-d.js.map +1 -0
- package/dist/src/web/hooks/use-tool-info.test.js +36 -15
- package/dist/src/web/hooks/use-tool-info.test.js.map +1 -1
- package/dist/src/web/hooks/use-user-agent.test.js +2 -2
- package/dist/src/web/hooks/use-user-agent.test.js.map +1 -1
- package/dist/src/web/hooks/use-widget-state.js +9 -7
- package/dist/src/web/hooks/use-widget-state.js.map +1 -1
- package/dist/src/web/hooks/use-widget-state.test.js +2 -3
- package/dist/src/web/hooks/use-widget-state.test.js.map +1 -1
- package/dist/src/web/index.d.ts +6 -3
- package/dist/src/web/index.js +6 -3
- package/dist/src/web/index.js.map +1 -1
- package/dist/src/web/mount-widget.d.ts +1 -1
- package/dist/src/web/mount-widget.js +35 -1
- package/dist/src/web/mount-widget.js.map +1 -1
- package/dist/src/web/plugin/data-llm.test.d.ts +1 -0
- package/dist/src/web/plugin/data-llm.test.js +81 -0
- package/dist/src/web/plugin/data-llm.test.js.map +1 -0
- package/dist/src/web/{plugin.js โ plugin/plugin.js} +5 -0
- package/dist/src/web/plugin/plugin.js.map +1 -0
- package/dist/src/web/plugin/transform-data-llm.d.ts +12 -0
- package/dist/src/web/plugin/transform-data-llm.js +93 -0
- package/dist/src/web/plugin/transform-data-llm.js.map +1 -0
- package/dist/src/web/plugin/transform-data-llm.test.d.ts +1 -0
- package/dist/src/web/plugin/transform-data-llm.test.js +81 -0
- package/dist/src/web/plugin/transform-data-llm.test.js.map +1 -0
- package/dist/src/web/proxy.d.ts +1 -0
- package/dist/src/web/proxy.js +48 -0
- package/dist/src/web/proxy.js.map +1 -0
- package/dist/src/web/types.d.ts +47 -28
- package/dist/src/web/types.js +1 -0
- package/dist/src/web/types.js.map +1 -1
- package/dist/vitest.config.js +0 -1
- package/dist/vitest.config.js.map +1 -1
- package/package.json +17 -7
- package/dist/src/test/setup.js +0 -9
- package/dist/src/test/setup.js.map +0 -1
- package/dist/src/web/hooks/use-tool-output.d.ts +0 -4
- package/dist/src/web/hooks/use-tool-output.js +0 -9
- package/dist/src/web/hooks/use-tool-output.js.map +0 -1
- package/dist/src/web/hooks/use-tool-response-metadata.d.ts +0 -4
- package/dist/src/web/hooks/use-tool-response-metadata.js +0 -8
- package/dist/src/web/hooks/use-tool-response-metadata.js.map +0 -1
- package/dist/src/web/plugin.js.map +0 -1
- /package/dist/src/{test/setup.d.ts โ web/create-store.test.d.ts} +0 -0
- /package/dist/src/web/{plugin.d.ts โ plugin/plugin.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -1,198 +1,123 @@
|
|
|
1
1
|
<div align="center">
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
**Skybridge is the TypeScript framework for building ChatGPT apps**
|
|
6
|
-
|
|
7
|
-
[](https://alpic.ai)
|
|
8
|
-
|
|
9
|
-

|
|
10
|
-

|
|
11
|
-

|
|
12
|
-
|
|
13
|
-
</div>
|
|
3
|
+
<img alt="Skybridge" src="docs/static/img/logo.png" width="220">
|
|
14
4
|
|
|
15
|
-
Skybridge
|
|
5
|
+
# Skybridge
|
|
16
6
|
|
|
17
|
-
|
|
18
|
-
- `skybridge/web`: A react library with hooks and components to build widgets on the underlying _OpenAI iFrame skybridge_ runtime.
|
|
7
|
+
**Build ChatGPT Apps. The Modern TypeScript Way.**
|
|
19
8
|
|
|
20
|
-
|
|
9
|
+
The fullstack TypeScript framework for ChatGPT Apps.<br />
|
|
10
|
+
**Type-safe. React-powered. Zero config.**
|
|
21
11
|
|
|
22
|
-
|
|
12
|
+
<br />
|
|
23
13
|
|
|
24
|
-
|
|
14
|
+
[](https://www.npmjs.com/package/skybridge)
|
|
15
|
+
[](https://www.npmjs.com/package/skybridge)
|
|
16
|
+
[](https://github.com/alpic-ai/skybridge/blob/main/LICENSE)
|
|
25
17
|
|
|
26
|
-
|
|
27
|
-
pnpm add skybridge
|
|
28
|
-
```
|
|
18
|
+
<br />
|
|
29
19
|
|
|
30
|
-
|
|
20
|
+
[Documentation](https://skybridge.tech) ยท [Quick Start](https://github.com/new?template_name=apps-sdk-template&template_owner=alpic-ai) ยท [Examples](https://github.com/alpic-ai/apps-sdk-template)
|
|
31
21
|
|
|
32
|
-
|
|
22
|
+
</div>
|
|
33
23
|
|
|
34
|
-
|
|
24
|
+
<br />
|
|
35
25
|
|
|
36
|
-
|
|
26
|
+
## โจ Why Skybridge?
|
|
37
27
|
|
|
38
|
-
|
|
28
|
+
ChatGPT Apps let you embed **rich, interactive UIs** directly in conversations. But the raw SDK is low-levelโno hooks, no type safety, no dev tools, and no HMR.
|
|
39
29
|
|
|
40
|
-
|
|
30
|
+
**Skybridge fixes that.**
|
|
41
31
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
web/
|
|
47
|
-
โโโ src/
|
|
48
|
-
โโโ widgets/
|
|
49
|
-
โโโ pokemon.tsx // Use the same widget name as the file name
|
|
50
|
-
```
|
|
32
|
+
| | |
|
|
33
|
+
|:--|:--|
|
|
34
|
+
| ๐จโ๐ป **Full Dev Environment** โ HMR, debug traces, and local emulator. No more refresh loops. | โ
**End-to-End Type Safety** โ tRPC-style inference from server to widget. Autocomplete everywhere. |
|
|
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. |
|
|
51
36
|
|
|
52
|
-
|
|
37
|
+
<br />
|
|
53
38
|
|
|
54
|
-
|
|
55
|
-
import { McpServer } from "skybridge/server";
|
|
39
|
+
## ๐ Get Started
|
|
56
40
|
|
|
57
|
-
|
|
41
|
+
**Create a new ChatGPT app:**
|
|
58
42
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
);
|
|
43
|
+
```bash
|
|
44
|
+
gh repo create my-app --template alpic-ai/apps-sdk-template --clone
|
|
45
|
+
cd my-app && pnpm install
|
|
63
46
|
```
|
|
64
47
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
```ts
|
|
68
|
-
import { mountWidget } from "skybridge/web";
|
|
69
|
-
|
|
70
|
-
const Pokemon: React.FunctionComponent = () => {
|
|
71
|
-
// Your React component code goes here...
|
|
72
|
-
};
|
|
48
|
+
**Or add to an existing project:**
|
|
73
49
|
|
|
74
|
-
|
|
50
|
+
```bash
|
|
51
|
+
npm i skybridge
|
|
52
|
+
yarn add skybridge
|
|
53
|
+
pnpm add skybridge
|
|
54
|
+
bun add skybridge
|
|
55
|
+
deno add skybridge
|
|
75
56
|
```
|
|
76
57
|
|
|
77
|
-
|
|
58
|
+
<div align="center">
|
|
78
59
|
|
|
79
|
-
|
|
60
|
+
**๐ [Read the Docs](https://skybridge.tech) ๐**
|
|
80
61
|
|
|
81
|
-
|
|
62
|
+
</div>
|
|
82
63
|
|
|
83
|
-
|
|
64
|
+
<br />
|
|
84
65
|
|
|
85
|
-
|
|
66
|
+
## ๐ฆ The Stack
|
|
86
67
|
|
|
87
|
-
|
|
68
|
+
- **`skybridge/server`** โ Drop-in MCP SDK replacement with widget registration and type inference.
|
|
69
|
+
- **`skybridge/web`** โ React hooks and components for ChatGPT's runtime.
|
|
88
70
|
|
|
89
|
-
|
|
71
|
+
### Server
|
|
90
72
|
|
|
91
73
|
```ts
|
|
92
|
-
import {
|
|
93
|
-
import { skybridge } from "skybridge/web";
|
|
74
|
+
import { McpServer } from "skybridge/server";
|
|
94
75
|
|
|
95
|
-
|
|
96
|
-
|
|
76
|
+
server.registerWidget("flights", {}, {
|
|
77
|
+
inputSchema: { destination: z.string() },
|
|
78
|
+
}, async ({ destination }) => {
|
|
79
|
+
const flights = await searchFlights(destination);
|
|
80
|
+
return { structuredContent: { flights } };
|
|
97
81
|
});
|
|
98
82
|
```
|
|
99
83
|
|
|
100
|
-
|
|
84
|
+
### Widget
|
|
101
85
|
|
|
102
|
-
|
|
86
|
+
```tsx
|
|
87
|
+
import { useToolInfo } from "skybridge/web";
|
|
103
88
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
- `useToolResponseMetadata`: A hook to get the initial tool `meta` returned when rendering the widget for the first time. The data inside this hook is not updated when the tool is called again.
|
|
107
|
-
- `useCallTool`: A @tanstack/react-query inspired hook to send make additional tool calls inside a widget.
|
|
89
|
+
function FlightsWidget() {
|
|
90
|
+
const { output } = useToolInfo();
|
|
108
91
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
const theme = useOpenAiGlobal("theme");
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
_useToolOutput_
|
|
118
|
-
|
|
119
|
-
```ts
|
|
120
|
-
import { useToolOutput } from "skybridge/web";
|
|
121
|
-
|
|
122
|
-
const toolOutput = useToolOutput();
|
|
92
|
+
return output.structuredContent.flights.map(f =>
|
|
93
|
+
<FlightCard key={f.id} flight={f} />
|
|
94
|
+
);
|
|
95
|
+
}
|
|
123
96
|
```
|
|
124
97
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
```ts
|
|
128
|
-
import { useToolResponseMetadata } from "skybridge/web";
|
|
129
|
-
|
|
130
|
-
const toolResponseMetadata = useToolResponseMetadata();
|
|
131
|
-
```
|
|
98
|
+
<br />
|
|
132
99
|
|
|
133
|
-
|
|
100
|
+
## ๐ฏ Features at a Glance
|
|
134
101
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
return (
|
|
142
|
-
<div>
|
|
143
|
-
<button
|
|
144
|
-
disabled={isPending}
|
|
145
|
-
onClick={() => {
|
|
146
|
-
callTool({ input: "test input" }, {
|
|
147
|
-
onSuccess: (data) => {
|
|
148
|
-
alert("Tool returned: " + data);
|
|
149
|
-
},
|
|
150
|
-
});
|
|
151
|
-
>
|
|
152
|
-
Call Tool inside a widget
|
|
153
|
-
</button>
|
|
154
|
-
</div>
|
|
155
|
-
);
|
|
156
|
-
};
|
|
157
|
-
```
|
|
102
|
+
- **Live Reload** โ Vite HMR. See changes instantly without reinstalling.
|
|
103
|
+
- **Typed Hooks** โ Full autocomplete for tools, inputs, outputs.
|
|
104
|
+
- **Widget โ Tool Calls** โ Trigger server actions from UI.
|
|
105
|
+
- **Dual Surface Sync** โ Keep model aware of what users see with `data-llm`.
|
|
106
|
+
- **React Query-style API** โ `isPending`, `isError`, callbacks.
|
|
107
|
+
- **MCP Compatible** โ Extends the official SDK. Works with any MCP client.
|
|
158
108
|
|
|
159
|
-
|
|
109
|
+
<br />
|
|
160
110
|
|
|
161
|
-
|
|
162
|
-
import { useCallTool } from "skybridge/web";
|
|
163
|
-
|
|
164
|
-
export const TestTool: React.FunctionComponent = () => {
|
|
165
|
-
const { callToolAsync, isPending } = useCallTool("myToolName");
|
|
166
|
-
|
|
167
|
-
return (
|
|
168
|
-
<div>
|
|
169
|
-
<button
|
|
170
|
-
disabled={isPending}
|
|
171
|
-
onClick={async () => {
|
|
172
|
-
const data = await callToolAsync({ input: "test input" });
|
|
173
|
-
alert("Tool returned: " + data);
|
|
174
|
-
}}
|
|
175
|
-
>
|
|
176
|
-
Call Tool inside a widget
|
|
177
|
-
</button>
|
|
178
|
-
</div>
|
|
179
|
-
);
|
|
180
|
-
};
|
|
181
|
-
```
|
|
111
|
+
<div align="center">
|
|
182
112
|
|
|
183
|
-
|
|
113
|
+
[](https://github.com/alpic-ai/skybridge/discussions)
|
|
114
|
+
[](https://github.com/alpic-ai/skybridge/issues)
|
|
115
|
+
[](https://discord.com/invite/gNAazGueab)
|
|
184
116
|
|
|
185
|
-
|
|
117
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for setup instructions
|
|
186
118
|
|
|
187
|
-
|
|
188
|
-
2. Create a new vite project in a folder named `web` and install the `skybridge` package
|
|
189
|
-
3. Replace the `vite.config.ts` file with the following:
|
|
119
|
+
<br />
|
|
190
120
|
|
|
191
|
-
|
|
192
|
-
import { defineConfig } from "vite";
|
|
193
|
-
import { skybridge } from "skybridge/web";
|
|
121
|
+
**[GPL-3.0 License](LICENSE)** ยท Made with โค๏ธ by **[Alpic](https://alpic.ai)**
|
|
194
122
|
|
|
195
|
-
|
|
196
|
-
plugins: [skybridge()],
|
|
197
|
-
});
|
|
198
|
-
```
|
|
123
|
+
</div>
|