@wowok/agent-mcp 3.2.2 → 3.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (163) hide show
  1. package/dist/chain-semantics/field-capability.d.ts +11 -0
  2. package/dist/chain-semantics/field-capability.js +1 -0
  3. package/dist/chain-semantics/freeze-map.d.ts +11 -0
  4. package/dist/chain-semantics/freeze-map.js +1 -0
  5. package/dist/chain-semantics/fund-flow.d.ts +10 -0
  6. package/dist/chain-semantics/fund-flow.js +1 -0
  7. package/dist/chain-semantics/guard-verbs.d.ts +22 -0
  8. package/dist/chain-semantics/guard-verbs.js +1 -0
  9. package/dist/chain-semantics/index.d.ts +10 -0
  10. package/dist/chain-semantics/index.js +1 -0
  11. package/dist/chain-semantics/object-graph.d.ts +18 -0
  12. package/dist/chain-semantics/object-graph.js +1 -0
  13. package/dist/communication/proof-reuse.d.ts +9 -0
  14. package/dist/communication/proof-reuse.js +1 -0
  15. package/dist/composition/audit.d.ts +10 -0
  16. package/dist/composition/audit.js +1 -0
  17. package/dist/composition/compile.d.ts +38 -0
  18. package/dist/composition/compile.js +1 -0
  19. package/dist/composition/materialize.d.ts +64 -0
  20. package/dist/composition/materialize.js +1 -0
  21. package/dist/composition/plan.d.ts +92 -0
  22. package/dist/composition/plan.js +1 -0
  23. package/dist/composition/reflux.d.ts +28 -0
  24. package/dist/composition/reflux.js +1 -0
  25. package/dist/evaluation/builtins/graph-service.spec.js +1 -1
  26. package/dist/evaluation/engine.js +1 -1
  27. package/dist/experience/realtime-feedback.js +1 -1
  28. package/dist/extensions/business-modules.js +1 -1
  29. package/dist/extensions/industry-pack.js +1 -1
  30. package/dist/extensions/modes.js +1 -1
  31. package/dist/graph/onchain/expand.js +1 -1
  32. package/dist/graph/onchain/exposure.js +1 -1
  33. package/dist/graph/onchain/facts.js +1 -1
  34. package/dist/harness/recover.js +1 -1
  35. package/dist/keeper/detectors.d.ts +7 -0
  36. package/dist/keeper/detectors.js +1 -1
  37. package/dist/keeper/types.d.ts +1 -1
  38. package/dist/keeper/types.js +1 -1
  39. package/dist/knowledge/allocation-ledger.js +1 -1
  40. package/dist/knowledge/allocation-puzzle.js +1 -1
  41. package/dist/knowledge/allocation-risk.js +1 -1
  42. package/dist/knowledge/allocation-templates.js +1 -1
  43. package/dist/knowledge/arb-fund-facts.d.ts +31 -0
  44. package/dist/knowledge/arb-fund-facts.js +1 -0
  45. package/dist/knowledge/baselines/rules/allocation.json +44 -15
  46. package/dist/knowledge/baselines/rules/guard.json +27 -8
  47. package/dist/knowledge/baselines/rules/plan.json +161 -0
  48. package/dist/knowledge/baselines/semantic-facts.d.ts +12 -0
  49. package/dist/knowledge/baselines/semantic-facts.js +1 -0
  50. package/dist/knowledge/builtin-templates.d.ts +1 -1
  51. package/dist/knowledge/builtin-templates.js +1 -1
  52. package/dist/knowledge/getting-started.js +1 -1
  53. package/dist/knowledge/guard-bindings.js +1 -1
  54. package/dist/knowledge/guard-design-patterns.d.ts +1 -1
  55. package/dist/knowledge/guard-design-patterns.js +1 -1
  56. package/dist/knowledge/guard-ledger.js +1 -1
  57. package/dist/knowledge/guard-risk.js +1 -1
  58. package/dist/knowledge/guard-templates.js +1 -1
  59. package/dist/knowledge/index.js +1 -1
  60. package/dist/knowledge/industry-registry.js +1 -1
  61. package/dist/knowledge/jsonrpc-enum.js +1 -1
  62. package/dist/knowledge/machine-ledger.js +1 -1
  63. package/dist/knowledge/machine-templates.js +1 -1
  64. package/dist/knowledge/onchain-constants.d.ts +2 -2
  65. package/dist/knowledge/onchain-constants.js +1 -1
  66. package/dist/knowledge/progress-ledger.js +1 -1
  67. package/dist/knowledge/scenario-modes.d.ts +13 -0
  68. package/dist/knowledge/service-allocation-semantics.js +1 -1
  69. package/dist/knowledge/service-ledger.js +1 -1
  70. package/dist/knowledge/service-templates.js +1 -1
  71. package/dist/knowledge/strategy-manuals.js +1 -1
  72. package/dist/knowledge/template-loader.d.ts +17 -1
  73. package/dist/knowledge/template-loader.js +1 -1
  74. package/dist/knowledge/template-registry.js +1 -1
  75. package/dist/knowledge/template-scanner.js +1 -1
  76. package/dist/knowledge/tools-reference.js +1 -1
  77. package/dist/knowledge/workflow-guidance.js +1 -1
  78. package/dist/monitor/MonitorLoop.js +1 -1
  79. package/dist/participation/radar-core.d.ts +6 -0
  80. package/dist/participation/radar-core.js +1 -1
  81. package/dist/playbooks/service-build/business-puzzle.js +1 -1
  82. package/dist/playbooks/service-build/machine-panorama.js +1 -1
  83. package/dist/playbooks/service-build/merchant-guide.js +1 -1
  84. package/dist/playbooks/service-build/migration-planner.js +1 -1
  85. package/dist/playbooks/service-build/object-panorama.js +1 -1
  86. package/dist/playbooks/service-build/participation-radar.js +1 -1
  87. package/dist/playbooks/service-build/relationship-profile.js +1 -1
  88. package/dist/playbooks/service-build/service-panorama.js +1 -1
  89. package/dist/playbooks/service-build/service-quote.js +1 -1
  90. package/dist/playbooks/service-build/service-quote.spec.d.ts +1 -0
  91. package/dist/playbooks/service-build/service-quote.spec.js +1 -0
  92. package/dist/review/index.js +1 -1
  93. package/dist/safety/confirm-gate.js +1 -1
  94. package/dist/schema/call/arbitration.js +1 -1
  95. package/dist/schema/call/base.d.ts +4 -0
  96. package/dist/schema/call/base.js +1 -1
  97. package/dist/schema/call/bridge.d.ts +1 -0
  98. package/dist/schema/call/error-codes.d.ts +1 -1
  99. package/dist/schema/call/error-codes.js +1 -1
  100. package/dist/schema/call/machine.js +1 -1
  101. package/dist/schema/call/order.d.ts +60 -0
  102. package/dist/schema/call/order.js +1 -1
  103. package/dist/schema/call/semantic.js +1 -1
  104. package/dist/schema/call/service.d.ts +56 -0
  105. package/dist/schema/call/service.js +1 -1
  106. package/dist/schema/common/index.js +1 -1
  107. package/dist/schema/index.d.ts +1 -0
  108. package/dist/schema/index.js +1 -1
  109. package/dist/schema/industry-pack/index.d.ts +2 -0
  110. package/dist/schema/industry-pack/index.js +1 -1
  111. package/dist/schema/interaction/index.d.ts +1 -1
  112. package/dist/schema/local/index.d.ts +10 -0
  113. package/dist/schema/local/index.js +1 -1
  114. package/dist/schema/operations.d.ts +48 -0
  115. package/dist/schema/query/bi.d.ts +26 -0
  116. package/dist/schema/query/bi.js +1 -1
  117. package/dist/schema/query/index.js +1 -1
  118. package/dist/schema/schema-version.js +1 -1
  119. package/dist/schema/service-clone/index.d.ts +46 -0
  120. package/dist/schema/service-clone/index.js +1 -0
  121. package/dist/schema-query-impl/index.js +1 -1
  122. package/dist/schemas/account_operation.output.json +1 -0
  123. package/dist/schemas/bridge_operation.output.json +1 -0
  124. package/dist/schemas/index.json +7 -1
  125. package/dist/schemas/industry_pack_operation.output.json +4 -0
  126. package/dist/schemas/industry_pack_operation.schema.json +4 -0
  127. package/dist/schemas/local_cache_operation.output.json +1 -0
  128. package/dist/schemas/local_history_operation.output.json +1 -0
  129. package/dist/schemas/local_info_operation.output.json +1 -0
  130. package/dist/schemas/local_mark_operation.output.json +1 -0
  131. package/dist/schemas/onchain_operations.output.json +2 -1
  132. package/dist/schemas/onchain_operations.schema.json +408 -97
  133. package/dist/schemas/onchain_operations_allocation.schema.json +5 -5
  134. package/dist/schemas/onchain_operations_arbitration.schema.json +3 -3
  135. package/dist/schemas/onchain_operations_contact.schema.json +1 -1
  136. package/dist/schemas/onchain_operations_demand.schema.json +3 -3
  137. package/dist/schemas/onchain_operations_gen_passport.schema.json +1 -1
  138. package/dist/schemas/onchain_operations_guard.schema.json +59 -59
  139. package/dist/schemas/onchain_operations_machine.schema.json +2 -2
  140. package/dist/schemas/onchain_operations_order.schema.json +133 -1
  141. package/dist/schemas/onchain_operations_progress.schema.json +1 -1
  142. package/dist/schemas/onchain_operations_proof.schema.json +1 -1
  143. package/dist/schemas/onchain_operations_repository.schema.json +1 -1
  144. package/dist/schemas/onchain_operations_reward.schema.json +4 -4
  145. package/dist/schemas/onchain_operations_service.schema.json +187 -8
  146. package/dist/schemas/onchain_operations_treasury.schema.json +7 -7
  147. package/dist/schemas/query_toolkit.output.json +136 -52
  148. package/dist/schemas/service_clone_operation.output.json +168 -0
  149. package/dist/schemas/service_clone_operation.schema.json +49 -0
  150. package/dist/schemas/workflow_operation.schema.json +1 -1
  151. package/dist/tools/handlers/config.js +1 -1
  152. package/dist/tools/handlers/industry-pack.js +1 -1
  153. package/dist/tools/handlers/messenger.js +1 -1
  154. package/dist/tools/handlers/onchain.js +1 -1
  155. package/dist/tools/handlers/query.js +1 -1
  156. package/dist/tools/handlers/service-clone.d.ts +2 -0
  157. package/dist/tools/handlers/service-clone.js +1 -0
  158. package/dist/tools/index.js +1 -1
  159. package/dist/tools/move-fn-index.gen.js +1 -1
  160. package/dist/tools/registry/business.js +1 -1
  161. package/dist/tools/wrap.d.ts +6 -1
  162. package/dist/tools/wrap.js +1 -1
  163. package/package.json +2 -2
