userRequestCandidatesBlock function

String? userRequestCandidatesBlock(
  1. List<Message> messages, {
  2. List<String?>? recordIds,
})

Renders the USER REQUEST CANDIDATES block appended to the summarizer input (after the conversation, before <previous-checkpoint>), or null when there are no candidates — the section is then the LLM's to fill with "(none)".

Implementation

String? userRequestCandidatesBlock(
  List<Message> messages, {
  List<String?>? recordIds,
}) {
  final lines = userRequestCandidateLines(messages, recordIds: recordIds);
  if (lines.isEmpty) return null;
  final header =
      'USER REQUEST CANDIDATES (every user-role message, oldest first — '
      'you judge which are open asks; fill `## Open User Requests` from '
      'these):';
  final buffer = StringBuffer(header);
  for (final line in lines) {
    buffer
      ..writeln()
      ..write(line);
  }
  return buffer.toString();
}