@askexenow/exe-os 0.8.37 → 0.8.38

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 (66) hide show
  1. package/dist/bin/backfill-conversations.js +66 -60
  2. package/dist/bin/backfill-responses.js +7 -8
  3. package/dist/bin/backfill-vectors.js +1 -8
  4. package/dist/bin/cleanup-stale-review-tasks.js +1 -8
  5. package/dist/bin/cli.js +520 -325
  6. package/dist/bin/exe-assign.js +7 -8
  7. package/dist/bin/exe-boot.js +54 -21
  8. package/dist/bin/exe-call.js +9 -4
  9. package/dist/bin/exe-cloud.js +37 -3
  10. package/dist/bin/exe-doctor.js +1 -8
  11. package/dist/bin/exe-export-behaviors.js +4 -11
  12. package/dist/bin/exe-forget.js +1 -8
  13. package/dist/bin/exe-gateway.js +72 -30
  14. package/dist/bin/exe-heartbeat.js +4 -11
  15. package/dist/bin/exe-kill.js +1 -8
  16. package/dist/bin/exe-launch-agent.js +51 -14
  17. package/dist/bin/exe-link.js +13 -3
  18. package/dist/bin/exe-new-employee.js +35 -10
  19. package/dist/bin/exe-pending-messages.js +1 -8
  20. package/dist/bin/exe-pending-notifications.js +1 -8
  21. package/dist/bin/exe-pending-reviews.js +4 -11
  22. package/dist/bin/exe-review.js +7 -8
  23. package/dist/bin/exe-search.js +10 -11
  24. package/dist/bin/exe-session-cleanup.js +11 -12
  25. package/dist/bin/exe-status.js +1 -8
  26. package/dist/bin/exe-team.js +1 -8
  27. package/dist/bin/git-sweep.js +7 -8
  28. package/dist/bin/graph-backfill.js +1 -8
  29. package/dist/bin/graph-export.js +1 -8
  30. package/dist/bin/install.js +9 -0
  31. package/dist/bin/scan-tasks.js +7 -8
  32. package/dist/bin/setup.js +396 -245
  33. package/dist/bin/shard-migrate.js +1 -8
  34. package/dist/bin/wiki-sync.js +1 -8
  35. package/dist/gateway/index.js +30 -30
  36. package/dist/hooks/bug-report-worker.js +4 -11
  37. package/dist/hooks/commit-complete.js +7 -8
  38. package/dist/hooks/error-recall.js +11 -12
  39. package/dist/hooks/ingest-worker.js +24 -9
  40. package/dist/hooks/instructions-loaded.js +7 -8
  41. package/dist/hooks/notification.js +7 -8
  42. package/dist/hooks/post-compact.js +7 -8
  43. package/dist/hooks/pre-compact.js +7 -8
  44. package/dist/hooks/pre-tool-use.js +7 -8
  45. package/dist/hooks/prompt-ingest-worker.js +19 -4
  46. package/dist/hooks/prompt-submit.js +14 -9
  47. package/dist/hooks/response-ingest-worker.js +20 -5
  48. package/dist/hooks/session-end.js +11 -12
  49. package/dist/hooks/session-start.js +11 -12
  50. package/dist/hooks/stop.js +7 -8
  51. package/dist/hooks/subagent-stop.js +7 -8
  52. package/dist/hooks/summary-worker.js +24 -9
  53. package/dist/index.js +11 -5
  54. package/dist/lib/cloud-sync.js +19 -2
  55. package/dist/lib/employee-templates.js +5 -0
  56. package/dist/lib/exe-daemon.js +24 -8
  57. package/dist/lib/hybrid-search.js +10 -11
  58. package/dist/lib/identity-templates.js +16 -7
  59. package/dist/lib/license.js +43 -2
  60. package/dist/lib/schedules.js +1 -8
  61. package/dist/lib/store.js +7 -8
  62. package/dist/mcp/server.js +184 -113
  63. package/dist/mcp/tools/list-tasks.js +35 -27
  64. package/dist/runtime/index.js +7 -2
  65. package/dist/tui/App.js +44 -5
  66. package/package.json +4 -2
@@ -1,12 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
5
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
6
- }) : x)(function(x) {
7
- if (typeof require !== "undefined") return require.apply(this, arguments);
8
- throw Error('Dynamic require of "' + x + '" is not supported');
9
- });
10
4
  var __esm = (fn, res) => function __init() {
11
5
  return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
12
6
  };
@@ -218,7 +212,7 @@ __export(shard_manager_exports, {
218
212
  shardExists: () => shardExists
219
213
  });
220
214
  import path3 from "path";
221
- import { existsSync as existsSync3, mkdirSync } from "fs";
215
+ import { existsSync as existsSync3, mkdirSync, readdirSync } from "fs";
222
216
  import { createClient as createClient2 } from "@libsql/client";
