@agentshouse/mdruntime 0.1.0-c44866799613e → 0.1.0-c44d5cc00aee5
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 +18 -17
- package/dist/acceptance.d.ts +3 -0
- package/dist/acceptance.d.ts.map +1 -0
- package/dist/acceptance.js +299 -0
- package/dist/act-lanes.d.ts +30 -0
- package/dist/act-lanes.d.ts.map +1 -0
- package/dist/act-lanes.js +225 -0
- package/dist/actions.d.ts +26 -0
- package/dist/actions.d.ts.map +1 -0
- package/dist/actions.js +302 -0
- package/dist/adapter.d.ts +110 -112
- package/dist/adapter.d.ts.map +1 -1
- package/dist/attached-model.d.ts +3 -11
- package/dist/attached-model.d.ts.map +1 -1
- package/dist/attached-model.js +28 -51
- package/dist/bootstrap.d.ts +15 -18
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +252 -158
- 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-set.d.ts +4 -0
- package/dist/change-set.d.ts.map +1 -1
- package/dist/change-set.js +6 -0
- package/dist/change.d.ts +1 -0
- package/dist/change.d.ts.map +1 -1
- package/dist/change.js +4 -2
- package/dist/chat-types.d.ts +3 -0
- package/dist/chat-types.d.ts.map +1 -0
- package/dist/chat-types.js +11 -0
- package/dist/client.d.ts +27 -21
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +36 -17
- package/dist/collection.d.ts +23 -7
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +13 -19
- package/dist/compile.d.ts +8 -6
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +288 -329
- package/dist/connection.d.ts +5 -143
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +109 -5104
- 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 +143 -0
- package/dist/conversation-live.d.ts.map +1 -0
- package/dist/conversation-live.js +254 -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 +65 -48
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +987 -838
- package/dist/declaration.d.ts +10 -0
- package/dist/declaration.d.ts.map +1 -0
- package/dist/declaration.js +24 -0
- package/dist/discovery.d.ts +10 -0
- package/dist/discovery.d.ts.map +1 -0
- package/dist/discovery.js +150 -0
- package/dist/durability.d.ts +19 -1
- package/dist/durability.d.ts.map +1 -1
- package/dist/durability.js +4 -0
- package/dist/entry.d.ts +3 -2
- package/dist/entry.d.ts.map +1 -1
- package/dist/entry.js +19 -9
- package/dist/expectation.d.ts +26 -13
- package/dist/expectation.d.ts.map +1 -1
- package/dist/expectation.js +72 -19
- package/dist/failure.d.ts +3 -0
- package/dist/failure.d.ts.map +1 -1
- package/dist/failure.js +6 -0
- package/dist/figures.d.ts +49 -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 +21 -8
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +73 -40
- 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 +34 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -5
- package/dist/install.d.ts +54 -0
- package/dist/install.d.ts.map +1 -0
- package/dist/install.js +530 -0
- package/dist/lifecycle.d.ts +7 -0
- package/dist/lifecycle.d.ts.map +1 -0
- package/dist/lifecycle.js +277 -0
- package/dist/listing.d.ts +48 -0
- package/dist/listing.d.ts.map +1 -0
- package/dist/listing.js +139 -0
- package/dist/live.d.ts +5 -4
- package/dist/live.d.ts.map +1 -1
- package/dist/live.js +64 -23
- package/dist/locks.d.ts +7 -0
- package/dist/locks.d.ts.map +1 -0
- package/dist/locks.js +32 -0
- package/dist/lost.d.ts +5 -0
- package/dist/lost.d.ts.map +1 -0
- package/dist/lost.js +49 -0
- package/dist/media.d.ts +2 -2
- package/dist/media.d.ts.map +1 -1
- package/dist/media.js +23 -13
- package/dist/memory.d.ts +17 -7
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +210 -97
- package/dist/messages.d.ts +33 -5
- package/dist/messages.d.ts.map +1 -1
- package/dist/messages.js +104 -36
- package/dist/model.d.ts +2 -11
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +0 -23
- package/dist/models.d.ts +10 -0
- package/dist/models.d.ts.map +1 -0
- package/dist/models.js +153 -0
- package/dist/observation.d.ts +4 -3
- package/dist/observation.d.ts.map +1 -1
- package/dist/observation.js +23 -17
- package/dist/opened.d.ts +1 -1
- package/dist/opened.d.ts.map +1 -1
- package/dist/opened.js +5 -5
- package/dist/opening.d.ts +4 -0
- package/dist/opening.d.ts.map +1 -0
- package/dist/opening.js +53 -0
- package/dist/outcome.d.ts +7 -4
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +18 -0
- package/dist/overlay.d.ts +6 -1
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +47 -21
- package/dist/page-metadata.d.ts +8 -0
- package/dist/page-metadata.d.ts.map +1 -0
- package/dist/page-metadata.js +19 -0
- package/dist/parts.d.ts +4 -0
- package/dist/parts.d.ts.map +1 -0
- package/dist/parts.js +13 -0
- package/dist/paths.d.ts +2 -0
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +26 -0
- package/dist/preparation.d.ts +20 -0
- package/dist/preparation.d.ts.map +1 -0
- package/dist/preparation.js +227 -0
- package/dist/presence.d.ts +52 -0
- package/dist/presence.d.ts.map +1 -0
- package/dist/presence.js +220 -0
- package/dist/queries.d.ts +16 -0
- package/dist/queries.d.ts.map +1 -0
- package/dist/queries.js +282 -0
- package/dist/query.d.ts +14 -210
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +3 -505
- package/dist/questions.d.ts +29 -0
- package/dist/questions.d.ts.map +1 -0
- package/dist/questions.js +115 -0
- package/dist/queue.d.ts +40 -0
- package/dist/queue.d.ts.map +1 -0
- package/dist/queue.js +450 -0
- package/dist/reach.d.ts +15 -12
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +240 -149
- package/dist/react.d.ts +15 -2
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +33 -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 +4 -19
- package/dist/readiness.d.ts.map +1 -1
- package/dist/readiness.js +4 -10
- package/dist/reads.d.ts +38 -10
- package/dist/reads.d.ts.map +1 -1
- package/dist/reads.js +163 -85
- package/dist/recovery.d.ts +3 -0
- package/dist/recovery.d.ts.map +1 -1
- package/dist/recovery.js +57 -1
- package/dist/refresh.d.ts +7 -5
- package/dist/refresh.d.ts.map +1 -1
- package/dist/refresh.js +35 -7
- package/dist/refusal.d.ts +5 -0
- package/dist/refusal.d.ts.map +1 -0
- package/dist/refusal.js +55 -0
- package/dist/replica.d.ts +12 -18
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +64 -34
- package/dist/retried.d.ts +30 -0
- package/dist/retried.d.ts.map +1 -0
- package/dist/retried.js +72 -0
- package/dist/room-draft.d.ts +24 -10
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +142 -106
- package/dist/room-drafts.d.ts +24 -0
- package/dist/room-drafts.d.ts.map +1 -0
- package/dist/room-drafts.js +217 -0
- package/dist/rows.d.ts +14 -21
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +49 -186
- package/dist/runtime.d.ts +34 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +1 -0
- package/dist/save.d.ts +42 -84
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +349 -170
- package/dist/saves.d.ts +32 -0
- package/dist/saves.d.ts.map +1 -0
- package/dist/saves.js +410 -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 -1
- package/dist/shared.d.ts +1 -7
- package/dist/shared.d.ts.map +1 -1
- package/dist/shared.js +13 -105
- package/dist/shown.d.ts +33 -0
- package/dist/shown.d.ts.map +1 -0
- package/dist/shown.js +302 -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 +28 -0
- package/dist/socket/lanes.d.ts.map +1 -0
- package/dist/socket/lanes.js +103 -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/session.d.ts +38 -0
- package/dist/socket/session.d.ts.map +1 -0
- package/dist/socket/session.js +23 -0
- package/dist/socket.d.ts +67 -0
- package/dist/socket.d.ts.map +1 -0
- package/dist/socket.js +164 -0
- package/dist/source.d.ts +54 -0
- package/dist/source.d.ts.map +1 -0
- package/dist/source.js +82 -0
- package/dist/status.d.ts +4 -5
- package/dist/status.d.ts.map +1 -1
- package/dist/status.js +3 -7
- 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 +214 -0
- package/dist/store/records.d.ts.map +1 -0
- package/dist/store/records.js +438 -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 +41 -0
- package/dist/store/watchers.d.ts +17 -0
- package/dist/store/watchers.d.ts.map +1 -0
- package/dist/store/watchers.js +56 -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 +120 -171
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +166 -414
- package/dist/stored.d.ts +62 -57
- package/dist/stored.d.ts.map +1 -1
- package/dist/stored.js +317 -239
- package/dist/surface.d.ts +88 -0
- package/dist/surface.d.ts.map +1 -0
- package/dist/surface.js +220 -0
- package/dist/sync.d.ts +19 -0
- package/dist/sync.d.ts.map +1 -0
- package/dist/sync.js +535 -0
- package/dist/tables.d.ts +126 -65
- package/dist/tables.d.ts.map +1 -1
- package/dist/tables.js +250 -113
- package/dist/tallies.d.ts +18 -0
- package/dist/tallies.d.ts.map +1 -0
- package/dist/tallies.js +128 -0
- package/dist/transfer.d.ts +0 -5
- package/dist/transfer.d.ts.map +1 -1
- package/dist/validation.d.ts +3 -4
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +42 -100
- 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 +65 -9
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +22 -5
- package/package.json +3 -2
- package/dist/attempt.d.ts +0 -16
- package/dist/attempt.d.ts.map +0 -1
- package/dist/attempt.js +0 -70
- 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 -368
- package/dist/log.d.ts +0 -5
- package/dist/log.d.ts.map +0 -1
- package/dist/log.js +0 -14
- package/dist/words.d.ts +0 -19
- package/dist/words.d.ts.map +0 -1
- package/dist/words.js +0 -150
package/dist/words.js
DELETED
|
@@ -1,150 +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 = /[\p{L}\p{N}\p{M}\p{Co}]+/gu;
|
|
4
|
-
const MARKED = /([\p{Script=Latin}\p{Script=Greek}\p{Script=Cyrillic}])\p{M}+/gu;
|
|
5
|
-
const INFLECTED = /^[\p{Script=Cyrillic}\p{Script=Greek}]+$/u;
|
|
6
|
-
const FOLD = /\p{M}+/gu;
|
|
7
|
-
const ASCII = /^[\x00-\x7f]$/;
|
|
8
|
-
const PREFIXED_LETTERS = 2;
|
|
9
|
-
const INFLECTED_LETTERS = 4;
|
|
10
|
-
const PHRASE_TERMS = { least: 2, most: 6 };
|
|
11
|
-
const GRAPHEMES = new Intl.Segmenter(undefined, { granularity: 'grapheme' });
|
|
12
|
-
function bigrams(run) {
|
|
13
|
-
const characters = Array.from(run);
|
|
14
|
-
if (characters.length < 2)
|
|
15
|
-
return ` ${run} `;
|
|
16
|
-
const pairs = [];
|
|
17
|
-
for (let index = 0; index + 1 < characters.length; index += 1) {
|
|
18
|
-
pairs.push(characters[index] + characters[index + 1]);
|
|
19
|
-
}
|
|
20
|
-
return ` ${pairs.join(' ')} `;
|
|
21
|
-
}
|
|
22
|
-
export function indexed(text) {
|
|
23
|
-
return text.normalize('NFKD').replace(MARKED, '$1').normalize('NFKC').replace(SPACELESS, bigrams);
|
|
24
|
-
}
|
|
25
|
-
function tokens(text) {
|
|
26
|
-
return [...text.matchAll(TOKEN)].map(([token]) => token.toLowerCase());
|
|
27
|
-
}
|
|
28
|
-
function quoted(token) {
|
|
29
|
-
return `"${token.replaceAll('"', '""')}"`;
|
|
30
|
-
}
|
|
31
|
-
function truncated(term) {
|
|
32
|
-
const letters = Array.from(term);
|
|
33
|
-
if (!INFLECTED.test(term) || letters.length < INFLECTED_LETTERS)
|
|
34
|
-
return null;
|
|
35
|
-
return letters.slice(0, letters.length - (letters.length >= 6 ? 2 : 1)).join('');
|
|
36
|
-
}
|
|
37
|
-
export function matchClauses(text) {
|
|
38
|
-
const terms = tokens(indexed(text));
|
|
39
|
-
if (terms.length === 0)
|
|
40
|
-
return null;
|
|
41
|
-
const unique = [...new Set(terms)];
|
|
42
|
-
const clauses = unique.map((term) => ({ text: quoted(term), kind: 'term', term }));
|
|
43
|
-
for (const term of unique) {
|
|
44
|
-
const stem = truncated(term);
|
|
45
|
-
if (stem !== null)
|
|
46
|
-
clauses.push({ text: `${quoted(stem)}*`, kind: 'stem', term });
|
|
47
|
-
}
|
|
48
|
-
const last = terms[terms.length - 1];
|
|
49
|
-
if (!/\s$/u.test(text) && Array.from(last).length >= PREFIXED_LETTERS) {
|
|
50
|
-
clauses.push({ text: `${quoted(last)}*`, kind: 'prefix', term: last });
|
|
51
|
-
}
|
|
52
|
-
if (terms.length >= PHRASE_TERMS.least && terms.length <= PHRASE_TERMS.most) {
|
|
53
|
-
clauses.push({ text: quoted(terms.join(' ')), kind: 'phrase', term: terms.join(' ') });
|
|
54
|
-
}
|
|
55
|
-
return clauses;
|
|
56
|
-
}
|
|
57
|
-
export function matchExpression(clauses) {
|
|
58
|
-
return clauses.map(({ text }) => text).join(' OR ');
|
|
59
|
-
}
|
|
60
|
-
function folded(text) {
|
|
61
|
-
return text.normalize('NFKD').replace(FOLD, '').toLowerCase();
|
|
62
|
-
}
|
|
63
|
-
export function queryTerms(text) {
|
|
64
|
-
return [...new Set(tokens(text.normalize('NFKC')).map(folded))];
|
|
65
|
-
}
|
|
66
|
-
function agrees(token, term) {
|
|
67
|
-
if (SPACELESS_TERM.test(term))
|
|
68
|
-
return token.includes(term);
|
|
69
|
-
if (token.startsWith(term))
|
|
70
|
-
return true;
|
|
71
|
-
return token.length >= 3 && term.startsWith(token.slice(0, Math.max(3, token.length - 2)));
|
|
72
|
-
}
|
|
73
|
-
function inside(token, offset, term) {
|
|
74
|
-
const pieces = [...GRAPHEMES.segment(token)];
|
|
75
|
-
const owner = [];
|
|
76
|
-
let joined = '';
|
|
77
|
-
for (const [at, { segment }] of pieces.entries()) {
|
|
78
|
-
const part = folded(segment);
|
|
79
|
-
joined += part;
|
|
80
|
-
for (let index = 0; index < part.length; index += 1)
|
|
81
|
-
owner.push(at);
|
|
82
|
-
}
|
|
83
|
-
const found = joined.indexOf(term);
|
|
84
|
-
if (found < 0)
|
|
85
|
-
return null;
|
|
86
|
-
const first = pieces[owner[found]];
|
|
87
|
-
const last = pieces[owner[found + term.length - 1]];
|
|
88
|
-
return { start: offset + first.index, end: offset + last.index + last.segment.length };
|
|
89
|
-
}
|
|
90
|
-
function locate(part, terms) {
|
|
91
|
-
for (const match of part.matchAll(TOKEN)) {
|
|
92
|
-
const token = folded(match[0]);
|
|
93
|
-
for (const term of terms) {
|
|
94
|
-
if (!agrees(token, term))
|
|
95
|
-
continue;
|
|
96
|
-
if (!SPACELESS_TERM.test(term)) {
|
|
97
|
-
return { start: match.index, end: match.index + match[0].length };
|
|
98
|
-
}
|
|
99
|
-
const found = inside(match[0], match.index, term);
|
|
100
|
-
if (found !== null)
|
|
101
|
-
return found;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
return null;
|
|
105
|
-
}
|
|
106
|
-
function settled(part, index) {
|
|
107
|
-
if (index <= 0 || index >= part.length)
|
|
108
|
-
return true;
|
|
109
|
-
const before = part[index - 1];
|
|
110
|
-
const after = part[index];
|
|
111
|
-
if (before === '\n')
|
|
112
|
-
return true;
|
|
113
|
-
return ASCII.test(before) && ASCII.test(after) && !(before === '\r' && after === '\n');
|
|
114
|
-
}
|
|
115
|
-
function edgesAround(part, low, high) {
|
|
116
|
-
let from = Math.max(0, low);
|
|
117
|
-
while (!settled(part, from))
|
|
118
|
-
from -= 1;
|
|
119
|
-
let to = Math.min(part.length, high);
|
|
120
|
-
while (!settled(part, to))
|
|
121
|
-
to += 1;
|
|
122
|
-
const edges = [...GRAPHEMES.segment(part.slice(from, to))].map(({ index }) => from + index);
|
|
123
|
-
edges.push(to);
|
|
124
|
-
return edges;
|
|
125
|
-
}
|
|
126
|
-
export function snippet(part, terms, reach) {
|
|
127
|
-
const located = locate(part, terms);
|
|
128
|
-
if (located === null)
|
|
129
|
-
return null;
|
|
130
|
-
const edges = edgesAround(part, located.start - 2 * reach, located.end + 2 * reach);
|
|
131
|
-
const last = (limit) => edges.filter((edge) => edge <= limit).at(-1) ?? edges[0];
|
|
132
|
-
const first = (limit) => edges.find((edge) => edge >= limit) ?? edges[edges.length - 1];
|
|
133
|
-
const from = last(located.start);
|
|
134
|
-
const to = Math.max(first(Math.min(located.end, from + reach)), first(from + 1));
|
|
135
|
-
const start = first(Math.max(0, from - reach));
|
|
136
|
-
const end = last(Math.min(part.length, to + reach));
|
|
137
|
-
return { text: part.slice(start, end), at: [from - start, to - start] };
|
|
138
|
-
}
|
|
139
|
-
export function matched(part, terms) {
|
|
140
|
-
const found = new Set();
|
|
141
|
-
for (const match of part.matchAll(TOKEN)) {
|
|
142
|
-
const token = folded(match[0]);
|
|
143
|
-
for (const term of terms)
|
|
144
|
-
if (agrees(token, term))
|
|
145
|
-
found.add(term);
|
|
146
|
-
if (found.size === terms.length)
|
|
147
|
-
break;
|
|
148
|
-
}
|
|
149
|
-
return [...found];
|
|
150
|
-
}
|