lawspec 0.30.0 → 0.31.1

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 (443) hide show
  1. package/CHANGELOG.md +405 -1
  2. package/README.md +19 -7
  3. package/api.mjs +1 -0
  4. package/beam-doctor.mjs +2 -2
  5. package/bin/lawspec.mjs +104 -96
  6. package/build.json +498 -406
  7. package/component-packages.mjs +339 -0
  8. package/component.d.ts +46 -0
  9. package/component.mjs +208 -0
  10. package/core.wasm +2 -2
  11. package/core_jsffi.js +5 -5
  12. package/examples/native-payments/clojure/lawspec.edn +48 -0
  13. package/examples/native-payments/clojure/src/domain/payments.clj +1 -1
  14. package/examples/native-payments/clojure/test/domain/payment_generators.clj +1 -1
  15. package/examples/native-payments/csharp/lawspec.edn +48 -0
  16. package/examples/native-payments/elixir/lawspec.edn +123 -0
  17. package/examples/native-payments/erlang/lawspec.edn +128 -0
  18. package/examples/native-payments/fsharp/lawspec.edn +123 -0
  19. package/examples/native-payments/gleam/lawspec.edn +123 -0
  20. package/examples/native-payments/go/lawspec.edn +123 -0
  21. package/examples/native-payments/groovy/lawspec.edn +123 -0
  22. package/examples/native-payments/haskell/lawspec.edn +123 -0
  23. package/examples/native-payments/java/lawspec.edn +123 -0
  24. package/examples/native-payments/javascript/lawspec.edn +123 -0
  25. package/examples/native-payments/kotlin/lawspec.edn +123 -0
  26. package/examples/native-payments/prolog/lawspec.edn +48 -0
  27. package/examples/native-payments/python/lawspec.edn +123 -0
  28. package/examples/native-payments/rust/lawspec.edn +124 -0
  29. package/examples/native-payments/scala/lawspec.edn +123 -0
  30. package/examples/native-payments/swift/lawspec.edn +123 -0
  31. package/examples/native-payments/typescript/lawspec.edn +123 -0
  32. package/examples/packages/orders/lawspec.edn +25 -0
  33. package/examples/packages/shop-domain/lawspec.edn +13 -0
  34. package/examples/packages/shop-tax-1/lawspec.edn +9 -0
  35. package/examples/packages/shop-tax-2/lawspec.edn +9 -0
  36. package/examples/specs/handler_bindings.lawspec +2 -2
  37. package/files.mjs +2 -1
  38. package/go.mod +4 -0
  39. package/index.d.ts +135 -2
  40. package/input-files.mjs +47 -0
  41. package/launcher.mjs +33 -13
  42. package/learn/adapters.mjs +226 -0
  43. package/learn/app.mjs +1279 -0
  44. package/learn/assert.mjs +33 -0
  45. package/learn/assets.mjs +15 -0
  46. package/learn/browser-runtime.mjs +58 -0
  47. package/learn/bundle.mjs +118 -0
  48. package/learn/compile-worker.mjs +106 -0
  49. package/learn/compiler.mjs +230 -0
  50. package/learn/coverage.json +8187 -0
  51. package/learn/curriculum.json +2952 -0
  52. package/learn/fantomas-worker.mjs +25 -0
  53. package/learn/format-worker.mjs +148 -0
  54. package/learn/fsharp.mjs +83 -0
  55. package/learn/harness-host.mjs +22 -0
  56. package/learn/index.html +326 -0
  57. package/learn/lawspec-core.mjs +223 -0
  58. package/learn/lawspec-language.mjs +69 -0
  59. package/learn/node-test.mjs +11 -0
  60. package/learn/presentation.mjs +73 -0
  61. package/learn/runner.mjs +72 -0
  62. package/learn/sandbox-frame.html +34 -0
  63. package/learn/sandbox.mjs +91 -0
  64. package/learn/store.mjs +141 -0
  65. package/learn/story.mjs +42 -0
  66. package/learn/style-options.json +16 -0
  67. package/learn/style.css +1023 -0
  68. package/learn/theme.js +77 -0
  69. package/learn/typescript.mjs +53 -0
  70. package/learn/vendor/@fontsource-atkinson-hyperlegible-LICENSE.txt +93 -0
  71. package/learn/vendor/@fontsource-atkinson-hyperlegible-mono-LICENSE.txt +93 -0
  72. package/learn/vendor/@fontsource-overpass-LICENSE.txt +93 -0
  73. package/learn/vendor/assemblies.json +1 -0
  74. package/learn/vendor/editor-worker.js +30 -0
  75. package/learn/vendor/editor.css +1 -0
  76. package/learn/vendor/editor.mjs +931 -0
  77. package/learn/vendor/esbuild-wasm-LICENSE.txt +21 -0
  78. package/learn/vendor/esbuild.mjs +2683 -0
  79. package/learn/vendor/esbuild.wasm +0 -0
  80. package/learn/vendor/fable-library/Array.js +1347 -0
  81. package/learn/vendor/fable-library/Async.js +134 -0
  82. package/learn/vendor/fable-library/AsyncBuilder.js +183 -0
  83. package/learn/vendor/fable-library/BigInt.js +306 -0
  84. package/learn/vendor/fable-library/BitConverter.js +138 -0
  85. package/learn/vendor/fable-library/Boolean.js +22 -0
  86. package/learn/vendor/fable-library/CHANGELOG.md +242 -0
  87. package/learn/vendor/fable-library/Char.js +202 -0
  88. package/learn/vendor/fable-library/Choice.js +184 -0
  89. package/learn/vendor/fable-library/CollectionUtil.js +182 -0
  90. package/learn/vendor/fable-library/ConditionalWeakTable.js +21 -0
  91. package/learn/vendor/fable-library/Date.js +841 -0
  92. package/learn/vendor/fable-library/DateOffset.js +261 -0
  93. package/learn/vendor/fable-library/DateOnly.js +124 -0
  94. package/learn/vendor/fable-library/Decimal.js +238 -0
  95. package/learn/vendor/fable-library/Double.js +47 -0
  96. package/learn/vendor/fable-library/Encoding.js +185 -0
  97. package/learn/vendor/fable-library/Event.js +93 -0
  98. package/learn/vendor/fable-library/FSharp.Collections.js +45 -0
  99. package/learn/vendor/fable-library/FSharp.Core.CompilerServices.js +27 -0
  100. package/learn/vendor/fable-library/FSharp.Core.js +156 -0
  101. package/learn/vendor/fable-library/Global.js +29 -0
  102. package/learn/vendor/fable-library/Guid.js +161 -0
  103. package/learn/vendor/fable-library/Int32.js +135 -0
  104. package/learn/vendor/fable-library/List.js +1323 -0
  105. package/learn/vendor/fable-library/Long.js +47 -0
  106. package/learn/vendor/fable-library/MailboxProcessor.js +94 -0
  107. package/learn/vendor/fable-library/Map.js +1396 -0
  108. package/learn/vendor/fable-library/MapUtil.js +130 -0
  109. package/learn/vendor/fable-library/MutableMap.js +339 -0
  110. package/learn/vendor/fable-library/MutableSet.js +233 -0
  111. package/learn/vendor/fable-library/Native.js +14 -0
  112. package/learn/vendor/fable-library/Numeric.js +75 -0
  113. package/learn/vendor/fable-library/Observable.js +113 -0
  114. package/learn/vendor/fable-library/Option.js +104 -0
  115. package/learn/vendor/fable-library/README.md +3 -0
  116. package/learn/vendor/fable-library/Random.js +172 -0
  117. package/learn/vendor/fable-library/Range.js +45 -0
  118. package/learn/vendor/fable-library/Reflection.js +479 -0
  119. package/learn/vendor/fable-library/RegExp.js +141 -0
  120. package/learn/vendor/fable-library/Result.js +165 -0
  121. package/learn/vendor/fable-library/Seq.js +1417 -0
  122. package/learn/vendor/fable-library/Seq2.js +111 -0
  123. package/learn/vendor/fable-library/Set.js +1816 -0
  124. package/learn/vendor/fable-library/String.js +674 -0
  125. package/learn/vendor/fable-library/System.Collections.Generic.js +333 -0
  126. package/learn/vendor/fable-library/System.Text.js +200 -0
  127. package/learn/vendor/fable-library/System.js +289 -0
  128. package/learn/vendor/fable-library/TimeOnly.js +122 -0
  129. package/learn/vendor/fable-library/TimeSpan.js +180 -0
  130. package/learn/vendor/fable-library/Timer.js +67 -0
  131. package/learn/vendor/fable-library/Types.js +198 -0
  132. package/learn/vendor/fable-library/Unicode.13.0.0.js +4 -0
  133. package/learn/vendor/fable-library/Uri.js +165 -0
  134. package/learn/vendor/fable-library/Util.js +796 -0
  135. package/learn/vendor/fable-library/big.d.ts +338 -0
  136. package/learn/vendor/fable-library/lib/big.js +825 -0
  137. package/learn/vendor/fable-library/package.json +24 -0
  138. package/learn/vendor/fable-library/quotation.js +618 -0
  139. package/learn/vendor/fable.js +430 -0
  140. package/learn/vendor/fantomas/FSharp.Core.uawo19tl4c.wasm +0 -0
  141. package/learn/vendor/fantomas/Fantomas.Core.stnanlnpyw.wasm +0 -0
  142. package/learn/vendor/fantomas/Fantomas.FCS.lqohfu5o9y.wasm +0 -0
  143. package/learn/vendor/fantomas/LawSpec.Learn.Formatter.5arcua4vy0.wasm +0 -0
  144. package/learn/vendor/fantomas/LawSpec.Learn.Formatter.u1ne3a6xd2.wasm +0 -0
  145. package/learn/vendor/fantomas/Microsoft.CSharp.mp8lhr6rez.wasm +0 -0
  146. package/learn/vendor/fantomas/Microsoft.VisualBasic.0e5fchkecn.wasm +0 -0
  147. package/learn/vendor/fantomas/Microsoft.VisualBasic.Core.17wn27qal2.wasm +0 -0
  148. package/learn/vendor/fantomas/Microsoft.Win32.Primitives.9d566sle9e.wasm +0 -0
  149. package/learn/vendor/fantomas/Microsoft.Win32.Registry.52dy96yk8i.wasm +0 -0
  150. package/learn/vendor/fantomas/System.AppContext.jwujeh069z.wasm +0 -0
  151. package/learn/vendor/fantomas/System.Buffers.y0isk1x97h.wasm +0 -0
  152. package/learn/vendor/fantomas/System.Collections.Concurrent.x5koi7bzem.wasm +0 -0
  153. package/learn/vendor/fantomas/System.Collections.Immutable.diwg7advch.wasm +0 -0
  154. package/learn/vendor/fantomas/System.Collections.NonGeneric.4089xs440e.wasm +0 -0
  155. package/learn/vendor/fantomas/System.Collections.Specialized.hj81u7zblb.wasm +0 -0
  156. package/learn/vendor/fantomas/System.Collections.nvrdeoknr1.wasm +0 -0
  157. package/learn/vendor/fantomas/System.ComponentModel.Annotations.yatcnfjeuk.wasm +0 -0
  158. package/learn/vendor/fantomas/System.ComponentModel.DataAnnotations.led9l5awu3.wasm +0 -0
  159. package/learn/vendor/fantomas/System.ComponentModel.EventBasedAsync.hpvp6cf4de.wasm +0 -0
  160. package/learn/vendor/fantomas/System.ComponentModel.Primitives.v7cajwpaqo.wasm +0 -0
  161. package/learn/vendor/fantomas/System.ComponentModel.TypeConverter.xk1hnyt762.wasm +0 -0
  162. package/learn/vendor/fantomas/System.ComponentModel.rrnda1lucx.wasm +0 -0
  163. package/learn/vendor/fantomas/System.Configuration.bn9vghjcq8.wasm +0 -0
  164. package/learn/vendor/fantomas/System.Console.09ajpiafhz.wasm +0 -0
  165. package/learn/vendor/fantomas/System.Core.wc649o5mw9.wasm +0 -0
  166. package/learn/vendor/fantomas/System.Data.Common.s4cowzd9a9.wasm +0 -0
  167. package/learn/vendor/fantomas/System.Data.DataSetExtensions.5fm360ikxl.wasm +0 -0
  168. package/learn/vendor/fantomas/System.Data.fsu4j4t4jw.wasm +0 -0
  169. package/learn/vendor/fantomas/System.Diagnostics.Contracts.p74re5oxzn.wasm +0 -0
  170. package/learn/vendor/fantomas/System.Diagnostics.Debug.622sixg49n.wasm +0 -0
  171. package/learn/vendor/fantomas/System.Diagnostics.DiagnosticSource.2j35bc2g2b.wasm +0 -0
  172. package/learn/vendor/fantomas/System.Diagnostics.FileVersionInfo.7n0wdvltaa.wasm +0 -0
  173. package/learn/vendor/fantomas/System.Diagnostics.Process.8iffh49mew.wasm +0 -0
  174. package/learn/vendor/fantomas/System.Diagnostics.StackTrace.1yz88vico8.wasm +0 -0
  175. package/learn/vendor/fantomas/System.Diagnostics.TextWriterTraceListener.ua8iuh2vhj.wasm +0 -0
  176. package/learn/vendor/fantomas/System.Diagnostics.Tools.roy5445ugj.wasm +0 -0
  177. package/learn/vendor/fantomas/System.Diagnostics.TraceSource.6qx1ldzz7g.wasm +0 -0
  178. package/learn/vendor/fantomas/System.Diagnostics.Tracing.b4799zpaas.wasm +0 -0
  179. package/learn/vendor/fantomas/System.Drawing.8gcjjqj0pu.wasm +0 -0
  180. package/learn/vendor/fantomas/System.Drawing.Primitives.y2uveru2yk.wasm +0 -0
  181. package/learn/vendor/fantomas/System.Dynamic.Runtime.023zrvzh9x.wasm +0 -0
  182. package/learn/vendor/fantomas/System.Formats.Asn1.znpklkbgqv.wasm +0 -0
  183. package/learn/vendor/fantomas/System.Formats.Tar.5yybjepfi2.wasm +0 -0
  184. package/learn/vendor/fantomas/System.Globalization.Calendars.10g6hyjy3k.wasm +0 -0
  185. package/learn/vendor/fantomas/System.Globalization.Extensions.hrinfrismg.wasm +0 -0
  186. package/learn/vendor/fantomas/System.Globalization.uvs4rah8fk.wasm +0 -0
  187. package/learn/vendor/fantomas/System.IO.4j645gw40d.wasm +0 -0
  188. package/learn/vendor/fantomas/System.IO.Compression.2z7vdt6tfb.wasm +0 -0
  189. package/learn/vendor/fantomas/System.IO.Compression.Brotli.fv80xs79j3.wasm +0 -0
  190. package/learn/vendor/fantomas/System.IO.Compression.FileSystem.88jdddz3sw.wasm +0 -0
  191. package/learn/vendor/fantomas/System.IO.Compression.ZipFile.jkn9avr4vo.wasm +0 -0
  192. package/learn/vendor/fantomas/System.IO.FileSystem.AccessControl.yme0uhbu37.wasm +0 -0
  193. package/learn/vendor/fantomas/System.IO.FileSystem.DriveInfo.qas7wf73rs.wasm +0 -0
  194. package/learn/vendor/fantomas/System.IO.FileSystem.Primitives.d1jmhkzu0e.wasm +0 -0
  195. package/learn/vendor/fantomas/System.IO.FileSystem.Watcher.z570derp0d.wasm +0 -0
  196. package/learn/vendor/fantomas/System.IO.FileSystem.o6jtz51fup.wasm +0 -0
  197. package/learn/vendor/fantomas/System.IO.IsolatedStorage.hqyeyb5ipe.wasm +0 -0
  198. package/learn/vendor/fantomas/System.IO.MemoryMappedFiles.zhamjnusxd.wasm +0 -0
  199. package/learn/vendor/fantomas/System.IO.Pipelines.wrmw5vws31.wasm +0 -0
  200. package/learn/vendor/fantomas/System.IO.Pipes.AccessControl.qcancj8gj2.wasm +0 -0
  201. package/learn/vendor/fantomas/System.IO.Pipes.zhcyguvwkr.wasm +0 -0
  202. package/learn/vendor/fantomas/System.IO.UnmanagedMemoryStream.o8cpjnlard.wasm +0 -0
  203. package/learn/vendor/fantomas/System.Linq.AsyncEnumerable.hyc0b7okjw.wasm +0 -0
  204. package/learn/vendor/fantomas/System.Linq.Expressions.ldibvm0efj.wasm +0 -0
  205. package/learn/vendor/fantomas/System.Linq.Parallel.2buevezvch.wasm +0 -0
  206. package/learn/vendor/fantomas/System.Linq.Queryable.cvq43g1awj.wasm +0 -0
  207. package/learn/vendor/fantomas/System.Linq.lz6mvi0hm2.wasm +0 -0
  208. package/learn/vendor/fantomas/System.Memory.3jekerw0ga.wasm +0 -0
  209. package/learn/vendor/fantomas/System.Net.Http.Json.8k237kkwec.wasm +0 -0
  210. package/learn/vendor/fantomas/System.Net.Http.cityx2bvcl.wasm +0 -0
  211. package/learn/vendor/fantomas/System.Net.HttpListener.s1jreclykx.wasm +0 -0
  212. package/learn/vendor/fantomas/System.Net.Mail.cmlj4c0gto.wasm +0 -0
  213. package/learn/vendor/fantomas/System.Net.NameResolution.q3gf18q13l.wasm +0 -0
  214. package/learn/vendor/fantomas/System.Net.NetworkInformation.xaz5tjw7d0.wasm +0 -0
  215. package/learn/vendor/fantomas/System.Net.Ping.a40atim1h0.wasm +0 -0
  216. package/learn/vendor/fantomas/System.Net.Primitives.i88i20r8sr.wasm +0 -0
  217. package/learn/vendor/fantomas/System.Net.Quic.hx06eo5xkj.wasm +0 -0
  218. package/learn/vendor/fantomas/System.Net.Requests.hkjxlfe5f5.wasm +0 -0
  219. package/learn/vendor/fantomas/System.Net.Security.ch34yya69o.wasm +0 -0
  220. package/learn/vendor/fantomas/System.Net.ServerSentEvents.0u7o0jk3p1.wasm +0 -0
  221. package/learn/vendor/fantomas/System.Net.ServicePoint.xbhxnytx4l.wasm +0 -0
  222. package/learn/vendor/fantomas/System.Net.Sockets.hzgzlvkc9l.wasm +0 -0
  223. package/learn/vendor/fantomas/System.Net.WebClient.84i8nwzbgu.wasm +0 -0
  224. package/learn/vendor/fantomas/System.Net.WebHeaderCollection.326nl7s9g3.wasm +0 -0
  225. package/learn/vendor/fantomas/System.Net.WebProxy.oq3mgkkqef.wasm +0 -0
  226. package/learn/vendor/fantomas/System.Net.WebSockets.2cx1v74vg8.wasm +0 -0
  227. package/learn/vendor/fantomas/System.Net.WebSockets.Client.rafzkktw8j.wasm +0 -0
  228. package/learn/vendor/fantomas/System.Net.w1hpj3bo6r.wasm +0 -0
  229. package/learn/vendor/fantomas/System.Numerics.Vectors.oyv7biw9ux.wasm +0 -0
  230. package/learn/vendor/fantomas/System.Numerics.lyu36wqn19.wasm +0 -0
  231. package/learn/vendor/fantomas/System.ObjectModel.kxu80demuu.wasm +0 -0
  232. package/learn/vendor/fantomas/System.Private.CoreLib.1vy46s12u6.wasm +0 -0
  233. package/learn/vendor/fantomas/System.Private.DataContractSerialization.ao8k9iu77a.wasm +0 -0
  234. package/learn/vendor/fantomas/System.Private.Uri.itn0n2zjd0.wasm +0 -0
  235. package/learn/vendor/fantomas/System.Private.Xml.19nzpxrx8w.wasm +0 -0
  236. package/learn/vendor/fantomas/System.Private.Xml.Linq.tw5eq1hjvo.wasm +0 -0
  237. package/learn/vendor/fantomas/System.Reflection.DispatchProxy.7lajnj8s8c.wasm +0 -0
  238. package/learn/vendor/fantomas/System.Reflection.Emit.7liz9zln06.wasm +0 -0
  239. package/learn/vendor/fantomas/System.Reflection.Emit.ILGeneration.1ut3qgacw8.wasm +0 -0
  240. package/learn/vendor/fantomas/System.Reflection.Emit.Lightweight.d0gvllb1jj.wasm +0 -0
  241. package/learn/vendor/fantomas/System.Reflection.Extensions.zr5bhwfczd.wasm +0 -0
  242. package/learn/vendor/fantomas/System.Reflection.Metadata.ff6np6mz2j.wasm +0 -0
  243. package/learn/vendor/fantomas/System.Reflection.Primitives.igpmvwv78c.wasm +0 -0
  244. package/learn/vendor/fantomas/System.Reflection.TypeExtensions.qouojzlnp9.wasm +0 -0
  245. package/learn/vendor/fantomas/System.Reflection.mk3jyxvh13.wasm +0 -0
  246. package/learn/vendor/fantomas/System.Resources.Reader.41ppfyz2vc.wasm +0 -0
  247. package/learn/vendor/fantomas/System.Resources.ResourceManager.sfwvfmw1ea.wasm +0 -0
  248. package/learn/vendor/fantomas/System.Resources.Writer.3uvs9tp38z.wasm +0 -0
  249. package/learn/vendor/fantomas/System.Runtime.CompilerServices.Unsafe.puz1xm53oc.wasm +0 -0
  250. package/learn/vendor/fantomas/System.Runtime.CompilerServices.VisualC.9qdau315py.wasm +0 -0
  251. package/learn/vendor/fantomas/System.Runtime.Extensions.i7gntui96b.wasm +0 -0
  252. package/learn/vendor/fantomas/System.Runtime.Handles.00oxj4o6ov.wasm +0 -0
  253. package/learn/vendor/fantomas/System.Runtime.InteropServices.JavaScript.9kq1vofond.wasm +0 -0
  254. package/learn/vendor/fantomas/System.Runtime.InteropServices.RuntimeInformation.my7qeqbhfh.wasm +0 -0
  255. package/learn/vendor/fantomas/System.Runtime.InteropServices.vqp80tnwc7.wasm +0 -0
  256. package/learn/vendor/fantomas/System.Runtime.Intrinsics.u0samjybfo.wasm +0 -0
  257. package/learn/vendor/fantomas/System.Runtime.Loader.n6zxw1b98a.wasm +0 -0
  258. package/learn/vendor/fantomas/System.Runtime.Numerics.o40sjhz59x.wasm +0 -0
  259. package/learn/vendor/fantomas/System.Runtime.Serialization.Formatters.1esvva4te3.wasm +0 -0
  260. package/learn/vendor/fantomas/System.Runtime.Serialization.Json.4n7u09advh.wasm +0 -0
  261. package/learn/vendor/fantomas/System.Runtime.Serialization.Primitives.xs2bo91wvk.wasm +0 -0
  262. package/learn/vendor/fantomas/System.Runtime.Serialization.Xml.ny21jmziti.wasm +0 -0
  263. package/learn/vendor/fantomas/System.Runtime.Serialization.qcxaur5wqs.wasm +0 -0
  264. package/learn/vendor/fantomas/System.Runtime.odq454d6j9.wasm +0 -0
  265. package/learn/vendor/fantomas/System.Security.AccessControl.8yfnzmqzaq.wasm +0 -0
  266. package/learn/vendor/fantomas/System.Security.Claims.8ogy0860de.wasm +0 -0
  267. package/learn/vendor/fantomas/System.Security.Cryptography.Algorithms.8zijp1svfw.wasm +0 -0
  268. package/learn/vendor/fantomas/System.Security.Cryptography.Cng.yxagtt77no.wasm +0 -0
  269. package/learn/vendor/fantomas/System.Security.Cryptography.Csp.uhfbvvau84.wasm +0 -0
  270. package/learn/vendor/fantomas/System.Security.Cryptography.Encoding.2ywrusvy8q.wasm +0 -0
  271. package/learn/vendor/fantomas/System.Security.Cryptography.OpenSsl.oa268u7i92.wasm +0 -0
  272. package/learn/vendor/fantomas/System.Security.Cryptography.Primitives.5uhvqe8puk.wasm +0 -0
  273. package/learn/vendor/fantomas/System.Security.Cryptography.X509Certificates.6i7pxilopt.wasm +0 -0
  274. package/learn/vendor/fantomas/System.Security.Cryptography.d0quqk1iyr.wasm +0 -0
  275. package/learn/vendor/fantomas/System.Security.Principal.Windows.gpqua4rz29.wasm +0 -0
  276. package/learn/vendor/fantomas/System.Security.Principal.i20kfklf3g.wasm +0 -0
  277. package/learn/vendor/fantomas/System.Security.SecureString.x2y8tzci3c.wasm +0 -0
  278. package/learn/vendor/fantomas/System.Security.e83vvh6sl2.wasm +0 -0
  279. package/learn/vendor/fantomas/System.ServiceModel.Web.poglliv2no.wasm +0 -0
  280. package/learn/vendor/fantomas/System.ServiceProcess.yro5uj2opo.wasm +0 -0
  281. package/learn/vendor/fantomas/System.Text.Encoding.CodePages.2wchx40i7z.wasm +0 -0
  282. package/learn/vendor/fantomas/System.Text.Encoding.Extensions.8utaw61kn5.wasm +0 -0
  283. package/learn/vendor/fantomas/System.Text.Encoding.cxdyfepnpj.wasm +0 -0
  284. package/learn/vendor/fantomas/System.Text.Encodings.Web.37ehbi7cye.wasm +0 -0
  285. package/learn/vendor/fantomas/System.Text.Json.ixiaa8hd3h.wasm +0 -0
  286. package/learn/vendor/fantomas/System.Text.RegularExpressions.2fhfmkk6vf.wasm +0 -0
  287. package/learn/vendor/fantomas/System.Threading.6pry74a050.wasm +0 -0
  288. package/learn/vendor/fantomas/System.Threading.AccessControl.76zfdfy8go.wasm +0 -0
  289. package/learn/vendor/fantomas/System.Threading.Channels.gpxnr01lmp.wasm +0 -0
  290. package/learn/vendor/fantomas/System.Threading.Overlapped.aqpl8tzdyc.wasm +0 -0
  291. package/learn/vendor/fantomas/System.Threading.Tasks.Dataflow.ytwttt7fzh.wasm +0 -0
  292. package/learn/vendor/fantomas/System.Threading.Tasks.Extensions.0deavcb00v.wasm +0 -0
  293. package/learn/vendor/fantomas/System.Threading.Tasks.Parallel.tjwtxugso0.wasm +0 -0
  294. package/learn/vendor/fantomas/System.Threading.Tasks.fu4qd5h3qy.wasm +0 -0
  295. package/learn/vendor/fantomas/System.Threading.Thread.klaua2by9m.wasm +0 -0
  296. package/learn/vendor/fantomas/System.Threading.ThreadPool.mkzm212njz.wasm +0 -0
  297. package/learn/vendor/fantomas/System.Threading.Timer.yp49llu5h2.wasm +0 -0
  298. package/learn/vendor/fantomas/System.Transactions.Local.vz6cgeh4w7.wasm +0 -0
  299. package/learn/vendor/fantomas/System.Transactions.ipwm3rsy66.wasm +0 -0
  300. package/learn/vendor/fantomas/System.ValueTuple.7ol6ljuhx8.wasm +0 -0
  301. package/learn/vendor/fantomas/System.Web.HttpUtility.itlvncjd96.wasm +0 -0
  302. package/learn/vendor/fantomas/System.Web.np8uzzakvl.wasm +0 -0
  303. package/learn/vendor/fantomas/System.Windows.18nzio44t3.wasm +0 -0
  304. package/learn/vendor/fantomas/System.Xml.45jprtg1pa.wasm +0 -0
  305. package/learn/vendor/fantomas/System.Xml.Linq.v9v8udncm1.wasm +0 -0
  306. package/learn/vendor/fantomas/System.Xml.ReaderWriter.a9mr08uzci.wasm +0 -0
  307. package/learn/vendor/fantomas/System.Xml.Serialization.03juoguwgc.wasm +0 -0
  308. package/learn/vendor/fantomas/System.Xml.XDocument.c9dhjnzqjb.wasm +0 -0
  309. package/learn/vendor/fantomas/System.Xml.XPath.XDocument.138b12i1pm.wasm +0 -0
  310. package/learn/vendor/fantomas/System.Xml.XPath.pvxm9341ce.wasm +0 -0
  311. package/learn/vendor/fantomas/System.Xml.XmlDocument.450wsyxvl0.wasm +0 -0
  312. package/learn/vendor/fantomas/System.Xml.XmlSerializer.y3t2n0tce7.wasm +0 -0
  313. package/learn/vendor/fantomas/System.gjriafnqmz.wasm +0 -0
  314. package/learn/vendor/fantomas/WindowsBase.8zsce9qxfb.wasm +0 -0
  315. package/learn/vendor/fantomas/cs/FSharp.Core.resources.9ehmavdel7.wasm +0 -0
  316. package/learn/vendor/fantomas/de/FSharp.Core.resources.2ofmxloa01.wasm +0 -0
  317. package/learn/vendor/fantomas/dotnet.js +1233 -0
  318. package/learn/vendor/fantomas/dotnet.native.b6l13xorvf.js +16 -0
  319. package/learn/vendor/fantomas/dotnet.native.rw4kynp763.wasm +0 -0
  320. package/learn/vendor/fantomas/dotnet.runtime.v06hirbjsv.js +4 -0
  321. package/learn/vendor/fantomas/es/FSharp.Core.resources.hkr5ggb4tr.wasm +0 -0
  322. package/learn/vendor/fantomas/fr/FSharp.Core.resources.43soen28ow.wasm +0 -0
  323. package/learn/vendor/fantomas/icudt_CJK.tjcz0u77k5.dat +0 -0
  324. package/learn/vendor/fantomas/icudt_EFIGS.tptq2av103.dat +0 -0
  325. package/learn/vendor/fantomas/icudt_no_CJK.lfu7j35m59.dat +0 -0
  326. package/learn/vendor/fantomas/it/FSharp.Core.resources.m60n5ls7oq.wasm +0 -0
  327. package/learn/vendor/fantomas/ja/FSharp.Core.resources.o6oof69v14.wasm +0 -0
  328. package/learn/vendor/fantomas/ko/FSharp.Core.resources.q6l4snlu9o.wasm +0 -0
  329. package/learn/vendor/fantomas/mscorlib.8ptuc08eli.wasm +0 -0
  330. package/learn/vendor/fantomas/netstandard.eymp85mooh.wasm +0 -0
  331. package/learn/vendor/fantomas/pl/FSharp.Core.resources.8bni0w6j8b.wasm +0 -0
  332. package/learn/vendor/fantomas/pt-BR/FSharp.Core.resources.k849vqm41u.wasm +0 -0
  333. package/learn/vendor/fantomas/ru/FSharp.Core.resources.jz9rhhtsla.wasm +0 -0
  334. package/learn/vendor/fantomas/tr/FSharp.Core.resources.wn6vbvjm1u.wasm +0 -0
  335. package/learn/vendor/fantomas/zh-Hans/FSharp.Core.resources.z7zzbso094.wasm +0 -0
  336. package/learn/vendor/fantomas/zh-Hant/FSharp.Core.resources.iammfsi7ls.wasm +0 -0
  337. package/learn/vendor/fast-check-LICENSE.txt +21 -0
  338. package/learn/vendor/fast-check.mjs +37 -0
  339. package/learn/vendor/fonts/atkinson-hyperlegible-latin-400-normal.woff2 +0 -0
  340. package/learn/vendor/fonts/atkinson-hyperlegible-latin-700-normal.woff2 +0 -0
  341. package/learn/vendor/fonts/atkinson-hyperlegible-mono-latin-400-normal.woff2 +0 -0
  342. package/learn/vendor/fonts/overpass-latin-600-normal.woff2 +0 -0
  343. package/learn/vendor/fonts/overpass-latin-700-normal.woff2 +0 -0
  344. package/learn/vendor/formatter-licenses/DotNet-LICENSE.txt +23 -0
  345. package/learn/vendor/formatter-licenses/DotNet-THIRD-PARTY-NOTICES.txt +1418 -0
  346. package/learn/vendor/formatter-licenses/FSharp-LICENSE.txt +23 -0
  347. package/learn/vendor/formatter-licenses/Fantomas-LICENSE.txt +202 -0
  348. package/learn/vendor/formatter-licenses/README.md +12 -0
  349. package/learn/vendor/manifest.json +1358 -0
  350. package/learn/vendor/metadata/Browser.Blob.dll +0 -0
  351. package/learn/vendor/metadata/Browser.Dom.dll +0 -0
  352. package/learn/vendor/metadata/Browser.Event.dll +0 -0
  353. package/learn/vendor/metadata/Browser.Gamepad.dll +0 -0
  354. package/learn/vendor/metadata/Browser.WebGL.dll +0 -0
  355. package/learn/vendor/metadata/Browser.WebStorage.dll +0 -0
  356. package/learn/vendor/metadata/FSharp.Core.dll +0 -0
  357. package/learn/vendor/metadata/Fable.Core.dll +0 -0
  358. package/learn/vendor/metadata/Fable.Repl.Lib.dll +0 -0
  359. package/learn/vendor/metadata/System.Collections.Concurrent.dll +0 -0
  360. package/learn/vendor/metadata/System.Collections.dll +0 -0
  361. package/learn/vendor/metadata/System.ComponentModel.Primitives.dll +0 -0
  362. package/learn/vendor/metadata/System.ComponentModel.TypeConverter.dll +0 -0
  363. package/learn/vendor/metadata/System.ComponentModel.dll +0 -0
  364. package/learn/vendor/metadata/System.Console.dll +0 -0
  365. package/learn/vendor/metadata/System.Core.dll +0 -0
  366. package/learn/vendor/metadata/System.Diagnostics.Debug.dll +0 -0
  367. package/learn/vendor/metadata/System.Diagnostics.Tools.dll +0 -0
  368. package/learn/vendor/metadata/System.Diagnostics.Tracing.dll +0 -0
  369. package/learn/vendor/metadata/System.Globalization.dll +0 -0
  370. package/learn/vendor/metadata/System.IO.dll +0 -0
  371. package/learn/vendor/metadata/System.Net.Requests.dll +0 -0
  372. package/learn/vendor/metadata/System.Net.WebClient.dll +0 -0
  373. package/learn/vendor/metadata/System.Numerics.dll +0 -0
  374. package/learn/vendor/metadata/System.Reflection.Extensions.dll +0 -0
  375. package/learn/vendor/metadata/System.Reflection.Metadata.dll +0 -0
  376. package/learn/vendor/metadata/System.Reflection.Primitives.dll +0 -0
  377. package/learn/vendor/metadata/System.Reflection.TypeExtensions.dll +0 -0
  378. package/learn/vendor/metadata/System.Reflection.dll +0 -0
  379. package/learn/vendor/metadata/System.Runtime.Extensions.dll +0 -0
  380. package/learn/vendor/metadata/System.Runtime.InteropServices.dll +0 -0
  381. package/learn/vendor/metadata/System.Runtime.Numerics.dll +0 -0
  382. package/learn/vendor/metadata/System.Runtime.dll +0 -0
  383. package/learn/vendor/metadata/System.Text.Encoding.Extensions.dll +0 -0
  384. package/learn/vendor/metadata/System.Text.Encoding.dll +0 -0
  385. package/learn/vendor/metadata/System.Text.RegularExpressions.dll +0 -0
  386. package/learn/vendor/metadata/System.Threading.Tasks.dll +0 -0
  387. package/learn/vendor/metadata/System.Threading.Thread.dll +0 -0
  388. package/learn/vendor/metadata/System.Threading.dll +0 -0
  389. package/learn/vendor/metadata/System.ValueTuple.dll +0 -0
  390. package/learn/vendor/metadata/System.dll +0 -0
  391. package/learn/vendor/metadata/mscorlib.dll +0 -0
  392. package/learn/vendor/metadata/netstandard.dll +0 -0
  393. package/learn/vendor/monaco-editor-LICENSE.txt +21 -0
  394. package/learn/vendor/prettier/babel.mjs +16 -0
  395. package/learn/vendor/prettier/brace-style.mjs +376 -0
  396. package/learn/vendor/prettier/estree.mjs +44 -0
  397. package/learn/vendor/prettier/standalone.mjs +29 -0
  398. package/learn/vendor/prettier/typescript.mjs +22 -0
  399. package/learn/vendor/prettier-LICENSE.txt +7 -0
  400. package/learn/vendor/prettier-plugin-brace-style-LICENSE.txt +21 -0
  401. package/learn/vendor/typescript-LICENSE.txt +55 -0
  402. package/learn/vendor/typescript-libs.json +1 -0
  403. package/learn/vendor/typescript.mjs +451 -0
  404. package/learn/vendor/zod-LICENSE.txt +21 -0
  405. package/learn/web-format.mjs +8 -0
  406. package/learn.mjs +126 -0
  407. package/lsp.mjs +10 -5
  408. package/native-evidence.mjs +50 -15
  409. package/native-examples.mjs +8 -7
  410. package/native-host.mjs +71 -0
  411. package/package.json +10 -4
  412. package/proof.d.ts +8 -2
  413. package/proof.mjs +183 -31
  414. package/scala-build-state.mjs +59 -0
  415. package/templates.mjs +242 -2
  416. package/test-command.mjs +192 -60
  417. package/builtin-data-names.mjs +0 -73
  418. package/examples/native-payments/clojure/lawspec.json +0 -62
  419. package/examples/native-payments/csharp/lawspec.json +0 -62
  420. package/examples/native-payments/elixir/lawspec.json +0 -160
  421. package/examples/native-payments/erlang/lawspec.json +0 -159
  422. package/examples/native-payments/fsharp/lawspec.json +0 -178
  423. package/examples/native-payments/gleam/lawspec.json +0 -160
  424. package/examples/native-payments/go/lawspec.json +0 -147
  425. package/examples/native-payments/groovy/lawspec.json +0 -176
  426. package/examples/native-payments/haskell/lawspec.json +0 -160
  427. package/examples/native-payments/java/lawspec.json +0 -176
  428. package/examples/native-payments/javascript/lawspec.json +0 -160
  429. package/examples/native-payments/kotlin/lawspec.json +0 -176
  430. package/examples/native-payments/prolog/lawspec.json +0 -20
  431. package/examples/native-payments/python/lawspec.json +0 -160
  432. package/examples/native-payments/rust/lawspec.json +0 -178
  433. package/examples/native-payments/scala/lawspec.json +0 -176
  434. package/examples/native-payments/swift/lawspec.json +0 -165
  435. package/examples/native-payments/typescript/lawspec.json +0 -160
  436. package/examples/packages/orders/lawspec.json +0 -27
  437. package/examples/packages/shop-domain/lawspec-package.json +0 -7
  438. package/examples/packages/shop-tax-1/lawspec-package.json +0 -5
  439. package/examples/packages/shop-tax-2/lawspec-package.json +0 -5
  440. package/explain.mjs +0 -114
  441. package/expression-presentation.mjs +0 -333
  442. package/positional-fields.mjs +0 -13
  443. package/typed-presentation.mjs +0 -165
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Colin McDonnell
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,8 @@
1
+ // Google's gts settings are shared by repository and on-device formatting.
2
+ // The pinned brace-style plugin provides the owner's Allman override.
3
+ // ref:DEC-google-style-allman
4
+ export async function formatWeb(source, path, {prettier, plugins, style})
5
+ {
6
+ const parser = /\.[cm]?tsx?$/.test(path) ? 'typescript' : 'babel';
7
+ return prettier.format(source, {...style, parser, plugins});
8
+ }
package/learn.mjs ADDED
@@ -0,0 +1,126 @@
1
+ // Generated from templates/npm/learn.mjs by lawspec-dev generate. Do not edit.
2
+ import {createServer} from 'node:http';
3
+ import {readFile, realpath, stat, cp, mkdir, copyFile} from 'node:fs/promises';
4
+ import path from 'node:path';
5
+ import {fileURLToPath} from 'node:url';
6
+ import {gzipSync} from 'node:zlib';
7
+
8
+ let compressed;
9
+ async function packagedAssets()
10
+ {
11
+ try
12
+ {
13
+ await readFile(new URL('./learn/vendor/manifest.json', import.meta.url));
14
+ await readFile(new URL('./learn/sandbox-frame.html', import.meta.url));
15
+ }
16
+ catch
17
+ {
18
+ throw new Error(
19
+ 'Learn assets are missing. In a compiler checkout run npm ci --prefix learn, make generate, and npm run build --prefix learn.',
20
+ );
21
+ }
22
+ }
23
+ async function compilerBytes()
24
+ {
25
+ return (compressed ??= gzipSync(
26
+ await readFile(fileURLToPath(new URL('./core.wasm', import.meta.url))),
27
+ {level: 9},
28
+ ));
29
+ }
30
+
31
+ export async function packageLearn(destination)
32
+ {
33
+ await packagedAssets();
34
+ await mkdir(destination, {recursive: true});
35
+ await cp(fileURLToPath(new URL('./learn/', import.meta.url)), destination, {
36
+ recursive: true,
37
+ });
38
+ await copyFile(
39
+ fileURLToPath(new URL('./core_jsffi.js', import.meta.url)),
40
+ path.join(destination, 'core_jsffi.js'),
41
+ );
42
+ const {writeFile} = await import('node:fs/promises');
43
+ await writeFile(
44
+ path.join(destination, 'core.wasm.gz'),
45
+ await compilerBytes(),
46
+ );
47
+ }
48
+
49
+ export async function serveLearn(port = '8384', {quiet = false} = {})
50
+ {
51
+ await packagedAssets();
52
+ if (!/^\d+$/.test(String(port)) || Number(port) < 0 || Number(port) > 65535)
53
+ throw new Error(
54
+ '--port must be an integer from 1 to 65535 (0 selects an available port)',
55
+ );
56
+ const root = await realpath(
57
+ fileURLToPath(new URL('./learn/', import.meta.url)),
58
+ );
59
+ const types = {
60
+ '.html': 'text/html; charset=utf-8',
61
+ '.mjs': 'text/javascript; charset=utf-8',
62
+ '.js': 'text/javascript; charset=utf-8',
63
+ '.css': 'text/css; charset=utf-8',
64
+ '.json': 'application/json; charset=utf-8',
65
+ '.wasm': 'application/wasm',
66
+ '.woff2': 'font/woff2',
67
+ };
68
+ const server = createServer(async (request, response) =>
69
+ {
70
+ try
71
+ {
72
+ if (!['GET', 'HEAD'].includes(request.method))
73
+ {
74
+ response.writeHead(405);
75
+ response.end();
76
+ return;
77
+ }
78
+ const pathname = decodeURIComponent(
79
+ new URL(request.url, 'http://localhost').pathname,
80
+ );
81
+ if (pathname === '/core.wasm.gz')
82
+ {
83
+ response.writeHead(200, {
84
+ 'Content-Type': 'application/gzip',
85
+ 'Cache-Control': 'no-cache',
86
+ });
87
+ response.end(
88
+ request.method === 'HEAD' ? undefined : await compilerBytes(),
89
+ );
90
+ return;
91
+ }
92
+ const compilerAsset = pathname === '/core_jsffi.js';
93
+ const file = await realpath(
94
+ compilerAsset
95
+ ? fileURLToPath(new URL('.' + pathname, import.meta.url))
96
+ : path.join(root, pathname === '/' ? 'index.html' : pathname),
97
+ );
98
+ if (
99
+ (!compilerAsset && !file.startsWith(root + path.sep)) ||
100
+ !(await stat(file)).isFile()
101
+ )
102
+ throw new Error('not found');
103
+ response.writeHead(200, {
104
+ 'Content-Type': types[path.extname(file)] ?? 'application/octet-stream',
105
+ 'X-Content-Type-Options': 'nosniff',
106
+ 'Cache-Control': 'no-cache',
107
+ });
108
+ response.end(
109
+ request.method === 'HEAD' ? undefined : await readFile(file),
110
+ );
111
+ }
112
+ catch
113
+ {
114
+ response.writeHead(404);
115
+ response.end('Not found');
116
+ }
117
+ });
118
+ await new Promise((resolve, reject) =>
119
+ {
120
+ server.once('error', reject);
121
+ server.listen(Number(port), '127.0.0.1', resolve);
122
+ });
123
+ if (!quiet)
124
+ console.log(`Learn LawSpec: http://127.0.0.1:${server.address().port}/`);
125
+ return server;
126
+ }
package/lsp.mjs CHANGED
@@ -3,6 +3,7 @@ import { readFile, readdir, stat } from 'node:fs/promises';
3
3
  import { fileURLToPath, pathToFileURL } from 'node:url';
