@askexenow/exe-os 0.8.85 → 0.8.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 (57) hide show
  1. package/dist/bin/cleanup-stale-review-tasks.js +57 -19
  2. package/dist/bin/cli.js +507 -337
  3. package/dist/bin/exe-agent-config.js +242 -0
  4. package/dist/bin/exe-agent.js +3 -3
  5. package/dist/bin/exe-boot.js +344 -346
  6. package/dist/bin/exe-dispatch.js +375 -250
  7. package/dist/bin/exe-forget.js +5 -1
  8. package/dist/bin/exe-gateway.js +260 -135
  9. package/dist/bin/exe-healthcheck.js +133 -1
  10. package/dist/bin/exe-heartbeat.js +72 -31
  11. package/dist/bin/exe-link.js +25 -2
  12. package/dist/bin/exe-new-employee.js +22 -0
  13. package/dist/bin/exe-pending-messages.js +55 -17
  14. package/dist/bin/exe-pending-reviews.js +57 -19
  15. package/dist/bin/exe-search.js +6 -2
  16. package/dist/bin/exe-session-cleanup.js +260 -135
  17. package/dist/bin/exe-start-codex.js +2598 -0
  18. package/dist/bin/exe-start.sh +15 -3
  19. package/dist/bin/exe-status.js +57 -19
  20. package/dist/bin/git-sweep.js +391 -266
  21. package/dist/bin/install.js +22 -0
  22. package/dist/bin/scan-tasks.js +394 -269
  23. package/dist/bin/setup.js +47 -2
  24. package/dist/gateway/index.js +257 -132
  25. package/dist/hooks/bug-report-worker.js +242 -117
  26. package/dist/hooks/commit-complete.js +389 -264
  27. package/dist/hooks/error-recall.js +6 -2
  28. package/dist/hooks/ingest-worker.js +314 -193
  29. package/dist/hooks/post-compact.js +84 -46
  30. package/dist/hooks/pre-compact.js +272 -147
  31. package/dist/hooks/pre-tool-use.js +104 -66
  32. package/dist/hooks/prompt-submit.js +126 -66
  33. package/dist/hooks/session-end.js +277 -152
  34. package/dist/hooks/session-start.js +70 -28
  35. package/dist/hooks/stop.js +90 -52
  36. package/dist/hooks/subagent-stop.js +84 -46
  37. package/dist/hooks/summary-worker.js +175 -114
  38. package/dist/index.js +296 -171
  39. package/dist/lib/agent-config.js +167 -0
  40. package/dist/lib/cloud-sync.js +25 -2
  41. package/dist/lib/exe-daemon.js +338 -213
  42. package/dist/lib/hybrid-search.js +7 -2
  43. package/dist/lib/messaging.js +95 -39
  44. package/dist/lib/runtime-table.js +16 -0
  45. package/dist/lib/session-wrappers.js +22 -0
  46. package/dist/lib/tasks.js +242 -117
  47. package/dist/lib/tmux-routing.js +314 -189
  48. package/dist/mcp/server.js +573 -274
  49. package/dist/mcp/tools/create-task.js +260 -135
  50. package/dist/mcp/tools/list-tasks.js +68 -30
  51. package/dist/mcp/tools/send-message.js +100 -44
  52. package/dist/mcp/tools/update-task.js +123 -67
  53. package/dist/runtime/index.js +276 -151
  54. package/dist/tui/App.js +479 -354
  55. package/package.json +1 -1
  56. package/src/commands/exe/agent-config.md +27 -0
  57. package/src/commands/exe/cc-doctor.md +10 -0
@@ -570,18 +570,54 @@ var init_provider_table = __esm({
570
570
  }
571
571
  });
572
572
 
