@estiva-app/conversation 0.23.1 → 0.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -6,6 +6,62 @@ none. A change to how an event is read is a MINOR in `0.x` even when no
6
6
  signature moved, because two apps on different versions would then disagree
7
7
  about a conversation.
8
8
 
9
+ ## 0.25.0 — 2026-11-03
10
+
11
+ **SPEC: none changed.** Peek's rule for a list row's dot moves here, so Ship
12
+ and Peek judge a topic's dot the same way (SHIPS-2). Each is Peek's code as it
13
+ ran, made pure: the read state and the muted list stay the app's to decrypt
14
+ and hand in.
15
+
16
+ - `streamHasUnread(messages, context, terms, frontier, isMentioned)`: §11.8's
17
+ four conditions over bodiless messages (`StreamMessage`: id, at, by, root).
18
+ - `membershipQueries(pubkey, now)`, `foldMemberships(pubkey, events, now)`:
19
+ the three filters bounded by the 90-day horizon (`HORIZON_SECONDS`,
20
+ `MEMBERSHIP_LIMIT` per filter), folded per candidate file, a created file
21
+ the viewer's from the horizon's start; the ids that name the viewer.
22
+ - `streamTermsOf(key, read, me, muted)`: member, since and muted for a file;
23
+ a Folder's own stream has no members. `membershipJudges(key, read, me)`:
24
+ whether the horizon has a word on the viewer there. `authorOfAddress`.
25
+
26
+ ## 0.24.0 — 2026-10-30
27
+
28
+ Three of Katerina's calls from the widget review (30 October), once for
29
+ every app.
30
+
31
+ **`[` lists Files first, and finds a message by its own words** (item 19).
32
+ `referenceSectionsOf(ranked)` gives `rankReferences`' two sections in the
33
+ order every app draws them: Files, then Messages (CON-26's ranking had
34
+ Messages above Files, so typing a file's word picked a message instead).
35
+ `messageCandidate(message, tier, nameOf, { resolveLink })` builds a
36
+ message's row as Peek, Ship and Leaf each built their own: its reference,
37
+ its author, its opening words as the caption, and `messageWords(body,
38
+ nameOf)` to be found by — what its writer wrote, with no URL and no type
39
+ word for a file or message it names, so a message is no longer found by the
40
+ raw text of a link in it. Each app passed the raw body as `search`.
41
+
42
+ **A link in a message preview reads as what it names** (item 20).
43
+ `openingWords(body, nameOf, { resolveLink })` reads a bare app URL the app
44
+ has resolved (§7.7) as the reference it names, "Issue" or "Message", as its
45
+ chip would (§13.6.2, "A bare app link reads as a reference"), never as the
46
+ raw URL. One nothing claims, one not answered yet, one in code and one in a
47
+ link's words stay as written. Without `resolveLink` it reads as before.
48
+
49
+ **An edit box shows the message's card, with its ✕** (item 36). With the
50
+ message's folded `embed` set as `folded`, `boxLinksOf` and `boxReadOf` give
51
+ the edit box the card the message has, while the edit still names its file,
52
+ so it can be seen and taken off there; otherwise, as before, the default
53
+ for a file the edit names first. A value the set holds as `none` (✕ after
54
+ sending) gets no default again, even when its link is taken out and put
55
+ back: a card taken off stays off (SPEC §13.6.2 lets a writer give it one;
56
+ these apps no longer do). `embedsToEdit` follows: the message's own card
57
+ kept leaves the set as it was (`undefined`, where it carried the set with
58
+ that card `detailed`, which draws the same); ✕ on it sets it `none` — which
59
+ also fixes ✕ on a link put back whose card the set still carried, which
60
+ used to keep the card.
61
+
62
+ SPEC: none changed. Nothing is read differently; what an edit writes stays
63
+ within §13.6.2's "The default on an edit".
64
+
9
65
  ## 0.23.1 — 2026-10-30
10
66
 
11
67
  **A word typed right after a chip is sent a space apart from it.** A chip
package/README.md CHANGED
@@ -27,8 +27,9 @@ pass, the clock is a `createdAtMs` you pass, and drafts take their storage.
27
27
  | writing | §6.4, §13.6 | `buildComment`, `buildReply`, `placeOf`, `referenceTagsFor`, `mentionTagsFor` |
28
28
  | what a composer's pick writes | §13.1 | `mentionText`, `messageReference`, `urgentTagsFor`, `URGENT_TAG` |
29
29
  | what the shared comment box holds, as the message it writes, and back | §13.1 | `composerText`, `composerDocument`, `withoutNewUrgency`, `composerDraft` |
30
- | what a box shows under itself while a comment is written: the one file's card and each block link's part, and the `embed` a send or an edit writes | §13.6.1, §13.6.2 | `boxReadOf`, `boxLinksOf`, `embedsToSend`, `embedsToEdit`, `namedBefore`, `withoutCard`, `linkTargetOf` |
31
- | what `[` offers, and in what order | §13.1 | `rankReferences`, `referenceMatch`, `fileReference`, `referenceSearch`, `MESSAGE_TIER`, `FILE_TIER`, `REFERENCE_CAPS` |
30
+ | what a box shows under itself while a comment is written or edited: the one file's card (an edit's own card, with its ✕) and each block link's part, and the `embed` a send or an edit writes | §13.6.1, §13.6.2 | `boxReadOf`, `boxLinksOf`, `embedsToSend`, `embedsToEdit`, `namedBefore`, `withoutCard`, `linkTargetOf` |
31
+ | what `[` offers, and in what order: Files, then Messages, a message found by its own words | §13.1 | `rankReferences`, `referenceSectionsOf`, `messageCandidate`, `referenceMatch`, `fileReference`, `referenceSearch`, `MESSAGE_TIER`, `FILE_TIER`, `REFERENCE_CAPS` |
32
+ | a message as a preview line says it, a link as what it names; the words it is found by | §13.1, §13.6.2 | `openingWords`, `referenceWord`, `messageWords` |
32
33
  | ordering | §6.2, §6.3 | `trustedTs`, `orderingMs`, `byOrder` |
