@askexenow/exe-os 0.9.85 → 0.9.87

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 (86) hide show
  1. package/dist/bin/agentic-ontology-backfill.js +50 -14
  2. package/dist/bin/agentic-reflection-backfill.js +50 -14
  3. package/dist/bin/agentic-semantic-label.js +50 -14
  4. package/dist/bin/backfill-conversations.js +50 -14
  5. package/dist/bin/backfill-responses.js +50 -14
  6. package/dist/bin/backfill-vectors.js +50 -14
  7. package/dist/bin/bulk-sync-postgres.js +50 -14
  8. package/dist/bin/cleanup-stale-review-tasks.js +53 -17
  9. package/dist/bin/cli.js +339 -81
  10. package/dist/bin/exe-agent.js +18 -0
  11. package/dist/bin/exe-assign.js +50 -14
  12. package/dist/bin/exe-boot.js +75 -39
  13. package/dist/bin/exe-call.js +18 -0
  14. package/dist/bin/exe-cloud.js +40 -4
  15. package/dist/bin/exe-dispatch.js +61 -25
  16. package/dist/bin/exe-doctor.js +40 -4
  17. package/dist/bin/exe-export-behaviors.js +50 -14
  18. package/dist/bin/exe-forget.js +50 -14
  19. package/dist/bin/exe-gateway.js +65 -29
  20. package/dist/bin/exe-heartbeat.js +55 -19
  21. package/dist/bin/exe-kill.js +54 -18
  22. package/dist/bin/exe-launch-agent.js +58 -22
  23. package/dist/bin/exe-new-employee.js +33 -2
  24. package/dist/bin/exe-pending-messages.js +53 -17
  25. package/dist/bin/exe-pending-notifications.js +53 -17
  26. package/dist/bin/exe-pending-reviews.js +55 -19
  27. package/dist/bin/exe-rename.js +52 -16
  28. package/dist/bin/exe-review.js +50 -14
  29. package/dist/bin/exe-search.js +58 -22
  30. package/dist/bin/exe-session-cleanup.js +85 -44
  31. package/dist/bin/exe-start-codex.js +57 -21
  32. package/dist/bin/exe-start-opencode.js +55 -19
  33. package/dist/bin/exe-status.js +62 -26
  34. package/dist/bin/exe-team.js +50 -14
  35. package/dist/bin/git-sweep.js +63 -27
  36. package/dist/bin/graph-backfill.js +50 -14
  37. package/dist/bin/graph-export.js +50 -14
  38. package/dist/bin/install.js +9 -0
  39. package/dist/bin/intercom-check.js +67 -31
  40. package/dist/bin/scan-tasks.js +63 -27
  41. package/dist/bin/setup.js +53 -13
  42. package/dist/bin/shard-migrate.js +50 -14
  43. package/dist/bin/stack-update.js +59 -2
  44. package/dist/bin/update.js +1 -1
  45. package/dist/gateway/index.js +65 -29
  46. package/dist/hooks/bug-report-worker.js +65 -29
  47. package/dist/hooks/codex-stop-task-finalizer.js +59 -23
  48. package/dist/hooks/commit-complete.js +64 -28
  49. package/dist/hooks/error-recall.js +62 -26
  50. package/dist/hooks/ingest-worker.js +4 -4
  51. package/dist/hooks/ingest.js +56 -20
  52. package/dist/hooks/instructions-loaded.js +50 -14
  53. package/dist/hooks/notification.js +50 -14
  54. package/dist/hooks/post-compact.js +50 -14
  55. package/dist/hooks/post-tool-combined.js +63 -27
  56. package/dist/hooks/pre-compact.js +61 -25
  57. package/dist/hooks/pre-tool-use.js +58 -22
  58. package/dist/hooks/prompt-submit.js +78 -42
  59. package/dist/hooks/session-end.js +66 -30
  60. package/dist/hooks/session-start.js +68 -32
  61. package/dist/hooks/stop.js +53 -17
  62. package/dist/hooks/subagent-stop.js +50 -14
  63. package/dist/hooks/summary-worker.js +55 -19
  64. package/dist/index.js +61 -25
  65. package/dist/lib/cloud-sync.js +32 -14
  66. package/dist/lib/database.js +22 -4
  67. package/dist/lib/db-daemon-client.js +16 -4
  68. package/dist/lib/db.js +22 -4
  69. package/dist/lib/device-registry.js +22 -4
  70. package/dist/lib/embedder.js +16 -4
  71. package/dist/lib/employee-templates.js +18 -0
  72. package/dist/lib/exe-daemon-client.js +16 -4
  73. package/dist/lib/exe-daemon.js +874 -232
  74. package/dist/lib/hybrid-search.js +58 -22
  75. package/dist/lib/identity-templates.js +6 -2
  76. package/dist/lib/schedules.js +53 -17
  77. package/dist/lib/skill-learning.js +16 -4
  78. package/dist/lib/store.js +50 -14
  79. package/dist/lib/tasks.js +16 -4
  80. package/dist/lib/tmux-routing.js +18 -6
  81. package/dist/mcp/server.js +809 -200
  82. package/dist/mcp/tools/create-task.js +24 -8
  83. package/dist/mcp/tools/update-task.js +18 -6
  84. package/dist/runtime/index.js +61 -25
  85. package/dist/tui/App.js +91 -55
  86. package/package.json +1 -1
