35 lines
1.0 KiB
TypeScript
35 lines
1.0 KiB
TypeScript
|
|
import type { OpenClawConfig } from "../../../src/config/config.js";
|
||
|
|
import {
|
||
|
|
resolveReactionLevel,
|
||
|
|
type ReactionLevel,
|
||
|
|
type ResolvedReactionLevel,
|
||
|
|
} from "../../../src/utils/reaction-level.js";
|
||
|
|
import { resolveSignalAccount } from "./accounts.js";
|
||
|
|
|
||
|
|
export type SignalReactionLevel = ReactionLevel;
|
||
|
|
export type ResolvedSignalReactionLevel = ResolvedReactionLevel;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Resolve the effective reaction level and its implications for Signal.
|
||
|
|
*
|
||
|
|
* Levels:
|
||
|
|
* - "off": No reactions at all
|
||
|
|
* - "ack": Only automatic ack reactions (👀 when processing), no agent reactions
|
||
|
|
* - "minimal": Agent can react, but sparingly (default)
|
||
|
|
* - "extensive": Agent can react liberally
|
||
|
|
*/
|
||
|
|
export function resolveSignalReactionLevel(params: {
|
||
|
|
cfg: OpenClawConfig;
|
||
|
|
accountId?: string;
|
||
|
|
}): ResolvedSignalReactionLevel {
|
||
|
|
const account = resolveSignalAccount({
|
||
|
|
cfg: params.cfg,
|
||
|
|
accountId: params.accountId,
|
||
|
|
});
|
||
|
|
return resolveReactionLevel({
|
||
|
|
value: account.config.reactionLevel,
|
||
|
|
defaultLevel: "minimal",
|
||
|
|
invalidFallback: "minimal",
|
||
|
|
});
|
||
|
|
}
|