@wowok/agent-mcp 3.2.7 → 3.2.9

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 (185) hide show
  1. package/dist/chain-semantics/field-capability.js +1 -1
  2. package/dist/chain-semantics/fund-flow.js +1 -1
  3. package/dist/chain-semantics/guard-verbs.js +1 -1
  4. package/dist/chain-semantics/object-graph.js +1 -1
  5. package/dist/composition/audit.js +1 -1
  6. package/dist/composition/compile.js +1 -1
  7. package/dist/composition/inflight.d.ts +10 -0
  8. package/dist/composition/inflight.js +1 -1
  9. package/dist/extensions/business-modules.d.ts +1 -1
  10. package/dist/extensions/business-modules.js +1 -1
  11. package/dist/graph/onchain/edge-schema.js +1 -1
  12. package/dist/harness/index.d.ts +1 -0
  13. package/dist/harness/index.js +1 -1
  14. package/dist/harness/operation-id.d.ts +1 -0
  15. package/dist/harness/operation-id.js +1 -0
  16. package/dist/harness/recover.js +1 -1
  17. package/dist/index.js +1 -1
  18. package/dist/knowledge/arbitration-ledger.js +1 -1
  19. package/dist/knowledge/audit-rules.js +1 -1
  20. package/dist/knowledge/baselines/rules/guard.json +96 -1
  21. package/dist/knowledge/baselines/rules/plan.json +30 -7
  22. package/dist/knowledge/baselines/semantic-facts.js +1 -1
  23. package/dist/knowledge/builtin-templates.d.ts +1 -1
  24. package/dist/knowledge/builtin-templates.js +1 -1
  25. package/dist/knowledge/discount-threshold.d.ts +11 -0
  26. package/dist/knowledge/discount-threshold.js +1 -1
  27. package/dist/knowledge/fund-layer.js +1 -1
  28. package/dist/knowledge/getting-started.js +1 -1
  29. package/dist/knowledge/guard-design-patterns.d.ts +1 -1
  30. package/dist/knowledge/guard-design-patterns.js +1 -1
  31. package/dist/knowledge/guard-field-cognition.js +1 -1
  32. package/dist/knowledge/guard-ledger.js +1 -1
  33. package/dist/knowledge/guard-lint.js +1 -1
  34. package/dist/knowledge/guard-render.js +1 -1
  35. package/dist/knowledge/guard-risk.d.ts +1 -0
  36. package/dist/knowledge/guard-risk.js +1 -1
  37. package/dist/knowledge/guard-submission-brief.d.ts +6 -0
  38. package/dist/knowledge/guard-submission-brief.js +1 -1
  39. package/dist/knowledge/guard-templates.d.ts +2 -2
  40. package/dist/knowledge/guard-templates.js +1 -1
  41. package/dist/knowledge/index.js +1 -1
  42. package/dist/knowledge/industry-registry.js +1 -1
  43. package/dist/knowledge/jsonrpc-enum.js +1 -1
  44. package/dist/knowledge/order-ledger.js +1 -1
  45. package/dist/knowledge/reward-ledger.js +1 -1
  46. package/dist/knowledge/safety-rules.js +1 -1
  47. package/dist/knowledge/template-loader.js +1 -1
  48. package/dist/knowledge/template-registry.js +1 -1
  49. package/dist/knowledge/template-scanner.d.ts +2 -0
  50. package/dist/knowledge/template-scanner.js +1 -1
  51. package/dist/knowledge/tool-constraints.js +1 -1
  52. package/dist/knowledge/workflow-guidance.d.ts +7 -3
  53. package/dist/knowledge/workflow-guidance.js +1 -1
  54. package/dist/monitor/MonitorLoop.js +1 -1
  55. package/dist/participation/radar-core.d.ts +1 -1
  56. package/dist/playbooks/service-build/business-puzzle.js +1 -1
  57. package/dist/playbooks/service-build/machine-panorama.js +1 -1
  58. package/dist/playbooks/service-build/merchant-guide.d.ts +8 -0
  59. package/dist/playbooks/service-build/merchant-guide.js +1 -1
  60. package/dist/playbooks/service-build/object-panorama.d.ts +28 -1
  61. package/dist/playbooks/service-build/object-panorama.js +1 -1
  62. package/dist/playbooks/service-build/participation-radar.d.ts +2 -0
  63. package/dist/playbooks/service-build/participation-radar.js +1 -1
  64. package/dist/playbooks/service-build/relationship-profile.js +1 -1
  65. package/dist/playbooks/service-build/reverse-mapping-nk4.spec.js +1 -1
  66. package/dist/playbooks/service-build/reverse-mapping.js +1 -1
  67. package/dist/playbooks/service-build/service-panorama.js +1 -1
  68. package/dist/playbooks/service-build/service-quote.js +1 -1
  69. package/dist/playbooks/service-build/service-quote.spec.js +1 -1
  70. package/dist/review/index.js +1 -1
  71. package/dist/safety/confirm-gate.js +1 -1
  72. package/dist/safety/preview.d.ts +1 -0
  73. package/dist/safety/preview.js +1 -1
  74. package/dist/schema/benchmark-migration/index.d.ts +14 -0
  75. package/dist/schema/benchmark-migration/index.js +1 -1
  76. package/dist/schema/call/allocation.d.ts +1 -1
  77. package/dist/schema/call/arbitration.d.ts +4 -4
  78. package/dist/schema/call/arbitration.js +1 -1
  79. package/dist/schema/call/base.d.ts +13 -5
  80. package/dist/schema/call/base.js +1 -1
  81. package/dist/schema/call/bridge.d.ts +2 -0
  82. package/dist/schema/call/contact.d.ts +1 -1
  83. package/dist/schema/call/demand.d.ts +1 -1
  84. package/dist/schema/call/error-codes.d.ts +1 -1
  85. package/dist/schema/call/error-codes.js +1 -1
  86. package/dist/schema/call/guard.d.ts +3 -3
  87. package/dist/schema/call/guard.js +1 -1
  88. package/dist/schema/call/handler.js +1 -1
  89. package/dist/schema/call/machine.d.ts +1 -1
  90. package/dist/schema/call/machine.js +1 -1
  91. package/dist/schema/call/order.d.ts +1 -1
  92. package/dist/schema/call/order.js +1 -1
  93. package/dist/schema/call/permission.d.ts +1 -1
  94. package/dist/schema/call/personal.d.ts +4 -4
  95. package/dist/schema/call/progress.d.ts +1 -1
  96. package/dist/schema/call/progress.js +1 -1
  97. package/dist/schema/call/proof.js +1 -1
  98. package/dist/schema/call/repository.d.ts +5 -5
  99. package/dist/schema/call/repository.js +1 -1
  100. package/dist/schema/call/reward.d.ts +1 -1
  101. package/dist/schema/call/reward.js +1 -1
  102. package/dist/schema/call/semantic.js +1 -1
  103. package/dist/schema/call/service.d.ts +4 -1
  104. package/dist/schema/call/service.js +1 -1
  105. package/dist/schema/call/treasury.d.ts +1 -1
  106. package/dist/schema/common/index.d.ts +4 -4
  107. package/dist/schema/common/index.js +1 -1
  108. package/dist/schema/goal/index.d.ts +12 -0
  109. package/dist/schema/goal/planning.d.ts +18 -0
  110. package/dist/schema/goal/planning.js +1 -1
  111. package/dist/schema/local/index.d.ts +21 -0
  112. package/dist/schema/local/index.js +1 -1
  113. package/dist/schema/messenger/index.js +1 -1
  114. package/dist/schema/operations.d.ts +22 -21
  115. package/dist/schema/query/bi.d.ts +6 -6
  116. package/dist/schema/query/bi.js +1 -1
  117. package/dist/schema/query/index.d.ts +112 -54
  118. package/dist/schema/query/index.js +1 -1
  119. package/dist/schema/schema-query/index.d.ts +1 -0
  120. package/dist/schema/schema-query/index.js +1 -1
  121. package/dist/schema/schema-version.js +1 -1
  122. package/dist/schema/utils/permission-machine-check.d.ts +2 -0
  123. package/dist/schema/utils/permission-machine-check.js +1 -1
  124. package/dist/schema/workflow/index.d.ts +1 -1
  125. package/dist/schema-query-impl/index.js +1 -1
  126. package/dist/schemas/account_operation.output.json +2 -0
  127. package/dist/schemas/account_operation.schema.json +3 -3
  128. package/dist/schemas/benchmark_migration_operation.output.json +42 -0
  129. package/dist/schemas/benchmark_migration_operation.schema.json +13 -0
  130. package/dist/schemas/bridge_operation.output.json +2 -0
  131. package/dist/schemas/goal_operation.schema.json +26 -0
  132. package/dist/schemas/index.json +1 -1
  133. package/dist/schemas/local_cache_operation.output.json +2 -0
  134. package/dist/schemas/local_history_operation.output.json +2 -0
  135. package/dist/schemas/local_info_operation.output.json +2 -0
  136. package/dist/schemas/local_mark_operation.output.json +2 -0
  137. package/dist/schemas/messenger_operation.schema.json +4 -4
  138. package/dist/schemas/onchain_operations.output.json +7 -5
  139. package/dist/schemas/onchain_operations.schema.json +108 -92
  140. package/dist/schemas/onchain_operations_allocation.schema.json +5 -5
  141. package/dist/schemas/onchain_operations_arbitration.schema.json +10 -8
  142. package/dist/schemas/onchain_operations_contact.schema.json +6 -5
  143. package/dist/schemas/onchain_operations_demand.schema.json +6 -5
  144. package/dist/schemas/onchain_operations_gen_passport.schema.json +5 -5
  145. package/dist/schemas/onchain_operations_gen_proof.schema.json +1 -1
  146. package/dist/schemas/onchain_operations_guard.schema.json +4 -4
  147. package/dist/schemas/onchain_operations_machine.schema.json +7 -6
  148. package/dist/schemas/onchain_operations_order.schema.json +8 -7
  149. package/dist/schemas/onchain_operations_permission.schema.json +1 -0
  150. package/dist/schemas/onchain_operations_personal.schema.json +2 -2
  151. package/dist/schemas/onchain_operations_progress.schema.json +8 -7
  152. package/dist/schemas/onchain_operations_proof.schema.json +6 -6
  153. package/dist/schemas/onchain_operations_repository.schema.json +10 -9
  154. package/dist/schemas/onchain_operations_reward.schema.json +8 -7
  155. package/dist/schemas/onchain_operations_service.schema.json +16 -11
  156. package/dist/schemas/onchain_operations_treasury.schema.json +6 -5
  157. package/dist/schemas/onchain_table_data.output.json +7 -7
  158. package/dist/schemas/query_toolkit.output.json +31 -30
  159. package/dist/schemas/query_toolkit.schema.json +1 -1
  160. package/dist/schemas/schema_query.schema.json +4 -0
  161. package/dist/schemas/workflow_operation.schema.json +5 -5
  162. package/dist/schemas/wowok_buildin_info.output.json +140 -3
  163. package/dist/schemas/wowok_buildin_info.schema.json +2 -2
  164. package/dist/tools/handlers/benchmark-migration.d.ts +22 -1
  165. package/dist/tools/handlers/benchmark-migration.js +1 -1
  166. package/dist/tools/handlers/config.js +1 -1
  167. package/dist/tools/handlers/dispatch-expectations.d.ts +0 -1
  168. package/dist/tools/handlers/dispatch-expectations.js +1 -1
  169. package/dist/tools/handlers/local.js +1 -1
  170. package/dist/tools/handlers/onchain.js +1 -1
  171. package/dist/tools/handlers/query.d.ts +1 -0
  172. package/dist/tools/handlers/query.js +1 -1
  173. package/dist/tools/handlers/review-chain.js +1 -1
  174. package/dist/tools/handlers/schema-query.js +1 -1
  175. package/dist/tools/index.js +1 -1
  176. package/dist/tools/move-fn-index.gen.js +1 -1
  177. package/dist/tools/registry/files.js +1 -1
  178. package/dist/tools/registry/query.js +1 -1
  179. package/dist/tools/rules-hook.js +1 -1
  180. package/dist/tools/upgrade-check.d.ts +23 -0
  181. package/dist/tools/upgrade-check.js +1 -1
  182. package/dist/tools/wip-deploy-assist.d.ts +6 -0
  183. package/dist/tools/wip-deploy-assist.js +1 -1
  184. package/dist/tools/wrap.js +1 -1
  185. package/package.json +2 -2
