-
Notifications
You must be signed in to change notification settings - Fork 0
API Reference
All exports are available from the main entry point:
import { ... } from 'agentic-rss-parser';Returns a ParserCompat instance — drop-in replacement for rss-parser.
createParser(options?: ParserOptions): ParserParserOptions
| Field | Type | Default | Description |
|---|---|---|---|
normalize |
boolean |
true |
Normalize field names |
customFields.feed |
Array |
[] |
Extra feed-level fields to extract |
customFields.item |
Array |
[] |
Extra item-level fields to extract |
headers |
Record<string,string> |
— | Extra HTTP request headers |
timeout |
number |
10000 |
HTTP timeout in ms |
maxRedirects |
number |
5 |
Max HTTP redirects to follow |
Full agentic pipeline — fetch, parse, deduplicate, analyse.
parseFeed(urls: string | string[], config?: ParseFeedConfig): Promise<FeedResultsArray>ParseFeedConfig
| Field | Type | Default | Description |
|---|---|---|---|
dbPath |
string |
cwd/data/rss-agent.db |
SQLite DB path |
storage |
StorageAdapter |
— | Custom adapter (overrides dbPath) |
fetchFullArticle |
boolean |
false |
Fetch + strip full article HTML |
concurrency |
number |
1 |
Max parallel feed fetches (max 16) |
maxItems |
number |
— | Stop after N items are stored |
analyzer |
Function |
— | Custom analyzer ({ item, context }) => AnalysisResult
|
model |
AnalyzerConfig |
— | Provider config for built-in LLM adapters |
Returns FeedResultsArray — an Array<{ item, analysis }> with an extra .feedErrors property.
Fetch a URL and return a raw parsed feed object (no analysis). Supports callback style.
Parse raw XML string into a feed object. Synchronous internally.
Read a local file and parse as feed XML.
Low-level pipeline. Returns { results, feedErrors } directly.
runAgenticParser(config: AgenticParserConfig): Promise<AgenticParserResult>AgenticParserConfig
| Field | Type | Required | Description |
|---|---|---|---|
feedUrls |
string[] |
✅ | Feed URLs to process |
dbPath |
string |
✅ (or storage) |
SQLite DB path |
storage |
StorageAdapter |
— | Custom adapter (overrides dbPath) |
fetchFullArticle |
boolean |
— | Fetch full article body |
concurrency |
number |
— | Max parallel feed fetches |
maxItems |
number |
— | Stop after N items stored |
parserOptions |
ParserOptions |
— | Options forwarded to XML parser |
analyzer |
Function |
— | Custom analyzer function |
model |
AnalyzerConfig |
— | Built-in provider config |
Returns
{
results: Array<{ item: NormalizedItem, analysis: AnalysisResult }>,
feedErrors: Array<{ feedUrl: string, error: string }>
}Analyse a single feed item. Used internally but exported for custom pipelines.
analyzeFeedItem(item, options?: {
fetchFullArticle?: boolean;
analyzer?: Function;
signals?: string[];
extraSignals?: string[];
threshold?: number;
}): Promise<AnalysisResult>Synchronous heuristic scorer. No LLM, no async.
heuristicAnalyze(item, context?: string, options?: {
signals?: string[];
extraSignals?: string[];
threshold?: number; // default: 3
}): AnalysisResultCreate a SQLite-backed StorageAdapter. Requires Node ≥ 22.5.0.
createStorage(dbPath: string): StorageAdapterCreate an in-memory StorageAdapter. Data is lost when the process exits. Works on any Node version.
createMemoryStorage(): StorageAdapterBuild an analyzer function for use in runAgenticParser({ analyzer }).
createAnalyzer(config?: AnalyzerConfig): Promise<AnalyzerFn>AnalyzerConfig
| Field | Type | Default | Description |
|---|---|---|---|
provider |
'heuristic'|'openai'|'anthropic'|'local' |
'heuristic' |
Analysis backend |
model |
string |
provider default | Model ID string |
apiKey |
string |
— | API key (required for openai/anthropic) |
baseURL |
string |
— | Override endpoint URL |
signals |
string[] |
— | Replace default heuristic signals |
extraSignals |
string[] |
— | Append to default signals |
threshold |
number |
3 |
Min signal matches to mark relevant |
Fetch a URL and return its plain-text content (HTML stripped).
fetchFullArticle(url: string): Promise<string>Resolve the effective signal list given signals / extraSignals options.
resolveSignals(options?: { signals?: string[]; extraSignals?: string[] }): string[]The built-in signal array used by the heuristic provider:
['release', 'security', 'vulnerability', 'node', 'javascript', 'typescript',
'framework', 'api', 'breaking', 'performance', 'agent', 'rss']{
decision: 'relevant' | 'ignore';
confidence: number; // 0–100
summary: string;
impact: string;
actionItems: string[];
tags: string[]; // matched signals or LLM-assigned tags
}