@conversokit/bridge 0.1.0 → 0.1.1
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 +44 -0
- package/package.json +13 -2
package/README.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# @conversokit/bridge
|
|
2
|
+
|
|
3
|
+
Widget Bridge for ConversoKit — `<BridgeProvider>` + `useBridge()` that prefers `window.openai.callTool` and falls back to `fetch` for local dev.
|
|
4
|
+
|
|
5
|
+
Part of [ConversoKit](https://github.com/Xyborg/ConversoKit) — a boilerplate for building ChatGPT Apps (Apps SDK / MCP) in <30 minutes.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pnpm add @conversokit/bridge react
|
|
11
|
+
# or
|
|
12
|
+
npm install @conversokit/bridge react
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import { BridgeProvider, useBridge } from '@conversokit/bridge';
|
|
19
|
+
|
|
20
|
+
export function App() {
|
|
21
|
+
return (
|
|
22
|
+
<BridgeProvider baseUrl="http://localhost:3000">
|
|
23
|
+
<Search />
|
|
24
|
+
</BridgeProvider>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function Search() {
|
|
29
|
+
const bridge = useBridge();
|
|
30
|
+
const onSearch = async (query: string) => {
|
|
31
|
+
const { products } = await bridge.callTool('search_products', { query });
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Inside ChatGPT, the bridge calls `window.openai.callTool` directly. Outside (local dev, Storybook), it falls back to `fetch(<baseUrl>/tools/<name>)`.
|
|
37
|
+
|
|
38
|
+
## Documentation
|
|
39
|
+
|
|
40
|
+
Full docs and runnable examples live in the [main repo](https://github.com/Xyborg/ConversoKit#readme).
|
|
41
|
+
|
|
42
|
+
## License
|
|
43
|
+
|
|
44
|
+
Apache-2.0 © Martín Aberastegue
|
package/package.json
CHANGED
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@conversokit/bridge",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Widget Bridge for ConversoKit — `<BridgeProvider>` + `useBridge()` that prefers `window.openai.callTool` and falls back to `fetch` for local dev.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"react",
|
|
8
|
+
"mcp",
|
|
9
|
+
"openai",
|
|
10
|
+
"chatgpt-apps",
|
|
11
|
+
"tool-calling",
|
|
12
|
+
"conversokit"
|
|
13
|
+
],
|
|
14
|
+
"engines": {
|
|
15
|
+
"node": ">=18.0.0"
|
|
16
|
+
},
|
|
6
17
|
"repository": {
|
|
7
18
|
"type": "git",
|
|
8
19
|
"url": "git+https://github.com/Xyborg/ConversoKit.git",
|
|
@@ -21,7 +32,7 @@
|
|
|
21
32
|
],
|
|
22
33
|
"dependencies": {
|
|
23
34
|
"zod": "^3.22.2",
|
|
24
|
-
"@conversokit/shared": "0.1.
|
|
35
|
+
"@conversokit/shared": "0.1.1"
|
|
25
36
|
},
|
|
26
37
|
"peerDependencies": {
|
|
27
38
|
"react": "^18.0.0"
|