refactor: reduce extension channel setup duplication

This commit is contained in:
Peter Steinberger
2026-03-14 02:05:27 +00:00
parent 74e50d3be3
commit e885f1999f
5 changed files with 26 additions and 12 deletions

View File

@@ -0,0 +1,18 @@
import { runPassiveAccountLifecycle } from "openclaw/plugin-sdk";
type StoppableMonitor = {
stop: () => void;
};
export async function runStoppablePassiveMonitor<TMonitor extends StoppableMonitor>(params: {
abortSignal: AbortSignal;
start: () => Promise<TMonitor>;
}): Promise<void> {
await runPassiveAccountLifecycle({
abortSignal: params.abortSignal,
start: params.start,
stop: async (monitor) => {
monitor.stop();
},
});
}