sunpeak 0.3.7 → 0.4.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 +28 -36
- package/dist/chatgpt/chatgpt-simulator.d.ts +13 -3
- package/dist/chatgpt/index.d.ts +1 -0
- package/dist/index.cjs +24 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +24 -6
- package/dist/index.js.map +1 -1
- package/dist/style.css +179 -7
- package/package.json +1 -1
- package/template/README.md +2 -14
- package/template/data/albums.json +112 -0
- package/template/data/places.json +49 -0
- package/template/dev/main.tsx +2 -59
- package/template/index.html +1 -1
- package/template/mcp/server.ts +4 -50
- package/template/src/App.tsx +86 -37
- package/template/src/components/album/album-card.tsx +45 -0
- package/template/src/components/album/albums.tsx +77 -0
- package/template/src/components/album/film-strip.tsx +50 -0
- package/template/src/components/album/fullscreen-viewer.tsx +60 -0
- package/template/src/components/album/index.ts +4 -0
- package/template/src/components/{openai-card.test.tsx → card/card.test.tsx} +12 -12
- package/template/src/components/{openai-card.tsx → card/card.tsx} +8 -8
- package/template/src/components/card/index.ts +1 -0
- package/template/src/components/{openai-carousel.test.tsx → carousel/carousel.test.tsx} +10 -10
- package/template/src/components/{openai-carousel.tsx → carousel/carousel.tsx} +7 -7
- package/template/src/components/carousel/index.ts +1 -0
- package/template/src/components/index.ts +4 -2
- package/template/src/components/simulations/albums-simulation.tsx +20 -0
- package/template/src/components/simulations/app-simulation.tsx +13 -0
- package/template/src/components/simulations/carousel-simulation.tsx +63 -0
- package/template/src/components/simulations/index.tsx +14 -0
package/README.md
CHANGED
|
@@ -17,9 +17,17 @@
|
|
|
17
17
|
|
|
18
18
|
The ChatGPT Apps SDK.
|
|
19
19
|
|
|
20
|
-
Build and test your
|
|
20
|
+
Build and test your MCP App UI locally with OpenAI apps-sdk-ui React components.
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
[Documentation](https://docs.sunpeak.ai/)
|
|
23
|
+
|
|
24
|
+
<div align="center">
|
|
25
|
+
<a href="https://docs.sunpeak.ai/library/chatgpt-simulator">
|
|
26
|
+
<picture>
|
|
27
|
+
<img alt="ChatGPT Simulator" src="https://sunpeak.ai/images/chatgpt-simulator.png">
|
|
28
|
+
</picture>
|
|
29
|
+
</a>
|
|
30
|
+
</div>
|
|
23
31
|
|
|
24
32
|
## Quickstart
|
|
25
33
|
|
|
@@ -31,37 +39,24 @@ Requirements: Node (20+), pnpm (10+)
|
|
|
31
39
|
pnpm dlx sunpeak new
|
|
32
40
|
```
|
|
33
41
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
Requirements: React (18+), Tailwind 4
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
pnpm add sunpeak
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
When using `ChatGPTSimulator`, import the styles in your entry file:
|
|
43
|
-
|
|
44
|
-
```tsx
|
|
45
|
-
import 'sunpeak/style.css';
|
|
46
|
-
import { ChatGPTSimulator } from 'sunpeak';
|
|
47
|
-
```
|
|
42
|
+
To add sunpeak to an existing project, refer to the [documentation](https://docs.sunpeak.ai/add-to-existing-project).
|
|
48
43
|
|
|
49
44
|
## Key Features
|
|
50
|
-
- 📺 ChatGPT simulator for local UI component development.
|
|
51
|
-
- 📚 Pre-built component library built on [openai/apps-sdk-ui](https://github.com/openai/apps-sdk-ui).
|
|
52
|
-
- 📱
|
|
53
|
-
- 🛜 Basic MCP server to serve your UI to ChatGPT prod out-of-the-box.
|
|
54
|
-
- 🧪 Testing framework that replicates advanced ChatGPT behavior locally.
|
|
45
|
+
- 📺 [ChatGPT simulator](https://docs.sunpeak.ai/library/chatgpt-simulator) for local UI component development.
|
|
46
|
+
- 📚 [Pre-built component library](https://docs.sunpeak.ai/template/ui-components) built on [openai/apps-sdk-ui](https://github.com/openai/apps-sdk-ui).
|
|
47
|
+
- 📱 [Multi-platform interface](https://docs.sunpeak.ai/library/multi-platform-apis) for portable MCP UI App development.
|
|
48
|
+
- 🛜 [Basic MCP server](https://docs.sunpeak.ai/library/mcp-server) to serve your UI to ChatGPT prod out-of-the-box.
|
|
49
|
+
- 🧪 [Testing framework](https://docs.sunpeak.ai/guides/testing) that replicates advanced ChatGPT behavior locally.
|
|
55
50
|
|
|
56
51
|
## Example Component
|
|
57
52
|
```tsx
|
|
58
|
-
import
|
|
59
|
-
import {
|
|
53
|
+
import "./styles/globals.css";
|
|
54
|
+
import { Card } from "./components/card";
|
|
60
55
|
|
|
61
56
|
export default function App() {
|
|
62
57
|
return (
|
|
63
|
-
<
|
|
64
|
-
image="https://
|
|
58
|
+
<Card
|
|
59
|
+
image="https://images.unsplash.com/photo-1520950237264-dfe336995c34?w=400&h=400&fit=crop"
|
|
65
60
|
imageAlt="Lady Bird Lake"
|
|
66
61
|
header="Lady Bird Lake"
|
|
67
62
|
metadata="⭐ 4.5 • Austin, TX"
|
|
@@ -69,26 +64,23 @@ export default function App() {
|
|
|
69
64
|
button2={{ children: "Learn More", onClick: () => {} }}
|
|
70
65
|
>
|
|
71
66
|
Scenic lake perfect for kayaking, paddleboarding, and trails.
|
|
72
|
-
</
|
|
67
|
+
</Card>
|
|
73
68
|
);
|
|
74
69
|
}
|
|
75
70
|
```
|
|
76
71
|
|
|
77
|
-
## Supported Platforms
|
|
78
|
-
|
|
79
|
-
- ✅ **OpenAI ChatGPT** - Fully supported ([design guidelines](https://developers.openai.com/apps-sdk/concepts/design-guidelines))
|
|
80
|
-
- 🔄 **Google Gemini** - Design system available (SDK support coming soon)
|
|
81
|
-
- 🔄 **Anthropic Claude** - Design system available (SDK support coming soon)
|
|
82
|
-
- 🔧 **Custom platforms** - Implement your own platform adapter
|
|
83
|
-
|
|
84
72
|
## What is sunpeak exactly?
|
|
85
73
|
|
|
86
74
|
sunpeak is an npm package consisting of:
|
|
87
75
|
|
|
88
76
|
1. **A CLI utility** for working with sunpeak (`./bin`).
|
|
89
|
-
2. **A
|
|
90
|
-
|
|
91
|
-
|
|
77
|
+
2. **A templated npm package** (`./template`). This template includes:
|
|
78
|
+
1. Project scaffold - Complete development setup with build, test, and dev tooling.
|
|
79
|
+
2. Pre-built UI components - Production-ready components following ChatGPT design guidelines.
|
|
80
|
+
3. **The `sunpeak` library** (`./src`). This library contains:
|
|
81
|
+
1. Multi-platform APIs - Abstraction layer for future platform support (Gemini, Claude).
|
|
82
|
+
2. ChatGPT simulator - Local development environment replicating ChatGPT's widget runtime.
|
|
83
|
+
3. MCP server - View local widgets in the real ChatGPT.
|
|
92
84
|
|
|
93
85
|
## Contributing
|
|
94
86
|
|
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
/**
|
|
3
|
+
* A simulation packages a component with its example data and metadata.
|
|
4
|
+
* Each simulation represents a complete app experience in the simulator.
|
|
5
|
+
*/
|
|
6
|
+
export interface Simulation {
|
|
7
|
+
value: string;
|
|
8
|
+
label: string;
|
|
9
|
+
component: React.ComponentType;
|
|
4
10
|
appName?: string;
|
|
5
11
|
appIcon?: string;
|
|
6
12
|
userMessage?: string;
|
|
7
13
|
toolOutput?: Record<string, unknown> | null;
|
|
8
14
|
widgetState?: Record<string, unknown> | null;
|
|
9
15
|
}
|
|
10
|
-
|
|
16
|
+
interface ChatGPTSimulatorProps {
|
|
17
|
+
children?: React.ReactNode;
|
|
18
|
+
simulations?: Simulation[];
|
|
19
|
+
}
|
|
20
|
+
export declare function ChatGPTSimulator({ children, simulations, }: ChatGPTSimulatorProps): import("react/jsx-runtime").JSX.Element;
|
|
11
21
|
export {};
|
package/dist/chatgpt/index.d.ts
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -3626,13 +3626,18 @@ const DEFAULT_THEME = "dark";
|
|
|
3626
3626
|
const DEFAULT_DISPLAY_MODE = "inline";
|
|
3627
3627
|
function ChatGPTSimulator({
|
|
3628
3628
|
children,
|
|
3629
|
-
|
|
3630
|
-
appIcon,
|
|
3631
|
-
userMessage,
|
|
3632
|
-
toolOutput = null,
|
|
3633
|
-
widgetState = null
|
|
3629
|
+
simulations = []
|
|
3634
3630
|
}) {
|
|
3635
3631
|
const [screenWidth, setScreenWidth] = React__namespace.useState("full");
|
|
3632
|
+
const [selectedKey, setSelectedKey] = React__namespace.useState(
|
|
3633
|
+
simulations.length > 0 ? simulations[0].value : ""
|
|
3634
|
+
);
|
|
3635
|
+
const selectedSim = simulations.find((sim) => sim.value === selectedKey);
|
|
3636
|
+
const appName = selectedSim == null ? void 0 : selectedSim.appName;
|
|
3637
|
+
const appIcon = selectedSim == null ? void 0 : selectedSim.appIcon;
|
|
3638
|
+
const userMessage = selectedSim == null ? void 0 : selectedSim.userMessage;
|
|
3639
|
+
const toolOutput = (selectedSim == null ? void 0 : selectedSim.toolOutput) ?? null;
|
|
3640
|
+
const widgetState = (selectedSim == null ? void 0 : selectedSim.widgetState) ?? null;
|
|
3636
3641
|
const mock = React.useMemo(
|
|
3637
3642
|
() => initMockOpenAI({
|
|
3638
3643
|
theme: DEFAULT_THEME,
|
|
@@ -3660,10 +3665,23 @@ function ChatGPTSimulator({
|
|
|
3660
3665
|
}
|
|
3661
3666
|
};
|
|
3662
3667
|
}, []);
|
|
3668
|
+
const SelectedComponent = selectedSim == null ? void 0 : selectedSim.component;
|
|
3669
|
+
const content = SelectedComponent ? /* @__PURE__ */ jsxRuntime.jsx(SelectedComponent, {}) : children;
|
|
3663
3670
|
return /* @__PURE__ */ jsxRuntime.jsx(ThemeProvider, { theme, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3664
3671
|
SimpleSidebar,
|
|
3665
3672
|
{
|
|
3666
3673
|
controls: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
|
|
3674
|
+
simulations.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(SidebarControl, { label: "Simulation", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3675
|
+
SidebarSelect,
|
|
3676
|
+
{
|
|
3677
|
+
value: selectedKey,
|
|
3678
|
+
onChange: (value) => setSelectedKey(value),
|
|
3679
|
+
options: simulations.map((sim) => ({
|
|
3680
|
+
value: sim.value,
|
|
3681
|
+
label: sim.label
|
|
3682
|
+
}))
|
|
3683
|
+
}
|
|
3684
|
+
) }),
|
|
3667
3685
|
/* @__PURE__ */ jsxRuntime.jsx(SidebarControl, { label: "Theme", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3668
3686
|
SidebarSelect,
|
|
3669
3687
|
{
|
|
@@ -3708,7 +3726,7 @@ function ChatGPTSimulator({
|
|
|
3708
3726
|
appName,
|
|
3709
3727
|
appIcon,
|
|
3710
3728
|
userMessage,
|
|
3711
|
-
children
|
|
3729
|
+
children: content
|
|
3712
3730
|
}
|
|
3713
3731
|
)
|
|
3714
3732
|
}
|