~/bend-docscommunity

ordinary_resource_system.bend checks

raw source on the hub · import bendvy-ecs-core@0.1.0.7/ordinary_resource_system.bend as Ordinary_resource_system

10 imports
import Base
import ./trace_facts.bend as TraceFacts
import ./ordinary_schema.bend as Schema
import ./ordinary_query_declaration.bend as Query
import ./world.bend as W
import ./system.bend as Sys
import ./resource.bend as Res
import ./transaction.bend as T
import ./commands.bend as Cmd
import ./capabilities.bend as Cap

Types

type Declaration source · line 16 · raw

@-S:Data -> @-R:Type -> @-H:Type -> @-Ops:Type -> Type

Static declaration: one ordinary identity supplies operational grant and metadata. Current resource operations replace the entire Resources owner, not one field. Retained whole-resource identity, access mode and operational grant. R may be affine Type; this declaration does not narrow replacement to a selected field. Raw declaration/adapters remain trusted, rather than authority created by strings.

type Owner source · line 63 · raw

@-S:Data -> @-Registry:Type -> @-kind:0x7e321819d0ff210531780719c7674cef/ordinary_query_declaration.Mode -> Type

Affine registry owner plus presentation slot, indexed by declared access mode. Resource payload remains in World, not copied into this registration metadata.

type Defined source · line 67 · raw

@-S:Data -> @-World:Type -> @-Registry:Type -> @-kind:0x7e321819d0ff210531780719c7674cef/ordinary_query_declaration.Mode -> Type

Registration result returning World in both branches; Defined retains registry in Owner and Rejected has no newly allocated runner owner.

Templates

template read source · line 20 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-V:Data -> @-project:(@_:R -> Pair(R, V)) -> @identity:0x7e321819d0ff210531780719c7674cef/ordinary_schema.Resource<S, R> -> Declaration<S, R, 0x7e321819d0ff210531780719c7674cef/transaction.Tx<0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E>, E>, 0x7e321819d0ff210531780719c7674cef/capabilities.ValueRead<0x7e321819d0ff210531780719c7674cef/transaction.Tx<0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E>, E>, V>>

Build whole-resource read declaration exposing detached V through an owner- returning projector. This supplies no setter and does not copy the actual R.

template write source · line 24 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-V:Data -> @-project:(@_:R -> Pair(R, V)) -> @identity:0x7e321819d0ff210531780719c7674cef/ordinary_schema.Resource<S, R> -> Declaration<S, R, 0x7e321819d0ff210531780719c7674cef/transaction.Tx<0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E>, E>, 0x7e321819d0ff210531780719c7674cef/capabilities.ValueWrite<0x7e321819d0ff210531780719c7674cef/transaction.Tx<0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E>, E>, R, V>>

Build whole-R read/replacement declaration. Setter consumes incoming R and journals displaced R until completion; it returns no recovery receipt.

template grant source · line 27 · raw

@-S:Data -> @-R:Type -> @-H:Type -> @-Ops:Type -> @declaration:Declaration<S, R, H, Ops> -> Ops

Advanced declaration projection of operational caps; does not invoke them.

template clause source · line 31 · raw

@-S:Data -> @-R:Type -> @-H:Type -> @-Ops:Type -> @declaration:Declaration<S, R, H, Ops> -> 0x7e321819d0ff210531780719c7674cef/ordinary_query_declaration.Clause<S>

Derive the resource key/mode clause from the same retained declaration.

template mode source · line 35 · raw

@-S:Data -> @-R:Type -> @-H:Type -> @-Ops:Type -> @declaration:Declaration<S, R, H, Ops> -> 0x7e321819d0ff210531780719c7674cef/ordinary_query_declaration.Mode

Project the declared read/write mode without inspecting resource storage.

template descriptions source · line 41 · raw

@-S:Data -> @+kind:0x7e321819d0ff210531780719c7674cef/ordinary_query_declaration.Mode -> @names:List<&2, String> -> List<&2, 0x7e321819d0ff210531780719c7674cef/ordinary_query_declaration.Clause<S>>

Description allocation is explicit observation work, not registration work. Presentation adapter expanding access names into same-mode detached clauses. Does not validate grants, allocate a registry or invoke a resource operation.

template access source · line 46 · raw

@-S:Data -> @value:0x7e321819d0ff210531780719c7674cef/ordinary_query_declaration.Clause<S> -> List<&2, String>

Project the singleton operational resource name used for registration metadata.

template returned source · line 49 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-Error:Data -> @-Out:Type -> @output:Out -> @result:0x7e321819d0ff210531780719c7674cef/transaction.Returned<0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E>, Error> -> 0x7e321819d0ff210531780719c7674cef/system.Outcome<0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E>, Error, Out>

template finished source · line 53 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-Error:Data -> @-Out:Type -> @result:Pair(0x7e321819d0ff210531780719c7674cef/transaction.Tx<0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E>, E>, Pair(0x7e321819d0ff210531780719c7674cef/transaction.Outcome<Error>, Out)) -> 0x7e321819d0ff210531780719c7674cef/system.Outcome<0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E>, Error, Out>

template runner source · line 59 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-Ops:(@_:Type -> Type) -> @-Args:Type -> @-Error:Data -> @-Out:Type -> @-declaration:Declaration<S, R, 0x7e321819d0ff210531780719c7674cef/transaction.Tx<0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E>, E>, Ops(0x7e321819d0ff210531780719c7674cef/transaction.Tx<0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E>, E>)> -> @-body:(@-H:Type -> @-caps:Ops(H) -> @_:Args -> @_:H -> Pair(H, Pair(0x7e321819d0ff210531780719c7674cef/transaction.Outcome<Error>, Out))) -> @world:0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E> -> @args:Args -> 0x7e321819d0ff210531780719c7674cef/system.Outcome<0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E>, Error, Out>

