@jam-overture/loom 0.1.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 (401) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +743 -0
  3. package/dist/catalogue.d.ts +70 -0
  4. package/dist/catalogue.js +88 -0
  5. package/dist/cli/args.d.ts +17 -0
  6. package/dist/cli/args.js +83 -0
  7. package/dist/cli/filesystem.d.ts +15 -0
  8. package/dist/cli/filesystem.js +31 -0
  9. package/dist/cli/index.d.ts +12 -0
  10. package/dist/cli/index.js +12 -0
  11. package/dist/cli/main.d.ts +3 -0
  12. package/dist/cli/main.js +30 -0
  13. package/dist/cli/namespace.d.ts +40 -0
  14. package/dist/cli/namespace.js +40 -0
  15. package/dist/cli/plan.d.ts +84 -0
  16. package/dist/cli/plan.js +113 -0
  17. package/dist/cli/run.d.ts +17 -0
  18. package/dist/cli/run.js +75 -0
  19. package/dist/cli/templates.d.ts +43 -0
  20. package/dist/cli/templates.js +134 -0
  21. package/dist/closed-set.d.ts +34 -0
  22. package/dist/closed-set.js +34 -0
  23. package/dist/data/adapter.d.ts +123 -0
  24. package/dist/data/adapter.js +91 -0
  25. package/dist/data/binding.d.ts +48 -0
  26. package/dist/data/binding.js +39 -0
  27. package/dist/data/catalogue.d.ts +26 -0
  28. package/dist/data/catalogue.js +6 -0
  29. package/dist/data/index.d.ts +14 -0
  30. package/dist/data/index.js +14 -0
  31. package/dist/data/plan.d.ts +58 -0
  32. package/dist/data/plan.js +0 -0
  33. package/dist/data/resolution.d.ts +91 -0
  34. package/dist/data/resolution.js +96 -0
  35. package/dist/data/resolve.d.ts +46 -0
  36. package/dist/data/resolve.js +37 -0
  37. package/dist/data/source.d.ts +40 -0
  38. package/dist/data/source.js +45 -0
  39. package/dist/deadline.d.ts +57 -0
  40. package/dist/deadline.js +78 -0
  41. package/dist/frame/catalogue.d.ts +24 -0
  42. package/dist/frame/catalogue.js +5 -0
  43. package/dist/frame/index.d.ts +12 -0
  44. package/dist/frame/index.js +12 -0
  45. package/dist/frame/origin.d.ts +87 -0
  46. package/dist/frame/origin.js +114 -0
  47. package/dist/frame/resolution.d.ts +85 -0
  48. package/dist/frame/resolution.js +79 -0
  49. package/dist/grammar.d.ts +26 -0
  50. package/dist/grammar.js +28 -0
  51. package/dist/ids.d.ts +57 -0
  52. package/dist/ids.js +104 -0
  53. package/dist/index.d.ts +26 -0
  54. package/dist/index.js +26 -0
  55. package/dist/interactivity.d.ts +50 -0
  56. package/dist/interactivity.js +22 -0
  57. package/dist/interpretation/anthropic.d.ts +22 -0
  58. package/dist/interpretation/anthropic.js +76 -0
  59. package/dist/interpretation/client.d.ts +83 -0
  60. package/dist/interpretation/client.js +2 -0
  61. package/dist/interpretation/draft.d.ts +234 -0
  62. package/dist/interpretation/draft.js +84 -0
  63. package/dist/interpretation/index.d.ts +15 -0
  64. package/dist/interpretation/index.js +15 -0
  65. package/dist/interpretation/interpreter.d.ts +62 -0
  66. package/dist/interpretation/interpreter.js +151 -0
  67. package/dist/interpretation/materialize.d.ts +42 -0
  68. package/dist/interpretation/materialize.js +107 -0
  69. package/dist/interpretation/prompt.d.ts +229 -0
  70. package/dist/interpretation/prompt.js +285 -0
  71. package/dist/interpretation/render.d.ts +76 -0
  72. package/dist/interpretation/render.js +272 -0
  73. package/dist/interpretation/schema.d.ts +49 -0
  74. package/dist/interpretation/schema.js +131 -0
  75. package/dist/json.d.ts +35 -0
  76. package/dist/json.js +11 -0
  77. package/dist/paging.d.ts +60 -0
  78. package/dist/paging.js +49 -0
  79. package/dist/primitive-type.d.ts +32 -0
  80. package/dist/primitive-type.js +39 -0
  81. package/dist/render/addressing.d.ts +59 -0
  82. package/dist/render/addressing.js +60 -0
  83. package/dist/render/anchor.d.ts +105 -0
  84. package/dist/render/anchor.js +84 -0
  85. package/dist/render/behaviour-adjust.d.ts +62 -0
  86. package/dist/render/behaviour-adjust.js +78 -0
  87. package/dist/render/behaviour-copy.d.ts +53 -0
  88. package/dist/render/behaviour-copy.js +75 -0
  89. package/dist/render/behaviour-disclose.d.ts +74 -0
  90. package/dist/render/behaviour-disclose.js +77 -0
  91. package/dist/render/behaviour-present.d.ts +123 -0
  92. package/dist/render/behaviour-present.js +173 -0
  93. package/dist/render/behaviour.d.ts +243 -0
  94. package/dist/render/behaviour.js +284 -0
  95. package/dist/render/control.d.ts +81 -0
  96. package/dist/render/control.js +80 -0
  97. package/dist/render/decorative.d.ts +62 -0
  98. package/dist/render/decorative.js +2 -0
  99. package/dist/render/diagnostics.d.ts +260 -0
  100. package/dist/render/diagnostics.js +61 -0
  101. package/dist/render/disclosed.d.ts +37 -0
  102. package/dist/render/disclosed.js +37 -0
  103. package/dist/render/editable.d.ts +34 -0
  104. package/dist/render/editable.js +35 -0
  105. package/dist/render/frame.d.ts +42 -0
  106. package/dist/render/frame.js +31 -0
  107. package/dist/render/index.d.ts +35 -0
  108. package/dist/render/index.js +35 -0
  109. package/dist/render/inline-variables.d.ts +77 -0
  110. package/dist/render/inline-variables.js +220 -0
  111. package/dist/render/presented.d.ts +82 -0
  112. package/dist/render/presented.js +82 -0
  113. package/dist/render/primitive.d.ts +228 -0
  114. package/dist/render/primitive.js +36 -0
  115. package/dist/render/props.d.ts +48 -0
  116. package/dist/render/props.js +2 -0
  117. package/dist/render/reads.d.ts +73 -0
  118. package/dist/render/reads.js +45 -0
  119. package/dist/render/render.d.ts +164 -0
  120. package/dist/render/render.js +571 -0
  121. package/dist/render/request.d.ts +111 -0
  122. package/dist/render/request.js +60 -0
  123. package/dist/render/text.d.ts +91 -0
  124. package/dist/render/text.js +44 -0
  125. package/dist/render/theme.d.ts +61 -0
  126. package/dist/render/theme.js +52 -0
  127. package/dist/reserved-props.d.ts +35 -0
  128. package/dist/reserved-props.js +45 -0
  129. package/dist/result.d.ts +27 -0
  130. package/dist/result.js +30 -0
  131. package/dist/role.d.ts +71 -0
  132. package/dist/role.js +22 -0
  133. package/dist/runtime/analysis.d.ts +149 -0
  134. package/dist/runtime/analysis.js +187 -0
  135. package/dist/runtime/assessment.d.ts +35 -0
  136. package/dist/runtime/assessment.js +13 -0
  137. package/dist/runtime/disposition.d.ts +102 -0
  138. package/dist/runtime/disposition.js +59 -0
  139. package/dist/runtime/events.d.ts +187 -0
  140. package/dist/runtime/events.js +7 -0
  141. package/dist/runtime/gate.d.ts +43 -0
  142. package/dist/runtime/gate.js +169 -0
  143. package/dist/runtime/index.d.ts +27 -0
  144. package/dist/runtime/index.js +27 -0
  145. package/dist/runtime/intent.d.ts +60 -0
  146. package/dist/runtime/intent.js +36 -0
  147. package/dist/runtime/interpreter.d.ts +117 -0
  148. package/dist/runtime/interpreter.js +46 -0
  149. package/dist/runtime/inverse-interpreter.d.ts +90 -0
  150. package/dist/runtime/inverse-interpreter.js +56 -0
  151. package/dist/runtime/inverse.d.ts +87 -0
  152. package/dist/runtime/inverse.js +48 -0
  153. package/dist/runtime/narration.d.ts +24 -0
  154. package/dist/runtime/narration.js +36 -0
  155. package/dist/runtime/nesting.d.ts +31 -0
  156. package/dist/runtime/nesting.js +46 -0
  157. package/dist/runtime/pipeline.d.ts +124 -0
  158. package/dist/runtime/pipeline.js +178 -0
  159. package/dist/runtime/policy-fingerprint.d.ts +29 -0
  160. package/dist/runtime/policy-fingerprint.js +119 -0
  161. package/dist/runtime/policy-source.d.ts +42 -0
  162. package/dist/runtime/policy-source.js +8 -0
  163. package/dist/runtime/policy.d.ts +156 -0
  164. package/dist/runtime/policy.js +107 -0
  165. package/dist/runtime/proposal.d.ts +423 -0
  166. package/dist/runtime/proposal.js +109 -0
  167. package/dist/runtime/redirection.d.ts +53 -0
  168. package/dist/runtime/redirection.js +38 -0
  169. package/dist/runtime/repointing.d.ts +71 -0
  170. package/dist/runtime/repointing.js +0 -0
  171. package/dist/runtime/reversibility.d.ts +36 -0
  172. package/dist/runtime/reversibility.js +39 -0
  173. package/dist/runtime/stake-level.d.ts +33 -0
  174. package/dist/runtime/stake-level.js +58 -0
  175. package/dist/runtime/stakes.d.ts +47 -0
  176. package/dist/runtime/stakes.js +305 -0
  177. package/dist/runtime/vocabulary.d.ts +122 -0
  178. package/dist/runtime/vocabulary.js +87 -0
  179. package/dist/sdk/audit.d.ts +195 -0
  180. package/dist/sdk/audit.js +128 -0
  181. package/dist/sdk/catalogue.d.ts +37 -0
  182. package/dist/sdk/catalogue.js +16 -0
  183. package/dist/sdk/conformance.d.ts +342 -0
  184. package/dist/sdk/conformance.js +494 -0
  185. package/dist/sdk/copy.d.ts +105 -0
  186. package/dist/sdk/copy.js +90 -0
  187. package/dist/sdk/definition.d.ts +242 -0
  188. package/dist/sdk/definition.js +64 -0
  189. package/dist/sdk/index.d.ts +19 -0
  190. package/dist/sdk/index.js +19 -0
  191. package/dist/sdk/interactivity.d.ts +29 -0
  192. package/dist/sdk/interactivity.js +34 -0
  193. package/dist/sdk/pairings.d.ts +124 -0
  194. package/dist/sdk/pairings.js +81 -0
  195. package/dist/sdk/registry.d.ts +162 -0
  196. package/dist/sdk/registry.js +329 -0
  197. package/dist/sdk/selection.d.ts +46 -0
  198. package/dist/sdk/selection.js +24 -0
  199. package/dist/sdk/text.d.ts +100 -0
  200. package/dist/sdk/text.js +105 -0
  201. package/dist/sdk/vocabulary.d.ts +39 -0
  202. package/dist/sdk/vocabulary.js +36 -0
  203. package/dist/signals/broadcast.d.ts +134 -0
  204. package/dist/signals/broadcast.js +451 -0
  205. package/dist/signals/collect.d.ts +184 -0
  206. package/dist/signals/collect.js +196 -0
  207. package/dist/signals/deliver.d.ts +64 -0
  208. package/dist/signals/deliver.js +85 -0
  209. package/dist/signals/fold.d.ts +112 -0
  210. package/dist/signals/fold.js +76 -0
  211. package/dist/signals/index.d.ts +31 -0
  212. package/dist/signals/index.js +31 -0
  213. package/dist/signals/ingest.d.ts +51 -0
  214. package/dist/signals/ingest.js +70 -0
  215. package/dist/signals/intake.d.ts +149 -0
  216. package/dist/signals/intake.js +154 -0
  217. package/dist/signals/journal.d.ts +94 -0
  218. package/dist/signals/journal.js +11 -0
  219. package/dist/signals/kinds.d.ts +22 -0
  220. package/dist/signals/kinds.js +22 -0
  221. package/dist/signals/ledger.d.ts +46 -0
  222. package/dist/signals/ledger.js +81 -0
  223. package/dist/signals/memory.d.ts +17 -0
  224. package/dist/signals/memory.js +99 -0
  225. package/dist/signals/migrate.d.ts +27 -0
  226. package/dist/signals/migrate.js +78 -0
  227. package/dist/signals/postgres.d.ts +7 -0
  228. package/dist/signals/postgres.js +295 -0
  229. package/dist/signals/rollup.d.ts +142 -0
  230. package/dist/signals/rollup.js +0 -0
  231. package/dist/signals/schema.d.ts +534 -0
  232. package/dist/signals/schema.js +92 -0
  233. package/dist/signals/signal.d.ts +381 -0
  234. package/dist/signals/signal.js +150 -0
  235. package/dist/signals/tally.d.ts +70 -0
  236. package/dist/signals/tally.js +2 -0
  237. package/dist/signals/view.d.ts +51 -0
  238. package/dist/signals/view.js +54 -0
  239. package/dist/store/attribution.d.ts +125 -0
  240. package/dist/store/attribution.js +116 -0
  241. package/dist/store/database.d.ts +14 -0
  242. package/dist/store/database.js +2 -0
  243. package/dist/store/driver.d.ts +29 -0
  244. package/dist/store/driver.js +39 -0
  245. package/dist/store/errors.d.ts +56 -0
  246. package/dist/store/errors.js +37 -0
  247. package/dist/store/index.d.ts +16 -0
  248. package/dist/store/index.js +16 -0
  249. package/dist/store/memory.d.ts +3 -0
  250. package/dist/store/memory.js +115 -0
  251. package/dist/store/migrate.d.ts +54 -0
  252. package/dist/store/migrate.js +122 -0
  253. package/dist/store/postgres-holds.d.ts +4 -0
  254. package/dist/store/postgres-holds.js +192 -0
  255. package/dist/store/postgres.d.ts +8 -0
  256. package/dist/store/postgres.js +262 -0
  257. package/dist/store/replay.d.ts +94 -0
  258. package/dist/store/replay.js +82 -0
  259. package/dist/store/revert.d.ts +116 -0
  260. package/dist/store/revert.js +243 -0
  261. package/dist/store/schema.d.ts +371 -0
  262. package/dist/store/schema.js +78 -0
  263. package/dist/store/source.d.ts +23 -0
  264. package/dist/store/source.js +37 -0
  265. package/dist/store/store.d.ts +231 -0
  266. package/dist/store/store.js +52 -0
  267. package/dist/store/undone.d.ts +18 -0
  268. package/dist/store/undone.js +89 -0
  269. package/dist/submit/catalogue.d.ts +20 -0
  270. package/dist/submit/catalogue.js +5 -0
  271. package/dist/submit/declaration.d.ts +39 -0
  272. package/dist/submit/declaration.js +30 -0
  273. package/dist/submit/endpoint.d.ts +131 -0
  274. package/dist/submit/endpoint.js +160 -0
  275. package/dist/submit/index.d.ts +13 -0
  276. package/dist/submit/index.js +13 -0
  277. package/dist/submit/plan.d.ts +49 -0
  278. package/dist/submit/plan.js +47 -0
  279. package/dist/submit/resolution.d.ts +61 -0
  280. package/dist/submit/resolution.js +64 -0
  281. package/dist/submit/resolve.d.ts +45 -0
  282. package/dist/submit/resolve.js +36 -0
  283. package/dist/telemetry/calibration.d.ts +132 -0
  284. package/dist/telemetry/calibration.js +151 -0
  285. package/dist/telemetry/episode.d.ts +140 -0
  286. package/dist/telemetry/episode.js +272 -0
  287. package/dist/telemetry/event.d.ts +2310 -0
  288. package/dist/telemetry/event.js +405 -0
  289. package/dist/telemetry/index.d.ts +15 -0
  290. package/dist/telemetry/index.js +15 -0
  291. package/dist/telemetry/journal.d.ts +116 -0
  292. package/dist/telemetry/journal.js +11 -0
  293. package/dist/telemetry/memory.d.ts +24 -0
  294. package/dist/telemetry/memory.js +75 -0
  295. package/dist/telemetry/migrate.d.ts +26 -0
  296. package/dist/telemetry/migrate.js +40 -0
  297. package/dist/telemetry/postgres.d.ts +6 -0
  298. package/dist/telemetry/postgres.js +139 -0
  299. package/dist/telemetry/retention.d.ts +131 -0
  300. package/dist/telemetry/retention.js +217 -0
  301. package/dist/telemetry/schema.d.ts +113 -0
  302. package/dist/telemetry/schema.js +33 -0
  303. package/dist/telemetry/sink.d.ts +42 -0
  304. package/dist/telemetry/sink.js +61 -0
  305. package/dist/testing/contracts.d.ts +34 -0
  306. package/dist/testing/contracts.js +34 -0
  307. package/dist/testing/definitions.d.ts +15 -0
  308. package/dist/testing/definitions.js +48 -0
  309. package/dist/testing/doubles.d.ts +94 -0
  310. package/dist/testing/doubles.js +141 -0
  311. package/dist/testing/episode-harness.d.ts +49 -0
  312. package/dist/testing/episode-harness.js +65 -0
  313. package/dist/testing/filesystem.d.ts +17 -0
  314. package/dist/testing/filesystem.js +17 -0
  315. package/dist/testing/fixtures.d.ts +57 -0
  316. package/dist/testing/fixtures.js +84 -0
  317. package/dist/testing/hold-contract.d.ts +19 -0
  318. package/dist/testing/hold-contract.js +374 -0
  319. package/dist/testing/index.d.ts +41 -0
  320. package/dist/testing/index.js +41 -0
  321. package/dist/testing/journal-contract.d.ts +17 -0
  322. package/dist/testing/journal-contract.js +353 -0
  323. package/dist/testing/model-replies.d.ts +34 -0
  324. package/dist/testing/model-replies.js +101 -0
  325. package/dist/testing/primitives.d.ts +7 -0
  326. package/dist/testing/primitives.js +29 -0
  327. package/dist/testing/reader-signal-contract.d.ts +38 -0
  328. package/dist/testing/reader-signal-contract.js +318 -0
  329. package/dist/testing/row-security.d.ts +17 -0
  330. package/dist/testing/row-security.js +21 -0
  331. package/dist/testing/store-contract.d.ts +25 -0
  332. package/dist/testing/store-contract.js +500 -0
  333. package/dist/theme/apply.d.ts +17 -0
  334. package/dist/theme/apply.js +60 -0
  335. package/dist/theme/contrast.d.ts +197 -0
  336. package/dist/theme/contrast.js +259 -0
  337. package/dist/theme/derive.d.ts +77 -0
  338. package/dist/theme/derive.js +167 -0
  339. package/dist/theme/faces.d.ts +73 -0
  340. package/dist/theme/faces.js +119 -0
  341. package/dist/theme/font-packs.d.ts +25 -0
  342. package/dist/theme/font-packs.js +257 -0
  343. package/dist/theme/index.d.ts +20 -0
  344. package/dist/theme/index.js +20 -0
  345. package/dist/theme/lab.d.ts +30 -0
  346. package/dist/theme/lab.js +46 -0
  347. package/dist/theme/library.d.ts +114 -0
  348. package/dist/theme/library.js +300 -0
  349. package/dist/theme/measure.d.ts +144 -0
  350. package/dist/theme/measure.js +145 -0
  351. package/dist/theme/palettes.d.ts +64 -0
  352. package/dist/theme/palettes.js +497 -0
  353. package/dist/theme/registry.d.ts +59 -0
  354. package/dist/theme/registry.js +60 -0
  355. package/dist/theme/separation.d.ts +177 -0
  356. package/dist/theme/separation.js +203 -0
  357. package/dist/theme/style-presets.d.ts +60 -0
  358. package/dist/theme/style-presets.js +124 -0
  359. package/dist/theme/theme.d.ts +253 -0
  360. package/dist/theme/theme.js +171 -0
  361. package/dist/tree/apply.d.ts +16 -0
  362. package/dist/tree/apply.js +104 -0
  363. package/dist/tree/builders.d.ts +19 -0
  364. package/dist/tree/builders.js +20 -0
  365. package/dist/tree/compare.d.ts +68 -0
  366. package/dist/tree/compare.js +75 -0
  367. package/dist/tree/configuration.d.ts +25 -0
  368. package/dist/tree/configuration.js +108 -0
  369. package/dist/tree/delta.d.ts +288 -0
  370. package/dist/tree/delta.js +88 -0
  371. package/dist/tree/errors.d.ts +69 -0
  372. package/dist/tree/errors.js +34 -0
  373. package/dist/tree/identity.d.ts +117 -0
  374. package/dist/tree/identity.js +145 -0
  375. package/dist/tree/index.d.ts +21 -0
  376. package/dist/tree/index.js +21 -0
  377. package/dist/tree/inverse.d.ts +24 -0
  378. package/dist/tree/inverse.js +112 -0
  379. package/dist/tree/mutation.d.ts +18 -0
  380. package/dist/tree/mutation.js +49 -0
  381. package/dist/tree/naming.d.ts +4 -0
  382. package/dist/tree/naming.js +35 -0
  383. package/dist/tree/navigation.d.ts +38 -0
  384. package/dist/tree/navigation.js +83 -0
  385. package/dist/tree/node.d.ts +103 -0
  386. package/dist/tree/node.js +46 -0
  387. package/dist/tree/outline.d.ts +28 -0
  388. package/dist/tree/outline.js +10 -0
  389. package/dist/tree/tree.d.ts +83 -0
  390. package/dist/tree/tree.js +62 -0
  391. package/dist/write/commit.d.ts +124 -0
  392. package/dist/write/commit.js +234 -0
  393. package/dist/write/held.d.ts +674 -0
  394. package/dist/write/held.js +185 -0
  395. package/dist/write/index.d.ts +11 -0
  396. package/dist/write/index.js +11 -0
  397. package/dist/write/liveness.d.ts +132 -0
  398. package/dist/write/liveness.js +91 -0
  399. package/dist/write/revert.d.ts +79 -0
  400. package/dist/write/revert.js +134 -0
  401. package/package.json +160 -0
