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.
- package/README.md +61 -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.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 +732 -11
- package/browser/worker.mjs +6 -3
- 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 +1078 -0
- package/dist/browser/loader.js +1 -0
- package/dist/browser/loader.mjs +231 -0
- package/dist/browser/worker.mjs +63 -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 +639 -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 +40 -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 +25 -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 +494 -0
- package/dist/literal-sources/stdlib/managed-literals.eli +1469 -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 +106 -11
- 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 +172 -72
- package/stdlib/gepo.eli +12 -0
- package/stdlib/interop/js.eli +56 -15
- package/stdlib/managed-literal-protocols.eli +494 -0
- package/stdlib/managed-literals.eli +1469 -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 +639 -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 +40 -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 +25 -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 +462 -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 +493 -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,153 @@
|
|
|
1
|
+
(module eliscript.managed-value-state
|
|
2
|
+
(import-portable "./bit.eli" rotate-left)
|
|
3
|
+
|
|
4
|
+
(defvar protocol-hashes (new globalThis/WeakMap))
|
|
5
|
+
(defvar host-object-hashes (new globalThis/WeakMap))
|
|
6
|
+
(defvar host-symbol-hashes (new globalThis/Map))
|
|
7
|
+
(defvar next-host-identity 1)
|
|
8
|
+
(defconst metrics (js-object :hashValueCalls 0 :protocolHashComputations 0
|
|
9
|
+
:protocolHashCacheHits 0 :hostIdentityAssignments 0))
|
|
10
|
+
(defun callable? (value) (= (js* "typeof value") "function"))
|
|
11
|
+
(defun object? (value)
|
|
12
|
+
(and (not (nil? value)) (or (= (js* "typeof value") "object") (callable? value))))
|
|
13
|
+
(defun fail (message) (throw (new globalThis/TypeError message)))
|
|
14
|
+
(defun numberPrimitive (value)
|
|
15
|
+
(if (not (object? value)) value
|
|
16
|
+
(let ((exotic (aref value (get globalThis/Symbol :toPrimitive))))
|
|
17
|
+
(if (not (nullish? exotic))
|
|
18
|
+
(progn
|
|
19
|
+
(unless (callable? exotic) (fail "Symbol.toPrimitive must be callable"))
|
|
20
|
+
(let ((primitive (js-call exotic :call value "number")))
|
|
21
|
+
(when (object? primitive) (fail "Cannot convert object to primitive value")) primitive))
|
|
22
|
+
(let ((names (js-array "valueOf" "toString")) (index 0) (found false) (primitive undefined))
|
|
23
|
+
(while (and (< index 2) (not found))
|
|
24
|
+
(let ((method (get value (get names index))))
|
|
25
|
+
(when (callable? method)
|
|
26
|
+
(setq primitive (js-call method :call value))
|
|
27
|
+
(unless (object? primitive) (setq found t))))
|
|
28
|
+
(setq index (1+ index)))
|
|
29
|
+
(unless found (fail "Cannot convert object to primitive value")) primitive)))))
|
|
30
|
+
(defun toNumber (value)
|
|
31
|
+
(let ((primitive (numberPrimitive value)))
|
|
32
|
+
(when (= (js* "typeof primitive") "bigint") (fail "Cannot convert a BigInt value to a number"))
|
|
33
|
+
(funcall globalThis/Number primitive)))
|
|
34
|
+
(defun avalancheHash (value)
|
|
35
|
+
(let ((hash (uint32 value)))
|
|
36
|
+
(setq hash (bit-xor hash (unsigned-bit-shift-right hash 16)))
|
|
37
|
+
(setq hash (imul32 hash 2246822507))
|
|
38
|
+
(setq hash (bit-xor hash (unsigned-bit-shift-right hash 13)))
|
|
39
|
+
(setq hash (imul32 hash 3266489909))
|
|
40
|
+
(uint32 (bit-xor hash (unsigned-bit-shift-right hash 16)))))
|
|
41
|
+
(defun mixHash (hash value)
|
|
42
|
+
(let ((mixed (imul32 (uint32 (bit-xor hash value)) 1540483477)))
|
|
43
|
+
(uint32 (bit-xor mixed (unsigned-bit-shift-right mixed 15)))))
|
|
44
|
+
(defun finishHash (hash count) (avalancheHash (mixHash hash (uint32 count))))
|
|
45
|
+
(defun hashString (value &rest tags)
|
|
46
|
+
(let* ((tag (if (or (= (js-length tags) 0) (undefined? (aref tags 0)))
|
|
47
|
+
1831565813 (aref tags 0)))
|
|
48
|
+
(hash (mixHash tag (aref value "length"))) (index 0))
|
|
49
|
+
(while (< index (aref value "length"))
|
|
50
|
+
(setq hash (mixHash hash (js-call value :charCodeAt index)) index (1+ index)))
|
|
51
|
+
(finishHash hash (aref value "length"))))
|
|
52
|
+
(defun hashNumber (value)
|
|
53
|
+
(if (funcall globalThis/Boolean (Number/isNaN value)) 1490037359
|
|
54
|
+
(let* ((normalized (if (= value 0) 0 value))
|
|
55
|
+
(words (number-float64-words (toNumber normalized))))
|
|
56
|
+
(finishHash (mixHash (mixHash 374761393 (get words 0)) (get words 1)) 2))))
|
|
57
|
+
(defun hashBigInt (value)
|
|
58
|
+
(let* ((zero (funcall globalThis/BigInt "0")) (base (funcall globalThis/BigInt "4294967296"))
|
|
59
|
+
(negative (< value zero)) (magnitude (if negative (- value) value))
|
|
60
|
+
(hash (mixHash 2017827537 (if negative 1 0))) (limbs 0) (complete false))
|
|
61
|
+
(while (not complete)
|
|
62
|
+
(setq hash (mixHash hash (funcall globalThis/Number (% magnitude base)))
|
|
63
|
+
magnitude (/ magnitude base) limbs (1+ limbs) complete (= magnitude zero)))
|
|
64
|
+
(finishHash hash limbs)))
|
|
65
|
+
(defun hashBoolean (value) (mixHash 1260232563 (if (funcall globalThis/Boolean value) 1911856395 423263297)))
|
|
66
|
+
(defun hashNull () 1108378657)
|
|
67
|
+
(defun hashUndefined () 2135587861)
|
|
68
|
+
(defun hashGlobalSymbol (key) (hashString key 2657455275))
|
|
69
|
+
(defun walkIterable (iterable visit)
|
|
70
|
+
(let* ((iterator (js-call (aref iterable (get globalThis/Symbol :iterator)) :call iterable))
|
|
71
|
+
(next nil) (complete false) (active false))
|
|
72
|
+
(unless (object? iterator) (fail "iterator must be an object"))
|
|
73
|
+
(setq next (aref iterator "next"))
|
|
74
|
+
(try
|
|
75
|
+
(while (not complete)
|
|
76
|
+
(setq active false)
|
|
77
|
+
(let ((step (js-call next :call iterator)))
|
|
78
|
+
(unless (object? step) (fail "iterator result must be an object"))
|
|
79
|
+
(if (funcall globalThis/Boolean (aref step "done")) (setq complete t)
|
|
80
|
+
(let ((value (aref step "value")))
|
|
81
|
+
(setq active t) (funcall visit value)))))
|
|
82
|
+
(catch error
|
|
83
|
+
(when (and active (not complete))
|
|
84
|
+
(try
|
|
85
|
+
(let ((close (get iterator :return)))
|
|
86
|
+
(unless (nullish? close) (js-call close :call iterator)))
|
|
87
|
+
(catch close-error nil)))
|
|
88
|
+
(throw error)))))
|
|
89
|
+
(defun orderedCollectionHash (iterable hashValue tag)
|
|
90
|
+
(let ((hash (uint32 tag)) (count 0))
|
|
91
|
+
(walkIterable iterable (lambda (value)
|
|
92
|
+
(setq hash (mixHash hash (funcall hashValue value)) count (1+ count))))
|
|
93
|
+
(finishHash hash count)))
|
|
94
|
+
(defun unorderedCollectionHash (iterable hashElement tag)
|
|
95
|
+
(let ((sum 0) (xor 0) (product 1) (count 0))
|
|
96
|
+
(walkIterable iterable (lambda (value)
|
|
97
|
+
(let ((hash (uint32 (funcall hashElement value))))
|
|
98
|
+
(setq sum (uint32 (+ sum hash))
|
|
99
|
+
xor (uint32 (bit-xor xor (rotate-left hash (bit-and hash 31))))
|
|
100
|
+
product (uint32 (imul32 product (bit-or hash 1))) count (1+ count)))))
|
|
101
|
+
(finishHash (mixHash (mixHash (mixHash tag sum) xor) product) count)))
|
|
102
|
+
(defun cachedProtocolHash (value compute)
|
|
103
|
+
(let ((cached (js-call protocol-hashes :get value)))
|
|
104
|
+
(if (not (undefined? cached))
|
|
105
|
+
(progn (put metrics :protocolHashCacheHits (1+ (get metrics :protocolHashCacheHits))) cached)
|
|
106
|
+
(progn
|
|
107
|
+
(put metrics :protocolHashComputations (1+ (get metrics :protocolHashComputations)))
|
|
108
|
+
(let ((hash (uint32 (funcall compute))))
|
|
109
|
+
(js-call protocol-hashes :set value hash) hash)))))
|
|
110
|
+
(defun recordHashValueCall ()
|
|
111
|
+
(put metrics :hashValueCalls (1+ (get metrics :hashValueCalls))) undefined)
|
|
112
|
+
(defun hostIdentityHash (value)
|
|
113
|
+
(let* ((hashes (if (= (js* "typeof value") "symbol") host-symbol-hashes host-object-hashes))
|
|
114
|
+
(cached (js-call hashes :get value)))
|
|
115
|
+
(if (not (undefined? cached)) cached
|
|
116
|
+
(let ((hash (finishHash 762272397 next-host-identity)))
|
|
117
|
+
(setq next-host-identity (1+ next-host-identity))
|
|
118
|
+
(put metrics :hostIdentityAssignments (1+ (get metrics :hostIdentityAssignments)))
|
|
119
|
+
(js-call hashes :set value hash) hash))))
|
|
120
|
+
(defun resetValueMetrics ()
|
|
121
|
+
(put metrics :hashValueCalls 0)
|
|
122
|
+
(put metrics :protocolHashComputations 0)
|
|
123
|
+
(put metrics :protocolHashCacheHits 0)
|
|
124
|
+
(put metrics :hostIdentityAssignments 0)
|
|
125
|
+
undefined)
|
|
126
|
+
(defun clearValueCaches ()
|
|
127
|
+
(setq protocol-hashes (new globalThis/WeakMap)
|
|
128
|
+
host-object-hashes (new globalThis/WeakMap)
|
|
129
|
+
host-symbol-hashes (new globalThis/Map)
|
|
130
|
+
next-host-identity 1)
|
|
131
|
+
(resetValueMetrics))
|
|
132
|
+
(defun readValueMetrics ()
|
|
133
|
+
(Object/freeze (js-object :hashValueCalls (get metrics :hashValueCalls)
|
|
134
|
+
:protocolHashComputations (get metrics :protocolHashComputations)
|
|
135
|
+
:protocolHashCacheHits (get metrics :protocolHashCacheHits)
|
|
136
|
+
:hostIdentityAssignments (get metrics :hostIdentityAssignments))))
|
|
137
|
+
(defun hashPrimitiveValue (value)
|
|
138
|
+
(let ((type (js* "typeof value")))
|
|
139
|
+
(cond ((nil? value) (hashNull))
|
|
140
|
+
((= type "undefined") (hashUndefined))
|
|
141
|
+
((= type "boolean") (hashBoolean value))
|
|
142
|
+
((= type "number") (hashNumber value))
|
|
143
|
+
((= type "bigint") (hashBigInt value))
|
|
144
|
+
((= type "string") (hashString value))
|
|
145
|
+
((= type "symbol")
|
|
146
|
+
(let ((key (js-call globalThis/Symbol :keyFor value)))
|
|
147
|
+
(if (undefined? key) (hostIdentityHash value) (hashGlobalSymbol key))))
|
|
148
|
+
((or (= type "object") (= type "function")) (hostIdentityHash value))
|
|
149
|
+
(t (fail (str "cannot hash JavaScript value of type " type))))))
|
|
150
|
+
(Object/defineProperty hashString "length" (js-object :value 1 :configurable t))
|
|
151
|
+
(export avalancheHash mixHash finishHash hashString hashNumber hashBigInt hashBoolean hashNull hashUndefined hashGlobalSymbol
|
|
152
|
+
orderedCollectionHash unorderedCollectionHash cachedProtocolHash recordHashValueCall hostIdentityHash
|
|
153
|
+
resetValueMetrics clearValueCaches readValueMetrics hashPrimitiveValue))
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
(module eliscript.managed-vector-view-state
|
|
2
|
+
(import-portable "./persistent-vector.eli"
|
|
3
|
+
empty-persistent-vector persistent-vector? persistent-vector-count
|
|
4
|
+
persistent-vector-nth persistent-vector-assoc persistent-vector-conj
|
|
5
|
+
persistent-vector-with-meta)
|
|
6
|
+
|
|
7
|
+
;; Private range storage. Frozen public SubVector objects and their brands
|
|
8
|
+
;; are created by the literal adapter, never by accepting these record keys.
|
|
9
|
+
(defportable managed-vector-view-state? (value)
|
|
10
|
+
(and (not (nullish? value)) (= (get value :kind nil) "managed-vector-view")))
|
|
11
|
+
|
|
12
|
+
(defportable managed-vector-view-state-make (vector start end metadata)
|
|
13
|
+
(js-object :kind "managed-vector-view" :vector vector :start start :end end :metadata metadata))
|
|
14
|
+
|
|
15
|
+
(defportable managed-vector-view-state-vector (view) (get view :vector))
|
|
16
|
+
(defportable managed-vector-view-state-start (view) (get view :start))
|
|
17
|
+
(defportable managed-vector-view-state-end (view) (get view :end))
|
|
18
|
+
(defportable managed-vector-view-state-count (view) (- (get view :end) (get view :start)))
|
|
19
|
+
(defportable managed-vector-view-state-meta (view) (get view :metadata))
|
|
20
|
+
|
|
21
|
+
(defportable managed-vector-view-state-valid-index? (index count inclusive)
|
|
22
|
+
(and (= (value-type index) "number")
|
|
23
|
+
(>= index -9007199254740991) (<= index 9007199254740991)
|
|
24
|
+
(= (% index 1) 0) (>= index 0)
|
|
25
|
+
(if inclusive (<= index count) (< index count))))
|
|
26
|
+
|
|
27
|
+
(defportable managed-vector-view-state-subvec (vector start end)
|
|
28
|
+
(let* ((view? (managed-vector-view-state? vector))
|
|
29
|
+
(valid? (or view? (persistent-vector? vector)))
|
|
30
|
+
(count (if view? (managed-vector-view-state-count vector)
|
|
31
|
+
(if valid? (persistent-vector-count vector) 0)))
|
|
32
|
+
(limit (if (nullish? end) count end)))
|
|
33
|
+
(if (or (not valid?)
|
|
34
|
+
(not (managed-vector-view-state-valid-index? start count t))
|
|
35
|
+
(not (managed-vector-view-state-valid-index? limit count t)) (< limit start))
|
|
36
|
+
nil
|
|
37
|
+
;; subvec creates a new unannotated view, including when its source is
|
|
38
|
+
;; itself annotated. Nested views share the original underlying trie.
|
|
39
|
+
(if view?
|
|
40
|
+
(managed-vector-view-state-make (get vector :vector)
|
|
41
|
+
(+ (get vector :start) start) (+ (get vector :start) limit) nil)
|
|
42
|
+
(managed-vector-view-state-make vector start limit nil)))))
|
|
43
|
+
|
|
44
|
+
(defportable managed-vector-view-state-with-meta (view metadata)
|
|
45
|
+
(if (eq metadata (get view :metadata)) view
|
|
46
|
+
(managed-vector-view-state-make (get view :vector) (get view :start) (get view :end) metadata)))
|
|
47
|
+
|
|
48
|
+
(defportable managed-vector-view-state-nth (view index not-found)
|
|
49
|
+
(if (managed-vector-view-state-valid-index? index (managed-vector-view-state-count view) false)
|
|
50
|
+
(persistent-vector-nth (get view :vector) (+ (get view :start) index) not-found)
|
|
51
|
+
not-found))
|
|
52
|
+
|
|
53
|
+
(defportable managed-vector-view-state-assoc (view index value)
|
|
54
|
+
(let ((count (managed-vector-view-state-count view)))
|
|
55
|
+
(if (not (managed-vector-view-state-valid-index? index count t)) nil
|
|
56
|
+
(let* ((vector (get view :vector)) (absolute (+ (get view :start) index))
|
|
57
|
+
(next (if (= absolute (persistent-vector-count vector))
|
|
58
|
+
(persistent-vector-conj vector value)
|
|
59
|
+
(persistent-vector-assoc vector absolute value))))
|
|
60
|
+
(if (nil? next) nil
|
|
61
|
+
(managed-vector-view-state-make next (get view :start)
|
|
62
|
+
(if (> (1+ absolute) (get view :end)) (1+ absolute) (get view :end))
|
|
63
|
+
(get view :metadata)))))))
|
|
64
|
+
|
|
65
|
+
(defportable managed-vector-view-state-conj (view value)
|
|
66
|
+
(managed-vector-view-state-assoc view (managed-vector-view-state-count view) value))
|
|
67
|
+
|
|
68
|
+
(defportable managed-vector-view-state-peek (view not-found)
|
|
69
|
+
(if (= (get view :start) (get view :end)) not-found
|
|
70
|
+
(persistent-vector-nth (get view :vector) (1- (get view :end)) not-found)))
|
|
71
|
+
|
|
72
|
+
(defportable managed-vector-view-state-empty (view)
|
|
73
|
+
(persistent-vector-with-meta (empty-persistent-vector) (get view :metadata)))
|
|
74
|
+
|
|
75
|
+
(defportable managed-vector-view-state-pop (view)
|
|
76
|
+
(let ((count (managed-vector-view-state-count view)))
|
|
77
|
+
(if (= count 0) nil
|
|
78
|
+
(if (= count 1) (managed-vector-view-state-empty view)
|
|
79
|
+
(managed-vector-view-state-make (get view :vector) (get view :start)
|
|
80
|
+
(1- (get view :end)) (get view :metadata))))))
|
|
81
|
+
|
|
82
|
+
(defportable managed-vector-view-state-array-reverse (values)
|
|
83
|
+
(let ((result (js-array)) (index 0))
|
|
84
|
+
(while (< index (js-length values))
|
|
85
|
+
(setq result (js-cons (get values index) result) index (1+ index)))
|
|
86
|
+
result))
|
|
87
|
+
|
|
88
|
+
(defportable managed-vector-view-state-to-array (view)
|
|
89
|
+
(let ((values (js-array)) (index (get view :start))
|
|
90
|
+
(end (get view :end)) (vector (get view :vector)))
|
|
91
|
+
(while (< index end)
|
|
92
|
+
(setq values (js-cons (persistent-vector-nth vector index nil) values)
|
|
93
|
+
index (1+ index)))
|
|
94
|
+
(managed-vector-view-state-array-reverse values)))
|
|
95
|
+
|
|
96
|
+
(export managed-vector-view-state? managed-vector-view-state-make
|
|
97
|
+
managed-vector-view-state-vector managed-vector-view-state-start managed-vector-view-state-end
|
|
98
|
+
managed-vector-view-state-count managed-vector-view-state-meta managed-vector-view-state-subvec
|
|
99
|
+
managed-vector-view-state-valid-index? managed-vector-view-state-with-meta
|
|
100
|
+
managed-vector-view-state-nth managed-vector-view-state-assoc managed-vector-view-state-conj
|
|
101
|
+
managed-vector-view-state-peek managed-vector-view-state-empty managed-vector-view-state-pop
|
|
102
|
+
managed-vector-view-state-to-array))
|
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
(module eliscript.managed-wire-http-rpc
|
|
2
|
+
(import "../../platform/http.mjs" :as Host)
|
|
3
|
+
(import "../../stdlib/managed-literals.eli" literal-each)
|
|
4
|
+
|
|
5
|
+
(defconst media-type "text/markdown; charset=utf-8")
|
|
6
|
+
(defun truth (value) (funcall globalThis/Boolean value))
|
|
7
|
+
(defun coalesce (value fallback) (if (or (nil? value) (undefined? value)) fallback value))
|
|
8
|
+
(defun option (object key fallback)
|
|
9
|
+
(let ((value (get object key))) (if (undefined? value) (funcall fallback) value)))
|
|
10
|
+
(defun fail (message) (throw (new globalThis/TypeError message)))
|
|
11
|
+
(defun instance? (value constructor)
|
|
12
|
+
(unless (or (= (js* "typeof constructor") "function")
|
|
13
|
+
(and (not (nil? constructor)) (= (js* "typeof constructor") "object")))
|
|
14
|
+
(fail "Right-hand side of instanceof is not an object"))
|
|
15
|
+
(let ((method (get constructor (get globalThis/Symbol :hasInstance))))
|
|
16
|
+
(when (nullish? method)
|
|
17
|
+
(unless (= (js* "typeof constructor") "function")
|
|
18
|
+
(fail "Right-hand side of instanceof is not callable"))
|
|
19
|
+
(setq method (get (get globalThis/Function :prototype) (get globalThis/Symbol :hasInstance))))
|
|
20
|
+
(funcall globalThis/Boolean (Reflect/apply method constructor (js-array value)))))
|
|
21
|
+
(defun line (value)
|
|
22
|
+
(js-call (funcall globalThis/String value) :replace (new globalThis/RegExp "[\\r\\n]" "gu") " "))
|
|
23
|
+
(defun public-path (value)
|
|
24
|
+
(when (or (not (= (js* "typeof value") "string"))
|
|
25
|
+
(not (js-call value :startsWith "/"))
|
|
26
|
+
(js-call (new globalThis/RegExp "[\\s?#`\\\\]" "u") :test value)
|
|
27
|
+
(js-call value :includes "//")
|
|
28
|
+
(and (not (= value "/")) (js-call value :endsWith "/"))
|
|
29
|
+
(js-call (js-call value :split "/") :some (lambda (part) (or (= part ".") (= part ".."))))
|
|
30
|
+
(js-call (js-array "/.well-known/gepo" "/.gepo") :some
|
|
31
|
+
(lambda (prefix) (or (= value prefix) (js-call value :startsWith (str prefix "/")))))
|
|
32
|
+
(not (= (get (new (get Host/globals :URL) value "https://local.invalid") :pathname) value)))
|
|
33
|
+
(fail "Expected a canonical public operation path"))
|
|
34
|
+
value)
|
|
35
|
+
(defun abort-reason (signal)
|
|
36
|
+
(let ((reason (get signal :reason)))
|
|
37
|
+
(if (or (nil? reason) (undefined? reason)) (new globalThis/Error "HTTP request aborted") reason)))
|
|
38
|
+
(defun target (value)
|
|
39
|
+
(let ((url (new (get Host/globals :URL) value)))
|
|
40
|
+
(when (or (not (js-call (js-array "http:" "https:") :includes (get url :protocol)))
|
|
41
|
+
(truth (get url :username)) (truth (get url :password)))
|
|
42
|
+
(fail "Expected an HTTP URL without credentials"))
|
|
43
|
+
(put url :hash "") url))
|
|
44
|
+
(defun parent (value)
|
|
45
|
+
(if (= value "/") nil
|
|
46
|
+
(let ((part (js-call value :slice 0 (js-call value :lastIndexOf "/"))))
|
|
47
|
+
(if (= part "") "/" part))))
|
|
48
|
+
|
|
49
|
+
;; Object spread creates own data fields, including a literal __proto__ key.
|
|
50
|
+
(defun spread-into (result source)
|
|
51
|
+
(unless (or (nil? source) (undefined? source))
|
|
52
|
+
(let ((boxed (funcall globalThis/Object source)))
|
|
53
|
+
(literal-each (Reflect/ownKeys boxed)
|
|
54
|
+
(lambda (key)
|
|
55
|
+
(let ((descriptor (Object/getOwnPropertyDescriptor boxed key)))
|
|
56
|
+
(when (and (not (undefined? descriptor)) (truth (get descriptor :enumerable)))
|
|
57
|
+
(Object/defineProperty result key
|
|
58
|
+
(js-object :value (get boxed key) :writable t :enumerable t :configurable t))))))))
|
|
59
|
+
result)
|
|
60
|
+
(defun defineOperation (options)
|
|
61
|
+
(public-path (get options :path))
|
|
62
|
+
(let ((execute (get options :execute)))
|
|
63
|
+
(unless (= (js* "typeof execute") "function")
|
|
64
|
+
(fail "Operation requires an execute function")))
|
|
65
|
+
(Object/freeze (spread-into
|
|
66
|
+
(js-object :title (get options :path) :summary "Invoke this operation."
|
|
67
|
+
:contentType "application/json" :request "Body is service-defined."
|
|
68
|
+
:success "Use HTTP status and response representation." :failures (js-array)
|
|
69
|
+
:effect "Service-defined." :retry "No automatic POST retry.") options)))
|
|
70
|
+
(defun usageMarkdown (operation)
|
|
71
|
+
(public-path (get operation :path))
|
|
72
|
+
(str "# " (line (let ((title (get operation :title)))
|
|
73
|
+
(if (or (nil? title) (undefined? title)) (get operation :path) title)))
|
|
74
|
+
"\n\nPOST `" (get operation :path) "` with Content-Type: "
|
|
75
|
+
(line (coalesce (get operation :contentType) "application/json")) ".\n\nPurpose: "
|
|
76
|
+
(line (coalesce (get operation :summary) "")) "\nRequest: "
|
|
77
|
+
(line (coalesce (get operation :request) "Body is service-defined.")) "\nSuccess: "
|
|
78
|
+
(line (coalesce (get operation :success) "Use HTTP status and response representation.")) "\nFailures: "
|
|
79
|
+
(let ((failures (js-call (let ((value (get operation :failures)))
|
|
80
|
+
(if (or (nil? value) (undefined? value)) (js-array) value)) :join "; ")))
|
|
81
|
+
(line (if (truth failures) failures "Use applicable HTTP error statuses.")))
|
|
82
|
+
"\nEffect: " (line (coalesce (get operation :effect) "Service-defined."))
|
|
83
|
+
"\nRetry: " (line (coalesce (get operation :retry) "No automatic POST retry.")) "\n"))
|
|
84
|
+
(defun directory-node () (js-object :operation nil :children (new globalThis/Set)))
|
|
85
|
+
(defun tree (operations)
|
|
86
|
+
(let ((nodes (new globalThis/Map (js-array (js-array "/" (directory-node))))))
|
|
87
|
+
(literal-each operations
|
|
88
|
+
(lambda (operation)
|
|
89
|
+
(public-path (get operation :path))
|
|
90
|
+
(let ((existing (js-call nodes :get (get operation :path))))
|
|
91
|
+
(when (and (not (undefined? existing)) (truth (get existing :operation)))
|
|
92
|
+
(fail "Duplicate operation path")))
|
|
93
|
+
(unless (js-call nodes :has (get operation :path))
|
|
94
|
+
(js-call nodes :set (get operation :path) (directory-node)))
|
|
95
|
+
(put (js-call nodes :get (get operation :path)) :operation operation)
|
|
96
|
+
(let ((child (get operation :path)))
|
|
97
|
+
(while (not (nil? (parent child)))
|
|
98
|
+
(let ((directory (parent child)))
|
|
99
|
+
(unless (js-call nodes :has directory) (js-call nodes :set directory (directory-node)))
|
|
100
|
+
(js-call (get (js-call nodes :get directory) :children) :add child)
|
|
101
|
+
(setq child directory))))))
|
|
102
|
+
nodes))
|
|
103
|
+
(defun pathIndexMarkdown (title operations &rest optional-arguments)
|
|
104
|
+
(let ((location (aref optional-arguments 0)))
|
|
105
|
+
(when (undefined? location) (setq location "/"))
|
|
106
|
+
(public-path location)
|
|
107
|
+
(let* ((nodes (tree operations)) (node (js-call nodes :get location)))
|
|
108
|
+
(if (undefined? node) nil
|
|
109
|
+
(let* ((children (js-call (Array/from (get node :children)) :sort))
|
|
110
|
+
(kind (if (truth (get node :operation))
|
|
111
|
+
(if (> (js-length children) 0) "operation and directory" "operation") "directory"))
|
|
112
|
+
(result (str "# " (line (coalesce title "Service")) "\n\nGEPO 0.2\nPath: `" location
|
|
113
|
+
"`\nParent: " (if (nil? (parent location)) "none" (str "`" (parent location) "`"))
|
|
114
|
+
"\nKind: " kind "\n")))
|
|
115
|
+
(when (truth (get node :operation))
|
|
116
|
+
(setq result (str result "\n## Usage\n\n" (usageMarkdown (get node :operation)))))
|
|
117
|
+
(setq result (str result "\n## Children\n\n"))
|
|
118
|
+
(if (= (js-length children) 0)
|
|
119
|
+
(setq result (str result (if (truth (get node :operation))
|
|
120
|
+
"No immediate child paths.\n" "The visible capability set is empty.\n")))
|
|
121
|
+
(literal-each children
|
|
122
|
+
(lambda (child)
|
|
123
|
+
(let ((operation (get (js-call nodes :get child) :operation)))
|
|
124
|
+
(setq result (str result "- `" child "` — "
|
|
125
|
+
(line (if (or (nil? operation) (undefined? operation)) "Directory"
|
|
126
|
+
(coalesce (get operation :summary) "Directory"))) "\n"))))))
|
|
127
|
+
result)))))
|
|
128
|
+
(defun discoveryCandidates (value)
|
|
129
|
+
(let ((url (target value)))
|
|
130
|
+
(put url :search "")
|
|
131
|
+
(let* ((root (get url :origin)) (candidates (js-array)))
|
|
132
|
+
(unless (= (get url :pathname) "/") (js-call candidates :push (str (get url :href) "?.gepo")))
|
|
133
|
+
(js-call candidates :push (str root "/?.gepo") (str root "/.gepo") (str root "/.well-known/gepo"))
|
|
134
|
+
(Array/from (new globalThis/Set candidates)))))
|
|
135
|
+
(defun classifyDiscovery (response)
|
|
136
|
+
(if (or (< (get response :status) 200) (>= (get response :status) 300)
|
|
137
|
+
(not (truth (get response :contentType))))
|
|
138
|
+
(js-object :accepted false :paths (js-array) :empty false)
|
|
139
|
+
(let ((type (js-call (js-call (get (js-call (get response :contentType) :split ";") 0) :trim) :toLowerCase)))
|
|
140
|
+
(if (or (not (js-call (js-array "text/markdown" "text/plain") :includes type))
|
|
141
|
+
(not (js-call (new globalThis/RegExp "\\bGEPO\\b" "u") :test (get response :body))))
|
|
142
|
+
(js-object :accepted false :paths (js-array) :empty false)
|
|
143
|
+
(let* ((children (js-call (js-call (get response :body) :split
|
|
144
|
+
(new globalThis/RegExp "^## Children\\s*$" "mu")) :at -1))
|
|
145
|
+
(matches (Array/from (js-call children :matchAll
|
|
146
|
+
(new globalThis/RegExp "^\\s*-\\s+`(/[^`\\s]*)`" "gmu"))))
|
|
147
|
+
(paths (Array/from (new globalThis/Set (js-call matches :map (lambda (match) (get match 1)))))))
|
|
148
|
+
(when (and (= (js-length paths) 0)
|
|
149
|
+
(js-call (new globalThis/RegExp "^Path: `/`$" "mu") :test (get response :body))
|
|
150
|
+
(js-call (new globalThis/RegExp "^Kind: operation$" "mu") :test (get response :body)))
|
|
151
|
+
(js-call paths :push "/"))
|
|
152
|
+
(let ((empty (js-call (new globalThis/RegExp "visible capability set is empty|no visible (?:operations|capabilities)" "iu")
|
|
153
|
+
:test children)))
|
|
154
|
+
(js-object :accepted (or (> (js-length paths) 0) empty) :paths paths :empty empty)))))))
|
|
155
|
+
|
|
156
|
+
(defun object? (value)
|
|
157
|
+
(or (and (not (nil? value)) (= (js* "typeof value") "object"))
|
|
158
|
+
(= (js* "typeof value") "function")))
|
|
159
|
+
(defun iterator-close (iterator)
|
|
160
|
+
(let ((close (get iterator :return)))
|
|
161
|
+
(unless (or (nil? close) (undefined? close))
|
|
162
|
+
(let ((result (Reflect/apply close iterator (js-array))))
|
|
163
|
+
(unless (object? result) (fail "Iterator result is not an object"))))))
|
|
164
|
+
(defun iteration (iterable)
|
|
165
|
+
(let* ((method (get iterable (get globalThis/Symbol :iterator)))
|
|
166
|
+
(iterator (Reflect/apply method iterable (js-array))))
|
|
167
|
+
(unless (object? iterator) (fail "Iterator result is not an object"))
|
|
168
|
+
(js-object :iterator iterator :next (get iterator :next))))
|
|
169
|
+
(defun iteration-step (cursor)
|
|
170
|
+
(let ((step (Reflect/apply (get cursor :next) (get cursor :iterator) (js-array))))
|
|
171
|
+
(unless (object? step) (fail "Iterator result is not an object")) step))
|
|
172
|
+
(defun close-abrupt (cursor error)
|
|
173
|
+
(try (iterator-close (get cursor :iterator)) (catch ignored nil))
|
|
174
|
+
(throw error))
|
|
175
|
+
|
|
176
|
+
(defun markdown-response (body &rest optional-arguments)
|
|
177
|
+
(let ((status (aref optional-arguments 0)) (headers (aref optional-arguments 1)))
|
|
178
|
+
(when (undefined? status) (setq status 200))
|
|
179
|
+
(when (undefined? headers) (setq headers (js-object)))
|
|
180
|
+
(new (get Host/globals :Response) body
|
|
181
|
+
(js-object :status status :headers (spread-into
|
|
182
|
+
(js-object "Content-Type" media-type "Cache-Control" "private, no-store") headers)))))
|
|
183
|
+
(defun createService (&rest optional-arguments)
|
|
184
|
+
(let ((options (aref optional-arguments 0)))
|
|
185
|
+
(when (undefined? options) (setq options (js-object)))
|
|
186
|
+
(let* ((title (option options "title" (lambda () "Service")))
|
|
187
|
+
(operations (option options "operations" (lambda () (js-array))))
|
|
188
|
+
(authorize (option options "authorize" (lambda () (lambda () t))))
|
|
189
|
+
(visible (option options "visible" (lambda () (lambda () t))))
|
|
190
|
+
(entries (js-call operations :map defineOperation)))
|
|
191
|
+
(tree entries)
|
|
192
|
+
(async (request)
|
|
193
|
+
(let* ((url (new (get Host/globals :URL) (get request :url)))
|
|
194
|
+
(fixed-entry (js-call (js-array "/.gepo" "/.well-known/gepo") :includes (get url :pathname)))
|
|
195
|
+
(discovery (and (js-call (js-array "GET" "HEAD") :includes (get request :method))
|
|
196
|
+
(or (js-call (get url :searchParams) :has ".gepo") fixed-entry)))
|
|
197
|
+
(location (if fixed-entry "/" (get url :pathname)))
|
|
198
|
+
(available (js-array)))
|
|
199
|
+
(let ((cursor (iteration entries)) (done false))
|
|
200
|
+
(while (not done)
|
|
201
|
+
(let ((step (iteration-step cursor)))
|
|
202
|
+
(if (truth (get step :done)) (setq done t)
|
|
203
|
+
(let ((operation (get step :value)))
|
|
204
|
+
(try
|
|
205
|
+
(when (truth (await (funcall visible request operation)))
|
|
206
|
+
(js-call available :push operation))
|
|
207
|
+
(catch error (close-abrupt cursor error))))))))
|
|
208
|
+
(let* ((nodes (tree available)) (node (js-call nodes :get location)))
|
|
209
|
+
(if (undefined? node) (markdown-response "Unknown path" 404)
|
|
210
|
+
(let ((permission (await (funcall authorize request (get node :operation)
|
|
211
|
+
(if discovery "index" (if (= (get request :method) "POST") "invoke" "usage"))))))
|
|
212
|
+
(cond
|
|
213
|
+
((instance? permission (get Host/globals :Response)) permission)
|
|
214
|
+
((not (eq permission t)) (markdown-response "Forbidden" 403))
|
|
215
|
+
(t
|
|
216
|
+
(let ((allow (if (and (truth (get node :operation)) (not fixed-entry))
|
|
217
|
+
"GET, HEAD, OPTIONS, POST" "GET, HEAD, OPTIONS")))
|
|
218
|
+
(cond
|
|
219
|
+
((= (get request :method) "OPTIONS")
|
|
220
|
+
(new (get Host/globals :Response) nil (js-object :status 204 :headers (js-object :Allow allow))))
|
|
221
|
+
((or (= (get request :method) "GET") (= (get request :method) "HEAD"))
|
|
222
|
+
(let ((body (if (or discovery (not (truth (get node :operation))))
|
|
223
|
+
(pathIndexMarkdown title available location) (usageMarkdown (get node :operation)))))
|
|
224
|
+
(markdown-response (if (= (get request :method) "HEAD") nil body))))
|
|
225
|
+
((or (not (= (get request :method) "POST")) (not (truth (get node :operation)))
|
|
226
|
+
(js-call (js-array "/.gepo" "/.well-known/gepo") :includes (get url :pathname)))
|
|
227
|
+
(markdown-response "Method not allowed" 405 (js-object :Allow allow)))
|
|
228
|
+
(t (let ((result (await (js-call (get node :operation) :execute request))))
|
|
229
|
+
(unless (instance? result (get Host/globals :Response)) (fail "Operation must return a Response"))
|
|
230
|
+
result))))))))))))))
|
|
231
|
+
|
|
232
|
+
(defun cancel-after-failure (stream reason)
|
|
233
|
+
;; Stream cancellation may itself remain pending indefinitely. Once the
|
|
234
|
+
;; business operation has failed, cleanup cannot own its completion or
|
|
235
|
+
;; replace its first exception. Observe a cancellation rejection without
|
|
236
|
+
;; waiting for it; ReadableStream cancellation closes pending reads now.
|
|
237
|
+
(try
|
|
238
|
+
(js-call (Promise/resolve (js-call stream :cancel reason)) :catch (lambda () undefined))
|
|
239
|
+
(catch ignored undefined))
|
|
240
|
+
undefined)
|
|
241
|
+
(defun createClient (&rest optional-arguments)
|
|
242
|
+
(let ((configuration (aref optional-arguments 0)))
|
|
243
|
+
(when (undefined? configuration) (setq configuration (js-object)))
|
|
244
|
+
(let* ((transport (option configuration "fetch" (lambda () (get Host/globals :fetch))))
|
|
245
|
+
(defaults (option configuration "headers" (lambda () (js-object))))
|
|
246
|
+
(maxBytes (option configuration "maxBytes" (lambda () 2097152)))
|
|
247
|
+
(timeoutMs (option configuration "timeoutMs" (lambda () 30000)))
|
|
248
|
+
(classify (option configuration "classify" (lambda () classifyDiscovery))))
|
|
249
|
+
(unless (and (= (js* "typeof transport") "function") (= (js* "typeof classify") "function")
|
|
250
|
+
(Number/isSafeInteger maxBytes) (>= maxBytes 1)
|
|
251
|
+
(Number/isSafeInteger timeoutMs) (>= timeoutMs 1))
|
|
252
|
+
(fail "Invalid client options"))
|
|
253
|
+
(let ((default-headers (new (get Host/globals :Headers) defaults))
|
|
254
|
+
(send nil) (usage nil) (index nil))
|
|
255
|
+
(setq send (async (url method body &rest optional-arguments)
|
|
256
|
+
(let ((options (aref optional-arguments 0)))
|
|
257
|
+
(when (undefined? options) (setq options (js-object)))
|
|
258
|
+
(let ((headers (new (get Host/globals :Headers) default-headers)))
|
|
259
|
+
(js-call (new (get Host/globals :Headers) (get options :headers)) :forEach
|
|
260
|
+
(lambda (value key) (js-call headers :set key value)))
|
|
261
|
+
(unless (js-call headers :has "Accept")
|
|
262
|
+
(js-call headers :set "Accept" "text/markdown, text/plain;q=0.8, */*;q=0.1"))
|
|
263
|
+
(when (truth (get options :contentType)) (js-call headers :set "Content-Type" (get options :contentType)))
|
|
264
|
+
(let* ((controller (new (get Host/globals :AbortController)))
|
|
265
|
+
(signal (if (truth (get options :signal))
|
|
266
|
+
(js-call (get Host/globals :AbortSignal) :any (js-array (get controller :signal) (get options :signal)))
|
|
267
|
+
(get controller :signal))))
|
|
268
|
+
(when (truth (get signal :aborted))
|
|
269
|
+
(throw (abort-reason signal)))
|
|
270
|
+
(let* ((timer (funcall (get Host/globals :setTimeout)
|
|
271
|
+
(lambda () (js-call controller :abort (new globalThis/Error "HTTP timeout"))) timeoutMs))
|
|
272
|
+
(on-abort undefined)
|
|
273
|
+
(aborted (new globalThis/Promise
|
|
274
|
+
(lambda (resolve reject)
|
|
275
|
+
(setq on-abort (lambda ()
|
|
276
|
+
(funcall reject (abort-reason signal))))
|
|
277
|
+
(js-call signal :addEventListener "abort" on-abort (js-object :once t))))))
|
|
278
|
+
(try
|
|
279
|
+
(let ((reply (await (Promise/race (js-array aborted
|
|
280
|
+
(funcall transport (get url :href)
|
|
281
|
+
(js-object :method method :body body :headers headers :redirect "manual" :signal signal)))))))
|
|
282
|
+
(when (and (>= (get reply :status) 300) (< (get reply :status) 400))
|
|
283
|
+
(let ((stream (get reply :body))
|
|
284
|
+
(error (new globalThis/Error "Redirect requires explicit caller handling")))
|
|
285
|
+
(unless (nullish? stream) (cancel-after-failure stream error))
|
|
286
|
+
(throw error)))
|
|
287
|
+
(let ((chunks (js-array)) (size 0))
|
|
288
|
+
(when (truth (get reply :body))
|
|
289
|
+
(let ((reader (js-call (get reply :body) :getReader)) (failed false))
|
|
290
|
+
(try
|
|
291
|
+
(let ((done false))
|
|
292
|
+
(while (not done)
|
|
293
|
+
(let* ((item (await (Promise/race (js-array aborted (js-call reader :read)))))
|
|
294
|
+
(finished (get item :done)) (value (get item :value)))
|
|
295
|
+
(if (truth finished) (setq done t)
|
|
296
|
+
(progn
|
|
297
|
+
(setq size (+ size (get value :byteLength)))
|
|
298
|
+
(when (> size maxBytes)
|
|
299
|
+
(throw (new globalThis/RangeError "HTTP response byte limit")))
|
|
300
|
+
(js-call chunks :push value))))))
|
|
301
|
+
(catch error
|
|
302
|
+
(setq failed t)
|
|
303
|
+
(cancel-after-failure reader error)
|
|
304
|
+
(throw error))
|
|
305
|
+
(finally
|
|
306
|
+
(try (js-call reader :releaseLock)
|
|
307
|
+
(catch cleanup-error (unless failed (throw cleanup-error))))))))
|
|
308
|
+
(let ((bytes (new (get Host/globals :Uint8Array) size)) (offset 0))
|
|
309
|
+
(literal-each chunks (lambda (chunk)
|
|
310
|
+
(js-call bytes :set chunk offset)
|
|
311
|
+
(setq offset (+ offset (get chunk :byteLength)))))
|
|
312
|
+
(js-object :url (get url :href) :status (get reply :status)
|
|
313
|
+
:contentType (js-call (get reply :headers) :get "Content-Type")
|
|
314
|
+
:headers (get reply :headers)
|
|
315
|
+
:body (js-call (new (get Host/globals :TextDecoder)) :decode bytes)))))
|
|
316
|
+
(finally
|
|
317
|
+
(funcall (get Host/globals :clearTimeout) timer)
|
|
318
|
+
(js-call signal :removeEventListener "abort" on-abort)))))))))
|
|
319
|
+
(setq usage (async (value &rest optional-arguments)
|
|
320
|
+
(let ((options (aref optional-arguments 0)))
|
|
321
|
+
(when (undefined? options) (setq options (js-object)))
|
|
322
|
+
(let ((url (target value)))
|
|
323
|
+
(js-call (get url :searchParams) :delete ".gepo")
|
|
324
|
+
(funcall send url "GET" undefined options)))))
|
|
325
|
+
(setq index (async (value &rest optional-arguments)
|
|
326
|
+
(let ((options (aref optional-arguments 0)))
|
|
327
|
+
(when (undefined? options) (setq options (js-object)))
|
|
328
|
+
(let ((url (target value))) (put url :search ".gepo") (funcall send url "GET" undefined options)))))
|
|
329
|
+
(Object/freeze (js-object :usage usage :index index
|
|
330
|
+
:discover (async (value &rest optional-arguments)
|
|
331
|
+
(let ((options (aref optional-arguments 0)))
|
|
332
|
+
(when (undefined? options) (setq options (js-object)))
|
|
333
|
+
(let ((attempts (js-array)) (candidates (discoveryCandidates value)) (found nil))
|
|
334
|
+
(let ((cursor (iteration candidates)) (done false))
|
|
335
|
+
(while (not done)
|
|
336
|
+
(let ((step (iteration-step cursor)))
|
|
337
|
+
(if (truth (get step :done)) (setq done t)
|
|
338
|
+
(let ((candidate (get step :value)))
|
|
339
|
+
(try
|
|
340
|
+
(let* ((reply (await (funcall send (target candidate) "GET" undefined options)))
|
|
341
|
+
(result (await (funcall classify reply))))
|
|
342
|
+
(js-call attempts :push (js-object :url (get reply :url) :status (get reply :status) :accepted (get result :accepted)))
|
|
343
|
+
(when (truth (get result :accepted))
|
|
344
|
+
(setq found (spread-into (spread-into (js-object) reply)
|
|
345
|
+
(js-object :paths (get result :paths) :state (if (truth (get result :empty)) "empty" "found") :attempts attempts)))
|
|
346
|
+
(setq done t)))
|
|
347
|
+
(catch error (close-abrupt cursor error)))
|
|
348
|
+
(when done (iterator-close (get cursor :iterator))))))))
|
|
349
|
+
(if (nil? found) (js-object :state "not-found" :attempts attempts) found))))
|
|
350
|
+
:invoke (async (value body &rest optional-arguments)
|
|
351
|
+
(let ((options (aref optional-arguments 0)))
|
|
352
|
+
(when (undefined? options) (setq options (js-object)))
|
|
353
|
+
(unless (eq (get options :allowPost) t) (fail "Invocation requires allowPost: true"))
|
|
354
|
+
(when (undefined? body) (fail "Invocation requires an explicit body"))
|
|
355
|
+
(let ((url (target value)))
|
|
356
|
+
(when (js-call (get url :searchParams) :has ".gepo") (fail "Discovery parameter is reserved"))
|
|
357
|
+
(let ((description (await (funcall usage url options))))
|
|
358
|
+
(when (or (< (get description :status) 200) (>= (get description :status) 300))
|
|
359
|
+
(throw (new globalThis/Error (str "Usage request failed: " (get description :status)))))
|
|
360
|
+
(funcall send url "POST" body options)))))))))))
|
|
361
|
+
|
|
362
|
+
(export defineOperation usageMarkdown pathIndexMarkdown discoveryCandidates classifyDiscovery createService createClient))
|