Invoke the opaque-owner body in one fresh ECS transaction with declaration caps. Args and Out may own Type payloads. Success returns Out; failure retains performed ECS edits and discards Out. Authored commands require a later barrier.

template registered source · line 70 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-Args:Type -> @-Error:Data -> @-Out:Type -> @-kind:0x7e321819d0ff210531780719c7674cef/ordinary_query_declaration.Mode -> @-run:(@_:0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E> -> @_:Args -> 0x7e321819d0ff210531780719c7674cef/system.Outcome<0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E>, Error, Out>) -> @slot:String -> @result:0x7e321819d0ff210531780719c7674cef/system.RegistrationResult<S, C, R, E, Args, Error, Out, run> -> Defined<S, 0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E>, 0x7e321819d0ff210531780719c7674cef/system.Registry<S, C, R, E, Args, Error, Out, run>, kind>

template define source · line 77 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-Ops:(@_:Type -> Type) -> @-Args:Type -> @-Error:Data -> @-Out:Type -> @-declaration:Declaration<S, R, 0x7e321819d0ff210531780719c7674cef/transaction.Tx<0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E>, E>, Ops(0x7e321819d0ff210531780719c7674cef/transaction.Tx<0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E>, E>)> -> @-body:(@-H:Type -> @-caps:Ops(H) -> @_:Args -> @_:H -> Pair(H, Pair(0x7e321819d0ff210531780719c7674cef/transaction.Outcome<Error>, Out))) -> @world:0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E> -> @name:String -> @slot:String -> Defined<S, 0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E>, 0x7e321819d0ff210531780719c7674cef/system.Registry<S, C, R, E, Args, Error, Out, runner(S, C, R, E, Ops, Args, Error, Out, declaration, body)>, mode(S, R, 0x7e321819d0ff210531780719c7674cef/transaction.Tx<0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E>, E>, Ops(0x7e321819d0ff210531780719c7674cef/transaction.Tx<0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E>, E>), declaration)>

Register the declaration-bound runner with its derived access. slot is retained for presentation and does not change operational resource authority. No body runs at registration. See the named-app matched-feature fixture under test-fixtures.

template run source · line 83 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-Args:Type -> @-Error:Data -> @-Out:Type -> @-kind:0x7e321819d0ff210531780719c7674cef/ordinary_query_declaration.Mode -> @-runner:(@_:0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E> -> @_:Args -> 0x7e321819d0ff210531780719c7674cef/system.Outcome<0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E>, Error, Out>) -> @owner:Owner<S, 0x7e321819d0ff210531780719c7674cef/system.Registry<S, C, R, E, Args, Error, Out, runner>, kind> -> @world:0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E> -> @args:Args -> Pair(0x7e321819d0ff210531780719c7674cef/system.RunResult<S, C, R, E, Args, Error, Out, runner>, String)

Registry's existing namespace and registration checks remain authoritative. Run tracked registration, returning its full success/refusal result plus slot. Refusal retains actual registry, World and Args under Sys.RunResult; successful execution returns callback Out, while callback failure does not return Out.

template describe source · line 90 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-Args:Type -> @-Error:Data -> @-Out:Type -> @-kind:0x7e321819d0ff210531780719c7674cef/ordinary_query_declaration.Mode -> @-runner:(@_:0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E> -> @_:Args -> 0x7e321819d0ff210531780719c7674cef/system.Outcome<0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E>, Error, Out>) -> @owner:Owner<S, 0x7e321819d0ff210531780719c7674cef/system.Registry<S, C, R, E, Args, Error, Out, runner>, kind> -> Pair(Owner<S, 0x7e321819d0ff210531780719c7674cef/system.Registry<S, C, R, E, Args, Error, Out, runner>, kind>, List<&2, 0x7e321819d0ff210531780719c7674cef/ordinary_query_declaration.Clause<S>>)

Called by an enabled debug bridge; actual Registry is borrowed and reconstructed. Enabled-observation adapter returning actual Owner and detached access clauses. Does not inspect resource payloads or grant access from the presentation slot.

template returned_observed source · line 95 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-Error:Data -> @-Out:Type -> @output:Out -> @result:Pair(0x7e321819d0ff210531780719c7674cef/transaction.Returned<0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E>, Error>, 0x7e321819d0ff210531780719c7674cef/trace_facts.State) -> Pair(0x7e321819d0ff210531780719c7674cef/system.Outcome<0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E>, Error, Out>, 0x7e321819d0ff210531780719c7674cef/trace_facts.State)

template finished_observed source · line 101 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-Error:Data -> @-Out:Type -> @result:Pair(0x7e321819d0ff210531780719c7674cef/transaction.Tx<0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E>, E>, Pair(0x7e321819d0ff210531780719c7674cef/transaction.Outcome<Error>, Out)) -> Pair(0x7e321819d0ff210531780719c7674cef/system.Outcome<0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E>, Error, Out>, 0x7e321819d0ff210531780719c7674cef/trace_facts.State)

Same user body and grants, with detached transaction facts returned beside it. Advanced runner finish adapter retaining detached transaction facts separately from World outcome. Same retained effects and failure-Out disposal as runner.