mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-03 13:22:14 +00:00
refactor: move tasks into bundled plugin
This commit is contained in:
@@ -140,14 +140,15 @@ methods:
|
||||
|
||||
### Infrastructure
|
||||
|
||||
| Method | What it registers |
|
||||
| ---------------------------------------------- | --------------------- |
|
||||
| `api.registerHook(events, handler, opts?)` | Event hook |
|
||||
| `api.registerHttpRoute(params)` | Gateway HTTP endpoint |
|
||||
| `api.registerGatewayMethod(name, handler)` | Gateway RPC method |
|
||||
| `api.registerCli(registrar, opts?)` | CLI subcommand |
|
||||
| `api.registerService(service)` | Background service |
|
||||
| `api.registerInteractiveHandler(registration)` | Interactive handler |
|
||||
| Method | What it registers |
|
||||
| ---------------------------------------------- | -------------------------- |
|
||||
| `api.registerHook(events, handler, opts?)` | Event hook |
|
||||
| `api.registerHttpRoute(params)` | Gateway HTTP endpoint |
|
||||
| `api.registerGatewayMethod(name, handler)` | Gateway RPC method |
|
||||
| `api.registerCli(registrar, opts?)` | CLI subcommand |
|
||||
| `api.registerService(service)` | Background service |
|
||||
| `api.registerInteractiveHandler(registration)` | Interactive handler |
|
||||
| `api.registerOperationsRuntime(runtime)` | Durable operations runtime |
|
||||
|
||||
### CLI registration metadata
|
||||
|
||||
|
||||
@@ -115,6 +115,40 @@ await api.runtime.subagent.deleteSession({
|
||||
Untrusted plugins can still run subagents, but override requests are rejected.
|
||||
</Warning>
|
||||
|
||||
### `api.runtime.operations`
|
||||
|
||||
Dispatch and query durable operation records behind a plugin-owned operations
|
||||
runtime.
|
||||
|
||||
```typescript
|
||||
const created = await api.runtime.operations.dispatch({
|
||||
type: "create",
|
||||
namespace: "imports",
|
||||
kind: "csv",
|
||||
status: "queued",
|
||||
description: "Import contacts.csv",
|
||||
runId: "import-1",
|
||||
});
|
||||
|
||||
const progressed = await api.runtime.operations.dispatch({
|
||||
type: "transition",
|
||||
runId: "import-1",
|
||||
status: "running",
|
||||
progressSummary: "Parsing rows",
|
||||
});
|
||||
|
||||
const record = await api.runtime.operations.findByRunId("import-1");
|
||||
const list = await api.runtime.operations.list({ namespace: "imports" });
|
||||
const summary = await api.runtime.operations.summarize({ namespace: "imports" });
|
||||
```
|
||||
|
||||
Notes:
|
||||
|
||||
- `api.registerOperationsRuntime(...)` installs the active runtime.
|
||||
- Core exposes the facade; plugins own the operation semantics and storage.
|
||||
- The built-in default runtime maps the existing background task ledger into the
|
||||
generic operations shape until a plugin overrides it.
|
||||
|
||||
### `api.runtime.tts`
|
||||
|
||||
Text-to-speech synthesis.
|
||||
|
||||
Reference in New Issue
Block a user