@askexenow/exe-os 0.8.32 → 0.8.36

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 (87) hide show
  1. package/dist/bin/backfill-conversations.js +332 -348
  2. package/dist/bin/backfill-responses.js +72 -12
  3. package/dist/bin/backfill-vectors.js +72 -12
  4. package/dist/bin/cleanup-stale-review-tasks.js +63 -3
  5. package/dist/bin/cli.js +1518 -1122
  6. package/dist/bin/exe-agent.js +4 -4
  7. package/dist/bin/exe-assign.js +80 -18
  8. package/dist/bin/exe-boot.js +408 -89
  9. package/dist/bin/exe-call.js +83 -24
  10. package/dist/bin/exe-dispatch.js +18 -10
  11. package/dist/bin/exe-doctor.js +63 -3
  12. package/dist/bin/exe-export-behaviors.js +64 -3
  13. package/dist/bin/exe-forget.js +69 -4
  14. package/dist/bin/exe-gateway.js +121 -36
  15. package/dist/bin/exe-heartbeat.js +77 -13
  16. package/dist/bin/exe-kill.js +64 -3
  17. package/dist/bin/exe-launch-agent.js +162 -35
  18. package/dist/bin/exe-link.js +946 -0
  19. package/dist/bin/exe-new-employee.js +121 -36
  20. package/dist/bin/exe-pending-messages.js +72 -7
  21. package/dist/bin/exe-pending-notifications.js +63 -3
  22. package/dist/bin/exe-pending-reviews.js +75 -10
  23. package/dist/bin/exe-rename.js +1287 -0
  24. package/dist/bin/exe-review.js +64 -4
  25. package/dist/bin/exe-search.js +79 -13
  26. package/dist/bin/exe-session-cleanup.js +91 -26
  27. package/dist/bin/exe-status.js +64 -4
  28. package/dist/bin/exe-team.js +64 -4
  29. package/dist/bin/git-sweep.js +71 -4
  30. package/dist/bin/graph-backfill.js +64 -3
  31. package/dist/bin/graph-export.js +64 -3
  32. package/dist/bin/install.js +3 -3
  33. package/dist/bin/scan-tasks.js +71 -4
  34. package/dist/bin/setup.js +156 -38
  35. package/dist/bin/shard-migrate.js +64 -3
  36. package/dist/bin/wiki-sync.js +64 -3
  37. package/dist/gateway/index.js +122 -37
  38. package/dist/hooks/bug-report-worker.js +209 -23
  39. package/dist/hooks/commit-complete.js +71 -4
  40. package/dist/hooks/error-recall.js +79 -13
  41. package/dist/hooks/ingest-worker.js +129 -43
  42. package/dist/hooks/instructions-loaded.js +71 -4
  43. package/dist/hooks/notification.js +71 -4
  44. package/dist/hooks/post-compact.js +71 -4
  45. package/dist/hooks/pre-compact.js +71 -4
  46. package/dist/hooks/pre-tool-use.js +413 -194
  47. package/dist/hooks/prompt-ingest-worker.js +82 -22
  48. package/dist/hooks/prompt-submit.js +103 -37
  49. package/dist/hooks/response-ingest-worker.js +87 -22
  50. package/dist/hooks/session-end.js +71 -4
  51. package/dist/hooks/session-start.js +79 -13
  52. package/dist/hooks/stop.js +71 -4
  53. package/dist/hooks/subagent-stop.js +71 -4
  54. package/dist/hooks/summary-worker.js +303 -50
  55. package/dist/index.js +134 -46
  56. package/dist/lib/cloud-sync.js +209 -15
  57. package/dist/lib/consolidation.js +4 -4
  58. package/dist/lib/database.js +64 -2
  59. package/dist/lib/device-registry.js +70 -3
  60. package/dist/lib/employee-templates.js +48 -22
  61. package/dist/lib/employees.js +34 -1
  62. package/dist/lib/exe-daemon.js +136 -53
  63. package/dist/lib/hybrid-search.js +79 -13
  64. package/dist/lib/identity-templates.js +57 -6
  65. package/dist/lib/identity.js +3 -3
  66. package/dist/lib/messaging.js +22 -14
  67. package/dist/lib/reminders.js +3 -3
  68. package/dist/lib/schedules.js +63 -3
  69. package/dist/lib/skill-learning.js +3 -3
  70. package/dist/lib/status-brief.js +63 -5
  71. package/dist/lib/store.js +64 -3
  72. package/dist/lib/task-router.js +4 -2
  73. package/dist/lib/tasks.js +48 -21
  74. package/dist/lib/tmux-routing.js +47 -20
  75. package/dist/mcp/server.js +727 -58
  76. package/dist/mcp/tools/complete-reminder.js +3 -3
  77. package/dist/mcp/tools/create-reminder.js +3 -3
  78. package/dist/mcp/tools/create-task.js +151 -24
  79. package/dist/mcp/tools/deactivate-behavior.js +3 -3
  80. package/dist/mcp/tools/list-reminders.js +3 -3
  81. package/dist/mcp/tools/list-tasks.js +17 -8
  82. package/dist/mcp/tools/send-message.js +24 -16
  83. package/dist/mcp/tools/update-task.js +25 -16
  84. package/dist/runtime/index.js +112 -24
  85. package/dist/tui/App.js +139 -36
  86. package/package.json +6 -2
  87. package/src/commands/exe/rename.md +12 -0
