sunpeak 0.17.4 → 0.17.6

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.
Files changed (48) hide show
  1. package/bin/commands/dev.mjs +4 -3
  2. package/bin/commands/inspect.mjs +58 -33
  3. package/dist/chatgpt/globals.css +5 -0
  4. package/dist/chatgpt/index.cjs +2 -2
  5. package/dist/chatgpt/index.js +2 -2
  6. package/dist/claude/index.cjs +1 -1
  7. package/dist/claude/index.js +1 -1
  8. package/dist/index.cjs +1 -1
  9. package/dist/index.js +1 -1
  10. package/dist/mcp/index.cjs +1 -1
  11. package/dist/mcp/index.cjs.map +1 -1
  12. package/dist/mcp/index.js +1 -1
  13. package/dist/mcp/index.js.map +1 -1
  14. package/dist/mcp/types.d.ts +7 -0
  15. package/dist/simulator/index.cjs +2 -2
  16. package/dist/simulator/index.cjs.map +1 -1
  17. package/dist/simulator/index.js +2 -2
  18. package/dist/simulator/index.js.map +1 -1
  19. package/dist/simulator/simulator-url.d.ts +32 -41
  20. package/dist/simulator/simulator.d.ts +14 -10
  21. package/dist/simulator/use-mcp-connection.d.ts +12 -7
  22. package/dist/simulator/use-simulator-state.d.ts +1 -1
  23. package/dist/{simulator-Dl8B-Ljb.js → simulator-BijjlOXb.js} +278 -143
  24. package/dist/simulator-BijjlOXb.js.map +1 -0
  25. package/dist/{simulator-CH9hs0N6.cjs → simulator-DqWETA_1.cjs} +278 -143
  26. package/dist/simulator-DqWETA_1.cjs.map +1 -0
  27. package/dist/{simulator-url-CozKF1jf.cjs → simulator-url-3ATCsPOT.cjs} +11 -30
  28. package/dist/simulator-url-3ATCsPOT.cjs.map +1 -0
  29. package/dist/{simulator-url-KoS_ToP6.js → simulator-url-BbuuWa7S.js} +11 -30
  30. package/dist/simulator-url-BbuuWa7S.js.map +1 -0
  31. package/dist/style.css +5 -0
  32. package/package.json +1 -1
  33. package/template/dist/albums/albums.html +1 -1
  34. package/template/dist/albums/albums.json +1 -1
  35. package/template/dist/carousel/carousel.html +1 -1
  36. package/template/dist/carousel/carousel.json +1 -1
  37. package/template/dist/map/map.html +1 -1
  38. package/template/dist/map/map.json +1 -1
  39. package/template/dist/review/review.html +1 -1
  40. package/template/dist/review/review.json +1 -1
  41. package/template/tests/e2e/albums.spec.ts +3 -9
  42. package/template/tests/e2e/carousel.spec.ts +3 -9
  43. package/template/tests/e2e/map.spec.ts +3 -9
  44. package/template/tests/e2e/review.spec.ts +3 -9
  45. package/dist/simulator-CH9hs0N6.cjs.map +0 -1
  46. package/dist/simulator-Dl8B-Ljb.js.map +0 -1
  47. package/dist/simulator-url-CozKF1jf.cjs.map +0 -1
  48. package/dist/simulator-url-KoS_ToP6.js.map +0 -1
@@ -106,4 +106,11 @@ export interface MCPServerConfig {
106
106
  * When not provided, resources serve pre-built HTML (production mode).
107
107
  */
108
108
  viteServer?: unknown;
109
+ /**
110
+ * When true, UI tool calls always use the real handler (bypassing simulation
111
+ * mock data). When false (default), UI tools with structuredContent in their
112
+ * simulation return mock data — real handlers are only used for backend-only
113
+ * tools. Set by `--prod-tools` flag in `sunpeak dev`.
114
+ */
115
+ prodTools?: boolean;
109
116
  }
@@ -1,8 +1,8 @@
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-CH9hs0N6.cjs");
5
- const require_simulator_url = require("../simulator-url-CozKF1jf.cjs");
4
+ const require_simulator = require("../simulator-DqWETA_1.cjs");
5
+ const require_simulator_url = require("../simulator-url-3ATCsPOT.cjs");
6
6
  const require_discovery = require("../discovery-Clu4uHp1.cjs");
7
7
  //#region src/simulator/index.ts
