sunpeak 0.18.7 → 0.18.12

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 (76) hide show
  1. package/README.md +12 -0
  2. package/bin/commands/dev.mjs +3 -3
  3. package/bin/commands/inspect.mjs +4 -1
  4. package/bin/lib/sandbox-server.mjs +31 -1
  5. package/dist/chatgpt/index.cjs +1 -2
  6. package/dist/chatgpt/index.js +1 -2
  7. package/dist/claude/index.cjs +1 -2
  8. package/dist/claude/index.js +1 -2
  9. package/dist/host/chatgpt/index.cjs +1 -2
  10. package/dist/host/chatgpt/index.cjs.map +1 -1
  11. package/dist/host/chatgpt/index.js +1 -2
  12. package/dist/host/chatgpt/index.js.map +1 -1
  13. package/dist/index.cjs +93 -93
  14. package/dist/index.cjs.map +1 -1
  15. package/dist/index.js +54 -54
  16. package/dist/index.js.map +1 -1
  17. package/dist/inspector/hosts.d.ts +12 -0
  18. package/dist/inspector/index.cjs +1 -2
  19. package/dist/inspector/index.js +1 -2
  20. package/dist/{inspector-CKc58UuI.cjs → inspector-8nPV2A-z.cjs} +104 -54
  21. package/dist/inspector-8nPV2A-z.cjs.map +1 -0
  22. package/dist/{inspector-DZrN0kej.js → inspector-Cdo5BK2D.js} +103 -53
  23. package/dist/inspector-Cdo5BK2D.js.map +1 -0
  24. package/dist/mcp/index.cjs +85 -71
  25. package/dist/mcp/index.cjs.map +1 -1
  26. package/dist/mcp/index.js +79 -65
  27. package/dist/mcp/index.js.map +1 -1
  28. package/dist/{protocol-DJmRaBzO.js → protocol-BfAACnv0.js} +14 -9
  29. package/dist/{protocol-DJmRaBzO.js.map → protocol-BfAACnv0.js.map} +1 -1
  30. package/dist/{protocol-jbxhzcnS.cjs → protocol-C7kTcBr_.cjs} +14 -9
  31. package/dist/{protocol-jbxhzcnS.cjs.map → protocol-C7kTcBr_.cjs.map} +1 -1
  32. package/dist/style.css +36 -1
  33. package/dist/{use-app-BNbz1uzj.js → use-app-CfP9VypY.js} +107 -56
  34. package/dist/use-app-CfP9VypY.js.map +1 -0
  35. package/dist/{use-app-Dqh20JPP.cjs → use-app-CzcYw1Kz.cjs} +165 -114
  36. package/dist/use-app-CzcYw1Kz.cjs.map +1 -0
  37. package/package.json +7 -7
  38. package/template/README.md +12 -0
  39. package/template/dist/albums/albums.html +16 -15
  40. package/template/dist/albums/albums.json +1 -1
  41. package/template/dist/carousel/carousel.html +20 -19
  42. package/template/dist/carousel/carousel.json +1 -1
  43. package/template/dist/map/map.html +7 -6
  44. package/template/dist/map/map.json +1 -1
  45. package/template/dist/review/review.html +6 -5
  46. package/template/dist/review/review.json +1 -1
  47. package/template/node_modules/.bin/vite +2 -2
  48. package/template/node_modules/.bin/vitest +2 -2
  49. package/template/node_modules/.vite/deps/_metadata.json +4 -4
  50. package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps.js +49 -49
  51. package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps.js.map +1 -1
  52. package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps_app-bridge.js +49 -49
  53. package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps_app-bridge.js.map +1 -1
  54. package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps_react.js +89 -89
  55. package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps_react.js.map +1 -1
  56. package/template/node_modules/.vite-mcp/deps/@testing-library_react.js +9 -6
  57. package/template/node_modules/.vite-mcp/deps/@testing-library_react.js.map +1 -1
  58. package/template/node_modules/.vite-mcp/deps/_metadata.json +26 -26
  59. package/template/node_modules/.vite-mcp/deps/{protocol-CTflwIfG.js → protocol-B_qKkui_.js} +14 -9
  60. package/template/node_modules/.vite-mcp/deps/protocol-B_qKkui_.js.map +1 -0
  61. package/template/node_modules/.vite-mcp/deps/vitest.js +366 -128
  62. package/template/node_modules/.vite-mcp/deps/vitest.js.map +1 -1
  63. package/template/package.json +2 -2
  64. package/template/src/resources/carousel/carousel.test.tsx +16 -2
  65. package/template/src/resources/carousel/carousel.tsx +42 -14
  66. package/template/src/resources/carousel/components/carousel.tsx +20 -0
  67. package/template/src/resources/carousel/components/index.ts +1 -0
  68. package/template/src/resources/carousel/components/place-detail.tsx +153 -0
  69. package/template/tests/e2e/carousel.spec.ts +125 -0
  70. package/template/tests/live/carousel.spec.ts +2 -2
  71. package/template/tests/simulations/show-carousel.json +54 -5
  72. package/dist/inspector-CKc58UuI.cjs.map +0 -1
  73. package/dist/inspector-DZrN0kej.js.map +0 -1
  74. package/dist/use-app-BNbz1uzj.js.map +0 -1
  75. package/dist/use-app-Dqh20JPP.cjs.map +0 -1
  76. package/template/node_modules/.vite-mcp/deps/protocol-CTflwIfG.js.map +0 -1
