@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
|
@@ -450,6 +450,10 @@ var createSessionStore = (pool) => {
|
|
|
450
450
|
event.createdAt
|
|
451
451
|
]
|
|
452
452
|
);
|
|
453
|
+
await pool.query(
|
|
454
|
+
"UPDATE sessions SET updated_at = $1 WHERE id = $2",
|
|
455
|
+
[event.createdAt ?? (/* @__PURE__ */ new Date()).toISOString(), event.sessionId]
|
|
456
|
+
);
|
|
453
457
|
},
|
|
454
458
|
async listSessionEvents(sessionId, options) {
|
|
455
459
|
const limit = options?.limit ?? 50;
|
|
@@ -503,10 +507,14 @@ var createSessionPrefsStore = (pool) => {
|
|
|
503
507
|
async setSessionPrefs(sessionId, prefs) {
|
|
504
508
|
const existing = await this.getSessionPrefs(sessionId);
|
|
505
509
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
506
|
-
const
|
|
507
|
-
const
|
|
508
|
-
const
|
|
509
|
-
const
|
|
510
|
+
const hasProviderId = Object.prototype.hasOwnProperty.call(prefs, "providerId");
|
|
511
|
+
const providerId = hasProviderId ? prefs.providerId ?? null : existing?.providerId ?? null;
|
|
512
|
+
const hasModel = Object.prototype.hasOwnProperty.call(prefs, "model");
|
|
513
|
+
const model = hasModel ? prefs.model ?? null : existing?.model ?? null;
|
|
514
|
+
const hasSystem = Object.prototype.hasOwnProperty.call(prefs, "system");
|
|
515
|
+
const system = hasSystem ? prefs.system ?? null : existing?.system ?? null;
|
|
516
|
+
const hasAutoRouting = Object.prototype.hasOwnProperty.call(prefs, "autoRouting");
|
|
517
|
+
const autoRouting = hasAutoRouting ? prefs.autoRouting ?? null : existing?.autoRouting ?? null;
|
|
510
518
|
const hasLanguage = Object.prototype.hasOwnProperty.call(prefs, "language");
|
|
511
519
|
const language = hasLanguage ? prefs.language ?? null : existing?.language ?? null;
|
|
512
520
|
const hasLanguageUpdatedAt = Object.prototype.hasOwnProperty.call(prefs, "languageUpdatedAt");
|
|
@@ -1500,4 +1508,4 @@ var PostgresStorage = class _PostgresStorage {
|
|
|
1500
1508
|
export {
|
|
1501
1509
|
PostgresStorage
|
|
1502
1510
|
};
|
|
1503
|
-
//# sourceMappingURL=chunk-
|
|
1511
|
+
//# sourceMappingURL=chunk-QFGAB4XD.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
searchSessions
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-3AYSJ7WB.js";
|
|
4
4
|
|
|
5
|
-
// ../chitragupta/packages/smriti/
|
|
5
|
+
// ../chitragupta/packages/smriti/dist/hybrid-search-learner.js
|
|
6
6
|
function gaussianRandom() {
|
|
7
7
|
const u1 = Math.random();
|
|
8
8
|
const u2 = Math.random();
|
|
@@ -25,14 +25,17 @@ function sampleGamma(shape) {
|
|
|
25
25
|
v = v * v * v;
|
|
26
26
|
const u = Math.random();
|
|
27
27
|
const zSq = z * z;
|
|
28
|
-
if (u < 1 - 0.0331 * (zSq * zSq))
|
|
29
|
-
|
|
28
|
+
if (u < 1 - 0.0331 * (zSq * zSq))
|
|
29
|
+
return d * v;
|
|
30
|
+
if (Math.log(u) < 0.5 * zSq + d * (1 - v + Math.log(v)))
|
|
31
|
+
return d * v;
|
|
30
32
|
}
|
|
31
33
|
}
|
|
32
34
|
function sampleBeta(alpha, beta) {
|
|
33
35
|
const x = sampleGamma(alpha);
|
|
34
36
|
const y = sampleGamma(beta);
|
|
35
|
-
if (x + y === 0)
|
|
37
|
+
if (x + y === 0)
|
|
38
|
+
return 0.5;
|
|
36
39
|
return x / (x + y);
|
|
37
40
|
}
|
|
38
41
|
var SIGNAL_INDEX = {
|
|
@@ -150,7 +153,7 @@ var HybridWeightLearner = class {
|
|
|
150
153
|
}
|
|
151
154
|
};
|
|
152
155
|
|
|
153
|
-
// ../chitragupta/packages/smriti/
|
|
156
|
+
// ../chitragupta/packages/smriti/dist/hybrid-search.js
|
|
154
157
|
var PRAMANA_RELIABILITY = {
|
|
155
158
|
pratyaksha: 1,
|
|
156
159
|
anumana: 0.85,
|
|
@@ -194,11 +197,15 @@ function shouldRetrieve(query) {
|
|
|
194
197
|
/\bshow me\b.*\bfrom\b/
|
|
195
198
|
];
|
|
196
199
|
for (const pattern of gapPatterns) {
|
|
197
|
-
if (pattern.test(lower))
|
|
200
|
+
if (pattern.test(lower))
|
|
201
|
+
return true;
|
|
198
202
|
}
|
|
199
|
-
if (lower.endsWith("?") && lower.length > 20)
|
|
200
|
-
|
|
201
|
-
if (
|
|
203
|
+
if (lower.endsWith("?") && lower.length > 20)
|
|
204
|
+
return true;
|
|
205
|
+
if (/session[:\s]/i.test(lower))
|
|
206
|
+
return true;
|
|
207
|
+
if (/\bproject\b.*\b(memory|context|knowledge)\b/i.test(lower))
|
|
208
|
+
return true;
|
|
202
209
|
return false;
|
|
203
210
|
}
|
|
204
211
|
var HybridSearchEngine = class {
|
|
@@ -244,7 +251,8 @@ var HybridSearchEngine = class {
|
|
|
244
251
|
* for each contributing signal (and pramana if present).
|
|
245
252
|
*/
|
|
246
253
|
recordFeedback(result, success) {
|
|
247
|
-
if (!this.weightLearner)
|
|
254
|
+
if (!this.weightLearner)
|
|
255
|
+
return;
|
|
248
256
|
for (const source of result.sources) {
|
|
249
257
|
this.weightLearner.update(source, success);
|
|
250
258
|
}
|
|
@@ -262,64 +270,60 @@ var HybridSearchEngine = class {
|
|
|
262
270
|
const rankings = [];
|
|
263
271
|
const tasks = [];
|
|
264
272
|
if (cfg.enableBM25) {
|
|
265
|
-
tasks.push(
|
|
266
|
-
(
|
|
267
|
-
|
|
273
|
+
tasks.push((async () => {
|
|
274
|
+
const bm25Results = searchSessions(query, cfg.project);
|
|
275
|
+
rankings.push({
|
|
276
|
+
source: "bm25",
|
|
277
|
+
weight: weights.bm25,
|
|
278
|
+
results: bm25Results.map((meta) => ({
|
|
279
|
+
id: meta.id,
|
|
280
|
+
title: meta.title,
|
|
281
|
+
content: `${meta.title} [${meta.tags.join(", ")}] agent:${meta.agent}`,
|
|
282
|
+
timestamp: meta.created ? Date.parse(meta.created) : void 0
|
|
283
|
+
}))
|
|
284
|
+
});
|
|
285
|
+
})());
|
|
286
|
+
}
|
|
287
|
+
if (cfg.enableVector && this.recallEngine) {
|
|
288
|
+
tasks.push((async () => {
|
|
289
|
+
try {
|
|
290
|
+
const vectorResults = await this.recallEngine.recall(query, {
|
|
291
|
+
topK: cfg.topK * 2
|
|
292
|
+
// Over-fetch for fusion
|
|
293
|
+
});
|
|
268
294
|
rankings.push({
|
|
269
|
-
source: "
|
|
270
|
-
weight: weights.
|
|
271
|
-
results:
|
|
272
|
-
id:
|
|
273
|
-
title:
|
|
274
|
-
content:
|
|
295
|
+
source: "vector",
|
|
296
|
+
weight: weights.vector,
|
|
297
|
+
results: vectorResults.map((r) => ({
|
|
298
|
+
id: r.sessionId,
|
|
299
|
+
title: r.title,
|
|
300
|
+
content: r.matchedContent || r.summary
|
|
275
301
|
}))
|
|
276
302
|
});
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
if (cfg.enableVector && this.recallEngine) {
|
|
281
|
-
tasks.push(
|
|
282
|
-
(async () => {
|
|
283
|
-
try {
|
|
284
|
-
const vectorResults = await this.recallEngine.recall(query, {
|
|
285
|
-
topK: cfg.topK * 2
|
|
286
|
-
// Over-fetch for fusion
|
|
287
|
-
});
|
|
288
|
-
rankings.push({
|
|
289
|
-
source: "vector",
|
|
290
|
-
weight: weights.vector,
|
|
291
|
-
results: vectorResults.map((r) => ({
|
|
292
|
-
id: r.sessionId,
|
|
293
|
-
title: r.title,
|
|
294
|
-
content: r.matchedContent || r.summary
|
|
295
|
-
}))
|
|
296
|
-
});
|
|
297
|
-
} catch {
|
|
298
|
-
}
|
|
299
|
-
})()
|
|
300
|
-
);
|
|
303
|
+
} catch {
|
|
304
|
+
}
|
|
305
|
+
})());
|
|
301
306
|
}
|
|
302
307
|
if (cfg.enableGraphRAG && this.graphEngine) {
|
|
303
|
-
tasks.push(
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
})()
|
|
319
|
-
);
|
|
308
|
+
tasks.push((async () => {
|
|
309
|
+
try {
|
|
310
|
+
const graphResults = await this.graphEngine.search(query, void 0, cfg.topK * 2);
|
|
311
|
+
rankings.push({
|
|
312
|
+
source: "graphrag",
|
|
313
|
+
weight: weights.graphrag,
|
|
314
|
+
results: graphResults.map((node) => ({
|
|
315
|
+
id: node.id,
|
|
316
|
+
title: node.label,
|
|
317
|
+
content: node.content
|
|
318
|
+
}))
|
|
319
|
+
});
|
|
320
|
+
} catch {
|
|
321
|
+
}
|
|
322
|
+
})());
|
|
320
323
|
}
|
|
321
324
|
await Promise.all(tasks);
|
|
322
|
-
if (rankings.length === 0)
|
|
325
|
+
if (rankings.length === 0)
|
|
326
|
+
return [];
|
|
323
327
|
const fusedScores = /* @__PURE__ */ new Map();
|
|
324
328
|
for (const ranking of rankings) {
|
|
325
329
|
for (let rank = 0; rank < ranking.results.length; rank++) {
|
|
@@ -333,6 +337,9 @@ var HybridSearchEngine = class {
|
|
|
333
337
|
if (doc.content.length > existing.content.length) {
|
|
334
338
|
existing.content = doc.content;
|
|
335
339
|
}
|
|
340
|
+
if (existing.timestamp === void 0 && doc.timestamp !== void 0) {
|
|
341
|
+
existing.timestamp = doc.timestamp;
|
|
342
|
+
}
|
|
336
343
|
} else {
|
|
337
344
|
const sources = /* @__PURE__ */ new Set();
|
|
338
345
|
sources.add(ranking.source);
|
|
@@ -342,7 +349,8 @@ var HybridSearchEngine = class {
|
|
|
342
349
|
content: doc.content,
|
|
343
350
|
score: rrfContribution,
|
|
344
351
|
sources,
|
|
345
|
-
ranks: { [ranking.source]: rank + 1 }
|
|
352
|
+
ranks: { [ranking.source]: rank + 1 },
|
|
353
|
+
timestamp: doc.timestamp
|
|
346
354
|
});
|
|
347
355
|
}
|
|
348
356
|
}
|
|
@@ -393,7 +401,8 @@ var HybridSearchEngine = class {
|
|
|
393
401
|
}
|
|
394
402
|
/** Self-RAG gated search -- only retrieves if the query signals a knowledge gap. */
|
|
395
403
|
async gatedSearch(query, configOverride) {
|
|
396
|
-
if (!shouldRetrieve(query))
|
|
404
|
+
if (!shouldRetrieve(query))
|
|
405
|
+
return [];
|
|
397
406
|
return this.search(query, configOverride);
|
|
398
407
|
}
|
|
399
408
|
};
|
|
@@ -404,4 +413,4 @@ export {
|
|
|
404
413
|
shouldRetrieve,
|
|
405
414
|
HybridSearchEngine
|
|
406
415
|
};
|
|
407
|
-
//# sourceMappingURL=chunk-
|
|
416
|
+
//# sourceMappingURL=chunk-QV4GPIPT.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// ../chitragupta/packages/smriti/
|
|
1
|
+
// ../chitragupta/packages/smriti/dist/db/schema.js
|
|
2
2
|
var AGENT_SCHEMA_VERSION = 4;
|
|
3
3
|
var GRAPH_SCHEMA_VERSION = 1;
|
|
4
4
|
var VECTORS_SCHEMA_VERSION = 1;
|
|
@@ -10,7 +10,8 @@ function initAllSchemas(dbm) {
|
|
|
10
10
|
function initAgentSchema(dbm) {
|
|
11
11
|
const db = dbm.get("agent");
|
|
12
12
|
const currentVersion = getSchemaVersion(db, "agent");
|
|
13
|
-
if (currentVersion >= AGENT_SCHEMA_VERSION)
|
|
13
|
+
if (currentVersion >= AGENT_SCHEMA_VERSION)
|
|
14
|
+
return;
|
|
14
15
|
db.exec(`
|
|
15
16
|
-- \u2500\u2500\u2500 Sessions \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
16
17
|
CREATE TABLE IF NOT EXISTS sessions (
|
|
@@ -243,7 +244,8 @@ function initAgentSchema(dbm) {
|
|
|
243
244
|
function initGraphSchema(dbm) {
|
|
244
245
|
const db = dbm.get("graph");
|
|
245
246
|
const currentVersion = getSchemaVersion(db, "graph");
|
|
246
|
-
if (currentVersion >= GRAPH_SCHEMA_VERSION)
|
|
247
|
+
if (currentVersion >= GRAPH_SCHEMA_VERSION)
|
|
248
|
+
return;
|
|
247
249
|
db.exec(`
|
|
248
250
|
-- \u2500\u2500\u2500 Nodes \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
249
251
|
CREATE TABLE IF NOT EXISTS nodes (
|
|
@@ -290,7 +292,8 @@ function initGraphSchema(dbm) {
|
|
|
290
292
|
function initVectorsSchema(dbm) {
|
|
291
293
|
const db = dbm.get("vectors");
|
|
292
294
|
const currentVersion = getSchemaVersion(db, "vectors");
|
|
293
|
-
if (currentVersion >= VECTORS_SCHEMA_VERSION)
|
|
295
|
+
if (currentVersion >= VECTORS_SCHEMA_VERSION)
|
|
296
|
+
return;
|
|
294
297
|
db.exec(`
|
|
295
298
|
-- \u2500\u2500\u2500 Embeddings \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
296
299
|
CREATE TABLE IF NOT EXISTS embeddings (
|
|
@@ -323,9 +326,7 @@ function getSchemaVersion(db, name) {
|
|
|
323
326
|
}
|
|
324
327
|
function setSchemaVersion(db, name, version) {
|
|
325
328
|
ensureVersionTable(db);
|
|
326
|
-
db.prepare(
|
|
327
|
-
"INSERT OR REPLACE INTO _schema_versions (name, version) VALUES (?, ?)"
|
|
328
|
-
).run(name, version);
|
|
329
|
+
db.prepare("INSERT OR REPLACE INTO _schema_versions (name, version) VALUES (?, ?)").run(name, version);
|
|
329
330
|
}
|
|
330
331
|
|
|
331
332
|
export {
|
|
@@ -334,4 +335,4 @@ export {
|
|
|
334
335
|
initGraphSchema,
|
|
335
336
|
initVectorsSchema
|
|
336
337
|
};
|
|
337
|
-
//# sourceMappingURL=chunk-
|
|
338
|
+
//# sourceMappingURL=chunk-V2ZIKDN4.js.map
|