4
4
  import path from 'node:path';
5
5
  import { createCompiler } from './api.mjs';
6
+ import {findManifest, readManifest} from './component.mjs';
6
7
 
7
8
  export function utf16Position(text, location) {
8
9
  const line = Math.max(0, location.line - 1);
@@ -44,11 +45,15 @@ export async function serveLanguage(input = process.stdin, output = process.stdo
44
45
  else if (file.endsWith('.lawspec')) sources.set(file, { path: file, content: await readFile(file, 'utf8') });
45
46
  }
46
47
  let config;
47
- try { config = JSON.parse(await readFile(path.join(workspace, 'lawspec.json'), 'utf8')); }
48
- catch (error) { if (error.code !== 'ENOENT') throw error; }
49
- if(config&&(config.version!==2||config.languageProfile!=='1.0-rc.2'))
50
- throw new Error('The language server requires configuration version 2 and languageProfile 1.0-rc.2.');
51
- for (const entry of config?.sources ?? []) await visit(path.resolve(workspace, entry));
48
+ let root = workspace;
49
+ try {
50
+ const file = await findManifest(workspace);
51
+ config = await readManifest(file);
52
+ root = path.dirname(file);
53
+ } catch (error) {
54
+ if (!/No lawspec\.edn found/.test(error.message)) throw error;
55
+ }
56
+ for (const entry of config?.sources ?? []) await visit(path.resolve(root, entry));
52
57
  for (const [uri, document] of documents) sources.set(fileURLToPath(uri), { path: fileURLToPath(uri), content: document.text });
53
58
  return [...sources.values()];
54
59
  }
