ordinary_app_component.bend
bendvy-ecs-core@0.1.0.0 · 113 lines · 0 definitions
1import Base
2import bendvy-ecs-core@0.1.0.0/change_tick.bend as Tick
3import bendvy-ecs-core@0.1.0.0/ordinary_app_execution_recipe.bend as Exec
4import bendvy-ecs-core@0.1.0.0/ordinary_app_execution_run.bend as ExecuteRun
5import bendvy-ecs-core@0.1.0.0/ordinary_app_registration_run.bend as Transport
6import bendvy-ecs-core@0.1.0.0/execution_context.bend as Ctx
7import bendvy-ecs-core@0.1.0.0/schedule_provision.bend as SP
8import bendvy-ecs-core@0.1.0.0/captured_schedule_composition.bend as Choice
9import bendvy-ecs-core@0.1.0.0/ordinary_app_composer.bend as Build
10import bendvy-ecs-core@0.1.0.0/ordinary_app_registration_fields.bend as Records
11import bendvy-ecs-core@0.1.0.0/ordinary_app_records.bend as Leaf
12import bendvy-ecs-core@0.1.0.0/ordinary_app_recipe.bend as Tree
13import bendvy-ecs-core@0.1.0.0/ordinary_app_observation.bend as Leaves
14import bendvy-ecs-core@0.1.0.0/world.bend as W
15import bendvy-ecs-core@0.1.0.0/system.bend as Sys
16import bendvy-ecs-core@0.1.0.0/transaction.bend as T
17import bendvy-ecs-core@0.1.0.0/ordinary_system.bend as System
18import bendvy-ecs-core@0.1.0.0/compose.bend as Q
19import bendvy-ecs-core@0.1.0.0/inspector.bend as I
20import bendvy-ecs-core@0.1.0.0/inspector_query.bend as IQ
21import bendvy-ecs-core@0.1.0.0/ordinary_query_observable.bend as O
22import bendvy-ecs-core@0.1.0.0/ordinary_app_observation_data.bend as DTO
23import bendvy-ecs-core@0.1.0.0/internal/ordinary_component_runner.bend as Generic
24
25# Failure of a registered component-query invocation: CallbackFailure wraps
26# its query/body error; RegistrationRefused means the registration cannot execute.
27# Execution returns the application owner separately; the error owns no world.
28type ExecutionError<Error:Data> is Data:
29 CallbackFailure{error:Q.Error<Error>}
30 RegistrationRefused{}
31def callback_failure(~Error:Data,error:Q.Error<Error>) -> ExecutionError<Error>:CallbackFailure{error}
32def extracted(~S:Data,~C:Type,~R:Type,~E:Data,~Owners:Type,~Rows:Data,~observe:W.World<S,C,R,E> -> W.World<S,C,R,E> & DTO.Observation<Rows>,~fold:Owners -> Owners & List<&2,Records.Fields<S>>,~Ops:Type -> Type,~Args:Data,~Error:Data,~Out:Data,~Value:Data,~query:O.Declaration<S,Q.Frame<S,C,R,E>,Ops(Q.Frame<S,C,R,E>),I.Frame<S,C,R,E>,Value>,~render:Value -> String,~body:@-H:Type -> @-caps:Ops(H) -> Args -> H -> H & (T.Outcome<Error> & Out),~Output:Type,done:Build.Registered<S,W.World<S,C,R,E>,Owners & Leaf.Record<S,Records.Token<Sys.Registry<S,C,R,E,Args & Maybe<&2,Tick.Tick>,Q.Error<Error>,List<&2,Out>,System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body)>>>,DTO.Product<Rows,DTO.Product<Unit,List<&2,IQ.ProjectedRow<S,Value>>>>,Tree.observe_pair(~W.World<S,C,R,E>,~Rows,~DTO.Product<Unit,List<&2,IQ.ProjectedRow<S,Value>>>,~observe,~Leaves.component_observe(~S,~C,~R,~E,~Ops,~Value,~query,~render)),Leaf.fold_pair(~S,~Owners,~Leaf.Record<S,Records.Token<Sys.Registry<S,C,R,E,Args & Maybe<&2,Tick.Tick>,Q.Error<Error>,List<&2,Out>,System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body)>>>,~fold,~Leaf.observed(~S,~Records.Token<Sys.Registry<S,C,R,E,Args & Maybe<&2,Tick.Tick>,Q.Error<Error>,List<&2,Out>,System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body)>>))> -> Output,failed:Build.Registered<S,W.World<S,C,R,E>,Owners,Rows,observe,fold> -> Output,world:W.World<S,C,R,E>,owners:Owners,debug:Bool,result:Records.Token<Sys.Registry<S,C,R,E,Args & Maybe<&2,Tick.Tick>,Q.Error<Error>,List<&2,Out>,System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body)>> & Records.Fields<S>) -> Output:
33 Generic.extracted(~S,~C,~R,~E,~Owners,~Rows,~observe,~fold,~Ops,~Args,~Error,~Out,~Value,~query,~render,~body,~System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body),~System.observable_define(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body),~ExecuteRun.component(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body),~ExecutionError<Error>,~callback_failure(~Error),~RegistrationRefused{},~Output,done,failed,world,owners,debug,result)
34
35def defined(~S:Data,~C:Type,~R:Type,~E:Data,~Owners:Type,~Rows:Data,~observe:W.World<S,C,R,E> -> W.World<S,C,R,E> & DTO.Observation<Rows>,~fold:Owners -> Owners & List<&2,Records.Fields<S>>,~Ops:Type -> Type,~Args:Data,~Error:Data,~Out:Data,~Value:Data,~query:O.Declaration<S,Q.Frame<S,C,R,E>,Ops(Q.Frame<S,C,R,E>),I.Frame<S,C,R,E>,Value>,~render:Value -> String,~body:@-H:Type -> @-caps:Ops(H) -> Args -> H -> H & (T.Outcome<Error> & Out),~Output:Type,done:Build.Registered<S,W.World<S,C,R,E>,Owners & Leaf.Record<S,Records.Token<Sys.Registry<S,C,R,E,Args & Maybe<&2,Tick.Tick>,Q.Error<Error>,List<&2,Out>,System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body)>>>,DTO.Product<Rows,DTO.Product<Unit,List<&2,IQ.ProjectedRow<S,Value>>>>,Tree.observe_pair(~W.World<S,C,R,E>,~Rows,~DTO.Product<Unit,List<&2,IQ.ProjectedRow<S,Value>>>,~observe,~Leaves.component_observe(~S,~C,~R,~E,~Ops,~Value,~query,~render)),Leaf.fold_pair(~S,~Owners,~Leaf.Record<S,Records.Token<Sys.Registry<S,C,R,E,Args & Maybe<&2,Tick.Tick>,Q.Error<Error>,List<&2,Out>,System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body)>>>,~fold,~Leaf.observed(~S,~Records.Token<Sys.Registry<S,C,R,E,Args & Maybe<&2,Tick.Tick>,Q.Error<Error>,List<&2,Out>,System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body)>>))> -> Output,failed:Build.Registered<S,W.World<S,C,R,E>,Owners,Rows,observe,fold> -> Output,owners:Owners,recipe:Tree.Recipe<W.World<S,C,R,E>,Rows,observe>,debug:Bool,result:System.Defined<S,W.World<S,C,R,E>,Sys.Registry<S,C,R,E,Args & Maybe<&2,Tick.Tick>,Q.Error<Error>,List<&2,Out>,System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body)>>) -> Output:
36 Generic.defined(~S,~C,~R,~E,~Owners,~Rows,~observe,~fold,~Ops,~Args,~Error,~Out,~Value,~query,~render,~body,~System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body),~System.observable_define(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body),~ExecuteRun.component(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body),~ExecutionError<Error>,~callback_failure(~Error),~RegistrationRefused{},~Output,done,failed,owners,recipe,debug,result)
37
38# Advanced registration-only entry: extends the observation recipe and owners.
39# Consumes app and calls done with the extended owner, or failed with the prior
40# owner on registration refusal. Prefer add for derived App execution.
41# This performs registration, not a query traversal or structural barrier.
42def register(~S:Data,~C:Type,~R:Type,~E:Data,~Owners:Type,~Rows:Data,~observe:W.World<S,C,R,E> -> W.World<S,C,R,E> & DTO.Observation<Rows>,~fold:Owners -> Owners & List<&2,Records.Fields<S>>,~Ops:Type -> Type,~Args:Data,~Error:Data,~Out:Data,~Value:Data,~query:O.Declaration<S,Q.Frame<S,C,R,E>,Ops(Q.Frame<S,C,R,E>),I.Frame<S,C,R,E>,Value>,~render:Value -> String,~body:@-H:Type -> @-caps:Ops(H) -> Args -> H -> H & (T.Outcome<Error> & Out),~Output:Type,done:Build.Registered<S,W.World<S,C,R,E>,Owners & Leaf.Record<S,Records.Token<Sys.Registry<S,C,R,E,Args & Maybe<&2,Tick.Tick>,Q.Error<Error>,List<&2,Out>,System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body)>>>,DTO.Product<Rows,DTO.Product<Unit,List<&2,IQ.ProjectedRow<S,Value>>>>,Tree.observe_pair(~W.World<S,C,R,E>,~Rows,~DTO.Product<Unit,List<&2,IQ.ProjectedRow<S,Value>>>,~observe,~Leaves.component_observe(~S,~C,~R,~E,~Ops,~Value,~query,~render)),Leaf.fold_pair(~S,~Owners,~Leaf.Record<S,Records.Token<Sys.Registry<S,C,R,E,Args & Maybe<&2,Tick.Tick>,Q.Error<Error>,List<&2,Out>,System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body)>>>,~fold,~Leaf.observed(~S,~Records.Token<Sys.Registry<S,C,R,E,Args & Maybe<&2,Tick.Tick>,Q.Error<Error>,List<&2,Out>,System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body)>>))> -> Output,failed:Build.Registered<S,W.World<S,C,R,E>,Owners,Rows,observe,fold> -> Output,app:Build.Registered<S,W.World<S,C,R,E>,Owners,Rows,observe,fold>,name:String,slot:String) -> Output:
43 Generic.register(~S,~C,~R,~E,~Owners,~Rows,~observe,~fold,~Ops,~Args,~Error,~Out,~Value,~query,~render,~body,~System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body),~System.observable_define(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body),~ExecuteRun.component(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body),~ExecutionError<Error>,~callback_failure(~Error),~RegistrationRefused{},~Output,done,failed,app,name,slot)
44
45def execution_returned(~S:Data,~C:Type,~R:Type,~E:Data,~Ops:Type -> Type,~Args:Data,~Error:Data,~Out:Data,~Value:Data,~query:O.Declaration<S,Q.Frame<S,C,R,E>,Ops(Q.Frame<S,C,R,E>),I.Frame<S,C,R,E>,Value>,~body:@-H:Type -> @-caps:Ops(H) -> Args -> H -> H & (T.Outcome<Error> & Out),+args:Args,result:Transport.TransportResult<S,Ctx.Context<W.World<S,C,R,E>>,Args & Maybe<&2,Tick.Tick>,Q.Error<Error>,List<&2,Out>,Records.Token<Sys.Registry<S,C,R,E,Args & Maybe<&2,Tick.Tick>,Q.Error<Error>,List<&2,Out>,System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body)>>>) -> Exec.Invocation<S,Records.Token<Sys.Registry<S,C,R,E,Args & Maybe<&2,Tick.Tick>,Q.Error<Error>,List<&2,Out>,System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body)>>,Args,Out> & Sys.Outcome<Ctx.Context<W.World<S,C,R,E>>,ExecutionError<Error>,Unit>:
46 Generic.execution_returned(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body,~System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body),~System.observable_define(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body),~ExecuteRun.component(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body),~ExecutionError<Error>,~callback_failure(~Error),~RegistrationRefused{},args,result)
47
48def execution_allowed(~S:Data,~C:Type,~R:Type,~E:Data,~Ops:Type -> Type,~Args:Data,~Error:Data,~Out:Data,~Value:Data,~query:O.Declaration<S,Q.Frame<S,C,R,E>,Ops(Q.Frame<S,C,R,E>),I.Frame<S,C,R,E>,Value>,~body:@-H:Type -> @-caps:Ops(H) -> Args -> H -> H & (T.Outcome<Error> & Out),allowed:Bool,owner:Exec.Invocation<S,Records.Token<Sys.Registry<S,C,R,E,Args & Maybe<&2,Tick.Tick>,Q.Error<Error>,List<&2,Out>,System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body)>>,Args,Out>,world:Ctx.Context<W.World<S,C,R,E>>,id:U32) -> Exec.Invocation<S,Records.Token<Sys.Registry<S,C,R,E,Args & Maybe<&2,Tick.Tick>,Q.Error<Error>,List<&2,Out>,System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body)>>,Args,Out> & Sys.Outcome<Ctx.Context<W.World<S,C,R,E>>,ExecutionError<Error>,Unit>:
49 Generic.execution_allowed(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body,~System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body),~System.observable_define(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body),~ExecuteRun.component(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body),~ExecutionError<Error>,~callback_failure(~Error),~RegistrationRefused{},allowed,owner,world,id)
50
51def execution_run(~S:Data,~C:Type,~R:Type,~E:Data,~Ops:Type -> Type,~Args:Data,~Error:Data,~Out:Data,~Value:Data,~query:O.Declaration<S,Q.Frame<S,C,R,E>,Ops(Q.Frame<S,C,R,E>),I.Frame<S,C,R,E>,Value>,~body:@-H:Type -> @-caps:Ops(H) -> Args -> H -> H & (T.Outcome<Error> & Out),owner:Exec.Invocation<S,Records.Token<Sys.Registry<S,C,R,E,Args & Maybe<&2,Tick.Tick>,Q.Error<Error>,List<&2,Out>,System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body)>>,Args,Out>,world:Ctx.Context<W.World<S,C,R,E>>,id:U32) -> Exec.Invocation<S,Records.Token<Sys.Registry<S,C,R,E,Args & Maybe<&2,Tick.Tick>,Q.Error<Error>,List<&2,Out>,System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body)>>,Args,Out> & Sys.Outcome<Ctx.Context<W.World<S,C,R,E>>,ExecutionError<Error>,Unit>:
52 Generic.execution_run(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body,~System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body),~System.observable_define(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body),~ExecuteRun.component(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body),~ExecutionError<Error>,~callback_failure(~Error),~RegistrationRefused{},owner,world,id)
53
54# Resulting registered application type after adding this component system.
55# Owns the world, prior registrations and the new invocation; it is not a copy.
56# Use add to construct it and ordinary-app-run.attach to derive execution.
57def Application(~S:Data,~C:Type,~R:Type,~E:Data,~Owners:Type,~Rows:Data,~observe:W.World<S,C,R,E> -> W.World<S,C,R,E> & DTO.Observation<Rows>,~fold:Owners -> Owners & List<&2,Records.Fields<S>>,~PriorError:Data,~priorPlan:Owners -> Owners & SP.Plan<S>,~priorDispatch:Owners -> Ctx.Context<W.World<S,C,R,E>> -> U32 -> Owners & Sys.Outcome<Ctx.Context<W.World<S,C,R,E>>,PriorError,Unit>,~priorProvide:W.World<S,C,R,E> -> W.World<S,C,R,E> & List<&2,SP.Requirement<S>>,~Ops:Type -> Type,~Args:Data,~Error:Data,~Out:Data,~Value:Data,~query:O.Declaration<S,Q.Frame<S,C,R,E>,Ops(Q.Frame<S,C,R,E>),I.Frame<S,C,R,E>,Value>,~body:@-H:Type -> @-caps:Ops(H) -> Args -> H -> H & (T.Outcome<Error> & Out),~render:Value -> String) -> Type:
58 Generic.Application(~S,~C,~R,~E,~Owners,~Rows,~observe,~fold,~PriorError,~priorPlan,~priorDispatch,~priorProvide,~Ops,~Args,~Error,~Out,~Value,~query,~body,~System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body),~System.observable_define(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body),~ExecuteRun.component(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body),~ExecutionError<Error>,~callback_failure(~Error),~RegistrationRefused{},~render)
59
60def execution_added(~S:Data,~C:Type,~R:Type,~E:Data,~Owners:Type,~Rows:Data,~observe:W.World<S,C,R,E> -> W.World<S,C,R,E> & DTO.Observation<Rows>,~fold:Owners -> Owners & List<&2,Records.Fields<S>>,~PriorError:Data,~priorPlan:Owners -> Owners & SP.Plan<S>,~priorDispatch:Owners -> Ctx.Context<W.World<S,C,R,E>> -> U32 -> Owners & Sys.Outcome<Ctx.Context<W.World<S,C,R,E>>,PriorError,Unit>,~priorProvide:W.World<S,C,R,E> -> W.World<S,C,R,E> & List<&2,SP.Requirement<S>>,~Ops:Type -> Type,~Args:Data,~Error:Data,~Out:Data,~Value:Data,~query:O.Declaration<S,Q.Frame<S,C,R,E>,Ops(Q.Frame<S,C,R,E>),I.Frame<S,C,R,E>,Value>,~body:@-H:Type -> @-caps:Ops(H) -> Args -> H -> H & (T.Outcome<Error> & Out),~render:Value -> String,~Output:Type,args:Args,done:Application(~S,~C,~R,~E,~Owners,~Rows,~observe,~fold,~PriorError,~priorPlan,~priorDispatch,~priorProvide,~Ops,~Args,~Error,~Out,~Value,~query,~body,~render) -> Output,result:Build.Registered<S,W.World<S,C,R,E>,Owners & Leaf.Record<S,Records.Token<Sys.Registry<S,C,R,E,Args & Maybe<&2,Tick.Tick>,Q.Error<Error>,List<&2,Out>,System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body)>>>,DTO.Product<Rows,DTO.Product<Unit,List<&2,IQ.ProjectedRow<S,Value>>>>,Tree.observe_pair(~W.World<S,C,R,E>,~Rows,~DTO.Product<Unit,List<&2,IQ.ProjectedRow<S,Value>>>,~observe,~Leaves.component_observe(~S,~C,~R,~E,~Ops,~Value,~query,~render)),Leaf.fold_pair(~S,~Owners,~Leaf.Record<S,Records.Token<Sys.Registry<S,C,R,E,Args & Maybe<&2,Tick.Tick>,Q.Error<Error>,List<&2,Out>,System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body)>>>,~fold,~Leaf.observed(~S,~Records.Token<Sys.Registry<S,C,R,E,Args & Maybe<&2,Tick.Tick>,Q.Error<Error>,List<&2,Out>,System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body)>>))>) -> Output:
61 Generic.execution_added(~S,~C,~R,~E,~Owners,~Rows,~observe,~fold,~PriorError,~priorPlan,~priorDispatch,~priorProvide,~Ops,~Args,~Error,~Out,~Value,~query,~body,~System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body),~System.observable_define(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body),~ExecuteRun.component(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body),~ExecutionError<Error>,~callback_failure(~Error),~RegistrationRefused{},~render,~Output,args,done,result)
62
63def execution_rejected(~S:Data,~C:Type,~R:Type,~E:Data,~Owners:Type,~Rows:Data,~observe:W.World<S,C,R,E> -> W.World<S,C,R,E> & DTO.Observation<Rows>,~fold:Owners -> Owners & List<&2,Records.Fields<S>>,~PriorError:Data,~priorPlan:Owners -> Owners & SP.Plan<S>,~priorDispatch:Owners -> Ctx.Context<W.World<S,C,R,E>> -> U32 -> Owners & Sys.Outcome<Ctx.Context<W.World<S,C,R,E>>,PriorError,Unit>,~priorProvide:W.World<S,C,R,E> -> W.World<S,C,R,E> & List<&2,SP.Requirement<S>>,~Ops:Type -> Type,~Args:Data,~Error:Data,~Out:Data,~Value:Data,~query:O.Declaration<S,Q.Frame<S,C,R,E>,Ops(Q.Frame<S,C,R,E>),I.Frame<S,C,R,E>,Value>,~body:@-H:Type -> @-caps:Ops(H) -> Args -> H -> H & (T.Outcome<Error> & Out),~render:Value -> String,~Output:Type,failed:Exec.Registered<S,W.World<S,C,R,E>,Owners,Rows,observe,fold,PriorError,priorPlan,priorDispatch,priorProvide> -> Output,result:Build.Registered<S,W.World<S,C,R,E>,Owners,Rows,observe,fold>) -> Output:
64 Generic.execution_rejected(~S,~C,~R,~E,~Owners,~Rows,~observe,~fold,~PriorError,~priorPlan,~priorDispatch,~priorProvide,~Ops,~Args,~Error,~Out,~Value,~query,~body,~System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body),~System.observable_define(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body),~ExecuteRun.component(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body),~ExecutionError<Error>,~callback_failure(~Error),~RegistrationRefused{},~render,~Output,failed,result)
65
66# Register a reusable component-query system and derive its execution recipe.
67# query supplies operational access and inspection; body sees only Ops(H).
68# Consumes value; done receives the extended application, while failed receives
69# the original application shape with its world and prior owners retained.
70# Registration does not execute body. Data args are stored for repeated runs;
71# affine captures use ordinary-app-capture-query instead. name/slot identify
72# the registration; schema and query owner types must agree.
73# Example: examples/scheduled-health/registration.bend, create().
74def add(~S:Data,~C:Type,~R:Type,~E:Data,~Owners:Type,~Rows:Data,~observe:W.World<S,C,R,E> -> W.World<S,C,R,E> & DTO.Observation<Rows>,~fold:Owners -> Owners & List<&2,Records.Fields<S>>,~PriorError:Data,~priorPlan:Owners -> Owners & SP.Plan<S>,~priorDispatch:Owners -> Ctx.Context<W.World<S,C,R,E>> -> U32 -> Owners & Sys.Outcome<Ctx.Context<W.World<S,C,R,E>>,PriorError,Unit>,~priorProvide:W.World<S,C,R,E> -> W.World<S,C,R,E> & List<&2,SP.Requirement<S>>,~Ops:Type -> Type,~Args:Data,~Error:Data,~Out:Data,~Value:Data,~query:O.Declaration<S,Q.Frame<S,C,R,E>,Ops(Q.Frame<S,C,R,E>),I.Frame<S,C,R,E>,Value>,~body:@-H:Type -> @-caps:Ops(H) -> Args -> H -> H & (T.Outcome<Error> & Out),~render:Value -> String,~Output:Type,done:Application(~S,~C,~R,~E,~Owners,~Rows,~observe,~fold,~PriorError,~priorPlan,~priorDispatch,~priorProvide,~Ops,~Args,~Error,~Out,~Value,~query,~body,~render) -> Output,failed:Exec.Registered<S,W.World<S,C,R,E>,Owners,Rows,observe,fold,PriorError,priorPlan,priorDispatch,priorProvide> -> Output,value:Exec.Registered<S,W.World<S,C,R,E>,Owners,Rows,observe,fold,PriorError,priorPlan,priorDispatch,priorProvide>,args:Args,name:String,slot:String) -> Output:
75 Generic.add(~S,~C,~R,~E,~Owners,~Rows,~observe,~fold,~PriorError,~priorPlan,~priorDispatch,~priorProvide,~Ops,~Args,~Error,~Out,~Value,~query,~body,~System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body),~System.observable_define(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body),~ExecuteRun.component(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body),~ExecutionError<Error>,~callback_failure(~Error),~RegistrationRefused{},~render,~Output,done,failed,value,args,name,slot)
76
77# Advanced type projection for the owners after add: prior owners plus the
78# registered invocation, stored Data arguments and most recent row outputs.
79# Use when naming an application type; this does not allocate or run a system.
80def execution_owners(~S:Data,~C:Type,~R:Type,~E:Data,~Owners:Type,~Rows:Data,~observe:W.World<S,C,R,E> -> W.World<S,C,R,E> & DTO.Observation<Rows>,~fold:Owners -> Owners & List<&2,Records.Fields<S>>,~PriorError:Data,~priorPlan:Owners -> Owners & SP.Plan<S>,~priorDispatch:Owners -> Ctx.Context<W.World<S,C,R,E>> -> U32 -> Owners & Sys.Outcome<Ctx.Context<W.World<S,C,R,E>>,PriorError,Unit>,~priorProvide:W.World<S,C,R,E> -> W.World<S,C,R,E> & List<&2,SP.Requirement<S>>,~Ops:Type -> Type,~Args:Data,~Error:Data,~Out:Data,~Value:Data,~query:O.Declaration<S,Q.Frame<S,C,R,E>,Ops(Q.Frame<S,C,R,E>),I.Frame<S,C,R,E>,Value>,~body:@-H:Type -> @-caps:Ops(H) -> Args -> H -> H & (T.Outcome<Error> & Out),~render:Value -> String) -> Type:
81 Generic.execution_owners(~S,~C,~R,~E,~Owners,~Rows,~observe,~fold,~PriorError,~priorPlan,~priorDispatch,~priorProvide,~Ops,~Args,~Error,~Out,~Value,~query,~body,~System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body),~System.observable_define(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body),~ExecuteRun.component(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body),~ExecutionError<Error>,~callback_failure(~Error),~RegistrationRefused{},~render)
82
83# Advanced detached observation type after add; preserves prior observations
84# and appends this query projection. Does not evaluate the projection.
85def execution_rows(~S:Data,~C:Type,~R:Type,~E:Data,~Owners:Type,~Rows:Data,~observe:W.World<S,C,R,E> -> W.World<S,C,R,E> & DTO.Observation<Rows>,~fold:Owners -> Owners & List<&2,Records.Fields<S>>,~PriorError:Data,~priorPlan:Owners -> Owners & SP.Plan<S>,~priorDispatch:Owners -> Ctx.Context<W.World<S,C,R,E>> -> U32 -> Owners & Sys.Outcome<Ctx.Context<W.World<S,C,R,E>>,PriorError,Unit>,~priorProvide:W.World<S,C,R,E> -> W.World<S,C,R,E> & List<&2,SP.Requirement<S>>,~Ops:Type -> Type,~Args:Data,~Error:Data,~Out:Data,~Value:Data,~query:O.Declaration<S,Q.Frame<S,C,R,E>,Ops(Q.Frame<S,C,R,E>),I.Frame<S,C,R,E>,Value>,~body:@-H:Type -> @-caps:Ops(H) -> Args -> H -> H & (T.Outcome<Error> & Out),~render:Value -> String) -> Data:
86 Generic.execution_rows(~S,~C,~R,~E,~Owners,~Rows,~observe,~fold,~PriorError,~priorPlan,~priorDispatch,~priorProvide,~Ops,~Args,~Error,~Out,~Value,~query,~body,~System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body),~System.observable_define(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body),~ExecuteRun.component(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body),~ExecutionError<Error>,~callback_failure(~Error),~RegistrationRefused{},~render)
87
88# Advanced derived observation callback for add, threading the world owner
89# and producing detached rows without executing the component system.
90def execution_observe(~S:Data,~C:Type,~R:Type,~E:Data,~Owners:Type,~Rows:Data,~observe:W.World<S,C,R,E> -> W.World<S,C,R,E> & DTO.Observation<Rows>,~fold:Owners -> Owners & List<&2,Records.Fields<S>>,~PriorError:Data,~priorPlan:Owners -> Owners & SP.Plan<S>,~priorDispatch:Owners -> Ctx.Context<W.World<S,C,R,E>> -> U32 -> Owners & Sys.Outcome<Ctx.Context<W.World<S,C,R,E>>,PriorError,Unit>,~priorProvide:W.World<S,C,R,E> -> W.World<S,C,R,E> & List<&2,SP.Requirement<S>>,~Ops:Type -> Type,~Args:Data,~Error:Data,~Out:Data,~Value:Data,~query:O.Declaration<S,Q.Frame<S,C,R,E>,Ops(Q.Frame<S,C,R,E>),I.Frame<S,C,R,E>,Value>,~body:@-H:Type -> @-caps:Ops(H) -> Args -> H -> H & (T.Outcome<Error> & Out),~render:Value -> String) -> W.World<S,C,R,E> -> W.World<S,C,R,E> & DTO.Observation<DTO.Product<Rows,DTO.Product<Unit,List<&2,IQ.ProjectedRow<S,Value>>>>>:
91 Generic.execution_observe(~S,~C,~R,~E,~Owners,~Rows,~observe,~fold,~PriorError,~priorPlan,~priorDispatch,~priorProvide,~Ops,~Args,~Error,~Out,~Value,~query,~body,~System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body),~System.observable_define(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body),~ExecuteRun.component(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body),~ExecutionError<Error>,~callback_failure(~Error),~RegistrationRefused{},~render)
92
93# Advanced derived callback for registration metadata; returns the same
94# owner shape with ordered fields. It does not invoke registered bodies.
95def execution_fold(~S:Data,~C:Type,~R:Type,~E:Data,~Owners:Type,~Rows:Data,~observe:W.World<S,C,R,E> -> W.World<S,C,R,E> & DTO.Observation<Rows>,~fold:Owners -> Owners & List<&2,Records.Fields<S>>,~PriorError:Data,~priorPlan:Owners -> Owners & SP.Plan<S>,~priorDispatch:Owners -> Ctx.Context<W.World<S,C,R,E>> -> U32 -> Owners & Sys.Outcome<Ctx.Context<W.World<S,C,R,E>>,PriorError,Unit>,~priorProvide:W.World<S,C,R,E> -> W.World<S,C,R,E> & List<&2,SP.Requirement<S>>,~Ops:Type -> Type,~Args:Data,~Error:Data,~Out:Data,~Value:Data,~query:O.Declaration<S,Q.Frame<S,C,R,E>,Ops(Q.Frame<S,C,R,E>),I.Frame<S,C,R,E>,Value>,~body:@-H:Type -> @-caps:Ops(H) -> Args -> H -> H & (T.Outcome<Error> & Out),~render:Value -> String) -> (Owners & Exec.Invocation<S,Records.Token<Sys.Registry<S,C,R,E,Args & Maybe<&2,Tick.Tick>,Q.Error<Error>,List<&2,Out>,System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body)>>,Args,Out>) -> (Owners & Exec.Invocation<S,Records.Token<Sys.Registry<S,C,R,E,Args & Maybe<&2,Tick.Tick>,Q.Error<Error>,List<&2,Out>,System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body)>>,Args,Out>) & List<&2,Records.Fields<S>>:
96 Generic.execution_fold(~S,~C,~R,~E,~Owners,~Rows,~observe,~fold,~PriorError,~priorPlan,~priorDispatch,~priorProvide,~Ops,~Args,~Error,~Out,~Value,~query,~body,~System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body),~System.observable_define(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body),~ExecuteRun.component(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body),~ExecutionError<Error>,~callback_failure(~Error),~RegistrationRefused{},~render)
97
98# Advanced derived plan callback for add, combining prior and new registered
99# invocations. Use with matching execution_owners and execution_dispatch.
100def execution_plan(~S:Data,~C:Type,~R:Type,~E:Data,~Owners:Type,~Rows:Data,~observe:W.World<S,C,R,E> -> W.World<S,C,R,E> & DTO.Observation<Rows>,~fold:Owners -> Owners & List<&2,Records.Fields<S>>,~PriorError:Data,~priorPlan:Owners -> Owners & SP.Plan<S>,~priorDispatch:Owners -> Ctx.Context<W.World<S,C,R,E>> -> U32 -> Owners & Sys.Outcome<Ctx.Context<W.World<S,C,R,E>>,PriorError,Unit>,~priorProvide:W.World<S,C,R,E> -> W.World<S,C,R,E> & List<&2,SP.Requirement<S>>,~Ops:Type -> Type,~Args:Data,~Error:Data,~Out:Data,~Value:Data,~query:O.Declaration<S,Q.Frame<S,C,R,E>,Ops(Q.Frame<S,C,R,E>),I.Frame<S,C,R,E>,Value>,~body:@-H:Type -> @-caps:Ops(H) -> Args -> H -> H & (T.Outcome<Error> & Out),~render:Value -> String) -> (Owners & Exec.Invocation<S,Records.Token<Sys.Registry<S,C,R,E,Args & Maybe<&2,Tick.Tick>,Q.Error<Error>,List<&2,Out>,System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body)>>,Args,Out>) -> (Owners & Exec.Invocation<S,Records.Token<Sys.Registry<S,C,R,E,Args & Maybe<&2,Tick.Tick>,Q.Error<Error>,List<&2,Out>,System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body)>>,Args,Out>) & SP.Plan<S>:
101 Generic.execution_plan(~S,~C,~R,~E,~Owners,~Rows,~observe,~fold,~PriorError,~priorPlan,~priorDispatch,~priorProvide,~Ops,~Args,~Error,~Out,~Value,~query,~body,~System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body),~System.observable_define(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body),~ExecuteRun.component(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body),~ExecutionError<Error>,~callback_failure(~Error),~RegistrationRefused{},~render)
102
103# Advanced derived dispatcher for add, routing registered IDs to the existing
104# invocation and returning owners plus success/failure. Does not copy a world
105# or registration; use the matching plan and provisioning callbacks.
106def execution_dispatch(~S:Data,~C:Type,~R:Type,~E:Data,~Owners:Type,~Rows:Data,~observe:W.World<S,C,R,E> -> W.World<S,C,R,E> & DTO.Observation<Rows>,~fold:Owners -> Owners & List<&2,Records.Fields<S>>,~PriorError:Data,~priorPlan:Owners -> Owners & SP.Plan<S>,~priorDispatch:Owners -> Ctx.Context<W.World<S,C,R,E>> -> U32 -> Owners & Sys.Outcome<Ctx.Context<W.World<S,C,R,E>>,PriorError,Unit>,~priorProvide:W.World<S,C,R,E> -> W.World<S,C,R,E> & List<&2,SP.Requirement<S>>,~Ops:Type -> Type,~Args:Data,~Error:Data,~Out:Data,~Value:Data,~query:O.Declaration<S,Q.Frame<S,C,R,E>,Ops(Q.Frame<S,C,R,E>),I.Frame<S,C,R,E>,Value>,~body:@-H:Type -> @-caps:Ops(H) -> Args -> H -> H & (T.Outcome<Error> & Out),~render:Value -> String) -> (Owners & Exec.Invocation<S,Records.Token<Sys.Registry<S,C,R,E,Args & Maybe<&2,Tick.Tick>,Q.Error<Error>,List<&2,Out>,System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body)>>,Args,Out>) -> Ctx.Context<W.World<S,C,R,E>> -> U32 -> (Owners & Exec.Invocation<S,Records.Token<Sys.Registry<S,C,R,E,Args & Maybe<&2,Tick.Tick>,Q.Error<Error>,List<&2,Out>,System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body)>>,Args,Out>) & Sys.Outcome<Ctx.Context<W.World<S,C,R,E>>,Choice.Choice<PriorError,ExecutionError<Error>>,Unit>:
107 Generic.execution_dispatch(~S,~C,~R,~E,~Owners,~Rows,~observe,~fold,~PriorError,~priorPlan,~priorDispatch,~priorProvide,~Ops,~Args,~Error,~Out,~Value,~query,~body,~System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body),~System.observable_define(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body),~ExecuteRun.component(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body),~ExecutionError<Error>,~callback_failure(~Error),~RegistrationRefused{},~render)
108
109# Advanced derived requirement callback for add; threads the world through
110# prior provisioning and preserves its declared requirements. This component
111# invocation adds no new requirements. Does not execute the registered body.
112def execution_provide(~S:Data,~C:Type,~R:Type,~E:Data,~Owners:Type,~Rows:Data,~observe:W.World<S,C,R,E> -> W.World<S,C,R,E> & DTO.Observation<Rows>,~fold:Owners -> Owners & List<&2,Records.Fields<S>>,~PriorError:Data,~priorPlan:Owners -> Owners & SP.Plan<S>,~priorDispatch:Owners -> Ctx.Context<W.World<S,C,R,E>> -> U32 -> Owners & Sys.Outcome<Ctx.Context<W.World<S,C,R,E>>,PriorError,Unit>,~priorProvide:W.World<S,C,R,E> -> W.World<S,C,R,E> & List<&2,SP.Requirement<S>>,~Ops:Type -> Type,~Args:Data,~Error:Data,~Out:Data,~Value:Data,~query:O.Declaration<S,Q.Frame<S,C,R,E>,Ops(Q.Frame<S,C,R,E>),I.Frame<S,C,R,E>,Value>,~body:@-H:Type -> @-caps:Ops(H) -> Args -> H -> H & (T.Outcome<Error> & Out),~render:Value -> String) -> W.World<S,C,R,E> -> W.World<S,C,R,E> & List<&2,SP.Requirement<S>>:
113 Generic.execution_provide(~S,~C,~R,~E,~Owners,~Rows,~observe,~fold,~PriorError,~priorPlan,~priorDispatch,~priorProvide,~Ops,~Args,~Error,~Out,~Value,~query,~body,~System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body),~System.observable_define(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body),~ExecuteRun.component(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body),~ExecutionError<Error>,~callback_failure(~Error),~RegistrationRefused{},~render)