functionalscript 0.44.0 → 0.45.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 (453) hide show
  1. package/fjs/asn.1/proof.f.d.mts +5 -0
  2. package/fjs/asn.1/proof.f.mjs +15 -3
  3. package/fjs/asserts/module.f.d.mts +14 -0
  4. package/fjs/asserts/module.f.mjs +20 -0
  5. package/fjs/asserts/proof.f.d.mts +3 -0
  6. package/fjs/asserts/proof.f.mjs +15 -1
  7. package/fjs/basen/base128/proof.f.d.mts +3 -1
  8. package/fjs/basen/base128/proof.f.mjs +3 -1
  9. package/fjs/basen/base64/module.f.mjs +7 -3
  10. package/fjs/basen/base64/proof.f.d.mts +3 -1
  11. package/fjs/basen/base64/proof.f.mjs +7 -4
  12. package/fjs/basen/cbase32/proof.f.d.mts +3 -1
  13. package/fjs/basen/cbase32/proof.f.mjs +3 -1
  14. package/fjs/bnf/data/proof.f.mjs +0 -1
  15. package/fjs/bnf/descent/module.f.d.mts +17 -2
  16. package/fjs/bnf/descent/module.f.mjs +118 -41
  17. package/fjs/bnf/descent/proof.f.d.mts +1 -0
  18. package/fjs/bnf/descent/proof.f.mjs +77 -1
  19. package/fjs/bnf/descent/types.d.ts +12 -4
  20. package/fjs/bnf/ll1/module.f.d.mts +28 -2
  21. package/fjs/bnf/ll1/module.f.mjs +180 -38
  22. package/fjs/bnf/ll1/proof.f.d.mts +2 -0
  23. package/fjs/bnf/ll1/proof.f.mjs +62 -1
  24. package/fjs/bnf/ll1/types.d.ts +14 -8
  25. package/fjs/bnf/module.f.d.mts +15 -6
  26. package/fjs/bnf/module.f.mjs +52 -11
  27. package/fjs/bnf/proof.f.d.mts +2 -0
  28. package/fjs/bnf/proof.f.mjs +79 -3
  29. package/fjs/bnf/token_symbol/module.f.d.mts +4 -3
  30. package/fjs/bnf/token_symbol/module.f.mjs +7 -6
  31. package/fjs/bnf/token_symbol/proof.f.mjs +5 -2
  32. package/fjs/bnf/token_symbol/types.d.ts +2 -2
  33. package/fjs/bnf/types.d.ts +10 -3
  34. package/fjs/cas/cli/proof.f.d.mts +3 -1
  35. package/fjs/cas/cli/proof.f.mjs +3 -1
  36. package/fjs/cas/evo/module.f.d.mts +7 -13
  37. package/fjs/cas/evo/module.f.mjs +103 -96
  38. package/fjs/cas/evo/proof.f.mjs +6 -3
  39. package/fjs/cas/module.f.mjs +96 -109
  40. package/fjs/ci/common/module.f.d.mts +1 -1
  41. package/fjs/ci/common/module.f.mjs +1 -0
  42. package/fjs/ci/config/module.f.d.mts +2 -2
  43. package/fjs/ci/config/module.f.mjs +2 -2
  44. package/fjs/ci/nix/proof.f.d.mts +2 -0
  45. package/fjs/ci/nix/proof.f.mjs +2 -2
  46. package/fjs/ci/proof.f.d.mts +4 -2
  47. package/fjs/ci/proof.f.mjs +4 -3
  48. package/fjs/cli/proof.f.d.mts +4 -2
  49. package/fjs/cli/proof.f.mjs +4 -2
  50. package/fjs/common/monoid/module.f.d.mts +70 -12
  51. package/fjs/common/monoid/module.f.mjs +177 -14
  52. package/fjs/common/monoid/proof.f.d.mts +12 -1
  53. package/fjs/common/monoid/proof.f.mjs +88 -4
  54. package/fjs/common/monoid/types.d.ts +23 -0
  55. package/fjs/crypto/secp/proof.f.d.mts +3 -1
  56. package/fjs/crypto/secp/proof.f.mjs +3 -1
  57. package/fjs/crypto/sha2/proof.f.d.mts +3 -1
  58. package/fjs/crypto/sha2/proof.f.mjs +3 -1
  59. package/fjs/crypto/vdf/module.f.d.mts +23 -4
  60. package/fjs/crypto/vdf/module.f.mjs +6 -4
  61. package/fjs/dev/module.f.d.mts +5 -2
  62. package/fjs/dev/module.f.mjs +5 -4
  63. package/fjs/dev/package_json/module.f.d.mts +7 -0
  64. package/fjs/dev/package_json/module.f.mjs +10 -7
  65. package/fjs/dev/update/module.f.d.mts +3 -0
  66. package/fjs/dev/update/module.f.mjs +3 -2
  67. package/fjs/dev/update/proof.f.d.mts +3 -0
  68. package/fjs/dev/update/proof.f.mjs +1 -2
  69. package/fjs/djs/parser/module.f.d.mts +3 -0
  70. package/fjs/djs/parser/module.f.mjs +18 -0
  71. package/fjs/djs/parser/proof.f.d.mts +3 -0
  72. package/fjs/djs/parser/proof.f.mjs +13 -1
  73. package/fjs/djs/proof.f.d.mts +3 -0
  74. package/fjs/djs/proof.f.mjs +4 -1
  75. package/fjs/djs/serializer/module.f.mjs +5 -4
  76. package/fjs/djs/tokenizer/module.f.mjs +21 -13
  77. package/fjs/djs/tokenizer/proof.f.d.mts +3 -0
  78. package/fjs/djs/tokenizer/proof.f.mjs +14 -2
  79. package/fjs/djs/transpiler/module.f.d.mts +1 -12
  80. package/fjs/djs/transpiler/module.f.mjs +1 -20
  81. package/fjs/djs/transpiler/types.d.ts +25 -0
  82. package/fjs/effects/eff/module.f.d.mts +10 -0
  83. package/fjs/effects/eff/module.f.mjs +4 -2
  84. package/fjs/effects/eff/proof.f.d.mts +3 -0
  85. package/fjs/effects/eff/proof.f.mjs +4 -1
  86. package/fjs/effects/list/module.f.d.mts +10 -2
  87. package/fjs/effects/list/module.f.mjs +4 -2
  88. package/fjs/effects/memory/module.f.d.mts +4 -2
  89. package/fjs/effects/memory/module.f.mjs +4 -3
  90. package/fjs/effects/memory/proof.f.d.mts +4 -0
  91. package/fjs/effects/memory/proof.f.mjs +5 -2
  92. package/fjs/effects/mock/module.f.d.mts +10 -2
  93. package/fjs/effects/mock/module.f.mjs +4 -2
  94. package/fjs/effects/module.d.mts +8 -0
  95. package/fjs/effects/module.f.d.mts +6 -4
  96. package/fjs/effects/module.f.mjs +6 -5
  97. package/fjs/effects/module.mjs +9 -1
  98. package/fjs/effects/node/memory/module.d.mts +3 -0
  99. package/fjs/effects/node/memory/module.mjs +3 -2
  100. package/fjs/effects/node/memory/proof.d.mts +2 -0
  101. package/fjs/effects/node/memory/proof.mjs +2 -1
  102. package/fjs/effects/node/module.d.mts +5 -0
  103. package/fjs/effects/node/module.f.d.mts +17 -12
  104. package/fjs/effects/node/module.f.mjs +6 -12
  105. package/fjs/effects/node/module.mjs +5 -17
  106. package/fjs/effects/node/virtual/module.f.d.mts +6 -3
  107. package/fjs/effects/node/virtual/module.f.mjs +6 -5
  108. package/fjs/effects/node/virtual/proof.f.d.mts +4 -1
  109. package/fjs/effects/node/virtual/proof.f.mjs +13 -1
  110. package/fjs/effects/proof.f.d.mts +3 -0
  111. package/fjs/effects/proof.f.mjs +4 -1
  112. package/fjs/emergent_testing/all.test.d.mts +8 -0
  113. package/fjs/emergent_testing/all.test.mjs +14 -0
  114. package/fjs/emergent_testing/module.f.d.mts +6 -1
  115. package/fjs/emergent_testing/module.f.mjs +40 -66
  116. package/fjs/emergent_testing/proof.f.mjs +5 -5
  117. package/fjs/fsc/bnf.f.d.mts +3 -0
  118. package/fjs/fsc/bnf.f.mjs +4 -1
  119. package/fjs/fsc/json.f.d.mts +3 -0
  120. package/fjs/fsc/json.f.mjs +4 -1
  121. package/fjs/fsc/module.f.d.mts +9 -0
  122. package/fjs/fsc/module.f.mjs +5 -3
  123. package/fjs/fsm/proof.f.d.mts +3 -0
  124. package/fjs/fsm/proof.f.mjs +4 -1
  125. package/fjs/js/tokenizer/module.f.d.mts +7 -0
  126. package/fjs/js/tokenizer/module.f.mjs +19 -55
  127. package/fjs/mcp/module.f.d.mts +36 -1
  128. package/fjs/mcp/module.f.mjs +9 -7
  129. package/fjs/mcp/proof.f.d.mts +11 -1
  130. package/fjs/mcp/proof.f.mjs +11 -18
  131. package/fjs/media/html/module.f.d.mts +12 -0
  132. package/fjs/media/html/module.f.mjs +6 -4
  133. package/fjs/media/html/proof.f.d.mts +3 -0
  134. package/fjs/media/html/proof.f.mjs +4 -1
  135. package/fjs/media/json/parser/module.f.d.mts +1 -1
  136. package/fjs/media/json/parser/module.f.mjs +25 -8
  137. package/fjs/media/json/parser/types.d.ts +5 -0
  138. package/fjs/media/json/rtti/proof.f.d.mts +3 -0
  139. package/fjs/media/json/rtti/proof.f.mjs +3 -3
  140. package/fjs/media/json/schema/module.f.d.mts +61 -27
  141. package/fjs/media/json/schema/module.f.mjs +228 -63
  142. package/fjs/media/json/schema/proof.f.d.mts +41 -0
  143. package/fjs/media/json/schema/proof.f.mjs +219 -7
  144. package/fjs/media/json/serializer/module.f.d.mts +13 -0
  145. package/fjs/media/json/serializer/module.f.mjs +7 -7
  146. package/fjs/media/json/tokenizer/module.f.d.mts +8 -0
  147. package/fjs/media/json/tokenizer/module.f.mjs +24 -5
  148. package/fjs/media/nix/module.f.d.mts +13 -0
  149. package/fjs/media/nix/module.f.mjs +4 -2
  150. package/fjs/media/nix/proof.f.d.mts +3 -0
  151. package/fjs/media/nix/proof.f.mjs +4 -1
  152. package/fjs/media/revision/module.f.d.mts +5 -0
  153. package/fjs/media/revision/module.f.mjs +8 -11
  154. package/fjs/media/revision/proof.f.d.mts +4 -0
  155. package/fjs/media/revision/proof.f.mjs +5 -2
  156. package/fjs/media/type/module.f.d.mts +28 -11
  157. package/fjs/media/type/module.f.mjs +69 -85
  158. package/fjs/media/type/proof.f.d.mts +16 -0
  159. package/fjs/media/type/proof.f.mjs +44 -4
  160. package/fjs/module.d.mts +5 -0
  161. package/fjs/module.f.d.mts +8 -0
  162. package/fjs/module.f.mjs +4 -2
  163. package/fjs/module.mjs +6 -0
  164. package/fjs/path/module.f.d.mts +8 -0
  165. package/fjs/path/module.f.mjs +4 -2
  166. package/fjs/proof.f.d.mts +4 -0
  167. package/fjs/proof.f.mjs +5 -2
  168. package/fjs/protocol/json_rpc/module.f.d.mts +1 -1
  169. package/fjs/protocol/json_rpc/module.f.mjs +7 -4
  170. package/fjs/protocol/json_rpc/proof.f.d.mts +6 -0
  171. package/fjs/protocol/json_rpc/proof.f.mjs +22 -1
  172. package/fjs/protocol/mcp/proof.f.d.mts +4 -0
  173. package/fjs/protocol/mcp/proof.f.mjs +47 -24
  174. package/fjs/protocol/mcp/stdio/module.f.d.mts +2 -4
  175. package/fjs/protocol/mcp/stdio/module.f.mjs +1 -8
  176. package/fjs/protocol/mcp/stdio/proof.f.d.mts +1 -1
  177. package/fjs/protocol/mcp/stdio/proof.f.mjs +1 -1
  178. package/fjs/protocol/mcp/stdio/types.d.ts +14 -0
  179. package/fjs/sul/id/module.f.d.mts +5 -0
  180. package/fjs/sul/id/module.f.mjs +5 -4
  181. package/fjs/sul/level/hash/module.f.d.mts +4 -1
  182. package/fjs/sul/level/hash/module.f.mjs +4 -3
  183. package/fjs/sul/level/hash/proof.f.d.mts +4 -0
  184. package/fjs/sul/level/hash/proof.f.mjs +5 -2
  185. package/fjs/sul/level/literal/module.f.d.mts +4 -1
  186. package/fjs/sul/level/literal/module.f.mjs +4 -3
  187. package/fjs/sul/level/literal/proof.f.d.mts +3 -0
  188. package/fjs/sul/level/literal/proof.f.mjs +4 -1
  189. package/fjs/sul/module.f.d.mts +5 -3
  190. package/fjs/sul/module.f.mjs +5 -4
  191. package/fjs/sul/proof.f.d.mts +4 -0
  192. package/fjs/sul/proof.f.mjs +5 -2
  193. package/fjs/text/ascii/module.f.d.mts +26 -0
  194. package/fjs/text/ascii/module.f.mjs +49 -1
  195. package/fjs/text/ascii/proof.f.d.mts +10 -0
  196. package/fjs/text/ascii/proof.f.mjs +33 -1
  197. package/fjs/text/code_point/module.f.d.mts +21 -3
  198. package/fjs/text/code_point/module.f.mjs +24 -8
  199. package/fjs/text/code_point/proof.f.d.mts +1 -0
  200. package/fjs/text/code_point/proof.f.mjs +28 -0
  201. package/fjs/text/module.f.d.mts +4 -2
  202. package/fjs/text/module.f.mjs +4 -3
  203. package/fjs/text/proof.f.d.mts +3 -0
  204. package/fjs/text/proof.f.mjs +4 -1
  205. package/fjs/text/sgr/module.f.d.mts +4 -1
  206. package/fjs/text/sgr/module.f.mjs +4 -3
  207. package/fjs/text/sgr/proof.f.d.mts +3 -0
  208. package/fjs/text/sgr/proof.f.mjs +4 -1
  209. package/fjs/text/utf16/module.f.d.mts +5 -1
  210. package/fjs/text/utf16/module.f.mjs +31 -33
  211. package/fjs/text/utf16/proof.f.d.mts +3 -1
  212. package/fjs/text/utf16/proof.f.mjs +18 -1
  213. package/fjs/text/utf8/module.f.d.mts +9 -5
  214. package/fjs/text/utf8/module.f.mjs +16 -18
  215. package/fjs/types/array/module.f.d.mts +2 -1
  216. package/fjs/types/array/module.f.mjs +2 -2
  217. package/fjs/types/bigfloat/module.f.d.mts +21 -1
  218. package/fjs/types/bigfloat/module.f.mjs +33 -7
  219. package/fjs/types/bigfloat/proof.f.d.mts +1 -0
  220. package/fjs/types/bigfloat/proof.f.mjs +46 -0
  221. package/fjs/types/bigint/module.f.d.mts +4 -0
  222. package/fjs/types/bigint/module.f.mjs +4 -3
  223. package/fjs/types/bit_vec/module.f.d.mts +10 -14
  224. package/fjs/types/bit_vec/module.f.mjs +61 -71
  225. package/fjs/types/bit_vec/proof.f.d.mts +6 -0
  226. package/fjs/types/bit_vec/proof.f.mjs +29 -3
  227. package/fjs/types/btree/find/module.f.d.mts +5 -1
  228. package/fjs/types/btree/find/module.f.mjs +5 -5
  229. package/fjs/types/btree/find/proof.f.d.mts +5 -1
  230. package/fjs/types/btree/find/proof.f.mjs +5 -3
  231. package/fjs/types/btree/module.f.d.mts +3 -0
  232. package/fjs/types/btree/module.f.mjs +3 -2
  233. package/fjs/types/btree/proof.f.d.mts +5 -1
  234. package/fjs/types/btree/proof.f.mjs +5 -3
  235. package/fjs/types/btree/remove/module.f.d.mts +11 -0
  236. package/fjs/types/btree/remove/module.f.mjs +9 -9
  237. package/fjs/types/btree/remove/proof.f.d.mts +3 -0
  238. package/fjs/types/btree/remove/proof.f.mjs +4 -1
  239. package/fjs/types/btree/set/module.f.d.mts +9 -0
  240. package/fjs/types/btree/set/module.f.mjs +5 -6
  241. package/fjs/types/btree/set/proof.f.d.mts +3 -0
  242. package/fjs/types/btree/set/proof.f.mjs +4 -1
  243. package/fjs/types/btree/types/module.f.d.mts +2 -1
  244. package/fjs/types/btree/types/module.f.mjs +2 -1
  245. package/fjs/types/byte_set/module.f.d.mts +10 -1
  246. package/fjs/types/byte_set/module.f.mjs +5 -3
  247. package/fjs/types/byte_set/proof.f.d.mts +3 -1
  248. package/fjs/types/byte_set/proof.f.mjs +3 -1
  249. package/fjs/types/function/compare/module.f.d.mts +3 -2
  250. package/fjs/types/function/compare/module.f.mjs +3 -2
  251. package/fjs/types/function/module.f.d.mts +8 -1
  252. package/fjs/types/function/module.f.mjs +8 -1
  253. package/fjs/types/function/operator/module.f.d.mts +2 -1
  254. package/fjs/types/function/operator/module.f.mjs +2 -2
  255. package/fjs/types/list/module.f.d.mts +9 -2
  256. package/fjs/types/list/module.f.mjs +5 -3
  257. package/fjs/types/list/proof.f.d.mts +4 -1
  258. package/fjs/types/list/proof.f.mjs +4 -2
  259. package/fjs/types/nibble_set/module.f.d.mts +2 -1
  260. package/fjs/types/nibble_set/module.f.mjs +2 -2
  261. package/fjs/types/nominal/module.f.d.mts +2 -1
  262. package/fjs/types/nominal/module.f.mjs +2 -1
  263. package/fjs/types/nullable/module.f.d.mts +8 -2
  264. package/fjs/types/nullable/module.f.mjs +4 -2
  265. package/fjs/types/number/module.f.d.mts +4 -0
  266. package/fjs/types/number/module.f.mjs +4 -3
  267. package/fjs/types/object/module.f.d.mts +14 -2
  268. package/fjs/types/object/module.f.mjs +15 -6
  269. package/fjs/types/object/proof.f.d.mts +5 -2
  270. package/fjs/types/object/proof.f.mjs +6 -3
  271. package/fjs/types/object/structurally_same/module.f.d.mts +39 -0
  272. package/fjs/types/object/structurally_same/module.f.mjs +59 -0
  273. package/fjs/types/object/structurally_same/proof.f.d.mts +6 -0
  274. package/fjs/types/object/structurally_same/proof.f.mjs +73 -0
  275. package/fjs/types/ordered_map/module.f.d.mts +5 -0
  276. package/fjs/types/ordered_map/module.f.mjs +5 -4
  277. package/fjs/types/ordered_map/proof.f.d.mts +3 -0
  278. package/fjs/types/ordered_map/proof.f.mjs +4 -1
  279. package/fjs/types/patricia_trie/module.f.d.mts +2 -1
  280. package/fjs/types/patricia_trie/module.f.mjs +2 -2
  281. package/fjs/types/patricia_trie/proof.f.d.mts +3 -0
  282. package/fjs/types/patricia_trie/proof.f.mjs +4 -1
  283. package/fjs/types/prime_field/module.f.d.mts +3 -1
  284. package/fjs/types/prime_field/module.f.mjs +3 -2
  285. package/fjs/types/range/module.f.d.mts +2 -1
  286. package/fjs/types/range/module.f.mjs +2 -2
  287. package/fjs/types/range_map/module.f.d.mts +6 -0
  288. package/fjs/types/range_map/module.f.mjs +6 -9
  289. package/fjs/types/range_map/proof.f.d.mts +5 -1
  290. package/fjs/types/range_map/proof.f.mjs +5 -3
  291. package/fjs/types/range_set/module.f.d.mts +5 -0
  292. package/fjs/types/range_set/module.f.mjs +1 -0
  293. package/fjs/types/range_set/proof.f.d.mts +3 -0
  294. package/fjs/types/range_set/proof.f.mjs +4 -1
  295. package/fjs/types/result/module.d.mts +8 -0
  296. package/fjs/types/result/module.f.d.mts +37 -7
  297. package/fjs/types/result/module.f.mjs +38 -8
  298. package/fjs/types/result/module.mjs +9 -1
  299. package/fjs/types/result/proof.f.d.mts +5 -0
  300. package/fjs/types/result/proof.f.mjs +22 -2
  301. package/fjs/types/rtti/common/module.f.d.mts +35 -2
  302. package/fjs/types/rtti/common/module.f.mjs +9 -7
  303. package/fjs/types/rtti/common/proof.f.d.mts +4 -0
  304. package/fjs/types/rtti/common/proof.f.mjs +5 -2
  305. package/fjs/types/rtti/data/module.f.d.mts +120 -0
  306. package/fjs/types/rtti/data/module.f.mjs +1030 -0
  307. package/fjs/types/rtti/data/proof.f.d.mts +75 -0
  308. package/fjs/types/rtti/data/proof.f.mjs +566 -0
  309. package/fjs/types/rtti/data/types.d.ts +83 -0
  310. package/fjs/types/rtti/module.f.d.mts +12 -5
  311. package/fjs/types/rtti/module.f.mjs +7 -5
  312. package/fjs/types/rtti/parse/module.f.d.mts +38 -0
  313. package/fjs/types/rtti/parse/module.f.mjs +9 -7
  314. package/fjs/types/rtti/parse/proof.f.mjs +18 -38
  315. package/fjs/types/rtti/proof.f.d.mts +3 -1
  316. package/fjs/types/rtti/proof.f.mjs +3 -1
  317. package/fjs/types/rtti/ts/module.f.d.mts +68 -9
  318. package/fjs/types/rtti/ts/module.f.mjs +262 -30
  319. package/fjs/types/rtti/ts/proof.f.d.mts +44 -0
  320. package/fjs/types/rtti/ts/proof.f.mjs +152 -4
  321. package/fjs/types/rtti/ts/types.d.ts +11 -0
  322. package/fjs/types/rtti/types.d.ts +40 -0
  323. package/fjs/types/rtti/validate/module.f.d.mts +36 -1
  324. package/fjs/types/rtti/validate/module.f.mjs +6 -4
  325. package/fjs/types/sorted_list/module.f.d.mts +4 -1
  326. package/fjs/types/sorted_list/module.f.mjs +21 -12
  327. package/fjs/types/sorted_list/proof.f.d.mts +3 -1
  328. package/fjs/types/sorted_list/proof.f.mjs +3 -1
  329. package/fjs/types/sorted_set/module.f.d.mts +31 -1
  330. package/fjs/types/sorted_set/module.f.mjs +4 -2
  331. package/fjs/types/sorted_set/proof.f.d.mts +3 -1
  332. package/fjs/types/sorted_set/proof.f.mjs +3 -1
  333. package/fjs/types/string/module.f.d.mts +4 -0
  334. package/fjs/types/string/module.f.mjs +4 -3
  335. package/fjs/types/string_set/module.f.d.mts +3 -1
  336. package/fjs/types/string_set/module.f.mjs +3 -2
  337. package/fjs/types/ts/module.f.d.mts +2 -0
  338. package/fjs/types/ts/module.f.mjs +3 -3
  339. package/fjs/types/ts/proof.f.d.mts +1 -0
  340. package/fjs/types/ts/proof.f.mjs +5 -0
  341. package/fjs/types/ts/types.d.ts +6 -1
  342. package/fjs/types/uint8array/module.f.d.mts +13 -2
  343. package/fjs/types/uint8array/module.f.mjs +20 -15
  344. package/fjs/website/module.f.d.mts +3 -0
  345. package/fjs/website/module.f.mjs +3 -2
  346. package/package.json +3 -3
  347. package/fjs/asn.1/types.js +0 -6
  348. package/fjs/asserts/types.js +0 -6
  349. package/fjs/basen/types.js +0 -6
  350. package/fjs/bnf/data/types.js +0 -6
  351. package/fjs/bnf/descent/types.js +0 -6
  352. package/fjs/bnf/ll1/types.js +0 -6
  353. package/fjs/bnf/token_symbol/types.js +0 -6
  354. package/fjs/bnf/types.js +0 -6
  355. package/fjs/cas/evo/types.js +0 -7
  356. package/fjs/cas/types.js +0 -6
  357. package/fjs/ci/common/types.js +0 -1
  358. package/fjs/ci/nix/types.js +0 -6
  359. package/fjs/ci/types.js +0 -6
  360. package/fjs/cli/types.js +0 -6
  361. package/fjs/common/monoid/types.js +0 -6
  362. package/fjs/crypto/pow/types.js +0 -6
  363. package/fjs/crypto/secp/types.js +0 -6
  364. package/fjs/crypto/sha2/types.js +0 -6
  365. package/fjs/crypto/sign/types.js +0 -6
  366. package/fjs/crypto/vdf/types.js +0 -6
  367. package/fjs/dev/types.js +0 -6
  368. package/fjs/djs/ast/types.js +0 -8
  369. package/fjs/djs/parser/types.js +0 -7
  370. package/fjs/djs/tokenizer/types.js +0 -7
  371. package/fjs/djs/types.js +0 -7
  372. package/fjs/effects/eff/types.js +0 -6
  373. package/fjs/effects/list/types.js +0 -6
  374. package/fjs/effects/memory/types.js +0 -6
  375. package/fjs/effects/mock/types.js +0 -6
  376. package/fjs/effects/node/types.js +0 -6
  377. package/fjs/effects/node/virtual/types.js +0 -7
  378. package/fjs/effects/types.js +0 -6
  379. package/fjs/emergent_testing/all.test.d.ts +0 -1
  380. package/fjs/emergent_testing/all.test.js +0 -5
  381. package/fjs/emergent_testing/scenarios/all.d.ts +0 -1
  382. package/fjs/emergent_testing/scenarios/all.js +0 -1
  383. package/fjs/emergent_testing/scenarios/async-subtests.fail.d.ts +0 -6
  384. package/fjs/emergent_testing/scenarios/async-subtests.fail.js +0 -9
  385. package/fjs/emergent_testing/scenarios/async-subtests.pass.d.ts +0 -6
  386. package/fjs/emergent_testing/scenarios/async-subtests.pass.js +0 -9
  387. package/fjs/emergent_testing/scenarios/async.fail.d.ts +0 -3
  388. package/fjs/emergent_testing/scenarios/async.fail.js +0 -6
  389. package/fjs/emergent_testing/scenarios/async.pass.d.ts +0 -3
  390. package/fjs/emergent_testing/scenarios/async.pass.js +0 -5
  391. package/fjs/emergent_testing/scenarios/fail.fail.d.ts +0 -3
  392. package/fjs/emergent_testing/scenarios/fail.fail.js +0 -3
  393. package/fjs/emergent_testing/scenarios/return-value.pass.d.ts +0 -3
  394. package/fjs/emergent_testing/scenarios/return-value.pass.js +0 -4
  395. package/fjs/emergent_testing/scenarios/thenable.pass.d.ts +0 -5
  396. package/fjs/emergent_testing/scenarios/thenable.pass.js +0 -11
  397. package/fjs/emergent_testing/scenarios/thenable2.pass.d.ts +0 -5
  398. package/fjs/emergent_testing/scenarios/thenable2.pass.js +0 -3
  399. package/fjs/emergent_testing/scenarios/throw.pass.d.ts +0 -5
  400. package/fjs/emergent_testing/scenarios/throw.pass.js +0 -3
  401. package/fjs/emergent_testing/types.js +0 -6
  402. package/fjs/js/tokenizer/types.js +0 -6
  403. package/fjs/media/html/types.js +0 -6
  404. package/fjs/media/json/parser/types.js +0 -6
  405. package/fjs/media/json/tokenizer/types.js +0 -6
  406. package/fjs/media/json/types.js +0 -13
  407. package/fjs/media/nix/types.js +0 -6
  408. package/fjs/media/revision/types.js +0 -8
  409. package/fjs/media/type/types.js +0 -6
  410. package/fjs/media/types.js +0 -7
  411. package/fjs/nanvm/types.js +0 -11
  412. package/fjs/protocol/json_rpc/types.js +0 -8
  413. package/fjs/protocol/mcp/types.js +0 -8
  414. package/fjs/sul/id/types.js +0 -6
  415. package/fjs/sul/level/hash/types.js +0 -6
  416. package/fjs/sul/level/literal/types.js +0 -6
  417. package/fjs/sul/types.js +0 -6
  418. package/fjs/text/sgr/types.js +0 -6
  419. package/fjs/text/types.js +0 -6
  420. package/fjs/text/utf16/types.js +0 -6
  421. package/fjs/text/utf8/types.js +0 -6
  422. package/fjs/types/array/types.js +0 -6
  423. package/fjs/types/bigfloat/types.js +0 -6
  424. package/fjs/types/bigint/types.js +0 -6
  425. package/fjs/types/bit_vec/types.js +0 -6
  426. package/fjs/types/btree/find/types.js +0 -6
  427. package/fjs/types/btree/types/types.js +0 -6
  428. package/fjs/types/byte_set/types.js +0 -6
  429. package/fjs/types/function/compare/types.js +0 -6
  430. package/fjs/types/function/operator/types.js +0 -6
  431. package/fjs/types/function/types.js +0 -6
  432. package/fjs/types/list/types.js +0 -6
  433. package/fjs/types/nibble_set/types.js +0 -6
  434. package/fjs/types/nominal/types.js +0 -6
  435. package/fjs/types/nullable/types.js +0 -6
  436. package/fjs/types/object/types.js +0 -8
  437. package/fjs/types/option/types.js +0 -6
  438. package/fjs/types/ordered_map/types.js +0 -6
  439. package/fjs/types/patricia_trie/types.js +0 -6
  440. package/fjs/types/phantom/types.js +0 -11
  441. package/fjs/types/prime_field/types.js +0 -6
  442. package/fjs/types/range/types.js +0 -6
  443. package/fjs/types/range_map/types.js +0 -6
  444. package/fjs/types/result/types.js +0 -6
  445. package/fjs/types/rtti/common/types.js +0 -1
  446. package/fjs/types/rtti/parse/types.js +0 -1
  447. package/fjs/types/rtti/ts/types.js +0 -1
  448. package/fjs/types/rtti/types.js +0 -1
  449. package/fjs/types/rtti/validate/types.js +0 -1
  450. package/fjs/types/sorted_list/types.js +0 -6
  451. package/fjs/types/sorted_set/types.js +0 -6
  452. package/fjs/types/string_set/types.js +0 -6
  453. package/fjs/types/ts/types.js +0 -8
