@wowok/agent-mcp 3.2.7 → 3.3.0

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 (265) hide show
  1. package/README.md +2 -2
  2. package/dist/chain-semantics/field-capability.js +1 -1
  3. package/dist/chain-semantics/freeze-map.js +1 -1
  4. package/dist/chain-semantics/fund-flow.js +1 -1
  5. package/dist/chain-semantics/guard-verbs.js +1 -1
  6. package/dist/chain-semantics/object-graph.js +1 -1
  7. package/dist/composition/audit.js +1 -1
  8. package/dist/composition/compile.d.ts +10 -1
  9. package/dist/composition/compile.js +1 -1
  10. package/dist/composition/inflight.d.ts +10 -0
  11. package/dist/composition/inflight.js +1 -1
  12. package/dist/extensions/business-modules.d.ts +1 -1
  13. package/dist/extensions/business-modules.js +1 -1
  14. package/dist/extensions/capability-manifest.js +1 -1
  15. package/dist/extensions/industry-audit.spec.js +1 -1
  16. package/dist/extensions/industry-pack.js +1 -1
  17. package/dist/graph/onchain/edge-schema.js +1 -1
  18. package/dist/graph/onchain/facts.spec.js +1 -1
  19. package/dist/graph/onchain/field-manifest.js +1 -1
  20. package/dist/harness/index.d.ts +1 -0
  21. package/dist/harness/index.js +1 -1
  22. package/dist/harness/operation-id.d.ts +1 -0
  23. package/dist/harness/operation-id.js +1 -0
  24. package/dist/harness/recover.js +1 -1
  25. package/dist/index.js +1 -1
  26. package/dist/intent/types.d.ts +1 -1
  27. package/dist/intent/types.js +1 -1
  28. package/dist/keeper/KeeperScan.d.ts +2 -1
  29. package/dist/keeper/KeeperScan.js +1 -1
  30. package/dist/keeper/keeper.spec.js +1 -1
  31. package/dist/keeper/types.d.ts +3 -0
  32. package/dist/keeper/types.js +1 -1
  33. package/dist/knowledge/allocator-rail-verifier.d.ts +34 -0
  34. package/dist/knowledge/allocator-rail-verifier.js +1 -0
  35. package/dist/knowledge/arbitration-ledger.js +1 -1
  36. package/dist/knowledge/arbitration-templates.js +1 -1
  37. package/dist/knowledge/arbitration-venue-order.js +1 -1
  38. package/dist/knowledge/audit-rules.d.ts +19 -1
  39. package/dist/knowledge/audit-rules.js +1 -1
  40. package/dist/knowledge/baselines/rules/alloc_audit.json +1 -1
  41. package/dist/knowledge/baselines/rules/arb.json +1 -1
  42. package/dist/knowledge/baselines/rules/guard.json +106 -1
  43. package/dist/knowledge/baselines/rules/machine.json +9 -6
  44. package/dist/knowledge/baselines/rules/plan.json +40 -17
  45. package/dist/knowledge/baselines/semantic-facts.js +1 -1
  46. package/dist/knowledge/builtin-templates.d.ts +1 -1
  47. package/dist/knowledge/builtin-templates.js +1 -1
  48. package/dist/knowledge/contract-invariants.js +1 -1
  49. package/dist/knowledge/discount-threshold.d.ts +11 -0
  50. package/dist/knowledge/discount-threshold.js +1 -1
  51. package/dist/knowledge/event-semantics.js +1 -1
  52. package/dist/knowledge/fund-layer.js +1 -1
  53. package/dist/knowledge/getting-started.js +1 -1
  54. package/dist/knowledge/guard-anchor-reach.d.ts +1 -1
  55. package/dist/knowledge/guard-anchor-reach.js +1 -1
  56. package/dist/knowledge/guard-bindings.js +1 -1
  57. package/dist/knowledge/guard-design-patterns.d.ts +1 -1
  58. package/dist/knowledge/guard-design-patterns.js +1 -1
  59. package/dist/knowledge/guard-field-cognition.js +1 -1
  60. package/dist/knowledge/guard-ledger.js +1 -1
  61. package/dist/knowledge/guard-lint.js +1 -1
  62. package/dist/knowledge/guard-render.js +1 -1
  63. package/dist/knowledge/guard-risk.d.ts +1 -0
  64. package/dist/knowledge/guard-risk.js +1 -1
  65. package/dist/knowledge/guard-submission-brief.d.ts +6 -0
  66. package/dist/knowledge/guard-submission-brief.js +1 -1
  67. package/dist/knowledge/guard-templates.d.ts +2 -2
  68. package/dist/knowledge/guard-templates.js +1 -1
  69. package/dist/knowledge/index.js +1 -1
  70. package/dist/knowledge/industry-registry.js +1 -1
  71. package/dist/knowledge/industry-strategy.js +1 -1
  72. package/dist/knowledge/jsonrpc-enum.js +1 -1
  73. package/dist/knowledge/machine-ledger.js +1 -1
  74. package/dist/knowledge/machine-puzzle.d.ts +1 -1
  75. package/dist/knowledge/machine-puzzle.js +1 -1
  76. package/dist/knowledge/machine-risk.js +1 -1
  77. package/dist/knowledge/machine-templates.js +1 -1
  78. package/dist/knowledge/machine-topology.d.ts +8 -0
  79. package/dist/knowledge/machine-topology.js +1 -1
  80. package/dist/knowledge/machine-translation.js +1 -1
  81. package/dist/knowledge/order-ledger.js +1 -1
  82. package/dist/knowledge/permission-ledger.js +1 -1
  83. package/dist/knowledge/protocol-facts.d.ts +16 -0
  84. package/dist/knowledge/protocol-facts.js +1 -0
  85. package/dist/knowledge/recipient-constraint.js +1 -1
  86. package/dist/knowledge/reward-ledger.d.ts +2 -1
  87. package/dist/knowledge/reward-ledger.js +1 -1
  88. package/dist/knowledge/reward-templates.js +1 -1
  89. package/dist/knowledge/safety-rules.d.ts +0 -2
  90. package/dist/knowledge/safety-rules.js +1 -1
  91. package/dist/knowledge/scenario-modes.d.ts +7 -0
  92. package/dist/knowledge/scenario-modes.js +1 -1
  93. package/dist/knowledge/strategy-manuals.js +1 -1
  94. package/dist/knowledge/template-loader.d.ts +13 -1
  95. package/dist/knowledge/template-loader.js +1 -1
  96. package/dist/knowledge/template-registry.js +1 -1
  97. package/dist/knowledge/template-scanner.d.ts +2 -0
  98. package/dist/knowledge/template-scanner.js +1 -1
  99. package/dist/knowledge/tool-constraints.js +1 -1
  100. package/dist/knowledge/tools-reference.js +1 -1
  101. package/dist/knowledge/workflow-guidance.d.ts +7 -3
  102. package/dist/knowledge/workflow-guidance.js +1 -1
  103. package/dist/monitor/MonitorLoop.js +1 -1
  104. package/dist/monitor/normalize.d.ts +1 -1
  105. package/dist/monitor/normalize.js +1 -1
  106. package/dist/monitor/types.d.ts +1 -1
  107. package/dist/monitor/types.js +1 -1
  108. package/dist/participation/radar-core.d.ts +1 -1
  109. package/dist/playbooks/service-build/business-puzzle.js +1 -1
  110. package/dist/playbooks/service-build/game-theory.d.ts +1 -0
  111. package/dist/playbooks/service-build/game-theory.js +1 -1
  112. package/dist/playbooks/service-build/intent-analyzer.js +1 -1
  113. package/dist/playbooks/service-build/machine-panorama.js +1 -1
  114. package/dist/playbooks/service-build/merchant-guide.d.ts +8 -0
  115. package/dist/playbooks/service-build/merchant-guide.js +1 -1
  116. package/dist/playbooks/service-build/object-panorama.d.ts +28 -1
  117. package/dist/playbooks/service-build/object-panorama.js +1 -1
  118. package/dist/playbooks/service-build/participation-radar.d.ts +2 -0
  119. package/dist/playbooks/service-build/participation-radar.js +1 -1
  120. package/dist/playbooks/service-build/relationship-profile.js +1 -1
  121. package/dist/playbooks/service-build/reverse-mapping-nk4.spec.js +1 -1
  122. package/dist/playbooks/service-build/reverse-mapping.js +1 -1
  123. package/dist/playbooks/service-build/service-panorama.js +1 -1
  124. package/dist/playbooks/service-build/service-quote.js +1 -1
  125. package/dist/playbooks/service-build/service-quote.spec.js +1 -1
  126. package/dist/relationship/registry.js +1 -1
  127. package/dist/review/index.js +1 -1
  128. package/dist/role/profiles.js +1 -1
  129. package/dist/safety/confirm-gate.js +1 -1
  130. package/dist/safety/preview.d.ts +1 -0
  131. package/dist/safety/preview.js +1 -1
  132. package/dist/schema/benchmark-migration/index.d.ts +19 -1
  133. package/dist/schema/benchmark-migration/index.js +1 -1
  134. package/dist/schema/call/allocation.d.ts +1 -1
  135. package/dist/schema/call/arbitration.d.ts +8 -8
  136. package/dist/schema/call/arbitration.js +1 -1
  137. package/dist/schema/call/base.d.ts +52 -5
  138. package/dist/schema/call/base.js +1 -1
  139. package/dist/schema/call/bridge.d.ts +3 -0
  140. package/dist/schema/call/contact.d.ts +5 -5
  141. package/dist/schema/call/demand.d.ts +5 -5
  142. package/dist/schema/call/error-codes.d.ts +1 -1
  143. package/dist/schema/call/error-codes.js +1 -1
  144. package/dist/schema/call/guard.d.ts +3 -3
  145. package/dist/schema/call/guard.js +1 -1
  146. package/dist/schema/call/handler.js +1 -1
  147. package/dist/schema/call/machine.d.ts +13 -5
  148. package/dist/schema/call/machine.js +1 -1
  149. package/dist/schema/call/order.d.ts +5 -5
  150. package/dist/schema/call/order.js +1 -1
  151. package/dist/schema/call/permission.d.ts +5 -5
  152. package/dist/schema/call/personal.d.ts +4 -4
  153. package/dist/schema/call/progress.d.ts +5 -5
  154. package/dist/schema/call/progress.js +1 -1
  155. package/dist/schema/call/proof.js +1 -1
  156. package/dist/schema/call/receipt.d.ts +8 -0
  157. package/dist/schema/call/receipt.js +1 -1
  158. package/dist/schema/call/repository.d.ts +9 -9
  159. package/dist/schema/call/repository.js +1 -1
  160. package/dist/schema/call/reward.d.ts +25 -5
  161. package/dist/schema/call/reward.js +1 -1
  162. package/dist/schema/call/semantic.js +1 -1
  163. package/dist/schema/call/service.d.ts +10 -5
  164. package/dist/schema/call/service.js +1 -1
  165. package/dist/schema/call/treasury.d.ts +5 -5
  166. package/dist/schema/common/index.d.ts +6 -6
  167. package/dist/schema/common/index.js +1 -1
  168. package/dist/schema/goal/index.d.ts +17 -1
  169. package/dist/schema/goal/planning.d.ts +28 -2
  170. package/dist/schema/goal/planning.js +1 -1
  171. package/dist/schema/industry-pack/index.d.ts +3 -0
  172. package/dist/schema/industry-pack/index.js +1 -1
  173. package/dist/schema/intent-radar/index.d.ts +9 -0
  174. package/dist/schema/intent-radar/index.js +1 -1
  175. package/dist/schema/local/index.d.ts +31 -0
  176. package/dist/schema/local/index.js +1 -1
  177. package/dist/schema/messenger/index.js +1 -1
  178. package/dist/schema/operations.d.ts +57 -43
  179. package/dist/schema/operations.js +1 -1
  180. package/dist/schema/query/bi.d.ts +22 -6
  181. package/dist/schema/query/bi.js +1 -1
  182. package/dist/schema/query/index.d.ts +164 -102
  183. package/dist/schema/query/index.js +1 -1
  184. package/dist/schema/schema-query/index.d.ts +2 -0
  185. package/dist/schema/schema-query/index.js +1 -1
  186. package/dist/schema/schema-version.js +1 -1
  187. package/dist/schema/utils/permission-machine-check.d.ts +2 -0
  188. package/dist/schema/utils/permission-machine-check.js +1 -1
  189. package/dist/schema/workflow/index.d.ts +1 -1
  190. package/dist/schema-query-impl/index.d.ts +1 -1
  191. package/dist/schema-query-impl/index.js +1 -1
  192. package/dist/schemas/account_operation.output.json +3 -0
  193. package/dist/schemas/account_operation.schema.json +4 -4
  194. package/dist/schemas/benchmark_migration_operation.output.json +42 -0
  195. package/dist/schemas/benchmark_migration_operation.schema.json +40 -3
  196. package/dist/schemas/bridge_operation.output.json +3 -0
  197. package/dist/schemas/goal_operation.schema.json +52 -2
  198. package/dist/schemas/index.json +1 -1
  199. package/dist/schemas/industry_pack_operation.output.json +8 -0
  200. package/dist/schemas/industry_pack_operation.schema.json +9 -0
  201. package/dist/schemas/intent_radar.output.json +8 -2
  202. package/dist/schemas/intent_radar.schema.json +4 -1
  203. package/dist/schemas/local_cache_operation.output.json +3 -0
  204. package/dist/schemas/local_history_operation.output.json +3 -0
  205. package/dist/schemas/local_info_operation.output.json +3 -0
  206. package/dist/schemas/local_mark_operation.output.json +3 -0
  207. package/dist/schemas/messenger_operation.schema.json +4 -4
  208. package/dist/schemas/monitor_events.schema.json +3 -1
  209. package/dist/schemas/onchain_events.output.json +275 -11
  210. package/dist/schemas/onchain_events.schema.json +25 -1
  211. package/dist/schemas/onchain_operations.output.json +47 -5
  212. package/dist/schemas/onchain_operations.schema.json +664 -179
  213. package/dist/schemas/onchain_operations_allocation.schema.json +7 -7
  214. package/dist/schemas/onchain_operations_arbitration.schema.json +21 -15
  215. package/dist/schemas/onchain_operations_contact.schema.json +15 -10
  216. package/dist/schemas/onchain_operations_demand.schema.json +15 -10
  217. package/dist/schemas/onchain_operations_gen_passport.schema.json +5 -5
  218. package/dist/schemas/onchain_operations_gen_proof.schema.json +1 -1
  219. package/dist/schemas/onchain_operations_guard.schema.json +346 -8
  220. package/dist/schemas/onchain_operations_machine.schema.json +24 -11
  221. package/dist/schemas/onchain_operations_order.schema.json +17 -12
  222. package/dist/schemas/onchain_operations_permission.schema.json +10 -5
  223. package/dist/schemas/onchain_operations_personal.schema.json +2 -2
  224. package/dist/schemas/onchain_operations_progress.schema.json +17 -12
  225. package/dist/schemas/onchain_operations_proof.schema.json +6 -6
  226. package/dist/schemas/onchain_operations_repository.schema.json +19 -14
  227. package/dist/schemas/onchain_operations_reward.schema.json +96 -15
  228. package/dist/schemas/onchain_operations_service.schema.json +33 -21
  229. package/dist/schemas/onchain_operations_treasury.schema.json +15 -10
  230. package/dist/schemas/onchain_table_data.output.json +7 -7
  231. package/dist/schemas/query_toolkit.output.json +268 -44
  232. package/dist/schemas/query_toolkit.schema.json +1 -1
  233. package/dist/schemas/schema_query.schema.json +7 -2
  234. package/dist/schemas/workflow_operation.schema.json +5 -5
  235. package/dist/schemas/wowok_buildin_info.output.json +140 -3
  236. package/dist/schemas/wowok_buildin_info.schema.json +2 -2
  237. package/dist/tools/handlers/benchmark-migration.d.ts +66 -1
  238. package/dist/tools/handlers/benchmark-migration.js +1 -1
  239. package/dist/tools/handlers/config.js +1 -1
  240. package/dist/tools/handlers/dispatch-expectations.d.ts +0 -1
  241. package/dist/tools/handlers/dispatch-expectations.js +1 -1
  242. package/dist/tools/handlers/industry-pack.js +1 -1
  243. package/dist/tools/handlers/intent-radar.js +1 -1
  244. package/dist/tools/handlers/keeper.d.ts +1 -1
  245. package/dist/tools/handlers/local.js +1 -1
  246. package/dist/tools/handlers/onchain.d.ts +12 -0
  247. package/dist/tools/handlers/onchain.js +1 -1
  248. package/dist/tools/handlers/query.d.ts +1 -0
  249. package/dist/tools/handlers/query.js +1 -1
  250. package/dist/tools/handlers/review-chain.js +1 -1
  251. package/dist/tools/handlers/schema-query.js +1 -1
  252. package/dist/tools/handlers/workflow.js +1 -1
  253. package/dist/tools/index.js +1 -1
  254. package/dist/tools/move-fn-index.gen.js +1 -1
  255. package/dist/tools/registry/agent.js +1 -1
  256. package/dist/tools/registry/business.js +1 -1
  257. package/dist/tools/registry/files.js +1 -1
  258. package/dist/tools/registry/query.js +1 -1
  259. package/dist/tools/rules-hook.js +1 -1
  260. package/dist/tools/upgrade-check.d.ts +23 -0
  261. package/dist/tools/upgrade-check.js +1 -1
  262. package/dist/tools/wip-deploy-assist.d.ts +6 -0
  263. package/dist/tools/wip-deploy-assist.js +1 -1
  264. package/dist/tools/wrap.js +1 -1
  265. package/package.json +2 -2
