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
@@ -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_protocol = require("../protocol-jbxhzcnS.cjs");
3
+ const require_protocol = require("../protocol-C7kTcBr_.cjs");
4
4
  let node_http = require("node:http");
5
5
  let node_url = require("node:url");
6
6
  let node_fs = require("node:fs");
@@ -6123,7 +6123,7 @@ var require_dist = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module
6123
6123
  exports.default = formatsPlugin;
6124
6124
  }));
6125
6125
  //#endregion
6126
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
6126
+ //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
6127
6127
  var import_ajv = /* @__PURE__ */ require_chunk.__toESM(require_ajv(), 1);
6128
6128
  var import_dist = /* @__PURE__ */ require_chunk.__toESM(require_dist(), 1);
6129
6129
  function createDefaultAjvInstance() {
@@ -6199,7 +6199,7 @@ var AjvJsonSchemaValidator = class {
6199
6199
  }
6200
6200
  };
6201
6201
  //#endregion
6202
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js
6202
+ //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js
6203
6203
  /**
6204
6204
  * Experimental server task features for MCP SDK.
6205
6205
  * WARNING: These APIs are experimental and may change without notice.
@@ -6419,7 +6419,7 @@ var ExperimentalServerTasks = class {
6419
6419
  }
6420
6420
  };
6421
6421
  //#endregion
6422
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js
6422
+ //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js
6423
6423
  /**
6424
6424
  * Experimental task capability assertion helpers.
6425
6425
  * WARNING: These APIs are experimental and may change without notice.
@@ -6470,7 +6470,7 @@ function assertClientRequestTaskCapability(requests, method, entityName) {
6470
6470
  }
6471
6471
  }
6472
6472
  //#endregion
6473
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js
6473
+ //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js
6474
6474
  /**
6475
6475
  * An MCP server on top of a pluggable transport.
6476
6476
  *
@@ -6811,7 +6811,7 @@ var Server = class extends require_protocol.Protocol {
6811
6811
  }
6812
6812
  };
6813
6813
  //#endregion
6814
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js
6814
+ //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js
6815
6815
  var COMPLETABLE_SYMBOL = Symbol.for("mcp.completable");
6816
6816
  /**
6817
6817
  * Checks if a schema is completable (has completion metadata).
@@ -6830,7 +6830,7 @@ var McpZodTypeKind;
6830
6830
  McpZodTypeKind["Completable"] = "McpCompletable";
6831
6831
  })(McpZodTypeKind || (McpZodTypeKind = {}));
6832
6832
  //#endregion
6833
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js
6833
+ //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js
6834
6834
  /**
6835
6835
  * Tool name validation utilities according to SEP: Specify Format for Tool Names
6836
6836
  *
@@ -6901,7 +6901,7 @@ function validateAndWarnToolName(name) {
6901
6901
  return result.isValid;
6902
6902
  }
6903
6903
  //#endregion
6904
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.js
6904
+ //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.js
6905
6905
  /**
6906
6906
  * Experimental McpServer task features for MCP SDK.
6907
6907
  * WARNING: These APIs are experimental and may change without notice.
@@ -6932,7 +6932,7 @@ var ExperimentalMcpServerTasks = class {
6932
6932
  }
6933
6933
  };
6934
6934
  //#endregion
6935
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js
6935
+ //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js
6936
6936
  /**
6937
6937
  * High-level MCP server that provides a simpler API for working with resources, tools, and prompts.
6938
6938
  * For advanced usage (like sending notifications or setting custom request handlers), use the underlying
@@ -7407,7 +7407,10 @@ var McpServer = class {
7407
7407
  if (isZodRawShapeCompat(firstArg)) {
7408
7408
  inputSchema = rest.shift();
7409
7409
  if (rest.length > 1 && typeof rest[0] === "object" && rest[0] !== null && !isZodRawShapeCompat(rest[0])) annotations = rest.shift();
7410
- } else if (typeof firstArg === "object" && firstArg !== null) annotations = rest.shift();
7410
+ } else if (typeof firstArg === "object" && firstArg !== null) {
7411
+ 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`);
7412
+ annotations = rest.shift();
7413
+ }
7411
7414
  }
7412
7415
  const callback = rest[0];
7413
7416
  return this._createRegisteredTool(name, void 0, description, inputSchema, outputSchema, annotations, { taskSupport: "forbidden" }, void 0, callback);
@@ -7517,11 +7520,12 @@ function isZodRawShapeCompat(obj) {
7517
7520
  }
7518
7521
  /**
7519
7522
  * Converts a provided Zod schema to a Zod object if it is a ZodRawShapeCompat,
7520
- * otherwise returns the schema as is.
7523
+ * otherwise returns the schema as is. Throws if the value is not a valid Zod schema.
7521
7524
  */
