@nxuss/lemma 0.4.4 → 0.4.6
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/README.md +28 -34
- package/lemma-proxy.cjs +72 -5
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,51 +1,55 @@
|
|
|
1
|
-
# Lemma v0.4.
|
|
1
|
+
# Lemma v0.4.5
|
|
2
2
|
> **The Intelligent AI Gateway — Privacy, Performance, and Precision for the Agentic Era.**
|
|
3
3
|
|
|
4
|
-
Lemma is a high-performance orchestration layer that sits between your development environment and LLM providers. It transforms the way you build with AI by providing **Shared Semantic Memory**, **Autonomous Cost Optimization**, and **
|
|
4
|
+
Lemma is a high-performance orchestration layer that sits between your development environment and LLM providers. It transforms the way you build with AI by providing **Shared Semantic Memory**, **Autonomous Cost Optimization**, and **Privacy Guardrails**.
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
## ⚡ Killer Features
|
|
9
9
|
|
|
10
10
|
### 🛡️ Privacy Firewall (Semantic Scrubber)
|
|
11
|
-
**Zero-Trust Prompts.** Stop leaking sensitive data. Lemma automatically detects API keys, PII, and credentials in your prompts, masking them with secure tokens before they reach the cloud. Responses are seamlessly reconstructed locally
|
|
11
|
+
**Zero-Trust Prompts.** Stop leaking sensitive data. Lemma automatically detects API keys, PII, and credentials in your prompts, masking them with secure tokens before they reach the cloud. Responses are seamlessly reconstructed locally.
|
|
12
12
|
|
|
13
13
|
### 🚦 Complexity Router (Cost-Optimizer)
|
|
14
|
-
**Intelligence Where it Matters.** Lemma analyzes the semantic complexity of every request. It autonomously routes lightweight tasks
|
|
14
|
+
**Intelligence Where it Matters.** Lemma analyzes the semantic complexity of every request. It autonomously routes lightweight tasks to hyper-efficient models like `gpt-4o-mini`, reserving premium models for high-reasoning challenges. Save up to 90% on simple tasks.
|
|
15
15
|
|
|
16
16
|
### 🧠 Telepathic Context Injector (Runtime Sync)
|
|
17
|
-
**Bridge the Gap Between Code and Execution.** Lemma synchronizes your application's live runtime state
|
|
17
|
+
**Bridge the Gap Between Code and Execution.** Lemma synchronizes your application's live runtime state and exceptions directly with your IDE’s consciousness. Your AI assistant gains immediate "situational awareness" of crashes.
|
|
18
18
|
|
|
19
19
|
### ⚡ Shared Semantic Cache
|
|
20
|
-
**Stop Paying for the Same Thought Twice.**
|
|
20
|
+
**Stop Paying for the Same Thought Twice.** Lemma understands meaning. It recognizes similar prompts and returns instant (3ms) responses, saving 40-70% on total API expenditure.
|
|
21
21
|
|
|
22
22
|
---
|
|
23
23
|
|
|
24
|
-
## 🚀
|
|
24
|
+
## 🚀 Smart CLI (Zero-Config)
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
Lemma v0.4.5 introduces the **Smart CLI**, making it easier than ever to get started:
|
|
27
27
|
|
|
28
28
|
```bash
|
|
29
|
+
# 1. Install
|
|
29
30
|
npm install -g @nxuss/lemma
|
|
30
|
-
|
|
31
|
+
|
|
32
|
+
# 2. Initialize (Auto-configures .env and .lemma/)
|
|
33
|
+
lemma init
|
|
34
|
+
|
|
35
|
+
# 3. Start with Intelligence Report
|
|
36
|
+
lemma start
|
|
31
37
|
```
|
|
32
38
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
* **Gemini Base:** `http://localhost:8085/v1beta`
|
|
36
|
-
* **Dashboard:** `http://localhost:3000`
|
|
39
|
+
### 🧠 Intelligence Report
|
|
40
|
+
On startup, Lemma performs a **System Check** to detect dependencies like Ollama and ChromaDB, providing a real-time report of active features and optimizations.
|
|
37
41
|
|
|
38
42
|
---
|
|
39
43
|
|
|
40
44
|
## 💎 Tier Comparison
|
|
41
45
|
|
|
42
|
-
| Feature | 🆓 Free (
|
|
46
|
+
| Feature | 🆓 Free (Standard) | 💎 Pro ($12/mo) |
|
|
43
47
|
| :--- | :--- | :--- |
|
|
48
|
+
| **Privacy Firewall** | ✅ Included | ✅ Advanced Masking |
|
|
49
|
+
| **Complexity Router** | ✅ Included | ✅ Custom Routing Policies |
|
|
44
50
|
| **Caching** | Exact Match | **Semantic Memory (ChromaDB)** |
|
|
45
|
-
| **
|
|
46
|
-
| **
|
|
47
|
-
| **IDE Sync** | Raw Log Stream | **Telepathic Context Injector** |
|
|
48
|
-
| **Continuity** | Local Only | **Cloud Sync (Team Memory)** |
|
|
51
|
+
| **Hive Mind** | Local Only | **Cloud Sync (Team Memory)** |
|
|
52
|
+
| **Telepathy** | Basic Sync | **Advanced State Injection** |
|
|
49
53
|
| **Limits** | 300 requests/mo | **Unlimited Agentic Power** |
|
|
50
54
|
|
|
51
55
|
---
|
|
@@ -53,26 +57,16 @@ lemma start --stack
|
|
|
53
57
|
## 🛠️ Developer Integration
|
|
54
58
|
|
|
55
59
|
### Use as an Intelligent Proxy
|
|
56
|
-
Simply swap your OpenAI/Anthropic base URL in your favorite tools (Cursor, Copilot, AutoGPT).
|
|
60
|
+
Simply swap your OpenAI/Anthropic base URL in your favorite tools (Cursor, Copilot, AutoGPT).
|
|
61
|
+
|
|
62
|
+
* **Base URL:** `http://localhost:8081/v1`
|
|
63
|
+
* **Dashboard:** `http://localhost:8081/dashboard/`
|
|
57
64
|
|
|
58
65
|
```bash
|
|
59
66
|
# Point your configuration to:
|
|
60
|
-
http://localhost:
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
### Use as a Multi-Agent Hub
|
|
64
|
-
For complex agent swarms that need a "Hive Mind":
|
|
65
|
-
```typescript
|
|
66
|
-
import { SubconsciousHub } from '@nxuss/lemma';
|
|
67
|
-
const hub = new SubconsciousHub({ server: { port: 8080 } });
|
|
68
|
-
await hub.start();
|
|
67
|
+
http://localhost:8081/v1
|
|
69
68
|
```
|
|
70
69
|
|
|
71
70
|
---
|
|
72
71
|
|
|
73
|
-
|
|
74
|
-
Monitor your savings, visualize agent connections, and inspect your semantic memory through the integrated real-time dashboard.
|
|
75
|
-
|
|
76
|
-
---
|
|
77
|
-
|
|
78
|
-
MIT © Nxus Studio | [Get Lemma Pro](https://lemma.nxus.studio/upgrade)
|
|
72
|
+
MIT © Nxus Studio | [Upgrade to Lemma Pro](https://lemma.nxus.studio/upgrade)
|
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
|
-
|
|
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(
|
|
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.
|
|
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
|
|
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.
|
|
3
|
+
"version": "0.4.6",
|
|
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",
|
|
@@ -161,7 +161,7 @@
|
|
|
161
161
|
"homepage": "https://github.com/Nxusbets/lemma#readme",
|
|
162
162
|
"dependencies": {
|
|
163
163
|
"@chroma-core/default-embed": "^0.1.9",
|
|
164
|
-
"@nxuss/lemma": "^0.4.
|
|
164
|
+
"@nxuss/lemma": "^0.4.5",
|
|
165
165
|
"@types/cors": "^2.8.19",
|
|
166
166
|
"axios": "^1.6.0",
|
|
167
167
|
"commander": "^14.0.3",
|