@estiva-app/protocol 0.37.0 → 0.39.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/dist/events.js CHANGED
@@ -35,6 +35,7 @@
35
35
  import { sha256 } from '@noble/hashes/sha256';
36
36
  import { bytesToHex, utf8ToBytes } from '@noble/hashes/utils';
37
37
  import { serializeBlockDocument } from './blocks.js';
38
+ import { embedTagsOf } from './embeds.js';
38
39
  /**
39
40
  * Buzz kind numbers used across the suite (crates/buzz-core/src/kind.rs).
40
41
  *
@@ -635,6 +636,8 @@ export function buildEdit(pubkey, createdAtMs, args) {
635
636
  // and a rounded `ts` could land in the next second and be discarded by
636
637
  // its own agreement rule.
637
638
  ['ts', String(Math.floor(createdAtMs))],
639
+ ...embedTagsOf(args.embeds ?? []),
640
+ ...(args.mediaTags ?? []),
638
641
  ],
639
642
  content: args.body,
640
643
  };
@@ -1 +1 @@
1
- {"version":3,"file":"events.js","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAC7C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAC7D,OAAO,EAAsB,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAoBxE;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG;IAClB,OAAO,EAAE,CAAC;IACV,QAAQ,EAAE,CAAC;IACX,QAAQ,EAAE,CAAC;IACX,cAAc,EAAE,CAAC;IACjB,cAAc,EAAE,IAAI;IACpB,mBAAmB,EAAE,IAAI;IACzB,kBAAkB,EAAE,IAAI;IACxB,kBAAkB,EAAE,IAAI;IACxB;;;;OAIG;IACH,cAAc,EAAE,IAAI;IACpB;;;;;;;;;;OAUG;IACH,SAAS,EAAE,IAAI;IACf;;;;;;;;OAQG;IACH,OAAO,E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json — `test/version.test.ts`
47
47
  * pins the two together. It exists so "the upgrade reached the app" can be
48
48
  * checked by grepping a built bundle rather than by trusting a lockfile. */
49
- export declare const PROTOCOL_VERSION = "0.37.0";
49
+ export declare const PROTOCOL_VERSION = "0.39.0";
50
50
  export { type NostrTag, type UnsignedEvent, type SignedEvent, type Profile, type ThreadRef, type ChannelVisibility, type ChannelKind, type MemberRole, type FolderOp, type Label, type ResolutionAction, KIND, MAX_EMOJI_CHARS, MAX_MESSAGE_BYTES, MAX_MENTIONS, MAX_DM_OTHERS, MAX_RATIONALE_BYTES, RELAY_AUTH_TOLERANCE_SECS, ASSERTION_SUBTYPE, computeEventId, toNostrSeconds, canonicalChannelName, threadTags, addr, relayAuthUrl, buildProfile, parseProfile, buildCreateChannel, buildDeleteChannel, buildEditChannelMetadata, buildFolderCommand, buildAddMember, buildDmOpen, buildDmHide, buildReaction, buildDeletion, buildEdit, buildMessage, buildResolution, buildBareFile, buildDocument, buildHighlight, buildUnsignedRelayAuthEvent, } from './events.js';
51
51
  export { type AddressPointer, type EventPointer, encodeNevent, decodeNevent, convertBits, bech32Encode, bech32Decode, encodeNaddr, decodeNaddr, pointerToAddress, addressToPointer, addrToNaddr, naddrToAddr, referenceToPointer, NADDR_RE, findNaddrs, stripNaddrs, encodeNpub, decodeNpub, NOSTR_URI_RE, findNostrUris, } from './nip19.js';
52
52
  export { type AuthEventArgs, TIMESTAMP_TOLERANCE_SECS, normalizeUrl, buildUnsignedAuthEvent, base64, authorizationHeaderFor, authorizationHeader, } from './nip98.js';
@@ -62,6 +62,6 @@ export { descriptionTextToBlockDocument, tableToDescriptionText } from './descri
62
62
  export { type EditorNode, type EditorDocument, EDITOR_BLOCK_TYPES, UNKNOWN_BLOCK_NODE, REFERENCE_NODE, documentForEditing, toEditorDocument, fromEditorDocument, publishableFromEditor, } from './editor.js';
63
63
  export { type BlockAnchor, type Part, type PartPointer, type PartSource, BLOCK_ANCHOR_TAG, PART_TAG, absenceOf, blockAnchorOf, partTag, partsOf, resolveBlockAnchor, resolvePart, } from './anchors.js';
64
64
  export { type CommentAnchor, type Quote, type TextPoint, MAX_RUN_ENTRIES_READ, MAX_RUN_IDS, QUOTE_CONTEXT_LENGTH, QUOTE_END_LENGTH, QUOTE_TAG, QUOTE_WHOLE_MAX, blockRunOf, blockRunTag, quoteOf, quoteTag, readRunIds, resolveBlockRun, resolveCommentAnchor, selectionAnchorTags, } from './comment-anchor.js';
