@wowok/agent-mcp 3.4.4 → 3.4.5

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 (191) hide show
  1. package/dist/.build-stamp.json +3 -3
  2. package/dist/chain-semantics/composition-truth.js +1 -1
  3. package/dist/composition/audit.js +1 -1
  4. package/dist/composition/compile.js +1 -1
  5. package/dist/composition/emit-phases.js +1 -1
  6. package/dist/composition/guard-fill.js +1 -1
  7. package/dist/composition/input-normalize.js +1 -1
  8. package/dist/composition/materialize.js +1 -1
  9. package/dist/composition/mode-gates.js +1 -1
  10. package/dist/composition/param-disclosure.js +1 -1
  11. package/dist/composition/plan-run-store.js +1 -0
  12. package/dist/composition/reflux.js +1 -1
  13. package/dist/composition/role-bindings.js +1 -0
  14. package/dist/composition/shape-expand.js +1 -1
  15. package/dist/composition/supply-chain-emit.js +1 -1
  16. package/dist/config/judgment.d.ts +13 -25
  17. package/dist/config/judgment.js +1 -1
  18. package/dist/config/match-policy-file.js +1 -1
  19. package/dist/config/rule-engine.d.ts +4 -10
  20. package/dist/config/rule-engine.js +1 -1
  21. package/dist/config/template-params.js +1 -1
  22. package/dist/evaluation/engine.js +1 -1
  23. package/dist/experience/realtime-feedback.js +1 -1
  24. package/dist/extensions/capability.js +1 -1
  25. package/dist/graph/onchain/expand.js +1 -1
  26. package/dist/graph/onchain/exposure.js +1 -1
  27. package/dist/harness/forward-roster-preflight.js +1 -0
  28. package/dist/keeper/detectors.js +1 -1
  29. package/dist/knowledge/allocator-rail-verifier.js +1 -1
  30. package/dist/knowledge/arb-operation-face.js +1 -1
  31. package/dist/knowledge/arbitration-rail-verifier.js +1 -1
  32. package/dist/knowledge/audit-rules.d.ts +17 -1
  33. package/dist/knowledge/audit-rules.js +1 -1
  34. package/dist/knowledge/baselines/rules/alloc_audit.json.good.sha256 +1 -0
  35. package/dist/knowledge/baselines/rules/allocation.json.good.sha256 +1 -0
  36. package/dist/knowledge/baselines/rules/arb.json.good.sha256 +1 -0
  37. package/dist/knowledge/baselines/rules/arbitration.json.good.sha256 +1 -0
  38. package/dist/knowledge/baselines/rules/bridge.json.good.sha256 +1 -0
  39. package/dist/knowledge/baselines/rules/contact.json.good.sha256 +1 -0
  40. package/dist/knowledge/baselines/rules/demand.json.good.sha256 +1 -0
  41. package/dist/knowledge/baselines/rules/graph.json.good.sha256 +1 -0
  42. package/dist/knowledge/baselines/rules/guard.json.good.sha256 +1 -0
  43. package/dist/knowledge/baselines/rules/machine.json.good.sha256 +1 -0
  44. package/dist/knowledge/baselines/rules/oracle.json.good.sha256 +1 -0
  45. package/dist/knowledge/baselines/rules/order.json.good.sha256 +1 -0
  46. package/dist/knowledge/baselines/rules/payment.json.good.sha256 +1 -0
  47. package/dist/knowledge/baselines/rules/permission.json.good.sha256 +1 -0
  48. package/dist/knowledge/baselines/rules/personal.json.good.sha256 +1 -0
  49. package/dist/knowledge/baselines/rules/plan.json +153 -33
  50. package/dist/knowledge/baselines/rules/plan.json.good +153 -33
  51. package/dist/knowledge/baselines/rules/plan.json.good.sha256 +1 -0
  52. package/dist/knowledge/baselines/rules/progress.json.good.sha256 +1 -0
  53. package/dist/knowledge/baselines/rules/proof.json.good.sha256 +1 -0
  54. package/dist/knowledge/baselines/rules/registrar.json.good.sha256 +1 -0
  55. package/dist/knowledge/baselines/rules/repository.json.good.sha256 +1 -0
  56. package/dist/knowledge/baselines/rules/resource.json.good.sha256 +1 -0
  57. package/dist/knowledge/baselines/rules/reward.json.good.sha256 +1 -0
  58. package/dist/knowledge/baselines/rules/service.json.good.sha256 +1 -0
  59. package/dist/knowledge/baselines/rules/treasury.json.good.sha256 +1 -0
  60. package/dist/knowledge/baselines/rules/util.json.good.sha256 +1 -0
  61. package/dist/knowledge/builtin-templates.d.ts +1 -1
  62. package/dist/knowledge/builtin-templates.js +1 -1
  63. package/dist/knowledge/discount-threshold.js +1 -1
  64. package/dist/knowledge/fee-param-bindings.js +1 -1
  65. package/dist/knowledge/getting-started.js +1 -1
  66. package/dist/knowledge/guard-binding-table.js +1 -1
  67. package/dist/knowledge/guard-design-patterns.js +1 -1
  68. package/dist/knowledge/guard-templates.d.ts +3 -2
  69. package/dist/knowledge/guard-templates.js +1 -1
  70. package/dist/knowledge/index.js +1 -1
  71. package/dist/knowledge/industry-registry.js +1 -1
  72. package/dist/knowledge/jsonrpc-enum.js +1 -1
  73. package/dist/knowledge/knob-docs.js +1 -1
  74. package/dist/knowledge/machine-topology.js +1 -1
  75. package/dist/knowledge/param-schema.js +1 -1
  76. package/dist/knowledge/param-tiers.js +1 -1
  77. package/dist/knowledge/path-oracle/products/alibaba-1688.js +1 -1
  78. package/dist/knowledge/path-oracle/products/amazon.js +1 -1
  79. package/dist/knowledge/path-oracle/products/booking-com.js +1 -1
  80. package/dist/knowledge/path-oracle/products/contra.js +1 -1
  81. package/dist/knowledge/path-oracle/products/costco.js +1 -1
  82. package/dist/knowledge/path-oracle/products/duoduo-maicai.js +1 -1
  83. package/dist/knowledge/path-oracle/products/etsy.js +1 -1
  84. package/dist/knowledge/path-oracle/products/gamefound.js +1 -1
  85. package/dist/knowledge/path-oracle/products/gofundme.js +1 -1
  86. package/dist/knowledge/path-oracle/products/klook.js +1 -1
  87. package/dist/knowledge/path-oracle/products/ninety-nine-designs.js +1 -1
  88. package/dist/knowledge/path-oracle/products/pinduoduo-kuaituantuan.js +1 -1
  89. package/dist/knowledge/path-oracle/products/shansong.js +1 -1
  90. package/dist/knowledge/path-oracle/products/taobao-presale.js +1 -1
  91. package/dist/knowledge/path-oracle/products/upwork-catalog.js +1 -1
  92. package/dist/knowledge/path-oracle/products/upwork.js +1 -1
  93. package/dist/knowledge/pattern-resolutions.js +1 -1
  94. package/dist/knowledge/protocol-facts.js +1 -1
  95. package/dist/knowledge/publish-gate.js +1 -1
  96. package/dist/knowledge/publish-surface-contract.js +1 -1
  97. package/dist/knowledge/template-loader.js +1 -1
  98. package/dist/knowledge/template-registry.js +1 -1
  99. package/dist/knowledge/template-scanner.js +1 -1
  100. package/dist/knowledge/time-units.js +1 -0
  101. package/dist/knowledge/tools-reference.js +1 -1
  102. package/dist/knowledge/workflow-guidance.js +1 -1
  103. package/dist/monitor/MonitorLoop.js +1 -1
  104. package/dist/participation/radar-core.js +1 -1
  105. package/dist/playbooks/service-build/business-puzzle.js +1 -1
  106. package/dist/playbooks/service-build/machine-panorama.js +1 -1
  107. package/dist/playbooks/service-build/merchant-guide.js +1 -1
  108. package/dist/playbooks/service-build/migration-planner.js +1 -1
  109. package/dist/playbooks/service-build/object-panorama.js +1 -1
  110. package/dist/playbooks/service-build/participation-radar.js +1 -1
  111. package/dist/playbooks/service-build/relationship-profile.js +1 -1
  112. package/dist/playbooks/service-build/service-panorama.js +1 -1
  113. package/dist/playbooks/service-build/service-quote.js +1 -1
  114. package/dist/review/index.js +1 -1
  115. package/dist/safety/confirm-gate.js +1 -1
  116. package/dist/schema/benchmark-migration/index.d.ts +110 -2
  117. package/dist/schema/benchmark-migration/index.js +1 -1
  118. package/dist/schema/boundary-coercion.js +1 -0
  119. package/dist/schema/call/arbitration.js +1 -1
  120. package/dist/schema/call/base.js +1 -1
  121. package/dist/schema/call/handler.js +1 -1
  122. package/dist/schema/call/machine.d.ts +56 -8
  123. package/dist/schema/call/order.d.ts +37 -10
  124. package/dist/schema/call/order.js +1 -1
  125. package/dist/schema/call/permission.d.ts +210 -30
  126. package/dist/schema/call/personal.d.ts +56 -8
  127. package/dist/schema/call/progress.d.ts +28 -4
  128. package/dist/schema/call/semantic.js +1 -1
  129. package/dist/schema/call/service.d.ts +84 -12
  130. package/dist/schema/common/index.d.ts +14 -2
  131. package/dist/schema/common/index.js +1 -1
  132. package/dist/schema/evaluation/index.js +1 -1
  133. package/dist/schema/goal/index.d.ts +1 -1
  134. package/dist/schema/goal/planning.js +1 -1
  135. package/dist/schema/local/index.js +1 -1
  136. package/dist/schema/messenger/index.d.ts +168 -24
  137. package/dist/schema/messenger/index.js +1 -1
  138. package/dist/schema/operations.d.ts +655 -22
  139. package/dist/schema/operations.js +1 -1
  140. package/dist/schema/persona/index.d.ts +22 -110
  141. package/dist/schema/query/index.js +1 -1
  142. package/dist/schema/schema-version.js +1 -1
  143. package/dist/schema/workflow/index.d.ts +4 -0
  144. package/dist/schema/workflow/index.js +1 -1
  145. package/dist/schema-query-impl/index.js +1 -1
  146. package/dist/schemas/benchmark_migration_operation.schema.json +1 -1
  147. package/dist/schemas/evaluation_operation.schema.json +1 -1
  148. package/dist/schemas/goal_operation.schema.json +1 -1
  149. package/dist/schemas/guard_rebind_replacement.schema.json +1 -0
  150. package/dist/schemas/index.json +1 -1
  151. package/dist/schemas/messenger_operation.schema.json +1 -1
  152. package/dist/schemas/onchain_operations.schema.json +1 -1
  153. package/dist/schemas/onchain_operations_allocation.schema.json +1 -1
  154. package/dist/schemas/onchain_operations_arbitration.schema.json +1 -1
  155. package/dist/schemas/onchain_operations_contact.schema.json +1 -1
  156. package/dist/schemas/onchain_operations_demand.schema.json +1 -1
  157. package/dist/schemas/onchain_operations_gen_passport.schema.json +1 -1
  158. package/dist/schemas/onchain_operations_machine.schema.json +1 -1
  159. package/dist/schemas/onchain_operations_order.schema.json +1 -1
  160. package/dist/schemas/onchain_operations_permission.schema.json +1 -1
  161. package/dist/schemas/onchain_operations_personal.schema.json +1 -1
  162. package/dist/schemas/onchain_operations_progress.schema.json +1 -1
  163. package/dist/schemas/onchain_operations_proof.schema.json +1 -1
  164. package/dist/schemas/onchain_operations_repository.schema.json +1 -1
  165. package/dist/schemas/onchain_operations_reward.schema.json +1 -1
  166. package/dist/schemas/onchain_operations_service.schema.json +1 -1
  167. package/dist/schemas/onchain_operations_treasury.schema.json +1 -1
  168. package/dist/schemas/persona_operation.schema.json +1 -1
  169. package/dist/schemas/time_convert.schema.json +1 -0
  170. package/dist/schemas/wip_file.schema.json +1 -1
  171. package/dist/schemas/workflow_operation.schema.json +1 -1
  172. package/dist/tools/handlers/benchmark-migration.js +1 -1
  173. package/dist/tools/handlers/config.js +1 -1
  174. package/dist/tools/handlers/fund-rail-recipe.js +1 -1
  175. package/dist/tools/handlers/guard-rebind-replacement.js +1 -0
  176. package/dist/tools/handlers/local.js +1 -1
  177. package/dist/tools/handlers/mark-namespace.js +1 -1
  178. package/dist/tools/handlers/onchain.js +1 -1
  179. package/dist/tools/handlers/query.js +1 -1
  180. package/dist/tools/handlers/settle-sweep.js +1 -1
  181. package/dist/tools/handlers/time-convert.js +1 -0
  182. package/dist/tools/handlers/wip.js +1 -1
  183. package/dist/tools/handlers/workflow.js +1 -1
  184. package/dist/tools/index.d.ts +1 -0
  185. package/dist/tools/index.js +1 -1
  186. package/dist/tools/registry/business.js +1 -1
  187. package/dist/tools/registry/local.js +1 -1
  188. package/dist/tools/registry/onchain.js +1 -1
  189. package/dist/tools/wip-verify-ledger.js +1 -1
  190. package/dist/tools/wrap.js +1 -1
  191. package/package.json +6 -5
