ruvector 0.1.68 → 0.1.69

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.
@@ -127,8 +127,8 @@
127
127
  "total_memories": 0,
128
128
  "total_trajectories": 0,
129
129
  "total_errors": 0,
130
- "session_count": 1,
131
- "last_session": 1767194227
130
+ "session_count": 2,
131
+ "last_session": 1767194641
132
132
  },
133
133
  "trajectories": []
134
134
  }
package/bin/cli.js CHANGED
@@ -2634,6 +2634,25 @@ class Intelligence {
2634
2634
  // Ignore engine errors on session end
2635
2635
  }
2636
2636
 
2637
+ // Auto-compress patterns if enabled (v2.1)
2638
+ try {
2639
+ if (process.env.RUVECTOR_AUTO_COMPRESS === 'true' || process.env.RUVECTOR_TENSOR_COMPRESS === 'true') {
2640
+ const TensorCompressClass = require('../dist/core/tensor-compress').default;
2641
+ if (TensorCompressClass && this.data.compressedPatterns) {
2642
+ const compress = new TensorCompressClass({ autoCompress: false });
2643
+ compress.import(this.data.compressedPatterns);
2644
+ const stats = compress.recompressAll();
2645
+ this.data.compressedPatterns = compress.export();
2646
+ // Only log if significant savings
2647
+ if (stats.savingsPercent > 10 && stats.totalTensors > 5) {
2648
+ // Silently compress, no console output to avoid hook noise
2649
+ }
2650
+ }
2651
+ }
2652
+ } catch (e) {
2653
+ // Ignore compression errors on session end
2654
+ }
2655
+
2637
2656
  // Save all data
2638
2657
  try {
2639
2658
  this.save();
@@ -2749,11 +2768,23 @@ hooksCmd.command('init')
2749
2768
  // Environment variables for intelligence (unless --minimal or --no-env)
2750
2769
  if (!opts.minimal && opts.env !== false) {
2751
2770
  settings.env = settings.env || {};
2771
+ // Core intelligence settings
2752
2772
  settings.env.RUVECTOR_INTELLIGENCE_ENABLED = settings.env.RUVECTOR_INTELLIGENCE_ENABLED || 'true';
2753
2773
  settings.env.RUVECTOR_LEARNING_RATE = settings.env.RUVECTOR_LEARNING_RATE || '0.1';
2754
2774
  settings.env.RUVECTOR_MEMORY_BACKEND = settings.env.RUVECTOR_MEMORY_BACKEND || 'rvlite';
2755
2775
  settings.env.INTELLIGENCE_MODE = settings.env.INTELLIGENCE_MODE || 'treatment';
2756
- console.log(chalk.blue(' ✓ Environment variables configured'));
2776
+ // v2.0 capabilities
2777
+ settings.env.RUVECTOR_AST_ENABLED = settings.env.RUVECTOR_AST_ENABLED || 'true';
2778
+ settings.env.RUVECTOR_DIFF_EMBEDDINGS = settings.env.RUVECTOR_DIFF_EMBEDDINGS || 'true';
2779
+ settings.env.RUVECTOR_COVERAGE_ROUTING = settings.env.RUVECTOR_COVERAGE_ROUTING || 'true';
2780
+ settings.env.RUVECTOR_GRAPH_ALGORITHMS = settings.env.RUVECTOR_GRAPH_ALGORITHMS || 'true';
2781
+ settings.env.RUVECTOR_SECURITY_SCAN = settings.env.RUVECTOR_SECURITY_SCAN || 'true';
2782
+ // v2.1 learning & compression
2783
+ settings.env.RUVECTOR_MULTI_ALGORITHM = settings.env.RUVECTOR_MULTI_ALGORITHM || 'true';
2784
+ settings.env.RUVECTOR_DEFAULT_ALGORITHM = settings.env.RUVECTOR_DEFAULT_ALGORITHM || 'double-q';
2785
+ settings.env.RUVECTOR_TENSOR_COMPRESS = settings.env.RUVECTOR_TENSOR_COMPRESS || 'true';
2786
+ settings.env.RUVECTOR_AUTO_COMPRESS = settings.env.RUVECTOR_AUTO_COMPRESS || 'true';
2787
+ console.log(chalk.blue(' ✓ Environment variables configured (v2.1 with multi-algorithm learning)'));
2757
2788
  }
2758
2789
 
2759
2790
  // Permissions based on detected project type (unless --minimal or --no-permissions)
@@ -5107,10 +5138,98 @@ hooksCmd.command('pretrain')
5107
5138
  console.log(chalk.yellow(` ⚠ Graph analysis skipped: ${e.message}`));
5108
5139
  }
5109
5140
 