@@ -53,14 +53,13 @@
53
53
  * @import { Hash, Subject, RevisionData, SubjectState, Cache, Evo } from './types.ts'
54
54
  */
55
55
 
56
- import { pure, foldStep } from '../../effects/module.f.mjs'
57
- import { eff } from '../../effects/eff/module.f.mjs'
56
+ import { pure, foldStep, mapStep, step } from '../../effects/module.f.mjs'
58
57
  import { create, read, write } from '../../effects/memory/module.f.mjs'
59
58
  import { collectRead } from '../module.f.mjs'
60
59
  import { cBase32ToVec, vecToCBase32 } from '../../basen/cbase32/module.f.mjs'
61
60
  import { fromVec } from '../../text/utf8/module.f.mjs'
62
61
  import { tryUtf8 } from '../../text/module.f.mjs'
63
- import { ok, error } from '../../types/result/module.f.mjs'
62
+ import { ok, error, okThen } from '../../types/result/module.f.mjs'
64
63
  import { nonEmpty, empty as elEmpty } from '../../effects/list/module.f.mjs'
65
64
  import { at, definedEntries } from '../../types/object/module.f.mjs'
66
65
  import { unwrap } from '../../types/nullable/module.f.mjs'
@@ -185,9 +184,9 @@ export const decodeRevisionVec = value => {
185
184
  * @returns {(hash: Vec) => Effect<O, Revision | null>}
186
185
  */
187
186
  export const decodeRevisionBlob = cas => hash =>
188
- eff(collectRead(cas.read(hash)))
189
- .map(([tag, value]) => tag === 'error' ? null : decodeRevisionVec(value))
190
- .value
187
+ mapStep(
188
+ collectRead(cas.read(hash)),
189
+ ([tag, value]) => tag === 'error' ? null : decodeRevisionVec(value))
191
190
 
192
191
  /**
193
192
  * Scans every hash in `cas` and builds a fresh {@link Cache} from the
@@ -202,11 +201,10 @@ export const buildCache = cas =>
202
201
  cas.list(),
203
202
  emptyCache,
204
203
  hash => cache =>
205
- eff(decodeRevisionBlob(cas)(hash))
206
- .step(revision =>
207
- pure(revision === null ? cache : addRevisionToCache(vecToCBase32(hash), revision)(cache))
208
- )
209
- .value)
204
+ mapStep(
205
+ decodeRevisionBlob(cas)(hash),
206
+ revision =>
207
+ revision === null ? cache : addRevisionToCache(vecToCBase32(hash), revision)(cache)))
210
208
 
211
209
  /**
212
210
  * Scans `cas` once and allocates a memory slot holding the resulting {@link Cache}.
@@ -216,17 +214,13 @@ export const buildCache = cas =>
216
214
  * @returns {Effect<O | MemOp, Key<Cache>>}
217
215
  */
218
216
  export const initEvo = cas =>
219
- eff(buildCache(cas))
220
- .step(cache => create(cache))
221
- .value
217
+ step(buildCache(cas), cache => create(cache))
222
218
 
223
219
  /** Reads, then rewrites, the cache at `cacheKey` with `revision` folded in at `hash`.
224
220
  * @type {(cacheKey: Key<Cache>) => (hash: Hash) => (revision: Revision) => Effect<MemOp, void>}
225
221
  */
226
222
  const foldIntoCache = cacheKey => hash => revision =>
227
- eff(read(cacheKey))
228
- .step(cache => write(cacheKey, addRevisionToCache(hash, revision)(cache)))
229
- .value
223
+ step(read(cacheKey), cache => write(cacheKey, addRevisionToCache(hash, revision)(cache)))
230
224
 
231
225
  /**
232
226
  * Folds `value` — bytes already written to a `Cas` at `hash` by some other
@@ -259,11 +253,9 @@ const resolveParent = cas => parentRef => {
259
253
  if (parentHash === null) {
260
254
  return pure(error(`invalid parent hash: ${parentRef}`))
261
255
  }
262
- return eff(decodeRevisionBlob(cas)(parentHash))
263
- .step(parent =>
264
- pure(parent === null ? error(`parent is not a revision blob: ${parentRef}`) : ok(parent))
265
- )
266
- .value
256
+ return mapStep(
257
+ decodeRevisionBlob(cas)(parentHash),
258
+ parent => parent === null ? error(`parent is not a revision blob: ${parentRef}`) : ok(parent))
267
259
  }
268
260
 
269
261
  /**
@@ -281,12 +273,11 @@ const resolveParents = cas => parents => {
281
273
  init,
282
274
  parentRef => (/** @type {Result<readonly Revision[], string>} */ acc) => {
283
275
  if (acc[0] === 'error') { return pure(acc) }
284
- return eff(resolveParent(cas)(parentRef))
285
- .step((/** @type {Result<Revision, string>} */ parentResult) =>
286
- /** @type {Effect<never, Result<readonly Revision[], string>>} */
287
- (pure(parentResult[0] === 'error' ? parentResult : ok([...acc[1], parentResult[1]])))
288
- )
289
- .value
276
+ return mapStep(
277
+ resolveParent(cas)(parentRef),
278
+ (/** @type {Result<Revision, string>} */ parentResult) =>
279
+ /** @type {Result<readonly Revision[], string>} */
280
+ (parentResult[0] === 'error' ? parentResult : ok([...acc[1], parentResult[1]])))
290
281
  })
