@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.
Files changed (53) hide show
  1. package/chunks/{agentic-tool-loop-2FZK72JO.js → agentic-tool-loop-NQESOBLC.js} +2 -2
  2. package/chunks/akasha-5C5Q6NMP.js +12 -0
  3. package/chunks/{chunk-JGI4SDWS.js → chunk-26K6DS6N.js} +7 -5
  4. package/chunks/chunk-5E3ZS5SW.js +529 -0
  5. package/chunks/{chunk-VJHNE47S.js → chunk-ARZCIITZ.js} +104 -94
  6. package/chunks/{chunk-PRXQW76U.js → chunk-EG37M4QL.js} +17 -6
  7. package/chunks/{chunk-HIYHTWFW.js → chunk-FEDPZOZ5.js} +572 -441
  8. package/chunks/{chunk-O4KV7TFP.js → chunk-GWYC7R2L.js} +38 -20
  9. package/chunks/chunk-H46F2Y6R.js +134 -0
  10. package/chunks/{chunk-M7THR63C.js → chunk-HXHDP2PZ.js} +78 -65
  11. package/chunks/chunk-KVQH4LE7.js +396 -0
  12. package/chunks/{chunk-TND3MU4Z.js → chunk-LJCT7UYP.js} +86 -68
  13. package/chunks/{chunk-OT4G2L46.js → chunk-M2RLX5LU.js} +229 -163
  14. package/chunks/{chunk-IGKYKEKT.js → chunk-NAQKA54E.js} +8 -2
  15. package/chunks/{chunk-77725AR7.js → chunk-PZ4AQ22L.js} +151 -57
  16. package/chunks/{chunk-C76USAC5.js → chunk-QFGAB4XD.js} +13 -5
  17. package/chunks/{chunk-MJ74G5RB.js → chunk-R273KC7J.js} +276 -3
  18. package/chunks/{chunk-JAWZ7ANC.js → chunk-RVKTGKFD.js} +12 -8
  19. package/chunks/{chunk-AGK3A7R7.js → chunk-TSOQ2CT3.js} +1430 -1173
  20. package/chunks/{chunk-YJRXLRTE.js → chunk-VEZ2DI2M.js} +24 -12
  21. package/chunks/{chunk-N22M7D4P.js → chunk-XP3NIH5F.js} +91 -98
  22. package/chunks/{chunk-6556EKOB.js → chunk-Y6IZH6FT.js} +42 -26
  23. package/chunks/{chunk-AS3DJFY3.js → chunk-YRTGGYJU.js} +45 -41
  24. package/chunks/{consolidation-indexer-VKQ6DNU3.js → consolidation-indexer-KPXORCJ4.js} +9 -9
  25. package/chunks/database-BX3LVYXS.js +11 -0
  26. package/chunks/{day-consolidation-BH3QU2SZ.js → day-consolidation-CR3TJFAL.js} +5 -5
  27. package/chunks/{src-Y3TGMINC.js → dist-ESCM3CP5.js} +31 -21
  28. package/chunks/graphrag-73XA7LBX.js +14 -0
  29. package/chunks/hierarchical-temporal-search-GHKVKNZ6.js +8 -0
  30. package/chunks/hybrid-search-OD756RDV.js +20 -0
  31. package/chunks/{memory-store-A6WOWLWC.js → memory-store-4GCBR2DZ.js} +4 -4
  32. package/chunks/periodic-consolidation-IINCHP6L.js +11 -0
  33. package/chunks/postgres-YLCUNVPQ.js +8 -0
  34. package/chunks/recall-64RROTUC.js +21 -0
  35. package/chunks/search-JVCDNTAJ.js +19 -0
  36. package/chunks/{session-store-3BRPGC6P.js → session-store-3EDQZEDS.js} +12 -6
  37. package/chunks/{sqlite-DHUQGPR5.js → sqlite-4N7YH2KK.js} +3 -3
  38. package/chunks/{src-6GVZTUH6.js → src-OPSDZEFI.js} +2 -2
  39. package/chunks/{suncalc-NOHGYHDU.js → suncalc-RM7URNUR.js} +2 -2
  40. package/chunks/{tree-RSHKDTCR.js → tree-FIUVGJ5J.js} +2 -2
  41. package/chunks/{vasana-engine-MU25OQ23.js → vasana-engine-W4PYWT5H.js} +5 -5
  42. package/gateway.js +38859 -30650
  43. package/package.json +1 -1
  44. package/pair-cli.js +2 -2
  45. package/chunks/chunk-U62ABYKD.js +0 -123
  46. package/chunks/chunk-UZ6OIVEC.js +0 -198
  47. package/chunks/graphrag-D7OXWAWD.js +0 -14
  48. package/chunks/hierarchical-temporal-search-PVHVA3NZ.js +0 -8
  49. package/chunks/hybrid-search-G2NAJKJ7.js +0 -20
  50. package/chunks/periodic-consolidation-LMYMNS4Q.js +0 -11
  51. package/chunks/postgres-WLH3D5HG.js +0 -8
  52. package/chunks/recall-ZNL4DJ2L.js +0 -21
  53. package/chunks/search-35JMSGUT.js +0 -19
