@glodon-aiot/bot-client-sdk 3.26.0-alpha.29 → 3.26.0-alpha.30

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,37 +1,37 @@
1
- var B = Object.defineProperty, L = Object.defineProperties;
2
- var M = Object.getOwnPropertyDescriptors;
1
+ var _ = Object.defineProperty, j = Object.defineProperties;
2
+ var B = Object.getOwnPropertyDescriptors;
3
3
  var x = Object.getOwnPropertySymbols;
4
- var U = Object.prototype.hasOwnProperty, T = Object.prototype.propertyIsEnumerable;
5
- var b = (n, t, e) => t in n ? B(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e, m = (n, t) => {
4
+ var L = Object.prototype.hasOwnProperty, M = Object.prototype.propertyIsEnumerable;
5
+ var v = (i, t, e) => t in i ? _(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e, k = (i, t) => {
6
6
  for (var e in t || (t = {}))
7
- U.call(t, e) && b(n, e, t[e]);
7
+ L.call(t, e) && v(i, e, t[e]);
8
8
  if (x)
9
9
  for (var e of x(t))
10
- T.call(t, e) && b(n, e, t[e]);
11
- return n;
12
- }, N = (n, t) => L(n, M(t));
13
- var y = (n, t, e) => (b(n, typeof t != "symbol" ? t + "" : t, e), e);
14
- var u = (n, t, e) => new Promise((r, s) => {
15
- var o = (a) => {
10
+ M.call(t, e) && v(i, e, t[e]);
11
+ return i;
12
+ }, N = (i, t) => j(i, B(t));
13
+ var y = (i, t, e) => (v(i, typeof t != "symbol" ? t + "" : t, e), e);
14
+ var d = (i, t, e) => new Promise((r, s) => {
15
+ var o = (l) => {
16
16
  try {
17
- l(e.next(a));
18
- } catch (h) {
19
- s(h);
17
+ a(e.next(l));
18
+ } catch (u) {
19
+ s(u);
20
20
  }
21
- }, i = (a) => {
21
+ }, n = (l) => {
22
22
  try {
23
- l(e.throw(a));
24
- } catch (h) {
25
- s(h);
23
+ a(e.throw(l));
24
+ } catch (u) {
25
+ s(u);
26
26
  }
27
- }, l = (a) => a.done ? r(a.value) : Promise.resolve(a.value).then(o, i);
28
- l((e = e.apply(n, t)).next());
27
+ }, a = (l) => l.done ? r(l.value) : Promise.resolve(l.value).then(o, n);
28
+ a((e = e.apply(i, t)).next());
29
29
  });
30
30
  import { MAX_COMMAND_OUTPUT_CHARS as w } from "../../builtinTools/command.mjs";
31
31
  import { domError as f } from "../adapters/WorkspaceFileAdapter.mjs";
32
- import { SANDBOX_PROTOCOL as A, SANDBOX_MAX_FILE_BYTES as F } from "./protocol.mjs";
33
- import { decodeBinaryFrame as v, MAX_BINARY_PAYLOAD as C, encodeBinaryFrame as O } from "./sandboxFrames.mjs";
34
- const P = {
32
+ import { SANDBOX_PROTOCOL as A, SANDBOX_MAX_FILE_BYTES as U } from "./protocol.mjs";
33
+ import { decodeBinaryFrame as S, MAX_BINARY_PAYLOAD as T, encodeBinaryFrame as F } from "./sandboxFrames.mjs";
34
+ const C = {
35
35
  revision: 0,
36
36
  network: {
37
37
  mode: "off",
@@ -43,13 +43,13 @@ const P = {
43
43
  }
44
44
  }
45
45
  };
46
- function _(n) {
47
- var r, s, o, i, l, a, h;
48
- if (!n || typeof n != "object")
46
+ function O(i) {
47
+ var r, s, o, n, a, l, u;
48
+ if (!i || typeof i != "object")
49
49
  return;
50
- const t = n, e = (r = t.network) == null ? void 0 : r.mode;
50
+ const t = i, e = (r = t.network) == null ? void 0 : r.mode;
51
51
  if (!(e !== "off" && e !== "allowlist" && e !== "open"))
52
- return m({
52
+ return k({
53
53
  revision: typeof t.revision == "number" ? t.revision : 0,
54
54
  network: {
55
55
  mode: e,
@@ -57,36 +57,36 @@ function _(n) {
57
57
  },
58
58
  packages: {
59
59
  python: {
60
- enabled: ((i = (o = t.packages) == null ? void 0 : o.python) == null ? void 0 : i.enabled) !== !1
60
+ enabled: ((n = (o = t.packages) == null ? void 0 : o.python) == null ? void 0 : n.enabled) !== !1
61
61
  }
62
62
  }
63
- }, Number.isInteger((l = t.exec) == null ? void 0 : l.maxConcurrent) && ((a = t.exec) == null ? void 0 : a.maxConcurrent) >= 1 ? {
63
+ }, Number.isInteger((a = t.exec) == null ? void 0 : a.maxConcurrent) && ((l = t.exec) == null ? void 0 : l.maxConcurrent) >= 1 ? {
64
64
  exec: {
65
- maxConcurrent: (h = t.exec) == null ? void 0 : h.maxConcurrent
65
+ maxConcurrent: (u = t.exec) == null ? void 0 : u.maxConcurrent
66
66
  }
67
67
  } : {});
68
68
  }
69
- function $(n) {
70
- const t = n == null ? void 0 : n.denied;
69
+ function $(i) {
70
+ const t = i == null ? void 0 : i.denied;
71
71
  return Array.isArray(t) ? t.filter((e) => typeof e == "string") : [];
72
72
  }
73
- function D(n, t) {
73
+ function D(i, t) {
74
74
  if (!t.length)
75
- return n;
75
+ return i;
76
76
  const e = `宿主网络策略拒绝了:${t.join("、")}。不要重试这些地址;需要时请用户在宿主设置里允许。`;
77
- return n ? `${n}
77
+ return i ? `${i}
78
78
  ${e}` : e;
79
79
  }
80
- const k = "沙箱已退出。";
81
- function E(n) {
82
- if (n instanceof Uint8Array)
83
- return n;
84
- if (n instanceof ArrayBuffer)
85
- return new Uint8Array(n);
80
+ const m = "沙箱已退出。";
81
+ function E(i) {
82
+ if (i instanceof Uint8Array)
83
+ return i;
84
+ if (i instanceof ArrayBuffer)
85
+ return new Uint8Array(i);
86
86
  }
87
- function j(n, t, e, r) {
88
- const s = n.length > w ? n.slice(n.length - w) : n;
89
- if (!t && !e && !r && n.length <= w)
87
+ function P(i, t, e, r) {
88
+ const s = i.length > w ? i.slice(i.length - w) : i;
89
+ if (!t && !e && !r && i.length <= w)
90
90
  return s;
91
91
  let o = `
92
92
  …输出已截断`;
@@ -96,7 +96,7 @@ class J {
96
96
  constructor(t = (e) => new WebSocket(e)) {
97
97
  y(this, "notice");
98
98
  /** 沙箱最近一次告知的网络策略。 */
99
- y(this, "policy", P);
99
+ y(this, "policy", C);
100
100
  y(this, "socket");
101
101
  y(this, "generation", 0);
102
102
  y(this, "authed", !1);
@@ -111,7 +111,7 @@ class J {
111
111
  }
112
112
  unavailableMessage() {
113
113
  var t, e, r, s;
114
- return ((t = this.notice) == null ? void 0 : t.state) === "starting" ? "沙箱正在启动。" : (e = this.notice) != null && e.message ? this.notice.message : ((r = this.notice) == null ? void 0 : r.state) === "exited" || ((s = this.notice) == null ? void 0 : s.state) === "failed" ? k : "沙箱没有就绪。";
114
+ return ((t = this.notice) == null ? void 0 : t.state) === "starting" ? "沙箱正在启动。" : (e = this.notice) != null && e.message ? this.notice.message : ((r = this.notice) == null ? void 0 : r.state) === "exited" || ((s = this.notice) == null ? void 0 : s.state) === "failed" ? m : "沙箱没有就绪。";
115
115
  }
116
116
  apply(t) {
117
117
  const e = this.notice;
@@ -119,7 +119,7 @@ class J {
119
119
  this.failAll(f("NotAllowedError", this.unavailableMessage())), this.stop();
120
120
  return;
121
121
  }
122
- (e == null ? void 0 : e.url) === t.url && e.token === t.token && this.socket && this.socket.readyState <= 1 || (this.failAll(f("AbortError", k)), this.stop(), this.connect(t.url, t.token));
122
+ (e == null ? void 0 : e.url) === t.url && e.token === t.token && this.socket && this.socket.readyState <= 1 || (this.failAll(f("AbortError", m)), this.stop(), this.connect(t.url, t.token));
123
123
  }
124
124
  /** `ws://127.0.0.1:port` 的主机和端口,文件地址拼在它前面。 */
125
125
  httpOrigin() {
@@ -128,7 +128,7 @@ class J {
128
128
  return t != null && t.startsWith("ws://") ? t.slice(5).replace(/\/$/, "") : "";
129
129
  }
130
130
  stat(t) {
131
- return u(this, null, function* () {
131
+ return d(this, null, function* () {
132
132
  return this.invoke({
133
133
  op: "stat",
134
134
  path: t
@@ -136,7 +136,7 @@ class J {
136
136
  });
137
137
  }
138
138
  url(t) {
139
- return u(this, null, function* () {
139
+ return d(this, null, function* () {
140
140
  const r = (yield this.invoke({
141
141
  op: "url",
142
142
  path: t
@@ -147,7 +147,7 @@ class J {
147
147
  });
148
148
  }
149
149
  releaseUrl(t) {
150
- return u(this, null, function* () {
150
+ return d(this, null, function* () {
151
151
  yield this.invoke({
152
152
  op: "releaseUrl",
153
153
  ticket: t
@@ -155,7 +155,7 @@ class J {
155
155
  });
156
156
  }
157
157
  list(t, e) {
158
- return u(this, null, function* () {
158
+ return d(this, null, function* () {
159
159
  return this.invoke({
160
160
  op: "list",
161
161
  path: t
@@ -163,58 +163,44 @@ class J {
163
163
  });
164
164
  }
165
165
  read(o) {
166
- return u(this, arguments, function* (t, e = 0, r = F, s) {
167
- const i = this.begin({
166
+ return d(this, arguments, function* (t, e = 0, r = U, s) {
167
+ const n = this.begin({
168
168
  op: "read",
169
169
  path: t,
170
170
  offset: e,
171
171
  maxBytes: r
172
- }, s), l = [];
173
- let a;
174
- for (; !a; ) {
175
- const d = yield this.next(i), g = E(d);
176
- if (g) {
177
- l.push(v(g).payload);
172
+ }, s), a = [];
173
+ let l;
174
+ for (; !l; ) {
175
+ const h = yield this.next(n), p = E(h);
176
+ if (p) {
177
+ a.push(S(p).payload);
178
178
  continue;
179
179
  }
180
- a = d;
180
+ l = h;
181
181
  }
182
- if (this.calls.delete(i), a.ok === !1)
183
- throw f(String(a.name || "NotAllowedError"), String(a.message || "读取失败。"));
184
- const h = l.reduce((d, g) => d + g.length, 0), c = new Uint8Array(h);
185
- let p = 0;
186
- return l.forEach((d) => {
187
- c.set(d, p), p += d.length;
182
+ if (this.calls.delete(n), l.ok === !1)
183
+ throw f(String(l.name || "NotAllowedError"), String(l.message || "读取失败。"));
184
+ const u = a.reduce((h, p) => h + p.length, 0), c = new Uint8Array(u);
185
+ let g = 0;
186
+ return a.forEach((h) => {
187
+ c.set(h, g), g += h.length;
188
188
  }), c;
189
189
  });
190
190
  }
191
191
  write(t, e, r, s) {
192
- return u(this, null, function* () {
192
+ return d(this, null, function* () {
193
193
  const o = this.begin({
194
194
  op: "write",
195
195
  path: t,
196
196
  size: e.length,
197
197
  createDirectories: r
198
198
  }, s);
199
- let i = 0;
200
- for (; i < e.length; ) {
201
- const a = e.subarray(i, i + C), h = i + a.length;
202
- this.send(O(o, i, h === e.length, a)), i = h;
203
- const p = yield this.next(o);
204
- if (p.ok === !1)
205
- throw this.calls.delete(o), f(String(p.name || "NotAllowedError"), String(p.message || "写入失败。"));
206
- if (p.op !== "ack" && p.ok === !0) {
207
- this.calls.delete(o);
208
- return;
209
- }
210
- }
211
- const l = yield this.next(o);
212
- if (this.calls.delete(o), l.ok === !1)
213
- throw f(String(l.name || "NotAllowedError"), String(l.message || "写入失败。"));
199
+ yield this.upload(o, e, "写入失败。");
214
200
  });
215
201
  }
216
202
  skillStatus(t, e) {
217
- return u(this, null, function* () {
203
+ return d(this, null, function* () {
218
204
  const r = yield this.invoke({
219
205
  op: "skillStatus",
220
206
  applicationId: t
@@ -223,83 +209,69 @@ class J {
223
209
  });
224
210
  }
225
211
  skillRead(t, e, r, s, o) {
226
- return u(this, null, function* () {
227
- const i = this.begin({
212
+ return d(this, null, function* () {
213
+ const n = this.begin({
228
214
  op: "skillRead",
229
215
  applicationId: t,
230
216
  skillId: e,
231
217
  version: r,
232
218
  path: s
233
- }, o), l = [];
234
- let a;
235
- for (; !a; ) {
236
- const d = yield this.next(i), g = E(d);
237
- if (g) {
238
- l.push(v(g).payload);
219
+ }, o), a = [];
220
+ let l;
221
+ for (; !l; ) {
222
+ const h = yield this.next(n), p = E(h);
223
+ if (p) {
224
+ a.push(S(p).payload);
239
225
  continue;
240
226
  }
241
- a = d;
227
+ l = h;
242
228
  }
243
- if (this.calls.delete(i), a.ok === !1)
244
- throw f(String(a.name || "NotAllowedError"), String(a.message || "读取失败。"));
245
- const h = l.reduce((d, g) => d + g.length, 0), c = new Uint8Array(h);
246
- let p = 0;
247
- return l.forEach((d) => {
248
- c.set(d, p), p += d.length;
229
+ if (this.calls.delete(n), l.ok === !1)
230
+ throw f(String(l.name || "NotAllowedError"), String(l.message || "读取失败。"));
231
+ const u = a.reduce((h, p) => h + p.length, 0), c = new Uint8Array(u);
232
+ let g = 0;
233
+ return a.forEach((h) => {
234
+ c.set(h, g), g += h.length;
249
235
  }), c;
250
236
  });
251
237
  }
252
238
  skillList(t, e, r, s, o) {
253
- return u(this, null, function* () {
254
- const i = yield this.invoke({
239
+ return d(this, null, function* () {
240
+ const n = yield this.invoke({
255
241
  op: "skillList",
256
242
  applicationId: t,
257
243
  skillId: e,
258
244
  version: r,
259
245
  path: s
260
246
  }, o);
261
- return typeof i.files == "string" ? i.files : "";
247
+ return typeof n.files == "string" ? n.files : "";
262
248
  });
263
249
  }
264
- skillGrep(t, e, r, s, o, i) {
265
- return u(this, null, function* () {
266
- const l = yield this.invoke({
250
+ skillGrep(t, e, r, s, o, n) {
251
+ return d(this, null, function* () {
252
+ const a = yield this.invoke({
267
253
  op: "skillGrep",
268
254
  applicationId: t,
269
255
  skillId: e,
270
256
  version: r,
271
257
  path: s,
272
258
  pattern: o
273
- }, i);
274
- return typeof l.matches == "string" ? l.matches : "";
259
+ }, n);
260
+ return typeof a.matches == "string" ? a.matches : "";
275
261
  });
276
262
  }
277
263
  installSkill(t, e, r) {
278
- return u(this, null, function* () {
279
- const s = this.begin(N(m({
264
+ return d(this, null, function* () {
265
+ const s = this.begin(N(k({
280
266
  op: "installSkill"
281
267
  }, t), {
282
268
  size: e.length
283
269
  }), r);
284
- let o = 0;
285
- for (; o < e.length; ) {
286
- const l = e.subarray(o, o + C), a = o + l.length;
287
- this.send(O(s, o, a === e.length, l)), o = a;
288
- const h = yield this.next(s);
289
- if (h.ok === !1)
290
- throw this.calls.delete(s), f(String(h.name || "NotAllowedError"), String(h.message || "安装失败。"));
291
- if (h.op !== "ack" && h.ok === !0) {
292
- this.calls.delete(s);
293
- return;
294
- }
295
- }
296
- const i = yield this.next(s);
297
- if (this.calls.delete(s), i.ok === !1)
298
- throw f(String(i.name || "NotAllowedError"), String(i.message || "安装失败。"));
270
+ yield this.upload(s, e, "安装失败。");
299
271
  });
300
272
  }
301
273
  skillPrune(t, e, r, s) {
302
- return u(this, null, function* () {
274
+ return d(this, null, function* () {
303
275
  yield this.invoke({
304
276
  op: "skillPrune",
305
277
  applicationId: t,
@@ -309,7 +281,7 @@ class J {
309
281
  });
310
282
  }
311
283
  mkdir(t) {
312
- return u(this, null, function* () {
284
+ return d(this, null, function* () {
313
285
  yield this.invoke({
314
286
  op: "mkdir",
315
287
  path: t
@@ -317,7 +289,7 @@ class J {
317
289
  });
318
290
  }
319
291
  remove(t, e) {
320
- return u(this, null, function* () {
292
+ return d(this, null, function* () {
321
293
  yield this.invoke({
322
294
  op: "remove",
323
295
  path: t,
@@ -326,7 +298,7 @@ class J {
326
298
  });
327
299
  }
328
300
  move(t, e) {
329
- return u(this, null, function* () {
301
+ return d(this, null, function* () {
330
302
  yield this.invoke({
331
303
  op: "move",
332
304
  from: t,
@@ -335,37 +307,31 @@ class J {
335
307
  });
336
308
  }
337
309
  exec(t, e, r) {
338
- return u(this, null, function* () {
339
- var h;
340
- const s = this.begin(m({}, t), e, () => {
341
- this.send({
342
- protocol: A,
343
- id: s,
344
- op: "cancel"
345
- });
346
- });
347
- let o = "", i = "", l = !1, a = !1;
310
+ return d(this, null, function* () {
311
+ var u;
312
+ const s = this.begin(k({}, t), e);
313
+ let o = "", n = "", a = !1, l = !1;
348
314
  for (; this.calls.has(s); ) {
349
315
  const c = yield this.next(s);
350
316
  if (c.op === "stdout" || c.op === "stderr") {
351
- const S = String((h = c.text) != null ? h : "");
352
- r == null || r(c.op, S), c.op === "stdout" ? (o += S, o.length > w && (l = !0), o = o.slice(-w)) : (i += S, i.length > w && (a = !0), i = i.slice(-w));
317
+ const b = String((u = c.text) != null ? u : "");
318
+ r == null || r(c.op, b), c.op === "stdout" ? (o += b, o.length > w && (a = !0), o = o.slice(-w)) : (n += b, n.length > w && (l = !0), n = n.slice(-w));
353
319
  continue;
354
320
  }
355
321
  if (this.calls.delete(s), c.ok === !1)
356
322
  throw f(String(c.name || "NotAllowedError"), String(c.message || "命令失败。"));
357
- const p = typeof c.logPath == "string" ? c.logPath : void 0, d = c.logTruncated === !0, g = $(c.network);
358
- return m({
323
+ const g = typeof c.logPath == "string" ? c.logPath : void 0, h = c.logTruncated === !0, p = $(c.network);
324
+ return k({
359
325
  exitCode: typeof c.exitCode == "number" ? c.exitCode : 1,
360
326
  timedOut: c.timedOut === !0,
361
- stdout: j(o, l, p, d),
362
- stderr: D(j(i, a, p, d), g),
327
+ stdout: P(o, a, g, h),
328
+ stderr: D(P(n, l, g, h), p),
363
329
  cwd: typeof c.cwd == "string" ? c.cwd : void 0
364
- }, g.length ? {
365
- denied: g
330
+ }, p.length ? {
331
+ denied: p
366
332
  } : {});
367
333
  }
368
- throw f("AbortError", k);
334
+ throw f("AbortError", m);
369
335
  });
370
336
  }
371
337
  invoke(t, e) {
@@ -378,42 +344,69 @@ class J {
378
344
  return o;
379
345
  });
380
346
  }
381
- begin(t, e, r) {
347
+ /**
348
+ * 沙箱轮到这次上传时先回 offset 为 0 的 ack,之后每个 ack 再发下一片。
349
+ * 排队期间不发数据,沙箱不用替排队的请求存分片。
350
+ */
351
+ upload(t, e, r) {
352
+ return d(this, null, function* () {
353
+ let s = 0;
354
+ for (; ; ) {
355
+ const o = yield this.next(t);
356
+ if (o.ok === !1)
357
+ throw this.calls.delete(t), f(String(o.name || "NotAllowedError"), String(o.message || r));
358
+ if (o.ok === !0) {
359
+ this.calls.delete(t);
360
+ return;
361
+ }
362
+ if (o.op !== "ack" || s >= e.length)
363
+ continue;
364
+ const n = e.subarray(s, s + T), a = s + n.length;
365
+ this.send(F(t, s, a === e.length, n)), s = a;
366
+ }
367
+ });
368
+ }
369
+ /** 取消时通知沙箱:命令会被结束,还在排队的文件请求会被移出队列。 */
370
+ begin(t, e) {
382
371
  if (!this.ready)
383
372
  throw f("NotAllowedError", this.unavailableMessage());
384
373
  if (e != null && e.aborted)
385
374
  throw f("AbortError");
386
- const s = `sbx-${++this.seq}`;
387
- let o = () => {
375
+ const r = `sbx-${++this.seq}`;
376
+ let s = () => {
388
377
  };
389
- const i = {
378
+ const o = {
390
379
  messages: [],
391
380
  waiters: [],
392
- reject: (a) => o(a)
381
+ reject: (a) => s(a)
393
382
  };
394
- this.calls.set(s, i);
395
- const l = () => {
396
- r == null || r(), i.reject(f("AbortError"));
383
+ this.calls.set(r, o);
384
+ const n = () => {
385
+ this.send({
386
+ protocol: A,
387
+ id: r,
388
+ op: "cancel"
389
+ }), o.reject(f("AbortError"));
397
390
  };
398
- return e == null || e.addEventListener("abort", l, {
391
+ return e == null || e.addEventListener("abort", n, {
399
392
  once: !0
400
- }), o = (a) => {
401
- e == null || e.removeEventListener("abort", l), this.calls.delete(s);
402
- const h = i.waiters.shift();
403
- h && h(Promise.reject(a));
404
- }, this.send(m({
393
+ }), s = (a) => {
394
+ e == null || e.removeEventListener("abort", n), this.calls.delete(r);
395
+ const l = o.waiters.shift();
396
+ l && l(Promise.reject(a));
397
+ }, this.send(k({
405
398
  protocol: A,
406
- id: s
407
- }, t)), s;
399
+ id: r
400
+ }, t)), r;
408
401
  }
409
402
  next(t) {
410
403
  const e = this.calls.get(t);
411
404
  if (!e)
412
- return Promise.reject(f("AbortError", k));
405
+ return Promise.reject(f("AbortError", m));
413
406
  const r = e.messages.shift();
414
407
  return r !== void 0 ? Promise.resolve(r) : new Promise((s, o) => {
415
- e.waiters.push(s), e.reject = (i) => {
416
- this.calls.delete(t), o(i);
408
+ e.waiters.push(s), e.reject = (n) => {
409
+ this.calls.delete(t), o(n);
417
410
  };
418
411
  });
419
412
  }
@@ -437,7 +430,7 @@ class J {
437
430
  }, s.onmessage = (o) => {
438
431
  r === this.generation && this.onFrame(o.data);
439
432
  }, s.onclose = () => {
440
- r === this.generation && (this.authed = !1, this.failAll(f("AbortError", k)));
433
+ r === this.generation && (this.authed = !1, this.failAll(f("AbortError", m)));
441
434
  }, s.onerror = () => {
442
435
  };
443
436
  }
@@ -445,30 +438,30 @@ class J {
445
438
  var s, o;
446
439
  const e = E(t);
447
440
  if (e) {
448
- const i = v(e);
449
- this.push(i.id, e);
441
+ const n = S(e);
442
+ this.push(n.id, e);
450
443
  return;
451
444
  }
452
445
  let r;
453
446
  try {
454
447
  r = JSON.parse(String(t));
455
- } catch (i) {
448
+ } catch (n) {
456
449
  return;
457
450
  }
458
451
  if (r.op === "policy" && r.id === void 0) {
459
- this.policy = (s = _(r.policy)) != null ? s : this.policy;
452
+ this.policy = (s = O(r.policy)) != null ? s : this.policy;
460
453
  return;
461
454
  }
462
455
  if (r.op === "auth") {
463
456
  if (r.ok === !0) {
464
- this.policy = (o = _(r.policy)) != null ? o : P, this.authed = !0;
465
- const i = this.outgoing;
466
- this.outgoing = [], i.forEach((l) => l());
457
+ this.policy = (o = O(r.policy)) != null ? o : C, this.authed = !0;
458
+ const n = this.outgoing;
459
+ this.outgoing = [], n.forEach((a) => a());
467
460
  }
468
461
  return;
469
462
  }
470
463
  if (r.op === "bye") {
471
- this.failAll(f("AbortError", k)), this.stop();
464
+ this.failAll(f("AbortError", m)), this.stop();
472
465
  return;
473
466
  }
474
467
  typeof r.id == "string" && this.push(r.id, r);
@@ -496,6 +489,6 @@ class J {
496
489
  }
497
490
  }
498
491
  export {
499
- P as OFFLINE_POLICY,
492
+ C as OFFLINE_POLICY,
500
493
  J as SandboxClient
501
494
  };
@@ -1,4 +1,4 @@
1
- const e = "@glodon-aiot/bot-client-sdk", s = "3.26.0-alpha.29", t = "glodoncv", i = "aiot bot client js sdk", n = "module", g = !1, o = [
1
+ const e = "@glodon-aiot/bot-client-sdk", s = "3.26.0-alpha.30", t = "glodoncv", i = "aiot bot client js sdk", n = "module", g = !1, o = [
2
2
  "aiot",
3
3
  "bot",
4
4
  "bot client",
@@ -68,7 +68,7 @@ const e = "@glodon-aiot/bot-client-sdk", s = "3.26.0-alpha.29", t = "glodoncv",
68
68
  access: "public",
69
69
  registry: "https://registry.npmjs.org/"
70
70
  }, y = {
71
- "@glodon-aiot/apis": "^3.26.0-alpha.29",
71
+ "@glodon-aiot/apis": "^3.26.0-alpha.30",
72
72
  axios: "0.24.0",
73
73
  buffer: "^6.0.3",
74
74
  dayjs: "^1.11.13",