mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-10 08:41:13 +00:00
refactor(tasks): move task-flow ownership under tasks
This commit is contained in:
@@ -190,12 +190,13 @@ describe("plugin runtime command execution", () => {
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "exposes runtime.taskFlow binding helpers",
|
||||
name: "exposes runtime.tasks.flow as the canonical TaskFlow runtime and keeps runtime.taskFlow as an alias",
|
||||
assert: (runtime: ReturnType<typeof createPluginRuntime>) => {
|
||||
expectFunctionKeys(runtime.taskFlow as Record<string, unknown>, [
|
||||
expectFunctionKeys(runtime.tasks.flow as Record<string, unknown>, [
|
||||
"bindSession",
|
||||
"fromToolContext",
|
||||
]);
|
||||
expect(runtime.taskFlow).toBe(runtime.tasks.flow);
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -184,6 +184,7 @@ export type CreatePluginRuntimeOptions = {
|
||||
|
||||
export function createPluginRuntime(_options: CreatePluginRuntimeOptions = {}): PluginRuntime {
|
||||
const mediaUnderstanding = createRuntimeMediaUnderstandingFacade();
|
||||
const taskFlow = createRuntimeTaskFlow();
|
||||
const runtime = {
|
||||
// Sourced from the shared OpenClaw version resolver (#52899) so plugins
|
||||
// always see the same version the CLI reports, avoiding API-version drift.
|
||||
@@ -204,7 +205,10 @@ export function createPluginRuntime(_options: CreatePluginRuntimeOptions = {}):
|
||||
events: createRuntimeEvents(),
|
||||
logging: createRuntimeLogging(),
|
||||
state: { resolveStateDir },
|
||||
taskFlow: createRuntimeTaskFlow(),
|
||||
tasks: {
|
||||
flow: taskFlow,
|
||||
},
|
||||
taskFlow,
|
||||
} satisfies Omit<
|
||||
PluginRuntime,
|
||||
"tts" | "mediaUnderstanding" | "stt" | "modelAuth" | "imageGeneration"
|
||||
|
||||
@@ -103,6 +103,9 @@ export type PluginRuntimeCore = {
|
||||
state: {
|
||||
resolveStateDir: typeof import("../../config/paths.js").resolveStateDir;
|
||||
};
|
||||
tasks: {
|
||||
flow: import("./runtime-taskflow.js").PluginRuntimeTaskFlow;
|
||||
};
|
||||
taskFlow: import("./runtime-taskflow.js").PluginRuntimeTaskFlow;
|
||||
modelAuth: {
|
||||
/** Resolve auth for a model. Only provider/model and optional cfg are used. */
|
||||
|
||||
Reference in New Issue
Block a user