Files
clawdbot/src/imessage/monitor/runtime.ts
2026-01-14 01:17:56 +00:00

19 lines
514 B
TypeScript

import type { RuntimeEnv } from "../../runtime.js";
import type { MonitorIMessageOpts } from "./types.js";
export function resolveRuntime(opts: MonitorIMessageOpts): RuntimeEnv {
return (
opts.runtime ?? {
log: console.log,
error: console.error,
exit: (code: number): never => {
throw new Error(`exit ${code}`);
},
}
);
}
export function normalizeAllowList(list?: Array<string | number>) {
return (list ?? []).map((entry) => String(entry).trim()).filter(Boolean);
}