sunpeak 0.14.3 → 0.15.1

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 (128) hide show
  1. package/README.md +32 -28
  2. package/bin/commands/build.mjs +2 -1
  3. package/bin/commands/dev.mjs +72 -2
  4. package/dist/chatgpt/{conversation.d.ts → chatgpt-conversation.d.ts} +1 -1
  5. package/dist/chatgpt/chatgpt-host.d.ts +1 -0
  6. package/dist/chatgpt/globals.css +618 -6156
  7. package/dist/chatgpt/index.cjs +11 -8
  8. package/dist/chatgpt/index.cjs.map +1 -1
  9. package/dist/chatgpt/index.d.ts +10 -32
  10. package/dist/chatgpt/index.js +15 -12
  11. package/dist/chatgpt/index.js.map +1 -1
  12. package/dist/claude/claude-conversation.d.ts +23 -0
  13. package/dist/claude/claude-host.d.ts +1 -0
  14. package/dist/claude/index.cjs +6 -0
  15. package/dist/claude/index.cjs.map +1 -0
  16. package/dist/claude/index.d.ts +1 -0
  17. package/dist/claude/index.js +6 -0
  18. package/dist/claude/index.js.map +1 -0
  19. package/dist/claude-host-C7KPfOM8.cjs +284 -0
  20. package/dist/claude-host-C7KPfOM8.cjs.map +1 -0
  21. package/dist/claude-host-CaD7ptbt.js +283 -0
  22. package/dist/claude-host-CaD7ptbt.js.map +1 -0
  23. package/dist/{discovery-COZUnY6a.js → discovery-DzV3HLXs.js} +5 -5
  24. package/dist/{discovery-COZUnY6a.js.map → discovery-DzV3HLXs.js.map} +1 -1
  25. package/dist/hooks/index.d.ts +4 -0
  26. package/dist/hooks/use-app-tools.d.ts +44 -0
  27. package/dist/hooks/use-update-model-context.d.ts +29 -0
  28. package/dist/index-BKrboRah.js +44 -0
  29. package/dist/index-BKrboRah.js.map +1 -0
  30. package/dist/index-BSKuY-oH.cjs +527 -0
  31. package/dist/index-BSKuY-oH.cjs.map +1 -0
  32. package/dist/index-CiqvXo8n.js +512 -0
  33. package/dist/index-CiqvXo8n.js.map +1 -0
  34. package/dist/index-Dr-L0Nb3.cjs +43 -0
  35. package/dist/index-Dr-L0Nb3.cjs.map +1 -0
  36. package/dist/index.cjs +1705 -1647
  37. package/dist/index.cjs.map +1 -1
  38. package/dist/index.d.ts +2 -1
  39. package/dist/index.js +2732 -2675
  40. package/dist/index.js.map +1 -1
  41. package/dist/lib/default-style-variables.d.ts +2 -0
  42. package/dist/lib/discovery-cli.js +1 -1
  43. package/dist/mcp/index.cjs +86 -27
  44. package/dist/mcp/index.cjs.map +1 -1
  45. package/dist/mcp/index.d.ts +3 -1
  46. package/dist/mcp/index.js +85 -26
  47. package/dist/mcp/index.js.map +1 -1
  48. package/dist/mcp/server.d.ts +4 -3
  49. package/dist/mcp/types.d.ts +11 -0
  50. package/dist/platform/chatgpt/index.cjs +1 -1
  51. package/dist/platform/chatgpt/index.js +1 -1
  52. package/dist/platform/index.cjs +3 -0
  53. package/dist/platform/index.cjs.map +1 -1
  54. package/dist/platform/index.d.ts +3 -1
  55. package/dist/platform/index.js +3 -0
  56. package/dist/platform/index.js.map +1 -1
  57. package/dist/{protocol-BQCnIrc9.js → protocol-DFbsCx7E.js} +29 -29
  58. package/dist/{protocol-BQCnIrc9.js.map → protocol-DFbsCx7E.js.map} +1 -1
  59. package/dist/simulator/host-styles.d.ts +5 -0
  60. package/dist/simulator/hosts.d.ts +73 -0
  61. package/dist/{chatgpt → simulator}/iframe-resource.d.ts +27 -3
  62. package/dist/simulator/index.cjs +40 -0
  63. package/dist/simulator/index.cjs.map +1 -0
  64. package/dist/simulator/index.d.ts +18 -0
  65. package/dist/simulator/index.js +40 -0
  66. package/dist/simulator/index.js.map +1 -0
  67. package/dist/{chatgpt → simulator}/mcp-app-host.d.ts +8 -1
  68. package/dist/simulator/mock-openai-runtime.d.ts +20 -0
  69. package/dist/{chatgpt → simulator}/simulator-url.d.ts +8 -1
  70. package/dist/simulator/simulator.d.ts +12 -0
  71. package/dist/{chatgpt → simulator}/theme-provider.d.ts +3 -1
  72. package/dist/simulator/use-simulator-state.d.ts +91 -0
  73. package/dist/simulator-BqZmzFVR.cjs +8214 -0
  74. package/dist/simulator-BqZmzFVR.cjs.map +1 -0
  75. package/dist/simulator-CMgCGNuD.js +8199 -0
  76. package/dist/simulator-CMgCGNuD.js.map +1 -0
  77. package/dist/simulator-url-BQ-7SMht.js +335 -0
  78. package/dist/simulator-url-BQ-7SMht.js.map +1 -0
  79. package/dist/simulator-url-uNqOCaPJ.cjs +334 -0
  80. package/dist/simulator-url-uNqOCaPJ.cjs.map +1 -0
  81. package/dist/style.css +558 -6143
  82. package/dist/types/runtime.d.ts +1 -1
  83. package/dist/{use-app-D7kRAPSG.cjs → use-app-BnoSPiUT.cjs} +2 -1
  84. package/dist/{use-app-D7kRAPSG.cjs.map → use-app-BnoSPiUT.cjs.map} +1 -1
  85. package/dist/{use-app-Dvr4LKs2.js → use-app-D_TeaMFG.js} +4 -3
  86. package/dist/{use-app-Dvr4LKs2.js.map → use-app-D_TeaMFG.js.map} +1 -1
  87. package/package.json +18 -3
  88. package/template/.sunpeak/dev.tsx +4 -4
  89. package/template/.sunpeak/resource-loader.html +1 -1
  90. package/template/node_modules/.bin/nodemon +2 -2
  91. package/template/node_modules/.bin/playwright +2 -2
  92. package/template/node_modules/.bin/sunpeak +2 -2
  93. package/template/node_modules/.bin/tsc +2 -2
  94. package/template/node_modules/.bin/tsserver +2 -2
  95. package/template/node_modules/.bin/tsx +2 -2
  96. package/template/node_modules/.bin/vite +2 -2
  97. package/template/src/components/avatar.tsx +4 -1
  98. package/template/src/components/button.tsx +17 -20
  99. package/template/src/resources/albums/albums-resource.tsx +2 -3
  100. package/template/src/resources/albums/components/album-card.tsx +4 -2
  101. package/template/src/resources/albums/components/film-strip.test.tsx +2 -2
  102. package/template/src/resources/albums/components/film-strip.tsx +2 -2
  103. package/template/src/resources/albums/components/fullscreen-viewer.tsx +7 -5
  104. package/template/src/resources/carousel/carousel-resource.tsx +2 -3
  105. package/template/src/resources/carousel/components/card.test.tsx +3 -2
  106. package/template/src/resources/carousel/components/card.tsx +8 -4
  107. package/template/src/resources/map/components/map-view.tsx +1 -1
  108. package/template/src/resources/map/components/map.tsx +1 -1
  109. package/template/src/resources/map/components/place-card.tsx +8 -4
  110. package/template/src/resources/map/components/place-carousel.tsx +1 -1
  111. package/template/src/resources/map/components/place-inspector.tsx +15 -7
  112. package/template/src/resources/map/components/place-list.tsx +7 -4
  113. package/template/src/resources/map/map-resource.tsx +0 -2
  114. package/template/src/resources/review/review-resource.tsx +61 -27
  115. package/template/tests/e2e/albums.spec.ts +118 -102
  116. package/template/tests/e2e/carousel.spec.ts +103 -100
  117. package/template/tests/e2e/map.spec.ts +220 -181
  118. package/template/tests/e2e/review.spec.ts +224 -198
  119. package/dist/_commonjsHelpers-Bc2YnDe1.cjs +0 -8
  120. package/dist/_commonjsHelpers-Bc2YnDe1.cjs.map +0 -1
  121. package/dist/_commonjsHelpers-DWwsNxpa.js +0 -9
  122. package/dist/_commonjsHelpers-DWwsNxpa.js.map +0 -1
  123. package/dist/index-CJ3jfcjj.js +0 -15131
  124. package/dist/index-CJ3jfcjj.js.map +0 -1
  125. package/dist/index-Cdeg96So.cjs +0 -15147
  126. package/dist/index-Cdeg96So.cjs.map +0 -1
  127. /package/dist/{chatgpt → simulator}/simple-sidebar.d.ts +0 -0
  128. /package/dist/{chatgpt/chatgpt-simulator-types.d.ts → simulator/simulator-types.d.ts} +0 -0
