registry = $registry; } /** * Build the full context string from sanitized mentions. * * @param array $sanitized_mentions Sanitized mention list. * @return string Context string to prepend to the user message, or '' if nothing resolved. */ public function build( array $sanitized_mentions ): string { $resolved = $this->registry->resolve_all( $sanitized_mentions ); if ( empty( $resolved ) ) { return ''; } $preamble = 'The user has mentioned the following items. Use this context to answer their question accurately:'; $context = $preamble . "\n\n" . $resolved; return apply_filters( 'aisentic_mention_context', $context, $sanitized_mentions ); } }