@creature-ai/sdk 0.1.1 → 0.1.2

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.
@@ -6,6 +6,13 @@
6
6
  * Environment types for host detection.
7
7
  */
8
8
  type Environment = "chatgpt" | "mcp-apps" | "standalone";
9
+ /**
10
+ * Display modes for UI resources.
11
+ * - "inline": Embedded within the conversation flow
12
+ * - "pip": Picture-in-picture floating panel
13
+ * - "fullscreen": Full-screen overlay
14
+ */
15
+ type DisplayMode = "inline" | "pip" | "fullscreen";
9
16
  /**
10
17
  * Log severity levels matching MCP protocol LoggingLevel.
11
18
  * These are displayed in the host's DevConsole with appropriate colors.
@@ -75,7 +82,8 @@ interface HostContext {
75
82
  styles?: {
76
83
  variables?: Record<string, string>;
77
84
  };
78
- displayMode?: "pip" | "inline";
85
+ displayMode?: DisplayMode;
86
+ availableDisplayModes?: DisplayMode[];
79
87
  viewport?: {
80
88
  width: number;
81
89
  height: number;
@@ -141,6 +149,21 @@ interface HostClient {
141
149
  sendNotification(method: string, params: unknown): void;
142
150
  /** Set widget state */
143
151
  setWidgetState(state: WidgetState | null): void;
152
+ /**
153
+ * Request a display mode change from the host.
154
+ *
155
+ * The host may refuse or coerce the request (e.g., "pip" → "fullscreen" on mobile).
156
+ * Always check `availableDisplayModes` in host context before calling, and handle
157
+ * the returned mode differing from the requested mode.
158
+ *
159
+ * @param params - Object containing the requested display mode
160
+ * @returns Promise resolving to the actual display mode granted by the host
161
+ */
162
+ requestDisplayMode(params: {
163
+ mode: DisplayMode;
164
+ }): Promise<{
165
+ mode: DisplayMode;
166
+ }>;
144
167
  /**
145
168
  * Send a log message to the host's DevConsole.
146
169
  *
@@ -160,4 +183,4 @@ interface HostClient {
160
183
  disconnect(): void;
161
184
  }
162
185
 
163
- export type { AppSessionOptions as A, Environment as E, HostClient as H, LogLevel as L, StructuredWidgetState as S, ToolResult as T, WidgetState as W, AppSessionState as a, AppSessionListener as b, HostContext as c, HostClientConfig as d, HostClientState as e, HostClientEvents as f, StateListener as g };
186
+ export type { AppSessionOptions as A, DisplayMode as D, Environment as E, HostClient as H, LogLevel as L, StructuredWidgetState as S, ToolResult as T, WidgetState as W, AppSessionState as a, AppSessionListener as b, HostContext as c, HostClientConfig as d, HostClientState as e, HostClientEvents as f, StateListener as g };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@creature-ai/sdk",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "SDK for building MCP Apps that work on both Creature and ChatGPT",
5
5
  "type": "module",
6
6
  "exports": {