@askexenow/exe-os 0.8.36 → 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 (77) hide show
  1. package/dist/bin/backfill-conversations.js +75 -61
  2. package/dist/bin/backfill-responses.js +16 -9
  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 +767 -348
  6. package/dist/bin/exe-assign.js +16 -9
  7. package/dist/bin/exe-boot.js +606 -42
  8. package/dist/bin/exe-call.js +9 -4
  9. package/dist/bin/exe-cloud.js +37 -3
  10. package/dist/bin/exe-dispatch.js +43 -3
  11. package/dist/bin/exe-doctor.js +1 -8
  12. package/dist/bin/exe-export-behaviors.js +11 -11
  13. package/dist/bin/exe-forget.js +1 -8
  14. package/dist/bin/exe-gateway.js +127 -37
  15. package/dist/bin/exe-heartbeat.js +6 -12
  16. package/dist/bin/exe-kill.js +8 -8
  17. package/dist/bin/exe-launch-agent.js +59 -15
  18. package/dist/bin/exe-link.js +516 -15
  19. package/dist/bin/exe-new-employee.js +35 -10
  20. package/dist/bin/exe-pending-messages.js +3 -9
  21. package/dist/bin/exe-pending-notifications.js +1 -8
  22. package/dist/bin/exe-pending-reviews.js +6 -12
  23. package/dist/bin/exe-review.js +16 -9
  24. package/dist/bin/exe-search.js +19 -12
  25. package/dist/bin/exe-session-cleanup.js +22 -14
  26. package/dist/bin/exe-status.js +1 -8
  27. package/dist/bin/exe-team.js +1 -8
  28. package/dist/bin/git-sweep.js +16 -9
  29. package/dist/bin/graph-backfill.js +8 -8
  30. package/dist/bin/graph-export.js +8 -8
  31. package/dist/bin/install.js +44 -5
  32. package/dist/bin/scan-tasks.js +16 -9
  33. package/dist/bin/setup.js +396 -245
  34. package/dist/bin/shard-migrate.js +8 -8
  35. package/dist/bin/wiki-sync.js +8 -8
  36. package/dist/gateway/index.js +85 -37
  37. package/dist/hooks/bug-report-worker.js +48 -15
  38. package/dist/hooks/commit-complete.js +16 -9
  39. package/dist/hooks/error-recall.js +21 -14
  40. package/dist/hooks/exe-heartbeat-hook.js +1 -1
  41. package/dist/hooks/ingest-worker.js +79 -16
  42. package/dist/hooks/ingest.js +1 -1
  43. package/dist/hooks/instructions-loaded.js +17 -10
  44. package/dist/hooks/notification.js +17 -10
  45. package/dist/hooks/post-compact.js +17 -10
  46. package/dist/hooks/pre-compact.js +17 -10
  47. package/dist/hooks/pre-tool-use.js +17 -10
  48. package/dist/hooks/prompt-ingest-worker.js +28 -5
  49. package/dist/hooks/prompt-submit.js +69 -16
  50. package/dist/hooks/response-ingest-worker.js +29 -6
  51. package/dist/hooks/session-end.js +21 -14
  52. package/dist/hooks/session-start.js +21 -14
  53. package/dist/hooks/stop.js +17 -10
  54. package/dist/hooks/subagent-stop.js +17 -10
  55. package/dist/hooks/summary-worker.js +536 -22
  56. package/dist/index.js +76 -20
  57. package/dist/lib/cloud-sync.js +521 -13
  58. package/dist/lib/employee-templates.js +5 -0
  59. package/dist/lib/exe-daemon.js +97 -31
  60. package/dist/lib/hybrid-search.js +19 -12
  61. package/dist/lib/identity-templates.js +16 -7
  62. package/dist/lib/license.js +43 -2
  63. package/dist/lib/messaging.js +43 -3
  64. package/dist/lib/schedules.js +1 -8
  65. package/dist/lib/store.js +16 -9
  66. package/dist/lib/tasks.js +47 -7
  67. package/dist/lib/tmux-routing.js +45 -3
  68. package/dist/mcp/server.js +256 -128
  69. package/dist/mcp/tools/create-task.js +48 -8
  70. package/dist/mcp/tools/deactivate-behavior.js +1 -1
  71. package/dist/mcp/tools/list-tasks.js +37 -28
  72. package/dist/mcp/tools/send-message.js +46 -6
  73. package/dist/mcp/tools/update-task.js +3 -2
  74. package/dist/runtime/index.js +61 -6
  75. package/dist/tui/App.js +98 -9
  76. package/package.json +5 -3
  77. package/src/commands/exe/afk.md +116 -0
