@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
@@ -1002,7 +1002,7 @@ __export(exe_daemon_client_exports, {
1002
1002
  });
1003
1003
  import net from "net";
1004
1004
  import os4 from "os";
1005
- import { spawn } from "child_process";
1005
+ import { spawn, execSync as execSync2 } from "child_process";
1006
1006
  import { randomUUID } from "crypto";
1007
1007
  import { existsSync as existsSync5, unlinkSync as unlinkSync2, readFileSync as readFileSync4, openSync, closeSync, statSync } from "fs";
1008
1008
  import path5 from "path";
@@ -1032,6 +1032,14 @@ function handleData(chunk) {
1032
1032
  }
1033
1033
  }
1034
1034
  }
1035
+ function isZombie(pid) {
1036
+ try {
1037
+ const state = execSync2(`ps -p ${pid} -o state=`, { encoding: "utf8", timeout: 2e3 }).trim();
1038
+ return state.startsWith("Z");
1039
+ } catch {
1040
+ return false;
1041
+ }
1042
+ }
1035
1043
  function cleanupStaleFiles() {
1036
1044
  if (existsSync5(PID_PATH)) {
1037
1045
  try {
@@ -1039,7 +1047,11 @@ function cleanupStaleFiles() {
1039
1047
  if (pid > 0) {
1040
1048
  try {
1041
1049
  process.kill(pid, 0);
1042
- return;
1050
+ if (!isZombie(pid)) {
1051
+ return;
1052
+ }
1053
+ process.stderr.write(`[exed-client] PID ${pid} is a zombie \u2014 cleaning up stale files
1054
+ `);
1043
1055
  } catch {
1044
1056
  }
1045
1057
  }
@@ -1067,8 +1079,8 @@ function findPackageRoot() {
1067
1079
  function getAvailableMemoryGB() {
1068
1080
  if (process.platform === "darwin") {
1069
1081
  try {
1070
- const { execSync: execSync5 } = __require("child_process");
1071
- const vmstat = execSync5("vm_stat", { encoding: "utf8" });
1082
+ const { execSync: execSync6 } = __require("child_process");
1083
+ const vmstat = execSync6("vm_stat", { encoding: "utf8" });
1072
1084
  const pageSize = 16384;
1073
1085
  const pageSizeMatch = vmstat.match(/page size of (\d+) bytes/);
1074
1086
  const actualPageSize = pageSizeMatch ? parseInt(pageSizeMatch[1], 10) : pageSize;
@@ -3058,6 +3070,12 @@ async function disposeDatabase() {
3058
3070
  clearInterval(_walCheckpointTimer);
3059
3071
  _walCheckpointTimer = null;
3060
3072
  }
3073
+ if (_client) {
3074
+ try {
3075
+ await _client.execute("PRAGMA wal_checkpoint(PASSIVE)");
3076
+ } catch {
3077
+ }
3078
+ }
3061
3079
  if (_daemonClient) {
3062
3080
  _daemonClient.close();
3063
3081
  _daemonClient = null;
@@ -3103,7 +3121,7 @@ var init_session_registry = __esm({
3103
3121
  });
3104
3122
 
3105
3123
  // src/lib/session-key.ts
3106
- import { execSync as execSync2 } from "child_process";
3124
+ import { execSync as execSync3 } from "child_process";
3107
3125
  function normalizeCommand(command) {
3108
3126
  const trimmed = command.trim().toLowerCase();
3109
3127
  const parts = trimmed.split(/[\\/]/);
@@ -3122,7 +3140,7 @@ function resolveRuntimeProcess() {
3122
3140
  let pid = process.ppid;
3123
3141
  for (let i = 0; i < 10; i++) {
3124
3142
  try {
3125
- const info = execSync2(`ps -p ${pid} -o ppid=,comm=`, {
3143
+ const info = execSync3(`ps -p ${pid} -o ppid=,comm=`, {
3126
3144
  encoding: "utf8",
3127
3145
  timeout: 2e3
3128
3146
  }).trim();
@@ -3288,7 +3306,7 @@ var init_transport = __esm({
3288
3306
  });
3289
3307
 
3290
3308
  // src/lib/cc-agent-support.ts
3291
- import { execSync as execSync3 } from "child_process";
3309
+ import { execSync as execSync4 } from "child_process";
3292
3310
  var init_cc_agent_support = __esm({
3293
3311
  "src/lib/cc-agent-support.ts"() {
3294
3312
  "use strict";
@@ -3521,7 +3539,7 @@ var init_task_scope = __esm({
3521
3539
  // src/lib/keychain.ts
3522
3540
  import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2 } from "fs/promises";
3523
3541
  import { existsSync as existsSync12, statSync as statSync2 } from "fs";
3524
- import { execSync as execSync4 } from "child_process";
3542
+ import { execSync as execSync5 } from "child_process";
3525
3543
  import path13 from "path";
3526
3544
  import os10 from "os";
3527
3545
  function getKeyDir() {
@@ -3538,13 +3556,13 @@ function linuxSecretAvailable() {
3538
3556
  if (process.platform !== "linux") return false;
3539
3557
  if (linuxSecretAvailability !== null) return linuxSecretAvailability;
3540
3558
  try {
3541
- execSync4("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
3559
+ execSync5("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
3542
3560
  } catch {
3543
3561
  linuxSecretAvailability = false;
3544
3562
  return false;
3545
3563
  }
3546
3564
  try {
3547
- execSync4("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
3565
+ execSync5("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
3548
3566
  linuxSecretAvailability = true;
3549
3567
  } catch {
3550
3568
  linuxSecretAvailability = false;
@@ -3568,7 +3586,7 @@ function macKeychainGet(service = SERVICE) {
3568
3586
  if (!nativeKeychainAllowed()) return null;
3569
3587
  if (process.platform !== "darwin") return null;
3570
3588
  try {
3571
- return execSync4(
3589
+ return execSync5(
3572
3590
  `security find-generic-password -s "${service}" -a "${ACCOUNT}" -w 2>/dev/null`,
3573
3591
  { encoding: "utf-8", timeout: 5e3 }
3574
3592
  ).trim();
@@ -3581,13 +3599,13 @@ function macKeychainSet(value, service = SERVICE) {
3581
3599
  if (process.platform !== "darwin") return false;
3582
3600
  try {
3583
3601
  try {
3584
- execSync4(
3602
+ execSync5(
3585
3603
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
3586
3604
  { timeout: 5e3 }
3587
3605
  );
3588
3606
  } catch {
3589
3607
  }
3590
- execSync4(
3608
+ execSync5(
3591
3609
  `security add-generic-password -s "${service}" -a "${ACCOUNT}" -w "${value}"`,
3592
3610
  { timeout: 5e3 }
3593
3611
  );
@@ -3600,7 +3618,7 @@ function macKeychainDelete(service = SERVICE) {
3600
3618
  if (!nativeKeychainAllowed()) return false;
3601
3619
  if (process.platform !== "darwin") return false;
3602
3620
  try {
3603
- execSync4(
3621
+ execSync5(
3604
3622
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
3605
3623
  { timeout: 5e3 }
3606
3624
  );
@@ -3612,7 +3630,7 @@ function macKeychainDelete(service = SERVICE) {
3612
3630
  function linuxSecretGet(service = SERVICE) {
3613
3631
  if (!linuxSecretAvailable()) return null;
3614
3632
  try {
3615
- return execSync4(
3633
+ return execSync5(
3616
3634
  `secret-tool lookup service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3617
3635
  { encoding: "utf-8", timeout: 5e3 }
3618
3636
  ).trim();
@@ -3623,7 +3641,7 @@ function linuxSecretGet(service = SERVICE) {
3623
3641
  function linuxSecretSet(value, service = SERVICE) {
3624
3642
  if (!linuxSecretAvailable()) return false;
3625
3643
  try {
3626
- execSync4(
3644
+ execSync5(
3627
3645
  `echo -n "${value}" | secret-tool store --label="exe-os master key" service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3628
3646
  { timeout: 5e3 }
3629
3647
  );
@@ -3636,7 +3654,7 @@ function linuxSecretDelete(service = SERVICE) {
3636
3654
  if (!nativeKeychainAllowed()) return false;
3637
3655
  if (process.platform !== "linux") return false;
3638
3656
  try {
3639
- execSync4(
3657
+ execSync5(
3640
3658
  `secret-tool clear service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3641
3659
  { timeout: 5e3 }
3642
3660
  );
@@ -1003,7 +1003,7 @@ __export(exe_daemon_client_exports, {
1003
1003
  });
1004
1004
  import net from "net";
1005
1005
  import os4 from "os";
1006
- import { spawn } from "child_process";
1006
+ import { spawn, execSync as execSync2 } from "child_process";
1007
1007
  import { randomUUID } from "crypto";
1008
1008
  import { existsSync as existsSync5, unlinkSync as unlinkSync2, readFileSync as readFileSync4, openSync, closeSync, statSync } from "fs";
1009
1009
  import path5 from "path";
@@ -1033,6 +1033,14 @@ function handleData(chunk) {
1033
1033
  }
1034
1034
  }
1035
1035
  }
1036
+ function isZombie(pid) {
1037
+ try {
1038
+ const state = execSync2(`ps -p ${pid} -o state=`, { encoding: "utf8", timeout: 2e3 }).trim();
1039
+ return state.startsWith("Z");
1040
+ } catch {
1041
+ return false;
1042
+ }
1043
+ }
1036
1044
  function cleanupStaleFiles() {
1037
1045
  if (existsSync5(PID_PATH)) {
1038
1046
  try {
@@ -1040,7 +1048,11 @@ function cleanupStaleFiles() {
1040
1048
  if (pid > 0) {
1041
1049
  try {
1042
1050
  process.kill(pid, 0);
1043
- return;
1051
+ if (!isZombie(pid)) {
1052
+ return;
1053
+ }
1054
+ process.stderr.write(`[exed-client] PID ${pid} is a zombie \u2014 cleaning up stale files
1055
+ `);
1044
1056
  } catch {
1045
1057
  }
1046
1058
  }
@@ -1068,8 +1080,8 @@ function findPackageRoot() {
1068
1080
  function getAvailableMemoryGB() {
1069
1081
  if (process.platform === "darwin") {
1070
1082
  try {
1071
- const { execSync: execSync5 } = __require("child_process");
1072
- const vmstat = execSync5("vm_stat", { encoding: "utf8" });
1083
+ const { execSync: execSync6 } = __require("child_process");
1084
+ const vmstat = execSync6("vm_stat", { encoding: "utf8" });
1073
1085
  const pageSize = 16384;
1074
1086
  const pageSizeMatch = vmstat.match(/page size of (\d+) bytes/);
1075
1087
  const actualPageSize = pageSizeMatch ? parseInt(pageSizeMatch[1], 10) : pageSize;
@@ -3059,6 +3071,12 @@ async function disposeDatabase() {
3059
3071
  clearInterval(_walCheckpointTimer);
3060
3072
  _walCheckpointTimer = null;
3061
3073
  }
3074
+ if (_client) {
3075
+ try {
3076
+ await _client.execute("PRAGMA wal_checkpoint(PASSIVE)");
3077
+ } catch {
3078
+ }
3079
+ }
3062
3080
  if (_daemonClient) {
3063
3081
  _daemonClient.close();
3064
3082
  _daemonClient = null;
@@ -3104,7 +3122,7 @@ var init_session_registry = __esm({
3104
3122
  });
3105
3123
 
3106
3124
  // src/lib/session-key.ts
3107
- import { execSync as execSync2 } from "child_process";
3125
+ import { execSync as execSync3 } from "child_process";
3108
3126
  function normalizeCommand(command) {
3109
3127
  const trimmed = command.trim().toLowerCase();
3110
3128
  const parts = trimmed.split(/[\\/]/);
@@ -3123,7 +3141,7 @@ function resolveRuntimeProcess() {
3123
3141
  let pid = process.ppid;
3124
3142
  for (let i = 0; i < 10; i++) {
3125
3143
  try {
3126
- const info = execSync2(`ps -p ${pid} -o ppid=,comm=`, {
3144
+ const info = execSync3(`ps -p ${pid} -o ppid=,comm=`, {
3127
3145
  encoding: "utf8",
3128
3146
  timeout: 2e3
3129
3147
  }).trim();
@@ -3289,7 +3307,7 @@ var init_transport = __esm({
3289
3307
  });
3290
3308
 
3291
3309
  // src/lib/cc-agent-support.ts
3292
- import { execSync as execSync3 } from "child_process";
3310
+ import { execSync as execSync4 } from "child_process";
3293
3311
  var init_cc_agent_support = __esm({
3294
3312
  "src/lib/cc-agent-support.ts"() {
3295
3313
  "use strict";
@@ -3587,7 +3605,7 @@ var init_notifications = __esm({
3587
3605
  // src/lib/keychain.ts
3588
3606
  import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2 } from "fs/promises";
3589
3607
  import { existsSync as existsSync13, statSync as statSync2 } from "fs";
3590
- import { execSync as execSync4 } from "child_process";
3608
+ import { execSync as execSync5 } from "child_process";
3591
3609
  import path14 from "path";
3592
3610
  import os11 from "os";
3593
3611
  function getKeyDir() {
@@ -3604,13 +3622,13 @@ function linuxSecretAvailable() {
3604
3622
  if (process.platform !== "linux") return false;
3605
3623
  if (linuxSecretAvailability !== null) return linuxSecretAvailability;
3606
3624
  try {
3607
- execSync4("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
3625
+ execSync5("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
3608
3626
  } catch {
3609
3627
  linuxSecretAvailability = false;
3610
3628
  return false;
3611
3629
  }
3612
3630
  try {
3613
- execSync4("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
3631
+ execSync5("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
3614
3632
  linuxSecretAvailability = true;
3615
3633
  } catch {
3616
3634
  linuxSecretAvailability = false;
@@ -3634,7 +3652,7 @@ function macKeychainGet(service = SERVICE) {
3634
3652
  if (!nativeKeychainAllowed()) return null;
3635
3653
  if (process.platform !== "darwin") return null;
3636
3654
  try {
3637
- return execSync4(
3655
+ return execSync5(
3638
3656
  `security find-generic-password -s "${service}" -a "${ACCOUNT}" -w 2>/dev/null`,
3639
3657
  { encoding: "utf-8", timeout: 5e3 }
3640
3658
  ).trim();
@@ -3647,13 +3665,13 @@ function macKeychainSet(value, service = SERVICE) {
3647
3665
  if (process.platform !== "darwin") return false;
3648
3666
  try {
3649
3667
  try {
3650
- execSync4(
3668
+ execSync5(
3651
3669
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
3652
3670
  { timeout: 5e3 }
3653
3671
  );
3654
3672
  } catch {
3655
3673
  }
3656
- execSync4(
3674
+ execSync5(
3657
3675
  `security add-generic-password -s "${service}" -a "${ACCOUNT}" -w "${value}"`,
3658
3676
  { timeout: 5e3 }
3659
3677
  );
@@ -3666,7 +3684,7 @@ function macKeychainDelete(service = SERVICE) {
3666
3684
  if (!nativeKeychainAllowed()) return false;
3667
3685
  if (process.platform !== "darwin") return false;
3668
3686
  try {
3669
- execSync4(
3687
+ execSync5(
3670
3688
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
3671
3689
  { timeout: 5e3 }
3672
3690
  );
@@ -3678,7 +3696,7 @@ function macKeychainDelete(service = SERVICE) {
3678
3696
  function linuxSecretGet(service = SERVICE) {
3679
3697
  if (!linuxSecretAvailable()) return null;
3680
3698
  try {
3681
- return execSync4(
3699
+ return execSync5(
3682
3700
  `secret-tool lookup service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3683
3701
  { encoding: "utf-8", timeout: 5e3 }
3684
3702
  ).trim();
@@ -3689,7 +3707,7 @@ function linuxSecretGet(service = SERVICE) {
3689
3707
  function linuxSecretSet(value, service = SERVICE) {
3690
3708
  if (!linuxSecretAvailable()) return false;
3691
3709
  try {
3692
- execSync4(
3710
+ execSync5(
3693
3711
  `echo -n "${value}" | secret-tool store --label="exe-os master key" service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3694
3712
  { timeout: 5e3 }
3695
3713
  );
@@ -3702,7 +3720,7 @@ function linuxSecretDelete(service = SERVICE) {
3702
3720
  if (!nativeKeychainAllowed()) return false;
3703
3721
  if (process.platform !== "linux") return false;
3704
3722
  try {
3705
- execSync4(
3723
+ execSync5(
3706
3724
  `secret-tool clear service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3707
3725
  { timeout: 5e3 }
3708
3726
  );
@@ -1003,7 +1003,7 @@ __export(exe_daemon_client_exports, {
1003
1003
  });
1004
1004
  import net from "net";
1005
1005
  import os4 from "os";
1006
- import { spawn } from "child_process";
1006
+ import { spawn, execSync as execSync2 } from "child_process";
1007
1007
  import { randomUUID } from "crypto";
1008
1008
  import { existsSync as existsSync5, unlinkSync as unlinkSync2, readFileSync as readFileSync4, openSync, closeSync, statSync } from "fs";
1009
1009
  import path5 from "path";
@@ -1033,6 +1033,14 @@ function handleData(chunk) {
1033
1033
  }
1034
1034
  }
1035
1035
  }
1036
+ function isZombie(pid) {
1037
+ try {
1038
+ const state = execSync2(`ps -p ${pid} -o state=`, { encoding: "utf8", timeout: 2e3 }).trim();
1039
+ return state.startsWith("Z");
1040
+ } catch {
1041
+ return false;
1042
+ }
1043
+ }
1036
1044
  function cleanupStaleFiles() {
1037
1045
  if (existsSync5(PID_PATH)) {
1038
1046
  try {
@@ -1040,7 +1048,11 @@ function cleanupStaleFiles() {
1040
1048
  if (pid > 0) {
1041
1049
  try {
1042
1050
  process.kill(pid, 0);
1043
- return;
1051
+ if (!isZombie(pid)) {
1052
+ return;
1053
+ }
1054
+ process.stderr.write(`[exed-client] PID ${pid} is a zombie \u2014 cleaning up stale files
1055
+ `);
1044
1056
  } catch {
1045
1057
  }
1046
1058
  }
@@ -1068,8 +1080,8 @@ function findPackageRoot() {
1068
1080
  function getAvailableMemoryGB() {
1069
1081
  if (process.platform === "darwin") {
1070
1082
  try {
1071
- const { execSync: execSync5 } = __require("child_process");
1072
- const vmstat = execSync5("vm_stat", { encoding: "utf8" });
1083
+ const { execSync: execSync6 } = __require("child_process");
1084
+ const vmstat = execSync6("vm_stat", { encoding: "utf8" });
1073
1085
  const pageSize = 16384;
1074
1086
  const pageSizeMatch = vmstat.match(/page size of (\d+) bytes/);
1075
1087
  const actualPageSize = pageSizeMatch ? parseInt(pageSizeMatch[1], 10) : pageSize;
@@ -3059,6 +3071,12 @@ async function disposeDatabase() {
3059
3071
  clearInterval(_walCheckpointTimer);
3060
3072
  _walCheckpointTimer = null;
3061
3073
  }
3074
+ if (_client) {
3075
+ try {
3076
+ await _client.execute("PRAGMA wal_checkpoint(PASSIVE)");
3077
+ } catch {
3078
+ }
3079
+ }
3062
3080
  if (_daemonClient) {
3063
3081
  _daemonClient.close();
3064
3082
  _daemonClient = null;
@@ -3104,7 +3122,7 @@ var init_session_registry = __esm({
3104
3122
  });
3105
3123
 
3106
3124
  // src/lib/session-key.ts
3107
- import { execSync as execSync2 } from "child_process";
3125
+ import { execSync as execSync3 } from "child_process";
3108
3126
  function normalizeCommand(command) {
3109
3127
  const trimmed = command.trim().toLowerCase();
3110
3128
  const parts = trimmed.split(/[\\/]/);
@@ -3123,7 +3141,7 @@ function resolveRuntimeProcess() {
3123
3141
  let pid = process.ppid;
3124
3142
  for (let i = 0; i < 10; i++) {
3125
3143
  try {
3126
- const info = execSync2(`ps -p ${pid} -o ppid=,comm=`, {
3144
+ const info = execSync3(`ps -p ${pid} -o ppid=,comm=`, {
3127
3145
  encoding: "utf8",
3128
3146
  timeout: 2e3
3129
3147
  }).trim();
@@ -3289,7 +3307,7 @@ var init_transport = __esm({
3289
3307
  });
3290
3308
 
3291
3309
  // src/lib/cc-agent-support.ts
3292
- import { execSync as execSync3 } from "child_process";
3310
+ import { execSync as execSync4 } from "child_process";
3293
3311
  var init_cc_agent_support = __esm({
3294
3312
  "src/lib/cc-agent-support.ts"() {
3295
3313
  "use strict";
@@ -3681,7 +3699,7 @@ var init_tasks_review = __esm({
3681
3699
  // src/lib/keychain.ts
3682
3700
  import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2 } from "fs/promises";
3683
3701
  import { existsSync as existsSync14, statSync as statSync2 } from "fs";
3684
- import { execSync as execSync4 } from "child_process";
3702
+ import { execSync as execSync5 } from "child_process";
3685
3703
  import path15 from "path";
3686
3704
  import os11 from "os";
3687
3705
  function getKeyDir() {
@@ -3698,13 +3716,13 @@ function linuxSecretAvailable() {
3698
3716
  if (process.platform !== "linux") return false;
3699
3717
  if (linuxSecretAvailability !== null) return linuxSecretAvailability;
3700
3718
  try {
3701
- execSync4("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
3719
+ execSync5("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
3702
3720
  } catch {
3703
3721
  linuxSecretAvailability = false;
3704
3722
  return false;
3705
3723
  }
3706
3724
  try {
3707
- execSync4("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
3725
+ execSync5("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
3708
3726
  linuxSecretAvailability = true;
3709
3727
  } catch {
3710
3728
  linuxSecretAvailability = false;
@@ -3728,7 +3746,7 @@ function macKeychainGet(service = SERVICE) {
3728
3746
  if (!nativeKeychainAllowed()) return null;
3729
3747
  if (process.platform !== "darwin") return null;
3730
3748
  try {
3731
- return execSync4(
3749
+ return execSync5(
3732
3750
  `security find-generic-password -s "${service}" -a "${ACCOUNT}" -w 2>/dev/null`,
3733
3751
  { encoding: "utf-8", timeout: 5e3 }
3734
3752
  ).trim();
@@ -3741,13 +3759,13 @@ function macKeychainSet(value, service = SERVICE) {
3741
3759
  if (process.platform !== "darwin") return false;
3742
3760
  try {
3743
3761
  try {
3744
- execSync4(
3762
+ execSync5(
3745
3763
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
3746
3764
  { timeout: 5e3 }
3747
3765
  );
3748
3766
  } catch {
3749
3767
  }
3750
- execSync4(
3768
+ execSync5(
3751
3769
  `security add-generic-password -s "${service}" -a "${ACCOUNT}" -w "${value}"`,
3752
3770
  { timeout: 5e3 }
3753
3771
  );
@@ -3760,7 +3778,7 @@ function macKeychainDelete(service = SERVICE) {
3760
3778
  if (!nativeKeychainAllowed()) return false;
3761
3779
  if (process.platform !== "darwin") return false;
3762
3780
  try {
3763
- execSync4(
3781
+ execSync5(
3764
3782
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
3765
3783
  { timeout: 5e3 }
3766
3784
  );
@@ -3772,7 +3790,7 @@ function macKeychainDelete(service = SERVICE) {
3772
3790
  function linuxSecretGet(service = SERVICE) {
3773
3791
  if (!linuxSecretAvailable()) return null;
3774
3792
  try {
3775
- return execSync4(
3793
+ return execSync5(
3776
3794
  `secret-tool lookup service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3777
3795
  { encoding: "utf-8", timeout: 5e3 }
3778
3796
  ).trim();
@@ -3783,7 +3801,7 @@ function linuxSecretGet(service = SERVICE) {
3783
3801
  function linuxSecretSet(value, service = SERVICE) {
3784
3802
  if (!linuxSecretAvailable()) return false;
3785
3803
  try {
3786
- execSync4(
3804
+ execSync5(
3787
3805
  `echo -n "${value}" | secret-tool store --label="exe-os master key" service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3788
3806
  { timeout: 5e3 }
3789
3807
  );
@@ -3796,7 +3814,7 @@ function linuxSecretDelete(service = SERVICE) {
3796
3814
  if (!nativeKeychainAllowed()) return false;
3797
3815
  if (process.platform !== "linux") return false;
3798
3816
  try {
3799
- execSync4(
3817
+ execSync5(
3800
3818
  `secret-tool clear service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3801
3819
  { timeout: 5e3 }
3802
3820
  );
@@ -6007,8 +6025,8 @@ async function main() {
6007
6025
  let sessionScope = process.env.EXE_SESSION ? extractRootExe(process.env.EXE_SESSION) ?? void 0 : void 0;
6008
6026
  if (!sessionScope) {
6009
6027
  try {
6010
- const { execSync: execSync5 } = await import("child_process");
6011
- const tmuxSession = execSync5("tmux display-message -p '#{session_name}'", { encoding: "utf8", timeout: 2e3 }).trim();
6028
+ const { execSync: execSync6 } = await import("child_process");
6029
+ const tmuxSession = execSync6("tmux display-message -p '#{session_name}'", { encoding: "utf8", timeout: 2e3 }).trim();
6012
6030
  if (isExeSession(tmuxSession)) sessionScope = tmuxSession;
6013
6031
  } catch {
6014
6032
  }
@@ -1051,7 +1051,7 @@ var init_daemon_auth = __esm({
1051
1051
  // src/lib/exe-daemon-client.ts
1052
1052
  import net from "net";
1053
1053
  import os4 from "os";
1054
- import { spawn } from "child_process";
1054
+ import { spawn, execSync as execSync2 } from "child_process";
1055
1055
  import { randomUUID } from "crypto";
1056
1056
  import { existsSync as existsSync5, unlinkSync as unlinkSync2, readFileSync as readFileSync4, openSync, closeSync, statSync } from "fs";
1057
1057
  import path5 from "path";
@@ -1081,6 +1081,14 @@ function handleData(chunk) {
1081
1081
  }
1082
1082
  }
1083
1083
  }
1084
+ function isZombie(pid) {
1085
+ try {
1086
+ const state = execSync2(`ps -p ${pid} -o state=`, { encoding: "utf8", timeout: 2e3 }).trim();
1087
+ return state.startsWith("Z");
1088
+ } catch {
1089
+ return false;
1090
+ }
1091
+ }
1084
1092
  function cleanupStaleFiles() {
1085
1093
  if (existsSync5(PID_PATH)) {
1086
1094
  try {
@@ -1088,7 +1096,11 @@ function cleanupStaleFiles() {
1088
1096
  if (pid > 0) {
1089
1097
  try {
1090
1098
  process.kill(pid, 0);
1091
- return;
1099
+ if (!isZombie(pid)) {
1100
+ return;
1101
+ }
1102
+ process.stderr.write(`[exed-client] PID ${pid} is a zombie \u2014 cleaning up stale files
1103
+ `);
1092
1104
  } catch {
1093
1105
  }
1094
1106
  }
@@ -1116,8 +1128,8 @@ function findPackageRoot() {
1116
1128
  function getAvailableMemoryGB() {
1117
1129
  if (process.platform === "darwin") {
1118
1130
  try {
1119
- const { execSync: execSync4 } = __require("child_process");
1120
- const vmstat = execSync4("vm_stat", { encoding: "utf8" });
1131
+ const { execSync: execSync5 } = __require("child_process");
1132
+ const vmstat = execSync5("vm_stat", { encoding: "utf8" });
1121
1133
  const pageSize = 16384;
1122
1134
  const pageSizeMatch = vmstat.match(/page size of (\d+) bytes/);
1123
1135
  const actualPageSize = pageSizeMatch ? parseInt(pageSizeMatch[1], 10) : pageSize;
@@ -2903,6 +2915,12 @@ async function disposeDatabase() {
2903
2915
  clearInterval(_walCheckpointTimer);
2904
2916
  _walCheckpointTimer = null;
2905
2917
  }
2918
+ if (_client) {
2919
+ try {
2920
+ await _client.execute("PRAGMA wal_checkpoint(PASSIVE)");
2921
+ } catch {
2922
+ }
2923
+ }
2906
2924
  if (_daemonClient) {
2907
2925
  _daemonClient.close();
2908
2926
  _daemonClient = null;
@@ -3212,7 +3230,7 @@ ${p.content}`).join("\n\n");
3212
3230
  // src/lib/keychain.ts
3213
3231
  import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2 } from "fs/promises";
3214
3232
  import { existsSync as existsSync6, statSync as statSync2 } from "fs";
3215
- import { execSync as execSync2 } from "child_process";
3233
+ import { execSync as execSync3 } from "child_process";
3216
3234
  import path6 from "path";
3217
3235
  import os5 from "os";
3218
3236
  function getKeyDir() {
@@ -3229,13 +3247,13 @@ function linuxSecretAvailable() {
3229
3247
  if (process.platform !== "linux") return false;
3230
3248
  if (linuxSecretAvailability !== null) return linuxSecretAvailability;
3231
3249
  try {
3232
- execSync2("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
3250
+ execSync3("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
3233
3251
  } catch {
3234
3252
  linuxSecretAvailability = false;
3235
3253
  return false;
3236
3254
  }
3237
3255
  try {
3238
- execSync2("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
3256
+ execSync3("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
3239
3257
  linuxSecretAvailability = true;
3240
3258
  } catch {
3241
3259
  linuxSecretAvailability = false;
@@ -3259,7 +3277,7 @@ function macKeychainGet(service = SERVICE) {
3259
3277
  if (!nativeKeychainAllowed()) return null;
3260
3278
  if (process.platform !== "darwin") return null;
3261
3279
  try {
3262
- return execSync2(
3280
+ return execSync3(
3263
3281
  `security find-generic-password -s "${service}" -a "${ACCOUNT}" -w 2>/dev/null`,
3264
3282
  { encoding: "utf-8", timeout: 5e3 }
3265
3283
  ).trim();
@@ -3272,13 +3290,13 @@ function macKeychainSet(value, service = SERVICE) {
3272
3290
  if (process.platform !== "darwin") return false;
3273
3291
  try {
3274
3292
  try {
3275
- execSync2(
3293
+ execSync3(
3276
3294
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
3277
3295
  { timeout: 5e3 }
3278
3296
  );
3279
3297
  } catch {
3280
3298
  }
3281
- execSync2(
3299
+ execSync3(
3282
3300
  `security add-generic-password -s "${service}" -a "${ACCOUNT}" -w "${value}"`,
3283
3301
  { timeout: 5e3 }
3284
3302
  );
@@ -3291,7 +3309,7 @@ function macKeychainDelete(service = SERVICE) {
3291
3309
  if (!nativeKeychainAllowed()) return false;
3292
3310
  if (process.platform !== "darwin") return false;
3293
3311
  try {
3294
- execSync2(
3312
+ execSync3(
3295
3313
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
3296
3314
  { timeout: 5e3 }
3297
3315
  );
@@ -3303,7 +3321,7 @@ function macKeychainDelete(service = SERVICE) {
3303
3321
  function linuxSecretGet(service = SERVICE) {
3304
3322
  if (!linuxSecretAvailable()) return null;
3305
3323
  try {
3306
- return execSync2(
3324
+ return execSync3(
3307
3325
  `secret-tool lookup service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3308
3326
  { encoding: "utf-8", timeout: 5e3 }
3309
3327
  ).trim();
@@ -3314,7 +3332,7 @@ function linuxSecretGet(service = SERVICE) {
3314
3332
  function linuxSecretSet(value, service = SERVICE) {
3315
3333
  if (!linuxSecretAvailable()) return false;
3316
3334
  try {
3317
- execSync2(
3335
+ execSync3(
3318
3336
  `echo -n "${value}" | secret-tool store --label="exe-os master key" service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3319
3337
  { timeout: 5e3 }
3320
3338
  );
@@ -3327,7 +3345,7 @@ function linuxSecretDelete(service = SERVICE) {
3327
3345
  if (!nativeKeychainAllowed()) return false;
3328
3346
  if (process.platform !== "linux") return false;
3329
3347
  try {
3330
- execSync2(
3348
+ execSync3(
3331
3349
  `secret-tool clear service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3332
3350
  { timeout: 5e3 }
3333
3351
  );
@@ -5233,7 +5251,7 @@ var init_store = __esm({
5233
5251
  // src/bin/exe-rename.ts
5234
5252
  init_employees();
5235
5253
  import { readFileSync as readFileSync5, writeFileSync as writeFileSync3, renameSync as renameSync4, unlinkSync as unlinkSync3, existsSync as existsSync8 } from "fs";
5236
- import { execSync as execSync3 } from "child_process";
5254
+ import { execSync as execSync4 } from "child_process";
5237
5255
  import path8 from "path";
5238
5256
  import { homedir } from "os";
5239
5257
 
@@ -5399,7 +5417,7 @@ function rewriteRenamedEmployeeContent(content, oldName, newName) {
5399
5417
  }
5400
5418
  function findExeBin2() {
5401
5419
  try {
5402
- return execSync3(process.platform === "win32" ? "where exe-os" : "which exe-os", { encoding: "utf8" }).trim();
5420
+ return execSync4(process.platform === "win32" ? "where exe-os" : "which exe-os", { encoding: "utf8" }).trim();
5403
5421
  } catch {
5404
5422
  return null;
5405
5423
  }