@askexenow/exe-os 0.8.41 → 0.8.43

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 (76) hide show
  1. package/dist/bin/backfill-conversations.js +805 -642
  2. package/dist/bin/backfill-responses.js +804 -641
  3. package/dist/bin/backfill-vectors.js +791 -634
  4. package/dist/bin/cleanup-stale-review-tasks.js +788 -631
  5. package/dist/bin/cli.js +1345 -660
  6. package/dist/bin/exe-agent.js +20 -1
  7. package/dist/bin/exe-assign.js +1503 -1343
  8. package/dist/bin/exe-boot.js +2518 -1798
  9. package/dist/bin/exe-call.js +39 -1
  10. package/dist/bin/exe-cloud.js +15 -1
  11. package/dist/bin/exe-dispatch.js +39 -2
  12. package/dist/bin/exe-doctor.js +790 -633
  13. package/dist/bin/exe-export-behaviors.js +792 -637
  14. package/dist/bin/exe-forget.js +145 -0
  15. package/dist/bin/exe-gateway.js +2500 -1877
  16. package/dist/bin/exe-heartbeat.js +147 -1
  17. package/dist/bin/exe-kill.js +795 -640
  18. package/dist/bin/exe-launch-agent.js +2168 -2008
  19. package/dist/bin/exe-link.js +28 -2
  20. package/dist/bin/exe-new-employee.js +25 -3
  21. package/dist/bin/exe-pending-messages.js +146 -1
  22. package/dist/bin/exe-pending-notifications.js +788 -631
  23. package/dist/bin/exe-pending-reviews.js +147 -1
  24. package/dist/bin/exe-rename.js +23 -0
  25. package/dist/bin/exe-review.js +490 -327
  26. package/dist/bin/exe-search.js +154 -3
  27. package/dist/bin/exe-session-cleanup.js +2466 -413
  28. package/dist/bin/exe-status.js +474 -317
  29. package/dist/bin/exe-team.js +474 -317
  30. package/dist/bin/git-sweep.js +2690 -150
  31. package/dist/bin/graph-backfill.js +794 -637
  32. package/dist/bin/graph-export.js +798 -641
  33. package/dist/bin/scan-tasks.js +2951 -44
  34. package/dist/bin/setup.js +62 -26
  35. package/dist/bin/shard-migrate.js +792 -637
  36. package/dist/bin/wiki-sync.js +794 -637
  37. package/dist/gateway/index.js +2504 -1895
  38. package/dist/hooks/bug-report-worker.js +2118 -576
  39. package/dist/hooks/commit-complete.js +2689 -149
  40. package/dist/hooks/error-recall.js +154 -3
  41. package/dist/hooks/ingest-worker.js +1439 -815
  42. package/dist/hooks/instructions-loaded.js +151 -0
  43. package/dist/hooks/notification.js +153 -2
  44. package/dist/hooks/post-compact.js +164 -0
  45. package/dist/hooks/pre-compact.js +3073 -101
  46. package/dist/hooks/pre-tool-use.js +151 -0
  47. package/dist/hooks/prompt-ingest-worker.js +1714 -1537
  48. package/dist/hooks/prompt-submit.js +2658 -1113
  49. package/dist/hooks/response-ingest-worker.js +170 -6
  50. package/dist/hooks/session-end.js +153 -2
  51. package/dist/hooks/session-start.js +154 -3
  52. package/dist/hooks/stop.js +151 -0
  53. package/dist/hooks/subagent-stop.js +151 -0
  54. package/dist/hooks/summary-worker.js +179 -7
  55. package/dist/index.js +278 -100
  56. package/dist/lib/cloud-sync.js +28 -2
  57. package/dist/lib/consolidation.js +69 -2
  58. package/dist/lib/database.js +19 -0
  59. package/dist/lib/device-registry.js +19 -0
  60. package/dist/lib/employee-templates.js +20 -1
  61. package/dist/lib/exe-daemon.js +236 -16
  62. package/dist/lib/hybrid-search.js +154 -3
  63. package/dist/lib/license.js +15 -1
  64. package/dist/lib/messaging.js +39 -2
  65. package/dist/lib/schedules.js +792 -637
  66. package/dist/lib/store.js +796 -636
  67. package/dist/lib/tasks.js +1614 -1091
  68. package/dist/lib/tmux-routing.js +149 -9
  69. package/dist/mcp/server.js +1825 -1138
  70. package/dist/mcp/tools/create-task.js +2280 -828
  71. package/dist/mcp/tools/list-tasks.js +2788 -159
  72. package/dist/mcp/tools/send-message.js +39 -2
  73. package/dist/mcp/tools/update-task.js +64 -0
  74. package/dist/runtime/index.js +235 -67
  75. package/dist/tui/App.js +1452 -644
  76. package/package.json +3 -2
