@nxuss/lemma 1.33.0 → 1.34.0
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 +2 -0
- package/dashboard/README.md +28 -332
- package/dashboard/dist/assets/{index-Dh-whqJ7.js → index-euG1IvQ7.js} +82 -82
- package/dashboard/dist/index.html +1 -1
- package/dist/cjs/cli/lemma-proxy.d.ts.map +1 -1
- package/dist/cjs/cli/lemma-proxy.js +20 -1
- package/dist/cjs/cli/lemma-proxy.js.map +1 -1
- package/dist/cjs/proxy/DebuggerState.d.ts +3 -0
- package/dist/cjs/proxy/DebuggerState.d.ts.map +1 -0
- package/dist/cjs/proxy/DebuggerState.js +18 -0
- package/dist/cjs/proxy/DebuggerState.js.map +1 -0
- package/dist/esm/cli/lemma-proxy.d.ts.map +1 -1
- package/dist/esm/cli/lemma-proxy.js +20 -1
- package/dist/esm/cli/lemma-proxy.js.map +1 -1
- package/dist/esm/proxy/DebuggerState.d.ts +3 -0
- package/dist/esm/proxy/DebuggerState.d.ts.map +1 -0
- package/dist/esm/proxy/DebuggerState.js +14 -0
- package/dist/esm/proxy/DebuggerState.js.map +1 -0
- package/package.json +4 -2
- package/dashboard/dist/assets/index-Dh-whqJ7.js.map +0 -1
package/README.md
CHANGED
|
@@ -35,6 +35,8 @@ lemma start # gateway + dashboard on http://localhost:8081
|
|
|
35
35
|
>
|
|
36
36
|
> **🆕 v1.22.0 — Lemma auto-activates in every LLM client.** `npm i -g @nxuss/lemma` registers the skill in your **user** catalog (auto-loads in every `muse` session, any project) and `lemma init` wires each project for Muse, Claude Code, Cursor, Codex, Windsurf, Kiro and OpenCode. Health check: `lemma doctor`.
|
|
37
37
|
>
|
|
38
|
+
> **🆕 v1.34.0 — Dashboard fixes.** The header shows the real running version (from `/health`), the debugger's pause/resume now works against the proxy, the Vite dev proxy points at the right port, and `npm run build` rebuilds the dashboard so the published UI is never stale.
|
|
39
|
+
>
|
|
38
40
|
> **🆕 v1.33.0 — C# (.NET) support, honestly labeled.** New per-project language detection
|
|
39
41
|
> (`.csproj/.sln`, target frameworks, mixed repos) and a read-only `capability_matrix` tool so clients
|
|
40
42
|
> stop guessing what works outside TypeScript. `get_ast_hologram` and `get_symbol_surgical_context` now
|
package/dashboard/README.md
CHANGED
|
@@ -1,351 +1,47 @@
|
|
|
1
1
|
# Lemma Dashboard
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Live view of a running Lemma proxy: token savings, cache behaviour, connected agents, MCP
|
|
4
|
+
activity and the Brain's knowledge base.
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
The proxy serves the production build itself at `http://localhost:8081/dashboard/`
|
|
7
|
+
(`lemma start`). The version shown in the header comes from the proxy's `/health`.
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
- Live visualization of connected agents
|
|
9
|
-
- Node graph showing agent relationships
|
|
10
|
-
- Real-time status updates (active, idle, busy)
|
|
11
|
-
- Agent capabilities display
|
|
12
|
-
- Connection lines to central hub
|
|
9
|
+
## Panels
|
|
13
10
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
-
|
|
17
|
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
11
|
+
- **Metrics bar / charts** — requests, hit rate, latency, tokens and cost saved
|
|
12
|
+
(`/api/metrics`, `/api/cache-stats`, `/api/savings-breakdown`).
|
|
13
|
+
- **The Hub** — connected agents (`/api/agents`), charts, savings breakdown, Brain knowledge
|
|
14
|
+
stats (`/api/brain/stats`), cache stats and the event timeline (`/api/events`).
|
|
15
|
+
- **The Tools** — live feed of MCP tool calls; the header badge shows MCP status
|
|
16
|
+
(`/api/mcp-status`) and toggles it (`/api/mcp/toggle`).
|
|
17
|
+
- **The Brain** — semantic search over the cache (`/api/search`).
|
|
18
|
+
- **Debugger** (bottom panel) — pause/resume. While paused the proxy refuses new completions
|
|
19
|
+
with `503` + `Retry-After` (`/api/debugger/pause|resume|state`).
|
|
20
|
+
- **Flush Cache** — `/api/cache/clear`.
|
|
23
21
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
- Playback controls (pause, step back/forward)
|
|
28
|
-
- State editing capabilities
|
|
29
|
-
- Event filtering by type
|
|
22
|
+
`TimeTravel.tsx` and the rewind call (`/api/debugger/rewind`) exist in the code but are not
|
|
23
|
+
wired into the proxy: rewind is only implemented by the standalone API server
|
|
24
|
+
(`src/api/dashboardRoutes.ts`).
|
|
30
25
|
|
|
31
|
-
##
|
|
32
|
-
|
|
33
|
-
### Installation
|
|
26
|
+
## Develop
|
|
34
27
|
|
|
35
28
|
```bash
|
|
36
|
-
cd dashboard
|
|
37
29
|
npm install
|
|
30
|
+
npm run dev # Vite on http://localhost:8082/dashboard/
|
|
38
31
|
```
|
|
39
32
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
```bash
|
|
43
|
-
npm run dev
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
Dashboard will be available at `http://localhost:3000`
|
|
33
|
+
The dev server talks to the proxy on `http://localhost:8081` (start it with `lemma start`).
|
|
34
|
+
Override with `VITE_API_URL` / `VITE_WS_URL` in `.env`.
|
|
47
35
|
|
|
48
|
-
|
|
36
|
+
## Build
|
|
49
37
|
|
|
50
38
|
```bash
|
|
51
|
-
npm run build
|
|
52
|
-
npm run preview
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
## Configuration
|
|
56
|
-
|
|
57
|
-
Create a `.env` file:
|
|
58
|
-
|
|
59
|
-
```env
|
|
60
|
-
VITE_ROUTER_URL=ws://localhost:8080
|
|
61
|
-
VITE_API_URL=http://localhost:8080
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
## Architecture
|
|
65
|
-
|
|
66
|
-
### Tech Stack
|
|
67
|
-
|
|
68
|
-
- **React 18**: UI framework
|
|
69
|
-
- **TypeScript**: Type safety
|
|
70
|
-
- **Vite**: Build tool and dev server
|
|
71
|
-
- **TailwindCSS**: Styling
|
|
72
|
-
- **Recharts**: Data visualization
|
|
73
|
-
- **Zustand**: State management
|
|
74
|
-
- **WebSocket**: Real-time communication
|
|
75
|
-
|
|
76
|
-
### Project Structure
|
|
77
|
-
|
|
78
|
-
```
|
|
79
|
-
dashboard/
|
|
80
|
-
├── src/
|
|
81
|
-
│ ├── components/
|
|
82
|
-
│ │ ├── AgentGraph.tsx # Agent visualization
|
|
83
|
-
│ │ ├── MetricsPanel.tsx # Token economics
|
|
84
|
-
│ │ ├── TimeTravel.tsx # State debugger
|
|
85
|
-
│ │ ├── ConnectionStatus.tsx # WebSocket status
|
|
86
|
-
│ │ └── Layout.tsx # App layout
|
|
87
|
-
│ ├── hooks/
|
|
88
|
-
│ │ └── useWebSocket.ts # WebSocket connection
|
|
89
|
-
│ ├── App.tsx # Main app component
|
|
90
|
-
│ ├── main.tsx # Entry point
|
|
91
|
-
│ └── index.css # Global styles
|
|
92
|
-
├── index.html
|
|
93
|
-
├── package.json
|
|
94
|
-
├── tsconfig.json
|
|
95
|
-
├── vite.config.ts
|
|
96
|
-
└── tailwind.config.js
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
## WebSocket Protocol
|
|
100
|
-
|
|
101
|
-
The dashboard connects to the Lemma router via WebSocket and exchanges IAP (Inter-Agent Protocol) messages.
|
|
102
|
-
|
|
103
|
-
### Connection
|
|
104
|
-
|
|
105
|
-
```typescript
|
|
106
|
-
const ws = new WebSocket('ws://localhost:8080');
|
|
107
|
-
|
|
108
|
-
// Send handshake
|
|
109
|
-
ws.send(JSON.stringify({
|
|
110
|
-
type: 'HANDSHAKE',
|
|
111
|
-
messageId: crypto.randomUUID(),
|
|
112
|
-
timestamp: Date.now(),
|
|
113
|
-
payload: {
|
|
114
|
-
agentId: 'dashboard-client',
|
|
115
|
-
agentName: 'Dashboard',
|
|
116
|
-
version: '1.0.0',
|
|
117
|
-
capabilities: [{ name: 'monitoring', version: '1.0.0' }],
|
|
118
|
-
},
|
|
119
|
-
}));
|
|
39
|
+
npm run build # tsc + vite build -> dist/
|
|
120
40
|
```
|
|
121
41
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
#### Metrics Update
|
|
125
|
-
```json
|
|
126
|
-
{
|
|
127
|
-
"type": "METRICS_UPDATE",
|
|
128
|
-
"payload": {
|
|
129
|
-
"totalRequests": 1000,
|
|
130
|
-
"cacheHits": 800,
|
|
131
|
-
"cacheMisses": 200,
|
|
132
|
-
"averageLatency": 45.2,
|
|
133
|
-
"tokensSaved": 150000,
|
|
134
|
-
"costSaved": 0.3,
|
|
135
|
-
"hitRate": "80.0%"
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
#### Agent Connected
|
|
141
|
-
```json
|
|
142
|
-
{
|
|
143
|
-
"type": "AGENT_CONNECTED",
|
|
144
|
-
"payload": {
|
|
145
|
-
"id": "agent-123",
|
|
146
|
-
"name": "Research Agent",
|
|
147
|
-
"capabilities": ["research", "analysis"],
|
|
148
|
-
"status": "idle",
|
|
149
|
-
"connectedAt": 1234567890
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
#### State Event
|
|
155
|
-
```json
|
|
156
|
-
{
|
|
157
|
-
"type": "STATE_EVENT",
|
|
158
|
-
"payload": {
|
|
159
|
-
"id": "event-uuid",
|
|
160
|
-
"timestamp": 1234567890,
|
|
161
|
-
"type": "TASK_REQUEST",
|
|
162
|
-
"agentId": "agent-123",
|
|
163
|
-
"data": {},
|
|
164
|
-
"snapshot": {}
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
## Components
|
|
170
|
-
|
|
171
|
-
### AgentGraph
|
|
172
|
-
|
|
173
|
-
Visualizes the agent swarm as a node graph.
|
|
174
|
-
|
|
175
|
-
**Props:**
|
|
176
|
-
- `agents: Agent[]` - Array of connected agents
|
|
177
|
-
|
|
178
|
-
**Features:**
|
|
179
|
-
- Circular layout around central hub
|
|
180
|
-
- Color-coded status indicators
|
|
181
|
-
- Capability badges
|
|
182
|
-
- Connection lines with animation
|
|
183
|
-
|
|
184
|
-
### MetricsPanel
|
|
185
|
-
|
|
186
|
-
Displays token economics and performance metrics.
|
|
187
|
-
|
|
188
|
-
**Props:**
|
|
189
|
-
- `metrics: Metrics` - Current metrics object
|
|
190
|
-
|
|
191
|
-
**Features:**
|
|
192
|
-
- 6 key metric cards
|
|
193
|
-
- 3 interactive charts
|
|
194
|
-
- ROI calculator
|
|
195
|
-
- Historical data tracking
|
|
196
|
-
|
|
197
|
-
### TimeTravel
|
|
198
|
-
|
|
199
|
-
State debugger with time-travel capabilities.
|
|
200
|
-
|
|
201
|
-
**Props:**
|
|
202
|
-
- `events: StateEvent[]` - Array of captured events
|
|
203
|
-
|
|
204
|
-
**Features:**
|
|
205
|
-
- Event timeline
|
|
206
|
-
- State inspector
|
|
207
|
-
- Playback controls
|
|
208
|
-
- State editing
|
|
209
|
-
|
|
210
|
-
### ConnectionStatus
|
|
211
|
-
|
|
212
|
-
Shows WebSocket connection status.
|
|
213
|
-
|
|
214
|
-
**Props:**
|
|
215
|
-
- `isConnected: boolean` - Connection state
|
|
216
|
-
|
|
217
|
-
## Customization
|
|
218
|
-
|
|
219
|
-
### Theme
|
|
220
|
-
|
|
221
|
-
Edit `tailwind.config.js` to customize colors:
|
|
222
|
-
|
|
223
|
-
```javascript
|
|
224
|
-
theme: {
|
|
225
|
-
extend: {
|
|
226
|
-
colors: {
|
|
227
|
-
primary: { /* your colors */ },
|
|
228
|
-
success: { /* your colors */ },
|
|
229
|
-
// ...
|
|
230
|
-
},
|
|
231
|
-
},
|
|
232
|
-
}
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
### Metrics
|
|
236
|
-
|
|
237
|
-
Add custom metrics in `useWebSocket.ts`:
|
|
238
|
-
|
|
239
|
-
```typescript
|
|
240
|
-
export interface Metrics {
|
|
241
|
-
// ... existing metrics
|
|
242
|
-
customMetric: number;
|
|
243
|
-
}
|
|
244
|
-
```
|
|
245
|
-
|
|
246
|
-
### Charts
|
|
247
|
-
|
|
248
|
-
Add new charts in `MetricsPanel.tsx` using Recharts:
|
|
249
|
-
|
|
250
|
-
```typescript
|
|
251
|
-
<LineChart data={historicalData}>
|
|
252
|
-
<Line dataKey="customMetric" stroke="#color" />
|
|
253
|
-
</LineChart>
|
|
254
|
-
```
|
|
255
|
-
|
|
256
|
-
## Performance
|
|
257
|
-
|
|
258
|
-
### Optimizations
|
|
259
|
-
|
|
260
|
-
- **Lazy Loading**: Components loaded on-demand
|
|
261
|
-
- **Memoization**: React.memo for expensive components
|
|
262
|
-
- **Virtual Scrolling**: For large event lists
|
|
263
|
-
- **Data Limiting**: Keep only recent data points
|
|
264
|
-
|
|
265
|
-
### Metrics
|
|
266
|
-
|
|
267
|
-
- **Bundle Size**: ~200KB gzipped
|
|
268
|
-
- **Initial Load**: <1s on fast connection
|
|
269
|
-
- **Memory Usage**: ~50MB typical
|
|
270
|
-
- **CPU Usage**: <5% idle, <15% active
|
|
271
|
-
|
|
272
|
-
## Deployment
|
|
273
|
-
|
|
274
|
-
### Static Hosting
|
|
275
|
-
|
|
276
|
-
Build and deploy to any static host:
|
|
277
|
-
|
|
278
|
-
```bash
|
|
279
|
-
npm run build
|
|
280
|
-
# Upload dist/ folder to:
|
|
281
|
-
# - Vercel
|
|
282
|
-
# - Netlify
|
|
283
|
-
# - AWS S3 + CloudFront
|
|
284
|
-
# - GitHub Pages
|
|
285
|
-
```
|
|
286
|
-
|
|
287
|
-
### Docker
|
|
288
|
-
|
|
289
|
-
```dockerfile
|
|
290
|
-
FROM node:20-alpine AS builder
|
|
291
|
-
WORKDIR /app
|
|
292
|
-
COPY package*.json ./
|
|
293
|
-
RUN npm ci
|
|
294
|
-
COPY . .
|
|
295
|
-
RUN npm run build
|
|
296
|
-
|
|
297
|
-
FROM nginx:alpine
|
|
298
|
-
COPY --from=builder /app/dist /usr/share/nginx/html
|
|
299
|
-
EXPOSE 80
|
|
300
|
-
CMD ["nginx", "-g", "daemon off;"]
|
|
301
|
-
```
|
|
302
|
-
|
|
303
|
-
### Environment Variables
|
|
304
|
-
|
|
305
|
-
Set in deployment platform:
|
|
306
|
-
|
|
307
|
-
- `VITE_ROUTER_URL`: WebSocket URL of Lemma router
|
|
308
|
-
- `VITE_API_URL`: HTTP API URL (if different)
|
|
309
|
-
|
|
310
|
-
## Troubleshooting
|
|
311
|
-
|
|
312
|
-
### WebSocket Connection Failed
|
|
313
|
-
|
|
314
|
-
1. Check router is running
|
|
315
|
-
2. Verify URL in `.env`
|
|
316
|
-
3. Check CORS settings
|
|
317
|
-
4. Verify firewall rules
|
|
318
|
-
|
|
319
|
-
### Metrics Not Updating
|
|
320
|
-
|
|
321
|
-
1. Check WebSocket connection status
|
|
322
|
-
2. Verify router is broadcasting metrics
|
|
323
|
-
3. Check browser console for errors
|
|
324
|
-
4. Verify message format
|
|
325
|
-
|
|
326
|
-
### Charts Not Rendering
|
|
327
|
-
|
|
328
|
-
1. Check data format matches Recharts requirements
|
|
329
|
-
2. Verify ResponsiveContainer has height
|
|
330
|
-
3. Check for console errors
|
|
331
|
-
4. Verify data is not empty
|
|
332
|
-
|
|
333
|
-
## Development
|
|
334
|
-
|
|
335
|
-
### Adding a New Tab
|
|
336
|
-
|
|
337
|
-
1. Create component in `src/components/`
|
|
338
|
-
2. Add tab button in `App.tsx`
|
|
339
|
-
3. Add route in tab navigation
|
|
340
|
-
4. Update state management
|
|
341
|
-
|
|
342
|
-
### Adding a New Metric
|
|
343
|
-
|
|
344
|
-
1. Update `Metrics` interface in `useWebSocket.ts`
|
|
345
|
-
2. Add metric card in `MetricsPanel.tsx`
|
|
346
|
-
3. Update backend to send metric
|
|
347
|
-
4. Add to historical data tracking
|
|
42
|
+
From the repo root, `npm run build` also builds the dashboard. `dashboard/dist` is
|
|
43
|
+
git-ignored but published to npm, so rebuild before releasing.
|
|
348
44
|
|
|
349
|
-
##
|
|
45
|
+
## Stack
|
|
350
46
|
|
|
351
|
-
|
|
47
|
+
React 18, TypeScript, Vite, Tailwind, Zustand, Recharts, Socket.IO client.
|