1 import Base 2 import ./change_tick.bend as Tick 3 import ./ordinary_app_execution_recipe.bend as Exec 4 import ./ordinary_app_execution_run.bend as ExecuteRun 5 import ./ordinary_app_registration_run.bend as Transport 6 import ./execution_context.bend as Ctx 7 import ./schedule_provision.bend as SP 8 import ./captured_schedule_composition.bend as Choice 9 import ./ordinary_app_composer.bend as Build 10 import ./ordinary_app_registration_fields.bend as Records 11 import ./ordinary_app_records.bend as Leaf 12 import ./ordinary_app_recipe.bend as Tree 13 import ./ordinary_app_observation.bend as Leaves 14 import ./world.bend as W 15 import ./system.bend as Sys 16 import ./transaction.bend as T 17 import ./ordinary_system.bend as System 18 import ./compose.bend as Q 19 import ./inspector.bend as I 20 import ./inspector_query.bend as IQ 21 import ./ordinary_query_observable.bend as O 22 import ./ordinary_app_observation_data.bend as DTO 23 import ./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. 28 type ExecutionError is Data: 29 CallbackFailure{error:Q.Error} 30 RegistrationRefused{} 31 def callback_failure(~Error:Data,error:Q.Error) -> ExecutionError:CallbackFailure{error} 32 def extracted(~S:Data,~C:Type,~R:Type,~E:Data,~Owners:Type,~Rows:Data,~observe:W.World -> W.World & DTO.Observation,~fold:Owners -> Owners & List<&2,Records.Fields>,~Ops:Type -> Type,~Args:Data,~Error:Data,~Out:Data,~Value:Data,~query:O.Declaration,Ops(Q.Frame),I.Frame,Value>,~render:Value -> String,~body:@-H:Type -> @-caps:Ops(H) -> Args -> H -> H & (T.Outcome & Out),~Output:Type,done:Build.Registered,Owners & Leaf.Record,Q.Error,List<&2,Out>,System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body)>>>,DTO.Product>>>,Tree.observe_pair(~W.World,~Rows,~DTO.Product>>,~observe,~Leaves.component_observe(~S,~C,~R,~E,~Ops,~Value,~query,~render)),Leaf.fold_pair(~S,~Owners,~Leaf.Record,Q.Error,List<&2,Out>,System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body)>>>,~fold,~Leaf.observed(~S,~Records.Token,Q.Error,List<&2,Out>,System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body)>>))> -> Output,failed:Build.Registered,Owners,Rows,observe,fold> -> Output,world:W.World,owners:Owners,debug:Bool,result:Records.Token,Q.Error,List<&2,Out>,System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body)>> & Records.Fields) -> 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,~callback_failure(~Error),~RegistrationRefused{},~Output,done,failed,world,owners,debug,result) 34 35 def defined(~S:Data,~C:Type,~R:Type,~E:Data,~Owners:Type,~Rows:Data,~observe:W.World -> W.World & DTO.Observation,~fold:Owners -> Owners & List<&2,Records.Fields>,~Ops:Type -> Type,~Args:Data,~Error:Data,~Out:Data,~Value:Data,~query:O.Declaration,Ops(Q.Frame),I.Frame,Value>,~render:Value -> String,~body:@-H:Type -> @-caps:Ops(H) -> Args -> H -> H & (T.Outcome & Out),~Output:Type,done:Build.Registered,Owners & Leaf.Record,Q.Error,List<&2,Out>,System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body)>>>,DTO.Product>>>,Tree.observe_pair(~W.World,~Rows,~DTO.Product>>,~observe,~Leaves.component_observe(~S,~C,~R,~E,~Ops,~Value,~query,~render)),Leaf.fold_pair(~S,~Owners,~Leaf.Record,Q.Error,List<&2,Out>,System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body)>>>,~fold,~Leaf.observed(~S,~Records.Token,Q.Error,List<&2,Out>,System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body)>>))> -> Output,failed:Build.Registered,Owners,Rows,observe,fold> -> Output,owners:Owners,recipe:Tree.Recipe,Rows,observe>,debug:Bool,result:System.Defined,Sys.Registry,Q.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,~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. 42 def register(~S:Data,~C:Type,~R:Type,~E:Data,~Owners:Type,~Rows:Data,~observe:W.World -> W.World & DTO.Observation,~fold:Owners -> Owners & List<&2,Records.Fields>,~Ops:Type -> Type,~Args:Data,~Error:Data,~Out:Data,~Value:Data,~query:O.Declaration,Ops(Q.Frame),I.Frame,Value>,~render:Value -> String,~body:@-H:Type -> @-caps:Ops(H) -> Args -> H -> H & (T.Outcome & Out),~Output:Type,done:Build.Registered,Owners & Leaf.Record,Q.Error,List<&2,Out>,System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body)>>>,DTO.Product>>>,Tree.observe_pair(~W.World,~Rows,~DTO.Product>>,~observe,~Leaves.component_observe(~S,~C,~R,~E,~Ops,~Value,~query,~render)),Leaf.fold_pair(~S,~Owners,~Leaf.Record,Q.Error,List<&2,Out>,System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body)>>>,~fold,~Leaf.observed(~S,~Records.Token,Q.Error,List<&2,Out>,System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body)>>))> -> Output,failed:Build.Registered,Owners,Rows,observe,fold> -> Output,app:Build.Registered,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,~callback_failure(~Error),~RegistrationRefused{},~Output,done,failed,app,name,slot) 44 45 def execution_returned(~S:Data,~C:Type,~R:Type,~E:Data,~Ops:Type -> Type,~Args:Data,~Error:Data,~Out:Data,~Value:Data,~query:O.Declaration,Ops(Q.Frame),I.Frame,Value>,~body:@-H:Type -> @-caps:Ops(H) -> Args -> H -> H & (T.Outcome & Out),+args:Args,result:Transport.TransportResult>,Args & Maybe<&2,Tick.Tick>,Q.Error,List<&2,Out>,Records.Token,Q.Error,List<&2,Out>,System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body)>>>) -> Exec.Invocation,Q.Error,List<&2,Out>,System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body)>>,Args,Out> & Sys.Outcome>,ExecutionError,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,~callback_failure(~Error),~RegistrationRefused{},args,result) 47 48 def execution_allowed(~S:Data,~C:Type,~R:Type,~E:Data,~Ops:Type -> Type,~Args:Data,~Error:Data,~Out:Data,~Value:Data,~query:O.Declaration,Ops(Q.Frame),I.Frame,Value>,~body:@-H:Type -> @-caps:Ops(H) -> Args -> H -> H & (T.Outcome & Out),allowed:Bool,owner:Exec.Invocation,Q.Error,List<&2,Out>,System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body)>>,Args,Out>,world:Ctx.Context>,id:U32) -> Exec.Invocation,Q.Error,List<&2,Out>,System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body)>>,Args,Out> & Sys.Outcome>,ExecutionError,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,~callback_failure(~Error),~RegistrationRefused{},allowed,owner,world,id) 50 51 def execution_run(~S:Data,~C:Type,~R:Type,~E:Data,~Ops:Type -> Type,~Args:Data,~Error:Data,~Out:Data,~Value:Data,~query:O.Declaration,Ops(Q.Frame),I.Frame,Value>,~body:@-H:Type -> @-caps:Ops(H) -> Args -> H -> H & (T.Outcome & Out),owner:Exec.Invocation,Q.Error,List<&2,Out>,System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body)>>,Args,Out>,world:Ctx.Context>,id:U32) -> Exec.Invocation,Q.Error,List<&2,Out>,System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body)>>,Args,Out> & Sys.Outcome>,ExecutionError,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,~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. 57 def Application(~S:Data,~C:Type,~R:Type,~E:Data,~Owners:Type,~Rows:Data,~observe:W.World -> W.World & DTO.Observation,~fold:Owners -> Owners & List<&2,Records.Fields>,~PriorError:Data,~priorPlan:Owners -> Owners & SP.Plan,~priorDispatch:Owners -> Ctx.Context> -> U32 -> Owners & Sys.Outcome>,PriorError,Unit>,~priorProvide:W.World -> W.World & List<&2,SP.Requirement>,~Ops:Type -> Type,~Args:Data,~Error:Data,~Out:Data,~Value:Data,~query:O.Declaration,Ops(Q.Frame),I.Frame,Value>,~body:@-H:Type -> @-caps:Ops(H) -> Args -> H -> H & (T.Outcome & 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,~callback_failure(~Error),~RegistrationRefused{},~render) 59 60 def execution_added(~S:Data,~C:Type,~R:Type,~E:Data,~Owners:Type,~Rows:Data,~observe:W.World -> W.World & DTO.Observation,~fold:Owners -> Owners & List<&2,Records.Fields>,~PriorError:Data,~priorPlan:Owners -> Owners & SP.Plan,~priorDispatch:Owners -> Ctx.Context> -> U32 -> Owners & Sys.Outcome>,PriorError,Unit>,~priorProvide:W.World -> W.World & List<&2,SP.Requirement>,~Ops:Type -> Type,~Args:Data,~Error:Data,~Out:Data,~Value:Data,~query:O.Declaration,Ops(Q.Frame),I.Frame,Value>,~body:@-H:Type -> @-caps:Ops(H) -> Args -> H -> H & (T.Outcome & 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,Owners & Leaf.Record,Q.Error,List<&2,Out>,System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body)>>>,DTO.Product>>>,Tree.observe_pair(~W.World,~Rows,~DTO.Product>>,~observe,~Leaves.component_observe(~S,~C,~R,~E,~Ops,~Value,~query,~render)),Leaf.fold_pair(~S,~Owners,~Leaf.Record,Q.Error,List<&2,Out>,System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body)>>>,~fold,~Leaf.observed(~S,~Records.Token,Q.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,~callback_failure(~Error),~RegistrationRefused{},~render,~Output,args,done,result) 62 63 def execution_rejected(~S:Data,~C:Type,~R:Type,~E:Data,~Owners:Type,~Rows:Data,~observe:W.World -> W.World & DTO.Observation,~fold:Owners -> Owners & List<&2,Records.Fields>,~PriorError:Data,~priorPlan:Owners -> Owners & SP.Plan,~priorDispatch:Owners -> Ctx.Context> -> U32 -> Owners & Sys.Outcome>,PriorError,Unit>,~priorProvide:W.World -> W.World & List<&2,SP.Requirement>,~Ops:Type -> Type,~Args:Data,~Error:Data,~Out:Data,~Value:Data,~query:O.Declaration,Ops(Q.Frame),I.Frame,Value>,~body:@-H:Type -> @-caps:Ops(H) -> Args -> H -> H & (T.Outcome & Out),~render:Value -> String,~Output:Type,failed:Exec.Registered,Owners,Rows,observe,fold,PriorError,priorPlan,priorDispatch,priorProvide> -> Output,result:Build.Registered,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,~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(). 74 def add(~S:Data,~C:Type,~R:Type,~E:Data,~Owners:Type,~Rows:Data,~observe:W.World -> W.World & DTO.Observation,~fold:Owners -> Owners & List<&2,Records.Fields>,~PriorError:Data,~priorPlan:Owners -> Owners & SP.Plan,~priorDispatch:Owners -> Ctx.Context> -> U32 -> Owners & Sys.Outcome>,PriorError,Unit>,~priorProvide:W.World -> W.World & List<&2,SP.Requirement>,~Ops:Type -> Type,~Args:Data,~Error:Data,~Out:Data,~Value:Data,~query:O.Declaration,Ops(Q.Frame),I.Frame,Value>,~body:@-H:Type -> @-caps:Ops(H) -> Args -> H -> H & (T.Outcome & 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,Owners,Rows,observe,fold,PriorError,priorPlan,priorDispatch,priorProvide> -> Output,value:Exec.Registered,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,~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. 80 def execution_owners(~S:Data,~C:Type,~R:Type,~E:Data,~Owners:Type,~Rows:Data,~observe:W.World -> W.World & DTO.Observation,~fold:Owners -> Owners & List<&2,Records.Fields>,~PriorError:Data,~priorPlan:Owners -> Owners & SP.Plan,~priorDispatch:Owners -> Ctx.Context> -> U32 -> Owners & Sys.Outcome>,PriorError,Unit>,~priorProvide:W.World -> W.World & List<&2,SP.Requirement>,~Ops:Type -> Type,~Args:Data,~Error:Data,~Out:Data,~Value:Data,~query:O.Declaration,Ops(Q.Frame),I.Frame,Value>,~body:@-H:Type -> @-caps:Ops(H) -> Args -> H -> H & (T.Outcome & 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,~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. 85 def execution_rows(~S:Data,~C:Type,~R:Type,~E:Data,~Owners:Type,~Rows:Data,~observe:W.World -> W.World & DTO.Observation,~fold:Owners -> Owners & List<&2,Records.Fields>,~PriorError:Data,~priorPlan:Owners -> Owners & SP.Plan,~priorDispatch:Owners -> Ctx.Context> -> U32 -> Owners & Sys.Outcome>,PriorError,Unit>,~priorProvide:W.World -> W.World & List<&2,SP.Requirement>,~Ops:Type -> Type,~Args:Data,~Error:Data,~Out:Data,~Value:Data,~query:O.Declaration,Ops(Q.Frame),I.Frame,Value>,~body:@-H:Type -> @-caps:Ops(H) -> Args -> H -> H & (T.Outcome & 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,~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. 90 def execution_observe(~S:Data,~C:Type,~R:Type,~E:Data,~Owners:Type,~Rows:Data,~observe:W.World -> W.World & DTO.Observation,~fold:Owners -> Owners & List<&2,Records.Fields>,~PriorError:Data,~priorPlan:Owners -> Owners & SP.Plan,~priorDispatch:Owners -> Ctx.Context> -> U32 -> Owners & Sys.Outcome>,PriorError,Unit>,~priorProvide:W.World -> W.World & List<&2,SP.Requirement>,~Ops:Type -> Type,~Args:Data,~Error:Data,~Out:Data,~Value:Data,~query:O.Declaration,Ops(Q.Frame),I.Frame,Value>,~body:@-H:Type -> @-caps:Ops(H) -> Args -> H -> H & (T.Outcome & Out),~render:Value -> String) -> W.World -> W.World & DTO.Observation>>>>: 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,~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. 95 def execution_fold(~S:Data,~C:Type,~R:Type,~E:Data,~Owners:Type,~Rows:Data,~observe:W.World -> W.World & DTO.Observation,~fold:Owners -> Owners & List<&2,Records.Fields>,~PriorError:Data,~priorPlan:Owners -> Owners & SP.Plan,~priorDispatch:Owners -> Ctx.Context> -> U32 -> Owners & Sys.Outcome>,PriorError,Unit>,~priorProvide:W.World -> W.World & List<&2,SP.Requirement>,~Ops:Type -> Type,~Args:Data,~Error:Data,~Out:Data,~Value:Data,~query:O.Declaration,Ops(Q.Frame),I.Frame,Value>,~body:@-H:Type -> @-caps:Ops(H) -> Args -> H -> H & (T.Outcome & Out),~render:Value -> String) -> (Owners & Exec.Invocation,Q.Error,List<&2,Out>,System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body)>>,Args,Out>) -> (Owners & Exec.Invocation,Q.Error,List<&2,Out>,System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body)>>,Args,Out>) & List<&2,Records.Fields>: 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,~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. 100 def execution_plan(~S:Data,~C:Type,~R:Type,~E:Data,~Owners:Type,~Rows:Data,~observe:W.World -> W.World & DTO.Observation,~fold:Owners -> Owners & List<&2,Records.Fields>,~PriorError:Data,~priorPlan:Owners -> Owners & SP.Plan,~priorDispatch:Owners -> Ctx.Context> -> U32 -> Owners & Sys.Outcome>,PriorError,Unit>,~priorProvide:W.World -> W.World & List<&2,SP.Requirement>,~Ops:Type -> Type,~Args:Data,~Error:Data,~Out:Data,~Value:Data,~query:O.Declaration,Ops(Q.Frame),I.Frame,Value>,~body:@-H:Type -> @-caps:Ops(H) -> Args -> H -> H & (T.Outcome & Out),~render:Value -> String) -> (Owners & Exec.Invocation,Q.Error,List<&2,Out>,System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body)>>,Args,Out>) -> (Owners & Exec.Invocation,Q.Error,List<&2,Out>,System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body)>>,Args,Out>) & SP.Plan: 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,~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. 106 def execution_dispatch(~S:Data,~C:Type,~R:Type,~E:Data,~Owners:Type,~Rows:Data,~observe:W.World -> W.World & DTO.Observation,~fold:Owners -> Owners & List<&2,Records.Fields>,~PriorError:Data,~priorPlan:Owners -> Owners & SP.Plan,~priorDispatch:Owners -> Ctx.Context> -> U32 -> Owners & Sys.Outcome>,PriorError,Unit>,~priorProvide:W.World -> W.World & List<&2,SP.Requirement>,~Ops:Type -> Type,~Args:Data,~Error:Data,~Out:Data,~Value:Data,~query:O.Declaration,Ops(Q.Frame),I.Frame,Value>,~body:@-H:Type -> @-caps:Ops(H) -> Args -> H -> H & (T.Outcome & Out),~render:Value -> String) -> (Owners & Exec.Invocation,Q.Error,List<&2,Out>,System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body)>>,Args,Out>) -> Ctx.Context> -> U32 -> (Owners & Exec.Invocation,Q.Error,List<&2,Out>,System.observable_runner(~S,~C,~R,~E,~Ops,~Args,~Error,~Out,~Value,~query,~body)>>,Args,Out>) & Sys.Outcome>,Choice.Choice>,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,~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. 112 def execution_provide(~S:Data,~C:Type,~R:Type,~E:Data,~Owners:Type,~Rows:Data,~observe:W.World -> W.World & DTO.Observation,~fold:Owners -> Owners & List<&2,Records.Fields>,~PriorError:Data,~priorPlan:Owners -> Owners & SP.Plan,~priorDispatch:Owners -> Ctx.Context> -> U32 -> Owners & Sys.Outcome>,PriorError,Unit>,~priorProvide:W.World -> W.World & List<&2,SP.Requirement>,~Ops:Type -> Type,~Args:Data,~Error:Data,~Out:Data,~Value:Data,~query:O.Declaration,Ops(Q.Frame),I.Frame,Value>,~body:@-H:Type -> @-caps:Ops(H) -> Args -> H -> H & (T.Outcome & Out),~render:Value -> String) -> W.World -> W.World & List<&2,SP.Requirement>: 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,~callback_failure(~Error),~RegistrationRefused{},~render)