@askexenow/exe-os 0.9.84 → 0.9.86

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 (82) hide show
  1. package/dist/bin/agentic-ontology-backfill.js +32 -14
  2. package/dist/bin/agentic-reflection-backfill.js +32 -14
  3. package/dist/bin/agentic-semantic-label.js +32 -14
  4. package/dist/bin/backfill-conversations.js +32 -14
  5. package/dist/bin/backfill-responses.js +32 -14
  6. package/dist/bin/backfill-vectors.js +32 -14
  7. package/dist/bin/bulk-sync-postgres.js +32 -14
  8. package/dist/bin/cleanup-stale-review-tasks.js +35 -17
  9. package/dist/bin/cli.js +224 -86
  10. package/dist/bin/exe-assign.js +32 -14
  11. package/dist/bin/exe-boot.js +57 -39
  12. package/dist/bin/exe-cloud.js +22 -4
  13. package/dist/bin/exe-dispatch.js +43 -25
  14. package/dist/bin/exe-doctor.js +22 -4
  15. package/dist/bin/exe-export-behaviors.js +32 -14
  16. package/dist/bin/exe-forget.js +32 -14
  17. package/dist/bin/exe-gateway.js +47 -29
  18. package/dist/bin/exe-heartbeat.js +37 -19
  19. package/dist/bin/exe-kill.js +36 -18
  20. package/dist/bin/exe-launch-agent.js +170 -79
  21. package/dist/bin/exe-new-employee.js +32 -0
  22. package/dist/bin/exe-pending-messages.js +35 -17
  23. package/dist/bin/exe-pending-notifications.js +35 -17
  24. package/dist/bin/exe-pending-reviews.js +37 -19
  25. package/dist/bin/exe-rename.js +34 -16
  26. package/dist/bin/exe-review.js +32 -14
  27. package/dist/bin/exe-search.js +40 -22
  28. package/dist/bin/exe-session-cleanup.js +67 -44
  29. package/dist/bin/exe-start-codex.js +39 -21
  30. package/dist/bin/exe-start-opencode.js +37 -19
  31. package/dist/bin/exe-status.js +44 -26
  32. package/dist/bin/exe-team.js +32 -14
  33. package/dist/bin/git-sweep.js +45 -27
  34. package/dist/bin/graph-backfill.js +32 -14
  35. package/dist/bin/graph-export.js +32 -14
  36. package/dist/bin/install.js +32 -0
  37. package/dist/bin/intercom-check.js +49 -31
  38. package/dist/bin/scan-tasks.js +45 -27
  39. package/dist/bin/setup.js +29 -11
  40. package/dist/bin/shard-migrate.js +32 -14
  41. package/dist/bin/stack-update.js +95 -7
  42. package/dist/bin/update.js +1 -1
  43. package/dist/gateway/index.js +47 -29
  44. package/dist/hooks/bug-report-worker.js +47 -29
  45. package/dist/hooks/codex-stop-task-finalizer.js +41 -23
  46. package/dist/hooks/commit-complete.js +46 -28
  47. package/dist/hooks/error-recall.js +44 -26
  48. package/dist/hooks/ingest-worker.js +4 -4
  49. package/dist/hooks/ingest.js +38 -20
  50. package/dist/hooks/instructions-loaded.js +32 -14
  51. package/dist/hooks/notification.js +32 -14
  52. package/dist/hooks/post-compact.js +32 -14
  53. package/dist/hooks/post-tool-combined.js +45 -27
  54. package/dist/hooks/pre-compact.js +43 -25
  55. package/dist/hooks/pre-tool-use.js +40 -22
  56. package/dist/hooks/prompt-submit.js +60 -42
  57. package/dist/hooks/session-end.js +48 -30
  58. package/dist/hooks/session-start.js +50 -32
  59. package/dist/hooks/stop.js +35 -17
  60. package/dist/hooks/subagent-stop.js +32 -14
  61. package/dist/hooks/summary-worker.js +37 -19
  62. package/dist/index.js +43 -25
  63. package/dist/lib/cloud-sync.js +32 -14
  64. package/dist/lib/database.js +22 -4
  65. package/dist/lib/db-daemon-client.js +16 -4
  66. package/dist/lib/db.js +22 -4
  67. package/dist/lib/device-registry.js +22 -4
  68. package/dist/lib/embedder.js +16 -4
  69. package/dist/lib/exe-daemon-client.js +16 -4
  70. package/dist/lib/exe-daemon.js +165 -66
  71. package/dist/lib/hybrid-search.js +40 -22
  72. package/dist/lib/schedules.js +35 -17
  73. package/dist/lib/skill-learning.js +16 -4
  74. package/dist/lib/store.js +32 -14
  75. package/dist/lib/tasks.js +16 -4
  76. package/dist/lib/tmux-routing.js +18 -6
  77. package/dist/mcp/server.js +142 -60
  78. package/dist/mcp/tools/create-task.js +18 -6
  79. package/dist/mcp/tools/update-task.js +18 -6
  80. package/dist/runtime/index.js +43 -25
  81. package/dist/tui/App.js +73 -55
  82. package/package.json +1 -1