package/dist/mcp/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { a as __toESM, i as __toCommonJS, n as __esmMin, r as __exportAll, t as __commonJSMin } from "../chunk-D6g4UhsZ.js";
2
- import { $ as literal, A as LoggingLevelSchema, B as SUPPORTED_PROTOCOL_VERSIONS, E as ListResourcesRequestSchema, F as ReadResourceRequestSchema, G as assertCompleteRequestResourceTemplate, J as isJSONRPCRequest, K as isInitializeRequest, L as RequestIdSchema, M as McpError, O as ListRootsResultSchema, Q as boolean, R as ResourceLinkSchema, S as ListPromptsRequestSchema, U as ToolSchema, V as SetLevelRequestSchema, W as assertCompleteRequestPrompt, X as _undefined, Y as isJSONRPCResultResponse, Z as array, _ as ImplementationSchema, a as CallToolResultSchema, at as unknown, b as JSONRPCMessageSchema, c as CreateMessageResultSchema, ct as getParseErrorMessage, dt as isZ4Schema, et as number, f as ElicitResultSchema, ft as normalizeObjectSchema, g as GetPromptRequestSchema, h as ErrorCode, ht as safeParseAsync, i as CallToolRequestSchema, it as union, k as ListToolsRequestSchema, l as CreateMessageResultWithToolsSchema, lt as getSchemaDescription, m as EmptyResultSchema, mt as safeParse, n as mergeCapabilities, nt as record, o as CompleteRequestSchema, ot as getLiteralValue, p as EmbeddedResourceSchema, pt as objectFromShape, q as isJSONRPCErrorResponse, r as toJsonSchemaCompat, rt as string, s as ContentBlockSchema, st as getObjectShape, t as Protocol, tt as object, u as CreateTaskResultSchema, ut as isSchemaOptional, v as InitializeRequestSchema, w as ListResourceTemplatesRequestSchema, x as LATEST_PROTOCOL_VERSION, y as InitializedNotificationSchema } from "../protocol-DJmRaBzO.js";
2
+ import { $ as literal, A as LoggingLevelSchema, B as SUPPORTED_PROTOCOL_VERSIONS, E as ListResourcesRequestSchema, F as ReadResourceRequestSchema, G as assertCompleteRequestResourceTemplate, J as isJSONRPCRequest, K as isInitializeRequest, L as RequestIdSchema, M as McpError, O as ListRootsResultSchema, Q as boolean, R as ResourceLinkSchema, S as ListPromptsRequestSchema, U as ToolSchema, V as SetLevelRequestSchema, W as assertCompleteRequestPrompt, X as _undefined, Y as isJSONRPCResultResponse, Z as array, _ as ImplementationSchema, a as CallToolResultSchema, at as unknown, b as JSONRPCMessageSchema, c as CreateMessageResultSchema, ct as getParseErrorMessage, dt as isZ4Schema, et as number, f as ElicitResultSchema, ft as normalizeObjectSchema, g as GetPromptRequestSchema, h as ErrorCode, ht as safeParseAsync, i as CallToolRequestSchema, it as union, k as ListToolsRequestSchema, l as CreateMessageResultWithToolsSchema, lt as getSchemaDescription, m as EmptyResultSchema, mt as safeParse, n as mergeCapabilities, nt as record, o as CompleteRequestSchema, ot as getLiteralValue, p as EmbeddedResourceSchema, pt as objectFromShape, q as isJSONRPCErrorResponse, r as toJsonSchemaCompat, rt as string, s as ContentBlockSchema, st as getObjectShape, t as Protocol, tt as object, u as CreateTaskResultSchema, ut as isSchemaOptional, v as InitializeRequestSchema, w as ListResourceTemplatesRequestSchema, x as LATEST_PROTOCOL_VERSION, y as InitializedNotificationSchema } from "../protocol-BfAACnv0.js";
3
3
  import { createServer } from "node:http";
