sunpeak 0.19.2 → 0.19.10

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 (90) hide show
  1. package/README.md +6 -4
  2. package/bin/commands/dev.mjs +1 -1
  3. package/bin/commands/inspect.mjs +1 -1
  4. package/bin/commands/new.mjs +9 -5
  5. package/bin/commands/start.mjs +3 -1
  6. package/bin/commands/test-init.mjs +478 -76
  7. package/bin/commands/test.mjs +357 -4
  8. package/bin/lib/eval/eval-reporter.mjs +105 -0
  9. package/bin/lib/eval/eval-runner.mjs +310 -0
  10. package/bin/lib/eval/eval-types.d.mts +168 -0
  11. package/bin/lib/eval/eval-vitest-plugin.mjs +158 -0
  12. package/bin/lib/eval/model-registry.mjs +73 -0
  13. package/bin/lib/sandbox-server.mjs +5 -2
  14. package/bin/sunpeak.js +1 -0
  15. package/dist/chatgpt/index.cjs +1 -1
  16. package/dist/chatgpt/index.js +1 -1
  17. package/dist/claude/index.cjs +1 -1
  18. package/dist/claude/index.js +1 -1
  19. package/dist/host/chatgpt/index.cjs +1 -1
  20. package/dist/host/chatgpt/index.js +1 -1
  21. package/dist/index.cjs +134 -124
  22. package/dist/index.cjs.map +1 -1
  23. package/dist/index.d.ts +3 -1
  24. package/dist/index.js +71 -62
  25. package/dist/index.js.map +1 -1
  26. package/dist/inspector/index.cjs +1 -1
  27. package/dist/inspector/index.js +1 -1
  28. package/dist/{inspector-Cdo5BK2D.js → inspector-D5DckQuU.js} +236 -98
  29. package/dist/inspector-D5DckQuU.js.map +1 -0
  30. package/dist/{inspector-8nPV2A-z.cjs → inspector-jY9O18z9.cjs} +237 -99
  31. package/dist/inspector-jY9O18z9.cjs.map +1 -0
  32. package/dist/mcp/index.cjs +237 -140
  33. package/dist/mcp/index.cjs.map +1 -1
  34. package/dist/mcp/index.d.ts +1 -1
  35. package/dist/mcp/index.js +230 -134
  36. package/dist/mcp/index.js.map +1 -1
  37. package/dist/mcp/production-server.d.ts +31 -0
  38. package/dist/{protocol-C7kTcBr_.cjs → protocol-C8pFDmcy.cjs} +8194 -8187
  39. package/dist/protocol-C8pFDmcy.cjs.map +1 -0
  40. package/dist/{protocol-BfAACnv0.js → protocol-CRqiPTLT.js} +8186 -8185
  41. package/dist/protocol-CRqiPTLT.js.map +1 -0
  42. package/dist/{use-app-CfP9VypY.js → use-app-Bfargfa3.js} +194 -94
  43. package/dist/use-app-Bfargfa3.js.map +1 -0
  44. package/dist/{use-app-CzcYw1Kz.cjs → use-app-CbsBEmwv.cjs} +254 -148
  45. package/dist/use-app-CbsBEmwv.cjs.map +1 -0
  46. package/package.json +27 -3
  47. package/template/README.md +17 -7
  48. package/template/_gitignore +2 -0
  49. package/template/dist/albums/albums.html +15 -15
  50. package/template/dist/albums/albums.json +1 -1
  51. package/template/dist/carousel/carousel.html +19 -19
  52. package/template/dist/carousel/carousel.json +1 -1
  53. package/template/dist/map/map.html +14 -14
  54. package/template/dist/map/map.json +1 -1
  55. package/template/dist/review/review.html +11 -11
  56. package/template/dist/review/review.json +1 -1
  57. package/template/node_modules/.bin/vitest +2 -2
  58. package/template/node_modules/.vite/deps/_metadata.json +3 -3
  59. package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps.js +192 -91
  60. package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps.js.map +1 -1
  61. package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps_app-bridge.js +231 -92
  62. package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps_app-bridge.js.map +1 -1
  63. package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps_react.js +208 -105
  64. package/template/node_modules/.vite-mcp/deps/@modelcontextprotocol_ext-apps_react.js.map +1 -1
  65. package/template/node_modules/.vite-mcp/deps/_metadata.json +25 -25
  66. package/template/node_modules/.vite-mcp/deps/{protocol-B_qKkui_.js → protocol-BqGB4zBx.js} +45 -45
  67. package/template/node_modules/.vite-mcp/deps/protocol-BqGB4zBx.js.map +1 -0
  68. package/template/node_modules/.vite-mcp/deps/vitest.js +7 -7
  69. package/template/node_modules/.vite-mcp/deps/vitest.js.map +1 -1
  70. package/template/tests/e2e/visual.spec.ts-snapshots/albums-dark-chatgpt-darwin.png +0 -0
  71. package/template/tests/e2e/visual.spec.ts-snapshots/albums-dark-claude-darwin.png +0 -0
  72. package/template/tests/e2e/visual.spec.ts-snapshots/albums-fullscreen-chatgpt-darwin.png +0 -0
  73. package/template/tests/e2e/visual.spec.ts-snapshots/albums-fullscreen-claude-darwin.png +0 -0
  74. package/template/tests/e2e/visual.spec.ts-snapshots/albums-light-chatgpt-darwin.png +0 -0
  75. package/template/tests/e2e/visual.spec.ts-snapshots/albums-light-claude-darwin.png +0 -0
  76. package/template/tests/e2e/visual.spec.ts-snapshots/albums-page-light-chatgpt-darwin.png +0 -0
  77. package/template/tests/e2e/visual.spec.ts-snapshots/albums-page-light-claude-darwin.png +0 -0
  78. package/template/tests/evals/.env.example +5 -0
  79. package/template/tests/evals/albums.eval.ts +28 -0
  80. package/template/tests/evals/carousel.eval.ts +26 -0
  81. package/template/tests/evals/eval.config.ts +26 -0
  82. package/template/tests/evals/map.eval.ts +23 -0
  83. package/template/tests/evals/review.eval.ts +48 -0
  84. package/dist/inspector-8nPV2A-z.cjs.map +0 -1
  85. package/dist/inspector-Cdo5BK2D.js.map +0 -1
  86. package/dist/protocol-BfAACnv0.js.map +0 -1
  87. package/dist/protocol-C7kTcBr_.cjs.map +0 -1
  88. package/dist/use-app-CfP9VypY.js.map +0 -1
  89. package/dist/use-app-CzcYw1Kz.cjs.map +0 -1
  90. package/template/node_modules/.vite-mcp/deps/protocol-B_qKkui_.js.map +0 -1
