@kernel.chat/kbot 3.0.0 → 3.0.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.
Files changed (2) hide show
  1. package/README.md +115 -13
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  <p align="center">
2
2
  <strong>K:BOT</strong><br>
3
- <em>Terminal AI agent that learns your patterns.</em>
3
+ <em>Terminal AI agent framework that learns your patterns.</em>
4
4
  </p>
5
5
 
6
6
  <p align="center">
@@ -11,14 +11,27 @@
11
11
  <a href="https://discord.gg/pYJn3hBqnz"><img src="https://img.shields.io/badge/discord-join-6B5B95?logo=discord&logoColor=white" alt="Discord"></a>
12
12
  </p>
13
13
 
14
- <!-- TODO: Replace with actual demo GIF after recording -->
15
- <!-- <p align="center"><img src="https://raw.githubusercontent.com/isaacsight/kernel/main/packages/kbot/demo.gif" alt="kbot demo" width="600"></p> -->
16
-
17
14
  ```bash
18
15
  npm install -g @kernel.chat/kbot
19
16
  ```
20
17
 
21
- **22 specialist agents. 223 tools. 20 providers. Runs offline. MIT licensed.**
18
+ **22 specialist agents. 246 tools. 20 providers. Programmatic SDK. Runs offline. MIT licensed.**
19
+
20
+ ---
21
+
22
+ ## What's New in v3.0.0
23
+
24
+ K:BOT is now a **framework**, not just a CLI. Seven architectural changes:
25
+
26
+ | Feature | What it means |
27
+ |---------|---------------|
28
+ | **Checkpointing** | Sessions survive crashes. Resume from the last tool call, not the beginning. |
29
+ | **Bayesian Routing** | Agents earn skill ratings via Bradley-Terry model. Routing gets smarter with every interaction. |
30
+ | **Programmatic SDK** | `import { agent, tools } from '@kernel.chat/kbot'` — use K:BOT as a library in your own apps. |
31
+ | **Middleware Pipeline** | Composable Express-style middleware for tool execution. Plugins can hook into every tool call. |
32
+ | **Terminal Enhancement** | Braille sparklines, truecolor gradients, Kitty/iTerm2 inline images, synchronized output. |
33
+ | **Lazy Loading** | Core tools load in ~200ms. 41 other modules load in background. Instant one-shot commands. |
34
+ | **Structured Streaming** | Typed event protocol — `ResponseStream` with async iterator, SSE endpoint, MCP integration. |
22
35
 
23
36
  ---
24
37
 
@@ -28,9 +41,10 @@ Most AI coding tools lock you into one provider and forget everything between se
28
41
 
29
42
  - **20 providers, zero lock-in** — Claude, GPT, Gemini, Grok, DeepSeek, Groq, Mistral, and 13 more. Switch anytime.
30
43
  - **Runs fully offline** — Embedded llama.cpp runs GGUF models directly. No Ollama needed. $0, fully private.
31
- - **Learns your patterns** — Extracts what works from every conversation. Gets faster and smarter over time.
32
- - **22 specialist agents** — Say "fix the auth bug" and it picks the coder. Say "research JWT tokens" and it picks the researcher. Auto-routed.
33
- - **Self-evaluating** — Every response scored on quality. Low score? Auto-retries with feedback.
44
+ - **Learns your patterns** — Bayesian skill ratings + pattern extraction. Gets faster and smarter over time.
45
+ - **22 specialist agents** — Say "fix the auth bug" and it routes to `coder`. Say "research JWT tokens" and it routes to `researcher`. Auto-routed with probabilistic confidence.
46
+ - **Crash-proof** — Checkpoints after every tool call. Resume interrupted sessions automatically.
47
+ - **Use as a library** — Clean SDK with typed exports. Build your own tools on top of K:BOT.
34
48
  - **Works in your IDE** — Built-in MCP server for VS Code, Cursor, Zed, Neovim. ACP for JetBrains.