@@ -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) {
@@ -1445,7 +1438,8 @@ async function writeMemory(record) {
1445
1438
  has_error: record.has_error ? 1 : 0,
1446
1439
  raw_text: record.raw_text,
1447
1440
  vector: record.vector,
1448
- version: _nextVersion++,
1441
+ version: 0,
1442
+ // Placeholder — assigned atomically at flush time
1449
1443
  task_id: record.task_id ?? null,
1450
1444
  importance: record.importance ?? 5,
1451
1445
  status: record.status ?? "active",
@@ -1462,6 +1456,12 @@ async function writeMemory(record) {
1462
1456
  supersedes_id: record.supersedes_id ?? null
1463
1457
  };
1464
1458
  _pendingRecords.push(dbRow);
1459
+ const MAX_PENDING = 1e3;
1460
+ if (_pendingRecords.length > MAX_PENDING) {
1461
+ const dropped = _pendingRecords.length - MAX_PENDING;
1462
+ _pendingRecords = _pendingRecords.slice(-MAX_PENDING);
1463
+ console.warn(`[store] Dropped ${dropped} oldest pending records (overflow)`);
1464
+ }
1465
1465
  if (_flushTimer === null) {
1466
1466
  _flushTimer = setInterval(() => {
1467
1467
  void flushBatch();
@@ -1479,6 +1479,13 @@ async function flushBatch() {
1479
1479
  _flushing = true;
1480
1480
  try {
1481
1481
  const batch = _pendingRecords.slice(0);
1482
+ const client = getClient();
1483
+ const vResult = await client.execute("SELECT MAX(version) as max_v FROM memories");
1484
+ let baseVersion = (Number(vResult.rows[0]?.max_v) || 0) + 1;
1485
+ for (const row of batch) {
1486
+ row.version = baseVersion++;
1487
+ }
1488
+ _nextVersion = baseVersion;
1482
1489
  const buildStmt = (row) => {
1483
1490
  const hasVector = row.vector !== null;
1484
1491
  const taskId = row.task_id ?? null;
@@ -2193,65 +2200,72 @@ async function backfillConversations(options) {
2193
2200
  process.stderr.write(`[backfill-conversations] Found ${files.length} JSONL files to process
2194
2201
  `);
2195
2202
  process.env.EXE_EMBED_PRIORITY = "low";
2196
- for (const file of files) {
2197
- stats.filesScanned++;
2198
- if (existingPaths.has(file)) {
2199
- stats.skippedDedup++;
2200
- continue;
2201
- }
2202
- const conv = await parseConversation(file);
2203
- if (conv.totalMessages < MIN_MESSAGES) {
2204
- stats.skippedTooShort++;
2205
- continue;
2206
- }
2207
- const summary = buildSummary(conv);
2208
- if (options.dryRun) {
2209
- process.stdout.write(`
2203
+ const BATCH_SIZE = 50;
2204
+ const MAX_DEDUP_SIZE = 5e4;
2205
+ for (let batchStart = 0; batchStart < files.length; batchStart += BATCH_SIZE) {
2206
+ const batch = files.slice(batchStart, batchStart + BATCH_SIZE);
2207
+ for (const file of batch) {
2208
+ stats.filesScanned++;
2209
+ if (existingPaths.size < MAX_DEDUP_SIZE && existingPaths.has(file)) {
2210
+ stats.skippedDedup++;
2211
+ continue;
2212
+ }
2213
+ const conv = await parseConversation(file);
2214
+ if (conv.totalMessages < MIN_MESSAGES) {
2215
+ stats.skippedTooShort++;
2216
+ continue;
2217
+ }
2218
+ const summary = buildSummary(conv);
2219
+ if (options.dryRun) {
2220
+ process.stdout.write(`
2210
2221
  \u2500\u2500\u2500 ${file} \u2500\u2500\u2500
2211
2222
  `);
2212
- process.stdout.write(`Project: ${conv.projectName} | Messages: ${conv.totalMessages}`);
2213
- process.stdout.write(` | Tools: ${Object.keys(conv.toolCounts).length}`);
2214
- process.stdout.write(` | Files: ${conv.filesTouched.size}
2223
+ process.stdout.write(`Project: ${conv.projectName} | Messages: ${conv.totalMessages}`);
2224
+ process.stdout.write(` | Tools: ${Object.keys(conv.toolCounts).length}`);
2225
+ process.stdout.write(` | Files: ${conv.filesTouched.size}
2215
2226
  `);
2216
- const firstPrompt = conv.userMessages[0];
2217
- if (firstPrompt) {
2218
- process.stdout.write(`First prompt: ${firstPrompt.slice(0, 120)}
2227
+ const firstPrompt = conv.userMessages[0];
2228
+ if (firstPrompt) {
2229
+ process.stdout.write(`First prompt: ${firstPrompt.slice(0, 120)}
2219
2230
  `);
2231
+ }
2232
+ stats.conversationsStored++;
2233
+ continue;
2220
2234
  }
2221
- stats.conversationsStored++;
2222
- continue;
2223
- }
2224
- let vector = null;
2225
- if (daemonConnected) {
2226
- try {
2227
- vector = await embedViaClient(summary, "low");
2228
- if (!vector) stats.embedFailed++;
2229
- } catch {
2230
- stats.embedFailed++;
2235
+ let vector = null;
2236
+ if (daemonConnected) {
2237
+ try {
2238
+ vector = await embedViaClient(summary, "low");
2239
+ if (!vector) stats.embedFailed++;
2240
+ } catch {
2241
+ stats.embedFailed++;
2242
+ }
2231
2243
  }
2232
- }
2233
- await writeMemory({
2234
- id: crypto2.randomUUID(),
2235
- agent_id: conv.agentId,
2236
- agent_role: conv.agentId === "exe" ? "COO" : "specialist",
2237
- session_id: conv.sessionId,
2238
- timestamp: conv.startTime ?? (/* @__PURE__ */ new Date()).toISOString(),
2239
- tool_name: TOOL_NAME,
2240
- project_name: conv.projectName,
2241
- has_error: conv.errorCount > 0,
2242
- raw_text: summary,
2243
- vector,
2244
- source_path: file,
2245
- source_type: "conversation"
2246
- });
2247
- existingPaths.add(file);
2248
- stats.conversationsStored++;
2249
- if (stats.filesScanned % 50 === 0) {
2250
- process.stderr.write(
2251
- `[backfill-conversations] Progress: ${stats.filesScanned}/${files.length} files, ${stats.conversationsStored} stored
2244
+ await writeMemory({
2245
+ id: crypto2.randomUUID(),
2246
+ agent_id: conv.agentId,
2247
+ agent_role: conv.agentId === "exe" ? "COO" : "specialist",
2248
+ session_id: conv.sessionId,
2249
+ timestamp: conv.startTime ?? (/* @__PURE__ */ new Date()).toISOString(),
2250
+ tool_name: TOOL_NAME,
2251
+ project_name: conv.projectName,
2252
+ has_error: conv.errorCount > 0,
2253
+ raw_text: summary,
2254
+ vector,
2255
+ source_path: file,
2256
+ source_type: "conversation"
2257
+ });
2258
+ if (existingPaths.size < MAX_DEDUP_SIZE) {
2259
+ existingPaths.add(file);
2260
+ }
2261
+ stats.conversationsStored++;
2262
+ if (stats.filesScanned % 50 === 0) {
2263
+ process.stderr.write(
2264
+ `[backfill-conversations] Progress: ${stats.filesScanned}/${files.length} files, ${stats.conversationsStored} stored
2252
2265
  `
2253
- );
2254
- await flushBatch();
2266
+ );
2267
+ await flushBatch();
2268
+ }
2255
2269
  }
2256
2270
  }
2257
2271
  if (!options.dryRun) {
@@ -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) {
@@ -1444,7 +1437,8 @@ async function writeMemory(record) {
1444
1437
  has_error: record.has_error ? 1 : 0,
1445
1438
  raw_text: record.raw_text,
1446
1439
  vector: record.vector,
1447
- version: _nextVersion++,
1440
+ version: 0,
1441
+ // Placeholder — assigned atomically at flush time
1448
1442
  task_id: record.task_id ?? null,
1449
1443
  importance: record.importance ?? 5,
1450
1444
  status: record.status ?? "active",
@@ -1461,6 +1455,12 @@ async function writeMemory(record) {
1461
1455
  supersedes_id: record.supersedes_id ?? null
1462
1456
  };
1463
1457
  _pendingRecords.push(dbRow);
1458
+ const MAX_PENDING = 1e3;
1459
+ if (_pendingRecords.length > MAX_PENDING) {
1460
+ const dropped = _pendingRecords.length - MAX_PENDING;
1461
+ _pendingRecords = _pendingRecords.slice(-MAX_PENDING);
1462
+ console.warn(`[store] Dropped ${dropped} oldest pending records (overflow)`);
1463
+ }
1464
1464
  if (_flushTimer === null) {
1465
1465
  _flushTimer = setInterval(() => {
1466
1466
  void flushBatch();
@@ -1478,6 +1478,13 @@ async function flushBatch() {
1478
1478
  _flushing = true;
1479
1479
  try {
1480
1480
  const batch = _pendingRecords.slice(0);
1481
+ const client = getClient();
1482
+ const vResult = await client.execute("SELECT MAX(version) as max_v FROM memories");
1483
+ let baseVersion = (Number(vResult.rows[0]?.max_v) || 0) + 1;
1484
+ for (const row of batch) {
1485
+ row.version = baseVersion++;
1486
+ }
1487
+ _nextVersion = baseVersion;
1481
1488
  const buildStmt = (row) => {
1482
1489
  const hasVector = row.vector !== null;
1483
1490
  const taskId = row.task_id ?? null;
@@ -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) {