223
217
  function initShardManager(encryptionKey) {
224
218
  _encryptionKey = encryptionKey;
@@ -257,7 +251,6 @@ function shardExists(projectName) {
257
251
  }
258
252
  function listShards() {
259
253
  if (!existsSync3(SHARDS_DIR)) return [];
260
- const { readdirSync } = __require("fs");
261
254
  return readdirSync(SHARDS_DIR).filter((f) => f.endsWith(".db")).map((f) => f.replace(".db", ""));
262
255
  }
263
256
  async function ensureShardSchema(client) {
@@ -1,12 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
5
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
6
- }) : x)(function(x) {
7
- if (typeof require !== "undefined") return require.apply(this, arguments);
8
- throw Error('Dynamic require of "' + x + '" is not supported');
9
- });
10
4
  var __esm = (fn, res) => function __init() {
11
5
  return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
12
6
  };
@@ -218,7 +212,7 @@ __export(shard_manager_exports, {
218
212
  shardExists: () => shardExists
219
213
  });
220
214
  import path3 from "path";
221
- import { existsSync as existsSync3, mkdirSync } from "fs";
215
+ import { existsSync as existsSync3, mkdirSync, readdirSync } from "fs";
222
216
  import { createClient as createClient2 } from "@libsql/client";
223
217
  function initShardManager(encryptionKey) {
224
218
  _encryptionKey = encryptionKey;
@@ -257,7 +251,6 @@ function shardExists(projectName) {
257
251
  }
258
252
  function listShards() {
259
253
  if (!existsSync3(SHARDS_DIR)) return [];
260
- const { readdirSync } = __require("fs");
261
254
  return readdirSync(SHARDS_DIR).filter((f) => f.endsWith(".db")).map((f) => f.replace(".db", ""));
262
255
  }
263
256
  async function ensureShardSchema(client) {
@@ -2,12 +2,6 @@ var __defProp = Object.defineProperty;
2
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
6
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
7
- }) : x)(function(x) {
8
- if (typeof require !== "undefined") return require.apply(this, arguments);
9
- throw Error('Dynamic require of "' + x + '" is not supported');
10
- });
11
5
  var __esm = (fn, res) => function __init() {
12
6
  return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
13
7
  };
@@ -1894,7 +1888,7 @@ __export(shard_manager_exports, {
1894
1888
  shardExists: () => shardExists
1895
1889
  });
1896
1890
  import path4 from "path";
1897
- import { existsSync as existsSync4, mkdirSync } from "fs";
1891
+ import { existsSync as existsSync4, mkdirSync, readdirSync } from "fs";
1898
1892
  import { createClient as createClient2 } from "@libsql/client";
