@estiva-app/conversation 0.13.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,21 @@ 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
+
9
24
  ## 0.13.0 — 2026-10-17
10
25
 
11
26
  **What the shared comment box holds, as the message it writes, and back**
package/README.md CHANGED
@@ -24,7 +24,7 @@ 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
29
  | what the shared comment box holds, as the message it writes, and back | §13.1 | `composerText`, `composerDocument`, `withoutNewUrgency`, `composerDraft` |
30
30
  | what `[` offers, and in what order | §13.1 | `rankReferences`, `referenceMatch`, `fileReference`, `referenceSearch`, `MESSAGE_TIER`, `FILE_TIER`, `REFERENCE_CAPS` |
@@ -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","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,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,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAEpD;;;;GAIG;AACH,SAAS,YAAY,CAAC,MAAc;IAClC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,wCAAwC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;AAChH,CAAC;AAED,kEAAkE;AAClE,SAAS,aAAa,CAAC,OAAe;IACpC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IACzC,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM;QAAE,MAAM,IAAI,KAAK,CAAC,mBAAmB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;IACnF,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;AACvB,CAAC;AAED;;;;;;;;;;GAUG;AACH,M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ACvC,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"}
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-and-which-file-gets-the-card.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-and-which-file-gets-the-card.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.13.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,7 +20,7 @@ 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
25
  export { composerDocument, composerDraft, composerText, withoutNewUrgency, type ComposerDraft, type ComposerLabels, type ComposerText, } from './composer.js';
26
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';
@@ -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,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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"}
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.13.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,7 +20,7 @@ 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
25
  export { composerDocument, composerDraft, composerText, withoutNewUrgency, } from './composer.js';
26
26
  export { FILE_TIER, fileReference, MESSAGE_TIER, rankReferences, REFERENCE_CAPS, referenceMatch, referenceSearch, refMatch, } from './references.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,GAIf,MAAM,gBAAgB,CAAA;AAEvB,OAAO,EAAE,aAAa,EAAoE,MAAM,kBAAkB,CAAA;AAElH,OA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,OAAO,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.13.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),
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-and-which-file-gets-the-card.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.13.0'
15
+ export const CONVERSATION_VERSION = '0.14.0'
16
16
 
17
17
  export {
18
18
  KIND_MESSAGE,
@@ -62,7 +62,7 @@ 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