@@ -0,0 +1,5 @@
1
+ # Copy this file to .env and fill in your API keys.
2
+ # .env is gitignored — never commit API keys.
3
+ # OPENAI_API_KEY=sk-...
4
+ # ANTHROPIC_API_KEY=sk-ant-...
5
+ # GOOGLE_GENERATIVE_AI_API_KEY=...
@@ -0,0 +1,28 @@
1
+ import { expect } from 'vitest';
2
+ import { defineEval } from 'sunpeak/eval';
3
+
4
+ export default defineEval({
5
+ cases: [
6
+ {
7
+ name: 'asks for photo albums',
8
+ prompt: 'Show me my photo albums',
9
+ expect: { tool: 'show-albums' },
10
+ },
11
+ {
12
+ name: 'asks for food photos',
13
+ prompt: 'Show me photos from my Austin pizza tour',
14
+ expect: {
15
+ tool: 'show-albums',
16
+ args: { search: expect.stringMatching(/pizza|austin/i) },
17
+ },
18
+ },
19
+ {
20
+ name: 'asks for a specific category',
21
+ prompt: 'Show me my travel photos',
22
+ expect: {
23
+ tool: 'show-albums',
24
+ args: { category: expect.stringMatching(/travel/i) },
25
+ },
26
+ },
27
+ ],
28
+ });
@@ -0,0 +1,26 @@
1
+ import { expect } from 'vitest';
2
+ import { defineEval } from 'sunpeak/eval';
3
+
4
+ export default defineEval({
5
+ cases: [
6
+ {
7
+ name: 'asks for popular places',
8
+ prompt: 'Show me popular places to visit in Tokyo',
9
+ expect: {
10
+ tool: 'show-carousel',
11
+ args: { city: expect.stringMatching(/tokyo/i) },
12
+ },
13
+ },
14
+ {
15
+ name: 'asks for restaurants',
16
+ prompt: 'What are some good restaurants in Paris?',
17
+ expect: {
18
+ tool: 'show-carousel',
19
+ args: {
20
+ city: expect.stringMatching(/paris/i),
21
+ categories: expect.arrayContaining([expect.stringMatching(/restaurant|food|dining/i)]),
22
+ },
23
+ },
24
+ },
25
+ ],
26
+ });
@@ -0,0 +1,26 @@
1
+ import { defineEvalConfig } from 'sunpeak/eval';
2
+
3
+ // API keys are loaded automatically from tests/evals/.env (gitignored).
4
+ // See .env.example for the format.
5
+
6
+ export default defineEvalConfig({
7
+ // Server is auto-detected for sunpeak projects.
8
+ // For non-sunpeak projects, uncomment:
9
+ // server: 'http://localhost:8000/mcp',
10
+
11
+ models: [
12
+ // Uncomment models and install their provider packages:
13
+ // 'gpt-4o', // OPENAI_API_KEY
14
+ // 'gpt-4o-mini', // OPENAI_API_KEY
15
+ // 'o4-mini', // OPENAI_API_KEY
16
+ // 'claude-sonnet-4-20250514', // ANTHROPIC_API_KEY
17
+ // 'gemini-2.0-flash', // GOOGLE_GENERATIVE_AI_API_KEY
18
+ ],
19
+
20
+ defaults: {
21
+ runs: 10, // Number of times to run each case per model
22
+ maxSteps: 1, // Max tool call steps per run
23
+ temperature: 0, // 0 for most deterministic results
24
+ timeout: 30_000, // Timeout per run in ms
25
+ },
26
+ });
@@ -0,0 +1,23 @@
1
+ import { expect } from 'vitest';
2
+ import { defineEval } from 'sunpeak/eval';
3
+
4
+ export default defineEval({
5
+ cases: [
6
+ {
7
+ name: 'asks for a map',
8
+ prompt: 'Show me a map of coffee shops near downtown Austin',
9
+ expect: {
10
+ tool: 'show-map',
11
+ args: { query: expect.stringMatching(/coffee/i) },
12
+ },
13
+ },
14
+ {
15
+ name: 'asks for nearby places',
16
+ prompt: 'Find me some parks nearby',
17
+ expect: {
18
+ tool: 'show-map',
19
+ args: { query: expect.stringMatching(/park/i) },
20
+ },
21
+ },
22
+ ],
23
+ });
@@ -0,0 +1,48 @@
1
+ import { expect } from 'vitest';
2
+ import { defineEval } from 'sunpeak/eval';
3
+
4
+ export default defineEval({
5
+ cases: [
6
+ {
7
+ name: 'asks to review a code diff',
8
+ prompt: 'Review my code changes to the auth module',
9
+ expect: { tool: 'review-diff' },
10
+ },
11
+ {
12
+ name: 'asks to draft a social post',
13
+ prompt: 'Write a launch announcement for X and LinkedIn',
14
+ expect: {
15
+ tool: 'review-post',
16
+ args: { platforms: expect.arrayContaining([expect.stringMatching(/x|twitter/i)]) },
17
+ },
18
+ },
19
+ {
20
+ name: 'asks to review a purchase',
21
+ prompt: 'Review my order for the Pro plan upgrade',
22
+ expect: { tool: 'review-purchase' },
23
+ },
24
+
25
+ // --- Other assertion patterns ---
26
+ //
27
+ // Multi-step (ordered tool call sequence):
28
+ // {
29
+ // name: 'multi-step flow',
30
+ // prompt: 'Draft a post and then review it',
31
+ // maxSteps: 3,
32
+ // expect: [
33
+ // { tool: 'review-post' },
34
+ // { tool: 'publish-post' },
35
+ // ],
36
+ // },
37
+ //
38
+ // Custom assertion (full access to result):
39
+ // {
40
+ // name: 'custom check',
41
+ // prompt: 'Show me my recent reviews',
42
+ // assert: (result) => {
43
+ // expect(result.toolCalls).toHaveLength(1);
44
+ // expect(result.toolCalls[0].name).toBe('review-diff');
45
+ // },
46
+ // },
47
+ ],
48
+ });