573
- // src/lib/intercom-queue.ts
574
- import { readFileSync as readFileSync4, writeFileSync as writeFileSync2, renameSync as renameSync3, existsSync as existsSync4, mkdirSync } from "fs";
573
+ // src/lib/runtime-table.ts
574
+ var RUNTIME_TABLE;
575
+ var init_runtime_table = __esm({
576
+ "src/lib/runtime-table.ts"() {
577
+ "use strict";
578
+ RUNTIME_TABLE = {
579
+ codex: {
580
+ binary: "codex",
581
+ launchMode: "exec",
582
+ autoApproveFlag: "--full-auto",
583
+ inlineFlag: "--no-alt-screen",
584
+ apiKeyEnv: "OPENAI_API_KEY",
585
+ defaultModel: "gpt-5.4"
586
+ }
587
+ };
588
+ }
589
+ });
590
+
591
+ // src/lib/agent-config.ts
592
+ import { readFileSync as readFileSync4, writeFileSync as writeFileSync2, existsSync as existsSync4, mkdirSync } from "fs";
575
593
  import path5 from "path";
594
+ var AGENT_CONFIG_PATH, DEFAULT_MODELS;
595
+ var init_agent_config = __esm({
596
+ "src/lib/agent-config.ts"() {
597
+ "use strict";
598
+ init_config();
599
+ init_runtime_table();
600
+ AGENT_CONFIG_PATH = path5.join(EXE_AI_DIR, "agent-config.json");
601
+ DEFAULT_MODELS = {
602
+ claude: "claude-opus-4",
603
+ codex: RUNTIME_TABLE.codex?.defaultModel ?? "gpt-5.4",
604
+ opencode: "minimax-m2.7"
605
+ };
606
+ }
607
+ });
608
+
609
+ // src/lib/intercom-queue.ts
610
+ import { readFileSync as readFileSync5, writeFileSync as writeFileSync3, renameSync as renameSync3, existsSync as existsSync5, mkdirSync as mkdirSync2 } from "fs";
611
+ import path6 from "path";
576
612
  import os5 from "os";
577
613
  function ensureDir() {
578
- const dir = path5.dirname(QUEUE_PATH);
579
- if (!existsSync4(dir)) mkdirSync(dir, { recursive: true });
614
+ const dir = path6.dirname(QUEUE_PATH);
615
+ if (!existsSync5(dir)) mkdirSync2(dir, { recursive: true });
580
616
  }
