sunpeak 0.8.8 → 0.9.2
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/bin/sunpeak.js +4 -0
- package/dist/chatgpt/chatgpt-simulator.d.ts +1 -2
- package/dist/chatgpt/index.cjs +9 -0
- package/dist/chatgpt/index.cjs.map +1 -0
- package/dist/chatgpt/index.d.ts +3 -1
- package/dist/chatgpt/index.js +9 -0
- package/dist/chatgpt/index.js.map +1 -0
- package/dist/chatgpt/simulator-url.d.ts +127 -0
- package/dist/index.cjs +39 -8448
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +58 -8466
- package/dist/index.js.map +1 -1
- package/dist/mcp/entry.cjs +2 -1
- package/dist/mcp/entry.cjs.map +1 -1
- package/dist/mcp/entry.js +2 -1
- package/dist/mcp/entry.js.map +1 -1
- package/dist/mcp/index.cjs +1 -1
- package/dist/mcp/index.d.ts +1 -1
- package/dist/mcp/index.js +1 -1
- package/dist/mcp/server.d.ts +1 -1
- package/dist/mcp/types.d.ts +3 -9
- package/dist/{server-DVmTC-SF.js → server-310A1k9o.js} +2 -2
- package/dist/{server-DVmTC-SF.js.map → server-310A1k9o.js.map} +1 -1
- package/dist/{server-B9YgCQdS.cjs → server-CSybLAYo.cjs} +2 -2
- package/dist/{server-B9YgCQdS.cjs.map → server-CSybLAYo.cjs.map} +1 -1
- package/dist/simulator-url-CG8lAAC3.cjs +8545 -0
- package/dist/simulator-url-CG8lAAC3.cjs.map +1 -0
- package/dist/simulator-url-CexnaL-e.js +8529 -0
- package/dist/simulator-url-CexnaL-e.js.map +1 -0
- package/dist/style.css +5858 -5843
- package/dist/types/simulation.d.ts +6 -32
- package/package.json +7 -3
- package/template/.sunpeak/dev.tsx +12 -7
- package/template/dist/albums.js +1 -1
- package/template/dist/albums.json +1 -1
- package/template/dist/carousel.js +1 -1
- package/template/dist/carousel.json +1 -1
- package/template/dist/map.js +1 -1
- package/template/dist/map.json +1 -1
- package/template/dist/review.js +2 -2
- package/template/dist/review.json +1 -1
- package/template/node_modules/.bin/playwright +21 -0
- package/template/node_modules/.vite/deps/@openai_apps-sdk-ui_components_SegmentedControl.js +4 -4
- package/template/node_modules/.vite/deps/@openai_apps-sdk-ui_components_Select.js +6 -6
- package/template/node_modules/.vite/deps/_metadata.json +28 -28
- package/template/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -1
- package/template/package.json +3 -1
- package/template/playwright.config.ts +26 -0
- package/template/src/resources/review-resource.test.tsx +2 -2
- package/template/src/resources/review-resource.tsx +6 -1
- package/template/src/simulations/albums-show-simulation.json +1 -1
- package/template/src/simulations/carousel-show-simulation.json +1 -1
- package/template/src/simulations/map-show-simulation.json +1 -1
- package/template/src/simulations/review-diff-simulation.json +1 -1
- package/template/src/simulations/review-post-simulation.json +1 -1
- package/template/src/simulations/review-purchase-simulation.json +1 -1
- package/template/test-results/.last-run.json +4 -0
- package/template/tests/e2e/albums.spec.ts +120 -0
- package/template/tests/e2e/carousel.spec.ts +127 -0
- package/template/tests/e2e/map.spec.ts +188 -0
- package/template/tests/e2e/review.spec.ts +245 -0
- package/template/vitest.config.ts +1 -0
- package/template/.sunpeak/vite-env.d.ts +0 -1
|
@@ -1,47 +1,21 @@
|
|
|
1
|
-
import { Tool, Resource } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
-
import { Theme, DisplayMode, UserAgent, SafeArea, View } from './index';
|
|
1
|
+
import { Tool, Resource, CallToolRequestParams, CallToolResult } from '@modelcontextprotocol/sdk/types.js';
|
|
3
2
|
/**
|
|
4
3
|
* Core simulation types for development and testing.
|
|
5
4
|
* These types define how simulations are configured and used in both
|
|
6
5
|
* the dev simulator and MCP server contexts.
|
|
7
6
|
*/
|
|
8
7
|
import type * as React from 'react';
|
|
9
|
-
/**
|
|
10
|
-
* Simulation globals that configure the simulator environment.
|
|
11
|
-
* These values are passed to the mock runtime to set initial values for development/testing.
|
|
12
|
-
* All fields are optional as simulations can use defaults.
|
|
13
|
-
* Globals initialized based on tool responses are instead set in SimulationCallToolResult:
|
|
14
|
-
* (structuredContent > toolOutput, _meta > toolResponseMetadata)
|
|
15
|
-
*/
|
|
16
|
-
export interface SimulationGlobals {
|
|
17
|
-
theme?: Theme;
|
|
18
|
-
userAgent?: UserAgent;
|
|
19
|
-
locale?: string;
|
|
20
|
-
maxHeight?: number;
|
|
21
|
-
displayMode?: DisplayMode;
|
|
22
|
-
safeArea?: SafeArea;
|
|
23
|
-
view?: View | null;
|
|
24
|
-
toolInput?: Record<string, unknown>;
|
|
25
|
-
widgetState?: Record<string, unknown> | null;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* MCP CallTool response data (subset used in simulations).
|
|
29
|
-
* Note: toolOutput (structuredContent) and toolResponseMetadata (_meta)
|
|
30
|
-
* are set here for use by the MCP server as well, not in SimulationGlobals.
|
|
31
|
-
*/
|
|
32
|
-
export interface SimulationCallToolResult {
|
|
33
|
-
structuredContent?: Record<string, unknown> | null;
|
|
34
|
-
_meta?: Record<string, unknown>;
|
|
35
|
-
}
|
|
36
8
|
/**
|
|
37
9
|
* A simulation packages a component with its example data and metadata.
|
|
38
10
|
* Each simulation represents a complete tool experience in the simulator.
|
|
39
11
|
*/
|
|
40
12
|
export interface Simulation {
|
|
13
|
+
name: string;
|
|
41
14
|
resourceComponent: React.ComponentType;
|
|
42
15
|
userMessage?: string;
|
|
43
|
-
simulationGlobals?: SimulationGlobals;
|
|
44
16
|
tool: Tool;
|
|
45
|
-
resource
|
|
46
|
-
|
|
17
|
+
resource: Resource;
|
|
18
|
+
callToolResult?: CallToolResult;
|
|
19
|
+
callToolRequestParams?: CallToolRequestParams;
|
|
20
|
+
widgetState?: Record<string, unknown> | null;
|
|
47
21
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sunpeak",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.2",
|
|
4
4
|
"description": "The ChatGPT App framework. Quickstart, build, & test your ChatGPT App locally!",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -17,6 +17,12 @@
|
|
|
17
17
|
"default": "./dist/index.cjs"
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
|
+
"./chatgpt": {
|
|
21
|
+
"import": {
|
|
22
|
+
"types": "./dist/chatgpt/index.d.ts",
|
|
23
|
+
"default": "./dist/chatgpt/index.js"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
20
26
|
"./style.css": "./dist/style.css",
|
|
21
27
|
"./chatgpt/globals.css": "./dist/chatgpt/globals.css",
|
|
22
28
|
"./mcp": {
|
|
@@ -68,7 +74,6 @@
|
|
|
68
74
|
"zod": "^3.25.76"
|
|
69
75
|
},
|
|
70
76
|
"devDependencies": {
|
|
71
|
-
"@playwright/test": "^1.57.0",
|
|
72
77
|
"@tailwindcss/vite": "^4.1.18",
|
|
73
78
|
"@testing-library/jest-dom": "^6.9.1",
|
|
74
79
|
"@testing-library/react": "^16.3.1",
|
|
@@ -110,7 +115,6 @@
|
|
|
110
115
|
"lint": "eslint . --ext .ts,.tsx --fix",
|
|
111
116
|
"typecheck": "tsc --noEmit",
|
|
112
117
|
"test": "vitest run",
|
|
113
|
-
"test:e2e": "playwright test",
|
|
114
118
|
"validate": "node scripts/validate.mjs"
|
|
115
119
|
}
|
|
116
120
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
|
1
2
|
/**
|
|
2
3
|
* Bootstrap file for Sunpeak dev server
|
|
3
4
|
* This file bootstraps the ChatGPT simulator for development
|
|
@@ -58,7 +59,7 @@ function getResourceComponent(name: string): React.ComponentType {
|
|
|
58
59
|
const pascalName = name.charAt(0).toUpperCase() + name.slice(1);
|
|
59
60
|
const componentName = `${pascalName}Resource`;
|
|
60
61
|
|
|
61
|
-
const component = resourceComponents[componentName];
|
|
62
|
+
const component = (resourceComponents as Record<string, React.ComponentType>)[componentName];
|
|
62
63
|
|
|
63
64
|
if (!component) {
|
|
64
65
|
throw new Error(
|
|
@@ -70,9 +71,9 @@ function getResourceComponent(name: string): React.ComponentType {
|
|
|
70
71
|
return component;
|
|
71
72
|
}
|
|
72
73
|
|
|
73
|
-
// Build simulations
|
|
74
|
-
type SimulationData = Omit<Simulation, 'resourceComponent' | 'resource'>;
|
|
75
|
-
const simulations: Simulation
|
|
74
|
+
// Build simulations object from discovered files
|
|
75
|
+
type SimulationData = Omit<Simulation, 'name' | 'resourceComponent' | 'resource'>;
|
|
76
|
+
const simulations: Record<string, Simulation> = {};
|
|
76
77
|
|
|
77
78
|
for (const [path, module] of Object.entries(simulationModules)) {
|
|
78
79
|
// Extract simulation key from path: '../src/simulations/albums-show-simulation.json' -> 'albums-show'
|
|
@@ -94,11 +95,15 @@ for (const [path, module] of Object.entries(simulationModules)) {
|
|
|
94
95
|
|
|
95
96
|
const resource = resourcesMap.get(resourceKey)!;
|
|
96
97
|
|
|
97
|
-
simulations
|
|
98
|
+
simulations[simulationKey] = {
|
|
98
99
|
...simulation,
|
|
99
|
-
|
|
100
|
+
name: simulationKey,
|
|
101
|
+
resource: {
|
|
102
|
+
uri: `ui://${resource.name}`, // Dummy URI.
|
|
103
|
+
...resource,
|
|
104
|
+
},
|
|
100
105
|
resourceComponent: getResourceComponent(resource.name),
|
|
101
|
-
}
|
|
106
|
+
};
|
|
102
107
|
}
|
|
103
108
|
|
|
104
109
|
// Read app config from environment or use defaults
|