@askexenow/exe-os 0.9.85 → 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 (80) 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 +152 -77
  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 +40 -22
  21. package/dist/bin/exe-pending-messages.js +35 -17
  22. package/dist/bin/exe-pending-notifications.js +35 -17
  23. package/dist/bin/exe-pending-reviews.js +37 -19
  24. package/dist/bin/exe-rename.js +34 -16
  25. package/dist/bin/exe-review.js +32 -14
  26. package/dist/bin/exe-search.js +40 -22
  27. package/dist/bin/exe-session-cleanup.js +67 -44
  28. package/dist/bin/exe-start-codex.js +39 -21
  29. package/dist/bin/exe-start-opencode.js +37 -19
  30. package/dist/bin/exe-status.js +44 -26
  31. package/dist/bin/exe-team.js +32 -14
  32. package/dist/bin/git-sweep.js +45 -27
  33. package/dist/bin/graph-backfill.js +32 -14
  34. package/dist/bin/graph-export.js +32 -14
  35. package/dist/bin/intercom-check.js +49 -31
  36. package/dist/bin/scan-tasks.js +45 -27
  37. package/dist/bin/setup.js +29 -11
  38. package/dist/bin/shard-migrate.js +32 -14
  39. package/dist/bin/stack-update.js +59 -2
  40. package/dist/bin/update.js +1 -1
  41. package/dist/gateway/index.js +47 -29
  42. package/dist/hooks/bug-report-worker.js +47 -29
  43. package/dist/hooks/codex-stop-task-finalizer.js +41 -23
  44. package/dist/hooks/commit-complete.js +46 -28
  45. package/dist/hooks/error-recall.js +44 -26
  46. package/dist/hooks/ingest-worker.js +4 -4
  47. package/dist/hooks/ingest.js +38 -20
  48. package/dist/hooks/instructions-loaded.js +32 -14
  49. package/dist/hooks/notification.js +32 -14
  50. package/dist/hooks/post-compact.js +32 -14
  51. package/dist/hooks/post-tool-combined.js +45 -27
  52. package/dist/hooks/pre-compact.js +43 -25
  53. package/dist/hooks/pre-tool-use.js +40 -22
  54. package/dist/hooks/prompt-submit.js +60 -42
  55. package/dist/hooks/session-end.js +48 -30
  56. package/dist/hooks/session-start.js +50 -32
  57. package/dist/hooks/stop.js +35 -17
  58. package/dist/hooks/subagent-stop.js +32 -14
  59. package/dist/hooks/summary-worker.js +37 -19
  60. package/dist/index.js +43 -25
  61. package/dist/lib/cloud-sync.js +32 -14
  62. package/dist/lib/database.js +22 -4
  63. package/dist/lib/db-daemon-client.js +16 -4
  64. package/dist/lib/db.js +22 -4
  65. package/dist/lib/device-registry.js +22 -4
  66. package/dist/lib/embedder.js +16 -4
  67. package/dist/lib/exe-daemon-client.js +16 -4
  68. package/dist/lib/exe-daemon.js +165 -66
  69. package/dist/lib/hybrid-search.js +40 -22
  70. package/dist/lib/schedules.js +35 -17
  71. package/dist/lib/skill-learning.js +16 -4
  72. package/dist/lib/store.js +32 -14
  73. package/dist/lib/tasks.js +16 -4
  74. package/dist/lib/tmux-routing.js +18 -6
  75. package/dist/mcp/server.js +142 -60
  76. package/dist/mcp/tools/create-task.js +18 -6
  77. package/dist/mcp/tools/update-task.js +18 -6
  78. package/dist/runtime/index.js +43 -25
  79. package/dist/tui/App.js +73 -55
  80. package/package.json +1 -1
