@polderlabs/bizar 4.5.0 → 4.5.2
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/bizar-dash/dist/assets/__vite-browser-external-BIHI7g3E.js +1 -0
- package/bizar-dash/dist/assets/__vite-browser-external-BIHI7g3E.js.map +1 -0
- package/bizar-dash/dist/assets/main-B4OfGAwz.js +361 -0
- package/bizar-dash/dist/assets/main-B4OfGAwz.js.map +1 -0
- package/bizar-dash/dist/assets/main-DAlLdW8I.css +1 -0
- package/bizar-dash/dist/assets/{mobile--0FBIKX3.js → mobile-BRhoDOUz.js} +1 -2
- package/bizar-dash/dist/assets/{mobile--0FBIKX3.js.map → mobile-BRhoDOUz.js.map} +1 -1
- package/bizar-dash/dist/assets/{mobile-OgRp8VIb.js → mobile-lbH6szyX.js} +2 -3
- package/bizar-dash/dist/assets/mobile-lbH6szyX.js.map +1 -0
- package/bizar-dash/dist/index.html +3 -3
- package/bizar-dash/dist/mobile.html +2 -2
- package/bizar-dash/skills/bizar/SKILL.md +20 -0
- package/bizar-dash/skills/headroom/SKILL.md +94 -0
- package/bizar-dash/skills/lightrag/SKILL.md +11 -0
- package/bizar-dash/skills/obsidian/SKILL.md +13 -0
- package/bizar-dash/src/server/api.mjs +6 -0
- package/bizar-dash/src/server/headroom.mjs +647 -0
- package/bizar-dash/src/server/memory-lightrag.mjs +281 -6
- package/bizar-dash/src/server/memory-obsidian.mjs +230 -0
- package/bizar-dash/src/server/memory-store.mjs +151 -0
- package/bizar-dash/src/server/mods-loader.mjs +13 -5
- package/bizar-dash/src/server/providers-store.mjs +73 -1
- package/bizar-dash/src/server/routes/_shared.mjs +17 -0
- package/bizar-dash/src/server/routes/chat.mjs +38 -0
- package/bizar-dash/src/server/routes/headroom.mjs +126 -0
- package/bizar-dash/src/server/routes/lightrag.mjs +6 -2
- package/bizar-dash/src/server/routes/memory.mjs +439 -4
- package/bizar-dash/src/server/schedules-runner.mjs +4 -4
- package/bizar-dash/src/server/server.mjs +55 -37
- package/bizar-dash/src/server/watcher.mjs +2 -2
- package/bizar-dash/src/web/App.tsx +42 -6
- package/bizar-dash/src/web/components/HeadroomSettings.tsx +418 -0
- package/bizar-dash/src/web/components/HeadroomStatus.tsx +158 -0
- package/bizar-dash/src/web/components/Toast.tsx +1 -1
- package/bizar-dash/src/web/components/Topbar.tsx +3 -1
- package/bizar-dash/src/web/lib/api.ts +12 -11
- package/bizar-dash/src/web/lib/types.ts +16 -0
- package/bizar-dash/src/web/main.tsx +1 -0
- package/bizar-dash/src/web/styles/chat.css +2 -0
- package/bizar-dash/src/web/styles/main.css +52 -23
- package/bizar-dash/src/web/styles/memory.css +955 -0
- package/bizar-dash/src/web/styles/tasks.css +2 -0
- package/bizar-dash/src/web/views/Memory.tsx +141 -0
- package/bizar-dash/src/web/views/MiniMaxUsage.tsx +3 -2
- package/bizar-dash/src/web/views/Overview.tsx +7 -2
- package/bizar-dash/src/web/views/Settings.tsx +32 -1
- package/bizar-dash/src/web/views/Skills.tsx +3 -2
- package/bizar-dash/src/web/views/Tasks.tsx +4 -3
- package/bizar-dash/src/web/views/memory/ConfigPanel.tsx +289 -0
- package/bizar-dash/src/web/views/memory/GitSyncPanel.tsx +220 -0
- package/bizar-dash/src/web/views/memory/LightragPanel.tsx +307 -0
- package/bizar-dash/src/web/views/memory/MemoryOverview.tsx +356 -0
- package/bizar-dash/src/web/views/memory/MemoryStatusCard.tsx +160 -0
- package/bizar-dash/src/web/views/memory/ObsidianPanel.tsx +642 -0
- package/bizar-dash/src/web/views/memory/SemanticSearchPanel.tsx +194 -0
- package/bizar-dash/tests/cli-bugfixes.test.mjs +151 -0
- package/bizar-dash/tests/frontend-bugfixes.test.mjs +151 -0
- package/bizar-dash/tests/headroom-install.test.mjs +173 -0
- package/bizar-dash/tests/headroom-settings.test.mjs +126 -0
- package/bizar-dash/tests/headroom-status.test.mjs +117 -0
- package/bizar-dash/tests/memory-lightrag-extended.test.mjs +162 -0
- package/bizar-dash/tests/memory-obsidian.test.mjs +269 -0
- package/bizar-dash/tests/memory-tab.test.mjs +322 -0
- package/bizar-dash/tests/mod-upgrade.node.test.mjs +1 -1
- package/bizar-dash/tests/server-bugfixes.test.mjs +318 -0
- package/bizar-dash/tests/submit-feedback.test.mjs +6 -6
- package/cli/artifact.mjs +11 -4
- package/cli/bin.mjs +211 -12
- package/cli/doctor.mjs +5 -3
- package/cli/memory.mjs +65 -21
- package/cli/provision.mjs +8 -2
- package/install.sh +1 -2
- package/package.json +3 -3
- package/bizar-dash/dist/assets/main-CDFKHzBg.css +0 -1
- package/bizar-dash/dist/assets/main-NYFpS2wY.js +0 -312
- package/bizar-dash/dist/assets/main-NYFpS2wY.js.map +0 -1
- package/bizar-dash/dist/assets/mobile-OgRp8VIb.js.map +0 -1
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
}
|
|
30
30
|
})();
|
|
31
31
|
</script>
|
|
32
|
-
<script type="module" crossorigin src="/assets/main-
|
|
33
|
-
<link rel="modulepreload" crossorigin href="/assets/mobile-
|
|
32
|
+
<script type="module" crossorigin src="/assets/main-B4OfGAwz.js"></script>
|
|
33
|
+
<link rel="modulepreload" crossorigin href="/assets/mobile-lbH6szyX.js">
|
|
34
34
|
<link rel="stylesheet" crossorigin href="/assets/mobile-CsZQAswA.css">
|
|
35
|
-
<link rel="stylesheet" crossorigin href="/assets/main-
|
|
35
|
+
<link rel="stylesheet" crossorigin href="/assets/main-DAlLdW8I.css">
|
|
36
36
|
</head>
|
|
37
37
|
<body>
|
|
38
38
|
<div id="root"></div>
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
13
13
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
14
14
|
<link rel="stylesheet" href="https://rsms.me/inter/inter.css" />
|
|
15
|
-
<script type="module" crossorigin src="/assets/mobile
|
|
16
|
-
<link rel="modulepreload" crossorigin href="/assets/mobile-
|
|
15
|
+
<script type="module" crossorigin src="/assets/mobile-BRhoDOUz.js"></script>
|
|
16
|
+
<link rel="modulepreload" crossorigin href="/assets/mobile-lbH6szyX.js">
|
|
17
17
|
<link rel="stylesheet" crossorigin href="/assets/mobile-CsZQAswA.css">
|
|
18
18
|
</head>
|
|
19
19
|
<body>
|
|
@@ -74,6 +74,26 @@ export MINIMAX_API_KEY_3="third-key"
|
|
|
74
74
|
|
|
75
75
|
Rotation triggers on 429 (rate limit), 402 (quota exhausted), 500/502/503/504 (server error). Does NOT trigger on 401 (unauthorized - fix the key).
|
|
76
76
|
|
|
77
|
+
## Headroom
|
|
78
|
+
|
|
79
|
+
The Bizar dashboard manages Headroom through Settings → Headroom. To check status:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
bizar headroom status
|
|
83
|
+
bizar headroom stats
|
|
84
|
+
bizar headroom install
|
|
85
|
+
bizar headroom wrap
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Or via the dashboard API:
|
|
89
|
+
- `GET /api/headroom/status` — live status
|
|
90
|
+
- `GET /api/headroom/stats` — compression stats
|
|
91
|
+
- `POST /api/headroom/install` — install headroom
|
|
92
|
+
- `POST /api/headroom/wrap` — wrap opencode
|
|
93
|
+
- `POST /api/headroom/proxy/start` — start proxy
|
|
94
|
+
|
|
95
|
+
Headroom is a context compression layer that sits between opencode and LLM providers, compressing tool outputs, logs, RAG chunks, and conversation history by 60–95%.
|
|
96
|
+
|
|
77
97
|
## Troubleshooting
|
|
78
98
|
|
|
79
99
|
### Odin Self-Handles Instead of Routing
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: headroom
|
|
3
|
+
description: Headroom — context compression layer for AI agents. Routes opencode and other LLM clients through a local proxy that compresses tool outputs, logs, RAG chunks, and conversation history by 60–95%.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Headroom
|
|
7
|
+
|
|
8
|
+
Headroom is a context compression layer that sits between opencode (or any LLM client) and the upstream provider. It intercepts tool call outputs, conversation history, and RAG chunks and compresses them before they reach the model — typically reducing token usage by 60–95% with no loss in answer quality.
|
|
9
|
+
|
|
10
|
+
## When to Use
|
|
11
|
+
|
|
12
|
+
- **Token budget is tight**: If a task is approaching the context window limit, Headroom can reclaim 60–90% of the tokens spent on tool outputs.
|
|
13
|
+
- **Long conversations**: The compression is cumulative — the longer the session, the more Headroom saves.
|
|
14
|
+
- **Verbose tool output**: RAG retrieval, file globbing, grep results, and diagnostic output are the highest-value compression targets.
|
|
15
|
+
- **Multi-step implementation**: Large features with many tool calls benefit most.
|
|
16
|
+
|
|
17
|
+
## Architecture
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
opencode → headroom proxy (localhost:8787) → LLM provider
|
|
21
|
+
↓
|
|
22
|
+
compresses tool outputs, logs, RAG chunks
|
|
23
|
+
caches responses
|
|
24
|
+
measures savings
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Key Concepts
|
|
28
|
+
|
|
29
|
+
### Compression ratio
|
|
30
|
+
The fraction of tokens Headroom eliminates. A 0.85 compression ratio means 85% of the tokens were removed before reaching the provider.
|
|
31
|
+
|
|
32
|
+
### Wrapped vs unwrapped
|
|
33
|
+
`headroom wrap opencode` modifies `~/.config/opencode/opencode.json` to route traffic through the proxy. `headroom unwrap opencode` restores the original configuration.
|
|
34
|
+
|
|
35
|
+
### Proxy vs wrap
|
|
36
|
+
- **Proxy** (`headroom proxy`): The actual HTTP proxy server running on port 8787.
|
|
37
|
+
- **Wrap** (`headroom wrap opencode`): The act of configuring opencode to use the proxy.
|
|
38
|
+
|
|
39
|
+
You can run the proxy standalone (`headroom proxy`) and point any OpenAI-compatible client at it. The wrap command is just a convenience for opencode.
|
|
40
|
+
|
|
41
|
+
## Dashboard Integration
|
|
42
|
+
|
|
43
|
+
The Bizar dashboard manages Headroom through Settings → Headroom:
|
|
44
|
+
|
|
45
|
+
- **Status widget**: Shows live proxy status, compression ratio, tokens saved
|
|
46
|
+
- **Controls**: Install, wrap/unwrap, start/stop proxy, open dashboard
|
|
47
|
+
- **Settings**: Auto-install, auto-start, auto-wrap, route-all-providers, port, host, backend, output shaper, telemetry, budget
|
|
48
|
+
|
|
49
|
+
API endpoints:
|
|
50
|
+
- `GET /api/headroom/status` — live status
|
|
51
|
+
- `GET /api/headroom/stats?hours=24` — compression statistics
|
|
52
|
+
- `POST /api/headroom/install` — install headroom
|
|
53
|
+
- `POST /api/headroom/wrap` — wrap opencode
|
|
54
|
+
- `POST /api/headroom/unwrap` — unwrap opencode
|
|
55
|
+
- `POST /api/headroom/proxy/start` — start proxy
|
|
56
|
+
- `POST /api/headroom/proxy/stop` — stop proxy
|
|
57
|
+
- `POST /api/headroom/auto-route` — configure all providers to route through the proxy
|
|
58
|
+
|
|
59
|
+
CLI:
|
|
60
|
+
```bash
|
|
61
|
+
bizar headroom status # live status
|
|
62
|
+
bizar headroom stats # compression stats
|
|
63
|
+
bizar headroom install # install headroom
|
|
64
|
+
bizar headroom wrap # wrap opencode
|
|
65
|
+
bizar headroom unwrap # unwrap
|
|
66
|
+
bizar headroom start # start proxy
|
|
67
|
+
bizar headroom stop # stop proxy
|
|
68
|
+
bizar headroom doctor # health check
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Environment Variables
|
|
72
|
+
|
|
73
|
+
| Variable | Default | Description |
|
|
74
|
+
|---|---|---|
|
|
75
|
+
| `HEADROOM_HOST` | `127.0.0.1` | Proxy bind host |
|
|
76
|
+
| `HEADROOM_PORT` | `8787` | Proxy port |
|
|
77
|
+
| `HEADROOM_OUTPUT_SHAPER` | `0` | Set to `1` to enable output shaping |
|
|
78
|
+
| `HEADROOM_TELEMETRY` | (on) | Set to `off` to disable |
|
|
79
|
+
| `HEADROOM_BUDGET` | `0` | Monthly USD cap (0 = unlimited) |
|
|
80
|
+
| `HEADROOM_CONTEXT_TOOL` | `rtk` | Context tool: `rtk` or `lean-ctx` |
|
|
81
|
+
|
|
82
|
+
## Common Gotchas
|
|
83
|
+
|
|
84
|
+
1. **Proxy must be running before opencode starts**: If the proxy is down when opencode launches, opencode will fail to make LLM calls. Start the proxy first, or enable `autoStart` in Headroom settings.
|
|
85
|
+
|
|
86
|
+
2. **`headroom wrap` edits opencode.json**: The wrap command modifies `~/.config/opencode/opencode.json`. If you use version control for this file, you'll see a diff on every wrap. Use `headroom unwrap` before committing, or ignore the changes.
|
|
87
|
+
|
|
88
|
+
3. **Headroom 0.30.0 doesn't have `headroom plan --tokens`**: This command was removed. Use `headroom perf --hours 24` for actual token savings data.
|
|
89
|
+
|
|
90
|
+
4. **Token savings are cumulative**: The compression ratio compounds over a session. A 15-step implementation that saves 80% at each step uses roughly the same tokens as a 3-step implementation without Headroom.
|
|
91
|
+
|
|
92
|
+
5. **Cache hits**: Headroom caches semantically similar tool calls. Repeated operations (file reads, API probes) can be served from cache entirely, bypassing the LLM.
|
|
93
|
+
|
|
94
|
+
6. **Provider baseURL**: When `routeAllProviders` is enabled, the dashboard rewrites provider baseURLs to point at the proxy. If you configure a new provider manually, you may need to update its baseURL to go through the proxy.
|
|
@@ -66,6 +66,17 @@ When both Obsidian vault and LightRAG are configured:
|
|
|
66
66
|
| Related concepts discovery | LightRAG search |
|
|
67
67
|
| Precise location of text | grep + read |
|
|
68
68
|
|
|
69
|
+
## Memory tab in the dashboard (v4.7.0+)
|
|
70
|
+
|
|
71
|
+
The dashboard's **Memory** tab (sidebar entry between Skills and Settings) surfaces LightRAG controls without leaving the browser:
|
|
72
|
+
|
|
73
|
+
- **LightRAG panel** — Start / Stop / Restart / Reindex all / Rebuild graph. Rebuild graph wipes the working dir and re-runs a full reindex (idempotent — safe to re-run).
|
|
74
|
+
- **Stats** — Approximate indexed-chunk count (from `kv_store_*.json`), query count last 24h, and average response time. Stats are tracked in a sidecar JSONL at `<project>/.bizar/memory-cache/lightrag-query-log.jsonl`.
|
|
75
|
+
- **Quick search** — Sends `GET /api/memory/query?q=...&topK=8` and shows the raw LightRAG response.
|
|
76
|
+
- **Semantic search panel** — Cross-source search: runs both LightRAG and Obsidian vault lexical search and merges results, deduped by (source, relPath).
|
|
77
|
+
|
|
78
|
+
Open the tab by setting `activeTab = 'memory'` or via the Overview's Memory status card. The LightRAG stats are fetched via `GET /api/memory/lightrag/stats`; the rebuild path uses `POST /api/memory/lightrag/rebuild-graph`.
|
|
79
|
+
|
|
69
80
|
## Common Issues
|
|
70
81
|
|
|
71
82
|
### Empty search results
|
|
@@ -48,6 +48,19 @@ Use the memory service to find relevant context before making non-trivial decisi
|
|
|
48
48
|
|
|
49
49
|
When LightRAG is enabled (v4.5.0+), it indexes vault content automatically. Query with `bizar memory search` - this routes to LightRAG for natural-language queries. For simple lookups, direct file reading is faster.
|
|
50
50
|
|
|
51
|
+
## Memory tab in the dashboard (v4.7.0+)
|
|
52
|
+
|
|
53
|
+
The dashboard has a dedicated **Memory** tab (sidebar entry between Skills and Settings) for working with the vault without leaving the browser:
|
|
54
|
+
|
|
55
|
+
- **Overview** — composite health score (vault + LightRAG + git + secrets + schema), with one-click navigation to each subsystem.
|
|
56
|
+
- **Obsidian Vault** — folder tree on the left, note list (newest first), detail pane with body + frontmatter + backlinks. Inline create / edit (markdown editor modal) / delete.
|
|
57
|
+
- **LightRAG** — Start / Stop / Restart / Reindex all / Rebuild graph. Quick search sends a natural-language query and shows the LightRAG response.
|
|
58
|
+
- **Git Sync** — branch / ahead / behind / dirty / clean pills, working-tree diff, Pull / Push / Commit / Fetch + sync.
|
|
59
|
+
- **Semantic Search** — single search input that queries both LightRAG and the Obsidian vault in one shot. Results deduplicated by (source, relPath) and sorted by score.
|
|
60
|
+
- **Config** — grouped forms for LightRAG URL/models, Obsidian path/syncInterval, git repo/remote/branch/autoSync, plus a "Test git connection" button.
|
|
61
|
+
|
|
62
|
+
Open the tab programmatically by setting `activeTab = 'memory'`. The Overview page now also surfaces a small Memory status card (health score + LightRAG + vault + git) with a single-click jump.
|
|
63
|
+
|
|
51
64
|
## Common Gotchas
|
|
52
65
|
|
|
53
66
|
- The vault is git-tracked but not auto-committed. Commit after meaningful knowledge additions.
|
|
@@ -53,6 +53,7 @@ import { createMiscRouter } from './routes/misc.mjs';
|
|
|
53
53
|
import { createEnvVarsRouter } from './routes/env-vars.mjs';
|
|
54
54
|
import { createUpdateRouter } from './routes/update.mjs';
|
|
55
55
|
import { createUsageRouter } from './routes/usage.mjs';
|
|
56
|
+
import { createHeadroomRouter } from './routes/headroom.mjs';
|
|
56
57
|
|
|
57
58
|
/**
|
|
58
59
|
* @param {object} deps
|
|
@@ -132,6 +133,11 @@ export async function createApiRouter({
|
|
|
132
133
|
router.use(createArtifactsRouter({ state, broadcast, projectRoot }));
|
|
133
134
|
router.use(createMinimaxRouter({ state, broadcast }));
|
|
134
135
|
router.use(createUsageRouter());
|
|
136
|
+
// v5.0.0 — Headroom context compression endpoints.
|
|
137
|
+
// Mounted at /api/headroom/* so the mount-prefix stripping works correctly.
|
|
138
|
+
// Each route handler inside the router is at its bare path (e.g. '/status'),
|
|
139
|
+
// which becomes '/api/headroom/status' at the top level.
|
|
140
|
+
router.use('/headroom', createHeadroomRouter());
|
|
135
141
|
router.use(createMiscRouter({ state, broadcast }));
|
|
136
142
|
|
|
137
143
|
// /api/auth/* must be reachable WITHOUT the bearer token so a fresh
|