eliscript 0.0.1 → 0.0.3

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 (417) hide show
  1. package/README.md +61 -0
  2. package/bootstrap/README.md +26 -0
  3. package/bootstrap/backends/README.md +515 -0
  4. package/bootstrap/backends/async.eli +230 -0
  5. package/bootstrap/backends/binary.eli +173 -0
  6. package/bootstrap/backends/capabilities.eli +74 -0
  7. package/bootstrap/backends/elf.eli +246 -0
  8. package/bootstrap/backends/managed.eli +5976 -0
  9. package/bootstrap/backends/memory.eli +100 -0
  10. package/bootstrap/backends/native.eli +2000 -0
  11. package/bootstrap/backends/numeric.eli +1362 -0
  12. package/bootstrap/backends/optimize.eli +79 -0
  13. package/bootstrap/backends/regexp.eli +2263 -0
  14. package/bootstrap/backends/sha256.eli +138 -0
  15. package/bootstrap/backends/wasm.eli +1161 -0
  16. package/bootstrap/compiler/analyzer.eli +165 -77
  17. package/bootstrap/compiler/compiler.eli +43 -19
  18. package/bootstrap/compiler/emitter.eli +780 -170
  19. package/bootstrap/compiler/expander.eli +136 -45
  20. package/bootstrap/compiler/formatter.eli +8 -1
  21. package/bootstrap/compiler/ir.eli +148 -45
  22. package/bootstrap/compiler/lower.eli +29 -2
  23. package/bootstrap/compiler/project.eli +51 -21
  24. package/bootstrap/compiler/reader.eli +128 -36
  25. package/bootstrap/compiler/source-map.eli +46 -4
  26. package/bootstrap/compiler/symbol.eli +2 -1
  27. package/bootstrap/compiler/syntax.eli +47 -12
  28. package/bootstrap/compiler/transient-analysis.eli +40 -4
  29. package/bootstrap/host/check-cli-legacy.mjs +163 -0
  30. package/bootstrap/host/check-cli.mjs +59 -158
  31. package/bootstrap/host/check-cli.mjs.map +1 -0
  32. package/bootstrap/host/compiler-session.eli +1579 -0
  33. package/bootstrap/host/compiler-tools.eli +513 -0
  34. package/bootstrap/host/eliscript-cli.mjs +53 -33
  35. package/bootstrap/host/eliscript-cli.mjs.map +1 -0
  36. package/bootstrap/host/project-cli-legacy.mjs +295 -0
  37. package/bootstrap/host/project-cli.mjs +74 -289
  38. package/bootstrap/host/project-cli.mjs.map +1 -0
  39. package/bootstrap/host/project-legacy.mjs +1080 -0
  40. package/bootstrap/host/project.mjs +210 -1060
  41. package/bootstrap/host/project.mjs.map +1 -0
  42. package/bootstrap/runtime/UNICODE-LICENSE.txt +39 -0
  43. package/bootstrap/runtime/memory.eli +30379 -0
  44. package/browser/host.mjs +732 -11
  45. package/browser/worker.mjs +6 -3
  46. package/compiler/eliscript-analyzer.el +371 -4
  47. package/compiler/eliscript-cli.el +84 -1
  48. package/compiler/eliscript-emitter.el +1189 -256
  49. package/compiler/eliscript-expander.el +147 -10
  50. package/compiler/eliscript-ir-emitter.el +725 -208
  51. package/compiler/eliscript-lower.el +127 -1
  52. package/compiler/eliscript-portable.el +177 -51
  53. package/compiler/eliscript-project.el +20 -2
  54. package/compiler/eliscript-reader.el +141 -57
  55. package/compiler/eliscript-source-map.el +26 -12
  56. package/compiler/eliscript-transient-analysis.el +382 -19
  57. package/dist/backends/async.mjs +561 -0
  58. package/dist/backends/async.mjs.macro-origins.json +1 -0
  59. package/dist/backends/async.mjs.map +1 -0
  60. package/dist/backends/binary.mjs +381 -0
  61. package/dist/backends/binary.mjs.macro-origins.json +1 -0
  62. package/dist/backends/binary.mjs.map +1 -0
  63. package/dist/backends/capabilities.mjs +237 -0
  64. package/dist/backends/capabilities.mjs.macro-origins.json +1 -0
  65. package/dist/backends/capabilities.mjs.map +1 -0
  66. package/dist/backends/elf.mjs +540 -0
  67. package/dist/backends/elf.mjs.macro-origins.json +1 -0
  68. package/dist/backends/elf.mjs.map +1 -0
  69. package/dist/backends/managed.mjs +10616 -0
  70. package/dist/backends/managed.mjs.macro-origins.json +1 -0
  71. package/dist/backends/managed.mjs.map +1 -0
  72. package/dist/backends/memory.mjs +278 -0
  73. package/dist/backends/memory.mjs.macro-origins.json +1 -0
  74. package/dist/backends/memory.mjs.map +1 -0
  75. package/dist/backends/native.mjs +4099 -0
  76. package/dist/backends/native.mjs.macro-origins.json +1 -0
  77. package/dist/backends/native.mjs.map +1 -0
  78. package/dist/backends/numeric.mjs +2458 -0
  79. package/dist/backends/numeric.mjs.macro-origins.json +1 -0
  80. package/dist/backends/numeric.mjs.map +1 -0
  81. package/dist/backends/optimize.mjs +204 -0
  82. package/dist/backends/optimize.mjs.macro-origins.json +1 -0
  83. package/dist/backends/optimize.mjs.map +1 -0
  84. package/dist/backends/regexp.mjs +2033 -0
  85. package/dist/backends/regexp.mjs.macro-origins.json +1 -0
  86. package/dist/backends/regexp.mjs.map +1 -0
  87. package/dist/backends/sha256.mjs +310 -0
  88. package/dist/backends/sha256.mjs.macro-origins.json +1 -0
  89. package/dist/backends/sha256.mjs.map +1 -0
  90. package/dist/backends/wasm.mjs +2258 -0
  91. package/dist/backends/wasm.mjs.macro-origins.json +1 -0
  92. package/dist/backends/wasm.mjs.map +1 -0
  93. package/dist/bootstrap/analyzer.mjs +1908 -776
  94. package/dist/bootstrap/analyzer.mjs.macro-origins.json +1 -0
  95. package/dist/bootstrap/analyzer.mjs.map +1 -1
  96. package/dist/bootstrap/compiler.mjs +450 -142
  97. package/dist/bootstrap/compiler.mjs.macro-origins.json +1 -0
  98. package/dist/bootstrap/compiler.mjs.map +1 -1
  99. package/dist/bootstrap/emitter.mjs +3083 -909
  100. package/dist/bootstrap/emitter.mjs.macro-origins.json +1 -0
  101. package/dist/bootstrap/emitter.mjs.map +1 -1
  102. package/dist/bootstrap/expander.mjs +2887 -1233
  103. package/dist/bootstrap/expander.mjs.macro-origins.json +1 -0
  104. package/dist/bootstrap/expander.mjs.map +1 -1
  105. package/dist/bootstrap/formatter.mjs +582 -218
  106. package/dist/bootstrap/formatter.mjs.macro-origins.json +1 -0
  107. package/dist/bootstrap/formatter.mjs.map +1 -1
  108. package/dist/bootstrap/ir.mjs +670 -116
  109. package/dist/bootstrap/ir.mjs.macro-origins.json +1 -0
  110. package/dist/bootstrap/ir.mjs.map +1 -1
  111. package/dist/bootstrap/lower.mjs +866 -257
  112. package/dist/bootstrap/lower.mjs.macro-origins.json +1 -0
  113. package/dist/bootstrap/lower.mjs.map +1 -1
  114. package/dist/bootstrap/package.json +1 -0
  115. package/dist/bootstrap/project.mjs +1168 -498
  116. package/dist/bootstrap/project.mjs.macro-origins.json +1 -0
  117. package/dist/bootstrap/project.mjs.map +1 -1
  118. package/dist/bootstrap/reader.mjs +674 -175
  119. package/dist/bootstrap/reader.mjs.macro-origins.json +1 -0
  120. package/dist/bootstrap/reader.mjs.map +1 -1
  121. package/dist/bootstrap/runtime/math.mjs +1117 -0
  122. package/dist/bootstrap/runtime/math.mjs.map +1 -0
  123. package/dist/bootstrap/runtime/unicode-case-data.mjs +10125 -0
  124. package/dist/bootstrap/runtime/unicode-case-data.mjs.map +1 -0
  125. package/dist/bootstrap/runtime/unicode-case.mjs +281 -0
  126. package/dist/bootstrap/runtime/unicode-case.mjs.map +1 -0
  127. package/dist/bootstrap/source-map.mjs +430 -119
  128. package/dist/bootstrap/source-map.mjs.macro-origins.json +1 -0
  129. package/dist/bootstrap/source-map.mjs.map +1 -1
  130. package/dist/bootstrap/symbol.mjs +229 -53
  131. package/dist/bootstrap/symbol.mjs.macro-origins.json +1 -0
  132. package/dist/bootstrap/symbol.mjs.map +1 -1
  133. package/dist/bootstrap/syntax.mjs +205 -7
  134. package/dist/bootstrap/syntax.mjs.macro-origins.json +1 -0
  135. package/dist/bootstrap/syntax.mjs.map +1 -1
  136. package/dist/bootstrap/transient-analysis.mjs +1185 -489
  137. package/dist/bootstrap/transient-analysis.mjs.macro-origins.json +1 -0
  138. package/dist/bootstrap/transient-analysis.mjs.map +1 -1
  139. package/dist/browser/compiler.js +199 -6478
  140. package/dist/browser/host.mjs +1078 -0
  141. package/dist/browser/loader.js +1 -0
  142. package/dist/browser/loader.mjs +231 -0
  143. package/dist/browser/worker.mjs +63 -0
  144. package/dist/compiler-artifact.json +1 -0
  145. package/dist/host/compiler-session.mjs +2980 -0
  146. package/dist/host/compiler-session.mjs.macro-origins.json +1 -0
  147. package/dist/host/compiler-session.mjs.map +1 -0
  148. package/dist/host/compiler-tools.mjs +1084 -0
  149. package/dist/host/compiler-tools.mjs.macro-origins.json +1 -0
  150. package/dist/host/compiler-tools.mjs.map +1 -0
  151. package/dist/literal-sources/runtime/core/collection-internals.eli +60 -0
  152. package/dist/literal-sources/runtime/core/collection.eli +639 -0
  153. package/dist/literal-sources/runtime/core/data-text.eli +290 -0
  154. package/dist/literal-sources/runtime/core/data.eli +22 -0
  155. package/dist/literal-sources/runtime/core/identifier.eli +44 -0
  156. package/dist/literal-sources/runtime/core/lazy-sequence.eli +131 -0
  157. package/dist/literal-sources/runtime/core/list.eli +19 -0
  158. package/dist/literal-sources/runtime/core/map.eli +9 -0
  159. package/dist/literal-sources/runtime/core/metadata-internals.eli +6 -0
  160. package/dist/literal-sources/runtime/core/metadata.eli +40 -0
  161. package/dist/literal-sources/runtime/core/object.eli +8 -0
  162. package/dist/literal-sources/runtime/core/order.eli +123 -0
  163. package/dist/literal-sources/runtime/core/persistent-kind.eli +28 -0
  164. package/dist/literal-sources/runtime/core/protocol-error.eli +32 -0
  165. package/dist/literal-sources/runtime/core/protocol.eli +28 -0
  166. package/dist/literal-sources/runtime/core/queue.eli +9 -0
  167. package/dist/literal-sources/runtime/core/record.eli +191 -0
  168. package/dist/literal-sources/runtime/core/regex.eli +158 -0
  169. package/dist/literal-sources/runtime/core/sequence.eli +305 -0
  170. package/dist/literal-sources/runtime/core/set-algebra.eli +28 -0
  171. package/dist/literal-sources/runtime/core/set.eli +9 -0
  172. package/dist/literal-sources/runtime/core/sorted.eli +408 -0
  173. package/dist/literal-sources/runtime/core/text.eli +14 -0
  174. package/dist/literal-sources/runtime/core/transducer.eli +268 -0
  175. package/dist/literal-sources/runtime/core/transient.eli +17 -0
  176. package/dist/literal-sources/runtime/core/truth.eli +4 -0
  177. package/dist/literal-sources/runtime/core/type.eli +232 -0
  178. package/dist/literal-sources/runtime/core/value-internals.eli +13 -0
  179. package/dist/literal-sources/runtime/core/value.eli +19 -0
  180. package/dist/literal-sources/runtime/core/vector.eli +25 -0
  181. package/dist/literal-sources/runtime/literals.eli +23 -0
  182. package/dist/literal-sources/runtime/testing/value.eli +6 -0
  183. package/dist/literal-sources/runtime/wire/http-rpc.eli +362 -0
  184. package/dist/literal-sources/runtime/wire/markdown.eli +275 -0
  185. package/dist/literal-sources/runtime/wire/schema.eli +193 -0
  186. package/dist/literal-sources/stdlib/bit.eli +36 -0
  187. package/dist/literal-sources/stdlib/core/data.eli +306 -0
  188. package/dist/literal-sources/stdlib/core/object.eli +89 -0
  189. package/dist/literal-sources/stdlib/core/protocol.eli +451 -0
  190. package/dist/literal-sources/stdlib/core/set.eli +312 -0
  191. package/dist/literal-sources/stdlib/core/text.eli +103 -0
  192. package/dist/literal-sources/stdlib/managed-literal-protocols.eli +494 -0
  193. package/dist/literal-sources/stdlib/managed-literals.eli +1469 -0
  194. package/dist/literal-sources/stdlib/managed-queue-state.eli +65 -0
  195. package/dist/literal-sources/stdlib/managed-sorted-state.eli +233 -0
  196. package/dist/literal-sources/stdlib/managed-transient-state.eli +348 -0
  197. package/dist/literal-sources/stdlib/managed-value-state.eli +153 -0
  198. package/dist/literal-sources/stdlib/managed-vector-view-state.eli +102 -0
  199. package/dist/literal-sources/stdlib/persistent-list.eli +145 -0
  200. package/dist/literal-sources/stdlib/persistent-map.eli +724 -0
  201. package/dist/literal-sources/stdlib/persistent-set.eli +236 -0
  202. package/dist/literal-sources/stdlib/persistent-vector.eli +359 -0
  203. package/dist/literal-sources/stdlib/value.eli +325 -0
  204. package/dist/package.json +10 -0
  205. package/dist/runtime/math.mjs +1116 -0
  206. package/dist/runtime/math.mjs.macro-origins.json +1 -0
  207. package/dist/runtime/math.mjs.map +1 -0
  208. package/dist/runtime/unicode-case-data.mjs +10124 -0
  209. package/dist/runtime/unicode-case-data.mjs.macro-origins.json +1 -0
  210. package/dist/runtime/unicode-case-data.mjs.map +1 -0
  211. package/dist/runtime/unicode-case.mjs +280 -0
  212. package/dist/runtime/unicode-case.mjs.macro-origins.json +1 -0
  213. package/dist/runtime/unicode-case.mjs.map +1 -0
  214. package/dist/runtime.eli +30379 -0
  215. package/dist/stage3-release.json +1 -0
  216. package/editor/README.md +1 -1
  217. package/editor/eliscript-mode.el +1 -1
  218. package/editor/eliscript-repl.el +1 -1
  219. package/package.json +106 -11
  220. package/platform/http.mjs +20 -0
  221. package/runtime/array-text.mjs +159 -0
  222. package/runtime/core/map-internals.mjs +27 -9
  223. package/runtime/core/object-impl.mjs +26 -17
  224. package/runtime/core/object-impl.mjs.map +1 -1
  225. package/runtime/core/protocol-impl.mjs +682 -255
  226. package/runtime/core/protocol-impl.mjs.map +1 -1
  227. package/runtime/core/protocol.mjs +4 -0
  228. package/runtime/core/record.mjs +23 -2
  229. package/runtime/core/regex.mjs +4 -0
  230. package/runtime/core/sorted.mjs +53 -0
  231. package/runtime/core/text-impl.mjs +167 -48
  232. package/runtime/core/text-impl.mjs.map +1 -1
  233. package/runtime/core/type.mjs +75 -3
  234. package/runtime/core/vector.mjs +6 -0
  235. package/runtime/math.eli +429 -0
  236. package/runtime/math.mjs +1116 -0
  237. package/runtime/math.mjs.map +1 -0
  238. package/runtime/number-radix.mjs +105 -0
  239. package/runtime/unicode-case-data.eli +29 -0
  240. package/runtime/unicode-case-data.mjs +10124 -0
  241. package/runtime/unicode-case-data.mjs.map +1 -0
  242. package/runtime/unicode-case.eli +100 -0
  243. package/runtime/unicode-case.mjs +280 -0
  244. package/runtime/unicode-case.mjs.map +1 -0
  245. package/runtime/wire/http-rpc.mjs +168 -0
  246. package/runtime/wire/markdown.mjs +196 -0
  247. package/runtime/wire/schema.mjs +109 -0
  248. package/stdlib/README.md +54 -0
  249. package/stdlib/core/protocol.eli +81 -17
  250. package/stdlib/core/seq.eli +1 -1
  251. package/stdlib/core/zipper.eli +172 -72
  252. package/stdlib/gepo.eli +12 -0
  253. package/stdlib/interop/js.eli +56 -15
  254. package/stdlib/managed-literal-protocols.eli +494 -0
  255. package/stdlib/managed-literals.eli +1469 -0
  256. package/stdlib/managed-protocol-error.eli +32 -0
  257. package/stdlib/managed-queue-state.eli +65 -0
  258. package/stdlib/managed-runtime-collection-internals.eli +60 -0
  259. package/stdlib/managed-runtime-collection.eli +639 -0
  260. package/stdlib/managed-runtime-data-text.eli +290 -0
  261. package/stdlib/managed-runtime-data.eli +22 -0
  262. package/stdlib/managed-runtime-identifier.eli +44 -0
  263. package/stdlib/managed-runtime-lazy-sequence.eli +131 -0
  264. package/stdlib/managed-runtime-list.eli +19 -0
  265. package/stdlib/managed-runtime-literals.eli +23 -0
  266. package/stdlib/managed-runtime-map.eli +9 -0
  267. package/stdlib/managed-runtime-metadata-internals.eli +6 -0
  268. package/stdlib/managed-runtime-metadata.eli +40 -0
  269. package/stdlib/managed-runtime-object.eli +8 -0
  270. package/stdlib/managed-runtime-order.eli +123 -0
  271. package/stdlib/managed-runtime-persistent-kind.eli +28 -0
  272. package/stdlib/managed-runtime-protocol.eli +28 -0
  273. package/stdlib/managed-runtime-queue.eli +9 -0
  274. package/stdlib/managed-runtime-record.eli +191 -0
  275. package/stdlib/managed-runtime-regex.eli +158 -0
  276. package/stdlib/managed-runtime-sequence.eli +305 -0
  277. package/stdlib/managed-runtime-set-algebra.eli +28 -0
  278. package/stdlib/managed-runtime-set.eli +9 -0
  279. package/stdlib/managed-runtime-sorted.eli +408 -0
  280. package/stdlib/managed-runtime-text.eli +14 -0
  281. package/stdlib/managed-runtime-transducer.eli +268 -0
  282. package/stdlib/managed-runtime-transient.eli +17 -0
  283. package/stdlib/managed-runtime-truth.eli +4 -0
  284. package/stdlib/managed-runtime-type.eli +232 -0
  285. package/stdlib/managed-runtime-value-internals.eli +13 -0
  286. package/stdlib/managed-runtime-value.eli +19 -0
  287. package/stdlib/managed-runtime-vector.eli +25 -0
  288. package/stdlib/managed-sorted-state.eli +233 -0
  289. package/stdlib/managed-testing-value.eli +6 -0
  290. package/stdlib/managed-transient-state.eli +348 -0
  291. package/stdlib/managed-value-state.eli +153 -0
  292. package/stdlib/managed-vector-view-state.eli +102 -0
  293. package/stdlib/managed-wire-http-rpc.eli +362 -0
  294. package/stdlib/managed-wire-markdown.eli +275 -0
  295. package/stdlib/managed-wire-schema.eli +193 -0
  296. package/stdlib/mdp.eli +7 -0
  297. package/stdlib/mds.eli +4 -0
  298. package/stdlib/persistent-vector.eli +23 -6
  299. package/tools/acceptance/check-legacy.mjs +687 -0
  300. package/tools/acceptance/check.eli +431 -0
  301. package/tools/acceptance/compile-evidence.el +49 -0
  302. package/tools/acceptance/finalize-legacy.mjs +498 -0
  303. package/tools/acceptance/finalize.eli +270 -0
  304. package/tools/backends/benchmark.mjs +175 -0
  305. package/tools/backends/build.mjs +135 -0
  306. package/tools/backends/compile.mjs +94 -0
  307. package/tools/backends/compiler-bootstrap.mjs +1001 -0
  308. package/tools/backends/compiler-browser.mjs +361 -0
  309. package/tools/backends/compiler-build.mjs +1628 -0
  310. package/tools/backends/compiler-cli-legacy.mjs +334 -0
  311. package/tools/backends/compiler-cli.mjs +29 -0
  312. package/tools/backends/compiler-corpus-bit.mjs +234 -0
  313. package/tools/backends/compiler-corpus-cli-adapters-legacy.mjs +362 -0
  314. package/tools/backends/compiler-corpus-cli-adapters.mjs +247 -0
  315. package/tools/backends/compiler-corpus-debugging.mjs +221 -0
  316. package/tools/backends/compiler-corpus-emitter.mjs +324 -0
  317. package/tools/backends/compiler-corpus-evaluation-adapters.mjs +65 -0
  318. package/tools/backends/compiler-corpus-execution-legacy.mjs +769 -0
  319. package/tools/backends/compiler-corpus-execution.mjs +3324 -0
  320. package/tools/backends/compiler-corpus-fuzz.mjs +229 -0
  321. package/tools/backends/compiler-corpus-generations.mjs +208 -0
  322. package/tools/backends/compiler-corpus-host-context-legacy.mjs +114 -0
  323. package/tools/backends/compiler-corpus-host-context.mjs +550 -0
  324. package/tools/backends/compiler-corpus-identity-host.mjs +553 -0
  325. package/tools/backends/compiler-corpus-identity-value-adapters-legacy.mjs +298 -0
  326. package/tools/backends/compiler-corpus-identity-value-adapters.mjs +69 -0
  327. package/tools/backends/compiler-corpus-isolated-exports.mjs +21 -0
  328. package/tools/backends/compiler-corpus-legacy.mjs +1155 -0
  329. package/tools/backends/compiler-corpus-literal-provider.mjs +282 -0
  330. package/tools/backends/compiler-corpus-managed-adapters-legacy.mjs +334 -0
  331. package/tools/backends/compiler-corpus-managed-adapters.mjs +937 -0
  332. package/tools/backends/compiler-corpus-managed-cases.mjs +179 -0
  333. package/tools/backends/compiler-corpus-managed-fixtures-legacy.mjs +879 -0
  334. package/tools/backends/compiler-corpus-managed-fixtures.mjs +1287 -0
  335. package/tools/backends/compiler-corpus-matchers.mjs +173 -0
  336. package/tools/backends/compiler-corpus-original-program.mjs +612 -0
  337. package/tools/backends/compiler-corpus-process.mjs +765 -0
  338. package/tools/backends/compiler-corpus-program-driver.mjs +306 -0
  339. package/tools/backends/compiler-corpus-project-adapters-legacy.mjs +497 -0
  340. package/tools/backends/compiler-corpus-project-adapters.mjs +340 -0
  341. package/tools/backends/compiler-corpus-project-entry-host.mjs +511 -0
  342. package/tools/backends/compiler-corpus-project-transport.mjs +151 -0
  343. package/tools/backends/compiler-corpus-raw-fixture-observer.mjs +1438 -0
  344. package/tools/backends/compiler-corpus-raw-language-fixtures.mjs +1456 -0
  345. package/tools/backends/compiler-corpus-raw-math-fixture.mjs +346 -0
  346. package/tools/backends/compiler-corpus-raw-special-fixtures.mjs +523 -0
  347. package/tools/backends/compiler-corpus-reference-legacy.mjs +263 -0
  348. package/tools/backends/compiler-corpus-reference.mjs +241 -0
  349. package/tools/backends/compiler-corpus-runtime-adapters-legacy.mjs +843 -0
  350. package/tools/backends/compiler-corpus-runtime-adapters.mjs +663 -0
  351. package/tools/backends/compiler-corpus-source-archive.mjs +206 -0
  352. package/tools/backends/compiler-corpus-tools-artifact-adapters.mjs +410 -0
  353. package/tools/backends/compiler-corpus-tools-cli.mjs +363 -0
  354. package/tools/backends/compiler-corpus-tools-reference.mjs +264 -0
  355. package/tools/backends/compiler-corpus.mjs +2054 -0
  356. package/tools/backends/compiler-debug.mjs +142 -0
  357. package/tools/backends/compiler-matrix.mjs +1955 -0
  358. package/tools/backends/compiler-metadata.mjs +203 -0
  359. package/tools/backends/compiler-package-browser.mjs +120 -0
  360. package/tools/backends/compiler-package-legacy.mjs +654 -0
  361. package/tools/backends/compiler-package.mjs +464 -0
  362. package/tools/backends/compiler-project.mjs +126 -0
  363. package/tools/backends/compiler-session.mjs +843 -0
  364. package/tools/backends/compiler-sha256.mjs +152 -0
  365. package/tools/backends/compiler-unicode-profile-host.mjs +196 -0
  366. package/tools/backends/compiler-worker.mjs +573 -0
  367. package/tools/backends/dist/bootstrap-js-stages.mjs +919 -0
  368. package/tools/backends/dist/bootstrap-js-stages.mjs.map +1 -0
  369. package/tools/backends/dist/managed-ir-inventory.mjs +488 -0
  370. package/tools/backends/dist/managed-ir-inventory.mjs.map +1 -0
  371. package/tools/backends/dist/record-grid.mjs +1256 -0
  372. package/tools/backends/dist/record-grid.mjs.map +1 -0
  373. package/tools/backends/dist/release-cli.mjs +462 -0
  374. package/tools/backends/dist/release-cli.mjs.map +1 -0
  375. package/tools/backends/dist/run-artifact.mjs +517 -0
  376. package/tools/backends/dist/run-artifact.mjs.map +1 -0
  377. package/tools/backends/eliscript/compiler-corpus-bit.eli +77 -0
  378. package/tools/backends/eliscript/compiler-corpus-debugging.eli +70 -0
  379. package/tools/backends/eliscript/compiler-corpus-project-entry-host.eli +256 -0
  380. package/tools/backends/managed-foreign-binding.mjs +497 -0
  381. package/tools/backends/managed-host-legacy.mjs +1181 -0
  382. package/tools/backends/managed-host-lifecycle.mjs +310 -0
  383. package/tools/backends/managed-host-object-provider.mjs +155 -0
  384. package/tools/backends/managed-host-object-realm.mjs +797 -0
  385. package/tools/backends/managed-host-proxy.mjs +71 -0
  386. package/tools/backends/managed-host-runtime.mjs +5868 -0
  387. package/tools/backends/managed-host.mjs +716 -0
  388. package/tools/backends/managed-module-graph-legacy.mjs +308 -0
  389. package/tools/backends/managed-module-graph.mjs +694 -0
  390. package/tools/backends/managed-runtime-host-legacy.mjs +195 -0
  391. package/tools/backends/managed-runtime.mjs +939 -0
  392. package/tools/backends/managed-source-view-legacy.mjs +332 -0
  393. package/tools/backends/managed-source-view.mjs +959 -0
  394. package/tools/backends/memory-runtime.mjs +100 -0
  395. package/tools/backends/native-benchmark.mjs +88 -0
  396. package/tools/backends/native-managed-runtime.mjs +677 -0
  397. package/tools/backends/native-memory.mjs +768 -0
  398. package/tools/backends/native-node-memory.mjs +142 -0
  399. package/tools/backends/native-node-runner.mjs +99 -0
  400. package/tools/backends/native-node-watchdog.mjs +19 -0
  401. package/tools/backends/native-node-worker.mjs +75 -0
  402. package/tools/backends/stage3-targets.mjs +493 -0
  403. package/tools/bootstrap-command.el +13 -0
  404. package/tools/bootstrap-runtime.el +101 -0
  405. package/tools/bootstrap-seed.el +55 -0
  406. package/tools/project/check-cli.eli +31 -0
  407. package/tools/project/project-cli.eli +42 -0
  408. package/tools/project/project.eli +122 -0
  409. package/tools/runtime/unicode-case-profiles.mjs +13 -0
  410. package/tools/runtime/unicode-case-runtime.el +57 -0
  411. package/tools/testing/source-debugging-corpus-host.eli +16 -0
  412. package/tools/testing/source-debugging.eli +139 -0
  413. package/tools/testing/stdlib-bit-corpus-host.eli +21 -0
  414. package/tools/testing/stdlib-bit-corpus-host.mjs +118 -0
  415. package/tools/testing/stdlib-bit.eli +104 -0
  416. package/tools/testing/stdlib-bit.mjs +255 -0
  417. package/bin/eliscript-bootstrap +0 -15
