Docs: cover heartbeat, cron, and plugin route updates
This commit is contained in:
@@ -62,7 +62,7 @@ Schema instead. See [Plugin manifest](/plugins/manifest).
|
||||
Plugins can register:
|
||||
|
||||
- Gateway RPC methods
|
||||
- Gateway HTTP handlers
|
||||
- Gateway HTTP routes
|
||||
- Agent tools
|
||||
- CLI commands
|
||||
- Background services
|
||||
@@ -106,6 +106,37 @@ Notes:
|
||||
- Uses core media-understanding audio configuration (`tools.media.audio`) and provider fallback order.
|
||||
- Returns `{ text: undefined }` when no transcription output is produced (for example skipped/unsupported input).
|
||||
|
||||
## Gateway HTTP routes
|
||||
|
||||
Plugins can expose HTTP endpoints with `api.registerHttpRoute(...)`.
|
||||
|
||||
```ts
|
||||
api.registerHttpRoute({
|
||||
path: "/acme/webhook",
|
||||
auth: "plugin",
|
||||
match: "exact",
|
||||
handler: async (_req, res) => {
|
||||
res.statusCode = 200;
|
||||
res.end("ok");
|
||||
return true;
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
Route fields:
|
||||
|
||||
- `path`: route path under the gateway HTTP server.
|
||||
- `auth`: required. Use `"gateway"` to require normal gateway auth, or `"plugin"` for plugin-managed auth/webhook verification.
|
||||
- `match`: optional. `"exact"` (default) or `"prefix"`.
|
||||
- `replaceExisting`: optional. Allows the same plugin to replace its own existing route registration.
|
||||
- `handler`: return `true` when the route handled the request.
|
||||
|
||||
Notes:
|
||||
|
||||
- `api.registerHttpHandler(...)` is obsolete. Use `api.registerHttpRoute(...)`.
|
||||
- Plugin routes must declare `auth` explicitly.
|
||||
- Exact `path + match` conflicts are rejected unless `replaceExisting: true`, and one plugin cannot replace another plugin's route.
|
||||
|
||||
## Plugin SDK import paths
|
||||
|
||||
Use SDK subpaths instead of the monolithic `openclaw/plugin-sdk` import when
|
||||
|
||||
Reference in New Issue
Block a user