65
- export { type Embed, type EmbedLayout, type LinkResolver, EMBED_TAG, cardsIn, embedTag, embedsOf, linksAsReferences, referenceOfLink, urlRunsIn } from './embeds.js';
65
+ export { type Embed, type EmbedLayout, type LineDraw, type LinkResolver, EMBED_TAG, cardsIn, defaultCardOf, embedTag, embedTagsOf, embedsOf, isFolderValue, isOnlyReferenceLine, lineDrawOf, linesOf, linksAsReferences, referenceOfLink, urlRunsIn, valueOfReference, valuesIn, withCard, } from './embeds.js';
66
66
  export { type BlossomVerb, type Imeta, BLOSSOM_AUTH_TTL_SECS, buildBlossomAuth, blossomAuthHeader, imetaTag, imetaOf, imetaFromAttrs, attachmentsInDocument, type BlobFetchLike, type BlobResponseLike, type FetchedBlob, sha256FromMediaUrl, fetchBlob, sha256Of, uploadBlob, imetaFor, canonicalizeImage, type UploadedBlob, type BlobUploadFetchLike, } from './media.js';
67
67
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAEH;;4EAE4E;AAC5E,eAAO,MAAM,gBAAgB,WAAW,CAAA;AAExC,OAAO,EAEL,KAAK,QAAQ,EACb,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,SAAS,EACd,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,KAAK,KAAK,E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Ac,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,aAAa,CAAA;AAEpB,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,IAAI,EACT,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,gBAAgB,EAChB,QAAQ,EACR,SAAS,EACT,aAAa,EACb,OAAO,EACP,OAAO,EACP,kBAAkB,EAClB,WAAW,GACZ,MAAM,cAAc,CAAA;AACrB,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,KAAK,EACV,KAAK,SAAS,EACd,oBAAoB,EACpB,WAAW,EACX,oBAAoB,EACpB,gBAAgB,EAChB,SAAS,EACT,eAAe,EACf,UAAU,EACV,WAAW,EACX,OAAO,EACP,QAAQ,EACR,UAAU,EACV,eAAe,EACf,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,WAAW,EAAE,KAAK,YAAY,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACpK,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,KAAK,EACV,qBAAqB,EACrB,gBAAgB,EAChB,iBAAiB,EACjB,QAAQ,EACR,OAAO,EACP,cAAc,EACd,qBAAqB,EACrB,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,kBAAkB,EAClB,SAAS,EACT,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,iBAAiB,EACjB,KAAK,YAAY,EACjB,KAAK,mBAAmB,GACzB,MAAM,YAAY,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;A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,EACR,OAAO,EACP,cAAc,EACd,qBAAqB,EACrB,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,kBAAkB,EAClB,SAAS,EACT,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,iBAAiB,EACjB,KAAK,YAAY,EACjB,KAAK,mBAAmB,GACzB,MAAM,YAAY,CAAA"}
package/dist/index.js CHANGED
@@ -46,7 +46,7 @@
46
46
  /** Bumped by hand with the version in package.json — `test/version.test.ts`
47
47
  * pins the two together. It exists so "the upgrade reached the app" can be
48
48
  * checked by grepping a built bundle rather than by trusting a lockfile. */
