@askexenow/exe-os 0.8.82 → 0.8.85

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 (97) hide show
  1. package/dist/bin/backfill-conversations.js +746 -595
  2. package/dist/bin/backfill-responses.js +745 -594
  3. package/dist/bin/backfill-vectors.js +312 -226
  4. package/dist/bin/cleanup-stale-review-tasks.js +97 -2
  5. package/dist/bin/cli.js +14360 -12525
  6. package/dist/bin/exe-agent.js +97 -88
  7. package/dist/bin/exe-assign.js +1003 -854
  8. package/dist/bin/exe-boot.js +1260 -323
  9. package/dist/bin/exe-call.js +10 -0
  10. package/dist/bin/exe-cloud.js +32 -9
  11. package/dist/bin/exe-dispatch.js +212 -36
  12. package/dist/bin/exe-doctor.js +403 -6
  13. package/dist/bin/exe-export-behaviors.js +175 -72
  14. package/dist/bin/exe-forget.js +97 -2
  15. package/dist/bin/exe-gateway.js +553 -174
  16. package/dist/bin/exe-healthcheck.js +1 -0
  17. package/dist/bin/exe-heartbeat.js +100 -5
  18. package/dist/bin/exe-kill.js +175 -72
  19. package/dist/bin/exe-launch-agent.js +189 -76
  20. package/dist/bin/exe-link.js +902 -80
  21. package/dist/bin/exe-new-employee.js +41 -11
  22. package/dist/bin/exe-pending-messages.js +96 -2
  23. package/dist/bin/exe-pending-notifications.js +97 -2
  24. package/dist/bin/exe-pending-reviews.js +98 -3
  25. package/dist/bin/exe-rename.js +577 -33
  26. package/dist/bin/exe-review.js +231 -73
  27. package/dist/bin/exe-search.js +989 -226
  28. package/dist/bin/exe-session-cleanup.js +4806 -1665
  29. package/dist/bin/exe-settings.js +20 -5
  30. package/dist/bin/exe-status.js +97 -2
  31. package/dist/bin/exe-team.js +97 -2
  32. package/dist/bin/git-sweep.js +901 -209
  33. package/dist/bin/graph-backfill.js +175 -72
  34. package/dist/bin/graph-export.js +175 -72
  35. package/dist/bin/install.js +38 -7
  36. package/dist/bin/list-providers.js +1 -0
  37. package/dist/bin/scan-tasks.js +906 -213
  38. package/dist/bin/setup.js +870 -271
  39. package/dist/bin/shard-migrate.js +175 -72
  40. package/dist/bin/update.js +4 -3
  41. package/dist/bin/wiki-sync.js +175 -72
  42. package/dist/gateway/index.js +550 -168
  43. package/dist/hooks/bug-report-worker.js +210 -25
  44. package/dist/hooks/commit-complete.js +899 -207
  45. package/dist/hooks/error-recall.js +988 -226
  46. package/dist/hooks/ingest-worker.js +1639 -1195
  47. package/dist/hooks/ingest.js +3 -0
  48. package/dist/hooks/instructions-loaded.js +707 -97
  49. package/dist/hooks/notification.js +699 -89
  50. package/dist/hooks/post-compact.js +714 -104
  51. package/dist/hooks/pre-compact.js +899 -207
  52. package/dist/hooks/pre-tool-use.js +742 -123
  53. package/dist/hooks/prompt-ingest-worker.js +245 -104
  54. package/dist/hooks/prompt-submit.js +995 -233
  55. package/dist/hooks/response-ingest-worker.js +245 -104
  56. package/dist/hooks/session-end.js +3941 -400
  57. package/dist/hooks/session-start.js +1001 -226
  58. package/dist/hooks/stop.js +725 -115
  59. package/dist/hooks/subagent-stop.js +714 -104
  60. package/dist/hooks/summary-worker.js +1970 -1336
  61. package/dist/index.js +1653 -1055
  62. package/dist/lib/cloud-sync.js +907 -86
  63. package/dist/lib/consolidation.js +2 -1
  64. package/dist/lib/database.js +642 -87
  65. package/dist/lib/db-daemon-client.js +503 -0
  66. package/dist/lib/device-registry.js +547 -7
  67. package/dist/lib/embedder.js +14 -28
  68. package/dist/lib/employee-templates.js +84 -74
  69. package/dist/lib/employees.js +9 -0
  70. package/dist/lib/exe-daemon-client.js +16 -29
  71. package/dist/lib/exe-daemon.js +1957 -924
  72. package/dist/lib/hybrid-search.js +988 -226
  73. package/dist/lib/identity.js +87 -67
  74. package/dist/lib/keychain.js +9 -1
  75. package/dist/lib/license.js +3 -3
  76. package/dist/lib/messaging.js +8 -1
  77. package/dist/lib/reminders.js +91 -74
  78. package/dist/lib/schedules.js +96 -2
  79. package/dist/lib/skill-learning.js +103 -85
  80. package/dist/lib/store.js +234 -73
  81. package/dist/lib/tasks.js +113 -24
  82. package/dist/lib/tmux-routing.js +122 -33
  83. package/dist/lib/token-spend.js +273 -0
  84. package/dist/lib/ws-client.js +11 -0
  85. package/dist/mcp/server.js +10874 -5546
  86. package/dist/mcp/tools/complete-reminder.js +94 -77
  87. package/dist/mcp/tools/create-reminder.js +94 -77
  88. package/dist/mcp/tools/create-task.js +810 -27
  89. package/dist/mcp/tools/deactivate-behavior.js +95 -77
  90. package/dist/mcp/tools/list-reminders.js +94 -77
  91. package/dist/mcp/tools/list-tasks.js +31 -1
  92. package/dist/mcp/tools/send-message.js +8 -1
  93. package/dist/mcp/tools/update-task.js +39 -10
  94. package/dist/runtime/index.js +913 -221
  95. package/dist/tui/App.js +1000 -298
  96. package/package.json +6 -1
  97. package/src/commands/exe/build-adv.md +2 -2