35
49
 
36
50
  ## Install
@@ -65,9 +79,42 @@ kbot local
65
79
  kbot -p "generate a user roles migration" > migration.sql
66
80
  ```
67
81
 
82
+ ## SDK — Use K:BOT as a Library
83
+
84
+ ```typescript
85
+ import { agent, tools, providers } from '@kernel.chat/kbot'
86
+
87
+ // Run the agent programmatically
88
+ const result = await agent.run("fix the auth bug", { agent: 'coder' })
89
+ console.log(result.content) // AI response
90
+ console.log(result.toolCalls) // tools it used
91
+ console.log(result.usage) // token counts
92
+
93
+ // Stream responses
94
+ for await (const event of agent.stream("explain this code")) {
95
+ if (event.type === 'content_delta') process.stdout.write(event.text)
96
+ if (event.type === 'tool_call_start') console.log(`Using: ${event.name}`)
97
+ }
98
+
99
+ // Execute tools directly
100
+ const files = await tools.execute('glob', { pattern: 'src/**/*.ts' })
101
+ console.log(files.result)
102
+
103
+ // List all 246 tools
104
+ console.log(tools.list().map(t => t.name))
105
+ ```
106
+
107
+ ### SDK Exports
108
+
109
+ ```typescript
110
+ import { agent, tools, providers } from '@kernel.chat/kbot' // Main SDK
111
+ import { SilentUIAdapter, CallbackUIAdapter } from '@kernel.chat/kbot' // UI adapters
112
+ import { ResponseStream } from '@kernel.chat/kbot' // Streaming
113
+ ```
114
+
68
115
  ## Specialists
69
116
 
70
- Auto-routed by intent, or pick one with `kbot --agent <name>`:
117
+ Auto-routed by Bayesian skill ratings, or pick one with `kbot --agent <name>`:
71
118
 
72
119
  | | Agents |
73
120
  |---|---|
@@ -82,7 +129,7 @@ kbot --agent guardian "review src/auth.ts for security issues"
82
129
  kbot --agent coder "refactor this into smaller functions"
83
130
  ```
84
131
 
85
- ## 223 Tools
132
+ ## 246 Tools
86
133
 
87
134
  | Category | Examples |
88
135
  |----------|---------|
@@ -92,10 +139,36 @@ kbot --agent coder "refactor this into smaller functions"
92
139
  | **Web** | search, fetch, browser automation |
93
140
  | **Research** | arXiv, Semantic Scholar, HuggingFace, NASA, DOI |
94
141
  | **Data** | CSV read/query/write, transforms, reports, invoices |
142
+ | **Deploy** | Vercel, Netlify, Cloudflare Workers/Pages, Fly.io, Railway |
143
+ | **Database** | Postgres, MySQL, SQLite queries, Prisma, ER diagrams |
95
144
  | **Containers** | Docker build/run/compose, Terraform |
96
145
  | **VFX** | GLSL shaders, FFmpeg, ImageMagick, Blender, procedural textures |
97
146
  | **IDE** | MCP server, ACP server, LSP bridge |
98
- | **Meta** | subagents, worktrees, planner, memory, sessions |
147
+ | **Meta** | subagents, worktrees, planner, memory, sessions, checkpoints |
148
+
149
+ ## Middleware Pipeline
150
+
151
+ Extend tool execution with composable middleware:
152
+
153
+ ```typescript
154
+ import { ToolPipeline, executionMiddleware } from '@kernel.chat/kbot/tools'
155
+
156
+ const pipeline = new ToolPipeline()
157
+
158
+ // Add custom logging middleware
159
+ pipeline.use(async (ctx, next) => {
160
+ console.log(`Calling ${ctx.toolName}...`)
161
+ await next()
162
+ console.log(`${ctx.toolName} took ${ctx.durationMs}ms`)
163
+ })
164
+
165
+ // Add the actual execution
166
+ pipeline.use(executionMiddleware(myExecutor))
167
+
168
+ await pipeline.execute({ toolName: 'bash', toolArgs: { command: 'ls' }, toolCallId: '1', metadata: {}, aborted: false })
169
+ ```
170
+
171
+ Built-in middleware: `permissionMiddleware`, `hookMiddleware`, `timeoutMiddleware`, `metricsMiddleware`, `truncationMiddleware`, `telemetryMiddleware`.
99
172
 
