pi-kot 0.1.38 → 0.1.40

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 (169) hide show
  1. package/README.md +68 -104
  2. package/dist/client/assets/index-DH1DarDy.js +196 -0
  3. package/dist/client/assets/index-DH1DarDy.js.map +1 -0
  4. package/dist/client/assets/index-DYWeNL-y.css +1 -0
  5. package/dist/client/assets/vendor-icons-BpFAkgBQ.js +2 -0
  6. package/dist/client/assets/vendor-icons-BpFAkgBQ.js.map +1 -0
  7. package/dist/client/assets/{vendor-markdown-BHwes4Q7.js → vendor-markdown-BDlxJt__.js} +2 -2
  8. package/dist/client/assets/{vendor-markdown-BHwes4Q7.js.map → vendor-markdown-BDlxJt__.js.map} +1 -1
  9. package/dist/client/assets/vendor-prism-CNIrsK0M.js +4 -0
  10. package/dist/client/assets/{vendor-prism-ChBCet0U.js.map → vendor-prism-CNIrsK0M.js.map} +1 -1
  11. package/dist/client/index.html +5 -5
  12. package/dist/server/archive-retention.test.d.ts +2 -0
  13. package/dist/server/archive-retention.test.d.ts.map +1 -0
  14. package/dist/server/archive-retention.test.js +63 -0
  15. package/dist/server/archive-retention.test.js.map +1 -0
  16. package/dist/server/ask-user-question/plan-review-registry.d.ts +49 -0
  17. package/dist/server/ask-user-question/plan-review-registry.d.ts.map +1 -0
  18. package/dist/server/ask-user-question/plan-review-registry.js +179 -0
  19. package/dist/server/ask-user-question/plan-review-registry.js.map +1 -0
  20. package/dist/server/ask-user-question/plannotator-registry.d.ts +49 -0
  21. package/dist/server/ask-user-question/plannotator-registry.d.ts.map +1 -0
  22. package/dist/server/ask-user-question/plannotator-registry.js +179 -0
  23. package/dist/server/ask-user-question/plannotator-registry.js.map +1 -0
  24. package/dist/server/ask-user-question/plannotator-submit-plan-tool.d.ts +6 -0
  25. package/dist/server/ask-user-question/plannotator-submit-plan-tool.d.ts.map +1 -0
  26. package/dist/server/ask-user-question/plannotator-submit-plan-tool.js +124 -0
  27. package/dist/server/ask-user-question/plannotator-submit-plan-tool.js.map +1 -0
  28. package/dist/server/ask-user-question/plannotator-submit-plan.test.d.ts +2 -0
  29. package/dist/server/ask-user-question/plannotator-submit-plan.test.d.ts.map +1 -0
  30. package/dist/server/ask-user-question/plannotator-submit-plan.test.js +62 -0
  31. package/dist/server/ask-user-question/plannotator-submit-plan.test.js.map +1 -0
  32. package/dist/server/ask-user-question/submit-plan-tool.d.ts +4 -0
  33. package/dist/server/ask-user-question/submit-plan-tool.d.ts.map +1 -0
  34. package/dist/server/ask-user-question/submit-plan-tool.js +120 -0
  35. package/dist/server/ask-user-question/submit-plan-tool.js.map +1 -0
  36. package/dist/server/ask-user-question/submit-plan.test.d.ts +2 -0
  37. package/dist/server/ask-user-question/submit-plan.test.d.ts.map +1 -0
  38. package/dist/server/ask-user-question/submit-plan.test.js +62 -0
  39. package/dist/server/ask-user-question/submit-plan.test.js.map +1 -0
  40. package/dist/server/contexts/web-ui.md +12 -3
  41. package/dist/server/event-stream.d.ts +8 -0
  42. package/dist/server/event-stream.d.ts.map +1 -1
  43. package/dist/server/event-stream.js +95 -0
  44. package/dist/server/event-stream.js.map +1 -1
  45. package/dist/server/extension-manager.d.ts.map +1 -1
  46. package/dist/server/extension-manager.js +0 -10
  47. package/dist/server/extension-manager.js.map +1 -1
  48. package/dist/server/extension-ui-bridge.d.ts +6 -0
  49. package/dist/server/extension-ui-bridge.d.ts.map +1 -1
  50. package/dist/server/extension-ui-bridge.js +65 -4
  51. package/dist/server/extension-ui-bridge.js.map +1 -1
  52. package/dist/server/extension-ui-bridge.test.d.ts +2 -0
  53. package/dist/server/extension-ui-bridge.test.d.ts.map +1 -0
  54. package/dist/server/extension-ui-bridge.test.js +40 -0
  55. package/dist/server/extension-ui-bridge.test.js.map +1 -0
  56. package/dist/server/index.d.ts.map +1 -1
  57. package/dist/server/index.js +105 -0
  58. package/dist/server/index.js.map +1 -1
  59. package/dist/server/path-refs.d.ts +1 -0
  60. package/dist/server/path-refs.d.ts.map +1 -1
  61. package/dist/server/path-refs.js +29 -2
  62. package/dist/server/path-refs.js.map +1 -1
  63. package/dist/server/path-refs.test.js +37 -0
  64. package/dist/server/path-refs.test.js.map +1 -1
  65. package/dist/server/plan-mode-extension.d.ts +10 -0
  66. package/dist/server/plan-mode-extension.d.ts.map +1 -0
  67. package/dist/server/plan-mode-extension.js +80 -0
  68. package/dist/server/plan-mode-extension.js.map +1 -0
  69. package/dist/server/plan-mode-extension.test.d.ts +2 -0
  70. package/dist/server/plan-mode-extension.test.d.ts.map +1 -0
  71. package/dist/server/plan-mode-extension.test.js +99 -0
  72. package/dist/server/plan-mode-extension.test.js.map +1 -0
  73. package/dist/server/processes/envelope.d.ts +5 -0
  74. package/dist/server/processes/envelope.d.ts.map +1 -0
  75. package/dist/server/processes/envelope.js +29 -0
  76. package/dist/server/processes/envelope.js.map +1 -0
  77. package/dist/server/processes/log-store.d.ts +24 -0
  78. package/dist/server/processes/log-store.d.ts.map +1 -0
  79. package/dist/server/processes/log-store.js +86 -0
  80. package/dist/server/processes/log-store.js.map +1 -0
  81. package/dist/server/processes/manager.d.ts +56 -0
  82. package/dist/server/processes/manager.d.ts.map +1 -0
  83. package/dist/server/processes/manager.js +343 -0
  84. package/dist/server/processes/manager.js.map +1 -0
  85. package/dist/server/processes/processes.test.d.ts +2 -0
  86. package/dist/server/processes/processes.test.d.ts.map +1 -0
  87. package/dist/server/processes/processes.test.js +85 -0
  88. package/dist/server/processes/processes.test.js.map +1 -0
  89. package/dist/server/processes/prompt-strings.d.ts +7 -0
  90. package/dist/server/processes/prompt-strings.d.ts.map +1 -0
  91. package/dist/server/processes/prompt-strings.js +28 -0
  92. package/dist/server/processes/prompt-strings.js.map +1 -0
  93. package/dist/server/processes/tool.d.ts +3 -0
  94. package/dist/server/processes/tool.d.ts.map +1 -0
  95. package/dist/server/processes/tool.js +160 -0
  96. package/dist/server/processes/tool.js.map +1 -0
  97. package/dist/server/processes/types.d.ts +125 -0
  98. package/dist/server/processes/types.d.ts.map +1 -0
  99. package/dist/server/processes/types.js +13 -0
  100. package/dist/server/processes/types.js.map +1 -0
  101. package/dist/server/processes/watches.d.ts +13 -0
  102. package/dist/server/processes/watches.d.ts.map +1 -0
  103. package/dist/server/processes/watches.js +55 -0
  104. package/dist/server/processes/watches.js.map +1 -0
  105. package/dist/server/routes/artifacts.d.ts +10 -0
  106. package/dist/server/routes/artifacts.d.ts.map +1 -1
  107. package/dist/server/routes/artifacts.js +102 -73
  108. package/dist/server/routes/artifacts.js.map +1 -1
  109. package/dist/server/routes/artifacts.test.d.ts +2 -0
  110. package/dist/server/routes/artifacts.test.d.ts.map +1 -0
  111. package/dist/server/routes/artifacts.test.js +144 -0
  112. package/dist/server/routes/artifacts.test.js.map +1 -0
  113. package/dist/server/routes/auth.d.ts.map +1 -1
  114. package/dist/server/routes/auth.js +17 -4
  115. package/dist/server/routes/auth.js.map +1 -1
  116. package/dist/server/routes/config.js +2 -2
  117. package/dist/server/routes/config.js.map +1 -1
  118. package/dist/server/routes/files-batch-delete.test.d.ts +2 -0
  119. package/dist/server/routes/files-batch-delete.test.d.ts.map +1 -0
  120. package/dist/server/routes/files-batch-delete.test.js +165 -0
  121. package/dist/server/routes/files-batch-delete.test.js.map +1 -0
  122. package/dist/server/routes/files.d.ts.map +1 -1
  123. package/dist/server/routes/files.js +99 -0
  124. package/dist/server/routes/files.js.map +1 -1
  125. package/dist/server/routes/plan-review.d.ts +3 -0
  126. package/dist/server/routes/plan-review.d.ts.map +1 -0
  127. package/dist/server/routes/plan-review.js +149 -0
  128. package/dist/server/routes/plan-review.js.map +1 -0
  129. package/dist/server/routes/plan-review.test.d.ts +2 -0
  130. package/dist/server/routes/plan-review.test.d.ts.map +1 -0
  131. package/dist/server/routes/plan-review.test.js +68 -0
  132. package/dist/server/routes/plan-review.test.js.map +1 -0
  133. package/dist/server/routes/processes.d.ts +3 -0
  134. package/dist/server/routes/processes.d.ts.map +1 -0
  135. package/dist/server/routes/processes.js +63 -0
  136. package/dist/server/routes/processes.js.map +1 -0
  137. package/dist/server/routes/sessions.d.ts.map +1 -1
  138. package/dist/server/routes/sessions.js +30 -1
  139. package/dist/server/routes/sessions.js.map +1 -1
  140. package/dist/server/routes/skills.d.ts.map +1 -1
  141. package/dist/server/routes/skills.js +52 -3
  142. package/dist/server/routes/skills.js.map +1 -1
  143. package/dist/server/session-store.d.ts +17 -1
  144. package/dist/server/session-store.d.ts.map +1 -1
  145. package/dist/server/session-store.js +120 -5
  146. package/dist/server/session-store.js.map +1 -1
  147. package/dist/server/skill-policy.d.ts +10 -3
  148. package/dist/server/skill-policy.d.ts.map +1 -1
  149. package/dist/server/skill-policy.js +31 -6
  150. package/dist/server/skill-policy.js.map +1 -1
  151. package/dist/server/skill-policy.test.d.ts +2 -0
  152. package/dist/server/skill-policy.test.d.ts.map +1 -0
  153. package/dist/server/skill-policy.test.js +102 -0
  154. package/dist/server/skill-policy.test.js.map +1 -0
  155. package/dist/server/ui-settings-store.d.ts +3 -2
  156. package/dist/server/ui-settings-store.d.ts.map +1 -1
  157. package/dist/server/ui-settings-store.js +11 -5
  158. package/dist/server/ui-settings-store.js.map +1 -1
  159. package/package.json +4 -4
  160. package/dist/client/assets/index-DczdsIBb.css +0 -1
  161. package/dist/client/assets/index-DsAokEBF.js +0 -191
  162. package/dist/client/assets/index-DsAokEBF.js.map +0 -1
  163. package/dist/client/assets/vendor-icons-B8pSAnO8.js +0 -2
  164. package/dist/client/assets/vendor-icons-B8pSAnO8.js.map +0 -1
  165. package/dist/client/assets/vendor-prism-ChBCet0U.js +0 -4
  166. package/dist/server/file-watcher.d.ts +0 -16
  167. package/dist/server/file-watcher.d.ts.map +0 -1
  168. package/dist/server/file-watcher.js +0 -84
  169. package/dist/server/file-watcher.js.map +0 -1
