@yugenlab/vaayu 0.1.2 → 0.1.4

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.
Files changed (33) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +1 -1
  3. package/chunks/agentic-tool-loop-2FZK72JO.js +147 -0
  4. package/chunks/{chunk-E5A3SCDJ.js → chunk-6556EKOB.js} +2 -2
  5. package/chunks/{chunk-FPNQLJLD.js → chunk-7UOXFHEB.js} +6 -6
  6. package/chunks/{chunk-NBXCXQ3H.js → chunk-D3RVJGO7.js} +2 -2
  7. package/chunks/{chunk-XRHUKKBC.js → chunk-DOQMEQ5S.js} +6 -6
  8. package/chunks/{chunk-OWBBY5XP.js → chunk-IGBRBFXX.js} +2 -2
  9. package/chunks/{chunk-F35MWELH.js → chunk-LVE2EOOH.js} +7 -7
  10. package/chunks/{chunk-2ARPXEDC.js → chunk-NHRBVSN3.js} +3 -3
  11. package/chunks/{chunk-F4T7POKM.js → chunk-OBYBBGHA.js} +2 -2
  12. package/chunks/{chunk-UW6E7IC4.js → chunk-PJEYJQ2C.js} +4 -4
  13. package/chunks/{chunk-SLA2OIMG.js → chunk-S2HDNNC7.js} +3 -3
  14. package/chunks/{chunk-DQMAQ2VL.js → chunk-TEQKXGIK.js} +5 -5
  15. package/chunks/{chunk-UQLPHNGH.js → chunk-U62ABYKD.js} +2 -2
  16. package/chunks/{chunk-KC6NRZ7U.js → chunk-UZ6OIVEC.js} +1 -1
  17. package/chunks/{chunk-5Z2BKSFF.js → chunk-YSC77CKZ.js} +427 -85
  18. package/chunks/{consolidation-indexer-A46RJU4R.js → consolidation-indexer-CD6DS2HO.js} +6 -6
  19. package/chunks/{day-consolidation-GQ2FDCR2.js → day-consolidation-U3X6P4ZG.js} +3 -3
  20. package/chunks/{graphrag-6YZ5YPLK.js → graphrag-LAZSXLLI.js} +4 -4
  21. package/chunks/{hierarchical-temporal-search-VA4D3SON.js → hierarchical-temporal-search-ETXYYJZK.js} +2 -2
  22. package/chunks/{hybrid-search-6XMUT66S.js → hybrid-search-TX6T3KYH.js} +7 -7
  23. package/chunks/{memory-store-KNJPMBLQ.js → memory-store-A6WOWLWC.js} +3 -3
  24. package/chunks/periodic-consolidation-4MACZE6S.js +11 -0
  25. package/chunks/{recall-THTI6ZO2.js → recall-IUPQCBYP.js} +5 -5
  26. package/chunks/{search-V7DJ3VNL.js → search-HHSVHBXC.js} +6 -6
  27. package/chunks/{session-store-GRKGTMHI.js → session-store-NDUDYAC7.js} +4 -4
  28. package/chunks/{src-54LTTDTH.js → src-ZAKUL232.js} +51 -41
  29. package/chunks/vasana-engine-G6BPOFX7.js +10 -0
  30. package/gateway.js +581 -102
  31. package/package.json +1 -1
  32. package/chunks/periodic-consolidation-N5MR77ZN.js +0 -11
  33. package/chunks/vasana-engine-Z4RXW2SB.js +0 -10
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 Sriinnu
3
+ Copyright (c) 2025-2026 Srinivas Pendela
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -358,7 +358,7 @@ Contributions welcome. Please read [CONTRIBUTING.md](CONTRIBUTING.md) before sub
358
358
 
359
359
  ## License
360
360
 
361
- MIT
361
+ MIT © 2025-2026 Srinivas Pendela
362
362
 
363
363
  ---
364
364
 