8
8
  var simulator_exports = /* @__PURE__ */ require_chunk.__exportAll({
@@ -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 } = 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":""}
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\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":""}
@@ -1,7 +1,7 @@
1
1
  import { r as __exportAll } from "../chunk-D6g4UhsZ.js";
2
2
  import "../protocol-DJmRaBzO.js";
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";
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-BijjlOXb.js";
4
+ import { t as createSimulatorUrl } from "../simulator-url-BbuuWa7S.js";
5
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({
@@ -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 } = 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":""}
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\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":""}
@@ -4,15 +4,28 @@ import { Theme, DisplayMode, DeviceType } from '../types/runtime';
4
4
  *
5
5
  * Use with `createSimulatorUrl()` to generate type-safe URL paths for e2e tests.
6
6
  *
7
+ * The two primary selectors mirror the sidebar dropdowns:
8
+ * - `tool` — which tool to inspect (Tool dropdown)
9
+ * - `simulation` — which simulation fixture to load (Simulation dropdown)
10
+ *
11
+ * When only `tool` is specified, no mock data is loaded ("Press Run" state).
12
+ * When `simulation` is specified, mock data from that fixture renders immediately.
13
+ * When both are specified, the tool is selected and the simulation provides mock data.
14
+ *
7
15
  * @example
8
16
  * ```ts
9
- * import { createSimulatorUrl } from 'sunpeak/chatgpt';
17
+ * import { createSimulatorUrl } from 'sunpeak/simulator';
18
+ *
19
+ * // Select a tool with no mock data (user must click Run):
20
+ * await page.goto(createSimulatorUrl({ tool: 'show-albums' }));
10
21
  *
11
- * // In e2e tests:
22
+ * // Select a simulation (mock data renders immediately):
23
+ * await page.goto(createSimulatorUrl({ simulation: 'show-albums' }));
24
+ *
25
+ * // Full options:
12
26
  * await page.goto(createSimulatorUrl({
13
27
  * simulation: 'show-albums',
14
28
  * theme: 'dark',
15
- * displayMode: 'fullscreen',
16
29
  * host: 'claude',
17
30
  * }));
18
31
  * ```
@@ -21,8 +34,15 @@ export interface SimulatorUrlParams {
21
34
  /**
22
35
  * The simulation name to load (e.g., 'show-albums', 'review-diff').
23
36
  * Corresponds to the simulation JSON filename without the `.json` extension.
37
+ * When specified, mock data from the simulation fixture renders immediately.
24
38
  */
25
39
  simulation?: string;
40
+ /**
41
+ * The tool name to select (e.g., 'show-albums', 'show-map').
42
+ * When specified without `simulation`, no mock data is loaded — the user
43
+ * must click Run to call the real handler.
44
+ */
45
+ tool?: string;
26
46
  /**
27
47
  * The host shell to use (e.g., 'chatgpt', 'claude').
28
48
  * Switches conversation chrome, theming, and reported host info/capabilities.
@@ -85,25 +105,13 @@ export interface SimulatorUrlParams {
85
105
  * Safe area inset from the right of the screen (in pixels).
86
106
  */
87
107
  safeAreaRight?: number;
88
- /**
89
- * Enable Prod Tools mode (real tool handlers instead of simulation mocks).
90
- */
91
- prodTools?: boolean;
92
108
  /**
93
109
  * Enable Prod Resources mode (production dist/ bundles instead of HMR).
94
110
  */
95
111
  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;
104
112
  }
105
113
  /**
106
- * Creates a URL path with query parameters for the ChatGPT Simulator.
114
+ * Creates a URL path with query parameters for the Simulator.
107
115
  *
108
116
  * @param params - The simulator parameters to encode
109
117
  * @param basePath - The base path for the URL (default: '/')
@@ -111,34 +119,17 @@ export interface SimulatorUrlParams {
111
119
  *
112
120
  * @example
113
121
  * ```ts
114
- * // Basic usage
122
+ * // Tool only (no mock data, "Press Run" state):
123
+ * createSimulatorUrl({ tool: 'show-albums' })
124
+ * // Returns: '/?tool=show-albums'
125
+ *
126
+ * // Simulation (mock data renders immediately):
115
127
  * createSimulatorUrl({ simulation: 'show-albums', theme: 'light' })
116
128
  * // Returns: '/?simulation=show-albums&theme=light'
117
129
  *
118
- * // With display mode
119
- * createSimulatorUrl({
120
- * simulation: 'review-diff',
121
- * theme: 'dark',
122
- * displayMode: 'fullscreen',
123
- * })
124
- * // Returns: '/?simulation=review-diff&theme=dark&displayMode=fullscreen'
125
- *
126
- * // With device simulation
127
- * createSimulatorUrl({
128
- * simulation: 'show-map',
129
- * deviceType: 'mobile',
130
- * touch: true,
131
- * hover: false,
132
- * })
133
- * // Returns: '/?simulation=show-map&deviceType=mobile&touch=true&hover=false'
134
- *
135
- * // With safe area insets (for notch simulation)
136
- * createSimulatorUrl({
137
- * simulation: 'show-carousel',
138
- * safeAreaTop: 44,
139
- * safeAreaBottom: 34,
140
- * })
141
- * // Returns: '/?simulation=show-carousel&safeAreaTop=44&safeAreaBottom=34'
130
+ * // Both tool and simulation:
131
+ * createSimulatorUrl({ tool: 'show-albums', simulation: 'show-albums' })
132
+ * // Returns: '/?tool=show-albums&simulation=show-albums'
142
133
  * ```
143
134
  */
144
135
  export declare function createSimulatorUrl(params: SimulatorUrlParams, basePath?: string): string;
@@ -14,17 +14,23 @@ export interface SimulatorProps {
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. */
17
+ /** Direct tool handler call, bypassing MCP server mock data. Falls back to onCallTool if not provided. */
18
18
  onCallToolDirect?: (params: {
19
19
  name: string;
20
20
  arguments?: Record<string, unknown>;
21
21
  }) => Promise<CallToolResult> | CallToolResult;
22
- /** Initial prod-tools mode state. Defaults to false. */
23
- defaultProdTools?: boolean;
24
22
  /** Initial prod-resources mode state. When true, resources load from dist/ instead of HMR. Defaults to false. */
25
23
  defaultProdResources?: boolean;
26
- /** Hide Prod Tools and Prod Resources toggles in the sidebar (e.g., for marketing/embedded use). */
24
+ /** Hide framework-only controls (Prod Resources) in the sidebar. */
27
25
  hideSimulatorModes?: boolean;
26
+ /**
27
+ * Demo mode for embedding on marketing sites. When true:
28
+ * - Hides Prod Resources checkbox
29
+ * - Disables the MCP Server URL input (shows a static example URL)
30
+ * - Hides the Run button (prevents sending real MCP requests)
31
+ * - Hides connection status indicator
32
+ */
33
+ demoMode?: boolean;
28
34
  /**
29
35
  * Base URL of the separate-origin sandbox server (e.g., "http://localhost:24680").
30
36
  * When provided, the outer iframe loads from this URL instead of using srcdoc,
@@ -32,12 +38,10 @@ export interface SimulatorProps {
32
38
  */
33
39
  sandboxUrl?: string;
34
40
  /**
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.
41
+ * MCP server URL. Pre-populates the server URL field in the sidebar and
42
+ * shows connection status. Users can edit this URL at any time to connect
43
+ * to a different server.
40
44
  */
41
45
  mcpServerUrl?: string;
42
46
  }
43
- export declare function Simulator({ children, simulations, appName, appIcon, defaultHost, onCallTool, onCallToolDirect, defaultProdTools, defaultProdResources, hideSimulatorModes, sandboxUrl, mcpServerUrl, }: SimulatorProps): import("react/jsx-runtime").JSX.Element;
47
+ export declare function Simulator({ children, simulations: initialSimulations, appName, appIcon, defaultHost, onCallTool, onCallToolDirect, defaultProdResources, hideSimulatorModes, demoMode, sandboxUrl, mcpServerUrl, }: SimulatorProps): import("react/jsx-runtime").JSX.Element;
@@ -3,17 +3,22 @@ export interface McpConnectionState {
3
3
  status: 'disconnected' | 'connecting' | 'connected' | 'error';
4
4
  /** Error message if status is 'error' */
5
5
  error?: string;
6
- /** Verify the server connection is alive. */
6
+ /** Simulations returned after a successful reconnect (undefined until first reconnect or after a failed reconnect) */
7
+ simulations?: Record<string, unknown>;
8
+ /** True after at least one user-initiated reconnect has been attempted (URL change). */
9
+ hasReconnected: boolean;
10
+ /** Connect to a new MCP server URL. Returns discovered simulations on success. */
7
11
  reconnect: (url: string) => Promise<void>;
8
12
  }
9
13
  /**
10
14
  * Hook for managing MCP server connection status via the dev server proxy.
11
15
  *
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).
16
+ * On mount (when `initialServerUrl` is provided), verifies the connection is alive
17
+ * by fetching `/__sunpeak/list-tools`. URL changes are handled by the caller
18
+ * via `reconnect()`, which posts to `/__sunpeak/connect`.
15
19
  *
16
- * Tool calling is handled separately via the `onCallTool` prop this
17
- * hook only manages the connection lifecycle and status display.
20
+ * This split avoids React StrictMode issues: the mount-only health check runs
21
+ * once (or safely twice with cancellation), while explicit `reconnect()` calls
22
+ * are triggered by the Simulator's URL-change effect.
18
23
  */
19
- export declare function useMcpConnection(serverUrl: string | undefined): McpConnectionState;
24
+ export declare function useMcpConnection(initialServerUrl: string | undefined): McpConnectionState;
@@ -86,7 +86,7 @@ export interface SimulatorState {
86
86
  csp: ResourceCSP | undefined;
87
87
  permissions: McpUiResourcePermissions | undefined;
88
88
  prefersBorder: boolean;
89
- urlProdTools: boolean | undefined;
89
+ urlTool: string | undefined;
90
90
  urlProdResources: boolean | undefined;
91
91
  }
92
92
  export declare function useSimulatorState({ simulations, defaultHost, }: UseSimulatorStateOptions): SimulatorState;