sunpeak 0.16.17 → 0.16.21

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 (145) hide show
  1. package/README.md +2 -2
  2. package/bin/commands/build.mjs +1 -1
  3. package/bin/commands/dev.mjs +137 -19
  4. package/bin/commands/new.mjs +21 -2
  5. package/bin/commands/start.mjs +1 -1
  6. package/dist/chatgpt/chatgpt-conversation.d.ts +3 -1
  7. package/dist/chatgpt/globals.css +37 -8
  8. package/dist/chatgpt/index.cjs +3 -5
  9. package/dist/chatgpt/index.cjs.map +1 -1
  10. package/dist/chatgpt/index.d.ts +0 -1
  11. package/dist/chatgpt/index.js +3 -5
  12. package/dist/chatgpt/index.js.map +1 -1
  13. package/dist/claude/claude-conversation.d.ts +3 -1
  14. package/dist/claude/index.cjs +2 -2
  15. package/dist/claude/index.d.ts +1 -1
  16. package/dist/claude/index.js +2 -2
  17. package/dist/{discovery-DvIQWTez.js → discovery-BVqD-JsT.js} +4 -2
  18. package/dist/{discovery-DvIQWTez.js.map → discovery-BVqD-JsT.js.map} +1 -1
  19. package/dist/{discovery-SviNiBkF.cjs → discovery-D1gpaVz4.cjs} +4 -2
  20. package/dist/{discovery-SviNiBkF.cjs.map → discovery-D1gpaVz4.cjs.map} +1 -1
  21. package/dist/hooks/index.d.ts +10 -1
  22. package/dist/hooks/safe-area.d.ts +6 -2
  23. package/dist/hooks/use-device-capabilities.d.ts +3 -0
  24. package/dist/hooks/use-platform.d.ts +3 -0
  25. package/dist/hooks/use-styles.d.ts +2 -0
  26. package/dist/hooks/use-time-zone.d.ts +1 -0
  27. package/dist/hooks/use-tool-info.d.ts +3 -0
  28. package/dist/hooks/use-user-agent.d.ts +1 -0
  29. package/dist/hooks/use-viewport.d.ts +3 -0
  30. package/dist/{platform → host}/chatgpt/index.cjs +1 -1
  31. package/dist/host/chatgpt/index.cjs.map +1 -0
  32. package/dist/{platform → host}/chatgpt/index.d.ts +2 -2
  33. package/dist/{platform → host}/chatgpt/index.js +1 -1
  34. package/dist/host/chatgpt/index.js.map +1 -0
  35. package/dist/{platform → host}/chatgpt/use-create-file.d.ts +2 -2
  36. package/dist/{platform → host}/chatgpt/use-file-download.d.ts +2 -2
  37. package/dist/{platform → host}/chatgpt/use-open-modal.d.ts +2 -2
  38. package/dist/{platform → host}/chatgpt/use-request-checkout.d.ts +2 -2
  39. package/dist/{platform → host}/index.cjs +5 -3
  40. package/dist/host/index.cjs.map +1 -0
  41. package/dist/{platform → host}/index.d.ts +15 -11
  42. package/dist/{platform → host}/index.js +5 -3
  43. package/dist/host/index.js.map +1 -0
  44. package/dist/{index-CsYoMHyn.js → index-B4aC3vjH.js} +4 -4
  45. package/dist/index-B4aC3vjH.js.map +1 -0
  46. package/dist/{index-DHcaJ5PU.cjs → index-CKabCJyV.cjs} +4 -4
  47. package/dist/index-CKabCJyV.cjs.map +1 -0
  48. package/dist/index-CX6Z4bED.js +29 -0
  49. package/dist/index-CX6Z4bED.js.map +1 -0
  50. package/dist/index-bKBBCBK6.cjs +28 -0
  51. package/dist/index-bKBBCBK6.cjs.map +1 -0
  52. package/dist/index.cjs +233 -6297
  53. package/dist/index.cjs.map +1 -1
  54. package/dist/index.d.ts +4 -2
  55. package/dist/index.js +228 -6292
  56. package/dist/index.js.map +1 -1
  57. package/dist/lib/discovery-cli.cjs +1 -1
  58. package/dist/lib/discovery-cli.js +1 -1
  59. package/dist/mcp/index.cjs +680 -6766
  60. package/dist/mcp/index.cjs.map +1 -1
  61. package/dist/mcp/index.js +682 -6768
  62. package/dist/mcp/index.js.map +1 -1
  63. package/dist/{protocol-CfvM5B6z.cjs → protocol-DkDHRwOW.cjs} +50 -5
  64. package/dist/{protocol-CfvM5B6z.cjs.map → protocol-DkDHRwOW.cjs.map} +1 -1
  65. package/dist/{protocol-CF-P_kw5.js → protocol-uge7qFev.js} +102 -57
  66. package/dist/{protocol-CF-P_kw5.js.map → protocol-uge7qFev.js.map} +1 -1
  67. package/dist/simulator/hosts.d.ts +2 -0
  68. package/dist/simulator/index.cjs +3 -3
  69. package/dist/simulator/index.js +3 -3
  70. package/dist/simulator/simple-sidebar.d.ts +18 -4
  71. package/dist/simulator/simulator-url.d.ts +8 -0
  72. package/dist/simulator/simulator.d.ts +13 -1
  73. package/dist/simulator/use-simulator-state.d.ts +10 -6
  74. package/dist/simulator-D8t-r7HH.js +3222 -0
  75. package/dist/simulator-D8t-r7HH.js.map +1 -0
  76. package/dist/simulator-FFNttkqL.cjs +3237 -0
  77. package/dist/simulator-FFNttkqL.cjs.map +1 -0
  78. package/dist/{simulator-url-rgg_KYOg.cjs → simulator-url-DcSYRl-P.cjs} +7 -1
  79. package/dist/simulator-url-DcSYRl-P.cjs.map +1 -0
  80. package/dist/{simulator-url-CuLqtnSS.js → simulator-url-j_XV3EoP.js} +7 -1
  81. package/dist/simulator-url-j_XV3EoP.js.map +1 -0
  82. package/dist/style.css +37 -8
  83. package/dist/use-app-C9gpzIQO.js +349 -0
  84. package/dist/use-app-C9gpzIQO.js.map +1 -0
  85. package/dist/use-app-D09O2swh.cjs +348 -0
  86. package/dist/use-app-D09O2swh.cjs.map +1 -0
  87. package/package.json +26 -14
  88. package/template/.sunpeak/dev.tsx +28 -2
  89. package/template/node_modules/.bin/vite +2 -2
  90. package/template/node_modules/.bin/vitest +2 -2
  91. package/template/package.json +5 -5
  92. package/template/playwright.config.ts +6 -3
  93. package/template/src/resources/albums/albums.test.tsx +1 -0
  94. package/template/src/resources/albums/albums.tsx +5 -2
  95. package/template/src/resources/albums/components/albums.test.tsx +22 -18
  96. package/template/src/resources/albums/components/albums.tsx +63 -7
  97. package/template/src/resources/albums/components/fullscreen-viewer.test.tsx +3 -25
  98. package/template/src/resources/albums/components/fullscreen-viewer.tsx +2 -3
  99. package/template/src/resources/carousel/carousel.test.tsx +12 -16
  100. package/template/src/resources/carousel/carousel.tsx +47 -5
  101. package/template/src/resources/map/components/map.tsx +65 -9
  102. package/template/src/resources/map/map.test.tsx +0 -1
  103. package/template/src/resources/review/review.test.tsx +25 -27
  104. package/template/src/resources/review/review.tsx +85 -63
  105. package/template/src/tools/review-diff.test.ts +73 -0
  106. package/template/src/tools/review-diff.ts +29 -2
  107. package/template/src/tools/review-post.test.ts +100 -0
  108. package/template/src/tools/review-post.ts +30 -2
  109. package/template/src/tools/review-purchase.test.ts +111 -0
  110. package/template/src/tools/review-purchase.ts +35 -2
  111. package/template/src/tools/review.test.ts +40 -0
  112. package/template/src/tools/review.ts +4 -1
  113. package/template/src/tools/show-albums.test.ts +42 -0
  114. package/template/src/tools/show-albums.ts +22 -2
  115. package/template/src/tools/show-carousel.test.ts +45 -0
  116. package/template/src/tools/show-carousel.ts +19 -2
  117. package/template/src/tools/show-map.test.ts +74 -0
  118. package/template/src/tools/show-map.ts +21 -2
  119. package/template/tests/e2e/albums.spec.ts +75 -0
  120. package/template/tests/e2e/carousel.spec.ts +65 -0
  121. package/template/tests/e2e/global-setup.ts +25 -0
  122. package/template/tests/e2e/map.spec.ts +60 -0
  123. package/template/tests/e2e/review.spec.ts +72 -11
  124. package/dist/chatgpt/chatgpt-simulator.d.ts +0 -10
  125. package/dist/index-BFD3bAHd.cjs +0 -547
  126. package/dist/index-BFD3bAHd.cjs.map +0 -1
  127. package/dist/index-CsYoMHyn.js.map +0 -1
  128. package/dist/index-DHcaJ5PU.cjs.map +0 -1
  129. package/dist/index-wUvmyoCx.js +0 -532
  130. package/dist/index-wUvmyoCx.js.map +0 -1
  131. package/dist/platform/chatgpt/index.cjs.map +0 -1
  132. package/dist/platform/chatgpt/index.js.map +0 -1
  133. package/dist/platform/index.cjs.map +0 -1
  134. package/dist/platform/index.js.map +0 -1
  135. package/dist/simulator-BEFsuj9Z.cjs +0 -8872
  136. package/dist/simulator-BEFsuj9Z.cjs.map +0 -1
  137. package/dist/simulator-Da9iAupa.js +0 -8857
  138. package/dist/simulator-Da9iAupa.js.map +0 -1
  139. package/dist/simulator-url-CuLqtnSS.js.map +0 -1
  140. package/dist/simulator-url-rgg_KYOg.cjs.map +0 -1
  141. package/dist/use-app-CaTJmpgj.cjs +0 -6449
  142. package/dist/use-app-CaTJmpgj.cjs.map +0 -1
  143. package/dist/use-app-DTTzqi-0.js +0 -6450
  144. package/dist/use-app-DTTzqi-0.js.map +0 -1
  145. /package/dist/{platform → host}/chatgpt/openai-types.d.ts +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../src/host/index.ts"],"sourcesContent":["/**\n * Host detection utilities for MCP Apps.\n *\n * Use these functions to detect which host is running your app\n * and conditionally use host-specific features.\n *\n * @example\n * ```tsx\n * import { isChatGPT } from 'sunpeak/host';\n *\n * function MyResource() {\n * // Only use ChatGPT-specific features when running on ChatGPT\n * if (isChatGPT()) {\n * // Use updateModelContext, etc.\n * }\n * }\n * ```\n */\n\n/**\n * Supported hosts.\n */\nexport type Host = 'chatgpt' | 'claude' | 'unknown';\n\n/**\n * Detect the current host.\n *\n * Detection is based on:\n * 1. Host runtime objects (window.openai for ChatGPT — works in both\n * real hosts and the simulator when the ChatGPT host shell is active)\n * 2. User agent patterns as fallback\n * 3. Hostname matching as final fallback\n *\n * @returns The detected host\n */\nexport function detectHost(): Host {\n // Check if we're in a browser environment\n if (typeof window === 'undefined') {\n return 'unknown';\n }\n\n // ChatGPT injects window.openai; the simulator does the same when\n // the ChatGPT host shell is selected. This is the most reliable signal.\n if ('openai' in window) {\n return 'chatgpt';\n }\n\n // Check user agent patterns for host detection\n const ua = navigator.userAgent.toLowerCase();\n\n // ChatGPT iOS/Android apps and web\n if (ua.includes('chatgpt') || window.location.hostname.includes('chatgpt.com')) {\n return 'chatgpt';\n }\n\n // Claude apps and web\n if (ua.includes('claude') || window.location.hostname.includes('claude.ai')) {\n return 'claude';\n }\n\n return 'unknown';\n}\n\n/**\n * Check if the app is running in a ChatGPT host.\n *\n * @returns true if running in ChatGPT\n *\n * @example\n * ```tsx\n * import { isChatGPT } from 'sunpeak/host';\n *\n * function MyResource() {\n * if (isChatGPT()) {\n * // Use ChatGPT-specific features\n * }\n * }\n * ```\n */\nexport function isChatGPT(): boolean {\n return detectHost() === 'chatgpt';\n}\n\n/**\n * Check if the app is running in a Claude host.\n *\n * @returns true if running in Claude\n */\nexport function isClaude(): boolean {\n return detectHost() === 'claude';\n}\n\n/** @deprecated Use `Host` instead. */\nexport type Platform = Host;\n\n/** @deprecated Use `detectHost` instead. */\nexport const detectPlatform = detectHost;\n"],"names":[],"mappings":"AAmCO,SAAS,aAAmB;AAEjC,MAAI,OAAO,WAAW,aAAa;AACjC,WAAO;AAAA,EACT;AAIA,MAAI,YAAY,QAAQ;AACtB,WAAO;AAAA,EACT;AAGA,QAAM,KAAK,UAAU,UAAU,YAAA;AAG/B,MAAI,GAAG,SAAS,SAAS,KAAK,OAAO,SAAS,SAAS,SAAS,aAAa,GAAG;AAC9E,WAAO;AAAA,EACT;AAGA,MAAI,GAAG,SAAS,QAAQ,KAAK,OAAO,SAAS,SAAS,SAAS,WAAW,GAAG;AAC3E,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAkBO,SAAS,YAAqB;AACnC,SAAO,iBAAiB;AAC1B;AAOO,SAAS,WAAoB;AAClC,SAAO,iBAAiB;AAC1B;AAMO,MAAM,iBAAiB;"}
@@ -1,6 +1,6 @@
1
- import { I as IframeResource, M as McpAppHost, a as SCREEN_WIDTHS, b as SidebarCheckbox, c as SidebarCollapsibleControl, d as SidebarControl, e as SidebarInput, f as SidebarSelect, g as SidebarTextarea, h as SidebarToggle, i as SimpleSidebar, S as Simulator, T as ThemeProvider, j as extractResourceCSP, k as getHostShell, l as getRegisteredHosts, r as registerHostShell, m as resolveServerToolResult, u as useSimulatorState, n as useThemeContext } from "./simulator-Da9iAupa.js";
2
- import { c as createSimulatorUrl } from "./simulator-url-CuLqtnSS.js";
3
- import { b as buildDevSimulations, a as buildResourceMap, c as buildSimulations, d as createResourceExports, e as extractResourceKey, f as extractSimulationKey, g as findResourceDirs, h as findResourceKey, i as getComponentName, t as toPascalCase } from "./discovery-DvIQWTez.js";
1
+ import { I as IframeResource, M as McpAppHost, a as SCREEN_WIDTHS, b as SidebarCheckbox, c as SidebarCollapsibleControl, d as SidebarControl, e as SidebarInput, f as SidebarSelect, g as SidebarTextarea, h as SidebarToggle, i as SimpleSidebar, S as Simulator, T as ThemeProvider, j as extractResourceCSP, k as getHostShell, l as getRegisteredHosts, r as registerHostShell, m as resolveServerToolResult, u as useSimulatorState, n as useThemeContext } from "./simulator-D8t-r7HH.js";
2
+ import { c as createSimulatorUrl } from "./simulator-url-j_XV3EoP.js";
3
+ import { b as buildDevSimulations, a as buildResourceMap, c as buildSimulations, d as createResourceExports, e as extractResourceKey, f as extractSimulationKey, g as findResourceDirs, h as findResourceKey, i as getComponentName, t as toPascalCase } from "./discovery-BVqD-JsT.js";
4
4
  const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5
5
  __proto__: null,
6
6
  IframeResource,
@@ -38,4 +38,4 @@ const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
38
38
  export {
39
39
  index as i
40
40
  };
41
- //# sourceMappingURL=index-CsYoMHyn.js.map
41
+ //# sourceMappingURL=index-B4aC3vjH.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-B4aC3vjH.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
- const simulator = require("./simulator-BEFsuj9Z.cjs");
3
- const simulatorUrl = require("./simulator-url-rgg_KYOg.cjs");
4
- const discovery = require("./discovery-SviNiBkF.cjs");
2
+ const simulator = require("./simulator-FFNttkqL.cjs");
3
+ const simulatorUrl = require("./simulator-url-DcSYRl-P.cjs");
4
+ const discovery = require("./discovery-D1gpaVz4.cjs");
5
5
  const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6
6
  __proto__: null,
7
7
  IframeResource: simulator.IframeResource,
@@ -37,4 +37,4 @@ const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
37
37
  useThemeContext: simulator.useThemeContext
38
38
  }, Symbol.toStringTag, { value: "Module" }));
