@jam-overture/loom 0.1.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 (414) hide show
  1. package/README.md +3 -1
  2. package/dist/application/application.d.ts +109 -0
  3. package/dist/application/application.js +97 -0
  4. package/dist/application/memory.d.ts +20 -0
  5. package/dist/application/memory.js +79 -0
  6. package/dist/application/store.d.ts +101 -0
  7. package/dist/application/store.js +25 -0
  8. package/dist/audience/audience.d.ts +36 -0
  9. package/dist/audience/audience.js +41 -0
  10. package/dist/audience/compose.d.ts +112 -0
  11. package/dist/audience/compose.js +134 -0
  12. package/dist/audience/memory.d.ts +14 -0
  13. package/dist/audience/memory.js +71 -0
  14. package/dist/audience/overlay-store.d.ts +343 -0
  15. package/dist/audience/overlay-store.js +217 -0
  16. package/dist/audience/rule.d.ts +121 -0
  17. package/dist/audience/rule.js +78 -0
  18. package/dist/cli/index.d.ts +3 -4
  19. package/dist/cli/index.js +3 -4
  20. package/dist/cli/templates.js +19 -0
  21. package/dist/data/adapter.d.ts +9 -1
  22. package/dist/data/adapter.js +2 -0
  23. package/dist/data/plan.js +0 -0
  24. package/dist/data/resolution.d.ts +23 -1
  25. package/dist/data/resolve.d.ts +31 -4
  26. package/dist/data/resolve.js +11 -3
  27. package/dist/ids.d.ts +10 -0
  28. package/dist/ids.js +11 -1
  29. package/dist/index.d.ts +1 -0
  30. package/dist/index.js +1 -0
  31. package/dist/interpretation/anthropic.d.ts +1 -1
  32. package/dist/interpretation/anthropic.js +2 -22
  33. package/dist/interpretation/client.d.ts +1 -1
  34. package/dist/interpretation/materialize.js +67 -22
  35. package/dist/interpretation/openai-compatible.d.ts +36 -0
  36. package/dist/interpretation/openai-compatible.js +79 -0
  37. package/dist/interpretation/status.d.ts +19 -0
  38. package/dist/interpretation/status.js +26 -0
  39. package/dist/live/index.d.ts +73 -0
  40. package/dist/live/index.js +73 -0
  41. package/dist/live/pages.d.ts +187 -0
  42. package/dist/live/pages.js +161 -0
  43. package/dist/live/pull.d.ts +147 -0
  44. package/dist/live/pull.js +398 -0
  45. package/dist/live/pulling.d.ts +79 -0
  46. package/dist/live/pulling.js +117 -0
  47. package/dist/live/window.d.ts +129 -0
  48. package/dist/live/window.js +132 -0
  49. package/dist/patch.d.ts +54 -0
  50. package/dist/patch.js +44 -0
  51. package/dist/project/closing.d.ts +51 -0
  52. package/dist/project/closing.js +53 -0
  53. package/dist/project/memory.d.ts +20 -0
  54. package/dist/project/memory.js +97 -0
  55. package/dist/project/project.d.ts +90 -0
  56. package/dist/project/project.js +91 -0
  57. package/dist/project/store.d.ts +135 -0
  58. package/dist/project/store.js +41 -0
  59. package/dist/registered.d.ts +64 -0
  60. package/dist/registered.js +118 -0
  61. package/dist/render/addressed.d.ts +35 -0
  62. package/dist/render/addressed.js +79 -0
  63. package/dist/render/behaviour-adjust.d.ts +11 -19
  64. package/dist/render/behaviour-adjust.js +75 -21
  65. package/dist/render/behaviour-present.d.ts +8 -0
  66. package/dist/render/behaviour-present.js +57 -6
  67. package/dist/render/behaviour.d.ts +98 -17
  68. package/dist/render/behaviour.js +91 -26
  69. package/dist/render/control-name.d.ts +68 -0
  70. package/dist/render/control-name.js +37 -0
  71. package/dist/render/diagnostics.d.ts +72 -0
  72. package/dist/render/diagnostics.js +7 -0
  73. package/dist/render/document-theme.d.ts +70 -0
  74. package/dist/render/document-theme.js +139 -0
  75. package/dist/render/editable.d.ts +15 -1
  76. package/dist/render/editable.js +13 -1
  77. package/dist/render/expected.d.ts +98 -0
  78. package/dist/render/expected.js +88 -0
  79. package/dist/render/index.d.ts +4 -0
  80. package/dist/render/index.js +4 -0
  81. package/dist/render/reads.d.ts +11 -0
  82. package/dist/render/reads.js +12 -1
  83. package/dist/render/render.d.ts +11 -0
  84. package/dist/render/render.js +294 -53
  85. package/dist/render/request.d.ts +8 -1
  86. package/dist/render/request.js +1 -0
  87. package/dist/render/slots.d.ts +52 -0
  88. package/dist/render/slots.js +24 -0
  89. package/dist/render/theme.d.ts +54 -1
  90. package/dist/render/theme.js +23 -1
  91. package/dist/render/unshown.d.ts +152 -0
  92. package/dist/render/unshown.js +80 -0
  93. package/dist/runtime/analysis.d.ts +94 -9
  94. package/dist/runtime/analysis.js +54 -9
  95. package/dist/runtime/assessment.d.ts +36 -2
  96. package/dist/runtime/assessment.js +27 -2
  97. package/dist/runtime/auto-apply-ceiling.d.ts +54 -0
  98. package/dist/runtime/auto-apply-ceiling.js +66 -0
  99. package/dist/runtime/checks.d.ts +148 -0
  100. package/dist/runtime/checks.js +112 -0
  101. package/dist/runtime/disposition.d.ts +96 -0
  102. package/dist/runtime/disposition.js +46 -0
  103. package/dist/runtime/gate.js +91 -10
  104. package/dist/runtime/index.d.ts +4 -0
  105. package/dist/runtime/index.js +4 -0
  106. package/dist/runtime/irreversibility.d.ts +64 -0
  107. package/dist/runtime/irreversibility.js +45 -0
  108. package/dist/runtime/nesting.d.ts +13 -1
  109. package/dist/runtime/nesting.js +41 -24
  110. package/dist/runtime/pipeline.d.ts +43 -0
  111. package/dist/runtime/pipeline.js +10 -2
  112. package/dist/runtime/policy-change.d.ts +93 -0
  113. package/dist/runtime/policy-change.js +305 -0
  114. package/dist/runtime/policy-log.d.ts +406 -0
  115. package/dist/runtime/policy-log.js +285 -0
  116. package/dist/runtime/policy.d.ts +8 -6
  117. package/dist/runtime/policy.js +5 -2
  118. package/dist/runtime/repointing.js +0 -0
  119. package/dist/runtime/reversibility.d.ts +11 -9
  120. package/dist/runtime/stakes.d.ts +129 -1
  121. package/dist/runtime/stakes.js +240 -26
  122. package/dist/runtime/vocabulary.d.ts +164 -7
  123. package/dist/runtime/vocabulary.js +181 -8
  124. package/dist/sdk/audit.d.ts +174 -3
  125. package/dist/sdk/audit.js +176 -17
  126. package/dist/sdk/catalogue.d.ts +9 -1
  127. package/dist/sdk/conformance.d.ts +37 -3
  128. package/dist/sdk/conformance.js +25 -4
  129. package/dist/sdk/definition.d.ts +129 -5
  130. package/dist/sdk/definition.js +66 -0
  131. package/dist/sdk/registry.d.ts +45 -2
  132. package/dist/sdk/registry.js +102 -1
  133. package/dist/signals/acted.contract.d.ts +21 -0
  134. package/dist/signals/acted.contract.js +236 -0
  135. package/dist/signals/acted.d.ts +359 -0
  136. package/dist/signals/acted.js +135 -0
  137. package/dist/signals/action-change.d.ts +507 -0
  138. package/dist/signals/action-change.js +265 -0
  139. package/dist/signals/action.d.ts +331 -0
  140. package/dist/signals/action.js +182 -0
  141. package/dist/signals/agenda.d.ts +585 -0
  142. package/dist/signals/agenda.js +295 -0
  143. package/dist/signals/applied-window.contract.d.ts +23 -0
  144. package/dist/signals/applied-window.contract.js +160 -0
  145. package/dist/signals/arrivals.contract.d.ts +21 -0
  146. package/dist/signals/arrivals.contract.js +180 -0
  147. package/dist/signals/arrivals.d.ts +375 -0
  148. package/dist/signals/arrivals.js +254 -0
  149. package/dist/signals/arriving.d.ts +210 -0
  150. package/dist/signals/arriving.js +133 -0
  151. package/dist/signals/audiences.d.ts +528 -0
  152. package/dist/signals/audiences.js +255 -0
  153. package/dist/signals/broadcast.d.ts +33 -17
  154. package/dist/signals/broadcast.js +255 -32
  155. package/dist/signals/change.d.ts +378 -0
  156. package/dist/signals/change.js +327 -0
  157. package/dist/signals/collect.d.ts +169 -34
  158. package/dist/signals/collect.js +186 -38
  159. package/dist/signals/conversion.d.ts +348 -0
  160. package/dist/signals/conversion.js +235 -0
  161. package/dist/signals/copy-change.d.ts +553 -0
  162. package/dist/signals/copy-change.js +377 -0
  163. package/dist/signals/copy.d.ts +337 -0
  164. package/dist/signals/copy.js +211 -0
  165. package/dist/signals/correlated.contract.d.ts +24 -0
  166. package/dist/signals/correlated.contract.js +94 -0
  167. package/dist/signals/counters.d.ts +97 -0
  168. package/dist/signals/counters.js +160 -0
  169. package/dist/signals/deliver.d.ts +23 -4
  170. package/dist/signals/deliver.js +34 -6
  171. package/dist/signals/deployment-change.d.ts +395 -0
  172. package/dist/signals/deployment-change.js +309 -0
  173. package/dist/signals/deployment.d.ts +278 -0
  174. package/dist/signals/deployment.js +178 -0
  175. package/dist/signals/door.d.ts +114 -0
  176. package/dist/signals/door.js +77 -0
  177. package/dist/signals/expire.d.ts +192 -0
  178. package/dist/signals/expire.js +213 -0
  179. package/dist/signals/fold.d.ts +10 -0
  180. package/dist/signals/fold.js +5 -1
  181. package/dist/signals/form-action.d.ts +302 -0
  182. package/dist/signals/form-action.js +169 -0
  183. package/dist/signals/form-copy.d.ts +523 -0
  184. package/dist/signals/form-copy.js +346 -0
  185. package/dist/signals/forms.d.ts +247 -0
  186. package/dist/signals/forms.js +147 -0
  187. package/dist/signals/frontier.d.ts +268 -0
  188. package/dist/signals/frontier.js +145 -0
  189. package/dist/signals/funnel-change.d.ts +548 -0
  190. package/dist/signals/funnel-change.js +361 -0
  191. package/dist/signals/funnel-hours.contract.d.ts +21 -0
  192. package/dist/signals/funnel-hours.contract.js +221 -0
  193. package/dist/signals/funnel-hours.d.ts +293 -0
  194. package/dist/signals/funnel-hours.js +99 -0
  195. package/dist/signals/funnel.d.ts +592 -0
  196. package/dist/signals/funnel.js +231 -0
  197. package/dist/signals/health.d.ts +694 -0
  198. package/dist/signals/health.js +573 -0
  199. package/dist/signals/index.d.ts +60 -0
  200. package/dist/signals/index.js +60 -0
  201. package/dist/signals/ingest.d.ts +56 -1
  202. package/dist/signals/ingest.js +91 -1
  203. package/dist/signals/inside.d.ts +190 -0
  204. package/dist/signals/inside.js +263 -0
  205. package/dist/signals/join.d.ts +56 -0
  206. package/dist/signals/join.js +60 -0
  207. package/dist/signals/journal.d.ts +123 -9
  208. package/dist/signals/kept.contract.d.ts +22 -0
  209. package/dist/signals/kept.contract.js +111 -0
  210. package/dist/signals/kinds.d.ts +8 -6
  211. package/dist/signals/kinds.js +14 -6
  212. package/dist/signals/library-action.d.ts +430 -0
  213. package/dist/signals/library-action.js +336 -0
  214. package/dist/signals/library-agenda-change.d.ts +324 -0
  215. package/dist/signals/library-agenda-change.js +199 -0
  216. package/dist/signals/library-agenda.d.ts +258 -0
  217. package/dist/signals/library-agenda.js +167 -0
  218. package/dist/signals/library-change.d.ts +477 -0
  219. package/dist/signals/library-change.js +335 -0
  220. package/dist/signals/library-copy-change.d.ts +498 -0
  221. package/dist/signals/library-copy-change.js +476 -0
  222. package/dist/signals/library-pace.d.ts +319 -0
  223. package/dist/signals/library-pace.js +305 -0
  224. package/dist/signals/library-reach-change.d.ts +646 -0
  225. package/dist/signals/library-reach-change.js +542 -0
  226. package/dist/signals/library-reach.d.ts +377 -0
  227. package/dist/signals/library-reach.js +227 -0
  228. package/dist/signals/library-senders-change.d.ts +457 -0
  229. package/dist/signals/library-senders-change.js +367 -0
  230. package/dist/signals/library-senders-reach-change.d.ts +486 -0
  231. package/dist/signals/library-senders-reach-change.js +538 -0
  232. package/dist/signals/library-senders-reach.d.ts +340 -0
  233. package/dist/signals/library-senders-reach.js +252 -0
  234. package/dist/signals/library-senders.d.ts +271 -0
  235. package/dist/signals/library-senders.js +180 -0
  236. package/dist/signals/library-word-reach-change.d.ts +567 -0
  237. package/dist/signals/library-word-reach-change.js +564 -0
  238. package/dist/signals/library.d.ts +306 -0
  239. package/dist/signals/library.js +178 -0
  240. package/dist/signals/memory.d.ts +9 -0
  241. package/dist/signals/memory.js +246 -14
  242. package/dist/signals/migrate.d.ts +20 -4
  243. package/dist/signals/migrate.js +269 -8
  244. package/dist/signals/notice.d.ts +389 -0
  245. package/dist/signals/notice.js +250 -0
  246. package/dist/signals/pace-change.d.ts +501 -0
  247. package/dist/signals/pace-change.js +310 -0
  248. package/dist/signals/pace.d.ts +296 -0
  249. package/dist/signals/pace.js +291 -0
  250. package/dist/signals/page-views.d.ts +365 -0
  251. package/dist/signals/page-views.js +218 -0
  252. package/dist/signals/part-pace.d.ts +378 -0
  253. package/dist/signals/part-pace.js +333 -0
  254. package/dist/signals/parts.d.ts +354 -0
  255. package/dist/signals/parts.js +232 -0
  256. package/dist/signals/postgres.d.ts +16 -2
  257. package/dist/signals/postgres.js +753 -76
  258. package/dist/signals/progress.d.ts +212 -0
  259. package/dist/signals/progress.js +150 -0
  260. package/dist/signals/ratios.d.ts +108 -0
  261. package/dist/signals/ratios.js +40 -0
  262. package/dist/signals/reach.d.ts +309 -0
  263. package/dist/signals/reach.js +93 -0
  264. package/dist/signals/readable.d.ts +34 -0
  265. package/dist/signals/readable.js +34 -0
  266. package/dist/signals/readership.d.ts +381 -0
  267. package/dist/signals/readership.js +308 -0
  268. package/dist/signals/region-pages.d.ts +173 -0
  269. package/dist/signals/region-pages.js +62 -0
  270. package/dist/signals/region.d.ts +287 -0
  271. package/dist/signals/region.js +198 -0
  272. package/dist/signals/retention.d.ts +163 -0
  273. package/dist/signals/retention.js +75 -0
  274. package/dist/signals/rhythm.d.ts +302 -0
  275. package/dist/signals/rhythm.js +262 -0
  276. package/dist/signals/rollup.d.ts +194 -4
  277. package/dist/signals/rollup.js +0 -0
  278. package/dist/signals/schema.d.ts +1069 -1
  279. package/dist/signals/schema.js +393 -3
  280. package/dist/signals/signal.d.ts +237 -11
  281. package/dist/signals/signal.js +70 -10
  282. package/dist/signals/silence-census.d.ts +205 -0
  283. package/dist/signals/silence-census.js +87 -0
  284. package/dist/signals/silences.d.ts +1147 -0
  285. package/dist/signals/silences.js +996 -0
  286. package/dist/signals/subtrees.d.ts +123 -0
  287. package/dist/signals/subtrees.js +102 -0
  288. package/dist/signals/tally.d.ts +262 -12
  289. package/dist/signals/unread.d.ts +292 -0
  290. package/dist/signals/unread.js +137 -0
  291. package/dist/signals/window-agenda.d.ts +276 -0
  292. package/dist/signals/window-agenda.js +83 -0
  293. package/dist/signals/window-figures.d.ts +148 -0
  294. package/dist/signals/window-figures.js +42 -0
  295. package/dist/signals/window-funnels.d.ts +88 -0
  296. package/dist/signals/window-funnels.js +47 -0
  297. package/dist/signals/window.d.ts +866 -0
  298. package/dist/signals/window.js +693 -0
  299. package/dist/signals/words.d.ts +24 -0
  300. package/dist/signals/words.js +24 -0
  301. package/dist/store/cache.d.ts +101 -0
  302. package/dist/store/cache.js +149 -0
  303. package/dist/store/history.d.ts +82 -0
  304. package/dist/store/history.js +36 -0
  305. package/dist/store/index.d.ts +30 -0
  306. package/dist/store/index.js +30 -0
  307. package/dist/store/memory.d.ts +2 -1
  308. package/dist/store/memory.js +48 -12
  309. package/dist/store/migrate.d.ts +106 -0
  310. package/dist/store/migrate.js +323 -7
  311. package/dist/store/postgres-applications.d.ts +4 -0
  312. package/dist/store/postgres-applications.js +197 -0
  313. package/dist/store/postgres-audience.d.ts +14 -0
  314. package/dist/store/postgres-audience.js +272 -0
  315. package/dist/store/postgres-holds.d.ts +10 -1
  316. package/dist/store/postgres-holds.js +116 -101
  317. package/dist/store/postgres-policy-log.d.ts +14 -0
  318. package/dist/store/postgres-policy-log.js +240 -0
  319. package/dist/store/postgres-projects.d.ts +4 -0
  320. package/dist/store/postgres-projects.js +217 -0
  321. package/dist/store/postgres.d.ts +17 -1
  322. package/dist/store/postgres.js +60 -9
  323. package/dist/store/replay.d.ts +102 -1
  324. package/dist/store/replay.js +190 -19
  325. package/dist/store/reseed.d.ts +238 -0
  326. package/dist/store/reseed.js +308 -0
  327. package/dist/store/schema.d.ts +762 -2
  328. package/dist/store/schema.js +218 -5
  329. package/dist/store/source.d.ts +57 -1
  330. package/dist/store/source.js +65 -1
  331. package/dist/store/store.d.ts +29 -6
  332. package/dist/submit/resolve.d.ts +1 -1
  333. package/dist/submit/resolve.js +2 -1
  334. package/dist/telemetry/calibration.d.ts +25 -0
  335. package/dist/telemetry/calibration.js +27 -1
  336. package/dist/telemetry/event.d.ts +391 -33
  337. package/dist/telemetry/event.js +84 -20
  338. package/dist/telemetry/index.d.ts +2 -0
  339. package/dist/telemetry/index.js +2 -0
  340. package/dist/telemetry/journal.d.ts +104 -3
  341. package/dist/telemetry/journal.js +9 -0
  342. package/dist/telemetry/lookup.d.ts +27 -0
  343. package/dist/telemetry/lookup.js +18 -0
  344. package/dist/telemetry/memory.js +33 -1
  345. package/dist/telemetry/migrate.js +22 -1
  346. package/dist/telemetry/postgres.d.ts +10 -1
  347. package/dist/telemetry/postgres.js +188 -90
  348. package/dist/telemetry/remeasure.d.ts +78 -0
  349. package/dist/telemetry/remeasure.js +83 -0
  350. package/dist/telemetry/retention.d.ts +2 -2
  351. package/dist/telemetry/schema.d.ts +17 -0
  352. package/dist/telemetry/schema.js +27 -1
  353. package/dist/telemetry/sink.d.ts +2 -2
  354. package/dist/telemetry/window.d.ts +135 -0
  355. package/dist/telemetry/window.js +101 -0
  356. package/dist/testing/application-contract.d.ts +14 -0
  357. package/dist/testing/application-contract.js +270 -0
  358. package/dist/testing/audience-overlay-contract.d.ts +31 -0
  359. package/dist/testing/audience-overlay-contract.js +354 -0
  360. package/dist/testing/contracts.d.ts +13 -7
  361. package/dist/testing/contracts.js +13 -7
  362. package/dist/testing/definitions.d.ts +78 -0
  363. package/dist/testing/definitions.js +134 -9
  364. package/dist/testing/doubles.d.ts +103 -0
  365. package/dist/testing/doubles.js +143 -0
  366. package/dist/testing/index.d.ts +2 -2
  367. package/dist/testing/index.js +2 -2
  368. package/dist/testing/journal-contract.js +297 -6
  369. package/dist/testing/model-contract.d.ts +110 -0
  370. package/dist/testing/model-contract.js +150 -0
  371. package/dist/testing/policy-log-contract.d.ts +26 -0
  372. package/dist/testing/policy-log-contract.js +344 -0
  373. package/dist/testing/project-contract.d.ts +14 -0
  374. package/dist/testing/project-contract.js +266 -0
  375. package/dist/testing/reader-signal-contract.d.ts +27 -2
  376. package/dist/testing/reader-signal-contract.js +475 -5
  377. package/dist/testing/store-contract.d.ts +7 -1
  378. package/dist/testing/store-contract.js +84 -3
  379. package/dist/theme/apply.d.ts +20 -1
  380. package/dist/theme/apply.js +5 -3
  381. package/dist/theme/contrast.d.ts +19 -14
  382. package/dist/theme/contrast.js +181 -17
  383. package/dist/theme/derive.d.ts +22 -0
  384. package/dist/theme/derive.js +54 -1
  385. package/dist/theme/library.js +1 -1
  386. package/dist/theme/measure.d.ts +34 -0
  387. package/dist/theme/measure.js +30 -1
  388. package/dist/theme/palettes.js +7 -7
  389. package/dist/theme/ramp.d.ts +64 -0
  390. package/dist/theme/ramp.js +114 -0
  391. package/dist/theme/registry.d.ts +9 -0
  392. package/dist/theme/registry.js +11 -1
  393. package/dist/theme/separation.d.ts +97 -3
  394. package/dist/theme/separation.js +75 -0
  395. package/dist/tree/apply.js +13 -0
  396. package/dist/tree/compare.d.ts +9 -0
  397. package/dist/tree/compare.js +18 -0
  398. package/dist/tree/mutation.d.ts +18 -0
  399. package/dist/tree/mutation.js +24 -12
  400. package/dist/tree/navigation.d.ts +5 -0
  401. package/dist/tree/navigation.js +32 -10
  402. package/dist/tree/outline.d.ts +7 -0
  403. package/dist/tree/outline.js +9 -5
  404. package/dist/write/computed.d.ts +60 -0
  405. package/dist/write/computed.js +61 -0
  406. package/dist/write/held.d.ts +59 -0
  407. package/dist/write/index.d.ts +5 -2
  408. package/dist/write/index.js +5 -2
  409. package/dist/write/reseed.d.ts +151 -0
  410. package/dist/write/reseed.js +184 -0
  411. package/dist/write/revert.js +2 -16
  412. package/package.json +25 -3
  413. package/dist/runtime/inverse-interpreter.d.ts +0 -90
  414. package/dist/runtime/inverse-interpreter.js +0 -56
