@yugenlab/vaayu 0.1.10 → 0.1.12
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-NQESOBLC.js} +2 -2
- package/chunks/akasha-5C5Q6NMP.js +12 -0
- package/chunks/{chunk-JGI4SDWS.js → chunk-26K6DS6N.js} +7 -5
- package/chunks/chunk-5E3ZS5SW.js +529 -0
- package/chunks/{chunk-VJHNE47S.js → chunk-ARZCIITZ.js} +104 -94
- package/chunks/{chunk-PRXQW76U.js → chunk-EG37M4QL.js} +17 -6
- package/chunks/{chunk-HIYHTWFW.js → chunk-FEDPZOZ5.js} +572 -441
- package/chunks/{chunk-O4KV7TFP.js → chunk-GWYC7R2L.js} +38 -20
- package/chunks/chunk-H46F2Y6R.js +134 -0
- package/chunks/{chunk-M7THR63C.js → chunk-HXHDP2PZ.js} +78 -65
- package/chunks/chunk-KVQH4LE7.js +396 -0
- package/chunks/{chunk-TND3MU4Z.js → chunk-LJCT7UYP.js} +86 -68
- package/chunks/{chunk-OT4G2L46.js → chunk-M2RLX5LU.js} +229 -163
- package/chunks/{chunk-IGKYKEKT.js → chunk-NAQKA54E.js} +8 -2
- package/chunks/{chunk-77725AR7.js → chunk-PZ4AQ22L.js} +151 -57
- package/chunks/{chunk-C76USAC5.js → chunk-QFGAB4XD.js} +13 -5
- package/chunks/{chunk-MJ74G5RB.js → chunk-R273KC7J.js} +276 -3
- package/chunks/{chunk-JAWZ7ANC.js → chunk-RVKTGKFD.js} +12 -8
- package/chunks/{chunk-AGK3A7R7.js → chunk-TSOQ2CT3.js} +1430 -1173
- package/chunks/{chunk-YJRXLRTE.js → chunk-VEZ2DI2M.js} +24 -12
- package/chunks/{chunk-N22M7D4P.js → chunk-XP3NIH5F.js} +91 -98
- package/chunks/{chunk-6556EKOB.js → chunk-Y6IZH6FT.js} +42 -26
- package/chunks/{chunk-AS3DJFY3.js → chunk-YRTGGYJU.js} +45 -41
- package/chunks/{consolidation-indexer-VKQ6DNU3.js → consolidation-indexer-KPXORCJ4.js} +9 -9
- package/chunks/database-BX3LVYXS.js +11 -0
- package/chunks/{day-consolidation-BH3QU2SZ.js → day-consolidation-CR3TJFAL.js} +5 -5
- package/chunks/{src-Y3TGMINC.js → dist-ESCM3CP5.js} +31 -21
- package/chunks/graphrag-73XA7LBX.js +14 -0
- package/chunks/hierarchical-temporal-search-GHKVKNZ6.js +8 -0
- package/chunks/hybrid-search-OD756RDV.js +20 -0
- package/chunks/{memory-store-A6WOWLWC.js → memory-store-4GCBR2DZ.js} +4 -4
- package/chunks/periodic-consolidation-IINCHP6L.js +11 -0
- package/chunks/postgres-YLCUNVPQ.js +8 -0
- package/chunks/recall-64RROTUC.js +21 -0
- package/chunks/search-JVCDNTAJ.js +19 -0
- package/chunks/{session-store-3BRPGC6P.js → session-store-3EDQZEDS.js} +12 -6
- package/chunks/{sqlite-DHUQGPR5.js → sqlite-4N7YH2KK.js} +3 -3
- package/chunks/{src-6GVZTUH6.js → src-OPSDZEFI.js} +2 -2
- package/chunks/{suncalc-NOHGYHDU.js → suncalc-RM7URNUR.js} +2 -2
- package/chunks/{tree-RSHKDTCR.js → tree-FIUVGJ5J.js} +2 -2
- package/chunks/{vasana-engine-MU25OQ23.js → vasana-engine-W4PYWT5H.js} +5 -5
- package/gateway.js +38859 -30650
- package/package.json +1 -1
- package/pair-cli.js +2 -2
- package/chunks/chunk-U62ABYKD.js +0 -123
- package/chunks/chunk-UZ6OIVEC.js +0 -198
- package/chunks/graphrag-D7OXWAWD.js +0 -14
- package/chunks/hierarchical-temporal-search-PVHVA3NZ.js +0 -8
- package/chunks/hybrid-search-G2NAJKJ7.js +0 -20
- package/chunks/periodic-consolidation-LMYMNS4Q.js +0 -11
- package/chunks/postgres-WLH3D5HG.js +0 -8
- package/chunks/recall-ZNL4DJ2L.js +0 -21
- package/chunks/search-35JMSGUT.js +0 -19
|
@@ -1,15 +1,25 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./chunk-
|
|
2
|
+
init_schema
|
|
3
|
+
} from "./chunk-VEZ2DI2M.js";
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
DatabaseManager,
|
|
6
|
+
init_database
|
|
7
|
+
} from "./chunk-H46F2Y6R.js";
|
|
8
|
+
import {
|
|
9
|
+
getChitraguptaHome,
|
|
10
|
+
init_dist
|
|
11
|
+
} from "./chunk-KVQH4LE7.js";
|
|
7
12
|
|
|
8
|
-
// ../chitragupta/packages/smriti/
|
|
13
|
+
// ../chitragupta/packages/smriti/dist/periodic-consolidation.js
|
|
14
|
+
init_dist();
|
|
9
15
|
import fs2 from "node:fs";
|
|
10
16
|
import path from "node:path";
|
|
11
17
|
|
|
12
|
-
// ../chitragupta/packages/smriti/
|
|
18
|
+
// ../chitragupta/packages/smriti/dist/db/index.js
|
|
19
|
+
init_database();
|
|
20
|
+
init_schema();
|
|
21
|
+
|
|
22
|
+
// ../chitragupta/packages/smriti/dist/periodic-monthly.js
|
|
13
23
|
function esc(s) {
|
|
14
24
|
return s.replace(/\|/g, "\\|").replace(/\n/g, " ");
|
|
15
25
|
}
|
|
@@ -17,7 +27,8 @@ function truncate(s, max) {
|
|
|
17
27
|
return s.length <= max ? s : s.slice(0, max - 3) + "...";
|
|
18
28
|
}
|
|
19
29
|
function countJsonArray(json) {
|
|
20
|
-
if (!json)
|
|
30
|
+
if (!json)
|
|
31
|
+
return 0;
|
|
21
32
|
try {
|
|
22
33
|
const arr = JSON.parse(json);
|
|
23
34
|
return Array.isArray(arr) ? arr.length : 0;
|
|
@@ -29,22 +40,29 @@ function generateRecommendations(stats, vasanas, vidhis, samskaras, tools) {
|
|
|
29
40
|
const recs = [];
|
|
30
41
|
if (stats.sessions > 0 && stats.cost > 0) {
|
|
31
42
|
const cps = stats.cost / stats.sessions;
|
|
32
|
-
if (cps > 1)
|
|
43
|
+
if (cps > 1)
|
|
44
|
+
recs.push(`Average cost per session is $${cps.toFixed(2)} \u2014 consider using lighter models for routine tasks.`);
|
|
33
45
|
}
|
|
34
46
|
if (stats.turns > 0 && stats.tokens > 0) {
|
|
35
47
|
const tpt = Math.round(stats.tokens / stats.turns);
|
|
36
|
-
if (tpt > 5e3)
|
|
48
|
+
if (tpt > 5e3)
|
|
49
|
+
recs.push(`High token usage per turn (${tpt.toLocaleString()} avg) \u2014 review context window usage and compaction settings.`);
|
|
37
50
|
}
|
|
38
51
|
const negVas = vasanas.filter((v) => v.valence === "negative");
|
|
39
|
-
if (negVas.length > 0)
|
|
52
|
+
if (negVas.length > 0)
|
|
53
|
+
recs.push(`${negVas.length} negative vasana(s) detected: ${negVas.map((v) => v.name).join(", ")}. Investigate root causes.`);
|
|
40
54
|
const weakVidhis = vidhis.filter((v) => v.success_rate < 0.5);
|
|
41
|
-
if (weakVidhis.length > 0)
|
|
55
|
+
if (weakVidhis.length > 0)
|
|
56
|
+
recs.push(`${weakVidhis.length} vidhi(s) with sub-50% success rate \u2014 consider refining or deprecating: ${weakVidhis.map((v) => v.name).join(", ")}.`);
|
|
42
57
|
const strongSam = samskaras.filter((s) => s.confidence > 0.8 && s.observation_count >= 5);
|
|
43
|
-
if (strongSam.length > 0)
|
|
58
|
+
if (strongSam.length > 0)
|
|
59
|
+
recs.push(`${strongSam.length} high-confidence samskara(s) may be ready for vasana crystallization.`);
|
|
44
60
|
if (tools.size > 0 && stats.sessions >= 5) {
|
|
45
|
-
if (tools.size / stats.sessions < 1.5)
|
|
61
|
+
if (tools.size / stats.sessions < 1.5)
|
|
62
|
+
recs.push("Low tool diversity \u2014 explore additional tools to improve efficiency.");
|
|
46
63
|
}
|
|
47
|
-
if (recs.length === 0)
|
|
64
|
+
if (recs.length === 0)
|
|
65
|
+
recs.push("All metrics within healthy ranges. Keep up the momentum.");
|
|
48
66
|
return recs;
|
|
49
67
|
}
|
|
50
68
|
function buildMonthlyMarkdown(project, period, stats, vasanas, vidhis, samskaras, tools, newNodes, newEdges, recommendations) {
|
|
@@ -59,7 +77,8 @@ function buildMonthlyMarkdown(project, period, stats, vasanas, vidhis, samskaras
|
|
|
59
77
|
lines.push("_No vasanas crystallized this month._");
|
|
60
78
|
} else {
|
|
61
79
|
lines.push("| Tendency | Strength | Valence | Stability |", "|----------|----------|---------|-----------|");
|
|
62
|
-
for (const v of vasanas)
|
|
80
|
+
for (const v of vasanas)
|
|
81
|
+
lines.push(`| ${esc(v.name)} | ${v.strength.toFixed(2)} | ${v.valence} | ${v.stability.toFixed(2)} |`);
|
|
63
82
|
}
|
|
64
83
|
lines.push("");
|
|
65
84
|
lines.push("## Vidhis Extracted");
|
|
@@ -67,7 +86,8 @@ function buildMonthlyMarkdown(project, period, stats, vasanas, vidhis, samskaras
|
|
|
67
86
|
lines.push("_No vidhis extracted this month._");
|
|
68
87
|
} else {
|
|
69
88
|
lines.push("| Procedure | Steps | Success Rate | Sessions |", "|-----------|-------|--------------|----------|");
|
|
70
|
-
for (const v of vidhis)
|
|
89
|
+
for (const v of vidhis)
|
|
90
|
+
lines.push(`| ${esc(v.name)} | ${countJsonArray(v.steps)} | ${v.success_rate.toFixed(2)} | ${countJsonArray(v.learned_from)} |`);
|
|
71
91
|
}
|
|
72
92
|
lines.push("");
|
|
73
93
|
lines.push("## Top Samskaras");
|
|
@@ -75,12 +95,14 @@ function buildMonthlyMarkdown(project, period, stats, vasanas, vidhis, samskaras
|
|
|
75
95
|
lines.push("_No active samskaras this month._");
|
|
76
96
|
} else {
|
|
77
97
|
lines.push("| Pattern | Type | Confidence | Observations |", "|---------|------|------------|--------------|");
|
|
78
|
-
for (const s of samskaras)
|
|
98
|
+
for (const s of samskaras)
|
|
99
|
+
lines.push(`| ${esc(truncate(s.pattern_content, 60))} | ${s.pattern_type} | ${s.confidence.toFixed(2)} | ${s.observation_count} |`);
|
|
79
100
|
}
|
|
80
101
|
lines.push("");
|
|
81
102
|
lines.push("## Knowledge Graph Growth", `- New nodes: ${newNodes}`, `- New edges: ${newEdges}`, "");
|
|
82
103
|
lines.push("## Recommendations");
|
|
83
|
-
for (const rec of recommendations)
|
|
104
|
+
for (const rec of recommendations)
|
|
105
|
+
lines.push(`- ${rec}`);
|
|
84
106
|
lines.push("");
|
|
85
107
|
return lines.join("\n");
|
|
86
108
|
}
|
|
@@ -104,10 +126,12 @@ async function buildMonthlyReport(project, home, baseDir, year, month, writeRepo
|
|
|
104
126
|
const ph = sessionIds.map(() => "?").join(",");
|
|
105
127
|
const turns = agentDb.prepare(`SELECT tool_calls FROM turns WHERE session_id IN (${ph}) AND tool_calls IS NOT NULL`).all(...sessionIds);
|
|
106
128
|
for (const turn of turns) {
|
|
107
|
-
if (!turn.tool_calls)
|
|
129
|
+
if (!turn.tool_calls)
|
|
130
|
+
continue;
|
|
108
131
|
try {
|
|
109
132
|
for (const c of JSON.parse(turn.tool_calls)) {
|
|
110
|
-
if (c.name)
|
|
133
|
+
if (c.name)
|
|
134
|
+
toolSet.add(c.name);
|
|
111
135
|
}
|
|
112
136
|
} catch {
|
|
113
137
|
}
|
|
@@ -124,7 +148,7 @@ async function buildMonthlyReport(project, home, baseDir, year, month, writeRepo
|
|
|
124
148
|
const filePath = getReportPath("monthly", period);
|
|
125
149
|
writeReport(filePath, markdown);
|
|
126
150
|
try {
|
|
127
|
-
const { indexConsolidationSummary } = await import("./consolidation-indexer-
|
|
151
|
+
const { indexConsolidationSummary } = await import("./consolidation-indexer-KPXORCJ4.js");
|
|
128
152
|
await indexConsolidationSummary("monthly", period, markdown, project);
|
|
129
153
|
} catch {
|
|
130
154
|
}
|
|
@@ -134,7 +158,7 @@ async function buildMonthlyReport(project, home, baseDir, year, month, writeRepo
|
|
|
134
158
|
return { type: "monthly", period, project, filePath, markdown, stats, durationMs };
|
|
135
159
|
}
|
|
136
160
|
|
|
137
|
-
// ../chitragupta/packages/smriti/
|
|
161
|
+
// ../chitragupta/packages/smriti/dist/periodic-yearly.js
|
|
138
162
|
import fs from "node:fs";
|
|
139
163
|
function esc2(s) {
|
|
140
164
|
return s.replace(/\|/g, "\\|").replace(/\n/g, " ");
|
|
@@ -143,7 +167,8 @@ function truncate2(s, max) {
|
|
|
143
167
|
return s.length <= max ? s : s.slice(0, max - 3) + "...";
|
|
144
168
|
}
|
|
145
169
|
function countJsonArray2(json) {
|
|
146
|
-
if (!json)
|
|
170
|
+
if (!json)
|
|
171
|
+
return 0;
|
|
147
172
|
try {
|
|
148
173
|
const arr = JSON.parse(json);
|
|
149
174
|
return Array.isArray(arr) ? arr.length : 0;
|
|
@@ -153,25 +178,33 @@ function countJsonArray2(json) {
|
|
|
153
178
|
}
|
|
154
179
|
function analyzeTrends(reports) {
|
|
155
180
|
const trends = [];
|
|
156
|
-
if (reports.length < 2)
|
|
181
|
+
if (reports.length < 2)
|
|
182
|
+
return trends;
|
|
157
183
|
const sessionCounts = reports.map((r) => r.stats.sessions);
|
|
158
184
|
const half = Math.floor(sessionCounts.length / 2);
|
|
159
185
|
const avgFirst = sessionCounts.slice(0, half).reduce((a, b) => a + b, 0) / (half || 1);
|
|
160
186
|
const avgSecond = sessionCounts.slice(half).reduce((a, b) => a + b, 0) / (sessionCounts.length - half || 1);
|
|
161
|
-
if (avgSecond > avgFirst * 1.3)
|
|
162
|
-
|
|
187
|
+
if (avgSecond > avgFirst * 1.3)
|
|
188
|
+
trends.push("Session volume increased significantly in the second half of the year.");
|
|
189
|
+
else if (avgSecond < avgFirst * 0.7)
|
|
190
|
+
trends.push("Session volume decreased notably in the second half of the year.");
|
|
163
191
|
const costs = reports.map((r) => r.stats.cost);
|
|
164
192
|
const costFirst = costs.slice(0, half).reduce((a, b) => a + b, 0);
|
|
165
193
|
const costSecond = costs.slice(half).reduce((a, b) => a + b, 0);
|
|
166
194
|
if (costSecond > 0 && costFirst > 0) {
|
|
167
|
-
if (costSecond < costFirst * 0.8)
|
|
168
|
-
|
|
195
|
+
if (costSecond < costFirst * 0.8)
|
|
196
|
+
trends.push("Cost efficiency improved over the year \u2014 spending decreased while activity continued.");
|
|
197
|
+
else if (costSecond > costFirst * 1.5)
|
|
198
|
+
trends.push("Spending increased substantially \u2014 review model selection and caching strategies.");
|
|
169
199
|
}
|
|
170
200
|
const totalVasanas = reports.reduce((s, r) => s + r.stats.vasanasCreated, 0);
|
|
171
201
|
const totalVidhis = reports.reduce((s, r) => s + r.stats.vidhisCreated, 0);
|
|
172
|
-
if (totalVasanas > 10)
|
|
173
|
-
|
|
174
|
-
if (
|
|
202
|
+
if (totalVasanas > 10)
|
|
203
|
+
trends.push(`Strong behavioral crystallization: ${totalVasanas} vasanas formed across the year.`);
|
|
204
|
+
if (totalVidhis > 5)
|
|
205
|
+
trends.push(`Active procedural learning: ${totalVidhis} vidhis extracted from repeated patterns.`);
|
|
206
|
+
if (trends.length === 0)
|
|
207
|
+
trends.push("Steady, consistent usage throughout the year with no significant inflection points.");
|
|
175
208
|
return trends;
|
|
176
209
|
}
|
|
177
210
|
function buildYearlyMarkdown(project, period, stats, vasanas, vidhis, samskaras, yearNodes, yearEdges, monthlyReports, trends, prevYearStats) {
|
|
@@ -200,18 +233,21 @@ function buildYearlyMarkdown(project, period, stats, vasanas, vidhis, samskaras,
|
|
|
200
233
|
if (monthlyReports.length > 0) {
|
|
201
234
|
lines.push("## Monthly Breakdown");
|
|
202
235
|
lines.push("| Month | Sessions | Turns | Tokens | Cost |", "|-------|----------|-------|--------|------|");
|
|
203
|
-
for (const r of monthlyReports)
|
|
236
|
+
for (const r of monthlyReports)
|
|
237
|
+
lines.push(`| ${r.period} | ${r.stats.sessions} | ${r.stats.turns} | ${r.stats.tokens.toLocaleString()} | $${r.stats.cost.toFixed(4)} |`);
|
|
204
238
|
lines.push("");
|
|
205
239
|
}
|
|
206
240
|
lines.push("## Trends");
|
|
207
|
-
for (const t of trends)
|
|
241
|
+
for (const t of trends)
|
|
242
|
+
lines.push(`- ${t}`);
|
|
208
243
|
lines.push("");
|
|
209
244
|
lines.push("## Top Vasanas of the Year");
|
|
210
245
|
if (vasanas.length === 0) {
|
|
211
246
|
lines.push("_No vasanas crystallized this year._");
|
|
212
247
|
} else {
|
|
213
248
|
lines.push("| Tendency | Strength | Valence | Stability |", "|----------|----------|---------|-----------|");
|
|
214
|
-
for (const v of vasanas.slice(0, 15))
|
|
249
|
+
for (const v of vasanas.slice(0, 15))
|
|
250
|
+
lines.push(`| ${esc2(v.name)} | ${v.strength.toFixed(2)} | ${v.valence} | ${v.stability.toFixed(2)} |`);
|
|
215
251
|
}
|
|
216
252
|
lines.push("");
|
|
217
253
|
lines.push("## Top Vidhis of the Year");
|
|
@@ -219,7 +255,8 @@ function buildYearlyMarkdown(project, period, stats, vasanas, vidhis, samskaras,
|
|
|
219
255
|
lines.push("_No vidhis extracted this year._");
|
|
220
256
|
} else {
|
|
221
257
|
lines.push("| Procedure | Steps | Success Rate | Sessions |", "|-----------|-------|--------------|----------|");
|
|
222
|
-
for (const v of vidhis.slice(0, 15))
|
|
258
|
+
for (const v of vidhis.slice(0, 15))
|
|
259
|
+
lines.push(`| ${esc2(v.name)} | ${countJsonArray2(v.steps)} | ${v.success_rate.toFixed(2)} | ${countJsonArray2(v.learned_from)} |`);
|
|
223
260
|
}
|
|
224
261
|
lines.push("");
|
|
225
262
|
lines.push("## Top Samskaras of the Year");
|
|
@@ -227,7 +264,8 @@ function buildYearlyMarkdown(project, period, stats, vasanas, vidhis, samskaras,
|
|
|
227
264
|
lines.push("_No active samskaras this year._");
|
|
228
265
|
} else {
|
|
229
266
|
lines.push("| Pattern | Type | Confidence | Observations |", "|---------|------|------------|--------------|");
|
|
230
|
-
for (const s of samskaras.slice(0, 20))
|
|
267
|
+
for (const s of samskaras.slice(0, 20))
|
|
268
|
+
lines.push(`| ${esc2(truncate2(s.pattern_content, 60))} | ${s.pattern_type} | ${s.confidence.toFixed(2)} | ${s.observation_count} |`);
|
|
231
269
|
}
|
|
232
270
|
lines.push("");
|
|
233
271
|
lines.push("## Knowledge Graph Growth", `- New nodes: ${yearNodes}`, `- New edges: ${yearEdges}`, "");
|
|
@@ -278,13 +316,14 @@ async function buildYearlyReport(project, home, baseDir, year, monthlyFn, extrac
|
|
|
278
316
|
const yearEdges = graphDb.prepare(`SELECT COUNT(*) AS cnt FROM edges WHERE recorded_at >= ? AND recorded_at < ?`).get(startMs, endMs)?.cnt ?? 0;
|
|
279
317
|
let prevYearStats = null;
|
|
280
318
|
const prevPath = getReportPath("yearly", String(year - 1));
|
|
281
|
-
if (fs.existsSync(prevPath))
|
|
319
|
+
if (fs.existsSync(prevPath))
|
|
320
|
+
prevYearStats = extractStatsFromMarkdown(fs.readFileSync(prevPath, "utf-8"));
|
|
282
321
|
const trends = analyzeTrends(monthlyReports);
|
|
283
322
|
const markdown = buildYearlyMarkdown(project, period, annualStats, allVasanas, allVidhis, allSamskaras, yearNodes, yearEdges, monthlyReports, trends, prevYearStats);
|
|
284
323
|
const filePath = getReportPath("yearly", period);
|
|
285
324
|
writeReport(filePath, markdown);
|
|
286
325
|
try {
|
|
287
|
-
const { indexConsolidationSummary } = await import("./consolidation-indexer-
|
|
326
|
+
const { indexConsolidationSummary } = await import("./consolidation-indexer-KPXORCJ4.js");
|
|
288
327
|
await indexConsolidationSummary("yearly", period, markdown, project);
|
|
289
328
|
} catch {
|
|
290
329
|
}
|
|
@@ -297,7 +336,7 @@ async function buildYearlyReport(project, home, baseDir, year, monthlyFn, extrac
|
|
|
297
336
|
return { type: "yearly", period, project, filePath, markdown, stats: annualStats, durationMs };
|
|
298
337
|
}
|
|
299
338
|
|
|
300
|
-
// ../chitragupta/packages/smriti/
|
|
339
|
+
// ../chitragupta/packages/smriti/dist/periodic-consolidation.js
|
|
301
340
|
function projectHash(project) {
|
|
302
341
|
let h = 2166136261;
|
|
303
342
|
for (let i = 0; i < project.length; i++) {
|
|
@@ -320,32 +359,11 @@ var PeriodicConsolidation = class {
|
|
|
320
359
|
// ── Public API ────────────────────────────────────────────────────────
|
|
321
360
|
/** Run monthly consolidation for a specific calendar month. */
|
|
322
361
|
async monthly(year, month) {
|
|
323
|
-
return buildMonthlyReport(
|
|
324
|
-
this._project,
|
|
325
|
-
this._home,
|
|
326
|
-
this._baseDir,
|
|
327
|
-
year,
|
|
328
|
-
month,
|
|
329
|
-
this._writeReport.bind(this),
|
|
330
|
-
this._indexIntoFts.bind(this),
|
|
331
|
-
this._logConsolidation.bind(this),
|
|
332
|
-
this.getReportPath.bind(this)
|
|
333
|
-
);
|
|
362
|
+
return buildMonthlyReport(this._project, this._home, this._baseDir, year, month, this._writeReport.bind(this), this._indexIntoFts.bind(this), this._logConsolidation.bind(this), this.getReportPath.bind(this));
|
|
334
363
|
}
|
|
335
364
|
/** Run yearly consolidation for a specific calendar year. */
|
|
336
365
|
async yearly(year) {
|
|
337
|
-
return buildYearlyReport(
|
|
338
|
-
this._project,
|
|
339
|
-
this._home,
|
|
340
|
-
this._baseDir,
|
|
341
|
-
year,
|
|
342
|
-
this.monthly.bind(this),
|
|
343
|
-
this._extractStatsFromMarkdown.bind(this),
|
|
344
|
-
this._writeReport.bind(this),
|
|
345
|
-
this._indexIntoFts.bind(this),
|
|
346
|
-
this._logConsolidation.bind(this),
|
|
347
|
-
this.getReportPath.bind(this)
|
|
348
|
-
);
|
|
366
|
+
return buildYearlyReport(this._project, this._home, this._baseDir, year, this.monthly.bind(this), this._extractStatsFromMarkdown.bind(this), this._writeReport.bind(this), this._indexIntoFts.bind(this), this._logConsolidation.bind(this), this.getReportPath.bind(this));
|
|
349
367
|
}
|
|
350
368
|
/** Check whether a monthly report exists on disk. */
|
|
351
369
|
hasMonthlyReport(year, month) {
|
|
@@ -365,7 +383,8 @@ var PeriodicConsolidation = class {
|
|
|
365
383
|
const reports = [];
|
|
366
384
|
for (const type of ["monthly", "yearly"]) {
|
|
367
385
|
const dir = path.join(this._baseDir, type);
|
|
368
|
-
if (!fs2.existsSync(dir))
|
|
386
|
+
if (!fs2.existsSync(dir))
|
|
387
|
+
continue;
|
|
369
388
|
const files = fs2.readdirSync(dir).filter((f) => f.endsWith(".md")).sort();
|
|
370
389
|
for (const file of files) {
|
|
371
390
|
reports.push({ type, period: file.replace(/\.md$/, ""), path: path.join(dir, file) });
|
|
@@ -390,9 +409,7 @@ var PeriodicConsolidation = class {
|
|
|
390
409
|
/** Log a consolidation run to the consolidation_log table. */
|
|
391
410
|
_logConsolidation(agentDb, entry) {
|
|
392
411
|
try {
|
|
393
|
-
agentDb.prepare(
|
|
394
|
-
`INSERT INTO consolidation_log (project, cycle_type, cycle_id, vasanas_created, vidhis_created, samskaras_processed, sessions_processed, status, created_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`
|
|
395
|
-
).run(entry.project, entry.cycleType, entry.cycleId, entry.vasanasCreated, entry.vidhisCreated, entry.samskarasProcessed, entry.sessionsProcessed, entry.status, entry.createdAt);
|
|
412
|
+
agentDb.prepare(`INSERT INTO consolidation_log (project, cycle_type, cycle_id, vasanas_created, vidhis_created, samskaras_processed, sessions_processed, status, created_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(entry.project, entry.cycleType, entry.cycleId, entry.vasanasCreated, entry.vidhisCreated, entry.samskarasProcessed, entry.sessionsProcessed, entry.status, entry.createdAt);
|
|
396
413
|
} catch {
|
|
397
414
|
}
|
|
398
415
|
}
|
|
@@ -409,7 +426,8 @@ var PeriodicConsolidation = class {
|
|
|
409
426
|
stats.cost = num(/\*\*Estimated Cost\*\*:\s*\$?([\d,.]+)/);
|
|
410
427
|
const countTableRows = (sectionName) => {
|
|
411
428
|
const section = md.match(new RegExp(`## ${sectionName}\\n[\\s\\S]*?(?=\\n##|$)`));
|
|
412
|
-
if (!section)
|
|
429
|
+
if (!section)
|
|
430
|
+
return 0;
|
|
413
431
|
const rows = (section[0].match(/^\|(?!\s*-)[^|]+\|/gm) || []).length - 1;
|
|
414
432
|
return rows < 0 ? 0 : rows;
|
|
415
433
|
};
|
|
@@ -423,4 +441,4 @@ var PeriodicConsolidation = class {
|
|
|
423
441
|
export {
|
|
424
442
|
PeriodicConsolidation
|
|
425
443
|
};
|
|
426
|
-
//# sourceMappingURL=chunk-
|
|
444
|
+
//# sourceMappingURL=chunk-LJCT7UYP.js.map
|