@nullplatform/plugin-dev-ui
v0.1.1
Published
<h2 align="center"> <a href="https://nullplatform.com" target="blank_"> <img height="100" alt="Nullplatform" src="https://nullplatform.com/favicon/android-chrome-192x192.png" /> </a> <br> <br> @nullplatform/plugin-dev-ui <b
Readme
Local development UI for nullplatform plugins. Spawns a plugin process via gRPC, starts a JSON editor from the document the plugin offers for each of its runs, streams each run's events in real time and shows its answer.
Works with a plugin whose entry point serves the agent's gRPC ExecutorPlugin protocol, as await main(plugin) does when the agent starts it (a scope, a service, a definePlugin); a collector serves itself (its schedule and watch) and speaks no gRPC. It starts the entry point --entry names, else the plugin's local entry, src/local.ts, when it has one (its in-memory ports reach no real platform), else its src/main.ts, else its src/index.ts, with the ports that file passes. An entry that is not a local.ts runs the plugin with its real ports (the platform API, the tracing API, catalog-ingest-api, as its settings describe them), and the dev UI says so on stderr. It reads the runs that describe prints, which @nullplatform/plugin 0.1.11 and the published dev UI 0.0.5 predate: until the next release, run it from this repository, its page built first (cd dev-ui && bun run build:ui && bun run dev --plugin <path>).
Install
bun add -d @nullplatform/plugin-dev-uiUsage
# From a plugin directory
bunx @nullplatform/plugin-dev-ui --plugin .
# Or via mise (scaffolded plugins include this task)
mise run devOpen http://localhost:3847 in your browser.
Commands
plugin-dev [--plugin <path>] [--entry <file>] Full dev mode (default)
plugin-dev preview [--plugin <path>] [--entry <file>] Editor preview only (no plugin process)Options
| Flag | Default | Description |
|---|---|---|
| --plugin <path> | cwd | Plugin directory |
| --entry <file> | src/local.ts, else src/main.ts, else src/index.ts | Entry point, from the plugin directory |
| --port <number> | 3847 | Server port |
How it works
- Runs
--describeon the plugin to get its manifest: the runs it offers tooling (runs: each action, each link's, each event,execute), each with the document the agent would hand over for it, built by the plugin's own kinds - Starts the editor from the chosen run's document; what you leave out is filled from it when you execute
- Spawns the plugin as a gRPC subprocess via
@nullplatform/plugin/testing, which asks it what it declares (Capabilities) - Sends an
ExecuteRPC when you trigger a run from the UI, with the command type the plugin declares first - Streams the run's events to the page as Server-Sent Events (
/api/events): itsExecuteEvents (started, eachoutput's text, theresult), a cancel (cancelled: the plugin is stopped and started again, the run has no answer), and an execute that could not be called (error) - Shows the run in the Execution panel: its status (running, completed, failed or cancelled), its duration from
startedto its end, and on a success the answer'sdata(formatted JSON, or its raw text when it is a string), on a failure itserrorCodeanderror. A run the server refuses (in preview, a run the plugin does not offer, a body that is not a JSON object) fails at once,REFUSED, with the server'serror. The Output panel shows the plugin's stdout and stderr lines
Development
bun run typecheck && bun run lint && bun run test # what CI runs