sunpeak 0.16.29 → 0.17.2
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 +8 -0
- 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-DIVvI69i.cjs → simulator-CH9hs0N6.cjs} +129 -21
- package/dist/simulator-CH9hs0N6.cjs.map +1 -0
- package/dist/{simulator-C7mkK7Sz.js → simulator-Dl8B-Ljb.js} +124 -22
- 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 +8 -0
- package/package.json +11 -3
- 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/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-C7mkK7Sz.js.map +0 -1
- package/dist/simulator-DIVvI69i.cjs.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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_chunk = require("../chunk-9hOWP6kD.cjs");
|
|
3
|
-
const require_discovery = require("../discovery-
|
|
3
|
+
const require_discovery = require("../discovery-Clu4uHp1.cjs");
|
|
4
4
|
let path = require("path");
|
|
5
5
|
path = require_chunk.__toESM(path);
|
|
6
6
|
//#region src/lib/extract-resource.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as findSimulationFilesFlat, c as toPascalCase, i as findResourceKey, n as extractSimulationKey, o as findToolFiles, r as findResourceDirs, s as getComponentName, t as extractResourceKey } from "../discovery-Cgoegt62.js";
|
|
2
2
|
import path from "path";
|
|
3
3
|
//#region src/lib/extract-resource.ts
|
|
4
4
|
/**
|
package/dist/lib/discovery.d.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Discovery utilities for resources, tools, and simulations.
|
|
3
|
+
*
|
|
4
|
+
* String helpers (toPascalCase, extractResourceKey, etc.) are used by both
|
|
5
|
+
* browser and Node.js code. Node.js utilities (findResourceDirs, findToolFiles,
|
|
6
|
+
* etc.) are used by CLI commands for build-time and runtime discovery.
|
|
7
|
+
*/
|
|
2
8
|
/**
|
|
3
9
|
* Convert a kebab-case string to PascalCase
|
|
4
10
|
* @example toPascalCase('review') // 'Review'
|
|
@@ -28,71 +34,6 @@ export declare function findResourceKey(simulationKey: string, resourceKeys: str
|
|
|
28
34
|
* @example getComponentName('album-art') // 'AlbumArtResource'
|
|
29
35
|
*/
|
|
30
36
|
export declare function getComponentName(resourceKey: string): string;
|
|
31
|
-
type GlobModules = Record<string, unknown>;
|
|
32
|
-
/**
|
|
33
|
-
* Process resource component modules from import.meta.glob() result.
|
|
34
|
-
* Extracts components and exports them with PascalCase names.
|
|
35
|
-
*
|
|
36
|
-
* @example
|
|
37
|
-
* const modules = import.meta.glob('./*\/*.tsx', { eager: true });
|
|
38
|
-
* export default createResourceExports(modules);
|
|
39
|
-
*/
|
|
40
|
-
export declare function createResourceExports(modules: GlobModules): Record<string, React.ComponentType>;
|
|
41
|
-
/**
|
|
42
|
-
* Build a resource metadata map from import.meta.glob() result.
|
|
43
|
-
* Used for connecting simulations to their resource definitions.
|
|
44
|
-
*
|
|
45
|
-
* @example
|
|
46
|
-
* const modules = import.meta.glob('../src/resources/*\/*.tsx', { eager: true });
|
|
47
|
-
* const resourcesMap = buildResourceMap(modules);
|
|
48
|
-
*/
|
|
49
|
-
export declare function buildResourceMap<T>(modules: GlobModules): Map<string, T>;
|
|
50
|
-
/**
|
|
51
|
-
* Options for building simulations from discovered modules
|
|
52
|
-
*/
|
|
53
|
-
export interface BuildSimulationsOptions<TResource, TSimulation> {
|
|
54
|
-
/** Glob result of simulation JSON files */
|
|
55
|
-
simulationModules: GlobModules;
|
|
56
|
-
/** Map of resource key -> resource metadata */
|
|
57
|
-
resourcesMap: Map<string, TResource>;
|
|
58
|
-
/** Map of component name -> React component */
|
|
59
|
-
resourceComponents: Record<string, React.ComponentType>;
|
|
60
|
-
/** Create the final simulation object */
|
|
61
|
-
createSimulation: (simulationKey: string, simulationData: unknown, resource: TResource, resourceComponent: React.ComponentType) => TSimulation;
|
|
62
|
-
/** Optional warning handler for missing resources */
|
|
63
|
-
onMissingResource?: (simulationKey: string, expectedPrefix: string) => void;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Build simulations by connecting simulation data with resources and components.
|
|
67
|
-
* This is the main orchestration function for dev server bootstrap.
|
|
68
|
-
*/
|
|
69
|
-
export declare function buildSimulations<TResource, TSimulation>(options: BuildSimulationsOptions<TResource, TSimulation>): Record<string, TSimulation>;
|
|
70
|
-
/**
|
|
71
|
-
* Resource metadata from resource .tsx files
|
|
72
|
-
*/
|
|
73
|
-
export interface ResourceMetadata {
|
|
74
|
-
name: string;
|
|
75
|
-
[key: string]: unknown;
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Options for building dev simulations
|
|
79
|
-
*/
|
|
80
|
-
export interface BuildDevSimulationsOptions {
|
|
81
|
-
/** Glob result of simulation JSON files */
|
|
82
|
-
simulationModules: GlobModules;
|
|
83
|
-
/** Resource components map from src/resources/index.ts */
|
|
84
|
-
resourceComponents: Record<string, React.ComponentType>;
|
|
85
|
-
/** Glob result of tool files: import.meta.glob('src/tools/*.ts', { eager: true }) */
|
|
86
|
-
toolModules: GlobModules;
|
|
87
|
-
/** Glob result of resource .tsx files from src/resources/ */
|
|
88
|
-
resourceModules: GlobModules;
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Build simulations for the dev server from glob results.
|
|
92
|
-
* Simulation JSON has `"tool": "tool-name"` string referencing a tool file.
|
|
93
|
-
* Tool files have `resource: 'name'` linking to a resource discovered from resourceModules.
|
|
94
|
-
*/
|
|
95
|
-
export declare function buildDevSimulations(options: BuildDevSimulationsOptions): Record<string, Simulation>;
|
|
96
37
|
/**
|
|
97
38
|
* Information about a discovered resource directory
|
|
98
39
|
*/
|
|
@@ -169,4 +110,3 @@ export interface SimulationFileInfo {
|
|
|
169
110
|
* // [{ name: 'show-albums', path: 'tests/simulations/show-albums.json' }]
|
|
170
111
|
*/
|
|
171
112
|
export declare function findSimulationFilesFlat(simulationsDir: string, fs: Pick<FsOps, 'readdirSync' | 'existsSync'>): SimulationFileInfo[];
|
|
172
|
-
export {};
|
package/dist/lib/index.d.ts
CHANGED
package/dist/mcp/index.cjs
CHANGED
|
@@ -9183,14 +9183,16 @@ function createAppServer(config, simulations, viteMode) {
|
|
|
9183
9183
|
};
|
|
9184
9184
|
const toolHandle = uZ(mcpServer, tool.name, {
|
|
9185
9185
|
description: tool.description,
|
|
9186
|
+
inputSchema: zod.z.object({}).passthrough(),
|
|
9186
9187
|
...simulation.outputSchema ? { outputSchema: simulation.outputSchema } : {},
|
|
9188
|
+
annotations: tool.annotations,
|
|
9187
9189
|
_meta: fullToolMeta
|
|
9188
|
-
}, async (extra) => {
|
|
9189
|
-
const args = extra.request?.params?.arguments ?? {};
|
|
9190
|
+
}, async (args, extra) => {
|
|
9190
9191
|
const argKeys = Object.keys(args);
|
|
9191
9192
|
const argsStr = argKeys.length > 0 ? `{${argKeys.join(", ")}}` : "{}";
|
|
9193
|
+
const hasMockResult = toolResult?.structuredContent != null;
|
|
9192
9194
|
const realHandler = simulation.handler;
|
|
9193
|
-
if (realHandler) {
|
|
9195
|
+
if (realHandler && !hasMockResult) {
|
|
9194
9196
|
console.log(`[MCP] CallTool: ${tool.name}${argsStr} → live handler`);
|
|
9195
9197
|
try {
|
|
9196
9198
|
const result = await realHandler(args, extra);
|
|
@@ -9211,8 +9213,7 @@ function createAppServer(config, simulations, viteMode) {
|
|
|
9211
9213
|
};
|
|
9212
9214
|
}
|
|
9213
9215
|
}
|
|
9214
|
-
|
|
9215
|
-
console.log(`[MCP] CallTool: ${tool.name}${argsStr} → ${hasStructuredContent ? "structured" : "text"}`);
|
|
9216
|
+
console.log(`[MCP] CallTool: ${tool.name}${argsStr} → ${hasMockResult ? "structured" : "text"}`);
|
|
9216
9217
|
return {
|
|
9217
9218
|
content: [{
|
|
9218
9219
|
type: "text",
|
|
@@ -9450,15 +9451,20 @@ function runMCPServer(config) {
|
|
|
9450
9451
|
viteServer.ws.handleUpgrade(request, socket, head);
|
|
9451
9452
|
});
|
|
9452
9453
|
httpServer.on("clientError", (err, socket) => {
|
|
9453
|
-
console.error("HTTP client error", err);
|
|
9454
|
+
if (err.code !== "ECONNRESET") console.error("HTTP client error", err);
|
|
9454
9455
|
socket.end("HTTP/1.1 400 Bad Request\r\n\r\n");
|
|
9455
9456
|
});
|
|
9457
|
+
let resolveReady;
|
|
9458
|
+
const ready = new Promise((resolve) => {
|
|
9459
|
+
resolveReady = resolve;
|
|
9460
|
+
});
|
|
9456
9461
|
const onListening = () => {
|
|
9457
9462
|
const actualPort = httpServer.address().port;
|
|
9458
9463
|
localDevServerUrl = `http://localhost:${actualPort}`;
|
|
9459
9464
|
console.log(`Sunpeak MCP server listening on http://localhost:${actualPort}`);
|
|
9460
9465
|
console.log(` MCP endpoint: http://localhost:${actualPort}${MCP_PATH$1}`);
|
|
9461
9466
|
if (viteMode) console.log(` Vite HMR: enabled (source files served with hot reload)`);
|
|
9467
|
+
resolveReady();
|
|
9462
9468
|
};
|
|
9463
9469
|
httpServer.on("error", (err) => {
|
|
9464
9470
|
if (err.code === "EADDRINUSE") {
|
|
@@ -9480,25 +9486,30 @@ function runMCPServer(config) {
|
|
|
9480
9486
|
};
|
|
9481
9487
|
process.on("SIGTERM", () => void shutdown());
|
|
9482
9488
|
process.on("SIGINT", () => void shutdown());
|
|
9483
|
-
return {
|
|
9484
|
-
|
|
9485
|
-
|
|
9486
|
-
|
|
9487
|
-
|
|
9488
|
-
|
|
9489
|
-
|
|
9490
|
-
|
|
9491
|
-
|
|
9492
|
-
|
|
9493
|
-
|
|
9494
|
-
|
|
9495
|
-
|
|
9496
|
-
|
|
9497
|
-
|
|
9489
|
+
return {
|
|
9490
|
+
ready,
|
|
9491
|
+
invalidateResources() {
|
|
9492
|
+
if (sessions.size === 0) return;
|
|
9493
|
+
const tunnelSessions = [...sessions].filter(([, s]) => !s.isLocal);
|
|
9494
|
+
if (tunnelSessions.length === 0) return;
|
|
9495
|
+
const timestamp = Date.now().toString(36);
|
|
9496
|
+
for (const [, session] of tunnelSessions) {
|
|
9497
|
+
for (const [name, handle] of session.resourceHandles) handle.update({ uri: `ui://${name}-${timestamp}` });
|
|
9498
|
+
for (const { handle, resourceName, toolMeta } of session.toolHandles) {
|
|
9499
|
+
const newUri = `ui://${resourceName}-${timestamp}`;
|
|
9500
|
+
handle.update({ _meta: {
|
|
9501
|
+
...toolMeta,
|
|
9502
|
+
ui: {
|
|
9503
|
+
...toolMeta.ui,
|
|
9504
|
+
resourceUri: newUri
|
|
9505
|
+
},
|
|
9506
|
+
"ui/resourceUri": newUri
|
|
9507
|
+
} });
|
|
9508
|
+
}
|
|
9498
9509
|
}
|
|
9510
|
+
console.log(`[MCP] Cache-busted ${tunnelSessions.length} tunnel session(s) with timestamp ${timestamp}`);
|
|
9499
9511
|
}
|
|
9500
|
-
|
|
9501
|
-
} };
|
|
9512
|
+
};
|
|
9502
9513
|
}
|
|
9503
9514
|
//#endregion
|
|
9504
9515
|
//#region src/mcp/production-server.ts
|