@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
@@ -1090,7 +1090,7 @@ __export(exe_daemon_client_exports, {
1090
1090
  });
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: execSync7 } = __require("child_process");
1159
- const vmstat = execSync7("vm_stat", { encoding: "utf8" });
1170
+ const { execSync: execSync8 } = __require("child_process");
1171
+ const vmstat = execSync8("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;
@@ -3146,6 +3158,12 @@ async function disposeDatabase() {
3146
3158
  clearInterval(_walCheckpointTimer);
3147
3159
  _walCheckpointTimer = null;
3148
3160
  }
3161
+ if (_client) {
3162
+ try {
3163
+ await _client.execute("PRAGMA wal_checkpoint(PASSIVE)");
3164
+ } catch {
3165
+ }
3166
+ }
3149
3167
  if (_daemonClient) {
3150
3168
  _daemonClient.close();
3151
3169
  _daemonClient = null;
@@ -3182,7 +3200,7 @@ var init_database = __esm({
3182
3200
  // src/lib/keychain.ts
3183
3201
  import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2 } from "fs/promises";
3184
3202
  import { existsSync as existsSync6, statSync as statSync2 } from "fs";
3185
- import { execSync as execSync2 } from "child_process";
3203
+ import { execSync as execSync3 } from "child_process";
3186
3204
  import path6 from "path";
3187
3205
  import os5 from "os";
3188
3206
  function getKeyDir() {
@@ -3199,13 +3217,13 @@ function linuxSecretAvailable() {
3199
3217
  if (process.platform !== "linux") return false;
3200
3218
  if (linuxSecretAvailability !== null) return linuxSecretAvailability;
3201
3219
  try {
3202
- execSync2("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
3220
+ execSync3("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
3203
3221
  } catch {
3204
3222
  linuxSecretAvailability = false;
3205
3223
  return false;
3206
3224
  }
3207
3225
  try {
3208
- execSync2("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
3226
+ execSync3("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
3209
3227
  linuxSecretAvailability = true;
3210
3228
  } catch {
3211
3229
  linuxSecretAvailability = false;
@@ -3229,7 +3247,7 @@ function macKeychainGet(service = SERVICE) {
3229
3247
  if (!nativeKeychainAllowed()) return null;
3230
3248
  if (process.platform !== "darwin") return null;
3231
3249
  try {
3232
- return execSync2(
3250
+ return execSync3(
3233
3251
  `security find-generic-password -s "${service}" -a "${ACCOUNT}" -w 2>/dev/null`,
3234
3252
  { encoding: "utf-8", timeout: 5e3 }
3235
3253
  ).trim();
@@ -3242,13 +3260,13 @@ function macKeychainSet(value, service = SERVICE) {
3242
3260
  if (process.platform !== "darwin") return false;
3243
3261
  try {
3244
3262
  try {
3245
- execSync2(
3263
+ execSync3(
3246
3264
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
3247
3265
  { timeout: 5e3 }
3248
3266
  );
3249
3267
  } catch {
3250
3268
  }
3251
- execSync2(
3269
+ execSync3(
3252
3270
  `security add-generic-password -s "${service}" -a "${ACCOUNT}" -w "${value}"`,
3253
3271
  { timeout: 5e3 }
3254
3272
  );
@@ -3261,7 +3279,7 @@ function macKeychainDelete(service = SERVICE) {
3261
3279
  if (!nativeKeychainAllowed()) return false;
3262
3280
  if (process.platform !== "darwin") return false;
3263
3281
  try {
3264
- execSync2(
3282
+ execSync3(
3265
3283
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
3266
3284
  { timeout: 5e3 }
3267
3285
  );
@@ -3273,7 +3291,7 @@ function macKeychainDelete(service = SERVICE) {
3273
3291
  function linuxSecretGet(service = SERVICE) {
3274
3292
  if (!linuxSecretAvailable()) return null;
3275
3293
  try {
3276
- return execSync2(
3294
+ return execSync3(
3277
3295
  `secret-tool lookup service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3278
3296
  { encoding: "utf-8", timeout: 5e3 }
3279
3297
  ).trim();
@@ -3284,7 +3302,7 @@ function linuxSecretGet(service = SERVICE) {
3284
3302
  function linuxSecretSet(value, service = SERVICE) {
3285
3303
  if (!linuxSecretAvailable()) return false;
3286
3304
  try {
3287
- execSync2(
3305
+ execSync3(
3288
3306
  `echo -n "${value}" | secret-tool store --label="exe-os master key" service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3289
3307
  { timeout: 5e3 }
3290
3308
  );
@@ -3297,7 +3315,7 @@ function linuxSecretDelete(service = SERVICE) {
3297
3315
  if (!nativeKeychainAllowed()) return false;
3298
3316
  if (process.platform !== "linux") return false;
3299
3317
  try {
3300
- execSync2(
3318
+ execSync3(
3301
3319
  `secret-tool clear service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3302
3320
  { timeout: 5e3 }
3303
3321
  );
@@ -5536,7 +5554,7 @@ var init_agent_config = __esm({
5536
5554
  });
5537
5555
 
5538
5556
  // src/lib/session-key.ts
5539
- import { execSync as execSync4 } from "child_process";
5557
+ import { execSync as execSync5 } from "child_process";
5540
5558
  function normalizeCommand(command) {
5541
5559
  const trimmed = command.trim().toLowerCase();
5542
5560
  const parts = trimmed.split(/[\\/]/);
@@ -5555,7 +5573,7 @@ function resolveRuntimeProcess() {
5555
5573
  let pid = process.ppid;
5556
5574
  for (let i = 0; i < 10; i++) {
5557
5575
  try {
5558
- const info = execSync4(`ps -p ${pid} -o ppid=,comm=`, {
5576
+ const info = execSync5(`ps -p ${pid} -o ppid=,comm=`, {
5559
5577
  encoding: "utf8",
5560
5578
  timeout: 2e3
5561
5579
  }).trim();
@@ -5627,7 +5645,7 @@ __export(active_agent_exports, {
5627
5645
  writeActiveAgent: () => writeActiveAgent
5628
5646
  });
5629
5647
  import { readFileSync as readFileSync6, writeFileSync as writeFileSync5, mkdirSync as mkdirSync4, unlinkSync as unlinkSync4, readdirSync as readdirSync3 } from "fs";
5630
- import { execSync as execSync5 } from "child_process";
5648
+ import { execSync as execSync6 } from "child_process";
5631
5649
  import path10 from "path";
5632
5650
  function isNameWithOptionalInstance(candidate, baseName) {
5633
5651
  if (candidate === baseName) return true;
@@ -5721,7 +5739,7 @@ function getActiveAgent() {
5721
5739
  } catch {
5722
5740
  }
5723
5741
  try {
5724
- const sessionName = execSync5(
5742
+ const sessionName = execSync6(
5725
5743
  "tmux display-message -p '#{session_name}' 2>/dev/null",
5726
5744
  { encoding: "utf8", timeout: 2e3 }
5727
5745
  ).trim();
@@ -6136,7 +6154,7 @@ ${BASE_OPERATING_PROCEDURES}`;
6136
6154
  }
6137
6155
 
6138
6156
  // src/lib/cc-agent-support.ts
6139
- import { execSync as execSync3 } from "child_process";
6157
+ import { execSync as execSync4 } from "child_process";
6140
6158
  var _cachedSupport = null;
6141
6159
  function _resetCcAgentSupportCache() {
6142
6160
  _cachedSupport = null;
@@ -6144,7 +6162,7 @@ function _resetCcAgentSupportCache() {
6144
6162
  function claudeSupportsAgentFlag() {
6145
6163
  if (_cachedSupport !== null) return _cachedSupport;
6146
6164
  try {
6147
- const helpOutput = execSync3("claude --help 2>&1", {
6165
+ const helpOutput = execSync4("claude --help 2>&1", {
6148
6166
  encoding: "utf-8",
6149
6167
  timeout: 5e3
6150
6168
  });
@@ -6157,7 +6175,7 @@ function claudeSupportsAgentFlag() {
6157
6175
 
6158
6176
  // src/bin/exe-launch-agent.ts
6159
6177
  init_employees();
6160
- import { execSync as execSync6 } from "child_process";
6178
+ import { execSync as execSync7 } from "child_process";
6161
6179
 
6162
6180
  // src/lib/provider-table.ts
6163
6181
  var PROVIDER_TABLE = {
@@ -6314,7 +6332,7 @@ var _ccHelpOutput = null;
6314
6332
  function getCcHelpOutput() {
6315
6333
  if (_ccHelpOutput === null) {
6316
6334
  try {
6317
- const result = execSync6("claude --help 2>&1", { encoding: "utf8", timeout: 5e3 });
6335
+ const result = execSync7("claude --help 2>&1", { encoding: "utf8", timeout: 5e3 });
6318
6336
  _ccHelpOutput = typeof result === "string" ? result : "";
6319
6337
  } catch {
6320
6338
  _ccHelpOutput = "";
@@ -1002,7 +1002,7 @@ __export(exe_daemon_client_exports, {
1002
1002
  });
1003
1003
  import net from "net";
1004
1004
  import os4 from "os";
1005
- import { spawn } from "child_process";
1005
+ import { spawn, execSync as execSync2 } from "child_process";
1006
1006
  import { randomUUID } from "crypto";
1007
1007
  import { existsSync as existsSync5, unlinkSync as unlinkSync2, readFileSync as readFileSync4, openSync, closeSync, statSync } from "fs";
1008
1008
  import path5 from "path";
@@ -1032,6 +1032,14 @@ function handleData(chunk) {
1032
1032
  }
1033
1033
  }
1034
1034
  }
1035
+ function isZombie(pid) {
1036
+ try {
1037
+ const state = execSync2(`ps -p ${pid} -o state=`, { encoding: "utf8", timeout: 2e3 }).trim();
1038
+ return state.startsWith("Z");
1039
+ } catch {
1040
+ return false;
1041
+ }
1042
+ }
1035
1043
  function cleanupStaleFiles() {
1036
1044
  if (existsSync5(PID_PATH)) {
1037
1045
  try {
@@ -1039,7 +1047,11 @@ function cleanupStaleFiles() {
1039
1047
  if (pid > 0) {
1040
1048
  try {
1041
1049
  process.kill(pid, 0);
1042
- return;
1050
+ if (!isZombie(pid)) {
1051
+ return;
1052
+ }
1053
+ process.stderr.write(`[exed-client] PID ${pid} is a zombie \u2014 cleaning up stale files
1054
+ `);
1043
1055
  } catch {
1044
1056
  }
1045
1057
  }
@@ -1067,8 +1079,8 @@ function findPackageRoot() {
1067
1079
  function getAvailableMemoryGB() {
1068
1080
  if (process.platform === "darwin") {
1069
1081
  try {
1070
- const { execSync: execSync5 } = __require("child_process");
1071
- const vmstat = execSync5("vm_stat", { encoding: "utf8" });
1082
+ const { execSync: execSync6 } = __require("child_process");
1083
+ const vmstat = execSync6("vm_stat", { encoding: "utf8" });
1072
1084
  const pageSize = 16384;
1073
1085
  const pageSizeMatch = vmstat.match(/page size of (\d+) bytes/);
1074
1086
  const actualPageSize = pageSizeMatch ? parseInt(pageSizeMatch[1], 10) : pageSize;
@@ -3058,6 +3070,12 @@ async function disposeDatabase() {
3058
3070
  clearInterval(_walCheckpointTimer);
3059
3071
  _walCheckpointTimer = null;
3060
3072
  }
3073
+ if (_client) {
3074
+ try {
3075
+ await _client.execute("PRAGMA wal_checkpoint(PASSIVE)");
3076
+ } catch {
3077
+ }
3078
+ }
3061
3079
  if (_daemonClient) {
3062
3080
  _daemonClient.close();
3063
3081
  _daemonClient = null;
@@ -3103,7 +3121,7 @@ var init_session_registry = __esm({
3103
3121
  });
3104
3122
 
3105
3123
  // src/lib/session-key.ts
3106
- import { execSync as execSync2 } from "child_process";
3124
+ import { execSync as execSync3 } from "child_process";
3107
3125
  function normalizeCommand(command) {
3108
3126
  const trimmed = command.trim().toLowerCase();
3109
3127
  const parts = trimmed.split(/[\\/]/);
@@ -3122,7 +3140,7 @@ function resolveRuntimeProcess() {
3122
3140
  let pid = process.ppid;
3123
3141
  for (let i = 0; i < 10; i++) {
3124
3142
  try {
3125
- const info = execSync2(`ps -p ${pid} -o ppid=,comm=`, {
3143
+ const info = execSync3(`ps -p ${pid} -o ppid=,comm=`, {
3126
3144
  encoding: "utf8",
3127
3145
  timeout: 2e3
3128
3146
  }).trim();
@@ -3288,7 +3306,7 @@ var init_transport = __esm({
3288
3306
  });
3289
3307
 
3290
3308
  // src/lib/cc-agent-support.ts
3291
- import { execSync as execSync3 } from "child_process";
3309
+ import { execSync as execSync4 } from "child_process";
3292
3310
  var init_cc_agent_support = __esm({
3293
3311
  "src/lib/cc-agent-support.ts"() {
3294
3312
  "use strict";
@@ -3521,7 +3539,7 @@ var init_task_scope = __esm({
3521
3539
  // src/lib/keychain.ts
3522
3540
  import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2 } from "fs/promises";
3523
3541
  import { existsSync as existsSync12, statSync as statSync2 } from "fs";
3524
- import { execSync as execSync4 } from "child_process";
3542
+ import { execSync as execSync5 } from "child_process";
3525
3543
  import path13 from "path";
3526
3544
  import os10 from "os";
3527
3545
  function getKeyDir() {
@@ -3538,13 +3556,13 @@ function linuxSecretAvailable() {
3538
3556
  if (process.platform !== "linux") return false;
3539
3557
  if (linuxSecretAvailability !== null) return linuxSecretAvailability;
3540
3558
  try {
3541
- execSync4("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
3559
+ execSync5("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
3542
3560
  } catch {
3543
3561
  linuxSecretAvailability = false;
3544
3562
  return false;
3545
3563
  }
3546
3564
  try {
3547
- execSync4("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
3565
+ execSync5("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
3548
3566
  linuxSecretAvailability = true;
3549
3567
  } catch {
3550
3568
  linuxSecretAvailability = false;
@@ -3568,7 +3586,7 @@ function macKeychainGet(service = SERVICE) {
3568
3586
  if (!nativeKeychainAllowed()) return null;
3569
3587
  if (process.platform !== "darwin") return null;
3570
3588
  try {
3571
- return execSync4(
3589
+ return execSync5(
3572
3590
  `security find-generic-password -s "${service}" -a "${ACCOUNT}" -w 2>/dev/null`,
3573
3591
  { encoding: "utf-8", timeout: 5e3 }
3574
3592
  ).trim();
@@ -3581,13 +3599,13 @@ function macKeychainSet(value, service = SERVICE) {
3581
3599
  if (process.platform !== "darwin") return false;
3582
3600
  try {
3583
3601
  try {
3584
- execSync4(
3602
+ execSync5(
3585
3603
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
3586
3604
  { timeout: 5e3 }
3587
3605
  );
3588
3606
  } catch {
3589
3607
  }
3590
- execSync4(
3608
+ execSync5(
3591
3609
  `security add-generic-password -s "${service}" -a "${ACCOUNT}" -w "${value}"`,
3592
3610
  { timeout: 5e3 }
3593
3611
  );
@@ -3600,7 +3618,7 @@ function macKeychainDelete(service = SERVICE) {
3600
3618
  if (!nativeKeychainAllowed()) return false;
3601
3619
  if (process.platform !== "darwin") return false;
3602
3620
  try {
3603
- execSync4(
3621
+ execSync5(
3604
3622
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
3605
3623
  { timeout: 5e3 }
3606
3624
  );
@@ -3612,7 +3630,7 @@ function macKeychainDelete(service = SERVICE) {
3612
3630
  function linuxSecretGet(service = SERVICE) {
3613
3631
  if (!linuxSecretAvailable()) return null;
3614
3632
  try {
3615
- return execSync4(
3633
+ return execSync5(
3616
3634
  `secret-tool lookup service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3617
3635
  { encoding: "utf-8", timeout: 5e3 }
3618
3636
  ).trim();
@@ -3623,7 +3641,7 @@ function linuxSecretGet(service = SERVICE) {
3623
3641
  function linuxSecretSet(value, service = SERVICE) {
3624
3642
  if (!linuxSecretAvailable()) return false;
3625
3643
  try {
3626
- execSync4(
3644
+ execSync5(
3627
3645
  `echo -n "${value}" | secret-tool store --label="exe-os master key" service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3628
3646
  { timeout: 5e3 }
3629
3647
  );
@@ -3636,7 +3654,7 @@ function linuxSecretDelete(service = SERVICE) {
3636
3654
  if (!nativeKeychainAllowed()) return false;
3637
3655
  if (process.platform !== "linux") return false;
3638
3656
  try {
3639
- execSync4(
3657
+ execSync5(
3640
3658
  `secret-tool clear service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3641
3659
  { timeout: 5e3 }
3642
3660
  );
@@ -1003,7 +1003,7 @@ __export(exe_daemon_client_exports, {
1003
1003
  });
1004
1004
  import net from "net";
1005
1005
  import os4 from "os";
1006
- import { spawn } from "child_process";
1006
+ import { spawn, execSync as execSync2 } from "child_process";
1007
1007
  import { randomUUID } from "crypto";
1008
1008
  import { existsSync as existsSync5, unlinkSync as unlinkSync2, readFileSync as readFileSync4, openSync, closeSync, statSync } from "fs";
1009
1009
  import path5 from "path";
@@ -1033,6 +1033,14 @@ function handleData(chunk) {
1033
1033
  }
1034
1034
  }
1035
1035
  }
1036
+ function isZombie(pid) {
1037
+ try {
1038
+ const state = execSync2(`ps -p ${pid} -o state=`, { encoding: "utf8", timeout: 2e3 }).trim();
1039
+ return state.startsWith("Z");
1040
+ } catch {
1041
+ return false;
1042
+ }
1043
+ }
1036
1044
  function cleanupStaleFiles() {
1037
1045
  if (existsSync5(PID_PATH)) {
1038
1046
  try {
@@ -1040,7 +1048,11 @@ function cleanupStaleFiles() {
1040
1048
  if (pid > 0) {
1041
1049
  try {
1042
1050
  process.kill(pid, 0);
1043
- return;
1051
+ if (!isZombie(pid)) {
1052
+ return;
1053
+ }
1054
+ process.stderr.write(`[exed-client] PID ${pid} is a zombie \u2014 cleaning up stale files
1055
+ `);
1044
1056
  } catch {
1045
1057
  }
1046
1058
  }
@@ -1068,8 +1080,8 @@ function findPackageRoot() {
1068
1080
  function getAvailableMemoryGB() {
1069
1081
  if (process.platform === "darwin") {
1070
1082
  try {
1071
- const { execSync: execSync5 } = __require("child_process");
1072
- const vmstat = execSync5("vm_stat", { encoding: "utf8" });
1083
+ const { execSync: execSync6 } = __require("child_process");
1084
+ const vmstat = execSync6("vm_stat", { encoding: "utf8" });
1073
1085
  const pageSize = 16384;
1074
1086
  const pageSizeMatch = vmstat.match(/page size of (\d+) bytes/);
1075
1087
  const actualPageSize = pageSizeMatch ? parseInt(pageSizeMatch[1], 10) : pageSize;
@@ -3059,6 +3071,12 @@ async function disposeDatabase() {
3059
3071
  clearInterval(_walCheckpointTimer);
3060
3072
  _walCheckpointTimer = null;
3061
3073
  }
3074
+ if (_client) {
3075
+ try {
3076
+ await _client.execute("PRAGMA wal_checkpoint(PASSIVE)");
3077
+ } catch {
3078
+ }
3079
+ }
3062
3080
  if (_daemonClient) {
3063
3081
  _daemonClient.close();
3064
3082
  _daemonClient = null;
@@ -3104,7 +3122,7 @@ var init_session_registry = __esm({
3104
3122
  });
3105
3123
 
3106
3124
  // src/lib/session-key.ts
3107
- import { execSync as execSync2 } from "child_process";
3125
+ import { execSync as execSync3 } from "child_process";
3108
3126
  function normalizeCommand(command) {
3109
3127
  const trimmed = command.trim().toLowerCase();
3110
3128
  const parts = trimmed.split(/[\\/]/);
@@ -3123,7 +3141,7 @@ function resolveRuntimeProcess() {
3123
3141
  let pid = process.ppid;
3124
3142
  for (let i = 0; i < 10; i++) {
3125
3143
  try {
3126
- const info = execSync2(`ps -p ${pid} -o ppid=,comm=`, {
3144
+ const info = execSync3(`ps -p ${pid} -o ppid=,comm=`, {
3127
3145
  encoding: "utf8",
3128
3146
  timeout: 2e3
3129
3147
  }).trim();
@@ -3289,7 +3307,7 @@ var init_transport = __esm({
3289
3307
  });
3290
3308
 
3291
3309
  // src/lib/cc-agent-support.ts
3292
- import { execSync as execSync3 } from "child_process";
3310
+ import { execSync as execSync4 } from "child_process";
3293
3311
  var init_cc_agent_support = __esm({
3294
3312
  "src/lib/cc-agent-support.ts"() {
3295
3313
  "use strict";
@@ -3587,7 +3605,7 @@ var init_notifications = __esm({
3587
3605
  // src/lib/keychain.ts
3588
3606
  import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2 } from "fs/promises";
3589
3607
  import { existsSync as existsSync13, statSync as statSync2 } from "fs";
3590
- import { execSync as execSync4 } from "child_process";
3608
+ import { execSync as execSync5 } from "child_process";
3591
3609
  import path14 from "path";
3592
3610
  import os11 from "os";
3593
3611
  function getKeyDir() {
@@ -3604,13 +3622,13 @@ function linuxSecretAvailable() {
3604
3622
  if (process.platform !== "linux") return false;
3605
3623
  if (linuxSecretAvailability !== null) return linuxSecretAvailability;
3606
3624
  try {
3607
- execSync4("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
3625
+ execSync5("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
3608
3626
  } catch {
3609
3627
  linuxSecretAvailability = false;
3610
3628
  return false;
3611
3629
  }
3612
3630
  try {
3613
- execSync4("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
3631
+ execSync5("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
3614
3632
  linuxSecretAvailability = true;
3615
3633
  } catch {
3616
3634
  linuxSecretAvailability = false;
@@ -3634,7 +3652,7 @@ function macKeychainGet(service = SERVICE) {
3634
3652
  if (!nativeKeychainAllowed()) return null;
3635
3653
  if (process.platform !== "darwin") return null;
3636
3654
  try {
3637
- return execSync4(
3655
+ return execSync5(
3638
3656
  `security find-generic-password -s "${service}" -a "${ACCOUNT}" -w 2>/dev/null`,
3639
3657
  { encoding: "utf-8", timeout: 5e3 }
3640
3658
  ).trim();
@@ -3647,13 +3665,13 @@ function macKeychainSet(value, service = SERVICE) {
3647
3665
  if (process.platform !== "darwin") return false;
3648
3666
  try {
3649
3667
  try {
3650
- execSync4(
3668
+ execSync5(
3651
3669
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
3652
3670
  { timeout: 5e3 }
3653
3671
  );
3654
3672
  } catch {
3655
3673
  }
3656
- execSync4(
3674
+ execSync5(
3657
3675
  `security add-generic-password -s "${service}" -a "${ACCOUNT}" -w "${value}"`,
3658
3676
  { timeout: 5e3 }
3659
3677
  );
@@ -3666,7 +3684,7 @@ function macKeychainDelete(service = SERVICE) {
3666
3684
  if (!nativeKeychainAllowed()) return false;
3667
3685
  if (process.platform !== "darwin") return false;
3668
3686
  try {
3669
- execSync4(
3687
+ execSync5(
3670
3688
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
3671
3689
  { timeout: 5e3 }
3672
3690
  );
@@ -3678,7 +3696,7 @@ function macKeychainDelete(service = SERVICE) {
3678
3696
  function linuxSecretGet(service = SERVICE) {
3679
3697
  if (!linuxSecretAvailable()) return null;
3680
3698
  try {
3681
- return execSync4(
3699
+ return execSync5(
3682
3700
  `secret-tool lookup service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3683
3701
  { encoding: "utf-8", timeout: 5e3 }
3684
3702
  ).trim();
@@ -3689,7 +3707,7 @@ function linuxSecretGet(service = SERVICE) {
3689
3707
  function linuxSecretSet(value, service = SERVICE) {
3690
3708
  if (!linuxSecretAvailable()) return false;
3691
3709
  try {
3692
- execSync4(
3710
+ execSync5(
3693
3711
  `echo -n "${value}" | secret-tool store --label="exe-os master key" service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3694
3712
  { timeout: 5e3 }
3695
3713
  );
@@ -3702,7 +3720,7 @@ function linuxSecretDelete(service = SERVICE) {
3702
3720
  if (!nativeKeychainAllowed()) return false;
3703
3721
  if (process.platform !== "linux") return false;
3704
3722
  try {
3705
- execSync4(
3723
+ execSync5(
3706
3724
  `secret-tool clear service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3707
3725
  { timeout: 5e3 }
3708
3726
  );