@glodon-aiot/bot-client-sdk 3.26.0-alpha.9 → 3.27.0-alpha.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.
Files changed (72) hide show
  1. package/README.md +246 -225
  2. package/dist/es/AgentSession.mjs +275 -197
  3. package/dist/es/BotClient.mjs +200 -123
  4. package/dist/es/Config.mjs +58 -68
  5. package/dist/es/DialogSession.mjs +123 -118
  6. package/dist/es/EventBus.mjs +38 -34
  7. package/dist/es/Logger.mjs +19 -21
  8. package/dist/es/Session.mjs +338 -284
  9. package/dist/es/api/index.mjs +31 -30
  10. package/dist/es/builtinTools/constants.mjs +12 -5
  11. package/dist/es/builtinTools/createBuiltinToolsPlugin.mjs +182 -160
  12. package/dist/es/builtinTools/paths.mjs +34 -27
  13. package/dist/es/builtinTools/platformSkills.mjs +248 -0
  14. package/dist/es/builtinTools/schemas.mjs +63 -18
  15. package/dist/es/builtinTools/tools.mjs +368 -244
  16. package/dist/es/index.mjs +62 -61
  17. package/dist/es/localFiles/adapters/FileSnapshotAdapter.mjs +160 -0
  18. package/dist/es/localFiles/adapters/FileSystemAccessAdapter.mjs +113 -131
  19. package/dist/es/localFiles/adapters/HostBridgeAdapter.mjs +60 -55
  20. package/dist/es/localFiles/constants.mjs +24 -28
  21. package/dist/es/localFiles/createLocalFilesPlugin.mjs +53 -52
  22. package/dist/es/localFiles/errors.mjs +44 -35
  23. package/dist/es/localFiles/host/connectHostBridge.mjs +20 -15
  24. package/dist/es/localFiles/host/protocol.mjs +27 -14
  25. package/dist/es/localFiles/host/sandboxClient.mjs +297 -127
  26. package/dist/es/localFiles/preview.mjs +33 -0
  27. package/dist/es/localFiles/schemas.mjs +22 -53
  28. package/dist/es/localFiles/workspace/LocalWorkspace.mjs +156 -89
  29. package/dist/es/localFiles/workspace/WorkspaceFiles.mjs +246 -0
  30. package/dist/es/localMcp/client.mjs +234 -0
  31. package/dist/es/localMcp/endpoints.mjs +94 -0
  32. package/dist/es/localMcp/register.mjs +207 -0
  33. package/dist/es/localMcp/registry.mjs +43 -0
  34. package/dist/es/package.json.mjs +29 -49
  35. package/dist/es/sessionUpload.mjs +49 -0
  36. package/dist/es/utils.mjs +24 -11
  37. package/dist/lib/index.js +48 -40
  38. package/dist/src/AgentSession.d.ts +13 -0
  39. package/dist/src/BotClient.d.ts +13 -1
  40. package/dist/src/Config.d.ts +14 -7
  41. package/dist/src/EventBus.d.ts +3 -0
  42. package/dist/src/Logger.d.ts +15 -8
  43. package/dist/src/PayloadTypes.d.ts +7 -0
  44. package/dist/src/Session.d.ts +19 -2
  45. package/dist/src/api/index.d.ts +2 -2
  46. package/dist/src/builtinTools/command.d.ts +7 -0
  47. package/dist/src/builtinTools/constants.d.ts +10 -2
  48. package/dist/src/builtinTools/paths.d.ts +3 -2
  49. package/dist/src/builtinTools/platformSkills.d.ts +92 -0
  50. package/dist/src/builtinTools/tools.d.ts +13 -0
  51. package/dist/src/constant.d.ts +1 -1
  52. package/dist/src/index.d.ts +2 -1
  53. package/dist/src/localFiles/adapters/FileSnapshotAdapter.d.ts +24 -0
  54. package/dist/src/localFiles/adapters/HostBridgeAdapter.d.ts +7 -4
  55. package/dist/src/localFiles/adapters/WorkspaceFileAdapter.d.ts +8 -0
  56. package/dist/src/localFiles/constants.d.ts +4 -13
  57. package/dist/src/localFiles/errors.d.ts +1 -1
  58. package/dist/src/localFiles/host/protocol.d.ts +14 -3
  59. package/dist/src/localFiles/host/sandboxClient.d.ts +50 -0
  60. package/dist/src/localFiles/index.d.ts +9 -5
  61. package/dist/src/localFiles/preview.d.ts +2 -0
  62. package/dist/src/localFiles/schemas.d.ts +0 -2
  63. package/dist/src/localFiles/types.d.ts +2 -22
  64. package/dist/src/localFiles/workspace/LocalWorkspace.d.ts +25 -3
  65. package/dist/src/localFiles/workspace/WorkspaceFiles.d.ts +63 -0
  66. package/dist/src/localMcp/client.d.ts +15 -0
  67. package/dist/src/localMcp/endpoints.d.ts +19 -0
  68. package/dist/src/localMcp/register.d.ts +34 -0
  69. package/dist/src/localMcp/registry.d.ts +27 -0
  70. package/dist/src/sessionUpload.d.ts +14 -0
  71. package/dist/src/utils.d.ts +6 -0
  72. 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 { getHostWebView 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,27 +1,40 @@
1
- const n = "glodon-workspace", i = 2;
2
- function s(t) {
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 (r) {
7
+ } catch (s) {
8
8
  return;
9
9
  }
10
10
  if (!e || typeof e != "object")
11
11
  return;
12
- const o = e;
13
- if (o.channel === n)
14
- return o;
12
+ const n = e;
13
+ if (n.channel === i)
14
+ return n;
15
15
  }
16
- function c() {
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 = (e = globalThis.chrome) == null ? void 0 : e.webview;
19
- if (!(!t || typeof t.postMessage != "function" || typeof t.addEventListener != "function"))
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
- n as HOST_CHANNEL,
24
- i as SANDBOX_PROTOCOL,
25
- c as getHostWebView,
26
- s as parseHostMessage
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
  };