* Process items through the standard pipeline: filter by allowed, filter blocked, sanitize, dedupe, limit * @param {any[]} rawItems - Raw items array from agent output * @param {string[]|undefined} allowed - Allowed items list * @param {number} maxCount - Maximum number of items * @param {string
(rawItems, allowed, maxCount, blocked = undefined)
| 292 | * @returns {string[]} Processed items |
| 293 | */ |
| 294 | function processItems(rawItems, allowed, maxCount, blocked = undefined) { |
| 295 | // Filter by allowed list first |
| 296 | const filtered = filterByAllowed(rawItems, allowed); |
| 297 | |
| 298 | // Filter out blocked items |
| 299 | const notBlocked = filterByBlocked(filtered, blocked); |
| 300 | |
| 301 | // Sanitize and deduplicate |
| 302 | const sanitized = sanitizeItems(notBlocked); |
| 303 | |
| 304 | // Limit to max count |
| 305 | return limitToMaxCount(sanitized, maxCount); |
| 306 | } |
| 307 | |
| 308 | module.exports = { |
| 309 | processSafeOutput, |
no test coverage detected