agent-discover 1.0.10 → 1.0.11
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/ui/app.js +58 -27
- package/package.json +1 -1
package/dist/ui/app.js
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
return fetch(AD._baseUrl + url, opts);
|
|
13
13
|
};
|
|
14
14
|
AD._wsUrl = null;
|
|
15
|
+
AD._root = document;
|
|
15
16
|
|
|
16
17
|
let state = { servers: [], active: [], version: '0.0.0' };
|
|
17
18
|
let ws = null;
|
|
@@ -59,7 +60,7 @@
|
|
|
59
60
|
}
|
|
60
61
|
|
|
61
62
|
function setConnectionStatus(cls, text) {
|
|
62
|
-
var el =
|
|
63
|
+
var el = AD._root.getElementById('conn-status');
|
|
63
64
|
if (!el) return;
|
|
64
65
|
el.className = 'connection-status ' + cls;
|
|
65
66
|
el.innerHTML = '<span class="conn-dot"></span>' + text;
|
|
@@ -70,7 +71,7 @@
|
|
|
70
71
|
// -------------------------------------------------------------------------
|
|
71
72
|
|
|
72
73
|
function initTabs() {
|
|
73
|
-
var navItems =
|
|
74
|
+
var navItems = AD._root.querySelectorAll('.nav-item');
|
|
74
75
|
navItems.forEach(function (item) {
|
|
75
76
|
item.addEventListener('click', function () {
|
|
76
77
|
var tab = this.dataset.tab;
|
|
@@ -81,10 +82,10 @@
|
|
|
81
82
|
});
|
|
82
83
|
this.classList.add('active');
|
|
83
84
|
|
|
84
|
-
|
|
85
|
+
AD._root.querySelectorAll('.tab-panel').forEach(function (p) {
|
|
85
86
|
p.classList.remove('active');
|
|
86
87
|
});
|
|
87
|
-
|
|
88
|
+
AD._root.getElementById('tab-' + tab).classList.add('active');
|
|
88
89
|
});
|
|
89
90
|
});
|
|
90
91
|
}
|
|
@@ -94,7 +95,7 @@
|
|
|
94
95
|
// -------------------------------------------------------------------------
|
|
95
96
|
|
|
96
97
|
function initTheme() {
|
|
97
|
-
var toggle =
|
|
98
|
+
var toggle = AD._root.getElementById('theme-toggle');
|
|
98
99
|
var saved = localStorage.getItem('agent-discover-theme');
|
|
99
100
|
if (saved === 'light') {
|
|
100
101
|
document.body.className = 'theme-light';
|
|
@@ -115,7 +116,7 @@
|
|
|
115
116
|
}
|
|
116
117
|
|
|
117
118
|
function updateThemeIcon(theme) {
|
|
118
|
-
var toggle =
|
|
119
|
+
var toggle = AD._root.getElementById('theme-toggle');
|
|
119
120
|
if (!toggle) return;
|
|
120
121
|
var icon = toggle.querySelector('.material-symbols-outlined');
|
|
121
122
|
if (icon) icon.textContent = theme === 'dark' ? 'dark_mode' : 'light_mode';
|
|
@@ -126,7 +127,7 @@
|
|
|
126
127
|
// -------------------------------------------------------------------------
|
|
127
128
|
|
|
128
129
|
function initSearch() {
|
|
129
|
-
var input =
|
|
130
|
+
var input = AD._root.getElementById('browse-search');
|
|
130
131
|
input.addEventListener('input', function () {
|
|
131
132
|
clearTimeout(searchTimeout);
|
|
132
133
|
var q = this.value.trim();
|
|
@@ -142,7 +143,7 @@
|
|
|
142
143
|
}
|
|
143
144
|
|
|
144
145
|
function fetchBrowse(query) {
|
|
145
|
-
var el =
|
|
146
|
+
var el = AD._root.getElementById('browse-list');
|
|
146
147
|
el.innerHTML = '<div class="loading">Searching...</div>';
|
|
147
148
|
|
|
148
149
|
AD._fetch('/api/browse?query=' + encodeURIComponent(query) + '&limit=20')
|
|
@@ -164,14 +165,14 @@
|
|
|
164
165
|
// -------------------------------------------------------------------------
|
|
165
166
|
|
|
166
167
|
function render() {
|
|
167
|
-
|
|
168
|
-
|
|
168
|
+
AD._root.getElementById('version').textContent = 'v' + state.version;
|
|
169
|
+
AD._root.getElementById('installed-count').textContent = String(state.servers.length);
|
|
169
170
|
|
|
170
171
|
renderInstalled();
|
|
171
172
|
}
|
|
172
173
|
|
|
173
174
|
function renderInstalled() {
|
|
174
|
-
var el =
|
|
175
|
+
var el = AD._root.getElementById('installed-list');
|
|
175
176
|
if (!state.servers.length) {
|
|
176
177
|
el.innerHTML =
|
|
177
178
|
'<div class="empty-state"><span class="material-symbols-outlined empty-icon">dns</span><p>No servers registered</p><p class="hint">Use registry_install or browse the marketplace</p></div>';
|
|
@@ -472,9 +473,9 @@
|
|
|
472
473
|
}
|
|
473
474
|
|
|
474
475
|
function renderBrowse() {
|
|
475
|
-
var el =
|
|
476
|
+
var el = AD._root.getElementById('browse-list');
|
|
476
477
|
if (!browseResults.length) {
|
|
477
|
-
var q =
|
|
478
|
+
var q = AD._root.getElementById('browse-search').value.trim();
|
|
478
479
|
if (!q) {
|
|
479
480
|
el.innerHTML =
|
|
480
481
|
'<div class="empty-state"><span class="material-symbols-outlined empty-icon">explore</span><p>Search the official MCP registry</p><p class="hint">Type a query above to discover servers</p></div>';
|
|
@@ -699,7 +700,7 @@
|
|
|
699
700
|
};
|
|
700
701
|
|
|
701
702
|
window.__installFromNpm = function () {
|
|
702
|
-
var input =
|
|
703
|
+
var input = AD._root.getElementById('npm-package-input');
|
|
703
704
|
var pkg = (input ? input.value : '').trim();
|
|
704
705
|
if (!pkg) return;
|
|
705
706
|
|
|
@@ -835,8 +836,8 @@
|
|
|
835
836
|
};
|
|
836
837
|
|
|
837
838
|
window.__addSecret = function (serverId) {
|
|
838
|
-
var keyEl =
|
|
839
|
-
var valEl =
|
|
839
|
+
var keyEl = AD._root.getElementById('secret-key-' + serverId);
|
|
840
|
+
var valEl = AD._root.getElementById('secret-val-' + serverId);
|
|
840
841
|
if (!keyEl || !valEl) return;
|
|
841
842
|
var key = keyEl.value.trim();
|
|
842
843
|
var value = valEl.value;
|
|
@@ -890,10 +891,10 @@
|
|
|
890
891
|
};
|
|
891
892
|
|
|
892
893
|
window.__saveConfig = function (serverId) {
|
|
893
|
-
var desc =
|
|
894
|
-
var cmd =
|
|
895
|
-
var argsEl =
|
|
896
|
-
var envEl =
|
|
894
|
+
var desc = AD._root.getElementById('cfg-desc-' + serverId);
|
|
895
|
+
var cmd = AD._root.getElementById('cfg-cmd-' + serverId);
|
|
896
|
+
var argsEl = AD._root.getElementById('cfg-args-' + serverId);
|
|
897
|
+
var envEl = AD._root.getElementById('cfg-env-' + serverId);
|
|
897
898
|
if (!desc || !cmd || !argsEl || !envEl) return;
|
|
898
899
|
|
|
899
900
|
var args = argsEl.value
|
|
@@ -937,7 +938,7 @@
|
|
|
937
938
|
// -------------------------------------------------------------------------
|
|
938
939
|
|
|
939
940
|
function showToast(message, type) {
|
|
940
|
-
var existing =
|
|
941
|
+
var existing = AD._root.querySelector('.toast');
|
|
941
942
|
if (existing) existing.remove();
|
|
942
943
|
|
|
943
944
|
var toast = document.createElement('div');
|
|
@@ -962,7 +963,10 @@
|
|
|
962
963
|
initThemeSync();
|
|
963
964
|
}
|
|
964
965
|
|
|
965
|
-
|
|
966
|
+
var _params = new URLSearchParams(location.search);
|
|
967
|
+
if (_params.get('baseUrl')) AD._baseUrl = _params.get('baseUrl');
|
|
968
|
+
if (_params.get('wsUrl')) AD._wsUrl = _params.get('wsUrl');
|
|
969
|
+
|
|
966
970
|
if (document.readyState === 'loading') {
|
|
967
971
|
document.addEventListener('DOMContentLoaded', _init);
|
|
968
972
|
} else {
|
|
@@ -1085,7 +1089,7 @@
|
|
|
1085
1089
|
updateThemeIcon(colors.isDark ? 'dark' : 'light');
|
|
1086
1090
|
}
|
|
1087
1091
|
|
|
1088
|
-
var themeToggle =
|
|
1092
|
+
var themeToggle = AD._root.getElementById('theme-toggle');
|
|
1089
1093
|
if (themeToggle) themeToggle.style.display = 'none';
|
|
1090
1094
|
});
|
|
1091
1095
|
}
|
|
@@ -1094,16 +1098,42 @@
|
|
|
1094
1098
|
options = options || {};
|
|
1095
1099
|
AD._baseUrl = options.baseUrl || '';
|
|
1096
1100
|
AD._wsUrl = options.wsUrl || null;
|
|
1097
|
-
|
|
1101
|
+
|
|
1102
|
+
var shadow = container.attachShadow({ mode: 'open' });
|
|
1103
|
+
|
|
1104
|
+
if (options.cssUrl) {
|
|
1098
1105
|
var link = document.createElement('link');
|
|
1099
|
-
link.id = 'ad-plugin-css';
|
|
1100
1106
|
link.rel = 'stylesheet';
|
|
1101
1107
|
link.href = options.cssUrl;
|
|
1102
|
-
|
|
1108
|
+
shadow.appendChild(link);
|
|
1103
1109
|
}
|
|
1110
|
+
|
|
1111
|
+
var fonts = document.createElement('link');
|
|
1112
|
+
fonts.rel = 'stylesheet';
|
|
1113
|
+
fonts.href =
|
|
1114
|
+
'https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap';
|
|
1115
|
+
shadow.appendChild(fonts);
|
|
1116
|
+
var icons = document.createElement('link');
|
|
1117
|
+
icons.rel = 'stylesheet';
|
|
1118
|
+
icons.href =
|
|
1119
|
+
'https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=swap';
|
|
1120
|
+
shadow.appendChild(icons);
|
|
1121
|
+
|
|
1122
|
+
var pluginStyle = document.createElement('style');
|
|
1123
|
+
pluginStyle.textContent =
|
|
1124
|
+
':host { display:block; width:100%; height:100%; overflow:hidden; }' +
|
|
1125
|
+
'.ad-wrapper { font-family:var(--font-sans); font-size:14px; color:var(--text); background:var(--bg); line-height:1.5; width:100%; height:100%; overflow:hidden; }' +
|
|
1126
|
+
'.ad-wrapper #app { height:100%; }';
|
|
1127
|
+
shadow.appendChild(pluginStyle);
|
|
1128
|
+
|
|
1104
1129
|
if (typeof AD._template === 'function') {
|
|
1105
|
-
|
|
1130
|
+
var wrapper = document.createElement('div');
|
|
1131
|
+
wrapper.className = 'theme-dark ad-wrapper';
|
|
1132
|
+
wrapper.innerHTML = AD._template();
|
|
1133
|
+
shadow.appendChild(wrapper);
|
|
1106
1134
|
}
|
|
1135
|
+
|
|
1136
|
+
AD._root = shadow;
|
|
1107
1137
|
_init();
|
|
1108
1138
|
};
|
|
1109
1139
|
|
|
@@ -1113,5 +1143,6 @@
|
|
|
1113
1143
|
ws.close();
|
|
1114
1144
|
ws = null;
|
|
1115
1145
|
}
|
|
1146
|
+
AD._root = document;
|
|
1116
1147
|
};
|
|
1117
1148
|
})();
|
package/package.json
CHANGED