33
34
  | edits and attachments | §6.8 | `editTargetOf`, `foldEdits`, `foldAttachments` |
34
35
  | reactions | §6.6 | `REACTION_HORIZON`, `reactionHorizon`, `reactionTargetOf`, `reactionEmojiOf`, `foldReactions` |
package/dist/boxCard.d.ts CHANGED
@@ -9,6 +9,11 @@
9
9
  * a Folder, a person, a message and the file the conversation is on do not
10
10
  * count, a link on words counts by its target, and a plain web link counts
11
11
  * for nothing. ✕ takes it off (the box's to keep).
12
+ * - **An edit's card.** The message's own card while the edit still names its
13
+ * file, with its ✕, so it can be seen and taken off there; otherwise the
14
+ * default for a file the edit names first. A card taken off before, with ✕
15
+ * on the sent message, never comes back in an edit (Katerina, 2026-10-30,
16
+ * widget review item 36).
12
17
  * - **The live part of each block link**, as the `part` the message will
13
18
  * carry, one per file. A part counts as its file and draws instead of a card,
14
19
  * so linking an issue and a block of a page shows the block and no card. A
@@ -28,7 +33,12 @@ export interface BoxLinks {
28
33
  values: string[];
29
34
  /** The block links' parts, one per file, the first link's; none of the conversation's own file. */
30
35
  parts: PartPointer[];
31
- /** The file that gets the default card, before any ✕. */
36
+ /**
37
+ * The card under the box, before any ✕: for a new message, the file that
38
+ * gets the default card; for an edit (`folded` given), the message's own
39
+ * card while the edit still names it, else the default for a file the edit
40
+ * names first.
41
+ */
32
42
  card?: string;
33
43
  /**
34
44
  * Every URL the text names, bare or as a link's target, once each: what the
@@ -45,6 +55,13 @@ export interface BoxLinkContext {
45
55
  here?: string;
46
56
  /** An edit's: the values the message named before it, which get no default again. */
47
57
  previous?: readonly string[];
58
+ /**
59
+ * An edit's: the message's folded `embed` set (`foldEmbeds`). Its card shows
60
+ * under the box while the edit names its file, and a value it holds as
61
+ * `none` — a card taken off with ✕ after sending — gets no default again,
62
+ * even named afresh.
63
+ */
64
+ folded?: readonly Embed[];
48
65
  }
49
66
  /**
50
67
  * What an app link in the box draws as: the file or message it names, or, for
@@ -52,7 +69,7 @@ export interface BoxLinkContext {
52
69
  * file's chip, the block live under the box.
53
70
  */
54
71
  export declare function linkTargetOf(url: string, context: Pick<BoxLinkContext, 'resolveLink' | 'blockOf'>): string | undefined;
55
- /** What a marker text names, and the one file it gives the default card. */
72
+ /** What a marker text names, and the one card it shows under the box. */
56
73
  export declare function boxLinksOf(text: string, context: BoxLinkContext): BoxLinks;
57
74
  /** {@link boxLinksOf} of a composer's document (`CommentBox`'s JSON), read as {@link composerText} writes it. */
58
75
  export declare function boxReadOf(doc: EditorDocument | EditorNode, context: BoxLinkContext): BoxLinks;
@@ -65,10 +82,12 @@ export declare function namedBefore(text: string, context: Pick<BoxLinkContext,
65
82
  export declare function embedsToSend(links: Pick<BoxLinks, 'card'>, removed: ReadonlySet<string>): Embed[];
66
83
  /**
67
84
  * The `embed` set an edit sends, or undefined to leave the message's as it
68
- * was. Only an edit that names a file first adds its default (`links` read
69
- * with `previous`), and then it carries the whole folded set with it, since a
70
- * set replaces (§13.6.2). A card removed with ✕, before sending or after,
71
- * stays removed.
85
+ * was. `links` is read with `previous` and `folded`, so its card is the
86
+ * message's own or the default for a file the edit names first. The message's
87
+ * own card, kept, leaves the set as it was; taken off with ✕ in the edit box,
88
+ * it is set `none`. A file named first adds its default; ✕ on that one writes
89
+ * nothing. Either way the whole folded set goes with it, since a set replaces
90
+ * (§13.6.2), and a card removed with ✕, before sending or after, stays removed.
72
91
  */
73
92
  export declare function embedsToEdit(links: Pick<BoxLinks, 'card'>, removed: ReadonlySet<string>, folded: readonly Embed[] | undefined): Embed[] | undefined;
74
93
  /** ✕ on a sent message's card: the folded set, with that card `none` and every other kept. */
@@ -1 +1 @@
1
- {"version":3,"file":"boxCard.d.ts","sourceRoot":"","sources":["../src/boxCard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAKL,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,KAAK,EACV,KAAK,YAAY,EACjB,KAAK,WAAW,EACjB,MAAM,sBAAsB,CAAA;AAG7B,2EAA2E;AAC3E,eAAO,MAAM,SAAS,IAAI,CAAA;AAE1B,MAAM,WAAW,QAAQ;IACvB,iDAAiD;IACjD,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,mGAAmG;IACnG,KAAK,EAAE,WAAW,EAAE,CAAA;IACpB,yDAAyD;IACzD,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;;OAGG;IACH,IAAI,EAAE,MAAM,EAAE,CAAA;CACf;AAED,MAAM,WAAW,cAAc;IAC7B,oEAAoE;IACpE,WAAW,EAAE,YAAY,CAAA;IACzB,wEAAwE;IACxE,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,WAAW,GAAG,SAAS,CAAA;IACjD,yFAAyF;IACzF,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,qFAAqF;IACrF,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAC7B;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,cAAc,EAAE,aAAa,GAAG,SAAS,CA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;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,SAAS,KAAK,EAAE,GAAG,SAAS,GAAG,KAAK,EAAE,GAAG,SAAS,CAKnJ;AAED,8FAA8F;AAC9F,wBAAgB,WAAW,CAAC,MAAM,EAAE,SAAS,KAAK,EAAE,GAAG,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,KAAK,EAAE,CAExF"}
package/dist/boxCard.js CHANGED
@@ -9,6 +9,11 @@
9
9
  * a Folder, a person, a message and the file the conversation is on do not
10
10
  * count, a link on words counts by its target, and a plain web link counts
11
11
  * for nothing. ✕ takes it off (the box's to keep).
12
+ * - **An edit's card.** The message's own card while the edit still names its
13
+ * file, with its ✕, so it can be seen and taken off there; otherwise the
14
+ * default for a file the edit names first. A card taken off before, with ✕
15
+ * on the sent message, never comes back in an edit (Katerina, 2026-10-30,
16
+ * widget review item 36).
12
17
  * - **The live part of each block link**, as the `part` the message will
13
18
  * carry, one per file. A part counts as its file and draws instead of a card,
14
19
  * so linking an issue and a block of a page shows the block and no card. A
@@ -20,7 +25,7 @@
20
25
  *
21
26
  * why: https://github.com/estiva-app/estiva-docs/blob/main/decisions/a-link-on-words-counts-toward-the-card.md
22
27
  */
23
- import { defaultCardOf, toRenderTree, valuesIn, withCard, } from '@estiva-app/protocol';
28
+ import { cardsIn, defaultCardOf, toRenderTree, valuesIn, withCard, } from '@estiva-app/protocol';
24
29
  import { composerText } from './composer.js';
25
30
  /** At most this many blocks show live under one message (SPEC §13.6.1). */
26
31
  export const MAX_PARTS = 6;
@@ -32,13 +37,14 @@ export const MAX_PARTS = 6;
32
37
  export function linkTargetOf(url, context) {
33
38
  return context.resolveLink(url) ?? context.blockOf(url)?.address;
34
39
  }
35
- /** What a marker text names, and the one file it gives the default card. */
40
+ /** What a marker text names, and the one card it shows under the box. */
36
41
  export function boxLinksOf(text, context) {
37
42
  // valuesIn asks the resolver about exactly the URLs a reader counts (not one
38
43
  // in a code span, nor one in a link's words), so recording its questions
39
44
  // gives the URLs without a second URL finder.
40
45
  const urls = [];
41
- const values = valuesIn(text ? toRenderTree(text, 'marker') : [], (url) => {
46
+ const tree = text ? toRenderTree(text, 'marker') : [];
47
+ const values = valuesIn(tree, (url) => {
42
48
  if (!urls.includes(url))
43
49
  urls.push(url);
44
50
  return context.resolveLink(url);
@@ -50,7 +56,12 @@ export function boxLinksOf(text, context) {
50
56
  parts.set(part.address, part);
51
57
  }
52
58
  const kept = [...parts.values()].slice(0, MAX_PARTS);
53
- const card = defaultCardOf(values, kept, { here: context.here, previous: context.previous });
59
+ const folded = context.folded ?? [];
60
+ // The card a reader draws under the message once the edit is saved: the first its folded set holds for what the edit names.
61
+ const current = cardsIn(folded, tree, kept, context.resolveLink).find((embed) => embed.layout !== 'none')?.value;
62
+ const takenOff = folded.filter((embed) => embed.layout === 'none').map((embed) => embed.value);
63
+ const previous = takenOff.length > 0 ? [...(context.previous ?? []), ...takenOff] : context.previous;
64
+ const card = current ?? defaultCardOf(values, kept, { here: context.here, previous });
54
65
  return { values, parts: kept, card, urls };
55
66
  }
56
67
  /** {@link boxLinksOf} of a composer's document (`CommentBox`'s JSON), read as {@link composerText} writes it. */
@@ -72,13 +83,20 @@ export function embedsToSend(links, removed) {
72
83
  }
73
84
  /**
74
85
  * The `embed` set an edit sends, or undefined to leave the message's as it
75
- * was. Only an edit that names a file first adds its default (`links` read
76
- * with `previous`), and then it carries the whole folded set with it, since a
77
- * set replaces (§13.6.2). A card removed with ✕, before sending or after,
78
- * stays removed.
86
+ * was. `links` is read with `previous` and `folded`, so its card is the
87
+ * message's own or the default for a file the edit names first. The message's
88
+ * own card, kept, leaves the set as it was; taken off with ✕ in the edit box,
89
+ * it is set `none`. A file named first adds its default; ✕ on that one writes
90
+ * nothing. Either way the whole folded set goes with it, since a set replaces
91
+ * (§13.6.2), and a card removed with ✕, before sending or after, stays removed.
79
92
  */
80
93
  export function embedsToEdit(links, removed, folded) {
81
- return links.card && !removed.has(links.card) ? withCard(folded ?? [], links.card, 'detailed') : undefined;
94
+ if (!links.card)
95
+ return undefined;
96
+ const own = (folded ?? []).some((embed) => embed.value === links.card && embed.layout !== 'none');
97
+ if (removed.has(links.card))
98
+ return own ? withCard(folded ?? [], links.card, 'none') : undefined;
99
+ return own ? undefined : withCard(folded ?? [], links.card, 'detailed');
82
100
  }
83
101
  /** ✕ on a sent message's card: the folded set, with that card `none` and every other kept. */
84
102
  export function withoutCard(folded, value) {
@@ -1 +1 @@
1
- {"version":3,"file":"boxCard.js","sourceRoot":"","sources":["../src/boxCard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EACL,aAAa,EACb,YAAY,EACZ,QAAQ,EACR,QAAQ,GAMT,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAE5C,2EAA2E;AAC3E,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAA;AA2B1B;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,GAAW,EAAE,OAAwD;IAChG,OAAO,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,OAAO,CAAA;AAClE,CAAC;AAED,4EAA4E;AAC5E,MAAM,UAAU,UAAU,CAAC,IAAY,EAAE,OAAuB;IAC9D,6EAA6E;IAC7E,yEAAyE;IACzE,8CAA8C;IAC9C,MAAM,IAAI,GAAa,EAAE,CAAA;IACzB,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,EAAE,EAAE;QACxE,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;YAA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,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,IAAI,EAAE,EAAE,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,CAAA;AACzE,CAAC;AAED,8FAA8F;AAC9F,MAAM,UAAU,WAAW,CAAC,MAAoC,EAAE,KAAa;IAC7E,OAAO,QAAQ,CAAC,MAAM,IAAI,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;AAC9C,CAAC"}
package/dist/index.d.ts CHANGED
@@ -12,7 +12,7 @@
12
12
  * apps: it imports no app's data layer, opens no socket, and takes every
13
13
  * environment touch — the relay read, the clock, storage — as a parameter.
14
14
  */
15
- export declare const CONVERSATION_VERSION = "0.23.1";
15
+ export declare const CONVERSATION_VERSION = "0.25.0";
16
16
  export { KIND_MESSAGE, KIND_COMMENT, KIND_EDIT, KIND_REACTION, KIND_DELETION, KIND_ASSERTION, isConversationKind, isEventId, } from './kinds.js';
17
17
  export { trustedTs, orderingMs, byOrder } from './order.js';
18
18
  export { namedInBody, isReply, anchorsOf, isCommentOn, referencesAddress, strengthOn, threadStrength, referenceTagsFor, mentionTagsFor, peopleNamedInBody, MAX_MENTIONED_PEOPLE, type Strength, } from './strength.js';
@@ -24,13 +24,14 @@ export { buildComment, buildReply, offersEditAndDelete, placeOf, type CommentRef
24
24
  export { eventsNamedInBody, mentionText, messageReference, quoteTagsFor, URGENT_TAG, urgentTagsFor } from './compose.js';
25
25
  export { composerDocument, composerDraft, composerText, withoutNewUrgency, type ComposerDraft, type ComposerLabels, type ComposerText, } from './composer.js';
26
26
  export { MAX_PARTS, boxLinksOf, boxReadOf, embedsToEdit, embedsToSend, linkTargetOf, namedBefore, withoutCard, type BoxLinkContext, type BoxLinks, } from './boxCard.js';
27
- export { FILE_TIER, fileReference, MESSAGE_TIER, rankReferences, REFERENCE_CAPS, referenceMatch, referenceSearch, refMatch, type RankedReferences, type RankReferencesInput, type ReferenceCandidate, type ReferenceSearch, type ReferenceSearchFn, type ReferenceSearchOptions, type ReferenceType, } from './references.js';
27
+ export { FILE_TIER, fileReference, MESSAGE_TIER, messageCandidate, rankReferences, REFERENCE_CAPS, referenceMatch, referenceSearch, referenceSectionsOf, refMatch, type RankedReferences, type RankedSection, type RankReferencesInput, type ReferableMessage, type ReferenceCandidate, type ReferenceSearch, type ReferenceSearchFn, type ReferenceSearchOptions, type ReferenceType, } from './references.js';
28
28
  export { KIND_CHANGE, MEMBER_FIELD_PREFIX, memberField, memberOfField, mentions, streamOf, membershipOf, membersOf, membershipFilters, candidateFilesOf, buildMembershipChange, MUTED_D_TAG, APPDATA_TAG, parseMutedBlob, serializeMutedBlob, buildMutedEvent, mutedFilter, mutedFromFollowed, type Membership, type MutedList, } from './membership.js';
29
29
  export { READ_STATE_TAG, READ_STATE_D_PREFIX, MAX_CONTEXTS, MAX_CONTEXT_ID_BYTES, MAX_TIMESTAMP, MAX_CLIENT_ID_BYTES, MAX_BLOB_BYTES, MAX_CONTEXTS_BYTES, READ_STATE_HORIZON_DAYS, channelContext, fileContext, threadContext, messageContext, toContextSeconds, isPublishableContextId, loadSlotIdentity, rotateSlotId, readStateDTag, parseReadStateBlob, serializeReadStateBlob, capContextsToBytes, capReadStateContexts, THREAD_RULE_FROM, REPLY_FLOOR_CONTEXT, advanceContexts, buildReadStateEvent, allSlotsFilter, mergeSlots, classifyOwnSlots, effectiveReadAt, threadReadAt, belowReplyFloor, fetchReadState, createSlotCache, publishReadState, type SlotCache, type SlotIdentity, type SlotStorage, type SlotSource, type RandomBytes, type ReadStateBlob, type CappedContexts, type SlotBlob, type OwnSlotVerdict, type Nip44, type FetchedReadState, } from './readState.js';
30
30
  export { unreadIn, isUnread, type StreamJudge } from './unread.js';
31
+ export { streamHasUnread, MEMBERSHIP_LIMIT, HORIZON_SECONDS, membershipQueries, authorOfAddress, foldMemberships, streamTermsOf, membershipJudges, type StreamMessage, type StreamFrontier, type StreamTerms, type MembershipRead, } from './streamUnread.js';
31
32
  export { peopleNamedInText, newlyNamedPeople, mentionAddsFor, type FileText } from './textMentions.js';
32
33
  export { KIND_MEMBERSHIP_LIST, namedProfilesOf, rosterOf, byName, mentionablePeople, type NamedProfile } from './people.js';
33
- export { openingWords, referenceWord } from './openingWords.js';
34
+ export { messageWords, openingWords, referenceWord, type OpeningWordsOptions } from './openingWords.js';
34
35
  export { archivedLine } from './archivedLine.js';
35
36
  export { createDraftStore, draftKeys, NO_DRAFTS, DRAFT_MAX_AGE_MS, DRAFT_MAX_CHARS, type Draft, type DraftStore, type DraftStorage, } from './drafts.js';
36
37
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,oBAAoB,WAAW,CAAA;AAE5C,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,aAAa,EACb,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,SAAS,GACV,MAAM,YAAY,CAAA;AAEnB,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAE3D,OAAO,EACL,WAAW,EACX,OAAO,EACP,SAAS,EACT,WAAW,EACX,iBAAiB,EACjB,UAAU,EACV,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,oBAAoB,EACpB,KAAK,QAAQ,GACd,MAAM,eAAe,CAAA;AAEtB,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAA;AAEpE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,eAAe,EAAE,UAAU,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAA;AAE/G,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,KAAK,eAAe,EACp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,aAAa,CAAA"}
package/dist/index.js CHANGED
@@ -12,7 +12,7 @@
12
12
  * apps: it imports no app's data layer, opens no socket, and takes every
13
13
  * environment touch — the relay read, the clock, storage — as a parameter.
14
14
  */
15
- export const CONVERSATION_VERSION = '0.23.1';
15
+ export const CONVERSATION_VERSION = '0.25.0';
16
16
  export { KIND_MESSAGE, KIND_COMMENT, KIND_EDIT, KIND_REACTION, KIND_DELETION, KIND_ASSERTION, isConversationKind, isEventId, } from './kinds.js';
17
17
  export { trustedTs, orderingMs, byOrder } from './order.js';
18
18
  export { namedInBody, isReply, anchorsOf, isCommentOn, referencesAddress, strengthOn, threadStrength, referenceTagsFor, mentionTagsFor, peopleNamedInBody, MAX_MENTIONED_PEOPLE, } from './strength.js';
@@ -24,13 +24,14 @@ export { buildComment, buildReply, offersEditAndDelete, placeOf } from './builde
24
24
  export { eventsNamedInBody, mentionText, messageReference, quoteTagsFor, URGENT_TAG, urgentTagsFor } from './compose.js';
25
25
  export { composerDocument, composerDraft, composerText, withoutNewUrgency, } from './composer.js';
26
26
  export { MAX_PARTS, boxLinksOf, boxReadOf, embedsToEdit, embedsToSend, linkTargetOf, namedBefore, withoutCard, } from './boxCard.js';
27
- export { FILE_TIER, fileReference, MESSAGE_TIER, rankReferences, REFERENCE_CAPS, referenceMatch, referenceSearch, refMatch, } from './references.js';
27
+ export { FILE_TIER, fileReference, MESSAGE_TIER, messageCandidate, rankReferences, REFERENCE_CAPS, referenceMatch, referenceSearch, referenceSectionsOf, refMatch, } from './references.js';
28
28
  export { KIND_CHANGE, MEMBER_FIELD_PREFIX, memberField, memberOfField, mentions, streamOf, membershipOf, membersOf, membershipFilters, candidateFilesOf, buildMembershipChange, MUTED_D_TAG, APPDATA_TAG, parseMutedBlob, serializeMutedBlob, buildMutedEvent, mutedFilter, mutedFromFollowed, } from './membership.js';
29
29
  export { READ_STATE_TAG, READ_STATE_D_PREFIX, MAX_CONTEXTS, MAX_CONTEXT_ID_BYTES, MAX_TIMESTAMP, MAX_CLIENT_ID_BYTES, MAX_BLOB_BYTES, MAX_CONTEXTS_BYTES, READ_STATE_HORIZON_DAYS, channelContext, fileContext, threadContext, messageContext, toContextSeconds, isPublishableContextId, loadSlotIdentity, rotateSlotId, readStateDTag, parseReadStateBlob, serializeReadStateBlob, capContextsToBytes, capReadStateContexts, THREAD_RULE_FROM, REPLY_FLOOR_CONTEXT, advanceContexts, buildReadStateEvent, allSlotsFilter, mergeSlots, classifyOwnSlots, effectiveReadAt, threadReadAt, belowReplyFloor, fetchReadState, createSlotCache, publishReadState, } from './readState.js';
30
30
  export { unreadIn, isUnread } from './unread.js';
31
+ export { streamHasUnread, MEMBERSHIP_LIMIT, HORIZON_SECONDS, membershipQueries, authorOfAddress, foldMemberships, streamTermsOf, membershipJudges, } from './streamUnread.js';
31
32
  export { peopleNamedInText, newlyNamedPeople, mentionAddsFor } from './textMentions.js';
32
33
  export { KIND_MEMBERSHIP_LIST, namedProfilesOf, rosterOf, byName, mentionablePeople } from './people.js';
33
- export { openingWords, referenceWord } from './openingWords.js';
34
+ export { messageWords, openingWords, referenceWord } from './openingWords.js';
34
35
  export { archivedLine } from './archivedLine.js';
35
36
  export { createDraftStore, draftKeys, NO_DRAFTS, DRAFT_MAX_AGE_MS, DRAFT_MAX_CHARS, } from './drafts.js';
36
37
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,QAAQ,CAAA;AAE5C,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,aAAa,EACb,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,SAAS,GACV,MAAM,YAAY,CAAA;AAEnB,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAE3D,OAAO,EACL,WAAW,EACX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M,mBAAmB,CAAA;AAEhD,OAAO,EACL,gBAAgB,EAChB,SAAS,EACT,SAAS,EACT,gBAAgB,EAChB,eAAe,GAIhB,MAAM,aAAa,CAAA"}
@@ -1,5 +1,49 @@
1
+ /**
2
+ * A message's opening words, as a caption — what `[`'s row for a comment
3
+ * shows under its author, and any preview of a message, the same in every app
4
+ * (PEEKM-6).
5
+ *
6
+ * One line of plain words: marks and line prefixes gone, a link on words as
7
+ * its words, a fenced code block's fences dropped. A `nostr:` reference reads
8
+ * as its chip would without resolving anything (SPEC §13.1: "the URI's own
9
+ * label or its shortened form, never blank"):
10
+ *
11
+ * - a person as `@Name`, or `@` and the key's shortened form when nobody here
12
+ * can name them;
13
+ * - a message as "Message", a file by its type word ("Issue", "Project",
14
+ * "Topic", "Document"), any other address as "File" — never by its title,
15
+ * so the same comment reads the same in an app that has the file loaded and
16
+ * one that does not (Miky, 27 October, PEEKM-6's kickoff).
17
+ *
18
+ * A bare app URL that names a file or a message reads as that reference would
19
+ * (§13.6.2, "A bare app link reads as a reference"), never as the raw URL
20
+ * (Katerina, 30 October, widget review item 20). A URL nothing claims stays
21
+ * as written (§13.1), and so does one in code.
22
+ *
23
+ * 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
24
+ */
25
+ import { type LinkResolver } from '@estiva-app/protocol';
26
+ export interface OpeningWordsOptions {
27
+ /**
28
+ * What an app link names (§7.7), as answered so far — the resolver the app
29
+ * gives its box (`BoxLinkContext.resolveLink`). A bare app URL it answers
30
+ * reads as the reference it names ("Issue", "Message"); one it does not —
31
+ * nothing claims it, or the answer has not come back yet — stays as
32
+ * written. Without it, every URL stays as written.
33
+ */
34
+ resolveLink?: LinkResolver;
35
+ }
1
36
  /** What a `nostr:` reference reads as in a caption, by its kind alone, or a person by name. */
2
37
  export declare function referenceWord(uri: string, nameOf: (pubkey: string) => string | undefined): string;
3
38
  /** A message body's opening words on one line, as a caption: see the module's note. */
4
- export declare function openingWords(body: string, nameOf: (pubkey: string) => string | undefined): string;
39
+ export declare function openingWords(body: string, nameOf: (pubkey: string) => string | undefined, options?: OpeningWordsOptions): string;
40
+ /**
41
+ * The words a message is found by in `[` (Katerina, 30 October, widget review
42
+ * item 19): what its writer wrote, read as {@link openingWords} reads it, but
43
+ * with no link's raw text — no bare URL, resolved or not — and no type word
44
+ * for a file or a message it names, so typing a file's word finds the file,
45
+ * not every message that links to it. A link on words keeps its words, a
46
+ * person reads as `@Name`, and code is kept as written.
47
+ */
48
+ export declare function messageWords(body: string, nameOf: (pubkey: string) => string | undefined): string;
5
49
  //# sourceMappingURL=openingWords.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"openingWords.d.ts","sourceRoot":"","sources":["../src/openingWords.ts"],"names":[],"mappings":"AAuCA,+FAA+F;AAC/F,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,GAAG,MAAM,CAoBjG;AAiBD,uFAAuF;AACvF,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,GAAG,MAAM,CAQjG"}
1
+ {"version":3,"file":"openingWords.d.ts","sourceRoot":"","sources":["../src/openingWords.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,EAAgF,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAmBtI,MAAM,WAAW,mBAAmB;IAClC;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,YAAY,CAAA;CAC3B;AAOD,+FAA+F;AAC/F,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,GAAG,MAAM,CAoBjG;AAmFD,uFAAuF;AACvF,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,EAAE,OAAO,GAAE,mBAAwB,GAAG,MAAM,CAEpI;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,GAAG,MAAM,CAEjG"}
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * A message's opening words, as a caption — what `[`'s row for a comment
3
- * shows under its author, the same in every app (PEEKM-6).
3
+ * shows under its author, and any preview of a message, the same in every app
4
+ * (PEEKM-6).
4
5
  *
5
6
  * One line of plain words: marks and line prefixes gone, a link on words as
6
7
  * its words, a fenced code block's fences dropped. A `nostr:` reference reads
@@ -14,9 +15,14 @@
14
15
  * so the same comment reads the same in an app that has the file loaded and
15
16
  * one that does not (Miky, 27 October, PEEKM-6's kickoff).
16
17
  *
18
+ * A bare app URL that names a file or a message reads as that reference would
19
+ * (§13.6.2, "A bare app link reads as a reference"), never as the raw URL
20
+ * (Katerina, 30 October, widget review item 20). A URL nothing claims stays
21
+ * as written (§13.1), and so does one in code.
22
+ *
17
23
  * 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
18
24
  */
19
- import { decodeNpub, parseInlineMarks, referenceToPointer } from '@estiva-app/protocol';
25
+ import { decodeNpub, parseInlineMarks, referenceOfLink, referenceToPointer, urlRunsIn } from '@estiva-app/protocol';
20
26
  /** A file's type word by its kind, as `[`'s Files rows name it. */
21
27
  const TYPE_WORDS = { 30850: 'Project', 30851: 'Issue', 30840: 'Topic', 30842: 'Document', 39000: 'Folder' };
22
28
  const FENCE = /^\s*(?:```|~~~)/;
@@ -29,6 +35,8 @@ const LINE_PREFIX = /^\s*(?:(?:>|#{1,6})\s+)*(?:(?:[-*+]|\d+[.)])\s+(?:\[[ xX]\]
29
35
  */
30
36
  const LINK_ON_WORDS = /(?<!!)\[([^[\]\n]+)\]\(((?:https?:\/\/|mailto:)[^\s)]+)\)/g;
31
37
  const linkWords = (whole, words, url) => (url.split('(').length > url.split(')').length ? whole : words);
38
+ /** A reference to a file or a message: the ones a caption names by a type word, not by anything its writer typed. */
39
+ const OBJECT_REFERENCE = /^nostr:(?:naddr1|nevent1|note1)/i;
32
40
  /** The shortened form §13.1 asks for when a reference names nobody here. */
33
41
  function shortened(uri) {
34
42
  return `${uri.replace(/^nostr:/i, '').slice(0, 12)}…`;
@@ -58,29 +66,87 @@ export function referenceWord(uri, nameOf) {
58
66
  return 'Message';
59
67
  return `@${shortened(uri)}`;
60
68
  }
69
+ /** A character `text` does not hold, from the private use area. */
70
+ function unusedCharacter(text) {
71
+ for (let code = 0xe000; code <= 0xf8ff; code++) {
72
+ const ch = String.fromCharCode(code);
73
+ if (!text.includes(ch))
74
+ return ch;
75
+ }
76
+ return undefined;
77
+ }
78
+ /** A bare URL as the line reads it: the reference's word in a caption, as written in code or when nothing claims it. */
79
+ function urlWord(url, reading) {
80
+ if (reading.code)
81
+ return url;
82
+ if (reading.mode === 'words')
83
+ return '';
84
+ const reference = reading.resolveLink ? referenceOfLink(url, reading.resolveLink) : undefined;
85
+ return reference ? referenceWord(reference, reading.nameOf) : url;
86
+ }
87
+ /** Each bare URL in a run of plain text, as the line reads it; the rest as it is. */
88
+ function withUrlsRead(text, reading) {
89
+ let out = '';
90
+ let at = 0;
91
+ for (const { url, from, to } of urlRunsIn(text)) {
92
+ out += text.slice(at, from) + urlWord(url, reading);
93
+ at = to;
94
+ }
95
+ return out + text.slice(at);
96
+ }
97
+ /** A `nostr:` reference as the line reads it: its word, or nothing in a message's own words when it names a file or a message. */
98
+ function referenceAs(uri, reading) {
99
+ return reading.mode === 'words' && OBJECT_REFERENCE.test(uri) ? '' : referenceWord(uri, reading.nameOf);
100
+ }
61
101
  /**
62
- * One line's words. Protocol's mark reader recurses once per mark, so a line of a few thousand (anyone can post one)
63
- * overflows the stack; that line then reads as its text with the marker characters dropped, rather than taking down
64
- * every `[` list that captions it (Peek: Feedback & Bugs 4acb43ac is the reader's own fix).
102
+ * One line's words. A bare URL is found in the text the marks leave, as a reader finds it (`urlRunsIn`), and read by
103
+ * {@link urlWord}. A URL written in a link's words names nothing (§13.6.2), so its `://` is broken by a character the
104
+ * line does not hold until the line is read. Protocol's mark reader recurses once per mark, so a line of a few thousand
105
+ * (anyone can post one) overflows the stack; that line then reads as its text with the marker characters dropped,
106
+ * rather than taking down every `[` list that captions it (Peek: Feedback & Bugs 4acb43ac is the reader's own fix).
65
107
  */
66
- function lineWords(line, nameOf) {
108
+ function lineWords(line, reading) {
109
+ const mark = line.includes('://') ? unusedCharacter(line) : undefined;
110
+ const text = line.replace(LINK_ON_WORDS, (whole, words, url) => {
111
+ const read = linkWords(whole, words, url);
112
+ return read !== whole && mark ? read.replaceAll('://', `:${mark}//`) : read;
113
+ });
114
+ const unmark = (words) => (mark ? words.replaceAll(mark, '') : words);
67
115
  try {
68
- return parseInlineMarks(line)
69
- .map((span) => (span.reference ? referenceWord(span.reference, nameOf) : span.text))
116
+ return parseInlineMarks(text)
117
+ .map((span) => (span.reference ? referenceAs(span.reference, reading) : unmark(span.code ? span.text : withUrlsRead(span.text, reading))))
70
118
  .join('');
71
119
  }
72
120
  catch {
73
- return line.replace(/[*_~`]+/g, '');
121
+ return unmark(withUrlsRead(text.replace(/[*_~`]+/g, ''), reading));
74
122
  }
75
123
  }
124
+ /** A body's lines on one line, read as `reading` says, a code block's fences dropped. */
125
+ function bodyWords(body, reading) {
126
+ let inCode = false;
127
+ const lines = [];
128
+ for (const line of body.split('\n')) {
129
+ if (FENCE.test(line)) {
130
+ inCode = !inCode;
131
+ continue;
132
+ }
133
+ lines.push(lineWords(line.replace(LINE_PREFIX, ''), { ...reading, code: inCode }));
134
+ }
135
+ return lines.join(' ').replace(/\s+/g, ' ').trim();
136
+ }
76
137
  /** A message body's opening words on one line, as a caption: see the module's note. */
77
- export function openingWords(body, nameOf) {
78
- return body
79
- .split('\n')
80
- .filter((line) => !FENCE.test(line))
81
- .map((line) => lineWords(line.replace(LINE_PREFIX, '').replace(LINK_ON_WORDS, linkWords), nameOf))
82
- .join(' ')
83
- .replace(/\s+/g, ' ')
84
- .trim();
138
+ export function openingWords(body, nameOf, options = {}) {
139
+ return bodyWords(body, { mode: 'caption', nameOf, resolveLink: options.resolveLink });
140
+ }
141
+ /**
142
+ * The words a message is found by in `[` (Katerina, 30 October, widget review
143
+ * item 19): what its writer wrote, read as {@link openingWords} reads it, but
144
+ * with no link's raw text — no bare URL, resolved or not — and no type word
145
+ * for a file or a message it names, so typing a file's word finds the file,
146
+ * not every message that links to it. A link on words keeps its words, a
147
+ * person reads as `@Name`, and code is kept as written.
148
+ */
149
+ export function messageWords(body, nameOf) {
150
+ return bodyWords(body, { mode: 'words', nameOf });
85
151
  }
86
152
  //# sourceMappingURL=openingWords.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"openingWords.js","sourceRoot":"","sources":["../src/openingWords.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAEvF,mEAAmE;AACnE,MAAM,UAAU,GAA2B,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAA;AAEnI,MAAM,KAAK,GAAG,iBAAiB,CAAA;AAC/B,kFAAkF;AAClF,MAAM,WAAW,GAAG,oEAAoE,CAAA;AACxF;;;;GAIG;AACH,MAAM,aAAa,GAAG,4DAA4D,CAAA;AAClF,MAAM,SAAS,GAAG,CAAC,KAAa,EAAE,KAAa,EAAE,GAAW,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAA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AC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAA;AACpD,CAAC;AAED,uFAAuF;AACvF,MAAM,UAAU,YAAY,CAAC,IAAY,EAAE,MAA8C,EAAE,UAA+B,EAAE;IAC1H,OAAO,SAAS,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,CAAC,CAAA;AACvF,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAAC,IAAY,EAAE,MAA8C;IACvF,OAAO,SAAS,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAA;AACnD,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { type OpeningWordsOptions } from './openingWords.js';
1
2
  /** What a reference names, as the row's type word says it (label objects by type, not app). */
2
3
  export type ReferenceType = 'message' | 'issue' | 'project' | 'topic' | 'document';
3
4
  /** Something `[` can offer. */
@@ -18,7 +19,10 @@ export interface ReferenceCandidate {
18
19
  * none, and on a message. Not matched: search keeps to titles.
19
20
  */
20
21
  summary?: string;
21
- /** Matched beside `title`: a message's text, an issue's ref (`CON-33`). */
22
+ /**
23
+ * Matched beside `title`: a message's own words ({@link messageWords}), an
24
+ * issue's ref (`CON-33`). A message without it is matched on `caption`.
25
+ */
22
26
  search?: string;
23
27
  /** 0 is closest: {@link MESSAGE_TIER} or {@link FILE_TIER}. */
24
28
  tier: number;
@@ -52,6 +56,37 @@ export interface RankedReferences {
52
56
  messages: ReferenceCandidate[];
53
57
  files: ReferenceCandidate[];
54
58
  }
59
+ /** One of `[`'s sections, by name: the app gives it its heading. */
60
+ export interface RankedSection {
61
+ name: 'files' | 'messages';
62
+ items: ReferenceCandidate[];
63
+ }
64
+ /**
65
+ * {@link rankReferences}' sections in the order `[` draws them: Files, then
66
+ * Messages (Katerina, 2026-10-30), in every app. An empty one is kept: the
67
+ * menu draws no heading for it.
68
+ */
69
+ export declare function referenceSectionsOf(ranked: RankedReferences): RankedSection[];
70
+ /** A message `[` can offer, as the app holds it. */
71
+ export interface ReferableMessage {
72
+ /** Its event id. */
73
+ id: string;
74
+ /** Its kind, carried in the reference so a reader fetches the right thing: 9 for chat, 1111 for a comment. */
75
+ kind: number;
76
+ /** Who wrote it, as the row names them. */
77
+ author: string;
78
+ body: string;
79
+ /** When it was written, in seconds, or any number that is higher for a newer one. */
80
+ at?: number;
81
+ }
82
+ /**
83
+ * A message as `[`'s row offers it, the same in every app: its reference
84
+ * (`messageReference`), its author as the title, its opening words as the
85
+ * caption ({@link openingWords}, an app link read as what it names when
86
+ * `resolveLink` has answered for it), and its own words to be found by
87
+ * ({@link messageWords}) — not the raw text of a link in it.
88
+ */
89
+ export declare function messageCandidate(message: ReferableMessage, tier: number, nameOf: (pubkey: string) => string | undefined, options?: OpeningWordsOptions): ReferenceCandidate;
55
90
  export interface RankReferencesInput {
56
91
  messages: readonly ReferenceCandidate[];
57
92
  files: readonly ReferenceCandidate[];