package/README.md CHANGED
@@ -24,11 +24,13 @@ This project was built out of **love and curiosity**.
24
24
 
25
25
  | Feature | Description |
26
26
  | --- | --- |
27
- | **💬 Chat** | Full agent conversation with streaming, markdown rendering, code blocks with syntax highlighting, and diff views — no intermediate adapter, SDK types consumed directly |
27
+ | **💬 Chat** | Full agent conversation with streaming, markdown rendering, code blocks with syntax highlighting, diff views, and KaTeX math — no intermediate adapter, SDK types consumed directly |
28
+ | **🗂️ Trail / Tool Grouping** | Consecutive tool calls collapse into a single **Trail** card. In-between agent reasoning appears as collapsible **Justification** steps with a chain-of-thought view that follows the agent live |
29
+ | **🌐 Internationalization** | Full multi-language support (**English** & **简体中文 / Simplified Chinese**), auto-detected from browser locale or configurable in Settings |
28
30
  | **🖥️ Terminal** | Multi-tab xterm.js terminal with persistent PTY sessions, **touch gestures** (long-press+drag arrows, double-tap Tab, 3-finger paste), and a mobile quick-keys bar |
29
- | **📁 File Explorer** | Browse, read, edit, and manage files in your project workspace with folder drag-and-drop uploads, drag-to-move, and ZIP downloads |
31
+ | **📁 File Explorer** | Browse, read, edit, and manage files in your project workspace with auto-refresh on agent edits, folder drag-and-drop uploads, drag-to-move, and ZIP downloads |
30
32
  | **🔧 MCP Support** | Add, configure, and toggle MCP servers with a full settings UI |
