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

@@ -191,7 +191,7 @@ describe("plugin runtime command execution", () => {
},
},
{
name: "exposes canonical runtime.tasks.runs and runtime.tasks.flows while keeping legacy TaskFlow aliases",
name: "exposes canonical runtime.tasks task runtimes while keeping legacy TaskFlow aliases",
assert: (runtime: ReturnType<typeof createPluginRuntime>) => {
expectFunctionKeys(runtime.tasks.runs as Record<string, unknown>, [
"bindSession",
@@ -201,11 +201,16 @@ describe("plugin runtime command execution", () => {
"bindSession",
"fromToolContext",
]);
expectFunctionKeys(runtime.tasks.managedFlows as Record<string, unknown>, [
"bindSession",
"fromToolContext",
]);
expectFunctionKeys(runtime.tasks.flow as Record<string, unknown>, [
"bindSession",
"fromToolContext",
]);
expect(runtime.taskFlow).toBe(runtime.tasks.flow);
expect(runtime.tasks.managedFlows).toBe(runtime.tasks.flow);
expect(runtime.taskFlow).toBe(runtime.tasks.managedFlows);
},
},
{

View File

@@ -217,6 +217,7 @@ export function createRuntimeTasks(params: {
return {
runs: createRuntimeTaskRuns(),
flows: createRuntimeTaskFlows(),
managedFlows: params.legacyTaskFlow,
flow: params.legacyTaskFlow,
};
}

View File

@@ -64,6 +64,7 @@ export type PluginRuntimeTaskFlows = {
export type PluginRuntimeTasks = {
runs: PluginRuntimeTaskRuns;
flows: PluginRuntimeTaskFlows;
managedFlows: PluginRuntimeTaskFlow;
/** @deprecated Use runtime.tasks.flows for DTO-based TaskFlow access. */
flow: PluginRuntimeTaskFlow;
};

View File

@@ -231,6 +231,7 @@ export type PluginRuntimeCore = {
tasks: {
runs: PluginRuntimeTaskRuns;
flows: PluginRuntimeTaskFlows;
managedFlows: import("./runtime-taskflow.types.js").PluginRuntimeTaskFlow;
/** @deprecated Use runtime.tasks.flows for DTO-based TaskFlow access. */
flow: import("./runtime-taskflow.types.js").PluginRuntimeTaskFlow;
};