mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-24 03:15:46 -06:00
f9d9d1225a
* refactor(sdk): add channel lifecycle patch factories * refactor(channels): adopt lifecycle patches in a-m * refactor(channels): adopt lifecycle patches in n-z * refactor(runtime): lifecycle-own ambient registries * test(slack): assert lifecycle factory fields * fix(sdk): preserve lifecycle patch extras types * test(zalouser): widen lifecycle status sink * test(irc): avoid shadowed status patch * fix(zalo): reuse account-agnostic media route * fix(gateway): accept explicit channel ready recovery * test(qa): assert terminal Slack block fact * test(qa): restore Slack blocked lifecycle scenario * test(gateway): lock explicit lifecycle recovery contract
31 lines
955 B
TypeScript
31 lines
955 B
TypeScript
import type { ChannelAccountSnapshot } from "openclaw/plugin-sdk/channel-contract";
|
|
import {
|
|
channelBlockedPatch,
|
|
channelReadyPatch,
|
|
channelStoppedPatch,
|
|
} from "openclaw/plugin-sdk/gateway-runtime";
|
|
|
|
export type MSTeamsStatusSink = (patch: Omit<ChannelAccountSnapshot, "accountId">) => void;
|
|
|
|
export function publishMSTeamsBlocked(
|
|
statusSink: MSTeamsStatusSink | undefined,
|
|
lastError: string,
|
|
) {
|
|
statusSink?.(channelBlockedPatch(lastError, { running: true }));
|
|
}
|
|
|
|
export function publishMSTeamsReady(statusSink: MSTeamsStatusSink | undefined, now = Date.now()) {
|
|
statusSink?.(channelReadyPatch({ lastConnectedAt: now }));
|
|
}
|
|
|
|
export function publishMSTeamsRecovering(
|
|
statusSink: MSTeamsStatusSink | undefined,
|
|
lastError: string,
|
|
) {
|
|
statusSink?.({ connected: false, lifecycle: "recovering", lastError });
|
|
}
|
|
|
|
export function publishMSTeamsStopped(statusSink: MSTeamsStatusSink | undefined) {
|
|
statusSink?.(channelStoppedPatch());
|
|
}
|