1899
1893
  function initShardManager(encryptionKey) {
1900
1894
  _encryptionKey = encryptionKey;
@@ -1933,8 +1927,7 @@ function shardExists(projectName) {
1933
1927
  }
1934
1928
  function listShards() {
1935
1929
  if (!existsSync4(SHARDS_DIR)) return [];
1936
- const { readdirSync: readdirSync3 } = __require("fs");
1937
- return readdirSync3(SHARDS_DIR).filter((f) => f.endsWith(".db")).map((f) => f.replace(".db", ""));
1930
+ return readdirSync(SHARDS_DIR).filter((f) => f.endsWith(".db")).map((f) => f.replace(".db", ""));
1938
1931
  }
1939
1932
  async function ensureShardSchema(client) {
1940
1933
  await client.execute("PRAGMA journal_mode = WAL");
@@ -2217,6 +2210,12 @@ async function writeMemory(record) {
2217
2210
  supersedes_id: record.supersedes_id ?? null
2218
2211
  };
2219
2212
  _pendingRecords.push(dbRow);
2213
+ const MAX_PENDING = 1e3;
2214
+ if (_pendingRecords.length > MAX_PENDING) {
2215
+ const dropped = _pendingRecords.length - MAX_PENDING;
2216
+ _pendingRecords = _pendingRecords.slice(-MAX_PENDING);
2217
+ console.warn(`[store] Dropped ${dropped} oldest pending records (overflow)`);
2218
+ }
2220
2219
  if (_flushTimer === null) {
2221
2220
  _flushTimer = setInterval(() => {
2222
2221
  void flushBatch();
@@ -2746,7 +2745,7 @@ var init_whatsapp_accounts = __esm({
2746
2745
  // src/lib/session-registry.ts
2747
2746
  import { readFileSync as readFileSync4, writeFileSync, mkdirSync as mkdirSync3, existsSync as existsSync5 } from "fs";
2748
2747
  import path6 from "path";
2749
- import os2 from "os";
2748
+ import os3 from "os";
2750
2749
  function registerSession(entry) {
2751
2750
  const dir = path6.dirname(REGISTRY_PATH);
2752
2751
  if (!existsSync5(dir)) {
@@ -2773,7 +2772,7 @@ var REGISTRY_PATH;
2773
2772
  var init_session_registry = __esm({
2774
2773
  "src/lib/session-registry.ts"() {
2775
2774
  "use strict";
2776
- REGISTRY_PATH = path6.join(os2.homedir(), ".exe-os", "session-registry.json");
2775
+ REGISTRY_PATH = path6.join(os3.homedir(), ".exe-os", "session-registry.json");
2777
2776
  }
2778
2777
  });
2779
2778
 
@@ -2995,7 +2994,7 @@ var init_provider_table = __esm({
2995
2994
  // src/lib/intercom-queue.ts
2996
2995
  import { readFileSync as readFileSync5, writeFileSync as writeFileSync2, renameSync as renameSync2, existsSync as existsSync6, mkdirSync as mkdirSync4 } from "fs";
2997
2996
  import path7 from "path";
2998
- import os3 from "os";
2997
+ import os4 from "os";
2999
2998
  function ensureDir() {
3000
2999
  const dir = path7.dirname(QUEUE_PATH);
3001
3000
  if (!existsSync6(dir)) mkdirSync4(dir, { recursive: true });
@@ -3035,9 +3034,9 @@ var QUEUE_PATH, TTL_MS, INTERCOM_LOG;
3035
3034
  var init_intercom_queue = __esm({
3036
3035
  "src/lib/intercom-queue.ts"() {
3037
3036
  "use strict";
3038
- QUEUE_PATH = path7.join(os3.homedir(), ".exe-os", "intercom-queue.json");
3037
+ QUEUE_PATH = path7.join(os4.homedir(), ".exe-os", "intercom-queue.json");
3039
3038
  TTL_MS = 60 * 60 * 1e3;
3040
- INTERCOM_LOG = path7.join(os3.homedir(), ".exe-os", "intercom.log");
3039
+ INTERCOM_LOG = path7.join(os4.homedir(), ".exe-os", "intercom.log");
3041
3040
  }
3042
3041
  });
3043
3042
 
@@ -3178,7 +3177,7 @@ var init_plan_limits = __esm({
3178
3177
  import { execFileSync as execFileSync2, execSync as execSync4 } from "child_process";
3179
3178
  import { readFileSync as readFileSync9, writeFileSync as writeFileSync4, mkdirSync as mkdirSync6, existsSync as existsSync10, appendFileSync } from "fs";
3180
3179
  import path11 from "path";
3181
- import os4 from "os";
3180
+ import os5 from "os";
3182
3181
  import { fileURLToPath as fileURLToPath2 } from "url";
3183
3182
  import { unlinkSync as unlinkSync2 } from "fs";
3184
3183
  function spawnLockPath(sessionName) {
@@ -3483,7 +3482,7 @@ function spawnEmployee(employeeName, exeSession, projectDir, opts) {
3483
3482
  const transport = getTransport();
3484
3483
  const sessionName = employeeSessionName(employeeName, exeSession, opts?.instance);
3485
3484
  const instanceLabel = opts?.instance != null && opts.instance > 0 ? `${employeeName}${opts.instance}` : employeeName;
3486
- const logDir = path11.join(os4.homedir(), ".exe-os", "session-logs");
3485
+ const logDir = path11.join(os5.homedir(), ".exe-os", "session-logs");
3487
3486
  const logFile = path11.join(logDir, `${instanceLabel}-${Date.now()}.log`);
3488
3487
  if (!existsSync10(logDir)) {
3489
3488
  mkdirSync6(logDir, { recursive: true });
@@ -3499,7 +3498,7 @@ function spawnEmployee(employeeName, exeSession, projectDir, opts) {
3499
3498
  } catch {
3500
3499
  }
3501
3500
  try {
3502
- const claudeJsonPath = path11.join(os4.homedir(), ".claude.json");
3501
+ const claudeJsonPath = path11.join(os5.homedir(), ".claude.json");
3503
3502
  let claudeJson = {};
3504
3503
  try {
3505
3504
  claudeJson = JSON.parse(readFileSync9(claudeJsonPath, "utf8"));
@@ -3514,7 +3513,7 @@ function spawnEmployee(employeeName, exeSession, projectDir, opts) {
3514
3513
  } catch {
3515
3514
  }
3516
3515
  try {
3517
- const settingsDir = path11.join(os4.homedir(), ".claude", "projects");
3516
+ const settingsDir = path11.join(os5.homedir(), ".claude", "projects");
3518
3517
  const normalizedKey = (opts?.cwd ?? projectDir).replace(/\//g, "-").replace(/^-/, "");
3519
3518
  const projSettingsDir = path11.join(settingsDir, normalizedKey);
3520
3519
  const settingsPath = path11.join(projSettingsDir, "settings.json");
@@ -3562,7 +3561,7 @@ function spawnEmployee(employeeName, exeSession, projectDir, opts) {
3562
3561
  let legacyFallbackWarned = false;
3563
3562
  if (!useExeAgent && !useBinSymlink) {
3564
3563
  const identityPath = path11.join(
3565
- os4.homedir(),
3564
+ os5.homedir(),
3566
3565
  ".exe-os",
3567
3566
  "identity",
3568
3567
  `${employeeName}.md`
@@ -3592,7 +3591,7 @@ function spawnEmployee(employeeName, exeSession, projectDir, opts) {
3592
3591
  }
3593
3592
  let sessionContextFlag = "";
3594
3593
  try {
3595
- const ctxDir = path11.join(os4.homedir(), ".exe-os", "session-cache");
3594
+ const ctxDir = path11.join(os5.homedir(), ".exe-os", "session-cache");
3596
3595
  mkdirSync6(ctxDir, { recursive: true });
3597
3596
  const ctxFile = path11.join(ctxDir, `session-context-${sessionName}.md`);
3598
3597
  const ctxContent = [
@@ -3703,11 +3702,11 @@ var init_tmux_routing = __esm({
3703
3702
  init_provider_table();
3704
3703
  init_intercom_queue();
3705
3704
  init_plan_limits();
3706
- SPAWN_LOCK_DIR = path11.join(os4.homedir(), ".exe-os", "spawn-locks");
3707
- SESSION_CACHE = path11.join(os4.homedir(), ".exe-os", "session-cache");
3705
+ SPAWN_LOCK_DIR = path11.join(os5.homedir(), ".exe-os", "spawn-locks");
3706
+ SESSION_CACHE = path11.join(os5.homedir(), ".exe-os", "session-cache");
3708
3707
  BEHAVIORS_EXPORT_TIMEOUT_MS = 1e4;
3709
3708
  INTERCOM_DEBOUNCE_MS = 3e4;
3710
- INTERCOM_LOG2 = path11.join(os4.homedir(), ".exe-os", "intercom.log");
3709
+ INTERCOM_LOG2 = path11.join(os5.homedir(), ".exe-os", "intercom.log");
3711
3710
  DEBOUNCE_FILE = path11.join(SESSION_CACHE, "intercom-debounce.json");
3712
3711
  DEBOUNCE_CLEANUP_AGE_MS = 5 * 60 * 1e3;
3713
3712
  BUSY_PATTERN = /[✻✽✶✳·].*…|Running…/;
@@ -3967,10 +3966,10 @@ var init_messaging = __esm({
3967
3966
  // src/lib/notifications.ts
3968
3967
  import crypto4 from "crypto";
3969
3968
  import path12 from "path";
3970
- import os5 from "os";
3969
+ import os6 from "os";
3971
3970
  import {
3972
3971
  readFileSync as readFileSync10,
3973
- readdirSync,
3972
+ readdirSync as readdirSync2,
3974
3973
  unlinkSync as unlinkSync3,
3975
3974
  existsSync as existsSync11,
3976
3975
  rmdirSync
@@ -4419,7 +4418,7 @@ var init_tasks_crud = __esm({
4419
4418
 
4420
4419
  // src/lib/tasks-review.ts
4421
4420
  import path14 from "path";
4422
- import { existsSync as existsSync13, readdirSync as readdirSync2, unlinkSync as unlinkSync4 } from "fs";
4421
+ import { existsSync as existsSync13, readdirSync as readdirSync3, unlinkSync as unlinkSync4 } from "fs";
4423
4422
  async function countPendingReviews() {
4424
4423
  const client = getClient();
4425
4424
  const result = await client.execute({
@@ -4541,7 +4540,7 @@ async function cleanupReviewFile(row, taskFile, _baseDir) {
4541
4540
  try {
4542
4541
  const cacheDir = path14.join(EXE_AI_DIR, "session-cache");
4543
4542
  if (existsSync13(cacheDir)) {
4544
- for (const f of readdirSync2(cacheDir)) {
4543
+ for (const f of readdirSync3(cacheDir)) {
4545
4544
  if (f.startsWith("review-notified-")) {
4546
4545
  unlinkSync4(path14.join(cacheDir, f));
4547
4546
  }
@@ -8016,11 +8015,12 @@ var SlackAdapter = class {
8016
8015
  // src/gateway/adapters/imessage.ts
8017
8016
  import { execFile } from "child_process";
8018
8017
  import { promisify } from "util";
8018
+ import os2 from "os";
8019
8019
  import path5 from "path";
8020
8020
  var execFileAsync = promisify(execFile);
8021
8021
  var POLL_INTERVAL_MS = 5e3;
8022
8022
  var MESSAGES_DB_PATH = path5.join(
8023
- process.env.HOME ?? "/Users",
8023
+ process.env.HOME ?? os2.homedir(),
8024
8024
  "Library/Messages/chat.db"
8025
8025
  );
8026
8026
  var IMessageAdapter = class {
@@ -8866,8 +8866,8 @@ async function ensureCRMContact(info) {
8866
8866
  import { readFileSync as readFileSync12, writeFileSync as writeFileSync6, existsSync as existsSync14, mkdirSync as mkdirSync8 } from "fs";
8867
8867
  import { randomUUID as randomUUID11 } from "crypto";
8868
8868
  import path18 from "path";
8869
- import os6 from "os";
8870
- var TRIGGERS_PATH = path18.join(os6.homedir(), ".exe-os", "triggers.json");
8869
+ import os7 from "os";
8870
+ var TRIGGERS_PATH = path18.join(os7.homedir(), ".exe-os", "triggers.json");
8871
8871
  function substituteTemplate(template, record) {
8872
8872
  return template.replace(
8873
8873
  /\{\{(\w+(?:\.\w+)*)\}\}/g,
@@ -2,12 +2,6 @@ var __defProp = Object.defineProperty;
2
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
6
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
7
- }) : x)(function(x) {
8
- if (typeof require !== "undefined") return require.apply(this, arguments);
9
- throw Error('Dynamic require of "' + x + '" is not supported');
10
- });
11
5
  var __esm = (fn, res) => function __init() {
12
6
  return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
13
7
  };
@@ -1115,7 +1109,7 @@ __export(shard_manager_exports, {
1115
1109
  shardExists: () => shardExists
1116
1110
  });
1117
1111
  import path3 from "path";
1118
- import { existsSync as existsSync3, mkdirSync } from "fs";
1112
+ import { existsSync as existsSync3, mkdirSync, readdirSync } from "fs";
1119
1113
  import { createClient as createClient2 } from "@libsql/client";
1120
1114
  function initShardManager(encryptionKey) {
1121
1115
  _encryptionKey = encryptionKey;
@@ -1154,8 +1148,7 @@ function shardExists(projectName) {
1154
1148
  }
1155
1149
  function listShards() {
1156
1150
  if (!existsSync3(SHARDS_DIR)) return [];
1157
- const { readdirSync: readdirSync3 } = __require("fs");
1158
- return readdirSync3(SHARDS_DIR).filter((f) => f.endsWith(".db")).map((f) => f.replace(".db", ""));
1151
+ return readdirSync(SHARDS_DIR).filter((f) => f.endsWith(".db")).map((f) => f.replace(".db", ""));
1159
1152
  }
1160
1153
  async function ensureShardSchema(client) {
1161
1154
  await client.execute("PRAGMA journal_mode = WAL");
@@ -1349,7 +1342,7 @@ import path4 from "path";
1349
1342
  import os2 from "os";
1350
1343
  import {
1351
1344
  readFileSync as readFileSync2,
1352
- readdirSync,
1345
+ readdirSync as readdirSync2,
1353
1346
  unlinkSync,
1354
1347
  existsSync as existsSync4,
1355
1348
  rmdirSync
@@ -2612,7 +2605,7 @@ var init_tmux_routing = __esm({
2612
2605
 
2613
2606
  // src/lib/tasks-review.ts
2614
2607
  import path12 from "path";
2615
- import { existsSync as existsSync12, readdirSync as readdirSync2, unlinkSync as unlinkSync3 } from "fs";
2608
+ import { existsSync as existsSync12, readdirSync as readdirSync3, unlinkSync as unlinkSync3 } from "fs";
2616
2609
  var init_tasks_review = __esm({
2617
2610
  "src/lib/tasks-review.ts"() {
2618
2611
  "use strict";
@@ -1,11 +1,5 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __getOwnPropNames = Object.getOwnPropertyNames;
3
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
4
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
5
- }) : x)(function(x) {
6
- if (typeof require !== "undefined") return require.apply(this, arguments);
7
- throw Error('Dynamic require of "' + x + '" is not supported');
8
- });
9
3
  var __esm = (fn, res) => function __init() {
10
4
  return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
11
5
  };
@@ -1184,7 +1178,7 @@ __export(shard_manager_exports, {
1184
1178
  shardExists: () => shardExists
1185
1179
  });
1186
1180
  import path3 from "path";
1187
- import { existsSync as existsSync3, mkdirSync } from "fs";
1181
+ import { existsSync as existsSync3, mkdirSync, readdirSync } from "fs";
1188
1182
  import { createClient as createClient2 } from "@libsql/client";
1189
1183
  function initShardManager(encryptionKey) {
1190
1184
  _encryptionKey = encryptionKey;
@@ -1223,7 +1217,6 @@ function shardExists(projectName) {
1223
1217
  }
1224
1218
  function listShards() {
1225
1219
  if (!existsSync3(SHARDS_DIR)) return [];
1226
- const { readdirSync } = __require("fs");
1227
1220
  return readdirSync(SHARDS_DIR).filter((f) => f.endsWith(".db")).map((f) => f.replace(".db", ""));
1228
1221
  }
1229
1222
  async function ensureShardSchema(client) {
@@ -1507,6 +1500,12 @@ async function writeMemory(record) {
1507
1500
  supersedes_id: record.supersedes_id ?? null
1508
1501
  };
1509
1502
  _pendingRecords.push(dbRow);
1503
+ const MAX_PENDING = 1e3;
1504
+ if (_pendingRecords.length > MAX_PENDING) {
1505
+ const dropped = _pendingRecords.length - MAX_PENDING;
1506
+ _pendingRecords = _pendingRecords.slice(-MAX_PENDING);
1507
+ console.warn(`[store] Dropped ${dropped} oldest pending records (overflow)`);
1508
+ }
1510
1509
  if (_flushTimer === null) {
1511
1510
  _flushTimer = setInterval(() => {
1512
1511
  void flushBatch();
@@ -1,11 +1,5 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __getOwnPropNames = Object.getOwnPropertyNames;
3
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
4
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
5
- }) : x)(function(x) {
6
- if (typeof require !== "undefined") return require.apply(this, arguments);
7
- throw Error('Dynamic require of "' + x + '" is not supported');
8
- });
9
3
  var __esm = (fn, res) => function __init() {
10
4
  return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
11
5
  };
@@ -1224,7 +1218,7 @@ __export(shard_manager_exports, {
1224
1218
  shardExists: () => shardExists
1225
1219
  });
1226
1220
  import path3 from "path";
1227
- import { existsSync as existsSync3, mkdirSync } from "fs";
1221
+ import { existsSync as existsSync3, mkdirSync, readdirSync } from "fs";
1228
1222
  import { createClient as createClient2 } from "@libsql/client";
1229
1223
  function initShardManager(encryptionKey) {
1230
1224
  _encryptionKey = encryptionKey;
@@ -1263,8 +1257,7 @@ function shardExists(projectName) {
1263
1257
  }
1264
1258
  function listShards() {
1265
1259
  if (!existsSync3(SHARDS_DIR)) return [];
1266
- const { readdirSync: readdirSync3 } = __require("fs");
1267
- return readdirSync3(SHARDS_DIR).filter((f) => f.endsWith(".db")).map((f) => f.replace(".db", ""));
1260
+ return readdirSync(SHARDS_DIR).filter((f) => f.endsWith(".db")).map((f) => f.replace(".db", ""));
1268
1261
  }
1269
1262
  async function ensureShardSchema(client) {
1270
1263
  await client.execute("PRAGMA journal_mode = WAL");
@@ -1547,6 +1540,12 @@ async function writeMemory(record) {
1547
1540
  supersedes_id: record.supersedes_id ?? null
1548
1541
  };
1549
1542
  _pendingRecords.push(dbRow);
1543
+ const MAX_PENDING = 1e3;
1544
+ if (_pendingRecords.length > MAX_PENDING) {
1545
+ const dropped = _pendingRecords.length - MAX_PENDING;
1546
+ _pendingRecords = _pendingRecords.slice(-MAX_PENDING);
1547
+ console.warn(`[store] Dropped ${dropped} oldest pending records (overflow)`);
1548
+ }
1550
1549
  if (_flushTimer === null) {
1551
1550
  _flushTimer = setInterval(() => {
1552
1551
  void flushBatch();
@@ -2445,7 +2444,7 @@ __export(file_grep_exports, {
2445
2444
  grepProjectFiles: () => grepProjectFiles
2446
2445
  });
2447
2446
  import { execSync as execSync2 } from "child_process";
2448
- import { readFileSync as readFileSync3, readdirSync, statSync as statSync2, existsSync as existsSync5 } from "fs";
2447
+ import { readFileSync as readFileSync3, readdirSync as readdirSync2, statSync as statSync2, existsSync as existsSync5 } from "fs";
2449
2448
  import path6 from "path";
2450
2449
  import crypto3 from "crypto";
2451
2450
  function hasRipgrep() {
@@ -2590,7 +2589,7 @@ function collectFiles(root, patterns) {
2590
2589
  const basename = path6.basename(dir);
2591
2590
  if (EXCLUDE_DIRS.includes(basename)) return;
2592
2591
  try {
2593
- const entries = readdirSync(dir, { withFileTypes: true });
2592
+ const entries = readdirSync2(dir, { withFileTypes: true });
2594
2593
  for (const entry of entries) {
2595
2594
  if (files.length >= MAX_FILES) return;
2596
2595
  const rel = path6.join(relative, entry.name);
@@ -3242,7 +3241,7 @@ init_database();
3242
3241
 
3243
3242
  // src/adapters/claude/active-agent.ts
3244
3243
  init_config();
3245
- import { readFileSync as readFileSync4, writeFileSync, mkdirSync as mkdirSync2, unlinkSync as unlinkSync2, readdirSync as readdirSync2 } from "fs";
3244
+ import { readFileSync as readFileSync4, writeFileSync, mkdirSync as mkdirSync2, unlinkSync as unlinkSync2, readdirSync as readdirSync3 } from "fs";
3246
3245
  import { execSync as execSync4 } from "child_process";
3247
3246
  import path8 from "path";
3248
3247
 
@@ -1275,7 +1275,7 @@ __export(shard_manager_exports, {
1275
1275
  shardExists: () => shardExists
1276
1276
  });
1277
1277
  import path5 from "path";
1278
- import { existsSync as existsSync4, mkdirSync } from "fs";
1278
+ import { existsSync as existsSync4, mkdirSync, readdirSync as readdirSync2 } from "fs";
1279
1279
  import { createClient as createClient2 } from "@libsql/client";
1280
1280
  function initShardManager(encryptionKey) {
1281
1281
  _encryptionKey = encryptionKey;
@@ -1314,8 +1314,7 @@ function shardExists(projectName) {
1314
1314
  }
1315
1315
  function listShards() {
1316
1316
  if (!existsSync4(SHARDS_DIR)) return [];
1317
- const { readdirSync: readdirSync4 } = __require("fs");
1318
- return readdirSync4(SHARDS_DIR).filter((f) => f.endsWith(".db")).map((f) => f.replace(".db", ""));
1317
+ return readdirSync2(SHARDS_DIR).filter((f) => f.endsWith(".db")).map((f) => f.replace(".db", ""));
1319
1318
  }
1320
1319
  async function ensureShardSchema(client) {
1321
1320
  await client.execute("PRAGMA journal_mode = WAL");
@@ -1509,7 +1508,7 @@ import path6 from "path";
1509
1508
  import os2 from "os";
1510
1509
  import {
1511
1510
  readFileSync as readFileSync3,
1512
- readdirSync as readdirSync2,
1511
+ readdirSync as readdirSync3,
1513
1512
  unlinkSync,
1514
1513
  existsSync as existsSync5,
1515
1514
  rmdirSync
@@ -1697,18 +1696,27 @@ async function validateLicense(apiKey, deviceId) {
1697
1696
  } catch {
1698
1697
  const cached = await getCachedLicense();
1699
1698
  if (cached) return cached;
1700
- return FREE_LICENSE;
1699
+ return { ...FREE_LICENSE, valid: false, error: "offline" };
1700
+ }
1701
+ }
1702
+ function getCacheAgeMs() {
1703
+ try {
1704
+ const { statSync: statSync3 } = __require("fs");
1705
+ const s = statSync3(CACHE_PATH);
1706
+ return Date.now() - s.mtimeMs;
1707
+ } catch {
1708
+ return Infinity;
1701
1709
  }
1702
1710
  }
1703
1711
  async function checkLicense() {
1704
1712
  const key = loadLicense();
1705
1713
  if (!key) return FREE_LICENSE;
1706
1714
  const cached = await getCachedLicense();
1707
- if (cached) return cached;
1715
+ if (cached && getCacheAgeMs() < CACHE_MAX_AGE_MS) return cached;
1708
1716
  const deviceId = loadDeviceId();
1709
1717
  return validateLicense(key, deviceId);
1710
1718
  }
1711
- var LICENSE_PATH, CACHE_PATH, DEVICE_ID_PATH, API_BASE, LICENSE_PUBLIC_KEY_PEM, LICENSE_JWT_ALG, PLAN_LIMITS, FREE_LICENSE;
1719
+ var LICENSE_PATH, CACHE_PATH, DEVICE_ID_PATH, API_BASE, LICENSE_PUBLIC_KEY_PEM, LICENSE_JWT_ALG, PLAN_LIMITS, FREE_LICENSE, CACHE_MAX_AGE_MS;
1712
1720
  var init_license = __esm({
1713
1721
  "src/lib/license.ts"() {
1714
1722
  "use strict";
@@ -1738,6 +1746,7 @@ MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEeHztAMOpR/ZMh+rWuOASjEZ54CGY
1738
1746
  employeeLimit: 1,
1739
1747
  memoryLimit: 5e3
1740
1748
  };
1749
+ CACHE_MAX_AGE_MS = 36e5;
1741
1750
  }
1742
1751
  });
1743
1752
 
@@ -3460,7 +3469,7 @@ var init_tmux_routing = __esm({
3460
3469
 
3461
3470
  // src/lib/tasks-review.ts
3462
3471
  import path15 from "path";
3463
- import { existsSync as existsSync14, readdirSync as readdirSync3, unlinkSync as unlinkSync4 } from "fs";
3472
+ import { existsSync as existsSync14, readdirSync as readdirSync4, unlinkSync as unlinkSync4 } from "fs";
3464
3473
  async function countPendingReviews() {
3465
3474
  const client = getClient();
3466
3475
  const result = await client.execute({
@@ -3582,7 +3591,7 @@ async function cleanupReviewFile(row, taskFile, _baseDir) {
3582
3591
  try {
3583
3592
  const cacheDir = path15.join(EXE_AI_DIR, "session-cache");
3584
3593
  if (existsSync14(cacheDir)) {
3585
- for (const f of readdirSync3(cacheDir)) {
3594
+ for (const f of readdirSync4(cacheDir)) {
3586
3595
  if (f.startsWith("review-notified-")) {
3587
3596
  unlinkSync4(path15.join(cacheDir, f));
3588
3597
  }
@@ -4522,6 +4531,12 @@ async function writeMemory(record) {
4522
4531
  supersedes_id: record.supersedes_id ?? null
4523
4532
  };
4524
4533
  _pendingRecords.push(dbRow);
4534
+ const MAX_PENDING = 1e3;
4535
+ if (_pendingRecords.length > MAX_PENDING) {
4536
+ const dropped = _pendingRecords.length - MAX_PENDING;
4537
+ _pendingRecords = _pendingRecords.slice(-MAX_PENDING);
4538
+ console.warn(`[store] Dropped ${dropped} oldest pending records (overflow)`);
4539
+ }
4525
4540
  if (_flushTimer === null) {
4526
4541
  _flushTimer = setInterval(() => {
4527
4542
  void flushBatch();
@@ -1,11 +1,5 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __getOwnPropNames = Object.getOwnPropertyNames;
3
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
4
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
5
- }) : x)(function(x) {
6
- if (typeof require !== "undefined") return require.apply(this, arguments);
7
- throw Error('Dynamic require of "' + x + '" is not supported');
8
- });
9
3
  var __esm = (fn, res) => function __init() {
10
4
  return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
11
5
  };
@@ -1184,7 +1178,7 @@ __export(shard_manager_exports, {
1184
1178
  shardExists: () => shardExists
1185
1179
  });
1186
1180
  import path5 from "path";
1187
- import { existsSync as existsSync4, mkdirSync as mkdirSync3 } from "fs";
1181
+ import { existsSync as existsSync4, mkdirSync as mkdirSync3, readdirSync as readdirSync3 } from "fs";
1188
1182
  import { createClient as createClient2 } from "@libsql/client";
1189
1183
  function initShardManager(encryptionKey) {
1190
1184
  _encryptionKey = encryptionKey;
@@ -1223,7 +1217,6 @@ function shardExists(projectName) {
1223
1217
  }
1224
1218
  function listShards() {
1225
1219
  if (!existsSync4(SHARDS_DIR)) return [];
1226
- const { readdirSync: readdirSync3 } = __require("fs");
1227
1220
  return readdirSync3(SHARDS_DIR).filter((f) => f.endsWith(".db")).map((f) => f.replace(".db", ""));
1228
1221
  }
1229
1222
  async function ensureShardSchema(client) {
@@ -1507,6 +1500,12 @@ async function writeMemory(record) {
1507
1500
  supersedes_id: record.supersedes_id ?? null
1508
1501
  };
1509
1502
  _pendingRecords.push(dbRow);
1503
+ const MAX_PENDING = 1e3;
1504
+ if (_pendingRecords.length > MAX_PENDING) {
1505
+ const dropped = _pendingRecords.length - MAX_PENDING;
1506
+ _pendingRecords = _pendingRecords.slice(-MAX_PENDING);
1507
+ console.warn(`[store] Dropped ${dropped} oldest pending records (overflow)`);
1508
+ }
1510
1509
  if (_flushTimer === null) {
1511
1510
  _flushTimer = setInterval(() => {
1512
1511
  void flushBatch();
@@ -1,11 +1,5 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __getOwnPropNames = Object.getOwnPropertyNames;
3
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
4
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
5
- }) : x)(function(x) {
6
- if (typeof require !== "undefined") return require.apply(this, arguments);
7
- throw Error('Dynamic require of "' + x + '" is not supported');
8
- });
9
3
  var __esm = (fn, res) => function __init() {
10
4
  return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
11
5
  };
@@ -1184,7 +1178,7 @@ __export(shard_manager_exports, {
1184
1178
  shardExists: () => shardExists
1185
1179
  });
1186
1180
  import path4 from "path";
1187
- import { existsSync as existsSync3, mkdirSync as mkdirSync2 } from "fs";
1181
+ import { existsSync as existsSync3, mkdirSync as mkdirSync2, readdirSync as readdirSync2 } from "fs";
1188
1182
  import { createClient as createClient2 } from "@libsql/client";
1189
1183
  function initShardManager(encryptionKey) {
1190
1184
  _encryptionKey = encryptionKey;
@@ -1223,7 +1217,6 @@ function shardExists(projectName) {
1223
1217
  }
1224
1218
  function listShards() {
1225
1219
  if (!existsSync3(SHARDS_DIR)) return [];
1226
- const { readdirSync: readdirSync2 } = __require("fs");
1227
1220
  return readdirSync2(SHARDS_DIR).filter((f) => f.endsWith(".db")).map((f) => f.replace(".db", ""));
1228
1221
  }
1229
1222
  async function ensureShardSchema(client) {
@@ -1507,6 +1500,12 @@ async function writeMemory(record) {
1507
1500
  supersedes_id: record.supersedes_id ?? null
1508
1501
  };
1509
1502
  _pendingRecords.push(dbRow);
1503
+ const MAX_PENDING = 1e3;
1504
+ if (_pendingRecords.length > MAX_PENDING) {
1505
+ const dropped = _pendingRecords.length - MAX_PENDING;
1506
+ _pendingRecords = _pendingRecords.slice(-MAX_PENDING);
1507
+ console.warn(`[store] Dropped ${dropped} oldest pending records (overflow)`);
1508
+ }
1510
1509
  if (_flushTimer === null) {
1511
1510
  _flushTimer = setInterval(() => {
1512
1511
  void flushBatch();
@@ -1,11 +1,5 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __getOwnPropNames = Object.getOwnPropertyNames;
3
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
4
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
5
- }) : x)(function(x) {
6
- if (typeof require !== "undefined") return require.apply(this, arguments);
7
- throw Error('Dynamic require of "' + x + '" is not supported');
8
- });
9
3
  var __esm = (fn, res) => function __init() {
10
4
  return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
11
5
  };
@@ -1184,7 +1178,7 @@ __export(shard_manager_exports, {
1184
1178
  shardExists: () => shardExists
1185
1179
  });
1186
1180
  import path4 from "path";
1187
- import { existsSync as existsSync3, mkdirSync as mkdirSync2 } from "fs";
1181
+ import { existsSync as existsSync3, mkdirSync as mkdirSync2, readdirSync as readdirSync2 } from "fs";
1188
1182
  import { createClient as createClient2 } from "@libsql/client";
1189
1183
  function initShardManager(encryptionKey) {
1190
1184
  _encryptionKey = encryptionKey;
@@ -1223,7 +1217,6 @@ function shardExists(projectName) {
1223
1217
  }
1224
1218
  function listShards() {
1225
1219
  if (!existsSync3(SHARDS_DIR)) return [];
1226
- const { readdirSync: readdirSync2 } = __require("fs");
1227
1220
  return readdirSync2(SHARDS_DIR).filter((f) => f.endsWith(".db")).map((f) => f.replace(".db", ""));
1228
1221
  }
1229
1222
  async function ensureShardSchema(client) {
@@ -1507,6 +1500,12 @@ async function writeMemory(record) {
1507
1500
  supersedes_id: record.supersedes_id ?? null
1508
1501
  };
1509
1502
  _pendingRecords.push(dbRow);
1503
+ const MAX_PENDING = 1e3;
1504
+ if (_pendingRecords.length > MAX_PENDING) {
1505
+ const dropped = _pendingRecords.length - MAX_PENDING;
1506
+ _pendingRecords = _pendingRecords.slice(-MAX_PENDING);
1507
+ console.warn(`[store] Dropped ${dropped} oldest pending records (overflow)`);
1508
+ }
1510
1509
  if (_flushTimer === null) {
1511
1510
  _flushTimer = setInterval(() => {
1512
1511
  void flushBatch();