31
- | **💾 Persistent UI Prefs** | Theme, sticky header, token usage toggle, and image compression — saved **server-side** in `~/.pi/agent/ui-settings.json`. Survives browser cache clears and device switches |
33
+ | **💾 Persistent UI Prefs** | Theme, language, sticky header, token usage toggle, image compression, trail view — saved **server-side** in `~/.pi/agent/ui-settings.json`. Survives browser cache clears and device switches |
32
34
  | **🧩 Orchestration** | Multi-agent workflows — supervise sub-agents, delegate tasks, inspect results |
33
35
  | **🔐 Auth** | Password-based login, API key support, JWT sessions |
34
36
  | **📱 Mobile-friendly** | PWA-ready, adaptive layout, touch gestures, virtual keyboard support |
@@ -37,6 +39,8 @@ This project was built out of **love and curiosity**.
37
39
  | **🔌 Tunnel** | Built-in tunnel helper UI for exposing local pi-kot traffic via supported providers, with install checks, diagnostics, and one-click start/stop |
38
40
  | **📦 Extensions** | Discover and install pi extensions from the UI — some features only appear after installing the right extension |
39
41
  | **🎨 Artifacts** | Agent-created HTML, SVG, Mermaid diagrams, and other files render inline in chat via sandboxed previews |