@@ -0,0 +1,1256 @@
1
+ // Generated by Eliscript. Do not edit.
2
+ import "eliscript/runtime/unicode-case.mjs";
3
+ import { c as __eliscript_at, d as __eliscript_at_direct } from "data:text/javascript;base64,dmFyIG09UmVmbGVjdC5hcHBseSx0dD1OdW1iZXIucHJvdG90eXBlLnZhbHVlT2Ysaj1OdW1iZXIucHJvdG90eXBlLnRvU3RyaW5nLFU9TnVtYmVyLG50PU9iamVjdC5jcmVhdGUsaD1CaWdJbnQsZXQ9RGF0YVZpZXcsb3Q9QXJyYXlCdWZmZXIsaXQ9RGF0YVZpZXcucHJvdG90eXBlLnNldEZsb2F0NjQsSj1EYXRhVmlldy5wcm90b3R5cGUuZ2V0VWludDMyLHJ0PVJhbmdlRXJyb3I7ZnVuY3Rpb24gY3QodCxuKXtsZXQgZT1oKG4pLG89aCh0KSxpPSIiO2lmKG88MG4pbz0tbztkb3tsZXQgZj1vJWU7aT0iMDEyMzQ1Njc4OWFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6IltVKGYpXStpLG8vPWV9d2hpbGUobyE9PTBuKTtyZXR1cm4gdDwwPyItIitpOml9ZnVuY3Rpb24gc3QodCxuKXtsZXQgZT1uZXcgZXQobmV3IG90KDgpKTttKGl0LGUsWzAsdCwhMV0pO2xldCBvPW0oSixlLFswLCExXSksaT1tKEosZSxbNCwhMV0pLGY9bz4+PjIwJjIwNDcsYj1vJjEwNDg1NzUscD1vPj4+MzEscj1oKGIpPDwzMm58aChpKTtpZihmIT09MClyKz0xbjw8NTJuO3I8PD0ybjtsZXQgbD00bix1PWY+MSYmYj09PTAmJmk9PT0wPzFuOjJuLGs9Mm47aWYoZj49MTA3NSl7bGV0IGM9aChmLTEwNzUpO3I8PD1jLHU8PD1jLGs8PD1jfWVsc2UgbDw8PWgoZj09PTA/MTA3NDoxMDc1LWYpO2xldCBkPWgobiksZz1udChudWxsKSxhPTAsUz0wLEQ9MDtpZihyPGwpd2hpbGUocjxsKXtpZihyKjJuPmwmJnIraz5sKWJyZWFrO3IqPWQsdSo9ZCxrKj1kLFMtLX1lbHNlIHdoaWxlKHI+PWwqZClsKj1kLFMrKztmb3IoOzspe2xldCBjPVUoci9sKTtyJT1sO2xldCBJPXI8dSx4PXIraz5sO2dbYSsrXT1jLEQ9RCoobiYxKStjJjE7bGV0IHE9cioybixQPXE+bHx8cT09PWwmJkQ9PT0xO2lmKFAmJnh8fCFQJiZJKXtpZihQKXtsZXQgUj1hLEI9ITA7d2hpbGUoUj4wJiZCKXtSLS07bGV0IEg9Z1tSXSsxO2lmKEg9PT1uKWdbUl09MDtlbHNlIGdbUl09SCxCPSExfWlmKEIpZ1swXT0xLFMrK31icmVha31pZihhPj02NCl0aHJvdyBuZXcgcnQoIm51bWJlciByYWRpeCBmb3JtYXR0aW5nIGRpZCBub3QgY29udmVyZ2UiKTtyKj1kLHUqPWQsayo9ZH13aGlsZShhPjEmJmdbYS0xXT09PTApYS0tO2xldCB3PSIiO2lmKFM8MCl7dz0iMC4iO2ZvcihsZXQgYz0wO2M8LTEtUztjKyspdys9IjAiO2ZvcihsZXQgYz0wO2M8YTtjKyspdys9IjAxMjM0NTY3ODlhYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5eiJbZ1tjXV19ZWxzZXtsZXQgYz1TKzEsST1jPmE/YzphO2ZvcihsZXQgeD0wO3g8STt4Kyspe2lmKHg9PT1jJiZjPGEpdys9Ii4iO3crPXg8YT8iMDEyMzQ1Njc4OWFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6IltnW3hdXToiMCJ9fXJldHVybiBwPyItIit3Ond9ZnVuY3Rpb24gRyh0LG4pe2xldCBlO3RyeXtlPW0odHQsdCxbXSl9Y2F0Y2h7cmV0dXJuIG0oaix0LFtuXSl9bGV0IG89MTA7aWYobiE9PXZvaWQgMCl7bGV0IGk9K247aWYobz1pIT09aT8wOmktaSUxLG88Mnx8bz4zNnx8byE9PW8pcmV0dXJuIG0oaixlLFtvXSl9aWYobz09PTEwfHxlPT09MHx8ZSE9PWV8fGU9PT0xLzB8fGU9PT0tMS8wKXJldHVybiBtKGosZSxbMTBdKTtyZXR1cm4gZSUxPT09MD9jdChlLG8pOnN0KGUsbyl9dmFyIHM9UmVmbGVjdC5hcHBseSxNPUZ1bmN0aW9uLnByb3RvdHlwZS5jYWxsLE49RnVuY3Rpb24ucHJvdG90eXBlLmFwcGx5LEU9RnVuY3Rpb24ucHJvdG90eXBlLmJpbmQsVD1PYmplY3QuZGVmaW5lUHJvcGVydHksbHQ9T2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcixmdD1PYmplY3QuZ2V0UHJvdG90eXBlT2YsdXQ9T2JqZWN0LnNldFByb3RvdHlwZU9mLGF0PVJlZmxlY3Qub3duS2V5cyxwdD1TeW1ib2wuaGFzSW5zdGFuY2UsVj1BcnJheS5pc0FycmF5LEs9QXJyYXkucHJvdG90eXBlLmpvaW4sej1BcnJheS5wcm90b3R5cGUudG9TdHJpbmcseXQ9T2JqZWN0LnByb3RvdHlwZS50b1N0cmluZyxidD1TdHJpbmcsQz1UeXBlRXJyb3IsZHQ9U3ltYm9sLnRvUHJpbWl0aXZlLGd0PVdlYWtTZXQucHJvdG90eXBlLmhhcyx3dD1XZWFrU2V0LnByb3RvdHlwZS5hZGQseHQ9V2Vha1NldC5wcm90b3R5cGUuZGVsZXRlLEY9bmV3IFdlYWtTZXQsTz1udWxsLFc9KHQpPT50IT09bnVsbCYmKHR5cGVvZiB0PT09Im9iamVjdCJ8fHR5cGVvZiB0PT09ImZ1bmN0aW9uInx8dHlwZW9mIHQ+InUiJiZ0IT09dm9pZCAwKSxBPSh0KT0+dHlwZW9mIHQ9PT0iZnVuY3Rpb24ifHx0eXBlb2YgdD4idSImJnQhPT12b2lkIDA7ZnVuY3Rpb24gaHQoKXtsZXQgbj1uZXcgQygiY3ljbGljIGFycmF5IHRleHQgY29udmVyc2lvbiIpO3Rocm93IG4uZWxpc2NyaXB0RGlhZ25vc3RpYz17Zm9ybWF0OiJlbGlzY3JpcHQtZGlhZ25vc3RpYyIsdmVyc2lvbjoxLGNvZGU6IkVMSS1SVDAwMDkiLHNldmVyaXR5OiJlcnJvciIscGhhc2U6InJ1bnRpbWUiLG1lc3NhZ2U6ImN5Y2xpYyBhcnJheSB0ZXh0IGNvbnZlcnNpb24ifSxufWZ1bmN0aW9uIG10KHQpe2lmKCFXKHQpKXJldHVybiB0O2xldCBuPXRbZHRdO2lmKG4hPT12b2lkIDAmJm4hPT1udWxsKXtsZXQgZT1zKG4sdCxbInN0cmluZyJdKTtpZighVyhlKSlyZXR1cm4gZTt0aHJvdyBuZXcgQygiQ2Fubm90IGNvbnZlcnQgb2JqZWN0IHRvIHByaW1pdGl2ZSB2YWx1ZSIpfWZvcihsZXQgZT0wO2U8MjtlKyspe2xldCBvPXRbZT09PTA/InRvU3RyaW5nIjoidmFsdWVPZiJdO2lmKEEobykpe2xldCBpPW89PT16JiZWKHQpP3YodCk6cyhvLHQsW10pO2lmKCFXKGkpKXJldHVybiBpfX10aHJvdyBuZXcgQygiQ2Fubm90IGNvbnZlcnQgb2JqZWN0IHRvIHByaW1pdGl2ZSB2YWx1ZSIpfWZ1bmN0aW9uIFEodCl7bGV0IG49bXQodCk7aWYodHlwZW9mIG49PT0ic3ltYm9sIil0aHJvdyBuZXcgQygiQ2Fubm90IGNvbnZlcnQgYSBTeW1ib2wgdmFsdWUgdG8gYSBzdHJpbmciKTtyZXR1cm4gYnQobil9ZnVuY3Rpb24gXyh0LG4pe2xldCBlPSt0Lmxlbmd0aCxvPWUhPT1lfHxlPD0wPzA6ZT49OTAwNzE5OTI1NDc0MDk5MT85MDA3MTk5MjU0NzQwOTkxOmUtZSUxLGk9bj09PXZvaWQgMD8iLCI6UShuKSxmPU89PT1udWxsO2lmKGYpTz10O2Vsc2V7aWYodD09PU98fHMoZ3QsRixbdF0pKWh0KCk7cyh3dCxGLFt0XSl9dHJ5e2xldCBiPSIiO2ZvcihsZXQgcD0wO3A8bztwKyspe2lmKHApYis9aTtsZXQgcj10W3BdO2lmKHIhPT1udWxsJiZyIT09dm9pZCAwKWIrPVEocil9cmV0dXJuIGJ9ZmluYWxseXtpZihmKU89bnVsbDtlbHNlIHMoeHQsRixbdF0pfX1mdW5jdGlvbiB2KHQpe2xldCBuPXQuam9pbjtyZXR1cm4gQShuKT9uPT09Sz9fKHQsdm9pZCAwKTpzKG4sdCxbXSk6cyh5dCx0LFtdKX1mdW5jdGlvbiB5KHQsbil7cmV0dXJuIG48dC5sZW5ndGg/dFtuXTp2b2lkIDB9ZnVuY3Rpb24gWCh0LG4pe2xldCBlPVtdO2ZvcihsZXQgbz1uO288dC5sZW5ndGg7bysrKVQoZSxlLmxlbmd0aCx7dmFsdWU6dFtvXSx3cml0YWJsZTohMCxlbnVtZXJhYmxlOiEwLGNvbmZpZ3VyYWJsZTohMH0pO3JldHVybiBlfWZ1bmN0aW9uIFN0KHQsbil7bGV0IGU9W107Zm9yKGxldCBvPTA7bzx0Lmxlbmd0aCtuLmxlbmd0aDtvKyspVChlLG8se3ZhbHVlOm88dC5sZW5ndGg/dFtvXTpuW28tdC5sZW5ndGhdLHdyaXRhYmxlOiEwLGVudW1lcmFibGU6ITAsY29uZmlndXJhYmxlOiEwfSk7cmV0dXJuIGV9ZnVuY3Rpb24gWSguLi50KXtyZXR1cm4gdH1mdW5jdGlvbiBaKHQsbil7cmV0dXJuIG4/cyhOLFksW3ZvaWQgMCx0XSk6cyhZLHZvaWQgMCx0KX1mdW5jdGlvbiBMKHQsbixlKXtmb3IoOzspe2lmKHQ9PT1qKXJldHVybiBHKG4seShlLDApKTtpZih0PT09SyYmVihuKSlyZXR1cm4gXyhuLHkoZSwwKSk7aWYodD09PXomJlYobikpcmV0dXJuIHYobik7aWYodD09PU0pe2lmKCFBKG4pKXJldHVybiBzKHQsbixlKTtsZXQgbz1uLGk9eShlLDApO2U9WChlLDEpLHQ9byxuPWk7Y29udGludWV9aWYodD09PU4pe2lmKCFBKG4pKXJldHVybiBzKHQsbixlKTtsZXQgbz1uLGk9eShlLDApO2U9Wih5KGUsMSksITApLHQ9byxuPWk7Y29udGludWV9aWYodD09PXMpe2xldCBvPXkoZSwwKSxpPXkoZSwxKTtpZighQShvKSlyZXR1cm4gcyh0LG4sZSk7ZT1aKHkoZSwyKSwhMSksdD1vLG49aTtjb250aW51ZX1pZih0PT09RSl7bGV0IG89cyh0LG4sZSk7aWYobiE9PWomJm4hPT1LJiZuIT09eiYmbiE9PU0mJm4hPT1OJiZuIT09cyYmbiE9PUUpcmV0dXJuIG87bGV0IGk9bixmPXkoZSwwKSxiPVgoZSwxKSxwPSguLi51KT0+TChpLGYsU3QoYix1KSk7VChwLHB0LHt2YWx1ZToodSk9PnUgaW5zdGFuY2VvZiBpLGNvbmZpZ3VyYWJsZTohMH0pO2xldCByPXMoRSxwLFt2b2lkIDBdKTt1dChyLGZ0KG8pKTtsZXQgbD1hdChvKTtmb3IobGV0IHU9MDt1PGwubGVuZ3RoO3UrKylUKHIsbFt1XSxsdChvLGxbdV0pKTtyZXR1cm4gcn1yZXR1cm4gcyh0LG4sZSl9fWZ1bmN0aW9uIFJ0KHQsbil7bGV0IGU9dFtuXTtyZXR1cm4oLi4ubyk9PkwoZSx0LG8pfWZ1bmN0aW9uIEF0KHQsbiwuLi5lKXtsZXQgbz10W25dO3JldHVybiBMKG8sdCxlKX1leHBvcnR7UnQgYXMgYyxBdCBhcyBkfTs=";
4
+ const __eliscript_truthy = (value) => value !== false && value != null;
5
+ const __eliscript_number_intrinsic = globalThis.Number;
6
+ const __eliscript_bigint_intrinsic = globalThis.BigInt;
7
+ const __eliscript_numeric_apply = globalThis.Reflect.apply;
8
+ const __eliscript_numeric_symbol = globalThis.Symbol.toPrimitive;
9
+ const __eliscript_numeric_error = globalThis.TypeError;
10
+ const __eliscript_numeric_trim = globalThis.String.prototype.trim;
11
+ const __eliscript_numeric_slice = globalThis.String.prototype.slice;
12
+ const __eliscript_numeric_exec = globalThis.RegExp.prototype.exec;
13
+ const __eliscript_numeric_radix = /^(?:0[xX][0-9a-fA-F]+|0[oO][0-7]+|0[bB][01]+)$/;
14
+ const __eliscript_numeric_object = (value) => value !== null && (typeof value === "object" || typeof value === "function" || (typeof value === "undefined" && value !== void 0));
15
+ const __eliscript_numeric_primitive = (value) => {
16
+ if (!__eliscript_numeric_object(value)) return value;
17
+ const exotic = value[__eliscript_numeric_symbol];
18
+ if (exotic !== void 0 && exotic !== null) {
19
+ const result = __eliscript_numeric_apply(exotic, value, ["number"]);
20
+ if (!__eliscript_numeric_object(result)) return result;
21
+ throw new __eliscript_numeric_error("Cannot convert object to primitive value");
22
+ }
23
+ for (let index = 0; index < 2; index++) {
24
+ const method = value[index === 0 ? "valueOf" : "toString"];
25
+ if (typeof method === "function" || (typeof method === "undefined" && method !== void 0)) {
26
+ const result = __eliscript_numeric_apply(method, value, []);
27
+ if (!__eliscript_numeric_object(result)) return result;
28
+ }
29
+ }
30
+ throw new __eliscript_numeric_error("Cannot convert object to primitive value");
31
+ };
32
+ const __eliscript_to_number = (value) => {
33
+ const primitive = __eliscript_numeric_primitive(value);
34
+ if (typeof primitive === "string") {
35
+ const text = __eliscript_numeric_apply(__eliscript_numeric_trim, primitive, []);
36
+ if (__eliscript_numeric_apply(__eliscript_numeric_exec, __eliscript_numeric_radix, [text]) !== null) {
37
+ let first = 2;
38
+ while (first < text.length && text[first] === "0") first++;
39
+ if (first === text.length) return 0;
40
+ const prefix = text[1];
41
+ const limit = prefix === "x" || prefix === "X" ? 256 : prefix === "b" || prefix === "B" ? 1024 : 342;
42
+ if (text.length - first > limit) return 1 / 0;
43
+ const token = __eliscript_numeric_apply(__eliscript_numeric_slice, text, [0, 2]) + __eliscript_numeric_apply(__eliscript_numeric_slice, text, [first]);
44
+ return __eliscript_number_intrinsic(__eliscript_bigint_intrinsic(token));
45
+ }
46
+ }
47
+ return __eliscript_number_intrinsic(primitive);
48
+ };
49
+ const __eliscript_numeric = (value) => {
50
+ if (typeof value === "number" || typeof value === "bigint") return value;
51
+ const primitive = __eliscript_numeric_primitive(value);
52
+ if (typeof primitive === "number" || typeof primitive === "bigint") return primitive;
53
+ return typeof primitive === "string" ? __eliscript_to_number(primitive) : +primitive;
54
+ };
55
+ const __eliscript_implicit_number = (value) => {
56
+ if (typeof value === "number") return value;
57
+ const primitive = __eliscript_numeric_primitive(value);
58
+ if (typeof primitive === "bigint") throw new __eliscript_numeric_error("Cannot convert a BigInt value to a number");
59
+ return typeof primitive === "string" ? __eliscript_to_number(primitive) : +primitive;
60
+ };
61
+ const __eliscript_numeric_decrement = (value) => __eliscript_implicit_number(value) - 1;
62
+ const __eliscript_numeric_sub = (a, b) => { if (typeof a === "number" && typeof b === "number") return a - b; return __eliscript_numeric(a) - __eliscript_numeric(b); };
63
+ const __eliscript_numeric_mul = (a, b) => { if (typeof a === "number" && typeof b === "number") return a * b; return __eliscript_numeric(a) * __eliscript_numeric(b); };
64
+ const __eliscript_numeric_div = (a, b) => { if (typeof a === "number" && typeof b === "number") return a / b; return __eliscript_numeric(a) / __eliscript_numeric(b); };
65
+ const __eliscript_numeric_rem = (a, b) => { if (typeof a === "number" && typeof b === "number") return a % b; return __eliscript_numeric(a) % __eliscript_numeric(b); };
66
+ const __eliscript_numeric_and = (a, b) => { if (typeof a === "number" && typeof b === "number") return a & b; return __eliscript_numeric(a) & __eliscript_numeric(b); };
67
+ const __eliscript_numeric_or = (a, b) => { if (typeof a === "number" && typeof b === "number") return a | b; return __eliscript_numeric(a) | __eliscript_numeric(b); };
68
+ const __eliscript_numeric_xor = (a, b) => { if (typeof a === "number" && typeof b === "number") return a ^ b; return __eliscript_numeric(a) ^ __eliscript_numeric(b); };
69
+ const __eliscript_numeric_shl = (a, b) => { if (typeof a === "number" && typeof b === "number") return a << b; return __eliscript_numeric(a) << __eliscript_numeric(b); };
70
+ const __eliscript_numeric_shr = (a, b) => { if (typeof a === "number" && typeof b === "number") return a >> b; return __eliscript_numeric(a) >> __eliscript_numeric(b); };
71
+ const __eliscript_numeric_ushr = (a, b) => { if (typeof a === "number" && typeof b === "number") return a >>> b; return __eliscript_numeric(a) >>> __eliscript_numeric(b); };
72
+ const __eliscript_numeric_neg = (a) => typeof a === "number" ? -a : -__eliscript_numeric(a);
73
+ const __eliscript_numeric_int32 = (a) => typeof a === "number" ? a | 0 : __eliscript_numeric(a) | 0;
74
+ const __eliscript_numeric_uint32 = (a) => typeof a === "number" ? a >>> 0 : __eliscript_numeric(a) >>> 0;
75
+ const __eliscript_numeric_not = (a) => typeof a === "number" ? ~a : ~__eliscript_numeric(a);
76
+ const __eliscript_numeric_relation = (operator, left, right) => {
77
+ if (typeof left === "number" && typeof right === "number") {
78
+ if (operator === "<") return left < right;
79
+ if (operator === "<=") return left <= right;
80
+ if (operator === ">") return left > right;
81
+ return left >= right;
82
+ }
83
+ let a = __eliscript_numeric_primitive(left);
84
+ let b = __eliscript_numeric_primitive(right);
85
+ const x = typeof a, y = typeof b;
86
+ if (!((x === "string" && y === "string") || (x === "bigint" && y === "string") || (x === "string" && y === "bigint"))) {
87
+ a = __eliscript_numeric(a);
88
+ b = __eliscript_numeric(b);
89
+ }
90
+ if (operator === "<") return a < b;
91
+ if (operator === "<=") return a <= b;
92
+ if (operator === ">") return a > b;
93
+ return a >= b;
94
+ };
95
+
96
+ import {mkdir, mkdtemp, lstat, realpath} from "node:fs/promises";
97
+ import {resolve, dirname, basename, relative, isAbsolute, sep} from "node:path";
98
+ import {root} from "../build.mjs";
99
+ import {loadCompilerSources, compilerMetadataDigest, buildIndependentCompiler} from "../compiler-build.mjs";
100
+ import {readCompilerMetadata} from "../compiler-metadata.mjs";
101
+ import {compilerHosts, normalizeCompilerHost, compilerSourceIdentity, assertCompilerArtifactSources, archiveCompilerSources, archiveCompilerArtifact, openCompilerArtifact, saveCompilerMetadata, compilerFailure, bootstrapCompilerChain} from "../compiler-bootstrap.mjs";
102
+ import {buildCompilerMatrix, runCompilerMatrixCell} from "../compiler-matrix.mjs";
103
+ function grid_error(message) {
104
+ return ((__eliscript_value_1) => { throw __eliscript_value_1; })(new (globalThis.Error)(message));
105
+ }
106
+ function grid_required_string(value, message) {
107
+ if ((!((((__eliscript_value) => { if (__eliscript_value === null) return "null"; const __eliscript_host_type = typeof __eliscript_value; if (__eliscript_host_type !== "object" && __eliscript_host_type !== "function") return __eliscript_host_type; try { const __eliscript_type = Object.getOwnPropertyDescriptor(__eliscript_value, Symbol.for("eliscript.value.type")); if (__eliscript_type && Object.prototype.hasOwnProperty.call(__eliscript_type, "value") && (__eliscript_type.value === "keyword" || __eliscript_type.value === "symbol")) return __eliscript_type.value; const __eliscript_kind = Object.getOwnPropertyDescriptor(__eliscript_value, "kind"); if (__eliscript_kind && Object.prototype.hasOwnProperty.call(__eliscript_kind, "value")) { if (__eliscript_kind.value === "eliscript/keyword") return "keyword"; if (__eliscript_kind.value === "eliscript/symbol") return "symbol"; } return __eliscript_host_type; } catch { return __eliscript_host_type; } })(value) === "string") && __eliscript_numeric_relation(">", ((value) ?? []).length, 0)))) {
108
+ ((__eliscript_value_2) => { throw __eliscript_value_2; })(new (globalThis.TypeError)(message));
109
+ }
110
+ return value;
111
+ }
112
+ function grid_source_sha(record) {
113
+ return ((record)["sourceIdentity"])["sha256"];
114
+ }
115
+ function grid_capture_plan(options) {
116
+ if ((!__eliscript_truthy(((__eliscript_value_3) => (__eliscript_truthy(__eliscript_value_3) ? ((((__eliscript_value) => { if (__eliscript_value === null) return "null"; const __eliscript_host_type = typeof __eliscript_value; if (__eliscript_host_type !== "object" && __eliscript_host_type !== "function") return __eliscript_host_type; try { const __eliscript_type = Object.getOwnPropertyDescriptor(__eliscript_value, Symbol.for("eliscript.value.type")); if (__eliscript_type && Object.prototype.hasOwnProperty.call(__eliscript_type, "value") && (__eliscript_type.value === "keyword" || __eliscript_type.value === "symbol")) return __eliscript_type.value; const __eliscript_kind = Object.getOwnPropertyDescriptor(__eliscript_value, "kind"); if (__eliscript_kind && Object.prototype.hasOwnProperty.call(__eliscript_kind, "value")) { if (__eliscript_kind.value === "eliscript/keyword") return "keyword"; if (__eliscript_kind.value === "eliscript/symbol") return "symbol"; } return __eliscript_host_type; } catch { return __eliscript_host_type; } })(options) === "object") && (!__eliscript_truthy(Array.isArray(options)))) : __eliscript_value_3))(options)))) {
117
+ ((__eliscript_value_4) => { throw __eliscript_value_4; })(new (globalThis.TypeError)("recorded compiler grid options are required"));
118
+ }
119
+ {
120
+ let output = grid_required_string((options)["outputRoot"], "compiler grid outputRoot is required");
121
+ let producers = (options)["producers"];
122
+ let cells = (options)["cells"];
123
+ let generations = (options)["generations"];
124
+ let generation_directory = grid_required_string(((generations == null) ? undefined : (generations)["directory"]), "recorded compiler grid requires existing self-host generation evidence");
125
+ let producer_records = [];
126
+ let cell_records = [];
127
+ let hosts = new (globalThis.Set)();
128
+ let pairs = new (globalThis.Set)();
129
+ let index = 0;
130
+ if ((!__eliscript_truthy(((__eliscript_value_5) => (__eliscript_truthy(__eliscript_value_5) ? (((producers) ?? []).length === 3) : __eliscript_value_5))(Array.isArray(producers))))) {
131
+ ((__eliscript_value_6) => { throw __eliscript_value_6; })(new (globalThis.TypeError)("recorded compiler grid requires three producer artifacts"));
132
+ }
133
+ if ((!__eliscript_truthy(((__eliscript_value_7) => (__eliscript_truthy(__eliscript_value_7) ? (((cells) ?? []).length === 9) : __eliscript_value_7))(Array.isArray(cells))))) {
134
+ ((__eliscript_value_8) => { throw __eliscript_value_8; })(new (globalThis.TypeError)("recorded compiler grid requires nine existing cells"));
135
+ }
136
+ while (__eliscript_numeric_relation("<", index, ((producers) ?? []).length)) {
137
+ {
138
+ let record = (producers)[index];
139
+ let host = normalizeCompilerHost((record)["host"]);
140
+ let path = grid_required_string((record)["metadataPath"], "producer metadataPath is required");
141
+ if (__eliscript_truthy((hosts)["has"](host))) {
142
+ grid_error("compiler grid repeats a producer host");
143
+ }
144
+ (hosts)["add"](host);
145
+ (producer_records)["push"](({"host": host, "metadataPath": resolve(path)}));
146
+ }
147
+ ((index = (index + 1)));
148
+ }
149
+ ((index = 0));
150
+ while (__eliscript_numeric_relation("<", index, ((cells) ?? []).length)) {
151
+ {
152
+ let record = (cells)[index];
153
+ let host = normalizeCompilerHost((record)["host"]);
154
+ let target = normalizeCompilerHost((record)["target"]);
155
+ let pair = (host + "-to-" + target);
156
+ let path = grid_required_string((record)["metadataPath"], "cell metadataPath is required");
157
+ if (__eliscript_truthy((pairs)["has"](pair))) {
158
+ grid_error("compiler grid repeats a producer/target cell");
159
+ }
160
+ (pairs)["add"](pair);
161
+ (cell_records)["push"](({"host": host, "target": target, "metadataPath": resolve(path)}));
162
+ }
163
+ ((index = (index + 1)));
164
+ }
165
+ return ({"outputRoot": resolve(output), "producers": producer_records, "cells": cell_records, "generations": ({"directory": resolve(generation_directory)}), "sourceRoot": (((options)["sourceRoot"] == null) ? root : resolve((options)["sourceRoot"])), "sessionOptions": (options)["sessionOptions"]});
166
+ }
167
+ }
168
+ function grid_assert_provenance(artifact, sources, producer_host) {
169
+ assertCompilerArtifactSources(artifact, sources);
170
+ {
171
+ let provenance = (artifact)["provenance"];
172
+ let mode = ((provenance == null) ? undefined : (provenance)["mode"]);
173
+ let wanted = (((sources)["modules"])["map"](((record) => {
174
+ return (record)["id"];
175
+ })))["sort"]();
176
+ let received = ((provenance == null) ? undefined : (provenance)["compiledModuleIds"]);
177
+ if ((!(((mode === "seed") || (mode === "session")) && ((provenance)["runtimeCompiled"] === true)))) {
178
+ grid_error("compiler build did not record a complete runtime compilation");
179
+ }
180
+ if ((!__eliscript_truthy(((__eliscript_value_9) => (__eliscript_truthy(__eliscript_value_9) ? (JSON.stringify((Array.from(received))["sort"]()) === JSON.stringify(wanted)) : __eliscript_value_9))(Array.isArray(received))))) {
181
+ grid_error("compiler build did not compile every original module");
182
+ }
183
+ if ((!(producer_host === undefined))) {
184
+ if ((!((mode === "session") && (normalizeCompilerHost((provenance)["producerHost"]) === producer_host)))) {
185
+ return grid_error("compiler build producer differs from the recorded independent host");
186
+ } else {
187
+ return null;
188
+ }
189
+ } else {
190
+ return null;
191
+ }
192
+ }
193
+ }
194
+ async function grid_read_artifact(path, host, sources, producer_host) {
195
+ return ((artifact) => {
196
+ if ((!(normalizeCompilerHost((artifact)["host"]) === host))) {
197
+ grid_error("recorded compiler artifact has a different host");
198
+ }
199
+ grid_assert_provenance(artifact, sources, producer_host);
200
+ ((artifact)["directory"] = dirname(path));
201
+ ((artifact)["metadataPath"] = path);
202
+ ((artifact)["path"] = resolve(dirname(path), grid_required_string((artifact)["path"], "compiler artifact path is required")));
203
+ return artifact;
204
+ })(await (readCompilerMetadata(path)));
205
+ }
206
+ async function grid_initialize_artifact(artifact, directory, options, owner) {
207
+ return (await (async (session, failed) => {
208
+ return (await (async () => {
209
+ try {
210
+ return (await (async () => {
211
+ ((session = await (openCompilerArtifact(artifact, options))));
212
+ if ((!(normalizeCompilerHost((session)["host"]) === normalizeCompilerHost((artifact)["host"])))) {
213
+ grid_error("compiler session changed its recorded host");
214
+ }
215
+ return (await (async (capabilities) => {
216
+ if ((!__eliscript_truthy(((__eliscript_value_10) => (__eliscript_truthy(__eliscript_value_10) ? ((__eliscript_value_11) => (__eliscript_truthy(__eliscript_value_11) ? ((__eliscript_value_12) => (__eliscript_truthy(__eliscript_value_12) ? (compilerHosts)["every"](((host) => {
217
+ return ((capabilities)["targets"])["includes"](host);
218
+ })) : __eliscript_value_12))(Array.isArray((capabilities)["targets"])) : __eliscript_value_11))(((capabilities)["version"] === 1)) : __eliscript_value_10))(((capabilities)["format"] === "eliscript-compiler-capabilities"))))) {
219
+ grid_error("initialized compiler does not expose the three product targets");
220
+ }
221
+ await (saveCompilerMetadata(resolve(directory, "capabilities.json"), capabilities));
222
+ return capabilities;
223
+ })(await ((session)["request"](({"operation": "capabilities"})))));
224
+ })());
225
+ } catch (error) {
226
+ ((failed = true));
227
+ return ((__eliscript_value_13) => { throw __eliscript_value_13; })(error);
228
+ } finally {
229
+ (__eliscript_truthy(session) ? (await (async () => {
230
+ try {
231
+ return await ((session)["close"]());
232
+ } catch (error) {
233
+ ((owner)["cleanupFailure"] = compilerFailure(error));
234
+ if ((!__eliscript_truthy(failed))) {
235
+ return ((__eliscript_value_14) => { throw __eliscript_value_14; })(error);
236
+ } else {
237
+ return null;
238
+ }
239
+ }
240
+ })()) : null);
241
+ }
242
+ })());
243
+ })(null, false));
244
+ }
245
+ async function grid_existing_generations(directory, source_identity) {
246
+ return (await (async (metadata) => {
247
+ return (await (async (chains) => {
248
+ return (await (async (hosts) => {
249
+ return (await (async (index) => {
250
+ return (await (async () => {
251
+ if ((!__eliscript_truthy(((__eliscript_value_15) => (__eliscript_truthy(__eliscript_value_15) ? ((__eliscript_value_16) => (__eliscript_truthy(__eliscript_value_16) ? ((__eliscript_value_17) => (__eliscript_truthy(__eliscript_value_17) ? ((__eliscript_value_18) => (__eliscript_truthy(__eliscript_value_18) ? ((__eliscript_value_19) => (__eliscript_truthy(__eliscript_value_19) ? ((__eliscript_value_20) => (__eliscript_truthy(__eliscript_value_20) ? (((chains) ?? []).length === 3) : __eliscript_value_20))(Array.isArray(chains)) : __eliscript_value_19))((((metadata)["fixedPoint"])["status"] === "identical")) : __eliscript_value_18))(((metadata)["status"] === "constructed")) : __eliscript_value_17))((grid_source_sha(metadata) === (source_identity)["sha256"])) : __eliscript_value_16))(((metadata)["version"] === 1)) : __eliscript_value_15))(((metadata)["format"] === "eliscript-independent-compiler-bootstrap"))))) {
252
+ grid_error("compiler grid requires three complete fixed-point self-host chains");
253
+ }
254
+ (await (async () => {
255
+ while (__eliscript_numeric_relation("<", index, ((chains) ?? []).length)) {
256
+ (await (async (chain) => {
257
+ return (await (async (sequence) => {
258
+ return (await (async (host) => {
259
+ return (await (async (chain_directory) => {
260
+ return (await (async () => {
261
+ if ((!__eliscript_truthy(((__eliscript_value_22) => (__eliscript_truthy(__eliscript_value_22) ? ((__eliscript_value_23) => (__eliscript_truthy(__eliscript_value_23) ? ((__eliscript_value_24) => (__eliscript_truthy(__eliscript_value_24) ? ((__eliscript_value_25) => (__eliscript_truthy(__eliscript_value_25) ? (sequence)["every"](((item) => {
262
+ return (normalizeCompilerHost(item) === host);
263
+ })) : __eliscript_value_25))(((chain)["status"] === "constructed")) : __eliscript_value_24))(__eliscript_numeric_relation(">=", ((sequence) ?? []).length, 3)) : __eliscript_value_23))((!__eliscript_truthy((hosts)["has"](host)))) : __eliscript_value_22))(host)))) {
264
+ grid_error("compiler grid generations do not cover three independent same-host chains");
265
+ }
266
+ (hosts)["add"](host);
267
+ return ((original) => {
268
+ return ((records) => {
269
+ return ((fixed_point) => {
270
+ return ((!__eliscript_truthy(((__eliscript_value_26) => (__eliscript_truthy(__eliscript_value_26) ? ((__eliscript_value_27) => (__eliscript_truthy(__eliscript_value_27) ? ((__eliscript_value_28) => (__eliscript_truthy(__eliscript_value_28) ? ((__eliscript_value_29) => (__eliscript_truthy(__eliscript_value_29) ? ((__eliscript_value_30) => (__eliscript_truthy(__eliscript_value_30) ? ((__eliscript_value_31) => (__eliscript_truthy(__eliscript_value_31) ? ((__eliscript_value_32) => (__eliscript_truthy(__eliscript_value_32) ? ((__eliscript_value_33) => (__eliscript_truthy(__eliscript_value_33) ? ((__eliscript_value_34) => (__eliscript_truthy(__eliscript_value_34) ? ((__eliscript_value_35) => (__eliscript_truthy(__eliscript_value_35) ? ((__eliscript_value_36) => (__eliscript_truthy(__eliscript_value_36) ? ((fixed_point)["comparisons"])["every"](((item) => {
271
+ return ((item)["status"] === "identical");
272
+ })) : __eliscript_value_36))(((((fixed_point)["comparisons"]) ?? []).length === __eliscript_numeric_decrement(((records) ?? []).length))) : __eliscript_value_35))(Array.isArray((fixed_point)["comparisons"])) : __eliscript_value_34))(((fixed_point)["status"] === "identical")) : __eliscript_value_33))((records)["every"](((record, position) => {
273
+ return (((record)["generation"] === (position + 1)) && ((record)["target"] === host) && ((record)["status"] === "instantiated") && ((record)["sourceSha256"] === (source_identity)["sha256"]) && ((position === 0) || ((record)["producerHost"] === host)));
274
+ }))) : __eliscript_value_32))((((records) ?? []).length === ((sequence) ?? []).length)) : __eliscript_value_31))(Array.isArray(records)) : __eliscript_value_30))((!__eliscript_truthy((original)["cleanupFailure"]))) : __eliscript_value_29))(((original)["status"] === "constructed")) : __eliscript_value_28))((grid_source_sha(original) === (source_identity)["sha256"])) : __eliscript_value_27))(((original)["version"] === 1)) : __eliscript_value_26))(((original)["format"] === "eliscript-compiler-bootstrap")))) ? grid_error("compiler generation records do not satisfy the retained matrix gate") : null);
275
+ })((original)["fixedPoint"]);
276
+ })((original)["generations"]);
277
+ })(await (readCompilerMetadata(resolve(chain_directory, "bootstrap.json"))));
278
+ })());
279
+ })(grid_required_string((chain)["directory"], "compiler generation directory is required")));
280
+ })((__eliscript_truthy(((__eliscript_value_21) => (__eliscript_truthy(__eliscript_value_21) ? __eliscript_numeric_relation(">", ((sequence) ?? []).length, 0) : __eliscript_value_21))(Array.isArray(sequence))) ? normalizeCompilerHost((sequence)[0]) : undefined)));
281
+ })((chain)["hosts"]));
282
+ })((chains)[index]));
283
+ ((index = (index + 1)));
284
+ }
285
+ return null;
286
+ })());
287
+ return ({"directory": directory, "status": (metadata)["status"], "sourceIdentity": (metadata)["sourceIdentity"], "chains": chains, "fixedPoint": (metadata)["fixedPoint"]});
288
+ })());
289
+ })(0));
290
+ })(new (globalThis.Set)()));
291
+ })((metadata)["chains"]));
292
+ })(await (readCompilerMetadata(resolve(directory, "bootstrap.json")))));
293
+ }
294
+ async function record_grid_artifacts(options, retain_artifacts) {
295
+ return (await (async (plan) => {
296
+ return (await (async (sources) => {
297
+ return (await (async (source_identity) => {
298
+ return (await (async (generations) => {
299
+ return (await (async () => {
300
+ await (mkdir((plan)["outputRoot"], ({"recursive": true})));
301
+ return (await (async (directory) => {
302
+ return (await (async (metadata) => {
303
+ return (await (async (manifest) => {
304
+ return (await (async (artifacts) => {
305
+ return (await (async (canonical_artifacts) => {
306
+ return (await (async (artifact_paths) => {
307
+ return (await (async (canonical_paths) => {
308
+ return (await (async (producers) => {
309
+ return (await (async (index) => {
310
+ return (await (async () => {
311
+ await (saveCompilerMetadata(manifest, metadata));
312
+ return (await (async () => {
313
+ try {
314
+ return (await (async () => {
315
+ (await (async () => {
316
+ while (__eliscript_numeric_relation("<", index, (((plan)["producers"]) ?? []).length)) {
317
+ (await (async (record) => {
318
+ return (await (async (host) => {
319
+ return (await (async (artifact) => {
320
+ return (await (async (producer_directory) => {
321
+ return (await (async (archived) => {
322
+ return (await (async (producer_record) => {
323
+ return (await (async () => {
324
+ ((metadata)["producers"])["push"](producer_record);
325
+ await (grid_initialize_artifact(artifact, producer_directory, (plan)["sessionOptions"], producer_record));
326
+ (producers)["set"](host, (artifact)["productIdentity"]);
327
+ return ((producer_record)["execution"] = "initialized");
328
+ })());
329
+ })(({"host": host, "artifact": archived, "execution": "unverified"})));
330
+ })(await (archiveCompilerArtifact(artifact, resolve(producer_directory, "metadata")))));
331
+ })(resolve(directory, ("producer-" + host))));
332
+ })(await (grid_read_artifact((record)["metadataPath"], host, sources, undefined))));
333
+ })((record)["host"]));
334
+ })(((plan)["producers"])[index]));
335
+ ((index = (index + 1)));
336
+ }
337
+ return null;
338
+ })());
339
+ (await (async (host_index) => {
340
+ return (await (async () => {
341
+ while (__eliscript_numeric_relation("<", host_index, ((compilerHosts) ?? []).length)) {
342
+ (await (async (host, target_index) => {
343
+ return (await (async () => {
344
+ while (__eliscript_numeric_relation("<", target_index, ((compilerHosts) ?? []).length)) {
345
+ (await (async (target) => {
346
+ return (await (async (record) => {
347
+ return (await (async (cell) => {
348
+ return (await (async (cell_directory) => {
349
+ return (await (async () => {
350
+ ((metadata)["cells"])["push"](cell);
351
+ await (mkdir(cell_directory, ({"recursive": true})));
352
+ await (saveCompilerMetadata(manifest, metadata));
353
+ return (await (async () => {
354
+ try {
355
+ return (await (async (artifact) => {
356
+ ((cell)["producerIdentity"] = (producers)["get"](host));
357
+ ((cell)["artifact"] = await (archiveCompilerArtifact(artifact, resolve(cell_directory, "metadata"))));
358
+ ((cell)["status"] = "built");
359
+ await (saveCompilerMetadata(manifest, metadata));
360
+ await (grid_initialize_artifact(artifact, cell_directory, (plan)["sessionOptions"], cell));
361
+ ((cell)["execution"] = "initialized");
362
+ ((cell)["status"] = "constructed");
363
+ if (__eliscript_truthy(retain_artifacts)) {
364
+ (artifacts)["push"](artifact);
365
+ }
366
+ (artifact_paths)["push"](({"host": target, "metadataPath": (record)["metadataPath"], "productIdentity": (artifact)["productIdentity"]}));
367
+ return await (saveCompilerMetadata(manifest, metadata));
368
+ })(await (grid_read_artifact((record)["metadataPath"], target, sources, host))));
369
+ } catch (error) {
370
+ ((cell)["status"] = "failed");
371
+ ((cell)["failure"] = compilerFailure(error));
372
+ return ((__eliscript_value_37) => { throw __eliscript_value_37; })(error);
373
+ }
374
+ })());
375
+ })());
376
+ })(resolve(directory, (host + "-to-" + target))));
377
+ })(({"host": host, "target": target, "status": "building", "execution": "unverified"})));
378
+ })(((plan)["cells"])["find"](((item) => {
379
+ return (((item)["host"] === host) && ((item)["target"] === target));
380
+ }))));
381
+ })((compilerHosts)[target_index]));
382
+ ((target_index = (target_index + 1)));
383
+ }
384
+ return null;
385
+ })());
386
+ })((compilerHosts)[host_index], 0));
387
+ ((host_index = (host_index + 1)));
388
+ }
389
+ return null;
390
+ })());
391
+ })(0));
392
+ ((index = 0));
393
+ while (__eliscript_numeric_relation("<", index, ((compilerHosts) ?? []).length)) {
394
+ {
395
+ let target = (compilerHosts)[index];
396
+ let cells = ((metadata)["cells"])["filter"](((cell) => {
397
+ return ((cell)["target"] === target);
398
+ }));
399
+ let identities = (cells)["map"](((cell) => {
400
+ return (((cell)["artifact"])["productIdentity"])["sha256"];
401
+ }));
402
+ if ((!__eliscript_truthy(((__eliscript_value_38) => (__eliscript_truthy(__eliscript_value_38) ? (identities)["every"](((value) => {
403
+ return ((((__eliscript_value) => { if (__eliscript_value === null) return "null"; const __eliscript_host_type = typeof __eliscript_value; if (__eliscript_host_type !== "object" && __eliscript_host_type !== "function") return __eliscript_host_type; try { const __eliscript_type = Object.getOwnPropertyDescriptor(__eliscript_value, Symbol.for("eliscript.value.type")); if (__eliscript_type && Object.prototype.hasOwnProperty.call(__eliscript_type, "value") && (__eliscript_type.value === "keyword" || __eliscript_type.value === "symbol")) return __eliscript_type.value; const __eliscript_kind = Object.getOwnPropertyDescriptor(__eliscript_value, "kind"); if (__eliscript_kind && Object.prototype.hasOwnProperty.call(__eliscript_kind, "value")) { if (__eliscript_kind.value === "eliscript/keyword") return "keyword"; if (__eliscript_kind.value === "eliscript/symbol") return "symbol"; } return __eliscript_host_type; } catch { return __eliscript_host_type; } })(value) === "string") && __eliscript_numeric_relation(">", ((value) ?? []).length, 0));
404
+ })) : __eliscript_value_38))((((cells) ?? []).length === 3))))) {
405
+ grid_error("compiler grid target has incomplete product identities");
406
+ }
407
+ {
408
+ const __eliscript_value_39 = ((new (globalThis.Set)(identities))["size"] === 1);
409
+ {
410
+ let identical = __eliscript_value_39;
411
+ ((metadata)["comparisons"])["push"](({"target": target, "status": (__eliscript_truthy(identical) ? "identical" : "different"), "identities": identities}));
412
+ if ((!__eliscript_truthy(identical))) {
413
+ grid_error("compiler grid target products differ");
414
+ }
415
+ }
416
+ }
417
+ if (__eliscript_truthy(retain_artifacts)) {
418
+ (canonical_artifacts)["push"]((artifacts)["find"](((artifact) => {
419
+ return ((artifact)["host"] === target);
420
+ })));
421
+ }
422
+ (canonical_paths)["push"]((artifact_paths)["find"](((artifact) => {
423
+ return ((artifact)["host"] === target);
424
+ })));
425
+ }
426
+ ((index = (index + 1)));
427
+ }
428
+ ((metadata)["identityVerification"] = "identical");
429
+ ((metadata)["status"] = "constructed");
430
+ await (saveCompilerMetadata(manifest, metadata));
431
+ if (__eliscript_truthy(retain_artifacts)) {
432
+ return ({"directory": directory, "artifacts": artifacts, "canonicalArtifacts": canonical_artifacts, "metadata": metadata});
433
+ } else {
434
+ return ({"directory": directory, "artifacts": artifacts, "canonicalArtifacts": canonical_artifacts, "artifactPaths": artifact_paths, "canonicalArtifactPaths": canonical_paths, "metadata": metadata});
435
+ }
436
+ })());
437
+ } catch (error) {
438
+ ((metadata)["status"] = "failed");
439
+ ((metadata)["identityVerification"] = "unverified");
440
+ ((metadata)["failure"] = compilerFailure(error));
441
+ await (saveCompilerMetadata(manifest, metadata));
442
+ return ((__eliscript_value_40) => { throw __eliscript_value_40; })(error);
443
+ }
444
+ })());
445
+ })());
446
+ })(0));
447
+ })(new (globalThis.Map)()));
448
+ })([]));
449
+ })([]));
450
+ })([]));
451
+ })([]));
452
+ })(resolve(directory, "grid.json")));
453
+ })(({"format": "eliscript-independent-compiler-grid", "version": 1, "status": "building", "verification": "unverified", "sourceIdentity": await (archiveCompilerSources(sources, resolve(directory, "sources"))), "cells": [], "comparisons": [], "generations": generations, "producers": []})));
454
+ })(await (mkdtemp(resolve((plan)["outputRoot"], "compiler-grid-")))));
455
+ })());
456
+ })(await (grid_existing_generations(((plan)["generations"])["directory"], source_identity))));
457
+ })(compilerSourceIdentity(sources)));
458
+ })(await (loadCompilerSources(({"sourceRoot": (plan)["sourceRoot"]})))));
459
+ })(grid_capture_plan(options)));
460
+ }
461
+ async function recordCompilerGrid(options) {
462
+ return await (record_grid_artifacts(options, true));
463
+ }
464
+ function grid_execution_plan(options) {
465
+ if ((!__eliscript_truthy(((__eliscript_value_41) => (__eliscript_truthy(__eliscript_value_41) ? ((((__eliscript_value) => { if (__eliscript_value === null) return "null"; const __eliscript_host_type = typeof __eliscript_value; if (__eliscript_host_type !== "object" && __eliscript_host_type !== "function") return __eliscript_host_type; try { const __eliscript_type = Object.getOwnPropertyDescriptor(__eliscript_value, Symbol.for("eliscript.value.type")); if (__eliscript_type && Object.prototype.hasOwnProperty.call(__eliscript_type, "value") && (__eliscript_type.value === "keyword" || __eliscript_type.value === "symbol")) return __eliscript_type.value; const __eliscript_kind = Object.getOwnPropertyDescriptor(__eliscript_value, "kind"); if (__eliscript_kind && Object.prototype.hasOwnProperty.call(__eliscript_kind, "value")) { if (__eliscript_kind.value === "eliscript/keyword") return "keyword"; if (__eliscript_kind.value === "eliscript/symbol") return "symbol"; } return __eliscript_host_type; } catch { return __eliscript_host_type; } })(options) === "object") && (!__eliscript_truthy(Array.isArray(options)))) : __eliscript_value_41))(options)))) {
466
+ ((__eliscript_value_42) => { throw __eliscript_value_42; })(new (globalThis.TypeError)("compiler matrix execution options are required"));
467
+ }
468
+ {
469
+ let output = grid_required_string((options)["outputRoot"], "compiler grid outputRoot is required");
470
+ let producers = (options)["producers"];
471
+ let count = (((options)["generations"] === undefined) ? 3 : (options)["generations"]);
472
+ let records = [];
473
+ let hosts = new (globalThis.Set)();
474
+ let index = 0;
475
+ if ((!__eliscript_truthy(((__eliscript_value_43) => (__eliscript_truthy(__eliscript_value_43) ? __eliscript_numeric_relation(">=", count, 3) : __eliscript_value_43))(Number.isSafeInteger(count))))) {
476
+ ((__eliscript_value_44) => { throw __eliscript_value_44; })(new (globalThis.TypeError)("compiler matrix execution requires at least three generations per host"));
477
+ }
478
+ if ((!__eliscript_truthy(((__eliscript_value_45) => (__eliscript_truthy(__eliscript_value_45) ? (((producers) ?? []).length === 3) : __eliscript_value_45))(Array.isArray(producers))))) {
479
+ ((__eliscript_value_46) => { throw __eliscript_value_46; })(new (globalThis.TypeError)("recorded compiler grid requires three producer artifacts"));
480
+ }
481
+ while (__eliscript_numeric_relation("<", index, ((producers) ?? []).length)) {
482
+ {
483
+ let record = (producers)[index];
484
+ let host = normalizeCompilerHost((record)["host"]);
485
+ let path = grid_required_string((record)["metadataPath"], "producer metadataPath is required");
486
+ if (__eliscript_truthy((hosts)["has"](host))) {
487
+ grid_error("compiler grid repeats a producer host");
488
+ }
489
+ (hosts)["add"](host);
490
+ (records)["push"](({"host": host, "metadataPath": resolve(path)}));
491
+ }
492
+ ((index = (index + 1)));
493
+ }
494
+ return ({"outputRoot": resolve(output), "producers": records, "generations": count, "sourceRoot": (((options)["sourceRoot"] == null) ? root : resolve((options)["sourceRoot"])), "profile": (((options)["profile"] === undefined) ? "small" : (options)["profile"]), "nativeTarget": (options)["nativeTarget"], "sessionOptions": (options)["sessionOptions"], "signal": (options)["signal"], "onStage": (options)["onStage"]});
495
+ }
496
+ }
497
+ function grid_chain_shape(metadata, host, count, source_identity) {
498
+ {
499
+ const __eliscript_value_47 = (metadata)["hosts"];
500
+ const __eliscript_value_48 = (metadata)["generations"];
501
+ const __eliscript_value_49 = (metadata)["fixedPoint"];
502
+ {
503
+ let sequence = __eliscript_value_47;
504
+ let records = __eliscript_value_48;
505
+ let fixed = __eliscript_value_49;
506
+ if ((!__eliscript_truthy(((__eliscript_value_50) => (__eliscript_truthy(__eliscript_value_50) ? ((__eliscript_value_51) => (__eliscript_truthy(__eliscript_value_51) ? ((__eliscript_value_52) => (__eliscript_truthy(__eliscript_value_52) ? ((__eliscript_value_53) => (__eliscript_truthy(__eliscript_value_53) ? ((__eliscript_value_54) => (__eliscript_truthy(__eliscript_value_54) ? ((__eliscript_value_55) => (__eliscript_truthy(__eliscript_value_55) ? ((__eliscript_value_56) => (__eliscript_truthy(__eliscript_value_56) ? ((__eliscript_value_57) => (__eliscript_truthy(__eliscript_value_57) ? ((__eliscript_value_58) => (__eliscript_truthy(__eliscript_value_58) ? ((__eliscript_value_59) => (__eliscript_truthy(__eliscript_value_59) ? ((__eliscript_value_60) => (__eliscript_truthy(__eliscript_value_60) ? ((__eliscript_value_61) => (__eliscript_truthy(__eliscript_value_61) ? ((__eliscript_value_62) => (__eliscript_truthy(__eliscript_value_62) ? ((__eliscript_value_63) => (__eliscript_truthy(__eliscript_value_63) ? ((fixed)["comparisons"])["every"](((item, position) => {
507
+ return ((__eliscript_value_64) => (__eliscript_truthy(__eliscript_value_64) ? ((__eliscript_value_65) => (__eliscript_truthy(__eliscript_value_65) ? ((__eliscript_value_66) => (__eliscript_truthy(__eliscript_value_66) ? ((__eliscript_value_67) => (__eliscript_truthy(__eliscript_value_67) ? ((__eliscript_value_68) => (__eliscript_truthy(__eliscript_value_68) ? (((((item)["identities"]) ?? []).length === 2) && (((item)["identities"])[0] === ((((records)[position])["artifact"])["productIdentity"])["sha256"]) && (((item)["identities"])[1] === ((((records)[(position + 1)])["artifact"])["productIdentity"])["sha256"])) : __eliscript_value_68))(Array.isArray((item)["identities"])) : __eliscript_value_67))(((item)["status"] === "identical")) : __eliscript_value_66))(((item)["to"] === (position + 2))) : __eliscript_value_65))(((item)["from"] === (position + 1))) : __eliscript_value_64))(((item)["target"] === host));
508
+ })) : __eliscript_value_63))(((((fixed)["comparisons"]) ?? []).length === __eliscript_numeric_decrement(((records) ?? []).length))) : __eliscript_value_62))(Array.isArray((fixed)["comparisons"])) : __eliscript_value_61))(((fixed)["status"] === "identical")) : __eliscript_value_60))((records)["every"](((record, position) => {
509
+ return (((record)["generation"] === (position + 1)) && ((record)["target"] === host) && ((record)["producerHost"] === host) && ((record)["status"] === "instantiated") && ((record)["sourceSha256"] === (source_identity)["sha256"]));
510
+ }))) : __eliscript_value_59))((((records) ?? []).length === ((sequence) ?? []).length)) : __eliscript_value_58))(Array.isArray(records)) : __eliscript_value_57))((sequence)["every"](((item) => {
511
+ return (normalizeCompilerHost(item) === host);
512
+ }))) : __eliscript_value_56))(__eliscript_numeric_relation(">=", ((sequence) ?? []).length, count)) : __eliscript_value_55))(Array.isArray(sequence)) : __eliscript_value_54))((!__eliscript_truthy((metadata)["cleanupFailure"]))) : __eliscript_value_53))(((metadata)["status"] === "constructed")) : __eliscript_value_52))((grid_source_sha(metadata) === (source_identity)["sha256"])) : __eliscript_value_51))(((metadata)["version"] === 1)) : __eliscript_value_50))(((metadata)["format"] === "eliscript-compiler-bootstrap"))))) {
513
+ grid_error("retained compiler chain does not satisfy the requested complete same-host fixed point");
514
+ }
515
+ return metadata;
516
+ }
517
+ }
518
+ }
519
+ async function grid_verify_chain(metadata, host, plan, sources, source_identity, initial) {
520
+ grid_chain_shape(metadata, host, (plan)["generations"], source_identity);
521
+ return (await (async (root_directory) => {
522
+ return (await (async (directory) => {
523
+ return (await (async (part) => {
524
+ return (await (async () => {
525
+ if ((!(__eliscript_numeric_relation(">", ((part) ?? []).length, 0) && (!__eliscript_truthy(isAbsolute(part))) && ((__eliscript_value_69, __eliscript_value_70) => (__eliscript_value_69 !== __eliscript_value_70))(part, "..") && (!__eliscript_truthy((part)["startsWith"]((".." + sep))))))) {
526
+ grid_error("retained compiler chain directory is outside its host construction root");
527
+ }
528
+ ((original) => {
529
+ if ((!(compilerMetadataDigest(metadata) === compilerMetadataDigest(original)))) {
530
+ return grid_error("retained compiler chain differs from its original bootstrap manifest");
531
+ } else {
532
+ return null;
533
+ }
534
+ })(await (readCompilerMetadata(resolve(directory, "bootstrap.json"))));
535
+ (await (async (seed) => {
536
+ if ((!__eliscript_truthy(((__eliscript_value_71) => (__eliscript_truthy(__eliscript_value_71) ? (((seed)["host"] === host) && (((seed)["productIdentity"])["sha256"] === ((initial)["productIdentity"])["sha256"])) : __eliscript_value_71))(seed)))) {
537
+ grid_error("retained compiler chain has a different initial producer");
538
+ }
539
+ return ((actual) => {
540
+ if ((!(compilerMetadataDigest(actual) === compilerMetadataDigest(seed)))) {
541
+ return grid_error("retained compiler chain seed evidence differs from its actual artifact");
542
+ } else {
543
+ return null;
544
+ }
545
+ })(await (archiveCompilerArtifact(initial, resolve(directory, "seed-metadata"))));
546
+ })((metadata)["seed"]));
547
+ return (await (async (records, index, last) => {
548
+ (await (async () => {
549
+ while (__eliscript_numeric_relation("<", index, ((records) ?? []).length)) {
550
+ (await (async (record) => {
551
+ return (await (async (evidence) => {
552
+ return (await (async (artifact_directory) => {
553
+ return (await (async (artifact) => {
554
+ return (await (async () => {
555
+ if ((!__eliscript_truthy(((__eliscript_value_72) => (__eliscript_truthy(__eliscript_value_72) ? ((__eliscript_value_73) => (__eliscript_truthy(__eliscript_value_73) ? ((__eliscript_value_76) => (__eliscript_truthy(__eliscript_value_76) ? ((__eliscript_value_77) => (__eliscript_truthy(__eliscript_value_77) ? ((__eliscript_value_78) => (__eliscript_truthy(__eliscript_value_78) ? ((__eliscript_value_79) => (__eliscript_truthy(__eliscript_value_79) ? ((__eliscript_value_80) => (__eliscript_truthy(__eliscript_value_80) ? (((artifact)["productIdentity"])["sha256"] === ((evidence)["productIdentity"])["sha256"]) : __eliscript_value_80))(((host === "javascript") ? ((artifact)["modules"])["every"](((item) => {
556
+ return (((__eliscript_value) => { if (__eliscript_value === null) return "null"; const __eliscript_host_type = typeof __eliscript_value; if (__eliscript_host_type !== "object" && __eliscript_host_type !== "function") return __eliscript_host_type; try { const __eliscript_type = Object.getOwnPropertyDescriptor(__eliscript_value, Symbol.for("eliscript.value.type")); if (__eliscript_type && Object.prototype.hasOwnProperty.call(__eliscript_type, "value") && (__eliscript_type.value === "keyword" || __eliscript_type.value === "symbol")) return __eliscript_type.value; const __eliscript_kind = Object.getOwnPropertyDescriptor(__eliscript_value, "kind"); if (__eliscript_kind && Object.prototype.hasOwnProperty.call(__eliscript_kind, "value")) { if (__eliscript_kind.value === "eliscript/keyword") return "keyword"; if (__eliscript_kind.value === "eliscript/symbol") return "symbol"; } return __eliscript_host_type; } catch { return __eliscript_host_type; } })((item)["sourceMapPath"]) === "string");
557
+ })) : (((__eliscript_value) => { if (__eliscript_value === null) return "null"; const __eliscript_host_type = typeof __eliscript_value; if (__eliscript_host_type !== "object" && __eliscript_host_type !== "function") return __eliscript_host_type; try { const __eliscript_type = Object.getOwnPropertyDescriptor(__eliscript_value, Symbol.for("eliscript.value.type")); if (__eliscript_type && Object.prototype.hasOwnProperty.call(__eliscript_type, "value") && (__eliscript_type.value === "keyword" || __eliscript_type.value === "symbol")) return __eliscript_type.value; const __eliscript_kind = Object.getOwnPropertyDescriptor(__eliscript_value, "kind"); if (__eliscript_kind && Object.prototype.hasOwnProperty.call(__eliscript_kind, "value")) { if (__eliscript_kind.value === "eliscript/keyword") return "keyword"; if (__eliscript_kind.value === "eliscript/symbol") return "symbol"; } return __eliscript_host_type; } catch { return __eliscript_host_type; } })((artifact)["debugPath"]) === "string"))) : __eliscript_value_79))(((((artifact)["literalIR"]) ?? []).length === (((sources)["literalSources"]) ?? []).length)) : __eliscript_value_78))(Array.isArray((artifact)["literalIR"])) : __eliscript_value_77))(((((artifact)["frontendIR"]) ?? []).length === ((((sources)["modules"]) ?? []).length + 1))) : __eliscript_value_76))(Array.isArray((artifact)["frontendIR"])) : __eliscript_value_73))((((__eliscript_value_74, __eliscript_value_75) => (__eliscript_value_74 !== __eliscript_value_75))(host, "native") || ((plan)["nativeTarget"] === undefined) || ((artifact)["nativeTarget"] === (plan)["nativeTarget"]))) : __eliscript_value_72))(((artifact)["profile"] === (plan)["profile"]))))) {
558
+ grid_error("retained compiler generation omits its complete IR debug or product identity");
559
+ }
560
+ ((actual) => {
561
+ if ((!(compilerMetadataDigest(actual) === compilerMetadataDigest(evidence)))) {
562
+ return grid_error("retained compiler generation differs from its authenticated artifact");
563
+ } else {
564
+ return null;
565
+ }
566
+ })(await (archiveCompilerArtifact(artifact, resolve(directory, ("generation-" + (index + 1) + "-metadata")))));
567
+ if ((index === __eliscript_numeric_decrement(((records) ?? []).length))) {
568
+ return ((last = artifact));
569
+ } else {
570
+ return null;
571
+ }
572
+ })());
573
+ })(await (grid_read_artifact(resolve(artifact_directory, "compiler-artifact.json"), host, sources, host))));
574
+ })(grid_required_string((evidence)["directory"], "compiler generation artifact directory is required")));
575
+ })((record)["artifact"]));
576
+ })((records)[index]));
577
+ ((index = (index + 1)));
578
+ }
579
+ return null;
580
+ })());
581
+ return ({"directory": directory, "metadata": metadata, "artifact": last});
582
+ })((metadata)["generations"], 0, undefined));
583
+ })());
584
+ })(relative(root_directory, directory)));
585
+ })(await (realpath(grid_required_string((metadata)["directory"], "compiler generation directory is required")))));
586
+ })(await (realpath(resolve((plan)["outputRoot"], "generations", ("chain-" + host))))));
587
+ }
588
+ async function grid_ensure_chain(plan, sources, source_identity, initial, host) {
589
+ return (await (async (directory) => {
590
+ return (await (async (path) => {
591
+ return (await (async (exists) => {
592
+ return (await (async () => {
593
+ (await (async () => {
594
+ try {
595
+ return ((info) => {
596
+ if ((!__eliscript_truthy(((__eliscript_value_81) => (__eliscript_truthy(__eliscript_value_81) ? (!__eliscript_truthy((info)["isSymbolicLink"]())) : __eliscript_value_81))((info)["isFile"]())))) {
597
+ return grid_error("retained compiler chain manifest must be a regular file");
598
+ } else {
599
+ return null;
600
+ }
601
+ })(await (lstat(path)));
602
+ } catch (error) {
603
+ if (((error)["code"] === "ENOENT")) {
604
+ return ((exists = false));
605
+ } else {
606
+ return ((__eliscript_value_82) => { throw __eliscript_value_82; })(error);
607
+ }
608
+ }
609
+ })());
610
+ return (__eliscript_truthy(exists) ? await (grid_verify_chain(await (readCompilerMetadata(path)), host, plan, sources, source_identity, initial)) : (await (async (sequence) => {
611
+ return (await (async (position) => {
612
+ return (await (async () => {
613
+ while (__eliscript_numeric_relation("<", position, (plan)["generations"])) {
614
+ (sequence)["push"](host);
615
+ ((position = (position + 1)));
616
+ }
617
+ return (await (async (chain) => {
618
+ grid_chain_shape((chain)["metadata"], host, (plan)["generations"], source_identity);
619
+ await (saveCompilerMetadata(path, (chain)["metadata"]));
620
+ return chain;
621
+ })(await (bootstrapCompilerChain(({"outputRoot": directory, "hosts": sequence, "sources": sources, "sourceRoot": (plan)["sourceRoot"], "seedArtifact": initial, "profile": (plan)["profile"], "nativeTarget": (plan)["nativeTarget"], "retainIR": true, "debug": true, "sessionOptions": (plan)["sessionOptions"], "signal": (plan)["signal"], "onStage": (plan)["onStage"]})))));
622
+ })());
623
+ })(0));
624
+ })([])));
625
+ })());
626
+ })(true));
627
+ })(resolve(directory, "bootstrap.json")));
628
+ })(resolve((plan)["outputRoot"], "generations", ("chain-" + host))));
629
+ }
630
+ async function runCompilerMatrixChain(options, host) {
631
+ return (await (async (plan) => {
632
+ return (await (async (target) => {
633
+ return (await (async (sources) => {
634
+ return (await (async (source_identity) => {
635
+ return (await (async (record) => {
636
+ return (await (async (initial) => {
637
+ return await (grid_ensure_chain(plan, sources, source_identity, initial, target));
638
+ })(await (grid_read_artifact((record)["metadataPath"], target, sources, undefined))));
639
+ })(((plan)["producers"])["find"](((item) => {
640
+ return ((item)["host"] === target);
641
+ }))));
642
+ })(compilerSourceIdentity(sources)));
643
+ })(await (loadCompilerSources(({"sourceRoot": (plan)["sourceRoot"]})))));
644
+ })(normalizeCompilerHost(host)));
645
+ })(grid_execution_plan(options)));
646
+ }
647
+ async function grid_chain_path(plan, sources, source_identity, host) {
648
+ return (await (async (record) => {
649
+ return (await (async (initial) => {
650
+ return ((chain) => {
651
+ return ((metadata) => {
652
+ return ((artifact) => {
653
+ return (() => {
654
+ if ((!(((metadata)["status"] === "constructed") && (((metadata)["fixedPoint"])["status"] === "identical") && (!__eliscript_truthy((metadata)["cleanupFailure"]))))) {
655
+ grid_error("compiler matrix self-host chain has not established a complete fixed point");
656
+ }
657
+ return ({"host": host, "metadataPath": (artifact)["metadataPath"], "productIdentity": (artifact)["productIdentity"], "chain": ({"hosts": (metadata)["hosts"], "directory": (chain)["directory"], "status": (metadata)["status"], "verification": "unverified", "sourceIdentity": (metadata)["sourceIdentity"], "fixedPoint": (metadata)["fixedPoint"]})});
658
+ })();
659
+ })((chain)["artifact"]);
660
+ })((chain)["metadata"]);
661
+ })(await (grid_ensure_chain(plan, sources, source_identity, initial, host)));
662
+ })(await (grid_read_artifact((record)["metadataPath"], host, sources, undefined))));
663
+ })(((plan)["producers"])["find"](((item) => {
664
+ return ((item)["host"] === host);
665
+ }))));
666
+ }
667
+ function grid_abort(plan) {
668
+ {
669
+ const __eliscript_value_83 = (plan)["signal"];
670
+ {
671
+ let signal = __eliscript_value_83;
672
+ if (__eliscript_truthy(((__eliscript_value_84) => (__eliscript_truthy(__eliscript_value_84) ? (signal)["aborted"] : __eliscript_value_84))(signal))) {
673
+ return ((__eliscript_value_85) => { throw __eliscript_value_85; })((((signal)["reason"] === undefined) ? new (globalThis.Error)("compiler matrix aborted") : (signal)["reason"]));
674
+ } else {
675
+ return null;
676
+ }
677
+ }
678
+ }
679
+ }
680
+ async function grid_open_build_producer(plan, sources, record, initial = null, owner = null) {
681
+ return (await (async (host) => {
682
+ return (await (async (artifact) => {
683
+ return (await (async () => {
684
+ if (__eliscript_truthy(owner)) {
685
+ ((owner)["producerIdentity"] = (artifact)["productIdentity"]);
686
+ }
687
+ return await (openCompilerArtifact(artifact, (plan)["sessionOptions"]));
688
+ })());
689
+ })(await (grid_read_artifact((record)["metadataPath"], host, sources, (__eliscript_truthy(initial) ? undefined : host)))));
690
+ })((record)["host"]));
691
+ }
692
+ async function grid_build_host(plan, sources, directory, metadata, manifest, record) {
693
+ return (await (async (host) => {
694
+ return (await (async (producer) => {
695
+ return (await (async (failed) => {
696
+ return (await (async (paths) => {
697
+ return (await (async () => {
698
+ try {
699
+ return (await (async () => {
700
+ grid_abort(plan);
701
+ ((producer = await (grid_open_build_producer(plan, sources, record))));
702
+ (await (async (index) => {
703
+ return (await (async () => {
704
+ while (__eliscript_numeric_relation("<", index, ((compilerHosts) ?? []).length)) {
705
+ grid_abort(plan);
706
+ (await (async (target) => {
707
+ return (await (async (cell) => {
708
+ return (await (async (cell_directory) => {
709
+ return (await (async () => {
710
+ ((metadata)["cells"])["push"](cell);
711
+ await (mkdir(cell_directory, ({"recursive": true})));
712
+ await (saveCompilerMetadata(manifest, metadata));
713
+ return (await (async () => {
714
+ try {
715
+ return (await (async (stage) => {
716
+ (__eliscript_truthy(stage) ? await (stage(({"directory": directory, "host": host, "target": target, "phase": "compiler-build"}))) : null);
717
+ return (await (async (emitted) => {
718
+ if ((!(normalizeCompilerHost((emitted)["host"]) === target))) {
719
+ grid_error("compiler grid emitted a different host");
720
+ }
721
+ grid_assert_provenance(emitted, sources, host);
722
+ ((cell)["artifact"] = await (archiveCompilerArtifact(emitted, resolve(cell_directory, "metadata"))));
723
+ ((cell)["status"] = "built");
724
+ await (saveCompilerMetadata(manifest, metadata));
725
+ (__eliscript_truthy(stage) ? await (stage(({"directory": directory, "host": host, "target": target, "phase": "compiler-initialize"}))) : null);
726
+ await (grid_initialize_artifact(emitted, cell_directory, (plan)["sessionOptions"], cell));
727
+ ((cell)["execution"] = "initialized");
728
+ ((cell)["status"] = "constructed");
729
+ return (paths)["push"](({"host": host, "target": target, "metadataPath": (emitted)["metadataPath"]}));
730
+ })(await (buildIndependentCompiler(({"host": target, "outputRoot": resolve(cell_directory, "artifact"), "session": producer, "sources": sources, "sourceRoot": (plan)["sourceRoot"], "profile": (plan)["profile"], "nativeTarget": (plan)["nativeTarget"], "signal": (plan)["signal"], "retainIR": true, "debug": true})))));
731
+ })((plan)["onStage"]));
732
+ } catch (error) {
733
+ ((cell)["status"] = "failed");
734
+ ((cell)["failure"] = compilerFailure(error));
735
+ return ((__eliscript_value_86) => { throw __eliscript_value_86; })(error);
736
+ } finally {
737
+ await (saveCompilerMetadata(manifest, metadata));
738
+ }
739
+ })());
740
+ })());
741
+ })(resolve(directory, (host + "-to-" + target))));
742
+ })(({"host": host, "target": target, "status": "building", "execution": "unverified"})));
743
+ })((compilerHosts)[index]));
744
+ ((index = (index + 1)));
745
+ }
746
+ return null;
747
+ })());
748
+ })(0));
749
+ return paths;
750
+ })());
751
+ } catch (error) {
752
+ ((failed = true));
753
+ return ((__eliscript_value_87) => { throw __eliscript_value_87; })(error);
754
+ } finally {
755
+ (__eliscript_truthy(producer) ? (await (async () => {
756
+ try {
757
+ return await ((producer)["close"]());
758
+ } catch (error) {
759
+ if ((!__eliscript_truthy((metadata)["cleanupFailures"]))) {
760
+ ((metadata)["cleanupFailures"] = []);
761
+ }
762
+ ((metadata)["cleanupFailures"])["push"](({"host": host, "failure": compilerFailure(error)}));
763
+ await (saveCompilerMetadata(manifest, metadata));
764
+ if ((!__eliscript_truthy(failed))) {
765
+ return ((__eliscript_value_88) => { throw __eliscript_value_88; })(error);
766
+ } else {
767
+ return null;
768
+ }
769
+ }
770
+ })()) : null);
771
+ }
772
+ })());
773
+ })([]));
774
+ })(false));
775
+ })(null));
776
+ })((record)["host"]));
777
+ }
778
+ async function grid_build_paths(plan, sources, producers, output) {
779
+ await (mkdir(output, ({"recursive": true})));
780
+ return (await (async (directory) => {
781
+ return (await (async (metadata) => {
782
+ return (await (async (manifest) => {
783
+ return (await (async (paths) => {
784
+ return (await (async (index) => {
785
+ return (await (async () => {
786
+ await (saveCompilerMetadata(manifest, metadata));
787
+ return (await (async () => {
788
+ try {
789
+ return (await (async () => {
790
+ (await (async () => {
791
+ while (__eliscript_numeric_relation("<", index, ((compilerHosts) ?? []).length)) {
792
+ (await (async (host) => {
793
+ return (await (async (record) => {
794
+ return ((row) => {
795
+ return ((position) => {
796
+ return (() => {
797
+ while (__eliscript_numeric_relation("<", position, ((row) ?? []).length)) {
798
+ (paths)["push"]((row)[position]);
799
+ ((position = (position + 1)));
800
+ }
801
+ return null;
802
+ })();
803
+ })(0);
804
+ })(await (grid_build_host(plan, sources, directory, metadata, manifest, record)));
805
+ })((producers)["find"](((item) => {
806
+ return ((item)["host"] === host);
807
+ }))));
808
+ })((compilerHosts)[index]));
809
+ ((index = (index + 1)));
810
+ }
811
+ return null;
812
+ })());
813
+ ((index = 0));
814
+ while (__eliscript_numeric_relation("<", index, ((compilerHosts) ?? []).length)) {
815
+ {
816
+ let target = (compilerHosts)[index];
817
+ let cells = ((metadata)["cells"])["filter"](((cell) => {
818
+ return ((cell)["target"] === target);
819
+ }));
820
+ let identities = (cells)["map"](((cell) => {
821
+ return (((cell)["artifact"])["productIdentity"])["sha256"];
822
+ }));
823
+ if ((!__eliscript_truthy(((__eliscript_value_89) => (__eliscript_truthy(__eliscript_value_89) ? ((__eliscript_value_90) => (__eliscript_truthy(__eliscript_value_90) ? (identities)["every"](((id) => {
824
+ return ((((__eliscript_value) => { if (__eliscript_value === null) return "null"; const __eliscript_host_type = typeof __eliscript_value; if (__eliscript_host_type !== "object" && __eliscript_host_type !== "function") return __eliscript_host_type; try { const __eliscript_type = Object.getOwnPropertyDescriptor(__eliscript_value, Symbol.for("eliscript.value.type")); if (__eliscript_type && Object.prototype.hasOwnProperty.call(__eliscript_type, "value") && (__eliscript_type.value === "keyword" || __eliscript_type.value === "symbol")) return __eliscript_type.value; const __eliscript_kind = Object.getOwnPropertyDescriptor(__eliscript_value, "kind"); if (__eliscript_kind && Object.prototype.hasOwnProperty.call(__eliscript_kind, "value")) { if (__eliscript_kind.value === "eliscript/keyword") return "keyword"; if (__eliscript_kind.value === "eliscript/symbol") return "symbol"; } return __eliscript_host_type; } catch { return __eliscript_host_type; } })(id) === "string") && __eliscript_numeric_relation(">", ((id) ?? []).length, 0));
825
+ })) : __eliscript_value_90))((cells)["every"](((cell) => {
826
+ return (((cell)["status"] === "constructed") && ((cell)["execution"] === "initialized"));
827
+ }))) : __eliscript_value_89))((((cells) ?? []).length === 3))))) {
828
+ grid_error("complete compiler grid has not established all same-target identities");
829
+ }
830
+ {
831
+ const __eliscript_value_91 = ((new (globalThis.Set)(identities))["size"] === 1);
832
+ {
833
+ let identical = __eliscript_value_91;
834
+ ((metadata)["comparisons"])["push"](({"target": target, "status": (__eliscript_truthy(identical) ? "identical" : "different"), "identities": identities}));
835
+ if ((!__eliscript_truthy(identical))) {
836
+ grid_error("complete compiler grid has not established all same-target identities");
837
+ }
838
+ }
839
+ }
840
+ }
841
+ ((index = (index + 1)));
842
+ }
843
+ if (__eliscript_truthy((metadata)["cleanupFailures"])) {
844
+ grid_error("compiler grid producer cleanup failed");
845
+ }
846
+ ((metadata)["status"] = "constructed");
847
+ ((metadata)["identityVerification"] = "identical");
848
+ await (saveCompilerMetadata(manifest, metadata));
849
+ return ({"directory": directory, "metadata": metadata, "cells": paths});
850
+ })());
851
+ } catch (error) {
852
+ ((metadata)["status"] = "failed");
853
+ ((metadata)["failure"] = compilerFailure(error));
854
+ await (saveCompilerMetadata(manifest, metadata));
855
+ return ((__eliscript_value_92) => { throw __eliscript_value_92; })(error);
856
+ }
857
+ })());
858
+ })());
859
+ })(0));
860
+ })([]));
861
+ })(resolve(directory, "grid.json")));
862
+ })(({"format": "eliscript-independent-compiler-grid", "version": 1, "status": "building", "verification": "unverified", "sourceIdentity": await (archiveCompilerSources(sources, resolve(directory, "sources"))), "cells": [], "comparisons": []})));
863
+ })(await (mkdtemp(resolve(output, "compiler-grid-")))));
864
+ }
865
+ async function grid_build_selected_cell(plan, sources, record, target, directory, metadata, manifest) {
866
+ return (await (async (host) => {
867
+ return (await (async (build) => {
868
+ return (await (async (producer) => {
869
+ return (await (async (failed) => {
870
+ return (await (async (stage) => {
871
+ return (await (async () => {
872
+ try {
873
+ return (await (async () => {
874
+ grid_abort(plan);
875
+ ((producer = await (grid_open_build_producer(plan, sources, record, true, build))));
876
+ (__eliscript_truthy(stage) ? await (stage(({"phase": "compiler-build", "host": host, "target": target}))) : null);
877
+ return (await (async (artifact) => {
878
+ if ((!(normalizeCompilerHost((artifact)["host"]) === target))) {
879
+ grid_error("compiler grid emitted a different host");
880
+ }
881
+ grid_assert_provenance(artifact, sources, host);
882
+ ((build)["metadataPath"] = (artifact)["metadataPath"]);
883
+ ((build)["artifact"] = await (archiveCompilerArtifact(artifact, resolve(directory, "metadata"))));
884
+ ((build)["status"] = "built");
885
+ await (saveCompilerMetadata(manifest, metadata));
886
+ (__eliscript_truthy(stage) ? await (stage(({"phase": "compiler-initialize", "host": host, "target": target}))) : null);
887
+ await (grid_initialize_artifact(artifact, directory, (plan)["sessionOptions"], build));
888
+ ((build)["execution"] = "initialized");
889
+ return ((build)["status"] = "constructed");
890
+ })(await (buildIndependentCompiler(({"host": target, "outputRoot": resolve(directory, "artifact"), "session": producer, "sources": sources, "sourceRoot": (plan)["sourceRoot"], "profile": "full-compiler", "nativeTarget": (plan)["nativeTarget"], "signal": (plan)["signal"], "retainIR": true, "debug": true})))));
891
+ })());
892
+ } catch (error) {
893
+ ((failed = true));
894
+ ((build)["status"] = "failed");
895
+ ((build)["failure"] = compilerFailure(error));
896
+ return ((__eliscript_value_93) => { throw __eliscript_value_93; })(error);
897
+ } finally {
898
+ (__eliscript_truthy(producer) ? (await (async () => {
899
+ try {
900
+ return await ((producer)["close"]());
901
+ } catch (error) {
902
+ ((build)["cleanupFailure"] = compilerFailure(error));
903
+ if ((!__eliscript_truthy(failed))) {
904
+ return ((__eliscript_value_94) => { throw __eliscript_value_94; })(error);
905
+ } else {
906
+ return null;
907
+ }
908
+ }
909
+ })()) : null);
910
+ await (saveCompilerMetadata(manifest, metadata));
911
+ }
912
+ })());
913
+ })((plan)["onStage"]));
914
+ })(false));
915
+ })(null));
916
+ })((metadata)["build"]));
917
+ })((record)["host"]));
918
+ }
919
+ function grid_assert_complete_cell_artifact(artifact, sources) {
920
+ {
921
+ let front = (artifact)["frontendIR"];
922
+ let literal = (artifact)["literalIR"];
923
+ let wanted = (((sources)["modules"])["map"](((item) => {
924
+ return (item)["id"];
925
+ })))["concat"](["runtime"]);
926
+ let files = new (globalThis.Set)((((artifact)["artifactIdentity"])["files"])["map"](((item) => {
927
+ return (item)["path"];
928
+ })));
929
+ let declared = ((path) => {
930
+ return ((__eliscript_value_95) => (__eliscript_truthy(__eliscript_value_95) ? (files)["has"](__eliscript_at_direct((relative((artifact)["directory"], resolve((artifact)["directory"], path)))["split"](sep), "join", "/")) : __eliscript_value_95))((((__eliscript_value) => { if (__eliscript_value === null) return "null"; const __eliscript_host_type = typeof __eliscript_value; if (__eliscript_host_type !== "object" && __eliscript_host_type !== "function") return __eliscript_host_type; try { const __eliscript_type = Object.getOwnPropertyDescriptor(__eliscript_value, Symbol.for("eliscript.value.type")); if (__eliscript_type && Object.prototype.hasOwnProperty.call(__eliscript_type, "value") && (__eliscript_type.value === "keyword" || __eliscript_type.value === "symbol")) return __eliscript_type.value; const __eliscript_kind = Object.getOwnPropertyDescriptor(__eliscript_value, "kind"); if (__eliscript_kind && Object.prototype.hasOwnProperty.call(__eliscript_kind, "value")) { if (__eliscript_kind.value === "eliscript/keyword") return "keyword"; if (__eliscript_kind.value === "eliscript/symbol") return "symbol"; } return __eliscript_host_type; } catch { return __eliscript_host_type; } })(path) === "string"));
931
+ });
932
+ if ((!__eliscript_truthy(((__eliscript_value_96) => (__eliscript_truthy(__eliscript_value_96) ? ((__eliscript_value_97) => (__eliscript_truthy(__eliscript_value_97) ? ((__eliscript_value_98) => (__eliscript_truthy(__eliscript_value_98) ? ((__eliscript_value_99) => (__eliscript_truthy(__eliscript_value_99) ? ((__eliscript_value_100) => (__eliscript_truthy(__eliscript_value_100) ? ((__eliscript_value_101) => (__eliscript_truthy(__eliscript_value_101) ? ((__eliscript_value_102) => (__eliscript_truthy(__eliscript_value_102) ? (((artifact)["host"] === "javascript") ? ((artifact)["modules"])["every"](((item) => {
933
+ return declared((item)["sourceMapPath"]);
934
+ })) : declared((artifact)["debugPath"])) : __eliscript_value_102))(((front)["concat"](literal))["every"](((item) => {
935
+ return ((__eliscript_value_103) => (__eliscript_truthy(__eliscript_value_103) ? declared((item)["canonicalPath"]) : __eliscript_value_103))(declared((item)["path"]));
936
+ }))) : __eliscript_value_101))((JSON.stringify(((literal)["map"](((item) => {
937
+ return (item)["id"];
938
+ })))["sort"]()) === JSON.stringify((((sources)["literalSources"])["map"](((item) => {
939
+ return (item)["id"];
940
+ })))["sort"]()))) : __eliscript_value_100))((JSON.stringify(((front)["map"](((item) => {
941
+ return (item)["id"];
942
+ })))["sort"]()) === JSON.stringify((wanted)["sort"]()))) : __eliscript_value_99))(Array.isArray(literal)) : __eliscript_value_98))(Array.isArray(front)) : __eliscript_value_97))(((artifact)["debugEnabled"] === true)) : __eliscript_value_96))(((artifact)["profile"] === "full-compiler"))))) {
943
+ return grid_error("existing cell build omits its complete IR debug or product declarations");
944
+ } else {
945
+ return null;
946
+ }
947
+ }
948
+ }
949
+ async function grid_reuse_producer_identity(plan, sources, record, directory, owner) {
950
+ return (await (async (artifact) => {
951
+ await (mkdir(directory, ({"recursive": true})));
952
+ await (grid_initialize_artifact(artifact, directory, (plan)["sessionOptions"], owner));
953
+ return (artifact)["productIdentity"];
954
+ })(await (grid_read_artifact((record)["metadataPath"], (record)["host"], sources, undefined))));
955
+ }
956
+ async function grid_reuse_selected_cell(plan, sources, record, target, directory, metadata, manifest, path) {
957
+ return (await (async (host) => {
958
+ return (await (async (build) => {
959
+ return (await (async (stage) => {
960
+ return (await (async (receipt_path) => {
961
+ return (await (async () => {
962
+ grid_abort(plan);
963
+ (__eliscript_truthy(stage) ? await (stage(({"phase": "compiler-reuse", "host": host, "target": target}))) : null);
964
+ return (await (async (receipt) => {
965
+ return (await (async (old) => {
966
+ return (await (async () => {
967
+ ((!__eliscript_truthy((await (async (__eliscript_value_104) => (__eliscript_truthy(__eliscript_value_104) ? (await (async (__eliscript_value_105) => (__eliscript_truthy(__eliscript_value_105) ? (await (async (__eliscript_value_106) => (__eliscript_truthy(__eliscript_value_106) ? (await (async (__eliscript_value_107) => (__eliscript_truthy(__eliscript_value_107) ? (await (async (__eliscript_value_108) => (__eliscript_truthy(__eliscript_value_108) ? (await (async (__eliscript_value_109) => (__eliscript_truthy(__eliscript_value_109) ? (await (async (__eliscript_value_110) => (__eliscript_truthy(__eliscript_value_110) ? (await (async (__eliscript_value_111) => (__eliscript_truthy(__eliscript_value_111) ? (await (async (__eliscript_value_112) => (__eliscript_truthy(__eliscript_value_112) ? (await (async (__eliscript_value_113) => (__eliscript_truthy(__eliscript_value_113) ? (await (async (__eliscript_value_114) => (__eliscript_truthy(__eliscript_value_114) ? (await (realpath((old)["metadataPath"])) === await (realpath(path))) : __eliscript_value_114))((!__eliscript_truthy((old)["cleanupFailure"])))) : __eliscript_value_113))(((old)["execution"] === "initialized"))) : __eliscript_value_112))(((old)["status"] === "constructed"))) : __eliscript_value_111))(((old)["target"] === target))) : __eliscript_value_110))(((old)["host"] === host))) : __eliscript_value_109))(old)) : __eliscript_value_108))((grid_source_sha(receipt) === (compilerSourceIdentity(sources))["sha256"]))) : __eliscript_value_107))(((receipt)["target"] === target))) : __eliscript_value_106))(((receipt)["host"] === host))) : __eliscript_value_105))(((receipt)["version"] === 1))) : __eliscript_value_104))(((receipt)["format"] === "eliscript-compiler-matrix-cell-execution"))))) ? grid_error("existing cell build lacks its complete original construction evidence") : null);
968
+ ((!(await (realpath((receipt)["producerMetadataPath"])) === await (realpath((record)["metadataPath"])))) ? grid_error("existing cell build has a different original producer") : null);
969
+ ((producer_identity) => {
970
+ if ((!((producer_identity)["sha256"] === ((old)["producerIdentity"])["sha256"]))) {
971
+ grid_error("existing cell build has a different original producer");
972
+ }
973
+ return ((build)["producerIdentity"] = producer_identity);
974
+ })(await (grid_reuse_producer_identity(plan, sources, record, resolve(directory, "producer-verification"), build)));
975
+ return (await (async (artifact) => {
976
+ return (await (async (archived) => {
977
+ return (await (async () => {
978
+ grid_assert_complete_cell_artifact(artifact, sources);
979
+ ((archived = await (archiveCompilerArtifact(artifact, resolve(directory, "metadata")))));
980
+ if ((!(compilerMetadataDigest(archived) === compilerMetadataDigest((old)["artifact"])))) {
981
+ grid_error("existing cell build differs from its original archived product");
982
+ }
983
+ ((build)["metadataPath"] = path);
984
+ ((build)["artifact"] = archived);
985
+ ((build)["reusedFrom"] = receipt_path);
986
+ ((build)["status"] = "built");
987
+ await (saveCompilerMetadata(manifest, metadata));
988
+ (__eliscript_truthy(stage) ? await (stage(({"phase": "compiler-initialize", "host": host, "target": target}))) : null);
989
+ await (grid_initialize_artifact(artifact, directory, (plan)["sessionOptions"], build));
990
+ ((build)["execution"] = "initialized");
991
+ ((build)["status"] = "constructed");
992
+ return await (saveCompilerMetadata(manifest, metadata));
993
+ })());
994
+ })(null));
995
+ })(await (grid_read_artifact(path, target, sources, host))));
996
+ })());
997
+ })((receipt)["build"]));
998
+ })(await (readCompilerMetadata(receipt_path))));
999
+ })());
1000
+ })(resolve(dirname(path), "..", "execution.json")));
1001
+ })((plan)["onStage"]));
1002
+ })((metadata)["build"]));
1003
+ })((record)["host"]));
1004
+ }
1005
+ async function grid_execute_cell(options, host, target, existing_path) {
1006
+ return (await (async (selected_host) => {
1007
+ return (await (async (selected_target) => {
1008
+ return (await (async (plan) => {
1009
+ return (await (async (corpus_records_path) => {
1010
+ return (await (async (sources) => {
1011
+ return (await (async (record) => {
1012
+ return (await (async () => {
1013
+ await (mkdir((plan)["outputRoot"], ({"recursive": true})));
1014
+ return (await (async (directory) => {
1015
+ return (await (async (manifest) => {
1016
+ return (await (async (metadata) => {
1017
+ return (await (async () => {
1018
+ await (saveCompilerMetadata(manifest, metadata));
1019
+ return (await (async () => {
1020
+ try {
1021
+ return (await (async () => {
1022
+ ((existing_path === undefined) ? await (grid_build_selected_cell(plan, sources, record, selected_target, directory, metadata, manifest)) : await (grid_reuse_selected_cell(plan, sources, record, selected_target, directory, metadata, manifest, existing_path)));
1023
+ ((metadata)["status"] = "corpus-running");
1024
+ await (saveCompilerMetadata(manifest, metadata));
1025
+ return (await (async (corpus) => {
1026
+ ((metadata)["corpus"] = ({"directory": (corpus)["directory"], "status": ((corpus)["metadata"])["status"], "verification": ((corpus)["metadata"])["verification"]}));
1027
+ if ((!(((corpus)["metadata"])["verification"] === "equivalent"))) {
1028
+ grid_error("original compiler corpus cell has not passed");
1029
+ }
1030
+ ((metadata)["status"] = "constructed");
1031
+ ((metadata)["verification"] = "equivalent");
1032
+ await (saveCompilerMetadata(manifest, metadata));
1033
+ return ({"directory": directory, "metadata": metadata, "corpus": corpus});
1034
+ })(await (runCompilerMatrixCell(({"host": selected_host, "target": selected_target, "metadataPath": (record)["metadataPath"], "outputRoot": resolve(directory, "original-corpus"), "sourceRoot": (plan)["sourceRoot"], "profile": "full-compiler", "corpusRecordsPath": corpus_records_path, "nativeTarget": (plan)["nativeTarget"], "sessionOptions": (plan)["sessionOptions"], "signal": (plan)["signal"], "onStage": (plan)["onStage"]})))));
1035
+ })());
1036
+ } catch (error) {
1037
+ ((metadata)["status"] = "failed");
1038
+ ((metadata)["verification"] = "unverified");
1039
+ ((metadata)["failure"] = compilerFailure(error));
1040
+ await (saveCompilerMetadata(manifest, metadata));
1041
+ return ((__eliscript_value_115) => { throw __eliscript_value_115; })(error);
1042
+ }
1043
+ })());
1044
+ })());
1045
+ })(({"format": "eliscript-compiler-matrix-cell-execution", "version": 1, "host": selected_host, "target": selected_target, "profile": "full-compiler", "status": "building", "verification": "unverified", "finalGridVerification": "unverified", "crossCellVerification": "unverified", "generationsVerification": "unverified", "sourceIdentity": await (archiveCompilerSources(sources, resolve(directory, "sources"))), "producerMetadataPath": (record)["metadataPath"], "build": ({"host": selected_host, "target": selected_target, "status": "building", "execution": "unverified"})})));
1046
+ })(resolve(directory, "execution.json")));
1047
+ })(await (mkdtemp(resolve((plan)["outputRoot"], ("compiler-matrix-cell-" + selected_host + "-to-" + selected_target + "-"))))));
1048
+ })());
1049
+ })(((plan)["producers"])["find"](((item) => {
1050
+ return ((item)["host"] === selected_host);
1051
+ }))));
1052
+ })(await (loadCompilerSources(({"sourceRoot": (plan)["sourceRoot"]})))));
1053
+ })((options)["corpusRecordsPath"]));
1054
+ })(grid_execution_plan(options)));
1055
+ })(normalizeCompilerHost(target)));
1056
+ })(normalizeCompilerHost(host)));
1057
+ }
1058
+ async function executeCompilerMatrixCellFromArtifacts(options, host, target) {
1059
+ return await (grid_execute_cell(options, host, target, undefined));
1060
+ }
1061
+ async function executeCompilerMatrixCellFromArtifact(options, host, target, metadata_path) {
1062
+ normalizeCompilerHost(host);
1063
+ normalizeCompilerHost(target);
1064
+ grid_required_string(metadata_path, "existing cell build metadataPath is required");
1065
+ return await (grid_execute_cell(options, host, target, resolve(metadata_path)));
1066
+ }
1067
+ async function executeCompilerMatrixFromArtifacts(options) {
1068
+ return (await (async (plan) => {
1069
+ return (await (async (sources) => {
1070
+ return (await (async (source_identity) => {
1071
+ return (await (async (index) => {
1072
+ return (await (async () => {
1073
+ await (mkdir((plan)["outputRoot"], ({"recursive": true})));
1074
+ return (await (async (directory) => {
1075
+ return (await (async (generation_directory) => {
1076
+ return (await (async (generation_path) => {
1077
+ return (await (async (manifest) => {
1078
+ return (await (async (generations) => {
1079
+ return (await (async (metadata) => {
1080
+ return (await (async (producers) => {
1081
+ return (await (async () => {
1082
+ await (mkdir(generation_directory, ({"recursive": true})));
1083
+ await (saveCompilerMetadata(generation_path, generations));
1084
+ await (saveCompilerMetadata(manifest, metadata));
1085
+ return (await (async () => {
1086
+ try {
1087
+ return (await (async () => {
1088
+ ((index = 0));
1089
+ (await (async () => {
1090
+ while (__eliscript_numeric_relation("<", index, ((compilerHosts) ?? []).length)) {
1091
+ (await (async (host) => {
1092
+ return (await (async (record) => {
1093
+ return (await (async () => {
1094
+ ((generations)["chains"])["push"]((record)["chain"]);
1095
+ (producers)["push"](({"host": host, "metadataPath": (record)["metadataPath"], "productIdentity": (record)["productIdentity"]}));
1096
+ return await (saveCompilerMetadata(generation_path, generations));
1097
+ })());
1098
+ })(await (grid_chain_path(plan, sources, source_identity, host))));
1099
+ })((compilerHosts)[index]));
1100
+ ((index = (index + 1)));
1101
+ }
1102
+ return null;
1103
+ })());
1104
+ ((generations)["status"] = "constructed");
1105
+ ((generations)["fixedPoint"] = ({"status": "identical"}));
1106
+ await (saveCompilerMetadata(generation_path, generations));
1107
+ await (grid_existing_generations(generation_directory, source_identity));
1108
+ return (await (async (built) => {
1109
+ return (await (async (grid) => {
1110
+ return (await (async () => {
1111
+ ((metadata)["gridDirectory"] = (grid)["directory"]);
1112
+ await (saveCompilerMetadata(manifest, metadata));
1113
+ return (await (async (matrix) => {
1114
+ ((metadata)["matrixDirectory"] = (matrix)["directory"]);
1115
+ ((metadata)["status"] = ((matrix)["metadata"])["status"]);
1116
+ ((metadata)["verification"] = ((matrix)["metadata"])["verification"]);
1117
+ await (saveCompilerMetadata(manifest, metadata));
1118
+ if ((!((metadata)["verification"] === "equivalent"))) {
1119
+ grid_error("complete original compiler corpus matrix has not passed");
1120
+ }
1121
+ return ({"directory": directory, "metadata": metadata, "grid": grid, "matrix": matrix});
1122
+ })(await (buildCompilerMatrix(({"outputRoot": resolve(directory, "original-corpus"), "sourceRoot": (plan)["sourceRoot"], "compilerGrid": grid, "compilerArtifactRecords": (grid)["canonicalArtifactPaths"], "readCompilerArtifact": (async (host) => {
1123
+ return (await (async (record) => {
1124
+ return await (grid_read_artifact((record)["metadataPath"], host, sources, "javascript"));
1125
+ })(((grid)["canonicalArtifactPaths"])["find"](((item) => {
1126
+ return ((item)["host"] === host);
1127
+ }))));
1128
+ }), "profile": (plan)["profile"], "nativeTarget": (plan)["nativeTarget"], "sessionOptions": (plan)["sessionOptions"], "signal": (plan)["signal"], "onStage": (plan)["onStage"]})))));
1129
+ })());
1130
+ })(await (record_grid_artifacts(({"outputRoot": resolve(directory, "recorded-grid"), "sourceRoot": (plan)["sourceRoot"], "producers": producers, "cells": (built)["cells"], "generations": ({"directory": generation_directory}), "sessionOptions": (plan)["sessionOptions"]}), false))));
1131
+ })(await (grid_build_paths(plan, sources, producers, resolve(directory, "cell-builds")))));
1132
+ })());
1133
+ } catch (error) {
1134
+ ((metadata)["status"] = "failed");
1135
+ ((metadata)["verification"] = "unverified");
1136
+ ((metadata)["failure"] = compilerFailure(error));
1137
+ (((generations)["status"] === "building") ? (await (async () => {
1138
+ ((generations)["status"] = "failed");
1139
+ return await (saveCompilerMetadata(generation_path, generations));
1140
+ })()) : null);
1141
+ await (saveCompilerMetadata(manifest, metadata));
1142
+ return ((__eliscript_value_116) => { throw __eliscript_value_116; })(error);
1143
+ }
1144
+ })());
1145
+ })());
1146
+ })([]));
1147
+ })(({"format": "eliscript-compiler-matrix-execution", "version": 1, "status": "building", "verification": "unverified", "sourceIdentity": source_identity, "generationsDirectory": generation_directory})));
1148
+ })(({"format": "eliscript-independent-compiler-bootstrap", "version": 1, "status": "building", "verification": "unverified", "sourceIdentity": source_identity, "chains": []})));
1149
+ })(resolve(directory, "execution.json")));
1150
+ })(resolve(generation_directory, "bootstrap.json")));
1151
+ })(resolve((plan)["outputRoot"], "generations")));
1152
+ })(await (mkdtemp(resolve((plan)["outputRoot"], "compiler-matrix-execution-")))));
1153
+ })());
1154
+ })(0));
1155
+ })(compilerSourceIdentity(sources)));
1156
+ })(await (loadCompilerSources(({"sourceRoot": (plan)["sourceRoot"]})))));
1157
+ })(grid_execution_plan(options)));
1158
+ }
1159
+ async function run_record_grid(arguments$) {
1160
+ return (await (async (execute, chain, reuse, cell) => {
1161
+ if ((!__eliscript_truthy(((__eliscript_value_117) => (__eliscript_truthy(__eliscript_value_117) ? __eliscript_value_117 : ((__eliscript_value_118) => (__eliscript_truthy(__eliscript_value_118) ? __eliscript_value_118 : ((__eliscript_value_119) => (__eliscript_truthy(__eliscript_value_119) ? __eliscript_value_119 : (((arguments$) ?? []).length === 1)))(cell)))(chain)))(execute)))) {
1162
+ ((__eliscript_value_120) => { throw __eliscript_value_120; })(new (globalThis.Error)("Usage: record-grid GRID_INPUT_JSON | --execute INPUT_JSON | --chain INPUT_JSON HOST | --cell INPUT_JSON HOST TARGET | --cell-from-artifact INPUT_JSON HOST TARGET BUILD_METADATA"));
1163
+ }
1164
+ return (await (async (path) => {
1165
+ return (await (async (base) => {
1166
+ return (await (async (options) => {
1167
+ return (await (async () => {
1168
+ ((options)["outputRoot"] = resolve(base, grid_required_string((options)["outputRoot"], "compiler grid outputRoot is required")));
1169
+ if (__eliscript_truthy((options)["sourceRoot"])) {
1170
+ ((options)["sourceRoot"] = resolve(base, (options)["sourceRoot"]));
1171
+ }
1172
+ if ((!__eliscript_truthy(((__eliscript_value_123) => (__eliscript_truthy(__eliscript_value_123) ? __eliscript_value_123 : ((__eliscript_value_124) => (__eliscript_truthy(__eliscript_value_124) ? __eliscript_value_124 : cell))(chain)))(execute)))) {
1173
+ {
1174
+ const __eliscript_value_125 = (options)["generations"];
1175
+ {
1176
+ let generations = __eliscript_value_125;
1177
+ if (__eliscript_truthy(generations)) {
1178
+ ((generations)["directory"] = resolve(base, (generations)["directory"]));
1179
+ }
1180
+ }
1181
+ }
1182
+ }
1183
+ ([(options)["producers"], (options)["cells"]])["forEach"](((records) => {
1184
+ if (__eliscript_truthy(Array.isArray(records))) {
1185
+ return (records)["forEach"](((record) => {
1186
+ return ((record)["metadataPath"] = resolve(base, (record)["metadataPath"]));
1187
+ }));
1188
+ } else {
1189
+ return null;
1190
+ }
1191
+ }));
1192
+ if (__eliscript_truthy(((__eliscript_value_126) => (__eliscript_truthy(__eliscript_value_126) ? __eliscript_value_126 : ((__eliscript_value_127) => (__eliscript_truthy(__eliscript_value_127) ? __eliscript_value_127 : cell))(chain)))(execute))) {
1193
+ {
1194
+ const __eliscript_value_128 = 0;
1195
+ {
1196
+ let count = __eliscript_value_128;
1197
+ ((options)["onStage"] = ((event) => {
1198
+ if (__eliscript_truthy(((__eliscript_value_129) => (__eliscript_truthy(__eliscript_value_129) ? __eliscript_value_129 : __eliscript_numeric_relation("<", count, 64)))(cell))) {
1199
+ ((count = (count + 1)));
1200
+ return (() => {
1201
+ try {
1202
+ {
1203
+ const __eliscript_value_130 = ({});
1204
+ const __eliscript_value_131 = ["phase", "host", "producerHost", "target", "generation", "filename", "recipe", "case", "record", "id", "operation", "index", "count", "completed", "total"];
1205
+ const __eliscript_value_132 = 0;
1206
+ {
1207
+ let record = __eliscript_value_130;
1208
+ let fields = __eliscript_value_131;
1209
+ let index = __eliscript_value_132;
1210
+ while (__eliscript_numeric_relation("<", index, ((fields) ?? []).length)) {
1211
+ {
1212
+ let field = (fields)[index];
1213
+ let value = (event)[field];
1214
+ if ((((__eliscript_value) => { if (__eliscript_value === null) return "null"; const __eliscript_host_type = typeof __eliscript_value; if (__eliscript_host_type !== "object" && __eliscript_host_type !== "function") return __eliscript_host_type; try { const __eliscript_type = Object.getOwnPropertyDescriptor(__eliscript_value, Symbol.for("eliscript.value.type")); if (__eliscript_type && Object.prototype.hasOwnProperty.call(__eliscript_type, "value") && (__eliscript_type.value === "keyword" || __eliscript_type.value === "symbol")) return __eliscript_type.value; const __eliscript_kind = Object.getOwnPropertyDescriptor(__eliscript_value, "kind"); if (__eliscript_kind && Object.prototype.hasOwnProperty.call(__eliscript_kind, "value")) { if (__eliscript_kind.value === "eliscript/keyword") return "keyword"; if (__eliscript_kind.value === "eliscript/symbol") return "symbol"; } return __eliscript_host_type; } catch { return __eliscript_host_type; } })(value) === "string")) {
1215
+ ((record)[field] = (value)["slice"](0, 256));
1216
+ } else {
1217
+ if (__eliscript_truthy(((__eliscript_value_133) => (__eliscript_truthy(__eliscript_value_133) ? Number.isFinite(value) : __eliscript_value_133))((((__eliscript_value) => { if (__eliscript_value === null) return "null"; const __eliscript_host_type = typeof __eliscript_value; if (__eliscript_host_type !== "object" && __eliscript_host_type !== "function") return __eliscript_host_type; try { const __eliscript_type = Object.getOwnPropertyDescriptor(__eliscript_value, Symbol.for("eliscript.value.type")); if (__eliscript_type && Object.prototype.hasOwnProperty.call(__eliscript_type, "value") && (__eliscript_type.value === "keyword" || __eliscript_type.value === "symbol")) return __eliscript_type.value; const __eliscript_kind = Object.getOwnPropertyDescriptor(__eliscript_value, "kind"); if (__eliscript_kind && Object.prototype.hasOwnProperty.call(__eliscript_kind, "value")) { if (__eliscript_kind.value === "eliscript/keyword") return "keyword"; if (__eliscript_kind.value === "eliscript/symbol") return "symbol"; } return __eliscript_host_type; } catch { return __eliscript_host_type; } })(value) === "number")))) {
1218
+ ((record)[field] = value);
1219
+ } else {
1220
+
1221
+ }
1222
+ }
1223
+ }
1224
+ ((index = (index + 1)));
1225
+ }
1226
+ return ((globalThis.process)["stderr"])["write"](("record-grid stage " + JSON.stringify(record) + "\n"));
1227
+ }
1228
+ }
1229
+ } catch (ignored) {
1230
+ return null;
1231
+ }
1232
+ })();
1233
+ } else {
1234
+ return null;
1235
+ }
1236
+ }));
1237
+ (options)["onStage"](({"phase": (__eliscript_truthy(chain) ? "chain-start" : (__eliscript_truthy(cell) ? "cell-start" : "execute-start")), "host": (__eliscript_truthy(((__eliscript_value_134) => (__eliscript_truthy(__eliscript_value_134) ? __eliscript_value_134 : cell))(chain)) ? (arguments$)[2] : undefined), "target": (__eliscript_truthy(cell) ? (arguments$)[3] : undefined)}));
1238
+ }
1239
+ }
1240
+ }
1241
+ return ((grid) => {
1242
+ ((globalThis.process)["stdout"])["write"]((resolve((grid)["directory"], (__eliscript_truthy(((__eliscript_value_135) => (__eliscript_truthy(__eliscript_value_135) ? __eliscript_value_135 : cell))(execute)) ? "execution.json" : (__eliscript_truthy(chain) ? "bootstrap.json" : "grid.json"))) + "\n"));
1243
+ return grid;
1244
+ })(await ((__eliscript_truthy(execute) ? executeCompilerMatrixFromArtifacts(options) : (__eliscript_truthy(chain) ? runCompilerMatrixChain(options, (arguments$)[2]) : (__eliscript_truthy(cell) ? (__eliscript_truthy(reuse) ? executeCompilerMatrixCellFromArtifact(options, (arguments$)[2], (arguments$)[3], resolve((arguments$)[4])) : executeCompilerMatrixCellFromArtifacts(options, (arguments$)[2], (arguments$)[3])) : recordCompilerGrid(options))))));
1245
+ })());
1246
+ })(await (readCompilerMetadata(path))));
1247
+ })(dirname(path)));
1248
+ })(resolve((arguments$)[(__eliscript_truthy(((__eliscript_value_121) => (__eliscript_truthy(__eliscript_value_121) ? __eliscript_value_121 : ((__eliscript_value_122) => (__eliscript_truthy(__eliscript_value_122) ? __eliscript_value_122 : cell))(chain)))(execute)) ? 1 : 0)])));
1249
+ })(((((arguments$) ?? []).length === 2) && ((arguments$)[0] === "--execute")), ((((arguments$) ?? []).length === 3) && ((arguments$)[0] === "--chain")), ((((arguments$) ?? []).length === 5) && ((arguments$)[0] === "--cell-from-artifact")), (((((arguments$) ?? []).length === 4) && ((arguments$)[0] === "--cell")) || ((((arguments$) ?? []).length === 5) && ((arguments$)[0] === "--cell-from-artifact")))));
1250
+ }
1251
+ export {recordCompilerGrid, executeCompilerMatrixFromArtifacts, runCompilerMatrixChain, executeCompilerMatrixCellFromArtifacts, executeCompilerMatrixCellFromArtifact};
1252
+ ((__eliscript_numeric_relation(">", (((globalThis.process)["argv"]) ?? []).length, 1) && (basename(((globalThis.process)["argv"])[1]) === "record-grid.mjs")) ? (run_record_grid(((globalThis.process)["argv"])["slice"](2)))["catch"](((error) => {
1253
+ ((globalThis.process)["stderr"])["write"]((JSON.stringify(compilerFailure(error)) + "\n"));
1254
+ return ((globalThis.process)["exitCode"] = 1);
1255
+ })) : null);
1256
+ //# sourceMappingURL=record-grid.mjs.map