Built-in sandbox SHIM: ls — the DIRECTORY listing, as a Python call instead
of a native tool.
Mapping a tree is the cheapest question there is and the one a model asks
most, so it must not cost a wire round trip: ls(dir) runs inside the
python_execution block the model is already in, its rows land in a Python
variable, and the model prints only what it needed. As a native tool the same
listing spent a whole tool result — plus a schema and a description in every
request — to hand back a tree that was usually filtered one line later.
The walk itself stays on the HOST: editing/list-directories is fff's
ignore-aware listing (.gitignore, .ignore, cache directories, the vis.yml
overlay), an order of magnitude faster than a guest os.scandir recursion that
would honour none of those rules. The bridge is one callable taking a JSON
request and answering the [ok result kind] envelope every shim uses, because
errors must cross the boundary as DATA — GraalPy does not route a host
exception through Python except.
:fs/access is asked by list-directories itself, so an extension that hides
a tree hides it from the listing exactly as it hides it from cat.
Built-in sandbox SHIM: `ls` — the DIRECTORY listing, as a Python call instead of a native tool. Mapping a tree is the cheapest question there is and the one a model asks most, so it must not cost a wire round trip: `ls(dir)` runs inside the `python_execution` block the model is already in, its rows land in a Python variable, and the model prints only what it needed. As a native tool the same listing spent a whole tool result — plus a schema and a description in every request — to hand back a tree that was usually filtered one line later. The walk itself stays on the HOST: `editing/list-directories` is fff's ignore-aware listing (`.gitignore`, `.ignore`, cache directories, the `vis.yml` overlay), an order of magnitude faster than a guest `os.scandir` recursion that would honour none of those rules. The bridge is one callable taking a JSON request and answering the `[ok result kind]` envelope every shim uses, because errors must cross the boundary as DATA — GraalPy does not route a host exception through Python `except`. `:fs/access` is asked by `list-directories` itself, so an extension that hides a tree hides it from the listing exactly as it hides it from `cat`.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |