@glodon-aiot/bot-client-sdk 3.26.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
@@ -50,6 +50,7 @@ const client = new BotClient(token, {
50
50
  env: 'dev', // 'dev' | 'test' | 'prod' | 'local',决定默认 API 地址
51
51
  // apiRoot: 'https://example.com/api/cvforce', // 传入后覆盖 env
52
52
  stream: true, // 省略时 Agent / 对话型默认流式
53
+ // appVersion: 'v1', // 编排版本:draft | latest | v1/v2…;省略时默认传 latest
53
54
  // plugins、builtinPlugins 见「Agent 插件」
54
55
  });
55
56
 
@@ -65,6 +66,8 @@ client.addEventListener('ready', () => {
65
66
 
66
67
  应用类型由平台应用决定,`loadSession` 按类型创建对应会话。
67
68
 
69
+ `appVersion` 作用于 Agent 的 WebSocket 建连,以及应用详情、prompt 变量、推荐问题、常用提示词和创建会话。HTTP 查询或创建会话请求体里的字段名是 `version`。`draft` 使用草稿,`v1` / `v2` 等指定已发布版本(大小写不敏感),`latest` 始终使用最新版本。不传或传空白时 SDK 默认传 `latest`。其他值不会导致连接失败,服务端会改用最新版本。ready 带回的版本与请求不一致时,SDK 输出告警。
70
+
68
71
  ## 对话界面
69
72
 
70
73
  界面自管渲染状态,数据以 `session.messages` 为准。事件都带当前消息或列表,收到后重绘即可。
@@ -1,18 +1,18 @@
1
1
  var E = Object.defineProperty, x = Object.defineProperties;
2
2
  var j = Object.getOwnPropertyDescriptors;
3
3
  var P = Object.getOwnPropertySymbols;
4
- var O = Object.prototype.hasOwnProperty, F = Object.prototype.propertyIsEnumerable;
5
- var S = (r, d, e) => d in r ? E(r, d, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[d] = e, h = (r, d) => {
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
- O.call(d, e) && S(r, e, d[e]);
7
+ O.call(d, e) && A(n, e, d[e]);
8
8
  if (P)
9
9
  for (var e of P(d))
10
- F.call(d, e) && S(r, e, d[e]);
11
- return r;
12
- }, y = (r, d) => x(r, j(d));
13
- var w = (r, d, e) => (S(r, typeof d != "symbol" ? d + "" : d, e), e);
14
- var v = (r, d, e) => new Promise((i, a) => {
15
- var n = (t) => {
10
+ V.call(d, e) && A(n, e, d[e]);
11
+ return n;
12
+ }, y = (n, d) => x(n, j(d));
13
+ var M = (n, d, e) => (A(n, typeof d != "symbol" ? d + "" : d, e), e);
14
+ var v = (n, d, e) => new Promise((i, a) => {
15
+ var o = (t) => {
16
16
  try {
17
17
  s(e.next(t));
18
18
  } catch (l) {
@@ -24,106 +24,111 @@ var v = (r, d, e) => new Promise((i, a) => {
24
24
  } catch (l) {
25
25
  a(l);
26
26
  }
27
- }, s = (t) => t.done ? i(t.value) : Promise.resolve(t.value).then(n, c);
28
- s((e = e.apply(r, 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
30
  import { ChatMessageRole as C, PromptVariableType as T } from "@glodon-aiot/apis";
31
- import N from "./Logger.mjs";
32
- import { configuration as p } from "./Config.mjs";
33
- import { io as D } from "socket.io-client";
31
+ import F from "./Logger.mjs";
32
+ import { configuration as u, resolveAppVersion as N } from "./Config.mjs";
33
+ import { io as $ } from "socket.io-client";
34
34
  import { UserMode as I } from "./PayloadTypes.mjs";
35
- import z, { SessionErrors as R } from "./Session.mjs";
36
- import V from "dayjs";
37
- import { v4 as $ } from "uuid";
38
- import { connectLocalMcpBridge as B, subscribeLocalMcpEndpoints as J } from "./localMcp/endpoints.mjs";
39
- import { registerLocalMcp as Q } from "./localMcp/register.mjs";
40
- const o = new N("[AgentSession] ");
41
- function L(r) {
42
- if (typeof r != "string")
43
- return r;
44
- const d = r.trim();
35
+ import D, { SessionErrors as R } from "./Session.mjs";
36
+ import z from "dayjs";
37
+ import { v4 as B } from "uuid";
38
+ import { connectLocalMcpBridge as J, subscribeLocalMcpEndpoints as Q } from "./localMcp/endpoints.mjs";
39
+ import { registerLocalMcp as Y } from "./localMcp/register.mjs";
40
+ const r = new F("[AgentSession] ");
41
+ function L(n) {
42
+ if (typeof n != "string")
43
+ return n;
44
+ const d = n.trim();
45
45
  if (d)
46
46
  try {
47
47
  return JSON.parse(d);
48
48
  } catch (e) {
49
- return r;
49
+ return n;
50
50
  }
51
51
  }
52
- function Y(r) {
53
- const d = r.imageContent;
54
- return Array.isArray(d) ? y(h({}, r), {
52
+ function H(n) {
53
+ const d = n.imageContent;
54
+ return Array.isArray(d) ? y(h({}, n), {
55
55
  imageContent: `[${d.length}]`
56
- }) : r;
56
+ }) : n;
57
57
  }
58
- function U(r) {
59
- return r == null || r === "" || typeof r == "object" && !Array.isArray(r) && Object.keys(r).length === 0;
58
+ function K(n, d) {
59
+ if (typeof d != "string")
60
+ return;
61
+ const e = d.trim();
62
+ !e || n.trim().toLowerCase() === e.toLowerCase() || console.warn(`[AgentSession] 应用版本「${n}」未生效,服务端已改用「${e}」。`);
60
63
  }
61
- function H(r, d) {
62
- const e = L(r == null ? void 0 : r.query);
64
+ function U(n) {
65
+ return n == null || n === "" || typeof n == "object" && !Array.isArray(n) && Object.keys(n).length === 0;
66
+ }
67
+ function G(n, d) {
68
+ const e = L(n == null ? void 0 : n.query);
63
69
  if (!U(e))
64
70
  return e;
65
71
  const i = L(d);
66
72
  return U(i) && e != null ? e : i;
67
73
  }
68
- class re extends z {
69
- constructor(e, i = "", a, n, c, s) {
70
- super(e, i, a, n, c, s);
71
- w(this, "inflightCalls", /* @__PURE__ */ new Set());
72
- w(this, "localMcpTicket", 0);
73
- w(this, "stopLocalMcpUpdates");
74
+ class ce extends D {
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");
74
80
  /** 已发出 `update`、尚未收到结果;下一条 ready / ack 按换票结果处理,不拆连接。 */
75
- w(this, "pendingTokenUpdate", !1);
81
+ M(this, "pendingTokenUpdate", !1);
76
82
  }
77
83
  prepareConnection() {
78
84
  return new Promise((e) => v(this, null, function* () {
79
85
  var c;
80
86
  if ((c = this.socket) != null && c.connected) {
81
- o.log("socket:reuse", this.id), e(!0);
87
+ r.log("socket:reuse", this.id), e(!0);
82
88
  return;
83
89
  }
84
90
  this.socket && (this.socket.removeAllListeners(), this.socket.close(), this.socket = null);
85
91
  const i = {
86
92
  version: "1.0",
87
- stream: JSON.stringify(p.stream),
93
+ stream: JSON.stringify(u.stream),
88
94
  appId: this._applicationId,
89
95
  sessionId: this.id,
90
96
  Authorization: `${this.requestToken}`,
91
- userMode: p.debug ? I.Debug : I.Normal
92
- }, a = new URL(p.apiRoot);
93
- o.log("socket:connecting", {
97
+ userMode: u.debug ? I.Debug : I.Normal
98
+ };
99
+ i.appVersion = N();
100
+ const a = new URL(u.apiRoot);
101
+ r.log("socket:connecting", {
94
102
  sessionId: this.id,
95
103
  origin: a.origin
96
104
  });
97
- const n = yield D(a.origin, {
105
+ const o = yield $(a.origin, {
98
106
  path: a.pathname.replace("api", "socketio") + "/copilot",
99
107
  query: i,
100
108
  transports: ["websocket"]
101
109
  });
102
- n.on("connect", () => {
103
- o.log("socket:connect"), this.event.emit("socket:connect"), n.emit("init");
104
- }), n.on("disconnect", () => {
105
- o.log("socket:disconnect"), this.event.emit("socket:disconnect"), this._ready = !1, this.pendingTokenUpdate = !1;
106
- }), n.on("ready", (s) => {
110
+ o.on("connect", () => {
111
+ r.log("socket:connect"), this.event.emit("socket:connect"), o.emit("init");
112
+ }), o.on("disconnect", () => {
113
+ r.log("socket:disconnect"), this.event.emit("socket:disconnect"), this._ready = !1, this.pendingTokenUpdate = !1;
114
+ }), o.on("ready", (s) => {
107
115
  if (this.pendingTokenUpdate) {
108
116
  this.handleResourceTokenUpdateResult(s);
109
117
  return;
110
118
  }
111
119
  if (s.code === 200) {
112
- o.log("ready");
113
- const t = p.debug ? I.Debug : I.Normal;
120
+ r.log("ready"), K(i.appVersion, s.appVersion);
121
+ const t = u.debug ? I.Debug : I.Normal;
114
122
  t === I.Debug && s.userMode, this._ready || (this._ready = !0, this.event.emit("ready")), this.frozen = !1, this.registerMcpFromClientConfig(), this.registerLocalMcp(), e(!0);
115
123
  } else {
116
124
  this._ready && (this._ready = !1);
117
- const t = new Error(
118
- R.SocketConnectionFailed
119
- // , {
120
- // cause: data,
121
- // }
122
- );
123
- o.error("error", t), this.event.emit("error", t), 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);
124
129
  }
125
- }), n.on("action", (s, t) => v(this, null, function* () {
126
- var A;
130
+ }), o.on("action", (s, t) => v(this, null, function* () {
131
+ var S;
127
132
  if (this._stopAnswer || !this.id)
128
133
  return;
129
134
  const {
@@ -132,7 +137,7 @@ class re extends z {
132
137
  runnerIsClient: m,
133
138
  pluginCode: f,
134
139
  funcCode: g,
135
- parameters: u,
140
+ parameters: p,
136
141
  requestBody: _
137
142
  }
138
143
  } = s, k = this.messages[this.messages.length - 1];
@@ -142,7 +147,7 @@ class re extends z {
142
147
  action: s
143
148
  }), this.event.emit("message:updated", k);
144
149
  else {
145
- const M = {
150
+ const w = {
146
151
  messageId: "",
147
152
  content: "",
148
153
  role: C.Robot,
@@ -157,39 +162,39 @@ class re extends z {
157
162
  },
158
163
  isReplying: !0
159
164
  };
160
- this.pushMessage(M), this.event.emit("message:action", {
161
- messageId: M.messageId,
165
+ this.pushMessage(w), this.event.emit("message:action", {
166
+ messageId: w.messageId,
162
167
  action: s
163
168
  });
164
169
  }
165
- if (l === "FUNCTION_CALL" && !m && o.log("server function", f, g), l === "FUNCTION_CALL" && m) {
166
- o.log(`calling function ${g} of plugin ${f} with argument:
167
- ${JSON.stringify(u)}`);
168
- const M = (A = p.plugins) == null ? void 0 : A[f];
169
- if (!M) {
170
- o.error("plugin not found", f, g), t({
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({
171
176
  code: 404,
172
177
  message: "没有找到插件。"
173
178
  });
174
179
  return;
175
180
  }
176
- const b = M[g];
181
+ const b = w[g];
177
182
  if (typeof b != "function") {
178
- o.error("plugin function not found", f, g), t({
183
+ r.error("plugin function not found", f, g), t({
179
184
  code: 404,
180
185
  message: "没有找到插件方法。"
181
186
  });
182
187
  return;
183
188
  }
184
- const q = H(u, _);
189
+ const q = G(p, _);
185
190
  this.invokeClientPlugin(b, q, t, {
186
191
  requestId: s.requestId,
187
192
  pluginCode: f,
188
193
  functionCode: g
189
194
  });
190
195
  }
191
- })), n.on("answer", (s) => {
192
- if (o.log("answer", s == null ? void 0 : s.data), !this._stopAnswer)
196
+ })), o.on("answer", (s) => {
197
+ if (r.log("answer", s == null ? void 0 : s.data), !this._stopAnswer)
193
198
  if (s.data.code !== 200 && (s.data.index = -1), s.data.stream || s.data.stream === void 0) {
194
199
  let t = this.messages[this.messages.length - 1];
195
200
  if (t && t.role === C.Robot)
@@ -202,7 +207,7 @@ class re extends z {
202
207
  searchReference: [],
203
208
  messageId: "",
204
209
  sessionId: this.id,
205
- messageTime: V(/* @__PURE__ */ new Date()).format("YYYY-MM-DD HH:mm:ss"),
210
+ messageTime: z(/* @__PURE__ */ new Date()).format("YYYY-MM-DD HH:mm:ss"),
206
211
  comment: {
207
212
  isAgree: 0
208
213
  },
@@ -259,17 +264,17 @@ class re extends z {
259
264
  isReplying: !0
260
265
  }, s.data)), this.event.emit("message:content", s.data));
261
266
  }
262
- }), n.on("reference", (s) => v(this, null, function* () {
267
+ }), o.on("reference", (s) => v(this, null, function* () {
263
268
  if (this._stopAnswer)
264
269
  return;
265
270
  if (!this.id) {
266
- const u = new Error(
271
+ const p = new Error(
267
272
  R.IdUndefined
268
273
  // {
269
274
  // cause: SESSION_ERROR_CAUSE[SessionErrors.IdUndefined],
270
275
  // }
271
276
  );
272
- o.error(u), this.event.emit("error", u), this.frozen = !1;
277
+ r.error(p), this.event.emit("error", p), this.frozen = !1;
273
278
  return;
274
279
  }
275
280
  const {
@@ -277,17 +282,17 @@ class re extends z {
277
282
  data: l,
278
283
  requestId: m
279
284
  } = s;
280
- o.log("reference", {
285
+ r.log("reference", {
281
286
  type: t,
282
287
  requestId: m,
283
288
  data: l
284
289
  });
285
- const f = this.messages.findIndex((u) => u.messageId === m && u.role === C.User);
290
+ const f = this.messages.findIndex((p) => p.messageId === m && p.role === C.User);
286
291
  if (f < 0)
287
292
  return;
288
293
  const g = f + 1;
289
294
  if (g >= this.messages.length) {
290
- const u = {
295
+ const p = {
291
296
  messageId: "",
292
297
  content: "",
293
298
  role: C.Robot,
@@ -302,56 +307,56 @@ class re extends z {
302
307
  },
303
308
  isReplying: !0
304
309
  };
305
- this.pushMessage(u);
310
+ this.pushMessage(p);
306
311
  }
307
312
  t === "KG" ? (this.messages[g] = y(h({}, this.messages[g]), {
308
313
  reference: l.knowledgeReference
309
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]), {
310
315
  searchReference: l.knowledgeReference
311
316
  }), this.event.emit("message:searchreference", l.searchReference), this.event.emit("message:updated", this.messages[g]));
312
- })), this.socket = n, n.open();
317
+ })), this.socket = o, o.open();
313
318
  }));
314
319
  }
315
320
  registerMcpFromClientConfig() {
316
- return p.mcp ? new Promise((e, i) => {
321
+ return u.mcp ? new Promise((e, i) => {
317
322
  if (!this.socket) {
318
323
  i("socket is undefined");
319
324
  return;
320
325
  }
321
- this.socket.emit("add_mcp_servers", p.mcp, (a) => {
322
- a.code === 200 ? (Object.keys(a.data).forEach((n) => {
323
- a.data[n].code !== 200 && o.report(n, "MCP Server 注册失败。", a.data[n]);
324
- }), o.log("mcp:registered", Object.keys(a.data)), e(!0)) : (o.error("MCP Server 注册失败。", a), i(a));
326
+ this.socket.emit("add_mcp_servers", u.mcp, (a) => {
327
+ a.code === 200 ? (Object.keys(a.data).forEach((o) => {
328
+ a.data[o].code !== 200 && r.report(o, "MCP Server 注册失败。", a.data[o]);
329
+ }), r.log("mcp:registered", Object.keys(a.data)), e(!0)) : (r.error("MCP Server 注册失败。", a), i(a));
325
330
  });
326
- }) : (o.log("mcp:skip"), Promise.resolve(!0));
331
+ }) : (r.log("mcp:skip"), Promise.resolve(!0));
327
332
  }
328
333
  registerLocalMcp() {
329
- var a, n;
334
+ var a, o;
330
335
  const e = this.socket;
331
336
  if (!e)
332
337
  return;
333
- B(), this.stopLocalMcpUpdates || (this.stopLocalMcpUpdates = J(() => this.registerLocalMcp()));
338
+ J(), this.stopLocalMcpUpdates || (this.stopLocalMcpUpdates = Q(() => this.registerLocalMcp()));
334
339
  const i = ++this.localMcpTicket;
335
- Q({
336
- arrange: (n = (a = this.application) == null ? void 0 : a.arrange) == null ? void 0 : n[0],
337
- initMcp: p.mcp,
338
- apiRoot: p.apiRoot,
340
+ Y({
341
+ arrange: (o = (a = this.application) == null ? void 0 : a.arrange) == null ? void 0 : o[0],
342
+ initMcp: u.mcp,
343
+ apiRoot: u.apiRoot,
339
344
  token: this.requestToken,
340
345
  socket: e,
341
346
  isCurrent: () => i === this.localMcpTicket
342
347
  }).catch((c) => {
343
- o.report("local mcp", c instanceof Error ? c.message : String(c));
348
+ r.report("local mcp", c instanceof Error ? c.message : String(c));
344
349
  });
345
350
  }
346
351
  addMcpServers(e) {
347
352
  return v(this, null, function* () {
348
353
  return this.ready ? this.socket ? new Promise((i, a) => {
349
- this.socket && this.socket.emit("add_mcp_servers", e, (n) => {
350
- n.code === 200 ? (Object.keys(n.data).forEach((c) => {
351
- n.data[c].code !== 200 && o.report(c, "MCP Server 注册失败。", n.data[c]);
352
- }), o.log("mcp:registered", Object.keys(n.data)), i(!0)) : (o.error("MCP Server 注册失败。", n), a(n));
354
+ this.socket && this.socket.emit("add_mcp_servers", e, (o) => {
355
+ o.code === 200 ? (Object.keys(o.data).forEach((c) => {
356
+ o.data[c].code !== 200 && r.report(c, "MCP Server 注册失败。", o.data[c]);
357
+ }), r.log("mcp:registered", Object.keys(o.data)), i(!0)) : (r.error("MCP Server 注册失败。", o), a(o));
353
358
  });
354
- }) : (o.error("socket is undefined."), Promise.reject("socket is undefined")) : (o.error("session is not avalible."), Promise.reject("session is not avalible"));
359
+ }) : (r.error("socket is undefined."), Promise.reject("socket is undefined")) : (r.error("session is not avalible."), Promise.reject("session is not avalible"));
355
360
  });
356
361
  }
357
362
  listMcpServers() {
@@ -360,12 +365,12 @@ class re extends z {
360
365
  this.socket && this.socket.emit("list_mcp_servers", (a) => {
361
366
  a.code === 200 ? e(a.data) : i(a);
362
367
  });
363
- }) : (o.error("socket is undefined."), Promise.reject("socket is undefined")) : (o.error("session is not avalible."), Promise.reject("session is not avalible"));
368
+ }) : (r.error("socket is undefined."), Promise.reject("socket is undefined")) : (r.error("session is not avalible."), Promise.reject("session is not avalible"));
364
369
  });
365
370
  }
366
371
  sendQuestion(e, i) {
367
372
  return v(this, null, function* () {
368
- var n;
373
+ var o;
369
374
  this.convertKnowledgesToChatFormat(this.knowledges);
370
375
  let a = y(h({}, e), {
371
376
  promptVariables: this.promptVariables.filter((c) => c.type === T.User).reduce((c, s) => y(h({}, c), {
@@ -374,7 +379,7 @@ class re extends z {
374
379
  systemPromptVariables: this.promptVariables.filter((c) => c.type === T.System).reduce((c, s) => y(h({}, c), {
375
380
  [s.key]: s.value
376
381
  }), {}),
377
- knowledges: (n = this.knowledges) == null ? void 0 : n.map((c) => c.id),
382
+ knowledges: (o = this.knowledges) == null ? void 0 : o.map((c) => c.id),
378
383
  //agent支持指定文件时再放开
379
384
  // knowledges: knowledgesForChat,
380
385
  enableTitleSummary: this.resolveEnableTitleSummary()
@@ -387,7 +392,7 @@ class re extends z {
387
392
  // cause: { code: -1, message: 'socket is null' },
388
393
  // }
389
394
  );
390
- return o.warn("error", c), this.event.emit("error", c), !1;
395
+ return r.warn("error", c), this.event.emit("error", c), !1;
391
396
  }
392
397
  this.emitQuestion(a);
393
398
  return;
@@ -397,7 +402,7 @@ class re extends z {
397
402
  }
398
403
  emitQuestion(e) {
399
404
  var i;
400
- o.log("question:request", Y(e)), (i = this.socket) == null || i.emit("question", e), o.log("question:sent", {
405
+ r.log("question:request", H(e)), (i = this.socket) == null || i.emit("question", e), r.log("question:sent", {
401
406
  sessionId: this.id
402
407
  });
403
408
  }
@@ -405,30 +410,30 @@ class re extends z {
405
410
  * 调用客户端插件:传入第三个参数 context(旧插件可忽略),结果最多回传一次,
406
411
  * 停止回答或调用被取消后不再回传。
407
412
  */
408
- invokeClientPlugin(e, i, a, n) {
413
+ invokeClientPlugin(e, i, a, o) {
409
414
  const c = new AbortController();
410
415
  this.inflightCalls.add(c);
411
416
  let s = !1;
412
417
  const t = (...m) => {
413
418
  s || (s = !0, this.inflightCalls.delete(c), !(this._stopAnswer || c.signal.aborted) && a(...m));
414
419
  }, l = {
415
- requestId: n.requestId || $(),
420
+ requestId: o.requestId || B(),
416
421
  applicationId: this._applicationId,
417
422
  sessionId: this.id,
418
- pluginCode: n.pluginCode,
419
- functionCode: n.functionCode,
423
+ pluginCode: o.pluginCode,
424
+ functionCode: o.functionCode,
420
425
  signal: c.signal
421
426
  };
422
427
  try {
423
428
  const m = e(i, t, l);
424
429
  m && typeof m.catch == "function" && m.catch((f) => {
425
- o.error("client plugin failed", f), t({
430
+ r.error("client plugin failed", f), t({
426
431
  code: 500,
427
432
  message: "客户端插件执行失败。"
428
433
  });
429
434
  });
430
435
  } catch (m) {
431
- o.error("client plugin failed", m), t({
436
+ r.error("client plugin failed", m), t({
432
437
  code: 500,
433
438
  message: "客户端插件执行失败。"
434
439
  });
@@ -447,7 +452,7 @@ class re extends z {
447
452
  if (!this.socket)
448
453
  return;
449
454
  const i = this.socket.io.opts.query;
450
- i && (i.Authorization = e), this.socket.connected && (this.pendingTokenUpdate = !0, o.log("socket:update", this.id), this.socket.emit("update", {
455
+ i && (i.Authorization = e), this.socket.connected && (this.pendingTokenUpdate = !0, r.log("socket:update", this.id), this.socket.emit("update", {
451
456
  resourceToken: e
452
457
  }, (a) => {
453
458
  this.pendingTokenUpdate && this.handleResourceTokenUpdateResult(a);
@@ -455,17 +460,17 @@ class re extends z {
455
460
  }
456
461
  handleResourceTokenUpdateResult(e) {
457
462
  if (this.pendingTokenUpdate = !1, !e || e.code === 200) {
458
- o.log("socket:update:ok", this.id);
463
+ r.log("socket:update:ok", this.id);
459
464
  return;
460
465
  }
461
466
  const i = new Error(R.SocketConnectionFailed, {
462
467
  cause: e
463
468
  });
464
- o.error("socket:update:failed", e), this.event.emit("error", i);
469
+ r.error("socket:update:failed", e), this.event.emit("error", i);
465
470
  }
466
471
  stopAnswer() {
467
472
  var e;
468
- o.log("stopAnswer", this.id), this.abortClientPluginCalls(), (e = this.socket) == null || e.emit("stop_answer");
473
+ r.log("stopAnswer", this.id), this.abortClientPluginCalls(), (e = this.socket) == null || e.emit("stop_answer");
469
474
  }
470
475
  inactivate(e = !1) {
471
476
  return !e && this.frozen && !!this.socket || this.abortClientPluginCalls(), super.inactivate(e);
@@ -482,5 +487,5 @@ class re extends z {
482
487
  }
483
488
  }
484
489
  export {
485
- re as default
490
+ ce as default
486
491
  };