import Base import ./event_notice_runtime.bend as Mixed import ./relation_commands.bend as Notice import ./event_family_routing.bend as Route import ./ordinary_event_family.bend as Family import ./ordinary_app_event_family_runtime.bend as App import ./ordinary_app_schema.bend as SchemaApp import ./ordinary_app_composer.bend as Build import ./ordinary_app_recipe.bend as Tree import ./ordinary_app_registration_fields.bend as Records import ./ordinary_app_observation_data.bend as DTO import ./ordinary_schema.bend as Schema import ./world.bend as W # Start a mixed typed-event/relation-notice runtime around the sole schema App # World. Canonical provision creates typed leaves; actual event owners and separate # failure-domain state are retained. This does not register/run a gameplay reader # or conflate typed publication ticks with failure-domain timing. def start(~S:Data,~C:Type,~R:Type,~P:Data,~D:Data,~F:Type,~H:Type,~make:D -> Nat -> F,~sync:F -> Nat -> List<&2,P> -> F,~frame:F -> Nat -> F,~retain:F -> Nat -> List<&2,P> -> F & List<&2,P>,~inventory:F -> F & List<&2,String>,~Owners:Type,~Rows:Data,~observe:W.World> -> W.World> & DTO.Observation,~fold:Owners -> Owners & List<&2,Records.Fields>,provision:Family.Provision,events:H,capacity:Nat,value:SchemaApp.Application,Owners,Rows,observe,fold>) -> App.Application,Mixed.State,Owners,Rows,observe,fold>: match provision value: case Family.Provision{domains} SchemaApp.Application{schema,Build.Registered{world,owners,recipe,debug}}:App.Application{schema,Mixed.start(~S,~C,~R,~P,~F,~H,world,make(domains,capacity),events),owners,recipe,debug} def inventoried(~S:Data,~C:Type,~R:Type,~P:Data,~F:Type,~H:Type,~Owners:Type,~Rows:Data,~observe:W.World> -> W.World> & DTO.Observation,~fold:Owners -> Owners & List<&2,Records.Fields>,schema:Schema.Schema,owners:Owners,recipe:Tree.Recipe>,Rows,observe>,debug:Bool,returned:Route.Runtime,Mixed.State> & Maybe<&2,List<&2,String>>) -> App.Application,Mixed.State,Owners,Rows,observe,fold> & Maybe<&2,List<&2,String>>: match returned: case (runtime,names):(App.Application{schema,runtime,owners,recipe,debug},names) # Return App and optional mixed runtime inventory, retaining actual World/family # owners. Disabled bypasses inventory derivation; enabled describes typed/failure # sources through the supplied trusted adapter, without acknowledgement or dispatch. def inventory(~S:Data,~C:Type,~R:Type,~P:Data,~F:Type,~H:Type,~inventory:F -> F & List<&2,String>,~Owners:Type,~Rows:Data,~observe:W.World> -> W.World> & DTO.Observation,~fold:Owners -> Owners & List<&2,Records.Fields>,value:App.Application,Mixed.State,Owners,Rows,observe,fold>) -> App.Application,Mixed.State,Owners,Rows,observe,fold> & Maybe<&2,List<&2,String>>: match value: case App.Application{schema,runtime,owners,recipe,+debug}:inventoried(~S,~C,~R,~P,~F,~H,~Owners,~Rows,~observe,~fold,schema,owners,recipe,debug,Mixed.inventory_enabled(~S,~C,~R,~P,~F,~H,~inventory,debug,runtime))