skybridge 0.0.0-dev.eb507fb → 0.0.0-dev.ecf87cf
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/dist/src/server/devtoolsStaticServer.d.ts +15 -0
- package/dist/src/server/devtoolsStaticServer.js +38 -0
- package/dist/src/server/devtoolsStaticServer.js.map +1 -0
- package/dist/src/server/index.d.ts +3 -2
- package/dist/src/server/index.js +1 -0
- package/dist/src/server/index.js.map +1 -1
- package/dist/src/server/inferUtilityTypes.d.ts +10 -0
- package/dist/src/server/server.d.ts +32 -15
- package/dist/src/server/server.js +52 -32
- package/dist/src/server/server.js.map +1 -1
- package/dist/src/server/templateHelper.d.ts +3 -0
- package/dist/src/server/templateHelper.js +3 -2
- package/dist/src/server/templateHelper.js.map +1 -1
- package/dist/src/server/templates/development.hbs +3 -2
- package/dist/src/server/templates/production.hbs +1 -0
- package/dist/src/test/utils.d.ts +53 -7
- package/dist/src/test/utils.js +78 -0
- package/dist/src/test/utils.js.map +1 -1
- package/dist/src/test/widget.test.js +68 -11
- package/dist/src/test/widget.test.js.map +1 -1
- package/dist/src/web/bridges/apps-sdk-adapter.d.ts +2 -0
- package/dist/src/web/bridges/apps-sdk-adapter.js +4 -0
- package/dist/src/web/bridges/apps-sdk-adapter.js.map +1 -0
- package/dist/src/web/bridges/apps-sdk-bridge.d.ts +8 -0
- package/dist/src/web/bridges/apps-sdk-bridge.js +41 -0
- package/dist/src/web/bridges/apps-sdk-bridge.js.map +1 -0
- package/dist/src/web/bridges/get-bridge-methods.d.ts +2 -0
- package/dist/src/web/bridges/get-bridge-methods.js +8 -0
- package/dist/src/web/bridges/get-bridge-methods.js.map +1 -0
- package/dist/src/web/bridges/hooks/use-apps-sdk-bridge.d.ts +2 -0
- package/dist/src/web/bridges/hooks/use-apps-sdk-bridge.js +7 -0
- package/dist/src/web/bridges/hooks/use-apps-sdk-bridge.js.map +1 -0
- package/dist/src/web/bridges/hooks/use-bridge.d.ts +2 -0
- package/dist/src/web/bridges/hooks/use-bridge.js +90 -0
- package/dist/src/web/bridges/hooks/use-bridge.js.map +1 -0
- package/dist/src/web/bridges/hooks/use-mcp-app-bridge.d.ts +4 -0
- package/dist/src/web/bridges/hooks/use-mcp-app-bridge.js +7 -0
- package/dist/src/web/bridges/hooks/use-mcp-app-bridge.js.map +1 -0
- package/dist/src/web/bridges/hooks/use-mcp-app-bridge.test.js +58 -0
- package/dist/src/web/bridges/hooks/use-mcp-app-bridge.test.js.map +1 -0
- package/dist/src/web/bridges/index.d.ts +4 -0
- package/dist/src/web/bridges/index.js +5 -0
- package/dist/src/web/bridges/index.js.map +1 -0
- package/dist/src/web/bridges/mcp-app-adapter.d.ts +2 -0
- package/dist/src/web/bridges/mcp-app-adapter.js +12 -0
- package/dist/src/web/bridges/mcp-app-adapter.js.map +1 -0
- package/dist/src/web/bridges/mcp-app-bridge.d.ts +30 -0
- package/dist/src/web/bridges/mcp-app-bridge.js +139 -0
- package/dist/src/web/bridges/mcp-app-bridge.js.map +1 -0
- package/dist/src/web/bridges/types.d.ts +32 -0
- package/dist/src/web/bridges/types.js +2 -0
- package/dist/src/web/bridges/types.js.map +1 -0
- package/dist/src/web/data-llm.test.js.map +1 -1
- package/dist/src/web/generate-helpers.d.ts +7 -5
- package/dist/src/web/generate-helpers.js +4 -2
- package/dist/src/web/generate-helpers.js.map +1 -1
- package/dist/src/web/generate-helpers.test-d.js +53 -1
- package/dist/src/web/generate-helpers.test-d.js.map +1 -1
- 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 +1 -1
- package/dist/src/web/hooks/use-call-tool.test.js +8 -14
- package/dist/src/web/hooks/use-call-tool.test.js.map +1 -1
- package/dist/src/web/hooks/use-display-mode.d.ts +2 -2
- package/dist/src/web/hooks/use-display-mode.js +6 -3
- package/dist/src/web/hooks/use-display-mode.js.map +1 -1
- package/dist/src/web/hooks/use-display-mode.test.js +1 -0
- package/dist/src/web/hooks/use-display-mode.test.js.map +1 -1
- package/dist/src/web/hooks/use-layout.d.ts +22 -0
- package/dist/src/web/hooks/use-layout.js +23 -0
- package/dist/src/web/hooks/use-layout.js.map +1 -0
- package/dist/src/web/hooks/use-layout.test.js +46 -0
- package/dist/src/web/hooks/use-layout.test.js.map +1 -0
- package/dist/src/web/hooks/use-openai-global.d.ts +3 -2
- package/dist/src/web/hooks/use-openai-global.js +3 -20
- package/dist/src/web/hooks/use-openai-global.js.map +1 -1
- package/dist/src/web/hooks/use-request-modal.d.ts +6 -3
- package/dist/src/web/hooks/use-request-modal.js +6 -1
- package/dist/src/web/hooks/use-request-modal.js.map +1 -1
- package/dist/src/web/hooks/use-request-modal.test.js +35 -2
- package/dist/src/web/hooks/use-request-modal.test.js.map +1 -1
- package/dist/src/web/hooks/use-tool-info.d.ts +1 -1
- package/dist/src/web/hooks/use-tool-info.js +5 -7
- package/dist/src/web/hooks/use-tool-info.js.map +1 -1
- package/dist/src/web/hooks/use-tool-info.test.js +1 -0
- package/dist/src/web/hooks/use-tool-info.test.js.map +1 -1
- package/dist/src/web/hooks/use-user.d.ts +18 -0
- package/dist/src/web/hooks/use-user.js +19 -0
- package/dist/src/web/hooks/use-user.js.map +1 -0
- package/dist/src/web/hooks/use-user.test.js +44 -0
- package/dist/src/web/hooks/use-user.test.js.map +1 -0
- package/dist/src/web/hooks/use-widget-state.js +2 -2
- package/dist/src/web/hooks/use-widget-state.js.map +1 -1
- package/dist/src/web/hooks/use-widget-state.test.js +1 -0
- package/dist/src/web/hooks/use-widget-state.test.js.map +1 -1
- 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/plugin.js +10 -4
- package/dist/src/web/plugin/plugin.js.map +1 -1
- package/dist/src/web/proxy.js +5 -0
- package/dist/src/web/proxy.js.map +1 -1
- package/dist/src/web/types.d.ts +24 -6
- package/dist/src/web/types.js.map +1 -1
- package/package.json +8 -6
- package/LICENSE +0 -674
- package/README.md +0 -123
- package/dist/src/web/hooks/use-locale.d.ts +0 -1
- package/dist/src/web/hooks/use-locale.js +0 -5
- package/dist/src/web/hooks/use-locale.js.map +0 -1
- package/dist/src/web/hooks/use-locale.test.js +0 -21
- package/dist/src/web/hooks/use-locale.test.js.map +0 -1
- package/dist/src/web/hooks/use-theme.d.ts +0 -1
- package/dist/src/web/hooks/use-theme.js +0 -5
- package/dist/src/web/hooks/use-theme.js.map +0 -1
- package/dist/src/web/hooks/use-theme.test.js +0 -26
- package/dist/src/web/hooks/use-theme.test.js.map +0 -1
- package/dist/src/web/hooks/use-user-agent.d.ts +0 -1
- package/dist/src/web/hooks/use-user-agent.js +0 -5
- package/dist/src/web/hooks/use-user-agent.js.map +0 -1
- package/dist/src/web/hooks/use-user-agent.test.js +0 -31
- package/dist/src/web/hooks/use-user-agent.test.js.map +0 -1
- /package/dist/src/web/{hooks/use-locale.test.d.ts → bridges/hooks/use-mcp-app-bridge.test.d.ts} +0 -0
- /package/dist/src/web/hooks/{use-theme.test.d.ts → use-layout.test.d.ts} +0 -0
- /package/dist/src/web/hooks/{use-user-agent.test.d.ts → use-user.test.d.ts} +0 -0
package/README.md
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
<div align="center">
|
|
2
|
-
|
|
3
|
-
<img alt="Skybridge" src="docs/static/img/logo.png" width="220">
|
|
4
|
-
|
|
5
|
-
# Skybridge
|
|
6
|
-
|
|
7
|
-
**Build ChatGPT Apps. The Modern TypeScript Way.**
|
|
8
|
-
|
|
9
|
-
The fullstack TypeScript framework for ChatGPT Apps.<br />
|
|
10
|
-
**Type-safe. React-powered. Zero config.**
|
|
11
|
-
|
|
12
|
-
<br />
|
|
13
|
-
|
|
14
|
-
[](https://www.npmjs.com/package/skybridge)
|
|
15
|
-
[](https://www.npmjs.com/package/skybridge)
|
|
16
|
-
[](https://github.com/alpic-ai/skybridge/blob/main/LICENSE)
|
|
17
|
-
|
|
18
|
-
<br />
|
|
19
|
-
|
|
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)
|
|
21
|
-
|
|
22
|
-
</div>
|
|
23
|
-
|
|
24
|
-
<br />
|
|
25
|
-
|
|
26
|
-
## ✨ Why Skybridge?
|
|
27
|
-
|
|
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.
|
|
29
|
-
|
|
30
|
-
**Skybridge fixes that.**
|
|
31
|
-
|
|
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. |
|
|
36
|
-
|
|
37
|
-
<br />
|
|
38
|
-
|
|
39
|
-
## 🚀 Get Started
|
|
40
|
-
|
|
41
|
-
**Create a new ChatGPT app:**
|
|
42
|
-
|
|
43
|
-
```bash
|
|
44
|
-
gh repo create my-app --template alpic-ai/apps-sdk-template --clone
|
|
45
|
-
cd my-app && pnpm install
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
**Or add to an existing project:**
|
|
49
|
-
|
|
50
|
-
```bash
|
|
51
|
-
npm i skybridge
|
|
52
|
-
yarn add skybridge
|
|
53
|
-
pnpm add skybridge
|
|
54
|
-
bun add skybridge
|
|
55
|
-
deno add skybridge
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
<div align="center">
|
|
59
|
-
|
|
60
|
-
**👉 [Read the Docs](https://skybridge.tech) 👈**
|
|
61
|
-
|
|
62
|
-
</div>
|
|
63
|
-
|
|
64
|
-
<br />
|
|
65
|
-
|
|
66
|
-
## 📦 The Stack
|
|
67
|
-
|
|
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.
|
|
70
|
-
|
|
71
|
-
### Server
|
|
72
|
-
|
|
73
|
-
```ts
|
|
74
|
-
import { McpServer } from "skybridge/server";
|
|
75
|
-
|
|
76
|
-
server.registerWidget("flights", {}, {
|
|
77
|
-
inputSchema: { destination: z.string() },
|
|
78
|
-
}, async ({ destination }) => {
|
|
79
|
-
const flights = await searchFlights(destination);
|
|
80
|
-
return { structuredContent: { flights } };
|
|
81
|
-
});
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
### Widget
|
|
85
|
-
|
|
86
|
-
```tsx
|
|
87
|
-
import { useToolInfo } from "skybridge/web";
|
|
88
|
-
|
|
89
|
-
function FlightsWidget() {
|
|
90
|
-
const { output } = useToolInfo();
|
|
91
|
-
|
|
92
|
-
return output.structuredContent.flights.map(f =>
|
|
93
|
-
<FlightCard key={f.id} flight={f} />
|
|
94
|
-
);
|
|
95
|
-
}
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
<br />
|
|
99
|
-
|
|
100
|
-
## 🎯 Features at a Glance
|
|
101
|
-
|
|
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.
|
|
108
|
-
|
|
109
|
-
<br />
|
|
110
|
-
|
|
111
|
-
<div align="center">
|
|
112
|
-
|
|
113
|
-
[](https://github.com/alpic-ai/skybridge/discussions)
|
|
114
|
-
[](https://github.com/alpic-ai/skybridge/issues)
|
|
115
|
-
[](https://discord.com/invite/gNAazGueab)
|
|
116
|
-
|
|
117
|
-
See [CONTRIBUTING.md](CONTRIBUTING.md) for setup instructions
|
|
118
|
-
|
|
119
|
-
<br />
|
|
120
|
-
|
|
121
|
-
**[GPL-3.0 License](LICENSE)** · Made with ❤️ by **[Alpic](https://alpic.ai)**
|
|
122
|
-
|
|
123
|
-
</div>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function useLocale(): string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-locale.js","sourceRoot":"","sources":["../../../../src/web/hooks/use-locale.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,MAAM,UAAU,SAAS;IACvB,OAAO,eAAe,CAAC,QAAQ,CAAE,CAAC;AACpC,CAAC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { renderHook } from "@testing-library/react";
|
|
2
|
-
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
3
|
-
import { useLocale } from "./use-locale.js";
|
|
4
|
-
describe("useLocale", () => {
|
|
5
|
-
let OpenaiMock;
|
|
6
|
-
beforeEach(() => {
|
|
7
|
-
OpenaiMock = {
|
|
8
|
-
locale: "en-US",
|
|
9
|
-
};
|
|
10
|
-
vi.stubGlobal("openai", OpenaiMock);
|
|
11
|
-
});
|
|
12
|
-
afterEach(() => {
|
|
13
|
-
vi.unstubAllGlobals();
|
|
14
|
-
vi.resetAllMocks();
|
|
15
|
-
});
|
|
16
|
-
it("should return the current locale from window.openai.locale", () => {
|
|
17
|
-
const { result } = renderHook(() => useLocale());
|
|
18
|
-
expect(result.current).toBe("en-US");
|
|
19
|
-
});
|
|
20
|
-
});
|
|
21
|
-
//# sourceMappingURL=use-locale.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-locale.test.js","sourceRoot":"","sources":["../../../../src/web/hooks/use-locale.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,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;IACzB,IAAI,UAEH,CAAC;IAEF,UAAU,CAAC,GAAG,EAAE;QACd,UAAU,GAAG;YACX,MAAM,EAAE,OAAO;SAChB,CAAC;QACF,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,EAAE,CAAC,4DAA4D,EAAE,GAAG,EAAE;QACpE,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,SAAS,EAAE,CAAC,CAAC;QAEjD,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function useTheme(): import("../types.js").Theme;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-theme.js","sourceRoot":"","sources":["../../../../src/web/hooks/use-theme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,MAAM,UAAU,QAAQ;IACtB,OAAO,eAAe,CAAC,OAAO,CAAE,CAAC;AACnC,CAAC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { renderHook } from "@testing-library/react";
|
|
2
|
-
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
3
|
-
import { useTheme } from "./use-theme.js";
|
|
4
|
-
describe("useTheme", () => {
|
|
5
|
-
let OpenaiMock;
|
|
6
|
-
beforeEach(() => {
|
|
7
|
-
OpenaiMock = {
|
|
8
|
-
theme: "light",
|
|
9
|
-
};
|
|
10
|
-
vi.stubGlobal("openai", OpenaiMock);
|
|
11
|
-
});
|
|
12
|
-
afterEach(() => {
|
|
13
|
-
vi.unstubAllGlobals();
|
|
14
|
-
vi.resetAllMocks();
|
|
15
|
-
});
|
|
16
|
-
it("should return the current theme from window.openai.theme", () => {
|
|
17
|
-
const { result } = renderHook(() => useTheme());
|
|
18
|
-
expect(result.current).toBe("light");
|
|
19
|
-
});
|
|
20
|
-
it("should return dark theme when set to dark", () => {
|
|
21
|
-
OpenaiMock.theme = "dark";
|
|
22
|
-
const { result } = renderHook(() => useTheme());
|
|
23
|
-
expect(result.current).toBe("dark");
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
//# sourceMappingURL=use-theme.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-theme.test.js","sourceRoot":"","sources":["../../../../src/web/hooks/use-theme.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,IAAI,UAEH,CAAC;IAEF,UAAU,CAAC,GAAG,EAAE;QACd,UAAU,GAAG;YACX,KAAK,EAAE,OAAO;SACf,CAAC;QACF,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,EAAE,CAAC,0DAA0D,EAAE,GAAG,EAAE;QAClE,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC;QAEhD,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,2CAA2C,EAAE,GAAG,EAAE;QACnD,UAAU,CAAC,KAAK,GAAG,MAAM,CAAC;QAC1B,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC;QAEhD,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function useUserAgent(): import("../types.js").UserAgent;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-user-agent.js","sourceRoot":"","sources":["../../../../src/web/hooks/use-user-agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,MAAM,UAAU,YAAY;IAC1B,OAAO,eAAe,CAAC,WAAW,CAAE,CAAC;AACvC,CAAC"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { renderHook } from "@testing-library/react";
|
|
2
|
-
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
3
|
-
import { useUserAgent } from "./use-user-agent.js";
|
|
4
|
-
describe("useUserAgent", () => {
|
|
5
|
-
let OpenaiMock;
|
|
6
|
-
beforeEach(() => {
|
|
7
|
-
OpenaiMock = {
|
|
8
|
-
userAgent: {
|
|
9
|
-
device: { type: "mobile" },
|
|
10
|
-
capabilities: { hover: false, touch: true },
|
|
11
|
-
},
|
|
12
|
-
};
|
|
13
|
-
vi.stubGlobal("openai", OpenaiMock);
|
|
14
|
-
});
|
|
15
|
-
afterEach(() => {
|
|
16
|
-
vi.unstubAllGlobals();
|
|
17
|
-
vi.resetAllMocks();
|
|
18
|
-
});
|
|
19
|
-
it("should return the current user agent from window.openai.userAgent", () => {
|
|
20
|
-
OpenaiMock.userAgent = {
|
|
21
|
-
device: { type: "mobile" },
|
|
22
|
-
capabilities: { hover: false, touch: true },
|
|
23
|
-
};
|
|
24
|
-
const { result } = renderHook(() => useUserAgent());
|
|
25
|
-
expect(result.current).toEqual({
|
|
26
|
-
device: { type: "mobile" },
|
|
27
|
-
capabilities: { hover: false, touch: true },
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
//# sourceMappingURL=use-user-agent.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-user-agent.test.js","sourceRoot":"","sources":["../../../../src/web/hooks/use-user-agent.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;AAEzE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,IAAI,UAEH,CAAC;IAEF,UAAU,CAAC,GAAG,EAAE;QACd,UAAU,GAAG;YACX,SAAS,EAAE;gBACT,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gBAC1B,YAAY,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE;aAC5C;SACF,CAAC;QACF,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,EAAE,CAAC,mEAAmE,EAAE,GAAG,EAAE;QAC3E,UAAU,CAAC,SAAS,GAAG;YACrB,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC1B,YAAY,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE;SAC5C,CAAC;QACF,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,YAAY,EAAE,CAAC,CAAC;QAEpD,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC;YAC7B,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC1B,YAAY,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE;SAC5C,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
/package/dist/src/web/{hooks/use-locale.test.d.ts → bridges/hooks/use-mcp-app-bridge.test.d.ts}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|