kern-ai 0.14.0 → 0.14.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,YAAY,EAAe,MAAM,IAAI,CAAC;AA2DhE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,YAAY,GAAG,WAAW,GAAG,aAAa,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAC;IACjF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,KAAK,CAAC;YAAE,SAAS,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAC;YAAC,QAAQ,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;KAAE,CAAC;CACnI;AAED,MAAM,MAAM,aAAa,GAAG,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;AAEzD,qBAAa,OAAO;IAClB,OAAO,CAAC,MAAM,CAAc;IAC5B,OAAO,CAAC,YAAY,CAAU;IAC9B,OAAO,CAAC,OAAO,CAAkB;IACjC,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,WAAW,CAA4B;gBAEnC,QAAQ,EAAE,MAAM;IAI5B,cAAc,CAAC,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QAAQ,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;KAAE,CAAC;CACnI;AAED,MAAM,MAAM,aAAa,GAAG,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;AAEzD,qBAAa,OAAO;IAClB,OAAO,CAAC,MAAM,CAAc;IAC5B,OAAO,CAAC,YAAY,CAAU;IAC9B,OAAO,CAAC,OAAO,CAAkB;IACjC,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,WAAW,CAA4B;gBAEnC,QAAQ,EAAE,MAAM;IAI5B,cAAc,CAAC,KAAK,EAAE,WAAW;IAI3B,iBAAiB,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAuB9C,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IA4B3B,OAAO,CAAC,iBAAiB,CAA4D;IAErF,oBAAoB,CAAC,EAAE,EAAE,MAAM;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,EAAE;IAI5D,aAAa,CACjB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,MAAM,CAAC;IAwLlB,OAAO,CAAC,WAAW;IA0BnB,YAAY,IAAI,MAAM,GAAG,IAAI;IAI7B,WAAW,IAAI,YAAY,EAAE;CAG9B"}
package/dist/runtime.js CHANGED
@@ -243,6 +243,10 @@ export class Runtime {
243
243
  }
244
244
  }
245
245
  log("runtime", `stream finished, text length: ${fullText.length}`);
