diff --git a/README.md b/README.md index c096b63..510df44 100644 --- a/README.md +++ b/README.md @@ -1,96 +1,133 @@ -# @escalated-dev/plugin-runtime +
-[](https://github.com/escalated-dev/escalated-plugin-runtime/actions/workflows/run-tests.yml) -[](https://nodejs.org/) -[](https://www.typescriptlang.org/) -[](https://opensource.org/licenses/MIT) -[](https://hits.sh/github.com/escalated-dev/escalated-plugin-runtime/) +
+ The Node.js process that runs Escalated plugins.
+ Your backend's bridge starts it and talks to it over JSON-RPC 2.0 on stdio.
+
+ Website · + Docs · + Cloud · + Releases +
-## Installation +
+ Runs every installed plugin in one process+ It finds plugins innode_modules/@escalated-dev/plugin-*, routes hooks to them, and proxies their ctx.* calls back to your backend.
+ |
+
+ Never takes the helpdesk down with it+ Your backend's bridge starts it on the first hook and restarts it with backoff after a crash. While it is down, filters return values unchanged. + |
+
| -## Architecture +**Loading** +- Discovers `@escalated-dev/plugin-*` packages +- Started by your backend's bridge +- Spawned lazily on first hook -The runtime is a long-lived Node.js process that: + | +-1. Discovers and loads installed plugins from `node_modules/@escalated-dev/plugin-*` -2. Responds to JSON-RPC messages from the host framework -3. Routes hooks (actions, filters) to registered plugin handlers -4. Proxies `ctx.*` calls back to the host for data operations +**Dispatch** +- Actions, filters, endpoints, webhooks +- Cron jobs and widget badges +- Activate and deactivate calls -``` -Host Framework (PHP/Ruby/Python) Plugin Runtime (Node.js) -┌──────────────────────────┐ stdio ┌──────────────────────────┐ -│ Bridge │◄──────────►│ @escalated-dev/ │ -│ - spawns subprocess │ JSON- │ plugin-runtime │ -│ - dispatches hooks │ RPC 2.0 │ ┌────────────────────┐ │ -│ - handles ctx.* calls │ │ │ plugin-slack │ │ -│ │ │ │ plugin-jira │ │ -│ │ │ │ your-custom-plugin │ │ -└──────────────────────────┘ │ └────────────────────┘ │ - └──────────────────────────┘ -``` + | ++ +**Resilience (via the bridge)** +- Restarts with exponential backoff +- Actions degrade when it is unavailable +- Filters pass values through when down + + | +
| + +**Protocol** +- JSON-RPC 2.0 over stdin and stdout +- Concurrent host calls +- `host_call_id` on every `ctx.*` call -### Resilience + | +-- Spawned lazily on first hook dispatch -- Automatic restart with exponential backoff if the process crashes -- Action hooks degrade gracefully when the runtime is unavailable -- Filter hooks return unmodified values when the runtime is down +**Active plugins** +- Runs only plugins the host lists +- Older hosts run every loaded plugin -## Broadcasting Event Forwarding + | +-When the host framework has real-time broadcasting enabled, the runtime automatically forwards broadcasting events to plugins. The bridge sends these as standard action hooks (e.g., `broadcast.ticket.updated`, `broadcast.ticket.replied`) so plugins can react to real-time events without any additional configuration. See the [Plugin SDK README](https://github.com/escalated-dev/escalated-plugin-sdk#broadcastable-events) for the full list of broadcastable events. +**Real-time** +- Forwards broadcast events as action hooks +- No extra plugin configuration -## Protocol + | +