@@ -1 +1 @@
1
- import{findScene,inferSceneFromFlow}from'./machine-ledger.js';export const MACHINE_TEMPLATES=[{'id':'tpl_machine_ecommerce_standard','scene_id':'ecommerce_standard','name':'Standard\x20E-commerce\x20Flow','description':'Linear\x20e-commerce\x20workflow:\x20Paid\x20(entry)\x20->\x20Ship\x20->\x20Receive\x20->\x20Complete.\x20'+'Payment\x20is\x20handled\x20by\x20the\x20Service\x20buy\x20flow\x20(direct\x20or\x20Passport-gated\x20purchase)\x20atomically;\x20Machine\x20starts\x20at\x20post-payment\x20state.\x20'+'Reaching\x20Complete\x20does\x20NOT\x20move\x20funds\x20—\x20allocation\x20is\x20a\x20separate\x20submitted\x20call\x20and\x20allocation.move\x20has\x20no\x20timer,\x20'+'so\x20a\x20keeper\x20(merchant\x20or\x20buyer-side\x20trigger)\x20must\x20fire\x20it\x20or\x20the\x20order\x20stays\x20settled-but-unpaid.\x20Recommended\x20baseline\x20for\x20new\x20merchants.','recommended_patterns':['P-M-SEQ'],'recommended_topology':['P-M-LINEAR'],'parameters':[{'name':'merchant_permission','type':'permission_ref','required':!![],'description':'Merchant\x20Permission\x20object\x20address\x20or\x20name\x20(must\x20have\x20custom\x20indices\x20defined)','constraint':'Permission\x20must\x20already\x20be\x20created;\x20index\x202\x20(merchant)\x20and\x20index\x203\x20(admin)\x20recommended'},{'name':'ship_forward_name','type':'string','required':!![],'default':'Ship','description':'Forward\x20name\x20for\x20shipping\x20step','constraint':'Must\x20be\x20<64\x20BCS\x20bytes;\x20only\x20letters/digits/underscore'},{'name':'receive_forward_name','type':'string','required':!![],'default':'Receive','description':'Forward\x20name\x20for\x20customer\x20receipt\x20confirmation'},{'name':'complete_node_name','type':'string','required':!![],'default':'Complete','description':'Terminal\x20node\x20name\x20triggering\x20fund\x20allocation'}],'example_nodes':[{'name':'Paid','description':'Entry:\x20order\x20created\x20and\x20paid\x20via\x20Service.buy();\x20Machine\x20starts\x20here'},{'name':'Shipped','description':'Goods\x20dispatched'},{'name':'Received','description':'Customer\x20confirmed\x20receipt'},{'name':'${complete_node_name}','description':'Terminal:\x20triggers\x20allocation'}],'example_pairs':[{'prev_node':'','next_node':'Paid','threshold':0x1,'forwards':[{'name':'Enter','weight':0x1,'named_operator':'','permission_index':0x0}]},{'prev_node':'Paid','next_node':'Shipped','threshold':0x1,'forwards':[{'name':'${ship_forward_name}','weight':0x1,'permission_index':0x2,'named_operator':''}]},{'prev_node':'Shipped','next_node':'Received','threshold':0x1,'forwards':[{'name':'${receive_forward_name}','weight':0x1,'named_operator':'','permission_index':0x0}]},{'prev_node':'Received','next_node':'${complete_node_name}','threshold':0x1,'forwards':[{'name':'Finish','weight':0x1,'permission_index':0x2,'named_operator':''}]}],'required_guards':[],'required_permissions':[{'index':0x2,'name':'merchant','description':'Merchant\x20role\x20for\x20Ship\x20+\x20Finish'},{'index':0x3,'name':'admin','description':'Admin\x20override\x20(optional)'}],'required_allocators':[{'name':'MerchantAllocation','trigger_node':'${complete_node_name}','description':'100%\x20to\x20merchant\x20Treasury\x20or\x20personal\x20address'}],'forkable_fields':['node_names','forward_names','thresholds','additional_branches'],'applicable_industries':['ecommerce','retail'],'relevant_risks':['R-M1-01','R-M1-02','R-M1-08','R-M2-01','R-M3-02','R-M4-01'],'creation_notes':['Build\x20order:\x20Permission\x20->\x20Machine\x20(unpublished)\x20->\x20Guards\x20->\x20Bind\x20guards\x20->\x20Publish\x20->\x20Bind\x20to\x20Service','First\x20node\x20\x27Paid\x27\x20represents\x20post-payment\x20state\x20—\x20Service.buy()\x20completes\x20payment\x20atomically\x20before\x20Progress\x20is\x20created','No\x20separate\x20\x27Order\x27\x20or\x20\x27Pay\x27\x20nodes\x20needed\x20—\x20payment\x20is\x20handled\x20by\x20Service.buy(),\x20not\x20Machine','Entry\x20point:\x20prev_node=\x27\x27\x20(empty\x20string)\x20targets\x20\x27Paid\x27\x20—\x20at\x20least\x20one\x20Pair\x20must\x20exist\x20with\x20empty\x20prev_node','If\x20using\x20P16\x20circular\x20reference\x20for\x20Service,\x20use\x20name\x20not\x20address\x20(Service\x20not\x20yet\x20published)'],'example_use_case':'Small\x20e-commerce\x20shop\x20selling\x20camera\x20accessories.\x20Linear\x20flow\x20with\x20no\x20exceptions.\x20'+'Funds\x20allocated\x20to\x20merchant\x20personal\x20address\x20on\x20Complete.','publish_checklist':['All\x204\x20nodes\x20have\x20at\x20least\x20one\x20outgoing\x20Forward\x20(except\x20terminal)','Entry\x20Pair\x20exists\x20(prev_node=\x27\x27\x20targets\x20\x27Paid\x27)','permissionIndex\x20values\x20match\x20Permission\x20object\x20indices','Test\x20Progress\x20run\x20on\x20testnet','machineNode2file\x20export\x20as\x20backup']},{'id':'tpl_machine_ecommerce_exceptions','scene_id':'ecommerce_with_exceptions','name':'E-commerce\x20Flow\x20with\x20Exception\x20Branches','description':'Multi-path\x20workflow:\x20Paid\x20(entry)\x20->\x20Ship\x20->\x20Receive/Lost/Return.\x20Lost\x20uses\x20dual-sig\x20(threshold=2).\x20'+'Payment\x20is\x20handled\x20by\x20Service.buy()\x20atomically;\x20Machine\x20starts\x20at\x20post-payment\x20state.\x20'+'Return\x20path\x20opens\x20Refund\x20->\x20Complete.\x20Competing\x20pairs\x20first-wins.','recommended_patterns':['P-M-SEQ','P-M-COMPETING'],'recommended_topology':['P-M-LINEAR','P-M-COMPETING'],'parameters':[{'name':'merchant_permission','type':'permission_ref','required':!![],'description':'Merchant\x20Permission\x20object'},{'name':'lost_threshold','type':'number','required':!![],'default':'2','description':'Threshold\x20for\x20dual-sig\x20on\x20Lost\x20node','constraint':'Must\x20be\x202\x20(customer\x20+\x20merchant)'},{'name':'arbitration_ref','type':'arbitration_ref','required':![],'description':'Arbitration\x20object\x20if\x20Lost\x20escalates\x20to\x20arbitration'},{'name':'time_guard_days','type':'number','required':!![],'default':'10','description':'Days\x20before\x20auto-complete\x20trigger\x20(time\x20guard)','constraint':'Must\x20be\x20>\x200;\x20reasonable\x20range\x207-30'},{'name':'return_node_name','type':'string','required':!![],'default':'Return','description':'Name\x20of\x20the\x20return/refund\x20node\x20in\x20the\x20exception\x20branch'}],'example_nodes':[{'name':'Paid','description':'Entry:\x20order\x20created\x20and\x20paid\x20via\x20Service.buy();\x20Machine\x20starts\x20here'},{'name':'Shipped'},{'name':'Received'},{'name':'Lost'},{'name':'Return'},{'name':'Refund'},{'name':'Complete'}],'example_pairs':[{'prev_node':'','next_node':'Paid','threshold':0x1,'forwards':[{'name':'Enter','weight':0x1,'named_operator':''}]},{'prev_node':'Paid','next_node':'Shipped','threshold':0x1,'forwards':[{'name':'Ship','weight':0x1,'permission_index':0x2}]},{'prev_node':'Shipped','next_node':'Received','threshold':0x1,'forwards':[{'name':'ConfirmReceive','weight':0x1,'named_operator':''}]},{'prev_node':'Shipped','next_node':'Lost','threshold':'${lost_threshold}','forwards':[{'name':'CustomerReport','weight':0x1,'named_operator':''},{'name':'MerchantConfirm','weight':0x1,'permission_index':0x2}]},{'prev_node':'Shipped','next_node':'Return','threshold':0x1,'forwards':[{'name':'RequestReturn','weight':0x1,'named_operator':''}]},{'prev_node':'Received','next_node':'Complete','threshold':0x1,'forwards':[{'name':'TimeGuard','weight':0x1,'permission_index':0x3,'guard':'time_guard_${time_guard_days}_days'},{'name':'MerchantFinish','weight':0x1,'permission_index':0x2}]},{'prev_node':'Return','next_node':'Refund','threshold':0x1,'forwards':[{'name':'IssueRefund','weight':0x1,'permission_index':0x2}]},{'prev_node':'Refund','next_node':'Complete','threshold':0x1,'forwards':[{'name':'CloseReturn','weight':0x1,'permission_index':0x2}]}],'required_guards':[{'guard_template_id':'tpl_forward_node_check','bound_to_forward':'MerchantConfirm','purpose':'Dual-sig\x20on\x20Lost\x20node'},{'guard_template_id':'tpl_forward_node_check','bound_to_forward':'TimeGuard','purpose':'Time\x20lock\x20${time_guard_days}\x20days'}],'required_permissions':[{'index':0x2,'name':'merchant','description':'Merchant\x20role'},{'index':0x3,'name':'admin','description':'Admin\x20/\x20time-guard\x20trigger'}],'required_allocators':[{'name':'CompleteAllocation','trigger_node':'Complete','description':'Full\x20allocation\x20to\x20merchant\x20on\x20normal\x20completion'},{'name':'RefundAllocation','trigger_node':'Refund','description':'Full\x20refund\x20to\x20customer\x20on\x20return'},{'name':'LostAllocation','trigger_node':'Lost','description':'Optional:\x20partial\x20refund\x20or\x20escrow\x20(depends\x20on\x20policy)'}],'forkable_fields':['node_names','branch_conditions','time_guard_days','lost_threshold'],'applicable_industries':['ecommerce','logistics'],'relevant_risks':['R-M1-01','R-M1-03','R-M1-08','R-M2-01','R-M2-05','R-M3-02','R-M3-04','R-M3-05','R-M4-01','R-M5-03'],'creation_notes':['First\x20node\x20\x27Paid\x27\x20represents\x20post-payment\x20state\x20—\x20Service.buy()\x20completes\x20payment\x20atomically\x20before\x20Progress\x20is\x20created','No\x20separate\x20\x27Order\x27\x20or\x20\x27Pay\x27\x20nodes\x20needed\x20—\x20payment\x20is\x20handled\x20by\x20Service.buy(),\x20not\x20Machine','Competing\x20Pairs\x20(Shipped\x20->\x20Received/Lost/Return)\x20are\x20mutually\x20exclusive\x20—\x20first\x20threshold\x20met\x20wins','Lost\x20node\x20threshold=2\x20means\x20BOTH\x20customer\x20and\x20merchant\x20Forwards\x20must\x20execute','TimeGuard\x20must\x20use\x20context(Clock)\x20>=\x20progress.current_time\x20+\x20duration\x20(progress.move\x20exposes\x20current_time,\x20refreshed\x20on\x20every\x20node\x20transition\x20—\x20there\x20is\x20no\x20entry_time\x20field)','If\x20Lost\x20escalates\x20to\x20arbitration,\x20bind\x20arbitration_usage_guard\x20on\x20Lost\x20forward','Refund\x20Allocation\x20must\x20use\x20sharing.who=OrderHolder\x20(refund\x20to\x20customer,\x20NOT\x20merchant)'],'example_use_case':'Mid-size\x20e-commerce\x20with\x207-day\x20return\x20policy\x20and\x20dispute\x20handling.\x20'+'Lost\x20claims\x20require\x20customer+merchant\x20dual\x20confirmation.','publish_checklist':['All\x20competing\x20Pairs\x20tested:\x20verify\x20first-wins\x20semantics\x20on\x20testnet','Lost\x20dual-sig\x20tested:\x20incomplete\x20signatures\x20do\x20not\x20advance','TimeGuard\x20Clock\x20query\x20verified\x20(testnet)','All\x20three\x20Allocators\x20tested\x20with\x20correct\x20sharing.who','Arbitration\x20binding\x20(if\x20any)\x20verified\x20via\x20gen_passport']},{'id':'tpl_machine_rental','scene_id':'rental_standard','name':'Equipment\x20Rental\x20Flow','description':'Rental\x20flow:\x20DepositPaid\x20(entry)\x20->\x20Pickup\x20->\x20In\x20Use\x20->\x20Return\x20->\x20Refund\x20Deposit.\x20'+'Payment\x20is\x20handled\x20by\x20Service.buy()\x20atomically;\x20Machine\x20starts\x20at\x20post-deposit\x20state.\x20'+'Separates\x20deposit\x20from\x20rental\x20fee\x20(two\x20Allocators).\x20Damage\x20report\x20via\x20retained_submission.','recommended_patterns':['P-M-SEQ'],'recommended_topology':['P-M-LINEAR'],'parameters':[{'name':'merchant_permission','type':'permission_ref','required':!![],'description':'Merchant\x20Permission\x20object'},{'name':'deposit_amount','type':'number','required':!![],'description':'Deposit\x20amount\x20in\x20smallest\x20WOW\x20unit','constraint':'Must\x20equal\x20order.amount\x20field;\x20verify\x20via\x20Guard\x20query'},{'name':'damage_inspection_node','type':'string','required':!![],'default':'DamageCheck','description':'Name\x20of\x20the\x20node\x20where\x20damage\x20inspection\x20occurs'},{'name':'return_node_name','type':'string','required':!![],'default':'Return','description':'Name\x20of\x20the\x20return\x20node\x20after\x20damage\x20check\x20fails'}],'example_nodes':[{'name':'DepositPaid','description':'Entry:\x20deposit\x20paid\x20via\x20Service.buy();\x20Machine\x20starts\x20here'},{'name':'PickedUp'},{'name':'InUse'},{'name':'Return'},{'name':'DamageCheck'},{'name':'DepositRefund'},{'name':'Complete'}],'example_pairs':[{'prev_node':'','next_node':'DepositPaid','threshold':0x1,'forwards':[{'name':'Enter','weight':0x1,'named_operator':''}]},{'prev_node':'DepositPaid','next_node':'PickedUp','threshold':0x1,'forwards':[{'name':'Pickup','weight':0x1,'named_operator':'','permission_index':0x2}]},{'prev_node':'PickedUp','next_node':'InUse','threshold':0x1,'forwards':[{'name':'StartUse','weight':0x1,'named_operator':''}]},{'prev_node':'InUse','next_node':'Return','threshold':0x1,'forwards':[{'name':'ReturnItem','weight':0x1,'named_operator':''}]},{'prev_node':'Return','next_node':'DamageCheck','threshold':0x1,'forwards':[{'name':'Inspect','weight':0x1,'permission_index':0x2,'retained_submission':'damage_report'}]},{'prev_node':'Return','next_node':'Complete','threshold':0x1,'forwards':[{'name':'CleanReturn','weight':0x1,'permission_index':0x2}]},{'prev_node':'DamageCheck','next_node':'DepositRefund','threshold':0x1,'forwards':[{'name':'DeductDamage','weight':0x1,'permission_index':0x2}]},{'prev_node':'DepositRefund','next_node':'Complete','threshold':0x1,'forwards':[{'name':'Close','weight':0x1,'permission_index':0x2}]}],'required_guards':[{'guard_template_id':'tpl_forward_privacy_delivery_proof','bound_to_forward':'Inspect','purpose':'Optional:\x20damage\x20evidence\x20proof\x20(photo,\x20video)'}],'required_permissions':[{'index':0x2,'name':'merchant','description':'Rental\x20provider'}],'required_allocators':[{'name':'RentalFeeAllocation','trigger_node':'Complete','description':'Rental\x20fee\x20to\x20merchant'},{'name':'DepositRefundAllocation','trigger_node':'DepositRefund','description':'Remaining\x20deposit\x20to\x20customer\x20(OrderHolder\x20sharing.who)'},{'name':'DamageDeductionAllocation','trigger_node':'DamageCheck','description':'Damage\x20deduction\x20to\x20merchant'}],'forkable_fields':['deposit_amount','damage_node_logic','additional_inspection_steps'],'applicable_industries':['rental','equipment','vehicle'],'relevant_risks':['R-M1-01','R-M1-08','R-M2-01','R-M2-04','R-M3-02','R-M4-01','R-M5-02'],'creation_notes':['First\x20node\x20\x27DepositPaid\x27\x20represents\x20post-payment\x20state\x20—\x20Service.buy()\x20completes\x20deposit\x20payment\x20atomically\x20before\x20Progress\x20is\x20created','No\x20separate\x20\x27Reserve\x27\x20or\x20\x27PayDeposit\x27\x20nodes\x20needed\x20—\x20reservation\x20and\x20payment\x20are\x20handled\x20by\x20Service.buy(),\x20not\x20Machine','Damage\x20report\x20uses\x20retained_submission\x20—\x20values\x20stored\x20uniquely\x20by\x20(current_node,\x20next_node,\x20forward_name)','Two\x20competing\x20Pairs\x20at\x20Return\x20node:\x20DamageCheck\x20vs\x20Complete\x20(clean\x20return)','DamageDeduction\x20Allocation\x20uses\x20sharing.who=Entity\x20(merchant),\x20not\x20OrderHolder'],'example_use_case':'Camera\x20equipment\x20rental:\x20customer\x20pays\x201000\x20WOW\x20deposit,\x20returns\x20equipment,\x20'+'merchant\x20inspects.\x20If\x20damaged,\x20200\x20WOW\x20deducted;\x20otherwise\x20full\x20refund.','publish_checklist':['Deposit\x20Guard\x20tested\x20(testnet)\x20with\x20valid/invalid\x20amounts','Damage\x20report\x20retained_submission\x20stored\x20correctly\x20(query\x20progress_history)','Both\x20Return\x20branches\x20tested\x20(DamageCheck\x20+\x20CleanReturn)','All\x20three\x20Allocators\x20verified\x20with\x20correct\x20sharing.who']},{'id':'tpl_machine_dual_signature','scene_id':'dual_signature','name':'Dual-Signature\x20Consensus\x20Flow','description':'Critical\x20node\x20requires\x20both\x20customer\x20+\x20merchant\x20confirmation.\x20threshold=2\x20with\x20two\x20Forwards\x20(weight=1\x20each).\x20'+'Customer\x20uses\x20namedOperator=\x27\x27\x20(OrderHolder);\x20merchant\x20uses\x20permissionIndex=2.','recommended_patterns':['P-M-AND'],'recommended_topology':['P-M-LINEAR'],'parameters':[{'name':'merchant_permission','type':'permission_ref','required':!![],'description':'Merchant\x20Permission\x20object'},{'name':'critical_node_name','type':'string','required':!![],'default':'Approve','description':'Node\x20requiring\x20dual-sig'},{'name':'next_node_after_approval','type':'string','required':!![],'default':'Execute','description':'Name\x20of\x20the\x20node\x20that\x20follows\x20after\x20dual-signature\x20approval'}],'example_nodes':[{'name':'Initiated'},{'name':'${critical_node_name}','description':'Dual-sig\x20required\x20here'},{'name':'${next_node_after_approval}'},{'name':'Complete'}],'example_pairs':[{'prev_node':'','next_node':'Initiated','threshold':0x1,'forwards':[{'name':'Initiate','weight':0x1,'named_operator':''}]},{'prev_node':'Initiated','next_node':'${critical_node_name}','threshold':0x1,'forwards':[{'name':'Submit','weight':0x1,'named_operator':''}]},{'prev_node':'${critical_node_name}','next_node':'${next_node_after_approval}','threshold':0x2,'forwards':[{'name':'CustomerApprove','weight':0x1,'named_operator':'','guard':'customer_identity_guard'},{'name':'MerchantApprove','weight':0x1,'permission_index':0x2,'guard':'merchant_identity_guard'}]},{'prev_node':'${next_node_after_approval}','next_node':'Complete','threshold':0x1,'forwards':[{'name':'Finish','weight':0x1,'permission_index':0x2}]}],'required_guards':[{'guard_template_id':'tpl_forward_node_check','bound_to_forward':'CustomerApprove','purpose':'Verify\x20customer\x20identity\x20(order.owner)'},{'guard_template_id':'tpl_forward_node_check','bound_to_forward':'MerchantApprove','purpose':'Verify\x20merchant\x20identity\x20(permission\x20holder)'}],'required_permissions':[{'index':0x2,'name':'merchant','description':'Merchant\x20approval'}],'required_allocators':[{'name':'CompleteAllocation','trigger_node':'Complete','description':'Allocation\x20on\x20dual-sig\x20completion'}],'forkable_fields':['critical_node_name','additional_approvers','guard_logic'],'applicable_industries':['ecommerce','service','logistics','escrow'],'relevant_risks':['R-M1-08','R-M2-01','R-M3-02','R-M3-04'],'creation_notes':['threshold=2\x20means\x20BOTH\x20Forwards\x20must\x20execute\x20to\x20advance\x20(AND\x20semantics)','Customer\x20Forward\x20uses\x20namedOperator=\x27\x27\x20(OrderHolder)','Merchant\x20Forward\x20uses\x20permissionIndex=2','If\x20either\x20party\x20fails\x20to\x20sign,\x20workflow\x20stalls\x20—\x20consider\x20adding\x20timeout\x20Guard'],'example_use_case':'High-value\x20order\x20(e.g.\x20real\x20estate\x20transaction)\x20requiring\x20both\x20buyer\x20and\x20seller\x20confirmation.','publish_checklist':['Both\x20Forward\x20identities\x20tested\x20on\x20testnet','Verify\x20partial\x20signature\x20does\x20NOT\x20advance\x20(threshold=2)','Guards\x20correctly\x20distinguish\x20customer\x20vs\x20merchant\x20identity']},{'id':'tpl_machine_weighted_voting','scene_id':'weighted_voting','name':'Weighted\x20Voting\x20Flow','description':'Multi-party\x20voting\x20with\x20unequal\x20weights.\x20threshold=100,\x20chief\x20weight=60,\x20members\x20weight=40\x20total.\x20'+'Each\x20member\x27s\x20weight\x20extracted\x20via\x20Guard\x20query\x20from\x20Arbitration\x20object.','recommended_patterns':['P-M-VOTE'],'recommended_topology':['P-M-LINEAR'],'parameters':[{'name':'arbitration_ref','type':'arbitration_ref','required':!![],'description':'Arbitration\x20object\x20storing\x20voter\x20weights'},{'name':'threshold_total','type':'number','required':!![],'default':'100','description':'Total\x20weight\x20threshold\x20for\x20decision'},{'name':'chief_weight','type':'number','required':!![],'default':'60','description':'Weight\x20assigned\x20to\x20the\x20chief\x20voter\x20(out\x20of\x20100)'},{'name':'member_count','type':'number','required':!![],'default':'5','description':'Number\x20of\x20voting\x20members\x20(excluding\x20chief)'}],'example_nodes':[{'name':'VoteOpened'},{'name':'Voting'},{'name':'Approved'},{'name':'Rejected'}],'example_pairs':[{'prev_node':'','next_node':'VoteOpened','threshold':0x1,'forwards':[{'name':'OpenVote','weight':0x1,'permission_index':0x3}]},{'prev_node':'VoteOpened','next_node':'Voting','threshold':0x1,'forwards':[{'name':'StartVoting','weight':0x1,'permission_index':0x3}]},{'prev_node':'Voting','next_node':'Approved','threshold':'${threshold_total}','forwards':[{'name':'ChiefVote','weight':'${chief_weight}','permission_index':0x2,'guard':'arb_voting_guard','retained_submission':'chief_vote_record'},{'name':'MemberVote','weight':0x8,'named_operator':'member','guard':'arb_voting_guard','retained_submission':'member_vote_record'}]},{'prev_node':'Voting','next_node':'Rejected','threshold':0x1,'forwards':[{'name':'TimeoutReject','weight':0x1,'permission_index':0x3,'guard':'voting_timeout_guard'}]}],'required_guards':[{'guard_template_id':'tpl_voting_guard_numeric_weight','bound_to_forward':'ChiefVote','purpose':'Verify\x20voting\x20eligibility\x20+\x20extract\x20weight\x20from\x20Arbitration'},{'guard_template_id':'tpl_voting_guard_numeric_weight','bound_to_forward':'MemberVote','purpose':'Verify\x20voting\x20eligibility\x20+\x20prevent\x20double-vote'}],'required_permissions':[{'index':0x2,'name':'chief','description':'Chief\x20voter\x20(high\x20weight)'},{'index':0x3,'name':'admin','description':'Vote\x20opener\x20/\x20timeout\x20trigger'}],'required_allocators':[{'name':'ApprovedAllocation','trigger_node':'Approved','description':'Allocation\x20on\x20approval'}],'forkable_fields':['weights','voter_count','timeout_days'],'applicable_industries':['governance','arbitration','dao'],'relevant_risks':['R-M1-08','R-M2-05','R-M3-04','R-M5-04','R-X1-14'],'creation_notes':['Member\x20weight\x20must\x20be\x20extracted\x20dynamically\x20via\x20Guard\x20query\x20(not\x20hardcoded\x20in\x20Forward)','Guard\x20MUST\x20check\x20arb.voted\x20has\x20[Signer]\x20to\x20prevent\x20double-voting\x20(R-X1-14\x20CRITICAL)','Competing\x20Pair:\x20Approved\x20vs\x20Rejected\x20(timeout)\x20—\x20first-wins','Voting\x20weight\x20is\x20query-derived;\x20Forward\x20weight\x20field\x20is\x20just\x20session\x20counter'],'example_use_case':'Arbitration\x20panel:\x201\x20chief\x20(weight\x2060)\x20+\x205\x20members\x20(weight\x208\x20each\x20=\x2040).\x20'+'Need\x20total\x20>=\x20100\x20to\x20approve.\x20Reject\x20after\x2072h\x20timeout.','publish_checklist':['Arbitration\x20object\x20created\x20and\x20tested','Double-vote\x20prevention\x20verified\x20(try\x20voting\x20twice\x20—\x20should\x20fail)','Weight\x20extraction\x20tested\x20with\x20different\x20voter\x20configurations','Timeout\x20Guard\x20(Clock)\x20verified\x20on\x20testnet']},{'id':'tpl_machine_cross_machine','scene_id':'cross_machine_supply_chain','name':'Cross-Machine\x20Supply\x20Chain','description':'Decomposed\x20supply\x20chain\x20across\x20multiple\x20Machines.\x20Machine\x20B\x27s\x20Forward\x20Guard\x20queries\x20Machine\x20A\x27s\x20Progress\x20'+'via\x20convert_witness=100\x20to\x20verify\x20upstream\x20completion\x20before\x20advancing.','recommended_patterns':['P-M-CROSS-MACHINE'],'recommended_topology':['P-M-LINEAR'],'parameters':[{'name':'machine_a_id','type':'machine_ref','required':!![],'description':'Upstream\x20Machine\x20(must\x20already\x20be\x20published)','constraint':'Machine\x20A\x20must\x20be\x20published\x20BEFORE\x20Machine\x20B\x27s\x20Guard\x20can\x20reference\x20its\x20Progress\x20'+'(Progress\x20creation\x20verifies\x20the\x20bound\x20Machine\x20is\x20published\x20—\x20see\x2006\x20§14.6)'},{'name':'machine_a_complete_node','type':'string','required':!![],'default':'Complete','description':'Target\x20node\x20name\x20in\x20Machine\x20A\x20to\x20verify'},{'name':'machine_b_permission','type':'permission_ref','required':!![],'description':'Machine\x20B\x27s\x20Permission\x20object'}],'example_nodes':[{'name':'UpstreamVerified'},{'name':'Production'},{'name':'Complete'}],'example_pairs':[{'prev_node':'','next_node':'UpstreamVerified','threshold':0x1,'forwards':[{'name':'VerifyUpstream','weight':0x1,'permission_index':0x2,'guard':'upstream_progress_guard','retained_submission':'upstream_progress_id'}]},{'prev_node':'UpstreamVerified','next_node':'Production','threshold':0x1,'forwards':[{'name':'StartProduction','weight':0x1,'permission_index':0x2}]},{'prev_node':'Production','next_node':'Complete','threshold':0x1,'forwards':[{'name':'Finish','weight':0x1,'permission_index':0x2}]}],'required_guards':[{'guard_template_id':'tpl_forward_node_check','bound_to_forward':'VerifyUpstream','purpose':'Query\x20Machine\x20A\x27s\x20Progress:\x20verify\x20it\x20reached\x20${machine_a_complete_node}'}],'required_permissions':[{'index':0x2,'name':'manufacturer','description':'Machine\x20B\x20operator'}],'required_allocators':[{'name':'CompleteAllocation','trigger_node':'Complete','description':'Allocation\x20to\x20Machine\x20B\x27s\x20merchant'}],'forkable_fields':['upstream_machine_ref','verification_node_name'],'applicable_industries':['manufacturing','logistics','retail','supply_chain'],'relevant_risks':['R-M1-01','R-M1-08','R-M2-01','R-M2-04','R-M3-04','R-M5-04','R-M5-05','R-M5-06'],'creation_notes':['Machine\x20A\x20MUST\x20be\x20published\x20before\x20Machine\x20B\x20(dependency\x20order)','Guard\x20uses\x20convert_witness=100\x20to\x20convert\x20submitted\x20Order/Progress\x20ID\x20into\x20queryable\x20Progress\x20object','Cross-Machine\x20dependency\x20is\x20one-way\x20(no\x20cycles)','retained_submission\x20stores\x20upstream\x20Progress\x20ID\x20for\x20later\x20audit','Multi-party\x20chain:\x20extend\x20pattern\x20with\x20Machine\x20C,\x20D,\x20...\x20(each\x20independently\x20published)','Dependency\x20verification:\x20enforced\x20when\x20the\x20Progress\x20object\x20is\x20created\x20(creation\x20checks\x20the\x20bound\x20Machine\x20is\x20published\x20—\x20see\x2006\x20§14.6)'],'example_use_case':'Supplier\x20(Machine\x20A)\x20->\x20Manufacturer\x20(Machine\x20B)\x20->\x20Retailer\x20(Machine\x20C).\x20'+'Manufacturer\x20cannot\x20start\x20production\x20until\x20supplier\x27s\x20Progress\x20reaches\x20\x27Complete\x27.','publish_checklist':['Machine\x20A\x20already\x20published\x20on-chain\x20(verify\x20via\x20onchain_objects)','Cross-Machine\x20Guard\x20tested\x20with\x20valid/invalid\x20upstream\x20Progress\x20IDs','retained_submission\x20verified\x20(query\x20progress_history\x20for\x20upstream_progress_id)','Independent\x20testing:\x20run\x20Machine\x20A\x20to\x20Complete,\x20then\x20attempt\x20Machine\x20B\x27s\x20VerifyUpstream']},{'id':'tpl_machine_privacy_delivery','scene_id':'privacy_delivery','name':'Privacy-Preserving\x20Delivery\x20Flow','description':'Customer\x20submits\x20privacy\x20data\x20via\x20Messenger\x20(encrypted,\x20off-chain).\x20Chain\x20stores\x20only\x20Merkle\x20Root\x20Proof.\x20'+'Guard\x20verifies\x20Proof\x20signature\x20+\x20timestamp\x20+\x20service\x20binding.\x20Uses\x20tpl_forward_privacy_delivery_proof\x20(strict\x20mode).','recommended_patterns':['P-M-SEQ'],'recommended_topology':['P-M-LINEAR'],'parameters':[{'name':'merchant_permission','type':'permission_ref','required':!![],'description':'Merchant\x20Permission\x20object'},{'name':'proof_node_name','type':'string','required':!![],'default':'ProofSubmitted','description':'Name\x20of\x20the\x20node\x20where\x20delivery\x20proof\x20is\x20submitted'},{'name':'delivery_node_name','type':'string','required':!![],'default':'DeliveryConfirmed','description':'Name\x20of\x20the\x20node\x20where\x20delivery\x20confirmation\x20occurs'}],'example_nodes':[{'name':'Paid','description':'Entry:\x20order\x20created\x20and\x20paid\x20via\x20Service.buy();\x20Machine\x20starts\x20here'},{'name':'${proof_node_name}','description':'Customer\x20submits\x20Proof\x20via\x20Messenger'},{'name':'${delivery_node_name}'},{'name':'Complete'}],'example_pairs':[{'prev_node':'','next_node':'Paid','threshold':0x1,'forwards':[{'name':'Enter','weight':0x1,'named_operator':''}]},{'prev_node':'Paid','next_node':'${proof_node_name}','threshold':0x1,'forwards':[{'name':'SubmitProof','weight':0x1,'named_operator':'','guard':'tpl_forward_privacy_delivery_proof','retained_submission':'proof_address'}]},{'prev_node':'${proof_node_name}','next_node':'${delivery_node_name}','threshold':0x1,'forwards':[{'name':'ConfirmDelivery','weight':0x1,'permission_index':0x2}]},{'prev_node':'${delivery_node_name}','next_node':'Complete','threshold':0x1,'forwards':[{'name':'Finish','weight':0x1,'permission_index':0x2}]}],'required_guards':[{'guard_template_id':'tpl_forward_privacy_delivery_proof','bound_to_forward':'SubmitProof','purpose':'Verify\x20Proof:\x20signer=proof.signer\x20∧\x20proof.time>order.time\x20∧\x20order.service=service'}],'required_permissions':[{'index':0x2,'name':'merchant','description':'Merchant\x20confirms\x20delivery'}],'required_allocators':[{'name':'CompleteAllocation','trigger_node':'Complete','description':'Allocation\x20to\x20merchant\x20after\x20delivery\x20confirmation'}],'forkable_fields':['proof_node_name','delivery_node_name','additional_evidence_steps'],'applicable_industries':['ecommerce','logistics','privacy_service'],'relevant_risks':['R-M1-01','R-M1-08','R-M2-01','R-M2-04','R-M3-02','R-M5-03'],'creation_notes':['Use\x20strict\x20mode\x20tpl_forward_privacy_delivery_proof\x20(3\x20conditions:\x20Signer\x20+\x20time\x20+\x20service\x20binding)','submitChainProof\x20about_address\x20=\x20peerAddress\x20(NOT\x20sessionId)','order_id\x20passed\x20via\x20description\x20string\x20field\x20(not\x20about_address)','Guard\x20table\x20item\x20name\x20MUST\x20be\x20<64\x20BCS\x20bytes\x20(MAX_NAME_LENGTH=64)','retained_submission\x20stores\x20Proof\x20address\x20for\x20arbitration\x20query','Proof\x20MUST\x20be\x20generated\x20by\x20messenger.submitChainProof\x20(not\x20manual)'],'example_use_case':'Customer\x20sends\x20delivery\x20address\x20via\x20Messenger\x20(encrypted).\x20Chain\x20stores\x20only\x20Proof.\x20'+'Merchant\x20verifies\x20Proof,\x20then\x20confirms\x20delivery.','publish_checklist':['Strict\x20mode\x20Guard\x20tested:\x203\x20conditions\x20verified\x20individually','Messenger\x20integration\x20tested\x20end-to-end\x20(submit\x20+\x20verify)','retained_submission\x20stored\x20Proof\x20address\x20queryable\x20from\x20progress_history','Guard\x20table\x20item\x20name\x20length\x20validated\x20(<64\x20BCS\x20bytes)']},{'id':'tpl_machine_reward','scene_id':'reward_incentive','name':'Reward\x20Incentive\x20Flow','description':'Customer\x20triggers\x20Reward\x20claim\x20at\x20specific\x20node.\x20Guard\x20prevents\x20double-claim\x20via\x20query_reward_record_count==0.\x20'+'Reward\x20object\x20independent\x20of\x20Allocator.','recommended_patterns':['P-M-SEQ'],'recommended_topology':['P-M-LINEAR'],'parameters':[{'name':'reward_ref','type':'reward_ref','required':!![],'description':'Reward\x20object\x20address\x20(must\x20be\x20already\x20created)'},{'name':'claim_node_name','type':'string','required':!![],'default':'ClaimReward','description':'Name\x20of\x20the\x20node\x20where\x20reward\x20claims\x20are\x20triggered'}],'example_nodes':[{'name':'Eligible'},{'name':'${claim_node_name}'},{'name':'Rewarded'},{'name':'Complete'}],'example_pairs':[{'prev_node':'','next_node':'Eligible','threshold':0x1,'forwards':[{'name':'Enter','weight':0x1,'named_operator':''}]},{'prev_node':'Eligible','next_node':'${claim_node_name}','threshold':0x1,'forwards':[{'name':'TriggerClaim','weight':0x1,'named_operator':'','guard':'reward_anti_double_guard','retained_submission':'claim_record'}]},{'prev_node':'${claim_node_name}','next_node':'Rewarded','threshold':0x1,'forwards':[{'name':'IssueReward','weight':0x1,'permission_index':0x3}]},{'prev_node':'Rewarded','next_node':'Complete','threshold':0x1,'forwards':[{'name':'Finish','weight':0x1,'permission_index':0x2}]}],'required_guards':[{'guard_template_id':'tpl_reward_one_time_claim','bound_to_forward':'TriggerClaim','purpose':'Verify\x20query_reward_record_count==0\x20to\x20prevent\x20double-claim'}],'required_permissions':[{'index':0x2,'name':'merchant','description':'Completes\x20flow'},{'index':0x3,'name':'reward_admin','description':'Issues\x20reward\x20tokens'}],'required_allocators':[{'name':'CompleteAllocation','trigger_node':'Complete','description':'Standard\x20allocation\x20(separate\x20from\x20Reward)'}],'forkable_fields':['claim_node_name','additional_reward_conditions'],'applicable_industries':['ecommerce','subscription','education','loyalty'],'relevant_risks':['R-M1-08','R-M2-05','R-M3-04','R-X1-14'],'creation_notes':['Reward\x20Guard\x20MUST\x20check\x20query_reward_record_count\x20==\x200\x20(R-X1-14\x20CRITICAL)','Reward\x20is\x20INDEPENDENT\x20of\x20Allocator\x20—\x20both\x20can\x20fire\x20on\x20different\x20nodes','Reward\x20object\x20must\x20be\x20created\x20BEFORE\x20publishing\x20this\x20Machine','retained_submission\x20stores\x20claim\x20record\x20for\x20audit'],'example_use_case':'Loyalty\x20program:\x20after\x20customer\x20completes\x205\x20orders,\x20eligible\x20to\x20claim\x20reward\x20token.\x20'+'Anti-double-claim\x20Guard\x20ensures\x20one\x20claim\x20per\x20customer.','publish_checklist':['Reward\x20object\x20already\x20created\x20and\x20tested','Anti-double-claim\x20Guard\x20tested:\x20claim\x20twice\x20should\x20fail\x20on\x20second\x20attempt','retained_submission\x20verified\x20(claim_record\x20queryable)']},{'id':'tpl_machine_wonder_feedback','scene_id':'wonder_feedback','name':'Wonder\x20Feedback\x20Flow\x20(Post-Completion\x20Rating)','description':'Post-completion\x20rating\x20flow:\x20Paid\x20(entry)\x20→\x20Shipped\x20→\x20Received\x20→\x20Completed\x20→\x20{Wonder\x20|\x20NoWonder}.\x20'+'After\x20the\x20order\x20reaches\x20\x27Completed\x27\x20(terminal\x20business\x20state,\x20funds\x20already\x20allocated\x20to\x20merchant),\x20'+'the\x20OrderHolder\x20(namedOperator=\x27\x27)\x20can\x20advance\x20Progress\x20to\x20\x27wonder\x27\x20(positive\x20review)\x20or\x20\x27no_wonder\x27\x20'+'(negative\x20review).\x20A\x20bound\x20Reward\x20object\x27s\x20claim_guard\x20verifies\x20Progress.current\x20==\x20\x27wonder\x27\x20before\x20'+'paying\x20out\x20—\x20reward\x20claim\x20needs\x20NO\x20Permission.\x20Dispute\x20is\x20NEVER\x20modeled\x20here:\x20it\x20flows\x20through\x20'+'the\x20Order\x27s\x20dispute\x20flow\x20→\x20Arb\x20case\x20→\x20arbiter\x20ruling\x20→\x20fee\x20withdrawal,\x20fully\x20off-Machine.','recommended_patterns':['P-M-SEQ','P-M-COMPETING'],'recommended_topology':['P-M-LINEAR','P-M-COMPETING'],'parameters':[{'name':'merchant_permission','type':'permission_ref','required':!![],'description':'Merchant\x20Permission\x20object\x20(index\x202\x20=\x20merchant,\x20index\x203\x20=\x20admin)'},{'name':'wonder_node_name','type':'string','required':!![],'default':'wonder','description':'Node\x20name\x20for\x20positive\x20feedback\x20(praise)\x20terminal','constraint':'Must\x20match\x20/^(wonder|praise|thumbs_up)$/i\x20OR\x20be\x20a\x20custom\x20name;\x20must\x20NOT\x20match\x20dispute\x20anti-pattern\x20regex'},{'name':'no_wonder_node_name','type':'string','required':!![],'default':'no_wonder','description':'Node\x20name\x20for\x20negative\x20feedback\x20(complaint)\x20terminal','constraint':'Must\x20match\x20/^(no_wonder|complain|thumbs_down)$/i\x20OR\x20be\x20a\x20custom\x20name;\x20must\x20NOT\x20match\x20dispute\x20anti-pattern\x20regex'},{'name':'reward_ref','type':'reward_ref','required':![],'description':'Reward\x20object\x20address\x20(optional).\x20If\x20bound,\x20its\x20claim_guard\x20should\x20verify\x20Progress.current\x20==\x20wonder_node_name\x20AND\x20order.holder\x20==\x20signer.\x20Use\x20wonder_praise\x20or\x20wonder_feedback\x20reward\x20template.'},{'name':'rating_time_limit_days','type':'number','required':![],'default':'30','description':'Days\x20after\x20completion\x20during\x20which\x20the\x20customer\x20can\x20rate\x20(enforced\x20by\x20Guard\x20on\x20Praise/Complain\x20forwards\x20via\x20context(Clock))','constraint':'Must\x20be\x20>\x200;\x20reasonable\x20range\x207-90'}],'example_nodes':[{'name':'Paid','description':'Entry:\x20order\x20created\x20and\x20paid\x20via\x20Service.buy();\x20Machine\x20starts\x20here'},{'name':'Shipped','description':'Merchant\x20dispatched\x20goods/service'},{'name':'Received','description':'Customer\x20confirmed\x20receipt'},{'name':'Completed','description':'Terminal\x20business\x20state\x20—\x20triggers\x20merchant\x20Allocation.\x20Funds\x20settled.'},{'name':'${wonder_node_name}','description':'Positive\x20feedback\x20terminal\x20(praise).\x20OrderHolder-only.\x20Reward-eligible.'},{'name':'${no_wonder_node_name}','description':'Negative\x20feedback\x20terminal\x20(complaint).\x20OrderHolder-only.\x20Optional\x20Repository\x20write\x20for\x20analytics.'}],'example_pairs':[{'prev_node':'','next_node':'Paid','threshold':0x1,'forwards':[{'name':'Enter','weight':0x1,'named_operator':''}]},{'prev_node':'Paid','next_node':'Shipped','threshold':0x1,'forwards':[{'name':'Ship','weight':0x1,'permission_index':0x2,'named_operator':''}]},{'prev_node':'Shipped','next_node':'Received','threshold':0x1,'forwards':[{'name':'ConfirmReceive','weight':0x1,'named_operator':''}]},{'prev_node':'Received','next_node':'Completed','threshold':0x1,'forwards':[{'name':'Finish','weight':0x1,'permission_index':0x2,'named_operator':''}]},{'prev_node':'Completed','next_node':'${wonder_node_name}','threshold':0x1,'forwards':[{'name':'Praise','weight':0x1,'named_operator':'','guard':'rating_window_guard','retained_submission':'rating_record'}]},{'prev_node':'Completed','next_node':'${no_wonder_node_name}','threshold':0x1,'forwards':[{'name':'Complain','weight':0x1,'named_operator':'','guard':'rating_window_guard','retained_submission':'rating_record'}]}],'required_guards':[{'guard_template_id':'tpl_forward_node_check','bound_to_forward':'Praise','purpose':'Verify\x20Progress.current\x20==\x20\x27Completed\x27\x20(rating\x20only\x20allowed\x20after\x20completion)\x20AND\x20context(Clock)\x20<=\x20progress.current_time\x20+\x20rating_time_limit_days'},{'guard_template_id':'tpl_forward_node_check','bound_to_forward':'Complain','purpose':'Verify\x20Progress.current\x20==\x20\x27Completed\x27\x20(rating\x20only\x20allowed\x20after\x20completion)\x20AND\x20context(Clock)\x20<=\x20progress.current_time\x20+\x20rating_time_limit_days'}],'required_permissions':[{'index':0x2,'name':'merchant','description':'Merchant\x20role\x20for\x20Ship\x20+\x20Finish\x20(NOT\x20for\x20rating\x20—\x20rating\x20is\x20OrderHolder-only\x20via\x20named_operator=\x27\x27)'},{'index':0x3,'name':'admin','description':'Admin\x20override\x20(optional)'}],'required_allocators':[{'name':'MerchantAllocation','trigger_node':'Completed','description':'100%\x20to\x20merchant\x20Treasury\x20or\x20personal\x20address.\x20Fires\x20at\x20Completion\x20—\x20NOT\x20at\x20Wonder/NoWonder\x20(those\x20are\x20reputation-only\x20terminals\x20with\x20no\x20fund\x20flow).'}],'forkable_fields':['wonder_node_name','no_wonder_node_name','rating_time_limit_days','additional_rating_nodes'],'applicable_industries':['ecommerce','service','rental','subscription','education'],'relevant_risks':['R-M1-01','R-M1-02','R-M1-08','R-M1-11','R-M2-01','R-M2-05','R-M3-02','R-M3-04','R-M4-01','R-M5-03'],'creation_notes':['DISPUTE\x20INDEPENDENCE:\x20This\x20Machine\x20MUST\x20NOT\x20contain\x20\x27disputed\x27,\x20\x27refunded\x27,\x20\x27arb\x27,\x20\x27arbitration\x27\x20nodes\x20(R-M1-11\x20critical).\x20Disputes\x20are\x20filed\x20off-Machine\x20—\x20through\x20the\x20Arbitration\x20dispute\x20flow\x20on\x20the\x20order\x20and\x20arbitration\x20objects.','Build\x20order:\x20Permission\x20→\x20Machine\x20(unpublished)\x20→\x20Guards\x20→\x20Bind\x20guards\x20→\x20Publish\x20→\x20Bind\x20to\x20Service\x20→\x20Bind\x20Reward\x20(optional)','First\x20node\x20\x27Paid\x27\x20represents\x20post-payment\x20state\x20—\x20Service.buy()\x20completes\x20payment\x20atomically\x20before\x20Progress\x20is\x20created','No\x20separate\x20\x27Order\x27\x20or\x20\x27Pay\x27\x20nodes\x20needed\x20—\x20payment\x20is\x20handled\x20by\x20Service.buy(),\x20not\x20Machine','Wonder/NoWonder\x20forwards\x20have\x20named_operator=\x27\x27\x20(empty)\x20—\x20this\x20delegates\x20to\x20the\x20OrderHolder\x20(customer).\x20No\x20Permission\x20index\x20needed\x20for\x20rating.','Completed\x20node\x20triggers\x20MerchantAllocation\x20—\x20funds\x20are\x20settled\x20BEFORE\x20the\x20rating\x20window\x20opens.\x20Rating\x20does\x20NOT\x20affect\x20fund\x20flow.','Competing\x20Pair:\x20Praise\x20vs\x20Complain\x20(first-wins)\x20—\x20one\x20rating\x20per\x20order,\x20enforced\x20by\x20Guard\x20+\x20retained_submission\x20audit\x20trail.','Reward\x20object\x20(if\x20bound)\x20is\x20INDEPENDENT\x20of\x20Allocator:\x20Reward.claim()\x20requires\x20Guard+passport,\x20not\x20Permission.\x20Guard\x20checks\x20Progress.current\x20==\x20\x27wonder\x27\x20AND\x20order.holder\x20==\x20signer.','rating_window_guard\x20enforces\x20time\x20limit:\x20context(Clock)\x20<=\x20progress.current_time\x20+\x20rating_time_limit_days.\x20After\x20window\x20closes,\x20no\x20rating\x20possible\x20(Completed\x20becomes\x20true\x20terminal).','Optional:\x20bind\x20a\x20Repository\x20to\x20record\x20feedback\x20node\x20for\x20analytics.\x20Repository\x20write\x20happens\x20via\x20Guard\x27s\x20data\x20extraction\x20(NOT\x20auto-passed\x20—\x20see\x2006\x20§14.4).'],'example_use_case':'Photography\x20service:\x20Paid\x20→\x20Shipped\x20(booking\x20confirmed)\x20→\x20Received\x20(session\x20delivered)\x20→\x20Completed\x20'+'(photos\x20delivered,\x20funds\x20released\x20to\x20photographer)\x20→\x20customer\x20advances\x20to\x20\x27wonder\x27\x20(loved\x20the\x20work)\x20'+'or\x20\x27no_wonder\x27\x20(didn\x27t\x20love\x20it).\x20Bound\x20Reward\x20pays\x201\x20WOW\x20to\x20customers\x20who\x20advance\x20to\x20\x27wonder\x27.\x20'+'Merchant\x27s\x20wonder/no_wonder\x20ratio\x20becomes\x20an\x20on-chain\x20reputation\x20signal.\x20Disputes\x20(if\x20any)\x20are\x20'+'filed\x20separately\x20via\x20Arbitration\x20object\x20—\x20never\x20enter\x20this\x20Machine.','publish_checklist':['All\x206\x20nodes\x20verified:\x20no\x20\x27disputed\x27/\x27refunded\x27/\x27arb\x27/\x27arbitration\x27\x20names\x20(R-M1-11\x20PASS)','Entry\x20Pair\x20exists\x20(prev_node=\x27\x27\x20targets\x20\x27Paid\x27)','Competing\x20Pair\x20tested:\x20Praise\x20vs\x20Complain\x20—\x20first-wins\x20semantics\x20verified\x20on\x20testnet','rating_window_guard\x20tested:\x20rating\x20blocked\x20after\x20time\x20limit\x20expires','MerchantAllocation\x20fires\x20ONLY\x20at\x20Completed\x20(NOT\x20at\x20Wonder/NoWonder)','Reward\x20object\x20(if\x20bound):\x20claim_guard\x20tested\x20—\x20Progress.current\x20==\x20\x27wonder\x27\x20required,\x20claim\x20fails\x20at\x20\x27no_wonder\x27\x20or\x20\x27Completed\x27','named_operator=\x27\x27\x20on\x20Praise/Complain\x20forwards\x20verified\x20(OrderHolder-only\x20operation)','machineNode2file\x20export\x20as\x20backup']},{'id':'tpl_machine_subscription','scene_id':'subscription','name':'Subscription\x20/\x20Membership\x20Flow','description':'Subscribe\x20->\x20Pay\x20->\x20Activate\x20->\x20[Renew\x20|\x20Expire]\x20->\x20Cancel/End.\x20Time-lock\x20on\x20Renew.\x20'+'Competing\x20Pair:\x20Renew\x20vs\x20Expire\x20(first-wins).\x20Repository\x20stores\x20subscription\x20status.','recommended_patterns':['P-M-SEQ','P-M-COMPETING'],'recommended_topology':['P-M-LINEAR','P-M-COMPETING'],'parameters':[{'name':'merchant_permission','type':'permission_ref','required':!![],'description':'Provider\x20Permission\x20object'},{'name':'subscription_duration_days','type':'number','required':!![],'default':'30','description':'Days\x20between\x20Renew\x20and\x20Expire\x20eligibility'},{'name':'repository_ref','type':'address','required':!![],'description':'Repository\x20object\x20storing\x20subscription\x20status\x20(note:\x20not\x20consensus_repositories,\x20which\x20is\x20declarative-only\x20—\x20see\x2006\x20§14.4)'}],'example_nodes':[{'name':'Paid','description':'Entry:\x20subscription\x20created\x20and\x20paid\x20via\x20Service.buy();\x20Machine\x20starts\x20here'},{'name':'Active'},{'name':'RenewEligible'},{'name':'Renewed'},{'name':'Expired'},{'name':'Cancelled'},{'name':'Ended'}],'example_pairs':[{'prev_node':'','next_node':'Paid','threshold':0x1,'forwards':[{'name':'Enter','weight':0x1,'named_operator':''}]},{'prev_node':'Paid','next_node':'Active','threshold':0x1,'forwards':[{'name':'Activate','weight':0x1,'permission_index':0x2,'guard':'repository_write_guard'}]},{'prev_node':'Active','next_node':'RenewEligible','threshold':0x1,'forwards':[{'name':'TimeUnlock','weight':0x1,'permission_index':0x3,'guard':'time_lock_guard_${subscription_duration_days}_days'}]},{'prev_node':'RenewEligible','next_node':'Renewed','threshold':0x1,'forwards':[{'name':'Renew','weight':0x1,'named_operator':''}]},{'prev_node':'RenewEligible','next_node':'Expired','threshold':0x1,'forwards':[{'name':'AutoExpire','weight':0x1,'permission_index':0x3,'guard':'expire_time_guard'}]},{'prev_node':'RenewEligible','next_node':'Cancelled','threshold':0x1,'forwards':[{'name':'Cancel','weight':0x1,'named_operator':''}]},{'prev_node':'Renewed','next_node':'Active','threshold':0x1,'forwards':[{'name':'Reactivate','weight':0x1,'permission_index':0x2}]},{'prev_node':'Expired','next_node':'Ended','threshold':0x1,'forwards':[{'name':'CloseExpired','weight':0x1,'permission_index':0x3}]},{'prev_node':'Cancelled','next_node':'Ended','threshold':0x1,'forwards':[{'name':'CloseCancelled','weight':0x1,'permission_index':0x2}]}],'required_guards':[{'guard_template_id':'tpl_forward_node_check','bound_to_forward':'TimeUnlock','purpose':'Time\x20lock:\x20context(Clock)\x20>=\x20progress.current_time\x20+\x20${subscription_duration_days}\x20days'},{'guard_template_id':'tpl_write_guard_type_check','bound_to_forward':'Activate','purpose':'Write\x20subscription\x20status\x20to\x20Repository'},{'guard_template_id':'tpl_forward_node_check','bound_to_forward':'AutoExpire','purpose':'Hard\x20expire:\x20context(Clock)\x20>=\x20progress.current_time\x20+\x202x\x20duration'}],'required_permissions':[{'index':0x2,'name':'provider','description':'Provider\x20activates/reactivates'},{'index':0x3,'name':'admin','description':'Time-lock\x20triggers'}],'required_allocators':[{'name':'RenewAllocation','trigger_node':'Renewed','description':'Charge\x20renewal\x20fee\x20on\x20Renew'}],'forkable_fields':['duration_days','grace_period','additional_tiers'],'applicable_industries':['subscription','saas','membership','service'],'relevant_risks':['R-M1-01','R-M1-08','R-M2-01','R-M2-05','R-M3-02','R-M3-04','R-M4-01','R-M5-04'],'creation_notes':['First\x20node\x20\x27Paid\x27\x20represents\x20post-payment\x20state\x20—\x20Service.buy()\x20completes\x20subscription\x20payment\x20atomically\x20before\x20Progress\x20is\x20created','No\x20separate\x20\x27Subscribe\x27\x20or\x20\x27Pay\x27\x20nodes\x20needed\x20—\x20subscription\x20and\x20payment\x20are\x20handled\x20by\x20Service.buy(),\x20not\x20Machine','Time-lock\x20uses\x20context(Clock)\x20—\x20verify\x20Clock\x20address\x20in\x20Guard\x20table','Competing\x20Pair:\x20Renew\x20vs\x20Expire\x20vs\x20Cancel\x20—\x20first-wins','Renewed\x20node\x20loops\x20back\x20to\x20Active\x20(recurring\x20subscription)','Repository\x20records\x20subscription\x20status\x20for\x20cross-Machine\x20verification','Renewal\x20Allocation\x20triggers\x20on\x20Renewed\x20node\x20(not\x20Active\x20—\x20avoids\x20double-charge)','Note:\x20consensus_repositories\x20is\x20declarative-only\x20(NOT\x20auto-passed\x20to\x20Progress);\x20use\x20repository_ref\x20parameter\x20for\x20actual\x20Repository\x20object\x20—\x20see\x2006\x20§14.4','VARIANT\x20—\x20Content\x20subscription\x20(Substack-style):\x20replace\x20time-lock\x20Renew/Expire\x20with\x20content-delivery\x20flow:','\x20\x206-node\x20variant:\x20Paid\x20(entry)\x20→\x20ContentPublished\x20→\x20Completed\x20(terminal-success)','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Paid\x20→\x20Cancelled\x20(terminal-cancel)\x20|\x20Paid\x20→\x20Disputed\x20→\x20Refunded\x20(terminal-dispute)','\x20\x20Permission:\x20author=index\x201000\x20(publish\x20+\x20cancel),\x20arbitrator=index\x201500\x20(resolve\x20dispute),\x20reader=namedOperator=\x27\x27\x20(open\x20role,\x20no\x20specific\x20operator)','\x20\x20Guards:\x20deliver_guard\x20(verify\x20author\x20permission\x20+\x20content\x20hash),\x20cancel_guard\x20(verify\x20subscriber\x20request),\x20refund_guard\x20(verify\x20arbitration\x20outcome)','\x20\x20Allocators:\x20deliver=100%\x20to\x20author,\x20cancel=100%\x20refund\x20to\x20subscriber,\x20dispute=100%\x20refund\x20to\x20subscriber\x20(Guard-first-wins\x20pattern)','\x20\x20First-Forward-wins:\x20when\x20Paid\x20has\x20competing\x20forwards\x20(Deliver|Cancel|Dispute),\x20the\x20first\x20triggered\x20forward\x20wins;\x20subscribers\x20cannot\x20double-claim','CRITICAL\x20—\x20v1→v2\x20lesson:\x20arbitrations\x20MUST\x20be\x20added\x20BEFORE\x20Service.publish\x20(post-publish,\x20arbitrations\x20become\x20immutable\x20and\x20cannot\x20be\x20added\x20—\x20F-S-21)','\x20\x20If\x20you\x20accidentally\x20published\x20without\x20arbitrations,\x20you\x20MUST\x20create\x20a\x20new\x20Service\x20v2\x20with\x20arbitrations\x20bound\x20before\x20publishing\x20(the\x20v1\x20Service\x20must\x20be\x20paused/abandoned)','\x20\x20ConfirmGate\x20(C-S-19,\x20QS11)\x20will\x20warn\x20before\x20publish\x20without\x20arbitrations\x20—\x20do\x20not\x20bypass\x20this\x20warning\x20unless\x20explicitly\x20intending\x20no-arbitration\x20operation','Build\x20order\x20(content\x20variant):\x20Permission\x20→\x20Machine\x20(unpublished,\x20with\x20initial\x20forward)\x20→\x203\x20Guards\x20→\x203\x20Allocators\x20(template\x20on\x20Service)\x20→\x20Service\x20(unpublished,\x20bind\x20machine+buy_guard+order_allocators+arbitrations)\x20→\x20Publish\x20Service\x20→\x20Test\x20order\x20(3\x20paths:\x20normal/cancel/dispute)'],'example_use_case':'Monthly\x20SaaS\x20subscription:\x20$10/month.\x20Customer\x20can\x20renew\x20anytime\x20after\x20day\x2025.\x20'+'Auto-expire\x20on\x20day\x2035\x20if\x20not\x20renewed.\x20Cancel\x20anytime.\x0a\x0a'+'VARIANT\x20—\x20Content\x20subscription\x20(Substack-style):\x20$5/month\x20newsletter.\x20Author\x20publishes\x20content\x20→\x20'+'subscriber\x20reads.\x20Subscriber\x20can\x20cancel\x20anytime\x20for\x20full\x20refund.\x20Disputes\x20resolved\x20by\x20arbitrator\x20'+'(100%\x20refund\x20to\x20subscriber\x20if\x20dispute\x20upheld).\x206-node\x20Machine,\x203\x20Guards,\x203\x20Allocators.\x20'+'Tested\x20on\x20testnet\x20with\x203\x20order\x20paths:\x20normal\x20delivery,\x20cancel,\x20dispute.','publish_checklist':['Time-lock\x20Guards\x20tested\x20on\x20testnet\x20(both\x20TimeUnlock\x20+\x20AutoExpire)','Competing\x20Pair\x20semantics\x20verified\x20(Renew\x20vs\x20Expire\x20vs\x20Cancel)','Repository\x20write\x20tested\x20(subscription\x20status\x20queryable)','Renewal\x20loop\x20tested:\x20Paid\x20->\x20Active\x20->\x20RenewEligible\x20->\x20Renewed\x20->\x20Active','Content\x20variant:\x20initial\x20node\x20(prev_node=\x27\x27)\x20MUST\x20have\x20at\x20least\x20one\x20forward\x20(FIX-002)\x20—\x20empty\x20forwards=[]\x20causes\x20Progress\x20to\x20be\x20permanently\x20stuck','Content\x20variant:\x20arbitrations\x20added\x20BEFORE\x20publish\x20(cannot\x20add\x20post-publish\x20per\x20F-S-21)','Content\x20variant:\x203\x20order\x20paths\x20tested\x20on\x20testnet\x20—\x20normal\x20delivery,\x20cancel-within-grace,\x20dispute-resolution','Content\x20variant:\x20machineNode2file\x20export\x20as\x20backup\x20(covers\x20all\x206\x20nodes)']}];export const MACHINE_TEMPLATES_VERSION='1.0.0';export const MACHINE_TEMPLATES_COUNT=MACHINE_TEMPLATES['length'];export function getAllTemplates(){return MACHINE_TEMPLATES;}export function getTemplateById(a){return MACHINE_TEMPLATES['find'](b=>b['id']===a);}export function getTemplatesByScene(a){return MACHINE_TEMPLATES['filter'](b=>b['scene_id']===a);}export function getTemplatesByIndustry(a){return MACHINE_TEMPLATES['filter'](b=>b['applicable_industries']['includes'](a));}export function getTemplatesByPattern(a){return MACHINE_TEMPLATES['filter'](b=>b['recommended_patterns']['includes'](a));}export function suggestTemplateForIntent(a){const b=inferSceneFromFlow(a);if(!b)return undefined;const c=getTemplatesByScene(b['id']);return c[0x0];}export function getTemplateParameters(a){const b=getTemplateById(a);return b?b['parameters']:[];}export function getRequiredParameters(a){return getTemplateParameters(a)['filter'](b=>b['required']);}export function getOptionalParameters(a){return getTemplateParameters(a)['filter'](b=>!b['required']);}function validateParamType(a,b){switch(b){case'address':case'string':case'permission_ref':case'guard_ref':case'machine_ref':case'service_ref':case'arbitration_ref':case'reward_ref':return typeof a==='string';case'number':return typeof a==='number'||typeof a==='string'&&/^\d+$/['test'](a);case'boolean':return typeof a==='boolean';case'vec_address':case'vec_string':case'node_name_list':return Array['isArray'](a)&&a['every'](c=>typeof c==='string');default:return![];}}function deepSubstitute(a,b){if(typeof a==='string')return a['replace'](/\$\{(\w+)\}/g,(c,d)=>d in b?String(b[d]):'${'+d+'}');if(Array['isArray'](a))return a['map'](c=>deepSubstitute(c,b));if(a&&typeof a==='object'){const c={};for(const [d,e]of Object['entries'](a)){c[d]=deepSubstitute(e,b);}return c;}return a;}export function fillTemplate(a,b){const c=getTemplateById(a);if(!c)return{'success':![],'validation_errors':['Template\x20not\x20found:\x20'+a]};const d=c['parameters']['filter'](h=>h['required']&&!(h['name']in b))['map'](h=>h['name']);if(d['length']>0x0)return{'success':![],'missing_params':d,'validation_errors':['Missing\x20required\x20parameters:\x20'+d['join'](',\x20')]};const e=[];for(const h of c['parameters']){if(h['name']in b){const i=b[h['name']];!validateParamType(i,h['type'])&&e['push']('Parameter\x20\x22'+h['name']+'\x22\x20type\x20mismatch:\x20expected\x20'+h['type']+',\x20got\x20'+typeof i);}}if(e['length']>0x0)return{'success':![],'validation_errors':e};const f=deepSubstitute(c['example_nodes'],b),g=deepSubstitute(c['example_pairs'],b);return{'success':!![],'filled_nodes':f,'filled_pairs':g};}export function forkTemplate(a){const b=getTemplateById(a);if(!b)return undefined;const c={};for(const d of b['forkable_fields']){c[d]='see\x20example_nodes/example_pairs';}return{'template_id':a,'forkable_fields':b['forkable_fields'],'current_values':c,'instructions':['Modify\x20fields\x20below\x20to\x20customize\x20the\x20workflow','Keep\x20template\x20structure\x20intact\x20unless\x20explicitly\x20noted','Run\x20risk\x20assessment\x20after\x20modification\x20(machine-risk.ts)','User\x20MUST\x20confirm\x20final\x20JSON\x20before\x20publish\x20(ConfirmGate)']};}export const DECISION_TREE={'Q1':{'question':'Does\x20the\x20workflow\x20involve\x20multiple\x20independent\x20services/parties?','no_next':'Q3'},'Q2':{'question':'Are\x20these\x20services\x20already\x20published\x20as\x20separate\x20Machines?','yes_template':'tpl_machine_cross_machine','no_next':'DECOMPOSE'},'Q3':{'question':'Does\x20any\x20node\x20require\x20multiple\x20parties\x27\x20confirmation\x20to\x20advance?','no_next':'Q5'},'Q4':{'question':'Do\x20all\x20parties\x20have\x20EQUAL\x20weight?','yes_template':'tpl_machine_dual_signature','no_next':'tpl_machine_weighted_voting'},'Q5':{'question':'Does\x20the\x20workflow\x20need\x20exception\x20branches\x20(lost,\x20return,\x20dispute)?','yes_template':'tpl_machine_ecommerce_exceptions','no_next':'Q6'},'Q6':{'question':'Does\x20it\x20involve\x20recurring\x20payments\x20or\x20time-based\x20state\x20changes?','yes_template':'tpl_machine_subscription','no_next':'Q7'},'Q7':{'question':'Does\x20it\x20need\x20privacy-preserving\x20data\x20delivery\x20(Messenger)?','yes_template':'tpl_machine_privacy_delivery','no_next':'Q8'},'Q8':{'question':'Does\x20it\x20involve\x20deposit/refund\x20separation?','yes_template':'tpl_machine_rental','no_next':'Q9'},'Q9':{'question':'Does\x20it\x20need\x20reward/incentive\x20distribution\x20at\x20a\x20specific\x20node?','yes_template':'tpl_machine_reward','no_next':'tpl_machine_ecommerce_standard'}};export function walkDecisionTree(a){let b='Q1';while(b){const c=DECISION_TREE[b];if(!c)return'UNKNOWN';const d=a[b];if(d===undefined)return b;if(d){if(c['yes_template'])return c['yes_template'];if(b==='Q1'){b='Q2';continue;}if(b==='Q3'){b='Q4';continue;}return'UNKNOWN';}else{if(c['no_next']){if(c['no_next']==='DECOMPOSE')return'DECOMPOSE_INTO_MULTIPLE_MACHINES';if(c['no_next']['startsWith']('tpl_'))return c['no_next'];b=c['no_next'];continue;}return'UNKNOWN';}}return'UNKNOWN';}export function verifyTemplateSceneReferences(){const a=[];for(const b of MACHINE_TEMPLATES){!findScene(b['scene_id'])&&a['push']({'template_id':b['id'],'invalid_scene_id':b['scene_id']});}return a;}export function getReferencedGuardTemplateIds(){const a=new Set();for(const b of MACHINE_TEMPLATES){for(const c of b['required_guards']){a['add'](c['guard_template_id']);}}return a;}export function getReferencedRiskIds(){const a=new Set();for(const b of MACHINE_TEMPLATES){for(const c of b['relevant_risks']){a['add'](c);}}return a;}export function listTemplates(){return MACHINE_TEMPLATES['map'](a=>({'id':a['id'],'name':a['name'],'scene_id':a['scene_id'],'patterns':a['recommended_patterns'],'industries':a['applicable_industries']}));}
1
+ import{findScene,inferSceneFromFlow}from'./machine-ledger.js';export const MACHINE_TEMPLATES=[{'id':'tpl_machine_ecommerce_standard','scene_id':'ecommerce_standard','name':'Standard\x20E-commerce\x20Flow','description':'Linear\x20e-commerce\x20workflow:\x20Paid\x20(entry)\x20->\x20Ship\x20->\x20Receive\x20->\x20Complete.\x20'+'Payment\x20is\x20handled\x20by\x20the\x20Service\x20buy\x20flow\x20(direct\x20or\x20Passport-gated\x20purchase)\x20atomically;\x20Machine\x20starts\x20at\x20post-payment\x20state.\x20'+'Reaching\x20Complete\x20does\x20NOT\x20move\x20funds\x20—\x20allocation\x20is\x20a\x20separate\x20submitted\x20call\x20and\x20allocation.move\x20has\x20no\x20timer,\x20'+'so\x20a\x20keeper\x20(merchant\x20or\x20buyer-side\x20trigger)\x20must\x20fire\x20it\x20or\x20the\x20order\x20stays\x20settled-but-unpaid.\x20Recommended\x20baseline\x20for\x20new\x20merchants.','recommended_patterns':['P-M-SEQ'],'recommended_topology':['P-M-LINEAR'],'parameters':[{'name':'merchant_permission','type':'permission_ref','required':!![],'description':'Merchant\x20Permission\x20object\x20address\x20or\x20name\x20(must\x20have\x20custom\x20indices\x20defined)','constraint':'Permission\x20must\x20already\x20be\x20created;\x20index\x202\x20(merchant)\x20and\x20index\x203\x20(admin)\x20recommended'},{'name':'ship_forward_name','type':'string','required':!![],'default':'Ship','description':'Forward\x20name\x20for\x20shipping\x20step','constraint':'Must\x20be\x20<64\x20BCS\x20bytes;\x20only\x20letters/digits/underscore'},{'name':'receive_forward_name','type':'string','required':!![],'default':'Receive','description':'Forward\x20name\x20for\x20customer\x20receipt\x20confirmation'},{'name':'complete_node_name','type':'string','required':!![],'default':'Complete','description':'Terminal\x20node\x20name\x20triggering\x20fund\x20allocation'}],'example_nodes':[{'name':'Paid','description':'Entry:\x20order\x20created\x20and\x20paid\x20via\x20Service.buy();\x20Machine\x20starts\x20here'},{'name':'Shipped','description':'Goods\x20dispatched'},{'name':'Received','description':'Customer\x20confirmed\x20receipt'},{'name':'${complete_node_name}','description':'Terminal:\x20triggers\x20allocation'}],'example_pairs':[{'prev_node':'','next_node':'Paid','threshold':0x1,'forwards':[{'name':'Enter','weight':0x1,'named_operator':'','permission_index':0x0}]},{'prev_node':'Paid','next_node':'Shipped','threshold':0x1,'forwards':[{'name':'${ship_forward_name}','weight':0x1,'permission_index':0x2,'named_operator':''}]},{'prev_node':'Shipped','next_node':'Received','threshold':0x1,'forwards':[{'name':'${receive_forward_name}','weight':0x1,'named_operator':'','permission_index':0x0}]},{'prev_node':'Received','next_node':'${complete_node_name}','threshold':0x1,'forwards':[{'name':'Finish','weight':0x1,'permission_index':0x2,'named_operator':''}]}],'required_guards':[],'required_permissions':[{'index':0x2,'name':'merchant','description':'Merchant\x20role\x20for\x20Ship\x20+\x20Finish'},{'index':0x3,'name':'admin','description':'Admin\x20override\x20(optional)'}],'required_allocators':[{'name':'MerchantAllocation','trigger_node':'${complete_node_name}','description':'100%\x20to\x20merchant\x20Treasury\x20or\x20personal\x20address'}],'forkable_fields':['node_names','forward_names','thresholds','additional_branches'],'applicable_industries':['ecommerce','retail'],'relevant_risks':['R-M1-01','R-M1-02','R-M1-08','R-M2-01','R-M3-02','R-M4-01'],'creation_notes':['Build\x20order:\x20Permission\x20->\x20Machine\x20(unpublished)\x20->\x20Guards\x20->\x20Bind\x20guards\x20->\x20Publish\x20->\x20Bind\x20to\x20Service','First\x20node\x20\x27Paid\x27\x20represents\x20post-payment\x20state\x20—\x20Service.buy()\x20completes\x20payment\x20atomically\x20before\x20Progress\x20is\x20created','No\x20separate\x20\x27Order\x27\x20or\x20\x27Pay\x27\x20nodes\x20needed\x20—\x20payment\x20is\x20handled\x20by\x20Service.buy(),\x20not\x20Machine','Entry\x20point:\x20prev_node=\x27\x27\x20(empty\x20string)\x20targets\x20\x27Paid\x27\x20—\x20at\x20least\x20one\x20Pair\x20must\x20exist\x20with\x20empty\x20prev_node','If\x20using\x20P16\x20circular\x20reference\x20for\x20Service,\x20use\x20name\x20not\x20address\x20(Service\x20not\x20yet\x20published)'],'example_use_case':'Small\x20e-commerce\x20shop\x20selling\x20camera\x20accessories.\x20Linear\x20flow\x20with\x20no\x20exceptions.\x20'+'Funds\x20allocated\x20to\x20merchant\x20personal\x20address\x20on\x20Complete.','publish_checklist':['All\x204\x20nodes\x20have\x20at\x20least\x20one\x20outgoing\x20Forward\x20(except\x20terminal)','Entry\x20Pair\x20exists\x20(prev_node=\x27\x27\x20targets\x20\x27Paid\x27)','permissionIndex\x20values\x20match\x20Permission\x20object\x20indices','Test\x20Progress\x20run\x20on\x20testnet','machineNode2file\x20export\x20as\x20backup']},{'id':'tpl_machine_ecommerce_exceptions','scene_id':'ecommerce_with_exceptions','name':'E-commerce\x20Flow\x20with\x20Exception\x20Branches','description':'Multi-path\x20workflow:\x20Paid\x20(entry)\x20->\x20Ship\x20->\x20Receive/Lost/Return.\x20Lost\x20uses\x20dual-sig\x20(threshold=2).\x20'+'Payment\x20is\x20handled\x20by\x20Service.buy()\x20atomically;\x20Machine\x20starts\x20at\x20post-payment\x20state.\x20'+'Return\x20path\x20opens\x20Refund\x20->\x20Complete.\x20Competing\x20pairs\x20first-wins.','recommended_patterns':['P-M-SEQ','P-M-COMPETING'],'recommended_topology':['P-M-LINEAR','P-M-COMPETING'],'parameters':[{'name':'merchant_permission','type':'permission_ref','required':!![],'description':'Merchant\x20Permission\x20object'},{'name':'lost_threshold','type':'number','required':!![],'default':'2','description':'Threshold\x20for\x20dual-sig\x20on\x20Lost\x20node','constraint':'Must\x20be\x202\x20(customer\x20+\x20merchant)'},{'name':'arbitration_ref','type':'arbitration_ref','required':![],'description':'Arbitration\x20object\x20if\x20Lost\x20escalates\x20to\x20arbitration'},{'name':'time_guard_days','type':'number','required':!![],'default':'10','description':'Days\x20before\x20auto-complete\x20trigger\x20(time\x20guard)','constraint':'Must\x20be\x20>\x200;\x20reasonable\x20range\x207-30'},{'name':'return_node_name','type':'string','required':!![],'default':'Return','description':'Name\x20of\x20the\x20return/refund\x20node\x20in\x20the\x20exception\x20branch'}],'example_nodes':[{'name':'Paid','description':'Entry:\x20order\x20created\x20and\x20paid\x20via\x20Service.buy();\x20Machine\x20starts\x20here'},{'name':'Shipped'},{'name':'Received'},{'name':'Lost'},{'name':'Return'},{'name':'Refund'},{'name':'Complete'}],'example_pairs':[{'prev_node':'','next_node':'Paid','threshold':0x1,'forwards':[{'name':'Enter','weight':0x1,'named_operator':''}]},{'prev_node':'Paid','next_node':'Shipped','threshold':0x1,'forwards':[{'name':'Ship','weight':0x1,'permission_index':0x2}]},{'prev_node':'Shipped','next_node':'Received','threshold':0x1,'forwards':[{'name':'ConfirmReceive','weight':0x1,'named_operator':''}]},{'prev_node':'Shipped','next_node':'Lost','threshold':'${lost_threshold}','forwards':[{'name':'CustomerReport','weight':0x1,'named_operator':''},{'name':'MerchantConfirm','weight':0x1,'permission_index':0x2}]},{'prev_node':'Shipped','next_node':'Return','threshold':0x1,'forwards':[{'name':'RequestReturn','weight':0x1,'named_operator':''}]},{'prev_node':'Received','next_node':'Complete','threshold':0x1,'forwards':[{'name':'TimeGuard','weight':0x1,'permission_index':0x3,'guard':'time_guard_${time_guard_days}_days'},{'name':'MerchantFinish','weight':0x1,'permission_index':0x2}]},{'prev_node':'Return','next_node':'Refund','threshold':0x1,'forwards':[{'name':'IssueRefund','weight':0x1,'permission_index':0x2}]},{'prev_node':'Refund','next_node':'Complete','threshold':0x1,'forwards':[{'name':'CloseReturn','weight':0x1,'permission_index':0x2}]}],'required_guards':[{'guard_template_id':'tpl_forward_node_check','bound_to_forward':'MerchantConfirm','purpose':'Dual-sig\x20on\x20Lost\x20node'},{'guard_template_id':'tpl_forward_node_check','bound_to_forward':'TimeGuard','purpose':'Time\x20lock\x20${time_guard_days}\x20days'}],'required_permissions':[{'index':0x2,'name':'merchant','description':'Merchant\x20role'},{'index':0x3,'name':'admin','description':'Admin\x20/\x20time-guard\x20trigger'}],'required_allocators':[{'name':'CompleteAllocation','trigger_node':'Complete','description':'Full\x20allocation\x20to\x20merchant\x20on\x20normal\x20completion'},{'name':'RefundAllocation','trigger_node':'Refund','description':'Full\x20refund\x20to\x20customer\x20on\x20return'},{'name':'LostAllocation','trigger_node':'Lost','description':'Optional:\x20partial\x20refund\x20or\x20escrow\x20(depends\x20on\x20policy)'}],'forkable_fields':['node_names','branch_conditions','time_guard_days','lost_threshold'],'applicable_industries':['ecommerce','logistics'],'relevant_risks':['R-M1-01','R-M1-03','R-M1-08','R-M2-01','R-M2-05','R-M3-02','R-M3-04','R-M3-05','R-M4-01','R-M5-03'],'creation_notes':['First\x20node\x20\x27Paid\x27\x20represents\x20post-payment\x20state\x20—\x20Service.buy()\x20completes\x20payment\x20atomically\x20before\x20Progress\x20is\x20created','No\x20separate\x20\x27Order\x27\x20or\x20\x27Pay\x27\x20nodes\x20needed\x20—\x20payment\x20is\x20handled\x20by\x20Service.buy(),\x20not\x20Machine','Competing\x20Pairs\x20(Shipped\x20->\x20Received/Lost/Return)\x20are\x20mutually\x20exclusive\x20—\x20first\x20threshold\x20met\x20wins','Lost\x20node\x20threshold=2\x20means\x20BOTH\x20customer\x20and\x20merchant\x20Forwards\x20must\x20execute','TimeGuard\x20must\x20use\x20context(Clock)\x20>=\x20progress.current_time\x20+\x20duration\x20(progress.move\x20exposes\x20current_time,\x20refreshed\x20on\x20every\x20node\x20transition\x20—\x20there\x20is\x20no\x20entry_time\x20field)','If\x20Lost\x20escalates\x20to\x20arbitration,\x20bind\x20arbitration_usage_guard\x20on\x20Lost\x20forward','Refund\x20Allocation\x20must\x20use\x20sharing.who=OrderHolder\x20(refund\x20to\x20customer,\x20NOT\x20merchant)'],'example_use_case':'Mid-size\x20e-commerce\x20with\x207-day\x20return\x20policy\x20and\x20dispute\x20handling.\x20'+'Lost\x20claims\x20require\x20customer+merchant\x20dual\x20confirmation.','publish_checklist':['All\x20competing\x20Pairs\x20tested:\x20verify\x20first-wins\x20semantics\x20on\x20testnet','Lost\x20dual-sig\x20tested:\x20incomplete\x20signatures\x20do\x20not\x20advance','TimeGuard\x20Clock\x20query\x20verified\x20(testnet)','All\x20three\x20Allocators\x20tested\x20with\x20correct\x20sharing.who','Arbitration\x20binding\x20(if\x20any)\x20verified\x20via\x20gen_passport']},{'id':'tpl_machine_rental','scene_id':'rental_standard','name':'Equipment\x20Rental\x20Flow','description':'Rental\x20flow:\x20DepositPaid\x20(entry)\x20->\x20Pickup\x20->\x20In\x20Use\x20->\x20Return\x20->\x20Refund\x20Deposit.\x20'+'Payment\x20is\x20handled\x20by\x20Service.buy()\x20atomically;\x20Machine\x20starts\x20at\x20post-deposit\x20state.\x20'+'Separates\x20deposit\x20from\x20rental\x20fee\x20(two\x20Allocators).\x20Damage\x20report\x20via\x20retained_submission.','recommended_patterns':['P-M-SEQ'],'recommended_topology':['P-M-LINEAR'],'parameters':[{'name':'merchant_permission','type':'permission_ref','required':!![],'description':'Merchant\x20Permission\x20object'},{'name':'deposit_amount','type':'number','required':!![],'description':'Deposit\x20amount\x20in\x20smallest\x20WOW\x20unit','constraint':'Must\x20equal\x20order.amount\x20field;\x20verify\x20via\x20Guard\x20query'},{'name':'damage_inspection_node','type':'string','required':!![],'default':'DamageCheck','description':'Name\x20of\x20the\x20node\x20where\x20damage\x20inspection\x20occurs'},{'name':'return_node_name','type':'string','required':!![],'default':'Return','description':'Name\x20of\x20the\x20return\x20node\x20after\x20damage\x20check\x20fails'}],'example_nodes':[{'name':'DepositPaid','description':'Entry:\x20deposit\x20paid\x20via\x20Service.buy();\x20Machine\x20starts\x20here'},{'name':'PickedUp'},{'name':'InUse'},{'name':'Return'},{'name':'DamageCheck'},{'name':'DepositRefund'},{'name':'Complete'}],'example_pairs':[{'prev_node':'','next_node':'DepositPaid','threshold':0x1,'forwards':[{'name':'Enter','weight':0x1,'named_operator':''}]},{'prev_node':'DepositPaid','next_node':'PickedUp','threshold':0x1,'forwards':[{'name':'Pickup','weight':0x1,'named_operator':'','permission_index':0x2}]},{'prev_node':'PickedUp','next_node':'InUse','threshold':0x1,'forwards':[{'name':'StartUse','weight':0x1,'named_operator':''}]},{'prev_node':'InUse','next_node':'Return','threshold':0x1,'forwards':[{'name':'ReturnItem','weight':0x1,'named_operator':''}]},{'prev_node':'Return','next_node':'DamageCheck','threshold':0x1,'forwards':[{'name':'Inspect','weight':0x1,'permission_index':0x2,'retained_submission':'damage_report'}]},{'prev_node':'Return','next_node':'Complete','threshold':0x1,'forwards':[{'name':'CleanReturn','weight':0x1,'permission_index':0x2}]},{'prev_node':'DamageCheck','next_node':'DepositRefund','threshold':0x1,'forwards':[{'name':'DeductDamage','weight':0x1,'permission_index':0x2}]},{'prev_node':'DepositRefund','next_node':'Complete','threshold':0x1,'forwards':[{'name':'Close','weight':0x1,'permission_index':0x2}]}],'required_guards':[{'guard_template_id':'tpl_forward_privacy_delivery_proof','bound_to_forward':'Inspect','purpose':'Optional:\x20damage\x20evidence\x20proof\x20(photo,\x20video)'}],'required_permissions':[{'index':0x2,'name':'merchant','description':'Rental\x20provider'}],'required_allocators':[{'name':'RentalFeeAllocation','trigger_node':'Complete','description':'Rental\x20fee\x20to\x20merchant'},{'name':'DepositRefundAllocation','trigger_node':'DepositRefund','description':'Remaining\x20deposit\x20to\x20customer\x20(OrderHolder\x20sharing.who)'},{'name':'DamageDeductionAllocation','trigger_node':'DamageCheck','description':'Damage\x20deduction\x20to\x20merchant'}],'forkable_fields':['deposit_amount','damage_node_logic','additional_inspection_steps'],'applicable_industries':['rental','equipment','vehicle'],'relevant_risks':['R-M1-01','R-M1-08','R-M2-01','R-M2-04','R-M3-02','R-M4-01','R-M5-02'],'creation_notes':['First\x20node\x20\x27DepositPaid\x27\x20represents\x20post-payment\x20state\x20—\x20Service.buy()\x20completes\x20deposit\x20payment\x20atomically\x20before\x20Progress\x20is\x20created','No\x20separate\x20\x27Reserve\x27\x20or\x20\x27PayDeposit\x27\x20nodes\x20needed\x20—\x20reservation\x20and\x20payment\x20are\x20handled\x20by\x20Service.buy(),\x20not\x20Machine','Damage\x20report\x20uses\x20retained_submission\x20—\x20values\x20stored\x20uniquely\x20by\x20(current_node,\x20next_node,\x20forward_name)','Two\x20competing\x20Pairs\x20at\x20Return\x20node:\x20DamageCheck\x20vs\x20Complete\x20(clean\x20return)','DamageDeduction\x20Allocation\x20uses\x20sharing.who=Entity\x20(merchant),\x20not\x20OrderHolder'],'example_use_case':'Camera\x20equipment\x20rental:\x20customer\x20pays\x201000\x20WOW\x20deposit,\x20returns\x20equipment,\x20'+'merchant\x20inspects.\x20If\x20damaged,\x20200\x20WOW\x20deducted;\x20otherwise\x20full\x20refund.','publish_checklist':['Deposit\x20Guard\x20tested\x20(testnet)\x20with\x20valid/invalid\x20amounts','Damage\x20report\x20retained_submission\x20stored\x20correctly\x20(query\x20progress_history)','Both\x20Return\x20branches\x20tested\x20(DamageCheck\x20+\x20CleanReturn)','All\x20three\x20Allocators\x20verified\x20with\x20correct\x20sharing.who']},{'id':'tpl_machine_dual_signature','scene_id':'dual_signature','name':'Dual-Signature\x20Consensus\x20Flow','description':'Critical\x20node\x20requires\x20both\x20customer\x20+\x20merchant\x20confirmation.\x20threshold=2\x20with\x20two\x20Forwards\x20(weight=1\x20each).\x20'+'Customer\x20uses\x20namedOperator=\x27\x27\x20(OrderHolder);\x20merchant\x20uses\x20permissionIndex=2.','recommended_patterns':['P-M-AND'],'recommended_topology':['P-M-LINEAR'],'parameters':[{'name':'merchant_permission','type':'permission_ref','required':!![],'description':'Merchant\x20Permission\x20object'},{'name':'critical_node_name','type':'string','required':!![],'default':'Approve','description':'Node\x20requiring\x20dual-sig'},{'name':'next_node_after_approval','type':'string','required':!![],'default':'Execute','description':'Name\x20of\x20the\x20node\x20that\x20follows\x20after\x20dual-signature\x20approval'}],'example_nodes':[{'name':'Initiated'},{'name':'${critical_node_name}','description':'Dual-sig\x20required\x20here'},{'name':'${next_node_after_approval}'},{'name':'Complete'}],'example_pairs':[{'prev_node':'','next_node':'Initiated','threshold':0x1,'forwards':[{'name':'Initiate','weight':0x1,'named_operator':''}]},{'prev_node':'Initiated','next_node':'${critical_node_name}','threshold':0x1,'forwards':[{'name':'Submit','weight':0x1,'named_operator':''}]},{'prev_node':'${critical_node_name}','next_node':'${next_node_after_approval}','threshold':0x2,'forwards':[{'name':'CustomerApprove','weight':0x1,'named_operator':'','guard':'customer_identity_guard'},{'name':'MerchantApprove','weight':0x1,'permission_index':0x2,'guard':'merchant_identity_guard'}]},{'prev_node':'${next_node_after_approval}','next_node':'Complete','threshold':0x1,'forwards':[{'name':'Finish','weight':0x1,'permission_index':0x2}]}],'required_guards':[{'guard_template_id':'tpl_forward_node_check','bound_to_forward':'CustomerApprove','purpose':'Verify\x20customer\x20identity\x20(order.owner)'},{'guard_template_id':'tpl_forward_node_check','bound_to_forward':'MerchantApprove','purpose':'Verify\x20merchant\x20identity\x20(permission\x20holder)'}],'required_permissions':[{'index':0x2,'name':'merchant','description':'Merchant\x20approval'}],'required_allocators':[{'name':'CompleteAllocation','trigger_node':'Complete','description':'Allocation\x20on\x20dual-sig\x20completion'}],'forkable_fields':['critical_node_name','additional_approvers','guard_logic'],'applicable_industries':['ecommerce','service','logistics','escrow'],'relevant_risks':['R-M1-08','R-M2-01','R-M3-02','R-M3-04'],'creation_notes':['threshold=2\x20means\x20BOTH\x20Forwards\x20must\x20execute\x20to\x20advance\x20(AND\x20semantics)','Customer\x20Forward\x20uses\x20namedOperator=\x27\x27\x20(OrderHolder)','Merchant\x20Forward\x20uses\x20permissionIndex=2','If\x20either\x20party\x20fails\x20to\x20sign,\x20workflow\x20stalls\x20—\x20consider\x20adding\x20timeout\x20Guard'],'example_use_case':'High-value\x20order\x20(e.g.\x20real\x20estate\x20transaction)\x20requiring\x20both\x20buyer\x20and\x20seller\x20confirmation.','publish_checklist':['Both\x20Forward\x20identities\x20tested\x20on\x20testnet','Verify\x20partial\x20signature\x20does\x20NOT\x20advance\x20(threshold=2)','Guards\x20correctly\x20distinguish\x20customer\x20vs\x20merchant\x20identity']},{'id':'tpl_machine_weighted_voting','scene_id':'weighted_voting','name':'Weighted\x20Voting\x20Flow','description':'Multi-party\x20voting\x20with\x20unequal\x20weights.\x20threshold=100,\x20chief\x20weight=60,\x20members\x20weight=40\x20total.\x20'+'Each\x20member\x27s\x20weight\x20extracted\x20via\x20Guard\x20query\x20from\x20Arbitration\x20object.','recommended_patterns':['P-M-VOTE'],'recommended_topology':['P-M-LINEAR'],'parameters':[{'name':'arbitration_ref','type':'arbitration_ref','required':!![],'description':'Arbitration\x20object\x20storing\x20voter\x20weights'},{'name':'threshold_total','type':'number','required':!![],'default':'100','description':'Total\x20weight\x20threshold\x20for\x20decision'},{'name':'chief_weight','type':'number','required':!![],'default':'60','description':'Weight\x20assigned\x20to\x20the\x20chief\x20voter\x20(out\x20of\x20100)'},{'name':'member_count','type':'number','required':!![],'default':'5','description':'Number\x20of\x20voting\x20members\x20(excluding\x20chief)'}],'example_nodes':[{'name':'VoteOpened'},{'name':'Voting'},{'name':'Approved'},{'name':'Rejected'}],'example_pairs':[{'prev_node':'','next_node':'VoteOpened','threshold':0x1,'forwards':[{'name':'OpenVote','weight':0x1,'permission_index':0x3}]},{'prev_node':'VoteOpened','next_node':'Voting','threshold':0x1,'forwards':[{'name':'StartVoting','weight':0x1,'permission_index':0x3}]},{'prev_node':'Voting','next_node':'Approved','threshold':'${threshold_total}','forwards':[{'name':'ChiefVote','weight':'${chief_weight}','permission_index':0x2,'guard':'arb_voting_guard','retained_submission':'chief_vote_record'},{'name':'MemberVote','weight':0x8,'named_operator':'member','guard':'arb_voting_guard','retained_submission':'member_vote_record'}]},{'prev_node':'Voting','next_node':'Rejected','threshold':0x1,'forwards':[{'name':'TimeoutReject','weight':0x1,'permission_index':0x3,'guard':'voting_timeout_guard'}]}],'required_guards':[{'guard_template_id':'tpl_voting_guard_numeric_weight','bound_to_forward':'ChiefVote','purpose':'Verify\x20voting\x20eligibility\x20+\x20extract\x20weight\x20from\x20Arbitration'},{'guard_template_id':'tpl_voting_guard_numeric_weight','bound_to_forward':'MemberVote','purpose':'Verify\x20voting\x20eligibility\x20+\x20prevent\x20double-vote'}],'required_permissions':[{'index':0x2,'name':'chief','description':'Chief\x20voter\x20(high\x20weight)'},{'index':0x3,'name':'admin','description':'Vote\x20opener\x20/\x20timeout\x20trigger'}],'required_allocators':[{'name':'ApprovedAllocation','trigger_node':'Approved','description':'Allocation\x20on\x20approval'}],'forkable_fields':['weights','voter_count','timeout_days'],'applicable_industries':['governance','arbitration','dao'],'relevant_risks':['R-M1-08','R-M2-05','R-M3-04','R-M5-04','R-X1-14'],'creation_notes':['Member\x20weight\x20must\x20be\x20extracted\x20dynamically\x20via\x20Guard\x20query\x20(not\x20hardcoded\x20in\x20Forward)','Guard\x20MUST\x20check\x20arb.voted\x20has\x20[Signer]\x20to\x20prevent\x20double-voting\x20(R-X1-14\x20CRITICAL)','Competing\x20Pair:\x20Approved\x20vs\x20Rejected\x20(timeout)\x20—\x20first-wins','Voting\x20weight\x20is\x20query-derived;\x20Forward\x20weight\x20field\x20is\x20just\x20session\x20counter'],'example_use_case':'Arbitration\x20panel:\x201\x20chief\x20(weight\x2060)\x20+\x205\x20members\x20(weight\x208\x20each\x20=\x2040).\x20'+'Need\x20total\x20>=\x20100\x20to\x20approve.\x20Reject\x20after\x2072h\x20timeout.','publish_checklist':['Arbitration\x20object\x20created\x20and\x20tested','Double-vote\x20prevention\x20verified\x20(try\x20voting\x20twice\x20—\x20should\x20fail)','Weight\x20extraction\x20tested\x20with\x20different\x20voter\x20configurations','Timeout\x20Guard\x20(Clock)\x20verified\x20on\x20testnet']},{'id':'tpl_machine_cross_machine','scene_id':'cross_machine_supply_chain','name':'Cross-Machine\x20Supply\x20Chain','description':'Decomposed\x20supply\x20chain\x20across\x20multiple\x20Machines.\x20Machine\x20B\x27s\x20Forward\x20Guard\x20queries\x20Machine\x20A\x27s\x20Progress\x20'+'via\x20convert_witness=100\x20to\x20verify\x20upstream\x20completion\x20before\x20advancing.','recommended_patterns':['P-M-CROSS-MACHINE'],'recommended_topology':['P-M-LINEAR'],'parameters':[{'name':'machine_a_id','type':'machine_ref','required':!![],'description':'Upstream\x20Machine\x20(must\x20already\x20be\x20published)','constraint':'Machine\x20A\x20must\x20be\x20published\x20BEFORE\x20Machine\x20B\x27s\x20Guard\x20can\x20reference\x20its\x20Progress\x20'+'(Progress\x20creation\x20verifies\x20the\x20bound\x20Machine\x20is\x20published\x20—\x20see\x2006\x20§14.6)'},{'name':'machine_a_complete_node','type':'string','required':!![],'default':'Complete','description':'Target\x20node\x20name\x20in\x20Machine\x20A\x20to\x20verify'},{'name':'machine_b_permission','type':'permission_ref','required':!![],'description':'Machine\x20B\x27s\x20Permission\x20object'}],'example_nodes':[{'name':'UpstreamVerified'},{'name':'Production'},{'name':'Complete'}],'example_pairs':[{'prev_node':'','next_node':'UpstreamVerified','threshold':0x1,'forwards':[{'name':'VerifyUpstream','weight':0x1,'permission_index':0x2,'guard':'upstream_progress_guard','retained_submission':'upstream_progress_id'}]},{'prev_node':'UpstreamVerified','next_node':'Production','threshold':0x1,'forwards':[{'name':'StartProduction','weight':0x1,'permission_index':0x2}]},{'prev_node':'Production','next_node':'Complete','threshold':0x1,'forwards':[{'name':'Finish','weight':0x1,'permission_index':0x2}]}],'required_guards':[{'guard_template_id':'tpl_forward_node_check','bound_to_forward':'VerifyUpstream','purpose':'Query\x20Machine\x20A\x27s\x20Progress:\x20verify\x20it\x20reached\x20${machine_a_complete_node}'}],'required_permissions':[{'index':0x2,'name':'manufacturer','description':'Machine\x20B\x20operator'}],'required_allocators':[{'name':'CompleteAllocation','trigger_node':'Complete','description':'Allocation\x20to\x20Machine\x20B\x27s\x20merchant'}],'forkable_fields':['upstream_machine_ref','verification_node_name'],'applicable_industries':['manufacturing','logistics','retail','supply_chain'],'relevant_risks':['R-M1-01','R-M1-08','R-M2-01','R-M2-04','R-M3-04','R-M5-04','R-M5-05','R-M5-06'],'creation_notes':['Machine\x20A\x20MUST\x20be\x20published\x20before\x20Machine\x20B\x20(dependency\x20order)','Guard\x20uses\x20convert_witness=100\x20to\x20convert\x20submitted\x20Order/Progress\x20ID\x20into\x20queryable\x20Progress\x20object','Cross-Machine\x20dependency\x20is\x20one-way\x20(no\x20cycles)','retained_submission\x20stores\x20upstream\x20Progress\x20ID\x20for\x20later\x20audit','Multi-party\x20chain:\x20extend\x20pattern\x20with\x20Machine\x20C,\x20D,\x20...\x20(each\x20independently\x20published)','Dependency\x20verification:\x20enforced\x20when\x20the\x20Progress\x20object\x20is\x20created\x20(creation\x20checks\x20the\x20bound\x20Machine\x20is\x20published\x20—\x20see\x2006\x20§14.6)'],'example_use_case':'Supplier\x20(Machine\x20A)\x20->\x20Manufacturer\x20(Machine\x20B)\x20->\x20Retailer\x20(Machine\x20C).\x20'+'Manufacturer\x20cannot\x20start\x20production\x20until\x20supplier\x27s\x20Progress\x20reaches\x20\x27Complete\x27.','publish_checklist':['Machine\x20A\x20already\x20published\x20on-chain\x20(verify\x20via\x20onchain_objects)','Cross-Machine\x20Guard\x20tested\x20with\x20valid/invalid\x20upstream\x20Progress\x20IDs','retained_submission\x20verified\x20(query\x20progress_history\x20for\x20upstream_progress_id)','Independent\x20testing:\x20run\x20Machine\x20A\x20to\x20Complete,\x20then\x20attempt\x20Machine\x20B\x27s\x20VerifyUpstream']},{'id':'tpl_machine_privacy_delivery','scene_id':'privacy_delivery','name':'Privacy-Preserving\x20Delivery\x20Flow','description':'Customer\x20submits\x20privacy\x20data\x20via\x20Messenger\x20(encrypted,\x20off-chain).\x20Chain\x20stores\x20only\x20Merkle\x20Root\x20Proof.\x20'+'Guard\x20verifies\x20Proof\x20signature\x20+\x20timestamp\x20+\x20service\x20binding.\x20Uses\x20tpl_forward_privacy_delivery_proof\x20(strict\x20mode).','recommended_patterns':['P-M-SEQ'],'recommended_topology':['P-M-LINEAR'],'parameters':[{'name':'merchant_permission','type':'permission_ref','required':!![],'description':'Merchant\x20Permission\x20object'},{'name':'proof_node_name','type':'string','required':!![],'default':'ProofSubmitted','description':'Name\x20of\x20the\x20node\x20where\x20delivery\x20proof\x20is\x20submitted'},{'name':'delivery_node_name','type':'string','required':!![],'default':'DeliveryConfirmed','description':'Name\x20of\x20the\x20node\x20where\x20delivery\x20confirmation\x20occurs'}],'example_nodes':[{'name':'Paid','description':'Entry:\x20order\x20created\x20and\x20paid\x20via\x20Service.buy();\x20Machine\x20starts\x20here'},{'name':'${proof_node_name}','description':'Customer\x20submits\x20Proof\x20via\x20Messenger'},{'name':'${delivery_node_name}'},{'name':'Complete'}],'example_pairs':[{'prev_node':'','next_node':'Paid','threshold':0x1,'forwards':[{'name':'Enter','weight':0x1,'named_operator':''}]},{'prev_node':'Paid','next_node':'${proof_node_name}','threshold':0x1,'forwards':[{'name':'SubmitProof','weight':0x1,'named_operator':'','guard':'tpl_forward_privacy_delivery_proof','retained_submission':'proof_address'}]},{'prev_node':'${proof_node_name}','next_node':'${delivery_node_name}','threshold':0x1,'forwards':[{'name':'ConfirmDelivery','weight':0x1,'permission_index':0x2}]},{'prev_node':'${delivery_node_name}','next_node':'Complete','threshold':0x1,'forwards':[{'name':'Finish','weight':0x1,'permission_index':0x2}]}],'required_guards':[{'guard_template_id':'tpl_forward_privacy_delivery_proof','bound_to_forward':'SubmitProof','purpose':'Verify\x20Proof:\x20signer=proof.signer\x20∧\x20proof.time>order.time\x20∧\x20order.service=service'}],'required_permissions':[{'index':0x2,'name':'merchant','description':'Merchant\x20confirms\x20delivery'}],'required_allocators':[{'name':'CompleteAllocation','trigger_node':'Complete','description':'Allocation\x20to\x20merchant\x20after\x20delivery\x20confirmation'}],'forkable_fields':['proof_node_name','delivery_node_name','additional_evidence_steps'],'applicable_industries':['ecommerce','logistics','privacy_service'],'relevant_risks':['R-M1-01','R-M1-08','R-M2-01','R-M2-04','R-M3-02','R-M5-03'],'creation_notes':['Use\x20strict\x20mode\x20tpl_forward_privacy_delivery_proof\x20(3\x20conditions:\x20Signer\x20+\x20time\x20+\x20service\x20binding)','submitChainProof\x20about_address\x20=\x20peerAddress\x20(NOT\x20sessionId)\x20—\x20about\x20records\x20ONLY\x20the\x20contact;\x20it\x20has\x20no\x20on-chain\x20meaning\x20and\x20must\x20NEVER\x20be\x20a\x20guard\x20decision\x20condition','PRIVACY:\x20never\x20pass\x20order_id\x20or\x20any\x20order\x20reference\x20via\x20the\x20description\x20field\x20(that\x20would\x20publicly\x20link\x20Proof\x20to\x20Order\x20on\x20chain)\x20—\x20all\x20order/business\x20linkage\x20stays\x20inside\x20the\x20Messenger\x20conversation;\x20acceptance\x20of\x20delivered\x20info\x20is\x20the\x20merchant\x27s\x20confirming\x20forward,\x20not\x20the\x20proof\x27s\x20recorded\x20address','Guard\x20table\x20item\x20name\x20MUST\x20be\x20<64\x20BCS\x20bytes\x20(MAX_NAME_LENGTH=64)','retained_submission\x20stores\x20Proof\x20address\x20for\x20arbitration\x20query','Proof\x20MUST\x20be\x20generated\x20by\x20messenger.submitChainProof\x20(not\x20manual)'],'example_use_case':'Customer\x20sends\x20delivery\x20address\x20via\x20Messenger\x20(encrypted).\x20Chain\x20stores\x20only\x20Proof.\x20'+'Merchant\x20verifies\x20Proof,\x20then\x20confirms\x20delivery.','publish_checklist':['Strict\x20mode\x20Guard\x20tested:\x203\x20conditions\x20verified\x20individually','Messenger\x20integration\x20tested\x20end-to-end\x20(submit\x20+\x20verify)','retained_submission\x20stored\x20Proof\x20address\x20queryable\x20from\x20progress_history','Guard\x20table\x20item\x20name\x20length\x20validated\x20(<64\x20BCS\x20bytes)']},{'id':'tpl_machine_reward','scene_id':'reward_incentive','name':'Reward\x20Incentive\x20Flow','description':'Customer\x20triggers\x20Reward\x20claim\x20at\x20specific\x20node.\x20Guard\x20prevents\x20double-claim\x20via\x20query_reward_record_count==0.\x20'+'Reward\x20object\x20independent\x20of\x20Allocator.','recommended_patterns':['P-M-SEQ'],'recommended_topology':['P-M-LINEAR'],'parameters':[{'name':'reward_ref','type':'reward_ref','required':!![],'description':'Reward\x20object\x20address\x20(must\x20be\x20already\x20created)'},{'name':'claim_node_name','type':'string','required':!![],'default':'ClaimReward','description':'Name\x20of\x20the\x20node\x20where\x20reward\x20claims\x20are\x20triggered'}],'example_nodes':[{'name':'Eligible'},{'name':'${claim_node_name}'},{'name':'Rewarded'},{'name':'Complete'}],'example_pairs':[{'prev_node':'','next_node':'Eligible','threshold':0x1,'forwards':[{'name':'Enter','weight':0x1,'named_operator':''}]},{'prev_node':'Eligible','next_node':'${claim_node_name}','threshold':0x1,'forwards':[{'name':'TriggerClaim','weight':0x1,'named_operator':'','guard':'reward_anti_double_guard','retained_submission':'claim_record'}]},{'prev_node':'${claim_node_name}','next_node':'Rewarded','threshold':0x1,'forwards':[{'name':'IssueReward','weight':0x1,'permission_index':0x3}]},{'prev_node':'Rewarded','next_node':'Complete','threshold':0x1,'forwards':[{'name':'Finish','weight':0x1,'permission_index':0x2}]}],'required_guards':[{'guard_template_id':'tpl_reward_one_time_claim','bound_to_forward':'TriggerClaim','purpose':'Verify\x20query_reward_record_count==0\x20to\x20prevent\x20double-claim'}],'required_permissions':[{'index':0x2,'name':'merchant','description':'Completes\x20flow'},{'index':0x3,'name':'reward_admin','description':'Issues\x20reward\x20tokens'}],'required_allocators':[{'name':'CompleteAllocation','trigger_node':'Complete','description':'Standard\x20allocation\x20(separate\x20from\x20Reward)'}],'forkable_fields':['claim_node_name','additional_reward_conditions'],'applicable_industries':['ecommerce','subscription','education','loyalty'],'relevant_risks':['R-M1-08','R-M2-05','R-M3-04','R-X1-14'],'creation_notes':['Reward\x20Guard\x20MUST\x20check\x20query_reward_record_count\x20==\x200\x20(R-X1-14\x20CRITICAL)','Reward\x20is\x20INDEPENDENT\x20of\x20Allocator\x20—\x20both\x20can\x20fire\x20on\x20different\x20nodes','Reward\x20object\x20must\x20be\x20created\x20BEFORE\x20publishing\x20this\x20Machine','retained_submission\x20stores\x20claim\x20record\x20for\x20audit'],'example_use_case':'Loyalty\x20program:\x20after\x20customer\x20completes\x205\x20orders,\x20eligible\x20to\x20claim\x20reward\x20token.\x20'+'Anti-double-claim\x20Guard\x20ensures\x20one\x20claim\x20per\x20customer.','publish_checklist':['Reward\x20object\x20already\x20created\x20and\x20tested','Anti-double-claim\x20Guard\x20tested:\x20claim\x20twice\x20should\x20fail\x20on\x20second\x20attempt','retained_submission\x20verified\x20(claim_record\x20queryable)']},{'id':'tpl_machine_wonder_feedback','scene_id':'wonder_feedback','name':'Wonder\x20Feedback\x20Flow\x20(Post-Completion\x20Rating)','description':'Post-completion\x20rating\x20flow:\x20Paid\x20(entry)\x20→\x20Shipped\x20→\x20Received\x20→\x20Completed\x20→\x20{Wonder\x20|\x20NoWonder}.\x20'+'After\x20the\x20order\x20reaches\x20\x27Completed\x27\x20(terminal\x20business\x20state,\x20funds\x20already\x20allocated\x20to\x20merchant),\x20'+'the\x20OrderHolder\x20(namedOperator=\x27\x27)\x20can\x20advance\x20Progress\x20to\x20\x27wonder\x27\x20(positive\x20review)\x20or\x20\x27no_wonder\x27\x20'+'(negative\x20review).\x20A\x20bound\x20Reward\x20object\x27s\x20claim_guard\x20verifies\x20Progress.current\x20==\x20\x27wonder\x27\x20before\x20'+'paying\x20out\x20—\x20reward\x20claim\x20needs\x20NO\x20Permission.\x20Dispute\x20is\x20NEVER\x20modeled\x20here:\x20it\x20flows\x20through\x20'+'the\x20Order\x27s\x20dispute\x20flow\x20→\x20Arb\x20case\x20→\x20arbiter\x20ruling\x20→\x20fee\x20withdrawal,\x20fully\x20off-Machine.','recommended_patterns':['P-M-SEQ','P-M-COMPETING'],'recommended_topology':['P-M-LINEAR','P-M-COMPETING'],'parameters':[{'name':'merchant_permission','type':'permission_ref','required':!![],'description':'Merchant\x20Permission\x20object\x20(index\x202\x20=\x20merchant,\x20index\x203\x20=\x20admin)'},{'name':'wonder_node_name','type':'string','required':!![],'default':'wonder','description':'Node\x20name\x20for\x20positive\x20feedback\x20(praise)\x20terminal','constraint':'Must\x20match\x20/^(wonder|praise|thumbs_up)$/i\x20OR\x20be\x20a\x20custom\x20name;\x20must\x20NOT\x20match\x20dispute\x20anti-pattern\x20regex'},{'name':'no_wonder_node_name','type':'string','required':!![],'default':'no_wonder','description':'Node\x20name\x20for\x20negative\x20feedback\x20(complaint)\x20terminal','constraint':'Must\x20match\x20/^(no_wonder|complain|thumbs_down)$/i\x20OR\x20be\x20a\x20custom\x20name;\x20must\x20NOT\x20match\x20dispute\x20anti-pattern\x20regex'},{'name':'reward_ref','type':'reward_ref','required':![],'description':'Reward\x20object\x20address\x20(optional).\x20If\x20bound,\x20its\x20claim_guard\x20should\x20verify\x20Progress.current\x20==\x20wonder_node_name\x20AND\x20order.holder\x20==\x20signer.\x20Use\x20wonder_praise\x20or\x20wonder_feedback\x20reward\x20template.'},{'name':'rating_time_limit_days','type':'number','required':![],'default':'30','description':'Days\x20after\x20completion\x20during\x20which\x20the\x20customer\x20can\x20rate\x20(enforced\x20by\x20Guard\x20on\x20Praise/Complain\x20forwards\x20via\x20context(Clock))','constraint':'Must\x20be\x20>\x200;\x20reasonable\x20range\x207-90'}],'example_nodes':[{'name':'Paid','description':'Entry:\x20order\x20created\x20and\x20paid\x20via\x20Service.buy();\x20Machine\x20starts\x20here'},{'name':'Shipped','description':'Merchant\x20dispatched\x20goods/service'},{'name':'Received','description':'Customer\x20confirmed\x20receipt'},{'name':'Completed','description':'Terminal\x20business\x20state\x20—\x20triggers\x20merchant\x20Allocation.\x20Funds\x20settled.'},{'name':'${wonder_node_name}','description':'Positive\x20feedback\x20terminal\x20(praise).\x20OrderHolder-only.\x20Reward-eligible.'},{'name':'${no_wonder_node_name}','description':'Negative\x20feedback\x20terminal\x20(complaint).\x20OrderHolder-only.\x20Optional\x20Repository\x20write\x20for\x20analytics.'}],'example_pairs':[{'prev_node':'','next_node':'Paid','threshold':0x1,'forwards':[{'name':'Enter','weight':0x1,'named_operator':''}]},{'prev_node':'Paid','next_node':'Shipped','threshold':0x1,'forwards':[{'name':'Ship','weight':0x1,'permission_index':0x2,'named_operator':''}]},{'prev_node':'Shipped','next_node':'Received','threshold':0x1,'forwards':[{'name':'ConfirmReceive','weight':0x1,'named_operator':''}]},{'prev_node':'Received','next_node':'Completed','threshold':0x1,'forwards':[{'name':'Finish','weight':0x1,'permission_index':0x2,'named_operator':''}]},{'prev_node':'Completed','next_node':'${wonder_node_name}','threshold':0x1,'forwards':[{'name':'Praise','weight':0x1,'named_operator':'','guard':'rating_window_guard','retained_submission':'rating_record'}]},{'prev_node':'Completed','next_node':'${no_wonder_node_name}','threshold':0x1,'forwards':[{'name':'Complain','weight':0x1,'named_operator':'','guard':'rating_window_guard','retained_submission':'rating_record'}]}],'required_guards':[{'guard_template_id':'tpl_forward_node_check','bound_to_forward':'Praise','purpose':'Verify\x20Progress.current\x20==\x20\x27Completed\x27\x20(rating\x20only\x20allowed\x20after\x20completion)\x20AND\x20context(Clock)\x20<=\x20progress.current_time\x20+\x20rating_time_limit_days'},{'guard_template_id':'tpl_forward_node_check','bound_to_forward':'Complain','purpose':'Verify\x20Progress.current\x20==\x20\x27Completed\x27\x20(rating\x20only\x20allowed\x20after\x20completion)\x20AND\x20context(Clock)\x20<=\x20progress.current_time\x20+\x20rating_time_limit_days'}],'required_permissions':[{'index':0x2,'name':'merchant','description':'Merchant\x20role\x20for\x20Ship\x20+\x20Finish\x20(NOT\x20for\x20rating\x20—\x20rating\x20is\x20OrderHolder-only\x20via\x20named_operator=\x27\x27)'},{'index':0x3,'name':'admin','description':'Admin\x20override\x20(optional)'}],'required_allocators':[{'name':'MerchantAllocation','trigger_node':'Completed','description':'100%\x20to\x20merchant\x20Treasury\x20or\x20personal\x20address.\x20Fires\x20at\x20Completion\x20—\x20NOT\x20at\x20Wonder/NoWonder\x20(those\x20are\x20reputation-only\x20terminals\x20with\x20no\x20fund\x20flow).'}],'forkable_fields':['wonder_node_name','no_wonder_node_name','rating_time_limit_days','additional_rating_nodes'],'applicable_industries':['ecommerce','service','rental','subscription','education'],'relevant_risks':['R-M1-01','R-M1-02','R-M1-08','R-M1-11','R-M2-01','R-M2-05','R-M3-02','R-M3-04','R-M4-01','R-M5-03'],'creation_notes':['DISPUTE\x20INDEPENDENCE:\x20This\x20Machine\x20MUST\x20NOT\x20contain\x20\x27disputed\x27,\x20\x27refunded\x27,\x20\x27arb\x27,\x20\x27arbitration\x27\x20nodes\x20(R-M1-11\x20critical).\x20Disputes\x20are\x20filed\x20off-Machine\x20—\x20through\x20the\x20Arbitration\x20dispute\x20flow\x20on\x20the\x20order\x20and\x20arbitration\x20objects.','Build\x20order:\x20Permission\x20→\x20Machine\x20(unpublished)\x20→\x20Guards\x20→\x20Bind\x20guards\x20→\x20Publish\x20→\x20Bind\x20to\x20Service\x20→\x20Bind\x20Reward\x20(optional)','First\x20node\x20\x27Paid\x27\x20represents\x20post-payment\x20state\x20—\x20Service.buy()\x20completes\x20payment\x20atomically\x20before\x20Progress\x20is\x20created','No\x20separate\x20\x27Order\x27\x20or\x20\x27Pay\x27\x20nodes\x20needed\x20—\x20payment\x20is\x20handled\x20by\x20Service.buy(),\x20not\x20Machine','Wonder/NoWonder\x20forwards\x20have\x20named_operator=\x27\x27\x20(empty)\x20—\x20this\x20delegates\x20to\x20the\x20OrderHolder\x20(customer).\x20No\x20Permission\x20index\x20needed\x20for\x20rating.','Completed\x20node\x20triggers\x20MerchantAllocation\x20—\x20funds\x20are\x20settled\x20BEFORE\x20the\x20rating\x20window\x20opens.\x20Rating\x20does\x20NOT\x20affect\x20fund\x20flow.','Competing\x20Pair:\x20Praise\x20vs\x20Complain\x20(first-wins)\x20—\x20one\x20rating\x20per\x20order,\x20enforced\x20by\x20Guard\x20+\x20retained_submission\x20audit\x20trail.','Reward\x20object\x20(if\x20bound)\x20is\x20INDEPENDENT\x20of\x20Allocator:\x20Reward.claim()\x20requires\x20Guard+passport,\x20not\x20Permission.\x20Guard\x20checks\x20Progress.current\x20==\x20\x27wonder\x27\x20AND\x20order.holder\x20==\x20signer.','rating_window_guard\x20enforces\x20time\x20limit:\x20context(Clock)\x20<=\x20progress.current_time\x20+\x20rating_time_limit_days.\x20After\x20window\x20closes,\x20no\x20rating\x20possible\x20(Completed\x20becomes\x20true\x20terminal).','Optional:\x20bind\x20a\x20Repository\x20to\x20record\x20feedback\x20node\x20for\x20analytics.\x20Repository\x20write\x20happens\x20via\x20Guard\x27s\x20data\x20extraction\x20(NOT\x20auto-passed\x20—\x20see\x2006\x20§14.4).'],'example_use_case':'Photography\x20service:\x20Paid\x20→\x20Shipped\x20(booking\x20confirmed)\x20→\x20Received\x20(session\x20delivered)\x20→\x20Completed\x20'+'(photos\x20delivered,\x20funds\x20released\x20to\x20photographer)\x20→\x20customer\x20advances\x20to\x20\x27wonder\x27\x20(loved\x20the\x20work)\x20'+'or\x20\x27no_wonder\x27\x20(didn\x27t\x20love\x20it).\x20Bound\x20Reward\x20pays\x201\x20WOW\x20to\x20customers\x20who\x20advance\x20to\x20\x27wonder\x27.\x20'+'Merchant\x27s\x20wonder/no_wonder\x20ratio\x20becomes\x20an\x20on-chain\x20reputation\x20signal.\x20Disputes\x20(if\x20any)\x20are\x20'+'filed\x20separately\x20via\x20Arbitration\x20object\x20—\x20never\x20enter\x20this\x20Machine.','publish_checklist':['All\x206\x20nodes\x20verified:\x20no\x20\x27disputed\x27/\x27refunded\x27/\x27arb\x27/\x27arbitration\x27\x20names\x20(R-M1-11\x20PASS)','Entry\x20Pair\x20exists\x20(prev_node=\x27\x27\x20targets\x20\x27Paid\x27)','Competing\x20Pair\x20tested:\x20Praise\x20vs\x20Complain\x20—\x20first-wins\x20semantics\x20verified\x20on\x20testnet','rating_window_guard\x20tested:\x20rating\x20blocked\x20after\x20time\x20limit\x20expires','MerchantAllocation\x20fires\x20ONLY\x20at\x20Completed\x20(NOT\x20at\x20Wonder/NoWonder)','Reward\x20object\x20(if\x20bound):\x20claim_guard\x20tested\x20—\x20Progress.current\x20==\x20\x27wonder\x27\x20required,\x20claim\x20fails\x20at\x20\x27no_wonder\x27\x20or\x20\x27Completed\x27','named_operator=\x27\x27\x20on\x20Praise/Complain\x20forwards\x20verified\x20(OrderHolder-only\x20operation)','machineNode2file\x20export\x20as\x20backup']},{'id':'tpl_machine_subscription','scene_id':'subscription','name':'Subscription\x20/\x20Membership\x20Flow','description':'Subscribe\x20->\x20Pay\x20->\x20Activate\x20->\x20[Renew\x20|\x20Expire]\x20->\x20Cancel/End.\x20Time-lock\x20on\x20Renew.\x20'+'Competing\x20Pair:\x20Renew\x20vs\x20Expire\x20(first-wins).\x20Repository\x20stores\x20subscription\x20status.','recommended_patterns':['P-M-SEQ','P-M-COMPETING'],'recommended_topology':['P-M-LINEAR','P-M-COMPETING'],'parameters':[{'name':'merchant_permission','type':'permission_ref','required':!![],'description':'Provider\x20Permission\x20object'},{'name':'subscription_duration_days','type':'number','required':!![],'default':'30','description':'Days\x20between\x20Renew\x20and\x20Expire\x20eligibility'},{'name':'repository_ref','type':'address','required':!![],'description':'Repository\x20object\x20storing\x20subscription\x20status\x20(note:\x20not\x20consensus_repositories,\x20which\x20is\x20declarative-only\x20—\x20see\x2006\x20§14.4)'}],'example_nodes':[{'name':'Paid','description':'Entry:\x20subscription\x20created\x20and\x20paid\x20via\x20Service.buy();\x20Machine\x20starts\x20here'},{'name':'Active'},{'name':'RenewEligible'},{'name':'Renewed'},{'name':'Expired'},{'name':'Cancelled'},{'name':'Ended'}],'example_pairs':[{'prev_node':'','next_node':'Paid','threshold':0x1,'forwards':[{'name':'Enter','weight':0x1,'named_operator':''}]},{'prev_node':'Paid','next_node':'Active','threshold':0x1,'forwards':[{'name':'Activate','weight':0x1,'permission_index':0x2,'guard':'repository_write_guard'}]},{'prev_node':'Active','next_node':'RenewEligible','threshold':0x1,'forwards':[{'name':'TimeUnlock','weight':0x1,'permission_index':0x3,'guard':'time_lock_guard_${subscription_duration_days}_days'}]},{'prev_node':'RenewEligible','next_node':'Renewed','threshold':0x1,'forwards':[{'name':'Renew','weight':0x1,'named_operator':''}]},{'prev_node':'RenewEligible','next_node':'Expired','threshold':0x1,'forwards':[{'name':'AutoExpire','weight':0x1,'permission_index':0x3,'guard':'expire_time_guard'}]},{'prev_node':'RenewEligible','next_node':'Cancelled','threshold':0x1,'forwards':[{'name':'Cancel','weight':0x1,'named_operator':''}]},{'prev_node':'Renewed','next_node':'Active','threshold':0x1,'forwards':[{'name':'Reactivate','weight':0x1,'permission_index':0x2}]},{'prev_node':'Expired','next_node':'Ended','threshold':0x1,'forwards':[{'name':'CloseExpired','weight':0x1,'permission_index':0x3}]},{'prev_node':'Cancelled','next_node':'Ended','threshold':0x1,'forwards':[{'name':'CloseCancelled','weight':0x1,'permission_index':0x2}]}],'required_guards':[{'guard_template_id':'tpl_forward_node_check','bound_to_forward':'TimeUnlock','purpose':'Time\x20lock:\x20context(Clock)\x20>=\x20progress.current_time\x20+\x20${subscription_duration_days}\x20days'},{'guard_template_id':'tpl_write_guard_type_check','bound_to_forward':'Activate','purpose':'Write\x20subscription\x20status\x20to\x20Repository'},{'guard_template_id':'tpl_forward_node_check','bound_to_forward':'AutoExpire','purpose':'Hard\x20expire:\x20context(Clock)\x20>=\x20progress.current_time\x20+\x202x\x20duration'}],'required_permissions':[{'index':0x2,'name':'provider','description':'Provider\x20activates/reactivates'},{'index':0x3,'name':'admin','description':'Time-lock\x20triggers'}],'required_allocators':[{'name':'RenewAllocation','trigger_node':'Renewed','description':'Charge\x20renewal\x20fee\x20on\x20Renew'}],'forkable_fields':['duration_days','grace_period','additional_tiers'],'applicable_industries':['subscription','saas','membership','service'],'relevant_risks':['R-M1-01','R-M1-08','R-M2-01','R-M2-05','R-M3-02','R-M3-04','R-M4-01','R-M5-04'],'creation_notes':['First\x20node\x20\x27Paid\x27\x20represents\x20post-payment\x20state\x20—\x20Service.buy()\x20completes\x20subscription\x20payment\x20atomically\x20before\x20Progress\x20is\x20created','No\x20separate\x20\x27Subscribe\x27\x20or\x20\x27Pay\x27\x20nodes\x20needed\x20—\x20subscription\x20and\x20payment\x20are\x20handled\x20by\x20Service.buy(),\x20not\x20Machine','Time-lock\x20uses\x20context(Clock)\x20—\x20verify\x20Clock\x20address\x20in\x20Guard\x20table','Competing\x20Pair:\x20Renew\x20vs\x20Expire\x20vs\x20Cancel\x20—\x20first-wins','Renewed\x20node\x20loops\x20back\x20to\x20Active\x20(recurring\x20subscription)','Repository\x20records\x20subscription\x20status\x20for\x20cross-Machine\x20verification','Renewal\x20Allocation\x20triggers\x20on\x20Renewed\x20node\x20(not\x20Active\x20—\x20avoids\x20double-charge)','Note:\x20consensus_repositories\x20is\x20declarative-only\x20(NOT\x20auto-passed\x20to\x20Progress);\x20use\x20repository_ref\x20parameter\x20for\x20actual\x20Repository\x20object\x20—\x20see\x2006\x20§14.4','VARIANT\x20—\x20Content\x20subscription\x20(Substack-style):\x20replace\x20time-lock\x20Renew/Expire\x20with\x20content-delivery\x20flow:','\x20\x206-node\x20variant:\x20Paid\x20(entry)\x20→\x20ContentPublished\x20→\x20Completed\x20(terminal-success)','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Paid\x20→\x20Cancelled\x20(terminal-cancel)\x20|\x20Paid\x20→\x20Disputed\x20→\x20Refunded\x20(terminal-dispute)','\x20\x20Permission:\x20author=index\x201000\x20(publish\x20+\x20cancel),\x20arbitrator=index\x201500\x20(resolve\x20dispute),\x20reader=namedOperator=\x27\x27\x20(open\x20role,\x20no\x20specific\x20operator)','\x20\x20Guards:\x20deliver_guard\x20(verify\x20author\x20permission\x20+\x20content\x20hash),\x20cancel_guard\x20(verify\x20subscriber\x20request),\x20refund_guard\x20(verify\x20arbitration\x20outcome)','\x20\x20Allocators:\x20deliver=100%\x20to\x20author,\x20cancel=100%\x20refund\x20to\x20subscriber,\x20dispute=100%\x20refund\x20to\x20subscriber\x20(Guard-first-wins\x20pattern)','\x20\x20First-Forward-wins:\x20when\x20Paid\x20has\x20competing\x20forwards\x20(Deliver|Cancel|Dispute),\x20the\x20first\x20triggered\x20forward\x20wins;\x20subscribers\x20cannot\x20double-claim','CRITICAL\x20—\x20v1→v2\x20lesson:\x20arbitrations\x20MUST\x20be\x20added\x20BEFORE\x20Service.publish\x20(post-publish,\x20arbitrations\x20become\x20immutable\x20and\x20cannot\x20be\x20added\x20—\x20F-S-21)','\x20\x20If\x20you\x20accidentally\x20published\x20without\x20arbitrations,\x20you\x20MUST\x20create\x20a\x20new\x20Service\x20v2\x20with\x20arbitrations\x20bound\x20before\x20publishing\x20(the\x20v1\x20Service\x20must\x20be\x20paused/abandoned)','\x20\x20ConfirmGate\x20(C-S-19,\x20QS11)\x20will\x20warn\x20before\x20publish\x20without\x20arbitrations\x20—\x20do\x20not\x20bypass\x20this\x20warning\x20unless\x20explicitly\x20intending\x20no-arbitration\x20operation','Build\x20order\x20(content\x20variant):\x20Permission\x20→\x20Machine\x20(unpublished,\x20with\x20initial\x20forward)\x20→\x203\x20Guards\x20→\x203\x20Allocators\x20(template\x20on\x20Service)\x20→\x20Service\x20(unpublished,\x20bind\x20machine+buy_guard+order_allocators+arbitrations)\x20→\x20Publish\x20Service\x20→\x20Test\x20order\x20(3\x20paths:\x20normal/cancel/dispute)'],'example_use_case':'Monthly\x20SaaS\x20subscription:\x20$10/month.\x20Customer\x20can\x20renew\x20anytime\x20after\x20day\x2025.\x20'+'Auto-expire\x20on\x20day\x2035\x20if\x20not\x20renewed.\x20Cancel\x20anytime.\x0a\x0a'+'VARIANT\x20—\x20Content\x20subscription\x20(Substack-style):\x20$5/month\x20newsletter.\x20Author\x20publishes\x20content\x20→\x20'+'subscriber\x20reads.\x20Subscriber\x20can\x20cancel\x20anytime\x20for\x20full\x20refund.\x20Disputes\x20resolved\x20by\x20arbitrator\x20'+'(100%\x20refund\x20to\x20subscriber\x20if\x20dispute\x20upheld).\x206-node\x20Machine,\x203\x20Guards,\x203\x20Allocators.\x20'+'Tested\x20on\x20testnet\x20with\x203\x20order\x20paths:\x20normal\x20delivery,\x20cancel,\x20dispute.','publish_checklist':['Time-lock\x20Guards\x20tested\x20on\x20testnet\x20(both\x20TimeUnlock\x20+\x20AutoExpire)','Competing\x20Pair\x20semantics\x20verified\x20(Renew\x20vs\x20Expire\x20vs\x20Cancel)','Repository\x20write\x20tested\x20(subscription\x20status\x20queryable)','Renewal\x20loop\x20tested:\x20Paid\x20->\x20Active\x20->\x20RenewEligible\x20->\x20Renewed\x20->\x20Active','Content\x20variant:\x20initial\x20node\x20(prev_node=\x27\x27)\x20MUST\x20have\x20at\x20least\x20one\x20forward\x20(FIX-002)\x20—\x20empty\x20forwards=[]\x20causes\x20Progress\x20to\x20be\x20permanently\x20stuck','Content\x20variant:\x20arbitrations\x20added\x20BEFORE\x20publish\x20(cannot\x20add\x20post-publish\x20per\x20F-S-21)','Content\x20variant:\x203\x20order\x20paths\x20tested\x20on\x20testnet\x20—\x20normal\x20delivery,\x20cancel-within-grace,\x20dispute-resolution','Content\x20variant:\x20machineNode2file\x20export\x20as\x20backup\x20(covers\x20all\x206\x20nodes)']}];export const MACHINE_TEMPLATES_VERSION='1.0.0';export const MACHINE_TEMPLATES_COUNT=MACHINE_TEMPLATES['length'];export function getAllTemplates(){return MACHINE_TEMPLATES;}export function getTemplateById(a){return MACHINE_TEMPLATES['find'](b=>b['id']===a);}export function getTemplatesByScene(a){return MACHINE_TEMPLATES['filter'](b=>b['scene_id']===a);}export function getTemplatesByIndustry(a){return MACHINE_TEMPLATES['filter'](b=>b['applicable_industries']['includes'](a));}export function getTemplatesByPattern(a){return MACHINE_TEMPLATES['filter'](b=>b['recommended_patterns']['includes'](a));}export function suggestTemplateForIntent(a){const b=inferSceneFromFlow(a);if(!b)return undefined;const c=getTemplatesByScene(b['id']);return c[0x0];}export function getTemplateParameters(a){const b=getTemplateById(a);return b?b['parameters']:[];}export function getRequiredParameters(a){return getTemplateParameters(a)['filter'](b=>b['required']);}export function getOptionalParameters(a){return getTemplateParameters(a)['filter'](b=>!b['required']);}function validateParamType(a,b){switch(b){case'address':case'string':case'permission_ref':case'guard_ref':case'machine_ref':case'service_ref':case'arbitration_ref':case'reward_ref':return typeof a==='string';case'number':return typeof a==='number'||typeof a==='string'&&/^\d+$/['test'](a);case'boolean':return typeof a==='boolean';case'vec_address':case'vec_string':case'node_name_list':return Array['isArray'](a)&&a['every'](c=>typeof c==='string');default:return![];}}function deepSubstitute(a,b){if(typeof a==='string')return a['replace'](/\$\{(\w+)\}/g,(c,d)=>d in b?String(b[d]):'${'+d+'}');if(Array['isArray'](a))return a['map'](c=>deepSubstitute(c,b));if(a&&typeof a==='object'){const c={};for(const [d,e]of Object['entries'](a)){c[d]=deepSubstitute(e,b);}return c;}return a;}export function fillTemplate(a,b){const c=getTemplateById(a);if(!c)return{'success':![],'validation_errors':['Template\x20not\x20found:\x20'+a]};const d=c['parameters']['filter'](h=>h['required']&&!(h['name']in b))['map'](h=>h['name']);if(d['length']>0x0)return{'success':![],'missing_params':d,'validation_errors':['Missing\x20required\x20parameters:\x20'+d['join'](',\x20')]};const e=[];for(const h of c['parameters']){if(h['name']in b){const i=b[h['name']];!validateParamType(i,h['type'])&&e['push']('Parameter\x20\x22'+h['name']+'\x22\x20type\x20mismatch:\x20expected\x20'+h['type']+',\x20got\x20'+typeof i);}}if(e['length']>0x0)return{'success':![],'validation_errors':e};const f=deepSubstitute(c['example_nodes'],b),g=deepSubstitute(c['example_pairs'],b);return{'success':!![],'filled_nodes':f,'filled_pairs':g};}export function forkTemplate(a){const b=getTemplateById(a);if(!b)return undefined;const c={};for(const d of b['forkable_fields']){c[d]='see\x20example_nodes/example_pairs';}return{'template_id':a,'forkable_fields':b['forkable_fields'],'current_values':c,'instructions':['Modify\x20fields\x20below\x20to\x20customize\x20the\x20workflow','Keep\x20template\x20structure\x20intact\x20unless\x20explicitly\x20noted','Run\x20risk\x20assessment\x20after\x20modification\x20(machine-risk.ts)','User\x20MUST\x20confirm\x20final\x20JSON\x20before\x20publish\x20(ConfirmGate)']};}export const DECISION_TREE={'Q1':{'question':'Does\x20the\x20workflow\x20involve\x20multiple\x20independent\x20services/parties?','no_next':'Q3'},'Q2':{'question':'Are\x20these\x20services\x20already\x20published\x20as\x20separate\x20Machines?','yes_template':'tpl_machine_cross_machine','no_next':'DECOMPOSE'},'Q3':{'question':'Does\x20any\x20node\x20require\x20multiple\x20parties\x27\x20confirmation\x20to\x20advance?','no_next':'Q5'},'Q4':{'question':'Do\x20all\x20parties\x20have\x20EQUAL\x20weight?','yes_template':'tpl_machine_dual_signature','no_next':'tpl_machine_weighted_voting'},'Q5':{'question':'Does\x20the\x20workflow\x20need\x20exception\x20branches\x20(lost,\x20return,\x20dispute)?','yes_template':'tpl_machine_ecommerce_exceptions','no_next':'Q6'},'Q6':{'question':'Does\x20it\x20involve\x20recurring\x20payments\x20or\x20time-based\x20state\x20changes?','yes_template':'tpl_machine_subscription','no_next':'Q7'},'Q7':{'question':'Does\x20it\x20need\x20privacy-preserving\x20data\x20delivery\x20(Messenger)?','yes_template':'tpl_machine_privacy_delivery','no_next':'Q8'},'Q8':{'question':'Does\x20it\x20involve\x20deposit/refund\x20separation?','yes_template':'tpl_machine_rental','no_next':'Q9'},'Q9':{'question':'Does\x20it\x20need\x20reward/incentive\x20distribution\x20at\x20a\x20specific\x20node?','yes_template':'tpl_machine_reward','no_next':'tpl_machine_ecommerce_standard'}};export function walkDecisionTree(a){let b='Q1';while(b){const c=DECISION_TREE[b];if(!c)return'UNKNOWN';const d=a[b];if(d===undefined)return b;if(d){if(c['yes_template'])return c['yes_template'];if(b==='Q1'){b='Q2';continue;}if(b==='Q3'){b='Q4';continue;}return'UNKNOWN';}else{if(c['no_next']){if(c['no_next']==='DECOMPOSE')return'DECOMPOSE_INTO_MULTIPLE_MACHINES';if(c['no_next']['startsWith']('tpl_'))return c['no_next'];b=c['no_next'];continue;}return'UNKNOWN';}}return'UNKNOWN';}export function verifyTemplateSceneReferences(){const a=[];for(const b of MACHINE_TEMPLATES){!findScene(b['scene_id'])&&a['push']({'template_id':b['id'],'invalid_scene_id':b['scene_id']});}return a;}export function getReferencedGuardTemplateIds(){const a=new Set();for(const b of MACHINE_TEMPLATES){for(const c of b['required_guards']){a['add'](c['guard_template_id']);}}return a;}export function getReferencedRiskIds(){const a=new Set();for(const b of MACHINE_TEMPLATES){for(const c of b['relevant_risks']){a['add'](c);}}return a;}export function listTemplates(){return MACHINE_TEMPLATES['map'](a=>({'id':a['id'],'name':a['name'],'scene_id':a['scene_id'],'patterns':a['recommended_patterns'],'industries':a['applicable_industries']}));}
@@ -1,4 +1,4 @@
1
- import { ONCHAIN_CONSTANTS, MAX_NODE_COUNT, MAX_NODE_COUNT_ONCHAIN, MAX_FORWARD_COUNT, MAX_FORWARD_ORDER_COUNT, MAX_NODE_PAIR_COUNT, MAX_CONSENSUS_REPOSITORIES_COUNT, USER_DEFINED_PERM_INDEX_START, MAX_PERM_FOR_ENTITY, MAX_ADMIN_COUNT, MAX_ITEM_COUNT, ROLE_OWNER, ROLE_ADMIN, ROLE_ENTITY, MAX_AGENT_COUNT, MAX_DISPUTE_COUNT, MAX_SHARING_COUNT, MAX_VOTING_GUARD_COUNT, MAX_POLICY_COUNT, MAX_ID_COUNT_ONCE, MAX_REWARD_COUNT, MAX_GUARD_COUNT_REWARD, MAX_RECORD_COUNT_REWARD, MAX_CONTEXT_REPOSITORY_COUNT, MAX_NAMED_OPERATOR_COUNT, MAX_NAMED_OPERATOR_ADDRESS_COUNT, MAX_IM_COUNT, MAX_TAGS_COUNT, MAX_RECIPIENT_COUNT, MAX_PROPOSITION_COUNT, MAX_VOTOR_COUNT, WITHDRAW_DURATION_TIME, MAX_ADDRESS_COUNT, MAX_RECORD_LENGTH, BRIDGE_MESSAGE_VERSION, BRIDGE_EVM_ADDRESS_LENGTH, BRIDGE_CURRENT_VERSION, BRIDGE_TRANSFER_STATUS_PENDING, BRIDGE_TRANSFER_STATUS_APPROVED, BRIDGE_TRANSFER_STATUS_CLAIMED, BRIDGE_TRANSFER_STATUS_NOT_FOUND, MAX_INDEMNITY_MULTIPLE, MAX_PRESENTER_COUNT, MAX_INPUT_SIZE, MAX_TABLE_SIZE, MAX_DEPENDED_COUNT, MAX_DISCOUNT_TOTAL_COUNT, type OnchainConstantName, type MaxNodeCountSdkLiteral } from "@wowok/wowok";
2
- export { ONCHAIN_CONSTANTS, MAX_NODE_COUNT, MAX_NODE_COUNT_ONCHAIN, MAX_FORWARD_COUNT, MAX_FORWARD_ORDER_COUNT, MAX_NODE_PAIR_COUNT, MAX_CONSENSUS_REPOSITORIES_COUNT, USER_DEFINED_PERM_INDEX_START, MAX_PERM_FOR_ENTITY, MAX_ADMIN_COUNT, MAX_ITEM_COUNT, ROLE_OWNER, ROLE_ADMIN, ROLE_ENTITY, MAX_AGENT_COUNT, MAX_DISPUTE_COUNT, MAX_SHARING_COUNT, MAX_VOTING_GUARD_COUNT, MAX_POLICY_COUNT, MAX_ID_COUNT_ONCE, MAX_REWARD_COUNT, MAX_GUARD_COUNT_REWARD, MAX_RECORD_COUNT_REWARD, MAX_CONTEXT_REPOSITORY_COUNT, MAX_NAMED_OPERATOR_COUNT, MAX_NAMED_OPERATOR_ADDRESS_COUNT, MAX_IM_COUNT, MAX_TAGS_COUNT, MAX_RECIPIENT_COUNT, MAX_PROPOSITION_COUNT, MAX_VOTOR_COUNT, WITHDRAW_DURATION_TIME, MAX_INDEMNITY_MULTIPLE, MAX_PRESENTER_COUNT, MAX_INPUT_SIZE, MAX_TABLE_SIZE, MAX_DEPENDED_COUNT, MAX_DISCOUNT_TOTAL_COUNT, MAX_ADDRESS_COUNT, MAX_RECORD_LENGTH, BRIDGE_MESSAGE_VERSION, BRIDGE_EVM_ADDRESS_LENGTH, BRIDGE_CURRENT_VERSION, BRIDGE_TRANSFER_STATUS_PENDING, BRIDGE_TRANSFER_STATUS_APPROVED, BRIDGE_TRANSFER_STATUS_CLAIMED, BRIDGE_TRANSFER_STATUS_NOT_FOUND, type OnchainConstantName, type MaxNodeCountSdkLiteral, };
1
+ import { ONCHAIN_CONSTANTS, MAX_NODE_COUNT, MAX_NODE_COUNT_ONCHAIN, MAX_FORWARD_COUNT, MAX_FORWARD_ORDER_COUNT, MAX_NODE_PAIR_COUNT, MAX_CONSENSUS_REPOSITORIES_COUNT, USER_DEFINED_PERM_INDEX_START, MAX_PERM_FOR_ENTITY, MAX_ADMIN_COUNT, MAX_ITEM_COUNT, ROLE_OWNER, ROLE_ADMIN, ROLE_ENTITY, MAX_AGENT_COUNT, MAX_DISPUTE_COUNT, MAX_SHARING_COUNT, MAX_VOTING_GUARD_COUNT, MAX_POLICY_COUNT, MAX_ID_COUNT_ONCE, MAX_REWARD_COUNT, MAX_GUARD_COUNT_REWARD, MAX_RECORD_COUNT_REWARD, MAX_CONTEXT_REPOSITORY_COUNT, MAX_NAMED_OPERATOR_COUNT, MAX_NAMED_OPERATOR_ADDRESS_COUNT, MAX_IM_COUNT, MAX_TAGS_COUNT, MAX_RECIPIENT_COUNT, MAX_PROPOSITION_COUNT, MAX_VOTOR_COUNT, WITHDRAW_DURATION_TIME, MAX_ADDRESS_COUNT, MAX_RECORD_LENGTH, BRIDGE_MESSAGE_VERSION, BRIDGE_EVM_ADDRESS_LENGTH, BRIDGE_CURRENT_VERSION, BRIDGE_TRANSFER_STATUS_PENDING, BRIDGE_TRANSFER_STATUS_APPROVED, BRIDGE_TRANSFER_STATUS_CLAIMED, BRIDGE_TRANSFER_STATUS_NOT_FOUND, MAX_INDEMNITY_MULTIPLE, MAX_PRESENTER_COUNT, MAX_INPUT_SIZE, MAX_TABLE_SIZE, MAX_DEPENDED_COUNT, MAX_DISCOUNT_TOTAL_COUNT, MAX_USER_IDENTIFIER, type OnchainConstantName, type MaxNodeCountSdkLiteral } from "@wowok/wowok";
2
+ export { ONCHAIN_CONSTANTS, MAX_NODE_COUNT, MAX_NODE_COUNT_ONCHAIN, MAX_FORWARD_COUNT, MAX_FORWARD_ORDER_COUNT, MAX_NODE_PAIR_COUNT, MAX_CONSENSUS_REPOSITORIES_COUNT, USER_DEFINED_PERM_INDEX_START, MAX_PERM_FOR_ENTITY, MAX_ADMIN_COUNT, MAX_ITEM_COUNT, ROLE_OWNER, ROLE_ADMIN, ROLE_ENTITY, MAX_AGENT_COUNT, MAX_DISPUTE_COUNT, MAX_SHARING_COUNT, MAX_VOTING_GUARD_COUNT, MAX_POLICY_COUNT, MAX_ID_COUNT_ONCE, MAX_REWARD_COUNT, MAX_GUARD_COUNT_REWARD, MAX_RECORD_COUNT_REWARD, MAX_CONTEXT_REPOSITORY_COUNT, MAX_NAMED_OPERATOR_COUNT, MAX_NAMED_OPERATOR_ADDRESS_COUNT, MAX_IM_COUNT, MAX_TAGS_COUNT, MAX_RECIPIENT_COUNT, MAX_PROPOSITION_COUNT, MAX_VOTOR_COUNT, WITHDRAW_DURATION_TIME, MAX_INDEMNITY_MULTIPLE, MAX_PRESENTER_COUNT, MAX_INPUT_SIZE, MAX_TABLE_SIZE, MAX_DEPENDED_COUNT, MAX_DISCOUNT_TOTAL_COUNT, MAX_USER_IDENTIFIER, MAX_ADDRESS_COUNT, MAX_RECORD_LENGTH, BRIDGE_MESSAGE_VERSION, BRIDGE_EVM_ADDRESS_LENGTH, BRIDGE_CURRENT_VERSION, BRIDGE_TRANSFER_STATUS_PENDING, BRIDGE_TRANSFER_STATUS_APPROVED, BRIDGE_TRANSFER_STATUS_CLAIMED, BRIDGE_TRANSFER_STATUS_NOT_FOUND, type OnchainConstantName, type MaxNodeCountSdkLiteral, };
3
3
  export declare const ONCHAIN_CONSTANT_MCP_CONSUMERS: Record<string, string[]>;
