# scorpiox-bot-plugin-hello **The canonical clean-room starter plugin for [SCORPIOX BOT](https://bot.scorpiox.net).** One C file. Zero dependencies. Three modes. Fork it, change a string, rebuild in one command, and you have your own plugin running on your node — no server restart, no SDK, no runtime to install. ```sh git clone https://plugingit.scorpiox.net/scorpiox-bot-plugin-hello.git cd scorpiox-bot-plugin-hello make cp plugin_hello ~/.scorpiox/plugins/ ``` Open SCORPIOX BOT → the **hello** plugin appears in Settings → Menus → Plugins, the Sessions Hub `⋯` menu, and the Chat floating window. --- ## What it does A SCORPIOX BOT dynamic plugin is a single native executable named `plugin_` that lives in the node's plugin directory (`~/.scorpiox/plugins/`, `/workspace/.scorpiox/plugins/`, or `%LOCALAPPDATA%\scorpiox\plugins\` on Windows). The node discovers it live — drop the file in, and it is available. Nothing is recompiled, no daemon is restarted. `plugin_hello` serves all three plugin modes from one binary: | Mode | Trigger | Response | |---|---|---| | **1. Metadata** | `plugin_hello --meta` or `SX_PLUGIN_META=1` | `{"name":"hello","desc":"Starter demo"}` | | **2. JSON API** | `?action=info`, `?action=echo&msg=…`, `?format=json` | JSON node facts + echo + hints | | **3. HTML UI** | plain `GET` (honours `?embed=1`) | Responsive dark/light starter bench | ### Mode 1 — Metadata Used by `GET /plugins` for discovery. Keep `name` to **one or two words** and `desc` to **about a dozen characters** — they are rendered inside compact chips in the Hub, the session card menu, and the chat window. ```console $ ./plugin_hello --meta {"name":"hello","desc":"Starter demo"} ``` ### Mode 2 — JSON API Always answers as a CGI response: `Content-Type: application/json; charset=utf-8`, `Cache-Control: no-store`, and — deliberately — **no `Content-Length`**. The server owns framing; emitting it yourself breaks proxies that stream or re-chunk the body. ```console $ QUERY_STRING='action=info' ./plugin_hello Content-Type: application/json; charset=utf-8 Cache-Control: no-store X-Content-Type-Options: nosniff {"ok":true,"plugin":"plugin_hello","slug":"hello","version":"1.1.1", "node":{"hostname":"agentcore-latest","os":"linux","arch":"x86_64", "libc":"glibc","pid":591,"utc":"2026-11-11T01:10:39Z"}, "query_string":"action=info", "hints":{...}} ``` | Action | Purpose | |---|---| | `action=info` (or `?format=json`) | Node hostname, OS, arch, libc, PID, UTC timestamp, raw `QUERY_STRING`, and customization hints | | `action=echo&msg=` | Percent-decoded echo with JSON-safe escaping and a byte length | | anything else | `{"ok":false,"error":"unknown action","supported":["info","echo"]}` | The echo action is the reference implementation of input handling: it percent-decodes first (`%20`, `+`), then escapes on the way out (`"` → `\"`, control bytes → `\u00XX`). That ordering is what keeps a hostile `msg` from breaking the JSON. ### Mode 3 — HTML UI A dark/light responsive bench (theme persisted in `localStorage.bot_theme`) that shows the live node facts, an echo tester, and the exact commands an agent needs to customize the plugin. With `?embed=1` the "back to bot" chrome is stripped so it fits the chat floating window and modal iframes. The JS inside is the part worth copying. A plugin page is reached by **two different routes** and dispatching them wrong is the single most common plugin bug: ```js var HUB = q.get('plugin'); // set when served through bot.scorpiox.net/plugins var u = HUB ? '/plugins?plugin=' + HUB + '&action=' + action // hub proxy : '/plugin_hello?action=' + action; // direct on the node ``` Calling `/plugins?plugin=` *on the node itself* returns the plugin **list** — that is the discovery endpoint, not a dispatch route. The page also forwards `node`, `id`, and `pwd` (hub → node auth) on every request and sends `X-Bot-Password`. --- ## Build ```sh make # native (cc / gcc / clang) -> ./plugin_hello make musl # static musl x86_64 (universal) -> ./plugin_hello make arm64 # static aarch64 (ARM64 servers) -> ./plugin_hello.arm64 make win64 # MinGW-w64 static PE x86_64 -> ./plugin_hello.exe make macos # Apple clang (run on macOS) -> ./plugin_hello make test # build + full test suite make clean ``` Every target compiles clean under `-Wall -Wextra -pedantic`. The source guards the POSIX bits with `_POSIX_C_SOURCE 200809L` and the Windows bits with `_WIN32`, so the same file builds for glibc, musl, macOS and MinGW without `#ifdef` soup in the actual logic. `make test` runs **50+ assertions** in `tests/run.sh`: all three modes, header hygiene (no `Content-Length`), JSON validity, percent-decoding and escaping, embed handling, theme wiring, the MinGW `.exe` `MZ` header, a warning-free pedantic build, and a **full git-history audit** for LAN IPs, GitHub PATs, HuggingFace tokens, credential assignments, embedded `user:token@` remotes, private emails and internal fleet paths. On Windows: `powershell -ExecutionPolicy Bypass -File build.ps1` --- ## Install ```sh # Linux / macOS mkdir -p ~/.scorpiox/plugins cp plugin_hello ~/.scorpiox/plugins/ chmod +x ~/.scorpiox/plugins/plugin_hello ``` ```powershell # Windows $d = "$env:LOCALAPPDATA\scorpiox\plugins" New-Item -ItemType Directory -Force -Path $d | Out-Null Copy-Item plugin_hello.exe "$d\" ``` Verify: ```sh ~/.scorpiox/plugins/plugin_hello --meta curl -s -H "X-Bot-Password: " http://127.0.0.1:8150/plugins | grep hello ``` --- ## Pre-built binaries If you would rather not compile, every release is published with checksums at **https://dist.scorpiox.net/bot-plugins/hello/1.1.1/** | Target | File | |---|---| | Linux x86_64 (glibc) | `linux-x86_64/plugin_hello` | | Linux x86_64 (static musl) | `linux-x86_64-musl/plugin_hello` | | Linux arm64 (static musl) | `linux-arm64-musl/plugin_hello` | | macOS (Apple Silicon) | `macos-arm64/plugin_hello` | | macOS (Intel) | `macos-x86_64/plugin_hello` | | Windows x64 | `windows-x86_64/plugin_hello.exe` | `manifest.json` carries the per-target SHA-256 and sizes; `SHA256SUMS` is the flat list; `source.tar.gz` is a `git archive` of the exact published commit. Always verify a downloaded binary against the checksum before installing it — a plugin runs with your local user's full permissions. --- ## Customize it (the 5-minute fork) 1. Rename the binary: change `PLUGIN_SLUG` / `PLUGIN_ID` and your `Makefile`'s `BIN`. 2. Rewrite `mode_meta()` — keep the title short and the description tiny. 3. Replace `emit_info_body()` with whatever your node actually knows (a `/proc` read, a `popen()` of a CLI, an HTTP probe). 4. Add an action branch in `mode_json()`. 5. Restyle the HTML — it is plain CSS custom properties, no framework. Then rebuild, copy into the plugin directory, and reload the bot. That is the whole loop. **Security notes.** This plugin reads nothing but its own process and environment. It makes **zero outbound network requests**. If your fork shells out, escape your arguments, never interpolate raw query values into a command line, and disclose the capability in your README — users are being asked to run native code from you. --- ## Layout ``` scorpiox-bot-plugin-hello/ ├── src/plugin_hello.c # the entire plugin ├── Makefile # native / musl / win64 / macos / test ├── build.ps1 # Windows MinGW build ├── release-dist.sh # multi-target build + dist.scorpiox.net upload ├── tests/run.sh # 50+ checks incl. git-history secret audit ├── LICENSE # MIT └── README.md ``` ## License MIT — see [LICENSE](LICENSE). Fork it, ship it, rename it, sell it. Just keep the notice. Published as part of the [SCORPIOX BOT plugin marketplace](https://plugingit.scorpiox.net).