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
@@ -3480,20 +3480,50 @@ var twMerge = /* @__PURE__ */ createTailwindMerge(getDefaultConfig);
3480
3480
  function cn(...inputs) {
3481
3481
  return twMerge(clsx(inputs));
3482
3482
  }
3483
+ function currentPageIsLoopback() {
3484
+ if (typeof window === "undefined") return true;
3485
+ return isLocalNetworkHostname(window.location.hostname);
3486
+ }
3487
+ function normalizeHostname(hostname) {
3488
+ return hostname.toLowerCase().replace(/^\[(.*)\]$/, "$1");
3489
+ }
3490
+ function isLocalNetworkHostname(hostname) {
3491
+ const host = normalizeHostname(hostname);
3492
+ if (host === "localhost" || host === "0.0.0.0" || host === "::1") return true;
3493
+ if (host.startsWith("127.")) return true;
3494
+ const ipv4 = host.match(/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/);
3495
+ if (ipv4) {
3496
+ const octets = ipv4.slice(1).map(Number);
3497
+ if (octets.some((octet) => octet < 0 || octet > 255)) return false;
3498
+ const [a, b] = octets;
3499
+ return a === 10 || a === 172 && b >= 16 && b <= 31 || a === 192 && b === 168 || a === 169 && b === 254;
3500
+ }
3501
+ return host.startsWith("fc") || host.startsWith("fd") || host.startsWith("fe80:");
3502
+ }
3483
3503
  /**
3484
3504
  * Returns true when `icon` is safe to use as the `src` of an `<img>` rendered
3485
- * inside the inspector chrome. Accepts http(s) URLs and `data:image/*` URIs
3486
- * for raster image types only. SVG data URIs are rejected because they can
3487
- * include `<script>`/event handlers that execute when the document parses
3488
- * the inline document (the `<img>` tag itself does not run scripts in modern
3489
- * browsers, but adjacent <object>/<embed>/<iframe> renders would). Anything
3490
- * else (emoji, plain text, javascript:, file:, etc.) falls through to the
3491
- * text-rendering path that already handles emoji icons.
3505
+ * inside the inspector chrome. Accepts https URLs, local http URLs while the
3506
+ * inspector itself is running locally, and `data:image/*` URIs for raster image
3507
+ * types only. SVG data URIs are rejected because they can include
3508
+ * `<script>`/event handlers that execute when the document parses the inline
3509
+ * document (the `<img>` tag itself does not run scripts in modern browsers,
3510
+ * but adjacent <object>/<embed>/<iframe> renders would). Anything else (emoji,
3511
+ * plain text, javascript:, file:, etc.) falls through to the text-rendering
3512
+ * path that already handles emoji icons.
3492
3513
  */
3493
3514
  function isAllowedIconUrl(icon) {
3494
- if (icon.startsWith("https://") || icon.startsWith("http://")) return true;
3495
- if (icon.startsWith("data:image/png") || icon.startsWith("data:image/jpeg") || icon.startsWith("data:image/gif") || icon.startsWith("data:image/webp")) return true;
3496
- return false;
3515
+ if (/^data:image\/(?:png|jpeg|gif|webp)(?:[;,]|$)/i.test(icon)) return true;
3516
+ let url;
3517
+ try {
3518
+ url = new URL(icon);
3519
+ } catch {
3520
+ return false;
3521
+ }
3522
+ if (url.protocol !== "http:" && url.protocol !== "https:") return false;
3523
+ const inspectorIsLocal = currentPageIsLoopback();
3524
+ if (isLocalNetworkHostname(url.hostname) && !inspectorIsLocal) return false;
3525
+ if (url.protocol === "http:" && !inspectorIsLocal) return false;
3526
+ return true;
3497
3527
  }
3498
3528
  //#endregion
3499
3529
  //#region src/inspector/hosts.ts
@@ -4526,7 +4556,7 @@ registerHostShell({
4526
4556
  }`
4527
4557
  });
4528
4558
  //#endregion
4529
- //#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
4559
+ //#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
4530
4560
  ((X) => typeof __require < "u" ? __require : typeof Proxy < "u" ? new Proxy(X, { get: (Y, Z) => (typeof __require < "u" ? __require : Y)[Z] }) : X)(function(X) {
4531
4561
  if (typeof __require < "u") return __require.apply(this, arguments);
4532
4562
  throw Error("Dynamic require of \"" + X + "\" is not supported");
@@ -5991,16 +6021,12 @@ var SUNPEAK_INLINE_HELPER_SCRIPT = `
5991
6021
  //#region src/inspector/iframe-resource.tsx
5992
6022
  /**
5993
6023
  * Allowed origins for cross-origin script loading.
5994
- * - Local development: localhost, 127.0.0.1, file://
5995
6024
  * - Production: sunpeak-prod-app-storage.s3.us-east-2.amazonaws.com (serves user scripts)
6025
+ *
6026
+ * Loopback script URLs are handled separately in isAllowedUrl() so hosted
6027
+ * inspectors cannot be tricked into loading scripts from a visitor's machine.
5996
6028
  */
5997
- var ALLOWED_SCRIPT_ORIGINS = [
5998
- "https://sunpeak-prod-app-storage.s3.us-east-2.amazonaws.com",
5999
- "http://localhost",
6000
- "https://localhost",
6001
- "http://127.0.0.1",
6002
- "https://127.0.0.1"
6003
- ];
6029
+ var ALLOWED_SCRIPT_ORIGINS = ["https://sunpeak-prod-app-storage.s3.us-east-2.amazonaws.com"];
6004
6030
  /**
6005
6031
  * Escapes HTML special characters to prevent XSS via attribute injection.
6006
6032
  */
@@ -9375,4 +9401,4 @@ function Inspector({ children, app, simulations: initialSimulationsProp = EMPTY_
9375
9401
  //#endregion
9376
9402
  export { cn as C, registerHostShell as S, extractResourceCSP as _, SidebarCollapsibleControl as a, getHostShell as b, SidebarSelect as c, SimpleSidebar as d, ThemeProvider as f, IframeResource as g, useInspectorState as h, SidebarCheckbox as i, SidebarTextarea as l, useMcpConnection as m, flattenAppToSimulations as n, SidebarControl as o, useThemeContext as p, resolveServerToolResult as r, SidebarInput as s, Inspector as t, SidebarToggle as u, McpAppHost as v, DEFAULT_STYLE_VARIABLES as w, getRegisteredHosts as x, SCREEN_WIDTHS as y };
9377
9403
 
9378
- //# sourceMappingURL=inspector-C6n8zap3.js.map
9404
+ //# sourceMappingURL=inspector-DvduUVNG.js.map