Builds a case-insensitive regex pattern matching @mentions of a name for triggering agent invocation.
// ---------------------------------------------------------------------------
// OpenBrowserClaw — Configuration constants
// ---------------------------------------------------------------------------
/** Default assistant name (used in trigger pattern) */
export const ASSISTANT_NAME = 'Andy';
/** Trigger pattern — messages must match this to invoke the agent */
export function buildTriggerPattern(name: string): RegExp {
const escaped = name.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
return new RegExp(`(^|\\s)@${escaped}\\b`, 'i');
}
export const TRIGGER_PATTERN = buildTriggerPattern(ASSISTANT_NAME);
/** How many recent messages to include in agent context */
export const CONTEXT_WINDOW_SIZE = 50;
/** Max tokens for Claude API response */
export const DEFAULT_MAX_TOKENS = 8096;
/*
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search 40K more like it.
Get a free API key