@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
@@ -1068,7 +1068,7 @@ var init_daemon_auth = __esm({
1068
1068
  // src/lib/exe-daemon-client.ts
1069
1069
  import net from "net";
1070
1070
  import os4 from "os";
1071
- import { spawn } from "child_process";
1071
+ import { spawn, execSync as execSync2 } from "child_process";
1072
1072
  import { randomUUID } from "crypto";
1073
1073
  import { existsSync as existsSync5, unlinkSync as unlinkSync2, readFileSync as readFileSync4, openSync, closeSync, statSync } from "fs";
1074
1074
  import path5 from "path";
@@ -1098,6 +1098,14 @@ function handleData(chunk) {
1098
1098
  }
1099
1099
  }
1100
1100
  }
1101
+ function isZombie(pid) {
1102
+ try {
1103
+ const state = execSync2(`ps -p ${pid} -o state=`, { encoding: "utf8", timeout: 2e3 }).trim();
1104
+ return state.startsWith("Z");
1105
+ } catch {
1106
+ return false;
1107
+ }
1108
+ }
1101
1109
  function cleanupStaleFiles() {
1102
1110
  if (existsSync5(PID_PATH)) {
1103
1111
  try {
@@ -1105,7 +1113,11 @@ function cleanupStaleFiles() {
1105
1113
  if (pid > 0) {
1106
1114
  try {
1107
1115
  process.kill(pid, 0);
1108
- return;
1116
+ if (!isZombie(pid)) {
1117
+ return;
1118
+ }
1119
+ process.stderr.write(`[exed-client] PID ${pid} is a zombie \u2014 cleaning up stale files
1120
+ `);
1109
1121
  } catch {
1110
1122
  }
1111
1123
  }
@@ -1133,8 +1145,8 @@ function findPackageRoot() {
1133
1145
  function getAvailableMemoryGB() {
1134
1146
  if (process.platform === "darwin") {
1135
1147
  try {
1136
- const { execSync: execSync6 } = __require("child_process");
1137
- const vmstat = execSync6("vm_stat", { encoding: "utf8" });
1148
+ const { execSync: execSync7 } = __require("child_process");
1149
+ const vmstat = execSync7("vm_stat", { encoding: "utf8" });
1138
1150
  const pageSize = 16384;
1139
1151
  const pageSizeMatch = vmstat.match(/page size of (\d+) bytes/);
1140
1152
  const actualPageSize = pageSizeMatch ? parseInt(pageSizeMatch[1], 10) : pageSize;
@@ -2920,6 +2932,12 @@ async function disposeDatabase() {
2920
2932
  clearInterval(_walCheckpointTimer);
2921
2933
  _walCheckpointTimer = null;
2922
2934
  }
2935
+ if (_client) {
2936
+ try {
2937
+ await _client.execute("PRAGMA wal_checkpoint(PASSIVE)");
2938
+ } catch {
2939
+ }
2940
+ }
2923
2941
  if (_daemonClient) {
2924
2942
  _daemonClient.close();
2925
2943
  _daemonClient = null;
@@ -4095,7 +4113,7 @@ var init_runtime_table = __esm({
4095
4113
  });
4096
4114
 
4097
4115
  // src/lib/session-key.ts
4098
- import { execSync as execSync3 } from "child_process";
4116
+ import { execSync as execSync4 } from "child_process";
4099
4117
  function normalizeCommand(command) {
4100
4118
  const trimmed = command.trim().toLowerCase();
4101
4119
  const parts = trimmed.split(/[\\/]/);
@@ -4114,7 +4132,7 @@ function resolveRuntimeProcess() {
4114
4132
  let pid = process.ppid;
4115
4133
  for (let i = 0; i < 10; i++) {
4116
4134
  try {
4117
- const info = execSync3(`ps -p ${pid} -o ppid=,comm=`, {
4135
+ const info = execSync4(`ps -p ${pid} -o ppid=,comm=`, {
4118
4136
  encoding: "utf8",
4119
4137
  timeout: 2e3
4120
4138
  }).trim();
@@ -4186,7 +4204,7 @@ __export(active_agent_exports, {
4186
4204
  writeActiveAgent: () => writeActiveAgent
4187
4205
  });
4188
4206
  import { readFileSync as readFileSync5, writeFileSync as writeFileSync4, mkdirSync as mkdirSync4, unlinkSync as unlinkSync4, readdirSync as readdirSync3 } from "fs";
4189
- import { execSync as execSync4 } from "child_process";
4207
+ import { execSync as execSync5 } from "child_process";
4190
4208
  import path9 from "path";
4191
4209
  function isNameWithOptionalInstance(candidate, baseName) {
4192
4210
  if (candidate === baseName) return true;
@@ -4280,7 +4298,7 @@ function getActiveAgent() {
4280
4298
  } catch {
4281
4299
  }
4282
4300
  try {
4283
- const sessionName = execSync4(
4301
+ const sessionName = execSync5(
4284
4302
  "tmux display-message -p '#{session_name}' 2>/dev/null",
4285
4303
  { encoding: "utf8", timeout: 2e3 }
4286
4304
  ).trim();
@@ -4604,7 +4622,7 @@ import { existsSync as existsSync12, readFileSync as readFileSync8, writeFileSyn
4604
4622
  import { createHash as createHash4 } from "crypto";
4605
4623
  import path13 from "path";
4606
4624
  import os10 from "os";
4607
- import { execSync as execSync5 } from "child_process";
4625
+ import { execSync as execSync6 } from "child_process";
4608
4626
  import { fileURLToPath as fileURLToPath2 } from "url";
4609
4627
  function resolvePackageRoot() {
4610
4628
  const thisFile = fileURLToPath2(import.meta.url);
@@ -5080,7 +5098,7 @@ init_database();
5080
5098
  // src/lib/keychain.ts
5081
5099
  import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2 } from "fs/promises";
5082
5100
  import { existsSync as existsSync6, statSync as statSync2 } from "fs";
5083
- import { execSync as execSync2 } from "child_process";
5101
+ import { execSync as execSync3 } from "child_process";
5084
5102
  import path6 from "path";
5085
5103
  import os5 from "os";
5086
5104
  var SERVICE = "exe-os";
@@ -5101,13 +5119,13 @@ function linuxSecretAvailable() {
5101
5119
  if (process.platform !== "linux") return false;
5102
5120
  if (linuxSecretAvailability !== null) return linuxSecretAvailability;
5103
5121
  try {
5104
- execSync2("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
5122
+ execSync3("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
5105
5123
  } catch {
5106
5124
  linuxSecretAvailability = false;
5107
5125
  return false;
5108
5126
  }
5109
5127
  try {
5110
- execSync2("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
5128
+ execSync3("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
5111
5129
  linuxSecretAvailability = true;
5112
5130
  } catch {
5113
5131
  linuxSecretAvailability = false;
@@ -5131,7 +5149,7 @@ function macKeychainGet(service = SERVICE) {
5131
5149
  if (!nativeKeychainAllowed()) return null;
5132
5150
  if (process.platform !== "darwin") return null;
5133
5151
  try {
5134
- return execSync2(
5152
+ return execSync3(
5135
5153
  `security find-generic-password -s "${service}" -a "${ACCOUNT}" -w 2>/dev/null`,
5136
5154
  { encoding: "utf-8", timeout: 5e3 }
5137
5155
  ).trim();
@@ -5144,13 +5162,13 @@ function macKeychainSet(value, service = SERVICE) {
5144
5162
  if (process.platform !== "darwin") return false;
5145
5163
  try {
5146
5164
  try {
5147
- execSync2(
5165
+ execSync3(
5148
5166
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
5149
5167
  { timeout: 5e3 }
5150
5168
  );
5151
5169
  } catch {
5152
5170
  }
5153
- execSync2(
5171
+ execSync3(
5154
5172
  `security add-generic-password -s "${service}" -a "${ACCOUNT}" -w "${value}"`,
5155
5173
  { timeout: 5e3 }
5156
5174
  );
@@ -5163,7 +5181,7 @@ function macKeychainDelete(service = SERVICE) {
5163
5181
  if (!nativeKeychainAllowed()) return false;
5164
5182
  if (process.platform !== "darwin") return false;
5165
5183
  try {
5166
- execSync2(
5184
+ execSync3(
5167
5185
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
5168
5186
  { timeout: 5e3 }
5169
5187
  );
@@ -5175,7 +5193,7 @@ function macKeychainDelete(service = SERVICE) {
5175
5193
  function linuxSecretGet(service = SERVICE) {
5176
5194
  if (!linuxSecretAvailable()) return null;
5177
5195
  try {
5178
- return execSync2(
5196
+ return execSync3(
5179
5197
  `secret-tool lookup service "${service}" account "${ACCOUNT}" 2>/dev/null`,
5180
5198
  { encoding: "utf-8", timeout: 5e3 }
5181
5199
  ).trim();
@@ -5186,7 +5204,7 @@ function linuxSecretGet(service = SERVICE) {
5186
5204
  function linuxSecretSet(value, service = SERVICE) {
5187
5205
  if (!linuxSecretAvailable()) return false;
5188
5206
  try {
5189
- execSync2(
5207
+ execSync3(
5190
5208
  `echo -n "${value}" | secret-tool store --label="exe-os master key" service "${service}" account "${ACCOUNT}" 2>/dev/null`,
5191
5209
  { timeout: 5e3 }
5192
5210
  );
@@ -5199,7 +5217,7 @@ function linuxSecretDelete(service = SERVICE) {
5199
5217
  if (!nativeKeychainAllowed()) return false;
5200
5218
  if (process.platform !== "linux") return false;
5201
5219
  try {
5202
- execSync2(
5220
+ execSync3(
5203
5221
  `secret-tool clear service "${service}" account "${ACCOUNT}" 2>/dev/null`,
5204
5222
  { timeout: 5e3 }
5205
5223
  );
@@ -6035,8 +6053,8 @@ async function main() {
6035
6053
  }
6036
6054
  if (!process.env[CODEX.apiKeyEnv]) {
6037
6055
  try {
6038
- const { execSync: execSync6 } = await import("child_process");
6039
- const status = execSync6("codex login status 2>&1", { encoding: "utf8", timeout: 5e3 }).trim();
6056
+ const { execSync: execSync7 } = await import("child_process");
6057
+ const status = execSync7("codex login status 2>&1", { encoding: "utf8", timeout: 5e3 }).trim();
6040
6058
  if (!status.toLowerCase().includes("logged in")) {
6041
6059
  process.stderr.write(
6042
6060
  `exe-start-codex: not authenticated. Run \`codex login\` or set ${CODEX.apiKeyEnv}.
@@ -1068,7 +1068,7 @@ var init_daemon_auth = __esm({
1068
1068
  // src/lib/exe-daemon-client.ts
1069
1069
  import net from "net";
1070
1070
  import os4 from "os";
1071
- import { spawn } from "child_process";
1071
+ import { spawn, execSync as execSync2 } from "child_process";
1072
1072
  import { randomUUID } from "crypto";
1073
1073
  import { existsSync as existsSync5, unlinkSync as unlinkSync2, readFileSync as readFileSync4, openSync, closeSync, statSync } from "fs";
1074
1074
  import path5 from "path";
@@ -1098,6 +1098,14 @@ function handleData(chunk) {
1098
1098
  }
1099
1099
  }
1100
1100
  }
1101
+ function isZombie(pid) {
1102
+ try {
1103
+ const state = execSync2(`ps -p ${pid} -o state=`, { encoding: "utf8", timeout: 2e3 }).trim();
1104
+ return state.startsWith("Z");
1105
+ } catch {
1106
+ return false;
1107
+ }
1108
+ }
1101
1109
  function cleanupStaleFiles() {
1102
1110
  if (existsSync5(PID_PATH)) {
1103
1111
  try {
@@ -1105,7 +1113,11 @@ function cleanupStaleFiles() {
1105
1113
  if (pid > 0) {
1106
1114
  try {
1107
1115
  process.kill(pid, 0);
1108
- return;
1116
+ if (!isZombie(pid)) {
1117
+ return;
1118
+ }
1119
+ process.stderr.write(`[exed-client] PID ${pid} is a zombie \u2014 cleaning up stale files
1120
+ `);
1109
1121
  } catch {
1110
1122
  }
1111
1123
  }
@@ -1133,8 +1145,8 @@ function findPackageRoot() {
1133
1145
  function getAvailableMemoryGB() {
1134
1146
  if (process.platform === "darwin") {
1135
1147
  try {
1136
- const { execSync: execSync6 } = __require("child_process");
1137
- const vmstat = execSync6("vm_stat", { encoding: "utf8" });
1148
+ const { execSync: execSync7 } = __require("child_process");
1149
+ const vmstat = execSync7("vm_stat", { encoding: "utf8" });
1138
1150
  const pageSize = 16384;
1139
1151
  const pageSizeMatch = vmstat.match(/page size of (\d+) bytes/);
1140
1152
  const actualPageSize = pageSizeMatch ? parseInt(pageSizeMatch[1], 10) : pageSize;
@@ -2920,6 +2932,12 @@ async function disposeDatabase() {
2920
2932
  clearInterval(_walCheckpointTimer);
2921
2933
  _walCheckpointTimer = null;
2922
2934
  }
2935
+ if (_client) {
2936
+ try {
2937
+ await _client.execute("PRAGMA wal_checkpoint(PASSIVE)");
2938
+ } catch {
2939
+ }
2940
+ }
2923
2941
  if (_daemonClient) {
2924
2942
  _daemonClient.close();
2925
2943
  _daemonClient = null;
@@ -4094,7 +4112,7 @@ var init_runtime_table = __esm({
4094
4112
  });
4095
4113
 
4096
4114
  // src/lib/session-key.ts
4097
- import { execSync as execSync3 } from "child_process";
4115
+ import { execSync as execSync4 } from "child_process";
4098
4116
  function normalizeCommand(command) {
4099
4117
  const trimmed = command.trim().toLowerCase();
4100
4118
  const parts = trimmed.split(/[\\/]/);
@@ -4113,7 +4131,7 @@ function resolveRuntimeProcess() {
4113
4131
  let pid = process.ppid;
4114
4132
  for (let i = 0; i < 10; i++) {
4115
4133
  try {
4116
- const info = execSync3(`ps -p ${pid} -o ppid=,comm=`, {
4134
+ const info = execSync4(`ps -p ${pid} -o ppid=,comm=`, {
4117
4135
  encoding: "utf8",
4118
4136
  timeout: 2e3
4119
4137
  }).trim();
@@ -4185,7 +4203,7 @@ __export(active_agent_exports, {
4185
4203
  writeActiveAgent: () => writeActiveAgent
4186
4204
  });
4187
4205
  import { readFileSync as readFileSync5, writeFileSync as writeFileSync4, mkdirSync as mkdirSync4, unlinkSync as unlinkSync4, readdirSync as readdirSync3 } from "fs";
4188
- import { execSync as execSync4 } from "child_process";
4206
+ import { execSync as execSync5 } from "child_process";
4189
4207
  import path9 from "path";
4190
4208
  function isNameWithOptionalInstance(candidate, baseName) {
4191
4209
  if (candidate === baseName) return true;
@@ -4279,7 +4297,7 @@ function getActiveAgent() {
4279
4297
  } catch {
4280
4298
  }
4281
4299
  try {
4282
- const sessionName = execSync4(
4300
+ const sessionName = execSync5(
4283
4301
  "tmux display-message -p '#{session_name}' 2>/dev/null",
4284
4302
  { encoding: "utf8", timeout: 2e3 }
4285
4303
  ).trim();
@@ -4591,7 +4609,7 @@ import { existsSync as existsSync12, readFileSync as readFileSync8, writeFileSyn
4591
4609
  import { createHash as createHash4 } from "crypto";
4592
4610
  import path13 from "path";
4593
4611
  import os10 from "os";
4594
- import { execSync as execSync5 } from "child_process";
4612
+ import { execSync as execSync6 } from "child_process";
4595
4613
  import { fileURLToPath as fileURLToPath2 } from "url";
4596
4614
  function resolvePackageRoot() {
4597
4615
  const thisFile = fileURLToPath2(import.meta.url);
@@ -4943,7 +4961,7 @@ init_database();
4943
4961
  // src/lib/keychain.ts
4944
4962
  import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2 } from "fs/promises";
4945
4963
  import { existsSync as existsSync6, statSync as statSync2 } from "fs";
4946
- import { execSync as execSync2 } from "child_process";
4964
+ import { execSync as execSync3 } from "child_process";
4947
4965
  import path6 from "path";
4948
4966
  import os5 from "os";
4949
4967
  var SERVICE = "exe-os";
@@ -4964,13 +4982,13 @@ function linuxSecretAvailable() {
4964
4982
  if (process.platform !== "linux") return false;
4965
4983
  if (linuxSecretAvailability !== null) return linuxSecretAvailability;
4966
4984
  try {
4967
- execSync2("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
4985
+ execSync3("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
4968
4986
  } catch {
4969
4987
  linuxSecretAvailability = false;
4970
4988
  return false;
4971
4989
  }
4972
4990
  try {
4973
- execSync2("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
4991
+ execSync3("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
4974
4992
  linuxSecretAvailability = true;
4975
4993
  } catch {
4976
4994
  linuxSecretAvailability = false;
@@ -4994,7 +5012,7 @@ function macKeychainGet(service = SERVICE) {
4994
5012
  if (!nativeKeychainAllowed()) return null;
4995
5013
  if (process.platform !== "darwin") return null;
4996
5014
  try {
4997
- return execSync2(
5015
+ return execSync3(
4998
5016
  `security find-generic-password -s "${service}" -a "${ACCOUNT}" -w 2>/dev/null`,
4999
5017
  { encoding: "utf-8", timeout: 5e3 }
5000
5018
  ).trim();
@@ -5007,13 +5025,13 @@ function macKeychainSet(value, service = SERVICE) {
5007
5025
  if (process.platform !== "darwin") return false;
5008
5026
  try {
5009
5027
  try {
5010
- execSync2(
5028
+ execSync3(
5011
5029
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
5012
5030
  { timeout: 5e3 }
5013
5031
  );
5014
5032
  } catch {
5015
5033
  }
5016
- execSync2(
5034
+ execSync3(
5017
5035
  `security add-generic-password -s "${service}" -a "${ACCOUNT}" -w "${value}"`,
5018
5036
  { timeout: 5e3 }
5019
5037
  );
@@ -5026,7 +5044,7 @@ function macKeychainDelete(service = SERVICE) {
5026
5044
  if (!nativeKeychainAllowed()) return false;
5027
5045
  if (process.platform !== "darwin") return false;
5028
5046
  try {
5029
- execSync2(
5047
+ execSync3(
5030
5048
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
5031
5049
  { timeout: 5e3 }
5032
5050
  );
@@ -5038,7 +5056,7 @@ function macKeychainDelete(service = SERVICE) {
5038
5056
  function linuxSecretGet(service = SERVICE) {
5039
5057
  if (!linuxSecretAvailable()) return null;
5040
5058
  try {
5041
- return execSync2(
5059
+ return execSync3(
5042
5060
  `secret-tool lookup service "${service}" account "${ACCOUNT}" 2>/dev/null`,
5043
5061
  { encoding: "utf-8", timeout: 5e3 }
5044
5062
  ).trim();
@@ -5049,7 +5067,7 @@ function linuxSecretGet(service = SERVICE) {
5049
5067
  function linuxSecretSet(value, service = SERVICE) {
5050
5068
  if (!linuxSecretAvailable()) return false;
5051
5069
  try {
5052
- execSync2(
5070
+ execSync3(
5053
5071
  `echo -n "${value}" | secret-tool store --label="exe-os master key" service "${service}" account "${ACCOUNT}" 2>/dev/null`,
5054
5072
  { timeout: 5e3 }
5055
5073
  );
@@ -5062,7 +5080,7 @@ function linuxSecretDelete(service = SERVICE) {
5062
5080
  if (!nativeKeychainAllowed()) return false;
5063
5081
  if (process.platform !== "linux") return false;
5064
5082
  try {
5065
- execSync2(
5083
+ execSync3(
5066
5084
  `secret-tool clear service "${service}" account "${ACCOUNT}" 2>/dev/null`,
5067
5085
  { timeout: 5e3 }
5068
5086
  );
@@ -1014,7 +1014,7 @@ __export(exe_daemon_client_exports, {
1014
1014
  });
1015
1015
  import net from "net";
1016
1016
  import os4 from "os";
1017
- import { spawn } from "child_process";
1017
+ import { spawn, execSync as execSync2 } from "child_process";
1018
1018
  import { randomUUID } from "crypto";
1019
1019
  import { existsSync as existsSync5, unlinkSync as unlinkSync2, readFileSync as readFileSync4, openSync, closeSync, statSync } from "fs";
1020
1020
  import path5 from "path";
@@ -1044,6 +1044,14 @@ function handleData(chunk) {
1044
1044
  }
1045
1045
  }
1046
1046
  }
1047
+ function isZombie(pid) {
1048
+ try {
1049
+ const state = execSync2(`ps -p ${pid} -o state=`, { encoding: "utf8", timeout: 2e3 }).trim();
1050
+ return state.startsWith("Z");
1051
+ } catch {
1052
+ return false;
1053
+ }
1054
+ }
1047
1055
  function cleanupStaleFiles() {
1048
1056
  if (existsSync5(PID_PATH)) {
1049
1057
  try {
@@ -1051,7 +1059,11 @@ function cleanupStaleFiles() {
1051
1059
  if (pid > 0) {
1052
1060
  try {
1053
1061
  process.kill(pid, 0);
1054
- return;
1062
+ if (!isZombie(pid)) {
1063
+ return;
1064
+ }
1065
+ process.stderr.write(`[exed-client] PID ${pid} is a zombie \u2014 cleaning up stale files
1066
+ `);
1055
1067
  } catch {
1056
1068
  }
1057
1069
  }
@@ -1079,8 +1091,8 @@ function findPackageRoot() {
1079
1091
  function getAvailableMemoryGB() {
1080
1092
  if (process.platform === "darwin") {
1081
1093
  try {
1082
- const { execSync: execSync6 } = __require("child_process");
1083
- const vmstat = execSync6("vm_stat", { encoding: "utf8" });
1094
+ const { execSync: execSync7 } = __require("child_process");
1095
+ const vmstat = execSync7("vm_stat", { encoding: "utf8" });
1084
1096
  const pageSize = 16384;
1085
1097
  const pageSizeMatch = vmstat.match(/page size of (\d+) bytes/);
1086
1098
  const actualPageSize = pageSizeMatch ? parseInt(pageSizeMatch[1], 10) : pageSize;
@@ -3070,6 +3082,12 @@ async function disposeDatabase() {
3070
3082
  clearInterval(_walCheckpointTimer);
3071
3083
  _walCheckpointTimer = null;
3072
3084
  }
3085
+ if (_client) {
3086
+ try {
3087
+ await _client.execute("PRAGMA wal_checkpoint(PASSIVE)");
3088
+ } catch {
3089
+ }
3090
+ }
3073
3091
  if (_daemonClient) {
3074
3092
  _daemonClient.close();
3075
3093
  _daemonClient = null;
@@ -3106,7 +3124,7 @@ var init_database = __esm({
3106
3124
  // src/lib/keychain.ts
3107
3125
  import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2 } from "fs/promises";
3108
3126
  import { existsSync as existsSync6, statSync as statSync2 } from "fs";
3109
- import { execSync as execSync2 } from "child_process";
3127
+ import { execSync as execSync3 } from "child_process";
3110
3128
  import path6 from "path";
3111
3129
  import os5 from "os";
3112
3130
  function getKeyDir() {
@@ -3123,13 +3141,13 @@ function linuxSecretAvailable() {
3123
3141
  if (process.platform !== "linux") return false;
3124
3142
  if (linuxSecretAvailability !== null) return linuxSecretAvailability;
3125
3143
  try {
3126
- execSync2("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
3144
+ execSync3("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
3127
3145
  } catch {
3128
3146
  linuxSecretAvailability = false;
3129
3147
  return false;
3130
3148
  }
3131
3149
  try {
3132
- execSync2("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
3150
+ execSync3("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
3133
3151
  linuxSecretAvailability = true;
3134
3152
  } catch {
3135
3153
  linuxSecretAvailability = false;
@@ -3153,7 +3171,7 @@ function macKeychainGet(service = SERVICE) {
3153
3171
  if (!nativeKeychainAllowed()) return null;
3154
3172
  if (process.platform !== "darwin") return null;
3155
3173
  try {
3156
- return execSync2(
3174
+ return execSync3(
3157
3175
  `security find-generic-password -s "${service}" -a "${ACCOUNT}" -w 2>/dev/null`,
3158
3176
  { encoding: "utf-8", timeout: 5e3 }
3159
3177
  ).trim();
@@ -3166,13 +3184,13 @@ function macKeychainSet(value, service = SERVICE) {
3166
3184
  if (process.platform !== "darwin") return false;
3167
3185
  try {
3168
3186
  try {
3169
- execSync2(
3187
+ execSync3(
3170
3188
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
3171
3189
  { timeout: 5e3 }
3172
3190
  );
3173
3191
  } catch {
3174
3192
  }
3175
- execSync2(
3193
+ execSync3(
3176
3194
  `security add-generic-password -s "${service}" -a "${ACCOUNT}" -w "${value}"`,
3177
3195
  { timeout: 5e3 }
3178
3196
  );
@@ -3185,7 +3203,7 @@ function macKeychainDelete(service = SERVICE) {
3185
3203
  if (!nativeKeychainAllowed()) return false;
3186
3204
  if (process.platform !== "darwin") return false;
3187
3205
  try {
3188
- execSync2(
3206
+ execSync3(
3189
3207
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
3190
3208
  { timeout: 5e3 }
3191
3209
  );
@@ -3197,7 +3215,7 @@ function macKeychainDelete(service = SERVICE) {
3197
3215
  function linuxSecretGet(service = SERVICE) {
3198
3216
  if (!linuxSecretAvailable()) return null;
3199
3217
  try {
3200
- return execSync2(
3218
+ return execSync3(
3201
3219
  `secret-tool lookup service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3202
3220
  { encoding: "utf-8", timeout: 5e3 }
3203
3221
  ).trim();
@@ -3208,7 +3226,7 @@ function linuxSecretGet(service = SERVICE) {
3208
3226
  function linuxSecretSet(value, service = SERVICE) {
3209
3227
  if (!linuxSecretAvailable()) return false;
3210
3228
  try {
3211
- execSync2(
3229
+ execSync3(
3212
3230
  `echo -n "${value}" | secret-tool store --label="exe-os master key" service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3213
3231
  { timeout: 5e3 }
3214
3232
  );
@@ -3221,7 +3239,7 @@ function linuxSecretDelete(service = SERVICE) {
3221
3239
  if (!nativeKeychainAllowed()) return false;
3222
3240
  if (process.platform !== "linux") return false;
3223
3241
  try {
3224
- execSync2(
3242
+ execSync3(
3225
3243
  `secret-tool clear service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3226
3244
  { timeout: 5e3 }
3227
3245
  );
@@ -5409,7 +5427,7 @@ var init_session_registry = __esm({
5409
5427
  });
5410
5428
 
5411
5429
  // src/lib/session-key.ts
5412
- import { execSync as execSync4 } from "child_process";
5430
+ import { execSync as execSync5 } from "child_process";
5413
5431
  function normalizeCommand(command) {
5414
5432
  const trimmed = command.trim().toLowerCase();
5415
5433
  const parts = trimmed.split(/[\\/]/);
@@ -5428,7 +5446,7 @@ function resolveRuntimeProcess() {
5428
5446
  let pid = process.ppid;
5429
5447
  for (let i = 0; i < 10; i++) {
5430
5448
  try {
5431
- const info = execSync4(`ps -p ${pid} -o ppid=,comm=`, {
5449
+ const info = execSync5(`ps -p ${pid} -o ppid=,comm=`, {
5432
5450
  encoding: "utf8",
5433
5451
  timeout: 2e3
5434
5452
  }).trim();
@@ -5594,7 +5612,7 @@ var init_transport = __esm({
5594
5612
  });
5595
5613
 
5596
5614
  // src/lib/cc-agent-support.ts
5597
- import { execSync as execSync5 } from "child_process";
5615
+ import { execSync as execSync6 } from "child_process";
5598
5616
  var init_cc_agent_support = __esm({
5599
5617
  "src/lib/cc-agent-support.ts"() {
5600
5618
  "use strict";
@@ -5894,13 +5912,13 @@ async function fastDbInit() {
5894
5912
  init_database();
5895
5913
 
5896
5914
  // src/lib/tmux-status.ts
5897
- import { execSync as execSync3 } from "child_process";
5915
+ import { execSync as execSync4 } from "child_process";
5898
5916
  function inTmux() {
5899
5917
  if (process.env.TMUX || process.env.TMUX_PANE) return true;
5900
5918
  const term = process.env.TERM ?? "";
5901
5919
  if (term.startsWith("tmux") || term.startsWith("screen")) return true;
5902
5920
  try {
5903
- execSync3("tmux display-message -p '#{session_name}' 2>/dev/null", {
5921
+ execSync4("tmux display-message -p '#{session_name}' 2>/dev/null", {
5904
5922
  encoding: "utf8",
5905
5923
  timeout: 2e3
5906
5924
  });
@@ -5910,12 +5928,12 @@ function inTmux() {
5910
5928
  try {
5911
5929
  let pid = process.ppid;
5912
5930
  for (let depth = 0; depth < 8 && pid > 1; depth++) {
5913
- const comm = execSync3(`ps -p ${pid} -o comm= 2>/dev/null`, {
5931
+ const comm = execSync4(`ps -p ${pid} -o comm= 2>/dev/null`, {
5914
5932
  encoding: "utf8",
5915
5933
  timeout: 1e3
5916
5934
  }).trim();
5917
5935
  if (/tmux/.test(comm)) return true;
5918
- const ppid = execSync3(`ps -p ${pid} -o ppid= 2>/dev/null`, {
5936
+ const ppid = execSync4(`ps -p ${pid} -o ppid= 2>/dev/null`, {
5919
5937
  encoding: "utf8",
5920
5938
  timeout: 1e3
5921
5939
  }).trim();
@@ -5928,7 +5946,7 @@ function inTmux() {
5928
5946
  }
5929
5947
  function listTmuxSessions() {
5930
5948
  try {
5931
- const out = execSync3("tmux list-sessions -F '#{session_name}' 2>/dev/null", {
5949
+ const out = execSync4("tmux list-sessions -F '#{session_name}' 2>/dev/null", {
5932
5950
  encoding: "utf8",
5933
5951
  timeout: 3e3
5934
5952
  });
@@ -5939,7 +5957,7 @@ function listTmuxSessions() {
5939
5957
  }
5940
5958
  function capturePaneLines(windowName, lines = 10) {
5941
5959
  try {
5942
- const out = execSync3(
5960
+ const out = execSync4(
5943
5961
  `tmux capture-pane -t ${JSON.stringify(windowName)} -p 2>/dev/null | tail -${lines}`,
5944
5962
  { encoding: "utf8", timeout: 3e3 }
5945
5963
  );
@@ -5950,7 +5968,7 @@ function capturePaneLines(windowName, lines = 10) {
5950
5968
  }
5951
5969
  function getPaneCwd(windowName) {
5952
5970
  try {
5953
- const out = execSync3(
5971
+ const out = execSync4(
5954
5972
  `tmux display-message -t ${JSON.stringify(windowName)} -p '#{pane_current_path}' 2>/dev/null`,
5955
5973
  { encoding: "utf8", timeout: 3e3 }
5956
5974
  );
@@ -5961,7 +5979,7 @@ function getPaneCwd(windowName) {
5961
5979
  }
5962
5980
  function projectFromPath(dir) {
5963
5981
  try {
5964
- const root = execSync3("git -C " + JSON.stringify(dir) + " rev-parse --show-toplevel 2>/dev/null", {
5982
+ const root = execSync4("git -C " + JSON.stringify(dir) + " rev-parse --show-toplevel 2>/dev/null", {
5965
5983
  encoding: "utf8",
5966
5984
  timeout: 3e3
5967
5985
  }).trim();
@@ -6020,7 +6038,7 @@ function getEmployeeStatuses(employeeNames) {
6020
6038
  }
6021
6039
  let paneAlive = true;
6022
6040
  try {
6023
- const paneStatus = execSync3(
6041
+ const paneStatus = execSync4(
6024
6042
  `tmux list-panes -t ${JSON.stringify(sessionName)} -F '#{pane_dead}' 2>/dev/null`,
6025
6043
  { encoding: "utf8", timeout: 3e3 }
6026
6044
  ).trim();