@hviana/sema 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/example/demo.js +25 -25
- package/dist/example/train_base.d.ts +21 -19
- package/dist/example/train_base.js +1952 -1684
- package/dist/src/alphabet.d.ts +3 -3
- package/dist/src/alphabet.js +27 -24
- package/dist/src/alu/src/alu.d.ts +194 -169
- package/dist/src/alu/src/alu.js +414 -374
- package/dist/src/alu/src/expr.d.ts +43 -36
- package/dist/src/alu/src/expr.js +278 -252
- package/dist/src/alu/src/index.d.ts +98 -9
- package/dist/src/alu/src/index.js +63 -9
- package/dist/src/alu/src/kernel-arith.d.ts +5 -1
- package/dist/src/alu/src/kernel-arith.js +285 -195
- package/dist/src/alu/src/kernel-bits.d.ts +5 -1
- package/dist/src/alu/src/kernel-bits.js +115 -81
- package/dist/src/alu/src/kernel-logic.js +63 -33
- package/dist/src/alu/src/kernel-nd.js +195 -155
- package/dist/src/alu/src/kernel-numeric.d.ts +80 -16
- package/dist/src/alu/src/kernel-numeric.js +331 -259
- package/dist/src/alu/src/operation.d.ts +132 -112
- package/dist/src/alu/src/operation.js +163 -149
- package/dist/src/alu/src/parser.d.ts +175 -168
- package/dist/src/alu/src/parser.js +421 -382
- package/dist/src/alu/src/resonance.d.ts +25 -16
- package/dist/src/alu/src/resonance.js +56 -49
- package/dist/src/alu/src/text.d.ts +7 -3
- package/dist/src/alu/src/text.js +37 -31
- package/dist/src/alu/src/value.d.ts +14 -14
- package/dist/src/alu/src/value.js +160 -150
- package/dist/src/alu/test/alu.test.js +656 -543
- package/dist/src/bytes.d.ts +5 -1
- package/dist/src/bytes.js +40 -33
- package/dist/src/config.d.ts +102 -102
- package/dist/src/config.js +83 -83
- package/dist/src/derive/src/deduction.d.ts +62 -60
- package/dist/src/derive/src/deduction.js +109 -103
- package/dist/src/derive/src/index.d.ts +7 -1
- package/dist/src/derive/src/priority-queue.d.ts +8 -8
- package/dist/src/derive/src/priority-queue.js +61 -57
- package/dist/src/derive/src/rewrite.d.ts +18 -15
- package/dist/src/derive/src/rewrite.js +67 -59
- package/dist/src/derive/src/trie.d.ts +56 -56
- package/dist/src/derive/src/trie.js +179 -175
- package/dist/src/derive/test/derive.test.js +100 -96
- package/dist/src/extension.d.ts +16 -13
- package/dist/src/geometry.d.ts +42 -17
- package/dist/src/geometry.js +266 -235
- package/dist/src/index.d.ts +17 -2
- package/dist/src/index.js +7 -1
- package/dist/src/ingest-cache.d.ts +30 -25
- package/dist/src/ingest-cache.js +127 -108
- package/dist/src/mind/articulation.d.ts +5 -1
- package/dist/src/mind/articulation.js +112 -77
- package/dist/src/mind/attention.d.ts +108 -40
- package/dist/src/mind/attention.js +871 -749
- package/dist/src/mind/canonical.d.ts +19 -4
- package/dist/src/mind/canonical.js +31 -27
- package/dist/src/mind/graph-search.d.ts +225 -201
- package/dist/src/mind/graph-search.js +821 -742
- package/dist/src/mind/index.d.ts +10 -2
- package/dist/src/mind/junction.d.ts +58 -31
- package/dist/src/mind/junction.js +237 -172
- package/dist/src/mind/learning.d.ts +52 -16
- package/dist/src/mind/learning.js +165 -143
- package/dist/src/mind/match.d.ts +69 -20
- package/dist/src/mind/match.js +318 -259
- package/dist/src/mind/mechanisms/alu.js +16 -16
- package/dist/src/mind/mechanisms/cast.d.ts +13 -9
- package/dist/src/mind/mechanisms/cast.js +456 -363
- package/dist/src/mind/mechanisms/confluence.d.ts +12 -8
- package/dist/src/mind/mechanisms/confluence.js +183 -152
- package/dist/src/mind/mechanisms/cover.d.ts +8 -2
- package/dist/src/mind/mechanisms/cover.js +210 -148
- package/dist/src/mind/mechanisms/extraction.d.ts +34 -8
- package/dist/src/mind/mechanisms/extraction.js +288 -234
- package/dist/src/mind/mechanisms/recall.d.ts +10 -6
- package/dist/src/mind/mechanisms/recall.js +185 -126
- package/dist/src/mind/mind.d.ts +154 -129
- package/dist/src/mind/mind.js +288 -258
- package/dist/src/mind/pipeline-mechanism.d.ts +124 -112
- package/dist/src/mind/pipeline-mechanism.js +172 -161
- package/dist/src/mind/pipeline.d.ts +14 -4
- package/dist/src/mind/pipeline.js +189 -125
- package/dist/src/mind/primitives.d.ts +32 -8
- package/dist/src/mind/primitives.js +117 -99
- package/dist/src/mind/rationale.d.ts +98 -86
- package/dist/src/mind/rationale.js +121 -113
- package/dist/src/mind/reasoning.d.ts +13 -2
- package/dist/src/mind/reasoning.js +166 -129
- package/dist/src/mind/recognition.d.ts +4 -1
- package/dist/src/mind/recognition.js +208 -183
- package/dist/src/mind/resonance.d.ts +22 -5
- package/dist/src/mind/resonance.js +0 -0
- package/dist/src/mind/trace.d.ts +25 -6
- package/dist/src/mind/trace.js +58 -50
- package/dist/src/mind/traverse.d.ts +58 -16
- package/dist/src/mind/traverse.js +357 -304
- package/dist/src/mind/types.d.ts +127 -120
- package/dist/src/mind/types.js +69 -60
- package/dist/src/rabitq-hnsw/src/database.d.ts +179 -177
- package/dist/src/rabitq-hnsw/src/database.js +359 -342
- package/dist/src/rabitq-hnsw/src/heap.d.ts +12 -12
- package/dist/src/rabitq-hnsw/src/heap.js +80 -75
- package/dist/src/rabitq-hnsw/src/hnsw.d.ts +103 -103
- package/dist/src/rabitq-hnsw/src/hnsw.js +454 -428
- package/dist/src/rabitq-hnsw/src/index.d.ts +6 -1
- package/dist/src/rabitq-hnsw/src/prng.d.ts +10 -10
- package/dist/src/rabitq-hnsw/src/prng.js +27 -25
- package/dist/src/rabitq-hnsw/src/rabitq.d.ts +69 -69
- package/dist/src/rabitq-hnsw/src/rabitq.js +262 -246
- package/dist/src/rabitq-hnsw/src/store.d.ts +132 -132
- package/dist/src/rabitq-hnsw/src/store.js +843 -752
- package/dist/src/rabitq-hnsw/test/hnsw.test.js +1054 -805
- package/dist/src/sema.d.ts +35 -0
- package/dist/src/sema.js +77 -0
- package/dist/src/store-sqlite.d.ts +166 -144
- package/dist/src/store-sqlite.js +660 -578
- package/dist/src/store.d.ts +630 -593
- package/dist/src/store.js +1581 -1440
- package/dist/src/vec.d.ts +9 -5
- package/dist/src/vec.js +73 -61
- package/package.json +2 -2
- package/src/sema.ts +102 -0
|
@@ -6,13 +6,13 @@ import type { PipelineMechanism, Precomputed } from "../pipeline-mechanism.js";
|
|
|
6
6
|
* matches and one meet, STEP each). `used` carries the pair's exemplar
|
|
7
7
|
* anchors so the reasoning stage does not re-speak them. */
|
|
8
8
|
export interface JoinResult {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
bytes: Uint8Array;
|
|
10
|
+
used: ReadonlySet<number>;
|
|
11
|
+
accounted: Array<[number, number]>;
|
|
12
|
+
moves: number;
|
|
13
|
+
/** A human-readable label for the query bytes the meet left unexplained —
|
|
14
|
+
* purely diagnostic, never priced. */
|
|
15
|
+
unexplained: string;
|
|
16
16
|
}
|
|
17
17
|
/** The main confluence entry point. Given a query, detect whether it weaves
|
|
18
18
|
* two or more INDEPENDENT constraints (ranked anchors supported by disjoint
|
|
@@ -20,5 +20,9 @@ export interface JoinResult {
|
|
|
20
20
|
* identity, and return the discriminative content the streams share — the
|
|
21
21
|
* entity that satisfies all constraints at once. Null when the query is
|
|
22
22
|
* not conjunctive or nothing lies in the intersection. */
|
|
23
|
-
export declare function confluenceJoin(
|
|
23
|
+
export declare function confluenceJoin(
|
|
24
|
+
ctx: MindContext,
|
|
25
|
+
query: Uint8Array,
|
|
26
|
+
pre: Precomputed,
|
|
27
|
+
): Promise<JoinResult | null>;
|
|
24
28
|
export declare const confluenceMechanism: PipelineMechanism;
|
|
@@ -51,163 +51,194 @@ import { rItem, rNode } from "../trace.js";
|
|
|
51
51
|
* entity that satisfies all constraints at once. Null when the query is
|
|
52
52
|
* not conjunctive or nothing lies in the intersection. */
|
|
53
53
|
export async function confluenceJoin(ctx, query, pre) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
54
|
+
const W = ctx.space.maxGroup;
|
|
55
|
+
if (query.length < 2 * W || ctx.store.edgeSourceCount() === 0) {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
const { ranked } = await pre.attention();
|
|
59
|
+
if (ranked.length < 2) {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
const N = corpusN(ctx);
|
|
63
|
+
// Response-scoped shared memos: the anchor-window identities and the
|
|
64
|
+
// structural-IDF reach live on Precomputed, so any other identity-based
|
|
65
|
+
// mechanism in the same response reuses them.
|
|
66
|
+
const reachMemo = pre.reachMemo;
|
|
67
|
+
const windowsOfAnchor = (anchor) => pre.windowsOf(anchor);
|
|
68
|
+
// The query's own window identities, offset → id (the canonical
|
|
69
|
+
// content-addressed read, canonical.windowIds): whatever the meet shares
|
|
70
|
+
// with the query is the CONSTRAINT being re-named (or its scaffolding),
|
|
71
|
+
// never the open seat the question asks for — subtracted by identity,
|
|
72
|
+
// below.
|
|
73
|
+
const queryWin = pre.queryWindows;
|
|
74
|
+
const queryIds = new Set(queryWin.values());
|
|
75
|
+
const streams = [];
|
|
76
|
+
const rankedCapped = ranked.length > pre.k ? ranked.slice(0, pre.k) : ranked;
|
|
77
|
+
for (const cand of rankedCapped) {
|
|
78
|
+
if (streams.some((s) => s.anchor === cand.anchor)) {
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
const ids = new Set(windowsOfAnchor(cand.anchor).values());
|
|
82
|
+
if (ids.size === 0) {
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
const cover = [];
|
|
86
|
+
const held = [];
|
|
87
|
+
let curC = null;
|
|
88
|
+
let curH = null;
|
|
89
|
+
for (const [off, wid] of queryWin) {
|
|
90
|
+
if (!ids.has(wid)) {
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
if (curH !== null && off <= curH[1]) {
|
|
94
|
+
curH[1] = off + W;
|
|
95
|
+
} else {
|
|
96
|
+
held.push(curH = [off, off + W]);
|
|
97
|
+
}
|
|
98
|
+
if (dominates(reachOf(ctx, wid, N, reachMemo), N)) {
|
|
99
|
+
continue; // scaffolding never binds
|
|
100
|
+
}
|
|
101
|
+
if (curC !== null && off <= curC[1]) {
|
|
102
|
+
curC[1] = off + W;
|
|
103
|
+
} else {
|
|
104
|
+
cover.push(curC = [off, off + W]);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
if (cover.length > 0) {
|
|
108
|
+
streams.push({ anchor: cand.anchor, vote: cand.vote, ids, cover, held });
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
if (streams.length < 2) {
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
// Two streams are INDEPENDENT constraints when the query content they
|
|
115
|
+
// hold is disjoint — each answers a different part of what was asked.
|
|
116
|
+
const disjoint = (a, b) =>
|
|
117
|
+
a.cover.every(([as, ae]) =>
|
|
118
|
+
b.cover.every(([bs, be]) => be <= as || bs >= ae)
|
|
119
|
+
);
|
|
120
|
+
let met = null;
|
|
121
|
+
for (let i = 0; i < streams.length; i++) {
|
|
122
|
+
for (let j = i + 1; j < streams.length; j++) {
|
|
123
|
+
const a = streams[i];
|
|
124
|
+
const b = streams[j];
|
|
125
|
+
if (!disjoint(a, b)) {
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
const wa = windowsOfAnchor(a.anchor);
|
|
129
|
+
const wb = b.ids;
|
|
130
|
+
// ── The MEET: in both anchors, not in the query ────────────────────
|
|
131
|
+
// Offsets of A whose window id is shared with B and absent from the
|
|
132
|
+
// query — merged into maximal contiguous spans (windows overlap, so
|
|
133
|
+
// consecutive shared offsets weave one span).
|
|
134
|
+
const spans = [];
|
|
135
|
+
let cur = null;
|
|
136
|
+
for (const [off, wid] of wa) {
|
|
137
|
+
const inMeet = wb.has(wid) && !queryIds.has(wid);
|
|
138
|
+
if (inMeet) {
|
|
139
|
+
if (cur !== null && off <= cur[1]) {
|
|
140
|
+
cur[1] = off + W;
|
|
141
|
+
} else {
|
|
142
|
+
spans.push(cur = [off, off + W]);
|
|
143
|
+
}
|
|
98
144
|
}
|
|
99
|
-
|
|
100
|
-
|
|
145
|
+
}
|
|
146
|
+
if (spans.length === 0) {
|
|
147
|
+
continue;
|
|
148
|
+
}
|
|
149
|
+
const aBytes = read(ctx, a.anchor);
|
|
150
|
+
for (const [s, e] of spans) {
|
|
151
|
+
// Scaffolding gate: the span's MOST discriminative window decides.
|
|
152
|
+
// Content reaching a corpus MAJORITY of contexts discriminates
|
|
153
|
+
// nothing (the same half-dominance convention every wrapper test
|
|
154
|
+
// uses); the query-subtraction above already removed everything the
|
|
155
|
+
// question names, so what survives here is a genuine open-seat
|
|
156
|
+
// entity.
|
|
157
|
+
let reach = Infinity;
|
|
158
|
+
for (let off = s; off + W <= e; off++) {
|
|
159
|
+
const wid = wa.get(off);
|
|
160
|
+
if (wid !== undefined && wb.has(wid) && !queryIds.has(wid)) {
|
|
161
|
+
reach = Math.min(reach, reachOf(ctx, wid, N, reachMemo));
|
|
162
|
+
}
|
|
101
163
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
return null;
|
|
105
|
-
// Two streams are INDEPENDENT constraints when the query content they
|
|
106
|
-
// hold is disjoint — each answers a different part of what was asked.
|
|
107
|
-
const disjoint = (a, b) => a.cover.every(([as, ae]) => b.cover.every(([bs, be]) => be <= as || bs >= ae));
|
|
108
|
-
let met = null;
|
|
109
|
-
for (let i = 0; i < streams.length; i++) {
|
|
110
|
-
for (let j = i + 1; j < streams.length; j++) {
|
|
111
|
-
const a = streams[i];
|
|
112
|
-
const b = streams[j];
|
|
113
|
-
if (!disjoint(a, b))
|
|
114
|
-
continue;
|
|
115
|
-
const wa = windowsOfAnchor(a.anchor);
|
|
116
|
-
const wb = b.ids;
|
|
117
|
-
// ── The MEET: in both anchors, not in the query ────────────────────
|
|
118
|
-
// Offsets of A whose window id is shared with B and absent from the
|
|
119
|
-
// query — merged into maximal contiguous spans (windows overlap, so
|
|
120
|
-
// consecutive shared offsets weave one span).
|
|
121
|
-
const spans = [];
|
|
122
|
-
let cur = null;
|
|
123
|
-
for (const [off, wid] of wa) {
|
|
124
|
-
const inMeet = wb.has(wid) && !queryIds.has(wid);
|
|
125
|
-
if (inMeet) {
|
|
126
|
-
if (cur !== null && off <= cur[1])
|
|
127
|
-
cur[1] = off + W;
|
|
128
|
-
else
|
|
129
|
-
spans.push(cur = [off, off + W]);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
if (spans.length === 0)
|
|
133
|
-
continue;
|
|
134
|
-
const aBytes = read(ctx, a.anchor);
|
|
135
|
-
for (const [s, e] of spans) {
|
|
136
|
-
// Scaffolding gate: the span's MOST discriminative window decides.
|
|
137
|
-
// Content reaching a corpus MAJORITY of contexts discriminates
|
|
138
|
-
// nothing (the same half-dominance convention every wrapper test
|
|
139
|
-
// uses); the query-subtraction above already removed everything the
|
|
140
|
-
// question names, so what survives here is a genuine open-seat
|
|
141
|
-
// entity.
|
|
142
|
-
let reach = Infinity;
|
|
143
|
-
for (let off = s; off + W <= e; off++) {
|
|
144
|
-
const wid = wa.get(off);
|
|
145
|
-
if (wid !== undefined && wb.has(wid) && !queryIds.has(wid)) {
|
|
146
|
-
reach = Math.min(reach, reachOf(ctx, wid, N, reachMemo));
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
if (!isFinite(reach) || dominates(reach, N))
|
|
150
|
-
continue;
|
|
151
|
-
const len = e - s;
|
|
152
|
-
if (met === null || reach < met.reach ||
|
|
153
|
-
(reach === met.reach && len > met.len)) {
|
|
154
|
-
met = { bytes: aBytes.subarray(s, e), reach, len, a, b };
|
|
155
|
-
}
|
|
156
|
-
}
|
|
164
|
+
if (!isFinite(reach) || dominates(reach, N)) {
|
|
165
|
+
continue;
|
|
157
166
|
}
|
|
167
|
+
const len = e - s;
|
|
168
|
+
if (
|
|
169
|
+
met === null || reach < met.reach ||
|
|
170
|
+
(reach === met.reach && len > met.len)
|
|
171
|
+
) {
|
|
172
|
+
met = { bytes: aBytes.subarray(s, e), reach, len, a, b };
|
|
173
|
+
}
|
|
174
|
+
}
|
|
158
175
|
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
176
|
+
}
|
|
177
|
+
if (met === null) {
|
|
178
|
+
return null;
|
|
179
|
+
}
|
|
180
|
+
const t = ctx.trace?.enter("confluence", [rItem(query, "query")]);
|
|
181
|
+
ctx.trace?.step(
|
|
182
|
+
"intersectEvidence",
|
|
183
|
+
[
|
|
184
|
+
rNode(ctx, met.a.anchor, "constraint", met.a.vote),
|
|
185
|
+
rNode(ctx, met.b.anchor, "constraint", met.b.vote),
|
|
186
|
+
],
|
|
187
|
+
[rItem(met.bytes, "meet")],
|
|
188
|
+
`the discriminative content BOTH constraints' evidence shares, by content-addressed identity (reach ${met.reach} of ${N} contexts)`,
|
|
189
|
+
);
|
|
190
|
+
t?.done(
|
|
191
|
+
[rItem(met.bytes, "answer")],
|
|
192
|
+
"conjunctive join — the entity where the independent evidence streams meet",
|
|
193
|
+
);
|
|
194
|
+
// Evidence: the query spans whose content the two streams hold by
|
|
195
|
+
// identity (scaffolding included — held, not just the binding cover);
|
|
196
|
+
// the acts were two constraint matches and one meet.
|
|
197
|
+
const accounted = [
|
|
198
|
+
...met.a.held,
|
|
199
|
+
...met.b.held,
|
|
200
|
+
];
|
|
201
|
+
return {
|
|
202
|
+
bytes: met.bytes,
|
|
203
|
+
used: new Set([met.a.anchor, met.b.anchor]),
|
|
204
|
+
accounted,
|
|
205
|
+
moves: 3 * STEP,
|
|
206
|
+
unexplained: unexplainedLabel(query, accounted),
|
|
207
|
+
};
|
|
181
208
|
}
|
|
182
209
|
// ── Pipeline mechanism ──────────────────────────────────────────────────────
|
|
183
210
|
export const confluenceMechanism = {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
211
|
+
name: "confluence",
|
|
212
|
+
provenance: "join",
|
|
213
|
+
async floor(_ctx, query, pre, worthRunning) {
|
|
214
|
+
const W = _ctx.space.maxGroup;
|
|
215
|
+
if (query.length < 2 * W || _ctx.store.edgeSourceCount() === 0) {
|
|
216
|
+
return null;
|
|
217
|
+
}
|
|
218
|
+
// Confluence's floor is always exactly 3*STEP when it exists — same
|
|
219
|
+
// investment discipline as CAST's (see cast.ts): when the bound already
|
|
220
|
+
// cannot beat the incumbent, return it UNINVESTED (never first-touch the
|
|
221
|
+
// climb just to be pruned) and let the pipeline record the truthful
|
|
222
|
+
// "cannot beat incumbent" note.
|
|
223
|
+
if (!worthRunning(3 * STEP)) {
|
|
224
|
+
return 3 * STEP;
|
|
225
|
+
}
|
|
226
|
+
if ((await pre.attention()).ranked.length < 2) {
|
|
227
|
+
return null;
|
|
228
|
+
}
|
|
229
|
+
return 3 * STEP;
|
|
230
|
+
},
|
|
231
|
+
async run(ctx, query, pre) {
|
|
232
|
+
const met = await confluenceJoin(ctx, query, pre);
|
|
233
|
+
if (!met) {
|
|
234
|
+
return [];
|
|
235
|
+
}
|
|
236
|
+
return [{
|
|
237
|
+
bytes: met.bytes,
|
|
238
|
+
accounted: met.accounted,
|
|
239
|
+
moves: met.moves,
|
|
240
|
+
used: met.used,
|
|
241
|
+
unexplained: met.unexplained,
|
|
242
|
+
}];
|
|
243
|
+
},
|
|
213
244
|
};
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import type { MindContext } from "../types.js";
|
|
2
2
|
import type { Site } from "../graph-search.js";
|
|
3
3
|
import type { PipelineMechanism } from "../pipeline-mechanism.js";
|
|
4
|
-
export declare function resolveConcepts(
|
|
5
|
-
|
|
4
|
+
export declare function resolveConcepts(
|
|
5
|
+
ctx: MindContext,
|
|
6
|
+
sites: Site[],
|
|
7
|
+
): Promise<Map<number, number>>;
|
|
8
|
+
export declare function resolveConnectors(
|
|
9
|
+
ctx: MindContext,
|
|
10
|
+
sites: ReadonlyArray<Site>,
|
|
11
|
+
): Promise<Map<string, Uint8Array>>;
|
|
6
12
|
export declare const coverMechanism: PipelineMechanism;
|