@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,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
  };
@@ -1488,7 +1482,7 @@ __export(shard_manager_exports, {
1488
1482
  shardExists: () => shardExists
1489
1483
  });
1490
1484
  import path6 from "path";
1491
- import { existsSync as existsSync5, mkdirSync as mkdirSync2 } from "fs";
1485
+ import { existsSync as existsSync5, mkdirSync as mkdirSync2, readdirSync as readdirSync2 } from "fs";
1492
1486
  import { createClient as createClient2 } from "@libsql/client";
1493
1487
  function initShardManager(encryptionKey) {
1494
1488
  _encryptionKey = encryptionKey;
@@ -1527,7 +1521,6 @@ function shardExists(projectName) {
1527
1521
  }
1528
1522
  function listShards() {
1529
1523
  if (!existsSync5(SHARDS_DIR)) return [];
1530
- const { readdirSync: readdirSync2 } = __require("fs");
1531
1524
  return readdirSync2(SHARDS_DIR).filter((f) => f.endsWith(".db")).map((f) => f.replace(".db", ""));
1532
1525
  }
1533
1526
  async function ensureShardSchema(client) {
@@ -1811,6 +1804,12 @@ async function writeMemory(record) {
1811
1804
  supersedes_id: record.supersedes_id ?? null
1812
1805
  };
1813
1806
  _pendingRecords.push(dbRow);
1807
+ const MAX_PENDING = 1e3;
1808
+ if (_pendingRecords.length > MAX_PENDING) {
1809
+ const dropped = _pendingRecords.length - MAX_PENDING;
1810
+ _pendingRecords = _pendingRecords.slice(-MAX_PENDING);
1811
+ console.warn(`[store] Dropped ${dropped} oldest pending records (overflow)`);
1812
+ }
1814
1813
  if (_flushTimer === null) {
1815
1814
  _flushTimer = setInterval(() => {
1816
1815
  void flushBatch();
@@ -280,7 +280,7 @@ __export(shard_manager_exports, {
280
280
  shardExists: () => shardExists
281
281
  });
282
282
  import path4 from "path";
283
- import { existsSync as existsSync3, mkdirSync } from "fs";
283
+ import { existsSync as existsSync3, mkdirSync, readdirSync } from "fs";
284
284
  import { createClient as createClient2 } from "@libsql/client";
285
285
  function initShardManager(encryptionKey) {
286
286
  _encryptionKey = encryptionKey;
@@ -319,7 +319,6 @@ function shardExists(projectName) {
319
319
  }
320
320
  function listShards() {
321
321
  if (!existsSync3(SHARDS_DIR)) return [];
322
- const { readdirSync } = __require("fs");
323
322
  return readdirSync(SHARDS_DIR).filter((f) => f.endsWith(".db")).map((f) => f.replace(".db", ""));
324
323
  }
325
324
  async function ensureShardSchema(client) {
@@ -1964,6 +1963,12 @@ async function writeMemory(record) {
1964
1963
  supersedes_id: record.supersedes_id ?? null
1965
1964
  };
1966
1965
  _pendingRecords.push(dbRow);
1966
+ const MAX_PENDING = 1e3;
1967
+ if (_pendingRecords.length > MAX_PENDING) {
1968
+ const dropped = _pendingRecords.length - MAX_PENDING;
1969
+ _pendingRecords = _pendingRecords.slice(-MAX_PENDING);
1970
+ console.warn(`[store] Dropped ${dropped} oldest pending records (overflow)`);
1971
+ }
1967
1972
  if (_flushTimer === null) {
1968
1973
  _flushTimer = setInterval(() => {
1969
1974
  void flushBatch();
@@ -2260,14 +2265,24 @@ async function validateLicense(apiKey, deviceId) {
2260
2265
  } catch {
2261
2266
  const cached = await getCachedLicense();
2262
2267
  if (cached) return cached;
2263
- return FREE_LICENSE;
2268
+ return { ...FREE_LICENSE, valid: false, error: "offline" };
2269
+ }
2270
+ }
2271
+ var CACHE_MAX_AGE_MS = 36e5;
2272
+ function getCacheAgeMs() {
2273
+ try {
2274
+ const { statSync: statSync2 } = __require("fs");
2275
+ const s = statSync2(CACHE_PATH);
2276
+ return Date.now() - s.mtimeMs;
2277
+ } catch {
2278
+ return Infinity;
2264
2279
  }
2265
2280
  }
2266
2281
  async function checkLicense() {
2267
2282
  const key = loadLicense();
2268
2283
  if (!key) return FREE_LICENSE;
2269
2284
  const cached = await getCachedLicense();
2270
- if (cached) return cached;
2285
+ if (cached && getCacheAgeMs() < CACHE_MAX_AGE_MS) return cached;
2271
2286
  const deviceId = loadDeviceId();
2272
2287
  return validateLicense(key, deviceId);
2273
2288
  }
@@ -1235,7 +1235,7 @@ __export(shard_manager_exports, {
1235
1235
  shardExists: () => shardExists
1236
1236
  });
1237
1237
  import path3 from "path";
1238
- import { existsSync as existsSync3, mkdirSync } from "fs";
1238
+ import { existsSync as existsSync3, mkdirSync, readdirSync } from "fs";
1239
1239
  import { createClient as createClient2 } from "@libsql/client";
1240
1240
  function initShardManager(encryptionKey) {
1241
1241
  _encryptionKey = encryptionKey;
@@ -1274,8 +1274,7 @@ function shardExists(projectName) {
1274
1274
  }
1275
1275
  function listShards() {
1276
1276
  if (!existsSync3(SHARDS_DIR)) return [];
1277
- const { readdirSync: readdirSync5 } = __require("fs");
1278
- return readdirSync5(SHARDS_DIR).filter((f) => f.endsWith(".db")).map((f) => f.replace(".db", ""));
1277
+ return readdirSync(SHARDS_DIR).filter((f) => f.endsWith(".db")).map((f) => f.replace(".db", ""));
1279
1278
  }
1280
1279
  async function ensureShardSchema(client) {
1281
1280
  await client.execute("PRAGMA journal_mode = WAL");
@@ -1558,6 +1557,12 @@ async function writeMemory(record) {
1558
1557
  supersedes_id: record.supersedes_id ?? null
1559
1558
  };
1560
1559
  _pendingRecords.push(dbRow);
1560
+ const MAX_PENDING = 1e3;
1561
+ if (_pendingRecords.length > MAX_PENDING) {
1562
+ const dropped = _pendingRecords.length - MAX_PENDING;
1563
+ _pendingRecords = _pendingRecords.slice(-MAX_PENDING);
1564
+ console.warn(`[store] Dropped ${dropped} oldest pending records (overflow)`);
1565
+ }
1561
1566
  if (_flushTimer === null) {
1562
1567
  _flushTimer = setInterval(() => {
1563
1568
  void flushBatch();
@@ -2456,7 +2461,7 @@ __export(file_grep_exports, {
2456
2461
  grepProjectFiles: () => grepProjectFiles
2457
2462
  });
2458
2463
  import { execSync as execSync2 } from "child_process";
2459
- import { readFileSync as readFileSync3, readdirSync, statSync as statSync2, existsSync as existsSync5 } from "fs";
2464
+ import { readFileSync as readFileSync3, readdirSync as readdirSync2, statSync as statSync2, existsSync as existsSync5 } from "fs";
2460
2465
  import path6 from "path";
2461
2466
  import crypto2 from "crypto";
2462
2467
  function hasRipgrep() {
@@ -2601,7 +2606,7 @@ function collectFiles(root, patterns) {
2601
2606
  const basename = path6.basename(dir);
2602
2607
  if (EXCLUDE_DIRS.includes(basename)) return;
2603
2608
  try {
2604
- const entries = readdirSync(dir, { withFileTypes: true });
2609
+ const entries = readdirSync2(dir, { withFileTypes: true });
2605
2610
  for (const entry of entries) {
2606
2611
  if (files.length >= MAX_FILES) return;
2607
2612
  const rel = path6.join(relative, entry.name);
@@ -4046,7 +4051,7 @@ import path15 from "path";
4046
4051
  import os5 from "os";
4047
4052
  import {
4048
4053
  readFileSync as readFileSync11,
4049
- readdirSync as readdirSync3,
4054
+ readdirSync as readdirSync4,
4050
4055
  unlinkSync as unlinkSync4,
4051
4056
  existsSync as existsSync13,
4052
4057
  rmdirSync
@@ -4304,7 +4309,7 @@ __export(tasks_review_exports, {
4304
4309
  listPendingReviews: () => listPendingReviews
4305
4310
  });
4306
4311
  import path17 from "path";
4307
- import { existsSync as existsSync15, readdirSync as readdirSync4, unlinkSync as unlinkSync5 } from "fs";
4312
+ import { existsSync as existsSync15, readdirSync as readdirSync5, unlinkSync as unlinkSync5 } from "fs";
4308
4313
  async function countPendingReviews() {
4309
4314
  const client = getClient();
4310
4315
  const result = await client.execute({
@@ -4516,7 +4521,7 @@ async function cleanupReviewFile(row, taskFile, _baseDir) {
4516
4521
  try {
4517
4522
  const cacheDir = path17.join(EXE_AI_DIR, "session-cache");
4518
4523
  if (existsSync15(cacheDir)) {
4519
- for (const f of readdirSync4(cacheDir)) {
4524
+ for (const f of readdirSync5(cacheDir)) {
4520
4525
  if (f.startsWith("review-notified-")) {
4521
4526
  unlinkSync5(path17.join(cacheDir, f));
4522
4527
  }
@@ -4906,7 +4911,7 @@ async function recentRecords(agentId, options, limit) {
4906
4911
 
4907
4912
  // src/adapters/claude/active-agent.ts
4908
4913
  init_config();
4909
- import { readFileSync as readFileSync4, writeFileSync, mkdirSync as mkdirSync2, unlinkSync as unlinkSync2, readdirSync as readdirSync2 } from "fs";
4914
+ import { readFileSync as readFileSync4, writeFileSync, mkdirSync as mkdirSync2, unlinkSync as unlinkSync2, readdirSync as readdirSync3 } from "fs";
4910
4915
  import { execSync as execSync4 } from "child_process";
4911
4916
  import path8 from "path";
4912
4917
 
@@ -1170,7 +1170,7 @@ __export(shard_manager_exports, {
1170
1170
  shardExists: () => shardExists
1171
1171
  });
1172
1172
  import path4 from "path";
1173
- import { existsSync as existsSync3, mkdirSync } from "fs";
1173
+ import { existsSync as existsSync3, mkdirSync, readdirSync } from "fs";
1174
1174
  import { createClient as createClient2 } from "@libsql/client";
1175
1175
  function initShardManager(encryptionKey) {
1176
1176
  _encryptionKey = encryptionKey;
@@ -1209,7 +1209,6 @@ function shardExists(projectName) {
1209
1209
  }
1210
1210
  function listShards() {
1211
1211
  if (!existsSync3(SHARDS_DIR)) return [];
1212
- const { readdirSync } = __require("fs");
1213
1212
  return readdirSync(SHARDS_DIR).filter((f) => f.endsWith(".db")).map((f) => f.replace(".db", ""));
1214
1213
  }
1215
1214
  async function ensureShardSchema(client) {
@@ -1937,14 +1936,23 @@ async function validateLicense(apiKey, deviceId) {
1937
1936
  } catch {
1938
1937
  const cached = await getCachedLicense();
1939
1938
  if (cached) return cached;
1940
- return FREE_LICENSE;
1939
+ return { ...FREE_LICENSE, valid: false, error: "offline" };
1940
+ }
1941
+ }
1942
+ function getCacheAgeMs() {
1943
+ try {
1944
+ const { statSync: statSync2 } = __require("fs");
1945
+ const s = statSync2(CACHE_PATH);
1946
+ return Date.now() - s.mtimeMs;
1947
+ } catch {
1948
+ return Infinity;
1941
1949
  }
1942
1950
  }
1943
1951
  async function checkLicense() {
1944
1952
  const key = loadLicense();
1945
1953
  if (!key) return FREE_LICENSE;
1946
1954
  const cached = await getCachedLicense();
1947
- if (cached) return cached;
1955
+ if (cached && getCacheAgeMs() < CACHE_MAX_AGE_MS) return cached;
1948
1956
  const deviceId = loadDeviceId();
1949
1957
  return validateLicense(key, deviceId);
1950
1958
  }
@@ -1958,7 +1966,7 @@ function isFeatureAllowed(license, feature) {
1958
1966
  return license.plan === "team" || license.plan === "agency" || license.plan === "enterprise";
1959
1967
  }
1960
1968
  }
1961
- var LICENSE_PATH, CACHE_PATH, DEVICE_ID_PATH, API_BASE, LICENSE_PUBLIC_KEY_PEM, LICENSE_JWT_ALG, PLAN_LIMITS, FREE_LICENSE;
1969
+ 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;
1962
1970
  var init_license = __esm({
1963
1971
  "src/lib/license.ts"() {
1964
1972
  "use strict";
@@ -1988,6 +1996,7 @@ MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEeHztAMOpR/ZMh+rWuOASjEZ54CGY
1988
1996
  employeeLimit: 1,
1989
1997
  memoryLimit: 5e3
1990
1998
  };
1999
+ CACHE_MAX_AGE_MS = 36e5;
1991
2000
  }
1992
2001
  });
1993
2002
 
@@ -2290,6 +2299,12 @@ async function writeMemory(record) {
2290
2299
  supersedes_id: record.supersedes_id ?? null
2291
2300
  };
2292
2301
  _pendingRecords.push(dbRow);
2302
+ const MAX_PENDING = 1e3;
2303
+ if (_pendingRecords.length > MAX_PENDING) {
2304
+ const dropped = _pendingRecords.length - MAX_PENDING;
2305
+ _pendingRecords = _pendingRecords.slice(-MAX_PENDING);
2306
+ console.warn(`[store] Dropped ${dropped} oldest pending records (overflow)`);
2307
+ }
2293
2308
  if (_flushTimer === null) {
2294
2309
  _flushTimer = setInterval(() => {
2295
2310
  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,8 +1217,7 @@ function shardExists(projectName) {
1223
1217
  }
1224
1218
  function listShards() {
1225
1219
  if (!existsSync3(SHARDS_DIR)) return [];
1226
- const { readdirSync: readdirSync3 } = __require("fs");
1227
- return readdirSync3(SHARDS_DIR).filter((f) => f.endsWith(".db")).map((f) => f.replace(".db", ""));
1220
+ return readdirSync2(SHARDS_DIR).filter((f) => f.endsWith(".db")).map((f) => f.replace(".db", ""));
1228
1221
  }
1229
1222
  async function ensureShardSchema(client) {
1230
1223
  await client.execute("PRAGMA journal_mode = WAL");
@@ -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();
@@ -1872,7 +1871,7 @@ import path5 from "path";
1872
1871
  import os2 from "os";
1873
1872
  import {
1874
1873
  readFileSync as readFileSync3,
1875
- readdirSync as readdirSync2,
1874
+ readdirSync as readdirSync3,
1876
1875
  unlinkSync as unlinkSync2,
1877
1876
  existsSync as existsSync4,
1878
1877
  rmdirSync
@@ -2015,7 +2014,7 @@ async function migrateJsonNotifications() {
2015
2014
  if (!existsSync4(notifDir)) return 0;
2016
2015
  let migrated = 0;
2017
2016
  try {
2018
- const files = readdirSync2(notifDir).filter((f) => f.endsWith(".json"));
2017
+ const files = readdirSync3(notifDir).filter((f) => f.endsWith(".json"));
2019
2018
  if (files.length === 0) return 0;
2020
2019
  const client = getClient();
2021
2020
  for (const file of files) {
@@ -2043,7 +2042,7 @@ async function migrateJsonNotifications() {
2043
2042
  }
2044
2043
  }
2045
2044
  try {
2046
- const remaining = readdirSync2(notifDir);
2045
+ const remaining = readdirSync3(notifDir);
2047
2046
  if (remaining.length === 0) {
2048
2047
  rmdirSync(notifDir);
2049
2048
  }
@@ -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 crypto2 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);
@@ -3137,7 +3136,7 @@ async function recentRecords(agentId, options, limit) {
3137
3136
 
3138
3137
  // src/adapters/claude/active-agent.ts
3139
3138
  init_config();
3140
- import { readFileSync as readFileSync4, writeFileSync, mkdirSync as mkdirSync2, unlinkSync as unlinkSync2, readdirSync as readdirSync2 } from "fs";
3139
+ import { readFileSync as readFileSync4, writeFileSync, mkdirSync as mkdirSync2, unlinkSync as unlinkSync2, readdirSync as readdirSync3 } from "fs";
3141
3140
  import { execSync as execSync4 } from "child_process";
3142
3141
  import path8 from "path";
3143
3142
 
@@ -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
  };
@@ -1203,7 +1197,7 @@ __export(shard_manager_exports, {
1203
1197
  shardExists: () => shardExists
1204
1198
  });
1205
1199
  import path4 from "path";
1206
- import { existsSync as existsSync3, mkdirSync as mkdirSync2 } from "fs";
1200
+ import { existsSync as existsSync3, mkdirSync as mkdirSync2, readdirSync as readdirSync2 } from "fs";
1207
1201
  import { createClient as createClient2 } from "@libsql/client";
1208
1202
  function initShardManager(encryptionKey) {
1209
1203
  _encryptionKey = encryptionKey;
@@ -1242,7 +1236,6 @@ function shardExists(projectName) {
1242
1236
  }
1243
1237
  function listShards() {
1244
1238
  if (!existsSync3(SHARDS_DIR)) return [];
1245
- const { readdirSync: readdirSync2 } = __require("fs");
1246
1239
  return readdirSync2(SHARDS_DIR).filter((f) => f.endsWith(".db")).map((f) => f.replace(".db", ""));
1247
1240
  }
1248
1241
  async function ensureShardSchema(client) {
@@ -1526,6 +1519,12 @@ async function writeMemory(record) {
1526
1519
  supersedes_id: record.supersedes_id ?? null
1527
1520
  };
1528
1521
  _pendingRecords.push(dbRow);
1522
+ const MAX_PENDING = 1e3;
1523
+ if (_pendingRecords.length > MAX_PENDING) {
1524
+ const dropped = _pendingRecords.length - MAX_PENDING;
1525
+ _pendingRecords = _pendingRecords.slice(-MAX_PENDING);
1526
+ console.warn(`[store] Dropped ${dropped} oldest pending records (overflow)`);
1527
+ }
1529
1528
  if (_flushTimer === null) {
1530
1529
  _flushTimer = setInterval(() => {
1531
1530
  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();
@@ -1316,7 +1316,7 @@ __export(shard_manager_exports, {
1316
1316
  shardExists: () => shardExists
1317
1317
  });
1318
1318
  import path3 from "path";
1319
- import { existsSync as existsSync3, mkdirSync } from "fs";
1319
+ import { existsSync as existsSync3, mkdirSync, readdirSync } from "fs";
1320
1320
  import { createClient as createClient2 } from "@libsql/client";
1321
1321
  function initShardManager(encryptionKey) {
1322
1322
  _encryptionKey = encryptionKey;
@@ -1355,8 +1355,7 @@ function shardExists(projectName) {
1355
1355
  }
1356
1356
  function listShards() {
1357
1357
  if (!existsSync3(SHARDS_DIR)) return [];
1358
- const { readdirSync: readdirSync3 } = __require("fs");
1359
- return readdirSync3(SHARDS_DIR).filter((f) => f.endsWith(".db")).map((f) => f.replace(".db", ""));
1358
+ return readdirSync(SHARDS_DIR).filter((f) => f.endsWith(".db")).map((f) => f.replace(".db", ""));
1360
1359
  }
1361
1360
  async function ensureShardSchema(client) {
1362
1361
  await client.execute("PRAGMA journal_mode = WAL");
@@ -1718,14 +1717,23 @@ async function validateLicense(apiKey, deviceId) {
1718
1717
  } catch {
1719
1718
  const cached = await getCachedLicense();
1720
1719
  if (cached) return cached;
1721
- return FREE_LICENSE;
1720
+ return { ...FREE_LICENSE, valid: false, error: "offline" };
1721
+ }
1722
+ }
1723
+ function getCacheAgeMs() {
1724
+ try {
1725
+ const { statSync: statSync2 } = __require("fs");
1726
+ const s = statSync2(CACHE_PATH);
1727
+ return Date.now() - s.mtimeMs;
1728
+ } catch {
1729
+ return Infinity;
1722
1730
  }
1723
1731
  }
1724
1732
  async function checkLicense() {
1725
1733
  const key = loadLicense();
1726
1734
  if (!key) return FREE_LICENSE;
1727
1735
  const cached = await getCachedLicense();
1728
- if (cached) return cached;
1736
+ if (cached && getCacheAgeMs() < CACHE_MAX_AGE_MS) return cached;
1729
1737
  const deviceId = loadDeviceId();
1730
1738
  return validateLicense(key, deviceId);
1731
1739
  }
@@ -1739,7 +1747,7 @@ function isFeatureAllowed(license, feature) {
1739
1747
  return license.plan === "team" || license.plan === "agency" || license.plan === "enterprise";
1740
1748
  }
1741
1749
  }
1742
- var LICENSE_PATH, CACHE_PATH, DEVICE_ID_PATH, API_BASE, LICENSE_PUBLIC_KEY_PEM, LICENSE_JWT_ALG, PLAN_LIMITS, FREE_LICENSE;
1750
+ 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;
1743
1751
  var init_license = __esm({
1744
1752
  "src/lib/license.ts"() {
1745
1753
  "use strict";
@@ -1769,6 +1777,7 @@ MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEeHztAMOpR/ZMh+rWuOASjEZ54CGY
1769
1777
  employeeLimit: 1,
1770
1778
  memoryLimit: 5e3
1771
1779
  };
1780
+ CACHE_MAX_AGE_MS = 36e5;
1772
1781
  }
1773
1782
  });
1774
1783
 
@@ -2404,7 +2413,7 @@ __export(cloud_sync_exports, {
2404
2413
  mergeConfig: () => mergeConfig,
2405
2414
  mergeRosterFromRemote: () => mergeRosterFromRemote
2406
2415
  });
2407
- import { readFileSync as readFileSync7, writeFileSync as writeFileSync2, existsSync as existsSync9, readdirSync as readdirSync2, mkdirSync as mkdirSync3, appendFileSync } from "fs";
2416
+ import { readFileSync as readFileSync7, writeFileSync as writeFileSync2, existsSync as existsSync9, readdirSync as readdirSync3, mkdirSync as mkdirSync3, appendFileSync } from "fs";
2408
2417
  import path9 from "path";
2409
2418
  import { homedir } from "os";
2410
2419
  function logError(msg) {
@@ -2671,7 +2680,7 @@ function buildRosterBlob(paths) {
2671
2680
  }
2672
2681
  const identities = {};
2673
2682
  if (existsSync9(identityDir)) {
2674
- for (const file of readdirSync2(identityDir).filter((f) => f.endsWith(".md"))) {
2683
+ for (const file of readdirSync3(identityDir).filter((f) => f.endsWith(".md"))) {
2675
2684
  try {
2676
2685
  identities[file] = readFileSync7(path9.join(identityDir, file), "utf-8");
2677
2686
  } catch {
@@ -3280,6 +3289,12 @@ async function writeMemory(record) {
3280
3289
  supersedes_id: record.supersedes_id ?? null
3281
3290
  };
3282
3291
  _pendingRecords.push(dbRow);
3292
+ const MAX_PENDING = 1e3;
3293
+ if (_pendingRecords.length > MAX_PENDING) {
3294
+ const dropped = _pendingRecords.length - MAX_PENDING;
3295
+ _pendingRecords = _pendingRecords.slice(-MAX_PENDING);
3296
+ console.warn(`[store] Dropped ${dropped} oldest pending records (overflow)`);
3297
+ }
3283
3298
  if (_flushTimer === null) {
3284
3299
  _flushTimer = setInterval(() => {
3285
3300
  void flushBatch();
@@ -3439,7 +3454,7 @@ import path4 from "path";
3439
3454
  import os2 from "os";
3440
3455
  import {
3441
3456
  readFileSync as readFileSync2,
3442
- readdirSync,
3457
+ readdirSync as readdirSync2,
3443
3458
  unlinkSync,
3444
3459
  existsSync as existsSync4,
3445
3460
  rmdirSync
package/dist/index.js CHANGED
@@ -4020,7 +4020,7 @@ __export(shard_manager_exports, {
4020
4020
  shardExists: () => shardExists
4021
4021
  });
4022
4022
  import path16 from "path";
4023
- import { existsSync as existsSync12, mkdirSync as mkdirSync6 } from "fs";
4023
+ import { existsSync as existsSync12, mkdirSync as mkdirSync6, readdirSync as readdirSync3 } from "fs";
4024
4024
  import { createClient as createClient2 } from "@libsql/client";
4025
4025
  function initShardManager(encryptionKey) {
4026
4026
  _encryptionKey = encryptionKey;
@@ -4059,7 +4059,6 @@ function shardExists(projectName) {
4059
4059
  }
4060
4060
  function listShards() {
4061
4061
  if (!existsSync12(SHARDS_DIR)) return [];
4062
- const { readdirSync: readdirSync3 } = __require("fs");
4063
4062
  return readdirSync3(SHARDS_DIR).filter((f) => f.endsWith(".db")).map((f) => f.replace(".db", ""));
4064
4063
  }
4065
4064
  async function ensureShardSchema(client) {
@@ -4343,6 +4342,12 @@ async function writeMemory(record) {
4343
4342
  supersedes_id: record.supersedes_id ?? null
4344
4343
  };
4345
4344
  _pendingRecords.push(dbRow);
4345
+ const MAX_PENDING = 1e3;
4346
+ if (_pendingRecords.length > MAX_PENDING) {
4347
+ const dropped = _pendingRecords.length - MAX_PENDING;
4348
+ _pendingRecords = _pendingRecords.slice(-MAX_PENDING);
4349
+ console.warn(`[store] Dropped ${dropped} oldest pending records (overflow)`);
4350
+ }
4346
4351
  if (_flushTimer === null) {
4347
4352
  _flushTimer = setInterval(() => {
4348
4353
  void flushBatch();
@@ -11141,11 +11146,12 @@ var SlackAdapter = class {
11141
11146
  // src/gateway/adapters/imessage.ts
11142
11147
  import { execFile } from "child_process";
11143
11148
  import { promisify } from "util";
11149
+ import os7 from "os";
11144
11150
  import path18 from "path";
11145
11151
  var execFileAsync = promisify(execFile);
11146
11152
  var POLL_INTERVAL_MS = 5e3;
11147
11153
  var MESSAGES_DB_PATH = path18.join(
11148
- process.env.HOME ?? "/Users",
11154
+ process.env.HOME ?? os7.homedir(),
11149
11155
  "Library/Messages/chat.db"
11150
11156
  );
11151
11157
  var IMessageAdapter = class {
@@ -11991,8 +11997,8 @@ async function ensureCRMContact(info) {
11991
11997
  import { readFileSync as readFileSync12, writeFileSync as writeFileSync6, existsSync as existsSync14, mkdirSync as mkdirSync8 } from "fs";
11992
11998
  import { randomUUID as randomUUID14 } from "crypto";
11993
11999
  import path19 from "path";
11994
- import os7 from "os";
11995
- var TRIGGERS_PATH = path19.join(os7.homedir(), ".exe-os", "triggers.json");
12000
+ import os8 from "os";
12001
+ var TRIGGERS_PATH = path19.join(os8.homedir(), ".exe-os", "triggers.json");
11996
12002
  function substituteTemplate(template, record) {
11997
12003
  return template.replace(
11998
12004
  /\{\{(\w+(?:\.\w+)*)\}\}/g,