sunpeak 0.16.28 → 0.17.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/bin/commands/dev.mjs +169 -342
- package/bin/commands/inspect.mjs +763 -0
- package/bin/commands/new.mjs +2 -2
- package/bin/lib/inspect/inspect-config.d.mts +20 -0
- package/bin/lib/inspect/inspect-config.mjs +76 -0
- package/bin/lib/live/global-setup.mjs +6 -1
- package/bin/sunpeak.js +11 -1
- package/dist/chatgpt/globals.css +35 -18
- package/dist/chatgpt/index.cjs +3 -11
- package/dist/chatgpt/index.cjs.map +1 -1
- package/dist/chatgpt/index.d.ts +2 -2
- package/dist/chatgpt/index.js +4 -8
- package/dist/chatgpt/index.js.map +1 -1
- package/dist/claude/index.cjs +1 -1
- package/dist/claude/index.js +1 -1
- package/dist/discovery-Cgoegt62.js +114 -0
- package/dist/discovery-Cgoegt62.js.map +1 -0
- package/dist/discovery-Clu4uHp1.cjs +161 -0
- package/dist/discovery-Clu4uHp1.cjs.map +1 -0
- package/dist/index.cjs +1 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -3
- package/dist/index.js.map +1 -1
- package/dist/lib/discovery-cli.cjs +1 -1
- package/dist/lib/discovery-cli.js +1 -1
- package/dist/lib/discovery.d.ts +7 -67
- package/dist/lib/index.d.ts +0 -1
- package/dist/mcp/index.cjs +34 -23
- package/dist/mcp/index.cjs.map +1 -1
- package/dist/mcp/index.js +34 -23
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/types.d.ts +5 -0
- package/dist/simulator/index.cjs +5 -11
- package/dist/simulator/index.cjs.map +1 -1
- package/dist/simulator/index.d.ts +4 -2
- package/dist/simulator/index.js +5 -8
- package/dist/simulator/index.js.map +1 -1
- package/dist/simulator/simple-sidebar.d.ts +7 -4
- package/dist/simulator/simulator-url.d.ts +8 -0
- package/dist/simulator/simulator.d.ts +15 -2
- package/dist/simulator/use-mcp-connection.d.ts +19 -0
- package/dist/{simulator-BYIH-xqQ.cjs → simulator-CH9hs0N6.cjs} +159 -52
- package/dist/simulator-CH9hs0N6.cjs.map +1 -0
- package/dist/{simulator-CmgNnWBO.js → simulator-Dl8B-Ljb.js} +154 -53
- package/dist/simulator-Dl8B-Ljb.js.map +1 -0
- package/dist/{simulator-url-BDGD4vZD.cjs → simulator-url-CozKF1jf.cjs} +3 -1
- package/dist/simulator-url-CozKF1jf.cjs.map +1 -0
- package/dist/{simulator-url-Bkxj43yT.js → simulator-url-KoS_ToP6.js} +3 -1
- package/dist/simulator-url-KoS_ToP6.js.map +1 -0
- package/dist/style.css +35 -18
- package/package.json +9 -1
- package/template/dist/albums/albums.html +105 -0
- package/template/dist/albums/albums.json +16 -0
- package/template/dist/carousel/carousel.html +105 -0
- package/template/dist/carousel/carousel.json +16 -0
- package/template/dist/map/map.html +3060 -0
- package/template/dist/map/map.json +22 -0
- package/template/dist/review/review.html +105 -0
- package/template/dist/review/review.json +16 -0
- package/template/dist/server.js +15 -0
- package/template/dist/tools/review-diff.js +50 -0
- package/template/dist/tools/review-post.js +50 -0
- package/template/dist/tools/review-purchase.js +61 -0
- package/template/dist/tools/review.js +31 -0
- package/template/dist/tools/show-albums.js +56 -0
- package/template/dist/tools/show-carousel.js +41 -0
- package/template/dist/tools/show-map.js +47 -0
- package/template/node_modules/.vite/deps/_metadata.json +8 -0
- package/template/node_modules/.vite/deps/package.json +3 -0
- package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps.js +500 -0
- package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps.js.map +1 -0
- package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps_app-bridge.js +563 -0
- package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps_app-bridge.js.map +1 -0
- package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps_react.js +575 -0
- package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps_react.js.map +1 -0
- package/template/node_modules/.vite-mcp/deps/@testing-library_react.js +11363 -0
- package/template/node_modules/.vite-mcp/deps/@testing-library_react.js.map +1 -0
- package/template/node_modules/.vite-mcp/deps/_metadata.json +130 -0
- package/template/node_modules/.vite-mcp/deps/chunk-BoAXSpZd.js +33 -0
- package/template/node_modules/.vite-mcp/deps/client-CU1wWud4.js +14385 -0
- package/template/node_modules/.vite-mcp/deps/client-CU1wWud4.js.map +1 -0
- package/template/node_modules/.vite-mcp/deps/clsx.js +18 -0
- package/template/node_modules/.vite-mcp/deps/clsx.js.map +1 -0
- package/template/node_modules/.vite-mcp/deps/dist-uWX8WbjY.js +505 -0
- package/template/node_modules/.vite-mcp/deps/dist-uWX8WbjY.js.map +1 -0
- package/template/node_modules/.vite-mcp/deps/embla-carousel-react.js +1461 -0
- package/template/node_modules/.vite-mcp/deps/embla-carousel-react.js.map +1 -0
- package/template/node_modules/.vite-mcp/deps/embla-carousel-wheel-gestures.js +536 -0
- package/template/node_modules/.vite-mcp/deps/embla-carousel-wheel-gestures.js.map +1 -0
- package/template/node_modules/.vite-mcp/deps/magic-string.es-Cklsmr-5.js +1013 -0
- package/template/node_modules/.vite-mcp/deps/magic-string.es-Cklsmr-5.js.map +1 -0
- package/template/node_modules/.vite-mcp/deps/mapbox-gl.js +46311 -0
- package/template/node_modules/.vite-mcp/deps/mapbox-gl.js.map +1 -0
- package/template/node_modules/.vite-mcp/deps/package.json +3 -0
- package/template/node_modules/.vite-mcp/deps/protocol-CTflwIfG.js +2090 -0
- package/template/node_modules/.vite-mcp/deps/protocol-CTflwIfG.js.map +1 -0
- package/template/node_modules/.vite-mcp/deps/react-dom.js +186 -0
- package/template/node_modules/.vite-mcp/deps/react-dom.js.map +1 -0
- package/template/node_modules/.vite-mcp/deps/react-dom_client.js +2 -0
- package/template/node_modules/.vite-mcp/deps/react.js +769 -0
- package/template/node_modules/.vite-mcp/deps/react.js.map +1 -0
- package/template/node_modules/.vite-mcp/deps/react_jsx-dev-runtime.js +205 -0
- package/template/node_modules/.vite-mcp/deps/react_jsx-dev-runtime.js.map +1 -0
- package/template/node_modules/.vite-mcp/deps/react_jsx-runtime.js +209 -0
- package/template/node_modules/.vite-mcp/deps/react_jsx-runtime.js.map +1 -0
- package/template/node_modules/.vite-mcp/deps/schemas-NsgmY9QV.js +12157 -0
- package/template/node_modules/.vite-mcp/deps/schemas-NsgmY9QV.js.map +1 -0
- package/template/node_modules/.vite-mcp/deps/tailwind-merge.js +2025 -0
- package/template/node_modules/.vite-mcp/deps/tailwind-merge.js.map +1 -0
- package/template/node_modules/.vite-mcp/deps/vitest.js +14021 -0
- package/template/node_modules/.vite-mcp/deps/vitest.js.map +1 -0
- package/template/node_modules/.vite-mcp/deps/zod.js +624 -0
- package/template/node_modules/.vite-mcp/deps/zod.js.map +1 -0
- package/template/src/tools/review-diff.test.ts +5 -1
- package/template/src/tools/review-diff.ts +1 -1
- package/template/src/tools/review-post.test.ts +5 -1
- package/template/src/tools/review-post.ts +1 -1
- package/template/src/tools/review-purchase.test.ts +5 -1
- package/template/src/tools/review-purchase.ts +1 -1
- package/template/src/tools/review.test.ts +5 -1
- package/template/src/tools/review.ts +1 -1
- package/template/src/tools/show-albums.test.ts +5 -1
- package/template/src/tools/show-albums.ts +1 -1
- package/template/src/tools/show-carousel.test.ts +5 -1
- package/template/src/tools/show-carousel.ts +1 -1
- package/template/src/tools/show-map.test.ts +5 -1
- package/template/src/tools/show-map.ts +1 -1
- package/template/tests/e2e/map.spec.ts +4 -2
- package/dist/discovery-BxKCIgG5.cjs +0 -332
- package/dist/discovery-BxKCIgG5.cjs.map +0 -1
- package/dist/discovery-Du4LHrih.js +0 -261
- package/dist/discovery-Du4LHrih.js.map +0 -1
- package/dist/simulator-BYIH-xqQ.cjs.map +0 -1
- package/dist/simulator-CmgNnWBO.js.map +0 -1
- package/dist/simulator-url-BDGD4vZD.cjs.map +0 -1
- package/dist/simulator-url-Bkxj43yT.js.map +0 -1
- package/template/.sunpeak/dev.tsx +0 -79
- package/template/.sunpeak/resource-loader.html +0 -20
- package/template/.sunpeak/resource-loader.tsx +0 -57
- package/template/index.html +0 -14
- package/template/src/resources/index.ts +0 -17
package/dist/mcp/types.d.ts
CHANGED
|
@@ -75,6 +75,11 @@ export interface SimulationWithDist {
|
|
|
75
75
|
* Handle returned by `runMCPServer` for controlling the running server.
|
|
76
76
|
*/
|
|
77
77
|
export interface MCPServerHandle {
|
|
78
|
+
/**
|
|
79
|
+
* Promise that resolves when the HTTP server is listening.
|
|
80
|
+
* Useful for callers that need to connect to the server immediately after starting it.
|
|
81
|
+
*/
|
|
82
|
+
ready: Promise<void>;
|
|
78
83
|
/**
|
|
79
84
|
* Notify non-local sessions that resources have changed.
|
|
80
85
|
* Sends `notifications/resources/list_changed` so hosts re-fetch fresh content.
|
package/dist/simulator/index.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_chunk = require("../chunk-9hOWP6kD.cjs");
|
|
3
3
|
require("../protocol-jbxhzcnS.cjs");
|
|
4
|
-
const require_simulator = require("../simulator-
|
|
5
|
-
const
|
|
6
|
-
const
|
|
4
|
+
const require_simulator = require("../simulator-CH9hs0N6.cjs");
|
|
5
|
+
const require_simulator_url = require("../simulator-url-CozKF1jf.cjs");
|
|
6
|
+
const require_discovery = require("../discovery-Clu4uHp1.cjs");
|
|
7
7
|
//#region src/simulator/index.ts
|
|
8
8
|
var simulator_exports = /* @__PURE__ */ require_chunk.__exportAll({
|
|
9
9
|
IframeResource: () => require_simulator.IframeResource,
|
|
@@ -19,10 +19,6 @@ var simulator_exports = /* @__PURE__ */ require_chunk.__exportAll({
|
|
|
19
19
|
SimpleSidebar: () => require_simulator.SimpleSidebar,
|
|
20
20
|
Simulator: () => require_simulator.Simulator,
|
|
21
21
|
ThemeProvider: () => require_simulator.ThemeProvider,
|
|
22
|
-
buildDevSimulations: () => require_discovery.buildDevSimulations,
|
|
23
|
-
buildResourceMap: () => require_discovery.buildResourceMap,
|
|
24
|
-
buildSimulations: () => require_discovery.buildSimulations,
|
|
25
|
-
createResourceExports: () => require_discovery.createResourceExports,
|
|
26
22
|
createSimulatorUrl: () => require_simulator_url.createSimulatorUrl,
|
|
27
23
|
extractResourceCSP: () => require_simulator.extractResourceCSP,
|
|
28
24
|
extractResourceKey: () => require_discovery.extractResourceKey,
|
|
@@ -35,6 +31,7 @@ var simulator_exports = /* @__PURE__ */ require_chunk.__exportAll({
|
|
|
35
31
|
registerHostShell: () => require_simulator.registerHostShell,
|
|
36
32
|
resolveServerToolResult: () => require_simulator.resolveServerToolResult,
|
|
37
33
|
toPascalCase: () => require_discovery.toPascalCase,
|
|
34
|
+
useMcpConnection: () => require_simulator.useMcpConnection,
|
|
38
35
|
useSimulatorState: () => require_simulator.useSimulatorState,
|
|
39
36
|
useThemeContext: () => require_simulator.useThemeContext
|
|
40
37
|
});
|
|
@@ -52,10 +49,6 @@ exports.SidebarToggle = require_simulator.SidebarToggle;
|
|
|
52
49
|
exports.SimpleSidebar = require_simulator.SimpleSidebar;
|
|
53
50
|
exports.Simulator = require_simulator.Simulator;
|
|
54
51
|
exports.ThemeProvider = require_simulator.ThemeProvider;
|
|
55
|
-
exports.buildDevSimulations = require_discovery.buildDevSimulations;
|
|
56
|
-
exports.buildResourceMap = require_discovery.buildResourceMap;
|
|
57
|
-
exports.buildSimulations = require_discovery.buildSimulations;
|
|
58
|
-
exports.createResourceExports = require_discovery.createResourceExports;
|
|
59
52
|
exports.createSimulatorUrl = require_simulator_url.createSimulatorUrl;
|
|
60
53
|
exports.extractResourceCSP = require_simulator.extractResourceCSP;
|
|
61
54
|
exports.extractResourceKey = require_discovery.extractResourceKey;
|
|
@@ -74,6 +67,7 @@ Object.defineProperty(exports, "simulator_exports", {
|
|
|
74
67
|
}
|
|
75
68
|
});
|
|
76
69
|
exports.toPascalCase = require_discovery.toPascalCase;
|
|
70
|
+
exports.useMcpConnection = require_simulator.useMcpConnection;
|
|
77
71
|
exports.useSimulatorState = require_simulator.useSimulatorState;
|
|
78
72
|
exports.useThemeContext = require_simulator.useThemeContext;
|
|
79
73
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":[],"sources":["../../src/simulator/index.ts"],"sourcesContent":["/**\n * Generic multi-host simulator for Sunpeak MCP Apps.\n *\n * The Simulator component provides a dev environment for testing MCP Apps\n * against multiple host platforms (ChatGPT, Claude, etc.).\n *\n * @example\n * ```tsx\n * import { simulator } from 'sunpeak';\n * const { Simulator
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../../src/simulator/index.ts"],"sourcesContent":["/**\n * Generic multi-host simulator for Sunpeak MCP Apps.\n *\n * The Simulator component provides a dev environment for testing MCP Apps\n * against multiple host platforms (ChatGPT, Claude, etc.).\n *\n * @example\n * ```tsx\n * import { simulator } from 'sunpeak';\n * const { Simulator } = simulator;\n *\n * <Simulator simulations={simulations} appName=\"My App\" />\n * ```\n *\n * @module sunpeak/simulator\n */\n\n// Register built-in host shells\nimport '../chatgpt/chatgpt-host';\nimport '../claude/claude-host';\n\n// Core simulator component\nexport { Simulator } from './simulator';\nexport type { SimulatorProps } from './simulator';\n\n// State hook (for custom simulator builds)\nexport { useSimulatorState } from './use-simulator-state';\nexport type { UseSimulatorStateOptions, SimulatorState } from './use-simulator-state';\n\n// Host shell system\nexport { registerHostShell, getHostShell, getRegisteredHosts } from './hosts';\nexport type { HostConversationProps, HostShell, HostId } from './hosts';\n\n// Infrastructure\nexport { McpAppHost } from './mcp-app-host';\nexport type { McpAppHostOptions } from './mcp-app-host';\nexport { IframeResource, extractResourceCSP } from './iframe-resource';\nexport type { ResourceCSP } from './iframe-resource';\nexport { ThemeProvider, useThemeContext } from './theme-provider';\n\n// MCP connection (inspect mode)\nexport { useMcpConnection } from './use-mcp-connection';\nexport type { McpConnectionState } from './use-mcp-connection';\n\n// Simulation types & resolution\nexport type { Simulation, ServerToolMock } from '../types/simulation';\nexport { resolveServerToolResult } from '../types/simulation';\n\n// Types & URL helpers\nexport type { ScreenWidth, SimulatorConfig } from './simulator-types';\nexport { SCREEN_WIDTHS } from './simulator-types';\nexport { createSimulatorUrl } from './simulator-url';\nexport type { SimulatorUrlParams } from './simulator-url';\n\n// Sidebar components (for building custom simulators)\nexport {\n SimpleSidebar,\n SidebarControl,\n SidebarCollapsibleControl,\n SidebarSelect,\n SidebarInput,\n SidebarCheckbox,\n SidebarTextarea,\n SidebarToggle,\n} from './simple-sidebar';\n\n// Discovery utilities\nexport {\n toPascalCase,\n extractResourceKey,\n extractSimulationKey,\n findResourceKey,\n getComponentName,\n findResourceDirs,\n} from '../lib/discovery';\nexport type { ResourceDirInfo, FsOps } from '../lib/discovery';\n"],"mappings":""}
|
|
@@ -9,6 +9,8 @@ export type { McpAppHostOptions } from './mcp-app-host';
|
|
|
9
9
|
export { IframeResource, extractResourceCSP } from './iframe-resource';
|
|
10
10
|
export type { ResourceCSP } from './iframe-resource';
|
|
11
11
|
export { ThemeProvider, useThemeContext } from './theme-provider';
|
|
12
|
+
export { useMcpConnection } from './use-mcp-connection';
|
|
13
|
+
export type { McpConnectionState } from './use-mcp-connection';
|
|
12
14
|
export type { Simulation, ServerToolMock } from '../types/simulation';
|
|
13
15
|
export { resolveServerToolResult } from '../types/simulation';
|
|
14
16
|
export type { ScreenWidth, SimulatorConfig } from './simulator-types';
|
|
@@ -16,5 +18,5 @@ export { SCREEN_WIDTHS } from './simulator-types';
|
|
|
16
18
|
export { createSimulatorUrl } from './simulator-url';
|
|
17
19
|
export type { SimulatorUrlParams } from './simulator-url';
|
|
18
20
|
export { SimpleSidebar, SidebarControl, SidebarCollapsibleControl, SidebarSelect, SidebarInput, SidebarCheckbox, SidebarTextarea, SidebarToggle, } from './simple-sidebar';
|
|
19
|
-
export {
|
|
20
|
-
export type {
|
|
21
|
+
export { toPascalCase, extractResourceKey, extractSimulationKey, findResourceKey, getComponentName, findResourceDirs, } from '../lib/discovery';
|
|
22
|
+
export type { ResourceDirInfo, FsOps } from '../lib/discovery';
|
package/dist/simulator/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { r as __exportAll } from "../chunk-D6g4UhsZ.js";
|
|
2
2
|
import "../protocol-DJmRaBzO.js";
|
|
3
|
-
import { _ as
|
|
4
|
-
import {
|
|
5
|
-
import { t as
|
|
3
|
+
import { _ as McpAppHost, a as SidebarControl, b as getRegisteredHosts, c as SidebarTextarea, d as ThemeProvider, f as useThemeContext, g as extractResourceCSP, h as IframeResource, i as SidebarCollapsibleControl, l as SidebarToggle, m as useSimulatorState, n as resolveServerToolResult, o as SidebarInput, p as useMcpConnection, r as SidebarCheckbox, s as SidebarSelect, t as Simulator, u as SimpleSidebar, v as SCREEN_WIDTHS, x as registerHostShell, y as getHostShell } from "../simulator-Dl8B-Ljb.js";
|
|
4
|
+
import { t as createSimulatorUrl } from "../simulator-url-KoS_ToP6.js";
|
|
5
|
+
import { c as toPascalCase, i as findResourceKey, n as extractSimulationKey, r as findResourceDirs, s as getComponentName, t as extractResourceKey } from "../discovery-Cgoegt62.js";
|
|
6
6
|
//#region src/simulator/index.ts
|
|
7
7
|
var simulator_exports = /* @__PURE__ */ __exportAll({
|
|
8
8
|
IframeResource: () => IframeResource,
|
|
@@ -18,10 +18,6 @@ var simulator_exports = /* @__PURE__ */ __exportAll({
|
|
|
18
18
|
SimpleSidebar: () => SimpleSidebar,
|
|
19
19
|
Simulator: () => Simulator,
|
|
20
20
|
ThemeProvider: () => ThemeProvider,
|
|
21
|
-
buildDevSimulations: () => buildDevSimulations,
|
|
22
|
-
buildResourceMap: () => buildResourceMap,
|
|
23
|
-
buildSimulations: () => buildSimulations,
|
|
24
|
-
createResourceExports: () => createResourceExports,
|
|
25
21
|
createSimulatorUrl: () => createSimulatorUrl,
|
|
26
22
|
extractResourceCSP: () => extractResourceCSP,
|
|
27
23
|
extractResourceKey: () => extractResourceKey,
|
|
@@ -34,10 +30,11 @@ var simulator_exports = /* @__PURE__ */ __exportAll({
|
|
|
34
30
|
registerHostShell: () => registerHostShell,
|
|
35
31
|
resolveServerToolResult: () => resolveServerToolResult,
|
|
36
32
|
toPascalCase: () => toPascalCase,
|
|
33
|
+
useMcpConnection: () => useMcpConnection,
|
|
37
34
|
useSimulatorState: () => useSimulatorState,
|
|
38
35
|
useThemeContext: () => useThemeContext
|
|
39
36
|
});
|
|
40
37
|
//#endregion
|
|
41
|
-
export { IframeResource, McpAppHost, SCREEN_WIDTHS, SidebarCheckbox, SidebarCollapsibleControl, SidebarControl, SidebarInput, SidebarSelect, SidebarTextarea, SidebarToggle, SimpleSidebar, Simulator, ThemeProvider,
|
|
38
|
+
export { IframeResource, McpAppHost, SCREEN_WIDTHS, SidebarCheckbox, SidebarCollapsibleControl, SidebarControl, SidebarInput, SidebarSelect, SidebarTextarea, SidebarToggle, SimpleSidebar, Simulator, ThemeProvider, createSimulatorUrl, extractResourceCSP, extractResourceKey, extractSimulationKey, findResourceDirs, findResourceKey, getComponentName, getHostShell, getRegisteredHosts, registerHostShell, resolveServerToolResult, simulator_exports as t, toPascalCase, useMcpConnection, useSimulatorState, useThemeContext };
|
|
42
39
|
|
|
43
40
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/simulator/index.ts"],"sourcesContent":["/**\n * Generic multi-host simulator for Sunpeak MCP Apps.\n *\n * The Simulator component provides a dev environment for testing MCP Apps\n * against multiple host platforms (ChatGPT, Claude, etc.).\n *\n * @example\n * ```tsx\n * import { simulator } from 'sunpeak';\n * const { Simulator
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/simulator/index.ts"],"sourcesContent":["/**\n * Generic multi-host simulator for Sunpeak MCP Apps.\n *\n * The Simulator component provides a dev environment for testing MCP Apps\n * against multiple host platforms (ChatGPT, Claude, etc.).\n *\n * @example\n * ```tsx\n * import { simulator } from 'sunpeak';\n * const { Simulator } = simulator;\n *\n * <Simulator simulations={simulations} appName=\"My App\" />\n * ```\n *\n * @module sunpeak/simulator\n */\n\n// Register built-in host shells\nimport '../chatgpt/chatgpt-host';\nimport '../claude/claude-host';\n\n// Core simulator component\nexport { Simulator } from './simulator';\nexport type { SimulatorProps } from './simulator';\n\n// State hook (for custom simulator builds)\nexport { useSimulatorState } from './use-simulator-state';\nexport type { UseSimulatorStateOptions, SimulatorState } from './use-simulator-state';\n\n// Host shell system\nexport { registerHostShell, getHostShell, getRegisteredHosts } from './hosts';\nexport type { HostConversationProps, HostShell, HostId } from './hosts';\n\n// Infrastructure\nexport { McpAppHost } from './mcp-app-host';\nexport type { McpAppHostOptions } from './mcp-app-host';\nexport { IframeResource, extractResourceCSP } from './iframe-resource';\nexport type { ResourceCSP } from './iframe-resource';\nexport { ThemeProvider, useThemeContext } from './theme-provider';\n\n// MCP connection (inspect mode)\nexport { useMcpConnection } from './use-mcp-connection';\nexport type { McpConnectionState } from './use-mcp-connection';\n\n// Simulation types & resolution\nexport type { Simulation, ServerToolMock } from '../types/simulation';\nexport { resolveServerToolResult } from '../types/simulation';\n\n// Types & URL helpers\nexport type { ScreenWidth, SimulatorConfig } from './simulator-types';\nexport { SCREEN_WIDTHS } from './simulator-types';\nexport { createSimulatorUrl } from './simulator-url';\nexport type { SimulatorUrlParams } from './simulator-url';\n\n// Sidebar components (for building custom simulators)\nexport {\n SimpleSidebar,\n SidebarControl,\n SidebarCollapsibleControl,\n SidebarSelect,\n SidebarInput,\n SidebarCheckbox,\n SidebarTextarea,\n SidebarToggle,\n} from './simple-sidebar';\n\n// Discovery utilities\nexport {\n toPascalCase,\n extractResourceKey,\n extractSimulationKey,\n findResourceKey,\n getComponentName,\n findResourceDirs,\n} from '../lib/discovery';\nexport type { ResourceDirInfo, FsOps } from '../lib/discovery';\n"],"mappings":""}
|
|
@@ -7,14 +7,15 @@ interface SimpleSidebarProps {
|
|
|
7
7
|
}
|
|
8
8
|
export declare function SimpleSidebar({ children, controls, headerRight }: SimpleSidebarProps): import("react/jsx-runtime").JSX.Element;
|
|
9
9
|
interface SidebarControlProps {
|
|
10
|
-
label:
|
|
10
|
+
label: React.ReactNode;
|
|
11
11
|
children: React.ReactNode;
|
|
12
12
|
/** Short tooltip shown on hover of the help icon */
|
|
13
13
|
tooltip?: string;
|
|
14
14
|
/** Docs path appended to https://sunpeak.ai/docs/ */
|
|
15
15
|
docsPath?: string;
|
|
16
|
+
'data-testid'?: string;
|
|
16
17
|
}
|
|
17
|
-
export declare function SidebarControl({ label, children, tooltip, docsPath }: SidebarControlProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export declare function SidebarControl({ label, children, tooltip, docsPath, 'data-testid': testId, }: SidebarControlProps): import("react/jsx-runtime").JSX.Element;
|
|
18
19
|
interface SidebarCollapsibleControlProps {
|
|
19
20
|
label: string;
|
|
20
21
|
children: React.ReactNode;
|
|
@@ -23,8 +24,9 @@ interface SidebarCollapsibleControlProps {
|
|
|
23
24
|
tooltip?: string;
|
|
24
25
|
/** Docs path appended to https://sunpeak.ai/docs/ */
|
|
25
26
|
docsPath?: string;
|
|
27
|
+
'data-testid'?: string;
|
|
26
28
|
}
|
|
27
|
-
export declare function SidebarCollapsibleControl({ label, children, defaultCollapsed, tooltip, docsPath, }: SidebarCollapsibleControlProps): import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
export declare function SidebarCollapsibleControl({ label, children, defaultCollapsed, tooltip, docsPath, 'data-testid': testId, }: SidebarCollapsibleControlProps): import("react/jsx-runtime").JSX.Element;
|
|
28
30
|
interface SidebarSelectProps {
|
|
29
31
|
value: string;
|
|
30
32
|
onChange: (value: string) => void;
|
|
@@ -63,8 +65,9 @@ interface SidebarTextareaProps {
|
|
|
63
65
|
placeholder?: string;
|
|
64
66
|
maxRows?: number;
|
|
65
67
|
error?: string;
|
|
68
|
+
'data-testid'?: string;
|
|
66
69
|
}
|
|
67
|
-
export declare function SidebarTextarea({ value, onChange, onFocus, onBlur, placeholder, maxRows, error, }: SidebarTextareaProps): import("react/jsx-runtime").JSX.Element;
|
|
70
|
+
export declare function SidebarTextarea({ value, onChange, onFocus, onBlur, placeholder, maxRows, error, 'data-testid': testId, }: SidebarTextareaProps): import("react/jsx-runtime").JSX.Element;
|
|
68
71
|
interface SidebarToggleProps {
|
|
69
72
|
value: string;
|
|
70
73
|
onChange: (value: string) => void;
|
|
@@ -93,6 +93,14 @@ export interface SimulatorUrlParams {
|
|
|
93
93
|
* Enable Prod Resources mode (production dist/ bundles instead of HMR).
|
|
94
94
|
*/
|
|
95
95
|
prodResources?: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* MCP server URL for inspect mode. Encoded into the URL for informational purposes.
|
|
98
|
+
*/
|
|
99
|
+
serverUrl?: string;
|
|
100
|
+
/**
|
|
101
|
+
* Pre-select a tool by name (alternative to the `simulation` param).
|
|
102
|
+
*/
|
|
103
|
+
tool?: string;
|
|
96
104
|
}
|
|
97
105
|
/**
|
|
98
106
|
* Creates a URL path with query parameters for the ChatGPT Simulator.
|
|
@@ -9,11 +9,16 @@ export interface SimulatorProps {
|
|
|
9
9
|
appIcon?: string;
|
|
10
10
|
/** Which host shell to use initially. Defaults to 'chatgpt'. */
|
|
11
11
|
defaultHost?: HostId;
|
|
12
|
-
/** Override callServerTool resolution. When provided, bypasses simulation serverTools mocks
|
|
12
|
+
/** Override callServerTool resolution. When provided, bypasses simulation serverTools mocks. Routes through MCP which returns simulation fixture data for UI tools. */
|
|
13
13
|
onCallTool?: (params: {
|
|
14
14
|
name: string;
|
|
15
15
|
arguments?: Record<string, unknown>;
|
|
16
16
|
}) => Promise<CallToolResult> | CallToolResult;
|
|
17
|
+
/** Direct tool handler call, bypassing MCP server mock data. Used by the Prod Tools Run button to call real handlers. Falls back to onCallTool if not provided. */
|
|
18
|
+
onCallToolDirect?: (params: {
|
|
19
|
+
name: string;
|
|
20
|
+
arguments?: Record<string, unknown>;
|
|
21
|
+
}) => Promise<CallToolResult> | CallToolResult;
|
|
17
22
|
/** Initial prod-tools mode state. Defaults to false. */
|
|
18
23
|
defaultProdTools?: boolean;
|
|
19
24
|
/** Initial prod-resources mode state. When true, resources load from dist/ instead of HMR. Defaults to false. */
|
|
@@ -26,5 +31,13 @@ export interface SimulatorProps {
|
|
|
26
31
|
* giving real cross-origin isolation that matches production hosts.
|
|
27
32
|
*/
|
|
28
33
|
sandboxUrl?: string;
|
|
34
|
+
/**
|
|
35
|
+
* MCP server URL. When provided, the simulator enters "inspect" mode:
|
|
36
|
+
* shows a server URL input in the sidebar (replacing prod-tools/prod-resources
|
|
37
|
+
* checkboxes), routes tool calls to the real server, and always shows the
|
|
38
|
+
* Run button. Simulations still work — those with toolResult use mock data,
|
|
39
|
+
* those without call the real server.
|
|
40
|
+
*/
|
|
41
|
+
mcpServerUrl?: string;
|
|
29
42
|
}
|
|
30
|
-
export declare function Simulator({ children, simulations, appName, appIcon, defaultHost, onCallTool, defaultProdTools, defaultProdResources, hideSimulatorModes, sandboxUrl, }: SimulatorProps): import("react/jsx-runtime").JSX.Element;
|
|
43
|
+
export declare function Simulator({ children, simulations, appName, appIcon, defaultHost, onCallTool, onCallToolDirect, defaultProdTools, defaultProdResources, hideSimulatorModes, sandboxUrl, mcpServerUrl, }: SimulatorProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface McpConnectionState {
|
|
2
|
+
/** Current connection status */
|
|
3
|
+
status: 'disconnected' | 'connecting' | 'connected' | 'error';
|
|
4
|
+
/** Error message if status is 'error' */
|
|
5
|
+
error?: string;
|
|
6
|
+
/** Verify the server connection is alive. */
|
|
7
|
+
reconnect: (url: string) => Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Hook for managing MCP server connection status via the dev server proxy.
|
|
11
|
+
*
|
|
12
|
+
* On mount (when `serverUrl` is provided), verifies the connection is alive
|
|
13
|
+
* by fetching `/__sunpeak/list-tools`. Tracks connection status for display
|
|
14
|
+
* in the sidebar (colored dot indicator).
|
|
15
|
+
*
|
|
16
|
+
* Tool calling is handled separately via the `onCallTool` prop — this
|
|
17
|
+
* hook only manages the connection lifecycle and status display.
|
|
18
|
+
*/
|
|
19
|
+
export declare function useMcpConnection(serverUrl: string | undefined): McpConnectionState;
|