@@ -0,0 +1,147 @@
1
+ import "./chunk-IGKYKEKT.js";
2
+
3
+ // apps/gateway/dist/agent/agentic-tool-loop.js
4
+ async function runAgenticToolLoop(params) {
5
+ const { initialContent, initialModel, contextMessages, tools, getToolRegistration, isToolAllowed, reChat, maxIterations, signal, logger, sessionId } = params;
6
+ let currentToolCalls = params.toolCalls;
7
+ let allToolResults = [];
8
+ const accumulatedMessages = [...contextMessages];
9
+ let finalContent = initialContent;
10
+ let finalModel = initialModel;
11
+ let iteration = 0;
12
+ while (currentToolCalls.length > 0 && iteration < maxIterations) {
13
+ iteration++;
14
+ if (signal?.aborted) {
15
+ logger.info("agentic_loop_aborted", { sessionId, iteration });
16
+ break;
17
+ }
18
+ accumulatedMessages.push({
19
+ role: "assistant",
20
+ content: finalContent,
21
+ toolCalls: currentToolCalls
22
+ });
23
+ const iterationResults = [];
24
+ for (const call of currentToolCalls) {
25
+ const callId = call.id ?? `call_${call.name}_${iteration}`;
26
+ if (!isToolAllowed(call.name)) {
27
+ const errorMsg = `Tool "${call.name}" is not allowed by current policy.`;
28
+ logger.warn("agentic_tool_blocked", { sessionId, tool: call.name, iteration });
29
+ iterationResults.push({
30
+ name: call.name,
31
+ input: call.input,
32
+ output: { error: errorMsg },
33
+ ok: false,
34
+ callId
35
+ });
36
+ accumulatedMessages.push({
37
+ role: "tool",
38
+ content: JSON.stringify({ error: errorMsg }),
39
+ name: call.name,
40
+ toolCallId: callId
41
+ });
42
+ continue;
43
+ }
44
+ const registration = getToolRegistration(call.name);
45
+ if (!registration) {
46
+ const errorMsg = `Tool "${call.name}" not found in registry.`;
47
+ logger.warn("agentic_tool_not_found", { sessionId, tool: call.name, iteration });
48
+ iterationResults.push({
49
+ name: call.name,
50
+ input: call.input,
51
+ output: { error: errorMsg },
52
+ ok: false,
53
+ callId
54
+ });
55
+ accumulatedMessages.push({
56
+ role: "tool",
57
+ content: JSON.stringify({ error: errorMsg }),
58
+ name: call.name,
59
+ toolCallId: callId
60
+ });
61
+ continue;
62
+ }
63
+ try {
64
+ const ctx = {
65
+ sessionId,
66
+ signal
67
+ };
68
+ const result = await registration.handler(call.input, ctx);
69
+ const output = result.ok ? result.output : result.error;
70
+ iterationResults.push({
71
+ name: call.name,
72
+ input: call.input,
73
+ output,
74
+ ok: result.ok,
75
+ callId
76
+ });
77
+ accumulatedMessages.push({
78
+ role: "tool",
79
+ content: JSON.stringify(result.ok ? result.output : { error: result.error }),
80
+ name: call.name,
81
+ toolCallId: callId
82
+ });
83
+ logger.info("agentic_tool_executed", {
84
+ sessionId,
85
+ tool: call.name,
86
+ ok: result.ok,
87
+ iteration
88
+ });
89
+ } catch (error) {
90
+ const errorMsg = error instanceof Error ? error.message : String(error);
91
+ logger.warn("agentic_tool_error", {
92
+ sessionId,
93
+ tool: call.name,
94
+ error: errorMsg,
95
+ iteration
96
+ });
97
+ iterationResults.push({
98
+ name: call.name,
99
+ input: call.input,
100
+ output: { error: errorMsg },
101
+ ok: false,
102
+ callId
103
+ });
104
+ accumulatedMessages.push({
105
+ role: "tool",
106
+ content: JSON.stringify({ error: errorMsg }),
107
+ name: call.name,
108
+ toolCallId: callId
109
+ });
110
+ }
111
+ }
112
+ allToolResults = [...allToolResults, ...iterationResults];
113
+ try {
114
+ const response = await reChat(accumulatedMessages, tools);
115
+ finalContent = response.content;
116
+ finalModel = response.model;
117
+ currentToolCalls = response.toolCalls ?? [];
118
+ } catch (error) {
119
+ logger.warn("agentic_rechat_failed", {
120
+ sessionId,
121
+ iteration,
122
+ error: error instanceof Error ? error.message : String(error)
123
+ });
124
+ if (!finalContent && allToolResults.length > 0) {
125
+ finalContent = allToolResults.map((r) => `${r.name}: ${r.ok ? JSON.stringify(r.output) : `Error: ${JSON.stringify(r.output)}`}`).join("\n");
126
+ }
127
+ break;
128
+ }
129
+ }
130
+ if (iteration >= maxIterations && currentToolCalls.length > 0) {
131
+ logger.warn("agentic_loop_max_iterations", {
132
+ sessionId,
133
+ maxIterations,
134
+ remainingToolCalls: currentToolCalls.length
135
+ });
136
+ }
137
+ return {
138
+ finalContent,
139
+ toolResults: allToolResults,
140
+ iterations: iteration,
141
+ finalModel
142
+ };
143
+ }
144
+ export {
145
+ runAgenticToolLoop
146
+ };
147
+ //# sourceMappingURL=agentic-tool-loop-2FZK72JO.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  MemoryError,
3
3
  getChitraguptaHome
