diff --git a/extensions/bluebubbles/src/channel.ts b/extensions/bluebubbles/src/channel.ts index 9c5cebe6c85..a0a12cb95a4 100644 --- a/extensions/bluebubbles/src/channel.ts +++ b/extensions/bluebubbles/src/channel.ts @@ -14,7 +14,10 @@ import { import { createAttachedChannelResultAdapter } from "openclaw/plugin-sdk/channel-send-result"; import { createChatChannelPlugin } from "openclaw/plugin-sdk/core"; import { createLazyRuntimeNamedExport } from "openclaw/plugin-sdk/lazy-runtime"; -import { createComputedAccountStatusAdapter } from "openclaw/plugin-sdk/status-helpers"; +import { + createComputedAccountStatusAdapter, + createDefaultChannelRuntimeState, +} from "openclaw/plugin-sdk/status-helpers"; import { listBlueBubblesAccountIds, type ResolvedBlueBubblesAccount, @@ -228,13 +231,7 @@ export const bluebubblesPlugin: ChannelPlugin = crea }, setup: blueBubblesSetupAdapter, status: createComputedAccountStatusAdapter({ - defaultRuntime: { - accountId: DEFAULT_ACCOUNT_ID, - running: false, - lastStartAt: null, - lastStopAt: null, - lastError: null, - }, + defaultRuntime: createDefaultChannelRuntimeState(DEFAULT_ACCOUNT_ID), collectStatusIssues: collectBlueBubblesStatusIssues, buildChannelSummary: ({ snapshot }) => buildProbeChannelStatusSummary(snapshot, { baseUrl: snapshot.baseUrl ?? null }), diff --git a/extensions/discord/src/channel.ts b/extensions/discord/src/channel.ts index dcc742c52fc..50ddd98a017 100644 --- a/extensions/discord/src/channel.ts +++ b/extensions/discord/src/channel.ts @@ -24,7 +24,10 @@ import { resolveThreadSessionKeys, type RoutePeer, } from "openclaw/plugin-sdk/routing"; -import { createComputedAccountStatusAdapter } from "openclaw/plugin-sdk/status-helpers"; +import { + createComputedAccountStatusAdapter, + createDefaultChannelRuntimeState, +} from "openclaw/plugin-sdk/status-helpers"; import { listDiscordAccountIds, resolveDiscordAccount, @@ -429,18 +432,13 @@ export const discordPlugin: ChannelPlugin = createChatCh }), }, status: createComputedAccountStatusAdapter({ - defaultRuntime: { - accountId: DEFAULT_ACCOUNT_ID, - running: false, + defaultRuntime: createDefaultChannelRuntimeState(DEFAULT_ACCOUNT_ID, { connected: false, reconnectAttempts: 0, lastConnectedAt: null, lastDisconnect: null, lastEventAt: null, - lastStartAt: null, - lastStopAt: null, - lastError: null, - }, + }), collectStatusIssues: collectDiscordStatusIssues, buildChannelSummary: ({ snapshot }) => buildTokenChannelStatusSummary(snapshot, { includeMode: false }), diff --git a/extensions/googlechat/src/channel.ts b/extensions/googlechat/src/channel.ts index 313401cb6d7..f8e61319100 100644 --- a/extensions/googlechat/src/channel.ts +++ b/extensions/googlechat/src/channel.ts @@ -18,7 +18,10 @@ import { } from "openclaw/plugin-sdk/directory-runtime"; import { buildPassiveProbedChannelStatusSummary } from "openclaw/plugin-sdk/extension-shared"; import { createLazyRuntimeNamedExport } from "openclaw/plugin-sdk/lazy-runtime"; -import { createComputedAccountStatusAdapter } from "openclaw/plugin-sdk/status-helpers"; +import { + createComputedAccountStatusAdapter, + createDefaultChannelRuntimeState, +} from "openclaw/plugin-sdk/status-helpers"; import { buildChannelConfigSchema, DEFAULT_ACCOUNT_ID, @@ -208,13 +211,7 @@ export const googlechatPlugin = createChatChannelPlugin({ }, actions: googlechatActions, status: createComputedAccountStatusAdapter({ - defaultRuntime: { - accountId: DEFAULT_ACCOUNT_ID, - running: false, - lastStartAt: null, - lastStopAt: null, - lastError: null, - }, + defaultRuntime: createDefaultChannelRuntimeState(DEFAULT_ACCOUNT_ID), collectStatusIssues: (accounts): ChannelStatusIssue[] => accounts.flatMap((entry) => { const accountId = String(entry.accountId ?? DEFAULT_ACCOUNT_ID); diff --git a/extensions/imessage/src/channel.ts b/extensions/imessage/src/channel.ts index 85e5d44ce05..b6efbf38e12 100644 --- a/extensions/imessage/src/channel.ts +++ b/extensions/imessage/src/channel.ts @@ -4,6 +4,7 @@ import { buildPassiveProbedChannelStatusSummary } from "openclaw/plugin-sdk/exte import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime"; import { resolveOutboundSendDep } from "openclaw/plugin-sdk/outbound-runtime"; import { buildOutboundBaseSessionKey, type RoutePeer } from "openclaw/plugin-sdk/routing"; +import { createDefaultChannelRuntimeState } from "openclaw/plugin-sdk/status-helpers"; import { buildComputedAccountStatusSnapshot, collectStatusIssuesFromLastError, @@ -150,15 +151,10 @@ export const imessagePlugin: ChannelPlugin collectStatusIssuesFromLastError("imessage", accounts), buildChannelSummary: ({ snapshot }) => buildPassiveProbedChannelStatusSummary(snapshot, { diff --git a/extensions/irc/src/channel.ts b/extensions/irc/src/channel.ts index 90f99893eb4..2c340630bb9 100644 --- a/extensions/irc/src/channel.ts +++ b/extensions/irc/src/channel.ts @@ -16,6 +16,7 @@ import { listResolvedDirectoryEntriesFromSources, } from "openclaw/plugin-sdk/directory-runtime"; import { runStoppablePassiveMonitor } from "openclaw/plugin-sdk/extension-shared"; +import { createDefaultChannelRuntimeState } from "openclaw/plugin-sdk/status-helpers"; import { listIrcAccountIds, resolveDefaultIrcAccountId, @@ -253,13 +254,7 @@ export const ircPlugin: ChannelPlugin = createChat }, }), status: { - defaultRuntime: { - accountId: DEFAULT_ACCOUNT_ID, - running: false, - lastStartAt: null, - lastStopAt: null, - lastError: null, - }, + defaultRuntime: createDefaultChannelRuntimeState(DEFAULT_ACCOUNT_ID), buildChannelSummary: ({ account, snapshot }) => ({ ...buildBaseChannelStatusSummary(snapshot), host: account.host, diff --git a/extensions/line/src/channel.ts b/extensions/line/src/channel.ts index 6883aaf691b..62aca6575d1 100644 --- a/extensions/line/src/channel.ts +++ b/extensions/line/src/channel.ts @@ -7,7 +7,10 @@ import { import { createChatChannelPlugin } from "openclaw/plugin-sdk/core"; import { createEmptyChannelDirectoryAdapter } from "openclaw/plugin-sdk/directory-runtime"; import { resolveOutboundMediaUrls } from "openclaw/plugin-sdk/reply-payload"; -import { createComputedAccountStatusAdapter } from "openclaw/plugin-sdk/status-helpers"; +import { + createComputedAccountStatusAdapter, + createDefaultChannelRuntimeState, +} from "openclaw/plugin-sdk/status-helpers"; import { buildTokenChannelStatusSummary, clearAccountEntryFields, @@ -74,13 +77,7 @@ export const linePlugin: ChannelPlugin = createChatChannelP directory: createEmptyChannelDirectoryAdapter(), setup: lineSetupAdapter, status: createComputedAccountStatusAdapter({ - defaultRuntime: { - accountId: DEFAULT_ACCOUNT_ID, - running: false, - lastStartAt: null, - lastStopAt: null, - lastError: null, - }, + defaultRuntime: createDefaultChannelRuntimeState(DEFAULT_ACCOUNT_ID), collectStatusIssues: (accounts) => { const issues: ChannelStatusIssue[] = []; for (const account of accounts) { diff --git a/extensions/matrix/src/channel.ts b/extensions/matrix/src/channel.ts index 35198343364..8784cf1873b 100644 --- a/extensions/matrix/src/channel.ts +++ b/extensions/matrix/src/channel.ts @@ -22,6 +22,7 @@ import { import { buildTrafficStatusSummary } from "openclaw/plugin-sdk/extension-shared"; import { createLazyRuntimeNamedExport } from "openclaw/plugin-sdk/lazy-runtime"; import { createRuntimeOutboundDelegates } from "openclaw/plugin-sdk/outbound-runtime"; +import { createDefaultChannelRuntimeState } from "openclaw/plugin-sdk/status-helpers"; import { matrixMessageActions } from "./actions.js"; import { MatrixConfigSchema } from "./config-schema.js"; import { @@ -319,13 +320,7 @@ export const matrixPlugin: ChannelPlugin = }), }, status: { - defaultRuntime: { - accountId: DEFAULT_ACCOUNT_ID, - running: false, - lastStartAt: null, - lastStopAt: null, - lastError: null, - }, + defaultRuntime: createDefaultChannelRuntimeState(DEFAULT_ACCOUNT_ID), collectStatusIssues: (accounts) => collectStatusIssuesFromLastError("matrix", accounts), buildChannelSummary: ({ snapshot }) => buildProbeChannelStatusSummary(snapshot, { baseUrl: snapshot.baseUrl ?? null }), diff --git a/extensions/mattermost/src/channel.ts b/extensions/mattermost/src/channel.ts index a7d35ac457a..b91f1c995a3 100644 --- a/extensions/mattermost/src/channel.ts +++ b/extensions/mattermost/src/channel.ts @@ -15,7 +15,10 @@ import { createRestrictSendersChannelSecurity } from "openclaw/plugin-sdk/channe import { createChatChannelPlugin } from "openclaw/plugin-sdk/core"; import { createChannelDirectoryAdapter } from "openclaw/plugin-sdk/directory-runtime"; import { buildPassiveProbedChannelStatusSummary } from "openclaw/plugin-sdk/extension-shared"; -import { createComputedAccountStatusAdapter } from "openclaw/plugin-sdk/status-helpers"; +import { + createComputedAccountStatusAdapter, + createDefaultChannelRuntimeState, +} from "openclaw/plugin-sdk/status-helpers"; import { MattermostConfigSchema } from "./config-schema.js"; import { resolveMattermostGroupRequireMention } from "./group-mentions.js"; import { @@ -347,16 +350,11 @@ export const mattermostPlugin: ChannelPlugin = create }, }, status: createComputedAccountStatusAdapter({ - defaultRuntime: { - accountId: DEFAULT_ACCOUNT_ID, - running: false, + defaultRuntime: createDefaultChannelRuntimeState(DEFAULT_ACCOUNT_ID, { connected: false, lastConnectedAt: null, lastDisconnect: null, - lastStartAt: null, - lastStopAt: null, - lastError: null, - }, + }), buildChannelSummary: ({ snapshot }) => buildPassiveProbedChannelStatusSummary(snapshot, { botTokenSource: snapshot.botTokenSource ?? "none", diff --git a/extensions/nextcloud-talk/src/channel.ts b/extensions/nextcloud-talk/src/channel.ts index 87e1b18b1c8..1df568e4842 100644 --- a/extensions/nextcloud-talk/src/channel.ts +++ b/extensions/nextcloud-talk/src/channel.ts @@ -13,6 +13,7 @@ import { import { createAllowlistProviderRouteAllowlistWarningCollector } from "openclaw/plugin-sdk/channel-policy"; import { createChatChannelPlugin } from "openclaw/plugin-sdk/core"; import { runStoppablePassiveMonitor } from "openclaw/plugin-sdk/extension-shared"; +import { createDefaultChannelRuntimeState } from "openclaw/plugin-sdk/status-helpers"; import { buildBaseChannelStatusSummary, buildChannelConfigSchema, @@ -168,13 +169,7 @@ export const nextcloudTalkPlugin: ChannelPlugin = }, setup: nextcloudTalkSetupAdapter, status: { - defaultRuntime: { - accountId: DEFAULT_ACCOUNT_ID, - running: false, - lastStartAt: null, - lastStopAt: null, - lastError: null, - }, + defaultRuntime: createDefaultChannelRuntimeState(DEFAULT_ACCOUNT_ID), buildChannelSummary: ({ snapshot }) => buildBaseChannelStatusSummary(snapshot, { secretSource: snapshot.secretSource ?? "none", diff --git a/extensions/slack/src/channel.ts b/extensions/slack/src/channel.ts index 08bce34344a..3c07596ef03 100644 --- a/extensions/slack/src/channel.ts +++ b/extensions/slack/src/channel.ts @@ -26,7 +26,10 @@ import { resolveThreadSessionKeys, type RoutePeer, } from "openclaw/plugin-sdk/routing"; -import { createComputedAccountStatusAdapter } from "openclaw/plugin-sdk/status-helpers"; +import { + createComputedAccountStatusAdapter, + createDefaultChannelRuntimeState, +} from "openclaw/plugin-sdk/status-helpers"; import { listEnabledSlackAccounts, resolveSlackAccount, @@ -457,13 +460,7 @@ export const slackPlugin: ChannelPlugin = createChatChanne ), }), status: createComputedAccountStatusAdapter({ - defaultRuntime: { - accountId: DEFAULT_ACCOUNT_ID, - running: false, - lastStartAt: null, - lastStopAt: null, - lastError: null, - }, + defaultRuntime: createDefaultChannelRuntimeState(DEFAULT_ACCOUNT_ID), buildChannelSummary: ({ snapshot }) => buildPassiveProbedChannelStatusSummary(snapshot, { botTokenSource: snapshot.botTokenSource ?? "none", diff --git a/extensions/telegram/src/channel.ts b/extensions/telegram/src/channel.ts index 333b7575fe3..b198f7d76eb 100644 --- a/extensions/telegram/src/channel.ts +++ b/extensions/telegram/src/channel.ts @@ -20,6 +20,7 @@ import { resolveThreadSessionKeys, type RoutePeer, } from "openclaw/plugin-sdk/routing"; +import { createDefaultChannelRuntimeState } from "openclaw/plugin-sdk/status-helpers"; import { parseTelegramTopicConversation } from "../runtime-api.js"; import { buildTokenChannelStatusSummary, @@ -449,13 +450,7 @@ export const telegramPlugin = createChatChannelPlugin({ }), actions: telegramMessageActions, status: { - defaultRuntime: { - accountId: DEFAULT_ACCOUNT_ID, - running: false, - lastStartAt: null, - lastStopAt: null, - lastError: null, - }, + defaultRuntime: createDefaultChannelRuntimeState(DEFAULT_ACCOUNT_ID), collectStatusIssues: collectTelegramStatusIssues, buildChannelSummary: ({ snapshot }) => buildTokenChannelStatusSummary(snapshot), probeAccount: async ({ account, timeoutMs }) => diff --git a/extensions/tlon/src/channel.ts b/extensions/tlon/src/channel.ts index 49dc28f0390..6eef5d21962 100644 --- a/extensions/tlon/src/channel.ts +++ b/extensions/tlon/src/channel.ts @@ -5,6 +5,7 @@ import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime"; import { createChatChannelPlugin, type ChannelPlugin } from "openclaw/plugin-sdk/core"; import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime"; import { createRuntimeOutboundDelegates } from "openclaw/plugin-sdk/outbound-runtime"; +import { createDefaultChannelRuntimeState } from "openclaw/plugin-sdk/status-helpers"; import { buildComputedAccountStatusSnapshot } from "../api.js"; import { tlonChannelConfigSchema } from "./config-schema.js"; import { resolveTlonOutboundSessionRoute } from "./session-route.js"; @@ -109,13 +110,7 @@ export const tlonPlugin = createChatChannelPlugin({ resolveOutboundSessionRoute: (params) => resolveTlonOutboundSessionRoute(params), }, status: { - defaultRuntime: { - accountId: DEFAULT_ACCOUNT_ID, - running: false, - lastStartAt: null, - lastStopAt: null, - lastError: null, - }, + defaultRuntime: createDefaultChannelRuntimeState(DEFAULT_ACCOUNT_ID), collectStatusIssues: (accounts) => { return accounts.flatMap((account) => { if (!account.configured) { diff --git a/extensions/whatsapp/src/channel.ts b/extensions/whatsapp/src/channel.ts index 529e6f8b44f..95a7dfbb854 100644 --- a/extensions/whatsapp/src/channel.ts +++ b/extensions/whatsapp/src/channel.ts @@ -1,5 +1,6 @@ import { buildDmGroupAccountAllowlistAdapter } from "openclaw/plugin-sdk/allowlist-config-edit"; import { createChatChannelPlugin } from "openclaw/plugin-sdk/core"; +import { createDefaultChannelRuntimeState } from "openclaw/plugin-sdk/status-helpers"; // WhatsApp-specific imports from local extension code (moved from src/web/ and src/channels/plugins/) import { resolveWhatsAppAccount, type ResolvedWhatsAppAccount } from "./accounts.js"; import type { WebChannelStatus } from "./auto-reply/types.js"; @@ -207,9 +208,7 @@ export const whatsappPlugin: ChannelPlugin = resolveRecipients: ({ cfg, opts }) => resolveWhatsAppHeartbeatRecipients(cfg, opts), }, status: { - defaultRuntime: { - accountId: DEFAULT_ACCOUNT_ID, - running: false, + defaultRuntime: createDefaultChannelRuntimeState(DEFAULT_ACCOUNT_ID, { connected: false, reconnectAttempts: 0, lastConnectedAt: null, @@ -217,9 +216,8 @@ export const whatsappPlugin: ChannelPlugin = lastInboundAt: null, lastMessageAt: null, lastEventAt: null, - lastError: null, healthState: "stopped", - }, + }), collectStatusIssues: collectWhatsAppStatusIssues, buildChannelSummary: async ({ account, snapshot }) => { const authDir = account.authDir; diff --git a/extensions/zalo/src/channel.ts b/extensions/zalo/src/channel.ts index cb407c77ea0..9e8a89d3f58 100644 --- a/extensions/zalo/src/channel.ts +++ b/extensions/zalo/src/channel.ts @@ -19,6 +19,7 @@ import { createChatChannelPlugin } from "openclaw/plugin-sdk/core"; import { createChannelDirectoryAdapter } from "openclaw/plugin-sdk/directory-runtime"; import { listResolvedDirectoryUserEntriesFromAllowFrom } from "openclaw/plugin-sdk/directory-runtime"; import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime"; +import { createDefaultChannelRuntimeState } from "openclaw/plugin-sdk/status-helpers"; import { listZaloAccountIds, resolveDefaultZaloAccountId, @@ -200,13 +201,7 @@ export const zaloPlugin: ChannelPlugin = listGroups: async () => [], }), status: { - defaultRuntime: { - accountId: DEFAULT_ACCOUNT_ID, - running: false, - lastStartAt: null, - lastStopAt: null, - lastError: null, - }, + defaultRuntime: createDefaultChannelRuntimeState(DEFAULT_ACCOUNT_ID), collectStatusIssues: collectZaloStatusIssues, buildChannelSummary: ({ snapshot }) => buildTokenChannelStatusSummary(snapshot), probeAccount: async ({ account, timeoutMs }) => diff --git a/extensions/zalouser/src/channel.ts b/extensions/zalouser/src/channel.ts index 24f2ee531a0..466ca405408 100644 --- a/extensions/zalouser/src/channel.ts +++ b/extensions/zalouser/src/channel.ts @@ -8,6 +8,7 @@ import { import { createStaticReplyToModeResolver } from "openclaw/plugin-sdk/conversation-runtime"; import { createChatChannelPlugin } from "openclaw/plugin-sdk/core"; import { buildPassiveProbedChannelStatusSummary } from "openclaw/plugin-sdk/extension-shared"; +import { createDefaultChannelRuntimeState } from "openclaw/plugin-sdk/status-helpers"; import type { ChannelAccountSnapshot, ChannelDirectoryEntry, @@ -409,13 +410,7 @@ export const zalouserPlugin: ChannelPlugin buildPassiveProbedChannelStatusSummary(snapshot), probeAccount: async ({ account, timeoutMs }) => probeZalouser(account.profile, timeoutMs),