mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-27 09:21:35 +07:00
refactor: reuse account status helpers in bundled channels
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
export {
|
||||
DEFAULT_ACCOUNT_ID,
|
||||
PAIRING_APPROVED_MESSAGE,
|
||||
buildComputedAccountStatusSnapshot,
|
||||
buildChannelConfigSchema,
|
||||
collectStatusIssuesFromLastError,
|
||||
formatTrimmedAllowFromEntries,
|
||||
|
||||
@@ -5,6 +5,7 @@ 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 {
|
||||
buildComputedAccountStatusSnapshot,
|
||||
collectStatusIssuesFromLastError,
|
||||
DEFAULT_ACCOUNT_ID,
|
||||
formatTrimmedAllowFromEntries,
|
||||
@@ -206,21 +207,21 @@ export const imessagePlugin: ChannelPlugin<ResolvedIMessageAccount> = {
|
||||
}),
|
||||
probeAccount: async ({ timeoutMs }) =>
|
||||
await (await loadIMessageChannelRuntime()).probeIMessageAccount(timeoutMs),
|
||||
buildAccountSnapshot: ({ account, runtime, probe }) => ({
|
||||
accountId: account.accountId,
|
||||
name: account.name,
|
||||
enabled: account.enabled,
|
||||
configured: account.configured,
|
||||
running: runtime?.running ?? false,
|
||||
lastStartAt: runtime?.lastStartAt ?? null,
|
||||
lastStopAt: runtime?.lastStopAt ?? null,
|
||||
lastError: runtime?.lastError ?? null,
|
||||
cliPath: runtime?.cliPath ?? account.config.cliPath ?? null,
|
||||
dbPath: runtime?.dbPath ?? account.config.dbPath ?? null,
|
||||
probe,
|
||||
lastInboundAt: runtime?.lastInboundAt ?? null,
|
||||
lastOutboundAt: runtime?.lastOutboundAt ?? null,
|
||||
}),
|
||||
buildAccountSnapshot: ({ account, runtime, probe }) =>
|
||||
buildComputedAccountStatusSnapshot(
|
||||
{
|
||||
accountId: account.accountId,
|
||||
name: account.name,
|
||||
enabled: account.enabled,
|
||||
configured: account.configured,
|
||||
runtime,
|
||||
probe,
|
||||
},
|
||||
{
|
||||
cliPath: runtime?.cliPath ?? account.config.cliPath ?? null,
|
||||
dbPath: runtime?.dbPath ?? account.config.dbPath ?? null,
|
||||
},
|
||||
),
|
||||
resolveAccountState: ({ enabled }) => (enabled ? "enabled" : "disabled"),
|
||||
},
|
||||
gateway: {
|
||||
|
||||
@@ -41,6 +41,7 @@ import {
|
||||
resolveMatrixTargetIdentity,
|
||||
} from "./matrix/target-ids.js";
|
||||
import {
|
||||
buildComputedAccountStatusSnapshot,
|
||||
buildChannelConfigSchema,
|
||||
buildProbeChannelStatusSummary,
|
||||
collectStatusIssuesFromLastError,
|
||||
@@ -412,20 +413,22 @@ export const matrixPlugin: ChannelPlugin<ResolvedMatrixAccount> = {
|
||||
};
|
||||
}
|
||||
},
|
||||
buildAccountSnapshot: ({ account, runtime, probe }) => ({
|
||||
accountId: account.accountId,
|
||||
name: account.name,
|
||||
enabled: account.enabled,
|
||||
configured: account.configured,
|
||||
baseUrl: account.homeserver,
|
||||
running: runtime?.running ?? false,
|
||||
lastStartAt: runtime?.lastStartAt ?? null,
|
||||
lastStopAt: runtime?.lastStopAt ?? null,
|
||||
lastError: runtime?.lastError ?? null,
|
||||
probe,
|
||||
lastProbeAt: runtime?.lastProbeAt ?? null,
|
||||
...buildTrafficStatusSummary(runtime),
|
||||
}),
|
||||
buildAccountSnapshot: ({ account, runtime, probe }) =>
|
||||
buildComputedAccountStatusSnapshot(
|
||||
{
|
||||
accountId: account.accountId,
|
||||
name: account.name,
|
||||
enabled: account.enabled,
|
||||
configured: account.configured,
|
||||
runtime,
|
||||
probe,
|
||||
},
|
||||
{
|
||||
baseUrl: account.homeserver,
|
||||
lastProbeAt: runtime?.lastProbeAt ?? null,
|
||||
...buildTrafficStatusSummary(runtime),
|
||||
},
|
||||
),
|
||||
},
|
||||
gateway: {
|
||||
startAccount: async (ctx) => {
|
||||
|
||||
@@ -42,7 +42,10 @@ export {
|
||||
export { IMessageConfigSchema } from "../config/zod-schema.providers-core.js";
|
||||
|
||||
export { resolveChannelMediaMaxBytes } from "../channels/plugins/media-limits.js";
|
||||
export { collectStatusIssuesFromLastError } from "./status-helpers.js";
|
||||
export {
|
||||
buildComputedAccountStatusSnapshot,
|
||||
collectStatusIssuesFromLastError,
|
||||
} from "./status-helpers.js";
|
||||
export {
|
||||
monitorIMessageProvider,
|
||||
probeIMessage,
|
||||
|
||||
@@ -148,6 +148,7 @@ export { formatResolvedUnresolvedNote } from "./resolution-notes.js";
|
||||
export { runPluginCommandWithTimeout } from "./run-command.js";
|
||||
export { createLoggerBackedRuntime, resolveRuntimeEnv } from "./runtime.js";
|
||||
export {
|
||||
buildComputedAccountStatusSnapshot,
|
||||
buildProbeChannelStatusSummary,
|
||||
collectStatusIssuesFromLastError,
|
||||
} from "./status-helpers.js";
|
||||
|
||||
Reference in New Issue
Block a user