zen-code 4.5.0 → 4.6.1

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 (37) hide show
  1. package/dist/MultiLineTextInput-B4NEXnFm.mjs +23343 -0
  2. package/dist/cli.mjs +44 -20
  3. package/dist/devtools-BHqoL8a6.mjs +11653 -0
  4. package/dist/graphBuilder-B3IJ7dB2.mjs +2641 -0
  5. package/dist/{index-BHwkVemt.mjs → index-DEcMgCTj.mjs} +1 -1
  6. package/dist/{memories-B8HqG014.mjs → memories-rSGKIPk5.mjs} +1 -1
  7. package/dist/metadata-XVTVXthy.mjs +6 -0
  8. package/dist/nonInteractive.mjs +7 -6
  9. package/dist/{subTasks-BTMXARkP.mjs → subTasks-5KLIr9iy.mjs} +47 -48
  10. package/dist/zen-code.mjs +8654 -2
  11. package/dist/zen-keyboard.mjs +7 -6
  12. package/package.json +7 -9
  13. package/dist/MultiLineTextInput-e7hD79Wp.mjs +0 -24631
  14. package/dist/app-DtYW5k3J.mjs +0 -16061
  15. package/dist/assets/worker-I4QjJYba.js +0 -1
  16. package/dist/checkpoint-1sAx_j1E-4BdN8r-w.mjs +0 -319
  17. package/dist/checkpoint-DxiUsHMy-BV-8KBKD.mjs +0 -394
  18. package/dist/chunk-YWE62C55-DID9N9eS.mjs +0 -193
  19. package/dist/devtools-CzaVuYnh.mjs +0 -2667
  20. package/dist/graphBuilder-B0bC88R_.mjs +0 -48756
  21. package/dist/id-Cu7CRpDw.mjs +0 -79
  22. package/dist/index-BUGHAUbY.mjs +0 -117
  23. package/dist/index-Bgm_TqjU.mjs +0 -212
  24. package/dist/index-C5j-48Ft.mjs +0 -75
  25. package/dist/index-CSvPIzA-.mjs +0 -464
  26. package/dist/index-DS5HVciX.mjs +0 -216
  27. package/dist/kysely-Bchvsze0.mjs +0 -4316
  28. package/dist/load-Cjl9cJ0o.mjs +0 -105
  29. package/dist/migrator-BatO36Tk.mjs +0 -592
  30. package/dist/pg-adapter-BFtir1GE-BU2H39HC.mjs +0 -62
  31. package/dist/postgres-dialect-DaHvQ_AZ.mjs +0 -211
  32. package/dist/queue-Bfg-8ehP-Lko1egu-.mjs +0 -106
  33. package/dist/remote-threads-CrG03ZS7-C9duTCnB.mjs +0 -157
  34. package/dist/shallow-DAx5vVov.mjs +0 -332
  35. package/dist/sql-CJsUpKEQ.mjs +0 -8106
  36. package/dist/sqlite-adapter-Bbonr5S5-DQLjfvyu.mjs +0 -68
  37. package/dist/zen-init.mjs +0 -1
package/dist/cli.mjs CHANGED
@@ -1,33 +1,57 @@
1
1
  #!/usr/bin/env node
2
- const t = process.argv.slice(2);
3
- async function o() {
4
- const s = t.indexOf("--yolo");
5
- if (s !== -1 && (process.env.YOLO_MODE = "true", t.splice(s, 1)), t[0] === "init")
6
- import("./zen-init.mjs");
7
- else if (t[0] === "keyboard")
2
+ import c from "node:path";
3
+ import m from "node:os";
4
+ import o from "node:fs";
5
+ import "node-notifier";
6
+ import "./metadata-XVTVXthy.mjs";
7
+ function p(e) {
8
+ const t = e.replace(/^~/, m.homedir()), s = c.resolve(t), n = c.dirname(s);
9
+ return o.existsSync(n) || o.mkdirSync(n, { recursive: !0 }), s;
10
+ }
11
+ function u(e, t) {
12
+ if (!o.existsSync(e)) {
13
+ process.env.DATABASE_INIT = "true";
14
+ return;
15
+ }
16
+ const n = (process.env.SQLITE_MAX_SIZE_MB ? parseInt(process.env.SQLITE_MAX_SIZE_MB, 10) * 1024 * 1024 : void 0) ?? 100 * 1024 * 1024, r = o.statSync(e).size, a = r / (1024 * 1024);
17
+ if (r > n) {
18
+ const d = n / 1048576;
19
+ console.warn(`⚠️ Database file is large: ${a.toFixed(2)}MB (limit: ${d.toFixed(2)}MB)`), console.warn(` Path: ${e}`), console.warn(" Set SQLITE_MAX_SIZE_MB to adjust limit");
20
+ }
21
+ }
22
+ function f(e) {
23
+ const t = p(e);
24
+ return process.env.SQLITE_DATABASE_URI = t, u(t), t;
25
+ }
26
+ const i = process.argv.slice(2);
27
+ async function l() {
28
+ const e = i.indexOf("--yolo");
29
+ if (e !== -1 && (process.env.YOLO_MODE = "true", i.splice(e, 1)), f("~/.zen-code/data/sessions.db"), i[0] === "init")
30
+ console.log("Please zen-code and use /m to configure models");
31
+ else if (i[0] === "keyboard")
8
32
  import("./zen-keyboard.mjs");
9
- else if (t[0] === "-p" || t[0] === "--prompt") {
10
- const e = t.slice(1).join(" "), { runNonInteractive: i } = await import("./nonInteractive.mjs");
11
- await i(e, !1);
12
- } else if (await r()) {
13
- const { runNonInteractive: i } = await import("./nonInteractive.mjs");
14
- await i(void 0, !0);
33
+ else if (i[0] === "-p" || i[0] === "--prompt") {
34
+ const t = i.slice(1).join(" "), { runNonInteractive: s } = await import("./nonInteractive.mjs");
35
+ await s(t, !1);
36
+ } else if (await S()) {
37
+ const { runNonInteractive: s } = await import("./nonInteractive.mjs");
38
+ await s(void 0, !0);
15
39
  } else
16
40
  await import("./zen-code.mjs");
17
41
  }
18
- async function r() {
19
- return new Promise((s) => {
42
+ async function S() {
43
+ return new Promise((e) => {
20
44
  if (process.stdin.isTTY) {
21
- s(!1);
45
+ e(!1);
22
46
  return;
23
47
  }
24
- const i = process.stdin.read();
25
- i ? (process.stdin.unshift(i), s(!0)) : setTimeout(() => {
48
+ const s = process.stdin.read();
49
+ s ? (process.stdin.unshift(s), e(!0)) : setTimeout(() => {
26
50
  const n = process.stdin.read();
27
- n ? (process.stdin.unshift(n), s(!0)) : s(!1);
51
+ n ? (process.stdin.unshift(n), e(!0)) : e(!1);
28
52
  }, 100);
29
53
  });
30
54
  }
31
- o().catch((s) => {
32
- console.error("❌ 执行失败:", s), process.exit(1);
55
+ l().catch((e) => {
56
+ console.error("❌ 执行失败:", e), process.exit(1);
33
57
  });