@askexenow/exe-os 0.8.40 → 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 (78) 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 +1376 -659
  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 +2549 -1784
  9. package/dist/bin/exe-call.js +39 -1
  10. package/dist/bin/exe-cloud.js +12 -2
  11. package/dist/bin/exe-dispatch.js +39 -2
  12. package/dist/bin/exe-doctor.js +791 -634
  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 +2501 -1846
  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 +44 -12
  20. package/dist/bin/exe-new-employee.js +6 -2
  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 +176 -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 +157 -4
  27. package/dist/bin/exe-session-cleanup.js +2487 -403
  28. package/dist/bin/exe-settings.js +2 -1
  29. package/dist/bin/exe-status.js +474 -317
  30. package/dist/bin/exe-team.js +474 -317
  31. package/dist/bin/git-sweep.js +2691 -151
  32. package/dist/bin/graph-backfill.js +794 -637
  33. package/dist/bin/graph-export.js +798 -641
  34. package/dist/bin/scan-tasks.js +2951 -44
  35. package/dist/bin/setup.js +50 -26
  36. package/dist/bin/shard-migrate.js +792 -637
  37. package/dist/bin/wiki-sync.js +794 -637
  38. package/dist/gateway/index.js +2542 -1887
  39. package/dist/hooks/bug-report-worker.js +2118 -576
  40. package/dist/hooks/commit-complete.js +2690 -150
  41. package/dist/hooks/error-recall.js +157 -4
  42. package/dist/hooks/ingest-worker.js +1455 -803
  43. package/dist/hooks/instructions-loaded.js +151 -0
  44. package/dist/hooks/notification.js +153 -2
  45. package/dist/hooks/post-compact.js +164 -0
  46. package/dist/hooks/pre-compact.js +3073 -101
  47. package/dist/hooks/pre-tool-use.js +151 -0
  48. package/dist/hooks/prompt-ingest-worker.js +1670 -1509
  49. package/dist/hooks/prompt-submit.js +2650 -1074
  50. package/dist/hooks/response-ingest-worker.js +154 -6
  51. package/dist/hooks/session-end.js +153 -2
  52. package/dist/hooks/session-start.js +157 -4
  53. package/dist/hooks/stop.js +151 -0
  54. package/dist/hooks/subagent-stop.js +155 -2
  55. package/dist/hooks/summary-worker.js +190 -21
  56. package/dist/index.js +326 -102
  57. package/dist/lib/cloud-sync.js +31 -10
  58. package/dist/lib/config.js +2 -0
  59. package/dist/lib/consolidation.js +69 -2
  60. package/dist/lib/database.js +19 -0
  61. package/dist/lib/device-registry.js +19 -0
  62. package/dist/lib/embedder.js +3 -1
  63. package/dist/lib/employee-templates.js +20 -1
  64. package/dist/lib/exe-daemon.js +285 -18
  65. package/dist/lib/hybrid-search.js +157 -4
  66. package/dist/lib/messaging.js +39 -2
  67. package/dist/lib/schedules.js +792 -637
  68. package/dist/lib/store.js +796 -636
  69. package/dist/lib/tasks.js +1485 -918
  70. package/dist/lib/tmux-routing.js +194 -10
  71. package/dist/mcp/server.js +1643 -924
  72. package/dist/mcp/tools/create-task.js +2283 -829
  73. package/dist/mcp/tools/list-tasks.js +2788 -159
  74. package/dist/mcp/tools/send-message.js +39 -2
  75. package/dist/mcp/tools/update-task.js +79 -0
  76. package/dist/runtime/index.js +280 -68
  77. package/dist/tui/App.js +1485 -645
  78. package/package.json +3 -2
@@ -243,6 +243,42 @@ var init_employees = __esm({
243
243
  }
244
244
  });
245
245
 
