@portel/photon 1.5.1 → 1.6.0
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 +361 -339
- package/dist/auto-ui/beam.d.ts +5 -0
- package/dist/auto-ui/beam.d.ts.map +1 -1
- package/dist/auto-ui/beam.js +727 -51
- package/dist/auto-ui/beam.js.map +1 -1
- package/dist/auto-ui/bridge/index.d.ts +37 -0
- package/dist/auto-ui/bridge/index.d.ts.map +1 -0
- package/dist/auto-ui/bridge/index.js +555 -0
- package/dist/auto-ui/bridge/index.js.map +1 -0
- package/dist/auto-ui/bridge/openai-shim.d.ts +20 -0
- package/dist/auto-ui/bridge/openai-shim.d.ts.map +1 -0
- package/dist/auto-ui/bridge/openai-shim.js +231 -0
- package/dist/auto-ui/bridge/openai-shim.js.map +1 -0
- package/dist/auto-ui/bridge/photon-app.d.ts +162 -0
- package/dist/auto-ui/bridge/photon-app.d.ts.map +1 -0
- package/dist/auto-ui/bridge/photon-app.js +460 -0
- package/dist/auto-ui/bridge/photon-app.js.map +1 -0
- package/dist/auto-ui/bridge/types.d.ts +128 -0
- package/dist/auto-ui/bridge/types.d.ts.map +1 -0
- package/dist/auto-ui/bridge/types.js +7 -0
- package/dist/auto-ui/bridge/types.js.map +1 -0
- package/dist/auto-ui/design-system/tokens.d.ts +1 -1
- package/dist/auto-ui/design-system/tokens.d.ts.map +1 -1
- package/dist/auto-ui/design-system/tokens.js +1 -1
- package/dist/auto-ui/design-system/tokens.js.map +1 -1
- package/dist/auto-ui/index.d.ts +3 -1
- package/dist/auto-ui/index.d.ts.map +1 -1
- package/dist/auto-ui/index.js +5 -2
- package/dist/auto-ui/index.js.map +1 -1
- package/dist/auto-ui/platform-compat.d.ts.map +1 -1
- package/dist/auto-ui/platform-compat.js +60 -6
- package/dist/auto-ui/platform-compat.js.map +1 -1
- package/dist/auto-ui/streamable-http-transport.d.ts +25 -1
- package/dist/auto-ui/streamable-http-transport.d.ts.map +1 -1
- package/dist/auto-ui/streamable-http-transport.js +581 -20
- package/dist/auto-ui/streamable-http-transport.js.map +1 -1
- package/dist/auto-ui/types.d.ts +74 -0
- package/dist/auto-ui/types.d.ts.map +1 -1
- package/dist/auto-ui/types.js +21 -0
- package/dist/auto-ui/types.js.map +1 -1
- package/dist/beam.bundle.js +51422 -1791
- package/dist/beam.bundle.js.map +4 -4
- package/dist/cli.js +12 -2
- package/dist/cli.js.map +1 -1
- package/dist/daemon/client.d.ts +5 -3
- package/dist/daemon/client.d.ts.map +1 -1
- package/dist/daemon/client.js +30 -4
- package/dist/daemon/client.js.map +1 -1
- package/dist/daemon/manager.d.ts +5 -0
- package/dist/daemon/manager.d.ts.map +1 -1
- package/dist/daemon/manager.js +20 -0
- package/dist/daemon/manager.js.map +1 -1
- package/dist/loader.d.ts +23 -0
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +77 -12
- package/dist/loader.js.map +1 -1
- package/dist/photon-cli-runner.d.ts.map +1 -1
- package/dist/photon-cli-runner.js +2 -0
- package/dist/photon-cli-runner.js.map +1 -1
- package/dist/photon-doc-extractor.d.ts +1 -0
- package/dist/photon-doc-extractor.d.ts.map +1 -1
- package/dist/photon-doc-extractor.js +25 -6
- package/dist/photon-doc-extractor.js.map +1 -1
- package/dist/server.d.ts +12 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +386 -13
- package/dist/server.js.map +1 -1
- package/dist/template-manager.js +2 -2
- package/dist/version.d.ts +8 -0
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +16 -0
- package/dist/version.js.map +1 -1
- package/package.json +19 -9
|
@@ -0,0 +1,460 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PhotonApp class for UI templates
|
|
3
|
+
*
|
|
4
|
+
* This runs in the browser iframe and communicates with the host
|
|
5
|
+
* using the MCP Apps Extension protocol.
|
|
6
|
+
*/
|
|
7
|
+
export class PhotonApp {
|
|
8
|
+
_name;
|
|
9
|
+
_toolOutput = null;
|
|
10
|
+
_toolInput = {};
|
|
11
|
+
_widgetState = {};
|
|
12
|
+
_theme = 'dark';
|
|
13
|
+
_locale = 'en-US';
|
|
14
|
+
_hostContext = null;
|
|
15
|
+
_pendingCalls = new Map();
|
|
16
|
+
_callIdCounter = 0;
|
|
17
|
+
// Event listeners
|
|
18
|
+
_resultListeners = [];
|
|
19
|
+
_themeListeners = [];
|
|
20
|
+
_progressListeners = [];
|
|
21
|
+
_statusListeners = [];
|
|
22
|
+
_streamListeners = [];
|
|
23
|
+
_emitListeners = [];
|
|
24
|
+
constructor(name) {
|
|
25
|
+
this._name = name;
|
|
26
|
+
this._setupMessageHandler();
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Set up message handler for communication with host
|
|
30
|
+
*/
|
|
31
|
+
_setupMessageHandler() {
|
|
32
|
+
window.addEventListener('message', (event) => {
|
|
33
|
+
const msg = event.data;
|
|
34
|
+
if (!msg || typeof msg !== 'object')
|
|
35
|
+
return;
|
|
36
|
+
// Handle JSON-RPC 2.0 messages
|
|
37
|
+
if (msg.jsonrpc === '2.0') {
|
|
38
|
+
this._handleJsonRpcMessage(msg);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
// Handle legacy photon: messages for backward compatibility
|
|
42
|
+
if (typeof msg.type === 'string' && msg.type.startsWith('photon:')) {
|
|
43
|
+
this._handleLegacyMessage(msg);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Handle JSON-RPC 2.0 messages (MCP Apps protocol)
|
|
50
|
+
*/
|
|
51
|
+
_handleJsonRpcMessage(msg) {
|
|
52
|
+
// Response to our call (has id, no method)
|
|
53
|
+
if (msg.id && !msg.method) {
|
|
54
|
+
const pending = this._pendingCalls.get(msg.id);
|
|
55
|
+
if (pending) {
|
|
56
|
+
this._pendingCalls.delete(msg.id);
|
|
57
|
+
if (msg.error) {
|
|
58
|
+
pending.reject(new Error(msg.error.message || 'Call failed'));
|
|
59
|
+
}
|
|
60
|
+
else if (msg.result?.isError) {
|
|
61
|
+
const errorData = this._extractData(msg.result);
|
|
62
|
+
pending.reject(new Error(typeof errorData === 'string' ? errorData : JSON.stringify(errorData)));
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
pending.resolve(this._extractData(msg.result));
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
// Notifications and requests from host
|
|
71
|
+
switch (msg.method) {
|
|
72
|
+
case 'ui/initialize':
|
|
73
|
+
this._handleInitialize(msg);
|
|
74
|
+
break;
|
|
75
|
+
case 'ui/notifications/tool-result':
|
|
76
|
+
this._toolOutput = msg.params?.result;
|
|
77
|
+
this._resultListeners.forEach((cb) => cb(this._extractData(msg.params?.result)));
|
|
78
|
+
break;
|
|
79
|
+
case 'ui/notifications/tool-input':
|
|
80
|
+
this._toolInput = msg.params?.input || {};
|
|
81
|
+
break;
|
|
82
|
+
case 'ui/notifications/host-context-changed':
|
|
83
|
+
case 'ui/notifications/context':
|
|
84
|
+
this._handleHostContextChanged(msg.params);
|
|
85
|
+
break;
|
|
86
|
+
case 'ui/resource-teardown':
|
|
87
|
+
// Respond to teardown request
|
|
88
|
+
if (msg.id != null) {
|
|
89
|
+
this._postToHost({ jsonrpc: '2.0', id: msg.id, result: {} });
|
|
90
|
+
}
|
|
91
|
+
break;
|
|
92
|
+
// Custom Photon notifications
|
|
93
|
+
case 'photon/notifications/progress':
|
|
94
|
+
this._progressListeners.forEach((cb) => cb(msg.params));
|
|
95
|
+
break;
|
|
96
|
+
case 'photon/notifications/status':
|
|
97
|
+
this._statusListeners.forEach((cb) => cb(msg.params));
|
|
98
|
+
break;
|
|
99
|
+
case 'photon/notifications/stream':
|
|
100
|
+
this._streamListeners.forEach((cb) => cb(msg.params));
|
|
101
|
+
break;
|
|
102
|
+
case 'photon/notifications/emit':
|
|
103
|
+
this._emitListeners.forEach((cb) => cb(msg.params));
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Handle legacy photon: messages for backward compatibility
|
|
109
|
+
*/
|
|
110
|
+
_handleLegacyMessage(msg) {
|
|
111
|
+
switch (msg.type) {
|
|
112
|
+
case 'photon:result':
|
|
113
|
+
this._toolOutput = msg.data;
|
|
114
|
+
this._resultListeners.forEach((cb) => cb(msg.data));
|
|
115
|
+
break;
|
|
116
|
+
case 'photon:theme-change':
|
|
117
|
+
this._theme = msg.theme || 'dark';
|
|
118
|
+
this._applyTheme();
|
|
119
|
+
this._themeListeners.forEach((cb) => cb(this._theme));
|
|
120
|
+
break;
|
|
121
|
+
case 'photon:context':
|
|
122
|
+
if (msg.context?.theme) {
|
|
123
|
+
this._theme = msg.context.theme;
|
|
124
|
+
this._applyTheme();
|
|
125
|
+
this._themeListeners.forEach((cb) => cb(this._theme));
|
|
126
|
+
}
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Handle ui/initialize message
|
|
132
|
+
*/
|
|
133
|
+
_handleInitialize(msg) {
|
|
134
|
+
const params = msg.params || {};
|
|
135
|
+
this._hostContext = params.hostContext;
|
|
136
|
+
if (params.hostContext?.theme) {
|
|
137
|
+
this._theme = params.hostContext.theme;
|
|
138
|
+
}
|
|
139
|
+
if (params.hostContext?.styles?.variables) {
|
|
140
|
+
this._applyThemeTokens(params.hostContext.styles.variables);
|
|
141
|
+
}
|
|
142
|
+
this._applyTheme();
|
|
143
|
+
// Send initialized notification
|
|
144
|
+
this._postToHost({
|
|
145
|
+
jsonrpc: '2.0',
|
|
146
|
+
method: 'ui/notifications/initialized',
|
|
147
|
+
params: {},
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Handle host context changes (theme, etc.)
|
|
152
|
+
*/
|
|
153
|
+
_handleHostContextChanged(params) {
|
|
154
|
+
if (!params)
|
|
155
|
+
return;
|
|
156
|
+
if (params.theme) {
|
|
157
|
+
this._theme = params.theme;
|
|
158
|
+
this._applyTheme();
|
|
159
|
+
this._themeListeners.forEach((cb) => cb(this._theme));
|
|
160
|
+
}
|
|
161
|
+
if (params.styles?.variables) {
|
|
162
|
+
this._applyThemeTokens(params.styles.variables);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Apply theme class to document
|
|
167
|
+
*/
|
|
168
|
+
_applyTheme() {
|
|
169
|
+
document.documentElement.classList.remove('light', 'dark');
|
|
170
|
+
document.documentElement.classList.add(this._theme);
|
|
171
|
+
document.documentElement.setAttribute('data-theme', this._theme);
|
|
172
|
+
document.documentElement.style.colorScheme = this._theme;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Apply theme CSS variables
|
|
176
|
+
*/
|
|
177
|
+
_applyThemeTokens(tokens) {
|
|
178
|
+
const root = document.documentElement;
|
|
179
|
+
for (const [key, value] of Object.entries(tokens)) {
|
|
180
|
+
root.style.setProperty(key, value);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Post message to host
|
|
185
|
+
*/
|
|
186
|
+
_postToHost(msg) {
|
|
187
|
+
window.parent.postMessage(msg, '*');
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Generate unique call ID
|
|
191
|
+
*/
|
|
192
|
+
_generateCallId() {
|
|
193
|
+
return `call_${++this._callIdCounter}_${Math.random().toString(36).slice(2)}`;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Extract data from MCP result format
|
|
197
|
+
*/
|
|
198
|
+
_extractData(result) {
|
|
199
|
+
if (!result)
|
|
200
|
+
return result;
|
|
201
|
+
// Prefer structuredContent
|
|
202
|
+
if (result.structuredContent) {
|
|
203
|
+
return result.structuredContent;
|
|
204
|
+
}
|
|
205
|
+
// Extract from content array
|
|
206
|
+
if (Array.isArray(result.content)) {
|
|
207
|
+
const textItem = result.content.find((item) => item.type === 'text');
|
|
208
|
+
if (textItem?.text) {
|
|
209
|
+
try {
|
|
210
|
+
return JSON.parse(textItem.text);
|
|
211
|
+
}
|
|
212
|
+
catch {
|
|
213
|
+
return textItem.text;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
return result;
|
|
218
|
+
}
|
|
219
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
220
|
+
// PUBLIC API (window.photon interface)
|
|
221
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
222
|
+
/**
|
|
223
|
+
* Connect to host and perform MCP Apps handshake
|
|
224
|
+
*/
|
|
225
|
+
async connect() {
|
|
226
|
+
const callId = this._generateCallId();
|
|
227
|
+
return new Promise((resolve, reject) => {
|
|
228
|
+
this._pendingCalls.set(callId, {
|
|
229
|
+
resolve: () => resolve(),
|
|
230
|
+
reject,
|
|
231
|
+
});
|
|
232
|
+
this._postToHost({
|
|
233
|
+
jsonrpc: '2.0',
|
|
234
|
+
id: callId,
|
|
235
|
+
method: 'ui/initialize',
|
|
236
|
+
params: {
|
|
237
|
+
appInfo: { name: this._name, version: '1.0.0' },
|
|
238
|
+
appCapabilities: {},
|
|
239
|
+
protocolVersion: '2026-01-26',
|
|
240
|
+
},
|
|
241
|
+
});
|
|
242
|
+
// Timeout after 5 seconds
|
|
243
|
+
setTimeout(() => {
|
|
244
|
+
if (this._pendingCalls.has(callId)) {
|
|
245
|
+
this._pendingCalls.delete(callId);
|
|
246
|
+
// Don't reject - some hosts don't respond to initialize
|
|
247
|
+
resolve();
|
|
248
|
+
}
|
|
249
|
+
}, 5000);
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Current tool output data
|
|
254
|
+
*/
|
|
255
|
+
get toolOutput() {
|
|
256
|
+
return this._toolOutput;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Current tool input
|
|
260
|
+
*/
|
|
261
|
+
get toolInput() {
|
|
262
|
+
return this._toolInput;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Widget state
|
|
266
|
+
*/
|
|
267
|
+
get widgetState() {
|
|
268
|
+
return this._widgetState;
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Set widget state
|
|
272
|
+
*/
|
|
273
|
+
setWidgetState(state) {
|
|
274
|
+
this._widgetState = state;
|
|
275
|
+
this._postToHost({ type: 'photon:set-state', state });
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Current theme
|
|
279
|
+
*/
|
|
280
|
+
get theme() {
|
|
281
|
+
return this._theme;
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Current locale
|
|
285
|
+
*/
|
|
286
|
+
get locale() {
|
|
287
|
+
return this._locale;
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Host context from initialization
|
|
291
|
+
*/
|
|
292
|
+
get hostContext() {
|
|
293
|
+
return this._hostContext;
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Register result handler
|
|
297
|
+
*/
|
|
298
|
+
onResult(cb) {
|
|
299
|
+
this._resultListeners.push(cb);
|
|
300
|
+
return () => {
|
|
301
|
+
const idx = this._resultListeners.indexOf(cb);
|
|
302
|
+
if (idx >= 0)
|
|
303
|
+
this._resultListeners.splice(idx, 1);
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Register theme change handler
|
|
308
|
+
*/
|
|
309
|
+
onThemeChange(cb) {
|
|
310
|
+
this._themeListeners.push(cb);
|
|
311
|
+
return () => {
|
|
312
|
+
const idx = this._themeListeners.indexOf(cb);
|
|
313
|
+
if (idx >= 0)
|
|
314
|
+
this._themeListeners.splice(idx, 1);
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Register progress notification handler
|
|
319
|
+
*/
|
|
320
|
+
onProgress(cb) {
|
|
321
|
+
this._progressListeners.push(cb);
|
|
322
|
+
return () => {
|
|
323
|
+
const idx = this._progressListeners.indexOf(cb);
|
|
324
|
+
if (idx >= 0)
|
|
325
|
+
this._progressListeners.splice(idx, 1);
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Register status notification handler
|
|
330
|
+
*/
|
|
331
|
+
onStatus(cb) {
|
|
332
|
+
this._statusListeners.push(cb);
|
|
333
|
+
return () => {
|
|
334
|
+
const idx = this._statusListeners.indexOf(cb);
|
|
335
|
+
if (idx >= 0)
|
|
336
|
+
this._statusListeners.splice(idx, 1);
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Register stream notification handler
|
|
341
|
+
*/
|
|
342
|
+
onStream(cb) {
|
|
343
|
+
this._streamListeners.push(cb);
|
|
344
|
+
return () => {
|
|
345
|
+
const idx = this._streamListeners.indexOf(cb);
|
|
346
|
+
if (idx >= 0)
|
|
347
|
+
this._streamListeners.splice(idx, 1);
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* Register emit notification handler
|
|
352
|
+
*/
|
|
353
|
+
onEmit(cb) {
|
|
354
|
+
this._emitListeners.push(cb);
|
|
355
|
+
return () => {
|
|
356
|
+
const idx = this._emitListeners.indexOf(cb);
|
|
357
|
+
if (idx >= 0)
|
|
358
|
+
this._emitListeners.splice(idx, 1);
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* Call a tool on the server
|
|
363
|
+
*/
|
|
364
|
+
async invoke(name, args) {
|
|
365
|
+
const callId = this._generateCallId();
|
|
366
|
+
return new Promise((resolve, reject) => {
|
|
367
|
+
this._pendingCalls.set(callId, { resolve, reject });
|
|
368
|
+
this._postToHost({
|
|
369
|
+
jsonrpc: '2.0',
|
|
370
|
+
id: callId,
|
|
371
|
+
method: 'tools/call',
|
|
372
|
+
params: { name, arguments: args || {} },
|
|
373
|
+
});
|
|
374
|
+
// Timeout after 30 seconds
|
|
375
|
+
setTimeout(() => {
|
|
376
|
+
if (this._pendingCalls.has(callId)) {
|
|
377
|
+
this._pendingCalls.delete(callId);
|
|
378
|
+
reject(new Error('Tool call timeout'));
|
|
379
|
+
}
|
|
380
|
+
}, 30000);
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* Alias for invoke (compatibility)
|
|
385
|
+
*/
|
|
386
|
+
callTool(name, args) {
|
|
387
|
+
return this.invoke(name, args);
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Send size change notification to host
|
|
391
|
+
*/
|
|
392
|
+
sendSizeChanged(size) {
|
|
393
|
+
this._postToHost({
|
|
394
|
+
jsonrpc: '2.0',
|
|
395
|
+
method: 'ui/notifications/size-changed',
|
|
396
|
+
params: size,
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* Parse size constraints from meta tag
|
|
401
|
+
*/
|
|
402
|
+
static parseSizeMeta() {
|
|
403
|
+
const meta = document.querySelector('meta[name="mcp:ui-size"]');
|
|
404
|
+
if (!meta)
|
|
405
|
+
return {};
|
|
406
|
+
const content = meta.getAttribute('content') || '';
|
|
407
|
+
const constraints = {};
|
|
408
|
+
const pairs = content.split(';');
|
|
409
|
+
for (const pair of pairs) {
|
|
410
|
+
const [key, value] = pair.split('=');
|
|
411
|
+
if (key && value) {
|
|
412
|
+
const numValue = parseInt(value, 10);
|
|
413
|
+
if (!isNaN(numValue)) {
|
|
414
|
+
if (key === 'minWidth')
|
|
415
|
+
constraints.minWidth = numValue;
|
|
416
|
+
if (key === 'minHeight')
|
|
417
|
+
constraints.minHeight = numValue;
|
|
418
|
+
if (key === 'maxWidth')
|
|
419
|
+
constraints.maxWidth = numValue;
|
|
420
|
+
if (key === 'maxHeight')
|
|
421
|
+
constraints.maxHeight = numValue;
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
return constraints;
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* Set up automatic size reporting with ResizeObserver
|
|
429
|
+
*/
|
|
430
|
+
setupAutoResize(target) {
|
|
431
|
+
const element = target || document.body;
|
|
432
|
+
const constraints = PhotonApp.parseSizeMeta();
|
|
433
|
+
// Get host constraints if available
|
|
434
|
+
const hostMaxWidth = this._hostContext?.containerDimensions?.maxWidth;
|
|
435
|
+
const hostMaxHeight = this._hostContext?.containerDimensions?.maxHeight;
|
|
436
|
+
const observer = new ResizeObserver(() => {
|
|
437
|
+
let width = element.scrollWidth;
|
|
438
|
+
let height = element.scrollHeight;
|
|
439
|
+
// Apply declared minimums
|
|
440
|
+
if (constraints.minWidth)
|
|
441
|
+
width = Math.max(width, constraints.minWidth);
|
|
442
|
+
if (constraints.minHeight)
|
|
443
|
+
height = Math.max(height, constraints.minHeight);
|
|
444
|
+
// Apply host maximums
|
|
445
|
+
if (hostMaxWidth)
|
|
446
|
+
width = Math.min(width, hostMaxWidth);
|
|
447
|
+
if (hostMaxHeight)
|
|
448
|
+
height = Math.min(height, hostMaxHeight);
|
|
449
|
+
// Apply declared maximums
|
|
450
|
+
if (constraints.maxWidth)
|
|
451
|
+
width = Math.min(width, constraints.maxWidth);
|
|
452
|
+
if (constraints.maxHeight)
|
|
453
|
+
height = Math.min(height, constraints.maxHeight);
|
|
454
|
+
this.sendSizeChanged({ width, height });
|
|
455
|
+
});
|
|
456
|
+
observer.observe(element);
|
|
457
|
+
return () => observer.disconnect();
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
//# sourceMappingURL=photon-app.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"photon-app.js","sourceRoot":"","sources":["../../../src/auto-ui/bridge/photon-app.ts"],"names":[],"mappings":"AA2BA;;;;;GAKG;AACH,MAAM,OAAO,SAAS;IACZ,KAAK,CAAS;IACd,WAAW,GAAQ,IAAI,CAAC;IACxB,UAAU,GAA4B,EAAE,CAAC;IACzC,YAAY,GAAY,EAAE,CAAC;IAC3B,MAAM,GAAqB,MAAM,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Q,CAAC,CAAC;YACxE,IAAI,WAAW,CAAC,SAAS;gBAAE,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;YAE5E,sBAAsB;YACtB,IAAI,YAAY;gBAAE,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;YACxD,IAAI,aAAa;gBAAE,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;YAE5D,0BAA0B;YAC1B,IAAI,WAAW,CAAC,QAAQ;gBAAE,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;YACxE,IAAI,WAAW,CAAC,SAAS;gBAAE,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;YAE5E,IAAI,CAAC,eAAe,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;QAC1C,CAAC,CAAC,CAAC;QAEH,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAE1B,OAAO,GAAG,EAAE,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC;IACrC,CAAC;CACF"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for Unified UI Bridge Architecture
|
|
3
|
+
*
|
|
4
|
+
* Based on @modelcontextprotocol/ext-apps SDK
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Photon context passed to the bridge
|
|
8
|
+
*/
|
|
9
|
+
export interface PhotonBridgeContext {
|
|
10
|
+
photon: string;
|
|
11
|
+
method: string;
|
|
12
|
+
theme: 'light' | 'dark';
|
|
13
|
+
locale?: string;
|
|
14
|
+
hostName?: string;
|
|
15
|
+
hostVersion?: string;
|
|
16
|
+
/** Names of injected @photon dependencies (for client-side event routing) */
|
|
17
|
+
injectedPhotons?: string[];
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Size constraints from meta tags and host context
|
|
21
|
+
*/
|
|
22
|
+
export interface SizeConstraints {
|
|
23
|
+
minWidth?: number;
|
|
24
|
+
minHeight?: number;
|
|
25
|
+
maxWidth?: number;
|
|
26
|
+
maxHeight?: number;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Custom Photon notification types (JSON-RPC method names)
|
|
30
|
+
*/
|
|
31
|
+
export type PhotonNotificationMethod = 'photon/notifications/progress' | 'photon/notifications/status' | 'photon/notifications/stream' | 'photon/notifications/emit' | 'photon/notifications/channel-event';
|
|
32
|
+
/**
|
|
33
|
+
* Progress notification payload
|
|
34
|
+
*/
|
|
35
|
+
export interface ProgressNotification {
|
|
36
|
+
percent?: number;
|
|
37
|
+
message?: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Status notification payload
|
|
41
|
+
*/
|
|
42
|
+
export interface StatusNotification {
|
|
43
|
+
type: 'info' | 'success' | 'error' | 'warn';
|
|
44
|
+
message: string;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Stream notification payload
|
|
48
|
+
*/
|
|
49
|
+
export interface StreamNotification {
|
|
50
|
+
chunk: string;
|
|
51
|
+
done?: boolean;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Emit notification payload
|
|
55
|
+
*/
|
|
56
|
+
export interface EmitNotification {
|
|
57
|
+
event: string;
|
|
58
|
+
data?: any;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Channel event notification payload
|
|
62
|
+
*/
|
|
63
|
+
export interface ChannelEventNotification {
|
|
64
|
+
channel: string;
|
|
65
|
+
event: string;
|
|
66
|
+
data?: any;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* window.photon API interface
|
|
70
|
+
*/
|
|
71
|
+
export interface PhotonAPI {
|
|
72
|
+
readonly toolOutput: any;
|
|
73
|
+
readonly toolInput: Record<string, unknown>;
|
|
74
|
+
readonly widgetState: unknown;
|
|
75
|
+
onResult(cb: (data: any) => void): () => void;
|
|
76
|
+
onThemeChange(cb: (theme: 'light' | 'dark') => void): () => void;
|
|
77
|
+
onProgress(cb: (notification: ProgressNotification) => void): () => void;
|
|
78
|
+
onStatus(cb: (notification: StatusNotification) => void): () => void;
|
|
79
|
+
onStream(cb: (notification: StreamNotification) => void): () => void;
|
|
80
|
+
onEmit(cb: (notification: EmitNotification) => void): () => void;
|
|
81
|
+
invoke(name: string, args?: Record<string, unknown>): Promise<any>;
|
|
82
|
+
callTool(name: string, args?: Record<string, unknown>): Promise<any>;
|
|
83
|
+
setWidgetState(state: unknown): void;
|
|
84
|
+
readonly theme: 'light' | 'dark';
|
|
85
|
+
readonly locale: string;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* window.openai API interface (OpenAI Apps SDK compatibility)
|
|
89
|
+
*/
|
|
90
|
+
export interface OpenAIAPI {
|
|
91
|
+
readonly theme: 'light' | 'dark';
|
|
92
|
+
readonly displayMode: 'inline' | 'fullscreen' | 'pip';
|
|
93
|
+
readonly locale: string;
|
|
94
|
+
readonly maxHeight: number;
|
|
95
|
+
readonly toolInput: Record<string, unknown>;
|
|
96
|
+
readonly toolOutput: unknown;
|
|
97
|
+
readonly widgetState: unknown;
|
|
98
|
+
setWidgetState(state: unknown): void;
|
|
99
|
+
callTool(name: string, args: Record<string, unknown>): Promise<unknown>;
|
|
100
|
+
sendFollowUpMessage(options: {
|
|
101
|
+
prompt: string;
|
|
102
|
+
}): Promise<void>;
|
|
103
|
+
uploadFile(file: File): Promise<{
|
|
104
|
+
fileId: string;
|
|
105
|
+
}>;
|
|
106
|
+
getFileDownloadUrl(options: {
|
|
107
|
+
fileId: string;
|
|
108
|
+
}): Promise<string>;
|
|
109
|
+
requestDisplayMode(mode: 'inline' | 'fullscreen' | 'pip'): Promise<void>;
|
|
110
|
+
requestModal(options: {
|
|
111
|
+
params: unknown;
|
|
112
|
+
template: string;
|
|
113
|
+
}): Promise<unknown>;
|
|
114
|
+
notifyIntrinsicHeight(height: number): void;
|
|
115
|
+
openExternal(options: {
|
|
116
|
+
href: string;
|
|
117
|
+
}): void;
|
|
118
|
+
setOpenInAppUrl(options: {
|
|
119
|
+
href: string;
|
|
120
|
+
}): void;
|
|
121
|
+
}
|
|
122
|
+
declare global {
|
|
123
|
+
interface Window {
|
|
124
|
+
photon: PhotonAPI;
|
|
125
|
+
openai: OpenAIAPI;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/auto-ui/bridge/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6EAA6E;IAC7E,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAChC,+BAA+B,GAC/B,6BAA6B,GAC7B,6BAA6B,GAC7B,2BAA2B,GAC3B,oCAAoC,CAAC;AAEzC;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,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EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACpD,kBAAkB,CAAC,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACjE,kBAAkB,CAAC,IAAI,EAAE,QAAQ,GAAG,YAAY,GAAG,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzE,YAAY,CAAC,OAAO,EAAE;QAAE,MAAM,EAAE,OAAO,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/E,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5C,YAAY,CAAC,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAC9C,eAAe,CAAC,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;CAClD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,MAAM,EAAE,SAAS,CAAC;QAClB,MAAM,EAAE,SAAS,CAAC;KACnB;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/auto-ui/bridge/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* Uses the subpath import to avoid pulling in Node.js dependencies
|
|
6
6
|
* (SchemaExtractor, fs, etc.) that would break browser bundling.
|
|
7
7
|
*/
|
|
8
|
-
export { spacing, spacingAliases, fontFamily, fontSize, lineHeight, fontWeight, colorsDark, colorsLight, colors, type ThemeMode, type ThemeColors, getThemeColors, getThemeTokens, elevation, radius, duration, easing, touchTarget, zIndex, generateTokensCSS, } from '@portel/photon-core/design-system/tokens';
|
|
8
|
+
export { spacing, spacingAliases, fontFamily, fontSize, lineHeight, fontWeight, colorsDark, colorsLight, colors, type ThemeMode, type ThemeColors, getThemeColors, getThemeTokens, elevation, elevationLight, radius, duration, easing, touchTarget, zIndex, generateTokensCSS, } from '@portel/photon-core/design-system/tokens';
|
|
9
9
|
//# sourceMappingURL=tokens.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../../src/auto-ui/design-system/tokens.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAEL,OAAO,EACP,cAAc,EAGd,UAAU,EACV,QAAQ,EACR,UAAU,EACV,UAAU,EAGV,UAAU,EACV,WAAW,EACX,MAAM,EAGN,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,cAAc,EACd,cAAc,EAGd,SAAS,
|
|
1
|
+
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../../src/auto-ui/design-system/tokens.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAEL,OAAO,EACP,cAAc,EAGd,UAAU,EACV,QAAQ,EACR,UAAU,EACV,UAAU,EAGV,UAAU,EACV,WAAW,EACX,MAAM,EAGN,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,cAAc,EACd,cAAc,EAGd,SAAS,EACT,cAAc,EAGd,MAAM,EAGN,QAAQ,EACR,MAAM,EAGN,WAAW,EAGX,MAAM,EAGN,iBAAiB,GAClB,MAAM,0CAA0C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../../src/auto-ui/design-system/tokens.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO;AACL,UAAU;AACV,OAAO,EACP,cAAc;AAEd,aAAa;AACb,UAAU,EACV,QAAQ,EACR,UAAU,EACV,UAAU;AAEV,SAAS;AACT,UAAU,EACV,WAAW,EACX,MAAM,EAKN,cAAc,EACd,cAAc;AAEd,YAAY;AACZ,SAAS;
|
|
1
|
+
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../../src/auto-ui/design-system/tokens.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO;AACL,UAAU;AACV,OAAO,EACP,cAAc;AAEd,aAAa;AACb,UAAU,EACV,QAAQ,EACR,UAAU,EACV,UAAU;AAEV,SAAS;AACT,UAAU,EACV,WAAW,EACX,MAAM,EAKN,cAAc,EACd,cAAc;AAEd,YAAY;AACZ,SAAS,EACT,cAAc;AAEd,gBAAgB;AAChB,MAAM;AAEN,SAAS;AACT,QAAQ,EACR,MAAM;AAEN,cAAc;AACd,WAAW;AAEX,UAAU;AACV,MAAM;AAEN,iBAAiB;AACjB,iBAAiB,GAClB,MAAM,0CAA0C,CAAC"}
|
package/dist/auto-ui/index.d.ts
CHANGED
|
@@ -16,6 +16,8 @@ export { startBeam } from './beam';
|
|
|
16
16
|
export * from './types';
|
|
17
17
|
export { createPhotonBridge, generateBridgeLoaderScript, type PhotonBridge, type EmitEvent, type ProgressEvent, type StatusEvent, type StreamEvent, type AskEvent, type AskTextEvent, type AskConfirmEvent, type AskSelectEvent, type AskNumberEvent, type PhotonContext, type HostToUIMessage, type UIToHostMessage, } from './photon-bridge';
|
|
18
18
|
export { PhotonHost, createHostOutputHandler, createHostInputProvider, type PhotonHostOptions, } from './photon-host';
|
|
19
|
-
export {
|
|
19
|
+
export { generateBridgeScript, generatePlatformBridgeScript, // backward compatible alias
|
|
20
|
+
type PhotonBridgeContext, type SizeConstraints, type PhotonAPI, type OpenAIAPI, type ProgressNotification, type StatusNotification, type StreamNotification, type EmitNotification, type ChannelEventNotification, } from './bridge/index';
|
|
21
|
+
export { createMcpAppsInitialize, createThemeChangeMessages, type PlatformContext, type McpAppsInitialize, type McpAppsToolInput, type McpAppsToolResult, type OpenAiApi, type OpenAiContext, } from './platform-compat';
|
|
20
22
|
export { getThemeTokens, getThemeColors, generateTokensCSS, colorsDark, colorsLight, type ThemeMode, } from './design-system/tokens';
|
|
21
23
|
//# sourceMappingURL=index.d.ts.map
|