pi-kot 0.1.35 → 0.1.36

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/README.md CHANGED
@@ -7,6 +7,8 @@
7
7
 
8
8
  pi-kot wraps the `@earendil-works/pi-coding-agent` SDK in an HTTP bridge with a React-based web UI. It exposes the agent's capabilities through REST, SSE, and WebSocket, giving you a fully interactive chat-and-terminal environment in your browser — no desktop app required.
9
9
 
10
+ Changes and SDK upgrades are tracked in [CHANGELOG.md](./CHANGELOG.md).
11
+
10
12
  ---
11
13
 
12
14
  ## Motivation
@@ -82,7 +84,7 @@ npx pi-kot --port 3333 --host 127.0.0.1 --password secret --workspace ~/Code
82
84
  ```bash
83
85
  npm run dev
84
86
 
85
- # Open http://localhost:5173
87
+ # Backend on :3332, UI at http://localhost:5173 (Vite proxies /api → :3332)
86
88
  ```
87
89
 
88
90
  ### Production
@@ -94,13 +96,7 @@ npm run start
94
96
  # Open http://localhost:3333
95
97
  ```
96
98
 
97
- Or build for production:
98
-
99
- ```bash
100
- npm run build
101
- npm run start
102
- # Open http://localhost:3333
103
- ```
99
+ All flags also work as environment variables (`PORT`, `HOST`, `UI_PASSWORD`, `API_KEY`, `WORKSPACE_PATH`, `LOG_LEVEL`, `MINIMAL_UI`, ...) — full reference in [Configuration](#configuration).
104
100
 
105
101
  ---
106
102
 
@@ -172,7 +168,72 @@ The server exposes tunnel controls under `/api/v1/tunnel`:
172
168
 
173
169
  ## Configuration
174
170
 
175
- See [START.md](./START.md) for the full configuration reference — ports, auth, storage paths, and more.
171
+ All options can be set as environment variables **or** CLI flags (with `npx pi-kot` / `pi-kot`). Flags not listed below are in `npx pi-kot --help`.
172
+
173
+ ### Network
174
+
175
+ | Variable | Flag | Default | Description |
176
+ |---|---|---|---|
177
+ | `PORT` | `--port` | `3333` | HTTP listen port |
178
+ | `HOST` | `--host` | `0.0.0.0` | Bind address (`127.0.0.1` for loopback-only) |
179
+ | `TRUST_PROXY` | — | `false` | Trust `X-Forwarded-*` headers when behind a reverse proxy |
180
+ | `CORS_ORIGIN` | — | `true` | CORS origin. `true` = reflect request origin; set a specific origin in production |
181
+
182
+ ### Authentication
183
+
184
+ | Variable | Flag | Default | Description |
185
+ |---|---|---|---|
186
+ | `UI_PASSWORD` | `--password` | — | Enable password auth; browser shows a login form |
187
+ | `API_KEY` | `--api-key` | — | Static API key for scripts/CI; also accepted as password in the login form |
188
+
189
+ If both are unset, auth is **disabled** and the UI opens freely.
190
+
191
+ ### Storage paths
192
+
193
+ | Variable | Flag | Default | Description |
194
+ |---|---|---|---|
195
+ | `WORKSPACE_PATH` | `--workspace` | `~/.pi-kot/workspace/default` | Default project workspace directory |
196
+ | `SESSION_DIR` | — | `~/.pi-kot/sessions` | Session data directory |
197
+ | `FORGE_DATA_DIR` | — | `~/.pi-kot` | Base config/data directory (MCP config, tool/skill overrides) |
198
+ | `PI_CONFIG_DIR` | — | `~/.pi/agent` | pi agent configuration directory (used by the SDK; `~/.pi/agent-dev` in dev mode) |
199
+
200
+ ### Data files (under `FORGE_DATA_DIR` by default)
201
+
202
+ | Variable | Default | Description |
203
+ |---|---|---|
204
+ | `MCP_CONFIG_FILE` | `$FORGE_DATA_DIR/mcp.json` | MCP server configurations |
205
+ | `MCP_STDIO_TRUST_FILE` | `$FORGE_DATA_DIR/mcp-stdio-trust.json` | Trusted stdio MCP servers |
206
+ | `TOOL_OVERRIDES_FILE` | `$FORGE_DATA_DIR/tool-overrides.json` | Per-project tool enable/disable overrides |
207
+ | `SKILL_OVERRIDES_FILE` | `$FORGE_DATA_DIR/skill-overrides.json` | Per-project skill enable/disable overrides |
208
+
209
+ ### Logging & Environment
210
+
211
+ | Variable | Flag | Default | Description |
212
+ |---|---|---|---|
213
+ | `LOG_LEVEL` | `--log-level` | `info` | Server log level: `info`, `debug`, `warn`, `error` |
214
+ | `PIKOT_MODE` | — | — | Set to `dev` to use `-dev`-suffixed data dirs (`~/.pi-kot-dev/`) so dev data doesn't mix with production |
215
+ | `NODE_ENV` | — | `production` | Set automatically by the server; `test` disables request logging |
216
+ | `MOUNT_CWD_PROJECT` | — | auto-set by CLI | When set, auto-creates a project for the given directory; the CLI shim sets it to the current working directory |
217
+
218
+ ### Static client serving
219
+
220
+ | Variable | Default | Description |
221
+ |---|---|---|
222
+ | `SERVE_CLIENT` | `true` | Serve the built Vite client from `CLIENT_DIST_PATH`; set `false` to run API-only (e.g. behind a separate reverse proxy serving the client) |
223
+ | `CLIENT_DIST_PATH` | `packages/client/dist` (in-repo) or `dist/client` (npm install) | Path to the built client dist directory; auto-detected |
224
+
225
+ ### Orchestration & UI
226
+
227
+ | Variable | Default | Description |
228
+ |---|---|---|
229
+ | `ORCHESTRATION_ENABLED` | `true` | Enable supervisor/worker orchestration |
230
+ | `MINIMAL_UI` | `false` | Hide optional UI panels (terminal, git, changes). Useful for locked-down deployments |
231
+
232
+ ### Dev-mode only (Vite)
233
+
234
+ | Variable | Default | Description |
235
+ |---|---|---|
236
+ | `VITE_API_PORT` | `3332` | Backend port that the Vite dev proxy forwards `/api` requests to (the `dev` script sets this to `3332`) |
176
237
 
177
238
  ---
178
239
 
@@ -206,6 +267,33 @@ The Git panel shows the current repository's status — modified files, staged c
206
267
 
207
268
  ---
208
269
 
270
+ ## MCP Servers
271
+
272
+ pi-kot supports Model Context Protocol (MCP) servers — tools, resources, and prompts exposed by external services.
273
+
274
+ ### Adding a server
275
+
276
+ 1. Open **Settings** → **MCP** tab
277
+ 2. Click **Add Server**
278
+ 3. Choose **Stdio** (local command) or **HTTP** (remote URL)
279
+ 4. Configure and save
280
+
281
+ ### Managing tools
282
+
283
+ Each MCP server exposes tools that the agent can use. You can enable/disable individual tools per project from the MCP settings panel.
284
+
285
+ ---
286
+
287
+ ## Orchestration
288
+
289
+ pi-kot supports multi-agent workflows — a supervisor session can spawn worker sub-agents to handle tasks in parallel.
290
+
291
+ - Click the **⚡ (Orchestration)** toggle in the toolbar to enable it
292
+ - Workers appear nested under their supervisor in the sidebar and show their own message stream
293
+ - Workers can be interrupted, killed, or detached individually
294
+
295
+ ---
296
+
209
297
  ## Artifacts
210
298
 
211
299
  pi-kot can render agent-created content inline in chat — HTML pages, SVG images, Mermaid diagrams, and more.
@@ -244,7 +332,7 @@ Ask the agent:
244
332
  > "Create a futuristic button with hover effects"
245
333
 
246
334
  The agent will:
247
- 1. Write the HTML to `.pi/web/artifacts/button.html`
335
+ 1. Write the HTML to `.pi/artifacts/button.html`
248
336
  2. Output: `[Live Preview](/api/v1/artifacts/button.html)`
249
337
  3. You see the rendered button inline in chat
250
338
 
@@ -276,6 +364,38 @@ You can toggle automatic client-side image compression before sending images to
276
364
 
277
365
  ---
278
366
 
367
+ ## Troubleshooting
368
+
369
+ ### "Connection lost" in terminal
370
+
371
+ The terminal reconnects automatically with exponential backoff. If it doesn't reconnect:
372
+
373
+ 1. Check that the server is still running
374
+ 2. Refresh the page — tabs are restored from sessionStorage
375
+ 3. If the server restarted, PTY sessions are lost — close and reopen tabs
376
+
377
+ ### Login form keeps showing
378
+
379
+ Your token expired or the server password changed. Sign out and log in again (or use **Clear stored token** on the login form).
380
+
381
+ ### Terminal feels laggy on mobile
382
+
383
+ - Tap responsiveness uses native touch events with minimal delay
384
+ - Arrow keys and input travel over WebSocket to the server — if the server is far away, you'll feel it. Try a local server for snappier response
385
+ - Try the **CTRL toggle** (quick-keys bar) instead of long-press for Ctrl+letter combinations
386
+
387
+ ### Touch gestures not working
388
+
389
+ - Make sure you're touching the terminal area, not the tab bar or quick-keys bar
390
+ - For long-press + drag: **hold still for 150ms first**, then drag — don't swipe immediately
391
+ - If text gets selected, the browser's default behavior is interfering — tap once to focus the terminal first
392
+
393
+ ### Keyboard not appearing on mobile
394
+
395
+ Tap anywhere on the terminal area to focus it. The quick-keys bar should appear, and the system keyboard should open.
396
+
397
+ ---
398
+
279
399
  ## Project Structure
280
400
 
281
401
  ```
