@askexenow/exe-os 0.8.41 → 0.8.42

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 (74) 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 +1326 -655
  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 +2508 -1802
  9. package/dist/bin/exe-call.js +39 -1
  10. package/dist/bin/exe-dispatch.js +39 -2
  11. package/dist/bin/exe-doctor.js +790 -633
  12. package/dist/bin/exe-export-behaviors.js +792 -637
  13. package/dist/bin/exe-forget.js +145 -0
  14. package/dist/bin/exe-gateway.js +2487 -1878
  15. package/dist/bin/exe-heartbeat.js +147 -1
  16. package/dist/bin/exe-kill.js +795 -640
  17. package/dist/bin/exe-launch-agent.js +2168 -2008
  18. package/dist/bin/exe-link.js +9 -1
  19. package/dist/bin/exe-new-employee.js +6 -2
  20. package/dist/bin/exe-pending-messages.js +146 -1
  21. package/dist/bin/exe-pending-notifications.js +788 -631
  22. package/dist/bin/exe-pending-reviews.js +147 -1
  23. package/dist/bin/exe-rename.js +23 -0
  24. package/dist/bin/exe-review.js +490 -327
  25. package/dist/bin/exe-search.js +154 -3
  26. package/dist/bin/exe-session-cleanup.js +2466 -413
  27. package/dist/bin/exe-status.js +474 -317
  28. package/dist/bin/exe-team.js +474 -317
  29. package/dist/bin/git-sweep.js +2690 -150
  30. package/dist/bin/graph-backfill.js +794 -637
  31. package/dist/bin/graph-export.js +798 -641
  32. package/dist/bin/scan-tasks.js +2951 -44
  33. package/dist/bin/setup.js +47 -25
  34. package/dist/bin/shard-migrate.js +792 -637
  35. package/dist/bin/wiki-sync.js +794 -637
  36. package/dist/gateway/index.js +2504 -1895
  37. package/dist/hooks/bug-report-worker.js +2118 -576
  38. package/dist/hooks/commit-complete.js +2689 -149
  39. package/dist/hooks/error-recall.js +154 -3
  40. package/dist/hooks/ingest-worker.js +1420 -814
  41. package/dist/hooks/instructions-loaded.js +151 -0
  42. package/dist/hooks/notification.js +153 -2
  43. package/dist/hooks/post-compact.js +164 -0
  44. package/dist/hooks/pre-compact.js +3073 -101
  45. package/dist/hooks/pre-tool-use.js +151 -0
  46. package/dist/hooks/prompt-ingest-worker.js +1700 -1541
  47. package/dist/hooks/prompt-submit.js +2658 -1113
  48. package/dist/hooks/response-ingest-worker.js +151 -5
  49. package/dist/hooks/session-end.js +153 -2
  50. package/dist/hooks/session-start.js +154 -3
  51. package/dist/hooks/stop.js +151 -0
  52. package/dist/hooks/subagent-stop.js +151 -0
  53. package/dist/hooks/summary-worker.js +160 -6
  54. package/dist/index.js +278 -100
  55. package/dist/lib/cloud-sync.js +9 -1
  56. package/dist/lib/consolidation.js +69 -2
  57. package/dist/lib/database.js +19 -0
  58. package/dist/lib/device-registry.js +19 -0
  59. package/dist/lib/employee-templates.js +20 -1
  60. package/dist/lib/exe-daemon.js +236 -16
  61. package/dist/lib/hybrid-search.js +154 -3
  62. package/dist/lib/messaging.js +39 -2
  63. package/dist/lib/schedules.js +792 -637
  64. package/dist/lib/store.js +796 -636
  65. package/dist/lib/tasks.js +1614 -1091
  66. package/dist/lib/tmux-routing.js +149 -9
  67. package/dist/mcp/server.js +1810 -1137
  68. package/dist/mcp/tools/create-task.js +2280 -828
  69. package/dist/mcp/tools/list-tasks.js +2788 -159
  70. package/dist/mcp/tools/send-message.js +39 -2
  71. package/dist/mcp/tools/update-task.js +64 -0
  72. package/dist/runtime/index.js +235 -67
  73. package/dist/tui/App.js +1440 -646
  74. package/package.json +3 -2
