1 import Base 2 import ./ordinary_app_execution_recipe.bend as Exec 3 import ./ordinary_app_execution_run.bend as ExecuteRun 4 import ./execution_context.bend as Ctx 5 import ./trace_facts.bend as Facts 6 import ./system.bend as Sys 7 import ./schedule.bend as Sch 8 import ./schedule_provision.bend as SP 9 import ./captured_schedule_composition.bend as Choice 10 import ./ordinary_app_composer.bend as Build 11 import ./ordinary_app_records.bend as Pair 12 import ./ordinary_app_recipe.bend as Tree 13 import ./ordinary_app_observation_data.bend as DTO 14 import ./local.bend as Local 15 import ./world.bend as W 16 import ./ordinary_app_registration_fields.bend as Fields 17 import ./ordinary_query_declaration.bend as Query 18 import ./ordinary_resource_system.bend as P 19 import ./transaction.bend as T 20 import ./commands.bend as Cmd 21 import ./capabilities.bend as Cap 22 # One ordinary declaration indexes the runner and registration owner. Local is 23 # returned separately from body Out on both transaction success and failure. 24 def returned(~S:Data,~C:Type,~R:Type,~E:Data,~L:Type,~Error:Data,~Out:Type,local:L,output:Out,result:T.Returned,Error>) -> Local.Outcome,L,Error,Out>: 25 match result: 26 case T.Returned{world,T.Success{}}:Local.Succeeded{world,local,output} 27 case T.Returned{world,T.Failure{error}}:Local.Failed{world,local,error} 28 def finished(~S:Data,~C:Type,~R:Type,~E:Data,~L:Type,~Error:Data,~Out:Type,result:T.Tx,E> & (L & (T.Outcome & Out))) -> Local.Outcome,L,Error,Out>: 29 match result: 30 case (tx,(local,(outcome,output))):returned(~S,~C,~R,~E,~L,~Error,~Out,local,output,Cmd.tx_finish(~S,~C,~R,~E,~Error,tx,outcome)) 31 # Execute one resource declaration/body with opaque Tx capabilities and actual L. 32 # Finish the ECS transaction using the returned outcome. Body-returned Local 33 # persists on success AND failure; failed Out is discarded, not returned as recovery. 34 # Args is consumed by the callback. This is Local execution, not captured-query 35 # state rollback, and arbitrary external callback effects are not transactional. 36 def runner(~S:Data,~C:Type,~R:Type,~E:Data,~L:Type,~Args:Type,~Error:Data,~Out:Type,~Ops:Type -> Type,~declaration:P.Declaration,E>,Ops(T.Tx,E>)>,~body:@-H:Type -> @-caps:Ops(H) -> L -> Args -> H -> H & (L & (T.Outcome & Out)),world:W.World,local:L,args:Args) -> Local.Outcome,L,Error,Out>: 37 finished(~S,~C,~R,~E,~L,~Error,~Out,body(T.Tx,E>,P.grant(~S,~R,~T.Tx,E>,~Ops(T.Tx,E>),declaration),local,args,T.begin(~W.World,~E,world))) 38 # Affine owner of the actual Local.Instance, indexed by declaration and body. 39 # No copied Local payload is retained in registration metadata. 40 type Owner<-S:Data,-C:Type,-R:Type,-E:Data,-L:Type,-Args:Type,-Error:Data,-Out:Type,-Ops:Type -> Type,-declaration:P.Declaration,E>,Ops(T.Tx,E>)>,-body:@-H:Type -> @-caps:Ops(H) -> L -> Args -> H -> H & (L & (T.Outcome & Out))> is Type: 41 Owner{instance:Local.Instance} 42 # Registration success retains Local in owner; refusal returns actual World and 43 # incoming L separately, without running the callback. 44 type Registration<-World:Type,-Owned:Type,-L:Type> is Type: 45 Registered{world:World,owner:Owned} 46 Rejected{world:World,local:L} 47 def registered(~S:Data,~C:Type,~R:Type,~E:Data,~L:Type,~Args:Type,~Error:Data,~Out:Type,~Ops:Type -> Type,~declaration:P.Declaration,E>,Ops(T.Tx,E>)>,~body:@-H:Type -> @-caps:Ops(H) -> L -> Args -> H -> H & (L & (T.Outcome & Out)),result:Local.Registered) -> Registration,Owner,L>: 48 match result: 49 case Local.Registered{world,instance}:Registered{world,Owner{instance}} 50 case Local.RegistrationRejected{world,local}:Rejected{world,local} 51 # Register the Local runner using access derived from the same resource declaration. 52 # Returns Registration with actual owners; does not execute the body or fabricate 53 # a query reader. Closed declarations/projections remain trusted provisioning. 54 def define(~S:Data,~C:Type,~R:Type,~E:Data,~L:Type,~Args:Type,~Error:Data,~Out:Type,~Ops:Type -> Type,~declaration:P.Declaration,E>,Ops(T.Tx,E>)>,~body:@-H:Type -> @-caps:Ops(H) -> L -> Args -> H -> H & (L & (T.Outcome & Out)),world:W.World,name:String,local:L) -> Registration,Owner,L>: 55 registered(~S,~C,~R,~E,~L,~Args,~Error,~Out,~Ops,~declaration,~body,Local.register(~S,~C,~R,~E,~L,~Args,~Error,~Out,~runner(~S,~C,~R,~E,~L,~Args,~Error,~Out,~Ops,~declaration,~body),world,name,P.access(~S,P.clause(~S,~R,~T.Tx,E>,~Ops(T.Tx,E>),declaration)),local)) 56 # Run the retained Local instance after actual registration/World validation. 57 # Completed returns the updated instance and Done(Out) or Fail(Error); callback 58 # failure still retains its returned Local. Refused returns World, instance and 59 # unconsumed Args. No implicit barrier, skip processing or disposal is performed. 60 def run(~S:Data,~C:Type,~R:Type,~E:Data,~L:Type,~Args:Type,~Error:Data,~Out:Type,~Ops:Type -> Type,~declaration:P.Declaration,E>,Ops(T.Tx,E>)>,~body:@-H:Type -> @-caps:Ops(H) -> L -> Args -> H -> H & (L & (T.Outcome & Out)),value:Owner,world:W.World,args:Args) -> Local.Run: 61 match value: 62 case Owner{instance}:Local.run(~S,~C,~R,~E,~L,~Args,~Error,~Out,~runner(~S,~C,~R,~E,~L,~Args,~Error,~Out,~Ops,~declaration,~body),instance,world,args) 63 def field_values(~S:Data,~C:Type,~R:Type,~E:Data,~L:Type,~Args:Type,~Error:Data,~Out:Type,~Ops:Type -> Type,~declaration:P.Declaration,E>,Ops(T.Tx,E>)>,~body:@-H:Type -> @-caps:Ops(H) -> L -> Args -> H -> H & (L & (T.Outcome & Out)),instance:Local.Instance,clause:Query.Clause) -> Owner & Fields.Fields: 64 match instance clause: 65 case Local.Instance{+namespace,+id,+name,+access,local} Query.Clause{+slot,+mode}:(Owner{Local.Instance{namespace,id,name,access,local}},Fields.Fields{namespace,id,name,access,None{},slot,[Query.Clause{slot,mode}],Fields.ResourceKind{mode}}) 66 # Local has no retained query reader cursor; None marks this nonreader metadata. 67 # Project registration fields while returning Owner. Resource slot/mode/access 68 # come from the operational declaration; Local payload remains opaque. The absent cursor 69 # is metadata, not a live lifecycle/event reader position. 70 def fields(~S:Data,~C:Type,~R:Type,~E:Data,~L:Type,~Args:Type,~Error:Data,~Out:Type,~Ops:Type -> Type,~declaration:P.Declaration,E>,Ops(T.Tx,E>)>,~body:@-H:Type -> @-caps:Ops(H) -> L -> Args -> H -> H & (L & (T.Outcome & Out)),value:Owner) -> Owner & Fields.Fields: 71 match value: 72 case Owner{instance}:field_values(~S,~C,~R,~E,~L,~Args,~Error,~Out,~Ops,~declaration,~body,instance,P.clause(~S,~R,~T.Tx,E>,~Ops(T.Tx,E>),declaration)) 73 def fields_list_returned(~S:Data,~C:Type,~R:Type,~E:Data,~L:Type,~Args:Type,~Error:Data,~Out:Type,~Ops:Type -> Type,~declaration:P.Declaration,E>,Ops(T.Tx,E>)>,~body:@-H:Type -> @-caps:Ops(H) -> L -> Args -> H -> H & (L & (T.Outcome & Out)),result:Owner & Fields.Fields) -> Owner & List<&2,Fields.Fields>: 74 match result: 75 case (value,field):(value,[field]) 76 # Advanced singleton registration fold retaining Owner and its actual Local. 77 # Produces metadata only, not an additional resource grant or gameplay invocation. 78 def fold(~S:Data,~C:Type,~R:Type,~E:Data,~L:Type,~Args:Type,~Error:Data,~Out:Type,~Ops:Type -> Type,~declaration:P.Declaration,E>,Ops(T.Tx,E>)>,~body:@-H:Type -> @-caps:Ops(H) -> L -> Args -> H -> H & (L & (T.Outcome & Out)),value:Owner) -> Owner & List<&2,Fields.Fields>: 79 fields_list_returned(~S,~C,~R,~E,~L,~Args,~Error,~Out,~Ops,~declaration,~body,fields(~S,~C,~R,~E,~L,~Args,~Error,~Out,~Ops,~declaration,~body,value)) 80 # Registration into an App either returns the extended App or the prior App shape 81 # with actual incoming Local. No automatic destructor runs on AppendRejected. 82 type Appended<-Before:Type,-After:Type,-L:Type> is Type: 83 Appended{app:After} 84 AppendRejected{app:Before,local:L} 85 # Ordinary registration composes the derived fold itself; application authors 86 # provide only operational declaration/body and Local, never metadata adapters. 87 def appended(~S:Data,~C:Type,~R:Type,~E:Data,~L:Type,~Args:Type,~Error:Data,~Out:Type,~Ops:Type -> Type,~declaration:P.Declaration,E>,Ops(T.Tx,E>)>,~body:@-H:Type -> @-caps:Ops(H) -> L -> Args -> H -> H & (L & (T.Outcome & Out)),~Previous:Type,~Rows:Data,~observe:W.World -> W.World & DTO.Observation,~previousFold:Previous -> Previous & List<&2,Fields.Fields>,previous:Previous,recipe:Tree.Recipe,Rows,observe>,debug:Bool,result:Registration,Owner,L>) -> Appended,Previous,Rows,observe,previousFold>,Build.Registered,Previous & Owner,Rows,observe,Pair.fold_pair(~S,~Previous,~Owner,~previousFold,~fold(~S,~C,~R,~E,~L,~Args,~Error,~Out,~Ops,~declaration,~body))>,L>: 88 match result: 89 case Rejected{world,local}:AppendRejected{Build.Registered{world,previous,recipe,debug},local} 90 case Registered{world,owner}:Appended{Build.Registered{world,(previous,owner),recipe,debug}} 91 # Register into a composer App, deriving the metadata fold and retaining prior 92 # owners/observer/debug. On refusal return prior App shape and Local; does not run 93 # body. See test-fixtures/public-schedules/named-app-v1/matched-feature-v1/fixture.bend. 94 def register(~S:Data,~C:Type,~R:Type,~E:Data,~L:Type,~Args:Type,~Error:Data,~Out:Type,~Ops:Type -> Type,~declaration:P.Declaration,E>,Ops(T.Tx,E>)>,~body:@-H:Type -> @-caps:Ops(H) -> L -> Args -> H -> H & (L & (T.Outcome & Out)),~Previous:Type,~Rows:Data,~observe:W.World -> W.World & DTO.Observation,~previousFold:Previous -> Previous & List<&2,Fields.Fields>,app:Build.Registered,Previous,Rows,observe,previousFold>,name:String,local:L) -> Appended,Previous,Rows,observe,previousFold>,Build.Registered,Previous & Owner,Rows,observe,Pair.fold_pair(~S,~Previous,~Owner,~previousFold,~fold(~S,~C,~R,~E,~L,~Args,~Error,~Out,~Ops,~declaration,~body))>,L>: 95 match app: 96 case Build.Registered{world,previous,recipe,debug}:appended(~S,~C,~R,~E,~L,~Args,~Error,~Out,~Ops,~declaration,~body,~Previous,~Rows,~observe,~previousFold,previous,recipe,debug,define(~S,~C,~R,~E,~L,~Args,~Error,~Out,~Ops,~declaration,~body,world,name,local)) 97 98 # Schedule-facing distinction between callback transaction failure and refused 99 # registration/routing. Neither branch implies Local was rolled back. 100 type ExecutionError is Data: 101 CallbackFailure{error:Error} 102 RegistrationRefused{} 103 # Executable invocation retaining actual Local owner and reusable Data Args. 104 # It stores no Out: schedule execution discards successful Out after completion. 105 type Invocation<-S:Data,-C:Type,-R:Type,-E:Data,-L:Type,-Args:Data,-Error:Data,-Out:Type,-Ops:Type -> Type,-declaration:P.Declaration,E>,Ops(T.Tx,E>)>,-body:@-H:Type -> @-caps:Ops(H) -> L -> Args -> H -> H & (L & (T.Outcome & Out))> is Type: 106 Invocation{owner:Owner,args:Args} 107 def execution_folded(~S:Data,~C:Type,~R:Type,~E:Data,~L:Type,~Args:Data,~Error:Data,~Out:Type,~Ops:Type -> Type,~declaration:P.Declaration,E>,Ops(T.Tx,E>)>,~body:@-H:Type -> @-caps:Ops(H) -> L -> Args -> H -> H & (L & (T.Outcome & Out)),args:Args,result:Owner & List<&2,Fields.Fields>) -> Invocation & List<&2,Fields.Fields>: 108 match result: 109 case (owner,fields):(Invocation{owner,args},fields) 110 # Advanced owner-returning fold of invocation metadata, retaining stored Args. 111 def execution_fields(~S:Data,~C:Type,~R:Type,~E:Data,~L:Type,~Args:Data,~Error:Data,~Out:Type,~Ops:Type -> Type,~declaration:P.Declaration,E>,Ops(T.Tx,E>)>,~body:@-H:Type -> @-caps:Ops(H) -> L -> Args -> H -> H & (L & (T.Outcome & Out)),value:Invocation) -> Invocation & List<&2,Fields.Fields>: 112 match value: 113 case Invocation{owner,args}:execution_folded(~S,~C,~R,~E,~L,~Args,~Error,~Out,~Ops,~declaration,~body,args,fold(~S,~C,~R,~E,~L,~Args,~Error,~Out,~Ops,~declaration,~body,owner)) 114 def execution_planned(~S:Data,~C:Type,~R:Type,~E:Data,~L:Type,~Args:Data,~Error:Data,~Out:Type,~Ops:Type -> Type,~declaration:P.Declaration,E>,Ops(T.Tx,E>)>,~body:@-H:Type -> @-caps:Ops(H) -> L -> Args -> H -> H & (L & (T.Outcome & Out)),args:Args,result:Owner & Fields.Fields) -> Invocation & SP.Plan: 115 match result: 116 case (owner,Fields.Fields{_,id,_,_,_,_,_,_}):(Invocation{owner,args},SP.Entry{Sch.System{id,0},[]}) 117 # Advanced owner-returning single-id plan at condition slot zero with no explicit 118 # requirements. Does not derive requirements from field metadata or run Local. 119 def execution_plan(~S:Data,~C:Type,~R:Type,~E:Data,~L:Type,~Args:Data,~Error:Data,~Out:Type,~Ops:Type -> Type,~declaration:P.Declaration,E>,Ops(T.Tx,E>)>,~body:@-H:Type -> @-caps:Ops(H) -> L -> Args -> H -> H & (L & (T.Outcome & Out)),value:Invocation) -> Invocation & SP.Plan: 120 match value: 121 case Invocation{owner,args}:execution_planned(~S,~C,~R,~E,~L,~Args,~Error,~Out,~Ops,~declaration,~body,args,fields(~S,~C,~R,~E,~L,~Args,~Error,~Out,~Ops,~declaration,~body,owner)) 122 def execution_returned(~S:Data,~C:Type,~R:Type,~E:Data,~L:Type,~Args:Data,~Error:Data,~Out:Type,~Ops:Type -> Type,~declaration:P.Declaration,E>,Ops(T.Tx,E>)>,~body:@-H:Type -> @-caps:Ops(H) -> L -> Args -> H -> H & (L & (T.Outcome & Out)),args:Args,trace:Facts.State,result:Local.Run) -> Invocation & Sys.Outcome>,ExecutionError,Unit>: 123 match result: 124 case Local.Completed{world,instance,Done{_},_}:(Invocation{Owner{instance},args},Sys.Succeeded{Ctx.Context{world,trace},Unit{}}) 125 case Local.Completed{world,instance,Fail{error},_}:(Invocation{Owner{instance},args},Sys.Failed{Ctx.Context{world,trace},CallbackFailure{error}}) 126 case Local.Refused{world,instance,_}:(Invocation{Owner{instance},args},Sys.Failed{Ctx.Context{world,trace},RegistrationRefused{}}) 127 def execution_allowed(~S:Data,~C:Type,~R:Type,~E:Data,~L:Type,~Args:Data,~Error:Data,~Out:Type,~Ops:Type -> Type,~declaration:P.Declaration,E>,Ops(T.Tx,E>)>,~body:@-H:Type -> @-caps:Ops(H) -> L -> Args -> H -> H & (L & (T.Outcome & Out)),valid:Bool,owner:Owner,args:Args,context:Ctx.Context>) -> Invocation & Sys.Outcome>,ExecutionError,Unit>: 128 match valid context: 129 case False{} context:(Invocation{owner,args},Sys.Failed{context,RegistrationRefused{}}) 130 case True{} Ctx.Context{world,trace}: 131 +actual=args 132 execution_returned(~S,~C,~R,~E,~L,~Args,~Error,~Out,~Ops,~declaration,~body,actual,trace,run(~S,~C,~R,~E,~L,~Args,~Error,~Out,~Ops,~declaration,~body,owner,world,actual)) 133 def execution_selected(~S:Data,~C:Type,~R:Type,~E:Data,~L:Type,~Args:Data,~Error:Data,~Out:Type,~Ops:Type -> Type,~declaration:P.Declaration,E>,Ops(T.Tx,E>)>,~body:@-H:Type -> @-caps:Ops(H) -> L -> Args -> H -> H & (L & (T.Outcome & Out)),args:Args,context:Ctx.Context>,id:U32,result:Owner & Fields.Fields) -> Invocation & Sys.Outcome>,ExecutionError,Unit>: 134 match result: 135 case (owner,fields):execution_allowed(~S,~C,~R,~E,~L,~Args,~Error,~Out,~Ops,~declaration,~body,U32.is_eq(id,Exec.registration_id(~S,fields)),owner,args,context) 136 # Advanced id-routed dispatch. Mismatched id returns invocation/context unchanged 137 # with RegistrationRefused. Matched execution preserves reusable Data Args and 138 # retains the returned Local instance; callback failure maps to CallbackFailure, 139 # while successful Out is discarded. Trace context is carried separately. 140 # This adapter installs no skip/cursor-advance or Local disposal callback. 141 def execution_run(~S:Data,~C:Type,~R:Type,~E:Data,~L:Type,~Args:Data,~Error:Data,~Out:Type,~Ops:Type -> Type,~declaration:P.Declaration,E>,Ops(T.Tx,E>)>,~body:@-H:Type -> @-caps:Ops(H) -> L -> Args -> H -> H & (L & (T.Outcome & Out)),value:Invocation,context:Ctx.Context>,id:U32) -> Invocation & Sys.Outcome>,ExecutionError,Unit>: 142 match value: 143 case Invocation{owner,args}:execution_selected(~S,~C,~R,~E,~L,~Args,~Error,~Out,~Ops,~declaration,~body,args,context,id,fields(~S,~C,~R,~E,~L,~Args,~Error,~Out,~Ops,~declaration,~body,owner)) 144 # Advanced execution-enabled App type with prior owners plus Local invocation. 145 # Uses prior observation unchanged and adds registration fields/plan/dispatch; 146 # this does not expose Local to unrelated systems or reset it on failed execution. 147 def Executable(~S:Data,~C:Type,~R:Type,~E:Data,~L:Type,~Args:Data,~Error:Data,~Out:Type,~Ops:Type -> Type,~declaration:P.Declaration,E>,Ops(T.Tx,E>)>,~body:@-H:Type -> @-caps:Ops(H) -> L -> Args -> H -> H & (L & (T.Outcome & Out)),~Previous:Type,~Rows:Data,~observe:W.World -> W.World & DTO.Observation,~previousFold:Previous -> Previous & List<&2,Fields.Fields>,~PriorError:Data,~priorPlan:Previous -> Previous & SP.Plan,~priorDispatch:Previous -> Ctx.Context> -> U32 -> Previous & Sys.Outcome>,PriorError,Unit>,~priorProvide:W.World -> W.World & List<&2,SP.Requirement>) -> Type: 148 Exec.Registered,Previous & Invocation,Rows,observe,Pair.fold_pair(~S,~Previous,~Invocation,~previousFold,~execution_fields(~S,~C,~R,~E,~L,~Args,~Error,~Out,~Ops,~declaration,~body)),Choice.Choice>,Exec.plan_pair(~S,~Previous,~Invocation,~priorPlan,~execution_plan(~S,~C,~R,~E,~L,~Args,~Error,~Out,~Ops,~declaration,~body)),Exec.dispatch_pair(~S,~W.World,~Previous,~Invocation,~PriorError,~ExecutionError,~previousFold,~priorDispatch,~execution_run(~S,~C,~R,~E,~L,~Args,~Error,~Out,~Ops,~declaration,~body)),Exec.provision_pair(~S,~W.World,~priorProvide,~Exec.empty_provide(~S,~W.World))> 149 def execution_added(~S:Data,~C:Type,~R:Type,~E:Data,~L:Type,~Args:Data,~Error:Data,~Out:Type,~Ops:Type -> Type,~declaration:P.Declaration,E>,Ops(T.Tx,E>)>,~body:@-H:Type -> @-caps:Ops(H) -> L -> Args -> H -> H & (L & (T.Outcome & Out)),~Previous:Type,~Rows:Data,~observe:W.World -> W.World & DTO.Observation,~previousFold:Previous -> Previous & List<&2,Fields.Fields>,~PriorError:Data,~priorPlan:Previous -> Previous & SP.Plan,~priorDispatch:Previous -> Ctx.Context> -> U32 -> Previous & Sys.Outcome>,PriorError,Unit>,~priorProvide:W.World -> W.World & List<&2,SP.Requirement>,args:Args,previous:Previous,recipe:Tree.Recipe,Rows,observe>,debug:Bool,result:Registration,Owner,L>) -> Appended,Previous,Rows,observe,previousFold,PriorError,priorPlan,priorDispatch,priorProvide>,Executable(~S,~C,~R,~E,~L,~Args,~Error,~Out,~Ops,~declaration,~body,~Previous,~Rows,~observe,~previousFold,~PriorError,~priorPlan,~priorDispatch,~priorProvide),L>: 150 match result: 151 case Rejected{world,local}:AppendRejected{Exec.Registered{Build.Registered{world,previous,recipe,debug},Exec.Recipe{}},local} 152 case Registered{world,owner}:Appended{Exec.Registered{Build.Registered{world,(previous,Invocation{owner,args}),recipe,debug},Exec.Recipe{}}} 153 # Register Local and Data Args into an execution-enabled App, deriving composition 154 # from the declaration. Refusal returns prior App and actual L; success retains 155 # L and Args for later dispatch. No run, condition skip or disposal happens here. 156 # Explicit lifecycle cleanup remains in local.bend rather than an implicit finalizer. 157 def add(~S:Data,~C:Type,~R:Type,~E:Data,~L:Type,~Args:Data,~Error:Data,~Out:Type,~Ops:Type -> Type,~declaration:P.Declaration,E>,Ops(T.Tx,E>)>,~body:@-H:Type -> @-caps:Ops(H) -> L -> Args -> H -> H & (L & (T.Outcome & Out)),~Previous:Type,~Rows:Data,~observe:W.World -> W.World & DTO.Observation,~previousFold:Previous -> Previous & List<&2,Fields.Fields>,~PriorError:Data,~priorPlan:Previous -> Previous & SP.Plan,~priorDispatch:Previous -> Ctx.Context> -> U32 -> Previous & Sys.Outcome>,PriorError,Unit>,~priorProvide:W.World -> W.World & List<&2,SP.Requirement>,value:Exec.Registered,Previous,Rows,observe,previousFold,PriorError,priorPlan,priorDispatch,priorProvide>,name:String,local:L,args:Args) -> Appended,Previous,Rows,observe,previousFold,PriorError,priorPlan,priorDispatch,priorProvide>,Executable(~S,~C,~R,~E,~L,~Args,~Error,~Out,~Ops,~declaration,~body,~Previous,~Rows,~observe,~previousFold,~PriorError,~priorPlan,~priorDispatch,~priorProvide),L>: 158 match value: 159 case Exec.Registered{Build.Registered{world,previous,recipe,debug},_}:execution_added(~S,~C,~R,~E,~L,~Args,~Error,~Out,~Ops,~declaration,~body,~Previous,~Rows,~observe,~previousFold,~PriorError,~priorPlan,~priorDispatch,~priorProvide,args,previous,recipe,debug,define(~S,~C,~R,~E,~L,~Args,~Error,~Out,~Ops,~declaration,~body,world,name,local)) 160 # Advanced type projection of prior owners paired with actual Local invocation. 161 def execution_owners(~S:Data,~C:Type,~R:Type,~E:Data,~L:Type,~Args:Data,~Error:Data,~Out:Type,~Ops:Type -> Type,~declaration:P.Declaration,E>,Ops(T.Tx,E>)>,~body:@-H:Type -> @-caps:Ops(H) -> L -> Args -> H -> H & (L & (T.Outcome & Out)),~Previous:Type,~Rows:Data,~observe:W.World -> W.World & DTO.Observation,~previousFold:Previous -> Previous & List<&2,Fields.Fields>,~PriorError:Data,~priorPlan:Previous -> Previous & SP.Plan,~priorDispatch:Previous -> Ctx.Context> -> U32 -> Previous & Sys.Outcome>,PriorError,Unit>,~priorProvide:W.World -> W.World & List<&2,SP.Requirement>) -> Type: 162 Previous & Invocation 163 # Advanced detached row projection: Local adds metadata, not observation rows. 164 def execution_rows(~S:Data,~C:Type,~R:Type,~E:Data,~L:Type,~Args:Data,~Error:Data,~Out:Type,~Ops:Type -> Type,~declaration:P.Declaration,E>,Ops(T.Tx,E>)>,~body:@-H:Type -> @-caps:Ops(H) -> L -> Args -> H -> H & (L & (T.Outcome & Out)),~Previous:Type,~Rows:Data,~observe:W.World -> W.World & DTO.Observation,~previousFold:Previous -> Previous & List<&2,Fields.Fields>,~PriorError:Data,~priorPlan:Previous -> Previous & SP.Plan,~priorDispatch:Previous -> Ctx.Context> -> U32 -> Previous & Sys.Outcome>,PriorError,Unit>,~priorProvide:W.World -> W.World & List<&2,SP.Requirement>) -> Data: 165 Rows 166 # Advanced observer projection retaining the prior observer exactly; Local is 167 # not automatically rendered or inspected by this adapter. 168 def execution_observe(~S:Data,~C:Type,~R:Type,~E:Data,~L:Type,~Args:Data,~Error:Data,~Out:Type,~Ops:Type -> Type,~declaration:P.Declaration,E>,Ops(T.Tx,E>)>,~body:@-H:Type -> @-caps:Ops(H) -> L -> Args -> H -> H & (L & (T.Outcome & Out)),~Previous:Type,~Rows:Data,~observe:W.World -> W.World & DTO.Observation,~previousFold:Previous -> Previous & List<&2,Fields.Fields>,~PriorError:Data,~priorPlan:Previous -> Previous & SP.Plan,~priorDispatch:Previous -> Ctx.Context> -> U32 -> Previous & Sys.Outcome>,PriorError,Unit>,~priorProvide:W.World -> W.World & List<&2,SP.Requirement>) -> W.World -> W.World & DTO.Observation: 169 observe 170 # Advanced closed fold of prior fields followed by Local invocation metadata. 171 def execution_fold(~S:Data,~C:Type,~R:Type,~E:Data,~L:Type,~Args:Data,~Error:Data,~Out:Type,~Ops:Type -> Type,~declaration:P.Declaration,E>,Ops(T.Tx,E>)>,~body:@-H:Type -> @-caps:Ops(H) -> L -> Args -> H -> H & (L & (T.Outcome & Out)),~Previous:Type,~Rows:Data,~observe:W.World -> W.World & DTO.Observation,~previousFold:Previous -> Previous & List<&2,Fields.Fields>,~PriorError:Data,~priorPlan:Previous -> Previous & SP.Plan,~priorDispatch:Previous -> Ctx.Context> -> U32 -> Previous & Sys.Outcome>,PriorError,Unit>,~priorProvide:W.World -> W.World & List<&2,SP.Requirement>) -> (Previous & Invocation) -> (Previous & Invocation) & List<&2,Fields.Fields>: 172 Pair.fold_pair(~S,~Previous,~Invocation,~previousFold,~execution_fields(~S,~C,~R,~E,~L,~Args,~Error,~Out,~Ops,~declaration,~body)) 173 # Advanced closed plan composition: prior plan then Local id, retaining owners. 174 def composed_plan(~S:Data,~C:Type,~R:Type,~E:Data,~L:Type,~Args:Data,~Error:Data,~Out:Type,~Ops:Type -> Type,~declaration:P.Declaration,E>,Ops(T.Tx,E>)>,~body:@-H:Type -> @-caps:Ops(H) -> L -> Args -> H -> H & (L & (T.Outcome & Out)),~Previous:Type,~Rows:Data,~observe:W.World -> W.World & DTO.Observation,~previousFold:Previous -> Previous & List<&2,Fields.Fields>,~PriorError:Data,~priorPlan:Previous -> Previous & SP.Plan,~priorDispatch:Previous -> Ctx.Context> -> U32 -> Previous & Sys.Outcome>,PriorError,Unit>,~priorProvide:W.World -> W.World & List<&2,SP.Requirement>) -> (Previous & Invocation) -> (Previous & Invocation) & SP.Plan: 175 Exec.plan_pair(~S,~Previous,~Invocation,~priorPlan,~execution_plan(~S,~C,~R,~E,~L,~Args,~Error,~Out,~Ops,~declaration,~body)) 176 # Advanced closed routing to prior or Local invocation with tagged error branches. 177 # Dispatch preserves actual owners; it is not a shared Local or capture transaction. 178 def execution_dispatch(~S:Data,~C:Type,~R:Type,~E:Data,~L:Type,~Args:Data,~Error:Data,~Out:Type,~Ops:Type -> Type,~declaration:P.Declaration,E>,Ops(T.Tx,E>)>,~body:@-H:Type -> @-caps:Ops(H) -> L -> Args -> H -> H & (L & (T.Outcome & Out)),~Previous:Type,~Rows:Data,~observe:W.World -> W.World & DTO.Observation,~previousFold:Previous -> Previous & List<&2,Fields.Fields>,~PriorError:Data,~priorPlan:Previous -> Previous & SP.Plan,~priorDispatch:Previous -> Ctx.Context> -> U32 -> Previous & Sys.Outcome>,PriorError,Unit>,~priorProvide:W.World -> W.World & List<&2,SP.Requirement>) -> (Previous & Invocation) -> Ctx.Context> -> U32 -> (Previous & Invocation) & Sys.Outcome>,Choice.Choice>,Unit>: 179 Exec.dispatch_pair(~S,~W.World,~Previous,~Invocation,~PriorError,~ExecutionError,~previousFold,~priorDispatch,~execution_run(~S,~C,~R,~E,~L,~Args,~Error,~Out,~Ops,~declaration,~body)) 180 # Advanced provisioning composition: preserve prior provisioning and add no 181 # extra requirements for this Local registration. 182 def execution_provide(~S:Data,~C:Type,~R:Type,~E:Data,~L:Type,~Args:Data,~Error:Data,~Out:Type,~Ops:Type -> Type,~declaration:P.Declaration,E>,Ops(T.Tx,E>)>,~body:@-H:Type -> @-caps:Ops(H) -> L -> Args -> H -> H & (L & (T.Outcome & Out)),~Previous:Type,~Rows:Data,~observe:W.World -> W.World & DTO.Observation,~previousFold:Previous -> Previous & List<&2,Fields.Fields>,~PriorError:Data,~priorPlan:Previous -> Previous & SP.Plan,~priorDispatch:Previous -> Ctx.Context> -> U32 -> Previous & Sys.Outcome>,PriorError,Unit>,~priorProvide:W.World -> W.World & List<&2,SP.Requirement>) -> W.World -> W.World & List<&2,SP.Requirement>: 183 Exec.provision_pair(~S,~W.World,~priorProvide,~Exec.empty_provide(~S,~W.World))