sunpeak 0.5.23 → 0.5.25
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/package.json +1 -4
- package/template/.sunpeak/dev.tsx +48 -2
- package/template/node_modules/.vite/deps/@openai_apps-sdk-ui_components_Button.js +3 -3
- package/template/node_modules/.vite/deps/@openai_apps-sdk-ui_components_Select.js +15 -15
- package/template/node_modules/.vite/deps/@openai_apps-sdk-ui_components_Textarea.js +3 -3
- package/template/node_modules/.vite/deps/_metadata.json +28 -28
- package/template/node_modules/.vite/deps/{chunk-LR7NKCX5.js → chunk-EVJ3DVH5.js} +7 -7
- package/template/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -1
- package/dist/dev/entry.d.ts +0 -0
- package/src/dev/entry.tsx +0 -55
- package/src/vite-env.d.ts +0 -10
- /package/template/node_modules/.vite/deps/{chunk-LR7NKCX5.js.map → chunk-EVJ3DVH5.js.map} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sunpeak",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.25",
|
|
4
4
|
"description": "The MCP App SDK. Quickstart, build, & test your ChatGPT App locally!",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -25,7 +25,6 @@
|
|
|
25
25
|
"default": "./dist/mcp/index.js"
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
|
-
"./dev/entry": "./src/dev/entry.tsx",
|
|
29
28
|
"./mcp/entry": "./dist/mcp/entry.js",
|
|
30
29
|
"./package.json": "./package.json"
|
|
31
30
|
},
|
|
@@ -35,8 +34,6 @@
|
|
|
35
34
|
"files": [
|
|
36
35
|
"dist",
|
|
37
36
|
"bin",
|
|
38
|
-
"src/dev",
|
|
39
|
-
"src/vite-env.d.ts",
|
|
40
37
|
"template",
|
|
41
38
|
"README.md"
|
|
42
39
|
],
|
|
@@ -1,5 +1,51 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Bootstrap file for Sunpeak dev server
|
|
3
|
-
* This file
|
|
3
|
+
* This file bootstraps the ChatGPT simulator for development
|
|
4
4
|
*/
|
|
5
|
-
import '
|
|
5
|
+
import { StrictMode } from 'react';
|
|
6
|
+
import { createRoot } from 'react-dom/client';
|
|
7
|
+
import { ChatGPTSimulator, type Simulation } from 'sunpeak';
|
|
8
|
+
import { SIMULATIONS } from '../src/simulations';
|
|
9
|
+
import * as Resources from '../src/components/resources';
|
|
10
|
+
import '../src/styles/globals.css';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Extract the resource component name from a URI
|
|
14
|
+
* Example: 'ui://CounterResource' -> 'CounterResource'
|
|
15
|
+
*/
|
|
16
|
+
function getResourceComponentFromURI(uri: string): React.ComponentType {
|
|
17
|
+
const match = uri.match(/^ui:\/\/(.+)$/);
|
|
18
|
+
if (!match) {
|
|
19
|
+
throw new Error(`Invalid resource URI format: ${uri}. Expected format: ui://ComponentName`);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const componentName = match[1];
|
|
23
|
+
const component = Resources[componentName as keyof typeof Resources];
|
|
24
|
+
|
|
25
|
+
if (!component) {
|
|
26
|
+
throw new Error(
|
|
27
|
+
`Resource component "${componentName}" not found. ` +
|
|
28
|
+
`Make sure it's exported from src/components/resources/index.ts`
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return component as React.ComponentType;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Package the resource component with the simulation
|
|
36
|
+
const simulations: Simulation[] = Object.values(
|
|
37
|
+
SIMULATIONS as Record<string, Omit<Simulation, 'resourceComponent'>>
|
|
38
|
+
).map((simulation) => ({
|
|
39
|
+
...simulation,
|
|
40
|
+
resourceComponent: getResourceComponentFromURI(simulation.resource.uri),
|
|
41
|
+
}));
|
|
42
|
+
|
|
43
|
+
// Read app config from package.json or use defaults
|
|
44
|
+
const appName = import.meta.env?.VITE_APP_NAME || 'Sunpeak App';
|
|
45
|
+
const appIcon = import.meta.env?.VITE_APP_ICON || '🌄';
|
|
46
|
+
|
|
47
|
+
createRoot(document.getElementById('root')!).render(
|
|
48
|
+
<StrictMode>
|
|
49
|
+
<ChatGPTSimulator simulations={simulations} appName={appName} appIcon={appIcon} />
|
|
50
|
+
</StrictMode>
|
|
51
|
+
);
|
|
@@ -2,13 +2,13 @@ import {
|
|
|
2
2
|
Button,
|
|
3
3
|
ButtonLink,
|
|
4
4
|
CopyButton
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-EVJ3DVH5.js";
|
|
6
6
|
import "./chunk-YOJ6QPGS.js";
|
|
7
|
-
import "./chunk-QPJAV452.js";
|
|
8
7
|
import "./chunk-BAG6OO6S.js";
|
|
8
|
+
import "./chunk-XB525PXG.js";
|
|
9
|
+
import "./chunk-QPJAV452.js";
|
|
9
10
|
import "./chunk-EGRHWZRV.js";
|
|
10
11
|
import "./chunk-CNYJBM5F.js";
|
|
11
|
-
import "./chunk-XB525PXG.js";
|
|
12
12
|
import "./chunk-PTVT3RFX.js";
|
|
13
13
|
import "./chunk-4TLBUCVB.js";
|
|
14
14
|
import "./chunk-ILHRZGIS.js";
|
|
@@ -1,23 +1,31 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Input
|
|
3
|
-
} from "./chunk-CQ3GYAYB.js";
|
|
4
1
|
import {
|
|
5
2
|
Button,
|
|
6
3
|
LoadingIndicator,
|
|
7
4
|
TransitionGroup
|
|
8
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-EVJ3DVH5.js";
|
|
9
6
|
import {
|
|
10
7
|
useTimeout
|
|
11
8
|
} from "./chunk-YOJ6QPGS.js";
|
|
12
|
-
import {
|
|
13
|
-
o
|
|
14
|
-
} from "./chunk-QPJAV452.js";
|
|
15
9
|
import {
|
|
16
10
|
handlePressableMouseEnter,
|
|
17
11
|
preventDefaultHandler,
|
|
18
12
|
toCssVariables,
|
|
19
13
|
waitForAnimationFrame
|
|
20
14
|
} from "./chunk-BAG6OO6S.js";
|
|
15
|
+
import {
|
|
16
|
+
Check_default,
|
|
17
|
+
ChevronDownVector_default,
|
|
18
|
+
DropdownVector_default,
|
|
19
|
+
Info_default,
|
|
20
|
+
Search_default,
|
|
21
|
+
X_default
|
|
22
|
+
} from "./chunk-XB525PXG.js";
|
|
23
|
+
import {
|
|
24
|
+
Input
|
|
25
|
+
} from "./chunk-CQ3GYAYB.js";
|
|
26
|
+
import {
|
|
27
|
+
o
|
|
28
|
+
} from "./chunk-QPJAV452.js";
|
|
21
29
|
import "./chunk-EGRHWZRV.js";
|
|
22
30
|
import {
|
|
23
31
|
dist_exports,
|
|
@@ -28,14 +36,6 @@ import "./chunk-KFGKZMLK.js";
|
|
|
28
36
|
import {
|
|
29
37
|
clsx_default
|
|
30
38
|
} from "./chunk-CNYJBM5F.js";
|
|
31
|
-
import {
|
|
32
|
-
Check_default,
|
|
33
|
-
ChevronDownVector_default,
|
|
34
|
-
DropdownVector_default,
|
|
35
|
-
Info_default,
|
|
36
|
-
Search_default,
|
|
37
|
-
X_default
|
|
38
|
-
} from "./chunk-XB525PXG.js";
|
|
39
39
|
import {
|
|
40
40
|
require_jsx_runtime
|
|
41
41
|
} from "./chunk-PTVT3RFX.js";
|
|
@@ -7,122 +7,125 @@
|
|
|
7
7
|
"react": {
|
|
8
8
|
"src": "../../../../node_modules/.pnpm/react@19.2.0/node_modules/react/index.js",
|
|
9
9
|
"file": "react.js",
|
|
10
|
-
"fileHash": "
|
|
10
|
+
"fileHash": "ad60bcbd",
|
|
11
11
|
"needsInterop": true
|
|
12
12
|
},
|
|
13
13
|
"react-dom": {
|
|
14
14
|
"src": "../../../../node_modules/.pnpm/react-dom@19.2.0_react@19.2.0/node_modules/react-dom/index.js",
|
|
15
15
|
"file": "react-dom.js",
|
|
16
|
-
"fileHash": "
|
|
16
|
+
"fileHash": "673263e9",
|
|
17
17
|
"needsInterop": true
|
|
18
18
|
},
|
|
19
19
|
"react/jsx-dev-runtime": {
|
|
20
20
|
"src": "../../../../node_modules/.pnpm/react@19.2.0/node_modules/react/jsx-dev-runtime.js",
|
|
21
21
|
"file": "react_jsx-dev-runtime.js",
|
|
22
|
-
"fileHash": "
|
|
22
|
+
"fileHash": "e0329ade",
|
|
23
23
|
"needsInterop": true
|
|
24
24
|
},
|
|
25
25
|
"react/jsx-runtime": {
|
|
26
26
|
"src": "../../../../node_modules/.pnpm/react@19.2.0/node_modules/react/jsx-runtime.js",
|
|
27
27
|
"file": "react_jsx-runtime.js",
|
|
28
|
-
"fileHash": "
|
|
28
|
+
"fileHash": "c89cf29d",
|
|
29
29
|
"needsInterop": true
|
|
30
30
|
},
|
|
31
31
|
"@openai/apps-sdk-ui/components/Button": {
|
|
32
32
|
"src": "../../../../node_modules/.pnpm/@openai+apps-sdk-ui@0.2.0_@types+react-dom@19.2.3_@types+react@19.2.7__@types+react@19._60630c8dcc43ec213b3e346c9e26579b/node_modules/@openai/apps-sdk-ui/dist/es/components/Button/index.js",
|
|
33
33
|
"file": "@openai_apps-sdk-ui_components_Button.js",
|
|
34
|
-
"fileHash": "
|
|
34
|
+
"fileHash": "dc3e4259",
|
|
35
35
|
"needsInterop": false
|
|
36
36
|
},
|
|
37
37
|
"@openai/apps-sdk-ui/components/Checkbox": {
|
|
38
38
|
"src": "../../../../node_modules/.pnpm/@openai+apps-sdk-ui@0.2.0_@types+react-dom@19.2.3_@types+react@19.2.7__@types+react@19._60630c8dcc43ec213b3e346c9e26579b/node_modules/@openai/apps-sdk-ui/dist/es/components/Checkbox/index.js",
|
|
39
39
|
"file": "@openai_apps-sdk-ui_components_Checkbox.js",
|
|
40
|
-
"fileHash": "
|
|
40
|
+
"fileHash": "a38670b1",
|
|
41
41
|
"needsInterop": false
|
|
42
42
|
},
|
|
43
43
|
"@openai/apps-sdk-ui/components/Icon": {
|
|
44
44
|
"src": "../../../../node_modules/.pnpm/@openai+apps-sdk-ui@0.2.0_@types+react-dom@19.2.3_@types+react@19.2.7__@types+react@19._60630c8dcc43ec213b3e346c9e26579b/node_modules/@openai/apps-sdk-ui/dist/es/components/Icon/index.js",
|
|
45
45
|
"file": "@openai_apps-sdk-ui_components_Icon.js",
|
|
46
|
-
"fileHash": "
|
|
46
|
+
"fileHash": "11f51b73",
|
|
47
47
|
"needsInterop": false
|
|
48
48
|
},
|
|
49
49
|
"@openai/apps-sdk-ui/components/Input": {
|
|
50
50
|
"src": "../../../../node_modules/.pnpm/@openai+apps-sdk-ui@0.2.0_@types+react-dom@19.2.3_@types+react@19.2.7__@types+react@19._60630c8dcc43ec213b3e346c9e26579b/node_modules/@openai/apps-sdk-ui/dist/es/components/Input/index.js",
|
|
51
51
|
"file": "@openai_apps-sdk-ui_components_Input.js",
|
|
52
|
-
"fileHash": "
|
|
52
|
+
"fileHash": "a6c29f36",
|
|
53
53
|
"needsInterop": false
|
|
54
54
|
},
|
|
55
55
|
"@openai/apps-sdk-ui/components/SegmentedControl": {
|
|
56
56
|
"src": "../../../../node_modules/.pnpm/@openai+apps-sdk-ui@0.2.0_@types+react-dom@19.2.3_@types+react@19.2.7__@types+react@19._60630c8dcc43ec213b3e346c9e26579b/node_modules/@openai/apps-sdk-ui/dist/es/components/SegmentedControl/index.js",
|
|
57
57
|
"file": "@openai_apps-sdk-ui_components_SegmentedControl.js",
|
|
58
|
-
"fileHash": "
|
|
58
|
+
"fileHash": "8319a966",
|
|
59
59
|
"needsInterop": false
|
|
60
60
|
},
|
|
61
61
|
"@openai/apps-sdk-ui/components/Select": {
|
|
62
62
|
"src": "../../../../node_modules/.pnpm/@openai+apps-sdk-ui@0.2.0_@types+react-dom@19.2.3_@types+react@19.2.7__@types+react@19._60630c8dcc43ec213b3e346c9e26579b/node_modules/@openai/apps-sdk-ui/dist/es/components/Select/index.js",
|
|
63
63
|
"file": "@openai_apps-sdk-ui_components_Select.js",
|
|
64
|
-
"fileHash": "
|
|
64
|
+
"fileHash": "415d0e10",
|
|
65
65
|
"needsInterop": false
|
|
66
66
|
},
|
|
67
67
|
"@openai/apps-sdk-ui/components/Textarea": {
|
|
68
68
|
"src": "../../../../node_modules/.pnpm/@openai+apps-sdk-ui@0.2.0_@types+react-dom@19.2.3_@types+react@19.2.7__@types+react@19._60630c8dcc43ec213b3e346c9e26579b/node_modules/@openai/apps-sdk-ui/dist/es/components/Textarea/index.js",
|
|
69
69
|
"file": "@openai_apps-sdk-ui_components_Textarea.js",
|
|
70
|
-
"fileHash": "
|
|
70
|
+
"fileHash": "3fa337b3",
|
|
71
71
|
"needsInterop": false
|
|
72
72
|
},
|
|
73
73
|
"@openai/apps-sdk-ui/theme": {
|
|
74
74
|
"src": "../../../../node_modules/.pnpm/@openai+apps-sdk-ui@0.2.0_@types+react-dom@19.2.3_@types+react@19.2.7__@types+react@19._60630c8dcc43ec213b3e346c9e26579b/node_modules/@openai/apps-sdk-ui/dist/es/lib/theme.js",
|
|
75
75
|
"file": "@openai_apps-sdk-ui_theme.js",
|
|
76
|
-
"fileHash": "
|
|
76
|
+
"fileHash": "ac987937",
|
|
77
77
|
"needsInterop": false
|
|
78
78
|
},
|
|
79
79
|
"clsx": {
|
|
80
80
|
"src": "../../../../node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs",
|
|
81
81
|
"file": "clsx.js",
|
|
82
|
-
"fileHash": "
|
|
82
|
+
"fileHash": "839c10d3",
|
|
83
83
|
"needsInterop": false
|
|
84
84
|
},
|
|
85
85
|
"embla-carousel-react": {
|
|
86
86
|
"src": "../../../../node_modules/.pnpm/embla-carousel-react@8.6.0_react@19.2.0/node_modules/embla-carousel-react/esm/embla-carousel-react.esm.js",
|
|
87
87
|
"file": "embla-carousel-react.js",
|
|
88
|
-
"fileHash": "
|
|
88
|
+
"fileHash": "2c4d0a37",
|
|
89
89
|
"needsInterop": false
|
|
90
90
|
},
|
|
91
91
|
"embla-carousel-wheel-gestures": {
|
|
92
92
|
"src": "../../../../node_modules/.pnpm/embla-carousel-wheel-gestures@8.1.0_embla-carousel@8.6.0/node_modules/embla-carousel-wheel-gestures/dist/embla-carousel-wheel-gestures.esm.js",
|
|
93
93
|
"file": "embla-carousel-wheel-gestures.js",
|
|
94
|
-
"fileHash": "
|
|
94
|
+
"fileHash": "f9e24ae7",
|
|
95
95
|
"needsInterop": false
|
|
96
96
|
},
|
|
97
97
|
"react-dom/client": {
|
|
98
98
|
"src": "../../../../node_modules/.pnpm/react-dom@19.2.0_react@19.2.0/node_modules/react-dom/client.js",
|
|
99
99
|
"file": "react-dom_client.js",
|
|
100
|
-
"fileHash": "
|
|
100
|
+
"fileHash": "1bd06eee",
|
|
101
101
|
"needsInterop": true
|
|
102
102
|
},
|
|
103
103
|
"tailwind-merge": {
|
|
104
104
|
"src": "../../../../node_modules/.pnpm/tailwind-merge@3.4.0/node_modules/tailwind-merge/dist/bundle-mjs.mjs",
|
|
105
105
|
"file": "tailwind-merge.js",
|
|
106
|
-
"fileHash": "
|
|
106
|
+
"fileHash": "fb2d54c6",
|
|
107
107
|
"needsInterop": false
|
|
108
108
|
}
|
|
109
109
|
},
|
|
110
110
|
"chunks": {
|
|
111
|
-
"chunk-
|
|
112
|
-
"file": "chunk-
|
|
113
|
-
},
|
|
114
|
-
"chunk-LR7NKCX5": {
|
|
115
|
-
"file": "chunk-LR7NKCX5.js"
|
|
111
|
+
"chunk-EVJ3DVH5": {
|
|
112
|
+
"file": "chunk-EVJ3DVH5.js"
|
|
116
113
|
},
|
|
117
114
|
"chunk-YOJ6QPGS": {
|
|
118
115
|
"file": "chunk-YOJ6QPGS.js"
|
|
119
116
|
},
|
|
120
|
-
"chunk-QPJAV452": {
|
|
121
|
-
"file": "chunk-QPJAV452.js"
|
|
122
|
-
},
|
|
123
117
|
"chunk-BAG6OO6S": {
|
|
124
118
|
"file": "chunk-BAG6OO6S.js"
|
|
125
119
|
},
|
|
120
|
+
"chunk-XB525PXG": {
|
|
121
|
+
"file": "chunk-XB525PXG.js"
|
|
122
|
+
},
|
|
123
|
+
"chunk-CQ3GYAYB": {
|
|
124
|
+
"file": "chunk-CQ3GYAYB.js"
|
|
125
|
+
},
|
|
126
|
+
"chunk-QPJAV452": {
|
|
127
|
+
"file": "chunk-QPJAV452.js"
|
|
128
|
+
},
|
|
126
129
|
"chunk-EGRHWZRV": {
|
|
127
130
|
"file": "chunk-EGRHWZRV.js"
|
|
128
131
|
},
|
|
@@ -135,9 +138,6 @@
|
|
|
135
138
|
"chunk-CNYJBM5F": {
|
|
136
139
|
"file": "chunk-CNYJBM5F.js"
|
|
137
140
|
},
|
|
138
|
-
"chunk-XB525PXG": {
|
|
139
|
-
"file": "chunk-XB525PXG.js"
|
|
140
|
-
},
|
|
141
141
|
"chunk-PTVT3RFX": {
|
|
142
142
|
"file": "chunk-PTVT3RFX.js"
|
|
143
143
|
},
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useTimeout
|
|
3
3
|
} from "./chunk-YOJ6QPGS.js";
|
|
4
|
-
import {
|
|
5
|
-
o
|
|
6
|
-
} from "./chunk-QPJAV452.js";
|
|
7
4
|
import {
|
|
8
5
|
handlePressableMouseEnter,
|
|
9
6
|
isDev,
|
|
@@ -15,13 +12,16 @@ import {
|
|
|
15
12
|
toTransformProperty,
|
|
16
13
|
waitForAnimationFrame
|
|
17
14
|
} from "./chunk-BAG6OO6S.js";
|
|
18
|
-
import {
|
|
19
|
-
clsx_default
|
|
20
|
-
} from "./chunk-CNYJBM5F.js";
|
|
21
15
|
import {
|
|
22
16
|
Check_default,
|
|
23
17
|
Copy_default
|
|
24
18
|
} from "./chunk-XB525PXG.js";
|
|
19
|
+
import {
|
|
20
|
+
o
|
|
21
|
+
} from "./chunk-QPJAV452.js";
|
|
22
|
+
import {
|
|
23
|
+
clsx_default
|
|
24
|
+
} from "./chunk-CNYJBM5F.js";
|
|
25
25
|
import {
|
|
26
26
|
require_jsx_runtime
|
|
27
27
|
} from "./chunk-PTVT3RFX.js";
|
|
@@ -625,4 +625,4 @@ export {
|
|
|
625
625
|
ButtonLink,
|
|
626
626
|
CopyButton
|
|
627
627
|
};
|
|
628
|
-
//# sourceMappingURL=chunk-
|
|
628
|
+
//# sourceMappingURL=chunk-EVJ3DVH5.js.map
|
package/template/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"4.0.13","results":[[":src/components/
|
|
1
|
+
{"version":"4.0.13","results":[[":src/components/album/fullscreen-viewer.test.tsx",{"duration":260.31835799999953,"failed":false}],[":src/components/album/albums.test.tsx",{"duration":348.7602830000001,"failed":false}],[":src/components/resources/carousel-resource.test.tsx",{"duration":252.86561500000016,"failed":false}],[":src/components/carousel/carousel.test.tsx",{"duration":63.213138999999956,"failed":false}],[":src/components/resources/counter-resource.test.tsx",{"duration":344.55251799999996,"failed":false}],[":src/components/resources/albums-resource.test.tsx",{"duration":298.1546329999999,"failed":false}],[":src/components/album/film-strip.test.tsx",{"duration":484.87700800000016,"failed":false}],[":src/components/album/album-card.test.tsx",{"duration":369.82878800000026,"failed":false}],[":src/components/card/card.test.tsx",{"duration":57.1538579999999,"failed":false}]]}
|
package/dist/dev/entry.d.ts
DELETED
|
File without changes
|
package/src/dev/entry.tsx
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Internal development server entry point
|
|
3
|
-
* This file is imported by Vite and bootstraps the ChatGPT simulator
|
|
4
|
-
*/
|
|
5
|
-
import { StrictMode } from 'react';
|
|
6
|
-
import { createRoot } from 'react-dom/client';
|
|
7
|
-
import { ChatGPTSimulator, type Simulation } from '../index';
|
|
8
|
-
|
|
9
|
-
// Dynamically import user's simulations and resources using Vite's resolution
|
|
10
|
-
// @ts-expect-error - These are resolved from the user's project via Vite aliases
|
|
11
|
-
import { SIMULATIONS } from '/src/simulations';
|
|
12
|
-
// @ts-expect-error - Resolved from user's project
|
|
13
|
-
import * as Resources from '/src/components/resources';
|
|
14
|
-
import '/src/styles/globals.css';
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Extract the resource component name from a URI
|
|
18
|
-
* Example: 'ui://CounterResource' -> 'CounterResource'
|
|
19
|
-
*/
|
|
20
|
-
function getResourceComponentFromURI(uri: string): React.ComponentType {
|
|
21
|
-
const match = uri.match(/^ui:\/\/(.+)$/);
|
|
22
|
-
if (!match) {
|
|
23
|
-
throw new Error(`Invalid resource URI format: ${uri}. Expected format: ui://ComponentName`);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const componentName = match[1];
|
|
27
|
-
const component = Resources[componentName as keyof typeof Resources];
|
|
28
|
-
|
|
29
|
-
if (!component) {
|
|
30
|
-
throw new Error(
|
|
31
|
-
`Resource component "${componentName}" not found. ` +
|
|
32
|
-
`Make sure it's exported from src/components/resources/index.ts`
|
|
33
|
-
);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return component as React.ComponentType;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// Package the resource component with the simulation
|
|
40
|
-
const simulations: Simulation[] = Object.values(
|
|
41
|
-
SIMULATIONS as Record<string, Omit<Simulation, 'resourceComponent'>>
|
|
42
|
-
).map((simulation) => ({
|
|
43
|
-
...simulation,
|
|
44
|
-
resourceComponent: getResourceComponentFromURI(simulation.resource.uri),
|
|
45
|
-
}));
|
|
46
|
-
|
|
47
|
-
// Read app config from package.json or use defaults
|
|
48
|
-
const appName = import.meta.env?.VITE_APP_NAME || 'Sunpeak App';
|
|
49
|
-
const appIcon = import.meta.env?.VITE_APP_ICON || '🌄';
|
|
50
|
-
|
|
51
|
-
createRoot(document.getElementById('root')!).render(
|
|
52
|
-
<StrictMode>
|
|
53
|
-
<ChatGPTSimulator simulations={simulations} appName={appName} appIcon={appIcon} />
|
|
54
|
-
</StrictMode>
|
|
55
|
-
);
|
package/src/vite-env.d.ts
DELETED
|
File without changes
|