@askexenow/exe-os 0.8.83 → 0.8.86
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 +154 -21
- package/dist/bin/cli.js +14678 -12676
- package/dist/bin/exe-agent-config.js +242 -0
- package/dist/bin/exe-agent.js +100 -91
- package/dist/bin/exe-assign.js +1003 -854
- package/dist/bin/exe-boot.js +1420 -485
- package/dist/bin/exe-call.js +10 -0
- package/dist/bin/exe-cloud.js +29 -6
- package/dist/bin/exe-dispatch.js +572 -271
- package/dist/bin/exe-doctor.js +403 -6
- package/dist/bin/exe-export-behaviors.js +175 -72
- package/dist/bin/exe-forget.js +102 -3
- package/dist/bin/exe-gateway.js +796 -292
- package/dist/bin/exe-healthcheck.js +134 -1
- package/dist/bin/exe-heartbeat.js +172 -36
- package/dist/bin/exe-kill.js +175 -72
- package/dist/bin/exe-launch-agent.js +189 -76
- package/dist/bin/exe-link.js +927 -82
- package/dist/bin/exe-new-employee.js +60 -8
- package/dist/bin/exe-pending-messages.js +151 -19
- package/dist/bin/exe-pending-notifications.js +97 -2
- package/dist/bin/exe-pending-reviews.js +155 -22
- package/dist/bin/exe-rename.js +564 -23
- package/dist/bin/exe-review.js +231 -73
- package/dist/bin/exe-search.js +995 -228
- package/dist/bin/exe-session-cleanup.js +4930 -1664
- package/dist/bin/exe-settings.js +20 -5
- package/dist/bin/exe-start-codex.js +2598 -0
- package/dist/bin/exe-start.sh +15 -3
- package/dist/bin/exe-status.js +154 -21
- package/dist/bin/exe-team.js +97 -2
- package/dist/bin/git-sweep.js +1180 -363
- package/dist/bin/graph-backfill.js +175 -72
- package/dist/bin/graph-export.js +175 -72
- package/dist/bin/install.js +60 -7
- package/dist/bin/list-providers.js +1 -0
- package/dist/bin/scan-tasks.js +1185 -367
- package/dist/bin/setup.js +914 -270
- 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 +792 -285
- package/dist/hooks/bug-report-worker.js +445 -135
- package/dist/hooks/commit-complete.js +1178 -361
- package/dist/hooks/error-recall.js +994 -228
- package/dist/hooks/ingest-worker.js +1799 -1234
- 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 +757 -109
- package/dist/hooks/pre-compact.js +1061 -244
- package/dist/hooks/pre-tool-use.js +787 -130
- package/dist/hooks/prompt-ingest-worker.js +242 -101
- package/dist/hooks/prompt-submit.js +1121 -299
- package/dist/hooks/response-ingest-worker.js +242 -101
- package/dist/hooks/session-end.js +4063 -397
- package/dist/hooks/session-start.js +1071 -254
- package/dist/hooks/stop.js +768 -120
- package/dist/hooks/subagent-stop.js +757 -109
- package/dist/hooks/summary-worker.js +1706 -1011
- package/dist/index.js +1821 -1098
- package/dist/lib/agent-config.js +167 -0
- package/dist/lib/cloud-sync.js +932 -88
- 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 +2733 -1575
- package/dist/lib/hybrid-search.js +995 -228
- package/dist/lib/identity.js +87 -67
- package/dist/lib/keychain.js +9 -1
- package/dist/lib/messaging.js +103 -40
- package/dist/lib/reminders.js +91 -74
- package/dist/lib/runtime-table.js +16 -0
- package/dist/lib/schedules.js +96 -2
- package/dist/lib/session-wrappers.js +22 -0
- package/dist/lib/skill-learning.js +103 -85
- package/dist/lib/store.js +234 -73
- package/dist/lib/tasks.js +348 -134
- package/dist/lib/tmux-routing.js +422 -208
- package/dist/lib/token-spend.js +273 -0
- package/dist/lib/ws-client.js +11 -0
- package/dist/mcp/server.js +5742 -696
- 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 +375 -152
- 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 +99 -31
- package/dist/mcp/tools/send-message.js +108 -45
- package/dist/mcp/tools/update-task.js +162 -77
- package/dist/runtime/index.js +1075 -258
- package/dist/tui/App.js +1333 -506
- package/package.json +6 -1
- package/src/commands/exe/agent-config.md +27 -0
- package/src/commands/exe/cc-doctor.md +10 -0
package/dist/lib/store.js
CHANGED
|
@@ -304,6 +304,12 @@ function getClient() {
|
|
|
304
304
|
if (!_resilientClient) {
|
|
305
305
|
throw new Error("Database client not initialized. Call initDatabase() first.");
|
|
306
306
|
}
|
|
307
|
+
if (process.env.EXE_IS_DAEMON === "1") {
|
|
308
|
+
return _resilientClient;
|
|
309
|
+
}
|
|
310
|
+
if (_daemonClient && _daemonClient._isDaemonActive()) {
|
|
311
|
+
return _daemonClient;
|
|
312
|
+
}
|
|
307
313
|
return _resilientClient;
|
|
308
314
|
}
|
|
309
315
|
function getRawClient() {
|
|
@@ -792,6 +798,12 @@ async function ensureSchema() {
|
|
|
792
798
|
} catch {
|
|
793
799
|
}
|
|
794
800
|
}
|
|
801
|
+
try {
|
|
802
|
+
await client.execute(
|
|
803
|
+
`CREATE INDEX IF NOT EXISTS idx_memories_content_hash ON memories(content_hash, agent_id)`
|
|
804
|
+
);
|
|
805
|
+
} catch {
|
|
806
|
+
}
|
|
795
807
|
await client.executeMultiple(`
|
|
796
808
|
CREATE TABLE IF NOT EXISTS entities (
|
|
797
809
|
id TEXT PRIMARY KEY,
|
|
@@ -844,7 +856,30 @@ async function ensureSchema() {
|
|
|
844
856
|
entity_id TEXT NOT NULL,
|
|
845
857
|
PRIMARY KEY (hyperedge_id, entity_id)
|
|
846
858
|
);
|
|
859
|
+
|
|
860
|
+
CREATE VIRTUAL TABLE IF NOT EXISTS entities_fts USING fts5(
|
|
861
|
+
name,
|
|
862
|
+
content=entities,
|
|
863
|
+
content_rowid=rowid
|
|
864
|
+
);
|
|
865
|
+
|
|
866
|
+
CREATE TRIGGER IF NOT EXISTS entities_fts_ai AFTER INSERT ON entities BEGIN
|
|
867
|
+
INSERT INTO entities_fts(rowid, name) VALUES (new.rowid, new.name);
|
|
868
|
+
END;
|
|
869
|
+
|
|
870
|
+
CREATE TRIGGER IF NOT EXISTS entities_fts_ad AFTER DELETE ON entities BEGIN
|
|
871
|
+
INSERT INTO entities_fts(entities_fts, rowid, name) VALUES('delete', old.rowid, old.name);
|
|
872
|
+
END;
|
|
873
|
+
|
|
874
|
+
CREATE TRIGGER IF NOT EXISTS entities_fts_au AFTER UPDATE ON entities BEGIN
|
|
875
|
+
INSERT INTO entities_fts(entities_fts, rowid, name) VALUES('delete', old.rowid, old.name);
|
|
876
|
+
INSERT INTO entities_fts(rowid, name) VALUES (new.rowid, new.name);
|
|
877
|
+
END;
|
|
847
878
|
`);
|
|
879
|
+
try {
|
|
880
|
+
await client.execute("INSERT INTO entities_fts(entities_fts) VALUES('rebuild')");
|
|
881
|
+
} catch {
|
|
882
|
+
}
|
|
848
883
|
await client.executeMultiple(`
|
|
849
884
|
CREATE TABLE IF NOT EXISTS entity_aliases (
|
|
850
885
|
alias TEXT NOT NULL PRIMARY KEY,
|
|
@@ -1025,6 +1060,33 @@ async function ensureSchema() {
|
|
|
1025
1060
|
CREATE INDEX IF NOT EXISTS idx_conversations_channel
|
|
1026
1061
|
ON conversations(channel_id);
|
|
1027
1062
|
`);
|
|
1063
|
+
await client.executeMultiple(`
|
|
1064
|
+
CREATE TABLE IF NOT EXISTS session_agent_map (
|
|
1065
|
+
session_uuid TEXT PRIMARY KEY,
|
|
1066
|
+
agent_id TEXT NOT NULL,
|
|
1067
|
+
session_name TEXT,
|
|
1068
|
+
task_id TEXT,
|
|
1069
|
+
project_name TEXT,
|
|
1070
|
+
started_at TEXT NOT NULL
|
|
1071
|
+
);
|
|
1072
|
+
|
|
1073
|
+
CREATE INDEX IF NOT EXISTS idx_session_agent_map_agent
|
|
1074
|
+
ON session_agent_map(agent_id);
|
|
1075
|
+
`);
|
|
1076
|
+
try {
|
|
1077
|
+
const mapCount = await client.execute({ sql: `SELECT COUNT(*) as cnt FROM session_agent_map`, args: [] });
|
|
1078
|
+
if (Number(mapCount.rows[0]?.cnt ?? 0) === 0) {
|
|
1079
|
+
await client.execute({
|
|
1080
|
+
sql: `INSERT OR IGNORE INTO session_agent_map (session_uuid, agent_id, session_name, started_at)
|
|
1081
|
+
SELECT session_id, agent_id, '', MIN(timestamp)
|
|
1082
|
+
FROM memories
|
|
1083
|
+
WHERE session_id IS NOT NULL AND session_id != '' AND agent_id IS NOT NULL AND agent_id != ''
|
|
1084
|
+
GROUP BY session_id, agent_id`,
|
|
1085
|
+
args: []
|
|
1086
|
+
});
|
|
1087
|
+
}
|
|
1088
|
+
} catch {
|
|
1089
|
+
}
|
|
1028
1090
|
try {
|
|
1029
1091
|
await client.execute({
|
|
1030
1092
|
sql: `ALTER TABLE tasks ADD COLUMN budget_tokens INTEGER`,
|
|
@@ -1158,15 +1220,41 @@ async function ensureSchema() {
|
|
|
1158
1220
|
});
|
|
1159
1221
|
} catch {
|
|
1160
1222
|
}
|
|
1223
|
+
for (const col of [
|
|
1224
|
+
"ALTER TABLE memories ADD COLUMN intent TEXT",
|
|
1225
|
+
"ALTER TABLE memories ADD COLUMN outcome TEXT",
|
|
1226
|
+
"ALTER TABLE memories ADD COLUMN domain TEXT",
|
|
1227
|
+
"ALTER TABLE memories ADD COLUMN referenced_entities TEXT",
|
|
1228
|
+
"ALTER TABLE memories ADD COLUMN retrieval_count INTEGER DEFAULT 0",
|
|
1229
|
+
"ALTER TABLE memories ADD COLUMN chain_position TEXT",
|
|
1230
|
+
"ALTER TABLE memories ADD COLUMN review_status TEXT",
|
|
1231
|
+
"ALTER TABLE memories ADD COLUMN context_window_pct INTEGER",
|
|
1232
|
+
"ALTER TABLE memories ADD COLUMN file_paths TEXT",
|
|
1233
|
+
"ALTER TABLE memories ADD COLUMN commit_hash TEXT",
|
|
1234
|
+
"ALTER TABLE memories ADD COLUMN duration_ms INTEGER",
|
|
1235
|
+
"ALTER TABLE memories ADD COLUMN token_cost REAL",
|
|
1236
|
+
"ALTER TABLE memories ADD COLUMN audience TEXT",
|
|
1237
|
+
"ALTER TABLE memories ADD COLUMN language_type TEXT",
|
|
1238
|
+
"ALTER TABLE memories ADD COLUMN parent_memory_id TEXT"
|
|
1239
|
+
]) {
|
|
1240
|
+
try {
|
|
1241
|
+
await client.execute(col);
|
|
1242
|
+
} catch {
|
|
1243
|
+
}
|
|
1244
|
+
}
|
|
1161
1245
|
}
|
|
1162
1246
|
async function disposeDatabase() {
|
|
1247
|
+
if (_daemonClient) {
|
|
1248
|
+
_daemonClient.close();
|
|
1249
|
+
_daemonClient = null;
|
|
1250
|
+
}
|
|
1163
1251
|
if (_client) {
|
|
1164
1252
|
_client.close();
|
|
1165
1253
|
_client = null;
|
|
1166
1254
|
_resilientClient = null;
|
|
1167
1255
|
}
|
|
1168
1256
|
}
|
|
1169
|
-
var _client, _resilientClient, initTurso, disposeTurso;
|
|
1257
|
+
var _client, _resilientClient, _daemonClient, initTurso, disposeTurso;
|
|
1170
1258
|
var init_database = __esm({
|
|
1171
1259
|
"src/lib/database.ts"() {
|
|
1172
1260
|
"use strict";
|
|
@@ -1174,6 +1262,7 @@ var init_database = __esm({
|
|
|
1174
1262
|
init_employees();
|
|
1175
1263
|
_client = null;
|
|
1176
1264
|
_resilientClient = null;
|
|
1265
|
+
_daemonClient = null;
|
|
1177
1266
|
initTurso = initDatabase;
|
|
1178
1267
|
disposeTurso = disposeDatabase;
|
|
1179
1268
|
}
|
|
@@ -1605,6 +1694,9 @@ ${p.content}`).join("\n\n");
|
|
|
1605
1694
|
}
|
|
1606
1695
|
});
|
|
1607
1696
|
|
|
1697
|
+
// src/lib/store.ts
|
|
1698
|
+
import { createHash } from "crypto";
|
|
1699
|
+
|
|
1608
1700
|
// src/types/memory.ts
|
|
1609
1701
|
var EMBEDDING_DIM = 1024;
|
|
1610
1702
|
|
|
@@ -1644,12 +1736,20 @@ async function getMasterKey() {
|
|
|
1644
1736
|
}
|
|
1645
1737
|
const keyPath = getKeyPath();
|
|
1646
1738
|
if (!existsSync3(keyPath)) {
|
|
1739
|
+
process.stderr.write(
|
|
1740
|
+
`[keychain] Key not found at ${keyPath} (HOME=${os3.homedir()}, EXE_OS_DIR=${process.env.EXE_OS_DIR ?? "unset"})
|
|
1741
|
+
`
|
|
1742
|
+
);
|
|
1647
1743
|
return null;
|
|
1648
1744
|
}
|
|
1649
1745
|
try {
|
|
1650
1746
|
const content = await readFile3(keyPath, "utf-8");
|
|
1651
1747
|
return Buffer.from(content.trim(), "base64");
|
|
1652
|
-
} catch {
|
|
1748
|
+
} catch (err) {
|
|
1749
|
+
process.stderr.write(
|
|
1750
|
+
`[keychain] Key read failed at ${keyPath}: ${err instanceof Error ? err.message : String(err)}
|
|
1751
|
+
`
|
|
1752
|
+
);
|
|
1653
1753
|
return null;
|
|
1654
1754
|
}
|
|
1655
1755
|
}
|
|
@@ -1788,12 +1888,52 @@ function classifyTier(record) {
|
|
|
1788
1888
|
if (["store_memory", "manual"].includes(record.tool_name ?? "") && (record.importance ?? 0) >= 5) return 2;
|
|
1789
1889
|
return 3;
|
|
1790
1890
|
}
|
|
1891
|
+
function inferFilePaths(record) {
|
|
1892
|
+
if (!["Read", "Write", "Edit"].includes(record.tool_name)) return null;
|
|
1893
|
+
const firstLine = record.raw_text.split("\n")[0] ?? "";
|
|
1894
|
+
const match = firstLine.match(/(\/[\w./-]+\.\w+)/);
|
|
1895
|
+
return match ? JSON.stringify([match[1]]) : null;
|
|
1896
|
+
}
|
|
1897
|
+
function inferCommitHash(record) {
|
|
1898
|
+
if (record.tool_name !== "Bash") return null;
|
|
1899
|
+
const match = record.raw_text.match(/\b([a-f0-9]{7,40})\b/);
|
|
1900
|
+
return match ? match[1] : null;
|
|
1901
|
+
}
|
|
1902
|
+
function inferLanguageType(record) {
|
|
1903
|
+
const text = record.raw_text;
|
|
1904
|
+
if (!text || text.length < 10) return null;
|
|
1905
|
+
const trimmed = text.trimStart();
|
|
1906
|
+
if (trimmed.startsWith("{") || trimmed.startsWith("[")) return "json";
|
|
1907
|
+
if (/\b(SELECT|INSERT|UPDATE|DELETE|CREATE TABLE|ALTER TABLE)\b/i.test(text)) return "sql";
|
|
1908
|
+
if (/\b(function |const |import |export |class |def |async |=>)\b/.test(text)) return "code";
|
|
1909
|
+
if (trimmed.startsWith("#") || trimmed.startsWith("*")) return "prose";
|
|
1910
|
+
return "mixed";
|
|
1911
|
+
}
|
|
1912
|
+
function inferDomain(record) {
|
|
1913
|
+
const proj = (record.project_name ?? "").toLowerCase();
|
|
1914
|
+
if (proj.includes("marketing") || proj.includes("content")) return "marketing";
|
|
1915
|
+
if (proj.includes("crm") || proj.includes("customer")) return "customer";
|
|
1916
|
+
return null;
|
|
1917
|
+
}
|
|
1791
1918
|
async function writeMemory(record) {
|
|
1792
1919
|
if (record.vector !== null && record.vector.length !== EMBEDDING_DIM) {
|
|
1793
1920
|
throw new Error(
|
|
1794
1921
|
`Expected ${EMBEDDING_DIM}-dim vector, got ${record.vector.length}`
|
|
1795
1922
|
);
|
|
1796
1923
|
}
|
|
1924
|
+
const contentHash = createHash("md5").update(record.raw_text).digest("hex");
|
|
1925
|
+
if (_pendingRecords.some((r) => r.content_hash === contentHash && r.agent_id === record.agent_id)) {
|
|
1926
|
+
return;
|
|
1927
|
+
}
|
|
1928
|
+
try {
|
|
1929
|
+
const client = getClient();
|
|
1930
|
+
const existing = await client.execute({
|
|
1931
|
+
sql: "SELECT id FROM memories WHERE content_hash = ? AND agent_id = ? LIMIT 1",
|
|
1932
|
+
args: [contentHash, record.agent_id]
|
|
1933
|
+
});
|
|
1934
|
+
if (existing.rows.length > 0) return;
|
|
1935
|
+
} catch {
|
|
1936
|
+
}
|
|
1797
1937
|
const dbRow = {
|
|
1798
1938
|
id: record.id,
|
|
1799
1939
|
agent_id: record.agent_id,
|
|
@@ -1823,7 +1963,23 @@ async function writeMemory(record) {
|
|
|
1823
1963
|
supersedes_id: record.supersedes_id ?? null,
|
|
1824
1964
|
draft: record.draft ? 1 : 0,
|
|
1825
1965
|
memory_type: record.memory_type ?? "raw",
|
|
1826
|
-
trajectory: record.trajectory ? JSON.stringify(record.trajectory) : null
|
|
1966
|
+
trajectory: record.trajectory ? JSON.stringify(record.trajectory) : null,
|
|
1967
|
+
content_hash: contentHash,
|
|
1968
|
+
intent: record.intent ?? null,
|
|
1969
|
+
outcome: record.outcome ?? null,
|
|
1970
|
+
domain: record.domain ?? inferDomain(record),
|
|
1971
|
+
referenced_entities: record.referenced_entities ?? null,
|
|
1972
|
+
retrieval_count: record.retrieval_count ?? 0,
|
|
1973
|
+
chain_position: record.chain_position ?? null,
|
|
1974
|
+
review_status: record.review_status ?? null,
|
|
1975
|
+
context_window_pct: record.context_window_pct ?? null,
|
|
1976
|
+
file_paths: record.file_paths ?? inferFilePaths(record),
|
|
1977
|
+
commit_hash: record.commit_hash ?? inferCommitHash(record),
|
|
1978
|
+
duration_ms: record.duration_ms ?? null,
|
|
1979
|
+
token_cost: record.token_cost ?? null,
|
|
1980
|
+
audience: record.audience ?? null,
|
|
1981
|
+
language_type: record.language_type ?? inferLanguageType(record),
|
|
1982
|
+
parent_memory_id: record.parent_memory_id ?? null
|
|
1827
1983
|
};
|
|
1828
1984
|
_pendingRecords.push(dbRow);
|
|
1829
1985
|
orgBus.emit({
|
|
@@ -1881,80 +2037,85 @@ async function flushBatch() {
|
|
|
1881
2037
|
const draft = row.draft ? 1 : 0;
|
|
1882
2038
|
const memoryType = row.memory_type ?? "raw";
|
|
1883
2039
|
const trajectory = row.trajectory ?? null;
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
2040
|
+
const contentHash = row.content_hash ?? null;
|
|
2041
|
+
const intent = row.intent ?? null;
|
|
2042
|
+
const outcome = row.outcome ?? null;
|
|
2043
|
+
const domain = row.domain ?? null;
|
|
2044
|
+
const referencedEntities = row.referenced_entities ?? null;
|
|
2045
|
+
const retrievalCount = row.retrieval_count ?? 0;
|
|
2046
|
+
const chainPosition = row.chain_position ?? null;
|
|
2047
|
+
const reviewStatus = row.review_status ?? null;
|
|
2048
|
+
const contextWindowPct = row.context_window_pct ?? null;
|
|
2049
|
+
const filePaths = row.file_paths ?? null;
|
|
2050
|
+
const commitHash = row.commit_hash ?? null;
|
|
2051
|
+
const durationMs = row.duration_ms ?? null;
|
|
2052
|
+
const tokenCost = row.token_cost ?? null;
|
|
2053
|
+
const audience = row.audience ?? null;
|
|
2054
|
+
const languageType = row.language_type ?? null;
|
|
2055
|
+
const parentMemoryId = row.parent_memory_id ?? null;
|
|
2056
|
+
const cols = `id, agent_id, agent_role, session_id, timestamp,
|
|
1894
2057
|
tool_name, project_name,
|
|
1895
2058
|
has_error, raw_text, vector, version, task_id, importance, status,
|
|
1896
2059
|
confidence, last_accessed,
|
|
1897
2060
|
workspace_id, document_id, user_id, char_offset, page_number,
|
|
1898
|
-
source_path, source_type, tier, supersedes_id, draft, memory_type, trajectory
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
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
|
-
trajectory
|
|
1957
|
-
]
|
|
2061
|
+
source_path, source_type, tier, supersedes_id, draft, memory_type, trajectory, content_hash,
|
|
2062
|
+
intent, outcome, domain, referenced_entities, retrieval_count,
|
|
2063
|
+
chain_position, review_status, context_window_pct, file_paths, commit_hash,
|
|
2064
|
+
duration_ms, token_cost, audience, language_type, parent_memory_id`;
|
|
2065
|
+
const metaArgs = [
|
|
2066
|
+
intent,
|
|
2067
|
+
outcome,
|
|
2068
|
+
domain,
|
|
2069
|
+
referencedEntities,
|
|
2070
|
+
retrievalCount,
|
|
2071
|
+
chainPosition,
|
|
2072
|
+
reviewStatus,
|
|
2073
|
+
contextWindowPct,
|
|
2074
|
+
filePaths,
|
|
2075
|
+
commitHash,
|
|
2076
|
+
durationMs,
|
|
2077
|
+
tokenCost,
|
|
2078
|
+
audience,
|
|
2079
|
+
languageType,
|
|
2080
|
+
parentMemoryId
|
|
2081
|
+
];
|
|
2082
|
+
const baseArgs = [
|
|
2083
|
+
row.id,
|
|
2084
|
+
row.agent_id,
|
|
2085
|
+
row.agent_role,
|
|
2086
|
+
row.session_id,
|
|
2087
|
+
row.timestamp,
|
|
2088
|
+
row.tool_name,
|
|
2089
|
+
row.project_name,
|
|
2090
|
+
row.has_error,
|
|
2091
|
+
row.raw_text
|
|
2092
|
+
];
|
|
2093
|
+
const sharedArgs = [
|
|
2094
|
+
row.version,
|
|
2095
|
+
taskId,
|
|
2096
|
+
importance,
|
|
2097
|
+
status,
|
|
2098
|
+
confidence,
|
|
2099
|
+
lastAccessed,
|
|
2100
|
+
workspaceId,
|
|
2101
|
+
documentId,
|
|
2102
|
+
userId,
|
|
2103
|
+
charOffset,
|
|
2104
|
+
pageNumber,
|
|
2105
|
+
sourcePath,
|
|
2106
|
+
sourceType,
|
|
2107
|
+
tier,
|
|
2108
|
+
supersedesId,
|
|
2109
|
+
draft,
|
|
2110
|
+
memoryType,
|
|
2111
|
+
trajectory,
|
|
2112
|
+
contentHash
|
|
2113
|
+
];
|
|
2114
|
+
return {
|
|
2115
|
+
sql: hasVector ? `INSERT OR IGNORE INTO memories (${cols})
|
|
2116
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, vector32(?), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)` : `INSERT OR IGNORE INTO memories (${cols})
|
|
2117
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, NULL, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
|
2118
|
+
args: hasVector ? [...baseArgs, vectorToBlob(row.vector), ...sharedArgs, ...metaArgs] : [...baseArgs, ...sharedArgs, ...metaArgs]
|
|
1958
2119
|
};
|
|
1959
2120
|
};
|
|
1960
2121
|
const globalClient = getClient();
|