ruvector 0.1.66 → 0.1.68

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.
@@ -121,5 +121,14 @@
121
121
  "rewardHistory": [
122
122
  1
123
123
  ]
124
- }
124
+ },
125
+ "stats": {
126
+ "total_patterns": 0,
127
+ "total_memories": 0,
128
+ "total_trajectories": 0,
129
+ "total_errors": 0,
130
+ "session_count": 1,
131
+ "last_session": 1767194227
132
+ },
133
+ "trajectories": []
125
134
  }
package/bin/cli.js CHANGED
@@ -2609,17 +2609,37 @@ class Intelligence {
2609
2609
  }
2610
2610
 
2611
2611
  sessionEnd() {
2612
- const duration = this.now() - (this.sessionStartTime || this.data.stats.last_session);
2613
- const actions = this.data.trajectories.filter(t => t.timestamp >= this.data.stats.last_session).length;
2612
+ // Ensure data structure exists with defaults
2613
+ if (!this.data) {
2614
+ this.data = { patterns: {}, memories: [], trajectories: [], errors: [], agents: {}, edges: [], stats: {} };
2615
+ }
2616
+ if (!this.data.stats) {
2617
+ this.data.stats = { total_patterns: 0, total_memories: 0, total_trajectories: 0, total_errors: 0, session_count: 0, last_session: 0 };
2618
+ }
2619
+ if (!this.data.trajectories) {
2620
+ this.data.trajectories = [];
2621
+ }
2622
+
2623
+ const lastSession = this.data.stats.last_session || 0;
2624
+ const duration = this.now() - (this.sessionStartTime || lastSession);
2625
+ const actions = this.data.trajectories.filter(t => t && t.timestamp >= lastSession).length;
2614
2626
 
2615
2627
  // Force learning cycle (only if engine already initialized)
2616
- const eng = this.getEngineIfReady();
2617
- if (eng) {
2618
- eng.forceLearn();
2628
+ try {
2629
+ const eng = this.getEngineIfReady();
2630
+ if (eng) {
2631
+ eng.forceLearn();
2632
+ }
2633
+ } catch (e) {
2634
+ // Ignore engine errors on session end
2619
2635
  }
2620
2636
 
2621
2637
  // Save all data
2622
- this.save();
2638
+ try {
2639
+ this.save();
2640
+ } catch (e) {
2641
+ // Ignore save errors on session end
2642
+ }
2623
2643
 
2624
2644
  return { duration, actions };
2625
2645
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ruvector",
3
- "version": "0.1.66",
3
+ "version": "0.1.68",
4
4
  "description": "High-performance vector database for Node.js with automatic native/WASM fallback",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/ruvector.db CHANGED
Binary file