mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-12 05:20:43 +00:00
Adds native iMessage private-API message actions, lightweight message-tool discovery, bridge capability cache sharing, execution-time action gates, target alias coverage, and regression tests.
132 lines
5.1 KiB
TypeScript
132 lines
5.1 KiB
TypeScript
import type {
|
|
BlockStreamingCoalesceConfig,
|
|
ContextVisibilityMode,
|
|
DmPolicy,
|
|
GroupPolicy,
|
|
MarkdownConfig,
|
|
} from "./types.base.js";
|
|
import type {
|
|
ChannelHealthMonitorConfig,
|
|
ChannelHeartbeatVisibilityConfig,
|
|
} from "./types.channels.js";
|
|
import type { DmConfig } from "./types.messages.js";
|
|
import type { GroupToolPolicyBySenderConfig, GroupToolPolicyConfig } from "./types.tools.js";
|
|
|
|
export type IMessageActionConfig = {
|
|
reactions?: boolean;
|
|
edit?: boolean;
|
|
unsend?: boolean;
|
|
reply?: boolean;
|
|
sendWithEffect?: boolean;
|
|
renameGroup?: boolean;
|
|
setGroupIcon?: boolean;
|
|
addParticipant?: boolean;
|
|
removeParticipant?: boolean;
|
|
leaveGroup?: boolean;
|
|
sendAttachment?: boolean;
|
|
};
|
|
|
|
export type IMessageAccountConfig = {
|
|
/** Optional display name for this account (used in CLI/UI lists). */
|
|
name?: string;
|
|
/** Optional provider capability tags used for agent/runtime guidance. */
|
|
capabilities?: string[];
|
|
/** Markdown formatting overrides (tables). */
|
|
markdown?: MarkdownConfig;
|
|
/** Allow channel-initiated config writes (default: true). */
|
|
configWrites?: boolean;
|
|
/** If false, do not start this iMessage account. Default: true. */
|
|
enabled?: boolean;
|
|
/** imsg CLI binary path (default: imsg). */
|
|
cliPath?: string;
|
|
/** Optional Messages db path override. */
|
|
dbPath?: string;
|
|
/** Remote SSH host token for SCP attachment fetches (`host` or `user@host`). */
|
|
remoteHost?: string;
|
|
/** Enable or disable private API message actions. */
|
|
actions?: IMessageActionConfig;
|
|
/** Optional default send service (imessage|sms|auto). */
|
|
service?: "imessage" | "sms" | "auto";
|
|
/** Optional default region (used when sending SMS). */
|
|
region?: string;
|
|
/** Direct message access policy (default: pairing). */
|
|
dmPolicy?: DmPolicy;
|
|
/** Optional allowlist for inbound handles or chat_id targets. */
|
|
allowFrom?: Array<string | number>;
|
|
/** Default delivery target for CLI --deliver when no explicit --reply-to is provided. */
|
|
defaultTo?: string;
|
|
/** Optional allowlist for group senders or chat_id targets. */
|
|
groupAllowFrom?: Array<string | number>;
|
|
/**
|
|
* Controls how group messages are handled:
|
|
* - "open": groups bypass allowFrom; mention-gating applies
|
|
* - "disabled": block all group messages entirely
|
|
* - "allowlist": only allow group messages from senders in groupAllowFrom/allowFrom
|
|
*/
|
|
groupPolicy?: GroupPolicy;
|
|
/** Supplemental context visibility policy (all|allowlist|allowlist_quote). */
|
|
contextVisibility?: ContextVisibilityMode;
|
|
/** Max group messages to keep as history context (0 disables). */
|
|
historyLimit?: number;
|
|
/** Max DM turns to keep as history context. */
|
|
dmHistoryLimit?: number;
|
|
/** Per-DM config overrides keyed by user ID. */
|
|
dms?: Record<string, DmConfig>;
|
|
/** Include attachments + reactions in watch payloads. */
|
|
includeAttachments?: boolean;
|
|
/** Allowed local iMessage attachment roots (supports single-segment `*` wildcards). */
|
|
attachmentRoots?: string[];
|
|
/** Allowed remote iMessage attachment roots for SCP fetches (supports `*`). */
|
|
remoteAttachmentRoots?: string[];
|
|
/** Max outbound media size in MB. */
|
|
mediaMaxMb?: number;
|
|
/** Timeout for probe/RPC operations in milliseconds (default: 10000). */
|
|
probeTimeoutMs?: number;
|
|
/** Outbound text chunk size (chars). Default: 4000. */
|
|
textChunkLimit?: number;
|
|
/** Chunking mode: "length" (default) splits by size; "newline" splits on every newline. */
|
|
chunkMode?: "length" | "newline";
|
|
blockStreaming?: boolean;
|
|
/** Merge streamed block replies before sending. */
|
|
blockStreamingCoalesce?: BlockStreamingCoalesceConfig;
|
|
/** When private API is available, mark inbound chats read before dispatch (default: true). */
|
|
sendReadReceipts?: boolean;
|
|
/**
|
|
* Merge consecutive same-sender DM rows from `chat.db` into a single agent
|
|
* turn. Mirrors `channels.bluebubbles.coalesceSameSenderDms` so Apple's
|
|
* split-send (`<command> <URL>` arriving as two separate rows ~0.8-2.0 s
|
|
* apart) lands as one merged message. DM-only — group chats keep instant
|
|
* per-message dispatch. Widens the default inbound debounce window to
|
|
* 2500 ms when enabled without an explicit
|
|
* `messages.inbound.byChannel.imessage`. Default: `false`.
|
|
*/
|
|
coalesceSameSenderDms?: boolean;
|
|
groups?: Record<
|
|
string,
|
|
{
|
|
requireMention?: boolean;
|
|
tools?: GroupToolPolicyConfig;
|
|
toolsBySender?: GroupToolPolicyBySenderConfig;
|
|
}
|
|
>;
|
|
/** Heartbeat visibility settings for this channel. */
|
|
heartbeat?: ChannelHeartbeatVisibilityConfig;
|
|
/** Channel health monitor overrides for this channel/account. */
|
|
healthMonitor?: ChannelHealthMonitorConfig;
|
|
/** Outbound response prefix override for this channel/account. */
|
|
responsePrefix?: string;
|
|
};
|
|
|
|
export type IMessageConfig = {
|
|
/** Optional per-account iMessage configuration (multi-account). */
|
|
accounts?: Record<string, IMessageAccountConfig>;
|
|
/** Optional default account id when multiple accounts are configured. */
|
|
defaultAccount?: string;
|
|
} & IMessageAccountConfig;
|
|
|
|
declare module "./types.channels.js" {
|
|
interface ChannelsConfig {
|
|
imessage?: IMessageConfig;
|
|
}
|
|
}
|