@estiva-app/conversation 0.14.0 → 0.15.1
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 +36 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/references.d.ts +19 -7
- package/dist/references.d.ts.map +1 -1
- package/dist/references.js +109 -28
- package/dist/references.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +1 -1
- package/src/references.ts +111 -26
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,42 @@ 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.15.1 — 2026-10-19
|
|
10
|
+
|
|
11
|
+
**`-"…"` leaves a phrase out**, as the relay reads it (buzz#32).
|
|
12
|
+
`referenceMatch` drops a text that holds those whole words next to each other,
|
|
13
|
+
in order, so `remov -"short summary"` no longer finds *Remove Short summary…*
|
|
14
|
+
while `remov -"summary short"` still does. In 0.15.0 the `-` was dropped and
|
|
15
|
+
the phrase became one to find, the opposite. A `-"` whose quote has not closed
|
|
16
|
+
yet ends the query, so a phrase being typed to leave out never turns into
|
|
17
|
+
words to find, and a query of only `-"…"` matches nothing.
|
|
18
|
+
|
|
19
|
+
SPEC: §5.2 — no rule of §6 or §9 changed. §5.2's text does not name
|
|
20
|
+
`-"phrase"` or an unclosed `-"` yet; an estiva-docs follow-up adds both, and
|
|
21
|
+
until then buzz#32 and this package are where the rule is written down.
|
|
22
|
+
|
|
23
|
+
## 0.15.0 — 2026-10-19
|
|
24
|
+
|
|
25
|
+
**Search matches every typed word as the start of a word** (record
|
|
26
|
+
*search-matches-every-word-as-a-word-start*). `referenceMatch` now keeps a
|
|
27
|
+
text only when each typed word starts one of its words, in any order; `"…"`
|
|
28
|
+
needs those whole words next to each other, in order; `-word` drops a text with
|
|
29
|
+
a word starting that way; a quote with no closing partner is ignored; `or` and
|
|
30
|
+
`key:value` are ordinary words; punctuation at a typed word's ends is ignored.
|
|
31
|
+
A query that only leaves words out matches nothing. A match inside a word is
|
|
32
|
+
gone: "ssue" no longer finds "issue". A hit where every typed word is a whole
|
|
33
|
+
word now ranks above one where a word is only started, so "short" lists
|
|
34
|
+
*Remove Short summary* above *Shortcuts*: the scores are 8 the whole text, 7–5
|
|
35
|
+
whole words (its start, one run at a word start, every word somewhere) and 3–1
|
|
36
|
+
the same for word starts; only `> 0` was ever read outside this package.
|
|
37
|
+
`referenceSearch` no longer lets an empty answer for words that are only left
|
|
38
|
+
out (`-draft`), or for a query with a quote still open (`"x -y`), stop a longer
|
|
39
|
+
query.
|
|
40
|
+
|
|
41
|
+
SPEC: §5.2 changed — a relay matches every typed word as a word start on a REQ
|
|
42
|
+
and on `/query` alike, and a reader's check of a title uses the same rule, so
|
|
43
|
+
it never drops a hit the relay found.
|
|
44
|
+
|
|
9
45
|
## 0.14.0 — 2026-10-19
|
|
10
46
|
|
|
11
47
|
**A reply to a comment on part of a page copies that comment's place**
|
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.
|
|
15
|
+
export declare const CONVERSATION_VERSION = "0.15.1";
|
|
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';
|
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.
|
|
15
|
+
export const CONVERSATION_VERSION = '0.15.1';
|
|
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';
|
package/dist/references.d.ts
CHANGED
|
@@ -70,9 +70,22 @@ export interface RankReferencesInput {
|
|
|
70
70
|
exclude?: readonly string[];
|
|
71
71
|
}
|
|
72
72
|
/**
|
|
73
|
-
* How well `text` holds `query
|
|
74
|
-
*
|
|
75
|
-
*
|
|
73
|
+
* How well `text` holds `query`, by the rule every Estiva search uses (SPEC
|
|
74
|
+
* §5.2): each typed word matches the start of a word, in any order; `"…"`
|
|
75
|
+
* matches those whole words next to each other; `-word` leaves out a text with
|
|
76
|
+
* a word starting that way, and `-"…"` one with those whole words next to each
|
|
77
|
+
* other. Punctuation at a typed word's ends is ignored, and
|
|
78
|
+
* so is case. A query with nothing to find but words left out matches nothing.
|
|
79
|
+
*
|
|
80
|
+
* Of the texts that match, a hit where every typed word is a whole word ranks
|
|
81
|
+
* above one where a word is only started (the record: "re" finds hundreds), and
|
|
82
|
+
* within each, by where it was found: the whole text, its start, what was typed
|
|
83
|
+
* as one run at the start of a word, every word somewhere. So 8 is the whole
|
|
84
|
+
* text, 7–5 whole words, 3–1 word starts, and 0 no match.
|
|
85
|
+
*
|
|
86
|
+
* Every text the rule finds, this finds, so a title the relay found by the rule
|
|
87
|
+
* is never dropped. A relay MAY find more (another may stem or fold accents;
|
|
88
|
+
* buzz caps a typed word at 4 pieces), and this drops what the rule does not.
|
|
76
89
|
*/
|
|
77
90
|
export declare function referenceMatch(text: string, query: string): number;
|
|
78
91
|
/**
|
|
@@ -121,9 +134,8 @@ export interface ReferenceSearch {
|
|
|
121
134
|
}
|
|
122
135
|
export interface ReferenceSearchOptions {
|
|
123
136
|
/**
|
|
124
|
-
* Must find no more for `q + " words"` than for `q` (every word
|
|
125
|
-
*
|
|
126
|
-
* is not asked.
|
|
137
|
+
* Must find no more for `q + " words"` than for `q` (every word must match,
|
|
138
|
+
* SPEC §5.2), since a longer query after an empty answer is not asked.
|
|
127
139
|
*/
|
|
128
140
|
search: ReferenceSearchFn;
|
|
129
141
|
/** The pause after a keystroke before asking. Default 200ms. */
|
|
@@ -149,7 +161,7 @@ export interface ReferenceSearchOptions {
|
|
|
149
161
|
* keeps its answer, which is still true of that query.
|
|
150
162
|
*
|
|
151
163
|
* Once a query found nothing, adding whole words to it is not asked (08d7f243):
|
|
152
|
-
* relay search
|
|
164
|
+
* relay search needs every word to match (SPEC §5.2), so `see [the fig` cannot
|
|
153
165
|
* find what `the` did not, and a sentence typed after an unmatched `[` would
|
|
154
166
|
* otherwise spend the rate limit on every longer version of itself. A failure
|
|
155
167
|
* is not "nothing", so it never stops a longer query.
|
package/dist/references.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"references.d.ts","sourceRoot":"","sources":["../src/references.ts"],"names":[],"mappings":"AAuBA,+FAA+F;AAC/F,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,UAAU,CAAA;AAElF,+BAA+B;AAC/B,MAAM,WAAW,kBAAkB;IACjC,gGAAgG;IAChG,EAAE,EAAE,MAAM,CAAA;IACV,iGAAiG;IACjG,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,aAAa,CAAA;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,kDAAkD;IAClD,KAAK,E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"}
|
package/dist/references.js
CHANGED
|
@@ -28,38 +28,118 @@ export const FILE_TIER = { folder: 0, recent: 1, search: 2 };
|
|
|
28
28
|
export const REFERENCE_CAPS = { messages: 4, files: 6 };
|
|
29
29
|
const normalize = (text) => text.toLowerCase().replace(/\s+/g, ' ').trim();
|
|
30
30
|
const isWordStart = (text, at) => at === 0 || !/[\p{L}\p{N}]/u.test(text[at - 1]);
|
|
31
|
+
/** The words of `text`: its runs of letters and digits, so `SUM-7.` is `sum`, `7`. */
|
|
32
|
+
const wordsOf = (text) => text.toLowerCase().match(/[\p{L}\p{N}]+/gu) ?? [];
|
|
31
33
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
34
|
+
* Splits typed text as the relay does (buzz's `parse_word_start`): `"…"` is a
|
|
35
|
+
* phrase, `-"…"` a phrase left out, a word opening with `-` is left out,
|
|
36
|
+
* anything else is a word, `or` and `key:value` included. A quote with no
|
|
37
|
+
* closing partner is ignored, so `"short summ` finds by word starts while it
|
|
38
|
+
* is typed; after `-"` it ends the query, so a phrase being typed to leave out
|
|
39
|
+
* never turns into words to find.
|
|
35
40
|
*/
|
|
41
|
+
function searchTerms(query) {
|
|
42
|
+
const terms = [];
|
|
43
|
+
let rest = query;
|
|
44
|
+
while ((rest = rest.trimStart())) {
|
|
45
|
+
if (rest.startsWith('-"')) {
|
|
46
|
+
const end = rest.indexOf('"', 2);
|
|
47
|
+
if (end < 0)
|
|
48
|
+
break;
|
|
49
|
+
const phrase = rest.slice(2, end).trim();
|
|
50
|
+
if (wordsOf(phrase).length > 0)
|
|
51
|
+
terms.push({ kind: 'notPhrase', text: phrase });
|
|
52
|
+
rest = rest.slice(end + 1);
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
if (rest.startsWith('"')) {
|
|
56
|
+
const end = rest.indexOf('"', 1);
|
|
57
|
+
if (end > 0) {
|
|
58
|
+
const phrase = rest.slice(1, end).trim();
|
|
59
|
+
if (phrase)
|
|
60
|
+
terms.push({ kind: 'phrase', text: phrase });
|
|
61
|
+
rest = rest.slice(end + 1);
|
|
62
|
+
}
|
|
63
|
+
else
|
|
64
|
+
rest = rest.slice(1);
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
const end = rest.search(/[\s"]/u);
|
|
68
|
+
const token = end < 0 ? rest : rest.slice(0, end);
|
|
69
|
+
rest = end < 0 ? '' : rest.slice(end);
|
|
70
|
+
if (token.startsWith('-')) {
|
|
71
|
+
if (token.length > 1)
|
|
72
|
+
terms.push({ kind: 'not', text: token.slice(1) });
|
|
73
|
+
}
|
|
74
|
+
else
|
|
75
|
+
terms.push({ kind: 'word', text: token });
|
|
76
|
+
}
|
|
77
|
+
return terms;
|
|
78
|
+
}
|
|
79
|
+
/** Whether `words` holds every word of `typed` at the start of one of its words. */
|
|
80
|
+
const startsWords = (words, typed) => {
|
|
81
|
+
const wanted = wordsOf(typed);
|
|
82
|
+
return wanted.length > 0 && wanted.every((w) => words.some((word) => word.startsWith(w)));
|
|
83
|
+
};
|
|
84
|
+
/** Whether `words` holds the whole words of `phrase`, next to each other and in order. */
|
|
85
|
+
const holdsPhrase = (words, phrase) => {
|
|
86
|
+
const wanted = wordsOf(phrase);
|
|
87
|
+
if (wanted.length === 0)
|
|
88
|
+
return false;
|
|
89
|
+
for (let at = 0; at + wanted.length <= words.length; at++)
|
|
90
|
+
if (wanted.every((w, i) => words[at + i] === w))
|
|
91
|
+
return true;
|
|
92
|
+
return false;
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* How well `text` holds `query`, by the rule every Estiva search uses (SPEC
|
|
96
|
+
* §5.2): each typed word matches the start of a word, in any order; `"…"`
|
|
97
|
+
* matches those whole words next to each other; `-word` leaves out a text with
|
|
98
|
+
* a word starting that way, and `-"…"` one with those whole words next to each
|
|
99
|
+
* other. Punctuation at a typed word's ends is ignored, and
|
|
100
|
+
* so is case. A query with nothing to find but words left out matches nothing.
|
|
101
|
+
*
|
|
102
|
+
* Of the texts that match, a hit where every typed word is a whole word ranks
|
|
103
|
+
* above one where a word is only started (the record: "re" finds hundreds), and
|
|
104
|
+
* within each, by where it was found: the whole text, its start, what was typed
|
|
105
|
+
* as one run at the start of a word, every word somewhere. So 8 is the whole
|
|
106
|
+
* text, 7–5 whole words, 3–1 word starts, and 0 no match.
|
|
107
|
+
*
|
|
108
|
+
* Every text the rule finds, this finds, so a title the relay found by the rule
|
|
109
|
+
* is never dropped. A relay MAY find more (another may stem or fold accents;
|
|
110
|
+
* buzz caps a typed word at 4 pieces), and this drops what the rule does not.
|
|
111
|
+
*/
|
|
112
|
+
// why: https://github.com/estiva-app/estiva-docs/blob/main/decisions/search-matches-every-word-as-a-word-start.md
|
|
36
113
|
export function referenceMatch(text, query) {
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
if (
|
|
114
|
+
const terms = searchTerms(query);
|
|
115
|
+
const wanted = wantedOf(terms);
|
|
116
|
+
if (wanted.length === 0)
|
|
117
|
+
return 0;
|
|
118
|
+
const words = wordsOf(text);
|
|
119
|
+
const holds = (t) => (t.kind === 'phrase' ? holdsPhrase(words, t.text) : startsWords(words, t.text));
|
|
120
|
+
const leftOut = (t) => (t.kind === 'not' && startsWords(words, t.text)) || (t.kind === 'notPhrase' && holdsPhrase(words, t.text));
|
|
121
|
+
if (!wanted.every(holds) || terms.some(leftOut))
|
|
40
122
|
return 0;
|
|
123
|
+
const whole = wanted.every((w) => w.kind === 'phrase' || wordsOf(w.text).every((piece) => words.includes(piece))) ? 4 : 0;
|
|
124
|
+
const t = normalize(text);
|
|
125
|
+
const q = normalize(wanted.map((w) => w.text.replace(/^[^\p{L}\p{N}]+|[^\p{L}\p{N}]+$/gu, '')).join(' '));
|
|
41
126
|
if (t === q)
|
|
42
|
-
return
|
|
127
|
+
return 8;
|
|
43
128
|
if (t.startsWith(q))
|
|
44
|
-
return 3;
|
|
45
|
-
let at = t.indexOf(q);
|
|
46
|
-
if (at < 0) {
|
|
47
|
-
const words = q.split(' ');
|
|
48
|
-
if (words.length < 2)
|
|
49
|
-
return 0;
|
|
50
|
-
const starts = (w) => {
|
|
51
|
-
for (let i = t.indexOf(w); i >= 0; i = t.indexOf(w, i + 1))
|
|
52
|
-
if (isWordStart(t, i))
|
|
53
|
-
return true;
|
|
54
|
-
return false;
|
|
55
|
-
};
|
|
56
|
-
return words.every(starts) ? 1 : 0;
|
|
57
|
-
}
|
|
58
|
-
for (; at >= 0; at = t.indexOf(q, at + 1))
|
|
129
|
+
return whole + 3;
|
|
130
|
+
for (let at = t.indexOf(q); at >= 0; at = t.indexOf(q, at + 1))
|
|
59
131
|
if (isWordStart(t, at))
|
|
60
|
-
return 2;
|
|
61
|
-
return 1;
|
|
132
|
+
return whole + 2;
|
|
133
|
+
return whole + 1;
|
|
62
134
|
}
|
|
135
|
+
/** The terms that ask for something: words and phrases with a letter or digit, not what is left out. */
|
|
136
|
+
const wantedOf = (terms) => terms.filter((t) => (t.kind === 'word' || t.kind === 'phrase') && wordsOf(t.text).length > 0);
|
|
137
|
+
/**
|
|
138
|
+
* Whether a longer query's answer is within `query`'s: it asks for a word and
|
|
139
|
+
* no quote is still open, since closing it can turn `"x -y` (y left out) into
|
|
140
|
+
* `"x -y z"` (a phrase that needs y).
|
|
141
|
+
*/
|
|
142
|
+
const narrowsBy = (query) => wantedOf(searchTerms(query)).length > 0 && (query.split('"').length - 1) % 2 === 0;
|
|
63
143
|
/**
|
|
64
144
|
* How well an issue's ref (`CON-33`) holds `query`: only from its start, and
|
|
65
145
|
* only once what was typed has a digit or a hyphen (Miky, 2026-10-05) — so
|
|
@@ -69,7 +149,8 @@ export function referenceMatch(text, query) {
|
|
|
69
149
|
*/
|
|
70
150
|
export function refMatch(ref, query) {
|
|
71
151
|
const score = ref && /[\d-]/.test(query) ? referenceMatch(ref, query) : 0;
|
|
72
|
-
|
|
152
|
+
// 8, 7 and 3: the whole ref or its start.
|
|
153
|
+
return score === 8 || score % 4 === 3 ? score : 0;
|
|
73
154
|
}
|
|
74
155
|
/** Keeps each id once, at its closest tier. */
|
|
75
156
|
function closest(candidates) {
|
|
@@ -146,7 +227,7 @@ const timers = globalThis;
|
|
|
146
227
|
* keeps its answer, which is still true of that query.
|
|
147
228
|
*
|
|
148
229
|
* Once a query found nothing, adding whole words to it is not asked (08d7f243):
|
|
149
|
-
* relay search
|
|
230
|
+
* relay search needs every word to match (SPEC §5.2), so `see [the fig` cannot
|
|
150
231
|
* find what `the` did not, and a sentence typed after an unmatched `[` would
|
|
151
232
|
* otherwise spend the rate limit on every longer version of itself. A failure
|
|
152
233
|
* is not "nothing", so it never stops a longer query.
|
|
@@ -157,8 +238,8 @@ export function referenceSearch({ search, delayMs = 200, retryMs = 5000, minLeng
|
|
|
157
238
|
const foundNothing = (query) => {
|
|
158
239
|
for (let at = query.indexOf(' '); at >= 0; at = query.indexOf(' ', at + 1)) {
|
|
159
240
|
const prefix = query.slice(0, at);
|
|
160
|
-
// `--`
|
|
161
|
-
if (
|
|
241
|
+
// `--` or `-draft` asks for no word at all, so its empty answer says nothing of `-draft budget`.
|
|
242
|
+
if (!narrowsBy(prefix))
|
|
162
243
|
continue;
|
|
163
244
|
const shorter = answered.get(prefix);
|
|
164
245
|
if (shorter && shorter.length === 0 && !failures.has(shorter))
|
package/dist/references.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"references.js","sourceRoot":"","sources":["../src/references.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAsClD,mEAAmE;AACnE,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAW,CAAA;AAE3D,+EAA+E;AAC/E,MAAM,CAAC,MAAM,SAAS,GAAG,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAW,CAAA;AAErE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C;KACF,CAAA;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@estiva-app/conversation",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.1",
|
|
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/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.
|
|
15
|
+
export const CONVERSATION_VERSION = '0.15.1'
|
|
16
16
|
|
|
17
17
|
export {
|
|
18
18
|
KIND_MESSAGE,
|
package/src/references.ts
CHANGED
|
@@ -90,31 +90,116 @@ const normalize = (text: string) => text.toLowerCase().replace(/\s+/g, ' ').trim
|
|
|
90
90
|
|
|
91
91
|
const isWordStart = (text: string, at: number) => at === 0 || !/[\p{L}\p{N}]/u.test(text[at - 1]!)
|
|
92
92
|
|
|
93
|
+
/** The words of `text`: its runs of letters and digits, so `SUM-7.` is `sum`, `7`. */
|
|
94
|
+
const wordsOf = (text: string): string[] => text.toLowerCase().match(/[\p{L}\p{N}]+/gu) ?? []
|
|
95
|
+
|
|
96
|
+
/** One piece of a typed query: a word, `"a phrase"`, `-a word` or `-"a phrase"` left out. */
|
|
97
|
+
interface SearchTerm {
|
|
98
|
+
kind: 'word' | 'phrase' | 'not' | 'notPhrase'
|
|
99
|
+
text: string
|
|
100
|
+
}
|
|
101
|
+
|
|
93
102
|
/**
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
103
|
+
* Splits typed text as the relay does (buzz's `parse_word_start`): `"…"` is a
|
|
104
|
+
* phrase, `-"…"` a phrase left out, a word opening with `-` is left out,
|
|
105
|
+
* anything else is a word, `or` and `key:value` included. A quote with no
|
|
106
|
+
* closing partner is ignored, so `"short summ` finds by word starts while it
|
|
107
|
+
* is typed; after `-"` it ends the query, so a phrase being typed to leave out
|
|
108
|
+
* never turns into words to find.
|
|
97
109
|
*/
|
|
98
|
-
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
110
|
+
function searchTerms(query: string): SearchTerm[] {
|
|
111
|
+
const terms: SearchTerm[] = []
|
|
112
|
+
let rest = query
|
|
113
|
+
while ((rest = rest.trimStart())) {
|
|
114
|
+
if (rest.startsWith('-"')) {
|
|
115
|
+
const end = rest.indexOf('"', 2)
|
|
116
|
+
if (end < 0) break
|
|
117
|
+
const phrase = rest.slice(2, end).trim()
|
|
118
|
+
if (wordsOf(phrase).length > 0) terms.push({ kind: 'notPhrase', text: phrase })
|
|
119
|
+
rest = rest.slice(end + 1)
|
|
120
|
+
continue
|
|
121
|
+
}
|
|
122
|
+
if (rest.startsWith('"')) {
|
|
123
|
+
const end = rest.indexOf('"', 1)
|
|
124
|
+
if (end > 0) {
|
|
125
|
+
const phrase = rest.slice(1, end).trim()
|
|
126
|
+
if (phrase) terms.push({ kind: 'phrase', text: phrase })
|
|
127
|
+
rest = rest.slice(end + 1)
|
|
128
|
+
} else rest = rest.slice(1)
|
|
129
|
+
continue
|
|
111
130
|
}
|
|
112
|
-
|
|
131
|
+
const end = rest.search(/[\s"]/u)
|
|
132
|
+
const token = end < 0 ? rest : rest.slice(0, end)
|
|
133
|
+
rest = end < 0 ? '' : rest.slice(end)
|
|
134
|
+
if (token.startsWith('-')) {
|
|
135
|
+
if (token.length > 1) terms.push({ kind: 'not', text: token.slice(1) })
|
|
136
|
+
} else terms.push({ kind: 'word', text: token })
|
|
113
137
|
}
|
|
114
|
-
|
|
115
|
-
|
|
138
|
+
return terms
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/** Whether `words` holds every word of `typed` at the start of one of its words. */
|
|
142
|
+
const startsWords = (words: readonly string[], typed: string) => {
|
|
143
|
+
const wanted = wordsOf(typed)
|
|
144
|
+
return wanted.length > 0 && wanted.every((w) => words.some((word) => word.startsWith(w)))
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/** Whether `words` holds the whole words of `phrase`, next to each other and in order. */
|
|
148
|
+
const holdsPhrase = (words: readonly string[], phrase: string) => {
|
|
149
|
+
const wanted = wordsOf(phrase)
|
|
150
|
+
if (wanted.length === 0) return false
|
|
151
|
+
for (let at = 0; at + wanted.length <= words.length; at++) if (wanted.every((w, i) => words[at + i] === w)) return true
|
|
152
|
+
return false
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* How well `text` holds `query`, by the rule every Estiva search uses (SPEC
|
|
157
|
+
* §5.2): each typed word matches the start of a word, in any order; `"…"`
|
|
158
|
+
* matches those whole words next to each other; `-word` leaves out a text with
|
|
159
|
+
* a word starting that way, and `-"…"` one with those whole words next to each
|
|
160
|
+
* other. Punctuation at a typed word's ends is ignored, and
|
|
161
|
+
* so is case. A query with nothing to find but words left out matches nothing.
|
|
162
|
+
*
|
|
163
|
+
* Of the texts that match, a hit where every typed word is a whole word ranks
|
|
164
|
+
* above one where a word is only started (the record: "re" finds hundreds), and
|
|
165
|
+
* within each, by where it was found: the whole text, its start, what was typed
|
|
166
|
+
* as one run at the start of a word, every word somewhere. So 8 is the whole
|
|
167
|
+
* text, 7–5 whole words, 3–1 word starts, and 0 no match.
|
|
168
|
+
*
|
|
169
|
+
* Every text the rule finds, this finds, so a title the relay found by the rule
|
|
170
|
+
* is never dropped. A relay MAY find more (another may stem or fold accents;
|
|
171
|
+
* buzz caps a typed word at 4 pieces), and this drops what the rule does not.
|
|
172
|
+
*/
|
|
173
|
+
// why: https://github.com/estiva-app/estiva-docs/blob/main/decisions/search-matches-every-word-as-a-word-start.md
|
|
174
|
+
export function referenceMatch(text: string, query: string): number {
|
|
175
|
+
const terms = searchTerms(query)
|
|
176
|
+
const wanted = wantedOf(terms)
|
|
177
|
+
if (wanted.length === 0) return 0
|
|
178
|
+
const words = wordsOf(text)
|
|
179
|
+
const holds = (t: SearchTerm) => (t.kind === 'phrase' ? holdsPhrase(words, t.text) : startsWords(words, t.text))
|
|
180
|
+
const leftOut = (t: SearchTerm) =>
|
|
181
|
+
(t.kind === 'not' && startsWords(words, t.text)) || (t.kind === 'notPhrase' && holdsPhrase(words, t.text))
|
|
182
|
+
if (!wanted.every(holds) || terms.some(leftOut)) return 0
|
|
183
|
+
const whole = wanted.every((w) => w.kind === 'phrase' || wordsOf(w.text).every((piece) => words.includes(piece))) ? 4 : 0
|
|
184
|
+
const t = normalize(text)
|
|
185
|
+
const q = normalize(wanted.map((w) => w.text.replace(/^[^\p{L}\p{N}]+|[^\p{L}\p{N}]+$/gu, '')).join(' '))
|
|
186
|
+
if (t === q) return 8
|
|
187
|
+
if (t.startsWith(q)) return whole + 3
|
|
188
|
+
for (let at = t.indexOf(q); at >= 0; at = t.indexOf(q, at + 1)) if (isWordStart(t, at)) return whole + 2
|
|
189
|
+
return whole + 1
|
|
116
190
|
}
|
|
117
191
|
|
|
192
|
+
/** The terms that ask for something: words and phrases with a letter or digit, not what is left out. */
|
|
193
|
+
const wantedOf = (terms: readonly SearchTerm[]) =>
|
|
194
|
+
terms.filter((t) => (t.kind === 'word' || t.kind === 'phrase') && wordsOf(t.text).length > 0)
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Whether a longer query's answer is within `query`'s: it asks for a word and
|
|
198
|
+
* no quote is still open, since closing it can turn `"x -y` (y left out) into
|
|
199
|
+
* `"x -y z"` (a phrase that needs y).
|
|
200
|
+
*/
|
|
201
|
+
const narrowsBy = (query: string) => wantedOf(searchTerms(query)).length > 0 && (query.split('"').length - 1) % 2 === 0
|
|
202
|
+
|
|
118
203
|
/**
|
|
119
204
|
* How well an issue's ref (`CON-33`) holds `query`: only from its start, and
|
|
120
205
|
* only once what was typed has a digit or a hyphen (Miky, 2026-10-05) — so
|
|
@@ -124,7 +209,8 @@ export function referenceMatch(text: string, query: string): number {
|
|
|
124
209
|
*/
|
|
125
210
|
export function refMatch(ref: string | undefined, query: string): number {
|
|
126
211
|
const score = ref && /[\d-]/.test(query) ? referenceMatch(ref, query) : 0
|
|
127
|
-
|
|
212
|
+
// 8, 7 and 3: the whole ref or its start.
|
|
213
|
+
return score === 8 || score % 4 === 3 ? score : 0
|
|
128
214
|
}
|
|
129
215
|
|
|
130
216
|
/** Keeps each id once, at its closest tier. */
|
|
@@ -218,9 +304,8 @@ export interface ReferenceSearch {
|
|
|
218
304
|
|
|
219
305
|
export interface ReferenceSearchOptions {
|
|
220
306
|
/**
|
|
221
|
-
* Must find no more for `q + " words"` than for `q` (every word
|
|
222
|
-
*
|
|
223
|
-
* is not asked.
|
|
307
|
+
* Must find no more for `q + " words"` than for `q` (every word must match,
|
|
308
|
+
* SPEC §5.2), since a longer query after an empty answer is not asked.
|
|
224
309
|
*/
|
|
225
310
|
search: ReferenceSearchFn
|
|
226
311
|
/** The pause after a keystroke before asking. Default 200ms. */
|
|
@@ -247,7 +332,7 @@ export interface ReferenceSearchOptions {
|
|
|
247
332
|
* keeps its answer, which is still true of that query.
|
|
248
333
|
*
|
|
249
334
|
* Once a query found nothing, adding whole words to it is not asked (08d7f243):
|
|
250
|
-
* relay search
|
|
335
|
+
* relay search needs every word to match (SPEC §5.2), so `see [the fig` cannot
|
|
251
336
|
* find what `the` did not, and a sentence typed after an unmatched `[` would
|
|
252
337
|
* otherwise spend the rate limit on every longer version of itself. A failure
|
|
253
338
|
* is not "nothing", so it never stops a longer query.
|
|
@@ -258,8 +343,8 @@ export function referenceSearch({ search, delayMs = 200, retryMs = 5000, minLeng
|
|
|
258
343
|
const foundNothing = (query: string) => {
|
|
259
344
|
for (let at = query.indexOf(' '); at >= 0; at = query.indexOf(' ', at + 1)) {
|
|
260
345
|
const prefix = query.slice(0, at)
|
|
261
|
-
// `--`
|
|
262
|
-
if (
|
|
346
|
+
// `--` or `-draft` asks for no word at all, so its empty answer says nothing of `-draft budget`.
|
|
347
|
+
if (!narrowsBy(prefix)) continue
|
|
263
348
|
const shorter = answered.get(prefix)
|
|
264
349
|
if (shorter && shorter.length === 0 && !failures.has(shorter)) return true
|
|
265
350
|
}
|