4
- } from "./chunk-KC6NRZ7U.js";
4
+ } from "./chunk-UZ6OIVEC.js";
5
5
 
6
6
  // ../chitragupta/packages/smriti/src/memory-store.ts
7
7
  import fs from "fs";
@@ -243,4 +243,4 @@ export {
243
243
  deleteMemory,
244
244
  listMemoryScopes
245
245
  };
246
- //# sourceMappingURL=chunk-E5A3SCDJ.js.map
246
+ //# sourceMappingURL=chunk-6556EKOB.js.map
@@ -6,7 +6,7 @@ import {
6
6
  import {
7
7
  SessionError,
8
8
  getChitraguptaHome
9
- } from "./chunk-KC6NRZ7U.js";
9
+ } from "./chunk-UZ6OIVEC.js";
10
10
 
11
11
  // ../chitragupta/packages/smriti/src/day-consolidation.ts
12
12
  import fs from "fs";
@@ -607,7 +607,7 @@ var FactExtractor = class {
607
607
  async extractAndSave(text, scope, projectScope) {
608
608
  const facts = await this.extract(text);
609
609
  if (facts.length === 0) return [];
610
- const { appendMemory, getMemory } = await import("./memory-store-KNJPMBLQ.js");
610
+ const { appendMemory, getMemory } = await import("./memory-store-A6WOWLWC.js");
611
611
  const globalScope = scope ?? { type: "global" };
612
612
  const existingMemory = getMemory(globalScope).toLowerCase();
613
613
  for (const fact of facts) {
@@ -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-GRKGTMHI.js");
699
+ const { listSessionsByDate, listTurnsWithTimestamps, loadSession } = await import("./session-store-NDUDYAC7.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-A46RJU4R.js");
774
+ const { indexConsolidationSummary } = await import("./consolidation-indexer-CD6DS2HO.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-GRKGTMHI.js");
1002
+ const { listSessionDates } = await import("./session-store-NDUDYAC7.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-FPNQLJLD.js.map
1029
+ //# sourceMappingURL=chunk-7UOXFHEB.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  searchSessions
3
- } from "./chunk-UW6E7IC4.js";
3
+ } from "./chunk-PJEYJQ2C.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-NBXCXQ3H.js.map
433
+ //# sourceMappingURL=chunk-D3RVJGO7.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  blobToVector,
3
3
  vectorToBlob
4
- } from "./chunk-F35MWELH.js";
4
+ } from "./chunk-LVE2EOOH.js";
5
5
  import {
6
6
  EmbeddingService,
7
7
  cosineSimilarity,
@@ -12,7 +12,7 @@ import {
12
12
  } from "./chunk-YJRXLRTE.js";
13
13
  import {
14
14
  DatabaseManager
15
- } from "./chunk-UQLPHNGH.js";
15
+ } from "./chunk-U62ABYKD.js";
16
16
 
17
17
  // ../chitragupta/packages/smriti/src/consolidation-indexer.ts
18
18
  var _embeddingService = null;
@@ -186,7 +186,7 @@ async function backfillConsolidationIndices() {
186
186
  db.prepare("SELECT id FROM embeddings WHERE source_type IN ('daily_summary', 'monthly_summary', 'yearly_summary')").all().map((r) => r.id)
187
187
  );
