Files
openclaw/src/config/types.channels.ts
Peter Steinberger 77f1359612 refactor: extract media and ACP core packages (#88534)
* refactor: extract media and acp core packages

* refactor: remove relocated media and acp sources

* build: wire new core packages into dependency checks

* test: alias new core packages in vitest

* build: keep media sniffer runtime dependency

* docs: refresh plugin sdk api baseline

* fix: keep normalized proposal queries non-empty

* test: keep channel timer tests isolated

* fix: keep rebased plugin checks green

* fix: preserve sms numeric allowlist entries

* test: harden exec foreground timeout failure

* test: remove duplicate skill workshop assertion

* fix: remove channel config lint suppression

* test: refresh lint suppression allowlist
2026-05-31 11:30:33 +01:00

110 lines
4.0 KiB
TypeScript

import type { ContextVisibilityMode, GroupPolicy } from "./types.base.js";
import type { ChannelBotLoopProtectionConfig } from "./types.bot-loop-protection.js";
import type {
ChannelHealthMonitorConfig,
ChannelHeartbeatVisibilityConfig,
} from "./types.channel-health.js";
import type { DiscordConfig } from "./types.discord.js";
import type { GoogleChatConfig } from "./types.googlechat.js";
import type { IMessageConfig } from "./types.imessage.js";
import type { IrcConfig } from "./types.irc.js";
import type { MentionPatternsPolicyConfig } from "./types.messages.js";
import type { MSTeamsConfig } from "./types.msteams.js";
import type { SignalConfig } from "./types.signal.js";
import type { SlackConfig } from "./types.slack.js";
import type { TelegramConfig } from "./types.telegram.js";
import type { WhatsAppConfig } from "./types.whatsapp.js";
export type {
ChannelHealthMonitorConfig,
ChannelHeartbeatVisibilityConfig,
} from "./types.channel-health.js";
export type { ChannelBotLoopProtectionConfig } from "./types.bot-loop-protection.js";
export type ChannelDefaultsConfig = {
groupPolicy?: GroupPolicy;
contextVisibility?: ContextVisibilityMode;
/** Default heartbeat visibility for all channels. */
heartbeat?: ChannelHeartbeatVisibilityConfig;
/** Default pair loop guard settings for channels that support bot loop protection. */
botLoopProtection?: ChannelBotLoopProtectionConfig;
};
export type ChannelModelByChannelConfig = Record<string, Record<string, string>>;
export type ExtensionNestedPolicyConfig = {
policy?: string;
allowFrom?: Array<string | number> | ReadonlyArray<string | number>;
[key: string]: unknown;
};
export type ExtensionAccountConfig = ExtensionNestedPolicyConfig & {
defaultTo?: string | number;
dmPolicy?: string;
dm?: ExtensionNestedPolicyConfig;
mediaMaxMb?: number;
configWrites?: boolean;
};
type OpenWorldChannelConfig = ReturnType<typeof JSON.parse>;
/**
* Base type for extension channel config sections.
* Extensions can use this as a starting point for their channel config.
*/
export type ExtensionChannelConfig = {
enabled?: boolean;
allowFrom?: Array<string | number> | ReadonlyArray<string | number>;
/** Default delivery target for CLI --deliver when no explicit --reply-to is provided. */
defaultTo?: string | number;
/** Optional default account id when multiple accounts are configured. */
defaultAccount?: string;
dmPolicy?: string;
groupPolicy?: GroupPolicy;
mentionPatterns?: MentionPatternsPolicyConfig | string[];
contextVisibility?: ContextVisibilityMode;
healthMonitor?: ChannelHealthMonitorConfig;
dm?: ExtensionNestedPolicyConfig;
network?: Record<string, unknown>;
groups?: Record<string, unknown>;
rooms?: Record<string, unknown>;
mediaMaxMb?: number;
callbackBaseUrl?: string;
interactions?: { callbackBaseUrl?: string; [key: string]: unknown };
execApprovals?: Record<string, unknown>;
threadBindings?: {
enabled?: boolean;
spawnSessions?: boolean;
defaultSpawnContext?: "isolated" | "fork";
/** @deprecated Use spawnSessions instead. */
spawnAcpSessions?: boolean;
/** @deprecated Use spawnSessions instead. */
spawnSubagentSessions?: boolean;
};
botLoopProtection?: ChannelBotLoopProtectionConfig;
spawnSubagentSessions?: boolean;
dangerouslyAllowPrivateNetwork?: boolean;
accounts?: Record<string, ExtensionAccountConfig>;
[key: string]: unknown;
};
export interface ChannelsConfig {
defaults?: ChannelDefaultsConfig;
/** Map provider -> channel id -> model override. */
modelByChannel?: ChannelModelByChannelConfig;
discord?: DiscordConfig;
googlechat?: GoogleChatConfig;
imessage?: IMessageConfig;
irc?: IrcConfig;
msteams?: MSTeamsConfig;
signal?: SignalConfig;
slack?: SlackConfig;
telegram?: TelegramConfig;
whatsapp?: WhatsAppConfig;
/**
* Channel sections are plugin-owned and keyed by arbitrary channel ids.
* Open-world config keeps SDK/plugin-owned sections ergonomic for dynamic ids.
*/
[key: string]: OpenWorldChannelConfig;
}