Component evidence

buildTriggerPattern (config.ts)

openbrowserclaw · src/config.ts · typescript · MIT
aiautomationtag:regex-patterntag:mention-detectiontag:agent-trigger

Builds a case-insensitive regex pattern matching @mentions of a name for triggering agent invocation.

Source preview first 800 characters · full source over MCP
// Source: https://github.com/wexare-ai/openbrowserclaw | License: MIT | Copyright 2026 Sacha Arbonel
// Provided via justclaw.it.com; keep this notice with the code.
// ---------------------------------------------------------------------------
// 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 recen

... (truncated -- full source via MCP)