@askexenow/exe-os 0.9.84 → 0.9.86

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/dist/bin/agentic-ontology-backfill.js +32 -14
  2. package/dist/bin/agentic-reflection-backfill.js +32 -14
  3. package/dist/bin/agentic-semantic-label.js +32 -14
  4. package/dist/bin/backfill-conversations.js +32 -14
  5. package/dist/bin/backfill-responses.js +32 -14
  6. package/dist/bin/backfill-vectors.js +32 -14
  7. package/dist/bin/bulk-sync-postgres.js +32 -14
  8. package/dist/bin/cleanup-stale-review-tasks.js +35 -17
  9. package/dist/bin/cli.js +224 -86
  10. package/dist/bin/exe-assign.js +32 -14
  11. package/dist/bin/exe-boot.js +57 -39
  12. package/dist/bin/exe-cloud.js +22 -4
  13. package/dist/bin/exe-dispatch.js +43 -25
  14. package/dist/bin/exe-doctor.js +22 -4
  15. package/dist/bin/exe-export-behaviors.js +32 -14
  16. package/dist/bin/exe-forget.js +32 -14
  17. package/dist/bin/exe-gateway.js +47 -29
  18. package/dist/bin/exe-heartbeat.js +37 -19
  19. package/dist/bin/exe-kill.js +36 -18
  20. package/dist/bin/exe-launch-agent.js +170 -79
  21. package/dist/bin/exe-new-employee.js +32 -0
  22. package/dist/bin/exe-pending-messages.js +35 -17
  23. package/dist/bin/exe-pending-notifications.js +35 -17
  24. package/dist/bin/exe-pending-reviews.js +37 -19
  25. package/dist/bin/exe-rename.js +34 -16
  26. package/dist/bin/exe-review.js +32 -14
  27. package/dist/bin/exe-search.js +40 -22
  28. package/dist/bin/exe-session-cleanup.js +67 -44
  29. package/dist/bin/exe-start-codex.js +39 -21
  30. package/dist/bin/exe-start-opencode.js +37 -19
  31. package/dist/bin/exe-status.js +44 -26
  32. package/dist/bin/exe-team.js +32 -14
  33. package/dist/bin/git-sweep.js +45 -27
  34. package/dist/bin/graph-backfill.js +32 -14
  35. package/dist/bin/graph-export.js +32 -14
  36. package/dist/bin/install.js +32 -0
  37. package/dist/bin/intercom-check.js +49 -31
  38. package/dist/bin/scan-tasks.js +45 -27
  39. package/dist/bin/setup.js +29 -11
  40. package/dist/bin/shard-migrate.js +32 -14
  41. package/dist/bin/stack-update.js +95 -7
  42. package/dist/bin/update.js +1 -1
  43. package/dist/gateway/index.js +47 -29
  44. package/dist/hooks/bug-report-worker.js +47 -29
  45. package/dist/hooks/codex-stop-task-finalizer.js +41 -23
  46. package/dist/hooks/commit-complete.js +46 -28
  47. package/dist/hooks/error-recall.js +44 -26
  48. package/dist/hooks/ingest-worker.js +4 -4
  49. package/dist/hooks/ingest.js +38 -20
  50. package/dist/hooks/instructions-loaded.js +32 -14
  51. package/dist/hooks/notification.js +32 -14
  52. package/dist/hooks/post-compact.js +32 -14
  53. package/dist/hooks/post-tool-combined.js +45 -27
  54. package/dist/hooks/pre-compact.js +43 -25
  55. package/dist/hooks/pre-tool-use.js +40 -22
  56. package/dist/hooks/prompt-submit.js +60 -42
  57. package/dist/hooks/session-end.js +48 -30
  58. package/dist/hooks/session-start.js +50 -32
  59. package/dist/hooks/stop.js +35 -17
  60. package/dist/hooks/subagent-stop.js +32 -14
  61. package/dist/hooks/summary-worker.js +37 -19
  62. package/dist/index.js +43 -25
  63. package/dist/lib/cloud-sync.js +32 -14
  64. package/dist/lib/database.js +22 -4
  65. package/dist/lib/db-daemon-client.js +16 -4
  66. package/dist/lib/db.js +22 -4
  67. package/dist/lib/device-registry.js +22 -4
  68. package/dist/lib/embedder.js +16 -4
  69. package/dist/lib/exe-daemon-client.js +16 -4
  70. package/dist/lib/exe-daemon.js +165 -66
  71. package/dist/lib/hybrid-search.js +40 -22
  72. package/dist/lib/schedules.js +35 -17
  73. package/dist/lib/skill-learning.js +16 -4
  74. package/dist/lib/store.js +32 -14
  75. package/dist/lib/tasks.js +16 -4
  76. package/dist/lib/tmux-routing.js +18 -6
  77. package/dist/mcp/server.js +142 -60
  78. package/dist/mcp/tools/create-task.js +18 -6
  79. package/dist/mcp/tools/update-task.js +18 -6
  80. package/dist/runtime/index.js +43 -25
  81. package/dist/tui/App.js +73 -55
  82. package/package.json +1 -1