39
39
  exports.index = index;
40
- //# sourceMappingURL=index-DHcaJ5PU.cjs.map
40
+ //# sourceMappingURL=index-CKabCJyV.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-CKabCJyV.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,29 @@
1
+ import { I as IframeResource, M as McpAppHost, a as SCREEN_WIDTHS, S as Simulator, T as ThemeProvider, j as extractResourceCSP, m as resolveServerToolResult, n as useThemeContext } from "./simulator-D8t-r7HH.js";
2
+ import { c as createSimulatorUrl } from "./simulator-url-j_XV3EoP.js";
3
+ import { b as buildDevSimulations, a as buildResourceMap, c as buildSimulations, d as createResourceExports, e as extractResourceKey, f as extractSimulationKey, g as findResourceDirs, h as findResourceKey, i as getComponentName, t as toPascalCase } from "./discovery-BVqD-JsT.js";
4
+ const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5
+ __proto__: null,
6
+ IframeResource,
7
+ McpAppHost,
8
+ SCREEN_WIDTHS,
9
+ Simulator,
10
+ ThemeProvider,
11
+ buildDevSimulations,
12
+ buildResourceMap,
13
+ buildSimulations,
14
+ createResourceExports,
15
+ createSimulatorUrl,
16
+ extractResourceCSP,
17
+ extractResourceKey,
18
+ extractSimulationKey,
19
+ findResourceDirs,
20
+ findResourceKey,
21
+ getComponentName,
22
+ resolveServerToolResult,
23
+ toPascalCase,
24
+ useThemeContext
25
+ }, Symbol.toStringTag, { value: "Module" }));
26
+ export {
27
+ index as i
28
+ };
29
+ //# sourceMappingURL=index-CX6Z4bED.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-CX6Z4bED.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ const simulator = require("./simulator-FFNttkqL.cjs");
3
+ const simulatorUrl = require("./simulator-url-DcSYRl-P.cjs");
4
+ const discovery = require("./discovery-D1gpaVz4.cjs");
5
+ const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6
+ __proto__: null,
7
+ IframeResource: simulator.IframeResource,
8
+ McpAppHost: simulator.McpAppHost,
9
+ SCREEN_WIDTHS: simulator.SCREEN_WIDTHS,
10
+ Simulator: simulator.Simulator,
11
+ ThemeProvider: simulator.ThemeProvider,
12
+ buildDevSimulations: discovery.buildDevSimulations,
13
+ buildResourceMap: discovery.buildResourceMap,
14
+ buildSimulations: discovery.buildSimulations,
15
+ createResourceExports: discovery.createResourceExports,
16
+ createSimulatorUrl: simulatorUrl.createSimulatorUrl,
17
+ extractResourceCSP: simulator.extractResourceCSP,
18
+ extractResourceKey: discovery.extractResourceKey,
19
+ extractSimulationKey: discovery.extractSimulationKey,
20
+ findResourceDirs: discovery.findResourceDirs,
21
+ findResourceKey: discovery.findResourceKey,
22
+ getComponentName: discovery.getComponentName,
23
+ resolveServerToolResult: simulator.resolveServerToolResult,
24
+ toPascalCase: discovery.toPascalCase,
25
+ useThemeContext: simulator.useThemeContext
26
+ }, Symbol.toStringTag, { value: "Module" }));
27
+ exports.index = index;
28
+ //# sourceMappingURL=index-bKBBCBK6.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-bKBBCBK6.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;"}