agent-bridge-abweb 1.0.3 → 1.0.4
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.
|
@@ -117,8 +117,8 @@
|
|
|
117
117
|
loading = true;
|
|
118
118
|
try {
|
|
119
119
|
error("");
|
|
120
|
-
const [health, plugins, messages, versions, policy] = await Promise.all([
|
|
121
|
-
request("/api/health"), request("/api/plugins"), request("/api/messages"), request("/api/versions"), request("/api/update-policy"),
|
|
120
|
+
const [health, plugins, messages, versions, policy, sessions] = await Promise.all([
|
|
121
|
+
request("/api/health"), request("/api/plugins"), request("/api/messages"), request("/api/versions"), request("/api/update-policy"), request("/api/sessions"),
|
|
122
122
|
]);
|
|
123
123
|
policyNode.value = policy.mode;
|
|
124
124
|
policyStatusNode.textContent = `当前:${policyNode.options[policyNode.selectedIndex]?.text ?? policy.mode}`;
|
|
@@ -130,6 +130,17 @@
|
|
|
130
130
|
renderPlugins(installed);
|
|
131
131
|
renderChannels(installed);
|
|
132
132
|
renderMessages(messages.messages ?? []);
|
|
133
|
+
const sessionTable = node("#sessions");
|
|
134
|
+
sessionTable.replaceChildren();
|
|
135
|
+
for (const session of sessions.sessions ?? []) {
|
|
136
|
+
const row = document.createElement("tr");
|
|
137
|
+
for (const value of [session.source, session.agentPlugin, session.sessionId, new Date(session.updatedAt).toLocaleString()]) {
|
|
138
|
+
const cell = document.createElement("td");
|
|
139
|
+
cell.textContent = value;
|
|
140
|
+
row.append(cell);
|
|
141
|
+
}
|
|
142
|
+
sessionTable.append(row);
|
|
143
|
+
}
|
|
133
144
|
if (refreshCatalog)
|
|
134
145
|
void loadCatalog().catch((cause) => { catalogNode.textContent = `远程插件目录暂时不可用:${cause instanceof Error ? cause.message : String(cause)}`; });
|
|
135
146
|
}
|
|
@@ -208,6 +219,13 @@
|
|
|
208
219
|
const status = document.createElement("span");
|
|
209
220
|
status.className = `status status-${plugin.status}`;
|
|
210
221
|
status.textContent = plugin.status;
|
|
222
|
+
const dependencies = Object.entries(plugin.manifest?.dependencies ?? {});
|
|
223
|
+
if (dependencies.length) {
|
|
224
|
+
const detail = document.createElement("small");
|
|
225
|
+
detail.className = "muted plugin-id";
|
|
226
|
+
detail.textContent = `依赖:${dependencies.map(([id, range]) => `${id} ${range}`).join(";")}`;
|
|
227
|
+
name.append(detail);
|
|
228
|
+
}
|
|
211
229
|
state.append(status);
|
|
212
230
|
if (plugin.error) {
|
|
213
231
|
const detail = document.createElement("small");
|
|
@@ -215,6 +233,12 @@
|
|
|
215
233
|
detail.textContent = plugin.error;
|
|
216
234
|
state.append(detail);
|
|
217
235
|
}
|
|
236
|
+
if (plugin.dependencyStatus?.length) {
|
|
237
|
+
const detail = document.createElement("small");
|
|
238
|
+
detail.className = "error-text plugin-id";
|
|
239
|
+
detail.textContent = `依赖:${plugin.dependencyStatus.join(";")}`;
|
|
240
|
+
state.append(detail);
|
|
241
|
+
}
|
|
218
242
|
const controls = document.createElement("td");
|
|
219
243
|
controls.className = "controls";
|
|
220
244
|
if (pluginVersions[plugin.id]?.state === "update-available" && plugin.path.includes("node_modules")) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
(() => {
|
|
2
|
-
type Plugin = { id: string; displayName: string; version: string; status: string; type?: string; capabilities?: string[]; error?: string; path: string; packageName?: string; manifest?: { managementPage?: string } };
|
|
2
|
+
type Plugin = { id: string; displayName: string; version: string; status: string; type?: string; capabilities?: string[]; error?: string; path: string; packageName?: string; dependencyStatus?: string[]; manifest?: { dependencies?: Record<string, string>; managementPage?: string } };
|
|
3
3
|
const node = <T extends HTMLElement>(selector: string): T => document.querySelector<T>(selector)!;
|
|
4
4
|
const pluginsNode = node<HTMLTableSectionElement>("#plugins");
|
|
5
5
|
const messagesNode = node<HTMLTableSectionElement>("#messages");
|
|
@@ -82,8 +82,8 @@
|
|
|
82
82
|
loading = true;
|
|
83
83
|
try {
|
|
84
84
|
error("");
|
|
85
|
-
const [health, plugins, messages, versions, policy] = await Promise.all([
|
|
86
|
-
request("/api/health"), request("/api/plugins"), request("/api/messages"), request("/api/versions"), request("/api/update-policy"),
|
|
85
|
+
const [health, plugins, messages, versions, policy, sessions] = await Promise.all([
|
|
86
|
+
request("/api/health"), request("/api/plugins"), request("/api/messages"), request("/api/versions"), request("/api/update-policy"), request("/api/sessions"),
|
|
87
87
|
]);
|
|
88
88
|
policyNode.value = policy.mode; policyStatusNode.textContent = `当前:${policyNode.options[policyNode.selectedIndex]?.text ?? policy.mode}`;
|
|
89
89
|
renderVersions(versions);
|
|
@@ -94,6 +94,12 @@
|
|
|
94
94
|
renderPlugins(installed);
|
|
95
95
|
renderChannels(installed);
|
|
96
96
|
renderMessages(messages.messages ?? []);
|
|
97
|
+
const sessionTable = node<HTMLTableSectionElement>("#sessions"); sessionTable.replaceChildren();
|
|
98
|
+
for (const session of sessions.sessions ?? []) {
|
|
99
|
+
const row = document.createElement("tr");
|
|
100
|
+
for (const value of [session.source, session.agentPlugin, session.sessionId, new Date(session.updatedAt).toLocaleString()]) { const cell = document.createElement("td"); cell.textContent = value; row.append(cell); }
|
|
101
|
+
sessionTable.append(row);
|
|
102
|
+
}
|
|
97
103
|
if (refreshCatalog) void loadCatalog().catch((cause) => { catalogNode.textContent = `远程插件目录暂时不可用:${cause instanceof Error ? cause.message : String(cause)}`; });
|
|
98
104
|
} catch (cause) { node<HTMLElement>("#access-panel").hidden = false; error(cause instanceof Error ? cause.message : String(cause)); }
|
|
99
105
|
finally { loading = false; }
|
|
@@ -138,8 +144,11 @@
|
|
|
138
144
|
const version = document.createElement("td"); version.textContent = `v${plugin.version}`;
|
|
139
145
|
const state = document.createElement("td");
|
|
140
146
|
const status = document.createElement("span"); status.className = `status status-${plugin.status}`; status.textContent = plugin.status;
|
|
147
|
+
const dependencies = Object.entries(plugin.manifest?.dependencies ?? {});
|
|
148
|
+
if (dependencies.length) { const detail = document.createElement("small"); detail.className = "muted plugin-id"; detail.textContent = `依赖:${dependencies.map(([id, range]) => `${id} ${range}`).join(";")}`; name.append(detail); }
|
|
141
149
|
state.append(status);
|
|
142
150
|
if (plugin.error) { const detail = document.createElement("small"); detail.className = "error-text plugin-id"; detail.textContent = plugin.error; state.append(detail); }
|
|
151
|
+
if (plugin.dependencyStatus?.length) { const detail = document.createElement("small"); detail.className = "error-text plugin-id"; detail.textContent = `依赖:${plugin.dependencyStatus.join(";")}`; state.append(detail); }
|
|
143
152
|
const controls = document.createElement("td"); controls.className = "controls";
|
|
144
153
|
if (pluginVersions[plugin.id]?.state === "update-available" && plugin.path.includes("node_modules")) { controlsUpgrade(plugin.id); controls.append(button("下载", `下载 ${plugin.id}`, async () => { await request(`/api/plugins/${encodeURIComponent(plugin.id)}/download`, "POST", { packageName: plugin.packageName, version: pluginVersions[plugin.id]?.latestVersion }); await load(); })); }
|
|
145
154
|
for (const [label, action] of [["启动", "start"], ["停止", "stop"], ["重载", "reload"]]) {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
<section><details id="installed-plugins" open><summary><h2>已安装插件</h2></summary><div class="table-scroll"><table class="plugin-table"><thead><tr><th scope="col">名称</th><th scope="col">类型</th><th scope="col">版本</th><th scope="col">状态</th><th scope="col">操作</th></tr></thead><tbody id="plugins"></tbody></table></div><div class="plugin-catalog"><div class="section-heading"><h3>npm 插件目录</h3><button id="search-packages" type="button">刷新目录</button></div><input id="package-search" placeholder="搜索插件名称或功能" aria-label="搜索 npm 插件"><div id="catalog" class="catalog" aria-live="polite"></div></div><form id="install-local-form"><input id="plugin-path" required placeholder="Windows 上的插件目录路径" aria-label="本地插件目录"><button type="submit">安装本地插件</button></form></details></section>
|
|
17
17
|
<section><div class="section-heading"><h2>Channel 设置</h2></div><nav id="channel-tabs" class="tabs channel-tabs" role="tablist" aria-label="Channel 设置"></nav><div id="channel-panel" role="tabpanel" aria-live="polite"></div></section>
|
|
18
18
|
</div>
|
|
19
|
-
<div id="messages-panel" role="tabpanel" aria-labelledby="messages-tab" hidden><section><div class="section-heading"><h2>最近通信</h2></div><div class="table-scroll"><table><thead><tr><th scope="col">时间</th><th scope="col">插件</th><th scope="col">接收 AID</th><th scope="col">来源 Peer</th><th scope="col">方向</th><th scope="col">消息</th><th scope="col">错误</th></tr></thead><tbody id="messages"></tbody></table></div><p id="messages-empty" class="muted" hidden>暂无通信记录</p></section></div>
|
|
19
|
+
<div id="messages-panel" role="tabpanel" aria-labelledby="messages-tab" hidden><section><div class="section-heading"><h2>最近通信</h2></div><div class="table-scroll"><table><thead><tr><th scope="col">时间</th><th scope="col">插件</th><th scope="col">接收 AID</th><th scope="col">来源 Peer</th><th scope="col">方向</th><th scope="col">消息</th><th scope="col">错误</th></tr></thead><tbody id="messages"></tbody></table></div><p id="messages-empty" class="muted" hidden>暂无通信记录</p><h2>通道会话</h2><div class="table-scroll"><table><thead><tr><th>来源</th><th>Agent</th><th>会话 ID</th><th>最近活跃时间</th></tr></thead><tbody id="sessions"></tbody></table></div></section></div>
|
|
20
20
|
<div id="logs-panel" role="tabpanel" aria-labelledby="logs-tab" hidden><section><div class="section-heading"><h2>运行日志</h2><button id="logs-refresh" type="button">刷新日志</button></div><div class="table-scroll"><table><thead><tr><th>时间</th><th>级别</th><th>来源</th><th>消息</th><th>详细字段</th></tr></thead><tbody id="logs"></tbody></table></div><p id="logs-empty" class="muted" hidden>暂无运行日志</p><div class="section-heading"><button id="logs-prev" type="button">上一页</button><span id="logs-page" class="muted">第 1 页</span><button id="logs-next" type="button">下一页</button></div></section></div>
|
|
21
21
|
<p id="error" class="error" role="alert" hidden></p>
|
|
22
22
|
</main>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-bridge-abweb",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "agent-bridge 的网页管理插件。",
|
|
5
5
|
"keywords": ["mu-agent-bridge-plugin", "mu-agent-bridge-management"],
|
|
6
6
|
"repository": { "type": "git", "url": "https://codeup.aliyun.com/6808da56fb3da14b899afd54/agent_bridge.git", "directory": "packages/abweb" },
|