@estiva-app/conversation 0.12.0 → 0.14.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,37 @@ 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.14.0 — 2026-10-19
10
+
11
+ **A reply to a comment on part of a page copies that comment's place**
12
+ (COMM-5). `CommentRef.place` takes the comment's `block` and `quote` tags, and
13
+ `buildReply` writes them verbatim after its `p`, before its `h`; any other tag
14
+ handed to it, and any `block` or `quote` among the reply's own `tags`, is
15
+ dropped. `placeOf(comment)` reads a comment's place off its event. So a thread
16
+ keeps its place on the page when its comment is deleted, and an app holding
17
+ only a reply can place it (record *a-reply-on-a-page-keeps-its-threads-place*).
18
+ A caller that passes no `place` writes the reply as before.
19
+
20
+ SPEC: §13.6 changed — a reply now copies its top-level comment's `block` and
21
+ `quote` instead of carrying none; a reader places a thread by its comment's
22
+ anchor while it is readable, else by its earliest reply's.
23
+
24
+ ## 0.13.0 — 2026-10-17
25
+
26
+ **What the shared comment box holds, as the message it writes, and back**
27
+ (COMM-2). `@estiva-app/ui/editor`'s `CommentBox` hands its app the editor's
28
+ document; `composerText(doc)` is the trimmed marker text a send writes and the
29
+ keys its urgent chips name, for `urgentTagsFor`. `composerDocument(text,
30
+ labels, urgent?)` opens an edit or a draft with its people and references as
31
+ chips again, and leaves as a `reference` whatever the app cannot name, or one
32
+ with marks or a card. `withoutNewUrgency` (an edit makes nobody newly urgent)
33
+ and `composerDraft(store, key, labels)` (a `DraftStore` in the box's terms)
34
+ come with them. Moved from Ship's `composerTriggers.tsx`, byte for byte in what
35
+ they write, so every app's box writes the same text.
36
+
37
+ SPEC: none changed how this package reads or writes; §13.1 is written as
38
+ before.
39
+
9
40
  ## 0.12.0 — 2026-10-16
10
41
 
11
42
  **A `[` row carries the file's summary, and a Leaf page is a type `[` names**
package/README.md CHANGED
@@ -24,8 +24,9 @@ pass, the clock is a `createdAtMs` you pass, and drafts take their storage.
24
24
  | --- | --- | --- |
25
25
  | comment or mention | §6.4 | `isCommentOn`, `strengthOn`, `threadStrength`, `anchorsOf`, `isReply`, `namedInBody` |
26
26
  | threading | §6.4 *Replies* | `parentOf`, `groupThreads` |
27
- | writing | §6.4 | `buildComment`, `buildReply`, `referenceTagsFor`, `mentionTagsFor` |
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
+ | what the shared comment box holds, as the message it writes, and back | §13.1 | `composerText`, `composerDocument`, `withoutNewUrgency`, `composerDraft` |
29
30
  | what `[` offers, and in what order | §13.1 | `rankReferences`, `referenceMatch`, `fileReference`, `referenceSearch`, `MESSAGE_TIER`, `FILE_TIER`, `REFERENCE_CAPS` |
30
31
  | ordering | §6.2, §6.3 | `trustedTs`, `orderingMs`, `byOrder` |
31
32
  | edits and attachments | §6.8 | `editTargetOf`, `foldEdits`, `foldAttachments` |
@@ -38,15 +38,35 @@ export interface CommentRef {
38
38
  * then carries no `p`, because a wrong one notifies the wrong person.
39
39
  */
40
40
  author?: string;
41
+ /**
42
+ * Where on its object the comment is: its own `block` and `quote` tags
43
+ * ({@link placeOf}). The reply copies them, so its thread keeps its place
44
+ * once the comment is deleted (§13.6). Absent when the comment is on the
45
+ * whole object or outside the read.
46
+ */
47
+ place?: readonly NostrTag[];
41
48
  }
49
+ /**
50
+ * A comment's place, as its event carries it: its `block` and `quote` tags,
51
+ * verbatim, for {@link CommentRef.place}. Empty when it is on the whole object.
52
+ *
53
+ * why: https://github.com/estiva-app/estiva-docs/blob/main/decisions/a-reply-on-a-page-keeps-its-threads-place.md
54
+ */
55
+ export declare function placeOf(comment: {
56
+ tags: readonly NostrTag[];
57
+ }): NostrTag[];
42
58
  /**
43
59
  * A reply to a comment — §6.4 *Replies*, C16. Tag order: `A`, `K`, `P`, `e`,
44
- * `k`, `[p]`, `h`, `ts`, `[imeta…]`, then `tags`.
60
+ * `k`, `[p]`, `[block, quote]`, `h`, `ts`, `[imeta…]`, then `tags`.
45
61
  *
46
62
  * **Flat, one level deep**: `e` names the thread's top-level comment, never
47
63
  * another reply. **No lowercase `a`** for the object: NIP-22 reads it as the
48
64
  * parent, so it would claim the reply is itself a top-level comment. The reply
49
- * is found by `#e` on the comment.
65
+ * is found by `#e` on the comment. **Its comment's place, copied** (§13.6):
66
+ * the `block` and `quote` tags of `comment.place` as written, and no other
67
+ * tag from it.
68
+ *
69
+ * why: https://github.com/estiva-app/estiva-docs/blob/main/decisions/a-reply-on-a-page-keeps-its-threads-place.md
50
70
  */
51
71
  export declare function buildReply(pubkey: string, createdAtMs: number, args: {
52
72
  comment: CommentRef;
@@ -1 +1 @@
1
- {"version":3,"file":"builders.d.ts","sourceRoot":"","sources":["../src/builders.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAA4B,KAAK,KAAK,EAAE,KAAK,QAAQ,EAAE,KAAK,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAmB9G;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,SAAS,KAAK,EAAE,CAAC;IAAC,IAAI,CAAC,EAAE,SAAS,QAAQ,EAAE,CAAA;CAAE,GAC5H,aAAa,CAsBf;AAED,6CAA6C;AAC7C,MAAM,WAAW,UAAU;IACzB,oBAAoB;IACpB,EAAE,EAAE,MAAM,CAAA;IACV,+CAA+C;IAC/C,MAAM,EAAE,MAA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IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;;;;OAKG;IACH,KAAK,CAAC,EAAE,SAAS,QAAQ,EAAE,CAAA;CAC5B;AAKD;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE;IAAE,IAAI,EAAE,SAAS,QAAQ,EAAE,CAAA;CAAE,GAAG,QAAQ,EAAE,CAG1E;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,UAAU,CACxB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE;IAAE,OAAO,EAAE,UAAU,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,SAAS,KAAK,EAAE,CAAC;IAAC,IAAI,CAAC,EAAE,SAAS,QAAQ,EAAE,CAAA;CAAE,GAChH,aAAa,CAuBf;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE;IAAE,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAExG"}
package/dist/builders.js CHANGED
@@ -59,19 +59,35 @@ export function buildComment(pubkey, createdAtMs, args) {
59
59
  content: args.body,
60
60
  };
61
61
  }
62
+ /** The tags that say where on its object a comment is (§13.6): `block` and `quote`. */
63
+ const PLACE_TAGS = new Set(['block', 'quote']);
64
+ /**
65
+ * A comment's place, as its event carries it: its `block` and `quote` tags,
66
+ * verbatim, for {@link CommentRef.place}. Empty when it is on the whole object.
67
+ *
68
+ * why: https://github.com/estiva-app/estiva-docs/blob/main/decisions/a-reply-on-a-page-keeps-its-threads-place.md
69
+ */
70
+ export function placeOf(comment) {
71
+ // One of each, the first, as every reader reads it: a stranger's extra tags are not copied under the replier's key.
72
+ return [...PLACE_TAGS].map((name) => comment.tags.find((t) => t[0] === name)).filter((t) => !!t);
73
+ }
62
74
  /**
63
75
  * A reply to a comment — §6.4 *Replies*, C16. Tag order: `A`, `K`, `P`, `e`,
64
- * `k`, `[p]`, `h`, `ts`, `[imeta…]`, then `tags`.
76
+ * `k`, `[p]`, `[block, quote]`, `h`, `ts`, `[imeta…]`, then `tags`.
65
77
  *
66
78
  * **Flat, one level deep**: `e` names the thread's top-level comment, never
67
79
  * another reply. **No lowercase `a`** for the object: NIP-22 reads it as the
68
80
  * parent, so it would claim the reply is itself a top-level comment. The reply
69
- * is found by `#e` on the comment.
81
+ * is found by `#e` on the comment. **Its comment's place, copied** (§13.6):
82
+ * the `block` and `quote` tags of `comment.place` as written, and no other
83
+ * tag from it.
84
+ *
85
+ * why: https://github.com/estiva-app/estiva-docs/blob/main/decisions/a-reply-on-a-page-keeps-its-threads-place.md
70
86
  */
71
87
  export function buildReply(pubkey, createdAtMs, args) {
72
88
  assertFolder(args.folder);
73
89
  const [kind, author] = kindAndAuthor(args.comment.anchor);
74
- const earned = (args.tags ?? []).filter((t) => !(t[0] === 'a' && t[1] === args.comment.anchor));
90
+ const earned = (args.tags ?? []).filter((t) => !(t[0] === 'a' && t[1] === args.comment.anchor) && !PLACE_TAGS.has(t[0]));
75
91
  return {
76
92
  pubkey,
77
93
  created_at: toNostrSeconds(createdAtMs),
@@ -83,6 +99,7 @@ export function buildReply(pubkey, createdAtMs, args) {
83
99
  ['e', args.comment.id],
84
100
  ['k', String(KIND_COMMENT)],
85
101
  ...(args.comment.author ? [['p', args.comment.author]] : []),
102
+ ...(args.comment.place ? placeOf({ tags: args.comment.place }).map((t) => [...t]) : []),
86
103
  ['h', args.folder],
87
104
  ['ts', String(Math.floor(createdAtMs))],
88
105
  ...(args.files ?? []).map(imetaTag),
@@ -1 +1 @@
1
- {"version":3,"file":"builders.js","sourceRoot":"","sources":["../src/builders.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAiD,MAAM,sBAAsB,CAAA;AAC9G,OAAO,EAAE,SAAS,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tB,CAAC,GAAG,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC;YAC3B,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YAC5D,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YACvF,CAAC,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC;YAClB,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC;YACvC,GAAG,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC;YACnC,GAAG,MAAM;SACV;QACD,OAAO,EAAE,IAAI,CAAC,IAAI;KACnB,CAAA;AACH,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAA2D;IAC7F,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM,CAAA;AACrD,CAAC"}
@@ -0,0 +1,80 @@
1
+ /**
2
+ * What the shared comment box holds, as the message it writes, and back
3
+ * (COMM-2).
4
+ *
5
+ * The box is `@estiva-app/ui/editor`'s `CommentBox`, and it hands its app the
6
+ * editor's document: a person as a `mention` or `urgentMention` chip, a
7
+ * message or a file as a `captionedReference` chip. That package depends on no
8
+ * protocol package, so the translation is here, once, for every app — Ship
9
+ * wrote it itself until now (`chipsAsReferences`, `withoutNewUrgency`,
10
+ * `urgentChipsFrom`), and Peek and Leaf each would have again.
11
+ *
12
+ * - {@link composerText}: the document → the marker text a send writes, and the
13
+ * people it names urgently (what {@link urgentTagsFor} takes).
14
+ * - {@link composerDocument}: marker text → the document an edit or a draft
15
+ * opens with, the people and references as chips again.
16
+ * - {@link withoutNewUrgency}: an edit's text, making nobody newly urgent.
17
+ * - {@link composerDraft}: a {@link DraftStore} as the box reads and writes it.
18
+ *
19
+ * why: https://github.com/estiva-app/estiva-docs/blob/main/decisions/every-app-writes-and-reacts-with-one-shared-box.md
20
+ */
21
+ import { type EditorDocument, type EditorNode } from '@estiva-app/protocol';
22
+ import type { DraftStore } from './drafts.js';
23
+ /** What a composer's document writes: the trimmed marker text, and whom it names urgently. */
24
+ export interface ComposerText {
25
+ text: string;
26
+ /** The keys its urgent chips name, once each; absent when none do. What `urgentTagsFor` takes. */
27
+ urgent?: string[];
28
+ }
29
+ /**
30
+ * The message a composer's document writes: its marker text, trimmed, and the
31
+ * keys its urgent chips name. A document with no blocks (an edit of a message
32
+ * that is only files starts as one) is no text.
33
+ *
34
+ * The send then earns its tags from these, as before: `mentionTagsFor`,
35
+ * `urgentTagsFor(text, urgent)`, `quoteTagsFor`, `referenceTagsFor`.
36
+ */
37
+ export declare function composerText(doc: EditorDocument | EditorNode): ComposerText;
38
+ /** What a composer needs to draw marker text as chips again. Each answers `undefined` for what it does not know. */
39
+ export interface ComposerLabels {
40
+ /** A person's name, by key: their `nostr:npub…` becomes a chip again. */
41
+ personLabel?: (pubkey: string) => string | undefined;
42
+ /** A message's or a file's chip, by its `nostr:` URI, as `[` captioned it. */
43
+ referenceCaption?: (uri: string) => {
44
+ label: string;
45
+ snippet: string;
46
+ } | undefined;
47
+ }
48
+ /**
49
+ * The document a composer opens with for marker text — an edit's or a draft's.
50
+ *
51
+ * A person written as `nostr:npub…` becomes a `mention` chip again, or an
52
+ * `urgentMention` one when `urgent` names them (§13.1 keeps the urgency in a
53
+ * tag, so marker text alone cannot say it); a message or a file becomes its
54
+ * `captionedReference` chip. Whatever `labels` does not know stays the
55
+ * `reference` it was, and so does one with marks or a card, which a chip
56
+ * would lose.
57
+ */
58
+ export declare function composerDocument(text: string, labels?: ComposerLabels, urgent?: readonly string[]): EditorDocument;
59
+ /**
60
+ * An edit's text with any `!@Name` the message did not already hold written as
61
+ * an ordinary `@Name` — CON-24. An edit carries no tags, so it makes nobody
62
+ * urgent (Miky, kickoff, 2026-10-07); a hand-typed `!@Name` is the old urgent
63
+ * text, which Peek still draws urgent while it pages nobody.
64
+ */
65
+ export declare function withoutNewUrgency(text: string, original: string): string;
66
+ /** One composer's draft, in the composer's own terms. */
67
+ export interface ComposerDraft {
68
+ /** The document to open with, or `undefined` when there is no draft. */
69
+ read(): EditorDocument | undefined;
70
+ /** Keep what is written; an empty document clears the draft. */
71
+ write(doc: EditorDocument): void;
72
+ clear(): void;
73
+ }
74
+ /**
75
+ * A draft kept in `store` under `key` (one of `draftKeys`), read and written as
76
+ * the composer's document: the marker text and the urgent picks (CON-31), and
77
+ * the chips back through {@link composerDocument}.
78
+ */
79
+ export declare function composerDraft(store: DraftStore, key: string, labels?: ComposerLabels): ComposerDraft;
80
+ //# sourceMappingURL=composer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composer.d.ts","sourceRoot":"","sources":["../src/composer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAML,KAAK,cAAc,EACnB,KAAK,UAAU,EAChB,MAAM,sBAAsB,CAAA;AAE7B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAE7C,8FAA8F;AAC9F,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,kGAAkG;IAClG,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;CAClB;AA4BD;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,cAAc,GAAG,UAAU,GAAG,YAAY,CAY3E;AAED,oHAAoH;AACpH,MAAM,WAAW,cAAc;IAC7B,yEAAyE;IACzE,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAA;IACpD,8EAA8E;IAC9E,gBAAgB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAA;CACnF;AAWD;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,GAAE,cAAmB,EAAE,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,cAAc,CAuBtH;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAExE;AAED,yDAAyD;AACzD,MAAM,WAAW,aAAa;IAC5B,wEAAwE;IACxE,IAAI,IAAI,cAAc,GAAG,SAAS,CAAA;IAClC,gEAAgE;IAChE,KAAK,CAAC,GAAG,EAAE,cAAc,GAAG,IAAI,CAAA;IAChC,KAAK,IAAI,IAAI,CAAA;CACd;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,GAAE,cAAmB,GAAG,aAAa,CAcxG"}
@@ -0,0 +1,145 @@
1
+ /**
2
+ * What the shared comment box holds, as the message it writes, and back
3
+ * (COMM-2).
4
+ *
5
+ * The box is `@estiva-app/ui/editor`'s `CommentBox`, and it hands its app the
6
+ * editor's document: a person as a `mention` or `urgentMention` chip, a
7
+ * message or a file as a `captionedReference` chip. That package depends on no
8
+ * protocol package, so the translation is here, once, for every app — Ship
9
+ * wrote it itself until now (`chipsAsReferences`, `withoutNewUrgency`,
10
+ * `urgentChipsFrom`), and Peek and Leaf each would have again.
11
+ *
12
+ * - {@link composerText}: the document → the marker text a send writes, and the
13
+ * people it names urgently (what {@link urgentTagsFor} takes).
14
+ * - {@link composerDocument}: marker text → the document an edit or a draft
15
+ * opens with, the people and references as chips again.
16
+ * - {@link withoutNewUrgency}: an edit's text, making nobody newly urgent.
17
+ * - {@link composerDraft}: a {@link DraftStore} as the box reads and writes it.
18
+ *
19
+ * why: https://github.com/estiva-app/estiva-docs/blob/main/decisions/every-app-writes-and-reacts-with-one-shared-box.md
20
+ */
21
+ import { blockDocumentToMarkerText, decodeNpub, documentForEditing, fromEditorDocument, toEditorDocument, } from '@estiva-app/protocol';
22
+ import { mentionText } from './compose.js';
23
+ const HEX_KEY = /^[0-9a-f]{64}$/;
24
+ const keyOf = (node) => {
25
+ const pubkey = node.attrs?.pubkey;
26
+ return typeof pubkey === 'string' && HEX_KEY.test(pubkey) ? pubkey : null;
27
+ };
28
+ /**
29
+ * The chips as the block bridge can write them. `fromEditorDocument` knows a
30
+ * `reference` and drops any inline node it does not, so a picked person would
31
+ * vanish from the message: a chip becomes the `reference` its `nostr:` text
32
+ * names (§13.1), or `@Name` / `!@Name` for somebody with no key.
33
+ */
34
+ function chipsAsReferences(node) {
35
+ if (node.type === 'mention' || node.type === 'urgentMention') {
36
+ const pubkey = keyOf(node);
37
+ const written = mentionText({ pubkey, label: String(node.attrs?.label ?? '') }, node.type === 'urgentMention');
38
+ return pubkey ? { type: 'reference', attrs: { uri: written } } : { type: 'text', text: written };
39
+ }
40
+ if (node.type === 'captionedReference') {
41
+ const uri = typeof node.attrs?.uri === 'string' ? node.attrs.uri : '';
42
+ return uri ? { type: 'reference', attrs: { uri } } : { type: 'text', text: String(node.attrs?.label ?? '') };
43
+ }
44
+ return node.content ? { ...node, content: node.content.map(chipsAsReferences) } : node;
45
+ }
46
+ /**
47
+ * The message a composer's document writes: its marker text, trimmed, and the
48
+ * keys its urgent chips name. A document with no blocks (an edit of a message
49
+ * that is only files starts as one) is no text.
50
+ *
51
+ * The send then earns its tags from these, as before: `mentionTagsFor`,
52
+ * `urgentTagsFor(text, urgent)`, `quoteTagsFor`, `referenceTagsFor`.
53
+ */
54
+ export function composerText(doc) {
55
+ const urgent = new Set();
56
+ const walk = (node) => {
57
+ if (node.type === 'urgentMention') {
58
+ const pubkey = keyOf(node);
59
+ if (pubkey)
60
+ urgent.add(pubkey);
61
+ }
62
+ node.content?.forEach(walk);
63
+ };
64
+ walk(doc);
65
+ const text = doc.content?.length ? blockDocumentToMarkerText(fromEditorDocument(chipsAsReferences(doc))).trim() : '';
66
+ return urgent.size > 0 ? { text, urgent: [...urgent] } : { text };
67
+ }
68
+ /** A reference that carries nothing a chip would drop: no marks, no card, no URL. */
69
+ const plainReference = (node) => {
70
+ if (node.type !== 'reference')
71
+ return null;
72
+ const { uri, marks, embed, extra, href } = node.attrs ?? {};
73
+ if (typeof uri !== 'string' || !uri)
74
+ return null;
75
+ if ((Array.isArray(marks) && marks.length > 0) || embed || extra || href)
76
+ return null;
77
+ return uri;
78
+ };
79
+ /**
80
+ * The document a composer opens with for marker text — an edit's or a draft's.
81
+ *
82
+ * A person written as `nostr:npub…` becomes a `mention` chip again, or an
83
+ * `urgentMention` one when `urgent` names them (§13.1 keeps the urgency in a
84
+ * tag, so marker text alone cannot say it); a message or a file becomes its
85
+ * `captionedReference` chip. Whatever `labels` does not know stays the
86
+ * `reference` it was, and so does one with marks or a card, which a chip
87
+ * would lose.
88
+ */
89
+ export function composerDocument(text, labels = {}, urgent) {
90
+ const keys = new Set(urgent ?? []);
91
+ const walk = (node) => {
92
+ const uri = plainReference(node);
93
+ if (uri && /^nostr:npub1/i.test(uri)) {
94
+ let pubkey = null;
95
+ try {
96
+ pubkey = decodeNpub(uri.slice('nostr:'.length).toLowerCase());
97
+ }
98
+ catch {
99
+ pubkey = null;
100
+ }
101
+ const label = pubkey ? labels.personLabel?.(pubkey) : undefined;
102
+ if (pubkey && label !== undefined)
103
+ return { type: keys.has(pubkey) ? 'urgentMention' : 'mention', attrs: { id: pubkey, label, pubkey } };
104
+ return node;
105
+ }
106
+ if (uri) {
107
+ const caption = labels.referenceCaption?.(uri);
108
+ if (caption)
109
+ return { type: 'captionedReference', attrs: { id: uri, label: caption.label, snippet: caption.snippet, uri } };
110
+ return node;
111
+ }
112
+ return node.content ? { ...node, content: node.content.map(walk) } : node;
113
+ };
114
+ return walk(toEditorDocument(documentForEditing(text, 'marker')));
115
+ }
116
+ /**
117
+ * An edit's text with any `!@Name` the message did not already hold written as
118
+ * an ordinary `@Name` — CON-24. An edit carries no tags, so it makes nobody
119
+ * urgent (Miky, kickoff, 2026-10-07); a hand-typed `!@Name` is the old urgent
120
+ * text, which Peek still draws urgent while it pages nobody.
121
+ */
122
+ export function withoutNewUrgency(text, original) {
123
+ return text.replace(/!@([^\s!@]+)/g, (whole, name) => (original.includes(whole) ? whole : `@${name}`));
124
+ }
125
+ /**
126
+ * A draft kept in `store` under `key` (one of `draftKeys`), read and written as
127
+ * the composer's document: the marker text and the urgent picks (CON-31), and
128
+ * the chips back through {@link composerDocument}.
129
+ */
130
+ export function composerDraft(store, key, labels = {}) {
131
+ return {
132
+ read() {
133
+ const draft = store.readDraft(key);
134
+ return draft && draft.text.trim() ? composerDocument(draft.text, labels, draft.urgent) : undefined;
135
+ },
136
+ write(doc) {
137
+ const { text, urgent } = composerText(doc);
138
+ store.write(key, text, urgent);
139
+ },
140
+ clear() {
141
+ store.clear(key);
142
+ },
143
+ };
144
+ }
145
+ //# sourceMappingURL=composer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composer.js","sourceRoot":"","sources":["../src/composer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EACL,yBAAyB,EACzB,UAAU,EACV,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,GAGjB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAU1C,MAAM,OAAO,GAAG,gBAAgB,CAAA;AAEhC,MAAM,KAAK,GAAG,CAAC,IAAgB,EAAiB,EAAE;IAChD,MAAM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AAC,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;QACpG,CAAC;QACD,KAAK,CAAC,GAAG;YACP,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,YAAY,CAAC,GAAG,CAAC,CAAA;YAC1C,KAAK,CAAC,KAAK,CAAC,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,CAAA;QAChC,CAAC;QACD,KAAK;YACH,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QAClB,CAAC;KACF,CAAA;AACH,CAAC"}
package/dist/edits.d.ts CHANGED
@@ -81,7 +81,7 @@ export declare function foldAttachments(events: readonly SignedEvent[]): Record<
81
81
  * edit removes a card. Which of these the body still names is
82
82
  * `cardsIn`'s question, asked of the folded body. Messages with none are absent.
83
83
  *
84
- * why: https://github.com/estiva-app/estiva-docs/blob/main/decisions/where-a-link-sits-decides-how-it-draws.md
84
+ * why: https://github.com/estiva-app/estiva-docs/blob/main/decisions/a-link-on-words-counts-toward-the-card.md
85
85
  */
86
86
  export declare function foldEmbeds(events: readonly SignedEvent[]): Record<string, Embed[]>;
87
87
  //# sourceMappingURL=edits.d.ts.map
package/dist/edits.js CHANGED
@@ -128,7 +128,7 @@ export function foldAttachments(events) {
128
128
  * edit removes a card. Which of these the body still names is
129
129
  * `cardsIn`'s question, asked of the folded body. Messages with none are absent.
130
130
  *
131
- * why: https://github.com/estiva-app/estiva-docs/blob/main/decisions/where-a-link-sits-decides-how-it-draws.md
131
+ * why: https://github.com/estiva-app/estiva-docs/blob/main/decisions/a-link-on-words-counts-toward-the-card.md
132
132
  */
133
133
  export function foldEmbeds(events) {
134
134
  const out = {};
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.12.0";
15
+ export declare const CONVERSATION_VERSION = "0.14.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';
@@ -20,8 +20,9 @@ export { parentOf, groupThreads, type Threaded } from './threads.js';
20
20
  export { editTargetOf, editsByTarget, foldEdits, foldAttachments, foldEmbeds, type EditFold } from './edits.js';
21
21
  export { REACTION_HORIZON, REACTION_EMOJI, reactionTargetOf, reactionEmojiOf, reactionHorizon, reactionEventsOf, foldReactions, groupReactions, type ReactionHorizon, type ReactionEvent, type Reaction, } from './reactions.js';
22
22
  export { decorationsOf, type Decoration, type Decorations, type Resolution, type QueryFn } from './decorations.js';
23
- export { buildComment, buildReply, offersEditAndDelete, type CommentRef } from './builders.js';
23
+ export { buildComment, buildReply, offersEditAndDelete, placeOf, type CommentRef } from './builders.js';
24
24
  export { eventsNamedInBody, mentionText, messageReference, quoteTagsFor, URGENT_TAG, urgentTagsFor } from './compose.js';
25
+ export { composerDocument, composerDraft, composerText, withoutNewUrgency, type ComposerDraft, type ComposerLabels, type ComposerText, } from './composer.js';
25
26
  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';
26
27
  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';
27
28
  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';
@@ -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,EA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pB,aAAa,EACb,mBAAmB,EACnB,cAAc,EACd,kBAAkB,EAClB,uBAAuB,EACvB,cAAc,EACd,WAAW,EACX,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,kBAAkB,EAClB,sBAAsB,EACtB,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,mBAAmB,EACnB,cAAc,EACd,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,eAAe,EACf,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,QAAQ,EACb,KAAK,cAAc,EACnB,KAAK,KAAK,EACV,KAAK,gBAAgB,GACtB,MAAM,gBAAgB,CAAA;AAEvB,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAA;AAElE,OAAO,EACL,gBAAgB,EAChB,SAAS,EACT,SAAS,EACT,gBAAgB,EAChB,eAAe,EACf,KAAK,KAAK,EACV,KAAK,UAAU,EACf,KAAK,YAAY,GAClB,MAAM,aAAa,CAAA"}
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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,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.12.0';
15
+ export const CONVERSATION_VERSION = '0.14.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';
@@ -20,8 +20,9 @@ export { parentOf, groupThreads } from './threads.js';
20
20
  export { editTargetOf, editsByTarget, foldEdits, foldAttachments, foldEmbeds } from './edits.js';
21
21
  export { REACTION_HORIZON, REACTION_EMOJI, reactionTargetOf, reactionEmojiOf, reactionHorizon, reactionEventsOf, foldReactions, groupReactions, } from './reactions.js';
22
22
  export { decorationsOf } from './decorations.js';
23
- export { buildComment, buildReply, offersEditAndDelete } from './builders.js';
23
+ export { buildComment, buildReply, offersEditAndDelete, placeOf } from './builders.js';
24
24
  export { eventsNamedInBody, mentionText, messageReference, quoteTagsFor, URGENT_TAG, urgentTagsFor } from './compose.js';
25
+ export { composerDocument, composerDraft, composerText, withoutNewUrgency, } from './composer.js';
25
26
  export { FILE_TIER, fileReference, MESSAGE_TIER, rankReferences, REFERENCE_CAPS, referenceMatch, referenceSearch, refMatch, } from './references.js';
26
27
  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';
27
28
  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';
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,OAAO,EACP,SAAS,EACT,WAAW,EACX,iBAAiB,EACjB,UAAU,EACV,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,oBAAoB,GAErB,MAAM,eAAe,CAAA;AAEtB,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAiB,MAAM,cAAc,CAAA;AAEpE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,eAAe,EAAE,UAAU,EAAiB,MAAM,YAAY,CAAA;AAE/G,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,cAAc,GAI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O,EACL,SAAS,EACT,aAAa,EACb,YAAY,EACZ,cAAc,EACd,cAAc,EACd,cAAc,EACd,eAAe,EACf,QAAQ,GAQT,MAAM,iBAAiB,CAAA;AAExB,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,WAAW,EACX,aAAa,EACb,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,SAAS,EACT,iBAAiB,EACjB,gBAAgB,EAChB,qBAAqB,EACrB,WAAW,EACX,WAAW,EACX,cAAc,EACd,kBAAkB,EAClB,eAAe,EACf,WAAW,EACX,iBAAiB,GAGlB,MAAM,iBAAiB,CAAA;AAExB,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,YAAY,EACZ,oBAAoB,EACpB,aAAa,EACb,mBAAmB,EACnB,cAAc,EACd,kBAAkB,EAClB,uBAAuB,EACvB,cAAc,EACd,WAAW,EACX,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,kBAAkB,EAClB,sBAAsB,EACtB,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,mBAAmB,EACnB,cAAc,EACd,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,eAAe,EACf,cAAc,EACd,eAAe,EACf,gBAAgB,GAYjB,MAAM,gBAAgB,CAAA;AAEvB,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAoB,MAAM,aAAa,CAAA;AAElE,OAAO,EACL,gBAAgB,EAChB,SAAS,EACT,SAAS,EACT,gBAAgB,EAChB,eAAe,GAIhB,MAAM,aAAa,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@estiva-app/conversation",
3
- "version": "0.12.0",
3
+ "version": "0.14.0",
4
4
  "description": "The conversation rules of the Estiva SPEC (§6.2–§6.8, §11): comment and mention strengths, threading, the edit, reaction and attachment folds, NIP-22 comment and reply builders, drafts, NIP-RS read state, membership and unread. A convenience an app adopts, never a requirement.",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/src/builders.ts CHANGED
@@ -76,16 +76,41 @@ export interface CommentRef {
76
76
  * then carries no `p`, because a wrong one notifies the wrong person.
77
77
  */
78
78
  author?: string
79
+ /**
80
+ * Where on its object the comment is: its own `block` and `quote` tags
81
+ * ({@link placeOf}). The reply copies them, so its thread keeps its place
82
+ * once the comment is deleted (§13.6). Absent when the comment is on the
83
+ * whole object or outside the read.
84
+ */
85
+ place?: readonly NostrTag[]
86
+ }
87
+
88
+ /** The tags that say where on its object a comment is (§13.6): `block` and `quote`. */
89
+ const PLACE_TAGS = new Set(['block', 'quote'])
90
+
91
+ /**
92
+ * A comment's place, as its event carries it: its `block` and `quote` tags,
93
+ * verbatim, for {@link CommentRef.place}. Empty when it is on the whole object.
94
+ *
95
+ * why: https://github.com/estiva-app/estiva-docs/blob/main/decisions/a-reply-on-a-page-keeps-its-threads-place.md
96
+ */
97
+ export function placeOf(comment: { tags: readonly NostrTag[] }): NostrTag[] {
98
+ // One of each, the first, as every reader reads it: a stranger's extra tags are not copied under the replier's key.
99
+ return [...PLACE_TAGS].map((name) => comment.tags.find((t) => t[0] === name)).filter((t): t is NostrTag => !!t)
79
100
  }
80
101
 
81
102
  /**
82
103
  * A reply to a comment — §6.4 *Replies*, C16. Tag order: `A`, `K`, `P`, `e`,
83
- * `k`, `[p]`, `h`, `ts`, `[imeta…]`, then `tags`.
104
+ * `k`, `[p]`, `[block, quote]`, `h`, `ts`, `[imeta…]`, then `tags`.
84
105
  *
85
106
  * **Flat, one level deep**: `e` names the thread's top-level comment, never
86
107
  * another reply. **No lowercase `a`** for the object: NIP-22 reads it as the
87
108
  * parent, so it would claim the reply is itself a top-level comment. The reply
88
- * is found by `#e` on the comment.
109
+ * is found by `#e` on the comment. **Its comment's place, copied** (§13.6):
110
+ * the `block` and `quote` tags of `comment.place` as written, and no other
111
+ * tag from it.
112
+ *
113
+ * why: https://github.com/estiva-app/estiva-docs/blob/main/decisions/a-reply-on-a-page-keeps-its-threads-place.md
89
114
  */
90
115
  export function buildReply(
91
116
  pubkey: string,
@@ -94,7 +119,7 @@ export function buildReply(
94
119
  ): UnsignedEvent {
95
120
  assertFolder(args.folder)
96
121
  const [kind, author] = kindAndAuthor(args.comment.anchor)
97
- const earned = (args.tags ?? []).filter((t) => !(t[0] === 'a' && t[1] === args.comment.anchor))
122
+ const earned = (args.tags ?? []).filter((t) => !(t[0] === 'a' && t[1] === args.comment.anchor) && !PLACE_TAGS.has(t[0]))
98
123
  return {
99
124
  pubkey,
100
125
  created_at: toNostrSeconds(createdAtMs),
@@ -106,6 +131,7 @@ export function buildReply(
106
131
  ['e', args.comment.id],
107
132
  ['k', String(KIND_COMMENT)],
108
133
  ...(args.comment.author ? [['p', args.comment.author]] : []),
134
+ ...(args.comment.place ? placeOf({ tags: args.comment.place }).map((t) => [...t]) : []),
109
135
  ['h', args.folder],
110
136
  ['ts', String(Math.floor(createdAtMs))],
111
137
  ...(args.files ?? []).map(imetaTag),
@@ -0,0 +1,178 @@
1
+ /**
2
+ * What the shared comment box holds, as the message it writes, and back
3
+ * (COMM-2).
4
+ *
5
+ * The box is `@estiva-app/ui/editor`'s `CommentBox`, and it hands its app the
6
+ * editor's document: a person as a `mention` or `urgentMention` chip, a
7
+ * message or a file as a `captionedReference` chip. That package depends on no
8
+ * protocol package, so the translation is here, once, for every app — Ship
9
+ * wrote it itself until now (`chipsAsReferences`, `withoutNewUrgency`,
10
+ * `urgentChipsFrom`), and Peek and Leaf each would have again.
11
+ *
12
+ * - {@link composerText}: the document → the marker text a send writes, and the
13
+ * people it names urgently (what {@link urgentTagsFor} takes).
14
+ * - {@link composerDocument}: marker text → the document an edit or a draft
15
+ * opens with, the people and references as chips again.
16
+ * - {@link withoutNewUrgency}: an edit's text, making nobody newly urgent.
17
+ * - {@link composerDraft}: a {@link DraftStore} as the box reads and writes it.
18
+ *
19
+ * why: https://github.com/estiva-app/estiva-docs/blob/main/decisions/every-app-writes-and-reacts-with-one-shared-box.md
20
+ */
21
+ import {
22
+ blockDocumentToMarkerText,
23
+ decodeNpub,
24
+ documentForEditing,
25
+ fromEditorDocument,
26
+ toEditorDocument,
27
+ type EditorDocument,
28
+ type EditorNode,
29
+ } from '@estiva-app/protocol'
30
+ import { mentionText } from './compose.js'
31
+ import type { DraftStore } from './drafts.js'
32
+
33
+ /** What a composer's document writes: the trimmed marker text, and whom it names urgently. */
34
+ export interface ComposerText {
35
+ text: string
36
+ /** The keys its urgent chips name, once each; absent when none do. What `urgentTagsFor` takes. */
37
+ urgent?: string[]
38
+ }
39
+
40
+ const HEX_KEY = /^[0-9a-f]{64}$/
41
+
42
+ const keyOf = (node: EditorNode): string | null => {
43
+ const pubkey = node.attrs?.pubkey
44
+ return typeof pubkey === 'string' && HEX_KEY.test(pubkey) ? pubkey : null
45
+ }
46
+
47
+ /**
48
+ * The chips as the block bridge can write them. `fromEditorDocument` knows a
49
+ * `reference` and drops any inline node it does not, so a picked person would
50
+ * vanish from the message: a chip becomes the `reference` its `nostr:` text
51
+ * names (§13.1), or `@Name` / `!@Name` for somebody with no key.
52
+ */
53
+ function chipsAsReferences(node: EditorNode): EditorNode {
54
+ if (node.type === 'mention' || node.type === 'urgentMention') {
55
+ const pubkey = keyOf(node)
56
+ const written = mentionText({ pubkey, label: String(node.attrs?.label ?? '') }, node.type === 'urgentMention')
57
+ return pubkey ? { type: 'reference', attrs: { uri: written } } : { type: 'text', text: written }
58
+ }
59
+ if (node.type === 'captionedReference') {
60
+ const uri = typeof node.attrs?.uri === 'string' ? node.attrs.uri : ''
61
+ return uri ? { type: 'reference', attrs: { uri } } : { type: 'text', text: String(node.attrs?.label ?? '') }
62
+ }
63
+ return node.content ? { ...node, content: node.content.map(chipsAsReferences) } : node
64
+ }
65
+
66
+ /**
67
+ * The message a composer's document writes: its marker text, trimmed, and the
68
+ * keys its urgent chips name. A document with no blocks (an edit of a message
69
+ * that is only files starts as one) is no text.
70
+ *
71
+ * The send then earns its tags from these, as before: `mentionTagsFor`,
72
+ * `urgentTagsFor(text, urgent)`, `quoteTagsFor`, `referenceTagsFor`.
73
+ */
74
+ export function composerText(doc: EditorDocument | EditorNode): ComposerText {
75
+ const urgent = new Set<string>()
76
+ const walk = (node: EditorNode) => {
77
+ if (node.type === 'urgentMention') {
78
+ const pubkey = keyOf(node)
79
+ if (pubkey) urgent.add(pubkey)
80
+ }
81
+ node.content?.forEach(walk)
82
+ }
83
+ walk(doc)
84
+ const text = doc.content?.length ? blockDocumentToMarkerText(fromEditorDocument(chipsAsReferences(doc) as EditorDocument)).trim() : ''
85
+ return urgent.size > 0 ? { text, urgent: [...urgent] } : { text }
86
+ }
87
+
88
+ /** What a composer needs to draw marker text as chips again. Each answers `undefined` for what it does not know. */
89
+ export interface ComposerLabels {
90
+ /** A person's name, by key: their `nostr:npub…` becomes a chip again. */
91
+ personLabel?: (pubkey: string) => string | undefined
92
+ /** A message's or a file's chip, by its `nostr:` URI, as `[` captioned it. */
93
+ referenceCaption?: (uri: string) => { label: string; snippet: string } | undefined
94
+ }
95
+
96
+ /** A reference that carries nothing a chip would drop: no marks, no card, no URL. */
97
+ const plainReference = (node: EditorNode): string | null => {
98
+ if (node.type !== 'reference') return null
99
+ const { uri, marks, embed, extra, href } = node.attrs ?? {}
100
+ if (typeof uri !== 'string' || !uri) return null
101
+ if ((Array.isArray(marks) && marks.length > 0) || embed || extra || href) return null
102
+ return uri
103
+ }
104
+
105
+ /**
106
+ * The document a composer opens with for marker text — an edit's or a draft's.
107
+ *
108
+ * A person written as `nostr:npub…` becomes a `mention` chip again, or an
109
+ * `urgentMention` one when `urgent` names them (§13.1 keeps the urgency in a
110
+ * tag, so marker text alone cannot say it); a message or a file becomes its
111
+ * `captionedReference` chip. Whatever `labels` does not know stays the
112
+ * `reference` it was, and so does one with marks or a card, which a chip
113
+ * would lose.
114
+ */
115
+ export function composerDocument(text: string, labels: ComposerLabels = {}, urgent?: readonly string[]): EditorDocument {
116
+ const keys = new Set(urgent ?? [])
117
+ const walk = (node: EditorNode): EditorNode => {
118
+ const uri = plainReference(node)
119
+ if (uri && /^nostr:npub1/i.test(uri)) {
120
+ let pubkey: string | null = null
121
+ try {
122
+ pubkey = decodeNpub(uri.slice('nostr:'.length).toLowerCase())
123
+ } catch {
124
+ pubkey = null
125
+ }
126
+ const label = pubkey ? labels.personLabel?.(pubkey) : undefined
127
+ if (pubkey && label !== undefined) return { type: keys.has(pubkey) ? 'urgentMention' : 'mention', attrs: { id: pubkey, label, pubkey } }
128
+ return node
129
+ }
130
+ if (uri) {
131
+ const caption = labels.referenceCaption?.(uri)
132
+ if (caption) return { type: 'captionedReference', attrs: { id: uri, label: caption.label, snippet: caption.snippet, uri } }
133
+ return node
134
+ }
135
+ return node.content ? { ...node, content: node.content.map(walk) } : node
136
+ }
137
+ return walk(toEditorDocument(documentForEditing(text, 'marker')) as EditorNode) as EditorDocument
138
+ }
139
+
140
+ /**
141
+ * An edit's text with any `!@Name` the message did not already hold written as
142
+ * an ordinary `@Name` — CON-24. An edit carries no tags, so it makes nobody
143
+ * urgent (Miky, kickoff, 2026-10-07); a hand-typed `!@Name` is the old urgent
144
+ * text, which Peek still draws urgent while it pages nobody.
145
+ */
146
+ export function withoutNewUrgency(text: string, original: string): string {
147
+ return text.replace(/!@([^\s!@]+)/g, (whole, name: string) => (original.includes(whole) ? whole : `@${name}`))
148
+ }
149
+
150
+ /** One composer's draft, in the composer's own terms. */
151
+ export interface ComposerDraft {
152
+ /** The document to open with, or `undefined` when there is no draft. */
153
+ read(): EditorDocument | undefined
154
+ /** Keep what is written; an empty document clears the draft. */
155
+ write(doc: EditorDocument): void
156
+ clear(): void
157
+ }
158
+
159
+ /**
160
+ * A draft kept in `store` under `key` (one of `draftKeys`), read and written as
161
+ * the composer's document: the marker text and the urgent picks (CON-31), and
162
+ * the chips back through {@link composerDocument}.
163
+ */
164
+ export function composerDraft(store: DraftStore, key: string, labels: ComposerLabels = {}): ComposerDraft {
165
+ return {
166
+ read() {
167
+ const draft = store.readDraft(key)
168
+ return draft && draft.text.trim() ? composerDocument(draft.text, labels, draft.urgent) : undefined
169
+ },
170
+ write(doc) {
171
+ const { text, urgent } = composerText(doc)
172
+ store.write(key, text, urgent)
173
+ },
174
+ clear() {
175
+ store.clear(key)
176
+ },
177
+ }
178
+ }
package/src/edits.ts CHANGED
@@ -146,7 +146,7 @@ export function foldAttachments(events: readonly SignedEvent[]): Record<string,
146
146
  * edit removes a card. Which of these the body still names is
147
147
  * `cardsIn`'s question, asked of the folded body. Messages with none are absent.
148
148
  *
149
- * why: https://github.com/estiva-app/estiva-docs/blob/main/decisions/where-a-link-sits-decides-how-it-draws.md
149
+ * why: https://github.com/estiva-app/estiva-docs/blob/main/decisions/a-link-on-words-counts-toward-the-card.md
150
150
  */
151
151
  export function foldEmbeds(events: readonly SignedEvent[]): Record<string, Embed[]> {
152
152
  const out: Record<string, Embed[]> = {}
package/src/index.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 const CONVERSATION_VERSION = '0.12.0'
15
+ export const CONVERSATION_VERSION = '0.14.0'
16
16
 
17
17
  export {
18
18
  KIND_MESSAGE,
@@ -62,10 +62,20 @@ export {
62
62
 
63
63
  export { decorationsOf, type Decoration, type Decorations, type Resolution, type QueryFn } from './decorations.js'
64
64
 
65
- export { buildComment, buildReply, offersEditAndDelete, type CommentRef } from './builders.js'
65
+ export { buildComment, buildReply, offersEditAndDelete, placeOf, type CommentRef } from './builders.js'
66
66
 
67
67
  export { eventsNamedInBody, mentionText, messageReference, quoteTagsFor, URGENT_TAG, urgentTagsFor } from './compose.js'
68
68
 
69
+ export {
70
+ composerDocument,
71
+ composerDraft,
72
+ composerText,
73
+ withoutNewUrgency,
74
+ type ComposerDraft,
75
+ type ComposerLabels,
76
+ type ComposerText,
77
+ } from './composer.js'
78
+
69
79
  export {
70
80
  FILE_TIER,
71
81
  fileReference,