refactor(plugin-sdk): add managed task flow runtime

This commit is contained in:
Peter Steinberger
2026-04-28 05:32:23 +01:00
parent d987e153fe
commit b60eb1711a
16 changed files with 35 additions and 23 deletions

View File

@@ -14,8 +14,10 @@ function createApi(params?: {
source: "test",
pluginConfig: params?.pluginConfig ?? {},
runtime: {
taskFlow: {
bindSession: vi.fn(({ sessionKey }: { sessionKey: string }) => ({ sessionKey })),
tasks: {
managedFlows: {
bindSession: vi.fn(({ sessionKey }: { sessionKey: string }) => ({ sessionKey })),
},
},
} as unknown as OpenClawPluginApi["runtime"],
registerHttpRoute: params?.registerHttpRoute ?? vi.fn(),

View File

@@ -17,7 +17,7 @@ function registerWebhookRoutes(api: OpenClawPluginApi): void {
});
for (const route of routes) {
const taskFlow = api.runtime.taskFlow.bindSession({
const taskFlow = api.runtime.tasks.managedFlows.bindSession({
sessionKey: route.sessionKey,
});
const target: TaskFlowWebhookTarget = {

View File

@@ -18,7 +18,7 @@ import {
} from "../runtime-api.js";
import type { WebhookSecretInput } from "./config.js";
type BoundTaskFlowRuntime = ReturnType<PluginRuntime["taskFlow"]["bindSession"]>;
type BoundTaskFlowRuntime = ReturnType<PluginRuntime["tasks"]["managedFlows"]["bindSession"]>;
type JsonValue = null | boolean | number | string | JsonValue[] | { [key: string]: JsonValue };