7522
7525
  function getZodSchemaObject(schema) {
7523
7526
  if (!schema) return;
7524
7527
  if (isZodRawShapeCompat(schema)) return require_protocol.objectFromShape(schema);
7528
+ if (!isZodSchemaInstance(schema)) throw new Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");
7525
7529
  return schema;
7526
7530
  }
7527
7531
  function promptArgumentsFromSchema(schema) {
@@ -7977,7 +7981,7 @@ var getRequestListener = (fetchCallback, options = {}) => {
7977
7981
  };
7978
7982
  };
7979
7983
  //#endregion
7980
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/server/webStandardStreamableHttp.js
7984
+ //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/server/webStandardStreamableHttp.js
7981
7985
  /**
7982
7986
  * Web Standards Streamable HTTP Server Transport
7983
7987
  *
@@ -8534,7 +8538,7 @@ var WebStandardStreamableHTTPServerTransport = class {
8534
8538
  }
8535
8539
  };
8536
8540
  //#endregion
8537
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/server/streamableHttp.js
8541
+ //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@4.3.6/node_modules/@modelcontextprotocol/sdk/dist/esm/server/streamableHttp.js
8538
8542
  /**
8539
8543
  * Node.js HTTP Streamable HTTP Server Transport
8540
8544
  *
@@ -8680,12 +8684,12 @@ var StreamableHTTPServerTransport = class {
8680
8684
  }
8681
8685
  };
8682
8686
  //#endregion
8683
- //#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
8684
- var g = require_protocol.union([require_protocol.literal("light"), require_protocol.literal("dark")]).describe("Color theme preference for the host environment."), G = require_protocol.union([
8687
+ //#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
8688
+ var M = require_protocol.union([require_protocol.literal("light"), require_protocol.literal("dark")]).describe("Color theme preference for the host environment."), G = require_protocol.union([
8685
8689
  require_protocol.literal("inline"),
8686
8690
  require_protocol.literal("fullscreen"),
8687
8691
  require_protocol.literal("pip")
8688
- ]).describe("Display mode for UI presentation."), i = require_protocol.union([
8692
+ ]).describe("Display mode for UI presentation."), p = require_protocol.union([
8689
8693
  require_protocol.literal("--color-background-primary"),
8690
8694
  require_protocol.literal("--color-background-secondary"),
8691
8695
  require_protocol.literal("--color-background-tertiary"),
@@ -8762,7 +8766,7 @@ var g = require_protocol.union([require_protocol.literal("light"), require_proto
8762
8766
  require_protocol.literal("--shadow-sm"),
8763
8767
  require_protocol.literal("--shadow-md"),
8764
8768
  require_protocol.literal("--shadow-lg")
8765
- ]).describe("CSS variable keys available to MCP apps for theming."), o = require_protocol.record(i.describe(`Style variables for theming MCP apps.
8769
+ ]).describe("CSS variable keys available to MCP apps for theming."), r = require_protocol.record(p.describe(`Style variables for theming MCP apps.
8766
8770
 
8767
8771
  Individual style keys are optional - hosts may provide any subset of these values.
8768
8772
  Values are strings containing CSS values (colors, sizes, font stacks, etc.).
@@ -8825,16 +8829,16 @@ require_protocol.object({
8825
8829
  method: require_protocol.literal("ui/notifications/tool-cancelled"),
8826
8830
  params: require_protocol.object({ reason: require_protocol.string().optional().describe("Optional reason for the cancellation (e.g., \"user action\", \"timeout\").") })
8827
8831
  });
8828
- var S = require_protocol.object({ fonts: require_protocol.string().optional() }), y = require_protocol.object({
8829
- variables: o.optional().describe("CSS variables for theming the app."),
8830
- css: S.optional().describe("CSS blocks that apps can inject.")
8832
+ var b = require_protocol.object({ fonts: require_protocol.string().optional() }), g = require_protocol.object({
8833
+ variables: r.optional().describe("CSS variables for theming the app."),
8834
+ css: b.optional().describe("CSS blocks that apps can inject.")
8831
8835
  });
8832
8836
  require_protocol.object({
8833
8837
  method: require_protocol.literal("ui/resource-teardown"),
8834
8838
  params: require_protocol.object({})
8835
8839
  });
8836
8840
  require_protocol.record(require_protocol.string(), require_protocol.unknown());
8837
- var q = require_protocol.object({
8841
+ var z$1 = require_protocol.object({
8838
8842
  text: require_protocol.object({}).optional().describe("Host supports text content blocks."),
8839
8843
  image: require_protocol.object({}).optional().describe("Host supports image content blocks."),
8840
8844
  audio: require_protocol.object({}).optional().describe("Host supports audio content blocks."),
@@ -8846,7 +8850,7 @@ require_protocol.object({
8846
8850
  method: require_protocol.literal("ui/notifications/request-teardown"),
8847
8851
  params: require_protocol.object({}).optional()
8848
8852
  });
8849
- var C = require_protocol.object({
8853
+ var S = require_protocol.object({
8850
8854
  experimental: require_protocol.object({}).optional().describe("Experimental features (structure TBD)."),
8851
8855
  openLinks: require_protocol.object({}).optional().describe("Host supports opening external URLs."),
8852
8856
  downloadFile: require_protocol.object({}).optional().describe("Host supports file downloads via ui/download-file."),
@@ -8857,9 +8861,9 @@ var C = require_protocol.object({
8857
8861
  permissions: K.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."),
8858
8862
  csp: B.optional().describe("CSP domains approved by the host.")
8859
8863
  }).optional().describe("Sandbox configuration applied by the host."),
8860
- updateModelContext: q.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."),
8861
- message: q.optional().describe("Host supports receiving content messages (ui/message) from the view.")
8862
- }), f = require_protocol.object({
8864
+ updateModelContext: z$1.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."),
8865
+ message: z$1.optional().describe("Host supports receiving content messages (ui/message) from the view.")
8866
+ }), y = require_protocol.object({
8863
8867
  experimental: require_protocol.object({}).optional().describe("Experimental features (structure TBD)."),
8864
8868
  tools: require_protocol.object({ listChanged: require_protocol.boolean().optional().describe("App supports tools/list_changed notifications.") }).optional().describe("App exposes MCP-style tools that the host can call."),
8865
8869
  availableDisplayModes: require_protocol.array(G).optional().describe("Display modes the app supports.")
@@ -8893,10 +8897,10 @@ require_protocol.object({
8893
8897
  params: require_protocol.object({ mode: G.describe("The display mode being requested.") })
8894
8898
  });
8895
8899
  require_protocol.object({ mode: G.describe("The display mode that was actually set. May differ from requested if not supported.") }).passthrough();
8896
- var u = require_protocol.union([require_protocol.literal("model"), require_protocol.literal("app")]).describe("Tool visibility scope - who can access the tool.");
8900
+ var C = require_protocol.union([require_protocol.literal("model"), require_protocol.literal("app")]).describe("Tool visibility scope - who can access the tool.");
8897
8901
  require_protocol.object({
8898
8902
  resourceUri: require_protocol.string().optional(),
8899
- visibility: require_protocol.array(u).optional().describe(`Who can access this tool. Default: ["model", "app"]
8903
+ visibility: require_protocol.array(C).optional().describe(`Who can access this tool. Default: ["model", "app"]
8900
8904
  - "model": Tool visible to and callable by the agent
8901
8905
  - "app": Tool callable by the app from this server only`)
8902
8906
  });
@@ -8925,13 +8929,13 @@ require_protocol.object({
8925
8929
  method: require_protocol.literal("ui/notifications/tool-result"),
8926
8930
  params: require_protocol.CallToolResultSchema.describe("Standard MCP tool execution result.")
8927
8931
  });
8928
- var k = require_protocol.object({
8932
+ var E = require_protocol.object({
8929
8933
  toolInfo: require_protocol.object({
8930
8934
  id: require_protocol.RequestIdSchema.optional().describe("JSON-RPC id of the tools/call request."),
8931
8935
  tool: require_protocol.ToolSchema.describe("Tool definition including name, inputSchema, etc.")
8932
8936
  }).optional().describe("Metadata of the tool call that instantiated this App."),
8933
- theme: g.optional().describe("Current color theme preference."),
8934
- styles: y.optional().describe("Style configuration for theming the app."),
8937
+ theme: M.optional().describe("Current color theme preference."),
8938
+ styles: g.optional().describe("Style configuration for theming the app."),
8935
8939
  displayMode: G.optional().describe("How the UI is currently displayed."),
8936
8940
  availableDisplayModes: require_protocol.array(G).optional().describe("Display modes the host supports."),
8937
8941
  containerDimensions: require_protocol.union([require_protocol.object({ height: require_protocol.number().describe("Fixed container height in pixels.") }), require_protocol.object({ maxHeight: require_protocol.union([require_protocol.number(), require_protocol._undefined()]).optional().describe("Maximum container height in pixels.") })]).and(require_protocol.union([require_protocol.object({ width: require_protocol.number().describe("Fixed container width in pixels.") }), require_protocol.object({ maxWidth: require_protocol.union([require_protocol.number(), require_protocol._undefined()]).optional().describe("Maximum container width in pixels.") })])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
@@ -8957,7 +8961,7 @@ container holding the app. Specify either width or maxWidth, and either height o
8957
8961
  }).passthrough();
8958
8962
  require_protocol.object({
8959
8963
  method: require_protocol.literal("ui/notifications/host-context-changed"),
8960
- params: k.describe("Partial context update containing only changed fields.")
8964
+ params: E.describe("Partial context update containing only changed fields.")
8961
8965
  });
8962
8966
  require_protocol.object({
8963
8967
  method: require_protocol.literal("ui/update-model-context"),
@@ -8970,45 +8974,45 @@ require_protocol.object({
8970
8974
  method: require_protocol.literal("ui/initialize"),
8971
8975
  params: require_protocol.object({
8972
8976
  appInfo: require_protocol.ImplementationSchema.describe("App identification (name and version)."),
8973
- appCapabilities: f.describe("Features and capabilities this app provides."),
8977
+ appCapabilities: y.describe("Features and capabilities this app provides."),
8974
8978
  protocolVersion: require_protocol.string().describe("Protocol version this app supports.")
8975
8979
  })
8976
8980
  });
8977
8981
  require_protocol.object({
8978
8982
  protocolVersion: require_protocol.string().describe("Negotiated protocol version string (e.g., \"2025-11-21\")."),
8979
8983
  hostInfo: require_protocol.ImplementationSchema.describe("Host application identification and version."),
8980
- hostCapabilities: C.describe("Features and capabilities provided by the host."),
8981
- hostContext: k.describe("Rich context about the host environment.")
8984
+ hostCapabilities: S.describe("Features and capabilities provided by the host."),
8985
+ hostContext: E.describe("Rich context about the host environment.")
8982
8986
  }).passthrough();
8983
- var v = "ui/resourceUri", d = "text/html;profile=mcp-app";
8984
- function hZ(Z, $, J, X) {
8985
- let D = J._meta, V = D.ui, L = D[v], W = D;
8986
- if (V?.resourceUri && !L) W = {
8987
- ...D,
8988
- [v]: V.resourceUri
8987
+ var U = "ui/resourceUri", f = "text/html;profile=mcp-app";
8988
+ function fZ(Z, $, J, X) {
8989
+ let V = J._meta, W = V.ui, L = V[U], D = V;
8990
+ if (W?.resourceUri && !L) D = {
8991
+ ...V,
8992
+ [U]: W.resourceUri
8989
8993
  };
8990
- else if (L && !V?.resourceUri) W = {
8991
- ...D,
8994
+ else if (L && !W?.resourceUri) D = {
8995
+ ...V,
8992
8996
  ui: {
8993
- ...V,
8997
+ ...W,
8994
8998
  resourceUri: L
8995
8999
  }
8996
9000
  };
8997
9001
  return Z.registerTool($, {
8998
9002
  ...J,
8999
- _meta: W
9003
+ _meta: D
9000
9004
  }, X);
9001
9005
  }
9002
- function mZ(Z, $, J, X, D) {
9006
+ function uZ(Z, $, J, X, V) {
9003
9007
  return Z.registerResource($, J, {
9004
- mimeType: d,
9008
+ mimeType: f,
9005
9009
  ...X
9006
- }, D);
9010
+ }, V);
9007
9011
  }
9008
- var IQ = "io.modelcontextprotocol/ui";
9009
- function cZ(Z) {
9012
+ var zQ = "io.modelcontextprotocol/ui";
9013
+ function dZ(Z) {
9010
9014
  if (!Z) return;
9011
- return Z.extensions?.[IQ];
9015
+ return Z.extensions?.[zQ];
9012
9016
  }
9013
9017
  //#endregion
9014
9018
  //#region src/mcp/resolve-domain.ts
@@ -9132,9 +9136,12 @@ function needsProdBuild(headers) {
9132
9136
  * Read pre-built resource HTML (production mode).
9133
9137
  * The HTML file is generated by `sunpeak build` with JS and CSS inlined.
9134
9138
  */
