@askexenow/exe-os 0.8.83 → 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.
- package/dist/bin/backfill-conversations.js +746 -595
- package/dist/bin/backfill-responses.js +745 -594
- package/dist/bin/backfill-vectors.js +312 -226
- package/dist/bin/cleanup-stale-review-tasks.js +97 -2
- package/dist/bin/cli.js +14350 -12518
- package/dist/bin/exe-agent.js +97 -88
- package/dist/bin/exe-assign.js +1003 -854
- package/dist/bin/exe-boot.js +1257 -320
- package/dist/bin/exe-call.js +10 -0
- package/dist/bin/exe-cloud.js +29 -6
- package/dist/bin/exe-dispatch.js +210 -34
- package/dist/bin/exe-doctor.js +403 -6
- package/dist/bin/exe-export-behaviors.js +175 -72
- package/dist/bin/exe-forget.js +97 -2
- package/dist/bin/exe-gateway.js +550 -171
- package/dist/bin/exe-healthcheck.js +1 -0
- package/dist/bin/exe-heartbeat.js +100 -5
- package/dist/bin/exe-kill.js +175 -72
- package/dist/bin/exe-launch-agent.js +189 -76
- package/dist/bin/exe-link.js +902 -80
- package/dist/bin/exe-new-employee.js +38 -8
- package/dist/bin/exe-pending-messages.js +96 -2
- package/dist/bin/exe-pending-notifications.js +97 -2
- package/dist/bin/exe-pending-reviews.js +98 -3
- package/dist/bin/exe-rename.js +564 -23
- package/dist/bin/exe-review.js +231 -73
- package/dist/bin/exe-search.js +989 -226
- package/dist/bin/exe-session-cleanup.js +4806 -1665
- package/dist/bin/exe-settings.js +20 -5
- package/dist/bin/exe-status.js +97 -2
- package/dist/bin/exe-team.js +97 -2
- package/dist/bin/git-sweep.js +899 -207
- package/dist/bin/graph-backfill.js +175 -72
- package/dist/bin/graph-export.js +175 -72
- package/dist/bin/install.js +38 -7
- package/dist/bin/list-providers.js +1 -0
- package/dist/bin/scan-tasks.js +904 -211
- package/dist/bin/setup.js +867 -268
- package/dist/bin/shard-migrate.js +175 -72
- package/dist/bin/update.js +1 -0
- package/dist/bin/wiki-sync.js +175 -72
- package/dist/gateway/index.js +548 -166
- package/dist/hooks/bug-report-worker.js +208 -23
- package/dist/hooks/commit-complete.js +897 -205
- package/dist/hooks/error-recall.js +988 -226
- package/dist/hooks/ingest-worker.js +1638 -1194
- package/dist/hooks/ingest.js +3 -0
- package/dist/hooks/instructions-loaded.js +707 -97
- package/dist/hooks/notification.js +699 -89
- package/dist/hooks/post-compact.js +714 -104
- package/dist/hooks/pre-compact.js +897 -205
- package/dist/hooks/pre-tool-use.js +742 -123
- package/dist/hooks/prompt-ingest-worker.js +242 -101
- package/dist/hooks/prompt-submit.js +995 -233
- package/dist/hooks/response-ingest-worker.js +242 -101
- package/dist/hooks/session-end.js +3941 -400
- package/dist/hooks/session-start.js +1001 -226
- package/dist/hooks/stop.js +725 -115
- package/dist/hooks/subagent-stop.js +714 -104
- package/dist/hooks/summary-worker.js +1964 -1330
- package/dist/index.js +1651 -1053
- package/dist/lib/cloud-sync.js +907 -86
- package/dist/lib/consolidation.js +2 -1
- package/dist/lib/database.js +642 -87
- package/dist/lib/db-daemon-client.js +503 -0
- package/dist/lib/device-registry.js +547 -7
- package/dist/lib/embedder.js +14 -28
- package/dist/lib/employee-templates.js +84 -74
- package/dist/lib/employees.js +9 -0
- package/dist/lib/exe-daemon-client.js +16 -29
- package/dist/lib/exe-daemon.js +1955 -922
- package/dist/lib/hybrid-search.js +988 -226
- package/dist/lib/identity.js +87 -67
- package/dist/lib/keychain.js +9 -1
- package/dist/lib/messaging.js +8 -1
- package/dist/lib/reminders.js +91 -74
- package/dist/lib/schedules.js +96 -2
- package/dist/lib/skill-learning.js +103 -85
- package/dist/lib/store.js +234 -73
- package/dist/lib/tasks.js +111 -22
- package/dist/lib/tmux-routing.js +120 -31
- package/dist/lib/token-spend.js +273 -0
- package/dist/lib/ws-client.js +11 -0
- package/dist/mcp/server.js +5222 -475
- package/dist/mcp/tools/complete-reminder.js +94 -77
- package/dist/mcp/tools/create-reminder.js +94 -77
- package/dist/mcp/tools/create-task.js +120 -22
- package/dist/mcp/tools/deactivate-behavior.js +95 -77
- package/dist/mcp/tools/list-reminders.js +94 -77
- package/dist/mcp/tools/list-tasks.js +31 -1
- package/dist/mcp/tools/send-message.js +8 -1
- package/dist/mcp/tools/update-task.js +39 -10
- package/dist/runtime/index.js +911 -219
- package/dist/tui/App.js +997 -295
- package/package.json +6 -1
package/dist/bin/exe-review.js
CHANGED
|
@@ -319,6 +319,12 @@ function getClient() {
|
|
|
319
319
|
if (!_resilientClient) {
|
|
320
320
|
throw new Error("Database client not initialized. Call initDatabase() first.");
|
|
321
321
|
}
|
|
322
|
+
if (process.env.EXE_IS_DAEMON === "1") {
|
|
323
|
+
return _resilientClient;
|
|
324
|
+
}
|
|
325
|
+
if (_daemonClient && _daemonClient._isDaemonActive()) {
|
|
326
|
+
return _daemonClient;
|
|
327
|
+
}
|
|
322
328
|
return _resilientClient;
|
|
323
329
|
}
|
|
324
330
|
function getRawClient() {
|
|
@@ -807,6 +813,12 @@ async function ensureSchema() {
|
|
|
807
813
|
} catch {
|
|
808
814
|
}
|
|
809
815
|
}
|
|
816
|
+
try {
|
|
817
|
+
await client.execute(
|
|
818
|
+
`CREATE INDEX IF NOT EXISTS idx_memories_content_hash ON memories(content_hash, agent_id)`
|
|
819
|
+
);
|
|
820
|
+
} catch {
|
|
821
|
+
}
|
|
810
822
|
await client.executeMultiple(`
|
|
811
823
|
CREATE TABLE IF NOT EXISTS entities (
|
|
812
824
|
id TEXT PRIMARY KEY,
|
|
@@ -859,7 +871,30 @@ async function ensureSchema() {
|
|
|
859
871
|
entity_id TEXT NOT NULL,
|
|
860
872
|
PRIMARY KEY (hyperedge_id, entity_id)
|
|
861
873
|
);
|
|
874
|
+
|
|
875
|
+
CREATE VIRTUAL TABLE IF NOT EXISTS entities_fts USING fts5(
|
|
876
|
+
name,
|
|
877
|
+
content=entities,
|
|
878
|
+
content_rowid=rowid
|
|
879
|
+
);
|
|
880
|
+
|
|
881
|
+
CREATE TRIGGER IF NOT EXISTS entities_fts_ai AFTER INSERT ON entities BEGIN
|
|
882
|
+
INSERT INTO entities_fts(rowid, name) VALUES (new.rowid, new.name);
|
|
883
|
+
END;
|
|
884
|
+
|
|
885
|
+
CREATE TRIGGER IF NOT EXISTS entities_fts_ad AFTER DELETE ON entities BEGIN
|
|
886
|
+
INSERT INTO entities_fts(entities_fts, rowid, name) VALUES('delete', old.rowid, old.name);
|
|
887
|
+
END;
|
|
888
|
+
|
|
889
|
+
CREATE TRIGGER IF NOT EXISTS entities_fts_au AFTER UPDATE ON entities BEGIN
|
|
890
|
+
INSERT INTO entities_fts(entities_fts, rowid, name) VALUES('delete', old.rowid, old.name);
|
|
891
|
+
INSERT INTO entities_fts(rowid, name) VALUES (new.rowid, new.name);
|
|
892
|
+
END;
|
|
862
893
|
`);
|
|
894
|
+
try {
|
|
895
|
+
await client.execute("INSERT INTO entities_fts(entities_fts) VALUES('rebuild')");
|
|
896
|
+
} catch {
|
|
897
|
+
}
|
|
863
898
|
await client.executeMultiple(`
|
|
864
899
|
CREATE TABLE IF NOT EXISTS entity_aliases (
|
|
865
900
|
alias TEXT NOT NULL PRIMARY KEY,
|
|
@@ -1040,6 +1075,33 @@ async function ensureSchema() {
|
|
|
1040
1075
|
CREATE INDEX IF NOT EXISTS idx_conversations_channel
|
|
1041
1076
|
ON conversations(channel_id);
|
|
1042
1077
|
`);
|
|
1078
|
+
await client.executeMultiple(`
|
|
1079
|
+
CREATE TABLE IF NOT EXISTS session_agent_map (
|
|
1080
|
+
session_uuid TEXT PRIMARY KEY,
|
|
1081
|
+
agent_id TEXT NOT NULL,
|
|
1082
|
+
session_name TEXT,
|
|
1083
|
+
task_id TEXT,
|
|
1084
|
+
project_name TEXT,
|
|
1085
|
+
started_at TEXT NOT NULL
|
|
1086
|
+
);
|
|
1087
|
+
|
|
1088
|
+
CREATE INDEX IF NOT EXISTS idx_session_agent_map_agent
|
|
1089
|
+
ON session_agent_map(agent_id);
|
|
1090
|
+
`);
|
|
1091
|
+
try {
|
|
1092
|
+
const mapCount = await client.execute({ sql: `SELECT COUNT(*) as cnt FROM session_agent_map`, args: [] });
|
|
1093
|
+
if (Number(mapCount.rows[0]?.cnt ?? 0) === 0) {
|
|
1094
|
+
await client.execute({
|
|
1095
|
+
sql: `INSERT OR IGNORE INTO session_agent_map (session_uuid, agent_id, session_name, started_at)
|
|
1096
|
+
SELECT session_id, agent_id, '', MIN(timestamp)
|
|
1097
|
+
FROM memories
|
|
1098
|
+
WHERE session_id IS NOT NULL AND session_id != '' AND agent_id IS NOT NULL AND agent_id != ''
|
|
1099
|
+
GROUP BY session_id, agent_id`,
|
|
1100
|
+
args: []
|
|
1101
|
+
});
|
|
1102
|
+
}
|
|
1103
|
+
} catch {
|
|
1104
|
+
}
|
|
1043
1105
|
try {
|
|
1044
1106
|
await client.execute({
|
|
1045
1107
|
sql: `ALTER TABLE tasks ADD COLUMN budget_tokens INTEGER`,
|
|
@@ -1173,8 +1235,30 @@ async function ensureSchema() {
|
|
|
1173
1235
|
});
|
|
1174
1236
|
} catch {
|
|
1175
1237
|
}
|
|
1238
|
+
for (const col of [
|
|
1239
|
+
"ALTER TABLE memories ADD COLUMN intent TEXT",
|
|
1240
|
+
"ALTER TABLE memories ADD COLUMN outcome TEXT",
|
|
1241
|
+
"ALTER TABLE memories ADD COLUMN domain TEXT",
|
|
1242
|
+
"ALTER TABLE memories ADD COLUMN referenced_entities TEXT",
|
|
1243
|
+
"ALTER TABLE memories ADD COLUMN retrieval_count INTEGER DEFAULT 0",
|
|
1244
|
+
"ALTER TABLE memories ADD COLUMN chain_position TEXT",
|
|
1245
|
+
"ALTER TABLE memories ADD COLUMN review_status TEXT",
|
|
1246
|
+
"ALTER TABLE memories ADD COLUMN context_window_pct INTEGER",
|
|
1247
|
+
"ALTER TABLE memories ADD COLUMN file_paths TEXT",
|
|
1248
|
+
"ALTER TABLE memories ADD COLUMN commit_hash TEXT",
|
|
1249
|
+
"ALTER TABLE memories ADD COLUMN duration_ms INTEGER",
|
|
1250
|
+
"ALTER TABLE memories ADD COLUMN token_cost REAL",
|
|
1251
|
+
"ALTER TABLE memories ADD COLUMN audience TEXT",
|
|
1252
|
+
"ALTER TABLE memories ADD COLUMN language_type TEXT",
|
|
1253
|
+
"ALTER TABLE memories ADD COLUMN parent_memory_id TEXT"
|
|
1254
|
+
]) {
|
|
1255
|
+
try {
|
|
1256
|
+
await client.execute(col);
|
|
1257
|
+
} catch {
|
|
1258
|
+
}
|
|
1259
|
+
}
|
|
1176
1260
|
}
|
|
1177
|
-
var _client, _resilientClient, initTurso;
|
|
1261
|
+
var _client, _resilientClient, _daemonClient, initTurso;
|
|
1178
1262
|
var init_database = __esm({
|
|
1179
1263
|
"src/lib/database.ts"() {
|
|
1180
1264
|
"use strict";
|
|
@@ -1182,6 +1266,7 @@ var init_database = __esm({
|
|
|
1182
1266
|
init_employees();
|
|
1183
1267
|
_client = null;
|
|
1184
1268
|
_resilientClient = null;
|
|
1269
|
+
_daemonClient = null;
|
|
1185
1270
|
initTurso = initDatabase;
|
|
1186
1271
|
}
|
|
1187
1272
|
});
|
|
@@ -1616,6 +1701,9 @@ ${p.content}`).join("\n\n");
|
|
|
1616
1701
|
init_employees();
|
|
1617
1702
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
1618
1703
|
|
|
1704
|
+
// src/lib/store.ts
|
|
1705
|
+
import { createHash } from "crypto";
|
|
1706
|
+
|
|
1619
1707
|
// src/types/memory.ts
|
|
1620
1708
|
var EMBEDDING_DIM = 1024;
|
|
1621
1709
|
|
|
@@ -1655,12 +1743,20 @@ async function getMasterKey() {
|
|
|
1655
1743
|
}
|
|
1656
1744
|
const keyPath = getKeyPath();
|
|
1657
1745
|
if (!existsSync3(keyPath)) {
|
|
1746
|
+
process.stderr.write(
|
|
1747
|
+
`[keychain] Key not found at ${keyPath} (HOME=${os3.homedir()}, EXE_OS_DIR=${process.env.EXE_OS_DIR ?? "unset"})
|
|
1748
|
+
`
|
|
1749
|
+
);
|
|
1658
1750
|
return null;
|
|
1659
1751
|
}
|
|
1660
1752
|
try {
|
|
1661
1753
|
const content = await readFile3(keyPath, "utf-8");
|
|
1662
1754
|
return Buffer.from(content.trim(), "base64");
|
|
1663
|
-
} catch {
|
|
1755
|
+
} catch (err) {
|
|
1756
|
+
process.stderr.write(
|
|
1757
|
+
`[keychain] Key read failed at ${keyPath}: ${err instanceof Error ? err.message : String(err)}
|
|
1758
|
+
`
|
|
1759
|
+
);
|
|
1664
1760
|
return null;
|
|
1665
1761
|
}
|
|
1666
1762
|
}
|
|
@@ -1799,12 +1895,52 @@ function classifyTier(record) {
|
|
|
1799
1895
|
if (["store_memory", "manual"].includes(record.tool_name ?? "") && (record.importance ?? 0) >= 5) return 2;
|
|
1800
1896
|
return 3;
|
|
1801
1897
|
}
|
|
1898
|
+
function inferFilePaths(record) {
|
|
1899
|
+
if (!["Read", "Write", "Edit"].includes(record.tool_name)) return null;
|
|
1900
|
+
const firstLine = record.raw_text.split("\n")[0] ?? "";
|
|
1901
|
+
const match = firstLine.match(/(\/[\w./-]+\.\w+)/);
|
|
1902
|
+
return match ? JSON.stringify([match[1]]) : null;
|
|
1903
|
+
}
|
|
1904
|
+
function inferCommitHash(record) {
|
|
1905
|
+
if (record.tool_name !== "Bash") return null;
|
|
1906
|
+
const match = record.raw_text.match(/\b([a-f0-9]{7,40})\b/);
|
|
1907
|
+
return match ? match[1] : null;
|
|
1908
|
+
}
|
|
1909
|
+
function inferLanguageType(record) {
|
|
1910
|
+
const text = record.raw_text;
|
|
1911
|
+
if (!text || text.length < 10) return null;
|
|
1912
|
+
const trimmed = text.trimStart();
|
|
1913
|
+
if (trimmed.startsWith("{") || trimmed.startsWith("[")) return "json";
|
|
1914
|
+
if (/\b(SELECT|INSERT|UPDATE|DELETE|CREATE TABLE|ALTER TABLE)\b/i.test(text)) return "sql";
|
|
1915
|
+
if (/\b(function |const |import |export |class |def |async |=>)\b/.test(text)) return "code";
|
|
1916
|
+
if (trimmed.startsWith("#") || trimmed.startsWith("*")) return "prose";
|
|
1917
|
+
return "mixed";
|
|
1918
|
+
}
|
|
1919
|
+
function inferDomain(record) {
|
|
1920
|
+
const proj = (record.project_name ?? "").toLowerCase();
|
|
1921
|
+
if (proj.includes("marketing") || proj.includes("content")) return "marketing";
|
|
1922
|
+
if (proj.includes("crm") || proj.includes("customer")) return "customer";
|
|
1923
|
+
return null;
|
|
1924
|
+
}
|
|
1802
1925
|
async function writeMemory(record) {
|
|
1803
1926
|
if (record.vector !== null && record.vector.length !== EMBEDDING_DIM) {
|
|
1804
1927
|
throw new Error(
|
|
1805
1928
|
`Expected ${EMBEDDING_DIM}-dim vector, got ${record.vector.length}`
|
|
1806
1929
|
);
|
|
1807
1930
|
}
|
|
1931
|
+
const contentHash = createHash("md5").update(record.raw_text).digest("hex");
|
|
1932
|
+
if (_pendingRecords.some((r) => r.content_hash === contentHash && r.agent_id === record.agent_id)) {
|
|
1933
|
+
return;
|
|
1934
|
+
}
|
|
1935
|
+
try {
|
|
1936
|
+
const client = getClient();
|
|
1937
|
+
const existing = await client.execute({
|
|
1938
|
+
sql: "SELECT id FROM memories WHERE content_hash = ? AND agent_id = ? LIMIT 1",
|
|
1939
|
+
args: [contentHash, record.agent_id]
|
|
1940
|
+
});
|
|
1941
|
+
if (existing.rows.length > 0) return;
|
|
1942
|
+
} catch {
|
|
1943
|
+
}
|
|
1808
1944
|
const dbRow = {
|
|
1809
1945
|
id: record.id,
|
|
1810
1946
|
agent_id: record.agent_id,
|
|
@@ -1834,7 +1970,23 @@ async function writeMemory(record) {
|
|
|
1834
1970
|
supersedes_id: record.supersedes_id ?? null,
|
|
1835
1971
|
draft: record.draft ? 1 : 0,
|
|
1836
1972
|
memory_type: record.memory_type ?? "raw",
|
|
1837
|
-
trajectory: record.trajectory ? JSON.stringify(record.trajectory) : null
|
|
1973
|
+
trajectory: record.trajectory ? JSON.stringify(record.trajectory) : null,
|
|
1974
|
+
content_hash: contentHash,
|
|
1975
|
+
intent: record.intent ?? null,
|
|
1976
|
+
outcome: record.outcome ?? null,
|
|
1977
|
+
domain: record.domain ?? inferDomain(record),
|
|
1978
|
+
referenced_entities: record.referenced_entities ?? null,
|
|
1979
|
+
retrieval_count: record.retrieval_count ?? 0,
|
|
1980
|
+
chain_position: record.chain_position ?? null,
|
|
1981
|
+
review_status: record.review_status ?? null,
|
|
1982
|
+
context_window_pct: record.context_window_pct ?? null,
|
|
1983
|
+
file_paths: record.file_paths ?? inferFilePaths(record),
|
|
1984
|
+
commit_hash: record.commit_hash ?? inferCommitHash(record),
|
|
1985
|
+
duration_ms: record.duration_ms ?? null,
|
|
1986
|
+
token_cost: record.token_cost ?? null,
|
|
1987
|
+
audience: record.audience ?? null,
|
|
1988
|
+
language_type: record.language_type ?? inferLanguageType(record),
|
|
1989
|
+
parent_memory_id: record.parent_memory_id ?? null
|
|
1838
1990
|
};
|
|
1839
1991
|
_pendingRecords.push(dbRow);
|
|
1840
1992
|
orgBus.emit({
|
|
@@ -1892,80 +2044,85 @@ async function flushBatch() {
|
|
|
1892
2044
|
const draft = row.draft ? 1 : 0;
|
|
1893
2045
|
const memoryType = row.memory_type ?? "raw";
|
|
1894
2046
|
const trajectory = row.trajectory ?? null;
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
2047
|
+
const contentHash = row.content_hash ?? null;
|
|
2048
|
+
const intent = row.intent ?? null;
|
|
2049
|
+
const outcome = row.outcome ?? null;
|
|
2050
|
+
const domain = row.domain ?? null;
|
|
2051
|
+
const referencedEntities = row.referenced_entities ?? null;
|
|
2052
|
+
const retrievalCount = row.retrieval_count ?? 0;
|
|
2053
|
+
const chainPosition = row.chain_position ?? null;
|
|
2054
|
+
const reviewStatus = row.review_status ?? null;
|
|
2055
|
+
const contextWindowPct = row.context_window_pct ?? null;
|
|
2056
|
+
const filePaths = row.file_paths ?? null;
|
|
2057
|
+
const commitHash = row.commit_hash ?? null;
|
|
2058
|
+
const durationMs = row.duration_ms ?? null;
|
|
2059
|
+
const tokenCost = row.token_cost ?? null;
|
|
2060
|
+
const audience = row.audience ?? null;
|
|
2061
|
+
const languageType = row.language_type ?? null;
|
|
2062
|
+
const parentMemoryId = row.parent_memory_id ?? null;
|
|
2063
|
+
const cols = `id, agent_id, agent_role, session_id, timestamp,
|
|
1905
2064
|
tool_name, project_name,
|
|
1906
2065
|
has_error, raw_text, vector, version, task_id, importance, status,
|
|
1907
2066
|
confidence, last_accessed,
|
|
1908
2067
|
workspace_id, document_id, user_id, char_offset, page_number,
|
|
1909
|
-
source_path, source_type, tier, supersedes_id, draft, memory_type, trajectory
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
trajectory
|
|
1968
|
-
]
|
|
2068
|
+
source_path, source_type, tier, supersedes_id, draft, memory_type, trajectory, content_hash,
|
|
2069
|
+
intent, outcome, domain, referenced_entities, retrieval_count,
|
|
2070
|
+
chain_position, review_status, context_window_pct, file_paths, commit_hash,
|
|
2071
|
+
duration_ms, token_cost, audience, language_type, parent_memory_id`;
|
|
2072
|
+
const metaArgs = [
|
|
2073
|
+
intent,
|
|
2074
|
+
outcome,
|
|
2075
|
+
domain,
|
|
2076
|
+
referencedEntities,
|
|
2077
|
+
retrievalCount,
|
|
2078
|
+
chainPosition,
|
|
2079
|
+
reviewStatus,
|
|
2080
|
+
contextWindowPct,
|
|
2081
|
+
filePaths,
|
|
2082
|
+
commitHash,
|
|
2083
|
+
durationMs,
|
|
2084
|
+
tokenCost,
|
|
2085
|
+
audience,
|
|
2086
|
+
languageType,
|
|
2087
|
+
parentMemoryId
|
|
2088
|
+
];
|
|
2089
|
+
const baseArgs = [
|
|
2090
|
+
row.id,
|
|
2091
|
+
row.agent_id,
|
|
2092
|
+
row.agent_role,
|
|
2093
|
+
row.session_id,
|
|
2094
|
+
row.timestamp,
|
|
2095
|
+
row.tool_name,
|
|
2096
|
+
row.project_name,
|
|
2097
|
+
row.has_error,
|
|
2098
|
+
row.raw_text
|
|
2099
|
+
];
|
|
2100
|
+
const sharedArgs = [
|
|
2101
|
+
row.version,
|
|
2102
|
+
taskId,
|
|
2103
|
+
importance,
|
|
2104
|
+
status,
|
|
2105
|
+
confidence,
|
|
2106
|
+
lastAccessed,
|
|
2107
|
+
workspaceId,
|
|
2108
|
+
documentId,
|
|
2109
|
+
userId,
|
|
2110
|
+
charOffset,
|
|
2111
|
+
pageNumber,
|
|
2112
|
+
sourcePath,
|
|
2113
|
+
sourceType,
|
|
2114
|
+
tier,
|
|
2115
|
+
supersedesId,
|
|
2116
|
+
draft,
|
|
2117
|
+
memoryType,
|
|
2118
|
+
trajectory,
|
|
2119
|
+
contentHash
|
|
2120
|
+
];
|
|
2121
|
+
return {
|
|
2122
|
+
sql: hasVector ? `INSERT OR IGNORE INTO memories (${cols})
|
|
2123
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, vector32(?), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)` : `INSERT OR IGNORE INTO memories (${cols})
|
|
2124
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, NULL, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
|
2125
|
+
args: hasVector ? [...baseArgs, vectorToBlob(row.vector), ...sharedArgs, ...metaArgs] : [...baseArgs, ...sharedArgs, ...metaArgs]
|
|
1969
2126
|
};
|
|
1970
2127
|
};
|
|
1971
2128
|
const globalClient = getClient();
|
|
@@ -2014,6 +2171,7 @@ import { realpathSync } from "fs";
|
|
|
2014
2171
|
import { fileURLToPath } from "url";
|
|
2015
2172
|
function isMainModule(importMetaUrl) {
|
|
2016
2173
|
if (process.argv[1] == null) return false;
|
|
2174
|
+
if (process.argv[1].includes("mcp/server")) return false;
|
|
2017
2175
|
try {
|
|
2018
2176
|
const scriptPath = realpathSync(process.argv[1]);
|
|
2019
2177
|
const modulePath = realpathSync(fileURLToPath(importMetaUrl));
|