188
188
  try {
189
- const { listDayFiles, readDayFile } = await import("./day-consolidation-GQ2FDCR2.js");
189
+ const { listDayFiles, readDayFile } = await import("./day-consolidation-U3X6P4ZG.js");
190
190
  const dayFiles = listDayFiles();
191
191
  for (const date of dayFiles) {
192
192
  const id = buildEmbeddingId("daily", date);
@@ -200,8 +200,8 @@ async function backfillConsolidationIndices() {
200
200
  } catch {
201
201
  }
202
202
  try {
203
- const { PeriodicConsolidation } = await import("./periodic-consolidation-N5MR77ZN.js");
204
- const { listSessionProjects } = await import("./session-store-GRKGTMHI.js");
203
+ const { PeriodicConsolidation } = await import("./periodic-consolidation-4MACZE6S.js");
204
+ const { listSessionProjects } = await import("./session-store-NDUDYAC7.js");
205
205
  const projectEntries = listSessionProjects();
206
206
  for (const entry of projectEntries) {
207
207
  const project = entry.project;
@@ -237,4 +237,4 @@ export {
237
237
  searchConsolidationSummaries,
238
238
  backfillConsolidationIndices
239
239
  };
240
- //# sourceMappingURL=chunk-XRHUKKBC.js.map
240
+ //# sourceMappingURL=chunk-DOQMEQ5S.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-A46RJU4R.js");
10
+ const { searchConsolidationSummaries } = await import("./consolidation-indexer-CD6DS2HO.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-OWBBY5XP.js.map
123
+ //# sourceMappingURL=chunk-IGBRBFXX.js.map
@@ -1,21 +1,21 @@
1
+ import {
2
+ listSessions,
3
+ loadSession
4
+ } from "./chunk-NHRBVSN3.js";
1
5
  import {
2
6
  EmbeddingService,
3
7
  cosineSimilarity,
4
8
  estimateTokens
5
9
  } from "./chunk-JAWZ7ANC.js";
6
- import {
7
- listSessions,
8
- loadSession
9
- } from "./chunk-2ARPXEDC.js";
10
10
  import {
11
11
  initVectorsSchema
12
12
  } from "./chunk-YJRXLRTE.js";
13
13
  import {
14
14
  DatabaseManager
15
- } from "./chunk-UQLPHNGH.js";
15
+ } from "./chunk-U62ABYKD.js";
16
16
  import {
17
17
  getChitraguptaHome
18
- } from "./chunk-KC6NRZ7U.js";
18
+ } from "./chunk-UZ6OIVEC.js";
19
19
 
20
20
  // ../chitragupta/packages/smriti/src/recall.ts
21
21
  import fs2 from "fs";
@@ -713,4 +713,4 @@ export {
713
713
  RecallEngine,
714
714
  migrateEmbeddingsJson
715
715
  };
716
- //# sourceMappingURL=chunk-F35MWELH.js.map
716
+ //# sourceMappingURL=chunk-LVE2EOOH.js.map
@@ -3,11 +3,11 @@ import {
3
3
  } from "./chunk-YJRXLRTE.js";
4
4
  import {
5
5
  DatabaseManager
6
- } from "./chunk-UQLPHNGH.js";
6
+ } from "./chunk-U62ABYKD.js";
7
7
  import {
8
8
  SessionError,
9
9
  getChitraguptaHome
10
- } from "./chunk-KC6NRZ7U.js";
10
+ } from "./chunk-UZ6OIVEC.js";
11
11
 
12
12
  // ../chitragupta/packages/smriti/src/session-store.ts
13
13
  import fs from "fs";
@@ -1005,4 +1005,4 @@ export {
1005
1005
  findSessionByMetadata,
1006
1006
  migrateExistingSessions
1007
1007
  };
1008
- //# sourceMappingURL=chunk-2ARPXEDC.js.map
1008
+ //# sourceMappingURL=chunk-NHRBVSN3.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  DatabaseManager
3
- } from "./chunk-UQLPHNGH.js";
3
+ } from "./chunk-U62ABYKD.js";
4
4
 
5
5
  // ../chitragupta/packages/smriti/src/vasana-engine.ts
6
6
  var FNV_OFFSET = 2166136261;
@@ -542,4 +542,4 @@ function jsonArr(s) {
542
542
  export {
543
543
  VasanaEngine
544
544
  };
545
- //# sourceMappingURL=chunk-F4T7POKM.js.map
545
+ //# sourceMappingURL=chunk-OBYBBGHA.js.map
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  getMemory,
3
3
  listMemoryScopes
4
- } from "./chunk-E5A3SCDJ.js";
4
+ } from "./chunk-6556EKOB.js";
5
5
  import {
6
6
  listSessions,
7
7
  loadSession
8
- } from "./chunk-2ARPXEDC.js";
8
+ } from "./chunk-NHRBVSN3.js";
9
9
  import {
10
10
  initAgentSchema
11
11
  } from "./chunk-YJRXLRTE.js";
