agent-bridge-abweb 1.0.4 → 1.0.6

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.
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveRuntimePort = resolveRuntimePort;
4
+ function resolveRuntimePort(config, runtime, pluginId, envName, fallback) {
5
+ const injected = runtime?.ports?.[pluginId];
6
+ if (typeof injected === "number" && Number.isInteger(injected) && injected > 0)
7
+ return injected;
8
+ const configured = config.cdpPort;
9
+ if (typeof configured === "number" && Number.isInteger(configured) && configured > 0)
10
+ return configured;
11
+ const environment = Number(process.env[envName] ?? "");
12
+ return Number.isInteger(environment) && environment > 0 ? environment : fallback;
13
+ }
@@ -5,7 +5,7 @@ const node_fs_1 = require("node:fs");
5
5
  const node_path_1 = require("node:path");
6
6
  const MANIFEST = {
7
7
  id: "abweb",
8
- version: "1.0.4",
8
+ version: "1.0.6",
9
9
  displayName: "Agent Bridge Web",
10
10
  entry: "dist/index.js",
11
11
  apiVersion: "1",
@@ -145,7 +145,6 @@
145
145
  void loadCatalog().catch((cause) => { catalogNode.textContent = `远程插件目录暂时不可用:${cause instanceof Error ? cause.message : String(cause)}`; });
146
146
  }
147
147
  catch (cause) {
148
- node("#access-panel").hidden = false;
149
148
  error(cause instanceof Error ? cause.message : String(cause));
150
149
  }
151
150
  finally {
@@ -239,6 +238,16 @@
239
238
  detail.textContent = `依赖:${plugin.dependencyStatus.join(";")}`;
240
239
  state.append(detail);
241
240
  }
241
+ // 插件未就绪且声明了客户端下载地址时,给出获取桌面客户端的入口
242
+ if (plugin.manifest?.clientDownloadUrl && plugin.status !== "ready") {
243
+ const link = document.createElement("a");
244
+ link.className = "plugin-id";
245
+ link.href = plugin.manifest.clientDownloadUrl;
246
+ link.target = "_blank";
247
+ link.rel = "noreferrer noopener";
248
+ link.textContent = "下载客户端";
249
+ state.append(link);
250
+ }
242
251
  const controls = document.createElement("td");
243
252
  controls.className = "controls";
244
253
  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; dependencyStatus?: string[]; manifest?: { dependencies?: Record<string, string>; 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; clientDownloadUrl?: 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");
@@ -101,7 +101,7 @@
101
101
  sessionTable.append(row);
102
102
  }
103
103
  if (refreshCatalog) void loadCatalog().catch((cause) => { catalogNode.textContent = `远程插件目录暂时不可用:${cause instanceof Error ? cause.message : String(cause)}`; });
104
- } catch (cause) { node<HTMLElement>("#access-panel").hidden = false; error(cause instanceof Error ? cause.message : String(cause)); }
104
+ } catch (cause) { error(cause instanceof Error ? cause.message : String(cause)); }
105
105
  finally { loading = false; }
106
106
  }
107
107
  function renderChannels(items: Plugin[]): void {
@@ -149,6 +149,11 @@
149
149
  state.append(status);
150
150
  if (plugin.error) { const detail = document.createElement("small"); detail.className = "error-text plugin-id"; detail.textContent = plugin.error; state.append(detail); }
151
151
  if (plugin.dependencyStatus?.length) { const detail = document.createElement("small"); detail.className = "error-text plugin-id"; detail.textContent = `依赖:${plugin.dependencyStatus.join(";")}`; state.append(detail); }
152
+ // 插件未就绪且声明了客户端下载地址时,给出获取桌面客户端的入口
153
+ if (plugin.manifest?.clientDownloadUrl && plugin.status !== "ready") {
154
+ const link = document.createElement("a"); link.className = "plugin-id"; link.href = plugin.manifest.clientDownloadUrl; link.target = "_blank"; link.rel = "noreferrer noopener";
155
+ link.textContent = "下载客户端"; state.append(link);
156
+ }
152
157
  const controls = document.createElement("td"); controls.className = "controls";
153
158
  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(); })); }
154
159
  for (const [label, action] of [["启动", "start"], ["停止", "stop"], ["重载", "reload"]]) {
package/package.json CHANGED
@@ -1,9 +1,16 @@
1
1
  {
2
2
  "name": "agent-bridge-abweb",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "agent-bridge 的网页管理插件。",
5
- "keywords": ["mu-agent-bridge-plugin", "mu-agent-bridge-management"],
6
- "repository": { "type": "git", "url": "https://codeup.aliyun.com/6808da56fb3da14b899afd54/agent_bridge.git", "directory": "packages/abweb" },
5
+ "keywords": [
6
+ "mu-agent-bridge-plugin",
7
+ "mu-agent-bridge-management"
8
+ ],
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://codeup.aliyun.com/6808da56fb3da14b899afd54/agent_bridge.git",
12
+ "directory": "packages/abweb"
13
+ },
7
14
  "main": "dist/src-ts/plugins/abweb/index.js",
8
15
  "files": [
9
16
  "dist/",
package/plugin.json CHANGED
@@ -1,11 +1,15 @@
1
1
  {
2
2
  "id": "abweb",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "type": "management",
5
5
  "displayName": "Agent Bridge Web",
6
6
  "entry": "dist/src-ts/plugins/abweb/index.js",
7
7
  "apiVersion": "1",
8
8
  "process": "in-process",
9
- "capabilities": ["web", "management", "health"],
9
+ "capabilities": [
10
+ "web",
11
+ "management",
12
+ "health"
13
+ ],
10
14
  "configSchema": "config.schema.json"
11
15
  }