49
- export const PROTOCOL_VERSION = '0.37.0';
49
+ export const PROTOCOL_VERSION = '0.39.0';
50
50
  export {
51
51
  // constants
52
52
  KIND, MAX_EMOJI_CHARS, MAX_MESSAGE_BYTES, MAX_MENTIONS, MAX_DM_OTHERS, MAX_RATIONALE_BYTES, RELAY_AUTH_TOLERANCE_SECS, ASSERTION_SUBTYPE,
@@ -68,6 +68,6 @@ export { descriptionTextToBlockDocument, tableToDescriptionText } from './descri
68
68
  export { EDITOR_BLOCK_TYPES, UNKNOWN_BLOCK_NODE, REFERENCE_NODE, documentForEditing, toEditorDocument, fromEditorDocument, publishableFromEditor, } from './editor.js';
69
69
  export { BLOCK_ANCHOR_TAG, PART_TAG, absenceOf, blockAnchorOf, partTag, partsOf, resolveBlockAnchor, resolvePart, } from './anchors.js';
70
70
  export { MAX_RUN_ENTRIES_READ, MAX_RUN_IDS, QUOTE_CONTEXT_LENGTH, QUOTE_END_LENGTH, QUOTE_TAG, QUOTE_WHOLE_MAX, blockRunOf, blockRunTag, quoteOf, quoteTag, readRunIds, resolveBlockRun, resolveCommentAnchor, selectionAnchorTags, } from './comment-anchor.js';
71
- export { EMBED_TAG, cardsIn, embedTag, embedsOf, linksAsReferences, referenceOfLink, urlRunsIn } from './embeds.js';
71
+ export { EMBED_TAG, cardsIn, defaultCardOf, embedTag, embedTagsOf, embedsOf, isFolderValue, isOnlyReferenceLine, lineDrawOf, linesOf, linksAsReferences, referenceOfLink, urlRunsIn, valueOfReference, valuesIn, withCard, } from './embeds.js';
72
72
  export { BLOSSOM_AUTH_TTL_SECS, buildBlossomAuth, blossomAuthHeader, imetaTag, imetaOf, imetaFromAttrs, attachmentsInDocument, sha256FromMediaUrl, fetchBlob, sha256Of, uploadBlob, imetaFor, canonicalizeImage, } from './media.js';
73
73
  //# 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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAEH;;4EAE4E;AAC5E,MAAM,CAAC,MAAM,gBAAgB,GAAG,QAAQ,CAAA;AAExC,OAAO;AAaL,YAAY;AACZ,IAAI,EACJ,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,mBAAmB,EACnB,yBAAyB,EACzB,iBAAiB;AACjB,8CAA8C;AAC9C,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,UAAU,EACV,IAAI,EACJ,YAAY;AACZ,WAAW;AACX,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAClB,kBAAkB,EAClB,wBAAwB,EACxB,kBAAkB,EAClB,cAAc,EACd,WAAW,EACX,WAAW,EACX,aAAa,EACb,aAAa,EACb,SAAS,EACT,YAAY,EACZ,eAAe,EACf,aAAa,EACb,aAAa,EACb,cAAc,EACd,2BAA2B,GAC5B,MAAM,aAAa,CAAA;AAEpB,OAAO,EAGL,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,WAAW,EACX,WAAW,EACX,kBAAkB,EAClB,QAAQ,EACR,UAAU,EACV,WAAW,EACX,UAAU,EACV,UAAU,EACV,YAAY,EACZ,aAAa,GACd,MAAM,YAAY,CAAA;A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rB,eAAe,EACf,YAAY,EACZ,cAAc,EACd,mBAAmB,EACnB,YAAY,EAEZ,UAAU,EACV,UAAU,GACX,MAAM,aAAa,CAAA;AAEpB,OAAO,EACL,yBAAyB,EACzB,yBAAyB,GAE1B,MAAM,qBAAqB,CAAA;AAE5B,OAAO,EAAE,8BAA8B,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAA;AAE9F,OAAO,EAGL,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,aAAa,CAAA;AAEpB,OAAO,EAKL,gBAAgB,EAChB,QAAQ,EACR,SAAS,EACT,aAAa,EACb,OAAO,EACP,OAAO,EACP,kBAAkB,EAClB,WAAW,GACZ,MAAM,cAAc,CAAA;AACrB,OAAO,EAIL,oBAAoB,EACpB,WAAW,EACX,oBAAoB,EACpB,gBAAgB,EAChB,SAAS,EACT,eAAe,EACf,UAAU,EACV,WAAW,EACX,OAAO,EACP,QAAQ,EACR,UAAU,EACV,eAAe,EACf,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAKL,SAAS,EACT,OAAO,EACP,aAAa,EACb,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,aAAa,EACb,mBAAmB,EACnB,UAAU,EACV,OAAO,EACP,iBAAiB,EACjB,eAAe,EACf,SAAS,EACT,gBAAgB,EAChB,QAAQ,EACR,QAAQ,GACT,MAAM,aAAa,CAAA;AACpB,OAAO,EAGL,qBAAqB,EACrB,gBAAgB,EAChB,iBAAiB,EACjB,QAAQ,EACR,OAAO,EACP,cAAc,EACd,qBAAqB,EAIrB,kBAAkB,EAClB,SAAS,EACT,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,iBAAiB,GAGlB,MAAM,YAAY,CAAA"}
package/dist/render.d.ts CHANGED
@@ -179,11 +179,11 @@ export declare function renderTreeText(blocks: readonly RenderBlock[]): string;
179
179
  * on its line is alone on its line whether or not somebody left a space after
180
180
  * it.
181
181
  *
182
- * @deprecated Since 0.33.0 a reference reads as its chip wherever it sits, in a
183
- * message (§13.6.2) and in a block document (§13.3, "A reference's card"); a
184
- * card comes only from what its writer chose. Use {@link blockCards} for a
185
- * document and `cardsIn` for a message. Kept for one release so a reader on it
186
- * still builds.
182
+ * @deprecated A whole paragraph is not the unit: since 0.38.0 a message's line
183
+ * that is only a reference draws its row (§13.2, §13.6.2), which
184
+ * `isOnlyReferenceLine` decides per line, list items and app URLs included. A
185
+ * block document reads a reference as its chip (§13.3); use {@link blockCards}
186
+ * for its cards.
187
187
  */
188
188
  export declare function standaloneReference(block: RenderBlock): string | undefined;
189
189
  /**
package/dist/render.js CHANGED
@@ -241,11 +241,11 @@ export function renderTreeText(blocks) {
241
241
  * on its line is alone on its line whether or not somebody left a space after
242
242
  * it.
243
243
  *
244
- * @deprecated Since 0.33.0 a reference reads as its chip wherever it sits, in a
245
- * message (§13.6.2) and in a block document (§13.3, "A reference's card"); a
246
- * card comes only from what its writer chose. Use {@link blockCards} for a
247
- * document and `cardsIn` for a message. Kept for one release so a reader on it
248
- * still builds.
244
+ * @deprecated A whole paragraph is not the unit: since 0.38.0 a message's line
245
+ * that is only a reference draws its row (§13.2, §13.6.2), which
246
+ * `isOnlyReferenceLine` decides per line, list items and app URLs included. A
247
+ * block document reads a reference as its chip (§13.3); use {@link blockCards}
248
+ * for its cards.
249
249
  */
250
250
  export function standaloneReference(block) {
251
251
  if (block.type !== 'paragraph' || block.children?.length)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@estiva-app/protocol",
3
- "version": "0.37.0",
3
+ "version": "0.39.0",
4
4
  "description": "The Estiva wire format: Buzz-shaped Nostr event builders, NIP-01 ids, NIP-19 naddr, NIP-98 HTTP auth, and the relay clients. Speaks the protocol; interprets nothing.",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/src/embeds.ts CHANGED
@@ -8,9 +8,11 @@
8
8
  * name: `compact` is §7.5's closed `row` and `detailed` its closed `card`, so
9
9
  * a richer card can come later without changing the wire.
10
10
  *
11
- * A reference with no `embed` is drawn by the reader's default (a chip, §13.1).
12
- * An `embed` for a value overrides that default, which is why `none` exists:
13
- * it is the author saying "no card" in an edit that replaces the set (§6.8).
11
+ * A reference with no `embed` draws by where it sits: its chip in a sentence,
12
+ * its row alone on its line ({@link isOnlyReferenceLine}). A reader never adds
13
+ * a card; the default card is the writer's ({@link defaultCardOf}). An `embed`
14
+ * for a value overrides any default, which is why `none` exists: it is the
15
+ * author saying "no card" in an edit that replaces the set (§6.8).
14
16
  *
15
17
  * Like `part` (§13.6.1), the tags are only half the answer. A card is drawn
16
18
  * only while the body — as edited — still names its value, and there is no
@@ -34,6 +36,12 @@ export interface Embed {
34
36
  /** An address (`kind:pubkey:d`) or a 64-hex event id, lowercase hex. */
35
37
  value: string
36
38
  layout: EmbedLayout
39
+ /**
40
+ * The layout as its tag wrote it, when this reader does not know it (and
41
+ * draws it as `compact`). An edit carries it as written ({@link embedTagsOf}),
42
+ * so a density added later is not rewritten by an older writer.
43
+ */
44
+ written?: string
37
45
  }
38
46
 
39
47
  /** The `embed` tag for one reference. */
@@ -41,6 +49,25 @@ export function embedTag(value: string, layout: EmbedLayout): string[] {
41
49
  return [EMBED_TAG, value, layout]
42
50
  }
43
51
 
52
+ /**
53
+ * A whole `embed` set as tags, as a send or an edit writes it: each value
54
+ * normalised as {@link embedsOf} reads it, the first entry per value kept, and
55
+ * a layout this writer does not know carried as it was written (`written`).
56
+ * Throws on a value that is neither an address nor an event id, or on a
57
+ * layout that is neither known nor carried, rather than write a tag readers skip.
58
+ */
59
+ export function embedTagsOf(set: readonly Embed[]): string[][] {
60
+ const seen = new Set<string>()
61
+ return set.flatMap((e) => {
62
+ const value = normalise(e.value)
63
+ if (!value) throw new Error(`not an address or event id: ${e.value}`)
64
+ if (e.layout !== 'compact' && e.layout !== 'detailed' && e.layout !== 'none') throw new Error(`not an embed layout: ${String(e.layout)}`)
65
+ if (seen.has(value)) return []
66
+ seen.add(value)
67
+ return [[EMBED_TAG, value, (e.layout === 'compact' && e.written) || e.layout]]
68
+ })
69
+ }
70
+
44
71
  // `partsOf`'s shape: an empty `d` is a valid address (NIP-01).
45
72
  const ADDRESS = /^\d+:[0-9a-f]{64}:/
46
73
  const EVENT_ID = /^[0-9a-f]{64}$/
@@ -65,7 +92,8 @@ export function embedsOf(event: { tags: readonly (readonly string[])[] }): Embed
65
92
  const value = normalise(tag[1])
66
93
  if (!value || seen.has(value)) continue
67
94
  seen.add(value)
68
- out.push({ value, layout: layoutOf(tag[2]) })
95
+ const layout = layoutOf(tag[2])
96
+ out.push(tag[2] && tag[2] !== layout ? { value, layout, written: tag[2] } : { value, layout })
69
97
  }
70
98
  return out
71
99
  }
