@hviana/sema 0.8.1 → 0.8.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 (114) hide show
  1. package/AGENTS.md +29 -29
  2. package/TRADEMARKS.md +0 -1
  3. package/dist/src/config.d.ts +28 -0
  4. package/dist/src/config.js +20 -0
  5. package/dist/src/geometry.d.ts +21 -0
  6. package/dist/src/geometry.js +21 -0
  7. package/dist/src/meter.d.ts +76 -0
  8. package/dist/src/meter.js +95 -0
  9. package/dist/src/mind/attention.d.ts +4 -0
  10. package/dist/src/mind/attention.js +165 -16
  11. package/dist/src/mind/canonical.d.ts +16 -0
  12. package/dist/src/mind/canonical.js +41 -0
  13. package/dist/src/mind/corpus.d.ts +40 -0
  14. package/dist/src/mind/corpus.js +149 -0
  15. package/dist/src/mind/graph-search.d.ts +7 -0
  16. package/dist/src/mind/graph-search.js +254 -24
  17. package/dist/src/mind/index.d.ts +3 -1
  18. package/dist/src/mind/index.js +1 -0
  19. package/dist/src/mind/match.d.ts +9 -4
  20. package/dist/src/mind/match.js +147 -61
  21. package/dist/src/mind/mechanisms/cast.js +19 -3
  22. package/dist/src/mind/mechanisms/confluence.js +24 -0
  23. package/dist/src/mind/mechanisms/cover.js +6 -0
  24. package/dist/src/mind/mechanisms/recall.js +32 -4
  25. package/dist/src/mind/mind.d.ts +57 -0
  26. package/dist/src/mind/mind.js +72 -1
  27. package/dist/src/mind/pipeline-mechanism.d.ts +7 -0
  28. package/dist/src/mind/pipeline.js +66 -20
  29. package/dist/src/mind/primitives.js +9 -1
  30. package/dist/src/mind/rationale.d.ts +28 -1
  31. package/dist/src/mind/rationale.js +22 -1
  32. package/dist/src/mind/reasoning.d.ts +25 -3
  33. package/dist/src/mind/reasoning.js +125 -20
  34. package/dist/src/mind/recognition.js +4 -8
  35. package/dist/src/mind/resonance.js +20 -1
  36. package/dist/src/mind/trace.js +1 -0
  37. package/dist/src/mind/traverse.js +15 -3
  38. package/dist/src/mind/types.d.ts +49 -4
  39. package/docs/INVARIANTS.md +2 -2
  40. package/docs/architecture/bounded-reads.md +1 -1
  41. package/docs/architecture/commonality.md +2 -2
  42. package/docs/architecture/cost-model.md +2 -2
  43. package/docs/architecture/determinism.md +7 -7
  44. package/docs/architecture/match-project.md +2 -3
  45. package/docs/architecture/mechanism-market.md +10 -10
  46. package/docs/architecture/meter.md +5 -5
  47. package/docs/architecture/store.md +3 -3
  48. package/docs/failures/tempting-but-wrong.md +34 -6
  49. package/docs/harness/gates.md +2 -2
  50. package/docs/mechanisms/cast.md +2 -2
  51. package/docs/mechanisms/cover.md +2 -3
  52. package/docs/mechanisms/extraction.md +7 -7
  53. package/docs/mechanisms/recall.md +8 -9
  54. package/jsr.json +1 -1
  55. package/package.json +1 -1
  56. package/src/alu/README.md +11 -12
  57. package/src/config.ts +48 -0
  58. package/src/geometry.ts +21 -0
  59. package/src/meter.ts +98 -0
  60. package/src/mind/attention.ts +167 -16
  61. package/src/mind/canonical.ts +43 -0
  62. package/src/mind/corpus.ts +202 -0
  63. package/src/mind/graph-search.ts +277 -23
  64. package/src/mind/index.ts +8 -1
  65. package/src/mind/match.ts +148 -57
  66. package/src/mind/mechanisms/cast.ts +20 -2
  67. package/src/mind/mechanisms/confluence.ts +24 -0
  68. package/src/mind/mechanisms/cover.ts +5 -0
  69. package/src/mind/mechanisms/recall.ts +32 -4
  70. package/src/mind/mind.ts +125 -0
  71. package/src/mind/pipeline-mechanism.ts +7 -0
  72. package/src/mind/pipeline.ts +79 -22
  73. package/src/mind/primitives.ts +9 -1
  74. package/src/mind/rationale.ts +35 -1
  75. package/src/mind/reasoning.ts +145 -13
  76. package/src/mind/recognition.ts +4 -8
  77. package/src/mind/resonance.ts +19 -1
  78. package/src/mind/trace.ts +1 -0
  79. package/src/mind/traverse.ts +16 -6
  80. package/src/mind/types.ts +53 -4
  81. package/test/100-complete-grounding-trace.test.mjs +109 -0
  82. package/test/101-alignment-gap-bound.test.mjs +106 -0
  83. package/test/102-production-composes-at-scale.test.mjs +110 -0
  84. package/test/103-alignment-gap-budget.test.mjs +89 -0
  85. package/test/104-composition-is-reported.test.mjs +90 -0
  86. package/test/105-derive-through-reports-its-refusal.test.mjs +137 -0
  87. package/test/106-the-join-fires.test.mjs +94 -0
  88. package/test/107-the-join-is-counted.test.mjs +81 -0
  89. package/test/108-the-join-chains.test.mjs +78 -0
  90. package/test/109-the-pivot-is-counted.test.mjs +60 -0
  91. package/test/110-the-reasoner-stops-when-the-question-is-answered.test.mjs +91 -0
  92. package/test/111-the-cover-assembly-is-counted.test.mjs +74 -0
  93. package/test/112-the-exploration-does-not-grow-with-the-hub.test.mjs +89 -0
  94. package/test/113-the-rationale-payload-is-bounded.test.mjs +84 -0
  95. package/test/114-alignment-budget-is-per-sweep.test.mjs +93 -0
  96. package/test/116-the-extension-is-gated-by-the-pipelines-own-remainder.test.mjs +100 -0
  97. package/test/117-corpus-search.test.mjs +171 -0
  98. package/test/118-the-join-reaches-a-key-off-the-cut.test.mjs +74 -0
  99. package/test/119-the-work-does-not-grow-with-the-corpus.test.mjs +122 -0
  100. package/test/120-composition-is-consequence.test.mjs +132 -0
  101. package/test/121-the-extension-does-not-grow-with-the-corpus.test.mjs +128 -0
  102. package/test/122-the-climb-search-does-not-grow-with-the-corpus.test.mjs +117 -0
  103. package/test/123-the-paired-formulas-agree.test.mjs +90 -0
  104. package/test/125-the-post-grounding-branch-publishes-its-operand.test.mjs +51 -0
  105. package/test/126-the-pipeline-does-not-name-mechanisms.test.mjs +42 -0
  106. package/test/128-the-leads-somewhere-pair-agrees.test.mjs +83 -0
  107. package/test/129-the-trace-payload-shape.test.mjs +164 -0
  108. package/test/14-scaling.test.mjs +10 -7
  109. package/test/32-confluence.test.mjs +68 -0
  110. package/test/38-reason-restate-guard.test.mjs +8 -2
  111. package/test/43-cast-analog-seat.test.mjs +10 -0
  112. package/test/55-cost-meter.test.mjs +859 -0
  113. package/test/76-reference-binding.test.mjs +6 -1
  114. package/test/89-completion-recursion.test.mjs +30 -5
