@glodon-aiot/bot-client-sdk 3.27.0-alpha.0 → 3.27.0-alpha.1

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/README.md CHANGED
@@ -66,7 +66,7 @@ client.addEventListener('ready', () => {
66
66
 
67
67
  应用类型由平台应用决定,`loadSession` 按类型创建对应会话。
68
68
 
69
- `appVersion` 只作用于 Agent 的 WebSocket 建连。`draft` 使用草稿,`v1` / `v2` 等指定已发布版本(大小写不敏感),`latest` 始终使用最新版本。不传或传空白时 SDK 默认传 `latest`。其他值不会导致连接失败,服务端会改用最新版本。ready 带回的版本与请求不一致时,SDK 输出告警。
69
+ `appVersion` 作用于 Agent 的 WebSocket 建连,以及应用详情、prompt 变量、推荐问题、常用提示词和创建会话。HTTP 查询或创建会话请求体里的字段名是 `version`。`draft` 使用草稿,`v1` / `v2` 等指定已发布版本(大小写不敏感),`latest` 始终使用最新版本。不传或传空白时 SDK 默认传 `latest`。其他值不会导致连接失败,服务端会改用最新版本。ready 带回的版本与请求不一致时,SDK 输出告警。
70
70
 
71
71
  ## 对话界面
72
72
 
@@ -1,44 +1,44 @@
1
- var x = Object.defineProperty, j = Object.defineProperties;
2
- var O = Object.getOwnPropertyDescriptors;
3
- var T = Object.getOwnPropertySymbols;
4
- var V = Object.prototype.hasOwnProperty, F = Object.prototype.propertyIsEnumerable;
5
- var S = (n, d, e) => d in n ? x(n, d, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[d] = e, m = (n, d) => {
1
+ var E = Object.defineProperty, x = Object.defineProperties;
2
+ var j = Object.getOwnPropertyDescriptors;
3
+ var P = Object.getOwnPropertySymbols;
4
+ var O = Object.prototype.hasOwnProperty, V = Object.prototype.propertyIsEnumerable;
5
+ var A = (n, d, e) => d in n ? E(n, d, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[d] = e, h = (n, d) => {
6
6
  for (var e in d || (d = {}))
7
- V.call(d, e) && S(n, e, d[e]);
8
- if (T)
9
- for (var e of T(d))
10
- F.call(d, e) && S(n, e, d[e]);
7
+ O.call(d, e) && A(n, e, d[e]);
8
+ if (P)
9
+ for (var e of P(d))
10
+ V.call(d, e) && A(n, e, d[e]);
11
11
  return n;
12
- }, C = (n, d) => j(n, O(d));
13
- var I = (n, d, e) => (S(n, typeof d != "symbol" ? d + "" : d, e), e);
12
+ }, y = (n, d) => x(n, j(d));
13
+ var M = (n, d, e) => (A(n, typeof d != "symbol" ? d + "" : d, e), e);
14
14
  var v = (n, d, e) => new Promise((i, a) => {
15
15
  var o = (t) => {
16
16
  try {
17
- g(e.next(t));
18
- } catch (s) {
19
- a(s);
17
+ s(e.next(t));
18
+ } catch (l) {
19
+ a(l);
20
20
  }
21
21
  }, c = (t) => {
22
22
  try {
23
- g(e.throw(t));
24
- } catch (s) {
25
- a(s);
23
+ s(e.throw(t));
24
+ } catch (l) {
25
+ a(l);
26
26
  }
27
- }, g = (t) => t.done ? i(t.value) : Promise.resolve(t.value).then(o, c);
28
- g((e = e.apply(n, d)).next());
27
+ }, s = (t) => t.done ? i(t.value) : Promise.resolve(t.value).then(o, c);
28
+ s((e = e.apply(n, d)).next());
29
29
  });
30
- import { ChatMessageRole as w, PromptVariableType as L } from "@glodon-aiot/apis";
31
- import N from "./Logger.mjs";
32
- import { configuration as p } from "./Config.mjs";
30
+ import { ChatMessageRole as C, PromptVariableType as T } from "@glodon-aiot/apis";
31
+ import F from "./Logger.mjs";
32
+ import { configuration as u, resolveAppVersion as N } from "./Config.mjs";
33
33
  import { io as $ } from "socket.io-client";
34
- import { UserMode as R } from "./PayloadTypes.mjs";
35
- import D, { SessionErrors as A } from "./Session.mjs";
34
+ import { UserMode as I } from "./PayloadTypes.mjs";
35
+ import D, { SessionErrors as R } from "./Session.mjs";
36
36
  import z from "dayjs";
37
37
  import { v4 as B } from "uuid";
38
38
  import { connectLocalMcpBridge as J, subscribeLocalMcpEndpoints as Q } from "./localMcp/endpoints.mjs";
39
39
  import { registerLocalMcp as Y } from "./localMcp/register.mjs";
40
- const r = new N("[AgentSession] ");
41
- function U(n) {
40
+ const r = new F("[AgentSession] ");
41
+ function L(n) {
42
42
  if (typeof n != "string")
43
43
  return n;
44
44
  const d = n.trim();
@@ -51,7 +51,7 @@ function U(n) {
51
51
  }
52
52
  function H(n) {
53
53
  const d = n.imageContent;
54
- return Array.isArray(d) ? C(m({}, n), {
54
+ return Array.isArray(d) ? y(h({}, n), {
55
55
  imageContent: `[${d.length}]`
56
56
  }) : n;
57
57
  }
@@ -61,28 +61,28 @@ function K(n, d) {
61
61
  const e = d.trim();
62
62
  !e || n.trim().toLowerCase() === e.toLowerCase() || console.warn(`[AgentSession] 应用版本「${n}」未生效,服务端已改用「${e}」。`);
63
63
  }
64
- function _(n) {
64
+ function U(n) {
65
65
  return n == null || n === "" || typeof n == "object" && !Array.isArray(n) && Object.keys(n).length === 0;
66
66
  }
67
67
  function G(n, d) {
68
- const e = U(n == null ? void 0 : n.query);
69
- if (!_(e))
68
+ const e = L(n == null ? void 0 : n.query);
69
+ if (!U(e))
70
70
  return e;
71
- const i = U(d);
72
- return _(i) && e != null ? e : i;
71
+ const i = L(d);
72
+ return U(i) && e != null ? e : i;
73
73
  }
74
74
  class ce extends D {
75
- constructor(e, i = "", a, o, c, g) {
76
- super(e, i, a, o, c, g);
77
- I(this, "inflightCalls", /* @__PURE__ */ new Set());
78
- I(this, "localMcpTicket", 0);
79
- I(this, "stopLocalMcpUpdates");
75
+ constructor(e, i = "", a, o, c, s) {
76
+ super(e, i, a, o, c, s);
77
+ M(this, "inflightCalls", /* @__PURE__ */ new Set());
78
+ M(this, "localMcpTicket", 0);
79
+ M(this, "stopLocalMcpUpdates");
80
80
  /** 已发出 `update`、尚未收到结果;下一条 ready / ack 按换票结果处理,不拆连接。 */
81
- I(this, "pendingTokenUpdate", !1);
81
+ M(this, "pendingTokenUpdate", !1);
82
82
  }
83
83
  prepareConnection() {
84
84
  return new Promise((e) => v(this, null, function* () {
85
- var c, g;
85
+ var c;
86
86
  if ((c = this.socket) != null && c.connected) {
87
87
  r.log("socket:reuse", this.id), e(!0);
88
88
  return;
@@ -90,14 +90,14 @@ class ce extends D {
90
90
  this.socket && (this.socket.removeAllListeners(), this.socket.close(), this.socket = null);
91
91
  const i = {
92
92
  version: "1.0",
93
- stream: JSON.stringify(p.stream),
93
+ stream: JSON.stringify(u.stream),
94
94
  appId: this._applicationId,
95
95
  sessionId: this.id,
96
96
  Authorization: `${this.requestToken}`,
97
- userMode: p.debug ? R.Debug : R.Normal
97
+ userMode: u.debug ? I.Debug : I.Normal
98
98
  };
99
- i.appVersion = ((g = p.appVersion) == null ? void 0 : g.trim()) || "latest";
100
- const a = new URL(p.apiRoot);
99
+ i.appVersion = N();
100
+ const a = new URL(u.apiRoot);
101
101
  r.log("socket:connecting", {
102
102
  sessionId: this.id,
103
103
  origin: a.origin
@@ -111,101 +111,98 @@ class ce extends D {
111
111
  r.log("socket:connect"), this.event.emit("socket:connect"), o.emit("init");
112
112
  }), o.on("disconnect", () => {
113
113
  r.log("socket:disconnect"), this.event.emit("socket:disconnect"), this._ready = !1, this.pendingTokenUpdate = !1;
114
- }), o.on("ready", (t) => {
114
+ }), o.on("ready", (s) => {
115
115
  if (this.pendingTokenUpdate) {
116
- this.handleResourceTokenUpdateResult(t);
116
+ this.handleResourceTokenUpdateResult(s);
117
117
  return;
118
118
  }
119
- if (t.code === 200) {
120
- r.log("ready"), K(i.appVersion, t.appVersion);
121
- const s = p.debug ? R.Debug : R.Normal;
122
- s === R.Debug && t.userMode, this._ready || (this._ready = !0, this.event.emit("ready")), this.frozen = !1, this.registerMcpFromClientConfig(), this.registerLocalMcp(), e(!0);
119
+ if (s.code === 200) {
120
+ r.log("ready"), K(i.appVersion, s.appVersion);
121
+ const t = u.debug ? I.Debug : I.Normal;
122
+ t === I.Debug && s.userMode, this._ready || (this._ready = !0, this.event.emit("ready")), this.frozen = !1, this.registerMcpFromClientConfig(), this.registerLocalMcp(), e(!0);
123
123
  } else {
124
124
  this._ready && (this._ready = !1);
125
- const s = new Error(
126
- A.SocketConnectionFailed
127
- // , {
128
- // cause: data,
129
- // }
130
- );
131
- r.error("error", s), this.event.emit("error", s), e(!1);
125
+ const t = new Error(R.SocketConnectionFailed, {
126
+ cause: s
127
+ });
128
+ r.error("error", t), this.event.emit("error", t), e(!1);
132
129
  }
133
- }), o.on("action", (t, s) => v(this, null, function* () {
134
- var b;
130
+ }), o.on("action", (s, t) => v(this, null, function* () {
131
+ var S;
135
132
  if (this._stopAnswer || !this.id)
136
133
  return;
137
134
  const {
138
135
  type: l,
139
136
  data: {
140
- runnerIsClient: y,
141
- pluginCode: u,
142
- funcCode: h,
143
- parameters: f,
144
- requestBody: q
137
+ runnerIsClient: m,
138
+ pluginCode: f,
139
+ funcCode: g,
140
+ parameters: p,
141
+ requestBody: _
145
142
  }
146
- } = t, k = this.messages[this.messages.length - 1];
143
+ } = s, k = this.messages[this.messages.length - 1];
147
144
  if (!k.messageId)
148
- k.actions || (k.actions = []), k.actions[t.data.step - 1] || (k.actions[t.data.step - 1] = []), k.actions[t.data.step - 1].push(t), this.event.emit("message:action", {
145
+ k.actions || (k.actions = []), k.actions[s.data.step - 1] || (k.actions[s.data.step - 1] = []), k.actions[s.data.step - 1].push(s), this.event.emit("message:action", {
149
146
  messageId: k.messageId,
150
- action: t
147
+ action: s
151
148
  }), this.event.emit("message:updated", k);
152
149
  else {
153
- const M = {
150
+ const w = {
154
151
  messageId: "",
155
152
  content: "",
156
- role: w.Robot,
153
+ role: C.Robot,
157
154
  sessionId: this.id,
158
155
  reference: [],
159
156
  searchReference: [],
160
157
  isLoading: !0,
161
158
  messageTime: "",
162
- actions: [[t]],
159
+ actions: [[s]],
163
160
  comment: {
164
161
  isAgree: 0
165
162
  },
166
163
  isReplying: !0
167
164
  };
168
- this.pushMessage(M), this.event.emit("message:action", {
169
- messageId: M.messageId,
170
- action: t
165
+ this.pushMessage(w), this.event.emit("message:action", {
166
+ messageId: w.messageId,
167
+ action: s
171
168
  });
172
169
  }
173
- if (l === "FUNCTION_CALL" && !y && r.log("server function", u, h), l === "FUNCTION_CALL" && y) {
174
- r.log(`calling function ${h} of plugin ${u} with argument:
175
- ${JSON.stringify(f)}`);
176
- const M = (b = p.plugins) == null ? void 0 : b[u];
177
- if (!M) {
178
- r.error("plugin not found", u, h), s({
170
+ if (l === "FUNCTION_CALL" && !m && r.log("server function", f, g), l === "FUNCTION_CALL" && m) {
171
+ r.log(`calling function ${g} of plugin ${f} with argument:
172
+ ${JSON.stringify(p)}`);
173
+ const w = (S = u.plugins) == null ? void 0 : S[f];
174
+ if (!w) {
175
+ r.error("plugin not found", f, g), t({
179
176
  code: 404,
180
177
  message: "没有找到插件。"
181
178
  });
182
179
  return;
183
180
  }
184
- const P = M[h];
185
- if (typeof P != "function") {
186
- r.error("plugin function not found", u, h), s({
181
+ const b = w[g];
182
+ if (typeof b != "function") {
183
+ r.error("plugin function not found", f, g), t({
187
184
  code: 404,
188
185
  message: "没有找到插件方法。"
189
186
  });
190
187
  return;
191
188
  }
192
- const E = G(f, q);
193
- this.invokeClientPlugin(P, E, s, {
194
- requestId: t.requestId,
195
- pluginCode: u,
196
- functionCode: h
189
+ const q = G(p, _);
190
+ this.invokeClientPlugin(b, q, t, {
191
+ requestId: s.requestId,
192
+ pluginCode: f,
193
+ functionCode: g
197
194
  });
198
195
  }
199
- })), o.on("answer", (t) => {
200
- if (r.log("answer", t == null ? void 0 : t.data), !this._stopAnswer)
201
- if (t.data.code !== 200 && (t.data.index = -1), t.data.stream || t.data.stream === void 0) {
202
- let s = this.messages[this.messages.length - 1];
203
- if (s && s.role === w.Robot)
204
- this.handleStreamAnswer(t.data, s), this.messages[this.messages.length - 1] = s, this.event.emit("message:content", s), this.event.emit("message:updated", s), s.index === -1 && (s.isReplying = !1, this.event.emit("answer:finish", s));
196
+ })), o.on("answer", (s) => {
197
+ if (r.log("answer", s == null ? void 0 : s.data), !this._stopAnswer)
198
+ if (s.data.code !== 200 && (s.data.index = -1), s.data.stream || s.data.stream === void 0) {
199
+ let t = this.messages[this.messages.length - 1];
200
+ if (t && t.role === C.Robot)
201
+ this.handleStreamAnswer(s.data, t), this.messages[this.messages.length - 1] = t, this.event.emit("message:content", t), this.event.emit("message:updated", t), t.index === -1 && (t.isReplying = !1, this.event.emit("answer:finish", t));
205
202
  else {
206
203
  const l = {
207
204
  content: "",
208
- role: w.Robot,
205
+ role: C.Robot,
209
206
  reference: [],
210
207
  searchReference: [],
211
208
  messageId: "",
@@ -225,17 +222,17 @@ class ce extends D {
225
222
  thinkingStatus: "",
226
223
  searchingStatus: ""
227
224
  };
228
- this.handleStreamAnswer(t.data, l), this.pushMessage(l), this.event.emit("message:content", l), l.index === -1 && (l.isReplying = !1, this.event.emit("answer:finish", l));
225
+ this.handleStreamAnswer(s.data, l), this.pushMessage(l), this.event.emit("message:content", l), l.index === -1 && (l.isReplying = !1, this.event.emit("answer:finish", l));
229
226
  }
230
- } else if (t.data.updateSession && this.data && (this.data = m(m({}, this.data), t.data.updateSession), this.event.emit("data:updated", this.data)), t.data.index === -1) {
231
- let s = this.messages[this.messages.length - 1];
232
- if (s && !s.messageId)
233
- s = m(m({}, s), t.data), this.event.emit("message:content", s), this.event.emit("message:updated", s), this.event.emit("answer:finish", s);
227
+ } else if (s.data.updateSession && this.data && (this.data = h(h({}, this.data), s.data.updateSession), this.event.emit("data:updated", this.data)), s.data.index === -1) {
228
+ let t = this.messages[this.messages.length - 1];
229
+ if (t && !t.messageId)
230
+ t = h(h({}, t), s.data), this.event.emit("message:content", t), this.event.emit("message:updated", t), this.event.emit("answer:finish", t);
234
231
  else {
235
- const l = m({
232
+ const l = h({
236
233
  messageId: "",
237
234
  content: "",
238
- role: w.Robot,
235
+ role: C.Robot,
239
236
  sessionId: this.id,
240
237
  reference: [],
241
238
  searchReference: [],
@@ -246,15 +243,15 @@ class ce extends D {
246
243
  isAgree: 0
247
244
  },
248
245
  isReplying: !0
249
- }, t.data);
246
+ }, s.data);
250
247
  this.event.emit("message:content", l), this.pushMessage(l), this.event.emit("answer:finish", l);
251
248
  }
252
249
  } else {
253
- let s = this.messages[this.messages.length - 1];
254
- s && !s.messageId ? (s = m(m({}, s), t.data), this.messages[this.messages.length - 1] = s, this.event.emit("message:content", s), this.event.emit("message:updated", s)) : (this.pushMessage(m({
250
+ let t = this.messages[this.messages.length - 1];
251
+ t && !t.messageId ? (t = h(h({}, t), s.data), this.messages[this.messages.length - 1] = t, this.event.emit("message:content", t), this.event.emit("message:updated", t)) : (this.pushMessage(h({
255
252
  messageId: "",
256
253
  content: "",
257
- role: w.Robot,
254
+ role: C.Robot,
258
255
  sessionId: this.id,
259
256
  reference: [],
260
257
  searchReference: [],
@@ -265,40 +262,40 @@ class ce extends D {
265
262
  isAgree: 0
266
263
  },
267
264
  isReplying: !0
268
- }, t.data)), this.event.emit("message:content", t.data));
265
+ }, s.data)), this.event.emit("message:content", s.data));
269
266
  }
270
- }), o.on("reference", (t) => v(this, null, function* () {
267
+ }), o.on("reference", (s) => v(this, null, function* () {
271
268
  if (this._stopAnswer)
272
269
  return;
273
270
  if (!this.id) {
274
- const f = new Error(
275
- A.IdUndefined
271
+ const p = new Error(
272
+ R.IdUndefined
276
273
  // {
277
274
  // cause: SESSION_ERROR_CAUSE[SessionErrors.IdUndefined],
278
275
  // }
279
276
  );
280
- r.error(f), this.event.emit("error", f), this.frozen = !1;
277
+ r.error(p), this.event.emit("error", p), this.frozen = !1;
281
278
  return;
282
279
  }
283
280
  const {
284
- type: s,
281
+ type: t,
285
282
  data: l,
286
- requestId: y
287
- } = t;
283
+ requestId: m
284
+ } = s;
288
285
  r.log("reference", {
289
- type: s,
290
- requestId: y,
286
+ type: t,
287
+ requestId: m,
291
288
  data: l
292
289
  });
293
- const u = this.messages.findIndex((f) => f.messageId === y && f.role === w.User);
294
- if (u < 0)
290
+ const f = this.messages.findIndex((p) => p.messageId === m && p.role === C.User);
291
+ if (f < 0)
295
292
  return;
296
- const h = u + 1;
297
- if (h >= this.messages.length) {
298
- const f = {
293
+ const g = f + 1;
294
+ if (g >= this.messages.length) {
295
+ const p = {
299
296
  messageId: "",
300
297
  content: "",
301
- role: w.Robot,
298
+ role: C.Robot,
302
299
  sessionId: this.id,
303
300
  reference: [],
304
301
  searchReference: [],
@@ -310,23 +307,23 @@ class ce extends D {
310
307
  },
311
308
  isReplying: !0
312
309
  };
313
- this.pushMessage(f);
310
+ this.pushMessage(p);
314
311
  }
315
- s === "KG" ? (this.messages[h] = C(m({}, this.messages[h]), {
312
+ t === "KG" ? (this.messages[g] = y(h({}, this.messages[g]), {
316
313
  reference: l.knowledgeReference
317
- }), yield this.fillMessageReference(this.messages[h]), this.event.emit("message:reference", l.knowledgeReference), this.event.emit("message:updated", this.messages[h])) : s === "WEB_SEARCH" && (this.messages[h] = C(m({}, this.messages[h]), {
314
+ }), yield this.fillMessageReference(this.messages[g]), this.event.emit("message:reference", l.knowledgeReference), this.event.emit("message:updated", this.messages[g])) : t === "WEB_SEARCH" && (this.messages[g] = y(h({}, this.messages[g]), {
318
315
  searchReference: l.knowledgeReference
319
- }), this.event.emit("message:searchreference", l.searchReference), this.event.emit("message:updated", this.messages[h]));
316
+ }), this.event.emit("message:searchreference", l.searchReference), this.event.emit("message:updated", this.messages[g]));
320
317
  })), this.socket = o, o.open();
321
318
  }));
322
319
  }
323
320
  registerMcpFromClientConfig() {
324
- return p.mcp ? new Promise((e, i) => {
321
+ return u.mcp ? new Promise((e, i) => {
325
322
  if (!this.socket) {
326
323
  i("socket is undefined");
327
324
  return;
328
325
  }
329
- this.socket.emit("add_mcp_servers", p.mcp, (a) => {
326
+ this.socket.emit("add_mcp_servers", u.mcp, (a) => {
330
327
  a.code === 200 ? (Object.keys(a.data).forEach((o) => {
331
328
  a.data[o].code !== 200 && r.report(o, "MCP Server 注册失败。", a.data[o]);
332
329
  }), r.log("mcp:registered", Object.keys(a.data)), e(!0)) : (r.error("MCP Server 注册失败。", a), i(a));
@@ -342,8 +339,8 @@ class ce extends D {
342
339
  const i = ++this.localMcpTicket;
343
340
  Y({
344
341
  arrange: (o = (a = this.application) == null ? void 0 : a.arrange) == null ? void 0 : o[0],
345
- initMcp: p.mcp,
346
- apiRoot: p.apiRoot,
342
+ initMcp: u.mcp,
343
+ apiRoot: u.apiRoot,
347
344
  token: this.requestToken,
348
345
  socket: e,
349
346
  isCurrent: () => i === this.localMcpTicket
@@ -375,12 +372,12 @@ class ce extends D {
375
372
  return v(this, null, function* () {
376
373
  var o;
377
374
  this.convertKnowledgesToChatFormat(this.knowledges);
378
- let a = C(m({}, e), {
379
- promptVariables: this.promptVariables.filter((c) => c.type === L.User).reduce((c, g) => C(m({}, c), {
380
- [g.key]: g.value
375
+ let a = y(h({}, e), {
376
+ promptVariables: this.promptVariables.filter((c) => c.type === T.User).reduce((c, s) => y(h({}, c), {
377
+ [s.key]: s.value
381
378
  }), {}),
382
- systemPromptVariables: this.promptVariables.filter((c) => c.type === L.System).reduce((c, g) => C(m({}, c), {
383
- [g.key]: g.value
379
+ systemPromptVariables: this.promptVariables.filter((c) => c.type === T.System).reduce((c, s) => y(h({}, c), {
380
+ [s.key]: s.value
384
381
  }), {}),
385
382
  knowledges: (o = this.knowledges) == null ? void 0 : o.map((c) => c.id),
386
383
  //agent支持指定文件时再放开
@@ -390,7 +387,7 @@ class ce extends D {
390
387
  if (!this.active) {
391
388
  if (yield this.activate(), !this.socket) {
392
389
  const c = new Error(
393
- A.SocketConnectionFailed
390
+ R.SocketConnectionFailed
394
391
  // {
395
392
  // cause: { code: -1, message: 'socket is null' },
396
393
  // }
@@ -416,10 +413,10 @@ class ce extends D {
416
413
  invokeClientPlugin(e, i, a, o) {
417
414
  const c = new AbortController();
418
415
  this.inflightCalls.add(c);
419
- let g = !1;
420
- const t = (...l) => {
421
- g || (g = !0, this.inflightCalls.delete(c), !(this._stopAnswer || c.signal.aborted) && a(...l));
422
- }, s = {
416
+ let s = !1;
417
+ const t = (...m) => {
418
+ s || (s = !0, this.inflightCalls.delete(c), !(this._stopAnswer || c.signal.aborted) && a(...m));
419
+ }, l = {
423
420
  requestId: o.requestId || B(),
424
421
  applicationId: this._applicationId,
425
422
  sessionId: this.id,
@@ -428,15 +425,15 @@ class ce extends D {
428
425
  signal: c.signal
429
426
  };
430
427
  try {
431
- const l = e(i, t, s);
432
- l && typeof l.catch == "function" && l.catch((y) => {
433
- r.error("client plugin failed", y), t({
428
+ const m = e(i, t, l);
429
+ m && typeof m.catch == "function" && m.catch((f) => {
430
+ r.error("client plugin failed", f), t({
434
431
  code: 500,
435
432
  message: "客户端插件执行失败。"
436
433
  });
437
434
  });
438
- } catch (l) {
439
- r.error("client plugin failed", l), t({
435
+ } catch (m) {
436
+ r.error("client plugin failed", m), t({
440
437
  code: 500,
441
438
  message: "客户端插件执行失败。"
442
439
  });
@@ -466,7 +463,7 @@ class ce extends D {
466
463
  r.log("socket:update:ok", this.id);
467
464
  return;
468
465
  }
469
- const i = new Error(A.SocketConnectionFailed, {
466
+ const i = new Error(R.SocketConnectionFailed, {
470
467
  cause: e
471
468
  });
472
469
  r.error("socket:update:failed", e), this.event.emit("error", i);