Methods
(async) addRecentArticle(article)
Add recent article to tracking
Parameters:
| Name | Type | Description |
|---|---|---|
article |
Object | Article metadata |
(async) cacheMCPQuery(queryKey, result, ttl)
Cache MCP query result
Parameters:
| Name | Type | Description |
|---|---|---|
queryKey |
string | Unique identifier for the query |
result |
any | Query result to cache |
ttl |
number | Time to live in seconds (default: 2 hours) |
calculateSimilarity() → {number}
Calculate similarity between two articles
Uses weighted combination of:
- Title similarity (50%)
- Topic overlap (30%)
- MCP query overlap (20%)
Returns:
Similarity score 0.0-1.0
- Type
- number
(async) checkDuplicateArticle(title, topics, mcpQueries) → {Object}
Check if article is duplicate based on similarity
Parameters:
| Name | Type | Description |
|---|---|---|
title |
string | Article title |
topics |
Array.<string> | Article topics |
mcpQueries |
Array.<string> | MCP query keys used for this article |
Returns:
{ isDuplicate: boolean, matchedArticle: Object|null, similarityScore: number }
- Type
- Object
cleanupExpiredEntries()
Clean up expired cache entries and old articles
getCachedMCPQuery(queryKey) → {any|null}
Get cached MCP query result
Parameters:
| Name | Type | Description |
|---|---|---|
queryKey |
string | Unique identifier for the query |
Returns:
Cached result or null if expired/missing
- Type
- any | null
getRecentArticles(hours) → {Array}
Get recent articles from last N hours
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
hours |
number | 6 | Hours to look back |
Returns:
Recent articles
- Type
- Array
getWorkflowStatistics() → {Object}
Get workflow statistics
Returns:
Statistics by workflow
- Type
- Object
hashObject(obj) → {string}
Hash object for cache comparison
Parameters:
| Name | Type | Description |
|---|---|---|
obj |
any | Object to hash |
Returns:
SHA-256 hash
- Type
- string
(async) load()
Load state from disk
(async) recordWorkflowExecution(workflowName, metadata)
Record workflow execution
Parameters:
| Name | Type | Description |
|---|---|---|
workflowName |
string | Name of workflow |
metadata |
Object | Execution metadata |
(async) save()
Save state to disk
setOverlap(set1, set2) → {number}
Calculate set overlap (Jaccard similarity)
Parameters:
| Name | Type | Description |
|---|---|---|
set1 |
Array | First set |
set2 |
Array | Second set |
Returns:
Overlap 0.0-1.0
- Type
- number
stringSimilarity(str1, str2) → {number}
Calculate string similarity using Jaccard similarity of word sets
Parameters:
| Name | Type | Description |
|---|---|---|
str1 |
string | First string |
str2 |
string | Second string |
Returns:
Similarity 0.0-1.0
- Type
- number