sunpeak 0.20.42 → 0.20.49

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 (74) hide show
  1. package/bin/commands/inspect.mjs +142 -40
  2. package/bin/commands/test-init.mjs +2 -0
  3. package/bin/lib/eval/eval-runner.mjs +4 -0
  4. package/bin/lib/eval/model-registry.mjs +3 -6
  5. package/bin/lib/inspect/inspect-config.d.mts +8 -0
  6. package/bin/lib/inspect/inspect-config.mjs +9 -0
  7. package/bin/lib/inspect/inspect-server.d.mts +2 -0
  8. package/bin/lib/test/test-config.d.mts +6 -0
  9. package/bin/lib/test/test-config.mjs +11 -0
  10. package/bin/sunpeak.js +1 -0
  11. package/dist/chatgpt/index.cjs +1 -1
  12. package/dist/chatgpt/index.js +1 -1
  13. package/dist/claude/index.cjs +1 -1
  14. package/dist/claude/index.js +1 -1
  15. package/dist/hooks/tool-data-store.d.ts +26 -0
  16. package/dist/hooks/use-tool-data.d.ts +3 -9
  17. package/dist/host/chatgpt/index.cjs +1 -1
  18. package/dist/host/chatgpt/index.js +1 -1
  19. package/dist/index.cjs +36 -22
  20. package/dist/index.cjs.map +1 -1
  21. package/dist/index.js +36 -22
  22. package/dist/index.js.map +1 -1
  23. package/dist/inspector/index.cjs +1 -1
  24. package/dist/inspector/index.js +1 -1
  25. package/dist/{inspector-DOmiG64-.cjs → inspector-BGnxpdOn.cjs} +46 -20
  26. package/dist/inspector-BGnxpdOn.cjs.map +1 -0
  27. package/dist/{inspector-C6n8zap3.js → inspector-DvduUVNG.js} +46 -20
  28. package/dist/inspector-DvduUVNG.js.map +1 -0
  29. package/dist/lib/utils.d.ts +8 -7
  30. package/dist/mcp/index.cjs +6 -4
  31. package/dist/mcp/index.cjs.map +1 -1
  32. package/dist/mcp/index.js +6 -4
  33. package/dist/mcp/index.js.map +1 -1
  34. package/dist/mcp/server.d.ts +12 -1
  35. package/dist/{use-app-Duar2Ipu.js → use-app-CmrLc3wz.js} +63 -2
  36. package/dist/use-app-CmrLc3wz.js.map +1 -0
  37. package/dist/{use-app-DUdnDLP5.cjs → use-app-fizR-zbu.cjs} +63 -2
  38. package/dist/use-app-fizR-zbu.cjs.map +1 -0
  39. package/package.json +9 -9
  40. package/template/dist/albums/albums.html +2 -2
  41. package/template/dist/albums/albums.json +1 -1
  42. package/template/dist/carousel/carousel.html +2 -2
  43. package/template/dist/carousel/carousel.json +1 -1
  44. package/template/dist/map/map.html +3 -3
  45. package/template/dist/map/map.json +1 -1
  46. package/template/dist/review/review.html +2 -2
  47. package/template/dist/review/review.json +1 -1
  48. package/template/node_modules/.bin/tsc +2 -2
  49. package/template/node_modules/.bin/tsserver +2 -2
  50. package/template/node_modules/.bin/vitest +2 -2
  51. package/template/node_modules/.vite/deps/_metadata.json +3 -3
  52. package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps.js +1 -1
  53. package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps.js.map +1 -1
  54. package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps_app-bridge.js +1 -1
  55. package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps_app-bridge.js.map +1 -1
  56. package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps_react.js +1 -1
  57. package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps_react.js.map +1 -1
  58. package/template/node_modules/.vite-mcp/deps/_metadata.json +23 -23
  59. package/template/node_modules/.vite-mcp/deps/vitest.js +7 -7
  60. package/template/node_modules/.vite-mcp/deps/vitest.js.map +1 -1
  61. package/template/package.json +1 -1
  62. package/template/tests/e2e/visual.spec.ts-snapshots/albums-dark-chatgpt-linux.png +0 -0
  63. package/template/tests/e2e/visual.spec.ts-snapshots/albums-dark-claude-linux.png +0 -0
  64. package/template/tests/e2e/visual.spec.ts-snapshots/albums-fullscreen-chatgpt-darwin.png +0 -0
  65. package/template/tests/e2e/visual.spec.ts-snapshots/albums-fullscreen-chatgpt-linux.png +0 -0
  66. package/template/tests/e2e/visual.spec.ts-snapshots/albums-fullscreen-claude-darwin.png +0 -0
  67. package/template/tests/e2e/visual.spec.ts-snapshots/albums-fullscreen-claude-linux.png +0 -0
  68. package/template/tests/e2e/visual.spec.ts-snapshots/albums-light-chatgpt-linux.png +0 -0
  69. package/template/tests/e2e/visual.spec.ts-snapshots/albums-light-claude-linux.png +0 -0
  70. package/template/tsconfig.json +2 -0
  71. package/dist/inspector-C6n8zap3.js.map +0 -1
  72. package/dist/inspector-DOmiG64-.cjs.map +0 -1
  73. package/dist/use-app-DUdnDLP5.cjs.map +0 -1
  74. package/dist/use-app-Duar2Ipu.js.map +0 -1
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_chunk = require("../chunk-Cek0wNdY.cjs");
3
- const require_inspector = require("../inspector-DOmiG64-.cjs");
3
+ const require_inspector = require("../inspector-BGnxpdOn.cjs");
4
4
  const require_inspector_url = require("../inspector-url-BxScdDag.cjs");
