/** * The files `[` offers, as @estiva-app/conversation ranks them (PEE-21). * * conversation's `rankReferences` orders candidates and knows nothing of a * relay; this is the half that turns what a relay holds into candidates — a * resolved object into a row, and typed text into the search tier — so Peek * and Ship draw the same rows from the same reads. * * A row is the type word, the current title and, when it has one, the file's * summary (SPEC §6.12, SUM-7); an issue is captioned with its * project's title, and nothing names a Folder (Miky, 2026-10-03). Only what the * reader resolved is offered: an object the relay did not hand back to them is * never a row, so nothing unreadable is offered. An archived file is offered * at the lowest priority, and so is an issue in an archived project. */ import { type ReferenceCandidate, type ReferenceType } from '@estiva-app/conversation'; import { type ForeignObject, type ProjectionCache, type QueryFn } from './projection.js'; import { type SearchMatch, type SignedEvent } from '@estiva-app/protocol'; /** * The kinds `[` offers as files, and the type word each draws as. A Leaf page * is offered in every app, beside topics, projects and issues (Miky, SUM-7 * kickoff, 2026-10-16). */ export declare const REFERENCE_FILE_TYPES: Readonly>; export interface FileCandidatesOptions { cache?: ProjectionCache; /** When each address was last written or read, in seconds — newer first within a tier. */ at?: ReadonlyMap; /** The types the relay keeps in order (`RelayFileReads.inOrder`): a project of one is picked as its link. */ inOrder?: readonly string[]; /** The host Ship serves projects from: a picked project's link is `/project/`. Ship's own unless said, so every app picks the same link. */ projectOrigin?: string; /** The relay offers the list read: an issue's project, read for its caption, is read by its current fields (`resolveForeignRoots`). */ listRead?: boolean; } /** Where Ship serves projects (§13.1, decided 2026-11-03): one link for a project, whichever app picked it. */ export declare const SHIP_ORIGIN = "https://ship.estiva.app"; /** * How a picked file goes in the text (§13.1): a project whose type the relay * keeps in order as Ship's path link with its id and no title, which every * app's host answers; anything else as `nostr:naddr…`. * * why: https://github.com/estiva-app/estiva-docs/blob/main/decisions/a-file-is-named-by-its-id-in-a-capital-and-small-tag.md */ export declare function pickedFileUri(address: string, { inOrder, projectOrigin }?: Pick): string; /** * Rows for resolved files, all in one tier. * * An issue's caption is its project's title, and an issue in an archived * project is archived with it: the project is taken from `objects` when it is * among them, and otherwise read in one more batch for every missing project * at once (roots and changes only). A project that cannot be read leaves the * caption empty rather than dropping the issue. Objects that are not * offerable — unreachable, untitled, or of a kind `[` does not offer — are * left out. */ export declare function fileCandidates(objects: readonly (ForeignObject | null | undefined)[], tier: number, query: QueryFn, { cache, at, inOrder, projectOrigin, listRead }?: FileCandidatesOptions): Promise; /** A `/query` that keeps what a `search` found besides its events (protocol's `Relay.queryWithMatches`). */ export type SearchQueryFn = (filters: Record[]) => Promise<{ events: SignedEvent[]; matches: readonly SearchMatch[]; }>; export interface SearchFileReferencesOptions extends Omit { /** How many roots, and separately how many renames, the relay is asked for. Default 32. */ limit?: number; /** * The kinds the relay finds by the words of their current fields (NIP-11 * `file_search`, `RelayFileReads.search`), and the read that asks it. Those * kinds are found by their summary, key and text too, through the list read; * every other kind by its title as before. */ byFields?: { kinds: readonly number[]; query: SearchQueryFn; /** The relay's `file_search.max_page_size`, which refuses a larger page. Default 20, production's. */ limit?: number; }; } /** * The files whose **current** title — or, for an issue, current ref (CON-33) * — holds `text`, as the search tier. * * The relay indexes a root's `title` and `ref` and a change's `value` for those * fields (SPEC §5.2); none is the current one on its own — a root keeps the * name it was created with, and a rename found by an old word may since have * been renamed again. So a hit is only an address: each is read back as its * root and changes, folded through its app's manifest, and kept only when what * it is called now matches what was typed. * * Roots and renames are asked for separately, so a burst of renames cannot * crowd every root out of the answer. Every typed word matches the start of a * word (SPEC §5.2), so a word matches before it is finished; `search_mode` is * still sent for a relay from before that rule. A relay that indexes none of these * kinds answers nothing, and so does this. A failed read rejects, for * `referenceSearch` to answer no hits for a while. * * With `byFields`, its kinds are found by the words of their current fields * instead, ahead of the title hits (`searchByFields`). */ export declare function searchFileReferences(text: string, query: QueryFn, { limit, byFields, ...options }?: SearchFileReferencesOptions): Promise; //# sourceMappingURL=references.d.ts.map