@loghead/core 0.1.0 → 0.1.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/build/loggerhead +0 -0
- package/{bin → build}/loghead +0 -0
- package/{README.md → build/npm/README.md} +38 -45
- package/build/npm/bin/loghead +0 -0
- package/build/npm/package.json +32 -0
- package/deno.lock +1003 -0
- package/dist/api/server.js +111 -0
- package/dist/cli_main.js +67 -0
- package/dist/db/client.js +53 -0
- package/dist/db/migrate.js +65 -0
- package/dist/services/auth.js +48 -0
- package/dist/services/db.js +157 -0
- package/dist/services/ollama.js +40 -0
- package/dist/types.js +2 -0
- package/dist/ui/main.js +71 -0
- package/dist/utils/startup.js +55 -0
- package/loggerhead.db +0 -0
- package/package.json +28 -24
- package/src/api/server.ts +123 -0
- package/src/cli_main.ts +65 -0
- package/src/db/client.ts +19 -0
- package/src/db/migrate.ts +67 -0
- package/src/services/auth.ts +50 -0
- package/src/services/db.ts +171 -0
- package/src/services/ollama.ts +39 -0
- package/src/tests/db.test.ts +63 -0
- package/src/types.ts +31 -0
- package/src/ui/main.ts +78 -0
- package/src/utils/startup.ts +52 -0
- package/tsconfig.json +15 -0
package/build/loggerhead
ADDED
|
Binary file
|
package/{bin → build}/loghead
RENAMED
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Loghead
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Loghead is a smart log aggregation tool and MCP server. It collects logs from various sources like your Terminal, Docker containers, or Browser, stores them in a database, and makes them searchable for AI assistants (like Claude, Cursor, or Windsurf).
|
|
4
4
|
|
|
5
5
|
Think of it as a "long-term memory" for your development logs that your AI coding agent can read.
|
|
6
6
|
|
|
@@ -11,22 +11,22 @@ Before you start, make sure you have:
|
|
|
11
11
|
1. **Local Ollama**: [Download here](https://ollama.com/download).
|
|
12
12
|
- Ensure it is running (`ollama serve`) and accessible at `http://localhost:11434`.
|
|
13
13
|
- Pull the embedding model: `ollama pull qwen3-embedding:0.6b` (or similar).
|
|
14
|
-
2. **The
|
|
14
|
+
2. **The Loghead Executable**: You can download the latest release or build it yourself (see below).
|
|
15
15
|
|
|
16
16
|
_(Note: [Deno](https://docs.deno.com/runtime/fundamentals/installation/) is only required if you want to build the project from source.)_
|
|
17
17
|
|
|
18
18
|
## Setup Guide
|
|
19
19
|
|
|
20
|
-
Follow these steps to get
|
|
20
|
+
Follow these steps to get Loghead running on your machine.
|
|
21
21
|
|
|
22
22
|
### 1. Install the Tool
|
|
23
23
|
|
|
24
|
-
Download the `
|
|
24
|
+
Download the `loghead` binary from the releases page and move it to a directory in your PATH (e.g., `/usr/local/bin`).
|
|
25
25
|
|
|
26
26
|
**Verify installation:**
|
|
27
27
|
|
|
28
28
|
```bash
|
|
29
|
-
|
|
29
|
+
loghead --help
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
### 2. Initialize the Database
|
|
@@ -34,17 +34,17 @@ loggerhead --help
|
|
|
34
34
|
Run this command to set up the database tables (SQLite):
|
|
35
35
|
|
|
36
36
|
```bash
|
|
37
|
-
|
|
37
|
+
loghead init
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
## How to Use
|
|
41
41
|
|
|
42
42
|
### 1. Start the MCP Server
|
|
43
43
|
|
|
44
|
-
This is the bridge that allows your AI editor to talk to
|
|
44
|
+
This is the bridge that allows your AI editor to talk to Loghead.
|
|
45
45
|
|
|
46
46
|
```bash
|
|
47
|
-
|
|
47
|
+
loghead start
|
|
48
48
|
```
|
|
49
49
|
|
|
50
50
|
You will see instructions on how to connect your specific AI tool (Claude, Cursor, VS Code, Windsurf) in the output.
|
|
@@ -52,8 +52,8 @@ You will see instructions on how to connect your specific AI tool (Claude, Curso
|
|
|
52
52
|
**Example for Claude Desktop Config:**
|
|
53
53
|
|
|
54
54
|
```json
|
|
55
|
-
"
|
|
56
|
-
"command": "
|
|
55
|
+
"loghead": {
|
|
56
|
+
"command": "loghead",
|
|
57
57
|
"args": ["stdio"]
|
|
58
58
|
}
|
|
59
59
|
```
|
|
@@ -63,40 +63,40 @@ You will see instructions on how to connect your specific AI tool (Claude, Curso
|
|
|
63
63
|
Organize your logs into projects.
|
|
64
64
|
|
|
65
65
|
```bash
|
|
66
|
-
|
|
66
|
+
loghead projects add "My Awesome App"
|
|
67
67
|
```
|
|
68
68
|
|
|
69
69
|
### 3. Add a Log Stream
|
|
70
70
|
|
|
71
|
-
A "stream" is a specific source of logs (e.g., your terminal output, or a specific Docker container). You need the Project ID from the previous step (use `
|
|
71
|
+
A "stream" is a specific source of logs (e.g., your terminal output, or a specific Docker container). You need the Project ID from the previous step (use `loghead projects list` to see it).
|
|
72
72
|
|
|
73
73
|
**Example: Creating a stream for Docker logs**
|
|
74
74
|
|
|
75
75
|
```bash
|
|
76
|
-
|
|
76
|
+
loghead streams add docker --project <PROJECT_ID> --name "Backend API" --container my-api-container
|
|
77
77
|
```
|
|
78
78
|
|
|
79
79
|
**Example: Creating a generic terminal stream**
|
|
80
80
|
|
|
81
81
|
```bash
|
|
82
|
-
|
|
82
|
+
loghead streams add terminal --project <PROJECT_ID> --name "Build Logs"
|
|
83
83
|
```
|
|
84
84
|
|
|
85
85
|
### 4. Ingest Logs
|
|
86
86
|
|
|
87
|
-
Now, feed logs into the stream you created. You need the Stream ID (use `
|
|
87
|
+
Now, feed logs into the stream you created. You need the Stream ID (use `loghead streams list --project <PROJECT_ID>` to find it).
|
|
88
88
|
|
|
89
89
|
**From Standard Input (Manual):**
|
|
90
|
-
You can pipe any command's output into
|
|
90
|
+
You can pipe any command's output into Loghead:
|
|
91
91
|
|
|
92
92
|
```bash
|
|
93
|
-
echo "Something happened" |
|
|
93
|
+
echo "Something happened" | loghead ingest --stream <STREAM_ID>
|
|
94
94
|
```
|
|
95
95
|
|
|
96
96
|
Or run a script and capture its output:
|
|
97
97
|
|
|
98
98
|
```bash
|
|
99
|
-
deno run my_script.ts |
|
|
99
|
+
deno run my_script.ts | loghead ingest --stream <STREAM_ID>
|
|
100
100
|
```
|
|
101
101
|
|
|
102
102
|
### 5. Query Logs (The AI Part)
|
|
@@ -109,37 +109,33 @@ Your AI assistant can now "call" tools to search these logs. It can ask things l
|
|
|
109
109
|
You can also check logs manually:
|
|
110
110
|
|
|
111
111
|
```bash
|
|
112
|
-
|
|
112
|
+
npx loghead log list --stream <STREAM_ID>
|
|
113
113
|
```
|
|
114
114
|
|
|
115
115
|
## Building from Source
|
|
116
116
|
|
|
117
|
-
If you want to build the `
|
|
117
|
+
If you want to build the `loghead` executable yourself (e.g., to contribute or modify it):
|
|
118
118
|
|
|
119
119
|
1. Install **Deno** (see Prerequisites).
|
|
120
120
|
2. Compile the tool into a single executable file in the `build` directory:
|
|
121
121
|
|
|
122
122
|
```bash
|
|
123
123
|
mkdir -p build
|
|
124
|
-
deno
|
|
124
|
+
deno task build
|
|
125
125
|
```
|
|
126
126
|
|
|
127
|
-
3. This will generate the `
|
|
128
|
-
|
|
129
|
-
```bash
|
|
130
|
-
sudo mv build/loggerhead /usr/local/bin/
|
|
131
|
-
```
|
|
127
|
+
3. This will generate the `loghead` binary in your `packages/core/build/` directory.
|
|
132
128
|
|
|
133
129
|
## Architecture Overview
|
|
134
130
|
|
|
135
131
|
- **Language:** TypeScript (Deno)
|
|
136
|
-
- **Database:** SQLite with `sqlite-vec`
|
|
137
|
-
- **AI:** Local Ollama running `
|
|
132
|
+
- **Database:** SQLite with `sqlite-vec` for storing log embeddings.
|
|
133
|
+
- **AI:** Local Ollama running `mxbai-embed-large` (or similar) to understand the semantic meaning of logs.
|
|
138
134
|
- **Protocol:** Model Context Protocol (MCP) for integration with AI agents.
|
|
139
135
|
|
|
140
136
|
## Sample Apps
|
|
141
137
|
|
|
142
|
-
We provide sample applications in the `sample_apps` directory to help you test
|
|
138
|
+
We provide sample applications in the `sample_apps` directory to help you test Loghead's capabilities.
|
|
143
139
|
|
|
144
140
|
### 1. CLI Calculator
|
|
145
141
|
|
|
@@ -149,14 +145,14 @@ A simple script that generates random logs and simulates a crash.
|
|
|
149
145
|
|
|
150
146
|
1. Create a project and a stream:
|
|
151
147
|
```bash
|
|
152
|
-
|
|
148
|
+
npx loghead projects add "Calculator App"
|
|
153
149
|
# Copy Project ID
|
|
154
|
-
|
|
150
|
+
npx loghead streams add terminal --project <PROJECT_ID> --name "CLI Output"
|
|
155
151
|
# Copy Stream ID
|
|
156
152
|
```
|
|
157
|
-
2. Run the calculator and pipe logs to
|
|
153
|
+
2. Run the calculator and pipe logs to Loghead:
|
|
158
154
|
```bash
|
|
159
|
-
deno run sample_apps/cli_calculator/main.ts |
|
|
155
|
+
deno run sample_apps/cli_calculator/main.ts | npx @loghead/terminal --token <TOKEN>
|
|
160
156
|
```
|
|
161
157
|
3. Ask your AI Agent: "Why did the calculator app crash?"
|
|
162
158
|
|
|
@@ -169,7 +165,7 @@ A Python worker process running in Docker that logs tasks and simulates occasion
|
|
|
169
165
|
1. Create a stream for Docker:
|
|
170
166
|
```bash
|
|
171
167
|
# Use existing Project ID
|
|
172
|
-
|
|
168
|
+
npx loghead streams add docker --project <PROJECT_ID> --name "Worker Node" --container worker-app
|
|
173
169
|
# Note the container name "worker-app" matches the --name in docker run below
|
|
174
170
|
# Copy Stream ID
|
|
175
171
|
```
|
|
@@ -179,23 +175,20 @@ A Python worker process running in Docker that logs tasks and simulates occasion
|
|
|
179
175
|
docker build -t docker-app .
|
|
180
176
|
docker run --name worker-app -d docker-app
|
|
181
177
|
```
|
|
182
|
-
3. Attach
|
|
178
|
+
3. Attach Loghead to the container logs:
|
|
183
179
|
```bash
|
|
184
|
-
|
|
180
|
+
npx @loghead/docker --token <TOKEN> --container worker-app
|
|
185
181
|
```
|
|
186
182
|
4. Ask your AI Agent: "What tasks is the worker processing?" or "Are there any performance warnings?"
|
|
187
183
|
|
|
188
184
|
### 3. Browser App
|
|
189
185
|
|
|
190
|
-
A simple HTML/JS Calculator that logs actions to the browser console.
|
|
186
|
+
A simple HTML/JS Calculator that logs actions to the browser console.
|
|
191
187
|
|
|
192
188
|
**How to test:**
|
|
193
189
|
|
|
194
190
|
1. Open `sample_apps/browser_app/index.html` in your browser.
|
|
195
|
-
2.
|
|
196
|
-
3.
|
|
197
|
-
4.
|
|
198
|
-
5.
|
|
199
|
-
```bash
|
|
200
|
-
cat logs.txt | loggerhead ingest --stream <STREAM_ID>
|
|
201
|
-
```
|
|
191
|
+
2. Ensure the Loghead Chrome Extension is installed and connected to a browser stream.
|
|
192
|
+
3. Open Developer Tools (Console).
|
|
193
|
+
4. Perform some calculations (try dividing by zero!).
|
|
194
|
+
5. Logs will automatically appear in your Loghead dashboard.
|
|
Binary file
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@loghead/core",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Smart log aggregation tool and MCP server",
|
|
5
|
+
"bin": {
|
|
6
|
+
"loghead": "./bin/loghead"
|
|
7
|
+
},
|
|
8
|
+
"files": [
|
|
9
|
+
"bin"
|
|
10
|
+
],
|
|
11
|
+
"os": [
|
|
12
|
+
"darwin"
|
|
13
|
+
],
|
|
14
|
+
"cpu": [
|
|
15
|
+
"arm64"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"postinstall": "echo 'Note: This package contains a prebuilt binary for macOS ARM64.'"
|
|
19
|
+
},
|
|
20
|
+
"author": "Onvo AI",
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"publishConfig": {
|
|
23
|
+
"access": "public"
|
|
24
|
+
},
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "git+https://github.com/onvo-ai/loghead.git"
|
|
28
|
+
},
|
|
29
|
+
"bugs": {
|
|
30
|
+
"url": "https://github.com/onvo-ai/loghead/issues"
|
|
31
|
+
}
|
|
32
|
+
}
|