@@ -1 +1 @@
1
- export const GUARD_FIELD_COGNITION_VERSION='1.1.0';const NUMBER='number\x20(numeric\x20value\x20type)',U64='u64\x20exactly\x20(common::TYPE_U64)',ADDRESS='address\x20or\x20address-compatible\x20object\x20id';export const GUARD_FIELD_SITES=[{'object':'Treasury','field':'external_withdraw_guard[]\x20(AmountFromWithdrawGuard)','mode':'gate+source','extraction':[{'name':'identifier\x20(amount)','meaning':'Exact\x20withdraw\x20amount\x20moved\x20out\x20of\x20the\x20treasury\x20balance','allowedOrigins':['submission','fixed'],'typeConstraint':NUMBER,'configCheck':'configuring\x20the\x20external-withdraw\x20guard:\x20the\x20amount\x20slot\x20must\x20carry\x20a\x20declared\x20submission\x20value\x20type\x20and\x20it\x20must\x20be\x20numeric\x20(E_IDENTIFIER_NOT_NUMBER_TYPE)','runtimeFallback':'falls\x20back\x20to\x20the\x20fixed\x20table\x20value\x20when\x20no\x20submission\x20is\x20supplied;\x20if\x20neither\x20exists\x20the\x20tx\x20aborts\x20(E_SUBMISSION_ID_NOT_FOUND)','riskNotes':['submission\x20origin\x20=\x20passport\x20builder\x20chooses\x20the\x20amount;\x20only\x20the\x20balance\x20check\x20(E_WITHDRAW_BALANCE_INSUFFICIENT)\x20bounds\x20it','fixed\x20origin\x20=\x20same\x20amount\x20every\x20withdrawal;\x20safe\x20default\x20for\x20allowance-style\x20guards','query\x20origin\x20is\x20impossible\x20for\x20this\x20slot\x20—\x20a\x20query\x20can\x20only\x20gate,\x20never\x20supply\x20the\x20amount']},{'name':'store_from_id\x20(optional)','meaning':'Secondary\x20slot\x20decoded\x20as\x20address;\x20recorded\x20in\x20Treasury\x20history\x20Record\x20for\x20traceability','allowedOrigins':['submission','fixed'],'typeConstraint':ADDRESS,'configCheck':'address-compatibility\x20check\x20on\x20the\x20recorded\x20slot\x20(E_STORE_FROM_ID_NOT_COMPATIBLE)','runtimeFallback':'None\x20->\x20Record.store_from_id\x20=\x20none','riskNotes':['Bookkeeping\x20only;\x20never\x20used\x20as\x20the\x20withdrawal\x20recipient']}],'gateBehavior':'the\x20passport\x20verification\x20against\x20this\x20guard\x20must\x20pass\x20AND\x20the\x20guard\x20address\x20must\x20be\x20registered\x20in\x20the\x20external-withdraw\x20guard\x20list\x20(E_EXTERNAL_WITHDRAW_GUARD_NOT_FOUND)','setterChecklist':['Decide\x20who\x20builds\x20passports\x20against\x20this\x20guard\x20—\x20that\x20party\x20controls\x20a\x20submission-origin\x20amount','Prefer\x20a\x20fixed\x20amount\x20for\x20allowance\x20guards;\x20reserve\x20submission\x20amounts\x20for\x20flows\x20where\x20the\x20passport\x20builder\x20is\x20trusted\x20or\x20the\x20amount\x20is\x20re-verified\x20inside\x20the\x20guard\x20expression\x20(e.g.\x20compare\x20against\x20order.amount\x20via\x20query\x201561)','The\x20RECIPIENT\x20is\x20tx-supplied,\x20not\x20from\x20the\x20guard\x20—\x20constrain\x20it\x20inside\x20the\x20guard\x20expression\x20(e.g.\x20compare\x20a\x20submitted\x20address\x20against\x20an\x20expected\x20one)\x20if\x20destination\x20matters','Check\x20the\x20guard\x27s\x20dependency-eligibility\x20status\x20only\x20matters\x20if\x20this\x20guard\x20will\x20rely\x20on\x20others\x20(relies\x20<=\x204,\x20added\x20first)'],'auditorChecklist':['For\x20each\x20registered\x20guard:\x20classify\x20amount\x20slot\x20as\x20fixed\x20or\x20submission\x20(read\x20b_submission\x20in\x20the\x20table)','If\x20submission:\x20who\x20can\x20hold/build\x20a\x20passport\x20with\x20this\x20guard?\x20Can\x20a\x20stranger\x20drain\x20the\x20treasury\x20up\x20to\x20its\x20balance?','Does\x20the\x20guard\x20expression\x20bind\x20the\x20submission\x20to\x20on-chain\x20state\x20(order,\x20repository\x20data)\x20or\x20is\x20it\x20free-form?','Is\x20the\x20withdrawal\x20recipient\x20constrained\x20anywhere?']},{'object':'Treasury','field':'external_deposit_guard[]\x20(AmountFromDepositGuard)','mode':'gate+source','extraction':[{'name':'identifier\x20(amount,\x20Option)','meaning':'When\x20Some:\x20exact\x20deposit\x20amount\x20split\x20from\x20the\x20coin\x20(remainder\x20returned\x20to\x20caller).\x20When\x20None:\x20whole\x20coin\x20deposited','allowedOrigins':['submission','fixed'],'typeConstraint':NUMBER,'configCheck':'same\x20as\x20withdraw:\x20value\x20type\x20must\x20be\x20numeric\x20when\x20Some','runtimeFallback':'None\x20->\x20entire\x20coin\x20deposited;\x20Some\x20->\x20coin::split\x20to\x20`value`,\x20remainder\x20transferred\x20back\x20to\x20sender','riskNotes':['A\x20submission-origin\x20amount\x20below\x20the\x20coin\x20total\x20silently\x20returns\x20the\x20difference\x20to\x20the\x20caller\x20—\x20intended\x20for\x20partial\x20deposits','Deposits\x20cannot\x20steal\x20funds;\x20the\x20risk\x20direction\x20is\x20mis-recorded\x20history\x20only']},{'name':'store_from_id\x20(optional)','meaning':'Address\x20slot\x20recorded\x20on\x20the\x20deposit\x20Record','allowedOrigins':['submission','fixed'],'typeConstraint':ADDRESS,'configCheck':'address-compatibility\x20check','runtimeFallback':'None\x20->\x20none','riskNotes':['Traceability\x20only']}],'gateBehavior':'passport\x20verification\x20against\x20the\x20guard\x20must\x20pass\x20+\x20guard\x20must\x20be\x20registered\x20(E_EXTERNAL_DEPOSIT_GUARD_NOT_FOUND)','setterChecklist':['None\x20identifier\x20=\x20whole-coin\x20deposit;\x20Some\x20=\x20exact-amount\x20deposit\x20with\x20refund\x20of\x20the\x20remainder'],'auditorChecklist':['Confirm\x20the\x20amount\x20slot\x20origin\x20matches\x20the\x20intended\x20deposit\x20UX\x20(whole\x20vs\x20exact)']},{'object':'Reward','field':'guards[]\x20(RewardGuard)','mode':'gate+source','extraction':[{'name':'recipient\x20(Recipient::GuardIdentifier)','meaning':'Claim\x20payout\x20destination\x20address','allowedOrigins':['submission','fixed'],'typeConstraint':ADDRESS,'configCheck':'recipient\x20must\x20be\x20a\x20valid\x20address\x20(E_RECIPIENT_IDENTIFIER_NOT_ADDRESS)','runtimeFallback':'Entity/Signer\x20variants\x20bypass\x20extraction\x20entirely','riskNotes':['submission\x20origin\x20=\x20passport\x20builder\x20redirects\x20the\x20payout\x20to\x20any\x20address\x20it\x20names']},{'name':'amount\x20(Amount::GuardU64Identifier)','meaning':'Claim\x20size\x20paid\x20from\x20the\x20Reward\x20balance','allowedOrigins':['submission','fixed'],'typeConstraint':U64,'configCheck':'submission\x20value\x20type\x20must\x20be\x20u64\x20(E_AMOUNT_NOT_U64)','runtimeFallback':'Fixed(u64)\x20variant\x20bypasses\x20extraction','riskNotes':['submission\x20origin\x20=\x20passport\x20builder\x20decides\x20the\x20claim\x20size;\x20only\x20balance\x20and\x20per-recipient\x20record\x20bound\x20it']},{'name':'store_from_id\x20(optional)','meaning':'Address\x20slot\x20recorded\x20in\x20the\x20per-recipient\x20claim\x20Record','allowedOrigins':['submission','fixed'],'typeConstraint':ADDRESS,'configCheck':'address-compatibility\x20check\x20(E_STORE_FROM_ID_NOT_COMPATIBLE)','runtimeFallback':'None\x20->\x20none\x20(an\x20unstamped\x20record\x20matches\x20NO\x20store_from_id\x20predicate\x20—\x20pin\x20the\x20slot\x20for\x20any\x20per-order\x20replay\x20gate)','riskNotes':['Traceability\x20+\x20replay\x20gate:\x20without\x20a\x20pinned\x20slot\x20a\x20per-order\x20dedup\x20leg\x20cannot\x20bind\x20to\x20a\x20real\x20order\x20id\x20—\x20pin\x20store_from_id\x20for\x20per-order\x20replay\x20protection;\x20slot-less\x20guards\x20can\x20only\x20dedup\x20lifetime-once\x20via\x20record\x20count/exists\x20with\x20an\x20empty\x20where']}],'gateBehavior':'claim:\x20passport\x20verification\x20against\x20the\x20guard\x20must\x20pass\x20+\x20expiration_time\x20check\x20+\x20guard\x20registered\x20(E_GUARD_NOT_FOUND);\x20guard_not_added_expiration_time\x20freezes\x20the\x20guard\x20set','setterChecklist':['Recipient+amount\x20both\x20submission\x20=\x20the\x20passport\x20builder\x20fully\x20controls\x20who\x20gets\x20paid\x20how\x20much\x20—\x20acceptable\x20only\x20for\x20self-service\x20claim\x20flows\x20where\x20the\x20builder\x20IS\x20the\x20beneficiary','expiration_time\x20on\x20the\x20RewardGuard\x20bounds\x20the\x20window\x20(E_GUARD_EXPIRED)'],'auditorChecklist':['For\x20each\x20guard:\x20are\x20recipient/amount\x20fixed\x20or\x20submission?','If\x20submission:\x20does\x20the\x20guard\x20expression\x20bind\x20them\x20to\x20repository\x20data\x20(1167)\x20or\x20an\x20order\x20so\x20the\x20claim\x20is\x20justified?','Is\x20there\x20a\x20per-recipient\x20cap?\x20(Only\x20the\x20historical\x20record\x20total\x20accumulates;\x20there\x20is\x20no\x20per-claim\x20limit.)']},{'object':'Repository','field':'policies[].write_guard[]\x20(PolicyGuard)','mode':'gate+source','extraction':[{'name':'id_from_submission\x20(Option<u8>)','meaning':'Data-record\x20key\x20(address)\x20extracted\x20from\x20the\x20guard\x20instead\x20of\x20caller-supplied','allowedOrigins':['submission','fixed'],'typeConstraint':ADDRESS,'configCheck':'address-compatibility\x20check\x20(E_INVALID_ID_IN_GUARD_TABLE)','runtimeFallback':'None\x20->\x20id\x20comes\x20from\x20the\x20caller\x20vector\x20or\x20is\x20auto-generated\x20(clock/signer)','riskNotes':['Policy-level\x20conflicts:\x20id_from\x20=\x20Clock/Signer\x20FORBIDS\x20id_from_submission\x20(E_POLICY_ID_FROM_SUBMISSION_FORBIDDEN);\x20id_from\x20=\x20None\x20REQUIRES\x20a\x20non-empty\x20write_guard\x20(E_POLICY_WRITE_GUARD_REQUIRED)']},{'name':'data_from_submission\x20(Option<u8>)','meaning':'Data\x20payload\x20extracted\x20from\x20the\x20guard\x20instead\x20of\x20caller-supplied','allowedOrigins':['submission','fixed'],'typeConstraint':'any\x20repository-supported\x20value\x20type\x20(first\x20byte\x20=\x20value_type)','configCheck':'identifier\x20presence\x20check\x20(E_INVALID_DATA_IN_GUARD_TABLE)','runtimeFallback':'None\x20->\x20data\x20comes\x20from\x20the\x20caller\x20vector','riskNotes':['Entry-point\x20routing\x20differs:\x20the\x20guarded\x20auto-id\x20write\x20consumes\x20data_from_submission;\x20the\x20guarded\x20manual\x20write\x20REJECTS\x20both\x20extraction\x20slots\x20(E_GUARD_SPECIFIED_ID_FROM_SUBMISSION);\x20the\x20mixed\x20guarded\x20write\x20mixes\x20per-guard\x20extraction\x20with\x20caller\x20vectors','Setting\x20an\x20extraction\x20slot\x20on\x20a\x20guard\x20that\x20is\x20only\x20ever\x20used\x20via\x20the\x20guarded\x20manual\x20write\x20silently\x20means\x20\x27unused\x20config\x27\x20—\x20route\x20must\x20match']}],'gateBehavior':'write\x20path\x20must\x20find\x20the\x20guard\x20in\x20the\x20policy\x20(E_GUARD_SPECIFIED_NOT_IN_POLICY)\x20and\x20pass\x20the\x20passport\x20verification\x20or\x20the\x20permission-based\x20verification\x20(impack\x20membership)','setterChecklist':['Match\x20the\x20policy\x20id_from\x20with\x20the\x20guard\x20slots\x20(see\x20conflicts\x20above)','Pick\x20the\x20write\x20entry\x20point\x20first,\x20then\x20decide\x20which\x20extraction\x20slots\x20that\x20entry\x20point\x20actually\x20honors'],'auditorChecklist':['For\x20each\x20write_guard:\x20which\x20entry\x20points\x20can\x20reach\x20it\x20and\x20which\x20slots\x20do\x20those\x20entry\x20points\x20consume?','A\x20policy\x20with\x20write_guard\x20but\x20id_from=None\x20and\x20no\x20extraction\x20slots\x20still\x20gates\x20writes\x20—\x20verify\x20the\x20guard\x20expression\x20actually\x20restricts\x20who\x20can\x20write']},{'object':'Repository','field':'policies[].quote_guard\x20(Option<address>)','mode':'source','extraction':[{'name':'repository.data\x20(query\x201167\x20params:\x20key,\x20id)','meaning':'Read\x20authorization\x20for\x20private\x20repository\x20data\x20inside\x20guard\x20expressions','allowedOrigins':['query'],'typeConstraint':'(String\x20key,\x20Address\x20id)\x20pair','configCheck':'setting\x20the\x20policy\x20quote\x20guard:\x20the\x20guard\x20must\x20be\x20dependency-eligible\x20(relies\x20empty\x20+\x20immutable\x20+\x20rep\x20true,\x20E_NEED_DEPENDENT_GUARD)','runtimeFallback':'None\x20->\x201167\x20queries\x20abort\x20(GUARD_QUERY_OBJECT_INVALID\x20/\x20quote_guard\x20check)','riskNotes':['Runtime\x20check\x20is\x20hardcoded\x20in\x20passport.rs:\x20the\x20querying\x20guard\x20must\x20be\x20a\x20member\x20of\x20the\x20passport\x20impack\x20list','rep\x20flag\x20comes\x20from\x20the\x20native\x20parse\x20at\x20guard\x20creation\x20—\x20a\x20guard\x20that\x20fails\x20rep\x20cannot\x20serve\x20as\x20quote_guard']}],'gateBehavior':'No\x20direct\x20gate\x20—\x20this\x20guard\x20authorizes\x20DATA\x20READS\x20performed\x20by\x20other\x20guards','setterChecklist':['Only\x20a\x20fresh,\x20immutable,\x20reliance-free\x20guard\x20(meets\x20the\x20dependency-eligibility\x20shape)\x20qualifies','Register\x20it\x20on\x20the\x20same\x20Repository\x20whose\x20data\x20will\x20be\x20quoted'],'auditorChecklist':['Which\x20guards\x20rely\x20on\x20/\x20are\x20bundled\x20with\x20this\x20quote_guard\x20in\x20passports?\x20(impack\x20membership\x20decides)','Is\x20the\x20quoted\x20(key,id)\x20scoped\x20narrowly\x20enough,\x20or\x20does\x20one\x20quote_guard\x20open\x20the\x20whole\x20policy?']},{'object':'Arbitration','field':'voting_guard[]\x20(VotingGuard)','mode':'gate+source','extraction':[{'name':'vote_weight\x20(VoteValue::GuardIdentifier)','meaning':'Voter\x27s\x20weighted\x20voting\x20power','allowedOrigins':['submission','fixed'],'typeConstraint':NUMBER+',\x20value\x20<=\x20u32\x20max\x20(E_GUARD_IDENTIFIER_NUMBER_INVALID)','configCheck':'value\x20type\x20must\x20be\x20numeric\x20(E_GUARD_IDENTIFIER_NOT_NUMBER)','runtimeFallback':'FixedValue\x20variant\x20bypasses\x20extraction','riskNotes':['submission\x20origin\x20=\x20the\x20passport\x20builder\x20assigns\x20its\x20own\x20voting\x20weight\x20—\x20dangerous\x20unless\x20the\x20guard\x20expression\x20derives\x20the\x20weight\x20from\x20trusted\x20state\x20(e.g.\x20repository\x20holdings\x20via\x201167)']}],'gateBehavior':'voting\x20through\x20the\x20voting\x20guard:\x20passport\x20verification\x20must\x20pass\x20+\x20guard\x20registered\x20(E_VOTING_GUARD_NOT_FOUND)','setterChecklist':['Empty\x20voting_guard\x20=\x20open\x20voting\x20(everybody);\x20non-empty\x20=\x20only\x20listed\x20guards\x20may\x20vote','FixedValue\x20for\x20equal-weight\x20votes;\x20GuardIdentifier\x20only\x20when\x20the\x20expression\x20can\x20justify\x20the\x20weight'],'auditorChecklist':['If\x20GuardIdentifier:\x20can\x20a\x20voter\x20self-assign\x20a\x20maximal\x20weight\x20by\x20building\x20the\x20passport\x20alone?']},{'object':'Arbitration','field':'usage_guard\x20(Option<address>)','mode':'gate','extraction':[],'gateBehavior':'passport-guarded\x20dispute\x20filing:\x20the\x20passport\x20verification\x20must\x20pass;\x20dispute()\x20without\x20a\x20passport\x20aborts\x20when\x20usage_guard\x20is\x20set\x20(E_NEED_PASSPORT).\x20Set\x20=\x20guarded\x20entry\x20to\x20filing\x20disputes','setterChecklist':['Set\x20to\x20restrict\x20who\x20can\x20open\x20disputes;\x20none\x20=\x20anyone\x20can\x20dispute'],'auditorChecklist':['Check\x20whether\x20disputing\x20requires\x20passing\x20this\x20guard\x20and\x20who\x20can\x20pass\x20it']},{'object':'Service','field':'buy_guard\x20(Option<address>)','mode':'gate','extraction':[],'gateBehavior':'passport-guarded\x20purchase:\x20the\x20passport\x20verification\x20must\x20pass;\x20buy()\x20without\x20a\x20passport\x20aborts\x20when\x20set\x20(E_BUY_GUARD_PASSPORT_REQUIRED)','setterChecklist':['Pure\x20purchase\x20gate:\x20membership/whitelist/KYC\x20style;\x20no\x20slots\x20are\x20extracted'],'auditorChecklist':['Who\x20can\x20pass\x20it;\x20does\x20it\x20gate\x20every\x20sale\x20item\x20equally\x20(it\x20is\x20service-wide,\x20not\x20per-sale)']},{'object':'Demand','field':'guards[]\x20(ServiceGuard)','mode':'gate+source','extraction':[{'name':'service_identifier\x20(Option<u8>)','meaning':'Presented\x20Service\x20address;\x20overrides\x20the\x20caller-supplied\x20service\x20when\x20presenting','allowedOrigins':['submission','fixed'],'typeConstraint':'address\x20slot\x20whose\x20object\x20type\x20must\x20be\x20Service\x20(submission\x20object\x20type\x20validated\x20at\x20guard_add)','configCheck':'object\x20type\x20check\x20against\x20the\x20guard\x20validated\x20table\x20(E_GUARD_IDS_TYPE_ERROR\x20at\x20verify)','runtimeFallback':'None\x20->\x20caller\x20names\x20the\x20presented\x20service\x20directly','riskNotes':['fixed\x20origin\x20hard-pins\x20which\x20Service\x20may\x20answer\x20this\x20Demand\x20through\x20this\x20guard','submission\x20origin\x20lets\x20the\x20passport\x20builder\x20pick\x20any\x20Service\x20—\x20verify\x20the\x20guard\x20expression\x20restricts\x20it']}],'gateBehavior':'presenting\x20with\x20a\x20passport:\x20passport\x20verification\x20must\x20pass\x20+\x20guard\x20registered\x20(E_GUARD_NOT_FOUND)','setterChecklist':['Set\x20service_identifier\x20to\x20pin\x20the\x20answering\x20service;\x20leave\x20None\x20for\x20open\x20presentation'],'auditorChecklist':['Origin\x20of\x20service_identifier;\x20if\x20submission,\x20who\x20can\x20present\x20what']},{'object':'Machine','field':'node.pair.forward.guard\x20(ForwardGuard)','mode':'gate+source','extraction':[{'name':'retained_submission\x20(vector<u8>\x20identifiers)','meaning':'Submission\x20values\x20retained\x20into\x20Progress\x20Holder.retained_submission\x20(e.g.\x20sub-order\x20/\x20procured-service\x20evidence)\x20when\x20the\x20forward\x20executes','allowedOrigins':['submission'],'typeConstraint':'identifiers\x20must\x20exist\x20as\x20submission\x20slots\x20(existence\x20check,\x20E_RETAINED_SUBMISSION_ERROR)','configCheck':'configuring\x20the\x20guarded\x20forward\x20validates\x20the\x20identifiers\x20against\x20the\x20guard\x20table','runtimeFallback':'empty\x20list\x20->\x20gate\x20only,\x20nothing\x20retained;\x20non-empty\x20->\x20the\x20submitted\x20values\x20are\x20copied\x20into\x20the\x20session\x20history','riskNotes':['This\x20is\x20the\x20mechanism\x20that\x20carries\x20sub-order\x20data\x20from\x20an\x20operator\x27s\x20passport\x20into\x20the\x20order\x27s\x20Progress\x20history\x20—\x20downstream\x20analyzers\x20read\x20it\x20(queries\x201266-1268,\x201279)']}],'gateBehavior':'progress\x20node\x20advancement\x20with\x20a\x20passport:\x20guard\x20is\x20the\x20optional\x20pre/post\x20verification\x20layer\x20for\x20advancing\x20a\x20node;\x20namedOperator/permissionIndex\x20can\x20be\x20replaced\x20by\x20a\x20guard','setterChecklist':['Choose\x20which\x20submission\x20slots\x20are\x20worth\x20retaining\x20as\x20durable\x20evidence','Remember\x20the\x20order\x20of\x20verification:\x20dependent\x20guards\x20must\x20be\x20added\x20to\x20the\x20passport\x20first'],'auditorChecklist':['For\x20each\x20guarded\x20forward:\x20does\x20the\x20retained\x20data\x20actually\x20prove\x20the\x20transition\x20claim\x20(sub-order\x20id,\x20amount)?']},{'object':'Allocation','field':'allocators[].guard\x20(Allocator)','mode':'gate+source','extraction':[{'name':'sharing\x20Recipient::GuardIdentifier','meaning':'Payout\x20recipient\x20address\x20for\x20that\x20sharing\x20line','allowedOrigins':['submission','fixed'],'typeConstraint':ADDRESS,'configCheck':'recipient\x20must\x20be\x20a\x20valid\x20address\x20(ERECIPIENT_IDENTIFIER_NOT_ADDRESS)','runtimeFallback':'Entity/Signer\x20sharing\x20variants\x20bypass\x20extraction','riskNotes':['submission\x20origin\x20=\x20the\x20passport\x20builder\x20decides\x20the\x20split\x20destination\x20at\x20alloc()\x20time\x20—\x20the\x20ALC1\x20audit\x20treats\x20an\x20unbound\x20recipient\x20as\x20a\x20redirect\x20risk','for_object\x20anchor\x20(protocol\x20139):\x20when\x20the\x20Allocation\x27s\x20payment_info.for_object\x20is\x20Some,\x20alloc()\x20enforces\x20submitted\x20address\x20==\x20for_object\x20and\x20aborts\x20with\x20ERECIPIENT_NOT_FOR_OBJECT\x20(15)\x20on\x20mismatch\x20—\x20the\x20anchor\x20is\x20mechanism-enforced,\x20not\x20advisory','for_object\x20=\x20None\x20carries\x20NO\x20anchor:\x20nothing\x20is\x20enforced\x20on-chain\x20and\x20the\x20recipient\x20semantics\x20are\x20entirely\x20the\x20creator\x27s\x20business\x20(Allocation\x20is\x20a\x20generic\x20component;\x20only\x20host\x20flows\x20that\x20declare\x20a\x20binding\x20get\x20the\x20anchor)']}],'gateBehavior':'alloc:\x20the\x20passed\x20guard\x20address\x20must\x20equal\x20the\x20registered\x20allocator\x20guard;\x20the\x20passport\x20verification\x20must\x20pass;\x20AllocationEvent\x20records\x20which\x20guard\x20ran','setterChecklist':['Bind\x20recipient\x20slots\x20inside\x20the\x20guard\x20expression\x20(signer\x20==\x20authorized\x20party,\x20state\x20==\x20expected\x20scope)\x20exactly\x20as\x20ALC1\x20expects','A\x20submission\x20slot\x20with\x20NO\x20scope\x20binding\x20=\x20HIGH\x20severity\x20finding','When\x20setting\x20payment_info:\x20for_object\x20=\x20Some\x20turns\x20it\x20into\x20an\x20enforced\x20anchor\x20—\x20every\x20GuardIdentifier\x20recipient\x20submission\x20must\x20equal\x20that\x20address\x20or\x20alloc()\x20aborts\x20(code\x2015);\x20verify\x20the\x20anchor\x20matches\x20the\x20intended\x20recipient\x20flow\x20BEFORE\x20create\x20(payment_info\x20is\x20immutable\x20after\x20create)','for_object\x20=\x20None\x20is\x20legal:\x20no\x20on-chain\x20anchor,\x20recipient\x20routing\x20is\x20then\x20purely\x20the\x20creator\x27s\x20design\x20—\x20flag\x20this\x20explicitly\x20in\x20the\x20plan\x20so\x20the\x20user\x20decides'],'auditorChecklist':['Cross-scenario\x20settlement\x20residual:\x20a\x20guard\x20bound\x20to\x20one\x20host\x20but\x20reusable\x20across\x20unrelated\x20callers\x20of\x20other\x20hosts','Every\x20submission\x20recipient\x20slot\x20must\x20have\x20a\x20scope\x20binding\x20(guard\x20expression\x20or\x20payment_info.for_object\x20anchor)\x20—\x20otherwise\x20funds\x20can\x20be\x20redirected','Check\x20payment_info.for_object:\x20Some\x20=\x20confirmed\x20enforced\x20anchor\x20(compare\x20against\x20intended\x20recipients);\x20None\x20=\x20trust-on-creator,\x20no\x20on-chain\x20enforcement\x20of\x20the\x20GuardIdentifier\x20destination']},{'object':'Payment','field':'info.for_guard\x20(PaymentInfo)','mode':'source','extraction':[{'name':'for_guard','meaning':'Provenance:\x20records\x20which\x20guard\x20context\x20produced\x20this\x20payment;\x20creates\x20an\x20object-linker\x20affiliation','allowedOrigins':['fixed'],'typeConstraint':'guard\x20address\x20(set\x20when\x20the\x20payment\x20info\x20is\x20created\x20with\x20a\x20guard\x20attached\x20—\x20the\x20payment_info_with_guard\x20variants)','configCheck':'n/a\x20—\x20plain\x20address\x20copy','runtimeFallback':'None\x20->\x20no\x20provenance','riskNotes':['Not\x20a\x20gate,\x20not\x20a\x20submission\x20slot\x20—\x20pure\x20traceability\x20(queries\x201057/1058,\x201108/1109)']}],'gateBehavior':'None','setterChecklist':['Attach\x20for_guard\x20when\x20the\x20payment\x20originates\x20from\x20a\x20guarded\x20flow'],'auditorChecklist':['Use\x20it\x20to\x20trace\x20payment\x20history\x20back\x20to\x20the\x20guarding\x20decision']},{'object':'Permission','field':'table\x20keys\x20(guard\x20addresses\x20as\x20permission\x20subjects)','mode':'gate','extraction':[],'gateBehavior':'A\x20guard\x20ADDRESS\x20can\x20be\x20granted\x20permission\x20indexes\x20like\x20a\x20user.\x20A\x20passport-asserted\x20operation\x20collects\x20the\x20passport\x20impack\x20guard\x20list\x20and\x20checks\x20permission\x20indexes\x20against\x20it:\x20a\x20passing\x20guard\x20can\x20therefore\x20carry\x20authorization\x20for\x20the\x20whole\x20transaction','setterChecklist':['Granting\x20an\x20index\x20to\x20a\x20guard\x20address\x20delegates\x20that\x20authority\x20to\x20anyone\x20who\x20can\x20pass\x20the\x20guard\x20—\x20treat\x20like\x20a\x20role\x20grant'],'auditorChecklist':['List\x20permission\x20subjects\x20that\x20are\x20guard\x20addresses;\x20evaluate\x20who\x20can\x20pass\x20those\x20guards\x20(they\x20inherit\x20the\x20permission)']}];export const VALUE_ORIGIN_SEMANTICS={'fixed':'Value\x20baked\x20into\x20the\x20guard\x20table\x20(b_submission=false).\x20Deterministic\x20on\x20every\x20use;\x20frozen\x20after\x20create;\x20used\x20as\x20the\x20fallback\x20when\x20no\x20submission\x20is\x20supplied.','submission':'Value\x20supplied\x20by\x20the\x20passport\x20builder\x20at\x20guard_add\x20time\x20(b_submission=true),\x20type-checked\x20against\x20the\x20table.\x20Whoever\x20builds\x20the\x20passport\x20controls\x20the\x20value\x20—\x20always\x20ask\x20who\x20that\x20is.','query':'Value\x20that\x20exists\x20only\x20inside\x20the\x20guard\x20input\x20expression\x20(native\x20query\x20opcodes\x201xxx).\x20It\x20constrains\x20verification\x20(state\x20coupling)\x20but\x20is\x20never\x20extractable;\x20extraction\x20slots\x20must\x20be\x20fixed\x20or\x20submission.'};export const GUARD_PASSPORT_DOCTRINE=['Slot\x20value\x20resolution\x20order:\x20passport\x20submission\x20value\x20->\x20fixed\x20guard\x20table\x20value\x20->\x20abort\x20(E_SUBMISSION_ID_NOT_FOUND).\x20A\x20slot\x20with\x20no\x20submission\x20and\x20no\x20fixed\x20value\x20aborts\x20the\x20host\x20call.','A\x20guard\x20only\x20participates\x20if\x20its\x20passport\x20verification\x20passes,\x20and\x20it\x20must\x20be\x20marked\x20impack\x20when\x20the\x20host\x20extracts\x20data\x20from\x20it\x20(result_for_permission\x20returns\x20impack\x20guards\x20only).','The\x20impack\x20list\x20is\x20snapshotted\x20before\x20verify()\x20runs;\x201167\x20quote_guard\x20membership\x20is\x20checked\x20against\x20this\x20snapshot\x20inside\x20the\x20native\x20verifier.','relies:\x20a\x20guard\x20may\x20depend\x20on\x20at\x20most\x204\x20other\x20guards\x20(MAX_DEPENDED_COUNT),\x20dependent\x20guards\x20must\x20be\x20added\x20to\x20the\x20passport\x20first,\x20and\x20the\x20combine\x20logic\x20is\x20relies_logic_and\x20(AND\x20default,\x20OR\x20optional).','Dependency\x20eligibility\x20of\x20a\x20guard\x20=\x20relies\x20empty\x20AND\x20immutable\x20AND\x20rep\x20—\x20the\x20only\x20shape\x20accepted\x20as\x20a\x20repository\x20quote_guard\x20or\x20as\x20a\x20relied-upon\x20guard.','Guards\x20are\x20frozen\x20on\x20create\x20(immutable=true);\x20changing\x20a\x20fixed\x20value\x20means\x20deploying\x20a\x20new\x20guard\x20and\x20re-registering\x20it\x20on\x20every\x20host\x20object.','Type\x20checks\x20happen\x20at\x20config\x20time\x20(submission\x20value\x20type\x20/\x20address\x20format\x20/\x20address\x20compatibility)\x20and\x20at\x20passport\x20build\x20time\x20(the\x20first\x20type\x20byte\x20of\x20each\x20submitted\x20value\x20is\x20compared\x20against\x20the\x20table);\x20runtime\x20aborts\x20are\x20the\x20last\x20resort.','Allocation\x20for_object\x20anchor\x20(protocol\x20139):\x20the\x20Allocation\x27s\x20payment_info.for_object,\x20when\x20Some,\x20is\x20enforced\x20inside\x20alloc()\x20—\x20every\x20Recipient::GuardIdentifier\x20submission\x20must\x20equal\x20that\x20address\x20(abort\x20ERECIPIENT_NOT_FOR_OBJECT\x2015).\x20When\x20None,\x20no\x20anchor\x20exists\x20and\x20the\x20GuardIdentifier\x20destination\x20is\x20whoever\x20builds\x20the\x20passport\x27s\x20choice:\x20entirely\x20the\x20creator\x27s\x20business.\x20Allocation\x20is\x20a\x20generic\x20component\x20—\x20the\x20anchor\x20is\x20opt-in\x20per\x20instance,\x20not\x20a\x20host-flow\x20constant.'];export function guardSitesFor(a){return GUARD_FIELD_SITES['filter'](b=>b['object']['toLowerCase']()===a['toLowerCase']());}export function guardCognitionDoctrine(){return['Classify\x20the\x20mode\x20first:\x20pure\x20gate\x20(authorization\x20only),\x20pure\x20source\x20(data\x20only),\x20or\x20gate+source\x20(most\x20money\x20fields).','For\x20every\x20extracted\x20slot,\x20name\x20its\x20origin\x20(fixed\x20/\x20submission\x20/\x20query)\x20before\x20judging\x20safety.','For\x20submission\x20slots,\x20identify\x20the\x20passport\x20builder:\x20that\x20party\x20chooses\x20the\x20value.\x20Trace\x20what\x20constrains\x20it\x20(guard\x20expression,\x20host-side\x20balance/authorization\x20checks).','For\x20fixed\x20slots,\x20remember\x20immutability:\x20the\x20value\x20is\x20policy,\x20changed\x20only\x20by\x20re-issuing\x20the\x20guard.','For\x20query-coupled\x20guards,\x20map\x20each\x20query\x20id\x20to\x20its\x20data\x20dependency\x20(which\x20object,\x20which\x20field)\x20—\x20the\x20guard\x20is\x20only\x20as\x20fresh\x20as\x20the\x20queried\x20state.','Check\x20config-time\x20invariants:\x20type\x20of\x20each\x20slot,\x20registration\x20limits\x20(treasury\x20100\x20deposit\x20/\x20200\x20withdraw\x20/\x20reward\x20200\x20/\x20arbitration\x2050\x20/\x20repository\x2010\x20write\x20guards\x20per\x20policy),\x20relies\x20<=\x204,\x20submission\x20size\x20<=\x20256\x20bytes.','Report\x20any\x20submission\x20slot\x20that\x20decides\x20money\x20destination\x20or\x20amount\x20without\x20a\x20scope\x20binding\x20as\x20a\x20HIGH-severity\x20redirect\x20risk.'];}export const REPOSITORY_WRITE_ROUTE_MATRIX=[{'route':'auto_id_write','purpose':'Unguarded\x20auto-id\x20write:\x20policy\x20has\x20NO\x20write\x20guards\x20and\x20id_from\x20is\x20Clock/Signer.','idSource':'clock','dataSource':'caller','honorsIdFromSubmission':![],'honorsDataFromSubmission':![],'guardRequirement':'policy-write-guard-must-be-empty','abortsOnUnhonoredSlots':![],'removeRoute':'auto_id_remove'},{'route':'auto_id_write_guarded','purpose':'Guarded\x20auto-id\x20write:\x20id\x20auto-generated;\x20the\x20guard\x20authorizes\x20AND\x20may\x20supply\x20the\x20data\x20payload\x20via\x20data_from_submission.','idSource':'clock','dataSource':'submission-if-set-else-caller','honorsIdFromSubmission':![],'honorsDataFromSubmission':!![],'guardRequirement':'specified-guard-must-be-in-policy','abortsOnUnhonoredSlots':![],'removeRoute':'auto_id_remove_guarded'},{'route':'manual_id_write','purpose':'Unguarded\x20manual\x20write:\x20caller\x20supplies\x20id\x20AND\x20data;\x20policy\x20must\x20have\x20no\x20write\x20guards.','idSource':'caller','dataSource':'caller','honorsIdFromSubmission':![],'honorsDataFromSubmission':![],'guardRequirement':'policy-write-guard-must-be-empty','abortsOnUnhonoredSlots':![],'removeRoute':'manual_id_remove'},{'route':'manual_id_write_guarded','purpose':'Guarded\x20manual\x20write:\x20caller\x20supplies\x20id\x20AND\x20data;\x20the\x20guard\x20authorizes\x20only.\x20Extraction\x20slots\x20must\x20be\x20None.','idSource':'caller','dataSource':'caller','honorsIdFromSubmission':![],'honorsDataFromSubmission':![],'guardRequirement':'specified-guard-must-be-in-policy','abortsOnUnhonoredSlots':!![],'removeRoute':'manual_id_remove_guarded'},{'route':'mixed_id_write_guarded','purpose':'Mixed\x20write:\x20per\x20specified\x20guard,\x20id\x20comes\x20from\x20id_from_submission\x20(else\x20caller\x20vector)\x20and\x20data\x20from\x20data_from_submission\x20(else\x20caller\x20vector).\x20Requires\x20policy\x20id_from\x20==\x20NONE.','idSource':'submission-if-set-else-caller','dataSource':'submission-if-set-else-caller','honorsIdFromSubmission':!![],'honorsDataFromSubmission':!![],'guardRequirement':'each-specified-guard-must-be-in-policy','abortsOnUnhonoredSlots':![],'removeRoute':'mixed_id_remove_guarded'},{'route':'mixed_id_remove_guarded','purpose':'Mixed\x20removal:\x20deletes\x20the\x20record\x20whose\x20id\x20is\x20extracted\x20from\x20id_from_submission.\x20Requires\x20the\x20slot\x20to\x20be\x20SET.','idSource':'submission-if-set-else-caller','dataSource':'none','honorsIdFromSubmission':!![],'honorsDataFromSubmission':![],'guardRequirement':'each-specified-guard-must-be-in-policy','abortsOnUnhonoredSlots':!![]}];export function repositoryRouteSlotConflicts(a){const b=[],{idFrom:c,writeGuardCount:d,idFromSubmissionSet:e,dataFromSubmissionSet:f,intendedRoute:g}=a;return c==='none'&&d===0x0&&b['push']('E_POLICY_WRITE_GUARD_REQUIRED:\x20id_from=NONE\x20with\x20an\x20empty\x20write_guard\x20lets\x20anyone\x20mutate\x20the\x20policy\x20data'),c!=='none'&&e&&b['push']('E_POLICY_ID_FROM_SUBMISSION_FORBIDDEN:\x20id\x20is\x20auto-generated\x20(clock/signer);\x20id_from_submission\x20can\x20never\x20fire'),(g==='manual_id_write_guarded'||g==='manual_id_remove_guarded')&&((e||f)&&b['push']('E_GUARD_SPECIFIED_ID_FROM_SUBMISSION:\x20the\x20chosen\x20route\x20rejects\x20every\x20extraction\x20slot;\x20use\x20the\x20mixed\x20guarded\x20write\x20or\x20the\x20guarded\x20auto-id\x20write\x20instead')),g==='auto_id_write_guarded'&&e&&b['push']('id_from_submission\x20is\x20never\x20consumed\x20by\x20the\x20guarded\x20auto-id\x20write\x20(id\x20is\x20auto-generated);\x20the\x20slot\x20is\x20dead\x20config'),g==='mixed_id_write_guarded'&&c!=='none'&&b['push']('E_POLICY_ID_FROM_NONE:\x20the\x20mixed\x20guarded\x20write\x20requires\x20policy\x20id_from=NONE'),g==='mixed_id_remove_guarded'&&!e&&b['push']('E_GUARD_NOT_SPECIFIED_ID_FROM_SUBMISSION:\x20mixed\x20removal\x20has\x20no\x20id\x20source;\x20set\x20id_from_submission\x20or\x20use\x20the\x20guarded\x20manual\x20removal\x20route'),b;}
1
+ export const GUARD_FIELD_COGNITION_VERSION='1.1.0';const NUMBER='number\x20(numeric\x20value\x20type)',U64='u64\x20exactly\x20(common::TYPE_U64)',ADDRESS='address\x20or\x20address-compatible\x20object\x20id';export const GUARD_FIELD_SITES=[{'object':'Treasury','field':'external_withdraw_guard[]\x20(AmountFromWithdrawGuard)','mode':'gate+source','extraction':[{'name':'identifier\x20(amount)','meaning':'Exact\x20withdraw\x20amount\x20moved\x20out\x20of\x20the\x20treasury\x20balance','allowedOrigins':['submission','fixed'],'typeConstraint':NUMBER,'configCheck':'configuring\x20the\x20external-withdraw\x20guard:\x20the\x20amount\x20slot\x20must\x20carry\x20a\x20declared\x20submission\x20value\x20type\x20and\x20it\x20must\x20be\x20numeric\x20(E_IDENTIFIER_NOT_NUMBER_TYPE)','runtimeFallback':'falls\x20back\x20to\x20the\x20fixed\x20table\x20value\x20when\x20no\x20submission\x20is\x20supplied;\x20if\x20neither\x20exists\x20the\x20tx\x20aborts\x20(E_SUBMISSION_ID_NOT_FOUND)','riskNotes':['submission\x20origin\x20=\x20passport\x20builder\x20chooses\x20the\x20amount;\x20only\x20the\x20balance\x20check\x20(E_WITHDRAW_BALANCE_INSUFFICIENT)\x20bounds\x20it','fixed\x20origin\x20=\x20same\x20amount\x20every\x20withdrawal;\x20safe\x20default\x20for\x20allowance-style\x20guards','query\x20origin\x20is\x20impossible\x20for\x20this\x20slot\x20—\x20a\x20query\x20can\x20only\x20gate,\x20never\x20supply\x20the\x20amount']},{'name':'store_from_id\x20(optional)','meaning':'Secondary\x20slot\x20decoded\x20as\x20address;\x20recorded\x20in\x20Treasury\x20history\x20Record\x20for\x20traceability','allowedOrigins':['submission','fixed'],'typeConstraint':ADDRESS,'configCheck':'address-compatibility\x20check\x20on\x20the\x20recorded\x20slot\x20(E_STORE_FROM_ID_NOT_COMPATIBLE)','runtimeFallback':'None\x20->\x20Record.store_from_id\x20=\x20none','riskNotes':['Bookkeeping\x20only;\x20never\x20used\x20as\x20the\x20withdrawal\x20recipient']}],'gateBehavior':'the\x20passport\x20verification\x20against\x20this\x20guard\x20must\x20pass\x20AND\x20the\x20guard\x20address\x20must\x20be\x20registered\x20in\x20the\x20external-withdraw\x20guard\x20list\x20(E_EXTERNAL_WITHDRAW_GUARD_NOT_FOUND)','setterChecklist':['Decide\x20who\x20builds\x20passports\x20against\x20this\x20guard\x20—\x20that\x20party\x20controls\x20a\x20submission-origin\x20amount','Prefer\x20a\x20fixed\x20amount\x20for\x20allowance\x20guards;\x20reserve\x20submission\x20amounts\x20for\x20flows\x20where\x20the\x20passport\x20builder\x20is\x20trusted\x20or\x20the\x20amount\x20is\x20re-verified\x20inside\x20the\x20guard\x20expression\x20(e.g.\x20compare\x20against\x20order.amount\x20via\x20query\x201561)','The\x20RECIPIENT\x20is\x20tx-supplied,\x20not\x20from\x20the\x20guard\x20—\x20constrain\x20it\x20inside\x20the\x20guard\x20expression\x20(e.g.\x20compare\x20a\x20submitted\x20address\x20against\x20an\x20expected\x20one)\x20if\x20destination\x20matters','Check\x20the\x20guard\x27s\x20dependency-eligibility\x20status\x20only\x20matters\x20if\x20this\x20guard\x20will\x20rely\x20on\x20others\x20(relies\x20<=\x204,\x20added\x20first)'],'auditorChecklist':['For\x20each\x20registered\x20guard:\x20classify\x20amount\x20slot\x20as\x20fixed\x20or\x20submission\x20(read\x20b_submission\x20in\x20the\x20table)','If\x20submission:\x20who\x20can\x20hold/build\x20a\x20passport\x20with\x20this\x20guard?\x20Can\x20a\x20stranger\x20drain\x20the\x20treasury\x20up\x20to\x20its\x20balance?','Does\x20the\x20guard\x20expression\x20bind\x20the\x20submission\x20to\x20on-chain\x20state\x20(order,\x20repository\x20data)\x20or\x20is\x20it\x20free-form?','Is\x20the\x20withdrawal\x20recipient\x20constrained\x20anywhere?']},{'object':'Treasury','field':'external_deposit_guard[]\x20(AmountFromDepositGuard)','mode':'gate+source','extraction':[{'name':'identifier\x20(amount,\x20Option)','meaning':'When\x20Some:\x20exact\x20deposit\x20amount\x20split\x20from\x20the\x20coin\x20(remainder\x20returned\x20to\x20caller).\x20When\x20None:\x20whole\x20coin\x20deposited','allowedOrigins':['submission','fixed'],'typeConstraint':NUMBER,'configCheck':'same\x20as\x20withdraw:\x20value\x20type\x20must\x20be\x20numeric\x20when\x20Some','runtimeFallback':'None\x20->\x20entire\x20coin\x20deposited;\x20Some\x20->\x20coin::split\x20to\x20`value`,\x20remainder\x20transferred\x20back\x20to\x20sender','riskNotes':['A\x20submission-origin\x20amount\x20below\x20the\x20coin\x20total\x20silently\x20returns\x20the\x20difference\x20to\x20the\x20caller\x20—\x20intended\x20for\x20partial\x20deposits','Deposits\x20cannot\x20steal\x20funds;\x20the\x20risk\x20direction\x20is\x20mis-recorded\x20history\x20only']},{'name':'store_from_id\x20(optional)','meaning':'Address\x20slot\x20recorded\x20on\x20the\x20deposit\x20Record','allowedOrigins':['submission','fixed'],'typeConstraint':ADDRESS,'configCheck':'address-compatibility\x20check','runtimeFallback':'None\x20->\x20none','riskNotes':['Traceability\x20only']}],'gateBehavior':'passport\x20verification\x20against\x20the\x20guard\x20must\x20pass\x20+\x20guard\x20must\x20be\x20registered\x20(E_EXTERNAL_DEPOSIT_GUARD_NOT_FOUND)','setterChecklist':['None\x20identifier\x20=\x20whole-coin\x20deposit;\x20Some\x20=\x20exact-amount\x20deposit\x20with\x20refund\x20of\x20the\x20remainder'],'auditorChecklist':['Confirm\x20the\x20amount\x20slot\x20origin\x20matches\x20the\x20intended\x20deposit\x20UX\x20(whole\x20vs\x20exact)']},{'object':'Reward','field':'guards[]\x20(RewardGuard)','mode':'gate+source','extraction':[{'name':'recipient\x20(Recipient::GuardIdentifier)','meaning':'Claim\x20payout\x20destination\x20address','allowedOrigins':['submission','fixed'],'typeConstraint':ADDRESS,'configCheck':'recipient\x20must\x20be\x20a\x20valid\x20address\x20(E_RECIPIENT_IDENTIFIER_NOT_ADDRESS)','runtimeFallback':'Entity/Signer\x20variants\x20bypass\x20extraction\x20entirely','riskNotes':['submission\x20origin\x20=\x20passport\x20builder\x20redirects\x20the\x20payout\x20to\x20any\x20address\x20it\x20names']},{'name':'amount\x20(Amount::GuardU64Identifier)','meaning':'Claim\x20size\x20paid\x20from\x20the\x20Reward\x20balance','allowedOrigins':['submission','fixed'],'typeConstraint':U64,'configCheck':'submission\x20value\x20type\x20must\x20be\x20u64\x20(E_AMOUNT_NOT_U64)','runtimeFallback':'Fixed(u64)\x20variant\x20bypasses\x20extraction','riskNotes':['submission\x20origin\x20=\x20passport\x20builder\x20decides\x20the\x20claim\x20size;\x20only\x20balance\x20and\x20per-recipient\x20record\x20bound\x20it']},{'name':'store_from_id\x20(optional)','meaning':'Address\x20slot\x20recorded\x20in\x20the\x20per-recipient\x20claim\x20Record','allowedOrigins':['submission','fixed'],'typeConstraint':ADDRESS,'configCheck':'address-compatibility\x20check\x20(E_STORE_FROM_ID_NOT_COMPATIBLE)','runtimeFallback':'None\x20->\x20none\x20(an\x20unstamped\x20record\x20matches\x20NO\x20store_from_id\x20predicate\x20—\x20pin\x20the\x20slot\x20for\x20any\x20per-order\x20replay\x20gate)','riskNotes':['Traceability\x20+\x20replay\x20gate:\x20without\x20a\x20pinned\x20slot\x20a\x20per-order\x20dedup\x20leg\x20cannot\x20bind\x20to\x20a\x20real\x20order\x20id\x20—\x20pin\x20store_from_id\x20for\x20per-order\x20replay\x20protection;\x20slot-less\x20guards\x20can\x20only\x20dedup\x20lifetime-once\x20via\x20record\x20count/exists\x20with\x20an\x20empty\x20where']}],'gateBehavior':'claim:\x20passport\x20verification\x20against\x20the\x20guard\x20must\x20pass\x20+\x20expiration_time\x20check\x20+\x20guard\x20registered\x20(E_GUARD_NOT_FOUND);\x20guard_not_added_expiration_time\x20freezes\x20the\x20guard\x20set\x20AND\x20blocks\x20balance\x20withdrawal\x20until\x20it\x20elapses','setterChecklist':['Recipient+amount\x20both\x20submission\x20=\x20the\x20passport\x20builder\x20fully\x20controls\x20who\x20gets\x20paid\x20how\x20much\x20—\x20acceptable\x20only\x20for\x20self-service\x20claim\x20flows\x20where\x20the\x20builder\x20IS\x20the\x20beneficiary','expiration_time\x20on\x20the\x20RewardGuard\x20bounds\x20the\x20window\x20(E_GUARD_EXPIRED)'],'auditorChecklist':['For\x20each\x20guard:\x20are\x20recipient/amount\x20fixed\x20or\x20submission?','If\x20submission:\x20does\x20the\x20guard\x20expression\x20bind\x20them\x20to\x20repository\x20data\x20(1167)\x20or\x20an\x20order\x20so\x20the\x20claim\x20is\x20justified?','Is\x20there\x20a\x20per-recipient\x20cap?\x20(Only\x20the\x20historical\x20record\x20total\x20accumulates;\x20there\x20is\x20no\x20per-claim\x20limit.)']},{'object':'Repository','field':'policies[].write_guard[]\x20(PolicyGuard)','mode':'gate+source','extraction':[{'name':'id_from_submission\x20(Option<u8>)','meaning':'Data-record\x20key\x20(address)\x20extracted\x20from\x20the\x20guard\x20instead\x20of\x20caller-supplied','allowedOrigins':['submission','fixed'],'typeConstraint':ADDRESS,'configCheck':'address-compatibility\x20check\x20(E_INVALID_ID_IN_GUARD_TABLE)','runtimeFallback':'None\x20->\x20id\x20comes\x20from\x20the\x20caller\x20vector\x20or\x20is\x20auto-generated\x20(clock/signer)','riskNotes':['Policy-level\x20conflicts:\x20id_from\x20=\x20Clock/Signer\x20FORBIDS\x20id_from_submission\x20(E_POLICY_ID_FROM_SUBMISSION_FORBIDDEN);\x20id_from\x20=\x20None\x20REQUIRES\x20a\x20non-empty\x20write_guard\x20(E_POLICY_WRITE_GUARD_REQUIRED)']},{'name':'data_from_submission\x20(Option<u8>)','meaning':'Data\x20payload\x20extracted\x20from\x20the\x20guard\x20instead\x20of\x20caller-supplied','allowedOrigins':['submission','fixed'],'typeConstraint':'any\x20repository-supported\x20value\x20type\x20(first\x20byte\x20=\x20value_type)','configCheck':'identifier\x20presence\x20check\x20(E_INVALID_DATA_IN_GUARD_TABLE)','runtimeFallback':'None\x20->\x20data\x20comes\x20from\x20the\x20caller\x20vector','riskNotes':['Entry-point\x20routing\x20differs:\x20the\x20guarded\x20auto-id\x20write\x20consumes\x20data_from_submission;\x20the\x20guarded\x20manual\x20write\x20REJECTS\x20both\x20extraction\x20slots\x20(E_GUARD_SPECIFIED_ID_FROM_SUBMISSION);\x20the\x20mixed\x20guarded\x20write\x20mixes\x20per-guard\x20extraction\x20with\x20caller\x20vectors','Setting\x20an\x20extraction\x20slot\x20on\x20a\x20guard\x20that\x20is\x20only\x20ever\x20used\x20via\x20the\x20guarded\x20manual\x20write\x20silently\x20means\x20\x27unused\x20config\x27\x20—\x20route\x20must\x20match']}],'gateBehavior':'write\x20path\x20must\x20find\x20the\x20guard\x20in\x20the\x20policy\x20(E_GUARD_SPECIFIED_NOT_IN_POLICY)\x20and\x20pass\x20the\x20passport\x20verification\x20or\x20the\x20permission-based\x20verification\x20(impack\x20membership)','setterChecklist':['Match\x20the\x20policy\x20id_from\x20with\x20the\x20guard\x20slots\x20(see\x20conflicts\x20above)','Pick\x20the\x20write\x20entry\x20point\x20first,\x20then\x20decide\x20which\x20extraction\x20slots\x20that\x20entry\x20point\x20actually\x20honors'],'auditorChecklist':['For\x20each\x20write_guard:\x20which\x20entry\x20points\x20can\x20reach\x20it\x20and\x20which\x20slots\x20do\x20those\x20entry\x20points\x20consume?','A\x20policy\x20with\x20write_guard\x20but\x20id_from=None\x20and\x20no\x20extraction\x20slots\x20still\x20gates\x20writes\x20—\x20verify\x20the\x20guard\x20expression\x20actually\x20restricts\x20who\x20can\x20write']},{'object':'Repository','field':'policies[].quote_guard\x20(Option<address>)','mode':'source','extraction':[{'name':'repository.data\x20(query\x201167\x20params:\x20key,\x20id)','meaning':'Read\x20authorization\x20for\x20private\x20repository\x20data\x20inside\x20guard\x20expressions','allowedOrigins':['query'],'typeConstraint':'(String\x20key,\x20Address\x20id)\x20pair','configCheck':'setting\x20the\x20policy\x20quote\x20guard:\x20the\x20guard\x20must\x20be\x20dependency-eligible\x20(relies\x20empty\x20+\x20immutable\x20+\x20rep\x20true,\x20E_NEED_DEPENDENT_GUARD)','runtimeFallback':'None\x20->\x20every\x20repository\x20data-row\x20read\x20aborts\x20for\x20a\x20key\x20protected\x20by\x20a\x20quote_guard\x20the\x20passport\x20does\x20not\x20carry\x20(IMPACK_GUARD_NOT_FOUND):\x20the\x201167\x20fetch\x20and\x20the\x201173/1174/1176\x20predicate\x20queries\x20check\x20the\x20queried\x20key;\x20the\x201177\x20keys-where\x20scan\x20refuses\x20outright\x20when\x20any\x20protected\x20key\x20is\x20uncovered','riskNotes':['The\x20reference\x20gate\x20spans\x20ALL\x20data-row\x20reads,\x20not\x20just\x20the\x20plain\x20fetch:\x20count/sum/find\x20predicates\x20and\x20the\x20keys-where\x20scan\x20hit\x20the\x20same\x20gate,\x20so\x20range/sum\x20probing\x20of\x20a\x20protected\x20value\x20is\x20refused\x20too','The\x20gate\x20runs\x20inside\x20the\x20native\x20verifier\x20against\x20the\x20impack-list\x20snapshot\x20taken\x20before\x20verify()','rep\x20flag\x20comes\x20from\x20the\x20native\x20parse\x20at\x20guard\x20creation\x20—\x20a\x20guard\x20that\x20fails\x20rep\x20cannot\x20serve\x20as\x20quote_guard']}],'gateBehavior':'No\x20direct\x20gate\x20—\x20this\x20guard\x20authorizes\x20DATA\x20READS\x20performed\x20by\x20other\x20guards','setterChecklist':['Only\x20a\x20fresh,\x20immutable,\x20reliance-free\x20guard\x20(meets\x20the\x20dependency-eligibility\x20shape)\x20qualifies','Register\x20it\x20on\x20the\x20same\x20Repository\x20whose\x20data\x20will\x20be\x20quoted'],'auditorChecklist':['Which\x20guards\x20rely\x20on\x20/\x20are\x20bundled\x20with\x20this\x20quote_guard\x20in\x20passports?\x20(impack\x20membership\x20decides)','Is\x20the\x20quoted\x20(key,id)\x20scoped\x20narrowly\x20enough,\x20or\x20does\x20one\x20quote_guard\x20open\x20the\x20whole\x20policy?']},{'object':'Arbitration','field':'voting_guard[]\x20(VotingGuard)','mode':'gate+source','extraction':[{'name':'vote_weight\x20(VoteValue::GuardIdentifier)','meaning':'Voter\x27s\x20weighted\x20voting\x20power','allowedOrigins':['submission','fixed'],'typeConstraint':NUMBER+',\x20value\x20<=\x20u32\x20max\x20(E_GUARD_IDENTIFIER_NUMBER_INVALID)','configCheck':'value\x20type\x20must\x20be\x20numeric\x20(E_GUARD_IDENTIFIER_NOT_NUMBER)','runtimeFallback':'FixedValue\x20variant\x20bypasses\x20extraction','riskNotes':['submission\x20origin\x20=\x20the\x20passport\x20builder\x20assigns\x20its\x20own\x20voting\x20weight\x20—\x20dangerous\x20unless\x20the\x20guard\x20expression\x20derives\x20the\x20weight\x20from\x20trusted\x20state\x20(e.g.\x20repository\x20holdings\x20via\x201167)']}],'gateBehavior':'voting\x20through\x20the\x20voting\x20guard:\x20passport\x20verification\x20must\x20pass\x20+\x20guard\x20registered\x20(E_VOTING_GUARD_NOT_FOUND)','setterChecklist':['Empty\x20voting_guard\x20=\x20open\x20voting\x20(everybody);\x20non-empty\x20=\x20only\x20listed\x20guards\x20may\x20vote','FixedValue\x20for\x20equal-weight\x20votes;\x20GuardIdentifier\x20only\x20when\x20the\x20expression\x20can\x20justify\x20the\x20weight'],'auditorChecklist':['If\x20GuardIdentifier:\x20can\x20a\x20voter\x20self-assign\x20a\x20maximal\x20weight\x20by\x20building\x20the\x20passport\x20alone?']},{'object':'Arbitration','field':'usage_guard\x20(Option<address>)','mode':'gate','extraction':[],'gateBehavior':'passport-guarded\x20dispute\x20filing:\x20the\x20passport\x20verification\x20must\x20pass;\x20dispute()\x20without\x20a\x20passport\x20aborts\x20when\x20usage_guard\x20is\x20set\x20(E_NEED_PASSPORT).\x20Set\x20=\x20guarded\x20entry\x20to\x20filing\x20disputes','setterChecklist':['Set\x20to\x20restrict\x20who\x20can\x20open\x20disputes;\x20none\x20=\x20anyone\x20can\x20dispute'],'auditorChecklist':['Check\x20whether\x20disputing\x20requires\x20passing\x20this\x20guard\x20and\x20who\x20can\x20pass\x20it']},{'object':'Service','field':'buy_guard\x20(Option<address>)','mode':'gate','extraction':[],'gateBehavior':'passport-guarded\x20purchase:\x20the\x20passport\x20verification\x20must\x20pass;\x20buy()\x20without\x20a\x20passport\x20aborts\x20when\x20set\x20(E_BUY_GUARD_PASSPORT_REQUIRED)','setterChecklist':['Pure\x20purchase\x20gate:\x20membership/whitelist/KYC\x20style;\x20no\x20slots\x20are\x20extracted'],'auditorChecklist':['Who\x20can\x20pass\x20it;\x20does\x20it\x20gate\x20every\x20sale\x20item\x20equally\x20(it\x20is\x20service-wide,\x20not\x20per-sale)']},{'object':'Demand','field':'guards[]\x20(ServiceGuard)','mode':'gate+source','extraction':[{'name':'service_identifier\x20(Option<u8>)','meaning':'Presented\x20Service\x20address;\x20overrides\x20the\x20caller-supplied\x20service\x20when\x20presenting','allowedOrigins':['submission','fixed'],'typeConstraint':'address\x20slot\x20whose\x20object\x20type\x20must\x20be\x20Service\x20(submission\x20object\x20type\x20validated\x20at\x20guard_add)','configCheck':'object\x20type\x20check\x20against\x20the\x20guard\x20validated\x20table\x20(E_GUARD_IDS_TYPE_ERROR\x20at\x20verify)','runtimeFallback':'None\x20->\x20caller\x20names\x20the\x20presented\x20service\x20directly','riskNotes':['fixed\x20origin\x20hard-pins\x20which\x20Service\x20may\x20answer\x20this\x20Demand\x20through\x20this\x20guard','submission\x20origin\x20lets\x20the\x20passport\x20builder\x20pick\x20any\x20Service\x20—\x20verify\x20the\x20guard\x20expression\x20restricts\x20it']}],'gateBehavior':'presenting\x20with\x20a\x20passport:\x20passport\x20verification\x20must\x20pass\x20+\x20guard\x20registered\x20(E_GUARD_NOT_FOUND)','setterChecklist':['Set\x20service_identifier\x20to\x20pin\x20the\x20answering\x20service;\x20leave\x20None\x20for\x20open\x20presentation'],'auditorChecklist':['Origin\x20of\x20service_identifier;\x20if\x20submission,\x20who\x20can\x20present\x20what']},{'object':'Machine','field':'node.pair.forward.guard\x20(ForwardGuard)','mode':'gate+source','extraction':[{'name':'retained_submission\x20(vector<u8>\x20identifiers)','meaning':'Submission\x20values\x20retained\x20into\x20Progress\x20Holder.retained_submission\x20(e.g.\x20sub-order\x20/\x20procured-service\x20evidence)\x20when\x20the\x20forward\x20executes','allowedOrigins':['submission'],'typeConstraint':'identifiers\x20must\x20exist\x20as\x20submission\x20slots\x20(existence\x20check,\x20E_RETAINED_SUBMISSION_ERROR)','configCheck':'configuring\x20the\x20guarded\x20forward\x20validates\x20the\x20identifiers\x20against\x20the\x20guard\x20table','runtimeFallback':'empty\x20list\x20->\x20gate\x20only,\x20nothing\x20retained;\x20non-empty\x20->\x20the\x20submitted\x20values\x20are\x20copied\x20into\x20the\x20session\x20history','riskNotes':['This\x20is\x20the\x20mechanism\x20that\x20carries\x20sub-order\x20data\x20from\x20an\x20operator\x27s\x20passport\x20into\x20the\x20order\x27s\x20Progress\x20history\x20—\x20downstream\x20analyzers\x20read\x20it\x20(ACTIVE-SESSION\x20queries\x201266-1268\x20+\x201279\x20count;\x20HISTORY-side\x20value\x20read\x20=\x201281\x20progress.history.session.forward.retained_submission.value,\x20which\x20stays\x20readable\x20after\x20the\x20session\x20migrates\x20into\x20history)']}],'gateBehavior':'progress\x20node\x20advancement\x20with\x20a\x20passport:\x20guard\x20is\x20the\x20optional\x20pre/post\x20verification\x20layer\x20for\x20advancing\x20a\x20node;\x20namedOperator/permissionIndex\x20can\x20be\x20replaced\x20by\x20a\x20guard','setterChecklist':['Choose\x20which\x20submission\x20slots\x20are\x20worth\x20retaining\x20as\x20durable\x20evidence','Remember\x20the\x20order\x20of\x20verification:\x20dependent\x20guards\x20must\x20be\x20added\x20to\x20the\x20passport\x20first'],'auditorChecklist':['For\x20each\x20guarded\x20forward:\x20does\x20the\x20retained\x20data\x20actually\x20prove\x20the\x20transition\x20claim\x20(sub-order\x20id,\x20amount)?']},{'object':'Allocation','field':'allocators[].guard\x20(Allocator)','mode':'gate+source','extraction':[{'name':'sharing\x20Recipient::GuardIdentifier','meaning':'Payout\x20recipient\x20address\x20for\x20that\x20sharing\x20line','allowedOrigins':['submission','fixed'],'typeConstraint':ADDRESS,'configCheck':'recipient\x20must\x20be\x20a\x20valid\x20address\x20(ERECIPIENT_IDENTIFIER_NOT_ADDRESS)','runtimeFallback':'Entity/Signer\x20sharing\x20variants\x20bypass\x20extraction','riskNotes':['submission\x20origin\x20=\x20the\x20passport\x20builder\x20decides\x20the\x20split\x20destination\x20at\x20alloc()\x20time\x20—\x20the\x20ALC1\x20audit\x20treats\x20an\x20unbound\x20recipient\x20as\x20a\x20redirect\x20risk','for_object\x20anchor\x20(protocol\x20139):\x20when\x20the\x20Allocation\x27s\x20payment_info.for_object\x20is\x20Some,\x20alloc()\x20enforces\x20submitted\x20address\x20==\x20for_object\x20and\x20aborts\x20with\x20ERECIPIENT_NOT_FOR_OBJECT\x20(15)\x20on\x20mismatch\x20—\x20the\x20anchor\x20is\x20mechanism-enforced,\x20not\x20advisory','for_object\x20=\x20None\x20carries\x20NO\x20anchor:\x20nothing\x20is\x20enforced\x20on-chain\x20and\x20the\x20recipient\x20semantics\x20are\x20entirely\x20the\x20creator\x27s\x20business\x20(Allocation\x20is\x20a\x20generic\x20component;\x20only\x20host\x20flows\x20that\x20declare\x20a\x20binding\x20get\x20the\x20anchor)']}],'gateBehavior':'alloc:\x20the\x20passed\x20guard\x20address\x20must\x20equal\x20the\x20registered\x20allocator\x20guard;\x20the\x20passport\x20verification\x20must\x20pass;\x20AllocationEvent\x20records\x20which\x20guard\x20ran','setterChecklist':['Bind\x20recipient\x20slots\x20inside\x20the\x20guard\x20expression\x20(signer\x20==\x20authorized\x20party,\x20state\x20==\x20expected\x20scope)\x20exactly\x20as\x20ALC1\x20expects','A\x20submission\x20slot\x20with\x20NO\x20scope\x20binding\x20=\x20HIGH\x20severity\x20finding','When\x20setting\x20payment_info:\x20for_object\x20=\x20Some\x20turns\x20it\x20into\x20an\x20enforced\x20anchor\x20—\x20every\x20GuardIdentifier\x20recipient\x20submission\x20must\x20equal\x20that\x20address\x20or\x20alloc()\x20aborts\x20(code\x2015);\x20verify\x20the\x20anchor\x20matches\x20the\x20intended\x20recipient\x20flow\x20BEFORE\x20create\x20(payment_info\x20is\x20immutable\x20after\x20create)','for_object\x20=\x20None\x20is\x20legal:\x20no\x20on-chain\x20anchor,\x20recipient\x20routing\x20is\x20then\x20purely\x20the\x20creator\x27s\x20design\x20—\x20flag\x20this\x20explicitly\x20in\x20the\x20plan\x20so\x20the\x20user\x20decides'],'auditorChecklist':['Cross-scenario\x20settlement\x20residual:\x20a\x20guard\x20bound\x20to\x20one\x20host\x20but\x20reusable\x20across\x20unrelated\x20callers\x20of\x20other\x20hosts','Every\x20submission\x20recipient\x20slot\x20must\x20have\x20a\x20scope\x20binding\x20(guard\x20expression\x20or\x20payment_info.for_object\x20anchor)\x20—\x20otherwise\x20funds\x20can\x20be\x20redirected','Check\x20payment_info.for_object:\x20Some\x20=\x20confirmed\x20enforced\x20anchor\x20(compare\x20against\x20intended\x20recipients);\x20None\x20=\x20trust-on-creator,\x20no\x20on-chain\x20enforcement\x20of\x20the\x20GuardIdentifier\x20destination']},{'object':'Payment','field':'info.for_guard\x20(PaymentInfo)','mode':'source','extraction':[{'name':'for_guard','meaning':'Provenance:\x20records\x20which\x20guard\x20context\x20produced\x20this\x20payment;\x20creates\x20an\x20object-linker\x20affiliation','allowedOrigins':['fixed'],'typeConstraint':'guard\x20address\x20(set\x20when\x20the\x20payment\x20info\x20is\x20created\x20with\x20a\x20guard\x20attached\x20—\x20the\x20payment_info_with_guard\x20variants)','configCheck':'n/a\x20—\x20plain\x20address\x20copy','runtimeFallback':'None\x20->\x20no\x20provenance','riskNotes':['Not\x20a\x20gate,\x20not\x20a\x20submission\x20slot\x20—\x20pure\x20traceability\x20(queries\x201057/1058,\x201108/1109)']}],'gateBehavior':'None','setterChecklist':['Attach\x20for_guard\x20when\x20the\x20payment\x20originates\x20from\x20a\x20guarded\x20flow'],'auditorChecklist':['Use\x20it\x20to\x20trace\x20payment\x20history\x20back\x20to\x20the\x20guarding\x20decision']},{'object':'Permission','field':'table\x20keys\x20(guard\x20addresses\x20as\x20permission\x20subjects)','mode':'gate','extraction':[],'gateBehavior':'A\x20guard\x20ADDRESS\x20can\x20be\x20granted\x20permission\x20indexes\x20like\x20a\x20user.\x20A\x20passport-asserted\x20operation\x20collects\x20the\x20passport\x20impack\x20guard\x20list\x20and\x20checks\x20permission\x20indexes\x20against\x20it:\x20a\x20passing\x20guard\x20can\x20therefore\x20carry\x20authorization\x20for\x20the\x20whole\x20transaction','setterChecklist':['Granting\x20an\x20index\x20to\x20a\x20guard\x20address\x20delegates\x20that\x20authority\x20to\x20anyone\x20who\x20can\x20pass\x20the\x20guard\x20—\x20treat\x20like\x20a\x20role\x20grant'],'auditorChecklist':['List\x20permission\x20subjects\x20that\x20are\x20guard\x20addresses;\x20evaluate\x20who\x20can\x20pass\x20those\x20guards\x20(they\x20inherit\x20the\x20permission)']}];export const VALUE_ORIGIN_SEMANTICS={'fixed':'Value\x20baked\x20into\x20the\x20guard\x20table\x20(b_submission=false).\x20Deterministic\x20on\x20every\x20use;\x20frozen\x20after\x20create;\x20used\x20as\x20the\x20fallback\x20when\x20no\x20submission\x20is\x20supplied.','submission':'Value\x20supplied\x20by\x20the\x20passport\x20builder\x20at\x20guard_add\x20time\x20(b_submission=true),\x20type-checked\x20against\x20the\x20table.\x20Whoever\x20builds\x20the\x20passport\x20controls\x20the\x20value\x20—\x20always\x20ask\x20who\x20that\x20is.','query':'Value\x20that\x20exists\x20only\x20inside\x20the\x20guard\x20input\x20expression\x20(native\x20query\x20opcodes\x201xxx).\x20It\x20constrains\x20verification\x20(state\x20coupling)\x20but\x20is\x20never\x20extractable;\x20extraction\x20slots\x20must\x20be\x20fixed\x20or\x20submission.'};export const GUARD_PASSPORT_DOCTRINE=['Slot\x20value\x20resolution\x20order:\x20passport\x20submission\x20value\x20->\x20fixed\x20guard\x20table\x20value\x20->\x20abort\x20(E_SUBMISSION_ID_NOT_FOUND).\x20A\x20slot\x20with\x20no\x20submission\x20and\x20no\x20fixed\x20value\x20aborts\x20the\x20host\x20call.','A\x20guard\x20only\x20participates\x20if\x20its\x20passport\x20verification\x20passes,\x20and\x20it\x20must\x20be\x20marked\x20impack\x20when\x20the\x20host\x20extracts\x20data\x20from\x20it\x20(result_for_permission\x20returns\x20impack\x20guards\x20only).','The\x20impack\x20list\x20is\x20snapshotted\x20before\x20verify()\x20runs;\x20repository\x20quote_guard\x20membership\x20is\x20checked\x20against\x20this\x20snapshot\x20inside\x20the\x20native\x20verifier\x20—\x20and\x20the\x20same\x20gate\x20now\x20covers\x20every\x20data-row\x20read\x20(1167\x20fetch,\x201173/1174/1176\x20predicate\x20queries,\x201177\x20keys-where),\x20not\x20just\x20the\x20plain\x20fetch.','relies:\x20a\x20guard\x20may\x20depend\x20on\x20at\x20most\x204\x20other\x20guards\x20(MAX_DEPENDED_COUNT),\x20dependent\x20guards\x20must\x20be\x20added\x20to\x20the\x20passport\x20first,\x20and\x20the\x20combine\x20logic\x20is\x20relies_logic_and\x20(AND\x20default,\x20OR\x20optional).','Dependency\x20eligibility\x20of\x20a\x20guard\x20=\x20relies\x20empty\x20AND\x20immutable\x20AND\x20rep\x20—\x20the\x20only\x20shape\x20accepted\x20as\x20a\x20repository\x20quote_guard\x20or\x20as\x20a\x20relied-upon\x20guard.','Guards\x20are\x20frozen\x20on\x20create\x20(immutable=true);\x20changing\x20a\x20fixed\x20value\x20means\x20deploying\x20a\x20new\x20guard\x20and\x20re-registering\x20it\x20on\x20every\x20host\x20object.','Type\x20checks\x20happen\x20at\x20config\x20time\x20(submission\x20value\x20type\x20/\x20address\x20format\x20/\x20address\x20compatibility)\x20and\x20at\x20passport\x20build\x20time\x20(the\x20first\x20type\x20byte\x20of\x20each\x20submitted\x20value\x20is\x20compared\x20against\x20the\x20table);\x20runtime\x20aborts\x20are\x20the\x20last\x20resort.','Allocation\x20for_object\x20anchor\x20(protocol\x20139):\x20the\x20Allocation\x27s\x20payment_info.for_object,\x20when\x20Some,\x20is\x20enforced\x20inside\x20alloc()\x20—\x20every\x20Recipient::GuardIdentifier\x20submission\x20must\x20equal\x20that\x20address\x20(abort\x20ERECIPIENT_NOT_FOR_OBJECT\x2015).\x20When\x20None,\x20no\x20anchor\x20exists\x20and\x20the\x20GuardIdentifier\x20destination\x20is\x20whoever\x20builds\x20the\x20passport\x27s\x20choice:\x20entirely\x20the\x20creator\x27s\x20business.\x20Allocation\x20is\x20a\x20generic\x20component\x20—\x20the\x20anchor\x20is\x20opt-in\x20per\x20instance,\x20not\x20a\x20host-flow\x20constant.'];export function guardSitesFor(a){return GUARD_FIELD_SITES['filter'](b=>b['object']['toLowerCase']()===a['toLowerCase']());}export function guardCognitionDoctrine(){return['Classify\x20the\x20mode\x20first:\x20pure\x20gate\x20(authorization\x20only),\x20pure\x20source\x20(data\x20only),\x20or\x20gate+source\x20(most\x20money\x20fields).','For\x20every\x20extracted\x20slot,\x20name\x20its\x20origin\x20(fixed\x20/\x20submission\x20/\x20query)\x20before\x20judging\x20safety.','For\x20submission\x20slots,\x20identify\x20the\x20passport\x20builder:\x20that\x20party\x20chooses\x20the\x20value.\x20Trace\x20what\x20constrains\x20it\x20(guard\x20expression,\x20host-side\x20balance/authorization\x20checks).','For\x20fixed\x20slots,\x20remember\x20immutability:\x20the\x20value\x20is\x20policy,\x20changed\x20only\x20by\x20re-issuing\x20the\x20guard.','For\x20query-coupled\x20guards,\x20map\x20each\x20query\x20id\x20to\x20its\x20data\x20dependency\x20(which\x20object,\x20which\x20field)\x20—\x20the\x20guard\x20is\x20only\x20as\x20fresh\x20as\x20the\x20queried\x20state.','Check\x20config-time\x20invariants:\x20type\x20of\x20each\x20slot,\x20registration\x20limits\x20(treasury\x20100\x20deposit\x20/\x20200\x20withdraw\x20/\x20reward\x20200\x20/\x20arbitration\x2050\x20/\x20repository\x2010\x20write\x20guards\x20per\x20policy),\x20relies\x20<=\x204,\x20submission\x20size\x20<=\x20256\x20bytes.','Report\x20any\x20submission\x20slot\x20that\x20decides\x20money\x20destination\x20or\x20amount\x20without\x20a\x20scope\x20binding\x20as\x20a\x20HIGH-severity\x20redirect\x20risk.'];}export const REPOSITORY_WRITE_ROUTE_MATRIX=[{'route':'auto_id_write','purpose':'Unguarded\x20auto-id\x20write:\x20policy\x20has\x20NO\x20write\x20guards\x20and\x20id_from\x20is\x20Clock/Signer.','idSource':'clock','dataSource':'caller','honorsIdFromSubmission':![],'honorsDataFromSubmission':![],'guardRequirement':'policy-write-guard-must-be-empty','abortsOnUnhonoredSlots':![],'removeRoute':'auto_id_remove'},{'route':'auto_id_write_guarded','purpose':'Guarded\x20auto-id\x20write:\x20id\x20auto-generated;\x20the\x20guard\x20authorizes\x20AND\x20may\x20supply\x20the\x20data\x20payload\x20via\x20data_from_submission.','idSource':'clock','dataSource':'submission-if-set-else-caller','honorsIdFromSubmission':![],'honorsDataFromSubmission':!![],'guardRequirement':'specified-guard-must-be-in-policy','abortsOnUnhonoredSlots':![],'removeRoute':'auto_id_remove_guarded'},{'route':'manual_id_write','purpose':'Unguarded\x20manual\x20write:\x20caller\x20supplies\x20id\x20AND\x20data;\x20policy\x20must\x20have\x20no\x20write\x20guards.','idSource':'caller','dataSource':'caller','honorsIdFromSubmission':![],'honorsDataFromSubmission':![],'guardRequirement':'policy-write-guard-must-be-empty','abortsOnUnhonoredSlots':![],'removeRoute':'manual_id_remove'},{'route':'manual_id_write_guarded','purpose':'Guarded\x20manual\x20write:\x20caller\x20supplies\x20id\x20AND\x20data;\x20the\x20guard\x20authorizes\x20only.\x20Extraction\x20slots\x20must\x20be\x20None.','idSource':'caller','dataSource':'caller','honorsIdFromSubmission':![],'honorsDataFromSubmission':![],'guardRequirement':'specified-guard-must-be-in-policy','abortsOnUnhonoredSlots':!![],'removeRoute':'manual_id_remove_guarded'},{'route':'mixed_id_write_guarded','purpose':'Mixed\x20write:\x20per\x20specified\x20guard,\x20id\x20comes\x20from\x20id_from_submission\x20(else\x20caller\x20vector)\x20and\x20data\x20from\x20data_from_submission\x20(else\x20caller\x20vector).\x20Requires\x20policy\x20id_from\x20==\x20NONE.','idSource':'submission-if-set-else-caller','dataSource':'submission-if-set-else-caller','honorsIdFromSubmission':!![],'honorsDataFromSubmission':!![],'guardRequirement':'each-specified-guard-must-be-in-policy','abortsOnUnhonoredSlots':![],'removeRoute':'mixed_id_remove_guarded'},{'route':'mixed_id_remove_guarded','purpose':'Mixed\x20removal:\x20deletes\x20the\x20record\x20whose\x20id\x20is\x20extracted\x20from\x20id_from_submission.\x20Requires\x20the\x20slot\x20to\x20be\x20SET.','idSource':'submission-if-set-else-caller','dataSource':'none','honorsIdFromSubmission':!![],'honorsDataFromSubmission':![],'guardRequirement':'each-specified-guard-must-be-in-policy','abortsOnUnhonoredSlots':!![]}];export function repositoryRouteSlotConflicts(a){const b=[],{idFrom:c,writeGuardCount:d,idFromSubmissionSet:e,dataFromSubmissionSet:f,intendedRoute:g}=a;return c==='none'&&d===0x0&&b['push']('E_POLICY_WRITE_GUARD_REQUIRED:\x20id_from=NONE\x20with\x20an\x20empty\x20write_guard\x20lets\x20anyone\x20mutate\x20the\x20policy\x20data'),c!=='none'&&e&&b['push']('E_POLICY_ID_FROM_SUBMISSION_FORBIDDEN:\x20id\x20is\x20auto-generated\x20(clock/signer);\x20id_from_submission\x20can\x20never\x20fire'),(g==='manual_id_write_guarded'||g==='manual_id_remove_guarded')&&((e||f)&&b['push']('E_GUARD_SPECIFIED_ID_FROM_SUBMISSION:\x20the\x20chosen\x20route\x20rejects\x20every\x20extraction\x20slot;\x20use\x20the\x20mixed\x20guarded\x20write\x20or\x20the\x20guarded\x20auto-id\x20write\x20instead')),g==='auto_id_write_guarded'&&e&&b['push']('id_from_submission\x20is\x20never\x20consumed\x20by\x20the\x20guarded\x20auto-id\x20write\x20(id\x20is\x20auto-generated);\x20the\x20slot\x20is\x20dead\x20config'),g==='mixed_id_write_guarded'&&c!=='none'&&b['push']('E_POLICY_ID_FROM_NONE:\x20the\x20mixed\x20guarded\x20write\x20requires\x20policy\x20id_from=NONE'),g==='mixed_id_remove_guarded'&&!e&&b['push']('E_GUARD_NOT_SPECIFIED_ID_FROM_SUBMISSION:\x20mixed\x20removal\x20has\x20no\x20id\x20source;\x20set\x20id_from_submission\x20or\x20use\x20the\x20guarded\x20manual\x20removal\x20route'),b;}
@@ -1 +1 @@
1
- export const GUARD_SCENES=[{'id':'service_buy_guard','name':'Service\x20purchase\x20validation\x20(buy_guard)','host_object':'Service','binding_field':'buy_guard','validation_scene':'When\x20a\x20customer\x20places\x20an\x20order\x20to\x20purchase\x20a\x20service,\x20the\x20Guard\x20validates\x20whether\x20the\x20customer\x20is\x20eligible\x20to\x20purchase\x20(identity/permission/condition)','pass_result':'Create\x20the\x20Order\x20object;\x20the\x20customer\x20enters\x20the\x20payment\x20flow','fail_result':'Transaction\x20rejected;\x20Order\x20is\x20not\x20created;\x20the\x20customer\x20cannot\x20purchase','submission_source':'Customer\x20(signer\x20address,\x20credentials,\x20Passport,\x20etc.)','special_constraints':['The\x20Guard\x20table\x20must\x20declare\x20all\x20data\x20the\x20customer\x20needs\x20to\x20submit','The\x20name\x20of\x20b_submission=true\x20entries\x20must\x20be\x20a\x20natural-language\x20description\x20(the\x20contract\x20the\x20customer\x20sees)','If\x20the\x20Guard\x20references\x20the\x20Service\x20itself,\x20use\x20the\x20circular\x20reference\x20pattern\x20(CREATE\x20Service\x20→\x20CREATE\x20Guard\x20→\x20MODIFY\x20Service)','buy_guard\x20can\x20still\x20be\x20modified\x20after\x20Service\x20is\x20published\x20(via\x20MODIFY\x20Service)','Reentrancy:\x20LOW\x20—\x20Each\x20purchase\x20creates\x20a\x20fresh\x20Order;\x20no\x20existing\x20Order\x20state\x20is\x20modified.\x20Default:\x20no\x20reentrancy\x20risk.\x20IF\x20business\x20intent\x20is\x20\x27limit\x20one\x20purchase\x20per\x20user\x27\x20(limited-edition\x20goods,\x20whitelist\x20single-buy),\x20an\x20anti-reentrancy\x20check\x20is\x20REQUIRED\x20but\x20no\x20direct\x20GUARDQUERY\x20primitive\x20exists\x20for\x20per-user\x20purchase\x20history\x20—\x20use\x20a\x20Repository\x20to\x20record\x20prior\x20purchases\x20and\x20add\x20`repository.data\x20has`\x20(query\x201166)\x20+\x20`logic_not`\x20to\x20root,\x20or\x20revoke\x20EntityRegistrar\x20membership\x20after\x20first\x20buy'],'common_patterns':['Identity\x20check:\x20context(Signer)\x20+\x20logic_equal\x20(single\x20address)\x20/\x20vec_contains_address\x20(whitelist)','Membership\x20validation:\x20query\x20EntityRegistrar(0xaab)\x20+\x20logic_and\x20combination','Time\x20limit:\x20context(Clock)\x20+\x20logic_as_u256_greater_or_equal(open_time)\x20for\x20an\x20OPENING\x20window\x20(valid\x20from\x20open\x20onwards);\x20for\x20a\x20DEADLINE\x20window\x20use\x20logic_as_u256_lesser_or_equal(calc_number_add(anchor,\x20duration))\x20—\x20Clock\x20<=\x20anchor+N.\x20NEVER\x20greater_or_equal(end_time):\x20inverts\x20the\x20window\x20(rejects\x20everything\x20inside\x20it,\x20admits\x20everything\x20after\x20it).\x20See\x20pattern.deadline_window','Multi-condition:\x20logic_and\x20combining\x20multiple\x20checks'],'mutable_after_publish':!![],'r_rounds_focus':['R1','R2','R3','R5','R7','R9']},{'id':'service_order_allocators_guard','name':'Allocation\x20strategy\x20selection\x20validation\x20(order_allocators[].guard)','host_object':'Service','binding_field':'order_allocators','validation_scene':'When\x20an\x20order\x20is\x20completed\x20or\x20allocation\x20conditions\x20are\x20met,\x20the\x20caller\x20submits\x20ONE\x20guard.\x20Every\x20allocator\x20bound\x20to\x20that\x20guard\x20fires,\x20in\x20vector\x20order,\x20each\x20against\x20the\x20balance\x20left\x20by\x20the\x20previous\x20(allocation.move:366-368).','pass_result':'Execute\x20the\x20allocation\x20strategy\x20for\x20every\x20allocator\x20bound\x20to\x20the\x20submitted\x20guard','fail_result':'If\x20the\x20submitted\x20guard\x20does\x20not\x20match\x20any\x20allocator\x27s\x20guard,\x20or\x20if\x20the\x20guard\x27s\x20conditions\x20fail,\x20no\x20funds\x20are\x20distributed','submission_source':'System\x20auto-derives\x20from\x20Progress\x20state\x20(no\x20explicit\x20customer\x20submission\x20needed)','special_constraints':['A\x20distribution\x20call\x20submits\x20ONE\x20guard;\x20every\x20allocator\x20bound\x20to\x20that\x20guard\x20fires\x20in\x20vector\x20order\x20against\x20the\x20shrinking\x20pool\x20(allocation.move:366-368).\x20Allocator\x20list\x20order\x20determines\x20the\x20firing\x20sequence\x20when\x20multiple\x20allocators\x20share\x20the\x20same\x20guard,\x20NOT\x20which\x20path\x20is\x20selected','order_allocators\x20cannot\x20be\x20modified\x20after\x20Service\x20is\x20published\x20(immutable)','Guard\x20usually\x20queries\x20Order/Progress\x20state\x20to\x20determine\x20allocation\x20conditions','Common\x20queries:\x20order.amount,\x20progress.current_node,\x20order.completed,\x20etc.','GuardIdentifier\x20can\x20be\x20used\x20for\x20dynamic\x20amounts\x20(extract\x20u64\x20value\x20from\x20table\x20as\x20allocation\x20ratio)','Guard+sharing\x20coupling:\x20Guard\x20determines\x20IF\x20allocation\x20happens;\x20sharing.who\x20determines\x20WHERE\x20funds\x20go.\x20If\x20sharing.who=Signer,\x20the\x20caller\x20receives\x20funds\x20—\x20the\x20Guard\x20MUST\x20bind\x20Signer\x20(context(Signer)==authorized)\x20to\x20prevent\x20theft.\x20PREFERRED:\x20use\x20sharing.who=Entity\x20(Treasury\x20or\x20fixed\x20address)\x20so\x20funds\x20always\x20go\x20to\x20the\x20legitimate\x20recipient\x20regardless\x20of\x20caller.','allocators\x20require\x20unique\x20guard\x20addresses\x20when\x20they\x20represent\x20alternative\x20paths:\x20bind\x20each\x20path\x20to\x20its\x20OWN\x20Guard\x20object\x20(they\x20may\x20share\x20root/table\x20but\x20must\x20differ\x20in\x20description).\x20Same-guard\x20allocators\x20fire\x20sequentially\x20on\x20the\x20same\x20call,\x20which\x20is\x20only\x20correct\x20for\x20intended\x20waterfalls\x20(fee\x20first,\x20then\x20split\x20remainder)','Every\x20allocator\x20bound\x20to\x20the\x20submitted\x20guard\x20fires\x20in\x20vector\x20order.\x20Alternative\x20business\x20paths\x20(settle\x20vs\x20refund\x20vs\x20damage)\x20must\x20use\x20DIFFERENT\x20guards\x20—\x20the\x20caller\x27s\x20guard\x20choice\x20selects\x20the\x20path,\x20not\x20the\x20allocator\x20list\x20position','If\x20sharing.who=Entity\x20references\x20a\x20Treasury\x20object,\x20verify\x20the\x20Treasury\x27s\x20permission\x20is\x20consistent\x20with\x20the\x20Service\x27s\x20permission\x20(different\x20permissions\x20=\x20different\x20permission\x20organizations\x20=\x20minor\x20risk).','Reentrancy:\x20LOW\x20—\x20Protocol-level\x20protection:\x20the\x20Order\x20layer\x20asserts\x20the\x20`allocation`\x20field\x20is\x20None\x20(E_ALLOCATION_ALREADY_SPECIFIED),\x20enforcing\x20ONE\x20Allocation\x20object\x20per\x20Order,\x20ever.\x20After\x20alloc()\x20executes,\x20typical\x20Rate-mode\x20allocators\x20(sum=10000)\x20and\x20any\x20Surplus-mode\x20allocator\x20drain\x20balance\x20to\x200\x20via\x20balance::withdraw_all,\x20making\x20a\x20second\x20alloc()\x20fail\x20at\x20`assert!(balance\x20>=\x20threshold)`.\x20EDGE\x20CASE:\x20Amount-mode-only\x20allocators\x20(no\x20Surplus,\x20total\x20<\x20full\x20balance)\x20leave\x20remainder;\x20a\x20second\x20alloc()\x20could\x20extract\x20more\x20—\x20mitigated\x20by\x20preferring\x20Rate/Surplus\x20modes.\x20External\x20deposit\x20via\x20receive()\x20is\x20possible\x20but\x20irrational\x20(attacker\x20funds\x20the\x20Allocation\x20they\x20attack).\x20Optional\x20anti-reentrancy\x20primitive:\x20`order.allocation\x20some`\x20(query\x201568)\x20+\x20logic_not'],'common_patterns':['Node\x20state\x20check:\x20query(Progress.current_node)\x20+\x20logic_equal(\x27Completed\x27)','Amount\x20threshold:\x20query(Order.amount)\x20+\x20logic_as_u256_greater_or_equal(threshold)','Multi-condition\x20combination:\x20logic_and\x20(node\x20state\x20+\x20amount\x20+\x20time)','GuardIdentifier\x20dynamic\x20ratio:\x20table[u64]\x20extracts\x20allocation\x20ratio','Treasury+personal\x202-allocator\x20pattern:\x202\x20Guard\x20objects\x20(identical\x20root/table,\x20different\x20descriptions)\x20+\x202\x20allocators\x20(sharing.who=Entity\x20Treasury\x20/\x20Entity\x20personal)\x20—\x202\x20alternative\x20merchant\x20collection\x20approaches\x20bound\x20to\x20DIFFERENT\x20guards;\x20the\x20caller\x27s\x20guard\x20choice\x20selects\x20which\x20allocator\x20fires'],'mutable_after_publish':![],'r_rounds_focus':['R1','R2','R3','R5','R6','R7']},{'id':'machine_forward_guard','name':'Workflow\x20node\x20advancement\x20validation\x20(Forward.guard)','host_object':'Machine','binding_field':'Forward.guard','validation_scene':'When\x20a\x20customer\x20or\x20provider\x20executes\x20a\x20Forward\x20operation\x20to\x20advance\x20the\x20workflow,\x20the\x20Guard\x20validates\x20whether\x20advancement\x20to\x20the\x20next\x20node\x20is\x20allowed','pass_result':'Progress\x20advances\x20to\x20next_node;\x20session\x20accumulates\x20weight','fail_result':'Forward\x20is\x20blocked;\x20Progress\x20stays\x20at\x20the\x20current\x20node.\x20Optional\x20retained_submission\x20retains\x20audit\x20data','submission_source':'The\x20party\x20executing\x20Forward\x20(Customer\x20or\x20Provider,\x20depending\x20on\x20Forward\x20configuration)','special_constraints':['Forward.guard\x20cannot\x20be\x20modified\x20after\x20Machine\x20is\x20published\x20(a\x20new\x20Machine\x20must\x20be\x20created)','Optional\x20retained_submission:\x20stores\x20submission\x20data\x20in\x20Progress\x20for\x20later\x20audit','retained_submission\x20indices\x20must\x20correspond\x20to\x20the\x20Guard\x20table','Common\x20queries:\x20progress.current_node,\x20progress.session_forward,\x20order.service,\x20etc.','Fund\x20gate\x20(crs\x20P2-3):\x20allocation.balance\x20(query\x201051;\x20witness\x20TypeOrderAllocation(109)\x20resolves\x20it\x20from\x20the\x20Order\x20address)\x20gates\x20a\x20forward\x20on\x20the\x20order\x27s\x20escrow\x20balance\x20—\x20the\x20canonical\x20renewal-loop\x20convention\x20is\x20balance\x20>=\x20new-period\x20price','Time\x20lock:\x20context(Clock)\x20+\x20calc_number_add(progress.current_time,\x20duration)\x20tested\x20with\x201000ms','Reentrancy:\x20ALLOWED\x20—\x20By\x20design,\x20Forward\x20moves\x20progress.current_node\x20to\x20next_node,\x20naturally\x20invalidating\x20the\x20Guard\x20at\x20the\x20old\x20node.\x20Re-submission\x20at\x20the\x20SAME\x20node\x20(before\x20forward\x20completes)\x20is\x20intentional:\x20users\x20may\x20fix\x20prior\x20submission\x20data\x20or\x20accumulate\x20session\x20weight\x20toward\x20threshold.\x20No\x20anti-reentrancy\x20primitive\x20needed.\x20Optional\x20observability\x20queries:\x20`progress.session_forward`\x20(1262),\x20`progress.history`\x20(1273),\x20`query_progress_history_find`\x20(1274)'],'common_patterns':['Identity\x20check:\x20context(Signer)\x20+\x20logic_equal\x20(only\x20specific\x20parties\x20can\x20advance)','Time\x20lock:\x20context(Clock)\x20+\x20calc_number_add\x20+\x20logic_as_u256_greater_or_equal','Prior\x20Forward\x20completion:\x20query_progress_history_find\x20+\x20logic_equal(accomplished=true)','Submission\x20data\x20validation:\x20identifier(submission)\x20+\x20logic_equal(expected_value)','Cross-object\x20query:\x20convert_witness=TypeOrderProgress(100)\x20queries\x20Progress\x20from\x20Order;\x20convert_witness=TypeOrderAllocation(109)\x20queries\x20the\x20Allocation\x20(escrow)\x20from\x20Order'],'mutable_after_publish':![],'r_rounds_focus':['R1','R2','R3','R5','R6','R7','R8','R9']},{'id':'progress_submission_guard','name':'Progress\x20submission\x20data\x20validation\x20(submission\x20guard)','host_object':'Progress','binding_field':'submission','validation_scene':'Whether\x20the\x20data\x20(e.g.\x20signature,\x20credential,\x20confirmation)\x20submitted\x20during\x20Forward\x20execution\x20satisfies\x20the\x20Guard\x20condition','pass_result':'Forward\x20completes;\x20node\x20advances\x20after\x20session\x20accumulates\x20weight\x20to\x20threshold','fail_result':'Forward\x20does\x20not\x20complete;\x20waits\x20for\x20resubmission\x20or\x20condition\x20satisfaction','submission_source':'The\x20party\x20submitting\x20data\x20(Customer\x20or\x20Provider)','special_constraints':['Works\x20in\x20concert\x20with\x20Forward.guard:\x20Forward.guard\x20validates\x20eligibility,\x20submission\x20guard\x20validates\x20data','retained_submission\x20stores\x20submission\x20data\x20in\x20Progress\x20session\x20for\x20audit','Common\x20queries:\x20progress.session_forward,\x20progress.session_weight,\x20etc.','Reentrancy:\x20ALLOWED\x20—\x20Multiple\x20submissions\x20accumulate\x20session\x20weight\x20toward\x20threshold\x20by\x20design.\x20Re-submission\x20is\x20the\x20intended\x20mechanism\x20for\x20reaching\x20threshold;\x20no\x20anti-reentrancy\x20primitive\x20needed'],'common_patterns':['Signature\x20validation:\x20identifier(signature_submission)\x20+\x20logic_equal(expected)','Credential\x20validation:\x20query(Repository.data)\x20+\x20logic_equal(submission_proof)','Confirmation\x20validation:\x20identifier(confirm_submission)\x20+\x20logic_equal(true)'],'mutable_after_publish':![],'r_rounds_focus':['R1','R2','R3','R5','R6','R8']},{'id':'reward_claim','name':'Reward\x20claim\x20validation\x20(Reward.guard)','host_object':'Reward','binding_field':'guard','validation_scene':'When\x20a\x20user\x20claims\x20from\x20a\x20reward\x20pool,\x20the\x20Guard\x20validates\x20eligibility\x20to\x20claim','pass_result':'Reward\x20is\x20distributed\x20to\x20the\x20Claimant\x20and\x20recorded\x20in\x20reward_record','fail_result':'Claim\x20rejected;\x20reward\x20is\x20not\x20distributed','submission_source':'Claimant\x20(address,\x20credentials,\x20Passport)','special_constraints':['Common\x20query_reward_record_count\x20prevents\x20duplicate\x20claims\x20(one-time\x20claim)','Guard\x20usually\x20queries\x20history\x20records\x20+\x20time\x20conditions\x20+\x20identity\x20validation','If\x20the\x20Reward\x20references\x20a\x20Service,\x20use\x20the\x20circular\x20reference\x20pattern','Reentrancy:\x20CRITICAL\x20—\x20Guard\x20pass\x20distributes\x20reward\x20funds\x20to\x20the\x20Claimant\x20AND\x20creates\x20a\x20reward_record,\x20but\x20the\x20Guard\x20conditions\x20(identity,\x20time,\x20node\x20state)\x20do\x20NOT\x20naturally\x20invalidate\x20after\x20a\x20claim.\x20Without\x20an\x20explicit\x20anti-reentrancy\x20primitive,\x20the\x20same\x20Claimant\x20can\x20repeatedly\x20pass\x20the\x20Guard\x20and\x20DRAIN\x20THE\x20ENTIRE\x20POOL.\x20This\x20is\x20the\x20most\x20severe\x20reentrancy\x20scene.\x20REQUIRED\x20anti-reentrancy\x20primitive\x20(any\x20one):\x20`reward.record\x20has`\x20(query\x201613,\x20Bool)\x20+\x20`logic_not`;\x20OR\x20`reward.record\x20count`\x20(query\x201612,\x20U64)\x20+\x20`logic_equal(0)`;\x20OR\x20`reward.record.find_first`\x20(query\x201626,\x20U64)\x20+\x20`logic_not`/`logic_equal(0)`.\x20Reference\x20template:\x20MyShop_Advanced\x20Guard\x207\x20condition\x204\x20—\x20`logic_not(query_reward_record_exists(where.storeFromId=order_id))`'],'common_patterns':['One-time\x20claim:\x20query_reward_record_count(recipient)\x20+\x20logic_equal(0)','Time\x20window:\x20context(Clock)\x20+\x20logic_as_u256_greater_or_equal(start_time)\x20opens\x20claiming\x20from\x20start\x20onwards;\x20a\x20claim\x20DEADLINE\x20needs\x20the\x20opposite\x20direction\x20—\x20logic_as_u256_lesser_or_equal(calc_number_add(start_time,\x20duration))\x20i.e.\x20Clock\x20<=\x20start+N.\x20NEVER\x20greater_or_equal(end_time)\x20(inverts:\x20whole\x20window\x20rejected,\x20everything\x20after\x20admitted).\x20See\x20pattern.deadline_window','Identity\x20validation:\x20context(Signer)\x20+\x20vec_contains_address(allowlist)','Multi-condition:\x20logic_and\x20(identity\x20+\x20time\x20+\x20not\x20claimed\x20before)'],'mutable_after_publish':!![],'r_rounds_focus':['R1','R2','R3','R5','R7','R8','R9']},{'id':'repository_write_guard','name':'Repository\x20write\x20validation\x20(write_guard)','host_object':'Repository','binding_field':'write_guard','validation_scene':'When\x20writing\x20to\x20on-chain\x20storage,\x20the\x20Guard\x20validates\x20write\x20eligibility\x20and\x20optionally\x20extracts\x20data','pass_result':'Write\x20succeeds;\x20optional\x20id_from_submission\x20extracts\x20the\x20entity\x20ID,\x20data_from_submission\x20extracts\x20the\x20data\x20value','fail_result':'Write\x20rejected','submission_source':'Writer/Reader','special_constraints':['The\x20table\x20entry\x20referenced\x20by\x20id_from_submission\x20must\x20be\x20of\x20Address\x20type','The\x20table\x20entry\x20referenced\x20by\x20data_from_submission\x20must\x20match\x20the\x20Repository\x27s\x20value_type','Type\x20mismatch\x20leads\x20to\x20write\x20failure\x20or\x20data\x20corruption','Commonly\x20used\x20for\x20oracle\x20data\x20writes,\x20third-party\x20credential\x20attestation,\x20etc.','Reentrancy:\x20LOW\x20—\x20Default\x20writes\x20are\x20idempotent\x20(same\x20ID\x20overwrites,\x20different\x20ID\x20appends);\x20no\x20fund\x20flow.\x20IF\x20business\x20intent\x20is\x20\x27one\x20write\x20per\x20ID\x27\x20(e.g.\x20voting,\x20immutable\x20credential,\x20single-attestation),\x20an\x20anti-reentrancy\x20check\x20is\x20needed.\x20Optional\x20primitive:\x20`repository.data\x20has`\x20(query\x201166,\x20Bool)\x20+\x20`logic_not`','CONTENT\x20BLIND\x20SPOT\x20(testnet\x20test-14\x20HIGH-04):\x20under\x20id_from=None\x20the\x20chain\x20asserts\x20only\x20that\x20the\x20write_guard\x20LIST\x20is\x20non-empty\x20(the\x20Repository\x20policy-creation\x20entry,\x20repository.move\x20L511-536,\x20E_POLICY_WRITE_GUARD_REQUIRED=22)\x20—\x20never\x20what\x20a\x20listed\x20Guard\x20proves.\x20A\x20guard\x20that\x20returns\x20true\x20for\x20every\x20caller\x20(constant-true\x20leaf,\x20self-comparison,\x20unsigned\x20>=\x200)\x20therefore\x20publishes\x20as\x20\x27guarded\x27\x20while\x20being\x20an\x20OPEN\x20write:\x20any\x20address\x20can\x20add\x20or\x20overwrite\x20any\x20row,\x20and\x20rows\x20carry\x20no\x20author\x20field.\x20Rule\x20R-X1-17\x20folds\x20the\x20tree\x20and\x20reports\x20it;\x20generate\x20the\x20guard\x20from\x20pattern.repository_write_authorization\x20(an\x20identity\x20leaf\x20—\x20context(Signer)\x20/\x20allowlist\x20/\x20Permission\x20staff\x20/\x20Order\x20holder\x20—\x20is\x20mandatory).\x20Under\x20id_from=Signer|Clock\x20the\x20list\x20MAY\x20stay\x20non-empty,\x20but\x20every\x20PolicyGuard\x27s\x20id_from_submission\x20must\x20be\x20None\x20(E_POLICY_ID_FROM_SUBMISSION_FORBIDDEN=23)'],'common_patterns':['Authorized\x20writer:\x20context(Signer)\x20+\x20vec_contains_address(authorized_writers)','Data\x20format\x20validation:\x20identifier(data_submission)\x20+\x20logic_string_contains(expected_prefix)','ID\x20extraction:\x20id_from_submission\x20+\x20data_from_submission\x20combination'],'mutable_after_publish':!![],'r_rounds_focus':['R1','R2','R3','R5','R6','R7']},{'id':'arbitration_usage_guard','name':'Dispute\x20initiation\x20validation\x20(usage_guard)','host_object':'Arbitration','binding_field':'usage_guard','validation_scene':'When\x20a\x20customer\x20initiates\x20a\x20dispute\x20against\x20an\x20order,\x20the\x20Guard\x20validates\x20whether\x20the\x20customer\x20is\x20eligible\x20to\x20initiate\x20the\x20dispute','pass_result':'Create\x20an\x20Arb\x20case\x20and\x20enter\x20the\x20arbitration\x20flow','fail_result':'Dispute\x20rejected;\x20Arb\x20is\x20not\x20created','submission_source':'Customer\x20(Passport\x20credential)','special_constraints':['When\x20Arbitration\x20bPaused=true,\x20it\x20blocks\x20first\x20(before\x20the\x20Guard\x20check)','The\x20customer\x20must\x20first\x20generate\x20a\x20Passport\x20(gen_passport\x20passes\x20usage_guard)','Common\x20queries:\x20order.completed,\x20order.service,\x20entity.has,\x20etc.','Guard\x20validates\x20customer\x20identity\x20+\x20order\x20status\x20+\x20dispute\x20eligibility','Reentrancy:\x20HIGH\x20—\x20Guard\x20pass\x20creates\x20a\x20new\x20Arb\x20case.\x20Without\x20anti-reentrancy,\x20a\x20customer\x20can\x20create\x20multiple\x20Arb\x20cases\x20for\x20the\x20SAME\x20Order\x20(up\x20to\x20MAX_DISPUTE_COUNT=10),\x20harassing\x20the\x20counterparty\x20and\x20inflating\x20arbitration\x20system\x20load.\x20Not\x20direct\x20fund\x20loss,\x20but\x20severe\x20system\x20abuse.\x20Note:\x20the\x20dispute\x20entry\x20point\x20deduplicates\x20by\x20Arb\x20address\x20but\x20does\x20NOT\x20prevent\x20multiple\x20distinct\x20Arbs\x20for\x20the\x20same\x20Order.\x20REQUIRED\x20anti-reentrancy\x20primitive\x20(any\x20one):\x20`order.dispute\x20has`\x20(query\x201565,\x20Bool,\x20per-Arb\x20check)\x20+\x20`logic_not`;\x20OR\x20`order.dispute\x20count`\x20(query\x201564,\x20U64)\x20+\x20`logic_equal(0)`\x20(strict:\x20block\x20any\x20prior\x20dispute)\x20or\x20`logic_as_u256_lesser_or_equal(N)`\x20(lenient:\x20allow\x20up\x20to\x20N\x20disputes)'],'common_patterns':['Order\x20status\x20validation:\x20query(Order.status)\x20+\x20logic_equal(\x27completed\x27)','Membership\x20validation:\x20query(EntityRegistrar)\x20+\x20logic_and','Dispute\x20deadline\x20window:\x20context(Clock)\x20+\x20logic_as_u256_lesser_or_equal(calc_number_add(query(Order.time),\x20N))\x20—\x20Clock\x20<=\x20order_time+N\x20closes\x20disputes\x20after\x20N;\x20a\x20bare\x20query(Order.time)\x20+\x20calc_number_add\x20+\x20context(Clock)\x20chain\x20has\x20NO\x20comparison\x20direction\x20and\x20guards\x20nothing.\x20See\x20pattern.deadline_window','Passport\x20credential:\x20identifier(passport_submission)\x20+\x20context(Signer)'],'mutable_after_publish':!![],'r_rounds_focus':['R1','R2','R3','R5','R7','R8','R9']},{'id':'arbitration_voting_guard','name':'Arbitration\x20voting\x20weight\x20validation\x20(voting_guard[])','host_object':'Arbitration','binding_field':'voting_guard','validation_scene':'When\x20an\x20arbitrator\x20votes,\x20the\x20Guard\x20validates\x20voting\x20eligibility\x20and\x20extracts\x20the\x20voting\x20weight\x20(u32)\x20from\x20GuardIdentifier','pass_result':'Vote\x20is\x20counted;\x20weight\x20is\x20the\x20value\x20extracted\x20by\x20GuardIdentifier','fail_result':'Vote\x20rejected','submission_source':'Voter\x20(Passport\x20credential\x20with\x20weight\x20data)','special_constraints':['The\x20table\x20entry\x20referenced\x20by\x20GuardIdentifier\x20must\x20be\x20of\x20a\x20numeric\x20type\x20(U8-U256),\x20cast\x20to\x20u32','Non-numeric\x20types\x20cause\x20E_GUARD_IDENTIFIER_NOT_NUMBER\x20error','b_submission\x20must\x20be\x20true\x20(weight\x20is\x20submitted\x20at\x20runtime\x20by\x20the\x20voter)','Multiple\x20voting_guards\x20can\x20be\x20configured,\x20each\x20corresponding\x20to\x20a\x20different\x20voter\x20group','When\x20Arbitration\x20bPaused=true,\x20voting\x20is\x20blocked','Reentrancy:\x20CRITICAL\x20—\x20Guard\x20pass\x20counts\x20the\x20vote\x20with\x20the\x20extracted\x20weight.\x20Without\x20anti-reentrancy,\x20the\x20same\x20voter\x20can\x20vote\x20MULTIPLE\x20times,\x20multiplying\x20their\x20weight\x20and\x20skewing\x20the\x20arbitration\x20result\x20(which\x20directly\x20determines\x20fund\x20ownership\x20via\x20compensation).\x20The\x20voter\x27s\x20eligibility\x20(identity,\x20reputation)\x20does\x20NOT\x20naturally\x20invalidate\x20after\x20voting.\x20REQUIRED\x20anti-reentrancy\x20primitive\x20(any\x20one):\x20`arb.voted\x20has`\x20(query\x201404,\x20Bool,\x20per-voter)\x20+\x20`logic_not`;\x20OR\x20`arb.voted.agree\x20has`\x20(query\x201406,\x20Bool,\x20per-voter-per-proposition)\x20+\x20`logic_not`;\x20OR\x20`arb.voted.agree\x20count`\x20(query\x201405,\x20U64,\x20per-voter)\x20+\x20`logic_equal(0)`.\x20Note:\x20`arb.voted_count`\x20(1403)\x20is\x20total\x20voter\x20count\x20(NOT\x20per-voter)\x20and\x20does\x20NOT\x20serve\x20as\x20an\x20anti-reentrancy\x20primitive\x20for\x20individual\x20voters'],'common_patterns':['Reputation\x20score\x20weight:\x20query(EntityRegistrar.records[reputation])\x20+\x20GuardIdentifier(u64)','Fixed\x20weight:\x20identifier(constant_weight)\x20+\x20GuardIdentifier','Multi-tier\x20voting:\x20different\x20voting_guards\x20correspond\x20to\x20different\x20weight\x20tiers','Eligibility\x20+\x20weight:\x20logic_and\x20(eligibility\x20check\x20+\x20GuardIdentifier\x20extracts\x20weight)'],'mutable_after_publish':!![],'r_rounds_focus':['R1','R2','R3','R5','R6','R7','R8','R9']},{'id':'gen_passport_guard','name':'Passport\x20credential\x20generation\x20validation\x20(gen_passport)','host_object':'Standalone','binding_field':'none','validation_scene':'When\x20a\x20user\x20calls\x20gen_passport,\x20the\x20Guard\x20validates\x20user\x20eligibility\x20and\x20generates\x20a\x20Passport\x20with\x20credentials','pass_result':'Passport\x20is\x20generated,\x20containing\x20credentials\x20validated\x20by\x20the\x20Guard','fail_result':'Passport\x20generation\x20fails;\x20the\x20user\x20did\x20not\x20pass\x20validation','submission_source':'Passport\x20applicant\x20(signer\x20+\x20credentials)','special_constraints':['quote_guard\x20is\x20a\x20RIGID\x20verification\x20requirement\x20when\x20querying\x20Repository\x20data\x20(query\x201167)','Two-phase:\x20passport\x20generation\x20scans\x20guard\x20+\x20prepares\x20quote_guard,\x20passport\x20verification\x20re-checks\x20+\x20verifies','If\x20quote_guard==None:\x20Repository\x20data\x20is\x20freely\x20queryable\x20(no\x20access\x20control)','Guard\x20can\x20be\x20created\x20standalone\x20(not\x20bound\x20to\x20a\x20specific\x20Host\x20Object)','Guard\x20can\x20be\x20depended\x20on\x20by\x20other\x20Guards\x20via\x20rely\x20(requires\x20rep=true)','The\x20Passport\x20generated\x20by\x20gen_passport\x20can\x20be\x20used\x20as\x20submission\x20data\x20for\x20subsequent\x20operations','Reentrancy:\x20LOW\x20—\x20Each\x20gen_passport\x20call\x20generates\x20an\x20independent\x20Passport\x20(one\x20Passport\x20per\x20operation).\x20Multiple\x20Passports\x20for\x20the\x20same\x20user\x20are\x20usually\x20valid\x20(each\x20serves\x20a\x20different\x20subsequent\x20operation).\x20IF\x20business\x20intent\x20is\x20\x27one\x20active\x20Passport\x20per\x20user\x27,\x20an\x20anti-reentrancy\x20check\x20is\x20needed\x20but\x20no\x20direct\x20GUARDQUERY\x20primitive\x20exists\x20—\x20use\x20off-chain\x20tracking\x20or\x20a\x20Repository\x20to\x20record\x20issued\x20Passport\x20IDs'],'common_patterns':['Identity\x20validation:\x20context(Signer)\x20+\x20logic_equal\x20(single\x20address/whitelist)','Membership\x20eligibility:\x20query(EntityRegistrar)\x20+\x20logic_equal','Reputation\x20threshold:\x20query(EntityRegistrar.records[reputation])\x20+\x20logic_as_u256_greater_or_equal','Multi-condition\x20combination:\x20logic_and\x20(identity\x20+\x20eligibility\x20+\x20reputation)'],'mutable_after_publish':![],'r_rounds_focus':['R1','R2','R3','R5','R6','R7']}];export function findScene(a,b){return GUARD_SCENES['find'](c=>c['host_object']===a&&c['binding_field']===b);}export function inferSceneFromAction(a){const b={'buy':'service_buy_guard','forward':'machine_forward_guard','allocate':'service_order_allocators_guard','claim_reward':'reward_claim','vote':'arbitration_voting_guard','dispute':'arbitration_usage_guard','write_repository':'repository_write_guard','submit_progress':'progress_submission_guard','gen_passport':'gen_passport_guard'},c=b[a];return GUARD_SCENES['find'](d=>d['id']===c);}export function getImmutableScenes(){return GUARD_SCENES['filter'](a=>!a['mutable_after_publish']);}export function getNumericIdentifierScenes(){return GUARD_SCENES['filter'](a=>a['special_constraints']['some'](b=>b['includes']('numeric')||b['includes']('GuardIdentifier')));}
1
+ export const GUARD_SCENES=[{'id':'service_buy_guard','name':'Service\x20purchase\x20validation\x20(buy_guard)','host_object':'Service','binding_field':'buy_guard','validation_scene':'When\x20a\x20customer\x20places\x20an\x20order\x20to\x20purchase\x20a\x20service,\x20the\x20Guard\x20validates\x20whether\x20the\x20customer\x20is\x20eligible\x20to\x20purchase\x20(identity/permission/condition)','pass_result':'Create\x20the\x20Order\x20object;\x20the\x20customer\x20enters\x20the\x20payment\x20flow','fail_result':'Transaction\x20rejected;\x20Order\x20is\x20not\x20created;\x20the\x20customer\x20cannot\x20purchase','submission_source':'Customer\x20(signer\x20address,\x20credentials,\x20Passport,\x20etc.)','special_constraints':['The\x20Guard\x20table\x20must\x20declare\x20all\x20data\x20the\x20customer\x20needs\x20to\x20submit','The\x20name\x20of\x20b_submission=true\x20entries\x20must\x20be\x20a\x20natural-language\x20description\x20(the\x20contract\x20the\x20customer\x20sees)','If\x20the\x20Guard\x20references\x20the\x20Service\x20itself,\x20use\x20the\x20circular\x20reference\x20pattern\x20(CREATE\x20Service\x20→\x20CREATE\x20Guard\x20→\x20MODIFY\x20Service)','buy_guard\x20can\x20still\x20be\x20modified\x20after\x20Service\x20is\x20published\x20(via\x20MODIFY\x20Service)','Reentrancy:\x20LOW\x20—\x20Each\x20purchase\x20creates\x20a\x20fresh\x20Order;\x20no\x20existing\x20Order\x20state\x20is\x20modified.\x20Default:\x20no\x20reentrancy\x20risk.\x20IF\x20business\x20intent\x20is\x20\x27limit\x20one\x20purchase\x20per\x20user\x27\x20(limited-edition\x20goods,\x20whitelist\x20single-buy),\x20an\x20anti-reentrancy\x20check\x20is\x20REQUIRED\x20but\x20no\x20direct\x20GUARDQUERY\x20primitive\x20exists\x20for\x20per-user\x20purchase\x20history\x20—\x20use\x20a\x20Repository\x20to\x20record\x20prior\x20purchases\x20and\x20add\x20`repository.data\x20has`\x20(query\x201166)\x20+\x20`logic_not`\x20to\x20the\x20BUY\x20guard\x20root\x20(READ\x20side\x20only\x20—\x20never\x20inside\x20a\x20write-guard\x20verified\x20in\x20the\x20write\x20PTB,\x20ofn-mn-261012\x20F-02),\x20or\x20revoke\x20EntityRegistrar\x20membership\x20after\x20first\x20buy'],'common_patterns':['Identity\x20check:\x20context(Signer)\x20+\x20logic_equal\x20(single\x20address)\x20/\x20vec_contains_address\x20(whitelist)','Membership\x20validation:\x20query\x20EntityRegistrar(0xaab)\x20+\x20logic_and\x20combination','Time\x20limit:\x20context(Clock)\x20+\x20logic_as_u256_greater_or_equal(open_time)\x20for\x20an\x20OPENING\x20window\x20(valid\x20from\x20open\x20onwards);\x20for\x20a\x20DEADLINE\x20window\x20use\x20logic_as_u256_lesser_or_equal(calc_number_add(anchor,\x20duration))\x20—\x20Clock\x20<=\x20anchor+N.\x20NEVER\x20greater_or_equal(end_time):\x20inverts\x20the\x20window\x20(rejects\x20everything\x20inside\x20it,\x20admits\x20everything\x20after\x20it).\x20See\x20pattern.deadline_window','Multi-condition:\x20logic_and\x20combining\x20multiple\x20checks'],'mutable_after_publish':!![],'r_rounds_focus':['R1','R2','R3','R5','R7','R9']},{'id':'service_order_allocators_guard','name':'Allocation\x20strategy\x20selection\x20validation\x20(order_allocators[].guard)','host_object':'Service','binding_field':'order_allocators','validation_scene':'When\x20an\x20order\x20is\x20completed\x20or\x20allocation\x20conditions\x20are\x20met,\x20the\x20caller\x20submits\x20ONE\x20guard.\x20Every\x20allocator\x20bound\x20to\x20that\x20guard\x20fires,\x20in\x20vector\x20order,\x20each\x20against\x20the\x20balance\x20left\x20by\x20the\x20previous\x20(allocation.move:366-368).','pass_result':'Execute\x20the\x20allocation\x20strategy\x20for\x20every\x20allocator\x20bound\x20to\x20the\x20submitted\x20guard','fail_result':'If\x20the\x20submitted\x20guard\x20does\x20not\x20match\x20any\x20allocator\x27s\x20guard,\x20or\x20if\x20the\x20guard\x27s\x20conditions\x20fail,\x20no\x20funds\x20are\x20distributed','submission_source':'System\x20auto-derives\x20from\x20Progress\x20state\x20(no\x20explicit\x20customer\x20submission\x20needed)','special_constraints':['A\x20distribution\x20call\x20submits\x20ONE\x20guard;\x20every\x20allocator\x20bound\x20to\x20that\x20guard\x20fires\x20in\x20vector\x20order\x20against\x20the\x20shrinking\x20pool\x20(allocation.move:366-368).\x20Allocator\x20list\x20order\x20determines\x20the\x20firing\x20sequence\x20when\x20multiple\x20allocators\x20share\x20the\x20same\x20guard,\x20NOT\x20which\x20path\x20is\x20selected','order_allocators\x20cannot\x20be\x20modified\x20after\x20Service\x20is\x20published\x20(immutable)','Guard\x20usually\x20queries\x20Order/Progress\x20state\x20to\x20determine\x20allocation\x20conditions','Common\x20queries:\x20order.amount,\x20progress.current_node,\x20order.completed,\x20etc.','GuardIdentifier\x20can\x20be\x20used\x20for\x20dynamic\x20amounts\x20(extract\x20u64\x20value\x20from\x20table\x20as\x20allocation\x20ratio)','Guard+sharing\x20coupling:\x20Guard\x20determines\x20IF\x20allocation\x20happens;\x20sharing.who\x20determines\x20WHERE\x20funds\x20go.\x20If\x20sharing.who=Signer,\x20the\x20caller\x20receives\x20funds\x20—\x20the\x20Guard\x20MUST\x20bind\x20Signer\x20(context(Signer)==authorized)\x20to\x20prevent\x20theft.\x20PREFERRED:\x20use\x20sharing.who=Entity\x20(Treasury\x20or\x20fixed\x20address)\x20so\x20funds\x20always\x20go\x20to\x20the\x20legitimate\x20recipient\x20regardless\x20of\x20caller.','allocators\x20require\x20unique\x20guard\x20addresses\x20when\x20they\x20represent\x20alternative\x20paths:\x20bind\x20each\x20path\x20to\x20its\x20OWN\x20Guard\x20object\x20(they\x20may\x20share\x20root/table\x20but\x20must\x20differ\x20in\x20description).\x20Same-guard\x20allocators\x20fire\x20sequentially\x20on\x20the\x20same\x20call,\x20which\x20is\x20only\x20correct\x20for\x20intended\x20waterfalls\x20(fee\x20first,\x20then\x20split\x20remainder)','Every\x20allocator\x20bound\x20to\x20the\x20submitted\x20guard\x20fires\x20in\x20vector\x20order.\x20Alternative\x20business\x20paths\x20(settle\x20vs\x20refund\x20vs\x20damage)\x20must\x20use\x20DIFFERENT\x20guards\x20—\x20the\x20caller\x27s\x20guard\x20choice\x20selects\x20the\x20path,\x20not\x20the\x20allocator\x20list\x20position','If\x20sharing.who=Entity\x20references\x20a\x20Treasury\x20object,\x20verify\x20the\x20Treasury\x27s\x20permission\x20is\x20consistent\x20with\x20the\x20Service\x27s\x20permission\x20(different\x20permissions\x20=\x20different\x20permission\x20organizations\x20=\x20minor\x20risk).','Reentrancy:\x20LOW\x20—\x20Protocol-level\x20protection:\x20the\x20Order\x20layer\x20asserts\x20the\x20`allocation`\x20field\x20is\x20None\x20(E_ALLOCATION_ALREADY_SPECIFIED),\x20enforcing\x20ONE\x20Allocation\x20object\x20per\x20Order,\x20ever.\x20After\x20alloc()\x20executes,\x20typical\x20Rate-mode\x20allocators\x20(sum=10000)\x20and\x20any\x20Surplus-mode\x20allocator\x20drain\x20balance\x20to\x200\x20via\x20balance::withdraw_all,\x20making\x20a\x20second\x20alloc()\x20fail\x20at\x20`assert!(balance\x20>=\x20threshold)`.\x20EDGE\x20CASE:\x20Amount-mode-only\x20allocators\x20(no\x20Surplus,\x20total\x20<\x20full\x20balance)\x20leave\x20remainder;\x20a\x20second\x20alloc()\x20could\x20extract\x20more\x20—\x20mitigated\x20by\x20preferring\x20Rate/Surplus\x20modes.\x20External\x20deposit\x20via\x20receive()\x20is\x20possible\x20but\x20irrational\x20(attacker\x20funds\x20the\x20Allocation\x20they\x20attack).\x20Optional\x20anti-reentrancy\x20primitive:\x20`order.allocation\x20some`\x20(query\x201568)\x20+\x20logic_not'],'common_patterns':['Node\x20state\x20check:\x20query(Progress.current_node)\x20+\x20logic_equal(\x27Completed\x27)','Amount\x20threshold:\x20query(Order.amount)\x20+\x20logic_as_u256_greater_or_equal(threshold)','Multi-condition\x20combination:\x20logic_and\x20(node\x20state\x20+\x20amount\x20+\x20time)','GuardIdentifier\x20dynamic\x20ratio:\x20table[u64]\x20extracts\x20allocation\x20ratio','Treasury+personal\x202-allocator\x20pattern:\x202\x20Guard\x20objects\x20(identical\x20root/table,\x20different\x20descriptions)\x20+\x202\x20allocators\x20(sharing.who=Entity\x20Treasury\x20/\x20Entity\x20personal)\x20—\x202\x20alternative\x20merchant\x20collection\x20approaches\x20bound\x20to\x20DIFFERENT\x20guards;\x20the\x20caller\x27s\x20guard\x20choice\x20selects\x20which\x20allocator\x20fires'],'mutable_after_publish':![],'r_rounds_focus':['R1','R2','R3','R5','R6','R7']},{'id':'machine_forward_guard','name':'Workflow\x20node\x20advancement\x20validation\x20(Forward.guard)','host_object':'Machine','binding_field':'Forward.guard','validation_scene':'When\x20a\x20customer\x20or\x20provider\x20executes\x20a\x20Forward\x20operation\x20to\x20advance\x20the\x20workflow,\x20the\x20Guard\x20validates\x20whether\x20advancement\x20to\x20the\x20next\x20node\x20is\x20allowed','pass_result':'Progress\x20advances\x20to\x20next_node;\x20session\x20accumulates\x20weight','fail_result':'Forward\x20is\x20blocked;\x20Progress\x20stays\x20at\x20the\x20current\x20node.\x20Optional\x20retained_submission\x20retains\x20audit\x20data','submission_source':'The\x20party\x20executing\x20Forward\x20(Customer\x20or\x20Provider,\x20depending\x20on\x20Forward\x20configuration)','special_constraints':['Forward.guard\x20cannot\x20be\x20modified\x20after\x20Machine\x20is\x20published\x20(a\x20new\x20Machine\x20must\x20be\x20created)','Optional\x20retained_submission:\x20stores\x20submission\x20data\x20in\x20Progress\x20for\x20later\x20audit','retained_submission\x20indices\x20must\x20correspond\x20to\x20the\x20Guard\x20table','Common\x20queries:\x20progress.current_node,\x20progress.session_forward,\x20order.service,\x20etc.','Fund\x20gate\x20(crs\x20P2-3):\x20allocation.balance\x20(query\x201051;\x20witness\x20TypeOrderAllocation(109)\x20resolves\x20it\x20from\x20the\x20Order\x20address)\x20gates\x20a\x20forward\x20on\x20the\x20order\x27s\x20escrow\x20balance\x20—\x20the\x20canonical\x20renewal-loop\x20convention\x20is\x20balance\x20>=\x20new-period\x20price','Time\x20lock:\x20context(Clock)\x20+\x20calc_number_add(progress.current_time,\x20duration)\x20tested\x20with\x201000ms','Reentrancy:\x20ALLOWED\x20—\x20By\x20design,\x20Forward\x20moves\x20progress.current_node\x20to\x20next_node,\x20naturally\x20invalidating\x20the\x20Guard\x20at\x20the\x20old\x20node.\x20Re-submission\x20at\x20the\x20SAME\x20node\x20(before\x20forward\x20completes)\x20is\x20intentional:\x20users\x20may\x20fix\x20prior\x20submission\x20data\x20or\x20accumulate\x20session\x20weight\x20toward\x20threshold.\x20No\x20anti-reentrancy\x20primitive\x20needed.\x20Optional\x20observability\x20queries:\x20`progress.session_forward`\x20(1262),\x20`progress.history`\x20(1273),\x20`query_progress_history_find`\x20(1274)'],'common_patterns':['Identity\x20check:\x20context(Signer)\x20+\x20logic_equal\x20(only\x20specific\x20parties\x20can\x20advance)','Time\x20lock:\x20context(Clock)\x20+\x20calc_number_add\x20+\x20logic_as_u256_greater_or_equal','Prior\x20Forward\x20completion:\x20query_progress_history_find\x20+\x20logic_equal(accomplished=true)','Submission\x20data\x20validation:\x20identifier(submission)\x20+\x20logic_equal(expected_value)','Cross-object\x20query:\x20convert_witness=TypeOrderProgress(100)\x20queries\x20Progress\x20from\x20Order;\x20convert_witness=TypeOrderAllocation(109)\x20queries\x20the\x20Allocation\x20(escrow)\x20from\x20Order'],'mutable_after_publish':![],'r_rounds_focus':['R1','R2','R3','R5','R6','R7','R8','R9']},{'id':'progress_submission_guard','name':'Progress\x20submission\x20data\x20validation\x20(submission\x20guard)','host_object':'Progress','binding_field':'submission','validation_scene':'Whether\x20the\x20data\x20(e.g.\x20signature,\x20credential,\x20confirmation)\x20submitted\x20during\x20Forward\x20execution\x20satisfies\x20the\x20Guard\x20condition','pass_result':'Forward\x20completes;\x20node\x20advances\x20after\x20session\x20accumulates\x20weight\x20to\x20threshold','fail_result':'Forward\x20does\x20not\x20complete;\x20waits\x20for\x20resubmission\x20or\x20condition\x20satisfaction','submission_source':'The\x20party\x20submitting\x20data\x20(Customer\x20or\x20Provider)','special_constraints':['Works\x20in\x20concert\x20with\x20Forward.guard:\x20Forward.guard\x20validates\x20eligibility,\x20submission\x20guard\x20validates\x20data','retained_submission\x20stores\x20submission\x20data\x20in\x20Progress\x20session\x20for\x20audit','Common\x20queries:\x20progress.session_forward,\x20progress.session_weight,\x20etc.','Reentrancy:\x20ALLOWED\x20—\x20Multiple\x20submissions\x20accumulate\x20session\x20weight\x20toward\x20threshold\x20by\x20design.\x20Re-submission\x20is\x20the\x20intended\x20mechanism\x20for\x20reaching\x20threshold;\x20no\x20anti-reentrancy\x20primitive\x20needed'],'common_patterns':['Signature\x20validation:\x20identifier(signature_submission)\x20+\x20logic_equal(expected)','Credential\x20validation:\x20query(Repository.data)\x20+\x20logic_equal(submission_proof)','Confirmation\x20validation:\x20identifier(confirm_submission)\x20+\x20logic_equal(true)'],'mutable_after_publish':![],'r_rounds_focus':['R1','R2','R3','R5','R6','R8']},{'id':'reward_claim','name':'Reward\x20claim\x20validation\x20(Reward.guard)','host_object':'Reward','binding_field':'guard','validation_scene':'When\x20a\x20user\x20claims\x20from\x20a\x20reward\x20pool,\x20the\x20Guard\x20validates\x20eligibility\x20to\x20claim','pass_result':'Reward\x20is\x20distributed\x20to\x20the\x20Claimant\x20and\x20recorded\x20in\x20reward_record','fail_result':'Claim\x20rejected;\x20reward\x20is\x20not\x20distributed','submission_source':'Claimant\x20(address,\x20credentials,\x20Passport)','special_constraints':['One-time\x20claim:\x20the\x20recipient-scoped\x20record\x20gate\x20—\x20query(\x27reward.record.exists_where\x27,\x20object=reward,\x20where={})\x20with\x20an\x20EMPTY\x20where\x20wrapped\x20in\x20logic_not\x20—\x20is\x20the\x20ONLY\x20replay\x20defense\x20you\x20may\x20rely\x20on\x20today.\x20DEPLOYED-BINARY\x20CAUTION\x20(DEPLOY-K1):\x20the\x20chain-side\x20once-slot\x20(E_CLAIM_ALREADY_MADE\x2013)\x20and\x20the\x20non-sender\x20payee\x20abort\x20(E_CLAIM_RECIPIENT_NOT_SIGNER\x2014)\x20exist\x20in\x20the\x20HEAD\x20framework\x20source\x20(MOV-PROTOCOL-1212)\x20but\x20were\x20measured\x20ABSENT\x20on\x20the\x20deployed\x20mainnet\x20package\x20(klk/ptrn-mn-261013:\x20the\x20same\x20claim\x20paid\x20twice;\x20the\x20once-key\x20field\x20never\x20written)\x20—\x20never\x20treat\x20the\x20chain\x20as\x20the\x20second\x20line\x20of\x20defense\x20until\x20the\x20deployment\x20lands.\x20Verify\x20the\x20chain\x20generation\x20via\x20wowok_buildin_info\x20info=\x27upgrade_check\x27\x20(build_stamp.chain_stamp)\x20before\x20dropping\x20any\x20client-side\x20gate\x20leg','Guard\x20usually\x20queries\x20history\x20records\x20+\x20time\x20conditions\x20+\x20identity\x20validation','If\x20the\x20Reward\x20references\x20a\x20Service,\x20use\x20the\x20circular\x20reference\x20pattern','Reentrancy:\x20the\x20chain-side\x20once-slot\x20(per-(recipient,\x20guard,\x20store_from\x20value)\x20dynamic-field\x20key\x20—\x20empty\x20slot\x20=\x20once\x20per\x20recipient,\x20a\x20store_from\x20value\x20pins\x20a\x20per-order\x20slot)\x20is\x20HEAD-SOURCE\x20ONLY\x20(MOV-PROTOCOL-1212)\x20and\x20NOT\x20yet\x20confirmed\x20on\x20the\x20deployed\x20binary\x20(DEPLOY-K1:\x20double-claim\x20measured\x20on\x20mainnet).\x20The\x20recipient-scoped\x20gate\x20(query\x201629\x20EMPTY\x20where\x20+\x20logic_not)\x20is\x20therefore\x20the\x20load-bearing\x20defense,\x20NOT\x20a\x20UX\x20pre-check;\x20keep\x20the\x20identity\x20leg\x20Signer\x20==\x20order.owner\x20as\x20defense-in-depth\x20(the\x20payee-must-be-sender\x20abort,\x20E_CLAIM_RECIPIENT_NOT_SIGNER\x2014,\x20is\x20likewise\x20head-source\x20until\x20the\x20deployment\x20lands).\x20NEVER\x20bind\x20storeFromId\x20in\x20the\x20where\x20of\x20LEGACY\x20rewards\x20—\x20old\x20claim\x20records\x20carry\x20no\x20store_from\x20key\x20so\x20the\x20filter\x20matches\x20nothing\x20(silent\x20no-op);\x20strict\x20once-per-order\x20semantics\x20stay\x20on\x20the\x20254\x20task-binding\x20Allocation\x20leg'],'common_patterns':['One-time\x20claim:\x20query_reward_record_count(recipient)\x20+\x20logic_equal(0)','Time\x20window:\x20context(Clock)\x20+\x20logic_as_u256_greater_or_equal(start_time)\x20opens\x20claiming\x20from\x20start\x20onwards;\x20a\x20claim\x20DEADLINE\x20needs\x20the\x20opposite\x20direction\x20—\x20logic_as_u256_lesser_or_equal(calc_number_add(start_time,\x20duration))\x20i.e.\x20Clock\x20<=\x20start+N.\x20NEVER\x20greater_or_equal(end_time)\x20(inverts:\x20whole\x20window\x20rejected,\x20everything\x20after\x20admitted).\x20See\x20pattern.deadline_window','Identity\x20validation:\x20context(Signer)\x20+\x20vec_contains_address(allowlist)','Multi-condition:\x20logic_and\x20(identity\x20+\x20time\x20+\x20not\x20claimed\x20before)'],'mutable_after_publish':!![],'r_rounds_focus':['R1','R2','R3','R5','R7','R8','R9']},{'id':'repository_write_guard','name':'Repository\x20write\x20validation\x20(write_guard)','host_object':'Repository','binding_field':'write_guard','validation_scene':'When\x20writing\x20to\x20on-chain\x20storage,\x20the\x20Guard\x20validates\x20write\x20eligibility\x20and\x20optionally\x20extracts\x20data','pass_result':'Write\x20succeeds;\x20optional\x20id_from_submission\x20extracts\x20the\x20entity\x20ID,\x20data_from_submission\x20extracts\x20the\x20data\x20value','fail_result':'Write\x20rejected','submission_source':'Writer/Reader','special_constraints':['The\x20table\x20entry\x20referenced\x20by\x20id_from_submission\x20must\x20be\x20of\x20Address\x20type','The\x20table\x20entry\x20referenced\x20by\x20data_from_submission\x20must\x20match\x20the\x20Repository\x27s\x20value_type','Type\x20mismatch\x20leads\x20to\x20write\x20failure\x20or\x20data\x20corruption','Commonly\x20used\x20for\x20oracle\x20data\x20writes,\x20third-party\x20credential\x20attestation,\x20etc.','Reentrancy:\x20LOW\x20—\x20Default\x20writes\x20are\x20idempotent\x20(same\x20ID\x20overwrites,\x20different\x20ID\x20appends);\x20no\x20fund\x20flow.\x20one-write-per-ID\x20(e.g.\x20voting,\x20immutable\x20credential,\x20single-attestation)\x20is\x20NOT\x20enforceable\x20on\x20the\x20write\x20side\x20TODAY\x20(ofn-mn-261012\x20F-02,\x20mainnet\x20A/B\x20verified):\x20the\x20write\x20guard\x20is\x20verified\x20inside\x20the\x20write\x20PTB\x20and\x20repository.data\x20is\x20an\x20UPSERT\x20—\x20a\x20`repository.data\x20has`\x20(query\x201166)\x20+\x20`logic_not`\x20leg\x20ALWAYS\x20aborts\x20at\x20the\x20write\x20site;\x20do\x20NOT\x20emit\x20it.\x20Usable\x20TODAY:\x20the\x20protocol-255\x20ONCE\x20slot\x20(per\x20guard\x20pool)\x20plus\x20the\x20254\x20task-binding\x20slot\x20(per-order\x20scoping);\x20per-row\x20value\x20ranges\x20(e.g.\x20rating\x201-5)\x20go\x20through\x20a\x20Repository\x20write\x20policy.\x20A\x20chain-side\x20write-guard\x20post-state\x20read\x20is\x20on\x20the\x20protocol\x20decision\x20list','CONTENT\x20BLIND\x20SPOT\x20(testnet\x20test-14\x20HIGH-04):\x20under\x20id_from=None\x20the\x20chain\x20asserts\x20only\x20that\x20the\x20write_guard\x20LIST\x20is\x20non-empty\x20(the\x20Repository\x20policy-creation\x20entry,\x20repository.move\x20L511-536,\x20E_POLICY_WRITE_GUARD_REQUIRED=22)\x20—\x20never\x20what\x20a\x20listed\x20Guard\x20proves.\x20A\x20guard\x20that\x20returns\x20true\x20for\x20every\x20caller\x20(constant-true\x20leaf,\x20self-comparison,\x20unsigned\x20>=\x200)\x20therefore\x20publishes\x20as\x20\x27guarded\x27\x20while\x20being\x20an\x20OPEN\x20write:\x20any\x20address\x20can\x20add\x20or\x20overwrite\x20any\x20row,\x20and\x20rows\x20carry\x20no\x20author\x20field.\x20Rule\x20R-X1-17\x20folds\x20the\x20tree\x20and\x20reports\x20it;\x20generate\x20the\x20guard\x20from\x20pattern.repository_write_authorization\x20(an\x20identity\x20leaf\x20—\x20context(Signer)\x20/\x20allowlist\x20/\x20Permission\x20staff\x20/\x20Order\x20holder\x20—\x20is\x20mandatory).\x20Under\x20id_from=Signer|Clock\x20the\x20list\x20MAY\x20stay\x20non-empty,\x20but\x20every\x20PolicyGuard\x27s\x20id_from_submission\x20must\x20be\x20None\x20(E_POLICY_ID_FROM_SUBMISSION_FORBIDDEN=23)'],'common_patterns':['Authorized\x20writer:\x20context(Signer)\x20+\x20vec_contains_address(authorized_writers)','Data\x20format\x20validation:\x20identifier(data_submission)\x20+\x20logic_string_contains(expected_prefix)','ID\x20extraction:\x20id_from_submission\x20+\x20data_from_submission\x20combination'],'mutable_after_publish':!![],'r_rounds_focus':['R1','R2','R3','R5','R6','R7']},{'id':'arbitration_usage_guard','name':'Dispute\x20initiation\x20validation\x20(usage_guard)','host_object':'Arbitration','binding_field':'usage_guard','validation_scene':'When\x20a\x20customer\x20initiates\x20a\x20dispute\x20against\x20an\x20order,\x20the\x20Guard\x20validates\x20whether\x20the\x20customer\x20is\x20eligible\x20to\x20initiate\x20the\x20dispute','pass_result':'Create\x20an\x20Arb\x20case\x20and\x20enter\x20the\x20arbitration\x20flow','fail_result':'Dispute\x20rejected;\x20Arb\x20is\x20not\x20created','submission_source':'Customer\x20(Passport\x20credential)','special_constraints':['When\x20Arbitration\x20bPaused=true,\x20it\x20blocks\x20first\x20(before\x20the\x20Guard\x20check)','The\x20customer\x20must\x20first\x20generate\x20a\x20Passport\x20(gen_passport\x20passes\x20usage_guard)','Common\x20queries:\x20order.completed,\x20order.service,\x20entity.has,\x20etc.','Guard\x20validates\x20customer\x20identity\x20+\x20order\x20status\x20+\x20dispute\x20eligibility','Reentrancy:\x20HIGH\x20—\x20Guard\x20pass\x20creates\x20a\x20new\x20Arb\x20case.\x20Without\x20anti-reentrancy,\x20a\x20customer\x20can\x20create\x20multiple\x20Arb\x20cases\x20for\x20the\x20SAME\x20Order\x20(up\x20to\x20MAX_DISPUTE_COUNT=10),\x20harassing\x20the\x20counterparty\x20and\x20inflating\x20arbitration\x20system\x20load.\x20Not\x20direct\x20fund\x20loss,\x20but\x20severe\x20system\x20abuse.\x20Note:\x20the\x20dispute\x20entry\x20point\x20deduplicates\x20by\x20Arb\x20address\x20but\x20does\x20NOT\x20prevent\x20multiple\x20distinct\x20Arbs\x20for\x20the\x20same\x20Order.\x20REQUIRED\x20anti-reentrancy\x20primitive\x20(any\x20one):\x20`order.dispute\x20has`\x20(query\x201565,\x20Bool,\x20per-Arb\x20check)\x20+\x20`logic_not`;\x20OR\x20`order.dispute\x20count`\x20(query\x201564,\x20U64)\x20+\x20`logic_equal(0)`\x20(strict:\x20block\x20any\x20prior\x20dispute)\x20or\x20`logic_as_u256_lesser_or_equal(N)`\x20(lenient:\x20allow\x20up\x20to\x20N\x20disputes)'],'common_patterns':['Order\x20status\x20validation:\x20query(Order.status)\x20+\x20logic_equal(\x27completed\x27)','Membership\x20validation:\x20query(EntityRegistrar)\x20+\x20logic_and','Dispute\x20deadline\x20window:\x20context(Clock)\x20+\x20logic_as_u256_lesser_or_equal(calc_number_add(query(Order.time),\x20N))\x20—\x20Clock\x20<=\x20order_time+N\x20closes\x20disputes\x20after\x20N;\x20a\x20bare\x20query(Order.time)\x20+\x20calc_number_add\x20+\x20context(Clock)\x20chain\x20has\x20NO\x20comparison\x20direction\x20and\x20guards\x20nothing.\x20See\x20pattern.deadline_window','Passport\x20credential:\x20identifier(passport_submission)\x20+\x20context(Signer)'],'mutable_after_publish':!![],'r_rounds_focus':['R1','R2','R3','R5','R7','R8','R9']},{'id':'arbitration_voting_guard','name':'Arbitration\x20voting\x20weight\x20validation\x20(voting_guard[])','host_object':'Arbitration','binding_field':'voting_guard','validation_scene':'When\x20an\x20arbitrator\x20votes,\x20the\x20Guard\x20validates\x20voting\x20eligibility\x20and\x20extracts\x20the\x20voting\x20weight\x20(u32)\x20from\x20GuardIdentifier','pass_result':'Vote\x20is\x20counted;\x20weight\x20is\x20the\x20value\x20extracted\x20by\x20GuardIdentifier','fail_result':'Vote\x20rejected','submission_source':'Voter\x20(Passport\x20credential\x20with\x20weight\x20data)','special_constraints':['The\x20table\x20entry\x20referenced\x20by\x20GuardIdentifier\x20must\x20be\x20of\x20a\x20numeric\x20type\x20(U8-U256),\x20cast\x20to\x20u32','Non-numeric\x20types\x20cause\x20E_GUARD_IDENTIFIER_NOT_NUMBER\x20error','b_submission\x20must\x20be\x20true\x20(weight\x20is\x20submitted\x20at\x20runtime\x20by\x20the\x20voter)','Multiple\x20voting_guards\x20can\x20be\x20configured,\x20each\x20corresponding\x20to\x20a\x20different\x20voter\x20group','When\x20Arbitration\x20bPaused=true,\x20voting\x20is\x20blocked','Reentrancy:\x20CRITICAL\x20—\x20Guard\x20pass\x20counts\x20the\x20vote\x20with\x20the\x20extracted\x20weight.\x20Without\x20anti-reentrancy,\x20the\x20same\x20voter\x20can\x20vote\x20MULTIPLE\x20times,\x20multiplying\x20their\x20weight\x20and\x20skewing\x20the\x20arbitration\x20result\x20(which\x20directly\x20determines\x20fund\x20ownership\x20via\x20compensation).\x20The\x20voter\x27s\x20eligibility\x20(identity,\x20reputation)\x20does\x20NOT\x20naturally\x20invalidate\x20after\x20voting.\x20REQUIRED\x20anti-reentrancy\x20primitive\x20(any\x20one):\x20`arb.voted\x20has`\x20(query\x201404,\x20Bool,\x20per-voter)\x20+\x20`logic_not`;\x20OR\x20`arb.voted.agree\x20has`\x20(query\x201406,\x20Bool,\x20per-voter-per-proposition)\x20+\x20`logic_not`;\x20OR\x20`arb.voted.agree\x20count`\x20(query\x201405,\x20U64,\x20per-voter)\x20+\x20`logic_equal(0)`.\x20Note:\x20`arb.voted_count`\x20(1403)\x20is\x20total\x20voter\x20count\x20(NOT\x20per-voter)\x20and\x20does\x20NOT\x20serve\x20as\x20an\x20anti-reentrancy\x20primitive\x20for\x20individual\x20voters'],'common_patterns':['Reputation\x20score\x20weight:\x20query(EntityRegistrar.records[reputation])\x20+\x20GuardIdentifier(u64)','Fixed\x20weight:\x20identifier(constant_weight)\x20+\x20GuardIdentifier','Multi-tier\x20voting:\x20different\x20voting_guards\x20correspond\x20to\x20different\x20weight\x20tiers','Eligibility\x20+\x20weight:\x20logic_and\x20(eligibility\x20check\x20+\x20GuardIdentifier\x20extracts\x20weight)'],'mutable_after_publish':!![],'r_rounds_focus':['R1','R2','R3','R5','R6','R7','R8','R9']},{'id':'gen_passport_guard','name':'Passport\x20credential\x20generation\x20validation\x20(gen_passport)','host_object':'Standalone','binding_field':'none','validation_scene':'When\x20a\x20user\x20calls\x20gen_passport,\x20the\x20Guard\x20validates\x20user\x20eligibility\x20and\x20generates\x20a\x20Passport\x20with\x20credentials','pass_result':'Passport\x20is\x20generated,\x20containing\x20credentials\x20validated\x20by\x20the\x20Guard','fail_result':'Passport\x20generation\x20fails;\x20the\x20user\x20did\x20not\x20pass\x20validation','submission_source':'Passport\x20applicant\x20(signer\x20+\x20credentials)','special_constraints':['quote_guard\x20is\x20a\x20RIGID\x20verification\x20requirement\x20when\x20querying\x20Repository\x20data\x20(query\x201167)','Two-phase:\x20passport\x20generation\x20scans\x20guard\x20+\x20prepares\x20quote_guard,\x20passport\x20verification\x20re-checks\x20+\x20verifies','If\x20quote_guard==None:\x20Repository\x20data\x20is\x20freely\x20queryable\x20(no\x20access\x20control)','Guard\x20can\x20be\x20created\x20standalone\x20(not\x20bound\x20to\x20a\x20specific\x20Host\x20Object)','Guard\x20can\x20be\x20depended\x20on\x20by\x20other\x20Guards\x20via\x20rely\x20(requires\x20rep=true)','The\x20Passport\x20generated\x20by\x20gen_passport\x20can\x20be\x20used\x20as\x20submission\x20data\x20for\x20subsequent\x20operations','Reentrancy:\x20LOW\x20—\x20Each\x20gen_passport\x20call\x20generates\x20an\x20independent\x20Passport\x20(one\x20Passport\x20per\x20operation).\x20Multiple\x20Passports\x20for\x20the\x20same\x20user\x20are\x20usually\x20valid\x20(each\x20serves\x20a\x20different\x20subsequent\x20operation).\x20IF\x20business\x20intent\x20is\x20\x27one\x20active\x20Passport\x20per\x20user\x27,\x20an\x20anti-reentrancy\x20check\x20is\x20needed\x20but\x20no\x20direct\x20GUARDQUERY\x20primitive\x20exists\x20—\x20use\x20off-chain\x20tracking\x20or\x20a\x20Repository\x20to\x20record\x20issued\x20Passport\x20IDs'],'common_patterns':['Identity\x20validation:\x20context(Signer)\x20+\x20logic_equal\x20(single\x20address/whitelist)','Membership\x20eligibility:\x20query(EntityRegistrar)\x20+\x20logic_equal','Reputation\x20threshold:\x20query(EntityRegistrar.records[reputation])\x20+\x20logic_as_u256_greater_or_equal','Multi-condition\x20combination:\x20logic_and\x20(identity\x20+\x20eligibility\x20+\x20reputation)'],'mutable_after_publish':![],'r_rounds_focus':['R1','R2','R3','R5','R6','R7']}];export function findScene(a,b){return GUARD_SCENES['find'](c=>c['host_object']===a&&c['binding_field']===b);}export function inferSceneFromAction(a){const b={'buy':'service_buy_guard','forward':'machine_forward_guard','allocate':'service_order_allocators_guard','claim_reward':'reward_claim','vote':'arbitration_voting_guard','dispute':'arbitration_usage_guard','write_repository':'repository_write_guard','submit_progress':'progress_submission_guard','gen_passport':'gen_passport_guard'},c=b[a];return GUARD_SCENES['find'](d=>d['id']===c);}export function getImmutableScenes(){return GUARD_SCENES['filter'](a=>!a['mutable_after_publish']);}export function getNumericIdentifierScenes(){return GUARD_SCENES['filter'](a=>a['special_constraints']['some'](b=>b['includes']('numeric')||b['includes']('GuardIdentifier')));}
@@ -1 +1 @@
1
- import{validateGuardData,MAX_DESCRIPTION_LENGTH,MAX_GUARD_TABLE_ITEM_LENGTH,MAX_NAME_LENGTH,ValueType}from'@wowok/wowok';import{evaluateGuardDraft}from'./guard-eval.js';import{findScene,inferSceneFromAction}from'./guard-ledger.js';import{suggestTemplateForScene}from'./guard-templates.js';import{validateGuardTreeShape}from'./guard-render.js';import{isBoolReturningQuery}from'../schema/utils/guard-query-utils.js';import{valueTypeName}from'./guard-submission-brief.js';const VALUE_TYPE_ID_TO_NAME={[ValueType['Bool']]:'Bool',[ValueType['Address']]:'Address',[ValueType['String']]:'String',[ValueType['U8']]:'U8',[ValueType['U16']]:'U16',[ValueType['U32']]:'U32',[ValueType['U64']]:'U64',[ValueType['U128']]:'U128',[ValueType['U256']]:'U256',[ValueType['VecBool']]:'VecBool',[ValueType['VecAddress']]:'VecAddress',[ValueType['VecString']]:'VecString',[ValueType['VecU8']]:'VecU8',[ValueType['VecU16']]:'VecU16',[ValueType['VecU32']]:'VecU32',[ValueType['VecU64']]:'VecU64',[ValueType['VecU128']]:'VecU128',[ValueType['VecU256']]:'VecU256',[ValueType['VecVecU8']]:'VecVecU8'};function normalizeValueTypeNames(a){if(!a['table']['some'](b=>typeof b['value_type']==='number'))return a;return{...a,'table':a['table']['map'](b=>typeof b['value_type']==='number'?{...b,'value_type':VALUE_TYPE_ID_TO_NAME[b['value_type']]??String(b['value_type'])}:b)};}function deepClone(a){return JSON['parse'](JSON['stringify'](a));}function rootToString(a){return JSON['stringify'](a);}function canonicalNode(a){if(a===null||typeof a!=='object')return JSON['stringify'](a)??'null';if(Array['isArray'](a))return'['+a['map'](canonicalNode)['join'](',')+']';const b=Object['keys'](a)['sort']();return'{'+b['map'](c=>JSON['stringify'](c)+':'+canonicalNode(a[c]))['join'](',')+'}';}const GE_NODE='logic_as_u256_greater_or_equal',LE_NODE='logic_as_u256_lesser_or_equal';function findDegenerateTimeWindows(a){const b=[],c=new Set(),d=g=>{const h=g['filter'](j=>j?.['type']===GE_NODE&&Array['isArray'](j['nodes'])&&j['nodes']['length']>=0x2),i=g['filter'](j=>j?.['type']===LE_NODE&&Array['isArray'](j['nodes'])&&j['nodes']['length']>=0x2);for(const j of h){for(const k of i){const l=canonicalNode(j['nodes'][0x0])===canonicalNode(k['nodes'][0x0]),m=canonicalNode(j['nodes'][0x1])===canonicalNode(k['nodes'][0x1]);if(!l||!m)continue;const n=canonicalNode(j)+'|'+canonicalNode(k);if(c['has'](n))continue;c['add'](n),b['push']({'ge':j,'le':k});}}},e=g=>{if(g?.['type']==='logic_and'&&Array['isArray'](g['nodes']))return g['nodes']['flatMap'](e);return[g];},f=g=>{if(!g||typeof g!=='object')return;if(g['type']==='logic_not')return;if(g['type']==='logic_and'&&Array['isArray'](g['nodes'])){const h=e(g);d(h),h['forEach'](f);return;}if(g['type']==='logic_or'&&Array['isArray'](g['nodes'])){for(const i of g['nodes']){i?.['type']==='logic_and'&&Array['isArray'](i['nodes'])?(d(i['nodes']),i['nodes']['forEach'](f)):f(i);}return;}if(g['type']===GE_NODE||g['type']===LE_NODE)d([g]);if(Array['isArray'](g['nodes']))g['nodes']['forEach'](f);};return f(a),b;}function hasSignerContext(a){const b=rootToString(a);return b['includes']('\x22Signer\x22')||b['includes']('\x22context\x22:\x22Signer\x22')||b['includes']('\x22context\x22:\x20\x22Signer\x22');}function getSubmissionEntries(a){return a['filter'](b=>b['b_submission']===!![]);}function inferValueType(a){if(typeof a==='string'){if(a['startsWith']('0x')&&a['length']>=0x3)return'Address';return'String';}if(typeof a==='number'){if(Number['isInteger'](a)){if(a>=0x0&&a<=0xff)return'U8';if(a>=0x0&&a<=0xffff)return'U16';return'U64';}return'U256';}if(typeof a==='boolean')return'Bool';if(Array['isArray'](a)){if(a['length']>0x0){const b=inferValueType(a[0x0]);if(b==='Address')return'Vec<Address>';if(b==='String')return'Vec<String>';if(b==='Bool')return'Vec<Bool>';}return'Vec<Address>';}return undefined;}function sdkIssueToDiagnostic(a){return{'code':a['code'],'message':a['message'],'severity':a['severity'],'source':'sdk','location':{'path':a['path']},'fix':{'description':'SDK\x20validation\x20failed\x20('+(a['sdk_error']??'InvalidParam')+');\x20manual\x20fix\x20required','auto_fixable':![]}};}async function checkSdkSyntax(a){const b=validateGuardTreeShape(a['root']);if(b['length']>0x0)return b['map'](f=>({'code':'G-001','message':f['message'],'severity':'error','source':'sdk','location':{'path':f['path']},'fix':{'description':'Unary\x20operators\x20(logic_not,\x20value_type,\x20vec_length,\x20calc_string_length,\x20convert_*)\x20take\x20a\x20single\x20\x27node\x27\x20child;\x20only\x20multi-operand\x20forms\x20(logic_and,\x20logic_or,\x20logic_equal,\x20logic_as_u256_*,\x20calc_number_*,\x20vec_contains_*)\x20take\x20a\x20\x27nodes\x27\x20array.','auto_fixable':![]}}));const c=a['table']['map'](f=>({'identifier':f['identifier'],'b_submission':f['b_submission']??![],'value_type':f['value_type']??'Address','value':f['value'],'name':f['name']??''}));let d;try{d=await validateGuardData({'description':a['description'],'table':c,'root':a['root'],'rely':a['rely']});}catch(f){const g=f?.['message']??String(f),h=/guard tree ([^:]+):/['exec'](g);return[{'code':'G-001','message':g,'severity':'error','source':'sdk','location':{'path':h?toJsonPointer(h[0x1]):'/root'},'fix':{'description':'Repair\x20the\x20tree\x20at\x20the\x20named\x20path:\x20unary\x20operators\x20(logic_not,\x20convert_*,\x20value_type)\x20take\x20a\x20single\x20\x27node\x27\x20child;\x20only\x20multi-operand\x20forms\x20(logic_and,\x20logic_or,\x20logic_equal,\x20calc_*,\x20vec_*)\x20take\x20\x27nodes\x27.','auto_fixable':![]}}];}return d['map'](sdkIssueToDiagnostic);}function toJsonPointer(a){const b=a['replace'](/^\/+/,'');return b['startsWith']('root')?'/'+b:'/root/'+b;}function checkSemanticErrors(a){const b=[],{table:c,root:d,binding_hint:e}=a,f=e?findScene(e['host_object']??'',e['binding_field']??''):undefined,g=getSubmissionEntries(c);if(g['length']>0x0&&d&&!hasSignerContext(d)){const h=g['some'](j=>j['value_type']==='Address'),i=f?.['id']==='service_order_allocators_guard'&&e?.['sharing_recipients']!==undefined&&e['sharing_recipients']['length']>0x0&&!e['sharing_recipients']['includes']('Signer');if(h&&!i){const j=g['filter'](k=>k['value_type']==='Address')['map'](k=>c['indexOf'](k));b['push']({'code':'LE-04','message':'Submitted\x20data\x20has\x20no\x20Signer\x20binding\x20(submission\x20forgery\x20risk)','severity':'error','source':'lint','location':{'path':j['map'](k=>'/table/'+k)['join']('\x20→\x20')},'fix':{'description':'Add\x20logic_equal(context(Signer),\x20identifier[N])\x20in\x20root\x20to\x20bind\x20the\x20submitter\x20identity','auto_fixable':![]}});}}if(f?.['id']==='arbitration_voting_guard'){const k=g['some'](l=>['U8','U16','U32','U64','U128','U256']['includes'](l['value_type']??''));if(k){const l=g['filter'](m=>['U8','U16','U32','U64','U128','U256']['includes'](m['value_type']??''))['map'](m=>c['indexOf'](m));b['push']({'code':'LE-05','message':'voting_guard\x20voting\x20weight\x20comes\x20from\x20submitted\x20data\x20(weight\x20forgery\x20risk)','severity':'error','source':'lint','location':{'path':l['map'](m=>'/table/'+m)['join']('\x20→\x20')},'fix':{'description':'Derive\x20arbitrator\x20weights\x20from\x20the\x20Arb\x20object\x20via\x20witness\x20(e.g.\x20105\x20TypeArbArbitration)\x20rather\x20than\x20submitting\x20them\x20directly','auto_fixable':![]}});}}if(f?.['id']==='gen_passport_guard'||e?.['action']==='gen_passport'){const m=rootToString(d);if(m['includes']('1167')||m['includes']('repository.data')){const n=m['includes']('quote_guard');n&&b['push']({'code':'LE-06','message':'repository.data\x20query\x20with\x20quote_guard:\x20rigid\x20verification\x20requirement\x20—\x20ensure\x20Passport\x20includes\x20quote_guard\x20verification\x20with\x20necessary\x20submissions\x20(e.g.,\x20Payment\x20proof)','severity':'info','source':'lint','location':{'path':'/root'},'fix':{'description':'Ensure\x20the\x20quote_guard\x20is\x20verified:\x20user\x20submits\x20Payment\x20via\x20Passport,\x20quote_guard\x20verifies\x20Payment\x20fields,\x20repository\x20data\x20query\x20passes','auto_fixable':![]}});}}if(e?.['host_object']&&f){const o=e['host_object'],p=c['filter'](q=>!q['b_submission']&&q['value_type']==='Address'&&typeof q['value']==='string'&&q['value']['startsWith']('0x')&&q['object_type']===o);if(p['length']>0x0){const q=p['map'](r=>c['indexOf'](r));b['push']({'code':'LE-07','message':'Circular\x20reference\x20uses\x20an\x20address\x20rather\x20than\x20a\x20name\x20(Host\x20Object\x20may\x20not\x20be\x20published\x20yet\x20when\x20the\x20Guard\x20is\x20created)','severity':'error','source':'lint','location':{'path':q['map'](r=>'/table/'+r+'/value')['join']('\x20→\x20')},'fix':{'description':'Change\x20value\x20from\x20an\x20address\x20to\x20an\x20object\x20name\x20(e.g.\x20\x22service1\x22);\x20the\x20SDK\x20will\x20resolve\x20it\x20to\x20an\x20address\x20after\x20the\x20Host\x20Object\x20is\x20published','auto_fixable':![]}});}}for(const {ge:r,le:s}of findDegenerateTimeWindows(d)){b['push']({'code':'LE-08','message':'Degenerate\x20time\x20window:\x20the\x20same\x20conjunction\x20asserts\x20`L\x20>=\x20R`\x20and\x20`L\x20<=\x20R`\x20over\x20'+'structurally\x20identical\x20operands.\x20Their\x20conjunction\x20is\x20`L\x20==\x20R`\x20—\x20on\x20a\x20millisecond\x20Clock\x20'+'an\x20~1\x20ms\x20window,\x20i.e.\x20the\x20guarded\x20forward\x20is\x20effectively\x20unreachable.\x20'+'`logic_as_u256_greater_or_equal`\x20is\x20a\x20LOWER\x20bound\x20(deadline\x20passed);\x20an\x20upper\x20bound\x20'+'(`logic_as_u256_lesser_or_equal`)\x20must\x20use\x20a\x20DIFFERENT\x20right-hand\x20side.','severity':'error','source':'lint','location':{'path':'/root'},'fix':{'description':'For\x20\x22the\x20deadline\x20has\x20passed\x22,\x20keep\x20ONLY\x20`L\x20>=\x20R`\x20and\x20delete\x20the\x20`<=`\x20clause.\x20'+'For\x20\x22the\x20window\x20is\x20open\x22,\x20keep\x20both\x20clauses\x20but\x20make\x20the\x20right-hand\x20sides\x20differ,\x20'+'e.g.\x20`L\x20>=\x20t`\x20and\x20`L\x20<=\x20t\x20+\x20K`.\x20Remember\x20`progress.current_time`\x20is\x20refreshed\x20on\x20'+'every\x20forward,\x20so\x20anchoring\x20a\x20release\x20lock\x20on\x20it\x20restarts\x20the\x20clock\x20at\x20each\x20node\x20change.','auto_fixable':![]}});}{const t=[],u=(x,y)=>{if(!y||typeof y!=='object')return;if(y['type']==='query'&&y['query']!==undefined){if(!isBoolReturningQuery(y['query'])){const z=typeof y['query']==='string'?y['query']:String(y['query']);t['push']({'op':x,'describe':'query\x20'+z,'claimedByTwin':/claimed_by/i['test'](z)&&!/\bsome\b/i['test'](z)});}}else{if(y['type']==='identifier'&&y['identifier']!==undefined){const A=c['find'](C=>C['identifier']===y['identifier']),B=A?.['value_type'];B&&B!=='Bool'&&B!=='Value'&&t['push']({'op':x,'describe':'identifier\x20'+y['identifier']+'\x20(table\x20value_type\x20'+B+')','claimedByTwin':![]});}}},w=x=>{if(!x||typeof x!=='object')return;if(x['type']==='logic_not'){u('logic_not',x['node']),w(x['node']);return;}Array['isArray'](x['nodes'])&&((x['type']==='logic_and'||x['type']==='logic_or')&&x['nodes']['forEach'](y=>u(x['type'],y)),x['nodes']['forEach'](w));if(x['node'])w(x['node']);};w(d);for(const x of t){b['push']({'code':'LE-09','message':x['op']+'\x20consumes\x20a\x20non-Bool\x20leaf\x20('+x['describe']+')\x20—\x20Bool\x20operators\x20take\x20Bool\x20operands\x20only\x20(crs\x20P2-1/P2-2)'+(x['claimedByTwin']?'.\x20TEACHING:\x20order.claimed_by\x20(query\x201571)\x20returns\x20Address;\x20its\x20Bool\x20twin\x20is\x20`order.claimed_by\x20some`\x20(query\x201570)\x20—\x20use\x20THAT\x20in\x20logic_not\x20/\x20logic_equal.':'.\x20TEACHING:\x20wrap\x20the\x20leaf\x20in\x20logic_equal[leaf,\x20identifier[N]]\x20(any\x20type)\x20or\x20a\x20logic_as_u256_*\x20operator\x20(numeric\x20comparison)\x20to\x20produce\x20a\x20Bool.'),'severity':'error','source':'lint','location':{'path':'/root'},'fix':{'description':x['claimedByTwin']?'Replace\x20query\x20order.claimed_by\x20with\x20order.claimed_by\x20some\x20(query\x201570)':'Wrap\x20the\x20leaf\x20in\x20logic_equal\x20against\x20identifier[N]\x20so\x20'+x['op']+'\x20receives\x20a\x20Bool','auto_fixable':![]}});}}return b;}function checkSyntaxHints(a){const b=[],{table:c}=a;(!a['description']||a['description']['trim']()==='')&&b['push']({'code':'SH-01','message':'description\x20is\x20missing\x20or\x20empty','severity':'info','source':'lint','location':{'path':'/description'},'fix':{'description':'Add\x20a\x20description,\x20e.g.\x20\x27Service\x20buy_guard:\x20whitelist\x20validation\x27','auto_fixable':!![]}});for(let d=0x0;d<c['length'];d++){const e=c[d];(!e['name']||e['name']['trim']()==='')&&b['push']({'code':'SH-03','message':'table['+d+']\x20is\x20missing\x20name','severity':'warning','source':'lint','location':{'path':'/table/'+d+'/name'},'fix':{'description':'Add\x20a\x20name,\x20e.g.\x20\x22data\x20entry\x20'+e['identifier']+'\x22','auto_fixable':!![]}});}for(let f=0x0;f<c['length'];f++){const g=c[f];!g['value_type']&&b['push']({'code':'SH-05','message':'table['+f+']\x20is\x20missing\x20value_type','severity':'warning','source':'lint','location':{'path':'/table/'+f+'/value_type'},'fix':{'description':'Infer\x20value_type\x20from\x20value\x20(e.g.\x20Address/String/U64,\x20etc.)','auto_fixable':!![]}});}c['length']>MAX_GUARD_TABLE_ITEM_LENGTH&&b['push']({'code':'SH-07','message':'table\x20entry\x20count\x20'+c['length']+'\x20exceeds\x20the\x20maximum\x20limit\x20'+MAX_GUARD_TABLE_ITEM_LENGTH,'severity':'error','source':'lint','location':{'path':'/table'},'fix':{'description':'Slim\x20down\x20the\x20table\x20by\x20merging\x20similar\x20entries,\x20or\x20split\x20into\x20multiple\x20Guards\x20+\x20rely','auto_fixable':![]}});for(let h=0x0;h<c['length'];h++){c[h]['b_submission']===undefined&&b['push']({'code':'SH-10','message':'table['+h+']\x20b_submission\x20is\x20missing','severity':'info','source':'lint','location':{'path':'/table/'+h+'/b_submission'},'fix':{'description':'Set\x20to\x20false\x20(constant)\x20or\x20true\x20(submitted\x20data)','auto_fixable':!![]}});}for(let j=0x0;j<c['length'];j++){const k=c[j];k['b_submission']===!![]&&k['value']!==undefined&&k['value']!==null&&b['push']({'code':'SH-11','message':'table['+j+']\x20has\x20a\x20redundant\x20value\x20field\x20on\x20b_submission=true\x20entry\x20(the\x20verifier\x20supplies\x20the\x20value\x20at\x20runtime;\x20this\x20value\x20is\x20ignored\x20by\x20BCS\x20encoding\x20and\x20wastes\x20gas)','severity':'warning','source':'lint','location':{'path':'/table/'+j+'/value'},'fix':{'description':'Remove\x20the\x20value\x20field\x20—\x20it\x20is\x20ignored\x20for\x20b_submission=true\x20entries','auto_fixable':!![]}});}return b;}function checkSuggestions(a){const b=[],{root:c,binding_hint:d,table:e,description:f}=a;if(c){const i=rootToString(c);if(i['includes']('vec_contains_address')&&i['includes']('Signer'))b['push']({'code':'SG-01','message':'Matches\x20Pattern\x20P04\x20(whitelist\x20validation)','severity':'hint','source':'lint','location':{'path':'/root'},'fix':{'description':'Refer\x20to\x20the\x20P04\x20Pattern\x20to\x20ensure\x20best\x20practices','auto_fixable':![]}});else{if(i['includes']('logic_equal')&&i['includes']('Signer')){const j=e['some'](k=>!k['b_submission']&&k['value_type']==='Address'&&typeof k['value']==='string'&&k['value']['length']>0x0);j&&b['push']({'code':'SG-01','message':'Matches\x20Pattern\x20P04\x20(whitelist\x20validation\x20—\x20single-address\x20variant)','severity':'hint','source':'lint','location':{'path':'/root'},'fix':{'description':'P04\x20single-address\x20form;\x20for\x20multi-address\x20scenarios,\x20consider\x20vec_contains_address','auto_fixable':![]}});}}(i['includes']('logic_as_u256_greater')||i['includes']('logic_as_u256_lesser'))&&b['push']({'code':'SG-01','message':'Matches\x20Pattern\x20P02\x20(numeric\x20threshold\x20validation)','severity':'hint','source':'lint','location':{'path':'/root'},'fix':{'description':'Suitable\x20for\x20amount/quantity\x20threshold\x20validation\x20scenarios','auto_fixable':![]}}),i['includes']('convert_witness')&&b['push']({'code':'SG-01','message':'Matches\x20Pattern\x20P09\x20(witness-derived\x20validation)','severity':'hint','source':'lint','location':{'path':'/root'},'fix':{'description':'Suitable\x20for\x20cross-object\x20relationship\x20validation\x20(e.g.\x20Order→Progress)','auto_fixable':![]}});}if(d?.['action']){const k=['buy','forward','allocate','claim_reward','vote','dispute','write_repository','submit_progress','gen_passport'];if(k['includes'](d['action'])){const l=inferSceneFromAction(d['action']);if(l){const m=suggestTemplateForScene(l['id']);m&&b['push']({'code':'SG-02','message':'Recommended\x20scene\x20template:\x20'+m['name'],'severity':'hint','source':'lint','location':{'path':'/'},'fix':{'description':'Refer\x20to\x20template\x20'+m['id']+'\x20('+m['example_use_case']+')','auto_fixable':![]}});}}}const g=n=>new TextEncoder()['encode'](n)['length'],h=getSubmissionEntries(e);for(const [n,o]of e['entries']()){const p=o['name']??'';if(p['length']===0x0)continue;if(g(p)>MAX_NAME_LENGTH)b['push']({'code':'SG-03','message':'table['+n+']\x20name\x20is\x20'+g(p)+'\x20BCS\x20characters,\x20maximum\x20is\x20'+MAX_NAME_LENGTH+'.\x20Use\x20a\x20short\x20identifier\x20(e.g.\x20\x27order_id\x27,\x20\x27delivery_node\x27);\x20the\x20human-readable\x20explanation\x20belongs\x20in\x20the\x20Guard\x27s\x20\x27description\x27\x20field','severity':'warning','source':'lint','location':{'path':'/table/'+n+'/name'},'fix':{'description':'Shorten\x20the\x20name\x20to\x20'+MAX_NAME_LENGTH+'\x20BCS\x20characters\x20or\x20fewer','auto_fixable':![]}});else p['toLowerCase']()['startsWith']('0x')&&b['push']({'code':'SG-03','message':'table['+n+']\x20name\x20must\x20not\x20start\x20with\x20\x220x\x22\x20(reserved\x20for\x20object\x20IDs)','severity':'warning','source':'lint','location':{'path':'/table/'+n+'/name'},'fix':{'description':'Rename\x20the\x20entry\x20without\x20the\x200x\x20prefix','auto_fixable':![]}});}if(h['length']>0x0){const q=(f??'')['trim']();q['length']<0xa&&b['push']({'code':'SG-03','message':'This\x20Guard\x20accepts\x20submitted\x20data\x20('+h['length']+'\x20table\x20'+(h['length']===0x1?'entry':'entries')+'\x20with\x20b_submission=true)\x20but\x20its\x20description\x20is\x20too\x20short\x20for\x20a\x20verifier\x20to\x20know\x20what\x20to\x20submit.\x20Explain\x20the\x20expected\x20submitted\x20data\x20in\x20the\x20Guard\x27s\x20\x27description\x27\x20field,\x20e.g.\x20\x27user-submitted\x20operation\x20type\x20(return/damage)\x27','severity':'info','source':'lint','location':{'path':'/'},'fix':{'description':'Explain\x20the\x20expected\x20submitted\x20data\x20in\x20the\x20Guard\x27s\x20\x27description\x27\x20field','auto_fixable':![]}});}if(c){const r=rootToString(c),s=r['includes']('proof.signer'),t=r['includes']('proof.time'),u=r['includes']('calc_string_length'),v=h['some'](w=>w['value_type']==='String');if(s&&t)b['push']({'code':'SG-04','message':'Strict-mode\x20privacy-delivery\x20guard\x20detected\x20(proof.signer\x20+\x20proof.time).\x20'+'Recommended\x20three\x20conditions:\x20Signer==proof.signer\x20(submitter\x20accountability),\x20'+'proof.time>order.time\x20(freshness),\x20order.service==service\x20(project\x20binding).\x20'+'No\x20content\x20verification\x20—\x20only\x20submission\x20responsibility\x20(\x27whoever\x20benefits\x20bears\x20the\x20burden\x20of\x20proof\x27).','severity':'info','source':'lint','location':{'path':'/root'},'fix':{'description':'Ensure\x20all\x20three\x20conditions\x20are\x20present\x20(logic_and).\x20Refer\x20to\x20template\x20tpl_forward_privacy_delivery_proof.\x20'+'Query\x20IDs:\x20proof.signer=1958,\x20proof.time=1960,\x20order.time=1574,\x20order.service=1563.','auto_fixable':![]}});else u&&v&&b['push']({'code':'SG-04','message':'Broad-mode\x20privacy-delivery\x20guard\x20detected\x20(String\x20submission\x20+\x20length\x20check,\x20e.g.\x20Merkle\x20Root\x20length\x20==\x2066).\x20'+'This\x20trusts\x20the\x20submitter\x27s\x20honesty;\x20the\x20counterparty\x20can\x20dispute\x20by\x20checking\x20their\x20own\x20Messenger\x20conversation.\x20'+'Suitable\x20as\x20an\x20arbitration\x20basis,\x20not\x20a\x20fund-flow\x20gate.','severity':'info','source':'lint','location':{'path':'/root'},'fix':{'description':'For\x20stronger\x20assurance,\x20consider\x20strict\x20mode:\x20submit\x20a\x20Proof\x20object\x20address\x20(from\x20messenger.submitChainProof)\x20+\x20'+'Order\x20address,\x20then\x20verify\x20proof.signer/proof.time/order.service.\x20See\x20template\x20tpl_forward_privacy_delivery_proof.','auto_fixable':![]}});}return b;}export function autoFixGuard(a){const b=deepClone(a),c=[];(!b['description']||b['description']['trim']()==='')&&(b['description']='Guard\x20(table:\x20'+b['table']['length']+'\x20items,\x20root:\x20'+(b['root']?.['type']??'unknown')+')',c['push']({'diagnostic_code':'SH-01','description':'Fill\x20in\x20default\x20description','after':b['description'],'path':'/description'}));if(b['description']&&b['description']['length']>MAX_DESCRIPTION_LENGTH){const f=b['description'];b['description']=b['description']['substring'](0x0,MAX_DESCRIPTION_LENGTH),c['push']({'diagnostic_code':'G-001','description':'Truncate\x20description\x20to\x20'+MAX_DESCRIPTION_LENGTH+'\x20characters','before':f['length']+'\x20characters','after':b['description']['length']+'\x20characters','path':'/description'});}for(let g=0x0;g<b['table']['length'];g++){const h=b['table'][g];(!h['name']||h['name']['trim']()==='')&&(h['name']='data\x20entry\x20'+h['identifier'],c['push']({'diagnostic_code':'SH-03','description':'table['+g+']\x20fill\x20in\x20name','after':h['name'],'path':'/table/'+g+'/name'}));}for(let j=0x0;j<b['table']['length'];j++){const k=b['table'][j];if(!k['value_type']&&k['value']!==undefined&&k['value']!==null){const l=inferValueType(k['value']);l&&(k['value_type']=l,c['push']({'diagnostic_code':'SH-05','description':'table['+j+']\x20infer\x20value_type','after':l,'path':'/table/'+j+'/value_type'}));}}const d=new Map();let e=0x0;for(let m=0x0;m<b['table']['length'];m++){const n=b['table'][m];if(!d['has'](n['identifier']))d['set'](n['identifier'],e),n['identifier']!==e&&c['push']({'diagnostic_code':'G-007','description':'table['+m+']\x20identifier\x20'+n['identifier']+'\x20→\x20'+e,'before':String(n['identifier']),'after':String(e),'path':'/table/'+m+'/identifier'}),n['identifier']=e,e++;else{const o=n['identifier'];n['identifier']=e,d['set'](o,e),c['push']({'diagnostic_code':'G-007','description':'table['+m+']\x20identifier\x20'+o+'\x20duplicate\x20→\x20reallocated\x20to\x20'+e,'before':String(o),'after':String(e),'path':'/table/'+m+'/identifier'}),e++;}}for(let p=0x0;p<b['table']['length'];p++){const q=b['table'][p];q['b_submission']===undefined&&(q['b_submission']=![],c['push']({'diagnostic_code':'SH-10','description':'table['+p+']\x20b_submission\x20default\x20set\x20to\x20false','after':'false','path':'/table/'+p+'/b_submission'}));}if(b['rely']?.['guards']&&b['rely']['guards']['length']>0x0){const r=[...new Set(b['rely']['guards'])];r['length']!==b['rely']['guards']['length']&&(c['push']({'diagnostic_code':'G-009','description':'rely\x20deduplicate:\x20'+b['rely']['guards']['length']+'\x20→\x20'+r['length'],'before':JSON['stringify'](b['rely']['guards']),'after':JSON['stringify'](r),'path':'/rely/guards'}),b['rely']['guards']=r);}for(let s=0x0;s<b['table']['length'];s++){const t=b['table'][s];if(t['b_submission']===!![]&&t['value']!==undefined&&t['value']!==null){const u=JSON['stringify'](t['value']);delete t['value'],c['push']({'diagnostic_code':'SH-11','description':'table['+s+']\x20remove\x20redundant\x20value\x20on\x20b_submission=true\x20entry','before':u,'after':'(removed)','path':'/table/'+s+'/value'});}}return{'fixed':b,'actions':c};}export async function lintGuard(a,b){const c=b?.['auto_fix']??!![],d=normalizeValueTypeNames(a),{table:e,root:f,rely:g,binding_hint:h}=d,i=[];let j;const k=await checkSdkSyntax(d);i['push'](...k);const l=checkSemanticErrors(d);i['push'](...l);const m=checkSyntaxHints(d);i['push'](...m);let n,o=[];if(c){const {fixed:w,actions:x}=autoFixGuard(d);x['length']>0x0&&(n=w,o=x);}if(e['length']>0x0&&f){const y=h?findScene(h['host_object']??'',h['binding_field']??''):undefined,z=e['map'](B=>({'identifier':B['identifier'],'b_submission':B['b_submission']??![],'value_type':B['value_type']??'Address','value':B['value'],'name':B['name'],'object_type':B['object_type']})),A=evaluateGuardDraft({'table':z,'root':f,'rely':g,'scene':y,'sharing_recipients':h?.['sharing_recipients']});j=A['assessment'];for(const B of j['risks']){const C=B['level']==='critical'||B['level']==='high'?'error':B['level']==='medium'?'warning':B['level']==='low'?'info':'hint',D=B['evidence']??'',E=D['startsWith']('/')?D:'/';i['push']({'code':B['id'],'message':'['+B['level']+']\x20'+B['title'],'severity':C,'source':'risk','location':{'path':E},'fix':{'description':B['mitigation'],'auto_fixable':![]}});}}const p=checkSuggestions(d);i['push'](...p);const q=i['filter'](F=>F['severity']==='error')['length'],s=i['filter'](F=>F['severity']==='warning')['length'],t=i['filter'](F=>F['severity']==='info'||F['severity']==='hint')['length'],u=q===0x0;let v;if(q>0x0)v='Fix\x20'+q+'\x20error(s)\x20and\x20re-run\x20lint';else s>0x0?v='Consider\x20addressing\x20'+s+'\x20warning(s),\x20then\x20submit\x20to\x20SDK\x20newGuard()\x20for\x20final\x20syntax\x20validation':v='lint\x20passed\x20(no\x20errors);\x20submit\x20to\x20SDK\x20newGuard()\x20for\x20final\x20syntax\x20validation\x20before\x20going\x20on-chain';return{'json_summary':{'table_count':e['length'],'root_type':f?.['type']??'unknown','has_rely':!!g?.['guards']?.['length'],'rely_count':g?.['guards']?.['length']??0x0,'has_description':!!d['description']},'diagnostics':i,'fixed_json':n,'fix_actions':o,'risk_assessment':j,'summary':{'errors':q,'warnings':s,'infos':t,'auto_fixes_applied':o['length'],'ready':u,'next_step':v}};}export async function isGuardReady(a){const b=await lintGuard(a,{'auto_fix':![]});return b['summary']['ready'];}export async function getGuardErrors(a){const b=await lintGuard(a,{'auto_fix':![]});return b['diagnostics']['filter'](c=>c['severity']==='error');}export function formatLintResult(a){const b=[];b['push']('===\x20Guard\x20JSON\x20Lint\x20Report\x20==='),b['push'](''),b['push']('Summary:'),b['push']('\x20\x20Errors:\x20\x20\x20\x20\x20'+a['summary']['errors']),b['push']('\x20\x20Warnings:\x20\x20\x20'+a['summary']['warnings']),b['push']('\x20\x20Infos:\x20\x20\x20\x20\x20\x20'+a['summary']['infos']),b['push']('\x20\x20Auto-fixes:\x20'+a['summary']['auto_fixes_applied']),b['push']('\x20\x20Ready:\x20\x20\x20\x20\x20\x20'+(a['summary']['ready']?'YES':'NO')),b['push']('\x20\x20Next\x20step:\x20\x20'+a['summary']['next_step']),b['push']('');if(a['fix_actions']['length']>0x0){b['push']('---\x20Auto-fix\x20Actions\x20---');for(const g of a['fix_actions']){b['push']('\x20\x20['+g['diagnostic_code']+']\x20'+g['description']),b['push']('\x20\x20\x20\x20Path:\x20'+g['path']),g['before']&&g['after']&&b['push']('\x20\x20\x20\x20'+g['before']+'\x20->\x20'+g['after']);}b['push']('');}const c=a['diagnostics']['filter'](h=>h['severity']==='error'),e=a['diagnostics']['filter'](h=>h['severity']==='warning'),f=a['diagnostics']['filter'](h=>h['severity']==='info'||h['severity']==='hint');if(c['length']>0x0){b['push']('---\x20Errors\x20(must\x20fix)\x20---');for(const h of c){b['push']('\x20\x20['+h['code']+']\x20('+h['source']+')\x20'+h['message']),b['push']('\x20\x20\x20\x20Path:\x20'+h['location']['path']);if(h['fix'])b['push']('\x20\x20\x20\x20Fix:\x20\x20'+h['fix']['description']);}b['push']('');}if(e['length']>0x0){b['push']('---\x20Warnings\x20(consider\x20fixing)\x20---');for(const i of e){b['push']('\x20\x20['+i['code']+']\x20('+i['source']+')\x20'+i['message']),b['push']('\x20\x20\x20\x20Path:\x20'+i['location']['path']);if(i['fix'])b['push']('\x20\x20\x20\x20Fix:\x20\x20'+i['fix']['description']);}b['push']('');}if(f['length']>0x0){b['push']('---\x20Info\x20&\x20Hints\x20---');for(const j of f){b['push']('\x20\x20['+j['code']+']\x20('+j['source']+')\x20'+j['message']),b['push']('\x20\x20\x20\x20Path:\x20'+j['location']['path']);}}return b['join']('\x0a');}export function translateGuardTypeError(a){if(!a)return undefined;let b='',c=-0x1,d=-0x1;const e=a['match'](/([\w.[\]-]+)\s*(?:→|->)\s*checkType:\s*(\d+)\s+require type:\s*(\d+)/);if(e)b=e[0x1],c=Number(e[0x2]),d=Number(e[0x3]);else{const j=a['match'](/checkType:\s*(\d+)\s+require type:\s*(\d+)/);if(!j)return undefined;c=Number(j[0x1]),d=Number(j[0x2]);}const f=b?'at\x20'+b+':\x20':'',g=valueTypeName(c),h=valueTypeName(d),i=[];if(d===0x0){i['push'](f+'the\x20parent\x20operator\x20needs\x20a\x20BOOL\x20operand,\x20but\x20the\x20child\x20returns\x20'+g+'.');if(c===0x1&&/claimed_by/i['test'](a))i['push']('TEACHING\x20(Bool/Address\x20twin,\x20crs\x20P2-2):\x20order.claimed_by\x20(query\x201571)\x20returns\x20Address;\x20'+'its\x20Bool\x20twin\x20is\x20`order.claimed_by\x20some`\x20(query\x201570\x20—\x20has\x20ANY\x20claimer).\x20Invert\x20THAT\x20with\x20'+'logic_not,\x20or\x20assert\x20logic_equal[query\x201570,\x20false].');else{if(c===0x1)i['push']('TEACHING:\x20wrap\x20the\x20Address\x20leaf\x20in\x20logic_equal\x20against\x20identifier[N]\x20—\x20'+'logic_equal[{type:\x22query\x22,\x20query:\x22...\x22},\x20{type:\x22identifier\x22,\x20identifier:N}].\x20'+'A\x20Bool\x20operator\x20(logic_and/or/not)\x20can\x20never\x20consume\x20a\x20bare\x20Address.');else{if(c===0x2)i['push']('TEACHING:\x20wrap\x20the\x20String\x20leaf\x20in\x20logic_equal\x20against\x20identifier[N].\x20A\x20multi-node\x20'+'membership\x20test\x20\x27current\x20in\x20{a,b,c}\x27\x20has\x20NO\x20set\x20operator\x20yet\x20(crs\x20P2-1):\x20express\x20one\x20'+'logic_equal\x20per\x20value\x20joined\x20by\x20logic_or\x20—\x20each\x20value\x20a\x20frozen\x20table\x20entry\x20(Guards\x20are\x20'+'create-only,\x20IMMUT-003).');else c>=0x3&&c<=0x8?i['push']('TEACHING:\x20numeric\x20leaf\x20—\x20compare\x20via\x20the\x20logic_as_u256_greater/lesser/equal\x20variants,\x20'+'or\x20wrap\x20in\x20logic_equal\x20against\x20a\x20numeric\x20identifier[N].'):i['push']('TEACHING:\x20wrap\x20the\x20leaf\x20in\x20a\x20Bool-producing\x20operator\x20(logic_equal\x20/\x20logic_as_u256_*)\x20'+'before\x20feeding\x20logic_and/or/not.');}}}else i['push'](f+'the\x20operator\x20requires\x20'+h+',\x20but\x20the\x20child\x20returns\x20'+g+'.\x20TEACHING:\x20align\x20the\x20operand\x20'+'types\x20—\x20wrap\x20in\x20logic_equal\x20(any\x20type)\x20or\x20convert\x20with\x20the\x20logic_as_u256_*\x20family\x20(numeric)\x20'+'before\x20the\x20comparison.');return['GUARD\x20TYPE\x20ERROR\x20(taught):',a['trim'](),...i]['join']('\x0a');}
1
+ import{validateGuardData,MAX_DESCRIPTION_LENGTH,MAX_GUARD_TABLE_ITEM_LENGTH,MAX_NAME_LENGTH,ValueType}from'@wowok/wowok';import{rootReferencedIdentifiers}from'./guard-risk.js';import{evaluateGuardDraft}from'./guard-eval.js';import{findScene,inferSceneFromAction}from'./guard-ledger.js';import{suggestTemplateForScene}from'./guard-templates.js';import{validateGuardTreeShape}from'./guard-render.js';import{isBoolReturningQuery}from'../schema/utils/guard-query-utils.js';import{valueTypeName}from'./guard-submission-brief.js';const VALUE_TYPE_ID_TO_NAME={[ValueType['Bool']]:'Bool',[ValueType['Address']]:'Address',[ValueType['String']]:'String',[ValueType['U8']]:'U8',[ValueType['U16']]:'U16',[ValueType['U32']]:'U32',[ValueType['U64']]:'U64',[ValueType['U128']]:'U128',[ValueType['U256']]:'U256',[ValueType['VecBool']]:'VecBool',[ValueType['VecAddress']]:'VecAddress',[ValueType['VecString']]:'VecString',[ValueType['VecU8']]:'VecU8',[ValueType['VecU16']]:'VecU16',[ValueType['VecU32']]:'VecU32',[ValueType['VecU64']]:'VecU64',[ValueType['VecU128']]:'VecU128',[ValueType['VecU256']]:'VecU256',[ValueType['VecVecU8']]:'VecVecU8'};function normalizeValueTypeNames(a){if(!a['table']['some'](b=>typeof b['value_type']==='number'))return a;return{...a,'table':a['table']['map'](b=>typeof b['value_type']==='number'?{...b,'value_type':VALUE_TYPE_ID_TO_NAME[b['value_type']]??String(b['value_type'])}:b)};}function deepClone(a){return JSON['parse'](JSON['stringify'](a));}function rootToString(a){return JSON['stringify'](a);}function canonicalNode(a){if(a===null||typeof a!=='object')return JSON['stringify'](a)??'null';if(Array['isArray'](a))return'['+a['map'](canonicalNode)['join'](',')+']';const b=Object['keys'](a)['sort']();return'{'+b['map'](c=>JSON['stringify'](c)+':'+canonicalNode(a[c]))['join'](',')+'}';}const GE_NODE='logic_as_u256_greater_or_equal',LE_NODE='logic_as_u256_lesser_or_equal';function findDegenerateTimeWindows(a){const b=[],c=new Set(),d=g=>{const h=g['filter'](j=>j?.['type']===GE_NODE&&Array['isArray'](j['nodes'])&&j['nodes']['length']>=0x2),i=g['filter'](j=>j?.['type']===LE_NODE&&Array['isArray'](j['nodes'])&&j['nodes']['length']>=0x2);for(const j of h){for(const k of i){const l=canonicalNode(j['nodes'][0x0])===canonicalNode(k['nodes'][0x0]),m=canonicalNode(j['nodes'][0x1])===canonicalNode(k['nodes'][0x1]);if(!l||!m)continue;const n=canonicalNode(j)+'|'+canonicalNode(k);if(c['has'](n))continue;c['add'](n),b['push']({'ge':j,'le':k});}}},e=g=>{if(g?.['type']==='logic_and'&&Array['isArray'](g['nodes']))return g['nodes']['flatMap'](e);return[g];},f=g=>{if(!g||typeof g!=='object')return;if(g['type']==='logic_not')return;if(g['type']==='logic_and'&&Array['isArray'](g['nodes'])){const h=e(g);d(h),h['forEach'](f);return;}if(g['type']==='logic_or'&&Array['isArray'](g['nodes'])){for(const i of g['nodes']){i?.['type']==='logic_and'&&Array['isArray'](i['nodes'])?(d(i['nodes']),i['nodes']['forEach'](f)):f(i);}return;}if(g['type']===GE_NODE||g['type']===LE_NODE)d([g]);if(Array['isArray'](g['nodes']))g['nodes']['forEach'](f);};return f(a),b;}function hasSignerContext(a){const b=rootToString(a);return b['includes']('\x22Signer\x22')||b['includes']('\x22context\x22:\x22Signer\x22')||b['includes']('\x22context\x22:\x20\x22Signer\x22');}function getSubmissionEntries(a){return a['filter'](b=>b['b_submission']===!![]);}function inferValueType(a){if(typeof a==='string'){if(a['startsWith']('0x')&&a['length']>=0x3)return'Address';return'String';}if(typeof a==='number'){if(Number['isInteger'](a)){if(a>=0x0&&a<=0xff)return'U8';if(a>=0x0&&a<=0xffff)return'U16';return'U64';}return'U256';}if(typeof a==='boolean')return'Bool';if(Array['isArray'](a)){if(a['length']>0x0){const b=inferValueType(a[0x0]);if(b==='Address')return'Vec<Address>';if(b==='String')return'Vec<String>';if(b==='Bool')return'Vec<Bool>';}return'Vec<Address>';}return undefined;}function sdkIssueToDiagnostic(a){return{'code':a['code'],'message':a['message'],'severity':a['severity'],'source':'sdk','location':{'path':a['path']},'fix':{'description':'SDK\x20validation\x20failed\x20('+(a['sdk_error']??'InvalidParam')+');\x20manual\x20fix\x20required','auto_fixable':![]}};}async function checkSdkSyntax(a){const b=validateGuardTreeShape(a['root']);if(b['length']>0x0)return b['map'](f=>({'code':'G-001','message':f['message'],'severity':'error','source':'sdk','location':{'path':f['path']},'fix':{'description':'Unary\x20operators\x20(logic_not,\x20value_type,\x20vec_length,\x20calc_string_length,\x20convert_*)\x20take\x20a\x20single\x20\x27node\x27\x20child;\x20only\x20multi-operand\x20forms\x20(logic_and,\x20logic_or,\x20logic_equal,\x20logic_as_u256_*,\x20calc_number_*,\x20vec_contains_*)\x20take\x20a\x20\x27nodes\x27\x20array.','auto_fixable':![]}}));const c=a['table']['map'](f=>({'identifier':f['identifier'],'b_submission':f['b_submission']??![],'value_type':f['value_type']??'Address','value':f['value'],'name':f['name']??''}));let d;try{d=await validateGuardData({'description':a['description'],'table':c,'root':a['root'],'rely':a['rely']});}catch(f){const g=f?.['message']??String(f),h=/guard tree ([^:]+):/['exec'](g);return[{'code':'G-001','message':g,'severity':'error','source':'sdk','location':{'path':h?toJsonPointer(h[0x1]):'/root'},'fix':{'description':'Repair\x20the\x20tree\x20at\x20the\x20named\x20path:\x20unary\x20operators\x20(logic_not,\x20convert_*,\x20value_type)\x20take\x20a\x20single\x20\x27node\x27\x20child;\x20only\x20multi-operand\x20forms\x20(logic_and,\x20logic_or,\x20logic_equal,\x20calc_*,\x20vec_*)\x20take\x20\x27nodes\x27.','auto_fixable':![]}}];}return d['map'](sdkIssueToDiagnostic);}function toJsonPointer(a){const b=a['replace'](/^\/+/,'');return b['startsWith']('root')?'/'+b:'/root/'+b;}function checkSemanticErrors(a){const b=[],{table:c,root:d,binding_hint:e}=a,f=e?findScene(e['host_object']??'',e['binding_field']??''):undefined,g=getSubmissionEntries(c);if(g['length']>0x0&&d&&!hasSignerContext(d)){const i=g['some'](l=>l['value_type']==='Address'),j=f?.['id']==='service_order_allocators_guard'&&e?.['sharing_recipients']!==undefined&&e['sharing_recipients']['length']>0x0&&!e['sharing_recipients']['includes']('Signer'),k=f?.['id']==='service_order_allocators_guard'&&g['length']>0x0&&g['every'](l=>!rootReferencedIdentifiers(d)['has'](l['identifier']));if(i&&!j&&!k){const l=g['filter'](m=>m['value_type']==='Address')['map'](m=>c['indexOf'](m));b['push']({'code':'LE-04','message':'Submitted\x20data\x20has\x20no\x20Signer\x20binding\x20(submission\x20forgery\x20risk)','severity':'error','source':'lint','location':{'path':l['map'](m=>'/table/'+m)['join']('\x20→\x20')},'fix':{'description':'Add\x20logic_equal(context(Signer),\x20identifier[N])\x20in\x20root\x20to\x20bind\x20the\x20submitter\x20identity','auto_fixable':![]}});}}if(f?.['id']==='arbitration_voting_guard'){const m=g['some'](n=>['U8','U16','U32','U64','U128','U256']['includes'](n['value_type']??''));if(m){const n=g['filter'](o=>['U8','U16','U32','U64','U128','U256']['includes'](o['value_type']??''))['map'](o=>c['indexOf'](o));b['push']({'code':'LE-05','message':'voting_guard\x20voting\x20weight\x20comes\x20from\x20submitted\x20data\x20(weight\x20forgery\x20risk)','severity':'error','source':'lint','location':{'path':n['map'](o=>'/table/'+o)['join']('\x20→\x20')},'fix':{'description':'Derive\x20arbitrator\x20weights\x20from\x20the\x20Arb\x20object\x20via\x20witness\x20(e.g.\x20105\x20TypeArbArbitration)\x20rather\x20than\x20submitting\x20them\x20directly','auto_fixable':![]}});}}if(f?.['id']==='gen_passport_guard'||e?.['action']==='gen_passport'){const o=rootToString(d);if(o['includes']('1167')||o['includes']('repository.data')){const p=o['includes']('quote_guard');p&&b['push']({'code':'LE-06','message':'repository.data\x20query\x20with\x20quote_guard:\x20rigid\x20verification\x20requirement\x20—\x20ensure\x20Passport\x20includes\x20quote_guard\x20verification\x20with\x20necessary\x20submissions\x20(e.g.,\x20Payment\x20proof)','severity':'info','source':'lint','location':{'path':'/root'},'fix':{'description':'Ensure\x20the\x20quote_guard\x20is\x20verified:\x20user\x20submits\x20Payment\x20via\x20Passport,\x20quote_guard\x20verifies\x20Payment\x20fields,\x20repository\x20data\x20query\x20passes','auto_fixable':![]}});}}if(e?.['host_object']&&f){const q=e['host_object'],r=c['filter'](s=>!s['b_submission']&&s['value_type']==='Address'&&typeof s['value']==='string'&&s['value']['startsWith']('0x')&&s['object_type']===q);if(r['length']>0x0){const s=r['map'](t=>c['indexOf'](t));b['push']({'code':'LE-07','message':'Circular\x20reference\x20uses\x20an\x20address\x20rather\x20than\x20a\x20name\x20(Host\x20Object\x20may\x20not\x20be\x20published\x20yet\x20when\x20the\x20Guard\x20is\x20created)','severity':'error','source':'lint','location':{'path':s['map'](t=>'/table/'+t+'/value')['join']('\x20→\x20')},'fix':{'description':'Change\x20value\x20from\x20an\x20address\x20to\x20an\x20object\x20name\x20(e.g.\x20\x22service1\x22);\x20the\x20SDK\x20will\x20resolve\x20it\x20to\x20an\x20address\x20after\x20the\x20Host\x20Object\x20is\x20published','auto_fixable':![]}});}}const h=c['filter'](t=>t['b_submission']===![]&&Array['isArray'](t['value'])&&t['value']['length']===0x0);h['length']>0x0&&b['push']({'code':'LE-10','message':'Static\x20table\x20slot(s)\x20'+h['map'](t=>t['identifier'])['join'](',\x20')+'\x20carry\x20an\x20EMPTY\x20array\x20value\x20—\x20'+'guard\x20table\x20construction\x20silently\x20DROPS\x20empty\x20vectors:\x20the\x20created\x20Guard\x20will\x20MISS\x20these\x20rows\x20while\x20creation\x20still\x20succeeds.','severity':'error','source':'lint','location':{'path':h['map'](t=>'/table['+t['identifier']+']')['join']('\x20→\x20')},'fix':{'description':'Give\x20each\x20flagged\x20slot\x20a\x20non-empty\x20static\x20value,\x20or\x20flip\x20it\x20to\x20b_submission=true\x20and\x20supply\x20the\x20value\x20at\x20Guard\x20trigger\x20time\x20(protocol\x20once-slots:\x20255\x20keys\x20on\x20the\x20submitted\x20bytes,\x20254\x20on\x20the\x20chain-derived\x20object\x20key).','auto_fixable':![]}});for(const {ge:t,le:u}of findDegenerateTimeWindows(d)){b['push']({'code':'LE-08','message':'Degenerate\x20time\x20window:\x20the\x20same\x20conjunction\x20asserts\x20`L\x20>=\x20R`\x20and\x20`L\x20<=\x20R`\x20over\x20'+'structurally\x20identical\x20operands.\x20Their\x20conjunction\x20is\x20`L\x20==\x20R`\x20—\x20on\x20a\x20millisecond\x20Clock\x20'+'an\x20~1\x20ms\x20window,\x20i.e.\x20the\x20guarded\x20forward\x20is\x20effectively\x20unreachable.\x20'+'`logic_as_u256_greater_or_equal`\x20is\x20a\x20LOWER\x20bound\x20(deadline\x20passed);\x20an\x20upper\x20bound\x20'+'(`logic_as_u256_lesser_or_equal`)\x20must\x20use\x20a\x20DIFFERENT\x20right-hand\x20side.','severity':'error','source':'lint','location':{'path':'/root'},'fix':{'description':'For\x20\x22the\x20deadline\x20has\x20passed\x22,\x20keep\x20ONLY\x20`L\x20>=\x20R`\x20and\x20delete\x20the\x20`<=`\x20clause.\x20'+'For\x20\x22the\x20window\x20is\x20open\x22,\x20keep\x20both\x20clauses\x20but\x20make\x20the\x20right-hand\x20sides\x20differ,\x20'+'e.g.\x20`L\x20>=\x20t`\x20and\x20`L\x20<=\x20t\x20+\x20K`.\x20Remember\x20`progress.current_time`\x20is\x20refreshed\x20on\x20'+'every\x20forward,\x20so\x20anchoring\x20a\x20release\x20lock\x20on\x20it\x20restarts\x20the\x20clock\x20at\x20each\x20node\x20change.','auto_fixable':![]}});}{const w=[],x=(z,A)=>{if(!A||typeof A!=='object')return;if(A['type']==='query'&&A['query']!==undefined){if(!isBoolReturningQuery(A['query'])){const B=typeof A['query']==='string'?A['query']:String(A['query']);w['push']({'op':z,'describe':'query\x20'+B,'claimedByTwin':/claimed_by/i['test'](B)&&!/\bsome\b/i['test'](B)});}}else{if(A['type']==='identifier'&&A['identifier']!==undefined){const C=c['find'](E=>E['identifier']===A['identifier']),D=C?.['value_type'];D&&D!=='Bool'&&D!=='Value'&&w['push']({'op':z,'describe':'identifier\x20'+A['identifier']+'\x20(table\x20value_type\x20'+D+')','claimedByTwin':![]});}}},y=z=>{if(!z||typeof z!=='object')return;if(z['type']==='logic_not'){x('logic_not',z['node']),y(z['node']);return;}Array['isArray'](z['nodes'])&&((z['type']==='logic_and'||z['type']==='logic_or')&&z['nodes']['forEach'](A=>x(z['type'],A)),z['nodes']['forEach'](y));if(z['node'])y(z['node']);};y(d);for(const z of w){b['push']({'code':'LE-09','message':z['op']+'\x20consumes\x20a\x20non-Bool\x20leaf\x20('+z['describe']+')\x20—\x20Bool\x20operators\x20take\x20Bool\x20operands\x20only\x20(crs\x20P2-1/P2-2)'+(z['claimedByTwin']?'.\x20TEACHING:\x20order.claimed_by\x20(query\x201571)\x20returns\x20Address;\x20its\x20Bool\x20twin\x20is\x20`order.claimed_by\x20some`\x20(query\x201570)\x20—\x20use\x20THAT\x20in\x20logic_not\x20/\x20logic_equal.':'.\x20TEACHING:\x20wrap\x20the\x20leaf\x20in\x20logic_equal[leaf,\x20identifier[N]]\x20(any\x20type)\x20or\x20a\x20logic_as_u256_*\x20operator\x20(numeric\x20comparison)\x20to\x20produce\x20a\x20Bool.'),'severity':'error','source':'lint','location':{'path':'/root'},'fix':{'description':z['claimedByTwin']?'Replace\x20query\x20order.claimed_by\x20with\x20order.claimed_by\x20some\x20(query\x201570)':'Wrap\x20the\x20leaf\x20in\x20logic_equal\x20against\x20identifier[N]\x20so\x20'+z['op']+'\x20receives\x20a\x20Bool','auto_fixable':![]}});}}return b;}function checkSyntaxHints(a){const b=[],{table:c}=a;(!a['description']||a['description']['trim']()==='')&&b['push']({'code':'SH-01','message':'description\x20is\x20missing\x20or\x20empty','severity':'info','source':'lint','location':{'path':'/description'},'fix':{'description':'Add\x20a\x20description,\x20e.g.\x20\x27Service\x20buy_guard:\x20whitelist\x20validation\x27','auto_fixable':!![]}});for(let d=0x0;d<c['length'];d++){const e=c[d];(!e['name']||e['name']['trim']()==='')&&b['push']({'code':'SH-03','message':'table['+d+']\x20is\x20missing\x20name','severity':'warning','source':'lint','location':{'path':'/table/'+d+'/name'},'fix':{'description':'Add\x20a\x20name,\x20e.g.\x20\x22data\x20entry\x20'+e['identifier']+'\x22','auto_fixable':!![]}});}for(let f=0x0;f<c['length'];f++){const g=c[f];!g['value_type']&&b['push']({'code':'SH-05','message':'table['+f+']\x20is\x20missing\x20value_type','severity':'warning','source':'lint','location':{'path':'/table/'+f+'/value_type'},'fix':{'description':'Infer\x20value_type\x20from\x20value\x20(e.g.\x20Address/String/U64,\x20etc.)','auto_fixable':!![]}});}c['length']>MAX_GUARD_TABLE_ITEM_LENGTH&&b['push']({'code':'SH-07','message':'table\x20entry\x20count\x20'+c['length']+'\x20exceeds\x20the\x20maximum\x20limit\x20'+MAX_GUARD_TABLE_ITEM_LENGTH,'severity':'error','source':'lint','location':{'path':'/table'},'fix':{'description':'Slim\x20down\x20the\x20table\x20by\x20merging\x20similar\x20entries,\x20or\x20split\x20into\x20multiple\x20Guards\x20+\x20rely','auto_fixable':![]}});for(let h=0x0;h<c['length'];h++){c[h]['b_submission']===undefined&&b['push']({'code':'SH-10','message':'table['+h+']\x20b_submission\x20is\x20missing','severity':'info','source':'lint','location':{'path':'/table/'+h+'/b_submission'},'fix':{'description':'Set\x20to\x20false\x20(constant)\x20or\x20true\x20(submitted\x20data)','auto_fixable':!![]}});}for(let j=0x0;j<c['length'];j++){const k=c[j];k['b_submission']===!![]&&k['value']!==undefined&&k['value']!==null&&b['push']({'code':'SH-11','message':'table['+j+']\x20has\x20a\x20redundant\x20value\x20field\x20on\x20b_submission=true\x20entry\x20(the\x20verifier\x20supplies\x20the\x20value\x20at\x20runtime;\x20this\x20value\x20is\x20ignored\x20by\x20BCS\x20encoding\x20and\x20wastes\x20gas)','severity':'warning','source':'lint','location':{'path':'/table/'+j+'/value'},'fix':{'description':'Remove\x20the\x20value\x20field\x20—\x20it\x20is\x20ignored\x20for\x20b_submission=true\x20entries','auto_fixable':!![]}});}return b;}function checkSuggestions(a){const b=[],{root:c,binding_hint:d,table:e,description:f}=a;if(c){const i=rootToString(c);if(i['includes']('vec_contains_address')&&i['includes']('Signer'))b['push']({'code':'SG-01','message':'Matches\x20Pattern\x20P04\x20(whitelist\x20validation)','severity':'hint','source':'lint','location':{'path':'/root'},'fix':{'description':'Refer\x20to\x20the\x20P04\x20Pattern\x20to\x20ensure\x20best\x20practices','auto_fixable':![]}});else{if(i['includes']('logic_equal')&&i['includes']('Signer')){const j=e['some'](k=>!k['b_submission']&&k['value_type']==='Address'&&typeof k['value']==='string'&&k['value']['length']>0x0);j&&b['push']({'code':'SG-01','message':'Matches\x20Pattern\x20P04\x20(whitelist\x20validation\x20—\x20single-address\x20variant)','severity':'hint','source':'lint','location':{'path':'/root'},'fix':{'description':'P04\x20single-address\x20form;\x20for\x20multi-address\x20scenarios,\x20consider\x20vec_contains_address','auto_fixable':![]}});}}(i['includes']('logic_as_u256_greater')||i['includes']('logic_as_u256_lesser'))&&b['push']({'code':'SG-01','message':'Matches\x20Pattern\x20P02\x20(numeric\x20threshold\x20validation)','severity':'hint','source':'lint','location':{'path':'/root'},'fix':{'description':'Suitable\x20for\x20amount/quantity\x20threshold\x20validation\x20scenarios','auto_fixable':![]}}),i['includes']('convert_witness')&&b['push']({'code':'SG-01','message':'Matches\x20Pattern\x20P09\x20(witness-derived\x20validation)','severity':'hint','source':'lint','location':{'path':'/root'},'fix':{'description':'Suitable\x20for\x20cross-object\x20relationship\x20validation\x20(e.g.\x20Order→Progress)','auto_fixable':![]}});}if(d?.['action']){const k=['buy','forward','allocate','claim_reward','vote','dispute','write_repository','submit_progress','gen_passport'];if(k['includes'](d['action'])){const l=inferSceneFromAction(d['action']);if(l){const m=suggestTemplateForScene(l['id']);m&&b['push']({'code':'SG-02','message':'Recommended\x20scene\x20template:\x20'+m['name'],'severity':'hint','source':'lint','location':{'path':'/'},'fix':{'description':'Refer\x20to\x20template\x20'+m['id']+'\x20('+m['example_use_case']+')','auto_fixable':![]}});}}}const g=n=>new TextEncoder()['encode'](n)['length'],h=getSubmissionEntries(e);for(const [n,o]of e['entries']()){const p=o['name']??'';if(p['length']===0x0)continue;if(g(p)>MAX_NAME_LENGTH)b['push']({'code':'SG-03','message':'table['+n+']\x20name\x20is\x20'+g(p)+'\x20BCS\x20characters,\x20maximum\x20is\x20'+MAX_NAME_LENGTH+'.\x20Use\x20a\x20short\x20identifier\x20(e.g.\x20\x27order_id\x27,\x20\x27delivery_node\x27);\x20the\x20human-readable\x20explanation\x20belongs\x20in\x20the\x20Guard\x27s\x20\x27description\x27\x20field','severity':'warning','source':'lint','location':{'path':'/table/'+n+'/name'},'fix':{'description':'Shorten\x20the\x20name\x20to\x20'+MAX_NAME_LENGTH+'\x20BCS\x20characters\x20or\x20fewer','auto_fixable':![]}});else p['toLowerCase']()['startsWith']('0x')&&b['push']({'code':'SG-03','message':'table['+n+']\x20name\x20must\x20not\x20start\x20with\x20\x220x\x22\x20(reserved\x20for\x20object\x20IDs)','severity':'warning','source':'lint','location':{'path':'/table/'+n+'/name'},'fix':{'description':'Rename\x20the\x20entry\x20without\x20the\x200x\x20prefix','auto_fixable':![]}});}if(h['length']>0x0){const q=(f??'')['trim']();q['length']<0xa&&b['push']({'code':'SG-03','message':'This\x20Guard\x20accepts\x20submitted\x20data\x20('+h['length']+'\x20table\x20'+(h['length']===0x1?'entry':'entries')+'\x20with\x20b_submission=true)\x20but\x20its\x20description\x20is\x20too\x20short\x20for\x20a\x20verifier\x20to\x20know\x20what\x20to\x20submit.\x20Explain\x20the\x20expected\x20submitted\x20data\x20in\x20the\x20Guard\x27s\x20\x27description\x27\x20field,\x20e.g.\x20\x27user-submitted\x20operation\x20type\x20(return/damage)\x27','severity':'info','source':'lint','location':{'path':'/'},'fix':{'description':'Explain\x20the\x20expected\x20submitted\x20data\x20in\x20the\x20Guard\x27s\x20\x27description\x27\x20field','auto_fixable':![]}});}if(c){const r=rootToString(c),s=r['includes']('proof.signer'),t=r['includes']('proof.time'),u=r['includes']('calc_string_length'),v=h['some'](w=>w['value_type']==='String');if(s&&t)b['push']({'code':'SG-04','message':'Strict-mode\x20privacy-delivery\x20guard\x20detected\x20(proof.signer\x20+\x20proof.time).\x20'+'Recommended\x20three\x20conditions:\x20Signer==proof.signer\x20(submitter\x20accountability),\x20'+'proof.time>order.time\x20(freshness),\x20order.service==service\x20(project\x20binding).\x20'+'No\x20content\x20verification\x20—\x20only\x20submission\x20responsibility\x20(\x27whoever\x20benefits\x20bears\x20the\x20burden\x20of\x20proof\x27).','severity':'info','source':'lint','location':{'path':'/root'},'fix':{'description':'Ensure\x20all\x20three\x20conditions\x20are\x20present\x20(logic_and).\x20Refer\x20to\x20template\x20tpl_forward_privacy_delivery_proof.\x20'+'Query\x20IDs:\x20proof.signer=1958,\x20proof.time=1960,\x20order.time=1574,\x20order.service=1563.','auto_fixable':![]}});else u&&v&&b['push']({'code':'SG-04','message':'Broad-mode\x20privacy-delivery\x20guard\x20detected\x20(String\x20submission\x20+\x20length\x20check,\x20e.g.\x20Merkle\x20Root\x20length\x20==\x2066).\x20'+'This\x20trusts\x20the\x20submitter\x27s\x20honesty;\x20the\x20counterparty\x20can\x20dispute\x20by\x20checking\x20their\x20own\x20Messenger\x20conversation.\x20'+'Suitable\x20as\x20an\x20arbitration\x20basis,\x20not\x20a\x20fund-flow\x20gate.','severity':'info','source':'lint','location':{'path':'/root'},'fix':{'description':'For\x20stronger\x20assurance,\x20consider\x20strict\x20mode:\x20submit\x20a\x20Proof\x20object\x20address\x20(from\x20messenger.submitChainProof)\x20+\x20'+'Order\x20address,\x20then\x20verify\x20proof.signer/proof.time/order.service.\x20See\x20template\x20tpl_forward_privacy_delivery_proof.','auto_fixable':![]}});}return b;}export function autoFixGuard(a){const b=deepClone(a),c=[];(!b['description']||b['description']['trim']()==='')&&(b['description']='Guard\x20(table:\x20'+b['table']['length']+'\x20items,\x20root:\x20'+(b['root']?.['type']??'unknown')+')',c['push']({'diagnostic_code':'SH-01','description':'Fill\x20in\x20default\x20description','after':b['description'],'path':'/description'}));if(b['description']&&b['description']['length']>MAX_DESCRIPTION_LENGTH){const f=b['description'];b['description']=b['description']['substring'](0x0,MAX_DESCRIPTION_LENGTH),c['push']({'diagnostic_code':'G-001','description':'Truncate\x20description\x20to\x20'+MAX_DESCRIPTION_LENGTH+'\x20characters','before':f['length']+'\x20characters','after':b['description']['length']+'\x20characters','path':'/description'});}for(let g=0x0;g<b['table']['length'];g++){const h=b['table'][g];(!h['name']||h['name']['trim']()==='')&&(h['name']='data\x20entry\x20'+h['identifier'],c['push']({'diagnostic_code':'SH-03','description':'table['+g+']\x20fill\x20in\x20name','after':h['name'],'path':'/table/'+g+'/name'}));}for(let j=0x0;j<b['table']['length'];j++){const k=b['table'][j];if(!k['value_type']&&k['value']!==undefined&&k['value']!==null){const l=inferValueType(k['value']);l&&(k['value_type']=l,c['push']({'diagnostic_code':'SH-05','description':'table['+j+']\x20infer\x20value_type','after':l,'path':'/table/'+j+'/value_type'}));}}const d=new Map();let e=0x0;for(let m=0x0;m<b['table']['length'];m++){const n=b['table'][m];if(!d['has'](n['identifier']))d['set'](n['identifier'],e),n['identifier']!==e&&c['push']({'diagnostic_code':'G-007','description':'table['+m+']\x20identifier\x20'+n['identifier']+'\x20→\x20'+e,'before':String(n['identifier']),'after':String(e),'path':'/table/'+m+'/identifier'}),n['identifier']=e,e++;else{const o=n['identifier'];n['identifier']=e,d['set'](o,e),c['push']({'diagnostic_code':'G-007','description':'table['+m+']\x20identifier\x20'+o+'\x20duplicate\x20→\x20reallocated\x20to\x20'+e,'before':String(o),'after':String(e),'path':'/table/'+m+'/identifier'}),e++;}}for(let p=0x0;p<b['table']['length'];p++){const q=b['table'][p];q['b_submission']===undefined&&(q['b_submission']=![],c['push']({'diagnostic_code':'SH-10','description':'table['+p+']\x20b_submission\x20default\x20set\x20to\x20false','after':'false','path':'/table/'+p+'/b_submission'}));}if(b['rely']?.['guards']&&b['rely']['guards']['length']>0x0){const r=[...new Set(b['rely']['guards'])];r['length']!==b['rely']['guards']['length']&&(c['push']({'diagnostic_code':'G-009','description':'rely\x20deduplicate:\x20'+b['rely']['guards']['length']+'\x20→\x20'+r['length'],'before':JSON['stringify'](b['rely']['guards']),'after':JSON['stringify'](r),'path':'/rely/guards'}),b['rely']['guards']=r);}for(let s=0x0;s<b['table']['length'];s++){const t=b['table'][s];if(t['b_submission']===!![]&&t['value']!==undefined&&t['value']!==null){const u=JSON['stringify'](t['value']);delete t['value'],c['push']({'diagnostic_code':'SH-11','description':'table['+s+']\x20remove\x20redundant\x20value\x20on\x20b_submission=true\x20entry','before':u,'after':'(removed)','path':'/table/'+s+'/value'});}}return{'fixed':b,'actions':c};}export async function lintGuard(a,b){const c=b?.['auto_fix']??!![],d=normalizeValueTypeNames(a),{table:e,root:f,rely:g,binding_hint:h}=d,i=[];let j;const k=await checkSdkSyntax(d);i['push'](...k);const l=checkSemanticErrors(d);i['push'](...l);const m=checkSyntaxHints(d);i['push'](...m);let n,o=[];if(c){const {fixed:w,actions:x}=autoFixGuard(d);x['length']>0x0&&(n=w,o=x);}if(e['length']>0x0&&f){const y=h?findScene(h['host_object']??'',h['binding_field']??''):undefined,z=e['map'](B=>({'identifier':B['identifier'],'b_submission':B['b_submission']??![],'value_type':B['value_type']??'Address','value':B['value'],'name':B['name'],'object_type':B['object_type']})),A=evaluateGuardDraft({'table':z,'root':f,'rely':g,'scene':y,'sharing_recipients':h?.['sharing_recipients']});j=A['assessment'];for(const B of j['risks']){const C=B['level']==='critical'||B['level']==='high'?'error':B['level']==='medium'?'warning':B['level']==='low'?'info':'hint',D=B['evidence']??'',E=D['startsWith']('/')?D:'/';i['push']({'code':B['id'],'message':'['+B['level']+']\x20'+B['title'],'severity':C,'source':'risk','location':{'path':E},'fix':{'description':B['mitigation'],'auto_fixable':![]}});}}const p=checkSuggestions(d);i['push'](...p);const q=i['filter'](F=>F['severity']==='error')['length'],s=i['filter'](F=>F['severity']==='warning')['length'],t=i['filter'](F=>F['severity']==='info'||F['severity']==='hint')['length'],u=q===0x0;let v;if(q>0x0)v='Fix\x20'+q+'\x20error(s)\x20and\x20re-run\x20lint';else s>0x0?v='Consider\x20addressing\x20'+s+'\x20warning(s),\x20then\x20submit\x20to\x20SDK\x20newGuard()\x20for\x20final\x20syntax\x20validation':v='lint\x20passed\x20(no\x20errors);\x20submit\x20to\x20SDK\x20newGuard()\x20for\x20final\x20syntax\x20validation\x20before\x20going\x20on-chain';return{'json_summary':{'table_count':e['length'],'root_type':f?.['type']??'unknown','has_rely':!!g?.['guards']?.['length'],'rely_count':g?.['guards']?.['length']??0x0,'has_description':!!d['description']},'diagnostics':i,'fixed_json':n,'fix_actions':o,'risk_assessment':j,'summary':{'errors':q,'warnings':s,'infos':t,'auto_fixes_applied':o['length'],'ready':u,'next_step':v}};}export async function isGuardReady(a){const b=await lintGuard(a,{'auto_fix':![]});return b['summary']['ready'];}export async function getGuardErrors(a){const b=await lintGuard(a,{'auto_fix':![]});return b['diagnostics']['filter'](c=>c['severity']==='error');}export function formatLintResult(a){const b=[];b['push']('===\x20Guard\x20JSON\x20Lint\x20Report\x20==='),b['push'](''),b['push']('Summary:'),b['push']('\x20\x20Errors:\x20\x20\x20\x20\x20'+a['summary']['errors']),b['push']('\x20\x20Warnings:\x20\x20\x20'+a['summary']['warnings']),b['push']('\x20\x20Infos:\x20\x20\x20\x20\x20\x20'+a['summary']['infos']),b['push']('\x20\x20Auto-fixes:\x20'+a['summary']['auto_fixes_applied']),b['push']('\x20\x20Ready:\x20\x20\x20\x20\x20\x20'+(a['summary']['ready']?'YES':'NO')),b['push']('\x20\x20Next\x20step:\x20\x20'+a['summary']['next_step']),b['push']('');if(a['fix_actions']['length']>0x0){b['push']('---\x20Auto-fix\x20Actions\x20---');for(const g of a['fix_actions']){b['push']('\x20\x20['+g['diagnostic_code']+']\x20'+g['description']),b['push']('\x20\x20\x20\x20Path:\x20'+g['path']),g['before']&&g['after']&&b['push']('\x20\x20\x20\x20'+g['before']+'\x20->\x20'+g['after']);}b['push']('');}const c=a['diagnostics']['filter'](h=>h['severity']==='error'),e=a['diagnostics']['filter'](h=>h['severity']==='warning'),f=a['diagnostics']['filter'](h=>h['severity']==='info'||h['severity']==='hint');if(c['length']>0x0){b['push']('---\x20Errors\x20(must\x20fix)\x20---');for(const h of c){b['push']('\x20\x20['+h['code']+']\x20('+h['source']+')\x20'+h['message']),b['push']('\x20\x20\x20\x20Path:\x20'+h['location']['path']);if(h['fix'])b['push']('\x20\x20\x20\x20Fix:\x20\x20'+h['fix']['description']);}b['push']('');}if(e['length']>0x0){b['push']('---\x20Warnings\x20(consider\x20fixing)\x20---');for(const i of e){b['push']('\x20\x20['+i['code']+']\x20('+i['source']+')\x20'+i['message']),b['push']('\x20\x20\x20\x20Path:\x20'+i['location']['path']);if(i['fix'])b['push']('\x20\x20\x20\x20Fix:\x20\x20'+i['fix']['description']);}b['push']('');}if(f['length']>0x0){b['push']('---\x20Info\x20&\x20Hints\x20---');for(const j of f){b['push']('\x20\x20['+j['code']+']\x20('+j['source']+')\x20'+j['message']),b['push']('\x20\x20\x20\x20Path:\x20'+j['location']['path']);}}return b['join']('\x0a');}export function translateGuardTypeError(a){if(!a)return undefined;let b='',c=-0x1,d=-0x1;const e=a['match'](/([\w.[\]-]+)\s*(?:→|->)\s*checkType:\s*(\d+)\s+require type:\s*(\d+)/);if(e)b=e[0x1],c=Number(e[0x2]),d=Number(e[0x3]);else{const j=a['match'](/checkType:\s*(\d+)\s+require type:\s*(\d+)/);if(!j)return undefined;c=Number(j[0x1]),d=Number(j[0x2]);}const f=b?'at\x20'+b+':\x20':'',g=valueTypeName(c),h=valueTypeName(d),i=[];if(d===0x0){i['push'](f+'the\x20parent\x20operator\x20needs\x20a\x20BOOL\x20operand,\x20but\x20the\x20child\x20returns\x20'+g+'.');if(c===0x1&&/claimed_by/i['test'](a))i['push']('TEACHING\x20(Bool/Address\x20twin,\x20crs\x20P2-2):\x20order.claimed_by\x20(query\x201571)\x20returns\x20Address;\x20'+'its\x20Bool\x20twin\x20is\x20`order.claimed_by\x20some`\x20(query\x201570\x20—\x20has\x20ANY\x20claimer).\x20Invert\x20THAT\x20with\x20'+'logic_not,\x20or\x20assert\x20logic_equal[query\x201570,\x20false].');else{if(c===0x1)i['push']('TEACHING:\x20wrap\x20the\x20Address\x20leaf\x20in\x20logic_equal\x20against\x20identifier[N]\x20—\x20'+'logic_equal[{type:\x22query\x22,\x20query:\x22...\x22},\x20{type:\x22identifier\x22,\x20identifier:N}].\x20'+'A\x20Bool\x20operator\x20(logic_and/or/not)\x20can\x20never\x20consume\x20a\x20bare\x20Address.');else{if(c===0x2)i['push']('TEACHING:\x20wrap\x20the\x20String\x20leaf\x20in\x20logic_equal\x20against\x20identifier[N].\x20A\x20multi-node\x20'+'membership\x20test\x20\x27current\x20in\x20{a,b,c}\x27\x20has\x20NO\x20set\x20operator\x20yet\x20(crs\x20P2-1):\x20express\x20one\x20'+'logic_equal\x20per\x20value\x20joined\x20by\x20logic_or\x20—\x20each\x20value\x20a\x20frozen\x20table\x20entry\x20(Guards\x20are\x20'+'create-only,\x20IMMUT-003).');else c>=0x3&&c<=0x8?i['push']('TEACHING:\x20numeric\x20leaf\x20—\x20compare\x20via\x20the\x20logic_as_u256_greater/lesser/equal\x20variants,\x20'+'or\x20wrap\x20in\x20logic_equal\x20against\x20a\x20numeric\x20identifier[N].'):i['push']('TEACHING:\x20wrap\x20the\x20leaf\x20in\x20a\x20Bool-producing\x20operator\x20(logic_equal\x20/\x20logic_as_u256_*)\x20'+'before\x20feeding\x20logic_and/or/not.');}}}else i['push'](f+'the\x20operator\x20requires\x20'+h+',\x20but\x20the\x20child\x20returns\x20'+g+'.\x20TEACHING:\x20align\x20the\x20operand\x20'+'types\x20—\x20wrap\x20in\x20logic_equal\x20(any\x20type)\x20or\x20convert\x20with\x20the\x20logic_as_u256_*\x20family\x20(numeric)\x20'+'before\x20the\x20comparison.');return['GUARD\x20TYPE\x20ERROR\x20(taught):',a['trim'](),...i]['join']('\x0a');}