@@ -144,7 +144,12 @@ test("the frame inventory REPORTS without judging", async () => {
144
144
  "the country where the Eiffel Tower is",
145
145
  );
146
146
  assert.equal(clean(inst.slots[0].filler), "France");
147
- assert.equal(inst.covered, 23, "coverage must be reported, not judged");
147
+ // 24, not 23: the alignment's gap bound is the PAIR's extent now (budgeted),
148
+ // so the frame's constant run is no longer cut one byte short by
149
+ // chainReach(W). The contract this test pins — REPORT without judging — is
150
+ // untouched: the substitution is still reported (and still refused by
151
+ // `voiceable` below).
152
+ assert.equal(inst.covered, 24, "coverage must be reported, not judged");
148
153
 
149
154
  // 2. An INSERTION — a real variation, and not a slot anything can carry.
150
155
  const ins = frameSlots(
@@ -206,12 +206,37 @@ test("completion recursion: per-query work does not grow with the corpus", async
206
206
  // NO OUTPUT CONFOUND. Work is allowed to grow with the ANSWER. Pinning the
207
207
  // answer byte-for-byte across every size removes that defence entirely: any
208
208
  // growth measured below bought exactly nothing.
209
+ // NO OUTPUT CONFOUND — WITHOUT DEMANDING A CONSTANT ANSWER.
210
+ //
211
+ // This used to require a byte-identical answer across corpus sizes, on the
212
+ // reasoning that with the output moving, any work growth would stop being
213
+ // attributable to the corpus. That was true only while an offer cap froze
214
+ // what a hop could reach: with the cap gone the offer follows the corpus, and
215
+ // a bigger corpus legitimately licenses a different — here CHEAPER —
216
+ // derivation. Measured at the three sizes: the answer moved at the largest
217
+ // (34 B → 34 B → 41 B) while the work did NOT (searches 2/2/2, pops
218
+ // 428/430/384, falling). So the confound worth defending against is not
219
+ // "the answer moved" but "the work grew because the answer grew", and that is
220
+ // removed by dividing the work by the answer it produced — the reading the
221
+ // comment below already allows ("Work is allowed to grow with the ANSWER").
222
+ // The two raw bars below stay exactly as they were; this only ADDS a bar.
223
+ // BYTES, not UTF-16 code units: this law is priced per byte (PASS/byte,
224
+ // bounded-reads.md), so the denominator is the answer's own byte length even
225
+ // though respondText hands back a string.
226
+ const answerBytes = answers.map((a) => new TextEncoder().encode(a).length);
227
+ const perByte = pops.map((p, i) => p / Math.max(1, answerBytes[i]));
228
+ const kPerByte = logLogSlope(SIZES, perByte);
229
+ console.log(
230
+ ` answer-normalised pops/byte: ${
231
+ perByte.map((v) => v.toFixed(2)).join(" → ")
232
+ } · k ≈ ${kPerByte.toFixed(2)}`,
233
+ );
209
234
  assert.ok(
210
- answers.every((a) => a === answers[0]),
211
- `the answer changed across corpus sizes (${
212
- JSON.stringify(answers.map((a) => a.slice(0, 40)))
213
- }) — with the output moving, work growth is no longer attributable to the ` +
214
- `corpus alone`,
235
+ kPerByte < 1,
236
+ `answer-normalised work grew with exponent k=${kPerByte.toFixed(2)} in ` +
237
+ `corpus size — dividing by the answer's own length already removes the ` +
238
+ `output confound, so growth beyond that is work the answer never asked ` +
239
+ `for (bounded-reads.md)`,
215
240
  );
216
241
 
217
242
  const kSearches = logLogSlope(SIZES, searches);