@@ -1703,7 +1703,7 @@ var init_daemon_auth = __esm({
1703
1703
  // src/lib/exe-daemon-client.ts
1704
1704
  import net from "net";
1705
1705
  import os5 from "os";
1706
- import { spawn } from "child_process";
1706
+ import { spawn, execSync as execSync2 } from "child_process";
1707
1707
  import { randomUUID } from "crypto";
1708
1708
  import { existsSync as existsSync6, unlinkSync as unlinkSync2, readFileSync as readFileSync5, openSync, closeSync, statSync } from "fs";
1709
1709
  import path7 from "path";
@@ -1733,6 +1733,14 @@ function handleData(chunk) {
1733
1733
  }
1734
1734
  }
1735
1735
  }
1736
+ function isZombie(pid) {
1737
+ try {
1738
+ const state = execSync2(`ps -p ${pid} -o state=`, { encoding: "utf8", timeout: 2e3 }).trim();
1739
+ return state.startsWith("Z");
1740
+ } catch {
1741
+ return false;
1742
+ }
1743
+ }
1736
1744
  function cleanupStaleFiles() {
1737
1745
  if (existsSync6(PID_PATH)) {
1738
1746
  try {
@@ -1740,7 +1748,11 @@ function cleanupStaleFiles() {
1740
1748
  if (pid > 0) {
1741
1749
  try {
1742
1750
  process.kill(pid, 0);
1743
- return;
1751
+ if (!isZombie(pid)) {
1752
+ return;
1753
+ }
1754
+ process.stderr.write(`[exed-client] PID ${pid} is a zombie \u2014 cleaning up stale files
1755
+ `);
1744
1756
  } catch {
1745
1757
  }
1746
1758
  }
@@ -1768,8 +1780,8 @@ function findPackageRoot() {
1768
1780
  function getAvailableMemoryGB() {
1769
1781
  if (process.platform === "darwin") {
1770
1782
  try {
1771
- const { execSync: execSync8 } = __require("child_process");
1772
- const vmstat = execSync8("vm_stat", { encoding: "utf8" });
1783
+ const { execSync: execSync9 } = __require("child_process");
1784
+ const vmstat = execSync9("vm_stat", { encoding: "utf8" });
1773
1785
  const pageSize = 16384;
1774
1786
  const pageSizeMatch = vmstat.match(/page size of (\d+) bytes/);
1775
1787
  const actualPageSize = pageSizeMatch ? parseInt(pageSizeMatch[1], 10) : pageSize;
@@ -3704,6 +3716,12 @@ async function disposeDatabase() {
3704
3716
  clearInterval(_walCheckpointTimer);
3705
3717
  _walCheckpointTimer = null;
3706
3718
  }
3719
+ if (_client) {
3720
+ try {
3721
+ await _client.execute("PRAGMA wal_checkpoint(PASSIVE)");
3722
+ } catch {
3723
+ }
3724
+ }
3707
3725
  if (_daemonClient) {
3708
3726
  _daemonClient.close();
3709
3727
  _daemonClient = null;
@@ -3808,7 +3826,7 @@ var init_embedder = __esm({
3808
3826
  // src/lib/keychain.ts
3809
3827
  import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2 } from "fs/promises";
3810
3828
  import { existsSync as existsSync7, statSync as statSync2 } from "fs";
3811
- import { execSync as execSync2 } from "child_process";
3829
+ import { execSync as execSync3 } from "child_process";
3812
3830
  import path8 from "path";
3813
3831
  import os6 from "os";
3814
3832
  function getKeyDir() {
@@ -3825,13 +3843,13 @@ function linuxSecretAvailable() {
3825
3843
  if (process.platform !== "linux") return false;
3826
3844
  if (linuxSecretAvailability !== null) return linuxSecretAvailability;
3827
3845
  try {
3828
- execSync2("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
3846
+ execSync3("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
3829
3847
  } catch {
3830
3848
  linuxSecretAvailability = false;
3831
3849
  return false;
3832
3850
  }
3833
3851
  try {
3834
- execSync2("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
3852
+ execSync3("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
3835
3853
  linuxSecretAvailability = true;
3836
3854
  } catch {
3837
3855
  linuxSecretAvailability = false;
@@ -3855,7 +3873,7 @@ function macKeychainGet(service = SERVICE) {
3855
3873
  if (!nativeKeychainAllowed()) return null;
3856
3874
  if (process.platform !== "darwin") return null;
3857
3875
  try {
3858
- return execSync2(
3876
+ return execSync3(
3859
3877
  `security find-generic-password -s "${service}" -a "${ACCOUNT}" -w 2>/dev/null`,
3860
3878
  { encoding: "utf-8", timeout: 5e3 }
3861
3879
  ).trim();
@@ -3868,13 +3886,13 @@ function macKeychainSet(value, service = SERVICE) {
3868
3886
  if (process.platform !== "darwin") return false;
3869
3887
  try {
3870
3888
  try {
3871
- execSync2(
3889
+ execSync3(
3872
3890
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
3873
3891
  { timeout: 5e3 }
3874
3892
  );
3875
3893
  } catch {
3876
3894
  }
3877
- execSync2(
3895
+ execSync3(
3878
3896
  `security add-generic-password -s "${service}" -a "${ACCOUNT}" -w "${value}"`,
3879
3897
  { timeout: 5e3 }
3880
3898
  );
@@ -3887,7 +3905,7 @@ function macKeychainDelete(service = SERVICE) {
3887
3905
  if (!nativeKeychainAllowed()) return false;
3888
3906
  if (process.platform !== "darwin") return false;
3889
3907
  try {
3890
- execSync2(
3908
+ execSync3(
3891
3909
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
3892
3910
  { timeout: 5e3 }
3893
3911
  );
@@ -3899,7 +3917,7 @@ function macKeychainDelete(service = SERVICE) {
3899
3917
  function linuxSecretGet(service = SERVICE) {
3900
3918
  if (!linuxSecretAvailable()) return null;
3901
3919
  try {
3902
- return execSync2(
3920
+ return execSync3(
3903
3921
  `secret-tool lookup service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3904
3922
  { encoding: "utf-8", timeout: 5e3 }
3905
3923
  ).trim();
@@ -3910,7 +3928,7 @@ function linuxSecretGet(service = SERVICE) {
3910
3928
  function linuxSecretSet(value, service = SERVICE) {
3911
3929
  if (!linuxSecretAvailable()) return false;
3912
3930
  try {
3913
- execSync2(
3931
+ execSync3(
3914
3932
  `echo -n "${value}" | secret-tool store --label="exe-os master key" service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3915
3933
  { timeout: 5e3 }
3916
3934
  );
@@ -3923,7 +3941,7 @@ function linuxSecretDelete(service = SERVICE) {
3923
3941
  if (!nativeKeychainAllowed()) return false;
3924
3942
  if (process.platform !== "linux") return false;
3925
3943
  try {
3926
- execSync2(
3944
+ execSync3(
3927
3945
  `secret-tool clear service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3928
3946
  { timeout: 5e3 }
3929
3947
  );
@@ -9406,7 +9424,7 @@ var init_session_registry = __esm({
9406
9424
  });
9407
9425
 
9408
9426
  // src/lib/session-key.ts
9409
- import { execSync as execSync3 } from "child_process";
9427
+ import { execSync as execSync4 } from "child_process";
9410
9428
  function normalizeCommand(command) {
9411
9429
  const trimmed = command.trim().toLowerCase();
9412
9430
  const parts = trimmed.split(/[\\/]/);
@@ -9425,7 +9443,7 @@ function resolveRuntimeProcess() {
9425
9443
  let pid = process.ppid;
9426
9444
  for (let i = 0; i < 10; i++) {
9427
9445
  try {
9428
- const info = execSync3(`ps -p ${pid} -o ppid=,comm=`, {
9446
+ const info = execSync4(`ps -p ${pid} -o ppid=,comm=`, {
9429
9447
  encoding: "utf8",
9430
9448
  timeout: 2e3
9431
9449
  }).trim();
@@ -9591,14 +9609,14 @@ var init_transport = __esm({
9591
9609
  });
9592
9610
 
9593
9611
  // src/lib/cc-agent-support.ts
9594
- import { execSync as execSync4 } from "child_process";
9612
+ import { execSync as execSync5 } from "child_process";
9595
9613
  function _resetCcAgentSupportCache() {
9596
9614
  _cachedSupport = null;
9597
9615
  }
9598
9616
  function claudeSupportsAgentFlag() {
9599
9617
  if (_cachedSupport !== null) return _cachedSupport;
9600
9618
  try {
9601
- const helpOutput = execSync4("claude --help 2>&1", {
9619
+ const helpOutput = execSync5("claude --help 2>&1", {
9602
9620
  encoding: "utf-8",
9603
9621
  timeout: 5e3
9604
9622
  });
@@ -10056,7 +10074,7 @@ var init_session_kill_telemetry = __esm({
10056
10074
  });
10057
10075
 
10058
10076
  // src/lib/project-name.ts
10059
- import { execSync as execSync5 } from "child_process";
10077
+ import { execSync as execSync6 } from "child_process";
10060
10078
  import path17 from "path";
10061
10079
  function getProjectName(cwd) {
10062
10080
  const dir = cwd ?? process.cwd();
@@ -10064,7 +10082,7 @@ function getProjectName(cwd) {
10064
10082
  try {
10065
10083
  let repoRoot;
10066
10084
  try {
10067
- const gitCommonDir = execSync5("git rev-parse --path-format=absolute --git-common-dir", {
10085
+ const gitCommonDir = execSync6("git rev-parse --path-format=absolute --git-common-dir", {
10068
10086
  cwd: dir,
10069
10087
  encoding: "utf8",
10070
10088
  timeout: 2e3,
@@ -10072,7 +10090,7 @@ function getProjectName(cwd) {
10072
10090
  }).trim();
10073
10091
  repoRoot = path17.dirname(gitCommonDir);
10074
10092
  } catch {
10075
- repoRoot = execSync5("git rev-parse --show-toplevel", {
10093
+ repoRoot = execSync6("git rev-parse --show-toplevel", {
10076
10094
  cwd: dir,
10077
10095
  encoding: "utf8",
10078
10096
  timeout: 2e3,
@@ -10163,7 +10181,7 @@ var init_session_scope = __esm({
10163
10181
  import crypto6 from "crypto";
10164
10182
  import path18 from "path";
10165
10183
  import os13 from "os";
10166
- import { execSync as execSync6 } from "child_process";
10184
+ import { execSync as execSync7 } from "child_process";
10167
10185
  import { mkdir as mkdir4, writeFile as writeFile4, appendFile } from "fs/promises";
10168
10186
  import { existsSync as existsSync15, readFileSync as readFileSync12 } from "fs";
10169
10187
  async function writeCheckpoint(input) {
@@ -10508,14 +10526,14 @@ function isTmuxSessionAlive(identifier) {
10508
10526
  if (!identifier || identifier === "unknown") return true;
10509
10527
  try {
10510
10528
  if (identifier.startsWith("%")) {
10511
- const output = execSync6("tmux list-panes -a -F '#{pane_id}'", {
10529
+ const output = execSync7("tmux list-panes -a -F '#{pane_id}'", {
10512
10530
  timeout: 2e3,
10513
10531
  encoding: "utf8",
10514
10532
  stdio: ["pipe", "pipe", "pipe"]
10515
10533
  });
10516
10534
  return output.split("\n").some((l) => l.trim() === identifier);
10517
10535
  } else {
10518
- execSync6(`tmux has-session -t ${JSON.stringify(identifier)}`, {
10536
+ execSync7(`tmux has-session -t ${JSON.stringify(identifier)}`, {
10519
10537
  timeout: 2e3,
10520
10538
  stdio: ["pipe", "pipe", "pipe"]
10521
10539
  });
@@ -10524,7 +10542,7 @@ function isTmuxSessionAlive(identifier) {
10524
10542
  } catch {
10525
10543
  if (identifier.startsWith("%")) return true;
10526
10544
  try {
10527
- execSync6("tmux list-sessions", {
10545
+ execSync7("tmux list-sessions", {
10528
10546
  timeout: 2e3,
10529
10547
  stdio: ["pipe", "pipe", "pipe"]
10530
10548
  });
@@ -10539,12 +10557,12 @@ function checkStaleCompletion(taskContext, taskCreatedAt) {
10539
10557
  if (!DELEGATION_KEYWORDS.test(taskContext)) return null;
10540
10558
  try {
10541
10559
  const since = new Date(taskCreatedAt).toISOString();
10542
- const branch = execSync6(
10560
+ const branch = execSync7(
10543
10561
  "git rev-parse --abbrev-ref HEAD 2>/dev/null",
10544
10562
  { encoding: "utf8", timeout: 3e3 }
10545
10563
  ).trim();
10546
10564
  const branchArg = branch && branch !== "HEAD" ? branch : "";
10547
- const commitCount = execSync6(
10565
+ const commitCount = execSync7(
10548
10566
  `git log --oneline --since="${since}" ${branchArg} 2>/dev/null | wc -l`,
10549
10567
  { encoding: "utf8", timeout: 5e3 }
10550
10568
  ).trim();
@@ -12075,7 +12093,7 @@ __export(tmux_routing_exports, {
12075
12093
  spawnEmployee: () => spawnEmployee,
12076
12094
  verifyPaneAtCapacity: () => verifyPaneAtCapacity
12077
12095
  });
12078
- import { execFileSync as execFileSync2, execSync as execSync7 } from "child_process";
12096
+ import { execFileSync as execFileSync2, execSync as execSync8 } from "child_process";
12079
12097
  import { readFileSync as readFileSync13, writeFileSync as writeFileSync8, mkdirSync as mkdirSync9, existsSync as existsSync17, appendFileSync, readdirSync as readdirSync4 } from "fs";
12080
12098
  import path22 from "path";
12081
12099
  import os14 from "os";
@@ -12796,7 +12814,7 @@ function spawnEmployee(employeeName, exeSession, projectDir, opts) {
12796
12814
  let booted = false;
12797
12815
  for (let i = 0; i < 30; i++) {
12798
12816
  try {
12799
- execSync7("sleep 0.5");
12817
+ execSync8("sleep 0.5");
12800
12818
  } catch {
12801
12819
  }
12802
12820
  try {
@@ -1031,7 +1031,7 @@ __export(exe_daemon_client_exports, {
1031
1031
  });
1032
1032
  import net from "net";
1033
1033
  import os4 from "os";
1034
- import { spawn } from "child_process";
1034
+ import { spawn, execSync as execSync2 } from "child_process";
1035
1035
  import { randomUUID } from "crypto";
1036
1036
  import { existsSync as existsSync5, unlinkSync as unlinkSync2, readFileSync as readFileSync4, openSync, closeSync, statSync } from "fs";
1037
1037
  import path5 from "path";
@@ -1061,6 +1061,14 @@ function handleData(chunk) {
1061
1061
  }
1062
1062
  }
1063
1063
  }
1064
+ function isZombie(pid) {
1065
+ try {
1066
+ const state = execSync2(`ps -p ${pid} -o state=`, { encoding: "utf8", timeout: 2e3 }).trim();
1067
+ return state.startsWith("Z");
1068
+ } catch {
1069
+ return false;
1070
+ }
1071
+ }
1064
1072
  function cleanupStaleFiles() {
1065
1073
  if (existsSync5(PID_PATH)) {
1066
1074
  try {
@@ -1068,7 +1076,11 @@ function cleanupStaleFiles() {
1068
1076
  if (pid > 0) {
1069
1077
  try {
1070
1078
  process.kill(pid, 0);
1071
- return;
1079
+ if (!isZombie(pid)) {
1080
+ return;
1081
+ }
1082
+ process.stderr.write(`[exed-client] PID ${pid} is a zombie \u2014 cleaning up stale files
1083
+ `);
1072
1084
  } catch {
1073
1085
  }
1074
1086
  }
@@ -1096,8 +1108,8 @@ function findPackageRoot() {
1096
1108
  function getAvailableMemoryGB() {
1097
1109
  if (process.platform === "darwin") {
1098
1110
  try {
1099
- const { execSync: execSync5 } = __require("child_process");
1100
- const vmstat = execSync5("vm_stat", { encoding: "utf8" });
1111
+ const { execSync: execSync6 } = __require("child_process");
1112
+ const vmstat = execSync6("vm_stat", { encoding: "utf8" });
1101
1113
  const pageSize = 16384;
1102
1114
  const pageSizeMatch = vmstat.match(/page size of (\d+) bytes/);
1103
1115
  const actualPageSize = pageSizeMatch ? parseInt(pageSizeMatch[1], 10) : pageSize;
@@ -3087,6 +3099,12 @@ async function disposeDatabase() {
3087
3099
  clearInterval(_walCheckpointTimer);
3088
3100
  _walCheckpointTimer = null;
3089
3101
  }
3102
+ if (_client) {
3103
+ try {
3104
+ await _client.execute("PRAGMA wal_checkpoint(PASSIVE)");
3105
+ } catch {
3106
+ }
3107
+ }
3090
3108
  if (_daemonClient) {
3091
3109
  _daemonClient.close();
3092
3110
  _daemonClient = null;
@@ -3123,7 +3141,7 @@ var init_database = __esm({
3123
3141
  // src/lib/keychain.ts
3124
3142
  import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2 } from "fs/promises";
3125
3143
  import { existsSync as existsSync6, statSync as statSync2 } from "fs";
3126
- import { execSync as execSync2 } from "child_process";
3144
+ import { execSync as execSync3 } from "child_process";
3127
3145
  import path6 from "path";
3128
3146
  import os5 from "os";
3129
3147
  function getKeyDir() {
@@ -3140,13 +3158,13 @@ function linuxSecretAvailable() {
3140
3158
  if (process.platform !== "linux") return false;
3141
3159
  if (linuxSecretAvailability !== null) return linuxSecretAvailability;
3142
3160
  try {
3143
- execSync2("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
3161
+ execSync3("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
3144
3162
  } catch {
3145
3163
  linuxSecretAvailability = false;
3146
3164
  return false;
3147
3165
  }
3148
3166
  try {
3149
- execSync2("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
3167
+ execSync3("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
3150
3168
  linuxSecretAvailability = true;
3151
3169
  } catch {
3152
3170
  linuxSecretAvailability = false;
@@ -3170,7 +3188,7 @@ function macKeychainGet(service = SERVICE) {
3170
3188
  if (!nativeKeychainAllowed()) return null;
3171
3189
  if (process.platform !== "darwin") return null;
3172
3190
  try {
3173
- return execSync2(
3191
+ return execSync3(
3174
3192
  `security find-generic-password -s "${service}" -a "${ACCOUNT}" -w 2>/dev/null`,
3175
3193
  { encoding: "utf-8", timeout: 5e3 }
3176
3194
  ).trim();
@@ -3183,13 +3201,13 @@ function macKeychainSet(value, service = SERVICE) {
3183
3201
  if (process.platform !== "darwin") return false;
3184
3202
  try {
3185
3203
  try {
3186
- execSync2(
3204
+ execSync3(
3187
3205
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
3188
3206
  { timeout: 5e3 }
3189
3207
  );
3190
3208
  } catch {
3191
3209
  }
3192
- execSync2(
3210
+ execSync3(
3193
3211
  `security add-generic-password -s "${service}" -a "${ACCOUNT}" -w "${value}"`,
3194
3212
  { timeout: 5e3 }
3195
3213
  );
@@ -3202,7 +3220,7 @@ function macKeychainDelete(service = SERVICE) {
3202
3220
  if (!nativeKeychainAllowed()) return false;
3203
3221
  if (process.platform !== "darwin") return false;
3204
3222
  try {
3205
- execSync2(
3223
+ execSync3(
3206
3224
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
3207
3225
  { timeout: 5e3 }
3208
3226
  );
@@ -3214,7 +3232,7 @@ function macKeychainDelete(service = SERVICE) {
3214
3232
  function linuxSecretGet(service = SERVICE) {
3215
3233
  if (!linuxSecretAvailable()) return null;
3216
3234
  try {
3217
- return execSync2(
3235
+ return execSync3(
3218
3236
  `secret-tool lookup service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3219
3237
  { encoding: "utf-8", timeout: 5e3 }
3220
3238
  ).trim();
@@ -3225,7 +3243,7 @@ function linuxSecretGet(service = SERVICE) {
3225
3243
  function linuxSecretSet(value, service = SERVICE) {
3226
3244
  if (!linuxSecretAvailable()) return false;
3227
3245
  try {
3228
- execSync2(
3246
+ execSync3(
3229
3247
  `echo -n "${value}" | secret-tool store --label="exe-os master key" service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3230
3248
  { timeout: 5e3 }
3231
3249
  );
@@ -3238,7 +3256,7 @@ function linuxSecretDelete(service = SERVICE) {
3238
3256
  if (!nativeKeychainAllowed()) return false;
3239
3257
  if (process.platform !== "linux") return false;
3240
3258
  try {
3241
- execSync2(
3259
+ execSync3(
3242
3260
  `secret-tool clear service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3243
3261
  { timeout: 5e3 }
3244
3262
  );
@@ -5426,7 +5444,7 @@ var init_session_registry = __esm({
5426
5444
  });
5427
5445
 
5428
5446
  // src/lib/session-key.ts
5429
- import { execSync as execSync3 } from "child_process";
5447
+ import { execSync as execSync4 } from "child_process";
5430
5448
  function normalizeCommand(command) {
5431
5449
  const trimmed = command.trim().toLowerCase();
5432
5450
  const parts = trimmed.split(/[\\/]/);
@@ -5445,7 +5463,7 @@ function resolveRuntimeProcess() {
5445
5463
  let pid = process.ppid;
5446
5464
  for (let i = 0; i < 10; i++) {
5447
5465
  try {
5448
- const info = execSync3(`ps -p ${pid} -o ppid=,comm=`, {
5466
+ const info = execSync4(`ps -p ${pid} -o ppid=,comm=`, {
5449
5467
  encoding: "utf8",
5450
5468
  timeout: 2e3
5451
5469
  }).trim();
@@ -5611,7 +5629,7 @@ var init_transport = __esm({
5611
5629
  });
5612
5630
 
5613
5631
  // src/lib/cc-agent-support.ts
5614
- import { execSync as execSync4 } from "child_process";
5632
+ import { execSync as execSync5 } from "child_process";
5615
5633
  var init_cc_agent_support = __esm({
5616
5634
  "src/lib/cc-agent-support.ts"() {
5617
5635
  "use strict";
@@ -6030,8 +6048,8 @@ function hashOutput(text) {
6030
6048
  async function queryPendingReviews() {
6031
6049
  let sessionScope;
6032
6050
  try {
6033
- const { execSync: execSync5 } = await import("child_process");
6034
- const tmuxSession = execSync5("tmux display-message -p '#{session_name}'", { encoding: "utf8", timeout: 2e3 }).trim();
6051
+ const { execSync: execSync6 } = await import("child_process");
6052
+ const tmuxSession = execSync6("tmux display-message -p '#{session_name}'", { encoding: "utf8", timeout: 2e3 }).trim();
6035
6053
  if (isExeSession(tmuxSession)) sessionScope = tmuxSession;
6036
6054
  } catch {
6037
6055
  }
@@ -992,7 +992,7 @@ __export(exe_daemon_client_exports, {
992
992
  });
993
993
  import net from "net";
994
994
  import os4 from "os";
995
- import { spawn } from "child_process";
995
+ import { spawn, execSync as execSync2 } from "child_process";
996
996
  import { randomUUID } from "crypto";
997
997
  import { existsSync as existsSync5, unlinkSync as unlinkSync2, readFileSync as readFileSync4, openSync, closeSync, statSync } from "fs";
998
998
  import path5 from "path";
@@ -1022,6 +1022,14 @@ function handleData(chunk) {
1022
1022
  }
1023
1023
  }
1024
1024
  }
1025
+ function isZombie(pid) {
1026
+ try {
1027
+ const state = execSync2(`ps -p ${pid} -o state=`, { encoding: "utf8", timeout: 2e3 }).trim();
1028
+ return state.startsWith("Z");
1029
+ } catch {
1030
+ return false;
1031
+ }
1032
+ }
1025
1033
  function cleanupStaleFiles() {
1026
1034
  if (existsSync5(PID_PATH)) {
1027
1035
  try {
@@ -1029,7 +1037,11 @@ function cleanupStaleFiles() {
1029
1037
  if (pid > 0) {
1030
1038
  try {
1031
1039
  process.kill(pid, 0);
1032
- return;
1040
+ if (!isZombie(pid)) {
1041
+ return;
1042
+ }
1043
+ process.stderr.write(`[exed-client] PID ${pid} is a zombie \u2014 cleaning up stale files
1044
+ `);
1033
1045
  } catch {
1034
1046
  }
1035
1047
  }
@@ -1057,8 +1069,8 @@ function findPackageRoot() {
1057
1069
  function getAvailableMemoryGB() {
1058
1070
  if (process.platform === "darwin") {
1059
1071
  try {
1060
- const { execSync: execSync4 } = __require("child_process");
1061
- const vmstat = execSync4("vm_stat", { encoding: "utf8" });
1072
+ const { execSync: execSync5 } = __require("child_process");
1073
+ const vmstat = execSync5("vm_stat", { encoding: "utf8" });
1062
1074
  const pageSize = 16384;
1063
1075
  const pageSizeMatch = vmstat.match(/page size of (\d+) bytes/);
1064
1076
  const actualPageSize = pageSizeMatch ? parseInt(pageSizeMatch[1], 10) : pageSize;
@@ -3048,6 +3060,12 @@ async function disposeDatabase() {
3048
3060
  clearInterval(_walCheckpointTimer);
3049
3061
  _walCheckpointTimer = null;
3050
3062
  }
3063
+ if (_client) {
3064
+ try {
3065
+ await _client.execute("PRAGMA wal_checkpoint(PASSIVE)");
3066
+ } catch {
3067
+ }
3068
+ }
3051
3069
  if (_daemonClient) {
3052
3070
  _daemonClient.close();
3053
3071
  _daemonClient = null;
@@ -3084,7 +3102,7 @@ var init_database = __esm({
3084
3102
  // src/lib/keychain.ts
3085
3103
  import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2 } from "fs/promises";
3086
3104
  import { existsSync as existsSync6, statSync as statSync2 } from "fs";
3087
- import { execSync as execSync2 } from "child_process";
3105
+ import { execSync as execSync3 } from "child_process";
3088
3106
  import path6 from "path";
3089
3107
  import os5 from "os";
3090
3108
  function getKeyDir() {
@@ -3101,13 +3119,13 @@ function linuxSecretAvailable() {
3101
3119
  if (process.platform !== "linux") return false;
3102
3120
  if (linuxSecretAvailability !== null) return linuxSecretAvailability;
3103
3121
  try {
3104
- execSync2("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
3122
+ execSync3("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
3105
3123
  } catch {
3106
3124
  linuxSecretAvailability = false;
3107
3125
  return false;
3108
3126
  }
3109
3127
  try {
3110
- execSync2("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
3128
+ execSync3("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
3111
3129
  linuxSecretAvailability = true;
3112
3130
  } catch {
3113
3131
  linuxSecretAvailability = false;
@@ -3131,7 +3149,7 @@ function macKeychainGet(service = SERVICE) {
3131
3149
  if (!nativeKeychainAllowed()) return null;
3132
3150
  if (process.platform !== "darwin") return null;
3133
3151
  try {
3134
- return execSync2(
3152
+ return execSync3(
3135
3153
  `security find-generic-password -s "${service}" -a "${ACCOUNT}" -w 2>/dev/null`,
3136
3154
  { encoding: "utf-8", timeout: 5e3 }
3137
3155
  ).trim();
@@ -3144,13 +3162,13 @@ function macKeychainSet(value, service = SERVICE) {
3144
3162
  if (process.platform !== "darwin") return false;
3145
3163
  try {
3146
3164
  try {
3147
- execSync2(
3165
+ execSync3(
3148
3166
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
3149
3167
  { timeout: 5e3 }
3150
3168
  );
3151
3169
  } catch {
3152
3170
  }
3153
- execSync2(
3171
+ execSync3(
3154
3172
  `security add-generic-password -s "${service}" -a "${ACCOUNT}" -w "${value}"`,
3155
3173
  { timeout: 5e3 }
3156
3174
  );
@@ -3163,7 +3181,7 @@ function macKeychainDelete(service = SERVICE) {
3163
3181
  if (!nativeKeychainAllowed()) return false;
3164
3182
  if (process.platform !== "darwin") return false;
3165
3183
  try {
3166
- execSync2(
3184
+ execSync3(
3167
3185
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
3168
3186
  { timeout: 5e3 }
3169
3187
  );
@@ -3175,7 +3193,7 @@ function macKeychainDelete(service = SERVICE) {
3175
3193
  function linuxSecretGet(service = SERVICE) {
3176
3194
  if (!linuxSecretAvailable()) return null;
3177
3195
  try {
3178
- return execSync2(
3196
+ return execSync3(
3179
3197
  `secret-tool lookup service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3180
3198
  { encoding: "utf-8", timeout: 5e3 }
3181
3199
  ).trim();
@@ -3186,7 +3204,7 @@ function linuxSecretGet(service = SERVICE) {
3186
3204
  function linuxSecretSet(value, service = SERVICE) {
3187
3205
  if (!linuxSecretAvailable()) return false;
3188
3206
  try {
3189
- execSync2(
3207
+ execSync3(
3190
3208
  `echo -n "${value}" | secret-tool store --label="exe-os master key" service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3191
3209
  { timeout: 5e3 }
3192
3210
  );
@@ -3199,7 +3217,7 @@ function linuxSecretDelete(service = SERVICE) {
3199
3217
  if (!nativeKeychainAllowed()) return false;
3200
3218
  if (process.platform !== "linux") return false;
3201
3219
  try {
3202
- execSync2(
3220
+ execSync3(
3203
3221
  `secret-tool clear service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3204
3222
  { timeout: 5e3 }
3205
3223
  );
@@ -5377,7 +5395,7 @@ var init_store = __esm({
5377
5395
 
5378
5396
  // src/bin/exe-kill.ts
5379
5397
  init_store();
5380
- import { execSync as execSync3 } from "child_process";
5398
+ import { execSync as execSync4 } from "child_process";
5381
5399
 
5382
5400
  // src/bin/fast-db-init.ts
5383
5401
  async function fastDbInit() {
@@ -5489,7 +5507,7 @@ function listSessions() {
5489
5507
  var MANUAL_KILL_REASON = "manual";
5490
5508
  function listLiveSessions() {
5491
5509
  try {
5492
- const out = execSync3("tmux list-sessions -F '#{session_name}' 2>/dev/null", {
5510
+ const out = execSync4("tmux list-sessions -F '#{session_name}' 2>/dev/null", {
5493
5511
  encoding: "utf8",
5494
5512
  timeout: 3e3
5495
5513
  });
@@ -5500,7 +5518,7 @@ function listLiveSessions() {
5500
5518
  }
5501
5519
  function currentExeSession() {
5502
5520
  try {
5503
- return execSync3("tmux display-message -p '#{session_name}' 2>/dev/null", {
5521
+ return execSync4("tmux display-message -p '#{session_name}' 2>/dev/null", {
5504
5522
  encoding: "utf8",
5505
5523
  timeout: 3e3
5506
5524
  }).trim() || null;
@@ -5523,7 +5541,7 @@ function resolveAgentId(sessionName, fallbackName) {
5523
5541
  return entry?.agentId ?? fallbackName;
5524
5542
  }
5525
5543
  function killTmuxSession(sessionName) {
5526
- execSync3(
5544
+ execSync4(
5527
5545
  `tmux kill-session -t ${JSON.stringify(sessionName)} 2>/dev/null`,
5528
5546
  { stdio: "ignore" }
5529
5547
  );