581
617
  function readQueue() {
582
618
  try {
583
- if (!existsSync4(QUEUE_PATH)) return [];
584
- return JSON.parse(readFileSync4(QUEUE_PATH, "utf8"));
619
+ if (!existsSync5(QUEUE_PATH)) return [];
620
+ return JSON.parse(readFileSync5(QUEUE_PATH, "utf8"));
585
621
  } catch {
586
622
  return [];
587
623
  }
@@ -589,7 +625,7 @@ function readQueue() {
589
625
  function writeQueue(queue) {
590
626
  ensureDir();
591
627
  const tmp = `${QUEUE_PATH}.tmp`;
592
- writeFileSync2(tmp, JSON.stringify(queue, null, 2));
628
+ writeFileSync3(tmp, JSON.stringify(queue, null, 2));
593
629
  renameSync3(tmp, QUEUE_PATH);
594
630
  }
595
631
  function queueIntercom(targetSession, reason) {
@@ -613,31 +649,31 @@ var QUEUE_PATH, TTL_MS, INTERCOM_LOG;
613
649
  var init_intercom_queue = __esm({
614
650
  "src/lib/intercom-queue.ts"() {
615
651
  "use strict";
616
- QUEUE_PATH = path5.join(os5.homedir(), ".exe-os", "intercom-queue.json");
652
+ QUEUE_PATH = path6.join(os5.homedir(), ".exe-os", "intercom-queue.json");
617
653
  TTL_MS = 60 * 60 * 1e3;
618
- INTERCOM_LOG = path5.join(os5.homedir(), ".exe-os", "intercom.log");
654
+ INTERCOM_LOG = path6.join(os5.homedir(), ".exe-os", "intercom.log");
619
655
  }
620
656
  });
621
657
 
622
658
  // src/lib/license.ts
623
- import { readFileSync as readFileSync5, writeFileSync as writeFileSync3, existsSync as existsSync5, mkdirSync as mkdirSync2 } from "fs";
659
+ import { readFileSync as readFileSync6, writeFileSync as writeFileSync4, existsSync as existsSync6, mkdirSync as mkdirSync3 } from "fs";
624
660
  import { randomUUID } from "crypto";
625
- import path6 from "path";
661
+ import path7 from "path";
626
662
  import { jwtVerify, importSPKI } from "jose";
627
663
  var LICENSE_PATH, CACHE_PATH, DEVICE_ID_PATH;
628
664
  var init_license = __esm({
629
665
  "src/lib/license.ts"() {
630
666
  "use strict";
631
667
  init_config();
632
- LICENSE_PATH = path6.join(EXE_AI_DIR, "license.key");
633
- CACHE_PATH = path6.join(EXE_AI_DIR, "license-cache.json");
634
- DEVICE_ID_PATH = path6.join(EXE_AI_DIR, "device-id");
668
+ LICENSE_PATH = path7.join(EXE_AI_DIR, "license.key");
669
+ CACHE_PATH = path7.join(EXE_AI_DIR, "license-cache.json");
670
+ DEVICE_ID_PATH = path7.join(EXE_AI_DIR, "device-id");
635
671
  }
636
672
  });
637
673
 
638
674
  // src/lib/plan-limits.ts
639
- import { readFileSync as readFileSync6, existsSync as existsSync6 } from "fs";
640
- import path7 from "path";
675
+ import { readFileSync as readFileSync7, existsSync as existsSync7 } from "fs";
676
+ import path8 from "path";
641
677
  var CACHE_PATH2;
642
678
  var init_plan_limits = __esm({
643
679
  "src/lib/plan-limits.ts"() {
@@ -646,13 +682,13 @@ var init_plan_limits = __esm({
646
682
  init_employees();
647
683
  init_license();
648
684
  init_config();
649
- CACHE_PATH2 = path7.join(EXE_AI_DIR, "license-cache.json");
685
+ CACHE_PATH2 = path8.join(EXE_AI_DIR, "license-cache.json");
650
686
  }
651
687
  });
652
688
 
653
689
  // src/lib/tmux-routing.ts
654
- import { readFileSync as readFileSync7, writeFileSync as writeFileSync4, mkdirSync as mkdirSync3, existsSync as existsSync7, appendFileSync } from "fs";
655
- import path8 from "path";
690
+ import { readFileSync as readFileSync8, writeFileSync as writeFileSync5, mkdirSync as mkdirSync4, existsSync as existsSync8, appendFileSync } from "fs";
691
+ import path9 from "path";
656
692
  import os6 from "os";
657
693
  import { fileURLToPath } from "url";
658
694
  function getMySession() {
@@ -666,7 +702,7 @@ function extractRootExe(name) {
666
702
  }
667
703
  function getParentExe(sessionKey) {
668
704
  try {
669
- const data = JSON.parse(readFileSync7(path8.join(SESSION_CACHE, `parent-exe-${sessionKey}.json`), "utf8"));
705
+ const data = JSON.parse(readFileSync8(path9.join(SESSION_CACHE, `parent-exe-${sessionKey}.json`), "utf8"));
670
706
  return data.parentExe || null;
671
707
  } catch {
672
708
  return null;
@@ -674,8 +710,8 @@ function getParentExe(sessionKey) {
674
710
  }
675
711
  function getDispatchedBy(sessionKey) {
676
712
  try {
677
- const data = JSON.parse(readFileSync7(
678
- path8.join(SESSION_CACHE, `parent-exe-${sessionKey}.json`),
713
+ const data = JSON.parse(readFileSync8(
714
+ path9.join(SESSION_CACHE, `parent-exe-${sessionKey}.json`),
679
715
  "utf8"
680
716
  ));
681
717
  return data.dispatchedBy ?? data.parentExe ?? null;
@@ -698,32 +734,50 @@ function resolveExeSession() {
698
734
  }
699
735
  function readDebounceState() {
700
736
  try {
701
- if (!existsSync7(DEBOUNCE_FILE)) return {};
702
- return JSON.parse(readFileSync7(DEBOUNCE_FILE, "utf8"));
737
+ if (!existsSync8(DEBOUNCE_FILE)) return {};
738
+ const raw = JSON.parse(readFileSync8(DEBOUNCE_FILE, "utf8"));
739
+ const state = {};
740
+ for (const [key, val] of Object.entries(raw)) {
741
+ if (typeof val === "number") {
742
+ state[key] = { lastSent: val, pending: 0 };
743
+ } else if (val && typeof val === "object" && "lastSent" in val) {
744
+ state[key] = val;
745
+ }
746
+ }
747
+ return state;
703
748
  } catch {
704
749
  return {};
705
750
  }
706
751
  }
707
752
  function writeDebounceState(state) {
708
753
  try {
709
- if (!existsSync7(SESSION_CACHE)) mkdirSync3(SESSION_CACHE, { recursive: true });
710
- writeFileSync4(DEBOUNCE_FILE, JSON.stringify(state));
754
+ if (!existsSync8(SESSION_CACHE)) mkdirSync4(SESSION_CACHE, { recursive: true });
755
+ writeFileSync5(DEBOUNCE_FILE, JSON.stringify(state));
711
756
  } catch {
712
757
  }
713
758
  }
714
759
  function isDebounced(targetSession) {
715
760
  const state = readDebounceState();
716
- const lastSent = state[targetSession] ?? 0;
717
- return Date.now() - lastSent < INTERCOM_DEBOUNCE_MS;
761
+ const entry = state[targetSession];
762
+ const lastSent = entry?.lastSent ?? 0;
763
+ if (Date.now() - lastSent < INTERCOM_DEBOUNCE_MS) {
764
+ if (!state[targetSession]) state[targetSession] = { lastSent, pending: 0 };
765
+ state[targetSession].pending++;
766
+ writeDebounceState(state);
767
+ return true;
768
+ }
769
+ return false;
718
770
  }
719
771
  function recordDebounce(targetSession) {
720
772
  const state = readDebounceState();
721
- state[targetSession] = Date.now();
773
+ const batched = state[targetSession]?.pending ?? 0;
774
+ state[targetSession] = { lastSent: Date.now(), pending: 0 };
722
775
  const cutoff = Date.now() - DEBOUNCE_CLEANUP_AGE_MS;
723
776
  for (const key of Object.keys(state)) {
724
- if ((state[key] ?? 0) < cutoff) delete state[key];
777
+ if ((state[key]?.lastSent ?? 0) < cutoff) delete state[key];
725
778
  }
726
779
  writeDebounceState(state);
780
+ return batched;
727
781
  }
728
782
  function logIntercom(msg) {
729
783
  const line = `[${(/* @__PURE__ */ new Date()).toISOString()}] ${msg}
@@ -764,7 +818,7 @@ function sendIntercom(targetSession) {
764
818
  return "skipped_exe";
765
819
  }
766
820
  if (isDebounced(targetSession)) {
767
- logIntercom(`DEBOUNCE \u2192 ${targetSession} (cross-process file debounce)`);
821
+ logIntercom(`DEBOUNCE \u2192 ${targetSession} (nudge batched, task safe in DB)`);
768
822
  return "debounced";
769
823
  }
770
824
  try {
@@ -776,14 +830,14 @@ function sendIntercom(targetSession) {
776
830
  const sessionState = getSessionState(targetSession);
777
831
  if (sessionState === "no_claude") {
778
832
  queueIntercom(targetSession, "claude not running in session");
779
- recordDebounce(targetSession);
780
- logIntercom(`QUEUED \u2192 ${targetSession} (no claude process \u2014 raw shell detected)`);
833
+ const batched2 = recordDebounce(targetSession);
834
+ logIntercom(`QUEUED \u2192 ${targetSession} (no claude process)${batched2 > 0 ? ` [${batched2} batched]` : ""}`);
781
835
  return "queued";
782
836
  }
783
837
  if (sessionState === "thinking" || sessionState === "tool") {
784
838
  queueIntercom(targetSession, "session busy at send time");
785
- recordDebounce(targetSession);
786
- logIntercom(`QUEUED \u2192 ${targetSession} (session busy, will retry from queue)`);
839
+ const batched2 = recordDebounce(targetSession);
840
+ logIntercom(`QUEUED \u2192 ${targetSession} (session busy)${batched2 > 0 ? ` [${batched2} batched]` : ""}`);
787
841
  return "queued";
788
842
  }
789
843
  if (transport.isPaneInCopyMode(targetSession)) {
@@ -791,8 +845,8 @@ function sendIntercom(targetSession) {
791
845
  transport.sendKeys(targetSession, "q");
792
846
  }
793
847
  transport.sendKeys(targetSession, "/exe-intercom");
794
- recordDebounce(targetSession);
795
- logIntercom(`DELIVERED \u2192 ${targetSession} (fire-and-forget)`);
848
+ const batched = recordDebounce(targetSession);
849
+ logIntercom(`DELIVERED \u2192 ${targetSession}${batched > 0 ? ` [${batched} nudges batched during debounce]` : ""} (fire-and-forget)`);
796
850
  return "delivered";
797
851
  } catch {
798
852
  logIntercom(`FAIL \u2192 ${targetSession}`);
@@ -831,14 +885,16 @@ var init_tmux_routing = __esm({
831
885
  init_cc_agent_support();
832
886
  init_mcp_prefix();
833
887
  init_provider_table();
888
+ init_agent_config();
889
+ init_runtime_table();
834
890
  init_intercom_queue();
835
891
  init_plan_limits();
836
892
  init_employees();
837
- SPAWN_LOCK_DIR = path8.join(os6.homedir(), ".exe-os", "spawn-locks");
838
- SESSION_CACHE = path8.join(os6.homedir(), ".exe-os", "session-cache");
893
+ SPAWN_LOCK_DIR = path9.join(os6.homedir(), ".exe-os", "spawn-locks");
894
+ SESSION_CACHE = path9.join(os6.homedir(), ".exe-os", "session-cache");
839
895
  INTERCOM_DEBOUNCE_MS = 3e4;
840
- INTERCOM_LOG2 = path8.join(os6.homedir(), ".exe-os", "intercom.log");
841
- DEBOUNCE_FILE = path8.join(SESSION_CACHE, "intercom-debounce.json");
896
+ INTERCOM_LOG2 = path9.join(os6.homedir(), ".exe-os", "intercom.log");
897
+ DEBOUNCE_FILE = path9.join(SESSION_CACHE, "intercom-debounce.json");
842
898
  DEBOUNCE_CLEANUP_AGE_MS = 5 * 60 * 1e3;
843
899
  BUSY_PATTERN = /[✻✽✶✳·].*…|Running…/;
844
900
  }
@@ -870,11 +926,11 @@ var init_task_scope = __esm({
870
926
 
871
927
  // src/lib/tasks-crud.ts
872
928
  import crypto2 from "crypto";
873
- import path9 from "path";
929
+ import path10 from "path";
874
930
  import os7 from "os";
875
931
  import { execSync as execSync4 } from "child_process";
876
932
  import { mkdir as mkdir3, writeFile as writeFile3, appendFile } from "fs/promises";
877
- import { existsSync as existsSync8, readFileSync as readFileSync8 } from "fs";
933
+ import { existsSync as existsSync9, readFileSync as readFileSync9 } from "fs";
878
934
  async function writeCheckpoint(input) {
879
935
  const client = getClient();
880
936
  const row = await resolveTask(client, input.taskId);
@@ -1159,8 +1215,8 @@ var init_tasks_crud = __esm({
1159
1215
  });
1160
1216
 
1161
1217
  // src/lib/tasks-review.ts
1162
- import path10 from "path";
1163
- import { existsSync as existsSync9, readdirSync as readdirSync2, unlinkSync as unlinkSync3 } from "fs";
1218
+ import path11 from "path";
1219
+ import { existsSync as existsSync10, readdirSync as readdirSync2, unlinkSync as unlinkSync3 } from "fs";
1164
1220
  async function cleanupReviewFile(row, taskFile, _baseDir) {
1165
1221
  if (String(row.assigned_by) !== "system" || !taskFile.includes("review-")) return;
1166
1222
  try {
@@ -1205,11 +1261,11 @@ async function cleanupReviewFile(row, taskFile, _baseDir) {
1205
1261
  );
1206
1262
  }
1207
1263
  try {
1208
- const cacheDir = path10.join(EXE_AI_DIR, "session-cache");
1209
- if (existsSync9(cacheDir)) {
1264
+ const cacheDir = path11.join(EXE_AI_DIR, "session-cache");
1265
+ if (existsSync10(cacheDir)) {
1210
1266
  for (const f of readdirSync2(cacheDir)) {
1211
1267
  if (f.startsWith("review-notified-")) {
1212
- unlinkSync3(path10.join(cacheDir, f));
1268
+ unlinkSync3(path11.join(cacheDir, f));
1213
1269
  }
1214
1270
  }
1215
1271
  }
@@ -1230,7 +1286,7 @@ var init_tasks_review = __esm({
1230
1286
  });
1231
1287
 
1232
1288
  // src/lib/tasks-chain.ts
1233
- import path11 from "path";
1289
+ import path12 from "path";
1234
1290
  import { readFile as readFile3, writeFile as writeFile4 } from "fs/promises";
1235
1291
  async function cascadeUnblock(taskId, baseDir, now) {
1236
1292
  const client = getClient();
@@ -1247,7 +1303,7 @@ async function cascadeUnblock(taskId, baseDir, now) {
1247
1303
  });
1248
1304
  for (const ur of unblockedRows.rows) {
1249
1305
  try {
1250
- const ubFile = path11.join(baseDir, String(ur.task_file));
1306
+ const ubFile = path12.join(baseDir, String(ur.task_file));
1251
1307
  let ubContent = await readFile3(ubFile, "utf-8");
1252
1308
  ubContent = ubContent.replace(/\*\*Status:\*\* blocked/, "**Status:** open");
1253
1309
  ubContent = ubContent.replace(/\n\*\*Blocked by:\*\*.*\n/, "\n");
@@ -1650,17 +1706,17 @@ var init_skill_learning = __esm({
1650
1706
  });
1651
1707
 
1652
1708
  // src/lib/tasks.ts
1653
- import path12 from "path";
1654
- import { writeFileSync as writeFileSync5, mkdirSync as mkdirSync4, unlinkSync as unlinkSync4 } from "fs";
1709
+ import path13 from "path";
1710
+ import { writeFileSync as writeFileSync6, mkdirSync as mkdirSync5, unlinkSync as unlinkSync4 } from "fs";
1655
1711
  async function updateTask(input) {
1656
1712
  const { row, taskFile, now, taskId } = await updateTaskStatus(input);
1657
1713
  try {
1658
1714
  const agent = String(row.assigned_to);
1659
- const cacheDir = path12.join(EXE_AI_DIR, "session-cache");
1660
- const cachePath = path12.join(cacheDir, `current-task-${agent}.json`);
1715
+ const cacheDir = path13.join(EXE_AI_DIR, "session-cache");
1716
+ const cachePath = path13.join(cacheDir, `current-task-${agent}.json`);
1661
1717
  if (input.status === "in_progress") {
1662
- mkdirSync4(cacheDir, { recursive: true });
1663
- writeFileSync5(cachePath, JSON.stringify({ taskId, title: String(row.title) }));
1718
+ mkdirSync5(cacheDir, { recursive: true });
1719
+ writeFileSync6(cachePath, JSON.stringify({ taskId, title: String(row.title) }));
1664
1720
  } else if (input.status === "done" || input.status === "blocked" || input.status === "cancelled") {
1665
1721
  try {
1666
1722
  unlinkSync4(cachePath);
@@ -1820,9 +1876,9 @@ __export(active_agent_exports, {
1820
1876
  resolveActiveAgentFromTmuxSession: () => resolveActiveAgentFromTmuxSession,
1821
1877
  writeActiveAgent: () => writeActiveAgent
1822
1878
  });
1823
- import { readFileSync as readFileSync9, writeFileSync as writeFileSync6, mkdirSync as mkdirSync5, unlinkSync as unlinkSync5, readdirSync as readdirSync3 } from "fs";
1879
+ import { readFileSync as readFileSync10, writeFileSync as writeFileSync7, mkdirSync as mkdirSync6, unlinkSync as unlinkSync5, readdirSync as readdirSync3 } from "fs";
1824
1880
  import { execSync as execSync5 } from "child_process";
1825
- import path13 from "path";
1881
+ import path14 from "path";
1826
1882
  function isNameWithOptionalInstance(candidate, baseName) {
1827
1883
  if (candidate === baseName) return true;
1828
1884
  if (!candidate.startsWith(baseName)) return false;
@@ -1866,12 +1922,12 @@ function resolveActiveAgentFromTmuxSession(sessionName) {
1866
1922
  return null;
1867
1923
  }
1868
1924
  function getMarkerPath() {
1869
- return path13.join(CACHE_DIR, `active-agent-${getSessionKey()}.json`);
1925
+ return path14.join(CACHE_DIR, `active-agent-${getSessionKey()}.json`);
1870
1926
  }
1871
1927
  function writeActiveAgent(agentId, agentRole) {
1872
1928
  try {
1873
- mkdirSync5(CACHE_DIR, { recursive: true });
1874
- writeFileSync6(
1929
+ mkdirSync6(CACHE_DIR, { recursive: true });
1930
+ writeFileSync7(
1875
1931
  getMarkerPath(),
1876
1932
  JSON.stringify({ agentId, agentRole, startedAt: (/* @__PURE__ */ new Date()).toISOString() })
1877
1933
  );
@@ -1887,7 +1943,7 @@ function clearActiveAgent() {
1887
1943
  function getActiveAgent() {
1888
1944
  try {
1889
1945
  const markerPath = getMarkerPath();
1890
- const raw = readFileSync9(markerPath, "utf8");
1946
+ const raw = readFileSync10(markerPath, "utf8");
1891
1947
  const data = JSON.parse(raw);
1892
1948
  if (data.agentId) {
1893
1949
  if (data.startedAt) {
@@ -1935,14 +1991,14 @@ function getAllActiveAgents() {
1935
1991
  const key = file.slice("active-agent-".length, -".json".length);
1936
1992
  if (key === "undefined") continue;
1937
1993
  try {
1938
- const raw = readFileSync9(path13.join(CACHE_DIR, file), "utf8");
1994
+ const raw = readFileSync10(path14.join(CACHE_DIR, file), "utf8");
1939
1995
  const data = JSON.parse(raw);
1940
1996
  if (!data.agentId) continue;
1941
1997
  if (data.startedAt) {
1942
1998
  const age = Date.now() - new Date(data.startedAt).getTime();
1943
1999
  if (age > STALE_MS) {
1944
2000
  try {
1945
- unlinkSync5(path13.join(CACHE_DIR, file));
2001
+ unlinkSync5(path14.join(CACHE_DIR, file));
1946
2002
  } catch {
1947
2003
  }
1948
2004
  continue;
@@ -1965,11 +2021,11 @@ function getAllActiveAgents() {
1965
2021
  function cleanupSessionMarkers() {
1966
2022
  const key = getSessionKey();
1967
2023
  try {
1968
- unlinkSync5(path13.join(CACHE_DIR, `active-agent-${key}.json`));
2024
+ unlinkSync5(path14.join(CACHE_DIR, `active-agent-${key}.json`));
1969
2025
  } catch {
1970
2026
  }
1971
2027
  try {
1972
- unlinkSync5(path13.join(CACHE_DIR, "active-agent-undefined.json"));
2028
+ unlinkSync5(path14.join(CACHE_DIR, "active-agent-undefined.json"));
1973
2029
  } catch {
1974
2030
  }
1975
2031
  }
@@ -1980,7 +2036,7 @@ var init_active_agent = __esm({
1980
2036
  init_config();
1981
2037
  init_session_key2();
1982
2038
  init_employees();
1983
- CACHE_DIR = path13.join(EXE_AI_DIR, "session-cache");
2039
+ CACHE_DIR = path14.join(EXE_AI_DIR, "session-cache");
1984
2040
  STALE_MS = 24 * 60 * 60 * 1e3;
1985
2041
  }
1986
2042
  });