@@ -379,6 +379,12 @@ function getClient() {
379
379
  if (!_resilientClient) {
380
380
  throw new Error("Database client not initialized. Call initDatabase() first.");
381
381
  }
382
+ if (process.env.EXE_IS_DAEMON === "1") {
383
+ return _resilientClient;
384
+ }
385
+ if (_daemonClient && _daemonClient._isDaemonActive()) {
386
+ return _daemonClient;
387
+ }
382
388
  return _resilientClient;
383
389
  }
384
390
  function getRawClient() {
@@ -867,6 +873,12 @@ async function ensureSchema() {
867
873
  } catch {
868
874
  }
869
875
  }
876
+ try {
877
+ await client.execute(
878
+ `CREATE INDEX IF NOT EXISTS idx_memories_content_hash ON memories(content_hash, agent_id)`
879
+ );
880
+ } catch {
881
+ }
870
882
  await client.executeMultiple(`
871
883
  CREATE TABLE IF NOT EXISTS entities (
872
884
  id TEXT PRIMARY KEY,
@@ -919,7 +931,30 @@ async function ensureSchema() {
919
931
  entity_id TEXT NOT NULL,
920
932
  PRIMARY KEY (hyperedge_id, entity_id)
921
933
  );
934
+
935
+ CREATE VIRTUAL TABLE IF NOT EXISTS entities_fts USING fts5(
936
+ name,
937
+ content=entities,
938
+ content_rowid=rowid
939
+ );
940
+
941
+ CREATE TRIGGER IF NOT EXISTS entities_fts_ai AFTER INSERT ON entities BEGIN
942
+ INSERT INTO entities_fts(rowid, name) VALUES (new.rowid, new.name);
943
+ END;
944
+
945
+ CREATE TRIGGER IF NOT EXISTS entities_fts_ad AFTER DELETE ON entities BEGIN
946
+ INSERT INTO entities_fts(entities_fts, rowid, name) VALUES('delete', old.rowid, old.name);
947
+ END;
948
+
949
+ CREATE TRIGGER IF NOT EXISTS entities_fts_au AFTER UPDATE ON entities BEGIN
950
+ INSERT INTO entities_fts(entities_fts, rowid, name) VALUES('delete', old.rowid, old.name);
951
+ INSERT INTO entities_fts(rowid, name) VALUES (new.rowid, new.name);
952
+ END;
922
953
  `);
