@glodon-aiot/bot-client-sdk 3.25.1-alpha.7 → 3.26.0-alpha.5

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.
Files changed (96) hide show
  1. package/README.md +572 -98
  2. package/dist/es/AgentSession.mjs +230 -165
  3. package/dist/es/BotClient.mjs +186 -136
  4. package/dist/es/Config.mjs +89 -26
  5. package/dist/es/Session.mjs +12 -0
  6. package/dist/es/api/index.mjs +42 -33
  7. package/dist/es/builtinTools/browserRuntime/BrowserCommandRunner.mjs +201 -0
  8. package/dist/es/builtinTools/browserRuntime/PythonRunner.mjs +356 -0
  9. package/dist/es/builtinTools/browserRuntime/WorkspaceBashFs.mjs +350 -0
  10. package/dist/es/builtinTools/browserRuntime/assets.mjs +9 -0
  11. package/dist/es/builtinTools/browserRuntime/loadBash.mjs +17 -0
  12. package/dist/es/builtinTools/browserRuntime/pyodideRunner.py.mjs +96 -0
  13. package/dist/es/builtinTools/browserRuntime/pyodideWorker.mjs +242 -0
  14. package/dist/es/builtinTools/command.mjs +56 -0
  15. package/dist/es/builtinTools/constants.mjs +10 -0
  16. package/dist/es/builtinTools/createBuiltinToolsPlugin.mjs +236 -0
  17. package/dist/es/builtinTools/overview.mjs +77 -0
  18. package/dist/es/builtinTools/paths.mjs +63 -0
  19. package/dist/es/builtinTools/schemas.mjs +216 -0
  20. package/dist/es/builtinTools/tools.mjs +471 -0
  21. package/dist/es/index.mjs +69 -9
  22. package/dist/es/localFiles/adapters/FileSystemAccessAdapter.mjs +264 -0
  23. package/dist/es/localFiles/adapters/HostBridgeAdapter.mjs +233 -0
  24. package/dist/es/localFiles/adapters/MemoryWorkspaceAdapter.mjs +197 -0
  25. package/dist/es/localFiles/adapters/WorkspaceFileAdapter.mjs +54 -0
  26. package/dist/es/localFiles/adapters/fsaTypes.mjs +9 -0
  27. package/dist/es/localFiles/constants.mjs +47 -0
  28. package/dist/es/localFiles/createLocalFilesPlugin.mjs +255 -0
  29. package/dist/es/localFiles/errors.mjs +57 -0
  30. package/dist/es/localFiles/host/connectHostBridge.mjs +54 -0
  31. package/dist/es/localFiles/host/protocol.mjs +27 -0
  32. package/dist/es/localFiles/limits.mjs +22 -0
  33. package/dist/es/localFiles/schemas.mjs +312 -0
  34. package/dist/es/localFiles/security/downloadUrlPolicy.mjs +39 -0
  35. package/dist/es/localFiles/security/glob.mjs +28 -0
  36. package/dist/es/localFiles/security/pathPolicy.mjs +59 -0
  37. package/dist/es/localFiles/security/sensitiveFiles.mjs +115 -0
  38. package/dist/es/localFiles/tools/readTools.mjs +333 -0
  39. package/dist/es/localFiles/tools/runtime.mjs +108 -0
  40. package/dist/es/localFiles/tools/transferTools.mjs +228 -0
  41. package/dist/es/localFiles/tools/writeTools.mjs +173 -0
  42. package/dist/es/localFiles/transfer/SessionFileTransfer.mjs +111 -0
  43. package/dist/es/localFiles/validate.mjs +66 -0
  44. package/dist/es/localFiles/workspace/LocalWorkspace.mjs +358 -0
  45. package/dist/es/localFiles/workspace/handleStore.mjs +79 -0
  46. package/dist/es/localFiles/workspace/watchDirectory.mjs +38 -0
  47. package/dist/es/package.json.mjs +38 -29
  48. package/dist/lib/index.js +373 -5
  49. package/dist/src/AgentSession.d.ts +9 -0
  50. package/dist/src/BotClient.d.ts +12 -2
  51. package/dist/src/Config.d.ts +22 -0
  52. package/dist/src/Session.d.ts +5 -1
  53. package/dist/src/api/index.d.ts +3 -1
  54. package/dist/src/builtinTools/browserRuntime/BrowserCommandRunner.d.ts +26 -0
  55. package/dist/src/builtinTools/browserRuntime/PythonRunner.d.ts +67 -0
  56. package/dist/src/builtinTools/browserRuntime/WorkspaceBashFs.d.ts +51 -0
  57. package/dist/src/builtinTools/browserRuntime/assets.d.ts +13 -0
  58. package/dist/src/builtinTools/browserRuntime/loadBash.d.ts +3 -0
  59. package/dist/src/builtinTools/browserRuntime/pyodideWorker.d.ts +44 -0
  60. package/dist/src/builtinTools/command.d.ts +26 -0
  61. package/dist/src/builtinTools/constants.d.ts +17 -0
  62. package/dist/src/builtinTools/createBuiltinToolsPlugin.d.ts +11 -0
  63. package/dist/src/builtinTools/overview.d.ts +5 -0
  64. package/dist/src/builtinTools/paths.d.ts +15 -0
  65. package/dist/src/builtinTools/schemas.d.ts +3 -0
  66. package/dist/src/builtinTools/tools.d.ts +60 -0
  67. package/dist/src/index.d.ts +4 -2
  68. package/dist/src/localFiles/adapters/FileSystemAccessAdapter.d.ts +20 -0
  69. package/dist/src/localFiles/adapters/HostBridgeAdapter.d.ts +43 -0
  70. package/dist/src/localFiles/adapters/MemoryWorkspaceAdapter.d.ts +21 -0
  71. package/dist/src/localFiles/adapters/WorkspaceFileAdapter.d.ts +40 -0
  72. package/dist/src/localFiles/adapters/fsaTypes.d.ts +41 -0
  73. package/dist/src/localFiles/constants.d.ts +51 -0
  74. package/dist/src/localFiles/createLocalFilesPlugin.d.ts +11 -0
  75. package/dist/src/localFiles/createLocalPythonPlugin.d.ts +12 -0
  76. package/dist/src/localFiles/errors.d.ts +34 -0
  77. package/dist/src/localFiles/host/connectHostBridge.d.ts +6 -0
  78. package/dist/src/localFiles/host/protocol.d.ts +46 -0
  79. package/dist/src/localFiles/index.d.ts +22 -0
  80. package/dist/src/localFiles/limits.d.ts +3 -0
  81. package/dist/src/localFiles/schemas.d.ts +29 -0
  82. package/dist/src/localFiles/security/downloadUrlPolicy.d.ts +4 -0
  83. package/dist/src/localFiles/security/glob.d.ts +3 -0
  84. package/dist/src/localFiles/security/pathPolicy.d.ts +14 -0
  85. package/dist/src/localFiles/security/sensitiveFiles.d.ts +23 -0
  86. package/dist/src/localFiles/tools/readTools.d.ts +7 -0
  87. package/dist/src/localFiles/tools/runtime.d.ts +43 -0
  88. package/dist/src/localFiles/tools/transferTools.d.ts +4 -0
  89. package/dist/src/localFiles/tools/writeTools.d.ts +4 -0
  90. package/dist/src/localFiles/transfer/SessionFileTransfer.d.ts +40 -0
  91. package/dist/src/localFiles/types.d.ts +319 -0
  92. package/dist/src/localFiles/validate.d.ts +2 -0
  93. package/dist/src/localFiles/workspace/LocalWorkspace.d.ts +111 -0
  94. package/dist/src/localFiles/workspace/handleStore.d.ts +11 -0
  95. package/dist/src/localFiles/workspace/watchDirectory.d.ts +7 -0
  96. package/package.json +13 -4