246
+ // src/lib/db-retry.ts
247
+ var init_db_retry = __esm({
248
+ "src/lib/db-retry.ts"() {
249
+ "use strict";
250
+ }
251
+ });
252
+
253
+ // src/lib/database.ts
254
+ import { createClient } from "@libsql/client";
255
+ var init_database = __esm({
256
+ "src/lib/database.ts"() {
257
+ "use strict";
258
+ init_db_retry();
259
+ }
260
+ });
261
+
262
+ // src/lib/global-procedures.ts
263
+ import { randomUUID } from "crypto";
264
+ function getGlobalProceduresBlock() {
265
+ if (!_cacheLoaded) return "";
266
+ if (!_cache) return "";
267
+ return `## Organization-Wide Procedures (MANDATORY \u2014 supersedes all other rules)
268
+
269
+ ${_cache}
270
+ `;
271
+ }
272
+ var _cache, _cacheLoaded;
273
+ var init_global_procedures = __esm({
274
+ "src/lib/global-procedures.ts"() {
275
+ "use strict";
276
+ init_database();
277
+ _cache = "";
278
+ _cacheLoaded = false;
279
+ }
280
+ });
281
+
246
282
  // src/lib/employee-templates.ts
247
283
  var employee_templates_exports = {};
248
284
  __export(employee_templates_exports, {
@@ -261,7 +297,8 @@ __export(employee_templates_exports, {
261
297
  function getSessionPrompt(storedPrompt) {
262
298
  const markerIndex = storedPrompt.indexOf(PROCEDURES_MARKER);
263
299
  const rolePrompt = markerIndex >= 0 ? storedPrompt.slice(0, markerIndex).trimEnd() : storedPrompt;
264
- return `${rolePrompt}
300
+ const globalBlock = getGlobalProceduresBlock();
301
+ return `${globalBlock}${rolePrompt}
265
302
  ${BASE_OPERATING_PROCEDURES}`;
266
303
  }
267
304
  function buildCustomEmployeePrompt(name, role) {
@@ -301,6 +338,7 @@ var BASE_OPERATING_PROCEDURES, DEFAULT_EXE, TEMPLATE_VERSION, PROCEDURES_MARKER,
301
338
  var init_employee_templates = __esm({
302
339
  "src/lib/employee-templates.ts"() {
303
340
  "use strict";
341
+ init_global_procedures();
304
342
  BASE_OPERATING_PROCEDURES = `
305
343
  EXE OS \u2014 VISION AND NON-NEGOTIABLE PRINCIPLES (above all work):
306
344
 
@@ -710,7 +710,8 @@ function isMainModule(importMetaUrl) {
710
710
  }
711
711
 
712
712
  // src/lib/cloud-sync.ts
713
- import { readFileSync as readFileSync5, writeFileSync as writeFileSync2, existsSync as existsSync6, readdirSync, mkdirSync as mkdirSync2, appendFileSync, unlinkSync } from "fs";
713
+ import { readFileSync as readFileSync5, writeFileSync as writeFileSync2, existsSync as existsSync6, readdirSync, mkdirSync as mkdirSync2, appendFileSync, unlinkSync, openSync, closeSync } from "fs";
714
+ import crypto4 from "crypto";
714
715
  import path6 from "path";
715
716
  import { homedir } from "os";
716
717
 
@@ -897,8 +898,17 @@ async function syncMode() {
897
898
  console.log("");
898
899
  console.log("Run /exe-cloud on the new device and paste these when prompted:\n");
899
900
  console.log(" 24-word recovery phrase:");
900
- console.log(` ${mnemonic}
901
+ const showFull = process.argv.includes("--show-full");
902
+ if (showFull) {
903
+ console.log(` ${mnemonic}
901
904
  `);
905
+ } else {
906
+ const words = mnemonic.split(" ");
907
+ const masked = words.length > 4 ? [...words.slice(0, 2), ...words.slice(2, -2).map(() => "****"), ...words.slice(-2)].join(" ") : mnemonic;
908
+ console.log(` ${masked}
909
+ `);
910
+ console.log(" To reveal full phrase: run with --show-full\n");
911
+ }
902
912
  console.log(" \u26A0 Clear your terminal history after copying.\n");
903
913
  if (config.cloud?.apiKey) {
904
914
  const maskedKey = config.cloud.apiKey.slice(0, 10) + "..." + config.cloud.apiKey.slice(-4);
@@ -624,8 +624,28 @@ function getMySession() {
624
624
  return getTransport().getMySession();
625
625
  }
626
626
  function employeeSessionName(employee, exeSession2, instance) {
627
+ if (!/^exe\d+$/.test(exeSession2)) {
628
+ const root = extractRootExe(exeSession2);
629
+ if (root) {
630
+ process.stderr.write(
631
+ `[tmux-routing] WARN: exeSession="${exeSession2}" is not a root exe session, using "${root}" instead
632
+ `
633
+ );
634
+ exeSession2 = root;
635
+ } else {
636
+ throw new Error(
637
+ `Invalid exeSession "${exeSession2}" \u2014 must be a root exe session (e.g., "exe1"), not an agent session`
638
+ );
639
+ }
640
+ }
627
641
  const suffix = instance != null && instance > 0 ? String(instance) : "";
628
- return `${employee}${suffix}-${exeSession2}`;
642
+ const name = `${employee}${suffix}-${exeSession2}`;
643
+ if (!VALID_SESSION_NAME.test(name)) {
644
+ throw new Error(
645
+ `Invalid session name "${name}" \u2014 must match {agent}-exe{N} or {agent}{instance}-exe{N}`
646
+ );
647
+ }
648
+ return name;
629
649
  }
630
650
  function extractRootExe(name) {
631
651
  const match = name.match(/(exe\d+)$/);
@@ -784,6 +804,22 @@ function ensureEmployee(employeeName2, exeSession2, projectDir2, opts) {
784
804
  error: `Error: pass employee name ('${bare}'), not session name ('${employeeName2}')`
785
805
  };
786
806
  }
807
+ if (!/^exe\d+$/.test(exeSession2)) {
808
+ const root = extractRootExe(exeSession2);
809
+ if (root) {
810
+ process.stderr.write(
811
+ `[ensureEmployee] WARN: caller passed exeSession="${exeSession2}" (not a root exe). Auto-correcting to "${root}".
812
+ `
813
+ );
814
+ exeSession2 = root;
815
+ } else {
816
+ return {
817
+ status: "failed",
818
+ sessionName: "",
819
+ error: `Invalid exeSession "${exeSession2}" \u2014 must be a root exe session (e.g., "exe1")`
820
+ };
821
+ }
822
+ }
787
823
  let effectiveInstance = opts?.instance;
788
824
  if (effectiveInstance === void 0 && opts?.autoInstance) {
789
825
  const free = findFreeInstance(
@@ -1030,7 +1066,7 @@ function spawnEmployee(employeeName2, exeSession2, projectDir2, opts) {
1030
1066
  releaseSpawnLock(sessionName);
1031
1067
  return { sessionName };
1032
1068
  }
1033
- var SPAWN_LOCK_DIR, SESSION_CACHE, BEHAVIORS_EXPORT_TIMEOUT_MS, INTERCOM_DEBOUNCE_MS, INTERCOM_LOG2, DEBOUNCE_FILE, DEBOUNCE_CLEANUP_AGE_MS, BUSY_PATTERN;
1069
+ var SPAWN_LOCK_DIR, SESSION_CACHE, BEHAVIORS_EXPORT_TIMEOUT_MS, VALID_SESSION_NAME, INTERCOM_DEBOUNCE_MS, INTERCOM_LOG2, DEBOUNCE_FILE, DEBOUNCE_CLEANUP_AGE_MS, BUSY_PATTERN;
1034
1070
  var init_tmux_routing = __esm({
1035
1071
  "src/lib/tmux-routing.ts"() {
1036
1072
  "use strict";
@@ -1045,6 +1081,7 @@ var init_tmux_routing = __esm({
1045
1081
  SPAWN_LOCK_DIR = path7.join(os4.homedir(), ".exe-os", "spawn-locks");
1046
1082
  SESSION_CACHE = path7.join(os4.homedir(), ".exe-os", "session-cache");
1047
1083
  BEHAVIORS_EXPORT_TIMEOUT_MS = 1e4;
1084
+ VALID_SESSION_NAME = /^[a-z]+-exe\d+$|^[a-z]+\d+-exe\d+$/;
1048
1085
  INTERCOM_DEBOUNCE_MS = 3e4;
1049
1086
  INTERCOM_LOG2 = path7.join(os4.homedir(), ".exe-os", "intercom.log");
1050
1087
  DEBOUNCE_FILE = path7.join(SESSION_CACHE, "intercom-debounce.json");