@jam-overture/loom 0.2.0 → 0.3.0

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 (194) hide show
  1. package/dist/audience/compose.d.ts +112 -0
  2. package/dist/audience/compose.js +134 -0
  3. package/dist/audience/memory.d.ts +14 -0
  4. package/dist/audience/memory.js +71 -0
  5. package/dist/audience/overlay-store.d.ts +343 -0
  6. package/dist/audience/overlay-store.js +217 -0
  7. package/dist/audience/rule.d.ts +121 -0
  8. package/dist/audience/rule.js +78 -0
  9. package/dist/cli/index.d.ts +3 -4
  10. package/dist/cli/index.js +3 -4
  11. package/dist/data/adapter.d.ts +9 -1
  12. package/dist/data/adapter.js +2 -0
  13. package/dist/data/resolve.d.ts +1 -1
  14. package/dist/interpretation/anthropic.d.ts +1 -1
  15. package/dist/interpretation/anthropic.js +2 -22
  16. package/dist/interpretation/client.d.ts +1 -1
  17. package/dist/interpretation/materialize.js +67 -22
  18. package/dist/interpretation/openai-compatible.d.ts +36 -0
  19. package/dist/interpretation/openai-compatible.js +79 -0
  20. package/dist/interpretation/status.d.ts +19 -0
  21. package/dist/interpretation/status.js +26 -0
  22. package/dist/live/index.d.ts +73 -0
  23. package/dist/live/index.js +73 -0
  24. package/dist/live/pages.d.ts +187 -0
  25. package/dist/live/pages.js +161 -0
  26. package/dist/live/pull.d.ts +147 -0
  27. package/dist/live/pull.js +398 -0
  28. package/dist/live/pulling.d.ts +79 -0
  29. package/dist/live/pulling.js +117 -0
  30. package/dist/live/window.d.ts +129 -0
  31. package/dist/live/window.js +132 -0
  32. package/dist/render/addressed.d.ts +35 -0
  33. package/dist/render/addressed.js +79 -0
  34. package/dist/render/document-theme.d.ts +70 -0
  35. package/dist/render/document-theme.js +139 -0
  36. package/dist/render/editable.d.ts +15 -1
  37. package/dist/render/editable.js +13 -1
  38. package/dist/render/expected.d.ts +98 -0
  39. package/dist/render/expected.js +88 -0
  40. package/dist/render/index.d.ts +2 -0
  41. package/dist/render/index.js +2 -0
  42. package/dist/render/render.d.ts +11 -0
  43. package/dist/render/render.js +192 -46
  44. package/dist/render/request.d.ts +8 -1
  45. package/dist/render/request.js +1 -0
  46. package/dist/runtime/auto-apply-ceiling.d.ts +54 -0
  47. package/dist/runtime/auto-apply-ceiling.js +66 -0
  48. package/dist/runtime/gate.js +69 -10
  49. package/dist/runtime/index.d.ts +1 -0
  50. package/dist/runtime/index.js +1 -0
  51. package/dist/runtime/nesting.d.ts +13 -1
  52. package/dist/runtime/nesting.js +41 -24
  53. package/dist/runtime/policy-change.js +8 -2
  54. package/dist/runtime/policy-log.d.ts +5 -5
  55. package/dist/runtime/policy.d.ts +8 -6
  56. package/dist/runtime/policy.js +5 -2
  57. package/dist/runtime/repointing.js +0 -0
  58. package/dist/sdk/definition.d.ts +65 -6
  59. package/dist/sdk/definition.js +44 -0
  60. package/dist/sdk/registry.d.ts +17 -1
  61. package/dist/sdk/registry.js +39 -0
  62. package/dist/signals/acted.contract.d.ts +21 -0
  63. package/dist/signals/acted.contract.js +236 -0
  64. package/dist/signals/acted.d.ts +359 -0
  65. package/dist/signals/acted.js +135 -0
  66. package/dist/signals/agenda.d.ts +585 -0
  67. package/dist/signals/agenda.js +295 -0
  68. package/dist/signals/arrivals.contract.d.ts +21 -0
  69. package/dist/signals/arrivals.contract.js +180 -0
  70. package/dist/signals/arrivals.d.ts +375 -0
  71. package/dist/signals/arrivals.js +254 -0
  72. package/dist/signals/broadcast.d.ts +25 -15
  73. package/dist/signals/broadcast.js +209 -36
  74. package/dist/signals/collect.d.ts +137 -43
  75. package/dist/signals/collect.js +103 -36
  76. package/dist/signals/conversion.d.ts +348 -0
  77. package/dist/signals/conversion.js +235 -0
  78. package/dist/signals/correlated.contract.d.ts +24 -0
  79. package/dist/signals/correlated.contract.js +94 -0
  80. package/dist/signals/counters.d.ts +51 -0
  81. package/dist/signals/counters.js +58 -0
  82. package/dist/signals/deployment-change.d.ts +28 -4
  83. package/dist/signals/deployment-change.js +57 -16
  84. package/dist/signals/deployment.d.ts +18 -5
  85. package/dist/signals/deployment.js +37 -11
  86. package/dist/signals/door.d.ts +34 -12
  87. package/dist/signals/door.js +37 -13
  88. package/dist/signals/expire.d.ts +192 -0
  89. package/dist/signals/expire.js +213 -0
  90. package/dist/signals/frontier.d.ts +268 -0
  91. package/dist/signals/frontier.js +145 -0
  92. package/dist/signals/funnel-hours.contract.d.ts +21 -0
  93. package/dist/signals/funnel-hours.contract.js +221 -0
  94. package/dist/signals/funnel-hours.d.ts +293 -0
  95. package/dist/signals/funnel-hours.js +99 -0
  96. package/dist/signals/funnel.d.ts +60 -0
  97. package/dist/signals/funnel.js +35 -20
  98. package/dist/signals/health.d.ts +201 -4
  99. package/dist/signals/health.js +214 -2
  100. package/dist/signals/index.d.ts +19 -0
  101. package/dist/signals/index.js +19 -0
  102. package/dist/signals/inside.d.ts +190 -0
  103. package/dist/signals/inside.js +263 -0
  104. package/dist/signals/join.d.ts +56 -0
  105. package/dist/signals/join.js +60 -0
  106. package/dist/signals/journal.d.ts +112 -9
  107. package/dist/signals/kept.contract.d.ts +22 -0
  108. package/dist/signals/kept.contract.js +111 -0
  109. package/dist/signals/library-agenda-change.d.ts +324 -0
  110. package/dist/signals/library-agenda-change.js +199 -0
  111. package/dist/signals/library-agenda.d.ts +258 -0
  112. package/dist/signals/library-agenda.js +167 -0
  113. package/dist/signals/library-reach-change.d.ts +10 -0
  114. package/dist/signals/library-reach-change.js +11 -3
  115. package/dist/signals/library-senders-change.d.ts +457 -0
  116. package/dist/signals/library-senders-change.js +367 -0
  117. package/dist/signals/library-senders-reach-change.d.ts +486 -0
  118. package/dist/signals/library-senders-reach-change.js +538 -0
  119. package/dist/signals/library-senders-reach.d.ts +340 -0
  120. package/dist/signals/library-senders-reach.js +252 -0
  121. package/dist/signals/library-senders.d.ts +271 -0
  122. package/dist/signals/library-senders.js +180 -0
  123. package/dist/signals/library-word-reach-change.js +2 -6
  124. package/dist/signals/memory.js +142 -1
  125. package/dist/signals/migrate.d.ts +6 -5
  126. package/dist/signals/migrate.js +150 -6
  127. package/dist/signals/notice.d.ts +88 -33
  128. package/dist/signals/notice.js +38 -16
  129. package/dist/signals/part-pace.d.ts +378 -0
  130. package/dist/signals/part-pace.js +333 -0
  131. package/dist/signals/parts.d.ts +25 -15
  132. package/dist/signals/parts.js +32 -73
  133. package/dist/signals/postgres.js +400 -26
  134. package/dist/signals/region.d.ts +1 -1
  135. package/dist/signals/retention.d.ts +43 -21
  136. package/dist/signals/retention.js +25 -8
  137. package/dist/signals/rhythm.d.ts +302 -0
  138. package/dist/signals/rhythm.js +262 -0
  139. package/dist/signals/rollup.d.ts +127 -1
  140. package/dist/signals/rollup.js +211 -24
  141. package/dist/signals/schema.d.ts +640 -3
  142. package/dist/signals/schema.js +239 -3
  143. package/dist/signals/silences.d.ts +310 -11
  144. package/dist/signals/silences.js +243 -0
  145. package/dist/signals/subtrees.d.ts +123 -0
  146. package/dist/signals/subtrees.js +102 -0
  147. package/dist/signals/tally.d.ts +125 -4
  148. package/dist/signals/unread.d.ts +292 -0
  149. package/dist/signals/unread.js +137 -0
  150. package/dist/signals/window-agenda.d.ts +276 -0
  151. package/dist/signals/window-agenda.js +83 -0
  152. package/dist/signals/window-funnels.d.ts +88 -0
  153. package/dist/signals/window-funnels.js +47 -0
  154. package/dist/store/cache.d.ts +101 -0
  155. package/dist/store/cache.js +149 -0
  156. package/dist/store/history.d.ts +82 -0
  157. package/dist/store/history.js +36 -0
  158. package/dist/store/index.d.ts +11 -0
  159. package/dist/store/index.js +11 -0
  160. package/dist/store/migrate.d.ts +26 -0
  161. package/dist/store/migrate.js +64 -0
  162. package/dist/store/postgres-audience.d.ts +14 -0
  163. package/dist/store/postgres-audience.js +272 -0
  164. package/dist/store/postgres.d.ts +1 -0
  165. package/dist/store/postgres.js +1 -0
  166. package/dist/store/schema.d.ts +312 -0
  167. package/dist/store/schema.js +77 -0
  168. package/dist/store/source.d.ts +57 -1
  169. package/dist/store/source.js +65 -1
  170. package/dist/submit/resolve.d.ts +1 -1
  171. package/dist/telemetry/index.d.ts +1 -0
  172. package/dist/telemetry/index.js +1 -0
  173. package/dist/telemetry/journal.d.ts +32 -0
  174. package/dist/telemetry/memory.js +10 -1
  175. package/dist/telemetry/postgres.js +18 -2
  176. package/dist/telemetry/window.d.ts +135 -0
  177. package/dist/telemetry/window.js +101 -0
  178. package/dist/testing/audience-overlay-contract.d.ts +31 -0
  179. package/dist/testing/audience-overlay-contract.js +354 -0
  180. package/dist/testing/contracts.d.ts +1 -0
  181. package/dist/testing/contracts.js +1 -0
  182. package/dist/testing/journal-contract.js +158 -5
  183. package/dist/theme/contrast.d.ts +19 -14
  184. package/dist/theme/contrast.js +181 -17
  185. package/dist/tree/apply.js +13 -0
  186. package/dist/tree/mutation.d.ts +18 -0
  187. package/dist/tree/mutation.js +24 -12
  188. package/dist/tree/navigation.d.ts +5 -0
  189. package/dist/tree/navigation.js +32 -10
  190. package/dist/tree/outline.d.ts +7 -0
  191. package/dist/tree/outline.js +9 -5
  192. package/package.json +39 -96
  193. package/dist/runtime/inverse-interpreter.d.ts +0 -90
  194. package/dist/runtime/inverse-interpreter.js +0 -56
