`plugin_files` — a read-only local file browser for a SCORPIOX BOT node.
List directories inside an allowlist of roots, preview text and markdown with
line numbers, view images, and download files. It opens every file read-only
and contains no create, write, rename, chmod or delete code path at all.
One clean-room C99 binary, zero dependencies, no CDN, no network requests.
files / File browser category: devtools MIT
| Route | Behaviour |
|---|---|
--meta (or SX_PLUGIN_META=1) | {"name":"files","desc":"File browser"} — unauthenticated so discovery works |
?action=roots | the allowlisted roots with a display name each |
?action=ls&path=<abs>[&hidden=1] | up to 5000 entries, directories first then names, each with type / size / mtime / mode; reports count, truncated, parent, root |
?action=read&path=<abs> | text preview up to 1 MiB, binary:true when a NUL byte appears in the first 8 KiB |
?action=raw&path=<abs>[&download=1] | streams the file with a guessed Content-Type, capped at 64 MiB |
GET (no action) | the browser page, ?embed=1 aware |
All routes except --meta sit behind require_node_auth(): X-Bot-Password,
Authorization: Bearer <pwd>, or ?pwd=. With BOT_PASSWORD unset the check
is a no-op, which is what local development wants.
Consumption of a plugin is native code on your machine, so the interesting
question is not "does it say read-only" but "can it do anything else".
fopen in write mode, no remove, rmdir, mkdir, rename, chmod, popen or system. tests/run.sh greps for all of them.
realpath() on POSIX and GetFullPathNameA + GetFinalPathNameByHandleA on Windows.
symlink that points out of a root is refused with 403 — the check happens
on the real target, not on the name that was typed.
.. in a browse path is rejected outright; %2e%2e decodes before thecheck, so the encoding does not help.
/proc, /sys and /dev are refused even when they sit under an allowedroot.
GET of a .html file on disk is served as text/plain. This route shares an origin with the node API, so rendering a local page as text/html would
hand every HTML file on the node the ability to call the plugin API with the
user's password. Images keep their real type because <img> only decodes
them.
Content-Length; scorpiox-server owns framing.| Platform | Defaults |
|---|---|
| Linux | /workspace, /codebases, $HOME |
| macOS | /workspace, /codebases, $HOME |
| Windows | %USERPROFILE%, D:\codebases |
$FILES_ALLOWED_ROOT adds one more, or several separated by : on POSIX and
; on Windows. Directories that do not exist are skipped silently, so the
list is honest on every machine.
make # native -> ./plugin_files
make musl # static musl x86_64 (Alpine, Debian, Arch, Omarchy)
make arm64 # static aarch64 (Raspberry Pi 5, ARM64 servers)
make win64 # static PE via x86_64-w64-mingw32-gcc
make macos # Apple clang (run on macOS)
make test # build + tests/run.sh (offline, 150 checks)
make e2e # build + tests/e2e.py (Playwright, 6 viewport/theme pairs)
make clean
On Windows, powershell -ExecutionPolicy Bypass -File build.ps1 produces
plugin_files.exe.
The page lives in src/ui.html and is compiled into src/ui_html.h by
tools/gen_ui.py, which splices the bot theme macros in at two control-byte
placeholders. make ui regenerates it; python3 tools/gen_ui.py --check
fails when the header is stale.
# prebuilt, from the market
curl -s -H "X-Bot-Password: $BOT_PASSWORD" \
'http://127.0.0.1:8150/plugin_manage?action=install&slug=files&mode=prebuilt'
# or from source, agent-style
git clone https://plugingit.scorpiox.net/scorpiox-bot-plugin-files.git
cd scorpiox-bot-plugin-files && make
mkdir -p ~/.scorpiox/plugins && cp plugin_files ~/.scorpiox/plugins/
Zero server restart: scorpiox-server resolves plugin_* executables live on
every request. The plugin then appears in GET /plugins, in the Hub ⋯ menu,
on session cards, and in the Chat floating window.
src/plugin_files.c the whole plugin (~1.0k lines)
src/bot_theme_plugin.h bot theme tokens, prepaint + handoff (trimmed copy)
src/ui.html the page, readable and diffable
src/ui_html.h generated from ui.html - do not edit
tools/gen_ui.py ui.html -> ui_html.h
tests/run.sh 150 offline assertions, no network
tests/e2e.py Playwright at 1440/1024/390, dark + light
plugin.json catalog sidecar (slug, id, title, capabilities, trust)
MIT. Copyright (c) 2026 SCORPIOX INC.