@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
@@ -981,7 +981,7 @@ var init_daemon_auth = __esm({
981
981
  // src/lib/exe-daemon-client.ts
982
982
  import net from "net";
983
983
  import os4 from "os";
984
- import { spawn } from "child_process";
984
+ import { spawn, execSync as execSync2 } from "child_process";
985
985
  import { randomUUID } from "crypto";
986
986
  import { existsSync as existsSync5, unlinkSync as unlinkSync2, readFileSync as readFileSync4, openSync, closeSync, statSync } from "fs";
987
987
  import path5 from "path";
@@ -1011,6 +1011,14 @@ function handleData(chunk) {
1011
1011
  }
1012
1012
  }
1013
1013
  }
1014
+ function isZombie(pid) {
1015
+ try {
1016
+ const state = execSync2(`ps -p ${pid} -o state=`, { encoding: "utf8", timeout: 2e3 }).trim();
1017
+ return state.startsWith("Z");
1018
+ } catch {
1019
+ return false;
1020
+ }
1021
+ }
1014
1022
  function cleanupStaleFiles() {
1015
1023
  if (existsSync5(PID_PATH)) {
1016
1024
  try {
@@ -1018,7 +1026,11 @@ function cleanupStaleFiles() {
1018
1026
  if (pid > 0) {
1019
1027
  try {
1020
1028
  process.kill(pid, 0);
1021
- return;
1029
+ if (!isZombie(pid)) {
1030
+ return;
1031
+ }
1032
+ process.stderr.write(`[exed-client] PID ${pid} is a zombie \u2014 cleaning up stale files
1033
+ `);
1022
1034
  } catch {
1023
1035
  }
1024
1036
  }
@@ -1046,8 +1058,8 @@ function findPackageRoot() {
1046
1058
  function getAvailableMemoryGB() {
1047
1059
  if (process.platform === "darwin") {
1048
1060
  try {
1049
- const { execSync: execSync3 } = __require("child_process");
1050
- const vmstat = execSync3("vm_stat", { encoding: "utf8" });
1061
+ const { execSync: execSync4 } = __require("child_process");
1062
+ const vmstat = execSync4("vm_stat", { encoding: "utf8" });
1051
1063
  const pageSize = 16384;
1052
1064
  const pageSizeMatch = vmstat.match(/page size of (\d+) bytes/);
1053
1065
  const actualPageSize = pageSizeMatch ? parseInt(pageSizeMatch[1], 10) : pageSize;
@@ -2833,6 +2845,12 @@ async function disposeDatabase() {
2833
2845
  clearInterval(_walCheckpointTimer);
2834
2846
  _walCheckpointTimer = null;
2835
2847
  }
2848
+ if (_client) {
2849
+ try {
2850
+ await _client.execute("PRAGMA wal_checkpoint(PASSIVE)");
2851
+ } catch {
2852
+ }
2853
+ }
2836
2854
  if (_daemonClient) {
2837
2855
  _daemonClient.close();
2838
2856
  _daemonClient = null;
@@ -3987,7 +4005,7 @@ init_database();
3987
4005
  // src/lib/keychain.ts
3988
4006
  import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2 } from "fs/promises";
3989
4007
  import { existsSync as existsSync6, statSync as statSync2 } from "fs";
3990
- import { execSync as execSync2 } from "child_process";
4008
+ import { execSync as execSync3 } from "child_process";
3991
4009
  import path6 from "path";
3992
4010
  import os5 from "os";
3993
4011
  var SERVICE = "exe-os";
@@ -4008,13 +4026,13 @@ function linuxSecretAvailable() {
4008
4026
  if (process.platform !== "linux") return false;
4009
4027
  if (linuxSecretAvailability !== null) return linuxSecretAvailability;
4010
4028
  try {
4011
- execSync2("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
4029
+ execSync3("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
4012
4030
  } catch {
4013
4031
  linuxSecretAvailability = false;
4014
4032
  return false;
4015
4033
  }
4016
4034
  try {
4017
- execSync2("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
4035
+ execSync3("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
4018
4036
  linuxSecretAvailability = true;
4019
4037
  } catch {
4020
4038
  linuxSecretAvailability = false;
@@ -4038,7 +4056,7 @@ function macKeychainGet(service = SERVICE) {
4038
4056
  if (!nativeKeychainAllowed()) return null;
4039
4057
  if (process.platform !== "darwin") return null;
4040
4058
  try {
4041
- return execSync2(
4059
+ return execSync3(
4042
4060
  `security find-generic-password -s "${service}" -a "${ACCOUNT}" -w 2>/dev/null`,
4043
4061
  { encoding: "utf-8", timeout: 5e3 }
4044
4062
  ).trim();
@@ -4051,13 +4069,13 @@ function macKeychainSet(value, service = SERVICE) {
4051
4069
  if (process.platform !== "darwin") return false;
4052
4070
  try {
4053
4071
  try {
4054
- execSync2(
4072
+ execSync3(
4055
4073
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
4056
4074
  { timeout: 5e3 }
4057
4075
  );
4058
4076
  } catch {
4059
4077
  }
4060
- execSync2(
4078
+ execSync3(
4061
4079
  `security add-generic-password -s "${service}" -a "${ACCOUNT}" -w "${value}"`,
4062
4080
  { timeout: 5e3 }
4063
4081
  );
@@ -4070,7 +4088,7 @@ function macKeychainDelete(service = SERVICE) {
4070
4088
  if (!nativeKeychainAllowed()) return false;
4071
4089
  if (process.platform !== "darwin") return false;
4072
4090
  try {
4073
- execSync2(
4091
+ execSync3(
4074
4092
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
4075
4093
  { timeout: 5e3 }
4076
4094
  );
@@ -4082,7 +4100,7 @@ function macKeychainDelete(service = SERVICE) {
4082
4100
  function linuxSecretGet(service = SERVICE) {
4083
4101
  if (!linuxSecretAvailable()) return null;
4084
4102
  try {
4085
- return execSync2(
4103
+ return execSync3(
4086
4104
  `secret-tool lookup service "${service}" account "${ACCOUNT}" 2>/dev/null`,
4087
4105
  { encoding: "utf-8", timeout: 5e3 }
4088
4106
  ).trim();
@@ -4093,7 +4111,7 @@ function linuxSecretGet(service = SERVICE) {
4093
4111
  function linuxSecretSet(value, service = SERVICE) {
4094
4112
  if (!linuxSecretAvailable()) return false;
4095
4113
  try {
4096
- execSync2(
4114
+ execSync3(
4097
4115
  `echo -n "${value}" | secret-tool store --label="exe-os master key" service "${service}" account "${ACCOUNT}" 2>/dev/null`,
4098
4116
  { timeout: 5e3 }
4099
4117
  );
@@ -4106,7 +4124,7 @@ function linuxSecretDelete(service = SERVICE) {
4106
4124
  if (!nativeKeychainAllowed()) return false;
4107
4125
  if (process.platform !== "linux") return false;
4108
4126
  try {
4109
- execSync2(
4127
+ execSync3(
4110
4128
  `secret-tool clear service "${service}" account "${ACCOUNT}" 2>/dev/null`,
4111
4129
  { timeout: 5e3 }
4112
4130
  );
@@ -981,7 +981,7 @@ var init_daemon_auth = __esm({
981
981
  // src/lib/exe-daemon-client.ts
982
982
  import net from "net";
983
983
  import os4 from "os";
984
- import { spawn } from "child_process";
984
+ import { spawn, execSync as execSync2 } from "child_process";
985
985
  import { randomUUID } from "crypto";
986
986
  import { existsSync as existsSync5, unlinkSync as unlinkSync2, readFileSync as readFileSync4, openSync, closeSync, statSync } from "fs";
987
987
  import path5 from "path";
@@ -1011,6 +1011,14 @@ function handleData(chunk) {
1011
1011
  }
1012
1012
  }
1013
1013
  }
1014
+ function isZombie(pid) {
1015
+ try {
1016
+ const state = execSync2(`ps -p ${pid} -o state=`, { encoding: "utf8", timeout: 2e3 }).trim();
1017
+ return state.startsWith("Z");
1018
+ } catch {
1019
+ return false;
1020
+ }
1021
+ }
1014
1022
  function cleanupStaleFiles() {
1015
1023
  if (existsSync5(PID_PATH)) {
1016
1024
  try {
@@ -1018,7 +1026,11 @@ function cleanupStaleFiles() {
1018
1026
  if (pid > 0) {
1019
1027
  try {
1020
1028
  process.kill(pid, 0);
1021
- return;
1029
+ if (!isZombie(pid)) {
1030
+ return;
1031
+ }
1032
+ process.stderr.write(`[exed-client] PID ${pid} is a zombie \u2014 cleaning up stale files
1033
+ `);
1022
1034
  } catch {
1023
1035
  }
1024
1036
  }
@@ -1046,8 +1058,8 @@ function findPackageRoot() {
1046
1058
  function getAvailableMemoryGB() {
1047
1059
  if (process.platform === "darwin") {
1048
1060
  try {
1049
- const { execSync: execSync3 } = __require("child_process");
1050
- const vmstat = execSync3("vm_stat", { encoding: "utf8" });
1061
+ const { execSync: execSync4 } = __require("child_process");
1062
+ const vmstat = execSync4("vm_stat", { encoding: "utf8" });
1051
1063
  const pageSize = 16384;
1052
1064
  const pageSizeMatch = vmstat.match(/page size of (\d+) bytes/);
1053
1065
  const actualPageSize = pageSizeMatch ? parseInt(pageSizeMatch[1], 10) : pageSize;
@@ -2833,6 +2845,12 @@ async function disposeDatabase() {
2833
2845
  clearInterval(_walCheckpointTimer);
2834
2846
  _walCheckpointTimer = null;
2835
2847
  }
2848
+ if (_client) {
2849
+ try {
2850
+ await _client.execute("PRAGMA wal_checkpoint(PASSIVE)");
2851
+ } catch {
2852
+ }
2853
+ }
2836
2854
  if (_daemonClient) {
2837
2855
  _daemonClient.close();
2838
2856
  _daemonClient = null;
@@ -3575,7 +3593,7 @@ init_database();
3575
3593
  // src/lib/keychain.ts
3576
3594
  import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2 } from "fs/promises";
3577
3595
  import { existsSync as existsSync6, statSync as statSync2 } from "fs";
3578
- import { execSync as execSync2 } from "child_process";
3596
+ import { execSync as execSync3 } from "child_process";
3579
3597
  import path6 from "path";
3580
3598
  import os5 from "os";
3581
3599
  var SERVICE = "exe-os";
@@ -3596,13 +3614,13 @@ function linuxSecretAvailable() {
3596
3614
  if (process.platform !== "linux") return false;
3597
3615
  if (linuxSecretAvailability !== null) return linuxSecretAvailability;
3598
3616
  try {
3599
- execSync2("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
3617
+ execSync3("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
3600
3618
  } catch {
3601
3619
  linuxSecretAvailability = false;
3602
3620
  return false;
3603
3621
  }
3604
3622
  try {
3605
- execSync2("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
3623
+ execSync3("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
3606
3624
  linuxSecretAvailability = true;
3607
3625
  } catch {
3608
3626
  linuxSecretAvailability = false;
@@ -3626,7 +3644,7 @@ function macKeychainGet(service = SERVICE) {
3626
3644
  if (!nativeKeychainAllowed()) return null;
3627
3645
  if (process.platform !== "darwin") return null;
3628
3646
  try {
3629
- return execSync2(
3647
+ return execSync3(
3630
3648
  `security find-generic-password -s "${service}" -a "${ACCOUNT}" -w 2>/dev/null`,
3631
3649
  { encoding: "utf-8", timeout: 5e3 }
3632
3650
  ).trim();
@@ -3639,13 +3657,13 @@ function macKeychainSet(value, service = SERVICE) {
3639
3657
  if (process.platform !== "darwin") return false;
3640
3658
  try {
3641
3659
  try {
3642
- execSync2(
3660
+ execSync3(
3643
3661
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
3644
3662
  { timeout: 5e3 }
3645
3663
  );
3646
3664
  } catch {
3647
3665
  }
3648
- execSync2(
3666
+ execSync3(
3649
3667
  `security add-generic-password -s "${service}" -a "${ACCOUNT}" -w "${value}"`,
3650
3668
  { timeout: 5e3 }
3651
3669
  );
@@ -3658,7 +3676,7 @@ function macKeychainDelete(service = SERVICE) {
3658
3676
  if (!nativeKeychainAllowed()) return false;
3659
3677
  if (process.platform !== "darwin") return false;
3660
3678
  try {
3661
- execSync2(
3679
+ execSync3(
3662
3680
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
3663
3681
  { timeout: 5e3 }
3664
3682
  );
@@ -3670,7 +3688,7 @@ function macKeychainDelete(service = SERVICE) {
3670
3688
  function linuxSecretGet(service = SERVICE) {
3671
3689
  if (!linuxSecretAvailable()) return null;
3672
3690
  try {
3673
- return execSync2(
3691
+ return execSync3(
3674
3692
  `secret-tool lookup service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3675
3693
  { encoding: "utf-8", timeout: 5e3 }
3676
3694
  ).trim();
@@ -3681,7 +3699,7 @@ function linuxSecretGet(service = SERVICE) {
3681
3699
  function linuxSecretSet(value, service = SERVICE) {
3682
3700
  if (!linuxSecretAvailable()) return false;
3683
3701
  try {
3684
- execSync2(
3702
+ execSync3(
3685
3703
  `echo -n "${value}" | secret-tool store --label="exe-os master key" service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3686
3704
  { timeout: 5e3 }
3687
3705
  );
@@ -3694,7 +3712,7 @@ function linuxSecretDelete(service = SERVICE) {
3694
3712
  if (!nativeKeychainAllowed()) return false;
3695
3713
  if (process.platform !== "linux") return false;
3696
3714
  try {
3697
- execSync2(
3715
+ execSync3(
3698
3716
  `secret-tool clear service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3699
3717
  { timeout: 5e3 }
3700
3718
  );
@@ -981,7 +981,7 @@ var init_daemon_auth = __esm({
981
981
  // src/lib/exe-daemon-client.ts
982
982
  import net from "net";
983
983
  import os4 from "os";
984
- import { spawn } from "child_process";
984
+ import { spawn, execSync as execSync2 } from "child_process";
985
985
  import { randomUUID } from "crypto";
986
986
  import { existsSync as existsSync5, unlinkSync as unlinkSync2, readFileSync as readFileSync4, openSync, closeSync, statSync } from "fs";
987
987
  import path5 from "path";
@@ -1011,6 +1011,14 @@ function handleData(chunk) {
1011
1011
  }
1012
1012
  }
1013
1013
  }
1014
+ function isZombie(pid) {
1015
+ try {
1016
+ const state = execSync2(`ps -p ${pid} -o state=`, { encoding: "utf8", timeout: 2e3 }).trim();
1017
+ return state.startsWith("Z");
1018
+ } catch {
1019
+ return false;
1020
+ }
1021
+ }
1014
1022
  function cleanupStaleFiles() {
1015
1023
  if (existsSync5(PID_PATH)) {
1016
1024
  try {
@@ -1018,7 +1026,11 @@ function cleanupStaleFiles() {
1018
1026
  if (pid > 0) {
1019
1027
  try {
1020
1028
  process.kill(pid, 0);
1021
- return;
1029
+ if (!isZombie(pid)) {
1030
+ return;
1031
+ }
1032
+ process.stderr.write(`[exed-client] PID ${pid} is a zombie \u2014 cleaning up stale files
1033
+ `);
1022
1034
  } catch {
1023
1035
  }
1024
1036
  }
@@ -1046,8 +1058,8 @@ function findPackageRoot() {
1046
1058
  function getAvailableMemoryGB() {
1047
1059
  if (process.platform === "darwin") {
1048
1060
  try {
1049
- const { execSync: execSync3 } = __require("child_process");
1050
- const vmstat = execSync3("vm_stat", { encoding: "utf8" });
1061
+ const { execSync: execSync4 } = __require("child_process");
1062
+ const vmstat = execSync4("vm_stat", { encoding: "utf8" });
1051
1063
  const pageSize = 16384;
1052
1064
  const pageSizeMatch = vmstat.match(/page size of (\d+) bytes/);
1053
1065
  const actualPageSize = pageSizeMatch ? parseInt(pageSizeMatch[1], 10) : pageSize;
@@ -2833,6 +2845,12 @@ async function disposeDatabase() {
2833
2845
  clearInterval(_walCheckpointTimer);
2834
2846
  _walCheckpointTimer = null;
2835
2847
  }
2848
+ if (_client) {
2849
+ try {
2850
+ await _client.execute("PRAGMA wal_checkpoint(PASSIVE)");
2851
+ } catch {
2852
+ }
2853
+ }
2836
2854
  if (_daemonClient) {
2837
2855
  _daemonClient.close();
2838
2856
  _daemonClient = null;
@@ -3699,7 +3717,7 @@ init_database();
3699
3717
  // src/lib/keychain.ts
3700
3718
  import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2 } from "fs/promises";
3701
3719
  import { existsSync as existsSync6, statSync as statSync2 } from "fs";
3702
- import { execSync as execSync2 } from "child_process";
3720
+ import { execSync as execSync3 } from "child_process";
3703
3721
  import path6 from "path";
3704
3722
  import os5 from "os";
3705
3723
  var SERVICE = "exe-os";
@@ -3720,13 +3738,13 @@ function linuxSecretAvailable() {
3720
3738
  if (process.platform !== "linux") return false;
3721
3739
  if (linuxSecretAvailability !== null) return linuxSecretAvailability;
3722
3740
  try {
3723
- execSync2("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
3741
+ execSync3("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
3724
3742
  } catch {
3725
3743
  linuxSecretAvailability = false;
3726
3744
  return false;
3727
3745
  }
3728
3746
  try {
3729
- execSync2("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
3747
+ execSync3("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
3730
3748
  linuxSecretAvailability = true;
3731
3749
  } catch {
3732
3750
  linuxSecretAvailability = false;
@@ -3750,7 +3768,7 @@ function macKeychainGet(service = SERVICE) {
3750
3768
  if (!nativeKeychainAllowed()) return null;
3751
3769
  if (process.platform !== "darwin") return null;
3752
3770
  try {
3753
- return execSync2(
3771
+ return execSync3(
3754
3772
  `security find-generic-password -s "${service}" -a "${ACCOUNT}" -w 2>/dev/null`,
3755
3773
  { encoding: "utf-8", timeout: 5e3 }
3756
3774
  ).trim();
@@ -3763,13 +3781,13 @@ function macKeychainSet(value, service = SERVICE) {
3763
3781
  if (process.platform !== "darwin") return false;
3764
3782
  try {
3765
3783
  try {
3766
- execSync2(
3784
+ execSync3(
3767
3785
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
3768
3786
  { timeout: 5e3 }
3769
3787
  );
3770
3788
  } catch {
3771
3789
  }
3772
- execSync2(
3790
+ execSync3(
3773
3791
  `security add-generic-password -s "${service}" -a "${ACCOUNT}" -w "${value}"`,
3774
3792
  { timeout: 5e3 }
3775
3793
  );
@@ -3782,7 +3800,7 @@ function macKeychainDelete(service = SERVICE) {
3782
3800
  if (!nativeKeychainAllowed()) return false;
3783
3801
  if (process.platform !== "darwin") return false;
3784
3802
  try {
3785
- execSync2(
3803
+ execSync3(
3786
3804
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
3787
3805
  { timeout: 5e3 }
3788
3806
  );
@@ -3794,7 +3812,7 @@ function macKeychainDelete(service = SERVICE) {
3794
3812
  function linuxSecretGet(service = SERVICE) {
3795
3813
  if (!linuxSecretAvailable()) return null;
3796
3814
  try {
3797
- return execSync2(
3815
+ return execSync3(
3798
3816
  `secret-tool lookup service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3799
3817
  { encoding: "utf-8", timeout: 5e3 }
3800
3818
  ).trim();
@@ -3805,7 +3823,7 @@ function linuxSecretGet(service = SERVICE) {
3805
3823
  function linuxSecretSet(value, service = SERVICE) {
3806
3824
  if (!linuxSecretAvailable()) return false;
3807
3825
  try {
3808
- execSync2(
3826
+ execSync3(
3809
3827
  `echo -n "${value}" | secret-tool store --label="exe-os master key" service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3810
3828
  { timeout: 5e3 }
3811
3829
  );
@@ -3818,7 +3836,7 @@ function linuxSecretDelete(service = SERVICE) {
3818
3836
  if (!nativeKeychainAllowed()) return false;
3819
3837
  if (process.platform !== "linux") return false;
3820
3838
  try {
3821
- execSync2(
3839
+ execSync3(
3822
3840
  `secret-tool clear service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3823
3841
  { timeout: 5e3 }
3824
3842
  );
@@ -985,7 +985,7 @@ var init_daemon_auth = __esm({
985
985
  // src/lib/exe-daemon-client.ts
986
986
  import net from "net";
987
987
  import os4 from "os";
988
- import { spawn } from "child_process";
988
+ import { spawn, execSync as execSync2 } from "child_process";
989
989
  import { randomUUID } from "crypto";
990
990
  import { existsSync as existsSync5, unlinkSync as unlinkSync2, readFileSync as readFileSync4, openSync, closeSync, statSync } from "fs";
991
991
  import path5 from "path";
@@ -1015,6 +1015,14 @@ function handleData(chunk) {
1015
1015
  }
1016
1016
  }
1017
1017
  }
1018
+ function isZombie(pid) {
1019
+ try {
1020
+ const state = execSync2(`ps -p ${pid} -o state=`, { encoding: "utf8", timeout: 2e3 }).trim();
1021
+ return state.startsWith("Z");
1022
+ } catch {
1023
+ return false;
1024
+ }
1025
+ }
1018
1026
  function cleanupStaleFiles() {
1019
1027
  if (existsSync5(PID_PATH)) {
1020
1028
  try {
@@ -1022,7 +1030,11 @@ function cleanupStaleFiles() {
1022
1030
  if (pid > 0) {
1023
1031
  try {
1024
1032
  process.kill(pid, 0);
1025
- return;
1033
+ if (!isZombie(pid)) {
1034
+ return;
1035
+ }
1036
+ process.stderr.write(`[exed-client] PID ${pid} is a zombie \u2014 cleaning up stale files
1037
+ `);
1026
1038
  } catch {
1027
1039
  }
1028
1040
  }
@@ -1050,8 +1062,8 @@ function findPackageRoot() {
1050
1062
  function getAvailableMemoryGB() {
1051
1063
  if (process.platform === "darwin") {
1052
1064
  try {
1053
- const { execSync: execSync3 } = __require("child_process");
1054
- const vmstat = execSync3("vm_stat", { encoding: "utf8" });
1065
+ const { execSync: execSync4 } = __require("child_process");
1066
+ const vmstat = execSync4("vm_stat", { encoding: "utf8" });
1055
1067
  const pageSize = 16384;
1056
1068
  const pageSizeMatch = vmstat.match(/page size of (\d+) bytes/);
1057
1069
  const actualPageSize = pageSizeMatch ? parseInt(pageSizeMatch[1], 10) : pageSize;
@@ -2973,6 +2985,12 @@ async function disposeDatabase() {
2973
2985
  clearInterval(_walCheckpointTimer);
2974
2986
  _walCheckpointTimer = null;
2975
2987
  }
2988
+ if (_client) {
2989
+ try {
2990
+ await _client.execute("PRAGMA wal_checkpoint(PASSIVE)");
2991
+ } catch {
2992
+ }
2993
+ }
2976
2994
  if (_daemonClient) {
2977
2995
  _daemonClient.close();
2978
2996
  _daemonClient = null;
@@ -4136,7 +4154,7 @@ init_database();
4136
4154
  // src/lib/keychain.ts
4137
4155
  import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2 } from "fs/promises";
4138
4156
  import { existsSync as existsSync6, statSync as statSync2 } from "fs";
4139
- import { execSync as execSync2 } from "child_process";
4157
+ import { execSync as execSync3 } from "child_process";
4140
4158
  import path6 from "path";
4141
4159
  import os5 from "os";
4142
4160
  var SERVICE = "exe-os";
@@ -4157,13 +4175,13 @@ function linuxSecretAvailable() {
4157
4175
  if (process.platform !== "linux") return false;
4158
4176
  if (linuxSecretAvailability !== null) return linuxSecretAvailability;
4159
4177
  try {
4160
- execSync2("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
4178
+ execSync3("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
4161
4179
  } catch {
4162
4180
  linuxSecretAvailability = false;
4163
4181
  return false;
4164
4182
  }
4165
4183
  try {
4166
- execSync2("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
4184
+ execSync3("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
4167
4185
  linuxSecretAvailability = true;
4168
4186
  } catch {
4169
4187
  linuxSecretAvailability = false;
@@ -4187,7 +4205,7 @@ function macKeychainGet(service = SERVICE) {
4187
4205
  if (!nativeKeychainAllowed()) return null;
4188
4206
  if (process.platform !== "darwin") return null;
4189
4207
  try {
4190
- return execSync2(
4208
+ return execSync3(
4191
4209
  `security find-generic-password -s "${service}" -a "${ACCOUNT}" -w 2>/dev/null`,
4192
4210
  { encoding: "utf-8", timeout: 5e3 }
4193
4211
  ).trim();
@@ -4200,13 +4218,13 @@ function macKeychainSet(value, service = SERVICE) {
4200
4218
  if (process.platform !== "darwin") return false;
4201
4219
  try {
4202
4220
  try {
4203
- execSync2(
4221
+ execSync3(
4204
4222
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
4205
4223
  { timeout: 5e3 }
4206
4224
  );
4207
4225
  } catch {
4208
4226
  }
4209
- execSync2(
4227
+ execSync3(
4210
4228
  `security add-generic-password -s "${service}" -a "${ACCOUNT}" -w "${value}"`,
4211
4229
  { timeout: 5e3 }
4212
4230
  );
@@ -4219,7 +4237,7 @@ function macKeychainDelete(service = SERVICE) {
4219
4237
  if (!nativeKeychainAllowed()) return false;
4220
4238
  if (process.platform !== "darwin") return false;
4221
4239
  try {
4222
- execSync2(
4240
+ execSync3(
4223
4241
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
4224
4242
  { timeout: 5e3 }
4225
4243
  );
@@ -4231,7 +4249,7 @@ function macKeychainDelete(service = SERVICE) {
4231
4249
  function linuxSecretGet(service = SERVICE) {
4232
4250
  if (!linuxSecretAvailable()) return null;
4233
4251
  try {
4234
- return execSync2(
4252
+ return execSync3(
4235
4253
  `secret-tool lookup service "${service}" account "${ACCOUNT}" 2>/dev/null`,
4236
4254
  { encoding: "utf-8", timeout: 5e3 }
4237
4255
  ).trim();
@@ -4242,7 +4260,7 @@ function linuxSecretGet(service = SERVICE) {
4242
4260
  function linuxSecretSet(value, service = SERVICE) {
4243
4261
  if (!linuxSecretAvailable()) return false;
4244
4262
  try {
4245
- execSync2(
4263
+ execSync3(
4246
4264
  `echo -n "${value}" | secret-tool store --label="exe-os master key" service "${service}" account "${ACCOUNT}" 2>/dev/null`,
4247
4265
  { timeout: 5e3 }
4248
4266
  );
@@ -4255,7 +4273,7 @@ function linuxSecretDelete(service = SERVICE) {
4255
4273
  if (!nativeKeychainAllowed()) return false;
4256
4274
  if (process.platform !== "linux") return false;
4257
4275
  try {
4258
- execSync2(
4276
+ execSync3(
4259
4277
  `secret-tool clear service "${service}" account "${ACCOUNT}" 2>/dev/null`,
4260
4278
  { timeout: 5e3 }
4261
4279
  );