mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 12:20:44 +00:00
refactor(plugin-sdk): add managed task flow runtime
This commit is contained in:
@@ -725,18 +725,18 @@ canonical replacement.
|
||||
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="runtime.tasks.flow → runtime.tasks.flows">
|
||||
<Accordion title="runtime.tasks.flow → runtime.tasks.managedFlows">
|
||||
**Old**: `runtime.tasks.flow` (singular) returned a live task-flow accessor.
|
||||
|
||||
**New**: `runtime.tasks.flows` (plural) returns DTO-based TaskFlow access,
|
||||
which is import-safe and does not require the full task runtime to be
|
||||
loaded.
|
||||
**New**: `runtime.tasks.managedFlows` keeps the managed TaskFlow mutation
|
||||
runtime for plugins that create, update, cancel, or run child tasks from a
|
||||
flow. Use `runtime.tasks.flows` when the plugin only needs DTO-based reads.
|
||||
|
||||
```typescript
|
||||
// Before
|
||||
const flow = api.runtime.tasks.flow(ctx);
|
||||
const flow = api.runtime.tasks.flow.fromToolContext(ctx);
|
||||
// After
|
||||
const flows = api.runtime.tasks.flows(ctx);
|
||||
const flow = api.runtime.tasks.managedFlows.fromToolContext(ctx);
|
||||
```
|
||||
|
||||
</Accordion>
|
||||
|
||||
@@ -179,11 +179,11 @@ Internal OpenClaw runtime code has the same direction: load config once at the C
|
||||
Inside the Gateway this runtime is in-process. In plugin CLI commands it calls the configured Gateway over RPC, so commands such as `openclaw googlemeet recover-tab` can inspect paired nodes from the terminal. Node commands still go through normal Gateway node pairing, command allowlists, and node-local command handling.
|
||||
|
||||
</Accordion>
|
||||
<Accordion title="api.runtime.taskFlow">
|
||||
<Accordion title="api.runtime.tasks.managedFlows">
|
||||
Bind a Task Flow runtime to an existing OpenClaw session key or trusted tool context, then create and manage Task Flows without passing an owner on every call.
|
||||
|
||||
```typescript
|
||||
const taskFlow = api.runtime.taskFlow.fromToolContext(ctx);
|
||||
const taskFlow = api.runtime.tasks.managedFlows.fromToolContext(ctx);
|
||||
|
||||
const created = taskFlow.createManaged({
|
||||
controllerId: "my-plugin/review-batch",
|
||||
|
||||
@@ -89,7 +89,7 @@ The plugin applies:
|
||||
- Request body size and timeout guards
|
||||
- Fixed-window rate limiting
|
||||
- In-flight request limiting
|
||||
- Owner-bound TaskFlow access through `api.runtime.taskFlow.bindSession(...)`
|
||||
- Owner-bound TaskFlow access through `api.runtime.tasks.managedFlows.bindSession(...)`
|
||||
|
||||
## Request format
|
||||
|
||||
|
||||
Reference in New Issue
Block a user