291
282
  }
292
283
 
@@ -366,21 +357,73 @@ const computeGeneration = parents =>
366
357
  parents.length === 0 ? 0 : 1 + parents.reduce((max, p) => Math.max(max, p.generation), 0)
367
358
 
368
359
  /**
369
- * Adds a new revision to `cas` and folds it into the cache at `cacheKey`.
360
+ * The pure half of {@link addRevision}: turns already-resolved `parents` into
361
+ * the exact `Revision` that will be stored, or the first reason it cannot be.
370
362
  *
371
- * Steps: resolve and validate every parent ({@link resolveParents}), resolve
372
- * `subject` from them ({@link resolveSubject}) and check every parent
373
- * actually belongs to it ({@link validateParentSubjects}), resolve `snapshot`
374
- * ({@link resolveSnapshot}) and compute `generation`
375
- * ({@link computeGeneration}), assemble a `Revision` and check its hash /
363
+ * Resolves `subject` ({@link resolveSubject}) and checks every parent belongs
364
+ * to it ({@link validateParentSubjects}), resolves `snapshot`
365
+ * ({@link resolveSnapshot}) and computes `generation`
366
+ * ({@link computeGeneration}), assembles the `Revision` and checks its hash /
376
367
  * generation semantics (`fjs/media/revision` `checkReferences` — the same rule
377
- * a reader applies; the shape itself is already guaranteed by this function's
378
- * own field types), encode and write it to `cas`, then fold the new revision
379
- * into the cache. Every failure — an invalid or missing parent, a
380
- * cross-subject parent, an unresolvable subject or snapshot, an invalid
381
- * revision, a blob too large to encode, or a store write failure — is
382
- * reported as `error(message)` rather than thrown, so a caller (e.g. an MCP
383
- * tool handler) can surface it without a `throw`/`catch`.
368
+ * a reader applies; the shape itself is already guaranteed by the field types
369
+ * here), then canonicalizes it.
370
+ *
371
+ * Canonicalizing parent/snapshot spellings is only safe once `checkReferences`
372
+ * has confirmed they decode, which makes the `unwrap` inside
373
+ * {@link canonicalHash} safe. It is not optional: two `add` calls describing
374
+ * the same logical revision but spelled differently (case, `i`/`l`/`o`
375
+ * aliases) must serialize identically, or they would produce two distinct CAS
376
+ * blobs that both remain heads — the point of `canonicalHash` (see the module
377
+ * doc) is defeated if this module itself writes non-canonical spellings.
378
+ *
379
+ * Separate from {@link addRevision} because none of it touches the store:
380
+ * everything up to the bytes is a plain `Result` pipeline, so `addRevision` is
381
+ * left holding only the encode, the write, and the cache fold. Each step also
382
+ * reads values resolved by earlier ones, which is why the guards are a flat
383
+ * sequence rather than an `okThen` chain — see `okThen`'s own note in
384
+ * [`fjs/types/result`](../../types/result/module.f.mjs).
385
+ *
386
+ * @param {RevisionData} input
387
+ * @returns {(parents: readonly Revision[]) => Result<Revision, string>}
388
+ */
389
+ const buildRevision = input => parents => {
390
+ const subjectResult = resolveSubject(input)(parents)
391
+ if (subjectResult[0] === 'error') { return subjectResult }
392
+ const subject = subjectResult[1]
393
+ const parentSubjectsResult = validateParentSubjects(subject)(parents)
394
+ if (parentSubjectsResult[0] === 'error') { return parentSubjectsResult }
395
+ const snapshotResult = resolveSnapshot(input)(subject)(parents)
396
+ if (snapshotResult[0] === 'error') { return snapshotResult }
397
+ /** @type {Revision} */
398
+ const revision = {
399
+ dialect,
400
+ subject,
401
+ parents: input.parents,
402
+ snapshot: snapshotResult[1],
403
+ generation: computeGeneration(parents),
404
+ archived: input.archived,
405
+ lock: input.lock,
406
+ }
407
+ const referencesResult = checkReferences(revision)
408
+ if (referencesResult[0] === 'error') { return referencesResult }
409
+ return ok({
410
+ ...revision,
411
+ parents: revision.parents.map(canonicalHash),
412
+ snapshot: canonicalHash(revision.snapshot),
413
+ lock: revision.lock === undefined ? undefined : canonicalLock(revision.lock),
414
+ })
415
+ }
416
+
417
+ /**
418
+ * Adds a new revision to `cas` and folds it into the cache at `cacheKey`.
419
+ *
420
+ * Steps: resolve and validate every parent ({@link resolveParents}), derive
421
+ * the revision to store from them ({@link buildRevision}), then encode it,
422
+ * write it to `cas`, and fold it into the cache. Every failure — an invalid
423
+ * or missing parent, a cross-subject parent, an unresolvable subject or
424
+ * snapshot, an invalid revision, a blob too large to encode, or a store write
425
+ * failure — is reported as `error(message)` rather than thrown, so a caller
426
+ * (e.g. an MCP tool handler) can surface it without a `throw`/`catch`.
384
427
  *
385
428
  * `input.generation` is ignored: it exists on {@link RevisionData} only so a
386
429
  * value read back by {@link readRevision} round-trips into `add` unchanged,
@@ -392,58 +435,26 @@ const computeGeneration = parents =>
392
435
  * @returns {(cacheKey: Key<Cache>) => (input: RevisionData) => Effect<O | MemOp, Result<Hash, string>>}
393
436
  */
