@askexenow/exe-os 0.8.38 → 0.8.39

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 (91) hide show
  1. package/README.md +17 -8
  2. package/dist/bin/backfill-conversations.js +46 -10
  3. package/dist/bin/backfill-responses.js +46 -10
  4. package/dist/bin/backfill-vectors.js +42 -8
  5. package/dist/bin/cleanup-stale-review-tasks.js +37 -8
  6. package/dist/bin/cli.js +281 -154
  7. package/dist/bin/exe-agent.js +19 -4
  8. package/dist/bin/exe-assign.js +39 -5
  9. package/dist/bin/exe-boot.js +237 -111
  10. package/dist/bin/exe-call.js +11 -6
  11. package/dist/bin/exe-cloud.js +99 -28
  12. package/dist/bin/exe-dispatch.js +1 -1
  13. package/dist/bin/exe-doctor.js +37 -8
  14. package/dist/bin/exe-export-behaviors.js +39 -10
  15. package/dist/bin/exe-forget.js +38 -9
  16. package/dist/bin/exe-gateway.js +109 -42
  17. package/dist/bin/exe-heartbeat.js +49 -20
  18. package/dist/bin/exe-kill.js +39 -10
  19. package/dist/bin/exe-launch-agent.js +58 -22
  20. package/dist/bin/exe-link.js +184 -85
  21. package/dist/bin/exe-new-employee.js +21 -7
  22. package/dist/bin/exe-pending-messages.js +46 -17
  23. package/dist/bin/exe-pending-notifications.js +37 -8
  24. package/dist/bin/exe-pending-reviews.js +47 -18
  25. package/dist/bin/exe-rename.js +21 -7
  26. package/dist/bin/exe-review.js +34 -5
  27. package/dist/bin/exe-search.js +47 -10
  28. package/dist/bin/exe-session-cleanup.js +56 -19
  29. package/dist/bin/exe-settings.js +63 -2
  30. package/dist/bin/exe-status.js +34 -5
  31. package/dist/bin/exe-team.js +34 -5
  32. package/dist/bin/git-sweep.js +38 -9
  33. package/dist/bin/graph-backfill.js +37 -8
  34. package/dist/bin/graph-export.js +37 -8
  35. package/dist/bin/install.js +1 -1
  36. package/dist/bin/scan-tasks.js +40 -11
  37. package/dist/bin/setup.js +58 -24
  38. package/dist/bin/shard-migrate.js +37 -8
  39. package/dist/bin/wiki-sync.js +39 -9
  40. package/dist/gateway/index.js +102 -37
  41. package/dist/hooks/bug-report-worker.js +62 -28
  42. package/dist/hooks/commit-complete.js +38 -9
  43. package/dist/hooks/error-recall.js +49 -8
  44. package/dist/hooks/exe-heartbeat-hook.js +3 -2
  45. package/dist/hooks/ingest-worker.js +151 -37
  46. package/dist/hooks/ingest.js +74 -28
  47. package/dist/hooks/instructions-loaded.js +39 -9
  48. package/dist/hooks/notification.js +37 -7
  49. package/dist/hooks/post-compact.js +37 -7
  50. package/dist/hooks/pre-compact.js +35 -6
  51. package/dist/hooks/pre-tool-use.js +52 -14
  52. package/dist/hooks/prompt-ingest-worker.js +56 -10
  53. package/dist/hooks/prompt-submit.js +61 -23
  54. package/dist/hooks/response-ingest-worker.js +57 -11
  55. package/dist/hooks/session-end.js +43 -10
  56. package/dist/hooks/session-start.js +46 -8
  57. package/dist/hooks/stop.js +37 -7
  58. package/dist/hooks/subagent-stop.js +37 -7
  59. package/dist/hooks/summary-worker.js +317 -99
  60. package/dist/index.js +87 -22
  61. package/dist/lib/cloud-sync.js +172 -78
  62. package/dist/lib/config.js +4 -1
  63. package/dist/lib/consolidation.js +5 -4
  64. package/dist/lib/database.js +1 -0
  65. package/dist/lib/device-registry.js +2 -1
  66. package/dist/lib/embedder.js +9 -1
  67. package/dist/lib/employees.js +11 -6
  68. package/dist/lib/exe-daemon-client.js +6 -1
  69. package/dist/lib/exe-daemon.js +71 -28
  70. package/dist/lib/hybrid-search.js +47 -10
  71. package/dist/lib/identity.js +1 -1
  72. package/dist/lib/keychain.js +2 -1
  73. package/dist/lib/license.js +13 -4
  74. package/dist/lib/messaging.js +1 -1
  75. package/dist/lib/reminders.js +2 -2
  76. package/dist/lib/schedules.js +37 -8
  77. package/dist/lib/skill-learning.js +1 -1
  78. package/dist/lib/store.js +37 -8
  79. package/dist/lib/tasks.js +1 -1
  80. package/dist/lib/tmux-routing.js +1 -1
  81. package/dist/mcp/server.js +97 -43
  82. package/dist/mcp/tools/complete-reminder.js +1 -1
  83. package/dist/mcp/tools/create-task.js +14 -6
  84. package/dist/mcp/tools/deactivate-behavior.js +2 -2
  85. package/dist/mcp/tools/list-reminders.js +1 -1
  86. package/dist/mcp/tools/list-tasks.js +1 -1
  87. package/dist/mcp/tools/send-message.js +1 -1
  88. package/dist/mcp/tools/update-task.js +1 -1
  89. package/dist/runtime/index.js +35 -6
  90. package/dist/tui/App.js +177 -95
  91. package/package.json +3 -3
