@glodon-aiot/agent-cli-sdk 3.3.3 → 3.3.4-beta.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.
@@ -1,5 +1,5 @@
1
- var R = Object.defineProperty, b = Object.defineProperties;
2
- var S = Object.getOwnPropertyDescriptors;
1
+ var R = Object.defineProperty, S = Object.defineProperties;
2
+ var b = Object.getOwnPropertyDescriptors;
3
3
  var _ = Object.getOwnPropertySymbols;
4
4
  var A = Object.prototype.hasOwnProperty, E = Object.prototype.propertyIsEnumerable;
5
5
  var P = (d, t, n) => t in d ? R(d, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : d[t] = n, h = (d, t) => {
@@ -9,73 +9,73 @@ var P = (d, t, n) => t in d ? R(d, t, { enumerable: !0, configurable: !0, writab
9
9
  for (var n of _(t))
10
10
  E.call(t, n) && P(d, n, t[n]);
11
11
  return d;
12
- }, k = (d, t) => b(d, S(t));
13
- var p = (d, t, n) => new Promise((o, i) => {
14
- var e = (c) => {
12
+ }, k = (d, t) => S(d, b(t));
13
+ var v = (d, t, n) => new Promise((r, i) => {
14
+ var s = (c) => {
15
15
  try {
16
- r(n.next(c));
16
+ o(n.next(c));
17
17
  } catch (g) {
18
18
  i(g);
19
19
  }
20
- }, s = (c) => {
20
+ }, e = (c) => {
21
21
  try {
22
- r(n.throw(c));
22
+ o(n.throw(c));
23
23
  } catch (g) {
24
24
  i(g);
25
25
  }
26
- }, r = (c) => c.done ? o(c.value) : Promise.resolve(c.value).then(e, s);
27
- r((n = n.apply(d, t)).next());
26
+ }, o = (c) => c.done ? r(c.value) : Promise.resolve(c.value).then(s, e);
27
+ o((n = n.apply(d, t)).next());
28
28
  });
29
29
  import { ChatMessageRole as I } from "@glodon-aiot/apis";
30
30
  import q from "./Logger.mjs";
31
- import { configuration as v } from "./Config.mjs";
31
+ import { configuration as f } from "./Config.mjs";
32
32
  import { io as x } from "socket.io-client";
33
33
  import { UserMode as w } from "./PayloadTypes.mjs";
34
34
  import L, { SessionErrors as y } from "./Session.mjs";
35
- const u = new q("[AgentSession] ");
35
+ const p = new q("[AgentSession] ");
36
36
  class D extends L {
37
- constructor(t, n = "", o, i, e, s) {
38
- super(t, n, o, i, e, s);
37
+ constructor(t, n = "", r, i, s, e) {
38
+ super(t, n, r, i, s, e);
39
39
  }
40
40
  prepareConnection() {
41
- return new Promise((t) => p(this, null, function* () {
41
+ return new Promise((t) => v(this, null, function* () {
42
42
  this.socket && t(!0);
43
43
  const n = {
44
44
  version: "1.0",
45
- stream: "false",
45
+ stream: JSON.stringify(f.stream === void 0 ? !0 : f.stream),
46
46
  appId: this._applicationId,
47
47
  sessionId: this.id,
48
48
  Authorization: `${this.token}`,
49
- userMode: v.debug ? w.Debug : w.Normal
50
- }, o = new URL(v.apiRoot), i = yield x(o.origin, {
51
- path: o.pathname.replace("api", "socketio") + "/copilot",
49
+ userMode: f.debug ? w.Debug : w.Normal
50
+ }, r = new URL(f.apiRoot), i = yield x(r.origin, {
51
+ path: r.pathname.replace("api", "socketio") + "/copilot",
52
52
  query: n,
53
53
  transports: ["websocket"]
54
54
  });
55
55
  i.on("connect", () => {
56
- u.log("socket:connect"), this.event.emit("socket:connect"), i.emit("init");
56
+ p.log("socket:connect"), this.event.emit("socket:connect"), i.emit("init");
57
57
  }), i.on("disconnect", () => {
58
- u.log("socket:disconnect"), this.event.emit("socket:disconnect"), this._ready = !1;
59
- }), i.on("ready", (e) => {
60
- if (e.code === 200) {
61
- u.log("ready");
62
- const s = v.debug ? w.Debug : w.Normal;
63
- s === w.Debug && e.userMode, console.log("session ready", e), this._ready = !0, this.event.emit("ready"), this.frozen = !1, this.registerMcpFromClientConfig(), t(!0);
58
+ p.log("socket:disconnect"), this.event.emit("socket:disconnect"), this._ready = !1;
59
+ }), i.on("ready", (s) => {
60
+ if (s.code === 200) {
61
+ p.log("ready");
62
+ const e = f.debug ? w.Debug : w.Normal;
63
+ e === w.Debug && s.userMode, this._ready = !0, this.event.emit("ready"), this.frozen = !1, this.registerMcpFromClientConfig(), t(!0);
64
64
  } else {
65
65
  this._ready && (this._ready = !1);
66
- const s = new Error(
66
+ const e = new Error(
67
67
  y.SocketConnectionFailed
68
68
  // , {
69
69
  // cause: data,
70
70
  // }
71
71
  );
72
- u.error("error", s), this.event.emit("error", s), t(!1);
72
+ p.error("error", e), this.event.emit("error", e), t(!1);
73
73
  }
74
- }), i.on("action", (e, s) => p(this, null, function* () {
74
+ }), i.on("action", (s, e) => v(this, null, function* () {
75
75
  if (this._stopAnswer || !this.id)
76
76
  return;
77
77
  const {
78
- type: r,
78
+ type: o,
79
79
  data: {
80
80
  runnerIsClient: c,
81
81
  pluginCode: g,
@@ -83,14 +83,14 @@ class D extends L {
83
83
  parameters: a,
84
84
  requestBody: N
85
85
  }
86
- } = e, f = this.messages[this.messages.length - 1];
87
- if (!f.messageId)
88
- f.actions || (f.actions = []), f.actions[e.data.step - 1] || (f.actions[e.data.step - 1] = []), f.actions[e.data.step - 1].push(e), this.event.emit("message:action", {
89
- messageId: f.messageId,
90
- action: e
91
- }), this.event.emit("message:updated", f);
86
+ } = s, l = this.messages[this.messages.length - 1];
87
+ if (!l.messageId)
88
+ l.actions || (l.actions = []), l.actions[s.data.step - 1] || (l.actions[s.data.step - 1] = []), l.actions[s.data.step - 1].push(s), this.event.emit("message:action", {
89
+ messageId: l.messageId,
90
+ action: s
91
+ }), this.event.emit("message:updated", l);
92
92
  else {
93
- const l = {
93
+ const u = {
94
94
  messageId: "",
95
95
  content: "",
96
96
  role: I.Robot,
@@ -99,18 +99,18 @@ class D extends L {
99
99
  searchReference: [],
100
100
  isLoading: !0,
101
101
  messageTime: "",
102
- actions: [[e]],
102
+ actions: [[s]],
103
103
  comment: {
104
104
  isAgree: 0
105
105
  }
106
106
  };
107
- this.pushMessage(l), this.event.emit("message:action", {
108
- messageId: l.messageId,
109
- action: e
107
+ this.pushMessage(u), this.event.emit("message:action", {
108
+ messageId: u.messageId,
109
+ action: s
110
110
  });
111
111
  }
112
112
  if (this.inactivating) {
113
- const l = new Error(
113
+ const u = new Error(
114
114
  y.Inactive
115
115
  // {
116
116
  // cause: {
@@ -120,18 +120,18 @@ class D extends L {
120
120
  // },
121
121
  // }
122
122
  );
123
- u.warn("error", l), this.event.emit("error", l);
124
- } else if (r === "FUNCTION_CALL" && c) {
125
- if (u.log(`calling function ${m} of plugin ${g} with argument:
126
- ${JSON.stringify(a)}`), !v.plugins[g]) {
127
- s({
123
+ p.warn("error", u), this.event.emit("error", u);
124
+ } else if (o === "FUNCTION_CALL" && c) {
125
+ if (p.log(`calling function ${m} of plugin ${g} with argument:
126
+ ${JSON.stringify(a)}`), !f.plugins[g]) {
127
+ e({
128
128
  code: 404,
129
129
  message: "对不起,没有找到插件。"
130
130
  });
131
131
  return;
132
132
  }
133
- const l = v.plugins[g][m];
134
- typeof l != "function" && s({
133
+ const u = f.plugins[g][m];
134
+ typeof u != "function" && e({
135
135
  code: 404,
136
136
  message: "对不起,没有找到插件方法。"
137
137
  });
@@ -140,18 +140,18 @@ class D extends L {
140
140
  M = JSON.parse(a == null ? void 0 : a.query);
141
141
  } catch (C) {
142
142
  }
143
- l(M, (...C) => {
144
- this._stopAnswer || s(...C);
143
+ u(M, (...C) => {
144
+ this._stopAnswer || e(...C);
145
145
  });
146
146
  }
147
- })), i.on("answer", (e) => {
147
+ })), i.on("answer", (s) => {
148
148
  if (!this._stopAnswer)
149
- if (e.data.code !== 200 && (e.data.index = -1, this.event.emit("error", e.data)), e.data.index === -1) {
150
- let s = this.messages[this.messages.length - 1];
151
- if (s && !s.messageId)
152
- s = h(h({}, s), e.data), this.event.emit("message:content", s), this.event.emit("message:updated", s), this.event.emit("answer:finish", s);
149
+ if (s.data.code !== 200 && (s.data.index = -1, this.event.emit("error", s.data)), s.data.index === -1) {
150
+ let e = this.messages[this.messages.length - 1];
151
+ if (e && !e.messageId)
152
+ e = h(h({}, e), s.data), this.event.emit("message:content", e), this.event.emit("message:updated", e), this.event.emit("answer:finish", e);
153
153
  else {
154
- const r = h({
154
+ const o = h({
155
155
  messageId: "",
156
156
  content: "",
157
157
  role: I.Robot,
@@ -164,14 +164,14 @@ class D extends L {
164
164
  comment: {
165
165
  isAgree: 0
166
166
  }
167
- }, e.data);
168
- this.event.emit("message:content", r), this.pushMessage(r), this.event.emit("answer:finish", r);
167
+ }, s.data);
168
+ this.event.emit("message:content", o), this.pushMessage(o), this.event.emit("answer:finish", o);
169
169
  }
170
170
  } else {
171
- let s = this.messages[this.messages.length - 1];
172
- s && !s.messageId ? (s = h(h({}, s), e.data), this.messages[this.messages.length - 1] = s, this.event.emit("message:content", s), this.event.emit("message:updated", s)) : (this.pushMessage(e.data), this.event.emit("message:content", e.data));
171
+ let e = this.messages[this.messages.length - 1];
172
+ e && !e.messageId ? (e = h(h({}, e), s.data), this.messages[this.messages.length - 1] = e, this.event.emit("message:content", e), this.event.emit("message:updated", e)) : (this.pushMessage(s.data), this.event.emit("message:content", s.data));
173
173
  }
174
- }), i.on("reference", (e) => p(this, null, function* () {
174
+ }), i.on("reference", (s) => v(this, null, function* () {
175
175
  if (this._stopAnswer)
176
176
  return;
177
177
  if (!this.id) {
@@ -181,14 +181,14 @@ class D extends L {
181
181
  // cause: SESSION_ERROR_CAUSE[SessionErrors.IdUndefined],
182
182
  // }
183
183
  );
184
- u.error(a), this.event.emit("error", a), this.frozen = !1;
184
+ p.error(a), this.event.emit("error", a), this.frozen = !1;
185
185
  return;
186
186
  }
187
187
  const {
188
- type: s,
189
- data: r,
188
+ type: e,
189
+ data: o,
190
190
  requestId: c
191
- } = e, g = this.messages.findIndex((a) => a.messageId === c && a.role === I.User);
191
+ } = s, g = this.messages.findIndex((a) => a.messageId === c && a.role === I.User);
192
192
  if (g < 0)
193
193
  return;
194
194
  const m = g + 1;
@@ -209,70 +209,70 @@ class D extends L {
209
209
  };
210
210
  this.pushMessage(a);
211
211
  }
212
- s === "KG" ? (this.messages[m] = k(h({}, this.messages[m]), {
213
- reference: r.knowledgeReference
214
- }), yield this.fillMessageReference(this.messages[m]), this.event.emit("message:reference", r.knowledgeReference), this.event.emit("message:updated", this.messages[m])) : s === "WEB_SEARCH" && (this.messages[m] = k(h({}, this.messages[m]), {
215
- searchReference: r.knowledgeReference
216
- }), this.event.emit("message:searchreference", r.searchReference), this.event.emit("message:updated", this.messages[m]));
212
+ e === "KG" ? (this.messages[m] = k(h({}, this.messages[m]), {
213
+ reference: o.knowledgeReference
214
+ }), yield this.fillMessageReference(this.messages[m]), this.event.emit("message:reference", o.knowledgeReference), this.event.emit("message:updated", this.messages[m])) : e === "WEB_SEARCH" && (this.messages[m] = k(h({}, this.messages[m]), {
215
+ searchReference: o.knowledgeReference
216
+ }), this.event.emit("message:searchreference", o.searchReference), this.event.emit("message:updated", this.messages[m]));
217
217
  })), this.socket = i, i.open();
218
218
  }));
219
219
  }
220
220
  registerMcpFromClientConfig() {
221
- return v.mcp ? new Promise((t, n) => {
221
+ return f.mcp ? new Promise((t, n) => {
222
222
  if (!this.socket) {
223
223
  n("socket is undefined");
224
224
  return;
225
225
  }
226
- this.socket.emit("add_mcp_servers", v.mcp, (o) => {
227
- o.code === 200 ? (Object.keys(o.data).forEach((i) => {
228
- o.data[i].code !== 200 && console.error(i, "MCP Server 注册失败。", o.data[i]);
229
- }), t(!0)) : (console.error("MCP Server 注册失败。", o), n(o));
226
+ this.socket.emit("add_mcp_servers", f.mcp, (r) => {
227
+ r.code === 200 ? (Object.keys(r.data).forEach((i) => {
228
+ r.data[i].code !== 200 && console.error(i, "MCP Server 注册失败。", r.data[i]);
229
+ }), t(!0)) : (console.error("MCP Server 注册失败。", r), n(r));
230
230
  });
231
231
  }) : Promise.resolve(!0);
232
232
  }
233
233
  addMcpServers(t) {
234
- return p(this, null, function* () {
235
- return this.ready ? this.socket ? new Promise((n, o) => {
234
+ return v(this, null, function* () {
235
+ return this.ready ? this.socket ? new Promise((n, r) => {
236
236
  this.socket && this.socket.emit("add_mcp_servers", t, (i) => {
237
- i.code === 200 ? (Object.keys(i.data).forEach((e) => {
238
- i.data[e].code !== 200 && console.error(e, "MCP Server 注册失败。", i.data[e]);
239
- }), n(!0)) : (console.error("MCP Server 注册失败。", i), o(i));
237
+ i.code === 200 ? (Object.keys(i.data).forEach((s) => {
238
+ i.data[s].code !== 200 && console.error(s, "MCP Server 注册失败。", i.data[s]);
239
+ }), n(!0)) : (console.error("MCP Server 注册失败。", i), r(i));
240
240
  });
241
241
  }) : (console.error(" socket is undefined."), Promise.reject("socket is undefined")) : (console.error("session is not avalible."), Promise.reject("session is not avalible"));
242
242
  });
243
243
  }
244
244
  listMcpServers() {
245
- return p(this, null, function* () {
245
+ return v(this, null, function* () {
246
246
  return this.ready ? this.socket ? new Promise((t, n) => {
247
- this.socket && this.socket.emit("list_mcp_servers", (o) => {
248
- o.code === 200 ? t(o.data) : n(o);
247
+ this.socket && this.socket.emit("list_mcp_servers", (r) => {
248
+ r.code === 200 ? t(r.data) : n(r);
249
249
  });
250
250
  }) : (console.error(" socket is undefined."), Promise.reject("socket is undefined")) : (console.error("session is not avalible."), Promise.reject("session is not avalible"));
251
251
  });
252
252
  }
253
253
  sendQuestion(t, n) {
254
- return p(this, null, function* () {
255
- var i, e, s;
256
- let o = k(h({}, t), {
257
- promptVariables: this.promptVariables.reduce((r, c) => k(h({}, r), {
254
+ return v(this, null, function* () {
255
+ var i, s, e;
256
+ let r = k(h({}, t), {
257
+ promptVariables: this.promptVariables.reduce((o, c) => k(h({}, o), {
258
258
  [c.key]: c.value
259
259
  }), {}),
260
- knowledges: (i = this.knowledges) == null ? void 0 : i.map((r) => r.id)
260
+ knowledges: (i = this.knowledges) == null ? void 0 : i.map((o) => o.id)
261
261
  });
262
262
  if (!this.active) {
263
263
  if (yield this.activate(), !this.socket) {
264
- const r = new Error(
264
+ const o = new Error(
265
265
  y.SocketConnectionFailed
266
266
  // {
267
267
  // cause: { code: -1, message: 'socket is null' },
268
268
  // }
269
269
  );
270
- return u.warn("error", r), this.event.emit("error", r), !1;
270
+ return p.warn("error", o), this.event.emit("error", o), !1;
271
271
  }
272
- (e = this.socket) == null || e.emit("question", o);
272
+ (s = this.socket) == null || s.emit("question", r);
273
273
  return;
274
274
  }
275
- (s = this.socket) == null || s.emit("question", o);
275
+ (e = this.socket) == null || e.emit("question", r);
276
276
  });
277
277
  }
278
278
  stopAnswer() {
@@ -1,16 +1,16 @@
1
- var S = Object.defineProperty, w = Object.defineProperties;
2
- var k = Object.getOwnPropertyDescriptors;
3
- var v = Object.getOwnPropertySymbols;
4
- var A = Object.prototype.hasOwnProperty, x = Object.prototype.propertyIsEnumerable;
5
- var f = (o, i, e) => i in o ? S(o, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[i] = e, _ = (o, i) => {
1
+ var w = Object.defineProperty, k = Object.defineProperties;
2
+ var A = Object.getOwnPropertyDescriptors;
3
+ var g = Object.getOwnPropertySymbols;
4
+ var x = Object.prototype.hasOwnProperty, I = Object.prototype.propertyIsEnumerable;
5
+ var u = (o, i, e) => i in o ? w(o, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[i] = e, p = (o, i) => {
6
6
  for (var e in i || (i = {}))
7
- A.call(i, e) && f(o, e, i[e]);
8
- if (v)
9
- for (var e of v(i))
10
- x.call(i, e) && f(o, e, i[e]);
7
+ x.call(i, e) && u(o, e, i[e]);
8
+ if (g)
9
+ for (var e of g(i))
10
+ I.call(i, e) && u(o, e, i[e]);
11
11
  return o;
12
- }, u = (o, i) => w(o, k(i));
13
- var p = (o, i, e) => (f(o, typeof i != "symbol" ? i + "" : i, e), e);
12
+ }, f = (o, i) => k(o, A(i));
13
+ var l = (o, i, e) => (u(o, typeof i != "symbol" ? i + "" : i, e), e);
14
14
  var c = (o, i, e) => new Promise((t, s) => {
15
15
  var n = (a) => {
16
16
  try {
@@ -18,43 +18,45 @@ var c = (o, i, e) => new Promise((t, s) => {
18
18
  } catch (h) {
19
19
  s(h);
20
20
  }
21
- }, l = (a) => {
21
+ }, d = (a) => {
22
22
  try {
23
23
  r(e.throw(a));
24
24
  } catch (h) {
25
25
  s(h);
26
26
  }
27
- }, r = (a) => a.done ? t(a.value) : Promise.resolve(a.value).then(n, l);
27
+ }, r = (a) => a.done ? t(a.value) : Promise.resolve(a.value).then(n, d);
28
28
  r((e = e.apply(o, i)).next());
29
29
  });
30
- import { parseJWT as g } from "./utils.mjs";
31
- import I from "./Logger.mjs";
32
- import { getCVForceService as R } from "./api/index.mjs";
33
- import { configure as E, configuration as y } from "./Config.mjs";
34
- import { ApplicationTypes as m } from "@glodon-aiot/apis";
30
+ import { parseJWT as m } from "./utils.mjs";
31
+ import R from "./Logger.mjs";
32
+ import { getCVForceService as E } from "./api/index.mjs";
33
+ import { configure as S, configuration as y } from "./Config.mjs";
34
+ import { ApplicationTypes as v } from "@glodon-aiot/apis";
35
35
  import L from "./AgentSession.mjs";
36
36
  import M from "./DialogSession.mjs";
37
37
  import C from "./EventBus.mjs";
38
- const T = new I("[BotClient] ");
38
+ const T = new R("[BotClient] ");
39
39
  class z {
40
40
  constructor(i, e, t = !0) {
41
- p(this, "event", new C());
42
- p(this, "cvforceApi");
41
+ l(this, "event", new C());
42
+ l(this, "cvforceApi");
43
43
  //从token解析出来的用户信息
44
- p(this, "_applicationId");
45
- p(this, "_application", null);
44
+ l(this, "_applicationId");
45
+ l(this, "_application", null);
46
46
  //session列表,被加载过的session将会被缓存到这个列表中
47
- p(this, "_sessions", []);
47
+ l(this, "_sessions", []);
48
48
  //活跃的session,只支持一个活跃的session
49
- p(this, "_activeSession");
50
- p(this, "_ready", !1);
49
+ l(this, "_activeSession");
50
+ l(this, "_ready", !1);
51
51
  //问题长度
52
- p(this, "_questionContextMaxLength", 4e3);
53
- p(this, "_promptVariables", []);
54
- if (this._token = i, this.lazyload = t, E(e), this._applicationId = g(i).rid || y.applicationId, !this._applicationId)
52
+ l(this, "_questionContextMaxLength", 4e3);
53
+ l(this, "_promptVariables", []);
54
+ if (this._token = i, this.lazyload = t, S(e), this._applicationId = m(i).rid || y.applicationId, !this._applicationId)
55
55
  throw "token is not vaild";
56
- this.cvforceApi = this.getService(), this.loadApplication().then(() => {
57
- this.event.emit("ready");
56
+ this.cvforceApi = this.getService(), this.loadApplication().then((s) => {
57
+ S(f(p({}, e), {
58
+ stream: e.stream === void 0 ? (s == null ? void 0 : s.type) === v.Dialog : e.stream
59
+ })), this.event.emit("ready");
58
60
  });
59
61
  }
60
62
  checkReady() {
@@ -86,8 +88,8 @@ class z {
86
88
  loadApplication() {
87
89
  return c(this, null, function* () {
88
90
  var e, t, s;
89
- this._application = yield this.cvforceApi.getApplicationId(this._applicationId).then((n) => (typeof n.arrange[0].recommendQuestionOpen != "boolean" && (n.arrange[0].recommendQuestionOpen = !0), u(_({}, n), {
90
- arrange: [u(_({}, n.arrange[0]), {
91
+ this._application = yield this.cvforceApi.getApplicationId(this._applicationId).then((n) => (typeof n.arrange[0].recommendQuestionOpen != "boolean" && (n.arrange[0].recommendQuestionOpen = !0), f(p({}, n), {
92
+ arrange: [f(p({}, n.arrange[0]), {
91
93
  recommendQuestionOpen: y.loadRelatedQuesions && n.arrange[0].recommendQuestionOpen
92
94
  })]
93
95
  })));
@@ -96,14 +98,14 @@ class z {
96
98
  });
97
99
  }
98
100
  getService() {
99
- return this.cvforceApi ? this.cvforceApi : R(y.apiRoot, this.token, (i, e) => T.error(e));
101
+ return this.cvforceApi ? this.cvforceApi : E(y.apiRoot, this.token, (i, e) => T.error(e));
100
102
  }
101
103
  get token() {
102
104
  return this._token;
103
105
  }
104
106
  set token(i) {
105
107
  this.checkReady(), this._token = i, this.ready = !1;
106
- const e = g(i).rid;
108
+ const e = m(i).rid;
107
109
  this._applicationId !== e && (this._applicationId = e, this._application = null, this.loadApplication().then(() => {
108
110
  this.event.emit("ready");
109
111
  }), this.clean());
@@ -125,15 +127,15 @@ class z {
125
127
  }
126
128
  createSession(i, e, t, s, n) {
127
129
  return c(this, null, function* () {
128
- const l = this;
130
+ const d = this;
129
131
  return new Promise((r, a) => {
130
- const h = (d) => c(this, null, function* () {
131
- if (d === m.Agent)
132
- r(new L(i, e, t, s, n, l));
133
- else if (d === m.Dialog)
134
- r(new M(i, e, t, s, n, l));
132
+ const h = (_) => c(this, null, function* () {
133
+ if (_ === v.Agent)
134
+ r(new L(i, e, t, s, n, d));
135
+ else if (_ === v.Dialog)
136
+ r(new M(i, e, t, s, n, d));
135
137
  else
136
- throw Error(`不支持的应用类型:${d}`);
138
+ throw Error(`不支持的应用类型:${_}`);
137
139
  });
138
140
  if (this.ready) {
139
141
  if (!this._application)
@@ -152,16 +154,16 @@ class z {
152
154
  return c(this, null, function* () {
153
155
  return new Promise((e, t) => {
154
156
  const s = () => this.cvforceApi.listSessions(this._applicationId, i).then((n) => {
155
- const l = [];
157
+ const d = [];
156
158
  return n.forEach((r) => c(this, null, function* () {
157
159
  const a = this._sessions.find((h) => r.id === h.id);
158
160
  if (a)
159
- a.data = r, this._application ? a.application = this._application : a.loadApplicationInfo(), l.push(a);
161
+ a.data = r, this._application ? a.application = this._application : a.loadApplicationInfo(), d.push(a);
160
162
  else {
161
163
  const h = yield this.createSession(this.token, r.id, r, this.lazyload, this._application || void 0);
162
- l.push(h);
164
+ d.push(h);
163
165
  }
164
- })), this.sessions = l, l;
166
+ })), this.sessions = d, d;
165
167
  });
166
168
  if (this.ready) {
167
169
  if (!this._application)
@@ -1,15 +1,15 @@
1
- var v = Object.defineProperty, s = Object.defineProperties;
1
+ var s = Object.defineProperty, v = Object.defineProperties;
2
2
  var u = Object.getOwnPropertyDescriptors;
3
3
  var n = Object.getOwnPropertySymbols;
4
4
  var p = Object.prototype.hasOwnProperty, h = Object.prototype.propertyIsEnumerable;
5
- var g = (o, t, e) => t in o ? v(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e, i = (o, t) => {
5
+ var g = (o, t, e) => t in o ? s(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e, i = (o, t) => {
6
6
  for (var e in t || (t = {}))
7
7
  p.call(t, e) && g(o, e, t[e]);
8
8
  if (n)
9
9
  for (var e of n(t))
10
10
  h.call(t, e) && g(o, e, t[e]);
11
11
  return o;
12
- }, l = (o, t) => s(o, u(t));
12
+ }, l = (o, t) => v(o, u(t));
13
13
  import d from "./Logger.mjs";
14
14
  const R = new d("[Config] ");
15
15
  var f = /* @__PURE__ */ ((o) => (o.dev = "https://aiot-dev.glodon.com/api/cvforcepd", o.test = "https://aiot-dev.glodon.com/api/cvforce", o.prod = "https://copilot.glodon.com/api/cvforce", o.local = "http://localhost:3000/api/cvforcepd", o))(f || {});
@@ -22,9 +22,10 @@ let c = {
22
22
  applicationId: "",
23
23
  plugins: {},
24
24
  mcp: void 0,
25
- loadRelatedQuesions: !0
25
+ loadRelatedQuesions: !0,
26
+ stream: !1
26
27
  };
27
- function x(o) {
28
+ function w(o) {
28
29
  d.debug = (o == null ? void 0 : o.debug) || !1, c = l(i(i({}, c), o), {
29
30
  apiRoot: (o == null ? void 0 : o.apiRoot) || c.apiRoot || (o != null && o.env ? f[o.env || "prod"] : c.apiRoot)
30
31
  }), d.debug && R.log("updated", c);
@@ -32,5 +33,5 @@ function x(o) {
32
33
  export {
33
34
  f as ApiUrl,
34
35
  c as configuration,
35
- x as configure
36
+ w as configure
36
37
  };