@askexenow/exe-os 0.9.13 → 0.9.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.
Files changed (70) hide show
  1. package/dist/bin/backfill-conversations.js +31 -4
  2. package/dist/bin/backfill-responses.js +31 -4
  3. package/dist/bin/backfill-vectors.js +25 -4
  4. package/dist/bin/cleanup-stale-review-tasks.js +1 -1
  5. package/dist/bin/cli.js +55 -8
  6. package/dist/bin/exe-assign.js +31 -4
  7. package/dist/bin/exe-boot.js +25 -4
  8. package/dist/bin/exe-dispatch.js +1 -1
  9. package/dist/bin/exe-doctor.js +1 -1
  10. package/dist/bin/exe-export-behaviors.js +1 -1
  11. package/dist/bin/exe-forget.js +1 -1
  12. package/dist/bin/exe-gateway.js +447 -21
  13. package/dist/bin/exe-heartbeat.js +1 -1
  14. package/dist/bin/exe-kill.js +1 -1
  15. package/dist/bin/exe-launch-agent.js +1 -1
  16. package/dist/bin/exe-link.js +31 -4
  17. package/dist/bin/exe-pending-messages.js +1 -1
  18. package/dist/bin/exe-pending-notifications.js +1 -1
  19. package/dist/bin/exe-pending-reviews.js +1 -1
  20. package/dist/bin/exe-rename.js +31 -4
  21. package/dist/bin/exe-review.js +1 -1
  22. package/dist/bin/exe-search.js +31 -4
  23. package/dist/bin/exe-session-cleanup.js +25 -4
  24. package/dist/bin/exe-start-codex.js +1 -1
  25. package/dist/bin/exe-start-opencode.js +1 -1
  26. package/dist/bin/exe-status.js +1 -1
  27. package/dist/bin/exe-team.js +1 -1
  28. package/dist/bin/git-sweep.js +25 -4
  29. package/dist/bin/graph-backfill.js +1 -1
  30. package/dist/bin/graph-export.js +1 -1
  31. package/dist/bin/scan-tasks.js +25 -4
  32. package/dist/bin/setup.js +46 -8
  33. package/dist/bin/shard-migrate.js +1 -1
  34. package/dist/bin/wiki-sync.js +1 -1
  35. package/dist/gateway/index.js +128 -125
  36. package/dist/hooks/bug-report-worker.js +1 -1
  37. package/dist/hooks/codex-stop-task-finalizer.js +1 -1
  38. package/dist/hooks/commit-complete.js +25 -4
  39. package/dist/hooks/error-recall.js +31 -4
  40. package/dist/hooks/ingest-worker.js +25 -4
  41. package/dist/hooks/ingest.js +1 -1
  42. package/dist/hooks/instructions-loaded.js +31 -4
  43. package/dist/hooks/notification.js +31 -4
  44. package/dist/hooks/post-compact.js +31 -4
  45. package/dist/hooks/pre-compact.js +25 -4
  46. package/dist/hooks/pre-tool-use.js +31 -4
  47. package/dist/hooks/prompt-ingest-worker.js +25 -4
  48. package/dist/hooks/prompt-submit.js +25 -4
  49. package/dist/hooks/response-ingest-worker.js +25 -4
  50. package/dist/hooks/session-end.js +25 -4
  51. package/dist/hooks/session-start.js +31 -4
  52. package/dist/hooks/stop.js +25 -4
  53. package/dist/hooks/subagent-stop.js +31 -4
  54. package/dist/hooks/summary-worker.js +25 -4
  55. package/dist/index.js +128 -125
  56. package/dist/lib/cloud-sync.js +31 -4
  57. package/dist/lib/database.js +31 -4
  58. package/dist/lib/db-daemon-client.js +31 -3
  59. package/dist/lib/db.js +31 -4
  60. package/dist/lib/device-registry.js +31 -4
  61. package/dist/lib/embedder.js +30 -3
  62. package/dist/lib/exe-daemon-client.js +31 -3
  63. package/dist/lib/exe-daemon.js +1969 -156
  64. package/dist/lib/hybrid-search.js +31 -4
  65. package/dist/lib/schedules.js +1 -1
  66. package/dist/lib/store.js +1 -1
  67. package/dist/mcp/server.js +25 -4
  68. package/dist/runtime/index.js +25 -4
  69. package/dist/tui/App.js +34 -4
  70. package/package.json +1 -1
