/** * Inbox reference engine — create, scan, and peek inbox refs. * Spec: §4.5 — Inbox Reference File Schema */ import { type MessageFile } from "./store.js"; /** * A single inbox entry: the message body plus the path to the `.ref` file * that points at it. Callers that need to consume *exactly* the refs they * peeked (to avoid racing with newly-arrived refs) use the refPath to delete * each ref individually via `consumeRef()`. */ export interface InboxEntry { refPath: string; message: MessageFile; } /** * Create an inbox reference file for a message. * * Creates a `.ref` file in inbox// with the message source * path and timestamp. The ref file is named `_msg-.ref`. * * @param recipientSessionId - Recipient session ID * @param messageSource - Relative path from store dir (e.g., "2026/04/11/msg-abc.md") * @param sentAt - ISO 8601 timestamp when message was sent * @param projectSlug - Optional project slug */ export declare function createInboxRef(recipientSessionId: string, messageSource: string, sentAt: string, projectSlug?: string): Promise; /** * Scan inbox and consume refs. * * Globs all `.ref` files for a session. For each ref: read the YAML, * resolve source to store dir, read the message, then delete the ref file. * Returns messages in chronological (oldest-first) order by sentAt. * * Orphaned refs (store file missing) are logged and skipped. * * @param sessionId - Session ID to scan inbox for * @param projectSlug - Optional project slug * @returns Messages in chronological (oldest-first) order */ export declare function scanInbox(sessionId: string, projectSlug?: string): Promise; /** * Peek at inbox without consuming refs. * * Same as scanInbox but does NOT delete `.ref` files. * * @param sessionId - Session ID to peek inbox for * @param projectSlug - Optional project slug * @returns Messages in chronological (oldest-first) order */ export declare function peekInbox(sessionId: string, projectSlug?: string): Promise; /** * Peek at inbox and return entries paired with their `.ref` file paths. * * Use this when you need to consume *exactly* the refs you peeked at — * `peekInbox()` followed by `scanInbox()` would race against any refs that * arrived in between, silently consuming them without ever delivering them. * * Pair with `consumeRef(entry.refPath)` for each entry once it has been * delivered. */ export declare function peekInboxEntries(sessionId: string, projectSlug?: string): Promise; /** * Delete a single inbox `.ref` file. Use after the message it points at * has been delivered to the LLM (via `pi.sendUserMessage` from idle polling * or via context-hook injection at turn start). * * Idempotent — silently no-ops if the ref no longer exists. */ export declare function consumeRef(refPath: string): Promise; //# sourceMappingURL=inbox.d.ts.map