@hviana/sema 0.9.1 → 0.9.3

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.
Files changed (42) hide show
  1. package/dist/src/meter.d.ts +19 -0
  2. package/dist/src/meter.js +19 -0
  3. package/dist/src/mind/evidence.d.ts +30 -0
  4. package/dist/src/mind/evidence.js +102 -0
  5. package/dist/src/mind/mechanisms/cast.d.ts +1 -1
  6. package/dist/src/mind/mechanisms/cast.js +73 -12
  7. package/dist/src/mind/mechanisms/cover.js +25 -3
  8. package/dist/src/mind/mechanisms/recall.js +93 -9
  9. package/dist/src/mind/mechanisms/reference.js +25 -0
  10. package/dist/src/mind/mind.d.ts +7 -0
  11. package/dist/src/mind/mind.js +3 -0
  12. package/dist/src/mind/pipeline-mechanism.js +15 -1
  13. package/dist/src/mind/pipeline.js +51 -8
  14. package/dist/src/mind/reasoning.js +65 -18
  15. package/dist/src/mind/resonance.d.ts +3 -2
  16. package/dist/src/mind/resonance.js +3 -2
  17. package/dist/src/mind/traverse.d.ts +94 -2
  18. package/dist/src/mind/traverse.js +611 -7
  19. package/dist/src/mind/types.d.ts +12 -0
  20. package/docs/INDEX.md +18 -17
  21. package/docs/INVARIANTS.md +1 -0
  22. package/docs/architecture/evidence.md +256 -0
  23. package/docs/architecture/exact-vs-approximate.md +10 -9
  24. package/jsr.json +1 -1
  25. package/package.json +1 -1
  26. package/src/meter.ts +19 -0
  27. package/src/mind/evidence.ts +125 -0
  28. package/src/mind/mechanisms/cast.ts +77 -3
  29. package/src/mind/mechanisms/cover.ts +42 -3
  30. package/src/mind/mechanisms/recall.ts +123 -11
  31. package/src/mind/mechanisms/reference.ts +24 -1
  32. package/src/mind/mind.ts +6 -0
  33. package/src/mind/pipeline-mechanism.ts +15 -1
  34. package/src/mind/pipeline.ts +64 -8
  35. package/src/mind/reasoning.ts +82 -17
  36. package/src/mind/resonance.ts +3 -2
  37. package/src/mind/traverse.ts +652 -7
  38. package/src/mind/types.ts +10 -0
  39. package/test/154-the-question-names-the-step.test.mjs +368 -0
  40. package/test/155-the-relation-read-off-another-instance.test.mjs +376 -0
  41. package/test/29-counterfactual.test.mjs +21 -11
  42. package/test/76-reference-binding.test.mjs +32 -0