4
4
  import { URL as URL$1 } from "node:url";
5
5
  import fs from "node:fs";
@@ -6119,7 +6119,7 @@ var require_dist = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6119
6119
  exports.default = formatsPlugin;
6120
6120
  }));
6121
6121
  //#endregion
6122
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
6122
+ //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
6123
6123
  var import_ajv = /* @__PURE__ */ __toESM(require_ajv(), 1);
6124
6124
  var import_dist = /* @__PURE__ */ __toESM(require_dist(), 1);
6125
6125
  function createDefaultAjvInstance() {
@@ -6195,7 +6195,7 @@ var AjvJsonSchemaValidator = class {
6195
6195
  }
6196
6196
  };
6197
6197
  //#endregion
6198
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js
6198
+ //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js
6199
6199
  /**
6200
6200
  * Experimental server task features for MCP SDK.
6201
6201
  * WARNING: These APIs are experimental and may change without notice.
@@ -6415,7 +6415,7 @@ var ExperimentalServerTasks = class {
6415
6415
  }
6416
6416
  };
6417
6417
  //#endregion
6418
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js
6418
+ //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js
6419
6419
  /**
6420
6420
  * Experimental task capability assertion helpers.
6421
6421
  * WARNING: These APIs are experimental and may change without notice.
@@ -6466,7 +6466,7 @@ function assertClientRequestTaskCapability(requests, method, entityName) {
6466
6466
  }
6467
6467
  }
6468
6468
  //#endregion
6469
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js
6469
+ //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js
6470
6470
  /**
6471
6471
  * An MCP server on top of a pluggable transport.
6472
6472
  *
@@ -6807,7 +6807,7 @@ var Server = class extends Protocol {
6807
6807
  }
6808
6808
  };
6809
6809
  //#endregion
6810
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js
6810
+ //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js
6811
6811
  var COMPLETABLE_SYMBOL = Symbol.for("mcp.completable");
6812
6812
  /**
6813
6813
  * Checks if a schema is completable (has completion metadata).
@@ -6826,7 +6826,7 @@ var McpZodTypeKind;
6826
6826
  McpZodTypeKind["Completable"] = "McpCompletable";
6827
6827
  })(McpZodTypeKind || (McpZodTypeKind = {}));
6828
6828
  //#endregion
6829
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js
6829
+ //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js
6830
6830
  /**
6831
6831
  * Tool name validation utilities according to SEP: Specify Format for Tool Names
6832
6832
  *
@@ -6897,7 +6897,7 @@ function validateAndWarnToolName(name) {
6897
6897
  return result.isValid;
6898
6898
  }
6899
6899
  //#endregion
6900
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.js
6900
+ //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.js
6901
6901
  /**
6902
6902
  * Experimental McpServer task features for MCP SDK.
6903
6903
  * WARNING: These APIs are experimental and may change without notice.
@@ -6928,7 +6928,7 @@ var ExperimentalMcpServerTasks = class {
6928
6928
  }
6929
6929
  };
6930
6930
  //#endregion
6931
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js
6931
+ //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js
6932
6932
  /**
6933
6933
  * High-level MCP server that provides a simpler API for working with resources, tools, and prompts.
6934
6934
  * For advanced usage (like sending notifications or setting custom request handlers), use the underlying
@@ -7403,7 +7403,10 @@ var McpServer = class {
7403
7403
  if (isZodRawShapeCompat(firstArg)) {
7404
7404
  inputSchema = rest.shift();
7405
7405
  if (rest.length > 1 && typeof rest[0] === "object" && rest[0] !== null && !isZodRawShapeCompat(rest[0])) annotations = rest.shift();
7406
- } else if (typeof firstArg === "object" && firstArg !== null) annotations = rest.shift();
7406
+ } else if (typeof firstArg === "object" && firstArg !== null) {
7407
+ if (Object.values(firstArg).some((v) => typeof v === "object" && v !== null)) throw new Error(`Tool ${name} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);
7408
+ annotations = rest.shift();
7409
+ }
7407
7410
  }
7408
7411
  const callback = rest[0];
7409
7412
  return this._createRegisteredTool(name, void 0, description, inputSchema, outputSchema, annotations, { taskSupport: "forbidden" }, void 0, callback);
@@ -7513,11 +7516,12 @@ function isZodRawShapeCompat(obj) {
7513
7516
  }
7514
7517
  /**
7515
7518
  * Converts a provided Zod schema to a Zod object if it is a ZodRawShapeCompat,
7516
- * otherwise returns the schema as is.
7519
+ * otherwise returns the schema as is. Throws if the value is not a valid Zod schema.
7517
7520
  */
