@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
@@ -1570,7 +1570,7 @@ var init_daemon_auth = __esm({
1570
1570
  // src/lib/exe-daemon-client.ts
1571
1571
  import net from "net";
1572
1572
  import os6 from "os";
1573
- import { spawn } from "child_process";
1573
+ import { spawn, execSync as execSync4 } from "child_process";
1574
1574
  import { randomUUID } from "crypto";
1575
1575
  import { existsSync as existsSync8, unlinkSync as unlinkSync2, readFileSync as readFileSync7, openSync, closeSync, statSync } from "fs";
1576
1576
  import path8 from "path";
@@ -1600,6 +1600,14 @@ function handleData(chunk) {
1600
1600
  }
1601
1601
  }
1602
1602
  }
1603
+ function isZombie(pid) {
1604
+ try {
1605
+ const state = execSync4(`ps -p ${pid} -o state=`, { encoding: "utf8", timeout: 2e3 }).trim();
1606
+ return state.startsWith("Z");
1607
+ } catch {
1608
+ return false;
1609
+ }
1610
+ }
1603
1611
  function cleanupStaleFiles() {
1604
1612
  if (existsSync8(PID_PATH)) {
1605
1613
  try {
@@ -1607,7 +1615,11 @@ function cleanupStaleFiles() {
1607
1615
  if (pid > 0) {
1608
1616
  try {
1609
1617
  process.kill(pid, 0);
1610
- return;
1618
+ if (!isZombie(pid)) {
1619
+ return;
1620
+ }
1621
+ process.stderr.write(`[exed-client] PID ${pid} is a zombie \u2014 cleaning up stale files
1622
+ `);
1611
1623
  } catch {
1612
1624
  }
1613
1625
  }
@@ -1635,8 +1647,8 @@ function findPackageRoot() {
1635
1647
  function getAvailableMemoryGB() {
1636
1648
  if (process.platform === "darwin") {
1637
1649
  try {
1638
- const { execSync: execSync9 } = __require("child_process");
1639
- const vmstat = execSync9("vm_stat", { encoding: "utf8" });
1650
+ const { execSync: execSync10 } = __require("child_process");
1651
+ const vmstat = execSync10("vm_stat", { encoding: "utf8" });
1640
1652
  const pageSize = 16384;
1641
1653
  const pageSizeMatch = vmstat.match(/page size of (\d+) bytes/);
1642
1654
  const actualPageSize = pageSizeMatch ? parseInt(pageSizeMatch[1], 10) : pageSize;
@@ -3571,6 +3583,12 @@ async function disposeDatabase() {
3571
3583
  clearInterval(_walCheckpointTimer);
3572
3584
  _walCheckpointTimer = null;
3573
3585
  }
3586
+ if (_client) {
3587
+ try {
3588
+ await _client.execute("PRAGMA wal_checkpoint(PASSIVE)");
3589
+ } catch {
3590
+ }
3591
+ }
3574
3592
  if (_daemonClient) {
3575
3593
  _daemonClient.close();
3576
3594
  _daemonClient = null;
@@ -3919,7 +3937,7 @@ var init_state_bus = __esm({
3919
3937
  });
3920
3938
 
3921
3939
  // src/lib/project-name.ts
3922
- import { execSync as execSync4 } from "child_process";
3940
+ import { execSync as execSync5 } from "child_process";
3923
3941
  import path13 from "path";
3924
3942
  function getProjectName(cwd) {
3925
3943
  const dir = cwd ?? process.cwd();
@@ -3927,7 +3945,7 @@ function getProjectName(cwd) {
3927
3945
  try {
3928
3946
  let repoRoot;
3929
3947
  try {
3930
- const gitCommonDir = execSync4("git rev-parse --path-format=absolute --git-common-dir", {
3948
+ const gitCommonDir = execSync5("git rev-parse --path-format=absolute --git-common-dir", {
3931
3949
  cwd: dir,
3932
3950
  encoding: "utf8",
3933
3951
  timeout: 2e3,
@@ -3935,7 +3953,7 @@ function getProjectName(cwd) {
3935
3953
  }).trim();
3936
3954
  repoRoot = path13.dirname(gitCommonDir);
3937
3955
  } catch {
3938
- repoRoot = execSync4("git rev-parse --show-toplevel", {
3956
+ repoRoot = execSync5("git rev-parse --show-toplevel", {
3939
3957
  cwd: dir,
3940
3958
  encoding: "utf8",
3941
3959
  timeout: 2e3,
@@ -4042,7 +4060,7 @@ __export(tasks_crud_exports, {
4042
4060
  import crypto4 from "crypto";
4043
4061
  import path14 from "path";
4044
4062
  import os10 from "os";
4045
- import { execSync as execSync5 } from "child_process";
4063
+ import { execSync as execSync6 } from "child_process";
4046
4064
  import { mkdir as mkdir3, writeFile as writeFile3, appendFile } from "fs/promises";
4047
4065
  import { existsSync as existsSync13, readFileSync as readFileSync11 } from "fs";
4048
4066
  async function writeCheckpoint(input) {
@@ -4387,14 +4405,14 @@ function isTmuxSessionAlive(identifier) {
4387
4405
  if (!identifier || identifier === "unknown") return true;
4388
4406
  try {
4389
4407
  if (identifier.startsWith("%")) {
4390
- const output = execSync5("tmux list-panes -a -F '#{pane_id}'", {
4408
+ const output = execSync6("tmux list-panes -a -F '#{pane_id}'", {
4391
4409
  timeout: 2e3,
4392
4410
  encoding: "utf8",
4393
4411
  stdio: ["pipe", "pipe", "pipe"]
4394
4412
  });
4395
4413
  return output.split("\n").some((l) => l.trim() === identifier);
4396
4414
  } else {
4397
- execSync5(`tmux has-session -t ${JSON.stringify(identifier)}`, {
4415
+ execSync6(`tmux has-session -t ${JSON.stringify(identifier)}`, {
4398
4416
  timeout: 2e3,
4399
4417
  stdio: ["pipe", "pipe", "pipe"]
4400
4418
  });
@@ -4403,7 +4421,7 @@ function isTmuxSessionAlive(identifier) {
4403
4421
  } catch {
4404
4422
  if (identifier.startsWith("%")) return true;
4405
4423
  try {
4406
- execSync5("tmux list-sessions", {
4424
+ execSync6("tmux list-sessions", {
4407
4425
  timeout: 2e3,
4408
4426
  stdio: ["pipe", "pipe", "pipe"]
4409
4427
  });
@@ -4418,12 +4436,12 @@ function checkStaleCompletion(taskContext, taskCreatedAt) {
4418
4436
  if (!DELEGATION_KEYWORDS.test(taskContext)) return null;
4419
4437
  try {
4420
4438
  const since = new Date(taskCreatedAt).toISOString();
4421
- const branch = execSync5(
4439
+ const branch = execSync6(
4422
4440
  "git rev-parse --abbrev-ref HEAD 2>/dev/null",
4423
4441
  { encoding: "utf8", timeout: 3e3 }
4424
4442
  ).trim();
4425
4443
  const branchArg = branch && branch !== "HEAD" ? branch : "";
4426
- const commitCount = execSync5(
4444
+ const commitCount = execSync6(
4427
4445
  `git log --oneline --since="${since}" ${branchArg} 2>/dev/null | wc -l`,
4428
4446
  { encoding: "utf8", timeout: 5e3 }
4429
4447
  ).trim();
@@ -6022,7 +6040,7 @@ __export(tmux_routing_exports, {
6022
6040
  spawnEmployee: () => spawnEmployee,
6023
6041
  verifyPaneAtCapacity: () => verifyPaneAtCapacity
6024
6042
  });
6025
- import { execFileSync as execFileSync2, execSync as execSync6 } from "child_process";
6043
+ import { execFileSync as execFileSync2, execSync as execSync7 } from "child_process";
6026
6044
  import { readFileSync as readFileSync12, writeFileSync as writeFileSync8, mkdirSync as mkdirSync7, existsSync as existsSync15, appendFileSync, readdirSync as readdirSync3 } from "fs";
6027
6045
  import path18 from "path";
6028
6046
  import os11 from "os";
@@ -6743,7 +6761,7 @@ function spawnEmployee(employeeName, exeSession, projectDir, opts) {
6743
6761
  let booted = false;
6744
6762
  for (let i = 0; i < 30; i++) {
6745
6763
  try {
6746
- execSync6("sleep 0.5");
6764
+ execSync7("sleep 0.5");
6747
6765
  } catch {
6748
6766
  }
6749
6767
  try {
@@ -6855,7 +6873,7 @@ var init_task_scope = __esm({
6855
6873
  // src/lib/keychain.ts
6856
6874
  import { readFile as readFile4, writeFile as writeFile5, unlink, mkdir as mkdir4, chmod as chmod2 } from "fs/promises";
6857
6875
  import { existsSync as existsSync16, statSync as statSync2 } from "fs";
6858
- import { execSync as execSync7 } from "child_process";
6876
+ import { execSync as execSync8 } from "child_process";
6859
6877
  import path19 from "path";
6860
6878
  import os12 from "os";
6861
6879
  function getKeyDir() {
@@ -6872,13 +6890,13 @@ function linuxSecretAvailable() {
6872
6890
  if (process.platform !== "linux") return false;
6873
6891
  if (linuxSecretAvailability !== null) return linuxSecretAvailability;
6874
6892
  try {
6875
- execSync7("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
6893
+ execSync8("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
6876
6894
  } catch {
6877
6895
  linuxSecretAvailability = false;
6878
6896
  return false;
6879
6897
  }
6880
6898
  try {
6881
- execSync7("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
6899
+ execSync8("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
6882
6900
  linuxSecretAvailability = true;
6883
6901
  } catch {
6884
6902
  linuxSecretAvailability = false;
@@ -6902,7 +6920,7 @@ function macKeychainGet(service = SERVICE) {
6902
6920
  if (!nativeKeychainAllowed()) return null;
6903
6921
  if (process.platform !== "darwin") return null;
6904
6922
  try {
6905
- return execSync7(
6923
+ return execSync8(
6906
6924
  `security find-generic-password -s "${service}" -a "${ACCOUNT}" -w 2>/dev/null`,
6907
6925
  { encoding: "utf-8", timeout: 5e3 }
6908
6926
  ).trim();
@@ -6915,13 +6933,13 @@ function macKeychainSet(value, service = SERVICE) {
6915
6933
  if (process.platform !== "darwin") return false;
6916
6934
  try {
6917
6935
  try {
6918
- execSync7(
6936
+ execSync8(
6919
6937
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
6920
6938
  { timeout: 5e3 }
6921
6939
  );
6922
6940
  } catch {
6923
6941
  }
6924
- execSync7(
6942
+ execSync8(
6925
6943
  `security add-generic-password -s "${service}" -a "${ACCOUNT}" -w "${value}"`,
6926
6944
  { timeout: 5e3 }
6927
6945
  );
@@ -6934,7 +6952,7 @@ function macKeychainDelete(service = SERVICE) {
6934
6952
  if (!nativeKeychainAllowed()) return false;
6935
6953
  if (process.platform !== "darwin") return false;
6936
6954
  try {
6937
- execSync7(
6955
+ execSync8(
6938
6956
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
6939
6957
  { timeout: 5e3 }
6940
6958
  );
@@ -6946,7 +6964,7 @@ function macKeychainDelete(service = SERVICE) {
6946
6964
  function linuxSecretGet(service = SERVICE) {
6947
6965
  if (!linuxSecretAvailable()) return null;
6948
6966
  try {
6949
- return execSync7(
6967
+ return execSync8(
6950
6968
  `secret-tool lookup service "${service}" account "${ACCOUNT}" 2>/dev/null`,
6951
6969
  { encoding: "utf-8", timeout: 5e3 }
6952
6970
  ).trim();
@@ -6957,7 +6975,7 @@ function linuxSecretGet(service = SERVICE) {
6957
6975
  function linuxSecretSet(value, service = SERVICE) {
6958
6976
  if (!linuxSecretAvailable()) return false;
6959
6977
  try {
6960
- execSync7(
6978
+ execSync8(
6961
6979
  `echo -n "${value}" | secret-tool store --label="exe-os master key" service "${service}" account "${ACCOUNT}" 2>/dev/null`,
6962
6980
  { timeout: 5e3 }
6963
6981
  );
@@ -6970,7 +6988,7 @@ function linuxSecretDelete(service = SERVICE) {
6970
6988
  if (!nativeKeychainAllowed()) return false;
6971
6989
  if (process.platform !== "linux") return false;
6972
6990
  try {
6973
- execSync7(
6991
+ execSync8(
6974
6992
  `secret-tool clear service "${service}" account "${ACCOUNT}" 2>/dev/null`,
6975
6993
  { timeout: 5e3 }
6976
6994
  );
@@ -7852,6 +7870,24 @@ var init_platform_procedures = __esm({
7852
7870
  priority: "p0",
7853
7871
  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."
7854
7872
  },
7873
+ {
7874
+ title: "Bug report status check \u2014 surface available fixes on boot",
7875
+ domain: "support",
7876
+ priority: "p1",
7877
+ 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."
7878
+ },
7879
+ {
7880
+ title: "Feature request triage \u2014 upstream feature vs local customization",
7881
+ domain: "support",
7882
+ priority: "p0",
7883
+ 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."
7884
+ },
7885
+ {
7886
+ title: "Feature request status check \u2014 surface shipped features on boot",
7887
+ domain: "support",
7888
+ priority: "p1",
7889
+ 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."
7890
+ },
7855
7891
  // --- Operations ---
7856
7892
  {
7857
7893
  title: "Managers must supervise deployed workers",
@@ -9093,7 +9129,7 @@ var init_store = __esm({
9093
9129
 
9094
9130
  // src/lib/git-task-sweep.ts
9095
9131
  init_task_scope();
9096
- import { execSync as execSync8 } from "child_process";
9132
+ import { execSync as execSync9 } from "child_process";
9097
9133
  var DEFAULT_COMMIT_LIMIT = 50;
9098
9134
  var DEFAULT_STALE_MINUTES = 10;
9099
9135
  var AUTO_ESCALATE_THRESHOLD = 0.6;
@@ -9160,7 +9196,7 @@ function matchScore(task, commitMessage, changedFiles) {
9160
9196
  function getRecentCommits(limit = DEFAULT_COMMIT_LIMIT) {
9161
9197
  try {
9162
9198
  const SEPARATOR = "<<SEP>>";
9163
- const output = execSync8(
9199
+ const output = execSync9(
9164
9200
  `git log --format="%h${SEPARATOR}%s${SEPARATOR}%aI" --name-only -n ${limit} -z`,
9165
9201
  { encoding: "utf8", timeout: 1e4 }
9166
9202
  );
@@ -981,7 +981,7 @@ var init_daemon_auth = __esm({
981
981
  // src/lib/exe-daemon-client.ts
982
982
  import net from "net";
983
983
  import os4 from "os";
984
- import { spawn } from "child_process";
984
+ import { spawn, execSync as execSync2 } from "child_process";
985
985
  import { randomUUID } from "crypto";
986
986
  import { existsSync as existsSync5, unlinkSync as unlinkSync2, readFileSync as readFileSync4, openSync, closeSync, statSync } from "fs";
987
987
  import path5 from "path";
@@ -1011,6 +1011,14 @@ function handleData(chunk) {
1011
1011
  }
1012
1012
  }
1013
1013
  }
1014
+ function isZombie(pid) {
1015
+ try {
1016
+ const state = execSync2(`ps -p ${pid} -o state=`, { encoding: "utf8", timeout: 2e3 }).trim();
1017
+ return state.startsWith("Z");
1018
+ } catch {
1019
+ return false;
1020
+ }
1021
+ }
1014
1022
  function cleanupStaleFiles() {
1015
1023
  if (existsSync5(PID_PATH)) {
1016
1024
  try {
@@ -1018,7 +1026,11 @@ function cleanupStaleFiles() {
1018
1026
  if (pid > 0) {
1019
1027
  try {
1020
1028
  process.kill(pid, 0);
1021
- return;
1029
+ if (!isZombie(pid)) {
1030
+ return;
1031
+ }
1032
+ process.stderr.write(`[exed-client] PID ${pid} is a zombie \u2014 cleaning up stale files
1033
+ `);
1022
1034
  } catch {
1023
1035
  }
1024
1036
  }
@@ -1046,8 +1058,8 @@ function findPackageRoot() {
1046
1058
  function getAvailableMemoryGB() {
1047
1059
  if (process.platform === "darwin") {
1048
1060
  try {
1049
- const { execSync: execSync3 } = __require("child_process");
1050
- const vmstat = execSync3("vm_stat", { encoding: "utf8" });
1061
+ const { execSync: execSync4 } = __require("child_process");
1062
+ const vmstat = execSync4("vm_stat", { encoding: "utf8" });
1051
1063
  const pageSize = 16384;
1052
1064
  const pageSizeMatch = vmstat.match(/page size of (\d+) bytes/);
1053
1065
  const actualPageSize = pageSizeMatch ? parseInt(pageSizeMatch[1], 10) : pageSize;
@@ -2833,6 +2845,12 @@ async function disposeDatabase() {
2833
2845
  clearInterval(_walCheckpointTimer);
2834
2846
  _walCheckpointTimer = null;
2835
2847
  }
2848
+ if (_client) {
2849
+ try {
2850
+ await _client.execute("PRAGMA wal_checkpoint(PASSIVE)");
2851
+ } catch {
2852
+ }
2853
+ }
2836
2854
  if (_daemonClient) {
2837
2855
  _daemonClient.close();
2838
2856
  _daemonClient = null;
@@ -3364,6 +3382,24 @@ var init_platform_procedures = __esm({
3364
3382
  priority: "p0",
3365
3383
  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."
3366
3384
  },
3385
+ {
3386
+ title: "Bug report status check \u2014 surface available fixes on boot",
3387
+ domain: "support",
3388
+ priority: "p1",
3389
+ 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."
3390
+ },
3391
+ {
3392
+ title: "Feature request triage \u2014 upstream feature vs local customization",
3393
+ domain: "support",
3394
+ priority: "p0",
3395
+ 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."
3396
+ },
3397
+ {
3398
+ title: "Feature request status check \u2014 surface shipped features on boot",
3399
+ domain: "support",
3400
+ priority: "p1",
3401
+ 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."
3402
+ },
3367
3403
  // --- Operations ---
3368
3404
  {
3369
3405
  title: "Managers must supervise deployed workers",
@@ -3987,7 +4023,7 @@ init_database();
3987
4023
  // src/lib/keychain.ts
3988
4024
  import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2 } from "fs/promises";
3989
4025
  import { existsSync as existsSync6, statSync as statSync2 } from "fs";
3990
- import { execSync as execSync2 } from "child_process";
4026
+ import { execSync as execSync3 } from "child_process";
3991
4027
  import path6 from "path";
3992
4028
  import os5 from "os";
3993
4029
  var SERVICE = "exe-os";
@@ -4008,13 +4044,13 @@ function linuxSecretAvailable() {
4008
4044
  if (process.platform !== "linux") return false;
4009
4045
  if (linuxSecretAvailability !== null) return linuxSecretAvailability;
4010
4046
  try {
4011
- execSync2("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
4047
+ execSync3("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
4012
4048
  } catch {
4013
4049
  linuxSecretAvailability = false;
4014
4050
  return false;
4015
4051
  }
4016
4052
  try {
4017
- execSync2("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
4053
+ execSync3("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
4018
4054
  linuxSecretAvailability = true;
4019
4055
  } catch {
4020
4056
  linuxSecretAvailability = false;
@@ -4038,7 +4074,7 @@ function macKeychainGet(service = SERVICE) {
4038
4074
  if (!nativeKeychainAllowed()) return null;
4039
4075
  if (process.platform !== "darwin") return null;
4040
4076
  try {
4041
- return execSync2(
4077
+ return execSync3(
4042
4078
  `security find-generic-password -s "${service}" -a "${ACCOUNT}" -w 2>/dev/null`,
4043
4079
  { encoding: "utf-8", timeout: 5e3 }
4044
4080
  ).trim();
@@ -4051,13 +4087,13 @@ function macKeychainSet(value, service = SERVICE) {
4051
4087
  if (process.platform !== "darwin") return false;
4052
4088
  try {
4053
4089
  try {
4054
- execSync2(
4090
+ execSync3(
4055
4091
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
4056
4092
  { timeout: 5e3 }
4057
4093
  );
4058
4094
  } catch {
4059
4095
  }
4060
- execSync2(
4096
+ execSync3(
4061
4097
  `security add-generic-password -s "${service}" -a "${ACCOUNT}" -w "${value}"`,
4062
4098
  { timeout: 5e3 }
4063
4099
  );
@@ -4070,7 +4106,7 @@ function macKeychainDelete(service = SERVICE) {
4070
4106
  if (!nativeKeychainAllowed()) return false;
4071
4107
  if (process.platform !== "darwin") return false;
4072
4108
  try {
4073
- execSync2(
4109
+ execSync3(
4074
4110
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
4075
4111
  { timeout: 5e3 }
4076
4112
  );
@@ -4082,7 +4118,7 @@ function macKeychainDelete(service = SERVICE) {
4082
4118
  function linuxSecretGet(service = SERVICE) {
4083
4119
  if (!linuxSecretAvailable()) return null;
4084
4120
  try {
4085
- return execSync2(
4121
+ return execSync3(
4086
4122
  `secret-tool lookup service "${service}" account "${ACCOUNT}" 2>/dev/null`,
4087
4123
  { encoding: "utf-8", timeout: 5e3 }
4088
4124
  ).trim();
@@ -4093,7 +4129,7 @@ function linuxSecretGet(service = SERVICE) {
4093
4129
  function linuxSecretSet(value, service = SERVICE) {
4094
4130
  if (!linuxSecretAvailable()) return false;
4095
4131
  try {
4096
- execSync2(
4132
+ execSync3(
4097
4133
  `echo -n "${value}" | secret-tool store --label="exe-os master key" service "${service}" account "${ACCOUNT}" 2>/dev/null`,
4098
4134
  { timeout: 5e3 }
4099
4135
  );
@@ -4106,7 +4142,7 @@ function linuxSecretDelete(service = SERVICE) {
4106
4142
  if (!nativeKeychainAllowed()) return false;
4107
4143
  if (process.platform !== "linux") return false;
4108
4144
  try {
4109
- execSync2(
4145
+ execSync3(
4110
4146
  `secret-tool clear service "${service}" account "${ACCOUNT}" 2>/dev/null`,
4111
4147
  { timeout: 5e3 }
4112
4148
  );
@@ -992,7 +992,7 @@ __export(exe_daemon_client_exports, {
992
992
  });
993
993
  import net from "net";
994
994
  import os4 from "os";
995
- import { spawn } from "child_process";
995
+ import { spawn, execSync as execSync2 } from "child_process";
996
996
  import { randomUUID } from "crypto";
997
997
  import { existsSync as existsSync5, unlinkSync as unlinkSync2, readFileSync as readFileSync4, openSync, closeSync, statSync } from "fs";
998
998
  import path5 from "path";
@@ -1022,6 +1022,14 @@ function handleData(chunk) {
1022
1022
  }
1023
1023
  }
1024
1024
  }
1025
+ function isZombie(pid) {
1026
+ try {
1027
+ const state = execSync2(`ps -p ${pid} -o state=`, { encoding: "utf8", timeout: 2e3 }).trim();
1028
+ return state.startsWith("Z");
1029
+ } catch {
1030
+ return false;
1031
+ }
1032
+ }
1025
1033
  function cleanupStaleFiles() {
1026
1034
  if (existsSync5(PID_PATH)) {
1027
1035
  try {
@@ -1029,7 +1037,11 @@ function cleanupStaleFiles() {
1029
1037
  if (pid > 0) {
1030
1038
  try {
1031
1039
  process.kill(pid, 0);
1032
- return;
1040
+ if (!isZombie(pid)) {
1041
+ return;
1042
+ }
1043
+ process.stderr.write(`[exed-client] PID ${pid} is a zombie \u2014 cleaning up stale files
1044
+ `);
1033
1045
  } catch {
1034
1046
  }
1035
1047
  }
@@ -1057,8 +1069,8 @@ function findPackageRoot() {
1057
1069
  function getAvailableMemoryGB() {
1058
1070
  if (process.platform === "darwin") {
1059
1071
  try {
1060
- const { execSync: execSync3 } = __require("child_process");
1061
- const vmstat = execSync3("vm_stat", { encoding: "utf8" });
1072
+ const { execSync: execSync4 } = __require("child_process");
1073
+ const vmstat = execSync4("vm_stat", { encoding: "utf8" });
1062
1074
  const pageSize = 16384;
1063
1075
  const pageSizeMatch = vmstat.match(/page size of (\d+) bytes/);
1064
1076
  const actualPageSize = pageSizeMatch ? parseInt(pageSizeMatch[1], 10) : pageSize;
@@ -3048,6 +3060,12 @@ async function disposeDatabase() {
3048
3060
  clearInterval(_walCheckpointTimer);
3049
3061
  _walCheckpointTimer = null;
3050
3062
  }
3063
+ if (_client) {
3064
+ try {
3065
+ await _client.execute("PRAGMA wal_checkpoint(PASSIVE)");
3066
+ } catch {
3067
+ }
3068
+ }
3051
3069
  if (_daemonClient) {
3052
3070
  _daemonClient.close();
3053
3071
  _daemonClient = null;
@@ -3084,7 +3102,7 @@ var init_database = __esm({
3084
3102
  // src/lib/keychain.ts
3085
3103
  import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2 } from "fs/promises";
3086
3104
  import { existsSync as existsSync6, statSync as statSync2 } from "fs";
3087
- import { execSync as execSync2 } from "child_process";
3105
+ import { execSync as execSync3 } from "child_process";
3088
3106
  import path6 from "path";
3089
3107
  import os5 from "os";
3090
3108
  function getKeyDir() {
@@ -3101,13 +3119,13 @@ function linuxSecretAvailable() {
3101
3119
  if (process.platform !== "linux") return false;
3102
3120
  if (linuxSecretAvailability !== null) return linuxSecretAvailability;
3103
3121
  try {
3104
- execSync2("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
3122
+ execSync3("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
3105
3123
  } catch {
3106
3124
  linuxSecretAvailability = false;
3107
3125
  return false;
3108
3126
  }
3109
3127
  try {
3110
- execSync2("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
3128
+ execSync3("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
3111
3129
  linuxSecretAvailability = true;
3112
3130
  } catch {
3113
3131
  linuxSecretAvailability = false;
@@ -3131,7 +3149,7 @@ function macKeychainGet(service = SERVICE) {
3131
3149
  if (!nativeKeychainAllowed()) return null;
3132
3150
  if (process.platform !== "darwin") return null;
3133
3151
  try {
3134
- return execSync2(
3152
+ return execSync3(
3135
3153
  `security find-generic-password -s "${service}" -a "${ACCOUNT}" -w 2>/dev/null`,
3136
3154
  { encoding: "utf-8", timeout: 5e3 }
3137
3155
  ).trim();
@@ -3144,13 +3162,13 @@ function macKeychainSet(value, service = SERVICE) {
3144
3162
  if (process.platform !== "darwin") return false;
3145
3163
  try {
3146
3164
  try {
3147
- execSync2(
3165
+ execSync3(
3148
3166
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
3149
3167
  { timeout: 5e3 }
3150
3168
  );
3151
3169
  } catch {
3152
3170
  }
3153
- execSync2(
3171
+ execSync3(
3154
3172
  `security add-generic-password -s "${service}" -a "${ACCOUNT}" -w "${value}"`,
3155
3173
  { timeout: 5e3 }
3156
3174
  );
@@ -3163,7 +3181,7 @@ function macKeychainDelete(service = SERVICE) {
3163
3181
  if (!nativeKeychainAllowed()) return false;
3164
3182
  if (process.platform !== "darwin") return false;
3165
3183
  try {
3166
- execSync2(
3184
+ execSync3(
3167
3185
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
3168
3186
  { timeout: 5e3 }
3169
3187
  );
@@ -3175,7 +3193,7 @@ function macKeychainDelete(service = SERVICE) {
3175
3193
  function linuxSecretGet(service = SERVICE) {
3176
3194
  if (!linuxSecretAvailable()) return null;
3177
3195
  try {
3178
- return execSync2(
3196
+ return execSync3(
3179
3197
  `secret-tool lookup service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3180
3198
  { encoding: "utf-8", timeout: 5e3 }
3181
3199
  ).trim();
@@ -3186,7 +3204,7 @@ function linuxSecretGet(service = SERVICE) {
3186
3204
  function linuxSecretSet(value, service = SERVICE) {
3187
3205
  if (!linuxSecretAvailable()) return false;
3188
3206
  try {
3189
- execSync2(
3207
+ execSync3(
3190
3208
  `echo -n "${value}" | secret-tool store --label="exe-os master key" service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3191
3209
  { timeout: 5e3 }
3192
3210
  );
@@ -3199,7 +3217,7 @@ function linuxSecretDelete(service = SERVICE) {
3199
3217
  if (!nativeKeychainAllowed()) return false;
3200
3218
  if (process.platform !== "linux") return false;
3201
3219
  try {
3202
- execSync2(
3220
+ execSync3(
3203
3221
  `secret-tool clear service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3204
3222
  { timeout: 5e3 }
3205
3223
  );
@@ -4136,6 +4154,24 @@ var init_platform_procedures = __esm({
4136
4154
  priority: "p0",
4137
4155
  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."
4138
4156
  },
4157
+ {
4158
+ title: "Bug report status check \u2014 surface available fixes on boot",
4159
+ domain: "support",
4160
+ priority: "p1",
4161
+ 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."
4162
+ },
4163
+ {
4164
+ title: "Feature request triage \u2014 upstream feature vs local customization",
4165
+ domain: "support",
4166
+ priority: "p0",
4167
+ 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."
4168
+ },
4169
+ {
4170
+ title: "Feature request status check \u2014 surface shipped features on boot",
4171
+ domain: "support",
4172
+ priority: "p1",
4173
+ 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."
4174
+ },
4139
4175
  // --- Operations ---
4140
4176
  {
4141
4177
  title: "Managers must supervise deployed workers",
@@ -979,6 +979,15 @@ async function registerMcpServer(packageRoot, homeDir = os6.homedir()) {
979
979
  delete claudeJson.mcpServers[MCP_LEGACY_KEY];
980
980
  process.stderr.write("exe-os: migrated MCP server key exe-mem \u2192 exe-os\n");
981
981
  }
982
+ if (claudeJson.projects) {
983
+ for (const [projectPath, projectConfig] of Object.entries(claudeJson.projects)) {
984
+ if (projectConfig.mcpServers?.[MCP_LEGACY_KEY]) {
985
+ delete projectConfig.mcpServers[MCP_LEGACY_KEY];
986
+ process.stderr.write(`exe-os: removed stale project-level exe-mem from ${projectPath}
987
+ `);
988
+ }
989
+ }
990
+ }
982
991
  const currentOs = claudeJson.mcpServers[MCP_PRIMARY_KEY];
983
992
  const osMatches = currentOs && JSON.stringify(currentOs) === JSON.stringify(newEntry);
984
993
  if (osMatches) {