agent-bridge-abweb 1.0.9 → 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.
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AgentError = void 0;
3
+ exports.AgentOperationError = exports.AgentError = void 0;
4
+ exports.errorDetails = errorDetails;
4
5
  class AgentError extends Error {
5
6
  constructor(message, options) {
6
7
  super(message, options);
@@ -8,3 +9,26 @@ class AgentError extends Error {
8
9
  }
9
10
  }
10
11
  exports.AgentError = AgentError;
12
+ /** 保留底层错误码,避免只留下 fetch failed 或超时这类表层提示。 */
13
+ function errorDetails(error) {
14
+ const parts = [];
15
+ const seen = new Set();
16
+ for (let current = error; current && !seen.has(current) && seen.size < 5;) {
17
+ seen.add(current);
18
+ const value = current;
19
+ const message = typeof value.message === "string" ? value.message : String(current);
20
+ parts.push(`${message}${value.code ? `(${String(value.code)})` : ""}`);
21
+ current = value.cause;
22
+ }
23
+ return parts.join(";原因:") || String(error);
24
+ }
25
+ class AgentOperationError extends AgentError {
26
+ code;
27
+ stage;
28
+ constructor(code, stage, cause) {
29
+ super(`${code}:${stage}失败:${errorDetails(cause)}`, { cause });
30
+ this.code = code;
31
+ this.stage = stage;
32
+ }
33
+ }
34
+ exports.AgentOperationError = AgentOperationError;
@@ -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.9",
8
+ version: "1.0.11",
9
9
  displayName: "Agent Bridge Web",
10
10
  entry: "dist/index.js",
11
11
  apiVersion: "1",
@@ -331,7 +331,7 @@
331
331
  state.append(detail);
332
332
  }
333
333
  // 插件未就绪且声明了客户端下载地址时,给出获取桌面客户端的入口
334
- if (plugin.manifest?.clientDownloadUrl && plugin.status !== "ready") {
334
+ if (plugin.manifest?.clientDownloadUrl && plugin.error?.includes("未找到") && plugin.error.includes(".exe")) {
335
335
  const link = document.createElement("a");
336
336
  link.className = "plugin-id";
337
337
  link.href = plugin.manifest.clientDownloadUrl;
@@ -201,7 +201,7 @@
201
201
  if (plugin.error) { const detail = document.createElement("small"); detail.className = "error-text plugin-id"; detail.textContent = plugin.error; state.append(detail); }
202
202
  if (plugin.dependencyStatus?.length) { const detail = document.createElement("small"); detail.className = "error-text plugin-id"; detail.textContent = `依赖:${plugin.dependencyStatus.join(";")}`; state.append(detail); }
203
203
  // 插件未就绪且声明了客户端下载地址时,给出获取桌面客户端的入口
204
- if (plugin.manifest?.clientDownloadUrl && plugin.status !== "ready") {
204
+ if (plugin.manifest?.clientDownloadUrl && plugin.error?.includes("未找到") && plugin.error.includes(".exe")) {
205
205
  const link = document.createElement("a"); link.className = "plugin-id"; link.href = plugin.manifest.clientDownloadUrl; link.target = "_blank"; link.rel = "noreferrer noopener";
206
206
  link.textContent = "下载客户端"; state.append(link);
207
207
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-bridge-abweb",
3
- "version": "1.0.9",
3
+ "version": "1.0.11",
4
4
  "description": "agent-bridge 的网页管理插件。",
5
5
  "keywords": [
6
6
  "mu-agent-bridge-plugin",
package/plugin.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "id": "abweb",
3
- "version": "1.0.9",
3
+ "version": "1.0.11",
4
4
  "type": "management",
5
5
  "displayName": "Agent Bridge Web",
6
6
  "entry": "dist/src-ts/plugins/abweb/index.js",