5
5
  const require_discovery = require("../discovery-31_n0zcu.cjs");
6
6
  //#region src/inspector/index.ts
@@ -1,5 +1,5 @@
1
1
  import { Ct as __exportAll } from "../protocol-bhrz2H_E.js";
2
- import { S as registerHostShell, _ as extractResourceCSP, a as SidebarCollapsibleControl, b as getHostShell, c as SidebarSelect, d as SimpleSidebar, f as ThemeProvider, g as IframeResource, h as useInspectorState, i as SidebarCheckbox, l as SidebarTextarea, m as useMcpConnection, n as flattenAppToSimulations, o as SidebarControl, p as useThemeContext, r as resolveServerToolResult, s as SidebarInput, t as Inspector, u as SidebarToggle, v as McpAppHost, x as getRegisteredHosts, y as SCREEN_WIDTHS } from "../inspector-C6n8zap3.js";
2
+ import { S as registerHostShell, _ as extractResourceCSP, a as SidebarCollapsibleControl, b as getHostShell, c as SidebarSelect, d as SimpleSidebar, f as ThemeProvider, g as IframeResource, h as useInspectorState, i as SidebarCheckbox, l as SidebarTextarea, m as useMcpConnection, n as flattenAppToSimulations, o as SidebarControl, p as useThemeContext, r as resolveServerToolResult, s as SidebarInput, t as Inspector, u as SidebarToggle, v as McpAppHost, x as getRegisteredHosts, y as SCREEN_WIDTHS } from "../inspector-DvduUVNG.js";
3
3
  import { t as createInspectorUrl } from "../inspector-url-xUMGbWis.js";
4
4
  import { c as toPascalCase, i as findResourceKey, n as extractSimulationKey, r as findResourceDirs, s as getComponentName, t as extractResourceKey } from "../discovery-DOVner--.js";
5
5
  //#region src/inspector/index.ts
@@ -3481,20 +3481,50 @@ var twMerge = /* @__PURE__ */ createTailwindMerge(getDefaultConfig);
3481
3481
  function cn(...inputs) {
3482
3482
  return twMerge(clsx(inputs));
3483
3483
  }
3484
+ function currentPageIsLoopback() {
3485
+ if (typeof window === "undefined") return true;
3486
+ return isLocalNetworkHostname(window.location.hostname);
3487
+ }
3488
+ function normalizeHostname(hostname) {
3489
+ return hostname.toLowerCase().replace(/^\[(.*)\]$/, "$1");
3490
+ }
3491
+ function isLocalNetworkHostname(hostname) {
3492
+ const host = normalizeHostname(hostname);
3493
+ if (host === "localhost" || host === "0.0.0.0" || host === "::1") return true;
3494
+ if (host.startsWith("127.")) return true;
3495
+ const ipv4 = host.match(/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/);
3496
+ if (ipv4) {
3497
+ const octets = ipv4.slice(1).map(Number);
3498
+ if (octets.some((octet) => octet < 0 || octet > 255)) return false;
3499
+ const [a, b] = octets;
3500
+ return a === 10 || a === 172 && b >= 16 && b <= 31 || a === 192 && b === 168 || a === 169 && b === 254;
3501
+ }
3502
+ return host.startsWith("fc") || host.startsWith("fd") || host.startsWith("fe80:");
3503
+ }
3484
3504
  /**
3485
3505
  * Returns true when `icon` is safe to use as the `src` of an `<img>` rendered
3486
- * inside the inspector chrome. Accepts http(s) URLs and `data:image/*` URIs
3487
- * for raster image types only. SVG data URIs are rejected because they can
3488
- * include `<script>`/event handlers that execute when the document parses
3489
- * the inline document (the `<img>` tag itself does not run scripts in modern
3490
- * browsers, but adjacent <object>/<embed>/<iframe> renders would). Anything
3491
- * else (emoji, plain text, javascript:, file:, etc.) falls through to the
3492
- * text-rendering path that already handles emoji icons.
3506
+ * inside the inspector chrome. Accepts https URLs, local http URLs while the
3507
+ * inspector itself is running locally, and `data:image/*` URIs for raster image
3508
+ * types only. SVG data URIs are rejected because they can include
3509
+ * `<script>`/event handlers that execute when the document parses the inline
3510
+ * document (the `<img>` tag itself does not run scripts in modern browsers,
3511
+ * but adjacent <object>/<embed>/<iframe> renders would). Anything else (emoji,
3512
+ * plain text, javascript:, file:, etc.) falls through to the text-rendering
3513
+ * path that already handles emoji icons.
3493
3514
  */
