/** * The conversations of every file a topic lists, read in one go and kept live * — the read behind a topic's All (SPEC §11.8). * * All reads the files on the topic's list and nothing under them: a listed * project's issues, a listed Folder's files and a listed page's sub-pages are * not here (Miky, 2026-11-06). Each file's events are returned as the shared * fold's input (`foldThreads`, `@estiva-app/conversation`), so the app folds * each file as its own pane would and every app draws the same threads. * * why: https://github.com/estiva-app/estiva-docs/blob/main/decisions/a-topic-keeps-its-own-list-of-files.md * why: https://github.com/estiva-app/estiva-docs/blob/main/decisions/what-belongs-to-a-file-is-stored-with-it.md * why: https://github.com/estiva-app/estiva-docs/blob/main/decisions/a-conversation-is-one-shared-thing-and-only-its-colours-are-the-apps.md * * ## The cold read * * 1. Every listed file's comments and replies: `kind:1111` by `#A` (its * address) and by `#O` (its id), always both (§6.4: a comment may carry * either form). The A/O rules decide which file each one is about * (`isAbout`), so a comment whose `A` and `O` name different files is about * neither. An owning app's older comment kinds (`emits.alsoRead`, Ship's * `kind:9`) are read by `#a` when its manifest resolves; a file whose * manifest does not resolve still has its `1111`s read. * 2. One `#e` read on what those name: edits (`40003`), resolve and reopen * (`9101`), deletions (`5`), the older kinds' replies, and reactions (`7`) * on each file's newest 100 messages (`REACTION_HORIZON`), as each file's * own pane asks (§6.6) — the cut is reported per file. * * About three requests for a topic of eight files, whatever their number up to * `MAX_FILTERS_PER_QUERY / 2`. A listed id the reader cannot resolve is left * out, not returned as an unreachable entry: the count is the disclosure * (§6.14, §3.2). */ import { type LiveRelay, type SignedEvent } from '@estiva-app/protocol'; import { type ProjectionCache, type QueryFn } from './projection.js'; import { type ListedFile } from './topics.js'; /** One listed file's conversation, as the shared fold takes it. */ export interface ListedConversation { /** The listed file's id. */ file: string; address: string; /** Its Folder, from its root, or `null` when the root names none. */ folder: string | null; /** * Every event its threads need, unordered: its comments and their replies, * and what the `#e` read returned on them. Pass to `foldThreads`. */ events: SignedEvent[]; /** A comment read for it came back at the relay's page ceiling: its oldest comments may be missing. */ commentsCut: boolean; /** Its messages past the reaction horizon, not asked about reactions (§6.6: a cap is reported). */ reactionTargetsOmitted: number; /** Its reaction read came back at the page ceiling, so some reactions may be missing. */ reactionEventsCut: boolean; /** Its edit, resolution and deletion read came back at the page ceiling. */ editEventsCut: boolean; /** @internal The comment kinds its owning app used to publish, read by `#a` (`emits.alsoRead`). */ olderKinds: readonly number[]; } /** What {@link listedConversations} read. */ export interface ListedConversations { /** The listed files the reader can resolve, in the list's order. */ files: ListedConversation[]; } /** The conversations of every file the topic at `topic` lists: its list read, then {@link listedConversationsOf}. */ export declare function listedConversations(query: QueryFn, topic: string, options?: { cache?: ProjectionCache; fileKinds?: readonly number[]; }): Promise; /** * The conversations of `listed`, a topic's list already read (`topicList`, * `readTopics`). Files left unresolved are left out. A refused read is * whatever `query` does with one. */ export declare function listedConversationsOf(query: QueryFn, listed: readonly ListedFile[], options?: { cache?: ProjectionCache; }): Promise; /** A live watch's handle. */ export interface ListedWatch { /** Idempotent. Closes its subscriptions. */ stop(): void; } /** * The most filters one live `REQ` may carry on our relay. Over it, the relay * answers only a `NOTICE` ("REQ contains 14 filters, maximum is 10", measured * 6 Nov) — no `CLOSED`, no `EOSE` — so a watch past it hears nothing and says * nothing. `POST /query` takes 128 (`MAX_FILTERS_PER_QUERY`); a socket does not. */ export declare const MAX_FILTERS_PER_REQ = 10; /** Wait before a watch that has learnt a new id asks again, so a burst of messages costs one new REQ. */ export declare const LISTED_WATCH_REBUILD_MS = 250; /** * Hear, live, every new event on the files `read` holds, each handed to its * file: a new comment or reply about one (`#A`, `#O`, and `#a` for an owner's * older kinds), and an edit, resolution, reaction or deletion naming any * message the watch knows (`#e`). One REQ for all of them (another per * {@link MAX_FILTERS_PER_REQ} filters, past about 700 messages), asked again — a * moment later, from the newest second it has seen — whenever a new message * or reaction gives it another id to listen for, so a reaction to a comment * written a second ago is heard. Each event is handed over once; the cold * read's are never handed over. * * ## Asking by file alone (`namesTeams: relayNamesTeams(relay)`) * * The decided shape asks by file alone (Miky, 2026-11-06), and a relay that * lists `buzz-live-as-stored` (ours) delivers a team's event live to a * request that names no team, as a stored read returns it. Pass * `namesTeams: relayNamesTeams(relay)` and the watch asks by file alone on * such a relay; it opens once that answer is in. Otherwise (`namesTeams` * true, the default, or a relay that does not say so) every filter also * carries the `#h` of each listed file's team and of every team a comment on * them was filed in. * * why: https://github.com/estiva-app/estiva-docs/blob/main/decisions/a-request-kept-open-hears-what-asking-again-would-return.md */ export declare function watchListedConversations(relay: Pick, read: ListedConversations, onEvent: (file: string, event: SignedEvent) => void, options?: { /** Unix seconds to hear from. Defaults to the newest event the read holds, else now. */ since?: number; /** Whether to name teams; a promise ({@link relayNamesTeams}) holds the REQ until it settles. Defaults to true. */ namesTeams?: boolean | Promise; onClosed?: (reason: string) => void; now?: () => number; setTimer?: (run: () => void, ms: number) => unknown; clearTimer?: (timer: unknown) => void; }): ListedWatch; /** * Open a watch now, or once `namesTeams` (a promise, `relayNamesTeams`) * settles, naming teams if it rejects. `since` covers the wait. */ export declare function openWhenKnown(namesTeams: boolean | Promise | undefined, set: (names: boolean) => void, open: () => void): void; //# sourceMappingURL=listedConversations.d.ts.map