import type { Settings } from "@opengeni/config"; import type { SocialConnection } from "@opengeni/contracts"; import type { Observability } from "@opengeni/observability"; import type { Database } from "@opengeni/db"; import { type SocialProviderFetch } from "./social-oauth.js"; export type SocialLivePost = { id: string; provider: "x" | "reddit"; url: string | null; author: string | null; text: string; createdAt: string | null; metrics: Record; context: Record; }; type SocialApiDeps = { db: Database; settings: Settings; observability?: Observability | undefined; providerFetch?: SocialProviderFetch | undefined; }; type ConnectionRef = { workspaceId: string; connectionId: string; subjectId?: string | null; }; export declare function assertSocialConnectionProvider(connection: Pick, expected: "x" | "reddit"): void; export declare function socialSearchLive(deps: SocialApiDeps, ref: ConnectionRef, input: { query: string; limit?: number | undefined; subreddit?: string | undefined; }): Promise<{ connection: SocialConnection; posts: SocialLivePost[]; }>; export declare function socialMentionsLive(deps: SocialApiDeps, ref: ConnectionRef, input: { limit?: number | undefined; sinceId?: string | undefined; }): Promise<{ connection: SocialConnection; posts: SocialLivePost[]; }>; export declare function socialThreadLive(deps: SocialApiDeps, ref: ConnectionRef, input: { id: string; limit?: number | undefined; }): Promise<{ connection: SocialConnection; posts: SocialLivePost[]; }>; export declare function socialOwnPostsLive(deps: SocialApiDeps, ref: ConnectionRef, input: { limit?: number | undefined; }): Promise<{ connection: SocialConnection; posts: SocialLivePost[]; }>; export declare function socialPostReply(deps: SocialApiDeps, ref: ConnectionRef, input: { inReplyToId: string; text: string; }): Promise<{ connection: SocialConnection; postedId: string | null; url: string | null; }>; /** * Reddit write endpoints address targets by fullname (t3_xxx post, t1_xxx * comment). Bare ids are ambiguous, so require the caller to be explicit. */ export declare function redditThingId(id: string): string; /** * Agent-controlled values that land in a provider URL PATH must be shape- * validated: encodeURIComponent leaves `.` intact, so `..` would collapse a * path segment and select a different endpoint on the same host. */ export declare function redditSubredditName(value: string): string; export declare function redditArticleId(value: string): string; /** * Joins a provider-supplied path against the provider origin and refuses * results that escape it (e.g. a hostile `@evil.com/x` or `//evil.com` * permalink), so mapper output URLs can be trusted downstream. */ export declare function redditUrl(path: string): string | null; export declare function mapXTweets(payload: Record, fallbackAuthor?: string): SocialLivePost[]; export declare function mapRedditListing(payload: Record): SocialLivePost[]; /** * /comments/{article} returns [post listing, comment listing]; flatten the * submission first, then its comment tree in order. */ export declare function mapRedditThread(payload: Record): SocialLivePost[]; export declare function redditCommentFromApiJson(payload: Record): { id: string | null; url: string | null; }; export {};