3494
3515
  function isAllowedIconUrl(icon) {
3495
- if (icon.startsWith("https://") || icon.startsWith("http://")) return true;
3496
- if (icon.startsWith("data:image/png") || icon.startsWith("data:image/jpeg") || icon.startsWith("data:image/gif") || icon.startsWith("data:image/webp")) return true;
3497
- return false;
3516
+ if (/^data:image\/(?:png|jpeg|gif|webp)(?:[;,]|$)/i.test(icon)) return true;
3517
+ let url;
3518
+ try {
3519
+ url = new URL(icon);
3520
+ } catch {
3521
+ return false;
3522
+ }
3523
+ if (url.protocol !== "http:" && url.protocol !== "https:") return false;
3524
+ const inspectorIsLocal = currentPageIsLoopback();
3525
+ if (isLocalNetworkHostname(url.hostname) && !inspectorIsLocal) return false;
3526
+ if (url.protocol === "http:" && !inspectorIsLocal) return false;
3527
+ return true;
3498
3528
  }
3499
3529
  //#endregion
3500
3530
  //#region src/inspector/hosts.ts
@@ -4527,7 +4557,7 @@ registerHostShell({
4527
4557
  }`
4528
4558
  });
4529
4559
  //#endregion
4530
- //#region ../../node_modules/.pnpm/@modelcontextprotocol+ext-apps@1.7.2_@modelcontextprotocol+sdk@1.29.0_zod@4.4.3__react-_f5b843da9146ebea748e10ad8dfce46a/node_modules/@modelcontextprotocol/ext-apps/dist/src/app-bridge.js
4560
+ //#region ../../node_modules/.pnpm/@modelcontextprotocol+ext-apps@1.7.3_@modelcontextprotocol+sdk@1.29.0_zod@4.4.3__react-_198afb8973c94867da191e43eebfe140/node_modules/@modelcontextprotocol/ext-apps/dist/src/app-bridge.js
4531
4561
  ((X) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(X, { get: (Y, Z) => (typeof require < "u" ? require : Y)[Z] }) : X)(function(X) {
4532
4562
  if (typeof require < "u") return require.apply(this, arguments);
4533
4563
  throw Error("Dynamic require of \"" + X + "\" is not supported");
@@ -5992,16 +6022,12 @@ var SUNPEAK_INLINE_HELPER_SCRIPT = `
5992
6022
  //#region src/inspector/iframe-resource.tsx
5993
6023
  /**
5994
6024
  * Allowed origins for cross-origin script loading.
5995
- * - Local development: localhost, 127.0.0.1, file://
5996
6025
  * - Production: sunpeak-prod-app-storage.s3.us-east-2.amazonaws.com (serves user scripts)
6026
+ *
6027
+ * Loopback script URLs are handled separately in isAllowedUrl() so hosted
6028
+ * inspectors cannot be tricked into loading scripts from a visitor's machine.
5997
6029
  */
5998
- var ALLOWED_SCRIPT_ORIGINS = [
5999
- "https://sunpeak-prod-app-storage.s3.us-east-2.amazonaws.com",
6000
- "http://localhost",
6001
- "https://localhost",
6002
- "http://127.0.0.1",
6003
- "https://127.0.0.1"
6004
- ];
6030
+ var ALLOWED_SCRIPT_ORIGINS = ["https://sunpeak-prod-app-storage.s3.us-east-2.amazonaws.com"];
6005
6031
  /**
6006
6032
  * Escapes HTML special characters to prevent XSS via attribute injection.
6007
6033
  */
@@ -9519,4 +9545,4 @@ Object.defineProperty(exports, "useThemeContext", {
9519
9545
  }
9520
9546
  });
9521
9547
 
9522
- //# sourceMappingURL=inspector-DOmiG64-.cjs.map
9548
+ //# sourceMappingURL=inspector-BGnxpdOn.cjs.map