@agentproto/apps 0.11.0 → 0.12.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/dist/agents-overview/panel.mjs +25 -0
- package/dist/agents-overview/panel.mjs.map +1 -1
- package/dist/agents-overview.mjs +25 -0
- package/dist/agents-overview.mjs.map +1 -1
- package/dist/bureau-sessions/panel.mjs +25 -0
- package/dist/bureau-sessions/panel.mjs.map +1 -1
- package/dist/bureau-sessions.mjs +25 -0
- package/dist/bureau-sessions.mjs.map +1 -1
- package/dist/index.mjs +494 -12
- package/dist/index.mjs.map +1 -1
- package/dist/live-session/panel.mjs +25 -0
- package/dist/live-session/panel.mjs.map +1 -1
- package/dist/live-session.mjs +25 -0
- package/dist/live-session.mjs.map +1 -1
- package/dist/panel-bridge.d.ts.map +1 -1
- package/dist/session-chat/blob-embed.d.ts +53 -0
- package/dist/session-chat/blob-embed.d.ts.map +1 -0
- package/dist/session-chat/index.d.ts +13 -0
- package/dist/session-chat/index.d.ts.map +1 -1
- package/dist/session-chat/panel.d.ts +38 -2
- package/dist/session-chat/panel.d.ts.map +1 -1
- package/dist/session-chat/panel.mjs +609 -6
- package/dist/session-chat/panel.mjs.map +1 -1
- package/dist/session-chat.mjs +631 -13
- package/dist/session-chat.mjs.map +1 -1
- package/dist/session-story/panel.mjs +25 -0
- package/dist/session-story/panel.mjs.map +1 -1
- package/dist/session-story.mjs +25 -0
- package/dist/session-story.mjs.map +1 -1
- package/dist/sessions-panel/panel.mjs +25 -0
- package/dist/sessions-panel/panel.mjs.map +1 -1
- package/dist/sessions-panel.mjs +25 -0
- package/dist/sessions-panel.mjs.map +1 -1
- package/dist/work-board/panel.d.ts +1 -1
- package/dist/work-board/panel.d.ts.map +1 -1
- package/dist/work-board/panel.generated.d.ts +1 -1
- package/dist/work-board/panel.generated.d.ts.map +1 -1
- package/dist/work-board/panel.mjs +25 -0
- package/dist/work-board/panel.mjs.map +1 -1
- package/dist/work-board.mjs +25 -0
- package/dist/work-board.mjs.map +1 -1
- package/package.json +1 -1
package/dist/session-chat.mjs
CHANGED
|
@@ -7,14 +7,275 @@ import { defineApp } from '@agentproto/app-kit';
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
|
|
10
|
+
// src/panel-bridge.ts
|
|
11
|
+
function panelBridgeScript(appName) {
|
|
12
|
+
return `// \u2500\u2500 MCP Apps bridge (shared: panel-bridge.ts) \u2500\u2500
|
|
13
|
+
// JSON-RPC 2.0 over window.parent.postMessage \xB7 spec 2026-01-26
|
|
14
|
+
var _nextId = 1, _pending = {}, _notifyHandlers = [];
|
|
15
|
+
var _hostContext = null, _hostContextHandlers = [];
|
|
16
|
+
var _hostCaps = null;
|
|
17
|
+
var _standaloneApp = null;
|
|
18
|
+
function _isStandalone(){
|
|
19
|
+
return window.parent === window && !!window.McpApp && typeof window.McpApp.connect === 'function';
|
|
20
|
+
}
|
|
21
|
+
// \u2500\u2500 Per-boot embed token (runtime embed-tokens.ts) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
22
|
+
// Panels that iframe the daemon's standalone app host carry this proof so
|
|
23
|
+
// GET /apps/:appId/ui?embed=1&et=... can drop its anti-framing headers for
|
|
24
|
+
// MCP-Apps hosts whose widget context is an opaque origin (Claude Desktop).
|
|
25
|
+
// registerMcpApps replaces the placeholder with a real per-boot token when
|
|
26
|
+
// serving the panel as a resource; every other render (tests, standalone
|
|
27
|
+
// tab, VS Code HTTP-iframe panel \u2014 the latter two already pass
|
|
28
|
+
// iframeEmbedAllowed's origin checks) keeps the literal, and
|
|
29
|
+
// withEmbedToken() then degrades to an identity function.
|
|
30
|
+
window.__AGENPROTO_EMBED_TOKEN__ = "__AGENPROTO_EMBED_TOKEN__";
|
|
31
|
+
function withEmbedToken(url){
|
|
32
|
+
var t = window.__AGENPROTO_EMBED_TOKEN__;
|
|
33
|
+
if (!t || t === '__AGENPROTO_EMBED_TOKEN__') return url;
|
|
34
|
+
return url + (url.indexOf('?') >= 0 ? '&' : '?') + 'et=' + encodeURIComponent(t);
|
|
35
|
+
}
|
|
36
|
+
function post(msg){ window.parent.postMessage(msg, '*'); }
|
|
37
|
+
function getHostContext(){ return _hostContext; }
|
|
38
|
+
function getHostCapabilities(){ return _hostCaps; }
|
|
39
|
+
function onHostContext(cb){
|
|
40
|
+
_hostContextHandlers.push(cb);
|
|
41
|
+
// Replay the last context so a late subscriber isn't stuck blind.
|
|
42
|
+
if (_hostContext){ try { cb(_hostContext); } catch(_) {} }
|
|
43
|
+
}
|
|
44
|
+
function _setHostContext(ctx){
|
|
45
|
+
if (!ctx || typeof ctx !== 'object') return;
|
|
46
|
+
// ui/notifications/host-context-changed carries only the changed keys \u2014
|
|
47
|
+
// merge, matching the official ext-apps App behaviour.
|
|
48
|
+
_hostContext = Object.assign({}, _hostContext || {}, ctx);
|
|
49
|
+
for (var i = 0; i < _hostContextHandlers.length; i++){
|
|
50
|
+
try { _hostContextHandlers[i](_hostContext); } catch(_) {}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function rpcRequest(method, params){
|
|
54
|
+
return new Promise(function(resolve, reject){
|
|
55
|
+
var id = _nextId++;
|
|
56
|
+
_pending[id] = {resolve: resolve, reject: reject};
|
|
57
|
+
post({jsonrpc: '2.0', id: id, method: method, params: params || {}});
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
function rpcNotify(method, params){ post({jsonrpc: '2.0', method: method, params: params || {}}); }
|
|
61
|
+
function onHostNotification(cb){ _notifyHandlers.push(cb); }
|
|
62
|
+
window.addEventListener('message', function(evt){
|
|
63
|
+
var msg = evt.data;
|
|
64
|
+
if (!msg || typeof msg !== 'object' || msg.jsonrpc !== '2.0') return;
|
|
65
|
+
if (msg.id != null && msg.method == null){
|
|
66
|
+
var p = _pending[msg.id];
|
|
67
|
+
if (!p) return;
|
|
68
|
+
delete _pending[msg.id];
|
|
69
|
+
if (msg.error) p.reject(new Error(msg.error.message || ('rpc error ' + msg.error.code)));
|
|
70
|
+
else p.resolve(msg.result);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
if (msg.method){
|
|
74
|
+
if (msg.method === 'ui/notifications/host-context-changed'){
|
|
75
|
+
_setHostContext(msg.params || {});
|
|
76
|
+
}
|
|
77
|
+
for (var i = 0; i < _notifyHandlers.length; i++){
|
|
78
|
+
try { _notifyHandlers[i](msg.method, msg.params || {}); } catch(_) {}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
function initBridge(){
|
|
83
|
+
if (_isStandalone()){
|
|
84
|
+
return window.McpApp.connect().then(function(conn){
|
|
85
|
+
_standaloneApp = conn;
|
|
86
|
+
// No host to advertise a hostContext \u2014 default to inline with no
|
|
87
|
+
// other modes available, which keeps the #dm/#pin toggle buttons
|
|
88
|
+
// hidden (they only show for modes hostContext.availableDisplayModes
|
|
89
|
+
// lists) instead of rendering two buttons with nothing to switch to.
|
|
90
|
+
_setHostContext({displayMode: 'inline', availableDisplayModes: []});
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
return rpcRequest('ui/initialize', {
|
|
94
|
+
appInfo: {name: ${JSON.stringify(appName)}, version: '0.1.0'},
|
|
95
|
+
appCapabilities: {availableDisplayModes: ['inline', 'fullscreen', 'pip']},
|
|
96
|
+
protocolVersion: '2026-01-26'
|
|
97
|
+
}).then(function(result){
|
|
98
|
+
// The initialize result carries the initial hostContext (displayMode +
|
|
99
|
+
// availableDisplayModes) \u2014 capture it before notifying the host.
|
|
100
|
+
if (result && result.hostContext) _setHostContext(result.hostContext);
|
|
101
|
+
// McpUiInitializeResult.hostCapabilities (ext-apps spec) \u2014 e.g. openLinks,
|
|
102
|
+
// "Host supports opening external URLs". Captured once, read via
|
|
103
|
+
// getHostCapabilities() by panels that need to branch on it.
|
|
104
|
+
if (result && result.hostCapabilities) _hostCaps = result.hostCapabilities;
|
|
105
|
+
rpcNotify('ui/notifications/initialized', {});
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
function requestDisplayMode(mode){
|
|
109
|
+
return rpcRequest('ui/request-display-mode', {mode: mode});
|
|
110
|
+
}
|
|
111
|
+
function openLink(url){
|
|
112
|
+
if (_standaloneApp && typeof _standaloneApp.openLink === 'function') return _standaloneApp.openLink(url);
|
|
113
|
+
return rpcRequest('ui/open-link', {url: url});
|
|
114
|
+
}
|
|
115
|
+
function callTool(name, args){
|
|
116
|
+
var raw = _standaloneApp
|
|
117
|
+
? _standaloneApp.callTool(name, args || {})
|
|
118
|
+
: rpcRequest('tools/call', {name: name, arguments: args || {}});
|
|
119
|
+
return raw.then(function(result){
|
|
120
|
+
if (result.isError){
|
|
121
|
+
var e = (result.content && result.content[0] && result.content[0].text) || 'tool error';
|
|
122
|
+
throw new Error(e);
|
|
123
|
+
}
|
|
124
|
+
var text = (result.content && result.content[0] && result.content[0].text) || '{}';
|
|
125
|
+
return JSON.parse(text);
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// \u2500\u2500 Display-mode toggle buttons (NO auto-request) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
130
|
+
// Injected by the shared bridge so every panel gets them without touching
|
|
131
|
+
// its own markup. Mirrors guilde canvas.app.ts canvasShellHtml(): the
|
|
132
|
+
// panel stays inline by default; the user expands on demand. Buttons only
|
|
133
|
+
// appear for modes the host advertises in hostContext.availableDisplayModes.
|
|
134
|
+
(function(){
|
|
135
|
+
function mount(){
|
|
136
|
+
var style = document.createElement('style');
|
|
137
|
+
style.textContent = '#dm,#pin{display:none;position:fixed;top:8px;z-index:10;'
|
|
138
|
+
+ 'border:1px solid #d0d0d0;background:#fff;color:#1a1a1a;'
|
|
139
|
+
+ 'font:600 13px/1 system-ui,sans-serif;padding:7px 12px;border-radius:6px;'
|
|
140
|
+
+ 'cursor:pointer;box-shadow:0 1px 4px rgba(0,0,0,.18)}'
|
|
141
|
+
+ '#dm{right:8px}#pin{right:118px}'
|
|
142
|
+
+ '#dm:hover,#pin:hover{background:#f2f2f2;border-color:#b0b0b0}'
|
|
143
|
+
+ '@media (prefers-color-scheme:dark){'
|
|
144
|
+
+ '#dm,#pin{border-color:#555;background:#2a2a2a;color:#f0f0f0;box-shadow:0 1px 4px rgba(0,0,0,.5)}'
|
|
145
|
+
+ '#dm:hover,#pin:hover{background:#333;border-color:#777}}';
|
|
146
|
+
document.head.appendChild(style);
|
|
147
|
+
|
|
148
|
+
var btn = document.createElement('button');
|
|
149
|
+
btn.id = 'dm'; btn.type = 'button'; btn.title = "Basculer l'affichage";
|
|
150
|
+
var pin = document.createElement('button');
|
|
151
|
+
pin.id = 'pin'; pin.type = 'button'; pin.title = '\xC9pingler sur le c\xF4t\xE9 (pip)';
|
|
152
|
+
document.body.appendChild(pin);
|
|
153
|
+
document.body.appendChild(btn);
|
|
154
|
+
|
|
155
|
+
function has(avail, m){ return !!avail && avail.indexOf(m) >= 0; }
|
|
156
|
+
|
|
157
|
+
// Re-sync button visibility + label from the current host context.
|
|
158
|
+
function syncBtn(ctx){
|
|
159
|
+
ctx = ctx || {};
|
|
160
|
+
var avail = ctx.availableDisplayModes;
|
|
161
|
+
// Diagnostic: what does THIS host actually advertise? (inline/fullscreen/pip)
|
|
162
|
+
console.log('[mcp-app] displayMode=', ctx.displayMode,
|
|
163
|
+
'availableDisplayModes=', avail);
|
|
164
|
+
|
|
165
|
+
// Fullscreen toggle button.
|
|
166
|
+
if (has(avail, 'fullscreen')){
|
|
167
|
+
btn.style.display = 'block';
|
|
168
|
+
btn.textContent = (ctx.displayMode === 'fullscreen') ? '\u2921 R\xE9duire' : '\u2922 Agrandir';
|
|
169
|
+
} else { btn.style.display = 'none'; }
|
|
170
|
+
|
|
171
|
+
// Dedicated pip ("pinned on side") button \u2014 only if the host advertises pip.
|
|
172
|
+
if (has(avail, 'pip')){
|
|
173
|
+
pin.style.display = 'block';
|
|
174
|
+
pin.textContent = (ctx.displayMode === 'pip') ? '\u2921 D\xE9tacher' : '\u{1F4CC} \xC9pingler';
|
|
175
|
+
} else { pin.style.display = 'none'; }
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
onHostContext(syncBtn);
|
|
179
|
+
|
|
180
|
+
btn.addEventListener('click', function(){
|
|
181
|
+
var ctx = getHostContext() || {};
|
|
182
|
+
var inPanel = (ctx.displayMode === 'fullscreen' || ctx.displayMode === 'pip');
|
|
183
|
+
requestDisplayMode(inPanel ? 'inline' : 'fullscreen').catch(function(){});
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
pin.addEventListener('click', function(){
|
|
187
|
+
var ctx = getHostContext() || {};
|
|
188
|
+
requestDisplayMode(ctx.displayMode === 'pip' ? 'inline' : 'pip').catch(function(){});
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
if (document.body) mount();
|
|
192
|
+
else document.addEventListener('DOMContentLoaded', mount);
|
|
193
|
+
})();`;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// src/session-chat/blob-embed.ts
|
|
197
|
+
var BLOB_BOOT_MESSAGE_TYPE = "agentproto-blob-boot";
|
|
198
|
+
function blobEmbedScript() {
|
|
199
|
+
return `// \u2500\u2500 Blob pass-through transform (shared: session-chat/blob-embed.ts) \u2500\u2500
|
|
200
|
+
function _blobEscapeAttr(s){ return String(s).replace(/&/g, '&').replace(/"/g, '"'); }
|
|
201
|
+
// Rewrite the fetched chat html so it works as a blob: document: <base> on
|
|
202
|
+
// the deep link, a fetch/EventSource shim that carries the embed token to
|
|
203
|
+
// the daemon origin, and the standalone bridge's ./tool-call made absolute.
|
|
204
|
+
function transformChatHtmlForBlob(html, url, token){
|
|
205
|
+
var origin = new URL(url).origin;
|
|
206
|
+
var tc = new URL('./tool-call', url);
|
|
207
|
+
tc.searchParams.set('et', token);
|
|
208
|
+
// The app-visible query for the blob doc: the deep link's search minus the
|
|
209
|
+
// embed token (the token must not ride the app's visible params). The
|
|
210
|
+
// blob document's own location has no params, so this is the ONLY channel
|
|
211
|
+
// for ?session= / ?embed=1 \u2014 the app reads it via bootSearchParams().
|
|
212
|
+
var bootUrl = new URL(url);
|
|
213
|
+
bootUrl.searchParams.delete('et');
|
|
214
|
+
var bootQuery = bootUrl.search;
|
|
215
|
+
var shim = '<script>(function(){'
|
|
216
|
+
+ 'try { window.parent.postMessage({ type: ${JSON.stringify(BLOB_BOOT_MESSAGE_TYPE)} }, "*"); } catch (_) {}'
|
|
217
|
+
+ 'var ORIGIN = ' + JSON.stringify(origin) + ', TOKEN = ' + JSON.stringify(token) + ';'
|
|
218
|
+
+ 'window.__AGENTPROTO_BASEURL__ = ORIGIN;'
|
|
219
|
+
+ 'var _h = window.history, _rs = _h.replaceState.bind(_h), _ps = _h.pushState.bind(_h);'
|
|
220
|
+
+ 'function _sameOrLoc(u){'
|
|
221
|
+
+ 'try {'
|
|
222
|
+
+ 'var x = new URL(u == null ? window.location.href : u, document.baseURI);'
|
|
223
|
+
+ 'return x.origin === window.location.origin ? u : window.location.href;'
|
|
224
|
+
+ '} catch (_) { return window.location.href; }'
|
|
225
|
+
+ '}'
|
|
226
|
+
+ '_h.replaceState = function(s, t, u){'
|
|
227
|
+
+ 'try { _rs(s, t, _sameOrLoc(u)); } catch (_) { try { _rs(s, t, window.location.href); } catch (_) {} }'
|
|
228
|
+
+ '};'
|
|
229
|
+
+ '_h.pushState = function(s, t, u){'
|
|
230
|
+
+ 'try { _ps(s, t, _sameOrLoc(u)); } catch (_) { try { _ps(s, t, window.location.href); } catch (_) {} }'
|
|
231
|
+
+ '};'
|
|
232
|
+
+ 'window.__AGENTPROTO_BOOT_QUERY__ = ' + JSON.stringify(bootQuery) + ';'
|
|
233
|
+
+ 'function withEt(u){'
|
|
234
|
+
+ 'try {'
|
|
235
|
+
+ 'var x = new URL(String(u), document.baseURI);'
|
|
236
|
+
+ 'if (x.origin !== ORIGIN) return null;'
|
|
237
|
+
+ 'if (!x.searchParams.has("et")) x.searchParams.set("et", TOKEN);'
|
|
238
|
+
+ 'return x.href;'
|
|
239
|
+
+ '} catch (_) { return null; }'
|
|
240
|
+
+ '}'
|
|
241
|
+
+ 'var _fetch = window.fetch;'
|
|
242
|
+
+ 'if (typeof _fetch === "function") {'
|
|
243
|
+
+ 'window.fetch = function(input, init){'
|
|
244
|
+
+ 'var r;'
|
|
245
|
+
+ 'if (typeof Request !== "undefined" && input instanceof Request) {'
|
|
246
|
+
+ 'r = withEt(input.url);'
|
|
247
|
+
+ 'if (r) { try { input = new Request(r, input); } catch (_) {} }'
|
|
248
|
+
+ '} else {'
|
|
249
|
+
+ 'r = withEt(input);'
|
|
250
|
+
+ 'if (r) input = r;'
|
|
251
|
+
+ '}'
|
|
252
|
+
+ 'return _fetch.call(window, input, init);'
|
|
253
|
+
+ '};'
|
|
254
|
+
+ '}'
|
|
255
|
+
+ 'var _ES = window.EventSource;'
|
|
256
|
+
+ 'if (typeof _ES === "function") {'
|
|
257
|
+
+ 'window.EventSource = function(u, cfg){ return new _ES(withEt(u) || u, cfg); };'
|
|
258
|
+
+ 'window.EventSource.prototype = _ES.prototype;'
|
|
259
|
+
+ '}'
|
|
260
|
+
+ '})();<\\/script>';
|
|
261
|
+
var head = '<base href="' + _blobEscapeAttr(url) + '">' + shim;
|
|
262
|
+
var m = html.match(/<head[^>]*>/i);
|
|
263
|
+
var out = m
|
|
264
|
+
? html.slice(0, m.index + m[0].length) + head + html.slice(m.index + m[0].length)
|
|
265
|
+
: head + html;
|
|
266
|
+
return out.split('fetch("./tool-call"').join('fetch(' + JSON.stringify(tc.href));
|
|
267
|
+
}`;
|
|
268
|
+
}
|
|
269
|
+
|
|
10
270
|
// src/session-chat/panel.ts
|
|
11
271
|
function escapeAttr(text) {
|
|
12
272
|
return text.replace(/&/g, "&").replace(/"/g, """);
|
|
13
273
|
}
|
|
14
274
|
function sessionChatEmbedHtml(initData) {
|
|
15
|
-
const url = initData.url;
|
|
16
|
-
const
|
|
17
|
-
const
|
|
275
|
+
const url = typeof initData.url === "string" && initData.url ? initData.url : null;
|
|
276
|
+
const notInstalled = initData.installed === false;
|
|
277
|
+
const link = url != null ? `<a href="${escapeAttr(url)}" target="_blank" rel="noreferrer">open in a tab</a>` : notInstalled ? "app not installed" : "connecting\u2026";
|
|
278
|
+
const iframe = url != null ? `<iframe id="chat" title="Session Chat"></iframe>` : "";
|
|
18
279
|
return `<!DOCTYPE html>
|
|
19
280
|
<html lang="en">
|
|
20
281
|
<head>
|
|
@@ -26,12 +287,354 @@ function sessionChatEmbedHtml(initData) {
|
|
|
26
287
|
html,body{height:100%;font-family:system-ui,-apple-system,sans-serif;background:#0d1117;color:#e6edf3;overflow:hidden}
|
|
27
288
|
#bar{padding:6px 12px;font-size:12px;color:#8b949e;background:#161b22;border-bottom:1px solid #30363d}
|
|
28
289
|
#bar a{color:#58a6ff}
|
|
29
|
-
#
|
|
290
|
+
#mode{color:#6e7681}
|
|
291
|
+
#stage{position:relative;height:calc(100% - 29px)}
|
|
292
|
+
#chat{position:absolute;inset:0;z-index:2;border:0;display:block;width:100%;height:100%}
|
|
293
|
+
#card{position:absolute;inset:0;z-index:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;text-align:center;padding:24px}
|
|
294
|
+
#card h2{font-size:15px;font-weight:600}
|
|
295
|
+
#card .sid{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px;color:#8b949e;background:#161b22;border:1px solid #30363d;border-radius:4px;padding:2px 8px}
|
|
296
|
+
#card p{font-size:12px;color:#8b949e;max-width:420px;line-height:1.5}
|
|
297
|
+
#card a{display:inline-block;margin-top:2px;border:1px solid #30363d;background:#161b22;color:#58a6ff;font-size:13px;padding:7px 14px;border-radius:6px;text-decoration:none}
|
|
298
|
+
#card a:hover{border-color:#58a6ff}
|
|
299
|
+
#notice{display:none;max-width:560px;margin:0 auto;padding:48px 24px;line-height:1.6}
|
|
300
|
+
#notice.show{display:block}
|
|
301
|
+
#notice h1{font-size:18px;margin-bottom:12px}
|
|
302
|
+
#notice code{background:#161b22;border:1px solid #30363d;border-radius:4px;padding:2px 6px;font-size:13px}
|
|
303
|
+
#notice p{margin:8px 0;color:#8b949e;font-size:13px}
|
|
30
304
|
</style>
|
|
31
305
|
</head>
|
|
32
306
|
<body>
|
|
33
|
-
<div id="bar">Session Chat ·
|
|
34
|
-
|
|
307
|
+
<div id="bar">Session Chat · <span id="link">${link}</span><span id="mode"></span></div>
|
|
308
|
+
<div id="stage">${iframe}<div id="card">
|
|
309
|
+
<h2>Session Chat</h2>
|
|
310
|
+
<div id="card-session" class="sid">—</div>
|
|
311
|
+
<p>Full embed isn't supported by this host — the chat opens in a browser tab.</p>
|
|
312
|
+
<a id="card-open" href="#" target="_blank" rel="noreferrer">Open chat</a>
|
|
313
|
+
</div><div id="notice"${notInstalled ? ' class="show"' : ""}>
|
|
314
|
+
<h1>Session Chat is not installed</h1>
|
|
315
|
+
<p>This panel is a thin launcher for the <code>@agentik/session-chat</code> app —
|
|
316
|
+
it does not bundle the chat UI itself.</p>
|
|
317
|
+
<p>To use it, install the app into this daemon:</p>
|
|
318
|
+
<p><code>agentproto app install @agentik/session-chat</code></p>
|
|
319
|
+
</div></div>
|
|
320
|
+
<script>
|
|
321
|
+
window.__APP_INIT__ = ${JSON.stringify(initData)};
|
|
322
|
+
|
|
323
|
+
${panelBridgeScript("agentproto-session-chat")}
|
|
324
|
+
|
|
325
|
+
${blobEmbedScript()}
|
|
326
|
+
|
|
327
|
+
// \u2500\u2500 Session-chat launcher logic \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
328
|
+
var mountedUrl = (window.__APP_INIT__ && window.__APP_INIT__.url) || null;
|
|
329
|
+
var pinnedSessionId = null; // session named by the host's tool-result push
|
|
330
|
+
var pendingUrl = null; // url pushed by the host before the bridge was up
|
|
331
|
+
var pendingNotInstalled = false;
|
|
332
|
+
var bridged = false;
|
|
333
|
+
var cardUrl = null; // deep link once resolved (drives the card button)
|
|
334
|
+
var cardSessionEl = document.getElementById('card-session');
|
|
335
|
+
var cardOpenEl = document.getElementById('card-open');
|
|
336
|
+
var mountGen = 0; // bumps per mount(); async work checks it before touching the DOM
|
|
337
|
+
var blobUrl = null; // live object url of the blob-mounted chat, if any
|
|
338
|
+
var blobBootTimer = null;
|
|
339
|
+
var blobBootOk = false;
|
|
340
|
+
|
|
341
|
+
function escapeHtml(text) {
|
|
342
|
+
return String(text).replace(/&/g, '&').replace(/</g, '<').replace(/"/g, '"');
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
function setMode(text) {
|
|
346
|
+
document.getElementById('mode').textContent = text ? ' \\u00b7 ' + text : '';
|
|
347
|
+
// The chat app is live inside the frame \u2014 the launcher bar (title, deep
|
|
348
|
+
// link, mount mode) is noise on top of the real surface. Hide it and let
|
|
349
|
+
// the frame own the full height. Only a failed mount (launcher card /
|
|
350
|
+
// not-installed notice) shows the bar again.
|
|
351
|
+
var bar = document.getElementById('bar');
|
|
352
|
+
var stage = document.getElementById('stage');
|
|
353
|
+
if (bar && stage) {
|
|
354
|
+
bar.style.display = text ? 'none' : '';
|
|
355
|
+
stage.style.height = text ? '100%' : 'calc(100% - 29px)';
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
// One fresh #chat frame on the stage (over the card), the previous one gone.
|
|
360
|
+
function newFrame() {
|
|
361
|
+
var stage = document.getElementById('stage');
|
|
362
|
+
var old = document.getElementById('chat');
|
|
363
|
+
if (old) old.remove();
|
|
364
|
+
var frame = document.createElement('iframe');
|
|
365
|
+
frame.id = 'chat';
|
|
366
|
+
frame.title = 'Session Chat';
|
|
367
|
+
stage.insertBefore(frame, stage.firstChild);
|
|
368
|
+
return frame;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
function revokeBlob() {
|
|
372
|
+
if (blobBootTimer) { clearTimeout(blobBootTimer); blobBootTimer = null; }
|
|
373
|
+
if (blobUrl) {
|
|
374
|
+
try { URL.revokeObjectURL(blobUrl); } catch (_) {}
|
|
375
|
+
blobUrl = null;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
function mount(url) {
|
|
380
|
+
if (!url || url === mountedUrl) return;
|
|
381
|
+
mountedUrl = url;
|
|
382
|
+
var gen = ++mountGen;
|
|
383
|
+
revokeBlob();
|
|
384
|
+
document.getElementById('notice').className = '';
|
|
385
|
+
setCardUrl(url);
|
|
386
|
+
document.getElementById('link').innerHTML =
|
|
387
|
+
'<a href="' + escapeHtml(url) + '" target="_blank" rel="noreferrer">open in a tab</a>';
|
|
388
|
+
var tokened = withEmbedToken(url);
|
|
389
|
+
if (tokened === url) {
|
|
390
|
+
// No per-boot token baked in (standalone tab, VS Code HTTP-iframe panel):
|
|
391
|
+
// the direct frame already passes the daemon's origin checks, and the
|
|
392
|
+
// blob path's daemon calls would have nothing to carry \u2014 skip it.
|
|
393
|
+
mountDirect(url);
|
|
394
|
+
return;
|
|
395
|
+
}
|
|
396
|
+
mountBlob(url, tokened, gen).catch(function (err) {
|
|
397
|
+
if (gen !== mountGen) return;
|
|
398
|
+
// The fetch itself was refused (host connect-src not merging our
|
|
399
|
+
// connectDomains, PNA, daemon down, \u2026) \u2014 probe answered: no blob path.
|
|
400
|
+
console.warn('[session-chat] blob mount failed, falling back to a direct frame:',
|
|
401
|
+
err && err.message ? err.message : String(err));
|
|
402
|
+
mountDirect(url);
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
// Direct-src iframe of the deep link, with the block probe \u2192 launcher card
|
|
407
|
+
// fallback. The terminal mount path when the blob one is unavailable.
|
|
408
|
+
function mountDirect(url) {
|
|
409
|
+
var frame = newFrame();
|
|
410
|
+
frame.src = withEmbedToken(url);
|
|
411
|
+
setMode('direct frame');
|
|
412
|
+
armBlockProbe(frame);
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
// Blob pass-through: fetch the chat html through the embed token, rewrite it
|
|
416
|
+
// for life as a blob: document (transformChatHtmlForBlob, blob-embed.ts) and
|
|
417
|
+
// mount it \u2014 blob: passes a host frame-src that refuses the daemon origin.
|
|
418
|
+
function mountBlob(url, tokened, gen) {
|
|
419
|
+
return fetch(tokened, { credentials: 'omit' }).then(function (res) {
|
|
420
|
+
if (!res.ok) throw new Error('HTTP ' + res.status);
|
|
421
|
+
return res.text();
|
|
422
|
+
}).then(function (html) {
|
|
423
|
+
if (gen !== mountGen) return;
|
|
424
|
+
var doc = transformChatHtmlForBlob(html, url, window.__AGENPROTO_EMBED_TOKEN__);
|
|
425
|
+
blobUrl = URL.createObjectURL(new Blob([doc], { type: 'text/html' }));
|
|
426
|
+
var frame = newFrame();
|
|
427
|
+
armBlobBootProbe(frame, url, gen);
|
|
428
|
+
frame.src = blobUrl;
|
|
429
|
+
setMode('embedded');
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
// The blob document's shim posts a boot ack as its first statement. No ack
|
|
434
|
+
// within the settle window means the host refused the blob frame or its
|
|
435
|
+
// inherited CSP killed the document's inline scripts \u2014 surface that through
|
|
436
|
+
// the direct-frame path (whose own probe ends on the launcher card) rather
|
|
437
|
+
// than leaving a silent blank.
|
|
438
|
+
window.addEventListener('message', function (evt) {
|
|
439
|
+
var d = evt.data;
|
|
440
|
+
if (!d || typeof d !== 'object' || d.type !== ${JSON.stringify(BLOB_BOOT_MESSAGE_TYPE)}) return;
|
|
441
|
+
var frame = document.getElementById('chat');
|
|
442
|
+
if (!frame || evt.source !== frame.contentWindow) return;
|
|
443
|
+
blobBootOk = true;
|
|
444
|
+
if (blobBootTimer) { clearTimeout(blobBootTimer); blobBootTimer = null; }
|
|
445
|
+
});
|
|
446
|
+
|
|
447
|
+
function armBlobBootProbe(frame, url, gen) {
|
|
448
|
+
blobBootOk = false;
|
|
449
|
+
blobBootTimer = setTimeout(function () {
|
|
450
|
+
blobBootTimer = null;
|
|
451
|
+
if (gen !== mountGen || blobBootOk) return;
|
|
452
|
+
console.warn('[session-chat] blob document never booted (host CSP?), falling back to a direct frame');
|
|
453
|
+
revokeBlob();
|
|
454
|
+
frame.remove();
|
|
455
|
+
mountDirect(url);
|
|
456
|
+
}, 5000);
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
function showNotInstalled() {
|
|
460
|
+
var old = document.getElementById('chat');
|
|
461
|
+
if (old) old.remove();
|
|
462
|
+
revokeBlob();
|
|
463
|
+
setMode('');
|
|
464
|
+
mountedUrl = null;
|
|
465
|
+
document.getElementById('card').style.display = 'none';
|
|
466
|
+
document.getElementById('notice').className = 'show';
|
|
467
|
+
document.getElementById('link').textContent = 'app not installed';
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
// The body of an ext-apps tool-result notification, whichever wrapping
|
|
471
|
+
// shape the host uses (params IS the CallToolResult, or nests it under
|
|
472
|
+
// params.result). null for error results / non-JSON text.
|
|
473
|
+
function parseToolResultBody(params) {
|
|
474
|
+
if (!params || typeof params !== 'object') return null;
|
|
475
|
+
var res = (params.result && typeof params.result === 'object') ? params.result : params;
|
|
476
|
+
if (res.isError) return null;
|
|
477
|
+
var content = Array.isArray(res.content) ? res.content : [];
|
|
478
|
+
var item = content[0];
|
|
479
|
+
if (!item || item.type !== 'text' || typeof item.text !== 'string') return null;
|
|
480
|
+
try { return JSON.parse(item.text); } catch (_) { return null; }
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
// INLINED COPY of live-session/logic.ts extractToolResultSessionId \u2014 keep
|
|
484
|
+
// in sync. \`sessionId\` (an agentproto_session_chat / live_session result)
|
|
485
|
+
// wins over \`id\` (an agent_start result: the spawned session descriptor).
|
|
486
|
+
function extractToolResultSessionId(params) {
|
|
487
|
+
var body = parseToolResultBody(params);
|
|
488
|
+
if (!body) return null;
|
|
489
|
+
if (typeof body.sessionId === 'string' && body.sessionId) return body.sessionId;
|
|
490
|
+
if (typeof body.id === 'string' && body.id) return body.id;
|
|
491
|
+
return null;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
// \u2500\u2500 Embed-token refresh \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
495
|
+
// The token baked into this page by registerMcpApps dies with the daemon
|
|
496
|
+
// boot that minted it (runtime embed-tokens.ts), but hosts cache the
|
|
497
|
+
// rendered widget: Claude Desktop keeps a conversation's srcdoc, so after
|
|
498
|
+
// any daemon restart the cached page replays a dead token and every daemon
|
|
499
|
+
// call 403s \u2014 the blob fetch fails, the direct frame is refused, and the
|
|
500
|
+
// user is left on the launcher card forever. Every tool result carries a
|
|
501
|
+
// live token (SessionChatOutput.embedToken), so adopt it before mounting.
|
|
502
|
+
//
|
|
503
|
+
// Only a render that WAS baked refreshes. A standalone tab or VS Code
|
|
504
|
+
// HTTP-iframe panel still holds the literal placeholder and passes the
|
|
505
|
+
// daemon's origin checks on its own; handing it a token would switch it
|
|
506
|
+
// onto the blob path for no reason.
|
|
507
|
+
function adoptEmbedToken(body) {
|
|
508
|
+
var cur = window.__AGENPROTO_EMBED_TOKEN__;
|
|
509
|
+
if (!cur || cur === '__AGENPROTO_EMBED_TOKEN__') return;
|
|
510
|
+
if (!body || typeof body.embedToken !== 'string' || !body.embedToken) return;
|
|
511
|
+
window.__AGENPROTO_EMBED_TOKEN__ = body.embedToken;
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
// Turn a session id into the installed app's deep link over the bridge.
|
|
515
|
+
function resolveSession(sessionId) {
|
|
516
|
+
noteSession(sessionId);
|
|
517
|
+
return callTool('agentproto_session_chat', sessionId ? { sessionId: sessionId } : {})
|
|
518
|
+
.then(function(out) {
|
|
519
|
+
adoptEmbedToken(out);
|
|
520
|
+
if (out && out.installed && typeof out.url === 'string' && out.url) mount(out.url);
|
|
521
|
+
else showNotInstalled();
|
|
522
|
+
})
|
|
523
|
+
.catch(function(err) {
|
|
524
|
+
document.getElementById('link').textContent = 'bridge error: ' + (err && err.message ? err.message : String(err));
|
|
525
|
+
});
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
// \u2500\u2500 Launcher card (the frame-blocked fallback UI) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
529
|
+
// The iframe mounts OVER the card. When the host's own CSP refuses the
|
|
530
|
+
// frame (Claude Desktop / Codex widget frames run frame-src 'self' blob:
|
|
531
|
+
// data: and do not yet merge csp.frameDomains), the frame stays on a
|
|
532
|
+
// same-origin about:blank \u2014 readable, unlike the loaded cross-origin chat \u2014
|
|
533
|
+
// and is removed after a settle window so the card becomes the interactive
|
|
534
|
+
// surface.
|
|
535
|
+
//
|
|
536
|
+
// The anchor carries target="_blank" rel="noreferrer" as the fallback path,
|
|
537
|
+
// but that is a plain no-op in hosts that sandbox the widget iframe without
|
|
538
|
+
// allow-popups (observed in Claude Desktop's side chat) \u2014 a normal click
|
|
539
|
+
// on such a host does nothing. Where the host advertises the capability
|
|
540
|
+
// (McpUiInitializeResult.hostCapabilities.openLinks in the ext-apps spec,
|
|
541
|
+
// captured by the bridge's getHostCapabilities()), route through the
|
|
542
|
+
// host-mediated ui/open-link request instead, which is not subject to the
|
|
543
|
+
// iframe's popup sandboxing.
|
|
544
|
+
cardOpenEl.addEventListener('click', function (evt) {
|
|
545
|
+
if (!cardUrl) { evt.preventDefault(); return; }
|
|
546
|
+
if (getHostCapabilities() && getHostCapabilities().openLinks) {
|
|
547
|
+
evt.preventDefault();
|
|
548
|
+
openLink(cardUrl).catch(function () { window.open(cardUrl, '_blank'); });
|
|
549
|
+
}
|
|
550
|
+
});
|
|
551
|
+
|
|
552
|
+
function noteSession(id) {
|
|
553
|
+
if (id && cardSessionEl) cardSessionEl.textContent = id;
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
function setCardUrl(u) {
|
|
557
|
+
if (!u) return;
|
|
558
|
+
cardUrl = u;
|
|
559
|
+
cardOpenEl.setAttribute('href', u);
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
// A blocked frame never leaves about:blank (same-origin with this page \u2014
|
|
563
|
+
// readable); the loaded chat is cross-origin (the probe throws). A readable
|
|
564
|
+
// frame that is STILL blank when the settle window closes = blocked.
|
|
565
|
+
function isBlank(frame) {
|
|
566
|
+
try { return frame.contentWindow.location.href === 'about:blank'; } catch (_) { return false; }
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
function armBlockProbe(frame) {
|
|
570
|
+
var settle = null;
|
|
571
|
+
function probe() {
|
|
572
|
+
if (settle) { clearTimeout(settle); settle = null; }
|
|
573
|
+
if (!isBlank(frame)) return;
|
|
574
|
+
// Still on about:blank right now \u2014 arm the settle window, but
|
|
575
|
+
// re-check when it closes: a slow (not blocked) load may have landed
|
|
576
|
+
// in the meantime, and only a frame STILL blank after the window gets
|
|
577
|
+
// removed. load firing in between clears this timeout above.
|
|
578
|
+
settle = setTimeout(function () {
|
|
579
|
+
settle = null;
|
|
580
|
+
if (isBlank(frame)) frame.remove();
|
|
581
|
+
}, 2000);
|
|
582
|
+
}
|
|
583
|
+
setTimeout(function () {
|
|
584
|
+
frame.addEventListener('load', probe);
|
|
585
|
+
probe();
|
|
586
|
+
}, 100);
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
// A url baked at render time (a host that re-renders per call with a real
|
|
590
|
+
// initData) mounts on boot \u2014 through the same blob-first path as every
|
|
591
|
+
// other mount, since the same opaque widget context frames it. The
|
|
592
|
+
// pre-rendered #chat frame is replaced by mount()'s own.
|
|
593
|
+
if (mountedUrl) {
|
|
594
|
+
var bootUrl = mountedUrl;
|
|
595
|
+
mountedUrl = null;
|
|
596
|
+
adoptEmbedToken(window.__APP_INIT__);
|
|
597
|
+
mount(bootUrl);
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
// The host pushes the triggering tool call's result (ext-apps
|
|
601
|
+
// ui/notifications/tool-result). For agent_start that result IS the spawned
|
|
602
|
+
// session's descriptor \u2014 pin the widget to THAT session.
|
|
603
|
+
onHostNotification(function(method, params) {
|
|
604
|
+
if (method !== 'ui/notifications/tool-result') return;
|
|
605
|
+
var body = parseToolResultBody(params);
|
|
606
|
+
if (!body) return;
|
|
607
|
+
if (typeof body.url === 'string' && body.url && body.installed !== false) {
|
|
608
|
+
// Adopt now, not at mount time: the token doesn't depend on the bridge.
|
|
609
|
+
adoptEmbedToken(body);
|
|
610
|
+
if (bridged) mount(body.url); else pendingUrl = body.url;
|
|
611
|
+
return;
|
|
612
|
+
}
|
|
613
|
+
if (body.installed === false) {
|
|
614
|
+
if (bridged) showNotInstalled(); else pendingNotInstalled = true;
|
|
615
|
+
return;
|
|
616
|
+
}
|
|
617
|
+
var id = extractToolResultSessionId(params);
|
|
618
|
+
if (!id || id === pinnedSessionId) return;
|
|
619
|
+
pinnedSessionId = id;
|
|
620
|
+
noteSession(id);
|
|
621
|
+
if (bridged) resolveSession(id);
|
|
622
|
+
});
|
|
623
|
+
|
|
624
|
+
initBridge().then(function() {
|
|
625
|
+
bridged = true;
|
|
626
|
+
if (pendingUrl) { mount(pendingUrl); pendingUrl = null; return; }
|
|
627
|
+
if (pendingNotInstalled) { showNotInstalled(); return; }
|
|
628
|
+
if (mountedUrl) return; // rendered with a real url
|
|
629
|
+
var init = window.__APP_INIT__ || {};
|
|
630
|
+
if (init.installed === false) { showNotInstalled(); return; }
|
|
631
|
+
// No url baked in (static ui:// render): resolve over the bridge \u2014 the
|
|
632
|
+
// pinned session when the host named one, else the app's picker.
|
|
633
|
+
return resolveSession(pinnedSessionId);
|
|
634
|
+
}).catch(function(err) {
|
|
635
|
+
document.getElementById('link').textContent = 'bridge error: ' + (err && err.message ? err.message : String(err));
|
|
636
|
+
});
|
|
637
|
+
</script>
|
|
35
638
|
</body>
|
|
36
639
|
</html>`;
|
|
37
640
|
}
|
|
@@ -78,7 +681,7 @@ function sessionChatAppUrl(httpBaseUrl, sessionId) {
|
|
|
78
681
|
params.set("embed", "1");
|
|
79
682
|
return `${base}?${params.toString()}`;
|
|
80
683
|
}
|
|
81
|
-
function
|
|
684
|
+
function daemonOrigin(httpBaseUrl) {
|
|
82
685
|
return new URL(httpBaseUrl).origin;
|
|
83
686
|
}
|
|
84
687
|
function makeSessionChatApp(ops) {
|
|
@@ -88,12 +691,27 @@ function makeSessionChatApp(ops) {
|
|
|
88
691
|
title: "Session Chat",
|
|
89
692
|
description: "Open the Session Chat app \u2014 a chat-thread view of any agentproto daemon session: full transcript replay, live follow-over SSE, and a composer that sends prompts into the same session. Requires the `@agentik/session-chat` app to be installed; without it the panel shows install instructions. Pass `sessionId` to deep-link straight into a known session.",
|
|
90
693
|
inputSchema: sessionChatInputSchema,
|
|
91
|
-
execute: async (input) =>
|
|
92
|
-
installed,
|
|
93
|
-
|
|
94
|
-
|
|
694
|
+
execute: async (input) => {
|
|
695
|
+
if (!installed) return { installed, url: null };
|
|
696
|
+
const token = ops.mintEmbedToken?.();
|
|
697
|
+
return {
|
|
698
|
+
installed,
|
|
699
|
+
url: sessionChatAppUrl(ops.httpBaseUrl, input.sessionId),
|
|
700
|
+
// Re-arms a cached widget whose baked token died with an earlier
|
|
701
|
+
// daemon boot (see SessionChatOutput.embedToken).
|
|
702
|
+
...token ? { embedToken: token } : {}
|
|
703
|
+
};
|
|
704
|
+
},
|
|
95
705
|
html: (initData) => sessionChatEmbedHtml(initData),
|
|
96
|
-
|
|
706
|
+
// Spec-correct either way (ext-apps McpUiResourceMeta). Measured
|
|
707
|
+
// 2026-09-18: Claude Desktop / Codex do NOT merge frameDomains into
|
|
708
|
+
// their widget frame-src; whether they merge connectDomains is unknown,
|
|
709
|
+
// so the panel probes it at runtime (blob fetch → fallback) rather than
|
|
710
|
+
// assuming either way.
|
|
711
|
+
csp: {
|
|
712
|
+
frameDomains: [daemonOrigin(ops.httpBaseUrl)],
|
|
713
|
+
connectDomains: [daemonOrigin(ops.httpBaseUrl)]
|
|
714
|
+
}
|
|
97
715
|
};
|
|
98
716
|
}
|
|
99
717
|
var sessionChatApp = defineApp({
|
|
@@ -108,6 +726,6 @@ var sessionChatApp = defineApp({
|
|
|
108
726
|
}
|
|
109
727
|
});
|
|
110
728
|
|
|
111
|
-
export { SESSION_CHAT_APP_ID, SESSION_CHAT_FALLBACK_HTML, makeSessionChatApp, sessionChatApp, sessionChatAppUrl, sessionChatEmbedHtml, sessionChatInputSchema };
|
|
729
|
+
export { BLOB_BOOT_MESSAGE_TYPE, SESSION_CHAT_APP_ID, SESSION_CHAT_FALLBACK_HTML, blobEmbedScript, makeSessionChatApp, sessionChatApp, sessionChatAppUrl, sessionChatEmbedHtml, sessionChatInputSchema };
|
|
112
730
|
//# sourceMappingURL=session-chat.mjs.map
|
|
113
731
|
//# sourceMappingURL=session-chat.mjs.map
|