scootcli 0.14.2__tar.gz → 0.16.0__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 (128) hide show
  1. {scootcli-0.14.2 → scootcli-0.16.0}/PKG-INFO +24 -10
  2. scootcli-0.14.2/src/scootcli.egg-info/PKG-INFO → scootcli-0.16.0/README.md +15 -28
  3. {scootcli-0.14.2 → scootcli-0.16.0}/pyproject.toml +2 -2
  4. scootcli-0.16.0/setup.py +47 -0
  5. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/__init__.py +1 -1
  6. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/agent.py +28 -4
  7. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/approvals.py +21 -56
  8. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/cli.py +9 -2
  9. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/commands/__init__.py +1 -0
  10. scootcli-0.16.0/src/scootcli/commands/error.py +45 -0
  11. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/commands/status.py +2 -2
  12. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/config.py +1 -0
  13. scootcli-0.16.0/src/scootcli/diagnostics.py +153 -0
  14. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/headless.py +22 -3
  15. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/pricing.py +49 -3
  16. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/repl.py +36 -10
  17. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/sessions.py +11 -4
  18. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/tools/__init__.py +8 -0
  19. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/tools/base.py +1 -0
  20. scootcli-0.16.0/src/scootcli/tools/web_search.py +102 -0
  21. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/transport.py +68 -9
  22. scootcli-0.14.2/README.md → scootcli-0.16.0/src/scootcli.egg-info/PKG-INFO +48 -9
  23. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli.egg-info/SOURCES.txt +9 -0
  24. {scootcli-0.14.2 → scootcli-0.16.0}/tests/test_approvals.py +112 -0
  25. {scootcli-0.14.2 → scootcli-0.16.0}/tests/test_config.py +13 -0
  26. scootcli-0.16.0/tests/test_connect_cancel.py +106 -0
  27. scootcli-0.16.0/tests/test_diagnostics.py +151 -0
  28. {scootcli-0.14.2 → scootcli-0.16.0}/tests/test_headless.py +27 -1
  29. scootcli-0.16.0/tests/test_midturn_saves.py +154 -0
  30. scootcli-0.16.0/tests/test_packaging.py +52 -0
  31. scootcli-0.16.0/tests/test_pricing.py +53 -0
  32. {scootcli-0.14.2 → scootcli-0.16.0}/tests/test_readiness.py +2 -1
  33. {scootcli-0.14.2 → scootcli-0.16.0}/tests/test_tools.py +69 -0
  34. {scootcli-0.14.2 → scootcli-0.16.0}/LICENSE +0 -0
  35. {scootcli-0.14.2 → scootcli-0.16.0}/setup.cfg +0 -0
  36. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/__main__.py +0 -0
  37. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/activity.py +0 -0
  38. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/auth.py +0 -0
  39. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/clipboard.py +0 -0
  40. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/commands/approve.py +0 -0
  41. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/commands/auth.py +0 -0
  42. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/commands/base.py +0 -0
  43. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/commands/compact.py +0 -0
  44. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/commands/copy.py +0 -0
  45. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/commands/exit.py +0 -0
  46. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/commands/forget.py +0 -0
  47. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/commands/help.py +0 -0
  48. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/commands/hooks.py +0 -0
  49. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/commands/init.py +0 -0
  50. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/commands/logo.py +0 -0
  51. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/commands/model.py +0 -0
  52. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/commands/panel.py +0 -0
  53. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/commands/reset.py +0 -0
  54. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/commands/resume.py +0 -0
  55. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/commands/route.py +0 -0
  56. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/commands/save.py +0 -0
  57. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/commands/scope.py +0 -0
  58. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/commands/sessions.py +0 -0
  59. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/commands/verbosity.py +0 -0
  60. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/commands/worktree.py +0 -0
  61. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/commands/yolo.py +0 -0
  62. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/context.py +0 -0
  63. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/credentials.py +0 -0
  64. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/errors.py +0 -0
  65. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/hooks.py +0 -0
  66. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/images.py +0 -0
  67. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/keys.py +0 -0
  68. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/lineeditor.py +0 -0
  69. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/logo.py +0 -0
  70. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/models.py +0 -0
  71. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/panel.py +0 -0
  72. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/preferences.py +0 -0
  73. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/presets.py +0 -0
  74. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/project.py +0 -0
  75. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/prompts.py +0 -0
  76. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/providers/__init__.py +0 -0
  77. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/providers/anthropic.py +0 -0
  78. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/providers/base.py +0 -0
  79. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/providers/openai_chat.py +0 -0
  80. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/providers/openai_responses.py +0 -0
  81. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/providers/registry.py +0 -0
  82. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/providers/router.py +0 -0
  83. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/rendering.py +0 -0
  84. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/resize.py +0 -0
  85. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/status.py +0 -0
  86. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/store.py +0 -0
  87. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/tools/edit_file.py +0 -0
  88. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/tools/list_dir.py +0 -0
  89. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/tools/open_editor.py +0 -0
  90. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/tools/read_file.py +0 -0
  91. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/tools/run_shell.py +0 -0
  92. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/tools/search.py +0 -0
  93. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/tools/update_plan.py +0 -0
  94. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/tools/write_file.py +0 -0
  95. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/updates.py +0 -0
  96. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/vision.py +0 -0
  97. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/workspace.py +0 -0
  98. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli/worktree.py +0 -0
  99. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli.egg-info/dependency_links.txt +0 -0
  100. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli.egg-info/entry_points.txt +0 -0
  101. {scootcli-0.14.2 → scootcli-0.16.0}/src/scootcli.egg-info/top_level.txt +0 -0
  102. {scootcli-0.14.2 → scootcli-0.16.0}/tests/test_agent.py +0 -0
  103. {scootcli-0.14.2 → scootcli-0.16.0}/tests/test_anthropic.py +0 -0
  104. {scootcli-0.14.2 → scootcli-0.16.0}/tests/test_auth.py +0 -0
  105. {scootcli-0.14.2 → scootcli-0.16.0}/tests/test_clipboard.py +0 -0
  106. {scootcli-0.14.2 → scootcli-0.16.0}/tests/test_hooks.py +0 -0
  107. {scootcli-0.14.2 → scootcli-0.16.0}/tests/test_images.py +0 -0
  108. {scootcli-0.14.2 → scootcli-0.16.0}/tests/test_lineeditor.py +0 -0
  109. {scootcli-0.14.2 → scootcli-0.16.0}/tests/test_logo.py +0 -0
  110. {scootcli-0.14.2 → scootcli-0.16.0}/tests/test_models.py +0 -0
  111. {scootcli-0.14.2 → scootcli-0.16.0}/tests/test_panel.py +0 -0
  112. {scootcli-0.14.2 → scootcli-0.16.0}/tests/test_preferences.py +0 -0
  113. {scootcli-0.14.2 → scootcli-0.16.0}/tests/test_providers.py +0 -0
  114. {scootcli-0.14.2 → scootcli-0.16.0}/tests/test_rendering.py +0 -0
  115. {scootcli-0.14.2 → scootcli-0.16.0}/tests/test_repl.py +0 -0
  116. {scootcli-0.14.2 → scootcli-0.16.0}/tests/test_resilience.py +0 -0
  117. {scootcli-0.14.2 → scootcli-0.16.0}/tests/test_resize.py +0 -0
  118. {scootcli-0.14.2 → scootcli-0.16.0}/tests/test_router.py +0 -0
  119. {scootcli-0.14.2 → scootcli-0.16.0}/tests/test_scope.py +0 -0
  120. {scootcli-0.14.2 → scootcli-0.16.0}/tests/test_sessions.py +0 -0
  121. {scootcli-0.14.2 → scootcli-0.16.0}/tests/test_small_060.py +0 -0
  122. {scootcli-0.14.2 → scootcli-0.16.0}/tests/test_smoke.py +0 -0
  123. {scootcli-0.14.2 → scootcli-0.16.0}/tests/test_store.py +0 -0
  124. {scootcli-0.14.2 → scootcli-0.16.0}/tests/test_streaming.py +0 -0
  125. {scootcli-0.14.2 → scootcli-0.16.0}/tests/test_transport_native.py +0 -0
  126. {scootcli-0.14.2 → scootcli-0.16.0}/tests/test_vision.py +0 -0
  127. {scootcli-0.14.2 → scootcli-0.16.0}/tests/test_workspace.py +0 -0
  128. {scootcli-0.14.2 → scootcli-0.16.0}/tests/test_worktree.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: scootcli
