@hviana/sema 0.9.0 → 0.9.2

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 (118) hide show
  1. package/AGENTS.md +7 -7
  2. package/dist/src/alu/src/index.d.ts +1 -1
  3. package/dist/src/alu/src/index.js +1 -1
  4. package/dist/src/alu/src/parser.js +2 -6
  5. package/dist/src/alu/src/resonance.d.ts +13 -0
  6. package/dist/src/alu/src/resonance.js +41 -0
  7. package/dist/src/alu/test/alu.test.js +39 -0
  8. package/dist/src/bytes.d.ts +6 -2
  9. package/dist/src/bytes.js +10 -4
  10. package/dist/src/canon.js +44 -0
  11. package/dist/src/geometry.d.ts +19 -1
  12. package/dist/src/geometry.js +125 -141
  13. package/dist/src/meter.d.ts +33 -0
  14. package/dist/src/meter.js +34 -1
  15. package/dist/src/mind/articulation.js +14 -1
  16. package/dist/src/mind/attention.d.ts +12 -0
  17. package/dist/src/mind/attention.js +44 -16
  18. package/dist/src/mind/bridge.js +3 -3
  19. package/dist/src/mind/derivation.d.ts +40 -0
  20. package/dist/src/mind/derivation.js +34 -0
  21. package/dist/src/mind/evidence.d.ts +24 -0
  22. package/dist/src/mind/evidence.js +90 -0
  23. package/dist/src/mind/graph-search.d.ts +89 -15
  24. package/dist/src/mind/graph-search.js +345 -174
  25. package/dist/src/mind/learning.js +1 -1
  26. package/dist/src/mind/mechanisms/cover.d.ts +19 -3
  27. package/dist/src/mind/mechanisms/cover.js +142 -61
  28. package/dist/src/mind/mechanisms/recall.js +10 -3
  29. package/dist/src/mind/mind.d.ts +6 -0
  30. package/dist/src/mind/mind.js +5 -2
  31. package/dist/src/mind/pipeline.d.ts +5 -1
  32. package/dist/src/mind/pipeline.js +220 -90
  33. package/dist/src/mind/primitives.d.ts +25 -5
  34. package/dist/src/mind/primitives.js +107 -44
  35. package/dist/src/mind/reasoning.d.ts +18 -4
  36. package/dist/src/mind/reasoning.js +487 -328
  37. package/dist/src/mind/recognition.js +29 -13
  38. package/dist/src/mind/resonance.js +1 -11
  39. package/dist/src/mind/traverse.d.ts +45 -5
  40. package/dist/src/mind/traverse.js +285 -8
  41. package/dist/src/mind/types.d.ts +16 -1
  42. package/dist/src/store-sqlite.d.ts +25 -0
  43. package/dist/src/store-sqlite.js +89 -1
  44. package/dist/src/store.d.ts +48 -4
  45. package/dist/src/store.js +86 -6
  46. package/docs/INDEX.md +20 -19
  47. package/docs/INVARIANTS.md +17 -16
  48. package/docs/architecture/bounded-reads.md +1 -1
  49. package/docs/architecture/caches.md +5 -4
  50. package/docs/architecture/closure.md +45 -5
  51. package/docs/architecture/cost-model.md +16 -0
  52. package/docs/architecture/evidence.md +113 -0
  53. package/docs/architecture/exact-vs-approximate.md +10 -9
  54. package/docs/architecture/factored-machinery.md +14 -13
  55. package/docs/architecture/fold-contract.md +51 -1
  56. package/docs/architecture/mechanism-market.md +21 -0
  57. package/docs/architecture/memoization.md +3 -3
  58. package/docs/architecture/meter.md +2 -1
  59. package/docs/architecture/saturation.md +12 -0
  60. package/docs/architecture/store.md +25 -2
  61. package/docs/failures/tempting-but-wrong.md +13 -2
  62. package/docs/harness/gates.md +12 -10
  63. package/docs/mechanisms/cover.md +23 -6
  64. package/jsr.json +1 -1
  65. package/package.json +1 -1
  66. package/src/alu/README.md +10 -2
  67. package/src/alu/src/index.ts +1 -0
  68. package/src/alu/src/parser.ts +6 -6
  69. package/src/alu/src/resonance.ts +42 -0
  70. package/src/alu/test/alu.test.ts +40 -0
  71. package/src/bytes.ts +13 -3
  72. package/src/canon.ts +40 -0
  73. package/src/geometry.ts +183 -154
  74. package/src/meter.ts +34 -1
  75. package/src/mind/articulation.ts +14 -2
  76. package/src/mind/attention.ts +47 -25
  77. package/src/mind/bridge.ts +3 -3
  78. package/src/mind/derivation.ts +77 -0
  79. package/src/mind/evidence.ts +107 -0
  80. package/src/mind/graph-search.ts +449 -221
  81. package/src/mind/learning.ts +1 -7
  82. package/src/mind/match.ts +1 -2
  83. package/src/mind/mechanisms/cast.ts +1 -2
  84. package/src/mind/mechanisms/cover.ts +207 -87
  85. package/src/mind/mechanisms/extraction.ts +1 -2
  86. package/src/mind/mechanisms/prefix-completion.ts +1 -1
  87. package/src/mind/mechanisms/recall.ts +17 -5
  88. package/src/mind/mechanisms/reference.ts +1 -1
  89. package/src/mind/mind.ts +9 -30
  90. package/src/mind/pipeline.ts +263 -104
  91. package/src/mind/primitives.ts +119 -43
  92. package/src/mind/reasoning.ts +611 -419
  93. package/src/mind/recognition.ts +24 -9
  94. package/src/mind/resonance.ts +2 -16
  95. package/src/mind/trace.ts +1 -1
  96. package/src/mind/traverse.ts +321 -8
  97. package/src/mind/types.ts +15 -11
  98. package/src/store-sqlite.ts +92 -1
  99. package/src/store.ts +113 -7
  100. package/test/105-derive-through-reports-its-refusal.test.mjs +8 -5
  101. package/test/106-the-join-fires.test.mjs +21 -0
  102. package/test/111-the-cover-assembly-is-counted.test.mjs +8 -5
  103. package/test/128-the-leads-somewhere-pair-agrees.test.mjs +18 -12
  104. package/test/136-the-two-named-limits.test.mjs +3 -2
  105. package/test/137-the-law-lives-once-and-below.test.mjs +21 -0
  106. package/test/148-exact-shortcuts-agree.test.mjs +188 -0
  107. package/test/149-the-closure-engine.test.mjs +138 -0
  108. package/test/150-the-join-is-output-sensitive.test.mjs +66 -0
  109. package/test/151-the-cover-pays-for-what-it-reaches.test.mjs +142 -0
  110. package/test/152-the-read-side-names-as-the-write-side.test.mjs +146 -0
  111. package/test/153-a-cheaper-bound-is-looked-at-first.test.mjs +155 -0
  112. package/test/154-the-question-names-the-step.test.mjs +281 -0
  113. package/test/24-generalization.test.mjs +32 -0
  114. package/test/36-bloom.test.mjs +53 -0
  115. package/test/37-cluster-dispersion-fusion.test.mjs +75 -0
  116. package/test/48-recognise-turn-connective.test.mjs +3 -2
  117. package/test/55-cost-meter.test.mjs +4 -4
  118. package/test/90-connector-read-cap.test.mjs +7 -7
