@yugenlab/vaayu 0.1.10 → 0.1.11
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/chunks/{agentic-tool-loop-2FZK72JO.js → agentic-tool-loop-O3NUV7KG.js} +1 -1
- package/chunks/{chunk-UZ6OIVEC.js → chunk-2OBLQJYJ.js} +1 -1
- package/chunks/{chunk-O4KV7TFP.js → chunk-3AYSJ7WB.js} +30 -18
- package/chunks/{chunk-U62ABYKD.js → chunk-67DXWEKG.js} +3 -3
- package/chunks/{chunk-6556EKOB.js → chunk-7AYYXHYZ.js} +25 -24
- package/chunks/{chunk-JGI4SDWS.js → chunk-7XV5ISV7.js} +7 -5
- package/chunks/{chunk-JAWZ7ANC.js → chunk-A3HOZBC5.js} +11 -7
- package/chunks/{chunk-VJHNE47S.js → chunk-D46QTN3G.js} +63 -82
- package/chunks/{chunk-PRXQW76U.js → chunk-EG37M4QL.js} +17 -6
- package/chunks/{chunk-77725AR7.js → chunk-F6RNEGFX.js} +82 -53
- package/chunks/{chunk-MJ74G5RB.js → chunk-G2QREGXK.js} +2 -2
- package/chunks/{chunk-AS3DJFY3.js → chunk-JZTFJE7M.js} +39 -39
- package/chunks/{chunk-OT4G2L46.js → chunk-LJUEMPLG.js} +202 -154
- package/chunks/{chunk-C76USAC5.js → chunk-QFGAB4XD.js} +13 -5
- package/chunks/{chunk-M7THR63C.js → chunk-QV4GPIPT.js} +74 -65
- package/chunks/{chunk-YJRXLRTE.js → chunk-V2ZIKDN4.js} +9 -8
- package/chunks/{chunk-AGK3A7R7.js → chunk-VCUJES75.js} +791 -677
- package/chunks/{chunk-N22M7D4P.js → chunk-W4PVGBUH.js} +86 -97
- package/chunks/{chunk-TND3MU4Z.js → chunk-Z576WVLG.js} +74 -66
- package/chunks/{chunk-HIYHTWFW.js → chunk-ZYY6N3SP.js} +90 -118
- package/chunks/{consolidation-indexer-VKQ6DNU3.js → consolidation-indexer-VIWOP6VO.js} +8 -8
- package/chunks/{day-consolidation-BH3QU2SZ.js → day-consolidation-HMHSXIOM.js} +4 -4
- package/chunks/{src-Y3TGMINC.js → dist-CY5NX2IK.js} +17 -17
- package/chunks/graphrag-T2QWNX57.js +14 -0
- package/chunks/{hierarchical-temporal-search-PVHVA3NZ.js → hierarchical-temporal-search-U6DG74IR.js} +2 -2
- package/chunks/hybrid-search-BYTXCOXP.js +20 -0
- package/chunks/{memory-store-A6WOWLWC.js → memory-store-LEERUQGL.js} +3 -3
- package/chunks/periodic-consolidation-D6SSKZ7H.js +11 -0
- package/chunks/{postgres-WLH3D5HG.js → postgres-7GZDDX77.js} +2 -2
- package/chunks/{recall-ZNL4DJ2L.js → recall-LNRQVATQ.js} +7 -7
- package/chunks/search-BIODUW2P.js +19 -0
- package/chunks/{session-store-3BRPGC6P.js → session-store-O3TS7DUY.js} +5 -5
- package/chunks/{sqlite-DHUQGPR5.js → sqlite-7BC4DJTN.js} +2 -2
- package/chunks/{vasana-engine-MU25OQ23.js → vasana-engine-BJFHJVGM.js} +4 -4
- package/gateway.js +31592 -24973
- package/package.json +1 -1
- package/pair-cli.js +1 -1
- package/chunks/graphrag-D7OXWAWD.js +0 -14
- package/chunks/hybrid-search-G2NAJKJ7.js +0 -20
- package/chunks/periodic-consolidation-LMYMNS4Q.js +0 -11
- package/chunks/search-35JMSGUT.js +0 -19
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
2
|
initAgentSchema
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-V2ZIKDN4.js";
|
|
4
4
|
import {
|
|
5
5
|
DatabaseManager
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-67DXWEKG.js";
|
|
7
7
|
import {
|
|
8
8
|
SessionError,
|
|
9
9
|
getChitraguptaHome
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-2OBLQJYJ.js";
|
|
11
11
|
|
|
12
|
-
// ../chitragupta/packages/smriti/
|
|
12
|
+
// ../chitragupta/packages/smriti/dist/session-store.js
|
|
13
13
|
import fs from "fs";
|
|
14
14
|
import { renameSync as nodeRenameSync } from "node:fs";
|
|
15
15
|
import path from "path";
|
|
16
16
|
import crypto from "crypto";
|
|
17
17
|
|
|
18
|
-
// ../chitragupta/packages/smriti/
|
|
18
|
+
// ../chitragupta/packages/smriti/dist/markdown-parser.js
|
|
19
19
|
function parseFrontmatter(yaml) {
|
|
20
20
|
const result = {};
|
|
21
21
|
const lines = yaml.split("\n");
|
|
@@ -23,7 +23,8 @@ function parseFrontmatter(yaml) {
|
|
|
23
23
|
let currentArray = null;
|
|
24
24
|
for (const line of lines) {
|
|
25
25
|
const trimmed = line.trim();
|
|
26
|
-
if (!trimmed || trimmed.startsWith("#"))
|
|
26
|
+
if (!trimmed || trimmed.startsWith("#"))
|
|
27
|
+
continue;
|
|
27
28
|
if (trimmed.startsWith("- ") && currentKey && currentArray !== null) {
|
|
28
29
|
currentArray.push(trimmed.slice(2).trim());
|
|
29
30
|
continue;
|
|
@@ -34,7 +35,8 @@ function parseFrontmatter(yaml) {
|
|
|
34
35
|
currentKey = null;
|
|
35
36
|
}
|
|
36
37
|
const colonIdx = trimmed.indexOf(":");
|
|
37
|
-
if (colonIdx === -1)
|
|
38
|
+
if (colonIdx === -1)
|
|
39
|
+
continue;
|
|
38
40
|
const key = trimmed.slice(0, colonIdx).trim();
|
|
39
41
|
const rawValue = trimmed.slice(colonIdx + 1).trim();
|
|
40
42
|
if (rawValue === "" || rawValue === void 0) {
|
|
@@ -59,9 +61,12 @@ function parseFrontmatter(yaml) {
|
|
|
59
61
|
return result;
|
|
60
62
|
}
|
|
61
63
|
function parseScalar(value) {
|
|
62
|
-
if (value === "null" || value === "~")
|
|
63
|
-
|
|
64
|
-
if (value === "
|
|
64
|
+
if (value === "null" || value === "~")
|
|
65
|
+
return null;
|
|
66
|
+
if (value === "true")
|
|
67
|
+
return true;
|
|
68
|
+
if (value === "false")
|
|
69
|
+
return false;
|
|
65
70
|
if (value.startsWith('"') && value.endsWith('"')) {
|
|
66
71
|
return value.slice(1, -1).replace(/\\"/g, '"');
|
|
67
72
|
}
|
|
@@ -69,7 +74,8 @@ function parseScalar(value) {
|
|
|
69
74
|
return value.slice(1, -1);
|
|
70
75
|
}
|
|
71
76
|
const num = Number(value);
|
|
72
|
-
if (!Number.isNaN(num) && value !== "")
|
|
77
|
+
if (!Number.isNaN(num) && value !== "")
|
|
78
|
+
return num;
|
|
73
79
|
return value;
|
|
74
80
|
}
|
|
75
81
|
function parseSessionMarkdown(content) {
|
|
@@ -103,7 +109,8 @@ function buildSessionMeta(raw) {
|
|
|
103
109
|
};
|
|
104
110
|
}
|
|
105
111
|
function parseTurns(body) {
|
|
106
|
-
if (!body)
|
|
112
|
+
if (!body)
|
|
113
|
+
return [];
|
|
107
114
|
body = stripFooter(body);
|
|
108
115
|
const turnPattern = /^## Turn (\d+) — (user|assistant)(?:\s+\(([^)]*)\))?/gm;
|
|
109
116
|
const turns = [];
|
|
@@ -129,8 +136,10 @@ function parseTurns(body) {
|
|
|
129
136
|
const parts = m.meta.split(",").map((s) => s.trim());
|
|
130
137
|
for (const part of parts) {
|
|
131
138
|
const [k, v] = part.split(":").map((s) => s.trim());
|
|
132
|
-
if (k === "agent")
|
|
133
|
-
|
|
139
|
+
if (k === "agent")
|
|
140
|
+
agent = v;
|
|
141
|
+
if (k === "model")
|
|
142
|
+
model = v;
|
|
134
143
|
}
|
|
135
144
|
}
|
|
136
145
|
const { content, toolCalls } = parseContentAndToolCalls(rawContent);
|
|
@@ -140,9 +149,12 @@ function parseTurns(body) {
|
|
|
140
149
|
role: m.role,
|
|
141
150
|
content: unescapedContent
|
|
142
151
|
};
|
|
143
|
-
if (agent)
|
|
144
|
-
|
|
145
|
-
if (
|
|
152
|
+
if (agent)
|
|
153
|
+
turn.agent = agent;
|
|
154
|
+
if (model)
|
|
155
|
+
turn.model = model;
|
|
156
|
+
if (toolCalls.length > 0)
|
|
157
|
+
turn.toolCalls = toolCalls;
|
|
146
158
|
turns.push(turn);
|
|
147
159
|
}
|
|
148
160
|
return turns;
|
|
@@ -193,11 +205,12 @@ function parseToolCallSection(name, section) {
|
|
|
193
205
|
}
|
|
194
206
|
}
|
|
195
207
|
const toolCall = { name, input, result };
|
|
196
|
-
if (isError)
|
|
208
|
+
if (isError)
|
|
209
|
+
toolCall.isError = true;
|
|
197
210
|
return toolCall;
|
|
198
211
|
}
|
|
199
212
|
|
|
200
|
-
// ../chitragupta/packages/smriti/
|
|
213
|
+
// ../chitragupta/packages/smriti/dist/markdown-writer.js
|
|
201
214
|
function writeFrontmatter(meta) {
|
|
202
215
|
const lines = [];
|
|
203
216
|
lines.push("---");
|
|
@@ -247,8 +260,10 @@ function writeTurn(turn) {
|
|
|
247
260
|
const lines = [];
|
|
248
261
|
let heading = `## Turn ${turn.turnNumber} \u2014 ${turn.role}`;
|
|
249
262
|
const metaParts = [];
|
|
250
|
-
if (turn.agent)
|
|
251
|
-
|
|
263
|
+
if (turn.agent)
|
|
264
|
+
metaParts.push(`agent: ${turn.agent}`);
|
|
265
|
+
if (turn.model)
|
|
266
|
+
metaParts.push(`model: ${turn.model}`);
|
|
252
267
|
if (metaParts.length > 0) {
|
|
253
268
|
heading += ` (${metaParts.join(", ")})`;
|
|
254
269
|
}
|
|
@@ -288,7 +303,7 @@ function writeTurnMarkdown(turn) {
|
|
|
288
303
|
return writeTurn(turn);
|
|
289
304
|
}
|
|
290
305
|
|
|
291
|
-
// ../chitragupta/packages/smriti/
|
|
306
|
+
// ../chitragupta/packages/smriti/dist/session-store.js
|
|
292
307
|
function atomicRename(tmpPath, targetPath) {
|
|
293
308
|
try {
|
|
294
309
|
nodeRenameSync(tmpPath, targetPath);
|
|
@@ -318,7 +333,8 @@ function cacheKey(id, project) {
|
|
|
318
333
|
function cacheGet(id, project) {
|
|
319
334
|
const key = cacheKey(id, project);
|
|
320
335
|
const entry = sessionCache.get(key);
|
|
321
|
-
if (!entry)
|
|
336
|
+
if (!entry)
|
|
337
|
+
return void 0;
|
|
322
338
|
const size = sessionCacheSizes.get(key) ?? 0;
|
|
323
339
|
sessionCache.delete(key);
|
|
324
340
|
sessionCacheSizes.delete(key);
|
|
@@ -335,7 +351,8 @@ function cachePut(id, project, session) {
|
|
|
335
351
|
const newSize = estimateSessionBytes(session);
|
|
336
352
|
while ((sessionCache.size >= SESSION_CACHE_MAX || sessionCacheBytes + newSize > SESSION_CACHE_MAX_BYTES) && sessionCache.size > 0) {
|
|
337
353
|
const oldest = sessionCache.keys().next().value;
|
|
338
|
-
if (oldest === void 0)
|
|
354
|
+
if (oldest === void 0)
|
|
355
|
+
break;
|
|
339
356
|
const evictedSize = sessionCacheSizes.get(oldest) ?? 0;
|
|
340
357
|
sessionCache.delete(oldest);
|
|
341
358
|
sessionCacheSizes.delete(oldest);
|
|
@@ -399,10 +416,12 @@ function resolveSessionPath(id, project) {
|
|
|
399
416
|
const dateMatch = id.match(/^session-(\d{4})-(\d{2})-\d{2}/);
|
|
400
417
|
if (dateMatch) {
|
|
401
418
|
const newPath = path.join(projectDir, dateMatch[1], dateMatch[2], `${id}.md`);
|
|
402
|
-
if (fs.existsSync(newPath))
|
|
419
|
+
if (fs.existsSync(newPath))
|
|
420
|
+
return newPath;
|
|
403
421
|
}
|
|
404
422
|
const oldPath = path.join(projectDir, `${id}.md`);
|
|
405
|
-
if (fs.existsSync(oldPath))
|
|
423
|
+
if (fs.existsSync(oldPath))
|
|
424
|
+
return oldPath;
|
|
406
425
|
if (dateMatch) {
|
|
407
426
|
return path.join(projectDir, dateMatch[1], dateMatch[2], `${id}.md`);
|
|
408
427
|
}
|
|
@@ -410,14 +429,14 @@ function resolveSessionPath(id, project) {
|
|
|
410
429
|
}
|
|
411
430
|
function patchFrontmatterUpdated(content, updatedIso) {
|
|
412
431
|
const fmMatch = content.match(/^---\n([\s\S]*?)\n---/);
|
|
413
|
-
if (!fmMatch)
|
|
432
|
+
if (!fmMatch)
|
|
433
|
+
return content;
|
|
414
434
|
const frontmatter = fmMatch[1];
|
|
415
|
-
if (!/^updated:\s/m.test(frontmatter))
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
if (patchedFrontmatter === frontmatter) return content;
|
|
435
|
+
if (!/^updated:\s/m.test(frontmatter))
|
|
436
|
+
return content;
|
|
437
|
+
const patchedFrontmatter = frontmatter.replace(/^updated:\s.*$/m, `updated: ${updatedIso}`);
|
|
438
|
+
if (patchedFrontmatter === frontmatter)
|
|
439
|
+
return content;
|
|
421
440
|
return `---
|
|
422
441
|
${patchedFrontmatter}
|
|
423
442
|
---${content.slice(fmMatch[0].length)}`;
|
|
@@ -517,7 +536,8 @@ function upsertSessionToDb(meta, filePath) {
|
|
|
517
536
|
}
|
|
518
537
|
}
|
|
519
538
|
function isRecoverableSessionConstraintError(err) {
|
|
520
|
-
if (!(err instanceof Error))
|
|
539
|
+
if (!(err instanceof Error))
|
|
540
|
+
return false;
|
|
521
541
|
const lower = err.message.toLowerCase();
|
|
522
542
|
return lower.includes("foreign key constraint failed") || lower.includes("constraint failed");
|
|
523
543
|
}
|
|
@@ -528,15 +548,7 @@ function seedSessionRowForTurn(sessionId, project, filePath) {
|
|
|
528
548
|
db.prepare(`
|
|
529
549
|
INSERT OR IGNORE INTO sessions (id, project, title, created_at, updated_at, turn_count, file_path)
|
|
530
550
|
VALUES (?, ?, ?, ?, ?, ?, ?)
|
|
531
|
-
`).run(
|
|
532
|
-
sessionId,
|
|
533
|
-
project,
|
|
534
|
-
"Recovered Session",
|
|
535
|
-
now,
|
|
536
|
-
now,
|
|
537
|
-
0,
|
|
538
|
-
normalizedFilePath
|
|
539
|
-
);
|
|
551
|
+
`).run(sessionId, project, "Recovered Session", now, now, 0, normalizedFilePath);
|
|
540
552
|
}
|
|
541
553
|
function insertTurnToDb(sessionId, turn, context) {
|
|
542
554
|
try {
|
|
@@ -546,25 +558,11 @@ function insertTurnToDb(sessionId, turn, context) {
|
|
|
546
558
|
const result = db.prepare(`
|
|
547
559
|
INSERT OR IGNORE INTO turns (session_id, turn_number, role, content, agent, model, tool_calls, created_at)
|
|
548
560
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
|
549
|
-
`).run(
|
|
550
|
-
sessionId,
|
|
551
|
-
turn.turnNumber,
|
|
552
|
-
turn.role,
|
|
553
|
-
turn.content,
|
|
554
|
-
turn.agent ?? null,
|
|
555
|
-
turn.model ?? null,
|
|
556
|
-
turn.toolCalls ? JSON.stringify(turn.toolCalls) : null,
|
|
557
|
-
now
|
|
558
|
-
);
|
|
561
|
+
`).run(sessionId, turn.turnNumber, turn.role, turn.content, turn.agent ?? null, turn.model ?? null, turn.toolCalls ? JSON.stringify(turn.toolCalls) : null, now);
|
|
559
562
|
if (result.changes > 0) {
|
|
560
|
-
db.prepare("INSERT OR IGNORE INTO turns_fts (rowid, content) VALUES (?, ?)").run(
|
|
561
|
-
result.lastInsertRowid,
|
|
562
|
-
turn.content
|
|
563
|
-
);
|
|
563
|
+
db.prepare("INSERT OR IGNORE INTO turns_fts (rowid, content) VALUES (?, ?)").run(result.lastInsertRowid, turn.content);
|
|
564
564
|
}
|
|
565
|
-
db.prepare(
|
|
566
|
-
"UPDATE sessions SET turn_count = turn_count + 1, updated_at = ? WHERE id = ?"
|
|
567
|
-
).run(now, sessionId);
|
|
565
|
+
db.prepare("UPDATE sessions SET turn_count = turn_count + 1, updated_at = ? WHERE id = ?").run(now, sessionId);
|
|
568
566
|
});
|
|
569
567
|
try {
|
|
570
568
|
writeTurn2();
|
|
@@ -579,10 +577,8 @@ function insertTurnToDb(sessionId, turn, context) {
|
|
|
579
577
|
}
|
|
580
578
|
} catch (err) {
|
|
581
579
|
const code = typeof err === "object" && err !== null && "code" in err ? String(err.code) : "unknown";
|
|
582
|
-
process.stderr.write(
|
|
583
|
-
|
|
584
|
-
`
|
|
585
|
-
);
|
|
580
|
+
process.stderr.write(`[chitragupta] turn insert failed for session ${sessionId} (turn=${turn.turnNumber}, role=${turn.role}, code=${code}): ${err instanceof Error ? err.message : err}
|
|
581
|
+
`);
|
|
586
582
|
}
|
|
587
583
|
}
|
|
588
584
|
function createSession(opts) {
|
|
@@ -624,14 +620,13 @@ function saveSession(session) {
|
|
|
624
620
|
atomicRename(tmpPath, filePath);
|
|
625
621
|
cachePut(session.meta.id, session.meta.project, session);
|
|
626
622
|
} catch (err) {
|
|
627
|
-
throw new SessionError(
|
|
628
|
-
`Failed to save session ${session.meta.id} at ${filePath}: ${err.message}`
|
|
629
|
-
);
|
|
623
|
+
throw new SessionError(`Failed to save session ${session.meta.id} at ${filePath}: ${err.message}`);
|
|
630
624
|
}
|
|
631
625
|
}
|
|
632
626
|
function loadSession(id, project) {
|
|
633
627
|
const cached = cacheGet(id, project);
|
|
634
|
-
if (cached)
|
|
628
|
+
if (cached)
|
|
629
|
+
return cached;
|
|
635
630
|
const filePath = resolveSessionPath(id, project);
|
|
636
631
|
if (!fs.existsSync(filePath)) {
|
|
637
632
|
throw new SessionError(`Session not found: ${id} (project: ${project})`);
|
|
@@ -642,10 +637,9 @@ function loadSession(id, project) {
|
|
|
642
637
|
cachePut(id, project, session);
|
|
643
638
|
return session;
|
|
644
639
|
} catch (err) {
|
|
645
|
-
if (err instanceof SessionError)
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
);
|
|
640
|
+
if (err instanceof SessionError)
|
|
641
|
+
throw err;
|
|
642
|
+
throw new SessionError(`Failed to load session ${id}: ${err.message}`);
|
|
649
643
|
}
|
|
650
644
|
}
|
|
651
645
|
function listSessions(project) {
|
|
@@ -653,13 +647,9 @@ function listSessions(project) {
|
|
|
653
647
|
const db = getAgentDb();
|
|
654
648
|
let rows;
|
|
655
649
|
if (project) {
|
|
656
|
-
rows = db.prepare(
|
|
657
|
-
"SELECT * FROM sessions WHERE project = ? ORDER BY updated_at DESC"
|
|
658
|
-
).all(project);
|
|
650
|
+
rows = db.prepare("SELECT * FROM sessions WHERE project = ? ORDER BY updated_at DESC").all(project);
|
|
659
651
|
} else {
|
|
660
|
-
rows = db.prepare(
|
|
661
|
-
"SELECT * FROM sessions ORDER BY updated_at DESC"
|
|
662
|
-
).all();
|
|
652
|
+
rows = db.prepare("SELECT * FROM sessions ORDER BY updated_at DESC").all();
|
|
663
653
|
}
|
|
664
654
|
if (rows.length > 0) {
|
|
665
655
|
return rows.map(rowToSessionMeta);
|
|
@@ -684,13 +674,9 @@ function listSessionsByDateRange(startMs, endMs, project) {
|
|
|
684
674
|
const db = getAgentDb();
|
|
685
675
|
let rows;
|
|
686
676
|
if (project) {
|
|
687
|
-
rows = db.prepare(
|
|
688
|
-
"SELECT * FROM sessions WHERE project = ? AND created_at >= ? AND created_at < ? ORDER BY created_at ASC"
|
|
689
|
-
).all(project, startMs, endMs);
|
|
677
|
+
rows = db.prepare("SELECT * FROM sessions WHERE project = ? AND created_at >= ? AND created_at < ? ORDER BY created_at ASC").all(project, startMs, endMs);
|
|
690
678
|
} else {
|
|
691
|
-
rows = db.prepare(
|
|
692
|
-
"SELECT * FROM sessions WHERE created_at >= ? AND created_at < ? ORDER BY created_at ASC"
|
|
693
|
-
).all(startMs, endMs);
|
|
679
|
+
rows = db.prepare("SELECT * FROM sessions WHERE created_at >= ? AND created_at < ? ORDER BY created_at ASC").all(startMs, endMs);
|
|
694
680
|
}
|
|
695
681
|
if (rows.length > 0) {
|
|
696
682
|
return rows.map(rowToSessionMeta);
|
|
@@ -708,17 +694,13 @@ function listSessionDates(project) {
|
|
|
708
694
|
const db = getAgentDb();
|
|
709
695
|
let rows;
|
|
710
696
|
if (project) {
|
|
711
|
-
rows = db.prepare(
|
|
712
|
-
`SELECT DISTINCT date(created_at / 1000, 'unixepoch') as session_date
|
|
697
|
+
rows = db.prepare(`SELECT DISTINCT date(created_at / 1000, 'unixepoch') as session_date
|
|
713
698
|
FROM sessions WHERE project = ?
|
|
714
|
-
ORDER BY session_date DESC`
|
|
715
|
-
).all(project);
|
|
699
|
+
ORDER BY session_date DESC`).all(project);
|
|
716
700
|
} else {
|
|
717
|
-
rows = db.prepare(
|
|
718
|
-
`SELECT DISTINCT date(created_at / 1000, 'unixepoch') as session_date
|
|
701
|
+
rows = db.prepare(`SELECT DISTINCT date(created_at / 1000, 'unixepoch') as session_date
|
|
719
702
|
FROM sessions
|
|
720
|
-
ORDER BY session_date DESC`
|
|
721
|
-
).all();
|
|
703
|
+
ORDER BY session_date DESC`).all();
|
|
722
704
|
}
|
|
723
705
|
return rows.map((r) => r.session_date).filter(Boolean);
|
|
724
706
|
} catch {
|
|
@@ -733,12 +715,10 @@ function listSessionDates(project) {
|
|
|
733
715
|
function listSessionProjects() {
|
|
734
716
|
try {
|
|
735
717
|
const db = getAgentDb();
|
|
736
|
-
const rows = db.prepare(
|
|
737
|
-
`SELECT project, COUNT(*) as count, MAX(updated_at) as last_active
|
|
718
|
+
const rows = db.prepare(`SELECT project, COUNT(*) as count, MAX(updated_at) as last_active
|
|
738
719
|
FROM sessions
|
|
739
720
|
GROUP BY project
|
|
740
|
-
ORDER BY last_active DESC`
|
|
741
|
-
).all();
|
|
721
|
+
ORDER BY last_active DESC`).all();
|
|
742
722
|
return rows.map((r) => ({
|
|
743
723
|
project: r.project,
|
|
744
724
|
sessionCount: r.count,
|
|
@@ -750,11 +730,13 @@ function listSessionProjects() {
|
|
|
750
730
|
}
|
|
751
731
|
function listSessionsFromFilesystem(project) {
|
|
752
732
|
const sessionsRoot = getSessionsRoot();
|
|
753
|
-
if (!fs.existsSync(sessionsRoot))
|
|
733
|
+
if (!fs.existsSync(sessionsRoot))
|
|
734
|
+
return [];
|
|
754
735
|
const results = [];
|
|
755
736
|
if (project) {
|
|
756
737
|
const projectDir = getProjectSessionDir(project);
|
|
757
|
-
if (!fs.existsSync(projectDir))
|
|
738
|
+
if (!fs.existsSync(projectDir))
|
|
739
|
+
return [];
|
|
758
740
|
results.push(...scanDirRecursive(projectDir));
|
|
759
741
|
} else {
|
|
760
742
|
const projectDirs = fs.readdirSync(sessionsRoot, { withFileTypes: true });
|
|
@@ -863,9 +845,7 @@ ${turnMd}
|
|
|
863
845
|
function listTurnsWithTimestamps(sessionId, project) {
|
|
864
846
|
try {
|
|
865
847
|
const db = getAgentDb();
|
|
866
|
-
const rows = db.prepare(
|
|
867
|
-
"SELECT turn_number, role, content, agent, model, tool_calls, created_at FROM turns WHERE session_id = ? ORDER BY turn_number ASC"
|
|
868
|
-
).all(sessionId);
|
|
848
|
+
const rows = db.prepare("SELECT turn_number, role, content, agent, model, tool_calls, created_at FROM turns WHERE session_id = ? ORDER BY turn_number ASC").all(sessionId);
|
|
869
849
|
if (rows.length > 0) {
|
|
870
850
|
return rows.map((row) => ({
|
|
871
851
|
turnNumber: row.turn_number,
|
|
@@ -912,7 +892,8 @@ function updateSessionMeta(sessionId, updates) {
|
|
|
912
892
|
sets.push("tags = @tags");
|
|
913
893
|
params.tags = JSON.stringify(updates.tags);
|
|
914
894
|
}
|
|
915
|
-
if (sets.length === 0)
|
|
895
|
+
if (sets.length === 0)
|
|
896
|
+
return;
|
|
916
897
|
sets.push("updated_at = @updated_at");
|
|
917
898
|
params.updated_at = Date.now();
|
|
918
899
|
db.prepare(`UPDATE sessions SET ${sets.join(", ")} WHERE id = @id`).run(params);
|
|
@@ -945,7 +926,8 @@ function findSessionByMetadata(key, value, project) {
|
|
|
945
926
|
function migrateExistingSessions(project) {
|
|
946
927
|
const db = getAgentDb();
|
|
947
928
|
const sessionsRoot = getSessionsRoot();
|
|
948
|
-
if (!fs.existsSync(sessionsRoot))
|
|
929
|
+
if (!fs.existsSync(sessionsRoot))
|
|
930
|
+
return { migrated: 0, skipped: 0 };
|
|
949
931
|
let migrated = 0;
|
|
950
932
|
let skipped = 0;
|
|
951
933
|
const dirs = project ? [getProjectSessionDir(project)] : fs.readdirSync(sessionsRoot, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => path.join(sessionsRoot, e.name));
|
|
@@ -957,9 +939,7 @@ function migrateExistingSessions(project) {
|
|
|
957
939
|
INSERT OR IGNORE INTO turns (session_id, turn_number, role, content, agent, model, tool_calls, created_at)
|
|
958
940
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
|
959
941
|
`);
|
|
960
|
-
const insertFts = db.prepare(
|
|
961
|
-
"INSERT INTO turns_fts (rowid, content) VALUES (?, ?)"
|
|
962
|
-
);
|
|
942
|
+
const insertFts = db.prepare("INSERT INTO turns_fts (rowid, content) VALUES (?, ?)");
|
|
963
943
|
const migrateFile = (mdPath, relativePath) => {
|
|
964
944
|
try {
|
|
965
945
|
const content = fs.readFileSync(mdPath, "utf-8");
|
|
@@ -973,16 +953,7 @@ function migrateExistingSessions(project) {
|
|
|
973
953
|
row.turn_count = session.turns.length;
|
|
974
954
|
insertSession.run(row);
|
|
975
955
|
for (const turn of session.turns) {
|
|
976
|
-
const result = insertTurn.run(
|
|
977
|
-
session.meta.id,
|
|
978
|
-
turn.turnNumber,
|
|
979
|
-
turn.role,
|
|
980
|
-
turn.content,
|
|
981
|
-
turn.agent ?? null,
|
|
982
|
-
turn.model ?? null,
|
|
983
|
-
turn.toolCalls ? JSON.stringify(turn.toolCalls) : null,
|
|
984
|
-
new Date(session.meta.created).getTime()
|
|
985
|
-
);
|
|
956
|
+
const result = insertTurn.run(session.meta.id, turn.turnNumber, turn.role, turn.content, turn.agent ?? null, turn.model ?? null, turn.toolCalls ? JSON.stringify(turn.toolCalls) : null, new Date(session.meta.created).getTime());
|
|
986
957
|
if (result.changes > 0) {
|
|
987
958
|
insertFts.run(result.lastInsertRowid, turn.content);
|
|
988
959
|
}
|
|
@@ -994,7 +965,8 @@ function migrateExistingSessions(project) {
|
|
|
994
965
|
};
|
|
995
966
|
const runMigration = db.transaction(() => {
|
|
996
967
|
for (const dir of dirs) {
|
|
997
|
-
if (!fs.existsSync(dir))
|
|
968
|
+
if (!fs.existsSync(dir))
|
|
969
|
+
continue;
|
|
998
970
|
walkMdFiles(dir, sessionsRoot, migrateFile);
|
|
999
971
|
}
|
|
1000
972
|
});
|
|
@@ -1040,4 +1012,4 @@ export {
|
|
|
1040
1012
|
findSessionByMetadata,
|
|
1041
1013
|
migrateExistingSessions
|
|
1042
1014
|
};
|
|
1043
|
-
//# sourceMappingURL=chunk-
|
|
1015
|
+
//# sourceMappingURL=chunk-ZYY6N3SP.js.map
|
|
@@ -4,13 +4,13 @@ import {
|
|
|
4
4
|
extractSummaryText,
|
|
5
5
|
indexConsolidationSummary,
|
|
6
6
|
searchConsolidationSummaries
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-JZTFJE7M.js";
|
|
8
|
+
import "./chunk-D46QTN3G.js";
|
|
9
|
+
import "./chunk-ZYY6N3SP.js";
|
|
10
|
+
import "./chunk-A3HOZBC5.js";
|
|
11
|
+
import "./chunk-V2ZIKDN4.js";
|
|
12
|
+
import "./chunk-67DXWEKG.js";
|
|
13
|
+
import "./chunk-2OBLQJYJ.js";
|
|
14
14
|
import "./chunk-IGKYKEKT.js";
|
|
15
15
|
export {
|
|
16
16
|
_resetConsolidationIndexer,
|
|
@@ -19,4 +19,4 @@ export {
|
|
|
19
19
|
indexConsolidationSummary,
|
|
20
20
|
searchConsolidationSummaries
|
|
21
21
|
};
|
|
22
|
-
//# sourceMappingURL=consolidation-indexer-
|
|
22
|
+
//# sourceMappingURL=consolidation-indexer-VIWOP6VO.js.map
|
|
@@ -9,9 +9,9 @@ import {
|
|
|
9
9
|
listDayFiles,
|
|
10
10
|
readDayFile,
|
|
11
11
|
searchDayFiles
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-F6RNEGFX.js";
|
|
13
|
+
import "./chunk-A3HOZBC5.js";
|
|
14
|
+
import "./chunk-2OBLQJYJ.js";
|
|
15
15
|
import "./chunk-IGKYKEKT.js";
|
|
16
16
|
export {
|
|
17
17
|
consolidateDay,
|
|
@@ -25,4 +25,4 @@ export {
|
|
|
25
25
|
readDayFile,
|
|
26
26
|
searchDayFiles
|
|
27
27
|
};
|
|
28
|
-
//# sourceMappingURL=day-consolidation-
|
|
28
|
+
//# sourceMappingURL=day-consolidation-HMHSXIOM.js.map
|
|
@@ -41,13 +41,13 @@ import {
|
|
|
41
41
|
sinkhornAccelerated,
|
|
42
42
|
sinkhornKnopp,
|
|
43
43
|
writeCrossMachineSnapshot
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-VCUJES75.js";
|
|
45
45
|
import {
|
|
46
46
|
backfillConsolidationIndices,
|
|
47
47
|
extractSummaryText,
|
|
48
48
|
indexConsolidationSummary,
|
|
49
49
|
searchConsolidationSummaries
|
|
50
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-JZTFJE7M.js";
|
|
51
51
|
import {
|
|
52
52
|
FactExtractor,
|
|
53
53
|
consolidateDay,
|
|
@@ -62,30 +62,30 @@ import {
|
|
|
62
62
|
listDayFiles,
|
|
63
63
|
readDayFile,
|
|
64
64
|
searchDayFiles
|
|
65
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-F6RNEGFX.js";
|
|
66
66
|
import {
|
|
67
67
|
HybridSearchEngine,
|
|
68
68
|
HybridWeightLearner,
|
|
69
69
|
PRAMANA_RELIABILITY,
|
|
70
70
|
shouldRetrieve
|
|
71
|
-
} from "./chunk-
|
|
71
|
+
} from "./chunk-QV4GPIPT.js";
|
|
72
72
|
import {
|
|
73
73
|
VasanaEngine
|
|
74
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-W4PVGBUH.js";
|
|
75
75
|
import {
|
|
76
76
|
hierarchicalTemporalSearch
|
|
77
|
-
} from "./chunk-
|
|
77
|
+
} from "./chunk-7XV5ISV7.js";
|
|
78
78
|
import {
|
|
79
79
|
searchMemory,
|
|
80
80
|
searchSessions
|
|
81
|
-
} from "./chunk-
|
|
81
|
+
} from "./chunk-3AYSJ7WB.js";
|
|
82
82
|
import {
|
|
83
83
|
appendMemory,
|
|
84
84
|
deleteMemory,
|
|
85
85
|
getMemory,
|
|
86
86
|
listMemoryScopes,
|
|
87
87
|
updateMemory
|
|
88
|
-
} from "./chunk-
|
|
88
|
+
} from "./chunk-7AYYXHYZ.js";
|
|
89
89
|
import {
|
|
90
90
|
GraphRAGEngine,
|
|
91
91
|
IncrementalPageRank,
|
|
@@ -104,7 +104,7 @@ import {
|
|
|
104
104
|
queryEdgesAtTime,
|
|
105
105
|
supersedEdge,
|
|
106
106
|
temporalDecay
|
|
107
|
-
} from "./chunk-
|
|
107
|
+
} from "./chunk-LJUEMPLG.js";
|
|
108
108
|
import {
|
|
109
109
|
PRESERVATION_RATIOS,
|
|
110
110
|
RecallEngine,
|
|
@@ -116,7 +116,7 @@ import {
|
|
|
116
116
|
configureRecallScoring,
|
|
117
117
|
migrateEmbeddingsJson,
|
|
118
118
|
vectorToBlob
|
|
119
|
-
} from "./chunk-
|
|
119
|
+
} from "./chunk-D46QTN3G.js";
|
|
120
120
|
import {
|
|
121
121
|
addTurn,
|
|
122
122
|
createSession,
|
|
@@ -136,25 +136,25 @@ import {
|
|
|
136
136
|
updateSessionMeta,
|
|
137
137
|
writeSessionMarkdown,
|
|
138
138
|
writeTurnMarkdown
|
|
139
|
-
} from "./chunk-
|
|
139
|
+
} from "./chunk-ZYY6N3SP.js";
|
|
140
140
|
import {
|
|
141
141
|
EmbeddingService,
|
|
142
142
|
estimateTokens,
|
|
143
143
|
fallbackEmbedding
|
|
144
|
-
} from "./chunk-
|
|
144
|
+
} from "./chunk-A3HOZBC5.js";
|
|
145
145
|
import {
|
|
146
146
|
PeriodicConsolidation
|
|
147
|
-
} from "./chunk-
|
|
147
|
+
} from "./chunk-Z576WVLG.js";
|
|
148
148
|
import {
|
|
149
149
|
initAgentSchema,
|
|
150
150
|
initAllSchemas,
|
|
151
151
|
initGraphSchema,
|
|
152
152
|
initVectorsSchema
|
|
153
|
-
} from "./chunk-
|
|
153
|
+
} from "./chunk-V2ZIKDN4.js";
|
|
154
154
|
import {
|
|
155
155
|
DatabaseManager
|
|
156
|
-
} from "./chunk-
|
|
157
|
-
import "./chunk-
|
|
156
|
+
} from "./chunk-67DXWEKG.js";
|
|
157
|
+
import "./chunk-2OBLQJYJ.js";
|
|
158
158
|
import "./chunk-IGKYKEKT.js";
|
|
159
159
|
export {
|
|
160
160
|
AdaptiveScorer,
|
|
@@ -284,4 +284,4 @@ export {
|
|
|
284
284
|
writeSessionMarkdown,
|
|
285
285
|
writeTurnMarkdown
|
|
286
286
|
};
|
|
287
|
-
//# sourceMappingURL=
|
|
287
|
+
//# sourceMappingURL=dist-CY5NX2IK.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GraphRAGEngine,
|
|
3
|
+
migrateGraphJson
|
|
4
|
+
} from "./chunk-LJUEMPLG.js";
|
|
5
|
+
import "./chunk-A3HOZBC5.js";
|
|
6
|
+
import "./chunk-V2ZIKDN4.js";
|
|
7
|
+
import "./chunk-67DXWEKG.js";
|
|
8
|
+
import "./chunk-2OBLQJYJ.js";
|
|
9
|
+
import "./chunk-IGKYKEKT.js";
|
|
10
|
+
export {
|
|
11
|
+
GraphRAGEngine,
|
|
12
|
+
migrateGraphJson
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=graphrag-T2QWNX57.js.map
|
package/chunks/{hierarchical-temporal-search-PVHVA3NZ.js → hierarchical-temporal-search-U6DG74IR.js}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
hierarchicalTemporalSearch
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-7XV5ISV7.js";
|
|
4
4
|
import "./chunk-IGKYKEKT.js";
|
|
5
5
|
export {
|
|
6
6
|
hierarchicalTemporalSearch
|
|
7
7
|
};
|
|
8
|
-
//# sourceMappingURL=hierarchical-temporal-search-
|
|
8
|
+
//# sourceMappingURL=hierarchical-temporal-search-U6DG74IR.js.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
HybridSearchEngine,
|
|
3
|
+
HybridWeightLearner,
|
|
4
|
+
PRAMANA_RELIABILITY,
|
|
5
|
+
shouldRetrieve
|
|
6
|
+
} from "./chunk-QV4GPIPT.js";
|
|
7
|
+
import "./chunk-3AYSJ7WB.js";
|
|
8
|
+
import "./chunk-7AYYXHYZ.js";
|
|
9
|
+
import "./chunk-ZYY6N3SP.js";
|
|
10
|
+
import "./chunk-V2ZIKDN4.js";
|
|
11
|
+
import "./chunk-67DXWEKG.js";
|
|
12
|
+
import "./chunk-2OBLQJYJ.js";
|
|
13
|
+
import "./chunk-IGKYKEKT.js";
|
|
14
|
+
export {
|
|
15
|
+
HybridSearchEngine,
|
|
16
|
+
HybridWeightLearner,
|
|
17
|
+
PRAMANA_RELIABILITY,
|
|
18
|
+
shouldRetrieve
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=hybrid-search-BYTXCOXP.js.map
|
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
getMemory,
|
|
5
5
|
listMemoryScopes,
|
|
6
6
|
updateMemory
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-7AYYXHYZ.js";
|
|
8
|
+
import "./chunk-2OBLQJYJ.js";
|
|
9
9
|
import "./chunk-IGKYKEKT.js";
|
|
10
10
|
export {
|
|
11
11
|
appendMemory,
|
|
@@ -14,4 +14,4 @@ export {
|
|
|
14
14
|
listMemoryScopes,
|
|
15
15
|
updateMemory
|
|
16
16
|
};
|
|
17
|
-
//# sourceMappingURL=memory-store-
|
|
17
|
+
//# sourceMappingURL=memory-store-LEERUQGL.js.map
|