/** * Channel 插件对象 — 主适配器集合(含 config / setup / onboarding / gateway / * outbound / status / messaging / groups / mentions / pairing / security / * auth / elevated / commands / streaming / threading / agentPrompt / * directory / resolver / actions / heartbeat) */ import { type SetupInput } from "./setup.js"; import type { ChannelAuthLoginParams, ChannelMessageActionContext, ChannelPollContext, ChannelPollResult, ChannelResolveTargetParams, ChannelStatusIssue, ChannelConfig, ChannelDirectoryListGroupMembersParams, ChannelDirectoryEntry, ChannelDirectoryListParams, ChannelDirectorySelfParams, ChannelGroupContext, ChannelHeartbeatRecipientsParams, ChannelThreadingContext, ChannelThreadingToolContext, ChannelToolSend, ChannelResolverParams, ChannelSecurityContext, ChannelSecurityDmPolicy, GatewayContext, HttpApiAccount, Logger, PluginRuntime } from "./types.js"; export declare function getAgentPromptMessageToolHints(): string[]; export declare function buildAgentPromptSystemContext(): string; export declare function buildAgentPromptAppendSystemContext(): string; export declare function setRuntime(rt: PluginRuntime, logger?: Logger): void; export declare const httpChannelPlugin: { id: string; meta: { id: string; label: string; selectionLabel: string; blurb: string; docsPath: string; order: number; aliases: string[]; }; capabilities: { chatTypes: readonly ["direct", "group"]; reactions: boolean; polls: boolean; edit: boolean; unsend: boolean; reply: boolean; effects: boolean; groupManagement: boolean; threads: boolean; media: boolean; nativeCommands: boolean; blockStreaming: boolean; }; defaults: { queue: { debounceMs: number; }; }; onboarding: { channel: string; getStatus: ({ cfg }: { cfg: ChannelConfig; }) => Promise<{ channel: string; configured: boolean; statusLines: string[]; selectionHint: string; quickstartScore: number; }>; configure: (ctx: { cfg: ChannelConfig; prompter?: unknown; input?: SetupInput; accountOverrides?: Record; forceAllowFrom?: boolean; }) => Promise<{ cfg: ChannelConfig; accountId: string; }>; configureInteractive: (ctx: { cfg: ChannelConfig; configured: boolean; prompter?: unknown; input?: SetupInput; accountOverrides?: Record; forceAllowFrom?: boolean; }) => Promise<{ cfg: ChannelConfig; accountId: string; } | "skip">; configureWhenConfigured: (ctx: { cfg: ChannelConfig; configured: boolean; prompter?: unknown; input?: SetupInput; accountOverrides?: Record; forceAllowFrom?: boolean; }) => Promise<{ cfg: ChannelConfig; accountId: string; } | "skip">; dmPolicy: { label: string; channel: string; policyKey: string; allowFromKey: string; getCurrent: (cfg: ChannelConfig) => "open" | "allowlist"; setPolicy: (cfg: ChannelConfig, policy: "open" | "allowlist") => ChannelConfig; promptAllowFrom: ({ cfg, prompter, accountId, }: { cfg: ChannelConfig; prompter?: unknown; accountId?: string; }) => Promise; }; disable: (cfg: ChannelConfig) => ChannelConfig; }; setup: { resolveAccountId: ({ cfg, accountId, input }: { cfg: ChannelConfig; accountId?: string; input?: SetupInput; }) => string; resolveBindingAccountId: ({ cfg, agentId, accountId }: { cfg: ChannelConfig; agentId: string; accountId?: string; }) => string | undefined; applyAccountName: ({ cfg, accountId, name }: { cfg: ChannelConfig; accountId: string; name?: string; }) => ChannelConfig; applyAccountConfig: ({ cfg, accountId, input }: { cfg: ChannelConfig; accountId: string; input: SetupInput; }) => ChannelConfig; validateInput: ({ accountId, input }: { cfg: ChannelConfig; accountId: string; input: SetupInput; }) => string | null; }; config: { listAccountIds: (cfg: ChannelConfig) => string[]; resolveAccount: (cfg: ChannelConfig, accountId?: string | null) => HttpApiAccount; defaultAccountId: (_cfg: ChannelConfig) => string; isConfigured: (account: HttpApiAccount) => boolean; describeAccount: (account: HttpApiAccount) => { accountId: string; name: string; enabled: boolean; configured: boolean; }; setAccountEnabled: ({ cfg, accountId, enabled }: { cfg: ChannelConfig; accountId: string; enabled: boolean; }) => { channels: { "openclaw-channel-xiaozhu": { accounts: { [x: string]: Record; }; }; }; } | { channels: { "openclaw-channel-xiaozhu": { enabled: boolean; }; }; }; deleteAccount: ({ cfg, accountId }: { cfg: ChannelConfig; accountId: string; }) => { channels: { [x: string]: Record; }; }; resolveAllowFrom: ({ cfg, accountId }: { cfg: ChannelConfig; accountId?: string | null; }) => string[] | undefined; formatAllowFrom: ({ allowFrom }: { cfg: ChannelConfig; accountId?: string | null; allowFrom: Array; }) => string[]; resolveDefaultTo: () => string | undefined; }; gateway: { startAccount: (ctx: GatewayContext) => Promise; stopAccount: (ctx: GatewayContext) => Promise; loginWithQrStart: ({ accountId }: { accountId?: string; }) => Promise<{ message: string; }>; loginWithQrWait: ({ accountId }: { accountId?: string; }) => Promise<{ connected: boolean; message: string; }>; logoutAccount: ({ accountId }: { accountId: string; }) => Promise<{ cleared: boolean; loggedOut: boolean; stopped: boolean; message: string; }>; }; outbound: { deliveryMode: "direct"; textChunkLimit: number; pollMaxOptions: number; chunker: (text: string, limit: number) => string[]; chunkerMode: "markdown"; resolveTarget: (params: ChannelResolveTargetParams) => { ok: true; to: string; } | { ok: false; error: Error; }; sendText: (opts: Record) => Promise<{ channel: string; ok: boolean; error: Error; } | { channel: string; ok: boolean; error?: undefined; }>; sendMedia: (opts: Record) => Promise<{ channel: string; ok: boolean; error: Error; } | { channel: string; ok: boolean; error?: undefined; }>; sendPayload: (ctx: Record) => Promise<{ channel: string; ok: boolean; error: Error; messageId?: undefined; } | { channel: string; ok: boolean; error: Error; messageId: string; } | { channel: string; ok: boolean; messageId: string; error?: undefined; }>; sendPoll: (ctx: ChannelPollContext) => Promise; }; status: { defaultRuntime: { accountId: string; running: boolean; connected: boolean; lastStartAt: null; lastStopAt: null; lastError: null; lastInboundAt: null; lastOutboundAt: null; }; probeAccount: ({ account, timeoutMs }: { account: HttpApiAccount; timeoutMs?: number; }) => Promise<{ ok: boolean; latencyMs: number; }>; buildAccountSnapshot: ({ account, runtime }: { account: HttpApiAccount; cfg: ChannelConfig; runtime?: Record; }) => { accountId: string; name: string; enabled: boolean; configured: boolean; running: boolean; connected: boolean; lastStartAt: number | null; lastStopAt: number | null; lastError: string | null; mode: "webhook" | "cloud"; lastInboundAt: number | null; lastOutboundAt: number | null; }; buildChannelSummary: ({ snapshot }: { account: HttpApiAccount; cfg: ChannelConfig; defaultAccountId: string; snapshot: Record; }) => { configured: boolean; running: boolean; connected: boolean; mode: string; lastStartAt: {} | null; lastStopAt: {} | null; lastError: {} | null; lastInboundAt: {} | null; lastOutboundAt: {} | null; }; resolveAccountState: ({ configured, enabled }: { account: HttpApiAccount; cfg: ChannelConfig; configured: boolean; enabled: boolean; }) => "enabled" | "disabled" | "not configured"; collectStatusIssues: (accounts: Array>) => ChannelStatusIssue[]; }; messaging: { normalizeTarget: (raw: string) => string | undefined; targetResolver: { looksLikeId: (raw: string, _normalized?: string) => boolean; hint: string; }; formatTargetDisplay: ({ target, display }: { target: string; display?: string; kind?: string; }) => string; }; resolver: { resolveTargets: ({ cfg, accountId, inputs, kind, runtime: _runtime, }: ChannelResolverParams) => Promise<({ input: string; resolved: boolean; note: string; id?: undefined; name?: undefined; } | { input: string; resolved: boolean; id: string; name: string; note: string; })[]>; }; groups: { resolveRequireMention: ({ cfg, accountId }: { cfg: ChannelConfig; accountId?: string | null; }) => boolean | undefined; resolveGroupIntroHint: ({ cfg, accountId }: { cfg: ChannelConfig; accountId?: string | null; }) => string | undefined; resolveToolPolicy: ({ cfg, accountId }: ChannelGroupContext) => { deny?: string[] | undefined; alsoAllow?: string[] | undefined; allow?: string[] | undefined; } | undefined; }; mentions: { stripPatterns: () => string[]; stripMentions: ({ text }: { text: string; }) => string; }; pairing: { idLabel: string; normalizeAllowEntry: (entry: string) => string; notifyApproval: () => Promise; }; execApprovals: { getInitiatingSurfaceState: ({ cfg, accountId }: { cfg: ChannelConfig; accountId?: string | null; }) => { kind: string; }; shouldSuppressLocalPrompt: ({ cfg, accountId, payload, }: { cfg: ChannelConfig; accountId?: string | null; payload: Record; }) => boolean; hasConfiguredDmRoute: ({ cfg }: { cfg: ChannelConfig; }) => boolean; shouldSuppressForwardingFallback: ({ cfg, target, }: { cfg: ChannelConfig; target: Record; request: Record; }) => boolean; buildPendingPayload: ({ cfg, request, target, nowMs, }: { cfg: ChannelConfig; request: Record; target: Record; nowMs: number; }) => Record | null; buildResolvedPayload: ({ cfg, resolved, target, }: { cfg: ChannelConfig; resolved: Record; target: Record; }) => Record | null; buildPluginPendingPayload: ({ cfg, request, target, nowMs, }: { cfg: ChannelConfig; request: Record; target: Record; nowMs: number; }) => Record | null; buildPluginResolvedPayload: ({ cfg, resolved, target, }: { cfg: ChannelConfig; resolved: Record; target: Record; }) => Record | null; }; security: { resolveDmPolicy: ({ cfg, accountId, account, }: ChannelSecurityContext) => ChannelSecurityDmPolicy; collectWarnings: ({ cfg, account }: ChannelSecurityContext) => string[]; }; elevated: { allowFromFallback: ({ cfg, accountId }: { cfg: ChannelConfig; accountId?: string | null; }) => string[] | undefined; }; auth: { login: ({ cfg, accountId, runtime, verbose, channelInput, }: ChannelAuthLoginParams) => Promise; }; commands: { enforceOwnerForCommands: boolean; skipWhenConfigEmpty: boolean; }; streaming: { blockStreamingCoalesceDefaults: { minChars: number; idleMs: number; }; }; threading: { resolveReplyToMode: ({ cfg, accountId }: { cfg: ChannelConfig; accountId?: string | null; chatType?: string | null; }) => "off" | "first" | "all"; allowExplicitReplyTagsWhenOff: boolean; allowTagsWhenOff: boolean; buildToolContext: ({ cfg, accountId, context, hasRepliedRef, }: { cfg: ChannelConfig; accountId?: string | null; context: ChannelThreadingContext; hasRepliedRef?: { value: boolean; }; }) => ChannelThreadingToolContext; }; agentPrompt: { messageToolHints: () => string[]; }; agentTools: ({ cfg }: { cfg?: ChannelConfig; }) => { label: string; name: string; ownerOnly: boolean; description: string; parameters: { type: string; properties: { action: { type: string; enum: string[]; }; accountId: { type: string; }; input: { type: string; }; inputs: { type: string; items: { type: string; }; }; clientId: { type: string; }; clientSecret: { type: string; }; verbose: { type: string; }; limit: { type: string; minimum: number; maximum: number; }; }; required: string[]; additionalProperties: boolean; }; execute: (_toolCallId: string, rawArgs: unknown) => Promise<{ content: Array<{ type: "text"; text: string; }>; details: unknown; }>; }[]; directory: { self: ({ accountId }: ChannelDirectorySelfParams) => Promise; listPeers: ({ accountId, query, limit }: ChannelDirectoryListParams) => Promise; listPeersLive: (params: ChannelDirectoryListParams) => Promise; listGroups: ({ accountId, query, limit }: ChannelDirectoryListParams) => Promise; listGroupsLive: (params: ChannelDirectoryListParams) => Promise; listGroupMembers: (params: ChannelDirectoryListGroupMembersParams) => Promise; }; actions: { describeMessageTool: () => { actions: ("send" | "upload-file" | "read" | "edit" | "react" | "reactions" | "pin" | "unpin" | "pins" | "search" | "delete" | "poll" | "permissions" | "reply" | "forward")[]; }; listActions: () => string[]; supportsAction: ({ action }: { action: string; }) => boolean; supportsButtons: () => boolean; supportsCards: () => boolean; extractToolSend: ({ args }: { args: Record; }) => ChannelToolSend | null; handleAction: (ctx: ChannelMessageActionContext) => Promise<{ content: Array<{ type: "text"; text: string; }>; details: Record; isError?: boolean; }>; }; heartbeat: { checkReady: ({ cfg, accountId }: { cfg: ChannelConfig; accountId?: string | null; }) => Promise<{ ok: boolean; reason: string; }>; resolveRecipients: ({ cfg, opts }: ChannelHeartbeatRecipientsParams) => { recipients: string[]; source: string; }; }; }; //# sourceMappingURL=channel.d.ts.map