@@ -1,7 +1,7 @@
1
1
  // 90-connector-read-cap.test.mjs — the "already answered" probe must read by
2
2
  // the QUERY, not by the corpus.
3
3
  //
4
- // `resolveConnectors` (src/mind/mechanisms/cover.ts) drops a site whose
4
+ // `offerConnectors` (src/mind/mechanisms/cover.ts) drops a site whose
5
5
  // continuation already appears elsewhere in the query — stale transcript
6
6
  // evidence, whose bridges would only be discarded later. The test is a
7
7
  // substring search, so it needs the candidate's bytes; it used to reconstruct
@@ -28,7 +28,7 @@
28
28
  // B reconstructed against a 3-byte prompt. So the invariant here is per-read
29
29
  // SIZE.
30
30
  //
31
- // It is measured by calling `resolveConnectors` DIRECTLY and diffing the meter
31
+ // It is measured by calling `offerConnectors` DIRECTLY and diffing the meter
32
32
  // across it. A whole-response counter cannot express this: `bytesRead` sums
33
33
  // every reader in the pipeline, and the answer itself is a long continuation
34
34
  // that is legitimately read in full — an earlier draft of this file asserted on
@@ -46,7 +46,7 @@ import { test } from "node:test";
46
46
  import assert from "node:assert/strict";
47
47
  import { Mind } from "../dist/src/index.js";
48
48
  import { SQliteStore } from "../dist/src/store-sqlite.js";
49
- import { resolveConnectors } from "../dist/src/mind/mechanisms/cover.js";
49
+ import { offerConnectors } from "../dist/src/mind/mechanisms/cover.js";
50
50
 
51
51
  /** Learnt CONTINUATIONS far longer than the query that will be asked — the
52
52
  * shape the cap governs: an uncapped probe reconstructs each one in full
@@ -80,7 +80,7 @@ test("connector probe reads by the query, not by the learnt continuation", async
80
80
  mind.beginResponse();
81
81
  try {
82
82
  const { sites } = mind.recogniseSpan(bytes);
83
- // EXACT ISOLATION. resolveConnectors also reads bytes the probe has
83
+ // EXACT ISOLATION. offerConnectors also reads bytes the probe has
84
84
  // nothing to do with (the n-ary bridge reads each ordered node in full, and
85
85
  // legitimately so). The probe itself early-returns when answeredSpans is
86
86
  // empty, so running the SAME call both ways and differencing leaves exactly
@@ -88,12 +88,12 @@ test("connector probe reads by the query, not by the learnt continuation", async
88
88
  const m = mind.meter;
89
89
  mind.answeredSpans = [];
90
90
  const a0 = m.byteReads, b0 = m.bytesRead;
91
- await resolveConnectors(mind, sites, bytes);
91
+ offerConnectors(mind, sites, bytes);
92
92
  const baseReads = m.byteReads - a0, baseBytes = m.bytesRead - b0;
93
93
 
94
94
  mind.answeredSpans = [[0, 1]];
95
95
  const a1 = m.byteReads, b1 = m.bytesRead;
96
- await resolveConnectors(mind, sites, bytes);
96
+ offerConnectors(mind, sites, bytes);
97
97
  const reads = (m.byteReads - a1) - baseReads;
98
98
  const read = (m.bytesRead - b1) - baseBytes;
99
99
 
@@ -107,7 +107,7 @@ test("connector probe reads by the query, not by the learnt continuation", async
107
107
  // below is trivially true and proves nothing.
108
108
  assert.ok(
109
109
  reads > 0,
110
- `resolveConnectors made no byte reads — the probe never ran (sites=${sites.length}), ` +
110
+ `offerConnectors made no byte reads — the probe never ran (sites=${sites.length}), ` +
111
111
  `so this file is not testing anything`,
112
112
  );
113
113