Docs for SCORPIOX CODE @ ce3b5cd

Plugins in SCORPIOX BOT

SCORPIOX BOT is a small, sharp tool until the day you want it to show you something it does not ship with — the GPU your job is saturating, the ports open on the box you are about to expose, the SQLite file your agent has been writing to. Plugins are how that happens without waiting for a release: a plugin is one native executable named plugin_<name> that lives on your node, and the bot runs it on demand and puts its page in front of you. A public catalogue, BotMarket, lists the plugins people have published, with their source and their checksums, and installs one onto your node in a click.

Docs for SCORPIOX CODE @ ce3b5cd.

The whole idea in one line: a plugin is a single native binary on your node — metadata, a JSON API and a web UI in the same file — and BotMarket is the open catalogue that installs it, with the source and the SHA-256 published next to every artifact.


What a plugin actually is

Be clear about this before installing anything.

That is the bargain: a plugin is as powerful as a shell command, which is why the market publishes the source and a digest for every artifact, and why the install dialog asks you to read before you click.


Where plugins live

DirectoryWhen to use it
/workspace/.scorpiox/pluginsPreferred on BotCloud containers. /workspace survives a container restart, so an installed plugin does too.
~/.scorpiox/pluginsA workstation or a self-hosted node. On Windows this is %LOCALAPPDATA%\scorpiox\plugins.
BOT_PLUGIN_DIRSet this environment variable to point the bot at a different directory.

The bot creates these directories on startup, so they are usually already there. Copy a binary in, make it executable on Unix (chmod +x), and it shows up in the plugin list on the next scan. Remove the file and it is gone.

Keep helper binaries — anything a plugin shells out to — named without the plugin_ prefix. The prefix is the only thing that marks a file as a plugin, and a helper that carries it will be listed as a UI plugin you can open.


The three-mode contract

Every plugin in BotMarket is the same shape. One C file, no dependencies, one binary, three modes. This is the whole contract.

ModeTriggerResponse
Metadata--meta argument, or SX_PLUGIN_META=1 in the environment{"name":"...","desc":"..."} as JSON
JSON API?action=... or ?format=json on the query stringapplication/json
Web UIa plain GETtext/html — the tool's page

Two rules that are easy to forget and expensive to debug:

A minimal plugin, complete:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char **argv)
{
    const char *qs = getenv("QUERY_STRING");
    if ((argc > 1 && strcmp(argv[1], "--meta") == 0) || getenv("SX_PLUGIN_META")) {
        puts("{\"name\":\"Ports\",\"desc\":\"Listening TCP\"}");
        return 0;
    }
    if (qs && (strstr(qs, "action=") || strstr(qs, "format=json"))) {
        printf("Content-Type: application/json; charset=utf-8\r\n\r\n"
               "{\"ok\":true,\"items\":[]}\n");
        return 0;
    }
    printf("Content-Type: text/html; charset=utf-8\r\n\r\n"
           "<!DOCTYPE html><html><body><h1>Ports</h1></body></html>\n");
    return 0;
}
cc -O2 -Wall -Wextra -o ~/.scorpiox/plugins/plugin_ports plugin_ports.c
chmod +x ~/.scorpiox/plugins/plugin_ports

On a node with a password, read it from the BOT_PASSWORD environment variable and accept it either as the X-Bot-Password header or as the pwd parameter of the page URL — the chat frame appends it to the URL rather than setting a header, and a plugin that only checks one of the two will refuse the frame that renders it.

Metadata style the market enforces

The catalogue is a grid of cards, and the card is only as useful as its two fields:

The longer title and summary are free text and belong in the detail view, not on the card.


Browsing and installing from BotMarket

The public catalogue is botmarket.scorpiox.net. Inside the product, the same catalogue is its own settings page: Settings → Plugins at /settings?sec=plugins. It is no longer buried inside Settings → Menus — Plugins now stands on its own, and a node selector appears when more than one node is attached so you can install onto a specific one.

Settings → Plugins has three tabs:

What the install dialog tells you

Nothing installs the moment you click Install. The untrusted-native-binary dialog opens first, and it states the four things you should know:

  1. What code will run — the plugin and its published capabilities.
  2. Which node — the machine that will execute it, not the web front end you are looking at.
  3. Which commit — the exact pinned source revision, with a link to the public repository.
  4. Which SHA-256 — the digest of the artifact, so you can verify the bytes yourself.

Then it offers three routes, and all three are legitimate:

Deep link straight to a plugin's card:

https://bot.scorpiox.net/settings?sec=plugins&tab=market&install=<slug>

Add &node=<nid> to target a specific node. Links already published in the older Settings → Menus form — /settings?sec=menus&tab=market&install=<slug>#pluginsSection — are redirected (HTTP 302) to this new page, so anything already out there keeps working.

What the installer verifies

The node does not trust the download blindly. In order:

  1. The artifact URL must be on the published distribution host — anything else is refused unless the operator has explicitly allowed untrusted origins.
  2. The bytes are hashed and compared against the stated SHA-256. A mismatch aborts and the temporary file is deleted.
  3. The file's first bytes must be a real executable for this platform. This is what stops an HTML error page that was saved as a binary during an outage from being installed and run.
  4. The binary is executed once with metadata mode requested, and its answer must be valid JSON with a name and a description. A crash or a non-JSON answer aborts the install.
  5. Only then is the file moved into place and a small sidecar manifest written next to it, recording the slug, version, install method, target, digest and source commit.

Remove reverses it, and it will only ever delete a plugin from your own plugin directory. Operator-installed plugins are refused.


The published artifacts

Every plugin ships six binaries under dist.scorpiox.net/bot-plugins/<slug>/<version>/, each with a digest in the manifest:

TargetWhat it is
linux-x86_64glibc x86_64 ELF
linux-x86_64-muslstatic musl x86_64 ELF — the preferred Linux target
linux-arm64-muslstatic musl aarch64 ELF
macos-arm64Apple Silicon Mach-O
macos-x86_64Intel macOS Mach-O
windows-x86_64native Win64 static PE

A Linux node asks the installer which target it should use and gets the static musl build as its first choice, because one static binary runs unchanged on Alpine, Debian, Ubuntu, Arch and Omarchy. It falls back to the glibc build only when there is a reason to.

The directory also carries SHA256SUMS and a source.tar.gz — an archive of the exact pinned commit. Everything needed to verify or rebuild a plugin is in one place, and it works offline once downloaded.


The source-first track

Prebuilt binaries are the fast path. The other path is the one that makes this market worth having: every plugin is public C99 source at a pinned commit.

https://plugingit.scorpiox.net/scorpiox-bot-plugin-<slug>.git

Anonymous read is allowed — git clone, browse the history, download an archive, and read every line before a binary ever touches your machine. Each card in the catalogue links its repository and its commit.

Because the source is one dependency-free C file, an agent can do in seconds what used to be a packaging project. Paste this into SCORPIOX BOT chat:

Clone https://plugingit.scorpiox.net/scorpiox-bot-plugin-<slug>.git, audit src/plugin_<id>.c for anything unsafe, customise it for my setup, compile it natively on this machine, verify --meta, and install it to ~/.scorpiox/plugins/.

That is the whole workflow: clone, audit, edit, cc -O2, copy. No SDK, no version pin, no rebuild pipeline. If you would rather read the procedure yourself first:


Writing your own

  1. Copy the starter. The market publishes a complete single-binary plugin, a Makefile with native, musl, Win64 and macOS targets, and a Windows build script, at botmarket.scorpiox.net/docs/sdk?file=plugin_starter.c. Change three defines, run make.
  2. Name it plugin_<name>. Lowercase, letters, digits, hyphens and underscores, up to 56 characters after the prefix.
  3. Answer --meta first. The card in the marketplace is only as good as those two fields.
  4. Build the page for the frame. Assume 390 pixels wide on a phone and a floating window inside chat. Honour ?embed=1, and never emit Content-Length.
  5. Ship it where it can be found. In the container, /workspace/.scorpiox/plugins. On a laptop, ~/.scorpiox/plugins.

Then open Settings → Plugins, click Rescan, and switch on the placements you want. No restart.

If you want it in the public catalogue, the same rules apply that the market enforces on everything else: clean source, no secrets, no internal addresses, a pinned commit, a SHA-256 for every artifact, and honest metadata.


Safety, in one place


Quick recipe: install one and open it

  1. Open Settings → Plugins → Marketplace.
  2. Find the plugin — for example sysmon — and read its summary, target and source link.
  3. Click Install. In the dialog, confirm the node, the commit and the SHA-256, then choose Install Prebuilt.
  4. Back on the Installed tab, click Rescan, then switch on the placements you want — Hub, Session Card, Chat.
  5. Open Chat and pick the plugin from the more menu. The tool renders in a floating window next to your session.

To try the source route instead, choose Agent Prompt in step 3 and paste it into chat.