@@ -92,7 +120,6 @@ function normalise(value: string): string | undefined {
92
120
  export type LinkResolver = (url: string) => string | undefined
93
121
 
94
122
  const TRAILING = new Set(['.', ',', ';', ':', '!', '?', ')', ']'])
95
- const URL_RUN = /https?:\/\/[^\s<>"'`]+/g
96
123
 
97
124
  /** A URL run without the sentence's trailing punctuation; stripped by a loop, which stays linear on a hostile run of dots. */
98
125
  function trimUrl(url: string): string {
@@ -101,13 +128,20 @@ function trimUrl(url: string): string {
101
128
  return url.slice(0, end)
102
129
  }
103
130
 
104
- /** The http(s) links in a text. Trailing punctuation is the sentence's, not the link's. */
105
- function urlsIn(text: string): string[] {
106
- return (text.match(URL_RUN) ?? []).map(trimUrl)
131
+ /** A URL stuck to the end of a word (`seehttps://…`) is the word's, not a link. */
132
+ function stuckToWord(text: string, start: number): boolean {
133
+ if (start === 0) return false
134
+ // The code point before it, so a letter outside the BMP (a surrogate pair) counts too.
135
+ const pair = start >= 2 && /[\uDC00-\uDFFF]/.test(text[start - 1]) && /[\uD800-\uDBFF]/.test(text[start - 2])
136
+ const at = pair ? start - 2 : start - 1
137
+ return /[\p{L}\p{N}]/u.test(String.fromCodePoint(text.codePointAt(at)!))
107
138
  }
108
139
 
109
- /** The address or event id a `nostr:` reference names, or undefined for a person or something unreadable. */
110
- function valueOfReference(reference: string): string | undefined {
140
+ /**
141
+ * The address or event id a `nostr:` reference names — what an `a`, `q` or
142
+ * `embed` carries for it — or undefined for a person or something unreadable.
143
+ */
144
+ export function valueOfReference(reference: string): string | undefined {
111
145
  const bare = reference.replace(/^nostr:/i, '').toLowerCase()
112
146
  try {
113
147
  if (bare.startsWith('naddr1')) return normalise(naddrToAddr(bare))
@@ -142,35 +176,38 @@ export function cardsIn(embeds: readonly Embed[], blocks: readonly RenderBlock[]
142
176
  if (embeds.length === 0) return []
143
177
  const byValue = new Map(embeds.map((e) => [e.value, e]))
144
178
  const withPart = new Set(parts.map((p) => normalise(p.address)).filter((v): v is string => !!v))
145
- const out: Embed[] = []
179
+ return valuesIn(blocks, resolveLink).flatMap((value) => {
180
+ const embed = withPart.has(value) ? undefined : byValue.get(value)
181
+ return embed ? [embed] : []
182
+ })
183
+ }
184
+
185
+ /**
186
+ * Every address and event id a message's body names, once each, in the order
187
+ * it first names them: by a `nostr:` reference, or by an app link that
188
+ * `resolveLink` resolves (§7.7). A person names no value. Text in a code span
189
+ * names nothing (§13.1). What {@link cardsIn} and {@link defaultCardOf} count.
190
+ */
191
+ export function valuesIn(blocks: readonly RenderBlock[], resolveLink?: LinkResolver): string[] {
192
+ const out: string[] = []
146
193
  const seen = new Set<string>()
147
194
  const take = (value: string | undefined) => {
148
- if (!value || seen.has(value) || withPart.has(value)) return
149
- const embed = byValue.get(value)
150
- if (!embed) return
195
+ if (!value || seen.has(value)) return
151
196
  seen.add(value)
152
- out.push(embed)
153
- }
154
- // Adjacent plain runs are read as one text, so a link a mark splits in two is still one link.
155
- const scan = (text: string) => {
156
- if (!resolveLink || !text.includes('://')) return
157
- for (const url of urlsIn(text)) {
158
- const value = resolveLink(url)
159
- if (value) take(normalise(value))
160
- }
197
+ out.push(value)
161
198
  }
199
+ const resolve = (url: string) => resolveLink && take(normalise(resolveLink(url) ?? ''))
200
+ // Run by run, by the rules {@link linksAsReferences} turns links by, so a URL names a value exactly where it draws as a reference.
162
201
  const walk = (bs: readonly RenderBlock[]) => {
163
202
  for (const block of bs) {
164
203
  if (block.type !== 'codeBlock') {
165
- let text = ''
166
204
  for (const run of block.inline ?? []) {
167
- if (run.reference || run.marks.includes('code')) {
168
- scan(text)
169
- text = ''
170
- if (run.reference) take(valueOfReference(run.reference))
171
- } else text += run.text
205
+ if (run.reference) take(valueOfReference(run.reference))
206
+ else if (run.marks.includes('code')) continue
207
+ else if (run.href !== undefined) {
208
+ if (run.text === run.href) resolve(run.href)
209
+ } else for (const { url } of urlRunsIn(run.text)) resolve(url)
172
210
  }
173
- scan(text)
174
211
  }
175
212
  if (block.children) walk(block.children)
176
213
  }
@@ -179,6 +216,151 @@ export function cardsIn(embeds: readonly Embed[], blocks: readonly RenderBlock[]
179
216
  return out
180
217
  }
181
218
 
219
+ /**
220
+ * A block's lines: its inline runs split at each `\n`, the line break both
221
+ * content models use (§13.2). A run that holds a break is cut in two, marks
222
+ * kept; a reference never holds one.
223
+ */
224
+ export function linesOf(block: Pick<RenderBlock, 'inline'>): RenderInline[][] {
225
+ const lines: RenderInline[][] = [[]]
226
+ for (const run of block.inline ?? []) {
227
+ const pieces = run.reference ? [run.text] : run.text.split('\n')
228
+ pieces.forEach((text, i) => {
229
+ if (i > 0) lines.push([])
230
+ if (text) lines[lines.length - 1].push(pieces.length === 1 ? run : { ...run, text })
231
+ })
232
+ }
233
+ return lines
234
+ }
235
+
236
+ const LONE_URL = /^https?:\/\/[^\s<>"'`]+$/
237
+ const PERSON = /^nostr:(npub1|nprofile1)/i
238
+
239
+ /**
240
+ * What a line of a message is only, by §13.2, or undefined when it is a
241
+ * sentence: the `nostr:` reference, or the bare URL, that §13.6.2 draws in its
242
+ * place. `block` is the block the line is in: only a paragraph's and a list
243
+ * item's lines count, never a quote's, a heading's or code's.
244
+ *
245
+ * Whitespace around it is trimmed. Anything else makes it a sentence: other
246
+ * words or punctuation (trailing `.` included), a second reference, a marker
247
+ * around it, a code span, or `[words](url)`. A person (`npub`, `nprofile`)
248
+ * alone on a line stays a chip, so it is not returned. A Folder stays a chip
249
+ * too, but whether a URL names one is known only once it resolves: the reader
250
+ * checks the value ({@link isFolderValue}). A URL returned here still has to
251
+ * resolve by §7.7; one that resolves to nothing, or to something the reader
252
+ * cannot read, stays the URL as written.
253
+ */
254
+ export function isOnlyReferenceLine(line: readonly RenderInline[], block: Pick<RenderBlock, 'type'>): string | undefined {
255
+ if (block.type !== 'paragraph' && block.type !== 'listItem') return undefined
256
+ const runs = line.filter((run) => run.reference || run.text.trim() !== '')
257
+ if (runs.length !== 1 || runs[0].marks.length > 0 || runs[0].href !== undefined) return undefined
258
+ const [run] = runs
259
+ if (run.reference) return PERSON.test(run.reference) ? undefined : run.reference
260
+ const text = run.text.trim()
261
+ return LONE_URL.test(text) && trimUrl(text) === text ? text : undefined
262
+ }
263
+
264
+ /** A Folder's address (`39000:…`): alone on its line it stays a chip, and it never takes the default card (§13.6.2). */
265
+ export function isFolderValue(value: string): boolean {
266
+ return value.startsWith('39000:')
267
+ }
268
+
269
+ /**
270
+ * What one line of a message draws (§13.2, §13.6.2):
271
+ * - `sentence` — its runs as they are, each reference its chip;
272
+ * - `row` — the line is only a reference to `value`, drawn as its row;
273
+ * - `nothing` — the same, but `value` has a card or a part under the message,
274
+ * which stands for it (C26);
275
+ * - `url` — a lone URL that names nothing (no app claims it, or the answer has
276
+ * not come back), drawn as the URL as written;
277
+ * - `unreadable` — a lone `nostr:` reference that names no address or event
278
+ * id, drawn as the unreadable row.
279
+ */
280
+ export type LineDraw =
281
+ | { draw: 'sentence' }
282
+ | { draw: 'row' | 'nothing'; value: string; url?: string }
283
+ | { draw: 'url'; url: string }
284
+ | { draw: 'unreadable'; reference: string }
285
+
286
+ /**
287
+ * How a reader draws one of a message's lines ({@link linesOf}) in `block`:
288
+ * {@link isOnlyReferenceLine}, then the value it names, then whether a card
289
+ * stands for it. `cards` is {@link cardsIn}'s answer (its `none` entries draw
290
+ * no card), `parts` the message's `part` pointers. A Folder alone on its line
291
+ * stays a chip, so its line is a sentence. Whether the reader can read a
292
+ * `row`'s object is its own business. One it cannot read draws the unreadable
293
+ * row when the line is a `nostr:` reference; when the line is a URL (`url` is
294
+ * set) it stays the URL as written, never an empty row (§13.6.2).
295
+ */
296
+ export function lineDrawOf(
297
+ line: readonly RenderInline[],
298
+ block: Pick<RenderBlock, 'type'>,
299
+ context: { cards?: readonly Embed[]; parts?: readonly PartPointer[]; resolveLink?: LinkResolver } = {},
300
+ ): LineDraw {
301
+ const only = isOnlyReferenceLine(line, block)
302
+ if (!only) return { draw: 'sentence' }
303
+ const isReference = /^nostr:/i.test(only)
304
+ const value = isReference ? valueOfReference(only) : normalise(context.resolveLink?.(only) ?? '')
305
+ if (!value) return isReference ? { draw: 'unreadable', reference: only } : { draw: 'url', url: only }
306
+ if (isFolderValue(value)) return { draw: 'sentence' }
307
+ const carded =
308
+ (context.cards ?? []).some((e) => e.value === value && e.layout !== 'none') ||
309
+ (context.parts ?? []).some((p) => normalise(p.address) === value)
310
+ return { draw: carded ? 'nothing' : 'row', value, ...(isReference ? {} : { url: only }) }
311
+ }
312
+
313
+ /**
314
+ * The value a writer gives the default card, `["embed", V, "detailed"]`, as
315
+ * it sends or edits a message (§13.6.2), or undefined.
316
+ *
317
+ * `values` is what the body names, resolved ({@link valuesIn}), and `parts`
318
+ * its `part` pointers. A file counts, except a Folder and `here`, the object
319
+ * whose conversation the message is in (Miky, 2026-10-16: the issue a
320
+ * message is about plus one other file gives the other its card); a part's
321
+ * file counts too. A message (an event id) does not. When exactly one file
322
+ * counts, it gets the card, unless a part names it (the part wins, and draws
323
+ * under the message already).
324
+ *
325
+ * On an edit, pass the values the previous folded body named as `previous`:
326
+ * the default is only for a file the edit names first, so a card its author
327
+ * removed with ✕, which left no tag before sending or `none` after, does not
328
+ * come back while the link stays. A link taken out and put back is named
329
+ * first again and gets its card, whichever ✕ removed it (Miky, 2026-10-16).
330
+ * The edit then carries the whole folded set with this one set to `detailed`
331
+ * ({@link withCard}).
332
+ */
333
+ export function defaultCardOf(
334
+ values: readonly string[],
335
+ parts: readonly PartPointer[] = [],
336
+ options: { here?: string; previous?: readonly string[] } = {},
337
+ ): string | undefined {
338
+ const here = normalise(options.here ?? '')
339
+ const withPart = new Set(parts.map((p) => normalise(p.address)).filter((v): v is string => !!v))
340
+ const isFile = (v: string | undefined): v is string => !!v && ADDRESS.test(v) && !isFolderValue(v) && v !== here
341
+ const files = new Set([...values.map(normalise), ...withPart].filter(isFile))
342
+ if (files.size !== 1) return undefined
343
+ const [file] = files
344
+ if (withPart.has(file)) return undefined
345
+ if (options.previous?.some((v) => normalise(v) === file)) return undefined
346
+ return file
347
+ }
348
+
349
+ /**
350
+ * A folded `embed` set with `value` set to `layout`, the rest kept as they
351
+ * are: what an edit carries, since a set replaces (§13.6.2). ✕ on a sent card
352
+ * is `withCard(set, V, 'none')`; adding an edit's default card is
353
+ * `withCard(set, V, 'detailed')`.
354
+ */
355
+ export function withCard(set: readonly Embed[], value: string, layout: EmbedLayout): Embed[] {
356
+ const v = normalise(value)
357
+ if (!v) throw new Error(`not an address or event id: ${value}`)
358
+ const out = set.filter((e) => e.value !== v)
359
+ const at = set.findIndex((e) => e.value === v)
360
+ out.splice(at === -1 ? out.length : at, 0, { value: v, layout })
361
+ return out
362
+ }
363
+
182
364
  /**
183
365
  * The `nostr:` reference an app link names, by what `resolveLink` answered for
184
366
  * it (§7.7), or undefined: nothing claims it, the answer has not come back, or
@@ -206,7 +388,7 @@ export function urlRunsIn(text: string): { url: string; from: number; to: number
206
388
  if (!text.includes('://')) return []
207
389
  const out: { url: string; from: number; to: number }[] = []
208
390
  for (const m of text.matchAll(LINK_OR_URL)) {
209
- if (m[1]) continue
391
+ if (m[1] || stuckToWord(text, m.index)) continue
210
392
  const start = m.index
211
393
  if (text.slice(Math.max(0, start - 2), start) === '](' || text[start - 1] === '[') continue
212
394
  const url = trimUrl(m[0])
@@ -228,9 +410,10 @@ const LINK_OR_URL = /(\[[^[\]\n]+\]\((?:https?:\/\/|mailto:)[^\s)]+\))|(https?:\
228
410
 
229
411
  /**
230
412
  * A message's tree with each bare app link turned into the reference it names,
231
- * so a reader draws it as that object's chip (SPEC §13.6.2, OPT-18).
413
+ * so a reader draws it as a reference to that object (SPEC §13.6.2, OPT-18):
414
+ * its chip in a sentence, its row alone on its line.
232
415
  *
233
- * A reference reads as a chip wherever it sits (§13.1), and a link some app
416
+ * A link some app
234
417
  * claims (§7.7) is a reference written as a URL — the form a message has when
235
418
  * it was written before the composer turned pasted links into chips, or by a
236
419
  * client that does not. Without this, the two would read differently for no
@@ -262,7 +445,7 @@ export function linksAsReferences(blocks: readonly RenderBlock[], resolveLink: L
262
445
  let at = 0
263
446
  for (const m of run.text.matchAll(LINK_OR_URL)) {
264
447
  // A link on words: neither its target nor a URL in its words is taken.
265
- if (m[1]) continue
448
+ if (m[1] || stuckToWord(run.text, m.index)) continue
266
449
  const start = m.index
267
450
  // A link on words whose words carry a mark arrives split across runs: its target follows `](`, and a URL as its words follows `[`.
268
451
  if (run.text.slice(Math.max(0, start - 2), start) === '](' || run.text[start - 1] === '[') continue
package/src/events.ts CHANGED
@@ -35,6 +35,7 @@
35
35
  import { sha256 } from '@noble/hashes/sha256'
36
36
  import { bytesToHex, utf8ToBytes } from '@noble/hashes/utils'
37
37
  import { type BlockDocument, serializeBlockDocument } from './blocks.js'
38
+ import { type Embed, embedTagsOf } from './embeds.js'
38
39
 
39
40
  /** A Nostr tag: an array of strings whose first element is the tag name. */
40
41
  export type NostrTag = string[]
@@ -716,6 +717,15 @@ export function buildEdit(
716
717
  targetEventId: string
717
718
  /** The new body, in the target's own format. */
718
719
  body: string
720
+ /**
721
+ * The message's whole `embed` set after this edit, when the edit changes it
722
+ * (SPEC §13.6.2): a set replaces, so every card it keeps is listed, and
723
+ * `none` for each it removes (`withCard`). Omitted or empty, the edit
724
+ * carries none and leaves the set as it was.
725
+ */
726
+ embeds?: readonly Embed[]
727
+ /** The whole `imeta` set after this edit, when it changes it; it folds the same way (§6.8). */
728
+ mediaTags?: NostrTag[]
719
729
  },
720
730
  ): UnsignedEvent {
721
731
  assertHex64(pubkey, 'pubkey')
@@ -735,6 +745,8 @@ export function buildEdit(
735
745
  // and a rounded `ts` could land in the next second and be discarded by
736
746
  // its own agreement rule.
737
747
  ['ts', String(Math.floor(createdAtMs))],
748
+ ...embedTagsOf(args.embeds ?? []),
749
+ ...(args.mediaTags ?? []),
738
750
  ],
739
751
  content: args.body,
740
752
  }
package/src/index.ts CHANGED
@@ -47,7 +47,7 @@
47
47
  /** Bumped by hand with the version in package.json — `test/version.test.ts`
48
48
  * pins the two together. It exists so "the upgrade reached the app" can be
49
49
  * checked by grepping a built bundle rather than by trusting a lockfile. */
50
- export const PROTOCOL_VERSION = '0.37.0'
50
+ export const PROTOCOL_VERSION = '0.39.0'
51
51
 
52
52
  export {
53
53
  // types
@@ -284,7 +284,28 @@ export {
284
284
  resolveCommentAnchor,
285
285
  selectionAnchorTags,
286
286
  } from './comment-anchor.js'
287
- export { type Embed, type EmbedLayout, type LinkResolver, EMBED_TAG, cardsIn, embedTag, embedsOf, linksAsReferences, referenceOfLink, urlRunsIn } from './embeds.js'
287
+ export {
288
+ type Embed,
289
+ type EmbedLayout,
290
+ type LineDraw,
291
+ type LinkResolver,
292
+ EMBED_TAG,
293
+ cardsIn,
294
+ defaultCardOf,
295
+ embedTag,
296
+ embedTagsOf,
297
+ embedsOf,
298
+ isFolderValue,
299
+ isOnlyReferenceLine,
300
+ lineDrawOf,
301
+ linesOf,
302
+ linksAsReferences,
303
+ referenceOfLink,
304
+ urlRunsIn,
305
+ valueOfReference,
306
+ valuesIn,
307
+ withCard,
308
+ } from './embeds.js'
288
309
  export {
289
310
  type BlossomVerb,
290
311
  type Imeta,