@@ -1 +1 @@
1
- export const FIELD_CAPABILITY={'Order.dispute':{'writeBy':['order.dispute\x20(package,\x20via\x20the\x20Service-bound\x20dispute\x20filing\x20flow)'],'readBy':['order.dispute\x20count/contains\x20check\x20(MAX_DISPUTE_COUNT\x20gate,\x20order.move:101-102)','guard-query:\x20order.dispute\x20count\x20/\x20has'],'enforcedBy':['filing\x20is\x20allowlist-gated:\x20the\x20Service-bound\x20dispute\x20entry\x20points\x20enforce\x20the\x20arbitrator\x20allowlist\x20(39),\x20the\x20neutrality\x20rule\x20(33)\x20and\x20the\x20order\x20binding\x20(26)\x20BEFORE\x20the\x20case\x20is\x20minted;\x20the\x20Service-blind\x20arbitration-module\x20dispute\x20entries\x20abort\x20E_DISPUTE_DEPRECATED\x20(arbitration\x2010)'],'writeOnly':![],'notes':'A-11\x20CLOSED:\x20filing-time\x20enforcement\x20replaced\x20the\x20old\x20abort-only-at-compensation\x20surface;\x20an\x20off-allowlist\x20venue\x20can\x20no\x20longer\x20be\x20filed\x20against\x20at\x20all.','findings':['A-10','A-11'],'source':{'file':'order.move','line':0x45,'pattern':'dispute:\x20vector<address>'}},'Order.required_info':{'writeBy':['owner-only\x20order\x20field\x20update\x20(order.move:77-80)'],'readBy':['guard-query:\x20order.required_info\x20some\x20/\x20value'],'enforcedBy':[],'writeOnly':!![],'notes':'buy\x20path\x20never\x20reads\x20customer_required/required_info\x20(A-1).\x20Owner-write-only\x20field.','findings':['A-1','A-10'],'source':{'file':'order.move','line':0x49,'pattern':'required_info:\x20Option<address>'}},'Order.claimed_by':{'writeBy':['order.compensate\x20(package,\x20order.move:94-97)'],'readBy':['the\x20not-yet-claimed\x20assert\x20on\x20the\x20compensate/dispute\x20path','guard-query:\x20order.claimed_by\x20some\x20/\x20value'],'enforcedBy':['blocks\x20second\x20compensate/dispute'],'writeOnly':![],'notes':'NOT\x20read\x20by\x20allocation.alloc\x20—\x20refund\x20rail\x20must\x20self-check\x20via\x20refund\x20guard\x20(DUAL-RAIL-01).\x20Deliberate\x20design,\x20order.move:199-220.','findings':['A-3'],'source':{'file':'order.move','line':0x48,'pattern':'claimed_by:\x20Option<address>'}},'Order.time':{'writeBy':['order.new\x20(clock::timestamp_ms\x20at\x20creation)'],'readBy':['guard-query:\x20order.time'],'enforcedBy':['template-declared\x20time\x20anchors'],'writeOnly':![],'notes':'Stable\x20anchor\x20for\x20window\x20guards\x20—\x20unlike\x20Progress.current_time\x20it\x20is\x20path-INDEPENDENT.','source':{'file':'order.move','line':0x4a,'pattern':'time:\x20u64'}},'Service.customer_required':{'writeBy':['service\x20settings\x20(pre-publish)'],'readBy':['guard-query'],'enforcedBy':[],'writeOnly':!![],'notes':'A-1:\x20declared\x20but\x20never\x20enforced\x20on\x20buy.\x20Fix\x20=\x20body-level\x20assert\x20in\x20order\x20creation\x20(protocol\x20upgrade).','findings':['A-1'],'source':{'file':'service.move','line':0xcd,'pattern':'customer_required:\x20vector<String>'}},'Service.repositories':{'writeBy':['service\x20settings'],'readBy':['guard-query:\x20service.repository\x20count\x20/\x20has'],'enforcedBy':[],'writeOnly':!![],'findings':['A-10'],'source':{'file':'service.move','line':0xc8,'pattern':'repositories:\x20vector<address>'}},'Service.rewards':{'writeBy':['service\x20settings'],'readBy':['guard-query'],'enforcedBy':[],'writeOnly':!![],'findings':['A-10'],'source':{'file':'service.move','line':0xd3,'pattern':'rewards:\x20vector<address>'}},'Service.order_allocators':{'writeBy':['service\x20settings\x20(pre-publish\x20replace;\x20post-publish\x20append-only)'],'readBy':['buy\x20path\x20(order-bound\x20Allocation\x20creation)','guard-query'],'enforcedBy':['publish\x20requires\x20non-empty\x20(E_NO_ALLOCATOR,\x20service.move:689-700)'],'writeOnly':![],'notes':'Replacement\x20frozen\x20at\x20publish\x20(E_ALREADY_PUBLISHED\x20on\x20the\x20pre-publish\x20replacement\x20path).\x20Append-only\x20additions\x20remain\x20possible\x20via\x20the\x20allocator-append\x20mutation\x20—\x20prefix\x20allocators\x20+\x20threshold\x20frozen,\x20EALLOCATORS_NOT_EXTENSION=20\x20on\x20violation\x20(J1).\x20Zero\x20allocator\x20rows\x20=\x20no\x20settlement\x20and\x20no\x20refund\x20rail\x20(B-1).','findings':['B-1','A-2'],'source':{'file':'service.move','line':0xd2,'pattern':'order_allocators:\x20Option<Allocators>'}},'Sale.wip':{'writeBy':['service\x20sales\x20mutation'],'readBy':['guard-query'],'enforcedBy':[],'writeOnly':!![],'notes':'wip_hash\x20IS\x20enforced\x20at\x20quote\x20(E_WIP_HASH_NOT_MATCH);\x20wip\x20url\x20itself\x20is\x20not.\x20No\x20on-chain\x20escrow\x20of\x20wip\x20content\x20(A-15).','findings':['A-10','A-15'],'source':{'file':'service.move','line':0x6b,'pattern':'wip:\x20String'}},'Machine.consensus_repositories':{'writeBy':['machine\x20settings\x20(pre-publish)'],'readBy':['guard-query:\x20machine.consensus_repository\x20count\x20/\x20has'],'enforcedBy':[],'writeOnly':!![],'findings':['A-10'],'source':{'file':'machine.move','line':0x148,'pattern':'consensus_repositories:\x20vector<address>'}},'Machine.nodes':{'writeBy':['machine\x20graph\x20mutation\x20(pre-publish)'],'readBy':['progress\x20node-advance','guard-query'],'enforcedBy':['publish\x20freeze\x20—\x20publishing\x20blocks\x20all\x20later\x20graph\x20changes'],'writeOnly':![],'notes':'Missing\x20edge\x20after\x20publish\x20=\x20permanent\x20brick\x20(A-2);\x20L1\x20must\x20dry-run\x20terminal\x20reachability\x20pre-publish.','findings':['A-2'],'source':{'file':'machine.move','line':0x147,'pattern':'nodes:\x20ParentLinkedTable<String,\x20vector<NodePair>>'}},'Progress.current_time':{'writeBy':['progress\x20node\x20entry\x20(timestamp\x20refreshed\x20on\x20every\x20advance,\x20progress.move:458)'],'readBy':['guard-query:\x20progress.current_time'],'enforcedBy':['window\x20guards\x20anchored\x20on\x20it'],'writeOnly':![],'notes':'PATH-DEPENDENT:\x20=\x20time\x20of\x20entering\x20CURRENT\x20node.\x20Routing\x20through\x20extra\x20nodes\x20(e.g.\x20reviewed)\x20postpones\x20settlement\x20windows\x20(E-10).\x20TIME-ANCHOR-01\x20checks\x20anchor\x20invariance\x20across\x20paths.','findings':['E-10','D-14'],'source':{'file':'progress.move','line':0x55,'pattern':'current_time:\x20u64'}},'Discount.benchmark':{'writeBy':['service.discounts\x20(creation)'],'readBy':['quote\x20price\x20calc\x20(discount\x20application)'],'enforcedBy':[],'writeOnly':![],'notes':'A-4:\x20below-benchmark\x20coupon\x20does\x20NOT\x20change\x20price\x20but\x20IS\x20still\x20burned\x20(a\x20discounted\x20quote\x20sets\x20discount:some\x20and\x20the\x20buy\x20path\x20destroys\x20the\x20coupon\x20unconditionally).','findings':['A-4'],'source':{'file':'service.move','line':0x85,'pattern':'benchmark:\x20Option<u64>'}},'Allocation.payment_info.for_object':{'writeBy':['buy\x20path\x20(set\x20to\x20the\x20Order\x20anchor\x20at\x20Allocation\x20creation)'],'readBy':['allocation.alloc\x20(ENO_PAYMENT_INFO\x20assert)'],'enforcedBy':['alloc\x20aborts\x20when\x20absent'],'writeOnly':![],'notes':'None\x20+\x20GuardIdentifier\x20recipient\x20=\x20CRITICAL\x20(funds\x20unrouteable)\x20—\x20template_scan\x20R-RECIPIENT-03\x20territory.','source':{'file':'allocation.move','line':0x194,'pattern':'payment_info:\x20Option<PaymentInfo>'}},'Treasury.inflow':{'writeBy':['treasury\x20deposit\x20paths'],'readBy':['guard-query','direct\x20field\x20accessor\x20treasury.inflow'],'enforcedBy':[],'writeOnly':![],'notes':'owner_receive\x20moves\x20value\x20out\x20WITHOUT\x20touching\x20outflow\x20—\x20never\x20re-derive\x20inflow\x20from\x20events\x20(treasury.move:86-88).','source':{'file':'treasury.move','line':0x4f,'pattern':'inflow:\x20u128'}},'Contact.permission':{'writeBy':['contact\x20settings'],'readBy':[],'enforcedBy':[],'writeOnly':![],'notes':'Never\x20consulted\x20anywhere\x20—\x20the\x20contact\x20status-change\x20call\x20(contact.move:33-43)\x20ignores\x20it\x20(A-16).\x20Not\x20part\x20of\x20the\x20A-10\x20guard-query\x20cluster:\x20it\x20has\x20no\x20reader\x20at\x20all.','findings':['A-16'],'source':{'file':'contact.move','line':0x1e,'pattern':'permission:\x20address'}}};
1
+ export const FIELD_CAPABILITY={'Order.dispute':{'writeBy':['order.dispute\x20(package,\x20via\x20the\x20Service-bound\x20dispute\x20filing\x20flow)'],'readBy':['order.dispute\x20count/contains\x20check\x20(MAX_DISPUTE_COUNT\x20gate,\x20order.move:119-123)','guard-query:\x20order.dispute\x20count\x20/\x20has'],'enforcedBy':['filing\x20is\x20allowlist-gated:\x20the\x20Service-bound\x20dispute\x20entry\x20points\x20enforce\x20the\x20arbitrator\x20allowlist\x20(39),\x20the\x20neutrality\x20rule\x20(33)\x20and\x20the\x20order\x20binding\x20(26)\x20BEFORE\x20the\x20case\x20is\x20minted;\x20the\x20Service-blind\x20arbitration-module\x20dispute\x20entries\x20abort\x20E_DISPUTE_DEPRECATED\x20(arbitration\x2010)'],'writeOnly':![],'notes':'A-11\x20CLOSED:\x20filing-time\x20enforcement\x20replaced\x20the\x20old\x20abort-only-at-compensation\x20surface;\x20an\x20off-allowlist\x20venue\x20can\x20no\x20longer\x20be\x20filed\x20against\x20at\x20all.','findings':['A-10','A-11'],'source':{'file':'order.move','line':0x48,'pattern':'dispute:\x20vector<address>'}},'Order.required_info':{'writeBy':['owner-only\x20order\x20field\x20update\x20(order.move:79-82)','owner-only\x20controlled\x20Proof\x20bind\x20(order.move:93-100,\x20E_REQUIRED_INFO_PROOF_NOT_BOUND\x20on\x20mismatch)'],'readBy':['guard-query:\x20order.required_info\x20some\x20/\x20value'],'enforcedBy':[],'writeOnly':!![],'notes':'buy\x20path\x20never\x20reads\x20customer_required/required_info\x20(A-1).\x20Owner-write-only\x20field.\x20The\x20controlled\x20bind\x20makes\x20the\x20TARGET\x20verifiable\x20(about==order,\x20creator==owner);\x20the\x20FIELD\x20stays\x20attestation-only\x20—\x20presence\x20gates\x20only.','findings':['A-1','A-10'],'source':{'file':'order.move','line':0x4c,'pattern':'required_info:\x20Option<address>'}},'Order.claimed_by':{'writeBy':['order.compensate\x20(package,\x20order.move:114-117)'],'readBy':['the\x20not-yet-claimed\x20assert\x20on\x20the\x20compensate/dispute\x20path','guard-query:\x20order.claimed_by\x20some\x20/\x20value'],'enforcedBy':['blocks\x20second\x20compensate/dispute'],'writeOnly':![],'notes':'NOT\x20read\x20by\x20allocation.alloc\x20—\x20refund\x20rail\x20must\x20self-check\x20via\x20refund\x20guard\x20(DUAL-RAIL-01).\x20Deliberate\x20design,\x20order.move:238-259.','findings':['A-3'],'source':{'file':'order.move','line':0x4b,'pattern':'claimed_by:\x20Option<address>'}},'Order.time':{'writeBy':['order.new\x20(clock::timestamp_ms\x20at\x20creation)'],'readBy':['guard-query:\x20order.time'],'enforcedBy':['template-declared\x20time\x20anchors'],'writeOnly':![],'notes':'Stable\x20anchor\x20for\x20window\x20guards\x20—\x20unlike\x20Progress.current_time\x20it\x20is\x20path-INDEPENDENT.','source':{'file':'order.move','line':0x4d,'pattern':'time:\x20u64'}},'Service.customer_required':{'writeBy':['service\x20settings\x20(pre-publish)'],'readBy':['guard-query'],'enforcedBy':[],'writeOnly':!![],'notes':'A-1:\x20declared\x20but\x20never\x20enforced\x20on\x20buy.\x20Fix\x20=\x20body-level\x20assert\x20in\x20order\x20creation\x20(protocol\x20upgrade).','findings':['A-1'],'source':{'file':'service.move','line':0xcd,'pattern':'customer_required:\x20vector<String>'}},'Service.repositories':{'writeBy':['service\x20settings'],'readBy':['guard-query:\x20service.repository\x20count\x20/\x20has'],'enforcedBy':[],'writeOnly':!![],'findings':['A-10'],'source':{'file':'service.move','line':0xc8,'pattern':'repositories:\x20vector<address>'}},'Service.rewards':{'writeBy':['service\x20settings'],'readBy':['guard-query'],'enforcedBy':[],'writeOnly':!![],'findings':['A-10'],'source':{'file':'service.move','line':0xd3,'pattern':'rewards:\x20vector<address>'}},'Service.order_allocators':{'writeBy':['service\x20settings\x20(pre-publish\x20replace;\x20post-publish\x20append-only)'],'readBy':['buy\x20path\x20(order-bound\x20Allocation\x20creation)','guard-query'],'enforcedBy':['publish\x20requires\x20non-empty\x20(E_NO_ALLOCATOR,\x20service.move:689-700)'],'writeOnly':![],'notes':'Replacement\x20frozen\x20at\x20publish\x20(E_ALREADY_PUBLISHED\x20on\x20the\x20pre-publish\x20replacement\x20path).\x20Append-only\x20additions\x20remain\x20possible\x20via\x20the\x20allocator-append\x20mutation\x20—\x20prefix\x20allocators\x20+\x20threshold\x20frozen,\x20EALLOCATORS_NOT_EXTENSION=20\x20on\x20violation\x20(J1).\x20Zero\x20allocator\x20rows\x20=\x20no\x20settlement\x20and\x20no\x20refund\x20rail\x20(B-1).','findings':['B-1','A-2'],'source':{'file':'service.move','line':0xd2,'pattern':'order_allocators:\x20Option<Allocators>'}},'Sale.wip':{'writeBy':['service\x20sales\x20mutation'],'readBy':['guard-query'],'enforcedBy':[],'writeOnly':!![],'notes':'wip_hash\x20IS\x20enforced\x20at\x20quote\x20(E_WIP_HASH_NOT_MATCH);\x20wip\x20url\x20itself\x20is\x20not.\x20No\x20on-chain\x20escrow\x20of\x20wip\x20content\x20(A-15).','findings':['A-10','A-15'],'source':{'file':'service.move','line':0x6b,'pattern':'wip:\x20String'}},'Machine.consensus_repositories':{'writeBy':['machine\x20settings\x20(pre-publish)'],'readBy':['guard-query:\x20machine.consensus_repository\x20count\x20/\x20has'],'enforcedBy':[],'writeOnly':!![],'findings':['A-10'],'source':{'file':'machine.move','line':0x148,'pattern':'consensus_repositories:\x20vector<address>'}},'Machine.nodes':{'writeBy':['machine\x20graph\x20mutation\x20(pre-publish)'],'readBy':['progress\x20node-advance','guard-query'],'enforcedBy':['publish\x20freeze\x20—\x20publishing\x20blocks\x20all\x20later\x20graph\x20changes'],'writeOnly':![],'notes':'Missing\x20edge\x20after\x20publish\x20=\x20permanent\x20brick\x20(A-2);\x20L1\x20must\x20dry-run\x20terminal\x20reachability\x20pre-publish.','findings':['A-2'],'source':{'file':'machine.move','line':0x147,'pattern':'nodes:\x20ParentLinkedTable<String,\x20vector<NodePair>>'}},'Progress.current_time':{'writeBy':['progress\x20node\x20entry\x20(timestamp\x20refreshed\x20on\x20every\x20advance,\x20progress.move:458)'],'readBy':['guard-query:\x20progress.current_time'],'enforcedBy':['window\x20guards\x20anchored\x20on\x20it'],'writeOnly':![],'notes':'PATH-DEPENDENT:\x20=\x20time\x20of\x20entering\x20CURRENT\x20node.\x20Routing\x20through\x20extra\x20nodes\x20(e.g.\x20reviewed)\x20postpones\x20settlement\x20windows\x20(E-10).\x20TIME-ANCHOR-01\x20checks\x20anchor\x20invariance\x20across\x20paths.','findings':['E-10','D-14'],'source':{'file':'progress.move','line':0x55,'pattern':'current_time:\x20u64'}},'Discount.benchmark':{'writeBy':['service.discounts\x20(creation)'],'readBy':['quote\x20price\x20calc\x20(discount\x20application)'],'enforcedBy':[],'writeOnly':![],'notes':'A-4:\x20below-benchmark\x20coupon\x20does\x20NOT\x20change\x20price\x20but\x20IS\x20still\x20burned\x20(a\x20discounted\x20quote\x20sets\x20discount:some\x20and\x20the\x20buy\x20path\x20destroys\x20the\x20coupon\x20unconditionally).','findings':['A-4'],'source':{'file':'service.move','line':0x85,'pattern':'benchmark:\x20Option<u64>'}},'Allocation.payment_info.for_object':{'writeBy':['buy\x20path\x20(set\x20to\x20the\x20Order\x20anchor\x20at\x20Allocation\x20creation)'],'readBy':['allocation.alloc\x20(ENO_PAYMENT_INFO\x20assert)'],'enforcedBy':['alloc\x20aborts\x20when\x20absent'],'writeOnly':![],'notes':'None\x20+\x20GuardIdentifier\x20recipient\x20=\x20CRITICAL\x20(funds\x20unrouteable)\x20—\x20template_scan\x20R-RECIPIENT-03\x20territory.','source':{'file':'allocation.move','line':0x194,'pattern':'payment_info:\x20Option<PaymentInfo>'}},'Treasury.inflow':{'writeBy':['treasury\x20deposit\x20paths'],'readBy':['guard-query','direct\x20field\x20accessor\x20treasury.inflow'],'enforcedBy':[],'writeOnly':![],'notes':'owner_receive\x20moves\x20value\x20out\x20WITHOUT\x20touching\x20outflow\x20—\x20never\x20re-derive\x20inflow\x20from\x20events\x20(treasury.move:86-88).','source':{'file':'treasury.move','line':0x4f,'pattern':'inflow:\x20u128'}},'Contact.permission':{'writeBy':['contact\x20settings'],'readBy':[],'enforcedBy':[],'writeOnly':![],'notes':'Never\x20consulted\x20anywhere\x20—\x20the\x20contact\x20status-change\x20call\x20(contact.move:33-43)\x20ignores\x20it\x20(A-16).\x20Not\x20part\x20of\x20the\x20A-10\x20guard-query\x20cluster:\x20it\x20has\x20no\x20reader\x20at\x20all.','findings':['A-16'],'source':{'file':'contact.move','line':0x1e,'pattern':'permission:\x20address'}}};
@@ -1 +1 @@
1
- export const FUND_FLOWS={'buy_entry':{'kind':'entry','summary':'Buyer\x20pays:\x20coin\x20split\x20->\x20Order\x20+\x20Allocation\x20escrow\x20anchored\x20to\x20the\x20order.','path':['service\x20buy\x20(creates\x20Order,\x20service.move:459)','order-bound\x20Allocation\x20creation\x20(splits\x20coin,\x20sets\x20payment_info.for_object=order,\x20service.move:408)'],'invariants':['Allocation.balance\x20==\x20order\x20amount\x20at\x20creation','quote.ctx\x20binds\x20quote\x20to\x20tx\x20digest;\x20stock\x20deducted\x20in\x20same\x20tx\x20as\x20buy'],'sources':[{'file':'service.move','line':0x1cb,'pattern':'buy2_imp'},{'file':'service.move','line':0x198,'pattern':'order_allocation'}]},'exit_alloc':{'kind':'exit','summary':'Escrow\x20exit\x201\x20(settlement\x20/\x20refund):\x20guard-matched\x20allocators\x20distribute\x20the\x20pool.','path':['allocation.alloc\x20(allocation.move:408)','per\x20matched\x20allocator:\x20once-slot\x20(OnceKey{guard,\x20allocator\x20index,\x20key})\x20consumed','Payment<T>\x20created;\x20CoinWrapper<T>\x20transferred\x20to\x20each\x20recipient','recipient\x20unwraps\x20via\x20payment.unwrap\x20/\x20order.owner_receive'],'invariants':['balance\x20>=\x20allocators.threshold\x20(EINSUFFICIENT_BALANCE)','balance\x20>\x200\x20(EZERO_DISTRIBUTION)\x20—\x20replay\x20on\x20drained\x20pool\x20aborts','payment_info\x20must\x20be\x20some\x20(ENO_PAYMENT_INFO)','every\x20allocator\x20with\x20matching\x20guard\x20RUNS,\x20in\x20vector\x20order,\x20against\x20the\x20shrinking\x20pool','once-slot\x20per\x20allocator\x20index\x20makes\x20replay\x20of\x20the\x20same\x20guard\x20abort'],'findings':['A-3'],'sources':[{'file':'allocation.move','line':0x198,'pattern':'public\x20fun\x20alloc<T>'},{'file':'allocation.move','line':0x19f,'pattern':'EZERO_DISTRIBUTION'}]},'exit_compensation':{'kind':'exit','summary':'Escrow\x20exit\x202\x20(arbitration\x20indemnity):\x20service\x20compensation_fund\x20pays\x20order\x20owner\x20directly.','path':['service\x20compensation\x20claim\x20(service.move:494;\x20arbitrations\x20whitelist\x20+\x20E33\x20conflict\x20check\x20at\x20:503-505)','arbitration.compensate\x20->\x20order.compensate\x20writes\x20claimed_by','compensation_fund\x20split\x20->\x20public_transfer\x20to\x20order.owner\x20(service.move:512)'],'invariants':['order\x20must\x20not\x20be\x20already\x20claimed\x20(E_ORDER_ALREADY_CLAIMED)','claiming\x20arbitration\x20must\x20be\x20in\x20service.arbitrations\x20whitelist'],'sources':[{'file':'service.move','line':0x1ee,'pattern':'compensation_claim'},{'file':'service.move','line':0x200,'pattern':'order::owner(order)'},{'file':'order.move','line':0x5e,'pattern':'public(package)\x20fun\x20compensate'}]},'dual_rail_fact':{'kind':'fact','summary':'A-3\x20dual\x20rail:\x20alloc\x20never\x20reads\x20claimed_by;\x20compensate\x20never\x20touches\x20the\x20escrow\x20balance.','path':['order.move:213-234\x20(deliberate:\x20refund-of-principal\x20+\x20damages\x20in\x20one\x20case\x20is\x20legal)'],'invariants':['Double-pay\x20prevention\x20is\x20delegated\x20to\x20template\x20convention:\x20refund\x20guard\x20MUST\x20assert\x20claimed_by\x20is\x20none','Tool\x20layer\x20MUST\x20enforce\x20this\x20convention\x20via\x20rule\x20DUAL-RAIL-01\x20—\x20the\x20chain\x20will\x20not'],'findings':['A-3'],'sources':[{'file':'order.move','line':0xd5,'pattern':'claimed_by'}]},'buyer_receive':{'kind':'exit','summary':'Buyer\x20claims\x20inbound\x20funds:\x20order.owner_receive\x20unwraps\x20Payment\x20and\x20transfers\x20coin\x20to\x20owner.','path':['order.owner_receive\x20(order.move:235-237,\x20public_transfer\x20to\x20self.owner)'],'invariants':['only\x20order.owner\x20receives'],'sources':[{'file':'order.move','line':0xeb,'pattern':'owner_receive'}]},'reward_claim':{'kind':'exit','summary':'Reward\x20pool\x20exit:\x20guard+passport\x20gated\x20claim\x20transfers\x20coin\x20to\x20recipient.','path':['reward.claim\x20(reward.move:139)\x20->\x20coin\x20to\x20recipient\x20(reward.move:202)'],'invariants':['passport\x20must\x20satisfy\x20the\x20matched\x20RewardGuard'],'sources':[{'file':'reward.move','line':0x8b,'pattern':'public\x20fun\x20claim<T>'}]},'treasury_flows':{'kind':'internal','summary':'Treasury:\x20deposit/withdraw/guard-driven\x20external\x20flows;\x20owner_receive\x20bypasses\x20outflow\x20counter.','path':['treasury.deposit\x20/\x20withdraw\x20(external_*_guard\x20driven\x20variants)','treasury.owner_receive\x20moves\x20value\x20out\x20WITHOUT\x20touching\x20outflow'],'invariants':['inflow\x20and\x20outflow\x20are\x20u128\x20accumulators;\x20conservation\x20audit\x20must\x20read\x20fields,\x20not\x20events'],'sources':[{'file':'treasury.move','line':0x48,'pattern':'public\x20struct\x20Treasury<phantom\x20T>\x20has\x20key'}]},'discount_burn':{'kind':'fact','summary':'A-4:\x20coupon\x20burned\x20unconditionally\x20at\x20buy,\x20even\x20when\x20benchmark\x20unmet\x20(price\x20unchanged).','path':['the\x20discounted\x20quote\x20sets\x20quote.discount=some\x20unconditionally\x20(service.move:351)','the\x20buy\x20path\x20destroys\x20the\x20coupon\x20unconditionally\x20(service.move:469)'],'invariants':['Fix\x20(protocol\x20upgrade,\x20body-level):\x20the\x20discounted\x20quote\x20returns\x20discount:none\x20below\x20benchmark'],'findings':['A-4'],'sources':[{'file':'service.move','line':0x15f,'pattern':'discount'},{'file':'service.move','line':0x1d5,'pattern':'discount_destroy'}]},'conservation_gap':{'kind':'fact','summary':'No\x20on-chain\x20conservation\x20check:\x20accumulator_*\x20are\x20private\x20and\x20sender==@0x0\x20is\x20unreachable.','path':[],'invariants':['Conservation\x20(sum\x20in\x20==\x20sum\x20out\x20+\x20balances)\x20MUST\x20be\x20audited\x20by\x20the\x20tool\x20layer\x20post-materialization\x20(A-14)'],'findings':['A-14'],'sources':[{'file':'service.move','line':0xcf,'pattern':'compensation_fund:\x20Balance<T>'}]}};
1
+ export const FUND_FLOWS={'buy_entry':{'kind':'entry','summary':'Buyer\x20pays:\x20coin\x20split\x20->\x20Order\x20+\x20Allocation\x20escrow\x20anchored\x20to\x20the\x20order.','path':['service\x20buy\x20(creates\x20Order,\x20service.move:459)','order-bound\x20Allocation\x20creation\x20(splits\x20coin,\x20sets\x20payment_info.for_object=order,\x20service.move:408)'],'invariants':['Allocation.balance\x20==\x20order\x20amount\x20at\x20creation','quote.ctx\x20binds\x20quote\x20to\x20tx\x20digest;\x20stock\x20deducted\x20in\x20same\x20tx\x20as\x20buy'],'sources':[{'file':'service.move','line':0x1cb,'pattern':'buy2_imp'},{'file':'service.move','line':0x198,'pattern':'order_allocation'}]},'exit_alloc':{'kind':'exit','summary':'Escrow\x20exit\x201\x20(settlement\x20/\x20refund):\x20guard-matched\x20allocators\x20distribute\x20the\x20pool.','path':['allocation.alloc\x20(allocation.move:408)','per\x20matched\x20allocator:\x20once-slot\x20(OnceKey{guard,\x20allocator\x20index,\x20key})\x20consumed','Payment<T>\x20created;\x20CoinWrapper<T>\x20transferred\x20to\x20each\x20recipient','recipient\x20unwraps\x20via\x20payment.unwrap\x20/\x20order.owner_receive'],'invariants':['balance\x20>=\x20allocators.threshold\x20(EINSUFFICIENT_BALANCE)','balance\x20>\x200\x20(EZERO_DISTRIBUTION)\x20—\x20replay\x20on\x20drained\x20pool\x20aborts','payment_info\x20must\x20be\x20some\x20(ENO_PAYMENT_INFO)','every\x20allocator\x20with\x20matching\x20guard\x20RUNS,\x20in\x20vector\x20order,\x20against\x20the\x20shrinking\x20pool','once-slot\x20per\x20allocator\x20index\x20makes\x20replay\x20of\x20the\x20same\x20guard\x20abort'],'findings':['A-3'],'sources':[{'file':'allocation.move','line':0x198,'pattern':'public\x20fun\x20alloc<T>'},{'file':'allocation.move','line':0x19f,'pattern':'EZERO_DISTRIBUTION'}]},'exit_compensation':{'kind':'exit','summary':'Escrow\x20exit\x202\x20(arbitration\x20indemnity):\x20service\x20compensation_fund\x20pays\x20order\x20owner\x20directly.','path':['service\x20compensation\x20claim\x20(service.move:494;\x20arbitrations\x20whitelist\x20+\x20E33\x20conflict\x20check\x20at\x20:503-505)','arbitration.compensate\x20->\x20order.compensate\x20writes\x20claimed_by','compensation_fund\x20split\x20->\x20public_transfer\x20to\x20order.owner\x20(service.move:512)'],'invariants':['order\x20must\x20not\x20be\x20already\x20claimed\x20(E_ORDER_ALREADY_CLAIMED)','claiming\x20arbitration\x20must\x20be\x20in\x20service.arbitrations\x20whitelist'],'sources':[{'file':'service.move','line':0x1ee,'pattern':'compensation_claim'},{'file':'service.move','line':0x200,'pattern':'order::owner(order)'},{'file':'order.move','line':0x72,'pattern':'public(package)\x20fun\x20compensate'}]},'dual_rail_fact':{'kind':'fact','summary':'A-3\x20dual\x20rail:\x20alloc\x20never\x20reads\x20claimed_by;\x20compensate\x20never\x20touches\x20the\x20escrow\x20balance.','path':['order.move:238-259\x20(deliberate:\x20refund-of-principal\x20+\x20damages\x20in\x20one\x20case\x20is\x20legal)'],'invariants':['Double-pay\x20prevention\x20is\x20delegated\x20to\x20template\x20convention:\x20refund\x20guard\x20MUST\x20assert\x20claimed_by\x20is\x20none','Tool\x20layer\x20MUST\x20enforce\x20this\x20convention\x20via\x20rule\x20DUAL-RAIL-01\x20—\x20the\x20chain\x20will\x20not'],'findings':['A-3'],'sources':[{'file':'order.move','line':0xee,'pattern':'claimed_by'}]},'buyer_receive':{'kind':'exit','summary':'Buyer\x20claims\x20inbound\x20funds:\x20order.owner_receive\x20unwraps\x20Payment\x20and\x20transfers\x20coin\x20to\x20owner.','path':['order.owner_receive\x20(order.move:260-270,\x20public_transfer\x20to\x20self.owner)'],'invariants':['only\x20order.owner\x20receives'],'sources':[{'file':'order.move','line':0x104,'pattern':'owner_receive'}]},'reward_claim':{'kind':'exit','summary':'Reward\x20pool\x20exit:\x20guard+passport\x20gated\x20claim\x20transfers\x20coin\x20to\x20recipient.','path':['reward.claim\x20(reward.move:168)\x20->\x20coin\x20to\x20recipient\x20(reward.move:251)'],'invariants':['passport\x20must\x20satisfy\x20the\x20matched\x20RewardGuard'],'sources':[{'file':'reward.move','line':0xa8,'pattern':'public\x20fun\x20claim<T>'}]},'treasury_flows':{'kind':'internal','summary':'Treasury:\x20deposit/withdraw/guard-driven\x20external\x20flows;\x20owner_receive\x20bypasses\x20outflow\x20counter.','path':['treasury.deposit\x20/\x20withdraw\x20(external_*_guard\x20driven\x20variants)','treasury.owner_receive\x20moves\x20value\x20out\x20WITHOUT\x20touching\x20outflow'],'invariants':['inflow\x20and\x20outflow\x20are\x20u128\x20accumulators;\x20conservation\x20audit\x20must\x20read\x20fields,\x20not\x20events'],'sources':[{'file':'treasury.move','line':0x48,'pattern':'public\x20struct\x20Treasury<phantom\x20T>\x20has\x20key'}]},'discount_burn':{'kind':'fact','summary':'A-4:\x20coupon\x20burned\x20unconditionally\x20at\x20buy,\x20even\x20when\x20benchmark\x20unmet\x20(price\x20unchanged).','path':['the\x20discounted\x20quote\x20sets\x20quote.discount=some\x20unconditionally\x20(service.move:351)','the\x20buy\x20path\x20destroys\x20the\x20coupon\x20unconditionally\x20(service.move:469)'],'invariants':['Fix\x20(protocol\x20upgrade,\x20body-level):\x20the\x20discounted\x20quote\x20returns\x20discount:none\x20below\x20benchmark'],'findings':['A-4'],'sources':[{'file':'service.move','line':0x15f,'pattern':'discount'},{'file':'service.move','line':0x1d5,'pattern':'discount_destroy'}]},'conservation_gap':{'kind':'fact','summary':'No\x20on-chain\x20conservation\x20check:\x20accumulator_*\x20are\x20private\x20and\x20sender==@0x0\x20is\x20unreachable.','path':[],'invariants':['Conservation\x20(sum\x20in\x20==\x20sum\x20out\x20+\x20balances)\x20MUST\x20be\x20audited\x20by\x20the\x20tool\x20layer\x20post-materialization\x20(A-14)'],'findings':['A-14'],'sources':[{'file':'service.move','line':0xcf,'pattern':'compensation_fund:\x20Balance<T>'}]}};
@@ -1 +1 @@
1
- export const GUARD_QUERY_SOURCE='ts-sdk/packages/wowok/src/w/call/guard-ins.ts#GUARDQUERY';export const NATIVE_VALIDATION={'entry':'the\x20native\x20guard-data\x20validation\x20call\x20(guard.move:15),\x20invoked\x20at\x20guard.move:271','semantics':['Query\x20on\x20absent\x20object\x20/\x20unset\x20Option\x20/\x20missing\x20collection\x20entry\x20aborts\x20with\x20VM\x20error\x20(e.g.\x20W_FIELD_NOT_FOUND)\x20—\x20the\x20Guard\x20does\x20NOT\x20silently\x20return\x200.\x20Safe\x20failure\x20mode,\x20NOT\x20a\x20null-bypass\x20risk.','Guard.rep\x20flag:\x20false\x20means\x20the\x20queried\x20object\x20or\x20first\x20parameter\x20failed\x20validation.','Empty-value\x20table\x20constant\x20crashes\x20with\x20MovePrimitiveRuntimeError\x20(A-5):\x20vector::borrow(&item.value,0)\x20without\x20length\x20check.'],'sources':[{'file':'guard.move','line':0xf,'pattern':'native\x20fun\x20validate_guard_data'},{'file':'guard.move','line':0x10f,'pattern':'validate_guard_data(&table_data,\x20input)'},{'file':'guard.move','line':0x76,'pattern':'rep:\x20bool'}]};export const PATH_DEPENDENT_TIME_QUERIES=[{'queryPrefix':'progress.current_time','semantics':'Time\x20of\x20ENTERING\x20the\x20current\x20node\x20(progress.move:458),\x20not\x20of\x20any\x20business\x20event.\x20A\x20buyer\x20leaving\x20a\x20review\x20(detour\x20via\x20reviewed\x20node)\x20postpones\x20merchant\x20settlement\x20windows.','findings':['E-10','D-14'],'sources':[{'file':'progress.move','line':0x55,'pattern':'current_time:\x20u64'}]},{'queryPrefix':'progress.session.forward.time','semantics':'Per-forward\x20last-op\x20time\x20inside\x20the\x20current\x20session;\x20also\x20path-local.','findings':['E-10'],'sources':[{'file':'progress.move','line':0x2d,'pattern':'time:\x20u64'}]}];export const STABLE_TIME_QUERIES=[{'queryPrefix':'order.time','semantics':'Order\x20creation\x20time\x20(order.move:112).\x20Never\x20moves.\x20Preferred\x20anchor\x20for\x20settlement/refund\x20windows.'}];export const WRITE_ONLY_QUERY_PREFIXES=[{'queryPrefix':'order.required_info','field':'Order.required_info','findings':['A-1','A-10']},{'queryPrefix':'order.claimed_by','field':'Order.claimed_by','findings':['A-3']},{'queryPrefix':'service.repository','field':'Service.repositories','findings':['A-10']},{'queryPrefix':'service.reward','field':'Service.rewards','findings':['A-10']},{'queryPrefix':'service.sale.wip','field':'Sale.wip','findings':['A-10','A-15']},{'queryPrefix':'machine.consensus_repository','field':'Machine.consensus_repositories','findings':['A-10']}];
1
+ export const GUARD_QUERY_SOURCE='ts-sdk/packages/wowok/src/w/call/guard-ins.ts#GUARDQUERY';export const NATIVE_VALIDATION={'entry':'the\x20native\x20guard-data\x20validation\x20call\x20(guard.move:15),\x20invoked\x20at\x20guard.move:271','semantics':['Query\x20on\x20absent\x20object\x20/\x20unset\x20Option\x20/\x20missing\x20collection\x20entry\x20aborts\x20with\x20VM\x20error\x20(e.g.\x20W_FIELD_NOT_FOUND)\x20—\x20the\x20Guard\x20does\x20NOT\x20silently\x20return\x200.\x20Safe\x20failure\x20mode,\x20NOT\x20a\x20null-bypass\x20risk.','Guard.rep\x20flag:\x20false\x20means\x20the\x20queried\x20object\x20or\x20first\x20parameter\x20failed\x20validation.','Empty-value\x20table\x20constant\x20crashes\x20with\x20MovePrimitiveRuntimeError\x20(A-5):\x20vector::borrow(&item.value,0)\x20without\x20length\x20check.'],'sources':[{'file':'guard.move','line':0xf,'pattern':'native\x20fun\x20validate_guard_data'},{'file':'guard.move','line':0x10f,'pattern':'validate_guard_data(&table_data,\x20input)'},{'file':'guard.move','line':0x76,'pattern':'rep:\x20bool'}]};export const PATH_DEPENDENT_TIME_QUERIES=[{'queryPrefix':'progress.current_time','semantics':'Time\x20of\x20ENTERING\x20the\x20current\x20node\x20(progress.move:458),\x20not\x20of\x20any\x20business\x20event.\x20A\x20buyer\x20leaving\x20a\x20review\x20(detour\x20via\x20reviewed\x20node)\x20postpones\x20merchant\x20settlement\x20windows.','findings':['E-10','D-14'],'sources':[{'file':'progress.move','line':0x55,'pattern':'current_time:\x20u64'}]},{'queryPrefix':'progress.session.forward.time','semantics':'Per-forward\x20last-op\x20time\x20inside\x20the\x20current\x20session;\x20also\x20path-local.','findings':['E-10'],'sources':[{'file':'progress.move','line':0x2d,'pattern':'time:\x20u64'}]}];export const STABLE_TIME_QUERIES=[{'queryPrefix':'order.time','semantics':'Order\x20creation\x20time\x20(order.move:151).\x20Never\x20moves.\x20Preferred\x20anchor\x20for\x20settlement/refund\x20windows.'}];export const WRITE_ONLY_QUERY_PREFIXES=[{'queryPrefix':'order.required_info','field':'Order.required_info','findings':['A-1','A-10']},{'queryPrefix':'order.claimed_by','field':'Order.claimed_by','findings':['A-3']},{'queryPrefix':'service.repository','field':'Service.repositories','findings':['A-10']},{'queryPrefix':'service.reward','field':'Service.rewards','findings':['A-10']},{'queryPrefix':'service.sale.wip','field':'Sale.wip','findings':['A-10','A-15']},{'queryPrefix':'machine.consensus_repository','field':'Machine.consensus_repositories','findings':['A-10']}];
@@ -1 +1 @@
1
- export const OBJECT_GRAPH={'Sale':{'module':'service','ownership':'value','references':{},'valueFields':{'name':'String','price':'u64','stock':'u64','suspension':'bool','wip':'String\x20//\x20write-only\x20(A-10)','wip_hash':'String\x20//\x20enforced\x20at\x20quote\x20(E_WIP_HASH_NOT_MATCH)'},'notes':'Value\x20type\x20embedded\x20in\x20Service.sales;\x20no\x20independent\x20identity.','source':{'file':'service.move','line':0x66,'pattern':'public\x20struct\x20Sale\x20has\x20store,\x20drop,\x20copy'},'findings':['A-10','A-15']},'Permission':{'module':'permission','ownership':'shared','references':{'um':'Contact?'},'valueFields':{'owner':'address','admin':'vector<address>','description':'String','remark':'vector<PermissionRemark>','table':'ParentLinkedTable<address,\x20vector<u16>>\x20//\x20entity/guard\x20->\x20perm\x20indexes'},'notes':'USER_DEFINED_PERM_INDEX_START=1000\x20enforced\x20at\x20construction;\x20the\x20permission\x20check\x20grants\x20all\x20indexes\x20to\x20admins.','source':{'file':'permission.move','line':0x21,'pattern':'public\x20struct\x20Permission\x20has\x20key'}},'Guard':{'module':'guard','ownership':'shared','references':{'relies':'address[]\x20//\x20any\x20object'},'valueFields':{'description':'String','table':'vector<TableItem>','validated':'vector<TableItemType>','input':'vector<u8>','relies_logic_and':'bool','immutable':'bool','rep':'bool'},'notes':'rep=false\x20means\x20the\x20queried\x20object/first\x20param\x20failed\x20the\x201167\x20query\x20validation.','source':{'file':'guard.move','line':0x6d,'pattern':'public\x20struct\x20Guard\x20has\x20key'}},'Machine':{'module':'machine','ownership':'shared','references':{'consensus_repositories':'Repository[]','um':'Contact?','permission':'Permission'},'valueFields':{'description':'String','nodes':'ParentLinkedTable<String,\x20vector<NodePair>>','bPaused':'bool','bPublished':'bool'},'notes':'Forward\x20=\x20{namedOperator?\x20|\x20permissionIndex?\x20(pre-check,\x20namedOperator\x20first)}\x20+\x20guard?\x20(post-check).\x20permissionIndex>=1000\x20at\x20construction;\x20retained_submission\x20must\x20be\x20subset\x20of\x20guard\x20submissions.\x20namedOperator\x20\x27\x27\x20(empty)\x20=\x20order\x20holder\x20—\x20the\x20open-subscription\x20buyer\x20self-advance\x20standard;\x20\x27\x27\x20may\x20coexist\x20with\x20permissionIndex\x20on\x20one\x20forward\x20(order\x20holder\x20OR\x20permission\x20entity).','source':{'file':'machine.move','line':0x144,'pattern':'public\x20struct\x20Machine\x20has\x20key'}},'Service<T>':{'module':'service','typeParam':'T','ownership':'shared','references':{'repositories':'Repository[]','buy_guard':'Guard?','machine':'Machine?','arbitrations':'Arbitration<T>[]','order_allocators':'Guard\x20(via\x20Allocators.allocators[].guard)','rewards':'Reward<T>[]','um':'Contact?','permission':'Permission'},'valueFields':{'description':'String','location':'String','sales':'vector<Sale>','bPublished':'bool','bPaused':'bool','customer_required':'vector<String>','compensation_fund':'Balance<T>','paused_time':'Option<u64>','setting_lock_duration':'u64'},'notes':'customer_required\x20is\x20write-only,\x20buy\x20path\x20never\x20enforces\x20it\x20(A-1).\x20compensation_fund\x20pays\x20arbitrator\x20indemnity\x20directly\x20to\x20order\x20owner.','source':{'file':'service.move','line':0xc3,'pattern':'public\x20struct\x20Service<phantom\x20T>\x20has\x20key'},'findings':['A-1','A-4','A-9','A-10','A-15']},'Order':{'module':'order','ownership':'shared','references':{'service':'Service<T>','machine':'Machine?','progress':'Progress?','allocation':'Allocation<T>?','discount':'Discount?','claimed_by':'Arb<T>?','required_info':'Contact|Proof?','dispute':'Arb<T>[]','agent':'address[]'},'valueFields':{'items':'vector<SaleItem>','amount':'u64','owner':'address','time':'u64\x20//\x20order\x20creation'},'notes':'claimed_by\x20written\x20by\x20compensate;\x20NOT\x20read\x20by\x20allocation.alloc\x20(dual-rail,\x20A-3\x20deliberate).\x20required_info\x20writable\x20by\x20owner\x20only,\x20enforced\x20nowhere\x20(A-1).','source':{'file':'order.move','line':0x3c,'pattern':'public\x20struct\x20Order\x20has\x20key'},'findings':['A-1','A-3','A-10']},'Progress':{'module':'progress','ownership':'shared','references':{'machine':'Machine','task':'Order?','context_repositories':'Repository[]'},'valueFields':{'current':'String','namedOperator':'vector<NamedOperator>','session':'vector<Session>','history':'ParentTableVec<History>','current_time':'u64\x20//\x20TIME\x20OF\x20ENTERING\x20CURRENT\x20NODE,\x20path-dependent\x20(E-10)'},'notes':'current_time\x20refreshes\x20on\x20every\x20node\x20transition;\x20window\x20guards\x20anchored\x20on\x20it\x20are\x20path-dependent.','source':{'file':'progress.move','line':0x4c,'pattern':'public\x20struct\x20Progress\x20has\x20key'},'findings':['E-10','D-14','A-6']},'Allocation<T>':{'module':'allocation','typeParam':'T','ownership':'shared','references':{'allocators.allocators[].guard':'Guard','payment':'Payment<T>[]','payment_info.for_object':'Order\x20(anchor)'},'valueFields':{'balance':'Balance<T>','allocators':'Allocators','payment_info':'Option<PaymentInfo>'},'notes':'alloc\x20runs\x20EVERY\x20allocator\x20whose\x20guard\x20matches;\x20each\x20consumes\x20a\x20once-slot\x20keyed\x20by\x20allocator\x20index;\x20evaluated\x20in\x20vector\x20order\x20against\x20shrinking\x20pool.','source':{'file':'allocation.move','line':0x190,'pattern':'public\x20struct\x20Allocation<phantom\x20T>\x20has\x20key'},'findings':['A-3']},'Payment<T>':{'module':'payment','typeParam':'T','ownership':'shared','references':{'info.for_object':'object?','info.for_guard':'Guard?','from_object':'object?'},'valueFields':{'amount':'u64','time':'u64','info':'PaymentInfo','signer':'address','record':'vector<Revenue>'},'source':{'file':'payment.move','line':0x5c,'pattern':'public\x20struct\x20Payment<phantom\x20T>\x20has\x20key'}},'CoinWrapper<T>':{'module':'payment','typeParam':'T','ownership':'owned','references':{'payment':'Payment<T>'},'valueFields':{'balance':'Balance<T>'},'notes':'Transferred\x20to\x20each\x20recipient;\x20unwrap\x20yields\x20Coin<T>.','source':{'file':'payment.move','line':0x27,'pattern':'public\x20struct\x20CoinWrapper<phantom\x20T>\x20has\x20key,\x20store'}},'Arbitration<T>':{'module':'arbitration','typeParam':'T','ownership':'shared','references':{'voting_guard[].guard':'Guard','usage_guard':'Guard?','um':'Contact?','permission':'Permission'},'valueFields':{'description':'String','location':'String','fee':'u64','balance':'Balance<T>','bPaused':'bool'},'notes':'Independent\x20arbitrator\x20=\x20independent\x20account\x20+\x20independent\x20Permission.\x20Empty\x20voting_guard\x20=\x20open\x20voting.','source':{'file':'arbitration.move','line':0x2f,'pattern':'public\x20struct\x20Arbitration<phantom\x20T>\x20has\x20key'}},'Arb<T>':{'module':'arb','typeParam':'T','ownership':'shared','references':{'order':'Order','arbitration':'Arbitration<T>'},'valueFields':{'voted':'vector<Voted>','proposition':'vector<Proposition>','fee':'Balance<T>','feedback':'String','indemnity':'Option<Indemnity>','voting_deadline':'Option<u64>','objection':'String','status':'u8\x20//\x200..6\x20Principal_confirming..Withdrawn','compensation_time':'Option<u64>','time':'u64'},'source':{'file':'arb.move','line':0x86,'pattern':'public\x20struct\x20Arb<phantom\x20T>\x20has\x20key'}},'Repository':{'module':'repository','ownership':'shared','references':{'policies[].write_guard[].guard':'Guard','policies[].quote_guard':'Guard?','rewards':'Reward<T>[]','um':'Contact?','permission':'Permission'},'valueFields':{'description':'String','policies':'vector<PolicyRule>','data':'ParentTable<DataKey,\x20vector<u8>>'},'notes':'Policies\x20mutable\x20post-share\x20via\x20the\x20permission-guarded\x20policy\x20add/set/remove/clear\x20calls\x20(repository.move:695-776).\x20The\x20passport-based\x20id-data\x20removal\x20call\x20always\x20aborts\x20(A-8).','source':{'file':'repository.move','line':0x1e2,'pattern':'public\x20struct\x20Repository\x20has\x20key'},'findings':['A-8','A-10']},'Demand':{'module':'demand','ownership':'shared','references':{'rewards':'Reward<T>[]','guards[].guard':'Guard','um':'Contact?','permission':'Permission'},'valueFields':{'description':'String','location':'String','presenters':'ParentTable<address,\x20ServiceInfo>'},'source':{'file':'demand.move','line':0x49,'pattern':'public\x20struct\x20Demand\x20has\x20key'}},'Reward<T>':{'module':'reward','typeParam':'T','ownership':'shared','references':{'guards[].guard':'Guard','um':'Contact?','permission':'Permission'},'valueFields':{'description':'String','balance':'Balance<T>','guard_not_added_expiration_time':'Option<u64>','record':'ParentTable<address,\x20RecipientRecord>'},'source':{'file':'reward.move','line':0x80,'pattern':'public\x20struct\x20Reward<phantom\x20T>\x20has\x20key'}},'Treasury<T>':{'module':'treasury','typeParam':'T','ownership':'shared','references':{'external_deposit_guard[].guard':'Guard','external_withdraw_guard[].guard':'Guard','um':'Contact?','permission':'Permission'},'valueFields':{'balance':'Balance<T>','history':'ParentTable<address,\x20Record>','inflow':'u128','outflow':'u128'},'notes':'owner_receive\x20moves\x20value\x20out\x20WITHOUT\x20touching\x20outflow;\x20read\x20inflow\x20field,\x20never\x20re-derive\x20from\x20events.','source':{'file':'treasury.move','line':0x48,'pattern':'public\x20struct\x20Treasury<phantom\x20T>\x20has\x20key'}},'Contact':{'module':'contact','ownership':'shared','references':{'permission':'Permission'},'valueFields':{'description':'String','location':'String','ims':'vector<Im>'},'notes':'The\x20contact\x20status-change\x20call\x20has\x20NO\x20permission\x20check;\x20the\x20permission\x20field\x20is\x20never\x20consulted\x20by\x20it\x20(A-16).','source':{'file':'contact.move','line':0x19,'pattern':'public\x20struct\x20Contact\x20has\x20key'},'findings':['A-16']},'Proof':{'module':'proof','ownership':'owned','references':{'about':'object?'},'valueFields':{'description':'String','proof':'String','item_count':'Option<u64>','server_pubkey':'String','server_signature':'String','signer':'address','proof_type':'u64','time':'u64'},'notes':'No\x20share_object\x20in\x20module;\x20owned\x20by\x20creator.\x20Carrier\x20for\x20WTS\x20evidence\x20anchors.','source':{'file':'proof.move','line':0xd,'pattern':'public\x20struct\x20Proof\x20has\x20key'}},'Discount':{'module':'service','ownership':'owned','references':{'service':'Service<T>'},'valueFields':{'name':'String','discount_type':'u8\x20//\x200=rates\x201=minus','benchmark':'Option<u64>','off':'u64','time_start':'u64','time_end':'u64','transferable':'bool'},'notes':'Transferred\x20to\x20buyer.\x20Burned\x20unconditionally\x20at\x20buy\x20even\x20when\x20benchmark\x20unmet\x20(A-4).','source':{'file':'service.move','line':0x81,'pattern':'public\x20struct\x20Discount\x20has\x20key'},'findings':['A-4']},'Passport':{'module':'passport','ownership':'owned','references':{'guard[].guard':'Guard','guard[].relies':'address[]','impack':'address[]'},'valueFields':{'result':'bool','tx_hash':'vector<u8>','time':'u64','signer':'address','has_verified':'bool'},'notes':'No\x20share_object\x20in\x20module;\x20carried\x20by\x20signer,\x20mutated\x20across\x20guard\x20checks.','source':{'file':'passport.move','line':0x28,'pattern':'public\x20struct\x20Passport\x20has\x20key'}},'EntityOrders':{'module':'entity_order','ownership':'singleton','references':{},'valueFields':{'table':'ParentTable<address,\x20vector<OrderRoleItem>>'},'notes':'Reverse\x20index\x20entity->orders.\x20FIFO\x20eviction\x20at\x205200\x20entries\x20(entity_order.move:72-78)\x20—\x20silent.','source':{'file':'entity_order.move','line':0x1e,'pattern':'public\x20struct\x20EntityOrders\x20has\x20key'},'findings':['A-13']},'EntityPermission':{'module':'entity_permission','ownership':'singleton','references':{},'valueFields':{'table':'ParentTable<address,\x20vector<PermissionItem>>'},'source':{'file':'entity_permission.move','line':0x1e,'pattern':'public\x20struct\x20EntityPermission\x20has\x20key'}},'EntityContact':{'module':'entity_contact','ownership':'singleton','references':{},'valueFields':{'table':'ParentTable<address,\x20vector<ContactItem>>'},'source':{'file':'entity_contact.move','line':0x18,'pattern':'public\x20struct\x20EntityContact\x20has\x20key'}},'ObjectLinkerCore':{'module':'object_linker','ownership':'singleton','references':{},'valueFields':{'table':'ParentTable<address,\x20vector<CoreLink>>\x20//\x20target\x20->\x20core\x20who[],\x20lossless'},'source':{'file':'object_linker.move','line':0x25,'pattern':'public\x20struct\x20ObjectLinkerCore\x20has\x20key'}},'ObjectLinkerTx':{'module':'object_linker','ownership':'singleton','references':{},'valueFields':{'table':'ParentTable<address,\x20TxBuffer>\x20//\x20target\x20->\x20recent\x20tx\x20who[],\x20lossy\x20FIFO'},'source':{'file':'object_linker.move','line':0x2b,'pattern':'public\x20struct\x20ObjectLinkerTx\x20has\x20key'}},'Registrar':{'module':'registrar','ownership':'singleton','references':{},'valueFields':{'table':'ParentTable<address,\x20Votes>\x20//\x20who\x20->\x20likes/dislikes/favors'},'source':{'file':'registrar.move','line':0xb4,'pattern':'public\x20struct\x20Registrar\x20has\x20key'}},'Entity':{'module':'registrar','ownership':'singleton','references':{},'valueFields':{'table':'ParentTable<address,\x20AddressInfo>'},'source':{'file':'registrar.move','line':0xb9,'pattern':'public\x20struct\x20Entity\x20has\x20key'}},'Messenger':{'module':'registrar','ownership':'singleton','references':{},'valueFields':{'table':'ParentTable<String,\x20PubKeyData>'},'notes':'DEAD:\x20struct\x20declared\x20but\x20share_object\x20commented\x20out\x20(registrar.move:209-212).\x20No\x20on-chain\x20Messenger\x20(A-16).','source':{'file':'registrar.move','line':0x278,'pattern':'public\x20struct\x20Messenger\x20has\x20key'},'findings':['A-16']},'Resource':{'module':'resource','ownership':'shared','references':{},'valueFields':{'table':'ParentTable<address,\x20AddressTag>'},'source':{'file':'resource.move','line':0x11,'pattern':'public\x20struct\x20Resource\x20has\x20key'}}};
1
+ export const OBJECT_GRAPH={'Sale':{'module':'service','ownership':'value','references':{},'valueFields':{'name':'String','price':'u64','stock':'u64','suspension':'bool','wip':'String\x20//\x20write-only\x20(A-10)','wip_hash':'String\x20//\x20enforced\x20at\x20quote\x20(E_WIP_HASH_NOT_MATCH)'},'notes':'Value\x20type\x20embedded\x20in\x20Service.sales;\x20no\x20independent\x20identity.','source':{'file':'service.move','line':0x66,'pattern':'public\x20struct\x20Sale\x20has\x20store,\x20drop,\x20copy'},'findings':['A-10','A-15']},'Permission':{'module':'permission','ownership':'shared','references':{'um':'Contact?'},'valueFields':{'owner':'address','admin':'vector<address>','description':'String','remark':'vector<PermissionRemark>','table':'ParentLinkedTable<address,\x20vector<u16>>\x20//\x20entity/guard\x20->\x20perm\x20indexes'},'notes':'USER_DEFINED_PERM_INDEX_START=1000\x20enforced\x20at\x20construction;\x20the\x20permission\x20check\x20grants\x20all\x20indexes\x20to\x20admins.','source':{'file':'permission.move','line':0x21,'pattern':'public\x20struct\x20Permission\x20has\x20key'}},'Guard':{'module':'guard','ownership':'shared','references':{'relies':'address[]\x20//\x20any\x20object'},'valueFields':{'description':'String','table':'vector<TableItem>','validated':'vector<TableItemType>','input':'vector<u8>','relies_logic_and':'bool','immutable':'bool','rep':'bool'},'notes':'rep=false\x20means\x20the\x20queried\x20object/first\x20param\x20failed\x20the\x201167\x20query\x20validation.','source':{'file':'guard.move','line':0x6d,'pattern':'public\x20struct\x20Guard\x20has\x20key'}},'Machine':{'module':'machine','ownership':'shared','references':{'consensus_repositories':'Repository[]','um':'Contact?','permission':'Permission'},'valueFields':{'description':'String','nodes':'ParentLinkedTable<String,\x20vector<NodePair>>','bPaused':'bool','bPublished':'bool'},'notes':'Forward\x20=\x20{namedOperator?\x20|\x20permissionIndex?\x20(pre-check,\x20namedOperator\x20first)}\x20+\x20guard?\x20(post-check).\x20permissionIndex>=1000\x20at\x20construction;\x20retained_submission\x20must\x20be\x20subset\x20of\x20guard\x20submissions.\x20namedOperator\x20\x27\x27\x20(empty)\x20=\x20order\x20holder\x20—\x20the\x20open-subscription\x20buyer\x20self-advance\x20standard;\x20\x27\x27\x20may\x20coexist\x20with\x20permissionIndex\x20on\x20one\x20forward\x20(order\x20holder\x20OR\x20permission\x20entity).','source':{'file':'machine.move','line':0x144,'pattern':'public\x20struct\x20Machine\x20has\x20key'}},'Service<T>':{'module':'service','typeParam':'T','ownership':'shared','references':{'repositories':'Repository[]','buy_guard':'Guard?','machine':'Machine?','arbitrations':'Arbitration<T>[]','order_allocators':'Guard\x20(via\x20Allocators.allocators[].guard)','rewards':'Reward<T>[]','um':'Contact?','permission':'Permission'},'valueFields':{'description':'String','location':'String','sales':'vector<Sale>','bPublished':'bool','bPaused':'bool','customer_required':'vector<String>','compensation_fund':'Balance<T>','paused_time':'Option<u64>','setting_lock_duration':'u64'},'notes':'customer_required\x20is\x20write-only,\x20buy\x20path\x20never\x20enforces\x20it\x20(A-1).\x20compensation_fund\x20pays\x20arbitrator\x20indemnity\x20directly\x20to\x20order\x20owner.','source':{'file':'service.move','line':0xc3,'pattern':'public\x20struct\x20Service<phantom\x20T>\x20has\x20key'},'findings':['A-1','A-4','A-9','A-10','A-15']},'Order':{'module':'order','ownership':'shared','references':{'service':'Service<T>','machine':'Machine?','progress':'Progress?','allocation':'Allocation<T>?','discount':'Discount?','claimed_by':'Arb<T>?','required_info':'Contact|Proof?','dispute':'Arb<T>[]','agent':'address[]'},'valueFields':{'items':'vector<SaleItem>','amount':'u64','owner':'address','time':'u64\x20//\x20order\x20creation'},'notes':'claimed_by\x20written\x20by\x20compensate;\x20NOT\x20read\x20by\x20allocation.alloc\x20(dual-rail,\x20A-3\x20deliberate).\x20required_info\x20writable\x20by\x20owner\x20only;\x20the\x20FIELD\x20stays\x20attestation-only\x20(A-1:\x20buy\x20never\x20requires\x20it),\x20but\x20a\x20controlled\x20Proof\x20bind\x20entry\x20(MOV-PROTOCOL-1212\x2011)\x20now\x20chain-enforces\x20proof-about==order\x20&&\x20proof-creator==owner\x20at\x20write\x20time\x20(rejection\x20aborts,\x20nothing\x20written).','source':{'file':'order.move','line':0x3f,'pattern':'public\x20struct\x20Order\x20has\x20key'},'findings':['A-1','A-3','A-10']},'Progress':{'module':'progress','ownership':'shared','references':{'machine':'Machine','task':'Order?','context_repositories':'Repository[]'},'valueFields':{'current':'String','namedOperator':'vector<NamedOperator>','session':'vector<Session>','history':'ParentTableVec<History>','current_time':'u64\x20//\x20TIME\x20OF\x20ENTERING\x20CURRENT\x20NODE,\x20path-dependent\x20(E-10)'},'notes':'current_time\x20refreshes\x20on\x20every\x20node\x20transition;\x20window\x20guards\x20anchored\x20on\x20it\x20are\x20path-dependent.','source':{'file':'progress.move','line':0x4c,'pattern':'public\x20struct\x20Progress\x20has\x20key'},'findings':['E-10','D-14','A-6']},'Allocation<T>':{'module':'allocation','typeParam':'T','ownership':'shared','references':{'allocators.allocators[].guard':'Guard','payment':'Payment<T>[]','payment_info.for_object':'Order\x20(anchor)'},'valueFields':{'balance':'Balance<T>','allocators':'Allocators','payment_info':'Option<PaymentInfo>'},'notes':'alloc\x20runs\x20EVERY\x20allocator\x20whose\x20guard\x20matches;\x20each\x20consumes\x20a\x20once-slot\x20keyed\x20by\x20allocator\x20index;\x20evaluated\x20in\x20vector\x20order\x20against\x20shrinking\x20pool.','source':{'file':'allocation.move','line':0x190,'pattern':'public\x20struct\x20Allocation<phantom\x20T>\x20has\x20key'},'findings':['A-3']},'Payment<T>':{'module':'payment','typeParam':'T','ownership':'shared','references':{'info.for_object':'object?','info.for_guard':'Guard?','from_object':'object?'},'valueFields':{'amount':'u64','time':'u64','info':'PaymentInfo','signer':'address','record':'vector<Revenue>'},'source':{'file':'payment.move','line':0x5c,'pattern':'public\x20struct\x20Payment<phantom\x20T>\x20has\x20key'}},'CoinWrapper<T>':{'module':'payment','typeParam':'T','ownership':'owned','references':{'payment':'Payment<T>'},'valueFields':{'balance':'Balance<T>'},'notes':'Transferred\x20to\x20each\x20recipient;\x20unwrap\x20yields\x20Coin<T>.','source':{'file':'payment.move','line':0x27,'pattern':'public\x20struct\x20CoinWrapper<phantom\x20T>\x20has\x20key,\x20store'}},'Arbitration<T>':{'module':'arbitration','typeParam':'T','ownership':'shared','references':{'voting_guard[].guard':'Guard','usage_guard':'Guard?','um':'Contact?','permission':'Permission'},'valueFields':{'description':'String','location':'String','fee':'u64','balance':'Balance<T>','bPaused':'bool'},'notes':'Independent\x20arbitrator\x20=\x20independent\x20account\x20+\x20independent\x20Permission.\x20Empty\x20voting_guard\x20=\x20open\x20voting.','source':{'file':'arbitration.move','line':0x2f,'pattern':'public\x20struct\x20Arbitration<phantom\x20T>\x20has\x20key'}},'Arb<T>':{'module':'arb','typeParam':'T','ownership':'shared','references':{'order':'Order','arbitration':'Arbitration<T>'},'valueFields':{'voted':'vector<Voted>','proposition':'vector<Proposition>','fee':'Balance<T>','feedback':'String','indemnity':'Option<Indemnity>','voting_deadline':'Option<u64>','objection':'String','status':'u8\x20//\x200..6\x20Principal_confirming..Withdrawn','compensation_time':'Option<u64>','time':'u64'},'source':{'file':'arb.move','line':0x86,'pattern':'public\x20struct\x20Arb<phantom\x20T>\x20has\x20key'}},'Repository':{'module':'repository','ownership':'shared','references':{'policies[].write_guard[].guard':'Guard','policies[].quote_guard':'Guard?','rewards':'Reward<T>[]','um':'Contact?','permission':'Permission'},'valueFields':{'description':'String','policies':'vector<PolicyRule>','data':'ParentTable<DataKey,\x20vector<u8>>'},'notes':'Policies\x20mutable\x20post-share\x20via\x20the\x20permission-guarded\x20policy\x20add/set/remove/clear\x20calls\x20(repository.move:695-776).\x20The\x20passport-based\x20id-data\x20removal\x20call\x20always\x20aborts\x20(A-8).','source':{'file':'repository.move','line':0x1e2,'pattern':'public\x20struct\x20Repository\x20has\x20key'},'findings':['A-8','A-10']},'Demand':{'module':'demand','ownership':'shared','references':{'rewards':'Reward<T>[]','guards[].guard':'Guard','um':'Contact?','permission':'Permission'},'valueFields':{'description':'String','location':'String','presenters':'ParentTable<address,\x20ServiceInfo>'},'source':{'file':'demand.move','line':0x49,'pattern':'public\x20struct\x20Demand\x20has\x20key'}},'Reward<T>':{'module':'reward','typeParam':'T','ownership':'shared','references':{'guards[].guard':'Guard','um':'Contact?','permission':'Permission'},'valueFields':{'description':'String','balance':'Balance<T>','guard_not_added_expiration_time':'Option<u64>','record':'ParentTable<address,\x20RecipientRecord>'},'source':{'file':'reward.move','line':0x9d,'pattern':'public\x20struct\x20Reward<phantom\x20T>\x20has\x20key'}},'Treasury<T>':{'module':'treasury','typeParam':'T','ownership':'shared','references':{'external_deposit_guard[].guard':'Guard','external_withdraw_guard[].guard':'Guard','um':'Contact?','permission':'Permission'},'valueFields':{'balance':'Balance<T>','history':'ParentTable<address,\x20Record>','inflow':'u128','outflow':'u128'},'notes':'owner_receive\x20moves\x20value\x20out\x20WITHOUT\x20touching\x20outflow;\x20read\x20inflow\x20field,\x20never\x20re-derive\x20from\x20events.','source':{'file':'treasury.move','line':0x48,'pattern':'public\x20struct\x20Treasury<phantom\x20T>\x20has\x20key'}},'Contact':{'module':'contact','ownership':'shared','references':{'permission':'Permission'},'valueFields':{'description':'String','location':'String','ims':'vector<Im>'},'notes':'The\x20contact\x20status-change\x20call\x20has\x20NO\x20permission\x20check;\x20the\x20permission\x20field\x20is\x20never\x20consulted\x20by\x20it\x20(A-16).','source':{'file':'contact.move','line':0x19,'pattern':'public\x20struct\x20Contact\x20has\x20key'},'findings':['A-16']},'Proof':{'module':'proof','ownership':'owned','references':{'about':'object?'},'valueFields':{'description':'String','proof':'String','item_count':'Option<u64>','server_pubkey':'String','server_signature':'String','signer':'address','proof_type':'u64','time':'u64'},'notes':'No\x20share_object\x20in\x20module;\x20owned\x20by\x20creator.\x20Carrier\x20for\x20WTS\x20evidence\x20anchors.','source':{'file':'proof.move','line':0xd,'pattern':'public\x20struct\x20Proof\x20has\x20key'}},'Discount':{'module':'service','ownership':'owned','references':{'service':'Service<T>'},'valueFields':{'name':'String','discount_type':'u8\x20//\x200=rates\x201=minus','benchmark':'Option<u64>','off':'u64','time_start':'u64','time_end':'u64','transferable':'bool'},'notes':'Transferred\x20to\x20buyer.\x20Burned\x20unconditionally\x20at\x20buy\x20even\x20when\x20benchmark\x20unmet\x20(A-4).','source':{'file':'service.move','line':0x81,'pattern':'public\x20struct\x20Discount\x20has\x20key'},'findings':['A-4']},'Passport':{'module':'passport','ownership':'owned','references':{'guard[].guard':'Guard','guard[].relies':'address[]','impack':'address[]'},'valueFields':{'result':'bool','tx_hash':'vector<u8>','time':'u64','signer':'address','has_verified':'bool'},'notes':'No\x20share_object\x20in\x20module;\x20carried\x20by\x20signer,\x20mutated\x20across\x20guard\x20checks.','source':{'file':'passport.move','line':0x28,'pattern':'public\x20struct\x20Passport\x20has\x20key'}},'EntityOrders':{'module':'entity_order','ownership':'singleton','references':{},'valueFields':{'table':'ParentTable<address,\x20vector<OrderRoleItem>>'},'notes':'Reverse\x20index\x20entity->orders.\x20FIFO\x20eviction\x20at\x205200\x20entries\x20(entity_order.move:72-78)\x20—\x20silent.','source':{'file':'entity_order.move','line':0x1e,'pattern':'public\x20struct\x20EntityOrders\x20has\x20key'},'findings':['A-13']},'EntityPermission':{'module':'entity_permission','ownership':'singleton','references':{},'valueFields':{'table':'ParentTable<address,\x20vector<PermissionItem>>'},'source':{'file':'entity_permission.move','line':0x1e,'pattern':'public\x20struct\x20EntityPermission\x20has\x20key'}},'EntityContact':{'module':'entity_contact','ownership':'singleton','references':{},'valueFields':{'table':'ParentTable<address,\x20vector<ContactItem>>'},'source':{'file':'entity_contact.move','line':0x18,'pattern':'public\x20struct\x20EntityContact\x20has\x20key'}},'ObjectLinkerCore':{'module':'object_linker','ownership':'singleton','references':{},'valueFields':{'table':'ParentTable<address,\x20vector<CoreLink>>\x20//\x20target\x20->\x20core\x20who[],\x20lossless'},'source':{'file':'object_linker.move','line':0x25,'pattern':'public\x20struct\x20ObjectLinkerCore\x20has\x20key'}},'ObjectLinkerTx':{'module':'object_linker','ownership':'singleton','references':{},'valueFields':{'table':'ParentTable<address,\x20TxBuffer>\x20//\x20target\x20->\x20recent\x20tx\x20who[],\x20lossy\x20FIFO'},'source':{'file':'object_linker.move','line':0x2b,'pattern':'public\x20struct\x20ObjectLinkerTx\x20has\x20key'}},'Registrar':{'module':'registrar','ownership':'singleton','references':{},'valueFields':{'table':'ParentTable<address,\x20Votes>\x20//\x20who\x20->\x20likes/dislikes/favors'},'source':{'file':'registrar.move','line':0xb4,'pattern':'public\x20struct\x20Registrar\x20has\x20key'}},'Entity':{'module':'registrar','ownership':'singleton','references':{},'valueFields':{'table':'ParentTable<address,\x20AddressInfo>'},'source':{'file':'registrar.move','line':0xb9,'pattern':'public\x20struct\x20Entity\x20has\x20key'}},'Messenger':{'module':'registrar','ownership':'singleton','references':{},'valueFields':{'table':'ParentTable<String,\x20PubKeyData>'},'notes':'DEAD:\x20struct\x20declared\x20but\x20share_object\x20commented\x20out\x20(registrar.move:209-212).\x20No\x20on-chain\x20Messenger\x20(A-16).','source':{'file':'registrar.move','line':0x278,'pattern':'public\x20struct\x20Messenger\x20has\x20key'},'findings':['A-16']},'Resource':{'module':'resource','ownership':'shared','references':{},'valueFields':{'table':'ParentTable<address,\x20AddressTag>'},'source':{'file':'resource.move','line':0x11,'pattern':'public\x20struct\x20Resource\x20has\x20key'}}};
@@ -1 +1 @@
1
- import{getJudgmentDoc}from'../config/judgment.js';import{evaluateRuleBook}from'../config/rule-engine.js';import{isPathDependentTimeQuery}from'../chain-semantics/index.js';import{MAX_INDEMNITY_MULTIPLE}from'../knowledge/onchain-constants.js';import{numericAmount}from'../knowledge/audit-rules.js';import{createsOf,isRef,refsOf,validatePlan}from'./plan.js';function collectQueries(a,b=[]){if(Array['isArray'](a)){for(const c of a)collectQueries(c,b);}else{if(typeof a==='object'&&a!==null){const d=a;d['type']==='query'&&typeof d['query']==='string'&&b['push']({'query':d['query']});for(const e of Object['values'](d))collectQueries(e,b);}}return b;}function acceptedProgressNodes(a,b){const c=new Map();if(Array['isArray'](b))for(const g of b){if(typeof g==='object'&&g!==null){const h=g;typeof h['identifier']==='number'&&typeof h['value']==='string'&&c['set'](h['identifier'],h['value']);}}const d=i=>{if(typeof i!=='object'||i===null)return undefined;const j=i;if(j['type']==='constant'&&typeof j['value']==='string')return j['value'];if(j['type']==='identifier'&&typeof j['identifier']==='number')return c['get'](j['identifier']);return undefined;},e=[],f=i=>{if(Array['isArray'](i)){for(const n of i)f(n);return;}if(typeof i!=='object'||i===null)return;const j=i,k=Array['isArray'](j['nodes'])?j['nodes']:undefined,l=k?.[0x0]??j['left'],m=k?.[0x1]??j['right'];if(typeof j['type']==='string'&&j['type']['startsWith']('logic')&&typeof l==='object'&&l!==null&&l['type']==='query'&&l['query']==='progress.current'){const o=d(m);if(o!==undefined)e['push'](o);}for(const p of Object['values'](j))f(p);};return f(a),e;}function guardProjection(a){const b=a['params']['root']??a['params']['logic'],c=collectQueries(b)['map'](d=>d['query']);return{'stepId':a['id'],'queries':c,'acceptedNodes':acceptedProgressNodes(b,a['params']['table']),'table':Array['isArray'](a['params']['table'])?a['params']['table']:[]};}function allocatorRows(a){const b=[],c=d=>{if(typeof d==='object'&&d!==null&&!Array['isArray'](d)){const e=d;if(Array['isArray'](e['allocators']))d=e['allocators'];}if(!Array['isArray'](d))return;for(const f of d){if(typeof f!=='object'||f===null)continue;const g=f,h=g['guard'],i=g['guard_key'],j=Array['isArray'](g['sharing'])?g['sharing']:[],k=j['map'](l=>typeof l==='object'&&l!==null?l['who']:undefined)['map'](l=>typeof l==='object'&&l!==null?l['GuardIdentifier']:undefined)['filter'](l=>typeof l==='number');b['push']({'track':typeof g['track']==='string'?g['track']:'settlement','guardStep':isRef(h)?h['$ref']:undefined,'guardKey':typeof i==='string'?i:undefined,'identifierLegs':k});}};for(const d of a['steps']){if(d['op']==='create'&&d['object']==='service')c(d['params']['order_allocators']);if(d['op']==='configure'&&d['method']==='order_allocators')c(d['params']['allocators']);}return b;}function machineProjection(a){const b=createsOf(a,'machine')[0x0];if(b===undefined)return undefined;const c=b['params']['nodes'];if(!Array['isArray'](c))return{'nodes':[],'edges':[],'terminals':[],'forwardGuardRefs':[]};const d=[],e=[],f=[];for(const j of c){if(typeof j!=='object'||j===null)continue;const k=j,l=typeof k['name']==='string'?k['name']:undefined;if(l===undefined)continue;d['push'](l);const m=Array['isArray'](k['pairs'])?k['pairs']:[];for(const n of m){const o=n,q=o?.['prev_node'];if(typeof q==='string')e['push']({'prev':q,'next':l});const r=Array['isArray'](o?.['forwards'])?o['forwards']:[];for(const s of r){const t=s?.['guard'];if(isRef(t))f['push'](t['$ref']);}}}const h=b['params']['pairs'];if(Array['isArray'](h))for(const u of h){const v=u;typeof v?.['prev_node']==='string'&&typeof v?.['next_node']==='string'&&e['push']({'prev':v['prev_node'],'next':v['next_node']});}const i=new Set(e['map'](w=>w['prev'])['filter'](w=>w!==''));return{'nodes':d,'edges':e,'terminals':d['filter'](w=>!i['has'](w)),'forwardGuardRefs':f};}function pathCountCap2(a,b){const c=new Map();for(const g of a){const h=c['get'](g['prev'])??[];h['push'](g['next']),c['set'](g['prev'],h);}let d=0x0;const f=(i,j)=>{if(d>=0x2)return;if(i===b){d+=0x1;return;}if(j['has'](i))return;const k=new Set(j)['add'](i);for(const l of c['get'](i)??[])f(l,k);};for(const i of c['get']('')??[])f(i,new Set());return d;}const WRITE_ONLY_ENFORCEMENT_SOURCES=[{'object':'service','param':'customer_required','coverQuery':'order.required_info','extract':a=>Array['isArray'](a['params']['customer_required'])&&a['params']['customer_required']['length']>0x0},{'object':'service','param':'sales[].wip','coverQuery':'service.sale.wip','extract':a=>Array['isArray'](a['params']['sales'])&&a['params']['sales']['some'](b=>typeof b==='object'&&b!==null&&typeof b['wip']==='string'&&b['wip']['length']>0x0)}];export function planFacts(a){const b=new Map(createsOf(a,'guard')['map'](J=>[J['id'],guardProjection(J)])),c=allocatorRows(a),d=machineProjection(a),e=createsOf(a,'service')['length']>0x0,f=createsOf(a,'repository')['length']>0x0,h=new Set();for(const J of c){const K=J['guardStep']===undefined?undefined:b['get'](J['guardStep']);for(const L of K?.['acceptedNodes']??[])h['add'](L);}const i=d?.['terminals']??[],j=i['find'](M=>!h['has'](M)),k=a['pending_guards']??[],l=k['filter'](M=>M['site']==='allocator')['length'],m=k['find'](M=>M['site']==='allocator'||M['site']==='machine_edge')?.['key'],o=k['find'](M=>M['site']==='service_buy')?.['key'],p=d?.['nodes']['find'](M=>/return/i['test'](M)),q=a['steps']['some'](M=>{if(M['op']==='configure'&&M['method']==='arbitrations'){const N=M['params']['objects'];return Array['isArray'](N)&&N['length']>0x0;}if(M['op']==='create'&&M['object']==='service'){const O=M['params']['arbitrations'];return Array['isArray'](O)&&O['length']>0x0;}return![];});let t,u=![];for(const M of a['steps']){if(M['op']==='configure'&&M['method']==='compensation_fund_add'){u=!![];const N=numericAmount(M['params']['balance']);if(N!==undefined)t=(t??0x0)+N;}}let v;const w=O=>{if(!Array['isArray'](O))return;for(const P of O){const Q=numericAmount(P?.['price']);if(Q!==undefined&&Q>0x0)v=Math['max'](v??0x0,Q);}};for(const O of a['steps']){if(O['op']==='create'&&O['object']==='service')w(O['params']['sales']);if(O['op']==='configure'&&O['method']==='sales')w(O['params']['sales']);}const x=t!==undefined&&v!==undefined,y=c['filter'](P=>P['track']==='refund'),z=y['map'](P=>P['guardStep']===undefined?undefined:b['get'](P['guardStep']))['find'](P=>P!==undefined&&!P['queries']['some'](Q=>Q['startsWith']('order.claimed_by')))?.['stepId'];let A,B=![];for(const P of b['values']()){if(P['queries']['some'](isPathDependentTimeQuery)){A??=P['stepId'];if(d!==undefined)for(const Q of P['acceptedNodes']){if(pathCountCap2(d['edges'],Q)>=0x2){B=!![],A=P['stepId'];break;}}}if(B)break;}const C=[...b['values']()]['flatMap'](R=>R['queries']);let D;for(const R of WRITE_ONLY_ENFORCEMENT_SOURCES){for(const S of createsOf(a,R['object'])){if(R['extract'](S)&&!C['some'](T=>T['startsWith'](R['coverQuery']))){D=R['param'];break;}}if(D!==undefined)break;}const E=new Set();for(const T of a['steps']){if(T['op']==='create'&&T['object']==='guard')continue;const U=refsOf(T['op']==='publish'?T['target']:T['params']);for(const V of U)E['add'](V);if(T['op']==='configure'){for(const W of refsOf(T['target']))E['add'](W);}}const F=[...b['keys']()]['find'](X=>!E['has'](X)),G=[...b['values']()]['find'](X=>!f&&X['queries']['some'](Y=>Y['startsWith']('repository.')))?.['stepId'];let H;if(e&&d!==undefined)for(const X of d['forwardGuardRefs']){const Y=b['get'](X);if(Y===undefined)continue;const Z=Y['table']['some'](a0=>a0['identifier']===0xfe&&a0['b_submission']===!![]);if(!Z){H=X;break;}}let I;for(const a0 of c){if(a0['guardStep']===undefined||a0['identifierLegs']['length']===0x0)continue;const a1=b['get'](a0['guardStep']);if(a1===undefined)continue;for(const a2 of a0['identifierLegs']){const a3=a1['table']['find'](a4=>a4['identifier']===a2);if(a3===undefined||a3['b_submission']!==!![]||a3['value_type']!=='Address'){I='slot\x20'+a2+'\x20of\x20guard\x20\x27'+a0['guardStep']+'\x27';break;}}if(I!==undefined)break;}return{'has_service':e,'has_machine':d!==undefined,'has_repository':f,'allocator_row_count':c['length'],'refund_row_count':y['length'],'terminal_count':i['length'],'terminal_nodes_display':i['join'](',\x20'),'pending_allocator_guard_count':l,...j===undefined?{}:{'first_uncovered_terminal':j},...z===undefined?{}:{'first_refund_guard_missing_claimed_by':z},...A===undefined?{}:{'first_path_dependent_anchor':A},'path_sensitive':B,...D===undefined?{}:{'first_write_only_unenforced_field':D},...F===undefined?{}:{'first_orphan_guard':F},...G===undefined?{}:{'first_repo_query_without_repository':G},...H===undefined?{}:{'first_edge_guard_missing_254':H},...I===undefined?{}:{'first_alloc_slot_missing':I},...m===undefined?{}:{'first_pending_fund_guard':m},...o===undefined?{}:{'first_pending_buy_guard':o},'has_return_rail':p!==undefined,...p===undefined?{}:{'return_rail_node':p},'has_arbitration_binding':q,'fund_topup_present':u,...t===undefined?{}:{'fund_topup_amount':t},...x?{'fund_ceiling_breach':t<MAX_INDEMNITY_MULTIPLE*v,'fund_ceiling_basis':MAX_INDEMNITY_MULTIPLE+'x\x20the\x20highest\x20SKU\x20price'}:{},'fund_ceiling_unverifiable':u&&!x};}function planRuleBook(){const a=getJudgmentDoc()['rules']['domains']['plan'];if(!a)throw new Error('factory\x20rule\x20pack\x20\x27plan\x27\x20missing\x20—\x20broken\x20installation');return a['rules'];}export function auditPlan(a){const b=validatePlan(a),c=planFacts(a),{findings:d}=evaluateRuleBook(planRuleBook(),c),e=b['length']>0x0||d['some'](g=>g['level']==='critical'||g['level']==='high');return{'issues':b,'findings':d,'facts':c,'blocking':e};}
1
+ import{getJudgmentDoc}from'../config/judgment.js';import{evaluateRuleBook}from'../config/rule-engine.js';import{isPathDependentTimeQuery}from'../chain-semantics/index.js';import{MAX_INDEMNITY_MULTIPLE}from'../knowledge/onchain-constants.js';import{numericAmount}from'../knowledge/audit-rules.js';import{createsOf,isRef,refsOf,validatePlan}from'./plan.js';function collectQueries(a,b=[]){if(Array['isArray'](a)){for(const c of a)collectQueries(c,b);}else{if(typeof a==='object'&&a!==null){const d=a;d['type']==='query'&&typeof d['query']==='string'&&b['push']({'query':d['query']});for(const e of Object['values'](d))collectQueries(e,b);}}return b;}function acceptedProgressNodes(a,b){const c=new Map();if(Array['isArray'](b))for(const g of b){if(typeof g==='object'&&g!==null){const h=g;typeof h['identifier']==='number'&&typeof h['value']==='string'&&c['set'](h['identifier'],h['value']);}}const d=i=>{if(typeof i!=='object'||i===null)return undefined;const j=i;if(j['type']==='constant'&&typeof j['value']==='string')return j['value'];if(j['type']==='identifier'&&typeof j['identifier']==='number')return c['get'](j['identifier']);return undefined;},e=[],f=i=>{if(Array['isArray'](i)){for(const n of i)f(n);return;}if(typeof i!=='object'||i===null)return;const j=i,k=Array['isArray'](j['nodes'])?j['nodes']:undefined,l=k?.[0x0]??j['left'],m=k?.[0x1]??j['right'];if(typeof j['type']==='string'&&j['type']['startsWith']('logic')&&typeof l==='object'&&l!==null&&l['type']==='query'&&l['query']==='progress.current'){const o=d(m);if(o!==undefined)e['push'](o);}for(const p of Object['values'](j))f(p);};return f(a),e;}const REPO_WHERE_QUERY_TYPES=new Set(['query_repository_data_count_where','query_repository_data_sum_where','query_repository_data_find_where']);function collectRepoWhereQueries(a,b=[]){if(Array['isArray'](a)){for(const c of a)collectRepoWhereQueries(c,b);}else{if(typeof a==='object'&&a!==null){const d=a;typeof d['type']==='string'&&REPO_WHERE_QUERY_TYPES['has'](d['type'])&&b['push'](d);for(const e of Object['values'](d))collectRepoWhereQueries(e,b);}}return b;}function staticStringOperand(a,b){if(typeof a!=='object'||a===null)return undefined;const c=a;if(typeof c['identifier']==='number'){const d=b['find'](e=>typeof e==='object'&&e!==null&&e['identifier']===c['identifier']);if(d===undefined||d['b_submission']===!![])return undefined;return typeof d['value']==='string'?d['value']:undefined;}return typeof c['value']==='string'?c['value']:undefined;}function isPlanLocalObjectOperand(a,b){if(typeof a!=='object'||a===null)return![];const c=a;if(typeof c['identifier']!=='number')return![];const d=b['find'](f=>typeof f==='object'&&f!==null&&f['identifier']===c['identifier']);if(d===undefined||d['b_submission']===!![])return![];const e=d['value'];if(typeof e==='object'&&e!==null)return!![];return typeof e==='string'&&e['startsWith']('$');}function guardProjection(a){const b=a['params']['root']??a['params']['logic'],c=collectQueries(b)['map'](d=>d['query']);return{'stepId':a['id'],'queries':c,'acceptedNodes':acceptedProgressNodes(b,a['params']['table']),'table':Array['isArray'](a['params']['table'])?a['params']['table']:[]};}function allocatorRows(a){const b=[],c=d=>{if(typeof d==='object'&&d!==null&&!Array['isArray'](d)){const e=d;if(Array['isArray'](e['allocators']))d=e['allocators'];}if(!Array['isArray'](d))return;for(const f of d){if(typeof f!=='object'||f===null)continue;const g=f,h=g['guard'],i=g['guard_key'],j=Array['isArray'](g['sharing'])?g['sharing']:[],k=j['map'](l=>typeof l==='object'&&l!==null?l['who']:undefined)['map'](l=>typeof l==='object'&&l!==null?l['GuardIdentifier']:undefined)['filter'](l=>typeof l==='number');b['push']({'track':typeof g['track']==='string'?g['track']:'settlement','guardStep':isRef(h)?h['$ref']:undefined,'guardKey':typeof i==='string'?i:undefined,'identifierLegs':k});}};for(const d of a['steps']){if(d['op']==='create'&&d['object']==='service')c(d['params']['order_allocators']);if(d['op']==='configure'&&d['method']==='order_allocators')c(d['params']['allocators']);}return b;}function machineProjection(a){const b=createsOf(a,'machine')[0x0];if(b===undefined)return undefined;const c=b['params']['nodes'];if(!Array['isArray'](c))return{'nodes':[],'edges':[],'terminals':[],'forwardGuardRefs':[]};const d=[],e=[],f=[];for(const j of c){if(typeof j!=='object'||j===null)continue;const k=j,l=typeof k['name']==='string'?k['name']:undefined;if(l===undefined)continue;d['push'](l);const m=Array['isArray'](k['pairs'])?k['pairs']:[];for(const n of m){const o=n,q=o?.['prev_node'];if(typeof q==='string')e['push']({'prev':q,'next':l});const r=Array['isArray'](o?.['forwards'])?o['forwards']:[];for(const s of r){const t=s?.['guard'];if(isRef(t))f['push'](t['$ref']);}}}const h=b['params']['pairs'];if(Array['isArray'](h))for(const u of h){const v=u;typeof v?.['prev_node']==='string'&&typeof v?.['next_node']==='string'&&e['push']({'prev':v['prev_node'],'next':v['next_node']});}const i=new Set(e['map'](w=>w['prev'])['filter'](w=>w!==''));return{'nodes':d,'edges':e,'terminals':d['filter'](w=>!i['has'](w)),'forwardGuardRefs':f};}function pathCountCap2(a,b){const c=new Map();for(const g of a){const h=c['get'](g['prev'])??[];h['push'](g['next']),c['set'](g['prev'],h);}let d=0x0;const f=(i,j)=>{if(d>=0x2)return;if(i===b){d+=0x1;return;}if(j['has'](i))return;const k=new Set(j)['add'](i);for(const l of c['get'](i)??[])f(l,k);};for(const i of c['get']('')??[])f(i,new Set());return d;}const WRITE_ONLY_ENFORCEMENT_SOURCES=[{'object':'service','param':'customer_required','coverQuery':'order.required_info','extract':a=>Array['isArray'](a['params']['customer_required'])&&a['params']['customer_required']['length']>0x0},{'object':'service','param':'sales[].wip','coverQuery':'service.sale.wip','extract':a=>Array['isArray'](a['params']['sales'])&&a['params']['sales']['some'](b=>typeof b==='object'&&b!==null&&typeof b['wip']==='string'&&b['wip']['length']>0x0)}];export function planFacts(a){const b=new Map(createsOf(a,'guard')['map'](O=>[O['id'],guardProjection(O)])),c=allocatorRows(a),d=machineProjection(a),e=createsOf(a,'service')['length']>0x0,f=createsOf(a,'repository')['length']>0x0,h=new Set();for(const O of c){const P=O['guardStep']===undefined?undefined:b['get'](O['guardStep']);for(const Q of P?.['acceptedNodes']??[])h['add'](Q);}const i=d?.['terminals']??[],j=i['find'](R=>!h['has'](R)),k=a['pending_guards']??[],l=k['filter'](R=>R['site']==='allocator')['length'],m=k['filter'](R=>R['site']==='allocator'||R['site']==='machine_edge'),o=k['filter'](R=>R['site']==='service_buy'),q=m[0x0]?.['key'],t=o[0x0]?.['key'],u=d?.['nodes']['find'](R=>/return/i['test'](R)),v=a['steps']['some'](R=>{if(R['op']==='configure'&&R['method']==='arbitrations'){const S=R['params']['objects'];return Array['isArray'](S)&&S['length']>0x0;}if(R['op']==='create'&&R['object']==='service'){const T=R['params']['arbitrations'];return Array['isArray'](T)&&T['length']>0x0;}return![];});let w,x=![];for(const R of a['steps']){if(R['op']==='configure'&&R['method']==='compensation_fund_add'){x=!![];const S=numericAmount(R['params']['balance']);if(S!==undefined)w=(w??0x0)+S;}}let y;const z=T=>{if(!Array['isArray'](T))return;for(const U of T){const V=numericAmount(U?.['price']);if(V!==undefined&&V>0x0)y=Math['max'](y??0x0,V);}};for(const T of a['steps']){if(T['op']==='create'&&T['object']==='service')z(T['params']['sales']);if(T['op']==='configure'&&T['method']==='sales')z(T['params']['sales']);}const A=w!==undefined&&y!==undefined,B=c['filter'](U=>U['track']==='refund'),C=B['map'](U=>U['guardStep']===undefined?undefined:b['get'](U['guardStep']))['find'](U=>U!==undefined&&!U['queries']['some'](V=>V['startsWith']('order.claimed_by')))?.['stepId'];let D,E=![];for(const U of b['values']()){if(U['queries']['some'](isPathDependentTimeQuery)){D??=U['stepId'];if(d!==undefined)for(const V of U['acceptedNodes']){if(pathCountCap2(d['edges'],V)>=0x2){E=!![],D=U['stepId'];break;}}}if(E)break;}const F=[...b['values']()]['flatMap'](W=>W['queries']);let G;for(const W of WRITE_ONLY_ENFORCEMENT_SOURCES){for(const X of createsOf(a,W['object'])){if(W['extract'](X)&&!F['some'](Y=>Y['startsWith'](W['coverQuery']))){G=W['param'];break;}}if(G!==undefined)break;}const H=new Set();for(const Y of a['steps']){if(Y['op']==='create'&&Y['object']==='guard')continue;const Z=refsOf(Y['op']==='publish'?Y['target']:Y['params']);for(const a0 of Z)H['add'](a0);if(Y['op']==='configure'){for(const a1 of refsOf(Y['target']))H['add'](a1);}}const I=[...b['keys']()]['find'](a2=>!H['has'](a2)),J=[...b['values']()]['find'](a2=>!f&&a2['queries']['some'](a3=>a3['startsWith']('repository.')))?.['stepId'];let K;if(e&&d!==undefined)for(const a2 of d['forwardGuardRefs']){const a3=b['get'](a2);if(a3===undefined)continue;const a4=a3['table']['some'](a5=>a5['identifier']===0xfe&&a5['b_submission']===!![]);if(!a4){K=a2;break;}}let L;for(const a5 of c){if(a5['guardStep']===undefined||a5['identifierLegs']['length']===0x0)continue;const a6=b['get'](a5['guardStep']);if(a6===undefined)continue;for(const a7 of a5['identifierLegs']){const a8=a6['table']['find'](a9=>a9['identifier']===a7);if(a8===undefined||a8['b_submission']!==!![]||a8['value_type']!=='Address'){L='slot\x20'+a7+'\x20of\x20guard\x20\x27'+a5['guardStep']+'\x27';break;}}if(L!==undefined)break;}const M=new Set();for(const a9 of createsOf(a,'repository')){const aa=a9['params']['policies'];if(!Array['isArray'](aa))continue;for(const ab of aa){const ac=ab?.['name'];if(typeof ac==='string')M['add'](ac);}}const N=[];if(M['size']>0x0)for(const ad of createsOf(a,'guard')){const ae=Array['isArray'](ad['params']['table'])?ad['params']['table']:[];for(const af of collectRepoWhereQueries(ad['params']['root']??ad['params']['logic'])){const ag=staticStringOperand(af['key'],ae);if(ag===undefined)continue;if(!isPlanLocalObjectOperand(af['object'],ae))continue;!M['has'](ag)&&N['push']('\x27'+ag+'\x27\x20in\x20guard\x20\x27'+ad['id']+'\x27');}}return{'has_service':e,'has_machine':d!==undefined,'has_repository':f,'allocator_row_count':c['length'],'refund_row_count':B['length'],'terminal_count':i['length'],'terminal_nodes_display':i['join'](',\x20'),'pending_allocator_guard_count':l,...j===undefined?{}:{'first_uncovered_terminal':j},...C===undefined?{}:{'first_refund_guard_missing_claimed_by':C},...D===undefined?{}:{'first_path_dependent_anchor':D},'path_sensitive':E,...G===undefined?{}:{'first_write_only_unenforced_field':G},...I===undefined?{}:{'first_orphan_guard':I},...J===undefined?{}:{'first_repo_query_without_repository':J},...K===undefined?{}:{'first_edge_guard_missing_254':K},...L===undefined?{}:{'first_alloc_slot_missing':L},...q===undefined?{}:{'first_pending_fund_guard':q,'pending_fund_guard_count':m['length'],'pending_fund_guard_keys_display':m['map'](ah=>ah['key'])['join'](',\x20')},...t===undefined?{}:{'first_pending_buy_guard':t,'pending_buy_guard_count':o['length'],'pending_buy_guard_keys_display':o['map'](ah=>ah['key'])['join'](',\x20')},'has_return_rail':u!==undefined,...u===undefined?{}:{'return_rail_node':u},'has_arbitration_binding':v,'fund_topup_present':x,...w===undefined?{}:{'fund_topup_amount':w},...A?{'fund_ceiling_breach':w<MAX_INDEMNITY_MULTIPLE*y,'fund_ceiling_basis':MAX_INDEMNITY_MULTIPLE+'x\x20the\x20highest\x20SKU\x20price'}:{},'fund_ceiling_unverifiable':x&&!A,...M['size']>0x0?{'repo_policy_keys_display':[...M]['join'](',\x20'),...N['length']>0x0?{'repo_gate_key_unbacked_count':N['length'],'first_repo_gate_key_unbacked':N[0x0],'repo_gate_key_unbacked_display':N['join'](',\x20')}:{}}:{}};}function planRuleBook(){const a=getJudgmentDoc()['rules']['domains']['plan'];if(!a)throw new Error('factory\x20rule\x20pack\x20\x27plan\x27\x20missing\x20—\x20broken\x20installation');return a['rules'];}export function auditPlan(a){const b=validatePlan(a),c=planFacts(a),{findings:d}=evaluateRuleBook(planRuleBook(),c),e=b['length']>0x0||d['some'](g=>g['level']==='critical'||g['level']==='high');return{'issues':b,'findings':d,'facts':c,'blocking':e};}
@@ -1 +1 @@
1
- import{fillGuardTemplate}from'../knowledge/guard-templates.js';import{rootHasRewardRecordGate}from'../knowledge/template-scanner.js';import{refsOf}from'./plan.js';const P=a=>a;export const TASK_BINDING_SLOT=0xfe;function safeId(a){return a['replace'](/[^a-zA-Z0-9_]/g,'_');}function ref(a){return{'$ref':a};}const MODE_MAP={'amount':'Amount','rate':'Rate','surplus':'Surplus'};export function compileTemplate(a,b,d={}){const f=d['nameBase']??a['id']['replace'](/\//g,'_'),h=d['merchantPermissionIndex']??0x3e8,i=[],j=[],k=new Set();for(const T of a['conditional_guards']??[]){const U=b[T['param']]??a['fee_params'][T['param']];if(U!==T['emit_value'])k['add'](T['guard_key']);}const l=new Map();for(const V of a['conditional_guards']??[]){l['set'](V['param'],(l['get'](V['param'])??0x0)+0x1);}const m=new Set((a['conditional_guards']??[])['filter'](W=>(l['get'](W['param'])??0x0)>0x1)['map'](W=>W['guard_key'])),o=new Set([...k]['filter'](W=>m['has'](W))),p=o['size']>0x0?a['machine_shape']['map'](W=>({...W,'from':(W['from']??[])['filter'](X=>typeof X==='string'||X['guard_key']===undefined||!o['has'](X['guard_key']))})):a['machine_shape'],q=o['size']>0x0?(a['allocator']['rows']??[])['filter'](W=>W['guard_key']===undefined||!o['has'](W['guard_key'])):a['allocator']['rows']??[],r=a['guards']['map']((W,X)=>({'key':W['key']??W['template_id']+'#'+X,'template_id':W['template_id'],'host':W['host'],'purpose':W['purpose']}))['filter'](W=>!k['has'](W['key'])),s=new Map(r['map'](W=>[W['key'],W])),t=new Map(),u=[],v=r['map'](W=>W['key']);for(const W of Object['keys'](d['guardResolutions']??{})){!s['has'](W)&&i['push']({'code':'GUARD_RESOLUTION_UNKNOWN','detail':'guard_resolutions\x20key\x20\x27'+W+'\x27\x20matches\x20no\x20guard\x20spec\x20key\x20declared\x20by\x20\x27'+f+'\x27.\x20'+('Legal\x20keys:\x20'+(v['length']>0x0?v['join'](',\x20'):'(none\x20—\x20this\x20template\x20declares\x20no\x20keyed\x20guards)')+'.\x20')+'An\x20unknown\x20key\x20was\x20previously\x20dropped\x20silently,\x20leaving\x20the\x20intended\x20guard\x20pending\x20while\x20the\x20build\x20looked\x20resolved.'});}for(const X of r){const Y='guard_'+safeId(X['key']),Z=d['guardResolutions']?.[X['key']];let a0=X['purpose'],a1,a2;if(Z?.['kind']==='inline')a1=Z['table'],a2=Z['root'],a0=Z['description']??X['purpose'];else{const a3=Z?.['kind']==='template'?Z['template_id']:X['template_id']['startsWith']('tpl_')?X['template_id']:undefined;if(a3!==undefined){const a4={'service_name':f+'_service',...a['fee_params'],...b,...Z?.['kind']==='template'?Z['params']:{}},a5=fillGuardTemplate(a3,a4);!a5['ok']?i['push']({'code':'GUARD_TEMPLATE_PARAMS','detail':'guard\x20\x27'+X['key']+'\x27\x20('+a3+'):\x20'+a5['error']}):(a1=a5['table'],a2=a5['root']);}}a1!==undefined?(t['set'](X['key'],{'stepId':Y,'description':a0,'table':a1,'root':a2}),X['step_id']=Y):u['push'](X);}const w=new Set(p['flatMap'](a6=>(a6['from']??[])['map'](a7=>typeof a7==='string'?undefined:a7['guard_key'])['filter'](a7=>typeof a7==='string'))),x=new Set();for(const a6 of r){if(!w['has'](a6['key']))continue;const a7=t['get'](a6['key']);if(a7===undefined)continue;const a8=a7['table']['some'](a9=>a9['identifier']===TASK_BINDING_SLOT);if(a8)continue;t['set'](a6['key'],{...a7,'table':[...a7['table'],{'identifier':TASK_BINDING_SLOT,'b_submission':!![],'value_type':'Address','name':'task_binding\x20order\x20anchor\x20(protocol\x20slot\x20254;\x20written\x20by\x20order\x20creation)'}]}),x['add'](a6['key']);}const y=a9=>t['get'](a9)!==undefined&&refsOf({'table':t['get'](a9)['table'],'root':t['get'](a9)['root']})['has']('service'),z=a9=>{const aa=t['get'](a9),ab=s['get'](a9)?.['purpose'];return{'op':'create','id':aa['stepId'],'object':'guard','params':P({'description':aa['description'],'table':aa['table'],'root':aa['root']}),'notes':x['has'](a9)?(ab??'Guard')+'\x20[kernel:\x20protocol\x20slot\x20254\x20(task\x20binding)\x20auto-declared]':ab};};j['push']({'op':'create','id':'permission','object':'permission','params':{'name':f+'_permission'}});const A=a['arbitration_mode']!==undefined&&a['arbitration_mode']!=='none';A&&j['push']({'op':'create','id':'permission_arb','object':'permission','params':{'name':f+'_arb_permission'},'notes':'MUST\x20be\x20created\x20by\x20a\x20different\x20account\x20than\x20the\x20service\x20permission\x20'+'(E_ARBITRATION_PERMISSION_CONFLICT=33):\x20dispute\x20neutrality.'});j['push']({'op':'create','id':'contact','object':'contact','params':{'name':f+'_contact'},'notes':'R8:\x20customer-service\x20channel;\x20mandatory\x20when\x20customer_required\x20is\x20set.'});const B=r['some'](a9=>a9['host']==='repository'||a9['template_id']==='pattern.repository_data_check'||a9['template_id']==='pattern.repository_write_authorization');if(B){const a9=b['repository_policies'];j['push']({'op':'create','id':'repository','object':'repository','params':{'name':f+'_evidence',...Array['isArray'](a9)?{'policies':a9}:{}},'notes':'Evidence\x20rows\x20(tracking\x20hash,\x20receipts,\x20WTS\x20proofs).'});}const C=[];for(const [aa]of t){y(aa)?C['push'](aa):j['push'](z(aa));}const D=new Set(p['map'](ab=>ab['name'])),E=[];for(const ab of p){if(ab['from']===undefined||ab['from']['length']===0x0){i['push']({'code':'MACHINE_EDGES_MISSING','detail':'machine_shape\x20node\x20\x27'+ab['name']+'\x27\x20declares\x20no\x20\x27from\x27\x20edges.\x20Edges\x20are\x20data\x20'+'(REPORT\x20#10\x20A-2:\x20a\x20missing\x20paid->closed_cancel\x20edge\x20bricks\x20the\x20shop\x20at\x20publish).\x20'+'Annotate\x20the\x20node\x20with\x20from:\x20[...]\x20(use\x20prev:\x20\x22\x22\x20for\x20the\x20entry\x20edge).'});continue;}const ac=[],ad=new Map();for(const ae of ab['from']){const af=typeof ae==='string'?{'prev':ae}:ae;if(af['prev']!==''&&!D['has'](af['prev'])){i['push']({'code':'EDGE_UNKNOWN_PREV','detail':'node\x20\x27'+ab['name']+'\x27\x20edge\x20prev\x20\x27'+af['prev']+'\x27\x20is\x20not\x20a\x20machine_shape\x20node'});continue;}const ag=af['operator']??ab['operator']??(af['prev']===''?'order_payer':'merchant'),ah={'name':af['forward']??(af['prev']===''?'enter_'+ab['name']:af['prev']+'_to_'+ab['name']),'weight':0x1,...ag==='order_payer'?{'namedOperator':''}:{'permissionIndex':af['permission_index']??h}};if(af['guard_key']!==undefined){const aj=s['get'](af['guard_key']);if(aj===undefined)i['push']({'code':'GUARD_KEY_UNKNOWN','detail':'edge\x20\x27'+af['prev']+'\x27->\x27'+ab['name']+'\x27\x20binds\x20unknown\x20guard_key\x20\x27'+af['guard_key']+'\x27'});else aj['step_id']!==undefined&&(y(aj['key'])?i['push']({'code':'GUARD_CYCLE','detail':'edge\x20\x27'+af['prev']+'\x27->\x27'+ab['name']+'\x27\x20binds\x20guard\x20\x27'+aj['key']+'\x27\x20which\x20itself\x20'+'refs\x20the\x20service\x20(created\x20after\x20the\x20machine)\x20—\x20an\x20F-05\x20cycle.\x20Rebind\x20or\x20split\x20the\x20guard.'}):ah['guard']=ref(aj['step_id']));}const ai=ad['get'](af['prev']);ai!==undefined?ai['push'](ah):ad['set'](af['prev'],[ah]);}for(const [ak,al]of ad){ac['push']({'prev_node':ak,'threshold':0x0,'forwards':al});}E['push']({'name':ab['name'],...ab['semantic_role']!==undefined?{'role':ab['semantic_role']}:{},'pairs':ac});}j['push']({'op':'create','id':'machine','object':'machine','params':P({'name':f+'_machine','nodes':E})}),j['push']({'op':'publish','id':'machine_publish','target':ref('machine'),'preflight':[{'check':'machine_publish','status':'pending'},{'check':'TASKBIND-01','status':'pending'}]});const F=typeof b['currency']==='string'?b['currency']:'0x2::wow::WOW',G=r['find'](am=>am['host']==='service'&&am['key']==='buy');j['push']({'op':'create','id':'service','object':'service','params':P({'name':f+'_service','type_parameter':F,'permission':ref('permission'),'machine':ref('machine'),'um':ref('contact'),'description':a['id']+'\x20—\x20compiled\x20by\x20composition/compile',...B?{'repositories':[ref('repository')]}:{},...G?.['step_id']!==undefined?{'buy_guard':ref(G['step_id'])}:{},...Array['isArray'](b['customer_required'])?{'customer_required':b['customer_required']}:{}}),'notes':'Draft\x20only:\x20machine/order_allocators\x20are\x20L1-frozen\x20at\x20publish;\x20allocators\x20attach\x20in\x20the\x20configure\x20step.'});for(const am of C)j['push'](z(am));const H=q['length']>0x0?q:[{'track':'settlement','recipient':a['allocator']['recipient']==='fixed'?'entity':a['allocator']['recipient'],'recipient_key':a['allocator']['recipient_key'],'mode':a['allocator']['mode'],'value':a['allocator']['mode']==='rate'?0x2710:a['allocator']['mode']==='surplus'?'0':undefined}],I=[],J=new Map();for(const an of H){if(an['guard_key']!==undefined){let ao=J['get'](an['guard_key']);ao===undefined&&(ao={'key':an['guard_key'],'rows':[]},J['set'](an['guard_key'],ao),I['push'](ao)),ao['rows']['push'](an);}else I['push']({'rows':[an]});}const K=[];for(const ap of I){const aq=[];let ar;for(const at of ap['rows']){let au=at['value'];au===undefined&&at['value_from']!==undefined&&(au=b[at['value_from']]??a['fee_params'][at['value_from']]);if(au===undefined&&at['mode']!=='surplus'){i['push']({'code':'ALLOCATOR_VALUE_MISSING','detail':'allocator\x20row\x20('+at['track']+'/'+at['recipient']+')\x20has\x20neither\x20value\x20nor\x20a\x20resolvable\x20value_from'});continue;}(at['fix']!==undefined||at['fix_from']!==undefined)&&i['push']({'code':'ALLOCATOR_FIX_UNSUPPORTED','detail':'allocator\x20row\x20('+at['track']+'/'+at['recipient']+')\x20declares\x20fix/fix_from\x20—\x20the\x20chain\x20has\x20no\x20holdback\x20'+'parameter:\x20fix\x20is\x20computed\x20on-chain\x20as\x20the\x20sum\x20of\x20the\x20Amount\x20legs\x20and\x20those\x20legs\x20are\x20PAID\x20'+'(allocation.move:399,540),\x20and\x20the\x20allocator-registration\x20call\x20surface\x20(guard,\x20sharing,\x20max)\x20has\x20no\x20fix\x20'+'argument,\x20so\x20this\x20value\x20never\x20reaches\x20the\x20chain.\x20To\x20keep\x20funds\x20in\x20the\x20pool,\x20do\x20not\x20distribute\x20them\x20'+'(a\x20separate\x20Allocation\x20object,\x20or\x20a\x20later\x20guard-gated\x20allocator);\x20to\x20combine\x20fixed\x20fees\x20with\x20a\x20'+'proportional\x20split,\x20use\x20explicit\x20Amount\x20legs\x20plus\x20Rate\x20legs\x20summing\x2010000.'});ar??=at['note'];let av;if(at['recipient']==='entity')av={'Entity':{'$late':{'by':'local_name','mark':at['recipient_key']??'merchant'}}};else{if(at['recipient']==='guard_identifier'){const aw=Number(at['recipient_key']??0x0);av={'GuardIdentifier':aw};const ax=ap['key']!==undefined?t['get'](ap['key']):undefined;if(ax!==undefined){const ay=ax['table']['find'](az=>az['identifier']===aw);(ay===undefined||ay['b_submission']!==!![]||ay['value_type']!=='Address')&&i['push']({'code':'GUARD_SLOT_UNKNOWN','detail':'allocator\x20leg\x20{GuardIdentifier:\x20'+aw+'}\x20on\x20guard\x20\x27'+ap['key']+'\x27\x20of\x20\x27'+f+'\x27:\x20the\x20bound\x20'+('Guard\x20table\x20has\x20no\x20slot\x20'+aw+'\x20Address\x20submission\x20row\x20(b_submission:\x20true).\x20On\x20chain\x20the\x20leg\x20')+('reads\x20slot\x20'+aw+'\x20as\x20its\x20payee\x20and\x20asserts\x20it\x20equals\x20the\x20paying\x20order\x20')+'(payment_info.for_object)\x20—\x20an\x20undeclared\x20or\x20static\x20slot\x20aborts\x20at\x20alloc\x20time\x20with\x20the\x20funds\x20'+'stranded,\x20and\x20Guard/allocators/forwards\x20are\x20all\x20publish-frozen.\x20Declare\x20'+('{identifier:\x20'+aw+',\x20b_submission:\x20true,\x20value_type:\x20\x22Address\x22}\x20in\x20the\x20Guard\x20table.')});}}else av='Signer';}aq['push']({'who':av,'sharing':String(au??'0'),'mode':MODE_MAP[at['mode']]});}if(aq['length']===0x0)continue;const as=ap['key']!==undefined?s['get'](ap['key'])?.['step_id']:undefined;ap['key']!==undefined&&!s['has'](ap['key'])&&i['push']({'code':'GUARD_KEY_UNKNOWN','detail':'allocator\x20row\x20('+ap['rows'][0x0]['track']+')\x20binds\x20unknown\x20guard_key\x20\x27'+ap['key']+'\x27'}),K['push']({...as!==undefined?{'guard':ref(as)}:{},...ap['key']!==undefined?{'guard_key':ap['key']}:{},'track':ap['rows'][0x0]['track'],'sharing':aq,...ar!==undefined?{'note':ar}:{}});}j['push']({'op':'configure','id':'service_allocators','target':ref('service'),'method':'order_allocators','params':P({'description':a['allocator']['description'],'threshold':Number(a['fee_params']['threshold']??0x0)||0x0,'allocators':K}),'requires':['machine_publish']});Array['isArray'](b['sales'])&&b['sales']['length']>0x0&&j['push']({'op':'configure','id':'service_sales','target':ref('service'),'method':'sales','params':{'op':'add','sales':b['sales']}});const L=b['review_mode'],M=L==='review'||L==='review_reward'||L==='none'?L:undefined,N=M??a['review_mode']??'none';if(N!=='none'){const az=p['some'](aE=>/review/i['test'](aE['name']));N==='review'&&!az&&i['push']({'code':'REVIEW_NODE_MISSING','detail':'review_mode\x20\x27'+N+'\x27\x20declares\x20the\x20buyer\x20review\x20reputation\x20rail,\x20but\x20machine_shape\x20has\x20no\x20'+'\x27reviewed\x27\x20node.\x20Add\x20a\x20buyer-advanced\x20review\x20node\x20(operator\x20order_payer)\x20with\x20an\x20EXIT\x20edge\x20back\x20to\x20the\x20'+'settlement\x20rail\x20(R-DEAD-END:\x20a\x20zero-exit\x20review\x20node\x20strands\x20the\x20escrow),\x20or\x20anchor\x20the\x20claim\x20on\x20the\x20'+'delivered\x20terminal\x20via\x20a\x20host:\x22reward\x22\x20guard\x20(review_mode\x20\x22review_reward\x22\x20variant).'});const aA=r['find'](aE=>aE['host']==='reward'),aB=p['find'](aE=>/review/i['test'](aE['name']))?.['name'];let aC,aD;if(aB!==undefined){const aE=[];for(const aH of p){for(const aI of aH['from']??[]){const aJ=typeof aI==='string'?{'prev':aI,'guard_key':undefined}:aI;aE['push']({'prev':aJ['prev'],'guard_key':aJ['guard_key'],'target':aH['name']});}}const aF=aE['find'](aK=>aK['target']===aB&&aK['guard_key']!==undefined)?.['guard_key']??aE['find'](aK=>aK['prev']===aB&&aK['guard_key']!==undefined)?.['guard_key'],aG=aF!==undefined?s['get'](aF):undefined;aC=aG?.['step_id'],aD=aF;}aC===undefined&&aA?.['step_id']!==undefined&&(aC=aA['step_id'],aD=aA['key']);if(aC!==undefined){const aK=b['buyer_review_enabled']===!![];j['push']({'op':'create','id':'repository_review','object':'repository','params':P({'name':f+'_review','description':'Structured\x20buyer\x20reputation\x20rows\x20(AR-1:\x20emitted\x20by\x20the\x20build\x20plan\x20—\x20no\x20manual\x20setup).','policies':[{'name':'review','description':'One\x20row\x20per\x20buyer\x20(id_from=Signer;\x20rewrite\x20=\x20own-record\x20overwrite).\x20Writes\x20require\x20the\x20review\x20credential\x20(guard\x20key\x20\x27'+aD+'\x27).\x20Payload:\x20JSON\x20text\x20{rating,\x20tags?,\x20orderRef?}.','write_guard':[{'guard':ref(aC)}],'id_from':'signer','value_type':'String'},...aK?[{'name':'buyer_review','description':'Merchant-side\x20structured\x20feedback\x20on\x20the\x20order/buyer\x20(D-R7\x20bidirectional\x20reputation,\x20opt-in).\x20One\x20row\x20per\x20writer\x20(id_from=Signer;\x20rewrite\x20=\x20own-record\x20overwrite).\x20NO\x20write\x20guard\x20by\x20design:\x20merchant\x20authority\x20is\x20verified\x20at\x20READ\x20time\x20(the\x20writer\x20must\x20control\x20the\x20order\x27s\x20service\x20—\x20graph\x20ControlIndex).\x20Payload:\x20JSON\x20text\x20{rating,\x20tags?,\x20orderRef?}.','id_from':'signer','value_type':'String'}]:[]]}),'notes':'REVIEW-COMPONENT\x20AR-1:\x20the\x20review\x20TEXT\x20still\x20rides\x20the\x20forward\x20message\x20(D-R1\x20dual\x20carrier);\x20this\x20repository\x20carries\x20ONLY\x20the\x20structured\x20row.\x20Buyers\x20resolve\x20this\x20object\x20by\x20name\x20(workspace/onchain_objects)\x20—\x20never\x20guess\x20an\x20address.'}),j['push']({'op':'configure','id':'service_review_repository','target':ref('service'),'method':'repositories','params':P({'op':'add','objects':[ref('repository_review')]}),'requires':['service','repository_review']});}if(N==='review_reward'){const aL=aA;if(aL===undefined||aL['step_id']===undefined)i['push']({'code':'REVIEW_REWARD_GUARD_MISSING','detail':'review_mode\x20\x27review_reward\x27\x20promises\x20a\x20claim\x20reward,\x20but\x20no\x20RESOLVED\x20host:\x22reward\x22\x20guard\x20spec\x20'+'exists\x20to\x20gate\x20the\x20claim.\x20Mount\x20a\x20reward\x20claim\x20guard\x20(e.g.\x20pattern.progress_state_check\x20anchored\x20'+'on\x20the\x20review\x20node\x20or\x20the\x20delivered\x20terminal\x20+\x20review\x20evidence\x20hash)\x20and\x20keep\x20it\x20resolvable\x20—\x20'+'an\x20unguarded\x20incentive\x20promise\x20must\x20not\x20publish\x20(INV-4).'});else{const aM=b['reward_funding'],aN=t['get'](aL['key']);aN!==undefined&&!rootHasRewardRecordGate(aN['root'])&&i['push']({'code':'REVIEW_REWARD_UNARMED','detail':'review_reward\x20claim\x20guard\x20\x27'+aL['key']+'\x27\x20carries\x20no\x20record-gate:\x20Reward.claim\x20has\x20NO\x20'+'protocol-level\x20idempotency\x20(OFN-C1),\x20so\x20a\x20funded\x20pool\x20behind\x20this\x20guard\x20is\x20a\x20replay-drain\x20target.\x20'+'Add\x20logic_not(query_reward_record_exists(object=<reward>,\x20where={storeFromId:<order\x20identifier>}))\x20'+'to\x20the\x20guard\x20root,\x20wrapped\x20in\x20logic_and\x20with\x20the\x20existing\x20checks\x20(reward.rs\x20record_exists_where;\x20'+'guard-risk\x20R-X1-14\x20audits\x20the\x20built\x20guard).\x20Until\x20armed,\x20do\x20not\x20fund\x20the\x20pool.'}),j['push']({'op':'create','id':'reward_review','object':'reward','params':P({'name':f+'_review_reward','description':'Review\x20incentive\x20pool\x20(sale-time\x20planned;\x20terms\x20disclosed\x20at\x20quote/buy):\x20claim\x20gated\x20by\x20guard\x20\x27'+aL['key']+'\x27.'}),'notes':'REVIEW-COMPONENT:\x20the\x20funded\x20reward\x20must\x20be\x20perceivable\x20by\x20the\x20buyer\x20BEFORE\x20ordering\x20—\x20the\x20full\x20terms\x20ride\x20the\x20quote/buy\x20surface\x20(REVIEW-COMPONENT-PLAN\x20§四).'}),j['push']({'op':'configure','id':'reward_review_guard_add','target':ref('reward_review'),'method':'guard_add','params':P({'guard':ref(aL['step_id'])}),'requires':['reward_review']}),j['push']({'op':'configure','id':'service_rewards','target':ref('service'),'method':'rewards','params':P({'op':'add','objects':[ref('reward_review')]}),'requires':['service']}),typeof aM==='string'||typeof aM==='number'?j['push']({'op':'configure','id':'reward_review_coin_add','target':ref('reward_review'),'method':'coin_add','params':{'coin':String(aM)},'requires':['reward_review']}):i['push']({'code':'REVIEW_REWARD_UNFUNDED','detail':'review_mode\x20\x27review_reward\x27\x20without\x20a\x20\x27reward_funding\x27\x20input\x20(INV-4\x20R-REWARD-FUNDED):\x20the\x20incentive\x20'+'is\x20a\x20marketing\x20promise\x20that\x20must\x20be\x20FUNDED\x20when\x20the\x20Service\x20is\x20built\x20(sale-time\x20planning\x20—\x20pool\x20>=\x20'+'expected\x20orders\x20x\x20per-order\x20reward,\x20benchmark\x20fee_param\x20review_reward_pool).\x20Pass\x20reward_funding\x20'+'(smallest-unit\x20string)\x20to\x20fund\x20the\x20Reward\x20object,\x20or\x20drop\x20to\x20review_mode\x20\x22review\x22.'});}}}if(A){j['push']({'op':'create','id':'arbitration','object':'arbitration','params':P({'name':f+'_arbitration','permission':ref('permission_arb'),'type_parameter':F}),'notes':'Independent\x20venue\x20(R2).\x20New\x20arbitrations\x20default\x20bPaused=true\x20—\x20unpause\x20is\x20a\x20separate\x20operator\x20step.'}),j['push']({'op':'configure','id':'service_arbitrations','target':ref('service'),'method':'arbitrations','params':P({'op':'add','objects':[ref('arbitration')]})});const aO=b['compensation_fund'];(typeof aO==='string'||typeof aO==='number')&&j['push']({'op':'configure','id':'service_compensation','target':ref('service'),'method':'compensation_fund_add','params':{'balance':String(aO)}});}j['push']({'op':'publish','id':'service_publish','target':ref('service'),'preflight':[{'check':'service_publish','status':'pending'},{'check':'FUND-EXIT-01','status':'pending'},{'check':'PLAN-ALLOC-01','status':'pending'},{'check':'TASKBIND-02','status':'pending'}]});const O=new Set(q['map'](aP=>aP['guard_key'])['filter'](aP=>typeof aP==='string')),Q=/^0x[0-9a-fA-F]{20,64}$/,R=aP=>{const aQ=t['get'](aP);if(aQ===undefined)return undefined;for(const aR of aQ['table']){const aS=aR;if(aS['b_submission']===!![]||aS['value_type']!=='Address')continue;const aT=aS['value'];if(typeof aT==='string'&&Q['test'](aT))return String(aS['identifier']??'?');}return undefined;};for(const aP of t['keys']()){if(!w['has'](aP)&&!O['has'](aP))continue;const aQ=R(aP);aQ!==undefined&&i['push']({'code':'GUARD_FOREIGN_SERVICE','detail':'guard\x20\x27'+aP+'\x27\x20pins\x20an\x20on-chain\x20address\x20literal\x20(table\x20slot\x20'+aQ+')\x20while\x20bound\x20into\x20this\x20build.\x20'+'The\x20plan\x27s\x20Service\x20is\x20created\x20BY\x20this\x20plan\x20and\x20cannot\x20equal\x20a\x20pre-existing\x20address,\x20so\x20the\x20pin\x20names\x20a\x20foreign\x20or\x20'+'stale\x20object:\x20each\x20object\x20is\x20well-formed\x20alone,\x20but\x20the\x20cross-object\x20identity\x20assert\x20aborts\x20every\x20guarded\x20forward\x20'+'(klook\x20B11\x20class),\x20and\x20Guard\x20+\x20machine\x20are\x20both\x20create/publish-frozen\x20—\x20unrepairable.\x20'+'Bind\x20by\x20plan\x20reference\x20({\x22$ref\x22:\x22service\x22})\x20or\x20by\x20the\x20P16\x20circular\x20service\x20NAME\x20instead.'});}const S=u['flatMap'](aR=>{const aS=O['has'](aR['key'])?'allocator':w['has'](aR['key'])?'machine_edge':aR['host']==='service'&&aR['key']==='buy'?'service_buy':undefined;return aS?[{'key':aR['key'],'template_id':aR['template_id'],'host':aR['host'],'site':aS,'purpose':aR['purpose']}]:[];});return{'plan':{'version':0x1,'intent':d['intent']??'compile\x20'+a['id'],'templateId':a['id'],'inputs':b,'steps':j,...S['length']>0x0?{'pending_guards':S}:{}},'guardSpecs':r,'unresolved':u,'blockers':i};}
1
+ import{fillGuardTemplate}from'../knowledge/guard-templates.js';import{rootHasRewardRecordGate}from'../knowledge/template-scanner.js';import{refsOf}from'./plan.js';const P=a=>a;export const TASK_BINDING_SLOT=0xfe;function safeId(a){return a['replace'](/[^a-zA-Z0-9_]/g,'_');}function ref(a){return{'$ref':a};}const MODE_MAP={'amount':'Amount','rate':'Rate','surplus':'Surplus'};export function compileTemplate(a,b,d={}){const f=d['nameBase']??a['id']['replace'](/\//g,'_'),h=d['merchantPermissionIndex']??0x3e8,i=[],j=[],k=new Set();for(const Y of a['conditional_guards']??[]){const Z=b[Y['param']]??a['fee_params'][Y['param']];if(Z!==Y['emit_value'])k['add'](Y['guard_key']);}const l=new Map();for(const a0 of a['conditional_guards']??[]){l['set'](a0['param'],(l['get'](a0['param'])??0x0)+0x1);}const m=new Set((a['conditional_guards']??[])['filter'](a1=>(l['get'](a1['param'])??0x0)>0x1)['map'](a1=>a1['guard_key'])),o=new Set([...k]['filter'](a1=>m['has'](a1))),p=o['size']>0x0?a['machine_shape']['map'](a1=>({...a1,'from':(a1['from']??[])['filter'](a2=>typeof a2==='string'||a2['guard_key']===undefined||!o['has'](a2['guard_key']))})):a['machine_shape'],q=o['size']>0x0?(a['allocator']['rows']??[])['filter'](a1=>a1['guard_key']===undefined||!o['has'](a1['guard_key'])):a['allocator']['rows']??[],r=a['guards']['map']((a1,a2)=>({'key':a1['key']??a1['template_id']+'#'+a2,'template_id':a1['template_id'],'host':a1['host'],'purpose':a1['purpose']}))['filter'](a1=>!k['has'](a1['key'])),s=new Map(r['map'](a1=>[a1['key'],a1])),t=new Map(),u=[],v=r['map'](a1=>a1['key']);for(const a1 of Object['keys'](d['guardResolutions']??{})){!s['has'](a1)&&i['push']({'code':'GUARD_RESOLUTION_UNKNOWN','detail':'guard_resolutions\x20key\x20\x27'+a1+'\x27\x20matches\x20no\x20guard\x20spec\x20key\x20declared\x20by\x20\x27'+f+'\x27.\x20'+('Legal\x20keys:\x20'+(v['length']>0x0?v['join'](',\x20'):'(none\x20—\x20this\x20template\x20declares\x20no\x20keyed\x20guards)')+'.\x20')+'An\x20unknown\x20key\x20was\x20previously\x20dropped\x20silently,\x20leaving\x20the\x20intended\x20guard\x20pending\x20while\x20the\x20build\x20looked\x20resolved.'});}for(const a2 of r){const a3='guard_'+safeId(a2['key']),a4=d['guardResolutions']?.[a2['key']];let a5=a2['purpose'],a6,a7;if(a4?.['kind']==='inline')a6=a4['table'],a7=a4['root'],a5=a4['description']??a2['purpose'];else{const a8=a4?.['kind']==='template'?a4['template_id']:a2['template_id']['startsWith']('tpl_')?a2['template_id']:undefined;if(a8!==undefined){const a9={'service_name':f+'_service',...a['fee_params'],...b,...a4?.['kind']==='template'?a4['params']:{}},aa=fillGuardTemplate(a8,a9);!aa['ok']?i['push']({'code':'GUARD_TEMPLATE_PARAMS','detail':'guard\x20\x27'+a2['key']+'\x27\x20('+a8+'):\x20'+aa['error']}):(a6=aa['table'],a7=aa['root']);}}a6!==undefined?(t['set'](a2['key'],{'stepId':a3,'description':a5,'table':a6,'root':a7}),a2['step_id']=a3):u['push'](a2);}const w=new Set(p['flatMap'](ab=>(ab['from']??[])['map'](ac=>typeof ac==='string'?undefined:ac['guard_key'])['filter'](ac=>typeof ac==='string')));for(const ab of q){if(typeof ab['guard_key']==='string')w['add'](ab['guard_key']);}const x=new Set();for(const ac of r){if(!w['has'](ac['key']))continue;const ad=t['get'](ac['key']);if(ad===undefined)continue;const ae=ad['table']['some'](af=>af['identifier']===TASK_BINDING_SLOT);if(ae)continue;t['set'](ac['key'],{...ad,'table':[...ad['table'],{'identifier':TASK_BINDING_SLOT,'b_submission':!![],'value_type':'Address','name':'task_binding\x20order\x20anchor\x20(protocol\x20slot\x20254;\x20written\x20by\x20order\x20creation)'}]}),x['add'](ac['key']);}const y=af=>t['get'](af)!==undefined&&refsOf({'table':t['get'](af)['table'],'root':t['get'](af)['root']})['has']('service'),z=af=>{const ag=t['get'](af),ah=s['get'](af)?.['purpose'];return{'op':'create','id':ag['stepId'],'object':'guard','params':P({'description':ag['description'],'table':ag['table'],'root':ag['root']}),'notes':x['has'](af)?(ah??'Guard')+'\x20[kernel:\x20protocol\x20slot\x20254\x20(task\x20binding)\x20auto-declared]':ah};};j['push']({'op':'create','id':'permission','object':'permission','params':{'name':f+'_permission'}});const A=a['arbitration_mode']!==undefined&&a['arbitration_mode']!=='none';A&&j['push']({'op':'create','id':'permission_arb','object':'permission','params':{'name':f+'_arb_permission'},'notes':'MUST\x20be\x20created\x20by\x20a\x20different\x20account\x20than\x20the\x20service\x20permission\x20'+'(E_ARBITRATION_PERMISSION_CONFLICT=33):\x20dispute\x20neutrality.'});j['push']({'op':'create','id':'contact','object':'contact','params':{'name':f+'_contact'},'notes':'R8:\x20customer-service\x20channel;\x20mandatory\x20when\x20customer_required\x20is\x20set.'});const B=new Set(['wip_provenance','subscription_with_proof']),C=Array['isArray'](b['adopted_module_ids'])?b['adopted_module_ids']['filter'](af=>typeof af==='string'):[],D=r['some'](af=>af['host']==='repository'||af['template_id']==='pattern.repository_data_check'||af['template_id']==='pattern.repository_write_authorization')||C['some'](af=>B['has'](af));if(D){const af=b['repository_policies'];j['push']({'op':'create','id':'repository','object':'repository','params':{'name':f+'_evidence',...Array['isArray'](af)?{'policies':af}:{}},'notes':'Evidence\x20rows\x20(tracking\x20hash,\x20receipts,\x20WTS\x20proofs).'});}const E=b['review_mode'],F=E==='review'||E==='review_reward'||E==='none'?E:undefined,G=F??a['review_mode']??'none',H=f+'_review_reward',I=ag=>{const ah=new Set(),ai=aj=>{if(Array['isArray'](aj)){for(const al of aj)ai(al);return;}if(typeof aj!=='object'||aj===null)return;const ak=aj;if(typeof ak['type']==='string'&&ak['type']['startsWith']('query_reward_record')){const am=ak['object'];if(am!==undefined&&typeof am['identifier']==='number')ah['add'](am['identifier']);}for(const an of Object['values'](ak))ai(an);};return ai(ag),ah;},J=G==='review_reward'?r['find'](ag=>ag['host']==='reward'):undefined;if(G==='review_reward'&&J?.['step_id']!==undefined){const ag=t['get'](J['key']);if(ag!==undefined){const ah=I(ag['root']);t['set'](J['key'],{...ag,'table':ag['table']['map'](ai=>{const aj=ai;if(aj['b_submission']===!![]||!ah['has'](aj['identifier']))return ai;return{...aj,'value':{'$late':{'by':'local_name','mark':H}}};})});}j['push']({'op':'create','id':'reward_review','object':'reward','params':P({'name':H,'description':'Review\x20incentive\x20pool\x20(sale-time\x20planned;\x20terms\x20disclosed\x20at\x20quote/buy):\x20claim\x20gated\x20by\x20guard\x20\x27'+J['key']+'\x27.'}),'notes':'REVIEW-COMPONENT:\x20the\x20funded\x20reward\x20must\x20be\x20perceivable\x20by\x20the\x20buyer\x20BEFORE\x20ordering\x20—\x20the\x20full\x20terms\x20ride\x20the\x20quote/buy\x20surface\x20(REVIEW-COMPONENT-PLAN\x20§四).\x20'+'[ZR-08:\x20created\x20BEFORE\x20its\x20claim\x20guard\x20—\x20the\x20guard\x27s\x20Reward-address\x20row\x20freezes\x20at\x20creation\x20and\x20binds\x20this\x20pool\x20by\x20local\x20name]'});}const K=[];for(const [ai]of t){y(ai)?K['push'](ai):j['push'](z(ai));}const L=new Set(p['map'](aj=>aj['name'])),M=[];for(const aj of p){if(aj['from']===undefined||aj['from']['length']===0x0){i['push']({'code':'MACHINE_EDGES_MISSING','detail':'machine_shape\x20node\x20\x27'+aj['name']+'\x27\x20declares\x20no\x20\x27from\x27\x20edges.\x20Edges\x20are\x20data\x20'+'(REPORT\x20#10\x20A-2:\x20a\x20missing\x20paid->closed_cancel\x20edge\x20bricks\x20the\x20shop\x20at\x20publish).\x20'+'Annotate\x20the\x20node\x20with\x20from:\x20[...]\x20(use\x20prev:\x20\x22\x22\x20for\x20the\x20entry\x20edge).'});continue;}const ak=[],al=new Map();for(const am of aj['from']){const an=typeof am==='string'?{'prev':am}:am;if(an['prev']!==''&&!L['has'](an['prev'])){i['push']({'code':'EDGE_UNKNOWN_PREV','detail':'node\x20\x27'+aj['name']+'\x27\x20edge\x20prev\x20\x27'+an['prev']+'\x27\x20is\x20not\x20a\x20machine_shape\x20node'});continue;}const ao=an['operator']??aj['operator']??(an['prev']===''?'order_payer':'merchant'),ap={'name':an['forward']??(an['prev']===''?'enter_'+aj['name']:an['prev']+'_to_'+aj['name']),'weight':0x1,...ao==='order_payer'?{'namedOperator':''}:{'permissionIndex':an['permission_index']??h}};if(an['guard_key']!==undefined){const ar=s['get'](an['guard_key']);if(ar===undefined)i['push']({'code':'GUARD_KEY_UNKNOWN','detail':'edge\x20\x27'+an['prev']+'\x27->\x27'+aj['name']+'\x27\x20binds\x20unknown\x20guard_key\x20\x27'+an['guard_key']+'\x27'});else ar['step_id']!==undefined&&(y(ar['key'])?i['push']({'code':'GUARD_CYCLE','detail':'edge\x20\x27'+an['prev']+'\x27->\x27'+aj['name']+'\x27\x20binds\x20guard\x20\x27'+ar['key']+'\x27\x20which\x20itself\x20'+'refs\x20the\x20service\x20(created\x20after\x20the\x20machine)\x20—\x20an\x20F-05\x20cycle.\x20Rebind\x20or\x20split\x20the\x20guard.'}):ap['guard']=ref(ar['step_id']));}const aq=al['get'](an['prev']);aq!==undefined?aq['push'](ap):al['set'](an['prev'],[ap]);}for(const [as,at]of al){ak['push']({'prev_node':as,'threshold':0x0,'forwards':at});}M['push']({'name':aj['name'],...aj['semantic_role']!==undefined?{'role':aj['semantic_role']}:{},'pairs':ak});}j['push']({'op':'create','id':'machine','object':'machine','params':P({'name':f+'_machine','nodes':M})}),j['push']({'op':'publish','id':'machine_publish','target':ref('machine'),'preflight':[{'check':'machine_publish','status':'pending'},{'check':'TASKBIND-01','status':'pending'}]});const N=typeof b['currency']==='string'?b['currency']:'0x2::wow::WOW',O=r['find'](au=>au['host']==='service'&&au['key']==='buy');j['push']({'op':'create','id':'service','object':'service','params':P({'name':f+'_service','type_parameter':N,'permission':ref('permission'),'machine':ref('machine'),'um':ref('contact'),'description':a['id']+'\x20—\x20compiled\x20by\x20composition/compile',...D?{'repositories':[ref('repository')]}:{},...O?.['step_id']!==undefined?{'buy_guard':ref(O['step_id'])}:{},...Array['isArray'](b['customer_required'])?{'customer_required':b['customer_required']}:{}}),'notes':'Draft\x20only:\x20machine/order_allocators\x20are\x20L1-frozen\x20at\x20publish;\x20allocators\x20attach\x20in\x20the\x20configure\x20step.'});for(const au of K)j['push'](z(au));const Q=q['length']>0x0?q:[{'track':'settlement','recipient':a['allocator']['recipient']==='fixed'?'entity':a['allocator']['recipient'],'recipient_key':a['allocator']['recipient_key'],'mode':a['allocator']['mode'],'value':a['allocator']['mode']==='rate'?0x2710:a['allocator']['mode']==='surplus'?'0':undefined}],R=[],S=new Map();for(const av of Q){if(av['guard_key']!==undefined){let aw=S['get'](av['guard_key']);aw===undefined&&(aw={'key':av['guard_key'],'rows':[]},S['set'](av['guard_key'],aw),R['push'](aw)),aw['rows']['push'](av);}else R['push']({'rows':[av]});}const T=[];for(const ax of R){const ay=[];let az;for(const aB of ax['rows']){let aC=aB['value'];aC===undefined&&aB['value_from']!==undefined&&(aC=b[aB['value_from']]??a['fee_params'][aB['value_from']]);if(aC===undefined&&aB['mode']!=='surplus'){i['push']({'code':'ALLOCATOR_VALUE_MISSING','detail':'allocator\x20row\x20('+aB['track']+'/'+aB['recipient']+')\x20has\x20neither\x20value\x20nor\x20a\x20resolvable\x20value_from'});continue;}(aB['fix']!==undefined||aB['fix_from']!==undefined)&&i['push']({'code':'ALLOCATOR_FIX_UNSUPPORTED','detail':'allocator\x20row\x20('+aB['track']+'/'+aB['recipient']+')\x20declares\x20fix/fix_from\x20—\x20the\x20chain\x20has\x20no\x20holdback\x20'+'parameter:\x20fix\x20is\x20computed\x20on-chain\x20as\x20the\x20sum\x20of\x20the\x20Amount\x20legs\x20and\x20those\x20legs\x20are\x20PAID\x20'+'(allocation.move:399,540),\x20and\x20the\x20allocator-registration\x20call\x20surface\x20(guard,\x20sharing,\x20max)\x20has\x20no\x20fix\x20'+'argument,\x20so\x20this\x20value\x20never\x20reaches\x20the\x20chain.\x20To\x20keep\x20funds\x20in\x20the\x20pool,\x20do\x20not\x20distribute\x20them\x20'+'(a\x20separate\x20Allocation\x20object,\x20or\x20a\x20later\x20guard-gated\x20allocator);\x20to\x20combine\x20fixed\x20fees\x20with\x20a\x20'+'proportional\x20split,\x20use\x20explicit\x20Amount\x20legs\x20plus\x20Rate\x20legs\x20summing\x2010000.'});az??=aB['note'];let aD;if(aB['recipient']==='entity')aD={'Entity':{'$late':{'by':'local_name','mark':aB['recipient_key']??'merchant'}}};else{if(aB['recipient']==='guard_identifier'){const aE=Number(aB['recipient_key']??0x0);aD={'GuardIdentifier':aE};const aF=ax['key']!==undefined?t['get'](ax['key']):undefined;if(aF!==undefined){const aG=aF['table']['find'](aH=>aH['identifier']===aE);(aG===undefined||aG['b_submission']!==!![]||aG['value_type']!=='Address')&&i['push']({'code':'GUARD_SLOT_UNKNOWN','detail':'allocator\x20leg\x20{GuardIdentifier:\x20'+aE+'}\x20on\x20guard\x20\x27'+ax['key']+'\x27\x20of\x20\x27'+f+'\x27:\x20the\x20bound\x20'+('Guard\x20table\x20has\x20no\x20slot\x20'+aE+'\x20Address\x20submission\x20row\x20(b_submission:\x20true).\x20On\x20chain\x20the\x20leg\x20')+('reads\x20slot\x20'+aE+'\x20as\x20its\x20payee\x20and\x20asserts\x20it\x20equals\x20the\x20paying\x20order\x20')+'(payment_info.for_object)\x20—\x20an\x20undeclared\x20or\x20STATIC\x20slot\x20aborts\x20at\x20alloc\x20time\x20with\x20code\x2015\x20'+'(ERECIPIENT_NOT_FOR_OBJECT,\x20allocation.move:500-520)\x20and\x20the\x20leg\x27s\x20funds\x20stranded\x20'+'(az3/abnb7\x20mainnet\x20261013:\x20static\x20GuardIdentifier\x20legs\x20bricked\x20every\x20refund\x20rail).\x20'+'Guard/allocators/forwards\x20are\x20all\x20publish-frozen.\x20Anchor\x20the\x20leg\x20on\x20the\x20protocol\x20slot\x20'+'(254\x20—\x20auto-written\x20with\x20the\x20paying\x20order\x20id\x20at\x20order\x20creation)\x20or\x20declare\x20'+('{identifier:\x20'+aE+',\x20b_submission:\x20true,\x20value_type:\x20\x22Address\x22}\x20in\x20the\x20Guard\x20table.')});}}else aD='Signer';}ay['push']({'who':aD,'sharing':String(aC??'0'),'mode':MODE_MAP[aB['mode']]});}if(ay['length']===0x0)continue;const aA=ax['key']!==undefined?s['get'](ax['key'])?.['step_id']:undefined;ax['key']!==undefined&&!s['has'](ax['key'])&&i['push']({'code':'GUARD_KEY_UNKNOWN','detail':'allocator\x20row\x20('+ax['rows'][0x0]['track']+')\x20binds\x20unknown\x20guard_key\x20\x27'+ax['key']+'\x27'}),T['push']({...aA!==undefined?{'guard':ref(aA)}:{},...ax['key']!==undefined?{'guard_key':ax['key']}:{},'track':ax['rows'][0x0]['track'],'sharing':ay,...az!==undefined?{'note':az}:{}});}j['push']({'op':'configure','id':'service_allocators','target':ref('service'),'method':'order_allocators','params':P({'description':a['allocator']['description'],'threshold':Number(a['fee_params']['threshold']??a['fee_params']['monthly_rent_amount']??0x0)||0x0,'allocators':T}),'requires':['machine_publish']});Array['isArray'](b['sales'])&&b['sales']['length']>0x0&&j['push']({'op':'configure','id':'service_sales','target':ref('service'),'method':'sales','params':{'op':'add','sales':b['sales']}});if(G!=='none'){const aH=p['some'](aM=>/review/i['test'](aM['name']));G==='review'&&!aH&&i['push']({'code':'REVIEW_NODE_MISSING','detail':'review_mode\x20\x27'+G+'\x27\x20declares\x20the\x20buyer\x20review\x20reputation\x20rail,\x20but\x20machine_shape\x20has\x20no\x20'+'\x27reviewed\x27\x20node.\x20Add\x20a\x20buyer-advanced\x20review\x20node\x20(operator\x20order_payer)\x20with\x20an\x20EXIT\x20edge\x20back\x20to\x20the\x20'+'settlement\x20rail\x20(R-DEAD-END:\x20a\x20zero-exit\x20review\x20node\x20strands\x20the\x20escrow),\x20or\x20anchor\x20the\x20claim\x20on\x20the\x20'+'delivered\x20terminal\x20via\x20a\x20host:\x22reward\x22\x20guard\x20(review_mode\x20\x22review_reward\x22\x20variant).'});const aI=r['find'](aM=>aM['host']==='reward'),aJ=p['find'](aM=>/review/i['test'](aM['name']))?.['name'];let aK,aL;if(aJ!==undefined){const aM=[];for(const aP of p){for(const aQ of aP['from']??[]){const aR=typeof aQ==='string'?{'prev':aQ,'guard_key':undefined}:aQ;aM['push']({'prev':aR['prev'],'guard_key':aR['guard_key'],'target':aP['name']});}}const aN=aM['find'](aS=>aS['target']===aJ&&aS['guard_key']!==undefined)?.['guard_key']??aM['find'](aS=>aS['prev']===aJ&&aS['guard_key']!==undefined)?.['guard_key'],aO=aN!==undefined?s['get'](aN):undefined;aK=aO?.['step_id'],aL=aN;}aK===undefined&&aI?.['step_id']!==undefined&&(aK=aI['step_id'],aL=aI['key']);if(aK!==undefined){const aS=b['buyer_review_enabled']===!![];j['push']({'op':'create','id':'repository_review','object':'repository','params':P({'name':f+'_review','description':'Structured\x20buyer\x20reputation\x20rows\x20(AR-1:\x20emitted\x20by\x20the\x20build\x20plan\x20—\x20no\x20manual\x20setup).','policies':[{'name':'review','description':'One\x20row\x20per\x20buyer\x20(id_from=Signer;\x20rewrite\x20=\x20own-record\x20overwrite).\x20Writes\x20require\x20the\x20review\x20credential\x20(guard\x20key\x20\x27'+aL+'\x27).\x20Payload:\x20JSON\x20text\x20{rating,\x20tags?,\x20orderRef?}.','write_guard':[{'guard':ref(aK)}],'id_from':'signer','value_type':'String'},...aS?[{'name':'buyer_review','description':'Merchant-side\x20structured\x20feedback\x20on\x20the\x20order/buyer\x20(D-R7\x20bidirectional\x20reputation,\x20opt-in).\x20One\x20row\x20per\x20writer\x20(id_from=Signer;\x20rewrite\x20=\x20own-record\x20overwrite).\x20NO\x20write\x20guard\x20by\x20design:\x20merchant\x20authority\x20is\x20verified\x20at\x20READ\x20time\x20(the\x20writer\x20must\x20control\x20the\x20order\x27s\x20service\x20—\x20graph\x20ControlIndex).\x20Payload:\x20JSON\x20text\x20{rating,\x20tags?,\x20orderRef?}.','id_from':'signer','value_type':'String'}]:[]]}),'notes':'REVIEW-COMPONENT\x20AR-1:\x20the\x20review\x20TEXT\x20still\x20rides\x20the\x20forward\x20message\x20(D-R1\x20dual\x20carrier);\x20this\x20repository\x20carries\x20ONLY\x20the\x20structured\x20row.\x20Buyers\x20resolve\x20this\x20object\x20by\x20name\x20(workspace/onchain_objects)\x20—\x20never\x20guess\x20an\x20address.'}),j['push']({'op':'configure','id':'service_review_repository','target':ref('service'),'method':'repositories','params':P({'op':'add','objects':[ref('repository_review')]}),'requires':['service','repository_review']});}if(G==='review_reward'){const aT=aI;if(aT===undefined||aT['step_id']===undefined)i['push']({'code':'REVIEW_REWARD_GUARD_MISSING','detail':'review_mode\x20\x27review_reward\x27\x20promises\x20a\x20claim\x20reward,\x20but\x20no\x20RESOLVED\x20host:\x22reward\x22\x20guard\x20spec\x20'+'exists\x20to\x20gate\x20the\x20claim.\x20Mount\x20a\x20reward\x20claim\x20guard\x20(e.g.\x20pattern.progress_state_check\x20anchored\x20'+'on\x20the\x20review\x20node\x20or\x20the\x20delivered\x20terminal\x20+\x20review\x20evidence\x20hash)\x20and\x20keep\x20it\x20resolvable\x20—\x20'+'an\x20unguarded\x20incentive\x20promise\x20must\x20not\x20publish\x20(INV-4).\x20The\x20root\x20must\x20also\x20carry\x20the\x20BKN-P2\x20'+'positive-amount\x20leg\x20(order.amount\x20>=\x201)\x20so\x20zero-total\x20orders\x20can\x20never\x20claim.'});else{const aU=b['reward_funding'],aV=t['get'](aT['key']);aV!==undefined&&!rootHasRewardRecordGate(aV['root'])&&i['push']({'code':'REVIEW_REWARD_UNARMED','detail':'review_reward\x20claim\x20guard\x20\x27'+aT['key']+'\x27\x20carries\x20no\x20record-gate:\x20Reward.claim\x20has\x20NO\x20'+'protocol-level\x20idempotency\x20(OFN-C1),\x20so\x20a\x20funded\x20pool\x20behind\x20this\x20guard\x20is\x20a\x20replay-drain\x20target.\x20'+'Add\x20logic_not(query_reward_record_exists(object=<reward>,\x20where={}))\x20(EMPTY\x20where\x20=\x20recipient-only\x20'+'scope;\x20the\x20storeFromId-filtered\x20form\x20is\x20a\x20SILENT\x20NO-OP\x20on-chain\x20—\x20ofn-mn-261012\x20F-01)\x20to\x20the\x20guard\x20'+'root,\x20wrapped\x20in\x20logic_and\x20with\x20the\x20identity\x20leg\x20(Signer\x20==\x20order.owner),\x20the\x20BKN-P2\x20positive-amount\x20'+'leg\x20(order.amount\x20>=\x201\x20—\x20zero-total\x20orders\x20must\x20never\x20claim)\x20and\x20the\x20existing\x20checks\x20'+'(see\x20tpl_reward_one_time_claim\x20v55\x20notes;\x20guard-risk\x20R-X1-14\x20audits\x20the\x20built\x20guard).\x20'+'Until\x20armed,\x20do\x20not\x20fund\x20the\x20pool.'}),j['push']({'op':'configure','id':'reward_review_guard_add','target':ref('reward_review'),'method':'guard_add','params':P({'guard':ref(aT['step_id'])}),'requires':['reward_review']}),j['push']({'op':'configure','id':'service_rewards','target':ref('service'),'method':'rewards','params':P({'op':'add','objects':[ref('reward_review')]}),'requires':['service']}),typeof aU==='string'||typeof aU==='number'?j['push']({'op':'configure','id':'reward_review_coin_add','target':ref('reward_review'),'method':'coin_add','params':{'coin':String(aU)},'requires':['reward_review']}):i['push']({'code':'REVIEW_REWARD_UNFUNDED','detail':'review_mode\x20\x27review_reward\x27\x20without\x20a\x20\x27reward_funding\x27\x20input\x20(INV-4\x20R-REWARD-FUNDED):\x20the\x20incentive\x20'+'is\x20a\x20marketing\x20promise\x20that\x20must\x20be\x20FUNDED\x20when\x20the\x20Service\x20is\x20built\x20(sale-time\x20planning\x20—\x20pool\x20>=\x20'+'expected\x20orders\x20x\x20per-order\x20reward,\x20benchmark\x20fee_param\x20review_reward_pool).\x20Pass\x20reward_funding\x20'+'(smallest-unit\x20string)\x20to\x20fund\x20the\x20Reward\x20object,\x20or\x20drop\x20to\x20review_mode\x20\x22review\x22.'});}}}if(A){j['push']({'op':'create','id':'arbitration','object':'arbitration','params':P({'name':f+'_arbitration','permission':ref('permission_arb'),'type_parameter':N}),'notes':'Independent\x20venue\x20(R2).\x20New\x20arbitrations\x20default\x20bPaused=true\x20—\x20unpause\x20is\x20a\x20separate\x20operator\x20step.'}),j['push']({'op':'configure','id':'service_arbitrations','target':ref('service'),'method':'arbitrations','params':P({'op':'add','objects':[ref('arbitration')]})});const aW=b['compensation_fund'];(typeof aW==='string'||typeof aW==='number')&&j['push']({'op':'configure','id':'service_compensation','target':ref('service'),'method':'compensation_fund_add','params':{'balance':String(aW)}});}j['push']({'op':'publish','id':'service_publish','target':ref('service'),'preflight':[{'check':'service_publish','status':'pending'},{'check':'FUND-EXIT-01','status':'pending'},{'check':'PLAN-ALLOC-01','status':'pending'},{'check':'TASKBIND-02','status':'pending'}]});const U=new Set(q['map'](aX=>aX['guard_key'])['filter'](aX=>typeof aX==='string')),V=/^0x[0-9a-fA-F]{20,64}$/,W=aX=>{const aY=t['get'](aX);if(aY===undefined)return undefined;for(const aZ of aY['table']){const b0=aZ;if(b0['b_submission']===!![]||b0['value_type']!=='Address')continue;const b1=b0['value'];if(typeof b1==='string'&&V['test'](b1))return String(b0['identifier']??'?');}return undefined;};for(const aX of t['keys']()){if(!w['has'](aX)&&!U['has'](aX))continue;const aY=W(aX);aY!==undefined&&i['push']({'code':'GUARD_FOREIGN_SERVICE','detail':'guard\x20\x27'+aX+'\x27\x20pins\x20an\x20on-chain\x20address\x20literal\x20(table\x20slot\x20'+aY+')\x20while\x20bound\x20into\x20this\x20build.\x20'+'The\x20plan\x27s\x20Service\x20is\x20created\x20BY\x20this\x20plan\x20and\x20cannot\x20equal\x20a\x20pre-existing\x20address,\x20so\x20the\x20pin\x20names\x20a\x20foreign\x20or\x20'+'stale\x20object:\x20each\x20object\x20is\x20well-formed\x20alone,\x20but\x20the\x20cross-object\x20identity\x20assert\x20aborts\x20every\x20guarded\x20forward\x20'+'(klook\x20B11\x20class),\x20and\x20Guard\x20+\x20machine\x20are\x20both\x20create/publish-frozen\x20—\x20unrepairable.\x20'+'Bind\x20by\x20plan\x20reference\x20({\x22$ref\x22:\x22service\x22})\x20or\x20by\x20the\x20P16\x20circular\x20service\x20NAME\x20instead.'});}const X=u['flatMap'](aZ=>{const b0=U['has'](aZ['key'])?'allocator':w['has'](aZ['key'])?'machine_edge':aZ['host']==='service'&&aZ['key']==='buy'?'service_buy':undefined;return b0?[{'key':aZ['key'],'template_id':aZ['template_id'],'host':aZ['host'],'site':b0,'purpose':aZ['purpose']}]:[];});return{'plan':{'version':0x1,'intent':d['intent']??'compile\x20'+a['id'],'templateId':a['id'],'inputs':b,'steps':j,...X['length']>0x0?{'pending_guards':X}:{}},'guardSpecs':r,'unresolved':u,'blockers':i};}
@@ -15,3 +15,13 @@ export declare function beginInFlight(op: string, data: unknown, env?: {
15
15
  }): string;
16
16
  export declare function recordInFlightOutcome(markerId: string, result: unknown): void;
17
17
  export declare function describeLastInFlight(op: string): string | undefined;
18
+ export declare function lastInFlightMarker(op: string): InFlightRecord | undefined;
19
+ export interface OrderLandedEvent {
20
+ order?: string;
21
+ progress?: string | null;
22
+ service?: string;
23
+ sender?: string;
24
+ time?: string | number;
25
+ digest?: string;
26
+ }
27
+ export declare function matchOrderLandedEvent(marker: InFlightRecord, ev: OrderLandedEvent): string | undefined;
@@ -1 +1 @@
1
- const MAX_RECORDS=0x32,MAX_AGE_MS=0x2*0x3c*0x3c*0x3e8,records=new Map();let seq=0x0;function hash(a){let b=0x1505;for(let c=0x0;c<a['length'];c++)b=(b<<0x5)+b+a['charCodeAt'](c)>>>0x0;return b['toString'](0x10);}function prune(){const a=Date['now']();for(const [b,c]of records){if(a-c['started_at']>MAX_AGE_MS)records['delete'](b);}while(records['size']>MAX_RECORDS){const d=records['keys']()['next']()['value'];if(d===undefined)break;records['delete'](d);}}function addr(a){return typeof a==='string'&&a['startsWith']('0x')?a:undefined;}export function beginInFlight(a,b,c){const d=b,e=d?.['order_new']?.['buy'],f=addr(d?.['object'])??addr(e?.['service']),g={'marker_id':'ifl_'+Date['now']()['toString'](0x10)+'_'+(seq++)['toString'](0x10),'op':a,'service':f,'buyer':addr(c?.['account']),'items_count':Array['isArray'](e?.['items'])?e['items']['length']:undefined,'params_hash':hash(JSON['stringify'](b??{})),'started_at':Date['now'](),'digests':[],'status':'in_flight'};return records['set'](g['marker_id'],g),prune(),g['marker_id'];}export function recordInFlightOutcome(a,b){const c=records['get'](a);if(!c)return;const d=b?.['digest'];typeof d==='string'&&d&&(c['digests']['push'](d),c['status']='landed');}export function describeLastInFlight(a){let b;for(const d of records['values']())if(d['op']===a)b=d;if(!b)return undefined;const c=[b['service']?'service='+b['service']:undefined,b['buyer']?'buyer='+b['buyer']:undefined,b['items_count']!==undefined?'items='+b['items_count']:undefined]['filter'](Boolean)['join']('\x20');if(b['status']==='landed'&&b['digests']['length']>0x0)return'IN-FLIGHT\x20MARKER\x20'+b['marker_id']+':\x20op='+b['op']+'\x20'+c+'\x20landed\x20with\x20digest\x20'+b['digests'][0x0]+'\x20'+('('+new Date(b['started_at'])['toISOString']()+').\x20The\x20execution\x20DID\x20reach\x20the\x20chain\x20—\x20adopt\x20the\x20')+'resulting\x20object;\x20resubmitting\x20the\x20same\x20call\x20creates\x20a\x20second\x20one.';return'IN-FLIGHT\x20MARKER\x20'+b['marker_id']+':\x20op='+b['op']+'\x20'+c+'\x20started\x20'+new Date(b['started_at'])['toISOString']()+'\x20'+'—\x20this\x20operation\x20is\x20observability-non-atomic:\x20a\x20transport\x20drop\x20after\x20submit\x20leaves\x20the\x20commit\x20state\x20'+'open.\x20Before\x20resubmitting,\x20first\x20verify\x20whether\x20an\x20order\x20with\x20this\x20exact\x20signature\x20already\x20landed\x20'+'(query\x20the\x20sender\x27s\x20recent\x20on-chain\x20objects\x20or\x20onchain_events\x20for\x20this\x20service);\x20adopt\x20it\x20if\x20present,\x20'+'resubmit\x20only\x20if\x20confirmed\x20absent.';}
1
+ const MAX_RECORDS=0x32,MAX_AGE_MS=0x2*0x3c*0x3c*0x3e8,records=new Map();let seq=0x0;function hash(a){let b=0x1505;for(let c=0x0;c<a['length'];c++)b=(b<<0x5)+b+a['charCodeAt'](c)>>>0x0;return b['toString'](0x10);}function prune(){const a=Date['now']();for(const [b,c]of records){if(a-c['started_at']>MAX_AGE_MS)records['delete'](b);}while(records['size']>MAX_RECORDS){const d=records['keys']()['next']()['value'];if(d===undefined)break;records['delete'](d);}}function addr(a){return typeof a==='string'&&a['startsWith']('0x')?a:undefined;}export function beginInFlight(a,b,c){const d=b,e=d?.['order_new']?.['buy'],f=addr(d?.['object'])??addr(e?.['service']),g={'marker_id':'ifl_'+Date['now']()['toString'](0x10)+'_'+(seq++)['toString'](0x10),'op':a,'service':f,'buyer':addr(c?.['account']),'items_count':Array['isArray'](e?.['items'])?e['items']['length']:undefined,'params_hash':hash(JSON['stringify'](b??{})),'started_at':Date['now'](),'digests':[],'status':'in_flight'};return records['set'](g['marker_id'],g),prune(),g['marker_id'];}export function recordInFlightOutcome(a,b){const c=records['get'](a);if(!c)return;const d=b?.['digest'];typeof d==='string'&&d&&(c['digests']['push'](d),c['status']='landed');}export function describeLastInFlight(a){let b;for(const d of records['values']())if(d['op']===a)b=d;if(!b)return undefined;const c=[b['service']?'service='+b['service']:undefined,b['buyer']?'buyer='+b['buyer']:undefined,b['items_count']!==undefined?'items='+b['items_count']:undefined]['filter'](Boolean)['join']('\x20');if(b['status']==='landed'&&b['digests']['length']>0x0)return'IN-FLIGHT\x20MARKER\x20'+b['marker_id']+':\x20op='+b['op']+'\x20'+c+'\x20landed\x20with\x20digest\x20'+b['digests'][0x0]+'\x20'+('('+new Date(b['started_at'])['toISOString']()+').\x20The\x20execution\x20DID\x20reach\x20the\x20chain\x20—\x20adopt\x20the\x20')+'resulting\x20object;\x20resubmitting\x20the\x20same\x20call\x20creates\x20a\x20second\x20one.';return'IN-FLIGHT\x20MARKER\x20'+b['marker_id']+':\x20op='+b['op']+'\x20'+c+'\x20started\x20'+new Date(b['started_at'])['toISOString']()+'\x20'+'—\x20this\x20operation\x20is\x20observability-non-atomic:\x20a\x20transport\x20drop\x20after\x20submit\x20leaves\x20the\x20commit\x20state\x20'+'open.\x20Before\x20resubmitting,\x20first\x20verify\x20whether\x20an\x20order\x20with\x20this\x20exact\x20signature\x20already\x20landed\x20'+'(query\x20the\x20sender\x27s\x20recent\x20on-chain\x20objects\x20or\x20onchain_events\x20for\x20this\x20service);\x20adopt\x20it\x20if\x20present,\x20'+'resubmit\x20only\x20if\x20confirmed\x20absent.';}export function lastInFlightMarker(a){let b;for(const c of records['values']())if(c['op']===a)b=c;return b;}export function matchOrderLandedEvent(a,b){const c=a['started_at']-0x2*0x3c*0x3e8,d=Number(b?.['time']);if(Number['isFinite'](d)&&d<c)return undefined;const e=!!(a['service']&&b?.['service']&&b['service']===a['service']),f=!!(a['buyer']&&b?.['sender']&&b['sender']['toLowerCase']()===a['buyer']['toLowerCase']());if(!e&&!f)return undefined;const g=b?.['digest']??'unknown';return'AUTO-VERIFIED\x20ON-CHAIN:\x20this\x20order\x20DID\x20land\x20despite\x20the\x20error\x20above\x20—\x20order='+(b?.['order']??'?')+((b?.['progress']?'\x20progress='+b['progress']:'')+'\x20digest='+g+'.\x20ADOPT\x20this\x20order\x20object;\x20')+'resubmitting\x20the\x20same\x20call\x20would\x20escrow\x20a\x20SECOND\x20time.';}
@@ -1,5 +1,5 @@
1
1
  import type { ProjectObjectType } from "../playbooks/service-build/namespace.js";
2
- export type BusinessModuleId = "milestone_escrow" | "independent_arbitration" | "wip_provenance" | "multi_tier_allocation" | "subscription_with_proof" | "accept_timeout_protection" | "refund_guarantee" | "reputation_on_chain" | "supplier_collaboration" | "damage_attestation";
2
+ export type BusinessModuleId = "milestone_escrow" | "independent_arbitration" | "wip_provenance" | "multi_tier_allocation" | "subscription_with_proof" | "accept_timeout_protection" | "refund_guarantee" | "reputation_on_chain" | "supplier_collaboration" | "damage_attestation" | "discount_lifecycle" | "praise_incentive";
3
3
  export interface ModuleEvaluationImpact {
4
4
  dimension: string;
5
5
  effect: "boost" | "required" | "optional";