@@ -1 +1 @@
1
- import{analyzeIntent}from'./intent-analyzer.js';import{compileTemplate}from'../../composition/compile.js';import{guardMountCensus}from'../../composition/guard-fill.js';import{reflux,auditScore}from'../../composition/reflux.js';import{planBlueprint}from'../../composition/blueprint-view.js';import{getGuardDesignPattern}from'../../knowledge/guard-design-patterns.js';import{lookupBinding}from'../../knowledge/guard-binding-table.js';import{GUARD_TEMPLATES,getTemplatesByScene}from'../../knowledge/guard-templates.js';import{GUARD_AFTER_SERVICE_DRAFT,relationDirection}from'../../knowledge/object-dependency.js';import{collectLateMarks}from'../../composition/plan.js';import{BUILTIN_TEMPLATES_VERSION}from'../../knowledge/builtin-templates.js';import{templateCatalogDigest}from'../../knowledge/template-loader.js';import{checkGameTheoryConstraints}from'./game-theory.js';import{assessWorkflowDesign}from'./workflow-design-assessment.js';import{getCapability,recommendCapabilities,checkCapabilityConstraints,capabilityIntentEvidence}from'../../extensions/capability.js';import{requirementCoverage}from'../../knowledge/requirement-families.js';import{recipientDesignGuidance}from'../../knowledge/recipient-constraint.js';import{getTemplate,getTemplatesByIndustry}from'../../knowledge/template-loader.js';import{resolveUserInputQuestions}from'../../knowledge/param-schema.js';import{PRODUCT_DETAIL_SOURCE_KEY,resolveProductDetailSource}from'../../knowledge/product-detail-source.js';import{getScenarioMode}from'../../knowledge/scenario-modes.js';function derivePlanSatisfiedConstraints(a,b){const c=new Set(),d=i=>a['edges']['some'](j=>j['relation']===i),e=i=>a['nodes']['some'](j=>j['id']===i),f=i=>a['nodes']['some'](j=>j['type']===i),g=i=>a['adoptedModules']['includes'](i);if(d('has_order_allocators'))c['add']('order_allocators_bound');if(d('uses_machine'))c['add']('machine_bound_before_publish');if(d('has_arbitration'))c['add']('arbitration_bound_to_service');if(e('machine'))c['add']('machine_published');if(e('repository'))c['add']('repository_published');if(e('service'))c['add']('service_published');e('permission_arb')&&e('permission')&&c['add']('arbitration_permission_independent');g('independent_arbitration')&&a['nodes']['some'](i=>i['id']['includes']('guard')&&i['id']['includes']('arbitration'))&&c['add']('voting_guard_configured');g('accept_timeout_protection')&&(c['add']('time_guard_configured'),c['add']('adminUnhold_permission'));g('milestone_escrow')&&f('guard')&&c['add']('milestone_forward_guarded');const h=d('has_order_allocators');if(h&&b['payment']['allocation']&&b['payment']['allocation']['length']>0x0){c['add']('allocators_configured');const i=b['payment']['allocation']['reduce']((k,l)=>k+l['percentage'],0x0);if(Math['abs'](i-0x64)<0.001)c['add']('sharing_sum_100');const j=b['payment']['allocation']['find'](k=>k['recipient']==='platform');if(!j||j['percentage']===0x0)c['add']('platform_fee_zero');g('supplier_collaboration')&&(c['add']('allocation_sharing_configured'),c['add']('demand_configured'));}g('wip_provenance')&&e('repository')&&c['add']('wip_hash_before_delivery');g('subscription_with_proof')&&e('repository')&&(c['add']('delivery_guard_per_cycle'),c['add']('repository_updated'));g('damage_attestation')&&(c['add']('pre_rental_hash'),c['add']('post_rental_hash'));g('refund_guarantee')&&(c['add']('compensation_fund_positive'),c['add']('refund_guard_configured'));if(g('praise_incentive')){const k=a['plan']['steps']['some'](m=>m['op']==='create'&&m['object']==='reward'),l=a['plan']['steps']['some'](m=>m['op']==='configure'&&m['method']==='coin_add');k&&l&&(c['add']('reward_pool_funded'),c['add']('reward_claim_replay_armed'));}g('discount_lifecycle')&&(c['add']('discount_budget_planned'),c['add']('discount_burn_disclosed'));if(g('after_sales_guarantee')){const m=a['plan']['steps']['find'](p=>p['op']==='create'&&p['object']==='machine'),n=m?.['params']?.['nodes']??[],o=n['some'](p=>/return|refund|exchange|replace|reship|swap|warranty|repair/i['test'](p['name']??''));o&&(c['add']('after_sales_rail_present'),c['add']('after_sales_rail_node_gated'),c['add']('after_sales_window_anchored'),c['add']('after_sales_no_double_remedy'));}if(g('acceptance_judging')){const p=a['plan']['steps']['find'](t=>t['op']==='create'&&t['object']==='machine'),q=p?.['params']?.['nodes']??[],r=q['map'](t=>t['name']??''),s=r['some'](t=>/accept|approv|award|ruling|place|placement|triage|vot|evaluat|winner|judge/i['test'](t));if(s){const t=r['some'](u=>/revis|redeliver|resubmit|rework/i['test'](u));c['add']('acceptance_race_free');if(e('arbitration'))c['add']('acceptance_judge_independent');if(!t||e('repository'))c['add']('acceptance_revision_bounded');}}if(g('installment_deposit')){const u=a['plan']['steps']['find'](z=>z['op']==='create'&&z['object']==='machine'),v=u?.['params']?.['nodes']??[],w=v['map'](z=>z['name']??''),x=w['some'](z=>/(deposit|down_?pay|balance_due|balance_owed|installment|milestone|awaiting|owed)/i['test'](z)),y=w['some'](z=>/(paid|funded|captured|settled)/i['test'](z));x&&y&&(c['add']('installment_funding_gated'),c['add']('installment_deposit_exit'),c['add']('installment_release_once'));}if(g('affiliate_commission')){const z=a['plan']['steps']['find'](D=>D['op']==='create'&&D['object']==='machine'),A=z?.['params']?.['nodes']??[],B=A['map'](D=>D['name']??''),C=B['some'](D=>/(commission|affiliate|referr|attribut|partner_?payout)/i['test'](D));C&&(c['add']('affiliate_rail_present'),c['add']('affiliate_clawback_disclosed'),c['add']('affiliate_window_anchored'));}if(g('crowdfunding')){const D=a['plan']['steps']['find'](H=>H['op']==='create'&&H['object']==='machine'),E=D?.['params']?.['nodes']??[],F=E['map'](H=>H['name']??''),G=F['some'](H=>/(releas|settle|funded|disburs|project)/i['test'](H));G&&(c['add']('crowdfunding_exit_rail_present'),c['add']('crowdfunding_aggregate_writer_bound'),c['add']('crowdfunding_disclosure_present'));}if(g('logistics_fulfillment')){const H=a['plan']['steps']['find'](L=>L['op']==='create'&&L['object']==='machine'),I=H?.['params']?.['nodes']??[],J=I['map'](L=>L['name']??''),K=J['some'](L=>/(dispatch|handover|hand_over|pickup|deliver|courier|rider|shipped)/i['test'](L));K&&(c['add']('logistics_rail_present'),c['add']('logistics_loss_covered'),c['add']('logistics_fee_independent'),c['add']('logistics_dispatch_disclosed'));}return c;}function deriveDeployTimeChecks(a,b=![]){const c=[];return a['nodes']['some'](d=>d['id']==='machine')&&c['push']('Machine\x20published\x20AND\x20bound\x20to\x20Service\x20BEFORE\x20Service.publish\x20(machine\x20is\x20immutable\x20after\x20publish)'),a['edges']['some'](d=>d['relation']==='has_order_allocators')&&(c['push']('Service.order_allocators\x20bound\x20(verify\x20via\x20query_objects\x20after\x20publish\x20—\x20order_allocators\x20is\x20FROZEN\x20at\x20publish)'),c['push']('Settlement\x20is\x20NOT\x20triggered\x20by\x20reaching\x20a\x20Machine\x20node\x20alone\x20—\x20an\x20explicit\x20alloc_by_guard\x20call\x20(keeper\x20or\x20merchant)\x20fires\x20the\x20settlement\x20Allocator\x20once\x20its\x20Guard\x20passes.\x20Declare\x20the\x20node->allocator\x20trigger\x20(which\x20terminal\x20node\x20unlocks\x20settlement)\x20and\x20schedule\x20the\x20keeper\x20step;\x20otherwise\x20orders\x20stall\x20at\x20the\x20settle\x20node\x20with\x20allocation_state=pending'),c['push']('ALLOCATOR\x20GUARD\x20DESIGN\x20—\x20hand-built\x20rails\x20(sahr\x20lesson):\x20BEFORE\x20writing\x20the\x20settlement\x20Guard,\x20map\x20the\x20host\x20object\x27s\x20RICH\x20STATES:\x20enumerate\x20the\x20Machine\x27s\x20terminal\x20nodes\x20(settlement\x20vs\x20refund\x20polarity),\x20the\x20mid-flight\x20states\x20a\x20claim\x20or\x20dispute\x20opens,\x20and\x20which\x20business\x20event\x20each\x20state\x20transition\x20represents;\x20the\x20allocator\x20gate\x20must\x20sit\x20at\x20exactly\x20ONE\x20mapped\x20transition\x20(e.g.\x20\x27order\x20reached\x20settle\x20terminal\x20AND\x20business\x20obligations\x20verified\x27),\x20never\x20at\x20\x27any\x20time\x20after\x20start\x27.\x20Then\x20bind\x20WHO\x20may\x20trigger\x20alloc_by_guard:\x20the\x20gate\x20carries\x20a\x20caller-identity\x20leg\x20—\x20context(Signer)\x20compared\x20against\x20a\x20table\x20entry,\x20a\x20permission.admin\x20/\x20order.owner\x20read,\x20or\x20the\x20named-operator\x20roster\x20query.\x20order.claimed_by\x20is\x20ORDER\x20STATE,\x20not\x20a\x20caller\x20binding\x20—\x20a\x20gate\x20whose\x20legs\x20read\x20only\x20order/progress/clock\x20state\x20is\x20callable\x20by\x20ANY\x20address,\x20and\x20a\x20bystander\x20can\x20accelerate\x20someone\x20else\x27s\x20payout\x20(sahr,\x20live-proven)'),c['push']('ALLOCATOR\x20GUARD\x20REVIEW\x20—\x20pre-publish,\x20semantic\x20alignment:\x20SAFETY\x20—\x20a\x20settlement\x20track\x20with\x20refund\x20exposure\x20carries\x20the\x20dispute\x20freeze\x20leg\x20logic_not[order.dispute.open]\x20(query\x201576)\x20so\x20a\x20filed\x20dispute\x20freezes\x20new\x20settlements;\x20resolved-awaiting-stamp\x20flows\x20drive\x20the\x20stamp\x20with\x20order.dispute.unstamped\x20(query\x201578).\x20EFFECTIVENESS\x20—\x20read\x20every\x20gate\x20leg\x20back\x20against\x20the\x20business\x20description\x20(who\x20SHOULD\x20trigger,\x20at\x20which\x20business\x20milestone,\x20with\x20what\x20evidence):\x20structural\x20lint\x20passing\x20is\x20NOT\x20semantic\x20alignment.\x20Run\x20the\x20template\x20scan\x20dry-run\x20before\x20publish\x20—\x20the\x20knowledge\x20face\x20discloses\x20identity-less\x20allocator\x20gates\x20as\x20RAIL_NO_CALLER_IDENTITY\x20(info,\x20never\x20blocking);\x20treat\x20the\x20disclosure\x20as\x20a\x20design-review\x20flag\x20and\x20resolve\x20it\x20either\x20with\x20a\x20caller-identity\x20leg\x20or\x20a\x20DOCUMENTED\x20open-trigger\x20rationale\x20(scene\x20verifies\x20identity\x20upstream\x20/\x20intentionally\x20open\x20venue),\x20never\x20by\x20silence'),c['push']('ALLOCATOR\x20RULING\x20DIRECTION\x20—\x20the\x20rich-state\x20matrix\x20closes\x20BOTH\x20ruling\x20outcomes:\x20an\x20award\x20exit\x20on\x20the\x20ARBITRATION\x20indemnity\x20track\x20(a\x20tpl_forward_arb_ruling_won\x20claimed_by==true\x20leg\x20is\x20legal\x20arb-side\x20state,\x20decision\x2011)\x20bound\x20ONLY\x20to\x20a\x20buyer-side\x20identity\x20(order.owner/agent)\x20is\x20unreachable\x20after\x20a\x20MERCHANT-favored\x20ruling\x20or\x20dismissal\x20—\x20nobody\x20but\x20the\x20buyer\x20can\x20open\x20the\x20exit\x20and\x20the\x20escrow\x20principal\x20strands\x20(w3k7\x20m2:\x201.25\x20WOW\x20held\x20on\x20a\x20fully-guarded\x20order;\x20the\x20protocol\x20is\x20direction-blind,\x20the\x20order\x20object\x20exposes\x20NO\x20winner\x20accessor,\x20so\x20the\x20guard\x20itself\x20cannot\x20branch\x20on\x20who\x20won).\x20Pair\x20the\x20buyer-side\x20award\x20exit\x20with\x20a\x20merchant-side\x20exit\x20(a\x20terminal-node-gated\x20recovery\x20sweep\x20—\x20the\x20canonical\x20recover\x20rail),\x20or\x20document\x20that\x20the\x20keeper\x20dual-payout\x20protocol\x20is\x20the\x20intended\x20sole\x20post-ruling\x20exit.\x20Overlap\x20between\x20an\x20award\x20and\x20a\x20fund-rail\x20payout\x20is\x20LEGAL\x20under\x20decision\x2011\x20and\x20is\x20disclosed\x20at\x20the\x20MCP\x20dual-payout\x20confirmation\x20gate\x20—\x20resolve\x20reachability\x20before\x20publish,\x20never\x20by\x20silence.\x20INVERTED\x20FUNDING\x20award-recipient\x20face\x20(W5-01\x20d;\x20the\x20order-side\x20award\x20payout\x20hard-binds\x20to\x20the\x20order\x20owner\x20on\x20both\x20compensate\x20and\x20conclude\x20paths):\x20a\x20ruling\x20pays\x20ONLY\x20the\x20compensation\x20indemnity,\x20never\x20the\x20escrow\x20principal\x20—\x20and\x20on\x20an\x20INVERTED-FUNDING\x20build\x20(bounty/contest:\x20the\x20SPONSOR\x20is\x20the\x20order_payer,\x20so\x20order.owner\x20IS\x20the\x20funder)\x20a\x20hunter/designer-side\x20win\x20pays\x20THE\x20SPONSOR,\x20not\x20the\x20winning\x20party;\x20state\x20both\x20directions\x20(award\x20recipient\x20+\x20principal\x20exit\x20via\x20the\x20recover\x20rail\x27s\x20note)\x20in\x20the\x20storefront/quote\x20before\x20publish')),(a['adoptedModules']['includes']('refund_guarantee')||a['nodes']['some'](d=>d['id']==='arbitration'))&&(b?c['push']('COMPENSATION\x20FUND:\x20DO\x20NOT\x20FUND\x20—\x20this\x20template\x20declares\x20compensation_fund_policy=forbidden\x20(the\x20unreserved\x20pool\x20is\x20double-takeable\x20via\x20refund-then-claim\x20until\x20the\x20arbitration-escrow\x20shared\x20gate\x20lands;\x20user\x20ruling\x202026-10-15).\x20Disputes\x20ride\x20the\x20escrow\x20rails\x20only;\x20the\x20compensation_fund_topup\x20post-deploy\x20step\x20is\x20intentionally\x20absent'):c['push']('compensation_fund\x20MUST\x20be\x20able\x20to\x20cover\x20payouts:\x20a\x20claim\x20against\x20a\x20drained\x20fund\x20aborts\x20with\x20E_COMPENSATION_NOT_MATCH.\x20Size\x20the\x20fund\x20>=\x203x\x20a\x20TYPICAL\x20single\x20order\x20(3x\x20IS\x20the\x20chain\x27s\x20hard\x20award\x20ceiling,\x20MAX_INDEMNITY_MULTIPLE)\x20—\x20per-order\x20coverage\x20is\x20enforced\x20at\x20BUY\x20time\x20(each\x20order\x20is\x20checked\x20against\x203x\x20ITS\x20OWN\x20amount,\x20not\x203x\x20the\x20highest\x20SKU),\x20so\x20publish\x20no\x20longer\x20blocks\x20on\x20coverage;\x20verify\x20the\x20on-chain\x20balance\x20before\x20going\x20live.\x205R-07③:\x20after\x20go-live\x20the\x20keeper\x20WATCHES\x20the\x20water\x20level\x20(see\x20the\x20compensation_fund_watch\x20step)\x20—\x20no\x20hard\x20gate,\x20the\x20merchant\x20decides')),a['nodes']['some'](d=>d['id']==='arbitration')&&(c['push']('Arbitration\x20activation\x20is\x20ATOMIC\x20in\x20the\x20creation\x20plan\x20—\x20the\x20chain\x20hardcodes\x20every\x20new\x20Arbitration\x20to\x20PAUSED\x20at\x20construction,\x20and\x20the\x20plan\x27s\x20arbitration\x20create\x20payload\x20carries\x20pause:false,\x20which\x20the\x20executor\x20composes\x20as\x20the\x20unpause\x20write\x20in\x20the\x20SAME\x20transaction\x20(the\x20creator\x20is\x20the\x20new\x20Permission\x27s\x20admin,\x20so\x20the\x20356\x20assert\x20passes).\x20Verify\x20the\x20paused\x20flag\x20reads\x20false\x20after\x20materialization\x20(a\x20paused\x20venue\x20aborts\x20every\x20dispute\x20filing).\x20Keep\x20Arbitration.permission\x20distinct\x20from\x20Service.permission\x20on-chain\x20(E_ARBITRATION_PERMISSION_CONFLICT=33)'),c['push']('ARBITRATION\x20VENUE\x20OWNERSHIP\x20(D-5):\x20the\x20recommended\x20onboarding\x20default\x20is\x20a\x20SELF-BUILT\x20venue\x20—\x20your\x20own\x20Arbitration\x20object\x20with\x20your\x20own\x20permission/admin\x20(voting_guard\x20tpl_voting_guard_open_vote\x20for\x20community\x20cases,\x20tpl_voting_guard_numeric_weight\x20for\x20a\x20named\x20panel).\x20A\x20THIRD-PARTY\x20venue\x20you\x20do\x20not\x20control\x20hands\x20the\x20private\x20key\x20that\x20answers\x20and\x20appeals\x20cases\x20to\x20its\x20operator:\x20an\x20outside\x20store\x27s\x20admin\x20going\x20silent\x20strands\x20your\x20defense\x20(F-16,\x20live-proven).\x20Use\x20an\x20outside\x20venue\x20ONLY\x20when\x20its\x20operator\x20is\x20a\x20named,\x20reachable\x20counterparty\x20the\x20merchant\x20accepts')),a['nodes']['some'](d=>d['id']==='repository')&&c['push']('Repository\x20published\x20and\x20Guard\x20write\x20validation\x20configured'),c['push']('After\x20materialization,\x20confirm\x20the\x20on-chain\x20state\x20matches\x20this\x20plan\x20(query_toolkit\x20query_type=\x27service_panorama\x27)'),c;}function derivePostDeploySteps(a,b=![],c=![]){const d=[];return!b&&(a['adoptedModules']['includes']('refund_guarantee')||a['nodes']['some'](e=>e['id']==='arbitration'))&&(!c&&d['push']({'order':d['length']+0x1,'id':'compensation_fund_topup','title':'Top\x20up\x20the\x20compensation\x20fund','when':'After\x20the\x20Service\x20PUBLISHES\x20successfully\x20(post-publish,\x20before\x20the\x20store\x20goes\x20live\x20to\x20buyers)','action':'Call\x20compensation_fund_add\x20sized\x20>=\x203x\x20a\x20TYPICAL\x20single\x20order\x20(3x\x20=\x20the\x20chain\x27s\x20hard\x20award\x20ceiling,\x20MAX_INDEMNITY_MULTIPLE;\x20above\x203x\x20only\x20buys\x20headroom\x20for\x20concurrent\x20claims).\x20Per-order\x20coverage\x20is\x20enforced\x20at\x20BUY\x20time\x20—\x20each\x20incoming\x20order\x20is\x20checked\x20against\x203x\x20ITS\x20OWN\x20amount\x20and\x20under-covered\x20orders\x20cannot\x20be\x20created\x20—\x20then\x20verify\x20the\x20on-chain\x20fund\x20balance\x20via\x20query_objects','tool_hint':'onchain_operations\x20(service.compensation_fund_add)','failure_if_skipped':'a\x20compensation\x20claim\x20against\x20an\x20empty\x20fund\x20aborts\x20(E_COMPENSATION_NOT_MATCH,\x20testnet\x20lesson\x20R-4)'}),d['push']({'order':d['length']+0x1,'id':'compensation_fund_watch','title':'Watch\x20the\x20compensation-fund\x20water\x20level\x20(recurring\x20keeper\x20step)','when':'Recurring\x20—\x20on\x20every\x20keeper\x20cycle\x20after\x20go-live,\x20and\x20ALWAYS\x20immediately\x20after\x20each\x20arbitration\x20payout\x20posts','action':'Query\x20the\x20on-chain\x20fund\x20balance\x20and\x20classify\x20it\x20with\x20classifyFundWaterLevel(balance,\x20low_water_threshold)\x20into\x20THREE\x20tiers:\x20HEALTHY\x20(balance\x20>=\x20threshold\x20—\x20silence\x20is\x20the\x20healthy\x20signal,\x20no\x20event)\x20/\x20LOW\x20WATER\x20(0\x20<\x20balance\x20<\x20threshold\x20—\x20surface\x20fundWaterReminder:\x20recommend\x20topping\x20up\x20via\x20compensation_fund_add;\x20one\x20large\x20award\x20could\x20leave\x20top\x20listings\x20under-covered)\x20/\x20DEPLETED\x20(balance\x200\x20—\x20surface\x20fundWaterReminder\x20LOUD:\x20every\x20claim\x20aborts\x2027\x20and\x20listings\x20above\x20the\x20zero\x20cap\x20check\x20out\x20UNDER-COVERED,\x20not\x20blocked\x20—\x20the\x20buy\x20proceeds\x20with\x20a\x20warning\x20since\x20ruling\x20⑤).\x20Thresholds\x20are\x20the\x20MERCHANT\x27s\x20call\x20(decision\x207)\x20—\x20recommended\x20anchor:\x20low-water\x20line\x20at\x203x\x20the\x20flagship\x20SKU\x20price,\x20healthy\x20line\x20at\x203x\x20the\x20typical\x20order.\x20NEVER\x20block\x20a\x20SKU\x20or\x20gate\x20a\x20claim\x20on\x20the\x20tier\x20—\x20the\x20reminder\x20is\x20the\x20whole\x20feature;\x20the\x20merchant\x20decides\x20(top\x20up\x20/\x20accept\x20the\x20exposure)','tool_hint':'query_toolkit\x20(service_panorama:\x20fund\x20balance)\x20+\x20fund-layer\x20classifyFundWaterLevel\x20+\x20onchain_operations\x20(service.compensation_fund_add)\x20on\x20the\x20merchant\x27s\x20decision','failure_if_skipped':'a\x20drained\x20or\x20low\x20fund\x20is\x20SILENT\x20—\x20the\x20first\x20signal\x20is\x20a\x20buyer\x27s\x20claim\x20aborting\x20(27)\x20or\x20top\x20listings\x20checking\x20out\x20under-covered\x20(buy\x20proceeds\x20with\x20a\x20warning\x20since\x20ruling\x20⑤;\x20a\x20max-award\x20ruling\x20aborts\x20code\x2027)'})),a['nodes']['some'](e=>e['id']==='arbitration')&&(d['push']({'order':d['length']+0x1,'id':'arbitration_unpause','title':'Verify\x20the\x20Arbitration\x20is\x20ACTIVE\x20(activation\x20rode\x20the\x20create)','when':'Immediately\x20after\x20materialization\x20—\x20before\x20the\x20store\x20goes\x20live\x20to\x20buyers','action':'The\x20creation\x20plan\x27s\x20arbitration\x20create\x20payload\x20carries\x20pause:false\x20(the\x20chain\x20hardcodes\x20new\x20Arbitrations\x20to\x20paused;\x20the\x20executor\x20composes\x20the\x20unpause\x20in\x20the\x20same\x20transaction)\x20—\x20VERIFY\x20the\x20paused\x20flag\x20reads\x20false\x20via\x20query_toolkit;\x20only\x20an\x20already-paused\x20leftover\x20venue\x20(built\x20before\x20this\x20payload\x20field\x20existed)\x20needs\x20a\x20manual\x20unpause.\x20Keep\x20its\x20Permission\x20distinct\x20from\x20the\x20Service\x20Permission\x20(E_ARBITRATION_PERMISSION_CONFLICT=33)','tool_hint':'query_toolkit\x20(arbitration\x20paused\x20flag);\x20manual\x20unpause\x20via\x20onchain_operations\x20(arbitration\x20pause:false)\x20ONLY\x20for\x20a\x20legacy\x20paused\x20venue','failure_if_skipped':'a\x20paused\x20Arbitration\x20aborts\x20every\x20dispute\x20filing\x20(testnet\x20lesson\x20R-5)'}),d['push']({'order':d['length']+0x1,'id':'arbitration_permission_write','title':'Grant\x20the\x20operator\x20account\x20its\x20venue-management\x20permissions','when':'After\x20the\x20Arbitration\x20object\x20is\x20created,\x20BEFORE\x20any\x20venue-management\x20call\x20(description/guard/fee/pause\x20edits)\x20from\x20the\x20operator\x20account','action':'Write\x20the\x20operator\x20permission\x20row:\x20onchain_operations\x20operation_type=\x27permission\x27,\x20data={object:\x27<arbitration_permission_object>\x27,\x20table:{op:\x27add\x20perm\x20by\x20entity\x27,\x20entity:\x27<operator_account>\x27,\x20index:[350,351,354,356,357,359]}}\x20—\x20350\x20file\x20new\x20cases,\x20351\x20description,\x20354\x20voting_guard\x20management,\x20356\x20pause/resume,\x20357\x20fee,\x20359\x20ruling.\x20The\x20arbitration\x20Permission\x20table\x20starts\x20EMPTY\x20with\x20only\x20the\x20creator\x20seeded\x20as\x20admin,\x20so\x20without\x20this\x20row\x20every\x20operator\x20call\x20aborts\x20on\x20the\x20permission\x20assert.\x20entity\x20must\x20be\x20a\x20FULL\x2066-char\x200x\x20address\x20or\x20a\x20local\x20mark\x20name\x20—\x20a\x20truncated\x20address\x20normalizes\x20to\x20a\x20DIFFERENT\x20on-chain\x20address\x20and\x20grants\x20the\x20wrong\x20row\x20silently','tool_hint':'onchain_operations\x20(permission\x20add\x20perm\x20by\x20entity,\x20indexes\x20350/351/354/356/357/359)','failure_if_skipped':'the\x20operator\x20account\x20holds\x20NO\x20rows\x20in\x20the\x20arbitration\x20Permission\x20table\x20—\x20every\x20venue-management\x20call\x20from\x20it\x20aborts\x20on\x20the\x20permission\x20assert\x20(permission\x20350-359\x20failures)','note':'SIGNER\x20DISCLOSURE:\x20until\x20the\x20row\x20above\x20lands,\x20the\x20ONLY\x20account\x20that\x20can\x20manage\x20this\x20venue\x20(pause\x20356\x20included)\x20is\x20the\x20venue\x20Permission\x27s\x20admin\x20—\x20its\x20CREATOR.\x20In\x20the\x20usual\x20single-venue\x20build\x20the\x20creator\x20is\x20the\x20arbitrator\x27s\x20account,\x20so\x20an\x20emergency\x20pause\x20before\x20this\x20step\x20must\x20be\x20signed\x20by\x20the\x20arbitrator,\x20not\x20the\x20merchant\x20operator.'}),d['push']({'order':d['length']+0x1,'id':'arbitration_arbitrator_grant','title':'Grant\x20the\x20arbitrator\x20account\x20its\x20case-lifecycle\x20permissions','when':'After\x20arbitration_permission_write,\x20BEFORE\x20the\x20first\x20dispute\x20reaches\x20voting','action':'Write\x20the\x20arbitrator\x20permission\x20row:\x20same\x20permission-object\x20call\x20shape\x20with\x20entity:\x27<arbitrator_account>\x27\x20and\x20index:[358,359,360,361,362,363,364]\x20—\x20358\x20vote,\x20359\x20ruling,\x20360\x20feedback,\x20361\x20confirm,\x20362\x20voting-deadline\x20change,\x20363\x20reset,\x20364\x20receive.\x20Note:\x20the\x20disputing\x20CUSTOMER\x20must\x20hold\x20358\x20for\x20their\x20vote\x20to\x20count\x20(a\x20plain\x20vote\x20with\x20an\x20empty\x20voting_guard\x20still\x20asserts\x20358\x20—\x20ungranted,\x20voting\x20collapses\x20to\x20admin-only,\x20E-13);\x20that\x20per-dispute\x20customer\x20grant\x20is\x20issued\x20at\x20filing\x20time,\x20NOT\x20in\x20this\x20step.\x20Full\x2066-char\x20address\x20or\x20mark\x20name\x20only','tool_hint':'onchain_operations\x20(permission\x20add\x20perm\x20by\x20entity,\x20indexes\x20358-364)','failure_if_skipped':'358-364\x20stay\x20creator-admin-only\x20—\x20the\x20named\x20arbitrator\x20cannot\x20vote/rule/confirm,\x20and\x20the\x20customer\x27s\x20vote\x20collapses\x20to\x20admin-only\x20(E-13),\x20dead-locking\x20the\x20first\x20dispute'}),d['push']({'order':d['length']+0x1,'id':'voting_guard_roster_bind','title':'Bind\x20a\x20roster/party\x20voting_guard\x20(default;\x20TRIAGE-261109\x20item\x20D)','when':'After\x20the\x20Arbitration\x20is\x20activated,\x20BEFORE\x20the\x20first\x20dispute\x20can\x20be\x20voted\x20on','action':'Bind\x20a\x20guard-weighted\x20voter\x20universe,\x20roster-first:\x20tpl_voting_guard_party_only\x20(dispute\x20parties\x20—\x20buyer\x20via\x20order.owner\x20+\x20arb.order\x20case\x20pin,\x20plus\x20the\x20venue\x20panel\x20address\x20list)\x20or\x20tpl_voting_guard_numeric_weight\x20(staff\x20roster\x20with\x20explicit\x20weights).\x20Choose\x20tpl_voting_guard_open_vote\x20(always-true,\x20one\x20passport\x20one\x20vote)\x20ONLY\x20for\x20a\x20deliberately\x20PUBLIC\x20venue\x20—\x20declare\x20the\x20open\x20venue\x20in\x20the\x20service\x20description','tool_hint':'onchain_operations\x20(guard\x20creation\x20+\x20arbitration\x20voting_guard\x20set,\x20op=\x27set\x27)','failure_if_skipped':'an\x20EMPTY\x20voting_guard\x20dead-locks\x20every\x20plain\x20vote\x20on\x20permission\x20358\x20(creator-admin\x20only)\x20—\x20the\x20first\x20dispute\x20cannot\x20reach\x20a\x20verdict\x20if\x20the\x20admin\x20is\x20unresponsive\x20(crs9-F-36,\x20R-ARB-VOTE-LOCK)'})),a['edges']['some'](f=>f['relation']==='has_order_allocators')&&d['push']({'order':d['length']+0x1,'id':'settlement_alloc_by_guard','title':'Fire\x20settlement\x20via\x20alloc_by_guard\x20(keeper\x20or\x20merchant\x20step)','when':'Recurring\x20—\x20after\x20EACH\x20order\x20reaches\x20its\x20settlement\x20terminal\x20node\x20(declare\x20which\x20node\x20unlocks\x20settlement)','action':'Call\x20alloc_by_guard\x20on\x20the\x20order\x27s\x20allocation\x20with\x20the\x20settlement\x20Guard;\x20reaching\x20the\x20Machine\x20node\x20alone\x20does\x20NOT\x20settle\x20(allocation_state\x20stays\x20pending)','tool_hint':'onchain_operations\x20(allocation.alloc_by_guard);\x20schedule\x20as\x20a\x20keeper\x20step','failure_if_skipped':'orders\x20stall\x20at\x20the\x20settle\x20node\x20with\x20funds\x20locked\x20in\x20escrow\x20(testnet\x20lesson\x20R-2)'}),d['push']({'order':d['length']+0x1,'id':'verify_service_panorama','title':'Verify\x20the\x20on-chain\x20state\x20matches\x20the\x20plan','when':'After\x20all\x20creation\x20steps\x20and\x20the\x20steps\x20above\x20are\x20done','action':'Run\x20the\x20service\x20panorama\x20query\x20and\x20diff\x20it\x20against\x20this\x20plan\x27s\x20blueprint/creation_plan','tool_hint':'query_toolkit\x20query_type=\x27service_panorama\x27','failure_if_skipped':'plan/chain\x20drift\x20(missing\x20binding,\x20wrong\x20allocator\x20order)\x20stays\x20undetected\x20until\x20an\x20order\x20hits\x20it'}),d;}function buildCreationPlan(a){const b=[],c=new Map(a['nodes']['map'](j=>[j['id'],j])),f=new Map();for(const j of a['nodes'])f['set'](j['id'],new Set());for(const k of a['edges']){if(!f['has'](k['from'])||!c['has'](k['to']))continue;const l=relationDirection(k['relation'])==='to_depends_on_from',m=l?k['to']:k['from'],o=l?k['from']:k['to'];if(m===o||!f['has'](m))continue;f['get'](m)['add'](o);}for(const p of a['nodes']){for(const q of Object['values'](p['config'])){q['type']==='address_ref'&&q['targetId']!==p['id']&&f['has'](q['targetId'])&&f['get'](p['id'])['add'](q['targetId']);}}{const r=GUARD_AFTER_SERVICE_DRAFT,s=a['nodes']['filter'](t=>t['type']===r['provider'])['map'](t=>t['id']);if(s['length']>0x0)for(const t of a['nodes']){if(t['type']!==r['dependent'])continue;const u=f['get'](t['id']);if(u===undefined)continue;for(const v of s)u['add'](v);}}const g=new Map([...f]['map'](([w,x])=>[w,[...x]])),h=[],i=new Map(f);while(i['size']>0x0){const w=[...i['entries']()]['filter'](([,x])=>x['size']===0x0)['map'](([x])=>x);if(w['length']===0x0){h['push'](...i['keys']());break;}w['sort']();for(const x of w){h['push'](x),i['delete'](x);for(const y of i['values']())y['delete'](x);}}return h['forEach']((z,A)=>{const B=c['get'](z),C=B['config']['name'],D=C?.['type']==='string'?C['value']:z,E=D['includes']('/')?D['replaceAll']('/','__'):D,F=z==='arbitration'?'Create\x20'+B['type']+'\x20via\x20onchain_operations\x20WITH\x20pause:false\x20(creation-time\x20activation),\x20then\x20configure.\x20Purpose:\x20'+B['purpose']:'Create\x20'+B['type']+'\x20via\x20onchain_operations,\x20then\x20configure.\x20Purpose:\x20'+B['purpose'];b['push']({'order':A+0x1,'node_id':z,'object_type':B['type'],'suggested_name':E,'depends_on':g['get'](z)??[],'operation_hint':F});}),b;}function resolveTemplate(a,b){if(!a)return undefined;const c=getTemplate(a);if(c)return c;const d=getTemplatesByIndustry(a);if(b){const f=b['toLowerCase'](),g=d['filter'](h=>{const i=String(h['product_ref']??'')['trim']()['toLowerCase']();return i['length']>0x0&&f['includes'](i);});if(g['length']===0x1)return g[0x0];}const e=getScenarioMode(a)?.['default_template'];if(e){const h=getTemplate(e);if(h)return h;}if(d['length']>0x0)return d[0x0];return undefined;}export const GAS_PER_ORDER_SMALLEST=0x5b8d80;export const MIN_ECONOMIC_ORDER_SMALLEST=0x2faf080;const GAS_RATIO_WARN_THRESHOLD=0.1,wow=a=>Number((a/0x3b9aca00)['toFixed'](0x6))+'\x20WOW';export function gasEconomicsWarnings(a,b){const c=[],d=(a??[])['map'](j=>Number(j?.['price']))['filter'](j=>Number['isFinite'](j)&&j>0x0);if(d['length']===0x0)return c;const e=Math['min'](...d),f=Number(b),g=Number['isFinite'](f)&&f>0x0?f:0x0,h=g+GAS_PER_ORDER_SMALLEST,i=h/e;if(e<MIN_ECONOMIC_ORDER_SMALLEST)c['push']('GAS\x20ECONOMY\x20(ddmc4\x20B-39\x20/\x20ks7\x20A-10):\x20the\x20cheapest\x20SKU\x20is\x20'+wow(e)+'\x20—\x20below\x20the\x20≈'+wow(MIN_ECONOMIC_ORDER_SMALLEST)+'\x20minimum\x20ECONOMIC\x20per-order\x20price.\x20'+('Measured\x20settlement\x20gas\x20is\x20≈'+wow(GAS_PER_ORDER_SMALLEST)+'\x20per\x20transaction')+(g>0x0?',\x20plus\x20'+wow(g)+'\x20cashback\x20per\x20claim':'')+('\x20—\x20per-order\x20overhead\x20≈'+wow(h)+'\x20('+Math['round'](i*0x64)+'%\x20of\x20this\x20SKU).\x20')+'Micro-priced\x20SKUs\x20lose\x20their\x20entire\x20margin\x20to\x20gas:\x20raise\x20the\x20price,\x20drop\x20the\x20per-claim\x20cashback,\x20or\x20batch\x20settlements.');else i>GAS_RATIO_WARN_THRESHOLD&&c['push']('GAS\x20ECONOMY\x20(ks7\x20A-10):\x20cashback\x20+\x20settlement\x20gas\x20≈'+wow(h)+'\x20per\x20order\x20is\x20'+Math['round'](i*0x64)+'%\x20of\x20the\x20cheapest\x20SKU\x20('+wow(e)+')\x20—\x20above\x20the\x2010%\x20warning\x20line.\x20'+'Trim\x20the\x20per-claim\x20cashback\x20or\x20raise\x20the\x20price.');return c;}export async function handleMerchantGuide(a){const b=a['guide_state']??{'intent_text':''},d=a['guide_confirm']??{},e={'intent_text':(a['intent']??b['intent_text']??'')['trim'](),'confirmed_industry':d['industry']??b['confirmed_industry'],'currency':d['currency']??b['currency'],'deliverables':d['deliverables']??b['deliverables'],'payment_override':d['payment']??b['payment_override'],'trust_override':d['trust']??b['trust_override'],'adopted_module_ids':d['adopted_module_ids']??b['adopted_module_ids'],'guard_resolutions':{...b['guard_resolutions']??{},...d['guard_resolutions']??{}},'review_mode':d['review_mode']??b['review_mode'],'reward_funding':d['reward_funding']??b['reward_funding'],'reward_claim_amount':d['reward_claim_amount']??b['reward_claim_amount'],'reward_claim_opens_after_days':d['reward_claim_opens_after_days']??b['reward_claim_opens_after_days'],'reward_claim_closes_after_days':d['reward_claim_closes_after_days']??b['reward_claim_closes_after_days'],'reward_rating_floor':d['reward_rating_floor']??b['reward_rating_floor'],'arbitration_vote_policy':d['arbitration_vote_policy']??b['arbitration_vote_policy'],'experience_compensation_mode':d['experience_compensation_mode']??b['experience_compensation_mode'],'experience_pool_funding':d['experience_pool_funding']??b['experience_pool_funding'],'compensation_fund':d['compensation_fund']??b['compensation_fund'],'after_sales_mode':d['after_sales_mode']??b['after_sales_mode'],'acceptance_mode':d['acceptance_mode']??b['acceptance_mode'],'installment_mode':d['installment_mode']??b['installment_mode'],'affiliate_mode':d['affiliate_mode']??b['affiliate_mode'],'crowdfunding_mode':d['crowdfunding_mode']??b['crowdfunding_mode'],'logistics_mode':d['logistics_mode']??b['logistics_mode'],'supply_chain':d['supply_chain']??b['supply_chain'],'sales':d['sales']??b['sales'],'fee_overrides':{...b['fee_overrides']??{},...d['fee_overrides']??{}}};for(const W of Object['keys'](e)){if(e[W]===undefined)delete e[W];}if(e['guard_resolutions']&&Object['keys'](e['guard_resolutions'])['length']===0x0)delete e['guard_resolutions'];if(!e['intent_text'])throw new Error('merchant_guide\x20requires\x20\x27intent\x27\x20(business\x20description)\x20for\x20Step\x201.\x20'+'Example:\x20intent=\x27I\x20want\x20to\x20offer\x20online\x20design\x20service\x20with\x20milestone\x20payments\x27.\x20'+'Pass\x20the\x20returned\x20guide_state\x20back\x20UNCHANGED\x20on\x20subsequent\x20calls,\x20plus\x20guide_confirm\x20for\x20merchant\x20decisions.');const f=await analyzeIntent(e['intent_text'],{'preferredIndustry':e['confirmed_industry'],'currency':e['currency']});if(!e['confirmed_industry'])return{'action':'merchant_guide','current_step':0x2,'step_name':'Industry\x20Matching','guide_state':e,'intent_draft':f['intent'],'industry_options':{'inferred':f['inferredIndustry'],'confidence':f['industryConfidence'],'similar':f['similarIndustries']},'warnings':f['warnings'],'next_action':'Confirm\x20the\x20industry\x20by\x20calling\x20merchant_guide\x20again\x20with\x20guide_state\x20(UNCHANGED)\x20'+('plus\x20guide_confirm={\x20industry:\x20\x27<one\x20of:\x20'+f['similarIndustries']['join'](',\x20')+'\x20—\x20or\x20any\x20other\x20industry\x20id>\x27\x20}')};const g={...f['intent'],'industry':e['confirmed_industry'],'deliverables':e['deliverables']??f['intent']['deliverables'],'payment':{...f['intent']['payment'],...e['payment_override']??{}},'trust':{...f['intent']['trust'],...e['trust_override']??{}}},h=!!e['adopted_module_ids'],i=e['adopted_module_ids']?e['adopted_module_ids']['map'](X=>getCapability(X))['filter'](X=>!!X):recommendCapabilities(e['confirmed_industry'],e['intent_text'],{'maxCapabilities':0x5}),j=a['template_override']??resolveTemplate(e['confirmed_industry'],e['intent_text']);if(!j)throw new Error('No\x20compilable\x20template\x20found\x20for\x20industry\x20\x27'+e['confirmed_industry']+'\x27.\x20'+'Register\x20a\x20template\x20via\x20industry_pack_operation\x20or\x20pass\x20template_override\x20explicitly.');const l=resolveUserInputQuestions(j),m=e['fee_overrides']?.[PRODUCT_DETAIL_SOURCE_KEY]??j?.['fee_params']?.[PRODUCT_DETAIL_SOURCE_KEY],n=await resolveProductDetailSource(m,e['sales']);if(n['enriched']['length']>0x0&&Array['isArray'](e['sales'])&&e['sales']['length']>0x0){const X=new Map(n['enriched']['map'](Y=>[Y['sku'],Y]));e['sales']=e['sales']['map'](Y=>{if(Y===null||typeof Y!=='object')return Y;const Z=X['get'](String(Y['name']??''));return Z===undefined?Y:{...Y,'wip':Z['wip'],'wip_hash':Z['wip_hash']};});}const o={'currency':e['currency']??g['payment']['currency'],...e['payment_override']?{'payment':e['payment_override']}:{},...e['trust_override']?{'trust':e['trust_override']}:{},...e['deliverables']?{'deliverables':e['deliverables']}:{},...e['adopted_module_ids']?{'adopted_module_ids':e['adopted_module_ids']}:{},...e['review_mode']?{'review_mode':e['review_mode']}:{},...e['reward_funding']!==undefined?{'reward_funding':e['reward_funding']}:{},...e['reward_claim_amount']!==undefined?{'reward_claim_amount':e['reward_claim_amount']}:{},...e['reward_claim_opens_after_days']!==undefined?{'reward_claim_opens_after_days':e['reward_claim_opens_after_days']}:{},...e['reward_claim_closes_after_days']!==undefined?{'reward_claim_closes_after_days':e['reward_claim_closes_after_days']}:{},...e['reward_rating_floor']!==undefined?{'reward_rating_floor':e['reward_rating_floor']}:{},...e['arbitration_vote_policy']!==undefined?{'arbitration_vote_policy':e['arbitration_vote_policy']}:{},...e['experience_compensation_mode']?{'experience_compensation_mode':e['experience_compensation_mode']}:{},...e['experience_pool_funding']!==undefined?{'experience_pool_funding':e['experience_pool_funding']}:{},...e['compensation_fund']!==undefined?{'compensation_fund':e['compensation_fund']}:{},...e['after_sales_mode']?{'after_sales_mode':e['after_sales_mode']}:{},...e['acceptance_mode']?{'acceptance_mode':e['acceptance_mode']}:{},...e['installment_mode']?{'installment_mode':e['installment_mode']}:{},...e['affiliate_mode']?{'affiliate_mode':e['affiliate_mode']}:{},...e['crowdfunding_mode']?{'crowdfunding_mode':e['crowdfunding_mode']}:{},...e['logistics_mode']?{'logistics_mode':e['logistics_mode']}:{},...e['sales']?.['length']?{'sales':e['sales']}:{},...e['fee_overrides']??{}},p={};Object['assign'](p,e['guard_resolutions']??{});const q=compileTemplate(j,o,{'nameBase':a['name_base']??j['id'],'intent':e['intent_text'],'guardResolutions':p,'buildTimeMs':Date['now'](),...e['supply_chain']!==undefined&&e['supply_chain']['length']>0x0?{'supplyChain':e['supply_chain']}:{}}),r=reflux(q['plan']),s=r['plan'],t=r['audit'],u=auditScore(t),w=planBlueprint(s,g,i['map'](Y=>Y['id'])),x=q['blockers']['map'](Y=>({'module':'template','missing_constraints':[Y['code']],'fix':Y['detail']})),y=derivePlanSatisfiedConstraints(w,g),z={'paymentModel':e['payment_override']?.['model'],'trustArbitration':e['trust_override']?.['arbitration'],'trustRefundPolicy':e['trust_override']?.['refundPolicy'],'proofsOfDelivery':e['deliverables']?.['map'](Y=>Y['proofOfDelivery']),'allocationCount':e['payment_override']?.['allocation']?.['length']},A=i['map'](Y=>{const Z=capabilityIntentEvidence(Y,e['intent_text'],z);return checkCapabilityConstraints(Y,y,{'evidenceMatched':h||Z['matched'],'evidence':Z});}),B=j['compensation_fund_policy']==='forbidden',C=deriveDeployTimeChecks(w,B),D=derivePostDeploySteps(w,B,s['steps']['some'](Y=>Y['op']==='configure'&&Y['id']==='service_compensation'&&Y['method']==='compensation_fund_add')),E=w['edges']['some'](Y=>Y['relation']==='has_order_allocators')?recipientDesignGuidance()['map'](Y=>({'id':Y['id'],'move_recipient':Y['move_recipient'],'semantics':Y['semantics'],'required_constraints':Y['required_constraints'],'finding_if_unmet':Y['finding_if_unmet']})):undefined,F=t['findings']['filter'](Y=>Y['level']==='critical'||Y['level']==='high')['map'](Y=>({'module':'audit','missing_constraints':[Y['rule_id']],'fix':Y['title']+'\x20—\x20'+(Y['mitigation']??Y['description'])})),G=[{'re':/allocat|refund|recover|claimed_by|settle|escrow/i,'scene':'service_order_allocators_guard'},{'re':/\bbuy\b|purchase|allowlist|blocklist/i,'scene':'service_buy_guard'},{'re':/reward/i,'scene':'reward_claim'},{'re':/write_guard|repository_write/i,'scene':'repository_write_guard'},{'re':/arbitrat|ruling|voting/i,'scene':'arbitration_usage_guard'},{'re':/forward|node|witness|deliver|review|cancel|expire|submission|progress/i,'scene':'machine_forward_guard'}],H=[{'re':/claimed_by\s*some\s*==\s*true/i,'tpl':'tpl_allocator_node_gate_recover'},{'re':/claimed_by\s*some\s*==\s*false|claimed_by\s*(?:is\s+)?none|\brefund|\bcancel/i,'tpl':'tpl_allocator_node_gate_refund'},{'re':/claimed_by\s*some|\brecover|\baward/i,'tpl':'tpl_allocator_node_gate_recover'}],I=[{'host':'machine','re':/pattern\.time_lock_progress/i,'tpl':'tpl_time_lock_progress'},{'host':'machine','re':/pattern\.time_window_upper_bound/i,'tpl':'tpl_time_window_upper'},{'host':'reward','re':/pattern\./i,'tpl':'tpl_reward_one_time_claim'}],J=(Y,Z,a0,a1,a2)=>{let a3;const a4=/tpl_[a-z0-9_]+/['exec'](Y+'\x20'+Z),a5=a1==='machine'||a1==='machine_forward'?'machine_forward_guard':a1==='reward'?'reward_claim':a1==='repository'?'repository_write_guard':a1==='arbitration'?'arbitration_usage_guard':undefined;if(a4!==null){const aa=GUARD_TEMPLATES['find'](ab=>ab['id']===a4[0x0])?.['scene_id'];aa!==undefined&&(a5===undefined||aa===a5||aa==='service_order_allocators_guard'&&a1!=='reward')&&(a3=aa);}a3===undefined&&a1!=='reward'&&!I['some'](ab=>ab['host']===(a1==='machine_forward'?'machine':a1)&&ab['re']['test'](Y))&&/\ballocators?\b|claimed_by|guard_identifier|order_allocators/i['test'](Z)&&(a3='service_order_allocators_guard');if(a3===undefined){if(a5!==undefined)a3=a5;else{const ab=G['find'](ac=>ac['re']['test'](Y+'\x20'+Z));a3=ab?.['scene'];}}if(a3===undefined)return undefined;const a6=getTemplatesByScene(a3);let a7=a0!==undefined&&a6['some'](ac=>ac['applicable_industries']['includes'](a0))?a6['filter'](ac=>ac['applicable_industries']['includes'](a0)):a6;if(/\btime[_-]?lock|\bwindow|\btimeout|\bduration|\bdeadline|\bdays?\b|\bclock|\bdelay/i['test'](Y+'\x20'+Z)){const ac=a7['filter'](ad=>JSON['stringify'](ad['example_root']??{})['toLowerCase']()['includes']('clock'));if(ac['length']===0x0)return undefined;a7=ac;}if(a2['length']>0x0){const ad=a4!==null?a7['find'](af=>af['id']===a4[0x0]):undefined,ae=a7['filter'](af=>{const ag=[];if(af['example_root']!==undefined){const ah=JSON['stringify'](af['example_root']);for(const ai of ah['matchAll'](/"query":"([^"]+)"/g))ag['push'](ai[0x1]);if(ah['includes']('\x22type\x22:\x22query_progress_history_time\x22'))ag['push']('progress.history.time');if(ah['includes']('\x22type\x22:\x22query_progress_history_find\x22'))ag['push']('progress.history.find');}return ag['some'](aj=>a2['some'](ak=>aj===ak||aj['startsWith'](ak)||ak['startsWith'](aj)));});if(ad!==undefined&&!ae['includes'](ad))ae['push'](ad);if(ae['length']===0x0)return undefined;a7=ae;}const a8=a1==='machine_forward'?'machine':a1,a9=I['find'](af=>af['host']===a8&&af['re']['test'](Y+'\x20'+Z)&&a7['some'](ag=>ag['id']===af['tpl']));a9!==undefined&&(a7=[...a7]['sort']((af,ag)=>(af['id']===a9['tpl']?0x0:0x1)-(ag['id']===a9['tpl']?0x0:0x1)));if(a3==='service_order_allocators_guard'){const af=H['find'](ag=>ag['re']['test'](Y+'\x20'+Z));af!==undefined&&(a7=[...a7]['sort']((ag,ah)=>(ag['id']===af['tpl']?0x0:0x1)-(ah['id']===af['tpl']?0x0:0x1)));}return a7['slice'](0x0,0x3)['map'](ag=>({'template_id':ag['id'],'name':ag['name'],'parameters':ag['parameters']['map'](ah=>({'name':ah['name'],'required':ah['required'],...ah['default']!==undefined?{'default':ah['default']}:{},'description':ah['description']}))}));},K=[],L=guardMountCensus(j,o),M=q['unresolved']['map'](Y=>{const Z=getGuardDesignPattern(Y['template_id']),a0=J(Y['template_id'],Y['purpose'],j?.['industry'],Y['host'],Z?.['key_queries']??[]),a1=new Map((j?.['allocator']['rows']??[])['filter'](a9=>typeof a9['guard_key']==='string')['map'](a9=>[a9['guard_key'],a9])),a2=a1['get'](Y['key']),a3=a2!==undefined&&!L['edgeKeys']['has'](Y['key']),a4=!L['edgeKeys']['has'](Y['key'])&&!L['railKeys']['has'](Y['key'])&&!L['policyKeys']['has'](Y['key'])&&Y['host']!=='reward'&&!(Y['host']==='service'&&Y['key']==='buy'),a5=Y['host']==='service'&&Y['key']==='buy';if(!a4&&!a5)K['push'](Y['key']);const a6=Y['key']['toLowerCase'](),a7=(Y['purpose']??'')['toLowerCase'](),a8=/recover|award/['test'](a6)||!/refund/['test'](a6)&&/recover|award/['test'](a7)?'NODE\x20GATE\x20REQUIRED\x20(the\x20sketch\x20above\x20omits\x20it):\x20this\x20recovery\x20rail\x20is\x20a\x20terminal-node-gated\x20sweep\x20—\x20resolve\x20the\x20gate\x20to\x20fire\x20only\x20when\x20the\x20order\x20has\x20reached\x20the\x20recovery\x20terminal\x20nodes\x20(tpl_allocator_node_gate_recover\x20family\x20carries\x20the\x20node-gate\x20slot\x20set;\x20NEVER\x20slot\x20254).\x20NEVER\x20add\x20an\x20order.claimed_by\x20leg:\x20fund\x20rails\x20never\x20read\x20the\x20claimed_by\x20axis\x20(decision\x2011,\x20R-FUND-RAIL-CLAIMED-BY\x20/\x20RAIL_CLAIMED_BY_LEG\x20critical).':/refund/['test'](a6)||!/recover|award/['test'](a6)&&/refund/['test'](a7)?'NODE\x20GATE\x20REQUIRED\x20(the\x20sketch\x20above\x20omits\x20it):\x20this\x20refund\x20rail\x20may\x20only\x20fire\x20at\x20its\x20refund\x20terminal\x20node\x20—\x20resolve\x20the\x20gate\x20against\x20order\x20node\x20state,\x20never\x20against\x20order.claimed_by\x20(fund\x20rails\x20NEVER\x20read\x20the\x20claimed_by\x20axis;\x20decision\x2011,\x20R-FUND-RAIL-CLAIMED-BY\x20/\x20RAIL_CLAIMED_BY_LEG\x20critical).\x20The\x20arbitration\x20award\x20is\x20the\x20indemnity\x20track\x27s\x20separate\x20commercial\x20payout\x20—\x20any\x20refund/award\x20overlap\x20is\x20legal\x20and\x20disclosed\x20at\x20the\x20MCP\x20dual-payout\x20confirmation\x20gate.':undefined;return{'key':Y['key'],'template_id':Y['template_id'],'host':Y['host'],'purpose':Y['purpose'],'bound':!a4&&!a5,'resolution_required':!a4||a5||j!==undefined&&lookupBinding(Y,j)!==undefined,...!(a4&&!a5)||j!==undefined&&lookupBinding(Y,j)!==undefined?{}:{'advisory_note':'ADVISORY\x20ONLY\x20—\x20nothing\x20binds\x20this\x20design\x20and\x20the\x20plan\x20ships\x20WITHOUT\x20it.\x20NO\x20resolution\x20needed\x20unless\x20you\x20WANT\x20the\x20gate;\x20add\x20guide_confirm.guard_resolutions[\x27'+Y['key']+'\x27]\x20only\x20then\x20(algr12\x20M-14).'},...Z?.['logic_summary']?{'logic_summary':Z['logic_summary']}:{},...a8?{'logic_summary_note':a8}:{},...Z?.['key_queries']?.['length']?{'key_queries':Z['key_queries']}:{},...a0!==undefined&&a0['length']>0x0?{'suggested_templates':a0}:{},'how_to_resolve':'guide_confirm.guard_resolutions[\x27'+Y['key']+'\x27]\x20=\x20{\x20kind:\x20\x27inline\x27,\x20table,\x20root\x20}\x20(a\x20resolved\x20Guard),\x20'+'or\x20{\x20kind:\x20\x27template\x27,\x20template_id:\x20\x27tpl_*\x27,\x20params\x20}\x20when\x20a\x20guard\x20template\x20matches\x20this\x20design'+(a0!==undefined&&a0['length']>0x0?'\x20(suggested_templates\x20below\x20list\x20the\x20matching\x20executable\x20forms\x20and\x20their\x20parameters)':'.')+(Y['host']==='machine'&&!a3?'\x20MACHINE-HOST\x20REQUIREMENT:\x20the\x20inline\x20table\x20MUST\x20declare\x20the\x20protocol\x20task-binding\x20slot\x20'+'{\x20identifier:\x20254,\x20b_submission:\x20true,\x20value_type:\x20\x22Address\x22\x20}\x20—\x20the\x20forward\x27s\x20passport\x20only\x20emits\x20'+'DECLARED\x20slots,\x20so\x20a\x20machine-forward\x20guard\x20without\x20this\x20row\x20aborts\x20EVERY\x20order-bound\x20forward\x20'+'it\x20gates\x20(code\x2011)\x20and\x20the\x20pre-publish\x20gate\x20blocks\x20the\x20Machine\x20publish.':'')+(a3?'\x20ALLOCATOR-RAIL\x20NOTE:\x20this\x20design\x20gates\x20an\x20allocator\x20rail\x20(not\x20a\x20machine\x20forward)\x20—\x20do\x20NOT\x20add\x20the\x20'+'254\x20task-binding\x20slot:\x20a\x20254\x20declaration\x20arms\x20once-per-order\x20replay\x20protection\x20at\x20alloc\x20time\x20'+'(allocation\x20ONCE_FOR_OBJECT)\x20and\x20permanently\x20blocks\x20multi-fire\x20rails\x20(a\x20second\x20release\x20aborts\x20'+'E_ONCE_TRIGGERED).\x20The\x20kernel\x20injects\x20254\x20ONLY\x20for\x20GuardIdentifier(254)-recipient\x20rails.'+(a2['recipient']==='guard_identifier'&&a2['recipient_key']!=='254'?'\x20This\x20rail\x27s\x20recipient\x20is\x20GuardIdentifier('+(a2['recipient_key']??'0')+')\x20—\x20the\x20inline\x20table\x20MUST\x20'+('declare\x20slot\x20'+(a2['recipient_key']??'0')+'\x20as\x20an\x20Address\x20submission\x20instead\x20(N-K21:\x20the\x20passport\x20')+'submits\x20the\x20ORDER\x20address\x20into\x20it;\x20an\x20undeclared\x20slot\x20makes\x20the\x20rail\x20unexecutable).':''):'')+(a4?'\x20ADVISORY\x20DESIGN\x20(run75747\x20F-38):\x20nothing\x20in\x20this\x20archetype\x20binds\x20this\x20key\x20—\x20no\x20machine\x20edge,\x20allocator\x20'+'rail,\x20repository\x20policy,\x20or\x20service\x20mount.\x20If\x20this\x20design\x20does\x20not\x20apply\x20to\x20your\x20shop\x20you\x20may\x20resolve\x20'+'it\x20with\x20{\x20kind:\x20\x27omit\x27\x20}\x20instead\x20of\x20building\x20a\x20Guard\x20no\x20one\x20consumes:\x20the\x20design\x20leaves\x20'+'pending_guard_designs,\x20no\x20Guard\x20object\x20is\x20created,\x20and\x20the\x20decision\x20is\x20recorded\x20in\x20the\x20build\x27s\x20'+'warnings.\x20An\x20omit\x20of\x20a\x20BOUND\x20design\x20is\x20refused\x20(GUARD_OMIT_UNSUPPORTED).':'')};}),N=x['length']>0x0||t['blocking'],O={'expiredTerminal':(j['machine_shape']??[])['some'](Y=>/expire|deadline|timeout/i['test'](String(Y?.['name']??'')))},P=checkGameTheoryConstraints(w,g,O),Q=[];for(const Y of requirementCoverage(e['intent_text'],j)){if(Y['status']==='mapped')continue;Q['push']({'id':Y['family'],'label':Y['label'],'severity':Y['status']==='blocker'&&Y['family']==='fulfillment'?'critical':'medium','message':'Intent\x20promises\x20\x27'+Y['label']+'\x27\x20(stated:\x20\x22'+Y['evidence']+'\x22)\x20but\x20the\x20matched\x20template\x20does\x20not\x20carry\x20it:\x20'+Y['note'],'fix':Y['note']});}for(const Z of A){if(Z['adopted']||Z['evidence_matched']!==![])continue;Q['push']({'id':'module_'+Z['capability'],'label':Z['capability'],'severity':'info','message':'Module\x20\x27'+Z['capability']+'\x27\x20rides\x20score\x20alone\x20(no\x20intent\x20evidence):\x20its\x20objects\x20ARE\x20included\x20in\x20this\x20build\x20—\x20an\x20UNCONFIRMED\x20adoption.','fix':'Confirm\x20via\x20guide_state.adopted_module_ids,\x20answer\x20the\x20structured\x20payment/trust\x20questions,\x20or\x20rebuild\x20with\x20an\x20adoption\x20list\x20that\x20omits\x20it.'});}const R=assessWorkflowDesign(w,{'gaps':Q}),S=buildCreationPlan(w),T=[...new Set(s['steps']['filter'](a0=>typeof a0['account']==='string')['map'](a0=>a0['account']))]['sort'](),U=[...collectLateMarks(s)]['sort'](),V=j?{'name':j['id'],'display_name':j['variant']+'\x20archetype\x20('+j['industry']+')','source':a['template_override']?'custom':'builtin','risk_appetite':'medium','key_risk':j['key_risk'],'machine_shape':j['machine_shape']['map'](a0=>({'name':a0['name'],'role':a0['role'],...a0['operator']?{'operator':a0['operator']}:{},...a0['semantic_role']?{'semantic_role':a0['semantic_role']}:{}})),'guards':j['guards']['map'](a0=>({'template_id':a0['template_id'],'host':a0['host'],'purpose':a0['purpose']})),'allocator':j['allocator'],'risk_constraints':{},'build_notes':j['build_notes']??[],...j['time_anchors']?{'time_anchors':j['time_anchors']}:{}}:undefined;return{'action':'merchant_guide','current_step':N?0x9:0xa,'step_name':N?'Harness\x20Check\x20(issues\x20found)':'Submission\x20Plan\x20Ready','guide_state':{...e,'adopted_module_ids':i['map'](a0=>a0['id'])},'intent':{'intent_type':g['intent'],'industry':g['industry'],'roles':g['roles'],'deliverables':g['deliverables'],'payment':g['payment'],'trust':g['trust']},'adopted_modules':i['map'](a0=>({'id':a0['id'],'name':a0['name'],'description':a0['description'],'requires_keeper':a0['requiresKeeper'],'keeper_hint':a0['keeperHint'],'user_protections':a0['userProtections'],'merchant_obligations':a0['merchantObligations']})),'mode_prior':V,...l['length']>0x0?{'user_input_questions':l,'user_input_note':'Collect\x20each\x20answer\x20and\x20pass\x20it\x20back\x20as\x20guide_state.fee_overrides[\x27<param_key>\x27]\x20on\x20the\x20next\x20merchant_guide\x20call;\x20unanswered\x20questions\x20keep\x20the\x20template\x20default.'}:{},...V?.['time_anchors']?{'time_anchor_instructions':Object['entries'](V['time_anchors'])['map'](([a0,a1])=>{const a2=a1['startsWith']('order.time')?'\x20(order-creation\x20time\x20—\x20PRE-checkout\x20branches\x20only;\x20a\x20post-checkout\x20window\x20anchored\x20here\x20is\x20unreachable)':a1['startsWith']('progress.current_time')?'\x20(entry\x20time\x20of\x20the\x20window\x27s\x20source\x20node\x20—\x20witness-derived\x20via\x20OrderProgress,\x20one\x20Guard\x20serves\x20every\x20order)':a1['startsWith']('absolute_date')?'\x20(per-order\x20instance\x20Guard\x20—\x20the\x20absolute\x20date\x20differs\x20per\x20booking)':'';return'Time\x20windows\x20for\x20\x27'+a0+'\x27\x20anchor\x20to\x20'+a1+a2;})}:{},'blueprint':{'nodes':w['nodes']['map'](a0=>({'id':a0['id'],'type':a0['type'],'purpose':a0['purpose']})),'edges':w['edges']['map'](a0=>({'from':a0['from'],'to':a0['to'],'relation':a0['relation'],'required':a0['required']}))},'evaluation_preview':{'estimatedRiskScore':u,'estimatedCompletenessScore':Math['min'](0x64,0x1e+i['length']*0x8),'keyRisks':t['findings']['filter'](a0=>a0['level']==='critical'||a0['level']==='high')['map'](a0=>a0['title']),'strengths':t['findings']['filter'](a0=>a0['level']==='info')['map'](a0=>a0['title']),'moduleBoosts':{}},'graph_validation':{'valid':t['issues']['length']===0x0,'hard_violations':t['issues']['map'](a0=>({'id':a0['code'],'description':a0['detail'],'fix':'Fix\x20the\x20Plan\x20structure','step':a0['step']})),'soft_notes':t['findings']['filter'](a0=>a0['level']==='medium'||a0['level']==='low')['map'](a0=>({'id':a0['rule_id'],'description':a0['title']}))},'harness_check':{'module_constraints':A['map'](a0=>{const a1=a0['capability']==='discount_lifecycle'&&a0['adopted']?'ADOPTION-BASED\x20satisfaction\x20(disclosure\x20obligations\x20accepted\x20with\x20module\x20adoption),\x20NOT\x20plan\x20structure:\x20creation_plan\x20intentionally\x20carries\x20no\x20Discount/SKU\x20nodes\x20—\x20they\x20are\x20minted\x20in\x20merchant\x20post-deploy\x20steps\x20and\x20verified\x20on-chain\x20after\x20deploy\x20(query\x20the\x20minted\x20Service.discount).\x20Reward\x20FUNDING\x20rides\x20review_mode\x20compile\x20emission,\x20BUT\x20the\x20reward\x20claim\x20GUARD\x20SPEC\x20must\x20still\x20be\x20declared\x20in\x20the\x20plan\x27s\x20guards[]\x20(host:\x27reward\x27)\x20—\x20compile\x20emits\x20the\x20rail\x20only\x20from\x20that\x20spec,\x20and\x20REVIEW_REWARD_GUARD_MISSING\x20hard-blocks\x20publish\x20when\x20it\x20is\x20omitted\x20(G-02,\x20onlyfans-mn\x20261019:\x20the\x20old\x20prose\x20denied\x20the\x20guard\x20spec\x20and\x20deadlocked\x20every\x20reward\x20publish).':a0['reason'],a2=a0['evidence_matched']===![]?a0['reason']:a1;return{'module':a0['capability'],'plan_satisfied':a0['adopted'],'missing':a0['missingConstraints'],'reason':a2,'findings':a0['findings'],'evidence_matched':a0['evidence_matched']};}),'blocking_issues':[...x['map'](a0=>({'module':a0['module'],'missing_constraints':a0['missing_constraints'],'fix':a0['fix']})),...F],'module_gaps':A['filter'](a0=>!a0['adopted'])['map'](a0=>({'module':a0['capability'],'missing_constraints':a0['missingConstraints'],'fix':a0['reason']})),'deploy_time_checks':C,'recipient_design_guidance':E},'game_theory':{'summary':P['summary'],'coverage':P['coveredCount']+'/'+P['totalCount'],'exposed_scenarios':P['exposedScenarios'],'wow_alignments':P['wowAlignments'],'scenarios':P['results']['map'](a0=>({'scenario':a0['scenario'],'covered':a0['covered'],'conflict':a0['conflict'],'user_protection':a0['userProtection'],'evaluation_metric':a0['evaluationMetric'],'recommendation':a0['recommendation']}))},'workflow_design_assessment':{'score':R['score'],'summary':R['summary'],'findings':R['findings']['map'](a0=>({'kind':a0['kind'],'severity':a0['severity'],'message':a0['message'],'fix':a0['fix']})),'checks':R['checks']['map'](a0=>({'id':a0['id'],'dimension':a0['dimension'],'passed':a0['passed'],'severity':a0['severity'],'message':a0['message'],'fix':a0['fix']}))},'creation_plan':S,'post_deploy_steps':D,...q['supplyChain']!==undefined?{'supply_chain':q['supplyChain']['map'](a0=>({'steps':a0['steps']['map'](a1=>a1['id']),'inputs':a0['inputs'],'primitives':a0['primitives'],'notes':a0['notes'],...a0['handoff']!==undefined?{'handoff':a0['handoff']}:{}}))}:{},'mandatory_disclosures':['PII\x20discipline\x20(rex5\x20B-57):\x20never\x20write\x20personal\x20data\x20(phone,\x20email,\x20exact\x20unit\x20address)\x20into\x20public\x20on-chain\x20fields\x20—\x20Contact\x20description/location/IM\x20entries,\x20repository\x20rows,\x20progress\x20messages\x20and\x20WIP\x20text\x20are\x20all\x20public.\x20Exchange\x20PII\x20over\x20the\x20encrypted\x20Messenger\x20and\x20keep\x20only\x20WTS\x20proofs\x20on\x20chain;\x20the\x20local\x20harness\x20store\x20is\x20non-private\x20too\x20(cache.db\x20holds\x20messenger\x20plaintext\x20and\x20LocalInfo\x20entries\x20unencrypted\x20on\x20disk,\x20readable\x20by\x20any\x20session\x20sharing\x20the\x20keystore).','Trust-claim\x20prose\x20is\x20not\x20a\x20chain\x20anchor\x20(rex5\x20T-31):\x20any\x20compensation-fund\x20or\x20protection\x20figure\x20quoted\x20in\x20the\x20service\x20description\x20is\x20free\x20text\x20—\x20awards\x20shrink\x20the\x20live\x20fund\x20in\x20place\x20(the\x20quoted\x20number\x20silently\x20goes\x20stale)\x20and\x20the\x20per-order\x20covered\x20ceiling\x20is\x20fund/3\x20(MAX_INDEMNITY_MULTIPLE),\x20not\x20the\x20headline.\x20Keep\x20quoted\x20numbers\x20synced\x20to\x20the\x20live\x20fund\x20balance\x20before\x20publishing\x20and\x20after\x20every\x20award.','Single-account\x20build\x20contract\x20(MN5-5R\x20decision):\x20this\x20pipeline\x20wires\x20ONLY\x20the\x20deploying\x20account\x20—\x20the\x20permission\x20layer\x27s\x20admin\x20pass-through\x20means\x20a\x20single-account\x20build\x20needs\x20zero\x20grants,\x20so\x20no\x20other\x20account\x20is\x20ever\x20granted.\x20A\x20multi-account\x20shop\x20(separate\x20keeper/staff/operator\x20accounts)\x20will\x20be\x20REFUSED\x20at\x20execution\x20time\x20(error\x20codes\x201000/1002\x20and\x20the\x20350~364\x20abort\x20family)\x20—\x20the\x20plan\x20will\x20look\x20complete\x20and\x20still\x20fail\x20on\x20first\x20non-admin\x20operation.\x20Until\x20an\x20explicit\x20account-grant\x20phase\x20ships,\x20run\x20multi-account\x20shops\x20by\x20declaring\x20the\x20limitation\x20up\x20front\x20and\x20granting\x20roles\x20manually\x20post-publish;\x20do\x20not\x20let\x20the\x20plan\x27s\x20completeness\x20imply\x20multi-account\x20readiness.'],...M['length']>0x0?{'pending_guard_designs':M}:{},...M['length']>0x0&&(s['pending_guards']?.['length']??0x0)!==M['length']?{'pending_count_note':'Two\x20counts,\x20two\x20views:\x20pending_guard_designs\x20lists\x20'+M['length']+'\x20unresolved\x20design(s)\x20(compile\x20view\x20—\x20includes\x20advisory\x20designs\x20with\x20no\x20edge/rail/policy/buy\x20mount);\x20'+('the\x20plan\x20audit\x20counts\x20'+(s['pending_guards']?.['length']??0x0)+'\x20(plan\x20view\x20—\x20site-bound\x20designs\x20only;\x20the\x20rule-pack\x20titles\x20\x22of\x20N\x20pending\x20in\x20total\x22\x20quote\x20this).\x20')+'The\x20LIST\x20is\x20the\x20resolution\x20fill\x20space;\x20the\x20audit\x20number\x20is\x20its\x20site-bound\x20subset.'}:{},'warnings':[...f['warnings'],...gasEconomicsWarnings(e['sales'],e['reward_claim_amount']),...q['omitted']['length']>0x0?['Advisory\x20guard\x20design(s)\x20omitted\x20by\x20decision\x20({kind:\x27omit\x27}):\x20'+q['omitted']['join'](',\x20')+'\x20—\x20'+'no\x20Guard\x20created,\x20nothing\x20binds\x20them\x20(run75747\x20F-38).']:[],...(q['supplyChain']??[])['flatMap']((a0,a1)=>a0['notes']['map'](a2=>'Supply-chain\x20promise\x20#'+String(a1+0x1)+':\x20'+a2)),...n['warnings']],'next_action':x['length']>0x0?'Resolve\x20the\x20blocking_issues\x20above\x20(compile\x20blockers\x20—\x20harness_check.blocking_issues\x20rows\x20with\x20module\x20\x27template\x27;\x20adjust\x20the\x20template\x20or\x20its\x20build\x20inputs),\x20then\x20call\x20merchant_guide\x20again.':t['blocking']?'The\x20plan\x20audit\x20is\x20BLOCKING\x20(see\x20harness_check.blocking_issues\x20and\x20audit.findings\x20—\x20e.g.\x20a\x20terminal\x20node\x20with\x20no\x20fund\x20exit,\x20or\x20an\x20unresolved\x20guard\x20bound\x20to\x20a\x20fund\x20path).\x20Fix\x20the\x20plan/template\x20or\x20guard\x20resolutions\x20and\x20call\x20merchant_guide\x20again;\x20do\x20NOT\x20materialize\x20this\x20plan.'+(M['length']>0x0?'\x20Pending\x20guard\x20designs:\x20'+M['length']+'\x20listed\x20in\x20pending_guard_designs\x20—\x20resolve\x20each\x20via\x20guide_confirm.guard_resolutions\x20(kind\x20\x27inline\x27\x20with\x20the\x20Guard\x20table+root,\x20kind\x20\x27template\x27\x20with\x20a\x20tpl_*\x20id,\x20or\x20{kind:\x27omit\x27}\x20for\x20advisory\x20designs\x20that\x20do\x20not\x20apply\x20to\x20this\x20shop),\x20then\x20call\x20merchant_guide\x20again.':''):K['length']>0x0?'Plan\x20is\x20structurally\x20ready,\x20but\x20'+K['length']+'\x20bound\x20guard\x20design(s)\x20('+K['map'](a0=>'\x27'+a0+'\x27')['join'](',\x20')+')\x20are\x20UNRESOLVED\x20(plan.pending_guard_designs)\x20—\x20do\x20NOT\x20materialize\x20yet:\x20an\x20unresolved\x20bound\x20design\x20ships\x20a\x20guard\x20the\x20executor\x20invents.\x20Resolve\x20each\x20via\x20guide_confirm.guard_resolutions\x20(kind\x20\x27inline\x27\x20with\x20the\x20Guard\x20table+root,\x20kind\x20\x27template\x27\x20with\x20a\x20tpl_*\x20id,\x20or\x20{kind:\x27omit\x27}\x20for\x20advisory\x20designs\x20that\x20do\x20not\x20apply\x20to\x20this\x20shop),\x20then\x20call\x20merchant_guide\x20again.':'Plan\x20ready.\x20Materialize\x20in\x20ONE\x20deterministic\x20call:\x20benchmark_migration\x20{action:\x27plan_execute\x27,\x20plan:\x20this\x20response\x27s\x20plan\x20object\x20verbatim'+(T['length']>0x0?',\x20accounts:{'+T['map'](a0=>a0+':\x20<its\x20controller\x20env>')['join'](',\x20')+'}':'')+('}\x20—\x20it\x20pre-flights\x20the\x20freeze\x20gate,\x20bind-audits\x20every\x20reference,\x20pre-resolves\x20local\x20marks,\x20slices\x20on\x20timeout_ms,\x20and\x20RESUMES\x20from\x20failures\x20(completed_steps\x20+\x20previous_outputs;\x20never\x20re-run\x20from\x20scratch\x20—\x20ghost\x20duplicates).\x20Then\x20run\x20post_deploy_steps\x20in\x20order\x20('+D['map'](a0=>a0['id'])['join'](',\x20')+').\x20WIZARD\x20CONTRACT:\x20on\x20the\x20Service\x20publish\x20call\x20(data.publish=true),\x20pass\x20this\x20exact\x20plan\x20back\x20as\x20data.creation_plan\x20—\x20the\x20publish\x20gate\x20replays\x20its\x20freeze\x20matrix\x20and\x20rejects\x20the\x20publish\x20if\x20any\x20gate\x20fails;\x20omitting\x20it\x20leaves\x20the\x20manual\x20path\x20ungated.\x20Manual\x20fallback\x20(only\x20if\x20plan_execute\x20refuses):\x20create\x20the\x20objects\x20in\x20creation_plan\x20order\x20via\x20onchain_operations,\x20then\x20run\x20post_deploy_steps\x20in\x20order.'),'plan':((()=>{const a0=templateCatalogDigest(String(s['templateId']??''));return{...s,...a0!==undefined?{'template_digest':a0}:{},'catalog_version':BUILTIN_TEMPLATES_VERSION};})()),...U['length']>0x0?{'required_local_marks':U,'required_local_marks_note':'plan_execute\x20(the\x20default\x20materializer\x20above)\x20resolves\x20each\x20of\x20these\x20local\x20names\x20against\x20the\x20LocalMark\x20store\x20of\x20the\x20target\x20network\x20and\x20refuses\x20to\x20execute\x20while\x20any\x20is\x20unregistered.\x20'+'Register\x20them\x20BEFORE\x20executing\x20(local_mark_operation\x20add).\x20A\x20name\x20that\x20matches\x20an\x20object\x20this\x20plan\x20itself\x20creates\x20is\x20bound\x20to\x20that\x20object\x20automatically.\x20'+'A\x20recipient\x20mark\x20must\x20point\x20at\x20a\x20real\x20account\x20address:\x20an\x20empty\x20name\x20makes\x20the\x20SDK\x20substitute\x20the\x20deploying\x20account,\x20and\x20an\x20object-id\x20/\x20zero-address\x20recipient\x20is\x20transferred\x20and\x20cannot\x20be\x20retrieved.'}:{},...n['steps']['length']>0x0?{'wip_source_steps':n['steps'],'wip_source_steps_note':'Execute-time\x20obligations\x20created\x20by\x20fee_overrides[\x27product_detail_source\x27].\x20A\x20URL\x20source\x20binds\x20sale.wip\x20directly\x20(wip_hash\x20stays\x20\x22\x22\x20until\x20pinned\x20—\x20pin\x20via\x20wip_file\x20verify\x20+\x20sales.op:\x27wip_set\x27);\x20a\x20local\x20source\x20is\x20already\x20hash-pinned\x20at\x20generate\x20time\x20but\x20MUST\x20be\x20hosted\x20publicly\x20and\x20rebound\x20before\x20customers\x20can\x20buy.\x20Both\x20are\x20ordinary\x20onchain_operations\x20calls,\x20not\x20plan\x20steps\x20—\x20run\x20them\x20in\x20the\x20order\x20given.'}:{},'audit':{'issues':t['issues'],'findings':t['findings'],'blocking':t['blocking'],'score':u},'reflux':{'applied':r['applied'],'blocks':r['blocks'],'iterations':r['iterations']}};}
1
+ import{analyzeIntent}from'./intent-analyzer.js';import{compileTemplate}from'../../composition/compile.js';import{guardMountCensus}from'../../composition/guard-fill.js';import{reflux,auditScore}from'../../composition/reflux.js';import{planBlueprint}from'../../composition/blueprint-view.js';import{getGuardDesignPattern}from'../../knowledge/guard-design-patterns.js';import{lookupBinding}from'../../knowledge/guard-binding-table.js';import{GUARD_TEMPLATES,getTemplatesByScene}from'../../knowledge/guard-templates.js';import{GUARD_AFTER_SERVICE_DRAFT,relationDirection}from'../../knowledge/object-dependency.js';import{collectLateMarks}from'../../composition/plan.js';import{BUILTIN_TEMPLATES_VERSION}from'../../knowledge/builtin-templates.js';import{templateCatalogDigest}from'../../knowledge/template-loader.js';import{checkGameTheoryConstraints}from'./game-theory.js';import{assessWorkflowDesign}from'./workflow-design-assessment.js';import{getCapability,recommendCapabilities,checkCapabilityConstraints,capabilityIntentEvidence}from'../../extensions/capability.js';import{requirementCoverage}from'../../knowledge/requirement-families.js';import{recipientDesignGuidance}from'../../knowledge/recipient-constraint.js';import{getTemplate,getTemplatesByIndustry}from'../../knowledge/template-loader.js';import{resolveUserInputQuestions}from'../../knowledge/param-schema.js';import{PRODUCT_DETAIL_SOURCE_KEY,resolveProductDetailSource}from'../../knowledge/product-detail-source.js';import{getScenarioMode}from'../../knowledge/scenario-modes.js';function derivePlanSatisfiedConstraints(a,b){const c=new Set(),d=i=>a['edges']['some'](j=>j['relation']===i),e=i=>a['nodes']['some'](j=>j['id']===i),f=i=>a['nodes']['some'](j=>j['type']===i),g=i=>a['adoptedModules']['includes'](i);if(d('has_order_allocators'))c['add']('order_allocators_bound');if(d('uses_machine'))c['add']('machine_bound_before_publish');if(d('has_arbitration'))c['add']('arbitration_bound_to_service');if(e('machine'))c['add']('machine_published');if(e('repository'))c['add']('repository_published');if(e('service'))c['add']('service_published');e('permission_arb')&&e('permission')&&c['add']('arbitration_permission_independent');g('independent_arbitration')&&a['nodes']['some'](i=>i['id']['includes']('guard')&&i['id']['includes']('arbitration'))&&c['add']('voting_guard_configured');g('accept_timeout_protection')&&(c['add']('time_guard_configured'),c['add']('adminUnhold_permission'));g('milestone_escrow')&&f('guard')&&c['add']('milestone_forward_guarded');const h=d('has_order_allocators');if(h&&b['payment']['allocation']&&b['payment']['allocation']['length']>0x0){c['add']('allocators_configured');const i=b['payment']['allocation']['reduce']((k,l)=>k+l['percentage'],0x0);if(Math['abs'](i-0x64)<0.001)c['add']('sharing_sum_100');const j=b['payment']['allocation']['find'](k=>k['recipient']==='platform');if(!j||j['percentage']===0x0)c['add']('platform_fee_zero');g('supplier_collaboration')&&(c['add']('allocation_sharing_configured'),c['add']('demand_configured'));}g('wip_provenance')&&e('repository')&&c['add']('wip_hash_before_delivery');g('subscription_with_proof')&&e('repository')&&(c['add']('delivery_guard_per_cycle'),c['add']('repository_updated'));g('damage_attestation')&&(c['add']('pre_rental_hash'),c['add']('post_rental_hash'));g('refund_guarantee')&&(c['add']('compensation_fund_positive'),c['add']('refund_guard_configured'));if(g('praise_incentive')){const k=a['plan']['steps']['some'](m=>m['op']==='create'&&m['object']==='reward'),l=a['plan']['steps']['some'](m=>m['op']==='configure'&&m['method']==='coin_add');k&&l&&(c['add']('reward_pool_funded'),c['add']('reward_claim_replay_armed'));}g('discount_lifecycle')&&(c['add']('discount_budget_planned'),c['add']('discount_burn_disclosed'));if(g('after_sales_guarantee')){const m=a['plan']['steps']['find'](p=>p['op']==='create'&&p['object']==='machine'),n=m?.['params']?.['nodes']??[],o=n['some'](p=>/return|refund|exchange|replace|reship|swap|warranty|repair/i['test'](p['name']??''));o&&(c['add']('after_sales_rail_present'),c['add']('after_sales_rail_node_gated'),c['add']('after_sales_window_anchored'),c['add']('after_sales_no_double_remedy'));}if(g('acceptance_judging')){const p=a['plan']['steps']['find'](t=>t['op']==='create'&&t['object']==='machine'),q=p?.['params']?.['nodes']??[],r=q['map'](t=>t['name']??''),s=r['some'](t=>/accept|approv|award|ruling|place|placement|triage|vot|evaluat|winner|judge/i['test'](t));if(s){const t=r['some'](u=>/revis|redeliver|resubmit|rework/i['test'](u));c['add']('acceptance_race_free');if(e('arbitration'))c['add']('acceptance_judge_independent');if(!t||e('repository'))c['add']('acceptance_revision_bounded');}}if(g('installment_deposit')){const u=a['plan']['steps']['find'](z=>z['op']==='create'&&z['object']==='machine'),v=u?.['params']?.['nodes']??[],w=v['map'](z=>z['name']??''),x=w['some'](z=>/(deposit|down_?pay|balance_due|balance_owed|installment|milestone|awaiting|owed)/i['test'](z)),y=w['some'](z=>/(paid|funded|captured|settled)/i['test'](z));x&&y&&(c['add']('installment_funding_gated'),c['add']('installment_deposit_exit'),c['add']('installment_release_once'));}if(g('affiliate_commission')){const z=a['plan']['steps']['find'](D=>D['op']==='create'&&D['object']==='machine'),A=z?.['params']?.['nodes']??[],B=A['map'](D=>D['name']??''),C=B['some'](D=>/(commission|affiliate|referr|attribut|partner_?payout)/i['test'](D));C&&(c['add']('affiliate_rail_present'),c['add']('affiliate_clawback_disclosed'),c['add']('affiliate_window_anchored'));}if(g('crowdfunding')){const D=a['plan']['steps']['find'](H=>H['op']==='create'&&H['object']==='machine'),E=D?.['params']?.['nodes']??[],F=E['map'](H=>H['name']??''),G=F['some'](H=>/(releas|settle|funded|disburs|project)/i['test'](H));G&&(c['add']('crowdfunding_exit_rail_present'),c['add']('crowdfunding_aggregate_writer_bound'),c['add']('crowdfunding_disclosure_present'));}if(g('logistics_fulfillment')){const H=a['plan']['steps']['find'](L=>L['op']==='create'&&L['object']==='machine'),I=H?.['params']?.['nodes']??[],J=I['map'](L=>L['name']??''),K=J['some'](L=>/(dispatch|handover|hand_over|pickup|deliver|courier|rider|shipped)/i['test'](L));K&&(c['add']('logistics_rail_present'),c['add']('logistics_loss_covered'),c['add']('logistics_fee_independent'),c['add']('logistics_dispatch_disclosed'));}return c;}function deriveDeployTimeChecks(a,b=![]){const c=[];return a['nodes']['some'](d=>d['id']==='machine')&&c['push']('Machine\x20published\x20AND\x20bound\x20to\x20Service\x20BEFORE\x20Service.publish\x20(machine\x20is\x20immutable\x20after\x20publish)'),a['edges']['some'](d=>d['relation']==='has_order_allocators')&&(c['push']('Service.order_allocators\x20bound\x20(verify\x20via\x20query_objects\x20after\x20publish\x20—\x20order_allocators\x20is\x20FROZEN\x20at\x20publish)'),c['push']('Settlement\x20is\x20NOT\x20triggered\x20by\x20reaching\x20a\x20Machine\x20node\x20alone\x20—\x20an\x20explicit\x20alloc_by_guard\x20call\x20(keeper\x20or\x20merchant)\x20fires\x20the\x20settlement\x20Allocator\x20once\x20its\x20Guard\x20passes.\x20Declare\x20the\x20node->allocator\x20trigger\x20(which\x20terminal\x20node\x20unlocks\x20settlement)\x20and\x20schedule\x20the\x20keeper\x20step;\x20otherwise\x20orders\x20stall\x20at\x20the\x20settle\x20node\x20with\x20allocation_state=pending'),c['push']('ALLOCATOR\x20GUARD\x20DESIGN\x20—\x20hand-built\x20rails\x20(sahr\x20lesson):\x20BEFORE\x20writing\x20the\x20settlement\x20Guard,\x20map\x20the\x20host\x20object\x27s\x20RICH\x20STATES:\x20enumerate\x20the\x20Machine\x27s\x20terminal\x20nodes\x20(settlement\x20vs\x20refund\x20polarity),\x20the\x20mid-flight\x20states\x20a\x20claim\x20or\x20dispute\x20opens,\x20and\x20which\x20business\x20event\x20each\x20state\x20transition\x20represents;\x20the\x20allocator\x20gate\x20must\x20sit\x20at\x20exactly\x20ONE\x20mapped\x20transition\x20(e.g.\x20\x27order\x20reached\x20settle\x20terminal\x20AND\x20business\x20obligations\x20verified\x27),\x20never\x20at\x20\x27any\x20time\x20after\x20start\x27.\x20Then\x20bind\x20WHO\x20may\x20trigger\x20alloc_by_guard:\x20the\x20gate\x20carries\x20a\x20caller-identity\x20leg\x20—\x20context(Signer)\x20compared\x20against\x20a\x20table\x20entry,\x20a\x20permission.admin\x20/\x20order.owner\x20read,\x20or\x20the\x20named-operator\x20roster\x20query.\x20order.claimed_by\x20is\x20ORDER\x20STATE,\x20not\x20a\x20caller\x20binding\x20—\x20a\x20gate\x20whose\x20legs\x20read\x20only\x20order/progress/clock\x20state\x20is\x20callable\x20by\x20ANY\x20address,\x20and\x20a\x20bystander\x20can\x20accelerate\x20someone\x20else\x27s\x20payout\x20(sahr,\x20live-proven)'),c['push']('ALLOCATOR\x20GUARD\x20REVIEW\x20—\x20pre-publish,\x20semantic\x20alignment:\x20SAFETY\x20—\x20a\x20settlement\x20track\x20with\x20refund\x20exposure\x20carries\x20the\x20dispute\x20freeze\x20leg\x20logic_not[order.dispute.open]\x20(query\x201576)\x20so\x20a\x20filed\x20dispute\x20freezes\x20new\x20settlements;\x20resolved-awaiting-stamp\x20flows\x20drive\x20the\x20stamp\x20with\x20order.dispute.unstamped\x20(query\x201578).\x20EFFECTIVENESS\x20—\x20read\x20every\x20gate\x20leg\x20back\x20against\x20the\x20business\x20description\x20(who\x20SHOULD\x20trigger,\x20at\x20which\x20business\x20milestone,\x20with\x20what\x20evidence):\x20structural\x20lint\x20passing\x20is\x20NOT\x20semantic\x20alignment.\x20Run\x20the\x20template\x20scan\x20dry-run\x20before\x20publish\x20—\x20the\x20knowledge\x20face\x20discloses\x20identity-less\x20allocator\x20gates\x20as\x20RAIL_NO_CALLER_IDENTITY\x20(info,\x20never\x20blocking);\x20treat\x20the\x20disclosure\x20as\x20a\x20design-review\x20flag\x20and\x20resolve\x20it\x20either\x20with\x20a\x20caller-identity\x20leg\x20or\x20a\x20DOCUMENTED\x20open-trigger\x20rationale\x20(scene\x20verifies\x20identity\x20upstream\x20/\x20intentionally\x20open\x20venue),\x20never\x20by\x20silence'),c['push']('ALLOCATOR\x20RULING\x20DIRECTION\x20—\x20the\x20rich-state\x20matrix\x20closes\x20BOTH\x20ruling\x20outcomes:\x20an\x20award\x20exit\x20on\x20the\x20ARBITRATION\x20indemnity\x20track\x20(a\x20tpl_forward_arb_ruling_won\x20claimed_by==true\x20leg\x20is\x20legal\x20arb-side\x20state,\x20decision\x2011)\x20bound\x20ONLY\x20to\x20a\x20buyer-side\x20identity\x20(order.owner/agent)\x20is\x20unreachable\x20after\x20a\x20MERCHANT-favored\x20ruling\x20or\x20dismissal\x20—\x20nobody\x20but\x20the\x20buyer\x20can\x20open\x20the\x20exit\x20and\x20the\x20escrow\x20principal\x20strands\x20(w3k7\x20m2:\x201.25\x20WOW\x20held\x20on\x20a\x20fully-guarded\x20order;\x20the\x20protocol\x20is\x20direction-blind,\x20the\x20order\x20object\x20exposes\x20NO\x20winner\x20accessor,\x20so\x20the\x20guard\x20itself\x20cannot\x20branch\x20on\x20who\x20won).\x20Pair\x20the\x20buyer-side\x20award\x20exit\x20with\x20a\x20merchant-side\x20exit\x20(a\x20terminal-node-gated\x20recovery\x20sweep\x20—\x20the\x20canonical\x20recover\x20rail),\x20or\x20document\x20that\x20the\x20keeper\x20dual-payout\x20protocol\x20is\x20the\x20intended\x20sole\x20post-ruling\x20exit.\x20Overlap\x20between\x20an\x20award\x20and\x20a\x20fund-rail\x20payout\x20is\x20LEGAL\x20under\x20decision\x2011\x20and\x20is\x20disclosed\x20at\x20the\x20MCP\x20dual-payout\x20confirmation\x20gate\x20—\x20resolve\x20reachability\x20before\x20publish,\x20never\x20by\x20silence.\x20INVERTED\x20FUNDING\x20award-recipient\x20face\x20(W5-01\x20d;\x20the\x20order-side\x20award\x20payout\x20hard-binds\x20to\x20the\x20order\x20owner\x20on\x20both\x20compensate\x20and\x20conclude\x20paths):\x20a\x20ruling\x20pays\x20ONLY\x20the\x20compensation\x20indemnity,\x20never\x20the\x20escrow\x20principal\x20—\x20and\x20on\x20an\x20INVERTED-FUNDING\x20build\x20(bounty/contest:\x20the\x20SPONSOR\x20is\x20the\x20order_payer,\x20so\x20order.owner\x20IS\x20the\x20funder)\x20a\x20hunter/designer-side\x20win\x20pays\x20THE\x20SPONSOR,\x20not\x20the\x20winning\x20party;\x20state\x20both\x20directions\x20(award\x20recipient\x20+\x20principal\x20exit\x20via\x20the\x20recover\x20rail\x27s\x20note)\x20in\x20the\x20storefront/quote\x20before\x20publish'),c['push']('NO\x20CLAIM\x20WITHDRAWAL\x20—\x20a\x20filed\x20dispute\x20can\x20NEVER\x20be\x20withdrawn:\x20WOWOK\x20has\x20no\x20withdrawal\x20path\x20for\x20a\x20filed\x20arbitration\x20claim\x20(the\x20on-chain\x20withdraw-family\x20verbs\x20move\x20only\x20the\x20Progress\x20node;\x20they\x20never\x20clear\x20order.dispute\x20and\x20never\x20write\x20claimed_by,\x20so\x20a\x20withdrawal\x20would\x20permanently\x20freeze\x20the\x20order\x27s\x20dispute-gated\x20refund\x20rails).\x20FileDispute\x20→\x20ruling\x20rails\x20(conclude/compensate)\x20are\x20the\x20ONLY\x20dispute\x20exits,\x20and\x20the\x20arbitration\x20fee\x20is\x20non-refundable\x20regardless\x20of\x20outcome.\x20Never\x20plan,\x20promise\x20or\x20document\x20a\x20claim-withdrawal\x20step;\x20drive\x20every\x20filed\x20case\x20to\x20a\x20ruling.')),(a['adoptedModules']['includes']('refund_guarantee')||a['nodes']['some'](d=>d['id']==='arbitration'))&&(b?c['push']('COMPENSATION\x20FUND:\x20DO\x20NOT\x20FUND\x20—\x20this\x20template\x20declares\x20compensation_fund_policy=forbidden\x20(the\x20unreserved\x20pool\x20is\x20double-takeable\x20via\x20refund-then-claim\x20until\x20the\x20arbitration-escrow\x20shared\x20gate\x20lands;\x20user\x20ruling\x202026-10-15).\x20Disputes\x20ride\x20the\x20escrow\x20rails\x20only;\x20the\x20compensation_fund_topup\x20post-deploy\x20step\x20is\x20intentionally\x20absent'):c['push']('compensation_fund\x20MUST\x20be\x20able\x20to\x20cover\x20payouts:\x20a\x20claim\x20against\x20a\x20drained\x20fund\x20aborts\x20with\x20E_COMPENSATION_NOT_MATCH.\x20Size\x20the\x20fund\x20>=\x203x\x20a\x20TYPICAL\x20single\x20order\x20(3x\x20IS\x20the\x20chain\x27s\x20hard\x20award\x20ceiling,\x20MAX_INDEMNITY_MULTIPLE)\x20—\x20per-order\x20coverage\x20is\x20enforced\x20at\x20BUY\x20time\x20(each\x20order\x20is\x20checked\x20against\x203x\x20ITS\x20OWN\x20amount,\x20not\x203x\x20the\x20highest\x20SKU),\x20so\x20publish\x20no\x20longer\x20blocks\x20on\x20coverage;\x20verify\x20the\x20on-chain\x20balance\x20before\x20going\x20live.\x205R-07③:\x20after\x20go-live\x20the\x20keeper\x20WATCHES\x20the\x20water\x20level\x20(see\x20the\x20compensation_fund_watch\x20step)\x20—\x20no\x20hard\x20gate,\x20the\x20merchant\x20decides')),a['nodes']['some'](d=>d['id']==='arbitration')&&(c['push']('Arbitration\x20activation\x20is\x20ATOMIC\x20in\x20the\x20creation\x20plan\x20—\x20the\x20chain\x20hardcodes\x20every\x20new\x20Arbitration\x20to\x20PAUSED\x20at\x20construction,\x20and\x20the\x20plan\x27s\x20arbitration\x20create\x20payload\x20carries\x20pause:false,\x20which\x20the\x20executor\x20composes\x20as\x20the\x20unpause\x20write\x20in\x20the\x20SAME\x20transaction\x20(the\x20creator\x20is\x20the\x20new\x20Permission\x27s\x20admin,\x20so\x20the\x20356\x20assert\x20passes).\x20Verify\x20the\x20paused\x20flag\x20reads\x20false\x20after\x20materialization\x20(a\x20paused\x20venue\x20aborts\x20every\x20dispute\x20filing).\x20Keep\x20Arbitration.permission\x20distinct\x20from\x20Service.permission\x20on-chain\x20(E_ARBITRATION_PERMISSION_CONFLICT=33)'),c['push']('ARBITRATION\x20VENUE\x20OWNERSHIP\x20(D-5):\x20the\x20recommended\x20onboarding\x20default\x20is\x20a\x20SELF-BUILT\x20venue\x20—\x20your\x20own\x20Arbitration\x20object\x20with\x20your\x20own\x20permission/admin\x20(voting_guard\x20tpl_voting_guard_open_vote\x20for\x20community\x20cases,\x20tpl_voting_guard_numeric_weight\x20for\x20a\x20named\x20panel).\x20A\x20THIRD-PARTY\x20venue\x20you\x20do\x20not\x20control\x20hands\x20the\x20private\x20key\x20that\x20answers\x20and\x20appeals\x20cases\x20to\x20its\x20operator:\x20an\x20outside\x20store\x27s\x20admin\x20going\x20silent\x20strands\x20your\x20defense\x20(F-16,\x20live-proven).\x20Use\x20an\x20outside\x20venue\x20ONLY\x20when\x20its\x20operator\x20is\x20a\x20named,\x20reachable\x20counterparty\x20the\x20merchant\x20accepts')),a['nodes']['some'](d=>d['id']==='repository')&&c['push']('Repository\x20published\x20and\x20Guard\x20write\x20validation\x20configured'),c['push']('After\x20materialization,\x20confirm\x20the\x20on-chain\x20state\x20matches\x20this\x20plan\x20(query_toolkit\x20query_type=\x27service_panorama\x27)'),c;}function derivePostDeploySteps(a,b=![],c=![]){const d=[];return!b&&(a['adoptedModules']['includes']('refund_guarantee')||a['nodes']['some'](e=>e['id']==='arbitration'))&&(!c&&d['push']({'order':d['length']+0x1,'id':'compensation_fund_topup','title':'Top\x20up\x20the\x20compensation\x20fund','when':'After\x20the\x20Service\x20PUBLISHES\x20successfully\x20(post-publish,\x20before\x20the\x20store\x20goes\x20live\x20to\x20buyers)','action':'Call\x20compensation_fund_add\x20sized\x20>=\x203x\x20a\x20TYPICAL\x20single\x20order\x20(3x\x20=\x20the\x20chain\x27s\x20hard\x20award\x20ceiling,\x20MAX_INDEMNITY_MULTIPLE;\x20above\x203x\x20only\x20buys\x20headroom\x20for\x20concurrent\x20claims).\x20Per-order\x20coverage\x20is\x20enforced\x20at\x20BUY\x20time\x20—\x20each\x20incoming\x20order\x20is\x20checked\x20against\x203x\x20ITS\x20OWN\x20amount\x20and\x20under-covered\x20orders\x20cannot\x20be\x20created\x20—\x20then\x20verify\x20the\x20on-chain\x20fund\x20balance\x20via\x20query_objects','tool_hint':'onchain_operations\x20(service.compensation_fund_add)','failure_if_skipped':'a\x20compensation\x20claim\x20against\x20an\x20empty\x20fund\x20aborts\x20(E_COMPENSATION_NOT_MATCH,\x20testnet\x20lesson\x20R-4)'}),d['push']({'order':d['length']+0x1,'id':'compensation_fund_watch','title':'Watch\x20the\x20compensation-fund\x20water\x20level\x20(recurring\x20keeper\x20step)','when':'Recurring\x20—\x20on\x20every\x20keeper\x20cycle\x20after\x20go-live,\x20and\x20ALWAYS\x20immediately\x20after\x20each\x20arbitration\x20payout\x20posts','action':'Query\x20the\x20on-chain\x20fund\x20balance\x20and\x20classify\x20it\x20with\x20classifyFundWaterLevel(balance,\x20low_water_threshold)\x20into\x20THREE\x20tiers:\x20HEALTHY\x20(balance\x20>=\x20threshold\x20—\x20silence\x20is\x20the\x20healthy\x20signal,\x20no\x20event)\x20/\x20LOW\x20WATER\x20(0\x20<\x20balance\x20<\x20threshold\x20—\x20surface\x20fundWaterReminder:\x20recommend\x20topping\x20up\x20via\x20compensation_fund_add;\x20one\x20large\x20award\x20could\x20leave\x20top\x20listings\x20under-covered)\x20/\x20DEPLETED\x20(balance\x200\x20—\x20surface\x20fundWaterReminder\x20LOUD:\x20every\x20claim\x20aborts\x2027\x20and\x20listings\x20above\x20the\x20zero\x20cap\x20check\x20out\x20UNDER-COVERED,\x20not\x20blocked\x20—\x20the\x20buy\x20proceeds\x20with\x20a\x20warning\x20since\x20ruling\x20⑤).\x20Thresholds\x20are\x20the\x20MERCHANT\x27s\x20call\x20(decision\x207)\x20—\x20recommended\x20anchor:\x20low-water\x20line\x20at\x203x\x20the\x20flagship\x20SKU\x20price,\x20healthy\x20line\x20at\x203x\x20the\x20typical\x20order.\x20NEVER\x20block\x20a\x20SKU\x20or\x20gate\x20a\x20claim\x20on\x20the\x20tier\x20—\x20the\x20reminder\x20is\x20the\x20whole\x20feature;\x20the\x20merchant\x20decides\x20(top\x20up\x20/\x20accept\x20the\x20exposure)','tool_hint':'query_toolkit\x20(service_panorama:\x20fund\x20balance)\x20+\x20fund-layer\x20classifyFundWaterLevel\x20+\x20onchain_operations\x20(service.compensation_fund_add)\x20on\x20the\x20merchant\x27s\x20decision','failure_if_skipped':'a\x20drained\x20or\x20low\x20fund\x20is\x20SILENT\x20—\x20the\x20first\x20signal\x20is\x20a\x20buyer\x27s\x20claim\x20aborting\x20(27)\x20or\x20top\x20listings\x20checking\x20out\x20under-covered\x20(buy\x20proceeds\x20with\x20a\x20warning\x20since\x20ruling\x20⑤;\x20a\x20max-award\x20ruling\x20aborts\x20code\x2027)'})),a['nodes']['some'](e=>e['id']==='arbitration')&&(d['push']({'order':d['length']+0x1,'id':'arbitration_unpause','title':'Verify\x20the\x20Arbitration\x20is\x20ACTIVE\x20(activation\x20rode\x20the\x20create)','when':'Immediately\x20after\x20materialization\x20—\x20before\x20the\x20store\x20goes\x20live\x20to\x20buyers','action':'The\x20creation\x20plan\x27s\x20arbitration\x20create\x20payload\x20carries\x20pause:false\x20(the\x20chain\x20hardcodes\x20new\x20Arbitrations\x20to\x20paused;\x20the\x20executor\x20composes\x20the\x20unpause\x20in\x20the\x20same\x20transaction)\x20—\x20VERIFY\x20the\x20paused\x20flag\x20reads\x20false\x20via\x20query_toolkit;\x20only\x20an\x20already-paused\x20leftover\x20venue\x20(built\x20before\x20this\x20payload\x20field\x20existed)\x20needs\x20a\x20manual\x20unpause.\x20Keep\x20its\x20Permission\x20distinct\x20from\x20the\x20Service\x20Permission\x20(E_ARBITRATION_PERMISSION_CONFLICT=33)','tool_hint':'query_toolkit\x20(arbitration\x20paused\x20flag);\x20manual\x20unpause\x20via\x20onchain_operations\x20(arbitration\x20pause:false)\x20ONLY\x20for\x20a\x20legacy\x20paused\x20venue','failure_if_skipped':'a\x20paused\x20Arbitration\x20aborts\x20every\x20dispute\x20filing\x20(testnet\x20lesson\x20R-5)'}),d['push']({'order':d['length']+0x1,'id':'arbitration_permission_write','title':'Grant\x20the\x20operator\x20account\x20its\x20venue-management\x20permissions','when':'After\x20the\x20Arbitration\x20object\x20is\x20created,\x20BEFORE\x20any\x20venue-management\x20call\x20(description/guard/fee/pause\x20edits)\x20from\x20the\x20operator\x20account','action':'Write\x20the\x20operator\x20permission\x20row:\x20onchain_operations\x20operation_type=\x27permission\x27,\x20data={object:\x27<arbitration_permission_object>\x27,\x20table:{op:\x27add\x20perm\x20by\x20entity\x27,\x20entity:\x27<operator_account>\x27,\x20index:[350,351,354,356,357,359]}}\x20—\x20350\x20file\x20new\x20cases,\x20351\x20description,\x20354\x20voting_guard\x20management,\x20356\x20pause/resume,\x20357\x20fee,\x20359\x20ruling.\x20The\x20arbitration\x20Permission\x20table\x20starts\x20EMPTY\x20with\x20only\x20the\x20creator\x20seeded\x20as\x20admin,\x20so\x20without\x20this\x20row\x20every\x20operator\x20call\x20aborts\x20on\x20the\x20permission\x20assert.\x20entity\x20must\x20be\x20a\x20FULL\x2066-char\x200x\x20address\x20or\x20a\x20local\x20mark\x20name\x20—\x20a\x20truncated\x20address\x20normalizes\x20to\x20a\x20DIFFERENT\x20on-chain\x20address\x20and\x20grants\x20the\x20wrong\x20row\x20silently','tool_hint':'onchain_operations\x20(permission\x20add\x20perm\x20by\x20entity,\x20indexes\x20350/351/354/356/357/359)','failure_if_skipped':'the\x20operator\x20account\x20holds\x20NO\x20rows\x20in\x20the\x20arbitration\x20Permission\x20table\x20—\x20every\x20venue-management\x20call\x20from\x20it\x20aborts\x20on\x20the\x20permission\x20assert\x20(permission\x20350-359\x20failures)','note':'SIGNER\x20DISCLOSURE:\x20until\x20the\x20row\x20above\x20lands,\x20the\x20ONLY\x20account\x20that\x20can\x20manage\x20this\x20venue\x20(pause\x20356\x20included)\x20is\x20the\x20venue\x20Permission\x27s\x20admin\x20—\x20its\x20CREATOR.\x20In\x20the\x20usual\x20single-venue\x20build\x20the\x20creator\x20is\x20the\x20arbitrator\x27s\x20account,\x20so\x20an\x20emergency\x20pause\x20before\x20this\x20step\x20must\x20be\x20signed\x20by\x20the\x20arbitrator,\x20not\x20the\x20merchant\x20operator.'}),d['push']({'order':d['length']+0x1,'id':'arbitration_arbitrator_grant','title':'Grant\x20the\x20arbitrator\x20account\x20its\x20case-lifecycle\x20permissions','when':'After\x20arbitration_permission_write,\x20BEFORE\x20the\x20first\x20dispute\x20reaches\x20voting','action':'Write\x20the\x20arbitrator\x20permission\x20row:\x20same\x20permission-object\x20call\x20shape\x20with\x20entity:\x27<arbitrator_account>\x27\x20and\x20index:[358,359,360,361,362,363,364]\x20—\x20358\x20vote,\x20359\x20ruling,\x20360\x20feedback,\x20361\x20confirm,\x20362\x20voting-deadline\x20change,\x20363\x20reset,\x20364\x20receive.\x20Note:\x20the\x20disputing\x20CUSTOMER\x20must\x20hold\x20358\x20for\x20their\x20vote\x20to\x20count\x20(a\x20plain\x20vote\x20with\x20an\x20empty\x20voting_guard\x20still\x20asserts\x20358\x20—\x20ungranted,\x20voting\x20collapses\x20to\x20admin-only,\x20E-13);\x20that\x20per-dispute\x20customer\x20grant\x20is\x20issued\x20at\x20filing\x20time,\x20NOT\x20in\x20this\x20step.\x20Full\x2066-char\x20address\x20or\x20mark\x20name\x20only','tool_hint':'onchain_operations\x20(permission\x20add\x20perm\x20by\x20entity,\x20indexes\x20358-364)','failure_if_skipped':'358-364\x20stay\x20creator-admin-only\x20—\x20the\x20named\x20arbitrator\x20cannot\x20vote/rule/confirm,\x20and\x20the\x20customer\x27s\x20vote\x20collapses\x20to\x20admin-only\x20(E-13),\x20dead-locking\x20the\x20first\x20dispute'}),d['push']({'order':d['length']+0x1,'id':'voting_guard_roster_bind','title':'Bind\x20a\x20roster/party\x20voting_guard\x20(default;\x20TRIAGE-261109\x20item\x20D)','when':'After\x20the\x20Arbitration\x20is\x20activated,\x20BEFORE\x20the\x20first\x20dispute\x20can\x20be\x20voted\x20on','action':'Bind\x20a\x20guard-weighted\x20voter\x20universe,\x20roster-first:\x20tpl_voting_guard_party_only\x20(dispute\x20parties\x20—\x20buyer\x20via\x20order.owner\x20+\x20arb.order\x20case\x20pin,\x20plus\x20the\x20venue\x20panel\x20address\x20list)\x20or\x20tpl_voting_guard_numeric_weight\x20(staff\x20roster\x20with\x20explicit\x20weights).\x20Choose\x20tpl_voting_guard_open_vote\x20(always-true,\x20one\x20passport\x20one\x20vote)\x20ONLY\x20for\x20a\x20deliberately\x20PUBLIC\x20venue\x20—\x20declare\x20the\x20open\x20venue\x20in\x20the\x20service\x20description','tool_hint':'onchain_operations\x20(guard\x20creation\x20+\x20arbitration\x20voting_guard\x20set,\x20op=\x27set\x27)','failure_if_skipped':'an\x20EMPTY\x20voting_guard\x20dead-locks\x20every\x20plain\x20vote\x20on\x20permission\x20358\x20(creator-admin\x20only)\x20—\x20the\x20first\x20dispute\x20cannot\x20reach\x20a\x20verdict\x20if\x20the\x20admin\x20is\x20unresponsive\x20(crs9-F-36,\x20R-ARB-VOTE-LOCK)'})),a['edges']['some'](f=>f['relation']==='has_order_allocators')&&d['push']({'order':d['length']+0x1,'id':'settlement_alloc_by_guard','title':'Fire\x20settlement\x20via\x20alloc_by_guard\x20(keeper\x20or\x20merchant\x20step)','when':'Recurring\x20—\x20after\x20EACH\x20order\x20reaches\x20its\x20settlement\x20terminal\x20node\x20(declare\x20which\x20node\x20unlocks\x20settlement)','action':'Call\x20alloc_by_guard\x20on\x20the\x20order\x27s\x20allocation\x20with\x20the\x20settlement\x20Guard;\x20reaching\x20the\x20Machine\x20node\x20alone\x20does\x20NOT\x20settle\x20(allocation_state\x20stays\x20pending)','tool_hint':'onchain_operations\x20(allocation.alloc_by_guard);\x20schedule\x20as\x20a\x20keeper\x20step','failure_if_skipped':'orders\x20stall\x20at\x20the\x20settle\x20node\x20with\x20funds\x20locked\x20in\x20escrow\x20(testnet\x20lesson\x20R-2)'}),d['push']({'order':d['length']+0x1,'id':'verify_service_panorama','title':'Verify\x20the\x20on-chain\x20state\x20matches\x20the\x20plan','when':'After\x20all\x20creation\x20steps\x20and\x20the\x20steps\x20above\x20are\x20done','action':'Run\x20the\x20service\x20panorama\x20query\x20and\x20diff\x20it\x20against\x20this\x20plan\x27s\x20blueprint/creation_plan','tool_hint':'query_toolkit\x20query_type=\x27service_panorama\x27','failure_if_skipped':'plan/chain\x20drift\x20(missing\x20binding,\x20wrong\x20allocator\x20order)\x20stays\x20undetected\x20until\x20an\x20order\x20hits\x20it'}),d;}function buildCreationPlan(a){const b=[],c=new Map(a['nodes']['map'](j=>[j['id'],j])),f=new Map();for(const j of a['nodes'])f['set'](j['id'],new Set());for(const k of a['edges']){if(!f['has'](k['from'])||!c['has'](k['to']))continue;const l=relationDirection(k['relation'])==='to_depends_on_from',m=l?k['to']:k['from'],o=l?k['from']:k['to'];if(m===o||!f['has'](m))continue;f['get'](m)['add'](o);}for(const p of a['nodes']){for(const q of Object['values'](p['config'])){q['type']==='address_ref'&&q['targetId']!==p['id']&&f['has'](q['targetId'])&&f['get'](p['id'])['add'](q['targetId']);}}{const r=GUARD_AFTER_SERVICE_DRAFT,s=a['nodes']['filter'](t=>t['type']===r['provider'])['map'](t=>t['id']);if(s['length']>0x0)for(const t of a['nodes']){if(t['type']!==r['dependent'])continue;const u=f['get'](t['id']);if(u===undefined)continue;for(const v of s)u['add'](v);}}const g=new Map([...f]['map'](([w,x])=>[w,[...x]])),h=[],i=new Map(f);while(i['size']>0x0){const w=[...i['entries']()]['filter'](([,x])=>x['size']===0x0)['map'](([x])=>x);if(w['length']===0x0){h['push'](...i['keys']());break;}w['sort']();for(const x of w){h['push'](x),i['delete'](x);for(const y of i['values']())y['delete'](x);}}return h['forEach']((z,A)=>{const B=c['get'](z),C=B['config']['name'],D=C?.['type']==='string'?C['value']:z,E=D['includes']('/')?D['replaceAll']('/','__'):D,F=z==='arbitration'?'Create\x20'+B['type']+'\x20via\x20onchain_operations\x20WITH\x20pause:false\x20(creation-time\x20activation),\x20then\x20configure.\x20Purpose:\x20'+B['purpose']:'Create\x20'+B['type']+'\x20via\x20onchain_operations,\x20then\x20configure.\x20Purpose:\x20'+B['purpose'];b['push']({'order':A+0x1,'node_id':z,'object_type':B['type'],'suggested_name':E,'depends_on':g['get'](z)??[],'operation_hint':F});}),b;}function resolveTemplate(a,b){if(!a)return undefined;const c=getTemplate(a);if(c)return c;const d=getTemplatesByIndustry(a);if(b){const f=b['toLowerCase'](),g=d['filter'](h=>{const i=String(h['product_ref']??'')['trim']()['toLowerCase']();return i['length']>0x0&&f['includes'](i);});if(g['length']===0x1)return g[0x0];}const e=getScenarioMode(a)?.['default_template'];if(e){const h=getTemplate(e);if(h)return h;}if(d['length']>0x0)return d[0x0];return undefined;}export const GAS_PER_ORDER_SMALLEST=0x5b8d80;export const MIN_ECONOMIC_ORDER_SMALLEST=0x2faf080;const GAS_RATIO_WARN_THRESHOLD=0.1,wow=a=>Number((a/0x3b9aca00)['toFixed'](0x6))+'\x20WOW';export function gasEconomicsWarnings(a,b){const c=[],d=(a??[])['map'](j=>Number(j?.['price']))['filter'](j=>Number['isFinite'](j)&&j>0x0);if(d['length']===0x0)return c;const e=Math['min'](...d),f=Number(b),g=Number['isFinite'](f)&&f>0x0?f:0x0,h=g+GAS_PER_ORDER_SMALLEST,i=h/e;if(e<MIN_ECONOMIC_ORDER_SMALLEST)c['push']('GAS\x20ECONOMY\x20(ddmc4\x20B-39\x20/\x20ks7\x20A-10):\x20the\x20cheapest\x20SKU\x20is\x20'+wow(e)+'\x20—\x20below\x20the\x20≈'+wow(MIN_ECONOMIC_ORDER_SMALLEST)+'\x20minimum\x20ECONOMIC\x20per-order\x20price.\x20'+('Measured\x20settlement\x20gas\x20is\x20≈'+wow(GAS_PER_ORDER_SMALLEST)+'\x20per\x20transaction')+(g>0x0?',\x20plus\x20'+wow(g)+'\x20cashback\x20per\x20claim':'')+('\x20—\x20per-order\x20overhead\x20≈'+wow(h)+'\x20('+Math['round'](i*0x64)+'%\x20of\x20this\x20SKU).\x20')+'Micro-priced\x20SKUs\x20lose\x20their\x20entire\x20margin\x20to\x20gas:\x20raise\x20the\x20price,\x20drop\x20the\x20per-claim\x20cashback,\x20or\x20batch\x20settlements.');else i>GAS_RATIO_WARN_THRESHOLD&&c['push']('GAS\x20ECONOMY\x20(ks7\x20A-10):\x20cashback\x20+\x20settlement\x20gas\x20≈'+wow(h)+'\x20per\x20order\x20is\x20'+Math['round'](i*0x64)+'%\x20of\x20the\x20cheapest\x20SKU\x20('+wow(e)+')\x20—\x20above\x20the\x2010%\x20warning\x20line.\x20'+'Trim\x20the\x20per-claim\x20cashback\x20or\x20raise\x20the\x20price.');return c;}export async function handleMerchantGuide(a){const b=a['guide_state']??{'intent_text':''},d=a['guide_confirm']??{},e={'intent_text':(a['intent']??b['intent_text']??'')['trim'](),'confirmed_industry':d['industry']??b['confirmed_industry'],'currency':d['currency']??b['currency'],'deliverables':d['deliverables']??b['deliverables'],'payment_override':d['payment']??b['payment_override'],'trust_override':d['trust']??b['trust_override'],'adopted_module_ids':d['adopted_module_ids']??b['adopted_module_ids'],'guard_resolutions':{...b['guard_resolutions']??{},...d['guard_resolutions']??{}},'review_mode':d['review_mode']??b['review_mode'],'reward_funding':d['reward_funding']??b['reward_funding'],'reward_claim_amount':d['reward_claim_amount']??b['reward_claim_amount'],'reward_claim_opens_after_days':d['reward_claim_opens_after_days']??b['reward_claim_opens_after_days'],'reward_claim_closes_after_days':d['reward_claim_closes_after_days']??b['reward_claim_closes_after_days'],'reward_claim_opens_after_ms':d['reward_claim_opens_after_ms']??b['reward_claim_opens_after_ms'],'reward_claim_closes_after_ms':d['reward_claim_closes_after_ms']??b['reward_claim_closes_after_ms'],'reward_rating_floor':d['reward_rating_floor']??b['reward_rating_floor'],'arbitration_vote_policy':d['arbitration_vote_policy']??b['arbitration_vote_policy'],'experience_compensation_mode':d['experience_compensation_mode']??b['experience_compensation_mode'],'experience_pool_funding':d['experience_pool_funding']??b['experience_pool_funding'],'price_rebate_mode':d['price_rebate_mode']??b['price_rebate_mode'],'price_rebate_pool_funding':d['price_rebate_pool_funding']??b['price_rebate_pool_funding'],'staff_addresses':d['staff_addresses']??b['staff_addresses'],'compensation_fund':d['compensation_fund']??b['compensation_fund'],'after_sales_mode':d['after_sales_mode']??b['after_sales_mode'],'acceptance_mode':d['acceptance_mode']??b['acceptance_mode'],'installment_mode':d['installment_mode']??b['installment_mode'],'affiliate_mode':d['affiliate_mode']??b['affiliate_mode'],'crowdfunding_mode':d['crowdfunding_mode']??b['crowdfunding_mode'],'logistics_mode':d['logistics_mode']??b['logistics_mode'],'supply_chain':d['supply_chain']??b['supply_chain'],'sales':d['sales']??b['sales'],'fee_overrides':{...b['fee_overrides']??{},...d['fee_overrides']??{}}};for(const W of Object['keys'](e)){if(e[W]===undefined)delete e[W];}if(e['guard_resolutions']&&Object['keys'](e['guard_resolutions'])['length']===0x0)delete e['guard_resolutions'];if(!e['intent_text'])throw new Error('merchant_guide\x20requires\x20\x27intent\x27\x20(business\x20description)\x20for\x20Step\x201.\x20'+'Example:\x20intent=\x27I\x20want\x20to\x20offer\x20online\x20design\x20service\x20with\x20milestone\x20payments\x27.\x20'+'Pass\x20the\x20returned\x20guide_state\x20back\x20UNCHANGED\x20on\x20subsequent\x20calls,\x20plus\x20guide_confirm\x20for\x20merchant\x20decisions.');const f=await analyzeIntent(e['intent_text'],{'preferredIndustry':e['confirmed_industry'],'currency':e['currency']});if(!e['confirmed_industry'])return{'action':'merchant_guide','current_step':0x2,'step_name':'Industry\x20Matching','guide_state':e,'intent_draft':f['intent'],'industry_options':{'inferred':f['inferredIndustry'],'confidence':f['industryConfidence'],'similar':f['similarIndustries']},'warnings':f['warnings'],'next_action':'Confirm\x20the\x20industry\x20by\x20calling\x20merchant_guide\x20again\x20with\x20guide_state\x20(UNCHANGED)\x20'+('plus\x20guide_confirm={\x20industry:\x20\x27<one\x20of:\x20'+f['similarIndustries']['join'](',\x20')+'\x20—\x20or\x20any\x20other\x20industry\x20id>\x27\x20}')};const g={...f['intent'],'industry':e['confirmed_industry'],'deliverables':e['deliverables']??f['intent']['deliverables'],'payment':{...f['intent']['payment'],...e['payment_override']??{}},'trust':{...f['intent']['trust'],...e['trust_override']??{}}},h=!!e['adopted_module_ids'],i=e['adopted_module_ids']?e['adopted_module_ids']['map'](X=>getCapability(X))['filter'](X=>!!X):recommendCapabilities(e['confirmed_industry'],e['intent_text'],{'maxCapabilities':0x5}),j=a['template_override']??resolveTemplate(e['confirmed_industry'],e['intent_text']);if(!j)throw new Error('No\x20compilable\x20template\x20found\x20for\x20industry\x20\x27'+e['confirmed_industry']+'\x27.\x20'+'Register\x20a\x20template\x20via\x20industry_pack_operation\x20or\x20pass\x20template_override\x20explicitly.');const l=resolveUserInputQuestions(j),m=e['fee_overrides']?.[PRODUCT_DETAIL_SOURCE_KEY]??j?.['fee_params']?.[PRODUCT_DETAIL_SOURCE_KEY],n=await resolveProductDetailSource(m,e['sales']);if(n['enriched']['length']>0x0&&Array['isArray'](e['sales'])&&e['sales']['length']>0x0){const X=new Map(n['enriched']['map'](Y=>[Y['sku'],Y]));e['sales']=e['sales']['map'](Y=>{if(Y===null||typeof Y!=='object')return Y;const Z=X['get'](String(Y['name']??''));return Z===undefined?Y:{...Y,'wip':Z['wip'],'wip_hash':Z['wip_hash']};});}const o={'currency':e['currency']??g['payment']['currency'],...e['payment_override']?{'payment':e['payment_override']}:{},...e['trust_override']?{'trust':e['trust_override']}:{},...e['deliverables']?{'deliverables':e['deliverables']}:{},...e['adopted_module_ids']?{'adopted_module_ids':e['adopted_module_ids']}:{},...e['review_mode']?{'review_mode':e['review_mode']}:{},...e['reward_funding']!==undefined?{'reward_funding':e['reward_funding']}:{},...e['reward_claim_amount']!==undefined?{'reward_claim_amount':e['reward_claim_amount']}:{},...e['reward_claim_opens_after_days']!==undefined?{'reward_claim_opens_after_days':e['reward_claim_opens_after_days']}:{},...e['reward_claim_closes_after_days']!==undefined?{'reward_claim_closes_after_days':e['reward_claim_closes_after_days']}:{},...e['reward_claim_opens_after_ms']!==undefined?{'reward_claim_opens_after_ms':e['reward_claim_opens_after_ms']}:{},...e['reward_claim_closes_after_ms']!==undefined?{'reward_claim_closes_after_ms':e['reward_claim_closes_after_ms']}:{},...e['reward_rating_floor']!==undefined?{'reward_rating_floor':e['reward_rating_floor']}:{},...e['arbitration_vote_policy']!==undefined?{'arbitration_vote_policy':e['arbitration_vote_policy']}:{},...e['experience_compensation_mode']?{'experience_compensation_mode':e['experience_compensation_mode']}:{},...e['experience_pool_funding']!==undefined?{'experience_pool_funding':e['experience_pool_funding']}:{},...e['price_rebate_mode']?{'price_rebate_mode':e['price_rebate_mode']}:{},...e['price_rebate_pool_funding']!==undefined?{'price_rebate_pool_funding':e['price_rebate_pool_funding']}:{},...e['staff_addresses']?.['length']?{'staff_addresses':e['staff_addresses'],'allowed_writers':JSON['stringify'](e['staff_addresses'])}:{},...e['compensation_fund']!==undefined?{'compensation_fund':e['compensation_fund']}:{},...e['after_sales_mode']?{'after_sales_mode':e['after_sales_mode']}:{},...e['acceptance_mode']?{'acceptance_mode':e['acceptance_mode']}:{},...e['installment_mode']?{'installment_mode':e['installment_mode']}:{},...e['affiliate_mode']?{'affiliate_mode':e['affiliate_mode']}:{},...e['crowdfunding_mode']?{'crowdfunding_mode':e['crowdfunding_mode']}:{},...e['logistics_mode']?{'logistics_mode':e['logistics_mode']}:{},...e['sales']?.['length']?{'sales':e['sales']}:{},...e['fee_overrides']??{}},p={};Object['assign'](p,e['guard_resolutions']??{});const q=compileTemplate(j,o,{'nameBase':a['name_base']??j['id'],'intent':e['intent_text'],'guardResolutions':p,'buildTimeMs':Date['now'](),...e['supply_chain']!==undefined&&e['supply_chain']['length']>0x0?{'supplyChain':e['supply_chain']}:{}}),r=reflux(q['plan']),s=r['plan'],t=r['audit'],u=auditScore(t),w=planBlueprint(s,g,i['map'](Y=>Y['id'])),x=q['blockers']['map'](Y=>({'module':'template','missing_constraints':[Y['code']],'fix':Y['detail']})),y=derivePlanSatisfiedConstraints(w,g),z={'paymentModel':e['payment_override']?.['model'],'trustArbitration':e['trust_override']?.['arbitration'],'trustRefundPolicy':e['trust_override']?.['refundPolicy'],'proofsOfDelivery':e['deliverables']?.['map'](Y=>Y['proofOfDelivery']),'allocationCount':e['payment_override']?.['allocation']?.['length']},A=i['map'](Y=>{const Z=capabilityIntentEvidence(Y,e['intent_text'],z);return checkCapabilityConstraints(Y,y,{'evidenceMatched':h||Z['matched'],'evidence':Z});}),B=j['compensation_fund_policy']==='forbidden',C=deriveDeployTimeChecks(w,B),D=derivePostDeploySteps(w,B,s['steps']['some'](Y=>Y['op']==='configure'&&Y['id']==='service_compensation'&&Y['method']==='compensation_fund_add')),E=w['edges']['some'](Y=>Y['relation']==='has_order_allocators')?recipientDesignGuidance()['map'](Y=>({'id':Y['id'],'move_recipient':Y['move_recipient'],'semantics':Y['semantics'],'required_constraints':Y['required_constraints'],'finding_if_unmet':Y['finding_if_unmet']})):undefined,F=t['findings']['filter'](Y=>Y['level']==='critical'||Y['level']==='high')['map'](Y=>({'module':'audit','missing_constraints':[Y['rule_id']],'fix':Y['title']+'\x20—\x20'+(Y['mitigation']??Y['description'])})),G=[{'re':/allocat|refund|recover|claimed_by|settle|escrow/i,'scene':'service_order_allocators_guard'},{'re':/\bbuy\b|purchase|allowlist|blocklist/i,'scene':'service_buy_guard'},{'re':/reward/i,'scene':'reward_claim'},{'re':/write_guard|repository_write/i,'scene':'repository_write_guard'},{'re':/arbitrat|ruling|voting/i,'scene':'arbitration_usage_guard'},{'re':/forward|node|witness|deliver|review|cancel|expire|submission|progress/i,'scene':'machine_forward_guard'}],H=[{'re':/claimed_by\s*some\s*==\s*true/i,'tpl':'tpl_allocator_node_gate_recover'},{'re':/claimed_by\s*some\s*==\s*false|claimed_by\s*(?:is\s+)?none|\brefund|\bcancel/i,'tpl':'tpl_allocator_node_gate_refund'},{'re':/claimed_by\s*some|\brecover|\baward/i,'tpl':'tpl_allocator_node_gate_recover'}],I=[{'host':'machine','re':/pattern\.time_lock_progress/i,'tpl':'tpl_time_lock_progress'},{'host':'machine','re':/pattern\.time_window_upper_bound/i,'tpl':'tpl_time_window_upper'},{'host':'reward','re':/pattern\./i,'tpl':'tpl_reward_one_time_claim'}],J=(Y,Z,a0,a1,a2)=>{let a3;const a4=/tpl_[a-z0-9_]+/['exec'](Y+'\x20'+Z),a5=a1==='machine'||a1==='machine_forward'?'machine_forward_guard':a1==='reward'?'reward_claim':a1==='repository'?'repository_write_guard':a1==='arbitration'?'arbitration_usage_guard':undefined;if(a4!==null){const aa=GUARD_TEMPLATES['find'](ab=>ab['id']===a4[0x0])?.['scene_id'];aa!==undefined&&(a5===undefined||aa===a5||aa==='service_order_allocators_guard'&&a1!=='reward')&&(a3=aa);}a3===undefined&&a1!=='reward'&&!I['some'](ab=>ab['host']===(a1==='machine_forward'?'machine':a1)&&ab['re']['test'](Y))&&/\ballocators?\b|claimed_by|guard_identifier|order_allocators/i['test'](Z)&&(a3='service_order_allocators_guard');if(a3===undefined){if(a5!==undefined)a3=a5;else{const ab=G['find'](ac=>ac['re']['test'](Y+'\x20'+Z));a3=ab?.['scene'];}}if(a3===undefined)return undefined;const a6=getTemplatesByScene(a3);let a7=a0!==undefined&&a6['some'](ac=>ac['applicable_industries']['includes'](a0))?a6['filter'](ac=>ac['applicable_industries']['includes'](a0)):a6;if(/\btime[_-]?lock|\bwindow|\btimeout|\bduration|\bdeadline|\bdays?\b|\bclock|\bdelay/i['test'](Y+'\x20'+Z)){const ac=a7['filter'](ad=>JSON['stringify'](ad['example_root']??{})['toLowerCase']()['includes']('clock'));if(ac['length']===0x0)return undefined;a7=ac;}if(a2['length']>0x0){const ad=a4!==null?a7['find'](af=>af['id']===a4[0x0]):undefined,ae=a7['filter'](af=>{const ag=[];if(af['example_root']!==undefined){const ah=JSON['stringify'](af['example_root']);for(const ai of ah['matchAll'](/"query":"([^"]+)"/g))ag['push'](ai[0x1]);if(ah['includes']('\x22type\x22:\x22query_progress_history_time\x22'))ag['push']('progress.history.time');if(ah['includes']('\x22type\x22:\x22query_progress_history_find\x22'))ag['push']('progress.history.find');}return ag['some'](aj=>a2['some'](ak=>aj===ak||aj['startsWith'](ak)||ak['startsWith'](aj)));});if(ad!==undefined&&!ae['includes'](ad))ae['push'](ad);if(ae['length']===0x0)return undefined;a7=ae;}const a8=a1==='machine_forward'?'machine':a1,a9=I['find'](af=>af['host']===a8&&af['re']['test'](Y+'\x20'+Z)&&a7['some'](ag=>ag['id']===af['tpl']));a9!==undefined&&(a7=[...a7]['sort']((af,ag)=>(af['id']===a9['tpl']?0x0:0x1)-(ag['id']===a9['tpl']?0x0:0x1)));if(a3==='service_order_allocators_guard'){const af=H['find'](ag=>ag['re']['test'](Y+'\x20'+Z));af!==undefined&&(a7=[...a7]['sort']((ag,ah)=>(ag['id']===af['tpl']?0x0:0x1)-(ah['id']===af['tpl']?0x0:0x1)));}return a7['slice'](0x0,0x3)['map'](ag=>({'template_id':ag['id'],'name':ag['name'],'parameters':ag['parameters']['map'](ah=>({'name':ah['name'],'required':ah['required'],...ah['default']!==undefined?{'default':ah['default']}:{},'description':ah['description']}))}));},K=[],L=guardMountCensus(j,o),M=q['unresolved']['map'](Y=>{const Z=getGuardDesignPattern(Y['template_id']),a0=J(Y['template_id'],Y['purpose'],j?.['industry'],Y['host'],Z?.['key_queries']??[]),a1=new Map((j?.['allocator']['rows']??[])['filter'](a9=>typeof a9['guard_key']==='string')['map'](a9=>[a9['guard_key'],a9])),a2=a1['get'](Y['key']),a3=a2!==undefined&&!L['edgeKeys']['has'](Y['key']),a4=!L['edgeKeys']['has'](Y['key'])&&!L['railKeys']['has'](Y['key'])&&!L['policyKeys']['has'](Y['key'])&&Y['host']!=='reward'&&!(Y['host']==='service'&&Y['key']==='buy'),a5=Y['host']==='service'&&Y['key']==='buy';if(!a4&&!a5)K['push'](Y['key']);const a6=Y['key']['toLowerCase'](),a7=(Y['purpose']??'')['toLowerCase'](),a8=/recover|award/['test'](a6)||!/refund/['test'](a6)&&/recover|award/['test'](a7)?'NODE\x20GATE\x20REQUIRED\x20(the\x20sketch\x20above\x20omits\x20it):\x20this\x20recovery\x20rail\x20is\x20a\x20terminal-node-gated\x20sweep\x20—\x20resolve\x20the\x20gate\x20to\x20fire\x20only\x20when\x20the\x20order\x20has\x20reached\x20the\x20recovery\x20terminal\x20nodes\x20(tpl_allocator_node_gate_recover\x20family\x20carries\x20the\x20node-gate\x20slot\x20set;\x20NEVER\x20slot\x20254).\x20NEVER\x20add\x20an\x20order.claimed_by\x20leg:\x20fund\x20rails\x20never\x20read\x20the\x20claimed_by\x20axis\x20(decision\x2011,\x20R-FUND-RAIL-CLAIMED-BY\x20/\x20RAIL_CLAIMED_BY_LEG\x20critical).':/refund/['test'](a6)||!/recover|award/['test'](a6)&&/refund/['test'](a7)?'NODE\x20GATE\x20REQUIRED\x20(the\x20sketch\x20above\x20omits\x20it):\x20this\x20refund\x20rail\x20may\x20only\x20fire\x20at\x20its\x20refund\x20terminal\x20node\x20—\x20resolve\x20the\x20gate\x20against\x20order\x20node\x20state,\x20never\x20against\x20order.claimed_by\x20(fund\x20rails\x20NEVER\x20read\x20the\x20claimed_by\x20axis;\x20decision\x2011,\x20R-FUND-RAIL-CLAIMED-BY\x20/\x20RAIL_CLAIMED_BY_LEG\x20critical).\x20The\x20arbitration\x20award\x20is\x20the\x20indemnity\x20track\x27s\x20separate\x20commercial\x20payout\x20—\x20any\x20refund/award\x20overlap\x20is\x20legal\x20and\x20disclosed\x20at\x20the\x20MCP\x20dual-payout\x20confirmation\x20gate.':undefined;return{'key':Y['key'],'template_id':Y['template_id'],'host':Y['host'],'purpose':Y['purpose'],'bound':!a4&&!a5,'resolution_required':!a4||a5||j!==undefined&&lookupBinding(Y,j)!==undefined,...!(a4&&!a5)||j!==undefined&&lookupBinding(Y,j)!==undefined?{}:{'advisory_note':'ADVISORY\x20ONLY\x20—\x20nothing\x20binds\x20this\x20design\x20and\x20the\x20plan\x20ships\x20WITHOUT\x20it.\x20NO\x20resolution\x20needed\x20unless\x20you\x20WANT\x20the\x20gate;\x20add\x20guide_confirm.guard_resolutions[\x27'+Y['key']+'\x27]\x20only\x20then\x20(algr12\x20M-14).'},...Z?.['logic_summary']?{'logic_summary':Z['logic_summary']}:{},...a8?{'logic_summary_note':a8}:{},...Z?.['key_queries']?.['length']?{'key_queries':Z['key_queries']}:{},...a0!==undefined&&a0['length']>0x0?{'suggested_templates':a0}:{},'how_to_resolve':'guide_confirm.guard_resolutions[\x27'+Y['key']+'\x27]\x20=\x20{\x20kind:\x20\x27inline\x27,\x20table,\x20root\x20}\x20(a\x20resolved\x20Guard),\x20'+'or\x20{\x20kind:\x20\x27template\x27,\x20template_id:\x20\x27tpl_*\x27,\x20params\x20}\x20when\x20a\x20guard\x20template\x20matches\x20this\x20design'+(a0!==undefined&&a0['length']>0x0?'\x20(suggested_templates\x20below\x20list\x20the\x20matching\x20executable\x20forms\x20and\x20their\x20parameters)':'.')+(Y['host']==='machine'&&!a3?'\x20MACHINE-HOST\x20REQUIREMENT:\x20the\x20inline\x20table\x20MUST\x20declare\x20the\x20protocol\x20task-binding\x20slot\x20'+'{\x20identifier:\x20254,\x20b_submission:\x20true,\x20value_type:\x20\x22Address\x22\x20}\x20—\x20the\x20forward\x27s\x20passport\x20only\x20emits\x20'+'DECLARED\x20slots,\x20so\x20a\x20machine-forward\x20guard\x20without\x20this\x20row\x20aborts\x20EVERY\x20order-bound\x20forward\x20'+'it\x20gates\x20(code\x2011)\x20and\x20the\x20pre-publish\x20gate\x20blocks\x20the\x20Machine\x20publish.':'')+(a3?'\x20ALLOCATOR-RAIL\x20NOTE:\x20this\x20design\x20gates\x20an\x20allocator\x20rail\x20(not\x20a\x20machine\x20forward)\x20—\x20do\x20NOT\x20add\x20the\x20'+'254\x20task-binding\x20slot:\x20a\x20254\x20declaration\x20arms\x20once-per-order\x20replay\x20protection\x20at\x20alloc\x20time\x20'+'(allocation\x20ONCE_FOR_OBJECT)\x20and\x20permanently\x20blocks\x20multi-fire\x20rails\x20(a\x20second\x20release\x20aborts\x20'+'E_ONCE_TRIGGERED).\x20The\x20kernel\x20injects\x20254\x20ONLY\x20for\x20GuardIdentifier(254)-recipient\x20rails.'+(a2['recipient']==='guard_identifier'&&a2['recipient_key']!=='254'?'\x20This\x20rail\x27s\x20recipient\x20is\x20GuardIdentifier('+(a2['recipient_key']??'0')+')\x20—\x20the\x20inline\x20table\x20MUST\x20'+('declare\x20slot\x20'+(a2['recipient_key']??'0')+'\x20as\x20an\x20Address\x20submission\x20instead\x20(N-K21:\x20the\x20passport\x20')+'submits\x20the\x20ORDER\x20address\x20into\x20it;\x20an\x20undeclared\x20slot\x20makes\x20the\x20rail\x20unexecutable).':''):'')+(a4?'\x20ADVISORY\x20DESIGN\x20(run75747\x20F-38):\x20nothing\x20in\x20this\x20archetype\x20binds\x20this\x20key\x20—\x20no\x20machine\x20edge,\x20allocator\x20'+'rail,\x20repository\x20policy,\x20or\x20service\x20mount.\x20If\x20this\x20design\x20does\x20not\x20apply\x20to\x20your\x20shop\x20you\x20may\x20resolve\x20'+'it\x20with\x20{\x20kind:\x20\x27omit\x27\x20}\x20instead\x20of\x20building\x20a\x20Guard\x20no\x20one\x20consumes:\x20the\x20design\x20leaves\x20'+'pending_guard_designs,\x20no\x20Guard\x20object\x20is\x20created,\x20and\x20the\x20decision\x20is\x20recorded\x20in\x20the\x20build\x27s\x20'+'warnings.\x20An\x20omit\x20of\x20a\x20BOUND\x20design\x20is\x20refused\x20(GUARD_OMIT_UNSUPPORTED).':'')};}),N=x['length']>0x0||t['blocking'],O={'expiredTerminal':(j['machine_shape']??[])['some'](Y=>/expire|deadline|timeout/i['test'](String(Y?.['name']??'')))},P=checkGameTheoryConstraints(w,g,O),Q=[];for(const Y of requirementCoverage(e['intent_text'],j)){if(Y['status']==='mapped')continue;Q['push']({'id':Y['family'],'label':Y['label'],'severity':Y['status']==='blocker'&&Y['family']==='fulfillment'?'critical':'medium','message':'Intent\x20promises\x20\x27'+Y['label']+'\x27\x20(stated:\x20\x22'+Y['evidence']+'\x22)\x20but\x20the\x20matched\x20template\x20does\x20not\x20carry\x20it:\x20'+Y['note'],'fix':Y['note']});}for(const Z of A){if(Z['adopted']||Z['evidence_matched']!==![])continue;Q['push']({'id':'module_'+Z['capability'],'label':Z['capability'],'severity':'info','message':'Module\x20\x27'+Z['capability']+'\x27\x20rides\x20score\x20alone\x20(no\x20intent\x20evidence):\x20its\x20objects\x20ARE\x20included\x20in\x20this\x20build\x20—\x20an\x20UNCONFIRMED\x20adoption.','fix':'Confirm\x20via\x20guide_state.adopted_module_ids,\x20answer\x20the\x20structured\x20payment/trust\x20questions,\x20or\x20rebuild\x20with\x20an\x20adoption\x20list\x20that\x20omits\x20it.'});}const R=assessWorkflowDesign(w,{'gaps':Q}),S=buildCreationPlan(w),T=[...new Set(s['steps']['filter'](a0=>typeof a0['account']==='string')['map'](a0=>a0['account']))]['sort'](),U=[...collectLateMarks(s)]['sort'](),V=j?{'name':j['id'],'display_name':j['variant']+'\x20archetype\x20('+j['industry']+')','source':a['template_override']?'custom':'builtin','risk_appetite':'medium','key_risk':j['key_risk'],'machine_shape':j['machine_shape']['map'](a0=>({'name':a0['name'],'role':a0['role'],...a0['operator']?{'operator':a0['operator']}:{},...a0['semantic_role']?{'semantic_role':a0['semantic_role']}:{}})),'guards':j['guards']['map'](a0=>({'template_id':a0['template_id'],'host':a0['host'],'purpose':a0['purpose']})),'allocator':j['allocator'],'risk_constraints':{},'build_notes':j['build_notes']??[],...j['time_anchors']?{'time_anchors':j['time_anchors']}:{}}:undefined;return{'action':'merchant_guide','current_step':N?0x9:0xa,'step_name':N?'Harness\x20Check\x20(issues\x20found)':'Submission\x20Plan\x20Ready','guide_state':{...e,'adopted_module_ids':i['map'](a0=>a0['id'])},'intent':{'intent_type':g['intent'],'industry':g['industry'],'roles':g['roles'],'deliverables':g['deliverables'],'payment':g['payment'],'trust':g['trust']},'adopted_modules':i['map'](a0=>({'id':a0['id'],'name':a0['name'],'description':a0['description'],'requires_keeper':a0['requiresKeeper'],'keeper_hint':a0['keeperHint'],'user_protections':a0['userProtections'],'merchant_obligations':a0['merchantObligations']})),'mode_prior':V,...l['length']>0x0?{'user_input_questions':l,'user_input_note':'Collect\x20each\x20answer\x20and\x20pass\x20it\x20back\x20as\x20guide_state.fee_overrides[\x27<param_key>\x27]\x20on\x20the\x20next\x20merchant_guide\x20call;\x20unanswered\x20questions\x20keep\x20the\x20template\x20default.'}:{},...V?.['time_anchors']?{'time_anchor_instructions':Object['entries'](V['time_anchors'])['map'](([a0,a1])=>{const a2=a1['startsWith']('order.time')?'\x20(order-creation\x20time\x20—\x20PRE-checkout\x20branches\x20only;\x20a\x20post-checkout\x20window\x20anchored\x20here\x20is\x20unreachable)':a1['startsWith']('progress.current_time')?'\x20(entry\x20time\x20of\x20the\x20window\x27s\x20source\x20node\x20—\x20witness-derived\x20via\x20OrderProgress,\x20one\x20Guard\x20serves\x20every\x20order)':a1['startsWith']('absolute_date')?'\x20(per-order\x20instance\x20Guard\x20—\x20the\x20absolute\x20date\x20differs\x20per\x20booking)':'';return'Time\x20windows\x20for\x20\x27'+a0+'\x27\x20anchor\x20to\x20'+a1+a2;})}:{},'blueprint':{'nodes':w['nodes']['map'](a0=>({'id':a0['id'],'type':a0['type'],'purpose':a0['purpose']})),'edges':w['edges']['map'](a0=>({'from':a0['from'],'to':a0['to'],'relation':a0['relation'],'required':a0['required']}))},'evaluation_preview':{'estimatedRiskScore':u,'estimatedCompletenessScore':Math['min'](0x64,0x1e+i['length']*0x8),'keyRisks':t['findings']['filter'](a0=>a0['level']==='critical'||a0['level']==='high')['map'](a0=>a0['title']),'strengths':t['findings']['filter'](a0=>a0['level']==='info')['map'](a0=>a0['title']),'moduleBoosts':{}},'graph_validation':{'valid':t['issues']['length']===0x0,'hard_violations':t['issues']['map'](a0=>({'id':a0['code'],'description':a0['detail'],'fix':'Fix\x20the\x20Plan\x20structure','step':a0['step']})),'soft_notes':t['findings']['filter'](a0=>a0['level']==='medium'||a0['level']==='low')['map'](a0=>({'id':a0['rule_id'],'description':a0['title']}))},'harness_check':{'module_constraints':A['map'](a0=>{const a1=a0['capability']==='discount_lifecycle'&&a0['adopted']?'ADOPTION-BASED\x20satisfaction\x20(disclosure\x20obligations\x20accepted\x20with\x20module\x20adoption),\x20NOT\x20plan\x20structure:\x20creation_plan\x20intentionally\x20carries\x20no\x20Discount/SKU\x20nodes\x20—\x20they\x20are\x20minted\x20in\x20merchant\x20post-deploy\x20steps\x20and\x20verified\x20on-chain\x20after\x20deploy\x20(query\x20the\x20minted\x20Service.discount).\x20Reward\x20FUNDING\x20rides\x20review_mode\x20compile\x20emission,\x20BUT\x20the\x20reward\x20claim\x20GUARD\x20SPEC\x20must\x20still\x20be\x20declared\x20in\x20the\x20plan\x27s\x20guards[]\x20(host:\x27reward\x27)\x20—\x20compile\x20emits\x20the\x20rail\x20only\x20from\x20that\x20spec,\x20and\x20REVIEW_REWARD_GUARD_MISSING\x20hard-blocks\x20publish\x20when\x20it\x20is\x20omitted\x20(G-02,\x20onlyfans-mn\x20261019:\x20the\x20old\x20prose\x20denied\x20the\x20guard\x20spec\x20and\x20deadlocked\x20every\x20reward\x20publish).':a0['reason'],a2=a0['evidence_matched']===![]?a0['reason']:a1;return{'module':a0['capability'],'plan_satisfied':a0['adopted'],'missing':a0['missingConstraints'],'reason':a2,'findings':a0['findings'],'evidence_matched':a0['evidence_matched']};}),'blocking_issues':[...x['map'](a0=>({'module':a0['module'],'missing_constraints':a0['missing_constraints'],'fix':a0['fix']})),...F],'module_gaps':A['filter'](a0=>!a0['adopted'])['map'](a0=>({'module':a0['capability'],'missing_constraints':a0['missingConstraints'],'fix':a0['reason']})),'deploy_time_checks':C,'recipient_design_guidance':E},'game_theory':{'summary':P['summary'],'coverage':P['coveredCount']+'/'+P['totalCount'],'exposed_scenarios':P['exposedScenarios'],'wow_alignments':P['wowAlignments'],'scenarios':P['results']['map'](a0=>({'scenario':a0['scenario'],'covered':a0['covered'],'conflict':a0['conflict'],'user_protection':a0['userProtection'],'evaluation_metric':a0['evaluationMetric'],'recommendation':a0['recommendation']}))},'workflow_design_assessment':{'score':R['score'],'summary':R['summary'],'findings':R['findings']['map'](a0=>({'kind':a0['kind'],'severity':a0['severity'],'message':a0['message'],'fix':a0['fix']})),'checks':R['checks']['map'](a0=>({'id':a0['id'],'dimension':a0['dimension'],'passed':a0['passed'],'severity':a0['severity'],'message':a0['message'],'fix':a0['fix']}))},'creation_plan':S,'post_deploy_steps':D,...q['supplyChain']!==undefined?{'supply_chain':q['supplyChain']['map'](a0=>({'steps':a0['steps']['map'](a1=>a1['id']),'inputs':a0['inputs'],'primitives':a0['primitives'],'notes':a0['notes'],...a0['handoff']!==undefined?{'handoff':a0['handoff']}:{}}))}:{},'mandatory_disclosures':['PII\x20discipline\x20(rex5\x20B-57):\x20never\x20write\x20personal\x20data\x20(phone,\x20email,\x20exact\x20unit\x20address)\x20into\x20public\x20on-chain\x20fields\x20—\x20Contact\x20description/location/IM\x20entries,\x20repository\x20rows,\x20progress\x20messages\x20and\x20WIP\x20text\x20are\x20all\x20public.\x20Exchange\x20PII\x20over\x20the\x20encrypted\x20Messenger\x20and\x20keep\x20only\x20WTS\x20proofs\x20on\x20chain;\x20the\x20local\x20harness\x20store\x20is\x20non-private\x20too\x20(cache.db\x20holds\x20messenger\x20plaintext\x20and\x20LocalInfo\x20entries\x20unencrypted\x20on\x20disk,\x20readable\x20by\x20any\x20session\x20sharing\x20the\x20keystore).','Trust-claim\x20prose\x20is\x20not\x20a\x20chain\x20anchor\x20(rex5\x20T-31):\x20any\x20compensation-fund\x20or\x20protection\x20figure\x20quoted\x20in\x20the\x20service\x20description\x20is\x20free\x20text\x20—\x20awards\x20shrink\x20the\x20live\x20fund\x20in\x20place\x20(the\x20quoted\x20number\x20silently\x20goes\x20stale)\x20and\x20the\x20per-order\x20covered\x20ceiling\x20is\x20fund/3\x20(MAX_INDEMNITY_MULTIPLE),\x20not\x20the\x20headline.\x20Keep\x20quoted\x20numbers\x20synced\x20to\x20the\x20live\x20fund\x20balance\x20before\x20publishing\x20and\x20after\x20every\x20award.','Single-account\x20build\x20contract\x20(MN5-5R\x20decision):\x20this\x20pipeline\x20wires\x20ONLY\x20the\x20deploying\x20account\x20—\x20the\x20permission\x20layer\x27s\x20admin\x20pass-through\x20means\x20a\x20single-account\x20build\x20needs\x20zero\x20grants,\x20so\x20no\x20other\x20account\x20is\x20ever\x20granted.\x20A\x20multi-account\x20shop\x20(separate\x20keeper/staff/operator\x20accounts)\x20will\x20be\x20REFUSED\x20at\x20execution\x20time\x20(error\x20codes\x201000/1002\x20and\x20the\x20350~364\x20abort\x20family)\x20—\x20the\x20plan\x20will\x20look\x20complete\x20and\x20still\x20fail\x20on\x20first\x20non-admin\x20operation.\x20Until\x20an\x20explicit\x20account-grant\x20phase\x20ships,\x20run\x20multi-account\x20shops\x20by\x20declaring\x20the\x20limitation\x20up\x20front\x20and\x20granting\x20roles\x20manually\x20post-publish;\x20do\x20not\x20let\x20the\x20plan\x27s\x20completeness\x20imply\x20multi-account\x20readiness.'],...M['length']>0x0?{'pending_guard_designs':M}:{},...M['length']>0x0&&(s['pending_guards']?.['length']??0x0)!==M['length']?{'pending_count_note':'Two\x20counts,\x20two\x20views:\x20pending_guard_designs\x20lists\x20'+M['length']+'\x20unresolved\x20design(s)\x20(compile\x20view\x20—\x20includes\x20advisory\x20designs\x20with\x20no\x20edge/rail/policy/buy\x20mount);\x20'+('the\x20plan\x20audit\x20counts\x20'+(s['pending_guards']?.['length']??0x0)+'\x20(plan\x20view\x20—\x20site-bound\x20designs\x20only;\x20the\x20rule-pack\x20titles\x20\x22of\x20N\x20pending\x20in\x20total\x22\x20quote\x20this).\x20')+'The\x20LIST\x20is\x20the\x20resolution\x20fill\x20space;\x20the\x20audit\x20number\x20is\x20its\x20site-bound\x20subset.'}:{},'warnings':[...f['warnings'],...gasEconomicsWarnings(e['sales'],e['reward_claim_amount']),...q['omitted']['length']>0x0?['Advisory\x20guard\x20design(s)\x20omitted\x20by\x20decision\x20({kind:\x27omit\x27}):\x20'+q['omitted']['join'](',\x20')+'\x20—\x20'+'no\x20Guard\x20created,\x20nothing\x20binds\x20them\x20(run75747\x20F-38).']:[],...(q['supplyChain']??[])['flatMap']((a0,a1)=>a0['notes']['map'](a2=>'Supply-chain\x20promise\x20#'+String(a1+0x1)+':\x20'+a2)),...n['warnings']],'next_action':x['length']>0x0?'Resolve\x20the\x20blocking_issues\x20above\x20(compile\x20blockers\x20—\x20harness_check.blocking_issues\x20rows\x20with\x20module\x20\x27template\x27;\x20adjust\x20the\x20template\x20or\x20its\x20build\x20inputs),\x20then\x20call\x20merchant_guide\x20again.':t['blocking']?'The\x20plan\x20audit\x20is\x20BLOCKING\x20(see\x20harness_check.blocking_issues\x20and\x20audit.findings\x20—\x20e.g.\x20a\x20terminal\x20node\x20with\x20no\x20fund\x20exit,\x20or\x20an\x20unresolved\x20guard\x20bound\x20to\x20a\x20fund\x20path).\x20Fix\x20the\x20plan/template\x20or\x20guard\x20resolutions\x20and\x20call\x20merchant_guide\x20again;\x20do\x20NOT\x20materialize\x20this\x20plan.'+(M['length']>0x0?'\x20Pending\x20guard\x20designs:\x20'+M['length']+'\x20listed\x20in\x20pending_guard_designs\x20—\x20resolve\x20each\x20via\x20guide_confirm.guard_resolutions\x20(kind\x20\x27inline\x27\x20with\x20the\x20Guard\x20table+root,\x20kind\x20\x27template\x27\x20with\x20a\x20tpl_*\x20id,\x20or\x20{kind:\x27omit\x27}\x20for\x20advisory\x20designs\x20that\x20do\x20not\x20apply\x20to\x20this\x20shop),\x20then\x20call\x20merchant_guide\x20again.':''):K['length']>0x0?'Plan\x20is\x20structurally\x20ready,\x20but\x20'+K['length']+'\x20bound\x20guard\x20design(s)\x20('+K['map'](a0=>'\x27'+a0+'\x27')['join'](',\x20')+')\x20are\x20UNRESOLVED\x20(plan.pending_guard_designs)\x20—\x20do\x20NOT\x20materialize\x20yet:\x20an\x20unresolved\x20bound\x20design\x20ships\x20a\x20guard\x20the\x20executor\x20invents.\x20Resolve\x20each\x20via\x20guide_confirm.guard_resolutions\x20(kind\x20\x27inline\x27\x20with\x20the\x20Guard\x20table+root,\x20kind\x20\x27template\x27\x20with\x20a\x20tpl_*\x20id,\x20or\x20{kind:\x27omit\x27}\x20for\x20advisory\x20designs\x20that\x20do\x20not\x20apply\x20to\x20this\x20shop),\x20then\x20call\x20merchant_guide\x20again.':'Plan\x20ready.\x20Materialize\x20in\x20ONE\x20deterministic\x20call:\x20benchmark_migration\x20{action:\x27plan_execute\x27,\x20plan:\x20this\x20response\x27s\x20plan\x20object\x20verbatim'+(T['length']>0x0?',\x20accounts:{'+T['map'](a0=>a0+':\x20<its\x20controller\x20env>')['join'](',\x20')+'}':'')+('}\x20—\x20it\x20pre-flights\x20the\x20freeze\x20gate,\x20bind-audits\x20every\x20reference,\x20pre-resolves\x20local\x20marks,\x20slices\x20on\x20timeout_ms,\x20and\x20RESUMES\x20from\x20failures\x20(completed_steps\x20+\x20previous_outputs;\x20never\x20re-run\x20from\x20scratch\x20—\x20ghost\x20duplicates).\x20Then\x20run\x20post_deploy_steps\x20in\x20order\x20('+D['map'](a0=>a0['id'])['join'](',\x20')+').\x20WIZARD\x20CONTRACT:\x20on\x20the\x20Service\x20publish\x20call\x20(data.publish=true),\x20pass\x20this\x20exact\x20plan\x20back\x20as\x20data.creation_plan\x20—\x20the\x20publish\x20gate\x20replays\x20its\x20freeze\x20matrix\x20and\x20rejects\x20the\x20publish\x20if\x20any\x20gate\x20fails;\x20omitting\x20it\x20leaves\x20the\x20manual\x20path\x20ungated.\x20Manual\x20fallback\x20(only\x20if\x20plan_execute\x20refuses):\x20create\x20the\x20objects\x20in\x20creation_plan\x20order\x20via\x20onchain_operations,\x20then\x20run\x20post_deploy_steps\x20in\x20order.'),'plan':((()=>{const a0=templateCatalogDigest(String(s['templateId']??''));return{...s,...a0!==undefined?{'template_digest':a0}:{},'catalog_version':BUILTIN_TEMPLATES_VERSION};})()),...U['length']>0x0?{'required_local_marks':U,'required_local_marks_note':'plan_execute\x20(the\x20default\x20materializer\x20above)\x20resolves\x20each\x20of\x20these\x20local\x20names\x20against\x20the\x20LocalMark\x20store\x20of\x20the\x20target\x20network\x20and\x20refuses\x20to\x20execute\x20while\x20any\x20is\x20unregistered.\x20'+'Register\x20them\x20BEFORE\x20executing\x20(local_mark_operation\x20add).\x20A\x20name\x20that\x20matches\x20an\x20object\x20this\x20plan\x20itself\x20creates\x20is\x20bound\x20to\x20that\x20object\x20automatically.\x20'+'A\x20recipient\x20mark\x20must\x20point\x20at\x20a\x20real\x20account\x20address:\x20an\x20empty\x20name\x20makes\x20the\x20SDK\x20substitute\x20the\x20deploying\x20account,\x20and\x20an\x20object-id\x20/\x20zero-address\x20recipient\x20is\x20transferred\x20and\x20cannot\x20be\x20retrieved.'}:{},...n['steps']['length']>0x0?{'wip_source_steps':n['steps'],'wip_source_steps_note':'Execute-time\x20obligations\x20created\x20by\x20fee_overrides[\x27product_detail_source\x27].\x20A\x20URL\x20source\x20binds\x20sale.wip\x20directly\x20(wip_hash\x20stays\x20\x22\x22\x20until\x20pinned\x20—\x20pin\x20via\x20wip_file\x20verify\x20+\x20sales.op:\x27wip_set\x27);\x20a\x20local\x20source\x20is\x20already\x20hash-pinned\x20at\x20generate\x20time\x20but\x20MUST\x20be\x20hosted\x20publicly\x20and\x20rebound\x20before\x20customers\x20can\x20buy.\x20Both\x20are\x20ordinary\x20onchain_operations\x20calls,\x20not\x20plan\x20steps\x20—\x20run\x20them\x20in\x20the\x20order\x20given.'}:{},'audit':{'issues':t['issues'],'findings':t['findings'],'blocking':t['blocking'],'score':u},'reflux':{'applied':r['applied'],'blocks':r['blocks'],'iterations':r['iterations']}};}
@@ -1 +1 @@
1
- import{matchScenarioMode}from'../../knowledge/scenario-modes.js';import{getTemplate,listTemplates,platformShareBps}from'../../knowledge/template-loader.js';import{scanTemplate}from'../../knowledge/template-scanner.js';import{discoveryTagsForTemplate,TEMPLATE_KEYWORDS}from'../../knowledge/builtin-templates.js';import{buildTemplateIndex,resolveByProductRef}from'../../knowledge/template-index.js';import{requirementCoverage}from'../../knowledge/requirement-families.js';export function matchTemplate(a,b,c){const e=c?.['english_summary']?a+'\x0a'+c['english_summary']:a,f=e['toLowerCase'](),{templates:g}=listTemplates(),h=buildTemplateIndex(g);if(c?.['product_ref']){const q=c['industry']?g['filter'](u=>u['industry']===c['industry']):g,r=q['length']>0x0?q:g,s=r['find'](u=>u['product_ref']?.['toLowerCase']()===c['product_ref']);if(s)return{'template':s,'confidence':0x1,'source':'discovery_product_ref'};}const i=resolveByProductRef(h,e);if(i){const t=g['find'](u=>u['id']===i);if(t)return{'template':t,'confidence':0x1,'source':'product_ref'};}const j=c?.['industry']??b,k=j?g['filter'](u=>u['industry']===j):g,l=k['length']>0x0?k:g,m=j!==undefined&&k['length']>0x0;if(c&&c['tags']['length']>0x0){const u=c['industry']?0x1:0x2,v=l['map'](x=>{const y=new Set(discoveryTagsForTemplate(x['id']));return{'template':x,'matched':c['tags']['filter'](z=>y['has'](z))};})['filter'](x=>x['matched']['length']>=u)['sort']((x,y)=>{if(y['matched']['length']!==x['matched']['length'])return y['matched']['length']-x['matched']['length'];const z=j!==undefined&&x['template']['industry']===j?0x1:0x0,A=j!==undefined&&y['template']['industry']===j?0x1:0x0;if(A!==z)return A-z;return x['template']['id']['localeCompare'](y['template']['id']);}),w=v[0x0];if(w){const x=w['matched']['length']/c['tags']['length'],y=j!==undefined&&w['template']['industry']===j?0.1:0x0,z=Math['min'](0.9,Number((0.45+0.55*x+y)['toFixed'](0x4)));return{'template':w['template'],'confidence':z,'source':'discovery_tags','matched_tags':w['matched']};}}const {mode:n,confidence:o}=matchScenarioMode(e);let p;for(const A of l){const B=TEMPLATE_KEYWORDS[A['id']]??[],C=discoveryTagsForTemplate(A['id']);let D=0x0;for(const F of B){if(f['includes'](F))D+=0x1;}for(const G of C){if(f['includes'](G))D+=0x1;}if(n['name']===A['industry'])D+=o;const E=B['length']+C['length']+0x1;if(!p||D>p['score'])p={'template':A,'score':D,'max':E};}if(p&&p['score']>0x0)return{'template':p['template'],'confidence':Math['min'](0x1,p['score']/p['max']),'source':'keywords'};if(m){const H=l['find'](I=>I['archetype']==='leader')??l[0x0];return{'template':H,'confidence':0.35,'source':'ir_industry_fallback'};}return undefined;}function dryRunRiskCheck(a){const b=scanTemplate(a),c=b['red_flags'];return{'passed':c['length']===0x0,'findings':b['findings']['map'](d=>'['+d['severity']+']\x20'+(d['rule_id']??'scan')+':\x20'+d['title']+'\x20—\x20'+d['suggestion'])};}function genericMappedEntries(a){return[{'source_element':'Order\x20lifecycle\x20/\x20status\x20flow','target_object':'Machine','mapping_note':a['machine_shape']['length']+'-node\x20workflow\x20adopted\x20from\x20the\x20'+a['id']+'\x20template'},{'source_element':'Business\x20rules\x20and\x20time\x20windows','target_object':'Guard','mapping_note':a['guards']['length']+'\x20guard\x20templates\x20carry\x20the\x20rule\x20parameters\x20as\x20immutable\x20on-chain\x20conditions'},{'source_element':'Payment\x20split\x20/\x20settlement','target_object':'Allocator','mapping_note':a['allocator']['description']},{'source_element':'Refund\x20policy','target_object':'Allocator\x20(refund\x20route)','mapping_note':'Refunds\x20route\x20via\x20Allocators\x20triggered\x20by\x20business\x20states\x20—\x20never\x20Machine\x20terminal\x20nodes\x20(R-M1-11)'},{'source_element':'Dispute\x20resolution','target_object':'Arbitration','mapping_note':'Independent\x20Arbitration\x20object\x20with\x20its\x20own\x20Permission\x20—\x20disputes\x20flow\x20off-Machine'},{'source_element':'Operator\x20roles\x20(staff/fulfiller/finance)','target_object':'Permission','mapping_note':'Role\x20slots\x20as\x20Permission\x20entities;\x20the\x20order\x20payer\x20acts\x20as\x20the\x20named\x20operator\x20without\x20occupying\x20a\x20slot'},{'source_element':'Evidence\x20and\x20records','target_object':'Repository','mapping_note':'Write-guarded\x20Repository\x20policies\x20anchor\x20evidence\x20hashes\x20(delivery,\x20inspection,\x20settlement\x20ledger)'},{'source_element':'Service\x20listing\x20and\x20pricing','target_object':'Service','mapping_note':'Service\x20carries\x20the\x20sale\x20structure,\x20buy\x20gate,\x20and\x20bound\x20Machine/Guards/Arbitration\x20before\x20publish'}];}function genericUnmappedEntries(a){const b=[{'source_element':'Incumbent\x20platform\x20internal\x20ranking\x20/\x20search\x20algorithm','mapping_note':'Marketplace\x20discovery\x20logic\x20has\x20no\x20on-chain\x20equivalent','reason':'Off-chain\x20platform\x20intelligence\x20—\x20use\x20the\x20WoWok\x20market\x20layer\x20(demand\x20matching)\x20instead'},{'source_element':'Incumbent\x20platform\x20user\x20account\x20/\x20login\x20system','mapping_note':'Identity\x20lives\x20in\x20wallets\x20and\x20Passports,\x20not\x20platform\x20accounts','reason':'WoWok\x20is\x20account-less\x20by\x20design\x20—\x20addresses\x20+\x20Passports\x20replace\x20platform\x20logins'},{'source_element':'Automatic\x20recurring\x20charges\x20(card\x20auto-debit)','mapping_note':'Recurring\x20charges\x20are\x20replaced\x20by\x20explicit\x20per-period\x20subscriber\x20signatures','reason':'Silent\x20auto-charge\x20is\x20an\x20anti-pattern\x20on\x20WoWok\x20—\x20renewal\x20requires\x20the\x20payer\x27s\x20signature\x20every\x20period'}];return a['industry']==='subscription'&&b['push']({'source_element':'Content\x20moderation\x20/\x20takedown\x20pipeline','mapping_note':'Only\x20content\x20hashes\x20live\x20on-chain;\x20content\x20bodies\x20stay\x20off-chain','reason':'Content\x20governance\x20is\x20structurally\x20out\x20of\x20scope\x20for\x20on-chain\x20objects\x20—\x20handle\x20it\x20at\x20the\x20hosting\x20layer'}),(a['industry']==='retail'||a['industry']==='rental')&&b['push']({'source_element':'Physical\x20logistics\x20/\x20courier\x20integration','mapping_note':'Logistics\x20stays\x20off-chain;\x20tracking\x20evidence\x20is\x20anchored\x20via\x20WIP\x20hashes','reason':'Carriers\x20are\x20external\x20systems\x20—\x20the\x20Machine\x20consumes\x20their\x20evidence,\x20not\x20their\x20API'}),b;}function manualReviewEntries(a){const b=[{'source_element':'Fee\x20and\x20split\x20parameters','mapping_note':'Template\x20defaults:\x20'+Object['entries'](a['fee_params'])['map'](([c,d])=>c+'='+d)['join'](',\x20'),'reason':'Confirm\x20or\x20override\x20each\x20parameter\x20before\x20generation'},{'source_element':'Operating\x20role','mapping_note':'Recommended:\x20'+a['recommended_role']+'\x20—\x20'+a['role_rationale'],'reason':'The\x20user\x20may\x20switch\x20role\x20(merchant\x20<->\x20supplier)\x20before\x20apply'},{'source_element':'Target\x20network','mapping_note':'Default\x20testnet\x20for\x20the\x20first\x20deployment','reason':'Mainnet\x20deployment\x20requires\x20explicit\x20user\x20confirmation'}];return a['keeper_dependencies']['length']>0x0&&b['push']({'source_element':'Off-chain\x20keeper\x20operations','mapping_note':'Declared\x20keepers:\x20'+a['keeper_dependencies']['join'](';\x20'),'reason':'Time-driven\x20transitions\x20only\x20ALLOW\x20advancement\x20—\x20someone\x20must\x20run\x20the\x20keepers'}),a['keeper_duty']&&a['keeper_duty']['length']>0x0&&b['push']({'source_element':'Keeper\x20duty\x20runbook','mapping_note':a['keeper_duty']['map'](c=>'WHEN\x20'+c['when']+'\x20->\x20'+c['action']+'\x20(if\x20missed:\x20'+c['miss_consequence']+')')['join'](';\x20'),'reason':'A\x20missed\x20duty\x20strands\x20an\x20order\x20or\x20funds\x20—\x20each\x20row\x20is\x20an\x20operating\x20obligation\x20of\x20this\x20build'}),b;}const FACT_PATTERNS=[{'pattern':/\b(?:coupon|promo(?:\s*code)?|discount\s*code|voucher)\b/i,'fact':{'label':'Coupons\x20/\x20promo\x20codes','note':'Maps\x20to\x20a\x20Discount\x20object\x20minted\x20on\x20the\x20Service\x20(budget\x20=\x20max_uses\x20x\x20value;\x20coupons\x20are\x20BURNED\x20on\x20use\x20—\x20never\x20restocked\x20or\x20refunded).\x20Decide\x20the\x20coupon\x20budget\x20and\x20eligibility\x20guard\x20before\x20apply.','disposition':'manual_review'}},{'pattern':/\breview\s+(?:reward|bounty|incentive)|\bincentiv\w+\s+reviews?\b|\bbonus\s+for\s+(?:a\s+)?reviews?\b/i,'fact':{'label':'Review\x20rewards\x20/\x20bounties','note':'Maps\x20to\x20a\x20funded\x20Reward\x20object\x20+\x20claim\x20guard\x20(generation\x20input\x20review_mode=\x27review_reward\x27).\x20The\x20reward\x20pool\x20MUST\x20be\x20funded\x20at\x20generation\x20time\x20(reward_funding\x20input)\x20—\x20an\x20unfunded\x20promise\x20is\x20refused.','disposition':'manual_review'}},{'pattern':/\breturn\s+(?:window|policy)|\b\d{1,3}[\s-]?day\s+returns?\b/i,'fact':{'label':'Return\x20window\x20/\x20policy','note':'Maps\x20to\x20the\x20template\x27s\x20return-window\x20guard\x20knob\x20(return_window_days\x20fee_param).\x20Compare\x20the\x20stated\x20number\x20against\x20the\x20template\x20default\x20before\x20apply\x20—\x20the\x20guard\x20binds\x20only\x20the\x20embedded\x20constant.','disposition':'manual_review'}},{'pattern':/\ba[\s-]?to[\s-]?z\b|\bbuyer\s+protection\b|\bguarantee\s+program\b/i,'fact':{'label':'Platform\x20guarantee\x20program\x20(A-to-z\x20style)','note':'Maps\x20to\x20the\x20independent\x20Arbitration\x20venue\x20plus\x20the\x20order-side\x20claim\x20rails.\x20The\x20refund-vs-award\x20exits\x20must\x20be\x20confirmed\x20at\x20guard\x20resolution\x20—\x20the\x20venue\x20itself\x20moves\x20no\x20funds.','disposition':'manual_review'}},{'pattern':/\b(?:multiple|third[- ]party)\s+sellers?\b|\bper[- ]product\s+split\b|\bmulti[- ]seller\b/i,'fact':{'label':'Multi-seller\x20per-product\x20settlement','note':'NOT\x20supported:\x20one\x20Service/Allocation\x20settles\x20ONE\x20merchant\x27s\x20split.\x20Multi-seller\x20needs\x20one\x20Service\x20per\x20seller\x20(archived\x20framework\x20boundary)\x20—\x20disclose\x20this\x20to\x20the\x20migrating\x20merchant\x20instead\x20of\x20generating\x20a\x20shop\x20that\x20cannot\x20pay\x20out.','disposition':'unmapped'}},{'pattern':/\bsales\s+tax\b|\bVAT\b|\bGST\b/i,'fact':{'label':'Sales\x20tax\x20/\x20VAT\x20handling','note':'NOT\x20supported\x20on-chain:\x20tax\x20remittance\x20is\x20an\x20off-chain\x20compliance\x20flow\x20(archived\x20framework\x20boundary).\x20Disclose;\x20do\x20not\x20model\x20it\x20as\x20a\x20split\x20row.','disposition':'unmapped'}}];function extractSplitMention(a){const b=a;let c=b['match'](/\b(?:platform|service|commission|take)\s*(?:fee|commission|rate|cut)?\s*(?:of|is|at|:)?\s*(\d{1,3}(?:\.\d+)?)\s*%/i)??b['match'](/(\d{1,3}(?:\.\d+)?)\s*%\s*(?:platform\s+)?(?:commission|service\s*fee|take|cut)\b/i);if(c)return{'statedPct':Number(c[0x1]),'raw':c[0x0],'certain':!![]};c=b['match'](/(\d{1,3}(?:\.\d+)?)\s*%\s*(?:goes\s+to|to|for)\s+the\s+(?:merchant|seller|creator|freelancer|artist)/i)??b['match'](/\b(?:merchant|seller|creator|freelancer|artist)s?\s+(?:keep|get|receive|earn)\s+(\d{1,3}(?:\.\d+)?)\s*%/i);if(c)return{'statedPct':0x64-Number(c[0x1]),'raw':c[0x0],'certain':!![]};c=b['match'](/\b(\d{1,3})\s*[/\u2013\u2014-]\s*(\d{1,3})\b(?:\s*%?\s*(?:split|revenue\s*share|share|revenue\s*split))?/i);if(c&&/split|revenue|share|commission/i['test'](b))return{'raw':c[0x0],'certain':![]};return undefined;}function splitConflictEntry(a,b){const c=extractSplitMention(b);if(!c)return undefined;const d=platformShareBps(a['fee_params']),e=d===undefined?undefined:d/0x64;if(e===undefined)return undefined;const f=Object['keys'](a['fee_params'])['find'](h=>/(?:platform|commission|service_fee)[a-z_]*_bps$/['test'](h)&&!/^attributed_/['test'](h));if(c['certain']&&c['statedPct']!==undefined&&Math['abs'](c['statedPct']-e)<0.01)return undefined;const g=c['certain']&&c['statedPct']!==undefined?c['statedPct']+'%\x20platform\x20share':'an\x20orientation-ambiguous\x20ratio\x20('+c['raw']+'\x20—\x20which\x20side\x20is\x20the\x20platform\x20is\x20not\x20stated)';return{'source_element':'Platform\x20commission\x20stated\x20in\x20the\x20description','mapping_note':'Your\x20description\x20states\x20'+g+';\x20template\x20\x27'+a['id']+'\x27\x20defaults\x20to\x20a\x20'+(e+'%\x20platform\x20share\x20(fee_params\x20'+(f??'platform_commission_bps')+'\x20=\x20'+(d??0x0)+'\x20bps).\x20')+'These\x20differ\x20—\x20the\x20template\x20default\x20wins\x20silently\x20unless\x20you\x20override\x20it.','reason':'Confirm\x20the\x20intended\x20split.\x20To\x20apply\x20the\x20stated\x20number,\x20pass\x20'+('fee_overrides[\x22'+(f??'platform_commission_bps')+'\x22]\x20=\x20'+(c['statedPct']!==undefined&&c['certain']?Math['round'](c['statedPct']*0x64):'<bps>')+'\x20')+'(basis\x20points)\x20on\x20template_generate\x20/\x20migration_apply;\x20to\x20keep\x20the\x20template\x20default,\x20ignore\x20this\x20entry.\x20'+'A\x20wrong\x20split\x20lands\x20as\x20a\x20live\x20allocator\x20row\x20and\x20order_allocators\x20is\x20frozen\x20at\x20publish.'};}const SPLIT_ORDER_PATTERNS=[/\b(?:multiple|several|many|\d+)\s+(?:pickup|collection|self[- ]pick(?:up)?)\s*(?:points?|locations?|stations?|sites?)/i,/\b(?:per|each|every)[-\s](?:pickup|collection)?[-\s]?point\b/i,/\b(?:group[- ]?buy(?:ing)?|community)\s+leaders?\b/i,/\brefund\s+(?:only\s+)?(?:some|part)\s+(?:of\s+)?(?:the\s+)?items?\b/i,/\breturn\s+(?:some|part)\s+of\s+(?:the\s+)?items?\b/i,/\b(?:refund|return)\s+\d+\s+of\s+\d+\s+items?\b/i,/\bper[- ]item\s+(?:refund|return|after[- ]?sales)\b/i];function splitOrderRecipeEntry(a){if(!SPLIT_ORDER_PATTERNS['some'](b=>b['test'](a)))return undefined;return{'source_element':'Multi-pickup-point\x20/\x20per-item\x20after-sales\x20(object-model\x20boundary)','mapping_note':'RECIPE\x20—\x20same-Service\x20split\x20orders\x20(expressible\x20TODAY):\x20keep\x20ONE\x20Service\x20as\x20the\x20storefront\x20and\x20'+'create\x20ONE\x20Order\x20per\x20pickup\x20point\x20(or\x20per\x20item\x20batch).\x20Each\x20Order\x20carries\x20its\x20own\x20escrow,\x20its\x20own\x20'+'time\x20windows\x20(a\x20per-point\x20cutoff\x20is\x20that\x20Order\x27s\x20time-lock\x20guard)\x20and\x20its\x20own\x20settlement/refund\x20'+'rails\x20—\x20no\x20topology\x20change,\x20no\x20new\x20primitive.\x20Per-item\x20partial\x20after-sales\x20rides\x20the\x20same\x20split:\x20'+'the\x20buyer\x20refunds/returns\x20per\x20Order\x20and\x20each\x20Order\x27s\x20escrow\x20settles\x20independently.\x20Generate\x20the\x20'+'Service\x20ONCE,\x20then\x20open\x20one\x20order\x20per\x20point\x20via\x20the\x20normal\x20buy\x20flow.','reason':'Chain\x20object-model\x20boundary:\x20an\x20Order\x20has\x20no\x20product\x20lines\x20or\x20point\x20sub-objects,\x20so\x20per-line\x20'+'amounts/cutoffs\x20inside\x20ONE\x20order\x20cannot\x20be\x20expressed\x20in\x20guard\x20data\x20(template\x20ruling,\x20ISSUES\x20paper\x204).\x20'+'Honest\x20costs\x20of\x20the\x20recipe:\x20object\x20count\x20scales\x20with\x20points;\x20cross-order\x20consistency\x20is\x20the\x20CLIENT\x27s\x20'+'duty\x20(no\x20atomic\x20multi-order\x20purchase);\x20campaign\x20aggregation\x20(crowdfunding\x20threshold\x20/\x20leader\x20roster)\x20'+'loses\x20its\x20single-object\x20view\x20—\x20compute\x20per-point\x20sums\x20client-side.\x20The\x20OrderLine\x20sub-object\x20primitive\x20'+'is\x20registered\x20on\x20the\x20protocol\x20train\x20(scheduled\x20after\x20the\x20machine.patch\x20paper)\x20—\x20re-check\x20the\x20train\x20'+'before\x20hand-building\x20aggregates.'};}function disclosedFactEntries(a,b,c){const d=[],e=[],f=new Set([...b,...c]['map'](g=>g['source_element']['toLowerCase']()));for(const {pattern:g,fact:h}of FACT_PATTERNS){if(!g['test'](a))continue;if(f['has'](h['label']['toLowerCase']()))continue;f['add'](h['label']['toLowerCase']());const i={'source_element':h['label'],'mapping_note':'Stated\x20in\x20your\x20description\x20—\x20the\x20deterministic\x20planner\x20does\x20not\x20map\x20it\x20automatically.\x20'+h['note'],'reason':'Explicit\x20disclosure\x20(amz9\x20A-3):\x20stated\x20commerce\x20facts\x20must\x20never\x20be\x20silently\x20dropped.\x20Confirm\x20or\x20decline\x20this\x20item\x20before\x20migration_apply.'};if(h['disposition']==='unmapped')e['push'](i);else d['push'](i);}return{'manual':d,'unmapped':e};}function wowokAdvantages(a){const b=['Every\x20rule\x20is\x20an\x20immutable\x20on-chain\x20Guard\x20—\x20customers\x20can\x20verify\x20the\x20exact\x20policy\x20before\x20paying','Disputes\x20resolve\x20through\x20independent\x20Arbitration\x20with\x20a\x20funded\x20compensation\x20pool','Fund\x20splits\x20execute\x20by\x20contract\x20at\x20the\x20configured\x20release\x20points\x20—\x20no\x20platform\x20discretion'];return a['industry']==='subscription'&&b['push']('Per-period\x20explicit-signature\x20renewal\x20—\x20the\x20anti-auto-renew\x20trap\x20is\x20a\x20selling\x20point'),a['industry']==='freelance'&&b['push']('Chain-verifiable\x200%\x20(or\x20low)\x20commission\x20via\x20the\x20allocator\x20split\x20itself'),a['industry']==='travel'&&b['push']('Two-tier\x20allocation\x20pays\x20each\x20supplier\x20at\x20its\x20own\x20segment\x20release\x20—\x20multi-party\x20transparency'),a['industry']==='education'&&b['push']('Regulatory\x20prepay\x20caps\x20and\x20per-session\x20release\x20protect\x20students\x20from\x20run-away\x20institutions'),a['industry']==='rental'&&b['push']('Deposit\x20escrow\x20+\x20evidence-gated\x20deduction\x20—\x20neither\x20side\x20can\x20unilaterally\x20seize\x20the\x20deposit'),a['industry']==='retail'&&b['push']('Escrow\x20+\x20confirm-on-receipt\x20release\x20—\x20the\x20buyer\x27s\x20confirmation\x20is\x20the\x20only\x20release\x20trigger'),b;}function customizableModules(a){const b=['independent_arbitration','refund_guarantee','reputation_on_chain','wip_provenance'];switch(a['industry']){case'freelance':return[...b,'milestone_escrow','accept_timeout_protection'];case'rental':return[...b,'damage_attestation'];case'education':return[...b,'accept_timeout_protection'];case'travel':return[...b,'multi_tier_allocation','supplier_collaboration'];case'subscription':return[...b,'subscription_with_proof'];case'retail':return[...b,'accept_timeout_protection'];default:return b;}}export function planMigration(a){const b=a['ir_discovery']?a['industry']?{...a['ir_discovery'],'industry':a['industry']}:a['ir_discovery']:undefined;let c,d={'source':'explicit','confidence':0x1};if(a['template_id']){c=getTemplate(a['template_id']);if(c&&a['industry']&&c['industry']!==a['industry']){const j=matchTemplate(a['industry']+'\x20'+a['description'],undefined,b);j&&j['template']['industry']===a['industry']&&(c=j['template'],d={'source':j['source'],'confidence':j['confidence'],...j['matched_tags']?{'matched_tags':j['matched_tags']}:{}});}}else{const k=a['industry']?a['industry']+'\x20'+a['description']:a['description'],l=matchTemplate(k,a['industry']?undefined:a['ir_industry'],b);c=l?.['template'];l&&(d={'source':l['source'],'confidence':l['confidence'],...l['matched_tags']?{'matched_tags':l['matched_tags']}:{}});if(!c&&a['industry']){c=listTemplates()['templates']['find'](m=>m['industry']===a['industry']&&m['archetype']==='leader');if(c)d={'source':'industry_leader','confidence':0.35};}}if(!c)return undefined;const e=manualReviewEntries(c),f=genericUnmappedEntries(c),g=splitConflictEntry(c,a['description']);if(g)e['unshift'](g);const h=disclosedFactEntries(a['description'],e,f);e['push'](...h['manual']),f['push'](...h['unmapped']);const i=splitOrderRecipeEntry(a['description']);if(i)e['push'](i);return{'source':{'url':a['url'],'description':a['description'],'detected_industry':c['industry'],'matched_template':c['id']},'template_match':d,'mapped':genericMappedEntries(c),'unmapped':f,'manual_review':e,'wowok_advantages':wowokAdvantages(c),'customizable_modules':customizableModules(c),'role_assessment':{'recommended':c['recommended_role'],'rationale':c['role_rationale'],'alternatives':['merchant','supplier','both']['filter'](m=>m!==c['recommended_role'])},'risk_check':dryRunRiskCheck(c),'requirement_coverage':requirementCoverage(a['description'],c),...c['conditional_guards']?.['length']?{'questions':[...new Set(c['conditional_guards']['map'](m=>m['param']))]['map'](m=>{const n=c['conditional_guards']['find'](o=>o['param']===m);return{'param':m,'question':n['question'],'options':[...n['values']],'default':String(c['fee_params'][m]??'')};})}:{},'network':a['network']??'testnet'};}
1
+ import{matchScenarioMode}from'../../knowledge/scenario-modes.js';import{getTemplate,listTemplates,platformShareBps}from'../../knowledge/template-loader.js';import{scanTemplate}from'../../knowledge/template-scanner.js';import{discoveryTagsForTemplate,TEMPLATE_KEYWORDS}from'../../knowledge/builtin-templates.js';import{buildTemplateIndex,resolveByProductRef}from'../../knowledge/template-index.js';import{requirementCoverage}from'../../knowledge/requirement-families.js';export function matchTemplate(a,b,c){const e=c?.['english_summary']?a+'\x0a'+c['english_summary']:a,f=e['toLowerCase'](),{templates:g}=listTemplates(),h=buildTemplateIndex(g);if(c?.['product_ref']){const q=c['industry']?g['filter'](u=>u['industry']===c['industry']):g,r=q['length']>0x0?q:g,s=r['find'](u=>u['product_ref']?.['toLowerCase']()===c['product_ref']);if(s)return{'template':s,'confidence':0x1,'source':'discovery_product_ref'};}const i=resolveByProductRef(h,e);if(i){const t=g['find'](u=>u['id']===i);if(t)return{'template':t,'confidence':0x1,'source':'product_ref'};}const j=c?.['industry']??b,k=j?g['filter'](u=>u['industry']===j):g,l=k['length']>0x0?k:g,m=j!==undefined&&k['length']>0x0;if(c&&c['tags']['length']>0x0){const u=c['industry']?0x1:0x2,v=l['map'](x=>{const y=new Set(discoveryTagsForTemplate(x['id']));return{'template':x,'matched':c['tags']['filter'](z=>y['has'](z))};})['filter'](x=>x['matched']['length']>=u)['sort']((x,y)=>{if(y['matched']['length']!==x['matched']['length'])return y['matched']['length']-x['matched']['length'];const z=j!==undefined&&x['template']['industry']===j?0x1:0x0,A=j!==undefined&&y['template']['industry']===j?0x1:0x0;if(A!==z)return A-z;return x['template']['id']['localeCompare'](y['template']['id']);}),w=v[0x0];if(w){const x=w['matched']['length']/c['tags']['length'],y=j!==undefined&&w['template']['industry']===j?0.1:0x0,z=Math['min'](0.9,Number((0.45+0.55*x+y)['toFixed'](0x4)));return{'template':w['template'],'confidence':z,'source':'discovery_tags','matched_tags':w['matched']};}}const {mode:n,confidence:o}=matchScenarioMode(e);let p;for(const A of l){const B=TEMPLATE_KEYWORDS[A['id']]??[],C=discoveryTagsForTemplate(A['id']);let D=0x0;for(const F of B){if(f['includes'](F))D+=0x1;}for(const G of C){if(f['includes'](G))D+=0x1;}if(n['name']===A['industry'])D+=o;const E=B['length']+C['length']+0x1;if(!p||D>p['score'])p={'template':A,'score':D,'max':E};}if(p&&p['score']>0x0)return{'template':p['template'],'confidence':Math['min'](0x1,p['score']/p['max']),'source':'keywords'};if(m){const H=l['find'](I=>I['archetype']==='leader')??l[0x0];return{'template':H,'confidence':0.35,'source':'ir_industry_fallback'};}return undefined;}function dryRunRiskCheck(a){const b=scanTemplate(a),c=b['red_flags'];return{'passed':c['length']===0x0,'findings':b['findings']['map'](d=>'['+d['severity']+']\x20'+(d['rule_id']??'scan')+':\x20'+d['title']+'\x20—\x20'+d['suggestion'])};}function genericMappedEntries(a){return[{'source_element':'Order\x20lifecycle\x20/\x20status\x20flow','target_object':'Machine','mapping_note':a['machine_shape']['length']+'-node\x20workflow\x20adopted\x20from\x20the\x20'+a['id']+'\x20template'},{'source_element':'Business\x20rules\x20and\x20time\x20windows','target_object':'Guard','mapping_note':a['guards']['length']+'\x20guard\x20templates\x20carry\x20the\x20rule\x20parameters\x20as\x20immutable\x20on-chain\x20conditions'},{'source_element':'Payment\x20split\x20/\x20settlement','target_object':'Allocator','mapping_note':a['allocator']['description']},{'source_element':'Refund\x20policy','target_object':'Allocator\x20(refund\x20route)','mapping_note':'Refunds\x20route\x20via\x20Allocators\x20triggered\x20by\x20business\x20states\x20—\x20never\x20Machine\x20terminal\x20nodes\x20(R-M1-11)'},{'source_element':'Dispute\x20resolution','target_object':'Arbitration','mapping_note':'Independent\x20Arbitration\x20object\x20with\x20its\x20own\x20Permission\x20—\x20disputes\x20flow\x20off-Machine'},{'source_element':'Operator\x20roles\x20(staff/fulfiller/finance)','target_object':'Permission','mapping_note':'Role\x20slots\x20as\x20Permission\x20entities;\x20the\x20order\x20payer\x20acts\x20as\x20the\x20named\x20operator\x20without\x20occupying\x20a\x20slot'},{'source_element':'Evidence\x20and\x20records','target_object':'Repository','mapping_note':'Write-guarded\x20Repository\x20policies\x20anchor\x20evidence\x20hashes\x20(delivery,\x20inspection,\x20settlement\x20ledger)'},{'source_element':'Service\x20listing\x20and\x20pricing','target_object':'Service','mapping_note':'Service\x20carries\x20the\x20sale\x20structure,\x20buy\x20gate,\x20and\x20bound\x20Machine/Guards/Arbitration\x20before\x20publish'}];}function genericUnmappedEntries(a){const b=[{'source_element':'Incumbent\x20platform\x20internal\x20ranking\x20/\x20search\x20algorithm','mapping_note':'Marketplace\x20discovery\x20logic\x20has\x20no\x20on-chain\x20equivalent','reason':'Off-chain\x20platform\x20intelligence\x20—\x20use\x20the\x20WoWok\x20market\x20layer\x20(demand\x20matching)\x20instead'},{'source_element':'Incumbent\x20platform\x20user\x20account\x20/\x20login\x20system','mapping_note':'Identity\x20lives\x20in\x20wallets\x20and\x20Passports,\x20not\x20platform\x20accounts','reason':'WoWok\x20is\x20account-less\x20by\x20design\x20—\x20addresses\x20+\x20Passports\x20replace\x20platform\x20logins'},{'source_element':'Automatic\x20recurring\x20charges\x20(card\x20auto-debit)','mapping_note':'Recurring\x20charges\x20are\x20replaced\x20by\x20explicit\x20per-period\x20subscriber\x20signatures','reason':'Silent\x20auto-charge\x20is\x20an\x20anti-pattern\x20on\x20WoWok\x20—\x20renewal\x20requires\x20the\x20payer\x27s\x20signature\x20every\x20period'}];return a['industry']==='subscription'&&b['push']({'source_element':'Content\x20moderation\x20/\x20takedown\x20pipeline','mapping_note':'Only\x20content\x20hashes\x20live\x20on-chain;\x20content\x20bodies\x20stay\x20off-chain','reason':'Content\x20governance\x20is\x20structurally\x20out\x20of\x20scope\x20for\x20on-chain\x20objects\x20—\x20handle\x20it\x20at\x20the\x20hosting\x20layer'}),(a['industry']==='retail'||a['industry']==='rental')&&b['push']({'source_element':'Physical\x20logistics\x20/\x20courier\x20integration','mapping_note':'Logistics\x20stays\x20off-chain;\x20tracking\x20evidence\x20is\x20anchored\x20via\x20WIP\x20hashes','reason':'Carriers\x20are\x20external\x20systems\x20—\x20the\x20Machine\x20consumes\x20their\x20evidence,\x20not\x20their\x20API'}),b;}function manualReviewEntries(a){const b=[{'source_element':'Fee\x20and\x20split\x20parameters','mapping_note':'Template\x20defaults:\x20'+Object['entries'](a['fee_params'])['map'](([c,d])=>c+'='+d)['join'](',\x20'),'reason':'Confirm\x20or\x20override\x20each\x20parameter\x20before\x20generation'},{'source_element':'Operating\x20role','mapping_note':'Recommended:\x20'+a['recommended_role']+'\x20—\x20'+a['role_rationale'],'reason':'The\x20user\x20may\x20switch\x20role\x20(merchant\x20<->\x20supplier)\x20before\x20apply'},{'source_element':'Target\x20network','mapping_note':'Default\x20testnet\x20for\x20the\x20first\x20deployment','reason':'Mainnet\x20deployment\x20requires\x20explicit\x20user\x20confirmation'}];return a['keeper_dependencies']['length']>0x0&&b['push']({'source_element':'Off-chain\x20keeper\x20operations','mapping_note':'Declared\x20keepers:\x20'+a['keeper_dependencies']['join'](';\x20'),'reason':'Time-driven\x20transitions\x20only\x20ALLOW\x20advancement\x20—\x20someone\x20must\x20run\x20the\x20keepers'}),a['keeper_duty']&&a['keeper_duty']['length']>0x0&&b['push']({'source_element':'Keeper\x20duty\x20runbook','mapping_note':a['keeper_duty']['map'](c=>'WHEN\x20'+c['when']+'\x20->\x20'+c['action']+'\x20(if\x20missed:\x20'+c['miss_consequence']+')')['join'](';\x20'),'reason':'A\x20missed\x20duty\x20strands\x20an\x20order\x20or\x20funds\x20—\x20each\x20row\x20is\x20an\x20operating\x20obligation\x20of\x20this\x20build'}),b;}const FACT_PATTERNS=[{'pattern':/\b(?:coupon|promo(?:\s*code)?|discount\s*code|voucher)\b/i,'fact':{'label':'Coupons\x20/\x20promo\x20codes','note':'Maps\x20to\x20a\x20Discount\x20object\x20minted\x20on\x20the\x20Service\x20(budget\x20=\x20max_uses\x20x\x20value;\x20coupons\x20are\x20BURNED\x20on\x20use\x20—\x20never\x20restocked\x20or\x20refunded).\x20Decide\x20the\x20coupon\x20budget\x20and\x20eligibility\x20guard\x20before\x20apply.','disposition':'manual_review'}},{'pattern':/\breview\s+(?:reward|bounty|incentive)|\bincentiv\w+\s+reviews?\b|\bbonus\s+for\s+(?:a\s+)?reviews?\b/i,'fact':{'label':'Review\x20rewards\x20/\x20bounties','note':'Maps\x20to\x20a\x20funded\x20Reward\x20object\x20+\x20claim\x20guard\x20(generation\x20input\x20review_mode=\x27review_reward\x27).\x20The\x20reward\x20pool\x20MUST\x20be\x20funded\x20at\x20generation\x20time\x20(reward_funding\x20input)\x20—\x20an\x20unfunded\x20promise\x20is\x20refused.','disposition':'manual_review'}},{'pattern':/\breturn\s+(?:window|policy)|\b\d{1,3}[\s-]?day\s+returns?\b/i,'fact':{'label':'Return\x20window\x20/\x20policy','note':'Maps\x20to\x20the\x20template\x27s\x20return-window\x20guard\x20knob\x20(return_window_days\x20fee_param).\x20Compare\x20the\x20stated\x20number\x20against\x20the\x20template\x20default\x20before\x20apply\x20—\x20the\x20guard\x20binds\x20only\x20the\x20embedded\x20constant.','disposition':'manual_review'}},{'pattern':/\ba[\s-]?to[\s-]?z\b|\bbuyer\s+protection\b|\bguarantee\s+program\b/i,'fact':{'label':'Platform\x20guarantee\x20program\x20(A-to-z\x20style)','note':'Maps\x20to\x20the\x20independent\x20Arbitration\x20venue\x20plus\x20the\x20order-side\x20claim\x20rails.\x20The\x20refund-vs-award\x20exits\x20must\x20be\x20confirmed\x20at\x20guard\x20resolution\x20—\x20the\x20venue\x20itself\x20moves\x20no\x20funds.','disposition':'manual_review'}},{'pattern':/\b(?:multiple|third[- ]party)\s+sellers?\b|\bper[- ]product\s+split\b|\bmulti[- ]seller\b/i,'fact':{'label':'Multi-seller\x20per-product\x20settlement','note':'NOT\x20supported:\x20one\x20Service/Allocation\x20settles\x20ONE\x20merchant\x27s\x20split.\x20Multi-seller\x20needs\x20one\x20Service\x20per\x20seller\x20(archived\x20framework\x20boundary)\x20—\x20disclose\x20this\x20to\x20the\x20migrating\x20merchant\x20instead\x20of\x20generating\x20a\x20shop\x20that\x20cannot\x20pay\x20out.','disposition':'unmapped'}},{'pattern':/\bsales\s+tax\b|\bVAT\b|\bGST\b/i,'fact':{'label':'Sales\x20tax\x20/\x20VAT\x20handling','note':'NOT\x20supported\x20on-chain:\x20tax\x20remittance\x20is\x20an\x20off-chain\x20compliance\x20flow\x20(archived\x20framework\x20boundary).\x20Disclose;\x20do\x20not\x20model\x20it\x20as\x20a\x20split\x20row.','disposition':'unmapped'}}];function extractSplitMention(a){const b=a;let c=b['match'](/\b(?:platform|service|commission|take)\s*(?:fee|commission|rate|cut)?\s*(?:of|is|at|:)?\s*(\d{1,3}(?:\.\d+)?)\s*%/i)??b['match'](/(\d{1,3}(?:\.\d+)?)\s*%\s*(?:platform\s+)?(?:commission|service\s*fee|take|cut)\b/i);if(c)return{'statedPct':Number(c[0x1]),'raw':c[0x0],'certain':!![]};c=b['match'](/(\d{1,3}(?:\.\d+)?)\s*%\s*(?:goes\s+to|to|for)\s+the\s+(?:merchant|seller|creator|freelancer|artist)/i)??b['match'](/\b(?:merchant|seller|creator|freelancer|artist)s?\s+(?:keep|get|receive|earn)\s+(\d{1,3}(?:\.\d+)?)\s*%/i);if(c)return{'statedPct':0x64-Number(c[0x1]),'raw':c[0x0],'certain':!![]};c=b['match'](/\b(\d{1,3})\s*[/\u2013\u2014-]\s*(\d{1,3})\b(?:\s*%?\s*(?:split|revenue\s*share|share|revenue\s*split))?/i);if(c&&/split|revenue|share|commission/i['test'](b))return{'raw':c[0x0],'certain':![]};return undefined;}function splitConflictEntry(a,b){const c=extractSplitMention(b);if(!c)return undefined;const d=platformShareBps(a['fee_params']),e=d===undefined?undefined:d/0x64;if(e===undefined)return undefined;const f=Object['keys'](a['fee_params'])['find'](h=>/(?:platform|commission|service_fee)[a-z_]*_bps$/['test'](h)&&!/^attributed_/['test'](h));if(c['certain']&&c['statedPct']!==undefined&&Math['abs'](c['statedPct']-e)<0.01)return undefined;const g=c['certain']&&c['statedPct']!==undefined?c['statedPct']+'%\x20platform\x20share':'an\x20orientation-ambiguous\x20ratio\x20('+c['raw']+'\x20—\x20which\x20side\x20is\x20the\x20platform\x20is\x20not\x20stated)';return{'source_element':'Platform\x20commission\x20stated\x20in\x20the\x20description','mapping_note':'Your\x20description\x20states\x20'+g+';\x20template\x20\x27'+a['id']+'\x27\x20defaults\x20to\x20a\x20'+(e+'%\x20platform\x20share\x20(fee_params\x20'+(f??'platform_commission_bps')+'\x20=\x20'+(d??0x0)+'\x20bps).\x20')+'These\x20differ\x20—\x20the\x20template\x20default\x20wins\x20silently\x20unless\x20you\x20override\x20it.','reason':'Confirm\x20the\x20intended\x20split.\x20To\x20apply\x20the\x20stated\x20number,\x20pass\x20'+('fee_overrides[\x22'+(f??'platform_commission_bps')+'\x22]\x20=\x20'+(c['statedPct']!==undefined&&c['certain']?Math['round'](c['statedPct']*0x64):'<bps>')+'\x20')+'(basis\x20points)\x20on\x20template_generate\x20/\x20migration_apply;\x20to\x20keep\x20the\x20template\x20default,\x20ignore\x20this\x20entry.\x20'+'A\x20wrong\x20split\x20lands\x20as\x20a\x20live\x20allocator\x20row\x20and\x20order_allocators\x20is\x20frozen\x20at\x20publish.'};}const SPLIT_ORDER_PATTERNS=[/\b(?:multiple|several|many|\d+)\s+(?:pickup|collection|self[- ]pick(?:up)?)\s*(?:points?|locations?|stations?|sites?)/i,/\b(?:per|each|every)[-\s](?:pickup|collection)?[-\s]?point\b/i,/\b(?:group[- ]?buy(?:ing)?|community)\s+leaders?\b/i,/\brefund\s+(?:only\s+)?(?:some|part)\s+(?:of\s+)?(?:the\s+)?items?\b/i,/\breturn\s+(?:some|part)\s+of\s+(?:the\s+)?items?\b/i,/\b(?:refund|return)\s+\d+\s+of\s+\d+\s+items?\b/i,/\bper[- ]item\s+(?:refund|return|after[- ]?sales)\b/i];function splitOrderRecipeEntry(a){if(!SPLIT_ORDER_PATTERNS['some'](b=>b['test'](a)))return undefined;return{'source_element':'Multi-pickup-point\x20/\x20per-item\x20after-sales\x20(object-model\x20boundary)','mapping_note':'RECIPE\x20—\x20same-Service\x20split\x20orders\x20(expressible\x20TODAY):\x20keep\x20ONE\x20Service\x20as\x20the\x20storefront\x20and\x20'+'create\x20ONE\x20Order\x20per\x20pickup\x20point\x20(or\x20per\x20item\x20batch).\x20Each\x20Order\x20carries\x20its\x20own\x20escrow,\x20its\x20own\x20'+'time\x20windows\x20(a\x20per-point\x20cutoff\x20is\x20that\x20Order\x27s\x20time-lock\x20guard)\x20and\x20its\x20own\x20settlement/refund\x20'+'rails\x20—\x20no\x20topology\x20change,\x20no\x20new\x20primitive.\x20Per-item\x20partial\x20after-sales\x20rides\x20the\x20same\x20split:\x20'+'the\x20buyer\x20refunds/returns\x20per\x20Order\x20and\x20each\x20Order\x27s\x20escrow\x20settles\x20independently.\x20Generate\x20the\x20'+'Service\x20ONCE,\x20then\x20open\x20one\x20order\x20per\x20point\x20via\x20the\x20normal\x20buy\x20flow.','reason':'Chain\x20object-model\x20boundary:\x20an\x20Order\x20has\x20no\x20product\x20lines\x20or\x20point\x20sub-objects,\x20so\x20per-line\x20'+'amounts/cutoffs\x20inside\x20ONE\x20order\x20cannot\x20be\x20expressed\x20in\x20guard\x20data\x20(template\x20ruling,\x20ISSUES\x20paper\x204).\x20'+'Honest\x20costs\x20of\x20the\x20recipe:\x20object\x20count\x20scales\x20with\x20points;\x20cross-order\x20consistency\x20is\x20the\x20CLIENT\x27s\x20'+'duty\x20(no\x20atomic\x20multi-order\x20purchase);\x20campaign\x20aggregation\x20(crowdfunding\x20threshold\x20/\x20leader\x20roster)\x20'+'loses\x20its\x20single-object\x20view\x20—\x20compute\x20per-point\x20sums\x20client-side.\x20The\x20OrderLine\x20sub-object\x20primitive\x20'+'is\x20registered\x20on\x20the\x20protocol\x20train\x20(scheduled\x20after\x20the\x20machine.patch\x20paper)\x20—\x20re-check\x20the\x20train\x20'+'before\x20hand-building\x20aggregates.'};}function disclosedFactEntries(a,b,c){const d=[],e=[],f=new Set([...b,...c]['map'](g=>g['source_element']['toLowerCase']()));for(const {pattern:g,fact:h}of FACT_PATTERNS){if(!g['test'](a))continue;if(f['has'](h['label']['toLowerCase']()))continue;f['add'](h['label']['toLowerCase']());const i={'source_element':h['label'],'mapping_note':'Stated\x20in\x20your\x20description\x20—\x20the\x20deterministic\x20planner\x20does\x20not\x20map\x20it\x20automatically.\x20'+h['note'],'reason':'Explicit\x20disclosure\x20(amz9\x20A-3):\x20stated\x20commerce\x20facts\x20must\x20never\x20be\x20silently\x20dropped.\x20Confirm\x20or\x20decline\x20this\x20item\x20before\x20migration_apply.'};if(h['disposition']==='unmapped')e['push'](i);else d['push'](i);}return{'manual':d,'unmapped':e};}function wowokAdvantages(a){const b=['Every\x20rule\x20is\x20an\x20immutable\x20on-chain\x20Guard\x20—\x20customers\x20can\x20verify\x20the\x20exact\x20policy\x20before\x20paying','Disputes\x20resolve\x20through\x20independent\x20Arbitration\x20with\x20a\x20funded\x20compensation\x20pool','Fund\x20splits\x20execute\x20by\x20contract\x20at\x20the\x20configured\x20release\x20points\x20—\x20no\x20platform\x20discretion'];return a['industry']==='subscription'&&b['push']('Per-period\x20explicit-signature\x20renewal\x20—\x20the\x20anti-auto-renew\x20trap\x20is\x20a\x20selling\x20point'),a['industry']==='freelance'&&b['push']('Chain-verifiable\x200%\x20(or\x20low)\x20commission\x20via\x20the\x20allocator\x20split\x20itself'),a['industry']==='travel'&&b['push']('Two-tier\x20allocation\x20pays\x20each\x20supplier\x20at\x20its\x20own\x20segment\x20release\x20—\x20multi-party\x20transparency'),a['industry']==='education'&&b['push']('Regulatory\x20prepay\x20caps\x20and\x20per-session\x20release\x20protect\x20students\x20from\x20run-away\x20institutions'),a['industry']==='rental'&&b['push']('Deposit\x20escrow\x20+\x20evidence-gated\x20deduction\x20—\x20neither\x20side\x20can\x20unilaterally\x20seize\x20the\x20deposit'),a['industry']==='retail'&&b['push']('Escrow\x20+\x20confirm-on-receipt\x20release\x20—\x20the\x20buyer\x27s\x20confirmation\x20is\x20the\x20only\x20release\x20trigger'),b;}function customizableModules(a){const b=['independent_arbitration','refund_guarantee','reputation_on_chain','wip_provenance'];switch(a['industry']){case'freelance':return[...b,'milestone_escrow','accept_timeout_protection'];case'rental':return[...b,'damage_attestation'];case'education':return[...b,'accept_timeout_protection'];case'travel':return[...b,'multi_tier_allocation','supplier_collaboration'];case'subscription':return[...b,'subscription_with_proof'];case'retail':return[...b,'accept_timeout_protection'];default:return b;}}const FACT_FAMILY_OVERLAP={'coupons\x20/\x20promo\x20codes':'discount','review\x20rewards\x20/\x20bounties':'review_incentive','return\x20window\x20/\x20policy':'after_sales'};export function buildClauseLedger(a,b,c){const d=c&&(c['review_mode']!==undefined||c['after_sales_mode']!==undefined||c['logistics_mode']!==undefined)?{...b,...c['review_mode']!==undefined?{'review_mode':c['review_mode']}:{},...c['after_sales_mode']!==undefined?{'after_sales_mode':c['after_sales_mode']}:{},...c['logistics_mode']!==undefined?{'logistics_mode':c['logistics_mode']}:{}}:b,f=[],g=new Set();for(const l of requirementCoverage(a,d)){const m='family:'+l['family'];g['add'](l['label']['toLowerCase']()),f['push']({'key':m,'clause':l['label'],'evidence':l['evidence'],'disposition':l['status']==='mapped'?'implemented':l['status']==='unmapped'?'inexpressible':'pending',...l['target']!==undefined?{'target':l['target']}:{},'reason':l['note']});}const {manual:h,unmapped:i}=disclosedFactEntries(a,[],[]);for(const n of[...h,...i]){const o=n['source_element']['toLowerCase']();if(g['has'](o))continue;g['add'](o);const p=FACT_FAMILY_OVERLAP[o];if(p!==undefined&&f['some'](r=>r['key']==='family:'+p))continue;const q=i['includes'](n)?'inexpressible':'pending';f['push']({'key':'fact:'+o['replace'](/[^a-z0-9]+/g,'-')['replace'](/^-|-$/g,''),'clause':n['source_element'],'evidence':a,'disposition':q,'reason':n['reason']??n['mapping_note']});}const j=splitConflictEntry(b,a);j&&f['push']({'key':'split:commission-conflict','clause':j['source_element'],'evidence':a,'disposition':'pending','reason':j['reason']});const k=splitOrderRecipeEntry(a);return k&&f['push']({'key':'recipe:split-order','clause':k['source_element'],'evidence':a,'disposition':'pending','reason':k['reason']}),f;}export function applyClauseDispositions(a,b){const c=[];for(const [e,f]of Object['entries'](b)){const g=a['find'](h=>h['key']===e);if(!g||g['disposition']!=='pending'||!f?.['reason']||f['reason']['trim']()===''){c['push'](e);continue;}g['disposition']='not_applicable',g['reason']=f['reason']['trim']();}return{'rejected':c};}export function planMigration(a){const b=a['ir_discovery']?a['industry']?{...a['ir_discovery'],'industry':a['industry']}:a['ir_discovery']:undefined;let c,d={'source':'explicit','confidence':0x1};if(a['template_id']){c=getTemplate(a['template_id']);if(c&&a['industry']&&c['industry']!==a['industry']){const j=matchTemplate(a['industry']+'\x20'+a['description'],undefined,b);j&&j['template']['industry']===a['industry']&&(c=j['template'],d={'source':j['source'],'confidence':j['confidence'],...j['matched_tags']?{'matched_tags':j['matched_tags']}:{}});}}else{const k=a['industry']?a['industry']+'\x20'+a['description']:a['description'],l=matchTemplate(k,a['industry']?undefined:a['ir_industry'],b);c=l?.['template'];l&&(d={'source':l['source'],'confidence':l['confidence'],...l['matched_tags']?{'matched_tags':l['matched_tags']}:{}});if(!c&&a['industry']){c=listTemplates()['templates']['find'](m=>m['industry']===a['industry']&&m['archetype']==='leader');if(c)d={'source':'industry_leader','confidence':0.35};}}if(!c)return undefined;const e=manualReviewEntries(c),f=genericUnmappedEntries(c),g=splitConflictEntry(c,a['description']);if(g)e['unshift'](g);const h=disclosedFactEntries(a['description'],e,f);e['push'](...h['manual']),f['push'](...h['unmapped']);const i=splitOrderRecipeEntry(a['description']);if(i)e['push'](i);return{'source':{'url':a['url'],'description':a['description'],'detected_industry':c['industry'],'matched_template':c['id']},'template_match':d,'mapped':genericMappedEntries(c),'unmapped':f,'manual_review':e,'wowok_advantages':wowokAdvantages(c),'customizable_modules':customizableModules(c),'role_assessment':{'recommended':c['recommended_role'],'rationale':c['role_rationale'],'alternatives':['merchant','supplier','both']['filter'](m=>m!==c['recommended_role'])},'risk_check':dryRunRiskCheck(c),'requirement_coverage':requirementCoverage(a['description'],c),'clause_ledger':buildClauseLedger(a['description'],c),...c['conditional_guards']?.['length']?{'questions':[...new Set(c['conditional_guards']['map'](m=>m['param']))]['map'](m=>{const n=c['conditional_guards']['find'](o=>o['param']===m);return{'param':m,'question':n['question'],'options':[...n['values']],'default':String(c['fee_params'][m]??'')};})}:{},'network':a['network']??'testnet'};}