@astrale-os/kernel-core 0.9.0-beta.9 → 1.0.0-beta.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/dist/auth/authority/accept.js +4 -0
- package/dist/auth/authority/admission/admission.d.ts +4 -1
- package/dist/auth/authority/admission/admission.js +46 -147
- package/dist/auth/authority/admission/index.d.ts +1 -1
- package/dist/auth/authority/admission/index.js +1 -1
- package/dist/auth/authority/admission/references.d.ts +13 -0
- package/dist/auth/authority/admission/references.js +38 -0
- package/dist/auth/authority/admission/term.d.ts +6 -0
- package/dist/auth/authority/admission/term.js +60 -0
- package/dist/auth/authority/admission/wire.d.ts +8 -0
- package/dist/auth/authority/admission/wire.js +33 -0
- package/dist/auth/authority/canonical.d.ts +2 -0
- package/dist/auth/authority/canonical.js +15 -0
- package/dist/auth/authority/index.d.ts +9 -2
- package/dist/auth/authority/index.js +6 -1
- package/dist/auth/authority/language/index.d.ts +3 -1
- package/dist/auth/authority/language/index.js +1 -0
- package/dist/auth/authority/language/predicate.d.ts +31 -16
- package/dist/auth/authority/language/predicate.js +1 -1
- package/dist/auth/authority/language/program.d.ts +21 -0
- package/dist/auth/authority/language/program.js +2 -0
- package/dist/auth/authority/normalization/index.d.ts +1 -1
- package/dist/auth/authority/normalization/index.js +1 -1
- package/dist/auth/authority/normalization/normalize.d.ts +2 -0
- package/dist/auth/authority/normalization/normalize.js +38 -16
- package/dist/auth/authority/ownership.optimization.d.ts +8 -0
- package/dist/auth/authority/ownership.optimization.js +83 -0
- package/dist/auth/authority/prepare-binder-body.d.ts +4 -0
- package/dist/auth/authority/prepare-binder-body.js +31 -0
- package/dist/auth/authority/program.d.ts +28 -0
- package/dist/auth/authority/program.js +191 -0
- package/dist/auth/authority/semantics/class-authority.d.ts +8 -0
- package/dist/auth/authority/semantics/class-authority.js +26 -0
- package/dist/auth/authority/semantics/composition.d.ts +39 -0
- package/dist/auth/authority/semantics/composition.js +112 -0
- package/dist/auth/authority/semantics/failure.d.ts +21 -0
- package/dist/auth/authority/semantics/failure.js +10 -0
- package/dist/auth/authority/semantics/index.d.ts +11 -0
- package/dist/auth/authority/semantics/index.js +5 -0
- package/dist/auth/authority/semantics/interpret.d.ts +41 -0
- package/dist/auth/authority/semantics/interpret.js +388 -0
- package/dist/auth/authority/semantics/snapshot.d.ts +40 -0
- package/dist/auth/authority/semantics/terms.d.ts +20 -0
- package/dist/auth/authority/semantics/terms.js +96 -0
- package/dist/auth/authority/semantics/vocabulary.d.ts +19 -0
- package/dist/auth/context/context.d.ts +4 -3
- package/dist/auth/expression/authoring/builder.d.ts +2 -11
- package/dist/auth/expression/authoring/builder.js +1 -45
- package/dist/auth/expression/authoring/index.d.ts +1 -1
- package/dist/auth/expression/authoring/index.js +1 -1
- package/dist/auth/expression/index.d.ts +1 -2
- package/dist/auth/expression/index.js +1 -2
- package/dist/auth/expression/language/identity-expression.d.ts +2 -22
- package/dist/auth/grant/index.d.ts +1 -1
- package/dist/auth/grant/index.js +1 -1
- package/dist/auth/grant/resolved/admission.d.ts +4 -3
- package/dist/auth/grant/resolved/admission.js +23 -13
- package/dist/auth/grant/resolved/grant.d.ts +1 -1
- package/dist/auth/grant/resolved/index.d.ts +1 -1
- package/dist/auth/grant/resolved/index.js +1 -1
- package/dist/auth/grant/unresolved/admission.d.ts +4 -1
- package/dist/auth/grant/unresolved/admission.js +27 -67
- package/dist/auth/grant/unresolved/limits.d.ts +2 -4
- package/dist/auth/grant/unresolved/limits.js +1 -5
- package/dist/auth/identity/admission.js +11 -3
- package/dist/auth/identity/identity.d.ts +15 -3
- package/dist/auth/identity/index.d.ts +1 -1
- package/dist/auth/index.d.ts +4 -4
- package/dist/auth/index.js +1 -1
- package/dist/auth/jwk/index.d.ts +1 -1
- package/dist/auth/jwk/index.js +1 -1
- package/dist/auth/jwk/thumbprint.d.ts +2 -0
- package/dist/auth/jwk/thumbprint.js +12 -6
- package/dist/auth/register/fingerprint/fingerprint.d.ts +25 -0
- package/dist/auth/register/fingerprint/fingerprint.js +31 -0
- package/dist/auth/register/fingerprint/index.d.ts +2 -0
- package/dist/auth/register/index.d.ts +5 -0
- package/dist/auth/register/request/admission.d.ts +3 -0
- package/dist/auth/register/request/admission.js +103 -0
- package/dist/auth/register/request/index.d.ts +3 -0
- package/dist/auth/register/request/limits.d.ts +6 -0
- package/dist/auth/register/request/limits.js +6 -0
- package/dist/auth/register/request/request.d.ts +19 -0
- package/dist/auth/{provision → register}/request/self-issuer.d.ts +1 -1
- package/dist/auth/{provision → register}/request/self-issuer.js +1 -1
- package/dist/auth/register/result/index.d.ts +1 -0
- package/dist/auth/register/result/result.d.ts +10 -0
- package/dist/auth/register/result/result.js +1 -0
- package/dist/callable/contract/body.d.ts +10 -0
- package/dist/callable/contract/body.js +7 -0
- package/dist/callable/contract/index.d.ts +2 -1
- package/dist/callable/contract/index.js +1 -1
- package/dist/callable/contract/output.d.ts +18 -2
- package/dist/callable/index.d.ts +3 -2
- package/dist/callable/index.js +2 -1
- package/dist/callable/invocation/call.d.ts +16 -2
- package/dist/callable/invocation/call.js +41 -1
- package/dist/callable/invocation/index.d.ts +1 -1
- package/dist/callable/invocation/index.js +1 -1
- package/dist/callable/invocation/result.d.ts +2 -2
- package/dist/dns-label.d.ts +1 -2
- package/dist/dns-label.js +2 -3
- package/dist/graph/graph/graph.d.ts +1 -5
- package/dist/graph/graph/graph.js +3 -27
- package/dist/graph/graph/index.d.ts +2 -4
- package/dist/graph/graph/index.js +2 -3
- package/dist/graph/graph/model/codec.js +4 -4
- package/dist/graph/graph/model/index.d.ts +1 -1
- package/dist/graph/graph/model/index.js +1 -1
- package/dist/graph/graph/model/model.d.ts +7 -7
- package/dist/graph/graph/model/model.js +6 -6
- package/dist/graph/graph/model/wire.d.ts +58 -78
- package/dist/graph/graph/model/wire.js +18 -19
- package/dist/graph/mutate/authoring/builder.d.ts +2 -2
- package/dist/graph/mutate/authoring/builder.js +2 -2
- package/dist/graph/mutate/authoring/create.js +13 -5
- package/dist/graph/mutate/index.d.ts +1 -1
- package/dist/graph/mutate/language/codec.js +3 -3
- package/dist/graph/mutate/language/model.d.ts +4 -4
- package/dist/graph/mutate/language/wire.d.ts +226 -215
- package/dist/graph/mutate/language/wire.js +42 -47
- package/dist/graph/mutate/result/index.d.ts +4 -3
- package/dist/graph/mutate/result/index.js +8 -6
- package/dist/graph/mutate/result/wire.d.ts +4 -4
- package/dist/graph/mutate/result/wire.js +7 -4
- package/dist/graph/node/identity/id.d.ts +0 -4
- package/dist/graph/node/identity/id.js +0 -5
- package/dist/graph/node/identity/order.js +20 -0
- package/dist/graph/path/authoring/path.d.ts +8 -5
- package/dist/graph/path/authoring/path.js +21 -3
- package/dist/graph/path/language/model.d.ts +8 -3
- package/dist/graph/path/language/syntax.js +23 -8
- package/dist/graph/query/authoring/builder.js +37 -5
- package/dist/graph/query/authoring/model.d.ts +20 -1
- package/dist/graph/query/index.d.ts +4 -2
- package/dist/graph/query/index.js +1 -0
- package/dist/graph/query/language/codec.js +18 -3
- package/dist/graph/query/language/fingerprint.js +8 -0
- package/dist/graph/query/language/model.d.ts +22 -4
- package/dist/graph/query/language/wire.d.ts +124 -114
- package/dist/graph/query/language/wire.js +54 -47
- package/dist/graph/query/order/index.d.ts +53 -0
- package/dist/graph/query/order/index.js +79 -0
- package/dist/graph/query/reference/evaluate.d.ts +1 -0
- package/dist/graph/query/reference/evaluate.js +39 -52
- package/dist/graph/query/result/index.js +1 -1
- package/dist/graph/query/result/wire.d.ts +93 -94
- package/dist/graph/query/result/wire.js +20 -20
- package/dist/graph/reconcile/condition/model.d.ts +2 -2
- package/dist/graph/reconcile/condition/references.d.ts +0 -1
- package/dist/graph/reconcile/condition/references.js +4 -4
- package/dist/graph/reconcile/correspondence.d.ts +9 -8
- package/dist/graph/reconcile/evidence.d.ts +2 -2
- package/dist/graph/reconcile/mutation/assess.d.ts +2 -1
- package/dist/graph/reconcile/observation.d.ts +4 -3
- package/dist/graph/reconcile/planning/canonical.d.ts +6 -0
- package/dist/graph/reconcile/planning/canonical.js +28 -0
- package/dist/graph/reconcile/planning/context.d.ts +3 -3
- package/dist/graph/reconcile/planning/model.d.ts +8 -4
- package/dist/graph/reconcile/planning/plan.js +2 -1
- package/dist/schema/authority/authority-relation.js +3 -0
- package/dist/schema/authority/claims.d.ts +24 -25
- package/dist/schema/authority/claims.js +8 -8
- package/dist/schema/authority/governed-by.d.ts +16 -91
- package/dist/schema/authority/governed-by.js +1 -1
- package/dist/schema/authority/operation-node.d.ts +27 -13
- package/dist/schema/authority/operations.d.ts +8 -168
- package/dist/schema/authority/policy.d.ts +27 -15
- package/dist/schema/authority/vocabulary.d.ts +3 -0
- package/dist/schema/authority/vocabulary.js +25 -0
- package/dist/schema/callables/entrypoint.d.ts +32 -0
- package/dist/schema/callables/entrypoint.js +12 -0
- package/dist/schema/callables/execution.d.ts +269 -0
- package/dist/schema/callables/execution.js +32 -0
- package/dist/schema/callables/function.d.ts +3400 -55
- package/dist/schema/callables/function.js +4 -3
- package/dist/schema/callables/index.d.ts +2 -1
- package/dist/schema/callables/index.js +2 -1
- package/dist/schema/callables/method-of.d.ts +18 -143
- package/dist/schema/callables/method-of.js +2 -2
- package/dist/schema/callables/view.d.ts +83 -51
- package/dist/schema/definitions/class.d.ts +45 -33
- package/dist/schema/definitions/extends.d.ts +16 -110
- package/dist/schema/definitions/instance-of.d.ts +17 -69
- package/dist/schema/domain/domain.d.ts +3343 -148
- package/dist/schema/domain/domain.js +6 -3
- package/dist/schema/domain/of-domain.d.ts +18 -192
- package/dist/schema/domain/of-domain.js +1 -1
- package/dist/schema/identity/composition.d.ts +5 -0
- package/dist/schema/identity/composition.js +5 -0
- package/dist/schema/identity/identity.d.ts +225 -122
- package/dist/schema/identity/identity.js +3 -4
- package/dist/schema/index.d.ts +1 -0
- package/dist/schema/index.js +1 -0
- package/dist/schema/installation/operation-id.d.ts +1 -2
- package/dist/schema/installation/operation-id.js +2 -4
- package/dist/schema/introspection/index.d.ts +1 -1
- package/dist/schema/introspection/language.d.ts +12 -28
- package/dist/schema/kernel/projection/callables.js +2 -3
- package/dist/schema/kernel/projection/core.d.ts +7 -0
- package/dist/schema/kernel/projection/core.js +51 -0
- package/dist/schema/kernel/projection/definitions.d.ts +13 -0
- package/dist/schema/kernel/projection/definitions.js +71 -0
- package/dist/schema/kernel/projection/index.d.ts +3 -3
- package/dist/schema/kernel/projection/index.js +2 -2
- package/dist/schema/kernel/projection/methods.d.ts +5 -0
- package/dist/schema/kernel/projection/methods.js +41 -0
- package/dist/schema/kernel/projection/part.d.ts +34 -0
- package/dist/schema/kernel/projection/part.js +42 -0
- package/dist/schema/kernel/projection/paths.d.ts +6 -0
- package/dist/schema/kernel/projection/{keys.js → paths.js} +12 -14
- package/dist/schema/kernel/projection/project.d.ts +4 -2
- package/dist/schema/kernel/projection/project.js +33 -258
- package/dist/schema/kernel/projection/properties.d.ts +11 -0
- package/dist/schema/kernel/projection/properties.js +36 -0
- package/dist/schema/kernel/projection/relations.d.ts +7 -0
- package/dist/schema/kernel/projection/relations.js +61 -0
- package/dist/schema/kernel/projection/types.d.ts +28 -2
- package/dist/schema/kernel/schema.d.ts +8737 -5086
- package/dist/schema/kernel/schema.js +12 -8
- package/dist/schema/kernel/syscalls/contracts/admit.d.ts +15 -12
- package/dist/schema/kernel/syscalls/contracts/admit.js +16 -9
- package/dist/schema/kernel/syscalls/contracts/blob.d.ts +31 -0
- package/dist/schema/kernel/syscalls/contracts/blob.js +24 -0
- package/dist/schema/kernel/syscalls/contracts/can.d.ts +19 -8
- package/dist/schema/kernel/syscalls/contracts/can.js +12 -4
- package/dist/schema/kernel/syscalls/contracts/delegate.d.ts +6 -7
- package/dist/schema/kernel/syscalls/contracts/delegate.js +5 -5
- package/dist/schema/kernel/syscalls/contracts/execution.d.ts +60 -0
- package/dist/schema/kernel/syscalls/contracts/execution.js +46 -0
- package/dist/schema/kernel/syscalls/contracts/expected.d.ts +5 -0
- package/dist/schema/kernel/syscalls/contracts/expected.js +9 -0
- package/dist/schema/kernel/syscalls/contracts/identity.d.ts +18 -19
- package/dist/schema/kernel/syscalls/contracts/identity.js +6 -7
- package/dist/schema/kernel/syscalls/contracts/impersonate.d.ts +6 -0
- package/dist/schema/kernel/syscalls/contracts/impersonate.js +4 -0
- package/dist/schema/kernel/syscalls/contracts/index.d.ts +6 -3
- package/dist/schema/kernel/syscalls/contracts/index.js +6 -3
- package/dist/schema/kernel/syscalls/contracts/install.d.ts +149 -217
- package/dist/schema/kernel/syscalls/contracts/install.js +22 -26
- package/dist/schema/kernel/syscalls/contracts/installation.d.ts +65 -351
- package/dist/schema/kernel/syscalls/contracts/installation.js +29 -67
- package/dist/schema/kernel/syscalls/contracts/introspect.d.ts +11 -15
- package/dist/schema/kernel/syscalls/contracts/introspect.js +8 -15
- package/dist/schema/kernel/syscalls/contracts/journal.d.ts +26 -27
- package/dist/schema/kernel/syscalls/contracts/journal.js +15 -15
- package/dist/schema/kernel/syscalls/contracts/mint.d.ts +5 -7
- package/dist/schema/kernel/syscalls/contracts/mint.js +4 -5
- package/dist/schema/kernel/syscalls/contracts/mutate.d.ts +243 -224
- package/dist/schema/kernel/syscalls/contracts/mutate.js +7 -1
- package/dist/schema/kernel/syscalls/contracts/query.d.ts +232 -222
- package/dist/schema/kernel/syscalls/contracts/query.js +10 -15
- package/dist/schema/kernel/syscalls/contracts/register.d.ts +20 -0
- package/dist/schema/kernel/syscalls/contracts/register.js +24 -0
- package/dist/schema/kernel/syscalls/contracts/uninstall.d.ts +54 -148
- package/dist/schema/kernel/syscalls/contracts/uninstall.js +6 -5
- package/dist/schema/kernel/syscalls/contracts/view-host-requirements.d.ts +17 -0
- package/dist/schema/kernel/syscalls/contracts/view-host-requirements.js +40 -0
- package/dist/schema/kernel/syscalls/contracts/view-resolve.d.ts +27 -28
- package/dist/schema/kernel/syscalls/contracts/view-resolve.js +16 -24
- package/dist/schema/kernel/syscalls/contracts/whoami.d.ts +19 -20
- package/dist/schema/kernel/syscalls/contracts/whoami.js +2 -2
- package/dist/schema/kernel/syscalls/contracts/whois.d.ts +22 -23
- package/dist/schema/kernel/syscalls/contracts/whois.js +3 -3
- package/dist/schema/kernel/syscalls/declarations/admit.d.ts +18 -18
- package/dist/schema/kernel/syscalls/declarations/admit.js +3 -3
- package/dist/schema/kernel/syscalls/declarations/can.d.ts +19 -14
- package/dist/schema/kernel/syscalls/declarations/can.js +4 -4
- package/dist/schema/kernel/syscalls/declarations/delegate.d.ts +9 -12
- package/dist/schema/kernel/syscalls/declarations/delegate.js +4 -4
- package/dist/schema/kernel/syscalls/declarations/download.d.ts +12 -0
- package/dist/schema/kernel/syscalls/declarations/download.js +10 -0
- package/dist/schema/kernel/syscalls/declarations/execution.d.ts +105 -0
- package/dist/schema/kernel/syscalls/declarations/execution.js +52 -0
- package/dist/schema/kernel/syscalls/declarations/impersonate.d.ts +9 -0
- package/dist/schema/kernel/syscalls/declarations/impersonate.js +12 -0
- package/dist/schema/kernel/syscalls/declarations/index.d.ts +870 -1323
- package/dist/schema/kernel/syscalls/declarations/index.js +18 -2
- package/dist/schema/kernel/syscalls/declarations/install.d.ts +29 -172
- package/dist/schema/kernel/syscalls/declarations/install.js +7 -5
- package/dist/schema/kernel/syscalls/declarations/introspect.d.ts +8 -19
- package/dist/schema/kernel/syscalls/declarations/introspect.js +3 -4
- package/dist/schema/kernel/syscalls/declarations/journal.d.ts +29 -31
- package/dist/schema/kernel/syscalls/declarations/journal.js +4 -2
- package/dist/schema/kernel/syscalls/declarations/mint.d.ts +8 -13
- package/dist/schema/kernel/syscalls/declarations/mint.js +5 -5
- package/dist/schema/kernel/syscalls/declarations/mutate.d.ts +239 -256
- package/dist/schema/kernel/syscalls/declarations/mutate.js +4 -2
- package/dist/schema/kernel/syscalls/declarations/query.d.ts +235 -260
- package/dist/schema/kernel/syscalls/declarations/query.js +4 -2
- package/dist/schema/kernel/syscalls/declarations/register.d.ts +23 -0
- package/dist/schema/kernel/syscalls/declarations/register.js +10 -0
- package/dist/schema/kernel/syscalls/declarations/uninstall.d.ts +49 -153
- package/dist/schema/kernel/syscalls/declarations/uninstall.js +4 -2
- package/dist/schema/kernel/syscalls/declarations/upload.d.ts +15 -0
- package/dist/schema/kernel/syscalls/declarations/upload.js +10 -0
- package/dist/schema/kernel/syscalls/declarations/use-policy.d.ts +4 -0
- package/dist/schema/kernel/syscalls/declarations/use-policy.js +9 -0
- package/dist/schema/kernel/syscalls/declarations/view-resolve.d.ts +30 -37
- package/dist/schema/kernel/syscalls/declarations/view-resolve.js +5 -3
- package/dist/schema/kernel/syscalls/declarations/whoami.d.ts +22 -26
- package/dist/schema/kernel/syscalls/declarations/whoami.js +3 -3
- package/dist/schema/kernel/syscalls/declarations/whois.d.ts +25 -29
- package/dist/schema/kernel/syscalls/declarations/whois.js +5 -3
- package/dist/schema/kernel/syscalls/descriptors/execution.d.ts +153 -0
- package/dist/schema/kernel/syscalls/descriptors/execution.js +11 -0
- package/dist/schema/kernel/syscalls/descriptors/function.d.ts +8 -2
- package/dist/schema/kernel/syscalls/descriptors/functions.d.ts +3 -1
- package/dist/schema/kernel/syscalls/descriptors/functions.js +3 -1
- package/dist/schema/kernel/syscalls/descriptors/identity.d.ts +47 -13
- package/dist/schema/kernel/syscalls/descriptors/identity.js +2 -1
- package/dist/schema/kernel/syscalls/descriptors/index.d.ts +2 -1
- package/dist/schema/kernel/syscalls/descriptors/index.js +2 -1
- package/dist/schema/kernel/syscalls/descriptors/results/view-resolution.d.ts +5 -2
- package/dist/schema/kernel/syscalls/descriptors/results/view-resolution.js +8 -38
- package/dist/schema/kernel/syscalls/descriptors/view.d.ts +11 -9
- package/dist/schema/kernel/syscalls/index.d.ts +2 -2
- package/dist/schema/kernel/syscalls/index.js +2 -2
- package/dist/schema/kernel/syscalls/references/execution.d.ts +55 -0
- package/dist/schema/kernel/syscalls/references/execution.js +13 -0
- package/dist/schema/kernel/syscalls/references/functions.d.ts +12 -2
- package/dist/schema/kernel/syscalls/references/functions.js +3 -1
- package/dist/schema/kernel/syscalls/references/identity.d.ts +9 -0
- package/dist/schema/kernel/syscalls/references/identity.js +1 -0
- package/dist/schema/kernel/syscalls/references/index.d.ts +2 -1
- package/dist/schema/kernel/syscalls/references/index.js +2 -1
- package/dist/schema/meta/created-by.d.ts +32 -0
- package/dist/schema/meta/created-by.js +17 -0
- package/dist/schema/meta/descriptable.d.ts +13 -11
- package/dist/schema/meta/edge.d.ts +5 -9
- package/dist/schema/meta/iconable.d.ts +13 -11
- package/dist/schema/meta/index.d.ts +1 -0
- package/dist/schema/meta/index.js +1 -0
- package/dist/schema/meta/named.d.ts +13 -9
- package/dist/schema/meta/node.d.ts +9 -1
- package/dist/schema/meta/remotable.d.ts +15 -22
- package/dist/schema/meta/statused.d.ts +13 -7
- package/dist/schema/meta/timestamped.d.ts +14 -12
- package/package.json +9 -7
- package/dist/auth/expression/normalization/canonicalize.d.ts +0 -7
- package/dist/auth/expression/normalization/canonicalize.js +0 -102
- package/dist/auth/expression/normalization/index.d.ts +0 -2
- package/dist/auth/expression/normalization/index.js +0 -2
- package/dist/auth/expression/normalization/raise-denials.d.ts +0 -3
- package/dist/auth/expression/normalization/raise-denials.js +0 -59
- package/dist/auth/provision/fingerprint/fingerprint.d.ts +0 -9
- package/dist/auth/provision/fingerprint/fingerprint.js +0 -33
- package/dist/auth/provision/fingerprint/index.d.ts +0 -2
- package/dist/auth/provision/index.d.ts +0 -5
- package/dist/auth/provision/request/admission.d.ts +0 -3
- package/dist/auth/provision/request/admission.js +0 -125
- package/dist/auth/provision/request/index.d.ts +0 -3
- package/dist/auth/provision/request/request.d.ts +0 -29
- package/dist/auth/provision/result/index.d.ts +0 -1
- package/dist/auth/provision/result/result.d.ts +0 -12
- package/dist/graph/graph/navigation/error.d.ts +0 -12
- package/dist/graph/graph/navigation/error.js +0 -20
- package/dist/graph/graph/navigation/index.d.ts +0 -2
- package/dist/graph/graph/navigation/index.js +0 -1
- package/dist/graph/graph/navigation/model.d.ts +0 -15
- package/dist/schema/callables/view-for.d.ts +0 -296
- package/dist/schema/callables/view-for.js +0 -12
- package/dist/schema/kernel/projection/keys.d.ts +0 -3
- package/dist/schema/kernel/projection/path.d.ts +0 -2
- package/dist/schema/kernel/projection/path.js +0 -140
- package/dist/schema/kernel/syscalls/contracts/provision.d.ts +0 -292
- package/dist/schema/kernel/syscalls/contracts/provision.js +0 -19
- package/dist/schema/kernel/syscalls/declarations/define.d.ts +0 -5
- package/dist/schema/kernel/syscalls/declarations/define.js +0 -7
- package/dist/schema/kernel/syscalls/declarations/provision.d.ts +0 -296
- package/dist/schema/kernel/syscalls/declarations/provision.js +0 -8
- /package/dist/auth/{provision/request/request.js → authority/semantics/snapshot.js} +0 -0
- /package/dist/auth/{provision/result/index.js → authority/semantics/vocabulary.js} +0 -0
- /package/dist/auth/{provision → register}/fingerprint/index.js +0 -0
- /package/dist/auth/{provision → register}/index.js +0 -0
- /package/dist/auth/{provision → register}/request/index.js +0 -0
- /package/dist/auth/{provision/result/result.js → register/request/request.js} +0 -0
- /package/dist/{graph/graph/navigation/model.js → auth/register/result/index.js} +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An authority decision that cannot be made. A failure is never `false`: under `not` it would
|
|
3
|
+
* become `true`, so every backend surfaces it as a failed request instead of a decision.
|
|
4
|
+
*/
|
|
5
|
+
export type AuthorityFailureCode =
|
|
6
|
+
/** A bound input names no live Node. */
|
|
7
|
+
'AUTHORITY_TARGET_NOT_FOUND'
|
|
8
|
+
/** A term reads an input the decision frame does not bind. */
|
|
9
|
+
| 'AUTHORITY_INPUT_UNBOUND'
|
|
10
|
+
/** A fixed term does not resolve to exactly one live Node. */
|
|
11
|
+
| 'AUTHORITY_REFERENCE_INVALID'
|
|
12
|
+
/** A binder root is absent, or its composition reaches a Node that is not an Identity. */
|
|
13
|
+
| 'AUTHORITY_COMPOSITION_INVALID'
|
|
14
|
+
/** A binder composition exceeds the evaluating backend's ceilings. */
|
|
15
|
+
| 'AUTHORITY_BUDGET_EXCEEDED';
|
|
16
|
+
export declare class AuthorityFailure extends Error {
|
|
17
|
+
readonly code: AuthorityFailureCode;
|
|
18
|
+
readonly details: Readonly<Record<string, unknown>>;
|
|
19
|
+
readonly name: 'AuthorityFailure';
|
|
20
|
+
constructor(code: AuthorityFailureCode, message: string, details?: Readonly<Record<string, unknown>>);
|
|
21
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { classAuthorityMeaning } from './class-authority.js';
|
|
2
|
+
export { allowed, closeComposition } from './composition.js';
|
|
3
|
+
export type { CompositionClosure, CompositionLimits, CompositionStatus } from './composition.js';
|
|
4
|
+
export { AuthorityFailure } from './failure.js';
|
|
5
|
+
export type { AuthorityFailureCode } from './failure.js';
|
|
6
|
+
export { binderRoots, createAuthorityEvaluator } from './interpret.js';
|
|
7
|
+
export type { AuthorityAtom, AuthorityEvaluationOptions, AuthorityEvaluator } from './interpret.js';
|
|
8
|
+
export type { AuthorityInputs, AuthorityNode, AuthoritySnapshot } from './snapshot.js';
|
|
9
|
+
export { fixedPaths, isFixedTerm, requiredInputs, termPath } from './terms.js';
|
|
10
|
+
export type { FixedTerm } from './terms.js';
|
|
11
|
+
export type { AuthorityVocabulary } from './vocabulary.js';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { classAuthorityMeaning } from './class-authority.js';
|
|
2
|
+
export { allowed, closeComposition } from './composition.js';
|
|
3
|
+
export { AuthorityFailure } from './failure.js';
|
|
4
|
+
export { binderRoots, createAuthorityEvaluator } from './interpret.js';
|
|
5
|
+
export { fixedPaths, isFixedTerm, requiredInputs, termPath } from './terms.js';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { NodeId } from '../../../graph/node/index.js';
|
|
2
|
+
import type { AuthorityExpr, AuthorityProgram, PredicateRef } from '../language/index.js';
|
|
3
|
+
import type { CompositionLimits } from './composition.js';
|
|
4
|
+
import type { AuthorityInputs, AuthoritySnapshot } from './snapshot.js';
|
|
5
|
+
import type { AuthorityVocabulary } from './vocabulary.js';
|
|
6
|
+
/** A leaf the Boolean and binder structure does not decompose. */
|
|
7
|
+
export type AuthorityAtom = Exclude<AuthorityExpr, {
|
|
8
|
+
readonly op: 'true' | 'false' | 'all' | 'any' | 'not' | 'as';
|
|
9
|
+
}>;
|
|
10
|
+
export interface AuthorityEvaluationOptions {
|
|
11
|
+
/** The evaluating backend's composition ceilings. */
|
|
12
|
+
readonly limits?: CompositionLimits;
|
|
13
|
+
/**
|
|
14
|
+
* Decide an atom outside every existential scope from evidence the snapshot does not hold, such
|
|
15
|
+
* as a captured fact table. Undefined leaves the atom to its meaning over the snapshot.
|
|
16
|
+
*/
|
|
17
|
+
readonly atom?: (atom: AuthorityAtom, subject: NodeId | undefined) => boolean | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* Pure observation of the snapshot's evidence token. It changes (Object.is) at every
|
|
20
|
+
* acquisition and stays stable otherwise; observing it must not acquire evidence.
|
|
21
|
+
* Stable snapshots may omit it. Tokens must not be mutated or reused across acquisitions.
|
|
22
|
+
*/
|
|
23
|
+
readonly evidenceEpoch?: () => unknown;
|
|
24
|
+
}
|
|
25
|
+
/** Decisions of one program over one snapshot. Memoized evidence never outlives the evaluator. */
|
|
26
|
+
export interface AuthorityEvaluator {
|
|
27
|
+
/**
|
|
28
|
+
* Resolve every fixed reference and admit every binder composition of the program, as a backend
|
|
29
|
+
* does for its whole request family before it exposes any decision.
|
|
30
|
+
*/
|
|
31
|
+
admit(): void;
|
|
32
|
+
/** Decide one predicate for one input frame; throws `AuthorityFailure`, never returns it. */
|
|
33
|
+
evaluate(predicate: PredicateRef, inputs?: AuthorityInputs): boolean;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The reference interpreter of authority. It is parametric over one snapshot and the Kernel
|
|
37
|
+
* vocabulary, and every backend lowering must agree with it.
|
|
38
|
+
*/
|
|
39
|
+
export declare function createAuthorityEvaluator(program: AuthorityProgram, snapshot: AuthoritySnapshot, vocabulary: AuthorityVocabulary, options?: AuthorityEvaluationOptions): AuthorityEvaluator;
|
|
40
|
+
/** Every Identity a binder of the program names, sorted. */
|
|
41
|
+
export declare function binderRoots(expressions: readonly AuthorityExpr[]): readonly NodeId[];
|
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
import { Path } from '../../../graph/path/index.js';
|
|
2
|
+
import { allowed, closeComposition } from './composition.js';
|
|
3
|
+
import { AuthorityFailure } from './failure.js';
|
|
4
|
+
import { fixedPaths, termPath } from './terms.js';
|
|
5
|
+
/**
|
|
6
|
+
* The reference interpreter of authority. It is parametric over one snapshot and the Kernel
|
|
7
|
+
* vocabulary, and every backend lowering must agree with it.
|
|
8
|
+
*/
|
|
9
|
+
export function createAuthorityEvaluator(program, snapshot, vocabulary, options = {}) {
|
|
10
|
+
const references = new Map();
|
|
11
|
+
const closures = new Map();
|
|
12
|
+
const projections = new Map();
|
|
13
|
+
const walks = new Map();
|
|
14
|
+
const walkPlans = new WeakMap();
|
|
15
|
+
const existentialPlans = new WeakMap();
|
|
16
|
+
const instanceOf = classKey(vocabulary.instanceOf);
|
|
17
|
+
const reference = (path) => {
|
|
18
|
+
const known = references.get(path.raw);
|
|
19
|
+
if (known !== undefined)
|
|
20
|
+
return known;
|
|
21
|
+
const nodes = [...new Set(snapshot.resolve(path))].filter((id) => snapshot.node(id));
|
|
22
|
+
if (nodes.length !== 1) {
|
|
23
|
+
throw new AuthorityFailure('AUTHORITY_REFERENCE_INVALID', 'An authority fixed reference does not resolve to exactly one live Node.', { path: path.raw, candidates: nodes.length });
|
|
24
|
+
}
|
|
25
|
+
references.set(path.raw, nodes[0]);
|
|
26
|
+
return nodes[0];
|
|
27
|
+
};
|
|
28
|
+
const closure = (root) => {
|
|
29
|
+
let value = closures.get(root);
|
|
30
|
+
if (value === undefined) {
|
|
31
|
+
value = closeComposition(root, snapshot, vocabulary, program.identities, options.limits);
|
|
32
|
+
closures.set(root, value);
|
|
33
|
+
}
|
|
34
|
+
return value;
|
|
35
|
+
};
|
|
36
|
+
const term = (value, frame) => {
|
|
37
|
+
switch (value.kind) {
|
|
38
|
+
case 'input': {
|
|
39
|
+
const id = frame.inputs[value.input];
|
|
40
|
+
if (id === undefined) {
|
|
41
|
+
throw new AuthorityFailure('AUTHORITY_INPUT_UNBOUND', `Authority input ${value.input} is not bound by the decision frame.`);
|
|
42
|
+
}
|
|
43
|
+
return id;
|
|
44
|
+
}
|
|
45
|
+
case 'subject':
|
|
46
|
+
if (frame.subject === undefined)
|
|
47
|
+
throw new TypeError('Authority subject is unbound.');
|
|
48
|
+
return frame.subject;
|
|
49
|
+
case 'local': {
|
|
50
|
+
const id = frame.locals.get(value.id);
|
|
51
|
+
if (id === undefined)
|
|
52
|
+
throw new TypeError(`Authority local ${value.id} is unbound.`);
|
|
53
|
+
return id;
|
|
54
|
+
}
|
|
55
|
+
default:
|
|
56
|
+
return reference(termPath(value));
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
const classOf = (id) => {
|
|
60
|
+
const node = snapshot.node(id);
|
|
61
|
+
if (node === undefined)
|
|
62
|
+
throw new TypeError('Authority evaluation reached a Node that is gone.');
|
|
63
|
+
return node.class;
|
|
64
|
+
};
|
|
65
|
+
/** `instance_of` is derived: the live projection of the Node's exact Class. */
|
|
66
|
+
const projection = (id) => {
|
|
67
|
+
const ref = classOf(id);
|
|
68
|
+
const key = classKey(ref);
|
|
69
|
+
let nodes = projections.get(key);
|
|
70
|
+
if (nodes === undefined) {
|
|
71
|
+
const candidates = snapshot.classProjection?.(ref) ?? snapshot.resolve(Path.project(ref));
|
|
72
|
+
nodes = Object.freeze([...new Set(candidates)].filter((node) => snapshot.node(node)));
|
|
73
|
+
projections.set(key, nodes);
|
|
74
|
+
}
|
|
75
|
+
return nodes;
|
|
76
|
+
};
|
|
77
|
+
const step = (from, edge) => classKey(edge) === instanceOf
|
|
78
|
+
? projection(from)
|
|
79
|
+
: snapshot.edges(from, edge, snapshot.orientation(edge) === 'undirected' ? 'both' : 'out');
|
|
80
|
+
/**
|
|
81
|
+
* Bounded walks: a Node reached at any depth within [min, max], revisits allowed. Each hop may
|
|
82
|
+
* take any member of the Edge Class extent.
|
|
83
|
+
*/
|
|
84
|
+
const related = (expression, source, target) => {
|
|
85
|
+
const { repeat, via: extent } = expression;
|
|
86
|
+
const min = repeat?.min ?? 1;
|
|
87
|
+
const max = repeat?.max ?? 1;
|
|
88
|
+
// The empty walk is already a proof. Do not spend a read budget exploring longer walks.
|
|
89
|
+
if (min === 0 && source === target)
|
|
90
|
+
return true;
|
|
91
|
+
let plan = walkPlans.get(expression);
|
|
92
|
+
if (plan === undefined) {
|
|
93
|
+
const key = JSON.stringify([min, max, extent.map(classKey)]);
|
|
94
|
+
plan = walks.get(key);
|
|
95
|
+
if (plan === undefined) {
|
|
96
|
+
plan = new Map();
|
|
97
|
+
walks.set(key, plan);
|
|
98
|
+
}
|
|
99
|
+
walkPlans.set(expression, plan);
|
|
100
|
+
}
|
|
101
|
+
const epoch = options.evidenceEpoch?.();
|
|
102
|
+
let walk = plan.get(source);
|
|
103
|
+
if (walk === undefined || !Object.is(walk.epoch, epoch)) {
|
|
104
|
+
walk = { epoch, layers: [new Set([source])] };
|
|
105
|
+
plan.delete(source);
|
|
106
|
+
}
|
|
107
|
+
let frontier = walk.layers[0];
|
|
108
|
+
for (let depth = 1; depth <= max && frontier.size > 0; depth++) {
|
|
109
|
+
let next = walk.layers[depth];
|
|
110
|
+
if (next === undefined) {
|
|
111
|
+
const before = options.evidenceEpoch?.();
|
|
112
|
+
const acquired = new Set();
|
|
113
|
+
for (const node of frontier) {
|
|
114
|
+
for (const edge of extent)
|
|
115
|
+
for (const reached of step(node, edge))
|
|
116
|
+
acquired.add(reached);
|
|
117
|
+
}
|
|
118
|
+
next = acquired;
|
|
119
|
+
walk.layers.push(next);
|
|
120
|
+
// Every retained layer must belong to the same epoch. A provisional prefix remains
|
|
121
|
+
// usable for this search only, even if its later extensions acquire no further evidence.
|
|
122
|
+
if (Object.is(walk.epoch, before) && Object.is(before, options.evidenceEpoch?.())) {
|
|
123
|
+
plan.set(source, walk);
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
plan.delete(source);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
// Like the frozen interpreter, acquire no layer beyond the first admissible witness.
|
|
130
|
+
if (depth >= min && next.has(target))
|
|
131
|
+
return true;
|
|
132
|
+
frontier = next;
|
|
133
|
+
}
|
|
134
|
+
return false;
|
|
135
|
+
};
|
|
136
|
+
const holds = (expression, frame) => {
|
|
137
|
+
switch (expression.op) {
|
|
138
|
+
case 'true':
|
|
139
|
+
return true;
|
|
140
|
+
case 'false':
|
|
141
|
+
return false;
|
|
142
|
+
case 'all':
|
|
143
|
+
return expression.predicates.every((child) => holds(child, frame));
|
|
144
|
+
case 'any':
|
|
145
|
+
return expression.predicates.some((child) => holds(child, frame));
|
|
146
|
+
case 'not':
|
|
147
|
+
return !holds(expression.predicate, frame);
|
|
148
|
+
case 'as': {
|
|
149
|
+
// A cyclic composition makes this binder false; the scope of a cycle is the binder.
|
|
150
|
+
const status = closure(expression.identity).status((identity) => holds(expression.where, { ...frame, subject: identity }));
|
|
151
|
+
return status !== undefined && allowed(status);
|
|
152
|
+
}
|
|
153
|
+
default:
|
|
154
|
+
return atom(expression, frame);
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
const atom = (expression, frame) => {
|
|
158
|
+
if (options.atom !== undefined && frame.locals.size === 0) {
|
|
159
|
+
const decided = options.atom(expression, frame.subject);
|
|
160
|
+
if (decided !== undefined)
|
|
161
|
+
return decided;
|
|
162
|
+
}
|
|
163
|
+
switch (expression.op) {
|
|
164
|
+
case 'same-node':
|
|
165
|
+
return term(expression.left, frame) === term(expression.right, frame);
|
|
166
|
+
case 'related':
|
|
167
|
+
return related(expression, term(expression.source, frame), term(expression.target, frame));
|
|
168
|
+
case 'instance-of':
|
|
169
|
+
return sameClass(classOf(term(expression.node, frame)), expression.class);
|
|
170
|
+
case 'edge-class': {
|
|
171
|
+
if (frame.inputs.edge === undefined) {
|
|
172
|
+
throw new AuthorityFailure('AUTHORITY_INPUT_UNBOUND', 'Authority edge-class requires a bound Edge object.');
|
|
173
|
+
}
|
|
174
|
+
return sameClass(frame.inputs.edge, expression.class);
|
|
175
|
+
}
|
|
176
|
+
case 'class-authority': {
|
|
177
|
+
// The meaning is `classAuthorityMeaning`; it is decided directly so no atom it expands to
|
|
178
|
+
// is ever asked of a captured fact table.
|
|
179
|
+
const identity = term(expression.identity, frame);
|
|
180
|
+
if (identity === reference(Path.domain(expression.class.origin)))
|
|
181
|
+
return true;
|
|
182
|
+
if (expression.evidence === 'owner')
|
|
183
|
+
return false;
|
|
184
|
+
const target = reference(Path.project(expression.class));
|
|
185
|
+
return snapshot
|
|
186
|
+
.edges(identity, vocabulary.capabilities[expression.operation], 'out')
|
|
187
|
+
.includes(target);
|
|
188
|
+
}
|
|
189
|
+
case 'exists':
|
|
190
|
+
return exists(expression, frame);
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
const exists = (expression, frame) => {
|
|
194
|
+
const candidates = expression.nodes.map((local) => local.kind === 'any' ? snapshot.nodes() : snapshot.nodes(local.classes));
|
|
195
|
+
// Acquire every extent in declaration order, even when the product has no tuple.
|
|
196
|
+
if (candidates.some((extent) => extent.length === 0))
|
|
197
|
+
return false;
|
|
198
|
+
let plan = existentialPlans.get(expression);
|
|
199
|
+
if (plan === undefined) {
|
|
200
|
+
const predicates = expression.where.op === 'all' ? expression.where.predicates : [expression.where];
|
|
201
|
+
const usedIndices = new Set();
|
|
202
|
+
// Each entry describes the whole prefix, including its earlier true predicates.
|
|
203
|
+
// gates[i] rejects values of local i; resets[i] invalidates their earlier context.
|
|
204
|
+
const gates = expression.nodes.map(() => []);
|
|
205
|
+
const resets = expression.nodes.map(() => []);
|
|
206
|
+
const dependency = predicates.map((predicate, item) => {
|
|
207
|
+
const used = localDependencies(predicate);
|
|
208
|
+
for (let index = 0; index < expression.nodes.length; index++) {
|
|
209
|
+
if (used.has(expression.nodes[index].id))
|
|
210
|
+
usedIndices.add(index);
|
|
211
|
+
}
|
|
212
|
+
const ordered = [...usedIndices].sort((left, right) => left - right);
|
|
213
|
+
const last = ordered.at(-1) ?? -1;
|
|
214
|
+
const earlier = ordered.at(-2) ?? -1;
|
|
215
|
+
if (last >= 0)
|
|
216
|
+
gates[last].push(item);
|
|
217
|
+
// An exclusion of the last dependency is valid only while all earlier ones stay fixed.
|
|
218
|
+
for (let index = 0; index <= earlier; index++)
|
|
219
|
+
resets[index].push(item);
|
|
220
|
+
return last;
|
|
221
|
+
});
|
|
222
|
+
plan = { predicates, dependency, gates, resets };
|
|
223
|
+
existentialPlans.set(expression, plan);
|
|
224
|
+
}
|
|
225
|
+
const { predicates, dependency, gates, resets } = plan;
|
|
226
|
+
const excluded = predicates.map(() => new Set());
|
|
227
|
+
const rejected = (index, node) => {
|
|
228
|
+
for (const item of gates[index])
|
|
229
|
+
if (excluded[item].has(node))
|
|
230
|
+
return true;
|
|
231
|
+
return false;
|
|
232
|
+
};
|
|
233
|
+
const clear = (item) => {
|
|
234
|
+
if (excluded[item].size === 0)
|
|
235
|
+
return;
|
|
236
|
+
excluded[item].clear();
|
|
237
|
+
};
|
|
238
|
+
let prefix = 0;
|
|
239
|
+
let observedEpoch = options.evidenceEpoch?.();
|
|
240
|
+
const refresh = () => {
|
|
241
|
+
const current = options.evidenceEpoch?.();
|
|
242
|
+
if (Object.is(current, observedEpoch))
|
|
243
|
+
return false;
|
|
244
|
+
observedEpoch = current;
|
|
245
|
+
prefix = 0;
|
|
246
|
+
excluded.forEach((_, item) => clear(item));
|
|
247
|
+
return true;
|
|
248
|
+
};
|
|
249
|
+
// -2 means a witness. Every other result identifies the last bound variable that
|
|
250
|
+
// may change the evaluated prefix. Descendants cannot alter its reads or result.
|
|
251
|
+
const locals = new Map(frame.locals);
|
|
252
|
+
const complete = { ...frame, locals };
|
|
253
|
+
const bind = (index) => {
|
|
254
|
+
if (index === expression.nodes.length) {
|
|
255
|
+
for (let item = prefix; item < predicates.length; item++) {
|
|
256
|
+
if (!holds(predicates[item], complete)) {
|
|
257
|
+
if (refresh())
|
|
258
|
+
return expression.nodes.length - 1;
|
|
259
|
+
const target = dependency[item];
|
|
260
|
+
if (target >= 0) {
|
|
261
|
+
const value = locals.get(expression.nodes[target].id);
|
|
262
|
+
if (!excluded[item].has(value)) {
|
|
263
|
+
excluded[item].add(value);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
return dependency[item];
|
|
267
|
+
}
|
|
268
|
+
prefix = item + 1;
|
|
269
|
+
}
|
|
270
|
+
return -2;
|
|
271
|
+
}
|
|
272
|
+
const id = expression.nodes[index].id;
|
|
273
|
+
const previous = locals.get(id);
|
|
274
|
+
try {
|
|
275
|
+
for (let ordinal = 0; ordinal < candidates[index].length; ordinal++) {
|
|
276
|
+
refresh();
|
|
277
|
+
const node = candidates[index][ordinal];
|
|
278
|
+
if (rejected(index, node)) {
|
|
279
|
+
continue;
|
|
280
|
+
}
|
|
281
|
+
for (const item of resets[index])
|
|
282
|
+
clear(item);
|
|
283
|
+
while (prefix > 0 && dependency[prefix - 1] >= index)
|
|
284
|
+
prefix--;
|
|
285
|
+
locals.set(id, node);
|
|
286
|
+
const result = bind(index + 1);
|
|
287
|
+
if (result === -2 || result < index)
|
|
288
|
+
return result;
|
|
289
|
+
}
|
|
290
|
+
return index - 1;
|
|
291
|
+
}
|
|
292
|
+
finally {
|
|
293
|
+
if (previous === undefined)
|
|
294
|
+
locals.delete(id);
|
|
295
|
+
else
|
|
296
|
+
locals.set(id, previous);
|
|
297
|
+
}
|
|
298
|
+
};
|
|
299
|
+
return bind(0) === -2;
|
|
300
|
+
};
|
|
301
|
+
return Object.freeze({
|
|
302
|
+
admit() {
|
|
303
|
+
for (const path of fixedPaths(program.predicates))
|
|
304
|
+
reference(path);
|
|
305
|
+
for (const root of binderRoots(program.predicates))
|
|
306
|
+
closure(root);
|
|
307
|
+
},
|
|
308
|
+
evaluate(predicate, inputs = {}) {
|
|
309
|
+
const expression = program.predicates[predicate];
|
|
310
|
+
if (expression === undefined)
|
|
311
|
+
throw new TypeError('Unknown Authority predicate ordinal.');
|
|
312
|
+
for (const input of ['object', 'source', 'target']) {
|
|
313
|
+
const id = inputs[input];
|
|
314
|
+
if (id !== undefined && snapshot.node(id) === undefined) {
|
|
315
|
+
throw new AuthorityFailure('AUTHORITY_TARGET_NOT_FOUND', `Authority ${input} does not exist in the evaluated graph.`, { [input]: id });
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
return holds(expression, { inputs, subject: undefined, locals: new Map() });
|
|
319
|
+
},
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
/** Locals whose assignment can affect the result of this expression. */
|
|
323
|
+
function localDependencies(expression) {
|
|
324
|
+
const result = new Set();
|
|
325
|
+
const addTerm = (term) => {
|
|
326
|
+
if (term.kind === 'local')
|
|
327
|
+
result.add(term.id);
|
|
328
|
+
};
|
|
329
|
+
const visit = (value) => {
|
|
330
|
+
switch (value.op) {
|
|
331
|
+
case 'all':
|
|
332
|
+
case 'any':
|
|
333
|
+
value.predicates.forEach(visit);
|
|
334
|
+
return;
|
|
335
|
+
case 'not':
|
|
336
|
+
visit(value.predicate);
|
|
337
|
+
return;
|
|
338
|
+
case 'as':
|
|
339
|
+
case 'exists':
|
|
340
|
+
visit(value.where);
|
|
341
|
+
return;
|
|
342
|
+
case 'same-node':
|
|
343
|
+
addTerm(value.left);
|
|
344
|
+
addTerm(value.right);
|
|
345
|
+
return;
|
|
346
|
+
case 'related':
|
|
347
|
+
addTerm(value.source);
|
|
348
|
+
addTerm(value.target);
|
|
349
|
+
return;
|
|
350
|
+
case 'instance-of':
|
|
351
|
+
addTerm(value.node);
|
|
352
|
+
return;
|
|
353
|
+
case 'class-authority':
|
|
354
|
+
addTerm(value.identity);
|
|
355
|
+
}
|
|
356
|
+
};
|
|
357
|
+
visit(expression);
|
|
358
|
+
return result;
|
|
359
|
+
}
|
|
360
|
+
/** Every Identity a binder of the program names, sorted. */
|
|
361
|
+
export function binderRoots(expressions) {
|
|
362
|
+
const roots = new Set();
|
|
363
|
+
const visit = (expression) => {
|
|
364
|
+
switch (expression.op) {
|
|
365
|
+
case 'all':
|
|
366
|
+
case 'any':
|
|
367
|
+
expression.predicates.forEach(visit);
|
|
368
|
+
return;
|
|
369
|
+
case 'not':
|
|
370
|
+
visit(expression.predicate);
|
|
371
|
+
return;
|
|
372
|
+
case 'exists':
|
|
373
|
+
visit(expression.where);
|
|
374
|
+
return;
|
|
375
|
+
case 'as':
|
|
376
|
+
roots.add(expression.identity);
|
|
377
|
+
visit(expression.where);
|
|
378
|
+
}
|
|
379
|
+
};
|
|
380
|
+
expressions.forEach(visit);
|
|
381
|
+
return Object.freeze([...roots].sort((left, right) => (left < right ? -1 : left > right ? 1 : 0)));
|
|
382
|
+
}
|
|
383
|
+
function sameClass(left, right) {
|
|
384
|
+
return left.origin === right.origin && left.kind === right.kind && left.name === right.name;
|
|
385
|
+
}
|
|
386
|
+
function classKey(ref) {
|
|
387
|
+
return `${ref.origin}:${ref.kind}.${ref.name}`;
|
|
388
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { NodeId } from '../../../graph/node/index.js';
|
|
2
|
+
import type { Path } from '../../../graph/path/index.js';
|
|
3
|
+
import type { ClassRef } from '../language/index.js';
|
|
4
|
+
/** One live Node as authority sees it: its exact concrete Class. */
|
|
5
|
+
export interface AuthorityNode {
|
|
6
|
+
readonly class: ClassRef;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* One consistent graph state the interpreter reads. Every Node it exposes is live and has exactly
|
|
10
|
+
* one active concrete Class; every Edge connects two such Nodes.
|
|
11
|
+
*/
|
|
12
|
+
export interface AuthoritySnapshot {
|
|
13
|
+
/** The live Node, or undefined when the id names none. */
|
|
14
|
+
node(id: NodeId): AuthorityNode | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Distinct Nodes one Edge of the exact Class away: `out` follows source to target, `in` target
|
|
17
|
+
* to source, `both` either orientation. The derived `instance_of` relation is never asked.
|
|
18
|
+
*/
|
|
19
|
+
edges(from: NodeId, edge: ClassRef, direction: 'out' | 'in' | 'both'): readonly NodeId[];
|
|
20
|
+
/** Orientation the pinned Registry declares for one Edge Class. */
|
|
21
|
+
orientation(edge: ClassRef): 'directed' | 'undirected';
|
|
22
|
+
/** Every live Node the Path reaches; a fixed term requires exactly one. */
|
|
23
|
+
resolve(path: Path): readonly NodeId[];
|
|
24
|
+
/**
|
|
25
|
+
* Pinned Registry candidates for derived `instance_of`, admitted through `node` before use.
|
|
26
|
+
* An absent hook falls back to `resolve(Path.project(ref))`; an empty result never does.
|
|
27
|
+
* Fixed terms always use `resolve` independently of this projection.
|
|
28
|
+
*/
|
|
29
|
+
classProjection?(ref: ClassRef): readonly NodeId[];
|
|
30
|
+
/** Every live Node, restricted to exact Classes when given. */
|
|
31
|
+
nodes(classes?: readonly ClassRef[]): readonly NodeId[];
|
|
32
|
+
}
|
|
33
|
+
/** The input frame of one decision; each bound Node must be live. */
|
|
34
|
+
export interface AuthorityInputs {
|
|
35
|
+
readonly object?: NodeId;
|
|
36
|
+
readonly source?: NodeId;
|
|
37
|
+
readonly target?: NodeId;
|
|
38
|
+
/** Exact Class of the bound Edge object, read only by `edge-class`. */
|
|
39
|
+
readonly edge?: ClassRef;
|
|
40
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { AuthorityExpr, Term } from '../language/index.js';
|
|
2
|
+
import type { AuthorityInputs } from './snapshot.js';
|
|
3
|
+
import { Path } from '../../../graph/path/index.js';
|
|
4
|
+
/** A term that names one Node independently of any row, binder or local. */
|
|
5
|
+
export type FixedTerm = Extract<Term, {
|
|
6
|
+
readonly kind: 'node' | 'class' | 'domain' | 'core' | 'ref';
|
|
7
|
+
}>;
|
|
8
|
+
export declare function isFixedTerm(term: Term): term is FixedTerm;
|
|
9
|
+
/** The Path a fixed term denotes; the term holds when that Path reaches exactly one live Node. */
|
|
10
|
+
export declare function termPath(term: FixedTerm): Path;
|
|
11
|
+
/**
|
|
12
|
+
* Every fixed Path one expression depends on, sorted by raw text. `class-authority` depends on the
|
|
13
|
+
* projection of its Class and on the Domain of the Class origin.
|
|
14
|
+
*/
|
|
15
|
+
export declare function fixedPaths(expressions: readonly AuthorityExpr[]): readonly Path[];
|
|
16
|
+
/**
|
|
17
|
+
* Every decision input the expressions read: each `input` term, and the bound Edge Class that
|
|
18
|
+
* `edge-class` reads. A decision whose frame leaves one of them unbound fails.
|
|
19
|
+
*/
|
|
20
|
+
export declare function requiredInputs(expressions: readonly AuthorityExpr[]): ReadonlySet<keyof AuthorityInputs>;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { Path } from '../../../graph/path/index.js';
|
|
2
|
+
export function isFixedTerm(term) {
|
|
3
|
+
return term.kind !== 'input' && term.kind !== 'local' && term.kind !== 'subject';
|
|
4
|
+
}
|
|
5
|
+
/** The Path a fixed term denotes; the term holds when that Path reaches exactly one live Node. */
|
|
6
|
+
export function termPath(term) {
|
|
7
|
+
switch (term.kind) {
|
|
8
|
+
case 'node':
|
|
9
|
+
return Path.id(term.id);
|
|
10
|
+
case 'class':
|
|
11
|
+
return Path.project(term.ref);
|
|
12
|
+
case 'domain':
|
|
13
|
+
return Path.domain(term.origin);
|
|
14
|
+
case 'ref':
|
|
15
|
+
case 'core':
|
|
16
|
+
return Path.project(term.ref);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Every fixed Path one expression depends on, sorted by raw text. `class-authority` depends on the
|
|
21
|
+
* projection of its Class and on the Domain of the Class origin.
|
|
22
|
+
*/
|
|
23
|
+
export function fixedPaths(expressions) {
|
|
24
|
+
const paths = new Map();
|
|
25
|
+
const add = (path) => {
|
|
26
|
+
paths.set(path.raw, path);
|
|
27
|
+
};
|
|
28
|
+
for (const expression of subexpressions(expressions)) {
|
|
29
|
+
for (const term of ownTerms(expression))
|
|
30
|
+
if (isFixedTerm(term))
|
|
31
|
+
add(termPath(term));
|
|
32
|
+
if (expression.op === 'class-authority') {
|
|
33
|
+
add(Path.project(expression.class));
|
|
34
|
+
add(Path.domain(expression.class.origin));
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return Object.freeze([...paths.values()].sort((left, right) => compare(left.raw, right.raw)));
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Every decision input the expressions read: each `input` term, and the bound Edge Class that
|
|
41
|
+
* `edge-class` reads. A decision whose frame leaves one of them unbound fails.
|
|
42
|
+
*/
|
|
43
|
+
export function requiredInputs(expressions) {
|
|
44
|
+
const inputs = new Set();
|
|
45
|
+
for (const expression of subexpressions(expressions)) {
|
|
46
|
+
if (expression.op === 'edge-class')
|
|
47
|
+
inputs.add('edge');
|
|
48
|
+
for (const term of ownTerms(expression))
|
|
49
|
+
if (term.kind === 'input')
|
|
50
|
+
inputs.add(term.input);
|
|
51
|
+
}
|
|
52
|
+
return inputs;
|
|
53
|
+
}
|
|
54
|
+
/** Every expression and nested expression, depth first in syntax order. */
|
|
55
|
+
function* subexpressions(expressions) {
|
|
56
|
+
for (const expression of expressions) {
|
|
57
|
+
yield expression;
|
|
58
|
+
switch (expression.op) {
|
|
59
|
+
case 'all':
|
|
60
|
+
case 'any':
|
|
61
|
+
yield* subexpressions(expression.predicates);
|
|
62
|
+
break;
|
|
63
|
+
case 'not':
|
|
64
|
+
yield* subexpressions([expression.predicate]);
|
|
65
|
+
break;
|
|
66
|
+
case 'as':
|
|
67
|
+
case 'exists':
|
|
68
|
+
yield* subexpressions([expression.where]);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/** The terms one expression reads itself, excluding those of its nested expressions. */
|
|
73
|
+
function ownTerms(expression) {
|
|
74
|
+
switch (expression.op) {
|
|
75
|
+
case 'same-node':
|
|
76
|
+
return [expression.left, expression.right];
|
|
77
|
+
case 'related':
|
|
78
|
+
return [expression.source, expression.target];
|
|
79
|
+
case 'instance-of':
|
|
80
|
+
return [expression.node];
|
|
81
|
+
case 'class-authority':
|
|
82
|
+
return [expression.identity];
|
|
83
|
+
case 'true':
|
|
84
|
+
case 'false':
|
|
85
|
+
case 'edge-class':
|
|
86
|
+
case 'all':
|
|
87
|
+
case 'any':
|
|
88
|
+
case 'not':
|
|
89
|
+
case 'as':
|
|
90
|
+
case 'exists':
|
|
91
|
+
return [];
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
function compare(left, right) {
|
|
95
|
+
return left < right ? -1 : left > right ? 1 : 0;
|
|
96
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ClassRef, Operation } from '../language/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* The Kernel Classes that give authority its meaning. Core Schema publishes the Kernel instance;
|
|
4
|
+
* the interpreter and every lowering take it as a parameter instead of discovering it.
|
|
5
|
+
*/
|
|
6
|
+
export interface AuthorityVocabulary {
|
|
7
|
+
/** Node Class whose concrete descendants an Identity binder may reach. */
|
|
8
|
+
readonly identity: ClassRef;
|
|
9
|
+
/** Outgoing composition Edges of one Identity. */
|
|
10
|
+
readonly composition: {
|
|
11
|
+
readonly extension: ClassRef;
|
|
12
|
+
readonly constraint: ClassRef;
|
|
13
|
+
readonly exclusion: ClassRef;
|
|
14
|
+
};
|
|
15
|
+
/** Edge from an Identity to a Class projection that delegates one Class operation. */
|
|
16
|
+
readonly capabilities: Readonly<Record<Operation, ClassRef>>;
|
|
17
|
+
/** The derived relation from a Node to the projection of its exact Class. */
|
|
18
|
+
readonly instanceOf: ClassRef;
|
|
19
|
+
}
|