refactor: move tasks into bundled plugin

This commit is contained in:
Peter Steinberger
2026-03-31 14:48:22 +01:00
parent 584db0aff2
commit c75f4695b7
39 changed files with 2492 additions and 736 deletions

View File

@@ -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

View File

@@ -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.