eliscript 0.0.1 → 0.0.2
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.
- package/README.md +59 -0
- package/bootstrap/README.md +26 -0
- package/bootstrap/backends/README.md +515 -0
- package/bootstrap/backends/async.eli +230 -0
- package/bootstrap/backends/binary.eli +173 -0
- package/bootstrap/backends/capabilities.eli +74 -0
- package/bootstrap/backends/elf.eli +246 -0
- package/bootstrap/backends/managed.eli +5976 -0
- package/bootstrap/backends/memory.eli +100 -0
- package/bootstrap/backends/native.eli +2000 -0
- package/bootstrap/backends/numeric.eli +1362 -0
- package/bootstrap/backends/optimize.eli +79 -0
- package/bootstrap/backends/regexp.eli +2263 -0
- package/bootstrap/backends/sha256.eli +138 -0
- package/bootstrap/backends/wasm.eli +1161 -0
- package/bootstrap/compiler/analyzer.eli +165 -77
- package/bootstrap/compiler/compiler.eli +43 -19
- package/bootstrap/compiler/emitter.eli +780 -170
- package/bootstrap/compiler/expander.eli +136 -45
- package/bootstrap/compiler/formatter.eli +8 -1
- package/bootstrap/compiler/ir.eli +148 -45
- package/bootstrap/compiler/lower.eli +29 -2
- package/bootstrap/compiler/project.eli +51 -21
- package/bootstrap/compiler/reader.eli +128 -36
- package/bootstrap/compiler/source-map.eli +46 -4
- package/bootstrap/compiler/symbol.eli +2 -1
- package/bootstrap/compiler/syntax.eli +47 -12
- package/bootstrap/compiler/transient-analysis.eli +40 -4
- package/bootstrap/host/check-cli-legacy.mjs +163 -0
- package/bootstrap/host/check-cli.mjs +59 -158
- package/bootstrap/host/check-cli.mjs.map +1 -0
- package/bootstrap/host/compiler-session.eli +1579 -0
- package/bootstrap/host/compiler-tools.eli +513 -0
- package/bootstrap/host/eliscript-cli-legacy.mjs +37 -0
- package/bootstrap/host/eliscript-cli.mjs +53 -33
- package/bootstrap/host/eliscript-cli.mjs.map +1 -0
- package/bootstrap/host/project-cli-legacy.mjs +295 -0
- package/bootstrap/host/project-cli.mjs +74 -289
- package/bootstrap/host/project-cli.mjs.map +1 -0
- package/bootstrap/host/project-legacy.mjs +1080 -0
- package/bootstrap/host/project.mjs +210 -1060
- package/bootstrap/host/project.mjs.map +1 -0
- package/bootstrap/runtime/UNICODE-LICENSE.txt +39 -0
- package/bootstrap/runtime/memory.eli +30379 -0
- package/browser/host.mjs +89 -0
- package/compiler/eliscript-analyzer.el +371 -4
- package/compiler/eliscript-cli.el +84 -1
- package/compiler/eliscript-emitter.el +1189 -256
- package/compiler/eliscript-expander.el +147 -10
- package/compiler/eliscript-ir-emitter.el +725 -208
- package/compiler/eliscript-lower.el +127 -1
- package/compiler/eliscript-portable.el +177 -51
- package/compiler/eliscript-project.el +20 -2
- package/compiler/eliscript-reader.el +141 -57
- package/compiler/eliscript-source-map.el +26 -12
- package/compiler/eliscript-transient-analysis.el +382 -19
- package/dist/backends/async.mjs +561 -0
- package/dist/backends/async.mjs.macro-origins.json +1 -0
- package/dist/backends/async.mjs.map +1 -0
- package/dist/backends/binary.mjs +381 -0
- package/dist/backends/binary.mjs.macro-origins.json +1 -0
- package/dist/backends/binary.mjs.map +1 -0
- package/dist/backends/capabilities.mjs +237 -0
- package/dist/backends/capabilities.mjs.macro-origins.json +1 -0
- package/dist/backends/capabilities.mjs.map +1 -0
- package/dist/backends/elf.mjs +540 -0
- package/dist/backends/elf.mjs.macro-origins.json +1 -0
- package/dist/backends/elf.mjs.map +1 -0
- package/dist/backends/managed.mjs +10616 -0
- package/dist/backends/managed.mjs.macro-origins.json +1 -0
- package/dist/backends/managed.mjs.map +1 -0
- package/dist/backends/memory.mjs +278 -0
- package/dist/backends/memory.mjs.macro-origins.json +1 -0
- package/dist/backends/memory.mjs.map +1 -0
- package/dist/backends/native.mjs +4099 -0
- package/dist/backends/native.mjs.macro-origins.json +1 -0
- package/dist/backends/native.mjs.map +1 -0
- package/dist/backends/numeric.mjs +2458 -0
- package/dist/backends/numeric.mjs.macro-origins.json +1 -0
- package/dist/backends/numeric.mjs.map +1 -0
- package/dist/backends/optimize.mjs +204 -0
- package/dist/backends/optimize.mjs.macro-origins.json +1 -0
- package/dist/backends/optimize.mjs.map +1 -0
- package/dist/backends/regexp.mjs +2033 -0
- package/dist/backends/regexp.mjs.macro-origins.json +1 -0
- package/dist/backends/regexp.mjs.map +1 -0
- package/dist/backends/sha256.mjs +310 -0
- package/dist/backends/sha256.mjs.macro-origins.json +1 -0
- package/dist/backends/sha256.mjs.map +1 -0
- package/dist/backends/wasm.mjs +2258 -0
- package/dist/backends/wasm.mjs.macro-origins.json +1 -0
- package/dist/backends/wasm.mjs.map +1 -0
- package/dist/bootstrap/analyzer.mjs +1908 -776
- package/dist/bootstrap/analyzer.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/analyzer.mjs.map +1 -1
- package/dist/bootstrap/compiler.mjs +450 -142
- package/dist/bootstrap/compiler.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/compiler.mjs.map +1 -1
- package/dist/bootstrap/emitter.mjs +3083 -909
- package/dist/bootstrap/emitter.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/emitter.mjs.map +1 -1
- package/dist/bootstrap/expander.mjs +2887 -1233
- package/dist/bootstrap/expander.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/expander.mjs.map +1 -1
- package/dist/bootstrap/formatter.mjs +582 -218
- package/dist/bootstrap/formatter.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/formatter.mjs.map +1 -1
- package/dist/bootstrap/ir.mjs +670 -116
- package/dist/bootstrap/ir.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/ir.mjs.map +1 -1
- package/dist/bootstrap/lower.mjs +866 -257
- package/dist/bootstrap/lower.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/lower.mjs.map +1 -1
- package/dist/bootstrap/package.json +1 -0
- package/dist/bootstrap/project.mjs +1168 -498
- package/dist/bootstrap/project.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/project.mjs.map +1 -1
- package/dist/bootstrap/reader.mjs +674 -175
- package/dist/bootstrap/reader.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/reader.mjs.map +1 -1
- package/dist/bootstrap/runtime/math.mjs +1117 -0
- package/dist/bootstrap/runtime/math.mjs.map +1 -0
- package/dist/bootstrap/runtime/unicode-case-data.mjs +10125 -0
- package/dist/bootstrap/runtime/unicode-case-data.mjs.map +1 -0
- package/dist/bootstrap/runtime/unicode-case.mjs +281 -0
- package/dist/bootstrap/runtime/unicode-case.mjs.map +1 -0
- package/dist/bootstrap/source-map.mjs +430 -119
- package/dist/bootstrap/source-map.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/source-map.mjs.map +1 -1
- package/dist/bootstrap/symbol.mjs +229 -53
- package/dist/bootstrap/symbol.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/symbol.mjs.map +1 -1
- package/dist/bootstrap/syntax.mjs +205 -7
- package/dist/bootstrap/syntax.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/syntax.mjs.map +1 -1
- package/dist/bootstrap/transient-analysis.mjs +1185 -489
- package/dist/bootstrap/transient-analysis.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/transient-analysis.mjs.map +1 -1
- package/dist/browser/compiler.js +199 -6478
- package/dist/browser/host.mjs +446 -0
- package/dist/browser/loader.js +1 -0
- package/dist/browser/loader.mjs +231 -0
- package/dist/browser/worker.mjs +60 -0
- package/dist/compiler-artifact.json +1 -0
- package/dist/host/compiler-session.mjs +2980 -0
- package/dist/host/compiler-session.mjs.macro-origins.json +1 -0
- package/dist/host/compiler-session.mjs.map +1 -0
- package/dist/host/compiler-tools.mjs +1084 -0
- package/dist/host/compiler-tools.mjs.macro-origins.json +1 -0
- package/dist/host/compiler-tools.mjs.map +1 -0
- package/dist/literal-sources/runtime/core/collection-internals.eli +60 -0
- package/dist/literal-sources/runtime/core/collection.eli +579 -0
- package/dist/literal-sources/runtime/core/data-text.eli +290 -0
- package/dist/literal-sources/runtime/core/data.eli +22 -0
- package/dist/literal-sources/runtime/core/identifier.eli +44 -0
- package/dist/literal-sources/runtime/core/lazy-sequence.eli +131 -0
- package/dist/literal-sources/runtime/core/list.eli +19 -0
- package/dist/literal-sources/runtime/core/map.eli +9 -0
- package/dist/literal-sources/runtime/core/metadata-internals.eli +6 -0
- package/dist/literal-sources/runtime/core/metadata.eli +23 -0
- package/dist/literal-sources/runtime/core/object.eli +8 -0
- package/dist/literal-sources/runtime/core/order.eli +123 -0
- package/dist/literal-sources/runtime/core/persistent-kind.eli +28 -0
- package/dist/literal-sources/runtime/core/protocol-error.eli +32 -0
- package/dist/literal-sources/runtime/core/protocol.eli +28 -0
- package/dist/literal-sources/runtime/core/queue.eli +9 -0
- package/dist/literal-sources/runtime/core/record.eli +191 -0
- package/dist/literal-sources/runtime/core/regex.eli +158 -0
- package/dist/literal-sources/runtime/core/sequence.eli +305 -0
- package/dist/literal-sources/runtime/core/set-algebra.eli +28 -0
- package/dist/literal-sources/runtime/core/set.eli +9 -0
- package/dist/literal-sources/runtime/core/sorted.eli +408 -0
- package/dist/literal-sources/runtime/core/text.eli +14 -0
- package/dist/literal-sources/runtime/core/transducer.eli +268 -0
- package/dist/literal-sources/runtime/core/transient.eli +17 -0
- package/dist/literal-sources/runtime/core/truth.eli +4 -0
- package/dist/literal-sources/runtime/core/type.eli +232 -0
- package/dist/literal-sources/runtime/core/value-internals.eli +13 -0
- package/dist/literal-sources/runtime/core/value.eli +19 -0
- package/dist/literal-sources/runtime/core/vector.eli +20 -0
- package/dist/literal-sources/runtime/literals.eli +23 -0
- package/dist/literal-sources/runtime/testing/value.eli +6 -0
- package/dist/literal-sources/runtime/wire/http-rpc.eli +362 -0
- package/dist/literal-sources/runtime/wire/markdown.eli +275 -0
- package/dist/literal-sources/runtime/wire/schema.eli +193 -0
- package/dist/literal-sources/stdlib/bit.eli +36 -0
- package/dist/literal-sources/stdlib/core/data.eli +306 -0
- package/dist/literal-sources/stdlib/core/object.eli +89 -0
- package/dist/literal-sources/stdlib/core/protocol.eli +451 -0
- package/dist/literal-sources/stdlib/core/set.eli +312 -0
- package/dist/literal-sources/stdlib/core/text.eli +103 -0
- package/dist/literal-sources/stdlib/managed-literal-protocols.eli +483 -0
- package/dist/literal-sources/stdlib/managed-literals.eli +1414 -0
- package/dist/literal-sources/stdlib/managed-queue-state.eli +65 -0
- package/dist/literal-sources/stdlib/managed-sorted-state.eli +233 -0
- package/dist/literal-sources/stdlib/managed-transient-state.eli +348 -0
- package/dist/literal-sources/stdlib/managed-value-state.eli +153 -0
- package/dist/literal-sources/stdlib/managed-vector-view-state.eli +102 -0
- package/dist/literal-sources/stdlib/persistent-list.eli +145 -0
- package/dist/literal-sources/stdlib/persistent-map.eli +724 -0
- package/dist/literal-sources/stdlib/persistent-set.eli +236 -0
- package/dist/literal-sources/stdlib/persistent-vector.eli +359 -0
- package/dist/literal-sources/stdlib/value.eli +325 -0
- package/dist/package.json +10 -0
- package/dist/runtime/math.mjs +1116 -0
- package/dist/runtime/math.mjs.macro-origins.json +1 -0
- package/dist/runtime/math.mjs.map +1 -0
- package/dist/runtime/unicode-case-data.mjs +10124 -0
- package/dist/runtime/unicode-case-data.mjs.macro-origins.json +1 -0
- package/dist/runtime/unicode-case-data.mjs.map +1 -0
- package/dist/runtime/unicode-case.mjs +280 -0
- package/dist/runtime/unicode-case.mjs.macro-origins.json +1 -0
- package/dist/runtime/unicode-case.mjs.map +1 -0
- package/dist/runtime.eli +30379 -0
- package/dist/stage3-release.json +1 -0
- package/editor/README.md +1 -1
- package/editor/eliscript-mode.el +1 -1
- package/editor/eliscript-repl.el +1 -1
- package/package.json +97 -10
- package/platform/http.mjs +20 -0
- package/runtime/array-text.mjs +159 -0
- package/runtime/core/map-internals.mjs +27 -9
- package/runtime/core/object-impl.mjs +26 -17
- package/runtime/core/object-impl.mjs.map +1 -1
- package/runtime/core/protocol-impl.mjs +682 -255
- package/runtime/core/protocol-impl.mjs.map +1 -1
- package/runtime/core/protocol.mjs +4 -0
- package/runtime/core/record.mjs +23 -2
- package/runtime/core/regex.mjs +4 -0
- package/runtime/core/sorted.mjs +53 -0
- package/runtime/core/text-impl.mjs +167 -48
- package/runtime/core/text-impl.mjs.map +1 -1
- package/runtime/core/type.mjs +75 -3
- package/runtime/core/vector.mjs +6 -0
- package/runtime/math.eli +429 -0
- package/runtime/math.mjs +1116 -0
- package/runtime/math.mjs.map +1 -0
- package/runtime/number-radix.mjs +105 -0
- package/runtime/unicode-case-data.eli +29 -0
- package/runtime/unicode-case-data.mjs +10124 -0
- package/runtime/unicode-case-data.mjs.map +1 -0
- package/runtime/unicode-case.eli +100 -0
- package/runtime/unicode-case.mjs +280 -0
- package/runtime/unicode-case.mjs.map +1 -0
- package/runtime/wire/http-rpc.mjs +168 -0
- package/runtime/wire/markdown.mjs +196 -0
- package/runtime/wire/schema.mjs +109 -0
- package/stdlib/README.md +54 -0
- package/stdlib/core/protocol.eli +81 -17
- package/stdlib/core/seq.eli +1 -1
- package/stdlib/core/zipper.eli +114 -47
- package/stdlib/gepo.eli +12 -0
- package/stdlib/interop/js.eli +56 -15
- package/stdlib/managed-literal-protocols.eli +483 -0
- package/stdlib/managed-literals.eli +1414 -0
- package/stdlib/managed-protocol-error.eli +32 -0
- package/stdlib/managed-queue-state.eli +65 -0
- package/stdlib/managed-runtime-collection-internals.eli +60 -0
- package/stdlib/managed-runtime-collection.eli +579 -0
- package/stdlib/managed-runtime-data-text.eli +290 -0
- package/stdlib/managed-runtime-data.eli +22 -0
- package/stdlib/managed-runtime-identifier.eli +44 -0
- package/stdlib/managed-runtime-lazy-sequence.eli +131 -0
- package/stdlib/managed-runtime-list.eli +19 -0
- package/stdlib/managed-runtime-literals.eli +23 -0
- package/stdlib/managed-runtime-map.eli +9 -0
- package/stdlib/managed-runtime-metadata-internals.eli +6 -0
- package/stdlib/managed-runtime-metadata.eli +23 -0
- package/stdlib/managed-runtime-object.eli +8 -0
- package/stdlib/managed-runtime-order.eli +123 -0
- package/stdlib/managed-runtime-persistent-kind.eli +28 -0
- package/stdlib/managed-runtime-protocol.eli +28 -0
- package/stdlib/managed-runtime-queue.eli +9 -0
- package/stdlib/managed-runtime-record.eli +191 -0
- package/stdlib/managed-runtime-regex.eli +158 -0
- package/stdlib/managed-runtime-sequence.eli +305 -0
- package/stdlib/managed-runtime-set-algebra.eli +28 -0
- package/stdlib/managed-runtime-set.eli +9 -0
- package/stdlib/managed-runtime-sorted.eli +408 -0
- package/stdlib/managed-runtime-text.eli +14 -0
- package/stdlib/managed-runtime-transducer.eli +268 -0
- package/stdlib/managed-runtime-transient.eli +17 -0
- package/stdlib/managed-runtime-truth.eli +4 -0
- package/stdlib/managed-runtime-type.eli +232 -0
- package/stdlib/managed-runtime-value-internals.eli +13 -0
- package/stdlib/managed-runtime-value.eli +19 -0
- package/stdlib/managed-runtime-vector.eli +20 -0
- package/stdlib/managed-sorted-state.eli +233 -0
- package/stdlib/managed-testing-value.eli +6 -0
- package/stdlib/managed-transient-state.eli +348 -0
- package/stdlib/managed-value-state.eli +153 -0
- package/stdlib/managed-vector-view-state.eli +102 -0
- package/stdlib/managed-wire-http-rpc.eli +362 -0
- package/stdlib/managed-wire-markdown.eli +275 -0
- package/stdlib/managed-wire-schema.eli +193 -0
- package/stdlib/mdp.eli +7 -0
- package/stdlib/mds.eli +4 -0
- package/stdlib/persistent-vector.eli +23 -6
- package/tools/acceptance/check-legacy.mjs +687 -0
- package/tools/acceptance/check.eli +431 -0
- package/tools/acceptance/compile-evidence.el +49 -0
- package/tools/acceptance/finalize-legacy.mjs +498 -0
- package/tools/acceptance/finalize.eli +270 -0
- package/tools/backends/benchmark.mjs +175 -0
- package/tools/backends/build.mjs +135 -0
- package/tools/backends/compile.mjs +94 -0
- package/tools/backends/compiler-bootstrap.mjs +1001 -0
- package/tools/backends/compiler-browser.mjs +361 -0
- package/tools/backends/compiler-build.mjs +1628 -0
- package/tools/backends/compiler-cli-legacy.mjs +334 -0
- package/tools/backends/compiler-cli.mjs +29 -0
- package/tools/backends/compiler-corpus-bit.mjs +234 -0
- package/tools/backends/compiler-corpus-cli-adapters-legacy.mjs +362 -0
- package/tools/backends/compiler-corpus-cli-adapters.mjs +247 -0
- package/tools/backends/compiler-corpus-debugging.mjs +221 -0
- package/tools/backends/compiler-corpus-emitter.mjs +324 -0
- package/tools/backends/compiler-corpus-evaluation-adapters.mjs +65 -0
- package/tools/backends/compiler-corpus-execution-legacy.mjs +769 -0
- package/tools/backends/compiler-corpus-execution.mjs +3324 -0
- package/tools/backends/compiler-corpus-fuzz.mjs +229 -0
- package/tools/backends/compiler-corpus-generations.mjs +208 -0
- package/tools/backends/compiler-corpus-host-context-legacy.mjs +114 -0
- package/tools/backends/compiler-corpus-host-context.mjs +550 -0
- package/tools/backends/compiler-corpus-identity-host.mjs +553 -0
- package/tools/backends/compiler-corpus-identity-value-adapters-legacy.mjs +298 -0
- package/tools/backends/compiler-corpus-identity-value-adapters.mjs +69 -0
- package/tools/backends/compiler-corpus-isolated-exports.mjs +21 -0
- package/tools/backends/compiler-corpus-legacy.mjs +1155 -0
- package/tools/backends/compiler-corpus-literal-provider.mjs +282 -0
- package/tools/backends/compiler-corpus-managed-adapters-legacy.mjs +334 -0
- package/tools/backends/compiler-corpus-managed-adapters.mjs +937 -0
- package/tools/backends/compiler-corpus-managed-cases.mjs +179 -0
- package/tools/backends/compiler-corpus-managed-fixtures-legacy.mjs +879 -0
- package/tools/backends/compiler-corpus-managed-fixtures.mjs +1287 -0
- package/tools/backends/compiler-corpus-matchers.mjs +173 -0
- package/tools/backends/compiler-corpus-original-program.mjs +612 -0
- package/tools/backends/compiler-corpus-process.mjs +765 -0
- package/tools/backends/compiler-corpus-program-driver.mjs +306 -0
- package/tools/backends/compiler-corpus-project-adapters-legacy.mjs +497 -0
- package/tools/backends/compiler-corpus-project-adapters.mjs +340 -0
- package/tools/backends/compiler-corpus-project-entry-host.mjs +511 -0
- package/tools/backends/compiler-corpus-project-transport.mjs +151 -0
- package/tools/backends/compiler-corpus-raw-fixture-observer.mjs +1438 -0
- package/tools/backends/compiler-corpus-raw-language-fixtures.mjs +1456 -0
- package/tools/backends/compiler-corpus-raw-math-fixture.mjs +346 -0
- package/tools/backends/compiler-corpus-raw-special-fixtures.mjs +523 -0
- package/tools/backends/compiler-corpus-reference-legacy.mjs +263 -0
- package/tools/backends/compiler-corpus-reference.mjs +241 -0
- package/tools/backends/compiler-corpus-runtime-adapters-legacy.mjs +843 -0
- package/tools/backends/compiler-corpus-runtime-adapters.mjs +663 -0
- package/tools/backends/compiler-corpus-source-archive.mjs +206 -0
- package/tools/backends/compiler-corpus-tools-artifact-adapters.mjs +410 -0
- package/tools/backends/compiler-corpus-tools-cli.mjs +363 -0
- package/tools/backends/compiler-corpus-tools-reference.mjs +264 -0
- package/tools/backends/compiler-corpus.mjs +2054 -0
- package/tools/backends/compiler-debug.mjs +142 -0
- package/tools/backends/compiler-matrix.mjs +1955 -0
- package/tools/backends/compiler-metadata.mjs +203 -0
- package/tools/backends/compiler-package-browser.mjs +120 -0
- package/tools/backends/compiler-package-legacy.mjs +654 -0
- package/tools/backends/compiler-package.mjs +464 -0
- package/tools/backends/compiler-project.mjs +126 -0
- package/tools/backends/compiler-session.mjs +843 -0
- package/tools/backends/compiler-sha256.mjs +152 -0
- package/tools/backends/compiler-unicode-profile-host.mjs +196 -0
- package/tools/backends/compiler-worker.mjs +573 -0
- package/tools/backends/dist/bootstrap-js-stages.mjs +919 -0
- package/tools/backends/dist/bootstrap-js-stages.mjs.map +1 -0
- package/tools/backends/dist/managed-ir-inventory.mjs +488 -0
- package/tools/backends/dist/managed-ir-inventory.mjs.map +1 -0
- package/tools/backends/dist/record-grid.mjs +1256 -0
- package/tools/backends/dist/record-grid.mjs.map +1 -0
- package/tools/backends/dist/release-cli.mjs +460 -0
- package/tools/backends/dist/release-cli.mjs.map +1 -0
- package/tools/backends/dist/run-artifact.mjs +517 -0
- package/tools/backends/dist/run-artifact.mjs.map +1 -0
- package/tools/backends/eliscript/compiler-corpus-bit.eli +77 -0
- package/tools/backends/eliscript/compiler-corpus-debugging.eli +70 -0
- package/tools/backends/eliscript/compiler-corpus-project-entry-host.eli +256 -0
- package/tools/backends/managed-foreign-binding.mjs +497 -0
- package/tools/backends/managed-host-legacy.mjs +1181 -0
- package/tools/backends/managed-host-lifecycle.mjs +310 -0
- package/tools/backends/managed-host-object-provider.mjs +155 -0
- package/tools/backends/managed-host-object-realm.mjs +797 -0
- package/tools/backends/managed-host-proxy.mjs +71 -0
- package/tools/backends/managed-host-runtime.mjs +5868 -0
- package/tools/backends/managed-host.mjs +716 -0
- package/tools/backends/managed-module-graph-legacy.mjs +308 -0
- package/tools/backends/managed-module-graph.mjs +694 -0
- package/tools/backends/managed-runtime-host-legacy.mjs +195 -0
- package/tools/backends/managed-runtime.mjs +939 -0
- package/tools/backends/managed-source-view-legacy.mjs +332 -0
- package/tools/backends/managed-source-view.mjs +959 -0
- package/tools/backends/memory-runtime.mjs +100 -0
- package/tools/backends/native-benchmark.mjs +88 -0
- package/tools/backends/native-managed-runtime.mjs +677 -0
- package/tools/backends/native-memory.mjs +768 -0
- package/tools/backends/native-node-memory.mjs +142 -0
- package/tools/backends/native-node-runner.mjs +99 -0
- package/tools/backends/native-node-watchdog.mjs +19 -0
- package/tools/backends/native-node-worker.mjs +75 -0
- package/tools/backends/stage3-targets.mjs +486 -0
- package/tools/bootstrap-command.el +13 -0
- package/tools/bootstrap-runtime.el +101 -0
- package/tools/bootstrap-seed.el +55 -0
- package/tools/project/check-cli.eli +31 -0
- package/tools/project/project-cli.eli +42 -0
- package/tools/project/project.eli +122 -0
- package/tools/runtime/unicode-case-profiles.mjs +13 -0
- package/tools/runtime/unicode-case-runtime.el +57 -0
- package/tools/testing/source-debugging-corpus-host.eli +16 -0
- package/tools/testing/source-debugging.eli +139 -0
- package/tools/testing/stdlib-bit-corpus-host.eli +21 -0
- package/tools/testing/stdlib-bit-corpus-host.mjs +118 -0
- package/tools/testing/stdlib-bit.eli +104 -0
- package/tools/testing/stdlib-bit.mjs +255 -0
- package/bin/eliscript-bootstrap +0 -15
|
@@ -0,0 +1,498 @@
|
|
|
1
|
+
|
|
2
|
+
import { createHash } from "node:crypto";
|
|
3
|
+
import { mkdir, readFile, stat, writeFile } from "node:fs/promises";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import process from "node:process";
|
|
6
|
+
import { fileURLToPath } from "node:url";
|
|
7
|
+
|
|
8
|
+
import { verifyAcceptanceRun } from "./check.mjs";
|
|
9
|
+
import { validateRefreshedWorkerSoak } from "./retained-soak.mjs";
|
|
10
|
+
import { validateRefreshedTransientBuilder } from "./retained-transient.mjs";
|
|
11
|
+
|
|
12
|
+
const TOOL_DIRECTORY = path.dirname(fileURLToPath(import.meta.url));
|
|
13
|
+
export const DEFAULT_ROOT = path.resolve(TOOL_DIRECTORY, "../..");
|
|
14
|
+
const CONTRACT_FILE = "contracts/final-acceptance.json";
|
|
15
|
+
const EXPECTED_SOURCE = {
|
|
16
|
+
run: "acceptance/runs/m13-01.json",
|
|
17
|
+
report: "acceptance/runs/m13-01.md",
|
|
18
|
+
};
|
|
19
|
+
const EXPECTED_OUTPUTS = {
|
|
20
|
+
manifest: "acceptance/manifest.json",
|
|
21
|
+
report: "acceptance/report.md",
|
|
22
|
+
};
|
|
23
|
+
const EXPECTED_GROUPS = ["benchmark", "fuzz", "scale", "soak", "test"];
|
|
24
|
+
const DEFECT_CLASSES = new Set([
|
|
25
|
+
"bootstrap",
|
|
26
|
+
"compatibility",
|
|
27
|
+
"correctness",
|
|
28
|
+
"data-loss",
|
|
29
|
+
"security",
|
|
30
|
+
]);
|
|
31
|
+
|
|
32
|
+
export class FinalAcceptanceError extends Error {
|
|
33
|
+
constructor(errors) {
|
|
34
|
+
super(`final acceptance validation failed:\n- ${errors.join("\n- ")}`);
|
|
35
|
+
this.name = "FinalAcceptanceError";
|
|
36
|
+
this.errors = errors;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function isPlainObject(value) {
|
|
41
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function equal(left, right) {
|
|
45
|
+
return JSON.stringify(left) === JSON.stringify(right);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function sha256(value) {
|
|
49
|
+
return createHash("sha256").update(value).digest("hex");
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function safeRelativePath(value) {
|
|
53
|
+
return typeof value === "string" && value.length > 0 &&
|
|
54
|
+
!path.isAbsolute(value) && !value.split("/").includes("..") &&
|
|
55
|
+
path.posix.normalize(value) === value;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function sortedUniqueStrings(values) {
|
|
59
|
+
return Array.isArray(values) && values.length > 0 &&
|
|
60
|
+
values.every((value) => typeof value === "string" && value.length > 0) &&
|
|
61
|
+
new Set(values).size === values.length &&
|
|
62
|
+
equal(values, [...values].sort());
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
async function readJson(root, file) {
|
|
66
|
+
return JSON.parse(await readFile(path.join(root, file), "utf8"));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
async function regularFile(root, file) {
|
|
70
|
+
try {
|
|
71
|
+
return (await stat(path.join(root, file))).isFile();
|
|
72
|
+
} catch {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export async function validateFinalAcceptanceContract(contract, run, options = {}) {
|
|
78
|
+
const root = path.resolve(options.root ?? DEFAULT_ROOT);
|
|
79
|
+
const errors = [];
|
|
80
|
+
if (!isPlainObject(contract) || contract.schemaVersion !== 1 ||
|
|
81
|
+
contract.format !== "eliscript-final-acceptance-contract" ||
|
|
82
|
+
contract.version !== 1) {
|
|
83
|
+
throw new FinalAcceptanceError([
|
|
84
|
+
"contract must use eliscript-final-acceptance-contract version 1",
|
|
85
|
+
]);
|
|
86
|
+
}
|
|
87
|
+
if (!equal(contract.source, EXPECTED_SOURCE)) {
|
|
88
|
+
errors.push("contract source must identify the retained core run and report");
|
|
89
|
+
}
|
|
90
|
+
if (contract.defects !== "acceptance/defects.json") {
|
|
91
|
+
errors.push("contract defects must identify acceptance/defects.json");
|
|
92
|
+
}
|
|
93
|
+
if (!equal(contract.outputs, EXPECTED_OUTPUTS)) {
|
|
94
|
+
errors.push("contract outputs must be the canonical acceptance artifacts");
|
|
95
|
+
}
|
|
96
|
+
if (!equal(contract.blockingSeverities, [1, 2])) {
|
|
97
|
+
errors.push("blocking severities must be exactly 1 and 2");
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const groups = Array.isArray(contract.evidenceGroups)
|
|
101
|
+
? contract.evidenceGroups
|
|
102
|
+
: [];
|
|
103
|
+
if (!equal(groups.map((group) => group?.id), EXPECTED_GROUPS)) {
|
|
104
|
+
errors.push("evidence groups must be exactly benchmark fuzz scale soak and test");
|
|
105
|
+
}
|
|
106
|
+
const criterionIds = new Set(run.criteria.map((criterion) => criterion.id));
|
|
107
|
+
const runArtifacts = new Map(run.artifacts.map((artifact) => [
|
|
108
|
+
artifact.file,
|
|
109
|
+
artifact.sha256,
|
|
110
|
+
]));
|
|
111
|
+
for (const [index, group] of groups.entries()) {
|
|
112
|
+
const label = group?.id ?? `evidence group ${index}`;
|
|
113
|
+
if (!isPlainObject(group) || !sortedUniqueStrings(group.criteria) ||
|
|
114
|
+
!sortedUniqueStrings(group.artifacts)) {
|
|
115
|
+
errors.push(`${label} must declare sorted unique criteria and artifacts`);
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
if (group.criteria.includes("*") && !equal(group.criteria, ["*"])) {
|
|
119
|
+
errors.push(`${label} wildcard criterion must be the only criterion`);
|
|
120
|
+
}
|
|
121
|
+
for (const id of group.criteria) {
|
|
122
|
+
if (id !== "*" && !criterionIds.has(id)) {
|
|
123
|
+
errors.push(`${label} references unknown criterion ${id}`);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
for (const file of group.artifacts) {
|
|
127
|
+
if (!safeRelativePath(file)) {
|
|
128
|
+
errors.push(`${label} has unsafe artifact path ${JSON.stringify(file)}`);
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
if (!runArtifacts.has(file)) {
|
|
132
|
+
errors.push(`${label} artifact is not bound by the source run: ${file}`);
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
if (!await regularFile(root, file)) {
|
|
136
|
+
errors.push(`${label} artifact is missing: ${file}`);
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
const currentBytes = await readFile(path.join(root, file));
|
|
140
|
+
const digest = sha256(currentBytes);
|
|
141
|
+
if (digest !== runArtifacts.get(file)) {
|
|
142
|
+
const refreshOptions = {
|
|
143
|
+
deferPerformanceAcceptance: options.deferPerformanceAcceptance === true,
|
|
144
|
+
};
|
|
145
|
+
const recordRefresh = (result) => {
|
|
146
|
+
if (result !== true && Array.isArray(options.deferredPerformanceAcceptance) &&
|
|
147
|
+
!options.deferredPerformanceAcceptance.some((item) => item.report === result.report)) {
|
|
148
|
+
options.deferredPerformanceAcceptance.push(result);
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
if (file === "benchmarks/worker-lifecycle-soak-macos-arm64.json") {
|
|
152
|
+
try { recordRefresh(await validateRefreshedWorkerSoak(root, file, currentBytes, run, refreshOptions)); }
|
|
153
|
+
catch (error) { errors.push(`${label} artifact changed after the source run: ${file}: ${error.message}`); }
|
|
154
|
+
} else if (file === "benchmarks/transient-builder-macos-arm64.json") {
|
|
155
|
+
try { recordRefresh(await validateRefreshedTransientBuilder(root, file, currentBytes, run, refreshOptions)); }
|
|
156
|
+
catch (error) { errors.push(`${label} artifact changed after the source run: ${file}: ${error.message}`); }
|
|
157
|
+
} else {
|
|
158
|
+
errors.push(`${label} artifact changed after the source run: ${file}`);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
if (errors.length > 0) throw new FinalAcceptanceError(errors);
|
|
164
|
+
return contract;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export async function validateDefectRegister(register, options = {}) {
|
|
168
|
+
const root = path.resolve(options.root ?? DEFAULT_ROOT);
|
|
169
|
+
const errors = [];
|
|
170
|
+
if (!isPlainObject(register) || register.schemaVersion !== 1 ||
|
|
171
|
+
register.format !== "eliscript-acceptance-defect-register" ||
|
|
172
|
+
register.version !== 1 || !Array.isArray(register.unresolved)) {
|
|
173
|
+
throw new FinalAcceptanceError([
|
|
174
|
+
"defect register must use eliscript-acceptance-defect-register version 1",
|
|
175
|
+
]);
|
|
176
|
+
}
|
|
177
|
+
const ids = [];
|
|
178
|
+
for (const [index, defect] of register.unresolved.entries()) {
|
|
179
|
+
const label = defect?.id ?? `defect ${index}`;
|
|
180
|
+
if (!isPlainObject(defect) || !/^[A-Z][A-Z0-9-]+$/u.test(defect.id ?? "") ||
|
|
181
|
+
!Number.isInteger(defect.severity) || defect.severity < 1 ||
|
|
182
|
+
defect.severity > 4 || !DEFECT_CLASSES.has(defect.class) ||
|
|
183
|
+
typeof defect.title !== "string" || defect.title.length === 0 ||
|
|
184
|
+
!sortedUniqueStrings(defect.evidence)) {
|
|
185
|
+
errors.push(`${label} must declare id severity class title and evidence`);
|
|
186
|
+
continue;
|
|
187
|
+
}
|
|
188
|
+
ids.push(defect.id);
|
|
189
|
+
for (const file of defect.evidence) {
|
|
190
|
+
if (!safeRelativePath(file) || !await regularFile(root, file)) {
|
|
191
|
+
errors.push(`${label} has missing or unsafe evidence ${JSON.stringify(file)}`);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
if (new Set(ids).size !== ids.length || !equal(ids, [...ids].sort())) {
|
|
196
|
+
errors.push("unresolved defect ids must be unique and sorted");
|
|
197
|
+
}
|
|
198
|
+
if (errors.length > 0) throw new FinalAcceptanceError(errors);
|
|
199
|
+
return register;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
function resultCounts(criteria) {
|
|
203
|
+
const result = { pass: 0, incomplete: 0, fail: 0, total: criteria.length };
|
|
204
|
+
for (const criterion of criteria) result[criterion.result] += 1;
|
|
205
|
+
return result;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
function evidenceRecords(contract, run) {
|
|
209
|
+
const allCriteria = run.criteria.map((criterion) => criterion.id);
|
|
210
|
+
const criteria = new Map(run.criteria.map((criterion) => [
|
|
211
|
+
criterion.id,
|
|
212
|
+
criterion.result,
|
|
213
|
+
]));
|
|
214
|
+
const artifacts = new Map(run.artifacts.map((artifact) => [
|
|
215
|
+
artifact.file,
|
|
216
|
+
artifact.sha256,
|
|
217
|
+
]));
|
|
218
|
+
return contract.evidenceGroups.map((group) => {
|
|
219
|
+
const ids = equal(group.criteria, ["*"]) ? allCriteria : group.criteria;
|
|
220
|
+
return {
|
|
221
|
+
id: group.id,
|
|
222
|
+
complete: true,
|
|
223
|
+
criteria: ids.map((id) => ({ id, result: criteria.get(id) })),
|
|
224
|
+
artifacts: group.artifacts.map((file) => ({
|
|
225
|
+
file,
|
|
226
|
+
sha256: artifacts.get(file),
|
|
227
|
+
})),
|
|
228
|
+
};
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
export async function buildFinalAcceptance(options = {}) {
|
|
233
|
+
const root = path.resolve(options.root ?? DEFAULT_ROOT);
|
|
234
|
+
const contract = options.contract ?? await readJson(root, CONTRACT_FILE);
|
|
235
|
+
const run = options.run ?? await verifyAcceptanceRun(contract.source.run, {
|
|
236
|
+
root,
|
|
237
|
+
markdownFile: contract.source.report,
|
|
238
|
+
});
|
|
239
|
+
await validateFinalAcceptanceContract(contract, run, {
|
|
240
|
+
root,
|
|
241
|
+
deferPerformanceAcceptance: options.deferPerformanceAcceptance === true,
|
|
242
|
+
deferredPerformanceAcceptance: options.deferredPerformanceAcceptance,
|
|
243
|
+
});
|
|
244
|
+
const defects = await validateDefectRegister(
|
|
245
|
+
options.defects ?? await readJson(root, contract.defects),
|
|
246
|
+
{ root },
|
|
247
|
+
);
|
|
248
|
+
const sourceRunBytes = await readFile(path.join(root, contract.source.run));
|
|
249
|
+
const sourceReportBytes = await readFile(path.join(root, contract.source.report));
|
|
250
|
+
const defectBytes = options.defects
|
|
251
|
+
? Buffer.from(`${JSON.stringify(defects, null, 2)}\n`)
|
|
252
|
+
: await readFile(path.join(root, contract.defects));
|
|
253
|
+
const evidence = evidenceRecords(contract, run);
|
|
254
|
+
const contractBytes = await readFile(path.join(root, CONTRACT_FILE));
|
|
255
|
+
const blockingDefects = defects.unresolved.filter((defect) =>
|
|
256
|
+
contract.blockingSeverities.includes(defect.severity)).length;
|
|
257
|
+
const evidenceComplete = evidence.every((group) => group.complete);
|
|
258
|
+
const criteria = resultCounts(run.criteria);
|
|
259
|
+
return {
|
|
260
|
+
schemaVersion: 1,
|
|
261
|
+
format: "eliscript-1.0-acceptance-manifest",
|
|
262
|
+
version: 1,
|
|
263
|
+
generatedAt: run.generatedAt,
|
|
264
|
+
source: run.source,
|
|
265
|
+
environment: run.environment,
|
|
266
|
+
contract: {
|
|
267
|
+
file: CONTRACT_FILE,
|
|
268
|
+
sha256: sha256(contractBytes),
|
|
269
|
+
},
|
|
270
|
+
sourceRun: {
|
|
271
|
+
json: contract.source.run,
|
|
272
|
+
jsonSha256: sha256(sourceRunBytes),
|
|
273
|
+
markdown: contract.source.report,
|
|
274
|
+
markdownSha256: sha256(sourceReportBytes),
|
|
275
|
+
},
|
|
276
|
+
commands: run.commands,
|
|
277
|
+
criteria: run.criteria,
|
|
278
|
+
artifacts: run.artifacts,
|
|
279
|
+
evidence,
|
|
280
|
+
defects: {
|
|
281
|
+
register: contract.defects,
|
|
282
|
+
registerSha256: sha256(defectBytes),
|
|
283
|
+
blockingSeverities: contract.blockingSeverities,
|
|
284
|
+
unresolved: defects.unresolved,
|
|
285
|
+
blockingCount: blockingDefects,
|
|
286
|
+
},
|
|
287
|
+
applications: run.applications,
|
|
288
|
+
summary: {
|
|
289
|
+
criteria,
|
|
290
|
+
corpusComplete: run.summary.corpusComplete,
|
|
291
|
+
operationalSuccess: run.summary.operationalSuccess,
|
|
292
|
+
evidenceComplete,
|
|
293
|
+
blockingDefects,
|
|
294
|
+
acceptancePass: run.summary.acceptancePass && evidenceComplete &&
|
|
295
|
+
blockingDefects === 0,
|
|
296
|
+
},
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
function markdownCell(value) {
|
|
301
|
+
return String(value).replaceAll("|", "\\|").replaceAll("\n", " ");
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
export function humanFinalAcceptanceReport(manifest) {
|
|
305
|
+
const lines = [
|
|
306
|
+
"# Eliscript 1.0 Acceptance Report",
|
|
307
|
+
"",
|
|
308
|
+
`- Source commit: \`${manifest.source.commit}\``,
|
|
309
|
+
`- Source tree: \`${manifest.source.tree}\``,
|
|
310
|
+
`- Contract: \`${manifest.contract.file}\` (\`${manifest.contract.sha256}\`)`,
|
|
311
|
+
`- Generated: ${manifest.generatedAt}`,
|
|
312
|
+
`- Environment: ${manifest.environment.operatingSystem}; ${manifest.environment.architecture}; Bun ${manifest.environment.bunVersion}; Node ${manifest.environment.nodeVersion}; Emacs ${manifest.environment.emacsVersion}`,
|
|
313
|
+
`- Corpus complete: ${manifest.summary.corpusComplete ? "yes" : "no"}`,
|
|
314
|
+
`- Operational success: ${manifest.summary.operationalSuccess ? "yes" : "no"}`,
|
|
315
|
+
`- Evidence complete: ${manifest.summary.evidenceComplete ? "yes" : "no"}`,
|
|
316
|
+
`- Blocking defects: ${manifest.summary.blockingDefects}`,
|
|
317
|
+
`- Final acceptance: ${manifest.summary.acceptancePass ? "pass" : "not reached"}`,
|
|
318
|
+
"",
|
|
319
|
+
manifest.summary.acceptancePass
|
|
320
|
+
? "Every mandatory core criterion and final gate passed in the source run."
|
|
321
|
+
: "This is the canonical candidate report. It does not declare Eliscript 1.0 accepted while mandatory criteria remain incomplete.",
|
|
322
|
+
"",
|
|
323
|
+
"## Mandatory Criteria",
|
|
324
|
+
"",
|
|
325
|
+
`Results: ${manifest.summary.criteria.pass} pass, ${manifest.summary.criteria.incomplete} incomplete, ${manifest.summary.criteria.fail} fail, ${manifest.summary.criteria.total} total.`,
|
|
326
|
+
"",
|
|
327
|
+
"| Criterion | Result | Declared state | Remaining work |",
|
|
328
|
+
"| --- | --- | --- | --- |",
|
|
329
|
+
...manifest.criteria.map((criterion) =>
|
|
330
|
+
`| ${criterion.id} ${markdownCell(criterion.title)} | ${criterion.result} | ${criterion.declaredStatus} | ${markdownCell(criterion.remaining ?? "-")} |`),
|
|
331
|
+
"",
|
|
332
|
+
"## Evidence Summaries",
|
|
333
|
+
"",
|
|
334
|
+
"| Group | Complete | Criteria | Artifacts |",
|
|
335
|
+
"| --- | --- | ---: | ---: |",
|
|
336
|
+
...manifest.evidence.map((group) =>
|
|
337
|
+
`| ${group.id} | ${group.complete ? "yes" : "no"} | ${group.criteria.length} | ${group.artifacts.length} |`),
|
|
338
|
+
"",
|
|
339
|
+
"## Unresolved Defects",
|
|
340
|
+
"",
|
|
341
|
+
...(manifest.defects.unresolved.length === 0
|
|
342
|
+
? ["No unresolved defects are recorded."]
|
|
343
|
+
: [
|
|
344
|
+
"| ID | Severity | Class | Title |",
|
|
345
|
+
"| --- | ---: | --- | --- |",
|
|
346
|
+
...manifest.defects.unresolved.map((defect) =>
|
|
347
|
+
`| ${defect.id} | ${defect.severity} | ${defect.class} | ${markdownCell(defect.title)} |`),
|
|
348
|
+
]),
|
|
349
|
+
"",
|
|
350
|
+
"## Application Validation",
|
|
351
|
+
"",
|
|
352
|
+
"| Criterion | Result | Core contribution |",
|
|
353
|
+
"| --- | --- | --- |",
|
|
354
|
+
...manifest.applications.map((application) =>
|
|
355
|
+
`| ${application.id} ${markdownCell(application.title)} | ${application.result} | no |`),
|
|
356
|
+
"",
|
|
357
|
+
"## Commands",
|
|
358
|
+
"",
|
|
359
|
+
"| Probe | Command | Result | Exit | Duration (ms) | Output SHA-256 |",
|
|
360
|
+
"| --- | --- | --- | ---: | ---: | --- |",
|
|
361
|
+
...manifest.commands.map((command) =>
|
|
362
|
+
`| ${command.id} | \`${markdownCell(command.argv.join(" "))}\` | ${command.status} | ${command.exitCode} | ${command.durationMs} | \`${command.outputSha256}\` |`),
|
|
363
|
+
"",
|
|
364
|
+
"## Artifact Digests",
|
|
365
|
+
"",
|
|
366
|
+
"| File | SHA-256 |",
|
|
367
|
+
"| --- | --- |",
|
|
368
|
+
...manifest.artifacts.map((artifact) =>
|
|
369
|
+
`| \`${artifact.file}\` | \`${artifact.sha256}\` |`),
|
|
370
|
+
];
|
|
371
|
+
return `${lines.join("\n")}\n`;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
export function validateFinalManifest(manifest, expected) {
|
|
375
|
+
const errors = [];
|
|
376
|
+
if (!isPlainObject(manifest) || manifest.schemaVersion !== 1 ||
|
|
377
|
+
manifest.format !== "eliscript-1.0-acceptance-manifest" ||
|
|
378
|
+
manifest.version !== 1) {
|
|
379
|
+
errors.push("manifest must use eliscript-1.0-acceptance-manifest version 1");
|
|
380
|
+
}
|
|
381
|
+
if (!equal(manifest?.summary, expected.summary)) {
|
|
382
|
+
errors.push("final acceptance summary is not derived from its source evidence");
|
|
383
|
+
}
|
|
384
|
+
if (!equal(manifest, expected)) {
|
|
385
|
+
errors.push("final acceptance manifest does not match its verified source run");
|
|
386
|
+
}
|
|
387
|
+
if (errors.length > 0) throw new FinalAcceptanceError(errors);
|
|
388
|
+
return manifest;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
export async function generateFinalAcceptance(options = {}) {
|
|
392
|
+
if (options.deferPerformanceAcceptance === true) {
|
|
393
|
+
throw new FinalAcceptanceError([
|
|
394
|
+
"cannot generate acceptance artifacts while current performance acceptance is deferred",
|
|
395
|
+
]);
|
|
396
|
+
}
|
|
397
|
+
const root = path.resolve(options.root ?? DEFAULT_ROOT);
|
|
398
|
+
const contract = options.contract ?? await readJson(root, CONTRACT_FILE);
|
|
399
|
+
const manifest = await buildFinalAcceptance({ ...options, root, contract });
|
|
400
|
+
await mkdir(path.dirname(path.join(root, contract.outputs.manifest)), {
|
|
401
|
+
recursive: true,
|
|
402
|
+
});
|
|
403
|
+
await writeFile(
|
|
404
|
+
path.join(root, contract.outputs.manifest),
|
|
405
|
+
`${JSON.stringify(manifest, null, 2)}\n`,
|
|
406
|
+
);
|
|
407
|
+
await writeFile(
|
|
408
|
+
path.join(root, contract.outputs.report),
|
|
409
|
+
humanFinalAcceptanceReport(manifest),
|
|
410
|
+
);
|
|
411
|
+
return manifest;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
export async function verifyFinalAcceptance(options = {}) {
|
|
415
|
+
const root = path.resolve(options.root ?? DEFAULT_ROOT);
|
|
416
|
+
const contract = options.contract ?? await readJson(root, CONTRACT_FILE);
|
|
417
|
+
const expected = await buildFinalAcceptance({ ...options, root, contract });
|
|
418
|
+
const manifest = options.manifest ??
|
|
419
|
+
await readJson(root, contract.outputs.manifest);
|
|
420
|
+
validateFinalManifest(manifest, expected);
|
|
421
|
+
const markdown = options.markdown ??
|
|
422
|
+
await readFile(path.join(root, contract.outputs.report), "utf8");
|
|
423
|
+
if (markdown !== humanFinalAcceptanceReport(manifest)) {
|
|
424
|
+
throw new FinalAcceptanceError([
|
|
425
|
+
"human acceptance report does not match the machine-readable manifest",
|
|
426
|
+
]);
|
|
427
|
+
}
|
|
428
|
+
if (options.requirePass && !manifest.summary.acceptancePass) {
|
|
429
|
+
throw new FinalAcceptanceError([
|
|
430
|
+
"the canonical artifacts are valid, but final acceptance has not been reached",
|
|
431
|
+
]);
|
|
432
|
+
}
|
|
433
|
+
if (options.requirePass && options.deferPerformanceAcceptance === true) {
|
|
434
|
+
throw new FinalAcceptanceError([
|
|
435
|
+
"current performance acceptance is deferred and has not passed",
|
|
436
|
+
]);
|
|
437
|
+
}
|
|
438
|
+
return manifest;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
export function humanFinalAcceptanceSummary(manifest) {
|
|
442
|
+
return [
|
|
443
|
+
`Final acceptance artifacts: ${manifest.source.commit}`,
|
|
444
|
+
`Criteria: ${manifest.summary.criteria.pass}/${manifest.summary.criteria.total} pass, ${manifest.summary.criteria.incomplete} incomplete, ${manifest.summary.criteria.fail} fail`,
|
|
445
|
+
`Evidence groups: ${manifest.evidence.length}/${manifest.evidence.length} complete`,
|
|
446
|
+
`Blocking defects: ${manifest.summary.blockingDefects}`,
|
|
447
|
+
`Final acceptance: ${manifest.summary.acceptancePass ? "pass" : "not reached"}`,
|
|
448
|
+
].join("\n");
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
function parseArguments(argv) {
|
|
452
|
+
const options = {};
|
|
453
|
+
for (const argument of argv) {
|
|
454
|
+
if (argument === "--generate") options.generate = true;
|
|
455
|
+
else if (argument === "--verify") options.verify = true;
|
|
456
|
+
else if (argument === "--require-pass") options.requirePass = true;
|
|
457
|
+
else throw new FinalAcceptanceError([`unknown argument ${argument}`]);
|
|
458
|
+
}
|
|
459
|
+
if (options.generate === options.verify) {
|
|
460
|
+
throw new FinalAcceptanceError([
|
|
461
|
+
"choose exactly one of --generate or --verify",
|
|
462
|
+
]);
|
|
463
|
+
}
|
|
464
|
+
return options;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
async function main() {
|
|
468
|
+
const options = parseArguments(process.argv.slice(2));
|
|
469
|
+
options.deferPerformanceAcceptance = process.env.ELISCRIPT_DEFER_PERFORMANCE_ACCEPTANCE === "1";
|
|
470
|
+
options.deferredPerformanceAcceptance = [];
|
|
471
|
+
const manifest = options.generate
|
|
472
|
+
? await generateFinalAcceptance(options)
|
|
473
|
+
: await verifyFinalAcceptance(options);
|
|
474
|
+
const summary = humanFinalAcceptanceSummary(manifest);
|
|
475
|
+
process.stdout.write(`${options.deferPerformanceAcceptance
|
|
476
|
+
? summary.replace(/^Final acceptance:/mu, "Historical final acceptance:")
|
|
477
|
+
: summary}\n`);
|
|
478
|
+
if (options.deferPerformanceAcceptance) {
|
|
479
|
+
process.stdout.write("Current performance acceptance: DEFERRED / NOT ACCEPTED\n");
|
|
480
|
+
for (const item of options.deferredPerformanceAcceptance) {
|
|
481
|
+
process.stdout.write(` ${item.report}: measured Git snapshot ${item.measuredSource.commit} verified; current source comparison not performed\n`);
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
if (options.requirePass && !manifest.summary.acceptancePass) {
|
|
485
|
+
throw new FinalAcceptanceError([
|
|
486
|
+
"the canonical artifacts are valid, but final acceptance has not been reached",
|
|
487
|
+
]);
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
if (import.meta.main) {
|
|
492
|
+
try {
|
|
493
|
+
await main();
|
|
494
|
+
} catch (error) {
|
|
495
|
+
process.stderr.write(`${error.stack ?? error}\n`);
|
|
496
|
+
process.exitCode = 1;
|
|
497
|
+
}
|
|
498
|
+
}
|