@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
@@ -1,90 +0,0 @@
1
- import type { IdFactory } from "../ids.js";
2
- import type { TreeOperation } from "../tree/delta.js";
3
- import type { Clock } from "./events.js";
4
- import type { ChangeInterpreter } from "./interpreter.js";
5
- import type { DiscardedWork } from "./proposal.js";
6
- /**
7
- * Proposing an inverse that is already in hand.
8
- *
9
- * The runtime computes the inverse of every change at assessment time
10
- * (`assessReversibility`), and until now the only way to *offer* one back was
11
- * `revertRevision`, which plans an undo by replaying a store. That is the right
12
- * path when the undo is being recovered from a log — it has to read one to know
13
- * what has been built on top since (0035).
14
- *
15
- * It is the wrong path, and an unreachable one, when the inverse never left the
16
- * process. A surface that composed a change and still holds the `Reversibility`
17
- * it produced has no log to replay and nothing to contest: the whole of what it
18
- * needs is the short piece between *here is an inverse* and *here is a proposal
19
- * the Gate can weigh*. `Loom marketing` wrote that piece by hand on 5 September
20
- * to make the front door's *Put it back* do what it says, and filed it, because
21
- * the alternative is every stateless surface rebuilding the same thirty lines
22
- * with its own idea of what an undo's provenance says.
23
- *
24
- * So this is the assembled version, and `revertInterpreter` is now it plus the
25
- * two things only a log can supply: a rationale naming the revision, and the
26
- * declaration of what applying it writes over.
27
- */
28
- /**
29
- * The inverse, as little of it as proposing one needs.
30
- *
31
- * A `TreeDelta` satisfies this, which is the common case — it is what
32
- * `Reversibility.inverse` hands back. A caller holding operations and the
33
- * revision they were computed against, and no delta yet, satisfies it too: the
34
- * delta id and tree id belong to the delta this proposes, not to the inverse it
35
- * proposes from.
36
- */
37
- export type ProposableInverse = {
38
- /** The revision the operations were computed against. */
39
- readonly baseRevision: number;
40
- readonly operations: readonly TreeOperation[];
41
- };
42
- /**
43
- * What the interpreter cannot compute, because it depends on where the inverse
44
- * came from.
45
- *
46
- * Both are required rather than defaulted. A default interpreter id would put
47
- * one stamp on undos planned by unrelated callers, and reading that stamp back
48
- * is how a surface tells an undo from a change — `(demo)` does exactly that
49
- * against `REVERT_INTERPRETER`. A default rationale would be the runtime
50
- * writing a sentence about a provenance it does not know, on the one field the
51
- * person answering a hold actually reads (0019).
52
- */
53
- export type InverseTerms = {
54
- /** What produced the delta, for `Provenance.interpreter`. Not a model. */
55
- readonly interpreter: string;
56
- /** Why, in the words the person answering a hold is shown. */
57
- readonly rationale: string;
58
- /**
59
- * Work applying this inverse would write over. Only a caller holding a log
60
- * can know of any, and absence keeps meaning "nobody looked at a log" rather
61
- * than "a log was checked and was clean" (0035).
62
- */
63
- readonly discards?: readonly DiscardedWork[];
64
- /**
65
- * The revision this puts back, recorded on the provenance the log keeps.
66
- *
67
- * Optional because not every inverse has one to name. A stateless surface
68
- * undoing a change it made in the same session has no revision — nothing was
69
- * ever appended — and stamping a number it does not have would be worse than
70
- * the absence. A caller that planned the undo off a log always does.
71
- */
72
- readonly undoes?: number;
73
- };
74
- /**
75
- * An interpreter that has nothing to interpret.
76
- *
77
- * The seam exists because interpretation is the non-deterministic step (0005),
78
- * not because it is always a model — and an undo is the case that proves the
79
- * seam was drawn in the right place. Everything downstream of it cannot tell
80
- * that no model was involved, which is exactly what makes an undo gateable on
81
- * the same terms as an AI-authored change.
82
- *
83
- * `confidence` is 1 because the inverse is computed, not guessed. That is the
84
- * honest self-grade (0007), and it is also why `authoredBy` is `runtime`: a 1
85
- * nobody graded is not a claim, and calibration (0031) segments these out of its
86
- * score rather than letting every undo walk the top band toward a perfect record
87
- * the model never earned.
88
- */
89
- export declare const inverseInterpreter: (inverse: ProposableInverse, terms: InverseTerms, idFactory: IdFactory, clock: Clock) => ChangeInterpreter;
90
- //# sourceMappingURL=inverse-interpreter.d.ts.map
@@ -1,56 +0,0 @@
1
- import { err, ok } from "../result.js";
2
- /**
3
- * An interpreter that has nothing to interpret.
4
- *
5
- * The seam exists because interpretation is the non-deterministic step (0005),
6
- * not because it is always a model — and an undo is the case that proves the
7
- * seam was drawn in the right place. Everything downstream of it cannot tell
8
- * that no model was involved, which is exactly what makes an undo gateable on
9
- * the same terms as an AI-authored change.
10
- *
11
- * `confidence` is 1 because the inverse is computed, not guessed. That is the
12
- * honest self-grade (0007), and it is also why `authoredBy` is `runtime`: a 1
13
- * nobody graded is not a claim, and calibration (0031) segments these out of its
14
- * score rather than letting every undo walk the top band toward a perfect record
15
- * the model never earned.
16
- */
17
- export const inverseInterpreter = (inverse, terms, idFactory, clock) => ({
18
- interpret: (intent, tree) => Promise.resolve(
19
- /**
20
- * An inverse is computed against one arrangement of a tree. Offering it
21
- * against another would be proposing something whose reasoning has
22
- * expired, so it declines rather than proposing. The write path refuses a
23
- * moved head before reaching here; this is what keeps the interpreter safe
24
- * to wire into a runtime directly, which a stateless caller does.
25
- */
26
- tree.revision === inverse.baseRevision
27
- ? ok({
28
- proposalId: idFactory.proposalId(),
29
- intentId: intent.intentId,
30
- delta: {
31
- deltaId: idFactory.deltaId(),
32
- treeId: tree.treeId,
33
- baseRevision: tree.revision,
34
- operations: inverse.operations,
35
- },
36
- rationale: terms.rationale,
37
- ...(terms.discards === undefined || terms.discards.length === 0
38
- ? {}
39
- : { discards: terms.discards }),
40
- provenance: {
41
- origin: intent.origin,
42
- ...(intent.actor === undefined ? {} : { actor: intent.actor }),
43
- interpreter: terms.interpreter,
44
- /** Computed, not inferred — so calibration leaves it out (0031). */
45
- authoredBy: "runtime",
46
- ...(terms.undoes === undefined ? {} : { undoes: terms.undoes }),
47
- confidence: 1,
48
- interpretedAt: clock.now(),
49
- },
50
- })
51
- : err({
52
- code: "refused",
53
- detail: `the inverse was computed against revision ${inverse.baseRevision}, and this tree is at ${tree.revision}`,
54
- })),
55
- });
56
- //# sourceMappingURL=inverse-interpreter.js.map