sunpeak 0.20.5 → 0.20.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.
- package/bin/commands/dev.mjs +23 -4
- package/bin/commands/inspect.mjs +14 -2
- package/bin/commands/test.mjs +4 -3
- package/bin/lib/eval/eval-runner.mjs +27 -1
- package/bin/lib/eval/model-registry.mjs +6 -1
- package/bin/lib/test/base-config.mjs +11 -4
- package/dist/mcp/index.cjs +23 -2
- package/dist/mcp/index.cjs.map +1 -1
- package/dist/mcp/index.js +23 -2
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/types.d.ts +1 -0
- package/package.json +1 -1
- package/template/dist/albums/albums.json +1 -1
- package/template/dist/carousel/carousel.json +1 -1
- package/template/dist/map/map.json +1 -1
- package/template/dist/review/review.json +1 -1
- package/template/tests/evals/albums.eval.ts +1 -1
- package/template/tests/evals/map.eval.ts +1 -1
- package/template/tests/evals/review.eval.ts +4 -2
package/dist/mcp/index.js
CHANGED
|
@@ -9273,6 +9273,26 @@ function injectViteCSP(existingMeta) {
|
|
|
9273
9273
|
};
|
|
9274
9274
|
}
|
|
9275
9275
|
var startupTimestamp = Date.now().toString(36);
|
|
9276
|
+
/**
|
|
9277
|
+
* Make all properties in a Zod raw shape optional.
|
|
9278
|
+
*
|
|
9279
|
+
* Tool schemas from `src/tools/*.ts` have required fields by default (e.g.
|
|
9280
|
+
* `z.string()`). The dev server needs to accept partial args because:
|
|
9281
|
+
* - Mock mode returns fixture data regardless of args
|
|
9282
|
+
* - Models may not send every required field
|
|
9283
|
+
* - The inspector's "Re-run" button sends args from the last run
|
|
9284
|
+
*
|
|
9285
|
+
* Making fields optional preserves property types/descriptions in `tools/list`
|
|
9286
|
+
* (so models know what args to send) while letting the SDK accept any subset.
|
|
9287
|
+
*/
|
|
9288
|
+
function makeSchemaOptional(shape) {
|
|
9289
|
+
const optional = {};
|
|
9290
|
+
for (const [key, value] of Object.entries(shape)) {
|
|
9291
|
+
const v = value;
|
|
9292
|
+
optional[key] = typeof v.optional === "function" ? v.optional() : value;
|
|
9293
|
+
}
|
|
9294
|
+
return optional;
|
|
9295
|
+
}
|
|
9276
9296
|
function createAppServer(config, simulations, viteMode) {
|
|
9277
9297
|
const { name = "sunpeak-app", version = "0.1.0", serverInfo } = config;
|
|
9278
9298
|
const mcpServer = new McpServer({
|
|
@@ -9346,6 +9366,7 @@ function createAppServer(config, simulations, viteMode) {
|
|
|
9346
9366
|
});
|
|
9347
9367
|
resourceHandles.set(resourceName, handle);
|
|
9348
9368
|
}
|
|
9369
|
+
const toolInputSchema = simulation.inputSchema ? makeSchemaOptional(simulation.inputSchema) : z.object({}).passthrough();
|
|
9349
9370
|
const fullToolMeta = {
|
|
9350
9371
|
...toolMeta,
|
|
9351
9372
|
ui: {
|
|
@@ -9355,7 +9376,7 @@ function createAppServer(config, simulations, viteMode) {
|
|
|
9355
9376
|
};
|
|
9356
9377
|
const toolHandle = hZ(mcpServer, tool.name, {
|
|
9357
9378
|
description: tool.description,
|
|
9358
|
-
inputSchema:
|
|
9379
|
+
inputSchema: toolInputSchema,
|
|
9359
9380
|
...simulation.outputSchema ? { outputSchema: simulation.outputSchema } : {},
|
|
9360
9381
|
annotations: tool.annotations,
|
|
9361
9382
|
_meta: fullToolMeta
|
|
@@ -9420,7 +9441,7 @@ function createAppServer(config, simulations, viteMode) {
|
|
|
9420
9441
|
const realHandler = simulation.handler;
|
|
9421
9442
|
const plainToolConfig = {
|
|
9422
9443
|
description: tool.description,
|
|
9423
|
-
inputSchema: z.object({}).passthrough(),
|
|
9444
|
+
inputSchema: simulation.inputSchema ? makeSchemaOptional(simulation.inputSchema) : z.object({}).passthrough(),
|
|
9424
9445
|
...simulation.outputSchema ? { outputSchema: simulation.outputSchema } : {},
|
|
9425
9446
|
annotations: tool.annotations,
|
|
9426
9447
|
_meta: toolMeta
|