sunpeak 0.14.3 → 0.15.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 +32 -28
- package/bin/commands/build.mjs +2 -1
- package/bin/commands/dev.mjs +72 -2
- package/dist/chatgpt/{conversation.d.ts → chatgpt-conversation.d.ts} +1 -1
- package/dist/chatgpt/chatgpt-host.d.ts +1 -0
- package/dist/chatgpt/globals.css +618 -6156
- package/dist/chatgpt/index.cjs +11 -8
- package/dist/chatgpt/index.cjs.map +1 -1
- package/dist/chatgpt/index.d.ts +10 -32
- package/dist/chatgpt/index.js +15 -12
- package/dist/chatgpt/index.js.map +1 -1
- package/dist/claude/claude-conversation.d.ts +23 -0
- package/dist/claude/claude-host.d.ts +1 -0
- package/dist/claude/index.cjs +6 -0
- package/dist/claude/index.cjs.map +1 -0
- package/dist/claude/index.d.ts +1 -0
- package/dist/claude/index.js +6 -0
- package/dist/claude/index.js.map +1 -0
- package/dist/claude-host-C7KPfOM8.cjs +284 -0
- package/dist/claude-host-C7KPfOM8.cjs.map +1 -0
- package/dist/claude-host-CaD7ptbt.js +283 -0
- package/dist/claude-host-CaD7ptbt.js.map +1 -0
- package/dist/{discovery-COZUnY6a.js → discovery-DzV3HLXs.js} +5 -5
- package/dist/{discovery-COZUnY6a.js.map → discovery-DzV3HLXs.js.map} +1 -1
- package/dist/hooks/index.d.ts +4 -0
- package/dist/hooks/use-app-tools.d.ts +44 -0
- package/dist/hooks/use-update-model-context.d.ts +29 -0
- package/dist/index-BKrboRah.js +44 -0
- package/dist/index-BKrboRah.js.map +1 -0
- package/dist/index-BSKuY-oH.cjs +527 -0
- package/dist/index-BSKuY-oH.cjs.map +1 -0
- package/dist/index-CiqvXo8n.js +512 -0
- package/dist/index-CiqvXo8n.js.map +1 -0
- package/dist/index-Dr-L0Nb3.cjs +43 -0
- package/dist/index-Dr-L0Nb3.cjs.map +1 -0
- package/dist/index.cjs +1705 -1647
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2732 -2675
- package/dist/index.js.map +1 -1
- package/dist/lib/default-style-variables.d.ts +2 -0
- package/dist/lib/discovery-cli.js +1 -1
- package/dist/mcp/index.cjs +86 -27
- package/dist/mcp/index.cjs.map +1 -1
- package/dist/mcp/index.d.ts +3 -1
- package/dist/mcp/index.js +85 -26
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/server.d.ts +4 -3
- package/dist/mcp/types.d.ts +11 -0
- package/dist/platform/chatgpt/index.cjs +1 -1
- package/dist/platform/chatgpt/index.js +1 -1
- package/dist/platform/index.cjs +3 -0
- package/dist/platform/index.cjs.map +1 -1
- package/dist/platform/index.d.ts +3 -1
- package/dist/platform/index.js +3 -0
- package/dist/platform/index.js.map +1 -1
- package/dist/{protocol-BQCnIrc9.js → protocol-DFbsCx7E.js} +29 -29
- package/dist/{protocol-BQCnIrc9.js.map → protocol-DFbsCx7E.js.map} +1 -1
- package/dist/simulator/host-styles.d.ts +5 -0
- package/dist/simulator/hosts.d.ts +73 -0
- package/dist/{chatgpt → simulator}/iframe-resource.d.ts +27 -3
- package/dist/simulator/index.cjs +40 -0
- package/dist/simulator/index.cjs.map +1 -0
- package/dist/simulator/index.d.ts +18 -0
- package/dist/simulator/index.js +40 -0
- package/dist/simulator/index.js.map +1 -0
- package/dist/{chatgpt → simulator}/mcp-app-host.d.ts +8 -1
- package/dist/simulator/mock-openai-runtime.d.ts +20 -0
- package/dist/{chatgpt → simulator}/simulator-url.d.ts +8 -1
- package/dist/simulator/simulator.d.ts +12 -0
- package/dist/{chatgpt → simulator}/theme-provider.d.ts +3 -1
- package/dist/simulator/use-simulator-state.d.ts +91 -0
- package/dist/simulator-BqZmzFVR.cjs +8214 -0
- package/dist/simulator-BqZmzFVR.cjs.map +1 -0
- package/dist/simulator-CMgCGNuD.js +8199 -0
- package/dist/simulator-CMgCGNuD.js.map +1 -0
- package/dist/simulator-url-BQ-7SMht.js +335 -0
- package/dist/simulator-url-BQ-7SMht.js.map +1 -0
- package/dist/simulator-url-uNqOCaPJ.cjs +334 -0
- package/dist/simulator-url-uNqOCaPJ.cjs.map +1 -0
- package/dist/style.css +558 -6143
- package/dist/types/runtime.d.ts +1 -1
- package/dist/{use-app-D7kRAPSG.cjs → use-app-BnoSPiUT.cjs} +2 -1
- package/dist/{use-app-D7kRAPSG.cjs.map → use-app-BnoSPiUT.cjs.map} +1 -1
- package/dist/{use-app-Dvr4LKs2.js → use-app-D_TeaMFG.js} +4 -3
- package/dist/{use-app-Dvr4LKs2.js.map → use-app-D_TeaMFG.js.map} +1 -1
- package/package.json +18 -3
- package/template/.sunpeak/dev.tsx +4 -4
- package/template/.sunpeak/resource-loader.html +1 -1
- package/template/node_modules/.bin/nodemon +2 -2
- package/template/node_modules/.bin/playwright +2 -2
- package/template/node_modules/.bin/sunpeak +2 -2
- package/template/node_modules/.bin/tsc +2 -2
- package/template/node_modules/.bin/tsserver +2 -2
- package/template/node_modules/.bin/tsx +2 -2
- package/template/node_modules/.bin/vite +2 -2
- package/template/src/components/avatar.tsx +4 -1
- package/template/src/components/button.tsx +17 -20
- package/template/src/resources/albums/albums-resource.tsx +2 -3
- package/template/src/resources/albums/components/album-card.tsx +4 -2
- package/template/src/resources/albums/components/film-strip.test.tsx +2 -2
- package/template/src/resources/albums/components/film-strip.tsx +2 -2
- package/template/src/resources/albums/components/fullscreen-viewer.tsx +7 -5
- package/template/src/resources/carousel/carousel-resource.tsx +2 -3
- package/template/src/resources/carousel/components/card.test.tsx +3 -2
- package/template/src/resources/carousel/components/card.tsx +8 -4
- package/template/src/resources/map/components/map-view.tsx +1 -1
- package/template/src/resources/map/components/map.tsx +1 -1
- package/template/src/resources/map/components/place-card.tsx +8 -4
- package/template/src/resources/map/components/place-carousel.tsx +1 -1
- package/template/src/resources/map/components/place-inspector.tsx +15 -7
- package/template/src/resources/map/components/place-list.tsx +7 -4
- package/template/src/resources/map/map-resource.tsx +0 -2
- package/template/src/resources/review/review-resource.tsx +61 -27
- package/template/tests/e2e/albums.spec.ts +118 -102
- package/template/tests/e2e/carousel.spec.ts +103 -100
- package/template/tests/e2e/map.spec.ts +220 -181
- package/template/tests/e2e/review.spec.ts +224 -198
- package/dist/_commonjsHelpers-Bc2YnDe1.cjs +0 -8
- package/dist/_commonjsHelpers-Bc2YnDe1.cjs.map +0 -1
- package/dist/_commonjsHelpers-DWwsNxpa.js +0 -9
- package/dist/_commonjsHelpers-DWwsNxpa.js.map +0 -1
- package/dist/index-CJ3jfcjj.js +0 -15131
- package/dist/index-CJ3jfcjj.js.map +0 -1
- package/dist/index-Cdeg96So.cjs +0 -15147
- package/dist/index-Cdeg96So.cjs.map +0 -1
- /package/dist/{chatgpt → simulator}/simple-sidebar.d.ts +0 -0
- /package/dist/{chatgpt/chatgpt-simulator-types.d.ts → simulator/simulator-types.d.ts} +0 -0
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
import { a as SCREEN_WIDTHS, r as registerHostShell, D as DEFAULT_STYLE_VARIABLES } from "./simulator-CMgCGNuD.js";
|
|
2
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
|
+
function CloseIcon() {
|
|
4
|
+
return /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx(
|
|
5
|
+
"path",
|
|
6
|
+
{
|
|
7
|
+
d: "M12 4L4 12M4 4L12 12",
|
|
8
|
+
stroke: "currentColor",
|
|
9
|
+
strokeWidth: "1.5",
|
|
10
|
+
strokeLinecap: "round"
|
|
11
|
+
}
|
|
12
|
+
) });
|
|
13
|
+
}
|
|
14
|
+
function BackIcon() {
|
|
15
|
+
return /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx(
|
|
16
|
+
"path",
|
|
17
|
+
{
|
|
18
|
+
d: "M10 3L5 8L10 13",
|
|
19
|
+
stroke: "currentColor",
|
|
20
|
+
strokeWidth: "1.5",
|
|
21
|
+
strokeLinecap: "round",
|
|
22
|
+
strokeLinejoin: "round"
|
|
23
|
+
}
|
|
24
|
+
) });
|
|
25
|
+
}
|
|
26
|
+
function ClaudeConversation({
|
|
27
|
+
children,
|
|
28
|
+
screenWidth,
|
|
29
|
+
displayMode,
|
|
30
|
+
platform,
|
|
31
|
+
onRequestDisplayMode,
|
|
32
|
+
appName = "Sunpeak",
|
|
33
|
+
appIcon,
|
|
34
|
+
userMessage = "What have you got for me today?",
|
|
35
|
+
isTransitioning = false
|
|
36
|
+
}) {
|
|
37
|
+
const isDesktop = platform === "desktop";
|
|
38
|
+
const containerWidth = screenWidth === "full" ? "100%" : `${SCREEN_WIDTHS[screenWidth]}px`;
|
|
39
|
+
const isFullscreen = displayMode === "fullscreen";
|
|
40
|
+
const isPip = displayMode === "pip";
|
|
41
|
+
const handleClose = () => onRequestDisplayMode?.("inline");
|
|
42
|
+
return /* @__PURE__ */ jsxs(
|
|
43
|
+
"div",
|
|
44
|
+
{
|
|
45
|
+
className: "flex flex-col w-full h-full flex-1 items-center relative",
|
|
46
|
+
style: {
|
|
47
|
+
transform: "translate(0)",
|
|
48
|
+
backgroundColor: "var(--sim-bg-conversation, var(--color-background-primary))",
|
|
49
|
+
color: "var(--color-text-primary)"
|
|
50
|
+
},
|
|
51
|
+
children: [
|
|
52
|
+
isFullscreen && /* @__PURE__ */ jsxs(
|
|
53
|
+
"div",
|
|
54
|
+
{
|
|
55
|
+
className: "fixed start-0 end-0 top-0 bottom-0 z-[51] mx-auto flex flex-col pointer-events-none",
|
|
56
|
+
style: { maxWidth: containerWidth },
|
|
57
|
+
children: [
|
|
58
|
+
/* @__PURE__ */ jsxs(
|
|
59
|
+
"div",
|
|
60
|
+
{
|
|
61
|
+
className: "z-10 flex items-center h-12 border-b px-3 pointer-events-auto",
|
|
62
|
+
style: {
|
|
63
|
+
borderColor: "var(--color-border-primary)",
|
|
64
|
+
backgroundColor: "var(--sim-bg-conversation, var(--color-background-primary))"
|
|
65
|
+
},
|
|
66
|
+
children: [
|
|
67
|
+
/* @__PURE__ */ jsx(
|
|
68
|
+
"button",
|
|
69
|
+
{
|
|
70
|
+
onClick: handleClose,
|
|
71
|
+
"aria-label": "Back",
|
|
72
|
+
className: "h-8 w-8 flex items-center justify-center rounded-lg transition-colors hover:opacity-70",
|
|
73
|
+
type: "button",
|
|
74
|
+
children: /* @__PURE__ */ jsx(BackIcon, {})
|
|
75
|
+
}
|
|
76
|
+
),
|
|
77
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1 text-center text-sm font-medium", children: appName }),
|
|
78
|
+
isDesktop && /* @__PURE__ */ jsx("div", { className: "w-8" })
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
),
|
|
82
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1" }),
|
|
83
|
+
/* @__PURE__ */ jsx(
|
|
84
|
+
"footer",
|
|
85
|
+
{
|
|
86
|
+
className: "pointer-events-auto p-3",
|
|
87
|
+
style: {
|
|
88
|
+
backgroundColor: "var(--sim-bg-conversation, var(--color-background-primary))"
|
|
89
|
+
},
|
|
90
|
+
children: /* @__PURE__ */ jsx("div", { className: "max-w-[48rem] mx-auto", children: /* @__PURE__ */ jsx(
|
|
91
|
+
"input",
|
|
92
|
+
{
|
|
93
|
+
type: "text",
|
|
94
|
+
name: "userInput",
|
|
95
|
+
disabled: true,
|
|
96
|
+
placeholder: "Reply to sunpeak...",
|
|
97
|
+
className: "w-full rounded-xl px-4 py-2.5 text-sm",
|
|
98
|
+
style: {
|
|
99
|
+
backgroundColor: "var(--sim-bg-reply-input, var(--color-background-secondary))",
|
|
100
|
+
border: "1px solid var(--color-border-primary)",
|
|
101
|
+
color: "var(--color-text-primary)"
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
) })
|
|
105
|
+
}
|
|
106
|
+
)
|
|
107
|
+
]
|
|
108
|
+
}
|
|
109
|
+
),
|
|
110
|
+
!isFullscreen && /* @__PURE__ */ jsx(
|
|
111
|
+
"header",
|
|
112
|
+
{
|
|
113
|
+
className: "h-12 flex items-center px-4 text-sm font-medium sticky top-0 z-40 w-full",
|
|
114
|
+
style: {
|
|
115
|
+
maxWidth: containerWidth,
|
|
116
|
+
backgroundColor: "var(--sim-bg-conversation, var(--color-background-primary))"
|
|
117
|
+
},
|
|
118
|
+
children: /* @__PURE__ */ jsx("span", { children: "sunpeak.ai" })
|
|
119
|
+
}
|
|
120
|
+
),
|
|
121
|
+
/* @__PURE__ */ jsxs(
|
|
122
|
+
"div",
|
|
123
|
+
{
|
|
124
|
+
className: "flex flex-col flex-1 w-full transition-all duration-200 overflow-hidden",
|
|
125
|
+
style: { maxWidth: containerWidth },
|
|
126
|
+
children: [
|
|
127
|
+
/* @__PURE__ */ jsxs("main", { className: "flex-1 overflow-y-auto overflow-x-hidden", children: [
|
|
128
|
+
!isFullscreen && /* @__PURE__ */ jsx("article", { className: "w-full", dir: "auto", "data-turn": "user", children: /* @__PURE__ */ jsx("div", { className: "px-4 py-4", children: /* @__PURE__ */ jsx("div", { className: "max-w-[48rem] mx-auto flex justify-end", children: /* @__PURE__ */ jsx(
|
|
129
|
+
"div",
|
|
130
|
+
{
|
|
131
|
+
className: "inline-block rounded-2xl px-4 py-2.5 text-sm max-w-[85%]",
|
|
132
|
+
style: {
|
|
133
|
+
backgroundColor: "var(--sim-bg-user-bubble, var(--color-background-tertiary))"
|
|
134
|
+
},
|
|
135
|
+
children: userMessage
|
|
136
|
+
}
|
|
137
|
+
) }) }) }),
|
|
138
|
+
/* @__PURE__ */ jsxs("article", { className: "w-full", dir: "auto", "data-turn": "assistant", children: [
|
|
139
|
+
/* @__PURE__ */ jsxs("h6", { className: "sr-only", children: [
|
|
140
|
+
appName,
|
|
141
|
+
" said:"
|
|
142
|
+
] }),
|
|
143
|
+
/* @__PURE__ */ jsx("div", { className: "px-4 py-2", children: /* @__PURE__ */ jsxs("div", { className: "max-w-[48rem] mx-auto", children: [
|
|
144
|
+
!isFullscreen && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 mb-3", children: [
|
|
145
|
+
appIcon ? /* @__PURE__ */ jsx("div", { className: "size-6 flex items-center justify-center text-base", children: appIcon }) : /* @__PURE__ */ jsx(
|
|
146
|
+
"div",
|
|
147
|
+
{
|
|
148
|
+
className: "size-6 rounded-full flex items-center justify-center text-xs font-medium text-white",
|
|
149
|
+
style: { backgroundColor: "#c55a30" },
|
|
150
|
+
children: "C"
|
|
151
|
+
}
|
|
152
|
+
),
|
|
153
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: appName })
|
|
154
|
+
] }),
|
|
155
|
+
/* @__PURE__ */ jsxs(
|
|
156
|
+
"div",
|
|
157
|
+
{
|
|
158
|
+
className: isPip ? "fixed start-4 end-4 top-12 z-50 mx-auto max-w-[40rem] lg:max-w-[48rem] sm:start-0 sm:end-0 sm:top-[3rem] sm:w-full overflow-visible" : isFullscreen ? "fixed inset-x-0 top-[3rem] bottom-0 z-50 mx-auto" : "relative mb-2 w-full overflow-visible",
|
|
159
|
+
style: {
|
|
160
|
+
...isPip ? { maxHeight: "480px" } : {},
|
|
161
|
+
...isFullscreen ? { maxWidth: containerWidth } : {}
|
|
162
|
+
},
|
|
163
|
+
children: [
|
|
164
|
+
isPip && /* @__PURE__ */ jsx(
|
|
165
|
+
"button",
|
|
166
|
+
{
|
|
167
|
+
onClick: handleClose,
|
|
168
|
+
className: "absolute -start-2 -top-1.5 z-10 rounded-full p-1.5 text-white shadow-md",
|
|
169
|
+
style: { backgroundColor: "#4a4a4a" },
|
|
170
|
+
"aria-label": "Close picture-in-picture",
|
|
171
|
+
type: "button",
|
|
172
|
+
children: /* @__PURE__ */ jsx(CloseIcon, {})
|
|
173
|
+
},
|
|
174
|
+
"pip-close"
|
|
175
|
+
),
|
|
176
|
+
/* @__PURE__ */ jsx(
|
|
177
|
+
"div",
|
|
178
|
+
{
|
|
179
|
+
className: isPip ? "relative overflow-hidden h-full rounded-2xl shadow-lg" : "relative overflow-hidden h-full",
|
|
180
|
+
children: /* @__PURE__ */ jsx(
|
|
181
|
+
"div",
|
|
182
|
+
{
|
|
183
|
+
className: "h-full w-full max-w-full",
|
|
184
|
+
style: {
|
|
185
|
+
...isPip ? {
|
|
186
|
+
overflow: "auto",
|
|
187
|
+
backgroundColor: "var(--color-background-secondary)"
|
|
188
|
+
} : isFullscreen ? {
|
|
189
|
+
overflow: "auto",
|
|
190
|
+
backgroundColor: "var(--color-background-primary)"
|
|
191
|
+
} : { backgroundColor: "transparent" },
|
|
192
|
+
opacity: isTransitioning ? 0 : 1,
|
|
193
|
+
transition: isTransitioning ? "none" : "opacity 100ms"
|
|
194
|
+
},
|
|
195
|
+
children
|
|
196
|
+
}
|
|
197
|
+
)
|
|
198
|
+
},
|
|
199
|
+
"content"
|
|
200
|
+
)
|
|
201
|
+
]
|
|
202
|
+
}
|
|
203
|
+
)
|
|
204
|
+
] }) })
|
|
205
|
+
] })
|
|
206
|
+
] }),
|
|
207
|
+
!isFullscreen && /* @__PURE__ */ jsx(
|
|
208
|
+
"footer",
|
|
209
|
+
{
|
|
210
|
+
style: {
|
|
211
|
+
backgroundColor: "var(--sim-bg-conversation, var(--color-background-primary))"
|
|
212
|
+
},
|
|
213
|
+
children: /* @__PURE__ */ jsx("div", { className: "max-w-[48rem] mx-auto px-4 py-4", children: /* @__PURE__ */ jsx("div", { className: "relative", children: /* @__PURE__ */ jsx(
|
|
214
|
+
"input",
|
|
215
|
+
{
|
|
216
|
+
type: "text",
|
|
217
|
+
name: "userInput",
|
|
218
|
+
disabled: true,
|
|
219
|
+
placeholder: "Reply to sunpeak...",
|
|
220
|
+
className: "w-full rounded-xl px-4 py-2.5 text-sm",
|
|
221
|
+
style: {
|
|
222
|
+
backgroundColor: "var(--sim-bg-reply-input, var(--color-background-secondary))",
|
|
223
|
+
border: "1px solid var(--color-border-primary)"
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
) }) })
|
|
227
|
+
}
|
|
228
|
+
)
|
|
229
|
+
]
|
|
230
|
+
}
|
|
231
|
+
)
|
|
232
|
+
]
|
|
233
|
+
}
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
const CLAUDE_HOST_INFO = {
|
|
237
|
+
name: "Claude",
|
|
238
|
+
version: "1.0.0"
|
|
239
|
+
};
|
|
240
|
+
const CLAUDE_HOST_CAPABILITIES = {
|
|
241
|
+
openLinks: {},
|
|
242
|
+
serverTools: {},
|
|
243
|
+
logging: {},
|
|
244
|
+
updateModelContext: { text: {} },
|
|
245
|
+
message: { text: {} }
|
|
246
|
+
};
|
|
247
|
+
function applyClaudeTheme(theme) {
|
|
248
|
+
document.documentElement.setAttribute("data-theme", theme);
|
|
249
|
+
document.documentElement.style.colorScheme = theme;
|
|
250
|
+
}
|
|
251
|
+
const CLAUDE_STYLE_VARIABLES = {
|
|
252
|
+
...DEFAULT_STYLE_VARIABLES,
|
|
253
|
+
// Background colors — warm beige/cream palette
|
|
254
|
+
"--color-background-primary": "light-dark(#faf9f5, #262624)",
|
|
255
|
+
"--color-background-secondary": "light-dark(#ffffff, #3a3935)",
|
|
256
|
+
"--color-background-tertiary": "light-dark(#e8e4dc, #4a4843)",
|
|
257
|
+
"--color-background-inverse": "light-dark(#2b2a27, #f3f0e8)",
|
|
258
|
+
// Text colors
|
|
259
|
+
"--color-text-primary": "light-dark(#2d2b27, #e8e4dc)",
|
|
260
|
+
"--color-text-secondary": "light-dark(#6b6560, #9b9690)",
|
|
261
|
+
"--color-text-tertiary": "light-dark(#9b9690, #6b6560)",
|
|
262
|
+
"--color-text-inverse": "light-dark(#e8e4dc, #2d2b27)",
|
|
263
|
+
// Border colors
|
|
264
|
+
"--color-border-primary": "light-dark(#e0ddd5, #4a4843)",
|
|
265
|
+
"--color-border-secondary": "light-dark(#d5d1c8, #5a5753)",
|
|
266
|
+
"--color-border-tertiary": "light-dark(#f0ede5, #3a3935)"
|
|
267
|
+
};
|
|
268
|
+
registerHostShell({
|
|
269
|
+
id: "claude",
|
|
270
|
+
label: "Claude",
|
|
271
|
+
Conversation: ClaudeConversation,
|
|
272
|
+
applyTheme: applyClaudeTheme,
|
|
273
|
+
hostInfo: CLAUDE_HOST_INFO,
|
|
274
|
+
hostCapabilities: CLAUDE_HOST_CAPABILITIES,
|
|
275
|
+
styleVariables: CLAUDE_STYLE_VARIABLES,
|
|
276
|
+
pageStyles: {
|
|
277
|
+
"--sim-bg-sidebar": "light-dark(#f9f8f3, #252523)",
|
|
278
|
+
"--sim-bg-conversation": "light-dark(#faf9f5, #262624)",
|
|
279
|
+
"--sim-bg-user-bubble": "light-dark(#f1eee6, #141413)",
|
|
280
|
+
"--sim-bg-reply-input": "light-dark(#ffffff, #30302e)"
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
//# sourceMappingURL=claude-host-CaD7ptbt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-host-CaD7ptbt.js","sources":["../src/claude/claude-conversation.tsx","../src/claude/claude-host.ts"],"sourcesContent":["import * as React from 'react';\nimport { SCREEN_WIDTHS, type ScreenWidth } from '../simulator/simulator-types';\nimport type { McpUiDisplayMode, McpUiHostContext } from '@modelcontextprotocol/ext-apps';\n\ntype Platform = NonNullable<McpUiHostContext['platform']>;\n\ninterface ClaudeConversationProps {\n children?: React.ReactNode;\n screenWidth: ScreenWidth;\n displayMode: McpUiDisplayMode;\n platform: Platform;\n onRequestDisplayMode?: (mode: McpUiDisplayMode) => void;\n appName?: string;\n appIcon?: string;\n userMessage?: string;\n isTransitioning?: boolean;\n}\n\nfunction CloseIcon() {\n return (\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M12 4L4 12M4 4L12 12\"\n stroke=\"currentColor\"\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n />\n </svg>\n );\n}\n\nfunction BackIcon() {\n return (\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M10 3L5 8L10 13\"\n stroke=\"currentColor\"\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n );\n}\n\n/**\n * Claude conversation shell — mimics Claude's chat UI chrome.\n *\n * All three display modes (inline, pip, fullscreen) share the same React tree\n * shape so that the iframe never unmounts when switching modes.\n */\nexport function ClaudeConversation({\n children,\n screenWidth,\n displayMode,\n platform,\n onRequestDisplayMode,\n appName = 'Sunpeak',\n appIcon,\n userMessage = 'What have you got for me today?',\n isTransitioning = false,\n}: ClaudeConversationProps) {\n const isDesktop = platform === 'desktop';\n const containerWidth = screenWidth === 'full' ? '100%' : `${SCREEN_WIDTHS[screenWidth]}px`;\n const isFullscreen = displayMode === 'fullscreen';\n const isPip = displayMode === 'pip';\n\n const handleClose = () => onRequestDisplayMode?.('inline');\n\n return (\n <div\n className=\"flex flex-col w-full h-full flex-1 items-center relative\"\n style={{\n transform: 'translate(0)',\n backgroundColor: 'var(--sim-bg-conversation, var(--color-background-primary))',\n color: 'var(--color-text-primary)',\n }}\n >\n {/* ─── Fullscreen chrome overlay ─── */}\n {isFullscreen && (\n <div\n className=\"fixed start-0 end-0 top-0 bottom-0 z-[51] mx-auto flex flex-col pointer-events-none\"\n style={{ maxWidth: containerWidth }}\n >\n <div\n className=\"z-10 flex items-center h-12 border-b px-3 pointer-events-auto\"\n style={{\n borderColor: 'var(--color-border-primary)',\n backgroundColor: 'var(--sim-bg-conversation, var(--color-background-primary))',\n }}\n >\n <button\n onClick={handleClose}\n aria-label=\"Back\"\n className=\"h-8 w-8 flex items-center justify-center rounded-lg transition-colors hover:opacity-70\"\n type=\"button\"\n >\n <BackIcon />\n </button>\n <div className=\"flex-1 text-center text-sm font-medium\">{appName}</div>\n {isDesktop && <div className=\"w-8\" />}\n </div>\n <div className=\"flex-1\" />\n <footer\n className=\"pointer-events-auto p-3\"\n style={{\n backgroundColor: 'var(--sim-bg-conversation, var(--color-background-primary))',\n }}\n >\n <div className=\"max-w-[48rem] mx-auto\">\n <input\n type=\"text\"\n name=\"userInput\"\n disabled\n placeholder=\"Reply to sunpeak...\"\n className=\"w-full rounded-xl px-4 py-2.5 text-sm\"\n style={{\n backgroundColor: 'var(--sim-bg-reply-input, var(--color-background-secondary))',\n border: '1px solid var(--color-border-primary)',\n color: 'var(--color-text-primary)',\n }}\n />\n </div>\n </footer>\n </div>\n )}\n\n {/* ─── Conversation header ─── */}\n {!isFullscreen && (\n <header\n className=\"h-12 flex items-center px-4 text-sm font-medium sticky top-0 z-40 w-full\"\n style={{\n maxWidth: containerWidth,\n backgroundColor: 'var(--sim-bg-conversation, var(--color-background-primary))',\n }}\n >\n <span>sunpeak.ai</span>\n </header>\n )}\n\n {/* ─── Conversation container ─── */}\n <div\n className=\"flex flex-col flex-1 w-full transition-all duration-200 overflow-hidden\"\n style={{ maxWidth: containerWidth }}\n >\n <main className=\"flex-1 overflow-y-auto overflow-x-hidden\">\n {/* User turn */}\n {!isFullscreen && (\n <article className=\"w-full\" dir=\"auto\" data-turn=\"user\">\n <div className=\"px-4 py-4\">\n <div className=\"max-w-[48rem] mx-auto flex justify-end\">\n <div\n className=\"inline-block rounded-2xl px-4 py-2.5 text-sm max-w-[85%]\"\n style={{\n backgroundColor:\n 'var(--sim-bg-user-bubble, var(--color-background-tertiary))',\n }}\n >\n {userMessage}\n </div>\n </div>\n </div>\n </article>\n )}\n\n {/* Assistant turn */}\n <article className=\"w-full\" dir=\"auto\" data-turn=\"assistant\">\n <h6 className=\"sr-only\">{appName} said:</h6>\n <div className=\"px-4 py-2\">\n <div className=\"max-w-[48rem] mx-auto\">\n {/* Claude avatar + name */}\n {!isFullscreen && (\n <div className=\"flex items-center gap-2 mb-3\">\n {appIcon ? (\n <div className=\"size-6 flex items-center justify-center text-base\">\n {appIcon}\n </div>\n ) : (\n <div\n className=\"size-6 rounded-full flex items-center justify-center text-xs font-medium text-white\"\n style={{ backgroundColor: '#c55a30' }}\n >\n C\n </div>\n )}\n <span className=\"text-sm font-medium\">{appName}</span>\n </div>\n )}\n\n {/* ─── CONTENT AREA ─── */}\n <div\n className={\n isPip\n ? 'fixed start-4 end-4 top-12 z-50 mx-auto max-w-[40rem] lg:max-w-[48rem] sm:start-0 sm:end-0 sm:top-[3rem] sm:w-full overflow-visible'\n : isFullscreen\n ? 'fixed inset-x-0 top-[3rem] bottom-0 z-50 mx-auto'\n : 'relative mb-2 w-full overflow-visible'\n }\n style={{\n ...(isPip ? { maxHeight: '480px' } : {}),\n ...(isFullscreen ? { maxWidth: containerWidth } : {}),\n }}\n >\n {/* PiP close button */}\n {isPip && (\n <button\n key=\"pip-close\"\n onClick={handleClose}\n className=\"absolute -start-2 -top-1.5 z-10 rounded-full p-1.5 text-white shadow-md\"\n style={{ backgroundColor: '#4a4a4a' }}\n aria-label=\"Close picture-in-picture\"\n type=\"button\"\n >\n <CloseIcon />\n </button>\n )}\n <div\n key=\"content\"\n className={\n isPip\n ? 'relative overflow-hidden h-full rounded-2xl shadow-lg'\n : 'relative overflow-hidden h-full'\n }\n >\n <div\n className=\"h-full w-full max-w-full\"\n style={{\n ...(isPip\n ? {\n overflow: 'auto',\n backgroundColor: 'var(--color-background-secondary)',\n }\n : isFullscreen\n ? {\n overflow: 'auto',\n backgroundColor: 'var(--color-background-primary)',\n }\n : { backgroundColor: 'transparent' }),\n opacity: isTransitioning ? 0 : 1,\n transition: isTransitioning ? 'none' : 'opacity 100ms',\n }}\n >\n {children}\n </div>\n </div>\n </div>\n </div>\n </div>\n </article>\n </main>\n\n {/* Input area */}\n {!isFullscreen && (\n <footer\n style={{\n backgroundColor: 'var(--sim-bg-conversation, var(--color-background-primary))',\n }}\n >\n <div className=\"max-w-[48rem] mx-auto px-4 py-4\">\n <div className=\"relative\">\n <input\n type=\"text\"\n name=\"userInput\"\n disabled\n placeholder=\"Reply to sunpeak...\"\n className=\"w-full rounded-xl px-4 py-2.5 text-sm\"\n style={{\n backgroundColor: 'var(--sim-bg-reply-input, var(--color-background-secondary))',\n border: '1px solid var(--color-border-primary)',\n }}\n />\n </div>\n </div>\n </footer>\n )}\n </div>\n </div>\n );\n}\n","import type { McpUiHostCapabilities } from '@modelcontextprotocol/ext-apps';\nimport { registerHostShell } from '../simulator/hosts';\nimport { DEFAULT_STYLE_VARIABLES } from '../simulator/host-styles';\nimport { ClaudeConversation } from './claude-conversation';\n\nconst CLAUDE_HOST_INFO = {\n name: 'Claude',\n version: '1.0.0',\n};\n\n/**\n * Claude starts with the baseline MCP App capabilities.\n * Host-specific capabilities (if any) can be added here as Claude's\n * MCP App integration evolves.\n */\nconst CLAUDE_HOST_CAPABILITIES: McpUiHostCapabilities = {\n openLinks: {},\n serverTools: {},\n logging: {},\n updateModelContext: { text: {} },\n message: { text: {} },\n};\n\n/**\n * Apply Claude-style theming to the document.\n * Sets data-theme attribute and color-scheme so CSS light-dark() resolves correctly.\n */\nfunction applyClaudeTheme(theme: 'light' | 'dark'): void {\n document.documentElement.setAttribute('data-theme', theme);\n document.documentElement.style.colorScheme = theme;\n}\n\n/**\n * Claude-specific style variable overrides (warm beige/cream palette).\n * Inherits defaults from DEFAULT_STYLE_VARIABLES, overriding only colors.\n */\nconst CLAUDE_STYLE_VARIABLES = {\n ...DEFAULT_STYLE_VARIABLES,\n // Background colors — warm beige/cream palette\n '--color-background-primary': 'light-dark(#faf9f5, #262624)',\n '--color-background-secondary': 'light-dark(#ffffff, #3a3935)',\n '--color-background-tertiary': 'light-dark(#e8e4dc, #4a4843)',\n '--color-background-inverse': 'light-dark(#2b2a27, #f3f0e8)',\n // Text colors\n '--color-text-primary': 'light-dark(#2d2b27, #e8e4dc)',\n '--color-text-secondary': 'light-dark(#6b6560, #9b9690)',\n '--color-text-tertiary': 'light-dark(#9b9690, #6b6560)',\n '--color-text-inverse': 'light-dark(#e8e4dc, #2d2b27)',\n // Border colors\n '--color-border-primary': 'light-dark(#e0ddd5, #4a4843)',\n '--color-border-secondary': 'light-dark(#d5d1c8, #5a5753)',\n '--color-border-tertiary': 'light-dark(#f0ede5, #3a3935)',\n};\n\nregisterHostShell({\n id: 'claude',\n label: 'Claude',\n Conversation: ClaudeConversation,\n applyTheme: applyClaudeTheme,\n hostInfo: CLAUDE_HOST_INFO,\n hostCapabilities: CLAUDE_HOST_CAPABILITIES,\n styleVariables: CLAUDE_STYLE_VARIABLES,\n pageStyles: {\n '--sim-bg-sidebar': 'light-dark(#f9f8f3, #252523)',\n '--sim-bg-conversation': 'light-dark(#faf9f5, #262624)',\n '--sim-bg-user-bubble': 'light-dark(#f1eee6, #141413)',\n '--sim-bg-reply-input': 'light-dark(#ffffff, #30302e)',\n },\n});\n"],"names":[],"mappings":";;AAkBA,SAAS,YAAY;AACnB,SACE,oBAAC,OAAA,EAAI,OAAM,MAAK,QAAO,MAAK,SAAQ,aAAY,MAAK,QAAO,OAAM,8BAChE,UAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,GAAE;AAAA,MACF,QAAO;AAAA,MACP,aAAY;AAAA,MACZ,eAAc;AAAA,IAAA;AAAA,EAAA,GAElB;AAEJ;AAEA,SAAS,WAAW;AAClB,SACE,oBAAC,OAAA,EAAI,OAAM,MAAK,QAAO,MAAK,SAAQ,aAAY,MAAK,QAAO,OAAM,8BAChE,UAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,GAAE;AAAA,MACF,QAAO;AAAA,MACP,aAAY;AAAA,MACZ,eAAc;AAAA,MACd,gBAAe;AAAA,IAAA;AAAA,EAAA,GAEnB;AAEJ;AAQO,SAAS,mBAAmB;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV;AAAA,EACA,cAAc;AAAA,EACd,kBAAkB;AACpB,GAA4B;AAC1B,QAAM,YAAY,aAAa;AAC/B,QAAM,iBAAiB,gBAAgB,SAAS,SAAS,GAA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ACJ,OAAO;AAAA,EACP,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,kBAAkB;AAAA,EAClB,gBAAgB;AAAA,EAChB,YAAY;AAAA,IACV,oBAAoB;AAAA,IACpB,yBAAyB;AAAA,IACzB,wBAAwB;AAAA,IACxB,wBAAwB;AAAA,EAAA;AAE5B,CAAC;"}
|
|
@@ -140,10 +140,10 @@ function findSimulationFiles(resourceDir, resourceKey, fs) {
|
|
|
140
140
|
}));
|
|
141
141
|
}
|
|
142
142
|
export {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
143
|
+
buildResourceMap as a,
|
|
144
|
+
buildDevSimulations as b,
|
|
145
|
+
buildSimulations as c,
|
|
146
|
+
createResourceExports as d,
|
|
147
147
|
extractResourceKey as e,
|
|
148
148
|
extractSimulationKey as f,
|
|
149
149
|
extractSimulationName as g,
|
|
@@ -154,4 +154,4 @@ export {
|
|
|
154
154
|
isSimulationFile as l,
|
|
155
155
|
toPascalCase as t
|
|
156
156
|
};
|
|
157
|
-
//# sourceMappingURL=discovery-
|
|
157
|
+
//# sourceMappingURL=discovery-DzV3HLXs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discovery-COZUnY6a.js","sources":["../src/lib/discovery.ts"],"sourcesContent":["/**\n * Discovery utilities for auto-discovering resources and simulations\n *\n * These helpers process the results of import.meta.glob() calls to extract\n * keys, build component maps, and connect simulations to resources.\n *\n * The glob calls themselves must remain in the template (Vite compile-time),\n * but all the processing logic lives here for easy updates across templates.\n *\n * Node.js utilities (findResourceDirs, isSimulationFile, etc.) can be used\n * by CLI commands for build-time and runtime discovery.\n */\n\nimport type { Simulation } from '../types/simulation.js';\n\n/**\n * Convert a kebab-case string to PascalCase\n * @example toPascalCase('review') // 'Review'\n * @example toPascalCase('album-art') // 'AlbumArt'\n */\nexport function toPascalCase(str: string): string {\n return str\n .split('-')\n .map((part) => part.charAt(0).toUpperCase() + part.slice(1))\n .join('');\n}\n\n/**\n * Extract the resource key from a resource file path\n * @example extractResourceKey('./review-resource.tsx') // 'review'\n * @example extractResourceKey('../src/resources/albums-resource.tsx') // 'albums'\n */\nexport function extractResourceKey(path: string): string | undefined {\n const match = path.match(/([^/]+)-resource\\.(tsx|json)$/);\n return match?.[1];\n}\n\n/**\n * Extract the simulation key from a simulation file path\n * @example extractSimulationKey('./albums-show-simulation.json') // 'albums-show'\n */\nexport function extractSimulationKey(path: string): string | undefined {\n const match = path.match(/([^/]+)-simulation\\.json$/);\n return match?.[1];\n}\n\n/**\n * Find the best matching resource key for a simulation key.\n * Matches the longest resource name that is a prefix of the simulation key.\n * @example findResourceKey('albums-show', ['albums', 'album']) // 'albums'\n * @example findResourceKey('review-diff', ['review', 'carousel']) // 'review'\n */\nexport function findResourceKey(simulationKey: string, resourceKeys: string[]): string | undefined {\n // Sort by length descending to find longest match first\n const sorted = [...resourceKeys].sort((a, b) => b.length - a.length);\n for (const resourceKey of sorted) {\n if (simulationKey === resourceKey || simulationKey.startsWith(resourceKey + '-')) {\n return resourceKey;\n }\n }\n return undefined;\n}\n\n/**\n * Get the expected component export name for a resource\n * @example getComponentName('review') // 'ReviewResource'\n * @example getComponentName('album-art') // 'AlbumArtResource'\n */\nexport function getComponentName(resourceKey: string): string {\n return `${toPascalCase(resourceKey)}Resource`;\n}\n\n// --- Glob processing helpers ---\n\ntype GlobModules = Record<string, unknown>;\n\n/**\n * Process resource component modules from import.meta.glob() result.\n * Extracts components and exports them with PascalCase names.\n *\n * @example\n * const modules = import.meta.glob('./**\\/*-resource.tsx', { eager: true });\n * export default createResourceExports(modules);\n */\nexport function createResourceExports(modules: GlobModules): Record<string, React.ComponentType> {\n const resources: Record<string, React.ComponentType> = {};\n\n for (const [path, module] of Object.entries(modules)) {\n const key = extractResourceKey(path);\n if (!key) continue;\n\n const exportName = getComponentName(key);\n const mod = module as Record<string, unknown>;\n\n // Try default export first, then named export matching the expected name\n const component = mod.default ?? mod[exportName];\n\n // Accept functions (regular components) or objects (forwardRef/memo components)\n if (component && (typeof component === 'function' || typeof component === 'object')) {\n resources[exportName] = component as React.ComponentType;\n }\n }\n\n return resources;\n}\n\n/**\n * Build a resource metadata map from import.meta.glob() result.\n * Used for connecting simulations to their resource definitions.\n *\n * @example\n * const modules = import.meta.glob('../src/resources/**\\/*-resource.tsx', { eager: true });\n * const resourcesMap = buildResourceMap(modules);\n */\nexport function buildResourceMap<T>(modules: GlobModules): Map<string, T> {\n const map = new Map<string, T>();\n\n for (const [path, module] of Object.entries(modules)) {\n const key = extractResourceKey(path);\n if (key) {\n map.set(key, (module as { resource: T }).resource);\n }\n }\n\n return map;\n}\n\n/**\n * Options for building simulations from discovered modules\n */\nexport interface BuildSimulationsOptions<TResource, TSimulation> {\n /** Glob result of simulation JSON files */\n simulationModules: GlobModules;\n /** Map of resource key -> resource metadata */\n resourcesMap: Map<string, TResource>;\n /** Map of component name -> React component */\n resourceComponents: Record<string, React.ComponentType>;\n /** Create the final simulation object */\n createSimulation: (\n simulationKey: string,\n simulationData: unknown,\n resource: TResource,\n resourceComponent: React.ComponentType\n ) => TSimulation;\n /** Optional warning handler for missing resources */\n onMissingResource?: (simulationKey: string, expectedPrefix: string) => void;\n}\n\n/**\n * Build simulations by connecting simulation data with resources and components.\n * This is the main orchestration function for dev server bootstrap.\n */\nexport function buildSimulations<TResource, TSimulation>(\n options: BuildSimulationsOptions<TResource, TSimulation>\n): Record<string, TSimulation> {\n const {\n simulationModules,\n resourcesMap,\n resourceComponents,\n createSimulation,\n onMissingResource = (key, prefix) =>\n console.warn(\n `No matching resource found for simulation \"${key}\". ` +\n `Expected a resource file like src/resources/${prefix}/${prefix}-resource.tsx`\n ),\n } = options;\n\n const resourceKeys = Array.from(resourcesMap.keys());\n const simulations: Record<string, TSimulation> = {};\n\n for (const [path, module] of Object.entries(simulationModules)) {\n const simulationKey = extractSimulationKey(path);\n if (!simulationKey) continue;\n\n const simulationData = (module as { default: unknown }).default;\n\n // Find matching resource\n const resourceKey = findResourceKey(simulationKey, resourceKeys);\n if (!resourceKey) {\n onMissingResource(simulationKey, simulationKey.split('-')[0]);\n continue;\n }\n\n const resource = resourcesMap.get(resourceKey)!;\n\n // Get component\n const componentName = getComponentName(resourceKey);\n const resourceComponent = resourceComponents[componentName];\n\n if (!resourceComponent) {\n console.warn(\n `Resource component \"${componentName}\" not found for resource \"${resourceKey}\". ` +\n `Make sure src/resources/${resourceKey}/${resourceKey}-resource.tsx exists with a default export.`\n );\n continue;\n }\n\n simulations[simulationKey] = createSimulation(\n simulationKey,\n simulationData,\n resource,\n resourceComponent\n );\n }\n\n return simulations;\n}\n\n// --- Dev server helpers ---\n\n/**\n * Resource metadata from *-resource.tsx files\n */\nexport interface ResourceMetadata {\n name: string;\n [key: string]: unknown;\n}\n\n/**\n * Options for building dev simulations\n */\nexport interface BuildDevSimulationsOptions {\n /** Glob result of simulation JSON files: import.meta.glob('*-simulation.json', { eager: true }) */\n simulationModules: GlobModules;\n /** Glob result of resource JSON files: import.meta.glob('*-resource.tsx', { eager: true }) */\n resourceModules: GlobModules;\n /** Resource components map from src/resources/index.ts */\n resourceComponents: Record<string, React.ComponentType>;\n}\n\n/**\n * Build simulations for the dev server from glob results.\n * This is the main entry point for dev.tsx bootstrap.\n *\n * @example\n * const simulations = buildDevSimulations({\n * simulationModules: import.meta.glob('../src/resources/**\\/*-simulation.json', { eager: true }),\n * resourceModules: import.meta.glob('../src/resources/**\\/*-resource.tsx', { eager: true }),\n * resourceComponents: resourceComponents,\n * });\n */\nexport function buildDevSimulations(\n options: BuildDevSimulationsOptions\n): Record<string, Simulation> {\n const { simulationModules, resourceModules, resourceComponents } = options;\n\n // Build resource metadata map\n const resourcesMap = buildResourceMap<ResourceMetadata>(resourceModules);\n\n // Build simulations with the standard dev server format\n return buildSimulations<ResourceMetadata, Simulation>({\n simulationModules,\n resourcesMap,\n resourceComponents,\n createSimulation: (simulationKey, simulationData, resource) => {\n // Get the component name for the resource URL\n const resourceKey = findResourceKey(simulationKey, Array.from(resourcesMap.keys()));\n const componentName = resourceKey ? getComponentName(resourceKey) : '';\n\n return {\n ...(simulationData as Omit<Simulation, 'name' | 'resourceUrl' | 'resource'>),\n name: simulationKey,\n resource: {\n uri: `ui://${resource.name}`,\n ...resource,\n },\n // Generate URL to the resource loader with component name as query param\n resourceUrl: `/.sunpeak/resource-loader.html?component=${componentName}`,\n } as Simulation;\n },\n });\n}\n\n// --- Node.js utilities for CLI commands ---\n// These utilities use standard Node.js APIs and can be imported by build/push/mcp commands.\n\n/**\n * Information about a discovered resource directory\n */\nexport interface ResourceDirInfo {\n /** Resource key (directory name), e.g., 'albums', 'carousel' */\n key: string;\n /** Full path to the resource directory */\n dir: string;\n /** Full path to the main resource file (tsx or json depending on context) */\n resourcePath: string;\n}\n\n/**\n * File system operations interface for dependency injection in tests\n */\nexport interface FsOps {\n readdirSync: (\n path: string,\n options: { withFileTypes: true }\n ) => Array<{ name: string; isDirectory: () => boolean }>;\n existsSync: (path: string) => boolean;\n}\n\n/**\n * Find all resource directories in a base directory.\n * Each valid resource directory contains a file matching the expected pattern.\n *\n * @param baseDir - Base directory to scan (e.g., 'src/resources' or 'dist')\n * @param filePattern - Function to generate expected filename from resource key\n * @param fs - File system operations (for testing)\n *\n * @example\n * // Find source resources (tsx files)\n * const resources = findResourceDirs('src/resources', key => `${key}-resource.tsx`);\n *\n * @example\n * // Find built resources (js files)\n * const resources = findResourceDirs('dist', key => `${key}.js`);\n */\nexport function findResourceDirs(\n baseDir: string,\n filePattern: (key: string) => string,\n fs: FsOps\n): ResourceDirInfo[] {\n if (!fs.existsSync(baseDir)) {\n return [];\n }\n\n const entries = fs.readdirSync(baseDir, { withFileTypes: true });\n\n return entries\n .filter((entry) => entry.isDirectory())\n .map((entry) => {\n const key = entry.name;\n const dir = `${baseDir}/${key}`;\n const resourcePath = `${dir}/${filePattern(key)}`;\n\n if (!fs.existsSync(resourcePath)) {\n return null;\n }\n\n return { key, dir, resourcePath };\n })\n .filter((info): info is ResourceDirInfo => info !== null);\n}\n\n/**\n * Check if a filename is a simulation file for a given resource.\n * Matches pattern: {resourceKey}-*-simulation.json\n *\n * @example\n * isSimulationFile('albums-show-simulation.json', 'albums') // true\n * isSimulationFile('albums-show-simulation.json', 'carousel') // false\n * isSimulationFile('albums-resource.tsx', 'albums') // false\n */\nexport function isSimulationFile(filename: string, resourceKey: string): boolean {\n return filename.startsWith(`${resourceKey}-`) && filename.endsWith('-simulation.json');\n}\n\n/**\n * Extract the simulation name from a simulation filename.\n * Given \"{resourceKey}-{name}-simulation.json\", returns \"{name}\".\n *\n * @example\n * extractSimulationName('albums-show-simulation.json', 'albums') // 'show'\n * extractSimulationName('carousel-hero-simulation.json', 'carousel') // 'hero'\n */\nexport function extractSimulationName(filename: string, resourceKey: string): string {\n return filename.replace(`${resourceKey}-`, '').replace('-simulation.json', '');\n}\n\n/**\n * Find all simulation files in a resource directory.\n *\n * @param resourceDir - Path to the resource directory\n * @param resourceKey - Resource key (e.g., 'albums')\n * @param fs - File system operations (for testing)\n * @returns Array of { filename, name } objects\n */\nexport function findSimulationFiles(\n resourceDir: string,\n resourceKey: string,\n fs: Pick<FsOps, 'readdirSync' | 'existsSync'>\n): Array<{ filename: string; name: string; path: string }> {\n if (!fs.existsSync(resourceDir)) {\n return [];\n }\n\n const entries = fs.readdirSync(resourceDir, { withFileTypes: true });\n\n return entries\n .filter((entry) => !entry.isDirectory() && isSimulationFile(entry.name, resourceKey))\n .map((entry) => ({\n filename: entry.name,\n name: extractSimulationName(entry.name, resourceKey),\n path: `${resourceDir}/${entry.name}`,\n }));\n}\n"],"names":[],"mappings":"AAoBO,SAAS,aAAa,KAAqB;AAChD,SAAO,IACJ,MAAM,GAAG,EACT,IAAI,CAAC,SAAS,KAAK,OAAO,CAAC,EAAE,YAAA,IAAgB,KAAK,MAAM,CAAC,CAAC,EAC1D,KAAK,EAAE;AACZ;AAOO,SAAS,mBAAmB,MAAkC;AACnE,QAAM,QAAQ,KAAK,M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WAAW,IAAI,MAAM,IAAI;AAAA,EAAA,EAClC;AACN;"}
|
|
1
|
+
{"version":3,"file":"discovery-DzV3HLXs.js","sources":["../src/lib/discovery.ts"],"sourcesContent":["/**\n * Discovery utilities for auto-discovering resources and simulations\n *\n * These helpers process the results of import.meta.glob() calls to extract\n * keys, build component maps, and connect simulations to resources.\n *\n * The glob calls themselves must remain in the template (Vite compile-time),\n * but all the processing logic lives here for easy updates across templates.\n *\n * Node.js utilities (findResourceDirs, isSimulationFile, etc.) can be used\n * by CLI commands for build-time and runtime discovery.\n */\n\nimport type { Simulation } from '../types/simulation.js';\n\n/**\n * Convert a kebab-case string to PascalCase\n * @example toPascalCase('review') // 'Review'\n * @example toPascalCase('album-art') // 'AlbumArt'\n */\nexport function toPascalCase(str: string): string {\n return str\n .split('-')\n .map((part) => part.charAt(0).toUpperCase() + part.slice(1))\n .join('');\n}\n\n/**\n * Extract the resource key from a resource file path\n * @example extractResourceKey('./review-resource.tsx') // 'review'\n * @example extractResourceKey('../src/resources/albums-resource.tsx') // 'albums'\n */\nexport function extractResourceKey(path: string): string | undefined {\n const match = path.match(/([^/]+)-resource\\.(tsx|json)$/);\n return match?.[1];\n}\n\n/**\n * Extract the simulation key from a simulation file path\n * @example extractSimulationKey('./albums-show-simulation.json') // 'albums-show'\n */\nexport function extractSimulationKey(path: string): string | undefined {\n const match = path.match(/([^/]+)-simulation\\.json$/);\n return match?.[1];\n}\n\n/**\n * Find the best matching resource key for a simulation key.\n * Matches the longest resource name that is a prefix of the simulation key.\n * @example findResourceKey('albums-show', ['albums', 'album']) // 'albums'\n * @example findResourceKey('review-diff', ['review', 'carousel']) // 'review'\n */\nexport function findResourceKey(simulationKey: string, resourceKeys: string[]): string | undefined {\n // Sort by length descending to find longest match first\n const sorted = [...resourceKeys].sort((a, b) => b.length - a.length);\n for (const resourceKey of sorted) {\n if (simulationKey === resourceKey || simulationKey.startsWith(resourceKey + '-')) {\n return resourceKey;\n }\n }\n return undefined;\n}\n\n/**\n * Get the expected component export name for a resource\n * @example getComponentName('review') // 'ReviewResource'\n * @example getComponentName('album-art') // 'AlbumArtResource'\n */\nexport function getComponentName(resourceKey: string): string {\n return `${toPascalCase(resourceKey)}Resource`;\n}\n\n// --- Glob processing helpers ---\n\ntype GlobModules = Record<string, unknown>;\n\n/**\n * Process resource component modules from import.meta.glob() result.\n * Extracts components and exports them with PascalCase names.\n *\n * @example\n * const modules = import.meta.glob('./**\\/*-resource.tsx', { eager: true });\n * export default createResourceExports(modules);\n */\nexport function createResourceExports(modules: GlobModules): Record<string, React.ComponentType> {\n const resources: Record<string, React.ComponentType> = {};\n\n for (const [path, module] of Object.entries(modules)) {\n const key = extractResourceKey(path);\n if (!key) continue;\n\n const exportName = getComponentName(key);\n const mod = module as Record<string, unknown>;\n\n // Try default export first, then named export matching the expected name\n const component = mod.default ?? mod[exportName];\n\n // Accept functions (regular components) or objects (forwardRef/memo components)\n if (component && (typeof component === 'function' || typeof component === 'object')) {\n resources[exportName] = component as React.ComponentType;\n }\n }\n\n return resources;\n}\n\n/**\n * Build a resource metadata map from import.meta.glob() result.\n * Used for connecting simulations to their resource definitions.\n *\n * @example\n * const modules = import.meta.glob('../src/resources/**\\/*-resource.tsx', { eager: true });\n * const resourcesMap = buildResourceMap(modules);\n */\nexport function buildResourceMap<T>(modules: GlobModules): Map<string, T> {\n const map = new Map<string, T>();\n\n for (const [path, module] of Object.entries(modules)) {\n const key = extractResourceKey(path);\n if (key) {\n map.set(key, (module as { resource: T }).resource);\n }\n }\n\n return map;\n}\n\n/**\n * Options for building simulations from discovered modules\n */\nexport interface BuildSimulationsOptions<TResource, TSimulation> {\n /** Glob result of simulation JSON files */\n simulationModules: GlobModules;\n /** Map of resource key -> resource metadata */\n resourcesMap: Map<string, TResource>;\n /** Map of component name -> React component */\n resourceComponents: Record<string, React.ComponentType>;\n /** Create the final simulation object */\n createSimulation: (\n simulationKey: string,\n simulationData: unknown,\n resource: TResource,\n resourceComponent: React.ComponentType\n ) => TSimulation;\n /** Optional warning handler for missing resources */\n onMissingResource?: (simulationKey: string, expectedPrefix: string) => void;\n}\n\n/**\n * Build simulations by connecting simulation data with resources and components.\n * This is the main orchestration function for dev server bootstrap.\n */\nexport function buildSimulations<TResource, TSimulation>(\n options: BuildSimulationsOptions<TResource, TSimulation>\n): Record<string, TSimulation> {\n const {\n simulationModules,\n resourcesMap,\n resourceComponents,\n createSimulation,\n onMissingResource = (key, prefix) =>\n console.warn(\n `No matching resource found for simulation \"${key}\". ` +\n `Expected a resource file like src/resources/${prefix}/${prefix}-resource.tsx`\n ),\n } = options;\n\n const resourceKeys = Array.from(resourcesMap.keys());\n const simulations: Record<string, TSimulation> = {};\n\n for (const [path, module] of Object.entries(simulationModules)) {\n const simulationKey = extractSimulationKey(path);\n if (!simulationKey) continue;\n\n const simulationData = (module as { default: unknown }).default;\n\n // Find matching resource\n const resourceKey = findResourceKey(simulationKey, resourceKeys);\n if (!resourceKey) {\n onMissingResource(simulationKey, simulationKey.split('-')[0]);\n continue;\n }\n\n const resource = resourcesMap.get(resourceKey)!;\n\n // Get component\n const componentName = getComponentName(resourceKey);\n const resourceComponent = resourceComponents[componentName];\n\n if (!resourceComponent) {\n console.warn(\n `Resource component \"${componentName}\" not found for resource \"${resourceKey}\". ` +\n `Make sure src/resources/${resourceKey}/${resourceKey}-resource.tsx exists with a default export.`\n );\n continue;\n }\n\n simulations[simulationKey] = createSimulation(\n simulationKey,\n simulationData,\n resource,\n resourceComponent\n );\n }\n\n return simulations;\n}\n\n// --- Dev server helpers ---\n\n/**\n * Resource metadata from *-resource.tsx files\n */\nexport interface ResourceMetadata {\n name: string;\n [key: string]: unknown;\n}\n\n/**\n * Options for building dev simulations\n */\nexport interface BuildDevSimulationsOptions {\n /** Glob result of simulation JSON files: import.meta.glob('*-simulation.json', { eager: true }) */\n simulationModules: GlobModules;\n /** Glob result of resource JSON files: import.meta.glob('*-resource.tsx', { eager: true }) */\n resourceModules: GlobModules;\n /** Resource components map from src/resources/index.ts */\n resourceComponents: Record<string, React.ComponentType>;\n}\n\n/**\n * Build simulations for the dev server from glob results.\n * This is the main entry point for dev.tsx bootstrap.\n *\n * @example\n * const simulations = buildDevSimulations({\n * simulationModules: import.meta.glob('../src/resources/**\\/*-simulation.json', { eager: true }),\n * resourceModules: import.meta.glob('../src/resources/**\\/*-resource.tsx', { eager: true }),\n * resourceComponents: resourceComponents,\n * });\n */\nexport function buildDevSimulations(\n options: BuildDevSimulationsOptions\n): Record<string, Simulation> {\n const { simulationModules, resourceModules, resourceComponents } = options;\n\n // Build resource metadata map\n const resourcesMap = buildResourceMap<ResourceMetadata>(resourceModules);\n\n // Build simulations with the standard dev server format\n return buildSimulations<ResourceMetadata, Simulation>({\n simulationModules,\n resourcesMap,\n resourceComponents,\n createSimulation: (simulationKey, simulationData, resource) => {\n // Get the component name for the resource URL\n const resourceKey = findResourceKey(simulationKey, Array.from(resourcesMap.keys()));\n const componentName = resourceKey ? getComponentName(resourceKey) : '';\n\n return {\n ...(simulationData as Omit<Simulation, 'name' | 'resourceUrl' | 'resource'>),\n name: simulationKey,\n resource: {\n uri: `ui://${resource.name}`,\n ...resource,\n },\n // Generate URL to the resource loader with component name as query param\n resourceUrl: `/.sunpeak/resource-loader.html?component=${componentName}`,\n } as Simulation;\n },\n });\n}\n\n// --- Node.js utilities for CLI commands ---\n// These utilities use standard Node.js APIs and can be imported by build/push/mcp commands.\n\n/**\n * Information about a discovered resource directory\n */\nexport interface ResourceDirInfo {\n /** Resource key (directory name), e.g., 'albums', 'carousel' */\n key: string;\n /** Full path to the resource directory */\n dir: string;\n /** Full path to the main resource file (tsx or json depending on context) */\n resourcePath: string;\n}\n\n/**\n * File system operations interface for dependency injection in tests\n */\nexport interface FsOps {\n readdirSync: (\n path: string,\n options: { withFileTypes: true }\n ) => Array<{ name: string; isDirectory: () => boolean }>;\n existsSync: (path: string) => boolean;\n}\n\n/**\n * Find all resource directories in a base directory.\n * Each valid resource directory contains a file matching the expected pattern.\n *\n * @param baseDir - Base directory to scan (e.g., 'src/resources' or 'dist')\n * @param filePattern - Function to generate expected filename from resource key\n * @param fs - File system operations (for testing)\n *\n * @example\n * // Find source resources (tsx files)\n * const resources = findResourceDirs('src/resources', key => `${key}-resource.tsx`);\n *\n * @example\n * // Find built resources (js files)\n * const resources = findResourceDirs('dist', key => `${key}.js`);\n */\nexport function findResourceDirs(\n baseDir: string,\n filePattern: (key: string) => string,\n fs: FsOps\n): ResourceDirInfo[] {\n if (!fs.existsSync(baseDir)) {\n return [];\n }\n\n const entries = fs.readdirSync(baseDir, { withFileTypes: true });\n\n return entries\n .filter((entry) => entry.isDirectory())\n .map((entry) => {\n const key = entry.name;\n const dir = `${baseDir}/${key}`;\n const resourcePath = `${dir}/${filePattern(key)}`;\n\n if (!fs.existsSync(resourcePath)) {\n return null;\n }\n\n return { key, dir, resourcePath };\n })\n .filter((info): info is ResourceDirInfo => info !== null);\n}\n\n/**\n * Check if a filename is a simulation file for a given resource.\n * Matches pattern: {resourceKey}-*-simulation.json\n *\n * @example\n * isSimulationFile('albums-show-simulation.json', 'albums') // true\n * isSimulationFile('albums-show-simulation.json', 'carousel') // false\n * isSimulationFile('albums-resource.tsx', 'albums') // false\n */\nexport function isSimulationFile(filename: string, resourceKey: string): boolean {\n return filename.startsWith(`${resourceKey}-`) && filename.endsWith('-simulation.json');\n}\n\n/**\n * Extract the simulation name from a simulation filename.\n * Given \"{resourceKey}-{name}-simulation.json\", returns \"{name}\".\n *\n * @example\n * extractSimulationName('albums-show-simulation.json', 'albums') // 'show'\n * extractSimulationName('carousel-hero-simulation.json', 'carousel') // 'hero'\n */\nexport function extractSimulationName(filename: string, resourceKey: string): string {\n return filename.replace(`${resourceKey}-`, '').replace('-simulation.json', '');\n}\n\n/**\n * Find all simulation files in a resource directory.\n *\n * @param resourceDir - Path to the resource directory\n * @param resourceKey - Resource key (e.g., 'albums')\n * @param fs - File system operations (for testing)\n * @returns Array of { filename, name } objects\n */\nexport function findSimulationFiles(\n resourceDir: string,\n resourceKey: string,\n fs: Pick<FsOps, 'readdirSync' | 'existsSync'>\n): Array<{ filename: string; name: string; path: string }> {\n if (!fs.existsSync(resourceDir)) {\n return [];\n }\n\n const entries = fs.readdirSync(resourceDir, { withFileTypes: true });\n\n return entries\n .filter((entry) => !entry.isDirectory() && isSimulationFile(entry.name, resourceKey))\n .map((entry) => ({\n filename: entry.name,\n name: extractSimulationName(entry.name, resourceKey),\n path: `${resourceDir}/${entry.name}`,\n }));\n}\n"],"names":[],"mappings":"AAoBO,SAAS,aAAa,KAAqB;AAChD,SAAO,IACJ,MAAM,GAAG,EACT,IAAI,CAAC,SAAS,KAAK,OAAO,CAAC,EAAE,YAAA,IAAgB,KAAK,MAAM,CAAC,CAAC,EAC1D,KAAK,EAAE;AACZ;AAOO,SAAS,mBAAmB,MAAkC;AACnE,QAAM,QAAQ,KAAK,MAAM,+BAA+B;AACxD,SAAO,QAAQ,CAAC;AAClB;AAMO,SAAS,qBAAqB,MAAkC;AACrE,QAAM,QAAQ,KAAK,MAAM,2BAA2B;AACpD,SAAO,QAAQ,CAAC;AAClB;AAQO,SAAS,gBAAgB,eAAuB,cAA4C;AAEjG,QAAM,SAAS,CAAC,GAAG,YAAY,EAAE,KAAK,CAAC,GAAG,MAAM,EAAE,SAAS,EAAE,MAAM;AACnE,aAAW,eAAe,QAAQ;AAChC,QAAI,kBAAkB,eAAe,cAAc,WAAW,cAAc,GAAG,GAAG;AAChF,aAAO;AAAA,IACT;AAAA,EACF;AACA,SAAO;AACT;AAOO,SAAS,iBAAiB,aAA6B;AAC5D,SAAO,GAAG,aAAa,WAAW,CAAC;AACrC;AAcO,SAAS,sBAAsB,SAA2D;AAC/F,QAAM,YAAiD,CAAA;AAEvD,aAAW,CAAC,MAAM,MAAM,KAAK,OAAO,QAAQ,OAAO,GAAG;AACpD,UAAM,MAAM,mBAAmB,IAAI;AACnC,QAAI,CAAC,IAAK;AAEV,UAAM,aAAa,iBAAiB,GAAG;AACvC,UAAM,MAAM;AAG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AAW,GAAG,KAAK,SAAS,SAAS,kBAAkB;AACvF;AAUO,SAAS,sBAAsB,UAAkB,aAA6B;AACnF,SAAO,SAAS,QAAQ,GAAG,WAAW,KAAK,EAAE,EAAE,QAAQ,oBAAoB,EAAE;AAC/E;AAUO,SAAS,oBACd,aACA,aACA,IACyD;AACzD,MAAI,CAAC,GAAG,WAAW,WAAW,GAAG;AAC/B,WAAO,CAAA;AAAA,EACT;AAEA,QAAM,UAAU,GAAG,YAAY,aAAa,EAAE,eAAe,MAAM;AAEnE,SAAO,QACJ,OAAO,CAAC,UAAU,CAAC,MAAM,YAAA,KAAiB,iBAAiB,MAAM,MAAM,WAAW,CAAC,EACnF,IAAI,CAAC,WAAW;AAAA,IACf,UAAU,MAAM;AAAA,IAChB,MAAM,sBAAsB,MAAM,MAAM,WAAW;AAAA,IACnD,MAAM,GAAG,WAAW,IAAI,MAAM,IAAI;AAAA,EAAA,EAClC;AACN;"}
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -20,6 +20,8 @@ export { useCallServerTool } from './use-call-server-tool';
|
|
|
20
20
|
export type { CallServerToolParams, CallServerToolResult } from './use-call-server-tool';
|
|
21
21
|
export { useSendMessage } from './use-send-message';
|
|
22
22
|
export type { SendMessageParams, MessageContent } from './use-send-message';
|
|
23
|
+
export { useUpdateModelContext } from './use-update-model-context';
|
|
24
|
+
export type { UpdateModelContextParams } from './use-update-model-context';
|
|
23
25
|
export { useOpenLink } from './use-open-link';
|
|
24
26
|
export type { OpenLinkParams } from './use-open-link';
|
|
25
27
|
export { useRequestDisplayMode } from './use-request-display-mode';
|
|
@@ -29,4 +31,6 @@ export type { LogLevel, SendLogParams } from './use-send-log';
|
|
|
29
31
|
export { useHostInfo } from './use-host-info';
|
|
30
32
|
export type { HostVersion, HostCapabilities } from './use-host-info';
|
|
31
33
|
export { useTeardown } from './use-teardown';
|
|
34
|
+
export { useAppTools } from './use-app-tools';
|
|
35
|
+
export type { AppTool, AppToolsConfig } from './use-app-tools';
|
|
32
36
|
export { useAppState } from './use-app-state';
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
export interface AppTool {
|
|
3
|
+
name: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
inputSchema?: Record<string, unknown>;
|
|
6
|
+
}
|
|
7
|
+
export interface AppToolsConfig {
|
|
8
|
+
/** Tools this app provides to the host */
|
|
9
|
+
tools: AppTool[];
|
|
10
|
+
/**
|
|
11
|
+
* Handler called when the host invokes one of this app's tools.
|
|
12
|
+
* Return a CallToolResult with the tool's output.
|
|
13
|
+
*/
|
|
14
|
+
onCallTool: (params: {
|
|
15
|
+
name: string;
|
|
16
|
+
arguments?: Record<string, unknown>;
|
|
17
|
+
}) => CallToolResult | Promise<CallToolResult>;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Register tools that this app provides to the host.
|
|
21
|
+
*
|
|
22
|
+
* This enables bidirectional tool calling: the host can call tools
|
|
23
|
+
* defined by the app, in addition to the app calling server tools.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```tsx
|
|
27
|
+
* import { useAppTools } from 'sunpeak';
|
|
28
|
+
*
|
|
29
|
+
* function MyResource() {
|
|
30
|
+
* useAppTools({
|
|
31
|
+
* tools: [
|
|
32
|
+
* { name: 'get-selection', description: 'Get the current selection' },
|
|
33
|
+
* ],
|
|
34
|
+
* onCallTool: async ({ name, arguments: args }) => {
|
|
35
|
+
* if (name === 'get-selection') {
|
|
36
|
+
* return { content: [{ type: 'text', text: selectedText }] };
|
|
37
|
+
* }
|
|
38
|
+
* return { content: [], isError: true };
|
|
39
|
+
* },
|
|
40
|
+
* });
|
|
41
|
+
* }
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export declare function useAppTools(config: AppToolsConfig): void;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { McpUiUpdateModelContextRequest } from '@modelcontextprotocol/ext-apps';
|
|
2
|
+
/** Parameters for updating model context — matches the MCP Apps SDK type. */
|
|
3
|
+
export type UpdateModelContextParams = McpUiUpdateModelContextRequest['params'];
|
|
4
|
+
/**
|
|
5
|
+
* Send model context updates to the host.
|
|
6
|
+
*
|
|
7
|
+
* Unlike `useAppState` (which automatically syncs structured state),
|
|
8
|
+
* this hook gives direct control over when and what is sent to the
|
|
9
|
+
* model context — including text content blocks.
|
|
10
|
+
*
|
|
11
|
+
* Each call overwrites the previous context. The host includes the
|
|
12
|
+
* last update in the model's next turn.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* import { useUpdateModelContext } from 'sunpeak';
|
|
17
|
+
*
|
|
18
|
+
* function MyResource() {
|
|
19
|
+
* const updateModelContext = useUpdateModelContext();
|
|
20
|
+
*
|
|
21
|
+
* const handleSelect = (item: Item) => {
|
|
22
|
+
* updateModelContext({
|
|
23
|
+
* structuredContent: { selectedItem: item },
|
|
24
|
+
* });
|
|
25
|
+
* };
|
|
26
|
+
* }
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare function useUpdateModelContext(): (params: UpdateModelContextParams) => Promise<void>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { c as createSimulatorUrl } from "./simulator-url-BQ-7SMht.js";
|
|
2
|
+
import "./claude-host-CaD7ptbt.js";
|
|
3
|
+
import { I as IframeResource, M as McpAppHost, a as SCREEN_WIDTHS, b as SidebarCheckbox, c as SidebarCollapsibleControl, d as SidebarControl, e as SidebarInput, f as SidebarSelect, g as SidebarTextarea, h as SidebarToggle, i as SimpleSidebar, S as Simulator, T as ThemeProvider, j as extractResourceCSP, k as getHostShell, l as getRegisteredHosts, r as registerHostShell, u as useSimulatorState, m as useThemeContext } from "./simulator-CMgCGNuD.js";
|
|
4
|
+
import { b as buildDevSimulations, a as buildResourceMap, c as buildSimulations, d as createResourceExports, e as extractResourceKey, f as extractSimulationKey, g as extractSimulationName, h as findResourceDirs, i as findResourceKey, j as findSimulationFiles, k as getComponentName, l as isSimulationFile, t as toPascalCase } from "./discovery-DzV3HLXs.js";
|
|
5
|
+
const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
6
|
+
__proto__: null,
|
|
7
|
+
IframeResource,
|
|
8
|
+
McpAppHost,
|
|
9
|
+
SCREEN_WIDTHS,
|
|
10
|
+
SidebarCheckbox,
|
|
11
|
+
SidebarCollapsibleControl,
|
|
12
|
+
SidebarControl,
|
|
13
|
+
SidebarInput,
|
|
14
|
+
SidebarSelect,
|
|
15
|
+
SidebarTextarea,
|
|
16
|
+
SidebarToggle,
|
|
17
|
+
SimpleSidebar,
|
|
18
|
+
Simulator,
|
|
19
|
+
ThemeProvider,
|
|
20
|
+
buildDevSimulations,
|
|
21
|
+
buildResourceMap,
|
|
22
|
+
buildSimulations,
|
|
23
|
+
createResourceExports,
|
|
24
|
+
createSimulatorUrl,
|
|
25
|
+
extractResourceCSP,
|
|
26
|
+
extractResourceKey,
|
|
27
|
+
extractSimulationKey,
|
|
28
|
+
extractSimulationName,
|
|
29
|
+
findResourceDirs,
|
|
30
|
+
findResourceKey,
|
|
31
|
+
findSimulationFiles,
|
|
32
|
+
getComponentName,
|
|
33
|
+
getHostShell,
|
|
34
|
+
getRegisteredHosts,
|
|
35
|
+
isSimulationFile,
|
|
36
|
+
registerHostShell,
|
|
37
|
+
toPascalCase,
|
|
38
|
+
useSimulatorState,
|
|
39
|
+
useThemeContext
|
|
40
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
41
|
+
export {
|
|
42
|
+
index as i
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=index-BKrboRah.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-BKrboRah.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|