246
+ // If the stream had an error and produced no output, throw to hit error handler
247
+ if (streamError && fullText.length === 0) {
248
+ throw streamError;
249
+ }
246
250
  try {
247
251
  const usage = await result.totalUsage;
248
252
  addTokenUsage(usage.inputTokens || 0, usage.outputTokens || 0);
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.js","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAqB,WAAW,EAAE,MAAM,IAAI,CAAC;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AE,CAAC,CAAC;QACjE,CAAC;IACH,CAAC;IAED,YAAY;QACV,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC;IACrC,CAAC;IAED,WAAW;QACT,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;IACpC,CAAC;CACF"}
@@ -0,0 +1,173 @@
1
+ # Commands
2
+
3
+ ## kern
4
+
5
+ Show help and available commands.
6
+
7
+ ## kern init \<name\>
8
+
9
+ Create a new agent or reconfigure an existing one.
10
+
11
+ **New agent**: interactive wizard asks for provider, API key, model, Telegram/Slack tokens. Scaffolds agent-kernel files (AGENTS.md, IDENTITY.md, KNOWLEDGE.md, USERS.md), creates `.kern/` config, initializes git, registers in `~/.kern/agents.json`, and starts the agent.
12
+
13
+ **Existing agent**: detects by name (from registry) or path. Shows current config with masked secrets. Update any field — press enter to keep current value. Restarts automatically after changes.
14
+
15
+ **Adopting an existing repo**: if the directory exists but has no `.kern/`, creates only `.kern/` config without overwriting existing AGENTS.md, IDENTITY.md, etc.
16
+
17
+ **Non-interactive mode**: pass `--api-key` to skip prompts. For automation and CI.
18
+
19
+ ```bash
20
+ kern init my-agent --api-key sk-or-...
21
+ kern init my-agent --api-key sk-or-... --provider anthropic --model claude-opus-4.6
22
+ kern init my-agent --api-key sk-or-... --telegram-token 123:ABC --slack-bot-token xoxb-... --slack-app-token xapp-...
23
+ ```
24
+
25
+ Defaults to openrouter + claude-opus-4.6 when flags are used.
26
+
27
+ ## kern start [name|path]
28
+
29
+ Start agents as background daemons.
30
+
31
+ - No argument: starts all registered agents
32
+ - With name: starts that agent (looks up in registry)
33
+ - With path: auto-registers and starts (e.g. `kern start ./cloned-repo`)
34
+ - Waits 2 seconds after fork, verifies process is alive
35
+ - Shows error log if startup fails
36
+ - Writes PID and port to `~/.kern/agents.json`
37
+
38
+ ## kern stop [name]
39
+
40
+ Stop agents.
41
+
42
+ - No argument: stops all running agents
43
+ - With name: stops that agent
44
+ - Sends SIGTERM, clears PID from registry
45
+
46
+ ## kern restart [name]
47
+
48
+ Stop then start. 500ms delay between for clean shutdown.
49
+
50
+ ## kern list
51
+
52
+ Show all registered agents with status.
53
+
54
+ - Green dot: running (shows PID and port)
55
+ - Dim dot: stopped
56
+ - Red dot: path not found
57
+ - Shows model, tool scope, session count
58
+
59
+ Aliases: `kern ls`, `kern status`
60
+
61
+ ## kern tui [name]
62
+
63
+ Interactive terminal chat. Connects to running daemon via HTTP/SSE.
64
+
65
+ - No argument, one agent: auto-connects
66
+ - No argument, multiple agents: arrow-key select
67
+ - Auto-starts daemon if not running
68
+ - Cross-channel messages visible in real time
69
+ - Heartbeat activity visible
70
+ - Ctrl-C only exits TUI, daemon stays alive
71
+
72
+ ## kern logs [name]
73
+
74
+ Tail agent logs in real time. Structured, colored output.
75
+
76
+ - No argument: auto-selects agent
77
+ - Logs stored in `.kern/logs/kern.log`
78
+ - Components: `[kern]` `[queue]` `[runtime]` `[telegram]` `[slack]` `[server]`
79
+ - Ctrl-C to stop
80
+
81
+ ## kern remove \<name\>
82
+
83
+ Unregister an agent. Stops it if running. Does not delete files.
84
+
85
+ Alias: `kern rm`
86
+
87
+ ## kern pair \<agent\> \<code\>
88
+
89
+ Approve a pairing code from the command line. No agent interaction needed.
90
+
91
+ ```bash
92
+ kern pair atlas KERN-7X4M
93
+ ```
94
+
95
+ ## kern backup \<name\>
96
+
97
+ Backup an agent to a `.tar.gz` file.
98
+
99
+ - Creates `~/.kern/backups/{name}-{date}.tar.gz`
100
+ - Includes everything: AGENTS.md, IDENTITY.md, knowledge/, notes/, .kern/config.json, .kern/sessions/, .kern/.env, .kern/pairing.json
101
+ - Excludes: .kern/logs/
102
+ - Agent can be running during backup
103
+
104
+ ## kern restore \<file\>
105
+
106
+ Restore an agent from a backup archive.
107
+
108
+ - Extracts to `./{agent-name}/` in the current directory
109
+ - Registers the agent in `~/.kern/agents.json`
110
+ - If agent already exists: warns and asks to confirm overwrite
111
+ - If agent is running: stops it before overwriting
112
+
113
+ ## kern web \<start|stop|status|token\>
114
+
115
+ Manage the web UI server.
116
+
117
+ ```bash
118
+ kern web start # start web UI, prints URL with auth token
119
+ kern web stop # stop it
120
+ kern web status # check if running
121
+ kern web token # print URL with auth token
122
+ ```
123
+
124
+ - Serves the web UI and proxies all agent API requests
125
+ - Agents bind to `127.0.0.1` — only reachable through the proxy
126
+ - `KERN_WEB_TOKEN` auto-generated on first start, stored in `~/.kern/.env`
127
+ - All `/api/*` routes require the web token (Bearer header or `?token=` query param)
128
+ - `kern web start` and `kern web token` always print the full URL with token
129
+ - Port configurable in `~/.kern/config.json` (default 9000)
130
+ - PID tracked in `~/.kern/web.pid`, logs in `~/.kern/web.log`
131
+
132
+ ## kern import opencode
133
+
134
+ Import a session from OpenCode into a kern agent.
135
+
136
+ - Finds OpenCode's SQLite database at `~/.local/share/opencode/opencode.db`
137
+ - Interactive: prompts to select project, session, and target agent
138
+ - Converts messages and tool calls to kern's ModelMessage format
139
+ - Validates tool-call/tool-result pairing
140
+ - Writes to `.kern/sessions/` as JSONL
141
+
142
+ ```bash
143
+ kern import opencode # interactive
144
+ kern import opencode /root/myproject # specify project path
145
+ kern import opencode --agent atlas # specify target agent
146
+ kern import opencode --project /root/myproject --session <id> --agent atlas
147
+ ```
148
+
149
+ ## Slash commands
150
+
151
+ Type these in any channel (TUI, Web, Telegram, Slack). Handled by the runtime at the queue level — never sent to the LLM. Instant, zero tokens. Results are broadcast to all connected clients via SSE.
152
+
153
+ ### /status
154
+
155
+ Show agent runtime status: model, uptime, session size, API usage, queue state, and interface connection status (Telegram, Slack).
156
+
157
+ ### /restart
158
+
159
+ Restart the agent daemon.
160
+
161
+ - 2-second delay to let interfaces acknowledge the message before the process dies
162
+ - Registered as a Telegram bot command (shows in the `/` menu)
163
+ - Safe — no restart loops, no session corruption
164
+ - The agent cannot restart itself — it must ask the operator to type `/restart`
165
+ - Web UI auto-reconnects after restart (re-discovers the new agent port)
166
+
167
+ ### /help
168
+
169
+ List available slash commands with descriptions.
170
+
171
+ ## kern run \<name|path\>
172
+
173
+ Run an agent in the foreground (for development/debugging). Starts all interfaces (Telegram, Slack) in-process.
package/docs/config.md ADDED
@@ -0,0 +1,114 @@
1
+ # Configuration
2
+
3
+ ## Per-agent: .kern/config.json
4
+
5
+ The main config file. Committed to git.
6
+
7
+ ```json
8
+ {
9
+ "model": "anthropic/claude-opus-4.6",
10
+ "provider": "openrouter",
11
+ "toolScope": "full",
12
+ "maxSteps": 30,
13
+ "maxContextTokens": 40000
14
+ }
15
+ ```
16
+
17
+ ### Fields
18
+
19
+ | Field | Default | Description |
20
+ |-------|---------|-------------|
21
+ | `model` | `anthropic/claude-opus-4.6` | Model ID. Format depends on provider. |
22
+ | `provider` | `openrouter` | API provider: `openrouter`, `anthropic`, `openai` |
23
+ | `toolScope` | `full` | Tool access level: `full`, `write`, `read` |
24
+ | `maxSteps` | `30` | Max tool-use steps per message |
25
+ | `maxContextTokens` | `40000` | Estimated token budget for context window. Messages beyond this are trimmed from the front (oldest first). Full history stays in JSONL. |
26
+ | `heartbeatInterval` | `60` | Minutes between heartbeat prompts. Agent reviews notes, updates knowledge. 0 to disable. |
27
+ | `recall` | `true` | Enable recall (long-term memory). Set to `false` to disable. Requires an embedding API key. |
28
+ | `autoRecall` | `false` | Automatically inject relevant old context before each turn. Requires recall enabled. |
29
+
30
+ ### Tool scopes
31
+
32
+ - **full** — bash, read, write, edit, glob, grep, webfetch, kern, message, recall
33
+ - **write** — read, write, edit, glob, grep, webfetch, kern, message, recall
34
+ - **read** — read, glob, grep, webfetch, kern, recall
35
+
36
+ ### Providers
37
+
38
+ - **openrouter** — routes to cheapest provider. Model IDs like `anthropic/claude-opus-4.6`. Uses OpenAI-compatible chat completions API.
39
+ - **anthropic** — direct Anthropic API. Model IDs like `claude-opus-4-6-20260301`.
40
+ - **openai** — OpenAI or Azure. Model IDs like `gpt-4o`.
41
+
42
+ ## Per-agent: .kern/.env
43
+
44
+ Secrets. Gitignored. Never committed.
45
+
46
+ ```
47
+ OPENROUTER_API_KEY=sk-or-...
48
+ TELEGRAM_BOT_TOKEN=...
49
+ SLACK_BOT_TOKEN=xoxb-...
50
+ SLACK_APP_TOKEN=xapp-...
51
+ KERN_AUTH_TOKEN=...
52
+ ```
53
+
54
+ Only set the API keys for providers/interfaces you use.
55
+
56
+ ### Auth tokens
57
+
58
+ **`KERN_AUTH_TOKEN`** — per-agent Bearer token required on all agent API endpoints (except `/health`).
59
+
60
+ - Auto-generated on first agent start — written to `.kern/.env` automatically
61
+ - Registered in `~/.kern/agents.json` so the TUI and web proxy can read it
62
+ - TUI reads it from the registry automatically
63
+ - Web proxy injects it into proxied requests — the browser never sees agent tokens
64
+
65
+ **`KERN_WEB_TOKEN`** — web proxy auth token stored in `~/.kern/.env`.
66
+
67
+ - Auto-generated on first `kern web start`
68
+ - Required on all `/api/*` proxy routes (Bearer header or `?token=` query param)
69
+ - Printed by `kern web start` and `kern web token`
70
+ - Web UI prompts for it on first visit, saves to localStorage
71
+
72
+ You never need to set either token manually unless you want specific values.
73
+
74
+ ## Global: ~/.kern/config.json
75
+
76
+ Global settings for the `kern web` server. Optional — defaults apply if the file doesn't exist.
77
+
78
+ ```json
79
+ {
80
+ "web_port": 9000,
81
+ "web_host": "0.0.0.0"
82
+ }
83
+ ```
84
+
85
+ | Field | Default | Description |
86
+ |-------|---------|-------------|
87
+ | `web_port` | `9000` | Port for the `kern web` UI server. |
88
+ | `web_host` | `0.0.0.0` | Bind address for the web UI server. |
89
+
90
+ ## Global: ~/.kern/agents.json
91
+
92
+ Agent registry. Managed automatically — do not edit by hand.
93
+
94
+ Tracks all registered agents with their name, path, PID, port, and auth token. Updated when agents start/stop.
95
+
96
+ ## .kern/recall.db
97
+
98
+ SQLite database with sqlite-vec extension for the recall tool. Contains three tables: `messages` (raw message content), `chunks` (turn-level summaries), and `vec_chunks` (embeddings). Auto-created on first start. Gitignored. Safe to delete — will be rebuilt on next start from session JSONL files.
99
+
100
+ ## .kern/sessions/
101
+
102
+ Conversation history as JSONL files. One file per session. First line is metadata, rest are messages. Gitignored.
103
+
104
+ ## .kern/pairing.json
105
+
106
+ Pending and paired user data. Transient — codes expire on restart. Paired users persist.
107
+
108
+ ## .kern/usage.json
109
+
110
+ Cumulative API token usage. Persists across restarts.
111
+
112
+ ## .kern/logs/
113
+
114
+ Log files from daemon mode (`kern start`). `kern.log` contains stdout/stderr.
@@ -0,0 +1,111 @@
1
+ # Get Started
2
+
3
+ Create your first kern agent in under a minute.
4
+
5
+ ## Install
6
+
7
+ ```
8
+ npm install -g kern-ai
9
+ ```
10
+
11
+ Requires Node.js 20+.
12
+
13
+ ## Create an agent
14
+
15
+ ```
16
+ kern init my-agent
17
+ ```
18
+
19
+ The wizard asks for:
20
+
21
+ 1. **Provider** — OpenRouter, Anthropic, or OpenAI
22
+ 2. **API key** — paste your key (stored in `.kern/.env`)
23
+ 3. **Model** — pick from the top models for your provider
24
+
25
+ This creates a `my-agent/` directory with:
26
+
27
+ ```
28
+ my-agent/
29
+ ├── IDENTITY.md — who the agent is
30
+ ├── KNOWLEDGE.md — index of knowledge files
31
+ ├── knowledge/ — mutable state files
32
+ ├── notes/ — daily narrative logs
33
+ └── .kern/
34
+ ├── config.json — model, provider, settings
35
+ └── .env — API keys
36
+ ```
37
+
38
+ ## Start the agent
39
+
40
+ ```
41
+ kern start
42
+ ```
43
+
44
+ The agent runs as a background daemon. Start once, connect from anywhere.
45
+
46
+ ## Chat from the terminal
47
+
48
+ ```
49
+ kern tui
50
+ ```
51
+
52
+ Interactive terminal chat. Type a message, get a response. The agent has tools — it can run commands, read/write files, search the web.
53
+
54
+ ## Chat from the browser
55
+
56
+ ```
57
+ kern web start
58
+ ```
59
+
60
+ Opens a web UI. Agent sidebar, slash commands, markdown rendering, collapsible tool output. Share the URL with others on your network.
61
+
62
+ ## Add Telegram
63
+
64
+ 1. Create a bot with [@BotFather](https://t.me/BotFather)
65
+ 2. Add the token to your config:
66
+
67
+ ```
68
+ kern init my-agent
69
+ ```
70
+
71
+ Select Telegram and paste the token. Restart the agent:
72
+
73
+ ```
74
+ kern restart my-agent
75
+ ```
76
+
77
+ Message your bot on Telegram — same agent, same memory.
78
+
79
+ ## Add Slack
80
+
81
+ 1. Create a Slack app with Socket Mode enabled
82
+ 2. Add bot token and app token to your config via `kern init`
83
+ 3. Invite the bot to channels
84
+
85
+ The agent reads every message in channels it's in but only responds when @mentioned or directly relevant.
86
+
87
+ ## User pairing
88
+
89
+ The first person to message the agent becomes the operator. Everyone else gets a pairing code:
90
+
91
+ 1. New user messages the agent → receives `KERN-XXXX`
92
+ 2. They share the code with you
93
+ 3. You approve it: `kern pair my-agent KERN-XXXX`
94
+
95
+ ## Agent memory
96
+
97
+ The agent maintains its own memory:
98
+
99
+ - **`knowledge/`** — facts about the current state of things. Mutable. The agent updates these as things change.
100
+ - **`notes/`** — daily logs of what happened. Append-only. The agent writes these at the end of each session.
101
+ - **Recall** — semantic search over all past conversations. Even after messages leave the context window, the agent can find them.
102
+
103
+ Everything is plain text and git-trackable.
104
+
105
+ ## What's next
106
+
107
+ - [Configuration](/docs/config) — model, provider, heartbeat, tool scope
108
+ - [Commands](/docs/commands) — full CLI reference
109
+ - [Interfaces](/docs/interfaces) — terminal, web, Telegram, Slack
110
+ - [Tools](/docs/tools) — bash, read, write, edit, grep, fetch, recall
111
+ - [Pairing](/docs/pairing) — user authentication and access control
@@ -0,0 +1,155 @@
1
+ # Interfaces
2
+
3
+ kern supports multiple interfaces simultaneously. Each agent runs as a daemon with all configured interfaces active.
4
+
5
+ ## TUI
6
+
7
+ Interactive terminal chat. Connects to a running daemon via HTTP/SSE.
8
+
9
+ ```bash
10
+ kern tui [name]
11
+ ```
12
+
13
+ - Always the operator (the person who created the agent)
14
+ - Auto-starts daemon if not running
15
+ - Auto-selects agent if only one registered
16
+ - Shows cross-channel messages in real time
17
+ - Renders Markdown (code blocks, quotes, bold, italic)
18
+ - Live connection indicator (`●`/`○`) that automatically reconnects
19
+ - **Mid-turn messaging** — input stays enabled while agent is working. Messages are injected between tool steps.
20
+ - Ctrl-C only kills TUI, daemon stays alive
21
+
22
+ Message styling (colored left borders):
23
+ - **green** — your input and outgoing messages to other channels
24
+ - **yellow** — incoming from other channels (Telegram, Slack, Web)
25
+ - **magenta** — heartbeat
26
+ - Assistant responses are plain text, indented
27
+ - Tool calls are color-coded by tool name (bash=red, read=cyan, write=green, edit=yellow, glob=magenta, grep=blue)
28
+
29
+ ## Web UI
30
+
31
+ Browser-based chat interface. Runs as a separate process from agents — `kern web` serves the UI, agents serve their APIs.
32
+
33
+ ### Setup
34
+
35
+ ```bash
36
+ kern web start # start web UI, prints URL with token
37
+ kern web stop # stop it
38
+ kern web status # check if running
39
+ kern web token # print URL with token again
40
+ ```
41
+
42
+ `kern web start` prints a URL with the auth token. Open it to connect:
43
+
44
+ ```
45
+ ● web started (pid 12345, port 9000)
46
+ → http://localhost:9000?token=abc123...
47
+ ```
48
+
49
+ Over Tailscale or LAN, use the machine's hostname or IP with the same token.
50
+
51
+ ### Architecture
52
+
53
+ - `kern web` serves the HTML page and proxies all API requests to agents
54
+ - Agents bind to `127.0.0.1` on random ports — only reachable locally via the proxy
55
+ - The web proxy injects agent auth tokens automatically — the browser never sees them
56
+ - Single `KERN_WEB_TOKEN` protects the proxy layer
57
+
58
+ ### Agent discovery
59
+
60
+ - **Local agents** are auto-discovered from `~/.kern/agents.json`. The sidebar shows them grouped under the local server.
61
+ - **Remote servers** can be added in the sidebar ("Add server" with URL + token). Agents on remote servers are fetched and grouped by server hostname. Stored in browser localStorage.
62
+
63
+ ### Authentication
64
+
65
+ Two layers:
66
+
67
+ 1. **Web proxy auth** — `KERN_WEB_TOKEN` in `~/.kern/.env`, auto-generated on first `kern web start`. Required on all `/api/*` routes. Web UI prompts for it on first visit, saves to localStorage. Logout button in sidebar clears it.
68
+
69
+ 2. **Agent auth** — per-agent `KERN_AUTH_TOKEN` in `.kern/.env`, auto-generated on first agent start. The web proxy reads these from `~/.kern/agents.json` and injects them into proxied requests. Users never interact with agent tokens.
70
+
71
+ ### Features
72
+
73
+ - **Agent sidebar** — left panel with agents grouped by server, online/offline status dots, collapsible on desktop, slide-out on mobile
74
+ - **Slash commands** — `/status`, `/restart`, `/help` with autocomplete popup
75
+ - **Collapsible tool output** — click a tool call to expand and see the result. Edit tools show inline diffs (red/green).
76
+ - **TUI-style message colors** — user (blue), incoming from Telegram/Slack (yellow), outgoing (green), heartbeat (magenta), per-tool colors
77
+ - **Streaming responses** with live cursor and thinking indicator
78
+ - **Mid-turn messaging** — input stays enabled while agent is working. Send follow-up messages or corrections that get injected between tool steps.
79
+ - **Full history** on connect, including tool call results
80
+ - **Agent info panel** — version, model, tools, Telegram/Slack connection status, uptime, session stats, API usage, queue state, connection string with copy
81
+ - **Auto-reconnect** — re-discovers agent port after restart
82
+ - **Dark theme**, mobile-friendly, PWA support
83
+
84
+ ### Global config
85
+
86
+ Web server port and host are configured in `~/.kern/config.json`:
87
+
88
+ ```json
89
+ {
90
+ "web_port": 9000,
91
+ "web_host": "0.0.0.0"
92
+ }
93
+ ```
94
+
95
+ Optional — defaults apply if the file doesn't exist.
96
+
97
+ ## Telegram
98
+
99
+ Long polling bot. Works behind NAT, no public URL needed.
100
+
101
+ ### Setup
102
+
103
+ 1. Message @BotFather on Telegram, create a bot, get the token
104
+ 2. Add `TELEGRAM_BOT_TOKEN=...` to `.kern/.env`
105
+ 3. Restart the agent
106
+
107
+ ### Behavior
108
+
109
+ - Unpaired users get a pairing code
110
+ - Paired users can chat normally
111
+ - Responses stream with typing indicator
112
+ - Tool calls shown live (⚙), replaced by response
113
+ - Markdown converted to Telegram HTML
114
+ - Connection status reported in `/status` (connected/disconnected/error)
115
+ - Graceful shutdown: polling stops cleanly on SIGTERM — no 409 conflicts on restart
116
+ - If a 409 conflict occurs (e.g. rapid restart), retries automatically after 5 seconds
117
+
118
+ ## Slack
119
+
120
+ Socket Mode connection. No public URL needed.
121
+
122
+ ### Setup
123
+
124
+ 1. Create a Slack app at https://api.slack.com/apps
125
+ 2. Enable **Socket Mode** in the app settings — generates an app-level token (`xapp-...`)
126
+ 3. Add bot token scopes:
127
+ - `chat:write` — send messages
128
+ - `channels:read` — read channel info
129
+ - `channels:history` — read channel messages
130
+ - `groups:read` — read private channel info
131
+ - `groups:history` — read private channel messages
132
+ - `im:read` — read DM info
133
+ - `im:write` — send DMs
134
+ - `im:history` — read DM history
135
+ 4. Install the app to your workspace — get bot token (`xoxb-...`)
136
+ 5. Subscribe to bot events:
137
+ - `message.channels` — messages in public channels
138
+ - `message.groups` — messages in private channels
139
+ - `message.im` — direct messages
140
+ 6. Add tokens to `.kern/.env`:
141
+ ```
142
+ SLACK_BOT_TOKEN=xoxb-...
143
+ SLACK_APP_TOKEN=xapp-...
144
+ ```
145
+ 7. Invite the bot to channels where it should listen
146
+ 8. Restart the agent
147
+
148
+ ### Behavior
149
+
150
+ - **DMs**: pairing required. Unpaired users get a code.
151
+ - **Channels**: agent reads ALL messages but only responds when @mentioned or directly relevant. Returns `NO_REPLY` to suppress silent messages.
152
+ - **Replies**: all replies post directly to the channel or DM (no threading).
153
+ - Agent can send proactive messages via the `message` tool.
154
+ - Connection status reported in `/status` (connected/disconnected/error).
155
+ - Graceful shutdown: Socket Mode connection closes cleanly on SIGTERM.
@@ -0,0 +1,72 @@
1
+ # User Pairing
2
+
3
+ kern uses a code-based pairing system. No allowlists — every user pairs through the agent.
4
+
5
+ ## Flow
6
+
7
+ 1. Unknown user messages the bot (Telegram DM or Slack DM)
8
+ 2. Bot responds with a pairing code: `KERN-XXXX`
9
+ 3. User shares the code with the operator out-of-band (text, email, in person)
10
+ 4. Operator tells the agent who this person is:
11
+ > "pair KERN-7X4M — that's Sarah, my cofounder, she handles finance but shouldn't see personal stuff"
12
+ 5. Agent calls `kern({ action: "pair", code: "KERN-7X4M" })`
13
+ 6. Agent updates `USERS.md` with identity, role, and access notes
14
+ 7. User is now paired and can chat
15
+
16
+ ## Pairing codes
17
+
18
+ - Format: `KERN-XXXX` (4 uppercase chars, no ambiguous characters I/O/0/1)
19
+ - Stored in `.kern/pairing.json` (gitignored)
20
+ - One code per user — if they message again, same code is returned
21
+ - Codes survive until paired or agent restarts
22
+
23
+ ## USERS.md
24
+
25
+ After pairing, the agent writes user info to `USERS.md`. This is a kern-specific file (not part of agent-kernel).
26
+
27
+ Example:
28
+ ```markdown
29
+ # Users
30
+
31
+ ## Sarah
32
+ - Telegram: 12345678
33
+ - Role: cofounder
34
+ - Access: financials, not personal
35
+ - Paired: 2026-03-24
36
+ - Notes: handles quarterly reports
37
+
38
+ ## Igor
39
+ - Telegram: 5292022513
40
+ - Role: friend, testing
41
+ - Access: general
42
+ - Paired: 2026-03-24
43
+ ```
44
+
45
+ The agent manages this file — reads it to know who people are, updates it as it learns more about users.
46
+
47
+ ## Operator
48
+
49
+ The first person to message the bot is auto-paired as the operator — no code needed, silent. The TUI is also always the operator.
50
+
51
+ Every subsequent user goes through the pairing code flow.
52
+
53
+ ## Approving users
54
+
55
+ Three ways to approve:
56
+
57
+ 1. **Through the agent** — tell it "pair KERN-XXXX — that's Sarah"
58
+ 2. **CLI** — `kern pair <agent> <code>` (no agent interaction needed)
59
+ 3. **kern tool** — agent calls `kern({ action: "pair", code: "KERN-XXXX" })`
60
+
61
+ ## Checking users
62
+
63
+ ```
64
+ kern({ action: "users" })
65
+ ```
66
+
67
+ Returns all paired users and pending pairing codes.
68
+
69
+ ## Storage
70
+
71
+ - `.kern/pairing.json` — pending codes and paired user IDs with chat IDs
72
+ - `USERS.md` — human-readable user directory managed by the agent
package/docs/tools.md ADDED
@@ -0,0 +1,163 @@
1
+ # Tools
2
+
3
+ kern provides 11 built-in tools. Availability depends on `toolScope` in config.
4
+
5
+ ## bash
6
+
7
+ Run shell commands. Full access to the system.
8
+
9
+ ```
10
+ bash({ command: "ls -la", timeout: 120000 })
11
+ ```
12
+
13
+ - `command` — shell command to execute
14
+ - `timeout` — optional, milliseconds (default 120000)
15
+
16
+ Scope: `full` only.
17
+
18
+ ## read
19
+
20
+ Read a file or list a directory.
21
+
22
+ ```
23
+ read({ path: "IDENTITY.md", offset: 1, limit: 2000 })
24
+ ```
25
+
26
+ - `path` — absolute or relative path
27
+ - `offset` — line number to start from (1-indexed, default 1)
28
+ - `limit` — max lines to return (default 2000)
29
+
30
+ Returns file contents with line numbers, or directory entries.
31
+
32
+ ## write
33
+
34
+ Create or overwrite a file.
35
+
36
+ ```
37
+ write({ path: "notes/2026-03-24.md", content: "# Today\n..." })
38
+ ```
39
+
40
+ Creates parent directories as needed.
41
+
42
+ ## edit
43
+
44
+ Exact string replacement in a file.
45
+
46
+ ```
47
+ edit({ path: "config.json", oldString: "opus-4", newString: "opus-4.6", replaceAll: false })
48
+ ```
49
+
50
+ - `oldString` must match exactly
51
+ - `replaceAll` — replace all occurrences (default false)
52
+
53
+ ## glob
54
+
55
+ Find files by pattern.
56
+
57
+ ```
58
+ glob({ pattern: "**/*.md", path: "/root/atlas" })
59
+ ```
60
+
61
+ ## grep
62
+
63
+ Search file contents with regex.
64
+
65
+ ```
66
+ grep({ pattern: "TODO", path: ".", include: "*.md" })
67
+ ```
68
+
69
+ ## webfetch
70
+
71
+ Fetch a URL and return the response body.
72
+
73
+ ```
74
+ webfetch({ url: "https://example.com", timeout: 30000 })
75
+ ```
76
+
77
+ Truncates responses over 50000 chars.
78
+
79
+ ## kern
80
+
81
+ Manage the runtime.
82
+
83
+ ```
84
+ kern({ action: "status" }) // runtime info, context size, API usage, queue, interface status
85
+ kern({ action: "config" }) // show .kern/config.json
86
+ kern({ action: "env" }) // show env var names (masked values)
87
+ kern({ action: "pair", code: "KERN-XXXX" }) // approve a pairing code
88
+ kern({ action: "users" }) // list paired and pending users
89
+ ```
90
+
91
+ ## message
92
+
93
+ Send a message to a user on any channel.
94
+
95
+ ```
96
+ message({ userId: "12345", interface: "telegram", text: "Hello!" })
97
+ ```
98
+
99
+ - `userId` — from USERS.md or pairing data
100
+ - `interface` — `telegram` or `slack`
101
+ - Looks up chatId from pairing data
102
+ - Broadcasts outgoing event to TUI
103
+
104
+ ## recall
105
+
106
+ Search long-term memory for old conversations outside the current context window. Two modes:
107
+
108
+ ### Search mode
109
+
110
+ ```
111
+ recall({ query: "pfSense firewall rules", limit: 5, after: "2026-03-25", before: "2026-03-28" })
112
+ ```
113
+
114
+ - `query` — semantic search query
115
+ - `limit` — max results (default 5)
116
+ - `after` — only results after this date (ISO 8601 or YYYY-MM-DD)
117
+ - `before` — only results before this date
118
+
119
+ Returns matching conversation chunks with distance score, timestamp, session ID, and message range.
120
+
121
+ ### Load mode
122
+
123
+ ```
124
+ recall({ sessionId: "96fbe7c5-...", messageStart: 100, messageEnd: 110 })
125
+ ```
126
+
127
+ - `sessionId` — session to load from
128
+ - `messageStart` / `messageEnd` — message index range
129
+
130
+ Returns raw messages for a specific range — use after search to get full context around a hit.
131
+
132
+ ### How it works
133
+
134
+ On startup, kern indexes the current session's messages into a local sqlite-vec database (`.kern/recall.db`). Indexing runs in the background — the agent is available immediately while the index builds. Raw messages are stored in sqlite alongside embedded chunks, so retrieval doesn't need to read session files.
135
+
136
+ Messages are chunked by turn (user→assistant pairs), embedded via `text-embedding-3-small`, and stored as vectors. After each turn, new messages are incrementally indexed — only new lines are parsed.
137
+
138
+ Search uses cosine similarity (KNN) to find the most relevant past conversation chunks.
139
+
140
+ Check indexing status via `kern({ action: "status" })` — the `recall` field shows message/chunk counts and whether the index is still building.
141
+
142
+ ### Requirements
143
+
144
+ Requires an API key for the configured provider (used for embeddings). Uses `text-embedding-3-small` (1536 dimensions).
145
+
146
+ ### Auto-recall
147
+
148
+ When `"autoRecall": true` is set in config, kern automatically injects relevant old context before each turn:
149
+
150
+ - Embeds the user's message and searches the recall index (top 3 results, distance < 0.95)
151
+ - Skips chunks already visible in the current context window
152
+ - Injects a `<recall>` block at the top of the context (ephemeral — not persisted to session)
153
+ - Capped at ~2000 tokens to avoid bloating context
154
+
155
+ The web UI shows a collapsible `📎 N memories recalled` block with the search query and chunk details.
156
+
157
+ Auto-recall only fires when messages have been trimmed from context (long sessions). Short sessions with everything in context don't trigger it.
158
+
159
+ ### Opt-out
160
+
161
+ Set `"recall": false` in `.kern/config.json` to disable recall entirely.
162
+
163
+ Set `"autoRecall": false` (or omit it) to disable auto-injection while keeping the recall search tool available.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kern-ai",
3
- "version": "0.14.0",
3
+ "version": "0.14.1",
4
4
  "description": "Simple agent runtime. Persistent memory, tools, Telegram.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -9,7 +9,8 @@
9
9
  },
10
10
  "files": [
11
11
  "dist",
12
- "templates"
12
+ "templates",
13
+ "docs"
13
14
  ],
14
15
  "scripts": {
15
16
  "build": "tsc",
@@ -25,7 +25,7 @@
25
25
  --green: #12c905;
26
26
  --red: #fc533a;
27
27
  --orange: #fcd53a;
28
- --tool-bg: #1e1e1e;
28
+ --tool-bg: #141414;
29
29
  --user-bg: #0d419d;
30
30
  --magenta: #bc8cff;
31
31
  --yellow: #d29922;
@@ -85,6 +85,26 @@
85
85
  padding: 6px;
86
86
  }
87
87
 
88
+ .sidebar-footer {
89
+ padding: 10px 14px;
90
+ border-top: 1px solid var(--border);
91
+ display: flex;
92
+ gap: 12px;
93
+ font-size: 12px;
94
+ }
95
+ .sidebar-footer a {
96
+ color: var(--text-muted);
97
+ text-decoration: none;
98
+ }
99
+ .sidebar-footer a:hover {
100
+ color: var(--text);
101
+ }
102
+ .sidebar-version {
103
+ margin-left: auto;
104
+ color: var(--text-muted);
105
+ opacity: 0.6;
106
+ }
107
+
88
108
  /* Add agent modal */
89
109
  .modal-overlay {
90
110
  display: none;
@@ -406,8 +426,7 @@
406
426
  align-self: flex-end;
407
427
  background: var(--bg-surface);
408
428
  color: #d4d4d4;
409
- border-right: 3px solid var(--accent);
410
- border-radius: 8px 0 0 8px;
429
+ border-radius: 8px;
411
430
  }
412
431
  .message.user-remote {
413
432
  align-self: flex-end;
@@ -446,8 +465,8 @@
446
465
  .message.tool {
447
466
  align-self: flex-start;
448
467
  background: var(--tool-bg);
449
- border-left: 3px solid var(--text-muted);
450
- border-radius: 0;
468
+ border: none;
469
+ border-radius: 6px;
451
470
  font-family: var(--font-mono);
452
471
  font-size: 12px;
453
472
  color: var(--text-dim);
@@ -459,12 +478,19 @@
459
478
  .message.tool .tool-arrow { font-size: 10px; color: var(--text-muted); transition: transform 0.15s; }
460
479
  .message.tool.expanded .tool-arrow { transform: rotate(90deg); }
461
480
  .message.tool .tool-name { font-weight: 600; }
481
+ .message.tool.tool-bash-style {
482
+ background: var(--tool-bg);
483
+ border: none;
484
+ border-radius: 6px;
485
+ padding: 6px 12px;
486
+ }
487
+ .message.tool .tool-prompt { color: var(--text-muted); user-select: none; }
462
488
  .message.tool .tool-detail { color: var(--text-muted); }
463
489
  .message.tool .tool-output {
464
490
  display: none;
465
491
  margin-top: 6px;
466
492
  padding: 8px;
467
- background: var(--bg);
493
+ background: var(--tool-bg);
468
494
  border-radius: 4px;
469
495
  font-size: 11px;
470
496
  line-height: 1.4;
@@ -874,11 +900,15 @@
874
900
 
875
901
  <div class="sidebar" id="sidebar">
876
902
  <div class="sidebar-header">
877
- <span>kern<span style="color:#58a6ff">.</span></span>
903
+ <a href="https://kern-ai.com" target="_blank" rel="noopener" style="color:inherit;text-decoration:none;">kern<span style="color:#58a6ff">.</span></a>
878
904
  <button class="filter-btn" id="logout-btn" title="Logout" style="font-size:14px;">&#x23FB;</button>
879
905
  </div>
880
906
  <div class="sidebar-list" id="switcher-list"></div>
881
-
907
+ <div class="sidebar-footer">
908
+ <a href="https://kern-ai.com/docs" target="_blank" rel="noopener">Docs</a>
909
+ <a href="https://github.com/oguzbilgic/kern-ai" target="_blank" rel="noopener" title="GitHub"><svg viewBox="0 0 16 16" width="14" height="14" fill="currentColor"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"/></svg></a>
910
+ <span class="sidebar-version" id="sidebar-version"></span>
911
+ </div>
882
912
  </div>
883
913
 
884
914
  <div class="modal-overlay" id="auth-modal">
@@ -1375,6 +1405,7 @@ function switchToAgent(agent) {
1375
1405
  if (window.innerWidth <= 768) closeSidebar();
1376
1406
  renderSwitcher();
1377
1407
  init();
1408
+ inputEl.focus();
1378
1409
  }
1379
1410
 
1380
1411
  function toggleSidebar() {
@@ -1576,7 +1607,12 @@ function addMessage(type, content, meta, toolInput, timestamp, iface) {
1576
1607
  const toolDetail = spaceIdx > 0 ? content.slice(spaceIdx) : '';
1577
1608
  const color = TOOL_COLORS[toolName] || 'var(--text-dim)';
1578
1609
  el.style.borderLeftColor = color;
1579
- el.innerHTML = `<div class="tool-header"><span class="tool-arrow">&#9654;</span><span class="tool-name" style="color:${color}">${toolName}</span><span class="tool-detail">${toolDetail}</span></div><div class="tool-output"></div>`;
1610
+ if (toolName === 'bash') {
1611
+ el.classList.add('tool-bash-style');
1612
+ el.innerHTML = `<div class="tool-header"><span class="tool-prompt">$</span><span class="tool-detail">${toolDetail}</span></div><div class="tool-output"></div>`;
1613
+ } else {
1614
+ el.innerHTML = `<div class="tool-header"><span class="tool-arrow">&#9654;</span><span class="tool-name" style="color:${color}">${toolName}</span><span class="tool-detail">${toolDetail}</span></div><div class="tool-output"></div>`;
1615
+ }
1580
1616
  // Pre-fill tool output from input for specific tools
1581
1617
  if (toolName === 'edit' && toolInput) {
1582
1618
  const diff = formatEditDiff(toolInput);
@@ -1958,6 +1994,7 @@ async function init() {
1958
1994
  const resolvedName = status.agentName || 'kern';
1959
1995
  agentNameEl.textContent = resolvedName;
1960
1996
  setActiveAgent(resolvedName);
1997
+ if (status.version) $('sidebar-version').textContent = 'v' + status.version;
1961
1998
  } catch {
1962
1999
  agentNameEl.textContent = 'kern';
1963
2000
  }
@@ -2034,7 +2071,6 @@ async function init() {
2034
2071
  onEvent: handleEvent,
2035
2072
  onConnect() {
2036
2073
  setConnected('connected');
2037
- addMessage('system', 'connected');
2038
2074
  },
2039
2075
  async onDisconnect() {
2040
2076
  if (authFailed || intentionalClose) return;