3
- Version: 0.14.2
3
+ Version: 0.16.0
4
4
  Summary: A tiny coding agent that goes where you point it
5
5
  Author: Sergey Nes
6
6
  License-Expression: MIT
@@ -21,6 +21,8 @@ Classifier: Topic :: Utilities
21
21
  Requires-Python: >=3.9
22
22
  Description-Content-Type: text/markdown
23
23
  License-File: LICENSE
24
+ Dynamic: description
25
+ Dynamic: description-content-type
24
26
  Dynamic: license-file
25
27
 
26
28
  # scoot
@@ -31,7 +33,7 @@ Dynamic: license-file
31
33
  [![Dependencies: none](https://img.shields.io/badge/dependencies-none-brightgreen.svg)](#install-options)
32
34
  [![Platform](https://img.shields.io/badge/platform-macOS%20%7C%20Linux-lightgrey.svg)](#install-options)
33
35
  [![Providers](https://img.shields.io/badge/providers-OpenAI%20%7C%20Anthropic%20%7C%20xAI%20%7C%20Groq%20%7C%20Ollama-orange.svg)](#providers-and-models)
34
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](./LICENSE)
36
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/sergenes/scootcli/blob/v0.16.0/LICENSE)
35
37
 
36
38
  ```
37
39
  ╭───╮ scoot: a tiny coding agent that goes where you point it.
@@ -168,7 +170,7 @@ A project's other secrets never enter scoot's process through a `.env` file.
168
170
  cp .env.example ~/.config/scoot/.env && chmod 600 ~/.config/scoot/.env
169
171
  ```
170
172
 
171
- The most useful settings (see [`.env.example`](./.env.example) for all of them):
173
+ The most useful settings (see [`.env.example`](https://github.com/sergenes/scootcli/blob/v0.16.0/.env.example) for all of them):
172
174
 
173
175
  | setting | meaning | default |
174
176
  |---|---|---|
@@ -179,6 +181,7 @@ The most useful settings (see [`.env.example`](./.env.example) for all of them):
179
181
  | `SCOOT_APPROVAL` | `always` · `auto-read` · `auto-edits` · `yolo` | `yolo` |
180
182
  | `SCOOT_MAX_STEPS` | tool-call steps per turn before asking to continue | `50` |
181
183
  | `SCOOT_OLLAMA_BASE_URL` | where Ollama listens | `http://localhost:11434/v1` |
184
+ | `SCOOT_SEARCH_URL` | your SearXNG instance; turns `web_search` on | off |
182
185
  | `HTTPS_PROXY` | proxy for hosted providers; localhost is never proxied | |
183
186
 
184
187
  ## Usage
@@ -214,6 +217,7 @@ scoot --no-panel --no-dock # plain prompt, no status bar (also what yo
214
217
  /route how auto picks a model
215
218
  /sessions list saved sessions /resume resume a saved session ([id])
216
219
  /forget delete session(s) /panel toggle the bottom status bar
220
+ /error this session's last error
217
221
  /verbosity feed detail (full|compact|quiet)
218
222
  /c copy last answer (Ctrl-S) /exit quit (also Ctrl-C)
219
223
  ```
@@ -233,11 +237,17 @@ Without a TTY, scoot falls back to a plain prompt with no bar and no dock.
233
237
  The agent has eight tools: `read_file`, `list_dir`, `search`, `write_file`, `edit_file`, `run_shell`, `open_editor` (hands a file to IntelliJ IDEA's `idea -e` or to VS Code, `SCOOT_EDITOR` picks), and `update_plan` (a progress checklist for multi-step work).
234
238
  Paths are resolved against the workspace root, and `~` works.
235
239
 
240
+ A ninth tool, `web_search`, is off until you point scoot at a [SearXNG](https://docs.searxng.org/) instance you run: set `SCOOT_SEARCH_URL` (for example `http://localhost:8888`) in your environment or in `~/.config/scoot/.env`.
241
+ SearXNG is self-hosted, so there is no API key and no account; it needs `json` added to `search.formats` in its `settings.yml`.
242
+ A search returns up to 10 results (title, URL, snippet) and does not open the pages.
243
+ Every search asks first and shows the exact query, in every approval mode including `yolo`, because the query leaves your machine.
244
+
236
245
  The workspace is where the agent works, not a wall.
237
246
  When a tool needs a file outside it, in `~/.config`, another repo, `/etc`, scoot asks once: allow this path `[a]`, allow that directory for the session `[d]`, allow anywhere for the session `[A]`, skip `[s]`, or quit `[q]`.
238
247
  `--scope anywhere`, `SCOOT_SCOPE=anywhere`, or `/scope anywhere` skip the question; `/scope` shows what has been granted.
239
248
 
240
- When a call needs approval you can approve once `[a]`, trust that tool for the session `[t]`, approve everything this session `[A]`, edit the arguments `[e]`, skip `[s]`, or quit `[q]`.
249
+ When a call needs approval you approve it `[a]` or skip it `[s]`; ESC stops the turn.
250
+ Each answer covers that one call; to stop being asked, change the mode.
241
251
  `/approve <mode>` sets how much runs without asking: `always` prompts for everything, `auto-read` auto-approves reads, `auto-edits` also auto-approves file edits, `yolo` runs everything.
242
252
  Catastrophic shell commands (a denylist: `rm -rf /`, `git push --force`, piping downloads into a shell, and so on) are re-confirmed in every mode.
243
253
 
@@ -248,7 +258,9 @@ A commit or merge that fails keeps the worktree and your files; nothing is remov
248
258
 
249
259
  Responses stream live and stay interruptible.
250
260
  Drag an image into the prompt and a vision-capable model describes it into the turn as text, so even a text-only coding model can act on it; `SCOOT_VISION_MODEL` pins the describer, `--no-images` turns the feature off.
251
- Every turn auto-saves under `~/.local/state/scoot/sessions/` (owner-only, secrets redacted, last 20 kept); `scoot --continue` or `/resume` picks up where you left off.
261
+ Sessions auto-save under `~/.local/state/scoot/sessions/` (owner-only, secrets redacted, last 20 kept), and not only when a turn ends: the prompt is saved before work starts, then each proposed tool batch and each tool result, so a crash or a killed terminal loses nothing that finished.
262
+ `scoot --continue` or `/resume` picks up where you left off.
263
+ When a turn fails, `/error` shows the latest error for the session (class, status, hint, and where it was raised), even after compaction or a restart.
252
264
 
253
265
  ### Automation: hooks and headless mode
254
266
 
@@ -272,7 +284,7 @@ Matchers understand Claude Code's tool names as well as scoot's, so `"matcher":
272
284
 
273
285
  **Headless mode** is for editors, automation, and remote-control tools: `scoot --headless` reads JSON lines on stdin (`prompt`, `approve`, `note`, `interrupt`, `command`, `shutdown`) and writes JSON lines on stdout (streamed text, tool calls, approval requests, results, plan updates, usage, errors, a heartbeat), with nothing else ever printed there.
274
286
  Same sessions, tools, approvals, routing, and hooks as the REPL; every `turn_end` carries the turn's tokens and cost, and `--json` one-shot output carries `cost` too.
275
- The message tables and a full transcript are in [`docs/headless-protocol.md`](./docs/headless-protocol.md); an unanswered approval is denied after `SCOOT_APPROVAL_TIMEOUT` seconds (default 120).
287
+ The message tables and a full transcript are in [`docs/headless-protocol.md`](https://github.com/sergenes/scootcli/blob/v0.16.0/docs/headless-protocol.md); an unanswered approval is denied after `SCOOT_APPROVAL_TIMEOUT` seconds (default 120).
276
288
 
277
289
  ### The status bar
278
290
 
@@ -317,8 +329,8 @@ python -m pytest -q # network-free suite
317
329
  ./scripts/build.sh # dist/scoot.pyz + wheel + sdist
318
330
  ```
319
331
 
320
- Design notes live in [`DESIGN.md`](./DESIGN.md), the behaviour spec in [`SPEC.md`](SPEC.md), what is next in [`ROADMAP.md`](./ROADMAP.md), and the release history in [`CHANGELOG.md`](./CHANGELOG.md).
321
- Want to build a CLI agent like this yourself? [`docs/blueprint.md`](./docs/blueprint.md) is the minimal spec: the components, the turn, the tools, the permission rules, and the acceptance checks, with no dependency on scoot's code.
332
+ Design notes live in [`DESIGN.md`](https://github.com/sergenes/scootcli/blob/v0.16.0/DESIGN.md), the behaviour spec in [`SPEC.md`](https://github.com/sergenes/scootcli/blob/v0.16.0/SPEC.md), what is next in [`ROADMAP.md`](https://github.com/sergenes/scootcli/blob/v0.16.0/ROADMAP.md), and the release history in [`CHANGELOG.md`](https://github.com/sergenes/scootcli/blob/v0.16.0/CHANGELOG.md).
333
+ Want to build a CLI agent like this yourself? [`docs/blueprint.md`](https://github.com/sergenes/scootcli/blob/v0.16.0/docs/blueprint.md) is the minimal spec: the components, the turn, the tools, the permission rules, and the acceptance checks, with no dependency on scoot's code.
322
334
  New capability is a drop-in file: a tool in `tools/`, a slash command in `commands/`, a provider row or adapter in `providers/`.
323
335
 
324
336
  ## Security
@@ -328,8 +340,10 @@ What scoot protects, and what it does not.
328
340
  - **Your API keys.** Read from the environment or from `~/.config/scoot/credentials.json` (directory `0700`, file `0600`), validated before saving, never echoed, and removed from the environment of every hook scoot runs. Key-shaped strings are masked in error messages and in saved sessions (message text, tool arguments, and the text copies inside provider replay data; signed or encrypted replay fields are stored as received). Streamed model output is printed as it arrives and is not filtered.
329
341
  - **A cloned repository cannot reconfigure you.** A project `.env` may choose the model, effort, and how the terminal looks. It may not set provider base URLs or proxies (which would send your key elsewhere), the approval mode, the scope, the root, hooks, or scoot's config and state directories; those come from flags, your environment, or `~/.config/scoot/.env`, and a project value for them is ignored and reported at start. A project's `.scoot/hooks.json` runs only after you review it and run `/hooks trust`; the trust is bound to the file's content, so an edited file asks again.
330
342
  - **File tools are scoped, shell commands are not sandboxed.** `read_file`, `list_dir`, `search`, `write_file`, and `edit_file` stay inside the workspace plus the paths you grant, and never follow a symlink out of it. `run_shell` runs the command as you, with your normal access to files, network, and other programs; approving a command means exactly that. The denylist (`rm -rf`, `git push`, `sudo`, piping a download into a shell, and so on) is an accident guard that forces a confirmation in every mode, including when a project's hook says `allow` (a hook in your own global config can waive it, so an editor or phone bridge you installed still works); it is not a boundary.
331
- - **The default is `yolo`.** Tool calls run without asking, except the denylist and paths outside the workspace. Use `--approval always` or `auto-read` on code you do not trust yet, and `/worktree start` to keep autonomous edits out of your checkout.
343
+ - **Web search is opt-in and always asks.** `web_search` exists only when you set `SCOOT_SEARCH_URL` yourself; a project `.env` cannot set it. Every query is shown and confirmed in every mode, and results are passed to the model as untrusted text.
344
+ - **The default is `yolo`.** Tool calls run without asking, except the denylist, web searches, and paths outside the workspace. Use `--approval always` or `auto-read` on code you do not trust yet, and `/worktree start` to keep autonomous edits out of your checkout.
332
345
  - **Saved sessions** are owner-only, keyed by workspace, and pruned to the last 20; `/forget all` removes them. Session ids are file names, never paths.
346
+ - **The `/error` record** is owner-only and holds metadata only: the error class, status or `errno`, and stack locations. It never holds local variables, payloads, or credentials, and it is deleted with its session.
333
347
  - No third-party dependencies means no third-party code to audit.
334
348
 
335
349
  ## Contributing
@@ -343,5 +357,5 @@ If you have an idea that does not meet that bar, a fork is the right home for it
343
357
 
344
358
  ## License
345
359
 
346
- MIT, see [`LICENSE`](./LICENSE).
360
+ MIT, see [`LICENSE`](https://github.com/sergenes/scootcli/blob/v0.16.0/LICENSE).
347
361
  Written by [Sergey Nes](https://www.linkedin.com/in/sergey-neskoromny).
@@ -1,28 +1,3 @@
1
- Metadata-Version: 2.4
2
- Name: scootcli
3
- Version: 0.14.2
4
- Summary: A tiny coding agent that goes where you point it
5
- Author: Sergey Nes
6
- License-Expression: MIT
7
- Project-URL: Homepage, https://github.com/sergenes/scootcli
8
- Project-URL: Repository, https://github.com/sergenes/scootcli
9
- Project-URL: Issues, https://github.com/sergenes/scootcli/issues
10
- Project-URL: Changelog, https://github.com/sergenes/scootcli/blob/main/CHANGELOG.md
11
- Keywords: coding-agent,cli,terminal,llm,openai,ollama,agent,stdlib
12
- Classifier: Development Status :: 3 - Alpha
13
- Classifier: Environment :: Console
14
- Classifier: Intended Audience :: Developers
15
- Classifier: Operating System :: MacOS
16
- Classifier: Operating System :: POSIX :: Linux
17
- Classifier: Programming Language :: Python :: 3
18
- Classifier: Programming Language :: Python :: 3 :: Only
19
- Classifier: Topic :: Software Development
20
- Classifier: Topic :: Utilities
21
- Requires-Python: >=3.9
22
- Description-Content-Type: text/markdown
23
- License-File: LICENSE
24
- Dynamic: license-file
25
-
26
1
  # scoot
27
2
 
28
3
  [![PyPI](https://img.shields.io/pypi/v/scootcli.svg?label=PyPI)](https://pypi.org/project/scootcli/)
@@ -179,6 +154,7 @@ The most useful settings (see [`.env.example`](./.env.example) for all of them):
179
154
  | `SCOOT_APPROVAL` | `always` · `auto-read` · `auto-edits` · `yolo` | `yolo` |
180
155
  | `SCOOT_MAX_STEPS` | tool-call steps per turn before asking to continue | `50` |
181
156
  | `SCOOT_OLLAMA_BASE_URL` | where Ollama listens | `http://localhost:11434/v1` |
157
+ | `SCOOT_SEARCH_URL` | your SearXNG instance; turns `web_search` on | off |
182
158
  | `HTTPS_PROXY` | proxy for hosted providers; localhost is never proxied | |
183
159
 
184
160
  ## Usage
@@ -214,6 +190,7 @@ scoot --no-panel --no-dock # plain prompt, no status bar (also what yo
214
190
  /route how auto picks a model
215
191
  /sessions list saved sessions /resume resume a saved session ([id])
216
192
  /forget delete session(s) /panel toggle the bottom status bar
193
+ /error this session's last error
217
194
  /verbosity feed detail (full|compact|quiet)
218
195
  /c copy last answer (Ctrl-S) /exit quit (also Ctrl-C)
219
196
  ```
@@ -233,11 +210,17 @@ Without a TTY, scoot falls back to a plain prompt with no bar and no dock.
233
210
  The agent has eight tools: `read_file`, `list_dir`, `search`, `write_file`, `edit_file`, `run_shell`, `open_editor` (hands a file to IntelliJ IDEA's `idea -e` or to VS Code, `SCOOT_EDITOR` picks), and `update_plan` (a progress checklist for multi-step work).
234
211
  Paths are resolved against the workspace root, and `~` works.
235
212
 
213
+ A ninth tool, `web_search`, is off until you point scoot at a [SearXNG](https://docs.searxng.org/) instance you run: set `SCOOT_SEARCH_URL` (for example `http://localhost:8888`) in your environment or in `~/.config/scoot/.env`.
214
+ SearXNG is self-hosted, so there is no API key and no account; it needs `json` added to `search.formats` in its `settings.yml`.
215
+ A search returns up to 10 results (title, URL, snippet) and does not open the pages.
216
+ Every search asks first and shows the exact query, in every approval mode including `yolo`, because the query leaves your machine.
217
+
236
218
  The workspace is where the agent works, not a wall.
237
219
  When a tool needs a file outside it, in `~/.config`, another repo, `/etc`, scoot asks once: allow this path `[a]`, allow that directory for the session `[d]`, allow anywhere for the session `[A]`, skip `[s]`, or quit `[q]`.
238
220
  `--scope anywhere`, `SCOOT_SCOPE=anywhere`, or `/scope anywhere` skip the question; `/scope` shows what has been granted.
239
221
 
240
- When a call needs approval you can approve once `[a]`, trust that tool for the session `[t]`, approve everything this session `[A]`, edit the arguments `[e]`, skip `[s]`, or quit `[q]`.
222
+ When a call needs approval you approve it `[a]` or skip it `[s]`; ESC stops the turn.
223
+ Each answer covers that one call; to stop being asked, change the mode.
241
224
  `/approve <mode>` sets how much runs without asking: `always` prompts for everything, `auto-read` auto-approves reads, `auto-edits` also auto-approves file edits, `yolo` runs everything.
242
225
  Catastrophic shell commands (a denylist: `rm -rf /`, `git push --force`, piping downloads into a shell, and so on) are re-confirmed in every mode.
243
226
 
@@ -248,7 +231,9 @@ A commit or merge that fails keeps the worktree and your files; nothing is remov
248
231
 
249
232
  Responses stream live and stay interruptible.
250
233
  Drag an image into the prompt and a vision-capable model describes it into the turn as text, so even a text-only coding model can act on it; `SCOOT_VISION_MODEL` pins the describer, `--no-images` turns the feature off.
251
- Every turn auto-saves under `~/.local/state/scoot/sessions/` (owner-only, secrets redacted, last 20 kept); `scoot --continue` or `/resume` picks up where you left off.
234
+ Sessions auto-save under `~/.local/state/scoot/sessions/` (owner-only, secrets redacted, last 20 kept), and not only when a turn ends: the prompt is saved before work starts, then each proposed tool batch and each tool result, so a crash or a killed terminal loses nothing that finished.
235
+ `scoot --continue` or `/resume` picks up where you left off.
236
+ When a turn fails, `/error` shows the latest error for the session (class, status, hint, and where it was raised), even after compaction or a restart.
252
237
 
253
238
  ### Automation: hooks and headless mode
254
239
 
@@ -328,8 +313,10 @@ What scoot protects, and what it does not.
328
313
  - **Your API keys.** Read from the environment or from `~/.config/scoot/credentials.json` (directory `0700`, file `0600`), validated before saving, never echoed, and removed from the environment of every hook scoot runs. Key-shaped strings are masked in error messages and in saved sessions (message text, tool arguments, and the text copies inside provider replay data; signed or encrypted replay fields are stored as received). Streamed model output is printed as it arrives and is not filtered.
329
314
  - **A cloned repository cannot reconfigure you.** A project `.env` may choose the model, effort, and how the terminal looks. It may not set provider base URLs or proxies (which would send your key elsewhere), the approval mode, the scope, the root, hooks, or scoot's config and state directories; those come from flags, your environment, or `~/.config/scoot/.env`, and a project value for them is ignored and reported at start. A project's `.scoot/hooks.json` runs only after you review it and run `/hooks trust`; the trust is bound to the file's content, so an edited file asks again.
330
315
  - **File tools are scoped, shell commands are not sandboxed.** `read_file`, `list_dir`, `search`, `write_file`, and `edit_file` stay inside the workspace plus the paths you grant, and never follow a symlink out of it. `run_shell` runs the command as you, with your normal access to files, network, and other programs; approving a command means exactly that. The denylist (`rm -rf`, `git push`, `sudo`, piping a download into a shell, and so on) is an accident guard that forces a confirmation in every mode, including when a project's hook says `allow` (a hook in your own global config can waive it, so an editor or phone bridge you installed still works); it is not a boundary.
331
- - **The default is `yolo`.** Tool calls run without asking, except the denylist and paths outside the workspace. Use `--approval always` or `auto-read` on code you do not trust yet, and `/worktree start` to keep autonomous edits out of your checkout.
316
+ - **Web search is opt-in and always asks.** `web_search` exists only when you set `SCOOT_SEARCH_URL` yourself; a project `.env` cannot set it. Every query is shown and confirmed in every mode, and results are passed to the model as untrusted text.
317
+ - **The default is `yolo`.** Tool calls run without asking, except the denylist, web searches, and paths outside the workspace. Use `--approval always` or `auto-read` on code you do not trust yet, and `/worktree start` to keep autonomous edits out of your checkout.
332
318
  - **Saved sessions** are owner-only, keyed by workspace, and pruned to the last 20; `/forget all` removes them. Session ids are file names, never paths.
319
+ - **The `/error` record** is owner-only and holds metadata only: the error class, status or `errno`, and stack locations. It never holds local variables, payloads, or credentials, and it is deleted with its session.
333
320
  - No third-party dependencies means no third-party code to audit.
334
321
 
335
322
  ## Contributing
@@ -4,9 +4,9 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "scootcli"
7
- dynamic = ["version"]
7
+ # The README is supplied by setup.py, which rewrites its relative links for PyPI (see there).
8
+ dynamic = ["version", "readme"]
8
9
  description = "A tiny coding agent that goes where you point it"
9
- readme = "README.md"
10
10
  license = "MIT"
11
11
  license-files = ["LICENSE"]
12
12
  authors = [{ name = "Sergey Nes" }]
@@ -0,0 +1,47 @@
1
+ """Build-time metadata that ``pyproject.toml`` cannot express: the README as PyPI shows it.
2
+
3
+ The README links to files in the repository with relative paths, which is right on GitHub. PyPI
4
+ renders the same text on pypi.org and resolves those paths there, so every one of them is a 404
5
+ (``pypi.org/project/scootcli/LICENSE``). The long description published to PyPI is therefore the
6
+ README with each relative link rewritten to the file on GitHub at this release's tag, so the page
7
+ for a version keeps pointing at that version's files.
8
+
9
+ Everything else lives in ``pyproject.toml``.
10
+ """
11
+
12
+ from __future__ import annotations
13
+
14
+ import re
15
+ from pathlib import Path
16
+
17
+ ROOT = Path(__file__).resolve().parent
18
+ REPO = "https://github.com/sergenes/scootcli"
19
+
20
+ # A Markdown link or image target that is not already absolute, an in-page anchor, or a mail address.
21
+ _RELATIVE = re.compile(r"(\]\()(?!https?://|#|mailto:)([^)\s]+)(\))")
22
+ _IMAGE = (".png", ".jpg", ".jpeg", ".gif", ".svg", ".webp")
23
+
24
+
25
+ def version() -> str:
26
+ text = (ROOT / "src" / "scootcli" / "__init__.py").read_text(encoding="utf-8")
27
+ return re.search(r'^__version__\s*=\s*"([^"]+)"', text, re.M).group(1)
28
+
29
+
30
+ def pypi_readme() -> str:
31
+ tag = "v" + version()
32
+
33
+ def absolute(match: "re.Match") -> str:
34
+ path = match.group(2)
35
+ while path.startswith("./"):
36
+ path = path[2:]
37
+ # an image must be served as the file itself, not as GitHub's page about the file
38
+ kind = "raw" if path.split("#")[0].lower().endswith(_IMAGE) else "blob"
39
+ return f"{match.group(1)}{REPO}/{kind}/{tag}/{path}{match.group(3)}"
40
+
41
+ return _RELATIVE.sub(absolute, (ROOT / "README.md").read_text(encoding="utf-8"))
42
+
43
+
44
+ if __name__ == "__main__":
45
+ from setuptools import setup
46
+
47
+ setup(long_description=pypi_readme(), long_description_content_type="text/markdown")
@@ -1,4 +1,4 @@
1
1
  """scoot: a tiny coding agent that goes where you point it."""
2
2
 
3
- __version__ = "0.14.2"
3
+ __version__ = "0.16.0"
4
4
 
@@ -32,6 +32,7 @@ class AgentOutcome:
32
32
  error: str = ""
33
33
  steps: int = 0
34
34
  streamed: bool = False # True if the final content was already printed live (streaming)
35
+ detail: Optional[dict] = None # for "error": metadata about the exception (diagnostics.describe)
35
36
 
36
37
 
37
38
  # finish reasons that mean the reply is not the model's whole answer, and what to tell the user.
@@ -54,6 +55,23 @@ def _strip_done(text: str) -> str:
54
55
  return "\n".join(lines).rstrip()
55
56
 
56
57
 
58
+ def _error_outcome(exc: Exception, steps: int) -> "AgentOutcome":
59
+ from .diagnostics import describe
60
+
61
+ return AgentOutcome("error", error=_fmt_error(exc), steps=steps, detail=describe(exc))
62
+
63
+
64
+ def _checkpoint(session) -> None:
65
+ """Save the session as it stands (best-effort). Called at every point where a crash or a killed
66
+ terminal would otherwise lose work: the prompt, a proposed tool batch, each tool result."""
67
+ save = getattr(session, "autosave", None)
68
+ if callable(save):
69
+ try:
70
+ save()
71
+ except Exception:
72
+ pass
73
+
74
+
57
75
  def _fmt_error(exc: Exception) -> str:
58
76
  """Format an error with its actionable hint, if any."""
59
77
  hint = getattr(exc, "hint", "")
@@ -109,6 +127,7 @@ class Agent:
109
127
  cancel_event = cancel_event or threading.Event()
110
128
  if hasattr(session, "start_turn"):
111
129
  session.start_turn() # begin this turn's usage tally (see turn_usage)
130
+ _checkpoint(session) # the prompt, before any work is done on it
112
131
  cfg = getattr(session, "config", None) or self.config
113
132
  session.active_model = self._pick_model(session)
114
133
  self._refresh_workspace(session, cfg)
@@ -134,7 +153,7 @@ class Agent:
134
153
  ui.assistant(f"model unavailable, switching to {session.active_model}.")
135
154
  steps -= 1 # don't count the failed attempt
136
155
  continue
137
- return AgentOutcome("error", error=_fmt_error(exc), steps=steps)
156
+ return _error_outcome(exc, steps)
138
157
  except ContextLengthError as exc:
139
158
  if not compacted and session.messages:
140
159
  compacted = True
@@ -146,15 +165,16 @@ class Agent:
146
165
  continue
147
166
  except ScootError:
148
167
  pass
149
- return AgentOutcome("error", error=_fmt_error(exc), steps=steps)
168
+ return _error_outcome(exc, steps)
150
169
  except ScootError as exc:
151
- return AgentOutcome("error", error=_fmt_error(exc), steps=steps)
170
+ return _error_outcome(exc, steps)
152
171
 
153
172
  try:
154
173
  session.account(result.usage, model=result.model or session.active_model)
155
174
  except TypeError: # older/fake sessions with a one-argument account()
156
175
  session.account(result.usage)
157
176
  session.messages.append(self._assistant_message(result))
177
+ _checkpoint(session) # the reply, and with it any tool batch, before anything runs
158
178
 
159
179
  if result.tool_calls:
160
180
  if (result.content or "").strip() and not streamed:
@@ -390,6 +410,7 @@ class Agent:
390
410
  session.messages.append(
391
411
  {"role": "tool", "tool_call_id": tool_call_id, "content": content}
392
412
  )
413
+ _checkpoint(session)
393
414
 
394
415
  @staticmethod
395
416
  def _tool_payload(result: ToolResult) -> str:
@@ -434,6 +455,7 @@ class Agent:
434
455
  tc_id = tc.get("id", "")
435
456
  if tc_id not in answered:
436
457
  session.messages.append({"role": "tool", "tool_call_id": tc_id, "content": note})
458
+ _checkpoint(session)
437
459
 
438
460
  # ── tool execution ───────────────────────────────────────────────────────────
439
461
  def _run_tools(self, session, tool_calls, ui, cancel_event, cfg=None) -> Optional[str]:
@@ -526,7 +548,9 @@ class Agent:
526
548
  )
527
549
  ui.tool_result(name, ToolResult(ok=False, summary="skipped"))
528
550
  continue
529
- if approval.decision == Decision.APPROVE_TOOL:
551
+ if getattr(tool, "always_confirm", False):
552
+ pass # one call only: a session-wide answer never trusts the tool or enters yolo
553
+ elif approval.decision == Decision.APPROVE_TOOL:
530
554
  trusted.add(name)
531
555
  ui.assistant(f"trusting {name} for the rest of this session.")
532
556
  elif approval.decision == Decision.APPROVE_SESSION:
@@ -1,14 +1,15 @@
1
1
  """Human-in-the-loop approvals (PLAN §9).
2
2
 
3
3
  Default policy is ``always``: every tool call is shown and must be approved. The prompt renders the
4
- tool name + arguments and, for writes/shell, a rich preview (diff or command). Inline single-key
5
- controls:
4
+ tool name + arguments and, for writes/shell, a rich preview (diff or command), then two single-key
5
+ choices:
6
6
 
7
- [a] approve once [t] trust this tool for the session [A] approve all this session (yolo)
8
- [e] edit arguments [s] skip (tell the model no) [q] abort the agent
7
+ [a] approve this call [s] skip it (tell the model no)
9
8
 
10
- ``[t]`` and ``[A]`` fight approval fatigue on read-heavy tasks; the shell denylist still re-confirms
11
- catastrophic commands even after ``[A]``.
9
+ ESC stops the turn. Approving more than one call is a deliberate command, not a key at a prompt:
10
+ ``/yolo`` and ``/approve <mode>`` change the mode for the session. The shell denylist and tools that
11
+ always confirm (web access) still ask in every mode. The wider decisions (``APPROVE_TOOL``,
12
+ ``APPROVE_SESSION``) remain for the headless protocol, whose clients choose from ``options``.
12
13
  """
13
14
 
14
15
  from __future__ import annotations
@@ -19,7 +20,7 @@ from dataclasses import dataclass
19
20
  from enum import Enum
20
21
 
21
22
  from .keys import read_key
22
- from .rendering import color, eprint
23
+ from .rendering import color
23
24
  from .tools.base import Tool, ToolContext
24
25
 
25
26
 
@@ -83,6 +84,8 @@ def needs_prompt(mode: str, tool: Tool, args: dict, trusted=()) -> "str | None":
83
84
  return f"blocked command ({reason})"
84
85
  if getattr(tool, "auto_approve", False):
85
86
  return None # side-effect-free meta tools (e.g. update_plan) never prompt
87
+ if getattr(tool, "always_confirm", False):
88
+ return "web access needs confirmation" # never auto-approved, even in yolo
86
89
  if mode == "yolo":
87
90
  return None
88
91
  if tool.name in (trusted or ()):
@@ -111,27 +114,6 @@ def _render(tool: Tool, args: dict, ctx: ToolContext) -> None:
111
114
  print(" " + strip_controls(line))
112
115
 
113
116
 
114
- def _edit_args(args: dict) -> dict:
115
- """Let the user type replacement JSON for the tool arguments."""
116
- print(color(" current args: ", "gray") + json.dumps(args, ensure_ascii=False))
117
- print(color(" enter new JSON (blank to keep): ", "gray"), end="", flush=True)
118
- try:
119
- raw = input()
120
- except (EOFError, KeyboardInterrupt):
121
- return args
122
- raw = raw.strip()
123
- if not raw:
124
- return args
125
- try:
126
- new = json.loads(raw)
127
- if isinstance(new, dict):
128
- return new
129
- eprint(color(" (ignored: not a JSON object)", "yellow"))
130
- except json.JSONDecodeError as exc:
131
- eprint(color(f" (ignored: invalid JSON: {exc})", "yellow"))
132
- return args
133
-
134
-
135
117
  SCOPE_CHOICES = ("once", "dir", "all", "deny", "abort")
136
118
 
137
119
 
@@ -175,41 +157,24 @@ def request_scope(tool: Tool, path, ctx: ToolContext) -> str:
175
157
 
176
158
 
177
159
  def request_approval(tool: Tool, args: dict, ctx: ToolContext) -> Approval:
178
- """Show the pending tool call and read the user's decision (with optional arg editing)."""
160
+ """Show the pending tool call and read the user's decision: approve this call, or skip it.
161
+
162
+ A yes/no on exactly what is shown is the whole decision, for every tool. ESC stops the turn, as it
163
+ does everywhere (and so does a closed or blank piped input); any other key shows the prompt again.
164
+ """
165
+ menu = " " + color("approve", "green") + " [a] " + color("skip", "yellow") + " [s] › "
179
166
  while True:
180
167
  _render(tool, args, ctx)
181
- print(
182
- " "
183
- + color("approve", "green")
184
- + " [a] "
185
- + color(f"trust {tool.name}", "green")
186
- + " [t] "
187
- + color("all-session", "green")
188
- + " [A] "
189
- + color("edit", "cyan")
190
- + " [e] "
191
- + color("skip", "yellow")
192
- + " [s] "
193
- + color("quit", "red")
194
- + " [q] › ",
195
- end="",
196
- flush=True,
197
- )
168
+ print(menu, end="", flush=True)
198
169
  key = _menu_key()
199
170
  print(key) # echo the choice for a clean transcript
200
171
 
201
172
  if key in ("a", "y", "\r", "\n", ""):
202
173
  return Approval(Decision.APPROVE, args)
203
- if key == "t":
204
- return Approval(Decision.APPROVE_TOOL, args)
205
- if key == "A":
206
- return Approval(Decision.APPROVE_SESSION, args)
207
- if key == "e":
208
- args = _edit_args(args)
209
- continue
210
- if key == "s":
174
+ if key in ("s", "n"):
211
175
  return Approval(Decision.SKIP, args)
212
- if key in ("q", "\x1b"):
176
+ if key in ("\x1b", "q"):
177
+ # "q" is not advertised, but it is what read_key answers for EOF or a blank line on piped
178
+ # input: a closed stdin must end the turn, never loop on the prompt and never approve.
213
179
  return Approval(Decision.ABORT, args)
214
180
  # Unknown key: re-prompt.
215
-
@@ -203,8 +203,15 @@ def _run_once(config: Config, pool: ProviderPool, prompt: str, as_json: bool, re
203
203
  # JSON output must be clean, so never stream tokens to stdout in that mode.
204
204
  agent_config = config.override(stream=False) if as_json else config
205
205
  ui = OneShotJsonUI() if as_json else ReplUI()
206
- outcome = Agent(agent_config, pool).run_turn(session, ui, threading.Event())
207
- session.autosave() # persist so `scoot -c` can continue this conversation
206
+ try:
207
+ outcome = Agent(agent_config, pool).run_turn(session, ui, threading.Event())
208
+ except BaseException as exc:
209
+ session.record_error(exc)
210
+ raise
211
+ finally:
212
+ session.autosave() # persist so `scoot -c` can continue this conversation, however the turn ended
213
+ if outcome.status == "error":
214
+ session.record_error(message=outcome.error, detail=outcome.detail)
208
215
  session_event(session, "SessionEnd", reason=outcome.status)
209
216
 
210
217
  if as_json:
@@ -54,6 +54,7 @@ def load_builtins() -> None:
54
54
  from . import route as _route # noqa: F401
55
55
  from . import hooks as _hooks # noqa: F401
56
56
  from . import scope as _scope # noqa: F401
57
+ from . import error as _error # noqa: F401
57
58
 
58
59
  _loaded = True
59
60
 
@@ -0,0 +1,45 @@
1
+ """/error: show the latest error of this session (kept across compaction and restarts)."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import time
6
+
7
+ from ..rendering import color, strip_controls
8
+ from . import register
9
+ from .base import SlashCommand
10
+
11
+
12
+ def _run(session, args: str):
13
+ from .. import diagnostics
14
+
15
+ record = diagnostics.load(session.id) or getattr(session, "error_record", None)
16
+ if not record:
17
+ print(color("no error recorded for this session.", "gray"))
18
+ return
19
+ when = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(record.get("time") or 0))
20
+ facts = [str(record.get("kind") or "Error")]
21
+ if record.get("status"):
22
+ facts.append(f"HTTP {record['status']}")
23
+ if record.get("code"):
24
+ facts.append(f"code {record['code']}")
25
+ if record.get("errno") is not None:
26
+ facts.append(f"errno {record['errno']}")
27
+ print(color(strip_controls(" · ".join(facts)), "red") + color(f" {when}", "gray"))
28
+ if record.get("message"):
29
+ print(" " + strip_controls(str(record["message"])))
30
+ if record.get("hint"):
31
+ print(color(" hint: " + strip_controls(str(record["hint"])), "yellow"))
32
+ meta = [f"model {record['model']}" if record.get("model") else "",
33
+ f"scoot {record['scoot']}" if record.get("scoot") else "",
34
+ ("caused by " + " ← ".join(str(c) for c in record["causes"])) if record.get("causes") else ""]
35
+ meta = [m for m in meta if m]
36
+ if meta:
37
+ print(color(" " + strip_controls(" · ".join(meta)), "gray"))
38
+ frames = [f for f in (record.get("frames") or []) if isinstance(f, dict)]
39
+ if frames:
40
+ print(color(" where (innermost last):", "gray"))
41
+ for f in frames:
42
+ print(color(strip_controls(f" {f.get('file', '?')}:{f.get('line', '?')} in {f.get('func', '?')}"), "gray"))
43
+
44
+
45
+ register(SlashCommand("error", "show this session's latest error", _run))
@@ -58,11 +58,11 @@ def _run(session, args: str):
58
58
  print(f" {color(label + ':', 'gray'):<28} {value}")
59
59
  by_model = getattr(session, "usage_by_model", None) or {}
60
60
  if by_model:
61
- from ..pricing import UPDATED, cost, fmt
61
+ from ..pricing import UPDATED, fmt, usage_cost
62
62
 
63
63
  print(f" {color('tokens and cost by model:', 'gray')}")
64
64
  for name, u in sorted(by_model.items(), key=lambda kv: -(kv[1]['prompt'] + kv[1]['completion'])):
65
- c = cost(name, u["prompt"], u["completion"], u.get("cached", 0))
65
+ c = usage_cost(name, u)
66
66
  cached = f" cached={u['cached']}" if u.get("cached") else ""
67
67
  print(f" {color(name, 'cyan'):<40} prompt={u['prompt']}{cached} completion={u['completion']} calls={u['calls']} {fmt(c)}")
68
68
  total = session.session_cost() if hasattr(session, "session_cost") else None
@@ -120,6 +120,7 @@ def allowed_env_key(key: str) -> bool:
120
120
  # relocate scoot's own files. Anything a cloned repository must not be able to decide for you.
121
121
  _PROJECT_BLOCKED_KEYS = frozenset({
122
122
  "SCOOT_APPROVAL", "SCOOT_SCOPE", "SCOOT_ROOT", "SCOOT_HOOKS", "SCOOT_CONFIG_DIR", "SCOOT_STATE_DIR",
123
+ "SCOOT_SEARCH_URL", # a repo must not redirect web-search queries to a host of its choosing
123
124
  *_PROXY_KEYS,
124
125
  })
125
126