@@ -1,7 +1,24 @@
1
+ import { isAboveCeiling, NOTHING_AUTO_APPLIES, } from "./auto-apply-ceiling.js";
1
2
  import { policyFingerprintOf } from "./policy-fingerprint.js";
2
3
  import { ceilingFor } from "./policy.js";
3
- import { isAbove, isAtLeast } from "./stake-level.js";
4
+ import { isAtLeast } from "./stake-level.js";
4
5
  import { stakeFactor } from "./stakes.js";
6
+ /**
7
+ * The clause the four rungs below the refusal floor share, because they share
8
+ * one argument: a level cannot say "never auto-apply" while ceilings are per
9
+ * origin (0002), so these facts are held for a person regardless of who asked.
10
+ */
11
+ const HELD_WHATEVER_THE_ORIGIN = "this deployment holds for a person whatever its origin may apply";
12
+ /**
13
+ * A reason's sentence: what the change does, then what the policy did about it.
14
+ *
15
+ * Both halves, because either alone has been mistaken for the whole. The damage
16
+ * on its own is identical for a change that is held and the same change refused
17
+ * — the damage really is the same, and a reviewer shown only that cannot tell
18
+ * *this needs you* from *this will never be offered*. The consequence on its own
19
+ * would describe a policy and never the change in front of the reader.
20
+ */
21
+ const sentence = (damage, consequence) => damage.length > 0 ? `${damage}, which ${consequence}` : consequence;
5
22
  const decide = (assessment, policy, kind, reason) => ({
6
23
  kind,
7
24
  reason,
@@ -21,6 +38,28 @@ const decide = (assessment, policy, kind, reason) => ({
21
38
  * means what it meant. Neither is trustworthy from the caller.
22
39
  */
23
40
  policyFingerprint: policyFingerprintOf(policy),
41
+ /**
42
+ * And which optional checks were in place while it was judged, read off the
43
+ * assessment rather than taken from a caller — the assessment is what was
44
+ * handed the seams, so it is the only thing here that can say.
45
+ *
46
+ * Stamped on every disposition, including the accepted ones, and that is the
47
+ * point rather than an oversight. A check that fires leaves a refusal a reader
48
+ * can see; a check that was *never wired* leaves nothing at all, and the whole
49
+ * gap this closes is the silent case.
50
+ */
51
+ wiredChecks: assessment.wiredChecks,
52
+ /**
53
+ * Stamped on every disposition rather than only on the one
54
+ * `confirmIrreversible` produced. Which rung fired and why a change cannot be
55
+ * taken back are separate facts: a change can be held for discarding later
56
+ * work *and* be irreversible, and the rung that won says nothing about the
57
+ * second. Reading it off the assessment here is what keeps a reader of the
58
+ * record from inferring one from the other.
59
+ */
60
+ ...(assessment.reversibility.reasons.length > 0
61
+ ? { irreversibilityReasons: assessment.reversibility.reasons }
62
+ : {}),
24
63
  });
25
64
  /** Too unsure to act on at all — asking the user to confirm a guess is noise. */
26
65
  const rejectBelowConfidenceFloor = {
@@ -32,6 +71,7 @@ const rejectBelowConfidenceFloor = {
32
71
  return null;
33
72
  return `interpreter confidence ${confidence} is below the floor of ${policy.confidenceFloor}`;
34
73
  },
74
+ consequence: () => "this deployment refuses outright",
35
75
  };
36
76
  /** Some changes are not offered to the user at all, however they were asked for. */
37
77
  const rejectAtRefusalFloor = {
@@ -40,9 +80,9 @@ const rejectAtRefusalFloor = {
40
80
  fires: (assessment, policy) => {
41
81
  if (!isAtLeast(assessment.stakes.level, policy.refusalFloor))
42
82
  return null;
43
- const detail = assessment.stakes.factors.map((factor) => factor.detail).join("; ");
44
- return detail || `stakes reached ${policy.refusalFloor}`;
83
+ return assessment.stakes.factors.map((factor) => factor.detail).join("; ");
45
84
  },
85
+ consequence: (_assessment, policy) => `this deployment refuses outright at ${policy.refusalFloor} stakes`,
46
86
  };
47
87
  /** Undo would not undo reality, so a human decides — regardless of how small it looks. */
48
88
  const confirmIrreversible = {
@@ -54,6 +94,7 @@ const confirmIrreversible = {
54
94
  const detail = assessment.reversibility.reasons.map((reason) => reason.code).join("; ");
55
95
  return `cannot be undone cleanly: ${detail}`;
56
96
  },
97
+ consequence: () => HELD_WHATEVER_THE_ORIGIN,
57
98
  };
58
99
  /**
59
100
  * A change that writes over work already in the log is never applied without a
@@ -72,6 +113,7 @@ const confirmDiscardsLaterWork = {
72
113
  code: "discards-later-work",
73
114
  kind: "requires-confirmation",
74
115
  fires: (assessment) => stakeFactor(assessment.stakes, "discards-later-work")?.detail ?? null,
116
+ consequence: () => HELD_WHATEVER_THE_ORIGIN,
75
117
  };
76
118
  /**
77
119
  * A change that moves where a form posts is never applied without a person,
@@ -89,6 +131,7 @@ const confirmRedirectedSubmission = {
89
131
  code: "redirected-submission",
90
132
  kind: "requires-confirmation",
91
133
  fires: (assessment) => stakeFactor(assessment.stakes, "redirected-submission")?.detail ?? null,
134
+ consequence: () => HELD_WHATEVER_THE_ORIGIN,
92
135
  };
93
136
  /**
94
137
  * A change that points a region at different data is never applied without a
@@ -106,18 +149,51 @@ const confirmRepointedBinding = {
106
149
  code: "repointed-binding",
107
150
  kind: "requires-confirmation",
108
151
  fires: (assessment) => stakeFactor(assessment.stakes, "repointed-binding")?.detail ?? null,
152
+ consequence: () => HELD_WHATEVER_THE_ORIGIN,
153
+ };
154
+ /**
155
+ * What the ceiling rung says the change does, and why at `nothing` it says
156
+ * nothing at all.
157
+ *
158
+ * Everywhere else the factors are the better damage line: they say what about
159
+ * *this* change took it over the line, which is what somebody deciding whether
160
+ * to allow it wants. At `nothing` there is no line this change crossed — the
161
+ * deployment decided in advance that this origin applies none of its changes
162
+ * (0405) — so naming a factor would offer a reason that is not the reason, and
163
+ * invite a person to think a smaller change would have gone through.
164
+ *
165
+ * It is therefore the one rung whose damage half is empty *by policy* rather
166
+ * than for want of a factor to name, and the consequence below is the whole
167
+ * sentence. That is the single exception to the two-half shape, and it is an
168
+ * exception in the half that is said rather than in the half that is left out:
169
+ * the sentence still names the verdict and still names what decided it.
170
+ */
171
+ const ceilingDamage = (assessment, ceiling) => ceiling === NOTHING_AUTO_APPLIES
172
+ ? ""
173
+ : assessment.stakes.factors.map((factor) => factor.detail).join("; ");
174
+ /**
175
+ * What this deployment did about it, and on which of its thresholds.
176
+ *
177
+ * At `nothing` the threshold is the origin itself rather than a level on the
178
+ * scale, so the clause names the origin and what it is configured to apply —
179
+ * which is both what the policy did and the fact that a person is required.
180
+ */
181
+ const ceilingConsequence = (assessment, ceiling) => {
182
+ const { origin } = assessment.proposal.provenance;
183
+ if (ceiling === NOTHING_AUTO_APPLIES)
184
+ return `${origin} applies nothing without a person`;
185
+ return `this deployment holds for a person above ${origin}'s ${ceiling} ceiling`;
109
186
  };
110
187
  const confirmAboveCeiling = {
111
188
  code: "stakes-above-ceiling",
112
189
  kind: "requires-confirmation",
113
190
  fires: (assessment, policy) => {
114
191
  const ceiling = ceilingFor(policy, assessment.proposal.provenance.origin);
115
- if (!isAbove(assessment.stakes.level, ceiling))
192
+ if (!isAboveCeiling(assessment.stakes.level, ceiling))
116
193
  return null;
117
- const detail = assessment.stakes.factors.map((factor) => factor.detail).join("; ");
118
- return (detail ||
119
- `${assessment.stakes.level} stakes exceed the ${ceiling} ceiling for ${assessment.proposal.provenance.origin}`);
194
+ return ceilingDamage(assessment, ceiling);
120
195
  },
196
+ consequence: (assessment, policy) => ceilingConsequence(assessment, ceilingFor(policy, assessment.proposal.provenance.origin)),
121
197
  };
122
198
  const confirmBelowMinimumConfidence = {
123
199
  code: "confidence-below-minimum",
@@ -128,6 +204,7 @@ const confirmBelowMinimumConfidence = {
128
204
  return null;
129
205
  return `interpreter confidence ${confidence} is below ${policy.minimumConfidence}`;
130
206
  },
207
+ consequence: () => "this deployment holds for a person",
131
208
  };
132
209
  /** Nothing objected, so the change goes through. */
133
210
  const accept = (assessment, policy) => decide(assessment, policy, "accepted", {
@@ -160,9 +237,13 @@ const ESCALATION_RULES = [
160
237
  export const ESCALATION_LADDER = ESCALATION_RULES.map((rule) => rule.code);
161
238
  export const gate = (assessment, policy) => {
162
239
  for (const rule of ESCALATION_RULES) {
163
- const detail = rule.fires(assessment, policy);
164
- if (detail !== null)
165
- return decide(assessment, policy, rule.kind, { code: rule.code, detail });
240
+ const damage = rule.fires(assessment, policy);
241
+ if (damage === null)
242
+ continue;
243
+ return decide(assessment, policy, rule.kind, {
244
+ code: rule.code,
245
+ detail: sentence(damage, rule.consequence(assessment, policy)),
246
+ });
166
247
  }
167
248
  return accept(assessment, policy);
168
249
  };
@@ -7,6 +7,8 @@
7
7
  */
8
8
  export * from "./analysis.js";
9
9
  export * from "./assessment.js";
10
+ export * from "./auto-apply-ceiling.js";
11
+ export * from "./checks.js";
10
12
  export * from "./disposition.js";
11
13
  export * from "./events.js";
12
14
  export * from "./gate.js";
@@ -15,7 +17,9 @@ export * from "./interpreter.js";
15
17
  export * from "./inverse.js";
16
18
  export * from "./nesting.js";
17
19
  export * from "./pipeline.js";
20
+ export * from "./policy-change.js";
18
21
  export * from "./policy-fingerprint.js";
22
+ export * from "./policy-log.js";
19
23
  export * from "./policy-source.js";
20
24
  export * from "./policy.js";
21
25
  export * from "./proposal.js";
@@ -7,6 +7,8 @@
7
7
  */
8
8
  export * from "./analysis.js";
9
9
  export * from "./assessment.js";
10
+ export * from "./auto-apply-ceiling.js";
11
+ export * from "./checks.js";
10
12
  export * from "./disposition.js";
11
13
  export * from "./events.js";
12
14
  export * from "./gate.js";
@@ -15,7 +17,9 @@ export * from "./interpreter.js";
15
17
  export * from "./inverse.js";
16
18
  export * from "./nesting.js";
17
19
  export * from "./pipeline.js";
20
+ export * from "./policy-change.js";
18
21
  export * from "./policy-fingerprint.js";
22
+ export * from "./policy-log.js";
19
23
  export * from "./policy-source.js";
20
24
  export * from "./policy.js";
21
25
  export * from "./proposal.js";
@@ -0,0 +1,64 @@
1
+ import { z } from "zod";
2
+ import { type PrimitiveType } from "../primitive-type.js";
3
+ /**
4
+ * Why a change cannot be taken back, as data.
5
+ *
6
+ * Its own module rather than `reversibility.ts` because of who has to import
7
+ * it. The reason is *computed* there, against a tree, a policy and an inverse
8
+ * delta; it is *stored* by `disposition.ts`, which §6 reads back out of a holds
9
+ * table and validates like anything else that crossed a wire or a year. A leaf
10
+ * holding nothing but the shape lets the second import it without pulling the
11
+ * tree engine in behind it, and keeps the direction of the dependency honest:
12
+ * the stored shape does not know how it was derived.
13
+ *
14
+ * The two members ask opposite things of whoever reads them, which is why a
15
+ * code is worth keeping beside the prose. `out-of-tree-effect` means the page
16
+ * is recoverable and reality is not — go and look at the part that takes the
17
+ * payment. `retention-budget-exceeded` means reality is fine and the page is
18
+ * not — decide whether the content is worth keeping, because the rest of it
19
+ * will not come back.
20
+ */
21
+ export declare const irreversibilityReasonSchema: z.ZodDiscriminatedUnion<"code", [z.ZodObject<{
22
+ code: z.ZodLiteral<"out-of-tree-effect">;
23
+ /**
24
+ * Which of the types the change touched this policy declared reach outside
25
+ * the tree. A type name is vocabulary the deployment registered rather than
26
+ * anything a visitor typed, which is why a stored record may carry it.
27
+ */
28
+ primitiveTypes: z.ZodArray<z.ZodBranded<z.ZodString, "PrimitiveType">, "many">;
29
+ }, "strip", z.ZodTypeAny, {
30
+ code: "out-of-tree-effect";
31
+ primitiveTypes: (string & z.BRAND<"PrimitiveType">)[];
32
+ }, {
33
+ code: "out-of-tree-effect";
34
+ primitiveTypes: string[];
35
+ }>, z.ZodObject<{
36
+ code: z.ZodLiteral<"retention-budget-exceeded">;
37
+ retainedNodeCount: z.ZodNumber;
38
+ budget: z.ZodNumber;
39
+ }, "strip", z.ZodTypeAny, {
40
+ code: "retention-budget-exceeded";
41
+ retainedNodeCount: number;
42
+ budget: number;
43
+ }, {
44
+ code: "retention-budget-exceeded";
45
+ retainedNodeCount: number;
46
+ budget: number;
47
+ }>]>;
48
+ export type IrreversibilityReason = {
49
+ readonly code: "out-of-tree-effect";
50
+ readonly primitiveTypes: readonly PrimitiveType[];
51
+ } | {
52
+ readonly code: "retention-budget-exceeded";
53
+ readonly retainedNodeCount: number;
54
+ readonly budget: number;
55
+ };
56
+ /**
57
+ * The types a reason list blames, empty when no out-of-tree reason fired.
58
+ *
59
+ * Here rather than at each of its two call sites because both of them are
60
+ * narrowing a reason list on the way into a stored record, and the narrowing is
61
+ * the part a reader has to be able to check.
62
+ */
63
+ export declare const outOfTreeEffectTypesOf: (reasons: readonly IrreversibilityReason[]) => readonly PrimitiveType[];
64
+ //# sourceMappingURL=irreversibility.d.ts.map
@@ -0,0 +1,45 @@
1
+ import { z } from "zod";
2
+ import { primitiveTypeSchema } from "../primitive-type.js";
3
+ /**
4
+ * Why a change cannot be taken back, as data.
5
+ *
6
+ * Its own module rather than `reversibility.ts` because of who has to import
7
+ * it. The reason is *computed* there, against a tree, a policy and an inverse
8
+ * delta; it is *stored* by `disposition.ts`, which §6 reads back out of a holds
9
+ * table and validates like anything else that crossed a wire or a year. A leaf
10
+ * holding nothing but the shape lets the second import it without pulling the
11
+ * tree engine in behind it, and keeps the direction of the dependency honest:
12
+ * the stored shape does not know how it was derived.
13
+ *
14
+ * The two members ask opposite things of whoever reads them, which is why a
15
+ * code is worth keeping beside the prose. `out-of-tree-effect` means the page
16
+ * is recoverable and reality is not — go and look at the part that takes the
17
+ * payment. `retention-budget-exceeded` means reality is fine and the page is
18
+ * not — decide whether the content is worth keeping, because the rest of it
19
+ * will not come back.
20
+ */
21
+ export const irreversibilityReasonSchema = z.discriminatedUnion("code", [
22
+ z.object({
23
+ code: z.literal("out-of-tree-effect"),
24
+ /**
25
+ * Which of the types the change touched this policy declared reach outside
26
+ * the tree. A type name is vocabulary the deployment registered rather than
27
+ * anything a visitor typed, which is why a stored record may carry it.
28
+ */
29
+ primitiveTypes: z.array(primitiveTypeSchema),
30
+ }),
31
+ z.object({
32
+ code: z.literal("retention-budget-exceeded"),
33
+ retainedNodeCount: z.number().int().nonnegative(),
34
+ budget: z.number().int().nonnegative(),
35
+ }),
36
+ ]);
37
+ /**
38
+ * The types a reason list blames, empty when no out-of-tree reason fired.
39
+ *
40
+ * Here rather than at each of its two call sites because both of them are
41
+ * narrowing a reason list on the way into a stored record, and the narrowing is
42
+ * the part a reader has to be able to check.
43
+ */
44
+ export const outOfTreeEffectTypesOf = (reasons) => reasons.flatMap((reason) => (reason.code === "out-of-tree-effect" ? reason.primitiveTypes : []));
45
+ //# sourceMappingURL=irreversibility.js.map
@@ -25,7 +25,19 @@ export type NestedTarget = {
25
25
  readonly ancestorId: NodeId;
26
26
  readonly ancestorType: PrimitiveType;
27
27
  };
28
- /** Every target this tree puts inside another, in document order. */
28
+ /**
29
+ * Every target this tree puts inside another, in document order.
30
+ *
31
+ * The walk carries an **explicit stack** and is not recursive (0380): a page's
32
+ * depth is data, and this read answered `RangeError` rather than a fault list
33
+ * at ten thousand deep while every read and edit in `src/tree/` answered at
34
+ * five hundred thousand (0372, 0373). The deeper a tree is, the less likely
35
+ * anyone is to have found the pair by eye, so this is the read whose answer
36
+ * matters most exactly where it used to stop having one.
37
+ *
38
+ * Children are pushed in reverse so the pop order is the document order the
39
+ * recursion gave, which is the order a fault list is read in.
40
+ */
29
41
  export declare const nestedTargetsIn: (root: LoomNode, isInteractive: InteractivePredicate) => readonly NestedTarget[];
30
42
  export declare const describeNestedTarget: (nested: NestedTarget) => string;
31
43
  //# sourceMappingURL=nesting.d.ts.map
@@ -14,32 +14,49 @@ export const interactivePredicateFor = (types) => {
14
14
  return when !== undefined && isInteractiveWith(when, node.props);
15
15
  };
16
16
  };
17
- const collect = (node, enclosing, isInteractive, found) => {
18
- const target = node.kind === "element" && isInteractive(node) ? node : null;
19
- if (target && enclosing) {
20
- found.push({
21
- nodeId: target.id,
22
- type: target.type,
23
- ancestorId: enclosing.id,
24
- ancestorType: enclosing.type,
25
- });
26
- }
27
- /**
28
- * The *nearest* enclosing target, not the outermost. Three deep is two faults
29
- * rather than one, and a reviewer told about each pair that touches can read
30
- * the chain off the tree; told only about the ends, they cannot.
31
- *
32
- * Slot nodes are descended without being targets themselves — a region
33
- * projected into a linked card sits inside it exactly as a child does.
34
- */
35
- const below = target ? { id: target.id, type: target.type } : enclosing;
36
- for (const child of childrenOf(node))
37
- collect(child, below, isInteractive, found);
38
- };
39
- /** Every target this tree puts inside another, in document order. */
17
+ /**
18
+ * Every target this tree puts inside another, in document order.
19
+ *
20
+ * The walk carries an **explicit stack** and is not recursive (0380): a page's
21
+ * depth is data, and this read answered `RangeError` rather than a fault list
22
+ * at ten thousand deep while every read and edit in `src/tree/` answered at
23
+ * five hundred thousand (0372, 0373). The deeper a tree is, the less likely
24
+ * anyone is to have found the pair by eye, so this is the read whose answer
25
+ * matters most exactly where it used to stop having one.
26
+ *
27
+ * Children are pushed in reverse so the pop order is the document order the
28
+ * recursion gave, which is the order a fault list is read in.
29
+ */
40
30
  export const nestedTargetsIn = (root, isInteractive) => {
41
31
  const found = [];
42
- collect(root, null, isInteractive, found);
32
+ const pending = [{ node: root, enclosing: null }];
33
+ for (let reached = pending.pop(); reached !== undefined; reached = pending.pop()) {
34
+ const { node, enclosing } = reached;
35
+ const target = node.kind === "element" && isInteractive(node) ? node : null;
36
+ if (target && enclosing) {
37
+ found.push({
38
+ nodeId: target.id,
39
+ type: target.type,
40
+ ancestorId: enclosing.id,
41
+ ancestorType: enclosing.type,
42
+ });
43
+ }
44
+ /**
45
+ * The *nearest* enclosing target, not the outermost. Three deep is two
46
+ * faults rather than one, and a reviewer told about each pair that touches
47
+ * can read the chain off the tree; told only about the ends, they cannot.
48
+ *
49
+ * Slot nodes are descended without being targets themselves — a region
50
+ * projected into a linked card sits inside it exactly as a child does.
51
+ */
52
+ const below = target ? { id: target.id, type: target.type } : enclosing;
53
+ const children = childrenOf(node);
54
+ for (let index = children.length - 1; index >= 0; index -= 1) {
55
+ const child = children[index];
56
+ if (child)
57
+ pending.push({ node: child, enclosing: below });
58
+ }
59
+ }
43
60
  return found;
44
61
  };
45
62
  export const describeNestedTarget = (nested) => `${nested.type} ${nested.nodeId} inside ${nested.ancestorType} ${nested.ancestorId}`;
@@ -1,4 +1,6 @@
1
1
  import type { IdFactory } from "../ids.js";
2
+ import type { BindingReader } from "../render/reads.js";
3
+ import type { SlotPlacer } from "../render/slots.js";
2
4
  import type { TreeDelta } from "../tree/delta.js";
3
5
  import type { TreeError } from "../tree/errors.js";
4
6
  import type { LoomTree } from "../tree/tree.js";
@@ -48,8 +50,49 @@ export type CompositionRuntime = {
48
50
  * with a registry hands the same object to both seams and the two cannot
49
51
  * disagree about what is drawable. `propsVocabularyFor(registry)` in the SDK
50
52
  * is how one is obtained without hand-keeping it.
53
+ *
54
+ * Handing this over is recorded on every judgment it makes, as the `props`
55
+ * member of `Disposition.wiredChecks` (0248) — the policy fingerprint cannot
56
+ * see a seam, so wiring one would otherwise move a deployment's refusal rate
57
+ * and leave nothing behind that says which day it moved.
51
58
  */
52
59
  readonly propsVocabulary?: PropsVocabulary;
60
+ /**
61
+ * What this deployment's primitives read an answer under, checked before a
62
+ * delta is judged. Optional and absent by default, for every reason
63
+ * `propsVocabulary` above gives — a runtime handed none cannot tell a question
64
+ * nothing reads from one something does, and refusing on that ground is a
65
+ * choice made at the composition root rather than inherited (0179, 0208).
66
+ *
67
+ * Deliberately the renderer's own `BindingReader` rather than a second shape,
68
+ * so what the walk reports as `data-unread` is what the write path refuses. An
69
+ * SDK registry satisfies it already, which is why there is no
70
+ * `bindingReaderFor(registry)` beside `propsVocabularyFor`: the registry **is**
71
+ * one, and a helper that wrapped it would only be a place for the two to
72
+ * disagree.
73
+ *
74
+ * Recorded as the `bindings` member of `Disposition.wiredChecks`, for the
75
+ * reason above.
76
+ */
77
+ readonly bindingReader?: BindingReader;
78
+ /**
79
+ * What this deployment's primitives place a named region for, checked before
80
+ * a delta is judged. Optional and absent by default, for every reason
81
+ * `propsVocabulary` and `bindingReader` above give: a runtime handed none
82
+ * cannot tell a region a primitive places from one it drops on the floor
83
+ * (0051, 0249), and refusing on that ground is a choice made at the
84
+ * composition root rather than inherited (0179, 0252).
85
+ *
86
+ * Deliberately the renderer's own `SlotPlacer` rather than a second shape, so
87
+ * what the walk reports as `slot-unplaced` is what the write path refuses. An
88
+ * SDK registry satisfies it already, which is why there is no
89
+ * `slotPlacerFor(registry)` beside `propsVocabularyFor` — the registry **is**
90
+ * one, which is the arrangement `bindingReader` already has and for its
91
+ * reason.
92
+ *
93
+ * Recorded as the `regions` member of `Disposition.wiredChecks` (0248).
94
+ */
95
+ readonly slotPlacer?: SlotPlacer;
53
96
  };
54
97
  export type CompositionOutcome = {
55
98
  readonly kind: "applied";
@@ -68,7 +68,11 @@ const dispositionOutcome = (runtime, tree, assessment, disposition) => {
68
68
  const judgeProposal = (runtime, tree, proposal, policy) => {
69
69
  const emit = emitter(runtime, tree);
70
70
  emit({ type: "change-proposed", proposal });
71
- const assessed = assessChange(tree, proposal, policy, runtime.idFactory.deltaId(), runtime.propsVocabulary);
71
+ const assessed = assessChange(tree, proposal, policy, runtime.idFactory.deltaId(), {
72
+ propsVocabulary: runtime.propsVocabulary,
73
+ bindingReader: runtime.bindingReader,
74
+ slotPlacer: runtime.slotPlacer,
75
+ });
72
76
  if (!assessed.ok) {
73
77
  emit({ type: "assessment-failed", proposal, error: assessed.error });
74
78
  return { kind: "not-applicable", proposal, error: assessed.error };
@@ -161,7 +165,11 @@ export const confirmChange = (runtime, tree, proposal, intent) => {
161
165
  */
162
166
  const policy = runtime.policySource.resolve({ tree, intent });
163
167
  emit({ type: "policy-resolved", intentId: intent.intentId, policy });
164
- const assessed = assessChange(tree, proposal, policy, runtime.idFactory.deltaId(), runtime.propsVocabulary);
168
+ const assessed = assessChange(tree, proposal, policy, runtime.idFactory.deltaId(), {
169
+ propsVocabulary: runtime.propsVocabulary,
170
+ bindingReader: runtime.bindingReader,
171
+ slotPlacer: runtime.slotPlacer,
172
+ });
165
173
  if (!assessed.ok) {
166
174
  emit({ type: "assessment-failed", proposal, error: assessed.error });
167
175
  return { kind: "not-applicable", proposal, error: assessed.error };
@@ -0,0 +1,93 @@
1
+ import type { GatePolicy } from "./policy.js";
2
+ /**
3
+ * What one policy edit did, field by field.
4
+ *
5
+ * `policyFingerprintOf` can prove two judgments ran under different rules and
6
+ * can say nothing about *how* they differed, because a digest has no middle: two
7
+ * fingerprints either match or they do not. That is the whole of what a reader
8
+ * of a changed policy is asking — a refusal rate that moved the week somebody
9
+ * edited a policy is either explained by the edit or is a fault, and a hash
10
+ * cannot tell those apart.
11
+ *
12
+ * So this is the fingerprint's other half, and it is deliberately *derived*
13
+ * rather than stored. 0016's relationship one level up: the log is the truth and
14
+ * the reading is a view. A policy log keeps whole policies and this says what
15
+ * happened between two of them, so there is never a recorded diff free to
16
+ * disagree with the policies it claims to describe.
17
+ *
18
+ * It is pure, synchronous and reads nothing but its two arguments — the
19
+ * properties `policy-source.ts` requires of everything on the decision path, so
20
+ * a host may call this while judging rather than only while reporting.
21
+ */
22
+ /**
23
+ * Which way an edit moved the Gate.
24
+ *
25
+ * The question every reader of a policy change actually has, and the reason this
26
+ * module is more than a key-by-key comparison: *did it get easier or harder for
27
+ * a change to get through.* A calibration window that straddles an edit is
28
+ * legible exactly when this is known, and uninterpretable when it is not.
29
+ *
30
+ * - `stricter` — fewer changes get applied without asking, or more are refused.
31
+ * - `looser` — the opposite.
32
+ * - `mixed` — both, within one field. A set that gained a member and lost one
33
+ * is the common case, and reporting it as either would be a guess.
34
+ * - `incomparable` — the field has no order. Renaming the policy or editing a
35
+ * host's own vocabulary into a different, equally large list is a change with
36
+ * no direction to it, and inventing one is worse than saying so.
37
+ */
38
+ export type PolicyDirection = "stricter" | "looser" | "mixed" | "incomparable";
39
+ /** One field of `GatePolicy` that is not what it was, and what it is now. */
40
+ export type PolicyFieldChange = {
41
+ readonly field: keyof GatePolicy;
42
+ readonly direction: PolicyDirection;
43
+ /**
44
+ * What moved, in that field's own terms, for a reader.
45
+ *
46
+ * Prose, and documented as prose: a consumer that needs the values reads them
47
+ * off the two policies it already has. The same rule `Disposition.reason`
48
+ * keeps — a sentence is for a screen and never for a parser.
49
+ */
50
+ readonly detail: string;
51
+ };
52
+ /**
53
+ * What an edit did, and whether it is an edit at all.
54
+ *
55
+ * `fingerprints` is carried rather than recomputed by callers because the pair
56
+ * is what joins this reading to the judgments either side of it: a `Disposition`
57
+ * records the fingerprint it ran under, so a reader holding a change can find
58
+ * the records on both sides of it without hashing anything itself.
59
+ */
60
+ export type PolicyChange = {
61
+ /** False when the two policies differ in nothing the Gate consults. */
62
+ readonly changed: boolean;
63
+ /**
64
+ * True when the two have different names, which a host editing a policy's
65
+ * contents is under contract to produce (0033).
66
+ */
67
+ readonly renamed: boolean;
68
+ readonly fields: readonly PolicyFieldChange[];
69
+ /**
70
+ * The direction of the whole edit, folded over the fields that have one.
71
+ *
72
+ * `incomparable` fields are skipped rather than counted: an edit that tightened
73
+ * a threshold and rewrote a host vocabulary list is *stricter* in the only
74
+ * respect anything can be ordered by, and calling the pair `mixed` would hide
75
+ * the one half that is knowable. An edit whose every field is incomparable is
76
+ * itself `incomparable`, which is the honest answer and not a fallback.
77
+ */
78
+ readonly direction: PolicyDirection;
79
+ readonly fingerprints: {
80
+ readonly was: string;
81
+ readonly now: string;
82
+ };
83
+ };
84
+ /**
85
+ * What changed between two policies, and which way it moved the Gate.
86
+ *
87
+ * Takes two whole policies rather than two fingerprints, because a digest is
88
+ * one-way: the pair is the only thing that can answer this, and a log that kept
89
+ * diffs instead of policies could not answer it about a pair it had not
90
+ * anticipated.
91
+ */
92
+ export declare const policyChangeOf: (was: GatePolicy, now: GatePolicy) => PolicyChange;
93
+ //# sourceMappingURL=policy-change.d.ts.map