7518
7521
  function getZodSchemaObject(schema) {
7519
7522
  if (!schema) return;
7520
7523
  if (isZodRawShapeCompat(schema)) return objectFromShape(schema);
7524
+ if (!isZodSchemaInstance(schema)) throw new Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");
7521
7525
  return schema;
7522
7526
  }
7523
7527
  function promptArgumentsFromSchema(schema) {
@@ -7973,7 +7977,7 @@ var getRequestListener = (fetchCallback, options = {}) => {
7973
7977
  };
7974
7978
  };
7975
7979
  //#endregion
7976
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/server/webStandardStreamableHttp.js
7980
+ //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/server/webStandardStreamableHttp.js
7977
7981
  /**
7978
7982
  * Web Standards Streamable HTTP Server Transport
7979
7983
  *
@@ -8530,7 +8534,7 @@ var WebStandardStreamableHTTPServerTransport = class {
8530
8534
  }
8531
8535
  };
8532
8536
  //#endregion
8533
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/server/streamableHttp.js
8537
+ //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/server/streamableHttp.js
8534
8538
  /**
8535
8539
  * Node.js HTTP Streamable HTTP Server Transport
8536
8540
  *
@@ -8676,12 +8680,12 @@ var StreamableHTTPServerTransport = class {
8676
8680
  }
8677
8681
  };
8678
8682
  //#endregion
8679
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+ext-apps@1.3.1_@modelcontextprotocol+sdk@1.27.1_zod@4.3.6__react-_cd1fb28fd87e0bddd0a29eba0721855d/node_modules/@modelcontextprotocol/ext-apps/dist/src/server/index.js
8680
- var g = union([literal("light"), literal("dark")]).describe("Color theme preference for the host environment."), G = union([
8683
+ //#region ../../node_modules/.pnpm/@modelcontextprotocol+ext-apps@1.3.2_@modelcontextprotocol+sdk@1.29.0_zod@4.3.6__react-_38e5f6c50a4ca9cf3f1dffc73a60c951/node_modules/@modelcontextprotocol/ext-apps/dist/src/server/index.js
8684
+ var M = union([literal("light"), literal("dark")]).describe("Color theme preference for the host environment."), G = union([
8681
8685
  literal("inline"),
8682
8686
  literal("fullscreen"),
8683
8687
  literal("pip")
8684
- ]).describe("Display mode for UI presentation."), o = record(union([
8688
+ ]).describe("Display mode for UI presentation."), r = record(union([
8685
8689
  literal("--color-background-primary"),
8686
8690
  literal("--color-background-secondary"),
8687
8691
  literal("--color-background-tertiary"),
@@ -8821,16 +8825,16 @@ object({
8821
8825
  method: literal("ui/notifications/tool-cancelled"),
8822
8826
  params: object({ reason: string().optional().describe("Optional reason for the cancellation (e.g., \"user action\", \"timeout\").") })
8823
8827
  });
8824
- var S = object({ fonts: string().optional() }), y = object({
8825
- variables: o.optional().describe("CSS variables for theming the app."),
8826
- css: S.optional().describe("CSS blocks that apps can inject.")
8828
+ var b = object({ fonts: string().optional() }), g = object({
8829
+ variables: r.optional().describe("CSS variables for theming the app."),
8830
+ css: b.optional().describe("CSS blocks that apps can inject.")
8827
8831
  });
8828
8832
  object({
8829
8833
  method: literal("ui/resource-teardown"),
8830
8834
  params: object({})
8831
8835
  });
8832
8836
  record(string(), unknown());
8833
- var q = object({
8837
+ var z$1 = object({
8834
8838
  text: object({}).optional().describe("Host supports text content blocks."),
8835
8839
  image: object({}).optional().describe("Host supports image content blocks."),
8836
8840
  audio: object({}).optional().describe("Host supports audio content blocks."),
@@ -8842,7 +8846,7 @@ object({
8842
8846
  method: literal("ui/notifications/request-teardown"),
8843
8847
  params: object({}).optional()
8844
8848
  });
8845
- var C = object({
8849
+ var S = object({
8846
8850
  experimental: object({}).optional().describe("Experimental features (structure TBD)."),
8847
8851
  openLinks: object({}).optional().describe("Host supports opening external URLs."),
8848
8852
  downloadFile: object({}).optional().describe("Host supports file downloads via ui/download-file."),
@@ -8853,9 +8857,9 @@ var C = object({
8853
8857
  permissions: K.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."),
8854
8858
  csp: B.optional().describe("CSP domains approved by the host.")
8855
8859
  }).optional().describe("Sandbox configuration applied by the host."),
8856
- updateModelContext: q.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."),
8857
- message: q.optional().describe("Host supports receiving content messages (ui/message) from the view.")
8858
- }), f = object({
8860
+ updateModelContext: z$1.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."),
8861
+ message: z$1.optional().describe("Host supports receiving content messages (ui/message) from the view.")
8862
+ }), y = object({
8859
8863
  experimental: object({}).optional().describe("Experimental features (structure TBD)."),
8860
8864
  tools: object({ listChanged: boolean().optional().describe("App supports tools/list_changed notifications.") }).optional().describe("App exposes MCP-style tools that the host can call."),
8861
8865
  availableDisplayModes: array(G).optional().describe("Display modes the app supports.")
@@ -8889,10 +8893,10 @@ object({
8889
8893
  params: object({ mode: G.describe("The display mode being requested.") })
8890
8894
  });
8891
8895
  object({ mode: G.describe("The display mode that was actually set. May differ from requested if not supported.") }).passthrough();
8892
- var u = union([literal("model"), literal("app")]).describe("Tool visibility scope - who can access the tool.");
8896
+ var C = union([literal("model"), literal("app")]).describe("Tool visibility scope - who can access the tool.");
8893
8897
  object({
8894
8898
  resourceUri: string().optional(),
8895
- visibility: array(u).optional().describe(`Who can access this tool. Default: ["model", "app"]
8899
+ visibility: array(C).optional().describe(`Who can access this tool. Default: ["model", "app"]
8896
8900
  - "model": Tool visible to and callable by the agent
8897
8901
  - "app": Tool callable by the app from this server only`)
8898
8902
  });
@@ -8921,13 +8925,13 @@ object({
8921
8925
  method: literal("ui/notifications/tool-result"),
8922
8926
  params: CallToolResultSchema.describe("Standard MCP tool execution result.")
8923
8927
  });
8924
- var k = object({
8928
+ var E = object({
8925
8929
  toolInfo: object({
8926
8930
  id: RequestIdSchema.optional().describe("JSON-RPC id of the tools/call request."),
8927
8931
  tool: ToolSchema.describe("Tool definition including name, inputSchema, etc.")
8928
8932
  }).optional().describe("Metadata of the tool call that instantiated this App."),
8929
- theme: g.optional().describe("Current color theme preference."),
8930
- styles: y.optional().describe("Style configuration for theming the app."),
8933
+ theme: M.optional().describe("Current color theme preference."),
8934
+ styles: g.optional().describe("Style configuration for theming the app."),
8931
8935
  displayMode: G.optional().describe("How the UI is currently displayed."),
8932
8936
  availableDisplayModes: array(G).optional().describe("Display modes the host supports."),
8933
8937
  containerDimensions: union([object({ height: number().describe("Fixed container height in pixels.") }), object({ maxHeight: union([number(), _undefined()]).optional().describe("Maximum container height in pixels.") })]).and(union([object({ width: number().describe("Fixed container width in pixels.") }), object({ maxWidth: union([number(), _undefined()]).optional().describe("Maximum container width in pixels.") })])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
@@ -8953,7 +8957,7 @@ container holding the app. Specify either width or maxWidth, and either height o
8953
8957
  }).passthrough();
8954
8958
  object({
8955
8959
  method: literal("ui/notifications/host-context-changed"),
8956
- params: k.describe("Partial context update containing only changed fields.")
8960
+ params: E.describe("Partial context update containing only changed fields.")
8957
8961
  });
8958
8962
  object({
8959
8963
  method: literal("ui/update-model-context"),
@@ -8966,45 +8970,45 @@ object({
8966
8970
  method: literal("ui/initialize"),
8967
8971
  params: object({
8968
8972
  appInfo: ImplementationSchema.describe("App identification (name and version)."),
8969
- appCapabilities: f.describe("Features and capabilities this app provides."),
8973
+ appCapabilities: y.describe("Features and capabilities this app provides."),
8970
8974
  protocolVersion: string().describe("Protocol version this app supports.")
8971
8975
  })
8972
8976
  });
8973
8977
  object({
8974
8978
  protocolVersion: string().describe("Negotiated protocol version string (e.g., \"2025-11-21\")."),
8975
8979
  hostInfo: ImplementationSchema.describe("Host application identification and version."),
8976
- hostCapabilities: C.describe("Features and capabilities provided by the host."),
8977
- hostContext: k.describe("Rich context about the host environment.")
8980
+ hostCapabilities: S.describe("Features and capabilities provided by the host."),
8981
+ hostContext: E.describe("Rich context about the host environment.")
8978
8982
  }).passthrough();
8979
- var v = "ui/resourceUri", d = "text/html;profile=mcp-app";
8980
- function hZ(Z, $, J, X) {
8981
- let D = J._meta, V = D.ui, L = D[v], W = D;
8982
- if (V?.resourceUri && !L) W = {
8983
- ...D,
8984
- [v]: V.resourceUri
8983
+ var U = "ui/resourceUri", f = "text/html;profile=mcp-app";
8984
+ function fZ(Z, $, J, X) {
8985
+ let V = J._meta, W = V.ui, L = V[U], D = V;
8986
+ if (W?.resourceUri && !L) D = {
8987
+ ...V,
8988
+ [U]: W.resourceUri
8985
8989
  };
8986
- else if (L && !V?.resourceUri) W = {
8987
- ...D,
8990
+ else if (L && !W?.resourceUri) D = {
8991
+ ...V,
8988
8992
  ui: {
8989
- ...V,
8993
+ ...W,
8990
8994
  resourceUri: L
8991
8995
  }
8992
8996
  };
8993
8997
  return Z.registerTool($, {
8994
8998
  ...J,
8995
- _meta: W
8999
+ _meta: D
8996
9000
  }, X);
8997
9001
  }
8998
- function mZ(Z, $, J, X, D) {
9002
+ function uZ(Z, $, J, X, V) {
8999
9003
  return Z.registerResource($, J, {
9000
- mimeType: d,
9004
+ mimeType: f,
9001
9005
  ...X
9002
- }, D);
9006
+ }, V);
9003
9007
  }
9004
- var IQ = "io.modelcontextprotocol/ui";
9005
- function cZ(Z) {
9008
+ var zQ = "io.modelcontextprotocol/ui";
9009
+ function dZ(Z) {
9006
9010
  if (!Z) return;
9007
- return Z.extensions?.[IQ];
9011
+ return Z.extensions?.[zQ];
9008
9012
  }
9009
9013
  //#endregion
9010
9014
  //#region src/mcp/resolve-domain.ts
@@ -9128,9 +9132,12 @@ function needsProdBuild(headers) {
9128
9132
  * Read pre-built resource HTML (production mode).
9129
9133
  * The HTML file is generated by `sunpeak build` with JS and CSS inlined.
9130
9134
  */
