UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

28 lines (27 loc) • 678 B
import { randomUUID } from "node:crypto"; //#region src/infra/install-progress.ts /** Only this operation's settlement completes its activity; later work cannot imply success. */ async function withInstallActivity(e, t, n, r = (e) => !(e && typeof e === "object" && "ok" in e && e.ok === false)) { if (!e?.activity) return await n(); const i = randomUUID(); const emit = (n) => { try { e.activity?.({ activityId: i, stage: t, status: n }); } catch {} }; emit("started"); try { const e = await n(); emit(r(e) ? "completed" : "failed"); return e; } catch (e) { emit("failed"); throw e; } } //#endregion export { withInstallActivity as t };