mindroot 9.5.0__py3-none-any.whl → 9.7.0__py3-none-any.whl
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.
- mindroot/coreplugins/admin/plugin_manager.py +42 -9
- mindroot/coreplugins/admin/static/js/registry-shared-services.js +62 -16
- mindroot/coreplugins/agent/SysAdmin/agent.json +33 -0
- mindroot/coreplugins/agent/init_models.py +3 -0
- mindroot/coreplugins/index/indices/default/index.json +33 -0
- {mindroot-9.5.0.dist-info → mindroot-9.7.0.dist-info}/METADATA +1 -1
- {mindroot-9.5.0.dist-info → mindroot-9.7.0.dist-info}/RECORD +11 -12
- mindroot/coreplugins/admin/plugin_manager_backup.py +0 -615
- mindroot/coreplugins/admin/static/js/registry-manager-old.js +0 -385
- {mindroot-9.5.0.dist-info → mindroot-9.7.0.dist-info}/WHEEL +0 -0
- {mindroot-9.5.0.dist-info → mindroot-9.7.0.dist-info}/entry_points.txt +0 -0
- {mindroot-9.5.0.dist-info → mindroot-9.7.0.dist-info}/licenses/LICENSE +0 -0
- {mindroot-9.5.0.dist-info → mindroot-9.7.0.dist-info}/top_level.txt +0 -0
|
@@ -1,385 +0,0 @@
|
|
|
1
|
-
import { html } from '/admin/static/js/lit-core.min.js';
|
|
2
|
-
import { RegistryManagerBase } from './registry-manager-base.js';
|
|
3
|
-
|
|
4
|
-
class RegistryManager extends RegistryManagerBase {
|
|
5
|
-
async checkAuthStatus() {
|
|
6
|
-
if (this.authToken) {
|
|
7
|
-
try {
|
|
8
|
-
const response = await fetch(`${this.registryUrl}/stats`, {
|
|
9
|
-
headers: {
|
|
10
|
-
'Authorization': `Bearer ${this.authToken}`
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
if (response.ok) {
|
|
15
|
-
this.isLoggedIn = true;
|
|
16
|
-
} else {
|
|
17
|
-
this.logout();
|
|
18
|
-
}
|
|
19
|
-
} catch (error) {
|
|
20
|
-
console.error('Error checking auth status:', error);
|
|
21
|
-
this.logout();
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
async loadStats() {
|
|
27
|
-
try {
|
|
28
|
-
const response = await fetch(`${this.registryUrl}/stats`);
|
|
29
|
-
if (response.ok) {
|
|
30
|
-
this.stats = await response.json();
|
|
31
|
-
}
|
|
32
|
-
} catch (error) {
|
|
33
|
-
console.error('Error loading stats:', error);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
async loadLocalContent() {
|
|
38
|
-
try {
|
|
39
|
-
const pluginsResponse = await fetch('/admin/plugin-manager/get-all-plugins');
|
|
40
|
-
if (pluginsResponse.ok) {
|
|
41
|
-
const pluginsData = await pluginsResponse.json();
|
|
42
|
-
this.localPlugins = pluginsData.data || [];
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const agentsResponse = await fetch('/admin/agents/local');
|
|
46
|
-
if (agentsResponse.ok) {
|
|
47
|
-
this.localAgents = await agentsResponse.json();
|
|
48
|
-
}
|
|
49
|
-
} catch (error) {
|
|
50
|
-
console.error('Error loading local content:', error);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
async handleLogin() {
|
|
55
|
-
const username = this.shadowRoot.getElementById('username').value;
|
|
56
|
-
const password = this.shadowRoot.getElementById('password').value;
|
|
57
|
-
|
|
58
|
-
if (!username || !password) {
|
|
59
|
-
this.error = 'Please enter username and password';
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
await this.login(username, password);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
async login(username, password) {
|
|
67
|
-
this.loading = true;
|
|
68
|
-
this.error = '';
|
|
69
|
-
|
|
70
|
-
try {
|
|
71
|
-
const formData = new FormData();
|
|
72
|
-
formData.append('username', username);
|
|
73
|
-
formData.append('password', password);
|
|
74
|
-
|
|
75
|
-
const response = await fetch(`${this.registryUrl}/token`, {
|
|
76
|
-
method: 'POST',
|
|
77
|
-
body: formData
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
if (response.ok) {
|
|
81
|
-
const data = await response.json();
|
|
82
|
-
this.authToken = data.access_token;
|
|
83
|
-
localStorage.setItem('registry_token', this.authToken);
|
|
84
|
-
this.isLoggedIn = true;
|
|
85
|
-
this.currentUser = { username };
|
|
86
|
-
} else {
|
|
87
|
-
const errorData = await response.json();
|
|
88
|
-
this.error = errorData.detail || 'Login failed';
|
|
89
|
-
}
|
|
90
|
-
} catch (error) {
|
|
91
|
-
this.error = 'Network error: ' + error.message;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
this.loading = false;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
logout() {
|
|
98
|
-
this.authToken = null;
|
|
99
|
-
this.isLoggedIn = false;
|
|
100
|
-
this.currentUser = null;
|
|
101
|
-
localStorage.removeItem('registry_token');
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
async search(query = this.searchQuery, category = this.selectedCategory) {
|
|
105
|
-
this.loading = true;
|
|
106
|
-
this.error = '';
|
|
107
|
-
|
|
108
|
-
try {
|
|
109
|
-
const params = new URLSearchParams({
|
|
110
|
-
query: query || '',
|
|
111
|
-
limit: '20',
|
|
112
|
-
semantic: 'true'
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
if (category && category !== 'all') {
|
|
116
|
-
params.append('category', category);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
const response = await fetch(`${this.registryUrl}/search?${params}`);
|
|
120
|
-
|
|
121
|
-
if (response.ok) {
|
|
122
|
-
const data = await response.json();
|
|
123
|
-
this.searchResults = data.results || [];
|
|
124
|
-
} else {
|
|
125
|
-
this.error = 'Search failed';
|
|
126
|
-
}
|
|
127
|
-
} catch (error) {
|
|
128
|
-
this.error = 'Network error: ' + error.message;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
this.loading = false;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
async installFromRegistry(item) {
|
|
135
|
-
this.loading = true;
|
|
136
|
-
this.error = '';
|
|
137
|
-
|
|
138
|
-
try {
|
|
139
|
-
if (this.authToken) {
|
|
140
|
-
await fetch(`${this.registryUrl}/install/${item.id}`, {
|
|
141
|
-
method: 'POST',
|
|
142
|
-
headers: {
|
|
143
|
-
'Authorization': `Bearer ${this.authToken}`
|
|
144
|
-
}
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
if (item.category === 'plugin') {
|
|
149
|
-
await this.installPlugin(item);
|
|
150
|
-
} else if (item.category === 'agent') {
|
|
151
|
-
await this.installAgent(item);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
await this.loadLocalContent();
|
|
155
|
-
|
|
156
|
-
} catch (error) {
|
|
157
|
-
this.error = 'Installation failed: ' + error.message;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
this.loading = false;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
async installPlugin(item) {
|
|
164
|
-
const installData = {
|
|
165
|
-
plugin: item.title,
|
|
166
|
-
source: item.github_url ? 'github' : 'pypi',
|
|
167
|
-
source_path: item.github_url || item.pypi_module
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
const response = await fetch('/admin/plugin-manager/stream-install-plugin', {
|
|
171
|
-
method: 'POST',
|
|
172
|
-
headers: {
|
|
173
|
-
'Content-Type': 'application/json'
|
|
174
|
-
},
|
|
175
|
-
body: JSON.stringify(installData)
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
if (!response.ok) {
|
|
179
|
-
throw new Error('Plugin installation failed');
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
async installAgent(item) {
|
|
184
|
-
const agentData = {
|
|
185
|
-
...item.data,
|
|
186
|
-
name: item.title,
|
|
187
|
-
description: item.description
|
|
188
|
-
};
|
|
189
|
-
|
|
190
|
-
const response = await fetch('/admin/agents/local', {
|
|
191
|
-
method: 'POST',
|
|
192
|
-
headers: {
|
|
193
|
-
'Content-Type': 'application/x-www-form-urlencoded'
|
|
194
|
-
},
|
|
195
|
-
body: `agent=${encodeURIComponent(JSON.stringify(agentData))}`
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
if (!response.ok) {
|
|
199
|
-
throw new Error('Agent installation failed');
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
_render() {
|
|
204
|
-
return html`
|
|
205
|
-
<div class="registry-manager">
|
|
206
|
-
${this.renderHeader()}
|
|
207
|
-
${this.renderTabs()}
|
|
208
|
-
${this.renderContent()}
|
|
209
|
-
</div>
|
|
210
|
-
`;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
renderHeader() {
|
|
214
|
-
if (this.isLoggedIn) {
|
|
215
|
-
return html`
|
|
216
|
-
<div class="user-info">
|
|
217
|
-
<span>Logged in as: ${this.currentUser?.username}</span>
|
|
218
|
-
<button @click=${this.logout}>Logout</button>
|
|
219
|
-
</div>
|
|
220
|
-
`;
|
|
221
|
-
} else {
|
|
222
|
-
return html`
|
|
223
|
-
<div class="section">
|
|
224
|
-
<h3>Registry Login</h3>
|
|
225
|
-
<div class="login-form">
|
|
226
|
-
<input type="text" placeholder="Username or Email" id="username">
|
|
227
|
-
<input type="password" placeholder="Password" id="password">
|
|
228
|
-
<button class="primary" @click=${this.handleLogin}>Login</button>
|
|
229
|
-
${this.error ? html`<div class="error">${this.error}</div>` : ''}
|
|
230
|
-
</div>
|
|
231
|
-
</div>
|
|
232
|
-
`;
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
renderTabs() {
|
|
237
|
-
return html`
|
|
238
|
-
<div class="tabs">
|
|
239
|
-
<div class="tab ${this.activeTab === 'search' ? 'active' : ''}"
|
|
240
|
-
@click=${() => this.activeTab = 'search'}>Search</div>
|
|
241
|
-
<div class="tab ${this.activeTab === 'publish' ? 'active' : ''}"
|
|
242
|
-
@click=${() => this.activeTab = 'publish'}>Publish</div>
|
|
243
|
-
<div class="tab ${this.activeTab === 'stats' ? 'active' : ''}"
|
|
244
|
-
@click=${() => this.activeTab = 'stats'}>Stats</div>
|
|
245
|
-
</div>
|
|
246
|
-
`;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
renderContent() {
|
|
250
|
-
switch (this.activeTab) {
|
|
251
|
-
case 'search':
|
|
252
|
-
return this.renderSearch();
|
|
253
|
-
case 'publish':
|
|
254
|
-
return this.renderPublish();
|
|
255
|
-
case 'stats':
|
|
256
|
-
return this.renderStats();
|
|
257
|
-
default:
|
|
258
|
-
return this.renderSearch();
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
renderSearch() {
|
|
263
|
-
return html`
|
|
264
|
-
<div class="section">
|
|
265
|
-
<h3>Search Registry</h3>
|
|
266
|
-
<div class="search-form">
|
|
267
|
-
<div class="form-row">
|
|
268
|
-
<input type="text" placeholder="Search plugins and agents..."
|
|
269
|
-
.value=${this.searchQuery}
|
|
270
|
-
@input=${(e) => this.searchQuery = e.target.value}>
|
|
271
|
-
<select .value=${this.selectedCategory}
|
|
272
|
-
@change=${(e) => this.selectedCategory = e.target.value}>
|
|
273
|
-
<option value="all">All</option>
|
|
274
|
-
<option value="plugin">Plugins</option>
|
|
275
|
-
<option value="agent">Agents</option>
|
|
276
|
-
</select>
|
|
277
|
-
<button class="primary" @click=${() => this.search()}>Search</button>
|
|
278
|
-
</div>
|
|
279
|
-
</div>
|
|
280
|
-
|
|
281
|
-
${this.loading ? html`<div class="loading">Searching...</div>` : ''}
|
|
282
|
-
${this.error ? html`<div class="error">${this.error}</div>` : ''}
|
|
283
|
-
|
|
284
|
-
<div class="search-results">
|
|
285
|
-
${this.searchResults.map(item => this.renderSearchResult(item))}
|
|
286
|
-
</div>
|
|
287
|
-
</div>
|
|
288
|
-
`;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
renderSearchResult(item) {
|
|
292
|
-
return html`
|
|
293
|
-
<div class="result-item">
|
|
294
|
-
<div class="result-header">
|
|
295
|
-
<h4 class="result-title">${item.title}</h4>
|
|
296
|
-
<span class="result-version">v${item.version}</span>
|
|
297
|
-
</div>
|
|
298
|
-
<p class="result-description">${item.description}</p>
|
|
299
|
-
<div class="result-meta">
|
|
300
|
-
<span>Category: ${item.category}</span>
|
|
301
|
-
<span>Downloads: ${item.download_count || 0}</span>
|
|
302
|
-
<span>Rating: ${item.rating || 0}/5</span>
|
|
303
|
-
</div>
|
|
304
|
-
${item.tags && item.tags.length > 0 ? html`
|
|
305
|
-
<div class="result-tags">
|
|
306
|
-
${item.tags.map(tag => html`<span class="tag">${tag}</span>`)}
|
|
307
|
-
</div>
|
|
308
|
-
` : ''}
|
|
309
|
-
<div class="result-actions">
|
|
310
|
-
<button class="success" @click=${() => this.installFromRegistry(item)}>Install</button>
|
|
311
|
-
${item.github_url ? html`<a href="${item.github_url}" target="_blank"><button>GitHub</button></a>` : ''}
|
|
312
|
-
</div>
|
|
313
|
-
</div>
|
|
314
|
-
`;
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
renderPublish() {
|
|
318
|
-
if (!this.isLoggedIn) {
|
|
319
|
-
return html`
|
|
320
|
-
<div class="section">
|
|
321
|
-
<h3>Publish to Registry</h3>
|
|
322
|
-
<p>Please log in to publish plugins and agents to the registry.</p>
|
|
323
|
-
</div>
|
|
324
|
-
`;
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
return html`
|
|
328
|
-
<div class="section">
|
|
329
|
-
<h3>Publish to Registry</h3>
|
|
330
|
-
<p>Select a local plugin or agent to publish:</p>
|
|
331
|
-
|
|
332
|
-
<h4>Local Plugins</h4>
|
|
333
|
-
${this.localPlugins.map(plugin => html`
|
|
334
|
-
<div class="result-item">
|
|
335
|
-
<h5>${plugin.name}</h5>
|
|
336
|
-
<p>${plugin.description || 'No description'}</p>
|
|
337
|
-
<button class="primary" @click=${() => this.publishItem(plugin, 'plugin')}>Publish Plugin</button>
|
|
338
|
-
</div>
|
|
339
|
-
`)}
|
|
340
|
-
|
|
341
|
-
<h4>Local Agents</h4>
|
|
342
|
-
${this.localAgents.map(agent => html`
|
|
343
|
-
<div class="result-item">
|
|
344
|
-
<h5>${agent.name}</h5>
|
|
345
|
-
<button class="primary" @click=${() => this.publishItem(agent, 'agent')}>Publish Agent</button>
|
|
346
|
-
</div>
|
|
347
|
-
`)}
|
|
348
|
-
</div>
|
|
349
|
-
`;
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
renderStats() {
|
|
353
|
-
return html`
|
|
354
|
-
<div class="section">
|
|
355
|
-
<h3>Registry Statistics</h3>
|
|
356
|
-
<div class="stats-grid">
|
|
357
|
-
<div class="stat-card">
|
|
358
|
-
<div class="stat-number">${this.stats.total_plugins || 0}</div>
|
|
359
|
-
<div class="stat-label">Plugins</div>
|
|
360
|
-
</div>
|
|
361
|
-
<div class="stat-card">
|
|
362
|
-
<div class="stat-number">${this.stats.total_agents || 0}</div>
|
|
363
|
-
<div class="stat-label">Agents</div>
|
|
364
|
-
</div>
|
|
365
|
-
<div class="stat-card">
|
|
366
|
-
<div class="stat-number">${this.stats.total_users || 0}</div>
|
|
367
|
-
<div class="stat-label">Users</div>
|
|
368
|
-
</div>
|
|
369
|
-
<div class="stat-card">
|
|
370
|
-
<div class="stat-number">${this.stats.total_installs || 0}</div>
|
|
371
|
-
<div class="stat-label">Installs</div>
|
|
372
|
-
</div>
|
|
373
|
-
</div>
|
|
374
|
-
</div>
|
|
375
|
-
`;
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
async publishItem(item, type) {
|
|
379
|
-
// Implementation for publishing items to registry
|
|
380
|
-
console.log('Publishing', type, item);
|
|
381
|
-
// This would involve creating the proper payload and sending to registry
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
customElements.define('registry-manager', RegistryManager);
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|