954
+ try {
955
+ await client.execute("INSERT INTO entities_fts(entities_fts) VALUES('rebuild')");
956
+ } catch {
957
+ }
923
958
  await client.executeMultiple(`
924
959
  CREATE TABLE IF NOT EXISTS entity_aliases (
925
960
  alias TEXT NOT NULL PRIMARY KEY,
@@ -1100,6 +1135,33 @@ async function ensureSchema() {
1100
1135
  CREATE INDEX IF NOT EXISTS idx_conversations_channel
1101
1136
  ON conversations(channel_id);
1102
1137
  `);
1138
+ await client.executeMultiple(`
1139
+ CREATE TABLE IF NOT EXISTS session_agent_map (
1140
+ session_uuid TEXT PRIMARY KEY,
1141
+ agent_id TEXT NOT NULL,
1142
+ session_name TEXT,
1143
+ task_id TEXT,
1144
+ project_name TEXT,
1145
+ started_at TEXT NOT NULL
1146
+ );
1147
+
1148
+ CREATE INDEX IF NOT EXISTS idx_session_agent_map_agent
1149
+ ON session_agent_map(agent_id);
1150
+ `);
1151
+ try {
1152
+ const mapCount = await client.execute({ sql: `SELECT COUNT(*) as cnt FROM session_agent_map`, args: [] });
1153
+ if (Number(mapCount.rows[0]?.cnt ?? 0) === 0) {
1154
+ await client.execute({
1155
+ sql: `INSERT OR IGNORE INTO session_agent_map (session_uuid, agent_id, session_name, started_at)
1156
+ SELECT session_id, agent_id, '', MIN(timestamp)
1157
+ FROM memories
1158
+ WHERE session_id IS NOT NULL AND session_id != '' AND agent_id IS NOT NULL AND agent_id != ''
1159
+ GROUP BY session_id, agent_id`,
1160
+ args: []
1161
+ });
1162
+ }
1163
+ } catch {
1164
+ }
1103
1165
  try {
1104
1166
  await client.execute({
1105
1167
  sql: `ALTER TABLE tasks ADD COLUMN budget_tokens INTEGER`,
@@ -1233,8 +1295,30 @@ async function ensureSchema() {
1233
1295
  });
1234
1296
  } catch {
1235
1297
  }
1298
+ for (const col of [
1299
+ "ALTER TABLE memories ADD COLUMN intent TEXT",
1300
+ "ALTER TABLE memories ADD COLUMN outcome TEXT",
1301
+ "ALTER TABLE memories ADD COLUMN domain TEXT",
1302
+ "ALTER TABLE memories ADD COLUMN referenced_entities TEXT",
1303
+ "ALTER TABLE memories ADD COLUMN retrieval_count INTEGER DEFAULT 0",
1304
+ "ALTER TABLE memories ADD COLUMN chain_position TEXT",
1305
+ "ALTER TABLE memories ADD COLUMN review_status TEXT",
1306
+ "ALTER TABLE memories ADD COLUMN context_window_pct INTEGER",
1307
+ "ALTER TABLE memories ADD COLUMN file_paths TEXT",
1308
+ "ALTER TABLE memories ADD COLUMN commit_hash TEXT",
1309
+ "ALTER TABLE memories ADD COLUMN duration_ms INTEGER",
1310
+ "ALTER TABLE memories ADD COLUMN token_cost REAL",
1311
+ "ALTER TABLE memories ADD COLUMN audience TEXT",
1312
+ "ALTER TABLE memories ADD COLUMN language_type TEXT",
1313
+ "ALTER TABLE memories ADD COLUMN parent_memory_id TEXT"
1314
+ ]) {
1315
+ try {
1316
+ await client.execute(col);
1317
+ } catch {
1318
+ }
1319
+ }
1236
1320
  }