@@ -654,7 +654,7 @@ async function ensureCompatibilityViews(prisma) {
654
654
  for (const mapping of VIEW_MAPPINGS) {
655
655
  const relation = mapping.source.replace(/"/g, "");
656
656
  const rows = await prisma.$queryRawUnsafe(
657
- "SELECT to_regclass($1) AS regclass",
657
+ "SELECT to_regclass($1)::text AS regclass",
658
658
  relation
659
659
  );
660
660
  if (!rows[0]?.regclass) {
@@ -655,7 +655,7 @@ async function ensureCompatibilityViews(prisma) {
655
655
  for (const mapping of VIEW_MAPPINGS) {
656
656
  const relation = mapping.source.replace(/"/g, "");
657
657
  const rows = await prisma.$queryRawUnsafe(
658
- "SELECT to_regclass($1) AS regclass",
658
+ "SELECT to_regclass($1)::text AS regclass",
659
659
  relation
660
660
  );
661
661
  if (!rows[0]?.regclass) {
@@ -655,7 +655,7 @@ async function ensureCompatibilityViews(prisma) {
655
655
  for (const mapping of VIEW_MAPPINGS) {
656
656
  const relation = mapping.source.replace(/"/g, "");
657
657
  const rows = await prisma.$queryRawUnsafe(
658
- "SELECT to_regclass($1) AS regclass",
658
+ "SELECT to_regclass($1)::text AS regclass",
659
659
  relation
660
660
  );
661
661
  if (!rows[0]?.regclass) {
@@ -1,6 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
5
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
6
+ }) : x)(function(x) {
7
+ if (typeof require !== "undefined") return require.apply(this, arguments);
8
+ throw Error('Dynamic require of "' + x + '" is not supported');
9
+ });
4
10
  var __esm = (fn, res) => function __init() {
5
11
  return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
6
12
  };
@@ -621,7 +627,7 @@ async function ensureCompatibilityViews(prisma) {
621
627
  for (const mapping of VIEW_MAPPINGS) {
622
628
  const relation = mapping.source.replace(/"/g, "");
623
629
  const rows = await prisma.$queryRawUnsafe(
624
- "SELECT to_regclass($1) AS regclass",
630
+ "SELECT to_regclass($1)::text AS regclass",
625
631
  relation
626
632
  );
627
633
  if (!rows[0]?.regclass) {
@@ -975,8 +981,29 @@ function findPackageRoot() {
975
981
  }
976
982
  return null;
977
983
  }
984
+ function getAvailableMemoryGB() {
985
+ if (process.platform === "darwin") {
986
+ try {
987
+ const { execSync: execSync3 } = __require("child_process");
988
+ const vmstat = execSync3("vm_stat", { encoding: "utf8" });
989
+ const pageSize = 16384;
990
+ const pageSizeMatch = vmstat.match(/page size of (\d+) bytes/);
991
+ const actualPageSize = pageSizeMatch ? parseInt(pageSizeMatch[1], 10) : pageSize;
992
+ const free = vmstat.match(/Pages free:\s+(\d+)/);
993
+ const inactive = vmstat.match(/Pages inactive:\s+(\d+)/);
994
+ const speculative = vmstat.match(/Pages speculative:\s+(\d+)/);
995
+ const freePages = free ? parseInt(free[1], 10) : 0;
996
+ const inactivePages = inactive ? parseInt(inactive[1], 10) : 0;
997
+ const speculativePages = speculative ? parseInt(speculative[1], 10) : 0;
998
+ return (freePages + inactivePages + speculativePages) * actualPageSize / (1024 * 1024 * 1024);
999
+ } catch {
1000
+ return os4.freemem() / (1024 * 1024 * 1024);
1001
+ }
1002
+ }
1003
+ return os4.freemem() / (1024 * 1024 * 1024);
1004
+ }
978
1005
  function spawnDaemon() {
979
- const freeGB = os4.freemem() / (1024 * 1024 * 1024);
1006
+ const freeGB = getAvailableMemoryGB();
980
1007
  const totalGB = os4.totalmem() / (1024 * 1024 * 1024);
981
1008
  if (totalGB <= 8) {
982
1009
  process.stderr.write(
@@ -985,9 +1012,9 @@ function spawnDaemon() {
985
1012
  );
986
1013
  return;
987
1014
  }
988
- if (totalGB <= 16 && freeGB < 4) {
1015
+ if (totalGB <= 16 && freeGB < 2) {
989
1016
  process.stderr.write(
990
- `[exed-client] SKIP: low memory (${freeGB.toFixed(1)}GB free / ${totalGB.toFixed(0)}GB total). Embedding daemon not started \u2014 using keyword search only.
1017
+ `[exed-client] SKIP: low memory (${freeGB.toFixed(1)}GB available / ${totalGB.toFixed(0)}GB total). Embedding daemon not started \u2014 using keyword search only.
991
1018
  `
992
1019
  );
993
1020
  return;
@@ -658,7 +658,7 @@ async function ensureCompatibilityViews(prisma) {
658
658
  for (const mapping of VIEW_MAPPINGS) {
659
659
  const relation = mapping.source.replace(/"/g, "");
660
660
  const rows = await prisma.$queryRawUnsafe(
661
- "SELECT to_regclass($1) AS regclass",
661
+ "SELECT to_regclass($1)::text AS regclass",
662
662
  relation
663
663
  );
664
664
  if (!rows[0]?.regclass) {
@@ -1,6 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
5
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
6
+ }) : x)(function(x) {
7
+ if (typeof require !== "undefined") return require.apply(this, arguments);
8
+ throw Error('Dynamic require of "' + x + '" is not supported');
9
+ });
4
10
  var __esm = (fn, res) => function __init() {
5
11
  return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
6
12
  };
@@ -721,7 +727,7 @@ async function ensureCompatibilityViews(prisma) {
721
727
  for (const mapping of VIEW_MAPPINGS) {
722
728
  const relation = mapping.source.replace(/"/g, "");
723
729
  const rows = await prisma.$queryRawUnsafe(
724
- "SELECT to_regclass($1) AS regclass",
730
+ "SELECT to_regclass($1)::text AS regclass",
725
731
  relation
726
732
  );
727
733
  if (!rows[0]?.regclass) {
@@ -3560,8 +3566,29 @@ function findPackageRoot() {
3560
3566
  }
3561
3567
  return null;
3562
3568
  }
3569
+ function getAvailableMemoryGB() {
3570
+ if (process.platform === "darwin") {
3571
+ try {
3572
+ const { execSync: execSync4 } = __require("child_process");
3573
+ const vmstat = execSync4("vm_stat", { encoding: "utf8" });
3574
+ const pageSize = 16384;
3575
+ const pageSizeMatch = vmstat.match(/page size of (\d+) bytes/);
3576
+ const actualPageSize = pageSizeMatch ? parseInt(pageSizeMatch[1], 10) : pageSize;
3577
+ const free = vmstat.match(/Pages free:\s+(\d+)/);
3578
+ const inactive = vmstat.match(/Pages inactive:\s+(\d+)/);
3579
+ const speculative = vmstat.match(/Pages speculative:\s+(\d+)/);
3580
+ const freePages = free ? parseInt(free[1], 10) : 0;
3581
+ const inactivePages = inactive ? parseInt(inactive[1], 10) : 0;
3582
+ const speculativePages = speculative ? parseInt(speculative[1], 10) : 0;
3583
+ return (freePages + inactivePages + speculativePages) * actualPageSize / (1024 * 1024 * 1024);
3584
+ } catch {
3585
+ return os5.freemem() / (1024 * 1024 * 1024);
3586
+ }
3587
+ }
3588
+ return os5.freemem() / (1024 * 1024 * 1024);
3589
+ }
3563
3590
  function spawnDaemon() {
3564
- const freeGB = os5.freemem() / (1024 * 1024 * 1024);
3591
+ const freeGB = getAvailableMemoryGB();
3565
3592
  const totalGB = os5.totalmem() / (1024 * 1024 * 1024);
3566
3593
  if (totalGB <= 8) {
3567
3594
  process.stderr.write(
@@ -3570,9 +3597,9 @@ function spawnDaemon() {
3570
3597
  );
3571
3598
  return;
3572
3599
  }
3573
- if (totalGB <= 16 && freeGB < 4) {
3600
+ if (totalGB <= 16 && freeGB < 2) {
3574
3601
  process.stderr.write(
3575
- `[exed-client] SKIP: low memory (${freeGB.toFixed(1)}GB free / ${totalGB.toFixed(0)}GB total). Embedding daemon not started \u2014 using keyword search only.
3602
+ `[exed-client] SKIP: low memory (${freeGB.toFixed(1)}GB available / ${totalGB.toFixed(0)}GB total). Embedding daemon not started \u2014 using keyword search only.
3576
3603
  `
3577
3604
  );
3578
3605
  return;
@@ -771,7 +771,7 @@ async function ensureCompatibilityViews(prisma) {
771
771
  for (const mapping of VIEW_MAPPINGS) {
772
772
  const relation = mapping.source.replace(/"/g, "");
773
773
  const rows = await prisma.$queryRawUnsafe(
774
- "SELECT to_regclass($1) AS regclass",
774
+ "SELECT to_regclass($1)::text AS regclass",
775
775
  relation
776
776
  );
777
777
  if (!rows[0]?.regclass) {
@@ -1125,8 +1125,29 @@ function findPackageRoot() {
1125
1125
  }
1126
1126
  return null;
1127
1127
  }
1128
+ function getAvailableMemoryGB() {
1129
+ if (process.platform === "darwin") {
1130
+ try {
1131
+ const { execSync: execSync10 } = __require("child_process");
1132
+ const vmstat = execSync10("vm_stat", { encoding: "utf8" });
1133
+ const pageSize = 16384;
1134
+ const pageSizeMatch = vmstat.match(/page size of (\d+) bytes/);
1135
+ const actualPageSize = pageSizeMatch ? parseInt(pageSizeMatch[1], 10) : pageSize;
1136
+ const free = vmstat.match(/Pages free:\s+(\d+)/);
1137
+ const inactive = vmstat.match(/Pages inactive:\s+(\d+)/);
1138
+ const speculative = vmstat.match(/Pages speculative:\s+(\d+)/);
1139
+ const freePages = free ? parseInt(free[1], 10) : 0;
1140
+ const inactivePages = inactive ? parseInt(inactive[1], 10) : 0;
1141
+ const speculativePages = speculative ? parseInt(speculative[1], 10) : 0;
1142
+ return (freePages + inactivePages + speculativePages) * actualPageSize / (1024 * 1024 * 1024);
1143
+ } catch {
1144
+ return os4.freemem() / (1024 * 1024 * 1024);
1145
+ }
1146
+ }
1147
+ return os4.freemem() / (1024 * 1024 * 1024);
1148
+ }
1128
1149
  function spawnDaemon() {
1129
- const freeGB = os4.freemem() / (1024 * 1024 * 1024);
1150
+ const freeGB = getAvailableMemoryGB();
1130
1151
  const totalGB = os4.totalmem() / (1024 * 1024 * 1024);
1131
1152
  if (totalGB <= 8) {
1132
1153
  process.stderr.write(
@@ -1135,9 +1156,9 @@ function spawnDaemon() {
1135
1156
  );
1136
1157
  return;
1137
1158
  }
1138
- if (totalGB <= 16 && freeGB < 4) {
1159
+ if (totalGB <= 16 && freeGB < 2) {
1139
1160
  process.stderr.write(
1140
- `[exed-client] SKIP: low memory (${freeGB.toFixed(1)}GB free / ${totalGB.toFixed(0)}GB total). Embedding daemon not started \u2014 using keyword search only.
1161
+ `[exed-client] SKIP: low memory (${freeGB.toFixed(1)}GB available / ${totalGB.toFixed(0)}GB total). Embedding daemon not started \u2014 using keyword search only.
1141
1162
  `
1142
1163
  );
1143
1164
  return;
@@ -661,7 +661,7 @@ async function ensureCompatibilityViews(prisma) {
661
661
  for (const mapping of VIEW_MAPPINGS) {
662
662
  const relation = mapping.source.replace(/"/g, "");
663
663
  const rows = await prisma.$queryRawUnsafe(
664
- "SELECT to_regclass($1) AS regclass",
664
+ "SELECT to_regclass($1)::text AS regclass",
665
665
  relation
666
666
  );
667
667
  if (!rows[0]?.regclass) {
@@ -655,7 +655,7 @@ async function ensureCompatibilityViews(prisma) {
655
655
  for (const mapping of VIEW_MAPPINGS) {
656
656
  const relation = mapping.source.replace(/"/g, "");
657
657
  const rows = await prisma.$queryRawUnsafe(
658
- "SELECT to_regclass($1) AS regclass",
658
+ "SELECT to_regclass($1)::text AS regclass",
659
659
  relation
660
660
  );
661
661
  if (!rows[0]?.regclass) {
@@ -666,7 +666,7 @@ async function ensureCompatibilityViews(prisma) {
666
666
  for (const mapping of VIEW_MAPPINGS) {
667
667
  const relation = mapping.source.replace(/"/g, "");
668
668
  const rows = await prisma.$queryRawUnsafe(
669
- "SELECT to_regclass($1) AS regclass",
669
+ "SELECT to_regclass($1)::text AS regclass",
670
670
  relation
671
671
  );
672
672
  if (!rows[0]?.regclass) {
@@ -655,7 +655,7 @@ async function ensureCompatibilityViews(prisma) {
655
655
  for (const mapping of VIEW_MAPPINGS) {
656
656
  const relation = mapping.source.replace(/"/g, "");
657
657
  const rows = await prisma.$queryRawUnsafe(
658
- "SELECT to_regclass($1) AS regclass",
658
+ "SELECT to_regclass($1)::text AS regclass",
659
659
  relation
660
660
  );
661
661
  if (!rows[0]?.regclass) {
@@ -1177,7 +1177,7 @@ async function ensureCompatibilityViews(prisma) {
1177
1177
  for (const mapping of VIEW_MAPPINGS) {
1178
1178
  const relation = mapping.source.replace(/"/g, "");
1179
1179
  const rows = await prisma.$queryRawUnsafe(
1180
- "SELECT to_regclass($1) AS regclass",
1180
+ "SELECT to_regclass($1)::text AS regclass",
1181
1181
  relation
1182
1182
  );
1183
1183
  if (!rows[0]?.regclass) {
@@ -1531,8 +1531,29 @@ function findPackageRoot() {
1531
1531
  }
1532
1532
  return null;
1533
1533
  }
1534
+ function getAvailableMemoryGB() {
1535
+ if (process.platform === "darwin") {
1536
+ try {
1537
+ const { execSync: execSync8 } = __require("child_process");
1538
+ const vmstat = execSync8("vm_stat", { encoding: "utf8" });
1539
+ const pageSize = 16384;
1540
+ const pageSizeMatch = vmstat.match(/page size of (\d+) bytes/);
1541
+ const actualPageSize = pageSizeMatch ? parseInt(pageSizeMatch[1], 10) : pageSize;
1542
+ const free = vmstat.match(/Pages free:\s+(\d+)/);
1543
+ const inactive = vmstat.match(/Pages inactive:\s+(\d+)/);
1544
+ const speculative = vmstat.match(/Pages speculative:\s+(\d+)/);
1545
+ const freePages = free ? parseInt(free[1], 10) : 0;
1546
+ const inactivePages = inactive ? parseInt(inactive[1], 10) : 0;
1547
+ const speculativePages = speculative ? parseInt(speculative[1], 10) : 0;
1548
+ return (freePages + inactivePages + speculativePages) * actualPageSize / (1024 * 1024 * 1024);
1549
+ } catch {
1550
+ return os6.freemem() / (1024 * 1024 * 1024);
1551
+ }
1552
+ }
1553
+ return os6.freemem() / (1024 * 1024 * 1024);
1554
+ }
1534
1555
  function spawnDaemon() {
1535
- const freeGB = os6.freemem() / (1024 * 1024 * 1024);
1556
+ const freeGB = getAvailableMemoryGB();
1536
1557
  const totalGB = os6.totalmem() / (1024 * 1024 * 1024);
1537
1558
  if (totalGB <= 8) {
1538
1559
  process.stderr.write(
@@ -1541,9 +1562,9 @@ function spawnDaemon() {
1541
1562
  );
1542
1563
  return;
1543
1564
  }
1544
- if (totalGB <= 16 && freeGB < 4) {
1565
+ if (totalGB <= 16 && freeGB < 2) {
1545
1566
  process.stderr.write(
1546
- `[exed-client] SKIP: low memory (${freeGB.toFixed(1)}GB free / ${totalGB.toFixed(0)}GB total). Embedding daemon not started \u2014 using keyword search only.
1567
+ `[exed-client] SKIP: low memory (${freeGB.toFixed(1)}GB available / ${totalGB.toFixed(0)}GB total). Embedding daemon not started \u2014 using keyword search only.
1547
1568
  `
1548
1569
  );
1549
1570
  return;
@@ -644,7 +644,7 @@ async function ensureCompatibilityViews(prisma) {
644
644
  for (const mapping of VIEW_MAPPINGS) {
645
645
  const relation = mapping.source.replace(/"/g, "");
646
646
  const rows = await prisma.$queryRawUnsafe(
647
- "SELECT to_regclass($1) AS regclass",
647
+ "SELECT to_regclass($1)::text AS regclass",
648
648
  relation
649
649
  );
650
650
  if (!rows[0]?.regclass) {
@@ -644,7 +644,7 @@ async function ensureCompatibilityViews(prisma) {
644
644
  for (const mapping of VIEW_MAPPINGS) {
645
645
  const relation = mapping.source.replace(/"/g, "");
646
646
  const rows = await prisma.$queryRawUnsafe(
647
- "SELECT to_regclass($1) AS regclass",
647
+ "SELECT to_regclass($1)::text AS regclass",
648
648
  relation
649
649
  );
650
650
  if (!rows[0]?.regclass) {
@@ -1189,7 +1189,7 @@ async function ensureCompatibilityViews(prisma) {
1189
1189
  for (const mapping of VIEW_MAPPINGS) {
1190
1190
  const relation = mapping.source.replace(/"/g, "");
1191
1191
  const rows = await prisma.$queryRawUnsafe(
1192
- "SELECT to_regclass($1) AS regclass",
1192
+ "SELECT to_regclass($1)::text AS regclass",
1193
1193
  relation
1194
1194
  );
1195
1195
  if (!rows[0]?.regclass) {
@@ -1543,8 +1543,29 @@ function findPackageRoot() {
1543
1543
  }
1544
1544
  return null;
1545
1545
  }
1546
+ function getAvailableMemoryGB() {
1547
+ if (process.platform === "darwin") {
1548
+ try {
1549
+ const { execSync: execSync7 } = __require("child_process");
1550
+ const vmstat = execSync7("vm_stat", { encoding: "utf8" });
1551
+ const pageSize = 16384;
1552
+ const pageSizeMatch = vmstat.match(/page size of (\d+) bytes/);
1553
+ const actualPageSize = pageSizeMatch ? parseInt(pageSizeMatch[1], 10) : pageSize;
1554
+ const free = vmstat.match(/Pages free:\s+(\d+)/);
1555
+ const inactive = vmstat.match(/Pages inactive:\s+(\d+)/);
1556
+ const speculative = vmstat.match(/Pages speculative:\s+(\d+)/);
1557
+ const freePages = free ? parseInt(free[1], 10) : 0;
1558
+ const inactivePages = inactive ? parseInt(inactive[1], 10) : 0;
1559
+ const speculativePages = speculative ? parseInt(speculative[1], 10) : 0;
1560
+ return (freePages + inactivePages + speculativePages) * actualPageSize / (1024 * 1024 * 1024);
1561
+ } catch {
1562
+ return os6.freemem() / (1024 * 1024 * 1024);
1563
+ }
1564
+ }
1565
+ return os6.freemem() / (1024 * 1024 * 1024);
1566
+ }
1546
1567
  function spawnDaemon() {
1547
- const freeGB = os6.freemem() / (1024 * 1024 * 1024);
1568
+ const freeGB = getAvailableMemoryGB();
1548
1569
  const totalGB = os6.totalmem() / (1024 * 1024 * 1024);
1549
1570
  if (totalGB <= 8) {
1550
1571
  process.stderr.write(
@@ -1553,9 +1574,9 @@ function spawnDaemon() {
1553
1574
  );
1554
1575
  return;
1555
1576
  }
1556
- if (totalGB <= 16 && freeGB < 4) {
1577
+ if (totalGB <= 16 && freeGB < 2) {
1557
1578
  process.stderr.write(
1558
- `[exed-client] SKIP: low memory (${freeGB.toFixed(1)}GB free / ${totalGB.toFixed(0)}GB total). Embedding daemon not started \u2014 using keyword search only.
1579
+ `[exed-client] SKIP: low memory (${freeGB.toFixed(1)}GB available / ${totalGB.toFixed(0)}GB total). Embedding daemon not started \u2014 using keyword search only.
1559
1580
  `
1560
1581
  );
1561
1582
  return;
package/dist/bin/setup.js CHANGED
@@ -527,8 +527,29 @@ function findPackageRoot() {
527
527
  }
528
528
  return null;
529
529
  }
530
+ function getAvailableMemoryGB() {
531
+ if (process.platform === "darwin") {
532
+ try {
533
+ const { execSync: execSync2 } = __require("child_process");
534
+ const vmstat = execSync2("vm_stat", { encoding: "utf8" });
535
+ const pageSize = 16384;
536
+ const pageSizeMatch = vmstat.match(/page size of (\d+) bytes/);
537
+ const actualPageSize = pageSizeMatch ? parseInt(pageSizeMatch[1], 10) : pageSize;
538
+ const free = vmstat.match(/Pages free:\s+(\d+)/);
539
+ const inactive = vmstat.match(/Pages inactive:\s+(\d+)/);
540
+ const speculative = vmstat.match(/Pages speculative:\s+(\d+)/);
541
+ const freePages = free ? parseInt(free[1], 10) : 0;
542
+ const inactivePages = inactive ? parseInt(inactive[1], 10) : 0;
543
+ const speculativePages = speculative ? parseInt(speculative[1], 10) : 0;
544
+ return (freePages + inactivePages + speculativePages) * actualPageSize / (1024 * 1024 * 1024);
545
+ } catch {
546
+ return os3.freemem() / (1024 * 1024 * 1024);
547
+ }
548
+ }
549
+ return os3.freemem() / (1024 * 1024 * 1024);
550
+ }
530
551
  function spawnDaemon() {
531
- const freeGB = os3.freemem() / (1024 * 1024 * 1024);
552
+ const freeGB = getAvailableMemoryGB();
532
553
  const totalGB = os3.totalmem() / (1024 * 1024 * 1024);
533
554
  if (totalGB <= 8) {
534
555
  process.stderr.write(
@@ -537,9 +558,9 @@ function spawnDaemon() {
537
558
  );
538
559
  return;
539
560
  }
540
- if (totalGB <= 16 && freeGB < 4) {
561
+ if (totalGB <= 16 && freeGB < 2) {
541
562
  process.stderr.write(
542
- `[exed-client] SKIP: low memory (${freeGB.toFixed(1)}GB free / ${totalGB.toFixed(0)}GB total). Embedding daemon not started \u2014 using keyword search only.
563
+ `[exed-client] SKIP: low memory (${freeGB.toFixed(1)}GB available / ${totalGB.toFixed(0)}GB total). Embedding daemon not started \u2014 using keyword search only.
543
564
  `
544
565
  );
545
566
  return;
@@ -2223,7 +2244,7 @@ async function ensureCompatibilityViews(prisma) {
2223
2244
  for (const mapping of VIEW_MAPPINGS) {
2224
2245
  const relation = mapping.source.replace(/"/g, "");
2225
2246
  const rows = await prisma.$queryRawUnsafe(
2226
- "SELECT to_regclass($1) AS regclass",
2247
+ "SELECT to_regclass($1)::text AS regclass",
2227
2248
  relation
2228
2249
  );
2229
2250
  if (!rows[0]?.regclass) {
@@ -6966,18 +6987,35 @@ function ask(rl, prompt) {
6966
6987
  doAsk();
6967
6988
  });
6968
6989
  }
6969
- function getAvailableMemoryGB() {
6990
+ function getAvailableMemoryGB2() {
6991
+ if (process.platform === "darwin") {
6992
+ try {
6993
+ const { execSync: execSync2 } = __require("child_process");
6994
+ const vmstat = execSync2("vm_stat", { encoding: "utf8" });
6995
+ const pageSizeMatch = vmstat.match(/page size of (\d+) bytes/);
6996
+ const pageSize = pageSizeMatch ? parseInt(pageSizeMatch[1], 10) : 16384;
6997
+ const free = vmstat.match(/Pages free:\s+(\d+)/);
6998
+ const inactive = vmstat.match(/Pages inactive:\s+(\d+)/);
6999
+ const speculative = vmstat.match(/Pages speculative:\s+(\d+)/);
7000
+ const freePages = free ? parseInt(free[1], 10) : 0;
7001
+ const inactivePages = inactive ? parseInt(inactive[1], 10) : 0;
7002
+ const speculativePages = speculative ? parseInt(speculative[1], 10) : 0;
7003
+ return (freePages + inactivePages + speculativePages) * pageSize / (1024 * 1024 * 1024);
7004
+ } catch {
7005
+ return os8.freemem() / (1024 * 1024 * 1024);
7006
+ }
7007
+ }
6970
7008
  return os8.freemem() / (1024 * 1024 * 1024);
6971
7009
  }
6972
7010
  function getTotalMemoryGB() {
6973
7011
  return os8.totalmem() / (1024 * 1024 * 1024);
6974
7012
  }
6975
7013
  function isLowMemory() {
6976
- return getAvailableMemoryGB() < 2;
7014
+ return getAvailableMemoryGB2() < 2;
6977
7015
  }
6978
7016
  async function validateModel(log) {
6979
7017
  const totalGB = getTotalMemoryGB();
6980
- const freeGB = getAvailableMemoryGB();
7018
+ const freeGB = getAvailableMemoryGB2();
6981
7019
  if (totalGB <= 8 || isLowMemory()) {
6982
7020
  log(`System memory: ${totalGB.toFixed(0)}GB total, ${freeGB.toFixed(1)}GB free`);
6983
7021
  log("Skipping in-memory model validation (low memory \u2014 will validate on first use).");
@@ -7193,7 +7231,7 @@ async function runSetupWizard(opts = {}) {
7193
7231
  skipModel2 = true;
7194
7232
  }
7195
7233
  if (!skipModel2) {
7196
- const freeGB = getAvailableMemoryGB();
7234
+ const freeGB = getAvailableMemoryGB2();
7197
7235
  if (freeGB < 2) {
7198
7236
  log(`\u26A0 Low memory detected: ${freeGB.toFixed(1)}GB free of ${totalGB.toFixed(0)}GB total`);
7199
7237
  log(" Close other applications (browser, Slack, etc.) before continuing.");
@@ -644,7 +644,7 @@ async function ensureCompatibilityViews(prisma) {
644
644
  for (const mapping of VIEW_MAPPINGS) {
645
645
  const relation = mapping.source.replace(/"/g, "");
646
646
  const rows = await prisma.$queryRawUnsafe(
647
- "SELECT to_regclass($1) AS regclass",
647
+ "SELECT to_regclass($1)::text AS regclass",
648
648
  relation
649
649
  );
650
650
  if (!rows[0]?.regclass) {
@@ -644,7 +644,7 @@ async function ensureCompatibilityViews(prisma) {
644
644
  for (const mapping of VIEW_MAPPINGS) {
645
645
  const relation = mapping.source.replace(/"/g, "");
646
646
  const rows = await prisma.$queryRawUnsafe(
647
- "SELECT to_regclass($1) AS regclass",
647
+ "SELECT to_regclass($1)::text AS regclass",
648
648
  relation
649
649
  );
650
650
  if (!rows[0]?.regclass) {