@glodon-aiot/bot-client-sdk 3.26.0-alpha.9 → 3.26.0
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 +243 -225
- package/dist/es/AgentSession.mjs +267 -197
- package/dist/es/BotClient.mjs +200 -123
- package/dist/es/Config.mjs +56 -67
- package/dist/es/DialogSession.mjs +123 -118
- package/dist/es/EventBus.mjs +38 -34
- package/dist/es/Logger.mjs +19 -21
- package/dist/es/Session.mjs +338 -284
- package/dist/es/api/index.mjs +31 -30
- package/dist/es/builtinTools/constants.mjs +12 -5
- package/dist/es/builtinTools/createBuiltinToolsPlugin.mjs +182 -160
- package/dist/es/builtinTools/paths.mjs +34 -27
- package/dist/es/builtinTools/platformSkills.mjs +248 -0
- package/dist/es/builtinTools/schemas.mjs +63 -18
- package/dist/es/builtinTools/tools.mjs +368 -244
- package/dist/es/index.mjs +62 -61
- package/dist/es/localFiles/adapters/FileSnapshotAdapter.mjs +160 -0
- package/dist/es/localFiles/adapters/FileSystemAccessAdapter.mjs +113 -131
- package/dist/es/localFiles/adapters/HostBridgeAdapter.mjs +60 -55
- package/dist/es/localFiles/constants.mjs +24 -28
- package/dist/es/localFiles/createLocalFilesPlugin.mjs +53 -52
- package/dist/es/localFiles/errors.mjs +44 -35
- package/dist/es/localFiles/host/connectHostBridge.mjs +20 -15
- package/dist/es/localFiles/host/protocol.mjs +27 -14
- package/dist/es/localFiles/host/sandboxClient.mjs +297 -127
- package/dist/es/localFiles/preview.mjs +33 -0
- package/dist/es/localFiles/schemas.mjs +22 -53
- package/dist/es/localFiles/workspace/LocalWorkspace.mjs +156 -89
- package/dist/es/localFiles/workspace/WorkspaceFiles.mjs +246 -0
- package/dist/es/localMcp/client.mjs +234 -0
- package/dist/es/localMcp/endpoints.mjs +94 -0
- package/dist/es/localMcp/register.mjs +207 -0
- package/dist/es/localMcp/registry.mjs +43 -0
- package/dist/es/package.json.mjs +34 -54
- package/dist/es/sessionUpload.mjs +49 -0
- package/dist/es/utils.mjs +24 -11
- package/dist/lib/index.js +48 -40
- package/dist/src/AgentSession.d.ts +13 -0
- package/dist/src/BotClient.d.ts +13 -1
- package/dist/src/Config.d.ts +6 -7
- package/dist/src/EventBus.d.ts +3 -0
- package/dist/src/Logger.d.ts +15 -8
- package/dist/src/PayloadTypes.d.ts +2 -0
- package/dist/src/Session.d.ts +19 -2
- package/dist/src/api/index.d.ts +2 -2
- package/dist/src/builtinTools/command.d.ts +7 -0
- package/dist/src/builtinTools/constants.d.ts +10 -2
- package/dist/src/builtinTools/paths.d.ts +3 -2
- package/dist/src/builtinTools/platformSkills.d.ts +92 -0
- package/dist/src/builtinTools/tools.d.ts +13 -0
- package/dist/src/constant.d.ts +1 -1
- package/dist/src/index.d.ts +2 -1
- package/dist/src/localFiles/adapters/FileSnapshotAdapter.d.ts +24 -0
- package/dist/src/localFiles/adapters/HostBridgeAdapter.d.ts +7 -4
- package/dist/src/localFiles/adapters/WorkspaceFileAdapter.d.ts +8 -0
- package/dist/src/localFiles/constants.d.ts +4 -13
- package/dist/src/localFiles/errors.d.ts +1 -1
- package/dist/src/localFiles/host/protocol.d.ts +14 -3
- package/dist/src/localFiles/host/sandboxClient.d.ts +50 -0
- package/dist/src/localFiles/index.d.ts +9 -5
- package/dist/src/localFiles/preview.d.ts +2 -0
- package/dist/src/localFiles/schemas.d.ts +0 -2
- package/dist/src/localFiles/types.d.ts +2 -22
- package/dist/src/localFiles/workspace/LocalWorkspace.d.ts +25 -3
- package/dist/src/localFiles/workspace/WorkspaceFiles.d.ts +63 -0
- package/dist/src/localMcp/client.d.ts +15 -0
- package/dist/src/localMcp/endpoints.d.ts +19 -0
- package/dist/src/localMcp/register.d.ts +34 -0
- package/dist/src/localMcp/registry.d.ts +27 -0
- package/dist/src/sessionUpload.d.ts +14 -0
- package/dist/src/utils.d.ts +6 -0
- package/package.json +4 -24
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import l from "../../Logger.mjs";
|
|
1
2
|
import { HostBridgeAdapter as f } from "../adapters/HostBridgeAdapter.mjs";
|
|
2
|
-
import {
|
|
3
|
-
function
|
|
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
|
|
21
|
+
function h(o) {
|
|
20
22
|
s == null || s(), s = void 0;
|
|
21
|
-
const e =
|
|
23
|
+
const e = y();
|
|
22
24
|
if (!e)
|
|
23
|
-
return () => {
|
|
25
|
+
return d.log("missing"), () => {
|
|
24
26
|
};
|
|
25
|
-
const i = new f(e),
|
|
26
|
-
const t =
|
|
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
|
|
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(
|
|
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
|
|
37
|
-
o.notifyFilesChanged(
|
|
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:
|
|
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",
|
|
52
|
+
e.removeEventListener("message", p), s === a && (s = void 0);
|
|
48
53
|
};
|
|
49
54
|
return s = a, a;
|
|
50
55
|
}
|
|
51
56
|
export {
|
|
52
|
-
|
|
57
|
+
h as connectHostBridge
|
|
53
58
|
};
|
|
@@ -1,27 +1,40 @@
|
|
|
1
|
-
const
|
|
2
|
-
function
|
|
1
|
+
const i = "glodon-workspace", o = "__glodonHostBridge", c = 1, f = 524288e3;
|
|
2
|
+
function d(t) {
|
|
3
3
|
let e = t;
|
|
4
4
|
if (typeof e == "string")
|
|
5
5
|
try {
|
|
6
6
|
e = JSON.parse(e);
|
|
7
|
-
} catch (
|
|
7
|
+
} catch (s) {
|
|
8
8
|
return;
|
|
9
9
|
}
|
|
10
10
|
if (!e || typeof e != "object")
|
|
11
11
|
return;
|
|
12
|
-
const
|
|
13
|
-
if (
|
|
14
|
-
return
|
|
12
|
+
const n = e;
|
|
13
|
+
if (n.channel === i)
|
|
14
|
+
return n;
|
|
15
15
|
}
|
|
16
|
-
function
|
|
16
|
+
function r(t) {
|
|
17
|
+
if (!t || typeof t != "object")
|
|
18
|
+
return;
|
|
19
|
+
const e = t;
|
|
20
|
+
if (!(typeof e.postMessage != "function" || typeof e.addEventListener != "function" || typeof e.removeEventListener != "function"))
|
|
21
|
+
return e;
|
|
22
|
+
}
|
|
23
|
+
function g(t) {
|
|
24
|
+
const e = globalThis;
|
|
25
|
+
t ? e[o] = t : delete e[o];
|
|
26
|
+
}
|
|
27
|
+
function u() {
|
|
17
28
|
var e;
|
|
18
|
-
const t = (
|
|
19
|
-
|
|
20
|
-
return t;
|
|
29
|
+
const t = r(globalThis[o]);
|
|
30
|
+
return t || r((e = globalThis.chrome) == null ? void 0 : e.webview);
|
|
21
31
|
}
|
|
22
32
|
export {
|
|
23
|
-
|
|
24
|
-
i as
|
|
25
|
-
|
|
26
|
-
|
|
33
|
+
o as HOST_BRIDGE_GLOBAL,
|
|
34
|
+
i as HOST_CHANNEL,
|
|
35
|
+
f as SANDBOX_MAX_FILE_BYTES,
|
|
36
|
+
c as SANDBOX_PROTOCOL,
|
|
37
|
+
u as getHostBridge,
|
|
38
|
+
d as parseHostMessage,
|
|
39
|
+
g as registerHostBridge
|
|
27
40
|
};
|