1237
- var _client, _resilientClient, initTurso;
1321
+ var _client, _resilientClient, _daemonClient, initTurso;
1238
1322
  var init_database = __esm({
1239
1323
  "src/lib/database.ts"() {
1240
1324
  "use strict";
@@ -1242,6 +1326,7 @@ var init_database = __esm({
1242
1326
  init_employees();
1243
1327
  _client = null;
1244
1328
  _resilientClient = null;
1329
+ _daemonClient = null;
1245
1330
  initTurso = initDatabase;
1246
1331
  }
1247
1332
  });
@@ -1692,10 +1777,12 @@ function handleData(chunk) {
1692
1777
  if (!line) continue;
1693
1778
  try {
1694
1779
  const response = JSON.parse(line);
1695
- const entry = _pending.get(response.id);
1780
+ const id = response.id;
1781
+ if (!id) continue;
1782
+ const entry = _pending.get(id);
1696
1783
  if (entry) {
1697
1784
  clearTimeout(entry.timer);
1698
- _pending.delete(response.id);
1785
+ _pending.delete(id);
1699
1786
  entry.resolve(response);
1700
1787
  }
1701
1788
  } catch {
@@ -1866,6 +1953,9 @@ async function connectEmbedDaemon() {
1866
1953
  return false;
1867
1954
  }
1868
1955
  function sendRequest(texts, priority) {
1956
+ return sendDaemonRequest({ texts, priority });
1957
+ }
1958
+ function sendDaemonRequest(payload, timeoutMs = REQUEST_TIMEOUT_MS) {
1869
1959
  return new Promise((resolve) => {
1870
1960
  if (!_socket || !_connected) {
1871
1961
  resolve({ error: "Not connected" });
@@ -1875,10 +1965,10 @@ function sendRequest(texts, priority) {
1875
1965
  const timer = setTimeout(() => {
1876
1966
  _pending.delete(id);
1877
1967
  resolve({ error: "Request timeout" });
1878
- }, REQUEST_TIMEOUT_MS);
1968
+ }, timeoutMs);
1879
1969
  _pending.set(id, { resolve, timer });
1880
1970
  try {
1881
- _socket.write(JSON.stringify({ id, texts, priority }) + "\n");
1971
+ _socket.write(JSON.stringify({ id, ...payload }) + "\n");
1882
1972
  } catch {
1883
1973
  clearTimeout(timer);
1884
1974
  _pending.delete(id);
@@ -1888,30 +1978,11 @@ function sendRequest(texts, priority) {
1888
1978
  }
1889
1979
  async function pingDaemon() {
1890
1980
  if (!_socket || !_connected) return null;
1891
- return new Promise((resolve) => {
1892
- const id = randomUUID3();
1893
- const timer = setTimeout(() => {
1894
- _pending.delete(id);
1895
- resolve(null);
1896
- }, 5e3);
1897
- _pending.set(id, {
1898
- resolve: (data) => {
1899
- if (data.health) {
1900
- resolve(data.health);
1901
- } else {
1902
- resolve(null);
1903
- }
1904
- },
1905
- timer
1906
- });
1907
- try {
1908
- _socket.write(JSON.stringify({ id, type: "health" }) + "\n");
1909
- } catch {
1910
- clearTimeout(timer);
1911
- _pending.delete(id);
1912
- resolve(null);
1913
- }
1914
- });
1981
+ const response = await sendDaemonRequest({ type: "health" }, 5e3);
1982
+ if (response.health) {
1983
+ return response.health;
1984
+ }
1985
+ return null;
1915
1986
  }
1916
1987
  function killAndRespawnDaemon() {
1917
1988
  process.stderr.write("[exed-client] Killing daemon for restart...\n");
@@ -2129,6 +2200,7 @@ function getProjectName(cwd) {
2129
2200
  // src/lib/store.ts
2130
2201
  init_memory();
2131
2202
  init_database();
2203
+ import { createHash } from "crypto";
2132
2204
 
2133
2205
  // src/lib/keychain.ts
2134
2206
  import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2 } from "fs/promises";
@@ -2163,12 +2235,20 @@ async function getMasterKey() {
2163
2235
  }
2164
2236
  const keyPath = getKeyPath();
2165
2237
  if (!existsSync3(keyPath)) {
2238
+ process.stderr.write(
2239
+ `[keychain] Key not found at ${keyPath} (HOME=${os3.homedir()}, EXE_OS_DIR=${process.env.EXE_OS_DIR ?? "unset"})
2240
+ `
2241
+ );
2166
2242
  return null;
2167
2243
  }
2168
2244
  try {
2169
2245
  const content = await readFile3(keyPath, "utf-8");
2170
2246
  return Buffer.from(content.trim(), "base64");
2171
- } catch {
2247
+ } catch (err) {
2248
+ process.stderr.write(
2249
+ `[keychain] Key read failed at ${keyPath}: ${err instanceof Error ? err.message : String(err)}
2250
+ `
2251
+ );
2172
2252
  return null;
2173
2253
  }
2174
2254
  }
@@ -2307,12 +2387,52 @@ function classifyTier(record) {
2307
2387
  if (["store_memory", "manual"].includes(record.tool_name ?? "") && (record.importance ?? 0) >= 5) return 2;
2308
2388
  return 3;
2309
2389
  }
2390
+ function inferFilePaths(record) {
2391
+ if (!["Read", "Write", "Edit"].includes(record.tool_name)) return null;
2392
+ const firstLine = record.raw_text.split("\n")[0] ?? "";
2393
+ const match = firstLine.match(/(\/[\w./-]+\.\w+)/);
2394
+ return match ? JSON.stringify([match[1]]) : null;
2395
+ }
2396
+ function inferCommitHash(record) {
2397
+ if (record.tool_name !== "Bash") return null;
2398
+ const match = record.raw_text.match(/\b([a-f0-9]{7,40})\b/);
2399
+ return match ? match[1] : null;
2400
+ }
2401
+ function inferLanguageType(record) {
2402
+ const text = record.raw_text;
2403
+ if (!text || text.length < 10) return null;
2404
+ const trimmed = text.trimStart();
2405
+ if (trimmed.startsWith("{") || trimmed.startsWith("[")) return "json";
2406
+ if (/\b(SELECT|INSERT|UPDATE|DELETE|CREATE TABLE|ALTER TABLE)\b/i.test(text)) return "sql";
2407
+ if (/\b(function |const |import |export |class |def |async |=>)\b/.test(text)) return "code";
2408
+ if (trimmed.startsWith("#") || trimmed.startsWith("*")) return "prose";
2409
+ return "mixed";
2410
+ }
2411
+ function inferDomain(record) {
2412
+ const proj = (record.project_name ?? "").toLowerCase();
2413
+ if (proj.includes("marketing") || proj.includes("content")) return "marketing";
2414
+ if (proj.includes("crm") || proj.includes("customer")) return "customer";
2415
+ return null;
2416
+ }
2310
2417
  async function writeMemory(record) {
2311
2418
  if (record.vector !== null && record.vector.length !== EMBEDDING_DIM) {
2312
2419
  throw new Error(
2313
2420
  `Expected ${EMBEDDING_DIM}-dim vector, got ${record.vector.length}`
2314
2421
  );
2315
2422
  }
2423
+ const contentHash = createHash("md5").update(record.raw_text).digest("hex");
2424
+ if (_pendingRecords.some((r) => r.content_hash === contentHash && r.agent_id === record.agent_id)) {
2425
+ return;
2426
+ }
2427
+ try {
2428
+ const client = getClient();
2429
+ const existing = await client.execute({
2430
+ sql: "SELECT id FROM memories WHERE content_hash = ? AND agent_id = ? LIMIT 1",
2431
+ args: [contentHash, record.agent_id]
2432
+ });
2433
+ if (existing.rows.length > 0) return;
2434
+ } catch {
2435
+ }
2316
2436
  const dbRow = {
2317
2437
  id: record.id,
2318
2438
  agent_id: record.agent_id,
@@ -2342,7 +2462,23 @@ async function writeMemory(record) {
2342
2462
  supersedes_id: record.supersedes_id ?? null,
2343
2463
  draft: record.draft ? 1 : 0,
2344
2464
  memory_type: record.memory_type ?? "raw",
2345
- trajectory: record.trajectory ? JSON.stringify(record.trajectory) : null
2465
+ trajectory: record.trajectory ? JSON.stringify(record.trajectory) : null,
2466
+ content_hash: contentHash,
2467
+ intent: record.intent ?? null,
2468
+ outcome: record.outcome ?? null,
2469
+ domain: record.domain ?? inferDomain(record),
2470
+ referenced_entities: record.referenced_entities ?? null,
2471
+ retrieval_count: record.retrieval_count ?? 0,
2472
+ chain_position: record.chain_position ?? null,
2473
+ review_status: record.review_status ?? null,
2474
+ context_window_pct: record.context_window_pct ?? null,
2475
+ file_paths: record.file_paths ?? inferFilePaths(record),
2476
+ commit_hash: record.commit_hash ?? inferCommitHash(record),
2477
+ duration_ms: record.duration_ms ?? null,
2478
+ token_cost: record.token_cost ?? null,
2479
+ audience: record.audience ?? null,
2480
+ language_type: record.language_type ?? inferLanguageType(record),
2481
+ parent_memory_id: record.parent_memory_id ?? null
2346
2482
  };
2347
2483
  _pendingRecords.push(dbRow);
2348
2484
  orgBus.emit({
@@ -2400,80 +2536,85 @@ async function flushBatch() {
2400
2536
  const draft = row.draft ? 1 : 0;
2401
2537
  const memoryType = row.memory_type ?? "raw";
2402
2538
  const trajectory = row.trajectory ?? null;
2403
- return {
2404
- sql: hasVector ? `INSERT OR IGNORE INTO memories
2405
- (id, agent_id, agent_role, session_id, timestamp,
2539
+ const contentHash = row.content_hash ?? null;
2540
+ const intent = row.intent ?? null;
2541
+ const outcome = row.outcome ?? null;
2542
+ const domain = row.domain ?? null;
2543
+ const referencedEntities = row.referenced_entities ?? null;
2544
+ const retrievalCount = row.retrieval_count ?? 0;
2545
+ const chainPosition = row.chain_position ?? null;
2546
+ const reviewStatus = row.review_status ?? null;
2547
+ const contextWindowPct = row.context_window_pct ?? null;
2548
+ const filePaths = row.file_paths ?? null;
2549
+ const commitHash = row.commit_hash ?? null;
2550
+ const durationMs = row.duration_ms ?? null;
2551
+ const tokenCost = row.token_cost ?? null;
2552
+ const audience = row.audience ?? null;
2553
+ const languageType = row.language_type ?? null;
2554
+ const parentMemoryId = row.parent_memory_id ?? null;
2555
+ const cols = `id, agent_id, agent_role, session_id, timestamp,
2406
2556
  tool_name, project_name,
2407
2557
  has_error, raw_text, vector, version, task_id, importance, status,
2408
2558
  confidence, last_accessed,
2409
2559
  workspace_id, document_id, user_id, char_offset, page_number,
2410
- source_path, source_type, tier, supersedes_id, draft, memory_type, trajectory)
2411
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, vector32(?), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)` : `INSERT OR IGNORE INTO memories
2412
- (id, agent_id, agent_role, session_id, timestamp,
2413
- tool_name, project_name,
2414
- has_error, raw_text, vector, version, task_id, importance, status,
2415
- confidence, last_accessed,
2416
- workspace_id, document_id, user_id, char_offset, page_number,
2417
- source_path, source_type, tier, supersedes_id, draft, memory_type, trajectory)
2418
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, NULL, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
2419
- args: hasVector ? [
2420
- row.id,
2421
- row.agent_id,
2422
- row.agent_role,
2423
- row.session_id,
2424
- row.timestamp,
2425
- row.tool_name,
2426
- row.project_name,
2427
- row.has_error,
2428
- row.raw_text,
2429
- vectorToBlob(row.vector),
2430
- row.version,
2431
- taskId,
2432
- importance,
2433
- status,
2434
- confidence,
2435
- lastAccessed,
2436
- workspaceId,
2437
- documentId,
2438
- userId,
2439
- charOffset,
2440
- pageNumber,
2441
- sourcePath,
2442
- sourceType,
2443
- tier,
2444
- supersedesId,
2445
- draft,
2446
- memoryType,
2447
- trajectory
2448
- ] : [
2449
- row.id,
2450
- row.agent_id,
2451
- row.agent_role,
2452
- row.session_id,
2453
- row.timestamp,
2454
- row.tool_name,
2455
- row.project_name,
2456
- row.has_error,
2457
- row.raw_text,
2458
- row.version,
2459
- taskId,
2460
- importance,
2461
- status,
2462
- confidence,
2463
- lastAccessed,
2464
- workspaceId,
2465
- documentId,
2466
- userId,
2467
- charOffset,
2468
- pageNumber,
2469
- sourcePath,
2470
- sourceType,
2471
- tier,
2472
- supersedesId,
2473
- draft,
2474
- memoryType,
2475
- trajectory
2476
- ]
2560
+ source_path, source_type, tier, supersedes_id, draft, memory_type, trajectory, content_hash,
2561
+ intent, outcome, domain, referenced_entities, retrieval_count,
2562
+ chain_position, review_status, context_window_pct, file_paths, commit_hash,
2563
+ duration_ms, token_cost, audience, language_type, parent_memory_id`;
2564
+ const metaArgs = [
2565
+ intent,
2566
+ outcome,
2567
+ domain,
2568
+ referencedEntities,
2569
+ retrievalCount,
2570
+ chainPosition,
2571
+ reviewStatus,
2572
+ contextWindowPct,
2573
+ filePaths,
2574
+ commitHash,
2575
+ durationMs,
2576
+ tokenCost,
2577
+ audience,
2578
+ languageType,
2579
+ parentMemoryId
2580
+ ];
2581
+ const baseArgs = [
2582
+ row.id,
2583
+ row.agent_id,
2584
+ row.agent_role,
2585
+ row.session_id,
2586
+ row.timestamp,
2587
+ row.tool_name,
2588
+ row.project_name,
2589
+ row.has_error,
2590
+ row.raw_text
2591
+ ];
2592
+ const sharedArgs = [
2593
+ row.version,
2594
+ taskId,
2595
+ importance,
2596
+ status,
2597
+ confidence,
2598
+ lastAccessed,
2599
+ workspaceId,
2600
+ documentId,
2601
+ userId,
2602
+ charOffset,
2603
+ pageNumber,
2604
+ sourcePath,
2605
+ sourceType,
2606
+ tier,
2607
+ supersedesId,
2608
+ draft,
2609
+ memoryType,
2610
+ trajectory,
2611
+ contentHash
2612
+ ];
2613
+ return {
2614
+ sql: hasVector ? `INSERT OR IGNORE INTO memories (${cols})
2615
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, vector32(?), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)` : `INSERT OR IGNORE INTO memories (${cols})
2616
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, NULL, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
2617
+ args: hasVector ? [...baseArgs, vectorToBlob(row.vector), ...sharedArgs, ...metaArgs] : [...baseArgs, ...sharedArgs, ...metaArgs]
2477
2618
  };
2478
2619
  };
2479
2620
  const globalClient = getClient();
@@ -2545,8 +2686,8 @@ MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEeHztAMOpR/ZMh+rWuOASjEZ54CGY
2545
2686
  -----END PUBLIC KEY-----`;
2546
2687
  var LICENSE_JWT_ALG = "ES256";
2547
2688
  var PLAN_LIMITS = {
2548
- free: { devices: 1, employees: 1, memories: 5e4 },
2549
- pro: { devices: 2, employees: 5, memories: 25e4 },
2689
+ free: { devices: 1, employees: 1, memories: 5e3 },
2690
+ pro: { devices: 3, employees: 5, memories: 1e5 },
2550
2691
  team: { devices: 10, employees: 20, memories: 1e6 },
2551
2692
  agency: { devices: 50, employees: 100, memories: 1e7 },
2552
2693
  enterprise: { devices: -1, employees: -1, memories: -1 }
@@ -2558,7 +2699,7 @@ var FREE_LICENSE = {
2558
2699
  expiresAt: null,
2559
2700
  deviceLimit: 1,
2560
2701
  employeeLimit: 1,
2561
- memoryLimit: 5e4
2702
+ memoryLimit: 5e3
2562
2703
  };
2563
2704
  function loadDeviceId() {
2564
2705
  const deviceJsonPath = path6.join(EXE_AI_DIR, "device.json");