@@ -309,6 +309,13 @@ async function ensureSchema() {
309
309
  });
310
310
  } catch {
311
311
  }
312
+ try {
313
+ await client.execute({
314
+ sql: `ALTER TABLE tasks ADD COLUMN session_scope TEXT`,
315
+ args: []
316
+ });
317
+ } catch {
318
+ }
312
319
  try {
313
320
  await client.execute({
314
321
  sql: `ALTER TABLE memories ADD COLUMN task_id TEXT`,
@@ -755,6 +762,18 @@ async function ensureSchema() {
755
762
  CREATE INDEX IF NOT EXISTS idx_session_kills_agent
756
763
  ON session_kills(agent_id);
757
764
  `);
765
+ await client.execute(`
766
+ CREATE TABLE IF NOT EXISTS global_procedures (
767
+ id TEXT PRIMARY KEY,
768
+ title TEXT NOT NULL,
769
+ content TEXT NOT NULL,
770
+ priority TEXT NOT NULL DEFAULT 'p0',
771
+ domain TEXT,
772
+ active INTEGER NOT NULL DEFAULT 1,
773
+ created_at TEXT NOT NULL,
774
+ updated_at TEXT NOT NULL
775
+ )
776
+ `);
758
777
  await client.executeMultiple(`
759
778
  CREATE TABLE IF NOT EXISTS conversations (
760
779
  id TEXT PRIMARY KEY,
@@ -1143,6 +1162,61 @@ var init_config = __esm({
1143
1162
  }
1144
1163
  });
1145
1164
 
1165
+ // src/lib/state-bus.ts
1166
+ var StateBus, orgBus;
1167
+ var init_state_bus = __esm({
1168
+ "src/lib/state-bus.ts"() {
1169
+ "use strict";
1170
+ StateBus = class {
1171
+ handlers = /* @__PURE__ */ new Map();
1172
+ globalHandlers = /* @__PURE__ */ new Set();
1173
+ /** Emit an event to all subscribers */
1174
+ emit(event) {
1175
+ const typeHandlers = this.handlers.get(event.type);
1176
+ if (typeHandlers) {
1177
+ for (const handler of typeHandlers) {
1178
+ try {
1179
+ handler(event);
1180
+ } catch {
1181
+ }
1182
+ }
1183
+ }
1184
+ for (const handler of this.globalHandlers) {
1185
+ try {
1186
+ handler(event);
1187
+ } catch {
1188
+ }
1189
+ }
1190
+ }
1191
+ /** Subscribe to a specific event type */
1192
+ on(type, handler) {
1193
+ if (!this.handlers.has(type)) {
1194
+ this.handlers.set(type, /* @__PURE__ */ new Set());
1195
+ }
1196
+ this.handlers.get(type).add(handler);
1197
+ }
1198
+ /** Subscribe to ALL events */
1199
+ onAny(handler) {
1200
+ this.globalHandlers.add(handler);
1201
+ }
1202
+ /** Unsubscribe from a specific event type */
1203
+ off(type, handler) {
1204
+ this.handlers.get(type)?.delete(handler);
1205
+ }
1206
+ /** Unsubscribe from ALL events */
1207
+ offAny(handler) {
1208
+ this.globalHandlers.delete(handler);
1209
+ }
1210
+ /** Remove all listeners */
1211
+ clear() {
1212
+ this.handlers.clear();
1213
+ this.globalHandlers.clear();
1214
+ }
1215
+ };
1216
+ orgBus = new StateBus();
1217
+ }
1218
+ });
1219
+
1146
1220
  // src/lib/shard-manager.ts
1147
1221
  var shard_manager_exports = {};
1148
1222
  __export(shard_manager_exports, {
@@ -1384,6 +1458,71 @@ var init_shard_manager = __esm({
1384
1458
  }
1385
1459
  });
1386
1460
 
1461
+ // src/lib/global-procedures.ts
1462
+ var global_procedures_exports = {};
1463
+ __export(global_procedures_exports, {
1464
+ deactivateGlobalProcedure: () => deactivateGlobalProcedure,
1465
+ getGlobalProceduresBlock: () => getGlobalProceduresBlock,
1466
+ loadGlobalProcedures: () => loadGlobalProcedures,
1467
+ storeGlobalProcedure: () => storeGlobalProcedure
1468
+ });
1469
+ import { randomUUID } from "crypto";
1470
+ async function loadGlobalProcedures() {
1471
+ const client = getClient();
1472
+ const result = await client.execute({
1473
+ sql: "SELECT * FROM global_procedures WHERE active = 1 ORDER BY priority ASC, created_at ASC",
1474
+ args: []
1475
+ });
1476
+ const procedures = result.rows;
1477
+ if (procedures.length > 0) {
1478
+ _cache = procedures.map((p) => `### ${p.title}
1479
+ ${p.content}`).join("\n\n");
1480
+ } else {
1481
+ _cache = "";
1482
+ }
1483
+ _cacheLoaded = true;
1484
+ return procedures;
1485
+ }
1486
+ function getGlobalProceduresBlock() {
1487
+ if (!_cacheLoaded) return "";
1488
+ if (!_cache) return "";
1489
+ return `## Organization-Wide Procedures (MANDATORY \u2014 supersedes all other rules)
1490
+
1491
+ ${_cache}
1492
+ `;
1493
+ }
1494
+ async function storeGlobalProcedure(input) {
1495
+ const id = randomUUID();
1496
+ const now = (/* @__PURE__ */ new Date()).toISOString();
1497
+ const client = getClient();
1498
+ await client.execute({
1499
+ sql: `INSERT INTO global_procedures (id, title, content, priority, domain, active, created_at, updated_at)
1500
+ VALUES (?, ?, ?, ?, ?, 1, ?, ?)`,
1501
+ args: [id, input.title, input.content, input.priority ?? "p0", input.domain ?? null, now, now]
1502
+ });
1503
+ await loadGlobalProcedures();
1504
+ return id;
1505
+ }
1506
+ async function deactivateGlobalProcedure(id) {
1507
+ const now = (/* @__PURE__ */ new Date()).toISOString();
1508
+ const client = getClient();
1509
+ const result = await client.execute({
1510
+ sql: "UPDATE global_procedures SET active = 0, updated_at = ? WHERE id = ?",
1511
+ args: [now, id]
1512
+ });
1513
+ await loadGlobalProcedures();
1514
+ return result.rowsAffected > 0;
1515
+ }
1516
+ var _cache, _cacheLoaded;
1517
+ var init_global_procedures = __esm({
1518
+ "src/lib/global-procedures.ts"() {
1519
+ "use strict";
1520
+ init_database();
1521
+ _cache = "";
1522
+ _cacheLoaded = false;
1523
+ }
1524
+ });
1525
+
1387
1526
  // src/lib/store.ts
1388
1527
  function isBusyError2(err) {
1389
1528
  if (err instanceof Error) {
@@ -1447,6 +1586,11 @@ async function initStore(options) {
1447
1586
  "version-query"
1448
1587
  );
1449
1588
  _nextVersion = (Number(vResult.rows[0]?.max_v) || 0) + 1;
1589
+ try {
1590
+ const { loadGlobalProcedures: loadGlobalProcedures2 } = await Promise.resolve().then(() => (init_global_procedures(), global_procedures_exports));
1591
+ await loadGlobalProcedures2();
1592
+ } catch {
1593
+ }
1450
1594
  }
1451
1595
  function buildWikiScopeFilter(options, columnPrefix) {
1452
1596
  const args = [];
@@ -1508,6 +1652,7 @@ var init_store = __esm({
1508
1652
  init_database();
1509
1653
  init_keychain();
1510
1654
  init_config();
1655
+ init_state_bus();
1511
1656
  INIT_MAX_RETRIES = 3;
1512
1657
  INIT_RETRY_DELAY_MS = 1e3;
1513
1658
  _pendingRecords = [];