lithe-cli 0.2.0__tar.gz → 0.2.1__tar.gz

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 (51) hide show
  1. lithe_cli-0.2.1/PKG-INFO +381 -0
  2. lithe_cli-0.2.1/README.md +332 -0
  3. {lithe_cli-0.2.0 → lithe_cli-0.2.1}/lithe_cli/__init__.py +1 -1
  4. {lithe_cli-0.2.0 → lithe_cli-0.2.1}/lithe_cli/__main__.py +1 -0
  5. lithe_cli-0.2.1/lithe_cli/agent.py +647 -0
  6. lithe_cli-0.2.1/lithe_cli/cli_parser.py +196 -0
  7. lithe_cli-0.2.1/lithe_cli/clipboard.py +123 -0
  8. lithe_cli-0.2.1/lithe_cli/commands.py +70 -0
  9. lithe_cli-0.2.1/lithe_cli/config.py +419 -0
  10. lithe_cli-0.2.1/lithe_cli/main.py +580 -0
  11. lithe_cli-0.2.1/lithe_cli/profiles.py +472 -0
  12. lithe_cli-0.2.1/lithe_cli/prompts.py +171 -0
  13. lithe_cli-0.2.1/lithe_cli/sessions.py +164 -0
  14. lithe_cli-0.2.1/lithe_cli/setup.py +190 -0
  15. lithe_cli-0.2.1/lithe_cli/ttui.py +1159 -0
  16. lithe_cli-0.2.1/lithe_cli/ttui_render.py +134 -0
  17. lithe_cli-0.2.1/lithe_cli/ttui_widgets.py +652 -0
  18. lithe_cli-0.2.1/lithe_cli/tui.py +618 -0
  19. lithe_cli-0.2.1/lithe_cli/ui.py +366 -0
  20. lithe_cli-0.2.1/lithe_cli/workbench.py +1071 -0
  21. lithe_cli-0.2.1/lithe_cli.egg-info/PKG-INFO +381 -0
  22. lithe_cli-0.2.1/lithe_cli.egg-info/SOURCES.txt +39 -0
  23. lithe_cli-0.2.1/lithe_cli.egg-info/requires.txt +7 -0
  24. {lithe_cli-0.2.0 → lithe_cli-0.2.1}/pyproject.toml +1 -1
  25. lithe_cli-0.2.1/tests/test_cli.py +1155 -0
  26. lithe_cli-0.2.1/tests/test_cli_budget_steer.py +286 -0
  27. lithe_cli-0.2.1/tests/test_cli_clipboard.py +179 -0
  28. lithe_cli-0.2.1/tests/test_cli_guard.py +67 -0
  29. lithe_cli-0.2.1/tests/test_cli_sessions.py +271 -0
  30. lithe_cli-0.2.1/tests/test_cli_subagents.py +341 -0
  31. lithe_cli-0.2.1/tests/test_profiles.py +630 -0
  32. lithe_cli-0.2.1/tests/test_setup.py +173 -0
  33. lithe_cli-0.2.1/tests/test_ttui.py +1108 -0
  34. lithe_cli-0.2.1/tests/test_tui_v2.py +228 -0
  35. lithe_cli-0.2.1/tests/test_workbench.py +633 -0
  36. lithe_cli-0.2.0/PKG-INFO +0 -211
  37. lithe_cli-0.2.0/README.md +0 -164
  38. lithe_cli-0.2.0/lithe_cli/agent.py +0 -207
  39. lithe_cli-0.2.0/lithe_cli/config.py +0 -162
  40. lithe_cli-0.2.0/lithe_cli/main.py +0 -305
  41. lithe_cli-0.2.0/lithe_cli/ui.py +0 -210
  42. lithe_cli-0.2.0/lithe_cli.egg-info/PKG-INFO +0 -211
  43. lithe_cli-0.2.0/lithe_cli.egg-info/SOURCES.txt +0 -17
  44. lithe_cli-0.2.0/lithe_cli.egg-info/requires.txt +0 -5
  45. lithe_cli-0.2.0/tests/test_cli.py +0 -247
  46. {lithe_cli-0.2.0 → lithe_cli-0.2.1}/LICENSE +0 -0
  47. {lithe_cli-0.2.0 → lithe_cli-0.2.1}/lithe_cli/py.typed +0 -0
  48. {lithe_cli-0.2.0 → lithe_cli-0.2.1}/lithe_cli.egg-info/dependency_links.txt +0 -0
  49. {lithe_cli-0.2.0 → lithe_cli-0.2.1}/lithe_cli.egg-info/entry_points.txt +0 -0
  50. {lithe_cli-0.2.0 → lithe_cli-0.2.1}/lithe_cli.egg-info/top_level.txt +0 -0
  51. {lithe_cli-0.2.0 → lithe_cli-0.2.1}/setup.cfg +0 -0