4
4
  export declare function getOnchainConstant(name: OnchainConstantName): number;
@@ -1 +1 @@
1
- import{ONCHAIN_CONSTANTS,MAX_NODE_COUNT,MAX_NODE_COUNT_ONCHAIN,MAX_FORWARD_COUNT,MAX_FORWARD_ORDER_COUNT,MAX_NODE_PAIR_COUNT,MAX_CONSENSUS_REPOSITORIES_COUNT,USER_DEFINED_PERM_INDEX_START,MAX_PERM_FOR_ENTITY,MAX_ADMIN_COUNT,MAX_ITEM_COUNT,ROLE_OWNER,ROLE_ADMIN,ROLE_ENTITY,MAX_AGENT_COUNT,MAX_DISPUTE_COUNT,MAX_SHARING_COUNT,MAX_VOTING_GUARD_COUNT,MAX_POLICY_COUNT,MAX_ID_COUNT_ONCE,MAX_REWARD_COUNT,MAX_GUARD_COUNT_REWARD,MAX_RECORD_COUNT_REWARD,MAX_CONTEXT_REPOSITORY_COUNT,MAX_NAMED_OPERATOR_COUNT,MAX_NAMED_OPERATOR_ADDRESS_COUNT,MAX_IM_COUNT,MAX_TAGS_COUNT,MAX_RECIPIENT_COUNT,MAX_PROPOSITION_COUNT,MAX_VOTOR_COUNT,WITHDRAW_DURATION_TIME,MAX_ADDRESS_COUNT,MAX_RECORD_LENGTH,BRIDGE_MESSAGE_VERSION,BRIDGE_EVM_ADDRESS_LENGTH,BRIDGE_CURRENT_VERSION,BRIDGE_TRANSFER_STATUS_PENDING,BRIDGE_TRANSFER_STATUS_APPROVED,BRIDGE_TRANSFER_STATUS_CLAIMED,BRIDGE_TRANSFER_STATUS_NOT_FOUND,MAX_INDEMNITY_MULTIPLE,MAX_PRESENTER_COUNT,MAX_INPUT_SIZE,MAX_TABLE_SIZE,MAX_DEPENDED_COUNT,MAX_DISCOUNT_TOTAL_COUNT}from'@wowok/wowok';export{ONCHAIN_CONSTANTS,MAX_NODE_COUNT,MAX_NODE_COUNT_ONCHAIN,MAX_FORWARD_COUNT,MAX_FORWARD_ORDER_COUNT,MAX_NODE_PAIR_COUNT,MAX_CONSENSUS_REPOSITORIES_COUNT,USER_DEFINED_PERM_INDEX_START,MAX_PERM_FOR_ENTITY,MAX_ADMIN_COUNT,MAX_ITEM_COUNT,ROLE_OWNER,ROLE_ADMIN,ROLE_ENTITY,MAX_AGENT_COUNT,MAX_DISPUTE_COUNT,MAX_SHARING_COUNT,MAX_VOTING_GUARD_COUNT,MAX_POLICY_COUNT,MAX_ID_COUNT_ONCE,MAX_REWARD_COUNT,MAX_GUARD_COUNT_REWARD,MAX_RECORD_COUNT_REWARD,MAX_CONTEXT_REPOSITORY_COUNT,MAX_NAMED_OPERATOR_COUNT,MAX_NAMED_OPERATOR_ADDRESS_COUNT,MAX_IM_COUNT,MAX_TAGS_COUNT,MAX_RECIPIENT_COUNT,MAX_PROPOSITION_COUNT,MAX_VOTOR_COUNT,WITHDRAW_DURATION_TIME,MAX_INDEMNITY_MULTIPLE,MAX_PRESENTER_COUNT,MAX_INPUT_SIZE,MAX_TABLE_SIZE,MAX_DEPENDED_COUNT,MAX_DISCOUNT_TOTAL_COUNT,MAX_ADDRESS_COUNT,MAX_RECORD_LENGTH,BRIDGE_MESSAGE_VERSION,BRIDGE_EVM_ADDRESS_LENGTH,BRIDGE_CURRENT_VERSION,BRIDGE_TRANSFER_STATUS_PENDING,BRIDGE_TRANSFER_STATUS_APPROVED,BRIDGE_TRANSFER_STATUS_CLAIMED,BRIDGE_TRANSFER_STATUS_NOT_FOUND};export const ONCHAIN_CONSTANT_MCP_CONSUMERS={'MAX_NODE_COUNT':['machine-topology.ts\x20(within_limits\x20check)','machine-risk.ts\x20R-M1-07','machine-translation.ts\x20MC-C-01','knowledge/index.ts\x20(max_node_count\x20field)'],'MAX_FORWARD_ORDER_COUNT':[],'MAX_NODE_PAIR_COUNT':['machine-topology.ts\x20(within_limits\x20check)'],'USER_DEFINED_PERM_INDEX_START':['machine-risk.ts\x20R-M3-08','guard-risk.ts\x20(forward\x20permissionIndex\x20guidance)'],'MAX_VOTING_GUARD_COUNT':['evaluation/builtins/arbitration-score.ts\x20(fairness_governance\x20reason)'],'MAX_ITEM_COUNT':['permission-context.ts\x20(entity_permission\x20reverse\x20index)'],'ROLE_OWNER':['permission-context.ts\x20(entity_permission\x20role\x20flags)'],'ROLE_ADMIN':['permission-context.ts\x20(entity_permission\x20role\x20flags)'],'ROLE_ENTITY':['permission-context.ts\x20(entity_permission\x20role\x20flags)']};export function getOnchainConstant(a){const b=ONCHAIN_CONSTANTS[a];if(b===undefined)throw new Error('Unknown\x20on-chain\x20constant:\x20'+String(a));return b;}
1
+ import{ONCHAIN_CONSTANTS,MAX_NODE_COUNT,MAX_NODE_COUNT_ONCHAIN,MAX_FORWARD_COUNT,MAX_FORWARD_ORDER_COUNT,MAX_NODE_PAIR_COUNT,MAX_CONSENSUS_REPOSITORIES_COUNT,USER_DEFINED_PERM_INDEX_START,MAX_PERM_FOR_ENTITY,MAX_ADMIN_COUNT,MAX_ITEM_COUNT,ROLE_OWNER,ROLE_ADMIN,ROLE_ENTITY,MAX_AGENT_COUNT,MAX_DISPUTE_COUNT,MAX_SHARING_COUNT,MAX_VOTING_GUARD_COUNT,MAX_POLICY_COUNT,MAX_ID_COUNT_ONCE,MAX_REWARD_COUNT,MAX_GUARD_COUNT_REWARD,MAX_RECORD_COUNT_REWARD,MAX_CONTEXT_REPOSITORY_COUNT,MAX_NAMED_OPERATOR_COUNT,MAX_NAMED_OPERATOR_ADDRESS_COUNT,MAX_IM_COUNT,MAX_TAGS_COUNT,MAX_RECIPIENT_COUNT,MAX_PROPOSITION_COUNT,MAX_VOTOR_COUNT,WITHDRAW_DURATION_TIME,MAX_ADDRESS_COUNT,MAX_RECORD_LENGTH,BRIDGE_MESSAGE_VERSION,BRIDGE_EVM_ADDRESS_LENGTH,BRIDGE_CURRENT_VERSION,BRIDGE_TRANSFER_STATUS_PENDING,BRIDGE_TRANSFER_STATUS_APPROVED,BRIDGE_TRANSFER_STATUS_CLAIMED,BRIDGE_TRANSFER_STATUS_NOT_FOUND,MAX_INDEMNITY_MULTIPLE,MAX_PRESENTER_COUNT,MAX_INPUT_SIZE,MAX_TABLE_SIZE,MAX_DEPENDED_COUNT,MAX_DISCOUNT_TOTAL_COUNT,MAX_USER_IDENTIFIER}from'@wowok/wowok';export{ONCHAIN_CONSTANTS,MAX_NODE_COUNT,MAX_NODE_COUNT_ONCHAIN,MAX_FORWARD_COUNT,MAX_FORWARD_ORDER_COUNT,MAX_NODE_PAIR_COUNT,MAX_CONSENSUS_REPOSITORIES_COUNT,USER_DEFINED_PERM_INDEX_START,MAX_PERM_FOR_ENTITY,MAX_ADMIN_COUNT,MAX_ITEM_COUNT,ROLE_OWNER,ROLE_ADMIN,ROLE_ENTITY,MAX_AGENT_COUNT,MAX_DISPUTE_COUNT,MAX_SHARING_COUNT,MAX_VOTING_GUARD_COUNT,MAX_POLICY_COUNT,MAX_ID_COUNT_ONCE,MAX_REWARD_COUNT,MAX_GUARD_COUNT_REWARD,MAX_RECORD_COUNT_REWARD,MAX_CONTEXT_REPOSITORY_COUNT,MAX_NAMED_OPERATOR_COUNT,MAX_NAMED_OPERATOR_ADDRESS_COUNT,MAX_IM_COUNT,MAX_TAGS_COUNT,MAX_RECIPIENT_COUNT,MAX_PROPOSITION_COUNT,MAX_VOTOR_COUNT,WITHDRAW_DURATION_TIME,MAX_INDEMNITY_MULTIPLE,MAX_PRESENTER_COUNT,MAX_INPUT_SIZE,MAX_TABLE_SIZE,MAX_DEPENDED_COUNT,MAX_DISCOUNT_TOTAL_COUNT,MAX_USER_IDENTIFIER,MAX_ADDRESS_COUNT,MAX_RECORD_LENGTH,BRIDGE_MESSAGE_VERSION,BRIDGE_EVM_ADDRESS_LENGTH,BRIDGE_CURRENT_VERSION,BRIDGE_TRANSFER_STATUS_PENDING,BRIDGE_TRANSFER_STATUS_APPROVED,BRIDGE_TRANSFER_STATUS_CLAIMED,BRIDGE_TRANSFER_STATUS_NOT_FOUND};export const ONCHAIN_CONSTANT_MCP_CONSUMERS={'MAX_NODE_COUNT':['machine-topology.ts\x20(within_limits\x20check)','machine-risk.ts\x20R-M1-07','machine-translation.ts\x20MC-C-01','knowledge/index.ts\x20(max_node_count\x20field)'],'MAX_FORWARD_ORDER_COUNT':[],'MAX_NODE_PAIR_COUNT':['machine-topology.ts\x20(within_limits\x20check)'],'USER_DEFINED_PERM_INDEX_START':['machine-risk.ts\x20R-M3-08','guard-risk.ts\x20(forward\x20permissionIndex\x20guidance)'],'MAX_VOTING_GUARD_COUNT':['evaluation/builtins/arbitration-score.ts\x20(fairness_governance\x20reason)'],'MAX_ITEM_COUNT':['permission-context.ts\x20(entity_permission\x20reverse\x20index)'],'ROLE_OWNER':['permission-context.ts\x20(entity_permission\x20role\x20flags)'],'ROLE_ADMIN':['permission-context.ts\x20(entity_permission\x20role\x20flags)'],'ROLE_ENTITY':['permission-context.ts\x20(entity_permission\x20role\x20flags)']};export function getOnchainConstant(a){const b=ONCHAIN_CONSTANTS[a];if(b===undefined)throw new Error('Unknown\x20on-chain\x20constant:\x20'+String(a));return b;}
@@ -1 +1 @@
1
- import{MAX_NAMED_OPERATOR_COUNT,MAX_NAMED_OPERATOR_ADDRESS_COUNT,MAX_CONTEXT_REPOSITORY_COUNT}from'@wowok/wowok';export{MAX_NAMED_OPERATOR_COUNT,MAX_NAMED_OPERATOR_ADDRESS_COUNT,MAX_CONTEXT_REPOSITORY_COUNT};export const PROGRESS_NEW={'index':0xdc,'name':'PROGRESS_NEW','description':'Create\x20new\x20Progress\x20(asserted\x20on\x20direct\x20Progress\x20creation)','governed_operations':['direct\x20Progress\x20creation','passport-guarded\x20Progress\x20creation'],'sdk_exposed':![]};export const PROGRESS_NAMED_OPERATOR={'index':0xdd,'name':'PROGRESS_NAMED_OPERATOR','description':'Manage\x20named\x20operators\x20(add/set/remove)\x20for\x20the\x20namedOperator\x20namespace','governed_operations':['progress::namedOperator_add','progress::namedOperator_set','progress::namedOperator_remove','progress::namedOperator_add_with_passport','progress::namedOperator_set_with_passport','progress::namedOperator_remove_with_passport'],'sdk_exposed':!![]};export const PROGRESS_TASK={'index':0xde,'name':'PROGRESS_TASK','description':'Submit\x20task\x20(one-time,\x20immutable\x20once\x20set\x20—\x20E_TASK_ALREADY_SET)','governed_operations':['submit\x20the\x20task\x20(one-time)','submit\x20the\x20task\x20with\x20a\x20passport'],'sdk_exposed':!![]};export const PROGRESS_CONTEXT_REPOSITORY={'index':0xdf,'name':'PROGRESS_CONTEXT_REPOSITORY','description':'Bind/unbind\x20context\x20Repository\x20(≤\x20MAX_CONTEXT_REPOSITORY_COUNT=30)','governed_operations':['bind\x20a\x20context\x20repository','unbind\x20a\x20context\x20repository','clear\x20all\x20context\x20repositories','bind\x20a\x20context\x20repository\x20(passport-guarded)','unbind\x20a\x20context\x20repository\x20(passport-guarded)','clear\x20all\x20context\x20repositories\x20(passport-guarded)'],'sdk_exposed':!![]};export const PROGRESS_UNHOLD={'index':0xe0,'name':'PROGRESS_UNHOLD','description':'Force\x20unhold\x20(adminUnhold)\x20—\x20bypasses\x20holder\x20check,\x20releases\x20blocked\x20forward','governed_operations':['force\x20unhold\x20(adminUnhold)','force\x20unhold\x20via\x20passport'],'sdk_exposed':!![]};export const PROGRESS_OWNER_RECEIVE={'index':0xe1,'name':'PROGRESS_OWNER_RECEIVE','description':'Owner\x20receives\x20objects/coins\x20(unwrap\x20Receiving<K>\x20→\x20owner)','governed_operations':['owner\x20receives\x20coins','owner\x20receives\x20a\x20generic\x20object','owner\x20receives\x20coins\x20via\x20passport','owner\x20receives\x20a\x20generic\x20object\x20via\x20passport'],'sdk_exposed':![]};export const PROGRESS_PERMISSIONS=[PROGRESS_NEW,PROGRESS_NAMED_OPERATOR,PROGRESS_TASK,PROGRESS_CONTEXT_REPOSITORY,PROGRESS_UNHOLD,PROGRESS_OWNER_RECEIVE];export const PROGRESS_SCENES=[{'id':'progress_task_submit','name':'Task\x20submission\x20&\x20binding\x20workflow','industry':['universal','ecommerce','logistics','education'],'scenario':'Submit\x20a\x20task\x20(Order/Reward/etc.)\x20to\x20Progress\x20via\x20task\x20submission.\x20'+'Task\x20is\x20one-time,\x20immutable\x20—\x20once\x20set,\x20E_TASK_ALREADY_SET\x20blocks\x20any\x20re-assignment.\x20'+'Binds\x20Progress\x201:1\x20to\x20the\x20task\x20object\x20for\x20the\x20rest\x20of\x20its\x20lifecycle.','phases':['task_binding','forward_advance'],'requires_published_machine':!![],'requires_order_bound':!![],'named_operator_roles':[],'builtin_indexes_consumed':[PROGRESS_TASK],'typical_context_repository_count':0x0,'uses_hold_mechanism':![],'uses_admin_unhold':![],'common_patterns':['Task\x20submission\x20is\x20one-time:\x20verify\x20task\x20address\x20before\x20submission\x20(E_TASK_ALREADY_SET\x20blocks\x20reset)','task\x20is\x20usually\x20an\x20Order\x20created\x20by\x20the\x20buy\x20flow\x20→\x20Progress.task\x20=\x20Order\x20address','Without\x20task,\x20Forward\x20advancement\x20falls\x20back\x20to\x20non-order\x20next()/hold()\x20paths'],'recommended_templates':['T-PR-01']},{'id':'progress_named_operator','name':'Named\x20operator\x20namespace\x20management','industry':['universal','logistics','arbitration','freelance'],'scenario':'Manage\x20named_operator\x20namespace\x20for\x20a\x20Progress.\x20Each\x20named\x20operator\x20is\x20a\x20(name\x20→\x20address\x20list)\x20'+'binding\x20used\x20by\x20Machine.forward.namedOperator\x20to\x20gate\x20next()/hold()\x20advancement.\x20'+'Up\x20to\x2060\x20named\x20operators\x20per\x20Progress,\x20up\x20to\x2080\x20addresses\x20per\x20operator.','phases':['named_operator_mgmt'],'requires_published_machine':!![],'requires_order_bound':![],'named_operator_roles':[{'role':'seller','typical_count':0x1},{'role':'logistics','typical_count':0x1},{'role':'reviewer','typical_count':0x3},{'role':'arbitrator','typical_count':0x5}],'builtin_indexes_consumed':[PROGRESS_NAMED_OPERATOR],'typical_context_repository_count':0x0,'uses_hold_mechanism':![],'uses_admin_unhold':![],'common_patterns':['namedOperator\x20name=\x27\x27:\x20special\x20case\x20—\x20means\x20OrderHolder\x20(order.owner/agent),\x20NOT\x20a\x20real\x20named\x20operator','add/set/remove\x20are\x20idempotent\x20on\x20duplicate\x20addresses\x20(vector::contains\x20check\x20before\x20push)','Use\x20\x27set\x27\x20to\x20REPLACE\x20an\x20operator\x27s\x20address\x20list;\x20use\x20\x27add\x27\x20to\x20extend;\x20\x27remove\x27\x20to\x20subtract','Names\x20must\x20satisfy\x20common::NAME\x20(isValidName)\x20—\x20non-empty,\x20length-bounded'],'recommended_templates':['T-PR-01','T-PR-02']},{'id':'progress_unhold','name':'Hold\x20release\x20(unhold\x20/\x20adminUnhold)\x20workflow','industry':['content','rental','arbitration','subscription'],'scenario':'Release\x20a\x20forward\x20that\x20was\x20previously\x20held.\x20Two\x20paths:\x20'+'(a)\x20unhold\x20by\x20original\x20holder\x20(named_operator\x20match);\x20'+'(b)\x20adminUnhold\x20(224)\x20by\x20permission-table\x20holder\x20—\x20bypasses\x20holder\x20check.\x20'+'adminUnhold\x20is\x20the\x20deadlock-resolution\x20escape\x20hatch\x20when\x20a\x20holder\x20is\x20unresponsive.','phases':['hold_state','unhold_state'],'requires_published_machine':!![],'requires_order_bound':!![],'named_operator_roles':[{'role':'holder','typical_count':0x1},{'role':'admin','typical_count':0x1}],'builtin_indexes_consumed':[PROGRESS_UNHOLD],'typical_context_repository_count':0x0,'uses_hold_mechanism':!![],'uses_admin_unhold':!![],'common_patterns':['unhold\x20checks\x20whether\x20the\x20sender\x20holds\x20permission\x20index\x20224:\x20if\x20yes,\x20force\x20release;\x20if\x20no,\x20require\x20holder\x20match','adminUnhold\x20has\x20wider\x20blast\x20radius\x20—\x20only\x20grant\x20224\x20to\x20trusted\x20recovery\x20operators','If\x20forward\x20already\x20accomplished,\x20E_FORWARD_ALREADY_ACCOMPLISHED\x20blocks\x20re-hold','Repeated\x20hold/unhold\x20cycles\x20indicate\x20a\x20stuck\x20workflow\x20—\x20surface\x20to\x20order-monitor'],'recommended_templates':['T-PR-05']},{'id':'progress_context_repository','name':'Context\x20Repository\x20binding\x20workflow','industry':['education','content','rental','cross_chain'],'scenario':'Bind/unbind\x20Repository\x20objects\x20as\x20Progress\x20context_repositories.\x20'+'Used\x20to\x20provide\x20query-time\x20context\x20(learning\x20progress,\x20inspection\x20records,\x20bridge\x20state).\x20'+'Up\x20to\x20MAX_CONTEXT_REPOSITORY_COUNT=30\x20repositories\x20per\x20Progress.','phases':['context_binding'],'requires_published_machine':!![],'requires_order_bound':![],'named_operator_roles':[],'builtin_indexes_consumed':[PROGRESS_CONTEXT_REPOSITORY],'typical_context_repository_count':0x3,'uses_hold_mechanism':![],'uses_admin_unhold':![],'common_patterns':['Binding\x20a\x20context\x20repository\x20registers\x20the\x20link\x20through\x20an\x20affiliation\x20transaction\x20(enables\x20cross-object\x20queries)','Unbinding\x20disaffiliates\x20the\x20link\x20—\x20Repository\x20may\x20be\x20garbage-collected\x20if\x20no\x20other\x20refs','Clearing\x20empties\x20the\x20entire\x20list\x20in\x20one\x20transaction','add\x20is\x20idempotent:\x20if\x20Repository\x20already\x20in\x20list,\x20no-op\x20(vector::contains\x20check)','Bind\x20before\x20forward\x20advance\x20so\x20on-chain\x20guards\x20can\x20read\x20context\x20data'],'recommended_templates':['T-PR-03']},{'id':'progress_owner_receive','name':'Owner\x20receive\x20(unwrap)\x20workflow','industry':['finance','treasury','rental','freelance'],'scenario':'Owner\x20receives\x20Receiving<K>\x20objects\x20or\x20CoinWrapper<T>\x20coins\x20sent\x20to\x20the\x20Progress\x20object.\x20'+'unwrap\x20→\x20forwarded\x20to\x20the\x20Permission\x20owner\x20through\x20the\x20permission\x20owner-receive\x20path.\x20'+'Used\x20at\x20terminal\x20nodes\x20(return_approved,\x20completed,\x20enforced)\x20to\x20disburse\x20funds.','phases':['owner_receive'],'requires_published_machine':!![],'requires_order_bound':!![],'named_operator_roles':[],'builtin_indexes_consumed':[PROGRESS_OWNER_RECEIVE],'typical_context_repository_count':0x0,'uses_hold_mechanism':![],'uses_admin_unhold':![],'common_patterns':['owner_receive\x20unwraps\x20CoinWrapper<T>\x20via\x20the\x20payment\x27s\x20type-checked\x20unwrap\x20(amount\x20validation)','Receiving\x20a\x20generic\x20K:key+store\x20object\x20forwards\x20it\x20to\x20the\x20Permission\x20owner','Triggered\x20at\x20terminal\x20nodes\x20(e.g.\x20\x27return_approved\x27\x20in\x20rental,\x20\x27enforced\x27\x20in\x20arbitration)','Permission\x20owner\x20≠\x20Progress\x20creator:\x20receives\x20flow\x20to\x20whoever\x20owns\x20the\x20bound\x20Machine\x27s\x20Permission'],'recommended_templates':['T-PR-06']},{'id':'progress_completed','name':'Forward\x20advancement\x20&\x20session\x20completion','industry':['universal'],'scenario':'Advance\x20Progress\x20via\x20next()\x20/\x20the\x20order-holder\x20advancement\x20path\x20—\x20accumulates\x20weights\x20in\x20session.forwards,\x20'+'and\x20when\x20weights\x20≥\x20threshold,\x20moves\x20session\x20into\x20history\x20and\x20updates\x20Progress.current.\x20'+'This\x20is\x20the\x20canonical\x20Forward\x20advancement\x20path\x20for\x20ALL\x20non-hold\x20operations.','phases':['forward_advance','completed'],'requires_published_machine':!![],'requires_order_bound':!![],'named_operator_roles':[{'role':'OrderHolder','typical_count':0x1},{'role':'next_node_operator','typical_count':0x1}],'builtin_indexes_consumed':[],'typical_context_repository_count':0x0,'uses_hold_mechanism':![],'uses_admin_unhold':![],'common_patterns':['Forward\x20guard\x20(Some):\x20requires\x20Passport;\x20the\x20passport\x20verification\x20against\x20the\x20guard\x20must\x20pass','Forward\x20guard\x20(None):\x20requires\x20permissionIndex\x20(Some)\x20or\x20namedOperator\x20match\x20(ASSERT_PERMISSION)','session.weights\x20+=\x20forward.weight;\x20when\x20≥\x20threshold,\x20push\x20session\x20into\x20ParentTableVec<History>','Progress.current\x20=\x20next_node\x20only\x20after\x20session\x20completes\x20(atomic\x20update)','E_NOT_THE_HOLDER:\x20if\x20forward\x20was\x20held\x20by\x20another\x20address,\x20next()\x20aborts','E_FORWARD_ALREADY_ACCOMPLISHED:\x20re-hold\x20on\x20completed\x20forward\x20is\x20blocked','⚠\x20ROUTING\x20RULE:\x20Forward.namedOperator=\x22\x22\x20(empty)\x20→\x20MUST\x20use\x20the\x20order-holder\x20path\x20(order.progress);\x20'+'non-empty\x20namedOperator\x20or\x20permissionIndex-only\x20→\x20MUST\x20call\x20progress.operate\x20(next).\x20'+'Wrong\x20path\x20→\x20Permission\x20denied\x20(abort\x20code\x205).\x20See\x20file\x20header\x20CRITICAL\x20ROUTING\x20RULE.'],'recommended_templates':['T-PR-04']}];export const PROGRESS_LEDGER_VERSION='1.0.0';export function getScenesByPhase(a){return PROGRESS_SCENES['filter'](b=>b['phases']['includes'](a));}export function findSceneById(a){return PROGRESS_SCENES['find'](b=>b['id']===a);}export function getScenesByIndustry(a){return PROGRESS_SCENES['filter'](b=>b['industry']['includes'](a)||b['industry']['includes']('universal'));}export function getBuiltinPermissionByIndex(a){return PROGRESS_PERMISSIONS['find'](b=>b['index']===a);}export function isProgressBuiltinPermission(a){return getBuiltinPermissionByIndex(a)!==undefined;}export function inferSceneFromIntent(a){const b=a['toLowerCase'](),c=[['adminunhold','progress_unhold'],['admin\x20unhold','progress_unhold'],['force\x20unhold','progress_unhold'],['unhold','progress_unhold'],['release\x20hold','progress_unhold'],['owner_receive','progress_owner_receive'],['owner\x20receive','progress_owner_receive'],['unwrap','progress_owner_receive'],['context_repository','progress_context_repository'],['context\x20repository','progress_context_repository'],['repository\x20binding','progress_context_repository'],['named_operator','progress_named_operator'],['named\x20operator','progress_named_operator'],['namedoperator','progress_named_operator'],['task\x20set','progress_task_submit'],['submit\x20task','progress_task_submit'],['next','progress_completed'],['advance','progress_completed'],['complete','progress_completed']];for(const [d,e]of c){if(b['includes'](d)){const f=findSceneById(e);if(f)return f;}}return undefined;}export function getAllBuiltinPermissions(){return[...PROGRESS_PERMISSIONS];}export function getProgressScenesCount(){return PROGRESS_SCENES['length'];}export function validateNamedOperatorAddressList(b){const c=[];b['length']>MAX_NAMED_OPERATOR_ADDRESS_COUNT&&c['push']('Named\x20operator\x20address\x20count\x20'+b['length']+'\x20exceeds\x20MAX_NAMED_OPERATOR_ADDRESS_COUNT\x20'+MAX_NAMED_OPERATOR_ADDRESS_COUNT);const d=new Set();for(const e of b){if(d['has'](e)){c['push']('Duplicate\x20address\x20in\x20list:\x20'+e+'\x20(Move\x20will\x20dedupe\x20silently)');break;}d['add'](e);}return{'ok':c['length']===0x0,'violations':c};}export function validateNamedOperatorCount(a){if(a>=MAX_NAMED_OPERATOR_COUNT)return{'ok':![],'violation':'Named\x20operator\x20count\x20'+a+'\x20would\x20exceed\x20MAX_NAMED_OPERATOR_COUNT\x20'+MAX_NAMED_OPERATOR_COUNT};return{'ok':!![]};}export function validateContextRepositoryCount(a,b){const c=a+b;if(c>MAX_CONTEXT_REPOSITORY_COUNT)return{'ok':![],'violation':'Context\x20repository\x20count\x20'+c+'\x20would\x20exceed\x20MAX_CONTEXT_REPOSITORY_COUNT\x20'+MAX_CONTEXT_REPOSITORY_COUNT};return{'ok':!![]};}export const PROGRESS_CROSS_OBJECT_REFS=[{'object':'Machine','phase':'universal','relationship':'Progress.machine\x20(immutable\x20bind,\x20E_MACHINE_NOT_MATCH\x20on\x20every\x20op)'},{'object':'Order','phase':'forward_advance','relationship':'Progress.task\x20=\x20Order.address\x20(1:1,\x20set\x20via\x20task\x20submission\x20or\x20the\x20buy\x20flow)'},{'object':'Order','phase':'forward_advance','relationship':'order-holder\x20paths\x20(advance\x20/\x20hold):\x20the\x20order\x20owner-or-agent\x20permission\x20check\x20gates\x20Forward\x20advance'},{'object':'Permission','phase':'universal','relationship':'Machine.permission\x20is\x20borrowed\x20for\x20ALL\x20220-225\x20assertions'},{'object':'Repository','phase':'context_binding','relationship':'context_repositories:\x20vector<address>\x20(≤\x2030),\x20bound\x20via\x20an\x20affiliation\x20transaction'},{'object':'Service','phase':'creation','relationship':'the\x20buy\x20flow\x20creates\x20the\x20Progress\x20internally\x20(bypasses\x20220\x20assertion\x20—\x20package-internal\x20entry)'},{'object':'Passport','phase':'forward_advance','relationship':'Forward.guard\x20(Some)\x20requires\x20Passport\x20+\x20passing\x20the\x20passport\x20verification'},{'object':'Passport','phase':'unhold_state','relationship':'passport-based\x20unhold:\x20224\x20check\x20via\x20passport\x20(fallback\x20when\x20the\x20sender\x27s\x20direct\x20224\x20permission\x20check\x20fails)'},{'object':'Payment','phase':'owner_receive','relationship':'owner_receive\x20unwraps\x20CoinWrapper<T>\x20via\x20the\x20payment\x27s\x20type-checked\x20unwrap'},{'object':'Allocation','phase':'completed','relationship':'Terminal\x20node\x20triggers\x20Allocation\x20alloc\x20(e.g.\x20\x27completed\x27,\x20\x27enforced\x27,\x20\x27return_approved\x27)'}];
1
+ import{MAX_NAMED_OPERATOR_COUNT,MAX_NAMED_OPERATOR_ADDRESS_COUNT,MAX_CONTEXT_REPOSITORY_COUNT}from'@wowok/wowok';export{MAX_NAMED_OPERATOR_COUNT,MAX_NAMED_OPERATOR_ADDRESS_COUNT,MAX_CONTEXT_REPOSITORY_COUNT};export const PROGRESS_NEW={'index':0xdc,'name':'PROGRESS_NEW','description':'Create\x20new\x20Progress\x20(asserted\x20on\x20direct\x20Progress\x20creation)','governed_operations':['direct\x20Progress\x20creation','passport-guarded\x20Progress\x20creation'],'sdk_exposed':![]};export const PROGRESS_NAMED_OPERATOR={'index':0xdd,'name':'PROGRESS_NAMED_OPERATOR','description':'Manage\x20named\x20operators\x20(add/set/remove)\x20for\x20the\x20namedOperator\x20namespace','governed_operations':['progress::namedOperator_add','progress::namedOperator_set','progress::namedOperator_remove','progress::namedOperator_add_with_passport','progress::namedOperator_set_with_passport','progress::namedOperator_remove_with_passport'],'sdk_exposed':!![]};export const PROGRESS_TASK={'index':0xde,'name':'PROGRESS_TASK','description':'Submit\x20task\x20(one-time,\x20immutable\x20once\x20set\x20—\x20E_TASK_ALREADY_SET)','governed_operations':['submit\x20the\x20task\x20(one-time)','submit\x20the\x20task\x20with\x20a\x20passport'],'sdk_exposed':!![]};export const PROGRESS_CONTEXT_REPOSITORY={'index':0xdf,'name':'PROGRESS_CONTEXT_REPOSITORY','description':'Bind/unbind\x20context\x20Repository\x20(≤\x20MAX_CONTEXT_REPOSITORY_COUNT=30)','governed_operations':['bind\x20a\x20context\x20repository','unbind\x20a\x20context\x20repository','clear\x20all\x20context\x20repositories','bind\x20a\x20context\x20repository\x20(passport-guarded)','unbind\x20a\x20context\x20repository\x20(passport-guarded)','clear\x20all\x20context\x20repositories\x20(passport-guarded)'],'sdk_exposed':!![]};export const PROGRESS_UNHOLD={'index':0xe0,'name':'PROGRESS_UNHOLD','description':'Force\x20unhold\x20(adminUnhold)\x20—\x20bypasses\x20holder\x20check,\x20releases\x20blocked\x20forward','governed_operations':['force\x20unhold\x20(adminUnhold)','force\x20unhold\x20via\x20passport'],'sdk_exposed':!![]};export const PROGRESS_OWNER_RECEIVE={'index':0xe1,'name':'PROGRESS_OWNER_RECEIVE','description':'Owner\x20receives\x20objects/coins\x20(unwrap\x20Receiving<K>\x20→\x20owner)','governed_operations':['owner\x20receives\x20coins','owner\x20receives\x20a\x20generic\x20object','owner\x20receives\x20coins\x20via\x20passport','owner\x20receives\x20a\x20generic\x20object\x20via\x20passport'],'sdk_exposed':![]};export const PROGRESS_PERMISSIONS=[PROGRESS_NEW,PROGRESS_NAMED_OPERATOR,PROGRESS_TASK,PROGRESS_CONTEXT_REPOSITORY,PROGRESS_UNHOLD,PROGRESS_OWNER_RECEIVE];export const PROGRESS_SCENES=[{'id':'progress_task_submit','name':'Task\x20submission\x20&\x20binding\x20workflow','industry':['universal','ecommerce','logistics','education'],'scenario':'Submit\x20a\x20task\x20(Order/Reward/etc.)\x20to\x20Progress\x20via\x20task\x20submission.\x20'+'Task\x20is\x20one-time,\x20immutable\x20—\x20once\x20set,\x20E_TASK_ALREADY_SET\x20blocks\x20any\x20re-assignment.\x20'+'Binds\x20Progress\x201:1\x20to\x20the\x20task\x20object\x20for\x20the\x20rest\x20of\x20its\x20lifecycle.','phases':['task_binding','forward_advance'],'requires_published_machine':!![],'requires_order_bound':!![],'named_operator_roles':[],'builtin_indexes_consumed':[PROGRESS_TASK],'typical_context_repository_count':0x0,'uses_hold_mechanism':![],'uses_admin_unhold':![],'common_patterns':['Task\x20submission\x20is\x20one-time:\x20verify\x20task\x20address\x20before\x20submission\x20(E_TASK_ALREADY_SET\x20blocks\x20reset)','task\x20is\x20usually\x20an\x20Order\x20created\x20by\x20the\x20buy\x20flow\x20→\x20Progress.task\x20=\x20Order\x20address','Without\x20task,\x20Forward\x20advancement\x20falls\x20back\x20to\x20non-order\x20next()/hold()\x20paths'],'recommended_templates':['T-PR-01']},{'id':'progress_named_operator','name':'Named\x20operator\x20namespace\x20management','industry':['universal','logistics','arbitration','freelance'],'scenario':'Manage\x20named_operator\x20namespace\x20for\x20a\x20Progress.\x20Each\x20named\x20operator\x20is\x20a\x20(name\x20→\x20address\x20list)\x20'+'binding\x20used\x20by\x20Machine.forward.namedOperator\x20to\x20gate\x20next()/hold()\x20advancement.\x20'+'Up\x20to\x2060\x20named\x20operators\x20per\x20Progress,\x20up\x20to\x2080\x20addresses\x20per\x20operator.','phases':['named_operator_mgmt'],'requires_published_machine':!![],'requires_order_bound':![],'named_operator_roles':[{'role':'seller','typical_count':0x1},{'role':'logistics','typical_count':0x1},{'role':'reviewer','typical_count':0x3},{'role':'arbitrator','typical_count':0x5}],'builtin_indexes_consumed':[PROGRESS_NAMED_OPERATOR],'typical_context_repository_count':0x0,'uses_hold_mechanism':![],'uses_admin_unhold':![],'common_patterns':['namedOperator\x20name=\x27\x27:\x20special\x20case\x20—\x20means\x20OrderHolder\x20(order.owner/agent),\x20NOT\x20a\x20real\x20named\x20operator','add/set/remove\x20are\x20idempotent\x20on\x20duplicate\x20addresses\x20(vector::contains\x20check\x20before\x20push)','Use\x20\x27set\x27\x20to\x20REPLACE\x20an\x20operator\x27s\x20address\x20list;\x20use\x20\x27add\x27\x20to\x20extend;\x20\x27remove\x27\x20to\x20subtract','Names\x20must\x20satisfy\x20common::NAME\x20(isValidName)\x20—\x20non-empty,\x20length-bounded'],'recommended_templates':['T-PR-01','T-PR-02']},{'id':'progress_unhold','name':'Hold\x20release\x20(unhold\x20/\x20adminUnhold)\x20workflow','industry':['content','rental','arbitration','subscription'],'scenario':'Release\x20a\x20forward\x20that\x20was\x20previously\x20held.\x20Two\x20paths:\x20'+'(a)\x20unhold\x20by\x20original\x20holder\x20(named_operator\x20match);\x20'+'(b)\x20adminUnhold\x20(224)\x20by\x20permission-table\x20holder\x20—\x20bypasses\x20holder\x20check.\x20'+'adminUnhold\x20is\x20the\x20deadlock-resolution\x20escape\x20hatch\x20when\x20a\x20holder\x20is\x20unresponsive.','phases':['hold_state','unhold_state'],'requires_published_machine':!![],'requires_order_bound':!![],'named_operator_roles':[{'role':'holder','typical_count':0x1},{'role':'admin','typical_count':0x1}],'builtin_indexes_consumed':[PROGRESS_UNHOLD],'typical_context_repository_count':0x0,'uses_hold_mechanism':!![],'uses_admin_unhold':!![],'common_patterns':['unhold\x20checks\x20whether\x20the\x20sender\x20holds\x20permission\x20index\x20224:\x20if\x20yes,\x20force\x20release;\x20if\x20no,\x20require\x20holder\x20match','adminUnhold\x20has\x20wider\x20blast\x20radius\x20—\x20only\x20grant\x20224\x20to\x20trusted\x20recovery\x20operators','If\x20forward\x20already\x20accomplished,\x20E_FORWARD_ALREADY_ACCOMPLISHED\x20blocks\x20re-hold','Repeated\x20hold/unhold\x20cycles\x20indicate\x20a\x20stuck\x20workflow\x20—\x20surface\x20to\x20order-monitor'],'recommended_templates':['T-PR-05']},{'id':'progress_context_repository','name':'Context\x20Repository\x20binding\x20workflow','industry':['education','content','rental','cross_chain'],'scenario':'Bind/unbind\x20Repository\x20objects\x20as\x20Progress\x20context_repositories.\x20'+'Used\x20to\x20provide\x20query-time\x20context\x20(learning\x20progress,\x20inspection\x20records,\x20bridge\x20state).\x20'+'Up\x20to\x20MAX_CONTEXT_REPOSITORY_COUNT=30\x20repositories\x20per\x20Progress.','phases':['context_binding'],'requires_published_machine':!![],'requires_order_bound':![],'named_operator_roles':[],'builtin_indexes_consumed':[PROGRESS_CONTEXT_REPOSITORY],'typical_context_repository_count':0x3,'uses_hold_mechanism':![],'uses_admin_unhold':![],'common_patterns':['Binding\x20a\x20context\x20repository\x20registers\x20the\x20link\x20through\x20an\x20affiliation\x20transaction\x20(enables\x20cross-object\x20queries)','Unbinding\x20disaffiliates\x20the\x20link\x20—\x20Repository\x20may\x20be\x20garbage-collected\x20if\x20no\x20other\x20refs','Clearing\x20empties\x20the\x20entire\x20list\x20in\x20one\x20transaction','add\x20is\x20idempotent:\x20if\x20Repository\x20already\x20in\x20list,\x20no-op\x20(vector::contains\x20check)','Bind\x20before\x20forward\x20advance\x20so\x20on-chain\x20guards\x20can\x20read\x20context\x20data'],'recommended_templates':['T-PR-03']},{'id':'progress_owner_receive','name':'Owner\x20receive\x20(unwrap)\x20workflow','industry':['finance','treasury','rental','freelance'],'scenario':'Owner\x20receives\x20Receiving<K>\x20objects\x20or\x20CoinWrapper<T>\x20coins\x20sent\x20to\x20the\x20Progress\x20object.\x20'+'unwrap\x20→\x20forwarded\x20to\x20the\x20Permission\x20owner\x20through\x20the\x20permission\x20owner-receive\x20path.\x20'+'Used\x20at\x20terminal\x20nodes\x20(return_approved,\x20completed,\x20enforced)\x20to\x20disburse\x20funds.','phases':['owner_receive'],'requires_published_machine':!![],'requires_order_bound':!![],'named_operator_roles':[],'builtin_indexes_consumed':[PROGRESS_OWNER_RECEIVE],'typical_context_repository_count':0x0,'uses_hold_mechanism':![],'uses_admin_unhold':![],'common_patterns':['owner_receive\x20unwraps\x20CoinWrapper<T>\x20via\x20the\x20payment\x27s\x20type-checked\x20unwrap\x20(amount\x20validation)','Receiving\x20a\x20generic\x20K:key+store\x20object\x20forwards\x20it\x20to\x20the\x20Permission\x20owner','Triggered\x20at\x20terminal\x20nodes\x20(e.g.\x20\x27return_approved\x27\x20in\x20rental,\x20\x27enforced\x27\x20in\x20arbitration)','Permission\x20owner\x20≠\x20Progress\x20creator:\x20receives\x20flow\x20to\x20whoever\x20owns\x20the\x20bound\x20Machine\x27s\x20Permission'],'recommended_templates':['T-PR-06']},{'id':'progress_completed','name':'Forward\x20advancement\x20&\x20session\x20completion','industry':['universal'],'scenario':'Advance\x20Progress\x20via\x20next()\x20/\x20the\x20order-holder\x20advancement\x20path\x20—\x20accumulates\x20weights\x20in\x20session.forwards,\x20'+'and\x20when\x20weights\x20≥\x20threshold,\x20moves\x20session\x20into\x20history\x20and\x20updates\x20Progress.current.\x20'+'This\x20is\x20the\x20canonical\x20Forward\x20advancement\x20path\x20for\x20ALL\x20non-hold\x20operations.','phases':['forward_advance','completed'],'requires_published_machine':!![],'requires_order_bound':!![],'named_operator_roles':[{'role':'OrderHolder','typical_count':0x1},{'role':'next_node_operator','typical_count':0x1}],'builtin_indexes_consumed':[],'typical_context_repository_count':0x0,'uses_hold_mechanism':![],'uses_admin_unhold':![],'common_patterns':['Forward\x20guard\x20(Some):\x20requires\x20Passport;\x20the\x20passport\x20verification\x20against\x20the\x20guard\x20must\x20pass','Forward\x20guard\x20(None):\x20requires\x20permissionIndex\x20(Some)\x20or\x20namedOperator\x20match\x20(ASSERT_PERMISSION)','session.weights\x20+=\x20forward.weight;\x20when\x20≥\x20threshold,\x20push\x20session\x20into\x20ParentTableVec<History>','Progress.current\x20=\x20next_node\x20only\x20after\x20session\x20completes\x20(atomic\x20update)','E_NOT_THE_HOLDER:\x20if\x20forward\x20was\x20held\x20by\x20another\x20address,\x20next()\x20aborts','E_FORWARD_ALREADY_ACCOMPLISHED:\x20re-hold\x20on\x20completed\x20forward\x20is\x20blocked','⚠\x20ROUTING\x20FACT:\x20Forward.namedOperator=\x22\x22\x20(empty)\x20→\x20order-bound\x20entry\x20only\x20(order.progress,\x20or\x20'+'progress.operate\x20which\x20auto-routes\x20when\x20the\x20Progress\x20task\x20is\x20an\x20Order).\x20Non-empty\x20namedOperator\x20or\x20'+'permissionIndex-only\x20→\x20either\x20entry\x20(identical\x20checks).\x20A\x20standalone\x20Progress\x20cannot\x20advance\x20\x22\x22\x20'+'forwards\x20at\x20all\x20(abort\x208\x20—\x20no\x20order\x20payer\x20exists).\x20See\x20file\x20header\x20ROUTING\x20FACTS.'],'recommended_templates':['T-PR-04']}];export const PROGRESS_LEDGER_VERSION='1.0.0';export function getScenesByPhase(a){return PROGRESS_SCENES['filter'](b=>b['phases']['includes'](a));}export function findSceneById(a){return PROGRESS_SCENES['find'](b=>b['id']===a);}export function getScenesByIndustry(a){return PROGRESS_SCENES['filter'](b=>b['industry']['includes'](a)||b['industry']['includes']('universal'));}export function getBuiltinPermissionByIndex(a){return PROGRESS_PERMISSIONS['find'](b=>b['index']===a);}export function isProgressBuiltinPermission(a){return getBuiltinPermissionByIndex(a)!==undefined;}export function inferSceneFromIntent(a){const b=a['toLowerCase'](),c=[['adminunhold','progress_unhold'],['admin\x20unhold','progress_unhold'],['force\x20unhold','progress_unhold'],['unhold','progress_unhold'],['release\x20hold','progress_unhold'],['owner_receive','progress_owner_receive'],['owner\x20receive','progress_owner_receive'],['unwrap','progress_owner_receive'],['context_repository','progress_context_repository'],['context\x20repository','progress_context_repository'],['repository\x20binding','progress_context_repository'],['named_operator','progress_named_operator'],['named\x20operator','progress_named_operator'],['namedoperator','progress_named_operator'],['task\x20set','progress_task_submit'],['submit\x20task','progress_task_submit'],['next','progress_completed'],['advance','progress_completed'],['complete','progress_completed']];for(const [d,e]of c){if(b['includes'](d)){const f=findSceneById(e);if(f)return f;}}return undefined;}export function getAllBuiltinPermissions(){return[...PROGRESS_PERMISSIONS];}export function getProgressScenesCount(){return PROGRESS_SCENES['length'];}export function validateNamedOperatorAddressList(b){const c=[];b['length']>MAX_NAMED_OPERATOR_ADDRESS_COUNT&&c['push']('Named\x20operator\x20address\x20count\x20'+b['length']+'\x20exceeds\x20MAX_NAMED_OPERATOR_ADDRESS_COUNT\x20'+MAX_NAMED_OPERATOR_ADDRESS_COUNT);const d=new Set();for(const e of b){if(d['has'](e)){c['push']('Duplicate\x20address\x20in\x20list:\x20'+e+'\x20(Move\x20will\x20dedupe\x20silently)');break;}d['add'](e);}return{'ok':c['length']===0x0,'violations':c};}export function validateNamedOperatorCount(a){if(a>=MAX_NAMED_OPERATOR_COUNT)return{'ok':![],'violation':'Named\x20operator\x20count\x20'+a+'\x20would\x20exceed\x20MAX_NAMED_OPERATOR_COUNT\x20'+MAX_NAMED_OPERATOR_COUNT};return{'ok':!![]};}export function validateContextRepositoryCount(a,b){const c=a+b;if(c>MAX_CONTEXT_REPOSITORY_COUNT)return{'ok':![],'violation':'Context\x20repository\x20count\x20'+c+'\x20would\x20exceed\x20MAX_CONTEXT_REPOSITORY_COUNT\x20'+MAX_CONTEXT_REPOSITORY_COUNT};return{'ok':!![]};}export const PROGRESS_CROSS_OBJECT_REFS=[{'object':'Machine','phase':'universal','relationship':'Progress.machine\x20(immutable\x20bind,\x20E_MACHINE_NOT_MATCH\x20on\x20every\x20op)'},{'object':'Order','phase':'forward_advance','relationship':'Progress.task\x20=\x20Order.address\x20(1:1,\x20set\x20via\x20task\x20submission\x20or\x20the\x20buy\x20flow)'},{'object':'Order','phase':'forward_advance','relationship':'order-holder\x20paths\x20(advance\x20/\x20hold):\x20the\x20order\x20owner-or-agent\x20permission\x20check\x20gates\x20Forward\x20advance'},{'object':'Permission','phase':'universal','relationship':'Machine.permission\x20is\x20borrowed\x20for\x20ALL\x20220-225\x20assertions'},{'object':'Repository','phase':'context_binding','relationship':'context_repositories:\x20vector<address>\x20(≤\x2030),\x20bound\x20via\x20an\x20affiliation\x20transaction'},{'object':'Service','phase':'creation','relationship':'the\x20buy\x20flow\x20creates\x20the\x20Progress\x20internally\x20(bypasses\x20220\x20assertion\x20—\x20package-internal\x20entry)'},{'object':'Passport','phase':'forward_advance','relationship':'Forward.guard\x20(Some)\x20requires\x20Passport\x20+\x20passing\x20the\x20passport\x20verification'},{'object':'Passport','phase':'unhold_state','relationship':'passport-based\x20unhold:\x20224\x20check\x20via\x20passport\x20(fallback\x20when\x20the\x20sender\x27s\x20direct\x20224\x20permission\x20check\x20fails)'},{'object':'Payment','phase':'owner_receive','relationship':'owner_receive\x20unwraps\x20CoinWrapper<T>\x20via\x20the\x20payment\x27s\x20type-checked\x20unwrap'},{'object':'Allocation','phase':'completed','relationship':'Terminal\x20node\x20triggers\x20Allocation\x20alloc\x20(e.g.\x20\x27completed\x27,\x20\x27enforced\x27,\x20\x27return_approved\x27)'}];
@@ -14,6 +14,9 @@ export interface ModeAllocatorRow {
14
14
  mode: "amount" | "rate" | "surplus";
15
15
  value?: string | number;
16
16
  value_from?: string;
17
+ fix?: string | number;
18
+ fix_from?: string;
19
+ guard_key?: string;
17
20
  note?: string;
18
21
  }