100
173
  ## 20 Providers
101
174
 
@@ -139,6 +212,33 @@ kbot local --embedded
139
212
  # GPU-accelerated: Metal (Mac), CUDA (Linux/Windows), Vulkan
140
213
  ```
141
214
 
215
+ ## Structured Streaming
216
+
217
+ Stream typed events to any consumer:
218
+
219
+ ```typescript
220
+ import { ResponseStream } from '@kernel.chat/kbot'
221
+
222
+ const stream = new ResponseStream()
223
+
224
+ // Subscribe to events
225
+ stream.on((event) => {
226
+ switch (event.type) {
227
+ case 'content_delta': process.stdout.write(event.text); break
228
+ case 'tool_call_start': console.log(`Tool: ${event.name}`); break
229
+ case 'tool_result': console.log(`Result: ${event.result}`); break
230
+ case 'usage': console.log(`Tokens: ${event.inputTokens} in, ${event.outputTokens} out`); break
231
+ }
232
+ })
233
+
234
+ // Or use as async iterator
235
+ for await (const event of stream) {
236
+ // handle each event
237
+ }
238
+ ```
239
+
240
+ **HTTP SSE**: `POST /stream` when running `kbot serve` — standard Server-Sent Events.
241
+
142
242
  ## IDE Integration
143
243
 
144
244
  ```json
@@ -161,9 +261,9 @@ Works with Claude Code, Cursor, VS Code, Windsurf, Zed, Neovim. Exposes file ops
161
261
  | `kbot "prompt"` | One-shot execution |
162
262
  | `kbot auth` | Configure API key |
163
263
  | `kbot local` | Use local AI (Ollama, embedded, LM Studio, Jan) |
264
+ | `kbot serve` | Start HTTP REST + SSE streaming server |
164
265
  | `kbot audit <repo>` | Security + quality audit of any GitHub repo |
165
266
  | `kbot contribute <repo>` | Find good-first-issues and quick wins |
166
- | `kbot serve` | Start HTTP REST server |
167
267
  | `kbot ide mcp` | Start MCP server for IDEs |
168
268
  | `kbot doctor` | 10-point health check |
169
269
  | `/agent <name>` | Switch specialist |
@@ -196,8 +296,10 @@ These aren't metaphors. They're TypeScript modules with paper citations in the h
196
296
  - API keys encrypted at rest (AES-256-CBC)
197
297
  - Destructive operations require confirmation
198
298
  - Shell commands sandboxed with blocklist
199
- - Tool execution timeout (5 min)
299
+ - Tool execution timeout (5 min) with middleware pipeline
200
300
  - Config files restricted to owner (chmod 600)
301
+ - Session checkpoints stored locally (~/.kbot/checkpoints/)
302
+ - Telemetry is local-only — never sent externally
201
303
 
202
304
  ## Contributing
203
305
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kernel.chat/kbot",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "description": "Universal AI agent framework for your terminal. 22 specialist agents, 246 tools, 20 providers. Programmatic SDK, Bayesian skill routing, checkpointing & resume, middleware pipeline, structured streaming, lazy tool loading, progressive terminal enhancement. Embedded llama.cpp engine, LoRA/QLoRA fine-tuning, deploy tools, MCP marketplace, team mode, plugin SDK. Self-evolving, learns your patterns.",
5
5
  "type": "module",
6
6
  "repository": {