@@ -0,0 +1,71 @@
1
+ import type { BindingName } from "../data/source.js";
2
+ import type { NodeId } from "../ids.js";
3
+ import type { LoomNode } from "../tree/node.js";
4
+ /**
5
+ * Where a change moves what a node asks for.
6
+ *
7
+ * [0058](../../decisions/0058-a-binding-is-a-question-the-tree-asks-answered-before-the-walk.md)
8
+ * keeps the answer out of the tree, so a proposal cannot invent data to show:
9
+ * `loom:data` names a registered source and the parameters to ask it with, and
10
+ * nothing else reaches the page. That seam holds whatever a delta does to it,
11
+ * and it is not the whole question. A `configure` that moves a binding from
12
+ * `catalogue.services` to `orders.mine` names two sources the host registered
13
+ * on purpose, authors no query, and still puts different data in front of the
14
+ * next stranger who loads the page.
15
+ *
16
+ * This is `redirection.ts` with one word changed, and the two modules are the
17
+ * two ends of the same pipe: that one measures where a visitor's data *goes*,
18
+ * this one measures which of the host's data *arrives*. The analysis reports a
19
+ * repointing today as a configured prop key like any other.
20
+ */
21
+ /** What makes one binding's question different from the one it replaced. */
22
+ export type RepointingKind = "source" | "params";
23
+ /** One node's question, moved from one registered source to another. */
24
+ export type RepointedBinding = {
25
+ readonly nodeId: NodeId;
26
+ readonly name: BindingName;
27
+ readonly kind: RepointingKind;
28
+ readonly from: string;
29
+ readonly to: string;
30
+ };
31
+ export declare const describeRepointedBinding: (repointed: RepointedBinding) => string;
32
+ /**
33
+ * Every question this change moves: a node that asked something before and asks
34
+ * something else, under the same name, after.
35
+ *
36
+ * Measured between the two trees rather than off the operations, and the
37
+ * inclusion rules are `redirectedSubmissionsBetween`'s, for its reasons:
38
+ *
39
+ * - **A binding that appears where there was none is not repointed.** An
40
+ * `insert` of a card reading `catalogue.services`, or a `configure` that gives
41
+ * an unbound node a question, is a region that showed nothing before. Nobody's
42
+ * expectation about what is on the page is being moved.
43
+ * - **A binding that disappears is not repointed either.** That region stops
44
+ * binding, which is breakage the shape factors already measure.
45
+ * - **A declaration that stops parsing reads as a loss**, because that is what
46
+ * the page does with it: `planDataIn` reports it as a problem and the node
47
+ * renders unbound. A repointing has to be somewhere different data will
48
+ * actually arrive.
49
+ *
50
+ * **Params count, and that is the one place this is not a transcription of the
51
+ * submission case.** A submission names a destination and carries no parameters,
52
+ * so there is nothing there to move; a binding's params are half of its
53
+ * question, and the framework's own documented example — `profile.field` asked
54
+ * with `{ "field": "bio" }` — selects which of a host's data comes out using
55
+ * nothing but a param. Weighing the source alone would let
56
+ * `{ "field": "bio" }` become `{ "field": "salary" }` unremarked, which is the
57
+ * exact thing this factor exists to catch, on the very example the reference
58
+ * documentation teaches it with (0163).
59
+ *
60
+ * The runtime cannot tell a param that *selects* data from one that merely
61
+ * shapes it — that would take vocabulary from the source registry, and this
62
+ * stays host-independent for the reason `redirection.ts` gives. So an ambiguous
63
+ * param change reads as selection, which is the safe direction: the cost is a
64
+ * confirmation on a widened `limit`, and the cost the other way is the salary
65
+ * field.
66
+ *
67
+ * Host-independent, and so needs no vocabulary: `loom:data` is the runtime's own
68
+ * key, and both sources were registered by the host in either case.
69
+ */
70
+ export declare const repointedBindingsBetween: (before: LoomNode, after: LoomNode) => readonly RepointedBinding[];
71
+ //# sourceMappingURL=repointing.d.ts.map
Binary file
@@ -0,0 +1,36 @@
1
+ import type { DeltaId } from "../ids.js";
2
+ import type { PrimitiveType } from "../primitive-type.js";
3
+ import { type Result } from "../result.js";
4
+ import type { TreeDelta } from "../tree/delta.js";
5
+ import type { TreeError } from "../tree/errors.js";
6
+ import type { LoomTree } from "../tree/tree.js";
7
+ import type { ChangeAnalysis } from "./analysis.js";
8
+ import type { GatePolicy } from "./policy.js";
9
+ /**
10
+ * Reversibility is computed, not guessed: the inverse delta is produced up
11
+ * front, so "can this be undone" is answered by handing over the thing that
12
+ * undoes it.
13
+ *
14
+ * At tree level an inverse always exists. What makes a change *irreversible* is
15
+ * either that undoing the tree would not undo reality — a primitive whose
16
+ * configuration reaches a payment flow or a sent message — or that the inverse
17
+ * would have to retain more content than the runtime is willing to hold.
18
+ */
19
+ export type IrreversibilityReason = {
20
+ readonly code: "out-of-tree-effect";
21
+ readonly primitiveTypes: readonly PrimitiveType[];
22
+ } | {
23
+ readonly code: "retention-budget-exceeded";
24
+ readonly retainedNodeCount: number;
25
+ readonly budget: number;
26
+ };
27
+ export type Reversibility = {
28
+ readonly reversible: boolean;
29
+ /** The tree-level undo. Present even when `reversible` is false. */
30
+ readonly inverse: TreeDelta;
31
+ /** Nodes the inverse must carry — the content a removal destroyed. */
32
+ readonly retainedNodeCount: number;
33
+ readonly reasons: readonly IrreversibilityReason[];
34
+ };
35
+ export declare const assessReversibility: (tree: LoomTree, delta: TreeDelta, analysis: ChangeAnalysis, policy: GatePolicy, inverseDeltaId: DeltaId) => Result<Reversibility, TreeError>;
36
+ //# sourceMappingURL=reversibility.d.ts.map
@@ -0,0 +1,39 @@
1
+ import { mapResult } from "../result.js";
2
+ import { invertDelta } from "../tree/inverse.js";
3
+ const irreversibilityReasons = (analysis, policy) => {
4
+ /**
5
+ * Relocated types count here as well as touched ones. Whether moving a live
6
+ * payment flow fires anything outside the tree is genuinely open, and
7
+ * phrasing must not decide it: a move that named the checkout was once
8
+ * irreversible while one that named its parent was not (0044). Where
9
+ * phrasing-independence forces a single answer, this takes the conservative
10
+ * one — a change wrongly called irreversible is offered for confirmation, and
11
+ * one wrongly called reversible is applied.
12
+ */
13
+ const outOfTree = [...analysis.touchedPrimitiveTypes, ...analysis.relocatedPrimitiveTypes].filter((type, index, types) => types.indexOf(type) === index && policy.outOfTreeEffectTypes.includes(type));
14
+ const overBudget = analysis.removedNodeCount > policy.inverseRetentionBudget;
15
+ return [
16
+ ...(outOfTree.length > 0
17
+ ? [{ code: "out-of-tree-effect", primitiveTypes: outOfTree }]
18
+ : []),
19
+ ...(overBudget
20
+ ? [
21
+ {
22
+ code: "retention-budget-exceeded",
23
+ retainedNodeCount: analysis.removedNodeCount,
24
+ budget: policy.inverseRetentionBudget,
25
+ },
26
+ ]
27
+ : []),
28
+ ];
29
+ };
30
+ export const assessReversibility = (tree, delta, analysis, policy, inverseDeltaId) => mapResult(invertDelta(tree, delta, inverseDeltaId), (inverse) => {
31
+ const reasons = irreversibilityReasons(analysis, policy);
32
+ return {
33
+ reversible: reasons.length === 0,
34
+ inverse,
35
+ retainedNodeCount: analysis.removedNodeCount,
36
+ reasons,
37
+ };
38
+ });
39
+ //# sourceMappingURL=reversibility.js.map
@@ -0,0 +1,33 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * The scale the gate weighs a change on, and the order it compares two of them
4
+ * in.
5
+ *
6
+ * It lives on its own because both halves of the runtime read it and neither
7
+ * owns it: the analysis assigns a level, the policy has a ceiling, and a
8
+ * comparison between the two is the whole of the verdict.
9
+ */
10
+ /**
11
+ * How much damage a change does if it turns out to be wrong. Four levels is
12
+ * enough to separate "just do it" from "ask first" from "refuse", with one
13
+ * level of headroom in between.
14
+ */
15
+ export declare const stakeLevelSchema: z.ZodEnum<["low", "medium", "high", "critical"]>;
16
+ export type StakeLevel = z.infer<typeof stakeLevelSchema>;
17
+ /**
18
+ * The scale in severity order, which is the order and not merely the set.
19
+ *
20
+ * Checked for completeness where it is written rather than by a test, because a
21
+ * test that holds a list against a second hand-written copy of the same four
22
+ * strings fails when somebody edits the copy and not when somebody edits the
23
+ * union. The order stays spelled out: it is arithmetic the Gate reads, and
24
+ * deriving it from `stakeLevelSchema.options` would make the order a member is
25
+ * declared in load-bearing for what the Gate does about it (0166).
26
+ */
27
+ export declare const STAKE_ORDER: readonly StakeLevel[];
28
+ export declare const compareStakes: (left: StakeLevel, right: StakeLevel) => number;
29
+ export declare const isAtLeast: (level: StakeLevel, floor: StakeLevel) => boolean;
30
+ export declare const isAbove: (level: StakeLevel, ceiling: StakeLevel) => boolean;
31
+ /** The highest level present, or `low` when nothing raised a concern. */
32
+ export declare const highestStake: (levels: readonly StakeLevel[]) => StakeLevel;
33
+ //# sourceMappingURL=stake-level.d.ts.map
@@ -0,0 +1,58 @@
1
+ import { z } from "zod";
2
+ import { everyMemberOf } from "../closed-set.js";
3
+ /**
4
+ * The scale the gate weighs a change on, and the order it compares two of them
5
+ * in.
6
+ *
7
+ * It lives on its own because both halves of the runtime read it and neither
8
+ * owns it: the analysis assigns a level, the policy has a ceiling, and a
9
+ * comparison between the two is the whole of the verdict.
10
+ */
11
+ /**
12
+ * How much damage a change does if it turns out to be wrong. Four levels is
13
+ * enough to separate "just do it" from "ask first" from "refuse", with one
14
+ * level of headroom in between.
15
+ */
16
+ export const stakeLevelSchema = z.enum(["low", "medium", "high", "critical"]);
17
+ /**
18
+ * The scale in severity order, which is the order and not merely the set.
19
+ *
20
+ * Checked for completeness where it is written rather than by a test, because a
21
+ * test that holds a list against a second hand-written copy of the same four
22
+ * strings fails when somebody edits the copy and not when somebody edits the
23
+ * union. The order stays spelled out: it is arithmetic the Gate reads, and
24
+ * deriving it from `stakeLevelSchema.options` would make the order a member is
25
+ * declared in load-bearing for what the Gate does about it (0166).
26
+ */
27
+ export const STAKE_ORDER = everyMemberOf()([
28
+ "low",
29
+ "medium",
30
+ "high",
31
+ "critical",
32
+ ]);
33
+ /**
34
+ * Where a level sits on the scale.
35
+ *
36
+ * `indexOf` answers `-1` for a level this list does not name, which ranks it
37
+ * *beneath* `low` — so every comparison below answers the reassuring `false`,
38
+ * both of the Gate's stakes rules stay silent, and the one level it could not
39
+ * weigh is the one it waves through. Measured: under `defaultGatePolicy` an
40
+ * unplaceable level is `accepted / within-policy` where `critical` is refused.
41
+ *
42
+ * The list above is now complete at compile time, so the route that worried the
43
+ * finding — a fifth member added to the schema — stops the declaration
44
+ * compiling before it can reach here. What is left is a level that arrives
45
+ * without passing through the types at all: cast at a seam, or read back off a
46
+ * record a newer deployment wrote. Ranking that at the top of the scale rather
47
+ * than beneath it is the remaining half, and it is blocked rather than
48
+ * forgotten: lesson 25 teaches this arithmetic as its worked example and
49
+ * live-checks the transcript, so the lesson's rewrite lands first. Filed
50
+ * 2026-09-17.
51
+ */
52
+ const rankOf = (level) => STAKE_ORDER.indexOf(level);
53
+ export const compareStakes = (left, right) => rankOf(left) - rankOf(right);
54
+ export const isAtLeast = (level, floor) => compareStakes(level, floor) >= 0;
55
+ export const isAbove = (level, ceiling) => compareStakes(level, ceiling) > 0;
56
+ /** The highest level present, or `low` when nothing raised a concern. */
57
+ export const highestStake = (levels) => levels.reduce((highest, level) => (isAbove(level, highest) ? level : highest), "low");
58
+ //# sourceMappingURL=stake-level.js.map
@@ -0,0 +1,47 @@
1
+ import type { ChangeAnalysis } from "./analysis.js";
2
+ import type { GatePolicy } from "./policy.js";
3
+ import type { DiscardedWork } from "./proposal.js";
4
+ import { type StakeLevel } from "./stake-level.js";
5
+ /**
6
+ * Stakes assessment: facts plus policy in, a level plus its reasons out.
7
+ *
8
+ * Every factor is recorded rather than collapsed, so a disposition can explain
9
+ * itself. "High stakes" is not useful feedback; "this removes 14 nodes and
10
+ * touches commerce.checkout" is.
11
+ *
12
+ * Stakes measure damage only. Whether a change can be taken back is a separate
13
+ * axis assessed separately — a change can be devastating and trivially
14
+ * reversible, or tiny and permanent, and the Gate needs to see those two
15
+ * properties independently rather than pre-blended into one number.
16
+ *
17
+ * Every factor but one is a fact about the delta against the tree. The
18
+ * exception, `discards-later-work`, is a fact about the log the delta was
19
+ * computed from, which no amount of looking at the delta can recover (0035).
20
+ */
21
+ export type StakeFactorCode = "protected-type-removed" | "protected-type-touched" | "protected-type-relocated" | "protected-prop-configured" | "large-removal" | "broad-change" | "shallow-structural-change" | "discards-later-work" | "nested-target" | "unknown-primitive" | "invalid-props" | "redirected-submission" | "repointed-binding";
22
+ export type StakeFactor = {
23
+ readonly code: StakeFactorCode;
24
+ readonly level: StakeLevel;
25
+ readonly detail: string;
26
+ };
27
+ export type StakeAssessment = {
28
+ readonly level: StakeLevel;
29
+ readonly factors: readonly StakeFactor[];
30
+ };
31
+ /**
32
+ * Everything the damage estimate is computed from: what the delta does, and
33
+ * what its author declared it writes over.
34
+ *
35
+ * A record rather than a trailing argument, for the reason `Commit.answeredBy`
36
+ * gives: an input that can be left off the end is one that will be, and leaving
37
+ * this one off silently lowers the stakes of a change that discards work.
38
+ */
39
+ export type StakeInput = {
40
+ readonly analysis: ChangeAnalysis;
41
+ /** Empty when the proposal declared nothing, which is not the same as nothing. */
42
+ readonly discards: readonly DiscardedWork[];
43
+ };
44
+ export declare const assessStakes: (input: StakeInput, policy: GatePolicy) => StakeAssessment;
45
+ /** The factor with this code, for a caller that needs the reason and not the level. */
46
+ export declare const stakeFactor: (stakes: StakeAssessment, code: StakeFactorCode) => StakeFactor | undefined;
47
+ //# sourceMappingURL=stakes.d.ts.map
@@ -0,0 +1,305 @@
1
+ import { describeNestedTarget } from "./nesting.js";
2
+ import { describeRedirectedSubmission } from "./redirection.js";
3
+ import { describeRepointedBinding } from "./repointing.js";
4
+ import { describeInvalidProps, describeUnknownPrimitive } from "./vocabulary.js";
5
+ import { highestStake } from "./stake-level.js";
6
+ const intersect = (candidates, declared) => candidates.filter((candidate) => declared.includes(candidate));
7
+ /** Destroying a protected primitive outranks merely reconfiguring one. */
8
+ const protectedTypeRemoved = ({ analysis }, policy) => {
9
+ const matches = intersect(analysis.removedPrimitiveTypes, policy.protectedPrimitiveTypes);
10
+ if (matches.length === 0)
11
+ return null;
12
+ return {
13
+ code: "protected-type-removed",
14
+ level: "critical",
15
+ detail: `destroys protected ${matches.join(", ")}`,
16
+ };
17
+ };
18
+ const protectedTypeTouched = ({ analysis }, policy) => {
19
+ const matches = intersect(analysis.touchedPrimitiveTypes, policy.protectedPrimitiveTypes);
20
+ if (matches.length === 0)
21
+ return null;
22
+ return {
23
+ code: "protected-type-touched",
24
+ level: "high",
25
+ detail: `touches protected ${matches.join(", ")}`,
26
+ };
27
+ };
28
+ /**
29
+ * Moving a protected primitive ranks with rewriting one, not with destroying
30
+ * one: the node survives intact and the position is what changed. It is a
31
+ * separate factor rather than a wider reading of `protected-type-touched`
32
+ * because the two sentences a reviewer needs are different — one says the card
33
+ * was rewritten, the other says it is somewhere else now (0044).
34
+ */
35
+ const protectedTypeRelocated = ({ analysis }, policy) => {
36
+ const matches = intersect(analysis.relocatedPrimitiveTypes, policy.protectedPrimitiveTypes);
37
+ if (matches.length === 0)
38
+ return null;
39
+ return {
40
+ code: "protected-type-relocated",
41
+ level: "high",
42
+ detail: `relocates protected ${matches.join(", ")}`,
43
+ };
44
+ };
45
+ const protectedProp = ({ analysis }, policy) => {
46
+ const matches = intersect(analysis.configuredPropKeys, policy.protectedPropKeys);
47
+ if (matches.length === 0)
48
+ return null;
49
+ return {
50
+ code: "protected-prop-configured",
51
+ level: "high",
52
+ detail: `configures protected ${matches.join(", ")}`,
53
+ };
54
+ };
55
+ const largeRemoval = ({ analysis }, policy) => {
56
+ const { removedNodeCount } = analysis;
57
+ const { removalThresholds } = policy;
58
+ if (removedNodeCount >= removalThresholds.high) {
59
+ return {
60
+ code: "large-removal",
61
+ level: "high",
62
+ detail: `removes ${removedNodeCount} nodes`,
63
+ };
64
+ }
65
+ if (removedNodeCount >= removalThresholds.medium) {
66
+ return {
67
+ code: "large-removal",
68
+ level: "medium",
69
+ detail: `removes ${removedNodeCount} nodes`,
70
+ };
71
+ }
72
+ return null;
73
+ };
74
+ const broadChange = ({ analysis }, policy) => {
75
+ const touched = analysis.affectedNodeIds.length;
76
+ if (touched < policy.breadthThreshold)
77
+ return null;
78
+ return { code: "broad-change", level: "medium", detail: `touches ${touched} nodes` };
79
+ };
80
+ const isStructural = (analysis) => analysis.insertedNodeCount + analysis.removedNodeCount + analysis.movedNodeCount > 0;
81
+ const shallowStructuralChange = ({ analysis }, policy) => {
82
+ if (!isStructural(analysis))
83
+ return null;
84
+ if (analysis.shallowestAffectedDepth > policy.shallowDepthThreshold)
85
+ return null;
86
+ return {
87
+ code: "shallow-structural-change",
88
+ level: "medium",
89
+ detail: `restructures at depth ${analysis.shallowestAffectedDepth}`,
90
+ };
91
+ };
92
+ /**
93
+ * Work this change writes over, as damage.
94
+ *
95
+ * `high` and not `critical`: critical is where the refusal floor sits by
96
+ * default, and a change that discards work is one a person should be allowed to
97
+ * decide about rather than one nobody may make. A host that disagrees lowers its
98
+ * refusal floor to `high` and gets a refusal, which is the composition 0002
99
+ * asks for instead of a second knob.
100
+ *
101
+ * Host-independent, so there is no vocabulary knob: whether a revision counts as
102
+ * work does not depend on which primitives a deployment cares about.
103
+ */
104
+ const discardsLaterWork = ({ discards }) => {
105
+ if (discards.length === 0)
106
+ return null;
107
+ const revisions = discards.map((discarded) => discarded.revision);
108
+ const nodes = new Set(discards.flatMap((discarded) => discarded.nodeIds));
109
+ return {
110
+ code: "discards-later-work",
111
+ level: "high",
112
+ detail: `discards work from revision${revisions.length === 1 ? "" : "s"} ${revisions.join(", ")} at ${nodes.size} node${nodes.size === 1 ? "" : "s"}`,
113
+ };
114
+ };
115
+ /**
116
+ * A target the reader cannot reach, as damage.
117
+ *
118
+ * `critical`, which under the default refusal floor means refused rather than
119
+ * offered — the strongest thing the Gate does, and the level is the argument.
120
+ * Every other factor here measures a change that might be right: destroying a
121
+ * protected primitive is what a redesign looks like, and discarding work is
122
+ * sometimes the point. This one measures a change that is wrong however it was
123
+ * meant. A control nobody can click is not a control.
124
+ *
125
+ * **The damage is unreachability, not nesting**, which is why the sentence says
126
+ * so. Nested anchors are one way to produce it — invalid HTML, resolved by
127
+ * browsers dropping a link — and they were the only way until 0068 declared
128
+ * `loom.article` a target on `href`. That one stretches its title anchor over
129
+ * the whole card with a `::after`, so a control placed underneath receives
130
+ * nothing while the markup stays perfectly well formed. "You put a link inside a
131
+ * link" would send a reader of that diff looking for an `<a>` inside an `<a>`
132
+ * that is not there. What both cases share is the enclosing node taking the
133
+ * whole of itself, which is exactly what `isInteractive` reports.
134
+ *
135
+ * Refusal is also the useful disposition rather than merely the severe one: a
136
+ * refused proposal is the one a repairer gets to try again, and "this control
137
+ * cannot be reached" is feedback a model can act on. Confirmation would put the
138
+ * question to a person who can only answer no.
139
+ *
140
+ * A host that disagrees does not need a knob — it declares no interactive
141
+ * vocabulary, and this never fires. Like the lists above, silence is the
142
+ * default (0002).
143
+ */
144
+ const nestedTarget = ({ analysis }) => {
145
+ const { nestedTargets } = analysis;
146
+ if (nestedTargets.length === 0)
147
+ return null;
148
+ const one = nestedTargets.length === 1;
149
+ return {
150
+ code: "nested-target",
151
+ level: "critical",
152
+ detail: `puts ${one ? "a target" : `${nestedTargets.length} targets`} where the reader cannot reach ${one ? "it" : "them"}: ${nestedTargets.map(describeNestedTarget).join("; ")}`,
153
+ };
154
+ };
155
+ /**
156
+ * A node the deployment cannot draw, as damage.
157
+ *
158
+ * `critical`, which under the default refusal floor means refused, and the
159
+ * comparison with `nested-target` above is the argument: this is the other
160
+ * factor that measures a change which is wrong however it was meant. Every
161
+ * other one measures a change that might be right. A part of the page that no
162
+ * code can render is not a part of the page — the renderer omits it and says so
163
+ * (0050), and it says so to nobody, on every request, for as long as the
164
+ * revision is current.
165
+ *
166
+ * Refusal is the useful disposition here and not merely the severe one, for the
167
+ * reason `nested-target` gives and more sharply. A refused proposal is the one a
168
+ * repairer gets to try again, and *this type does not exist* is the single most
169
+ * actionable thing a model can be told: the catalogue it was given already lists
170
+ * what does. Confirmation would put an invented word to a person who can only
171
+ * answer no.
172
+ *
173
+ * **What keeps a rollback undoable** is where this is measured rather than how
174
+ * severely it is judged. A tree may legitimately name a primitive a later
175
+ * deployment withdrew, and only what a change *introduces* is counted, so an
176
+ * ordinary edit to a page that already holds one is untouched. Restoring such a
177
+ * node — an undo of the removal that took it out — is the case this does refuse,
178
+ * and refusing it is the honest answer: the primitive has to come back before
179
+ * the page can.
180
+ *
181
+ * A host that disagrees does not need a knob. It declares no vocabulary and this
182
+ * never fires, which is today's behaviour and the default (0002).
183
+ */
184
+ const unknownPrimitive = ({ analysis }) => {
185
+ const { unknownPrimitives } = analysis;
186
+ if (unknownPrimitives.length === 0)
187
+ return null;
188
+ const one = unknownPrimitives.length === 1;
189
+ return {
190
+ code: "unknown-primitive",
191
+ level: "critical",
192
+ detail: `adds ${one ? "a node" : `${unknownPrimitives.length} nodes`} no primitive is registered for, so ${one ? "it draws" : "they draw"} nothing: ${unknownPrimitives.map(describeUnknownPrimitive).join("; ")}`,
193
+ };
194
+ };
195
+ /**
196
+ * Props the declaring primitive refuses, as damage.
197
+ *
198
+ * `critical`, the same level as `unknown-primitive`, because the damage is
199
+ * identical and it is worth being blunt about why: `renderElement` returns
200
+ * `null` for both. A type nothing registered and a node whose props its own
201
+ * schema rejects produce the same hole on the same page for the same reader,
202
+ * and a level that ranked them differently would be ranking the explanation
203
+ * rather than the harm.
204
+ *
205
+ * The reason to refuse rather than to hold, as with `unknown-primitive`: a
206
+ * refusal is the disposition a repairer is offered, and *`text` is longer than
207
+ * this primitive accepts, by this much* is among the most actionable things a
208
+ * model can be told. Confirmation would put a broken node to a person whose
209
+ * only available answer is no.
210
+ *
211
+ * A host that disagrees does not need a knob. It wires no props vocabulary and
212
+ * this never fires, which is today's behaviour and the default (0002).
213
+ */
214
+ const invalidProps = ({ analysis }) => {
215
+ const { invalidProps: invalid } = analysis;
216
+ if (invalid.length === 0)
217
+ return null;
218
+ const one = invalid.length === 1;
219
+ return {
220
+ code: "invalid-props",
221
+ level: "critical",
222
+ detail: `leaves ${one ? "a node" : `${invalid.length} nodes`} carrying props the declaring primitive refuses, so ${one ? "it draws" : "they draw"} nothing: ${invalid.map(describeInvalidProps).join("; ")}`,
223
+ };
224
+ };
225
+ /**
226
+ * A form pointed somewhere else, as damage.
227
+ *
228
+ * `high` rather than `critical`, and the comparison with `nested-target` above
229
+ * is the argument. That one measures a change that is wrong however it was
230
+ * meant, so it is refused. This one measures a change that is often exactly
231
+ * right — a deployment that splits one mailing list into two repoints its forms,
232
+ * and refusing that would mean no proposal could ever move a form at all. What
233
+ * must not happen is that it goes through without anybody noticing, and that is
234
+ * a question of who decides rather than of whether it may be done.
235
+ *
236
+ * So it is `high` plus a rule in the Gate, in the shape 0035 established for
237
+ * discarded work: a level alone cannot say "never auto-apply", because ceilings
238
+ * are per origin (0002) and a `high` factor is a hold for one origin and a
239
+ * silent apply for another. Where a visitor's data goes should not depend on who
240
+ * asked for it to move.
241
+ *
242
+ * Host-independent, so no vocabulary knob: `loom:submit` is the runtime's own
243
+ * key, and both endpoints were registered by the host in either case.
244
+ */
245
+ const redirectedSubmission = ({ analysis }) => {
246
+ const { redirectedSubmissions } = analysis;
247
+ if (redirectedSubmissions.length === 0)
248
+ return null;
249
+ return {
250
+ code: "redirected-submission",
251
+ level: "high",
252
+ detail: `redirects ${redirectedSubmissions.length === 1 ? "a submission" : `${redirectedSubmissions.length} submissions`}: ${redirectedSubmissions.map(describeRedirectedSubmission).join("; ")}`,
253
+ };
254
+ };
255
+ /**
256
+ * A region pointed at different data, as damage.
257
+ *
258
+ * `high`, plus a rule in the Gate, for every reason `redirectedSubmission` above
259
+ * gives — and the pairing is the argument. That factor measures where a
260
+ * visitor's data goes; this one measures which of the host's data arrives, and
261
+ * they are the two ends of one pipe. Repointing is often exactly right: a
262
+ * deployment that splits one catalogue into two repoints its pages, and refusing
263
+ * that would mean no proposal could ever move a binding at all. What must not
264
+ * happen is that it goes through without anybody noticing, which is a question
265
+ * of who decides rather than of whether it may be done.
266
+ *
267
+ * A level alone cannot say "never auto-apply" while ceilings are per origin
268
+ * (0002), so the rule carries that and the level carries the damage. Which of a
269
+ * deployment's data comes out should not depend on who asked for it to change.
270
+ *
271
+ * Host-independent, so no vocabulary knob: `loom:data` is the runtime's own key,
272
+ * and both sources were registered by the host in either case.
273
+ */
274
+ const repointedBinding = ({ analysis }) => {
275
+ const { repointedBindings } = analysis;
276
+ if (repointedBindings.length === 0)
277
+ return null;
278
+ return {
279
+ code: "repointed-binding",
280
+ level: "high",
281
+ detail: `repoints ${repointedBindings.length === 1 ? "a binding" : `${repointedBindings.length} bindings`}: ${repointedBindings.map(describeRepointedBinding).join("; ")}`,
282
+ };
283
+ };
284
+ const FACTORS = [
285
+ protectedTypeRemoved,
286
+ protectedTypeTouched,
287
+ protectedTypeRelocated,
288
+ protectedProp,
289
+ largeRemoval,
290
+ broadChange,
291
+ shallowStructuralChange,
292
+ discardsLaterWork,
293
+ nestedTarget,
294
+ unknownPrimitive,
295
+ invalidProps,
296
+ redirectedSubmission,
297
+ repointedBinding,
298
+ ];
299
+ export const assessStakes = (input, policy) => {
300
+ const factors = FACTORS.flatMap((factor) => factor(input, policy) ?? []);
301
+ return { level: highestStake(factors.map((factor) => factor.level)), factors };
302
+ };
303
+ /** The factor with this code, for a caller that needs the reason and not the level. */
304
+ export const stakeFactor = (stakes, code) => stakes.factors.find((factor) => factor.code === code);
305
+ //# sourceMappingURL=stakes.js.map