@yugenlab/vaayu 0.1.0 → 0.1.2
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/{chunk-L7JICQBW.js → chunk-2ARPXEDC.js} +5 -3
- package/chunks/{chunk-IIET2K6D.js → chunk-5Z2BKSFF.js} +81 -603
- package/chunks/{chunk-MINFB5LT.js → chunk-C76USAC5.js} +30 -6
- package/chunks/{chunk-URGEODS5.js → chunk-DQMAQ2VL.js} +4 -4
- package/chunks/{chunk-JZU37VQ5.js → chunk-F35MWELH.js} +6 -4
- package/chunks/chunk-F4T7POKM.js +545 -0
- package/chunks/{chunk-H76V36OF.js → chunk-FPNQLJLD.js} +4 -4
- package/chunks/{chunk-KDRROLVN.js → chunk-NBXCXQ3H.js} +2 -2
- package/chunks/{chunk-YSU3BWV6.js → chunk-OWBBY5XP.js} +2 -2
- package/chunks/{chunk-SMVJRPAH.js → chunk-PRXQW76U.js} +46 -6
- package/chunks/{chunk-S4TBVCL2.js → chunk-SLA2OIMG.js} +5 -3
- package/chunks/chunk-UQLPHNGH.js +123 -0
- package/chunks/{chunk-ITIVYGUG.js → chunk-UW6E7IC4.js} +6 -4
- package/chunks/{chunk-HAPVUJ6A.js → chunk-XRHUKKBC.js} +9 -7
- package/chunks/{chunk-U6OLJ36B.js → chunk-YJRXLRTE.js} +21 -122
- package/chunks/{consolidation-indexer-TOTTDZXW.js → consolidation-indexer-A46RJU4R.js} +6 -5
- package/chunks/{day-consolidation-NKO63HZQ.js → day-consolidation-GQ2FDCR2.js} +2 -2
- package/chunks/{graphrag-ZI2FSU7S.js → graphrag-6YZ5YPLK.js} +4 -3
- package/chunks/{hierarchical-temporal-search-ZD46UMKR.js → hierarchical-temporal-search-VA4D3SON.js} +2 -2
- package/chunks/{hybrid-search-ZVLZVGFS.js → hybrid-search-6XMUT66S.js} +6 -5
- package/chunks/periodic-consolidation-N5MR77ZN.js +11 -0
- package/chunks/{postgres-3ZXBYTPC.js → postgres-WLH3D5HG.js} +2 -2
- package/chunks/{recall-GMVHWQWW.js → recall-THTI6ZO2.js} +5 -4
- package/chunks/{search-7HZETVMZ.js → search-V7DJ3VNL.js} +5 -4
- package/chunks/{session-store-XKPGKXUS.js → session-store-GRKGTMHI.js} +4 -3
- package/chunks/{sqlite-JPF5TICX.js → sqlite-DHUQGPR5.js} +2 -2
- package/chunks/{src-QAXOD5SB.js → src-54LTTDTH.js} +18 -14
- package/chunks/vasana-engine-Z4RXW2SB.js +10 -0
- package/gateway.js +1429 -264
- package/package.json +1 -1
- package/chunks/periodic-consolidation-BPKOZDGB.js +0 -10
|
@@ -696,7 +696,7 @@ async function consolidateDay(date, options) {
|
|
|
696
696
|
if (options?.loadSessions) {
|
|
697
697
|
sessions = await options.loadSessions(date);
|
|
698
698
|
} else {
|
|
699
|
-
const { listSessionsByDate, listTurnsWithTimestamps, loadSession } = await import("./session-store-
|
|
699
|
+
const { listSessionsByDate, listTurnsWithTimestamps, loadSession } = await import("./session-store-GRKGTMHI.js");
|
|
700
700
|
const metas = listSessionsByDate(date);
|
|
701
701
|
sessions = metas.map((meta) => {
|
|
702
702
|
try {
|
|
@@ -771,7 +771,7 @@ async function consolidateDay(date, options) {
|
|
|
771
771
|
fs.mkdirSync(dir, { recursive: true });
|
|
772
772
|
fs.writeFileSync(dayPath, markdown, "utf-8");
|
|
773
773
|
try {
|
|
774
|
-
const { indexConsolidationSummary } = await import("./consolidation-indexer-
|
|
774
|
+
const { indexConsolidationSummary } = await import("./consolidation-indexer-A46RJU4R.js");
|
|
775
775
|
await indexConsolidationSummary("daily", date, markdown);
|
|
776
776
|
} catch {
|
|
777
777
|
}
|
|
@@ -999,7 +999,7 @@ function isDayConsolidated(date) {
|
|
|
999
999
|
return fs.existsSync(getDayFilePath(date));
|
|
1000
1000
|
}
|
|
1001
1001
|
async function getUnconsolidatedDates(limit) {
|
|
1002
|
-
const { listSessionDates } = await import("./session-store-
|
|
1002
|
+
const { listSessionDates } = await import("./session-store-GRKGTMHI.js");
|
|
1003
1003
|
const sessionDates = listSessionDates();
|
|
1004
1004
|
const unconsolidated = [];
|
|
1005
1005
|
for (const date of sessionDates) {
|
|
@@ -1026,4 +1026,4 @@ export {
|
|
|
1026
1026
|
isDayConsolidated,
|
|
1027
1027
|
getUnconsolidatedDates
|
|
1028
1028
|
};
|
|
1029
|
-
//# sourceMappingURL=chunk-
|
|
1029
|
+
//# sourceMappingURL=chunk-FPNQLJLD.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
searchSessions
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-UW6E7IC4.js";
|
|
4
4
|
|
|
5
5
|
// ../chitragupta/packages/smriti/src/hybrid-search.ts
|
|
6
6
|
var PRAMANA_RELIABILITY = {
|
|
@@ -430,4 +430,4 @@ export {
|
|
|
430
430
|
shouldRetrieve,
|
|
431
431
|
HybridSearchEngine
|
|
432
432
|
};
|
|
433
|
-
//# sourceMappingURL=chunk-
|
|
433
|
+
//# sourceMappingURL=chunk-NBXCXQ3H.js.map
|
|
@@ -7,7 +7,7 @@ var DEPTH_BOOST = {
|
|
|
7
7
|
async function hierarchicalTemporalSearch(query, options) {
|
|
8
8
|
const limit = options?.limit ?? 10;
|
|
9
9
|
const results = [];
|
|
10
|
-
const { searchConsolidationSummaries } = await import("./consolidation-indexer-
|
|
10
|
+
const { searchConsolidationSummaries } = await import("./consolidation-indexer-A46RJU4R.js");
|
|
11
11
|
const yearlyHits = await searchConsolidationSummaries(query, "yearly", {
|
|
12
12
|
limit: 3,
|
|
13
13
|
project: options?.project
|
|
@@ -120,4 +120,4 @@ function deduplicateAndSort(results, limit) {
|
|
|
120
120
|
export {
|
|
121
121
|
hierarchicalTemporalSearch
|
|
122
122
|
};
|
|
123
|
-
//# sourceMappingURL=chunk-
|
|
123
|
+
//# sourceMappingURL=chunk-OWBBY5XP.js.map
|
|
@@ -118,10 +118,30 @@ function initAgentSchema(db) {
|
|
|
118
118
|
lane_id TEXT,
|
|
119
119
|
queue_mode TEXT,
|
|
120
120
|
announce_mode TEXT,
|
|
121
|
+
pin_provider_id TEXT,
|
|
122
|
+
pin_model TEXT,
|
|
123
|
+
pin_reason TEXT,
|
|
124
|
+
pin_until TEXT,
|
|
121
125
|
updated_at TEXT
|
|
122
126
|
)
|
|
123
127
|
`);
|
|
124
128
|
db.exec(`CREATE INDEX IF NOT EXISTS session_routes_updated_idx ON session_routes(updated_at)`);
|
|
129
|
+
try {
|
|
130
|
+
db.exec(`ALTER TABLE session_routes ADD COLUMN pin_provider_id TEXT`);
|
|
131
|
+
} catch {
|
|
132
|
+
}
|
|
133
|
+
try {
|
|
134
|
+
db.exec(`ALTER TABLE session_routes ADD COLUMN pin_model TEXT`);
|
|
135
|
+
} catch {
|
|
136
|
+
}
|
|
137
|
+
try {
|
|
138
|
+
db.exec(`ALTER TABLE session_routes ADD COLUMN pin_reason TEXT`);
|
|
139
|
+
} catch {
|
|
140
|
+
}
|
|
141
|
+
try {
|
|
142
|
+
db.exec(`ALTER TABLE session_routes ADD COLUMN pin_until TEXT`);
|
|
143
|
+
} catch {
|
|
144
|
+
}
|
|
125
145
|
db.exec(`
|
|
126
146
|
CREATE TABLE IF NOT EXISTS agent_run_events (
|
|
127
147
|
id TEXT PRIMARY KEY,
|
|
@@ -2353,23 +2373,39 @@ async function listSessionInbox(db, options) {
|
|
|
2353
2373
|
function prepareSessionRouteStatements(db) {
|
|
2354
2374
|
return {
|
|
2355
2375
|
get: db.prepare(
|
|
2356
|
-
"SELECT session_id, agent_id, lane_id, queue_mode, announce_mode, updated_at FROM session_routes WHERE session_id = @session_id"
|
|
2376
|
+
"SELECT session_id, agent_id, lane_id, queue_mode, announce_mode, pin_provider_id, pin_model, pin_reason, pin_until, updated_at FROM session_routes WHERE session_id = @session_id"
|
|
2357
2377
|
),
|
|
2358
2378
|
upsert: db.prepare(
|
|
2359
|
-
"INSERT INTO session_routes (session_id, agent_id, lane_id, queue_mode, announce_mode, updated_at) VALUES (@session_id, @agent_id, @lane_id, @queue_mode, @announce_mode, @updated_at) ON CONFLICT(session_id) DO UPDATE SET agent_id = excluded.agent_id, lane_id = excluded.lane_id, queue_mode = excluded.queue_mode, announce_mode = excluded.announce_mode, updated_at = excluded.updated_at"
|
|
2379
|
+
"INSERT INTO session_routes (session_id, agent_id, lane_id, queue_mode, announce_mode, pin_provider_id, pin_model, pin_reason, pin_until, updated_at) VALUES (@session_id, @agent_id, @lane_id, @queue_mode, @announce_mode, @pin_provider_id, @pin_model, @pin_reason, @pin_until, @updated_at) ON CONFLICT(session_id) DO UPDATE SET agent_id = excluded.agent_id, lane_id = excluded.lane_id, queue_mode = excluded.queue_mode, announce_mode = excluded.announce_mode, pin_provider_id = excluded.pin_provider_id, pin_model = excluded.pin_model, pin_reason = excluded.pin_reason, pin_until = excluded.pin_until, updated_at = excluded.updated_at"
|
|
2360
2380
|
),
|
|
2361
2381
|
list: db.prepare(
|
|
2362
|
-
"SELECT session_id, agent_id, lane_id, queue_mode, announce_mode, updated_at FROM session_routes ORDER BY updated_at DESC LIMIT @limit"
|
|
2382
|
+
"SELECT session_id, agent_id, lane_id, queue_mode, announce_mode, pin_provider_id, pin_model, pin_reason, pin_until, updated_at FROM session_routes ORDER BY updated_at DESC LIMIT @limit"
|
|
2363
2383
|
)
|
|
2364
2384
|
};
|
|
2365
2385
|
}
|
|
2386
|
+
var mapQueueMode = (value) => {
|
|
2387
|
+
if (value === "followup" || value === "collect" || value === "steer" || value === "drop" || value === "reject") {
|
|
2388
|
+
return value;
|
|
2389
|
+
}
|
|
2390
|
+
return void 0;
|
|
2391
|
+
};
|
|
2392
|
+
var mapAnnounceMode = (value) => {
|
|
2393
|
+
if (value === "hub" || value === "channel" || value === "none") {
|
|
2394
|
+
return value;
|
|
2395
|
+
}
|
|
2396
|
+
return void 0;
|
|
2397
|
+
};
|
|
2366
2398
|
var mapRoute = (row) => {
|
|
2367
2399
|
return {
|
|
2368
2400
|
sessionId: String(row.session_id),
|
|
2369
2401
|
agentId: row.agent_id ? String(row.agent_id) : void 0,
|
|
2370
2402
|
laneId: row.lane_id ? String(row.lane_id) : void 0,
|
|
2371
|
-
queueMode:
|
|
2372
|
-
announceMode:
|
|
2403
|
+
queueMode: mapQueueMode(row.queue_mode),
|
|
2404
|
+
announceMode: mapAnnounceMode(row.announce_mode),
|
|
2405
|
+
pinProviderId: row.pin_provider_id ? String(row.pin_provider_id) : void 0,
|
|
2406
|
+
pinModel: row.pin_model ? String(row.pin_model) : void 0,
|
|
2407
|
+
pinReason: row.pin_reason ? String(row.pin_reason) : void 0,
|
|
2408
|
+
pinUntil: row.pin_until ? String(row.pin_until) : void 0,
|
|
2373
2409
|
updatedAt: row.updated_at ? String(row.updated_at) : (/* @__PURE__ */ new Date()).toISOString()
|
|
2374
2410
|
};
|
|
2375
2411
|
};
|
|
@@ -2384,6 +2420,10 @@ async function upsertSessionRoute(s, record) {
|
|
|
2384
2420
|
lane_id: record.laneId ?? null,
|
|
2385
2421
|
queue_mode: record.queueMode ?? null,
|
|
2386
2422
|
announce_mode: record.announceMode ?? null,
|
|
2423
|
+
pin_provider_id: record.pinProviderId ?? null,
|
|
2424
|
+
pin_model: record.pinModel ?? null,
|
|
2425
|
+
pin_reason: record.pinReason ?? null,
|
|
2426
|
+
pin_until: record.pinUntil ?? null,
|
|
2387
2427
|
updated_at: record.updatedAt
|
|
2388
2428
|
});
|
|
2389
2429
|
return record;
|
|
@@ -2750,4 +2790,4 @@ export {
|
|
|
2750
2790
|
deleteReaction,
|
|
2751
2791
|
SqliteStorage
|
|
2752
2792
|
};
|
|
2753
|
-
//# sourceMappingURL=chunk-
|
|
2793
|
+
//# sourceMappingURL=chunk-PRXQW76U.js.map
|
|
@@ -8,9 +8,11 @@ import {
|
|
|
8
8
|
textMatchScore
|
|
9
9
|
} from "./chunk-JAWZ7ANC.js";
|
|
10
10
|
import {
|
|
11
|
-
DatabaseManager,
|
|
12
11
|
initGraphSchema
|
|
13
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-YJRXLRTE.js";
|
|
13
|
+
import {
|
|
14
|
+
DatabaseManager
|
|
15
|
+
} from "./chunk-UQLPHNGH.js";
|
|
14
16
|
import {
|
|
15
17
|
getChitraguptaHome
|
|
16
18
|
} from "./chunk-KC6NRZ7U.js";
|
|
@@ -2155,4 +2157,4 @@ export {
|
|
|
2155
2157
|
GraphRAGEngine,
|
|
2156
2158
|
migrateGraphJson
|
|
2157
2159
|
};
|
|
2158
|
-
//# sourceMappingURL=chunk-
|
|
2160
|
+
//# sourceMappingURL=chunk-SLA2OIMG.js.map
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getChitraguptaHome
|
|
3
|
+
} from "./chunk-KC6NRZ7U.js";
|
|
4
|
+
|
|
5
|
+
// ../chitragupta/packages/smriti/src/db/database.ts
|
|
6
|
+
import Database from "better-sqlite3";
|
|
7
|
+
import fs from "fs";
|
|
8
|
+
import path from "path";
|
|
9
|
+
var DEFAULT_PRAGMAS = {
|
|
10
|
+
journal_mode: "WAL",
|
|
11
|
+
synchronous: "NORMAL",
|
|
12
|
+
// Safe with WAL — fsync on checkpoint only
|
|
13
|
+
cache_size: -64e3,
|
|
14
|
+
// 64MB cache (negative = KB)
|
|
15
|
+
foreign_keys: 1,
|
|
16
|
+
busy_timeout: 5e3,
|
|
17
|
+
// 5s wait on lock contention
|
|
18
|
+
temp_store: "MEMORY",
|
|
19
|
+
mmap_size: 268435456
|
|
20
|
+
// 256MB mmap for read performance
|
|
21
|
+
};
|
|
22
|
+
var DatabaseManager = class _DatabaseManager {
|
|
23
|
+
static _instance = null;
|
|
24
|
+
_databases = /* @__PURE__ */ new Map();
|
|
25
|
+
_dbDir;
|
|
26
|
+
_closed = false;
|
|
27
|
+
constructor(dbDir) {
|
|
28
|
+
this._dbDir = dbDir ?? getChitraguptaHome();
|
|
29
|
+
fs.mkdirSync(this._dbDir, { recursive: true });
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Get or create the singleton instance.
|
|
33
|
+
* @param dbDir - Override the database directory (useful for testing).
|
|
34
|
+
*/
|
|
35
|
+
static instance(dbDir) {
|
|
36
|
+
if (!_DatabaseManager._instance || _DatabaseManager._instance._closed) {
|
|
37
|
+
_DatabaseManager._instance = new _DatabaseManager(dbDir);
|
|
38
|
+
}
|
|
39
|
+
return _DatabaseManager._instance;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Reset the singleton (for testing). Closes all open databases.
|
|
43
|
+
*/
|
|
44
|
+
static reset() {
|
|
45
|
+
if (_DatabaseManager._instance) {
|
|
46
|
+
_DatabaseManager._instance.closeAll();
|
|
47
|
+
_DatabaseManager._instance = null;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Get a database connection by name. Opens it on first access.
|
|
52
|
+
*/
|
|
53
|
+
get(name) {
|
|
54
|
+
if (this._closed) {
|
|
55
|
+
throw new Error("DatabaseManager has been closed");
|
|
56
|
+
}
|
|
57
|
+
let db = this._databases.get(name);
|
|
58
|
+
if (!db) {
|
|
59
|
+
db = this._open(name);
|
|
60
|
+
this._databases.set(name, db);
|
|
61
|
+
}
|
|
62
|
+
return db;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Get the file path for a database.
|
|
66
|
+
*/
|
|
67
|
+
getPath(name) {
|
|
68
|
+
return path.join(this._dbDir, `${name}.db`);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Close all open database connections.
|
|
72
|
+
*/
|
|
73
|
+
closeAll() {
|
|
74
|
+
for (const [name, db] of this._databases) {
|
|
75
|
+
try {
|
|
76
|
+
db.close();
|
|
77
|
+
} catch {
|
|
78
|
+
}
|
|
79
|
+
this._databases.delete(name);
|
|
80
|
+
}
|
|
81
|
+
this._closed = true;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Close a specific database connection.
|
|
85
|
+
*/
|
|
86
|
+
close(name) {
|
|
87
|
+
const db = this._databases.get(name);
|
|
88
|
+
if (db) {
|
|
89
|
+
db.close();
|
|
90
|
+
this._databases.delete(name);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Run VACUUM on a database to reclaim space.
|
|
95
|
+
* Should be called during deep sleep / yearly archival.
|
|
96
|
+
*/
|
|
97
|
+
vacuum(name) {
|
|
98
|
+
this.get(name).exec("VACUUM");
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Check database integrity.
|
|
102
|
+
*/
|
|
103
|
+
integrityCheck(name) {
|
|
104
|
+
const result = this.get(name).pragma("integrity_check");
|
|
105
|
+
return result[0]?.integrity_check ?? "unknown";
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Open a database file and apply pragmas.
|
|
109
|
+
*/
|
|
110
|
+
_open(name) {
|
|
111
|
+
const dbPath = this.getPath(name);
|
|
112
|
+
const db = new Database(dbPath);
|
|
113
|
+
for (const [key, value] of Object.entries(DEFAULT_PRAGMAS)) {
|
|
114
|
+
db.pragma(`${key} = ${value}`);
|
|
115
|
+
}
|
|
116
|
+
return db;
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
export {
|
|
121
|
+
DatabaseManager
|
|
122
|
+
};
|
|
123
|
+
//# sourceMappingURL=chunk-UQLPHNGH.js.map
|
|
@@ -5,11 +5,13 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
listSessions,
|
|
7
7
|
loadSession
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-2ARPXEDC.js";
|
|
9
9
|
import {
|
|
10
|
-
DatabaseManager,
|
|
11
10
|
initAgentSchema
|
|
12
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-YJRXLRTE.js";
|
|
12
|
+
import {
|
|
13
|
+
DatabaseManager
|
|
14
|
+
} from "./chunk-UQLPHNGH.js";
|
|
13
15
|
|
|
14
16
|
// ../chitragupta/packages/smriti/src/search.ts
|
|
15
17
|
var _dbInitialized = false;
|
|
@@ -344,4 +346,4 @@ export {
|
|
|
344
346
|
searchSessions,
|
|
345
347
|
searchMemory
|
|
346
348
|
};
|
|
347
|
-
//# sourceMappingURL=chunk-
|
|
349
|
+
//# sourceMappingURL=chunk-UW6E7IC4.js.map
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
blobToVector,
|
|
3
3
|
vectorToBlob
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-F35MWELH.js";
|
|
5
5
|
import {
|
|
6
6
|
EmbeddingService,
|
|
7
7
|
cosineSimilarity,
|
|
8
8
|
fallbackEmbedding
|
|
9
9
|
} from "./chunk-JAWZ7ANC.js";
|
|
10
10
|
import {
|
|
11
|
-
DatabaseManager,
|
|
12
11
|
initVectorsSchema
|
|
13
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-YJRXLRTE.js";
|
|
13
|
+
import {
|
|
14
|
+
DatabaseManager
|
|
15
|
+
} from "./chunk-UQLPHNGH.js";
|
|
14
16
|
|
|
15
17
|
// ../chitragupta/packages/smriti/src/consolidation-indexer.ts
|
|
16
18
|
var _embeddingService = null;
|
|
@@ -184,7 +186,7 @@ async function backfillConsolidationIndices() {
|
|
|
184
186
|
db.prepare("SELECT id FROM embeddings WHERE source_type IN ('daily_summary', 'monthly_summary', 'yearly_summary')").all().map((r) => r.id)
|
|
185
187
|
);
|
|
186
188
|
try {
|
|
187
|
-
const { listDayFiles, readDayFile } = await import("./day-consolidation-
|
|
189
|
+
const { listDayFiles, readDayFile } = await import("./day-consolidation-GQ2FDCR2.js");
|
|
188
190
|
const dayFiles = listDayFiles();
|
|
189
191
|
for (const date of dayFiles) {
|
|
190
192
|
const id = buildEmbeddingId("daily", date);
|
|
@@ -198,8 +200,8 @@ async function backfillConsolidationIndices() {
|
|
|
198
200
|
} catch {
|
|
199
201
|
}
|
|
200
202
|
try {
|
|
201
|
-
const { PeriodicConsolidation } = await import("./periodic-consolidation-
|
|
202
|
-
const { listSessionProjects } = await import("./session-store-
|
|
203
|
+
const { PeriodicConsolidation } = await import("./periodic-consolidation-N5MR77ZN.js");
|
|
204
|
+
const { listSessionProjects } = await import("./session-store-GRKGTMHI.js");
|
|
203
205
|
const projectEntries = listSessionProjects();
|
|
204
206
|
for (const entry of projectEntries) {
|
|
205
207
|
const project = entry.project;
|
|
@@ -235,4 +237,4 @@ export {
|
|
|
235
237
|
searchConsolidationSummaries,
|
|
236
238
|
backfillConsolidationIndices
|
|
237
239
|
};
|
|
238
|
-
//# sourceMappingURL=chunk-
|
|
240
|
+
//# sourceMappingURL=chunk-XRHUKKBC.js.map
|
|
@@ -1,124 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getChitraguptaHome
|
|
3
|
-
} from "./chunk-KC6NRZ7U.js";
|
|
4
|
-
|
|
5
|
-
// ../chitragupta/packages/smriti/src/db/database.ts
|
|
6
|
-
import Database from "better-sqlite3";
|
|
7
|
-
import fs from "fs";
|
|
8
|
-
import path from "path";
|
|
9
|
-
var DEFAULT_PRAGMAS = {
|
|
10
|
-
journal_mode: "WAL",
|
|
11
|
-
synchronous: "NORMAL",
|
|
12
|
-
// Safe with WAL — fsync on checkpoint only
|
|
13
|
-
cache_size: -64e3,
|
|
14
|
-
// 64MB cache (negative = KB)
|
|
15
|
-
foreign_keys: 1,
|
|
16
|
-
busy_timeout: 5e3,
|
|
17
|
-
// 5s wait on lock contention
|
|
18
|
-
temp_store: "MEMORY",
|
|
19
|
-
mmap_size: 268435456
|
|
20
|
-
// 256MB mmap for read performance
|
|
21
|
-
};
|
|
22
|
-
var DatabaseManager = class _DatabaseManager {
|
|
23
|
-
static _instance = null;
|
|
24
|
-
_databases = /* @__PURE__ */ new Map();
|
|
25
|
-
_dbDir;
|
|
26
|
-
_closed = false;
|
|
27
|
-
constructor(dbDir) {
|
|
28
|
-
this._dbDir = dbDir ?? getChitraguptaHome();
|
|
29
|
-
fs.mkdirSync(this._dbDir, { recursive: true });
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Get or create the singleton instance.
|
|
33
|
-
* @param dbDir - Override the database directory (useful for testing).
|
|
34
|
-
*/
|
|
35
|
-
static instance(dbDir) {
|
|
36
|
-
if (!_DatabaseManager._instance || _DatabaseManager._instance._closed) {
|
|
37
|
-
_DatabaseManager._instance = new _DatabaseManager(dbDir);
|
|
38
|
-
}
|
|
39
|
-
return _DatabaseManager._instance;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Reset the singleton (for testing). Closes all open databases.
|
|
43
|
-
*/
|
|
44
|
-
static reset() {
|
|
45
|
-
if (_DatabaseManager._instance) {
|
|
46
|
-
_DatabaseManager._instance.closeAll();
|
|
47
|
-
_DatabaseManager._instance = null;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Get a database connection by name. Opens it on first access.
|
|
52
|
-
*/
|
|
53
|
-
get(name) {
|
|
54
|
-
if (this._closed) {
|
|
55
|
-
throw new Error("DatabaseManager has been closed");
|
|
56
|
-
}
|
|
57
|
-
let db = this._databases.get(name);
|
|
58
|
-
if (!db) {
|
|
59
|
-
db = this._open(name);
|
|
60
|
-
this._databases.set(name, db);
|
|
61
|
-
}
|
|
62
|
-
return db;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Get the file path for a database.
|
|
66
|
-
*/
|
|
67
|
-
getPath(name) {
|
|
68
|
-
return path.join(this._dbDir, `${name}.db`);
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Close all open database connections.
|
|
72
|
-
*/
|
|
73
|
-
closeAll() {
|
|
74
|
-
for (const [name, db] of this._databases) {
|
|
75
|
-
try {
|
|
76
|
-
db.close();
|
|
77
|
-
} catch {
|
|
78
|
-
}
|
|
79
|
-
this._databases.delete(name);
|
|
80
|
-
}
|
|
81
|
-
this._closed = true;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Close a specific database connection.
|
|
85
|
-
*/
|
|
86
|
-
close(name) {
|
|
87
|
-
const db = this._databases.get(name);
|
|
88
|
-
if (db) {
|
|
89
|
-
db.close();
|
|
90
|
-
this._databases.delete(name);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Run VACUUM on a database to reclaim space.
|
|
95
|
-
* Should be called during deep sleep / yearly archival.
|
|
96
|
-
*/
|
|
97
|
-
vacuum(name) {
|
|
98
|
-
this.get(name).exec("VACUUM");
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Check database integrity.
|
|
102
|
-
*/
|
|
103
|
-
integrityCheck(name) {
|
|
104
|
-
const result = this.get(name).pragma("integrity_check");
|
|
105
|
-
return result[0]?.integrity_check ?? "unknown";
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Open a database file and apply pragmas.
|
|
109
|
-
*/
|
|
110
|
-
_open(name) {
|
|
111
|
-
const dbPath = this.getPath(name);
|
|
112
|
-
const db = new Database(dbPath);
|
|
113
|
-
for (const [key, value] of Object.entries(DEFAULT_PRAGMAS)) {
|
|
114
|
-
db.pragma(`${key} = ${value}`);
|
|
115
|
-
}
|
|
116
|
-
return db;
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
|
|
120
1
|
// ../chitragupta/packages/smriti/src/db/schema.ts
|
|
121
|
-
var AGENT_SCHEMA_VERSION =
|
|
2
|
+
var AGENT_SCHEMA_VERSION = 4;
|
|
122
3
|
var GRAPH_SCHEMA_VERSION = 1;
|
|
123
4
|
var VECTORS_SCHEMA_VERSION = 1;
|
|
124
5
|
function initAllSchemas(dbm) {
|
|
@@ -338,6 +219,25 @@ function initAgentSchema(dbm) {
|
|
|
338
219
|
ALTER TABLE sessions ADD COLUMN metadata TEXT;
|
|
339
220
|
`);
|
|
340
221
|
}
|
|
222
|
+
if (currentVersion < 4) {
|
|
223
|
+
db.exec(`
|
|
224
|
+
CREATE TABLE IF NOT EXISTS rta_audit (
|
|
225
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
226
|
+
timestamp INTEGER NOT NULL,
|
|
227
|
+
rule_id TEXT NOT NULL,
|
|
228
|
+
allowed INTEGER NOT NULL, -- 0 = denied, 1 = allowed
|
|
229
|
+
tool_name TEXT NOT NULL,
|
|
230
|
+
reason TEXT,
|
|
231
|
+
session_id TEXT,
|
|
232
|
+
project TEXT,
|
|
233
|
+
created_at INTEGER NOT NULL DEFAULT (unixepoch() * 1000)
|
|
234
|
+
);
|
|
235
|
+
|
|
236
|
+
CREATE INDEX IF NOT EXISTS idx_rta_audit_timestamp ON rta_audit(timestamp DESC);
|
|
237
|
+
CREATE INDEX IF NOT EXISTS idx_rta_audit_rule_id ON rta_audit(rule_id);
|
|
238
|
+
CREATE INDEX IF NOT EXISTS idx_rta_audit_denied ON rta_audit(allowed) WHERE allowed = 0;
|
|
239
|
+
`);
|
|
240
|
+
}
|
|
341
241
|
setSchemaVersion(db, "agent", AGENT_SCHEMA_VERSION);
|
|
342
242
|
}
|
|
343
243
|
function initGraphSchema(dbm) {
|
|
@@ -429,10 +329,9 @@ function setSchemaVersion(db, name, version) {
|
|
|
429
329
|
}
|
|
430
330
|
|
|
431
331
|
export {
|
|
432
|
-
DatabaseManager,
|
|
433
332
|
initAllSchemas,
|
|
434
333
|
initAgentSchema,
|
|
435
334
|
initGraphSchema,
|
|
436
335
|
initVectorsSchema
|
|
437
336
|
};
|
|
438
|
-
//# sourceMappingURL=chunk-
|
|
337
|
+
//# sourceMappingURL=chunk-YJRXLRTE.js.map
|
|
@@ -4,11 +4,12 @@ import {
|
|
|
4
4
|
extractSummaryText,
|
|
5
5
|
indexConsolidationSummary,
|
|
6
6
|
searchConsolidationSummaries
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-XRHUKKBC.js";
|
|
8
|
+
import "./chunk-F35MWELH.js";
|
|
9
9
|
import "./chunk-JAWZ7ANC.js";
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-2ARPXEDC.js";
|
|
11
|
+
import "./chunk-YJRXLRTE.js";
|
|
12
|
+
import "./chunk-UQLPHNGH.js";
|
|
12
13
|
import "./chunk-KC6NRZ7U.js";
|
|
13
14
|
import "./chunk-IGKYKEKT.js";
|
|
14
15
|
export {
|
|
@@ -18,4 +19,4 @@ export {
|
|
|
18
19
|
indexConsolidationSummary,
|
|
19
20
|
searchConsolidationSummaries
|
|
20
21
|
};
|
|
21
|
-
//# sourceMappingURL=consolidation-indexer-
|
|
22
|
+
//# sourceMappingURL=consolidation-indexer-A46RJU4R.js.map
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
listDayFiles,
|
|
8
8
|
readDayFile,
|
|
9
9
|
searchDayFiles
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-FPNQLJLD.js";
|
|
11
11
|
import "./chunk-JAWZ7ANC.js";
|
|
12
12
|
import "./chunk-KC6NRZ7U.js";
|
|
13
13
|
import "./chunk-IGKYKEKT.js";
|
|
@@ -21,4 +21,4 @@ export {
|
|
|
21
21
|
readDayFile,
|
|
22
22
|
searchDayFiles
|
|
23
23
|
};
|
|
24
|
-
//# sourceMappingURL=day-consolidation-
|
|
24
|
+
//# sourceMappingURL=day-consolidation-GQ2FDCR2.js.map
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
GraphRAGEngine,
|
|
3
3
|
migrateGraphJson
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-SLA2OIMG.js";
|
|
5
5
|
import "./chunk-JAWZ7ANC.js";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-YJRXLRTE.js";
|
|
7
|
+
import "./chunk-UQLPHNGH.js";
|
|
7
8
|
import "./chunk-KC6NRZ7U.js";
|
|
8
9
|
import "./chunk-IGKYKEKT.js";
|
|
9
10
|
export {
|
|
10
11
|
GraphRAGEngine,
|
|
11
12
|
migrateGraphJson
|
|
12
13
|
};
|
|
13
|
-
//# sourceMappingURL=graphrag-
|
|
14
|
+
//# sourceMappingURL=graphrag-6YZ5YPLK.js.map
|
package/chunks/{hierarchical-temporal-search-ZD46UMKR.js → hierarchical-temporal-search-VA4D3SON.js}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
hierarchicalTemporalSearch
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-OWBBY5XP.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-VA4D3SON.js.map
|
|
@@ -3,11 +3,12 @@ import {
|
|
|
3
3
|
HybridWeightLearner,
|
|
4
4
|
PRAMANA_RELIABILITY,
|
|
5
5
|
shouldRetrieve
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-NBXCXQ3H.js";
|
|
7
|
+
import "./chunk-UW6E7IC4.js";
|
|
8
8
|
import "./chunk-E5A3SCDJ.js";
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-2ARPXEDC.js";
|
|
10
|
+
import "./chunk-YJRXLRTE.js";
|
|
11
|
+
import "./chunk-UQLPHNGH.js";
|
|
11
12
|
import "./chunk-KC6NRZ7U.js";
|
|
12
13
|
import "./chunk-IGKYKEKT.js";
|
|
13
14
|
export {
|
|
@@ -16,4 +17,4 @@ export {
|
|
|
16
17
|
PRAMANA_RELIABILITY,
|
|
17
18
|
shouldRetrieve
|
|
18
19
|
};
|
|
19
|
-
//# sourceMappingURL=hybrid-search-
|
|
20
|
+
//# sourceMappingURL=hybrid-search-6XMUT66S.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
PeriodicConsolidation
|
|
3
|
+
} from "./chunk-DQMAQ2VL.js";
|
|
4
|
+
import "./chunk-YJRXLRTE.js";
|
|
5
|
+
import "./chunk-UQLPHNGH.js";
|
|
6
|
+
import "./chunk-KC6NRZ7U.js";
|
|
7
|
+
import "./chunk-IGKYKEKT.js";
|
|
8
|
+
export {
|
|
9
|
+
PeriodicConsolidation
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=periodic-consolidation-N5MR77ZN.js.map
|
|
@@ -4,10 +4,11 @@ import {
|
|
|
4
4
|
blobToVector,
|
|
5
5
|
migrateEmbeddingsJson,
|
|
6
6
|
vectorToBlob
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-F35MWELH.js";
|
|
8
8
|
import "./chunk-JAWZ7ANC.js";
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-2ARPXEDC.js";
|
|
10
|
+
import "./chunk-YJRXLRTE.js";
|
|
11
|
+
import "./chunk-UQLPHNGH.js";
|
|
11
12
|
import "./chunk-KC6NRZ7U.js";
|
|
12
13
|
import "./chunk-IGKYKEKT.js";
|
|
13
14
|
export {
|
|
@@ -17,4 +18,4 @@ export {
|
|
|
17
18
|
migrateEmbeddingsJson,
|
|
18
19
|
vectorToBlob
|
|
19
20
|
};
|
|
20
|
-
//# sourceMappingURL=recall-
|
|
21
|
+
//# sourceMappingURL=recall-THTI6ZO2.js.map
|