@@ -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;
@@ -3987,7 +4005,7 @@ init_database();
3987
4005
  // src/lib/keychain.ts
3988
4006
  import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2 } from "fs/promises";
3989
4007
  import { existsSync as existsSync6, statSync as statSync2 } from "fs";
3990
- import { execSync as execSync2 } from "child_process";
4008
+ import { execSync as execSync3 } from "child_process";
3991
4009
  import path6 from "path";
3992
4010
  import os5 from "os";
3993
4011
  var SERVICE = "exe-os";
@@ -4008,13 +4026,13 @@ function linuxSecretAvailable() {
4008
4026
  if (process.platform !== "linux") return false;
4009
4027
  if (linuxSecretAvailability !== null) return linuxSecretAvailability;
4010
4028
  try {
4011
- execSync2("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
4029
+ execSync3("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
4012
4030
  } catch {
4013
4031
  linuxSecretAvailability = false;
4014
4032
  return false;
4015
4033
  }
4016
4034
  try {
4017
- execSync2("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
4035
+ execSync3("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
4018
4036
  linuxSecretAvailability = true;
4019
4037
  } catch {
4020
4038
  linuxSecretAvailability = false;
@@ -4038,7 +4056,7 @@ function macKeychainGet(service = SERVICE) {
4038
4056
  if (!nativeKeychainAllowed()) return null;
4039
4057
  if (process.platform !== "darwin") return null;
4040
4058
  try {
4041
- return execSync2(
4059
+ return execSync3(
4042
4060
  `security find-generic-password -s "${service}" -a "${ACCOUNT}" -w 2>/dev/null`,
4043
4061
  { encoding: "utf-8", timeout: 5e3 }
4044
4062
  ).trim();
@@ -4051,13 +4069,13 @@ function macKeychainSet(value, service = SERVICE) {
4051
4069
  if (process.platform !== "darwin") return false;
4052
4070
  try {
4053
4071
  try {
4054
- execSync2(
4072
+ execSync3(
4055
4073
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
4056
4074
  { timeout: 5e3 }
4057
4075
  );
4058
4076
  } catch {
4059
4077
  }
4060
- execSync2(
4078
+ execSync3(
4061
4079
  `security add-generic-password -s "${service}" -a "${ACCOUNT}" -w "${value}"`,
4062
4080
  { timeout: 5e3 }
4063
4081
  );
@@ -4070,7 +4088,7 @@ function macKeychainDelete(service = SERVICE) {
4070
4088
  if (!nativeKeychainAllowed()) return false;
4071
4089
  if (process.platform !== "darwin") return false;
4072
4090
  try {
4073
- execSync2(
4091
+ execSync3(
4074
4092
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
4075
4093
  { timeout: 5e3 }
4076
4094
  );
@@ -4082,7 +4100,7 @@ function macKeychainDelete(service = SERVICE) {
4082
4100
  function linuxSecretGet(service = SERVICE) {
4083
4101
  if (!linuxSecretAvailable()) return null;
4084
4102
  try {
4085
- return execSync2(
4103
+ return execSync3(
4086
4104
  `secret-tool lookup service "${service}" account "${ACCOUNT}" 2>/dev/null`,
4087
4105
  { encoding: "utf-8", timeout: 5e3 }
4088
4106
  ).trim();
@@ -4093,7 +4111,7 @@ function linuxSecretGet(service = SERVICE) {
4093
4111
  function linuxSecretSet(value, service = SERVICE) {
4094
4112
  if (!linuxSecretAvailable()) return false;
4095
4113
  try {
4096
- execSync2(
4114
+ execSync3(
4097
4115
  `echo -n "${value}" | secret-tool store --label="exe-os master key" service "${service}" account "${ACCOUNT}" 2>/dev/null`,
4098
4116
  { timeout: 5e3 }
4099
4117
  );
@@ -4106,7 +4124,7 @@ function linuxSecretDelete(service = SERVICE) {
4106
4124
  if (!nativeKeychainAllowed()) return false;
4107
4125
  if (process.platform !== "linux") return false;
4108
4126
  try {
4109
- execSync2(
4127
+ execSync3(
4110
4128
  `secret-tool clear service "${service}" account "${ACCOUNT}" 2>/dev/null`,
4111
4129
  { timeout: 5e3 }
4112
4130
  );
@@ -2,6 +2,7 @@
2
2
 
3
3
  // src/bin/stack-update.ts
4
4
  import { readFileSync as readFileSync4 } from "fs";
5
+ import { spawnSync as spawnSync2 } from "child_process";
5
6
 
6
7
  // src/lib/is-main.ts
7
8
  import { realpathSync } from "fs";
@@ -439,6 +440,9 @@ function installDockerUbuntu(exec) {
439
440
  function randomSecret(bytes = 32) {
440
441
  return randomBytes(bytes).toString("base64url");
441
442
  }
443
+ function randomHexSecret(bytes = 24) {
444
+ return randomBytes(bytes).toString("hex");
445
+ }
442
446
  function hydrateEnv(raw, opts) {
443
447
  let next = raw;
444
448
  const license = opts.licenseKey || process.env.EXE_LICENSE_KEY || loadLicense() || "";
@@ -448,6 +452,8 @@ function hydrateEnv(raw, opts) {
448
452
  for (const [key, value] of env.entries()) {
449
453
  if (!/CHANGEME/.test(value)) continue;
450
454
  if (key === "EXE_LICENSE_KEY" && license) replacements[key] = license;
455
+ else if (key === "MONITOR_AGENT_KEY") continue;
456
+ else if (key === "EXE_GATEWAY_WS_RELAY_AUTH_TOKEN") replacements[key] = randomHexSecret(24);
451
457
  else if (key.endsWith("_PASSWORD")) replacements[key] = randomSecret(24);
452
458
  else if (key.endsWith("_SECRET") || key.endsWith("_TOKEN") || key.endsWith("_KEY") || key.endsWith("_SALT")) replacements[key] = value.replace(/CHANGEME[A-Z0-9_]*/g, randomSecret(32));
453
459
  else if (key === "EXED_MCP_TOKEN") replacements[key] = randomSecret(32);
@@ -510,12 +516,25 @@ function assertHostReadyForApply(report) {
510
516
  if (blockers.length > 0) throw new Error(`Stack host is not ready:
511
517
  - ${blockers.join("\n- ")}`);
512
518
  }
519
+ function areStackContainersRunning(composeFile, envFile) {
520
+ try {
521
+ const result = spawnSync("docker", ["compose", "--file", composeFile, "--env-file", envFile, "ps", "-q"], {
522
+ stdio: ["pipe", "pipe", "pipe"],
523
+ timeout: 15e3
524
+ });
525
+ return result.status === 0 && (result.stdout?.toString().trim().length ?? 0) > 0;
526
+ } catch {
527
+ return false;
528
+ }
529
+ }
513
530
  async function runStackUpdate(options) {
514
531
  const exec = options.exec ?? defaultExec;
515
532
  const now = options.now ?? (() => /* @__PURE__ */ new Date());
516
533
  if (options.rollback) return rollbackStackUpdate(options);
517
- const report = bootstrapStackHost({ ...options, installDocker: options.installDocker ?? !!options.yes });
518
- if (!options.dryRun) assertHostReadyForApply(report);
534
+ if (options.bootstrap !== false) {
535
+ const report = bootstrapStackHost({ ...options, installDocker: options.installDocker ?? !!options.yes });
536
+ if (!options.dryRun) assertHostReadyForApply(report);
537
+ }
519
538
  const manifest = await loadStackManifest(options.manifestRef, options.fetchText, options.manifestPublicKey, options.manifestAuthToken);
520
539
  const envRaw = readFileSync3(options.envFile, "utf8");
521
540
  const plan = createStackUpdatePlan(manifest, envRaw, options.targetVersion);
@@ -531,7 +550,8 @@ async function runStackUpdate(options) {
531
550
  });
532
551
  const lockFile = options.lockFile ?? path3.join(path3.dirname(options.envFile), ".exe-stack-lock.json");
533
552
  const previousVersion = readCurrentStackVersion(lockFile);
534
- if (options.dryRun || plan.changes.length === 0) {
553
+ const containersRunning = plan.changes.length === 0 ? areStackContainersRunning(options.composeFile, options.envFile) : true;
554
+ if (options.dryRun || plan.changes.length === 0 && containersRunning) {
535
555
  return { status: "planned", targetVersion: plan.targetVersion, changes: plan.changes, lockFile };
536
556
  }
537
557
  await postDeployAudit(options, "started", plan.targetVersion, previousVersion);
@@ -693,7 +713,9 @@ function defaultStackPaths() {
693
713
  // Packaged manifests keep cold-start installs unblocked even before update-service entitlements are provisioned.
694
714
  auditUrl: process.env.EXE_STACK_AUDIT_URL || (/^https?:\/\//.test(manifestRef) ? "https://update.askexe.com/v1/deploy-audits" : void 0),
695
715
  imageCredentialsUrl: process.env.EXE_STACK_IMAGE_CREDENTIALS_URL || (/^https?:\/\//.test(manifestRef) ? "https://update.askexe.com/v1/image-credentials" : void 0),
696
- manifestAuthToken: process.env.EXE_STACK_UPDATE_TOKEN || process.env.EXE_LICENSE_KEY || loadLicense() || void 0,
716
+ // License key IS the auth token for update.askexe.com no separate update token needed.
717
+ // EXE_STACK_UPDATE_TOKEN kept as legacy fallback during migration.
718
+ manifestAuthToken: process.env.EXE_LICENSE_KEY || loadLicense() || process.env.EXE_STACK_UPDATE_TOKEN || void 0,
697
719
  manifestPublicKey: loadDefaultPublicKey()
698
720
  };
699
721
  }
@@ -815,9 +837,21 @@ Options:
815
837
  -y, --yes Non-interactive confirmation
816
838
  `);
817
839
  }
818
- function printChanges(changes) {
840
+ function printChanges(changes, composeFile, envFile) {
819
841
  if (changes.length === 0) {
820
- console.log("\u2705 Stack already matches target manifest.");
842
+ const running = areCliContainersRunning(composeFile, envFile);
843
+ if (running) {
844
+ console.log("Stack .env matches target manifest. Checking container health...\n");
845
+ const unhealthy = printContainerHealth(composeFile, envFile);
846
+ if (unhealthy > 0) {
847
+ console.log(`
848
+ \u{1F534} ${unhealthy} service(s) unhealthy or crashlooping. Run \`docker compose logs <service>\` to diagnose.`);
849
+ } else {
850
+ console.log("\n\u2705 Stack already matches target manifest. All services healthy.");
851
+ }
852
+ } else {
853
+ console.log("\u26A0\uFE0F Stack .env matches target manifest but containers are not running. Will start them.");
854
+ }
821
855
  return;
822
856
  }
823
857
  console.log("Planned image tag changes:");
@@ -826,6 +860,60 @@ function printChanges(changes) {
826
860
  console.log(` ${c.before ?? "<unset>"} \u2192 ${c.after}`);
827
861
  }
828
862
  }
863
+ function areCliContainersRunning(composeFile, envFile) {
864
+ try {
865
+ const result = spawnSync2("docker", ["compose", "--file", composeFile, "--env-file", envFile, "ps", "-q"], {
866
+ stdio: ["pipe", "pipe", "pipe"],
867
+ timeout: 15e3
868
+ });
869
+ return result.status === 0 && (result.stdout?.toString().trim().length ?? 0) > 0;
870
+ } catch {
871
+ return false;
872
+ }
873
+ }
874
+ function getContainerHealth(composeFile, envFile) {
875
+ try {
876
+ const result = spawnSync2(
877
+ "docker",
878
+ ["compose", "--file", composeFile, "--env-file", envFile, "ps", "--format", "json"],
879
+ { stdio: ["pipe", "pipe", "pipe"], timeout: 15e3 }
880
+ );
881
+ if (result.status !== 0) return [];
882
+ const raw = result.stdout?.toString().trim() ?? "";
883
+ if (!raw) return [];
884
+ return raw.split("\n").filter(Boolean).map((line) => {
885
+ try {
886
+ const obj = JSON.parse(line);
887
+ return {
888
+ service: obj.Service ?? obj.Name ?? "unknown",
889
+ state: obj.State ?? "unknown",
890
+ health: obj.Health ?? "",
891
+ restartCount: typeof obj.RestartCount === "number" ? obj.RestartCount : 0
892
+ };
893
+ } catch {
894
+ return null;
895
+ }
896
+ }).filter((x) => x !== null);
897
+ } catch {
898
+ return [];
899
+ }
900
+ }
901
+ function printContainerHealth(composeFile, envFile) {
902
+ const containers = getContainerHealth(composeFile, envFile);
903
+ if (containers.length === 0) return 0;
904
+ let unhealthy = 0;
905
+ for (const c of containers) {
906
+ const isRestarting = c.state === "restarting" || c.restartCount > 2;
907
+ const isUnhealthy = c.health === "unhealthy" || c.state === "dead" || c.state === "exited";
908
+ if (isRestarting || isUnhealthy) {
909
+ unhealthy++;
910
+ console.log(` \u274C ${c.service}: ${c.state} (restarts: ${c.restartCount}${c.health ? `, health: ${c.health}` : ""})`);
911
+ } else {
912
+ console.log(` \u2705 ${c.service}: ${c.state}${c.health ? ` (${c.health})` : ""}`);
913
+ }
914
+ }
915
+ return unhealthy;
916
+ }
829
917
  function printBreaking(changes) {
830
918
  if (changes.length === 0) return;
831
919
  console.log("\nBreaking-change notices:");
@@ -880,7 +968,7 @@ async function main(args = process.argv.slice(2)) {
880
968
  console.log(`Compose: ${opts.composeFile}`);
881
969
  console.log(`Env: ${opts.envFile}
882
970
  `);
883
- printChanges(plan.changes);
971
+ printChanges(plan.changes, opts.composeFile, opts.envFile);
884
972
  printBreaking(plan.breakingChanges);
885
973
  if (opts.check || opts.dryRun) return;
886
974
  if (!opts.yes) {
@@ -804,7 +804,7 @@ async function runRestore() {
804
804
  }
805
805
  async function runUpdate(cliArgs) {
806
806
  const args = cliArgs ?? process.argv.slice(2);
807
- const autoMode = args.includes("--auto") || args.includes("-y");
807
+ const autoMode = args.includes("--auto") || args.includes("--yes") || args.includes("-y");
808
808
  const checkOnly = args.includes("--check");
809
809
  const restoreMode = args.includes("--restore");
810
810
  if (restoreMode) {
@@ -1702,7 +1702,7 @@ var init_daemon_auth = __esm({
1702
1702
  // src/lib/exe-daemon-client.ts
1703
1703
  import net from "net";
1704
1704
  import os4 from "os";
1705
- import { spawn } from "child_process";
1705
+ import { spawn, execSync as execSync2 } from "child_process";
1706
1706
  import { randomUUID } from "crypto";
1707
1707
  import { existsSync as existsSync6, unlinkSync as unlinkSync2, readFileSync as readFileSync5, openSync, closeSync, statSync } from "fs";
1708
1708
  import path6 from "path";
@@ -1732,6 +1732,14 @@ function handleData(chunk) {
1732
1732
  }
1733
1733
  }
1734
1734
  }
1735
+ function isZombie(pid) {
1736
+ try {
1737
+ const state = execSync2(`ps -p ${pid} -o state=`, { encoding: "utf8", timeout: 2e3 }).trim();
1738
+ return state.startsWith("Z");
1739
+ } catch {
1740
+ return false;
1741
+ }
1742
+ }
1735
1743
  function cleanupStaleFiles() {
1736
1744
  if (existsSync6(PID_PATH)) {
1737
1745
  try {
@@ -1739,7 +1747,11 @@ function cleanupStaleFiles() {
1739
1747
  if (pid > 0) {
1740
1748
  try {
1741
1749
  process.kill(pid, 0);
1742
- return;
1750
+ if (!isZombie(pid)) {
1751
+ return;
1752
+ }
1753
+ process.stderr.write(`[exed-client] PID ${pid} is a zombie \u2014 cleaning up stale files
1754
+ `);
1743
1755
  } catch {
1744
1756
  }
1745
1757
  }
@@ -1767,8 +1779,8 @@ function findPackageRoot() {
1767
1779
  function getAvailableMemoryGB() {
1768
1780
  if (process.platform === "darwin") {
1769
1781
  try {
1770
- const { execSync: execSync8 } = __require("child_process");
1771
- const vmstat = execSync8("vm_stat", { encoding: "utf8" });
1782
+ const { execSync: execSync9 } = __require("child_process");
1783
+ const vmstat = execSync9("vm_stat", { encoding: "utf8" });
1772
1784
  const pageSize = 16384;
1773
1785
  const pageSizeMatch = vmstat.match(/page size of (\d+) bytes/);
1774
1786
  const actualPageSize = pageSizeMatch ? parseInt(pageSizeMatch[1], 10) : pageSize;
@@ -3703,6 +3715,12 @@ async function disposeDatabase() {
3703
3715
  clearInterval(_walCheckpointTimer);
3704
3716
  _walCheckpointTimer = null;
3705
3717
  }
3718
+ if (_client) {
3719
+ try {
3720
+ await _client.execute("PRAGMA wal_checkpoint(PASSIVE)");
3721
+ } catch {
3722
+ }
3723
+ }
3706
3724
  if (_daemonClient) {
3707
3725
  _daemonClient.close();
3708
3726
  _daemonClient = null;
@@ -3807,7 +3825,7 @@ var init_embedder = __esm({
3807
3825
  // src/lib/keychain.ts
3808
3826
  import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2 } from "fs/promises";
3809
3827
  import { existsSync as existsSync7, statSync as statSync2 } from "fs";
3810
- import { execSync as execSync2 } from "child_process";
3828
+ import { execSync as execSync3 } from "child_process";
3811
3829
  import path7 from "path";
3812
3830
  import os5 from "os";
3813
3831
  function getKeyDir() {
@@ -3824,13 +3842,13 @@ function linuxSecretAvailable() {
3824
3842
  if (process.platform !== "linux") return false;
3825
3843
  if (linuxSecretAvailability !== null) return linuxSecretAvailability;
3826
3844
  try {
3827
- execSync2("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
3845
+ execSync3("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
3828
3846
  } catch {
3829
3847
  linuxSecretAvailability = false;
3830
3848
  return false;
3831
3849
  }
3832
3850
  try {
3833
- execSync2("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
3851
+ execSync3("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
3834
3852
  linuxSecretAvailability = true;
3835
3853
  } catch {
3836
3854
  linuxSecretAvailability = false;
@@ -3854,7 +3872,7 @@ function macKeychainGet(service = SERVICE) {
3854
3872
  if (!nativeKeychainAllowed()) return null;
3855
3873
  if (process.platform !== "darwin") return null;
3856
3874
  try {
3857
- return execSync2(
3875
+ return execSync3(
3858
3876
  `security find-generic-password -s "${service}" -a "${ACCOUNT}" -w 2>/dev/null`,
3859
3877
  { encoding: "utf-8", timeout: 5e3 }
3860
3878
  ).trim();
@@ -3867,13 +3885,13 @@ function macKeychainSet(value, service = SERVICE) {
3867
3885
  if (process.platform !== "darwin") return false;
3868
3886
  try {
3869
3887
  try {
3870
- execSync2(
3888
+ execSync3(
3871
3889
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
3872
3890
  { timeout: 5e3 }
3873
3891
  );
3874
3892
  } catch {
3875
3893
  }
3876
- execSync2(
3894
+ execSync3(
3877
3895
  `security add-generic-password -s "${service}" -a "${ACCOUNT}" -w "${value}"`,
3878
3896
  { timeout: 5e3 }
3879
3897
  );
@@ -3886,7 +3904,7 @@ function macKeychainDelete(service = SERVICE) {
3886
3904
  if (!nativeKeychainAllowed()) return false;
3887
3905
  if (process.platform !== "darwin") return false;
3888
3906
  try {
3889
- execSync2(
3907
+ execSync3(
3890
3908
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
3891
3909
  { timeout: 5e3 }
3892
3910
  );
@@ -3898,7 +3916,7 @@ function macKeychainDelete(service = SERVICE) {
3898
3916
  function linuxSecretGet(service = SERVICE) {
3899
3917
  if (!linuxSecretAvailable()) return null;
3900
3918
  try {
3901
- return execSync2(
3919
+ return execSync3(
3902
3920
  `secret-tool lookup service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3903
3921
  { encoding: "utf-8", timeout: 5e3 }
3904
3922
  ).trim();
@@ -3909,7 +3927,7 @@ function linuxSecretGet(service = SERVICE) {
3909
3927
  function linuxSecretSet(value, service = SERVICE) {
3910
3928
  if (!linuxSecretAvailable()) return false;
3911
3929
  try {
3912
- execSync2(
3930
+ execSync3(
3913
3931
  `echo -n "${value}" | secret-tool store --label="exe-os master key" service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3914
3932
  { timeout: 5e3 }
3915
3933
  );
@@ -3922,7 +3940,7 @@ function linuxSecretDelete(service = SERVICE) {
3922
3940
  if (!nativeKeychainAllowed()) return false;
3923
3941
  if (process.platform !== "linux") return false;
3924
3942
  try {
3925
- execSync2(
3943
+ execSync3(
3926
3944
  `secret-tool clear service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3927
3945
  { timeout: 5e3 }
3928
3946
  );
@@ -7274,7 +7292,7 @@ var init_session_registry = __esm({
7274
7292
  });
7275
7293
 
7276
7294
  // src/lib/session-key.ts
7277
- import { execSync as execSync3 } from "child_process";
7295
+ import { execSync as execSync4 } from "child_process";
7278
7296
  function normalizeCommand(command) {
7279
7297
  const trimmed = command.trim().toLowerCase();
7280
7298
  const parts = trimmed.split(/[\\/]/);
@@ -7293,7 +7311,7 @@ function resolveRuntimeProcess() {
7293
7311
  let pid = process.ppid;
7294
7312
  for (let i = 0; i < 10; i++) {
7295
7313
  try {
7296
- const info = execSync3(`ps -p ${pid} -o ppid=,comm=`, {
7314
+ const info = execSync4(`ps -p ${pid} -o ppid=,comm=`, {
7297
7315
  encoding: "utf8",
7298
7316
  timeout: 2e3
7299
7317
  }).trim();
@@ -7459,14 +7477,14 @@ var init_transport = __esm({
7459
7477
  });
7460
7478
 
7461
7479
  // src/lib/cc-agent-support.ts
7462
- import { execSync as execSync4 } from "child_process";
7480
+ import { execSync as execSync5 } from "child_process";
7463
7481
  function _resetCcAgentSupportCache() {
7464
7482
  _cachedSupport = null;
7465
7483
  }
7466
7484
  function claudeSupportsAgentFlag() {
7467
7485
  if (_cachedSupport !== null) return _cachedSupport;
7468
7486
  try {
7469
- const helpOutput = execSync4("claude --help 2>&1", {
7487
+ const helpOutput = execSync5("claude --help 2>&1", {
7470
7488
  encoding: "utf-8",
7471
7489
  timeout: 5e3
7472
7490
  });
@@ -7950,7 +7968,7 @@ var init_session_kill_telemetry = __esm({
7950
7968
  });
7951
7969
 
7952
7970
  // src/lib/project-name.ts
7953
- import { execSync as execSync5 } from "child_process";
7971
+ import { execSync as execSync6 } from "child_process";
7954
7972
  import path16 from "path";
7955
7973
  function getProjectName(cwd) {
7956
7974
  const dir = cwd ?? process.cwd();
@@ -7958,7 +7976,7 @@ function getProjectName(cwd) {
7958
7976
  try {
7959
7977
  let repoRoot;
7960
7978
  try {
7961
- const gitCommonDir = execSync5("git rev-parse --path-format=absolute --git-common-dir", {
7979
+ const gitCommonDir = execSync6("git rev-parse --path-format=absolute --git-common-dir", {
7962
7980
  cwd: dir,
7963
7981
  encoding: "utf8",
7964
7982
  timeout: 2e3,
@@ -7966,7 +7984,7 @@ function getProjectName(cwd) {
7966
7984
  }).trim();
7967
7985
  repoRoot = path16.dirname(gitCommonDir);
7968
7986
  } catch {
7969
- repoRoot = execSync5("git rev-parse --show-toplevel", {
7987
+ repoRoot = execSync6("git rev-parse --show-toplevel", {
7970
7988
  cwd: dir,
7971
7989
  encoding: "utf8",
7972
7990
  timeout: 2e3,
@@ -8057,7 +8075,7 @@ var init_session_scope = __esm({
8057
8075
  import crypto6 from "crypto";
8058
8076
  import path17 from "path";
8059
8077
  import os12 from "os";
8060
- import { execSync as execSync6 } from "child_process";
8078
+ import { execSync as execSync7 } from "child_process";
8061
8079
  import { mkdir as mkdir4, writeFile as writeFile4, appendFile } from "fs/promises";
8062
8080
  import { existsSync as existsSync15, readFileSync as readFileSync12 } from "fs";
8063
8081
  async function writeCheckpoint(input) {
@@ -8402,14 +8420,14 @@ function isTmuxSessionAlive(identifier) {
8402
8420
  if (!identifier || identifier === "unknown") return true;
8403
8421
  try {
8404
8422
  if (identifier.startsWith("%")) {
8405
- const output = execSync6("tmux list-panes -a -F '#{pane_id}'", {
8423
+ const output = execSync7("tmux list-panes -a -F '#{pane_id}'", {
8406
8424
  timeout: 2e3,
8407
8425
  encoding: "utf8",
8408
8426
  stdio: ["pipe", "pipe", "pipe"]
8409
8427
  });
8410
8428
  return output.split("\n").some((l) => l.trim() === identifier);
8411
8429
  } else {
8412
- execSync6(`tmux has-session -t ${JSON.stringify(identifier)}`, {
8430
+ execSync7(`tmux has-session -t ${JSON.stringify(identifier)}`, {
8413
8431
  timeout: 2e3,
8414
8432
  stdio: ["pipe", "pipe", "pipe"]
8415
8433
  });
@@ -8418,7 +8436,7 @@ function isTmuxSessionAlive(identifier) {
8418
8436
  } catch {
8419
8437
  if (identifier.startsWith("%")) return true;
8420
8438
  try {
8421
- execSync6("tmux list-sessions", {
8439
+ execSync7("tmux list-sessions", {
8422
8440
  timeout: 2e3,
8423
8441
  stdio: ["pipe", "pipe", "pipe"]
8424
8442
  });
@@ -8433,12 +8451,12 @@ function checkStaleCompletion(taskContext, taskCreatedAt) {
8433
8451
  if (!DELEGATION_KEYWORDS.test(taskContext)) return null;
8434
8452
  try {
8435
8453
  const since = new Date(taskCreatedAt).toISOString();
8436
- const branch = execSync6(
8454
+ const branch = execSync7(
8437
8455
  "git rev-parse --abbrev-ref HEAD 2>/dev/null",
8438
8456
  { encoding: "utf8", timeout: 3e3 }
8439
8457
  ).trim();
8440
8458
  const branchArg = branch && branch !== "HEAD" ? branch : "";
8441
- const commitCount = execSync6(
8459
+ const commitCount = execSync7(
8442
8460
  `git log --oneline --since="${since}" ${branchArg} 2>/dev/null | wc -l`,
8443
8461
  { encoding: "utf8", timeout: 5e3 }
8444
8462
  ).trim();
@@ -9969,7 +9987,7 @@ __export(tmux_routing_exports, {
9969
9987
  spawnEmployee: () => spawnEmployee,
9970
9988
  verifyPaneAtCapacity: () => verifyPaneAtCapacity
9971
9989
  });
9972
- import { execFileSync as execFileSync2, execSync as execSync7 } from "child_process";
9990
+ import { execFileSync as execFileSync2, execSync as execSync8 } from "child_process";
9973
9991
  import { readFileSync as readFileSync13, writeFileSync as writeFileSync8, mkdirSync as mkdirSync9, existsSync as existsSync17, appendFileSync, readdirSync as readdirSync4 } from "fs";
9974
9992
  import path21 from "path";
9975
9993
  import os13 from "os";
@@ -10690,7 +10708,7 @@ function spawnEmployee(employeeName, exeSession, projectDir, opts) {
10690
10708
  let booted = false;
10691
10709
  for (let i = 0; i < 30; i++) {
10692
10710
  try {
10693
- execSync7("sleep 0.5");
10711
+ execSync8("sleep 0.5");
10694
10712
  } catch {
10695
10713
  }
10696
10714
  try {