12
12
  import {
13
13
  DatabaseManager
14
- } from "./chunk-UQLPHNGH.js";
14
+ } from "./chunk-U62ABYKD.js";
15
15
 
16
16
  // ../chitragupta/packages/smriti/src/search.ts
17
17
  var _dbInitialized = false;
@@ -346,4 +346,4 @@ export {
346
346
  searchSessions,
347
347
  searchMemory
348
348
  };
349
- //# sourceMappingURL=chunk-UW6E7IC4.js.map
349
+ //# sourceMappingURL=chunk-PJEYJQ2C.js.map
@@ -12,10 +12,10 @@ import {
12
12
  } from "./chunk-YJRXLRTE.js";
13
13
  import {
14
14
  DatabaseManager
15
- } from "./chunk-UQLPHNGH.js";
15
+ } from "./chunk-U62ABYKD.js";
16
16
  import {
17
17
  getChitraguptaHome
18
- } from "./chunk-KC6NRZ7U.js";
18
+ } from "./chunk-UZ6OIVEC.js";
19
19
 
20
20
  // ../chitragupta/packages/smriti/src/graphrag.ts
21
21
  import fs from "fs";
@@ -2157,4 +2157,4 @@ export {
2157
2157
  GraphRAGEngine,
2158
2158
  migrateGraphJson
2159
2159
  };
2160
- //# sourceMappingURL=chunk-SLA2OIMG.js.map
2160
+ //# sourceMappingURL=chunk-S2HDNNC7.js.map
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  DatabaseManager
3
- } from "./chunk-UQLPHNGH.js";
3
+ } from "./chunk-U62ABYKD.js";
4
4
  import {
5
5
  getChitraguptaHome
6
- } from "./chunk-KC6NRZ7U.js";
6
+ } from "./chunk-UZ6OIVEC.js";
7
7
 
8
8
  // ../chitragupta/packages/smriti/src/periodic-consolidation.ts
9
9
  import fs from "node:fs";
@@ -135,7 +135,7 @@ var PeriodicConsolidation = class {
135
135
  const filePath = this.getReportPath("monthly", period);
136
136
  this._writeReport(filePath, markdown);
137
137
  try {
138
- const { indexConsolidationSummary } = await import("./consolidation-indexer-A46RJU4R.js");
138
+ const { indexConsolidationSummary } = await import("./consolidation-indexer-CD6DS2HO.js");
139
139
  await indexConsolidationSummary("monthly", period, markdown, this._project);
140
140
  } catch {
141
141
  }
@@ -278,7 +278,7 @@ var PeriodicConsolidation = class {
278
278
  const filePath = this.getReportPath("yearly", period);
279
279
  this._writeReport(filePath, markdown);
280
280
  try {
281
- const { indexConsolidationSummary } = await import("./consolidation-indexer-A46RJU4R.js");
281
+ const { indexConsolidationSummary } = await import("./consolidation-indexer-CD6DS2HO.js");
282
282
  await indexConsolidationSummary("yearly", period, markdown, this._project);
283
283
  } catch {
284
284
  }
@@ -749,4 +749,4 @@ var PeriodicConsolidation = class {
749
749
  export {
750
750
  PeriodicConsolidation
751
751
  };
752
- //# sourceMappingURL=chunk-DQMAQ2VL.js.map
752
+ //# sourceMappingURL=chunk-TEQKXGIK.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getChitraguptaHome
3
- } from "./chunk-KC6NRZ7U.js";
3
+ } from "./chunk-UZ6OIVEC.js";
4
4
 
5
5
  // ../chitragupta/packages/smriti/src/db/database.ts
6
6
  import Database from "better-sqlite3";
@@ -120,4 +120,4 @@ var DatabaseManager = class _DatabaseManager {
120
120
  export {
121
121
  DatabaseManager
122
122
  };
123
- //# sourceMappingURL=chunk-UQLPHNGH.js.map
123
+ //# sourceMappingURL=chunk-U62ABYKD.js.map
@@ -195,4 +195,4 @@ export {
195
195
  MemoryError,
196
196
  getChitraguptaHome
197
197
  };
198
- //# sourceMappingURL=chunk-KC6NRZ7U.js.map
198
+ //# sourceMappingURL=chunk-UZ6OIVEC.js.map