mirror of
https://github.com/kennethnym/aris.git
synced 2026-03-20 00:51:20 +00:00
Post-processors can now return a boost map (item ID -> score) to promote or demote items in the feed ordering. Scores from multiple processors are summed and clamped to [-1, 1]. Co-authored-by: Ona <no-reply@ona.com>
26 lines
784 B
TypeScript
26 lines
784 B
TypeScript
import type { FeedItem } from "./feed"
|
|
|
|
export interface ItemGroup {
|
|
/** IDs of items to present together */
|
|
itemIds: string[]
|
|
/** Summary text for the group */
|
|
summary: string
|
|
}
|
|
|
|
export interface FeedEnhancement {
|
|
/** New items to inject into the feed */
|
|
additionalItems?: FeedItem[]
|
|
/** Groups of items to present together with a summary */
|
|
groupedItems?: ItemGroup[]
|
|
/** Item IDs to remove from the feed */
|
|
suppress?: string[]
|
|
/** Map of item ID to boost score (-1 to 1). Positive promotes, negative demotes. */
|
|
boost?: Record<string, number>
|
|
}
|
|
|
|
/**
|
|
* A function that transforms feed items and produces enhancement directives.
|
|
* Use named functions for meaningful error attribution.
|
|
*/
|
|
export type FeedPostProcessor = (items: FeedItem[]) => Promise<FeedEnhancement>
|