@@ -1,128 +1,131 @@
1
1
  import { test, expect } from '@playwright/test';
2
2
  import { createSimulatorUrl } from 'sunpeak/chatgpt';
3
3
 
4
- test.describe('Carousel Resource', () => {
5
- test.describe('Light Mode', () => {
6
- test('should render carousel cards with correct styles', async ({ page }) => {
7
- await page.goto(createSimulatorUrl({ simulation: 'carousel-show', theme: 'light' }));
8
-
9
- const iframe = page.frameLocator('iframe');
10
- const card = iframe.locator('.rounded-2xl').first();
11
- await expect(card).toBeVisible();
12
-
13
- const styles = await card.evaluate((el) => {
14
- const computed = window.getComputedStyle(el);
15
- return {
16
- borderRadius: computed.borderRadius,
17
- cursor: computed.cursor,
18
- };
4
+ const hosts = ['chatgpt', 'claude'] as const;
5
+
6
+ for (const host of hosts) {
7
+ test.describe(`Carousel Resource [${host}]`, () => {
8
+ test.describe('Light Mode', () => {
9
+ test('should render carousel cards with correct styles', async ({ page }) => {
10
+ await page.goto(createSimulatorUrl({ simulation: 'carousel-show', theme: 'light', host }));
11
+
12
+ const iframe = page.frameLocator('iframe');
13
+ const card = iframe.locator('.rounded-2xl').first();
14
+ await expect(card).toBeVisible();
15
+
16
+ const styles = await card.evaluate((el) => {
17
+ const computed = window.getComputedStyle(el);
18
+ return {
19
+ borderRadius: computed.borderRadius,
20
+ cursor: computed.cursor,
21
+ };
22
+ });
23
+
24
+ expect(styles.borderRadius).toBe('16px'); // rounded-2xl
25
+ expect(styles.cursor).toBe('pointer');
19
26
  });
20
27
 
21
- expect(styles.borderRadius).toBe('16px'); // rounded-2xl
22
- expect(styles.cursor).toBe('pointer');
23
- });
28
+ test('should have card with border styling', async ({ page }) => {
29
+ await page.goto(createSimulatorUrl({ simulation: 'carousel-show', theme: 'light', host }));
24
30
 
25
- test('should have card with border styling', async ({ page }) => {
26
- await page.goto(createSimulatorUrl({ simulation: 'carousel-show', theme: 'light' }));
31
+ const iframe = page.frameLocator('iframe');
32
+ const card = iframe.locator('.rounded-2xl.border').first();
33
+ await expect(card).toBeVisible();
27
34
 
28
- const iframe = page.frameLocator('iframe');
29
- const card = iframe.locator('.rounded-2xl.border').first();
30
- await expect(card).toBeVisible();
35
+ const styles = await card.evaluate((el) => {
36
+ const computed = window.getComputedStyle(el);
37
+ return {
38
+ borderWidth: computed.borderWidth,
39
+ borderStyle: computed.borderStyle,
40
+ };
41
+ });
31
42
 
32
- const styles = await card.evaluate((el) => {
33
- const computed = window.getComputedStyle(el);
34
- return {
35
- borderWidth: computed.borderWidth,
36
- borderStyle: computed.borderStyle,
37
- };
43
+ expect(styles.borderWidth).toBe('1px');
44
+ expect(styles.borderStyle).toBe('solid');
38
45
  });
39
46
 
40
- expect(styles.borderWidth).toBe('1px');
41
- expect(styles.borderStyle).toBe('solid');
42
- });
47
+ test('should have interactive buttons', async ({ page }) => {
48
+ await page.goto(createSimulatorUrl({ simulation: 'carousel-show', theme: 'light', host }));
43
49
 
44
- test('should have interactive buttons', async ({ page }) => {
45
- await page.goto(createSimulatorUrl({ simulation: 'carousel-show', theme: 'light' }));
50
+ const iframe = page.frameLocator('iframe');
51
+ const visitButton = iframe.locator('button:has-text("Visit")').first();
52
+ await expect(visitButton).toBeAttached();
46
53
 
47
- const iframe = page.frameLocator('iframe');
48
- const visitButton = iframe.locator('button:has-text("Visit")').first();
49
- await expect(visitButton).toBeAttached();
54
+ const styles = await visitButton.evaluate((el) => {
55
+ const computed = window.getComputedStyle(el);
56
+ return {
57
+ cursor: computed.cursor,
58
+ };
59
+ });
50
60
 
51
- const styles = await visitButton.evaluate((el) => {
52
- const computed = window.getComputedStyle(el);
53
- return {
54
- cursor: computed.cursor,
55
- };
61
+ expect(styles.cursor).toBe('pointer');
56
62
  });
57
-
58
- expect(styles.cursor).toBe('pointer');
59
63
  });
60
- });
61
64
 
62
- test.describe('Dark Mode', () => {
63
- test('should render carousel cards with correct styles', async ({ page }) => {
64
- await page.goto(createSimulatorUrl({ simulation: 'carousel-show', theme: 'dark' }));
65
+ test.describe('Dark Mode', () => {
66
+ test('should render carousel cards with correct styles', async ({ page }) => {
67
+ await page.goto(createSimulatorUrl({ simulation: 'carousel-show', theme: 'dark', host }));
68
+
69
+ const iframe = page.frameLocator('iframe');
70
+ const card = iframe.locator('.rounded-2xl').first();
71
+ await expect(card).toBeVisible();
65
72
 
66
- const iframe = page.frameLocator('iframe');
67
- const card = iframe.locator('.rounded-2xl').first();
68
- await expect(card).toBeVisible();
73
+ const styles = await card.evaluate((el) => {
74
+ const computed = window.getComputedStyle(el);
75
+ return {
76
+ borderRadius: computed.borderRadius,
77
+ cursor: computed.cursor,
78
+ };
79
+ });
69
80
 
70
- const styles = await card.evaluate((el) => {
71
- const computed = window.getComputedStyle(el);
72
- return {
73
- borderRadius: computed.borderRadius,
74
- cursor: computed.cursor,
75
- };
81
+ expect(styles.borderRadius).toBe('16px'); // rounded-2xl
82
+ expect(styles.cursor).toBe('pointer');
76
83
  });
77
84
 
78
- expect(styles.borderRadius).toBe('16px'); // rounded-2xl
79
- expect(styles.cursor).toBe('pointer');
80
- });
85
+ test('should have appropriate styling for dark mode', async ({ page }) => {
86
+ await page.goto(createSimulatorUrl({ simulation: 'carousel-show', theme: 'dark', host }));
81
87
 
82
- test('should have appropriate background color for dark mode', async ({ page }) => {
83
- await page.goto(createSimulatorUrl({ simulation: 'carousel-show', theme: 'dark' }));
88
+ const iframe = page.frameLocator('iframe');
89
+ // Select card by its border + rounded combo
90
+ const card = iframe.locator('.rounded-2xl.border').first();
91
+ await expect(card).toBeVisible();
84
92
 
85
- const iframe = page.frameLocator('iframe');
86
- const card = iframe.locator('.rounded-2xl.bg-surface').first();
87
- await expect(card).toBeVisible();
93
+ const styles = await card.evaluate((el) => {
94
+ const computed = window.getComputedStyle(el);
95
+ return {
96
+ borderWidth: computed.borderWidth,
97
+ borderStyle: computed.borderStyle,
98
+ };
99
+ });
88
100
 
89
- const styles = await card.evaluate((el) => {
90
- const computed = window.getComputedStyle(el);
91
- return {
92
- backgroundColor: computed.backgroundColor,
93
- };
101
+ expect(styles.borderWidth).toBe('1px');
102
+ expect(styles.borderStyle).toBe('solid');
94
103
  });
95
104
 
96
- // Background color should be set (not transparent)
97
- expect(styles.backgroundColor).toBeTruthy();
98
- expect(styles.backgroundColor).not.toBe('rgba(0, 0, 0, 0)');
99
- });
100
-
101
- test('should load without console errors', async ({ page }) => {
102
- const errors: string[] = [];
103
- page.on('console', (msg) => {
104
- if (msg.type() === 'error') {
105
- errors.push(msg.text());
106
- }
105
+ test('should load without console errors', async ({ page }) => {
106
+ const errors: string[] = [];
107
+ page.on('console', (msg) => {
108
+ if (msg.type() === 'error') {
109
+ errors.push(msg.text());
110
+ }
111
+ });
112
+
113
+ await page.goto(createSimulatorUrl({ simulation: 'carousel-show', theme: 'dark', host }));
114
+
115
+ // Wait for iframe content to render
116
+ const iframe = page.frameLocator('iframe');
117
+ await expect(iframe.locator('.rounded-2xl').first()).toBeVisible();
118
+
119
+ // Filter out expected iframe/MCP handshake errors
120
+ const unexpectedErrors = errors.filter(
121
+ (e) =>
122
+ !e.includes('[IframeResource]') &&
123
+ !e.includes('mcp') &&
124
+ !e.includes('PostMessage') &&
125
+ !e.includes('connect')
126
+ );
127
+ expect(unexpectedErrors).toHaveLength(0);
107
128
  });
108
-
109
- await page.goto(createSimulatorUrl({ simulation: 'carousel-show', theme: 'dark' }));
110
-
111
- // Wait for iframe content to render
112
- const iframe = page.frameLocator('iframe');
113
- await expect(iframe.locator('.rounded-2xl').first()).toBeVisible();
114
-
115
- // Filter out expected iframe/MCP handshake errors
116
- const unexpectedErrors = errors.filter(
117
- (e) =>
118
- !e.includes('[IframeResource]') &&
119
- !e.includes('mcp') &&
120
- !e.includes('PostMessage') &&
121
- !e.includes('connect')
122
- );
123
- expect(unexpectedErrors).toHaveLength(0);
124
129
  });
125
130
  });
126
-
127
- // Note: No fullscreen test for carousel as per requirements
128
- });
131
+ }