394
437
  export const addRevision = cas => cacheKey => input =>
395
- eff(resolveParents(cas)(input.parents))
396
- .step((/** @type {Result<readonly Revision[], string>} */ parentsResult) => {
397
- if (parentsResult[0] === 'error') { return pure(parentsResult) }
398
- const subjectResult = resolveSubject(input)(parentsResult[1])
399
- if (subjectResult[0] === 'error') { return pure(subjectResult) }
400
- const parentSubjectsResult = validateParentSubjects(subjectResult[1])(parentsResult[1])
401
- if (parentSubjectsResult[0] === 'error') { return pure(parentSubjectsResult) }
402
- const snapshotResult = resolveSnapshot(input)(subjectResult[1])(parentsResult[1])
403
- if (snapshotResult[0] === 'error') { return pure(snapshotResult) }
404
- /** @type {Revision} */
405
- const revision = {
406
- dialect,
407
- subject: subjectResult[1],
408
- parents: input.parents,
409
- snapshot: snapshotResult[1],
410
- generation: computeGeneration(parentsResult[1]),
411
- archived: input.archived,
412
- lock: input.lock,
413
- }
414
- const referencesResult = checkReferences(revision)
415
- if (referencesResult[0] === 'error') { return pure(referencesResult) }
416
- // Canonicalize parent/snapshot spellings now that checkReferences has
417
- // confirmed they decode (`unwrap` inside `canonicalHash` is safe):
418
- // two `add` calls describing the same logical revision but spelled
419
- // differently (case, `i`/`l`/`o` aliases) must serialize identically,
420
- // or they'd produce two distinct CAS blobs that both remain heads —
421
- // the point of `canonicalHash` (see the module doc) is defeated if
422
- // this module itself writes non-canonical spellings.
423
- /** @type {Revision} */
424
- const canonicalRevision = {
425
- ...revision,
426
- parents: revision.parents.map(canonicalHash),
427
- snapshot: canonicalHash(revision.snapshot),
428
- lock: revision.lock === undefined ? undefined : canonicalLock(revision.lock),
429
- }
438
+ step(
439
+ resolveParents(cas)(input.parents),
440
+ (/** @type {Result<readonly Revision[], string>} */ parentsResult) => {
441
+ const revisionResult = okThen(buildRevision(input))(parentsResult)
442
+ if (revisionResult[0] === 'error') { return pure(revisionResult) }
443
+ const canonicalRevision = revisionResult[1]
430
444
  const bytes = tryUtf8(encodeText(canonicalRevision))
431
445
  if (bytes === null) {
432
446
  return pure(error('revision too large to encode'))
433
447
  }
434
- return eff(cas.write(nonEmpty(ok(bytes), /** @type {List<never, Ok<Vec>>} */ (elEmpty()))))
435
- .step((/** @type {IoResult<Vec>} */ writeResult) => {
448
+ return step(
449
+ cas.write(nonEmpty(ok(bytes), /** @type {List<never, Ok<Vec>>} */ (elEmpty()))),
450
+ (/** @type {IoResult<Vec>} */ writeResult) => {
436
451
  if (writeResult[0] === 'error') {
437
452
  return /** @type {Effect<MemOp, Result<Hash, string>>} */ (pure(error('failed to write revision to CAS')))
438
453
  }
439
454
  const hash = vecToCBase32(writeResult[1])
440
- return eff(foldIntoCache(cacheKey)(hash)(canonicalRevision))
441
- .step(() => pure(ok(hash)))
442
- .value
455
+ return mapStep(foldIntoCache(cacheKey)(hash)(canonicalRevision), () => ok(hash))
443
456
  })
444
- .value
445
457
  })
446
- .value
447
458
 
448
459
  /**
449
460
  * Projects a decoded `Revision` into the shared {@link RevisionData}
@@ -525,9 +536,7 @@ export const readRevision = cas => hash => {
525
536
  const hashVec = cBase32ToVec(hash)
526
537
  return hashVec === null
527
538
  ? pure(error(`invalid hash: ${hash}`))
528
- : eff(collectRead(cas.read(hashVec)))
529
- .map(decodeReadRevision(hash))
530
- .value
539
+ : mapStep(collectRead(cas.read(hashVec)), decodeReadRevision(hash))
531
540
  }
532
541
 
533
542
  /**
@@ -540,17 +549,15 @@ export const readRevision = cas => hash => {
540
549
  export const evo = cas => cacheKey => ({
541
550
  list: archived => {
542
551
  const listed = subjectListed(archived)
543
- return eff(read(cacheKey))
544
- .step(cache => pure(definedEntries(cache.bySubject)
545
- .flatMap(([subject, state]) => listed(state) ? [subject] : [])))
546
- .value
552
+ return mapStep(
553
+ read(cacheKey),
554
+ cache => definedEntries(cache.bySubject)
555
+ .flatMap(([subject, state]) => listed(state) ? [subject] : []))
547
556
  },
548
- head: subject => eff(read(cacheKey))
549
- .step(cache => {
550
- const state = at(subject)(cache.bySubject)
551
- return pure(state === null ? [] : headsOf(state))
552
- })
553
- .value,
557
+ head: subject => mapStep(read(cacheKey), cache => {
558
+ const state = at(subject)(cache.bySubject)
559
+ return state === null ? [] : headsOf(state)
560
+ }),
554
561
  add: input => addRevision(cas)(cacheKey)(input),
555
562
  revision: readRevision(cas),
556
563
  })
@@ -7,7 +7,11 @@
7
7
  * @import { RevisionData } from './types.ts'
8
8
  */
9
9
 
10
- import { assert, assertEq } from '../../asserts/module.f.mjs'
10
+ import {
11
+ assert,
12
+ assertEq,
13
+ assertStructurallySame,
14
+ } from '../../asserts/module.f.mjs'
11
15
  import { pure } from '../../effects/module.f.mjs'
12
16
  import { fileCas } from '../module.f.mjs'
13
17
  import { sha256 } from '../../crypto/sha2/module.f.mjs'
@@ -18,7 +22,6 @@ import { unwrap } from '../../types/nullable/module.f.mjs'
18
22
  import { ok, error } from '../../types/result/module.f.mjs'
19
23
  import { nonEmpty, empty as elEmpty } from '../../effects/list/module.f.mjs'
20
24
  import { tryUtf8 } from '../../text/module.f.mjs'
21
-
22
25
  import { dialect as revisionDialect } from '../../media/revision/module.f.mjs'
23
26
  import {
24
27
  buildCache, decodeRevisionBlob, initEvo, evo, emptyCache, syncRevision,
@@ -65,7 +68,7 @@ export const proof = {
65
68
  buildCacheEmptyStoreYieldsEmptyCache: () => {
66
69
  const c = fileCas(sha256)(home)
67
70
  const [, cache] = virtual(emptyState)(buildCache(c))
68
- assertEq(JSON.stringify(cache), JSON.stringify(emptyCache))
71
+ assertStructurallySame(cache, emptyCache)
69
72
  },
70
73
  buildCacheSkipsNonRevisionBlob: () => {
71
74
  const c = fileCas(sha256)(home)
@@ -22,8 +22,7 @@ import { sha256 } from '../crypto/sha2/module.f.mjs'
22
22
  import { join, normalize, parse } from '../path/module.f.mjs'
23
23
  import { empty, length, maxLength, maxLengthBytes, msb, vec } from '../types/bit_vec/module.f.mjs'
24
24
  import { cBase32ToVec, vecToCBase32 } from '../basen/cbase32/module.f.mjs'
25
- import { foldStep, forEachStep, history, historyStep, okStep, pure, step } from '../effects/module.f.mjs'
26
- import { eff } from '../effects/eff/module.f.mjs'
25
+ import { foldStep, forEachStep, history, historyStep, mapStep, okStep, pure, step } from '../effects/module.f.mjs'
27
26
  import {
28
27
  access,
29
28
  createExclusive,
@@ -74,18 +73,16 @@ export const toPath = key => {
74
73
  export const collectRead = stream => {
75
74
  /** @type {(acc: Vec) => (s: List<O, IoResult<Vec>>) => Effect<O, IoResult<Vec>>} */
76
75
  const loop = acc => s =>
77
- eff(s)
78
- .step((/** @type {*} */ node) => {
79
- if (node === undefined) { return pure(ok(acc)) }
80
- const { first, tail } = node
81
- const [t, v] = first
82
- if (t === 'error') { return pure(first) }
83
- if (length(acc) + length(v) > maxLength) {
84
- return pure(error(`cas blob exceeds maximum vector length of ${maxLength} bits`))
85
- }
86
- return loop(msb.concat(acc)(v))(tail)
87
- })
88
- .value
76
+ step(s, node => {
77
+ if (node === undefined) { return pure(ok(acc)) }
78
+ const { first, tail } = node
79
+ const [t, v] = first
80
+ if (t === 'error') { return pure(first) }
81
+ if (length(acc) + length(v) > maxLength) {
82
+ return pure(error(`cas blob exceeds maximum vector length of ${maxLength} bits`))
83
+ }
84
+ return loop(msb.concat(acc)(v))(tail)
85
+ })
89
86
  return loop(empty)(stream)
90
87
  }
91
88
 
@@ -133,21 +130,24 @@ const deadlineOf = name => Number(name.slice(0, name.indexOf('-')))
133
130
  * @param {string} stageDir
134
131
  * @returns {Effect<O, void>}
135
132
  */
136
- const gcStage = stageDir =>
137
- eff(now())
138
- .step(() => readdir(stageDir, {}))
139
- .step(([k, v], t) => {
133
+ const gcStage = stageDir => {
134
+ // The `readdir` result and the `now()` timestamp are both needed by the last
135
+ // link, so the timestamp is carried forward in a history rather than closed
136
+ // over by a nested continuation.
137
+ const listed = historyStep(
138
+ history(now()),
139
+ () => readdir(stageDir, {}))
140
+ return step(
141
+ listed,
142
+ ([[k, v], t]) => {
140
143
  if (k === 'error') { return pure(undefined) }
141
144
  const expired = v.flatMap(d =>
142
145
  d.isFile && deadlineOf(d.name) < t ? [d.name] : [])
143
146
  return forEachStep(
144
147
  pure(expired),
145
- name =>
146
- eff(rm(join(stageDir, name)))
147
- .step(() => pure(undefined))
148
- .value)
148
+ name => mapStep(rm(join(stageDir, name)), () => undefined))
149
149
  })
150
- .value
150
+ }
151
151
 
152
152
  // Lock-free staging upload (plan/staging-lease.md): stream each chunk straight
153
153
  // to a `_stage/<deadline>-<rand>` file via `writeBytes` while folding it into the
@@ -176,69 +176,61 @@ const writeImpl = (sha2, path, stageDir, payload) => {
176
176
  const rel = toPath(hash)
177
177
  const dst = join(path, rel)
178
178
  const dstDir = join(path, ...parse(rel).slice(0, -1))
179
- return eff(mkdir(dstDir, { recursive: true }))
180
- .step(() => rename(curPath, dst))
181
- .step(() => rm(curPath))
182
- .step(() => stat(dst))
183
- .step(st => pure(st[0] === 'ok' && st[1].size === offset ? ok(hash) : error('publish size mismatch')))
184
- .value
179
+ const created = step(mkdir(dstDir, { recursive: true }), () => rename(curPath, dst))
180
+ const removed = step(created, () => rm(curPath))
181
+ const stated = step(removed, () => stat(dst))
182
+ return mapStep(
183
+ stated,
184
+ st => st[0] === 'ok' && st[1].size === offset ? ok(hash) : error('publish size mismatch'))
185
185
  }
186
186
  // Any streaming error fails closed: delete the partial file, return the error.
187
187
  /** @type {(curPath: string, e: unknown) => Effect<FileCasOperation, IoResult<Vec>>} */
188
188
  const fail = (curPath, e) =>
189
- eff(rm(curPath))
190
- .step(() => pure(error(e)))
191
- .value
192
- return eff(gcStage(stageDir)).step(() =>
193
- eff(random256).step(rnd => {
194
- const rndStr = vecToCBase32(rnd)
195
- /** @type {(state: Sha2State, offset: number, curPath: string) => (stream: List<O1, IoResult<Vec>>) => Effect<O1 | FileCasOperation, IoResult<Vec>>} */
196
- const loop = (state, offset, curPath) =>
197
- stream =>
198
- eff(stream)
199
- .step((node) => {
200
- if (node === undefined) {
201
- return publish(state, offset, curPath)
202
- }
203
- const { first, tail } = node
204
- if (first[0] === 'error') {
205
- return fail(curPath, first[1])
206
- }
207
- const chunk = first[1]
208
- return eff(writeBytes(curPath, offset, chunk))
209
- .step(wb => {
210
- if (wb[0] === 'error') { return fail(curPath, wb[1]) }
211
- const newState = sha2.append(chunk)(state)
212
- const newOffset = offset + Number(length(chunk) / 8n)
213
- // Renew the lease: rename to a fresh deadline (keeps `delta` constant).
214
- // The new path is still needed after the rename, to recurse with,
215
- // so the rename captures it rather than closing over it.
216
- const nextPath = step(
217
- now(),
218
- t => pure(join(stageDir, stageName(t + leaseDelta, rndStr))))
219
- const renamed = historyStep(
220
- history(nextPath),
221
- next => rename(curPath, next))
222
- return step(
223
- renamed,
224
- ([[rt, v], next]) =>
225
- rt === 'error'
226
- ? fail(curPath, v)
227
- : loop(newState, newOffset, next)(tail))
228
- })
229
- .value
230
- })
231
- .value
232
- return eff(mkdir(stageDir, { recursive: true }))
233
- .step(() => now())
234
- .step(t0 => {
235
- const path0 = join(stageDir, stageName(t0 + leaseDelta, rndStr))
236
- return eff(createExclusive(path0))
237
- .step(okStep(() => loop(sha2.init, 0, path0)(payload)))
238
- .value
189
+ mapStep(rm(curPath), () => error(e))
190
+ const rndEffect = step(gcStage(stageDir), () => random256)
191
+ return step(rndEffect, rnd => {
192
+ const rndStr = vecToCBase32(rnd)
193
+ /** @type {(state: Sha2State, offset: number, curPath: string) => (stream: List<O1, IoResult<Vec>>) => Effect<O1 | FileCasOperation, IoResult<Vec>>} */
194
+ const loop = (state, offset, curPath) =>
195
+ stream =>
196
+ step(stream, node => {
197
+ if (node === undefined) {
198
+ return publish(state, offset, curPath)
199
+ }
200
+ const { first, tail } = node
201
+ if (first[0] === 'error') {
202
+ return fail(curPath, first[1])
203
+ }
204
+ const chunk = first[1]
205
+ return step(writeBytes(curPath, offset, chunk), wb => {
206
+ if (wb[0] === 'error') { return fail(curPath, wb[1]) }
207
+ const newState = sha2.append(chunk)(state)
208
+ const newOffset = offset + Number(length(chunk) / 8n)
209
+ // Renew the lease: rename to a fresh deadline (keeps `delta` constant).
210
+ // The new path is still needed after the rename, to recurse with,
211
+ // so the rename captures it rather than closing over it.
212
+ const nextPath = step(
213
+ now(),
214
+ t => pure(join(stageDir, stageName(t + leaseDelta, rndStr))))
215
+ const renamed = historyStep(
216
+ history(nextPath),
217
+ next => rename(curPath, next))
218
+ return step(
219
+ renamed,
220
+ ([[rt, v], next]) =>
221
+ rt === 'error'
222
+ ? fail(curPath, v)
223
+ : loop(newState, newOffset, next)(tail))
224
+ })
239
225
  })
240
- .value
241
- }).value).value
226
+ const started = step(mkdir(stageDir, { recursive: true }), () => now())
227
+ return step(started, t0 => {
228
+ const path0 = join(stageDir, stageName(t0 + leaseDelta, rndStr))
229
+ return step(
230
+ createExclusive(path0),
231
+ okStep(() => loop(sha2.init, 0, path0)(payload)))
232
+ })
233
+ })
242
234
  }
243
235
 
244
236
  /**
@@ -255,8 +247,9 @@ export const fileCas = sha2 => path => {
255
247
  const p = join(path, toPath(hash))
256
248
  /** @type {(offset: number) => List<FileCasOperation, IoResult<Vec>>} */
257
249
  const loop = offset =>
258
- eff(readBytes(p, offset, chunkBytes))
259
- .step(/** @type {(result: IoResult<Vec>) => List<FileCasOperation, IoResult<Vec>>} */ (result) => {
250
+ step(
251
+ readBytes(p, offset, chunkBytes),
252
+ /** @type {(result: IoResult<Vec>) => List<FileCasOperation, IoResult<Vec>>} */ (result) => {
260
253
  const [t, v] = result
261
254
  // A missing shard or read error is an explicit error item, never EOF.
262
255
  if (t === 'error') {
@@ -268,7 +261,6 @@ export const fileCas = sha2 => path => {
268
261
  ? elEmpty()
269
262
  : nonEmpty(ok(v), loop(offset + chunkBytes))
270
263
  })
271
- .value
272
264
  return loop(0)
273
265
  },
274
266
  write: payload => writeImpl(sha2, path, stageDir, payload),
@@ -277,20 +269,18 @@ export const fileCas = sha2 => path => {
277
269
  // empty store, mirroring how `read` maps a missing shard to an error item.
278
270
  // A `.cas` that exists but cannot be read (permissions, corruption) is a
279
271
  // genuine storage error and is surfaced, not masked as "no hashes".
280
- eff(access(storePrefix))
281
- .step(a => {
282
- if (a[0] === 'error') {
283
- if (isNotFound(a[1])) { return pure(/** @type {readonly Vec[]} */ ([])) }
284
- throw a[1]
285
- }
286
- return eff(readdir(storePrefix, { recursive: true }))
287
- .step(r => pure(unwrap(r).flatMap(({ name, parentPath, isFile }) =>
288
- toOption(isFile
289
- ? cBase32ToVec(normalize(parentPath).substring(normalizedStorePrefix.length).replaceAll('/', '') + name)
290
- : null))))
291
- .value
292
- })
293
- .value,
272
+ step(access(storePrefix), a => {
273
+ if (a[0] === 'error') {
274
+ if (isNotFound(a[1])) { return pure(/** @type {readonly Vec[]} */ ([])) }
275
+ throw a[1]
276
+ }
277
+ return mapStep(
278
+ readdir(storePrefix, { recursive: true }),
279
+ r => unwrap(r).flatMap(({ name, parentPath, isFile }) =>
280
+ toOption(isFile
281
+ ? cBase32ToVec(normalize(parentPath).substring(normalizedStorePrefix.length).replaceAll('/', '') + name)
282
+ : null)))
283
+ }),
294
284
  url: hash =>
295
285
  join(path, toPath(hash))
296
286
  }
@@ -305,9 +295,7 @@ const random256 =
305
295
  pure([0, 1, 2, 3, 4, 5, 6, 7]),
306
296
  empty,
307
297
  () => (/** @type {Vec} */ acc) =>
308
- eff(randomInt())
309
- .step(r => pure(msb.concat(acc)(vec(32n)(BigInt(r)))))
310
- .value)
298
+ mapStep(randomInt(), r => msb.concat(acc)(vec(32n)(BigInt(r)))))
311
299
 
312
300
  /** Streams any file at `filePath` in `<=128 KiB` chunks as a `ListEffect` of `ok` items.
313
301
  *
@@ -316,8 +304,9 @@ const random256 =
316
304
  const streamFile = filePath => {
317
305
  /** @type {(offset: number) => List<ReadBytes, IoResult<Vec>>} */
318
306
  const loop = offset =>
319
- eff(readBytes(filePath, offset, chunkBytes))
320
- .step(/** @type {(result: IoResult<Vec>) => List<ReadBytes, IoResult<Vec>>} */ (result) => {
307
+ step(
308
+ readBytes(filePath, offset, chunkBytes),
309
+ /** @type {(result: IoResult<Vec>) => List<ReadBytes, IoResult<Vec>>} */ (result) => {
321
310
  if (result[0] === 'error') {
322
311
  return nonEmpty(result, elEmpty())
323
312
  }
@@ -326,7 +315,6 @@ const streamFile = filePath => {
326
315
  ? elEmpty()
327
316
  : nonEmpty(ok(chunk), loop(offset + chunkBytes))
328
317
  })
329
- .value
330
318
  return loop(0)
331
319
  }
332
320
 
@@ -355,9 +343,8 @@ export const casAddFile = cas => path =>
355
343
  export const casUpload = home => fileName => {
356
344
  const src = join(home, 'cas_upload', fileName)
357
345
  const c = fileCas(sha256)(home)
358
- return eff(casAddFile(c)(src))
359
- .step(okStep(/** @type {(v: Vec) => Effect<Rm, IoResult<Vec>>} */ (v => eff(rm(src))
360
- .step(() => pure(ok(v)))
361
- .value)))
362
- .value
346
+ return step(
347
+ casAddFile(c)(src),
348
+ okStep(/** @type {(v: Vec) => Effect<Rm, IoResult<Vec>>} */ (v =>
349
+ mapStep(rm(src), () => ok(v)))))
363
350
  }
@@ -1,4 +1,3 @@
1
- import type { Step, Job, MetaStep } from './types.ts';
2
1
  /**
3
2
  * Shared CI types and helpers: GitHub Actions step/job RTTI schemas, the
4
3
  * `MetaStep` representation used by tool-specific modules, and assemblers like
@@ -10,6 +9,7 @@ import type { Step, Job, MetaStep } from './types.ts';
10
9
  *
11
10
  * @import { Step, Job, MetaStep, StepType } from './types.ts'
12
11
  */
12
+ import type { Step, Job, MetaStep } from './types.ts';
13
13
  import { actions } from '../config/module.f.mjs';
14
14
  export declare const os: readonly ['ubuntu', 'macos', 'windows'];
15
15
  export declare const architecture: readonly ['intel', 'arm'];
@@ -9,6 +9,7 @@
9
9
  *
10
10
  * @import { Step, Job, MetaStep, StepType } from './types.ts'
11
11
  */
12
+
12
13
  import { actions, images } from '../config/module.f.mjs'
13
14
  import { option, array, record, string } from '../../types/rtti/module.f.mjs'
14
15
  import { parse as rttiParse } from '../../types/rtti/parse/module.f.mjs'