@nxuss/lemma 0.4.4 → 0.4.5

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 (2) hide show
  1. package/lemma-proxy.cjs +72 -5
  2. package/package.json +1 -1
package/lemma-proxy.cjs CHANGED
@@ -93,6 +93,31 @@ function getPidByPort(port) {
93
93
  return null;
94
94
  }
95
95
 
96
+ async function checkDependency(url) {
97
+ try {
98
+ const res = await axios.get(url, { timeout: 1000, validateStatus: () => true });
99
+ return res.status >= 200 && res.status < 500;
100
+ } catch { return false; }
101
+ }
102
+
103
+ function ensureGitIgnore() {
104
+ const gi = path.join(process.cwd(), '.gitignore');
105
+ const line = '.lemma/';
106
+ try {
107
+ if (fs.existsSync(gi)) {
108
+ const content = fs.readFileSync(gi, 'utf8');
109
+ if (!content.includes(line)) {
110
+ fs.appendFileSync(gi, `\n# Lemma Context Logs\n${line}\n`);
111
+ return true;
112
+ }
113
+ } else {
114
+ fs.writeFileSync(gi, `# Lemma Context Logs\n${line}\n`);
115
+ return true;
116
+ }
117
+ } catch {}
118
+ return false;
119
+ }
120
+
96
121
  // ── License helpers ────────────────────────────────────────────────────────────
97
122
  function loadLicense() {
98
123
  return readJson(LICENSE_FILE, { isPro: false });
@@ -489,10 +514,38 @@ class LemmaServer {
489
514
  }
490
515
  throw e;
491
516
  });
492
- server.listen(this.port, () => {
517
+ server.listen(this.port, async () => {
493
518
  fs.writeFileSync(PID_FILE, String(process.pid));
494
519
  fs.writeFileSync(PORT_FILE, String(this.port));
495
- console.log(`\n🚀 Lemma Proxy v${VERSION}\n📁 Project : ${this.projectName}\n🔌 Port : ${this.port}\n`);
520
+
521
+ const pro = isPro();
522
+ console.log(`\n🚀 Lemma Proxy v${VERSION} — ${pro ? 'PRO' : 'STANDARD'}`);
523
+ console.log(`📁 Project : ${this.projectName}\n🔌 Port : ${this.port}`);
524
+
525
+ console.log('\n🧠 Intelligence Report');
526
+ console.log('────────────────────────────────────────────────');
527
+ console.log(`🔒 Privacy Firewall : \x1b[32m[ACTIVE]\x1b[0m`);
528
+ console.log(`🔀 Complexity Router : \x1b[32m[ACTIVE]\x1b[0m`);
529
+ console.log(`💾 Exact Cache : \x1b[32m[ACTIVE]\x1b[0m`);
530
+
531
+ const ollamaOk = await checkDependency('http://localhost:11434/api/tags');
532
+ const chromaOk = await checkDependency('http://localhost:8000/'); // Basic check for Chroma
533
+
534
+ if (pro) {
535
+ console.log(`🎯 Semantic Cache : ${ollamaOk && chromaOk ? '\x1b[32m[ACTIVE]\x1b[0m' : '\x1b[33m[OFFLINE - Check Ollama/Chroma]\x1b[0m'}`);
536
+ console.log(`🌐 Hive Mind (Cloud) : \x1b[32m[ACTIVE]\x1b[0m`);
537
+ } else {
538
+ console.log(`🎯 Semantic Cache : \x1b[90m[PRO ONLY]\x1b[0m -> https://lemma.nxus.studio/upgrade`);
539
+ console.log(`🌐 Hive Mind (Cloud) : \x1b[90m[PRO ONLY]\x1b[0m -> https://lemma.nxus.studio/upgrade`);
540
+ }
541
+
542
+ const hasStackDir = fs.existsSync(path.join(process.cwd(), '.lemma'));
543
+ console.log(`📡 Telepathic Sync : ${hasStackDir ? '\x1b[32m[READY]\x1b[0m' : '\x1b[90m[DISABLED - Run "lemma init"]\x1b[0m'}`);
544
+ console.log('────────────────────────────────────────────────\n');
545
+
546
+ if (!pro) {
547
+ console.log('\x1b[36m💡 Unlock Semantic Search & Team Caching at https://lemma.nxus.studio/upgrade\x1b[0m\n');
548
+ }
496
549
  });
497
550
  process.on('SIGTERM', () => server.close());
498
551
  }
@@ -657,15 +710,28 @@ program.command('init')
657
710
  .description('Initialize Lemma in the current project (auto-discovery)')
658
711
  .action(() => {
659
712
  const project = detectProject();
660
- console.log(`🛠️ Initializing Lemma for [${project}]...`);
713
+ console.log(`\n🛠️ Initializing Lemma for [${project}]...`);
661
714
 
715
+ // 1. Create .lemma directory
716
+ const lemmaDir = path.join(process.cwd(), '.lemma');
717
+ if (!fs.existsSync(lemmaDir)) {
718
+ fs.mkdirSync(lemmaDir, { recursive: true });
719
+ console.log('✅ Created .lemma directory (Telepathic Sync enabled)');
720
+ }
721
+
722
+ // 2. Update .gitignore
723
+ if (ensureGitIgnore()) {
724
+ console.log('✅ Added .lemma/ to .gitignore');
725
+ }
726
+
727
+ // 3. Update .env
662
728
  const envFile = path.join(process.cwd(), '.env');
663
729
  const lemmaConfig = `\n# Lemma AI Gateway Configuration\nOPENAI_BASE_URL=http://localhost:8081/v1\nLEMMA_PROJECT=${project}\n`;
664
730
 
665
731
  if (fs.existsSync(envFile)) {
666
732
  const content = fs.readFileSync(envFile, 'utf8');
667
733
  if (content.includes('OPENAI_BASE_URL')) {
668
- console.log('⚠️ OPENAI_BASE_URL already exists in .env. Please update it manually to: http://localhost:8081/v1');
734
+ console.log('⚠️ OPENAI_BASE_URL already exists in .env. Update it to: http://localhost:8081/v1');
669
735
  } else {
670
736
  fs.appendFileSync(envFile, lemmaConfig);
671
737
  console.log('✅ Added Lemma configuration to .env');
@@ -675,7 +741,8 @@ program.command('init')
675
741
  console.log('✅ Created .env with Lemma configuration');
676
742
  }
677
743
 
678
- console.log('\n🚀 Done! Run "lemma start" to begin.');
744
+ console.log('\n Project initialized for the Agentic Era!');
745
+ console.log('🚀 Run "lemma start" to begin.\n');
679
746
  });
680
747
 
681
748
  program.parse(process.argv);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxuss/lemma",
3
- "version": "0.4.4",
3
+ "version": "0.4.5",
4
4
  "description": "Intelligent AI Gateway — Semantic cache, Privacy Firewall, and Autonomous Cost-Optimization for AI Agents.",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",