19
22
  export interface ModeAllocatorStrategy {
@@ -30,12 +33,22 @@ export interface ModeGuardRef {
30
33
  template_id: string;
31
34
  host: "service" | "machine" | "reward" | "repository" | "arbitration";
32
35
  purpose: string;
36
+ key?: string;
33
37
  }
34
38
  export interface ModeMachineNode {
35
39
  name: string;
36
40
  role: string;
37
41
  operator?: "merchant" | "order_payer";
38
42
  semantic_role?: "draft" | "active" | "delivered" | "final" | "cancelled";
43
+ optional?: boolean;
44
+ from?: (string | ModeMachineEdge)[];
45
+ }
46
+ export interface ModeMachineEdge {
47
+ prev: string;
48
+ forward?: string;
49
+ operator?: "merchant" | "order_payer";
50
+ permission_index?: number;
51
+ guard_key?: string;
39
52
  }
40
53
  export declare const BUYER_ACTION_NODE_RE: RegExp;
41
54
  export declare function unannotatedBuyerActionNodes(shape: ReadonlyArray<{
@@ -1 +1 @@
1
- import{resolveInViewport}from'./repository-write-semantics.js';export const SERVICE_ALLOCATION_SEMANTICS_ANALYZER_ID='SA1';export const ALLOCATION_SEMANTICS_ANALYZER_ID='SA2';function asRecord(a){return a!=null&&typeof a==='object'&&!Array['isArray'](a)?a:undefined;}function recipientOf(a){if(typeof a==='string')return'entity:'+a['toLowerCase']();const b=asRecord(a);if(b){if(b['signer']!=null)return'signer';const c=b['guard_identifier']??b['guardIdentifier']??b['identifier'];if(c!=null)return'guard_identifier:'+String(c);const d=b['address']??b['entity'];if(typeof d==='string')return'entity:'+d['toLowerCase']();}if(typeof a==='number')return'guard_identifier:'+a;return'(unknown\x20recipient)';}function modeOf(a){const b=typeof a==='number'?a:typeof a==='string'?Number(a):NaN;return Number['isNaN'](b)?undefined:b;}function normalizeSharing(a){if(!Array['isArray'](a))return[];return a['map'](b=>{const c=b??{};return{'who':recipientOf(c['who']??c['recipient']),...c['sharing']!=null?{'value':String(c['sharing'])}:{},...modeOf(c['mode'])!==undefined?{'mode':modeOf(c['mode'])}:{}};});}function normalizeAllocators(a){if(!Array['isArray'](a))return[];return a['map'](b=>{const c=b??{},d=normalizeSharing(c['sharing']),e=modeOf(c['mode']),f=e!==undefined?d['map'](g=>g['mode']===undefined?{...g,'mode':e}:g):d;return{...typeof c['guard']==='string'&&c['guard']?{'guard':c['guard']['toLowerCase']()}:{},'sharing':f,...c['fix']!=null?{'fix':String(c['fix'])}:{},...c['max']!=null&&c['max']!==null?{'max':String(c['max'])}:{}};});}export function serviceAllocatorsOf(a){const b=asRecord(a['order_allocators']);if(!b)return[];return normalizeAllocators(b['allocators']);}export function allocationInstanceFactsOf(a){const b=asRecord(a['allocators']),c=asRecord(a['payment_info']),d=e=>typeof e==='string'&&e['length']>0x0?e['toLowerCase']():undefined;return{'allocators':normalizeAllocators(b?.['allocators']),...b&&b['threshold']!=null?{'threshold':String(b['threshold'])}:{},...c&&d(c['for_object'])?{'forObject':d(c['for_object'])}:{},...c&&d(c['for_guard'])?{'forGuard':d(c['for_guard'])}:{}};}const MODE_NAME={0x0:'amount',0x1:'rate',0x2:'surplus',0x3:'rate-gross'};function modeSemantics(a,b){switch(a){case 0x0:return'fixed-amount\x20mode:\x20the\x20allocator\x20moves\x20its\x20configured\x20total'+(b['fix']?'\x20(fix\x20'+b['fix']+')':'')+(b['max']?'\x20capped\x20at\x20'+b['max']:'')+';\x20a\x20run\x20with\x20insufficient\x20balance\x20aborts\x20the\x20whole\x20allocation';case 0x1:return'net\x20rate\x20mode:\x20each\x20row\x20moves\x20share/10000\x20of\x20the\x20EXECUTION-TIME\x20surplus\x20(balance\x20minus\x20the\x20fixed\x20part)\x20—\x20recipient\x20amounts\x20float\x20with\x20the\x20balance\x20at\x20unlock\x20time';case 0x2:return'surplus\x20mode:\x20the\x20row\x20receives\x20whatever\x20remains\x20after\x20the\x20fixed\x20and\x20rated\x20rows\x20are\x20served';case 0x3:return'rate-gross\x20mode:\x20each\x20row\x20moves\x20share/10000\x20of\x20the\x20FULL\x20pool\x20(or\x20the\x20max\x20cap\x20when\x20set)\x20with\x20the\x20fixed\x20part\x20NOT\x20removed\x20—\x20lets\x20fixed\x20Amount\x20rows\x20and\x20percentage-of-total\x20rows\x20coexist\x20exactly';default:return'mode\x20value\x20out\x20of\x20the\x20on-chain\x20range\x20(0/1/2/3)\x20—\x20the\x20configuration\x20cannot\x20exist\x20on-chain';}}function classificationRisks(a,b,c){const d=[];a['forEach']((e,f)=>{const g=[...new Set(e['sharing']['map'](j=>j['mode']??0x0))],h=g['length']===0x1?g[0x0]:undefined;d['push']({'id':'R-ALC-S-01','level':'info','title':'Allocator\x20#'+f+'\x20of\x20'+c+':\x20'+(h!==undefined?MODE_NAME[h]??'mode\x20'+h:'mixed-mode')+'\x20allocation','description':'Unlocking\x20guard\x20'+(e['guard']??'(proposal\x20guard)')+'\x20triggers\x20this\x20allocator\x20—\x20'+modeSemantics(h,e)+'.\x20'+(e['sharing']['length']+'\x20recipient\x20row(s):\x20'+e['sharing']['map'](j=>''+j['who']+(j['value']?'='+j['value']:''))['join'](',\x20')+'.')+(b&&b!=='0'?'\x20The\x20allocation\x20template\x20enforces\x20a\x20minimum\x20run\x20amount\x20of\x20'+b+'.':''),'evidence':'allocator='+f+'\x20guard='+(e['guard']??'?')+'\x20sharing_rows='+e['sharing']['length'],'affected_stakeholders':['owner','buyer'],'confidence':'exact'});});for(let e=0x0;e<a['length'];e++){const f=a[e]['sharing']['filter'](h=>h['mode']===0x1);if(f['length']===0x0)continue;const g=f['reduce']((h,j)=>h+Number(j['value']??0x0),0x0);g!==0x2710&&d['push']({'id':'R-ALC-S-05','level':'info','title':'Allocator\x20#'+e+'\x20of\x20'+c+':\x20rated\x20rows\x20sum\x20to\x20'+g+'/10000','description':'Rate\x20rows\x20are\x20fractions\x20of\x20the\x20execution-time\x20surplus\x20(basis\x2010000).\x20A\x20sum\x20of\x20'+g+'\x20leaves\x20'+(0x2710-g)+'/10000\x20of\x20the\x20surplus\x20unmoved\x20by\x20this\x20allocator\x20per\x20run\x20—\x20intentional\x20residue\x20or\x20a\x20configuration\x20slip?','evidence':'allocator='+e+'\x20rate_sum='+g,'affected_stakeholders':['owner','buyer'],'confidence':'exact'});}return d;}function duplicateGuardRisks(a,b){const c=new Map(),d=[];return a['forEach']((e,f)=>{if(!e['guard'])return;const g=c['get'](e['guard']);g!==undefined?d['push']({'id':'R-ALC-S-04','level':'high','title':'Allocator\x20#'+f+'\x20of\x20'+b+'\x20can\x20never\x20run\x20(duplicate\x20guard)','description':'Guard\x20'+e['guard']+'\x20already\x20drives\x20allocator\x20#'+g+';\x20allocation\x20matches\x20the\x20FIRST\x20allocator\x20whose\x20guard\x20equals\x20the\x20unlocking\x20guard,\x20so\x20this\x20entry\x20is\x20dead\x20configuration\x20—\x20its\x20recipients\x20are\x20silently\x20unreachable.\x20Remove\x20it\x20or\x20give\x20it\x20a\x20distinct\x20guard.','evidence':'guard='+e['guard']+'\x20first='+g+'\x20duplicate='+f,'affected_stakeholders':['owner','buyer'],'confidence':'exact'}):c['set'](e['guard'],f);}),d;}function resolutionRisks(b,c,d){const f=[],g=new Set();for(const h of b){if(!h['guard'])continue;const i=resolveInViewport(h['guard'],d);if(i['status']!=='fetched'){if(g['has'](h['guard']))continue;g['add'](h['guard']);const j=i['status']==='masked'?'present\x20in\x20the\x20graph\x20but\x20ACCESS-GATED\x20for\x20the\x20current\x20viewer':i['status']==='unfetched'?'in\x20the\x20graph\x20but\x20its\x20state\x20is\x20\x22'+i['state']+'\x22':'OUTSIDE\x20the\x20witnessed\x20topology';f['push']({'id':'R-ALC-S-02','level':'medium','title':'Allocator\x20guard\x20unresolved\x20—\x20allocation\x20semantics\x20incomplete','description':'Guard\x20'+h['guard']+'\x20of\x20'+c+'\x20is\x20'+j+':\x20what\x20unlocks\x20this\x20allocator,\x20and\x20therefore\x20when\x20money\x20moves,\x20cannot\x20be\x20assessed.\x20'+(i['status']==='absent'&&i['depthCapped']?'The\x20expansion\x20depth\x20budget\x20was\x20exhausted\x20(default\x20depth\x20is\x204);\x20request\x20a\x20deeper\x20topology\x20read.':i['status']==='absent'?'Request\x20a\x20deeper\x20or\x20wider\x20topology\x20read\x20(raise\x20the\x20exploration\x20depth\x20beyond\x20the\x20default\x204,\x20or\x20widen\x20the\x20expanded\x20edge\x20set).':i['status']==='masked'?'Widen\x20viewer\x20access\x20and\x20re-analyze.':'Retry\x20once\x20the\x20object\x20fetch\x20succeeds.'),'evidence':'guard='+h['guard']+'\x20resolution='+i['status'],'affected_stakeholders':['owner','buyer'],'confidence':'bounded'});continue;}for(const k of d['graph']['out']['get'](h['guard'])??[]){if(k['schema']!=='guard.relies')continue;const l=resolveInViewport(k['to'],d);if(l['status']==='fetched')continue;f['push']({'id':'R-ALC-S-03','level':'medium','title':'Sub-guard\x20of\x20an\x20allocator\x20guard\x20unresolved\x20—\x20condition\x20semantics\x20incomplete','description':'The\x20allocator\x20guard\x20'+h['guard']+'\x20of\x20'+c+'\x20relies\x20on\x20sub-guard\x20'+k['to']+',\x20which\x20is\x20not\x20witnessed\x20as\x20fetched:\x20part\x20of\x20the\x20unlock\x20condition\x20is\x20invisible,\x20so\x20sufficiency\x20of\x20the\x20allocation\x20conditions\x20cannot\x20be\x20confirmed.','evidence':'guard='+h['guard']+'\x20relies='+k['to']+'\x20resolution='+l['status'],'affected_stakeholders':['owner','buyer'],'confidence':'bounded'});}}return f;}function anchoringRisks(a,b){if(a['forObject']||a['forGuard'])return[];return[{'id':'R-ALC-S-06','level':'info','title':b+'\x20is\x20not\x20anchored\x20to\x20a\x20business\x20object','description':'No\x20for_object/for_guard\x20anchoring\x20is\x20configured:\x20ANY\x20payment\x20routed\x20to\x20this\x20allocation\x20(from\x20any\x20source\x20that\x20learns\x20its\x20address)\x20unlocks\x20the\x20allocation\x20guards\x20—\x20the\x20split\x20runs\x20regardless\x20of\x20business\x20context.\x20Anchoring\x20is\x20enforced\x20ONLY\x20when\x20set;\x20leave\x20unanchored\x20only\x20when\x20open\x20routing\x20is\x20intended.','evidence':'for_object=none\x20for_guard=none','affected_stakeholders':['owner','buyer'],'confidence':'exact'}];}function analyzeAllocationSemantics(a,b,c,d){const e=[];if(a['length']===0x0)return e['push']({'id':'R-ALC-S-01','level':'info','title':b['subject']+'\x20has\x20no\x20allocators','description':'No\x20allocator\x20is\x20configured\x20—\x20no\x20split\x20runs\x20when\x20payments\x20settle;\x20funds\x20stay\x20in\x20the\x20host\x20object.\x20Configure\x20allocators\x20if\x20proceeds\x20must\x20be\x20distributed.','evidence':'allocators=0','affected_stakeholders':['owner'],'confidence':'exact'}),e;return e['push'](...classificationRisks(a,b['threshold'],b['subject'])),e['push'](...duplicateGuardRisks(a,b['subject'])),e['push'](...resolutionRisks(a,b['subject'],d)),b['anchored']===![]&&e['push'](...anchoringRisks({'allocators':a},b['subject'])),e;}export function analyzeServiceAllocationSemantics(a,b,c){return analyzeAllocationSemantics(serviceAllocatorsOf(a),{'subject':'service\x20'+b['id']+'\x20order_allocators'},b,c);}export function analyzeAllocationInstanceSemantics(a,b,c){const d=allocationInstanceFactsOf(a);return analyzeAllocationSemantics(d['allocators'],{'subject':'allocation\x20'+b['id'],...d['threshold']?{'threshold':d['threshold']}:{},'anchored':d['forObject']===undefined&&d['forGuard']===undefined?![]:!![]},b,c);}
1
+ import{resolveInViewport}from'./repository-write-semantics.js';export const SERVICE_ALLOCATION_SEMANTICS_ANALYZER_ID='SA1';export const ALLOCATION_SEMANTICS_ANALYZER_ID='SA2';function asRecord(a){return a!=null&&typeof a==='object'&&!Array['isArray'](a)?a:undefined;}function recipientOf(a){if(typeof a==='string')return'entity:'+a['toLowerCase']();const b=asRecord(a);if(b){if(b['signer']!=null)return'signer';const c=b['guard_identifier']??b['guardIdentifier']??b['identifier'];if(c!=null)return'guard_identifier:'+String(c);const d=b['address']??b['entity'];if(typeof d==='string')return'entity:'+d['toLowerCase']();}if(typeof a==='number')return'guard_identifier:'+a;return'(unknown\x20recipient)';}function modeOf(a){const b=typeof a==='number'?a:typeof a==='string'?Number(a):NaN;return Number['isNaN'](b)?undefined:b;}function normalizeSharing(a){if(!Array['isArray'](a))return[];return a['map'](b=>{const c=b??{};return{'who':recipientOf(c['who']??c['recipient']),...c['sharing']!=null?{'value':String(c['sharing'])}:{},...modeOf(c['mode'])!==undefined?{'mode':modeOf(c['mode'])}:{}};});}function normalizeAllocators(a){if(!Array['isArray'](a))return[];return a['map'](b=>{const c=b??{},d=normalizeSharing(c['sharing']),e=modeOf(c['mode']),f=e!==undefined?d['map'](g=>g['mode']===undefined?{...g,'mode':e}:g):d;return{...typeof c['guard']==='string'&&c['guard']?{'guard':c['guard']['toLowerCase']()}:{},'sharing':f,...c['fix']!=null?{'fix':String(c['fix'])}:{},...c['max']!=null&&c['max']!==null?{'max':String(c['max'])}:{}};});}export function serviceAllocatorsOf(a){const b=asRecord(a['order_allocators']);if(!b)return[];return normalizeAllocators(b['allocators']);}export function allocationInstanceFactsOf(a){const b=asRecord(a['allocators']),c=asRecord(a['payment_info']),d=e=>typeof e==='string'&&e['length']>0x0?e['toLowerCase']():undefined;return{'allocators':normalizeAllocators(b?.['allocators']),...b&&b['threshold']!=null?{'threshold':String(b['threshold'])}:{},...c&&d(c['for_object'])?{'forObject':d(c['for_object'])}:{},...c&&d(c['for_guard'])?{'forGuard':d(c['for_guard'])}:{}};}const MODE_NAME={0x0:'amount',0x1:'rate',0x2:'surplus',0x3:'rate-gross'};function modeSemantics(a,b){switch(a){case 0x0:return'fixed-amount\x20mode:\x20the\x20allocator\x20moves\x20its\x20configured\x20total'+(b['fix']?'\x20(fix\x20'+b['fix']+')':'')+(b['max']?'\x20capped\x20at\x20'+b['max']:'')+';\x20a\x20run\x20with\x20insufficient\x20balance\x20aborts\x20the\x20whole\x20allocation';case 0x1:return'net\x20rate\x20mode:\x20each\x20row\x20moves\x20share/10000\x20of\x20the\x20EXECUTION-TIME\x20surplus\x20(balance\x20minus\x20the\x20fixed\x20part)\x20—\x20recipient\x20amounts\x20float\x20with\x20the\x20balance\x20at\x20unlock\x20time';case 0x2:return'surplus\x20mode:\x20the\x20row\x20receives\x20whatever\x20remains\x20after\x20the\x20fixed\x20and\x20rated\x20rows\x20are\x20served';case 0x3:return'rate-gross\x20mode:\x20each\x20row\x20moves\x20share/10000\x20of\x20the\x20FULL\x20pool\x20(or\x20the\x20max\x20cap\x20when\x20set)\x20with\x20the\x20fixed\x20part\x20NOT\x20removed\x20—\x20lets\x20fixed\x20Amount\x20rows\x20and\x20percentage-of-total\x20rows\x20coexist\x20exactly';default:return'mode\x20value\x20out\x20of\x20the\x20on-chain\x20range\x20(0/1/2/3)\x20—\x20the\x20configuration\x20cannot\x20exist\x20on-chain';}}function classificationRisks(a,b,c){const d=[];a['forEach']((e,f)=>{const g=[...new Set(e['sharing']['map'](j=>j['mode']??0x0))],h=g['length']===0x1?g[0x0]:undefined;d['push']({'id':'R-ALC-S-01','level':'info','title':'Allocator\x20#'+f+'\x20of\x20'+c+':\x20'+(h!==undefined?MODE_NAME[h]??'mode\x20'+h:'mixed-mode')+'\x20allocation','description':'Unlocking\x20guard\x20'+(e['guard']??'(proposal\x20guard)')+'\x20triggers\x20this\x20allocator\x20—\x20'+modeSemantics(h,e)+'.\x20'+(e['sharing']['length']+'\x20recipient\x20row(s):\x20'+e['sharing']['map'](j=>''+j['who']+(j['value']?'='+j['value']:''))['join'](',\x20')+'.')+(b&&b!=='0'?'\x20The\x20allocation\x20template\x20enforces\x20a\x20minimum\x20run\x20amount\x20of\x20'+b+'.':''),'evidence':'allocator='+f+'\x20guard='+(e['guard']??'?')+'\x20sharing_rows='+e['sharing']['length'],'affected_stakeholders':['owner','buyer'],'confidence':'exact'});});for(let e=0x0;e<a['length'];e++){const f=a[e]['sharing']['filter'](h=>h['mode']===0x1);if(f['length']===0x0)continue;const g=f['reduce']((h,j)=>h+Number(j['value']??0x0),0x0);g!==0x2710&&d['push']({'id':'R-ALC-S-05','level':'info','title':'Allocator\x20#'+e+'\x20of\x20'+c+':\x20rated\x20rows\x20sum\x20to\x20'+g+'/10000','description':'Rate\x20rows\x20are\x20fractions\x20of\x20the\x20execution-time\x20surplus\x20(basis\x2010000).\x20A\x20sum\x20of\x20'+g+'\x20leaves\x20'+(0x2710-g)+'/10000\x20of\x20the\x20surplus\x20unmoved\x20by\x20this\x20allocator\x20per\x20run\x20—\x20intentional\x20residue\x20or\x20a\x20configuration\x20slip?','evidence':'allocator='+e+'\x20rate_sum='+g,'affected_stakeholders':['owner','buyer'],'confidence':'exact'});}return d;}function duplicateGuardRisks(a,b){const c=new Map(),d=[];return a['forEach']((e,f)=>{if(!e['guard'])return;const g=c['get'](e['guard']);g!==undefined?d['push']({'id':'R-ALC-S-04','level':'high','title':'Allocator\x20#'+f+'\x20of\x20'+b+'\x20can\x20never\x20run\x20(duplicate\x20guard)','description':'Guard\x20'+e['guard']+'\x20already\x20drives\x20allocator\x20#'+g+';\x20allocation\x20fires\x20EVERY\x20allocator\x20whose\x20guard\x20equals\x20the\x20unlocking\x20guard\x20(allocation.move:366-368),\x20so\x20this\x20entry\x20STACKS\x20with\x20#'+g+'\x20on\x20the\x20same\x20call\x20—\x20each\x20fires\x20in\x20vector\x20order\x20against\x20the\x20shrinking\x20pool.\x20If\x20they\x20were\x20meant\x20as\x20alternative\x20paths,\x20give\x20this\x20entry\x20a\x20distinct\x20guard;\x20if\x20a\x20waterfall\x20was\x20intended,\x20verify\x20the\x20order\x20matches\x20the\x20payout\x20sequence.','evidence':'guard='+e['guard']+'\x20first='+g+'\x20duplicate='+f,'affected_stakeholders':['owner','buyer'],'confidence':'exact'}):c['set'](e['guard'],f);}),d;}function resolutionRisks(b,c,d){const f=[],g=new Set();for(const h of b){if(!h['guard'])continue;const i=resolveInViewport(h['guard'],d);if(i['status']!=='fetched'){if(g['has'](h['guard']))continue;g['add'](h['guard']);const j=i['status']==='masked'?'present\x20in\x20the\x20graph\x20but\x20ACCESS-GATED\x20for\x20the\x20current\x20viewer':i['status']==='unfetched'?'in\x20the\x20graph\x20but\x20its\x20state\x20is\x20\x22'+i['state']+'\x22':'OUTSIDE\x20the\x20witnessed\x20topology';f['push']({'id':'R-ALC-S-02','level':'medium','title':'Allocator\x20guard\x20unresolved\x20—\x20allocation\x20semantics\x20incomplete','description':'Guard\x20'+h['guard']+'\x20of\x20'+c+'\x20is\x20'+j+':\x20what\x20unlocks\x20this\x20allocator,\x20and\x20therefore\x20when\x20money\x20moves,\x20cannot\x20be\x20assessed.\x20'+(i['status']==='absent'&&i['depthCapped']?'The\x20expansion\x20depth\x20budget\x20was\x20exhausted\x20(default\x20depth\x20is\x204);\x20request\x20a\x20deeper\x20topology\x20read.':i['status']==='absent'?'Request\x20a\x20deeper\x20or\x20wider\x20topology\x20read\x20(raise\x20the\x20exploration\x20depth\x20beyond\x20the\x20default\x204,\x20or\x20widen\x20the\x20expanded\x20edge\x20set).':i['status']==='masked'?'Widen\x20viewer\x20access\x20and\x20re-analyze.':'Retry\x20once\x20the\x20object\x20fetch\x20succeeds.'),'evidence':'guard='+h['guard']+'\x20resolution='+i['status'],'affected_stakeholders':['owner','buyer'],'confidence':'bounded'});continue;}for(const k of d['graph']['out']['get'](h['guard'])??[]){if(k['schema']!=='guard.relies')continue;const l=resolveInViewport(k['to'],d);if(l['status']==='fetched')continue;f['push']({'id':'R-ALC-S-03','level':'medium','title':'Sub-guard\x20of\x20an\x20allocator\x20guard\x20unresolved\x20—\x20condition\x20semantics\x20incomplete','description':'The\x20allocator\x20guard\x20'+h['guard']+'\x20of\x20'+c+'\x20relies\x20on\x20sub-guard\x20'+k['to']+',\x20which\x20is\x20not\x20witnessed\x20as\x20fetched:\x20part\x20of\x20the\x20unlock\x20condition\x20is\x20invisible,\x20so\x20sufficiency\x20of\x20the\x20allocation\x20conditions\x20cannot\x20be\x20confirmed.','evidence':'guard='+h['guard']+'\x20relies='+k['to']+'\x20resolution='+l['status'],'affected_stakeholders':['owner','buyer'],'confidence':'bounded'});}}return f;}function anchoringRisks(a,b){if(a['forObject']||a['forGuard'])return[];return[{'id':'R-ALC-S-06','level':'info','title':b+'\x20is\x20not\x20anchored\x20to\x20a\x20business\x20object','description':'No\x20for_object/for_guard\x20anchoring\x20is\x20configured:\x20ANY\x20payment\x20routed\x20to\x20this\x20allocation\x20(from\x20any\x20source\x20that\x20learns\x20its\x20address)\x20unlocks\x20the\x20allocation\x20guards\x20—\x20the\x20split\x20runs\x20regardless\x20of\x20business\x20context.\x20Anchoring\x20is\x20enforced\x20ONLY\x20when\x20set;\x20leave\x20unanchored\x20only\x20when\x20open\x20routing\x20is\x20intended.','evidence':'for_object=none\x20for_guard=none','affected_stakeholders':['owner','buyer'],'confidence':'exact'}];}function analyzeAllocationSemantics(a,b,c,d){const e=[];if(a['length']===0x0)return e['push']({'id':'R-ALC-S-01','level':'info','title':b['subject']+'\x20has\x20no\x20allocators','description':'No\x20allocator\x20is\x20configured\x20—\x20no\x20split\x20runs\x20when\x20payments\x20settle;\x20funds\x20stay\x20in\x20the\x20host\x20object.\x20Configure\x20allocators\x20if\x20proceeds\x20must\x20be\x20distributed.','evidence':'allocators=0','affected_stakeholders':['owner'],'confidence':'exact'}),e;return e['push'](...classificationRisks(a,b['threshold'],b['subject'])),e['push'](...duplicateGuardRisks(a,b['subject'])),e['push'](...resolutionRisks(a,b['subject'],d)),b['anchored']===![]&&e['push'](...anchoringRisks({'allocators':a},b['subject'])),e;}export function analyzeServiceAllocationSemantics(a,b,c){return analyzeAllocationSemantics(serviceAllocatorsOf(a),{'subject':'service\x20'+b['id']+'\x20order_allocators'},b,c);}export function analyzeAllocationInstanceSemantics(a,b,c){const d=allocationInstanceFactsOf(a);return analyzeAllocationSemantics(d['allocators'],{'subject':'allocation\x20'+b['id'],...d['threshold']?{'threshold':d['threshold']}:{},'anchored':d['forObject']===undefined&&d['forGuard']===undefined?![]:!![]},b,c);}