Liking cljdoc? Tell your friends :D
Clojure only.

com.blockether.vis.internal.foundation.shim-ls

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 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. The rows themselves cross as a JSON string rather than as the boundary's own ForeignDicts: a listing is data the caller SERIALIZES, and json.dumps is the one dict operation a foreign map refuses. Measured over a 100 KB listing of this repo, the JSON hop costs 3.4 ms against 11.8 ms for __vis_pyify__ over the proxies — the string is the CHEAPEST real dict.

: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 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`. The rows themselves cross as a JSON string rather than as the
boundary's own `ForeignDict`s: a listing is data the caller SERIALIZES, and
`json.dumps` is the one dict operation a foreign map refuses. Measured over a
100 KB listing of this repo, the JSON hop costs 3.4 ms against 11.8 ms for
`__vis_pyify__` over the proxies — the string is the CHEAPEST real dict.

`: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`.
raw docstring

vis-extensionclj

source

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close