@askexenow/exe-os 0.9.30 → 0.9.32

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 (64) hide show
  1. package/dist/bin/backfill-conversations.js +135 -7
  2. package/dist/bin/backfill-responses.js +135 -7
  3. package/dist/bin/backfill-vectors.js +135 -7
  4. package/dist/bin/cleanup-stale-review-tasks.js +139 -11
  5. package/dist/bin/cli.js +812 -486
  6. package/dist/bin/exe-assign.js +135 -7
  7. package/dist/bin/exe-boot.js +422 -113
  8. package/dist/bin/exe-cloud.js +160 -9
  9. package/dist/bin/exe-dispatch.js +136 -8
  10. package/dist/bin/exe-doctor.js +255 -13
  11. package/dist/bin/exe-export-behaviors.js +136 -8
  12. package/dist/bin/exe-forget.js +136 -8
  13. package/dist/bin/exe-gateway.js +171 -24
  14. package/dist/bin/exe-heartbeat.js +141 -13
  15. package/dist/bin/exe-kill.js +140 -12
  16. package/dist/bin/exe-launch-agent.js +143 -15
  17. package/dist/bin/exe-link.js +357 -48
  18. package/dist/bin/exe-pending-messages.js +136 -8
  19. package/dist/bin/exe-pending-notifications.js +136 -8
  20. package/dist/bin/exe-pending-reviews.js +138 -10
  21. package/dist/bin/exe-review.js +136 -8
  22. package/dist/bin/exe-search.js +155 -20
  23. package/dist/bin/exe-session-cleanup.js +166 -38
  24. package/dist/bin/exe-start-codex.js +142 -14
  25. package/dist/bin/exe-start-opencode.js +140 -12
  26. package/dist/bin/exe-status.js +148 -20
  27. package/dist/bin/exe-team.js +136 -8
  28. package/dist/bin/git-sweep.js +138 -10
  29. package/dist/bin/graph-backfill.js +135 -7
  30. package/dist/bin/graph-export.js +136 -8
  31. package/dist/bin/intercom-check.js +153 -25
  32. package/dist/bin/scan-tasks.js +138 -10
  33. package/dist/bin/setup.js +447 -121
  34. package/dist/bin/shard-migrate.js +135 -7
  35. package/dist/gateway/index.js +151 -23
  36. package/dist/hooks/bug-report-worker.js +151 -23
  37. package/dist/hooks/codex-stop-task-finalizer.js +145 -17
  38. package/dist/hooks/commit-complete.js +138 -10
  39. package/dist/hooks/error-recall.js +159 -24
  40. package/dist/hooks/ingest.js +142 -14
  41. package/dist/hooks/instructions-loaded.js +136 -8
  42. package/dist/hooks/notification.js +136 -8
  43. package/dist/hooks/post-compact.js +136 -8
  44. package/dist/hooks/post-tool-combined.js +159 -24
  45. package/dist/hooks/pre-compact.js +136 -8
  46. package/dist/hooks/pre-tool-use.js +144 -16
  47. package/dist/hooks/prompt-submit.js +195 -55
  48. package/dist/hooks/session-end.js +141 -13
  49. package/dist/hooks/session-start.js +165 -30
  50. package/dist/hooks/stop.js +136 -8
  51. package/dist/hooks/subagent-stop.js +136 -8
  52. package/dist/hooks/summary-worker.js +374 -65
  53. package/dist/index.js +136 -8
  54. package/dist/lib/cloud-sync.js +355 -46
  55. package/dist/lib/consolidation.js +1 -0
  56. package/dist/lib/exe-daemon.js +469 -127
  57. package/dist/lib/hybrid-search.js +155 -20
  58. package/dist/lib/keychain.js +191 -7
  59. package/dist/lib/schedules.js +138 -10
  60. package/dist/lib/store.js +135 -7
  61. package/dist/mcp/server.js +706 -213
  62. package/dist/runtime/index.js +136 -8
  63. package/dist/tui/App.js +208 -31
  64. package/package.json +1 -1
@@ -1631,8 +1631,8 @@ function findPackageRoot() {
1631
1631
  function getAvailableMemoryGB() {
1632
1632
  if (process.platform === "darwin") {
1633
1633
  try {
1634
- const { execSync: execSync7 } = __require("child_process");
1635
- const vmstat = execSync7("vm_stat", { encoding: "utf8" });
1634
+ const { execSync: execSync8 } = __require("child_process");
1635
+ const vmstat = execSync8("vm_stat", { encoding: "utf8" });
1636
1636
  const pageSize = 16384;
1637
1637
  const pageSizeMatch = vmstat.match(/page size of (\d+) bytes/);
1638
1638
  const actualPageSize = pageSizeMatch ? parseInt(pageSizeMatch[1], 10) : pageSize;
@@ -6535,6 +6535,7 @@ var init_task_scope = __esm({
6535
6535
  // src/lib/keychain.ts
6536
6536
  import { readFile as readFile4, writeFile as writeFile5, unlink, mkdir as mkdir4, chmod as chmod2 } from "fs/promises";
6537
6537
  import { existsSync as existsSync15 } from "fs";
6538
+ import { execSync as execSync7 } from "child_process";
6538
6539
  import path18 from "path";
6539
6540
  import os11 from "os";
6540
6541
  function getKeyDir() {
@@ -6543,6 +6544,59 @@ function getKeyDir() {
6543
6544
  function getKeyPath() {
6544
6545
  return path18.join(getKeyDir(), "master.key");
6545
6546
  }
6547
+ function macKeychainGet() {
6548
+ if (process.platform !== "darwin") return null;
6549
+ try {
6550
+ return execSync7(
6551
+ `security find-generic-password -s "${SERVICE}" -a "${ACCOUNT}" -w 2>/dev/null`,
6552
+ { encoding: "utf-8", timeout: 5e3 }
6553
+ ).trim();
6554
+ } catch {
6555
+ return null;
6556
+ }
6557
+ }
6558
+ function macKeychainSet(value) {
6559
+ if (process.platform !== "darwin") return false;
6560
+ try {
6561
+ try {
6562
+ execSync7(
6563
+ `security delete-generic-password -s "${SERVICE}" -a "${ACCOUNT}" 2>/dev/null`,
6564
+ { timeout: 5e3 }
6565
+ );
6566
+ } catch {
6567
+ }
6568
+ execSync7(
6569
+ `security add-generic-password -s "${SERVICE}" -a "${ACCOUNT}" -w "${value}"`,
6570
+ { timeout: 5e3 }
6571
+ );
6572
+ return true;
6573
+ } catch {
6574
+ return false;
6575
+ }
6576
+ }
6577
+ function linuxSecretGet() {
6578
+ if (process.platform !== "linux") return null;
6579
+ try {
6580
+ return execSync7(
6581
+ `secret-tool lookup service "${SERVICE}" account "${ACCOUNT}" 2>/dev/null`,
6582
+ { encoding: "utf-8", timeout: 5e3 }
6583
+ ).trim();
6584
+ } catch {
6585
+ return null;
6586
+ }
6587
+ }
6588
+ function linuxSecretSet(value) {
6589
+ if (process.platform !== "linux") return false;
6590
+ try {
6591
+ execSync7(
6592
+ `echo -n "${value}" | secret-tool store --label="exe-os master key" service "${SERVICE}" account "${ACCOUNT}"`,
6593
+ { timeout: 5e3 }
6594
+ );
6595
+ return true;
6596
+ } catch {
6597
+ return false;
6598
+ }
6599
+ }
6546
6600
  async function tryKeytar() {
6547
6601
  try {
6548
6602
  return await import("keytar");
@@ -6550,13 +6604,63 @@ async function tryKeytar() {
6550
6604
  return null;
6551
6605
  }
6552
6606
  }
6607
+ function deriveMachineKey() {
6608
+ try {
6609
+ const crypto7 = __require("crypto");
6610
+ const material = [
6611
+ os11.hostname(),
6612
+ os11.userInfo().username,
6613
+ os11.arch(),
6614
+ os11.platform(),
6615
+ // Machine ID on Linux (stable across reboots)
6616
+ process.platform === "linux" ? readMachineId() : ""
6617
+ ].join("|");
6618
+ return crypto7.createHash("sha256").update(material).digest();
6619
+ } catch {
6620
+ return null;
6621
+ }
6622
+ }
6623
+ function readMachineId() {
6624
+ try {
6625
+ const { readFileSync: readFileSync14 } = __require("fs");
6626
+ return readFileSync14("/etc/machine-id", "utf-8").trim();
6627
+ } catch {
6628
+ return "";
6629
+ }
6630
+ }
6631
+ function decryptWithMachineKey(encrypted, machineKey) {
6632
+ if (!encrypted.startsWith(ENCRYPTED_PREFIX)) return null;
6633
+ try {
6634
+ const crypto7 = __require("crypto");
6635
+ const parts = encrypted.slice(ENCRYPTED_PREFIX.length).split(":");
6636
+ if (parts.length !== 3) return null;
6637
+ const [ivB64, tagB64, cipherB64] = parts;
6638
+ const iv = Buffer.from(ivB64, "base64");
6639
+ const authTag = Buffer.from(tagB64, "base64");
6640
+ const decipher = crypto7.createDecipheriv("aes-256-gcm", machineKey, iv);
6641
+ decipher.setAuthTag(authTag);
6642
+ let decrypted = decipher.update(cipherB64, "base64", "utf-8");
6643
+ decrypted += decipher.final("utf-8");
6644
+ return decrypted;
6645
+ } catch {
6646
+ return null;
6647
+ }
6648
+ }
6553
6649
  async function getMasterKey() {
6650
+ const nativeValue = macKeychainGet() ?? linuxSecretGet();
6651
+ if (nativeValue) {
6652
+ return Buffer.from(nativeValue, "base64");
6653
+ }
6554
6654
  const keytar = await tryKeytar();
6555
6655
  if (keytar) {
6556
6656
  try {
6557
- const stored = await keytar.getPassword(SERVICE, ACCOUNT);
6558
- if (stored) {
6559
- return Buffer.from(stored, "base64");
6657
+ const keytarValue = await keytar.getPassword(SERVICE, ACCOUNT);
6658
+ if (keytarValue) {
6659
+ const migrated = macKeychainSet(keytarValue) || linuxSecretSet(keytarValue);
6660
+ if (migrated) {
6661
+ process.stderr.write("[keychain] Migrated key from keytar to native keychain.\n");
6662
+ }
6663
+ return Buffer.from(keytarValue, "base64");
6560
6664
  }
6561
6665
  } catch {
6562
6666
  }
@@ -6570,8 +6674,31 @@ async function getMasterKey() {
6570
6674
  return null;
6571
6675
  }
6572
6676
  try {
6573
- const content = await readFile4(keyPath, "utf-8");
6574
- return Buffer.from(content.trim(), "base64");
6677
+ const content = (await readFile4(keyPath, "utf-8")).trim();
6678
+ let b64Value;
6679
+ if (content.startsWith(ENCRYPTED_PREFIX)) {
6680
+ const machineKey = deriveMachineKey();
6681
+ if (!machineKey) {
6682
+ process.stderr.write("[keychain] Cannot derive machine key to decrypt stored key.\n");
6683
+ return null;
6684
+ }
6685
+ const decrypted = decryptWithMachineKey(content, machineKey);
6686
+ if (!decrypted) {
6687
+ process.stderr.write(
6688
+ "[keychain] Key decryption failed \u2014 machine may have changed.\n Use your 24-word recovery phrase: exe-os link import\n"
6689
+ );
6690
+ return null;
6691
+ }
6692
+ b64Value = decrypted;
6693
+ } else {
6694
+ b64Value = content;
6695
+ }
6696
+ const key = Buffer.from(b64Value, "base64");
6697
+ const migrated = macKeychainSet(b64Value) || linuxSecretSet(b64Value);
6698
+ if (migrated) {
6699
+ process.stderr.write("[keychain] Migrated key from file to native keychain.\n");
6700
+ }
6701
+ return key;
6575
6702
  } catch (err) {
6576
6703
  process.stderr.write(
6577
6704
  `[keychain] Key read failed at ${keyPath}: ${err instanceof Error ? err.message : String(err)}
@@ -6580,12 +6707,13 @@ async function getMasterKey() {
6580
6707
  return null;
6581
6708
  }
6582
6709
  }
6583
- var SERVICE, ACCOUNT;
6710
+ var SERVICE, ACCOUNT, ENCRYPTED_PREFIX;
6584
6711
  var init_keychain = __esm({
6585
6712
  "src/lib/keychain.ts"() {
6586
6713
  "use strict";
6587
6714
  SERVICE = "exe-mem";
6588
6715
  ACCOUNT = "master-key";
6716
+ ENCRYPTED_PREFIX = "enc:";
6589
6717
  }
6590
6718
  });
6591
6719
 
@@ -8036,8 +8164,8 @@ async function main() {
8036
8164
  const agentId = folderArg.startsWith("exe/") ? folderArg.slice(4) : folderArg;
8037
8165
  let tmuxSession;
8038
8166
  try {
8039
- const { execSync: execSync7 } = await import("child_process");
8040
- const out = execSync7("tmux display-message -p '#{session_name}' 2>/dev/null", {
8167
+ const { execSync: execSync8 } = await import("child_process");
8168
+ const out = execSync8("tmux display-message -p '#{session_name}' 2>/dev/null", {
8041
8169
  encoding: "utf8",
8042
8170
  timeout: 1e3
8043
8171
  }).trim();