UNPKG

@struktoai/mirage-core

Version:

A Unified Virtual Filesystem For AI Agents

38 lines • 2.31 kB
import type { DiscordAccessor } from '../../accessor/discord.ts'; export declare const DISCORD_EPOCH = 1420070400000n; /** The lowest snowflake Discord mints at `seconds` of Unix time. */ export declare function snowflakeAt(seconds: number): bigint; export interface DiscordMessage extends Record<string, unknown> { id: string; attachments?: { id: string; [key: string]: unknown; }[]; } /** * A channel-day's messages, or a run of days' through `lastDay`, a page at a * time, newest page first. Mirrors Python's `stream_messages_for_day`. */ export declare function streamMessagesForDay(accessor: DiscordAccessor, channelId: string, dateStr: string, pageSize?: number, after?: string, lastDay?: string): AsyncIterableIterator<DiscordMessage[]>; /** Every message of a channel-day, or only those after `after`, oldest first. */ export declare function listMessagesForDay(accessor: DiscordAccessor, channelId: string, dateStr: string, pageSize?: number, after?: string): Promise<DiscordMessage[]>; /** * A channel-day's messages for its listing, kept for the read of its * chat.jsonl that follows in the same command. A walk reads a day's * chat.jsonl right after it lists the day, so only the last listed day is * kept, only for the command that listed it, and for at most * `LISTING_TRUST_WINDOW` seconds, the window a fetch still counts as current * in (none under `fresh`). That command's read takes it instead of fetching * the day again; any other read, a direct one included, asks Discord. A * listing nothing reads holds no more than one day. Mirrors Python's * `listed_messages_for_day`. */ export declare function listedMessagesForDay(accessor: DiscordAccessor, channelId: string, dateStr: string): Promise<DiscordMessage[]>; /** * A channel-day's messages as JSONL: the ones the running command's listing * of the day just fetched (`listedMessagesForDay`), else fetched now. Either * way the day is no longer kept. Mirrors Python's `get_history_jsonl`. */ export declare function getHistoryJsonl(accessor: DiscordAccessor, channelId: string, dateStr: string): Promise<Uint8Array>; export declare function fetchRecentMessages(accessor: DiscordAccessor, channelId: string, limit?: number): Promise<Record<string, unknown>[]>; //# sourceMappingURL=history.d.ts.map