mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-05 22:32:12 +00:00
refactor(zalouser): narrow channel runtime imports
This commit is contained in:
23
extensions/zalouser/src/channel-api.ts
Normal file
23
extensions/zalouser/src/channel-api.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
export { formatAllowFromLowercase } from "openclaw/plugin-sdk/allow-from";
|
||||
export type {
|
||||
ChannelAccountSnapshot,
|
||||
ChannelDirectoryEntry,
|
||||
ChannelGroupContext,
|
||||
ChannelMessageActionAdapter,
|
||||
} from "openclaw/plugin-sdk/channel-contract";
|
||||
export { buildChannelConfigSchema } from "openclaw/plugin-sdk/channel-plugin-common";
|
||||
export type { ChannelPlugin } from "openclaw/plugin-sdk/core";
|
||||
export {
|
||||
DEFAULT_ACCOUNT_ID,
|
||||
normalizeAccountId,
|
||||
type OpenClawConfig,
|
||||
} from "openclaw/plugin-sdk/core";
|
||||
export {
|
||||
isDangerousNameMatchingEnabled,
|
||||
type GroupToolPolicyConfig,
|
||||
} from "openclaw/plugin-sdk/config-runtime";
|
||||
export { chunkTextForOutbound } from "openclaw/plugin-sdk/text-chunking";
|
||||
export {
|
||||
isNumericTargetId,
|
||||
sendPayloadWithChunkedTextAndMedia,
|
||||
} from "openclaw/plugin-sdk/reply-payload";
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { ChannelPlugin } from "../runtime-api.js";
|
||||
import type { ResolvedZalouserAccount } from "./accounts.js";
|
||||
import type { ChannelPlugin } from "./channel-api.js";
|
||||
import { zalouserSetupAdapter } from "./setup-core.js";
|
||||
import { zalouserSetupWizard } from "./setup-surface.js";
|
||||
import { createZalouserPluginBase } from "./shared.js";
|
||||
|
||||
@@ -12,23 +12,6 @@ import {
|
||||
createAsyncComputedAccountStatusAdapter,
|
||||
createDefaultChannelRuntimeState,
|
||||
} from "openclaw/plugin-sdk/status-helpers";
|
||||
import type {
|
||||
ChannelAccountSnapshot,
|
||||
ChannelDirectoryEntry,
|
||||
ChannelGroupContext,
|
||||
ChannelMessageActionAdapter,
|
||||
ChannelPlugin,
|
||||
OpenClawConfig,
|
||||
GroupToolPolicyConfig,
|
||||
} from "../runtime-api.js";
|
||||
import {
|
||||
DEFAULT_ACCOUNT_ID,
|
||||
chunkTextForOutbound,
|
||||
isDangerousNameMatchingEnabled,
|
||||
isNumericTargetId,
|
||||
normalizeAccountId,
|
||||
sendPayloadWithChunkedTextAndMedia,
|
||||
} from "../runtime-api.js";
|
||||
import {
|
||||
listZalouserAccountIds,
|
||||
resolveDefaultZalouserAccountId,
|
||||
@@ -37,6 +20,23 @@ import {
|
||||
checkZcaAuthenticated,
|
||||
type ResolvedZalouserAccount,
|
||||
} from "./accounts.js";
|
||||
import type {
|
||||
ChannelAccountSnapshot,
|
||||
ChannelDirectoryEntry,
|
||||
ChannelGroupContext,
|
||||
ChannelMessageActionAdapter,
|
||||
ChannelPlugin,
|
||||
OpenClawConfig,
|
||||
GroupToolPolicyConfig,
|
||||
} from "./channel-api.js";
|
||||
import {
|
||||
DEFAULT_ACCOUNT_ID,
|
||||
chunkTextForOutbound,
|
||||
isDangerousNameMatchingEnabled,
|
||||
isNumericTargetId,
|
||||
normalizeAccountId,
|
||||
sendPayloadWithChunkedTextAndMedia,
|
||||
} from "./channel-api.js";
|
||||
import { buildZalouserGroupCandidates, findZalouserGroupEntry } from "./group-policy.js";
|
||||
import { resolveZalouserReactionMessageIds } from "./message-sid.js";
|
||||
import { probeZalouser, type ZalouserProbeResult } from "./probe.js";
|
||||
@@ -184,7 +184,9 @@ const zalouserMessageActions: ChannelMessageActionAdapter = {
|
||||
const accounts = accountId
|
||||
? [resolveZalouserAccountSync({ cfg, accountId })].filter((account) => account.enabled)
|
||||
: listZalouserAccountIds(cfg)
|
||||
.map((resolvedAccountId) => resolveZalouserAccountSync({ cfg, accountId: resolvedAccountId }))
|
||||
.map((resolvedAccountId) =>
|
||||
resolveZalouserAccountSync({ cfg, accountId: resolvedAccountId }),
|
||||
)
|
||||
.filter((account) => account.enabled);
|
||||
if (accounts.length === 0) {
|
||||
return null;
|
||||
|
||||
@@ -3,8 +3,6 @@ import {
|
||||
adaptScopedAccountAccessor,
|
||||
createScopedChannelConfigAdapter,
|
||||
} from "openclaw/plugin-sdk/channel-config-helpers";
|
||||
import type { ChannelPlugin } from "../runtime-api.js";
|
||||
import { buildChannelConfigSchema, formatAllowFromLowercase } from "../runtime-api.js";
|
||||
import {
|
||||
listZalouserAccountIds,
|
||||
resolveDefaultZalouserAccountId,
|
||||
@@ -12,6 +10,8 @@ import {
|
||||
checkZcaAuthenticated,
|
||||
type ResolvedZalouserAccount,
|
||||
} from "./accounts.js";
|
||||
import type { ChannelPlugin } from "./channel-api.js";
|
||||
import { buildChannelConfigSchema, formatAllowFromLowercase } from "./channel-api.js";
|
||||
import { ZalouserConfigSchema } from "./config-schema.js";
|
||||
import { zalouserDoctor } from "./doctor.js";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user