@tryhamster/gerbil 1.0.0-rc.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/LICENSE +23 -0
- package/README.md +253 -0
- package/bin/cli.js +2 -0
- package/dist/auto-update-BbNHbSU1.mjs +3 -0
- package/dist/browser/index.d.mts +262 -0
- package/dist/browser/index.d.mts.map +1 -0
- package/dist/browser/index.mjs +755 -0
- package/dist/browser/index.mjs.map +1 -0
- package/dist/chrome-backend-C5Un08O4.mjs +771 -0
- package/dist/chrome-backend-C5Un08O4.mjs.map +1 -0
- package/dist/chrome-backend-CtwPENIW.mjs +3 -0
- package/dist/chunk-Ct1HF2bE.mjs +7 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.mjs +7078 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/frameworks/express.d.mts +22 -0
- package/dist/frameworks/express.d.mts.map +1 -0
- package/dist/frameworks/express.mjs +123 -0
- package/dist/frameworks/express.mjs.map +1 -0
- package/dist/frameworks/fastify.d.mts +11 -0
- package/dist/frameworks/fastify.d.mts.map +1 -0
- package/dist/frameworks/fastify.mjs +73 -0
- package/dist/frameworks/fastify.mjs.map +1 -0
- package/dist/frameworks/hono.d.mts +14 -0
- package/dist/frameworks/hono.d.mts.map +1 -0
- package/dist/frameworks/hono.mjs +82 -0
- package/dist/frameworks/hono.mjs.map +1 -0
- package/dist/frameworks/next.d.mts +31 -0
- package/dist/frameworks/next.d.mts.map +1 -0
- package/dist/frameworks/next.mjs +116 -0
- package/dist/frameworks/next.mjs.map +1 -0
- package/dist/frameworks/react.d.mts +56 -0
- package/dist/frameworks/react.d.mts.map +1 -0
- package/dist/frameworks/react.mjs +172 -0
- package/dist/frameworks/react.mjs.map +1 -0
- package/dist/frameworks/trpc.d.mts +12 -0
- package/dist/frameworks/trpc.d.mts.map +1 -0
- package/dist/frameworks/trpc.mjs +80 -0
- package/dist/frameworks/trpc.mjs.map +1 -0
- package/dist/gerbil-BfnsFWRE.mjs +644 -0
- package/dist/gerbil-BfnsFWRE.mjs.map +1 -0
- package/dist/gerbil-BjW-z7Fq.mjs +5 -0
- package/dist/gerbil-DZ1k3ChC.d.mts +138 -0
- package/dist/gerbil-DZ1k3ChC.d.mts.map +1 -0
- package/dist/index.d.mts +223 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +13 -0
- package/dist/index.mjs.map +1 -0
- package/dist/integrations/ai-sdk.d.mts +78 -0
- package/dist/integrations/ai-sdk.d.mts.map +1 -0
- package/dist/integrations/ai-sdk.mjs +199 -0
- package/dist/integrations/ai-sdk.mjs.map +1 -0
- package/dist/integrations/langchain.d.mts +41 -0
- package/dist/integrations/langchain.d.mts.map +1 -0
- package/dist/integrations/langchain.mjs +93 -0
- package/dist/integrations/langchain.mjs.map +1 -0
- package/dist/integrations/llamaindex.d.mts +45 -0
- package/dist/integrations/llamaindex.d.mts.map +1 -0
- package/dist/integrations/llamaindex.mjs +86 -0
- package/dist/integrations/llamaindex.mjs.map +1 -0
- package/dist/integrations/mcp-client.d.mts +206 -0
- package/dist/integrations/mcp-client.d.mts.map +1 -0
- package/dist/integrations/mcp-client.mjs +507 -0
- package/dist/integrations/mcp-client.mjs.map +1 -0
- package/dist/integrations/mcp.d.mts +177 -0
- package/dist/integrations/mcp.d.mts.map +1 -0
- package/dist/integrations/mcp.mjs +8 -0
- package/dist/mcp-R8kRLIKb.mjs +348 -0
- package/dist/mcp-R8kRLIKb.mjs.map +1 -0
- package/dist/models-DKULvhOr.mjs +136 -0
- package/dist/models-DKULvhOr.mjs.map +1 -0
- package/dist/models-De2-_GmQ.d.mts +22 -0
- package/dist/models-De2-_GmQ.d.mts.map +1 -0
- package/dist/one-liner-BUQR0nqq.mjs +98 -0
- package/dist/one-liner-BUQR0nqq.mjs.map +1 -0
- package/dist/skills/index.d.mts +390 -0
- package/dist/skills/index.d.mts.map +1 -0
- package/dist/skills/index.mjs +7 -0
- package/dist/skills-D3CEpgDc.mjs +630 -0
- package/dist/skills-D3CEpgDc.mjs.map +1 -0
- package/dist/tools-BsiEE6f2.mjs +567 -0
- package/dist/tools-BsiEE6f2.mjs.map +1 -0
- package/dist/types-BS1N92Jt.d.mts +183 -0
- package/dist/types-BS1N92Jt.d.mts.map +1 -0
- package/dist/utils-7vXqtq2Q.mjs +63 -0
- package/dist/utils-7vXqtq2Q.mjs.map +1 -0
- package/docs/ai-sdk.md +80 -0
- package/docs/architecture/README.md +84 -0
- package/docs/architecture/caching.md +227 -0
- package/docs/architecture/inference.md +176 -0
- package/docs/architecture/overview.md +179 -0
- package/docs/architecture/streaming.md +261 -0
- package/docs/architecture/webgpu.md +213 -0
- package/docs/browser.md +328 -0
- package/docs/cli.md +155 -0
- package/docs/frameworks.md +90 -0
- package/docs/mcp-client.md +224 -0
- package/docs/mcp.md +109 -0
- package/docs/memory.md +229 -0
- package/docs/repl.md +473 -0
- package/docs/skills.md +261 -0
- package/docs/tools.md +304 -0
- package/package.json +207 -0
package/docs/repl.md
ADDED
|
@@ -0,0 +1,473 @@
|
|
|
1
|
+
# Gerbil REPL
|
|
2
|
+
|
|
3
|
+
The Gerbil REPL is an interactive terminal interface that brings all of Gerbil's capabilities into a visual, navigable dashboard. Built with [Ink](https://github.com/vadimdemedes/ink) (React for CLIs), it provides a modern TUI experience.
|
|
4
|
+
|
|
5
|
+
## Launch
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx @tryhamster/gerbil repl
|
|
9
|
+
# or simply
|
|
10
|
+
gerbil # After global install
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Updates
|
|
14
|
+
|
|
15
|
+
Gerbil checks for updates on startup but **never installs without your permission**.
|
|
16
|
+
|
|
17
|
+
### In REPL
|
|
18
|
+
|
|
19
|
+
When an update is available, you'll see a prompt in the header:
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
gerbil 1.0.0 / Chat | Update v1.0.1 → Press u to update
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Press **`u`** to install the update. You'll see:
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
⬇ Updating...
|
|
29
|
+
✅ Updated! Restart to use v1.0.1
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Via CLI Command
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
gerbil update
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Output:
|
|
39
|
+
```
|
|
40
|
+
✔ Checking for updates...
|
|
41
|
+
ℹ Update available: v1.0.0 → v1.0.1
|
|
42
|
+
⠋ Installing v1.0.1...
|
|
43
|
+
✔ ✅ Updated to v1.0.1
|
|
44
|
+
|
|
45
|
+
Restart your terminal or run 'gerbil' to use the new version.
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### After Any Command
|
|
49
|
+
|
|
50
|
+
After running any `gerbil` command, you'll see a notification if an update is available:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
$ gerbil commit
|
|
54
|
+
✔ Generated commit message
|
|
55
|
+
|
|
56
|
+
💡 Update available: v1.0.0 → v1.0.1
|
|
57
|
+
Run 'gerbil update' to install
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Main Menu
|
|
61
|
+
|
|
62
|
+
On launch, you'll see a dashboard with 8 feature cards in a 4×2 grid:
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
GERBIL
|
|
66
|
+
Local LLM inference for Node.js
|
|
67
|
+
by tryhamster.com
|
|
68
|
+
|
|
69
|
+
[AI-generated welcome message appears here]
|
|
70
|
+
|
|
71
|
+
model: qwen3-0.6b
|
|
72
|
+
|
|
73
|
+
┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐
|
|
74
|
+
│ [1] Chat │ │ [2] Skills │ │ [3] Tools │ │ [4] Model │
|
|
75
|
+
│ Talk with │ │ Run AI │ │ Manage │ │ Change │
|
|
76
|
+
│ Gerbil │ │ skills │ │ tools │ │ model │
|
|
77
|
+
└─────────────┘ └─────────────┘ └─────────────┘ └─────────────┘
|
|
78
|
+
┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐
|
|
79
|
+
│ [5]Integrate│ │ [6]Benchmark│ │ [7] Info │ │ [8] Serve │
|
|
80
|
+
│ Framework │ │ Speed │ │ System │ │ Start │
|
|
81
|
+
│ setup │ │ tests │ │ info │ │ server │
|
|
82
|
+
└─────────────┘ └─────────────┘ └─────────────┘ └─────────────┘
|
|
83
|
+
|
|
84
|
+
arrows | enter | 1-8 | d docs | g github | q quit
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Navigation
|
|
88
|
+
- **Arrow keys** — Navigate the menu grid (up/down/left/right)
|
|
89
|
+
- **Enter** or **1-8** — Select a feature
|
|
90
|
+
- **t** — Toggle thinking mode (menu) or **⌘T** (anywhere)
|
|
91
|
+
- **a** — Toggle agent mode (menu) or **⌘A** (anywhere)
|
|
92
|
+
- **d** — Open documentation (tryhamster.com docs)
|
|
93
|
+
- **g** — Open GitHub repository
|
|
94
|
+
- **h** — Open tryhamster.com
|
|
95
|
+
- **q** — Quit
|
|
96
|
+
- **Ctrl+C** — Press twice to quit (safety confirmation)
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## Features
|
|
101
|
+
|
|
102
|
+
### [1] Chat
|
|
103
|
+
|
|
104
|
+
Interactive conversation with your local LLM.
|
|
105
|
+
|
|
106
|
+
**Chat Modes** (press `Tab` to switch):
|
|
107
|
+
|
|
108
|
+
| Mode | Symbol | Description |
|
|
109
|
+
|------|--------|-------------|
|
|
110
|
+
| Assistant | `>` | Helpful and concise general assistant |
|
|
111
|
+
| Coder | `$` | Code-focused, minimal explanations |
|
|
112
|
+
| Teacher | `?` | Patient explanations with examples |
|
|
113
|
+
| Creative | `*` | Expressive and imaginative |
|
|
114
|
+
| Minimal | `.` | Ultra-short responses |
|
|
115
|
+
|
|
116
|
+
**Agent Mode** (press `⌘A` to toggle):
|
|
117
|
+
- When enabled, Gerbil can call tools like `gerbil_docs` and `run_skill`
|
|
118
|
+
- Works with any chat mode (e.g., Coder + Agent)
|
|
119
|
+
- Shows `+tools` badge when active
|
|
120
|
+
- Tool calls display in cyan boxes with connected result boxes
|
|
121
|
+
|
|
122
|
+
**Thinking Mode** (press `⌘T` to toggle):
|
|
123
|
+
- When enabled, shows the model's chain-of-thought reasoning
|
|
124
|
+
- Only available with Qwen3 models
|
|
125
|
+
|
|
126
|
+
**Context Tracking:**
|
|
127
|
+
- Shows tokens used vs. available context
|
|
128
|
+
- Warning when context is >80% full
|
|
129
|
+
- Color-coded: green (<50%), yellow (50-80%), red (>80%)
|
|
130
|
+
|
|
131
|
+
**Commands:**
|
|
132
|
+
|
|
133
|
+
| Command | Description |
|
|
134
|
+
|---------|-------------|
|
|
135
|
+
| `/new` or `/clear` | Start a new conversation |
|
|
136
|
+
| `/docs <topic>` | Search Gerbil documentation |
|
|
137
|
+
| `/summarize` or `/compress` | Summarize and compress context |
|
|
138
|
+
| `/mode` | Open mode selector |
|
|
139
|
+
| `/help` | Show all commands |
|
|
140
|
+
|
|
141
|
+
**Shortcuts:**
|
|
142
|
+
|
|
143
|
+
| Key | Action |
|
|
144
|
+
|-----|--------|
|
|
145
|
+
| `⌘C` | Copy entire chat to clipboard |
|
|
146
|
+
| `⌘S` | Save chat to markdown file |
|
|
147
|
+
| `⌘T` | Toggle thinking mode |
|
|
148
|
+
| `⌘A` | Toggle agent mode |
|
|
149
|
+
| `Tab` | Open mode selector |
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
### [2] Skills
|
|
154
|
+
|
|
155
|
+
Run built-in AI skills or create custom ones.
|
|
156
|
+
|
|
157
|
+
**Built-in Skills:**
|
|
158
|
+
- `commit` — Generate git commit messages
|
|
159
|
+
- `summarize` — Condense text or documents
|
|
160
|
+
- `explain` — Break down code or concepts
|
|
161
|
+
- `review` — Code review with issue detection
|
|
162
|
+
- `test` — Generate test cases
|
|
163
|
+
- `translate` — Translate text
|
|
164
|
+
- `extract` — Extract structured data
|
|
165
|
+
- `title` — Generate titles
|
|
166
|
+
|
|
167
|
+
**Usage:**
|
|
168
|
+
1. Select a skill from the list
|
|
169
|
+
2. Enter input (JSON or plain text)
|
|
170
|
+
3. View the result
|
|
171
|
+
|
|
172
|
+
**Controls:**
|
|
173
|
+
- **Up/Down** — Navigate skill list
|
|
174
|
+
- **Enter** — Select skill to run
|
|
175
|
+
- **c** — Create a new skill (opens wizard)
|
|
176
|
+
- **Esc** — Back to menu
|
|
177
|
+
|
|
178
|
+
The first option is **"+ Create new skill"** which opens the skill creation wizard.
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
### [3] Tools
|
|
183
|
+
|
|
184
|
+
View and manage tools that the agent can use.
|
|
185
|
+
|
|
186
|
+
**Interface:**
|
|
187
|
+
```
|
|
188
|
+
📦 TOOLS
|
|
189
|
+
Browse and manage available tools
|
|
190
|
+
|
|
191
|
+
▸ gerbil_docs [builtin]
|
|
192
|
+
run_skill [builtin]
|
|
193
|
+
generate_joke [project]
|
|
194
|
+
|
|
195
|
+
Press c to create | x to execute | Esc back
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
**Tool Sources:**
|
|
199
|
+
- `[builtin]` — Built-in tools like `gerbil_docs`, `run_skill`
|
|
200
|
+
- `[project]` — Custom tools from `.gerbil/tools/`
|
|
201
|
+
- `[error]` — Tools that failed to load (shows error message)
|
|
202
|
+
|
|
203
|
+
**Controls:**
|
|
204
|
+
- **Up/Down** — Navigate tool list
|
|
205
|
+
- **Enter** — Expand tool details
|
|
206
|
+
- **x** — Execute selected tool
|
|
207
|
+
- **c** — Create a new tool (opens wizard)
|
|
208
|
+
- **o** — Open project tool file in VS Code
|
|
209
|
+
- **Esc** — Back to menu
|
|
210
|
+
|
|
211
|
+
**Tool Details (when expanded):**
|
|
212
|
+
```
|
|
213
|
+
▾ gerbil_docs [builtin]
|
|
214
|
+
Search Gerbil documentation
|
|
215
|
+
Parameters: query (string)
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
### Create Tool Wizard
|
|
221
|
+
|
|
222
|
+
A guided 4-step wizard to create custom tools:
|
|
223
|
+
|
|
224
|
+
```
|
|
225
|
+
[✓] Name --- [✓] Description --- [>] Parameters --- [ ] Logic
|
|
226
|
+
|
|
227
|
+
┌─────────────────────────────────┐
|
|
228
|
+
│ Name: get_weather │
|
|
229
|
+
│ Description: Gets weather │
|
|
230
|
+
│ Parameters: city as string │
|
|
231
|
+
│ Logic: ... │
|
|
232
|
+
└─────────────────────────────────┘
|
|
233
|
+
|
|
234
|
+
Parameters
|
|
235
|
+
What inputs does this tool need? (press Enter to skip)
|
|
236
|
+
|
|
237
|
+
> city as a string (required)
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
**Steps:**
|
|
241
|
+
1. **Name** — Tool identifier (snake_case, e.g., `get_weather`)
|
|
242
|
+
2. **Description** — What the tool does (one sentence)
|
|
243
|
+
3. **Parameters** — What inputs it needs (optional, press Enter to skip)
|
|
244
|
+
4. **Logic** — What it should return
|
|
245
|
+
|
|
246
|
+
After completion, Gerbil generates a tool file and saves it to `.gerbil/tools/your_tool.tool.ts`.
|
|
247
|
+
|
|
248
|
+
**Generated Tool Format:**
|
|
249
|
+
```typescript
|
|
250
|
+
// Gerbil Tool: my_tool
|
|
251
|
+
// No imports needed - just export a config object
|
|
252
|
+
|
|
253
|
+
export default {
|
|
254
|
+
name: "my_tool",
|
|
255
|
+
description: "Does something useful",
|
|
256
|
+
execute: async (params, ctx) => {
|
|
257
|
+
const value = params?.input || "default";
|
|
258
|
+
// ctx.generate() available for LLM calls!
|
|
259
|
+
return `Result: ${value}`;
|
|
260
|
+
},
|
|
261
|
+
};
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
---
|
|
265
|
+
|
|
266
|
+
### [4] Model
|
|
267
|
+
|
|
268
|
+
Switch between models or download new ones.
|
|
269
|
+
|
|
270
|
+
**Tabs:**
|
|
271
|
+
- **[Recommended]** — Tested models with known performance
|
|
272
|
+
- **[HuggingFace]** — Search any compatible model
|
|
273
|
+
|
|
274
|
+
**Model List:**
|
|
275
|
+
```
|
|
276
|
+
● Qwen3 0.6B ~400MB fastest [current]
|
|
277
|
+
● Qwen2.5 0.5B ~350MB fast
|
|
278
|
+
○ SmolLM2 360M ~250MB fastest
|
|
279
|
+
○ Phi-3 Mini ~2.1GB medium
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
- `●` Green dot = cached locally
|
|
283
|
+
- `○` Gray dot = not downloaded
|
|
284
|
+
|
|
285
|
+
**Controls:**
|
|
286
|
+
- **Up/Down** — Select model
|
|
287
|
+
- **Enter** — Download (if needed) + switch to model
|
|
288
|
+
- **d** — Download only (pre-cache without switching)
|
|
289
|
+
- **Tab** — Switch between Recommended/HuggingFace tabs
|
|
290
|
+
|
|
291
|
+
---
|
|
292
|
+
|
|
293
|
+
### [5] Integrate
|
|
294
|
+
|
|
295
|
+
Framework integration code examples for:
|
|
296
|
+
|
|
297
|
+
- **AI SDK (Vercel)** — `gerbil/ai`
|
|
298
|
+
- **Next.js** — `gerbil/next`
|
|
299
|
+
- **Express** — `gerbil/express`
|
|
300
|
+
- **React Hooks** — `gerbil/react`
|
|
301
|
+
- **Hono** — `gerbil/hono`
|
|
302
|
+
- **LangChain** — `gerbil/langchain`
|
|
303
|
+
|
|
304
|
+
Navigate with Up/Down to see code snippets for each framework.
|
|
305
|
+
|
|
306
|
+
---
|
|
307
|
+
|
|
308
|
+
### [6] Benchmark
|
|
309
|
+
|
|
310
|
+
Performance testing with multiple runs and averages.
|
|
311
|
+
|
|
312
|
+
```
|
|
313
|
+
Benchmark: qwen3-0.6b
|
|
314
|
+
Run multiple times for accurate averages
|
|
315
|
+
|
|
316
|
+
Results (3 runs):
|
|
317
|
+
Run 1: 45 tok/s, 234ms first token, 52 tokens
|
|
318
|
+
Run 2: 47 tok/s, 198ms first token, 48 tokens
|
|
319
|
+
Run 3: 46 tok/s, 212ms first token, 51 tokens
|
|
320
|
+
|
|
321
|
+
┌─────────────────────────────┐
|
|
322
|
+
│ Averages: │
|
|
323
|
+
│ Tokens/sec: 46 │
|
|
324
|
+
│ First token: 215ms │
|
|
325
|
+
└─────────────────────────────┘
|
|
326
|
+
|
|
327
|
+
Enter run | c clear | Esc back
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
**Controls:**
|
|
331
|
+
- **Enter** — Run benchmark
|
|
332
|
+
- **c** — Clear results
|
|
333
|
+
- **Esc** — Back to menu
|
|
334
|
+
|
|
335
|
+
Results persist across runs for accurate averaging.
|
|
336
|
+
|
|
337
|
+
---
|
|
338
|
+
|
|
339
|
+
### [7] Info
|
|
340
|
+
|
|
341
|
+
System and session information.
|
|
342
|
+
|
|
343
|
+
**Tabs:**
|
|
344
|
+
- **[Info]** — Model details, device info, memory usage
|
|
345
|
+
- **[Stats]** — Session statistics (prompts, tokens, time)
|
|
346
|
+
- **[Cache]** — Cached models and storage location
|
|
347
|
+
|
|
348
|
+
Each tab includes an AI-generated observation about the current data.
|
|
349
|
+
|
|
350
|
+
**Info Tab:**
|
|
351
|
+
```
|
|
352
|
+
GERBIL v0.1.0
|
|
353
|
+
|
|
354
|
+
LOADED MODEL
|
|
355
|
+
Name: qwen3-0.6b
|
|
356
|
+
Size: 400MB
|
|
357
|
+
Context: 32,768 tokens
|
|
358
|
+
Thinking: supported
|
|
359
|
+
|
|
360
|
+
DEVICE
|
|
361
|
+
Device: Apple Silicon (Metal)
|
|
362
|
+
Runtime: Node.js v20.10.0
|
|
363
|
+
|
|
364
|
+
MEMORY (Unified)
|
|
365
|
+
Total: 16GB
|
|
366
|
+
Used: 8.2GB (51%)
|
|
367
|
+
Available: 7.8GB
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
---
|
|
371
|
+
|
|
372
|
+
### [8] Serve
|
|
373
|
+
|
|
374
|
+
Start HTTP or MCP servers.
|
|
375
|
+
|
|
376
|
+
**Server Types:**
|
|
377
|
+
- **HTTP Server** — REST API for Gerbil
|
|
378
|
+
- **MCP Server** — For Claude Desktop, Cursor, etc.
|
|
379
|
+
|
|
380
|
+
**HTTP Server:**
|
|
381
|
+
```
|
|
382
|
+
Model: qwen3-0.6b
|
|
383
|
+
Port: 3000
|
|
384
|
+
|
|
385
|
+
Endpoints:
|
|
386
|
+
POST /generate - Generate text
|
|
387
|
+
GET /info - Server info
|
|
388
|
+
|
|
389
|
+
[running] http://localhost:3000
|
|
390
|
+
PID: 12345
|
|
391
|
+
|
|
392
|
+
Enter or s to stop | Esc back
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
**Controls:**
|
|
396
|
+
- **Tab** — Switch between HTTP/MCP
|
|
397
|
+
- **Enter** — Start server (or stop if running)
|
|
398
|
+
- **s** — Stop running server
|
|
399
|
+
- **Esc** — Back (server keeps running in background)
|
|
400
|
+
|
|
401
|
+
---
|
|
402
|
+
|
|
403
|
+
## Global Controls
|
|
404
|
+
|
|
405
|
+
These work from any view:
|
|
406
|
+
|
|
407
|
+
| Key | Action |
|
|
408
|
+
|-----|--------|
|
|
409
|
+
| `Esc` | Go back to menu |
|
|
410
|
+
| `⌘T` | Toggle thinking mode |
|
|
411
|
+
| `⌘A` | Toggle agent mode |
|
|
412
|
+
| `Ctrl+C` | Quit (press twice) |
|
|
413
|
+
| `q` | Quit (from menu only) |
|
|
414
|
+
|
|
415
|
+
---
|
|
416
|
+
|
|
417
|
+
## AI-Generated Messages
|
|
418
|
+
|
|
419
|
+
The REPL uses Gerbil itself to generate contextual messages:
|
|
420
|
+
|
|
421
|
+
1. **Welcome Message** — Generated on startup, introduces capabilities
|
|
422
|
+
2. **View Tips** — Generated when entering each view, explains what to do
|
|
423
|
+
|
|
424
|
+
These messages are 1-2 sentences, helpful, and specific to the context.
|
|
425
|
+
|
|
426
|
+
---
|
|
427
|
+
|
|
428
|
+
## Technical Details
|
|
429
|
+
|
|
430
|
+
- **Built with:** [Ink](https://github.com/vadimdemedes/ink) (React for CLIs)
|
|
431
|
+
- **Components:** Custom React components for each view
|
|
432
|
+
- **State:** React hooks for local state management
|
|
433
|
+
- **Model:** Shared Gerbil instance across all views
|
|
434
|
+
- **Streaming:** Real-time token streaming in chat
|
|
435
|
+
|
|
436
|
+
---
|
|
437
|
+
|
|
438
|
+
## Example Session
|
|
439
|
+
|
|
440
|
+
```bash
|
|
441
|
+
$ npx @tryhamster/gerbil repl
|
|
442
|
+
|
|
443
|
+
# Gerbil loads, shows welcome message
|
|
444
|
+
# Press 1 or navigate to Chat
|
|
445
|
+
|
|
446
|
+
[gerbil / Chat]
|
|
447
|
+
Context: 0 / 32,768 tokens (0%)
|
|
448
|
+
[>] Assistant +tools | tab mode | ⌘Think | ⌘Agent | /help
|
|
449
|
+
|
|
450
|
+
> How do I create a tool?
|
|
451
|
+
|
|
452
|
+
🔧 tool(gerbil_docs)
|
|
453
|
+
query: "tools"
|
|
454
|
+
|
|
455
|
+
📄 Documentation
|
|
456
|
+
Tools are functions the agent can call...
|
|
457
|
+
|
|
458
|
+
> Based on the docs, you can create tools using...
|
|
459
|
+
|
|
460
|
+
> /docs skills
|
|
461
|
+
📄 docs(skills):
|
|
462
|
+
Skills are reusable AI tasks with Zod-validated...
|
|
463
|
+
|
|
464
|
+
> ⌘S
|
|
465
|
+
# Saves to gerbil-chat-2024-01-15T10-30-00.md
|
|
466
|
+
|
|
467
|
+
> Esc
|
|
468
|
+
# Back to menu
|
|
469
|
+
|
|
470
|
+
# Press 3 for Tools view
|
|
471
|
+
# Press c to create a new tool
|
|
472
|
+
# Follow the wizard to create your tool
|
|
473
|
+
```
|