@glodon-aiot/bot-client-sdk 3.26.0-alpha.13 → 3.26.0-alpha.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/dist/es/BotClient.mjs +153 -137
- package/dist/es/builtinTools/createBuiltinToolsPlugin.mjs +99 -82
- package/dist/es/builtinTools/paths.mjs +28 -22
- package/dist/es/builtinTools/platformSkills.mjs +210 -0
- package/dist/es/builtinTools/schemas.mjs +2 -2
- package/dist/es/builtinTools/tools.mjs +256 -233
- package/dist/es/localFiles/adapters/HostBridgeAdapter.mjs +19 -18
- package/dist/es/localFiles/host/protocol.mjs +1 -1
- package/dist/es/localFiles/host/sandboxClient.mjs +171 -100
- package/dist/es/localFiles/workspace/LocalWorkspace.mjs +46 -44
- package/dist/es/package.json.mjs +2 -2
- package/dist/lib/index.js +36 -36
- package/dist/src/builtinTools/command.d.ts +7 -0
- package/dist/src/builtinTools/paths.d.ts +1 -0
- package/dist/src/builtinTools/platformSkills.d.ts +67 -0
- package/dist/src/builtinTools/tools.d.ts +4 -0
- package/dist/src/localFiles/adapters/HostBridgeAdapter.d.ts +1 -1
- package/dist/src/localFiles/host/protocol.d.ts +1 -1
- package/dist/src/localFiles/host/sandboxClient.d.ts +15 -0
- package/dist/src/localFiles/workspace/LocalWorkspace.d.ts +3 -0
- package/package.json +2 -2
|
@@ -10,8 +10,8 @@ var p = (r, e, t) => e in r ? S(r, e, { enumerable: !0, configurable: !0, writab
|
|
|
10
10
|
R.call(e, t) && p(r, t, e[t]);
|
|
11
11
|
return r;
|
|
12
12
|
}, k = (r, e) => C(r, P(e));
|
|
13
|
-
var
|
|
14
|
-
var o = (r, e, t) => new Promise((
|
|
13
|
+
var i = (r, e, t) => (p(r, typeof e != "symbol" ? e + "" : e, t), t);
|
|
14
|
+
var o = (r, e, t) => new Promise((s, n) => {
|
|
15
15
|
var a = (l) => {
|
|
16
16
|
try {
|
|
17
17
|
c(t.next(l));
|
|
@@ -24,7 +24,7 @@ var o = (r, e, t) => new Promise((i, n) => {
|
|
|
24
24
|
} catch (d) {
|
|
25
25
|
n(d);
|
|
26
26
|
}
|
|
27
|
-
}, c = (l) => l.done ?
|
|
27
|
+
}, c = (l) => l.done ? s(l.value) : Promise.resolve(l.value).then(a, h);
|
|
28
28
|
c((t = t.apply(r, e)).next());
|
|
29
29
|
});
|
|
30
30
|
import b from "../../EventBus.mjs";
|
|
@@ -47,7 +47,7 @@ function U(r) {
|
|
|
47
47
|
if (e.startsWith("/") || e.includes(":") || e.includes("\0"))
|
|
48
48
|
return;
|
|
49
49
|
const t = e.split("/");
|
|
50
|
-
if (!t.some((
|
|
50
|
+
if (!t.some((s) => !s || s === "." || s === ".."))
|
|
51
51
|
return t.join("/");
|
|
52
52
|
}
|
|
53
53
|
function x(r) {
|
|
@@ -55,40 +55,42 @@ function x(r) {
|
|
|
55
55
|
}
|
|
56
56
|
class X {
|
|
57
57
|
constructor(e) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
58
|
+
i(this, "applicationId");
|
|
59
|
+
i(this, "limits");
|
|
60
|
+
i(this, "sensitive");
|
|
61
|
+
i(this, "downloadUrlAllowlist");
|
|
62
|
+
i(this, "allowWorkspaceWideTextSearch");
|
|
63
|
+
i(this, "transfer");
|
|
64
|
+
i(this, "fetch");
|
|
65
|
+
i(this, "commandRunner");
|
|
66
|
+
/** 平台技能同步。由 BotClient 在启用本地工作区后挂上。 */
|
|
67
|
+
i(this, "platformSkills");
|
|
68
|
+
i(this, "browserRuntime");
|
|
69
|
+
i(this, "store");
|
|
70
|
+
i(this, "picker");
|
|
71
|
+
i(this, "event", new b(!0));
|
|
72
|
+
i(this, "_status");
|
|
73
|
+
i(this, "_displayName");
|
|
74
|
+
i(this, "_adapter", null);
|
|
75
|
+
i(this, "pendingHandle", null);
|
|
76
|
+
i(this, "approvalHandler");
|
|
77
|
+
i(this, "activeCalls", 0);
|
|
78
|
+
i(this, "commandRunning", !1);
|
|
79
|
+
i(this, "inflight", /* @__PURE__ */ new Set());
|
|
80
|
+
i(this, "_ready", Promise.resolve());
|
|
81
|
+
i(this, "stopWatching", () => {
|
|
80
82
|
});
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
83
|
+
i(this, "pendingChangePaths", /* @__PURE__ */ new Set());
|
|
84
|
+
i(this, "changeTimer");
|
|
85
|
+
i(this, "refreshAllVisible", !1);
|
|
84
86
|
var h, c, l, d, f, g, y, v, w, A;
|
|
85
87
|
const t = (h = e.config) != null ? h : {};
|
|
86
88
|
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
|
|
89
|
+
const s = (d = e.transfer) != null ? d : L(() => {
|
|
88
90
|
});
|
|
89
91
|
this.transfer = {
|
|
90
|
-
upload: (g = (f = t.transfer) == null ? void 0 : f.upload) != null ? g :
|
|
91
|
-
resolveDownload: (v = (y = t.transfer) == null ? void 0 : y.resolveDownload) != null ? v :
|
|
92
|
+
upload: (g = (f = t.transfer) == null ? void 0 : f.upload) != null ? g : s.upload,
|
|
93
|
+
resolveDownload: (v = (y = t.transfer) == null ? void 0 : y.resolveDownload) != null ? v : s.resolveDownload
|
|
92
94
|
};
|
|
93
95
|
const n = (w = e.fetch) != null ? w : typeof fetch == "function" ? fetch : void 0;
|
|
94
96
|
this.fetch = n ? n.bind(globalThis) : () => Promise.reject(new Error("fetch is not available")), this.commandRunner = e.commandRunner;
|
|
@@ -156,13 +158,13 @@ class X {
|
|
|
156
158
|
return e.then((t) => o(this, null, function* () {
|
|
157
159
|
var n, a;
|
|
158
160
|
this.cancelAll();
|
|
159
|
-
const
|
|
161
|
+
const s = (a = yield (n = t.queryPermission) == null ? void 0 : n.call(t, u)) != null ? a : "granted";
|
|
160
162
|
return yield this.store.set(this.handleKey, {
|
|
161
163
|
handle: t,
|
|
162
164
|
displayName: t.name,
|
|
163
165
|
savedAt: Date.now()
|
|
164
166
|
}).catch(() => {
|
|
165
|
-
}),
|
|
167
|
+
}), s === "denied" ? (this.pendingHandle = t, this._adapter = null, this.setStatus("denied", t.name), !1) : (this.attachHandle(t), !0);
|
|
166
168
|
}), (t) => {
|
|
167
169
|
if (x(t))
|
|
168
170
|
return !1;
|
|
@@ -175,7 +177,7 @@ class X {
|
|
|
175
177
|
}
|
|
176
178
|
doRestore() {
|
|
177
179
|
return o(this, null, function* () {
|
|
178
|
-
var
|
|
180
|
+
var s, n, a;
|
|
179
181
|
if (!this.picker) {
|
|
180
182
|
this._adapter || this.setStatus("unsupported");
|
|
181
183
|
return;
|
|
@@ -192,7 +194,7 @@ class X {
|
|
|
192
194
|
}
|
|
193
195
|
let t;
|
|
194
196
|
try {
|
|
195
|
-
t = (a = yield (n = (
|
|
197
|
+
t = (a = yield (n = (s = e.handle).queryPermission) == null ? void 0 : n.call(s, u)) != null ? a : "prompt";
|
|
196
198
|
} catch (h) {
|
|
197
199
|
t = "prompt";
|
|
198
200
|
}
|
|
@@ -207,10 +209,10 @@ class X {
|
|
|
207
209
|
let t;
|
|
208
210
|
try {
|
|
209
211
|
t = e.requestPermission(u);
|
|
210
|
-
} catch (
|
|
211
|
-
return Promise.reject(
|
|
212
|
+
} catch (s) {
|
|
213
|
+
return Promise.reject(s);
|
|
212
214
|
}
|
|
213
|
-
return t.then((
|
|
215
|
+
return t.then((s) => s === "granted" ? (this.attachHandle(e), !0) : (this._adapter = null, this.setStatus(s === "denied" ? "denied" : "prompt", e.name), !1));
|
|
214
216
|
}
|
|
215
217
|
/** 断开工作区并删除持久化句柄。状态立即变为未授权,存储删除在其后完成。 */
|
|
216
218
|
clear() {
|
|
@@ -233,8 +235,8 @@ class X {
|
|
|
233
235
|
this.refreshAllVisible = !0;
|
|
234
236
|
else
|
|
235
237
|
for (const t of e) {
|
|
236
|
-
const
|
|
237
|
-
|
|
238
|
+
const s = U(t);
|
|
239
|
+
s === void 0 ? this.refreshAllVisible = !0 : this.pendingChangePaths.add(s);
|
|
238
240
|
}
|
|
239
241
|
clearTimeout(this.changeTimer), this.changeTimer = setTimeout(() => this.flushFilesChanged(), 150);
|
|
240
242
|
}
|
|
@@ -339,7 +341,7 @@ class X {
|
|
|
339
341
|
}
|
|
340
342
|
flushFilesChanged() {
|
|
341
343
|
this.changeTimer = void 0;
|
|
342
|
-
const e = this.refreshAllVisible, t = [...this.pendingChangePaths].sort((
|
|
344
|
+
const e = this.refreshAllVisible, t = [...this.pendingChangePaths].sort((s, n) => s < n ? -1 : s > n ? 1 : 0);
|
|
343
345
|
this.pendingChangePaths.clear(), this.refreshAllVisible = !1, this._status === "granted" && this.emit("files:changed", {
|
|
344
346
|
paths: e ? [] : t
|
|
345
347
|
});
|
|
@@ -348,8 +350,8 @@ class X {
|
|
|
348
350
|
emit(e, t) {
|
|
349
351
|
try {
|
|
350
352
|
this.event.emit(e, t);
|
|
351
|
-
} catch (
|
|
352
|
-
console.error(`[LocalWorkspace] ${e} listener failed`,
|
|
353
|
+
} catch (s) {
|
|
354
|
+
console.error(`[LocalWorkspace] ${e} listener failed`, s);
|
|
353
355
|
}
|
|
354
356
|
}
|
|
355
357
|
}
|
package/dist/es/package.json.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const e = "@glodon-aiot/bot-client-sdk", s = "3.26.0-alpha.
|
|
1
|
+
const e = "@glodon-aiot/bot-client-sdk", s = "3.26.0-alpha.15", 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.13", t = "glodoncv",
|
|
|
68
68
|
access: "public",
|
|
69
69
|
registry: "https://registry.npmjs.org/"
|
|
70
70
|
}, y = {
|
|
71
|
-
"@glodon-aiot/apis": "^3.26.0-alpha.
|
|
71
|
+
"@glodon-aiot/apis": "^3.26.0-alpha.15",
|
|
72
72
|
axios: "0.24.0",
|
|
73
73
|
buffer: "^6.0.3",
|
|
74
74
|
dayjs: "^1.11.13",
|