@hviana/sema 0.1.4 → 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 +13 -9
- package/dist/src/sema.js +40 -26
- 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
|
@@ -1,23 +1,60 @@
|
|
|
1
1
|
import type { DerivationStep } from "./graph-search.js";
|
|
2
|
-
import type {
|
|
2
|
+
import type {
|
|
3
|
+
AncestorReach,
|
|
4
|
+
Attention,
|
|
5
|
+
AttentionRead,
|
|
6
|
+
DFMode,
|
|
7
|
+
MindContext,
|
|
8
|
+
Region,
|
|
9
|
+
RegionVote,
|
|
10
|
+
SaturationInfo,
|
|
11
|
+
} from "./types.js";
|
|
3
12
|
/** Climb the query's perceived byte regions up the structural DAG via
|
|
4
13
|
* resonance, pool the evidence, and return only the ROOT points of
|
|
5
14
|
* attention — those that cleared commitVotes' significance floor. */
|
|
6
|
-
export declare function climbAttention(
|
|
15
|
+
export declare function climbAttention(
|
|
16
|
+
ctx: MindContext,
|
|
17
|
+
query: Uint8Array,
|
|
18
|
+
k: number,
|
|
19
|
+
mode?: DFMode,
|
|
20
|
+
): Promise<Attention[]>;
|
|
7
21
|
/** Full read-out of one consensus climb: both the roots (dominant points of
|
|
8
22
|
* attention) and the entire ranked list. Cached via ctx.climbMemo when
|
|
9
23
|
* ctx.trace is null. */
|
|
10
|
-
export declare function climbAttentionAll(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
24
|
+
export declare function climbAttentionAll(
|
|
25
|
+
ctx: MindContext,
|
|
26
|
+
query: Uint8Array,
|
|
27
|
+
k: number,
|
|
28
|
+
mode?: DFMode,
|
|
29
|
+
): Promise<AttentionRead>;
|
|
30
|
+
export declare function computeAttention(
|
|
31
|
+
ctx: MindContext,
|
|
32
|
+
query: Uint8Array,
|
|
33
|
+
k: number,
|
|
34
|
+
mode: DFMode,
|
|
35
|
+
): Promise<AttentionRead>;
|
|
36
|
+
export declare function collectRegions(
|
|
37
|
+
ctx: MindContext,
|
|
38
|
+
query: Uint8Array,
|
|
39
|
+
): Region[];
|
|
40
|
+
export declare function voteRegions(
|
|
41
|
+
ctx: MindContext,
|
|
42
|
+
query: Uint8Array,
|
|
43
|
+
regions: readonly Region[],
|
|
44
|
+
k: number,
|
|
45
|
+
mode: DFMode,
|
|
46
|
+
N: number,
|
|
47
|
+
reachMemo?: Map<number, AncestorReach>,
|
|
48
|
+
): Promise<{
|
|
49
|
+
votes: RegionVote[];
|
|
50
|
+
saturated: boolean[];
|
|
51
|
+
voters: Array<
|
|
52
|
+
{
|
|
53
|
+
id: number;
|
|
54
|
+
score: number;
|
|
55
|
+
w: number;
|
|
56
|
+
} | null
|
|
57
|
+
>;
|
|
21
58
|
}>;
|
|
22
59
|
/** The consensus vote as EVIDENCE POOLING, not shortest path: each surviving
|
|
23
60
|
* region is an axiom; it contributes to every root it climbed to (or, for a
|
|
@@ -31,42 +68,73 @@ export declare function voteRegions(ctx: MindContext, query: Uint8Array, regions
|
|
|
31
68
|
* merely logs alongside it. `votesIdf`/`support` are the same two
|
|
32
69
|
* read-outs {@link commitVotes} always gated on; only how they accumulate
|
|
33
70
|
* changed. */
|
|
34
|
-
export declare function poolVotes(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
71
|
+
export declare function poolVotes(
|
|
72
|
+
ctx: MindContext,
|
|
73
|
+
regionVotes: readonly RegionVote[],
|
|
74
|
+
sat: SaturationInfo,
|
|
75
|
+
N: number,
|
|
76
|
+
): {
|
|
77
|
+
votes: Map<number, number>;
|
|
78
|
+
votesIdf: Map<number, number>;
|
|
79
|
+
support: Map<number, {
|
|
80
|
+
start: number;
|
|
81
|
+
end: number;
|
|
82
|
+
w: number;
|
|
83
|
+
}>;
|
|
84
|
+
steps: DerivationStep[];
|
|
43
85
|
};
|
|
44
|
-
export declare function commitVotes(
|
|
86
|
+
export declare function commitVotes(
|
|
87
|
+
ctx: MindContext,
|
|
88
|
+
pooled: {
|
|
45
89
|
votes: Map<number, number>;
|
|
46
90
|
votesIdf: Map<number, number>;
|
|
47
91
|
support: Map<number, {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
92
|
+
start: number;
|
|
93
|
+
end: number;
|
|
94
|
+
w: number;
|
|
51
95
|
}>;
|
|
52
96
|
steps: DerivationStep[];
|
|
53
|
-
},
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
97
|
+
},
|
|
98
|
+
sat: SaturationInfo,
|
|
99
|
+
regions: readonly Region[],
|
|
100
|
+
regionVoter: ReadonlyArray<
|
|
101
|
+
{
|
|
102
|
+
id: number;
|
|
103
|
+
score: number;
|
|
104
|
+
w: number;
|
|
105
|
+
} | null
|
|
106
|
+
>,
|
|
107
|
+
N: number,
|
|
108
|
+
): AttentionRead;
|
|
109
|
+
export declare function detectSaturated(
|
|
110
|
+
ctx: MindContext,
|
|
111
|
+
regions: ReadonlyArray<{
|
|
59
112
|
start: number;
|
|
60
113
|
end: number;
|
|
61
114
|
chunk?: boolean;
|
|
62
|
-
}>,
|
|
63
|
-
|
|
115
|
+
}>,
|
|
116
|
+
saturated: ReadonlyArray<boolean>,
|
|
117
|
+
): SaturationInfo;
|
|
118
|
+
export declare function canonicalChunkId(
|
|
119
|
+
ctx: MindContext,
|
|
120
|
+
regionBytes: Uint8Array,
|
|
121
|
+
N: number,
|
|
122
|
+
reachMemo?: Map<number, AncestorReach>,
|
|
123
|
+
): number | null;
|
|
64
124
|
export declare function naturalBreak(votes: number[]): number;
|
|
65
|
-
export declare function traceAttention(
|
|
125
|
+
export declare function traceAttention(
|
|
126
|
+
ctx: MindContext,
|
|
127
|
+
regions: ReadonlyArray<{
|
|
66
128
|
start: number;
|
|
67
129
|
end: number;
|
|
68
|
-
}>,
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
130
|
+
}>,
|
|
131
|
+
regionVoter: ReadonlyArray<
|
|
132
|
+
{
|
|
133
|
+
id: number;
|
|
134
|
+
score: number;
|
|
135
|
+
w: number;
|
|
136
|
+
} | null
|
|
137
|
+
>,
|
|
138
|
+
roots: ReadonlyArray<Attention>,
|
|
139
|
+
steps?: ReadonlyArray<DerivationStep>,
|
|
140
|
+
): void;
|