@hviana/sema 0.2.4 → 0.2.6
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/package.json +1 -1
- package/src/geometry.ts +52 -3
- package/src/mind/attention.ts +1469 -120
- package/src/mind/index.ts +16 -0
- package/src/mind/junction.ts +125 -16
- package/src/mind/mind.ts +15 -0
- package/src/mind/rationale.ts +12 -4
- package/src/mind/traverse.ts +75 -7
- package/src/mind/types.ts +25 -0
- package/test/51-structural-resonance-ladder.test.mjs +552 -0
- package/test/52-climb-consensus-instrumentation.test.mjs +324 -0
- package/test/53-cross-region-probe-instrumentation.test.mjs +356 -0
- package/dist/example/demo.d.ts +0 -1
- package/dist/example/demo.js +0 -39
- package/dist/example/train_base.d.ts +0 -87
- package/dist/example/train_base.js +0 -2252
- package/dist/src/alphabet.d.ts +0 -7
- package/dist/src/alphabet.js +0 -33
- package/dist/src/alu/src/alu.d.ts +0 -185
- package/dist/src/alu/src/alu.js +0 -440
- package/dist/src/alu/src/expr.d.ts +0 -61
- package/dist/src/alu/src/expr.js +0 -318
- package/dist/src/alu/src/index.d.ts +0 -11
- package/dist/src/alu/src/index.js +0 -19
- package/dist/src/alu/src/kernel-arith.d.ts +0 -16
- package/dist/src/alu/src/kernel-arith.js +0 -264
- package/dist/src/alu/src/kernel-bits.d.ts +0 -19
- package/dist/src/alu/src/kernel-bits.js +0 -152
- package/dist/src/alu/src/kernel-logic.d.ts +0 -4
- package/dist/src/alu/src/kernel-logic.js +0 -60
- package/dist/src/alu/src/kernel-nd.d.ts +0 -3
- package/dist/src/alu/src/kernel-nd.js +0 -208
- package/dist/src/alu/src/kernel-numeric.d.ts +0 -54
- package/dist/src/alu/src/kernel-numeric.js +0 -366
- package/dist/src/alu/src/operation.d.ts +0 -168
- package/dist/src/alu/src/operation.js +0 -189
- package/dist/src/alu/src/parser.d.ts +0 -221
- package/dist/src/alu/src/parser.js +0 -577
- package/dist/src/alu/src/resonance.d.ts +0 -55
- package/dist/src/alu/src/resonance.js +0 -126
- package/dist/src/alu/src/text.d.ts +0 -31
- package/dist/src/alu/src/text.js +0 -73
- package/dist/src/alu/src/value.d.ts +0 -109
- package/dist/src/alu/src/value.js +0 -300
- package/dist/src/alu/test/alu.test.d.ts +0 -1
- package/dist/src/alu/test/alu.test.js +0 -764
- package/dist/src/bytes.d.ts +0 -14
- package/dist/src/bytes.js +0 -59
- package/dist/src/canon.d.ts +0 -26
- package/dist/src/canon.js +0 -57
- package/dist/src/config.d.ts +0 -111
- package/dist/src/config.js +0 -91
- package/dist/src/derive/src/deduction.d.ts +0 -125
- package/dist/src/derive/src/deduction.js +0 -155
- package/dist/src/derive/src/index.d.ts +0 -7
- package/dist/src/derive/src/index.js +0 -11
- package/dist/src/derive/src/priority-queue.d.ts +0 -20
- package/dist/src/derive/src/priority-queue.js +0 -73
- package/dist/src/derive/src/rewrite.d.ts +0 -56
- package/dist/src/derive/src/rewrite.js +0 -100
- package/dist/src/derive/src/trie.d.ts +0 -90
- package/dist/src/derive/src/trie.js +0 -217
- package/dist/src/derive/test/derive.test.d.ts +0 -1
- package/dist/src/derive/test/derive.test.js +0 -122
- package/dist/src/extension.d.ts +0 -37
- package/dist/src/extension.js +0 -7
- package/dist/src/geometry.d.ts +0 -176
- package/dist/src/geometry.js +0 -546
- package/dist/src/index.d.ts +0 -16
- package/dist/src/index.js +0 -18
- package/dist/src/ingest-cache.d.ts +0 -41
- package/dist/src/ingest-cache.js +0 -161
- package/dist/src/mind/articulation.d.ts +0 -6
- package/dist/src/mind/articulation.js +0 -99
- package/dist/src/mind/attention.d.ts +0 -88
- package/dist/src/mind/attention.js +0 -997
- package/dist/src/mind/bridge.d.ts +0 -30
- package/dist/src/mind/bridge.js +0 -569
- package/dist/src/mind/canonical.d.ts +0 -29
- package/dist/src/mind/canonical.js +0 -88
- package/dist/src/mind/graph-search.d.ts +0 -285
- package/dist/src/mind/graph-search.js +0 -956
- package/dist/src/mind/index.d.ts +0 -5
- package/dist/src/mind/index.js +0 -5
- package/dist/src/mind/junction.d.ts +0 -95
- package/dist/src/mind/junction.js +0 -262
- package/dist/src/mind/learning.d.ts +0 -47
- package/dist/src/mind/learning.js +0 -248
- package/dist/src/mind/match.d.ts +0 -126
- package/dist/src/mind/match.js +0 -441
- package/dist/src/mind/mechanisms/alu.d.ts +0 -4
- package/dist/src/mind/mechanisms/alu.js +0 -36
- package/dist/src/mind/mechanisms/cast.d.ts +0 -89
- package/dist/src/mind/mechanisms/cast.js +0 -716
- package/dist/src/mind/mechanisms/confluence.d.ts +0 -24
- package/dist/src/mind/mechanisms/confluence.js +0 -225
- package/dist/src/mind/mechanisms/cover.d.ts +0 -6
- package/dist/src/mind/mechanisms/cover.js +0 -203
- package/dist/src/mind/mechanisms/extraction.d.ts +0 -67
- package/dist/src/mind/mechanisms/extraction.js +0 -387
- package/dist/src/mind/mechanisms/recall.d.ts +0 -13
- package/dist/src/mind/mechanisms/recall.js +0 -325
- package/dist/src/mind/mind.d.ts +0 -274
- package/dist/src/mind/mind.js +0 -572
- package/dist/src/mind/pipeline-mechanism.d.ts +0 -142
- package/dist/src/mind/pipeline-mechanism.js +0 -213
- package/dist/src/mind/pipeline.d.ts +0 -20
- package/dist/src/mind/pipeline.js +0 -217
- package/dist/src/mind/primitives.d.ts +0 -70
- package/dist/src/mind/primitives.js +0 -287
- package/dist/src/mind/rationale.d.ts +0 -134
- package/dist/src/mind/rationale.js +0 -162
- package/dist/src/mind/reasoning.d.ts +0 -34
- package/dist/src/mind/reasoning.js +0 -240
- package/dist/src/mind/recognition.d.ts +0 -20
- package/dist/src/mind/recognition.js +0 -390
- package/dist/src/mind/resonance.d.ts +0 -23
- package/dist/src/mind/resonance.js +0 -0
- package/dist/src/mind/trace.d.ts +0 -15
- package/dist/src/mind/trace.js +0 -73
- package/dist/src/mind/traverse.d.ts +0 -113
- package/dist/src/mind/traverse.js +0 -504
- package/dist/src/mind/types.d.ts +0 -271
- package/dist/src/mind/types.js +0 -130
- package/dist/src/rabitq-ivf/src/database.d.ts +0 -113
- package/dist/src/rabitq-ivf/src/database.js +0 -201
- package/dist/src/rabitq-ivf/src/index.d.ts +0 -7
- package/dist/src/rabitq-ivf/src/index.js +0 -4
- package/dist/src/rabitq-ivf/src/ivf.d.ts +0 -200
- package/dist/src/rabitq-ivf/src/ivf.js +0 -1165
- package/dist/src/rabitq-ivf/src/prng.d.ts +0 -19
- package/dist/src/rabitq-ivf/src/prng.js +0 -36
- package/dist/src/rabitq-ivf/src/rabitq.d.ts +0 -95
- package/dist/src/rabitq-ivf/src/rabitq.js +0 -283
- package/dist/src/sema.d.ts +0 -31
- package/dist/src/sema.js +0 -63
- package/dist/src/store-sqlite.d.ts +0 -184
- package/dist/src/store-sqlite.js +0 -942
- package/dist/src/store.d.ts +0 -663
- package/dist/src/store.js +0 -1618
- package/dist/src/vec.d.ts +0 -31
- package/dist/src/vec.js +0 -109
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import type { MindContext } from "../types.js";
|
|
2
|
-
import type { Vec } from "../../vec.js";
|
|
3
|
-
/** A CAST answer plus its elementary evidence for think's grounding decider:
|
|
4
|
-
* `accounted` — the query spans the weave's aligned runs explain; `moves` —
|
|
5
|
-
* the ladder cost of the acts the taken branch performed (STEP per
|
|
6
|
-
* projection, CONCEPT for the halo-mediated analogy gate). */
|
|
7
|
-
export interface CastResult {
|
|
8
|
-
bytes: Uint8Array;
|
|
9
|
-
used: ReadonlySet<number>;
|
|
10
|
-
accounted: Array<[number, number]>;
|
|
11
|
-
moves: number;
|
|
12
|
-
/** A human-readable label for the query bytes this schema left
|
|
13
|
-
* unexplained — purely diagnostic, never priced (see the module's
|
|
14
|
-
* Task 2 note in pipeline.ts's Candidate interface). */
|
|
15
|
-
unexplained: string;
|
|
16
|
-
}
|
|
17
|
-
/** The seat that establishes a node's role in an analogical comparison:
|
|
18
|
-
* the REVERSE context (what leads to it) when a predecessor genuinely
|
|
19
|
-
* ESTABLISHES id — introduces or describes it by name — else the FORWARD
|
|
20
|
-
* continuation (what it leads to), else `fallback`.
|
|
21
|
-
*
|
|
22
|
-
* An earlier version gated this purely on `prevCount(id) > 0`: any
|
|
23
|
-
* predecessor at all was treated as proof of a genuine named ENTITY
|
|
24
|
-
* (seat it by what established it), while no predecessor meant a bare
|
|
25
|
-
* learnt CONTEXT (seat it by what it leads to, since voicing it verbatim
|
|
26
|
-
* would answer a question with a question). That test measured the wrong
|
|
27
|
-
* thing — a broad sample of this store's own question-shaped nodes showed
|
|
28
|
-
* the large majority (≈71%) have at least one predecessor, most of them a
|
|
29
|
-
* handful of generic, high-fan-out sentences that recur as an INCIDENTAL
|
|
30
|
-
* neighbour to dozens of otherwise-unrelated destinations (a SmolSent-
|
|
31
|
-
* style sentence-adjacency artifact, never naming or describing what
|
|
32
|
-
* follows). Traced live: "What is the capital of France?" — whose own
|
|
33
|
-
* forward edge unambiguously resolves to "The capital of France is
|
|
34
|
-
* Paris." — has exactly one such incidental predecessor ("Create an
|
|
35
|
-
* example of a types of questions a GPT model can answer.?"), wrongly
|
|
36
|
-
* read as disqualifying proof of "genuine entity."
|
|
37
|
-
*
|
|
38
|
-
* A plain forward-first swap (matching {@link project}'s universal
|
|
39
|
-
* priority) over-corrected: test/29's C2/C3 pin that a genuine entity
|
|
40
|
-
* analog (e.g. "Leonardo da Vinci", established by "The Mona Lisa was
|
|
41
|
-
* painted by Leonardo da Vinci.") must be seated by that establishing
|
|
42
|
-
* sentence, NOT by its own biography fact — voicing the bio leaks exactly
|
|
43
|
-
* what a comparison must keep out, and loses the embedded "Mona Lisa"
|
|
44
|
-
* term C3 relies on for a further hop.
|
|
45
|
-
*
|
|
46
|
-
* The distinguishing signal is content-addressed, not a count: a genuine
|
|
47
|
-
* establishing predecessor's bytes CONTAIN id's own bytes — it names or
|
|
48
|
-
* describes id ("...painted by Leonardo da Vinci." contains "Leonardo da
|
|
49
|
-
* Vinci"). An incidental adjacency predecessor never does — it merely
|
|
50
|
-
* preceded id in some unrelated document without ever mentioning it. No
|
|
51
|
-
* new tuned constant: containment is the same primitive `restatesQuery`
|
|
52
|
-
* and `dominates`-style checks already use throughout this codebase.
|
|
53
|
-
*
|
|
54
|
-
* `allowForward` (default true) gates the FORWARD branch specifically —
|
|
55
|
-
* see the call sites below: the DOMINANT is what the query is actually
|
|
56
|
-
* ASKING, so completing it forward is the whole point; an ANALOG is only
|
|
57
|
-
* being CITED for comparison; the query never asked about IT, so chasing
|
|
58
|
-
* its own further continuation drifts onto whatever coincidentally
|
|
59
|
-
* follows it in the corpus. Traced live: the analog "What is the capital
|
|
60
|
-
* of Japan?\nTokyo is the capital of Japan." is ALREADY a complete,
|
|
61
|
-
* self-answering unit (prevCount 0, so no establishing predecessor
|
|
62
|
-
* either) — its sole forward edge is "And what is the capital of the
|
|
63
|
-
* Moon?", an unrelated quiz question sharing nothing but corpus
|
|
64
|
-
* adjacency. With forward disallowed, an analog like this falls through
|
|
65
|
-
* to `fallback` — its own bytes, exactly the complete fact that made it a
|
|
66
|
-
* genuine analog in the first place. See
|
|
67
|
-
* test/41-seatofnode-direction.test.mjs and
|
|
68
|
-
* test/43-cast-analog-seat.test.mjs. */
|
|
69
|
-
export declare function seatOfNode(ctx: MindContext, id: number, guide: Vec | null | undefined, fallback: Uint8Array, allowForward?: boolean): Promise<Uint8Array>;
|
|
70
|
-
/** CAST's own entry gates, checked once here and reused by
|
|
71
|
-
/** The main CAST entry point. Given a query and its pre-computed pre.rec.sites,
|
|
72
|
-
* determine whether the query weaves together multiple independent learnt
|
|
73
|
-
* structures (by graded alignment — literal first, then halo-matched pre.rec.sites).
|
|
74
|
-
* If so, attempt substitution, redirection, AND analogical comparison —
|
|
75
|
-
* each schema is tried independently and every one that fires yields its
|
|
76
|
-
* OWN candidate; think's grounding decider (which already compares weights
|
|
77
|
-
* across mechanisms) picks among them, so CAST no longer needs an internal
|
|
78
|
-
* priority order.
|
|
79
|
-
*
|
|
80
|
-
* `climb`, when given, is {@link castFloor}'s own climb result — reused
|
|
81
|
-
* instead of re-running climbAttentionAll (see the note on {@link
|
|
82
|
-
* CastFloor}). Its gates (`query.length`, `edgeSourceCount`,
|
|
83
|
-
* `ranked.length < 2`) MUST stay in sync with castFloor's — one is the
|
|
84
|
-
* other's admissible lower bound, checked before this runs.
|
|
85
|
-
*
|
|
86
|
-
* Returns the array of {@link CastResult}s that fired (possibly empty). */
|
|
87
|
-
export declare function counterfactualTransfer(ctx: MindContext, query: Uint8Array, pre: Precomputed): Promise<CastResult[]>;
|
|
88
|
-
import type { PipelineMechanism, Precomputed } from "../pipeline-mechanism.js";
|
|
89
|
-
export declare const castMechanism: PipelineMechanism;
|