@@ -10,6 +10,9 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
10
10
  if (typeof require !== "undefined") return require.apply(this, arguments);
11
11
  throw Error('Dynamic require of "' + x + '" is not supported');
12
12
  });
13
+ var __esm = (fn, res) => function __init() {
14
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
15
+ };
13
16
  var __commonJS = (cb, mod) => function __require2() {
14
17
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
15
18
  };
@@ -33,11 +36,14 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
33
36
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
34
37
  mod
35
38
  ));
39
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
36
40
 
37
41
  export {
38
42
  __require,
43
+ __esm,
39
44
  __commonJS,
40
45
  __export,
41
- __toESM
46
+ __toESM,
47
+ __toCommonJS
42
48
  };
43
- //# sourceMappingURL=chunk-IGKYKEKT.js.map
49
+ //# sourceMappingURL=chunk-NAQKA54E.js.map
@@ -2,17 +2,19 @@ import {
2
2
  EmbeddingService,
3
3
  cosineSimilarity,
4
4
  fallbackEmbedding
5
- } from "./chunk-JAWZ7ANC.js";
5
+ } from "./chunk-RVKTGKFD.js";
6
6
  import {
7
7
  SessionError,
8
- getChitraguptaHome
9
- } from "./chunk-UZ6OIVEC.js";
8
+ getChitraguptaHome,
9
+ init_dist
10
+ } from "./chunk-KVQH4LE7.js";
10
11
 
11
- // ../chitragupta/packages/smriti/src/day-consolidation.ts
12
+ // ../chitragupta/packages/smriti/dist/day-consolidation.js
13
+ init_dist();
12
14
  import fs2 from "fs";
13
15
  import path2 from "path";
14
16
 
15
- // ../chitragupta/packages/smriti/src/event-extractor-strategies.ts
17
+ // ../chitragupta/packages/smriti/dist/event-extractor-strategies.js
16
18
  var DOMAIN_EXTRACTOR_MAP = {
17
19
  planning: "discussion",
18
20
  learning: "discussion",
@@ -171,9 +173,7 @@ function extractFromDiscussionAssistant(turn, timestamp, sessionId, provider) {
171
173
  });
172
174
  }
173
175
  }