@@ -15,12 +15,68 @@ var __export = (target, all) => {
15
15
  __defProp(target, name, { get: all[name], enumerable: true });
16
16
  };
17
17
 
18
+ // src/lib/db-retry.ts
19
+ function isBusyError(err) {
20
+ if (err instanceof Error) {
21
+ const msg = err.message.toLowerCase();
22
+ return msg.includes("sqlite_busy") || msg.includes("database is locked");
23
+ }
24
+ return false;
25
+ }
26
+ function delay(ms) {
27
+ return new Promise((resolve) => setTimeout(resolve, ms));
28
+ }
29
+ async function retryOnBusy(fn, label) {
30
+ let lastError;
31
+ for (let attempt = 0; attempt <= MAX_RETRIES; attempt++) {
32
+ try {
33
+ return await fn();
34
+ } catch (err) {
35
+ lastError = err;
36
+ if (!isBusyError(err) || attempt === MAX_RETRIES) {
37
+ throw err;
38
+ }
39
+ const backoff = BASE_DELAY_MS * Math.pow(2, attempt);
40
+ const jitter = Math.floor(Math.random() * MAX_JITTER_MS);
41
+ process.stderr.write(
42
+ `[exe-os] SQLITE_BUSY ${label} retry ${attempt + 1}/${MAX_RETRIES} \u2014 waiting ${backoff + jitter}ms
43
+ `
44
+ );
45
+ await delay(backoff + jitter);
46
+ }
47
+ }
48
+ throw lastError;
49
+ }
50
+ function wrapWithRetry(client) {
51
+ return new Proxy(client, {
52
+ get(target, prop, receiver) {
53
+ if (prop === "execute") {
54
+ return (sql) => retryOnBusy(() => target.execute(sql), "execute");
55
+ }
56
+ if (prop === "batch") {
57
+ return (stmts) => retryOnBusy(() => target.batch(stmts), "batch");
58
+ }
59
+ return Reflect.get(target, prop, receiver);
60
+ }
61
+ });
62
+ }
63
+ var MAX_RETRIES, BASE_DELAY_MS, MAX_JITTER_MS;
64
+ var init_db_retry = __esm({
65
+ "src/lib/db-retry.ts"() {
66
+ "use strict";
67
+ MAX_RETRIES = 3;
68
+ BASE_DELAY_MS = 200;
69
+ MAX_JITTER_MS = 300;
70
+ }
71
+ });
72
+
18
73
  // src/lib/database.ts
19
74
  import { createClient } from "@libsql/client";