@@ -5,7 +5,7 @@ import path from 'node:path';
5
5
  import {doctor} from './doctor.mjs';
6
6
  import {planWrites} from './files.mjs';
7
7
  import {projectKey} from './failure-database.mjs';
8
- import {lawKeys,environmentDigest,recordedDigest,projectDigest,invocations} from './test-command.mjs';
8
+ import {lawKeys,presentationDigest,environmentDigest,recordedDigest,projectDigest,invocations} from './test-command.mjs';
9
9
 
10
10
  // Native execution observations are scoped to actual completed test slots.
11
11
  // They never establish a universal model proof or a witness-search completeness claim.
@@ -48,6 +48,8 @@ export function recordNativeAttempts(run, tests, {keys,seed,ok,profile,output,al
48
48
  // reported beside it are not inputs, so they change no key.
49
49
  export function attestedKeys(result) {
50
50
  const wiring=d=>[d.dependency,d.endpoint,d.kind,
51
+ ...(d.implementation?[[d.implementation.kind,d.implementation.product,d.implementation.version,
52
+ d.implementation.commit??null,d.implementation.digest??null]]:[]),
51
53
  ...(d.standIn?[d.standIn.identity,d.standIn.version,d.standIn.conformance]:[])];
52
54
  return new Map((result.evidence??[]).filter(item=>item.against||item.plannedAgainst)
53
55
  .map(item=>[item.declaration,JSON.stringify([
@@ -65,17 +67,17 @@ const observationOutcome=outcome=>outcome==='known-failing'?'known-discrepancy':
65
67
 
66
68
  // Only observations with matching current compiler/configuration/source/native
67
69
  // inputs are eligible for completed evidence. A stored timestamp alone is not.
68
- export async function readNativeObservations({compiler,input,selected,roots,configRoot,build,evidence,attestation}) {
70
+ export async function readNativeObservations({compiler,input,selected,roots,configRoot,config={},build,evidence,attestation}) {
69
71
  const records=await Promise.all(selected.map(async(target,index)=>{
70
72
  const root=roots[index],file=path.join(configRoot,'.lawspec/results',`${target.language}-${projectKey(root)}.json`);
71
73
  const record=JSON.parse(await readFile(file,'utf8').catch(error=>{
72
74
  if(error.code==='ENOENT')return '{}';throw error;
73
75
  }));
74
- return {target,root,attempts:record.attempts??{},runs:record.laws??{},attestations:record.attestations??{}};
76
+ return {target,root,attempts:record.attempts??{},runs:record.laws??{},presentation:record.presentation,attestations:record.attestations??{}};
75
77
  }));
76
78
  if(!records.some(record=>Object.keys(record.attempts).length))return [];
77
79
  const observations=[];
78
- for(const {target,root,attempts,runs,attestations}of records){
80
+ for(const {target,root,attempts,runs,presentation,attestations}of records){
79
81
  const plans=new Map(),contexts=new Map();
80
82
  // An attempt is keyed by the wiring of the attestation it ran under: the
81
83
  // one named now, or else the one lawspec test stored for its run.
@@ -112,10 +114,15 @@ export async function readNativeObservations({compiler,input,selected,roots,conf
112
114
  const report=await doctor(target,root,generated.files);
113
115
  if(!report.ok)result={reason:'The current native environment could not be checked: '+report.message};
114
116
  else {
117
+ const environment=await environmentDigest(root,report,target.language);
118
+ if(presentation!==presentationDigest(generated.files,environment)){
119
+ result={reason:'Current generated presentation has not passed native validation; run lawspec test'};
120
+ contexts.set(key,result);return result;
121
+ }
115
122
  const owned=new Set(generated.files.filter(file=>file.ownership==='generated').map(file=>file.path));
116
123
  const keys=lawKeys({build,target,machineBits:input.machineBits,minify,tests:generated.tests,files:generated.files,
117
- environment:await environmentDigest(root,report)+await recordedDigest(path.join(configRoot,'recorded')),
118
- project:await projectDigest(root,owned),attested:attestedKeys(generated)});
124
+ environment,recorded:await recordedDigest(path.join(configRoot,'recorded')),
125
+ project:await projectDigest(root,owned,target.language,{inputRoot:configRoot,inputs:config.inputs??[]}),attested:attestedKeys(generated)});
119
126
  result={generated,keys};
120
127
  }
121
128
  }
@@ -123,7 +130,19 @@ export async function readNativeObservations({compiler,input,selected,roots,conf
123
130
  contexts.set(key,result);return result;
124
131
  }
125
132
  for(const [id,baseline]of expected){
126
- const attempt=attempts[id];
133
+ let attempt=attempts[id],reuse;
134
+ if(!attempt)for(const original of Object.values(attempts)){
135
+ // Only a single ordinary-law observation can be re-associated here.
136
+ // Combined model methods keep their exact group identities.
137
+ if(original.outcome!=='passed'||original.check?.nativeGroup?.length!==1||
138
+ !isDeepStrictEqual(original.check.obligations,[{declaration:original.check.id,stage:'law'}])||
139
+ !isDeepStrictEqual(obligationTargets(baseline),[{declaration:id,stage:'law'}]))continue;
140
+ let candidate=await context(original.profile?.minify??false,wiredBy(original));
141
+ if(candidate.reason&&candidate.stale)candidate=await context(!original.profile?.minify,wiredBy(original));
142
+ if(!candidate.reason&&candidate.keys.get(id)===original.key&&baseline.key===original.planKey){
143
+ attempt=original;reuse={check:original.check.id,key:original.key,at:original.at};break;
144
+ }
145
+ }
127
146
  const row={target:target.language,root,check:{id,obligations:obligationTargets(baseline)},
128
147
  outcome:observationOutcome(attempt?.outcome??'not-run'),coverage:baseline.coverage,attempt};
129
148
  if(!attempt){observations.push({...row,freshness:'not-run',reason:'No completed native observation was recorded'});continue;}
@@ -132,29 +151,34 @@ export async function readNativeObservations({compiler,input,selected,roots,conf
132
151
  typeof profile.minify!=='boolean'){
133
152
  observations.push({...row,freshness:'stale',reason:'Compiler, target or machine profile differs'});continue;
134
153
  }
135
- const current=await context(profile.minify,wiredBy(attempt));
154
+ let current=await context(profile.minify,wiredBy(attempt));
155
+ // Layout belongs to the artifact, not to the meaning of its old run.
156
+ // Accept the other canonical layout only when it exactly matches disk.
157
+ if(current.reason&&current.stale)current=await context(!profile.minify,wiredBy(attempt));
136
158
  if(current.reason){observations.push({...row,freshness:current.stale?'stale':'unavailable',reason:current.reason});continue;}
137
159
  const entry=current.generated.tests.find(entry=>entry.law===id);
138
160
  if(!entry||attempt.key!==current.keys.get(id)||attempt.planKey!==entry.key||
139
- !isDeepStrictEqual(attempt.check?.obligations,obligationTargets(entry))||
161
+ (!reuse&&!isDeepStrictEqual(attempt.check?.obligations,obligationTargets(entry)))||
140
162
  !isDeepStrictEqual(attempt.coverage,entry.coverage)){
141
163
  observations.push({...row,freshness:'stale',reason:'Specification, selection, bindings, native source or toolchain inputs differ'});continue;
142
164
  }
143
- const invocation=invocations(target,[entry],{root}).find(run=>run.laws?.includes(entry));
165
+ const observedEntry=reuse?{...entry,...attempt.check,law:attempt.check.id,key:attempt.planKey}:entry;
166
+ const invocation=invocations(target,[observedEntry],{root}).find(run=>run.laws?.includes(observedEntry));
167
+ const observedKeys=reuse?new Map([[observedEntry.law,attempt.key]]):current.keys;
144
168
  const validSeed=(typeof attempt.seed==='number'&&Number.isSafeInteger(attempt.seed)&&attempt.seed>=0)||
145
169
  (typeof attempt.seed==='string'&&/^[0-9]+$/.test(attempt.seed));
146
170
  const recomputed=validSeed&&Number.isFinite(Date.parse(attempt.at))&&invocation&&Array.isArray(attempt.tests)&&recordNativeAttempts(invocation,attempt.tests,
147
- {keys:current.keys,seed:attempt.seed,ok:attempt.invocation?.ok===true,profile,at:attempt.at,
148
- allEntries:current.generated.tests})[id];
171
+ {keys:observedKeys,seed:attempt.seed,ok:attempt.invocation?.ok===true,profile,at:attempt.at,
172
+ allEntries:reuse?[observedEntry]:current.generated.tests})[observedEntry.law];
149
173
  if(!recomputed||recomputed.outcome!==attempt.outcome||
150
174
  !isDeepStrictEqual(recomputed.check.nativeGroup,attempt.check?.nativeGroup)){
151
175
  observations.push({...row,freshness:'unavailable',reason:'The stored observation does not establish the current native completion'});continue;
152
176
  }
153
177
  const run=runs[id];
154
- observations.push({...row,freshness:'matching-inputs',
178
+ observations.push({...row,freshness:'matching-inputs',...(reuse?{reused:reuse}:{}),
155
179
  ...(attempt.outcome==='passed'&&run?.key===attempt.key&&(run.flaky||run.adequacy)?
156
180
  {harness:{...(run.flaky?{flaky:true}:{}),...(run.adequacy?{adequacy:run.adequacy}:{})}}:{}),
157
- reason:attempt.outcome==='passed'?'Recorded native completion matches the current inputs':'Recorded native attempt matches the current inputs'});
181
+ reason:reuse?'Original native completion reused for the current semantic law; no fresh invocation is claimed':attempt.outcome==='passed'?'Recorded native completion matches the current inputs':'Recorded native attempt matches the current inputs'});
158
182
  }
159
183
  for(const [id,attempt]of Object.entries(attempts))if(!expected.has(id)&&Array.isArray(attempt.check?.obligations))
160
184
  observations.push({target:target.language,root,check:attempt.check,attempt,outcome:observationOutcome(attempt.outcome),
@@ -201,4 +225,15 @@ export function attachNativeEvidence(evidence,observations){
201
225
  });
202
226
  }
203
227
 
204
- export {nativeEvidenceText} from './explain.mjs';
228
+ // Native conformance a law's evidence row carries, for lawspec evidence.
229
+ export function nativeEvidenceText(item){
230
+ if(!item.nativeEvidence)return '';
231
+ const summary=item.nativeEvidence;
232
+ return [`Native conformance: ${summary.status}; search completeness: ${summary.searchCompleteness}`,
233
+ ...summary.observations.map(row=>`${row.target} (${row.root}): ${row.outcome}; ${row.freshness}`+
234
+ (row.attempt?`; seed ${row.attempt.seed}; ${row.attempt.at}`:'')+`; ${row.reason}`),
235
+ ...summary.observations.flatMap(row=>(row.attempt?.tests??[]).filter(test=>test.status==='failed')
236
+ .map(test=>`${test.name}: ${test.reason??test.failure??test.message??'native test failed'}`)),
237
+ ...summary.observations.filter(row=>row.attempt?.invocation.output)
238
+ .map(row=>'Native invocation output (scoped to that invocation):\n'+row.attempt.invocation.output)].join('\n');
239
+ }
@@ -3,6 +3,7 @@ import {readFile, readdir, mkdir} from 'node:fs/promises';
3
3
  import path from 'node:path';
4
4
  import {templates, commands, setup} from './templates.mjs';
5
5
  import {safePath, planWrites, applyWrites} from './files.mjs';
6
+ import {parseManifest, writeManifest} from './component.mjs';
6
7
 
7
8
  async function projectFiles(directory, prefix = '') {
8
9
  const files = {};
@@ -30,11 +31,11 @@ export async function exportNativePayments(options, selected) {
30
31
  ...await projectFiles(new URL(`./examples/native-payments/${target}/`, import.meta.url)),
31
32
  'laws/payments.lawspec': law,
32
33
  };
33
- const config = JSON.parse(files['lawspec.json']);
34
- if(config.version!==2||config.languageProfile!=='1.0-rc.2')
35
- throw new Error(`Bundled native payments configuration for ${target} must use version 2 and languageProfile 1.0-rc.2`);
34
+ const config = parseManifest(files['lawspec.edn']);
35
+ if(config.manifestVersion!==1||config.languageProfile!=='1.0-rc.2')
36
+ throw new Error(`Bundled native payments configuration for ${target} must use lawspec.edn and languageProfile 1.0-rc.2`);
36
37
  config.machineBits = options.machineBits ?? 64;
37
- files['lawspec.json'] = JSON.stringify(config, null, options.minify ? undefined : 2) + '\n';
38
+ files['lawspec.edn'] = writeManifest(config, {compact: options.minify === true});
38
39
  const instructions = target === 'gleam' ? setup[target].replace(
39
40
  'Prepare dependencies with gleam build, then run gleam test.',
40
41
  'Prepare dependencies with node prepare.mjs before generation, then run gleam test.') : setup[target];
@@ -44,8 +45,8 @@ This project checks application-owned payment types against the shared LawSpec
44
45
  model. Money maps to Price, currency variants have application names, and the
45
46
  archive preserves distinct present and absent payments.
46
47
 
47
- The specification uses the canonical language profile. The version 2 project
48
- configuration selects its verification layers explicitly. Most targets bind
48
+ The specification uses the canonical language profile. The component manifest
49
+ selects its verification layers explicitly. Most targets bind
49
50
  application-owned domain types; C#, Clojure and Prolog use the generated model data
50
51
  and bind the application's functions and generators.
51
52
 
@@ -77,7 +78,7 @@ the application so that runtime support is present.
77
78
 
78
79
  Edit the domain implementation or generator, then run the native tests again.
79
80
  For example, change the fee from 0.2 to 0.3: the exact-decimal law must fail.
80
- Edit \`lawspec.json\` to change native bindings and rerun \`lawspec generate\`.
81
+ Edit \`lawspec.edn\` to change native bindings and rerun \`lawspec generate\`.
81
82
 
82
83
  All exported project files are user-owned. Re-exporting preserves your edits;
83
84
  it reports changed bundled versions for review. Compiler-generated files use a
@@ -0,0 +1,71 @@
1
+ // Generated from templates/npm/native-host.mjs by lawspec-dev generate. Do not edit.
2
+ // Native execution identity is separate from the WebAssembly compiler cache
3
+ // and from the solver host. Conservatively bind the executable SDK bundle,
4
+ // its installed dependency closure, and the Node binary which runs it.
5
+ import {createHash} from 'node:crypto';
6
+ import {createRequire} from 'node:module';
7
+ import {readFile,readdir,realpath} from 'node:fs/promises';
8
+ import {fileURLToPath} from 'node:url';
9
+ import path from 'node:path';
10
+
11
+ const sdkRoot=fileURLToPath(new URL('.',import.meta.url));
12
+ // These modules only render explanations, serve editors, create examples or
13
+ // execute optional proofs. They do not select or certify native completion.
14
+ const separate=new Set(['proof.mjs','lsp.mjs','explain.mjs','scalars.mjs','examples-command.mjs']);
15
+ let nodeIdentityValue;
16
+ async function nodeIdentity(){
17
+ nodeIdentityValue??=(async()=>createHash('sha256').update(await readFile(process.execPath)).digest('hex'))();
18
+ return nodeIdentityValue;
19
+ }
20
+
21
+ export async function fingerprintNativeHost(root=sdkRoot){
22
+ const hash=createHash('sha256').update('lawspec-native-host-v1\0');
23
+ hash.update(JSON.stringify([await nodeIdentity(),process.version,process.platform,process.arch,process.execArgv,process.env.NODE_OPTIONS??'']));
24
+ const add=async(file,label)=>hash.update(label+'\0').update(await readFile(file)).update('\0');
25
+ // New SDK helper modules enter the identity automatically. Project output,
26
+ // declarations, documentation and core.wasm are deliberately outside it.
27
+ for(const entry of (await readdir(root,{withFileTypes:true})).sort((a,b)=>a.name<b.name?-1:a.name>b.name?1:0))
28
+ if(entry.isFile()&&((entry.name.endsWith('.mjs')&&!separate.has(entry.name))||entry.name==='core_jsffi.js'))
29
+ await add(path.join(root,entry.name),entry.name);
30
+ for(const entry of (await readdir(path.join(root,'bin'),{withFileTypes:true})).sort((a,b)=>a.name<b.name?-1:a.name>b.name?1:0))
31
+ if(entry.isFile()&&entry.name.endsWith('.mjs'))await add(path.join(root,'bin',entry.name),'bin/'+entry.name);
32
+ const manifest=JSON.parse(await readFile(path.join(root,'package.json'),'utf8'));
33
+ await add(path.join(root,'package.json'),'package.json');
34
+ const seen=new Set();
35
+ async function packageRoot(name,from){
36
+ let directory=path.dirname(createRequire(path.join(from,'package.json')).resolve(name));
37
+ while(true){
38
+ const candidate=path.join(directory,'package.json');
39
+ const value=await readFile(candidate,'utf8').then(JSON.parse,error=>{if(error.code==='ENOENT')return null;throw error;});
40
+ if(value?.name===name)return {directory:await realpath(directory),value};
41
+ const parent=path.dirname(directory);if(parent===directory)throw new Error('Cannot identify native host dependency '+name);
42
+ directory=parent;
43
+ }
44
+ }
45
+ async function dependency(name,from,optional=false){
46
+ let selected;
47
+ try{selected=await packageRoot(name,from);}catch(error){
48
+ if(optional&&error.code==='MODULE_NOT_FOUND'){hash.update('absent-optional:'+name+'\0');return;}throw error;
49
+ }
50
+ const {directory,value}=selected,label=path.relative(root,directory).split(path.sep).join('/');
51
+ hash.update('dependency:'+name+'\0'+label+'\0');
52
+ if(seen.has(directory))return;seen.add(directory);
53
+ async function walk(folder,relative=''){
54
+ for(const entry of (await readdir(folder,{withFileTypes:true})).sort((a,b)=>a.name<b.name?-1:a.name>b.name?1:0)){
55
+ const next=relative?relative+'/'+entry.name:entry.name;
56
+ if(entry.isSymbolicLink())throw new Error('Cannot fingerprint symbolic-link content in native host dependency: '+label+'/'+next);
57
+ if(entry.isDirectory()&&!['node_modules','.git'].includes(entry.name))await walk(path.join(folder,entry.name),next);
58
+ else if(entry.isFile())await add(path.join(folder,entry.name),label+'/'+next);
59
+ }
60
+ }
61
+ await walk(directory);
62
+ for(const child of Object.keys({...value.dependencies,...value.optionalDependencies}).sort())
63
+ await dependency(child,directory,Object.hasOwn(value.optionalDependencies??{},child));
64
+ }
65
+ for(const name of Object.keys({...manifest.dependencies,...manifest.optionalDependencies}).sort())
66
+ await dependency(name,root,Object.hasOwn(manifest.optionalDependencies??{},name));
67
+ return hash.digest('hex');
68
+ }
69
+
70
+ let identity;
71
+ export function nativeHostIdentity(){return identity??=fingerprintNativeHost();}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lawspec",
3
- "version": "0.30.0",
3
+ "version": "0.31.1",
4
4
  "description": "State the law once. Check it everywhere.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -22,17 +22,22 @@
22
22
  "./proof": {
23
23
  "types": "./proof.d.ts",
24
24
  "import": "./proof.mjs"
25
+ },
26
+ "./component": {
27
+ "types": "./component.d.ts",
28
+ "import": "./component.mjs"
25
29
  }
26
30
  },
27
31
  "types": "index.d.ts",
32
+ "dependencies": {"edn-data": "1.2.2", "tar": "7.5.22"},
28
33
  "files": [
29
34
  "*.mjs",
30
35
  "*.json",
31
- "index.d.ts",
32
- "proof.d.ts",
36
+ "*.d.ts",
33
37
  "bin",
34
38
  "core.wasm",
35
39
  "core_jsffi.js",
40
+ "go.mod",
36
41
  "README.md",
37
42
  "CHANGELOG.md",
38
43
  "LICENSE",
@@ -40,7 +45,8 @@
40
45
  "NORMALIZATION-LICENSES.txt",
41
46
  "starter.lawspec",
42
47
  "starter-rc1.lawspec",
43
- "examples"
48
+ "examples",
49
+ "learn"
44
50
  ],
45
51
  "scripts": {
46
52
  "prepack": "for f in README.md CHANGELOG.md; do cmp -s ../$f $f || { cp ../$f .$f.$$ && mv -f .$f.$$ $f; }; done",
package/proof.d.ts CHANGED
@@ -11,6 +11,10 @@ export interface Z3Options {
11
11
  }
12
12
  /** How a solver run went: shared by law and law-set evidence. */
13
13
  interface SolverRun {
14
+ /** Current task binding when a semantic result reuses an earlier execution. */
15
+ currentTaskFingerprint?: string;
16
+ /** Provenance of the completed execution reused; no fresh solver run occurred. */
17
+ reused?: {key:string; owner:string; declaration:string; taskFingerprint:string; runFingerprint:string};
14
18
  outcome: 'unsat' | 'sat' | 'unknown' | 'timeout' | 'resource-limit' | 'out-of-memory' | 'unavailable' | 'failed' | 'unsupported';
15
19
  reason: string;
16
20
  stdout?: string;
@@ -30,8 +34,10 @@ export interface LawSolverEvidence extends SolverRun {
30
34
  at: Location;
31
35
  encoding: 'lawspec-smtlib-v1' | 'lawspec-smtlib-v2';
32
36
  machineBits: 32 | 64;
33
- programFingerprint: string;
37
+ lawFingerprint: string;
34
38
  taskFingerprint?: string;
39
+ /** Current names for the same semantic induction plan; original cases remain in induction. */
40
+ currentInduction?: {on:string; using:string[]};
35
41
  status: 'proved' | 'refuted' | 'incomplete' | 'unsupported';
36
42
  model?: string;
37
43
  modelValidated?: boolean;
@@ -76,5 +82,5 @@ export interface ModelSolverEvidence extends SolverRun {
76
82
  counterexample?: undefined;
77
83
  }
78
84
  export type SolverEvidence = LawSolverEvidence | AnalysisSolverEvidence | ModelSolverEvidence;
79
- export function proofTaskFingerprint(task: {encoding:string;programFingerprint:string;machineBits:number;owner:string;declaration:string;script:string}):string;
85
+ export function proofTaskFingerprint(task: {encoding:string;lawFingerprint:string;machineBits:number;owner:string;declaration:string;script:string}):string;
80
86
  export function proveWithZ3(compiler:Compiler,request:CheckRequest,options?:Z3Options):Promise<Result & {solverEvidence:SolverEvidence[]}>;