@@ -1048,7 +1048,7 @@ var init_daemon_auth = __esm({
1048
1048
  // src/lib/exe-daemon-client.ts
1049
1049
  import net from "net";
1050
1050
  import os4 from "os";
1051
- import { spawn } from "child_process";
1051
+ import { spawn, execSync as execSync2 } from "child_process";
1052
1052
  import { randomUUID } from "crypto";
1053
1053
  import { existsSync as existsSync5, unlinkSync as unlinkSync2, readFileSync as readFileSync4, openSync, closeSync, statSync } from "fs";
1054
1054
  import path5 from "path";
@@ -1078,6 +1078,14 @@ function handleData(chunk) {
1078
1078
  }
1079
1079
  }
1080
1080
  }
1081
+ function isZombie(pid) {
1082
+ try {
1083
+ const state = execSync2(`ps -p ${pid} -o state=`, { encoding: "utf8", timeout: 2e3 }).trim();
1084
+ return state.startsWith("Z");
1085
+ } catch {
1086
+ return false;
1087
+ }
1088
+ }
1081
1089
  function cleanupStaleFiles() {
1082
1090
  if (existsSync5(PID_PATH)) {
1083
1091
  try {
@@ -1085,7 +1093,11 @@ function cleanupStaleFiles() {
1085
1093
  if (pid > 0) {
1086
1094
  try {
1087
1095
  process.kill(pid, 0);
1088
- return;
1096
+ if (!isZombie(pid)) {
1097
+ return;
1098
+ }
1099
+ process.stderr.write(`[exed-client] PID ${pid} is a zombie \u2014 cleaning up stale files
1100
+ `);
1089
1101
  } catch {
1090
1102
  }
1091
1103
  }
@@ -1113,8 +1125,8 @@ function findPackageRoot() {
1113
1125
  function getAvailableMemoryGB() {
1114
1126
  if (process.platform === "darwin") {
1115
1127
  try {
1116
- const { execSync: execSync7 } = __require("child_process");
1117
- const vmstat = execSync7("vm_stat", { encoding: "utf8" });
1128
+ const { execSync: execSync8 } = __require("child_process");
1129
+ const vmstat = execSync8("vm_stat", { encoding: "utf8" });
1118
1130
  const pageSize = 16384;
1119
1131
  const pageSizeMatch = vmstat.match(/page size of (\d+) bytes/);
1120
1132
  const actualPageSize = pageSizeMatch ? parseInt(pageSizeMatch[1], 10) : pageSize;
@@ -3049,6 +3061,12 @@ async function disposeDatabase() {
3049
3061
  clearInterval(_walCheckpointTimer);
3050
3062
  _walCheckpointTimer = null;
3051
3063
  }
3064
+ if (_client) {
3065
+ try {
3066
+ await _client.execute("PRAGMA wal_checkpoint(PASSIVE)");
3067
+ } catch {
3068
+ }
3069
+ }
3052
3070
  if (_daemonClient) {
3053
3071
  _daemonClient.close();
3054
3072
  _daemonClient = null;
@@ -3085,7 +3103,7 @@ var init_database = __esm({
3085
3103
  // src/lib/keychain.ts
3086
3104
  import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2 } from "fs/promises";
3087
3105
  import { existsSync as existsSync6, statSync as statSync2 } from "fs";
3088
- import { execSync as execSync2 } from "child_process";
3106
+ import { execSync as execSync3 } from "child_process";
3089
3107
  import path6 from "path";
3090
3108
  import os5 from "os";
3091
3109
  function getKeyDir() {
@@ -3102,13 +3120,13 @@ function linuxSecretAvailable() {
3102
3120
  if (process.platform !== "linux") return false;
3103
3121
  if (linuxSecretAvailability !== null) return linuxSecretAvailability;
3104
3122
  try {
3105
- execSync2("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
3123
+ execSync3("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
3106
3124
  } catch {
3107
3125
  linuxSecretAvailability = false;
3108
3126
  return false;
3109
3127
  }
3110
3128
  try {
3111
- execSync2("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
3129
+ execSync3("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
3112
3130
  linuxSecretAvailability = true;
3113
3131
  } catch {
3114
3132
  linuxSecretAvailability = false;
@@ -3132,7 +3150,7 @@ function macKeychainGet(service = SERVICE) {
3132
3150
  if (!nativeKeychainAllowed()) return null;
3133
3151
  if (process.platform !== "darwin") return null;
3134
3152
  try {
3135
- return execSync2(
3153
+ return execSync3(
3136
3154
  `security find-generic-password -s "${service}" -a "${ACCOUNT}" -w 2>/dev/null`,
3137
3155
  { encoding: "utf-8", timeout: 5e3 }
3138
3156
  ).trim();
@@ -3145,13 +3163,13 @@ function macKeychainSet(value, service = SERVICE) {
3145
3163
  if (process.platform !== "darwin") return false;
3146
3164
  try {
3147
3165
  try {
3148
- execSync2(
3166
+ execSync3(
3149
3167
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
3150
3168
  { timeout: 5e3 }
3151
3169
  );
3152
3170
  } catch {
3153
3171
  }
3154
- execSync2(
3172
+ execSync3(
3155
3173
  `security add-generic-password -s "${service}" -a "${ACCOUNT}" -w "${value}"`,
3156
3174
  { timeout: 5e3 }
3157
3175
  );
@@ -3164,7 +3182,7 @@ function macKeychainDelete(service = SERVICE) {
3164
3182
  if (!nativeKeychainAllowed()) return false;
3165
3183
  if (process.platform !== "darwin") return false;
3166
3184
  try {
3167
- execSync2(
3185
+ execSync3(
3168
3186
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
3169
3187
  { timeout: 5e3 }
3170
3188
  );
@@ -3176,7 +3194,7 @@ function macKeychainDelete(service = SERVICE) {
3176
3194
  function linuxSecretGet(service = SERVICE) {
3177
3195
  if (!linuxSecretAvailable()) return null;
3178
3196
  try {
3179
- return execSync2(
3197
+ return execSync3(
3180
3198
  `secret-tool lookup service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3181
3199
  { encoding: "utf-8", timeout: 5e3 }
3182
3200
  ).trim();
@@ -3187,7 +3205,7 @@ function linuxSecretGet(service = SERVICE) {
3187
3205
  function linuxSecretSet(value, service = SERVICE) {
3188
3206
  if (!linuxSecretAvailable()) return false;
3189
3207
  try {
3190
- execSync2(
3208
+ execSync3(
3191
3209
  `echo -n "${value}" | secret-tool store --label="exe-os master key" service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3192
3210
  { timeout: 5e3 }
3193
3211
  );
@@ -3200,7 +3218,7 @@ function linuxSecretDelete(service = SERVICE) {
3200
3218
  if (!nativeKeychainAllowed()) return false;
3201
3219
  if (process.platform !== "linux") return false;
3202
3220
  try {
3203
- execSync2(
3221
+ execSync3(
3204
3222
  `secret-tool clear service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3205
3223
  { timeout: 5e3 }
3206
3224
  );
@@ -4137,6 +4155,24 @@ var init_platform_procedures = __esm({
4137
4155
  priority: "p0",
4138
4156
  content: "When an agent encounters a suspected Exe OS bug, update breakage, MCP/tool failure, installer issue, memory/orchestration defect, or customer-local patch need, it MUST use create_bug_report. Do this before or alongside any local workaround so the report reaches AskExe support directly via the customer's license. Do NOT ask the founder for permission to file a required bug report. If create_bug_report is deferred/lazy-loaded, load it and call it. If it is unavailable in the live MCP surface, report 'create_bug_report unavailable in this session' and save a local report in exe/output \u2014 never claim the tool does not exist unless the live MCP surface was checked. If upstream delivery fails, call support_test (MCP) and include its result in the local report so AskExe can distinguish customer setup, license provisioning, and server intake issues; only ask the founder to run `exe-os support test` if MCP is disconnected/unavailable. Classify first: upstream_bug = reproducible exe-os/platform defect; customer_customization = identity, behavior, procedure, config, branding, workflow preference that belongs in customer-owned layers; emergency_hotfix = temporary local patch. For upstream bugs/emergency hotfixes include version, repro steps, expected/actual, files changed, workaround, and local diff summary. Avoid permanent platform-code patches unless founder approves; if a hotfix is unavoidable, document it in the bug report and re-check after npm update."
4139
4157
  },
4158
+ {
4159
+ title: "Bug report status check \u2014 surface available fixes on boot",
4160
+ domain: "support",
4161
+ priority: "p1",
4162
+ content: "Once per session (COO boot only, never repeat), call list_my_bug_reports to check if any previously filed bug reports have been fixed by AskExe. If any report has status 'fixed' with a fixed_version, surface it to the founder immediately: '\u{1F527} N bug fix(es) available \u2014 run exe-os update to get version X.Y.Z'. This is a one-time check at boot, not a recurring poll. If no reports exist or none are fixed, skip silently. If the MCP tool is unavailable or the network call fails, skip silently \u2014 this is informational, not blocking."
4163
+ },
4164
+ {
4165
+ title: "Feature request triage \u2014 upstream feature vs local customization",
4166
+ domain: "support",
4167
+ priority: "p0",
4168
+ content: "When an agent or founder identifies a desired capability that exe-os does not yet provide, the COO (or equivalent coordinator) must decide: is this a local customization (identity, behavior, procedure, config, branding, workflow preference that can be configured in customer-owned layers) or an upstream feature request (a platform capability that requires changes to exe-os code, shipped via npm update)? Local customizations: implement immediately using store_behavior, update_identity, company_procedure, or config changes. Upstream features: use create_feature_request to submit to AskExe. Include use case, business impact, and current workaround. Do NOT ask the founder for permission to file a feature request \u2014 file it proactively when the need is clear."
4169
+ },
4170
+ {
4171
+ title: "Feature request status check \u2014 surface shipped features on boot",
4172
+ domain: "support",
4173
+ priority: "p1",
4174
+ content: "Once per session (COO boot only, never repeat), call list_my_feature_requests to check if any previously filed feature requests have been shipped by AskExe. If any request has status 'shipped' with a shipped_version, surface it to the founder immediately: '\u{1F680} N feature(s) shipped \u2014 run exe-os update to get version X.Y.Z'. This is a one-time check at boot, not a recurring poll. If no requests exist or none are shipped, skip silently. If the MCP tool is unavailable or the network call fails, skip silently \u2014 this is informational, not blocking."
4175
+ },
4140
4176
  // --- Operations ---
4141
4177
  {
4142
4178
  title: "Managers must supervise deployed workers",
@@ -5668,7 +5704,7 @@ __export(project_name_exports, {
5668
5704
  _resetCache: () => _resetCache,
5669
5705
  getProjectName: () => getProjectName
5670
5706
  });
5671
- import { execSync as execSync3 } from "child_process";
5707
+ import { execSync as execSync4 } from "child_process";
5672
5708
  import path9 from "path";
5673
5709
  function getProjectName(cwd) {
5674
5710
  const dir = cwd ?? process.cwd();
@@ -5676,7 +5712,7 @@ function getProjectName(cwd) {
5676
5712
  try {
5677
5713
  let repoRoot;
5678
5714
  try {
5679
- const gitCommonDir = execSync3("git rev-parse --path-format=absolute --git-common-dir", {
5715
+ const gitCommonDir = execSync4("git rev-parse --path-format=absolute --git-common-dir", {
5680
5716
  cwd: dir,
5681
5717
  encoding: "utf8",
5682
5718
  timeout: 2e3,
@@ -5684,7 +5720,7 @@ function getProjectName(cwd) {
5684
5720
  }).trim();
5685
5721
  repoRoot = path9.dirname(gitCommonDir);
5686
5722
  } catch {
5687
- repoRoot = execSync3("git rev-parse --show-toplevel", {
5723
+ repoRoot = execSync4("git rev-parse --show-toplevel", {
5688
5724
  cwd: dir,
5689
5725
  encoding: "utf8",
5690
5726
  timeout: 2e3,
@@ -5718,14 +5754,14 @@ var file_grep_exports = {};
5718
5754
  __export(file_grep_exports, {
5719
5755
  grepProjectFiles: () => grepProjectFiles
5720
5756
  });
5721
- import { execSync as execSync4 } from "child_process";
5757
+ import { execSync as execSync5 } from "child_process";
5722
5758
  import { readFileSync as readFileSync5, readdirSync as readdirSync2, statSync as statSync4, existsSync as existsSync9 } from "fs";
5723
5759
  import path10 from "path";
5724
5760
  import crypto3 from "crypto";
5725
5761
  function hasRipgrep() {
5726
5762
  if (_hasRg === null) {
5727
5763
  try {
5728
- execSync4("rg --version", { stdio: "ignore", timeout: 2e3 });
5764
+ execSync5("rg --version", { stdio: "ignore", timeout: 2e3 });
5729
5765
  _hasRg = true;
5730
5766
  } catch {
5731
5767
  _hasRg = false;
@@ -5791,7 +5827,7 @@ function grepWithRipgrep(pattern, projectRoot, patterns) {
5791
5827
  const globs = (patterns ?? DEFAULT_PATTERNS).map((p) => `--glob '${p}'`).join(" ");
5792
5828
  const excludes = EXCLUDE_DIRS.map((d) => `--glob '!${d}'`).join(" ");
5793
5829
  const cmd = `rg -i -c --hidden --no-config --no-ignore '${pattern.replace(/'/g, "\\'")}' . ${globs} ${excludes} --max-filesize ${MAX_FILE_SIZE} 2>/dev/null || true`;
5794
- const output = execSync4(cmd, {
5830
+ const output = execSync5(cmd, {
5795
5831
  cwd: projectRoot,
5796
5832
  encoding: "utf8",
5797
5833
  timeout: 3e3,
@@ -5806,12 +5842,12 @@ function grepWithRipgrep(pattern, projectRoot, patterns) {
5806
5842
  const matchCount = parseInt(line.slice(colonIdx + 1));
5807
5843
  if (isNaN(matchCount) || matchCount === 0) continue;
5808
5844
  try {
5809
- const firstMatch = execSync4(
5845
+ const firstMatch = execSync5(
5810
5846
  `rg -i -n --hidden '${pattern.replace(/'/g, "\\'")}' '${filePath}' --max-count 1 2>/dev/null | head -1`,
5811
5847
  { cwd: projectRoot, encoding: "utf8", timeout: 1e3 }
5812
5848
  ).trim();
5813
5849
  const lineNum = parseInt(firstMatch.split(":")[0] ?? "1");
5814
- const totalLines = execSync4(`wc -l < '${filePath}'`, {
5850
+ const totalLines = execSync5(`wc -l < '${filePath}'`, {
5815
5851
  cwd: projectRoot,
5816
5852
  encoding: "utf8",
5817
5853
  timeout: 1e3
@@ -7259,11 +7295,11 @@ init_database();
7259
7295
  // src/lib/active-agent.ts
7260
7296
  init_config();
7261
7297
  import { readFileSync as readFileSync6, writeFileSync as writeFileSync3, mkdirSync as mkdirSync3, unlinkSync as unlinkSync3, readdirSync as readdirSync3 } from "fs";
7262
- import { execSync as execSync6 } from "child_process";
7298
+ import { execSync as execSync7 } from "child_process";
7263
7299
  import path11 from "path";
7264
7300
 
7265
7301
  // src/lib/session-key.ts
7266
- import { execSync as execSync5 } from "child_process";
7302
+ import { execSync as execSync6 } from "child_process";
7267
7303
  var _cached2 = null;
7268
7304
  var _cachedRuntime = null;
7269
7305
  var RUNTIME_COMMANDS = {
@@ -7289,7 +7325,7 @@ function resolveRuntimeProcess() {
7289
7325
  let pid = process.ppid;
7290
7326
  for (let i = 0; i < 10; i++) {
7291
7327
  try {
7292
- const info = execSync5(`ps -p ${pid} -o ppid=,comm=`, {
7328
+ const info = execSync6(`ps -p ${pid} -o ppid=,comm=`, {
7293
7329
  encoding: "utf8",
7294
7330
  timeout: 2e3
7295
7331
  }).trim();
@@ -7411,7 +7447,7 @@ function getActiveAgent() {
7411
7447
  } catch {
7412
7448
  }
7413
7449
  try {
7414
- const sessionName = execSync6(
7450
+ const sessionName = execSync7(
7415
7451
  "tmux display-message -p '#{session_name}' 2>/dev/null",
7416
7452
  { encoding: "utf8", timeout: 2e3 }
7417
7453
  ).trim();
@@ -8,7 +8,7 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
8
8
  // src/lib/exe-daemon-client.ts
9
9
  import net from "net";
10
10
  import os2 from "os";
11
- import { spawn } from "child_process";
11
+ import { spawn, execSync } from "child_process";
12
12
  import { randomUUID } from "crypto";
13
13
  import { existsSync as existsSync4, unlinkSync, readFileSync as readFileSync3, openSync, closeSync, statSync } from "fs";
14
14
  import path3 from "path";
@@ -497,7 +497,7 @@ function detectError(data) {
497
497
  }
498
498
 
499
499
  // src/lib/project-name.ts
500
- import { execSync } from "child_process";
500
+ import { execSync as execSync2 } from "child_process";
501
501
  import path5 from "path";
502
502
  var _cached = null;
503
503
  var _cachedCwd = null;
@@ -507,7 +507,7 @@ function getProjectName(cwd) {
507
507
  try {
508
508
  let repoRoot;
509
509
  try {
510
- const gitCommonDir = execSync("git rev-parse --path-format=absolute --git-common-dir", {
510
+ const gitCommonDir = execSync2("git rev-parse --path-format=absolute --git-common-dir", {
511
511
  cwd: dir,
512
512
  encoding: "utf8",
513
513
  timeout: 2e3,
@@ -515,7 +515,7 @@ function getProjectName(cwd) {
515
515
  }).trim();
516
516
  repoRoot = path5.dirname(gitCommonDir);
517
517
  } catch {
518
- repoRoot = execSync("git rev-parse --show-toplevel", {
518
+ repoRoot = execSync2("git rev-parse --show-toplevel", {
519
519
  cwd: dir,
520
520
  encoding: "utf8",
521
521
  timeout: 2e3,
@@ -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
  );
@@ -4313,6 +4331,24 @@ var init_platform_procedures = __esm({
4313
4331
  priority: "p0",
4314
4332
  content: "When an agent encounters a suspected Exe OS bug, update breakage, MCP/tool failure, installer issue, memory/orchestration defect, or customer-local patch need, it MUST use create_bug_report. Do this before or alongside any local workaround so the report reaches AskExe support directly via the customer's license. Do NOT ask the founder for permission to file a required bug report. If create_bug_report is deferred/lazy-loaded, load it and call it. If it is unavailable in the live MCP surface, report 'create_bug_report unavailable in this session' and save a local report in exe/output \u2014 never claim the tool does not exist unless the live MCP surface was checked. If upstream delivery fails, call support_test (MCP) and include its result in the local report so AskExe can distinguish customer setup, license provisioning, and server intake issues; only ask the founder to run `exe-os support test` if MCP is disconnected/unavailable. Classify first: upstream_bug = reproducible exe-os/platform defect; customer_customization = identity, behavior, procedure, config, branding, workflow preference that belongs in customer-owned layers; emergency_hotfix = temporary local patch. For upstream bugs/emergency hotfixes include version, repro steps, expected/actual, files changed, workaround, and local diff summary. Avoid permanent platform-code patches unless founder approves; if a hotfix is unavoidable, document it in the bug report and re-check after npm update."
4315
4333
  },
4334
+ {
4335
+ title: "Bug report status check \u2014 surface available fixes on boot",
4336
+ domain: "support",
4337
+ priority: "p1",
4338
+ content: "Once per session (COO boot only, never repeat), call list_my_bug_reports to check if any previously filed bug reports have been fixed by AskExe. If any report has status 'fixed' with a fixed_version, surface it to the founder immediately: '\u{1F527} N bug fix(es) available \u2014 run exe-os update to get version X.Y.Z'. This is a one-time check at boot, not a recurring poll. If no reports exist or none are fixed, skip silently. If the MCP tool is unavailable or the network call fails, skip silently \u2014 this is informational, not blocking."
4339
+ },
4340
+ {
4341
+ title: "Feature request triage \u2014 upstream feature vs local customization",
4342
+ domain: "support",
4343
+ priority: "p0",
4344
+ content: "When an agent or founder identifies a desired capability that exe-os does not yet provide, the COO (or equivalent coordinator) must decide: is this a local customization (identity, behavior, procedure, config, branding, workflow preference that can be configured in customer-owned layers) or an upstream feature request (a platform capability that requires changes to exe-os code, shipped via npm update)? Local customizations: implement immediately using store_behavior, update_identity, company_procedure, or config changes. Upstream features: use create_feature_request to submit to AskExe. Include use case, business impact, and current workaround. Do NOT ask the founder for permission to file a feature request \u2014 file it proactively when the need is clear."
4345
+ },
4346
+ {
4347
+ title: "Feature request status check \u2014 surface shipped features on boot",
4348
+ domain: "support",
4349
+ priority: "p1",
4350
+ content: "Once per session (COO boot only, never repeat), call list_my_feature_requests to check if any previously filed feature requests have been shipped by AskExe. If any request has status 'shipped' with a shipped_version, surface it to the founder immediately: '\u{1F680} N feature(s) shipped \u2014 run exe-os update to get version X.Y.Z'. This is a one-time check at boot, not a recurring poll. If no requests exist or none are shipped, skip silently. If the MCP tool is unavailable or the network call fails, skip silently \u2014 this is informational, not blocking."
4351
+ },
4316
4352
  // --- Operations ---
4317
4353
  {
4318
4354
  title: "Managers must supervise deployed workers",
@@ -5559,11 +5595,11 @@ __export(git_staleness_exports, {
5559
5595
  detectStaleFiles: () => detectStaleFiles,
5560
5596
  recordFileRead: () => recordFileRead
5561
5597
  });
5562
- import { execSync as execSync5 } from "child_process";
5598
+ import { execSync as execSync6 } from "child_process";
5563
5599
  import path12 from "path";
5564
5600
  function getHeadCommit(cwd) {
5565
5601
  try {
5566
- return execSync5("git rev-parse --short HEAD", {
5602
+ return execSync6("git rev-parse --short HEAD", {
5567
5603
  cwd,
5568
5604
  timeout: GIT_TIMEOUT_MS,
5569
5605
  encoding: "utf-8"
@@ -5626,7 +5662,7 @@ async function detectStaleFiles(agentId, cwd) {
5626
5662
  const readAt = String(record.read_at ?? "");
5627
5663
  if (!filePath || !readAt) continue;
5628
5664
  try {
5629
- const gitSummary = execSync5(
5665
+ const gitSummary = execSync6(
5630
5666
  `git log -1 --oneline --after=${JSON.stringify(readAt)} --format="%h %an: %s" -- ${JSON.stringify(filePath)}`,
5631
5667
  {
5632
5668
  cwd,
@@ -5863,7 +5899,7 @@ __export(project_name_exports, {
5863
5899
  _resetCache: () => _resetCache,
5864
5900
  getProjectName: () => getProjectName
5865
5901
  });
5866
- import { execSync as execSync6 } from "child_process";
5902
+ import { execSync as execSync7 } from "child_process";
5867
5903
  import path13 from "path";
5868
5904
  function getProjectName(cwd) {
5869
5905
  const dir = cwd ?? process.cwd();
@@ -5871,7 +5907,7 @@ function getProjectName(cwd) {
5871
5907
  try {
5872
5908
  let repoRoot;
5873
5909
  try {
5874
- const gitCommonDir = execSync6("git rev-parse --path-format=absolute --git-common-dir", {
5910
+ const gitCommonDir = execSync7("git rev-parse --path-format=absolute --git-common-dir", {
5875
5911
  cwd: dir,
5876
5912
  encoding: "utf8",
5877
5913
  timeout: 2e3,
@@ -5879,7 +5915,7 @@ function getProjectName(cwd) {
5879
5915
  }).trim();
5880
5916
  repoRoot = path13.dirname(gitCommonDir);
5881
5917
  } catch {
5882
- repoRoot = execSync6("git rev-parse --show-toplevel", {
5918
+ repoRoot = execSync7("git rev-parse --show-toplevel", {
5883
5919
  cwd: dir,
5884
5920
  encoding: "utf8",
5885
5921
  timeout: 2e3,