sunpeak 0.9.3 → 0.9.8
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.
- package/README.md +2 -2
- package/dist/chatgpt/conversation.d.ts +5 -2
- package/dist/chatgpt/iframe-resource.d.ts +69 -0
- package/dist/chatgpt/index.cjs +2 -1
- package/dist/chatgpt/index.cjs.map +1 -1
- package/dist/chatgpt/index.d.ts +1 -0
- package/dist/chatgpt/index.js +2 -1
- package/dist/chatgpt/simple-sidebar.d.ts +2 -2
- package/dist/index.cjs +2 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -2
- package/dist/{simulator-url-CG8lAAC3.cjs → simulator-url-BpCa95pE.cjs} +876 -251
- package/dist/simulator-url-BpCa95pE.cjs.map +1 -0
- package/dist/{simulator-url-CexnaL-e.js → simulator-url-q5tHLc4-.js} +876 -251
- package/dist/simulator-url-q5tHLc4-.js.map +1 -0
- package/dist/style.css +12 -0
- package/dist/types/simulation.d.ts +4 -1
- package/package.json +1 -1
- package/template/README.md +2 -2
- package/template/dist/albums.js +7 -7
- package/template/dist/albums.json +1 -1
- package/template/dist/carousel.js +6 -6
- package/template/dist/carousel.json +1 -1
- package/template/dist/map.js +17 -17
- package/template/dist/map.json +1 -1
- package/template/dist/review.js +7 -7
- package/template/dist/review.json +1 -1
- package/template/node_modules/.vite/deps/_metadata.json +19 -19
- package/template/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -1
- package/template/src/components/album/album-carousel.tsx +28 -3
- package/template/src/components/carousel/carousel.tsx +28 -3
- package/dist/simulator-url-CG8lAAC3.cjs.map +0 -1
- package/dist/simulator-url-CexnaL-e.js.map +0 -1
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
[](https://www.npmjs.com/package/sunpeak)
|
|
13
13
|
[](https://github.com/Sunpeak-AI/sunpeak/actions)
|
|
14
14
|
[](https://github.com/Sunpeak-AI/sunpeak/blob/main/LICENSE)
|
|
15
|
-
[](https://www.typescriptlang.org/)
|
|
16
16
|
[](https://reactjs.org/)
|
|
17
17
|
|
|
18
18
|
The ChatGPT App framework.
|
|
@@ -57,7 +57,7 @@ sunpeak is an npm package consisting of:
|
|
|
57
57
|
2. **The `sunpeak` framework** (`./template`). Next.js for ChatGPT Apps. This templated npm package includes:
|
|
58
58
|
1. Project scaffold - Complete development setup with build, test, and mcp tooling, including the sunpeak library.
|
|
59
59
|
2. UI components - Production-ready components following ChatGPT design guidelines and using OpenAI apps-sdk-ui React components.
|
|
60
|
-
3. Convention over configuration - Create UIs (resources) by simply creating a `resources/NAME-resource.tsx` React file and `resources/NAME-resource.json` metadata file.
|
|
60
|
+
3. Convention over configuration - Create UIs (resources) by simply creating a `src/resources/NAME-resource.tsx` React file and `src/resources/NAME-resource.json` metadata file.
|
|
61
61
|
3. **The `sunpeak` CLI** (`./bin`). Commands for managing ChatGPT Apps. Includes a client for the [sunpeak Resource Repository](https://app.sunpeak.ai/) (ECR for ChatGPT Apps). The repository helps you & your CI/CD decouple your App from your client-agnostic MCP server:
|
|
62
62
|
1. Tag your app builds with version numbers and environment names (like `v1.0.0` and `prod`)
|
|
63
63
|
2. `push` built Apps to a central location
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { ScreenWidth } from './chatgpt-simulator-types';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
interface ConversationProps {
|
|
4
|
-
|
|
4
|
+
/** React content to render (mutually exclusive with iframeScriptSrc) */
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
/** URL to a built .js file to render in an iframe (mutually exclusive with children) */
|
|
7
|
+
iframeScriptSrc?: string;
|
|
5
8
|
screenWidth: ScreenWidth;
|
|
6
9
|
appName?: string;
|
|
7
10
|
appIcon?: string;
|
|
8
11
|
userMessage?: string;
|
|
9
12
|
resourceMeta?: Record<string, unknown>;
|
|
10
13
|
}
|
|
11
|
-
export declare function Conversation({ children, screenWidth, appName, appIcon, userMessage, resourceMeta, }: ConversationProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare function Conversation({ children, iframeScriptSrc, screenWidth, appName, appIcon, userMessage, resourceMeta, }: ConversationProps): import("react/jsx-runtime").JSX.Element;
|
|
12
15
|
export {};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Escapes HTML special characters to prevent XSS via attribute injection.
|
|
4
|
+
*/
|
|
5
|
+
declare function escapeHtml(str: string): string;
|
|
6
|
+
/**
|
|
7
|
+
* Validates that a script source URL is from an allowed origin.
|
|
8
|
+
* Allows same-origin scripts and scripts from whitelisted domains.
|
|
9
|
+
*/
|
|
10
|
+
declare function isAllowedScriptSrc(src: string): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Generates a Content Security Policy string from CSP configuration.
|
|
13
|
+
* Creates a restrictive policy that only allows specified domains.
|
|
14
|
+
*/
|
|
15
|
+
declare function generateCSP(csp: WidgetCSP | undefined, scriptSrc: string): string;
|
|
16
|
+
/**
|
|
17
|
+
* Content Security Policy configuration for iframe resources.
|
|
18
|
+
* Maps to the openai/widgetCSP field in resource JSON files.
|
|
19
|
+
*/
|
|
20
|
+
export interface WidgetCSP {
|
|
21
|
+
/** Domains allowed for fetch/XHR/WebSocket connections */
|
|
22
|
+
connect_domains?: string[];
|
|
23
|
+
/** Domains allowed for scripts, images, styles, fonts */
|
|
24
|
+
resource_domains?: string[];
|
|
25
|
+
}
|
|
26
|
+
interface IframeResourceProps {
|
|
27
|
+
/** URL to a built .js file to load in the iframe. The HTML wrapper is generated automatically. */
|
|
28
|
+
scriptSrc: string;
|
|
29
|
+
/** Optional className for the iframe container */
|
|
30
|
+
className?: string;
|
|
31
|
+
/** Optional style for the iframe */
|
|
32
|
+
style?: React.CSSProperties;
|
|
33
|
+
/** Optional Content Security Policy configuration */
|
|
34
|
+
csp?: WidgetCSP;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Generates the bridge script with allowed parent origins injected.
|
|
38
|
+
* This bridges the MessageChannel API with the window.openai interface.
|
|
39
|
+
* Uses MessageChannel for secure communication instead of postMessage('*').
|
|
40
|
+
*/
|
|
41
|
+
declare function generateBridgeScript(allowedParentOrigins: string[]): string;
|
|
42
|
+
/**
|
|
43
|
+
* Generates HTML wrapper for a script URL.
|
|
44
|
+
* Includes minimal styling for transparent background and full-size root.
|
|
45
|
+
* The scriptSrc is escaped to prevent XSS via attribute injection.
|
|
46
|
+
*/
|
|
47
|
+
declare function generateScriptHtml(scriptSrc: string, theme: string, cspPolicy: string): string;
|
|
48
|
+
/**
|
|
49
|
+
* IframeResource renders production .js files in an actual iframe.
|
|
50
|
+
*
|
|
51
|
+
* It sets up a postMessage bridge to communicate window.openai state
|
|
52
|
+
* between the parent simulator and the iframe content.
|
|
53
|
+
*
|
|
54
|
+
* Usage:
|
|
55
|
+
* ```tsx
|
|
56
|
+
* <IframeResource scriptSrc="/dist/carousel.js" />
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
export declare function IframeResource({ scriptSrc, className, style, csp }: IframeResourceProps): import("react/jsx-runtime").JSX.Element;
|
|
60
|
+
export declare const _testExports: {
|
|
61
|
+
escapeHtml: typeof escapeHtml;
|
|
62
|
+
isAllowedScriptSrc: typeof isAllowedScriptSrc;
|
|
63
|
+
generateBridgeScript: typeof generateBridgeScript;
|
|
64
|
+
generateCSP: typeof generateCSP;
|
|
65
|
+
generateScriptHtml: typeof generateScriptHtml;
|
|
66
|
+
ALLOWED_SCRIPT_ORIGINS: string[];
|
|
67
|
+
ALLOWED_PARENT_ORIGINS: string[];
|
|
68
|
+
};
|
|
69
|
+
export {};
|
package/dist/chatgpt/index.cjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const simulatorUrl = require("../simulator-url-
|
|
3
|
+
const simulatorUrl = require("../simulator-url-BpCa95pE.cjs");
|
|
4
4
|
exports.ChatGPTSimulator = simulatorUrl.ChatGPTSimulator;
|
|
5
|
+
exports.IframeResource = simulatorUrl.IframeResource;
|
|
5
6
|
exports.ThemeProvider = simulatorUrl.ThemeProvider;
|
|
6
7
|
exports.createSimulatorUrl = simulatorUrl.createSimulatorUrl;
|
|
7
8
|
exports.initMockOpenAI = simulatorUrl.initMockOpenAI;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
|
package/dist/chatgpt/index.d.ts
CHANGED
package/dist/chatgpt/index.js
CHANGED
|
@@ -45,10 +45,10 @@ interface SidebarTextareaProps {
|
|
|
45
45
|
onFocus?: () => void;
|
|
46
46
|
onBlur?: () => void;
|
|
47
47
|
placeholder?: string;
|
|
48
|
-
|
|
48
|
+
maxRows?: number;
|
|
49
49
|
error?: string;
|
|
50
50
|
}
|
|
51
|
-
export declare function SidebarTextarea({ value, onChange, onFocus, onBlur, placeholder,
|
|
51
|
+
export declare function SidebarTextarea({ value, onChange, onFocus, onBlur, placeholder, maxRows, error, }: SidebarTextareaProps): import("react/jsx-runtime").JSX.Element;
|
|
52
52
|
interface SidebarToggleProps {
|
|
53
53
|
value: string;
|
|
54
54
|
onChange: (value: string) => void;
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const simulatorUrl = require("./simulator-url-
|
|
3
|
+
const simulatorUrl = require("./simulator-url-BpCa95pE.cjs");
|
|
4
4
|
const React = require("react");
|
|
5
5
|
const discovery = require("./discovery-a4WId9PC.cjs");
|
|
6
6
|
function _interopNamespaceDefault(e) {
|
|
@@ -3054,6 +3054,7 @@ const prefersReducedMotion = createMediaQueryFn("(prefers-reduced-motion: reduce
|
|
|
3054
3054
|
const isPrimarilyTouchDevice = createMediaQueryFn("(pointer: coarse)");
|
|
3055
3055
|
const isHoverAvailable = createMediaQueryFn("(hover: hover)");
|
|
3056
3056
|
exports.ChatGPTSimulator = simulatorUrl.ChatGPTSimulator;
|
|
3057
|
+
exports.IframeResource = simulatorUrl.IframeResource;
|
|
3057
3058
|
exports.SCREEN_WIDTHS = simulatorUrl.SCREEN_WIDTHS;
|
|
3058
3059
|
exports.ThemeProvider = simulatorUrl.ThemeProvider;
|
|
3059
3060
|
exports.createSimulatorUrl = simulatorUrl.createSimulatorUrl;
|