@estiva-app/protocol 0.38.0 → 0.40.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 +26 -0
- package/dist/embeds.d.ts +27 -13
- package/dist/embeds.d.ts.map +1 -1
- package/dist/embeds.js +85 -30
- package/dist/embeds.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/embeds.ts +86 -27
- package/src/index.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,32 @@ Every entry answers the wire question explicitly, including when the answer is
|
|
|
4
4
|
nothing (ADR 0002 §4b). A change to the bytes an app publishes is a MAJOR — in
|
|
5
5
|
`0.x`, a MINOR — even when no TypeScript signature moved.
|
|
6
6
|
|
|
7
|
+
## 0.40.0 — 2026-10-17
|
|
8
|
+
|
|
9
|
+
**Wire behaviour: reading changed, nothing new written** (SPEC §13.6.2, C20,
|
|
10
|
+
C25, C26, C27; WBM-10; record a-link-on-words-counts-toward-the-card). A link
|
|
11
|
+
on words, `[these words](<app URL>)`, now names its file: `valuesIn` counts its
|
|
12
|
+
target, so `cardsIn` draws the card a message chose for it and `defaultCardOf`
|
|
13
|
+
gives it the default when it is the message's only file. Its words stay a link
|
|
14
|
+
(`linksAsReferences` and `lineDrawOf` unchanged), a URL in its words still
|
|
15
|
+
names nothing, and a web link that resolves to nothing still does not count.
|
|
16
|
+
A link on words whose words carry a mark (`[**words**](url)`, split across
|
|
17
|
+
runs) counts too, and a URL in such words now names nothing, as in plain words.
|
|
18
|
+
`[](url)` is not a link on words and names nothing. A block document's link run
|
|
19
|
+
counts its `href` whatever its words, code-styled words included. Old messages that chose a card on words draw it again (Miky, 17 Oct).
|
|
20
|
+
|
|
21
|
+
## 0.39.0 — 2026-10-16
|
|
22
|
+
|
|
23
|
+
**Wire behaviour: changed, on edits only** (SPEC §13.6.2; Widgets 2). An edit
|
|
24
|
+
now carries an `embed` layout this writer does not know as it was written
|
|
25
|
+
(`Embed.written`, from `embedsOf`), where 0.38.0 rewrote it as `compact`.
|
|
26
|
+
`defaultCardOf` loses the `embeds` option: a link taken out of a message and
|
|
27
|
+
put back gets its default card again, whichever ✕ removed it (Miky, 16 Oct).
|
|
28
|
+
Reading: `lineDrawOf`'s `row` and `nothing` carry `url` when the line is a URL,
|
|
29
|
+
so a reader that cannot read the file draws the URL, not an empty row. A URL
|
|
30
|
+
right after a letter outside the BMP (`𝑎https://…`) is stuck to that word, as
|
|
31
|
+
after any other Unicode letter or number.
|
|
32
|
+
|
|
7
33
|
## 0.38.0 — 2026-10-16
|
|
8
34
|
|
|
9
35
|
**Wire behaviour: changed — where a link sits decides how it draws in a
|
package/dist/embeds.d.ts
CHANGED
|
@@ -8,14 +8,21 @@ export interface Embed {
|
|
|
8
8
|
/** An address (`kind:pubkey:d`) or a 64-hex event id, lowercase hex. */
|
|
9
9
|
value: string;
|
|
10
10
|
layout: EmbedLayout;
|
|
11
|
+
/**
|
|
12
|
+
* The layout as its tag wrote it, when this reader does not know it (and
|
|
13
|
+
* draws it as `compact`). An edit carries it as written ({@link embedTagsOf}),
|
|
14
|
+
* so a density added later is not rewritten by an older writer.
|
|
15
|
+
*/
|
|
16
|
+
written?: string;
|
|
11
17
|
}
|
|
12
18
|
/** The `embed` tag for one reference. */
|
|
13
19
|
export declare function embedTag(value: string, layout: EmbedLayout): string[];
|
|
14
20
|
/**
|
|
15
21
|
* A whole `embed` set as tags, as a send or an edit writes it: each value
|
|
16
|
-
* normalised as {@link embedsOf} reads it, the first entry per value kept
|
|
22
|
+
* normalised as {@link embedsOf} reads it, the first entry per value kept, and
|
|
23
|
+
* a layout this writer does not know carried as it was written (`written`).
|
|
17
24
|
* Throws on a value that is neither an address nor an event id, or on a
|
|
18
|
-
* layout
|
|
25
|
+
* layout that is neither known nor carried, rather than write a tag readers skip.
|
|
19
26
|
*/
|
|
20
27
|
export declare function embedTagsOf(set: readonly Embed[]): string[][];
|
|
21
28
|
/**
|
|
@@ -52,7 +59,8 @@ export declare function valueOfReference(reference: string): string | undefined;
|
|
|
52
59
|
* `embeds` is the message's folded set; `blocks` its folded body as a render
|
|
53
60
|
* tree; `parts` its `part` pointers (§13.6.1). A value appears here only while
|
|
54
61
|
* the body names it — by a `nostr:` reference, or by an app link that
|
|
55
|
-
* `resolveLink` resolves to it (§7.7)
|
|
62
|
+
* `resolveLink` resolves to it (§7.7), bare or as a link on words' target —
|
|
63
|
+
* and only when no `part` names the
|
|
56
64
|
* same address, because the live block already stands for that object. Text in
|
|
57
65
|
* a code span names nothing (§13.1). Without `resolveLink` a link names nothing:
|
|
58
66
|
* resolving one needs the manifests and the relay, which this package does not hold.
|
|
@@ -64,8 +72,12 @@ export declare function cardsIn(embeds: readonly Embed[], blocks: readonly Rende
|
|
|
64
72
|
/**
|
|
65
73
|
* Every address and event id a message's body names, once each, in the order
|
|
66
74
|
* it first names them: by a `nostr:` reference, or by an app link that
|
|
67
|
-
* `resolveLink` resolves (§7.7)
|
|
68
|
-
*
|
|
75
|
+
* `resolveLink` resolves (§7.7), written bare or as the target of a link on
|
|
76
|
+
* words. A link on words keeps its words where it draws, but names its file;
|
|
77
|
+
* a URL in its words names nothing. A person names no value. Text in a code
|
|
78
|
+
* span names nothing (§13.1). What {@link cardsIn} and {@link defaultCardOf} count.
|
|
79
|
+
*
|
|
80
|
+
* why: https://github.com/estiva-app/estiva-docs/blob/main/decisions/a-link-on-words-counts-toward-the-card.md
|
|
69
81
|
*/
|
|
70
82
|
export declare function valuesIn(blocks: readonly RenderBlock[], resolveLink?: LinkResolver): string[];
|
|
71
83
|
/**
|
|
@@ -108,6 +120,7 @@ export type LineDraw = {
|
|
|
108
120
|
} | {
|
|
109
121
|
draw: 'row' | 'nothing';
|
|
110
122
|
value: string;
|
|
123
|
+
url?: string;
|
|
111
124
|
} | {
|
|
112
125
|
draw: 'url';
|
|
113
126
|
url: string;
|
|
@@ -121,7 +134,9 @@ export type LineDraw = {
|
|
|
121
134
|
* stands for it. `cards` is {@link cardsIn}'s answer (its `none` entries draw
|
|
122
135
|
* no card), `parts` the message's `part` pointers. A Folder alone on its line
|
|
123
136
|
* stays a chip, so its line is a sentence. Whether the reader can read a
|
|
124
|
-
* `row`'s object is its own business
|
|
137
|
+
* `row`'s object is its own business. One it cannot read draws the unreadable
|
|
138
|
+
* row when the line is a `nostr:` reference; when the line is a URL (`url` is
|
|
139
|
+
* set) it stays the URL as written, never an empty row (§13.6.2).
|
|
125
140
|
*/
|
|
126
141
|
export declare function lineDrawOf(line: readonly RenderInline[], block: Pick<RenderBlock, 'type'>, context?: {
|
|
127
142
|
cards?: readonly Embed[];
|
|
@@ -140,18 +155,17 @@ export declare function lineDrawOf(line: readonly RenderInline[], block: Pick<Re
|
|
|
140
155
|
* counts, it gets the card, unless a part names it (the part wins, and draws
|
|
141
156
|
* under the message already).
|
|
142
157
|
*
|
|
143
|
-
* On an edit, pass the values the previous folded body named as `previous
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
158
|
+
* On an edit, pass the values the previous folded body named as `previous`:
|
|
159
|
+
* the default is only for a file the edit names first, so a card its author
|
|
160
|
+
* removed with ✕, which left no tag before sending or `none` after, does not
|
|
161
|
+
* come back while the link stays. A link taken out and put back is named
|
|
162
|
+
* first again and gets its card, whichever ✕ removed it (Miky, 2026-10-16).
|
|
163
|
+
* The edit then carries the whole folded set with this one set to `detailed`
|
|
149
164
|
* ({@link withCard}).
|
|
150
165
|
*/
|
|
151
166
|
export declare function defaultCardOf(values: readonly string[], parts?: readonly PartPointer[], options?: {
|
|
152
167
|
here?: string;
|
|
153
168
|
previous?: readonly string[];
|
|
154
|
-
embeds?: readonly Embed[];
|
|
155
169
|
}): string | undefined;
|
|
156
170
|
/**
|
|
157
171
|
* A folded `embed` set with `value` set to `layout`, the rest kept as they
|
package/dist/embeds.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embeds.d.ts","sourceRoot":"","sources":["../src/embeds.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE5D,eAAO,MAAM,SAAS,UAAU,CAAA;AAEhC,2EAA2E;AAC3E,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,UAAU,GAAG,MAAM,CAAA;AAEzD,6BAA6B;AAC7B,MAAM,WAAW,KAAK;IACpB,wEAAwE;IACxE,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"embeds.d.ts","sourceRoot":"","sources":["../src/embeds.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE5D,eAAO,MAAM,SAAS,UAAU,CAAA;AAEhC,2EAA2E;AAC3E,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,UAAU,GAAG,MAAM,CAAA;AAEzD,6BAA6B;AAC7B,MAAM,WAAW,KAAK;IACpB,wEAAwE;IACxE,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,WAAW,CAAA;IACnB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,yCAAyC;AACzC,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,MAAM,EAAE,CAErE;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,SAAS,KAAK,EAAE,GAAG,MAAM,EAAE,EAAE,CAU7D;AAMD;;;;;;;;;;;GAWG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE;IAAE,IAAI,EAAE,SAAS,CAAC,SAAS,MAAM,EA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AAE,CA0C1G"}
|
package/dist/embeds.js
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* in an edit can still carry a card (Miky, 2026-10-13, OPT-16 kickoff).
|
|
21
21
|
* {@link cardsIn} applies that rule; {@link embedsOf} reads the tags alone.
|
|
22
22
|
*
|
|
23
|
-
* why: https://github.com/estiva-app/estiva-docs/blob/main/decisions/
|
|
23
|
+
* why: https://github.com/estiva-app/estiva-docs/blob/main/decisions/a-link-on-words-counts-toward-the-card.md
|
|
24
24
|
*/
|
|
25
25
|
import { addrToNaddr, bech32Decode, convertBits, decodeNevent, encodeNevent, naddrToAddr } from './nip19.js';
|
|
26
26
|
export const EMBED_TAG = 'embed';
|
|
@@ -30,9 +30,10 @@ export function embedTag(value, layout) {
|
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
32
|
* A whole `embed` set as tags, as a send or an edit writes it: each value
|
|
33
|
-
* normalised as {@link embedsOf} reads it, the first entry per value kept
|
|
33
|
+
* normalised as {@link embedsOf} reads it, the first entry per value kept, and
|
|
34
|
+
* a layout this writer does not know carried as it was written (`written`).
|
|
34
35
|
* Throws on a value that is neither an address nor an event id, or on a
|
|
35
|
-
* layout
|
|
36
|
+
* layout that is neither known nor carried, rather than write a tag readers skip.
|
|
36
37
|
*/
|
|
37
38
|
export function embedTagsOf(set) {
|
|
38
39
|
const seen = new Set();
|
|
@@ -45,7 +46,7 @@ export function embedTagsOf(set) {
|
|
|
45
46
|
if (seen.has(value))
|
|
46
47
|
return [];
|
|
47
48
|
seen.add(value);
|
|
48
|
-
return [
|
|
49
|
+
return [[EMBED_TAG, value, (e.layout === 'compact' && e.written) || e.layout]];
|
|
49
50
|
});
|
|
50
51
|
}
|
|
51
52
|
// `partsOf`'s shape: an empty `d` is a valid address (NIP-01).
|
|
@@ -73,7 +74,8 @@ export function embedsOf(event) {
|
|
|
73
74
|
if (!value || seen.has(value))
|
|
74
75
|
continue;
|
|
75
76
|
seen.add(value);
|
|
76
|
-
|
|
77
|
+
const layout = layoutOf(tag[2]);
|
|
78
|
+
out.push(tag[2] && tag[2] !== layout ? { value, layout, written: tag[2] } : { value, layout });
|
|
77
79
|
}
|
|
78
80
|
return out;
|
|
79
81
|
}
|
|
@@ -99,7 +101,12 @@ function trimUrl(url) {
|
|
|
99
101
|
}
|
|
100
102
|
/** A URL stuck to the end of a word (`seehttps://…`) is the word's, not a link. */
|
|
101
103
|
function stuckToWord(text, start) {
|
|
102
|
-
|
|
104
|
+
if (start === 0)
|
|
105
|
+
return false;
|
|
106
|
+
// The code point before it, so a letter outside the BMP (a surrogate pair) counts too.
|
|
107
|
+
const pair = start >= 2 && /[\uDC00-\uDFFF]/.test(text[start - 1]) && /[\uD800-\uDBFF]/.test(text[start - 2]);
|
|
108
|
+
const at = pair ? start - 2 : start - 1;
|
|
109
|
+
return /[\p{L}\p{N}]/u.test(String.fromCodePoint(text.codePointAt(at)));
|
|
103
110
|
}
|
|
104
111
|
/**
|
|
105
112
|
* The address or event id a `nostr:` reference names — what an `a`, `q` or
|
|
@@ -131,7 +138,8 @@ export function valueOfReference(reference) {
|
|
|
131
138
|
* `embeds` is the message's folded set; `blocks` its folded body as a render
|
|
132
139
|
* tree; `parts` its `part` pointers (§13.6.1). A value appears here only while
|
|
133
140
|
* the body names it — by a `nostr:` reference, or by an app link that
|
|
134
|
-
* `resolveLink` resolves to it (§7.7)
|
|
141
|
+
* `resolveLink` resolves to it (§7.7), bare or as a link on words' target —
|
|
142
|
+
* and only when no `part` names the
|
|
135
143
|
* same address, because the live block already stands for that object. Text in
|
|
136
144
|
* a code span names nothing (§13.1). Without `resolveLink` a link names nothing:
|
|
137
145
|
* resolving one needs the manifests and the relay, which this package does not hold.
|
|
@@ -152,8 +160,12 @@ export function cardsIn(embeds, blocks, parts = [], resolveLink) {
|
|
|
152
160
|
/**
|
|
153
161
|
* Every address and event id a message's body names, once each, in the order
|
|
154
162
|
* it first names them: by a `nostr:` reference, or by an app link that
|
|
155
|
-
* `resolveLink` resolves (§7.7)
|
|
156
|
-
*
|
|
163
|
+
* `resolveLink` resolves (§7.7), written bare or as the target of a link on
|
|
164
|
+
* words. A link on words keeps its words where it draws, but names its file;
|
|
165
|
+
* a URL in its words names nothing. A person names no value. Text in a code
|
|
166
|
+
* span names nothing (§13.1). What {@link cardsIn} and {@link defaultCardOf} count.
|
|
167
|
+
*
|
|
168
|
+
* why: https://github.com/estiva-app/estiva-docs/blob/main/decisions/a-link-on-words-counts-toward-the-card.md
|
|
157
169
|
*/
|
|
158
170
|
export function valuesIn(blocks, resolveLink) {
|
|
159
171
|
const out = [];
|
|
@@ -165,23 +177,47 @@ export function valuesIn(blocks, resolveLink) {
|
|
|
165
177
|
out.push(value);
|
|
166
178
|
};
|
|
167
179
|
const resolve = (url) => resolveLink && take(normalise(resolveLink(url) ?? ''));
|
|
168
|
-
//
|
|
180
|
+
// A bare URL names a value exactly where {@link linksAsReferences} draws it as a reference;
|
|
181
|
+
// a link on words names its target, never a URL in its words. Each is taken where it starts.
|
|
169
182
|
const walk = (bs) => {
|
|
170
183
|
for (const block of bs) {
|
|
171
184
|
if (block.type !== 'codeBlock') {
|
|
172
|
-
|
|
185
|
+
const runs = block.inline ?? [];
|
|
186
|
+
const links = linksOnWordsIn(runs);
|
|
187
|
+
const named = [];
|
|
188
|
+
// `links` is in text order and its spans do not overlap, so two cursors keep this linear.
|
|
189
|
+
let inWords = 0;
|
|
190
|
+
let byTarget = 0;
|
|
191
|
+
let at = 0;
|
|
192
|
+
for (const run of runs) {
|
|
193
|
+
const end = at + run.text.length;
|
|
173
194
|
if (run.reference)
|
|
174
|
-
|
|
175
|
-
else if (run.
|
|
176
|
-
|
|
177
|
-
else if (run.
|
|
178
|
-
|
|
179
|
-
|
|
195
|
+
named.push({ at, reference: run.reference });
|
|
196
|
+
else if (run.href !== undefined)
|
|
197
|
+
named.push({ at, url: run.href });
|
|
198
|
+
else if (!run.marks.includes('code')) {
|
|
199
|
+
for (const { url, from } of urlRunsIn(run.text)) {
|
|
200
|
+
const pos = at + from;
|
|
201
|
+
while (inWords < links.length && links[inWords].wordsEnd <= pos)
|
|
202
|
+
inWords++;
|
|
203
|
+
const link = links[inWords];
|
|
204
|
+
if (!link || pos < link.from)
|
|
205
|
+
named.push({ at: pos, url });
|
|
206
|
+
}
|
|
207
|
+
while (byTarget < links.length && links[byTarget].target < at)
|
|
208
|
+
byTarget++;
|
|
209
|
+
for (; byTarget < links.length && links[byTarget].target < end; byTarget++) {
|
|
210
|
+
const link = links[byTarget];
|
|
211
|
+
// Only a target written whole in this run, `)` included, is the URL a reader draws.
|
|
212
|
+
if (link.target + link.url.length + 1 <= end)
|
|
213
|
+
named.push({ at: link.from, url: link.url });
|
|
214
|
+
}
|
|
180
215
|
}
|
|
181
|
-
|
|
182
|
-
for (const { url } of urlRunsIn(run.text))
|
|
183
|
-
resolve(url);
|
|
216
|
+
at = end;
|
|
184
217
|
}
|
|
218
|
+
named.sort((a, b) => a.at - b.at);
|
|
219
|
+
for (const n of named)
|
|
220
|
+
n.reference ? take(valueOfReference(n.reference)) : resolve(n.url);
|
|
185
221
|
}
|
|
186
222
|
if (block.children)
|
|
187
223
|
walk(block.children);
|
|
@@ -247,7 +283,9 @@ export function isFolderValue(value) {
|
|
|
247
283
|
* stands for it. `cards` is {@link cardsIn}'s answer (its `none` entries draw
|
|
248
284
|
* no card), `parts` the message's `part` pointers. A Folder alone on its line
|
|
249
285
|
* stays a chip, so its line is a sentence. Whether the reader can read a
|
|
250
|
-
* `row`'s object is its own business
|
|
286
|
+
* `row`'s object is its own business. One it cannot read draws the unreadable
|
|
287
|
+
* row when the line is a `nostr:` reference; when the line is a URL (`url` is
|
|
288
|
+
* set) it stays the URL as written, never an empty row (§13.6.2).
|
|
251
289
|
*/
|
|
252
290
|
export function lineDrawOf(line, block, context = {}) {
|
|
253
291
|
const only = isOnlyReferenceLine(line, block);
|
|
@@ -261,7 +299,7 @@ export function lineDrawOf(line, block, context = {}) {
|
|
|
261
299
|
return { draw: 'sentence' };
|
|
262
300
|
const carded = (context.cards ?? []).some((e) => e.value === value && e.layout !== 'none') ||
|
|
263
301
|
(context.parts ?? []).some((p) => normalise(p.address) === value);
|
|
264
|
-
return { draw: carded ? 'nothing' : 'row', value };
|
|
302
|
+
return { draw: carded ? 'nothing' : 'row', value, ...(isReference ? {} : { url: only }) };
|
|
265
303
|
}
|
|
266
304
|
/**
|
|
267
305
|
* The value a writer gives the default card, `["embed", V, "detailed"]`, as
|
|
@@ -275,12 +313,12 @@ export function lineDrawOf(line, block, context = {}) {
|
|
|
275
313
|
* counts, it gets the card, unless a part names it (the part wins, and draws
|
|
276
314
|
* under the message already).
|
|
277
315
|
*
|
|
278
|
-
* On an edit, pass the values the previous folded body named as `previous
|
|
279
|
-
*
|
|
280
|
-
*
|
|
281
|
-
*
|
|
282
|
-
*
|
|
283
|
-
*
|
|
316
|
+
* On an edit, pass the values the previous folded body named as `previous`:
|
|
317
|
+
* the default is only for a file the edit names first, so a card its author
|
|
318
|
+
* removed with ✕, which left no tag before sending or `none` after, does not
|
|
319
|
+
* come back while the link stays. A link taken out and put back is named
|
|
320
|
+
* first again and gets its card, whichever ✕ removed it (Miky, 2026-10-16).
|
|
321
|
+
* The edit then carries the whole folded set with this one set to `detailed`
|
|
284
322
|
* ({@link withCard}).
|
|
285
323
|
*/
|
|
286
324
|
export function defaultCardOf(values, parts = [], options = {}) {
|
|
@@ -295,8 +333,6 @@ export function defaultCardOf(values, parts = [], options = {}) {
|
|
|
295
333
|
return undefined;
|
|
296
334
|
if (options.previous?.some((v) => normalise(v) === file))
|
|
297
335
|
return undefined;
|
|
298
|
-
if (options.embeds?.some((e) => normalise(e.value) === file))
|
|
299
|
-
return undefined;
|
|
300
336
|
return file;
|
|
301
337
|
}
|
|
302
338
|
/**
|
|
@@ -353,6 +389,25 @@ export function urlRunsIn(text) {
|
|
|
353
389
|
}
|
|
354
390
|
return out;
|
|
355
391
|
}
|
|
392
|
+
/**
|
|
393
|
+
* Each link on words in a block of marker text, `[words](https://…)`, found
|
|
394
|
+
* over the block's runs joined, so one whose words carry a mark (split across
|
|
395
|
+
* runs) is found too. Offsets are into that joined text: `from` the `[`,
|
|
396
|
+
* `wordsEnd` the `]`, `target` where the URL starts (SPEC §13.6.2).
|
|
397
|
+
*/
|
|
398
|
+
function linksOnWordsIn(runs) {
|
|
399
|
+
const text = runs.map((r) => r.text).join('');
|
|
400
|
+
if (!text.includes(']('))
|
|
401
|
+
return [];
|
|
402
|
+
const out = [];
|
|
403
|
+
for (const m of text.matchAll(LINK_OR_URL)) {
|
|
404
|
+
if (!m[1])
|
|
405
|
+
continue;
|
|
406
|
+
const close = m[1].indexOf('](');
|
|
407
|
+
out.push({ from: m.index, wordsEnd: m.index + close, target: m.index + close + 2, url: m[1].slice(close + 2, -1) });
|
|
408
|
+
}
|
|
409
|
+
return out;
|
|
410
|
+
}
|
|
356
411
|
/**
|
|
357
412
|
* One pass over a run: a link on words, `[words](https://…)` as the marker
|
|
358
413
|
* format writes it (group 1 — its URL is the target of words the author chose),
|
package/dist/embeds.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embeds.js","sourceRoot":"","sources":["../src/embeds.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAI5G,MAAM,CAAC,MAAM,SAAS,GAAG,OAAO,CAAA;AAYhC,yCAAyC;AACzC,MAAM,UAAU,QAAQ,CAAC,KAAa,EAAE,MAAmB;IACzD,OAAO,CAAC,SAAS,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;AACnC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,GAAqB;IAC/C,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAA;IAC9B,OAAO,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC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AAA;AACrB,CAAC"}
|
package/dist/index.d.ts
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 declare const PROTOCOL_VERSION = "0.
|
|
49
|
+
export declare const PROTOCOL_VERSION = "0.40.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';
|
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.
|
|
49
|
+
export const PROTOCOL_VERSION = '0.40.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,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@estiva-app/protocol",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.40.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
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* in an edit can still carry a card (Miky, 2026-10-13, OPT-16 kickoff).
|
|
21
21
|
* {@link cardsIn} applies that rule; {@link embedsOf} reads the tags alone.
|
|
22
22
|
*
|
|
23
|
-
* why: https://github.com/estiva-app/estiva-docs/blob/main/decisions/
|
|
23
|
+
* why: https://github.com/estiva-app/estiva-docs/blob/main/decisions/a-link-on-words-counts-toward-the-card.md
|
|
24
24
|
*/
|
|
25
25
|
import { addrToNaddr, bech32Decode, convertBits, decodeNevent, encodeNevent, naddrToAddr } from './nip19.js'
|
|
26
26
|
import type { PartPointer } from './anchors.js'
|
|
@@ -36,6 +36,12 @@ export interface Embed {
|
|
|
36
36
|
/** An address (`kind:pubkey:d`) or a 64-hex event id, lowercase hex. */
|
|
37
37
|
value: string
|
|
38
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
|
|
39
45
|
}
|
|
40
46
|
|
|
41
47
|
/** The `embed` tag for one reference. */
|
|
@@ -45,9 +51,10 @@ export function embedTag(value: string, layout: EmbedLayout): string[] {
|
|
|
45
51
|
|
|
46
52
|
/**
|
|
47
53
|
* A whole `embed` set as tags, as a send or an edit writes it: each value
|
|
48
|
-
* normalised as {@link embedsOf} reads it, the first entry per value kept
|
|
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`).
|
|
49
56
|
* Throws on a value that is neither an address nor an event id, or on a
|
|
50
|
-
* layout
|
|
57
|
+
* layout that is neither known nor carried, rather than write a tag readers skip.
|
|
51
58
|
*/
|
|
52
59
|
export function embedTagsOf(set: readonly Embed[]): string[][] {
|
|
53
60
|
const seen = new Set<string>()
|
|
@@ -57,7 +64,7 @@ export function embedTagsOf(set: readonly Embed[]): string[][] {
|
|
|
57
64
|
if (e.layout !== 'compact' && e.layout !== 'detailed' && e.layout !== 'none') throw new Error(`not an embed layout: ${String(e.layout)}`)
|
|
58
65
|
if (seen.has(value)) return []
|
|
59
66
|
seen.add(value)
|
|
60
|
-
return [
|
|
67
|
+
return [[EMBED_TAG, value, (e.layout === 'compact' && e.written) || e.layout]]
|
|
61
68
|
})
|
|
62
69
|
}
|
|
63
70
|
|
|
@@ -85,7 +92,8 @@ export function embedsOf(event: { tags: readonly (readonly string[])[] }): Embed
|
|
|
85
92
|
const value = normalise(tag[1])
|
|
86
93
|
if (!value || seen.has(value)) continue
|
|
87
94
|
seen.add(value)
|
|
88
|
-
|
|
95
|
+
const layout = layoutOf(tag[2])
|
|
96
|
+
out.push(tag[2] && tag[2] !== layout ? { value, layout, written: tag[2] } : { value, layout })
|
|
89
97
|
}
|
|
90
98
|
return out
|
|
91
99
|
}
|
|
@@ -122,7 +130,11 @@ function trimUrl(url: string): string {
|
|
|
122
130
|
|
|
123
131
|
/** A URL stuck to the end of a word (`seehttps://…`) is the word's, not a link. */
|
|
124
132
|
function stuckToWord(text: string, start: number): boolean {
|
|
125
|
-
|
|
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)!))
|
|
126
138
|
}
|
|
127
139
|
|
|
128
140
|
/**
|
|
@@ -152,7 +164,8 @@ export function valueOfReference(reference: string): string | undefined {
|
|
|
152
164
|
* `embeds` is the message's folded set; `blocks` its folded body as a render
|
|
153
165
|
* tree; `parts` its `part` pointers (§13.6.1). A value appears here only while
|
|
154
166
|
* the body names it — by a `nostr:` reference, or by an app link that
|
|
155
|
-
* `resolveLink` resolves to it (§7.7)
|
|
167
|
+
* `resolveLink` resolves to it (§7.7), bare or as a link on words' target —
|
|
168
|
+
* and only when no `part` names the
|
|
156
169
|
* same address, because the live block already stands for that object. Text in
|
|
157
170
|
* a code span names nothing (§13.1). Without `resolveLink` a link names nothing:
|
|
158
171
|
* resolving one needs the manifests and the relay, which this package does not hold.
|
|
@@ -173,8 +186,12 @@ export function cardsIn(embeds: readonly Embed[], blocks: readonly RenderBlock[]
|
|
|
173
186
|
/**
|
|
174
187
|
* Every address and event id a message's body names, once each, in the order
|
|
175
188
|
* it first names them: by a `nostr:` reference, or by an app link that
|
|
176
|
-
* `resolveLink` resolves (§7.7)
|
|
177
|
-
*
|
|
189
|
+
* `resolveLink` resolves (§7.7), written bare or as the target of a link on
|
|
190
|
+
* words. A link on words keeps its words where it draws, but names its file;
|
|
191
|
+
* a URL in its words names nothing. A person names no value. Text in a code
|
|
192
|
+
* span names nothing (§13.1). What {@link cardsIn} and {@link defaultCardOf} count.
|
|
193
|
+
*
|
|
194
|
+
* why: https://github.com/estiva-app/estiva-docs/blob/main/decisions/a-link-on-words-counts-toward-the-card.md
|
|
178
195
|
*/
|
|
179
196
|
export function valuesIn(blocks: readonly RenderBlock[], resolveLink?: LinkResolver): string[] {
|
|
180
197
|
const out: string[] = []
|
|
@@ -185,17 +202,40 @@ export function valuesIn(blocks: readonly RenderBlock[], resolveLink?: LinkResol
|
|
|
185
202
|
out.push(value)
|
|
186
203
|
}
|
|
187
204
|
const resolve = (url: string) => resolveLink && take(normalise(resolveLink(url) ?? ''))
|
|
188
|
-
//
|
|
205
|
+
// A bare URL names a value exactly where {@link linksAsReferences} draws it as a reference;
|
|
206
|
+
// a link on words names its target, never a URL in its words. Each is taken where it starts.
|
|
189
207
|
const walk = (bs: readonly RenderBlock[]) => {
|
|
190
208
|
for (const block of bs) {
|
|
191
209
|
if (block.type !== 'codeBlock') {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
210
|
+
const runs = block.inline ?? []
|
|
211
|
+
const links = linksOnWordsIn(runs)
|
|
212
|
+
const named: { at: number; reference?: string; url?: string }[] = []
|
|
213
|
+
// `links` is in text order and its spans do not overlap, so two cursors keep this linear.
|
|
214
|
+
let inWords = 0
|
|
215
|
+
let byTarget = 0
|
|
216
|
+
let at = 0
|
|
217
|
+
for (const run of runs) {
|
|
218
|
+
const end = at + run.text.length
|
|
219
|
+
if (run.reference) named.push({ at, reference: run.reference })
|
|
220
|
+
else if (run.href !== undefined) named.push({ at, url: run.href })
|
|
221
|
+
else if (!run.marks.includes('code')) {
|
|
222
|
+
for (const { url, from } of urlRunsIn(run.text)) {
|
|
223
|
+
const pos = at + from
|
|
224
|
+
while (inWords < links.length && links[inWords].wordsEnd <= pos) inWords++
|
|
225
|
+
const link = links[inWords]
|
|
226
|
+
if (!link || pos < link.from) named.push({ at: pos, url })
|
|
227
|
+
}
|
|
228
|
+
while (byTarget < links.length && links[byTarget].target < at) byTarget++
|
|
229
|
+
for (; byTarget < links.length && links[byTarget].target < end; byTarget++) {
|
|
230
|
+
const link = links[byTarget]
|
|
231
|
+
// Only a target written whole in this run, `)` included, is the URL a reader draws.
|
|
232
|
+
if (link.target + link.url.length + 1 <= end) named.push({ at: link.from, url: link.url })
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
at = end
|
|
198
236
|
}
|
|
237
|
+
named.sort((a, b) => a.at - b.at)
|
|
238
|
+
for (const n of named) n.reference ? take(valueOfReference(n.reference)) : resolve(n.url!)
|
|
199
239
|
}
|
|
200
240
|
if (block.children) walk(block.children)
|
|
201
241
|
}
|
|
@@ -267,7 +307,7 @@ export function isFolderValue(value: string): boolean {
|
|
|
267
307
|
*/
|
|
268
308
|
export type LineDraw =
|
|
269
309
|
| { draw: 'sentence' }
|
|
270
|
-
| { draw: 'row' | 'nothing'; value: string }
|
|
310
|
+
| { draw: 'row' | 'nothing'; value: string; url?: string }
|
|
271
311
|
| { draw: 'url'; url: string }
|
|
272
312
|
| { draw: 'unreadable'; reference: string }
|
|
273
313
|
|
|
@@ -277,7 +317,9 @@ export type LineDraw =
|
|
|
277
317
|
* stands for it. `cards` is {@link cardsIn}'s answer (its `none` entries draw
|
|
278
318
|
* no card), `parts` the message's `part` pointers. A Folder alone on its line
|
|
279
319
|
* stays a chip, so its line is a sentence. Whether the reader can read a
|
|
280
|
-
* `row`'s object is its own business
|
|
320
|
+
* `row`'s object is its own business. One it cannot read draws the unreadable
|
|
321
|
+
* row when the line is a `nostr:` reference; when the line is a URL (`url` is
|
|
322
|
+
* set) it stays the URL as written, never an empty row (§13.6.2).
|
|
281
323
|
*/
|
|
282
324
|
export function lineDrawOf(
|
|
283
325
|
line: readonly RenderInline[],
|
|
@@ -293,7 +335,7 @@ export function lineDrawOf(
|
|
|
293
335
|
const carded =
|
|
294
336
|
(context.cards ?? []).some((e) => e.value === value && e.layout !== 'none') ||
|
|
295
337
|
(context.parts ?? []).some((p) => normalise(p.address) === value)
|
|
296
|
-
return { draw: carded ? 'nothing' : 'row', value }
|
|
338
|
+
return { draw: carded ? 'nothing' : 'row', value, ...(isReference ? {} : { url: only }) }
|
|
297
339
|
}
|
|
298
340
|
|
|
299
341
|
/**
|
|
@@ -308,18 +350,18 @@ export function lineDrawOf(
|
|
|
308
350
|
* counts, it gets the card, unless a part names it (the part wins, and draws
|
|
309
351
|
* under the message already).
|
|
310
352
|
*
|
|
311
|
-
* On an edit, pass the values the previous folded body named as `previous
|
|
312
|
-
*
|
|
313
|
-
*
|
|
314
|
-
*
|
|
315
|
-
*
|
|
316
|
-
*
|
|
353
|
+
* On an edit, pass the values the previous folded body named as `previous`:
|
|
354
|
+
* the default is only for a file the edit names first, so a card its author
|
|
355
|
+
* removed with ✕, which left no tag before sending or `none` after, does not
|
|
356
|
+
* come back while the link stays. A link taken out and put back is named
|
|
357
|
+
* first again and gets its card, whichever ✕ removed it (Miky, 2026-10-16).
|
|
358
|
+
* The edit then carries the whole folded set with this one set to `detailed`
|
|
317
359
|
* ({@link withCard}).
|
|
318
360
|
*/
|
|
319
361
|
export function defaultCardOf(
|
|
320
362
|
values: readonly string[],
|
|
321
363
|
parts: readonly PartPointer[] = [],
|
|
322
|
-
options: { here?: string; previous?: readonly string[]
|
|
364
|
+
options: { here?: string; previous?: readonly string[] } = {},
|
|
323
365
|
): string | undefined {
|
|
324
366
|
const here = normalise(options.here ?? '')
|
|
325
367
|
const withPart = new Set(parts.map((p) => normalise(p.address)).filter((v): v is string => !!v))
|
|
@@ -329,7 +371,6 @@ export function defaultCardOf(
|
|
|
329
371
|
const [file] = files
|
|
330
372
|
if (withPart.has(file)) return undefined
|
|
331
373
|
if (options.previous?.some((v) => normalise(v) === file)) return undefined
|
|
332
|
-
if (options.embeds?.some((e) => normalise(e.value) === file)) return undefined
|
|
333
374
|
return file
|
|
334
375
|
}
|
|
335
376
|
|
|
@@ -384,6 +425,24 @@ export function urlRunsIn(text: string): { url: string; from: number; to: number
|
|
|
384
425
|
return out
|
|
385
426
|
}
|
|
386
427
|
|
|
428
|
+
/**
|
|
429
|
+
* Each link on words in a block of marker text, `[words](https://…)`, found
|
|
430
|
+
* over the block's runs joined, so one whose words carry a mark (split across
|
|
431
|
+
* runs) is found too. Offsets are into that joined text: `from` the `[`,
|
|
432
|
+
* `wordsEnd` the `]`, `target` where the URL starts (SPEC §13.6.2).
|
|
433
|
+
*/
|
|
434
|
+
function linksOnWordsIn(runs: readonly RenderInline[]): { from: number; wordsEnd: number; target: number; url: string }[] {
|
|
435
|
+
const text = runs.map((r) => r.text).join('')
|
|
436
|
+
if (!text.includes('](')) return []
|
|
437
|
+
const out: { from: number; wordsEnd: number; target: number; url: string }[] = []
|
|
438
|
+
for (const m of text.matchAll(LINK_OR_URL)) {
|
|
439
|
+
if (!m[1]) continue
|
|
440
|
+
const close = m[1].indexOf('](')
|
|
441
|
+
out.push({ from: m.index, wordsEnd: m.index + close, target: m.index + close + 2, url: m[1].slice(close + 2, -1) })
|
|
442
|
+
}
|
|
443
|
+
return out
|
|
444
|
+
}
|
|
445
|
+
|
|
387
446
|
/**
|
|
388
447
|
* One pass over a run: a link on words, `[words](https://…)` as the marker
|
|
389
448
|
* format writes it (group 1 — its URL is the target of words the author chose),
|
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.
|
|
50
|
+
export const PROTOCOL_VERSION = '0.40.0'
|
|
51
51
|
|
|
52
52
|
export {
|
|
53
53
|
// types
|