@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,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DatabaseManager
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-67DXWEKG.js";
|
|
4
4
|
import {
|
|
5
5
|
getChitraguptaHome
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-2OBLQJYJ.js";
|
|
7
7
|
|
|
8
|
-
// ../chitragupta/packages/smriti/
|
|
8
|
+
// ../chitragupta/packages/smriti/dist/periodic-consolidation.js
|
|
9
9
|
import fs2 from "node:fs";
|
|
10
10
|
import path from "node:path";
|
|
11
11
|
|
|
12
|
-
// ../chitragupta/packages/smriti/
|
|
12
|
+
// ../chitragupta/packages/smriti/dist/periodic-monthly.js
|
|
13
13
|
function esc(s) {
|
|
14
14
|
return s.replace(/\|/g, "\\|").replace(/\n/g, " ");
|
|
15
15
|
}
|
|
@@ -17,7 +17,8 @@ function truncate(s, max) {
|
|
|
17
17
|
return s.length <= max ? s : s.slice(0, max - 3) + "...";
|
|
18
18
|
}
|
|
19
19
|
function countJsonArray(json) {
|
|
20
|
-
if (!json)
|
|
20
|
+
if (!json)
|
|
21
|
+
return 0;
|
|
21
22
|
try {
|
|
22
23
|
const arr = JSON.parse(json);
|
|
23
24
|
return Array.isArray(arr) ? arr.length : 0;
|
|
@@ -29,22 +30,29 @@ function generateRecommendations(stats, vasanas, vidhis, samskaras, tools) {
|
|
|
29
30
|
const recs = [];
|
|
30
31
|
if (stats.sessions > 0 && stats.cost > 0) {
|
|
31
32
|
const cps = stats.cost / stats.sessions;
|
|
32
|
-
if (cps > 1)
|
|
33
|
+
if (cps > 1)
|
|
34
|
+
recs.push(`Average cost per session is $${cps.toFixed(2)} \u2014 consider using lighter models for routine tasks.`);
|
|
33
35
|
}
|
|
34
36
|
if (stats.turns > 0 && stats.tokens > 0) {
|
|
35
37
|
const tpt = Math.round(stats.tokens / stats.turns);
|
|
36
|
-
if (tpt > 5e3)
|
|
38
|
+
if (tpt > 5e3)
|
|
39
|
+
recs.push(`High token usage per turn (${tpt.toLocaleString()} avg) \u2014 review context window usage and compaction settings.`);
|
|
37
40
|
}
|
|
38
41
|
const negVas = vasanas.filter((v) => v.valence === "negative");
|
|
39
|
-
if (negVas.length > 0)
|
|
42
|
+
if (negVas.length > 0)
|
|
43
|
+
recs.push(`${negVas.length} negative vasana(s) detected: ${negVas.map((v) => v.name).join(", ")}. Investigate root causes.`);
|
|
40
44
|
const weakVidhis = vidhis.filter((v) => v.success_rate < 0.5);
|
|
41
|
-
if (weakVidhis.length > 0)
|
|
45
|
+
if (weakVidhis.length > 0)
|
|
46
|
+
recs.push(`${weakVidhis.length} vidhi(s) with sub-50% success rate \u2014 consider refining or deprecating: ${weakVidhis.map((v) => v.name).join(", ")}.`);
|
|
42
47
|
const strongSam = samskaras.filter((s) => s.confidence > 0.8 && s.observation_count >= 5);
|
|
43
|
-
if (strongSam.length > 0)
|
|
48
|
+
if (strongSam.length > 0)
|
|
49
|
+
recs.push(`${strongSam.length} high-confidence samskara(s) may be ready for vasana crystallization.`);
|
|
44
50
|
if (tools.size > 0 && stats.sessions >= 5) {
|
|
45
|
-
if (tools.size / stats.sessions < 1.5)
|
|
51
|
+
if (tools.size / stats.sessions < 1.5)
|
|
52
|
+
recs.push("Low tool diversity \u2014 explore additional tools to improve efficiency.");
|
|
46
53
|
}
|
|
47
|
-
if (recs.length === 0)
|
|
54
|
+
if (recs.length === 0)
|
|
55
|
+
recs.push("All metrics within healthy ranges. Keep up the momentum.");
|
|
48
56
|
return recs;
|
|
49
57
|
}
|
|
50
58
|
function buildMonthlyMarkdown(project, period, stats, vasanas, vidhis, samskaras, tools, newNodes, newEdges, recommendations) {
|
|
@@ -59,7 +67,8 @@ function buildMonthlyMarkdown(project, period, stats, vasanas, vidhis, samskaras
|
|
|
59
67
|
lines.push("_No vasanas crystallized this month._");
|
|
60
68
|
} else {
|
|
61
69
|
lines.push("| Tendency | Strength | Valence | Stability |", "|----------|----------|---------|-----------|");
|
|
62
|
-
for (const v of vasanas)
|
|
70
|
+
for (const v of vasanas)
|
|
71
|
+
lines.push(`| ${esc(v.name)} | ${v.strength.toFixed(2)} | ${v.valence} | ${v.stability.toFixed(2)} |`);
|
|
63
72
|
}
|
|
64
73
|
lines.push("");
|
|
65
74
|
lines.push("## Vidhis Extracted");
|
|
@@ -67,7 +76,8 @@ function buildMonthlyMarkdown(project, period, stats, vasanas, vidhis, samskaras
|
|
|
67
76
|
lines.push("_No vidhis extracted this month._");
|
|
68
77
|
} else {
|
|
69
78
|
lines.push("| Procedure | Steps | Success Rate | Sessions |", "|-----------|-------|--------------|----------|");
|
|
70
|
-
for (const v of vidhis)
|
|
79
|
+
for (const v of vidhis)
|
|
80
|
+
lines.push(`| ${esc(v.name)} | ${countJsonArray(v.steps)} | ${v.success_rate.toFixed(2)} | ${countJsonArray(v.learned_from)} |`);
|
|
71
81
|
}
|
|
72
82
|
lines.push("");
|
|
73
83
|
lines.push("## Top Samskaras");
|
|
@@ -75,12 +85,14 @@ function buildMonthlyMarkdown(project, period, stats, vasanas, vidhis, samskaras
|
|
|
75
85
|
lines.push("_No active samskaras this month._");
|
|
76
86
|
} else {
|
|
77
87
|
lines.push("| Pattern | Type | Confidence | Observations |", "|---------|------|------------|--------------|");
|
|
78
|
-
for (const s of samskaras)
|
|
88
|
+
for (const s of samskaras)
|
|
89
|
+
lines.push(`| ${esc(truncate(s.pattern_content, 60))} | ${s.pattern_type} | ${s.confidence.toFixed(2)} | ${s.observation_count} |`);
|
|
79
90
|
}
|
|
80
91
|
lines.push("");
|
|
81
92
|
lines.push("## Knowledge Graph Growth", `- New nodes: ${newNodes}`, `- New edges: ${newEdges}`, "");
|
|
82
93
|
lines.push("## Recommendations");
|
|
83
|
-
for (const rec of recommendations)
|
|
94
|
+
for (const rec of recommendations)
|
|
95
|
+
lines.push(`- ${rec}`);
|
|
84
96
|
lines.push("");
|
|
85
97
|
return lines.join("\n");
|
|
86
98
|
}
|
|
@@ -104,10 +116,12 @@ async function buildMonthlyReport(project, home, baseDir, year, month, writeRepo
|
|
|
104
116
|
const ph = sessionIds.map(() => "?").join(",");
|
|
105
117
|
const turns = agentDb.prepare(`SELECT tool_calls FROM turns WHERE session_id IN (${ph}) AND tool_calls IS NOT NULL`).all(...sessionIds);
|
|
106
118
|
for (const turn of turns) {
|
|
107
|
-
if (!turn.tool_calls)
|
|
119
|
+
if (!turn.tool_calls)
|
|
120
|
+
continue;
|
|
108
121
|
try {
|
|
109
122
|
for (const c of JSON.parse(turn.tool_calls)) {
|
|
110
|
-
if (c.name)
|
|
123
|
+
if (c.name)
|
|
124
|
+
toolSet.add(c.name);
|
|
111
125
|
}
|
|
112
126
|
} catch {
|
|
113
127
|
}
|
|
@@ -124,7 +138,7 @@ async function buildMonthlyReport(project, home, baseDir, year, month, writeRepo
|
|
|
124
138
|
const filePath = getReportPath("monthly", period);
|
|
125
139
|
writeReport(filePath, markdown);
|
|
126
140
|
try {
|
|
127
|
-
const { indexConsolidationSummary } = await import("./consolidation-indexer-
|
|
141
|
+
const { indexConsolidationSummary } = await import("./consolidation-indexer-VIWOP6VO.js");
|
|
128
142
|
await indexConsolidationSummary("monthly", period, markdown, project);
|
|
129
143
|
} catch {
|
|
130
144
|
}
|
|
@@ -134,7 +148,7 @@ async function buildMonthlyReport(project, home, baseDir, year, month, writeRepo
|
|
|
134
148
|
return { type: "monthly", period, project, filePath, markdown, stats, durationMs };
|
|
135
149
|
}
|
|
136
150
|
|
|
137
|
-
// ../chitragupta/packages/smriti/
|
|
151
|
+
// ../chitragupta/packages/smriti/dist/periodic-yearly.js
|
|
138
152
|
import fs from "node:fs";
|
|
139
153
|
function esc2(s) {
|
|
140
154
|
return s.replace(/\|/g, "\\|").replace(/\n/g, " ");
|
|
@@ -143,7 +157,8 @@ function truncate2(s, max) {
|
|
|
143
157
|
return s.length <= max ? s : s.slice(0, max - 3) + "...";
|
|
144
158
|
}
|
|
145
159
|
function countJsonArray2(json) {
|
|
146
|
-
if (!json)
|
|
160
|
+
if (!json)
|
|
161
|
+
return 0;
|
|
147
162
|
try {
|
|
148
163
|
const arr = JSON.parse(json);
|
|
149
164
|
return Array.isArray(arr) ? arr.length : 0;
|
|
@@ -153,25 +168,33 @@ function countJsonArray2(json) {
|
|
|
153
168
|
}
|
|
154
169
|
function analyzeTrends(reports) {
|
|
155
170
|
const trends = [];
|
|
156
|
-
if (reports.length < 2)
|
|
171
|
+
if (reports.length < 2)
|
|
172
|
+
return trends;
|
|
157
173
|
const sessionCounts = reports.map((r) => r.stats.sessions);
|
|
158
174
|
const half = Math.floor(sessionCounts.length / 2);
|
|
159
175
|
const avgFirst = sessionCounts.slice(0, half).reduce((a, b) => a + b, 0) / (half || 1);
|
|
160
176
|
const avgSecond = sessionCounts.slice(half).reduce((a, b) => a + b, 0) / (sessionCounts.length - half || 1);
|
|
161
|
-
if (avgSecond > avgFirst * 1.3)
|
|
162
|
-
|
|
177
|
+
if (avgSecond > avgFirst * 1.3)
|
|
178
|
+
trends.push("Session volume increased significantly in the second half of the year.");
|
|
179
|
+
else if (avgSecond < avgFirst * 0.7)
|
|
180
|
+
trends.push("Session volume decreased notably in the second half of the year.");
|
|
163
181
|
const costs = reports.map((r) => r.stats.cost);
|
|
164
182
|
const costFirst = costs.slice(0, half).reduce((a, b) => a + b, 0);
|
|
165
183
|
const costSecond = costs.slice(half).reduce((a, b) => a + b, 0);
|
|
166
184
|
if (costSecond > 0 && costFirst > 0) {
|
|
167
|
-
if (costSecond < costFirst * 0.8)
|
|
168
|
-
|
|
185
|
+
if (costSecond < costFirst * 0.8)
|
|
186
|
+
trends.push("Cost efficiency improved over the year \u2014 spending decreased while activity continued.");
|
|
187
|
+
else if (costSecond > costFirst * 1.5)
|
|
188
|
+
trends.push("Spending increased substantially \u2014 review model selection and caching strategies.");
|
|
169
189
|
}
|
|
170
190
|
const totalVasanas = reports.reduce((s, r) => s + r.stats.vasanasCreated, 0);
|
|
171
191
|
const totalVidhis = reports.reduce((s, r) => s + r.stats.vidhisCreated, 0);
|
|
172
|
-
if (totalVasanas > 10)
|
|
173
|
-
|
|
174
|
-
if (
|
|
192
|
+
if (totalVasanas > 10)
|
|
193
|
+
trends.push(`Strong behavioral crystallization: ${totalVasanas} vasanas formed across the year.`);
|
|
194
|
+
if (totalVidhis > 5)
|
|
195
|
+
trends.push(`Active procedural learning: ${totalVidhis} vidhis extracted from repeated patterns.`);
|
|
196
|
+
if (trends.length === 0)
|
|
197
|
+
trends.push("Steady, consistent usage throughout the year with no significant inflection points.");
|
|
175
198
|
return trends;
|
|
176
199
|
}
|
|
177
200
|
function buildYearlyMarkdown(project, period, stats, vasanas, vidhis, samskaras, yearNodes, yearEdges, monthlyReports, trends, prevYearStats) {
|
|
@@ -200,18 +223,21 @@ function buildYearlyMarkdown(project, period, stats, vasanas, vidhis, samskaras,
|
|
|
200
223
|
if (monthlyReports.length > 0) {
|
|
201
224
|
lines.push("## Monthly Breakdown");
|
|
202
225
|
lines.push("| Month | Sessions | Turns | Tokens | Cost |", "|-------|----------|-------|--------|------|");
|
|
203
|
-
for (const r of monthlyReports)
|
|
226
|
+
for (const r of monthlyReports)
|
|
227
|
+
lines.push(`| ${r.period} | ${r.stats.sessions} | ${r.stats.turns} | ${r.stats.tokens.toLocaleString()} | $${r.stats.cost.toFixed(4)} |`);
|
|
204
228
|
lines.push("");
|
|
205
229
|
}
|
|
206
230
|
lines.push("## Trends");
|
|
207
|
-
for (const t of trends)
|
|
231
|
+
for (const t of trends)
|
|
232
|
+
lines.push(`- ${t}`);
|
|
208
233
|
lines.push("");
|
|
209
234
|
lines.push("## Top Vasanas of the Year");
|
|
210
235
|
if (vasanas.length === 0) {
|
|
211
236
|
lines.push("_No vasanas crystallized this year._");
|
|
212
237
|
} else {
|
|
213
238
|
lines.push("| Tendency | Strength | Valence | Stability |", "|----------|----------|---------|-----------|");
|
|
214
|
-
for (const v of vasanas.slice(0, 15))
|
|
239
|
+
for (const v of vasanas.slice(0, 15))
|
|
240
|
+
lines.push(`| ${esc2(v.name)} | ${v.strength.toFixed(2)} | ${v.valence} | ${v.stability.toFixed(2)} |`);
|
|
215
241
|
}
|
|
216
242
|
lines.push("");
|
|
217
243
|
lines.push("## Top Vidhis of the Year");
|
|
@@ -219,7 +245,8 @@ function buildYearlyMarkdown(project, period, stats, vasanas, vidhis, samskaras,
|
|
|
219
245
|
lines.push("_No vidhis extracted this year._");
|
|
220
246
|
} else {
|
|
221
247
|
lines.push("| Procedure | Steps | Success Rate | Sessions |", "|-----------|-------|--------------|----------|");
|
|
222
|
-
for (const v of vidhis.slice(0, 15))
|
|
248
|
+
for (const v of vidhis.slice(0, 15))
|
|
249
|
+
lines.push(`| ${esc2(v.name)} | ${countJsonArray2(v.steps)} | ${v.success_rate.toFixed(2)} | ${countJsonArray2(v.learned_from)} |`);
|
|
223
250
|
}
|
|
224
251
|
lines.push("");
|
|
225
252
|
lines.push("## Top Samskaras of the Year");
|
|
@@ -227,7 +254,8 @@ function buildYearlyMarkdown(project, period, stats, vasanas, vidhis, samskaras,
|
|
|
227
254
|
lines.push("_No active samskaras this year._");
|
|
228
255
|
} else {
|
|
229
256
|
lines.push("| Pattern | Type | Confidence | Observations |", "|---------|------|------------|--------------|");
|
|
230
|
-
for (const s of samskaras.slice(0, 20))
|
|
257
|
+
for (const s of samskaras.slice(0, 20))
|
|
258
|
+
lines.push(`| ${esc2(truncate2(s.pattern_content, 60))} | ${s.pattern_type} | ${s.confidence.toFixed(2)} | ${s.observation_count} |`);
|
|
231
259
|
}
|
|
232
260
|
lines.push("");
|
|
233
261
|
lines.push("## Knowledge Graph Growth", `- New nodes: ${yearNodes}`, `- New edges: ${yearEdges}`, "");
|
|
@@ -278,13 +306,14 @@ async function buildYearlyReport(project, home, baseDir, year, monthlyFn, extrac
|
|
|
278
306
|
const yearEdges = graphDb.prepare(`SELECT COUNT(*) AS cnt FROM edges WHERE recorded_at >= ? AND recorded_at < ?`).get(startMs, endMs)?.cnt ?? 0;
|
|
279
307
|
let prevYearStats = null;
|
|
280
308
|
const prevPath = getReportPath("yearly", String(year - 1));
|
|
281
|
-
if (fs.existsSync(prevPath))
|
|
309
|
+
if (fs.existsSync(prevPath))
|
|
310
|
+
prevYearStats = extractStatsFromMarkdown(fs.readFileSync(prevPath, "utf-8"));
|
|
282
311
|
const trends = analyzeTrends(monthlyReports);
|
|
283
312
|
const markdown = buildYearlyMarkdown(project, period, annualStats, allVasanas, allVidhis, allSamskaras, yearNodes, yearEdges, monthlyReports, trends, prevYearStats);
|
|
284
313
|
const filePath = getReportPath("yearly", period);
|
|
285
314
|
writeReport(filePath, markdown);
|
|
286
315
|
try {
|
|
287
|
-
const { indexConsolidationSummary } = await import("./consolidation-indexer-
|
|
316
|
+
const { indexConsolidationSummary } = await import("./consolidation-indexer-VIWOP6VO.js");
|
|
288
317
|
await indexConsolidationSummary("yearly", period, markdown, project);
|
|
289
318
|
} catch {
|
|
290
319
|
}
|
|
@@ -297,7 +326,7 @@ async function buildYearlyReport(project, home, baseDir, year, monthlyFn, extrac
|
|
|
297
326
|
return { type: "yearly", period, project, filePath, markdown, stats: annualStats, durationMs };
|
|
298
327
|
}
|
|
299
328
|
|
|
300
|
-
// ../chitragupta/packages/smriti/
|
|
329
|
+
// ../chitragupta/packages/smriti/dist/periodic-consolidation.js
|
|
301
330
|
function projectHash(project) {
|
|
302
331
|
let h = 2166136261;
|
|
303
332
|
for (let i = 0; i < project.length; i++) {
|
|
@@ -320,32 +349,11 @@ var PeriodicConsolidation = class {
|
|
|
320
349
|
// ── Public API ────────────────────────────────────────────────────────
|
|
321
350
|
/** Run monthly consolidation for a specific calendar month. */
|
|
322
351
|
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
|
-
);
|
|
352
|
+
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
353
|
}
|
|
335
354
|
/** Run yearly consolidation for a specific calendar year. */
|
|
336
355
|
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
|
-
);
|
|
356
|
+
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
357
|
}
|
|
350
358
|
/** Check whether a monthly report exists on disk. */
|
|
351
359
|
hasMonthlyReport(year, month) {
|
|
@@ -365,7 +373,8 @@ var PeriodicConsolidation = class {
|
|
|
365
373
|
const reports = [];
|
|
366
374
|
for (const type of ["monthly", "yearly"]) {
|
|
367
375
|
const dir = path.join(this._baseDir, type);
|
|
368
|
-
if (!fs2.existsSync(dir))
|
|
376
|
+
if (!fs2.existsSync(dir))
|
|
377
|
+
continue;
|
|
369
378
|
const files = fs2.readdirSync(dir).filter((f) => f.endsWith(".md")).sort();
|
|
370
379
|
for (const file of files) {
|
|
371
380
|
reports.push({ type, period: file.replace(/\.md$/, ""), path: path.join(dir, file) });
|
|
@@ -390,9 +399,7 @@ var PeriodicConsolidation = class {
|
|
|
390
399
|
/** Log a consolidation run to the consolidation_log table. */
|
|
391
400
|
_logConsolidation(agentDb, entry) {
|
|
392
401
|
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);
|
|
402
|
+
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
403
|
} catch {
|
|
397
404
|
}
|
|
398
405
|
}
|
|
@@ -409,7 +416,8 @@ var PeriodicConsolidation = class {
|
|
|
409
416
|
stats.cost = num(/\*\*Estimated Cost\*\*:\s*\$?([\d,.]+)/);
|
|
410
417
|
const countTableRows = (sectionName) => {
|
|
411
418
|
const section = md.match(new RegExp(`## ${sectionName}\\n[\\s\\S]*?(?=\\n##|$)`));
|
|
412
|
-
if (!section)
|
|
419
|
+
if (!section)
|
|
420
|
+
return 0;
|
|
413
421
|
const rows = (section[0].match(/^\|(?!\s*-)[^|]+\|/gm) || []).length - 1;
|
|
414
422
|
return rows < 0 ? 0 : rows;
|
|
415
423
|
};
|
|
@@ -423,4 +431,4 @@ var PeriodicConsolidation = class {
|
|
|
423
431
|
export {
|
|
424
432
|
PeriodicConsolidation
|
|
425
433
|
};
|
|
426
|
-
//# sourceMappingURL=chunk-
|
|
434
|
+
//# sourceMappingURL=chunk-Z576WVLG.js.map
|