@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
@@ -1090,7 +1090,7 @@ var init_daemon_auth = __esm({
1090
1090
  // src/lib/exe-daemon-client.ts
1091
1091
  import net from "net";
1092
1092
  import os4 from "os";
1093
- import { spawn } from "child_process";
1093
+ import { spawn, execSync as execSync2 } from "child_process";
1094
1094
  import { randomUUID } from "crypto";
1095
1095
  import { existsSync as existsSync5, unlinkSync as unlinkSync2, readFileSync as readFileSync4, openSync, closeSync, statSync } from "fs";
1096
1096
  import path5 from "path";
@@ -1120,6 +1120,14 @@ function handleData(chunk) {
1120
1120
  }
1121
1121
  }
1122
1122
  }
1123
+ function isZombie(pid) {
1124
+ try {
1125
+ const state = execSync2(`ps -p ${pid} -o state=`, { encoding: "utf8", timeout: 2e3 }).trim();
1126
+ return state.startsWith("Z");
1127
+ } catch {
1128
+ return false;
1129
+ }
1130
+ }
1123
1131
  function cleanupStaleFiles() {
1124
1132
  if (existsSync5(PID_PATH)) {
1125
1133
  try {
@@ -1127,7 +1135,11 @@ function cleanupStaleFiles() {
1127
1135
  if (pid > 0) {
1128
1136
  try {
1129
1137
  process.kill(pid, 0);
1130
- return;
1138
+ if (!isZombie(pid)) {
1139
+ return;
1140
+ }
1141
+ process.stderr.write(`[exed-client] PID ${pid} is a zombie \u2014 cleaning up stale files
1142
+ `);
1131
1143
  } catch {
1132
1144
  }
1133
1145
  }
@@ -1155,8 +1167,8 @@ function findPackageRoot() {
1155
1167
  function getAvailableMemoryGB() {
1156
1168
  if (process.platform === "darwin") {
1157
1169
  try {
1158
- const { execSync: execSync11 } = __require("child_process");
1159
- const vmstat = execSync11("vm_stat", { encoding: "utf8" });
1170
+ const { execSync: execSync12 } = __require("child_process");
1171
+ const vmstat = execSync12("vm_stat", { encoding: "utf8" });
1160
1172
  const pageSize = 16384;
1161
1173
  const pageSizeMatch = vmstat.match(/page size of (\d+) bytes/);
1162
1174
  const actualPageSize = pageSizeMatch ? parseInt(pageSizeMatch[1], 10) : pageSize;
@@ -3091,6 +3103,12 @@ async function disposeDatabase() {
3091
3103
  clearInterval(_walCheckpointTimer);
3092
3104
  _walCheckpointTimer = null;
3093
3105
  }
3106
+ if (_client) {
3107
+ try {
3108
+ await _client.execute("PRAGMA wal_checkpoint(PASSIVE)");
3109
+ } catch {
3110
+ }
3111
+ }
3094
3112
  if (_daemonClient) {
3095
3113
  _daemonClient.close();
3096
3114
  _daemonClient = null;
@@ -3127,7 +3145,7 @@ var init_database = __esm({
3127
3145
  // src/lib/keychain.ts
3128
3146
  import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2 } from "fs/promises";
3129
3147
  import { existsSync as existsSync6, statSync as statSync2 } from "fs";
3130
- import { execSync as execSync2 } from "child_process";
3148
+ import { execSync as execSync3 } from "child_process";
3131
3149
  import path6 from "path";
3132
3150
  import os5 from "os";
3133
3151
  function getKeyDir() {
@@ -3144,13 +3162,13 @@ function linuxSecretAvailable() {
3144
3162
  if (process.platform !== "linux") return false;
3145
3163
  if (linuxSecretAvailability !== null) return linuxSecretAvailability;
3146
3164
  try {
3147
- execSync2("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
3165
+ execSync3("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
3148
3166
  } catch {
3149
3167
  linuxSecretAvailability = false;
3150
3168
  return false;
3151
3169
  }
3152
3170
  try {
3153
- execSync2("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
3171
+ execSync3("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
3154
3172
  linuxSecretAvailability = true;
3155
3173
  } catch {
3156
3174
  linuxSecretAvailability = false;
@@ -3174,7 +3192,7 @@ function macKeychainGet(service = SERVICE) {
3174
3192
  if (!nativeKeychainAllowed()) return null;
3175
3193
  if (process.platform !== "darwin") return null;
3176
3194
  try {
3177
- return execSync2(
3195
+ return execSync3(
3178
3196
  `security find-generic-password -s "${service}" -a "${ACCOUNT}" -w 2>/dev/null`,
3179
3197
  { encoding: "utf-8", timeout: 5e3 }
3180
3198
  ).trim();
@@ -3187,13 +3205,13 @@ function macKeychainSet(value, service = SERVICE) {
3187
3205
  if (process.platform !== "darwin") return false;
3188
3206
  try {
3189
3207
  try {
3190
- execSync2(
3208
+ execSync3(
3191
3209
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
3192
3210
  { timeout: 5e3 }
3193
3211
  );
3194
3212
  } catch {
3195
3213
  }
3196
- execSync2(
3214
+ execSync3(
3197
3215
  `security add-generic-password -s "${service}" -a "${ACCOUNT}" -w "${value}"`,
3198
3216
  { timeout: 5e3 }
3199
3217
  );
@@ -3206,7 +3224,7 @@ function macKeychainDelete(service = SERVICE) {
3206
3224
  if (!nativeKeychainAllowed()) return false;
3207
3225
  if (process.platform !== "darwin") return false;
3208
3226
  try {
3209
- execSync2(
3227
+ execSync3(
3210
3228
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
3211
3229
  { timeout: 5e3 }
3212
3230
  );
@@ -3218,7 +3236,7 @@ function macKeychainDelete(service = SERVICE) {
3218
3236
  function linuxSecretGet(service = SERVICE) {
3219
3237
  if (!linuxSecretAvailable()) return null;
3220
3238
  try {
3221
- return execSync2(
3239
+ return execSync3(
3222
3240
  `secret-tool lookup service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3223
3241
  { encoding: "utf-8", timeout: 5e3 }
3224
3242
  ).trim();
@@ -3229,7 +3247,7 @@ function linuxSecretGet(service = SERVICE) {
3229
3247
  function linuxSecretSet(value, service = SERVICE) {
3230
3248
  if (!linuxSecretAvailable()) return false;
3231
3249
  try {
3232
- execSync2(
3250
+ execSync3(
3233
3251
  `echo -n "${value}" | secret-tool store --label="exe-os master key" service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3234
3252
  { timeout: 5e3 }
3235
3253
  );
@@ -3242,7 +3260,7 @@ function linuxSecretDelete(service = SERVICE) {
3242
3260
  if (!nativeKeychainAllowed()) return false;
3243
3261
  if (process.platform !== "linux") return false;
3244
3262
  try {
3245
- execSync2(
3263
+ execSync3(
3246
3264
  `secret-tool clear service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3247
3265
  { timeout: 5e3 }
3248
3266
  );
@@ -5453,7 +5471,7 @@ var init_session_registry = __esm({
5453
5471
  });
5454
5472
 
5455
5473
  // src/lib/session-key.ts
5456
- import { execSync as execSync3 } from "child_process";
5474
+ import { execSync as execSync4 } from "child_process";
5457
5475
  function normalizeCommand(command) {
5458
5476
  const trimmed = command.trim().toLowerCase();
5459
5477
  const parts = trimmed.split(/[\\/]/);
@@ -5472,7 +5490,7 @@ function resolveRuntimeProcess() {
5472
5490
  let pid = process.ppid;
5473
5491
  for (let i = 0; i < 10; i++) {
5474
5492
  try {
5475
- const info = execSync3(`ps -p ${pid} -o ppid=,comm=`, {
5493
+ const info = execSync4(`ps -p ${pid} -o ppid=,comm=`, {
5476
5494
  encoding: "utf8",
5477
5495
  timeout: 2e3
5478
5496
  }).trim();
@@ -5638,14 +5656,14 @@ var init_transport = __esm({
5638
5656
  });
5639
5657
 
5640
5658
  // src/lib/cc-agent-support.ts
5641
- import { execSync as execSync4 } from "child_process";
5659
+ import { execSync as execSync5 } from "child_process";
5642
5660
  function _resetCcAgentSupportCache() {
5643
5661
  _cachedSupport = null;
5644
5662
  }
5645
5663
  function claudeSupportsAgentFlag() {
5646
5664
  if (_cachedSupport !== null) return _cachedSupport;
5647
5665
  try {
5648
- const helpOutput = execSync4("claude --help 2>&1", {
5666
+ const helpOutput = execSync5("claude --help 2>&1", {
5649
5667
  encoding: "utf-8",
5650
5668
  timeout: 5e3
5651
5669
  });
@@ -6158,7 +6176,7 @@ var init_session_kill_telemetry = __esm({
6158
6176
  });
6159
6177
 
6160
6178
  // src/lib/project-name.ts
6161
- import { execSync as execSync5 } from "child_process";
6179
+ import { execSync as execSync6 } from "child_process";
6162
6180
  import path15 from "path";
6163
6181
  function getProjectName(cwd) {
6164
6182
  const dir = cwd ?? process.cwd();
@@ -6166,7 +6184,7 @@ function getProjectName(cwd) {
6166
6184
  try {
6167
6185
  let repoRoot;
6168
6186
  try {
6169
- const gitCommonDir = execSync5("git rev-parse --path-format=absolute --git-common-dir", {
6187
+ const gitCommonDir = execSync6("git rev-parse --path-format=absolute --git-common-dir", {
6170
6188
  cwd: dir,
6171
6189
  encoding: "utf8",
6172
6190
  timeout: 2e3,
@@ -6174,7 +6192,7 @@ function getProjectName(cwd) {
6174
6192
  }).trim();
6175
6193
  repoRoot = path15.dirname(gitCommonDir);
6176
6194
  } catch {
6177
- repoRoot = execSync5("git rev-parse --show-toplevel", {
6195
+ repoRoot = execSync6("git rev-parse --show-toplevel", {
6178
6196
  cwd: dir,
6179
6197
  encoding: "utf8",
6180
6198
  timeout: 2e3,
@@ -6281,7 +6299,7 @@ __export(tasks_crud_exports, {
6281
6299
  import crypto4 from "crypto";
6282
6300
  import path16 from "path";
6283
6301
  import os11 from "os";
6284
- import { execSync as execSync6 } from "child_process";
6302
+ import { execSync as execSync7 } from "child_process";
6285
6303
  import { mkdir as mkdir4, writeFile as writeFile4, appendFile } from "fs/promises";
6286
6304
  import { existsSync as existsSync15, readFileSync as readFileSync11 } from "fs";
6287
6305
  async function writeCheckpoint(input) {
@@ -6626,14 +6644,14 @@ function isTmuxSessionAlive(identifier) {
6626
6644
  if (!identifier || identifier === "unknown") return true;
6627
6645
  try {
6628
6646
  if (identifier.startsWith("%")) {
6629
- const output = execSync6("tmux list-panes -a -F '#{pane_id}'", {
6647
+ const output = execSync7("tmux list-panes -a -F '#{pane_id}'", {
6630
6648
  timeout: 2e3,
6631
6649
  encoding: "utf8",
6632
6650
  stdio: ["pipe", "pipe", "pipe"]
6633
6651
  });
6634
6652
  return output.split("\n").some((l) => l.trim() === identifier);
6635
6653
  } else {
6636
- execSync6(`tmux has-session -t ${JSON.stringify(identifier)}`, {
6654
+ execSync7(`tmux has-session -t ${JSON.stringify(identifier)}`, {
6637
6655
  timeout: 2e3,
6638
6656
  stdio: ["pipe", "pipe", "pipe"]
6639
6657
  });
@@ -6642,7 +6660,7 @@ function isTmuxSessionAlive(identifier) {
6642
6660
  } catch {
6643
6661
  if (identifier.startsWith("%")) return true;
6644
6662
  try {
6645
- execSync6("tmux list-sessions", {
6663
+ execSync7("tmux list-sessions", {
6646
6664
  timeout: 2e3,
6647
6665
  stdio: ["pipe", "pipe", "pipe"]
6648
6666
  });
@@ -6657,12 +6675,12 @@ function checkStaleCompletion(taskContext, taskCreatedAt) {
6657
6675
  if (!DELEGATION_KEYWORDS.test(taskContext)) return null;
6658
6676
  try {
6659
6677
  const since = new Date(taskCreatedAt).toISOString();
6660
- const branch = execSync6(
6678
+ const branch = execSync7(
6661
6679
  "git rev-parse --abbrev-ref HEAD 2>/dev/null",
6662
6680
  { encoding: "utf8", timeout: 3e3 }
6663
6681
  ).trim();
6664
6682
  const branchArg = branch && branch !== "HEAD" ? branch : "";
6665
- const commitCount = execSync6(
6683
+ const commitCount = execSync7(
6666
6684
  `git log --oneline --since="${since}" ${branchArg} 2>/dev/null | wc -l`,
6667
6685
  { encoding: "utf8", timeout: 5e3 }
6668
6686
  ).trim();
@@ -8261,7 +8279,7 @@ __export(tmux_routing_exports, {
8261
8279
  spawnEmployee: () => spawnEmployee,
8262
8280
  verifyPaneAtCapacity: () => verifyPaneAtCapacity
8263
8281
  });
8264
- import { execFileSync as execFileSync2, execSync as execSync7 } from "child_process";
8282
+ import { execFileSync as execFileSync2, execSync as execSync8 } from "child_process";
8265
8283
  import { readFileSync as readFileSync12, writeFileSync as writeFileSync8, mkdirSync as mkdirSync8, existsSync as existsSync17, appendFileSync, readdirSync as readdirSync4 } from "fs";
8266
8284
  import path20 from "path";
8267
8285
  import os12 from "os";
@@ -8982,7 +9000,7 @@ function spawnEmployee(employeeName, exeSession2, projectDir, opts) {
8982
9000
  let booted = false;
8983
9001
  for (let i = 0; i < 30; i++) {
8984
9002
  try {
8985
- execSync7("sleep 0.5");
9003
+ execSync8("sleep 0.5");
8986
9004
  } catch {
8987
9005
  }
8988
9006
  try {
@@ -9100,7 +9118,7 @@ __export(git_task_sweep_exports, {
9100
9118
  matchScore: () => matchScore,
9101
9119
  sweepTasks: () => sweepTasks
9102
9120
  });
9103
- import { execSync as execSync8 } from "child_process";
9121
+ import { execSync as execSync9 } from "child_process";
9104
9122
  function extractKeywords(text) {
9105
9123
  return text.toLowerCase().replace(/[^a-z0-9\s-]/g, " ").split(/\s+/).filter((w) => w.length >= 3 && !STOP_WORDS.has(w));
9106
9124
  }
@@ -9129,7 +9147,7 @@ function matchScore(task, commitMessage, changedFiles) {
9129
9147
  function getRecentCommits(limit = DEFAULT_COMMIT_LIMIT) {
9130
9148
  try {
9131
9149
  const SEPARATOR = "<<SEP>>";
9132
- const output = execSync8(
9150
+ const output = execSync9(
9133
9151
  `git log --format="%h${SEPARATOR}%s${SEPARATOR}%aI" --name-only -n ${limit} -z`,
9134
9152
  { encoding: "utf8", timeout: 1e4 }
9135
9153
  );
@@ -9320,12 +9338,12 @@ __export(worktree_exports, {
9320
9338
  worktreeBranch: () => worktreeBranch,
9321
9339
  worktreePath: () => worktreePath
9322
9340
  });
9323
- import { execSync as execSync9 } from "child_process";
9341
+ import { execSync as execSync10 } from "child_process";
9324
9342
  import { existsSync as existsSync18, readFileSync as readFileSync13, appendFileSync as appendFileSync2, mkdirSync as mkdirSync9, realpathSync } from "fs";
9325
9343
  import path21 from "path";
9326
9344
  function getGitRoot(dir) {
9327
9345
  try {
9328
- const root = execSync9("git rev-parse --show-toplevel", {
9346
+ const root = execSync10("git rev-parse --show-toplevel", {
9329
9347
  cwd: dir,
9330
9348
  encoding: "utf-8",
9331
9349
  timeout: GIT_TIMEOUT_MS,
@@ -9338,7 +9356,7 @@ function getGitRoot(dir) {
9338
9356
  }
9339
9357
  function getMainRepoRoot(dir) {
9340
9358
  try {
9341
- const commonDir = execSync9(
9359
+ const commonDir = execSync10(
9342
9360
  "git rev-parse --path-format=absolute --git-common-dir",
9343
9361
  { cwd: dir, encoding: "utf-8", timeout: GIT_TIMEOUT_MS, stdio: ["pipe", "pipe", "pipe"] }
9344
9362
  ).trim();
@@ -9369,7 +9387,7 @@ function ensureWorktree(projectDir, employeeName, instance) {
9369
9387
  mkdirSync9(worktreesDir, { recursive: true });
9370
9388
  ensureGitignoreEntry(repoRoot, "/.worktrees/");
9371
9389
  try {
9372
- execSync9("git worktree prune", {
9390
+ execSync10("git worktree prune", {
9373
9391
  cwd: repoRoot,
9374
9392
  encoding: "utf-8",
9375
9393
  timeout: GIT_TIMEOUT_MS,
@@ -9380,14 +9398,14 @@ function ensureWorktree(projectDir, employeeName, instance) {
9380
9398
  const branchExists = branchExistsLocally(repoRoot, branch);
9381
9399
  try {
9382
9400
  if (branchExists) {
9383
- execSync9(`git worktree add "${wtPath}" "${branch}"`, {
9401
+ execSync10(`git worktree add "${wtPath}" "${branch}"`, {
9384
9402
  cwd: repoRoot,
9385
9403
  encoding: "utf-8",
9386
9404
  timeout: GIT_TIMEOUT_MS,
9387
9405
  stdio: ["pipe", "pipe", "pipe"]
9388
9406
  });
9389
9407
  } else {
9390
- execSync9(`git worktree add "${wtPath}" -b "${branch}" HEAD`, {
9408
+ execSync10(`git worktree add "${wtPath}" -b "${branch}" HEAD`, {
9391
9409
  cwd: repoRoot,
9392
9410
  encoding: "utf-8",
9393
9411
  timeout: GIT_TIMEOUT_MS,
@@ -9405,7 +9423,7 @@ function ensureWorktree(projectDir, employeeName, instance) {
9405
9423
  }
9406
9424
  function isWorktreeDirty(wtPath) {
9407
9425
  try {
9408
- const status = execSync9("git status --porcelain", {
9426
+ const status = execSync10("git status --porcelain", {
9409
9427
  cwd: wtPath,
9410
9428
  encoding: "utf-8",
9411
9429
  timeout: GIT_TIMEOUT_MS,
@@ -9435,7 +9453,7 @@ function cleanupWorktree(projectDir, employeeName, instance) {
9435
9453
  return { cleaned: false, reason: `branch ${branch} not merged into ${mainBranch}` };
9436
9454
  }
9437
9455
  try {
9438
- execSync9(`git worktree remove "${wtPath}"`, {
9456
+ execSync10(`git worktree remove "${wtPath}"`, {
9439
9457
  cwd: repoRoot,
9440
9458
  encoding: "utf-8",
9441
9459
  timeout: GIT_TIMEOUT_MS,
@@ -9448,7 +9466,7 @@ function cleanupWorktree(projectDir, employeeName, instance) {
9448
9466
  };
9449
9467
  }
9450
9468
  try {
9451
- execSync9(`git branch -d "${branch}"`, {
9469
+ execSync10(`git branch -d "${branch}"`, {
9452
9470
  cwd: repoRoot,
9453
9471
  encoding: "utf-8",
9454
9472
  timeout: GIT_TIMEOUT_MS,
@@ -9460,7 +9478,7 @@ function cleanupWorktree(projectDir, employeeName, instance) {
9460
9478
  }
9461
9479
  function branchExistsLocally(repoRoot, branch) {
9462
9480
  try {
9463
- execSync9(`git rev-parse --verify "refs/heads/${branch}"`, {
9481
+ execSync10(`git rev-parse --verify "refs/heads/${branch}"`, {
9464
9482
  cwd: repoRoot,
9465
9483
  encoding: "utf-8",
9466
9484
  timeout: GIT_TIMEOUT_MS,
@@ -9479,7 +9497,7 @@ function detectMainBranch(repoRoot) {
9479
9497
  }
9480
9498
  function isBranchMerged(repoRoot, branch, into) {
9481
9499
  try {
9482
- const merged = execSync9(`git branch --merged "${into}"`, {
9500
+ const merged = execSync10(`git branch --merged "${into}"`, {
9483
9501
  cwd: repoRoot,
9484
9502
  encoding: "utf-8",
9485
9503
  timeout: GIT_TIMEOUT_MS,
@@ -9526,7 +9544,7 @@ init_database();
9526
9544
  init_task_scope();
9527
9545
  init_project_name();
9528
9546
  import crypto7 from "crypto";
9529
- import { execSync as execSync10 } from "child_process";
9547
+ import { execSync as execSync11 } from "child_process";
9530
9548
  var agentName = process.argv[2];
9531
9549
  var exeSession = process.argv[3];
9532
9550
  if (!agentName) process.exit(0);
@@ -9702,7 +9720,7 @@ try {
9702
9720
  }
9703
9721
  const msg = `session-ended: ${agentName} session terminated. ${parts.join(". ")}`;
9704
9722
  try {
9705
- execSync10(`tmux send-keys -t ${JSON.stringify(exeSession)} ${JSON.stringify(msg)} Enter`, {
9723
+ execSync11(`tmux send-keys -t ${JSON.stringify(exeSession)} ${JSON.stringify(msg)} Enter`, {
9706
9724
  timeout: 3e3
9707
9725
  });
9708
9726
  } catch {
@@ -9718,6 +9736,11 @@ try {
9718
9736
  }
9719
9737
  } catch {
9720
9738
  }
9739
+ try {
9740
+ const client = getClient();
9741
+ await client.execute("PRAGMA wal_checkpoint(PASSIVE)");
9742
+ } catch {
9743
+ }
9721
9744
  try {
9722
9745
  const { cleanupWorktree: cleanupWorktree2 } = await Promise.resolve().then(() => (init_worktree(), worktree_exports));
9723
9746
  const cleanup = cleanupWorktree2(process.cwd(), agentName);
@@ -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}.