20
75
  async function initDatabase(config) {
21
76
  if (_client) {
22
77
  _client.close();
23
78
  _client = null;
79
+ _resilientClient = null;
24
80
  }
25
81
  const opts = {
26
82
  url: `file:${config.dbPath}`
@@ -29,17 +85,24 @@ async function initDatabase(config) {
29
85
  opts.encryptionKey = config.encryptionKey;
30
86
  }
31
87
  _client = createClient(opts);
88
+ _resilientClient = wrapWithRetry(_client);
32
89
  }
33
90
  function getClient() {
91
+ if (!_resilientClient) {
92
+ throw new Error("Database client not initialized. Call initDatabase() first.");
93
+ }
94
+ return _resilientClient;
95
+ }
96
+ function getRawClient() {
34
97
  if (!_client) {
35
98
  throw new Error("Database client not initialized. Call initDatabase() first.");
36
99
  }
37
100
  return _client;
38
101
  }
39
102
  async function ensureSchema() {
40
- const client = getClient();
103
+ const client = getRawClient();
41
104
  await client.execute("PRAGMA journal_mode = WAL");
42
- await client.execute("PRAGMA busy_timeout = 5000");
105
+ await client.execute("PRAGMA busy_timeout = 30000");
43
106
  try {
44
107
  await client.execute("PRAGMA libsql_vector_search_ef = 128");
45
108
  } catch {
@@ -828,11 +891,13 @@ async function ensureSchema() {
828
891
  }
829
892
  }
830
893
  }
831
- var _client, initTurso;
894
+ var _client, _resilientClient, initTurso;
832
895
  var init_database = __esm({
833
896
  "src/lib/database.ts"() {
834
897
  "use strict";
898
+ init_db_retry();
835
899
  _client = null;
900
+ _resilientClient = null;
836
901
  initTurso = initDatabase;
837
902
  }
838
903
  });
@@ -1084,7 +1149,7 @@ function listShards() {
1084
1149
  }
1085
1150
  async function ensureShardSchema(client) {
1086
1151
  await client.execute("PRAGMA journal_mode = WAL");
1087
- await client.execute("PRAGMA busy_timeout = 5000");
1152
+ await client.execute("PRAGMA busy_timeout = 30000");
1088
1153
  try {
1089
1154
  await client.execute("PRAGMA libsql_vector_search_ef = 128");
1090
1155
  } catch {
@@ -1270,7 +1335,7 @@ var init_shard_manager = __esm({
1270
1335
 
1271
1336
  // src/lib/employees.ts
1272
1337
  import { readFile as readFile3, writeFile as writeFile3, mkdir as mkdir3 } from "fs/promises";
1273
- import { existsSync as existsSync4, symlinkSync, readlinkSync } from "fs";
1338
+ import { existsSync as existsSync4, symlinkSync, readlinkSync, readFileSync as readFileSync2 } from "fs";
1274
1339
  import { execSync } from "child_process";
1275
1340
  import path4 from "path";
1276
1341
  var EMPLOYEES_PATH;
@@ -1287,7 +1352,7 @@ import crypto2 from "crypto";
1287
1352
  import path5 from "path";
1288
1353
  import os2 from "os";
1289
1354
  import {
1290
- readFileSync as readFileSync2,
1355
+ readFileSync as readFileSync3,
1291
1356
  readdirSync,
1292
1357
  unlinkSync,
1293
1358
  existsSync as existsSync5,
@@ -1305,7 +1370,7 @@ import crypto3 from "crypto";
1305
1370
  import path6 from "path";
1306
1371
  import { execSync as execSync2 } from "child_process";
1307
1372
  import { mkdir as mkdir4, writeFile as writeFile4, appendFile } from "fs/promises";
1308
- import { existsSync as existsSync6, readFileSync as readFileSync3 } from "fs";
1373
+ import { existsSync as existsSync6, readFileSync as readFileSync4 } from "fs";
1309
1374
  var init_tasks_crud = __esm({
1310
1375
  "src/lib/tasks-crud.ts"() {
1311
1376
  "use strict";
@@ -1369,7 +1434,7 @@ var init_provider_table = __esm({
1369
1434
  });
1370
1435
 
1371
1436
  // src/lib/intercom-queue.ts
1372
- import { readFileSync as readFileSync4, writeFileSync, renameSync as renameSync2, existsSync as existsSync7, mkdirSync as mkdirSync2 } from "fs";
1437
+ import { readFileSync as readFileSync5, writeFileSync, renameSync as renameSync2, existsSync as existsSync7, mkdirSync as mkdirSync2 } from "fs";
1373
1438
  import path8 from "path";
1374
1439
  import os4 from "os";
1375
1440
  var QUEUE_PATH, TTL_MS, INTERCOM_LOG;
@@ -1383,7 +1448,7 @@ var init_intercom_queue = __esm({
1383
1448
  });
1384
1449
 
1385
1450
  // src/lib/license.ts
1386
- import { readFileSync as readFileSync5, writeFileSync as writeFileSync2, existsSync as existsSync8, mkdirSync as mkdirSync3 } from "fs";
1451
+ import { readFileSync as readFileSync6, writeFileSync as writeFileSync2, existsSync as existsSync8, mkdirSync as mkdirSync3 } from "fs";
1387
1452
  import { randomUUID } from "crypto";
1388
1453
  import path9 from "path";
1389
1454
  import { jwtVerify, importSPKI } from "jose";
@@ -1399,7 +1464,7 @@ var init_license = __esm({
1399
1464
  });
1400
1465
 
1401
1466
  // src/lib/plan-limits.ts
1402
- import { readFileSync as readFileSync6, existsSync as existsSync9 } from "fs";
1467
+ import { readFileSync as readFileSync7, existsSync as existsSync9 } from "fs";
1403
1468
  import path10 from "path";
1404
1469
  var CACHE_PATH2;
1405
1470
  var init_plan_limits = __esm({