@@ -302,6 +302,13 @@ async function ensureSchema() {
302
302
  });
303
303
  } catch {
304
304
  }
305
+ try {
306
+ await client.execute({
307
+ sql: `ALTER TABLE tasks ADD COLUMN session_scope TEXT`,
308
+ args: []
309
+ });
310
+ } catch {
311
+ }
305
312
  try {
306
313
  await client.execute({
307
314
  sql: `ALTER TABLE memories ADD COLUMN task_id TEXT`,
@@ -748,6 +755,18 @@ async function ensureSchema() {
748
755
  CREATE INDEX IF NOT EXISTS idx_session_kills_agent
749
756
  ON session_kills(agent_id);
750
757
  `);
758
+ await client.execute(`
759
+ CREATE TABLE IF NOT EXISTS global_procedures (
760
+ id TEXT PRIMARY KEY,
761
+ title TEXT NOT NULL,
762
+ content TEXT NOT NULL,
763
+ priority TEXT NOT NULL DEFAULT 'p0',
764
+ domain TEXT,
765
+ active INTEGER NOT NULL DEFAULT 1,
766
+ created_at TEXT NOT NULL,
767
+ updated_at TEXT NOT NULL
768
+ )
769
+ `);
751
770
  await client.executeMultiple(`
752
771
  CREATE TABLE IF NOT EXISTS conversations (
753
772
  id TEXT PRIMARY KEY,
@@ -1105,6 +1124,61 @@ var init_config = __esm({
1105
1124
  }
1106
1125
  });
1107
1126
 
1127
+ // src/lib/state-bus.ts
1128
+ var StateBus, orgBus;
1129
+ var init_state_bus = __esm({
1130
+ "src/lib/state-bus.ts"() {
1131
+ "use strict";
1132
+ StateBus = class {
1133
+ handlers = /* @__PURE__ */ new Map();
1134
+ globalHandlers = /* @__PURE__ */ new Set();
1135
+ /** Emit an event to all subscribers */
1136
+ emit(event) {
1137
+ const typeHandlers = this.handlers.get(event.type);
1138
+ if (typeHandlers) {
1139
+ for (const handler of typeHandlers) {
1140
+ try {
1141
+ handler(event);
1142
+ } catch {
1143
+ }
1144
+ }
1145
+ }
1146
+ for (const handler of this.globalHandlers) {
1147
+ try {
1148
+ handler(event);
1149
+ } catch {
1150
+ }
1151
+ }
1152
+ }
1153
+ /** Subscribe to a specific event type */
1154
+ on(type, handler) {
1155
+ if (!this.handlers.has(type)) {
1156
+ this.handlers.set(type, /* @__PURE__ */ new Set());
1157
+ }
1158
+ this.handlers.get(type).add(handler);
1159
+ }
1160
+ /** Subscribe to ALL events */
1161
+ onAny(handler) {
1162
+ this.globalHandlers.add(handler);
1163
+ }
1164
+ /** Unsubscribe from a specific event type */
1165
+ off(type, handler) {
1166
+ this.handlers.get(type)?.delete(handler);
1167
+ }
1168
+ /** Unsubscribe from ALL events */
1169
+ offAny(handler) {
1170
+ this.globalHandlers.delete(handler);
1171
+ }
1172
+ /** Remove all listeners */
1173
+ clear() {
1174
+ this.handlers.clear();
1175
+ this.globalHandlers.clear();
1176
+ }
1177
+ };
1178
+ orgBus = new StateBus();
1179
+ }
1180
+ });
1181
+
1108
1182
  // src/lib/shard-manager.ts
1109
1183
  var shard_manager_exports = {};
1110
1184
  __export(shard_manager_exports, {
@@ -1346,6 +1420,71 @@ var init_shard_manager = __esm({
1346
1420
  }
1347
1421
  });
1348
1422
 
1423
+ // src/lib/global-procedures.ts
1424
+ var global_procedures_exports = {};
1425
+ __export(global_procedures_exports, {
1426
+ deactivateGlobalProcedure: () => deactivateGlobalProcedure,
1427
+ getGlobalProceduresBlock: () => getGlobalProceduresBlock,
1428
+ loadGlobalProcedures: () => loadGlobalProcedures,
1429
+ storeGlobalProcedure: () => storeGlobalProcedure
1430
+ });
1431
+ import { randomUUID } from "crypto";
1432
+ async function loadGlobalProcedures() {
1433
+ const client = getClient();
1434
+ const result = await client.execute({
1435
+ sql: "SELECT * FROM global_procedures WHERE active = 1 ORDER BY priority ASC, created_at ASC",
1436
+ args: []
1437
+ });
1438
+ const procedures = result.rows;
1439
+ if (procedures.length > 0) {
1440
+ _cache = procedures.map((p) => `### ${p.title}
1441
+ ${p.content}`).join("\n\n");
1442
+ } else {
1443
+ _cache = "";
1444
+ }
1445
+ _cacheLoaded = true;
1446
+ return procedures;
1447
+ }
1448
+ function getGlobalProceduresBlock() {
1449
+ if (!_cacheLoaded) return "";
1450
+ if (!_cache) return "";
1451
+ return `## Organization-Wide Procedures (MANDATORY \u2014 supersedes all other rules)
1452
+
1453
+ ${_cache}
1454
+ `;
1455
+ }
1456
+ async function storeGlobalProcedure(input) {
1457
+ const id = randomUUID();
1458
+ const now = (/* @__PURE__ */ new Date()).toISOString();
1459
+ const client = getClient();
1460
+ await client.execute({
1461
+ sql: `INSERT INTO global_procedures (id, title, content, priority, domain, active, created_at, updated_at)
1462
+ VALUES (?, ?, ?, ?, ?, 1, ?, ?)`,
1463
+ args: [id, input.title, input.content, input.priority ?? "p0", input.domain ?? null, now, now]
1464
+ });
1465
+ await loadGlobalProcedures();
1466
+ return id;
1467
+ }
1468
+ async function deactivateGlobalProcedure(id) {
1469
+ const now = (/* @__PURE__ */ new Date()).toISOString();
1470
+ const client = getClient();
1471
+ const result = await client.execute({
1472
+ sql: "UPDATE global_procedures SET active = 0, updated_at = ? WHERE id = ?",
1473
+ args: [now, id]
1474
+ });
1475
+ await loadGlobalProcedures();
1476
+ return result.rowsAffected > 0;
1477
+ }
1478
+ var _cache, _cacheLoaded;
1479
+ var init_global_procedures = __esm({
1480
+ "src/lib/global-procedures.ts"() {
1481
+ "use strict";
1482
+ init_database();
1483
+ _cache = "";
1484
+ _cacheLoaded = false;
1485
+ }
1486
+ });
1487
+
1349
1488
  // src/lib/employees.ts
1350
1489
  import { readFile as readFile3, writeFile as writeFile3, mkdir as mkdir3 } from "fs/promises";
1351
1490
  import { existsSync as existsSync4, symlinkSync, readlinkSync, readFileSync as readFileSync2 } from "fs";
@@ -1462,7 +1601,7 @@ var init_intercom_queue = __esm({
1462
1601
 
1463
1602
  // src/lib/license.ts
1464
1603
  import { readFileSync as readFileSync6, writeFileSync as writeFileSync2, existsSync as existsSync8, mkdirSync as mkdirSync3 } from "fs";
1465
- import { randomUUID } from "crypto";
1604
+ import { randomUUID as randomUUID2 } from "crypto";
1466
1605
  import path9 from "path";
1467
1606
  import { jwtVerify, importSPKI } from "jose";
1468
1607
  var LICENSE_PATH, CACHE_PATH, DEVICE_ID_PATH;
@@ -1538,6 +1677,7 @@ var init_tasks_review = __esm({
1538
1677
  init_tasks_crud();
1539
1678
  init_tmux_routing();
1540
1679
  init_session_key();
1680
+ init_state_bus();
1541
1681
  }
1542
1682
  });
1543
1683
 
@@ -1596,6 +1736,7 @@ async function getMasterKey() {
1596
1736
 
1597
1737
  // src/lib/store.ts
1598
1738
  init_config();
1739
+ init_state_bus();
1599
1740
  var INIT_MAX_RETRIES = 3;
1600
1741
  var INIT_RETRY_DELAY_MS = 1e3;
1601
1742
  function isBusyError2(err) {
@@ -1666,6 +1807,11 @@ async function initStore(options) {
1666
1807
  "version-query"
1667
1808
  );
1668
1809
  _nextVersion = (Number(vResult.rows[0]?.max_v) || 0) + 1;
1810
+ try {
1811
+ const { loadGlobalProcedures: loadGlobalProcedures2 } = await Promise.resolve().then(() => (init_global_procedures(), global_procedures_exports));
1812
+ await loadGlobalProcedures2();
1813
+ } catch {
1814
+ }
1669
1815
  }
1670
1816
 
1671
1817
  // src/bin/exe-heartbeat.ts