open-mcp-app 0.0.5 → 0.0.6
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 +158 -0
- package/dist/core/index.d.ts +44 -42
- package/dist/core/index.js +57 -142
- package/dist/core/index.js.map +1 -1
- package/dist/react/index.d.ts +20 -3
- package/dist/react/index.js +62 -23
- package/dist/react/index.js.map +1 -1
- package/dist/server/index.d.ts +2 -1
- package/dist/server/index.js +11 -6
- package/dist/server/index.js.map +1 -1
- package/dist/styles/index.css +4 -0
- package/dist/styles/reset.css +22 -0
- package/dist/styles/theme.css +119 -0
- package/dist/styles/utilities.css +98 -0
- package/package.json +11 -3
- package/dist/styles/base.css +0 -745
package/README.md
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
# open-mcp-app
|
|
2
|
+
|
|
3
|
+
SDK for building MCP Apps that work on any MCP App host (Creature, ChatGPT, Claude Desktop).
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install open-mcp-app
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
### Server-side (Express)
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { createApp } from "open-mcp-app/server";
|
|
17
|
+
import { z } from "zod";
|
|
18
|
+
|
|
19
|
+
const app = createApp({ name: "My App", version: "1.0.0" })
|
|
20
|
+
.tool("greet", {
|
|
21
|
+
description: "Greet a user",
|
|
22
|
+
parameters: z.object({ name: z.string() }),
|
|
23
|
+
execute: async ({ name }) => ({
|
|
24
|
+
content: [{ type: "text", text: `Hello, ${name}!` }],
|
|
25
|
+
}),
|
|
26
|
+
})
|
|
27
|
+
.build();
|
|
28
|
+
|
|
29
|
+
app.listen(3000);
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Client-side (React)
|
|
33
|
+
|
|
34
|
+
```tsx
|
|
35
|
+
import { HostProvider, useHost } from "open-mcp-app/react";
|
|
36
|
+
|
|
37
|
+
function App() {
|
|
38
|
+
return (
|
|
39
|
+
<HostProvider name="My App">
|
|
40
|
+
<MyWidget />
|
|
41
|
+
</HostProvider>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function MyWidget() {
|
|
46
|
+
const host = useHost();
|
|
47
|
+
|
|
48
|
+
const handleClick = async () => {
|
|
49
|
+
const result = await host.callTool("greet", { name: "World" });
|
|
50
|
+
console.log(result);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
return <button onClick={handleClick}>Greet</button>;
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Host Compatibility
|
|
58
|
+
|
|
59
|
+
| Feature | Creature | ChatGPT | Claude Desktop |
|
|
60
|
+
|---------|----------|---------|----------------|
|
|
61
|
+
| Tool Calls | ✅ | ✅ | ✅ |
|
|
62
|
+
| Display Modes | ✅ | ✅ | ❌ |
|
|
63
|
+
| Widget State | ✅ | ✅ | ✅ |
|
|
64
|
+
| Update Model Context | ✅ | ✅ | ✅ |
|
|
65
|
+
| Multi-Instance | ✅ | ❌ | ❌ |
|
|
66
|
+
| Theme Sync | ✅ | ❌ | ✅ |
|
|
67
|
+
|
|
68
|
+
## Core Concepts
|
|
69
|
+
|
|
70
|
+
### Widget State
|
|
71
|
+
|
|
72
|
+
Persist UI state across sessions using `widgetState`. Supports two segments:
|
|
73
|
+
|
|
74
|
+
- **modelContent**: Visible to the AI model in future turns
|
|
75
|
+
- **privateContent**: UI-only, hidden from the model
|
|
76
|
+
|
|
77
|
+
```tsx
|
|
78
|
+
const host = useHost();
|
|
79
|
+
|
|
80
|
+
// Set widget state
|
|
81
|
+
host.exp.setWidgetState({
|
|
82
|
+
modelContent: "User is on the settings page",
|
|
83
|
+
privateContent: { theme: "dark", collapsed: false },
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
// Read current state
|
|
87
|
+
const state = host.widgetState;
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Update Model Context
|
|
91
|
+
|
|
92
|
+
Explicitly inform the AI model about user actions without triggering an immediate response. Use this when the UI needs the model to know about important interactions (file selections, preferences, etc.) for future turns.
|
|
93
|
+
|
|
94
|
+
```tsx
|
|
95
|
+
const { updateModelContext } = useHost();
|
|
96
|
+
|
|
97
|
+
// Inform the model about a user action
|
|
98
|
+
await updateModelContext([
|
|
99
|
+
{ type: "text", text: "User selected file: /src/App.tsx" },
|
|
100
|
+
]);
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
**Host Behavior:**
|
|
104
|
+
- **Creature**: Sends `ui/update-model-context` notification per MCP Apps spec
|
|
105
|
+
- **ChatGPT**: Maps to `setWidgetState` per their MCP Apps compatibility layer
|
|
106
|
+
- **Claude Desktop**: Supported via MCP Apps protocol
|
|
107
|
+
|
|
108
|
+
### Tool Visibility
|
|
109
|
+
|
|
110
|
+
Control whether tools are available to the model, UI, or both:
|
|
111
|
+
|
|
112
|
+
```typescript
|
|
113
|
+
.tool("search_internal", {
|
|
114
|
+
description: "Search internal data",
|
|
115
|
+
parameters: z.object({ query: z.string() }),
|
|
116
|
+
execute: async ({ query }) => ({ ... }),
|
|
117
|
+
visibility: "app", // UI-only tool, hidden from AI
|
|
118
|
+
})
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Visibility options:
|
|
122
|
+
- `"model"` (default): AI can call the tool
|
|
123
|
+
- `"app"`: UI-only, hidden from AI
|
|
124
|
+
- `["model", "app"]`: Available to both
|
|
125
|
+
|
|
126
|
+
## Entry Points
|
|
127
|
+
|
|
128
|
+
Import from specific subpaths:
|
|
129
|
+
|
|
130
|
+
```typescript
|
|
131
|
+
import { createApp } from "open-mcp-app/server"; // Server-side
|
|
132
|
+
import { createHost } from "open-mcp-app/core"; // Vanilla JS client
|
|
133
|
+
import { useHost } from "open-mcp-app/react"; // React hooks
|
|
134
|
+
import { mcpAppPlugin } from "open-mcp-app/vite"; // Vite plugin
|
|
135
|
+
import "open-mcp-app/styles/tailwind.css"; // Base styles
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Development
|
|
139
|
+
|
|
140
|
+
### With Vite
|
|
141
|
+
|
|
142
|
+
```typescript
|
|
143
|
+
// vite.config.ts
|
|
144
|
+
import { mcpAppPlugin } from "open-mcp-app/vite";
|
|
145
|
+
|
|
146
|
+
export default {
|
|
147
|
+
plugins: [mcpAppPlugin()],
|
|
148
|
+
};
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
The Vite plugin provides:
|
|
152
|
+
- Hot Module Replacement in the Creature iframe
|
|
153
|
+
- Automatic port discovery between UI and server
|
|
154
|
+
- Development proxy configuration
|
|
155
|
+
|
|
156
|
+
## License
|
|
157
|
+
|
|
158
|
+
MIT
|
package/dist/core/index.d.ts
CHANGED
|
@@ -198,17 +198,6 @@ interface ExpHostApi {
|
|
|
198
198
|
* Creature only - no-op on ChatGPT and generic MCP Apps hosts.
|
|
199
199
|
*/
|
|
200
200
|
setTitle(title: string): void;
|
|
201
|
-
/**
|
|
202
|
-
* Update the model context for future turns.
|
|
203
|
-
*
|
|
204
|
-
* In MCP Apps spec as `ui/update-model-context`. Context is available
|
|
205
|
-
* to the model in future turns without triggering immediate response.
|
|
206
|
-
* Each call overwrites previous context.
|
|
207
|
-
*
|
|
208
|
-
* - MCP Apps hosts: Supported (if host declares capability)
|
|
209
|
-
* - ChatGPT: No-op
|
|
210
|
-
*/
|
|
211
|
-
updateModelContext(content: ContentBlock[]): Promise<void>;
|
|
212
201
|
/**
|
|
213
202
|
* Send a raw notification to the host.
|
|
214
203
|
*
|
|
@@ -322,6 +311,20 @@ interface UnifiedHostClient {
|
|
|
322
311
|
* Falls back to browser console on ChatGPT.
|
|
323
312
|
*/
|
|
324
313
|
log(level: LogLevel, message: string, data?: Record<string, unknown>): void;
|
|
314
|
+
/**
|
|
315
|
+
* Update the model context for future turns.
|
|
316
|
+
*
|
|
317
|
+
* In MCP Apps spec as `ui/update-model-context`. Context is available
|
|
318
|
+
* to the model in future turns without triggering immediate response.
|
|
319
|
+
* Each call overwrites previous context.
|
|
320
|
+
*
|
|
321
|
+
* Use this for ephemeral notifications that don't need persistence.
|
|
322
|
+
* For persistent context, use widgetState.modelContent instead.
|
|
323
|
+
*
|
|
324
|
+
* - MCP Apps hosts: Sends `ui/update-model-context` notification
|
|
325
|
+
* - ChatGPT: Maps to setWidgetState per MCP Apps compatibility
|
|
326
|
+
*/
|
|
327
|
+
updateModelContext(content: ContentBlock[]): Promise<void>;
|
|
325
328
|
/**
|
|
326
329
|
* Register an event handler. Returns unsubscribe function.
|
|
327
330
|
*/
|
|
@@ -521,6 +524,14 @@ declare class CreatureDesktopHostClient extends Subscribable implements UnifiedH
|
|
|
521
524
|
* Send a log message to the host's DevConsole.
|
|
522
525
|
*/
|
|
523
526
|
log(level: LogLevel, message: string, data?: Record<string, unknown>): void;
|
|
527
|
+
/**
|
|
528
|
+
* Update the model context for future turns.
|
|
529
|
+
*
|
|
530
|
+
* Sends `ui/update-model-context` notification per MCP Apps spec.
|
|
531
|
+
* Context is available to the model in future turns without
|
|
532
|
+
* triggering immediate response.
|
|
533
|
+
*/
|
|
534
|
+
updateModelContext(content: ContentBlock[]): Promise<void>;
|
|
524
535
|
on<K extends keyof HostClientEvents>(event: K, handler: HostClientEvents[K]): () => void;
|
|
525
536
|
/**
|
|
526
537
|
* Experimental APIs (shared across all hosts).
|
|
@@ -661,6 +672,14 @@ declare class ClaudeDesktopHostClient extends Subscribable implements UnifiedHos
|
|
|
661
672
|
* Send a log message to the host's DevConsole.
|
|
662
673
|
*/
|
|
663
674
|
log(level: LogLevel, message: string, data?: Record<string, unknown>): void;
|
|
675
|
+
/**
|
|
676
|
+
* Update the model context for future turns.
|
|
677
|
+
*
|
|
678
|
+
* Sends `ui/update-model-context` notification per MCP Apps spec.
|
|
679
|
+
* Context is available to the model in future turns without
|
|
680
|
+
* triggering immediate response.
|
|
681
|
+
*/
|
|
682
|
+
updateModelContext(content: ContentBlock[]): Promise<void>;
|
|
664
683
|
on<K extends keyof HostClientEvents>(event: K, handler: HostClientEvents[K]): () => void;
|
|
665
684
|
/**
|
|
666
685
|
* Experimental APIs (shared across all hosts).
|
|
@@ -811,6 +830,13 @@ declare class ChatGptWebHostClient extends Subscribable implements UnifiedHostCl
|
|
|
811
830
|
* ChatGPT doesn't have a DevConsole, so logs go to browser console only.
|
|
812
831
|
*/
|
|
813
832
|
log(level: LogLevel, message: string, data?: Record<string, unknown>): void;
|
|
833
|
+
/**
|
|
834
|
+
* Update model context for future turns.
|
|
835
|
+
*
|
|
836
|
+
* On ChatGPT, this maps to setWidgetState per their MCP Apps compatibility.
|
|
837
|
+
* The content blocks are converted to a string and stored as modelContent.
|
|
838
|
+
*/
|
|
839
|
+
updateModelContext(content: ContentBlock[]): Promise<void>;
|
|
814
840
|
on<K extends keyof HostClientEvents>(event: K, handler: HostClientEvents[K]): () => void;
|
|
815
841
|
/**
|
|
816
842
|
* Experimental APIs (shared across all hosts).
|
|
@@ -890,6 +916,10 @@ declare class StandaloneHostClient extends Subscribable implements UnifiedHostCl
|
|
|
890
916
|
* Log a message to the console.
|
|
891
917
|
*/
|
|
892
918
|
log(level: LogLevel, message: string, data?: Record<string, unknown>): void;
|
|
919
|
+
/**
|
|
920
|
+
* Update model context - logs in standalone mode.
|
|
921
|
+
*/
|
|
922
|
+
updateModelContext(content: ContentBlock[]): Promise<void>;
|
|
893
923
|
on<K extends keyof HostClientEvents>(event: K, handler: HostClientEvents[K]): () => void;
|
|
894
924
|
/**
|
|
895
925
|
* Experimental APIs for non-standard features.
|
|
@@ -903,28 +933,11 @@ declare class StandaloneHostClient extends Subscribable implements UnifiedHostCl
|
|
|
903
933
|
}
|
|
904
934
|
|
|
905
935
|
/**
|
|
906
|
-
*
|
|
907
|
-
*
|
|
908
|
-
* This module provides SDK-only CSS variables for spacing, containers, and component sizing.
|
|
909
|
-
* These are NOT part of the MCP Apps spec - they are convenient defaults for clean layouts.
|
|
936
|
+
* Style Application Utilities
|
|
910
937
|
*
|
|
911
938
|
* Host-provided spec variables (colors, typography, etc.) are applied automatically
|
|
912
|
-
* when the app initializes via hostContext.styles.variables.
|
|
913
|
-
* initialization is complete, so there's no need for pre-host defaults.
|
|
914
|
-
*
|
|
915
|
-
* Usage:
|
|
916
|
-
* 1. Import base.css which uses these variables
|
|
917
|
-
* 2. Or apply them manually via applyLayoutDefaults()
|
|
918
|
-
*/
|
|
919
|
-
/**
|
|
920
|
-
* SDK-only layout variables for spacing, containers, and component sizing.
|
|
921
|
-
* These are NOT part of the MCP Apps spec but provide sensible defaults
|
|
922
|
-
* for clean layouts.
|
|
923
|
-
*
|
|
924
|
-
* Based on a 4px (0.25rem) base unit, similar to Tailwind's spacing scale.
|
|
925
|
-
* Component sizing follows patterns from @openai/apps-sdk-ui for consistency.
|
|
939
|
+
* when the app initializes via hostContext.styles.variables.
|
|
926
940
|
*/
|
|
927
|
-
declare const LAYOUT_DEFAULTS: Record<string, string>;
|
|
928
941
|
/**
|
|
929
942
|
* Apply CSS variables to an element (defaults to document root).
|
|
930
943
|
*
|
|
@@ -935,17 +948,6 @@ declare const applyStyles: ({ styles, root, }: {
|
|
|
935
948
|
styles: Record<string, string>;
|
|
936
949
|
root?: HTMLElement;
|
|
937
950
|
}) => void;
|
|
938
|
-
/**
|
|
939
|
-
* Apply SDK layout defaults to the document.
|
|
940
|
-
* This applies spacing, container, and control variables.
|
|
941
|
-
*
|
|
942
|
-
* Note: If you import base.css, these variables are already defined via :root.
|
|
943
|
-
* Only call this manually if you need to apply them programmatically or
|
|
944
|
-
* to a specific element other than document root.
|
|
945
|
-
*
|
|
946
|
-
* @param root - Element to apply styles to (defaults to document.documentElement)
|
|
947
|
-
*/
|
|
948
|
-
declare const applyLayoutDefaults: (root?: HTMLElement) => void;
|
|
949
951
|
|
|
950
952
|
/**
|
|
951
953
|
* Create a WebSocket client with automatic reconnection.
|
|
@@ -1023,4 +1025,4 @@ declare const createHost: (config: HostClientConfig) => UnifiedHostClient;
|
|
|
1023
1025
|
*/
|
|
1024
1026
|
declare const createHostAsync: (config: HostClientConfig) => Promise<UnifiedHostClient>;
|
|
1025
1027
|
|
|
1026
|
-
export { ChatGptWebHostClient, ClaudeDesktopHostClient, type ContentBlock, CreatureDesktopHostClient, type DisplayMode, type Environment, type ExpHostApi, type HostClientConfig, type HostClientEvents, type HostClientState, type HostContext, type ImageContentBlock,
|
|
1028
|
+
export { ChatGptWebHostClient, ClaudeDesktopHostClient, type ContentBlock, CreatureDesktopHostClient, type DisplayMode, type Environment, type ExpHostApi, type HostClientConfig, type HostClientEvents, type HostClientState, type HostContext, type ImageContentBlock, type LogLevel, type OpenContext, StandaloneHostClient, type StateListener, type StructuredWidgetState, type TextContentBlock, type ToolResult, type UnifiedHostClient, type WebSocketClient, type WebSocketClientConfig, type WebSocketStatus, type WidgetState, applyStyles, createHost, createHostAsync, createWebSocket, detectEnvironment };
|
package/dist/core/index.js
CHANGED
|
@@ -210,6 +210,27 @@ var ChatGptWebHostClient = class _ChatGptWebHostClient extends Subscribable {
|
|
|
210
210
|
const consoleMethod = level === "error" ? "error" : level === "warning" ? "warn" : "log";
|
|
211
211
|
console[consoleMethod](`[${this.config.name}]`, message, data ?? "");
|
|
212
212
|
}
|
|
213
|
+
/**
|
|
214
|
+
* Update model context for future turns.
|
|
215
|
+
*
|
|
216
|
+
* On ChatGPT, this maps to setWidgetState per their MCP Apps compatibility.
|
|
217
|
+
* The content blocks are converted to a string and stored as modelContent.
|
|
218
|
+
*/
|
|
219
|
+
async updateModelContext(content) {
|
|
220
|
+
if (!window.openai?.setWidgetState) return;
|
|
221
|
+
const textContent = content.filter(
|
|
222
|
+
(block) => block.type === "text" && typeof block.text === "string"
|
|
223
|
+
).map((block) => block.text).join("\n");
|
|
224
|
+
if (!textContent) return;
|
|
225
|
+
const existingState = this.state.widgetState || {};
|
|
226
|
+
const newState = {
|
|
227
|
+
...existingState,
|
|
228
|
+
modelContent: textContent
|
|
229
|
+
};
|
|
230
|
+
this.setState({ widgetState: newState });
|
|
231
|
+
window.openai.setWidgetState(newState);
|
|
232
|
+
this.emit("widget-state-change", newState);
|
|
233
|
+
}
|
|
213
234
|
on(event, handler) {
|
|
214
235
|
if (event === "theme-change" || event === "teardown") {
|
|
215
236
|
return () => {
|
|
@@ -240,9 +261,6 @@ var ChatGptWebHostClient = class _ChatGptWebHostClient extends Subscribable {
|
|
|
240
261
|
setTitle: (_title) => {
|
|
241
262
|
},
|
|
242
263
|
// MCP Apps-only (no-op on ChatGPT)
|
|
243
|
-
updateModelContext: async (_content) => {
|
|
244
|
-
},
|
|
245
|
-
// MCP Apps-only (no-op on ChatGPT)
|
|
246
264
|
sendNotification: (_method, _params) => {
|
|
247
265
|
},
|
|
248
266
|
getInstanceId: () => {
|
|
@@ -9764,6 +9782,21 @@ var CreatureDesktopHostClient = class _CreatureDesktopHostClient extends Subscri
|
|
|
9764
9782
|
data: data ? { message, ...data } : message
|
|
9765
9783
|
});
|
|
9766
9784
|
}
|
|
9785
|
+
/**
|
|
9786
|
+
* Update the model context for future turns.
|
|
9787
|
+
*
|
|
9788
|
+
* Sends `ui/update-model-context` notification per MCP Apps spec.
|
|
9789
|
+
* Context is available to the model in future turns without
|
|
9790
|
+
* triggering immediate response.
|
|
9791
|
+
*/
|
|
9792
|
+
async updateModelContext(content) {
|
|
9793
|
+
if (!this.app) return;
|
|
9794
|
+
this.app.notification({
|
|
9795
|
+
method: "ui/update-model-context",
|
|
9796
|
+
params: { content }
|
|
9797
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9798
|
+
});
|
|
9799
|
+
}
|
|
9767
9800
|
on(event, handler) {
|
|
9768
9801
|
if (event === "theme-change" || event === "teardown") {
|
|
9769
9802
|
return this.onMcpEvent(
|
|
@@ -9805,14 +9838,6 @@ var CreatureDesktopHostClient = class _CreatureDesktopHostClient extends Subscri
|
|
|
9805
9838
|
setTitle: (title) => {
|
|
9806
9839
|
this.sendNotification("ui/notifications/title-changed", { title });
|
|
9807
9840
|
},
|
|
9808
|
-
updateModelContext: async (content) => {
|
|
9809
|
-
if (!this.app) return;
|
|
9810
|
-
this.app.notification({
|
|
9811
|
-
method: "ui/update-model-context",
|
|
9812
|
-
params: { content }
|
|
9813
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9814
|
-
});
|
|
9815
|
-
},
|
|
9816
9841
|
sendNotification: (method, params) => {
|
|
9817
9842
|
this.sendNotification(method, params);
|
|
9818
9843
|
},
|
|
@@ -10135,6 +10160,21 @@ var ClaudeDesktopHostClient = class _ClaudeDesktopHostClient extends Subscribabl
|
|
|
10135
10160
|
data: data ? { message, ...data } : message
|
|
10136
10161
|
});
|
|
10137
10162
|
}
|
|
10163
|
+
/**
|
|
10164
|
+
* Update the model context for future turns.
|
|
10165
|
+
*
|
|
10166
|
+
* Sends `ui/update-model-context` notification per MCP Apps spec.
|
|
10167
|
+
* Context is available to the model in future turns without
|
|
10168
|
+
* triggering immediate response.
|
|
10169
|
+
*/
|
|
10170
|
+
async updateModelContext(content) {
|
|
10171
|
+
if (!this.app) return;
|
|
10172
|
+
this.app.notification({
|
|
10173
|
+
method: "ui/update-model-context",
|
|
10174
|
+
params: { content }
|
|
10175
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10176
|
+
});
|
|
10177
|
+
}
|
|
10138
10178
|
on(event, handler) {
|
|
10139
10179
|
if (event === "theme-change" || event === "teardown") {
|
|
10140
10180
|
return this.onMcpEvent(
|
|
@@ -10176,14 +10216,6 @@ var ClaudeDesktopHostClient = class _ClaudeDesktopHostClient extends Subscribabl
|
|
|
10176
10216
|
// Not supported on Claude Desktop
|
|
10177
10217
|
setTitle: (_title) => {
|
|
10178
10218
|
},
|
|
10179
|
-
updateModelContext: async (content) => {
|
|
10180
|
-
if (!this.app) return;
|
|
10181
|
-
this.app.notification({
|
|
10182
|
-
method: "ui/update-model-context",
|
|
10183
|
-
params: { content }
|
|
10184
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10185
|
-
});
|
|
10186
|
-
},
|
|
10187
10219
|
sendNotification: (method, params) => {
|
|
10188
10220
|
this.sendNotification(method, params);
|
|
10189
10221
|
},
|
|
@@ -10453,6 +10485,12 @@ var StandaloneHostClient = class _StandaloneHostClient extends Subscribable {
|
|
|
10453
10485
|
const consoleMethod = level === "error" ? "error" : level === "warning" ? "warn" : "log";
|
|
10454
10486
|
console[consoleMethod](`[${this.config.name}]`, message, data ?? "");
|
|
10455
10487
|
}
|
|
10488
|
+
/**
|
|
10489
|
+
* Update model context - logs in standalone mode.
|
|
10490
|
+
*/
|
|
10491
|
+
async updateModelContext(content) {
|
|
10492
|
+
console.debug(`[Standalone] updateModelContext(${content.length} blocks)`);
|
|
10493
|
+
}
|
|
10456
10494
|
on(event, handler) {
|
|
10457
10495
|
if (event === "theme-change" || event === "teardown") {
|
|
10458
10496
|
return () => {
|
|
@@ -10479,9 +10517,6 @@ var StandaloneHostClient = class _StandaloneHostClient extends Subscribable {
|
|
|
10479
10517
|
setTitle: (title) => {
|
|
10480
10518
|
console.debug(`[Standalone] exp.setTitle("${title}")`);
|
|
10481
10519
|
},
|
|
10482
|
-
updateModelContext: async (content) => {
|
|
10483
|
-
console.debug(`[Standalone] exp.updateModelContext(${content.length} blocks)`);
|
|
10484
|
-
},
|
|
10485
10520
|
sendNotification: (method, params) => {
|
|
10486
10521
|
console.debug(`[Standalone] exp.sendNotification("${method}")`, params);
|
|
10487
10522
|
},
|
|
@@ -10518,121 +10553,6 @@ var StandaloneHostClient = class _StandaloneHostClient extends Subscribable {
|
|
|
10518
10553
|
};
|
|
10519
10554
|
|
|
10520
10555
|
// src/core/styles.ts
|
|
10521
|
-
var LAYOUT_DEFAULTS = {
|
|
10522
|
-
// Spacing scale (4px base)
|
|
10523
|
-
"--spacing-0": "0",
|
|
10524
|
-
"--spacing-px": "1px",
|
|
10525
|
-
"--spacing-0-5": "0.125rem",
|
|
10526
|
-
// 2px
|
|
10527
|
-
"--spacing-1": "0.25rem",
|
|
10528
|
-
// 4px
|
|
10529
|
-
"--spacing-1-5": "0.375rem",
|
|
10530
|
-
// 6px
|
|
10531
|
-
"--spacing-2": "0.5rem",
|
|
10532
|
-
// 8px
|
|
10533
|
-
"--spacing-2-5": "0.625rem",
|
|
10534
|
-
// 10px
|
|
10535
|
-
"--spacing-3": "0.75rem",
|
|
10536
|
-
// 12px
|
|
10537
|
-
"--spacing-3-5": "0.875rem",
|
|
10538
|
-
// 14px
|
|
10539
|
-
"--spacing-4": "1rem",
|
|
10540
|
-
// 16px
|
|
10541
|
-
"--spacing-5": "1.25rem",
|
|
10542
|
-
// 20px
|
|
10543
|
-
"--spacing-6": "1.5rem",
|
|
10544
|
-
// 24px
|
|
10545
|
-
"--spacing-7": "1.75rem",
|
|
10546
|
-
// 28px
|
|
10547
|
-
"--spacing-8": "2rem",
|
|
10548
|
-
// 32px
|
|
10549
|
-
"--spacing-9": "2.25rem",
|
|
10550
|
-
// 36px
|
|
10551
|
-
"--spacing-10": "2.5rem",
|
|
10552
|
-
// 40px
|
|
10553
|
-
"--spacing-12": "3rem",
|
|
10554
|
-
// 48px
|
|
10555
|
-
"--spacing-14": "3.5rem",
|
|
10556
|
-
// 56px
|
|
10557
|
-
"--spacing-16": "4rem",
|
|
10558
|
-
// 64px
|
|
10559
|
-
"--spacing-20": "5rem",
|
|
10560
|
-
// 80px
|
|
10561
|
-
"--spacing-24": "6rem",
|
|
10562
|
-
// 96px
|
|
10563
|
-
// Container max-widths
|
|
10564
|
-
"--container-xs": "20rem",
|
|
10565
|
-
// 320px
|
|
10566
|
-
"--container-sm": "24rem",
|
|
10567
|
-
// 384px
|
|
10568
|
-
"--container-md": "28rem",
|
|
10569
|
-
// 448px
|
|
10570
|
-
"--container-lg": "32rem",
|
|
10571
|
-
// 512px
|
|
10572
|
-
"--container-xl": "36rem",
|
|
10573
|
-
// 576px
|
|
10574
|
-
"--container-2xl": "42rem",
|
|
10575
|
-
// 672px
|
|
10576
|
-
"--container-3xl": "48rem",
|
|
10577
|
-
// 768px
|
|
10578
|
-
"--container-4xl": "56rem",
|
|
10579
|
-
// 896px
|
|
10580
|
-
"--container-5xl": "64rem",
|
|
10581
|
-
// 1024px
|
|
10582
|
-
"--container-6xl": "72rem",
|
|
10583
|
-
// 1152px
|
|
10584
|
-
"--container-7xl": "80rem",
|
|
10585
|
-
// 1280px
|
|
10586
|
-
"--container-prose": "65ch",
|
|
10587
|
-
// Optimal reading width
|
|
10588
|
-
// Control heights (buttons, inputs)
|
|
10589
|
-
"--control-height-xs": "1.5rem",
|
|
10590
|
-
// 24px
|
|
10591
|
-
"--control-height-sm": "1.75rem",
|
|
10592
|
-
// 28px
|
|
10593
|
-
"--control-height-md": "2rem",
|
|
10594
|
-
// 32px
|
|
10595
|
-
"--control-height-lg": "2.25rem",
|
|
10596
|
-
// 36px
|
|
10597
|
-
"--control-height-xl": "2.5rem",
|
|
10598
|
-
// 40px
|
|
10599
|
-
"--control-height-2xl": "2.75rem",
|
|
10600
|
-
// 44px
|
|
10601
|
-
"--control-height-3xl": "3rem",
|
|
10602
|
-
// 48px
|
|
10603
|
-
// Control padding (internal horizontal padding)
|
|
10604
|
-
"--control-padding-xs": "0.5rem",
|
|
10605
|
-
// 8px
|
|
10606
|
-
"--control-padding-sm": "0.625rem",
|
|
10607
|
-
// 10px
|
|
10608
|
-
"--control-padding-md": "0.75rem",
|
|
10609
|
-
// 12px
|
|
10610
|
-
"--control-padding-lg": "0.875rem",
|
|
10611
|
-
// 14px
|
|
10612
|
-
"--control-padding-xl": "1rem",
|
|
10613
|
-
// 16px
|
|
10614
|
-
// Icon sizes (for use in buttons/inputs)
|
|
10615
|
-
"--icon-size-xs": "0.75rem",
|
|
10616
|
-
// 12px
|
|
10617
|
-
"--icon-size-sm": "0.875rem",
|
|
10618
|
-
// 14px
|
|
10619
|
-
"--icon-size-md": "1rem",
|
|
10620
|
-
// 16px
|
|
10621
|
-
"--icon-size-lg": "1.125rem",
|
|
10622
|
-
// 18px
|
|
10623
|
-
"--icon-size-xl": "1.25rem",
|
|
10624
|
-
// 20px
|
|
10625
|
-
"--icon-size-2xl": "1.5rem",
|
|
10626
|
-
// 24px
|
|
10627
|
-
// Focus ring
|
|
10628
|
-
"--ring-width": "2px",
|
|
10629
|
-
"--ring-offset": "2px",
|
|
10630
|
-
// Transitions
|
|
10631
|
-
"--transition-fast": "100ms ease",
|
|
10632
|
-
"--transition-normal": "150ms ease",
|
|
10633
|
-
"--transition-slow": "200ms ease",
|
|
10634
|
-
"--transition-slower": "300ms ease"
|
|
10635
|
-
};
|
|
10636
10556
|
var applyStyles = ({
|
|
10637
10557
|
styles,
|
|
10638
10558
|
root
|
|
@@ -10645,9 +10565,6 @@ var applyStyles = ({
|
|
|
10645
10565
|
element.style.setProperty(key, value);
|
|
10646
10566
|
}
|
|
10647
10567
|
};
|
|
10648
|
-
var applyLayoutDefaults = (root) => {
|
|
10649
|
-
applyStyles({ styles: LAYOUT_DEFAULTS, root });
|
|
10650
|
-
};
|
|
10651
10568
|
|
|
10652
10569
|
// src/core/websocket.ts
|
|
10653
10570
|
function createWebSocket(url, config = {}) {
|
|
@@ -10821,12 +10738,10 @@ export {
|
|
|
10821
10738
|
ChatGptWebHostClient,
|
|
10822
10739
|
ClaudeDesktopHostClient,
|
|
10823
10740
|
CreatureDesktopHostClient,
|
|
10824
|
-
LAYOUT_DEFAULTS,
|
|
10825
10741
|
StandaloneHostClient,
|
|
10826
10742
|
YU as applyDocumentTheme,
|
|
10827
10743
|
qU as applyHostFonts,
|
|
10828
10744
|
QU as applyHostStyleVariables,
|
|
10829
|
-
applyLayoutDefaults,
|
|
10830
10745
|
applyStyles,
|
|
10831
10746
|
createHost,
|
|
10832
10747
|
createHostAsync,
|