@@ -203,7 +203,21 @@ export class Precomputed {
203
203
  * fusion all share. Computed on first access; a query no mechanism
204
204
  * climbs for (e.g. one an extension decided outright) never pays for it. */
205
205
  attention() {
206
- return this._attention ??= this.shared("attention", () => climbAttentionAll(this.ctx, this.query, this.k));
206
+ return this._attention ??= this.shared("attention", () => climbAttentionAll(this.ctx, this.query, this.k)).then((read) => {
207
+ // The climb's scored anchors are what the exact tier reads co-instances
208
+ // of the question from (traverse.ts, `relationFrames`): the
209
+ // approximate climb proposes, witnessing decides.
210
+ // A pick made before the points existed read less evidence than one
211
+ // made after, so the response's pick memo starts over (traverse.ts,
212
+ // guidedNext: a pick is a function of the store, the guide AND the
213
+ // points — traced and untraced responses must agree).
214
+ const asked = this.ctx._edgeAsked;
215
+ if (asked !== null && asked.points === undefined) {
216
+ asked.points = read.ranked.map((a) => a.anchor);
217
+ this.ctx._edgeChoice.clear();
218
+ }
219
+ return read;
220
+ });
207
221
  }
208
222
  _weave;
209
223
  /** Result of {@link alignGraded} for the first k ranked anchors —
@@ -15,7 +15,9 @@ import { fusionLayer, walkLayer } from "./reasoning.js";
15
15
  import { closed, closeOver, remainderOf, unaccountedBytes, unexplainedSpans, windowOf, } from "./derivation.js";
16
16
  import { rItem } from "./trace.js";
17
17
  import { unexplainedLabel } from "./rationale.js";
18
- import { hubBound } from "./traverse.js";
18
+ import { hubBound, offsetCanon, scaffoldExtents } from "./traverse.js";
19
+ import { windowIndex, witness } from "./evidence.js";
20
+ import { indexOf } from "../bytes.js";
19
21
  import { Precomputed, } from "./pipeline-mechanism.js";
20
22
  import { coverMechanism } from "./mechanisms/cover.js";
21
23
  import { castMechanism } from "./mechanisms/cast.js";
@@ -83,6 +85,13 @@ export async function think(ctx, query, mechs) {
83
85
  if (query.length === 0)
84
86
  return null;
85
87
  ctx._edgeGuide = gistOf(ctx, query);
88
+ {
89
+ const asked = offsetCanon(ctx, query);
90
+ ctx._edgeAsked = {
91
+ bytes: asked,
92
+ index: windowIndex(asked, ctx.space.maxGroup),
93
+ };
94
+ }
86
95
  ctx._edgeChoice.clear();
87
96
  const t = ctx.trace?.enter("think", [rItem(query, "query")]);
88
97
  const done = (answer, note) => {
@@ -468,7 +477,17 @@ export async function think(ctx, query, mechs) {
468
477
  ...pre.computed.map((u) => [u.i, u.j]),
469
478
  ];
470
479
  const explained = priced.filter(([a, b]) => windowOf([a, b], answer, query, ctx.space.maxGroup) !== null);
471
- const paid = remainderOf(query.length, explained, ctx.space.maxGroup);
480
+ // THE DERIVATION IS BORN OWING ITS DISCRIMINATIVE MATERIAL. The bytes a
481
+ // corpus-global scaffolding window reaches (traverse.ts, `scaffoldExtents`)
482
+ // are nobody's debt — otherwise a later step could claim to pay them by
483
+ // restating ` is `, which every fact holds, and the law (which measures
484
+ // carrying by any window of what is owed) would admit it; the substitution
485
+ // bridge reads gaps the same way (`explainedSpan`). PRICING is untouched:
486
+ // the ladder still charges every unexplained byte, because for a question
487
+ // made of nothing but scaffolding (`How are you today?`) covering those bytes
488
+ // IS the evidence.
489
+ const scaffold = scaffoldExtents(ctx, query);
490
+ const paid = remainderOf(query.length, [...explained, ...scaffold], ctx.space.maxGroup);
472
491
  // WHAT THE CONSTRUCTION WITHHOLDS, at or above one quantum: the difference between
473
492
  // the remainder paid in full and the remainder paid by carrying. Both readings
474
493
  // are the law's, so the floor is applied once and in one place — and the
@@ -488,8 +507,23 @@ export async function think(ctx, query, mechs) {
488
507
  };
489
508
  const uncovered = state.remainder;
490
509
  // ── Post-grounding, gated by the declaration and the remainder ────────
510
+ // WHAT THE GROUNDING SPOKE FOR, when it did not declare it: the forms inside
511
+ // the answer that the ASKER already holds. An answer is the asker's material
512
+ // plus what the corpus added — the fact's own value — and only the former was
513
+ // spoken for: re-entering it walks back to the question. The latter is what a
514
+ // chain continues THROUGH. Consuming every form recognised in the answer
515
+ // consumed that too, so a chain could start only where recognition happened
516
+ // to miss the next entity — measured on 133 held-out 2Wiki compositional
517
+ // questions, 3 pivot steps in all once interior recognition named the entity
518
+ // inside every fact. Witnessed exactly, as `chooseNext`'s exact tier reads the
519
+ // question (evidence.ts); a form below one window cannot be witnessed, and is
520
+ // consumed as before.
521
+ const asked = ctx._edgeAsked;
491
522
  const preConsumed = declaredUsed ??
492
- new Set(recognise(ctx, answer).sites.map((s) => s.payload));
523
+ new Set(recognise(ctx, answer).sites
524
+ .filter((s) => asked === null || s.end - s.start < ctx.space.maxGroup ||
525
+ witness(offsetCanon(ctx, answer.subarray(s.start, s.end)), [asked.index], ctx.space.maxGroup).complete)
526
+ .map((s) => s.payload));
493
527
  // A grounding that DECLARED itself complete is not extended: the answer is
494
528
  // already a trained form's own continuation, reached through an identity
495
529
  // claim about the query, so a multi-hop pivot could only chain past the
@@ -504,13 +538,14 @@ export async function think(ctx, query, mechs) {
504
538
  // Reading the used anchors' OWN bytes here says something stronger and
505
539
  // wrong: that nothing INSIDE what was voiced may be pivoted through. A
506
540
  // comparison's seat sentence legitimately contains further terms with
507
- // their own unrelated facts, and C3 pins exactly that — `Mona Lisa`, inside
508
- // the voiced seat `The Mona Lisa was painted by Leonardo da Vinci.`, leads
509
- // on to `Mona Lisa hangs in the Louvre`, which is about neither analog.
541
+ // their own unrelated facts — `Mona Lisa`, inside the voiced seat `The Mona
542
+ // Lisa was painted by Leonardo da Vinci.`, leads on to `Mona Lisa hangs in
543
+ // the Louvre`, which is about neither analog (test/29 C3: a candidate the
544
+ // walk takes only when the question names it).
510
545
  // The withheld content is the used anchors' CONTINUATIONS, so that is what
511
546
  // the containment rule reads: `speare` is contained in `Shakespeare wrote
512
547
  // 39 plays` and stays refused, while `Mona Lisa` appears in no withheld
513
- // continuation and the genuine further hop fires.
548
+ // continuation and stays a candidate.
514
549
  //
515
550
  // Only a mechanism carrying its own `used` set (cast/join) gets this: there
516
551
  // `preConsumed` is a deliberate, short list of the anchors the answer
@@ -518,7 +553,15 @@ export async function think(ctx, query, mechs) {
518
553
  // `preConsumed` is derived by re-recognising the answer — "everything in
519
554
  // it", not "what it voiced" — and a containment rule over that would
520
555
  // suppress every pivot the answer legitimately contains.
521
- const voiced = declaredUsed === undefined ? [] : [...declaredUsed].flatMap((id) => ctx.store.nextFirst(id, hubBound(ctx)).map((n) => read(ctx, n)));
556
+ //
557
+ // …and a continuation the ANSWER ITSELF holds was voiced, not withheld. A
558
+ // substitution that answers with its anchor's own continuation (`The director
559
+ // of Beat Girl is Edmond T. Gréville.`) declared that anchor used, so reading
560
+ // its continuations as withheld refused every pivot inside the answer — the
561
+ // chain could never step past the entity the first hop introduced.
562
+ const voiced = declaredUsed === undefined ? [] : [...declaredUsed].flatMap((id) => ctx.store.nextFirst(id, hubBound(ctx))
563
+ .map((n) => read(ctx, n))
564
+ .filter((v) => indexOf(answer, v, 0) < 0));
522
565
  // WHAT THIS BRANCH READ, published where it was read. Post-grounding decides
523
566
  // by the DECLARATION (`decided.used`, which becomes `voiced`), by what the
524
567
  // recognition already consumed (`preConsumed`) and by the derivation's own
@@ -6,10 +6,11 @@ import { rItem, rNode } from "./trace.js";
6
6
  import { bytesEqual, indexOf, latin1 } from "../bytes.js";
7
7
  import { read, resolve } from "./primitives.js";
8
8
  import { countClusters } from "./attention.js";
9
- import { hubBound } from "./traverse.js";
9
+ import { coInstanceFiller, guidedFirst, hubBound, namedContinuations, offsetCanon, } from "./traverse.js";
10
+ import { unspoken, windowIndex } from "./evidence.js";
10
11
  import { containsSpan, follow, haloSiblings, project } from "./match.js";
11
12
  import { joinWithBridge, pivotInto } from "./resonance.js";
12
- import { closeOver, restates, unaccountedBytes, } from "./derivation.js";
13
+ import { closed, closeOver, restates, unaccountedBytes, } from "./derivation.js";
13
14
  import { STEP } from "./graph-search.js";
14
15
  /** What one ADMITTED transition did to the question, published on the meter:
15
16
  * the bytes its witnesses CARRIED and the remainder the move DRAINED. The two
@@ -69,6 +70,11 @@ export function walkLayer(ctx, query, preConsumed, pre, voiced = []) {
69
70
  // fire — the same visibility trade chooseNext documents.
70
71
  const bound = hubBound(ctx);
71
72
  const consumed = new Set();
73
+ /** The windows each product of this derivation holds — what of the question
74
+ * the derivation has already restated, so a later step is NAMED only by
75
+ * question material none of them said. */
76
+ const spoken = [];
77
+ const speak = (product) => spoken.push(windowIndex(offsetCanon(ctx, product), ctx.space.maxGroup));
72
78
  /** `prev` lets a caller hand in an already-read reverse-edge list — hop 0
73
79
  * reuses the guard's, below, instead of re-reading it. */
74
80
  const consumeNode = (id, prev) => {
@@ -89,6 +95,7 @@ export function walkLayer(ctx, query, preConsumed, pre, voiced = []) {
89
95
  const begin = async (d0) => {
90
96
  const answer = d0.product;
91
97
  startedFrom = answer;
98
+ speak(answer);
92
99
  // Echo guard: a query that is ITSELF a learnt continuation (some context's
93
100
  // answer) is being asked back at the system — hopping forward from it would
94
101
  // chain through the very fact that produced it and echo the conversation
@@ -204,16 +211,12 @@ export function walkLayer(ctx, query, preConsumed, pre, voiced = []) {
204
211
  // 30 s); and raising it from 12 to 200 changed neither the answer nor
205
212
  // `pivotSteps` on the chain fixtures.
206
213
  const qv = pre.guide; // the response-wide guide IS the query's gist
207
- // WHOSE EXTENSION IS THIS? `voiced` is what the mechanism WITHHELD (the
208
- // pipeline sends the used anchors' CONTINUATIONS, not their bytes), so a
209
- // non-empty `voiced` means exactly what that note says: the grounding came
210
- // from a mechanism that carries its own short `used` set (cast/join) and
211
- // therefore OWNS the shape of its answer. The further terms inside such a
212
- // seat are legitimately followable (test/29 C3's `Mona Lisa` lives inside the
213
- // voiced seat and leads on to a fact about neither analog), which the law
214
- // expresses as the identity species of progress — `moves` — declared by the
215
- // reporter and never inferred from the mechanism's name.
216
- const producerOwnsShape = voiced.length > 0;
214
+ // NO PRODUCER OWNS THE NEXT STEP. A grounding that declared what it voiced
215
+ // (cast/join) used to MOVE through any further term inside its answer,
216
+ // unasked — `Who is the director of The Jerk?` grounded by CAST walked on to
217
+ // `The country of citizenship of Carl Reiner is American.` What it voiced
218
+ // still bounds what may be pivoted through (`voiced`, pivotInto); whether a
219
+ // step is taken is the naming rule below, the same for every mechanism.
217
220
  let hop = 0;
218
221
  let t;
219
222
  // WHAT THE OFFERED STEP WOULD BE. The law decides, so the accepted step is
@@ -328,21 +331,48 @@ export function walkLayer(ctx, query, preConsumed, pre, voiced = []) {
328
331
  ctx.trace?.step("pivotCandidateRefused", [rItem(cur, "answer")], [], `${why} — refused`);
329
332
  return null;
330
333
  }
334
+ // THE STEP THE QUESTION ASKS FOR. The hop `follow` took is NAMED when one
335
+ // of its establishing contexts is witnessed by what of the question no
336
+ // product has restated yet, plus the pivot itself (traverse.ts,
337
+ // `namedContinuations`): `Where was the place of death of the director of
338
+ // film Beat Girl?` names `Edmond T. Gréville place of death` once the first
339
+ // hop has restated `director` and `Beat Girl` — and `Who is the father of
340
+ // Frederick II?` names nothing past `Peter III of Aragon`, because `father`
341
+ // was restated by the hop that reached him. A named step MOVES to structure
342
+ // the question asked for, so it is admitted on that ground; an unnamed one
343
+ // must carry the question's remainder as before, and from a CLOSED
344
+ // derivation — nothing left owed — it is not offered at all: the question
345
+ // asks for no further step, and the law would otherwise admit any.
346
+ const asked = ctx._edgeAsked;
347
+ let named = false;
348
+ if (asked !== null) {
349
+ const unsaid = {
350
+ bytes: asked.bytes,
351
+ index: unspoken(asked.index, spoken),
352
+ };
353
+ const names = namedContinuations(ctx, pivot, unsaid);
354
+ const hop = guidedFirst(ctx, pivot);
355
+ named = names !== null && hop !== undefined && names.includes(hop);
356
+ }
357
+ if (!named && closed(d)) {
358
+ ctx.trace?.step("pivotUnasked", [rItem(cur, "answer"), rNode(ctx, pivot, "pivot")], [rItem(fc, "withheld")], "the derivation owes nothing and the question names no further step — not offered");
359
+ return null;
360
+ }
331
361
  pending = { kind: "pivot", cur, pivot, fc };
332
- // Offered with the identity species ONLY when the grounding declared what it
333
- // speaks for; otherwise the law requires this step to carry question
334
- // material the grounding left unaccounted, which is the drift the extension
335
- // tests pin — refused by the law's own measure, not by a private window
336
- // test.
362
+ // Offered with the identity species when the question names the step;
363
+ // otherwise the law requires this step to carry question material the grounding left
364
+ // unaccounted, which is the drift the extension tests pin — refused by the
365
+ // law's own measure, not by a private window test.
337
366
  return {
338
367
  product: fc,
339
368
  contains: true,
340
- reaches: producerOwnsShape,
369
+ reaches: named,
341
370
  cost: STEP,
342
371
  };
343
372
  };
344
373
  const onTaken = (before, after, witnesses) => {
345
374
  meterTransition(ctx, before, after, witnesses);
375
+ speak(after.product);
346
376
  const p = pending;
347
377
  pending = null;
348
378
  if (p === null)
@@ -646,6 +676,23 @@ primarySpans = []) {
646
676
  // again would only restate it. Deliberately NOT a magnitude measure:
647
677
  // it fires on exact content-addressed recurrence, not on how strongly
648
678
  // the root resonates.
679
+ // ANOTHER INSTANCE IS NOT ANOTHER TOPIC. A root the question witnesses
680
+ // in every byte but one contiguous span is the question's own frame
681
+ // around a different filler (evidence.ts, `coInstanceFiller`): the climb
682
+ // committed `Where was Peter Jackson born?` as a second point of
683
+ // `Where was the director of film Beat Girl born?` on the frame windows
684
+ // alone, and fusing it voiced Peter Jackson's birthplace beside the
685
+ // answer. Such a root says what the question's relation IS (traverse.ts,
686
+ // `byCoInstance`), never what it asks about.
687
+ const asked = ctx._edgeAsked;
688
+ if (asked !== null) {
689
+ const form = read(ctx, root.anchor, 2 * query.length);
690
+ const co = coInstanceFiller(ctx, form, [asked.index], asked.bytes);
691
+ if (co !== null) {
692
+ ctx.trace?.step("coInstanceRoot", [rNode(ctx, root.anchor, "point", root.vote)], [rItem(form.subarray(co.span[0], co.span[1]), "filler")], "the question witnesses this point in every byte but one filler of its own — another instance of the question's frame, not a further topic");
693
+ continue;
694
+ }
695
+ }
649
696
  const cont = await follow(ctx, root.anchor, qv);
650
697
  if (cont !== null && cont.length > 0 &&
651
698
  // The law's positional reading: the caller knows the material it is
@@ -26,8 +26,9 @@ export declare function joinWithBridge(ctx: MindContext, left: Uint8Array, right
26
26
  * Shakespeare" (id 676) and the pivot hopped through "speare" (id 606, not
27
27
  * in `consumed`) straight into that analog's own biography, which is exactly
28
28
  * what the comparison had refused to voice. The rule is CONTAINMENT, not
29
- * overlap, so C3's genuine further hop — "Mona Lisa", a term inside the seat
30
- * sentence but part of NEITHER analog — still fires. */
29
+ * overlap, so C3's further term — "Mona Lisa", inside the seat sentence but
30
+ * part of NEITHER analog — stays a candidate; whether the walk steps through
31
+ * it is the naming rule's decision (reasoning.ts, evidence.md). */
31
32
  export declare function pivotInto(ctx: MindContext, answer: Uint8Array, consumed: ReadonlySet<number>, voiced?: readonly Uint8Array[]): Promise<number | null>;
32
33
  export declare function meaningOf(ctx: MindContext, bytes: Uint8Array, anchors: ReadonlyArray<{
33
34
  name: string;
@@ -236,8 +236,9 @@ export async function joinWithBridge(ctx, left, right) {
236
236
  * Shakespeare" (id 676) and the pivot hopped through "speare" (id 606, not
237
237
  * in `consumed`) straight into that analog's own biography, which is exactly
238
238
  * what the comparison had refused to voice. The rule is CONTAINMENT, not
239
- * overlap, so C3's genuine further hop — "Mona Lisa", a term inside the seat
240
- * sentence but part of NEITHER analog — still fires. */
239
+ * overlap, so C3's further term — "Mona Lisa", inside the seat sentence but
240
+ * part of NEITHER analog — stays a candidate; whether the walk steps through
241
+ * it is the naming rule's decision (reasoning.ts, evidence.md). */
241
242
  export async function pivotInto(ctx, answer, consumed, voiced = []) {
242
243
  // The pivot's OWN shortlist capacity — not `recallQueryK`: they are different
243
244
  // quantities (a mechanical sweep's probe budget vs the bridge's candidate-read
@@ -1,5 +1,6 @@
1
1
  import { Vec } from "../vec.js";
2
2
  import type { AncestorReach, MindContext } from "./types.js";
3
+ import { type WindowIndex } from "./evidence.js";
3
4
  /** The reach memo this ask should use — see the note above.
4
5
  *
5
6
  * A TRACED response always gets a fresh, empty one. `AncestorReach`'s
@@ -140,8 +141,10 @@ export declare function argmaxCosine<T>(query: Vec, items: Iterable<T>, vecOf: (
140
141
  * formRules all share. undefined when the node has no continuation. */
141
142
  export declare function guidedFirst(ctx: MindContext, id: number): number | undefined;
142
143
  export declare function guidedNext(ctx: MindContext, node: number): number | undefined;
143
- /** Disambiguate among a node's learnt continuations by distributional
144
- * support. NOTE the `guide` contract: its VALUE is deliberately unused —
144
+ /** Disambiguate among a node's learnt continuations: first by the question's
145
+ * own witness of an establishing context (the exact tier, see
146
+ * {@link askedContinuations}), then by distributional support. NOTE the
147
+ * `guide` contract: its VALUE is deliberately unused —
145
148
  * only its PRESENCE gates disambiguation (a null guide means no query is in
146
149
  * flight, so structural walkers keep plain first-edge behaviour). The
147
150
  * gist-cosine of short answer candidates against a query guide is dominated
@@ -153,6 +156,78 @@ export declare function guidedNext(ctx: MindContext, node: number): number | und
153
156
  * therefore scores by guide cosine. The two directions consult different
154
157
  * halves of the evidence on purpose. */
155
158
  export declare function chooseNext(ctx: MindContext, id: number, guide?: Vec | null): number | undefined;
159
+ /** The response canonicalizer's reading of `bytes` when it keeps every offset
160
+ * — so a window found in the canonical bytes sits at the same place in the
161
+ * asker's — else the bytes themselves. Text canon is offset-preserving on
162
+ * ASCII without interior whitespace runs; where it is not, the raw bytes are
163
+ * read and a case-variant window simply does not match. */
164
+ export declare function offsetCanon(ctx: MindContext, bytes: Uint8Array): Uint8Array;
165
+ /** A FRAGMENT ANSWERS OTHER QUESTIONS. A recognised form that sits inside
166
+ * other forms (it has structural parents or containers) holds continuations
167
+ * because the forms it is a piece of were asked — suffix inheritance gives
168
+ * `f death` the answer of every `… place of death` question, and `director`
169
+ * the answer of every `… director` one. Choosing one of several such
170
+ * continuations by popularity voices some other question's answer. A
171
+ * fragment with several continuations leads somewhere FOR THIS QUESTION only
172
+ * when the question names one (the exact tier below). A form that is
173
+ * (nearly) the whole question is not a piece of it: the question says
174
+ * nothing beyond it, so its continuations answer THIS question. Read by
175
+ * every mechanism that projects through a recognised site (cover's sites,
176
+ * recall's argument binding). */
177
+ export declare function answersOtherQuestions(ctx: MindContext, id: number, queryLen: number, siteLen: number): boolean;
178
+ /** The continuations of `id` that `asked` NAMES (see {@link
179
+ * askedContinuations}) — for a caller holding material other than the whole
180
+ * question: the multi-hop walk asks with what of the question no product has
181
+ * restated yet. null when none is named. */
182
+ export declare function namedContinuations(ctx: MindContext, id: number, asked: {
183
+ bytes: Uint8Array;
184
+ index: WindowIndex;
185
+ }): number[] | null;
186
+ /** The question spans that NAMED `pick` among `id`'s continuations — the
187
+ * evidence a projection through that pick stands on, so a mechanism can
188
+ * account for what the question said about it (mechanism-market.md:
189
+ * evidence travels). Empty when the question names no continuation of `id`
190
+ * or names others. */
191
+ export declare function askedEvidence(ctx: MindContext, id: number, pick: number): Array<[number, number]>;
192
+ /** The climb's points the question HOLDS under the response's equivalence —
193
+ * stored forms whose canonical bytes occur in the question's, as sites. The
194
+ * recognition walk matches bytes and the fold's own boundaries, so a stored
195
+ * `Man at Bath` inside `… of film Man At Bath work at?` is no site; the
196
+ * consensus climb reaches it through the windows the two spellings share, and
197
+ * containment under the canon (offset-preserving, so the span is the
198
+ * question's own) decides. Approximate proposes, exact decides. Read off
199
+ * the `chainReach(W)` most corroborated points; empty before the climb. */
200
+ export declare function canonHeldPoints(ctx: MindContext, minLen: number): Array<{
201
+ start: number;
202
+ end: number;
203
+ payload: number;
204
+ }>;
205
+ /** A CO-INSTANCE of the question: a stored form that shares the question's
206
+ * FRAME — the same opening and the same close, byte for byte under the
207
+ * response's equivalence — around ONE different filler. `Where was Peter
208
+ * Jackson born?` against `Where was the director of film Beat Girl born?`
209
+ * shares `Where was ` and ` born?`, and leaves `Peter Jackson` against `the
210
+ * director of film Beat Girl`: another instance of the same question, never
211
+ * this one. It is the ordered limit of witnessing: a frame is not a bag of
212
+ * windows (an order-free reading lets `Lyon is a city in France` pass for an
213
+ * instance of `what if the capital of France were Lyon?`, which NAMES Lyon;
214
+ * and a coincidental window inside a filler splits it).
215
+ *
216
+ * The frame must reach one window, every window inside it must be held by
217
+ * the material (so on the walk, a frame a product already said cannot name a
218
+ * second step), and the form's filler must be a thing the corpus knows
219
+ * (below) — a record that differs from the question only inside the frame
220
+ * by a description (`converts sunlight into chemical energy` against
221
+ * `works`) is the same question about the frame's own subject. (Requiring
222
+ * the two fillers to share no window as well was measured redundant with
223
+ * this and cost two answers on the 2Wiki fixture.) Returns the form's filler span in `raw` and the
224
+ * question spans of the frame, or null. One reading for every consumer: the
225
+ * exact tier transfers the relation through it, and the readers that would
226
+ * VOICE such a form's own continuation refuse it. */
227
+ export declare function coInstanceFiller(ctx: MindContext, raw: Uint8Array, indexes: ReadonlyArray<WindowIndex>, question: Uint8Array): {
228
+ span: [number, number];
229
+ spans: Array<[number, number]>;
230
+ } | null;
156
231
  /** The perceived gist of a candidate node, through the session gist cache.
157
232
  * Re-gisting a candidate is a full river fold of its bytes — the measured
158
233
  * recall bottleneck (a hub context offers up to √N continuations, EACH
@@ -198,6 +273,23 @@ export declare function chooseAmong(ctx: MindContext, candidates: readonly numbe
198
273
  * NOT scaffolding-only — it has no evidence either way, and its callers already
199
274
  * refuse it on their own terms. */
200
275
  export declare function allWindowsAreScaffolding(ctx: MindContext, query: Uint8Array): boolean;
276
+ /** Per offset of `bytes`: 1 when the W-window there is a stored form contained
277
+ * in more than √N places (corpus-global scaffolding; see the floor below),
278
+ * else 0. Memoised per
279
+ * byte array for the life of the store's read-only response. */
280
+ export declare function hubWindows(ctx: MindContext, bytes: Uint8Array): Uint8Array;
281
+ /** The query's SCAFFOLDING CORE, as spans: the bytes every W-window over which
282
+ * is a hub (see {@link hubWindows}) — what is nothing but frame, where
283
+ * {@link scaffoldExtents} is what a frame window reaches. */
284
+ export declare function scaffoldSpans(ctx: MindContext, query: Uint8Array): Array<[number, number]>;
285
+ /** The EXTENTS of the query's SCAFFOLDING windows, merged: every byte some
286
+ * W-window reaches that is a stored form contained in more than √N places —
287
+ * corpus-global commonality (commonality.md), the same "hub" reading as
288
+ * {@link allWindowsAreScaffolding} and the bridge's `explainedSpan`. A window
289
+ * the store never saw is NOT scaffolding. The extent, not the core, is what
290
+ * a coverage test needs: a span that still holds one hub window can be
291
+ * "carried" by any fact that holds that window. */
292
+ export declare function scaffoldExtents(ctx: MindContext, query: Uint8Array): Array<[number, number]>;
201
293
  /** Trained forms the query may OPEN, proposed from the write side's own
202
294
  * leaf-id window index — the supply of last resort for prefix completion.
203
295
  *