@agentshouse/mdruntime 0.1.0-ce41fec66d91b → 0.1.0-ce5b3c1e6ea87
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/README.md +2 -2
- package/dist/acceptance.d.ts +6 -0
- package/dist/acceptance.d.ts.map +1 -0
- package/dist/acceptance.js +389 -0
- package/dist/actions.d.ts +20 -0
- package/dist/actions.d.ts.map +1 -0
- package/dist/actions.js +251 -0
- package/dist/adapter.d.ts +44 -25
- package/dist/adapter.d.ts.map +1 -1
- package/dist/attached-model.d.ts +3 -10
- package/dist/attached-model.d.ts.map +1 -1
- package/dist/attached-model.js +21 -56
- package/dist/bootstrap.d.ts +8 -4
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +209 -78
- package/dist/cell.d.ts +6 -0
- package/dist/cell.d.ts.map +1 -0
- package/dist/cell.js +9 -0
- package/dist/chain.d.ts +2 -1
- package/dist/chain.d.ts.map +1 -1
- package/dist/change.d.ts +1 -0
- package/dist/change.d.ts.map +1 -1
- package/dist/chat-types.d.ts +5 -0
- package/dist/chat-types.d.ts.map +1 -0
- package/dist/chat-types.js +13 -0
- package/dist/client.d.ts +20 -4
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +3 -0
- package/dist/collection.d.ts +2 -1
- package/dist/collection.d.ts.map +1 -1
- package/dist/compile.d.ts +6 -6
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +231 -300
- package/dist/connection.d.ts +5 -141
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +101 -5058
- package/dist/context.d.ts +2 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +7 -0
- package/dist/conversation-live.d.ts +136 -0
- package/dist/conversation-live.d.ts.map +1 -0
- package/dist/conversation-live.js +248 -0
- package/dist/conversation-row.d.ts +33 -0
- package/dist/conversation-row.d.ts.map +1 -0
- package/dist/conversation-row.js +53 -0
- package/dist/conversation.d.ts +34 -38
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +856 -850
- package/dist/discovery.d.ts +10 -0
- package/dist/discovery.d.ts.map +1 -0
- package/dist/discovery.js +175 -0
- package/dist/durability.d.ts +15 -0
- package/dist/durability.d.ts.map +1 -1
- package/dist/entry.d.ts +2 -2
- package/dist/entry.d.ts.map +1 -1
- package/dist/entry.js +17 -7
- package/dist/figures.d.ts +48 -0
- package/dist/figures.d.ts.map +1 -0
- package/dist/figures.js +197 -0
- package/dist/holdings.d.ts +29 -0
- package/dist/holdings.d.ts.map +1 -0
- package/dist/holdings.js +95 -0
- package/dist/host.d.ts +4 -5
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +23 -22
- package/dist/identity.d.ts +0 -1
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +0 -3
- package/dist/index.d.ts +23 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/install.d.ts +56 -0
- package/dist/install.d.ts.map +1 -0
- package/dist/install.js +560 -0
- package/dist/job.d.ts +33 -0
- package/dist/job.d.ts.map +1 -0
- package/dist/job.js +54 -0
- package/dist/lifecycle.d.ts +7 -0
- package/dist/lifecycle.d.ts.map +1 -0
- package/dist/lifecycle.js +268 -0
- package/dist/listing.d.ts +53 -0
- package/dist/listing.d.ts.map +1 -0
- package/dist/listing.js +175 -0
- package/dist/live.d.ts +5 -4
- package/dist/live.d.ts.map +1 -1
- package/dist/live.js +62 -20
- package/dist/locks.d.ts +9 -0
- package/dist/locks.d.ts.map +1 -0
- package/dist/locks.js +61 -0
- package/dist/log.d.ts +1 -0
- package/dist/log.d.ts.map +1 -1
- package/dist/lost.d.ts +5 -0
- package/dist/lost.d.ts.map +1 -0
- package/dist/lost.js +61 -0
- package/dist/memory.d.ts +5 -1
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +47 -8
- package/dist/messages.d.ts +27 -3
- package/dist/messages.d.ts.map +1 -1
- package/dist/messages.js +97 -19
- package/dist/model.d.ts +2 -9
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +0 -9
- package/dist/models.d.ts +14 -0
- package/dist/models.d.ts.map +1 -0
- package/dist/models.js +193 -0
- package/dist/observation.d.ts +2 -2
- package/dist/observation.d.ts.map +1 -1
- package/dist/observation.js +7 -2
- package/dist/opening.d.ts +4 -0
- package/dist/opening.d.ts.map +1 -0
- package/dist/opening.js +57 -0
- package/dist/outcome.d.ts +4 -1
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +3 -0
- package/dist/overlay.d.ts +1 -0
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +11 -0
- package/dist/parts.d.ts +59 -0
- package/dist/parts.d.ts.map +1 -0
- package/dist/parts.js +118 -0
- package/dist/preparation.d.ts +20 -0
- package/dist/preparation.d.ts.map +1 -0
- package/dist/preparation.js +226 -0
- package/dist/queries.d.ts +16 -0
- package/dist/queries.d.ts.map +1 -0
- package/dist/queries.js +272 -0
- package/dist/query.d.ts +13 -208
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +3 -505
- package/dist/questions.d.ts +34 -0
- package/dist/questions.d.ts.map +1 -0
- package/dist/questions.js +122 -0
- package/dist/reach.d.ts +14 -12
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +167 -114
- package/dist/react.d.ts +10 -2
- package/dist/react.d.ts.map +1 -1
- package/dist/read.d.ts +7 -0
- package/dist/read.d.ts.map +1 -0
- package/dist/read.js +17 -0
- package/dist/readiness.d.ts +0 -2
- package/dist/readiness.d.ts.map +1 -1
- package/dist/reads.d.ts +37 -0
- package/dist/reads.d.ts.map +1 -0
- package/dist/reads.js +171 -0
- package/dist/recovery.d.ts.map +1 -1
- package/dist/recovery.js +9 -1
- package/dist/refresh.d.ts +1 -1
- package/dist/refresh.d.ts.map +1 -1
- package/dist/refresh.js +7 -0
- package/dist/refusal.d.ts +5 -0
- package/dist/refusal.d.ts.map +1 -0
- package/dist/refusal.js +56 -0
- package/dist/replica.d.ts +8 -8
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +52 -16
- package/dist/room-draft.d.ts +4 -3
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +65 -52
- package/dist/room-drafts.d.ts +24 -0
- package/dist/room-drafts.d.ts.map +1 -0
- package/dist/room-drafts.js +216 -0
- package/dist/rows.d.ts +14 -21
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +48 -184
- package/dist/runtime.d.ts +43 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +1 -0
- package/dist/save.d.ts +3 -1
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +16 -11
- package/dist/saves.d.ts +70 -0
- package/dist/saves.d.ts.map +1 -0
- package/dist/saves.js +1006 -0
- package/dist/search.d.ts +12 -63
- package/dist/search.d.ts.map +1 -1
- package/dist/search.js +9 -52
- package/dist/seed.d.ts +11 -2
- package/dist/seed.d.ts.map +1 -1
- package/dist/seed.js +71 -0
- package/dist/shared.d.ts +1 -1
- package/dist/shared.d.ts.map +1 -1
- package/dist/shared.js +9 -5
- package/dist/shown.d.ts +31 -0
- package/dist/shown.d.ts.map +1 -0
- package/dist/shown.js +295 -0
- package/dist/socket/admission.d.ts +7 -0
- package/dist/socket/admission.d.ts.map +1 -0
- package/dist/socket/admission.js +39 -0
- package/dist/socket/answers.d.ts +6 -0
- package/dist/socket/answers.d.ts.map +1 -0
- package/dist/socket/answers.js +20 -0
- package/dist/socket/lanes.d.ts +20 -0
- package/dist/socket/lanes.d.ts.map +1 -0
- package/dist/socket/lanes.js +77 -0
- package/dist/socket/reads.d.ts +10 -0
- package/dist/socket/reads.d.ts.map +1 -0
- package/dist/socket/reads.js +31 -0
- package/dist/socket/rooms.d.ts +43 -0
- package/dist/socket/rooms.d.ts.map +1 -0
- package/dist/socket/rooms.js +90 -0
- package/dist/socket/session.d.ts +39 -0
- package/dist/socket/session.d.ts.map +1 -0
- package/dist/socket/session.js +23 -0
- package/dist/socket.d.ts +70 -0
- package/dist/socket.d.ts.map +1 -0
- package/dist/socket.js +175 -0
- package/dist/source.d.ts +61 -0
- package/dist/source.d.ts.map +1 -0
- package/dist/source.js +81 -0
- package/dist/status.d.ts +0 -2
- package/dist/status.d.ts.map +1 -1
- package/dist/status.js +0 -6
- package/dist/store/fences.d.ts +16 -0
- package/dist/store/fences.d.ts.map +1 -0
- package/dist/store/fences.js +26 -0
- package/dist/store/installs.d.ts +30 -0
- package/dist/store/installs.d.ts.map +1 -0
- package/dist/store/installs.js +34 -0
- package/dist/store/readiness.d.ts +10 -0
- package/dist/store/readiness.d.ts.map +1 -0
- package/dist/store/readiness.js +52 -0
- package/dist/store/records.d.ts +212 -0
- package/dist/store/records.d.ts.map +1 -0
- package/dist/store/records.js +408 -0
- package/dist/store/room-held.d.ts +8 -0
- package/dist/store/room-held.d.ts.map +1 -0
- package/dist/store/room-held.js +17 -0
- package/dist/store/space.d.ts +11 -0
- package/dist/store/space.d.ts.map +1 -0
- package/dist/store/space.js +43 -0
- package/dist/store/watchers.d.ts +17 -0
- package/dist/store/watchers.d.ts.map +1 -0
- package/dist/store/watchers.js +57 -0
- package/dist/store/writes.d.ts +24 -0
- package/dist/store/writes.d.ts.map +1 -0
- package/dist/store/writes.js +125 -0
- package/dist/store.d.ts +107 -145
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +143 -366
- package/dist/stored.d.ts +58 -32
- package/dist/stored.d.ts.map +1 -1
- package/dist/stored.js +264 -187
- package/dist/surface.d.ts +88 -0
- package/dist/surface.d.ts.map +1 -0
- package/dist/surface.js +223 -0
- package/dist/sync.d.ts +20 -0
- package/dist/sync.d.ts.map +1 -0
- package/dist/sync.js +532 -0
- package/dist/tables.d.ts +117 -27
- package/dist/tables.d.ts.map +1 -1
- package/dist/tables.js +211 -49
- package/dist/tallies.d.ts +18 -0
- package/dist/tallies.d.ts.map +1 -0
- package/dist/tallies.js +129 -0
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +7 -4
- package/dist/windows.d.ts +1 -12
- package/dist/windows.d.ts.map +1 -1
- package/dist/windows.js +2 -75
- package/dist/wire.d.ts +17 -1
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +7 -0
- package/package.json +2 -2
- package/dist/fence.d.ts +0 -6
- package/dist/fence.d.ts.map +0 -1
- package/dist/fence.js +0 -10
- package/dist/fulltext.d.ts +0 -27
- package/dist/fulltext.d.ts.map +0 -1
- package/dist/fulltext.js +0 -370
- package/dist/words.d.ts +0 -19
- package/dist/words.d.ts.map +0 -1
- package/dist/words.js +0 -156
package/dist/words.js
DELETED
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
const SPACELESS = /(?:[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Thai}\p{Script=Lao}\p{Script=Khmer}\p{Script=Myanmar}\p{Script=Hangul}]\p{M}*)+/gu;
|
|
2
|
-
const SPACELESS_TERM = /[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Thai}\p{Script=Lao}\p{Script=Khmer}\p{Script=Myanmar}\p{Script=Hangul}]/u;
|
|
3
|
-
const TOKEN = /(?![\x00-\x7f])\p{S}\p{M}*|[\p{L}\p{N}\p{M}\p{Co}]+/gu;
|
|
4
|
-
const SYMBOL = /(?![\x00-\x7f])\p{S}\p{M}*/gu;
|
|
5
|
-
const MARKED = /([\p{Script=Latin}\p{Script=Greek}\p{Script=Cyrillic}])\p{M}+/gu;
|
|
6
|
-
const INFLECTED = /^[\p{Script=Cyrillic}\p{Script=Greek}]+$/u;
|
|
7
|
-
const FOLD = /\p{M}+/gu;
|
|
8
|
-
const ASCII = /^[\x00-\x7f]$/;
|
|
9
|
-
const PREFIXED_LETTERS = 2;
|
|
10
|
-
const INFLECTED_LETTERS = 4;
|
|
11
|
-
const PHRASE_TERMS = { least: 2, most: 6 };
|
|
12
|
-
const GRAPHEMES = new Intl.Segmenter(undefined, { granularity: 'grapheme' });
|
|
13
|
-
function bigrams(run) {
|
|
14
|
-
const characters = Array.from(run);
|
|
15
|
-
if (characters.length < 2)
|
|
16
|
-
return ` ${run} `;
|
|
17
|
-
const pairs = [];
|
|
18
|
-
for (let index = 0; index + 1 < characters.length; index += 1) {
|
|
19
|
-
pairs.push(characters[index] + characters[index + 1]);
|
|
20
|
-
}
|
|
21
|
-
return ` ${pairs.join(' ')} `;
|
|
22
|
-
}
|
|
23
|
-
export function indexed(text) {
|
|
24
|
-
return text
|
|
25
|
-
.normalize('NFKD')
|
|
26
|
-
.replace(MARKED, '$1')
|
|
27
|
-
.normalize('NFKC')
|
|
28
|
-
.replace(SPACELESS, bigrams)
|
|
29
|
-
.replace(SYMBOL, (symbol) => ` ${symbol.replace(FOLD, '')} `);
|
|
30
|
-
}
|
|
31
|
-
function tokens(text) {
|
|
32
|
-
return [...text.matchAll(TOKEN)].map(([token]) => token.toLowerCase());
|
|
33
|
-
}
|
|
34
|
-
function quoted(token) {
|
|
35
|
-
return `"${token.replaceAll('"', '""')}"`;
|
|
36
|
-
}
|
|
37
|
-
function truncated(term) {
|
|
38
|
-
const letters = Array.from(term);
|
|
39
|
-
if (!INFLECTED.test(term) || letters.length < INFLECTED_LETTERS)
|
|
40
|
-
return null;
|
|
41
|
-
return letters.slice(0, letters.length - (letters.length >= 6 ? 2 : 1)).join('');
|
|
42
|
-
}
|
|
43
|
-
export function matchClauses(text) {
|
|
44
|
-
const terms = tokens(indexed(text));
|
|
45
|
-
if (terms.length === 0)
|
|
46
|
-
return null;
|
|
47
|
-
const unique = [...new Set(terms)];
|
|
48
|
-
const clauses = unique.map((term) => ({ text: quoted(term), kind: 'term', term }));
|
|
49
|
-
for (const term of unique) {
|
|
50
|
-
const stem = truncated(term);
|
|
51
|
-
if (stem !== null)
|
|
52
|
-
clauses.push({ text: `${quoted(stem)}*`, kind: 'stem', term });
|
|
53
|
-
}
|
|
54
|
-
const last = terms[terms.length - 1];
|
|
55
|
-
if (!/\s$/u.test(text) && Array.from(last).length >= PREFIXED_LETTERS) {
|
|
56
|
-
clauses.push({ text: `${quoted(last)}*`, kind: 'prefix', term: last });
|
|
57
|
-
}
|
|
58
|
-
if (terms.length >= PHRASE_TERMS.least && terms.length <= PHRASE_TERMS.most) {
|
|
59
|
-
clauses.push({ text: quoted(terms.join(' ')), kind: 'phrase', term: terms.join(' ') });
|
|
60
|
-
}
|
|
61
|
-
return clauses;
|
|
62
|
-
}
|
|
63
|
-
export function matchExpression(clauses) {
|
|
64
|
-
return clauses.map(({ text }) => text).join(' OR ');
|
|
65
|
-
}
|
|
66
|
-
function folded(text) {
|
|
67
|
-
return text.normalize('NFKD').replace(FOLD, '').toLowerCase();
|
|
68
|
-
}
|
|
69
|
-
export function queryTerms(text) {
|
|
70
|
-
return [...new Set(tokens(text.normalize('NFKC')).map(folded))];
|
|
71
|
-
}
|
|
72
|
-
function agrees(token, term) {
|
|
73
|
-
if (SPACELESS_TERM.test(term))
|
|
74
|
-
return token.includes(term);
|
|
75
|
-
if (token.startsWith(term))
|
|
76
|
-
return true;
|
|
77
|
-
return token.length >= 3 && term.startsWith(token.slice(0, Math.max(3, token.length - 2)));
|
|
78
|
-
}
|
|
79
|
-
function inside(token, offset, term) {
|
|
80
|
-
const pieces = [...GRAPHEMES.segment(token)];
|
|
81
|
-
const owner = [];
|
|
82
|
-
let joined = '';
|
|
83
|
-
for (const [at, { segment }] of pieces.entries()) {
|
|
84
|
-
const part = folded(segment);
|
|
85
|
-
joined += part;
|
|
86
|
-
for (let index = 0; index < part.length; index += 1)
|
|
87
|
-
owner.push(at);
|
|
88
|
-
}
|
|
89
|
-
const found = joined.indexOf(term);
|
|
90
|
-
if (found < 0)
|
|
91
|
-
return null;
|
|
92
|
-
const first = pieces[owner[found]];
|
|
93
|
-
const last = pieces[owner[found + term.length - 1]];
|
|
94
|
-
return { start: offset + first.index, end: offset + last.index + last.segment.length };
|
|
95
|
-
}
|
|
96
|
-
function locate(part, terms) {
|
|
97
|
-
for (const match of part.matchAll(TOKEN)) {
|
|
98
|
-
const token = folded(match[0]);
|
|
99
|
-
for (const term of terms) {
|
|
100
|
-
if (!agrees(token, term))
|
|
101
|
-
continue;
|
|
102
|
-
if (!SPACELESS_TERM.test(term)) {
|
|
103
|
-
return { start: match.index, end: match.index + match[0].length };
|
|
104
|
-
}
|
|
105
|
-
const found = inside(match[0], match.index, term);
|
|
106
|
-
if (found !== null)
|
|
107
|
-
return found;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
return null;
|
|
111
|
-
}
|
|
112
|
-
function settled(part, index) {
|
|
113
|
-
if (index <= 0 || index >= part.length)
|
|
114
|
-
return true;
|
|
115
|
-
const before = part[index - 1];
|
|
116
|
-
const after = part[index];
|
|
117
|
-
if (before === '\n')
|
|
118
|
-
return true;
|
|
119
|
-
return ASCII.test(before) && ASCII.test(after) && !(before === '\r' && after === '\n');
|
|
120
|
-
}
|
|
121
|
-
function edgesAround(part, low, high) {
|
|
122
|
-
let from = Math.max(0, low);
|
|
123
|
-
while (!settled(part, from))
|
|
124
|
-
from -= 1;
|
|
125
|
-
let to = Math.min(part.length, high);
|
|
126
|
-
while (!settled(part, to))
|
|
127
|
-
to += 1;
|
|
128
|
-
const edges = [...GRAPHEMES.segment(part.slice(from, to))].map(({ index }) => from + index);
|
|
129
|
-
edges.push(to);
|
|
130
|
-
return edges;
|
|
131
|
-
}
|
|
132
|
-
export function snippet(part, terms, reach) {
|
|
133
|
-
const located = locate(part, terms);
|
|
134
|
-
if (located === null)
|
|
135
|
-
return null;
|
|
136
|
-
const edges = edgesAround(part, located.start - 2 * reach, located.end + 2 * reach);
|
|
137
|
-
const last = (limit) => edges.filter((edge) => edge <= limit).at(-1) ?? edges[0];
|
|
138
|
-
const first = (limit) => edges.find((edge) => edge >= limit) ?? edges[edges.length - 1];
|
|
139
|
-
const from = last(located.start);
|
|
140
|
-
const to = Math.max(first(Math.min(located.end, from + reach)), first(from + 1));
|
|
141
|
-
const start = first(Math.max(0, from - reach));
|
|
142
|
-
const end = last(Math.min(part.length, to + reach));
|
|
143
|
-
return { text: part.slice(start, end), at: [from - start, to - start] };
|
|
144
|
-
}
|
|
145
|
-
export function matched(part, terms) {
|
|
146
|
-
const found = new Set();
|
|
147
|
-
for (const match of part.matchAll(TOKEN)) {
|
|
148
|
-
const token = folded(match[0]);
|
|
149
|
-
for (const term of terms)
|
|
150
|
-
if (agrees(token, term))
|
|
151
|
-
found.add(term);
|
|
152
|
-
if (found.size === terms.length)
|
|
153
|
-
break;
|
|
154
|
-
}
|
|
155
|
-
return [...found];
|
|
156
|
-
}
|