@glodon-aiot/bot-client-sdk 3.26.0-alpha.33 → 3.26.0-alpha.34

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.
@@ -9,7 +9,7 @@ var E = (e, t, r) => t in e ? J(e, t, { enumerable: !0, configurable: !0, writab
9
9
  for (var r of G(t))
10
10
  Q.call(t, r) && E(e, r, t[r]);
11
11
  return e;
12
- }, f = (e, t) => B(e, K(t));
12
+ }, h = (e, t) => B(e, K(t));
13
13
  var _ = (e, t, r) => (E(e, typeof t != "symbol" ? t + "" : t, r), r);
14
14
  var F = (e, t, r) => new Promise((d, s) => {
15
15
  var o = (a) => {
@@ -28,26 +28,27 @@ var F = (e, t, r) => new Promise((d, s) => {
28
28
  i((r = r.apply(e, t)).next());
29
29
  });
30
30
  import { v4 as U } from "uuid";
31
- import { LOCAL_FILES_FUNCTION_CODES as V, TRANSFER_FUNCTION_CODES as X, SEARCH_FUNCTION_CODES as Y, WORKSPACE_GRANT_ID as Z } from "./constants.mjs";
32
- import { cancelledError as g, workspaceNotGranted as $, ToolError as h, ToolCode as m, toToolError as k } from "./errors.mjs";
33
- import { LOCAL_FILE_TOOL_SCHEMAS as ee } from "./schemas.mjs";
34
- import { assertGrantId as te } from "./security/pathPolicy.mjs";
35
- import { listDirectory as re, readFile as ie, statFile as ae, searchFiles as oe, searchText as ne } from "./tools/readTools.mjs";
36
- import { uploadFile as se, downloadFile as le } from "./tools/transferTools.mjs";
37
- import { applyPatch as de, writeFile as ce } from "./tools/writeTools.mjs";
38
- import { validateToolInput as ue } from "./validate.mjs";
39
- const me = {
40
- list_directory: re,
41
- read_file: ie,
42
- stat_file: ae,
43
- search_files: oe,
44
- search_text: ne,
45
- apply_patch: de,
46
- write_file: ce,
47
- upload_file: se,
48
- download_file: le
31
+ import V from "../Logger.mjs";
32
+ import { LOCAL_FILES_FUNCTION_CODES as X, TRANSFER_FUNCTION_CODES as Y, SEARCH_FUNCTION_CODES as Z, WORKSPACE_GRANT_ID as $ } from "./constants.mjs";
33
+ import { cancelledError as g, workspaceNotGranted as k, ToolError as f, ToolCode as m, toToolError as ee } from "./errors.mjs";
34
+ import { LOCAL_FILE_TOOL_SCHEMAS as te } from "./schemas.mjs";
35
+ import { assertGrantId as re } from "./security/pathPolicy.mjs";
36
+ import { listDirectory as ie, readFile as ae, statFile as oe, searchFiles as ne, searchText as se } from "./tools/readTools.mjs";
37
+ import { uploadFile as le, downloadFile as de } from "./tools/transferTools.mjs";
38
+ import { applyPatch as ce, writeFile as ue } from "./tools/writeTools.mjs";
39
+ import { validateToolInput as me } from "./validate.mjs";
40
+ const fe = new V("[LocalFiles] "), he = {
41
+ list_directory: ie,
42
+ read_file: ae,
43
+ stat_file: oe,
44
+ search_files: ne,
45
+ search_text: se,
46
+ apply_patch: ce,
47
+ write_file: ue,
48
+ upload_file: le,
49
+ download_file: de
49
50
  };
50
- class he {
51
+ class ge {
51
52
  constructor(t, r) {
52
53
  _(this, "remaining");
53
54
  _(this, "startedAt", 0);
@@ -66,23 +67,23 @@ class he {
66
67
  this.pause(), this.remaining = 0;
67
68
  }
68
69
  }
69
- function fe(e, t) {
70
- return X.includes(t) ? e.limits.transferTimeoutMs : Y.includes(t) ? e.limits.searchTimeoutMs : e.limits.toolTimeoutMs;
70
+ function pe(e, t) {
71
+ return Y.includes(t) ? e.limits.transferTimeoutMs : Z.includes(t) ? e.limits.searchTimeoutMs : e.limits.toolTimeoutMs;
71
72
  }
72
- function ge(e) {
73
+ function ve(e) {
73
74
  if (typeof e != "string")
74
75
  return e;
75
76
  try {
76
77
  return JSON.parse(e);
77
78
  } catch (t) {
78
- throw new h(m.BadRequest, "参数不是合法的 JSON 对象。");
79
+ throw new f(m.BadRequest, "参数不是合法的 JSON 对象。");
79
80
  }
80
81
  }
81
- function pe(e) {
82
+ function Ie(e) {
82
83
  if (!e || typeof e != "object" || Array.isArray(e))
83
84
  return;
84
85
  const t = e;
85
- return (t.grantId === void 0 || t.grantId === null || t.grantId === "") && (t.grantId = Z), t.grantId;
86
+ return (t.grantId === void 0 || t.grantId === null || t.grantId === "") && (t.grantId = $), t.grantId;
86
87
  }
87
88
  function W(e) {
88
89
  return new Promise((t, r) => {
@@ -91,7 +92,7 @@ function W(e) {
91
92
  });
92
93
  });
93
94
  }
94
- function ve(e) {
95
+ function be(e) {
95
96
  return u({
96
97
  code: e.code,
97
98
  message: e.message
@@ -99,7 +100,7 @@ function ve(e) {
99
100
  data: e.data
100
101
  } : {});
101
102
  }
102
- function Ie(e, t, r, d, s) {
103
+ function Te(e, t, r, d, s) {
103
104
  return F(this, null, function* () {
104
105
  var N, S, q, P, C, D, R, x;
105
106
  const o = {
@@ -115,7 +116,7 @@ function Ie(e, t, r, d, s) {
115
116
  functionCode: t
116
117
  }, i = new AbortController();
117
118
  let a = !1;
118
- const c = new he(fe(e, t), () => {
119
+ const c = new ge(pe(e, t), () => {
119
120
  a = !0, i.abort();
120
121
  }), v = () => i.abort();
121
122
  (N = o.signal) == null || N.addEventListener("abort", v, {
@@ -123,16 +124,16 @@ function Ie(e, t, r, d, s) {
123
124
  }), (S = o.signal) != null && S.aborted && i.abort();
124
125
  let p = null, I, L = !1;
125
126
  try {
126
- const b = ge(r), l = pe(b);
127
- l != null && te(l);
128
- const w = ue(b, ee[t].parameters), M = (q = w.path) != null ? q : w.destPath;
127
+ const b = ve(r), l = Ie(b);
128
+ l != null && re(l);
129
+ const w = me(b, te[t].parameters), M = (q = w.path) != null ? q : w.destPath;
129
130
  if (typeof M == "string" && (n.path = M), yield e.ready, i.signal.aborted)
130
131
  throw g();
131
132
  const y = e.adapter;
132
133
  if (!y)
133
- throw $();
134
+ throw k();
134
135
  if (p = e.acquireSlot(), !p)
135
- throw new h(m.TooManyRequests, "同时进行的文件操作过多,请稍后重试。");
136
+ throw new f(m.TooManyRequests, "同时进行的文件操作过多,请稍后重试。");
136
137
  I = e.track(i), L = !0, e.emit("tool:start", u({}, n)), c.resume();
137
138
  const H = {
138
139
  adapter: y,
@@ -143,11 +144,11 @@ function Ie(e, t, r, d, s) {
143
144
  allowWorkspaceWideTextSearch: e.allowWorkspaceWideTextSearch,
144
145
  transfer: e.transfer,
145
146
  fetch: e.fetch,
146
- context: f(u({}, o), {
147
+ context: h(u({}, o), {
147
148
  signal: i.signal
148
149
  }),
149
150
  signal: i.signal,
150
- requestApproval: (O, j) => be(e, {
151
+ requestApproval: (O, j) => _e(e, {
151
152
  approvalPath: O,
152
153
  preview: j,
153
154
  context: o,
@@ -157,32 +158,32 @@ function Ie(e, t, r, d, s) {
157
158
  base: n
158
159
  }),
159
160
  progress: (O) => e.emit("tool:progress", u(u({}, n), O))
160
- }, T = yield Promise.race([me[t](w, H), W(i.signal)]), A = {
161
+ }, T = yield Promise.race([he[t](w, H), W(i.signal)]), A = {
161
162
  code: m.Ok,
162
163
  message: "ok",
163
164
  data: T.data
164
165
  };
165
- T.truncated && (A.truncated = !0), (C = T.warnings) != null && C.length && (A.warnings = T.warnings), e.emit("tool:finish", f(u({}, n), {
166
+ T.truncated && (A.truncated = !0), (C = T.warnings) != null && C.length && (A.warnings = T.warnings), e.emit("tool:finish", h(u({}, n), {
166
167
  code: m.Ok
167
168
  })), d(A);
168
169
  } catch (b) {
169
- let l = k(b);
170
- a ? l = new h(m.Timeout, "操作超时,已中止。") : i.signal.aborted && l.code !== m.Cancelled && (l = g()), ((D = l.data) == null ? void 0 : D.reason) === "workspace_not_granted" && L && e.handlePermissionLost(), l.code === m.Cancelled ? e.emit("tool:cancelled", u({}, n)) : e.emit("tool:error", f(u({}, n), {
170
+ let l = ee(b);
171
+ a ? l = new f(m.Timeout, "操作超时,已中止。") : i.signal.aborted && l.code !== m.Cancelled && (l = g()), ((D = l.data) == null ? void 0 : D.reason) === "workspace_not_granted" && L && e.handlePermissionLost(), l.code === m.Cancelled ? e.emit("tool:cancelled", u({}, n)) : e.emit("tool:error", h(u({}, n), {
171
172
  code: l.code,
172
173
  message: l.message,
173
174
  reason: (R = l.data) == null ? void 0 : R.reason
174
- })), d(ve(l));
175
+ })), d(be(l));
175
176
  } finally {
176
177
  c.clear(), (x = o.signal) == null || x.removeEventListener("abort", v), p == null || p(), I == null || I();
177
178
  }
178
179
  });
179
180
  }
180
- function be(e, t) {
181
+ function _e(e, t) {
181
182
  return F(this, null, function* () {
182
183
  var i;
183
184
  const r = e.getApprovalHandler();
184
185
  if (!r)
185
- throw new h(m.Forbidden, "当前环境未提供操作确认能力,无法执行写入或传输操作。", {
186
+ throw new f(m.Forbidden, "当前环境未提供操作确认能力,无法执行写入或传输操作。", {
186
187
  reason: "approval_unavailable"
187
188
  });
188
189
  if (t.signal.aborted)
@@ -201,7 +202,7 @@ function be(e, t) {
201
202
  preview: t.preview,
202
203
  signal: d.signal
203
204
  };
204
- t.timer.pause(), e.emit("tool:approval-required", f(u({}, t.base), {
205
+ t.timer.pause(), e.emit("tool:approval-required", h(u({}, t.base), {
205
206
  path: t.approvalPath,
206
207
  approvalId: o.id
207
208
  }));
@@ -213,11 +214,11 @@ function be(e, t) {
213
214
  if (t.signal.aborted)
214
215
  throw g();
215
216
  if (a !== !0)
216
- throw new h(m.Forbidden, "用户拒绝了本次操作。", {
217
+ throw new f(m.Forbidden, "用户拒绝了本次操作。", {
217
218
  reason: "user_rejected"
218
219
  });
219
220
  } catch (a) {
220
- throw a instanceof h ? a : new h(m.Forbidden, "操作确认失败,已取消本次操作。", {
221
+ throw a instanceof f ? a : new f(m.Forbidden, "操作确认失败,已取消本次操作。", {
221
222
  reason: "user_rejected"
222
223
  });
223
224
  } finally {
@@ -225,24 +226,24 @@ function be(e, t) {
225
226
  }
226
227
  });
227
228
  }
228
- function Se({
229
+ function Ce({
229
230
  pluginCode: e,
230
231
  workspace: t
231
232
  }) {
232
233
  const r = {};
233
- return V.forEach((d) => {
234
+ return X.forEach((d) => {
234
235
  r[d] = (s, o, n) => {
235
236
  let i = !1;
236
- Ie(t, d, s, (c) => {
237
+ Te(t, d, s, (c) => {
237
238
  if (!i) {
238
239
  i = !0;
239
240
  try {
240
241
  o(c);
241
242
  } catch (v) {
242
- console.error("[LocalFiles] callback failed", v);
243
+ fe.report("callback failed", v);
243
244
  }
244
245
  }
245
- }, f(u({}, n), {
246
+ }, h(u({}, n), {
246
247
  pluginCode: e
247
248
  }));
248
249
  };
@@ -251,5 +252,5 @@ function Se({
251
252
  };
252
253
  }
253
254
  export {
254
- Se as createLocalFilesPlugin
255
+ Ce as createLocalFilesPlugin
255
256
  };
@@ -1,6 +1,7 @@
1
+ import l from "../../Logger.mjs";
1
2
  import { HostBridgeAdapter as f } from "../adapters/HostBridgeAdapter.mjs";
2
- import { getHostBridge as g, HOST_CHANNEL as l, parseHostMessage as y } from "./protocol.mjs";
3
- function m(o) {
3
+ import { getHostBridge as y, HOST_CHANNEL as m, parseHostMessage as c } from "./protocol.mjs";
4
+ function u(o) {
4
5
  if (!o || typeof o != "object")
5
6
  return;
6
7
  const e = o;
@@ -15,39 +16,43 @@ function m(o) {
15
16
  reason: typeof e.reason == "string" ? e.reason : void 0
16
17
  };
17
18
  }
19
+ const d = new l("[HostBridge] ");
18
20
  let s;
19
- function v(o) {
21
+ function h(o) {
20
22
  s == null || s(), s = void 0;
21
- const e = g();
23
+ const e = y();
22
24
  if (!e)
23
- return () => {
25
+ return d.log("missing"), () => {
24
26
  };
25
- const i = new f(e), d = (p) => {
26
- const t = y(p.data);
27
+ const i = new f(e), p = (g) => {
28
+ const t = c(g.data);
27
29
  if (t) {
28
30
  if (t.type === "workspace") {
29
- const n = t.granted === !0, r = typeof t.displayName == "string" ? t.displayName : "";
31
+ const r = t.granted === !0, n = typeof t.displayName == "string" ? t.displayName : "";
30
32
  i.setCapabilities(t.capabilities, {
31
33
  version: t.sandboxVersion
32
- }), i.applySandbox(m(t.sandbox)), n ? (i.displayName = r || "工程目录", (o.status !== "granted" || o.displayName !== i.displayName) && o.attachAdapter(i, i.displayName)) : o.status === "granted" && o.clear();
34
+ }), i.applySandbox(u(t.sandbox)), d.log("workspace", {
35
+ granted: r,
36
+ displayName: n
37
+ }), r ? (i.displayName = n || "工程目录", (o.status !== "granted" || o.displayName !== i.displayName) && o.attachAdapter(i, i.displayName)) : o.status === "granted" && o.clear();
33
38
  return;
34
39
  }
35
40
  if (t.type === "fs-changed") {
36
- const n = Array.isArray(t.paths) ? t.paths.filter((r) => typeof r == "string") : [];
37
- o.notifyFilesChanged(n);
41
+ const r = Array.isArray(t.paths) ? t.paths.filter((n) => typeof n == "string") : [];
42
+ o.notifyFilesChanged(r);
38
43
  return;
39
44
  }
40
45
  }
41
46
  };
42
- e.addEventListener("message", d), e.postMessage({
43
- channel: l,
47
+ e.addEventListener("message", p), d.log("hello"), e.postMessage({
48
+ channel: m,
44
49
  type: "hello"
45
50
  });
46
51
  const a = () => {
47
- e.removeEventListener("message", d), s === a && (s = void 0);
52
+ e.removeEventListener("message", p), s === a && (s = void 0);
48
53
  };
49
54
  return s = a, a;
50
55
  }
51
56
  export {
52
- v as connectHostBridge
57
+ h as connectHostBridge
53
58
  };
@@ -1,15 +1,15 @@
1
- var P = Object.defineProperty, S = Object.defineProperties;
2
- var b = Object.getOwnPropertyDescriptors;
1
+ var S = Object.defineProperty, b = Object.defineProperties;
2
+ var H = Object.getOwnPropertyDescriptors;
3
3
  var k = Object.getOwnPropertySymbols;
4
- var H = Object.prototype.hasOwnProperty, R = Object.prototype.propertyIsEnumerable;
5
- var p = (r, e, t) => e in r ? P(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, u = (r, e) => {
4
+ var R = Object.prototype.hasOwnProperty, T = Object.prototype.propertyIsEnumerable;
5
+ var p = (r, e, t) => e in r ? S(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, u = (r, e) => {
6
6
  for (var t in e || (e = {}))
7
- H.call(e, t) && p(r, t, e[t]);
7
+ R.call(e, t) && p(r, t, e[t]);
8
8
  if (k)
9
9
  for (var t of k(e))
10
- R.call(e, t) && p(r, t, e[t]);
10
+ T.call(e, t) && p(r, t, e[t]);
11
11
  return r;
12
- }, C = (r, e) => S(r, b(e));
12
+ }, C = (r, e) => b(r, H(e));
13
13
  var s = (r, e, t) => (p(r, typeof e != "symbol" ? e + "" : e, t), t);
14
14
  var d = (r, e, t) => new Promise((i, n) => {
15
15
  var a = (o) => {
@@ -27,23 +27,24 @@ var d = (r, e, t) => new Promise((i, n) => {
27
27
  }, l = (o) => o.done ? i(o.value) : Promise.resolve(o.value).then(a, h);
28
28
  l((t = t.apply(r, e)).next());
29
29
  });
30
- import T from "../../EventBus.mjs";
30
+ import F from "../../Logger.mjs";
31
+ import D from "../../EventBus.mjs";
31
32
  import { FileSystemAccessAdapter as _ } from "../adapters/FileSystemAccessAdapter.mjs";
32
- import { HostBridgeAdapter as F } from "../adapters/HostBridgeAdapter.mjs";
33
- import { FileSnapshotAdapter as D } from "../adapters/FileSnapshotAdapter.mjs";
34
- import { getNativeDirectoryPicker as W } from "../adapters/fsaTypes.mjs";
35
- import { LOCAL_FILES_FUNCTION_CODES as L } from "../constants.mjs";
33
+ import { HostBridgeAdapter as W } from "../adapters/HostBridgeAdapter.mjs";
34
+ import { FileSnapshotAdapter as L } from "../adapters/FileSnapshotAdapter.mjs";
35
+ import { getNativeDirectoryPicker as E } from "../adapters/fsaTypes.mjs";
36
+ import { LOCAL_FILES_FUNCTION_CODES as I } from "../constants.mjs";
36
37
  import { getDownloadUrlAllowlist as N } from "../security/downloadUrlPolicy.mjs";
37
- import { SensitiveFilePolicy as E } from "../security/sensitiveFiles.mjs";
38
- import { resolveLimits as I } from "../limits.mjs";
39
- import { createDefaultSessionFileTransfer as q } from "../transfer/SessionFileTransfer.mjs";
40
- import { createMemoryStore as U } from "./handleStore.mjs";
41
- import { watchDirectoryHandle as j } from "./watchDirectory.mjs";
42
- import { WorkspaceFiles as x } from "./WorkspaceFiles.mjs";
38
+ import { SensitiveFilePolicy as q } from "../security/sensitiveFiles.mjs";
39
+ import { resolveLimits as U } from "../limits.mjs";
40
+ import { createDefaultSessionFileTransfer as j } from "../transfer/SessionFileTransfer.mjs";
41
+ import { createMemoryStore as x } from "./handleStore.mjs";
42
+ import { watchDirectoryHandle as K } from "./watchDirectory.mjs";
43
+ import { WorkspaceFiles as V } from "./WorkspaceFiles.mjs";
43
44
  const m = {
44
45
  mode: "readwrite"
45
46
  };
46
- function K(r) {
47
+ function M(r) {
47
48
  const e = r.replace(/\\/g, "/").trim().replace(/^\.\/+/, "").replace(/\/+$/, "");
48
49
  if (!e || e === ".")
49
50
  return "";
@@ -53,10 +54,11 @@ function K(r) {
53
54
  if (!t.some((i) => !i || i === "." || i === ".."))
54
55
  return t.join("/");
55
56
  }
56
- function V(r) {
57
+ function O(r) {
57
58
  return !!r && typeof r == "object" && r.name === "AbortError";
58
59
  }
59
- class se {
60
+ const P = new F("[LocalWorkspace] ");
61
+ class ne {
60
62
  constructor(e) {
61
63
  s(this, "applicationId");
62
64
  s(this, "limits");
@@ -73,7 +75,7 @@ class se {
73
75
  s(this, "files");
74
76
  s(this, "store");
75
77
  s(this, "picker");
76
- s(this, "event", new T(!0));
78
+ s(this, "event", new D(!0));
77
79
  s(this, "_status");
78
80
  s(this, "_displayName");
79
81
  s(this, "_adapter", null);
@@ -92,8 +94,8 @@ class se {
92
94
  s(this, "epoch", 0);
93
95
  var h, l, o, c, f, g, v, y, w, A;
94
96
  const t = (h = e.config) != null ? h : {};
95
- this.applicationId = e.applicationId, this.store = (l = e.store) != null ? l : U(), this.picker = e.picker === null ? void 0 : (o = e.picker) != null ? o : W(), this.limits = I(t.limits), this.sensitive = new E(t.sensitiveRulesAppend), this.downloadUrlAllowlist = N(t.downloadUrlAllowlistAppend), this.allowWorkspaceWideTextSearch = !!t.allowWorkspaceWideTextSearch, this.approvalHandler = t.onApprovalRequired;
96
- const i = (c = e.transfer) != null ? c : q(() => {
97
+ this.applicationId = e.applicationId, this.store = (l = e.store) != null ? l : x(), this.picker = e.picker === null ? void 0 : (o = e.picker) != null ? o : E(), this.limits = U(t.limits), this.sensitive = new q(t.sensitiveRulesAppend), this.downloadUrlAllowlist = N(t.downloadUrlAllowlistAppend), this.allowWorkspaceWideTextSearch = !!t.allowWorkspaceWideTextSearch, this.approvalHandler = t.onApprovalRequired;
98
+ const i = (c = e.transfer) != null ? c : j(() => {
97
99
  });
98
100
  this.transfer = {
99
101
  upload: (g = (f = t.transfer) == null ? void 0 : f.upload) != null ? g : i.upload,
@@ -106,7 +108,7 @@ class se {
106
108
  enabled: (a == null ? void 0 : a.enabled) !== !1,
107
109
  bashModuleURL: a == null ? void 0 : a.bashModuleURL,
108
110
  pyodideIndexURL: a == null ? void 0 : a.pyodideIndexURL
109
- }, this._status = this.picker ? "none" : "unsupported", this.files = new x(this);
111
+ }, this._status = this.picker ? "none" : "unsupported", this.files = new V(this);
110
112
  }
111
113
  // -------------------------------------------------------------------------
112
114
  // 状态
@@ -139,7 +141,10 @@ class se {
139
141
  return `disclosure:${this.applicationId}`;
140
142
  }
141
143
  setStatus(e, t = this._displayName) {
142
- e === this._status && t === this._displayName || (this._status = e, this._displayName = t, this.emit("workspace:changed", {
144
+ e === this._status && t === this._displayName || (this._status = e, this._displayName = t, P.log("status", {
145
+ status: e,
146
+ displayName: t
147
+ }), this.emit("workspace:changed", {
143
148
  status: e,
144
149
  displayName: t
145
150
  }));
@@ -148,7 +153,7 @@ class se {
148
153
  this._adapter !== e && this.files.releaseAllUrls(), this._adapter = e;
149
154
  }
150
155
  attachHandle(e) {
151
- this.cancelFilesChanged(), this.pendingHandle = e, this.replaceAdapter(new _(e)), this.setStatus("granted", e.name), this.unwatchDirectory(), this.stopWatching = j(e, (t) => this.notifyFilesChanged(t));
156
+ this.cancelFilesChanged(), this.pendingHandle = e, this.replaceAdapter(new _(e)), this.setStatus("granted", e.name), this.unwatchDirectory(), this.stopWatching = K(e, (t) => this.notifyFilesChanged(t));
152
157
  }
153
158
  // -------------------------------------------------------------------------
154
159
  // 授权
@@ -174,7 +179,7 @@ class se {
174
179
  savedAt: Date.now()
175
180
  }).catch(() => {
176
181
  }), !0), (t) => {
177
- if (V(t))
182
+ if (O(t))
178
183
  return !1;
179
184
  throw t;
180
185
  });
@@ -263,7 +268,7 @@ class se {
263
268
  lastModified: c.lastModified,
264
269
  blob: c
265
270
  }));
266
- this.attachAdapter(new D(a, n), n);
271
+ this.attachAdapter(new L(a, n), n);
267
272
  }
268
273
  /** 直接挂载一个 Adapter(测试或自定义后端),视为已授权。 */
269
274
  attachAdapter(e, t = e.displayName) {
@@ -279,7 +284,7 @@ class se {
279
284
  this.refreshAllVisible = !0;
280
285
  else
281
286
  for (const t of e) {
282
- const i = K(t);
287
+ const i = M(t);
283
288
  i === void 0 ? this.refreshAllVisible = !0 : this.pendingChangePaths.add(i);
284
289
  }
285
290
  clearTimeout(this.changeTimer), this.changeTimer = setTimeout(() => this.flushFilesChanged(), 150);
@@ -351,7 +356,7 @@ class se {
351
356
  * 浏览器运行时一次只放一条。
352
357
  */
353
358
  acquireCommand() {
354
- if (this._adapter instanceof F)
359
+ if (this._adapter instanceof W)
355
360
  return () => {
356
361
  };
357
362
  if (this.activeCommands >= 1)
@@ -372,7 +377,7 @@ class se {
372
377
  this.inflight.clear(), e.forEach((t) => t.abort());
373
378
  }
374
379
  handshake() {
375
- const e = Object.fromEntries(L.map((t) => [t, !0]));
380
+ const e = Object.fromEntries(I.map((t) => [t, !0]));
376
381
  return {
377
382
  protocolVersion: "1.0",
378
383
  capabilities: C(u({}, e), {
@@ -411,10 +416,10 @@ class se {
411
416
  try {
412
417
  this.event.emit(e, t);
413
418
  } catch (i) {
414
- console.error(`[LocalWorkspace] ${e} listener failed`, i);
419
+ P.report(`${e} listener failed`, i);
415
420
  }
416
421
  }
417
422
  }
418
423
  export {
419
- se as LocalWorkspace
424
+ ne as LocalWorkspace
420
425
  };
@@ -30,7 +30,7 @@ import H from "../Logger.mjs";
30
30
  import { retainMcpSessions as A, listMcpTools as O, dropUnusedMcpSession as I, callMcpTool as U } from "./client.mjs";
31
31
  import { currentLocalMcpEndpoints as b } from "./endpoints.mjs";
32
32
  import { replaceLocalMcpTools as E, localMcpBindings as D, localMcpBinding as R } from "./registry.mjs";
33
- const m = new H("[LocalMcp] ", !0);
33
+ const m = new H("[LocalMcp] ");
34
34
  function Z(e) {
35
35
  const o = e == null ? void 0 : e.mcps;
36
36
  return Array.isArray(o) ? o.filter((t) => t && typeof t == "object" && t.runtime === "local" && t.id) : [];
@@ -161,7 +161,7 @@ function ne(e) {
161
161
  tools: S
162
162
  } : (v(), null);
163
163
  } catch (i) {
164
- return v(), m.error("local mcp failed", s, i instanceof Error ? i.message : String(i)), null;
164
+ return v(), m.report("local mcp failed", s, i instanceof Error ? i.message : String(i)), null;
165
165
  }
166
166
  })));
167
167
  if (l()) {
@@ -193,7 +193,7 @@ function ne(e) {
193
193
  mcpServers: u
194
194
  }, (c) => {
195
195
  const s = c && typeof c == "object" ? c.code : void 0;
196
- typeof s == "number" && s !== 200 && m.error("register_client_mcp_tools", s);
196
+ typeof s == "number" && s !== 200 && m.report("register_client_mcp_tools", s);
197
197
  });
198
198
  });
199
199
  }
@@ -1,11 +1,11 @@
1
- const e = "@glodon-aiot/bot-client-sdk", s = "3.26.0-alpha.33", t = "glodoncv", i = "aiot bot client js sdk", n = "module", g = !1, o = [
1
+ const s = "@glodon-aiot/bot-client-sdk", t = "3.26.0-alpha.34", e = "glodoncv", i = "aiot bot client js sdk", n = "module", y = !1, d = [
2
2
  "aiot",
3
3
  "bot",
4
4
  "bot client",
5
5
  "sdk"
6
- ], d = [
6
+ ], o = [
7
7
  "dist"
8
- ], p = "./dist/es/index.mjs", l = "./dist/lib/index.js", c = "./dist/src/index.d.ts", r = {
8
+ ], c = "./dist/es/index.mjs", l = "./dist/lib/index.js", p = "./dist/src/index.d.ts", r = {
9
9
  ".": {
10
10
  import: "./dist/es/index.mjs",
11
11
  require: "./dist/lib/index.js",
@@ -13,16 +13,12 @@ const e = "@glodon-aiot/bot-client-sdk", s = "3.26.0-alpha.33", t = "glodoncv",
13
13
  }
14
14
  }, a = "MIT", u = {
15
15
  watch: "yarn build --watch",
16
- example: "node ./example/server.js",
17
- dev: "npm-run-all -p watch example",
18
- start: "vite",
19
16
  build: "tsc && vite build --mode prod && yarn build:cdn",
20
17
  "build:npm": "tsc && vite build --mode prod",
21
18
  "build:cdn": "tsc && vite build --mode prod --config ./vite.config.cdn.ts",
22
- preview: "vite preview",
23
19
  check: "yarn prettier --check .",
24
20
  write: "yarn prettier --write .",
25
- lint: "eslint --ext .tsx,.ts --fix ./example -c .eslintrc.js",
21
+ lint: "eslint --ext .ts src -c .eslintrc.cjs",
26
22
  "build:just-bash": "node scripts/build-just-bash.mjs",
27
23
  "upload:just-bash": "node scripts/build-just-bash.mjs && node scripts/upload-cdn-libs.cjs just-bash",
28
24
  "build:pyodide": "node scripts/build-pyodide.mjs",
@@ -35,58 +31,40 @@ const e = "@glodon-aiot/bot-client-sdk", s = "3.26.0-alpha.33", t = "glodoncv",
35
31
  "@commitlint/config-conventional": "^17.0.3",
36
32
  "@rollup/plugin-babel": "^6.0.4",
37
33
  "@rollup/plugin-typescript": "^11.1.6",
38
- "@types/express": "^4",
39
- "@types/identity-obj-proxy": "^3",
40
34
  "@typescript-eslint/eslint-plugin": "^5.35.1",
41
35
  "@typescript-eslint/parser": "^5.35.1",
42
- "babel-loader": "^8.3.0",
43
36
  eslint: "^8.0.1",
44
37
  "eslint-config-prettier": "^8.5.0",
45
- "eslint-config-standard-with-typescript": "^22.0.0",
46
- "eslint-plugin-import": "^2.25.2",
47
- "eslint-plugin-n": "^15.0.0",
48
- "eslint-plugin-promise": "^6.0.0",
49
- "eslint-plugin-react": "^7.31.0",
50
- "eslint-plugin-storybook": "^0.6.10",
51
- express: "4",
52
- "http-proxy-middleware": "^3.0.0",
53
- "identity-obj-proxy": "^3.0.0",
54
38
  "just-bash": "3.6.0",
55
- "npm-run-all": "^4.1.5",
56
39
  prettier: "2.7.1",
57
40
  pyodide: "314.0.7",
58
- "rollup-plugin-visualizer": "^6.0.1",
59
- "socket.io": "^4.7.5",
60
- "ts-node": "^10.9.2",
61
41
  typescript: "*",
62
42
  vite: "^4.1.1",
63
43
  "vite-plugin-dts": "^4.3.0",
64
44
  "vite-plugin-externalize-deps": "^0.9.0",
65
- "vite-tsconfig-paths": "^5.1.4",
66
45
  vitest: "^0.34.6"
67
- }, m = {
46
+ }, j = {
68
47
  access: "public",
69
48
  registry: "https://registry.npmjs.org/"
70
- }, y = {
71
- "@glodon-aiot/apis": "^3.26.0-alpha.33",
49
+ }, m = {
50
+ "@glodon-aiot/apis": "^3.26.0-alpha.34",
72
51
  axios: "0.24.0",
73
- buffer: "^6.0.3",
74
52
  dayjs: "^1.11.13",
75
53
  "js-base64": "^3.7.7",
76
54
  "socket.io-client": "^4.7.5",
77
55
  uuid: "^11.1.0"
78
- }, j = {
79
- name: e,
80
- version: s,
81
- author: t,
56
+ }, g = {
57
+ name: s,
58
+ version: t,
59
+ author: e,
82
60
  description: i,
83
61
  type: n,
84
62
  sideEffects: !1,
85
- keywords: o,
86
- files: d,
87
- module: p,
63
+ keywords: d,
64
+ files: o,
65
+ module: c,
88
66
  main: l,
89
- typings: c,
67
+ typings: p,
90
68
  exports: r,
91
69
  license: a,
92
70
  scripts: u,
@@ -94,26 +72,26 @@ const e = "@glodon-aiot/bot-client-sdk", s = "3.26.0-alpha.33", t = "glodoncv",
94
72
  "lint-staged": {
95
73
  "*.{js,css,md,jsx,less,ts,tsx,json}": "prettier --write"
96
74
  },
97
- publishConfig: m,
98
- dependencies: y
75
+ publishConfig: j,
76
+ dependencies: m
99
77
  };
100
78
  export {
101
- t as author,
102
- j as default,
103
- y as dependencies,
79
+ e as author,
80
+ g as default,
81
+ m as dependencies,
104
82
  i as description,
105
83
  b as devDependencies,
106
84
  r as exports,
107
- d as files,
108
- o as keywords,
85
+ o as files,
86
+ d as keywords,
109
87
  a as license,
110
88
  l as main,
111
- p as module,
112
- e as name,
113
- m as publishConfig,
89
+ c as module,
90
+ s as name,
91
+ j as publishConfig,
114
92
  u as scripts,
115
- g as sideEffects,
93
+ y as sideEffects,
116
94
  n as type,
117
- c as typings,
118
- s as version
95
+ p as typings,
96
+ t as version
119
97
  };