@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
@@ -311,6 +311,13 @@ async function ensureSchema() {
311
311
  });
312
312
  } catch {
313
313
  }
314
+ try {
315
+ await client.execute({
316
+ sql: `ALTER TABLE tasks ADD COLUMN session_scope TEXT`,
317
+ args: []
318
+ });
319
+ } catch {
320
+ }
314
321
  try {
315
322
  await client.execute({
316
323
  sql: `ALTER TABLE memories ADD COLUMN task_id TEXT`,
@@ -757,6 +764,18 @@ async function ensureSchema() {
757
764
  CREATE INDEX IF NOT EXISTS idx_session_kills_agent
758
765
  ON session_kills(agent_id);
759
766
  `);
767
+ await client.execute(`
768
+ CREATE TABLE IF NOT EXISTS global_procedures (
769
+ id TEXT PRIMARY KEY,
770
+ title TEXT NOT NULL,
771
+ content TEXT NOT NULL,
772
+ priority TEXT NOT NULL DEFAULT 'p0',
773
+ domain TEXT,
774
+ active INTEGER NOT NULL DEFAULT 1,
775
+ created_at TEXT NOT NULL,
776
+ updated_at TEXT NOT NULL
777
+ )
778
+ `);
760
779
  await client.executeMultiple(`
761
780
  CREATE TABLE IF NOT EXISTS conversations (
762
781
  id TEXT PRIMARY KEY,
@@ -1212,6 +1231,61 @@ var init_config = __esm({
1212
1231
  }
1213
1232
  });
1214
1233
 
1234
+ // src/lib/state-bus.ts
1235
+ var StateBus, orgBus;
1236
+ var init_state_bus = __esm({
1237
+ "src/lib/state-bus.ts"() {
1238
+ "use strict";
1239
+ StateBus = class {
1240
+ handlers = /* @__PURE__ */ new Map();
1241
+ globalHandlers = /* @__PURE__ */ new Set();
1242
+ /** Emit an event to all subscribers */
1243
+ emit(event) {
1244
+ const typeHandlers = this.handlers.get(event.type);
1245
+ if (typeHandlers) {
1246
+ for (const handler of typeHandlers) {
1247
+ try {
1248
+ handler(event);
1249
+ } catch {
1250
+ }
1251
+ }
1252
+ }
1253
+ for (const handler of this.globalHandlers) {
1254
+ try {
1255
+ handler(event);
1256
+ } catch {
1257
+ }
1258
+ }
1259
+ }
1260
+ /** Subscribe to a specific event type */
1261
+ on(type, handler) {
1262
+ if (!this.handlers.has(type)) {
1263
+ this.handlers.set(type, /* @__PURE__ */ new Set());
1264
+ }
1265
+ this.handlers.get(type).add(handler);
1266
+ }
1267
+ /** Subscribe to ALL events */
1268
+ onAny(handler) {
1269
+ this.globalHandlers.add(handler);
1270
+ }
1271
+ /** Unsubscribe from a specific event type */
1272
+ off(type, handler) {
1273
+ this.handlers.get(type)?.delete(handler);
1274
+ }
1275
+ /** Unsubscribe from ALL events */
1276
+ offAny(handler) {
1277
+ this.globalHandlers.delete(handler);
1278
+ }
1279
+ /** Remove all listeners */
1280
+ clear() {
1281
+ this.handlers.clear();
1282
+ this.globalHandlers.clear();
1283
+ }
1284
+ };
1285
+ orgBus = new StateBus();
1286
+ }
1287
+ });
1288
+
1215
1289
  // src/lib/shard-manager.ts
1216
1290
  var shard_manager_exports = {};
1217
1291
  __export(shard_manager_exports, {
@@ -1453,6 +1527,71 @@ var init_shard_manager = __esm({
1453
1527
  }
1454
1528
  });
1455
1529
 
1530
+ // src/lib/global-procedures.ts
1531
+ var global_procedures_exports = {};
1532
+ __export(global_procedures_exports, {
1533
+ deactivateGlobalProcedure: () => deactivateGlobalProcedure,
1534
+ getGlobalProceduresBlock: () => getGlobalProceduresBlock,
1535
+ loadGlobalProcedures: () => loadGlobalProcedures,
1536
+ storeGlobalProcedure: () => storeGlobalProcedure
1537
+ });
1538
+ import { randomUUID } from "crypto";
1539
+ async function loadGlobalProcedures() {
1540
+ const client = getClient();
1541
+ const result = await client.execute({
1542
+ sql: "SELECT * FROM global_procedures WHERE active = 1 ORDER BY priority ASC, created_at ASC",
1543
+ args: []
1544
+ });
1545
+ const procedures = result.rows;
1546
+ if (procedures.length > 0) {
1547
+ _cache = procedures.map((p) => `### ${p.title}
1548
+ ${p.content}`).join("\n\n");
1549
+ } else {
1550
+ _cache = "";
1551
+ }
1552
+ _cacheLoaded = true;
1553
+ return procedures;
1554
+ }
1555
+ function getGlobalProceduresBlock() {
1556
+ if (!_cacheLoaded) return "";
1557
+ if (!_cache) return "";
1558
+ return `## Organization-Wide Procedures (MANDATORY \u2014 supersedes all other rules)
1559
+
1560
+ ${_cache}
1561
+ `;
1562
+ }
1563
+ async function storeGlobalProcedure(input) {
1564
+ const id = randomUUID();
1565
+ const now = (/* @__PURE__ */ new Date()).toISOString();
1566
+ const client = getClient();
1567
+ await client.execute({
1568
+ sql: `INSERT INTO global_procedures (id, title, content, priority, domain, active, created_at, updated_at)
1569
+ VALUES (?, ?, ?, ?, ?, 1, ?, ?)`,
1570
+ args: [id, input.title, input.content, input.priority ?? "p0", input.domain ?? null, now, now]
1571
+ });
1572
+ await loadGlobalProcedures();
1573
+ return id;
1574
+ }
1575
+ async function deactivateGlobalProcedure(id) {
1576
+ const now = (/* @__PURE__ */ new Date()).toISOString();
1577
+ const client = getClient();
1578
+ const result = await client.execute({
1579
+ sql: "UPDATE global_procedures SET active = 0, updated_at = ? WHERE id = ?",
1580
+ args: [now, id]
1581
+ });
1582
+ await loadGlobalProcedures();
1583
+ return result.rowsAffected > 0;
1584
+ }
1585
+ var _cache, _cacheLoaded;
1586
+ var init_global_procedures = __esm({
1587
+ "src/lib/global-procedures.ts"() {
1588
+ "use strict";
1589
+ init_database();
1590
+ _cache = "";
1591
+ _cacheLoaded = false;
1592
+ }
1593
+ });
1594
+
1456
1595
  // src/lib/store.ts
1457
1596
  var store_exports = {};
1458
1597
  __export(store_exports, {
@@ -1532,6 +1671,11 @@ async function initStore(options) {
1532
1671
  "version-query"
1533
1672
  );
1534
1673
  _nextVersion = (Number(vResult.rows[0]?.max_v) || 0) + 1;
1674
+ try {
1675
+ const { loadGlobalProcedures: loadGlobalProcedures2 } = await Promise.resolve().then(() => (init_global_procedures(), global_procedures_exports));
1676
+ await loadGlobalProcedures2();
1677
+ } catch {
1678
+ }
1535
1679
  }
1536
1680
  function classifyTier(record) {
1537
1681
  if (record.tool_name === "commit_to_long_term_memory" && (record.importance ?? 0) >= 8) return 1;
@@ -1573,6 +1717,12 @@ async function writeMemory(record) {
1573
1717
  supersedes_id: record.supersedes_id ?? null
1574
1718
  };
1575
1719
  _pendingRecords.push(dbRow);
1720
+ orgBus.emit({
1721
+ type: "memory_stored",
1722
+ agentId: record.agent_id,
1723
+ project: record.project_name,
1724
+ timestamp: record.timestamp
1725
+ });
1576
1726
  const MAX_PENDING = 1e3;
1577
1727
  if (_pendingRecords.length > MAX_PENDING) {
1578
1728
  const dropped = _pendingRecords.length - MAX_PENDING;
@@ -1918,6 +2068,7 @@ var init_store = __esm({
1918
2068
  init_database();
1919
2069
  init_keychain();
1920
2070
  init_config();
2071
+ init_state_bus();
1921
2072
  INIT_MAX_RETRIES = 3;
1922
2073
  INIT_RETRY_DELAY_MS = 1e3;
1923
2074
  _pendingRecords = [];
@@ -2021,7 +2172,7 @@ var init_self_query_router = __esm({
2021
2172
  // src/lib/exe-daemon-client.ts
2022
2173
  import net from "net";
2023
2174
  import { spawn } from "child_process";
2024
- import { randomUUID } from "crypto";
2175
+ import { randomUUID as randomUUID2 } from "crypto";
2025
2176
  import { existsSync as existsSync4, unlinkSync, readFileSync as readFileSync2, openSync, closeSync, statSync } from "fs";
2026
2177
  import path4 from "path";
2027
2178
  import { fileURLToPath } from "url";
@@ -2213,7 +2364,7 @@ function sendRequest(texts, priority) {
2213
2364
  resolve({ error: "Not connected" });
2214
2365
  return;
2215
2366
  }
2216
- const id = randomUUID();
2367
+ const id = randomUUID2();
2217
2368
  const timer = setTimeout(() => {
2218
2369
  _pending.delete(id);
2219
2370
  resolve({ error: "Request timeout" });
@@ -2231,7 +2382,7 @@ function sendRequest(texts, priority) {
2231
2382
  async function pingDaemon() {
2232
2383
  if (!_socket || !_connected) return null;
2233
2384
  return new Promise((resolve) => {
2234
- const id = randomUUID();
2385
+ const id = randomUUID2();
2235
2386
  const timer = setTimeout(() => {
2236
2387
  _pending.delete(id);
2237
2388
  resolve(null);