@@ -4,6 +4,7 @@ export const SILENCE_SUBJECTS = everyMemberOf()([
4
4
  "part",
5
5
  "comparison",
6
6
  "kind",
7
+ "series",
7
8
  ]);
8
9
  /** One line per subject, for a surface naming what a reason is about. */
9
10
  export const describeSilenceSubject = (subject) => {
@@ -16,11 +17,14 @@ export const describeSilenceSubject = (subject) => {
16
17
  return "the two readings together, neither side named";
17
18
  case "kind":
18
19
  return "one kind of part, everywhere it stands in the pages read";
20
+ case "series":
21
+ return "the run of hours that was read, whatever scope its counters were of";
19
22
  }
20
23
  };
21
24
  export const SILENCE_VOCABULARIES = everyMemberOf()([
22
25
  "action-change",
23
26
  "change",
27
+ "conversion",
24
28
  "copy",
25
29
  "copy-change",
26
30
  "deployment",
@@ -36,10 +40,15 @@ export const SILENCE_VOCABULARIES = everyMemberOf()([
36
40
  "library-pace",
37
41
  "library-reach",
38
42
  "library-reach-change",
43
+ "library-senders",
44
+ "library-senders-change",
45
+ "library-senders-reach",
46
+ "library-senders-reach-change",
39
47
  "library-word-reach-change",
40
48
  "pace",
41
49
  "pace-change",
42
50
  "reach",
51
+ "rhythm",
43
52
  ]);
44
53
  /**
45
54
  * What each reading's reasons are about.
@@ -52,6 +61,7 @@ export const SILENCE_VOCABULARIES = everyMemberOf()([
52
61
  export const SUBJECT_OF_VOCABULARY = Object.freeze({
53
62
  "action-change": "comparison",
54
63
  change: "comparison",
64
+ conversion: "page",
55
65
  copy: "page",
56
66
  "copy-change": "comparison",
57
67
  deployment: "page",
@@ -67,10 +77,15 @@ export const SUBJECT_OF_VOCABULARY = Object.freeze({
67
77
  "library-pace": "kind",
68
78
  "library-reach": "kind",
69
79
  "library-reach-change": "kind",
80
+ "library-senders": "kind",
81
+ "library-senders-change": "kind",
82
+ "library-senders-reach": "kind",
83
+ "library-senders-reach-change": "kind",
70
84
  "library-word-reach-change": "kind",
71
85
  pace: "part",
72
86
  "pace-change": "comparison",
73
87
  reach: "page",
88
+ rhythm: "series",
74
89
  });
75
90
  export const SILENCE_CONDITIONS = everyMemberOf()([
76
91
  "two-pages",
@@ -91,6 +106,12 @@ export const SILENCE_CONDITIONS = everyMemberOf()([
91
106
  "two-revisions",
92
107
  "one-population",
93
108
  "no-audience-named",
109
+ "questions-stale",
110
+ "no-reach-below",
111
+ "no-hour-counted",
112
+ "no-hour-settled",
113
+ "nothing-checkable",
114
+ "nothing-claimed",
94
115
  ]);
95
116
  /**
96
117
  * One line per condition, written so that it reads after the subject it is
@@ -138,6 +159,18 @@ export const describeSilenceCondition = (condition) => {
138
159
  return "both readings are of one audience, so there is no second population";
139
160
  case "no-audience-named":
140
161
  return "nothing recorded which audience it was of";
162
+ case "questions-stale":
163
+ return "every question it is asked names a part the page no longer has";
164
+ case "no-reach-below":
165
+ return "nothing below it reported being reached, so nothing it holds can witness it";
166
+ case "no-hour-counted":
167
+ return "no hour of it has ever been counted";
168
+ case "no-hour-settled":
169
+ return "it holds hours and not one of them is over yet";
170
+ case "nothing-checkable":
171
+ return "no place it holds in both readings could be checked in both of them";
172
+ case "nothing-claimed":
173
+ return "every place it could be compared at is unclaimed in one of the two readings";
141
174
  }
142
175
  };
143
176
  const meaning = (vocabulary, condition) => ({
@@ -526,6 +559,50 @@ export const meaningOfKindPaceSilence = (silence) => {
526
559
  return meaning("library-pace", "says-nothing");
527
560
  }
528
561
  };
562
+ /**
563
+ * What a comparison of two windows' senders reports, of one kind (0394, 0414).
564
+ *
565
+ * **Two conditions of its own, and both are about running out of places rather
566
+ * than out of readers** (0400). Its first two members are the pair every
567
+ * comparison keyed by the vocabulary reports: `unplaced` is the census's
568
+ * `nothing-of-the-kind`, and `unpaired` is `nothing-carried` said of a place,
569
+ * exactly as a comparison of two windows of one library says it (0266).
570
+ *
571
+ * The next three are the population being empty, and they are three conditions
572
+ * rather than one because they are three instructions. `unwitnessable` is
573
+ * answered by nothing at all — it is a fact about the library. `uncheckable` is
574
+ * answered by readers under the places on both sides. `unclaimable` is answered
575
+ * by a sender that reports what it did. A surface handed one in place of another
576
+ * sends a deployment to rewrite pages that are fine, to wait for a week of
577
+ * readers it has already had, or to go and look at a primitive that is working.
578
+ *
579
+ * **`unwitnessable` is the census's word and `nothing-inside` said of an
580
+ * intersection, which is new and is the clause worth reading twice** (0414).
581
+ * 0400 refused the structural condition for the coarse member and was right to:
582
+ * *there is nothing inside it* is false of a library full of parts and short of
583
+ * readers. The split makes it true of what it is now said about — a kind no
584
+ * paired place of which holds anything on **both** sides. A place that held
585
+ * parts and was emptied by the release is in it, and that is deliberate: being a
586
+ * leaf on either side is a fact about a tree, so no reading of either window
587
+ * could ever have checked the place in both, and the remedy is the pages rather
588
+ * than the readers. That is what separates it from `no-reach-below`, which 0400
589
+ * also refused here and which stays refused — that one is a **measurement** of
590
+ * one window, and whether it holds depends on which window is read.
591
+ */
592
+ export const meaningOfSenderFixSilence = (silence) => {
593
+ switch (silence) {
594
+ case "unplaced":
595
+ return meaning("library-senders-change", "nothing-of-the-kind");
596
+ case "unpaired":
597
+ return meaning("library-senders-change", "nothing-carried");
598
+ case "unwitnessable":
599
+ return meaning("library-senders-change", "nothing-inside");
600
+ case "uncheckable":
601
+ return meaning("library-senders-change", "nothing-checkable");
602
+ case "unclaimable":
603
+ return meaning("library-senders-change", "nothing-claimed");
604
+ }
605
+ };
529
606
  /** What a pace reading's silence reports, of one part (0230). */
530
607
  export const meaningOfPaceSilence = (silence) => {
531
608
  switch (silence) {
@@ -716,6 +793,172 @@ export const meaningOfFormCopySilence = (silence) => {
716
793
  return meaning("form-copy", "words-a-floor");
717
794
  }
718
795
  };
796
+ /**
797
+ * What an order of a deployment's conversions reports (0333).
798
+ *
799
+ * **The twenty-second set, and the second whose subject is what a deployment
800
+ * asked rather than what it measured.** Three members are the door's three
801
+ * (0229) at the page subject, `unsplit` is the window fault the split of two
802
+ * forms brought (0300), and `inconsistent` is the alarm every reading of
803
+ * counters against page views raises.
804
+ *
805
+ * Two are worth reading twice. `unanswered` is `no-reach-reported` said of a
806
+ * funnel end rather than of a part — a counter that is there and reports
807
+ * nobody arriving at it — and `stale` is the one condition this set brings:
808
+ * every question asked of a page that the page no longer has the parts for.
809
+ *
810
+ * **A page nothing asks anything of is not in this set at all.** It is a
811
+ * standing and not a silence: no figure is withheld, because no question was
812
+ * written, and the sentence is *there is nothing here to measure* rather than
813
+ * *this could not be measured*.
814
+ */
815
+ export const meaningOfConversionSilence = (silence) => {
816
+ switch (silence) {
817
+ case "unsplit":
818
+ return meaning("conversion", "two-forms-unsplit");
819
+ case "unscaled":
820
+ return meaning("conversion", "no-arrivals-counted");
821
+ case "unopened":
822
+ return meaning("conversion", "no-openings-marked");
823
+ case "uncounted":
824
+ return meaning("conversion", "no-window-folded");
825
+ case "stale":
826
+ return meaning("conversion", "questions-stale");
827
+ case "unanswered":
828
+ return meaning("conversion", "no-reach-reported");
829
+ case "inconsistent":
830
+ return meaning("conversion", "readers-above-views");
831
+ }
832
+ };
833
+ /**
834
+ * What a reader-weighted reading of a library's silent senders reports, of one
835
+ * kind.
836
+ *
837
+ * **Six members and not one new state of the world**, which is the claim this
838
+ * table exists to make. Three of them are the census of silent senders' own
839
+ * values, reused rather than respelled because that census is already asked of a
840
+ * kind; the other three are the door's, said at this subject exactly as a kind's
841
+ * share of the readers who met it says them (0256). A reading that answers a
842
+ * question no reading here could answer, and brings no condition with it, is
843
+ * what a mapped vocabulary is supposed to look like.
844
+ *
845
+ * `unwitnessed` is `no-reach-below` for the reason the sibling condition exists
846
+ * at all: the reach it is missing is not the subject's own, and a deployment
847
+ * handed `no-reach-reported` instead would go and rewrite a primitive that works
848
+ * because nobody has stood under it yet.
849
+ *
850
+ * **The door's three are kept apart from each other here, too.** A weighted
851
+ * figure is withheld for the whole kind when any page bearing a checkable place
852
+ * of it cannot be scaled, and which page that was is published with a page's own
853
+ * reason on it — so the remedy stays legible: a missing row is retention, no
854
+ * openings is a sender, and an unfolded window is a wait.
855
+ */
856
+ export const meaningOfSenderReachSilence = (silence) => {
857
+ switch (silence) {
858
+ case "unplaced":
859
+ return meaning("library-senders-reach", "nothing-of-the-kind");
860
+ case "unwitnessable":
861
+ return meaning("library-senders-reach", "nothing-inside");
862
+ case "unwitnessed":
863
+ return meaning("library-senders-reach", "no-reach-below");
864
+ case "unscaled":
865
+ return meaning("library-senders-reach", "no-arrivals-counted");
866
+ case "unopened":
867
+ return meaning("library-senders-reach", "no-openings-marked");
868
+ case "uncounted":
869
+ return meaning("library-senders-reach", "no-window-folded");
870
+ }
871
+ };
872
+ /**
873
+ * What a comparison of two windows of a library's silent senders, among the
874
+ * readings that got inside them, reports of one kind.
875
+ *
876
+ * **Not one new state of the world**, which is what a reading built out of two
877
+ * readings that are both already mapped ought to report. The comparison of
878
+ * places' own values are reused rather than respelled, because that comparison
879
+ * is already asked of a kind; the rest are the door's, said at this subject
880
+ * exactly as the reader-weighted reading of one window says them. No count of
881
+ * them is written here: the member list is the test's to count (0400 clause 8).
882
+ *
883
+ * The three worth reading twice are `unwitnessable`, `uncheckable` and
884
+ * `unclaimable`, in that order. *Nothing stands inside its places to report
885
+ * them*, *come back with readers on both sides*, and *the places are checkable
886
+ * and one window would not say what they did* are three instructions with three
887
+ * remedies — nothing, waiting, and a primitive to look at — and the subsystem's
888
+ * conditions for them keep that difference where a surface can see it (0414).
889
+ */
890
+ export const meaningOfSenderReachChangeSilence = (silence) => {
891
+ switch (silence) {
892
+ case "unplaced":
893
+ return meaning("library-senders-reach-change", "nothing-of-the-kind");
894
+ case "unpaired":
895
+ return meaning("library-senders-reach-change", "nothing-carried");
896
+ case "unwitnessable":
897
+ return meaning("library-senders-reach-change", "nothing-inside");
898
+ case "uncheckable":
899
+ return meaning("library-senders-reach-change", "nothing-checkable");
900
+ case "unclaimable":
901
+ return meaning("library-senders-reach-change", "nothing-claimed");
902
+ case "unscaled":
903
+ return meaning("library-senders-reach-change", "no-arrivals-counted");
904
+ case "unopened":
905
+ return meaning("library-senders-reach-change", "no-openings-marked");
906
+ case "uncounted":
907
+ return meaning("library-senders-reach-change", "no-window-folded");
908
+ }
909
+ };
910
+ /**
911
+ * What a fold of an hourly series into the hours of a day reports (0389).
912
+ *
913
+ * **The twenty-third set, and the first whose subject is a run of hours.** It
914
+ * brought both of its conditions, which no set had done since the first five,
915
+ * and the reason is that it is the first reading here that is a fold of a
916
+ * **clock** rather than of a window: its silences are the two ways a series can
917
+ * hold no finished hour, and nothing about a page, a part, a pair or a kind can
918
+ * be in either.
919
+ *
920
+ * `unmeasured` is the one worth stating. It is not `no-window-folded`, which is
921
+ * the state it reads most like — that condition asserts readers arrived and the
922
+ * rollup has not caught up, and an empty series is equally what a deployment
923
+ * nobody has read looks like. Collapsing the two would have put *your rollup is
924
+ * behind* on a deployment with no readers.
925
+ */
926
+ export const meaningOfDayShapeSilence = (silence) => {
927
+ switch (silence) {
928
+ case "unmeasured":
929
+ return meaning("rhythm", "no-hour-counted");
930
+ case "unsettled":
931
+ return meaning("rhythm", "no-hour-settled");
932
+ }
933
+ };
934
+ /**
935
+ * What a census of a library's silent senders reports, of one kind (0393).
936
+ *
937
+ * **The twenty-fourth set, and it brought exactly one condition.** Two of its
938
+ * three members are states already here at the same subject: `unplaced` is the
939
+ * census's `nothing-of-the-kind`, and `unwitnessable` is `nothing-inside` — a
940
+ * kind standing only in places with no element part under them, which is the
941
+ * eleventh set's condition said of the one question a part's own report can be
942
+ * checked by.
943
+ *
944
+ * `unwitnessed` is the new one, and it is `no-reach-below` rather than
945
+ * `no-reach-reported` because the reach it is missing is not the subject's. A
946
+ * placement of this kind holds parts and no view reported reaching any of them,
947
+ * so the defect this reading is about — a part on a reader's screen that said
948
+ * nothing — cannot be seen there at all. The sibling condition would have sent a
949
+ * deployment to its senders for a window in which nobody had stood under the
950
+ * component.
951
+ */
952
+ export const meaningOfSenderSilence = (silence) => {
953
+ switch (silence) {
954
+ case "unplaced":
955
+ return meaning("library-senders", "nothing-of-the-kind");
956
+ case "unwitnessable":
957
+ return meaning("library-senders", "nothing-inside");
958
+ case "unwitnessed":
959
+ return meaning("library-senders", "no-reach-below");
960
+ }
961
+ };
719
962
  export const SILENCE_RELATIONS = everyMemberOf()([
720
963
  "one-state",
721
964
  "one-reason",
@@ -0,0 +1,123 @@
1
+ import type { PartReading, PartStanding } from "./parts.js";
2
+ /**
3
+ * The shape of a page's parts, as three projections every reading of the
4
+ * frontier needs and none of them should spell twice.
5
+ *
6
+ * A reading of a page is a pre-order list of addressed nodes carrying a depth
7
+ * ([`parts.ts`](parts.ts)), so *what is inside this part* is a contiguous run
8
+ * and *what did the readers below it report* is a difference of two prefix
9
+ * counts. Both are one pass over the page and neither walks a part's ancestors,
10
+ * which is the quadratic shape rule 4 of
11
+ * [`docs/signals.md`](../../docs/signals.md) keeps out of these readings.
12
+ *
13
+ * **Internal to `src/signals/`, and deliberately not re-exported from
14
+ * [`index.ts`](index.ts).** It publishes no answer about a deployment; it is the
15
+ * one spelling of a projection that [`frontier.ts`](frontier.ts), the census in
16
+ * [`library-senders.ts`](library-senders.ts), the comparison in
17
+ * [`library-senders-change.ts`](library-senders-change.ts) and the
18
+ * reader-weighted reading in
19
+ * [`library-senders-reach.ts`](library-senders-reach.ts) all need. Two
20
+ * spellings that agree
21
+ * today are how the two came to disagree about which parts a reader was below
22
+ * — the failure `parts.ts` names about `spokenFor` and the counter keys.
23
+ *
24
+ * Pure: no store, no clock, no DOM, and nothing here survives into a browser
25
+ * bundle.
26
+ */
27
+ /** Where each part sits, from one pre-order pass over a stack of open parts. */
28
+ export type PartExtents = {
29
+ /**
30
+ * The index of the part each part sits inside, and `null` at an outermost
31
+ * part.
32
+ *
33
+ * Taken by index rather than by id so that a container's standing is read off
34
+ * the row itself. An id would be a second place where two parts sharing one —
35
+ * which a tree does not do, and which a reading cannot check — became a wrong
36
+ * answer instead of an impossible one.
37
+ */
38
+ readonly containers: readonly (number | null)[];
39
+ /** The exclusive end of each part's subtree; `parts.length` for a part the page ends inside. */
40
+ readonly ends: readonly number[];
41
+ };
42
+ /** Each part's container and the end of its subtree, in one pass. */
43
+ export declare const extentsOf: (parts: readonly PartReading[]) => PartExtents;
44
+ /** Prefix counts, so a subtree's standings are two subtractions rather than a scan. */
45
+ export declare const prefixOf: (parts: readonly PartReading[], standing: PartStanding) => readonly number[];
46
+ /** The count over the half-open range `[from, to)` of a prefix built by {@link prefixOf}. */
47
+ export declare const between: (counts: readonly number[], from: number, to: number) => number;
48
+ /**
49
+ * What a placement is, as far as a silent sender can be seen on it.
50
+ *
51
+ * The five states are exclusive and exhaustive over a page's parts, and the
52
+ * order below is the order they are decided in: whether anything stands inside
53
+ * it, then whether anything inside it reported reach, then what it said about
54
+ * itself.
55
+ */
56
+ export type SenderState =
57
+ /** Nothing stands inside it, so nothing could ever witness it (0393). */
58
+ "leaf"
59
+ /** Parts stand inside it and none of them reported reach in this window. */
60
+ | "unwitnessed"
61
+ /** Something below it reported reach, and it reported coming into view itself. */
62
+ | "reporting"
63
+ /** Something below it reported reach and it said nothing, which is the defect (0382). */
64
+ | "silent"
65
+ /**
66
+ * Something below it reported reach and it reported something that was not a
67
+ * view.
68
+ *
69
+ * Plausibly the same defect and never claimed as it, because `unknown` is the
70
+ * absence of a claim (0282).
71
+ */
72
+ | "indeterminate";
73
+ /** Whether the defect could be seen at a placement in this state. */
74
+ export declare const witnessedState: (state: SenderState) => boolean;
75
+ /** One part with what its placement is, which is what a census and a comparison both count. */
76
+ export type PartSender = {
77
+ readonly part: PartReading;
78
+ readonly state: SenderState;
79
+ /**
80
+ * The most reach any part **strictly inside** it reported, which is what a
81
+ * reader-weighted reading of the defect weighs a placement by.
82
+ *
83
+ * It is nought exactly where {@link witnessedState} is false, and that is one
84
+ * fact rather than two agreeing ones: a part is `read` precisely when its
85
+ * counters report reach above nought, so *something below it reported reach*
86
+ * and *the most reach below it is above nought* are the same predicate read
87
+ * two ways. A reading that worked its own version of it out beside the state
88
+ * is the drift this module exists to prevent.
89
+ *
90
+ * **The maximum and never the sum.** `reached` counts distinct page views per
91
+ * part, so adding a subtree's counters multiplies one reader by how finely
92
+ * the page was built — the distinctness trap
93
+ * [`parts.ts`](parts.ts) already keeps out of a role row. The largest single
94
+ * part's count is a **floor** on the page views that got inside, which is the
95
+ * direction a census of a quiet deployment is allowed to be wrong in (0212).
96
+ *
97
+ * Raw, in the page's own counters: putting it on the scale a door counts in
98
+ * is the caller's, because the door is a fact about the page and not about the
99
+ * tree.
100
+ */
101
+ readonly insideReach: number;
102
+ };
103
+ /**
104
+ * Each part of a page with the state its placement is in, in one pass.
105
+ *
106
+ * The **one** spelling of 0382's rule — *skipped, with reach reported below it*
107
+ * — shared by the census ([`library-senders.ts`](library-senders.ts)), by the
108
+ * comparison of two windows
109
+ * ([`library-senders-change.ts`](library-senders-change.ts)) and by the
110
+ * reader-weighted reading of the same defect
111
+ * ([`library-senders-reach.ts`](library-senders-reach.ts)). Two spellings of
112
+ * it that agreed today is what this module exists to prevent, and a census and a
113
+ * comparison disagreeing about which placements were silent is the shape of that
114
+ * failure a surface could not notice.
115
+ *
116
+ * Carries the part rather than an index, so that no caller reads a parallel
117
+ * array back by position — and carries {@link PartSender.insideReach} beside the
118
+ * state for the same reason, since the weight a reader-weighted reading puts on
119
+ * a placement and the predicate that says the defect is visible there are one
120
+ * fact about the subtree.
121
+ */
122
+ export declare const senderStatesOf: (parts: readonly PartReading[]) => readonly PartSender[];
123
+ //# sourceMappingURL=subtrees.d.ts.map
@@ -0,0 +1,102 @@
1
+ /** Each part's container and the end of its subtree, in one pass. */
2
+ export const extentsOf = (parts) => {
3
+ const total = parts.length;
4
+ const containers = [];
5
+ const ends = new Array(total).fill(total);
6
+ const open = [];
7
+ for (const [at, part] of parts.entries()) {
8
+ for (;;) {
9
+ const top = open.at(-1);
10
+ if (top === undefined)
11
+ break;
12
+ const above = parts[top];
13
+ if (above === undefined || above.depth < part.depth)
14
+ break;
15
+ ends[top] = at;
16
+ open.pop();
17
+ }
18
+ containers.push(open.at(-1) ?? null);
19
+ open.push(at);
20
+ }
21
+ return { containers, ends };
22
+ };
23
+ /** Prefix counts, so a subtree's standings are two subtractions rather than a scan. */
24
+ export const prefixOf = (parts, standing) => {
25
+ const counts = [0];
26
+ for (const part of parts)
27
+ counts.push((counts.at(-1) ?? 0) + (part.standing === standing ? 1 : 0));
28
+ return counts;
29
+ };
30
+ /** The count over the half-open range `[from, to)` of a prefix built by {@link prefixOf}. */
31
+ export const between = (counts, from, to) => (counts[to] ?? 0) - (counts[from] ?? 0);
32
+ /** Whether the defect could be seen at a placement in this state. */
33
+ export const witnessedState = (state) => state === "reporting" || state === "silent" || state === "indeterminate";
34
+ const stateOf = (part, beneath, readBelow) => {
35
+ if (beneath === 0)
36
+ return "leaf";
37
+ if (readBelow === 0)
38
+ return "unwitnessed";
39
+ switch (part.standing) {
40
+ case "read":
41
+ return "reporting";
42
+ case "skipped":
43
+ return "silent";
44
+ case "unknown":
45
+ return "indeterminate";
46
+ }
47
+ };
48
+ /**
49
+ * The most reach reported inside each part, in one pass over the page.
50
+ *
51
+ * Walked **backwards**, which is what makes it one pass: a pre-order list puts
52
+ * every part after the part that contains it, so by the time an index is read
53
+ * its own subtree has already been folded into it and the answer can be handed
54
+ * up to its container. A maximum does not subtract, so the prefix counts
55
+ * {@link prefixOf} builds cannot serve and a forward walk would have to look
56
+ * down each subtree — the per-part descent rule 4 of
57
+ * [`docs/signals.md`](../../docs/signals.md) keeps out of these readings.
58
+ */
59
+ const reachInsideOf = (parts, containers) => {
60
+ const inside = new Array(parts.length).fill(0);
61
+ for (let at = parts.length - 1; at >= 0; at -= 1) {
62
+ const container = containers[at];
63
+ if (container === null || container === undefined)
64
+ continue;
65
+ const own = parts[at]?.counters?.reached ?? 0;
66
+ inside[container] = Math.max(inside[container] ?? 0, own, inside[at] ?? 0);
67
+ }
68
+ return inside;
69
+ };
70
+ /**
71
+ * Each part of a page with the state its placement is in, in one pass.
72
+ *
73
+ * The **one** spelling of 0382's rule — *skipped, with reach reported below it*
74
+ * — shared by the census ([`library-senders.ts`](library-senders.ts)), by the
75
+ * comparison of two windows
76
+ * ([`library-senders-change.ts`](library-senders-change.ts)) and by the
77
+ * reader-weighted reading of the same defect
78
+ * ([`library-senders-reach.ts`](library-senders-reach.ts)). Two spellings of
79
+ * it that agreed today is what this module exists to prevent, and a census and a
80
+ * comparison disagreeing about which placements were silent is the shape of that
81
+ * failure a surface could not notice.
82
+ *
83
+ * Carries the part rather than an index, so that no caller reads a parallel
84
+ * array back by position — and carries {@link PartSender.insideReach} beside the
85
+ * state for the same reason, since the weight a reader-weighted reading puts on
86
+ * a placement and the predicate that says the defect is visible there are one
87
+ * fact about the subtree.
88
+ */
89
+ export const senderStatesOf = (parts) => {
90
+ const { containers, ends } = extentsOf(parts);
91
+ const reads = prefixOf(parts, "read");
92
+ const inside = reachInsideOf(parts, containers);
93
+ return parts.map((part, at) => {
94
+ const end = ends[at] ?? parts.length;
95
+ return {
96
+ part,
97
+ state: stateOf(part, end - at - 1, between(reads, at + 1, end)),
98
+ insideReach: inside[at] ?? 0,
99
+ };
100
+ });
101
+ };
102
+ //# sourceMappingURL=subtrees.js.map