@@ -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: execSync3 } = __require("child_process");
1072
- const vmstat = execSync3("vm_stat", { encoding: "utf8" });
1083
+ const { execSync: execSync4 } = __require("child_process");
1084
+ const vmstat = execSync4("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;
@@ -3095,7 +3113,7 @@ var init_database = __esm({
3095
3113
  // src/lib/keychain.ts
3096
3114
  import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2 } from "fs/promises";
3097
3115
  import { existsSync as existsSync6, statSync as statSync2 } from "fs";
3098
- import { execSync as execSync2 } from "child_process";
3116
+ import { execSync as execSync3 } from "child_process";
3099
3117
  import path6 from "path";
3100
3118
  import os5 from "os";
3101
3119
  function getKeyDir() {
@@ -3112,13 +3130,13 @@ function linuxSecretAvailable() {
3112
3130
  if (process.platform !== "linux") return false;
3113
3131
  if (linuxSecretAvailability !== null) return linuxSecretAvailability;
3114
3132
  try {
3115
- execSync2("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
3133
+ execSync3("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
3116
3134
  } catch {
3117
3135
  linuxSecretAvailability = false;
3118
3136
  return false;
3119
3137
  }
3120
3138
  try {
3121
- execSync2("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
3139
+ execSync3("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
3122
3140
  linuxSecretAvailability = true;
3123
3141
  } catch {
3124
3142
  linuxSecretAvailability = false;
@@ -3142,7 +3160,7 @@ function macKeychainGet(service = SERVICE) {
3142
3160
  if (!nativeKeychainAllowed()) return null;
3143
3161
  if (process.platform !== "darwin") return null;
3144
3162
  try {
3145
- return execSync2(
3163
+ return execSync3(
3146
3164
  `security find-generic-password -s "${service}" -a "${ACCOUNT}" -w 2>/dev/null`,
3147
3165
  { encoding: "utf-8", timeout: 5e3 }
3148
3166
  ).trim();
@@ -3155,13 +3173,13 @@ function macKeychainSet(value, service = SERVICE) {
3155
3173
  if (process.platform !== "darwin") return false;
3156
3174
  try {
3157
3175
  try {
3158
- execSync2(
3176
+ execSync3(
3159
3177
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
3160
3178
  { timeout: 5e3 }
3161
3179
  );
3162
3180
  } catch {
3163
3181
  }
3164
- execSync2(
3182
+ execSync3(
3165
3183
  `security add-generic-password -s "${service}" -a "${ACCOUNT}" -w "${value}"`,
3166
3184
  { timeout: 5e3 }
3167
3185
  );
@@ -3174,7 +3192,7 @@ function macKeychainDelete(service = SERVICE) {
3174
3192
  if (!nativeKeychainAllowed()) return false;
3175
3193
  if (process.platform !== "darwin") return false;
3176
3194
  try {
3177
- execSync2(
3195
+ execSync3(
3178
3196
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
3179
3197
  { timeout: 5e3 }
3180
3198
  );
@@ -3186,7 +3204,7 @@ function macKeychainDelete(service = SERVICE) {
3186
3204
  function linuxSecretGet(service = SERVICE) {
3187
3205
  if (!linuxSecretAvailable()) return null;
3188
3206
  try {
3189
- return execSync2(
3207
+ return execSync3(
3190
3208
  `secret-tool lookup service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3191
3209
  { encoding: "utf-8", timeout: 5e3 }
3192
3210
  ).trim();
@@ -3197,7 +3215,7 @@ function linuxSecretGet(service = SERVICE) {
3197
3215
  function linuxSecretSet(value, service = SERVICE) {
3198
3216
  if (!linuxSecretAvailable()) return false;
3199
3217
  try {
3200
- execSync2(
3218
+ execSync3(
3201
3219
  `echo -n "${value}" | secret-tool store --label="exe-os master key" service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3202
3220
  { timeout: 5e3 }
3203
3221
  );
@@ -3210,7 +3228,7 @@ function linuxSecretDelete(service = SERVICE) {
3210
3228
  if (!nativeKeychainAllowed()) return false;
3211
3229
  if (process.platform !== "linux") return false;
3212
3230
  try {
3213
- execSync2(
3231
+ execSync3(
3214
3232
  `secret-tool clear service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3215
3233
  { timeout: 5e3 }
3216
3234
  );
@@ -1570,7 +1570,7 @@ var init_daemon_auth = __esm({
1570
1570
  // src/lib/exe-daemon-client.ts
1571
1571
  import net from "net";
1572
1572
  import os6 from "os";
1573
- import { spawn } from "child_process";
1573
+ import { spawn, execSync as execSync4 } from "child_process";
1574
1574
  import { randomUUID } from "crypto";
1575
1575
  import { existsSync as existsSync8, unlinkSync as unlinkSync2, readFileSync as readFileSync7, openSync, closeSync, statSync } from "fs";
1576
1576
  import path8 from "path";
@@ -1600,6 +1600,14 @@ function handleData(chunk) {
1600
1600
  }
1601
1601
  }
1602
1602
  }
1603
+ function isZombie(pid) {
1604
+ try {
1605
+ const state = execSync4(`ps -p ${pid} -o state=`, { encoding: "utf8", timeout: 2e3 }).trim();
1606
+ return state.startsWith("Z");
1607
+ } catch {
1608
+ return false;
1609
+ }
1610
+ }
1603
1611
  function cleanupStaleFiles() {
1604
1612
  if (existsSync8(PID_PATH)) {
1605
1613
  try {
@@ -1607,7 +1615,11 @@ function cleanupStaleFiles() {
1607
1615
  if (pid > 0) {
1608
1616
  try {
1609
1617
  process.kill(pid, 0);
1610
- return;
1618
+ if (!isZombie(pid)) {
1619
+ return;
1620
+ }
1621
+ process.stderr.write(`[exed-client] PID ${pid} is a zombie \u2014 cleaning up stale files
1622
+ `);
1611
1623
  } catch {
1612
1624
  }
1613
1625
  }
@@ -1635,8 +1647,8 @@ function findPackageRoot() {
1635
1647
  function getAvailableMemoryGB() {
1636
1648
  if (process.platform === "darwin") {
1637
1649
  try {
1638
- const { execSync: execSync9 } = __require("child_process");
1639
- const vmstat = execSync9("vm_stat", { encoding: "utf8" });
1650
+ const { execSync: execSync10 } = __require("child_process");
1651
+ const vmstat = execSync10("vm_stat", { encoding: "utf8" });
1640
1652
  const pageSize = 16384;
1641
1653
  const pageSizeMatch = vmstat.match(/page size of (\d+) bytes/);
1642
1654
  const actualPageSize = pageSizeMatch ? parseInt(pageSizeMatch[1], 10) : pageSize;
@@ -3571,6 +3583,12 @@ async function disposeDatabase() {
3571
3583
  clearInterval(_walCheckpointTimer);
3572
3584
  _walCheckpointTimer = null;
3573
3585
  }
3586
+ if (_client) {
3587
+ try {
3588
+ await _client.execute("PRAGMA wal_checkpoint(PASSIVE)");
3589
+ } catch {
3590
+ }
3591
+ }
3574
3592
  if (_daemonClient) {
3575
3593
  _daemonClient.close();
3576
3594
  _daemonClient = null;
@@ -3919,7 +3937,7 @@ var init_state_bus = __esm({
3919
3937
  });
3920
3938
 
3921
3939
  // src/lib/project-name.ts
3922
- import { execSync as execSync4 } from "child_process";
3940
+ import { execSync as execSync5 } from "child_process";
3923
3941
  import path13 from "path";
3924
3942
  function getProjectName(cwd) {
3925
3943
  const dir = cwd ?? process.cwd();
@@ -3927,7 +3945,7 @@ function getProjectName(cwd) {
3927
3945
  try {
3928
3946
  let repoRoot;
3929
3947
  try {
3930
- const gitCommonDir = execSync4("git rev-parse --path-format=absolute --git-common-dir", {
3948
+ const gitCommonDir = execSync5("git rev-parse --path-format=absolute --git-common-dir", {
3931
3949
  cwd: dir,
3932
3950
  encoding: "utf8",
3933
3951
  timeout: 2e3,
@@ -3935,7 +3953,7 @@ function getProjectName(cwd) {
3935
3953
  }).trim();
3936
3954
  repoRoot = path13.dirname(gitCommonDir);
3937
3955
  } catch {
3938
- repoRoot = execSync4("git rev-parse --show-toplevel", {
3956
+ repoRoot = execSync5("git rev-parse --show-toplevel", {
3939
3957
  cwd: dir,
3940
3958
  encoding: "utf8",
3941
3959
  timeout: 2e3,
@@ -4042,7 +4060,7 @@ __export(tasks_crud_exports, {
4042
4060
  import crypto4 from "crypto";
4043
4061
  import path14 from "path";
4044
4062
  import os10 from "os";
4045
- import { execSync as execSync5 } from "child_process";
4063
+ import { execSync as execSync6 } from "child_process";
4046
4064
  import { mkdir as mkdir3, writeFile as writeFile3, appendFile } from "fs/promises";
4047
4065
  import { existsSync as existsSync13, readFileSync as readFileSync11 } from "fs";
4048
4066
  async function writeCheckpoint(input) {
@@ -4387,14 +4405,14 @@ function isTmuxSessionAlive(identifier) {
4387
4405
  if (!identifier || identifier === "unknown") return true;
4388
4406
  try {
4389
4407
  if (identifier.startsWith("%")) {
4390
- const output = execSync5("tmux list-panes -a -F '#{pane_id}'", {
4408
+ const output = execSync6("tmux list-panes -a -F '#{pane_id}'", {
4391
4409
  timeout: 2e3,
4392
4410
  encoding: "utf8",
4393
4411
  stdio: ["pipe", "pipe", "pipe"]
4394
4412
  });
4395
4413
  return output.split("\n").some((l) => l.trim() === identifier);
4396
4414
  } else {
4397
- execSync5(`tmux has-session -t ${JSON.stringify(identifier)}`, {
4415
+ execSync6(`tmux has-session -t ${JSON.stringify(identifier)}`, {
4398
4416
  timeout: 2e3,
4399
4417
  stdio: ["pipe", "pipe", "pipe"]
4400
4418
  });
@@ -4403,7 +4421,7 @@ function isTmuxSessionAlive(identifier) {
4403
4421
  } catch {
4404
4422
  if (identifier.startsWith("%")) return true;
4405
4423
  try {
4406
- execSync5("tmux list-sessions", {
4424
+ execSync6("tmux list-sessions", {
4407
4425
  timeout: 2e3,
4408
4426
  stdio: ["pipe", "pipe", "pipe"]
4409
4427
  });
@@ -4418,12 +4436,12 @@ function checkStaleCompletion(taskContext, taskCreatedAt) {
4418
4436
  if (!DELEGATION_KEYWORDS.test(taskContext)) return null;
4419
4437
  try {
4420
4438
  const since = new Date(taskCreatedAt).toISOString();
4421
- const branch = execSync5(
4439
+ const branch = execSync6(
4422
4440
  "git rev-parse --abbrev-ref HEAD 2>/dev/null",
4423
4441
  { encoding: "utf8", timeout: 3e3 }
4424
4442
  ).trim();
4425
4443
  const branchArg = branch && branch !== "HEAD" ? branch : "";
4426
- const commitCount = execSync5(
4444
+ const commitCount = execSync6(
4427
4445
  `git log --oneline --since="${since}" ${branchArg} 2>/dev/null | wc -l`,
4428
4446
  { encoding: "utf8", timeout: 5e3 }
4429
4447
  ).trim();
@@ -6022,7 +6040,7 @@ __export(tmux_routing_exports, {
6022
6040
  spawnEmployee: () => spawnEmployee,
6023
6041
  verifyPaneAtCapacity: () => verifyPaneAtCapacity
6024
6042
  });
6025
- import { execFileSync as execFileSync2, execSync as execSync6 } from "child_process";
6043
+ import { execFileSync as execFileSync2, execSync as execSync7 } from "child_process";
6026
6044
  import { readFileSync as readFileSync12, writeFileSync as writeFileSync8, mkdirSync as mkdirSync7, existsSync as existsSync15, appendFileSync, readdirSync as readdirSync3 } from "fs";
6027
6045
  import path18 from "path";
6028
6046
  import os11 from "os";
@@ -6743,7 +6761,7 @@ function spawnEmployee(employeeName, exeSession, projectDir, opts) {
6743
6761
  let booted = false;
6744
6762
  for (let i = 0; i < 30; i++) {
6745
6763
  try {
6746
- execSync6("sleep 0.5");
6764
+ execSync7("sleep 0.5");
6747
6765
  } catch {
6748
6766
  }
6749
6767
  try {
@@ -6855,7 +6873,7 @@ var init_task_scope = __esm({
6855
6873
  // src/lib/keychain.ts
6856
6874
  import { readFile as readFile4, writeFile as writeFile5, unlink, mkdir as mkdir4, chmod as chmod2 } from "fs/promises";
6857
6875
  import { existsSync as existsSync16, statSync as statSync2 } from "fs";
6858
- import { execSync as execSync7 } from "child_process";
6876
+ import { execSync as execSync8 } from "child_process";
6859
6877
  import path19 from "path";
6860
6878
  import os12 from "os";
6861
6879
  function getKeyDir() {
@@ -6872,13 +6890,13 @@ function linuxSecretAvailable() {
6872
6890
  if (process.platform !== "linux") return false;
6873
6891
  if (linuxSecretAvailability !== null) return linuxSecretAvailability;
6874
6892
  try {
6875
- execSync7("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
6893
+ execSync8("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
6876
6894
  } catch {
6877
6895
  linuxSecretAvailability = false;
6878
6896
  return false;
6879
6897
  }
6880
6898
  try {
6881
- execSync7("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
6899
+ execSync8("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
6882
6900
  linuxSecretAvailability = true;
6883
6901
  } catch {
6884
6902
  linuxSecretAvailability = false;
@@ -6902,7 +6920,7 @@ function macKeychainGet(service = SERVICE) {
6902
6920
  if (!nativeKeychainAllowed()) return null;
6903
6921
  if (process.platform !== "darwin") return null;
6904
6922
  try {
6905
- return execSync7(
6923
+ return execSync8(
6906
6924
  `security find-generic-password -s "${service}" -a "${ACCOUNT}" -w 2>/dev/null`,
6907
6925
  { encoding: "utf-8", timeout: 5e3 }
6908
6926
  ).trim();
@@ -6915,13 +6933,13 @@ function macKeychainSet(value, service = SERVICE) {
6915
6933
  if (process.platform !== "darwin") return false;
6916
6934
  try {
6917
6935
  try {
6918
- execSync7(
6936
+ execSync8(
6919
6937
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
6920
6938
  { timeout: 5e3 }
6921
6939
  );
6922
6940
  } catch {
6923
6941
  }
6924
- execSync7(
6942
+ execSync8(
6925
6943
  `security add-generic-password -s "${service}" -a "${ACCOUNT}" -w "${value}"`,
6926
6944
  { timeout: 5e3 }
6927
6945
  );
@@ -6934,7 +6952,7 @@ function macKeychainDelete(service = SERVICE) {
6934
6952
  if (!nativeKeychainAllowed()) return false;
6935
6953
  if (process.platform !== "darwin") return false;
6936
6954
  try {
6937
- execSync7(
6955
+ execSync8(
6938
6956
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
6939
6957
  { timeout: 5e3 }
6940
6958
  );
@@ -6946,7 +6964,7 @@ function macKeychainDelete(service = SERVICE) {
6946
6964
  function linuxSecretGet(service = SERVICE) {
6947
6965
  if (!linuxSecretAvailable()) return null;
6948
6966
  try {
6949
- return execSync7(
6967
+ return execSync8(
6950
6968
  `secret-tool lookup service "${service}" account "${ACCOUNT}" 2>/dev/null`,
6951
6969
  { encoding: "utf-8", timeout: 5e3 }
6952
6970
  ).trim();
@@ -6957,7 +6975,7 @@ function linuxSecretGet(service = SERVICE) {
6957
6975
  function linuxSecretSet(value, service = SERVICE) {
6958
6976
  if (!linuxSecretAvailable()) return false;
6959
6977
  try {
6960
- execSync7(
6978
+ execSync8(
6961
6979
  `echo -n "${value}" | secret-tool store --label="exe-os master key" service "${service}" account "${ACCOUNT}" 2>/dev/null`,
6962
6980
  { timeout: 5e3 }
6963
6981
  );
@@ -6970,7 +6988,7 @@ function linuxSecretDelete(service = SERVICE) {
6970
6988
  if (!nativeKeychainAllowed()) return false;
6971
6989
  if (process.platform !== "linux") return false;
6972
6990
  try {
6973
- execSync7(
6991
+ execSync8(
6974
6992
  `secret-tool clear service "${service}" account "${ACCOUNT}" 2>/dev/null`,
6975
6993
  { timeout: 5e3 }
6976
6994
  );
@@ -9093,7 +9111,7 @@ var init_store = __esm({
9093
9111
 
9094
9112
  // src/lib/git-task-sweep.ts
9095
9113
  init_task_scope();
9096
- import { execSync as execSync8 } from "child_process";
9114
+ import { execSync as execSync9 } from "child_process";
9097
9115
  var DEFAULT_COMMIT_LIMIT = 50;
9098
9116
  var DEFAULT_STALE_MINUTES = 10;
9099
9117
  var AUTO_ESCALATE_THRESHOLD = 0.6;
@@ -9160,7 +9178,7 @@ function matchScore(task, commitMessage, changedFiles) {
9160
9178
  function getRecentCommits(limit = DEFAULT_COMMIT_LIMIT) {
9161
9179
  try {
9162
9180
  const SEPARATOR = "<<SEP>>";
9163
- const output = execSync8(
9181
+ const output = execSync9(
9164
9182
  `git log --format="%h${SEPARATOR}%s${SEPARATOR}%aI" --name-only -n ${limit} -z`,
9165
9183
  { encoding: "utf8", timeout: 1e4 }
9166
9184
  );
@@ -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
  );
@@ -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: execSync3 } = __require("child_process");
1061
- const vmstat = execSync3("vm_stat", { encoding: "utf8" });
1072
+ const { execSync: execSync4 } = __require("child_process");
1073
+ const vmstat = execSync4("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
  );