@@ -288,7 +408,7 @@ pi-kot/
288
408
  │ │ ├── hooks/ # Custom hooks (touch swipe, extensions, ...)
289
409
  │ │ └── lib/ # Utilities (API client, SSE, theme, tool-registry, ...)
290
410
  │ │ # Note: no normalize.ts — SDK types consumed directly
291
- │ └── server/ # Express server (REST, SSE, WebSocket, PTY)
411
+ │ └── server/ # Fastify server (REST, SSE, WebSocket, PTY)
292
412
  │ └── src/
293
413
  │ ├── routes/ # API routes (sessions, terminal, git, files, projects, extensions, tunnel, ...)
294
414
  │ ├── mcp/ # MCP server registry & manager
@@ -296,7 +416,7 @@ pi-kot/
296
416
  │ ├── ask-user-question/ # Web-compatible tool wrappers (e.g. plan_mode_question)
297
417
  │ ├── tunnel/ # Tunnel providers, registry, service, install/doctor helpers
298
418
  │ └── ... # Config, auth, PTY manager, extension manager, etc.
299
- ├── START.md # Configuration & running guide
419
+ ├── CHANGELOG.md # Release notes & SDK upgrade history
300
420
  ```
301
421
 
302
422
  ---
@@ -306,8 +426,8 @@ pi-kot/
306
426
  | Layer | Technology |
307
427
  |---|---|
308
428
  | **UI** | React, TypeScript, Vite, xterm.js, CodeMirror, Zustand |
309
- | **Server** | Express, ws (WebSocket), node-pty |
310
- | **SDK** | `@earendil-works/pi-coding-agent` |
429
+ | **Server** | Fastify, ws (WebSocket), node-pty |
430
+ | **SDK** | `@earendil-works/pi-coding-agent` (currently 0.83.0) |
311
431
  | **Auth** | JWT, scrypt password hashing |
312
432
  | **State** | Zustand (client), JSONL session files (server) |
313
433