import * as postgres from 'postgres'; import { schema } from '@vibeflow/database'; declare class AnalyzerService { /** * Save parsed tweets with their media to the database * Handles duplicates by updating existing records * Returns the tweets enriched with their database IDs */ static saveParsedTweets(parsedTweets: schema.InsertTweetAnalyzerWithMedia[]): Promise; /** * Save media for a specific tweet */ static saveMediaForTweet(tweetId: number, mediaItems: Omit[]): Promise; static updateMediaDescriptions(media: schema.TweetMediaAnalyzer): Promise; static getMediaByAuthorUsername(username: string): Promise; /** * Get all tweets */ static getAllTweets(): Promise<{ id: number; apiId: string; url: string; text: string; retweetCount: number; replyCount: number; likeCount: number; quoteCount: number; viewCount: number; bookmarkCount: number; username: string; type: string; createdAt: Date; evs: number; scrapedAt: Date; status: string; updatedAt: Date; }[]>; /** * Get tweet by database ID */ static getTweetById(id: number): Promise<{ id: number; apiId: string; url: string; text: string; retweetCount: number; replyCount: number; likeCount: number; quoteCount: number; viewCount: number; bookmarkCount: number; username: string; type: string; createdAt: Date; evs: number; scrapedAt: Date; status: string; updatedAt: Date; }>; static getTweetsBySql(sql: string): Promise[]>>; } type TweetCandidate = { tweet: schema.Tweet; analytics: schema.TweetAnalytics; }; declare const PENDING_TWEET_STATUS: "pending"; declare const READY_TO_RESPOND_TWEET_STATUS: "ready_to_respond"; declare const ERROR_TWEET_STATUS: "error"; declare const PROCESSED_TWEET_STATUS: "processed"; declare const REPLIED_TWEET_STATUS: "responded"; declare function insertTweetsAndIgnoreDuplicates(tweets: schema.InsertTweet[]): Promise<{ id: number; text: string; retweetCount: number; replyCount: number; likeCount: number; quoteCount: number; viewCount: number; status: string; updatedAt: Date; tweetId: string; language: string | null; tweetUrl: string; authorId: string; authorUsername: string | null; authorName: string | null; authorFollowers: number | null; conversationId: string | null; isReply: boolean; inReplyToId: string | null; inReplyToUsername: string | null; createdAtUtc: Date; capturedAtUtc: Date; errors: string[] | null; source: string; rawJson: unknown; reply: string | null; reasoning: string | null; }[]>; declare function getPendingTweets(): Promise<{ id: number; tweetId: string; text: string; language: string | null; tweetUrl: string; authorId: string; authorUsername: string | null; authorName: string | null; authorFollowers: number | null; conversationId: string | null; isReply: boolean; inReplyToId: string | null; inReplyToUsername: string | null; likeCount: number; replyCount: number; retweetCount: number; quoteCount: number; viewCount: number; createdAtUtc: Date; capturedAtUtc: Date; updatedAt: Date; status: string; errors: string[] | null; source: string; rawJson: unknown; reply: string | null; reasoning: string | null; }[]>; declare function addReplyToTweet(tweetId: string, reply: string, reasoning: string): Promise; declare function getMostRelevantTweetsToReplyTo({ top_k, }: { top_k?: number | undefined; }): Promise; declare function addErrorToTweet(tweetId: string, error: string): Promise; declare function setTweetStatus(tweetId: string, status: schema.Tweet["status"]): Promise; declare function batchSetTweetStatus(tweetIds: string[], status: schema.Tweet["status"]): Promise; declare function addAnalyticsToTweet(analytics: schema.InsertTweetAnalytics): Promise; declare function batchAddAnalyticsToTweets(analytics: schema.InsertTweetAnalytics[]): Promise; declare function getTweetAnalytics(tweetId: string): Promise<{ id: number; tweetId: string; rawEngagementScore: string; normalizedEngagementScore: string; freshnessAdjustedScore: string; finalScore: string; authorSizeNormalizationFactor: string; freshnessDecayFactor: string; ageInHours: string; shouldReply: boolean; algorithmVersion: string; computedAt: Date; }[]>; declare function getTweetCandidates(): Promise; declare const ENGAGEMENT_WEIGHTS: { readonly reply: 4; readonly quote: 3; readonly retweet: 2; readonly like: 1; readonly view: 0.001; }; declare const FRESHNESS_DECAY: { readonly halfLifeHours: 24; readonly decayFactor: number; }; declare const ANALYTICS_VERSION: "1.0"; declare const REPLY_THRESHOLD = 0.5; declare const TWITTER_USERNAME: string | undefined; declare function calculateRawEngagementScore(tweet: schema.Tweet): number; declare function calculateAuthorSizeNormalization(authorFollowers: number): number; declare function calculateFreshnessDecay(tweetCreatedAt: Date): { factor: number; ageInHours: number; }; declare function calculateFinalScore(rawEngagementScore: number, authorSizeNormalizationFactor: number, freshnessDecayFactor: number): number; declare function calculateShouldReply(finalScore: number): boolean; declare function calculateTweetAnalytics(tweet: schema.Tweet): Promise; declare function calculateBatchTweetAnalytics(tweets: schema.Tweet[]): Promise; declare function checkIfUserRepliedToTweet(reply: schema.InsertTweet): Promise; interface SlackMessagePayload { text?: string; blocks?: SlackBlock[]; channel?: string; username?: string; icon_emoji?: string; icon_url?: string; } interface SlackBlock { type: 'section' | 'divider' | 'header' | 'actions' | 'context' | 'image'; text?: { type: 'mrkdwn' | 'plain_text'; text: string; }; fields?: Array<{ type: 'mrkdwn' | 'plain_text'; text: string; }>; accessory?: { type: string; [key: string]: any; }; elements?: any[]; image_url?: string; alt_text?: string; } declare class SlackClient { private readonly webhookUrl; constructor(webhookUrl: string); postMessage(message: SlackMessagePayload): Promise<{ ok: boolean; status: number; body: string; }>; postText(text: string): Promise<{ ok: boolean; status: number; body: string; }>; } declare const generateVisualDescription: (type: string, url: string) => Promise; export { ANALYTICS_VERSION, AnalyzerService, ENGAGEMENT_WEIGHTS, ERROR_TWEET_STATUS, FRESHNESS_DECAY, PENDING_TWEET_STATUS, PROCESSED_TWEET_STATUS, READY_TO_RESPOND_TWEET_STATUS, REPLIED_TWEET_STATUS, REPLY_THRESHOLD, type SlackBlock, SlackClient, type SlackMessagePayload, TWITTER_USERNAME, type TweetCandidate, addAnalyticsToTweet, addErrorToTweet, addReplyToTweet, batchAddAnalyticsToTweets, batchSetTweetStatus, calculateAuthorSizeNormalization, calculateBatchTweetAnalytics, calculateFinalScore, calculateFreshnessDecay, calculateRawEngagementScore, calculateShouldReply, calculateTweetAnalytics, checkIfUserRepliedToTweet, generateVisualDescription, getMostRelevantTweetsToReplyTo, getPendingTweets, getTweetAnalytics, getTweetCandidates, insertTweetsAndIgnoreDuplicates, setTweetStatus };