@@ -1094,7 +1094,8 @@ var OllamaProvider = class {
1094
1094
  const res = await fetch(`${this.host}/api/chat`, {
1095
1095
  method: "POST",
1096
1096
  headers: { "Content-Type": "application/json" },
1097
- body: JSON.stringify(body)
1097
+ body: JSON.stringify(body),
1098
+ signal: AbortSignal.timeout(3e4)
1098
1099
  });
1099
1100
  if (!res.ok) {
1100
1101
  throw new Error(`Ollama API error: ${res.status} ${await res.text()}`);
@@ -1425,10 +1426,19 @@ var BashTool = {
1425
1426
  stdio: ["ignore", "pipe", "pipe"],
1426
1427
  env: { ...process.env }
1427
1428
  });
1429
+ const MAX_OUTPUT_SIZE = 5242880;
1428
1430
  const stdoutChunks = [];
1429
1431
  const stderrChunks = [];
1430
- child.stdout.on("data", (chunk) => stdoutChunks.push(chunk));
1431
- child.stderr.on("data", (chunk) => stderrChunks.push(chunk));
1432
+ let stdoutSize = 0;
1433
+ let stderrSize = 0;
1434
+ child.stdout.on("data", (chunk) => {
1435
+ if (stdoutSize < MAX_OUTPUT_SIZE) stdoutChunks.push(chunk);
1436
+ stdoutSize += chunk.length;
1437
+ });
1438
+ child.stderr.on("data", (chunk) => {
1439
+ if (stderrSize < MAX_OUTPUT_SIZE) stderrChunks.push(chunk);
1440
+ stderrSize += chunk.length;
1441
+ });
1432
1442
  const onAbort = () => {
1433
1443
  child.kill("SIGTERM");
1434
1444
  setTimeout(() => {
@@ -1829,8 +1839,13 @@ function runRipgrep(input, searchPath, context) {
1829
1839
  timeout: 3e4,
1830
1840
  stdio: ["ignore", "pipe", "pipe"]
1831
1841
  });
1842
+ const MAX_OUTPUT = 1e7;
1832
1843
  const chunks = [];
1833
- child.stdout.on("data", (chunk) => chunks.push(chunk));
1844
+ let totalSize = 0;
1845
+ child.stdout.on("data", (chunk) => {
1846
+ totalSize += chunk.length;
1847
+ if (totalSize <= MAX_OUTPUT) chunks.push(chunk);
1848
+ });
1834
1849
  const onAbort = () => child.kill("SIGTERM");
1835
1850
  context.abortSignal.addEventListener("abort", onAbort, { once: true });
1836
1851
  child.on("close", (code) => {
@@ -10,7 +10,7 @@ var __export = (target, all) => {
10
10
  };
11
11
 
12
12
  // src/lib/config.ts
13
- import { readFile, writeFile, mkdir } from "fs/promises";
13
+ import { readFile, writeFile, mkdir, chmod } from "fs/promises";
14
14
  import { readFileSync, existsSync, renameSync } from "fs";
15
15
  import path from "path";
16
16
  import os from "os";
@@ -607,8 +607,13 @@ var _buffer = "";
607
607
  var _requestCount = 0;
608
608
  var HEALTH_CHECK_INTERVAL = 100;
609
609
  var _pending = /* @__PURE__ */ new Map();
610
+ var MAX_BUFFER = 1e7;
610
611
  function handleData(chunk) {
611
612
  _buffer += chunk.toString();
613
+ if (_buffer.length > MAX_BUFFER) {
614
+ _buffer = "";
615
+ return;
616
+ }
612
617
  let newlineIdx;
613
618
  while ((newlineIdx = _buffer.indexOf("\n")) !== -1) {
614
619
  const line = _buffer.slice(0, newlineIdx).trim();
@@ -1008,6 +1013,7 @@ async function ensureSchema() {
1008
1013
  const client = getRawClient();
1009
1014
  await client.execute("PRAGMA journal_mode = WAL");
1010
1015
  await client.execute("PRAGMA busy_timeout = 30000");
1016
+ await client.execute("PRAGMA wal_autocheckpoint = 1000");
1011
1017
  try {
1012
1018
  await client.execute("PRAGMA libsql_vector_search_ef = 128");
1013
1019
  } catch {
@@ -1798,14 +1804,15 @@ async function ensureSchema() {
1798
1804
  }
1799
1805
 
1800
1806
  // src/lib/keychain.ts
1801
- import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod } from "fs/promises";
1807
+ import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2 } from "fs/promises";
1802
1808
  import { existsSync as existsSync4 } from "fs";
1803
1809
  import path4 from "path";
1810
+ import os2 from "os";
1804
1811
  import crypto from "crypto";
1805
1812
  var SERVICE = "exe-mem";
1806
1813
  var ACCOUNT = "master-key";
1807
1814
  function getKeyDir() {
1808
- return process.env.EXE_OS_DIR ?? process.env.EXE_MEM_DIR ?? path4.join(process.env.HOME ?? "/tmp", ".exe-os");
1815
+ return process.env.EXE_OS_DIR ?? process.env.EXE_MEM_DIR ?? path4.join(os2.homedir(), ".exe-os");
1809
1816
  }
1810
1817
  function getKeyPath() {
1811
1818
  return path4.join(getKeyDir(), "master.key");
@@ -1842,6 +1849,30 @@ async function getMasterKey() {
1842
1849
 
1843
1850
  // src/lib/store.ts
1844
1851
  init_config();
1852
+ var INIT_MAX_RETRIES = 3;
1853
+ var INIT_RETRY_DELAY_MS = 1e3;
1854
+ function isBusyError2(err) {
1855
+ if (err instanceof Error) {
1856
+ const msg = err.message.toLowerCase();
1857
+ return msg.includes("sqlite_busy") || msg.includes("database is locked");
1858
+ }
1859
+ return false;
1860
+ }
1861
+ async function retryOnBusy2(fn, label) {
1862
+ for (let attempt = 0; attempt <= INIT_MAX_RETRIES; attempt++) {
1863
+ try {
1864
+ return await fn();
1865
+ } catch (err) {
1866
+ if (!isBusyError2(err) || attempt === INIT_MAX_RETRIES) throw err;
1867
+ process.stderr.write(
1868
+ `[store] SQLITE_BUSY during ${label}, retry ${attempt + 1}/${INIT_MAX_RETRIES}
1869
+ `
1870
+ );
1871
+ await new Promise((r) => setTimeout(r, INIT_RETRY_DELAY_MS * (attempt + 1)));
1872
+ }
1873
+ }
1874
+ throw new Error("unreachable");
1875
+ }
1845
1876
  var _pendingRecords = [];
1846
1877
  var _batchSize = 20;
1847
1878
  var _flushIntervalMs = 1e4;
@@ -1876,14 +1907,17 @@ async function initStore(options) {
1876
1907
  dbPath,
1877
1908
  encryptionKey: hexKey
1878
1909
  });
1879
- await ensureSchema();
1910
+ await retryOnBusy2(() => ensureSchema(), "ensureSchema");
1880
1911
  try {
1881
1912
  const { initShardManager: initShardManager2 } = await Promise.resolve().then(() => (init_shard_manager(), shard_manager_exports));
1882
1913
  initShardManager2(hexKey);
1883
1914
  } catch {
1884
1915
  }
1885
1916
  const client = getClient();
1886
- const vResult = await client.execute("SELECT MAX(version) as max_v FROM memories");
1917
+ const vResult = await retryOnBusy2(
1918
+ () => client.execute("SELECT MAX(version) as max_v FROM memories"),
1919
+ "version-query"
1920
+ );
1887
1921
  _nextVersion = (Number(vResult.rows[0]?.max_v) || 0) + 1;
1888
1922
  }
1889
1923
  function classifyTier(record) {