zidane-gui 9.1.16 → 9.1.17
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/out/main/index.js +851 -59
- package/out/preload/index.mjs +31 -2
- package/out/renderer/assets/{43YPWK3Q-DqQmzBPu.js → 43YPWK3Q-1wyGHRhG.js} +8 -8
- package/out/renderer/assets/{45MVAN6X-CYP7xDN8.js → 45MVAN6X-CCX59Sl8.js} +7 -7
- package/out/renderer/assets/{46GJKBLZ-Co9yrG8W.js → 46GJKBLZ-BfO42B_T.js} +12 -12
- package/out/renderer/assets/{63WH7YNF-JjkWKCFV.js → 63WH7YNF-CML8-yHW.js} +10 -10
- package/out/renderer/assets/{6DDU7VKX-BbtUMWO4.js → 6DDU7VKX-CYg_yoLw.js} +8 -8
- package/out/renderer/assets/{CLQLV5VT-Ba6obVJu.js → CLQLV5VT-Bg0M-SGs.js} +8 -8
- package/out/renderer/assets/{CUSPXG5M-BeHLB3vL.js → CUSPXG5M-CsYKrsuv.js} +8 -8
- package/out/renderer/assets/{CodeEditor-DAvsCy4c.js → CodeEditor-mxUtgGJl.js} +5 -5
- package/out/renderer/assets/{ComposerEditor-CmebUdQf.js → ComposerEditor-CzlLgqm3.js} +6 -6
- package/out/renderer/assets/{D3L7O4X2-Bz5JjvM3.js → D3L7O4X2-DUIFiQQs.js} +6 -6
- package/out/renderer/assets/{D5TW5CPZ-COD7XA6N.js → D5TW5CPZ-B5G-YYi_.js} +1 -1
- package/out/renderer/assets/{DiffsTab-Cg5SMPpy.js → DiffsTab-DTkod12Z.js} +12 -12
- package/out/renderer/assets/{EGADTWYV-DnX4xYm9.js → EGADTWYV-C5ja_Lm2.js} +7 -7
- package/out/renderer/assets/{EOJSJZXM-C1MKUH-z.js → EOJSJZXM-Dda_vMqK.js} +10 -10
- package/out/renderer/assets/{EditorWorkers-BfFVQ69E.js → EditorWorkers-4yw3sh7s.js} +9 -8
- package/out/renderer/assets/{FileIcon-acads6Ac.js → FileIcon-DlpPG4Tv.js} +1 -1
- package/out/renderer/assets/{FilesTab-RbqMfCrC.js → FilesTab-DwqtloUX.js} +337 -36
- package/out/renderer/assets/{G2OEIG6X-Dtesfr7X.js → G2OEIG6X-8IWIlJoy.js} +7 -7
- package/out/renderer/assets/{GXJ2T77W-BkncFrMb.js → GXJ2T77W-K_AYpQU1.js} +8 -8
- package/out/renderer/assets/{HX3UMAK7-DyzWjT_c.js → HX3UMAK7-CXREbgl0.js} +7 -7
- package/out/renderer/assets/{IU7WZTP6-C4qRhHoM.js → IU7WZTP6-DxZaf96h.js} +1 -1
- package/out/renderer/assets/{J5J2NR2G-2GjekDt4.js → J5J2NR2G-DvD4FXRy.js} +6 -6
- package/out/renderer/assets/{JRCWTJEL-Dto8Fjzi.js → JRCWTJEL-Dl83Hlzn.js} +5 -5
- package/out/renderer/assets/{KHUP5TOH-DWatm9RV.js → KHUP5TOH-CsVBjKaO.js} +1 -1
- package/out/renderer/assets/{L74FQTH5-YWQWDmAR.js → L74FQTH5-DWSyibfN.js} +6 -6
- package/out/renderer/assets/{LAV4ZXOS-BDeemsOt.js → LAV4ZXOS-DCtpD44i.js} +8 -8
- package/out/renderer/assets/{LBIZYCRR-CuJZ9kCp.js → LBIZYCRR-DpNXkUqg.js} +9 -9
- package/out/renderer/assets/{LFFXNLRS-CYLYOq-d.js → LFFXNLRS-CfnB3vZl.js} +5 -5
- package/out/renderer/assets/{LLLWOAQD-B6r0O-b8.js → LLLWOAQD-BOJG2YQq.js} +1 -1
- package/out/renderer/assets/{LTYQZ5U5-C6Vwu29l.js → LTYQZ5U5-Dw9W0QpI.js} +8 -8
- package/out/renderer/assets/{NDSCUZ25-D49aLwGZ.js → NDSCUZ25-B7bWy0v0.js} +2 -2
- package/out/renderer/assets/{NMN3IKWL-CmFbUlVt.js → NMN3IKWL-YWUccb3M.js} +11 -11
- package/out/renderer/assets/{NMUA3R2D-BmYN27sp.js → NMUA3R2D-PM0msfx1.js} +9 -9
- package/out/renderer/assets/{NY5A6PPW-CFmWX6Y1.js → NY5A6PPW-BiV0tPIy.js} +5 -5
- package/out/renderer/assets/{OHJ2EJXK-BkSNlV9q.js → OHJ2EJXK-B1XaNGkt.js} +1 -1
- package/out/renderer/assets/{OU2GIT2H-Df8P_VMV.js → OU2GIT2H-CnRIS6XL.js} +6 -6
- package/out/renderer/assets/{PDMLSE6I-B1fxTWPk.js → PDMLSE6I-D2L4rd2W.js} +2 -2
- package/out/renderer/assets/{PJ7X32S5-jmIr_WuS.js → PJ7X32S5-BDIGjA8B.js} +7 -7
- package/out/renderer/assets/{RLLQ44NJ-Bk5ATCRc.js → RLLQ44NJ-Du6_4Ch9.js} +9 -9
- package/out/renderer/assets/{S6DWMCK5-ru17f61y.js → S6DWMCK5-BCek3BK9.js} +10 -10
- package/out/renderer/assets/{STIOTUT7-D3W8oemx.js → STIOTUT7-Di8tUtxD.js} +8 -8
- package/out/renderer/assets/{SXSLPWUD-BP8ObIM3.js → SXSLPWUD-CUkLp4Fg.js} +2 -2
- package/out/renderer/assets/{TR4WJQGX-DwQDLHm2.js → TR4WJQGX-DghxArE6.js} +1 -1
- package/out/renderer/assets/TranscriptViews-D-F4TCT7.js +28 -0
- package/out/renderer/assets/{UWRPUF3N-BefBSoyh.js → UWRPUF3N-qS1g5ho1.js} +1 -1
- package/out/renderer/assets/{VSWIZJ7B-QwUQICP_.js → VSWIZJ7B-BKZhRmsN.js} +1 -1
- package/out/renderer/assets/ViewBlock-BcCbp_nS.js +1536 -0
- package/out/renderer/assets/ViewCharts-DuQAWU2F.js +6350 -0
- package/out/renderer/assets/ViewCustom-D5CeSx32.js +240 -0
- package/out/renderer/assets/ViewExtension-q6W__eQm.js +74 -0
- package/out/renderer/assets/ViewInputs-BwIsKHHk.js +407 -0
- package/out/renderer/assets/ViewMcpApp-BJxpfIUe.js +607 -0
- package/out/renderer/assets/ViewTables-D7FxVTon.js +284 -0
- package/out/renderer/assets/{WM7NR6YK-CRccSJmx.js → WM7NR6YK-BCt1dKcj.js} +6 -6
- package/out/renderer/assets/{WXKV2YEK-AiJtxeS-.js → WXKV2YEK-C1EL6EKw.js} +5 -5
- package/out/renderer/assets/{XLHPVVFU-CISC9r_V.js → XLHPVVFU-BN2wXqoc.js} +1 -1
- package/out/renderer/assets/{YNX532HU-CY_1HOiG.js → YNX532HU-BtmHcbvF.js} +7 -7
- package/out/renderer/assets/{YUPSMAUO-Cv2Ryk3Q.js → YUPSMAUO-CyZdB_Cb.js} +1 -1
- package/out/renderer/assets/{ZFRCZTLK-xOx-Cqik.js → ZFRCZTLK-aAZ7jHr_.js} +8 -8
- package/out/renderer/assets/{ZZDR4CN3-CDsCY6PX.js → ZZDR4CN3-BdJdxId6.js} +6 -6
- package/out/renderer/assets/{core-Drnj1qQL.js → core-CPNc3zNs.js} +1 -1
- package/out/renderer/assets/{core-Cst33ux7.js → core-CZ6gd8oJ.js} +2414 -435
- package/out/renderer/assets/{file-tabs--M9K6eWf.js → file-tabs-CgISplTF.js} +10 -9
- package/out/renderer/assets/ghostty-vt-CC3key_8.wasm +0 -0
- package/out/renderer/assets/{ghostty-web-DsF2lzXq.js → ghostty-web-DoJg8mwQ.js} +3 -3
- package/out/renderer/assets/{hastToHtml-AUrFnNH_.js → hastToHtml-Lx-c_BvK.js} +1 -1
- package/out/renderer/assets/heic-to-AUnw0rrk.js +57 -0
- package/out/renderer/assets/{highlights-BWQ-BGwF.js → highlights-BkRUNyAa.js} +7 -7
- package/out/renderer/assets/{highlights-D9DV-gLr.js → highlights-DqzA57PQ.js} +4 -4
- package/out/renderer/assets/{index-DcoAavzj.js → index-2ScxmF2I.js} +336 -195
- package/out/renderer/assets/{index-DhpOdP7M.js → index-CF84dbuf.js} +1 -1
- package/out/renderer/assets/input-preview-DTTTULd2.js +5 -0
- package/out/renderer/assets/{kit-BRekmBoz.js → kit-CjkT3Ius.js} +10084 -6109
- package/out/renderer/assets/{langs-CC8eNbvY.js → langs-CDfkqznm.js} +3 -3
- package/out/renderer/assets/{lazy-DtE8TmIe.js → lazy-BrSdiwQa.js} +3 -3
- package/out/renderer/assets/{loader-BWgWjzVT.js → loader-D2zAtI-u.js} +3 -3
- package/out/renderer/assets/{pierre-theme-DkKyEYzW.js → pierre-theme-BuOZsexm.js} +9 -9
- package/out/renderer/assets/{shiki-CahOMWmD.js → shiki-Dfvytwwf.js} +8 -8
- package/out/renderer/assets/{stream-tokenizer-CtslDDLQ.js → stream-tokenizer-BVf54Cm5.js} +2 -2
- package/out/renderer/assets/{index-C5y0Nb6N.css → styles-BsuQ5hRd.css} +641 -20
- package/out/renderer/assets/theme-watch-0b-hqR9T.js +37 -0
- package/out/renderer/assets/{themes-BVPDzAaq.js → themes-DByaI0Ud.js} +6 -6
- package/out/renderer/assets/{useDetachCleanup-1eMIugni.js → useDetachCleanup-Dn-cfZgC.js} +4 -4
- package/out/renderer/assets/{useFolderChanges-Cqv3OcO_.js → useFolderChanges-Dh2Z47jL.js} +10 -8
- package/out/renderer/assets/{vendor-BpwX-s_O.js → vendor-CadCDYU0.js} +1 -1
- package/out/renderer/assets/{vendor-editor-Cx3SvGyZ.js → vendor-editor-BJIeGzeh.js} +2 -2
- package/out/renderer/assets/{vendor-motion-BgQeucLF.js → vendor-motion-u3N9isCo.js} +1 -1
- package/out/renderer/assets/{vendor-react-bPTwWURR.js → vendor-react-BSxSjatM.js} +5 -4
- package/out/renderer/assets/view-preview-B7F51KZx.js +375 -0
- package/out/renderer/assets/zoom-reset-BfXcQTFh.js +13 -0
- package/out/renderer/index.html +8 -8
- package/out/renderer/view-preview.html +23 -0
- package/package.json +2 -2
|
@@ -0,0 +1,607 @@
|
|
|
1
|
+
import { r as reactExports, j as jsxRuntimeExports } from "./vendor-react-BSxSjatM.js";
|
|
2
|
+
import { eF as customLinkUrl, eG as MCP_APP_PROTOCOL_VERSION, eH as MCP_APP_PERMISSIONS, eE as CUSTOM_FRAME_MAX_HEIGHT } from "./core-CZ6gd8oJ.js";
|
|
3
|
+
import { u as useViewsHost, h as useViewsLabels, L as LruMap, j as useLinkRouter, M as useOptionalChatHost, K as useViewsInputs, X as useOptionalConfirm, Y as useOptionalModal, Z as MCP_APP_ORIGIN_SOURCE, n as customSlots, o as buttonClass, N as Notice } from "./kit-CjkT3Ius.js";
|
|
4
|
+
import { g as useViewportPresence, s as str, h as useViewExpanded, k as useExpandView, l as observeSize, C as CustomStatic } from "./ViewBlock-BcCbp_nS.js";
|
|
5
|
+
import { w as watchTheme } from "./theme-watch-0b-hqR9T.js";
|
|
6
|
+
import { CUSTOM_RUN_MARGIN } from "./ViewCustom-D5CeSx32.js";
|
|
7
|
+
import "./vendor-CadCDYU0.js";
|
|
8
|
+
import "./vendor-motion-u3N9isCo.js";
|
|
9
|
+
import "./vendor-editor-BJIeGzeh.js";
|
|
10
|
+
const MCP_APP_BRIDGE_PENDING_MAX = 8;
|
|
11
|
+
const MCP_APP_BRIDGE_RATE_MAX = 60;
|
|
12
|
+
const MCP_APP_BRIDGE_WINDOW_MS = 1e4;
|
|
13
|
+
const MCP_APP_MESSAGE_MAX_CHARS = 8e3;
|
|
14
|
+
const MCP_APP_CONTEXT_MAX_CHARS = 2e3;
|
|
15
|
+
const MCP_APP_DOWNLOAD_MAX_BYTES = 192 * 1024;
|
|
16
|
+
class McpAppRefusal extends Error {
|
|
17
|
+
}
|
|
18
|
+
const isObject$1 = (value) => !!value && typeof value === "object" && !Array.isArray(value);
|
|
19
|
+
const isId = (value) => typeof value === "string" || typeof value === "number" && Number.isFinite(value);
|
|
20
|
+
const INVALID_PARAMS = -32602;
|
|
21
|
+
const METHOD_NOT_FOUND = -32601;
|
|
22
|
+
const REFUSED = -32e3;
|
|
23
|
+
function contentText(content) {
|
|
24
|
+
const blocks = Array.isArray(content) ? content : content === void 0 ? [] : [content];
|
|
25
|
+
return blocks.map((block) => isObject$1(block) && block.type === "text" && typeof block.text === "string" ? block.text : "").filter(Boolean).join("\n");
|
|
26
|
+
}
|
|
27
|
+
function base64Text(text) {
|
|
28
|
+
let binary = "";
|
|
29
|
+
for (const byte of new TextEncoder().encode(text)) binary += String.fromCharCode(byte);
|
|
30
|
+
return btoa(binary);
|
|
31
|
+
}
|
|
32
|
+
function base64Bytes(data) {
|
|
33
|
+
const clean = data.replace(/\s+/g, "");
|
|
34
|
+
return Math.floor(clean.length * 3 / 4) - (clean.endsWith("==") ? 2 : clean.endsWith("=") ? 1 : 0);
|
|
35
|
+
}
|
|
36
|
+
function fileNameOf(uri) {
|
|
37
|
+
const last = uri.split(/[?#]/)[0].split(/[/\\]/).filter(Boolean).at(-1) ?? "";
|
|
38
|
+
let name = last;
|
|
39
|
+
try {
|
|
40
|
+
name = decodeURIComponent(last);
|
|
41
|
+
} catch {
|
|
42
|
+
}
|
|
43
|
+
const clean = name.replace(/[\u0000-\u001F<>:"/\\|?*]+/g, "_").replace(/^\.+/, "").slice(0, 128).trim();
|
|
44
|
+
return clean || "download";
|
|
45
|
+
}
|
|
46
|
+
function downloadOf(params) {
|
|
47
|
+
const contents = Array.isArray(params.contents) ? params.contents : [];
|
|
48
|
+
const embedded = contents.find((item) => isObject$1(item) && item.type === "resource" && isObject$1(item.resource));
|
|
49
|
+
if (!embedded) return "ui/download-file needs an embedded resource.";
|
|
50
|
+
const resource = embedded.resource;
|
|
51
|
+
const uri = typeof resource.uri === "string" ? resource.uri : "";
|
|
52
|
+
const mimeType = typeof resource.mimeType === "string" && /^[\w.+-]+\/[\w.+-]+$/.test(resource.mimeType) ? resource.mimeType : "application/octet-stream";
|
|
53
|
+
let data;
|
|
54
|
+
if (typeof resource.blob === "string") {
|
|
55
|
+
if (!/^[A-Za-z0-9+/\s]*={0,2}$/.test(resource.blob)) return "The file is not valid base64.";
|
|
56
|
+
data = resource.blob.replace(/\s+/g, "");
|
|
57
|
+
} else if (typeof resource.text === "string") {
|
|
58
|
+
if (resource.text.length > MCP_APP_DOWNLOAD_MAX_BYTES) return "The file is larger than 192 KB.";
|
|
59
|
+
data = base64Text(resource.text);
|
|
60
|
+
} else {
|
|
61
|
+
return "The resource has no text or blob.";
|
|
62
|
+
}
|
|
63
|
+
const size = base64Bytes(data);
|
|
64
|
+
if (size > MCP_APP_DOWNLOAD_MAX_BYTES) return "The file is larger than 192 KB.";
|
|
65
|
+
return { name: fileNameOf(uri), mimeType, data, size };
|
|
66
|
+
}
|
|
67
|
+
function toolResult(value) {
|
|
68
|
+
const r = isObject$1(value) ? value : {};
|
|
69
|
+
return {
|
|
70
|
+
content: Array.isArray(r.content) ? r.content : [],
|
|
71
|
+
...isObject$1(r.structuredContent) ? { structuredContent: r.structuredContent } : {},
|
|
72
|
+
...r.isError === true ? { isError: true } : {},
|
|
73
|
+
...isObject$1(r._meta) ? { _meta: r._meta } : {}
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
function createMcpAppBridge(options) {
|
|
77
|
+
const now = options.now ?? Date.now;
|
|
78
|
+
let initialized = false;
|
|
79
|
+
let stopped = false;
|
|
80
|
+
let pending = 0;
|
|
81
|
+
let sent;
|
|
82
|
+
const times = [];
|
|
83
|
+
const post = (message) => {
|
|
84
|
+
if (!stopped) options.post({ jsonrpc: "2.0", ...message });
|
|
85
|
+
};
|
|
86
|
+
const respond = (id, result) => post({ id, result });
|
|
87
|
+
const fail = (id, code, message) => post({ id, error: { code, message } });
|
|
88
|
+
const notify = (method, params) => post({ method, params });
|
|
89
|
+
const answer = (id, run) => {
|
|
90
|
+
if (pending >= MCP_APP_BRIDGE_PENDING_MAX) {
|
|
91
|
+
fail(id, REFUSED, "Too many requests in flight.");
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
pending++;
|
|
95
|
+
void run().then(
|
|
96
|
+
(result) => {
|
|
97
|
+
pending--;
|
|
98
|
+
respond(id, result);
|
|
99
|
+
},
|
|
100
|
+
(error) => {
|
|
101
|
+
pending--;
|
|
102
|
+
fail(id, REFUSED, error instanceof Error && error.message ? error.message : "Request failed.");
|
|
103
|
+
}
|
|
104
|
+
);
|
|
105
|
+
};
|
|
106
|
+
const sendToolCall = () => {
|
|
107
|
+
const input = options.toolCall.input;
|
|
108
|
+
notify("ui/notifications/tool-input", { arguments: isObject$1(input) ? input : {} });
|
|
109
|
+
if (options.toolCall.result !== null) notify("ui/notifications/tool-result", toolResult(options.toolCall.result));
|
|
110
|
+
};
|
|
111
|
+
const request = (id, method, params) => {
|
|
112
|
+
switch (method) {
|
|
113
|
+
case "ui/initialize": {
|
|
114
|
+
sent = options.hostContext();
|
|
115
|
+
respond(id, {
|
|
116
|
+
protocolVersion: MCP_APP_PROTOCOL_VERSION,
|
|
117
|
+
hostInfo: { name: "zidane", version: options.hostVersion ?? "0" },
|
|
118
|
+
hostCapabilities: {
|
|
119
|
+
openLinks: {},
|
|
120
|
+
serverTools: {},
|
|
121
|
+
serverResources: {},
|
|
122
|
+
logging: {},
|
|
123
|
+
...options.sendMessage ? { message: {} } : {},
|
|
124
|
+
...options.updateModelContext ? { updateModelContext: {} } : {},
|
|
125
|
+
...options.downloadFile ? { downloadFile: {} } : {},
|
|
126
|
+
sandbox: {
|
|
127
|
+
...options.app.csp ? { csp: options.app.csp } : {},
|
|
128
|
+
permissions: Object.fromEntries(options.app.permissions.map((name) => [name, {}]))
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
hostContext: sent
|
|
132
|
+
});
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
case "ping":
|
|
136
|
+
respond(id, {});
|
|
137
|
+
return;
|
|
138
|
+
case "tools/call": {
|
|
139
|
+
const name = params.name;
|
|
140
|
+
const args = params.arguments ?? {};
|
|
141
|
+
if (typeof name !== "string" || name.trim() === "" || !isObject$1(args)) {
|
|
142
|
+
fail(id, INVALID_PARAMS, "tools/call needs a tool name and object arguments.");
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
answer(
|
|
146
|
+
id,
|
|
147
|
+
async () => toolResult(await options.request("tools/call", { name, arguments: args }))
|
|
148
|
+
);
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
case "resources/read": {
|
|
152
|
+
const uri = params.uri;
|
|
153
|
+
if (typeof uri !== "string" || uri.trim() === "") {
|
|
154
|
+
fail(id, INVALID_PARAMS, "resources/read needs a uri.");
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
answer(id, () => options.request("resources/read", { uri }));
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
case "ui/open-link": {
|
|
161
|
+
const url = customLinkUrl(params.url);
|
|
162
|
+
if (!url) {
|
|
163
|
+
fail(id, INVALID_PARAMS, "Only http and https links open.");
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
answer(id, () => options.openLink(url, activeNow).then(() => ({})));
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
case "ui/request-display-mode": {
|
|
170
|
+
const mode = params.mode === "fullscreen" || params.mode === "inline" ? params.mode : void 0;
|
|
171
|
+
const current = options.hostContext().displayMode;
|
|
172
|
+
respond(id, {
|
|
173
|
+
mode: mode && options.requestDisplayMode ? options.requestDisplayMode(mode, activeNow) : current
|
|
174
|
+
});
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
case "ui/message": {
|
|
178
|
+
const send = options.sendMessage;
|
|
179
|
+
const text = contentText(params.content).trim();
|
|
180
|
+
if (!send) {
|
|
181
|
+
fail(id, METHOD_NOT_FOUND, "This host takes no messages from apps.");
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
if (params.role !== void 0 && params.role !== "user" || !text || text.length > MCP_APP_MESSAGE_MAX_CHARS) {
|
|
185
|
+
fail(
|
|
186
|
+
id,
|
|
187
|
+
INVALID_PARAMS,
|
|
188
|
+
`ui/message needs a user role and text content of at most ${MCP_APP_MESSAGE_MAX_CHARS} characters.`
|
|
189
|
+
);
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
const active = activeNow;
|
|
193
|
+
answer(id, () => send(text, active).then(() => ({})));
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
case "ui/update-model-context": {
|
|
197
|
+
const update = options.updateModelContext;
|
|
198
|
+
if (!update) {
|
|
199
|
+
fail(id, METHOD_NOT_FOUND, "This host takes no model context from apps.");
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
const structured = isObject$1(params.structuredContent) ? JSON.stringify(params.structuredContent) : "";
|
|
203
|
+
const text = [contentText(params.content), structured].filter(Boolean).join("\n");
|
|
204
|
+
if (text.length > MCP_APP_CONTEXT_MAX_CHARS) {
|
|
205
|
+
fail(id, INVALID_PARAMS, `The context is at most ${MCP_APP_CONTEXT_MAX_CHARS} characters.`);
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
answer(id, () => update(text).then(() => ({})));
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
case "ui/download-file": {
|
|
212
|
+
const download = options.downloadFile;
|
|
213
|
+
if (!download) {
|
|
214
|
+
fail(id, METHOD_NOT_FOUND, "This host saves no files from apps.");
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
const file = downloadOf(params);
|
|
218
|
+
if (typeof file === "string") {
|
|
219
|
+
fail(id, INVALID_PARAMS, file);
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
answer(id, () => download(file).then(() => ({})));
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
default:
|
|
226
|
+
fail(id, METHOD_NOT_FOUND, `Method not found: ${method}`);
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
const notification = (method, params) => {
|
|
230
|
+
if (method === "ui/notifications/initialized") {
|
|
231
|
+
if (initialized) return;
|
|
232
|
+
initialized = true;
|
|
233
|
+
sendToolCall();
|
|
234
|
+
bridge.updateHostContext();
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
if (method === "ui/notifications/size-changed") {
|
|
238
|
+
const width = typeof params.width === "number" && Number.isFinite(params.width) ? params.width : void 0;
|
|
239
|
+
const height = typeof params.height === "number" && Number.isFinite(params.height) ? params.height : void 0;
|
|
240
|
+
if (width !== void 0 || height !== void 0)
|
|
241
|
+
options.onSizeChanged({
|
|
242
|
+
...width === void 0 ? {} : { width },
|
|
243
|
+
...height === void 0 ? {} : { height }
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
let activeNow = false;
|
|
248
|
+
const bridge = {
|
|
249
|
+
receive(message, meta) {
|
|
250
|
+
if (stopped) return;
|
|
251
|
+
const at = now();
|
|
252
|
+
while (times.length > 0 && times[0] <= at - MCP_APP_BRIDGE_WINDOW_MS) times.shift();
|
|
253
|
+
const method = message.method;
|
|
254
|
+
if (times.length >= MCP_APP_BRIDGE_RATE_MAX) {
|
|
255
|
+
if (isId(message.id) && typeof method === "string") fail(message.id, REFUSED, "Too many messages.");
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
times.push(at);
|
|
259
|
+
if (typeof method !== "string") return;
|
|
260
|
+
const params = isObject$1(message.params) ? message.params : {};
|
|
261
|
+
activeNow = meta?.active === true;
|
|
262
|
+
if (isId(message.id)) request(message.id, method, params);
|
|
263
|
+
else notification(method, params);
|
|
264
|
+
},
|
|
265
|
+
updateHostContext() {
|
|
266
|
+
if (!initialized || !sent || stopped) return;
|
|
267
|
+
const next = options.hostContext();
|
|
268
|
+
const changes = {};
|
|
269
|
+
for (const key of Object.keys(next)) {
|
|
270
|
+
if (JSON.stringify(next[key]) !== JSON.stringify(sent[key])) changes[key] = next[key];
|
|
271
|
+
}
|
|
272
|
+
sent = next;
|
|
273
|
+
if (Object.keys(changes).length > 0) notify("ui/notifications/host-context-changed", changes);
|
|
274
|
+
},
|
|
275
|
+
teardown() {
|
|
276
|
+
if (stopped) return;
|
|
277
|
+
if (initialized) post({ id: "zidane-teardown", method: "ui/resource-teardown", params: {} });
|
|
278
|
+
stopped = true;
|
|
279
|
+
},
|
|
280
|
+
pending: () => pending
|
|
281
|
+
};
|
|
282
|
+
return bridge;
|
|
283
|
+
}
|
|
284
|
+
const DEFAULT_HEIGHT = 320;
|
|
285
|
+
const FULLSCREEN_MIN_HEIGHT = 480;
|
|
286
|
+
const MIN_HEIGHT = 80;
|
|
287
|
+
const granted = new LruMap(64);
|
|
288
|
+
let liveApps = 0;
|
|
289
|
+
function mcpAppFrameCount() {
|
|
290
|
+
return liveApps;
|
|
291
|
+
}
|
|
292
|
+
const clamp = (height) => Math.min(CUSTOM_FRAME_MAX_HEIGHT, Math.max(MIN_HEIGHT, Math.round(height)));
|
|
293
|
+
const STYLE_VARIABLES = [
|
|
294
|
+
["--color-background-primary", "background-color", "var(--zg-bg)"],
|
|
295
|
+
["--color-background-secondary", "background-color", "var(--zg-tray)"],
|
|
296
|
+
["--color-background-tertiary", "background-color", "var(--zg-raised)"],
|
|
297
|
+
["--color-background-inverse", "background-color", "var(--zg-text)"],
|
|
298
|
+
["--color-background-info", "background-color", "var(--zg-info-soft)"],
|
|
299
|
+
["--color-background-danger", "background-color", "var(--zg-danger-soft)"],
|
|
300
|
+
["--color-background-success", "background-color", "var(--zg-success-soft)"],
|
|
301
|
+
["--color-background-warning", "background-color", "var(--zg-warn-soft)"],
|
|
302
|
+
["--color-text-primary", "color", "var(--zg-text)"],
|
|
303
|
+
["--color-text-secondary", "color", "var(--zg-text-muted)"],
|
|
304
|
+
["--color-text-tertiary", "color", "var(--zg-text-subtle)"],
|
|
305
|
+
["--color-text-inverse", "color", "var(--zg-bg)"],
|
|
306
|
+
["--color-text-info", "color", "var(--zg-info)"],
|
|
307
|
+
["--color-text-danger", "color", "var(--zg-danger)"],
|
|
308
|
+
["--color-text-success", "color", "var(--zg-success)"],
|
|
309
|
+
["--color-text-warning", "color", "var(--zg-warn)"],
|
|
310
|
+
["--color-border-primary", "border-top-color", "var(--zg-hairline)"],
|
|
311
|
+
["--color-border-secondary", "border-top-color", "var(--zg-border)"],
|
|
312
|
+
["--color-ring-primary", "outline-color", "var(--zg-ring)"],
|
|
313
|
+
["--font-sans", "font-family", "var(--zg-font-ui)"],
|
|
314
|
+
["--font-mono", "font-family", "var(--zg-font-mono)"],
|
|
315
|
+
["--border-radius-sm", "border-top-left-radius", "var(--zg-radius-sm)"],
|
|
316
|
+
["--border-radius-md", "border-top-left-radius", "var(--zg-radius-md)"],
|
|
317
|
+
["--border-radius-lg", "border-top-left-radius", "var(--zg-radius-lg)"]
|
|
318
|
+
];
|
|
319
|
+
function mcpAppStyleVariables(within) {
|
|
320
|
+
const probe = document.createElement("span");
|
|
321
|
+
probe.setAttribute("aria-hidden", "true");
|
|
322
|
+
probe.style.cssText = "position:absolute;visibility:hidden;pointer-events:none;border-top:1px solid;outline:1px solid";
|
|
323
|
+
within.appendChild(probe);
|
|
324
|
+
const out = {};
|
|
325
|
+
try {
|
|
326
|
+
for (const [name, property, value] of STYLE_VARIABLES) {
|
|
327
|
+
probe.style.setProperty(property, value);
|
|
328
|
+
const resolved = getComputedStyle(probe).getPropertyValue(property).replace(/\s+/g, " ").trim();
|
|
329
|
+
if (resolved) out[name] = resolved.slice(0, 256);
|
|
330
|
+
probe.style.removeProperty(property);
|
|
331
|
+
}
|
|
332
|
+
} finally {
|
|
333
|
+
probe.remove();
|
|
334
|
+
}
|
|
335
|
+
return out;
|
|
336
|
+
}
|
|
337
|
+
function appTheme() {
|
|
338
|
+
const scheme = getComputedStyle(document.documentElement).colorScheme ?? "";
|
|
339
|
+
return /\blight\b/.test(scheme) && !/\bdark\b/.test(scheme) ? "light" : "dark";
|
|
340
|
+
}
|
|
341
|
+
function media(query) {
|
|
342
|
+
return typeof matchMedia === "function" && matchMedia(query).matches;
|
|
343
|
+
}
|
|
344
|
+
function sizeText(bytes) {
|
|
345
|
+
if (bytes < 1024) return `${bytes} B`;
|
|
346
|
+
if (bytes < 1024 * 1024) return `${Math.round(bytes / 1024)} KB`;
|
|
347
|
+
return `${(bytes / 1024 / 1024).toFixed(1)} MB`;
|
|
348
|
+
}
|
|
349
|
+
const isObject = (value) => !!value && typeof value === "object" && !Array.isArray(value);
|
|
350
|
+
const McpAppFrameView = reactExports.memo(function McpAppFrameView2({ node, scope }) {
|
|
351
|
+
const host = useViewsHost();
|
|
352
|
+
const labels = useViewsLabels();
|
|
353
|
+
const outer = reactExports.useRef(null);
|
|
354
|
+
const box = reactExports.useRef(null);
|
|
355
|
+
const near = useViewportPresence(outer, CUSTOM_RUN_MARGIN);
|
|
356
|
+
const p = node.props;
|
|
357
|
+
const title = str(p.title) ?? "";
|
|
358
|
+
const server = str(p.server) ?? "";
|
|
359
|
+
const tool = str(p.tool) ?? "";
|
|
360
|
+
const { sessionId, viewId } = scope;
|
|
361
|
+
const viewKey = `${sessionId}\0${viewId}`;
|
|
362
|
+
const declared = MCP_APP_PERMISSIONS.filter((name) => Array.isArray(p.permissions) && p.permissions.includes(name));
|
|
363
|
+
const [allowed, setAllowed] = reactExports.useState(() => granted.peek(viewKey) ?? []);
|
|
364
|
+
const asked = declared.filter((name) => !allowed.includes(name));
|
|
365
|
+
const [clicked, setClicked] = reactExports.useState(false);
|
|
366
|
+
const [slot, setSlot] = reactExports.useState(false);
|
|
367
|
+
const [live, setLive] = reactExports.useState(false);
|
|
368
|
+
const [height, setHeight] = reactExports.useState(DEFAULT_HEIGHT);
|
|
369
|
+
const [error, setError] = reactExports.useState(null);
|
|
370
|
+
const [refusal, setRefusal] = reactExports.useState(null);
|
|
371
|
+
const [nearBefore, setNearBefore] = reactExports.useState(near);
|
|
372
|
+
if (near !== nearBefore) {
|
|
373
|
+
setNearBefore(near);
|
|
374
|
+
if (!near) setClicked(false);
|
|
375
|
+
}
|
|
376
|
+
const links = useLinkRouter();
|
|
377
|
+
const chat = useOptionalChatHost();
|
|
378
|
+
const inputsOn = useViewsInputs();
|
|
379
|
+
const ask = useOptionalConfirm();
|
|
380
|
+
const modal = useOptionalModal();
|
|
381
|
+
const expanded = useViewExpanded();
|
|
382
|
+
const expand = useExpandView(viewId);
|
|
383
|
+
const mode = expanded ? "fullscreen" : "inline";
|
|
384
|
+
const modes = expanded || expand ? ["inline", "fullscreen"] : ["inline"];
|
|
385
|
+
const input = reactExports.useRef(null);
|
|
386
|
+
reactExports.useEffect(() => {
|
|
387
|
+
const send = chat?.send;
|
|
388
|
+
input.current = {
|
|
389
|
+
links,
|
|
390
|
+
host,
|
|
391
|
+
send: send && inputsOn ? (text) => send({
|
|
392
|
+
sessionId,
|
|
393
|
+
prompt: text,
|
|
394
|
+
origin: { kind: "user", source: MCP_APP_ORIGIN_SOURCE, sender: { id: viewId, name: server } },
|
|
395
|
+
literal: true,
|
|
396
|
+
keepDraft: true,
|
|
397
|
+
delivery: "queue"
|
|
398
|
+
}) : null,
|
|
399
|
+
confirm: ask ? (file) => ask({
|
|
400
|
+
title: labels.viewMcpAppDownloadTitle(file.name),
|
|
401
|
+
message: labels.viewMcpAppDownloadBody(server, sizeText(file.size)),
|
|
402
|
+
confirmLabel: labels.viewMcpAppDownloadSave
|
|
403
|
+
}) : null,
|
|
404
|
+
displayMode: (next, active) => {
|
|
405
|
+
if (next === "fullscreen" && !expanded && expand && active) {
|
|
406
|
+
expand({ title: title || server, tree: scope.tree, custom: scope });
|
|
407
|
+
return "fullscreen";
|
|
408
|
+
}
|
|
409
|
+
if (next === "inline" && expanded && modal) {
|
|
410
|
+
modal.close(`view:${viewId}`);
|
|
411
|
+
return "inline";
|
|
412
|
+
}
|
|
413
|
+
return mode;
|
|
414
|
+
}
|
|
415
|
+
};
|
|
416
|
+
});
|
|
417
|
+
const start = host?.customFrame;
|
|
418
|
+
reactExports.useEffect(() => {
|
|
419
|
+
if (!start || error || !(near || clicked)) return void 0;
|
|
420
|
+
const release = customSlots.request(
|
|
421
|
+
{ grant: () => setSlot(true), revoke: () => setSlot(false) },
|
|
422
|
+
{ priority: clicked }
|
|
423
|
+
);
|
|
424
|
+
return () => {
|
|
425
|
+
release();
|
|
426
|
+
setSlot(false);
|
|
427
|
+
};
|
|
428
|
+
}, [start, error, near, clicked]);
|
|
429
|
+
const allowedKey = allowed.join(",");
|
|
430
|
+
reactExports.useEffect(() => {
|
|
431
|
+
if (!slot || !start || !box.current) return void 0;
|
|
432
|
+
const container = box.current;
|
|
433
|
+
let frame = null;
|
|
434
|
+
let bridge = null;
|
|
435
|
+
let stop = () => {
|
|
436
|
+
};
|
|
437
|
+
let stopTheme = () => {
|
|
438
|
+
};
|
|
439
|
+
let stopSize = () => {
|
|
440
|
+
};
|
|
441
|
+
let cancelled = false;
|
|
442
|
+
let width = Math.round(container.getBoundingClientRect().width);
|
|
443
|
+
const permissions = allowedKey ? allowedKey.split(",") : [];
|
|
444
|
+
void start({ sessionId, viewId, path: [0], original: false, theme: {}, title, permissions }).then((result) => {
|
|
445
|
+
if (cancelled) {
|
|
446
|
+
if (result.ok) result.value.dispose();
|
|
447
|
+
return;
|
|
448
|
+
}
|
|
449
|
+
if (!result.ok) {
|
|
450
|
+
setError(result.error);
|
|
451
|
+
return;
|
|
452
|
+
}
|
|
453
|
+
const started = result.value;
|
|
454
|
+
if (started.kind !== "mcp-app" || !started.postRpc) {
|
|
455
|
+
started.dispose();
|
|
456
|
+
setError({ code: "unsupported" });
|
|
457
|
+
return;
|
|
458
|
+
}
|
|
459
|
+
frame = started;
|
|
460
|
+
liveApps++;
|
|
461
|
+
const element = started.element;
|
|
462
|
+
const csp = isObject(p.csp) ? p.csp : void 0;
|
|
463
|
+
const context = () => ({
|
|
464
|
+
theme: appTheme(),
|
|
465
|
+
styles: { variables: mcpAppStyleVariables(container) },
|
|
466
|
+
displayMode: mode,
|
|
467
|
+
availableDisplayModes: modes,
|
|
468
|
+
containerDimensions: { width, maxHeight: CUSTOM_FRAME_MAX_HEIGHT },
|
|
469
|
+
platform: element.tagName === "WEBVIEW" ? "desktop" : "web",
|
|
470
|
+
locale: navigator.language,
|
|
471
|
+
timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
472
|
+
deviceCapabilities: { touch: media("(pointer: coarse)"), hover: media("(hover: hover)") },
|
|
473
|
+
safeAreaInsets: { top: 0, right: 0, bottom: 0, left: 0 },
|
|
474
|
+
toolInfo: {
|
|
475
|
+
tool: { name: tool, ...title && title !== tool ? { title } : {}, inputSchema: { type: "object" } }
|
|
476
|
+
}
|
|
477
|
+
});
|
|
478
|
+
const data = isObject(node.data) ? node.data : {};
|
|
479
|
+
const app = createMcpAppBridge({
|
|
480
|
+
app: { server, tool, title, ...csp ? { csp } : {}, permissions: started.permissions ?? [] },
|
|
481
|
+
toolCall: { input: data.input ?? {}, result: data.result ?? null },
|
|
482
|
+
post: (message) => started.postRpc?.(message),
|
|
483
|
+
hostContext: context,
|
|
484
|
+
request: async (method, params) => {
|
|
485
|
+
const appRequest = input.current?.host?.appRequest;
|
|
486
|
+
if (!appRequest) throw new McpAppRefusal("This app cannot reach its server here.");
|
|
487
|
+
const answer = await appRequest(sessionId, viewId, method, params);
|
|
488
|
+
if (answer.ok) return answer.value;
|
|
489
|
+
const message = "message" in answer.error ? answer.error.message : "This app cannot reach its server here.";
|
|
490
|
+
setRefusal(message);
|
|
491
|
+
throw new McpAppRefusal(message);
|
|
492
|
+
},
|
|
493
|
+
openLink: async (url, active) => {
|
|
494
|
+
if (!active || !input.current) throw new McpAppRefusal("Links open only from a click in the app.");
|
|
495
|
+
await input.current.links.open(url, { source: "transcript", sessionId });
|
|
496
|
+
},
|
|
497
|
+
onSizeChanged: (size) => {
|
|
498
|
+
if (size.height !== void 0) setHeight(clamp(size.height));
|
|
499
|
+
},
|
|
500
|
+
requestDisplayMode: (next, active) => input.current?.displayMode(next, active) ?? mode,
|
|
501
|
+
// Offered where the chat can send; each call checks the click and the inputs switch again.
|
|
502
|
+
...chat?.send ? {
|
|
503
|
+
sendMessage: async (text, active) => {
|
|
504
|
+
if (!active) throw new McpAppRefusal("Messages send only from a click in the app.");
|
|
505
|
+
const send = input.current?.send;
|
|
506
|
+
if (!send) throw new McpAppRefusal("This app cannot send messages here.");
|
|
507
|
+
await send(text);
|
|
508
|
+
}
|
|
509
|
+
} : {},
|
|
510
|
+
updateModelContext: async (text) => {
|
|
511
|
+
const appRequest = input.current?.host?.appRequest;
|
|
512
|
+
if (!appRequest) throw new McpAppRefusal("This app cannot set context here.");
|
|
513
|
+
const answer = await appRequest(sessionId, viewId, "ui/update-model-context", { text });
|
|
514
|
+
if (!answer.ok)
|
|
515
|
+
throw new McpAppRefusal(
|
|
516
|
+
"message" in answer.error ? answer.error.message : "This app cannot set context here."
|
|
517
|
+
);
|
|
518
|
+
},
|
|
519
|
+
// Offered where the host can save a file and the app can ask the person first.
|
|
520
|
+
...host?.downloadFile && ask ? {
|
|
521
|
+
downloadFile: async (file) => {
|
|
522
|
+
const save = input.current?.host?.downloadFile;
|
|
523
|
+
const confirm = input.current?.confirm;
|
|
524
|
+
if (!save || !confirm) throw new McpAppRefusal("This app cannot save files here.");
|
|
525
|
+
if (!await confirm(file)) throw new McpAppRefusal("The person did not save the file.");
|
|
526
|
+
const saved = await save({ name: file.name, mimeType: file.mimeType, data: file.data });
|
|
527
|
+
if (!saved.ok)
|
|
528
|
+
throw new McpAppRefusal(
|
|
529
|
+
"message" in saved.error ? saved.error.message : "The file could not be saved."
|
|
530
|
+
);
|
|
531
|
+
}
|
|
532
|
+
} : {}
|
|
533
|
+
});
|
|
534
|
+
bridge = app;
|
|
535
|
+
stop = started.listen((event) => {
|
|
536
|
+
if (event.kind === "rpc")
|
|
537
|
+
app.receive(event.message, { ...event.active !== void 0 ? { active: event.active } : {} });
|
|
538
|
+
});
|
|
539
|
+
stopTheme = watchTheme(() => app.updateHostContext());
|
|
540
|
+
stopSize = observeSize(container, (next) => {
|
|
541
|
+
const rounded = Math.round(next);
|
|
542
|
+
if (rounded === width) return;
|
|
543
|
+
width = rounded;
|
|
544
|
+
app.updateHostContext();
|
|
545
|
+
});
|
|
546
|
+
Object.assign(element.style, { width: "100%", height: "100%", border: "0", display: "block" });
|
|
547
|
+
container.appendChild(element);
|
|
548
|
+
setLive(true);
|
|
549
|
+
});
|
|
550
|
+
return () => {
|
|
551
|
+
cancelled = true;
|
|
552
|
+
setLive(false);
|
|
553
|
+
stop();
|
|
554
|
+
stopTheme();
|
|
555
|
+
stopSize();
|
|
556
|
+
bridge?.teardown();
|
|
557
|
+
if (frame) {
|
|
558
|
+
liveApps--;
|
|
559
|
+
frame.element.remove();
|
|
560
|
+
frame.dispose();
|
|
561
|
+
frame = null;
|
|
562
|
+
}
|
|
563
|
+
};
|
|
564
|
+
}, [slot, start, sessionId, viewId, allowedKey, mode]);
|
|
565
|
+
const names = (list) => list.map((name) => labels.viewMcpAppPermission(name)).join(", ");
|
|
566
|
+
const allow = () => {
|
|
567
|
+
const next = [.../* @__PURE__ */ new Set([...allowed, ...declared])];
|
|
568
|
+
granted.set(viewKey, next);
|
|
569
|
+
setAllowed(next);
|
|
570
|
+
};
|
|
571
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref: outer, className: "flex flex-col gap-2 min-w-0", "data-zg-view-mcp-app": live ? "live" : "parked", children: [
|
|
572
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
573
|
+
"div",
|
|
574
|
+
{
|
|
575
|
+
className: "relative min-w-0 rounded-zg-md overflow-hidden",
|
|
576
|
+
style: { height: expanded ? Math.max(FULLSCREEN_MIN_HEIGHT, height) : height },
|
|
577
|
+
children: [
|
|
578
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref: box, role: "group", "aria-label": labels.viewMcpAppFrame(server, title), className: "absolute inset-0" }),
|
|
579
|
+
live ? null : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "absolute inset-0 flex flex-col gap-2", children: [
|
|
580
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(CustomStatic, { p, note: !slot && near ? labels.viewMcpAppWaiting : void 0 }),
|
|
581
|
+
slot || error ? null : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute bottom-2 right-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: buttonClass({ size: "xs" }), onClick: () => setClicked(true), children: labels.viewMcpAppRun }) })
|
|
582
|
+
] })
|
|
583
|
+
]
|
|
584
|
+
}
|
|
585
|
+
),
|
|
586
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
587
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "zg-meta truncate", children: labels.viewMcpAppFrom(server) }),
|
|
588
|
+
allowed.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "zg-meta", children: labels.viewMcpAppAllowed(names(allowed)) }) : null
|
|
589
|
+
] }),
|
|
590
|
+
asked.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
591
|
+
Notice,
|
|
592
|
+
{
|
|
593
|
+
tone: "info",
|
|
594
|
+
compact: true,
|
|
595
|
+
action: /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: buttonClass({ size: "xs" }), onClick: allow, children: labels.viewMcpAppAllow }),
|
|
596
|
+
children: labels.viewMcpAppAsks(names(asked))
|
|
597
|
+
}
|
|
598
|
+
) : null,
|
|
599
|
+
refusal ? /* @__PURE__ */ jsxRuntimeExports.jsx(Notice, { tone: "warning", compact: true, detail: refusal, children: labels.viewMcpAppRefused }) : null,
|
|
600
|
+
error ? /* @__PURE__ */ jsxRuntimeExports.jsx(Notice, { tone: "error", compact: true, ..."message" in error ? { detail: error.message } : {}, children: labels.viewMcpAppFailed }) : null
|
|
601
|
+
] });
|
|
602
|
+
});
|
|
603
|
+
export {
|
|
604
|
+
McpAppFrameView,
|
|
605
|
+
mcpAppFrameCount,
|
|
606
|
+
mcpAppStyleVariables
|
|
607
|
+
};
|