@@ -0,0 +1,381 @@
1
+ Metadata-Version: 2.4
2
+ Name: lithe-cli
3
+ Version: 0.2.1
4
+ Summary: Command-line interface for the lithe agent kernel: chat, one-shot runs, undo, and run inspection.
5
+ License: MIT License
6
+
7
+ Copyright (c) 2026 betaloop contributors
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in all
17
+ copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
+ SOFTWARE.
26
+
27
+ Keywords: agent,llm,react,cli,tool-calling
28
+ Classifier: Development Status :: 4 - Beta
29
+ Classifier: Environment :: Console
30
+ Classifier: Intended Audience :: Developers
31
+ Classifier: License :: OSI Approved :: MIT License
32
+ Classifier: Programming Language :: Python :: 3
33
+ Classifier: Programming Language :: Python :: 3.10
34
+ Classifier: Programming Language :: Python :: 3.11
35
+ Classifier: Programming Language :: Python :: 3.12
36
+ Classifier: Programming Language :: Python :: 3.13
37
+ Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
38
+ Classifier: Typing :: Typed
39
+ Requires-Python: >=3.10
40
+ Description-Content-Type: text/markdown
41
+ License-File: LICENSE
42
+ Requires-Dist: lithe>=0.1.9
43
+ Requires-Dist: prompt-toolkit>=3.0.38
44
+ Requires-Dist: textual>=1.0
45
+ Provides-Extra: dev
46
+ Requires-Dist: pytest>=8; extra == "dev"
47
+ Requires-Dist: ruff>=0.4; extra == "dev"
48
+ Dynamic: license-file
49
+
50
+ # lithe-cli
51
+
52
+ [![PyPI](https://img.shields.io/pypi/v/lithe-cli.svg)](https://pypi.org/project/lithe-cli/)
53
+ [![Python](https://img.shields.io/pypi/pyversions/lithe-cli.svg)](https://pypi.org/project/lithe-cli/)
54
+ [![License: MIT](https://img.shields.io/pypi/lithe-cli.svg)](https://pypi.org/project/lithe-cli/)
55
+
56
+ **lithe-cli** is the command-line interface for
57
+ [lithe](https://pypi.org/project/lithe/) — the storage-free ReAct agent
58
+ kernel. Installing it pulls in `lithe` automatically and gives you a `lithe`
59
+ command: chat with an agent that reads and writes files in your workspace,
60
+ runs code, searches the web through MCP tools, inspects stored runs, and
61
+ undoes a run's mutations.
62
+
63
+ ```bash
64
+ pip install lithe-cli
65
+ ```
66
+
67
+ ## Configure
68
+
69
+ There is no default endpoint — the CLI refuses to run rather than silently
70
+ hitting some third-party URL. The easiest way in is the wizard: on the
71
+ first `lithe chat` / `lithe run` (or any time, via `lithe config`) an
72
+ interactive terminal walks a **provider-first interview** — profile name,
73
+ provider type (Tab-completed: openai / anthropic / zai / deepseek /
74
+ openrouter / qwen / moonshot, or `none` for a hand-written endpoint),
75
+ base_url (defaults to the preset's official URL — override it to point a
76
+ provider's format at your own router), API key, model — and saves them
77
+ to `$LITHE_HOME/config.json` (mode 0600 — it holds the key). An optional
78
+ connectivity probe catches typos before your first turn, using the
79
+ provider's own auth (`x-api-key` for messages endpoints).
80
+
81
+ The config file holds **named profiles** — several endpoints, one active:
82
+
83
+ ```json
84
+ {
85
+ "version": 2,
86
+ "active": "zhipu",
87
+ "profiles": {
88
+ "zhipu": {"base_url": "https://…", "api_key": "…", "model": "glm-4.6",
89
+ "context_window": 128000, "cached_models": ["glm-4.6"]},
90
+ "zai-preset": {"provider": "zai", "api_key": "…", "model": "glm-4.6"}
91
+ }
92
+ }
93
+ ```
94
+
95
+ A profile may set `"provider"` instead of (or alongside) `base_url`: the
96
+ vendor preset from `lithe.bundles.providers` fills `base_url` when unset
97
+ and contributes `LLMConfig` defaults (transport, `extra_body`,
98
+ `default_headers`) **under** your explicit values — you write the key and
99
+ model, the preset knows the endpoint shape. `--provider` /
100
+ `LITHE_PROVIDER` override the profile field; `config --list` / `--show`
101
+ display it; an unknown name fails loudly with the available presets
102
+ (openai / anthropic / zai / deepseek / openrouter / qwen / moonshot).
103
+
104
+ ```bash
105
+ lithe config # provider-first wizard (edits a named profile)
106
+ lithe config --list # profiles, key masked
107
+ lithe config --use openrouter # switch active profile (script-friendly)
108
+ lithe config --model glm-4.5 # set the active profile's default model
109
+ lithe config --provider anthropic # set the active profile's preset
110
+ # (none/off clears)
111
+ lithe models # GET {base_url}/models, cached into the profile
112
+ ```
113
+
114
+ A one-shot provider for a single invocation pairs the flag with an
115
+ explicit `--base-url` — the custom-router form without touching the
116
+ config file:
117
+
118
+ ```bash
119
+ lithe run --provider openrouter --base-url https://my-router/api/v1 \
120
+ --api-key sk-... --model vendor/claude-sonnet-4 "task"
121
+ ```
122
+
123
+ To configure by hand instead, point the CLI at any OpenAI-compatible
124
+ endpoint:
125
+
126
+ ```bash
127
+ export LITHE_API_KEY=sk-...
128
+ export LITHE_BASE_URL=https://your-endpoint/api/v1
129
+ export LITHE_MODEL=your-model
130
+ ```
131
+
132
+ Resolution order is flag (`--api-key`, `--base-url`, `--model`) >
133
+ environment > the selected profile's fields, per key; `--profile NAME`
134
+ (or `LITHE_PROFILE`) selects a profile for one invocation. The wizard
135
+ never runs without a TTY on both ends, so pipes and CI keep the hard
136
+ refusal; `--no-setup` restores that fail-fast behavior on terminals
137
+ too. `lithe config --show` peeks at the saved values with a masked key.
138
+
139
+ `LITHE_HOME` (default `~/.lithe`) locates the run store; the agent's
140
+ workspace defaults to the current directory (`--workspace` to change).
141
+
142
+ `lithe doctor` prints the effective configuration — endpoint (with a
143
+ masked key), config file, store, workspace, sandbox backend, skills, MCP
144
+ servers — so you can see what a run would use before starting one.
145
+
146
+ ## Use
147
+
148
+ ### One-shot task
149
+
150
+ ```bash
151
+ $ cd my-project
152
+ $ lithe run "总结 README.md 的要点,存到 SUMMARY.md"
153
+ ⚒ read_file 读取 README.md
154
+ ✓ 已读取 README.md(120 行) 0.1s
155
+ ⚒ write_file 写入 SUMMARY.md
156
+ ✓ 写入 SUMMARY.md(+12 行,新建) 0.0s
157
+ 已把要点写入 SUMMARY.md。
158
+ ── done · steps 3 · tokens 2100 · cost 0.0042
159
+ ```
160
+
161
+ 修改已有文件时,助手优先调用 `edit_file` 或 `apply_patch` 做局部更新;只有新建文件或需要整体替换时才使用 `write_file`。工具调用界面只显示工具名、文件路径等摘要,文件写入/编辑的结果带 `+N -M 行` 的行数变化提示(lithe 0.1.0 起由内核统计)。
162
+
163
+ `--stream` streams tokens as they generate; `-v` adds per-call
164
+ usage/context gauges; `--max-steps` caps the tool loop;
165
+ `--context-window` enables fullness gauges; `--reasoning-effort LEVEL`
166
+ sets the reasoning intensity for one invocation (flag > profile field;
167
+ `/reasoning` adjusts it in-session). Run budgets end the turn with
168
+ status `budget_exceeded` once crossed: `--max-cost USD` (needs a
169
+ `pricing` table in the profile on endpoints that report no usage cost)
170
+ and `--max-tokens N` (cumulative); both show progress lines in the
171
+ sidebar and adjust via `/set` (`off` clears). Sampling:
172
+ `--temperature` / `--max-output-tokens` (flag > profile field).
173
+
174
+ ### Full-screen interface
175
+
176
+ On an interactive terminal, `lithe chat` and `lithe run TASK` open a
177
+ persistent full-screen interface (built on [Textual](https://textual.textualize.io))
178
+ instead of scribbling one-line events into the console. The left pane is
179
+ the conversation; the right sidebar is five fixed sections — 会话(current
180
+ + recent ones, `●` marks sessions with a turn still running)、模型、运行、
181
+ 工具/待办、用量:
182
+
183
+ ```text
184
+ lithe 0.2.1 · ▣ #12 重构计划 │ zhipu · glm-4.6 │ ~/myproj ● 运行中
185
+ ╭──────────────────────────────────────╮╭──────────────────────────╮
186
+ │ 把 a.txt 改成三行待办清单 ││ ◆ 会话 │
187
+ │ ◆ edit_file · 局部修改 a.txt ││ #12 重构计划 ● │
188
+ │ ✓ 编辑 a.txt(+3 -1 行) 0.0s ││ #11 bugfix ✓ 7轮 │
189
+ │ 已完成。 ││ F3 切换 · /new 新建 │
190
+ │ ││ ◆ 模型 │
191
+ │ ││ zhipu · glm-4.6 │
192
+ │ ││ zai · chat · F7 端点 │
193
+ │ ││ ◆ 会话用量 │
194
+ │ ││ 输入 1,024 · 输出 216 │
195
+ ╰──────────────────────────────────────╯╰──────────────────────────╯
196
+ Tab 采纳 → /model /models /new
197
+ lithe ❯ _
198
+ ● 运行中 · 步骤 2/35 Enter 发送 · F2 侧栏 · F3 会话 · F4 模型 · F5 设置 · F6 推理 · F7 端点 · /help
199
+ ```
200
+
201
+ **Switch without leaving the screen**: `F3` opens the session picker
202
+ (`Enter` switch, `n` new, `d` delete, `r` rename), `F4` the model picker
203
+ (grouped by profile; `Enter` switch, `s` save as the profile's default,
204
+ `r` fetch `/models`), `F5` the settings picker (`Enter` toggles a
205
+ capability; see below), and `F7` the **endpoint manager** — every saved
206
+ profile with its `provider · transport` dialect, base_url and masked
207
+ key; `Enter` switches, `n` creates a profile right in the form (provider
208
+ type cycled with Enter, base_url defaulting to each preset's official
209
+ URL — overridable for custom routers, star-echoed API key), `e` edits
210
+ one, `p` swaps its provider type. A profile created in the form is
211
+ switched to on save; edits to the current profile apply to the next
212
+ turn. Switching away from a running session does **not**
213
+ cancel it — its badge stays lit and the pane rebuilds from the store when
214
+ you come back. Typing `/` shows matching commands above the prompt (`Tab`
215
+ accepts; `/model`, `/profile`, `/set` complete their arguments too),
216
+ and `↑`/`↓` recall the persistent input history. `Ctrl+C` cancels the
217
+ current turn (a second press during the same turn force-exits) and exits
218
+ when idle. Plain text typed mid-turn **steers** the running agent: it is
219
+ queued into the kernel's steering inbox and injected as a user message at
220
+ the next step boundary (rendered in the transcript; persistently
221
+ recorded), so you can correct course while it works — texts that cannot
222
+ be injected before the turn ends are honestly reported as dropped. Slash
223
+ commands work while a turn runs. The transcript follows new output only
224
+ while you're at the bottom — scroll up to re-read and your position
225
+ sticks.
226
+
227
+ Text selection uses the terminal's native `Shift+drag` (hide the sidebar
228
+ with F2 first if it grabs both panes). Pipes and CI keep the plain
229
+ per-line output unchanged; the legacy prompt_toolkit full-screen was
230
+ removed — the Textual UI is the only full-screen front-end.
231
+
232
+ ### Sessions
233
+
234
+ Every chat conversation persists as a kernel conversation (one run per
235
+ turn, messages written incrementally):
236
+
237
+ ```bash
238
+ lithe chat -c # continue the most recent session
239
+ lithe chat --resume 12 # by id (or unique title prefix)
240
+ lithe sessions # list; newest activity first
241
+ lithe sessions --rename 12 规划 # rename
242
+ lithe sessions --delete 12 # soft delete (runs stay: log/undo work)
243
+ ```
244
+
245
+ A session remembers its last profile and model and restores them on
246
+ resume (unless `--model`/env pinned). Inside chat, the same operations
247
+ are slash commands: `/sessions`, `/resume 12`, `/new [标题]`,
248
+ `/rename 标题`, `/model glm-4.5 [--save]`, `/profile zhipu`,
249
+ `/models`, `/undo`, `/tools`, `/sidebar`, `/help`, `/exit`.
250
+
251
+ ### In-session settings
252
+
253
+ The per-turn knobs don't need a restart: `/set` (or `F5`) opens a picker
254
+ where `Enter` toggles a capability, and typed forms set anything —
255
+ `/set shell on`, `/set code off`, `/set vision`, `/set document on`,
256
+ `/set max-steps 50`, `/set timeout 240`, `/set attempts 3`,
257
+ `/set stream on`, `/set verbose`.
258
+ Settings apply to the **next turn** (the running turn keeps its own tool
259
+ set), stay session-scoped (nothing is written to the profile), and
260
+ turning `shell` on restates its trust warning. `/tools` re-derives the
261
+ registry after a capability flip, so the listing always matches what the
262
+ next turn will see.
263
+
264
+ **Reasoning intensity**: `/reasoning` (or `F6`) picks a level —
265
+ `off / minimal / low / medium / high`, or any value your model accepts
266
+ (`none` on some) typed directly; `--save` persists it to the profile. The
267
+ kernel maps it per protocol (`reasoning_effort` on chat-completions,
268
+ `reasoning.effort` on Responses) and combines it with
269
+ `extra_body["reasoning"]` siblings such as OpenRouter's
270
+ `max_tokens`/`exclude`. The sidebar shows the active level when set.
271
+
272
+ ### Extra capabilities
273
+
274
+ The kernel ships these as bundles; the CLI grants them per flag:
275
+
276
+ | Flag | Tools granted | Notes |
277
+ | --- | --- | --- |
278
+ | `--code` | `run_code` / `run_file` | Python under bubblewrap when installed (passthrough otherwise); `doctor` shows which |
279
+ | `--shell` | `run_command` | Native bash/sh on Linux and macOS, PowerShell/cmd on Windows; runs with the current user's host permissions, is not sandboxed, and cannot be undone |
280
+ | `--skills DIR` | `load_skill` | markdown skill library; defaults to `$LITHE_HOME/skills` when it exists, `--skills ""` disables |
281
+ | `--download` | `download_file` | SSRF-guarded, size-capped network fetch |
282
+ | `--vision` | `image_info` / `analyze_image` | image probe is stdlib-only; analysis routes one vision call to the main endpoint |
283
+ | `--document` | `document_info` / `analyze_document` | PDF/DOCX/XLSX/PPTX reading on the main endpoint; `/set document` toggles in-session |
284
+ | `--document-format` | (dialect for `analyze_document`) | `inline-file` (OpenRouter family) / `files-api` (strict OpenAI upload) / `none` (probe only); default: profile field `document_format`, else provider preset |
285
+ | `--max-cost USD` | (run budget) | the turn ends `budget_exceeded` once cumulative cost crosses it; on endpoints reporting no `usage.cost` add a profile `pricing` table (`{"prompt": 3, "completion": 15}` per 1M) — the preset providers' known prices work too |
286
+ | `--max-tokens N` | (run budget) | cumulative token budget for the turn; `--max-output-tokens N` is the different per-call cap |
287
+ | `--subagents` / `--no-subagents` | `delegate` / `delegate_parallel` | kernel delegation on the default roster — `researcher` (read-only lookup, gains vision/document tools with those flags), `coder` (file edits + `run_code` with `--code`), `operator` (`run_command`/`download_file`, present only with `--shell`/`--download`); children inherit the endpoint and budgets, parallel workers share one live cost ceiling; **on by default** (the roster reuses already-enabled tools only — no new powers); `/set subagents` toggles in-session |
288
+ | `--mcp SPEC` | whatever the servers expose | JSON array/object or `@file` (env `LITHE_MCP`); stdio and streamable-http; failed servers degrade gracefully |
289
+
290
+ ```bash
291
+ $ lithe run --code "用 run_code 验证 results.csv 的行数"
292
+ $ lithe run --document "总结 report.pdf 的结论,存到 NOTES.md"
293
+ $ lithe run --subagents "先让 researcher 摸清 src 结构,再让 coder 分头改"
294
+ $ lithe run --shell "检查当前目录的项目状态"
295
+ $ lithe chat --skills ~/my-skills --mcp @~/mcp.json
296
+ ```
297
+
298
+ ### Undo a run
299
+
300
+ The bundled file and todo tools register reverters, so undo works with zero
301
+ configuration:
302
+
303
+ ```bash
304
+ $ lithe runs # find the run
305
+ run status steps cost task
306
+ ──────────── ────── ───── ──── ────────────────
307
+ abc123def456 done 3 0.01 总结 README.md …
308
+ $ lithe undo abc123def456
309
+ ✓ 已撤销 2 个操作(run abc123def456)
310
+ ```
311
+
312
+ A file the run created is deleted; a file it overwrote is restored.
313
+ (`run_code` side effects are not revertible — its tool description warns
314
+ the model.)
315
+
316
+ ### Inspect
317
+
318
+ ```bash
319
+ $ lithe runs # stored runs (newest last)
320
+ $ lithe sessions # stored conversations (newest first)
321
+ $ lithe log abc123def456 # messages + actions of one run
322
+ $ lithe models # what the endpoint offers (cached)
323
+ $ lithe doctor # config + capability status
324
+ ```
325
+
326
+ ### Tools
327
+
328
+ ```bash
329
+ $ lithe tools # what the agent can do
330
+ tool category description
331
+ ──────────── ──────── ──────────────────────────────
332
+ apply_patch WRITE 以行级 patch 一次修改多个文件…
333
+ read_file READ 读取文件内容…
334
+ ...
335
+ ```
336
+
337
+ The default tool set is the workspace bundle (`read_file` / `write_file` /
338
+ `edit_file` / `list_files` / `search_files` / `glob_files` /
339
+ `apply_patch`) plus todos (`update_todos` / `list_todos`); the flags above
340
+ add capabilities. (MCP tools attach at run time, so `lithe tools` lists
341
+ them only after a session has started the servers.)
342
+
343
+ ### Colors
344
+
345
+ Output is colored when stdout is a TTY and `NO_COLOR` is unset; `--color`
346
+ / `--no-color` force either way. Output rendering itself stays
347
+ dependency-free — plain text degrades cleanly through pipes and cron.
348
+ Interactive *input* (the chat prompt and the setup wizard) is
349
+ [prompt_toolkit](https://python-prompt-toolkit.readthedocs.io/):
350
+ wide-character-safe editing, bracketed-paste handling, star-echoed API
351
+ keys, inline wizard validation, and persistent history.
352
+
353
+ ## Where things land
354
+
355
+ | Path | Contents |
356
+ | --- | --- |
357
+ | current dir (or `--workspace`) | the agent's sandboxed workspace — every tool path resolves strictly inside it |
358
+ | `~/.lithe/config.json` (or `LITHE_HOME`) | endpoint profiles: `{version, active, profiles}` (0600 — it holds keys) |
359
+ | `~/.lithe/runs` (or `--store`) | JSONL run store: conversations, runs, messages, actions, undo records |
360
+ | `~/.lithe/runs/todos-<scope-hash>.json` | the agent's task list, isolated by user and resolved workspace |
361
+ | `~/.lithe/skills` (or `--skills`) | the markdown skill library, when enabled |
362
+ | `~/.lithe/history` | chat input history (prompt_toolkit `FileHistory`; `↑`/`↓` recall in the TUI, Ctrl+R search in the plain REPL) |
363
+
364
+ ## Design notes
365
+
366
+ - The CLI is a thin host over a `Workbench`: the workbench owns the
367
+ endpoint view (profile + model), the session manager and the running
368
+ turns; the plain REPL and the full-screen Textual app are both just
369
+ subscribers to its event bus and callers of one dispatcher. Everything
370
+ else (ReAct loop, streaming, budgets, replay, undo engine) is reused
371
+ from lithe.
372
+ - The Textual screen is tested headlessly with `App.run_test()` pilots
373
+ (turns, F2/F3/F4, history, completion) — real interaction tests that
374
+ also run on Windows; its pure builders (sidebar/header/footer markup,
375
+ completion suggestions) and the shared `TuiState` event folding have
376
+ direct unit tests.
377
+ - `python -m lithe_cli` works alongside the `lithe` console script.
378
+
379
+ ## License
380
+
381
+ MIT