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

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 (70) hide show
  1. package/README.md +543 -98
  2. package/dist/es/AgentSession.mjs +230 -165
  3. package/dist/es/BotClient.mjs +186 -136
  4. package/dist/es/Config.mjs +111 -26
  5. package/dist/es/Session.mjs +12 -0
  6. package/dist/es/api/index.mjs +42 -33
  7. package/dist/es/index.mjs +68 -9
  8. package/dist/es/localFiles/adapters/FileSystemAccessAdapter.mjs +174 -0
  9. package/dist/es/localFiles/adapters/HostBridgeAdapter.mjs +172 -0
  10. package/dist/es/localFiles/adapters/MemoryWorkspaceAdapter.mjs +162 -0
  11. package/dist/es/localFiles/adapters/WorkspaceFileAdapter.mjs +50 -0
  12. package/dist/es/localFiles/adapters/fsaTypes.mjs +9 -0
  13. package/dist/es/localFiles/constants.mjs +47 -0
  14. package/dist/es/localFiles/createLocalFilesPlugin.mjs +255 -0
  15. package/dist/es/localFiles/createLocalPythonPlugin.mjs +196 -0
  16. package/dist/es/localFiles/errors.mjs +57 -0
  17. package/dist/es/localFiles/host/connectHostBridge.mjs +50 -0
  18. package/dist/es/localFiles/host/protocol.mjs +26 -0
  19. package/dist/es/localFiles/limits.mjs +22 -0
  20. package/dist/es/localFiles/schemas.mjs +327 -0
  21. package/dist/es/localFiles/security/downloadUrlPolicy.mjs +39 -0
  22. package/dist/es/localFiles/security/glob.mjs +28 -0
  23. package/dist/es/localFiles/security/pathPolicy.mjs +59 -0
  24. package/dist/es/localFiles/security/sensitiveFiles.mjs +115 -0
  25. package/dist/es/localFiles/tools/readTools.mjs +333 -0
  26. package/dist/es/localFiles/tools/runtime.mjs +108 -0
  27. package/dist/es/localFiles/tools/transferTools.mjs +228 -0
  28. package/dist/es/localFiles/tools/writeTools.mjs +173 -0
  29. package/dist/es/localFiles/transfer/SessionFileTransfer.mjs +111 -0
  30. package/dist/es/localFiles/validate.mjs +66 -0
  31. package/dist/es/localFiles/workspace/LocalWorkspace.mjs +339 -0
  32. package/dist/es/localFiles/workspace/handleStore.mjs +79 -0
  33. package/dist/es/localFiles/workspace/watchDirectory.mjs +38 -0
  34. package/dist/es/package.json.mjs +7 -4
  35. package/dist/lib/index.js +9 -4
  36. package/dist/src/AgentSession.d.ts +9 -0
  37. package/dist/src/BotClient.d.ts +12 -2
  38. package/dist/src/Config.d.ts +22 -0
  39. package/dist/src/Session.d.ts +5 -1
  40. package/dist/src/api/index.d.ts +3 -1
  41. package/dist/src/index.d.ts +4 -2
  42. package/dist/src/localFiles/adapters/FileSystemAccessAdapter.d.ts +17 -0
  43. package/dist/src/localFiles/adapters/HostBridgeAdapter.d.ts +24 -0
  44. package/dist/src/localFiles/adapters/MemoryWorkspaceAdapter.d.ts +18 -0
  45. package/dist/src/localFiles/adapters/WorkspaceFileAdapter.d.ts +26 -0
  46. package/dist/src/localFiles/adapters/fsaTypes.d.ts +39 -0
  47. package/dist/src/localFiles/constants.d.ts +50 -0
  48. package/dist/src/localFiles/createLocalFilesPlugin.d.ts +11 -0
  49. package/dist/src/localFiles/createLocalPythonPlugin.d.ts +12 -0
  50. package/dist/src/localFiles/errors.d.ts +34 -0
  51. package/dist/src/localFiles/host/connectHostBridge.d.ts +6 -0
  52. package/dist/src/localFiles/host/protocol.d.ts +33 -0
  53. package/dist/src/localFiles/index.d.ts +21 -0
  54. package/dist/src/localFiles/limits.d.ts +3 -0
  55. package/dist/src/localFiles/schemas.d.ts +30 -0
  56. package/dist/src/localFiles/security/downloadUrlPolicy.d.ts +4 -0
  57. package/dist/src/localFiles/security/glob.d.ts +3 -0
  58. package/dist/src/localFiles/security/pathPolicy.d.ts +14 -0
  59. package/dist/src/localFiles/security/sensitiveFiles.d.ts +23 -0
  60. package/dist/src/localFiles/tools/readTools.d.ts +7 -0
  61. package/dist/src/localFiles/tools/runtime.d.ts +43 -0
  62. package/dist/src/localFiles/tools/transferTools.d.ts +4 -0
  63. package/dist/src/localFiles/tools/writeTools.d.ts +4 -0
  64. package/dist/src/localFiles/transfer/SessionFileTransfer.d.ts +40 -0
  65. package/dist/src/localFiles/types.d.ts +306 -0
  66. package/dist/src/localFiles/validate.d.ts +2 -0
  67. package/dist/src/localFiles/workspace/LocalWorkspace.d.ts +99 -0
  68. package/dist/src/localFiles/workspace/handleStore.d.ts +11 -0
  69. package/dist/src/localFiles/workspace/watchDirectory.d.ts +7 -0
  70. package/package.json +7 -4
@@ -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,4 +1,4 @@
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", t = "3.26.0-alpha.4", i = "glodoncv", s = "aiot bot client js sdk", n = "module", y = !1, o = [
2
2
  "aiot",
3
3
  "bot",
4
4
  "bot client",
@@ -22,7 +22,9 @@ 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"
25
+ lint: "eslint --ext .tsx,.ts --fix ./example -c .eslintrc.js",
26
+ test: "vitest run",
27
+ "test:watch": "vitest"
26
28
  }, g = {
27
29
  "@babel/core": "^7.20.12",
28
30
  "@commitlint/cli": "^17.0.3",
@@ -54,12 +56,13 @@ const e = "@glodon-aiot/bot-client-sdk", t = "3.25.1-alpha.7", i = "glodoncv", s
54
56
  vite: "^4.1.1",
55
57
  "vite-plugin-dts": "^4.3.0",
56
58
  "vite-plugin-externalize-deps": "^0.9.0",
57
- "vite-tsconfig-paths": "^5.1.4"
59
+ "vite-tsconfig-paths": "^5.1.4",
60
+ vitest: "^0.34.6"
58
61
  }, m = {
59
62
  access: "public",
60
63
  registry: "https://registry.npmjs.org/"
61
64
  }, b = {
62
- "@glodon-aiot/apis": "^3.25.1-alpha.7",
65
+ "@glodon-aiot/apis": "^3.26.0-alpha.4",
63
66
  axios: "0.24.0",
64
67
  buffer: "^6.0.3",
65
68
  dayjs: "^1.11.13",