9135
- function readResourceHtmlProd(distPath) {
9139
+ function readResourceHtmlProd(distPath, resourceName) {
9136
9140
  const htmlPath = node_path.default.resolve(distPath);
9137
- if (!node_fs.default.existsSync(htmlPath)) throw new Error(`Resource HTML file not found at ${htmlPath}. Run "sunpeak build" to generate the built app.`);
9141
+ if (!node_fs.default.existsSync(htmlPath)) {
9142
+ const label = resourceName ? `Resource "${resourceName}"` : "Resource";
9143
+ throw new Error(`${label}: built HTML not found at ${htmlPath}. Run "sunpeak build" to generate it.`);
9144
+ }
9138
9145
  return node_fs.default.readFileSync(htmlPath, "utf8");
9139
9146
  }
9140
9147
  /**
@@ -9243,7 +9250,7 @@ function getViteResourceHtml(srcPath) {
9243
9250
  */
9244
9251
  function getResourceHtml(simulation, viteMode, prodBuild) {
9245
9252
  if (viteMode && simulation.srcPath && !prodBuild) return getViteResourceHtml(simulation.srcPath);
9246
- let html = readResourceHtmlProd(simulation.distPath);
9253
+ let html = readResourceHtmlProd(simulation.distPath, simulation.name);
9247
9254
  if (isDevOverlayEnabled()) html = html.replace("</body>", `${getDevOverlayScript(Date.now(), lastToolTimingMs)}\n</body>`);
9248
9255
  return html;
9249
9256
  }
@@ -9320,7 +9327,7 @@ function createAppServer(config, simulations, viteMode) {
9320
9327
  registeredUriSet.add(uri);
9321
9328
  const listMeta = viteMode ? injectViteCSP(resourceMeta) : resourceMeta;
9322
9329
  const handle = mcpServer.registerResource(resourceName, uri, {
9323
- mimeType: d,
9330
+ mimeType: f,
9324
9331
  description: resource.description,
9325
9332
  _meta: listMeta
9326
9333
  }, async (readUri, extra) => {
@@ -9339,7 +9346,7 @@ function createAppServer(config, simulations, viteMode) {
9339
9346
  console.log(`[MCP] ReadResource: ${readUri.href} → ${sizeKB}KB${servedVite ? " (vite)" : " (built)"}`);
9340
9347
  return { contents: [{
9341
9348
  uri: readUri.href,
9342
- mimeType: d,
9349
+ mimeType: f,
9343
9350
  text: content,
9344
9351
  _meta: readMeta
9345
9352
  }] };
@@ -9353,7 +9360,7 @@ function createAppServer(config, simulations, viteMode) {
9353
9360
  ...toolMeta.ui?.visibility ? { visibility: toolMeta.ui.visibility } : {}
9354
9361
  }
9355
9362
  };
9356
- const toolHandle = hZ(mcpServer, tool.name, {
9363
+ const toolHandle = fZ(mcpServer, tool.name, {
9357
9364
  description: tool.description,
9358
9365
  inputSchema: zod.z.object({}).passthrough(),
9359
9366
  ...simulation.outputSchema ? { outputSchema: simulation.outputSchema } : {},
@@ -9555,6 +9562,7 @@ async function handleMcpRequest(req, res, config, simulations, viteMode) {
9555
9562
  console.warn(`[MCP] Accept header negotiation (expected with some clients)`);
9556
9563
  return;
9557
9564
  }
9565
+ if (error.message?.includes("Server not initialized")) return;
9558
9566
  const id = transport.sessionId;
9559
9567
  console.error(`[MCP] Transport error${id ? ` (${id.substring(0, 8)}...)` : ""}:`, error);
9560
9568
  };
@@ -9639,7 +9647,8 @@ function runMCPServer(config) {
9639
9647
  viteServer.ws.handleUpgrade(request, socket, head);
9640
9648
  });
9641
9649
  httpServer.on("clientError", (err, socket) => {
9642
- if (err.code !== "ECONNRESET") console.error("HTTP client error", err);
9650
+ 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");
9651
+ else console.error("HTTP client error", err);
9643
9652
  socket.end("HTTP/1.1 400 Bad Request\r\n\r\n");
9644
9653
  });
9645
9654
  let resolveReady;
@@ -9649,14 +9658,16 @@ function runMCPServer(config) {
9649
9658
  const onListening = () => {
9650
9659
  const actualPort = httpServer.address().port;
9651
9660
  localDevServerUrl = `http://localhost:${actualPort}`;
9652
- console.log(`Sunpeak MCP server listening on http://localhost:${actualPort}`);
9661
+ if (actualPort !== requestedPort) console.log(`Sunpeak MCP server listening on http://localhost:${actualPort} (port ${requestedPort} was in use)`);
9662
+ else console.log(`Sunpeak MCP server listening on http://localhost:${actualPort}`);
9653
9663
  console.log(` MCP endpoint: http://localhost:${actualPort}${MCP_PATH$1}`);
9654
9664
  if (viteMode) console.log(` Vite HMR: enabled (source files served with hot reload)`);
9655
9665
  resolveReady();
9656
9666
  };
9667
+ const requestedPort = port;
9657
9668
  httpServer.on("error", (err) => {
9658
9669
  if (err.code === "EADDRINUSE") {
9659
- console.warn(`Port ${port} in use, finding an available port...`);
9670
+ console.warn(`Port ${requestedPort} is in use, trying another port...`);
9660
9671
  httpServer.listen(0);
9661
9672
  } else throw err;
9662
9673
  });
@@ -9797,7 +9808,7 @@ function createProductionMcpServer(config) {
9797
9808
  if (res) {
9798
9809
  if (!registeredResources.has(res.uri)) {
9799
9810
  registeredResources.add(res.uri);
9800
- const handle = mZ(mcpServer, res.name, res.uri, {
9811
+ const handle = uZ(mcpServer, res.name, res.uri, {
9801
9812
  description: res.description,
9802
9813
  _meta: res._meta
9803
9814
  }, async () => {
@@ -9805,7 +9816,7 @@ function createProductionMcpServer(config) {
9805
9816
  const readMeta = serverUrl ? injectDefaultDomain(resolved, clientName, serverUrl) : resolved;
9806
9817
  return { contents: [{
9807
9818
  uri: res.uri,
9808
- mimeType: d,
9819
+ mimeType: f,
9809
9820
  text: res.html,
9810
9821
  _meta: readMeta
9811
9822
  }] };
@@ -9826,7 +9837,7 @@ function createProductionMcpServer(config) {
9826
9837
  }
9827
9838
  }
9828
9839
  };
9829
- hZ(mcpServer, tool.name, toolConfig, makeCallback());
9840
+ fZ(mcpServer, tool.name, toolConfig, makeCallback());
9830
9841
  } else {
9831
9842
  const cb = makeCallback();
9832
9843
  const toolConfig = {
@@ -10209,19 +10220,22 @@ function startProductionHttpServer(config, portOrOptions) {
10209
10220
  }
10210
10221
  });
10211
10222
  httpServer.on("clientError", (err, socket) => {
10212
- log("error", "HTTP client error", { error: err.message });
10223
+ 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");
10224
+ else log("error", "HTTP client error", { error: err.message });
10213
10225
  socket.end("HTTP/1.1 400 Bad Request\r\n\r\n");
10214
10226
  });
10215
10227
  const displayHost = host === "0.0.0.0" ? "localhost" : host;
10228
+ const requestedPort = port;
10216
10229
  const onListening = () => {
10217
10230
  const addr = httpServer.address();
10218
- log("info", `Server listening on http://${displayHost}:${addr.port}`);
10231
+ if (addr.port !== requestedPort) log("info", `Server listening on http://${displayHost}:${addr.port} (port ${requestedPort} was in use)`);
10232
+ else log("info", `Server listening on http://${displayHost}:${addr.port}`);
10219
10233
  log("info", `MCP endpoint: http://${displayHost}:${addr.port}${MCP_PATH}`);
10220
10234
  log("info", `Health check: http://${displayHost}:${addr.port}/health`);
10221
10235
  };
10222
10236
  httpServer.on("error", (err) => {
10223
10237
  if (err.code === "EADDRINUSE") {
10224
- log("warn", `Port ${port} in use, finding an available port...`);
10238
+ log("warn", `Port ${requestedPort} is in use, trying another port...`);
10225
10239
  httpServer.listen(0, host);
10226
10240
  } else throw err;
10227
10241
  });
@@ -10241,22 +10255,22 @@ function startProductionHttpServer(config, portOrOptions) {
10241
10255
  process.on("SIGINT", () => void shutdown());
10242
10256
  }
10243
10257
  //#endregion
10244
- exports.EXTENSION_ID = IQ;
10258
+ exports.EXTENSION_ID = zQ;
10245
10259
  exports.FAVICON_BASE64 = FAVICON_BASE64;
10246
10260
  exports.FAVICON_BUFFER = FAVICON_BUFFER;
10247
10261
  exports.FAVICON_DATA_URI = FAVICON_DATA_URI;
10248
- exports.RESOURCE_MIME_TYPE = d;
10249
- exports.RESOURCE_URI_META_KEY = v;
10262
+ exports.RESOURCE_MIME_TYPE = f;
10263
+ exports.RESOURCE_URI_META_KEY = U;
10250
10264
  exports.computeChatGPTDomain = computeChatGPTDomain;
10251
10265
  exports.computeClaudeDomain = computeClaudeDomain;
10252
10266
  exports.createHandler = createHandler;
10253
10267
  exports.createMcpHandler = createMcpHandler;
10254
10268
  exports.createProductionMcpServer = createProductionMcpServer;
10255
- exports.getUiCapability = cZ;
10269
+ exports.getUiCapability = dZ;
10256
10270
  exports.injectDefaultDomain = injectDefaultDomain;
10257
10271
  exports.injectResolvedDomain = injectResolvedDomain;
10258
- exports.registerAppResource = mZ;
10259
- exports.registerAppTool = hZ;
10272
+ exports.registerAppResource = uZ;
10273
+ exports.registerAppTool = fZ;
10260
10274
  exports.resolveDomain = resolveDomain;
10261
10275
  exports.runMCPServer = runMCPServer;
10262
10276
  exports.setJsonLogging = setJsonLogging;