42
+ | **📎 Turn File Chips** | Files modified/created during each turn are summarized in clickable chips below the assistant message with diff previews |
43
+ | **✈️ Fly-to-Top Anchor** | Smooth prompt anchoring that flies your message to the top upon submit, keeping streaming responses comfortably in focus |
40
44
 
41
45
  ---
42
46
 
@@ -100,6 +104,57 @@ All flags also work as environment variables (`PORT`, `HOST`, `UI_PASSWORD`, `AP
100
104
 
101
105
  ---
102
106
 
107
+ ## Trail — Grouped Tool Display & Chain-of-Thought
108
+
109
+ When the agent executes consecutive tool calls or intersperses text between actions, pi-kot structures them into a clean **Trail**:
110
+
111
+ - **Auto (Justify)**: Collapses reasoning steps into preview rows. The newest step automatically stays expanded while the agent is live so you can follow its train of thought in real-time.
112
+ - **Expand All**: Expands all tools, justifications, and thinking blocks.
113
+ - **Consecutive Tool Grouping**: Identical consecutive actions (like reading multiple files) are automatically bundled (e.g. `8 × Read`) to avoid visual noise while remaining interactive.
114
+
115
+ ---
116
+
117
+ ## 📋 Native Plan Mode & Review Panel
118
+
119
+ pi-kot includes a 100% native, lightweight Plan Mode built directly into the agent lifecycle — no third-party extensions required:
120
+
121
+ - **Zero Token Overhead When Inactive**: Inactive turns consume **0 extra tokens**.
122
+ - **Dynamic In-Process Guardrails**: When toggled on, an in-process interceptor restricts the agent to exploring the codebase and drafting markdown plans (e.g. `PLAN.md`). Modifying code files is safely blocked until user approval.
123
+ - **Side Panel Review**: The agent pauses and submits its plan via `submit_plan`. Review the proposal in a side panel with rendered markdown, edit directly, approve with implementation notes, or request revisions.
124
+ - **Seamless Approval Flow**: Approving automatically transitions out of plan mode, allowing the agent to proceed with code modifications without any extra manual steps.
125
+ - **Toggle Anywhere**: Enable or exit Plan Mode anytime via the clipboard icon in the chat input, the banner above the prompt box, or the `/plan` slash command.
126
+
127
+ ---
128
+
129
+ ## Slash Commands
130
+
131
+ Type `/` in the chat input to access built-in and extension commands. Slash commands support arguments:
132
+
133
+ ```
134
+ /vision config provider openai
135
+ /vision show
136
+ /vision on
137
+ /compact
138
+ /compact with summary
139
+ /reload
140
+ /abort
141
+ ```
142
+
143
+ The dropdown stays visible while typing arguments, and arguments are forwarded directly to the target extension or command handler.
144
+
145
+ ---
146
+
147
+ ## 🌐 Internationalization (i18n)
148
+
149
+ pi-kot supports multiple languages out of the box:
150
+
151
+ - **English** (`en`)
152
+ - **简体中文** (`zh-CN` / Simplified Chinese)
153
+
154
+ Language is automatically detected from your browser settings and can be changed in **Settings → Appearance → Language**.
155
+
156
+ ---
157
+
103
158
  ## Terminal Touch Gestures
104
159
 
105
160
  pi-kot's terminal supports mobile touch gestures inspired by Termius:
@@ -121,17 +176,16 @@ Some features only appear **after** installing the corresponding extension. Head
121
176
  | --- | --- | --- |
122
177
  | **pi-web-access** 🌐 | `npm:pi-web-access` | Web search, content extraction, API interaction tools for the agent |
123
178
  | **pi-playwright** 🎭 | `npm:pi-playwright` | Browser automation — the agent can interact with real web UI |
124
- | **pi-vision-tool** 👁️ | `npm:pi-vision-tool` | **Vision agent selection** — non-vision models can delegate `describe_image` to a vision-capable model; full vision settings exposed in Extensions tab |
179
+ | **pi-vision-tool** 👁️ | `npm:pi-vision-tool` | **Vision agent selection** — non-vision models can delegate `describe_image` to a vision-capable model; full vision settings exposed in Extensions tab and slash commands (`/vision config`, `/vision show`, etc.) |
125
180
  | **pi-rewind** ⏪ | `npm:@ayulab/pi-rewind` | **Session revert** — checkpoint, rewind, and branch from any prior state |
126
- | **pi-plan-mode** 📋 | `npm:@narumitw/pi-plan-mode` | **Plan mode** — codex-like structured planning. Blocks mutating tools, adds `plan_mode_question` for structured user questions |
127
181
  | **context-mode** 🧠 | `npm:context-mode` | **Context window savings** — sandboxed code execution, FTS5 knowledge base, BM25 search, and session continuity across compaction |
128
182
 
129
183
  > 💡 **Tip**: Some UI elements only appear **after** the extension is installed. For example:
130
184
  >
131
- > - **Vision model selector** in Extensions tab → appears only after `pi-vision-tool` is installed
185
+ > - **Vision model selector & slash commands** → appears only after `pi-vision-tool` is installed
132
186
  > - **Rewind button** on chat messages → appears only after `pi-rewind` is installed
133
- > - **Plan mode tool safety** → appears only after `pi-plan-mode` is installed
134
187
  > - **Context stats/doctor commands** → appears only after `context-mode` is installed
188
+ > *(Note: **Plan mode & review side panel** is built-in natively out-of-the-box — no extension install required!)*
135
189
  > If something mentioned in this README doesn't show up, check the Extensions tab first.
136
190
 
137
191
  ---
@@ -242,7 +296,7 @@ If both are unset, auth is **disabled** and the UI opens freely.
242
296
 
243
297
  Browse and manage files in your project workspace.
244
298
 
245
- - **Open**: Click a file to read it
299
+ - **Open**: Click a file to read it; auto-refreshes when modified by the agent
246
300
  - **Edit**: Modify content directly in the editor (CodeMirror)
247
301
  - **New file/folder**: Right-click in the tree
248
302
  - **Delete**: Right-click a file
@@ -251,8 +305,6 @@ Browse and manage files in your project workspace.
251
305
  - **Download folder as ZIP**: Right-click a folder in the explorer and choose the download action
252
306
  - **Clone project**: Use the clone dialog to pull a repo into the workspace, with optional custom destination path
253
307
 
254
- The file explorer also shows files the agent has created or modified during the session.
255
-
256
308
  ---
257
309
 
258
310
  ## Git Panel
@@ -301,8 +353,8 @@ pi-kot can render agent-created content inline in chat — HTML pages, SVG image
301
353
 
302
354
  ### How it works
303
355
 
304
- 1. The agent writes files to `.pi/artifacts/` in your project directory
305
- 2. Files are served via `/api/v1/artifacts/<filename>`
356
+ 1. The agent writes files to `.pi/artifacts/` in your project directory (subfolders supported)
357
+ 2. Files are served via `/api/v1/artifacts/<path>`
306
358
  3. The chat renderer detects HTML/SVG/JSON/Markdown content and shows a live preview
307
359
 
308
360
  ### Supported formats
@@ -316,34 +368,6 @@ pi-kot can render agent-created content inline in chat — HTML pages, SVG image
316
368
  | **JSON** | ` ```json` or valid JSON tool output | Syntax highlighted |
317
369
  | **Image** | `data:image/...` or ` ```image` | `<img>` tag |
318
370
 
319
- ### Agent context injection
320
-
321
- pi-kot automatically injects a **web UI context** into every session, telling the agent:
322
-
323
- - It's running in a browser (not a terminal)
324
- - To write user-visible files to `.pi/artifacts/` in the current directory
325
- - To use `/api/v1/artifacts/<filename>` links for previews
326
- - To use Mermaid instead of ASCII art for diagrams
327
-
328
- This means the agent will automatically produce web-compatible output when creating diagrams, reports, or interactive content.
329
-
330
- ### Example
331
-
332
- Ask the agent:
333
- > "Create a futuristic button with hover effects"
334
-
335
- The agent will:
336
-
337
- 1. Write the HTML to `.pi/artifacts/button.html`
338
- 2. Output: `[Live Preview](/api/v1/artifacts/button.html)`
339
- 3. You see the rendered button inline in chat
340
-
341
- ### API route
342
-
343
- | Method | Path | Purpose |
344
- |---|---|---|
345
- | `GET` | `/api/v1/artifacts/:filename` | Serve an artifact file (no auth required) |
346
-
347
371
  ---
348
372
 
349
373
  ## Settings
@@ -352,75 +376,14 @@ Access settings via the **⚙** icon in the header.
352
376
 
353
377
  | Tab | What you can configure |
354
378
  | --- | --- |
355
- | **Appearance** | Theme picker, sticky user header, show token usage, image compression — all **persisted server-side** |
379
+ | **Appearance** | Theme picker, language (English / 简体中文), sticky user header, show token usage, image compression, trail default view — all **persisted server-side** |
356
380
  | **Providers** | View configured providers, add/remove API keys, add custom providers, raw models.json editor |
357
- | **Agent** | Default provider, default model, thinking level, model scope (hide unused models), orchestrator model |
381
+ | **Agent** | Default provider, default model, thinking level, model scope (hide unused models with **bulk select toggles**), orchestrator model |
358
382
  | **General** | Server & SDK versions, update check, reload page |
359
383
  | **Extensions ⚗️** | Install/manage pi extensions — **install the recommended ones to unlock features** |
360
384
  | **Skills** | Enable/disable agent skills |
361
385
  | **Tunnel 🚇** | Tunnel provider install check, diagnostics, start/stop tunnel, copy public URL |
362
386
 
363
- ### Image compression
364
-
365
- You can toggle automatic client-side image compression before sending images to the model. When enabled, images are downscaled to a max dimension and compressed to JPEG to reduce token usage.
366
-
367
- ---
368
-
369
- ## Troubleshooting
370
-
371
- ### "Connection lost" in terminal
372
-
373
- The terminal reconnects automatically with exponential backoff. If it doesn't reconnect:
374
-
375
- 1. Check that the server is still running
376
- 2. Refresh the page — tabs are restored from sessionStorage
377
- 3. If the server restarted, PTY sessions are lost — close and reopen tabs
378
-
379
- ### Login form keeps showing
380
-
381
- Your token expired or the server password changed. Sign out and log in again (or use **Clear stored token** on the login form).
382
-
383
- ### Terminal feels laggy on mobile
384
-
385
- - Tap responsiveness uses native touch events with minimal delay
386
- - 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
387
- - Try the **CTRL toggle** (quick-keys bar) instead of long-press for Ctrl+letter combinations
388
-
389
- ### Touch gestures not working
390
-
391
- - Make sure you're touching the terminal area, not the tab bar or quick-keys bar
392
- - For long-press + drag: **hold still for 150ms first**, then drag — don't swipe immediately
393
- - If text gets selected, the browser's default behavior is interfering — tap once to focus the terminal first
394
-
395
- ### Keyboard not appearing on mobile
396
-
397
- Tap anywhere on the terminal area to focus it. The quick-keys bar should appear, and the system keyboard should open.
398
-
399
- ---
400
-
401
- ## Project Structure
402
-
403
- ```
404
- pi-kot/
405
- ├── packages/
406
- │ ├── client/ # React SPA (Vite, xterm.js, Zustand)
407
- │ │ └── src/
408
- │ │ ├── components/ # UI components (ChatView, TerminalPanel, SlidePanel, ...)
409
- │ │ ├── stores/ # Zustand stores (session, layout, terminal, MCP, preferences)
410
- │ │ ├── hooks/ # Custom hooks (touch swipe, extensions, ...)
411
- │ │ └── lib/ # Utilities (API client, SSE, theme, tool-registry, ...)
412
- │ │ # Note: no normalize.ts — SDK types consumed directly
413
- │ └── server/ # Fastify server (REST, SSE, WebSocket, PTY)
414
- │ └── src/
415
- │ ├── routes/ # API routes (sessions, terminal, git, files, projects, extensions, tunnel, ...)
416
- │ ├── mcp/ # MCP server registry & manager
417
- │ ├── orchestration/ # Multi-agent orchestration
418
- │ ├── ask-user-question/ # Web-compatible tool wrappers (e.g. plan_mode_question)
419
- │ ├── tunnel/ # Tunnel providers, registry, service, install/doctor helpers
420
- │ └── ... # Config, auth, PTY manager, extension manager, etc.
421
- ├── CHANGELOG.md # Release notes & SDK upgrade history
422
- ```
423
-
424
387
  ---
425
388
 
426
389
  ## Tech Stack
@@ -429,9 +392,10 @@ pi-kot/
429
392
  | --- | --- |
430
393
  | **UI** | React, TypeScript, Vite, xterm.js, CodeMirror, Zustand |
431
394
  | **Server** | Fastify, ws (WebSocket), node-pty |
432
- | **SDK** | `@earendil-works/pi-coding-agent` (currently 0.84.2) |
395
+ | **SDK** | `@earendil-works/pi-coding-agent` (currently 0.87.1) |
433
396
  | **Auth** | JWT, scrypt password hashing |
434
397
  | **State** | Zustand (client), JSONL session files (server) |
398
+ | **i18n** | Lightweight custom registry supporting English & 简体中文 |
435
399
 
436
400
  ---
437
401