@@ -0,0 +1,358 @@
1
+ var S = Object.defineProperty, C = Object.defineProperties;
2
+ var P = Object.getOwnPropertyDescriptors;
3
+ var _ = Object.getOwnPropertySymbols;
4
+ var H = Object.prototype.hasOwnProperty, R = 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, m = (r, e) => {
6
+ for (var t in e || (e = {}))
7
+ H.call(e, t) && p(r, t, e[t]);
8
+ if (_)
9
+ for (var t of _(e))
10
+ R.call(e, t) && p(r, t, e[t]);
11
+ return r;
12
+ }, k = (r, e) => C(r, P(e));
13
+ var s = (r, e, t) => (p(r, typeof e != "symbol" ? e + "" : e, t), t);
14
+ var o = (r, e, t) => new Promise((i, n) => {
15
+ var a = (l) => {
16
+ try {
17
+ c(t.next(l));
18
+ } catch (d) {
19
+ n(d);
20
+ }
21
+ }, h = (l) => {
22
+ try {
23
+ c(t.throw(l));
24
+ } catch (d) {
25
+ n(d);
26
+ }
27
+ }, c = (l) => l.done ? i(l.value) : Promise.resolve(l.value).then(a, h);
28
+ c((t = t.apply(r, e)).next());
29
+ });
30
+ import b from "../../EventBus.mjs";
31
+ import { FileSystemAccessAdapter as D } from "../adapters/FileSystemAccessAdapter.mjs";
32
+ import { getNativeDirectoryPicker as T } from "../adapters/fsaTypes.mjs";
33
+ import { LOCAL_FILES_FUNCTION_CODES as F } from "../constants.mjs";
34
+ import { getDownloadUrlAllowlist as W } from "../security/downloadUrlPolicy.mjs";
35
+ import { SensitiveFilePolicy as q } from "../security/sensitiveFiles.mjs";
36
+ import { resolveLimits as I } from "../limits.mjs";
37
+ import { createDefaultSessionFileTransfer as L } from "../transfer/SessionFileTransfer.mjs";
38
+ import { createMemoryStore as N } from "./handleStore.mjs";
39
+ import { watchDirectoryHandle as E } from "./watchDirectory.mjs";
40
+ const u = {
41
+ mode: "readwrite"
42
+ };
43
+ function U(r) {
44
+ const e = r.replace(/\\/g, "/").trim().replace(/^\.\/+/, "").replace(/\/+$/, "");
45
+ if (!e || e === ".")
46
+ return "";
47
+ if (e.startsWith("/") || e.includes(":") || e.includes("\0"))
48
+ return;
49
+ const t = e.split("/");
50
+ if (!t.some((i) => !i || i === "." || i === ".."))
51
+ return t.join("/");
52
+ }
53
+ function x(r) {
54
+ return !!r && typeof r == "object" && r.name === "AbortError";
55
+ }
56
+ class X {
57
+ constructor(e) {
58
+ s(this, "applicationId");
59
+ s(this, "limits");
60
+ s(this, "sensitive");
61
+ s(this, "downloadUrlAllowlist");
62
+ s(this, "allowWorkspaceWideTextSearch");
63
+ s(this, "transfer");
64
+ s(this, "fetch");
65
+ s(this, "commandRunner");
66
+ s(this, "browserRuntime");
67
+ s(this, "store");
68
+ s(this, "picker");
69
+ s(this, "event", new b(!0));
70
+ s(this, "_status");
71
+ s(this, "_displayName");
72
+ s(this, "_adapter", null);
73
+ s(this, "pendingHandle", null);
74
+ s(this, "approvalHandler");
75
+ s(this, "activeCalls", 0);
76
+ s(this, "commandRunning", !1);
77
+ s(this, "inflight", /* @__PURE__ */ new Set());
78
+ s(this, "_ready", Promise.resolve());
79
+ s(this, "stopWatching", () => {
80
+ });
81
+ s(this, "pendingChangePaths", /* @__PURE__ */ new Set());
82
+ s(this, "changeTimer");
83
+ s(this, "refreshAllVisible", !1);
84
+ var h, c, l, d, f, g, y, v, w, A;
85
+ const t = (h = e.config) != null ? h : {};
86
+ this.applicationId = e.applicationId, this.store = (c = e.store) != null ? c : N(), this.picker = e.picker === null ? void 0 : (l = e.picker) != null ? l : T(), this.limits = I(t.limits), this.sensitive = new q(t.sensitiveRulesAppend), this.downloadUrlAllowlist = W(t.downloadUrlAllowlistAppend), this.allowWorkspaceWideTextSearch = !!t.allowWorkspaceWideTextSearch, this.approvalHandler = t.onApprovalRequired;
87
+ const i = (d = e.transfer) != null ? d : L(() => {
88
+ });
89
+ this.transfer = {
90
+ upload: (g = (f = t.transfer) == null ? void 0 : f.upload) != null ? g : i.upload,
91
+ resolveDownload: (v = (y = t.transfer) == null ? void 0 : y.resolveDownload) != null ? v : i.resolveDownload
92
+ };
93
+ const n = (w = e.fetch) != null ? w : typeof fetch == "function" ? fetch : void 0;
94
+ this.fetch = n ? n.bind(globalThis) : () => Promise.reject(new Error("fetch is not available")), this.commandRunner = e.commandRunner;
95
+ const a = (A = t.commandRuntime) == null ? void 0 : A.browser;
96
+ this.browserRuntime = {
97
+ enabled: (a == null ? void 0 : a.enabled) !== !1,
98
+ bashModuleURL: a == null ? void 0 : a.bashModuleURL,
99
+ pyodideIndexURL: a == null ? void 0 : a.pyodideIndexURL
100
+ }, this._status = this.picker ? "none" : "unsupported";
101
+ }
102
+ // -------------------------------------------------------------------------
103
+ // 状态
104
+ // -------------------------------------------------------------------------
105
+ get status() {
106
+ return this._status;
107
+ }
108
+ /** 当前(或待恢复的)文件夹名,不含绝对路径。 */
109
+ get displayName() {
110
+ return this._displayName;
111
+ }
112
+ get isSupported() {
113
+ return !!this.picker;
114
+ }
115
+ /** 最近一次 restore() 完成前,工具调用会等待它。 */
116
+ get ready() {
117
+ return this._ready;
118
+ }
119
+ /** @internal 已授权时可用的 Adapter。 */
120
+ get adapter() {
121
+ return this._status === "granted" ? this._adapter : null;
122
+ }
123
+ get handleKey() {
124
+ return `workspace:${this.applicationId}`;
125
+ }
126
+ get disclosureKey() {
127
+ return `disclosure:${this.applicationId}`;
128
+ }
129
+ setStatus(e, t = this._displayName) {
130
+ e === this._status && t === this._displayName || (this._status = e, this._displayName = t, this.emit("workspace:changed", {
131
+ status: e,
132
+ displayName: t
133
+ }));
134
+ }
135
+ attachHandle(e) {
136
+ this.cancelFilesChanged(), this.pendingHandle = e, this._adapter = new D(e), this.setStatus("granted", e.name), this.unwatchDirectory(), this.stopWatching = E(e, (t) => this.notifyFilesChanged(t));
137
+ }
138
+ // -------------------------------------------------------------------------
139
+ // 授权
140
+ // -------------------------------------------------------------------------
141
+ /**
142
+ * 弹出目录选择框。必须在用户点击事件中调用。
143
+ * 用户取消时返回 false 且状态不变。
144
+ */
145
+ pick() {
146
+ if (!this.picker)
147
+ return Promise.resolve(!1);
148
+ let e;
149
+ try {
150
+ e = this.picker({
151
+ mode: "readwrite"
152
+ });
153
+ } catch (t) {
154
+ return Promise.reject(t);
155
+ }
156
+ return e.then((t) => o(this, null, function* () {
157
+ var n, a;
158
+ this.cancelAll();
159
+ const i = (a = yield (n = t.queryPermission) == null ? void 0 : n.call(t, u)) != null ? a : "granted";
160
+ return yield this.store.set(this.handleKey, {
161
+ handle: t,
162
+ displayName: t.name,
163
+ savedAt: Date.now()
164
+ }).catch(() => {
165
+ }), i === "denied" ? (this.pendingHandle = t, this._adapter = null, this.setStatus("denied", t.name), !1) : (this.attachHandle(t), !0);
166
+ }), (t) => {
167
+ if (x(t))
168
+ return !1;
169
+ throw t;
170
+ });
171
+ }
172
+ /** 读取上次的目录句柄并检查权限,不弹窗。 */
173
+ restore() {
174
+ return this._ready = this.doRestore(), this._ready;
175
+ }
176
+ doRestore() {
177
+ return o(this, null, function* () {
178
+ var i, n, a;
179
+ if (!this.picker) {
180
+ this._adapter || this.setStatus("unsupported");
181
+ return;
182
+ }
183
+ let e;
184
+ try {
185
+ e = yield this.store.get(this.handleKey);
186
+ } catch (h) {
187
+ e = void 0;
188
+ }
189
+ if (!(e != null && e.handle)) {
190
+ this.pendingHandle = null, this._adapter = null, this.setStatus("none", void 0);
191
+ return;
192
+ }
193
+ let t;
194
+ try {
195
+ t = (a = yield (n = (i = e.handle).queryPermission) == null ? void 0 : n.call(i, u)) != null ? a : "prompt";
196
+ } catch (h) {
197
+ t = "prompt";
198
+ }
199
+ t === "granted" ? this.attachHandle(e.handle) : (this.pendingHandle = e.handle, this._adapter = null, this.setStatus(t === "denied" ? "denied" : "prompt", e.displayName));
200
+ });
201
+ }
202
+ /** 对已保存的目录重新申请权限。必须在用户点击事件中调用。 */
203
+ requestPermission() {
204
+ const e = this.pendingHandle;
205
+ if (!(e != null && e.requestPermission))
206
+ return Promise.resolve(!1);
207
+ let t;
208
+ try {
209
+ t = e.requestPermission(u);
210
+ } catch (i) {
211
+ return Promise.reject(i);
212
+ }
213
+ return t.then((i) => i === "granted" ? (this.attachHandle(e), !0) : (this._adapter = null, this.setStatus(i === "denied" ? "denied" : "prompt", e.name), !1));
214
+ }
215
+ /** 断开工作区并删除持久化句柄。状态立即变为未授权,存储删除在其后完成。 */
216
+ clear() {
217
+ return o(this, null, function* () {
218
+ this.cancelAll(), this.cancelFilesChanged(), this.unwatchDirectory(), this.pendingHandle = null, this._adapter = null, this.setStatus(this.picker ? "none" : "unsupported", void 0), yield this.store.delete(this.handleKey).catch(() => {
219
+ });
220
+ });
221
+ }
222
+ /** 直接挂载一个 Adapter(测试或自定义后端),视为已授权。 */
223
+ attachAdapter(e, t = e.displayName) {
224
+ this.cancelAll(), this.cancelFilesChanged(), this.unwatchDirectory(), this.pendingHandle = null, this._adapter = e, this.setStatus("granted", t);
225
+ }
226
+ /**
227
+ * 通知目录树重读。`paths` 是相对工作区根的目录;省略时重读当前展开的全部目录。
228
+ * 短时间内的多次通知会合并成一次。
229
+ */
230
+ notifyFilesChanged(e) {
231
+ if (this._status === "granted") {
232
+ if (!e || e.length === 0)
233
+ this.refreshAllVisible = !0;
234
+ else
235
+ for (const t of e) {
236
+ const i = U(t);
237
+ i === void 0 ? this.refreshAllVisible = !0 : this.pendingChangePaths.add(i);
238
+ }
239
+ clearTimeout(this.changeTimer), this.changeTimer = setTimeout(() => this.flushFilesChanged(), 150);
240
+ }
241
+ }
242
+ /** @internal 工具执行中遇到权限错误时调用,重新检查并更新状态。 */
243
+ handlePermissionLost() {
244
+ return o(this, null, function* () {
245
+ const e = this.pendingHandle;
246
+ if (!(e != null && e.queryPermission))
247
+ return;
248
+ const t = yield e.queryPermission(u).catch(() => "prompt");
249
+ t !== "granted" && (this.cancelAll(), this.cancelFilesChanged(), this.unwatchDirectory(), this._adapter = null, this.setStatus(t === "denied" ? "denied" : "prompt", e.name));
250
+ });
251
+ }
252
+ // -------------------------------------------------------------------------
253
+ // 外发提示
254
+ // -------------------------------------------------------------------------
255
+ isDisclosureAcknowledged() {
256
+ return o(this, null, function* () {
257
+ try {
258
+ return !!(yield this.store.get(this.disclosureKey));
259
+ } catch (e) {
260
+ return !1;
261
+ }
262
+ });
263
+ }
264
+ acknowledgeDisclosure() {
265
+ return o(this, null, function* () {
266
+ yield this.store.set(this.disclosureKey, !0).catch(() => {
267
+ });
268
+ });
269
+ }
270
+ // -------------------------------------------------------------------------
271
+ // 确认、并发与取消
272
+ // -------------------------------------------------------------------------
273
+ setApprovalHandler(e) {
274
+ this.approvalHandler = e;
275
+ }
276
+ get hasApprovalHandler() {
277
+ return !!this.approvalHandler;
278
+ }
279
+ /** @internal */
280
+ getApprovalHandler() {
281
+ return this.approvalHandler;
282
+ }
283
+ /** @internal 占用一个并发名额;已满时返回 null。 */
284
+ acquireSlot() {
285
+ if (this.activeCalls >= this.limits.maxConcurrentRequests)
286
+ return null;
287
+ this.activeCalls++;
288
+ let e = !1;
289
+ return () => {
290
+ e || (e = !0, this.activeCalls--);
291
+ };
292
+ }
293
+ /** @internal 同一工作区同一时间只跑一个命令;已有命令在运行时返回 null。 */
294
+ acquireCommand() {
295
+ if (this.commandRunning)
296
+ return null;
297
+ this.commandRunning = !0;
298
+ let e = !1;
299
+ return () => {
300
+ e || (e = !0, this.commandRunning = !1);
301
+ };
302
+ }
303
+ /** @internal 登记进行中的调用,更换或断开工作区时统一中止。 */
304
+ track(e) {
305
+ return this.inflight.add(e), () => this.inflight.delete(e);
306
+ }
307
+ /** 中止所有进行中的调用(含等待确认的请求)。 */
308
+ cancelAll() {
309
+ const e = Array.from(this.inflight);
310
+ this.inflight.clear(), e.forEach((t) => t.abort());
311
+ }
312
+ handshake() {
313
+ const e = Object.fromEntries(F.map((t) => [t, !0]));
314
+ return {
315
+ protocolVersion: "1.0",
316
+ capabilities: k(m({}, e), {
317
+ cancellation: !0,
318
+ atomicWrite: !0
319
+ }),
320
+ limits: m({}, this.limits)
321
+ };
322
+ }
323
+ // -------------------------------------------------------------------------
324
+ // 事件
325
+ // -------------------------------------------------------------------------
326
+ on(e, t) {
327
+ return this.event.on(e, t), () => this.off(e, t);
328
+ }
329
+ off(e, t) {
330
+ this.event.off(e, t);
331
+ }
332
+ unwatchDirectory() {
333
+ const e = this.stopWatching;
334
+ this.stopWatching = () => {
335
+ }, e();
336
+ }
337
+ cancelFilesChanged() {
338
+ clearTimeout(this.changeTimer), this.changeTimer = void 0, this.pendingChangePaths.clear(), this.refreshAllVisible = !1;
339
+ }
340
+ flushFilesChanged() {
341
+ this.changeTimer = void 0;
342
+ const e = this.refreshAllVisible, t = [...this.pendingChangePaths].sort((i, n) => i < n ? -1 : i > n ? 1 : 0);
343
+ this.pendingChangePaths.clear(), this.refreshAllVisible = !1, this._status === "granted" && this.emit("files:changed", {
344
+ paths: e ? [] : t
345
+ });
346
+ }
347
+ /** @internal */
348
+ emit(e, t) {
349
+ try {
350
+ this.event.emit(e, t);
351
+ } catch (i) {
352
+ console.error(`[LocalWorkspace] ${e} listener failed`, i);
353
+ }
354
+ }
355
+ }
356
+ export {
357
+ X as LocalWorkspace
358
+ };
@@ -0,0 +1,79 @@
1
+ var a = (r, s, e) => new Promise((c, l) => {
2
+ var n = (d) => {
3
+ try {
4
+ t(e.next(d));
5
+ } catch (i) {
6
+ l(i);
7
+ }
8
+ }, o = (d) => {
9
+ try {
10
+ t(e.throw(d));
11
+ } catch (i) {
12
+ l(i);
13
+ }
14
+ }, t = (d) => d.done ? c(d.value) : Promise.resolve(d.value).then(n, o);
15
+ t((e = e.apply(r, s)).next());
16
+ });
17
+ const y = "glodon-aiot-local-workspace", u = "kv";
18
+ function p() {
19
+ const r = /* @__PURE__ */ new Map();
20
+ return {
21
+ get(e) {
22
+ return a(this, null, function* () {
23
+ return r.get(e);
24
+ });
25
+ },
26
+ set(e, c) {
27
+ return a(this, null, function* () {
28
+ r.set(e, c);
29
+ });
30
+ },
31
+ delete(e) {
32
+ return a(this, null, function* () {
33
+ r.delete(e);
34
+ });
35
+ }
36
+ };
37
+ }
38
+ function w(r) {
39
+ return new Promise((s, e) => {
40
+ r.onsuccess = () => s(r.result), r.onerror = () => e(r.error);
41
+ });
42
+ }
43
+ function g(r = y) {
44
+ if (typeof indexedDB == "undefined")
45
+ return p();
46
+ let s;
47
+ const e = () => (s || (s = new Promise((n, o) => {
48
+ const t = indexedDB.open(r, 1);
49
+ t.onupgradeneeded = () => {
50
+ t.result.createObjectStore(u);
51
+ }, t.onsuccess = () => n(t.result), t.onerror = () => {
52
+ s = void 0, o(t.error);
53
+ };
54
+ })), s), c = (n, o) => a(this, null, function* () {
55
+ const t = yield e();
56
+ return w(o(t.transaction(u, n).objectStore(u)));
57
+ });
58
+ return {
59
+ get(n) {
60
+ return a(this, null, function* () {
61
+ return yield c("readonly", (o) => o.get(n));
62
+ });
63
+ },
64
+ set(n, o) {
65
+ return a(this, null, function* () {
66
+ yield c("readwrite", (t) => t.put(o, n));
67
+ });
68
+ },
69
+ delete(n) {
70
+ return a(this, null, function* () {
71
+ yield c("readwrite", (o) => o.delete(n));
72
+ });
73
+ }
74
+ };
75
+ }
76
+ export {
77
+ g as createIndexedDbStore,
78
+ p as createMemoryStore
79
+ };
@@ -0,0 +1,38 @@
1
+ function u(r) {
2
+ if (r != null && r.length && !r.some((e) => !e || e === "." || e === ".." || e.includes("/") || e.includes("\\")))
3
+ return r.length === 1 ? "" : r.slice(0, -1).join("/");
4
+ }
5
+ function f(r, e) {
6
+ const n = globalThis.FileSystemObserver;
7
+ if (typeof n != "function")
8
+ return () => {
9
+ };
10
+ let i;
11
+ try {
12
+ i = new n((v) => {
13
+ const t = /* @__PURE__ */ new Set();
14
+ for (const d of v) {
15
+ if (d.type === "errored") {
16
+ e();
17
+ return;
18
+ }
19
+ const o = u(d.relativePathComponents), c = u(d.relativePathMovedFrom);
20
+ if (o === void 0 && c === void 0) {
21
+ e();
22
+ return;
23
+ }
24
+ o !== void 0 && t.add(o), c !== void 0 && t.add(c);
25
+ }
26
+ t.size && e([...t]);
27
+ });
28
+ } catch (v) {
29
+ return () => {
30
+ };
31
+ }
32
+ return i.observe(r, {
33
+ recursive: !0
34
+ }).catch(() => i.disconnect()), () => i.disconnect();
35
+ }
36
+ export {
37
+ f as watchDirectoryHandle
38
+ };
@@ -1,11 +1,11 @@
1
- const e = "@glodon-aiot/bot-client-sdk", t = "3.25.1-alpha.7", i = "glodoncv", s = "aiot bot client js sdk", n = "module", y = !1, o = [
1
+ const e = "@glodon-aiot/bot-client-sdk", s = "3.26.0-alpha.5", t = "glodoncv", i = "aiot bot client js sdk", n = "module", g = !1, o = [
2
2
  "aiot",
3
3
  "bot",
4
4
  "bot client",
5
5
  "sdk"
6
- ], l = [
6
+ ], d = [
7
7
  "dist"
8
- ], p = "./dist/es/index.mjs", c = "./dist/lib/index.js", r = "./dist/src/index.d.ts", d = {
8
+ ], p = "./dist/es/index.mjs", l = "./dist/lib/index.js", c = "./dist/src/index.d.ts", r = {
9
9
  ".": {
10
10
  import: "./dist/es/index.mjs",
11
11
  require: "./dist/lib/index.js",
@@ -22,8 +22,14 @@ const e = "@glodon-aiot/bot-client-sdk", t = "3.25.1-alpha.7", i = "glodoncv", s
22
22
  preview: "vite preview",
23
23
  check: "yarn prettier --check .",
24
24
  write: "yarn prettier --write .",
25
- lint: "eslint --ext .tsx,.ts --fix ./example -c .eslintrc.js"
26
- }, g = {
25
+ lint: "eslint --ext .tsx,.ts --fix ./example -c .eslintrc.js",
26
+ "build:just-bash": "node scripts/build-just-bash.mjs",
27
+ "upload:just-bash": "node scripts/build-just-bash.mjs && node scripts/upload-cdn-libs.cjs just-bash",
28
+ "build:pyodide": "node scripts/build-pyodide.mjs",
29
+ "upload:pyodide": "node scripts/build-pyodide.mjs && node scripts/upload-cdn-libs.cjs pyodide",
30
+ test: "vitest run",
31
+ "test:watch": "vitest"
32
+ }, b = {
27
33
  "@babel/core": "^7.20.12",
28
34
  "@commitlint/cli": "^17.0.3",
29
35
  "@commitlint/config-conventional": "^17.0.3",
@@ -45,8 +51,10 @@ const e = "@glodon-aiot/bot-client-sdk", t = "3.25.1-alpha.7", i = "glodoncv", s
45
51
  express: "4",
46
52
  "http-proxy-middleware": "^3.0.0",
47
53
  "identity-obj-proxy": "^3.0.0",
54
+ "just-bash": "3.6.0",
48
55
  "npm-run-all": "^4.1.5",
49
56
  prettier: "2.7.1",
57
+ pyodide: "314.0.7",
50
58
  "rollup-plugin-visualizer": "^6.0.1",
51
59
  "socket.io": "^4.7.5",
52
60
  "ts-node": "^10.9.2",
@@ -54,57 +62,58 @@ const e = "@glodon-aiot/bot-client-sdk", t = "3.25.1-alpha.7", i = "glodoncv", s
54
62
  vite: "^4.1.1",
55
63
  "vite-plugin-dts": "^4.3.0",
56
64
  "vite-plugin-externalize-deps": "^0.9.0",
57
- "vite-tsconfig-paths": "^5.1.4"
65
+ "vite-tsconfig-paths": "^5.1.4",
66
+ vitest: "^0.34.6"
58
67
  }, m = {
59
68
  access: "public",
60
69
  registry: "https://registry.npmjs.org/"
61
- }, b = {
62
- "@glodon-aiot/apis": "^3.25.1-alpha.7",
70
+ }, y = {
71
+ "@glodon-aiot/apis": "^3.26.0-alpha.5",
63
72
  axios: "0.24.0",
64
73
  buffer: "^6.0.3",
65
74
  dayjs: "^1.11.13",
66
75
  "js-base64": "^3.7.7",
67
76
  "socket.io-client": "^4.7.5",
68
77
  uuid: "^11.1.0"
69
- }, x = {
78
+ }, j = {
70
79
  name: e,
71
- version: t,
72
- author: i,
73
- description: s,
80
+ version: s,
81
+ author: t,
82
+ description: i,
74
83
  type: n,
75
84
  sideEffects: !1,
76
85
  keywords: o,
77
- files: l,
86
+ files: d,
78
87
  module: p,
79
- main: c,
80
- typings: r,
81
- exports: d,
88
+ main: l,
89
+ typings: c,
90
+ exports: r,
82
91
  license: a,
83
92
  scripts: u,
84
- devDependencies: g,
93
+ devDependencies: b,
85
94
  "lint-staged": {
86
95
  "*.{js,css,md,jsx,less,ts,tsx,json}": "prettier --write"
87
96
  },
88
97
  publishConfig: m,
89
- dependencies: b
98
+ dependencies: y
90
99
  };
91
100
  export {
92
- i as author,
93
- x as default,
94
- b as dependencies,
95
- s as description,
96
- g as devDependencies,
97
- d as exports,
98
- l as files,
101
+ t as author,
102
+ j as default,
103
+ y as dependencies,
104
+ i as description,
105
+ b as devDependencies,
106
+ r as exports,
107
+ d as files,
99
108
  o as keywords,
100
109
  a as license,
101
- c as main,
110
+ l as main,
102
111
  p as module,
103
112
  e as name,
104
113
  m as publishConfig,
105
114
  u as scripts,
106
- y as sideEffects,
115
+ g as sideEffects,
107
116
  n as type,
108
- r as typings,
109
- t as version
117
+ c as typings,
118
+ s as version
110
119
  };