sunpeak 0.15.4 → 0.16.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 +51 -48
- package/bin/commands/build.mjs +13 -4
- package/bin/commands/dev.mjs +64 -19
- package/bin/commands/new.mjs +13 -3
- package/bin/lib/extract-resource.mjs +1 -1
- package/bin/lib/extract-tool.mjs +78 -0
- package/bin/lib/patterns.mjs +2 -26
- package/dist/chatgpt/index.cjs +3 -6
- package/dist/chatgpt/index.cjs.map +1 -1
- package/dist/chatgpt/index.d.ts +1 -1
- package/dist/chatgpt/index.js +6 -9
- package/dist/claude/index.cjs +1 -1
- package/dist/claude/index.js +1 -1
- package/dist/discovery-CH80W5l9.js +217 -0
- package/dist/discovery-CH80W5l9.js.map +1 -0
- package/dist/discovery-DmB8_4QL.cjs +216 -0
- package/dist/discovery-DmB8_4QL.cjs.map +1 -0
- package/dist/{index-CutQgPzR.js → index-BjnAsaqp.js} +3 -6
- package/dist/index-BjnAsaqp.js.map +1 -0
- package/dist/{index-Cngntkp2.cjs → index-BvQ_ZuOO.cjs} +3 -6
- package/dist/{index-Cngntkp2.cjs.map → index-BvQ_ZuOO.cjs.map} +1 -1
- package/dist/{index-B0dxRJvS.cjs → index-C9CVbGFt.cjs} +3 -6
- package/dist/index-C9CVbGFt.cjs.map +1 -0
- package/dist/{index-Ce_5ZIdJ.js → index-CTGEqlgk.js} +3 -6
- package/dist/{index-Ce_5ZIdJ.js.map → index-CTGEqlgk.js.map} +1 -1
- package/dist/index.cjs +48 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3404 -3361
- package/dist/index.js.map +1 -1
- package/dist/lib/discovery-cli.cjs +58 -5
- package/dist/lib/discovery-cli.cjs.map +1 -1
- package/dist/lib/discovery-cli.d.ts +3 -2
- package/dist/lib/discovery-cli.js +61 -8
- package/dist/lib/discovery-cli.js.map +1 -1
- package/dist/lib/discovery.d.ts +42 -43
- package/dist/lib/extract-tool.d.ts +12 -0
- package/dist/mcp/favicon.d.ts +1 -1
- package/dist/mcp/index.cjs +3 -2
- package/dist/mcp/index.cjs.map +1 -1
- package/dist/mcp/index.d.ts +1 -1
- package/dist/mcp/index.js +3 -2
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/types.d.ts +24 -1
- package/dist/platform/chatgpt/index.cjs +1 -1
- package/dist/platform/chatgpt/index.js +1 -1
- package/dist/simulator/index.cjs +2 -5
- package/dist/simulator/index.cjs.map +1 -1
- package/dist/simulator/index.d.ts +1 -1
- package/dist/simulator/index.js +5 -8
- package/dist/simulator/simulator-url.d.ts +9 -9
- package/dist/{simulator-DcfQBRXE.cjs → simulator-B56j5P8W.cjs} +8 -2
- package/dist/{simulator-DcfQBRXE.cjs.map → simulator-B56j5P8W.cjs.map} +1 -1
- package/dist/{simulator-CxrtnguM.js → simulator-C0H_k092.js} +8 -2
- package/dist/{simulator-CxrtnguM.js.map → simulator-C0H_k092.js.map} +1 -1
- package/dist/simulator-url-CuLqtnSS.js.map +1 -1
- package/dist/simulator-url-rgg_KYOg.cjs.map +1 -1
- package/dist/types/resource-config.d.ts +7 -5
- package/dist/{use-app-D_TeaMFG.js → use-app-BThbgFFT.js} +51 -22
- package/dist/{use-app-D_TeaMFG.js.map → use-app-BThbgFFT.js.map} +1 -1
- package/dist/{use-app-BnoSPiUT.cjs → use-app-BuufpXTQ.cjs} +49 -20
- package/dist/{use-app-BnoSPiUT.cjs.map → use-app-BuufpXTQ.cjs.map} +1 -1
- package/package.json +1 -1
- package/template/.sunpeak/dev.tsx +8 -4
- package/template/.sunpeak/resource-loader.tsx +2 -1
- package/template/README.md +14 -10
- package/template/package.json +2 -1
- package/template/src/resources/albums/{albums-resource.test.tsx → albums.test.tsx} +1 -1
- package/template/src/resources/albums/{albums-resource.tsx → albums.tsx} +0 -1
- package/template/src/resources/carousel/{carousel-resource.test.tsx → carousel.test.tsx} +1 -1
- package/template/src/resources/carousel/{carousel-resource.tsx → carousel.tsx} +0 -1
- package/template/src/resources/index.ts +4 -4
- package/template/src/resources/map/{map-resource.test.tsx → map.test.tsx} +1 -1
- package/template/src/resources/map/{map-resource.tsx → map.tsx} +0 -1
- package/template/src/resources/review/{review-resource.test.tsx → review.test.tsx} +1 -1
- package/template/src/resources/review/{review-resource.tsx → review.tsx} +1 -2
- package/template/src/server.ts +15 -0
- package/template/src/tools/review-diff.ts +24 -0
- package/template/src/tools/review-post.ts +26 -0
- package/template/src/tools/review-purchase.ts +31 -0
- package/template/src/tools/show-albums.ts +22 -0
- package/template/src/tools/show-carousel.ts +25 -0
- package/template/src/tools/show-map.ts +29 -0
- package/template/tests/e2e/albums.spec.ts +6 -6
- package/template/tests/e2e/carousel.spec.ts +6 -6
- package/template/tests/e2e/map.spec.ts +11 -11
- package/template/tests/simulations/{review/review-diff-simulation.json → review-diff.json} +1 -31
- package/template/tests/simulations/{review/review-post-simulation.json → review-post.json} +1 -37
- package/template/tests/simulations/{review/review-purchase-simulation.json → review-purchase.json} +1 -38
- package/template/tests/simulations/{albums/albums-show-simulation.json → show-albums.json} +1 -24
- package/template/tests/simulations/{carousel/carousel-show-simulation.json → show-carousel.json} +1 -24
- package/template/tests/simulations/{map/map-show-simulation.json → show-map.json} +1 -35
- package/dist/discovery-CRR3SlyI.cjs +0 -156
- package/dist/discovery-CRR3SlyI.cjs.map +0 -1
- package/dist/discovery-DzV3HLXs.js +0 -157
- package/dist/discovery-DzV3HLXs.js.map +0 -1
- package/dist/index-B0dxRJvS.cjs.map +0 -1
- package/dist/index-CutQgPzR.js.map +0 -1
package/dist/mcp/types.d.ts
CHANGED
|
@@ -1,4 +1,27 @@
|
|
|
1
|
-
import { Resource, Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
1
|
+
import { Resource, Tool, ServerRequest, ServerNotification } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import { RequestHandlerExtra } from '@modelcontextprotocol/sdk/shared/protocol.js';
|
|
3
|
+
import { ToolConfig } from '@modelcontextprotocol/ext-apps/server';
|
|
4
|
+
export type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
|
|
5
|
+
export type { AuthInfo } from '@modelcontextprotocol/sdk/server/auth/types.js';
|
|
6
|
+
/**
|
|
7
|
+
* Extra context passed to tool handlers as the second argument.
|
|
8
|
+
*
|
|
9
|
+
* This is a pre-applied alias for the MCP SDK's `RequestHandlerExtra` —
|
|
10
|
+
* no custom fields, just ergonomic generics so users don't need to parameterize it.
|
|
11
|
+
*
|
|
12
|
+
* Key fields: `authInfo`, `sessionId`, `signal`, `_meta`.
|
|
13
|
+
*/
|
|
14
|
+
export type ToolHandlerExtra = RequestHandlerExtra<ServerRequest, ServerNotification>;
|
|
15
|
+
/**
|
|
16
|
+
* Configuration for a Sunpeak tool file's `tool` export.
|
|
17
|
+
*
|
|
18
|
+
* Extends the ext-apps `ToolConfig` with a `resource` field that links
|
|
19
|
+
* the tool to a resource by its unique name string.
|
|
20
|
+
*/
|
|
21
|
+
export interface AppToolConfig extends ToolConfig {
|
|
22
|
+
/** The resource name (must match a directory in `src/resources/`, e.g. `'albums'`). */
|
|
23
|
+
resource: string;
|
|
24
|
+
}
|
|
2
25
|
/**
|
|
3
26
|
* Simulation configuration for MCP server.
|
|
4
27
|
* Must include distPath for the built HTML file.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const React = require("react");
|
|
4
|
-
const useApp = require("../../use-app-
|
|
4
|
+
const useApp = require("../../use-app-BuufpXTQ.cjs");
|
|
5
5
|
function getOpenAIRuntime() {
|
|
6
6
|
if (typeof window !== "undefined" && "openai" in window) {
|
|
7
7
|
return window.openai;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useCallback } from "react";
|
|
2
|
-
import { u as useApp } from "../../use-app-
|
|
2
|
+
import { u as useApp } from "../../use-app-BThbgFFT.js";
|
|
3
3
|
function getOpenAIRuntime() {
|
|
4
4
|
if (typeof window !== "undefined" && "openai" in window) {
|
|
5
5
|
return window.openai;
|
package/dist/simulator/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const simulator = require("../simulator-
|
|
3
|
+
const simulator = require("../simulator-B56j5P8W.cjs");
|
|
4
4
|
const simulatorUrl = require("../simulator-url-rgg_KYOg.cjs");
|
|
5
|
-
const discovery = require("../discovery-
|
|
5
|
+
const discovery = require("../discovery-DmB8_4QL.cjs");
|
|
6
6
|
exports.IframeResource = simulator.IframeResource;
|
|
7
7
|
exports.McpAppHost = simulator.McpAppHost;
|
|
8
8
|
exports.SCREEN_WIDTHS = simulator.SCREEN_WIDTHS;
|
|
@@ -29,11 +29,8 @@ exports.buildSimulations = discovery.buildSimulations;
|
|
|
29
29
|
exports.createResourceExports = discovery.createResourceExports;
|
|
30
30
|
exports.extractResourceKey = discovery.extractResourceKey;
|
|
31
31
|
exports.extractSimulationKey = discovery.extractSimulationKey;
|
|
32
|
-
exports.extractSimulationName = discovery.extractSimulationName;
|
|
33
32
|
exports.findResourceDirs = discovery.findResourceDirs;
|
|
34
33
|
exports.findResourceKey = discovery.findResourceKey;
|
|
35
|
-
exports.findSimulationFiles = discovery.findSimulationFiles;
|
|
36
34
|
exports.getComponentName = discovery.getComponentName;
|
|
37
|
-
exports.isSimulationFile = discovery.isSimulationFile;
|
|
38
35
|
exports.toPascalCase = discovery.toPascalCase;
|
|
39
36
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -14,5 +14,5 @@ export { SCREEN_WIDTHS } from './simulator-types';
|
|
|
14
14
|
export { createSimulatorUrl } from './simulator-url';
|
|
15
15
|
export type { SimulatorUrlParams } from './simulator-url';
|
|
16
16
|
export { SimpleSidebar, SidebarControl, SidebarCollapsibleControl, SidebarSelect, SidebarInput, SidebarCheckbox, SidebarTextarea, SidebarToggle, } from './simple-sidebar';
|
|
17
|
-
export { buildDevSimulations, buildSimulations, buildResourceMap, createResourceExports, toPascalCase, extractResourceKey, extractSimulationKey, findResourceKey, getComponentName, findResourceDirs,
|
|
17
|
+
export { buildDevSimulations, buildSimulations, buildResourceMap, createResourceExports, toPascalCase, extractResourceKey, extractSimulationKey, findResourceKey, getComponentName, findResourceDirs, } from '../lib/discovery';
|
|
18
18
|
export type { BuildSimulationsOptions, BuildDevSimulationsOptions, ResourceMetadata, ResourceDirInfo, FsOps, } from '../lib/discovery';
|
package/dist/simulator/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { I, M, a, b, c, d, e, f, g, h, i, S, T, j, k, l, r, u, m } from "../simulator-
|
|
1
|
+
import { I, M, a, b, c, d, e, f, g, h, i, S, T, j, k, l, r, u, m } from "../simulator-C0H_k092.js";
|
|
2
2
|
import { c as c2 } from "../simulator-url-CuLqtnSS.js";
|
|
3
|
-
import { b as b2, a as a2, c as c3, d as d2, e as e2, f as f2, g as g2, h as h2, i as i2,
|
|
3
|
+
import { b as b2, a as a2, c as c3, d as d2, e as e2, f as f2, g as g2, h as h2, i as i2, t } from "../discovery-CH80W5l9.js";
|
|
4
4
|
export {
|
|
5
5
|
I as IframeResource,
|
|
6
6
|
M as McpAppHost,
|
|
@@ -23,14 +23,11 @@ export {
|
|
|
23
23
|
j as extractResourceCSP,
|
|
24
24
|
e2 as extractResourceKey,
|
|
25
25
|
f2 as extractSimulationKey,
|
|
26
|
-
g2 as
|
|
27
|
-
h2 as
|
|
28
|
-
i2 as
|
|
29
|
-
j2 as findSimulationFiles,
|
|
30
|
-
k2 as getComponentName,
|
|
26
|
+
g2 as findResourceDirs,
|
|
27
|
+
h2 as findResourceKey,
|
|
28
|
+
i2 as getComponentName,
|
|
31
29
|
k as getHostShell,
|
|
32
30
|
l as getRegisteredHosts,
|
|
33
|
-
l2 as isSimulationFile,
|
|
34
31
|
r as registerHostShell,
|
|
35
32
|
t as toPascalCase,
|
|
36
33
|
u as useSimulatorState,
|
|
@@ -10,7 +10,7 @@ import { Theme, DisplayMode, DeviceType } from '../types/runtime';
|
|
|
10
10
|
*
|
|
11
11
|
* // In e2e tests:
|
|
12
12
|
* await page.goto(createSimulatorUrl({
|
|
13
|
-
* simulation: 'albums
|
|
13
|
+
* simulation: 'show-albums',
|
|
14
14
|
* theme: 'dark',
|
|
15
15
|
* displayMode: 'fullscreen',
|
|
16
16
|
* host: 'claude',
|
|
@@ -19,8 +19,8 @@ import { Theme, DisplayMode, DeviceType } from '../types/runtime';
|
|
|
19
19
|
*/
|
|
20
20
|
export interface SimulatorUrlParams {
|
|
21
21
|
/**
|
|
22
|
-
* The simulation name to load (e.g., 'albums
|
|
23
|
-
* Corresponds to the simulation JSON filename without the
|
|
22
|
+
* The simulation name to load (e.g., 'show-albums', 'review-diff').
|
|
23
|
+
* Corresponds to the simulation JSON filename without the `.json` extension.
|
|
24
24
|
*/
|
|
25
25
|
simulation?: string;
|
|
26
26
|
/**
|
|
@@ -96,8 +96,8 @@ export interface SimulatorUrlParams {
|
|
|
96
96
|
* @example
|
|
97
97
|
* ```ts
|
|
98
98
|
* // Basic usage
|
|
99
|
-
* createSimulatorUrl({ simulation: 'albums
|
|
100
|
-
* // Returns: '/?simulation=albums
|
|
99
|
+
* createSimulatorUrl({ simulation: 'show-albums', theme: 'light' })
|
|
100
|
+
* // Returns: '/?simulation=show-albums&theme=light'
|
|
101
101
|
*
|
|
102
102
|
* // With display mode
|
|
103
103
|
* createSimulatorUrl({
|
|
@@ -109,20 +109,20 @@ export interface SimulatorUrlParams {
|
|
|
109
109
|
*
|
|
110
110
|
* // With device simulation
|
|
111
111
|
* createSimulatorUrl({
|
|
112
|
-
* simulation: 'map
|
|
112
|
+
* simulation: 'show-map',
|
|
113
113
|
* deviceType: 'mobile',
|
|
114
114
|
* touch: true,
|
|
115
115
|
* hover: false,
|
|
116
116
|
* })
|
|
117
|
-
* // Returns: '/?simulation=map
|
|
117
|
+
* // Returns: '/?simulation=show-map&deviceType=mobile&touch=true&hover=false'
|
|
118
118
|
*
|
|
119
119
|
* // With safe area insets (for notch simulation)
|
|
120
120
|
* createSimulatorUrl({
|
|
121
|
-
* simulation: 'carousel
|
|
121
|
+
* simulation: 'show-carousel',
|
|
122
122
|
* safeAreaTop: 44,
|
|
123
123
|
* safeAreaBottom: 34,
|
|
124
124
|
* })
|
|
125
|
-
* // Returns: '/?simulation=carousel
|
|
125
|
+
* // Returns: '/?simulation=show-carousel&safeAreaTop=44&safeAreaBottom=34'
|
|
126
126
|
* ```
|
|
127
127
|
*/
|
|
128
128
|
export declare function createSimulatorUrl(params: SimulatorUrlParams, basePath?: string): string;
|
|
@@ -7771,7 +7771,13 @@ function useSimulatorState({
|
|
|
7771
7771
|
simulations,
|
|
7772
7772
|
defaultHost = "chatgpt"
|
|
7773
7773
|
}) {
|
|
7774
|
-
const simulationNames = Object.keys(simulations)
|
|
7774
|
+
const simulationNames = Object.keys(simulations).sort((a2, b) => {
|
|
7775
|
+
const simA = simulations[a2];
|
|
7776
|
+
const simB = simulations[b];
|
|
7777
|
+
const labelA = `${simA.resource.title || simA.resource.name}: ${simA.tool.title || simA.tool.name}`;
|
|
7778
|
+
const labelB = `${simB.resource.title || simB.resource.name}: ${simB.tool.title || simB.tool.name}`;
|
|
7779
|
+
return labelA.localeCompare(labelB);
|
|
7780
|
+
});
|
|
7775
7781
|
const urlParams = React.useMemo(() => parseUrlParams(), []);
|
|
7776
7782
|
const [screenWidth, setScreenWidth] = React.useState("full");
|
|
7777
7783
|
const isMobileWidth = (width) => width === "mobile-s" || width === "mobile-l";
|
|
@@ -8776,4 +8782,4 @@ exports.getRegisteredHosts = getRegisteredHosts;
|
|
|
8776
8782
|
exports.registerHostShell = registerHostShell;
|
|
8777
8783
|
exports.useSimulatorState = useSimulatorState;
|
|
8778
8784
|
exports.useThemeContext = useThemeContext;
|
|
8779
|
-
//# sourceMappingURL=simulator-
|
|
8785
|
+
//# sourceMappingURL=simulator-B56j5P8W.cjs.map
|