refactor: share extension monitor runtime setup

This commit is contained in:
Peter Steinberger
2026-03-14 02:13:07 +00:00
parent 6decaebcf2
commit 1ac4bac8b1
3 changed files with 25 additions and 14 deletions

View File

@@ -1,4 +1,5 @@
import { createLoggerBackedRuntime, type RuntimeEnv } from "openclaw/plugin-sdk/irc";
import type { RuntimeEnv } from "openclaw/plugin-sdk/irc";
import { resolveLoggerBackedRuntime } from "../../shared/runtime.js";
import { resolveIrcAccount } from "./accounts.js";
import { connectIrcClient, type IrcClient } from "./client.js";
import { buildIrcConnectOptions } from "./connect-options.js";
@@ -39,12 +40,10 @@ export async function monitorIrcProvider(opts: IrcMonitorOptions): Promise<{ sto
accountId: opts.accountId,
});
const runtime: RuntimeEnv =
opts.runtime ??
createLoggerBackedRuntime({
logger: core.logging.getChildLogger(),
exitError: () => new Error("Runtime exit not available"),
});
const runtime: RuntimeEnv = resolveLoggerBackedRuntime(
opts.runtime,
core.logging.getChildLogger(),
);
if (!account.configured) {
throw new Error(