174
- const optionLines = lines.filter(
175
- (l) => /^(?:\d+\.|[-*]|\*\*Option|Option [A-C])/i.test(l.trim())
176
- );
176
+ const optionLines = lines.filter((l) => /^(?:\d+\.|[-*]|\*\*Option|Option [A-C])/i.test(l.trim()));
177
177
  if (optionLines.length >= 2) {
178
178
  const summary = optionLines.slice(0, 4).map((l) => l.trim().slice(0, 100)).join("; ");
179
179
  events.push({
@@ -204,7 +204,8 @@ function extractFromDiscussionAssistant(turn, timestamp, sessionId, provider) {
204
204
  }
205
205
  function extractTopic(content) {
206
206
  const firstLine = content.split("\n")[0].trim();
207
- if (firstLine.length < 5 || firstLine.length > 200) return null;
207
+ if (firstLine.length < 5 || firstLine.length > 200)
208
+ return null;
208
209
  const cleaned = firstLine.replace(/^(?:hey|hi|hello|ok|okay|so|well|please|pls|can you|could you)\s+/i, "").trim();
209
210
  return cleaned.length > 5 ? cleaned.slice(0, 100) : null;
210
211
  }
@@ -212,7 +213,8 @@ function deduplicateEvents(events) {
212
213
  const seen = /* @__PURE__ */ new Set();
213
214
  return events.filter((event) => {
214
215
  const key = `${event.type}:${event.summary.toLowerCase().replace(/[^\w\s]/g, "").trim().slice(0, 50)}`;
215
- if (seen.has(key)) return false;
216
+ if (seen.has(key))
217
+ return false;
216
218
  seen.add(key);
217
219
  return true;
218
220
  });
@@ -246,25 +248,31 @@ function generateNarrative(sessionType, events, meta, provider) {
246
248
  const errors = events.filter((e) => e.type === "error");
247
249
  const commits = events.filter((e) => e.type === "commit");
248
250
  const decisions = events.filter((e) => e.type === "decision");
249
- if (decisions.length > 0) parts.push(decisions[0].summary);
251
+ if (decisions.length > 0)
252
+ parts.push(decisions[0].summary);
250
253
  parts.push(`${actions.length} actions`);
251
- if (errors.length > 0) parts.push(`${errors.length} errors`);
252
- if (commits.length > 0) parts.push(`${commits.length} commits`);
254
+ if (errors.length > 0)
255
+ parts.push(`${errors.length} errors`);
256
+ if (commits.length > 0)
257
+ parts.push(`${commits.length} commits`);
253
258
  } else if (strategy === "discussion") {
254
259
  const topics = events.filter((e) => e.type === "topic");
255
260
  const decisions = events.filter((e) => e.type === "decision");
256
- if (topics.length > 0) parts.push(`Discussed: ${topics.map((t) => t.summary).slice(0, 3).join(", ")}`);
257
- if (decisions.length > 0) parts.push(`${decisions.length} decisions`);
261
+ if (topics.length > 0)
262
+ parts.push(`Discussed: ${topics.map((t) => t.summary).slice(0, 3).join(", ")}`);
263
+ if (decisions.length > 0)
264
+ parts.push(`${decisions.length} decisions`);
258
265
  } else if (strategy === "personal") {
259
266
  const facts = events.filter((e) => e.type === "fact" || e.type === "preference");
260
- if (facts.length > 0) parts.push(facts.map((f) => f.summary).join("; "));
267
+ if (facts.length > 0)
268
+ parts.push(facts.map((f) => f.summary).join("; "));
261
269
  } else {
262
270
  parts.push(`${events.length} events`);
263
271
  }
264
272
  return parts.join(" \u2014 ");
265
273
  }
266
274
 
267
- // ../chitragupta/packages/smriti/src/event-extractor.ts
275
+ // ../chitragupta/packages/smriti/dist/event-extractor.js
268
276
  var DOMAIN_SIGNALS = {
269
277
  planning: [
270
278
  /\b(?:plan for|roadmap|milestone|timeline|schedule|deadline|sprint|backlog|prioriti[sz]e)\b/i,
@@ -327,12 +335,14 @@ function scoreDomainSignals(turns) {
327
335
  groupsMatched++;
328
336
  }
329
337
  }
330
- if (groupsMatched > 0) scores.set(domain, groupsMatched);
338
+ if (groupsMatched > 0)
339
+ scores.set(domain, groupsMatched);
331
340
  }
332
341
  return scores;
333
342
  }
334
343
  function detectSessionType(turns) {
335
- if (turns.length === 0) return "personal";
344
+ if (turns.length === 0)
345
+ return "personal";
336
346
  let toolTurns = 0;
337
347
  let textTurns = 0;
338
348
  let totalUserLength = 0;
@@ -361,9 +371,11 @@ function detectSessionType(turns) {
361
371
  } else {
362
372
  coreType = "mixed";
363
373
  }
364
- if (coreType === "coding") return "coding";
374
+ if (coreType === "coding")
375
+ return "coding";
365
376
  const domainScores = scoreDomainSignals(turns);
366
- if (domainScores.size === 0) return coreType;
377
+ if (domainScores.size === 0)
378
+ return coreType;
367
379
  let topDomain = null;
368
380
  let topScore = 0;
369
381
  for (const [domain, score] of domainScores) {
@@ -426,7 +438,7 @@ function extractEventChain(meta, turns) {
426
438
  return { sessionType, events: deduped, narrative, topics, meta };
427
439
  }
428
440
 
429
- // ../chitragupta/packages/smriti/src/fact-extractor.ts
441
+ // ../chitragupta/packages/smriti/dist/fact-extractor.js
430
442
  var DEFAULT_CONFIG = {
431
443
  minConfidence: 0.5,
432
444
  useVectors: true,
@@ -525,7 +537,8 @@ var FactExtractor = class {
525
537
  * Initialize vector templates (lazy, on first use).
526
538
  */
527
539
  async ensureInitialized() {
528
- if (this.initialized) return;
540
+ if (this.initialized)
541
+ return;
529
542
  if (!this.config.useVectors) {
530
543
  this.initialized = true;
531
544
  return;
@@ -547,9 +560,12 @@ var FactExtractor = class {
547
560
  * Uses pattern matching first, then vector similarity for misses.
548
561
  */
549
562
  async extract(text) {
563
+ if (!shouldAnalyzeForFacts(text))
564
+ return [];
550
565
  await this.ensureInitialized();
551
566
  const facts = [];
552
- if (text.length < 5 || text.length > 5e3) return facts;
567
+ if (text.length < 5 || text.length > 5e3)
568
+ return facts;
553
569
  for (const rule of FACT_PATTERNS) {
554
570
  for (const pattern of rule.patterns) {
555
571
  const match = text.match(pattern);
@@ -568,13 +584,14 @@ var FactExtractor = class {
568
584
  }
569
585
  }
570
586
  }
571
- if (this.config.useVectors && facts.length === 0) {
587
+ if (this.config.useVectors && facts.length === 0 && shouldUseVectorFallback(text)) {
572
588
  const inputEmbedding = fallbackEmbedding(text.toLowerCase().slice(0, 200));
573
589
  let bestScore = 0;
574
590
  let bestTemplate = null;
575
591
  for (const tmpl of VECTOR_TEMPLATES) {
576
592
  const tmplEmbedding = this.templateEmbeddings.get(tmpl.template);
577
- if (!tmplEmbedding) continue;
593
+ if (!tmplEmbedding)
594
+ continue;
578
595
  const score = cosineSimilarity(inputEmbedding, tmplEmbedding);
579
596
  if (score > bestScore) {
580
597
  bestScore = score;
@@ -608,19 +625,24 @@ var FactExtractor = class {
608
625
  */
609
626
  async extractAndSave(text, scope, projectScope) {
610
627
  const facts = await this.extract(text);
611
- if (facts.length === 0) return [];
612
- const { appendMemory, getMemory } = await import("./memory-store-A6WOWLWC.js");
628
+ if (facts.length === 0)
629
+ return [];
630
+ const { appendMemory, getMemory } = await import("./memory-store-4GCBR2DZ.js");
613
631
  const globalScope = scope ?? { type: "global" };
614
632
  const existingMemory = getMemory(globalScope).toLowerCase();
633
+ const projectMemory = projectScope && projectScope.type !== "session" ? getMemory(projectScope).toLowerCase() : "";
615
634
  for (const fact of facts) {
616
635
  const dedupeKey = `${fact.category}:${fact.fact.toLowerCase().slice(0, 50)}`;
617
- if (this.recentFacts.has(dedupeKey)) continue;
618
- if (existingMemory.includes(fact.fact.toLowerCase().slice(0, 30))) continue;
636
+ if (this.recentFacts.has(dedupeKey))
637
+ continue;
638
+ const memoryNeedle = fact.fact.toLowerCase().slice(0, 40);
639
+ if (existingMemory.includes(memoryNeedle) || projectMemory.includes(memoryNeedle))
640
+ continue;
619
641
  const entry = `[${fact.category}] ${fact.fact}`;
620
642
  if (fact.category === "preference" && projectScope) {
621
- await appendMemory(projectScope, entry);
643
+ await appendMemory(projectScope, entry, { dedupe: true });
622
644
  } else {
623
- await appendMemory(globalScope, entry);
645
+ await appendMemory(globalScope, entry, { dedupe: true });
624
646
  }
625
647
  this.recentFacts.add(dedupeKey);
626
648
  }
@@ -636,9 +658,43 @@ var FactExtractor = class {
636
658
  }
637
659
  }
638
660
  };
661
+ var MIN_WORDS = {
662
+ identity: 1,
663
+ location: 1,
664
+ work: 1,
665
+ preference: 1,
666
+ relationship: 1,
667
+ instruction: 3,
668
+ personal: 1
669
+ };
670
+ var MIN_LENGTH = {
671
+ identity: 2,
672
+ location: 2,
673
+ work: 2,
674
+ preference: 3,
675
+ relationship: 2,
676
+ instruction: 10,
677
+ personal: 2
678
+ };
679
+ var NOISE_PATTERNS = [
680
+ /^(?:this|that|it|the|a|an|some|any|all)$/i,
681
+ /^(?:circular deps?|deps?|fix|bug|error|issue|test|build|run|check)$/i,
682
+ /^(?:file|folder|dir|path|module|package|import|export)$/i,
683
+ /^[a-z]$/i
684
+ ];
639
685
  function normalizeFact(category, raw) {
640
686
  const cleaned = raw.replace(/[.!?,;:]+$/, "").trim();
641
- if (cleaned.length < 2) return null;
687
+ if (cleaned.length < MIN_LENGTH[category])
688
+ return null;
689
+ const wordCount = cleaned.split(/\s+/).filter((w) => w.length > 0).length;
690
+ if (wordCount < MIN_WORDS[category])
691
+ return null;
692
+ if (wordCount <= 2) {
693
+ for (const noise of NOISE_PATTERNS) {
694
+ if (noise.test(cleaned))
695
+ return null;
696
+ }
697
+ }
642
698
  switch (category) {
643
699
  case "identity":
644
700
  return `Name: ${capitalize(cleaned)}`;
@@ -661,6 +717,32 @@ function normalizeFact(category, raw) {
661
717
  function capitalize(s) {
662
718
  return s.charAt(0).toUpperCase() + s.slice(1);
663
719
  }
720
+ function shouldAnalyzeForFacts(text) {
721
+ const trimmed = text.trim();
722
+ if (trimmed.length < 8 || trimmed.length > 5e3)
723
+ return false;
724
+ const lower = trimmed.toLowerCase();
725
+ if (/^\/[a-z0-9_-]+/i.test(lower))
726
+ return false;
727
+ if (/^(hi|hii|hello|hey|yo|thanks|thank you|ok|okay|cool|fine|namaste|namaskaram)\b/.test(lower) && trimmed.length < 64) {
728
+ return false;
729
+ }
730
+ const hasMemorySignal = /\b(remember|don't forget|note this|save this|from now on|always|call me|my name is|i am|i'm|i live|i work|i prefer|we use|our stack)\b/i.test(lower);
731
+ const hasFirstPerson = /\b(i|i'm|i am|my|we|our)\b/i.test(lower);
732
+ const hasPatternCue = /\b(based in|living in|located in|never use|don't use|avoid|keep in mind|note that|remember that)\b/i.test(lower);
733
+ const isQuestion = /\?\s*$/.test(lower);
734
+ if (isQuestion && !hasMemorySignal)
735
+ return false;
736
+ return hasMemorySignal || hasFirstPerson || hasPatternCue;
737
+ }
738
+ function shouldUseVectorFallback(text) {
739
+ const lower = text.toLowerCase();
740
+ if (!shouldAnalyzeForFacts(text))
741
+ return false;
742
+ if (/^\s*(which|what|when|where|why|how)\b/.test(lower) && /\?\s*$/.test(lower))
743
+ return false;
744
+ return true;
745
+ }
664
746
  var _instance = null;
665
747
  function getFactExtractor(config) {
666
748
  if (!_instance) {
@@ -669,7 +751,7 @@ function getFactExtractor(config) {
669
751
  return _instance;
670
752
  }
671
753
 
672
- // ../chitragupta/packages/smriti/src/day-consolidation-renderer.ts
754
+ // ../chitragupta/packages/smriti/dist/day-consolidation-renderer.js
673
755
  function generateDayMarkdown(date, projectMap, sessionCount, totalTurns, facts) {
674
756
  const lines = [];
675
757
  const dayName = (/* @__PURE__ */ new Date(`${date}T12:00:00Z`)).toLocaleDateString("en-US", { weekday: "long" });
@@ -697,7 +779,8 @@ function renderProjectSection(lines, activity) {
697
779
  lines.push(`## Project: ${activity.project}`);
698
780
  lines.push("");
699
781
  const meta = [];
700
- if (activity.branch) meta.push(`**Branch**: ${activity.branch}`);
782
+ if (activity.branch)
783
+ meta.push(`**Branch**: ${activity.branch}`);
701
784
  meta.push(`**Providers**: ${[...activity.providers].join(", ")}`);
702
785
  meta.push(`**Sessions**: ${activity.sessions.length}`);
703
786
  if (activity.filesModified.size > 0) {
@@ -736,9 +819,7 @@ function renderSessionSection(lines, session, chain, activity) {
736
819
  lines.push(`**Topics**: ${chain.topics.slice(0, 5).join(", ")}`);
737
820
  lines.push("");
738
821
  }
739
- const keyEvents = chain.events.filter(
740
- (e) => e.type === "decision" || e.type === "error" || e.type === "commit" || e.type === "fact" || e.type === "preference"
741
- );
822
+ const keyEvents = chain.events.filter((e) => e.type === "decision" || e.type === "error" || e.type === "commit" || e.type === "fact" || e.type === "preference");
742
823
  if (keyEvents.length > 0) {
743
824
  for (const event of keyEvents.slice(0, 10)) {
744
825
  const icon = eventIcon(event.type);
@@ -791,30 +872,35 @@ function eventIcon(type) {
791
872
  }
792
873
  }
793
874
 
794
- // ../chitragupta/packages/smriti/src/day-consolidation-query.ts
875
+ // ../chitragupta/packages/smriti/dist/day-consolidation-query.js
795
876
  import fs from "fs";
796
877
  import path from "path";
797
878
  function readDayFile(date) {
798
879
  const dayPath = getDayFilePath(date);
799
- if (!fs.existsSync(dayPath)) return null;
880
+ if (!fs.existsSync(dayPath))
881
+ return null;
800
882
  return fs.readFileSync(dayPath, "utf-8");
801
883
  }
802
884
  function listDayFiles() {
803
885
  const daysRoot = getDaysRoot();
804
- if (!fs.existsSync(daysRoot)) return [];
886
+ if (!fs.existsSync(daysRoot))
887
+ return [];
805
888
  const dates = [];
806
889
  try {
807
890
  const years = fs.readdirSync(daysRoot, { withFileTypes: true });
808
891
  for (const year of years) {
809
- if (!year.isDirectory()) continue;
892
+ if (!year.isDirectory())
893
+ continue;
810
894
  const yearPath = path.join(daysRoot, year.name);
811
895
  const months = fs.readdirSync(yearPath, { withFileTypes: true });
812
896
  for (const month of months) {
813
- if (!month.isDirectory()) continue;
897
+ if (!month.isDirectory())
898
+ continue;
814
899
  const monthPath = path.join(yearPath, month.name);
815
900
  const days = fs.readdirSync(monthPath);
816
901
  for (const day of days) {
817
- if (!day.endsWith(".md")) continue;
902
+ if (!day.endsWith(".md"))
903
+ continue;
818
904
  const dd = day.replace(".md", "");
819
905
  dates.push(`${year.name}-${month.name}-${dd}`);
820
906
  }
@@ -830,9 +916,11 @@ function searchDayFiles(query, options) {
830
916
  const results = [];
831
917
  const queryLower = query.toLowerCase();
832
918
  for (const date of dates) {
833
- if (results.length >= limit) break;
919
+ if (results.length >= limit)
920
+ break;
834
921
  const content = readDayFile(date);
835
- if (!content) continue;
922
+ if (!content)
923
+ continue;
836
924
  const lines = content.split("\n");
837
925
  const matches = [];
838
926
  for (let i = 0; i < lines.length; i++) {
@@ -850,11 +938,12 @@ function isDayConsolidated(date) {
850
938
  return fs.existsSync(getDayFilePath(date));
851
939
  }
852
940
  async function getUnconsolidatedDates(limit) {
853
- const { listSessionDates } = await import("./session-store-3BRPGC6P.js");
941
+ const { listSessionDates } = await import("./session-store-3EDQZEDS.js");
854
942
  const sessionDates = listSessionDates();
855
943
  const unconsolidated = [];
856
944
  for (const date of sessionDates) {
857
- if (unconsolidated.length >= (limit ?? 30)) break;
945
+ if (unconsolidated.length >= (limit ?? 30))
946
+ break;
858
947
  if (!isDayConsolidated(date)) {
859
948
  unconsolidated.push(date);
860
949
  }
@@ -862,13 +951,14 @@ async function getUnconsolidatedDates(limit) {
862
951
  return unconsolidated;
863
952
  }
864
953
 
865
- // ../chitragupta/packages/smriti/src/day-consolidation.ts
954
+ // ../chitragupta/packages/smriti/dist/day-consolidation.js
866
955
  function getDaysRoot() {
867
956
  return path2.join(getChitraguptaHome(), "days");
868
957
  }
869
958
  function getDayFilePath(date) {
870
959
  const match = date.match(/^(\d{4})-(\d{2})-(\d{2})$/);
871
- if (!match) throw new SessionError(`Invalid date: ${date}. Expected YYYY-MM-DD.`);
960
+ if (!match)
961
+ throw new SessionError(`Invalid date: ${date}. Expected YYYY-MM-DD.`);
872
962
  return path2.join(getDaysRoot(), match[1], match[2], `${match[3]}.md`);
873
963
  }
874
964
  async function consolidateDay(date, options) {
@@ -891,7 +981,7 @@ async function consolidateDay(date, options) {
891
981
  if (options?.loadSessions) {
892
982
  sessions = await options.loadSessions(date);
893
983
  } else {
894
- const { listSessionsByDate, listTurnsWithTimestamps, loadSession } = await import("./session-store-3BRPGC6P.js");
984
+ const { listSessionsByDate, listTurnsWithTimestamps, loadSession } = await import("./session-store-3EDQZEDS.js");
895
985
  const metas = listSessionsByDate(date);
896
986
  sessions = metas.map((meta) => {
897
987
  try {
@@ -944,7 +1034,8 @@ async function consolidateDay(date, options) {
944
1034
  activity.sessions.push(meta);
945
1035
  const provider = meta.metadata?.provider ?? meta.agent ?? "unknown";
946
1036
  activity.providers.add(provider);
947
- if (meta.branch) activity.branch = meta.branch;
1037
+ if (meta.branch)
1038
+ activity.branch = meta.branch;
948
1039
  const eventChain = extractEventChain(meta, turns);
949
1040
  activity.eventChains.push(eventChain);
950
1041
  for (const turn of turns) {
@@ -966,7 +1057,7 @@ async function consolidateDay(date, options) {
966
1057
  fs2.mkdirSync(dir, { recursive: true });
967
1058
  fs2.writeFileSync(dayPath, markdown, "utf-8");
968
1059
  try {
969
- const { indexConsolidationSummary } = await import("./consolidation-indexer-VKQ6DNU3.js");
1060
+ const { indexConsolidationSummary } = await import("./consolidation-indexer-KPXORCJ4.js");
970
1061
  await indexConsolidationSummary("daily", date, markdown);
971
1062
  } catch {
972
1063
  }
@@ -987,8 +1078,10 @@ async function extractFactsWithEngine(sessions) {
987
1078
  const extractor = new FactExtractor({ useVectors: true });
988
1079
  for (const { turns } of sessions) {
989
1080
  for (const turn of turns) {
990
- if (turn.role !== "user") continue;
991
- if (turn.content.length < 5 || turn.content.length > 5e3) continue;
1081
+ if (turn.role !== "user")
1082
+ continue;
1083
+ if (turn.content.length < 5 || turn.content.length > 5e3)
1084
+ continue;
992
1085
  const extracted = await extractor.extract(turn.content);
993
1086
  for (const fact of extracted) {
994
1087
  const key = fact.fact.toLowerCase().slice(0, 50);
@@ -1016,7 +1109,8 @@ function extractFactsFallback(sessions) {
1016
1109
  ];
1017
1110
  for (const { turns } of sessions) {
1018
1111
  for (const turn of turns) {
1019
- if (turn.role !== "user") continue;
1112
+ if (turn.role !== "user")
1113
+ continue;
1020
1114
  for (const pattern of factPatterns) {
1021
1115
  const match = turn.content.match(pattern);
1022
1116
  if (match) {
@@ -1045,4 +1139,4 @@ export {
1045
1139
  getDayFilePath,
1046
1140
  consolidateDay
1047
1141
  };
1048
- //# sourceMappingURL=chunk-77725AR7.js.map
1142
+ //# sourceMappingURL=chunk-PZ4AQ22L.js.map
@@ -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 providerId = prefs.providerId ?? existing?.providerId ?? null;
507
- const model = prefs.model ?? existing?.model ?? null;
508
- const system = prefs.system ?? existing?.system ?? null;
509
- const autoRouting = prefs.autoRouting ?? existing?.autoRouting ?? null;
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-C76USAC5.js.map
1511
+ //# sourceMappingURL=chunk-QFGAB4XD.js.map