@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
@@ -1373,7 +1373,7 @@ var init_daemon_auth = __esm({
1373
1373
  // src/lib/exe-daemon-client.ts
1374
1374
  import net from "net";
1375
1375
  import os5 from "os";
1376
- import { spawn } from "child_process";
1376
+ import { spawn, execSync as execSync4 } from "child_process";
1377
1377
  import { randomUUID } from "crypto";
1378
1378
  import { existsSync as existsSync8, unlinkSync as unlinkSync5, readFileSync as readFileSync7, openSync, closeSync, statSync } from "fs";
1379
1379
  import path9 from "path";
@@ -1403,6 +1403,14 @@ function handleData(chunk) {
1403
1403
  }
1404
1404
  }
1405
1405
  }
1406
+ function isZombie(pid) {
1407
+ try {
1408
+ const state = execSync4(`ps -p ${pid} -o state=`, { encoding: "utf8", timeout: 2e3 }).trim();
1409
+ return state.startsWith("Z");
1410
+ } catch {
1411
+ return false;
1412
+ }
1413
+ }
1406
1414
  function cleanupStaleFiles() {
1407
1415
  if (existsSync8(PID_PATH)) {
1408
1416
  try {
@@ -1410,7 +1418,11 @@ function cleanupStaleFiles() {
1410
1418
  if (pid > 0) {
1411
1419
  try {
1412
1420
  process.kill(pid, 0);
1413
- return;
1421
+ if (!isZombie(pid)) {
1422
+ return;
1423
+ }
1424
+ process.stderr.write(`[exed-client] PID ${pid} is a zombie \u2014 cleaning up stale files
1425
+ `);
1414
1426
  } catch {
1415
1427
  }
1416
1428
  }
@@ -1438,8 +1450,8 @@ function findPackageRoot() {
1438
1450
  function getAvailableMemoryGB() {
1439
1451
  if (process.platform === "darwin") {
1440
1452
  try {
1441
- const { execSync: execSync7 } = __require("child_process");
1442
- const vmstat = execSync7("vm_stat", { encoding: "utf8" });
1453
+ const { execSync: execSync8 } = __require("child_process");
1454
+ const vmstat = execSync8("vm_stat", { encoding: "utf8" });
1443
1455
  const pageSize = 16384;
1444
1456
  const pageSizeMatch = vmstat.match(/page size of (\d+) bytes/);
1445
1457
  const actualPageSize = pageSizeMatch ? parseInt(pageSizeMatch[1], 10) : pageSize;
@@ -3225,6 +3237,12 @@ async function disposeDatabase() {
3225
3237
  clearInterval(_walCheckpointTimer);
3226
3238
  _walCheckpointTimer = null;
3227
3239
  }
3240
+ if (_client) {
3241
+ try {
3242
+ await _client.execute("PRAGMA wal_checkpoint(PASSIVE)");
3243
+ } catch {
3244
+ }
3245
+ }
3228
3246
  if (_daemonClient) {
3229
3247
  _daemonClient.close();
3230
3248
  _daemonClient = null;
@@ -3261,7 +3279,7 @@ var init_database = __esm({
3261
3279
  // src/lib/keychain.ts
3262
3280
  import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2 } from "fs/promises";
3263
3281
  import { existsSync as existsSync9, statSync as statSync2 } from "fs";
3264
- import { execSync as execSync4 } from "child_process";
3282
+ import { execSync as execSync5 } from "child_process";
3265
3283
  import path10 from "path";
3266
3284
  import os6 from "os";
3267
3285
  function getKeyDir() {
@@ -3278,13 +3296,13 @@ function linuxSecretAvailable() {
3278
3296
  if (process.platform !== "linux") return false;
3279
3297
  if (linuxSecretAvailability !== null) return linuxSecretAvailability;
3280
3298
  try {
3281
- execSync4("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
3299
+ execSync5("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
3282
3300
  } catch {
3283
3301
  linuxSecretAvailability = false;
3284
3302
  return false;
3285
3303
  }
3286
3304
  try {
3287
- execSync4("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
3305
+ execSync5("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
3288
3306
  linuxSecretAvailability = true;
3289
3307
  } catch {
3290
3308
  linuxSecretAvailability = false;
@@ -3308,7 +3326,7 @@ function macKeychainGet(service = SERVICE) {
3308
3326
  if (!nativeKeychainAllowed()) return null;
3309
3327
  if (process.platform !== "darwin") return null;
3310
3328
  try {
3311
- return execSync4(
3329
+ return execSync5(
3312
3330
  `security find-generic-password -s "${service}" -a "${ACCOUNT}" -w 2>/dev/null`,
3313
3331
  { encoding: "utf-8", timeout: 5e3 }
3314
3332
  ).trim();
@@ -3321,13 +3339,13 @@ function macKeychainSet(value, service = SERVICE) {
3321
3339
  if (process.platform !== "darwin") return false;
3322
3340
  try {
3323
3341
  try {
3324
- execSync4(
3342
+ execSync5(
3325
3343
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
3326
3344
  { timeout: 5e3 }
3327
3345
  );
3328
3346
  } catch {
3329
3347
  }
3330
- execSync4(
3348
+ execSync5(
3331
3349
  `security add-generic-password -s "${service}" -a "${ACCOUNT}" -w "${value}"`,
3332
3350
  { timeout: 5e3 }
3333
3351
  );
@@ -3340,7 +3358,7 @@ function macKeychainDelete(service = SERVICE) {
3340
3358
  if (!nativeKeychainAllowed()) return false;
3341
3359
  if (process.platform !== "darwin") return false;
3342
3360
  try {
3343
- execSync4(
3361
+ execSync5(
3344
3362
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
3345
3363
  { timeout: 5e3 }
3346
3364
  );
@@ -3352,7 +3370,7 @@ function macKeychainDelete(service = SERVICE) {
3352
3370
  function linuxSecretGet(service = SERVICE) {
3353
3371
  if (!linuxSecretAvailable()) return null;
3354
3372
  try {
3355
- return execSync4(
3373
+ return execSync5(
3356
3374
  `secret-tool lookup service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3357
3375
  { encoding: "utf-8", timeout: 5e3 }
3358
3376
  ).trim();
@@ -3363,7 +3381,7 @@ function linuxSecretGet(service = SERVICE) {
3363
3381
  function linuxSecretSet(value, service = SERVICE) {
3364
3382
  if (!linuxSecretAvailable()) return false;
3365
3383
  try {
3366
- execSync4(
3384
+ execSync5(
3367
3385
  `echo -n "${value}" | secret-tool store --label="exe-os master key" service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3368
3386
  { timeout: 5e3 }
3369
3387
  );
@@ -3376,7 +3394,7 @@ function linuxSecretDelete(service = SERVICE) {
3376
3394
  if (!nativeKeychainAllowed()) return false;
3377
3395
  if (process.platform !== "linux") return false;
3378
3396
  try {
3379
- execSync4(
3397
+ execSync5(
3380
3398
  `secret-tool clear service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3381
3399
  { timeout: 5e3 }
3382
3400
  );
@@ -5559,11 +5577,11 @@ __export(git_staleness_exports, {
5559
5577
  detectStaleFiles: () => detectStaleFiles,
5560
5578
  recordFileRead: () => recordFileRead
5561
5579
  });
5562
- import { execSync as execSync5 } from "child_process";
5580
+ import { execSync as execSync6 } from "child_process";
5563
5581
  import path12 from "path";
5564
5582
  function getHeadCommit(cwd) {
5565
5583
  try {
5566
- return execSync5("git rev-parse --short HEAD", {
5584
+ return execSync6("git rev-parse --short HEAD", {
5567
5585
  cwd,
5568
5586
  timeout: GIT_TIMEOUT_MS,
5569
5587
  encoding: "utf-8"
@@ -5626,7 +5644,7 @@ async function detectStaleFiles(agentId, cwd) {
5626
5644
  const readAt = String(record.read_at ?? "");
5627
5645
  if (!filePath || !readAt) continue;
5628
5646
  try {
5629
- const gitSummary = execSync5(
5647
+ const gitSummary = execSync6(
5630
5648
  `git log -1 --oneline --after=${JSON.stringify(readAt)} --format="%h %an: %s" -- ${JSON.stringify(filePath)}`,
5631
5649
  {
5632
5650
  cwd,
@@ -5863,7 +5881,7 @@ __export(project_name_exports, {
5863
5881
  _resetCache: () => _resetCache,
5864
5882
  getProjectName: () => getProjectName
5865
5883
  });
5866
- import { execSync as execSync6 } from "child_process";
5884
+ import { execSync as execSync7 } from "child_process";
5867
5885
  import path13 from "path";
5868
5886
  function getProjectName(cwd) {
5869
5887
  const dir = cwd ?? process.cwd();
@@ -5871,7 +5889,7 @@ function getProjectName(cwd) {
5871
5889
  try {
5872
5890
  let repoRoot;
5873
5891
  try {
5874
- const gitCommonDir = execSync6("git rev-parse --path-format=absolute --git-common-dir", {
5892
+ const gitCommonDir = execSync7("git rev-parse --path-format=absolute --git-common-dir", {
5875
5893
  cwd: dir,
5876
5894
  encoding: "utf8",
5877
5895
  timeout: 2e3,
@@ -5879,7 +5897,7 @@ function getProjectName(cwd) {
5879
5897
  }).trim();
5880
5898
  repoRoot = path13.dirname(gitCommonDir);
5881
5899
  } catch {
5882
- repoRoot = execSync6("git rev-parse --show-toplevel", {
5900
+ repoRoot = execSync7("git rev-parse --show-toplevel", {
5883
5901
  cwd: dir,
5884
5902
  encoding: "utf8",
5885
5903
  timeout: 2e3,
@@ -994,7 +994,7 @@ __export(exe_daemon_client_exports, {
994
994
  });
995
995
  import net from "net";
996
996
  import os4 from "os";
997
- import { spawn } from "child_process";
997
+ import { spawn, execSync as execSync4 } from "child_process";
998
998
  import { randomUUID } from "crypto";
999
999
  import { existsSync as existsSync5, unlinkSync as unlinkSync3, readFileSync as readFileSync5, openSync, closeSync, statSync } from "fs";
1000
1000
  import path6 from "path";
@@ -1024,6 +1024,14 @@ function handleData(chunk) {
1024
1024
  }
1025
1025
  }
1026
1026
  }
1027
+ function isZombie(pid) {
1028
+ try {
1029
+ const state = execSync4(`ps -p ${pid} -o state=`, { encoding: "utf8", timeout: 2e3 }).trim();
1030
+ return state.startsWith("Z");
1031
+ } catch {
1032
+ return false;
1033
+ }
1034
+ }
1027
1035
  function cleanupStaleFiles() {
1028
1036
  if (existsSync5(PID_PATH)) {
1029
1037
  try {
@@ -1031,7 +1039,11 @@ function cleanupStaleFiles() {
1031
1039
  if (pid > 0) {
1032
1040
  try {
1033
1041
  process.kill(pid, 0);
1034
- return;
1042
+ if (!isZombie(pid)) {
1043
+ return;
1044
+ }
1045
+ process.stderr.write(`[exed-client] PID ${pid} is a zombie \u2014 cleaning up stale files
1046
+ `);
1035
1047
  } catch {
1036
1048
  }
1037
1049
  }
@@ -1059,8 +1071,8 @@ function findPackageRoot() {
1059
1071
  function getAvailableMemoryGB() {
1060
1072
  if (process.platform === "darwin") {
1061
1073
  try {
1062
- const { execSync: execSync5 } = __require("child_process");
1063
- const vmstat = execSync5("vm_stat", { encoding: "utf8" });
1074
+ const { execSync: execSync6 } = __require("child_process");
1075
+ const vmstat = execSync6("vm_stat", { encoding: "utf8" });
1064
1076
  const pageSize = 16384;
1065
1077
  const pageSizeMatch = vmstat.match(/page size of (\d+) bytes/);
1066
1078
  const actualPageSize = pageSizeMatch ? parseInt(pageSizeMatch[1], 10) : pageSize;
@@ -3050,6 +3062,12 @@ async function disposeDatabase() {
3050
3062
  clearInterval(_walCheckpointTimer);
3051
3063
  _walCheckpointTimer = null;
3052
3064
  }
3065
+ if (_client) {
3066
+ try {
3067
+ await _client.execute("PRAGMA wal_checkpoint(PASSIVE)");
3068
+ } catch {
3069
+ }
3070
+ }
3053
3071
  if (_daemonClient) {
3054
3072
  _daemonClient.close();
3055
3073
  _daemonClient = null;
@@ -3086,7 +3104,7 @@ var init_database = __esm({
3086
3104
  // src/lib/keychain.ts
3087
3105
  import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2 } from "fs/promises";
3088
3106
  import { existsSync as existsSync7, statSync as statSync2 } from "fs";
3089
- import { execSync as execSync4 } from "child_process";
3107
+ import { execSync as execSync5 } from "child_process";
3090
3108
  import path8 from "path";
3091
3109
  import os5 from "os";
3092
3110
  function getKeyDir() {
@@ -3103,13 +3121,13 @@ function linuxSecretAvailable() {
3103
3121
  if (process.platform !== "linux") return false;
3104
3122
  if (linuxSecretAvailability !== null) return linuxSecretAvailability;
3105
3123
  try {
3106
- execSync4("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
3124
+ execSync5("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
3107
3125
  } catch {
3108
3126
  linuxSecretAvailability = false;
3109
3127
  return false;
3110
3128
  }
3111
3129
  try {
3112
- execSync4("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
3130
+ execSync5("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
3113
3131
  linuxSecretAvailability = true;
3114
3132
  } catch {
3115
3133
  linuxSecretAvailability = false;
@@ -3133,7 +3151,7 @@ function macKeychainGet(service = SERVICE) {
3133
3151
  if (!nativeKeychainAllowed()) return null;
3134
3152
  if (process.platform !== "darwin") return null;
3135
3153
  try {
3136
- return execSync4(
3154
+ return execSync5(
3137
3155
  `security find-generic-password -s "${service}" -a "${ACCOUNT}" -w 2>/dev/null`,
3138
3156
  { encoding: "utf-8", timeout: 5e3 }
3139
3157
  ).trim();
@@ -3146,13 +3164,13 @@ function macKeychainSet(value, service = SERVICE) {
3146
3164
  if (process.platform !== "darwin") return false;
3147
3165
  try {
3148
3166
  try {
3149
- execSync4(
3167
+ execSync5(
3150
3168
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
3151
3169
  { timeout: 5e3 }
3152
3170
  );
3153
3171
  } catch {
3154
3172
  }
3155
- execSync4(
3173
+ execSync5(
3156
3174
  `security add-generic-password -s "${service}" -a "${ACCOUNT}" -w "${value}"`,
3157
3175
  { timeout: 5e3 }
3158
3176
  );
@@ -3165,7 +3183,7 @@ function macKeychainDelete(service = SERVICE) {
3165
3183
  if (!nativeKeychainAllowed()) return false;
3166
3184
  if (process.platform !== "darwin") return false;
3167
3185
  try {
3168
- execSync4(
3186
+ execSync5(
3169
3187
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
3170
3188
  { timeout: 5e3 }
3171
3189
  );
@@ -3177,7 +3195,7 @@ function macKeychainDelete(service = SERVICE) {
3177
3195
  function linuxSecretGet(service = SERVICE) {
3178
3196
  if (!linuxSecretAvailable()) return null;
3179
3197
  try {
3180
- return execSync4(
3198
+ return execSync5(
3181
3199
  `secret-tool lookup service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3182
3200
  { encoding: "utf-8", timeout: 5e3 }
3183
3201
  ).trim();
@@ -3188,7 +3206,7 @@ function linuxSecretGet(service = SERVICE) {
3188
3206
  function linuxSecretSet(value, service = SERVICE) {
3189
3207
  if (!linuxSecretAvailable()) return false;
3190
3208
  try {
3191
- execSync4(
3209
+ execSync5(
3192
3210
  `echo -n "${value}" | secret-tool store --label="exe-os master key" service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3193
3211
  { timeout: 5e3 }
3194
3212
  );
@@ -3201,7 +3219,7 @@ function linuxSecretDelete(service = SERVICE) {
3201
3219
  if (!nativeKeychainAllowed()) return false;
3202
3220
  if (process.platform !== "linux") return false;
3203
3221
  try {
3204
- execSync4(
3222
+ execSync5(
3205
3223
  `secret-tool clear service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3206
3224
  { timeout: 5e3 }
3207
3225
  );
@@ -994,7 +994,7 @@ __export(exe_daemon_client_exports, {
994
994
  });
995
995
  import net from "net";
996
996
  import os4 from "os";
997
- import { spawn } from "child_process";
997
+ import { spawn, execSync as execSync4 } from "child_process";
998
998
  import { randomUUID } from "crypto";
999
999
  import { existsSync as existsSync5, unlinkSync as unlinkSync3, readFileSync as readFileSync5, openSync, closeSync, statSync } from "fs";
1000
1000
  import path6 from "path";
@@ -1024,6 +1024,14 @@ function handleData(chunk) {
1024
1024
  }
1025
1025
  }
1026
1026
  }
1027
+ function isZombie(pid) {
1028
+ try {
1029
+ const state = execSync4(`ps -p ${pid} -o state=`, { encoding: "utf8", timeout: 2e3 }).trim();
1030
+ return state.startsWith("Z");
1031
+ } catch {
1032
+ return false;
1033
+ }
1034
+ }
1027
1035
  function cleanupStaleFiles() {
1028
1036
  if (existsSync5(PID_PATH)) {
1029
1037
  try {
@@ -1031,7 +1039,11 @@ function cleanupStaleFiles() {
1031
1039
  if (pid > 0) {
1032
1040
  try {
1033
1041
  process.kill(pid, 0);
1034
- return;
1042
+ if (!isZombie(pid)) {
1043
+ return;
1044
+ }
1045
+ process.stderr.write(`[exed-client] PID ${pid} is a zombie \u2014 cleaning up stale files
1046
+ `);
1035
1047
  } catch {
1036
1048
  }
1037
1049
  }
@@ -1059,8 +1071,8 @@ function findPackageRoot() {
1059
1071
  function getAvailableMemoryGB() {
1060
1072
  if (process.platform === "darwin") {
1061
1073
  try {
1062
- const { execSync: execSync5 } = __require("child_process");
1063
- const vmstat = execSync5("vm_stat", { encoding: "utf8" });
1074
+ const { execSync: execSync6 } = __require("child_process");
1075
+ const vmstat = execSync6("vm_stat", { encoding: "utf8" });
1064
1076
  const pageSize = 16384;
1065
1077
  const pageSizeMatch = vmstat.match(/page size of (\d+) bytes/);
1066
1078
  const actualPageSize = pageSizeMatch ? parseInt(pageSizeMatch[1], 10) : pageSize;
@@ -3050,6 +3062,12 @@ async function disposeDatabase() {
3050
3062
  clearInterval(_walCheckpointTimer);
3051
3063
  _walCheckpointTimer = null;
3052
3064
  }
3065
+ if (_client) {
3066
+ try {
3067
+ await _client.execute("PRAGMA wal_checkpoint(PASSIVE)");
3068
+ } catch {
3069
+ }
3070
+ }
3053
3071
  if (_daemonClient) {
3054
3072
  _daemonClient.close();
3055
3073
  _daemonClient = null;
@@ -3086,7 +3104,7 @@ var init_database = __esm({
3086
3104
  // src/lib/keychain.ts
3087
3105
  import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2 } from "fs/promises";
3088
3106
  import { existsSync as existsSync6, statSync as statSync2 } from "fs";
3089
- import { execSync as execSync4 } from "child_process";
3107
+ import { execSync as execSync5 } from "child_process";
3090
3108
  import path7 from "path";
3091
3109
  import os5 from "os";
3092
3110
  function getKeyDir() {
@@ -3103,13 +3121,13 @@ function linuxSecretAvailable() {
3103
3121
  if (process.platform !== "linux") return false;
3104
3122
  if (linuxSecretAvailability !== null) return linuxSecretAvailability;
3105
3123
  try {
3106
- execSync4("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
3124
+ execSync5("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
3107
3125
  } catch {
3108
3126
  linuxSecretAvailability = false;
3109
3127
  return false;
3110
3128
  }
3111
3129
  try {
3112
- execSync4("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
3130
+ execSync5("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
3113
3131
  linuxSecretAvailability = true;
3114
3132
  } catch {
3115
3133
  linuxSecretAvailability = false;
@@ -3133,7 +3151,7 @@ function macKeychainGet(service = SERVICE) {
3133
3151
  if (!nativeKeychainAllowed()) return null;
3134
3152
  if (process.platform !== "darwin") return null;
3135
3153
  try {
3136
- return execSync4(
3154
+ return execSync5(
3137
3155
  `security find-generic-password -s "${service}" -a "${ACCOUNT}" -w 2>/dev/null`,
3138
3156
  { encoding: "utf-8", timeout: 5e3 }
3139
3157
  ).trim();
@@ -3146,13 +3164,13 @@ function macKeychainSet(value, service = SERVICE) {
3146
3164
  if (process.platform !== "darwin") return false;
3147
3165
  try {
3148
3166
  try {
3149
- execSync4(
3167
+ execSync5(
3150
3168
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
3151
3169
  { timeout: 5e3 }
3152
3170
  );
3153
3171
  } catch {
3154
3172
  }
3155
- execSync4(
3173
+ execSync5(
3156
3174
  `security add-generic-password -s "${service}" -a "${ACCOUNT}" -w "${value}"`,
3157
3175
  { timeout: 5e3 }
3158
3176
  );
@@ -3165,7 +3183,7 @@ function macKeychainDelete(service = SERVICE) {
3165
3183
  if (!nativeKeychainAllowed()) return false;
3166
3184
  if (process.platform !== "darwin") return false;
3167
3185
  try {
3168
- execSync4(
3186
+ execSync5(
3169
3187
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
3170
3188
  { timeout: 5e3 }
3171
3189
  );
@@ -3177,7 +3195,7 @@ function macKeychainDelete(service = SERVICE) {
3177
3195
  function linuxSecretGet(service = SERVICE) {
3178
3196
  if (!linuxSecretAvailable()) return null;
3179
3197
  try {
3180
- return execSync4(
3198
+ return execSync5(
3181
3199
  `secret-tool lookup service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3182
3200
  { encoding: "utf-8", timeout: 5e3 }
3183
3201
  ).trim();
@@ -3188,7 +3206,7 @@ function linuxSecretGet(service = SERVICE) {
3188
3206
  function linuxSecretSet(value, service = SERVICE) {
3189
3207
  if (!linuxSecretAvailable()) return false;
3190
3208
  try {
3191
- execSync4(
3209
+ execSync5(
3192
3210
  `echo -n "${value}" | secret-tool store --label="exe-os master key" service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3193
3211
  { timeout: 5e3 }
3194
3212
  );
@@ -3201,7 +3219,7 @@ function linuxSecretDelete(service = SERVICE) {
3201
3219
  if (!nativeKeychainAllowed()) return false;
3202
3220
  if (process.platform !== "linux") return false;
3203
3221
  try {
3204
- execSync4(
3222
+ execSync5(
3205
3223
  `secret-tool clear service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3206
3224
  { timeout: 5e3 }
3207
3225
  );
@@ -1289,7 +1289,7 @@ __export(exe_daemon_client_exports, {
1289
1289
  });
1290
1290
  import net from "net";
1291
1291
  import os6 from "os";
1292
- import { spawn } from "child_process";
1292
+ import { spawn, execSync as execSync5 } from "child_process";
1293
1293
  import { randomUUID } from "crypto";
1294
1294
  import { existsSync as existsSync7, unlinkSync as unlinkSync3, readFileSync as readFileSync7, openSync, closeSync, statSync } from "fs";
1295
1295
  import path9 from "path";
@@ -1319,6 +1319,14 @@ function handleData(chunk) {
1319
1319
  }
1320
1320
  }
1321
1321
  }
1322
+ function isZombie(pid) {
1323
+ try {
1324
+ const state = execSync5(`ps -p ${pid} -o state=`, { encoding: "utf8", timeout: 2e3 }).trim();
1325
+ return state.startsWith("Z");
1326
+ } catch {
1327
+ return false;
1328
+ }
1329
+ }
1322
1330
  function cleanupStaleFiles() {
1323
1331
  if (existsSync7(PID_PATH)) {
1324
1332
  try {
@@ -1326,7 +1334,11 @@ function cleanupStaleFiles() {
1326
1334
  if (pid > 0) {
1327
1335
  try {
1328
1336
  process.kill(pid, 0);
1329
- return;
1337
+ if (!isZombie(pid)) {
1338
+ return;
1339
+ }
1340
+ process.stderr.write(`[exed-client] PID ${pid} is a zombie \u2014 cleaning up stale files
1341
+ `);
1330
1342
  } catch {
1331
1343
  }
1332
1344
  }
@@ -1354,8 +1366,8 @@ function findPackageRoot() {
1354
1366
  function getAvailableMemoryGB() {
1355
1367
  if (process.platform === "darwin") {
1356
1368
  try {
1357
- const { execSync: execSync6 } = __require("child_process");
1358
- const vmstat = execSync6("vm_stat", { encoding: "utf8" });
1369
+ const { execSync: execSync7 } = __require("child_process");
1370
+ const vmstat = execSync7("vm_stat", { encoding: "utf8" });
1359
1371
  const pageSize = 16384;
1360
1372
  const pageSizeMatch = vmstat.match(/page size of (\d+) bytes/);
1361
1373
  const actualPageSize = pageSizeMatch ? parseInt(pageSizeMatch[1], 10) : pageSize;
@@ -3345,6 +3357,12 @@ async function disposeDatabase() {
3345
3357
  clearInterval(_walCheckpointTimer);
3346
3358
  _walCheckpointTimer = null;
3347
3359
  }
3360
+ if (_client) {
3361
+ try {
3362
+ await _client.execute("PRAGMA wal_checkpoint(PASSIVE)");
3363
+ } catch {
3364
+ }
3365
+ }
3348
3366
  if (_daemonClient) {
3349
3367
  _daemonClient.close();
3350
3368
  _daemonClient = null;
@@ -3524,7 +3542,7 @@ var init_task_scope = __esm({
3524
3542
  // src/lib/keychain.ts
3525
3543
  import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2 } from "fs/promises";
3526
3544
  import { existsSync as existsSync12, statSync as statSync2 } from "fs";
3527
- import { execSync as execSync5 } from "child_process";
3545
+ import { execSync as execSync6 } from "child_process";
3528
3546
  import path14 from "path";
3529
3547
  import os10 from "os";
3530
3548
  function getKeyDir() {
@@ -3541,13 +3559,13 @@ function linuxSecretAvailable() {
3541
3559
  if (process.platform !== "linux") return false;
3542
3560
  if (linuxSecretAvailability !== null) return linuxSecretAvailability;
3543
3561
  try {
3544
- execSync5("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
3562
+ execSync6("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
3545
3563
  } catch {
3546
3564
  linuxSecretAvailability = false;
3547
3565
  return false;
3548
3566
  }
3549
3567
  try {
3550
- execSync5("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
3568
+ execSync6("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
3551
3569
  linuxSecretAvailability = true;
3552
3570
  } catch {
3553
3571
  linuxSecretAvailability = false;
@@ -3571,7 +3589,7 @@ function macKeychainGet(service = SERVICE) {
3571
3589
  if (!nativeKeychainAllowed()) return null;
3572
3590
  if (process.platform !== "darwin") return null;
3573
3591
  try {
3574
- return execSync5(
3592
+ return execSync6(
3575
3593
  `security find-generic-password -s "${service}" -a "${ACCOUNT}" -w 2>/dev/null`,
3576
3594
  { encoding: "utf-8", timeout: 5e3 }
3577
3595
  ).trim();
@@ -3584,13 +3602,13 @@ function macKeychainSet(value, service = SERVICE) {
3584
3602
  if (process.platform !== "darwin") return false;
3585
3603
  try {
3586
3604
  try {
3587
- execSync5(
3605
+ execSync6(
3588
3606
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
3589
3607
  { timeout: 5e3 }
3590
3608
  );
3591
3609
  } catch {
3592
3610
  }
3593
- execSync5(
3611
+ execSync6(
3594
3612
  `security add-generic-password -s "${service}" -a "${ACCOUNT}" -w "${value}"`,
3595
3613
  { timeout: 5e3 }
3596
3614
  );
@@ -3603,7 +3621,7 @@ function macKeychainDelete(service = SERVICE) {
3603
3621
  if (!nativeKeychainAllowed()) return false;
3604
3622
  if (process.platform !== "darwin") return false;
3605
3623
  try {
3606
- execSync5(
3624
+ execSync6(
3607
3625
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
3608
3626
  { timeout: 5e3 }
3609
3627
  );
@@ -3615,7 +3633,7 @@ function macKeychainDelete(service = SERVICE) {
3615
3633
  function linuxSecretGet(service = SERVICE) {
3616
3634
  if (!linuxSecretAvailable()) return null;
3617
3635
  try {
3618
- return execSync5(
3636
+ return execSync6(
3619
3637
  `secret-tool lookup service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3620
3638
  { encoding: "utf-8", timeout: 5e3 }
3621
3639
  ).trim();
@@ -3626,7 +3644,7 @@ function linuxSecretGet(service = SERVICE) {
3626
3644
  function linuxSecretSet(value, service = SERVICE) {
3627
3645
  if (!linuxSecretAvailable()) return false;
3628
3646
  try {
3629
- execSync5(
3647
+ execSync6(
3630
3648
  `echo -n "${value}" | secret-tool store --label="exe-os master key" service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3631
3649
  { timeout: 5e3 }
3632
3650
  );
@@ -3639,7 +3657,7 @@ function linuxSecretDelete(service = SERVICE) {
3639
3657
  if (!nativeKeychainAllowed()) return false;
3640
3658
  if (process.platform !== "linux") return false;
3641
3659
  try {
3642
- execSync5(
3660
+ execSync6(
3643
3661
  `secret-tool clear service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3644
3662
  { timeout: 5e3 }
3645
3663
  );