5141
+ // Phase 10: Initialize multi-algorithm learning engine
5142
+ console.log(chalk.yellow('\n🎯 Phase 10: Initializing multi-algorithm learning engine...\n'));
5143
+
5144
+ try {
5145
+ if (loadLearningModules() && LearningEngineClass) {
5146
+ const engine = new LearningEngineClass();
5147
+
5148
+ // Configure optimal algorithms for each task type based on repo analysis
5149
+ engine.configure('agent-routing', { algorithm: 'double-q', learningRate: 0.1, epsilon: 0.1 });
5150
+ engine.configure('error-avoidance', { algorithm: 'sarsa', learningRate: 0.05, epsilon: 0.05 });
5151
+ engine.configure('confidence-scoring', { algorithm: 'actor-critic', learningRate: 0.01 });
5152
+ engine.configure('trajectory-learning', { algorithm: 'decision-transformer', sequenceLength: 20 });
5153
+ engine.configure('context-ranking', { algorithm: 'ppo', clipRange: 0.2 });
5154
+ engine.configure('memory-recall', { algorithm: 'td-lambda', lambda: 0.8 });
5155
+
5156
+ // Bootstrap with initial experiences from file patterns
5157
+ let bootstrapCount = 0;
5158
+ for (const [state, actions] of Object.entries(intel.data.patterns || {})) {
5159
+ for (const [action, value] of Object.entries(actions)) {
5160
+ if (value > 0.3) { // Only strong patterns
5161
+ engine.update('agent-routing', {
5162
+ state,
5163
+ action,
5164
+ reward: value,
5165
+ nextState: state,
5166
+ done: true
5167
+ });
5168
+ bootstrapCount++;
5169
+ }
5170
+ }
5171
+ }
5172
+
5173
+ intel.data.learning = engine.export();
5174
+ stats.learningBootstrap = bootstrapCount;
5175
+ console.log(chalk.green(` ✓ Configured 6 task-specific algorithms`));
5176
+ console.log(chalk.green(` ✓ Bootstrapped with ${bootstrapCount} initial experiences`));
5177
+ console.log(chalk.dim(' Algorithms: double-q, sarsa, actor-critic, decision-transformer, ppo, td-lambda'));
5178
+ } else {
5179
+ console.log(chalk.dim(' ⏭️ LearningEngine not available'));
5180
+ }
5181
+ } catch (e) {
5182
+ console.log(chalk.yellow(` ⚠ Learning engine init skipped: ${e.message}`));
5183
+ }
5184
+
5185
+ // Phase 11: Initialize TensorCompress for pattern storage
5186
+ console.log(chalk.yellow('\n📦 Phase 11: Initializing TensorCompress for efficient storage...\n'));
5187
+
5188
+ try {
5189
+ if (loadLearningModules() && TensorCompressClass) {
5190
+ const compress = new TensorCompressClass({
5191
+ autoCompress: false,
5192
+ hotThreshold: 0.8,
5193
+ warmThreshold: 0.4,
5194
+ coolThreshold: 0.1,
5195
+ coldThreshold: 0.01
5196
+ });
5197
+
5198
+ // Store any existing embeddings with compression
5199
+ let compressed = 0;
5200
+ if (intel.data.memories) {
5201
+ for (let i = 0; i < intel.data.memories.length; i++) {
5202
+ const mem = intel.data.memories[i];
5203
+ if (mem.embedding && Array.isArray(mem.embedding)) {
5204
+ compress.store(`memory_${i}`, mem.embedding, 'pq8');
5205
+ compressed++;
5206
+ }
5207
+ }
5208
+ }
5209
+
5210
+ if (compressed > 0) {
5211
+ const compStats = compress.recompressAll();
5212
+ intel.data.compressedPatterns = compress.export();
5213
+ stats.compressed = compressed;
5214
+ stats.compressionSavings = compStats.savingsPercent;
5215
+ console.log(chalk.green(` ✓ Compressed ${compressed} embeddings`));
5216
+ console.log(chalk.green(` ✓ Memory savings: ${compStats.savingsPercent.toFixed(1)}%`));
5217
+ } else {
5218
+ intel.data.compressedPatterns = compress.export();
5219
+ console.log(chalk.green(` ✓ TensorCompress initialized (ready for future embeddings)`));
5220
+ }
5221
+ console.log(chalk.dim(' Levels: none (hot), half (warm), pq8 (cool), pq4 (cold), binary (archive)'));
5222
+ } else {
5223
+ console.log(chalk.dim(' ⏭️ TensorCompress not available'));
5224
+ }
5225
+ } catch (e) {
5226
+ console.log(chalk.yellow(` ⚠ TensorCompress init skipped: ${e.message}`));
5227
+ }
5228
+
5110
5229
  // Save all learning data
5111
5230
  intel.data.pretrained = {
5112
5231
  date: new Date().toISOString(),
5113
- version: '2.0',
5232
+ version: '2.1',
5114
5233
  stats: stats
5115
5234
  };
5116
5235
  intel.save();
@@ -5127,6 +5246,8 @@ hooksCmd.command('pretrain')
5127
5246
  if (stats.coverage) console.log(` 🧪 Coverage: ${stats.coverage.lines.toFixed(1)}% lines`);
5128
5247
  if (stats.neural?.attention) console.log(` 🧠 10 attention mechanisms available`);
5129
5248
  if (stats.graph) console.log(` 🔗 ${stats.graph.communities} code communities detected`);
5249
+ if (stats.learningBootstrap) console.log(` 🎯 ${stats.learningBootstrap} learning experiences bootstrapped`);
5250
+ if (stats.compressionSavings) console.log(` 📦 ${stats.compressionSavings.toFixed(1)}% compression savings`);
5130
5251
  console.log(chalk.dim('\nThe intelligence layer will now provide better recommendations.'));
5131
5252
  });
5132
5253
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ruvector",
3
- "version": "0.1.68",
3
+ "version": "0.1.69",
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",