2026-01-17 06:48:34 +00:00
|
|
|
|
import type { NormalizedChatType } from "../channels/chat-type.js";
|
|
|
|
|
|
|
2026-01-14 01:08:15 +00:00
|
|
|
|
export type ReplyMode = "text" | "command";
|
|
|
|
|
|
export type TypingMode = "never" | "instant" | "thinking" | "message";
|
|
|
|
|
|
export type SessionScope = "per-sender" | "global";
|
2026-01-15 10:57:00 +00:00
|
|
|
|
export type DmScope = "main" | "per-peer" | "per-channel-peer";
|
2026-01-14 01:08:15 +00:00
|
|
|
|
export type ReplyToMode = "off" | "first" | "all";
|
|
|
|
|
|
export type GroupPolicy = "open" | "disabled" | "allowlist";
|
|
|
|
|
|
export type DmPolicy = "pairing" | "allowlist" | "open" | "disabled";
|
|
|
|
|
|
|
|
|
|
|
|
export type OutboundRetryConfig = {
|
|
|
|
|
|
/** Max retry attempts for outbound requests (default: 3). */
|
|
|
|
|
|
attempts?: number;
|
|
|
|
|
|
/** Minimum retry delay in ms (default: 300-500ms depending on provider). */
|
|
|
|
|
|
minDelayMs?: number;
|
|
|
|
|
|
/** Maximum retry delay cap in ms (default: 30000). */
|
|
|
|
|
|
maxDelayMs?: number;
|
|
|
|
|
|
/** Jitter factor (0-1) applied to delays (default: 0.1). */
|
|
|
|
|
|
jitter?: number;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
export type BlockStreamingCoalesceConfig = {
|
|
|
|
|
|
minChars?: number;
|
|
|
|
|
|
maxChars?: number;
|
|
|
|
|
|
idleMs?: number;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
export type BlockStreamingChunkConfig = {
|
|
|
|
|
|
minChars?: number;
|
|
|
|
|
|
maxChars?: number;
|
|
|
|
|
|
breakPreference?: "paragraph" | "newline" | "sentence";
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
export type HumanDelayConfig = {
|
|
|
|
|
|
/** Delay style for block replies (off|natural|custom). */
|
|
|
|
|
|
mode?: "off" | "natural" | "custom";
|
|
|
|
|
|
/** Minimum delay in milliseconds (default: 800). */
|
|
|
|
|
|
minMs?: number;
|
|
|
|
|
|
/** Maximum delay in milliseconds (default: 2500). */
|
|
|
|
|
|
maxMs?: number;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
export type SessionSendPolicyAction = "allow" | "deny";
|
|
|
|
|
|
export type SessionSendPolicyMatch = {
|
|
|
|
|
|
channel?: string;
|
2026-01-17 06:48:34 +00:00
|
|
|
|
chatType?: NormalizedChatType;
|
2026-01-14 01:08:15 +00:00
|
|
|
|
keyPrefix?: string;
|
|
|
|
|
|
};
|
|
|
|
|
|
export type SessionSendPolicyRule = {
|
|
|
|
|
|
action: SessionSendPolicyAction;
|
|
|
|
|
|
match?: SessionSendPolicyMatch;
|
|
|
|
|
|
};
|
|
|
|
|
|
export type SessionSendPolicyConfig = {
|
|
|
|
|
|
default?: SessionSendPolicyAction;
|
|
|
|
|
|
rules?: SessionSendPolicyRule[];
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2026-01-18 06:37:30 +00:00
|
|
|
|
export type SessionResetMode = "daily" | "idle";
|
|
|
|
|
|
export type SessionResetConfig = {
|
|
|
|
|
|
mode?: SessionResetMode;
|
|
|
|
|
|
/** Local hour (0-23) for the daily reset boundary. */
|
|
|
|
|
|
atHour?: number;
|
|
|
|
|
|
/** Sliding idle window (minutes). When set with daily mode, whichever expires first wins. */
|
|
|
|
|
|
idleMinutes?: number;
|
|
|
|
|
|
};
|
|
|
|
|
|
export type SessionResetByTypeConfig = {
|
|
|
|
|
|
dm?: SessionResetConfig;
|
|
|
|
|
|
group?: SessionResetConfig;
|
|
|
|
|
|
thread?: SessionResetConfig;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2026-01-14 01:08:15 +00:00
|
|
|
|
export type SessionConfig = {
|
|
|
|
|
|
scope?: SessionScope;
|
2026-01-15 10:57:00 +00:00
|
|
|
|
/** DM session scoping (default: "main"). */
|
|
|
|
|
|
dmScope?: DmScope;
|
2026-01-16 14:23:22 -06:00
|
|
|
|
/** Map platform-prefixed identities (e.g. "telegram:123") to canonical DM peers. */
|
|
|
|
|
|
identityLinks?: Record<string, string[]>;
|
2026-01-14 01:08:15 +00:00
|
|
|
|
resetTriggers?: string[];
|
|
|
|
|
|
idleMinutes?: number;
|
|
|
|
|
|
heartbeatIdleMinutes?: number;
|
2026-01-18 06:37:30 +00:00
|
|
|
|
reset?: SessionResetConfig;
|
|
|
|
|
|
resetByType?: SessionResetByTypeConfig;
|
2026-01-14 01:08:15 +00:00
|
|
|
|
store?: string;
|
|
|
|
|
|
typingIntervalSeconds?: number;
|
|
|
|
|
|
typingMode?: TypingMode;
|
|
|
|
|
|
mainKey?: string;
|
|
|
|
|
|
sendPolicy?: SessionSendPolicyConfig;
|
|
|
|
|
|
agentToAgent?: {
|
|
|
|
|
|
/** Max ping-pong turns between requester/target (0–5). Default: 5. */
|
|
|
|
|
|
maxPingPongTurns?: number;
|
|
|
|
|
|
};
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
export type LoggingConfig = {
|
|
|
|
|
|
level?: "silent" | "fatal" | "error" | "warn" | "info" | "debug" | "trace";
|
|
|
|
|
|
file?: string;
|
2026-01-14 14:31:43 +00:00
|
|
|
|
consoleLevel?: "silent" | "fatal" | "error" | "warn" | "info" | "debug" | "trace";
|
2026-01-14 01:08:15 +00:00
|
|
|
|
consoleStyle?: "pretty" | "compact" | "json";
|
|
|
|
|
|
/** Redact sensitive tokens in tool summaries. Default: "tools". */
|
|
|
|
|
|
redactSensitive?: "off" | "tools";
|
|
|
|
|
|
/** Regex patterns used to redact sensitive tokens (defaults apply when unset). */
|
|
|
|
|
|
redactPatterns?: string[];
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2026-01-20 18:56:10 +00:00
|
|
|
|
export type DiagnosticsOtelConfig = {
|
|
|
|
|
|
enabled?: boolean;
|
|
|
|
|
|
endpoint?: string;
|
|
|
|
|
|
protocol?: "http/protobuf" | "grpc";
|
|
|
|
|
|
headers?: Record<string, string>;
|
|
|
|
|
|
serviceName?: string;
|
|
|
|
|
|
traces?: boolean;
|
|
|
|
|
|
metrics?: boolean;
|
|
|
|
|
|
logs?: boolean;
|
|
|
|
|
|
/** Trace sample rate (0.0 - 1.0). */
|
|
|
|
|
|
sampleRate?: number;
|
|
|
|
|
|
/** Metric export interval (ms). */
|
|
|
|
|
|
flushIntervalMs?: number;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
export type DiagnosticsConfig = {
|
|
|
|
|
|
enabled?: boolean;
|
|
|
|
|
|
otel?: DiagnosticsOtelConfig;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2026-01-14 01:08:15 +00:00
|
|
|
|
export type WebReconnectConfig = {
|
|
|
|
|
|
initialMs?: number;
|
|
|
|
|
|
maxMs?: number;
|
|
|
|
|
|
factor?: number;
|
|
|
|
|
|
jitter?: number;
|
|
|
|
|
|
maxAttempts?: number; // 0 = unlimited
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
export type WebConfig = {
|
|
|
|
|
|
/** If false, do not start the WhatsApp web provider. Default: true. */
|
|
|
|
|
|
enabled?: boolean;
|
|
|
|
|
|
heartbeatSeconds?: number;
|
|
|
|
|
|
reconnect?: WebReconnectConfig;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// Provider docking: allowlists keyed by provider id (and internal "webchat").
|
2026-01-14 14:31:43 +00:00
|
|
|
|
export type AgentElevatedAllowFromConfig = Partial<Record<string, Array<string | number>>>;
|
2026-01-14 01:08:15 +00:00
|
|
|
|
|
|
|
|
|
|
export type IdentityConfig = {
|
|
|
|
|
|
name?: string;
|
|
|
|
|
|
theme?: string;
|
|
|
|
|
|
emoji?: string;
|
|
|
|
|
|
};
|