9131
- function readResourceHtmlProd(distPath) {
9135
+ function readResourceHtmlProd(distPath, resourceName) {
9132
9136
  const htmlPath = path.resolve(distPath);
9133
- if (!fs.existsSync(htmlPath)) throw new Error(`Resource HTML file not found at ${htmlPath}. Run "sunpeak build" to generate the built app.`);
9137
+ if (!fs.existsSync(htmlPath)) {
9138
+ const label = resourceName ? `Resource "${resourceName}"` : "Resource";
9139
+ throw new Error(`${label}: built HTML not found at ${htmlPath}. Run "sunpeak build" to generate it.`);
9140
+ }
9134
9141
  return fs.readFileSync(htmlPath, "utf8");
9135
9142
  }
9136
9143
  /**
@@ -9239,7 +9246,7 @@ function getViteResourceHtml(srcPath) {
9239
9246
  */
9240
9247
  function getResourceHtml(simulation, viteMode, prodBuild) {
9241
9248
  if (viteMode && simulation.srcPath && !prodBuild) return getViteResourceHtml(simulation.srcPath);
9242
- let html = readResourceHtmlProd(simulation.distPath);
9249
+ let html = readResourceHtmlProd(simulation.distPath, simulation.name);
9243
9250
  if (isDevOverlayEnabled()) html = html.replace("</body>", `${getDevOverlayScript(Date.now(), lastToolTimingMs)}\n</body>`);
9244
9251
  return html;
9245
9252
  }
@@ -9316,7 +9323,7 @@ function createAppServer(config, simulations, viteMode) {
9316
9323
  registeredUriSet.add(uri);
9317
9324
  const listMeta = viteMode ? injectViteCSP(resourceMeta) : resourceMeta;
9318
9325
  const handle = mcpServer.registerResource(resourceName, uri, {
9319
- mimeType: d,
9326
+ mimeType: f,
9320
9327
  description: resource.description,
9321
9328
  _meta: listMeta
9322
9329
  }, async (readUri, extra) => {
@@ -9335,7 +9342,7 @@ function createAppServer(config, simulations, viteMode) {
9335
9342
  console.log(`[MCP] ReadResource: ${readUri.href} → ${sizeKB}KB${servedVite ? " (vite)" : " (built)"}`);
9336
9343
  return { contents: [{
9337
9344
  uri: readUri.href,
9338
- mimeType: d,
9345
+ mimeType: f,
9339
9346
  text: content,
9340
9347
  _meta: readMeta
9341
9348
  }] };
@@ -9349,7 +9356,7 @@ function createAppServer(config, simulations, viteMode) {
9349
9356
  ...toolMeta.ui?.visibility ? { visibility: toolMeta.ui.visibility } : {}
9350
9357
  }
9351
9358
  };
9352
- const toolHandle = hZ(mcpServer, tool.name, {
9359
+ const toolHandle = fZ(mcpServer, tool.name, {
9353
9360
  description: tool.description,
9354
9361
  inputSchema: z.object({}).passthrough(),
9355
9362
  ...simulation.outputSchema ? { outputSchema: simulation.outputSchema } : {},
@@ -9551,6 +9558,7 @@ async function handleMcpRequest(req, res, config, simulations, viteMode) {
9551
9558
  console.warn(`[MCP] Accept header negotiation (expected with some clients)`);
9552
9559
  return;
9553
9560
  }
9561
+ if (error.message?.includes("Server not initialized")) return;
9554
9562
  const id = transport.sessionId;
9555
9563
  console.error(`[MCP] Transport error${id ? ` (${id.substring(0, 8)}...)` : ""}:`, error);
9556
9564
  };
@@ -9635,7 +9643,8 @@ function runMCPServer(config) {
9635
9643
  viteServer.ws.handleUpgrade(request, socket, head);
9636
9644
  });
9637
9645
  httpServer.on("clientError", (err, socket) => {
9638
- if (err.code !== "ECONNRESET") console.error("HTTP client error", err);
9646
+ if (err.code === "ECONNRESET") {} else if (err.code === "HPE_INVALID_METHOD" && "rawPacket" in err && Buffer.isBuffer(err.rawPacket) && err.rawPacket[0] === 22) console.error("Received HTTPS request on HTTP server. If you're using ngrok, make sure the upstream is http:// (not https://). Example: ngrok http 8000");
9647
+ else console.error("HTTP client error", err);
9639
9648
  socket.end("HTTP/1.1 400 Bad Request\r\n\r\n");
9640
9649
  });
9641
9650
  let resolveReady;
@@ -9645,14 +9654,16 @@ function runMCPServer(config) {
9645
9654
  const onListening = () => {
9646
9655
  const actualPort = httpServer.address().port;
9647
9656
  localDevServerUrl = `http://localhost:${actualPort}`;
9648
- console.log(`Sunpeak MCP server listening on http://localhost:${actualPort}`);
9657
+ if (actualPort !== requestedPort) console.log(`Sunpeak MCP server listening on http://localhost:${actualPort} (port ${requestedPort} was in use)`);
9658
+ else console.log(`Sunpeak MCP server listening on http://localhost:${actualPort}`);
9649
9659
  console.log(` MCP endpoint: http://localhost:${actualPort}${MCP_PATH$1}`);
9650
9660
  if (viteMode) console.log(` Vite HMR: enabled (source files served with hot reload)`);
9651
9661
  resolveReady();
9652
9662
  };
9663
+ const requestedPort = port;
9653
9664
  httpServer.on("error", (err) => {
9654
9665
  if (err.code === "EADDRINUSE") {
9655
- console.warn(`Port ${port} in use, finding an available port...`);
9666
+ console.warn(`Port ${requestedPort} is in use, trying another port...`);
9656
9667
  httpServer.listen(0);
9657
9668
  } else throw err;
9658
9669
  });
@@ -9793,7 +9804,7 @@ function createProductionMcpServer(config) {
9793
9804
  if (res) {
9794
9805
  if (!registeredResources.has(res.uri)) {
9795
9806
  registeredResources.add(res.uri);
9796
- const handle = mZ(mcpServer, res.name, res.uri, {
9807
+ const handle = uZ(mcpServer, res.name, res.uri, {
9797
9808
  description: res.description,
9798
9809
  _meta: res._meta
9799
9810
  }, async () => {
@@ -9801,7 +9812,7 @@ function createProductionMcpServer(config) {
9801
9812
  const readMeta = serverUrl ? injectDefaultDomain(resolved, clientName, serverUrl) : resolved;
9802
9813
  return { contents: [{
9803
9814
  uri: res.uri,
9804
- mimeType: d,
9815
+ mimeType: f,
9805
9816
  text: res.html,
9806
9817
  _meta: readMeta
9807
9818
  }] };
@@ -9822,7 +9833,7 @@ function createProductionMcpServer(config) {
9822
9833
  }
9823
9834
  }
9824
9835
  };
9825
- hZ(mcpServer, tool.name, toolConfig, makeCallback());
9836
+ fZ(mcpServer, tool.name, toolConfig, makeCallback());
9826
9837
  } else {
9827
9838
  const cb = makeCallback();
9828
9839
  const toolConfig = {
@@ -10205,19 +10216,22 @@ function startProductionHttpServer(config, portOrOptions) {
10205
10216
  }
10206
10217
  });
10207
10218
  httpServer.on("clientError", (err, socket) => {
10208
- log("error", "HTTP client error", { error: err.message });
10219
+ if (err.code === "HPE_INVALID_METHOD" && "rawPacket" in err && Buffer.isBuffer(err.rawPacket) && err.rawPacket[0] === 22) log("error", "Received HTTPS request on HTTP server. If you're using ngrok, make sure the upstream is http:// (not https://). Example: ngrok http 8000");
10220
+ else log("error", "HTTP client error", { error: err.message });
10209
10221
  socket.end("HTTP/1.1 400 Bad Request\r\n\r\n");
10210
10222
  });
10211
10223
  const displayHost = host === "0.0.0.0" ? "localhost" : host;
10224
+ const requestedPort = port;
10212
10225
  const onListening = () => {
10213
10226
  const addr = httpServer.address();
10214
- log("info", `Server listening on http://${displayHost}:${addr.port}`);
10227
+ if (addr.port !== requestedPort) log("info", `Server listening on http://${displayHost}:${addr.port} (port ${requestedPort} was in use)`);
10228
+ else log("info", `Server listening on http://${displayHost}:${addr.port}`);
10215
10229
  log("info", `MCP endpoint: http://${displayHost}:${addr.port}${MCP_PATH}`);
10216
10230
  log("info", `Health check: http://${displayHost}:${addr.port}/health`);
10217
10231
  };
10218
10232
  httpServer.on("error", (err) => {
10219
10233
  if (err.code === "EADDRINUSE") {
10220
- log("warn", `Port ${port} in use, finding an available port...`);
10234
+ log("warn", `Port ${requestedPort} is in use, trying another port...`);
10221
10235
  httpServer.listen(0, host);
10222
10236
  } else throw err;
10223
10237
  });
@@ -10237,6 +10251,6 @@ function startProductionHttpServer(config, portOrOptions) {
10237
10251
  process.on("SIGINT", () => void shutdown());
10238
10252
  }
10239
10253
  //#endregion
10240
- export { IQ as EXTENSION_ID, FAVICON_BASE64, FAVICON_BUFFER, FAVICON_DATA_URI, d as RESOURCE_MIME_TYPE, v as RESOURCE_URI_META_KEY, computeChatGPTDomain, computeClaudeDomain, createHandler, createMcpHandler, createProductionMcpServer, cZ as getUiCapability, injectDefaultDomain, injectResolvedDomain, mZ as registerAppResource, hZ as registerAppTool, resolveDomain, runMCPServer, setJsonLogging, startProductionHttpServer };
10254
+ export { zQ as EXTENSION_ID, FAVICON_BASE64, FAVICON_BUFFER, FAVICON_DATA_URI, f as RESOURCE_MIME_TYPE, U as RESOURCE_URI_META_KEY, computeChatGPTDomain, computeClaudeDomain, createHandler, createMcpHandler, createProductionMcpServer, dZ as getUiCapability, injectDefaultDomain, injectResolvedDomain, uZ as registerAppResource, fZ as registerAppTool, resolveDomain, runMCPServer, setJsonLogging, startProductionHttpServer };
10241
10255
 
10242
10256
  //# sourceMappingURL=index.js.map