@wowok/agent-mcp 3.2.4 → 3.2.6

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 (90) hide show
  1. package/dist/composition/blueprint-view.d.ts +64 -0
  2. package/dist/composition/blueprint-view.js +1 -0
  3. package/dist/evaluation/builtins/graph-service.spec.js +1 -1
  4. package/dist/evaluation/engine.js +1 -1
  5. package/dist/experience/realtime-feedback.js +1 -1
  6. package/dist/extensions/industry-pack.d.ts +1 -0
  7. package/dist/extensions/industry-pack.js +1 -1
  8. package/dist/extensions/modes.js +1 -1
  9. package/dist/extensions/registry.d.ts +1 -2
  10. package/dist/extensions/registry.js +1 -1
  11. package/dist/graph/onchain/expand.js +1 -1
  12. package/dist/graph/onchain/exposure.js +1 -1
  13. package/dist/graph/onchain/facts.js +1 -1
  14. package/dist/harness/recover.js +1 -1
  15. package/dist/knowledge/audit-rules.d.ts +2 -0
  16. package/dist/knowledge/audit-rules.js +1 -1
  17. package/dist/knowledge/baselines/rules/allocation.json +5 -5
  18. package/dist/knowledge/baselines/rules/arb.json +1 -1
  19. package/dist/knowledge/baselines/rules/guard.json +9 -9
  20. package/dist/knowledge/baselines/rules/machine.json +5 -5
  21. package/dist/knowledge/baselines/rules/order.json +1 -1
  22. package/dist/knowledge/builtin-templates.d.ts +2 -1
  23. package/dist/knowledge/builtin-templates.js +1 -1
  24. package/dist/knowledge/entity-recipient-guard.js +1 -1
  25. package/dist/knowledge/getting-started.js +1 -1
  26. package/dist/knowledge/guard-design-patterns.js +1 -1
  27. package/dist/knowledge/guard-risk.js +1 -1
  28. package/dist/knowledge/guard-templates.d.ts +1 -1
  29. package/dist/knowledge/guard-templates.js +1 -1
  30. package/dist/knowledge/index.js +1 -1
  31. package/dist/knowledge/industry-generalizer.js +1 -1
  32. package/dist/knowledge/industry-registry.js +1 -1
  33. package/dist/knowledge/jsonrpc-enum.js +1 -1
  34. package/dist/knowledge/order-ledger.js +1 -1
  35. package/dist/knowledge/scenario-modes.d.ts +2 -4
  36. package/dist/knowledge/scenario-modes.js +1 -1
  37. package/dist/knowledge/service-ledger.js +1 -1
  38. package/dist/knowledge/service-templates.js +1 -1
  39. package/dist/knowledge/template-loader.d.ts +7 -2
  40. package/dist/knowledge/template-loader.js +1 -1
  41. package/dist/knowledge/template-registry.js +1 -1
  42. package/dist/knowledge/template-scanner.js +1 -1
  43. package/dist/knowledge/template-validation.d.ts +2 -0
  44. package/dist/knowledge/template-validation.js +1 -0
  45. package/dist/monitor/MonitorLoop.js +1 -1
  46. package/dist/playbooks/service-build/business-puzzle.js +1 -1
  47. package/dist/playbooks/service-build/game-theory.d.ts +2 -2
  48. package/dist/playbooks/service-build/game-theory.js +1 -1
  49. package/dist/playbooks/service-build/machine-panorama.js +1 -1
  50. package/dist/playbooks/service-build/merchant-guide.d.ts +54 -11
  51. package/dist/playbooks/service-build/merchant-guide.js +1 -1
  52. package/dist/playbooks/service-build/mode-actions.js +1 -1
  53. package/dist/playbooks/service-build/object-panorama.js +1 -1
  54. package/dist/playbooks/service-build/participation-radar.js +1 -1
  55. package/dist/playbooks/service-build/relationship-profile.js +1 -1
  56. package/dist/playbooks/service-build/reverse-mapping-nk4.spec.d.ts +1 -0
  57. package/dist/playbooks/service-build/reverse-mapping-nk4.spec.js +1 -0
  58. package/dist/playbooks/service-build/reverse-mapping.d.ts +24 -0
  59. package/dist/playbooks/service-build/reverse-mapping.js +1 -1
  60. package/dist/playbooks/service-build/service-panorama.js +1 -1
  61. package/dist/playbooks/service-build/service-quote.js +1 -1
  62. package/dist/playbooks/service-build/workflow-design-assessment.d.ts +2 -2
  63. package/dist/playbooks/service-build/workflow-design-assessment.js +1 -1
  64. package/dist/review/index.js +1 -1
  65. package/dist/safety/confirm-gate.js +1 -1
  66. package/dist/schema/call/handler.js +1 -1
  67. package/dist/schema/call/semantic.js +1 -1
  68. package/dist/schema/call/service.d.ts +14 -0
  69. package/dist/schema/call/service.js +1 -1
  70. package/dist/schema/common/index.js +1 -1
  71. package/dist/schema/goal/planning.js +1 -1
  72. package/dist/schema/local/index.js +1 -1
  73. package/dist/schema/operations.d.ts +7 -0
  74. package/dist/schema/schema-version.js +1 -1
  75. package/dist/schema-query-impl/index.js +1 -1
  76. package/dist/schemas/goal_operation.schema.json +1 -1
  77. package/dist/schemas/index.json +1 -1
  78. package/dist/schemas/onchain_operations.schema.json +37 -2
  79. package/dist/schemas/onchain_operations_service.schema.json +37 -2
  80. package/dist/tools/handlers/benchmark-migration.d.ts +2 -13
  81. package/dist/tools/handlers/benchmark-migration.js +1 -1
  82. package/dist/tools/handlers/config.js +1 -1
  83. package/dist/tools/handlers/industry-pack.js +1 -1
  84. package/dist/tools/handlers/onchain.js +1 -1
  85. package/dist/tools/handlers/query.js +1 -1
  86. package/dist/tools/registry/agent.js +1 -1
  87. package/dist/tools/wip-deploy-assist.js +1 -1
  88. package/package.json +2 -2
  89. package/dist/playbooks/service-build/semantic-graph.d.ts +0 -99
  90. package/dist/playbooks/service-build/semantic-graph.js +0 -1
@@ -1 +1 @@
1
- export const BUYER_ACTION_NODE_RE=/^(reviewed|return_requested|guest_cancelled|withdrawn|charging|cancelled|closed_cancel)$/i;export function unannotatedBuyerActionNodes(a){return a['filter'](b=>!b['operator']&&BUYER_ACTION_NODE_RE['test'](b['name']))['map'](b=>b['name']);}export const SCENARIO_MODES=[{'name':'freelance','phase':0x1,'industry':'Design\x20/\x20dev\x20/\x20consulting\x20/\x20writing','trust_pattern':'Milestone\x20allocation,\x20acceptance\x20gate','traits':{'has_logistics':![],'communication_heavy':!![],'pure_digital':!![],'long_cycle':!![],'deposit_required':![],'multi_tier_allocation':![]},'machine_shape':[{'name':'paid','role':'Entry:\x20order\x20created\x20and\x20paid\x20via\x20Service.buy();\x20Machine\x20starts\x20here'},{'name':'kickoff','role':'Scope\x20confirmed;\x20WTS\x20change-request\x20channel\x20opened\x20(scope-creep\x20ledger)'},{'name':'milestone_1_delivering','role':'Provider\x20works\x20on\x20milestone\x201'},{'name':'milestone_1_delivered','role':'Milestone\x201\x20deliverable\x20submitted\x20(WIP\x20hash\x20mandatory)'},{'name':'milestone_1_accepted','role':'Customer\x20signs\x20milestone\x201\x20acceptance\x20—\x20M1\x20funds\x20releasable','operator':'order_payer'},{'name':'milestone_2_delivering','role':'Provider\x20works\x20on\x20milestone\x202'},{'name':'milestone_2_delivered','role':'Milestone\x202\x20deliverable\x20submitted\x20(WIP\x20hash\x20mandatory)'},{'name':'milestone_2_accepted','role':'Customer\x20signs\x20milestone\x202\x20acceptance\x20—\x20M2\x20funds\x20releasable','operator':'order_payer'},{'name':'final_delivering','role':'Provider\x20finalizes\x20remaining\x20scope'},{'name':'final_delivered','role':'Final\x20deliverable\x20submitted\x20(WIP\x20hash\x20mandatory)'},{'name':'completed','role':'Final\x20acceptance\x20signed\x20—\x20remaining\x20escrow\x20released\x20to\x20provider','operator':'order_payer'},{'name':'closed_cancel','role':'Pre-delivery\x20cancellation\x20—\x20triggers\x20refund\x20Allocator\x20(unearned\x20portion)','operator':'order_payer'}],'guards':[{'template_id':'pattern.buy_guard_blocklist','host':'service','purpose':'Customer\x20identity\x20check\x20on\x20purchase'},{'template_id':'pattern.identity_check_order_holder','host':'machine','purpose':'Both\x20parties\x20confirm\x20scope\x20at\x20kickoff\x20(WTS\x20change-request\x20channel)'},{'template_id':'pattern.repository_data_check','host':'machine','purpose':'Provider\x20must\x20submit\x20WIP\x20hash\x20for\x20every\x20milestone\x20deliverable'},{'template_id':'pattern.identity_check_order_holder','host':'machine','purpose':'Only\x20customer\x20can\x20sign\x20milestone/final\x20acceptance'},{'template_id':'pattern.identity_check_service_provider_dynamic','host':'machine','purpose':'Only\x20provider\x20can\x20withdraw\x20after\x20each\x20accepted\x20milestone'},{'template_id':'pattern.identity_check_order_holder','host':'machine','purpose':'Only\x20customer\x20can\x20initiate\x20pre-delivery\x20cancellation'},{'template_id':'tpl_payment_exception_compensation','host':'machine','purpose':'Delivery\x20delay\x20exception\x20compensation\x20via\x20scene-bound\x20Payment\x20(§2.13)'}],'allocator':{'recipient':'signer','count':0x2,'mode':'amount','description':'Per-milestone\x20release:\x20each\x20accepted\x20milestone\x20releases\x20its\x20escrowed\x20amount\x20to\x20provider;\x20final\x20acceptance\x20releases\x20the\x20remainder\x20on\x20completed;\x20pre-delivery\x20cancellation\x20refunds\x20the\x20unearned\x20portion\x20to\x20customer\x20via\x20Allocator\x20(off-Machine\x20fund\x20routing\x20per\x20R-M1-11)'},'key_risk':'Customer\x20never\x20accepts\x20delivery\x20—\x20provider\x20cannot\x20get\x20paid','build_notes':['Use\x20Service\x20`setting_locked_time`\x20to\x20lock\x20rules\x20for\x20the\x20engagement\x20duration','WIP\x20hash\x20on\x20every\x20milestone\x20deliverable\x20is\x20mandatory\x20—\x20protects\x20provider\x20in\x20disputes','Acceptance\x20gate\x20is\x20the\x20trust\x20pivot\x20—\x20both\x20parties\x20must\x20agree\x20on\x20criteria\x20per\x20milestone','Milestones\x20map\x20to\x20deliverable-Guarded\x20forwards;\x20each\x20accepted\x20milestone\x20releases\x20its\x20escrowed\x20slice\x20(allocation.distribute_milestone)','Scope\x20changes\x20are\x20recorded\x20as\x20WTS\x20change-requests\x20at\x20kickoff/throughout\x20—\x20never\x20silent','R-M1-11:\x20no\x20\x27refunded\x27/\x27disputed\x27/\x27arb\x27/\x27cancelled\x27\x20nodes\x20—\x20refunds\x20route\x20via\x20Allocator\x20(to\x20OrderHolder)\x20triggered\x20by\x20\x27closed_cancel\x27,\x20disputes\x20via\x20Arbitration','Payment\x20exception\x20compensation\x20for\x20delivery\x20delays\x20—\x20provider\x20Treasury\x20auto-compensates\x20customer\x20(§2.13)','Project-Catalog\x20orders\x20have\x20NO\x20milestones\x20(single\x20funded\x20order\x20+\x20steps\x20timeline);\x20milestones\x20here\x20model\x20fixed-price\x20CONTRACTS.\x20For\x20catalog-style\x20listings\x20(tiered\x20pricing\x20+\x20add-ons\x20+\x20buyer\x20requirements)\x20use\x20the\x20freelance/catalog-tiers\x20template\x20instead','Time-bound\x20catalog\x20rules\x20(24h\x20instant\x20cancel,\x2048h\x20requirements\x20timeout,\x2014-day\x20auto-accept)\x20need\x20a\x20time\x20Guard\x20PLUS\x20an\x20off-chain\x20keeper\x20per\x20window\x20-\x20Guards\x20take\x20an\x20immutable\x20duration\x20constant']},{'name':'rental','phase':0x1,'industry':'Equipment\x20/\x20vehicle\x20/\x20property\x20rental','trust_pattern':'Deposit\x20escrow,\x20return\x20inspection','traits':{'has_logistics':!![],'communication_heavy':!![],'pure_digital':![],'long_cycle':![],'deposit_required':!![],'multi_tier_allocation':![]},'machine_shape':[{'name':'deposit_paid','role':'Entry:\x20deposit\x20+\x20rent\x20paid\x20via\x20Service.buy();\x20Machine\x20starts\x20here'},{'name':'booking_confirmed','role':'Owner\x20confirms\x20availability\x20and\x20handover\x20schedule'},{'name':'handover_out','role':'Owner\x20hands\x20over\x20item,\x20records\x20pre-rental\x20WIP\x20(condition\x20photos)'},{'name':'in_use','role':'Rental\x20period\x20active'},{'name':'overdue','role':'Past\x20due\x20date\x20without\x20return\x20—\x20time-lock\x20Guard\x20(clock)\x20gates\x20late\x20fees'},{'name':'return_requested','role':'Customer\x20initiates\x20return','operator':'order_payer'},{'name':'returned','role':'Item\x20physically\x20returned;\x20post-rental\x20WIP\x20recorded','operator':'order_payer'},{'name':'inspected','role':'Owner\x20inspects\x20returned\x20item\x20(pre+post\x20WIP\x20comparison)'},{'name':'return_approved','role':'No\x20damage\x20—\x20triggers\x20deposit\x20refund\x20Allocator\x20(100%\x20to\x20customer)'},{'name':'damage_confirmed','role':'Damage\x20confirmed\x20via\x20pre+post\x20WIP\x20diff\x20—\x20triggers\x20deposit\x20deduction\x20Allocator'},{'name':'completed','role':'Rental\x20finalized\x20—\x20triggers\x20rent\x20Allocator\x20(rent\x20to\x20owner)'},{'name':'closed_cancel','role':'Pre-handover\x20cancellation\x20—\x20triggers\x20full\x20refund\x20Allocator','operator':'order_payer'}],'guards':[{'template_id':'pattern.verifier_evidence_philosophy','host':'service','purpose':'Verify\x20deposit\x20amount\x20matches\x20listing'},{'template_id':'pattern.identity_check_service_provider_dynamic','host':'machine','purpose':'Owner\x20confirms\x20availability\x20and\x20handover\x20schedule'},{'template_id':'pattern.repository_data_check','host':'machine','purpose':'Handover\x20must\x20record\x20pre-rental\x20WIP\x20(condition\x20photos)'},{'template_id':'pattern.time_lock_progress','host':'machine','purpose':'Overdue\x20state\x20gated\x20by\x20clock\x20time-lock\x20(convert_witness/clock)'},{'template_id':'pattern.repository_data_check','host':'machine','purpose':'Return\x20must\x20include\x20post-rental\x20WIP'},{'template_id':'pattern.identity_check_service_provider_dynamic','host':'machine','purpose':'Only\x20owner\x20can\x20submit\x20inspection\x20result'},{'template_id':'damage_guard_wip','host':'machine','purpose':'Damage\x20claim\x20requires\x20pre+post\x20WIP\x20comparison'},{'template_id':'pattern.identity_check_service_provider_dynamic','host':'machine','purpose':'Cancellation\x20refund\x20requires\x20owner\x20permission\x20OR\x20arbiter'},{'template_id':'tpl_payment_exception_compensation','host':'machine','purpose':'Return\x20delay/damage\x20exception\x20compensation\x20via\x20scene-bound\x20Payment\x20(§2.13)'},{'template_id':'tpl_repository_quote_guard_subscription','host':'repository','purpose':'Weather/usage\x20data\x20oracle\x20subscription\x20(§2.11)'}],'allocator':{'recipient':'entity','count':0x4,'mode':'amount','description':'Rent\x20to\x20owner\x20on\x20completed;\x20deposit\x20refund\x20to\x20customer\x20on\x20return_approved;\x20deposit\x20deduction\x20to\x20owner\x20on\x20damage_confirmed;\x20full\x20deposit+rent\x20refund\x20to\x20customer\x20on\x20cancelled\x20(fund\x20routing\x20via\x20Allocator\x20per\x20R-M1-11)'},'key_risk':'Owner\x20claims\x20damage\x20without\x20pre-rental\x20WIP\x20—\x20customer\x20loses\x20deposit\x20unfairly','build_notes':['Pre-rental\x20WIP\x20is\x20non-negotiable\x20—\x20without\x20it,\x20damage\x20claims\x20fail','Deposit\x20must\x20be\x20escrowed,\x20not\x20direct-transferred\x20—\x20enables\x20fair\x20deduction','Inspection\x20gate\x20prevents\x20customer\x20from\x20denying\x20damage','Overdue\x20handling\x20uses\x20a\x20time-lock\x20Guard\x20(clock)\x20—\x20the\x20Guard\x20only\x20ALLOWS\x20the\x20overdue\x20transition;\x20automatic\x20advancement\x20needs\x20an\x20off-chain\x20keeper\x20(see\x20DESIGN-REVIEW\x20C-3)','Extensions\x20are\x20modeled\x20as\x20separate\x20sub-orders\x20(REUSE\x20pattern),\x20not\x20as\x20machine\x20cycles\x20—\x20the\x20Machine\x20stays\x20a\x20DAG','R-M1-11:\x20no\x20\x27deposit_refunded\x27/\x27deposit_deducted\x27/\x27refunded\x27\x20nodes\x20—\x20deposit\x20refund/deduction\x20flows\x20through\x20Allocator\x20triggered\x20by\x20return_approved/damage_confirmed\x20business\x20states','Payment\x20exception\x20compensation\x20for\x20return\x20delays\x20—\x20Treasury\x20withdraws\x20scene-bound\x20Payment\x20(§2.13)','Repository\x20quote_guard\x20for\x20weather/usage\x20data\x20subscription\x20revenue\x20(§2.11)']},{'name':'education','phase':0x2,'industry':'Courses\x20/\x20training\x20/\x20tutoring','trust_pattern':'Periodic\x20release\x20per\x20session,\x20attendance\x20Guard','traits':{'has_logistics':![],'communication_heavy':!![],'pure_digital':![],'long_cycle':!![],'deposit_required':!![],'multi_tier_allocation':![]},'machine_shape':[{'name':'paid','role':'Entry:\x20enrollment\x20and\x20tuition\x20paid\x20via\x20Service.buy();\x20Machine\x20starts\x20here'},{'name':'enrolled','role':'Institution\x20confirms\x20enrollment;\x20class\x20Repository\x20record\x20created'},{'name':'session_1','role':'Session\x201\x20delivered\x20—\x20attendance\x20evidence\x20recorded\x20(Repository)'},{'name':'session_2','role':'Session\x202\x20delivered\x20—\x20attendance\x20evidence\x20recorded'},{'name':'session_3','role':'Session\x203\x20delivered\x20(representative;\x20configure\x20N\x20sessions\x20at\x20build\x20time)'},{'name':'assessed','role':'Final\x20assessment\x20/\x20exam\x20submitted\x20(WIP)'},{'name':'certificate_issued','role':'Certificate\x20issued\x20as\x20WIP/Proof\x20deliverable'},{'name':'completed','role':'All\x20sessions\x20delivered\x20and\x20certified\x20—\x20tuition\x20fully\x20released'},{'name':'paused','role':'Student\x20on\x20leave\x20—\x20terminal;\x20resume\x20via\x20a\x20new\x20sub-order\x20(REUSE\x20pattern,\x20keeps\x20the\x20Machine\x20a\x20DAG)'},{'name':'withdrawn','role':'Enrollment\x20cancelled\x20mid-course\x20—\x20triggers\x20unearned-tuition\x20refund\x20Allocator','operator':'order_payer'}],'guards':[{'template_id':'pattern.identity_check_service_provider_dynamic','host':'machine','purpose':'Institution\x20confirms\x20enrollment\x20and\x20creates\x20class\x20Repository\x20record'},{'template_id':'pattern.identity_check_order_holder','host':'machine','purpose':'Per-session\x20student\x20attendance\x20signature\x20with\x20session\x20evidence'},{'template_id':'pattern.repository_data_check','host':'machine','purpose':'Assessment\x20submission\x20requires\x20WIP\x20commitment'},{'template_id':'pattern.repository_data_check','host':'machine','purpose':'Certificate\x20issuance\x20requires\x20WIP/Proof\x20deliverable'},{'template_id':'pattern.identity_check_service_provider_dynamic','host':'machine','purpose':'Institution\x20approval\x20OR\x20arbiter\x20for\x20withdrawal\x20refund'},{'template_id':'tpl_buy_guard_order_holder','host':'service','purpose':'Course\x20module\x20progressive\x20unlock\x20via\x20supply\x20chain\x20sub-orders\x20(§2.12)'}],'allocator':{'recipient':'entity','count':0x2,'mode':'amount','description':'1/N\x20of\x20tuition\x20released\x20per\x20session\x20attendance\x20(per-session\x20release\x20to\x20institution/instructor);\x20unearned\x20portion\x20refunded\x20to\x20student\x20via\x20Allocator\x20on\x20withdrawn\x20(per\x20R-M1-11)'},'key_risk':'Tutoring\x20institutions\x20run\x20away\x20with\x20prepaid\x20tuition','build_notes':['Use\x20Service\x20`setting_locked_time`\x20to\x20lock\x20rules\x20for\x20the\x20entire\x20term\x20(regulatory\x20compliance,\x20>=90d)','Attendance\x20Guard\x20needs\x20WIP\x20hash\x20for\x20session\x20content\x20commitment;\x20attendance\x20evidence\x20lives\x20in\x20the\x20class\x20Repository','Per-session\x20release\x20requires\x20threshold-based\x20trigger\x20—\x20each\x20attended\x20session\x20releases\x201/N','session_1..session_3\x20are\x20representative\x20—\x20configure\x20the\x20real\x20session\x20count\x20(session_N)\x20at\x20build\x20time;\x20each\x20session\x20=\x20one\x20attendance-Guarded\x20forward','Pause/deferral\x20is\x20a\x20terminal\x20node\x20+\x20new\x20sub-order\x20(REUSE\x20pattern)\x20—\x20never\x20a\x20loop\x20back\x20into\x20the\x20session\x20chain\x20(Machine\x20must\x20stay\x20a\x20DAG)','Supply\x20chain\x20sub-orders\x20for\x20course\x20module\x20progressive\x20unlock\x20—\x20each\x20module\x20=\x20sub-service\x20with\x20buy_guard\x20verifying\x20previous\x20module\x20completion\x20(§2.12)','Repository\x20for\x20learning\x20progress\x20collaboration\x20data\x20—\x20progress\x20as\x20key,\x20session\x20data\x20as\x20value\x20(§2.10)']},{'name':'travel','phase':0x2,'industry':'Custom\x20tours\x20/\x20multi-segment\x20trips','trust_pattern':'Multi-tier\x20allocation\x20per\x20segment','traits':{'has_logistics':![],'communication_heavy':!![],'pure_digital':![],'long_cycle':!![],'deposit_required':!![],'multi_tier_allocation':!![]},'machine_shape':[{'name':'paid','role':'Entry:\x20tour\x20booked\x20and\x20paid\x20(deposit\x20+\x20final)\x20via\x20Service.buy();\x20Machine\x20starts\x20here'},{'name':'pre_trip','role':'Itinerary\x20confirmed;\x20supplier\x20sub-orders\x20placed\x20(hotel/guide/driver)'},{'name':'segment_D1','role':'Segment\x201\x20(e.g.,\x20hotel\x20check-in)\x20—\x20arrival\x20WIP'},{'name':'segment_D2','role':'Segment\x202\x20(e.g.,\x20guided\x20tour)\x20—\x20arrival\x20WIP'},{'name':'segment_D3','role':'Segment\x203\x20(representative;\x20configure\x20per-day/per-activity\x20nodes\x20at\x20build\x20time)'},{'name':'rescheduled','role':'Weather/force-majeure\x20branch\x20—\x20segment\x20moved\x20to\x20a\x20new\x20date\x20(terminal;\x20new\x20segment\x20via\x20sub-order)'},{'name':'returned','role':'Trip\x20completed,\x20customer\x20returns','operator':'order_payer'},{'name':'completed','role':'All\x20segments\x20delivered,\x20funds\x20released\x20per\x20segment'},{'name':'interrupted','role':'Trip\x20interrupted\x20—\x20triggers\x20refund\x20Allocator\x20(undelivered\x20segments)\x20or\x20Arbitration'}],'guards':[{'template_id':'pattern.identity_check_service_provider_dynamic','host':'machine','purpose':'Agency\x20confirms\x20itinerary\x20and\x20supplier\x20sub-order\x20placement'},{'template_id':'pattern.repository_data_check','host':'machine','purpose':'Per-segment\x20arrival\x20WIP\x20(hotel\x20check-in,\x20transport,\x20activity)'},{'template_id':'pattern.repository_data_check','host':'machine','purpose':'Weather/force-majeure\x20witness\x20(Repository\x20query\x20or\x20convert_witness)\x20gates\x20reschedule\x20branch'},{'template_id':'pattern.identity_check_service_provider_dynamic','host':'machine','purpose':'Agency\x20approval\x20OR\x20arbiter\x20for\x20trip\x20interruption'},{'template_id':'tpl_buy_guard_order_holder','host':'service','purpose':'Supply\x20chain\x20sub-orders\x20for\x20tour\x20package\x20segments\x20(§2.12)'},{'template_id':'tpl_payment_exception_compensation','host':'machine','purpose':'Trip\x20delay/segment\x20change\x20exception\x20compensation\x20(§2.13)'},{'template_id':'tpl_repository_quote_guard_subscription','host':'repository','purpose':'Weather/travel\x20data\x20oracle\x20subscription\x20(§2.11)'}],'allocator':{'recipient':'entity','count':0x3,'mode':'amount','description':'Deposit\x2020%\x20to\x20agency,\x20final\x2080%\x20to\x20agency,\x20then\x20agency-side\x20Allocation\x20splits\x20to\x20hotel/guide/driver\x20per\x20segment\x20(per-day\x20release);\x20undelivered\x20segments\x20refunded\x20to\x20customer\x20via\x20Allocator\x20on\x20interrupted\x20(per\x20R-M1-11)'},'key_risk':'Paid\x20in\x20full\x20then\x20service\x20shrinks\x20—\x20multi-tier\x20transparency\x20prevents\x20this','build_notes':['Multi-tier\x20Allocation\x20is\x20WoWok\x27s\x20unique\x20advantage\x20over\x20traditional\x20travel\x20platforms','segment_guard\x20needs\x20standardized\x20WIP\x20templates\x20per\x20segment\x20type\x20(hotel,\x20transport,\x20activity)','Multi-tier\x20waterfall\x20needs\x20guard\x20chaining\x20validation','Weather/force-majeure\x20branches\x20enter\x20reschedule\x20(terminal)\x20or\x20partial-refund\x20interrupted\x20terminal\x20—\x20never\x20loop\x20back\x20into\x20the\x20segment\x20chain\x20(Machine\x20must\x20stay\x20a\x20DAG)','Supplier\x20sub-orders\x20each\x20carry\x20their\x20own\x20machine\x20—\x20hotel/guide/driver\x20fulfill\x20independently\x20(§2.12)','Supply\x20chain\x20sub-orders\x20—\x20each\x20tour\x20segment\x20=\x20sub-service\x20with\x20buy_guard\x20verifying\x20main\x20tour\x20order\x20(§2.12)','Payment\x20exception\x20compensation\x20for\x20flight/segment\x20delays\x20(§2.13)','Repository\x20quote_guard\x20for\x20weather/travel\x20data\x20subscription\x20revenue\x20(§2.11)']},{'name':'subscription','phase':0x3,'industry':'SaaS\x20/\x20content\x20membership\x20/\x20periodic\x20service','trust_pattern':'Periodic\x20charge,\x20cancel\x20Guard','traits':{'has_logistics':![],'communication_heavy':![],'pure_digital':!![],'long_cycle':!![],'deposit_required':![],'multi_tier_allocation':![]},'machine_shape':[{'name':'paid','role':'Entry:\x20subscription\x20paid\x20and\x20active\x20via\x20Service.buy();\x20Machine\x20starts\x20here'},{'name':'active','role':'Subscription\x20active\x20—\x20member\x20access\x20granted'},{'name':'period_1_delivered','role':'Period\x201\x20content\x20delivered\x20(WIP\x20hash)'},{'name':'period_2_delivered','role':'Period\x202\x20content\x20delivered\x20(representative;\x20per-period\x20nodes\x20at\x20build\x20time)'},{'name':'renew_confirmed','role':'Explicit\x20renewal\x20—\x20subscriber\x20confirms\x20next-period\x20charge\x20(no\x20silent\x20auto-renew)','operator':'order_payer'},{'name':'closed_cancel','role':'Subscriber\x20cancels\x20—\x20takes\x20effect\x20next\x20period;\x20pro-rata\x20refund\x20Allocator','operator':'order_payer'},{'name':'expired','role':'Subscription\x20term\x20ends'}],'guards':[{'template_id':'pattern.identity_check_order_holder','host':'machine','purpose':'User\x20confirms\x20each\x20charge\x20—\x20no\x20auto-renew\x20trap'},{'template_id':'pattern.repository_data_check','host':'machine','purpose':'Creator\x20WIP\x20hash\x20per\x20period\x20—\x20prevents\x20content\x20abandonment'},{'template_id':'pattern.identity_check_order_holder','host':'machine','purpose':'Renewal\x20requires\x20explicit\x20subscriber\x20confirmation\x20(WTS\x20notice)'},{'template_id':'cancel_guard_signer','host':'machine','purpose':'User\x20cancels\x20anytime,\x20next-period\x20effective'},{'template_id':'tpl_repository_quote_guard_subscription','host':'repository','purpose':'Creator\x20publishes\x20paid\x20data\x20(analytics,\x20market\x20data)\x20with\x20quote_guard\x20subscription\x20(§2.11)'}],'allocator':{'recipient':'entity','count':0x1,'mode':'amount','description':'Each\x20confirmed\x20charge\x20→\x20100%\x20to\x20creator;\x20unearned\x20periods\x20→\x20pro-rata\x20refund\x20to\x20subscriber\x20on\x20cancelled\x20(via\x20Allocator\x20per\x20R-M1-11)'},'key_risk':'Auto-renew\x20trap\x20and\x20platform-takes-30%\x20—\x20WoWok\x20native\x20solution','build_notes':['Pure\x20digital\x20—\x20native\x20WoWok\x20soil','charge_guard\x20needs\x20periodic\x20trigger\x20(off-chain\x20scheduler\x20+\x20on-chain\x20Guard)','Renewal\x20is\x20an\x20explicit\x20buyer-side\x20forward\x20(or\x20a\x20Guard-gated\x20auto-renew\x20WITH\x20WTS\x20notice)\x20—\x20never\x20silent','Cancellation\x20is\x20frictionless\x20and\x20next-period\x20effective;\x20pro-rata\x20refund\x20for\x20unearned\x20periods','Forbid\x20dead-end\x20nodes\x20(prevent\x20lock-in);\x20every\x20state\x20must\x20have\x20a\x20forward\x20or\x20be\x20an\x20intended\x20terminal','Targets\x20indie\x20creators,\x20niche\x20SaaS,\x20paid\x20newsletters','Repository\x20quote_guard\x20for\x20creator\x20data\x20subscription\x20revenue\x20—\x20creators\x20publish\x20paid\x20data,\x20users\x20pay\x20to\x20access\x20(§2.11)']},{'name':'retail','phase':0x1,'industry':'Goods\x20retail\x20/\x20marketplace\x20/\x20e-commerce','trust_pattern':'Escrow\x20+\x20confirm-on-receipt\x20release','traits':{'has_logistics':!![],'communication_heavy':![],'pure_digital':![],'long_cycle':![],'deposit_required':![],'multi_tier_allocation':![]},'machine_shape':[{'name':'paid','role':'Entry:\x20order\x20created\x20and\x20paid\x20via\x20the\x20on-chain\x20buy\x20flow;\x20Machine\x20starts\x20here'},{'name':'processing','role':'Merchant\x20prepares\x20order\x20(picking/packing);\x20required_info\x20(shipping\x20address)\x20collected\x20via\x20Messenger'},{'name':'shipped','role':'Merchant\x20ships\x20goods,\x20records\x20shipping\x20WIP\x20(tracking\x20number)'},{'name':'in_transit','role':'Logistics\x20leg\x20active\x20—\x20tracking\x20WIP\x20updates'},{'name':'delivered','role':'Goods\x20delivered\x20to\x20buyer'},{'name':'confirmed','role':'Buyer\x20confirms\x20receipt\x20(confirm\x20gate:\x20only\x20buyer\x20can\x20confirm)','operator':'order_payer'},{'name':'completed','role':'Funds\x20released\x20to\x20merchant'},{'name':'return_requested','role':'Buyer\x20requests\x20return\x20within\x20refund_window\x20(>=7d)','operator':'order_payer'},{'name':'returned','role':'Buyer\x20ships\x20goods\x20back\x20(return\x20WIP:\x20tracking\x20number)\x20—\x20triggers\x20refund\x20Allocator\x20(R-M1-11\x20compliant)','operator':'order_payer'},{'name':'closed_cancel','role':'Pre-ship\x20cancellation\x20—\x20triggers\x20refund\x20Allocator','operator':'order_payer'}],'guards':[{'template_id':'pattern.verifier_evidence_philosophy','host':'service','purpose':'Verify\x20inventory\x20and\x20buyer\x20address\x20on\x20purchase'},{'template_id':'ship_guard_wip','host':'machine','purpose':'Shipping\x20evidence\x20WIP\x20(logistics\x20tracking\x20number)'},{'template_id':'pattern.identity_check_order_holder','host':'machine','purpose':'Only\x20buyer\x20can\x20confirm\x20receipt'},{'template_id':'pattern.time_lock_progress','host':'machine','purpose':'Return\x20request\x20gated\x20by\x20refund_window\x20time-lock\x20(clock)'},{'template_id':'pattern.identity_check_service_provider_dynamic','host':'machine','purpose':'Return\x20&\x20refund\x20requires\x20merchant\x20permission\x20OR\x20arbiter'},{'template_id':'tpl_payment_exception_compensation','host':'machine','purpose':'Logistics\x20delay\x20exception\x20compensation\x20(§2.13)'}],'allocator':{'recipient':'entity','count':0x3,'mode':'rate','description':'Platform\x2010%\x20+\x20Merchant\x2090%\x20(rate-based\x20split)\x20on\x20completed;\x20full\x20refund\x20to\x20buyer\x20on\x20returned/cancelled\x20via\x20refund\x20Allocator'},'key_risk':'Products\x20don\x27t\x20match\x20description\x20—\x20no\x20refund\x20path\x20for\x20returns','build_notes':['Logistics\x20WIP\x20(tracking\x20number)\x20is\x20essential\x20—\x20shipping\x20evidence\x20protects\x20both\x20parties\x20in\x20return\x20disputes','Confirm\x20gate\x20prevents\x20merchant\x20from\x20self-confirming\x20receipt','Refund\x20path\x20must\x20support\x20return-and-exchange\x20flow;\x20refund_window\x20>=\x207d','Return\x20request\x20is\x20time-lock\x20gated\x20—\x20after\x20the\x20window\x20closes,\x20returns\x20need\x20merchant\x20permission\x20or\x20arbitration','Compensation\x20fund\x20covers\x20return/exchange\x20disputes','R-M1-11:\x20no\x20\x27refunded\x27\x20node\x20—\x20refunds\x20route\x20via\x20Allocator\x20triggered\x20by\x20returned/cancelled\x20business\x20states;\x20disputes\x20go\x20to\x20Arbitration']},{'name':'general','phase':0x1,'industry':'Anything\x20not\x20covered\x20/\x20hybrid','trust_pattern':'User-defined\x20from\x20scratch','traits':{'has_logistics':![],'communication_heavy':![],'pure_digital':![],'long_cycle':![],'deposit_required':![],'multi_tier_allocation':![]},'machine_shape':[],'guards':[],'allocator':{'recipient':'signer','count':0x0,'mode':'amount','description':'User-defined\x20—\x20no\x20defaults'},'key_risk':'No\x20safety\x20net\x20—\x20user\x20must\x20design\x20all\x20trust\x20mechanisms\x20manually','build_notes':['Escape\x20hatch:\x20any\x20user\x20can\x20switch\x20to\x20general\x20mode\x20at\x20any\x20time','Already-created\x20objects\x20under\x20a\x20previous\x20mode\x20remain\x20on-chain\x20(REUSE\x20pattern)','wowok-machine\x20/\x20wowok-guard\x20/\x20wowok-provider\x20become\x20primary\x20references']}];export function matchScenarioMode(a){const b=a['toLowerCase'](),c=inferScenarioTraits(a),e=SCENARIO_MODES['map'](h=>{let i=0x0,j=0x0;for(const k of Object['keys'](c)){j+=0x1;if(h['traits'][k]===c[k])i+=0x1;}if(h['name']!=='general'){const l=MODE_KEYWORDS[h['name']]??[];for(const m of l){if(b['includes'](m))i+=0.5;}}return{'mode':h,'score':i,'total':j};});let f=e[0x0];for(const h of e){if(h['score']>f['score'])f=h;}const g=f['total']>0x0?Math['min'](0x1,f['score']/f['total']):0x0;return{'mode':f['mode'],'confidence':g};}const MODE_KEYWORDS={'freelance':['freelance','design','develop','consult','write','consulting'],'rental':['rent','rental','lease','borrow','equipment','vehicle','property'],'education':['course','training','tutor','teach','education','class'],'travel':['tour','travel','trip','itinerary','vacation'],'subscription':['subscribe','subscription','membership','saas','newsletter','recurring'],'retail':['retail','shop','store','marketplace','sell\x20goods','ecommerce','e-commerce']};export function inferScenarioTraits(a){const b=a['toLowerCase']();return{'has_logistics':/ship|delivery|equipment|vehicle|physical|goods/['test'](b),'communication_heavy':/consult|discuss|back-and-forth|custom|bespoke|negotiate/['test'](b),'pure_digital':/digital|file|download|online|software|code|design|content/['test'](b),'long_cycle':/month|long-term|engagement|project|semester|period/['test'](b),'deposit_required':/deposit|escrow|prepay|tuition|reserve/['test'](b),'multi_tier_allocation':/tier|segment|multi-|agency|hotel|guide|driver/['test'](b)};}export const MODE_COMPOSITIONS=[{'modes':['freelance','subscription'],'use_case':'Retainer\x20consulting\x20(monthly\x20+\x20milestone)','conflict_resolution':'Allocator:\x20split\x20into\x20retainer\x20(subscription)\x20+\x20milestone\x20(freelance)'},{'modes':['rental','education'],'use_case':'Equipment\x20training\x20rental','conflict_resolution':'Machine:\x20extend\x20rental\x20nodes\x20with\x20attendance\x20gates'},{'modes':['travel','rental'],'use_case':'Tour\x20with\x20equipment','conflict_resolution':'Allocator:\x20segment\x20allocation\x20+\x20deposit\x20escrow\x20side-by-side'}];export function getScenarioMode(a){return SCENARIO_MODES['find'](b=>b['name']===a);}export function listScenarioModes(){return SCENARIO_MODES;}export function getShippedModes(){return SCENARIO_MODES['filter'](a=>a['phase']===0x1);}export function getModeCompositions(a){return MODE_COMPOSITIONS['filter'](b=>b['modes']['includes'](a));}export const SCENARIO_MODES_VERSION=0x6;
1
+ export const BUYER_ACTION_NODE_RE=/^(reviewed|return_requested|guest_cancelled|withdrawn|charging|cancelled|closed_cancel)$/i;export function unannotatedBuyerActionNodes(a){return a['filter'](b=>!b['operator']&&BUYER_ACTION_NODE_RE['test'](b['name']))['map'](b=>b['name']);}export const SCENARIO_MODES=[{'name':'freelance','phase':0x1,'industry':'Design\x20/\x20dev\x20/\x20consulting\x20/\x20writing','trust_pattern':'Milestone\x20allocation,\x20acceptance\x20gate','traits':{'has_logistics':![],'communication_heavy':!![],'pure_digital':!![],'long_cycle':!![],'deposit_required':![],'multi_tier_allocation':![]},'default_template':'freelance/enterprise-talent-market','key_risk':'Customer\x20never\x20accepts\x20delivery\x20—\x20provider\x20cannot\x20get\x20paid','build_notes':['Use\x20Service\x20`setting_locked_time`\x20to\x20lock\x20rules\x20for\x20the\x20engagement\x20duration','WIP\x20hash\x20on\x20every\x20milestone\x20deliverable\x20is\x20mandatory\x20—\x20protects\x20provider\x20in\x20disputes','Acceptance\x20gate\x20is\x20the\x20trust\x20pivot\x20—\x20both\x20parties\x20must\x20agree\x20on\x20criteria\x20per\x20milestone','Milestones\x20map\x20to\x20deliverable-Guarded\x20forwards;\x20each\x20accepted\x20milestone\x20releases\x20its\x20escrowed\x20slice\x20(allocation.distribute_milestone)','Scope\x20changes\x20are\x20recorded\x20as\x20WTS\x20change-requests\x20at\x20kickoff/throughout\x20—\x20never\x20silent','R-M1-11:\x20no\x20\x27refunded\x27/\x27disputed\x27/\x27arb\x27/\x27cancelled\x27\x20nodes\x20—\x20refunds\x20route\x20via\x20Allocator\x20(to\x20OrderHolder)\x20triggered\x20by\x20\x27closed_cancel\x27,\x20disputes\x20via\x20Arbitration','Payment\x20exception\x20compensation\x20for\x20delivery\x20delays\x20—\x20provider\x20Treasury\x20auto-compensates\x20customer\x20(§2.13)','Project-Catalog\x20orders\x20have\x20NO\x20milestones\x20(single\x20funded\x20order\x20+\x20steps\x20timeline);\x20milestones\x20here\x20model\x20fixed-price\x20CONTRACTS.\x20For\x20catalog-style\x20listings\x20(tiered\x20pricing\x20+\x20add-ons\x20+\x20buyer\x20requirements)\x20use\x20the\x20freelance/catalog-tiers\x20template\x20instead','Time-bound\x20catalog\x20rules\x20(24h\x20instant\x20cancel,\x2048h\x20requirements\x20timeout,\x2014-day\x20auto-accept)\x20need\x20a\x20time\x20Guard\x20PLUS\x20an\x20off-chain\x20keeper\x20per\x20window\x20-\x20Guards\x20take\x20an\x20immutable\x20duration\x20constant']},{'name':'rental','phase':0x1,'industry':'Equipment\x20/\x20vehicle\x20/\x20property\x20rental','trust_pattern':'Deposit\x20escrow,\x20return\x20inspection','traits':{'has_logistics':!![],'communication_heavy':!![],'pure_digital':![],'long_cycle':![],'deposit_required':!![],'multi_tier_allocation':![]},'default_template':'rental/institutional-longstay','key_risk':'Owner\x20claims\x20damage\x20without\x20pre-rental\x20WIP\x20—\x20customer\x20loses\x20deposit\x20unfairly','build_notes':['Pre-rental\x20WIP\x20is\x20non-negotiable\x20—\x20without\x20it,\x20damage\x20claims\x20fail','Deposit\x20must\x20be\x20escrowed,\x20not\x20direct-transferred\x20—\x20enables\x20fair\x20deduction','Inspection\x20gate\x20prevents\x20customer\x20from\x20denying\x20damage','Overdue\x20handling\x20uses\x20a\x20time-lock\x20Guard\x20(clock)\x20—\x20the\x20Guard\x20only\x20ALLOWS\x20the\x20overdue\x20transition;\x20automatic\x20advancement\x20needs\x20an\x20off-chain\x20keeper\x20(see\x20DESIGN-REVIEW\x20C-3)','Extensions\x20are\x20modeled\x20as\x20separate\x20sub-orders\x20(REUSE\x20pattern),\x20not\x20as\x20machine\x20cycles\x20—\x20the\x20Machine\x20stays\x20a\x20DAG','R-M1-11:\x20no\x20\x27deposit_refunded\x27/\x27deposit_deducted\x27/\x27refunded\x27\x20nodes\x20—\x20deposit\x20refund/deduction\x20flows\x20through\x20Allocator\x20triggered\x20by\x20return_approved/damage_confirmed\x20business\x20states','Payment\x20exception\x20compensation\x20for\x20return\x20delays\x20—\x20Treasury\x20withdraws\x20scene-bound\x20Payment\x20(§2.13)','Repository\x20quote_guard\x20for\x20weather/usage\x20data\x20subscription\x20revenue\x20(§2.11)']},{'name':'education','phase':0x2,'industry':'Courses\x20/\x20training\x20/\x20tutoring','trust_pattern':'Periodic\x20release\x20per\x20session,\x20attendance\x20Guard','traits':{'has_logistics':![],'communication_heavy':!![],'pure_digital':![],'long_cycle':!![],'deposit_required':!![],'multi_tier_allocation':![]},'default_template':'education/live-class-cohort','key_risk':'Tutoring\x20institutions\x20run\x20away\x20with\x20prepaid\x20tuition','build_notes':['Use\x20Service\x20`setting_locked_time`\x20to\x20lock\x20rules\x20for\x20the\x20entire\x20term\x20(regulatory\x20compliance,\x20>=90d)','Attendance\x20Guard\x20needs\x20WIP\x20hash\x20for\x20session\x20content\x20commitment;\x20attendance\x20evidence\x20lives\x20in\x20the\x20class\x20Repository','Per-session\x20release\x20requires\x20threshold-based\x20trigger\x20—\x20each\x20attended\x20session\x20releases\x201/N','session_1..session_3\x20are\x20representative\x20—\x20configure\x20the\x20real\x20session\x20count\x20(session_N)\x20at\x20build\x20time;\x20each\x20session\x20=\x20one\x20attendance-Guarded\x20forward','Pause/deferral\x20is\x20a\x20terminal\x20node\x20+\x20new\x20sub-order\x20(REUSE\x20pattern)\x20—\x20never\x20a\x20loop\x20back\x20into\x20the\x20session\x20chain\x20(Machine\x20must\x20stay\x20a\x20DAG)','Supply\x20chain\x20sub-orders\x20for\x20course\x20module\x20progressive\x20unlock\x20—\x20each\x20module\x20=\x20sub-service\x20with\x20buy_guard\x20verifying\x20previous\x20module\x20completion\x20(§2.12)','Repository\x20for\x20learning\x20progress\x20collaboration\x20data\x20—\x20progress\x20as\x20key,\x20session\x20data\x20as\x20value\x20(§2.10)']},{'name':'travel','phase':0x2,'industry':'Custom\x20tours\x20/\x20multi-segment\x20trips','trust_pattern':'Multi-tier\x20allocation\x20per\x20segment','traits':{'has_logistics':![],'communication_heavy':!![],'pure_digital':![],'long_cycle':!![],'deposit_required':!![],'multi_tier_allocation':!![]},'default_template':'travel/destination-experience','key_risk':'Paid\x20in\x20full\x20then\x20service\x20shrinks\x20—\x20multi-tier\x20transparency\x20prevents\x20this','build_notes':['Multi-tier\x20Allocation\x20is\x20WoWok\x27s\x20unique\x20advantage\x20over\x20traditional\x20travel\x20platforms','segment_guard\x20needs\x20standardized\x20WIP\x20templates\x20per\x20segment\x20type\x20(hotel,\x20transport,\x20activity)','Multi-tier\x20waterfall\x20needs\x20guard\x20chaining\x20validation','Weather/force-majeure\x20branches\x20enter\x20reschedule\x20(terminal)\x20or\x20partial-refund\x20interrupted\x20terminal\x20—\x20never\x20loop\x20back\x20into\x20the\x20segment\x20chain\x20(Machine\x20must\x20stay\x20a\x20DAG)','Supplier\x20sub-orders\x20each\x20carry\x20their\x20own\x20machine\x20—\x20hotel/guide/driver\x20fulfill\x20independently\x20(§2.12)','Supply\x20chain\x20sub-orders\x20—\x20each\x20tour\x20segment\x20=\x20sub-service\x20with\x20buy_guard\x20verifying\x20main\x20tour\x20order\x20(§2.12)','Payment\x20exception\x20compensation\x20for\x20flight/segment\x20delays\x20(§2.13)','Repository\x20quote_guard\x20for\x20weather/travel\x20data\x20subscription\x20revenue\x20(§2.11)']},{'name':'subscription','phase':0x3,'industry':'SaaS\x20/\x20content\x20membership\x20/\x20periodic\x20service','trust_pattern':'Periodic\x20charge,\x20cancel\x20Guard','traits':{'has_logistics':![],'communication_heavy':![],'pure_digital':!![],'long_cycle':!![],'deposit_required':![],'multi_tier_allocation':![]},'default_template':'subscription/creator-membership','key_risk':'Auto-renew\x20trap\x20and\x20platform-takes-30%\x20—\x20WoWok\x20native\x20solution','build_notes':['Pure\x20digital\x20—\x20native\x20WoWok\x20soil','charge_guard\x20needs\x20periodic\x20trigger\x20(off-chain\x20scheduler\x20+\x20on-chain\x20Guard)','Renewal\x20is\x20an\x20explicit\x20buyer-side\x20forward\x20(or\x20a\x20Guard-gated\x20auto-renew\x20WITH\x20WTS\x20notice)\x20—\x20never\x20silent','Cancellation\x20is\x20frictionless\x20and\x20next-period\x20effective;\x20pro-rata\x20refund\x20for\x20unearned\x20periods','Forbid\x20dead-end\x20nodes\x20(prevent\x20lock-in);\x20every\x20state\x20must\x20have\x20a\x20forward\x20or\x20be\x20an\x20intended\x20terminal','Targets\x20indie\x20creators,\x20niche\x20SaaS,\x20paid\x20newsletters','Repository\x20quote_guard\x20for\x20creator\x20data\x20subscription\x20revenue\x20—\x20creators\x20publish\x20paid\x20data,\x20users\x20pay\x20to\x20access\x20(§2.11)']},{'name':'retail','phase':0x1,'industry':'Goods\x20retail\x20/\x20marketplace\x20/\x20e-commerce','trust_pattern':'Escrow\x20+\x20confirm-on-receipt\x20release','traits':{'has_logistics':!![],'communication_heavy':![],'pure_digital':![],'long_cycle':![],'deposit_required':![],'multi_tier_allocation':![]},'default_template':'retail/scale-marketplace','key_risk':'Products\x20don\x27t\x20match\x20description\x20—\x20no\x20refund\x20path\x20for\x20returns','build_notes':['Logistics\x20WIP\x20(tracking\x20number)\x20is\x20essential\x20—\x20shipping\x20evidence\x20protects\x20both\x20parties\x20in\x20return\x20disputes','Confirm\x20gate\x20prevents\x20merchant\x20from\x20self-confirming\x20receipt','Refund\x20path\x20must\x20support\x20return-and-exchange\x20flow;\x20refund_window\x20>=\x207d','Return\x20request\x20is\x20time-lock\x20gated\x20—\x20after\x20the\x20window\x20closes,\x20returns\x20need\x20merchant\x20permission\x20or\x20arbitration','Compensation\x20fund\x20covers\x20return/exchange\x20disputes','R-M1-11:\x20no\x20\x27refunded\x27\x20node\x20—\x20refunds\x20route\x20via\x20Allocator\x20triggered\x20by\x20returned/cancelled\x20business\x20states;\x20disputes\x20go\x20to\x20Arbitration']},{'name':'general','phase':0x1,'industry':'Anything\x20not\x20covered\x20/\x20hybrid','trust_pattern':'User-defined\x20from\x20scratch','traits':{'has_logistics':![],'communication_heavy':![],'pure_digital':![],'long_cycle':![],'deposit_required':![],'multi_tier_allocation':![]},'default_template':null,'key_risk':'No\x20safety\x20net\x20—\x20user\x20must\x20design\x20all\x20trust\x20mechanisms\x20manually','build_notes':['Escape\x20hatch:\x20any\x20user\x20can\x20switch\x20to\x20general\x20mode\x20at\x20any\x20time','Already-created\x20objects\x20under\x20a\x20previous\x20mode\x20remain\x20on-chain\x20(REUSE\x20pattern)','wowok-machine\x20/\x20wowok-guard\x20/\x20wowok-provider\x20become\x20primary\x20references']}];export function matchScenarioMode(a){const b=a['toLowerCase'](),c=inferScenarioTraits(a),e=SCENARIO_MODES['map'](h=>{let i=0x0,j=0x0;for(const k of Object['keys'](c)){j+=0x1;if(h['traits'][k]===c[k])i+=0x1;}if(h['name']!=='general'){const l=MODE_KEYWORDS[h['name']]??[];for(const m of l){if(b['includes'](m))i+=0.5;}}return{'mode':h,'score':i,'total':j};});let f=e[0x0];for(const h of e){if(h['score']>f['score'])f=h;}const g=f['total']>0x0?Math['min'](0x1,f['score']/f['total']):0x0;return{'mode':f['mode'],'confidence':g};}const MODE_KEYWORDS={'freelance':['freelance','design','develop','consult','write','consulting'],'rental':['rent','rental','lease','borrow','equipment','vehicle','property'],'education':['course','training','tutor','teach','education','class'],'travel':['tour','travel','trip','itinerary','vacation'],'subscription':['subscribe','subscription','membership','saas','newsletter','recurring'],'retail':['retail','shop','store','marketplace','sell\x20goods','ecommerce','e-commerce']};export function inferScenarioTraits(a){const b=a['toLowerCase']();return{'has_logistics':/ship|delivery|equipment|vehicle|physical|goods/['test'](b),'communication_heavy':/consult|discuss|back-and-forth|custom|bespoke|negotiate/['test'](b),'pure_digital':/digital|file|download|online|software|code|design|content/['test'](b),'long_cycle':/month|long-term|engagement|project|semester|period/['test'](b),'deposit_required':/deposit|escrow|prepay|tuition|reserve/['test'](b),'multi_tier_allocation':/tier|segment|multi-|agency|hotel|guide|driver/['test'](b)};}export const MODE_COMPOSITIONS=[{'modes':['freelance','subscription'],'use_case':'Retainer\x20consulting\x20(monthly\x20+\x20milestone)','conflict_resolution':'Allocator:\x20split\x20into\x20retainer\x20(subscription)\x20+\x20milestone\x20(freelance)'},{'modes':['rental','education'],'use_case':'Equipment\x20training\x20rental','conflict_resolution':'Machine:\x20extend\x20rental\x20nodes\x20with\x20attendance\x20gates'},{'modes':['travel','rental'],'use_case':'Tour\x20with\x20equipment','conflict_resolution':'Allocator:\x20segment\x20allocation\x20+\x20deposit\x20escrow\x20side-by-side'}];export function getScenarioMode(a){return SCENARIO_MODES['find'](b=>b['name']===a);}export function listScenarioModes(){return SCENARIO_MODES;}export function getShippedModes(){return SCENARIO_MODES['filter'](a=>a['phase']===0x1);}export function getModeCompositions(a){return MODE_COMPOSITIONS['filter'](b=>b['modes']['includes'](a));}export const SCENARIO_MODES_VERSION=0x7;
@@ -1 +1 @@
1
- export const SERVICE_PERMISSIONS=[{'index':0x12c,'name':'SERVICE_NEW','description':'Create\x20new\x20Service','governed_operation':'create\x20a\x20new\x20Service','post_publish_mutability':'na'},{'index':0x12d,'name':'SERVICE_DESCRIPTION','description':'Modify\x20Service\x20description','governed_operation':'modify\x20the\x20Service\x20description','post_publish_mutability':'mutable'},{'index':0x12f,'name':'SERVICE_LOCATION','description':'Set\x20Service\x20location/URL','governed_operation':'set\x20the\x20Service\x20location/URL','post_publish_mutability':'mutable'},{'index':0x130,'name':'SERVICE_REPOSITORY','description':'Add/remove\x20Repository\x20references','governed_operation':'add/remove/clear\x20Repository\x20references','post_publish_mutability':'mutable'},{'index':0x131,'name':'SERVICE_SALES','description':'Add/set/remove/clear\x20sales\x20items','governed_operation':'add/set/remove/clear\x20sales\x20items','post_publish_mutability':'mutable'},{'index':0x132,'name':'SERVICE_MACHINE','description':'Bind/unbind\x20Machine\x20workflow\x20template','governed_operation':'bind/unbind\x20the\x20Machine\x20workflow\x20template','post_publish_mutability':'immutable'},{'index':0x133,'name':'SERVICE_BUY_GUARD','description':'Set/clear\x20buy\x20Guard\x20(post-publish\x20mutable)','governed_operation':'set/clear\x20the\x20buy_guard\x20check','post_publish_mutability':'mutable'},{'index':0x134,'name':'SERVICE_ARBITRATION','description':'Add/remove\x20Arbitration\x20references','governed_operation':'add/remove/clear\x20Arbitration\x20references','post_publish_mutability':'immutable'},{'index':0x135,'name':'SERVICE_CUSTOMER_INFO_REQUIRED','description':'Set\x20customer\x20required\x20info\x20fields','governed_operation':'set\x20customer\x20required\x20info\x20fields','post_publish_mutability':'mutable'},{'index':0x136,'name':'SERVICE_PAUSE','description':'Pause/resume\x20Service\x20(block\x20new\x20orders)','governed_operation':'pause/resume\x20the\x20Service','post_publish_mutability':'mutable'},{'index':0x137,'name':'SERVICE_PUBLISH','description':'Publish\x20Service\x20(IRREVERSIBLE)','governed_operation':'publish\x20the\x20Service\x20(irreversible)','post_publish_mutability':'one_shot'},{'index':0x138,'name':'SERVICE_DISCOUNT','description':'Issue/discount_destroy\x20discount\x20coupons','governed_operation':'issue/destroy\x20discount\x20coupons','post_publish_mutability':'mutable'},{'index':0x139,'name':'SERVICE_ORDER_ALLOCATOR','description':'Set\x20order\x20allocator\x20strategy','governed_operation':'set\x20the\x20order_allocators\x20strategy','post_publish_mutability':'immutable'},{'index':0x13a,'name':'SERVICE_COMPENSATION_FUND_WITHDRAW','description':'Withdraw\x20compensation\x20fund\x20(time-locked)','governed_operation':'withdraw\x20from\x20the\x20compensation_fund\x20(time-locked)','post_publish_mutability':'locked_by_duration'},{'index':0x13b,'name':'SERVICE_COMPENSATION_FUND_DEPOSIT','description':'Deposit\x20to\x20compensation\x20fund','governed_operation':'deposit\x20to\x20the\x20compensation_fund','post_publish_mutability':'mutable'},{'index':0x13c,'name':'SERVICE_COMPENSATION_FUND_RECEIVE','description':'Receive\x20compensation\x20fund\x20(arbitration\x20payout)','governed_operation':'receive\x20the\x20compensation_fund\x20payout\x20(arbitration\x20payout)','post_publish_mutability':'mutable'},{'index':0x13d,'name':'SERVICE_COMPENSATION_LOCK_DURATION_ADD','description':'Extend\x20setting_lock_duration\x20(only-increase)','governed_operation':'extend\x20setting_lock_duration\x20(only-increase)','post_publish_mutability':'mutable'},{'index':0x13e,'name':'SERVICE_REWARD','description':'Add/remove\x20Reward\x20references\x20(remove/clear\x20time-locked)','governed_operation':'add/remove/clear\x20Reward\x20references','post_publish_mutability':'locked_by_duration'},{'index':0x13f,'name':'SERVICE_OWNER_RECEIVE','description':'Receive\x20Payment/objects\x20to\x20owner','governed_operation':'receive\x20Payments/objects\x20to\x20owner','post_publish_mutability':'mutable'},{'index':0x140,'name':'SERVICE_UM','description':'Bind/unbind\x20Contact\x20as\x20UM','governed_operation':'bind/unbind\x20Contact\x20as\x20UM','post_publish_mutability':'mutable'},{'index':0x141,'name':'SERVICE_ARB_STATEMENT','description':'Append\x20seller\x20statement\x20to\x20an\x20Arb\x20case\x20(event-only)','governed_operation':'append\x20seller\x20text\x20to\x20a\x20case\x20against\x20an\x20order\x20of\x20this\x20service\x20(ArbStatementEvent;\x20no\x20Arb\x20state\x20change)','post_publish_mutability':'mutable'}];export const SERVICE_ORDER_FLOW_STAGES=[{'stage':0x1,'name':'pre_check','preconditions':['Service.bPublished\x20==\x20true\x20(else\x20E_NOT_PUBLISHED,\x20service:7)','Service.bPaused\x20==\x20false\x20(else\x20E_PAUSED,\x20service:19)','buy_guard\x20(if\x20set)\x20added\x20to\x20guards[]\x20list\x20for\x20verification'],'side_effects':[],'always_executed':!![]},{'stage':0x2,'name':'wip_verify','preconditions':['buy.items\x20non-empty','Each\x20item.name\x20matches\x20a\x20sale\x20in\x20Service.sales\x20(else\x20E_SALE_ITEM_NOT_FOUND,\x20service:32)','sale.suspension\x20==\x20false\x20(else\x20E_SALE_SUSPENDED)'],'side_effects':['If\x20buyer\x20passes\x20empty\x20wip_hash,\x20SDK\x20auto-fills\x20with\x20sale.wip_hash','verifiedWipUrls\x20Set\x20avoids\x20re-verifying\x20same\x20WIP\x20URL\x20across\x20items','verify_wip()\x20fetches\x20WIP\x20file\x20and\x20compares\x20hash\x20(else\x20E_WIP_HASH_NOT_MATCH)'],'always_executed':!![]},{'stage':0x3,'name':'quote','preconditions':['All\x20items\x20have\x20valid\x20sale\x20+\x20wip_hash\x20match','stock\x20>=\x20purchase\x20quantity\x20(else\x20E_STOCK_NOT_ENOUGH,\x20service:16)','discount\x20object\x20(if\x20used)\x20is\x20valid\x20and\x20within\x20its\x20[time_start,\x20time_end]\x20window\x20(else\x20E_DISCOUNT_TIME_INVALID)'],'side_effects':['The\x20quote\x20step\x20computes\x20the\x20total\x20price\x20(with\x20discount\x20if\x20applicable)','⚠️\x20Stock\x20is\x20deducted\x20(split)\x20—\x20side\x20effect\x20is\x20NOT\x20auto-rolled-back\x20on\x20later\x20failure','The\x20on-chain\x20quote\x20call\x20executes\x20(the\x20discount\x20path\x20validates\x20the\x20Clock\x20time-window\x20check)'],'always_executed':!![]},{'stage':0x4,'name':'create_order','preconditions':['Quote\x20object\x20from\x20stage\x203','Registrar\x20+\x20Clock\x20objects\x20available'],'side_effects':['The\x20atomic\x20on-chain\x20buy\x20call\x20executes\x20(passport-gated\x20variant\x20supported)','Order\x20object\x20created\x20(builder=customer,\x20service=Service.id)','Order.id\x20recorded\x20for\x20stages\x205-7'],'always_executed':!![]},{'stage':0x5,'name':'create_allocation','preconditions':['Service.order_allocators\x20is\x20Some\x20(configured)','Order\x20from\x20stage\x204','CoinParam\x20for\x20total_pay\x20matches\x20Service<T>\x20type'],'side_effects':['The\x20on-chain\x20allocation\x20call\x20executes','Allocation\x20object\x20created\x20(guard-selected\x20fund\x20distribution)','Order.allocation\x20=\x20Allocation\x20address'],'always_executed':!![]},{'stage':0x6,'name':'create_progress','preconditions':['Service.machine\x20is\x20Some\x20(machine\x20bound)','Order\x20from\x20stage\x204','Machine\x20from\x20Service.machine'],'side_effects':['The\x20on-chain\x20progress-creation\x20call\x20executes','Progress\x20object\x20created\x20(Progress.machine\x20=\x20Service.machine,\x20Progress.task\x20=\x20Order.id)'],'always_executed':![]},{'stage':0x7,'name':'post_actions','preconditions':['Order/Allocation/Progress\x20objects\x20from\x20stages\x204-6'],'side_effects':['Attach\x20agents\x20to\x20the\x20order\x20(if\x20order_new.agents\x20provided)','order_required_info_update\x20(if\x20order_required_info\x20provided)','Transfer\x20Order\x20ownership\x20(if\x20transfer\x20provided\x20—\x20sets\x20new\x20Order\x20owner)','namedNewOrder\x20/\x20namedNewAllocation\x20/\x20namedNewProgress\x20(local\x20naming)'],'always_executed':![]},{'stage':0x8,'name':'return_result','preconditions':['All\x20preceding\x20stages\x20succeeded'],'side_effects':['Returns\x20BuyResult\x20{\x20order,\x20allocation?,\x20progress?\x20}','Caller\x20proceeds\x20to\x20sign\x20+\x20submit\x20transaction'],'always_executed':!![]}];export const SERVICE_CROSS_OBJECT_BINDINGS=[{'object':'Machine','field':'machine','required':![],'locked_after_publish':!![],'notes':'Workflow\x20template;\x20post-publish\x20immutable\x20(F-S-20).\x20Progress.machine\x20inherits\x20this\x20value.'},{'object':'Guard','field':'buy_guard','required':![],'locked_after_publish':![],'notes':'Buyer\x20eligibility\x20guard;\x20post-publish\x20STILL\x20MUTABLE\x20(unusual\x20—\x20see\x20F-S-26)'},{'object':'Allocation','field':'order_allocators','required':!![],'locked_after_publish':!![],'notes':'Order\x20fund\x20distribution\x20strategy;\x20publish\x20prerequisite\x20(F-S-18).\x20Post-publish\x20immutable\x20(F-S-22).'},{'object':'Arbitration','field':'arbitrations','required':![],'locked_after_publish':![],'notes':'Dispute\x20handlers;\x20required\x20if\x20compensation_fund\x20>\x200\x20(F-S-19).\x20add\x20always\x20mutable;\x20remove/clear\x20time-locked\x20after\x20publish\x20(F-S-21).'},{'object':'Repository','field':'repositories','required':![],'locked_after_publish':![],'notes':'Shared\x20data\x20stores;\x20mutable\x20post-publish'},{'object':'Reward','field':'rewards','required':![],'locked_after_publish':![],'notes':'Marketing\x20incentives;\x20add\x20always\x20mutable;\x20remove/clear\x20time-locked\x20after\x20publish\x20(F-S-24)'},{'object':'Contact','field':'um','required':![],'locked_after_publish':![],'notes':'User\x20Manager\x20(Contact\x20object);\x20mutable\x20post-publish'},{'object':'Treasury','field':'(indirect\x20via\x20order_allocators.sharing.who=Entity)','required':![],'locked_after_publish':![],'notes':'Treasury\x20is\x20referenced\x20by\x20Allocation.sharing.who,\x20not\x20by\x20Service\x20directly'}];export const SERVICE_SCENES=[{'id':'service_retail','name':'Retail\x20e-commerce\x20Service','category':'retail','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['bind/unbind\x20the\x20UM\x20Contact','builder\x20(transfer)'],'admin_operations':['update\x20the\x20description','set\x20the\x20location/URL','set\x20customer\x20required\x20info\x20fields'],'permission_index_operations':['publish\x20the\x20Service\x20(311)','pause/resume\x20the\x20Service\x20(310)','add/set/remove/clear\x20sales\x20items\x20(305)','set\x20the\x20order_allocators\x20strategy\x20(313)','set/clear\x20the\x20buy_guard\x20check\x20(307)','issue/destroy\x20discount\x20coupons\x20(312)'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['order_allocators\x20must\x20be\x20set\x20(F-S-18,\x20E_NO_ALLOCATOR)','If\x20compensation_fund\x20>\x200,\x20arbitrations\x20must\x20be\x20non-empty\x20(F-S-19)'],'common_patterns':['Multi-tier\x20pricing\x20via\x20sales[]\x20(Standard/Premium/Enterprise)','WIP\x20hash\x20per\x20sale\x20item\x20for\x20tamper-proof\x20product\x20info','buy_guard\x20for\x20KYC\x20whitelist\x20during\x20pre-sale,\x20then\x20null\x20for\x20public\x20sale','compensation_fund\x20deposited\x20before\x20publish\x20+\x20arbitrations\x20configured'],'recommended_templates':['T-S-01','T-S-06']},{'id':'service_rental','name':'Rental\x20Service\x20(short/long-term)','category':'rental','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['bind/unbind\x20the\x20UM\x20Contact','builder\x20(transfer)'],'admin_operations':['update\x20the\x20description','set\x20the\x20location/URL'],'permission_index_operations':['publish\x20the\x20Service\x20(311)','add/set\x20sales\x20items\x20(305)','bind\x20the\x20Machine\x20workflow\x20(306)\x20—\x20for\x20rental\x20workflow','add\x20Arbitration\x20references\x20(308)\x20—\x20for\x20deposit\x20disputes'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['order_allocators\x20must\x20be\x20set','machine\x20recommended\x20(rental\x20workflow\x20with\x20deposit/return\x20stages)','arbitrations\x20recommended\x20(deposit\x20refund\x20disputes)'],'common_patterns':['Machine\x20workflow\x20with\x20\x27Deposit\x20→\x20Use\x20→\x20Return\x20→\x20Refund\x27\x20nodes','compensation_fund\x20holds\x20deposit\x20guarantees','buy_guard\x20verifies\x20renter\x20identity/KYC','stock=1\x20per\x20rental\x20item\x20(unique\x20items)'],'recommended_templates':['T-S-02','T-S-04']},{'id':'service_subscription','name':'Subscription\x20Service\x20(recurring)','category':'subscription','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['bind/unbind\x20the\x20UM\x20Contact','builder\x20(transfer)'],'admin_operations':['update\x20the\x20description','set\x20the\x20location/URL'],'permission_index_operations':['publish\x20the\x20Service\x20(311)','add/set\x20sales\x20items\x20(305)','issue\x20discount\x20coupons\x20(312)\x20—\x20promotional\x20rates','add\x20Reward\x20references\x20(318)\x20—\x20loyalty\x20rewards'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['order_allocators\x20must\x20be\x20set'],'common_patterns':['Tiered\x20plans\x20(Free/Pro/Enterprise)\x20as\x20sales[]','Discount\x20coupons\x20for\x20trial\x20periods','Rewards\x20for\x20long-term\x20subscribers','Renewal\x20handled\x20by\x20repeat\x20orders\x20(no\x20native\x20recurring\x20billing)'],'recommended_templates':['T-S-03']},{'id':'service_workflow','name':'Workflow-bound\x20Service\x20(machine-bound)','category':'workflow','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['bind/unbind\x20the\x20UM\x20Contact','builder\x20(transfer)'],'admin_operations':['update\x20the\x20description','set\x20the\x20location/URL'],'permission_index_operations':['bind\x20the\x20Machine\x20workflow\x20(306)','publish\x20the\x20Service\x20(311)','set\x20the\x20order_allocators\x20strategy\x20(313)'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['order_allocators\x20must\x20be\x20set','machine\x20must\x20be\x20published\x20before\x20binding','machine\x20recommended\x20for\x20any\x20multi-stage\x20service\x20delivery'],'common_patterns':['Machine\x20defines\x20Pay\x20→\x20Confirm\x20→\x20Deliver\x20→\x20Sign-off\x20nodes','Progress\x20created\x20per\x20order\x20(stage\x206\x20of\x20buy\x20flow)','Named\x20operators\x20assigned\x20per\x20Forward\x20in\x20Machine','Service.paused\x20does\x20NOT\x20affect\x20already-created\x20Progress\x20(existing\x20orders\x20continue)'],'recommended_templates':['T-S-04']},{'id':'service_arbitration','name':'Arbitration-bound\x20Service\x20(dispute-ready)','category':'arbitration','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['bind/unbind\x20the\x20UM\x20Contact','builder\x20(transfer)'],'admin_operations':['update\x20the\x20description'],'permission_index_operations':['add\x20Arbitration\x20references\x20(308)','deposit\x20to\x20the\x20compensation_fund\x20(315)','extend\x20setting_lock_duration\x20(317)','publish\x20the\x20Service\x20(311)'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['If\x20compensation_fund\x20>\x200,\x20arbitrations\x20must\x20be\x20non-empty\x20(F-S-19)','Arbitration\x20objects\x20must\x20be\x20created\x20before\x20binding','compensation_fund_add\x20before\x20publish\x20recommended\x20(else\x20post-publish\x20deposit\x20still\x20possible)'],'common_patterns':['2-3\x20Arbitration\x20objects\x20(different\x20arb\x20committees\x20for\x20different\x20dispute\x20types)','compensation_fund\x20deposited\x20as\x20%\x20of\x20expected\x20order\x20volume','setting_lock_duration\x20extended\x20by\x20owner\x20to\x20build\x20customer\x20trust','Arbitration\x20compensation\x20payout\x20triggered\x20by\x20the\x20arbitration\x20result\x20(not\x20by\x20Service\x20directly)'],'recommended_templates':['T-S-05','T-S-06']},{'id':'service_compensation_fund','name':'Compensation\x20Fund\x20Service\x20(embedded\x20balance)','category':'compensation_fund','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['bind/unbind\x20the\x20UM\x20Contact','builder\x20(transfer)'],'admin_operations':['update\x20the\x20description'],'permission_index_operations':['deposit\x20to\x20the\x20compensation_fund\x20(315)','withdraw\x20from\x20the\x20compensation_fund\x20(314)\x20—\x20time-locked\x20after\x20publish','receive\x20the\x20compensation_fund\x20payout\x20(316)\x20—\x20arbitration\x20payout\x20(always\x20mutable)','extend\x20setting_lock_duration\x20(317)\x20—\x20extend\x20lock'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['compensation_fund\x20>\x200\x20→\x20arbitrations\x20non-empty\x20(F-S-19)','compensation_fund\x20coin\x20type\x20must\x20match\x20Service<T>\x20type\x20parameter'],'common_patterns':['Fund\x20inflow:\x20compensation_fund_add\x20(315)\x20—\x20always\x20mutable','Fund\x20outflow:\x20compensation_fund_withdraw\x20(314)\x20—\x20requires\x20bPaused\x20+\x20lock_duration\x20expired','Fund\x20receive:\x20compensation_fund_receive\x20(316)\x20—\x20arbitration\x20payout,\x20always\x20mutable','Fund\x20consumer:\x20arbitration\x20compensation\x20payout\x20(driven\x20by\x20arb\x20result)','Distinct\x20from\x20Treasury:\x20Service-internal,\x20arbitration-bound,\x20lock-protected'],'recommended_templates':['T-S-06']},{'id':'service_reward','name':'Reward-attached\x20Service\x20(marketing)','category':'reward','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['bind/unbind\x20the\x20UM\x20Contact','builder\x20(transfer)'],'admin_operations':['update\x20the\x20description'],'permission_index_operations':['add/remove/clear\x20Reward\x20references\x20(318)\x20—\x20add\x20always\x20mutable;\x20remove/clear\x20time-locked\x20after\x20publish','issue/destroy\x20discount\x20coupons\x20(312)','publish\x20the\x20Service\x20(311)'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['order_allocators\x20must\x20be\x20set'],'common_patterns':['Rewards\x20added\x20post-publish\x20(always\x20allowed;\x20remove/clear\x20is\x20time-locked\x20after\x20publish)','Reward\x20objects\x20must\x20exist\x20before\x20binding\x20(queryObjectsWithType\x20validation)','MAX_REWARD_COUNT\x20=\x2020\x20per\x20Service','Reward\x20remove/clear\x20requires\x20Service\x20paused\x20+\x20setting_lock_duration\x20elapsed\x20(protects\x20customer\x20expectations)'],'recommended_templates':['T-S-08']},{'id':'service_arbitration_binding','name':'Arbitration\x20Binding\x20Service\x20(post-publish\x20immutable)','category':'arbitration','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['bind/unbind\x20the\x20UM\x20Contact','builder\x20(transfer)'],'admin_operations':['update\x20the\x20description'],'permission_index_operations':['add\x20Arbitration\x20references\x20(308)\x20—\x20pre-publish\x20only','remove\x20an\x20Arbitration\x20reference\x20(308)\x20—\x20pre-publish\x20only','clear\x20Arbitration\x20references\x20(308)\x20—\x20pre-publish\x20only','publish\x20the\x20Service\x20(311)'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['MAX_ARBITRATION_COUNT\x20=\x2020\x20per\x20Service\x20(F-S-04)','Each\x20Arbitration\x20object\x20must\x20be\x20valid\x20(queryObjectsWithType\x20validation)','Arbitration\x20bound\x20=\x20locked\x20post-publish\x20(F-S-21).\x20To\x20change:\x20create\x20new\x20Service.'],'common_patterns':['Pre-publish:\x20set\x201-3\x20Arbitration\x20objects\x20for\x20different\x20dispute\x20scopes','Post-publish:\x20immutable\x20—\x20clone\x20Service\x20if\x20change\x20needed','⚠️\x20Data\x20inconsistency:\x20dynamic-pricing.ts\x20marks\x20arbitrations\x20as\x20mutable,\x20but\x20SDK\x20blocks\x20it\x20(F-S-21)'],'recommended_templates':['T-S-05']},{'id':'service_buy_guard','name':'Buy\x20Guard\x20Service\x20(post-publish\x20mutable\x20guard)','category':'buy_guard','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['bind/unbind\x20the\x20UM\x20Contact','builder\x20(transfer)'],'admin_operations':['update\x20the\x20description'],'permission_index_operations':['bind\x20the\x20buy_guard\x20Guard\x20(307)','clear\x20the\x20buy_guard\x20Guard\x20(307)','publish\x20the\x20Service\x20(311)'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['order_allocators\x20must\x20be\x20set'],'common_patterns':['Pre-sale\x20phase:\x20buy_guard\x20=\x20whitelist\x20Guard\x20(KYC\x20verified\x20buyers\x20only)','Public\x20sale:\x20buy_guard\x20=\x20null\x20(anyone\x20can\x20buy)','Restricted\x20phase:\x20buy_guard\x20=\x20KYC\x20Guard\x20(compliance)','⚠️\x20buy_guard\x20is\x20the\x20ONLY\x20publish-locked-field\x20exception\x20—\x20still\x20mutable\x20post-publish','buy_guard\x20verification\x20happens\x20at\x20Stage\x201\x20of\x20buy\x20flow\x20(pre_check)'],'recommended_templates':['T-S-01']},{'id':'service_order_allocator','name':'Order\x20Allocator\x20Service\x20(fund\x20distribution\x20config)','category':'order_allocator','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['bind/unbind\x20the\x20UM\x20Contact','builder\x20(transfer)'],'admin_operations':['update\x20the\x20description'],'permission_index_operations':['set\x20the\x20order_allocators\x20strategy\x20(313)\x20—\x20pre-publish\x20only','publish\x20the\x20Service\x20(311)\x20—\x20requires\x20order_allocators\x20(F-S-18)'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['order_allocators\x20MUST\x20be\x20set\x20(F-S-18,\x20E_NO_ALLOCATOR)','Allocators.sharing.who\x20can\x20reference\x20Treasury\x20addresses\x20(indirect\x20Treasury\x20binding)','MAX_SHARING_COUNT\x20=\x20100\x20per\x20allocator'],'common_patterns':['Multi-party\x20split:\x20merchant\x2080%\x20/\x20platform\x2010%\x20/\x20logistics\x2010%','Threshold-based:\x20different\x20allocators\x20for\x20different\x20order\x20sizes','Guard-bound\x20allocator:\x20allocation\x20execution\x20requires\x20Guard\x20verification','Post-publish\x20immutable\x20—\x20clone\x20Service\x20to\x20change\x20allocation\x20strategy'],'recommended_templates':['T-S-08']},{'id':'service_dynamic_pricing','name':'Dynamic\x20Pricing\x20Service\x20(discount-driven)','category':'dynamic_pricing','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['bind/unbind\x20the\x20UM\x20Contact','builder\x20(transfer)'],'admin_operations':['update\x20the\x20description'],'permission_index_operations':['issue\x20discount\x20coupons\x20(312)','add/set\x20sales\x20items\x20(305)\x20—\x20adjust\x20base\x20prices','remove\x20sales\x20items\x20(305)\x20—\x20remove\x20deprecated\x20SKUs'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['order_allocators\x20must\x20be\x20set'],'common_patterns':['Discount\x20types:\x200=rates\x20(basis\x20points,\x20per\x2010000),\x201=minus\x20(direct\x20deduction)','MAX_DISCOUNT_COUNT_ONCE\x20=\x201000\x20per\x20issue\x20call','MAX_DISCOUNT_RECEIVER_ONCE\x20=\x201000\x20receivers\x20per\x20call','MAX_DISCOUNT_TOTAL_COUNT\x20=\x2020000\x20total\x20coupons','discount_destroy:\x20holder-only\x20(no\x20SERVICE_DISCOUNT\x20permission\x20needed)'],'recommended_templates':['T-S-07']},{'id':'service_multi_allocator','name':'Multi-Allocator\x20Service\x20(tiered\x20fund\x20distribution)','category':'multi_allocator','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['bind/unbind\x20the\x20UM\x20Contact','builder\x20(transfer)'],'admin_operations':['update\x20the\x20description'],'permission_index_operations':['set\x20the\x20order_allocators\x20strategy\x20(313)\x20—\x20pre-publish\x20only','publish\x20the\x20Service\x20(311)'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['order_allocators\x20MUST\x20be\x20set','Each\x20allocator\x20has\x20its\x20own\x20Guard\x20+\x20sharing\x20+\x20threshold','Each\x20allocator\x20is\x20bound\x20to\x20a\x20DIFFERENT\x20guard\x20—\x20the\x20caller\x27s\x20submitted\x20guard\x20selects\x20which\x20path\x20fires'],'common_patterns':['Tier\x201\x20(small\x20orders):\x20single-recipient\x20allocator\x20(low\x20fee)','Tier\x202\x20(medium\x20orders):\x20two-recipient\x20split\x20(merchant\x20+\x20platform)','Tier\x203\x20(large\x20orders):\x20three-recipient\x20split\x20(merchant\x20+\x20platform\x20+\x20logistics)','Each\x20tier\x20can\x20have\x20its\x20own\x20Guard\x20for\x20execution\x20authorization'],'recommended_templates':['T-S-08']}];export const SERVICE_LEDGER_VERSION='1.0.0';export function getScenesByCategory(a){return SERVICE_SCENES['filter'](b=>b['category']===a);}export function findSceneById(a){return SERVICE_SCENES['find'](b=>b['id']===a);}export function getServicePermissionByIndex(a){return SERVICE_PERMISSIONS['find'](b=>b['index']===a);}export function isServicePermission(a){return getServicePermissionByIndex(a)!==undefined;}export function getPermissionsByMutability(a){return SERVICE_PERMISSIONS['filter'](b=>b['post_publish_mutability']===a);}export function getImmutablePostPublishPermissions(){return SERVICE_PERMISSIONS['filter'](a=>a['post_publish_mutability']==='immutable'||a['post_publish_mutability']==='one_shot');}export function getLockedByDurationPermissions(){return SERVICE_PERMISSIONS['filter'](a=>a['post_publish_mutability']==='locked_by_duration');}export function inferSceneFromIntent(a){const b=a['toLowerCase'](),c=[['retail','retail'],['ecommerce','retail'],['rental','rental'],['rent','rental'],['short-term\x20rental','rental'],['long-term\x20rental','rental'],['subscription','subscription'],['subscribe','subscription'],['workflow','workflow'],['machine-bound','workflow'],['arbitration','arbitration'],['dispute','arbitration'],['compensation','compensation_fund'],['compensation_fund','compensation_fund'],['reward','reward'],['marketing','reward'],['buy_guard','buy_guard'],['kyc','buy_guard'],['whitelist','buy_guard'],['allocator','order_allocator'],['discount','dynamic_pricing'],['coupon','dynamic_pricing'],['multi-allocator','multi_allocator'],['tiered','multi_allocator']];for(const [d,e]of c){if(b['includes'](d)){const f=getScenesByCategory(e);if(f['length']>0x0)return f[0x0];}}if(b['includes']('service'))return findSceneById('service_retail');return undefined;}export function getAllServiceScenes(){return[...SERVICE_SCENES];}export function getServiceScenesCount(){return SERVICE_SCENES['length'];}export function getServicePermissionsCount(){return SERVICE_PERMISSIONS['length'];}export function getOrderFlowStage(a){return SERVICE_ORDER_FLOW_STAGES['find'](b=>b['stage']===a);}export function getCrossObjectBindings(){return[...SERVICE_CROSS_OBJECT_BINDINGS];}
1
+ export const SERVICE_PERMISSIONS=[{'index':0x12c,'name':'SERVICE_NEW','description':'Create\x20new\x20Service','governed_operation':'create\x20a\x20new\x20Service','post_publish_mutability':'na'},{'index':0x12d,'name':'SERVICE_DESCRIPTION','description':'Modify\x20Service\x20description','governed_operation':'modify\x20the\x20Service\x20description','post_publish_mutability':'mutable'},{'index':0x12f,'name':'SERVICE_LOCATION','description':'Set\x20Service\x20location/URL','governed_operation':'set\x20the\x20Service\x20location/URL','post_publish_mutability':'mutable'},{'index':0x130,'name':'SERVICE_REPOSITORY','description':'Add/remove\x20Repository\x20references','governed_operation':'add/remove/clear\x20Repository\x20references','post_publish_mutability':'mutable'},{'index':0x131,'name':'SERVICE_SALES','description':'Add/set/remove/clear\x20sales\x20items','governed_operation':'add/set/remove/clear\x20sales\x20items','post_publish_mutability':'mutable'},{'index':0x132,'name':'SERVICE_MACHINE','description':'Bind/unbind\x20Machine\x20workflow\x20template','governed_operation':'bind/unbind\x20the\x20Machine\x20workflow\x20template','post_publish_mutability':'immutable'},{'index':0x133,'name':'SERVICE_BUY_GUARD','description':'Set/clear\x20buy\x20Guard\x20(post-publish\x20mutable)','governed_operation':'set/clear\x20the\x20buy_guard\x20check','post_publish_mutability':'mutable'},{'index':0x134,'name':'SERVICE_ARBITRATION','description':'Add/remove\x20Arbitration\x20references','governed_operation':'add/remove/clear\x20Arbitration\x20references','post_publish_mutability':'immutable'},{'index':0x135,'name':'SERVICE_CUSTOMER_INFO_REQUIRED','description':'Set\x20customer\x20required\x20info\x20fields','governed_operation':'set\x20customer\x20required\x20info\x20fields','post_publish_mutability':'mutable'},{'index':0x136,'name':'SERVICE_PAUSE','description':'Pause/resume\x20Service\x20(block\x20new\x20orders)','governed_operation':'pause/resume\x20the\x20Service','post_publish_mutability':'mutable'},{'index':0x137,'name':'SERVICE_PUBLISH','description':'Publish\x20Service\x20(IRREVERSIBLE)','governed_operation':'publish\x20the\x20Service\x20(irreversible)','post_publish_mutability':'one_shot'},{'index':0x138,'name':'SERVICE_DISCOUNT','description':'Issue/discount_destroy\x20discount\x20coupons','governed_operation':'issue/destroy\x20discount\x20coupons','post_publish_mutability':'mutable'},{'index':0x139,'name':'SERVICE_ORDER_ALLOCATOR','description':'Set\x20order\x20allocator\x20strategy','governed_operation':'set\x20the\x20order_allocators\x20strategy','post_publish_mutability':'immutable'},{'index':0x13a,'name':'SERVICE_COMPENSATION_FUND_WITHDRAW','description':'Withdraw\x20compensation\x20fund\x20(time-locked)','governed_operation':'withdraw\x20from\x20the\x20compensation_fund\x20(time-locked)','post_publish_mutability':'locked_by_duration'},{'index':0x13b,'name':'SERVICE_COMPENSATION_FUND_DEPOSIT','description':'Deposit\x20to\x20compensation\x20fund','governed_operation':'deposit\x20to\x20the\x20compensation_fund','post_publish_mutability':'mutable'},{'index':0x13c,'name':'SERVICE_COMPENSATION_FUND_RECEIVE','description':'Receive\x20compensation\x20fund\x20(arbitration\x20payout)','governed_operation':'receive\x20the\x20compensation_fund\x20payout\x20(arbitration\x20payout)','post_publish_mutability':'mutable'},{'index':0x13d,'name':'SERVICE_COMPENSATION_LOCK_DURATION_ADD','description':'Extend\x20setting_lock_duration\x20(only-increase)','governed_operation':'extend\x20setting_lock_duration\x20(only-increase)','post_publish_mutability':'mutable'},{'index':0x13e,'name':'SERVICE_REWARD','description':'Add/remove\x20Reward\x20references\x20(remove/clear\x20time-locked)','governed_operation':'add/remove/clear\x20Reward\x20references','post_publish_mutability':'locked_by_duration'},{'index':0x13f,'name':'SERVICE_OWNER_RECEIVE','description':'Receive\x20Payment/objects\x20to\x20owner','governed_operation':'receive\x20Payments/objects\x20to\x20owner','post_publish_mutability':'mutable'},{'index':0x140,'name':'SERVICE_UM','description':'Bind/unbind\x20Contact\x20as\x20UM','governed_operation':'bind/unbind\x20Contact\x20as\x20UM','post_publish_mutability':'mutable'},{'index':0x141,'name':'SERVICE_ARB_STATEMENT','description':'Append\x20seller\x20statement\x20to\x20an\x20Arb\x20case\x20(event-only)','governed_operation':'append\x20seller\x20text\x20to\x20a\x20case\x20against\x20an\x20order\x20of\x20this\x20service\x20(ArbStatementEvent;\x20no\x20Arb\x20state\x20change)','post_publish_mutability':'mutable'}];export const SERVICE_ORDER_FLOW_STAGES=[{'stage':0x1,'name':'pre_check','preconditions':['Service.bPublished\x20==\x20true\x20(else\x20E_NOT_PUBLISHED,\x20service:7)','Service.bPaused\x20==\x20false\x20(else\x20E_PAUSED,\x20service:19)','buy_guard\x20(if\x20set)\x20added\x20to\x20guards[]\x20list\x20for\x20verification'],'side_effects':[],'always_executed':!![]},{'stage':0x2,'name':'wip_verify','preconditions':['buy.items\x20non-empty','Each\x20item.name\x20matches\x20a\x20sale\x20in\x20Service.sales\x20(else\x20E_SALE_ITEM_NOT_FOUND,\x20service:32)','sale.suspension\x20==\x20false\x20(else\x20E_SALE_SUSPENDED)'],'side_effects':['If\x20buyer\x20passes\x20empty\x20wip_hash,\x20SDK\x20auto-fills\x20with\x20sale.wip_hash','verifiedWipUrls\x20Set\x20avoids\x20re-verifying\x20same\x20WIP\x20URL\x20across\x20items','verify_wip()\x20fetches\x20WIP\x20file\x20and\x20compares\x20hash\x20(else\x20E_WIP_HASH_NOT_MATCH)'],'always_executed':!![]},{'stage':0x3,'name':'quote','preconditions':['All\x20items\x20have\x20valid\x20sale\x20+\x20wip_hash\x20match','stock\x20>=\x20purchase\x20quantity\x20(else\x20E_STOCK_NOT_ENOUGH,\x20service:16)','discount\x20object\x20(if\x20used)\x20is\x20valid\x20and\x20within\x20its\x20[time_start,\x20time_end]\x20window\x20(else\x20E_DISCOUNT_TIME_INVALID)'],'side_effects':['The\x20quote\x20step\x20computes\x20the\x20total\x20price\x20(with\x20discount\x20if\x20applicable)','⚠️\x20Stock\x20is\x20deducted\x20(split)\x20—\x20side\x20effect\x20is\x20NOT\x20auto-rolled-back\x20on\x20later\x20failure','The\x20on-chain\x20quote\x20call\x20executes\x20(the\x20discount\x20path\x20validates\x20the\x20Clock\x20time-window\x20check)'],'always_executed':!![]},{'stage':0x4,'name':'create_order','preconditions':['Quote\x20object\x20from\x20stage\x203','Registrar\x20+\x20Clock\x20objects\x20available'],'side_effects':['The\x20atomic\x20on-chain\x20buy\x20call\x20executes\x20(passport-gated\x20variant\x20supported)','Order\x20object\x20created\x20(builder=customer,\x20service=Service.id)','Order.id\x20recorded\x20for\x20stages\x205-7'],'always_executed':!![]},{'stage':0x5,'name':'create_allocation','preconditions':['Service.order_allocators\x20is\x20Some\x20(configured)','Order\x20from\x20stage\x204','CoinParam\x20for\x20total_pay\x20matches\x20Service<T>\x20type'],'side_effects':['The\x20on-chain\x20allocation\x20call\x20executes','Allocation\x20object\x20created\x20(guard-selected\x20fund\x20distribution)','Order.allocation\x20=\x20Allocation\x20address'],'always_executed':!![]},{'stage':0x6,'name':'create_progress','preconditions':['Service.machine\x20is\x20Some\x20(machine\x20bound)','Order\x20from\x20stage\x204','Machine\x20from\x20Service.machine'],'side_effects':['The\x20on-chain\x20progress-creation\x20call\x20executes','Progress\x20object\x20created\x20(Progress.machine\x20=\x20Service.machine,\x20Progress.task\x20=\x20Order.id)'],'always_executed':![]},{'stage':0x7,'name':'post_actions','preconditions':['Order/Allocation/Progress\x20objects\x20from\x20stages\x204-6'],'side_effects':['Attach\x20agents\x20to\x20the\x20order\x20(if\x20order_new.agents\x20provided)','order_required_info_update\x20(if\x20order_required_info\x20provided)','Transfer\x20Order\x20ownership\x20(if\x20transfer\x20provided\x20—\x20sets\x20new\x20Order\x20owner)','namedNewOrder\x20/\x20namedNewAllocation\x20/\x20namedNewProgress\x20(local\x20naming)'],'always_executed':![]},{'stage':0x8,'name':'return_result','preconditions':['All\x20preceding\x20stages\x20succeeded'],'side_effects':['Returns\x20BuyResult\x20{\x20order,\x20allocation?,\x20progress?\x20}','Caller\x20proceeds\x20to\x20sign\x20+\x20submit\x20transaction'],'always_executed':!![]}];export const SERVICE_CROSS_OBJECT_BINDINGS=[{'object':'Machine','field':'machine','required':![],'locked_after_publish':!![],'notes':'Workflow\x20template;\x20post-publish\x20immutable\x20(F-S-20).\x20Progress.machine\x20inherits\x20this\x20value.'},{'object':'Guard','field':'buy_guard','required':![],'locked_after_publish':![],'notes':'Buyer\x20eligibility\x20guard;\x20post-publish\x20STILL\x20MUTABLE\x20(unusual\x20—\x20see\x20F-S-26)'},{'object':'Allocation','field':'order_allocators','required':!![],'locked_after_publish':!![],'notes':'Order\x20fund\x20distribution\x20strategy;\x20publish\x20prerequisite\x20(F-S-18).\x20Post-publish\x20immutable\x20(F-S-22).'},{'object':'Arbitration','field':'arbitrations','required':![],'locked_after_publish':![],'notes':'Dispute\x20handlers;\x20required\x20if\x20compensation_fund\x20>\x200\x20(F-S-19).\x20add\x20always\x20mutable;\x20remove/clear\x20time-locked\x20after\x20publish\x20(F-S-21).'},{'object':'Repository','field':'repositories','required':![],'locked_after_publish':![],'notes':'Shared\x20data\x20stores;\x20mutable\x20post-publish'},{'object':'Reward','field':'rewards','required':![],'locked_after_publish':![],'notes':'Marketing\x20incentives;\x20add\x20always\x20mutable;\x20remove/clear\x20time-locked\x20after\x20publish\x20(F-S-24)'},{'object':'Contact','field':'um','required':![],'locked_after_publish':![],'notes':'User\x20Manager\x20(Contact\x20object);\x20mutable\x20post-publish'},{'object':'Treasury','field':'(indirect\x20via\x20order_allocators.sharing.who=Entity)','required':![],'locked_after_publish':![],'notes':'Treasury\x20is\x20referenced\x20by\x20Allocation.sharing.who,\x20not\x20by\x20Service\x20directly'}];export const SERVICE_SCENES=[{'id':'service_retail','name':'Retail\x20e-commerce\x20Service','category':'retail','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['bind/unbind\x20the\x20UM\x20Contact','builder\x20(transfer)'],'admin_operations':['update\x20the\x20description','set\x20the\x20location/URL','set\x20customer\x20required\x20info\x20fields'],'permission_index_operations':['publish\x20the\x20Service\x20(311)','pause/resume\x20the\x20Service\x20(310)','add/set/remove/clear\x20sales\x20items\x20(305)','set\x20the\x20order_allocators\x20strategy\x20(313)','set/clear\x20the\x20buy_guard\x20check\x20(307)','issue/destroy\x20discount\x20coupons\x20(312)'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['order_allocators\x20must\x20be\x20set\x20(F-S-18,\x20E_NO_ALLOCATOR)','If\x20compensation_fund\x20>\x200,\x20arbitrations\x20must\x20be\x20non-empty\x20(F-S-19)'],'common_patterns':['Multi-tier\x20pricing\x20via\x20sales[]\x20(Standard/Premium/Enterprise)','WIP\x20hash\x20per\x20sale\x20item\x20for\x20tamper-proof\x20product\x20info','buy_guard\x20for\x20KYC\x20whitelist\x20during\x20pre-sale,\x20then\x20null\x20for\x20public\x20sale','compensation_fund\x20deposited\x20before\x20publish\x20+\x20arbitrations\x20configured'],'recommended_templates':['T-S-01','T-S-06']},{'id':'service_rental','name':'Rental\x20Service\x20(short/long-term)','category':'rental','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['bind/unbind\x20the\x20UM\x20Contact','builder\x20(transfer)'],'admin_operations':['update\x20the\x20description','set\x20the\x20location/URL'],'permission_index_operations':['publish\x20the\x20Service\x20(311)','add/set\x20sales\x20items\x20(305)','bind\x20the\x20Machine\x20workflow\x20(306)\x20—\x20for\x20rental\x20workflow','add\x20Arbitration\x20references\x20(308)\x20—\x20for\x20deposit\x20disputes'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['order_allocators\x20must\x20be\x20set','machine\x20recommended\x20(rental\x20workflow\x20with\x20deposit/return\x20stages)','arbitrations\x20recommended\x20(deposit\x20refund\x20disputes)'],'common_patterns':['Machine\x20workflow\x20with\x20\x27Deposit\x20→\x20Use\x20→\x20Return\x20→\x20Refund\x27\x20nodes','compensation_fund\x20holds\x20deposit\x20guarantees','buy_guard\x20verifies\x20renter\x20identity/KYC','stock=1\x20per\x20rental\x20item\x20(unique\x20items)'],'recommended_templates':['T-S-02','T-S-04']},{'id':'service_subscription','name':'Subscription\x20Service\x20(recurring)','category':'subscription','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['bind/unbind\x20the\x20UM\x20Contact','builder\x20(transfer)'],'admin_operations':['update\x20the\x20description','set\x20the\x20location/URL'],'permission_index_operations':['publish\x20the\x20Service\x20(311)','add/set\x20sales\x20items\x20(305)','issue\x20discount\x20coupons\x20(312)\x20—\x20promotional\x20rates','add\x20Reward\x20references\x20(318)\x20—\x20loyalty\x20rewards'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['order_allocators\x20must\x20be\x20set'],'common_patterns':['Tiered\x20plans\x20(Free/Pro/Enterprise)\x20as\x20sales[]','Discount\x20coupons\x20for\x20trial\x20periods','Rewards\x20for\x20long-term\x20subscribers','Renewal\x20handled\x20by\x20repeat\x20orders\x20(no\x20native\x20recurring\x20billing)'],'recommended_templates':['T-S-03']},{'id':'service_workflow','name':'Workflow-bound\x20Service\x20(machine-bound)','category':'workflow','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['bind/unbind\x20the\x20UM\x20Contact','builder\x20(transfer)'],'admin_operations':['update\x20the\x20description','set\x20the\x20location/URL'],'permission_index_operations':['bind\x20the\x20Machine\x20workflow\x20(306)','publish\x20the\x20Service\x20(311)','set\x20the\x20order_allocators\x20strategy\x20(313)'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['order_allocators\x20must\x20be\x20set','machine\x20must\x20be\x20published\x20before\x20binding','machine\x20recommended\x20for\x20any\x20multi-stage\x20service\x20delivery'],'common_patterns':['Machine\x20defines\x20Pay\x20→\x20Confirm\x20→\x20Deliver\x20→\x20Sign-off\x20nodes','Progress\x20created\x20per\x20order\x20(stage\x206\x20of\x20buy\x20flow)','Named\x20operators\x20assigned\x20per\x20Forward\x20in\x20Machine','Service.paused\x20does\x20NOT\x20affect\x20already-created\x20Progress\x20(existing\x20orders\x20continue)'],'recommended_templates':['T-S-04']},{'id':'service_arbitration','name':'Arbitration-bound\x20Service\x20(dispute-ready)','category':'arbitration','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['bind/unbind\x20the\x20UM\x20Contact','builder\x20(transfer)'],'admin_operations':['update\x20the\x20description'],'permission_index_operations':['add\x20Arbitration\x20references\x20(308)','deposit\x20to\x20the\x20compensation_fund\x20(315)','extend\x20setting_lock_duration\x20(317)','publish\x20the\x20Service\x20(311)'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['If\x20compensation_fund\x20>\x200,\x20arbitrations\x20must\x20be\x20non-empty\x20(F-S-19)','Arbitration\x20objects\x20must\x20be\x20created\x20before\x20binding','compensation_fund_add\x20before\x20publish\x20recommended\x20(else\x20post-publish\x20deposit\x20still\x20possible)'],'common_patterns':['2-3\x20Arbitration\x20objects\x20(different\x20arb\x20committees\x20for\x20different\x20dispute\x20types)','compensation_fund\x20deposited\x20as\x20%\x20of\x20expected\x20order\x20volume','setting_lock_duration\x20extended\x20by\x20owner\x20to\x20build\x20customer\x20trust','Arbitration\x20compensation\x20payout\x20triggered\x20by\x20the\x20arbitration\x20result\x20(not\x20by\x20Service\x20directly)'],'recommended_templates':['T-S-05','T-S-06']},{'id':'service_compensation_fund','name':'Compensation\x20Fund\x20Service\x20(embedded\x20balance)','category':'compensation_fund','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['bind/unbind\x20the\x20UM\x20Contact','builder\x20(transfer)'],'admin_operations':['update\x20the\x20description'],'permission_index_operations':['deposit\x20to\x20the\x20compensation_fund\x20(315)','withdraw\x20from\x20the\x20compensation_fund\x20(314)\x20—\x20time-locked\x20after\x20publish','receive\x20the\x20compensation_fund\x20payout\x20(316)\x20—\x20arbitration\x20payout\x20(always\x20mutable)','extend\x20setting_lock_duration\x20(317)\x20—\x20extend\x20lock'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['compensation_fund\x20>\x200\x20→\x20arbitrations\x20non-empty\x20(F-S-19)','compensation_fund\x20coin\x20type\x20must\x20match\x20Service<T>\x20type\x20parameter'],'common_patterns':['Fund\x20inflow:\x20compensation_fund_add\x20(315)\x20—\x20always\x20mutable','Fund\x20outflow:\x20compensation_fund_withdraw\x20(314)\x20—\x20requires\x20bPaused\x20+\x20lock_duration\x20expired','Fund\x20receive:\x20compensation_fund_receive\x20(316)\x20—\x20arbitration\x20payout,\x20always\x20mutable','Fund\x20consumer:\x20arbitration\x20compensation\x20payout\x20(driven\x20by\x20arb\x20result)','Distinct\x20from\x20Treasury:\x20Service-internal,\x20arbitration-bound,\x20lock-protected'],'recommended_templates':['T-S-06']},{'id':'service_reward','name':'Reward-attached\x20Service\x20(marketing)','category':'reward','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['bind/unbind\x20the\x20UM\x20Contact','builder\x20(transfer)'],'admin_operations':['update\x20the\x20description'],'permission_index_operations':['add/remove/clear\x20Reward\x20references\x20(318)\x20—\x20add\x20always\x20mutable;\x20remove/clear\x20time-locked\x20after\x20publish','issue/destroy\x20discount\x20coupons\x20(312)','publish\x20the\x20Service\x20(311)'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['order_allocators\x20must\x20be\x20set'],'common_patterns':['Rewards\x20added\x20post-publish\x20(always\x20allowed;\x20remove/clear\x20is\x20time-locked\x20after\x20publish)','Reward\x20objects\x20must\x20exist\x20before\x20binding\x20(queryObjectsWithType\x20validation)','MAX_REWARD_COUNT\x20=\x2020\x20per\x20Service','Reward\x20remove/clear\x20requires\x20Service\x20paused\x20+\x20setting_lock_duration\x20elapsed\x20(protects\x20customer\x20expectations)'],'recommended_templates':['T-S-08']},{'id':'service_arbitration_binding','name':'Arbitration\x20Binding\x20Service\x20(post-publish\x20immutable)','category':'arbitration','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['bind/unbind\x20the\x20UM\x20Contact','builder\x20(transfer)'],'admin_operations':['update\x20the\x20description'],'permission_index_operations':['add\x20Arbitration\x20references\x20(308)\x20—\x20pre-publish\x20only','remove\x20an\x20Arbitration\x20reference\x20(308)\x20—\x20pre-publish\x20only','clear\x20Arbitration\x20references\x20(308)\x20—\x20pre-publish\x20only','publish\x20the\x20Service\x20(311)'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['MAX_ARBITRATION_COUNT\x20=\x2020\x20per\x20Service\x20(F-S-04)','Each\x20Arbitration\x20object\x20must\x20be\x20valid\x20(queryObjectsWithType\x20validation)','Arbitration\x20bound\x20=\x20locked\x20post-publish\x20(F-S-21).\x20To\x20change:\x20create\x20new\x20Service.'],'common_patterns':['Pre-publish:\x20set\x201-3\x20Arbitration\x20objects\x20for\x20different\x20dispute\x20scopes','Post-publish:\x20immutable\x20—\x20clone\x20Service\x20if\x20change\x20needed','⚠️\x20Data\x20inconsistency:\x20dynamic-pricing.ts\x20marks\x20arbitrations\x20as\x20mutable,\x20but\x20SDK\x20blocks\x20it\x20(F-S-21)'],'recommended_templates':['T-S-05']},{'id':'service_buy_guard','name':'Buy\x20Guard\x20Service\x20(post-publish\x20mutable\x20guard)','category':'buy_guard','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['bind/unbind\x20the\x20UM\x20Contact','builder\x20(transfer)'],'admin_operations':['update\x20the\x20description'],'permission_index_operations':['bind\x20the\x20buy_guard\x20Guard\x20(307)','clear\x20the\x20buy_guard\x20Guard\x20(307)','publish\x20the\x20Service\x20(311)'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['order_allocators\x20must\x20be\x20set'],'common_patterns':['Pre-sale\x20phase:\x20buy_guard\x20=\x20whitelist\x20Guard\x20(KYC\x20verified\x20buyers\x20only)','Public\x20sale:\x20buy_guard\x20=\x20null\x20(anyone\x20can\x20buy)','Restricted\x20phase:\x20buy_guard\x20=\x20KYC\x20Guard\x20(compliance)','⚠️\x20buy_guard\x20is\x20the\x20ONLY\x20publish-locked-field\x20exception\x20—\x20still\x20mutable\x20post-publish','buy_guard\x20verification\x20happens\x20at\x20Stage\x201\x20of\x20buy\x20flow\x20(pre_check)'],'recommended_templates':['T-S-01']},{'id':'service_order_allocator','name':'Order\x20Allocator\x20Service\x20(fund\x20distribution\x20config)','category':'order_allocator','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['bind/unbind\x20the\x20UM\x20Contact','builder\x20(transfer)'],'admin_operations':['update\x20the\x20description'],'permission_index_operations':['set\x20the\x20order_allocators\x20strategy\x20(313)\x20—\x20pre-publish\x20only','publish\x20the\x20Service\x20(311)\x20—\x20requires\x20order_allocators\x20(F-S-18)'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['order_allocators\x20MUST\x20be\x20set\x20(F-S-18,\x20E_NO_ALLOCATOR)','Allocators.sharing.who\x20can\x20reference\x20Treasury\x20addresses\x20(indirect\x20Treasury\x20binding)','MAX_SHARING_COUNT\x20=\x20100\x20per\x20allocator'],'common_patterns':['Multi-party\x20split:\x20merchant\x2080%\x20/\x20platform\x2010%\x20/\x20logistics\x2010%','Threshold-based:\x20different\x20allocators\x20for\x20different\x20order\x20sizes','Guard-bound\x20allocator:\x20allocation\x20execution\x20requires\x20Guard\x20verification','Post-publish\x20immutable\x20—\x20clone\x20Service\x20to\x20change\x20allocation\x20strategy'],'recommended_templates':['T-S-08']},{'id':'service_dynamic_pricing','name':'Dynamic\x20Pricing\x20Service\x20(discount-driven)','category':'dynamic_pricing','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['bind/unbind\x20the\x20UM\x20Contact','builder\x20(transfer)'],'admin_operations':['update\x20the\x20description'],'permission_index_operations':['issue\x20discount\x20coupons\x20(312)','add/set\x20sales\x20items\x20(305)\x20—\x20adjust\x20base\x20prices','remove\x20sales\x20items\x20(305)\x20—\x20remove\x20deprecated\x20SKUs'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['order_allocators\x20must\x20be\x20set'],'common_patterns':['Discount\x20types:\x200=rates\x20(basis\x20points,\x20per\x2010000),\x201=minus\x20(direct\x20deduction)','MAX_DISCOUNT_COUNT_ONCE\x20=\x201000\x20per\x20issue\x20call','MAX_DISCOUNT_RECEIVER_ONCE\x20=\x201000\x20receivers\x20per\x20call','MAX_DISCOUNT_TOTAL_COUNT\x20=\x2020000\x20total\x20coupons','discount_destroy:\x20holder-only\x20(no\x20SERVICE_DISCOUNT\x20permission\x20needed)','discount_send:\x20holder-only\x20transfer\x20of\x20owned\x20transferable:true\x20coupons\x20to\x20another\x20address\x20(no\x20permission\x20needed)'],'recommended_templates':['T-S-07']},{'id':'service_multi_allocator','name':'Multi-Allocator\x20Service\x20(tiered\x20fund\x20distribution)','category':'multi_allocator','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['bind/unbind\x20the\x20UM\x20Contact','builder\x20(transfer)'],'admin_operations':['update\x20the\x20description'],'permission_index_operations':['set\x20the\x20order_allocators\x20strategy\x20(313)\x20—\x20pre-publish\x20only','publish\x20the\x20Service\x20(311)'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['order_allocators\x20MUST\x20be\x20set','Each\x20allocator\x20has\x20its\x20own\x20Guard\x20+\x20sharing\x20+\x20threshold','Each\x20allocator\x20is\x20bound\x20to\x20a\x20DIFFERENT\x20guard\x20—\x20the\x20caller\x27s\x20submitted\x20guard\x20selects\x20which\x20path\x20fires'],'common_patterns':['Tier\x201\x20(small\x20orders):\x20single-recipient\x20allocator\x20(low\x20fee)','Tier\x202\x20(medium\x20orders):\x20two-recipient\x20split\x20(merchant\x20+\x20platform)','Tier\x203\x20(large\x20orders):\x20three-recipient\x20split\x20(merchant\x20+\x20platform\x20+\x20logistics)','Each\x20tier\x20can\x20have\x20its\x20own\x20Guard\x20for\x20execution\x20authorization'],'recommended_templates':['T-S-08']}];export const SERVICE_LEDGER_VERSION='1.0.0';export function getScenesByCategory(a){return SERVICE_SCENES['filter'](b=>b['category']===a);}export function findSceneById(a){return SERVICE_SCENES['find'](b=>b['id']===a);}export function getServicePermissionByIndex(a){return SERVICE_PERMISSIONS['find'](b=>b['index']===a);}export function isServicePermission(a){return getServicePermissionByIndex(a)!==undefined;}export function getPermissionsByMutability(a){return SERVICE_PERMISSIONS['filter'](b=>b['post_publish_mutability']===a);}export function getImmutablePostPublishPermissions(){return SERVICE_PERMISSIONS['filter'](a=>a['post_publish_mutability']==='immutable'||a['post_publish_mutability']==='one_shot');}export function getLockedByDurationPermissions(){return SERVICE_PERMISSIONS['filter'](a=>a['post_publish_mutability']==='locked_by_duration');}export function inferSceneFromIntent(a){const b=a['toLowerCase'](),c=[['retail','retail'],['ecommerce','retail'],['rental','rental'],['rent','rental'],['short-term\x20rental','rental'],['long-term\x20rental','rental'],['subscription','subscription'],['subscribe','subscription'],['workflow','workflow'],['machine-bound','workflow'],['arbitration','arbitration'],['dispute','arbitration'],['compensation','compensation_fund'],['compensation_fund','compensation_fund'],['reward','reward'],['marketing','reward'],['buy_guard','buy_guard'],['kyc','buy_guard'],['whitelist','buy_guard'],['allocator','order_allocator'],['discount','dynamic_pricing'],['coupon','dynamic_pricing'],['multi-allocator','multi_allocator'],['tiered','multi_allocator']];for(const [d,e]of c){if(b['includes'](d)){const f=getScenesByCategory(e);if(f['length']>0x0)return f[0x0];}}if(b['includes']('service'))return findSceneById('service_retail');return undefined;}export function getAllServiceScenes(){return[...SERVICE_SCENES];}export function getServiceScenesCount(){return SERVICE_SCENES['length'];}export function getServicePermissionsCount(){return SERVICE_PERMISSIONS['length'];}export function getOrderFlowStage(a){return SERVICE_ORDER_FLOW_STAGES['find'](b=>b['stage']===a);}export function getCrossObjectBindings(){return[...SERVICE_CROSS_OBJECT_BINDINGS];}
@@ -1 +1 @@
1
- export const SERVICE_TEMPLATES=[{'id':'T-S-01','name':'Retail\x20e-commerce\x20Service','description':'Standard\x20retail\x20shop\x20with\x20multiple\x20SKUs,\x20WIP-verified\x20products,\x20owner-only\x20allocation','applicable_scenes':['service_retail','service_buy_guard'],'industry_tags':['retail','ecommerce','digital_goods'],'params':[{'name':'owner_address','type':'address','description':'Service\x20owner\x20address\x20(receives\x20payments)','required':!![]},{'name':'permission_address','type':'address','description':'Permission\x20object\x20address\x20(must\x20be\x20owned\x20by\x20owner)','required':!![]},{'name':'description','type':'string','description':'Shop\x20description','required':!![]},{'name':'location','type':'string','description':'Service\x20geographic\x20location\x20(city/region)','required':![],'default':''},{'name':'sales_items','type':'object','description':'Array\x20of\x20{name,\x20price,\x20stock,\x20wip,\x20wip_hash}','required':!![]},{'name':'buy_guard_address','type':'address','description':'Buyer\x20eligibility\x20Guard\x20(null\x20for\x20public\x20sale)','required':![],'default':''}],'body':a=>{const b={'object':null,'description':a['description'],'permission':a['permission_address'],'location':a['location']||undefined,'sales':{'op':'add','sales':a['sales_items']},'order_allocators':[{'threshold':'0','sharing':[{'who':{'Object':a['owner_address']},'weight':0x64}]}]};if(a['buy_guard_address'])b['buy_guard']=a['buy_guard_address'];return b;},'notes':['WIP\x20hash\x20is\x20MANDATORY\x20for\x20tamper\x20protection\x20—\x20never\x20leave\x20empty\x20if\x20wip\x20URL\x20is\x20set','Use\x20buy_guard\x20for\x20pre-sale\x20whitelist\x20phase,\x20then\x20clear\x20for\x20public\x20sale','Single-recipient\x20allocation\x20(owner\x20100%)\x20—\x20use\x20T-S-08\x20for\x20multi-party\x20split'],'post_publish_considerations':['machine/arbitrations/order_allocators\x20become\x20immutable\x20—\x20verify\x20before\x20publish','Sales\x20can\x20still\x20be\x20added/removed/updated\x20post-publish','buy_guard\x20can\x20be\x20changed\x20post-publish\x20(unusual\x20exception)']},{'id':'T-S-02','name':'Rental\x20Service\x20(deposit\x20+\x20use\x20+\x20return)','description':'Equipment/asset\x20rental\x20with\x20deposit\x20guarantee,\x20Machine\x20workflow,\x20and\x20arbitration','applicable_scenes':['service_rental'],'industry_tags':['rental','equipment','real_estate'],'params':[{'name':'owner_address','type':'address','description':'Service\x20owner\x20(rental\x20company)','required':!![]},{'name':'permission_address','type':'address','description':'Permission\x20object\x20address','required':!![]},{'name':'description','type':'string','description':'Rental\x20service\x20description','required':!![]},{'name':'machine_address','type':'address','description':'Published\x20Machine\x20with\x20Reserve→Pay→Pickup→Return→Refund\x20nodes','required':!![]},{'name':'arbitration_object','type':'address','description':'Arbitration\x20for\x20deposit\x20disputes','required':!![]},{'name':'rental_items','type':'object','description':'Array\x20of\x20{name,\x20price,\x20stock=1,\x20wip,\x20wip_hash}','required':!![]},{'name':'compensation_fund_balance','type':'string','description':'Initial\x20deposit\x20to\x20compensation_fund\x20(in\x20base\x20units)','required':![],'default':'0'}],'body':a=>({'object':null,'description':a['description'],'permission':a['permission_address'],'machine':a['machine_address'],'arbitrations':{'op':'add','objects':[a['arbitration_object']]},'sales':{'op':'add','sales':a['rental_items']},'order_allocators':[{'threshold':'0','sharing':[{'who':{'Object':a['owner_address']},'weight':0x64}]}],'compensation_fund_add':a['compensation_fund_balance']&&a['compensation_fund_balance']!=='0'?{'balance':a['compensation_fund_balance']}:undefined}),'notes':['stock=1\x20per\x20rental\x20item\x20(unique\x20items)\x20—\x20once\x20rented,\x20stock\x20becomes\x200','Machine\x20must\x20define\x20deposit/return/refund\x20nodes\x20for\x20proper\x20rental\x20flow','compensation_fund\x20holds\x20deposit\x20guarantees\x20—\x20separate\x20from\x20rental\x20fee','Arbitration\x20required\x20if\x20compensation_fund\x20>\x200\x20(F-S-19)'],'post_publish_considerations':['Machine\x20binding\x20is\x20permanent\x20—\x20verify\x20workflow\x20before\x20publish','Arbitration\x20binding\x20is\x20permanent\x20—\x20choose\x20reputable\x20arbiters','Sales\x20can\x20be\x20updated\x20(add\x20new\x20rental\x20items,\x20remove\x20deprecated\x20ones)']},{'id':'T-S-03','name':'Subscription\x20Service\x20(tiered\x20plans)','description':'Recurring-access\x20service\x20with\x20tiered\x20plans\x20(Free/Pro/Enterprise),\x20discount\x20coupons,\x20loyalty\x20rewards','applicable_scenes':['service_subscription'],'industry_tags':['subscription','saas','membership'],'params':[{'name':'owner_address','type':'address','description':'Service\x20owner','required':!![]},{'name':'permission_address','type':'address','description':'Permission\x20object\x20address','required':!![]},{'name':'description','type':'string','description':'Subscription\x20service\x20description','required':!![]},{'name':'tier_plans','type':'object','description':'Array\x20of\x20{name,\x20price,\x20stock=999999,\x20wip,\x20wip_hash}\x20for\x20each\x20tier','required':!![]},{'name':'trial_discount_count','type':'number','description':'Number\x20of\x20trial\x20discount\x20coupons\x20to\x20issue','required':![],'default':0x0},{'name':'reward_address','type':'address','description':'Loyalty\x20Reward\x20object\x20address\x20(optional)','required':![],'default':''}],'body':a=>{const b={'object':null,'description':a['description'],'permission':a['permission_address'],'sales':{'op':'add','sales':a['tier_plans']},'order_allocators':[{'threshold':'0','sharing':[{'who':{'Object':a['owner_address']},'weight':0x64}]}]};return a['reward_address']&&(b['rewards']={'op':'add','objects':[a['reward_address']]}),b;},'notes':['Subscription\x20renewals\x20are\x20handled\x20by\x20repeat\x20orders\x20(no\x20native\x20recurring\x20billing)','Use\x20large\x20stock\x20values\x20(e.g.\x20999999)\x20since\x20subscriptions\x20are\x20not\x20inventory-limited','Trial\x20discounts:\x20issue\x20via\x20discount\x20(312)\x20post-publish','Loyalty\x20rewards:\x20bind\x20via\x20the\x20add-reward\x20operation\x20(318)\x20—\x20locked\x20by\x20setting_lock_duration'],'post_publish_considerations':['Tier\x20prices\x20can\x20be\x20updated\x20via\x20the\x20sales\x20update\x20operation\x20(existing\x20subscribers\x20unaffected)','Discount\x20coupons\x20can\x20be\x20issued/destroyed\x20post-publish','Rewards\x20can\x20be\x20added\x20but\x20removal\x20locked\x20by\x20duration']},{'id':'T-S-04','name':'Workflow-bound\x20Service\x20(machine-driven\x20delivery)','description':'Service\x20with\x20multi-step\x20delivery\x20workflow\x20(e.g.\x20freelance,\x20custom\x20manufacturing,\x20course)','applicable_scenes':['service_workflow','service_rental'],'industry_tags':['workflow','freelance','manufacturing','education'],'params':[{'name':'owner_address','type':'address','description':'Service\x20owner\x20(provider)','required':!![]},{'name':'permission_address','type':'address','description':'Permission\x20object\x20address','required':!![]},{'name':'description','type':'string','description':'Service\x20description','required':!![]},{'name':'machine_address','type':'address','description':'Published\x20Machine\x20with\x20Pay→Confirm→Deliver→Sign-off\x20nodes','required':!![]},{'name':'service_items','type':'object','description':'Array\x20of\x20{name,\x20price,\x20stock,\x20wip,\x20wip_hash}','required':!![]},{'name':'customer_required','type':'string[]','description':'Required\x20info\x20fields\x20(e.g.\x20[\x27name\x27,\x27project_brief\x27])','required':![],'default':[]}],'body':a=>({'object':null,'description':a['description'],'permission':a['permission_address'],'machine':a['machine_address'],'sales':{'op':'add','sales':a['service_items']},'customer_required':a['customer_required'],'order_allocators':[{'threshold':'0','sharing':[{'who':{'Object':a['owner_address']},'weight':0x64}]}]}),'notes':['Machine\x20MUST\x20be\x20published\x20before\x20binding\x20(via\x20the\x20Machine\x20publish\x20operation)','Each\x20order\x20creates\x20a\x20Progress\x20object\x20tracking\x20the\x20workflow','Named\x20operators\x20can\x20be\x20assigned\x20per\x20Forward\x20in\x20the\x20Machine','Service.bPaused\x20does\x20NOT\x20affect\x20already-created\x20Progress\x20(existing\x20orders\x20continue)'],'post_publish_considerations':['Machine\x20binding\x20is\x20PERMANENT\x20—\x20cannot\x20upgrade\x20workflow\x20post-publish','To\x20change\x20workflow:\x20clone\x20Service\x20with\x20new\x20Machine,\x20migrate\x20customers\x20via\x20discounts','customer_required\x20fields\x20can\x20be\x20updated\x20post-publish']},{'id':'T-S-05','name':'Arbitration-bound\x20Service\x20(dispute-ready)','description':'Service\x20with\x20multiple\x20Arbitration\x20objects\x20for\x20different\x20dispute\x20scopes\x20+\x20compensation_fund','applicable_scenes':['service_arbitration','service_arbitration_binding'],'industry_tags':['arbitration','dispute_resolution','high_value'],'params':[{'name':'owner_address','type':'address','description':'Service\x20owner','required':!![]},{'name':'permission_address','type':'address','description':'Permission\x20object\x20address','required':!![]},{'name':'description','type':'string','description':'Service\x20description','required':!![]},{'name':'arbitration_addresses','type':'string[]','description':'1-3\x20Arbitration\x20object\x20addresses\x20(different\x20scopes)','required':!![]},{'name':'compensation_fund_balance','type':'string','description':'Initial\x20compensation_fund\x20deposit\x20(base\x20units)','required':!![]},{'name':'setting_lock_duration_ms','type':'number','description':'Initial\x20setting_lock_duration\x20in\x20ms\x20(default\x2030\x20days)','required':![],'default':0x9a7ec800},{'name':'service_items','type':'object','description':'Array\x20of\x20{name,\x20price,\x20stock,\x20wip,\x20wip_hash}','required':!![]}],'body':a=>({'object':null,'description':a['description'],'permission':a['permission_address'],'arbitrations':{'op':'add','objects':a['arbitration_addresses']},'compensation_fund_add':{'balance':a['compensation_fund_balance']},'setting_lock_duration_add':a['setting_lock_duration_ms'],'sales':{'op':'add','sales':a['service_items']},'order_allocators':[{'threshold':'0','sharing':[{'who':{'Object':a['owner_address']},'weight':0x64}]}]}),'notes':['Use\x202-3\x20Arbitration\x20objects:\x20e.g.\x20one\x20for\x20quality\x20disputes,\x20one\x20for\x20delivery\x20disputes','compensation_fund\x20>\x200\x20REQUIRES\x20arbitrations\x20non-empty\x20(F-S-19,\x20E_ARBITRATION_NOT_SET_WITH_COMPENSATION_FUND)','compensation_fund\x20coin\x20type\x20MUST\x20match\x20Service<T>\x20type\x20parameter','setting_lock_duration\x20protects\x20customers\x20—\x20only-increase\x20mechanism'],'post_publish_considerations':['Arbitration\x20bindings\x20are\x20PERMANENT\x20—\x20verify\x20arb\x20reputation\x20before\x20publish','compensation_fund_add\x20(deposit)\x20is\x20always\x20mutable\x20post-publish','compensation_fund_withdraw\x20requires\x20bPaused=true\x20+\x20lock_duration\x20expired','Cannot\x20add\x20new\x20Arbitration\x20post-publish\x20—\x20only\x20pre-publish']},{'id':'T-S-06','name':'Compensation\x20fund\x20Service\x20(embedded\x20Balance<T>)','description':'Service\x20focused\x20on\x20compensation_fund\x20management\x20—\x20emphasizes\x20distinction\x20from\x20Treasury','applicable_scenes':['service_compensation_fund','service_arbitration'],'industry_tags':['finance','escrow','guarantee'],'params':[{'name':'owner_address','type':'address','description':'Service\x20owner','required':!![]},{'name':'permission_address','type':'address','description':'Permission\x20object\x20address','required':!![]},{'name':'description','type':'string','description':'Service\x20description','required':!![]},{'name':'arbitration_addresses','type':'string[]','description':'Arbitration\x20objects\x20(required\x20when\x20fund\x20>\x200)','required':!![]},{'name':'initial_deposit','type':'string','description':'Initial\x20compensation_fund\x20deposit\x20(base\x20units)','required':!![]},{'name':'lock_duration_ms','type':'number','description':'setting_lock_duration\x20(ms)','required':![],'default':0x9a7ec800},{'name':'service_items','type':'object','description':'Sales\x20items','required':!![]}],'body':a=>({'object':null,'description':a['description'],'permission':a['permission_address'],'arbitrations':{'op':'add','objects':a['arbitration_addresses']},'compensation_fund_add':{'balance':a['initial_deposit']},'setting_lock_duration_add':a['lock_duration_ms'],'sales':{'op':'add','sales':a['service_items']},'order_allocators':[{'threshold':'0','sharing':[{'who':{'Object':a['owner_address']},'weight':0x64}]}]}),'notes':['⚠️\x20compensation_fund\x20is\x20INTERNAL\x20Balance<T>\x20—\x20distinct\x20from\x20Treasury\x20(external)','Treasury\x20is\x20referenced\x20via\x20order_allocators.sharing.who=Entity\x20(Treasury\x20address)','compensation_fund\x20is\x20consumed\x20by\x20the\x20arbitration\x20compensation\x20claim\x20(driven\x20by\x20arb\x20result)','Owner\x20can\x20only\x20withdraw\x20via\x20compensation_fund_withdraw\x20(requires\x20paused\x20+\x20lock\x20expired)'],'post_publish_considerations':['Deposits\x20(compensation_fund_add)\x20always\x20allowed','Withdrawals\x20(compensation_fund_withdraw)\x20require\x20bPaused=true\x20+\x20lock_duration\x20expired','Receive\x20(compensation_fund_receive)\x20locked\x20by\x20duration','setting_lock_duration\x20only-increase\x20—\x20plan\x20withdrawal\x20timeline\x20carefully']},{'id':'T-S-07','name':'Dynamic\x20pricing\x20Service\x20(discount-driven)','description':'Service\x20with\x20promotional\x20discount\x20coupons\x20—\x20supports\x20rates\x20(basis\x20points,\x20per\x2010000)\x20and\x20minus\x20(direct\x20deduction)\x20types','applicable_scenes':['service_dynamic_pricing'],'industry_tags':['retail','marketing','promotion'],'params':[{'name':'owner_address','type':'address','description':'Service\x20owner','required':!![]},{'name':'permission_address','type':'address','description':'Permission\x20object\x20address','required':!![]},{'name':'description','type':'string','description':'Service\x20description','required':!![]},{'name':'service_items','type':'object','description':'Array\x20of\x20{name,\x20price,\x20stock,\x20wip,\x20wip_hash}','required':!![]},{'name':'discount_specs','type':'object','description':'Array\x20of\x20{name,\x20type,\x20data,\x20count,\x20expire_at}\x20for\x20initial\x20discounts','required':![],'default':[]}],'body':a=>({'object':null,'description':a['description'],'permission':a['permission_address'],'sales':{'op':'add','sales':a['service_items']},'order_allocators':[{'threshold':'0','sharing':[{'who':{'Object':a['owner_address']},'weight':0x64}]}]}),'notes':['Discounts\x20are\x20issued\x20POST-PUBLISH\x20via\x20discount\x20(312)\x20—\x20not\x20in\x20create\x20body','discount_type=0\x20rates\x20(basis\x20points,\x20e.g.\x201000=10%);\x201=minus\x20(direct\x20deduction,\x20base\x20units)','MAX_DISCOUNT_COUNT_ONCE\x20=\x201000\x20per\x20issue\x20call','MAX_DISCOUNT_RECEIVER_ONCE\x20=\x201000\x20receivers\x20per\x20call','MAX_DISCOUNT_TOTAL_COUNT\x20=\x2020000\x20total\x20coupons\x20per\x20Service','discount_destroy\x20is\x20holder-only\x20(no\x20SERVICE_DISCOUNT\x20permission\x20needed)'],'post_publish_considerations':['Discount\x20coupons\x20can\x20be\x20issued/destroyed\x20freely','Sales\x20prices\x20can\x20be\x20updated\x20via\x20the\x20sales\x20update\x20operation\x20(existing\x20orders\x20unaffected)','Track\x20discount\x20usage\x20to\x20avoid\x20stockout\x20of\x20promotional\x20items']},{'id':'T-S-08','name':'Multi-allocator\x20Service\x20(tiered\x20fund\x20distribution)','description':'Service\x20with\x20multiple\x20allocator\x20tiers\x20—\x20guard-selected\x20distribution\x20based\x20on\x20order\x20value','applicable_scenes':['service_multi_allocator','service_order_allocator','service_reward'],'industry_tags':['marketplace','platform','logistics'],'params':[{'name':'owner_address','type':'address','description':'Service\x20owner\x20(merchant)','required':!![]},{'name':'permission_address','type':'address','description':'Permission\x20object\x20address','required':!![]},{'name':'description','type':'string','description':'Service\x20description','required':!![]},{'name':'platform_address','type':'address','description':'Platform\x20fee\x20recipient','required':!![]},{'name':'logistics_address','type':'address','description':'Logistics\x20fee\x20recipient\x20(optional)','required':![],'default':''},{'name':'service_items','type':'object','description':'Array\x20of\x20{name,\x20price,\x20stock,\x20wip,\x20wip_hash}','required':!![]},{'name':'tier1_threshold','type':'string','description':'Small\x20order\x20threshold\x20(base\x20units,\x20e.g.\x20\x270\x27)','required':![],'default':'0'},{'name':'tier2_threshold','type':'string','description':'Medium\x20order\x20threshold\x20(base\x20units)','required':![],'default':'10000000000'},{'name':'tier3_threshold','type':'string','description':'Large\x20order\x20threshold\x20(base\x20units)','required':![],'default':'100000000000'}],'body':a=>{const b=[{'threshold':a['tier1_threshold'],'sharing':[{'who':{'Object':a['owner_address']},'weight':0x5a},{'who':{'Object':a['platform_address']},'weight':0xa}]},{'threshold':a['tier2_threshold'],'sharing':a['logistics_address']?[{'who':{'Object':a['owner_address']},'weight':0x50},{'who':{'Object':a['platform_address']},'weight':0xa},{'who':{'Object':a['logistics_address']},'weight':0xa}]:[{'who':{'Object':a['owner_address']},'weight':0x55},{'who':{'Object':a['platform_address']},'weight':0xf}]},{'threshold':a['tier3_threshold'],'sharing':a['logistics_address']?[{'who':{'Object':a['owner_address']},'weight':0x46},{'who':{'Object':a['platform_address']},'weight':0xa},{'who':{'Object':a['logistics_address']},'weight':0x14}]:[{'who':{'Object':a['owner_address']},'weight':0x50},{'who':{'Object':a['platform_address']},'weight':0x14}]}];return{'object':null,'description':a['description'],'permission':a['permission_address'],'sales':{'op':'add','sales':a['service_items']},'order_allocators':b};},'notes':['Each\x20allocator\x20tier\x20is\x20bound\x20to\x20a\x20DIFFERENT\x20guard\x20—\x20the\x20caller\x27s\x20submitted\x20guard\x20selects\x20which\x20tier\x20fires','Each\x20tier\x20can\x20have\x20its\x20own\x20Guard\x20for\x20execution\x20authorization\x20(optional)','Thresholds\x20must\x20be\x20ascending\x20(tier1\x20<\x20tier2\x20<\x20tier3)','MAX_SHARING_COUNT\x20=\x20100\x20per\x20allocator\x20(sum\x20of\x20sharing\x20entries)','Treasury\x20addresses\x20can\x20be\x20referenced\x20via\x20sharing.who=Entity\x20(Treasury\x20object)'],'post_publish_considerations':['⚠️\x20order_allocators\x20is\x20IMMUTABLE\x20post-publish\x20(F-S-22)\x20—\x20verify\x20tiers\x20before\x20publish','To\x20change\x20fee\x20split:\x20clone\x20Service\x20with\x20new\x20allocators\x20(cannot\x20migrate\x20existing\x20Orders)','Sales\x20can\x20still\x20be\x20updated\x20post-publish\x20(only\x20allocator\x20is\x20locked)']},{'id':'T-S-09','name':'Supply\x20Chain\x20Sub-order\x20Service\x20(milestone\x20unlock\x20via\x20buy_guard)','description':'Sub-service\x20whose\x20buy_guard\x20verifies\x20the\x20user\x20purchased\x20the\x20main\x20service\x20order.\x20Each\x20milestone\x20=\x20one\x20sub-order.\x20Enables\x20supply\x20chain\x20composition:\x20main\x20service\x20→\x20multiple\x20sub-services\x20with\x20conditional\x20access.','applicable_scenes':['service_buy_guard'],'industry_tags':['travel','rental','education','freelance','ecommerce','supply_chain'],'params':[{'name':'owner_address','type':'address','description':'Sub-service\x20owner\x20address','required':!![]},{'name':'permission_address','type':'address','description':'Permission\x20object\x20address','required':!![]},{'name':'description','type':'string','description':'Sub-service\x20description\x20(e.g.,\x20\x27Hotel\x20booking\x20for\x20tour\x20package\x20X\x27)','required':!![]},{'name':'main_service_address','type':'address','description':'Main\x20Service\x20object\x20address\x20(the\x20parent\x20service)','required':!![]},{'name':'buy_guard_address','type':'address','description':'Guard\x20address\x20verifying\x20main\x20order\x20ownership\x20(order.owner==Signer\x20AND\x20order.service==main_service)','required':!![]},{'name':'price','type':'number','description':'Sub-service\x20price','required':!![]},{'name':'machine_address','type':'address','description':'Machine\x20object\x20for\x20sub-order\x20workflow','required':!![]}],'body':a=>({'object':null,'description':a['description'],'service_type':'supply_chain_sub','buy_guard':a['buy_guard_address'],'price':a['price'],'machine':a['machine_address'],'permission':a['permission_address']}),'notes':['VERIFIED:\x20buy_guard:\x20Option<address>;\x20the\x20Passport-verified\x20purchase\x20evaluates\x20buy_guard','VERIFIER-EVIDENCE\x20DESIGN:\x20user\x20submits\x20main\x20Order\x20as\x20evidence\x20(b_submission=true),\x20buy_guard\x20verifies\x20order.owner==Signer\x20AND\x20order.service==main_service_address','No\x20parent_order\x20field\x20needed\x20—\x20relationship\x20verified\x20via\x20buy_guard\x20querying\x20submitted\x20Order\x20fields','Each\x20milestone\x20=\x20one\x20sub-order\x20with\x20its\x20own\x20Service\x20+\x20buy_guard\x20+\x20Machine','Main\x20flow\x20Machine\x20can\x20branch\x20to\x20different\x20sub-services\x20based\x20on\x20node\x20progression','Use\x20tpl_buy_guard_order_holder\x20(guard-templates.ts)\x20for\x20the\x20buy_guard\x20design'],'post_publish_considerations':['buy_guard\x20is\x20mutable\x20post-publish\x20(can\x20update\x20the\x20guard\x20address)','If\x20main\x20service\x20is\x20unpublished,\x20sub-service\x20buy_guard\x20will\x20fail\x20(order.service\x20won\x27t\x20match)','Consider\x20publishing\x20main\x20service\x20before\x20sub-services']}];export const SERVICE_TEMPLATES_VERSION='1.0.0';export function getAllServiceTemplates(){return[...SERVICE_TEMPLATES];}export function getServiceTemplateById(a){return SERVICE_TEMPLATES['find'](b=>b['id']===a);}export function getServiceTemplatesByScene(a){return SERVICE_TEMPLATES['filter'](b=>b['applicable_scenes']['includes'](a));}export function getServiceTemplatesByIndustry(a){return SERVICE_TEMPLATES['filter'](b=>b['industry_tags']['includes'](a)||b['industry_tags']['includes']('universal'));}export function suggestServiceTemplateForScene(a){const b=getServiceTemplatesByScene(a);return b['length']>0x0?b[0x0]:undefined;}export function listServiceTemplates(){return SERVICE_TEMPLATES['map'](a=>({'id':a['id'],'name':a['name'],'description':a['description'],'scenes':a['applicable_scenes']}));}export const SERVICE_PRICING_NOTE='Pricing\x20coin:\x20prices\x20in\x20the\x20generated\x20body\x20are\x20denominated\x20in\x20the\x20object\x27s\x20type_parameter\x20token\x20(default\x200x2::wow::WOW),\x20which\x20is\x20FIXED\x20at\x20creation\x20—\x20buyers\x20must\x20hold\x20that\x20exact\x20token\x20to\x20order.\x20To\x20price\x20in\x20a\x20different\x20token,\x20pass\x20its\x20full\x20type\x20(from\x20wowok_buildin_info\x20\x27mainnet\x20bridge\x20tokens\x27\x20wowTypeTag)\x20as\x20type_parameter\x20BEFORE\x20creating.\x20Testnet\x20has\x20ONLY\x20WOW\x20(no\x20stablecoins\x20are\x20bridged);\x20multi-token\x20pricing\x20is\x20a\x20mainnet\x20capability.';export function fillServiceTemplate(a,b){const c=getServiceTemplateById(a);if(!c)return{'ok':![],'error':'Template\x20'+a+'\x20not\x20found'};const d=[];for(const f of c['params']){f['required']&&!(f['name']in b)&&d['push'](f['name']);}if(d['length']>0x0)return{'ok':![],'error':'Missing\x20required\x20params:\x20'+d['join'](',\x20'),'missing_required':d};const e={...b};for(const g of c['params']){!(g['name']in e)&&g['default']!==undefined&&(e[g['name']]=g['default']);}return{'ok':!![],'body':c['body'](e),'pricing_note':SERVICE_PRICING_NOTE};}
1
+ export const SERVICE_TEMPLATES=[{'id':'T-S-01','name':'Retail\x20e-commerce\x20Service','description':'Standard\x20retail\x20shop\x20with\x20multiple\x20SKUs,\x20WIP-verified\x20products,\x20owner-only\x20allocation','applicable_scenes':['service_retail','service_buy_guard'],'industry_tags':['retail','ecommerce','digital_goods'],'params':[{'name':'owner_address','type':'address','description':'Service\x20owner\x20address\x20(receives\x20payments)','required':!![]},{'name':'permission_address','type':'address','description':'Permission\x20object\x20address\x20(must\x20be\x20owned\x20by\x20owner)','required':!![]},{'name':'description','type':'string','description':'Shop\x20description','required':!![]},{'name':'location','type':'string','description':'Service\x20geographic\x20location\x20(city/region)','required':![],'default':''},{'name':'sales_items','type':'object','description':'Array\x20of\x20{name,\x20price,\x20stock,\x20wip,\x20wip_hash}','required':!![]},{'name':'buy_guard_address','type':'address','description':'Buyer\x20eligibility\x20Guard\x20(null\x20for\x20public\x20sale)','required':![],'default':''}],'body':a=>{const b={'object':null,'description':a['description'],'permission':a['permission_address'],'location':a['location']||undefined,'sales':{'op':'add','sales':a['sales_items']},'order_allocators':[{'threshold':'0','sharing':[{'who':{'Object':a['owner_address']},'weight':0x64}]}]};if(a['buy_guard_address'])b['buy_guard']=a['buy_guard_address'];return b;},'notes':['WIP\x20hash\x20is\x20MANDATORY\x20for\x20tamper\x20protection\x20—\x20never\x20leave\x20empty\x20if\x20wip\x20URL\x20is\x20set','Use\x20buy_guard\x20for\x20pre-sale\x20whitelist\x20phase,\x20then\x20clear\x20for\x20public\x20sale','Single-recipient\x20allocation\x20(owner\x20100%)\x20—\x20use\x20T-S-08\x20for\x20multi-party\x20split'],'post_publish_considerations':['machine/arbitrations/order_allocators\x20become\x20immutable\x20—\x20verify\x20before\x20publish','Sales\x20can\x20still\x20be\x20added/removed/updated\x20post-publish','buy_guard\x20can\x20be\x20changed\x20post-publish\x20(unusual\x20exception)']},{'id':'T-S-02','name':'Rental\x20Service\x20(deposit\x20+\x20use\x20+\x20return)','description':'Equipment/asset\x20rental\x20with\x20deposit\x20guarantee,\x20Machine\x20workflow,\x20and\x20arbitration','applicable_scenes':['service_rental'],'industry_tags':['rental','equipment','real_estate'],'params':[{'name':'owner_address','type':'address','description':'Service\x20owner\x20(rental\x20company)','required':!![]},{'name':'permission_address','type':'address','description':'Permission\x20object\x20address','required':!![]},{'name':'description','type':'string','description':'Rental\x20service\x20description','required':!![]},{'name':'machine_address','type':'address','description':'Published\x20Machine\x20with\x20Reserve→Pay→Pickup→Return→Refund\x20nodes','required':!![]},{'name':'arbitration_object','type':'address','description':'Arbitration\x20for\x20deposit\x20disputes','required':!![]},{'name':'rental_items','type':'object','description':'Array\x20of\x20{name,\x20price,\x20stock=1,\x20wip,\x20wip_hash}','required':!![]},{'name':'compensation_fund_balance','type':'string','description':'Initial\x20deposit\x20to\x20compensation_fund\x20(in\x20base\x20units)','required':![],'default':'0'}],'body':a=>({'object':null,'description':a['description'],'permission':a['permission_address'],'machine':a['machine_address'],'arbitrations':{'op':'add','objects':[a['arbitration_object']]},'sales':{'op':'add','sales':a['rental_items']},'order_allocators':[{'threshold':'0','sharing':[{'who':{'Object':a['owner_address']},'weight':0x64}]}],'compensation_fund_add':a['compensation_fund_balance']&&a['compensation_fund_balance']!=='0'?{'balance':a['compensation_fund_balance']}:undefined}),'notes':['stock=1\x20per\x20rental\x20item\x20(unique\x20items)\x20—\x20once\x20rented,\x20stock\x20becomes\x200','Machine\x20must\x20define\x20deposit/return/refund\x20nodes\x20for\x20proper\x20rental\x20flow','compensation_fund\x20holds\x20deposit\x20guarantees\x20—\x20separate\x20from\x20rental\x20fee','Arbitration\x20required\x20if\x20compensation_fund\x20>\x200\x20(F-S-19)'],'post_publish_considerations':['Machine\x20binding\x20is\x20permanent\x20—\x20verify\x20workflow\x20before\x20publish','Arbitration\x20binding\x20is\x20permanent\x20—\x20choose\x20reputable\x20arbiters','Sales\x20can\x20be\x20updated\x20(add\x20new\x20rental\x20items,\x20remove\x20deprecated\x20ones)']},{'id':'T-S-03','name':'Subscription\x20Service\x20(tiered\x20plans)','description':'Recurring-access\x20service\x20with\x20tiered\x20plans\x20(Free/Pro/Enterprise),\x20discount\x20coupons,\x20loyalty\x20rewards','applicable_scenes':['service_subscription'],'industry_tags':['subscription','saas','membership'],'params':[{'name':'owner_address','type':'address','description':'Service\x20owner','required':!![]},{'name':'permission_address','type':'address','description':'Permission\x20object\x20address','required':!![]},{'name':'description','type':'string','description':'Subscription\x20service\x20description','required':!![]},{'name':'tier_plans','type':'object','description':'Array\x20of\x20{name,\x20price,\x20stock=999999,\x20wip,\x20wip_hash}\x20for\x20each\x20tier','required':!![]},{'name':'trial_discount_count','type':'number','description':'Number\x20of\x20trial\x20discount\x20coupons\x20to\x20issue','required':![],'default':0x0},{'name':'reward_address','type':'address','description':'Loyalty\x20Reward\x20object\x20address\x20(optional)','required':![],'default':''}],'body':a=>{const b={'object':null,'description':a['description'],'permission':a['permission_address'],'sales':{'op':'add','sales':a['tier_plans']},'order_allocators':[{'threshold':'0','sharing':[{'who':{'Object':a['owner_address']},'weight':0x64}]}]};return a['reward_address']&&(b['rewards']={'op':'add','objects':[a['reward_address']]}),b;},'notes':['Subscription\x20renewals\x20are\x20handled\x20by\x20repeat\x20orders\x20(no\x20native\x20recurring\x20billing)','Use\x20large\x20stock\x20values\x20(e.g.\x20999999)\x20since\x20subscriptions\x20are\x20not\x20inventory-limited','Trial\x20discounts:\x20issue\x20via\x20discount\x20(312)\x20post-publish','Loyalty\x20rewards:\x20bind\x20via\x20the\x20add-reward\x20operation\x20(318)\x20—\x20locked\x20by\x20setting_lock_duration'],'post_publish_considerations':['Tier\x20prices\x20can\x20be\x20updated\x20via\x20the\x20sales\x20update\x20operation\x20(existing\x20subscribers\x20unaffected)','Discount\x20coupons\x20can\x20be\x20issued/destroyed\x20post-publish','Rewards\x20can\x20be\x20added\x20but\x20removal\x20locked\x20by\x20duration']},{'id':'T-S-04','name':'Workflow-bound\x20Service\x20(machine-driven\x20delivery)','description':'Service\x20with\x20multi-step\x20delivery\x20workflow\x20(e.g.\x20freelance,\x20custom\x20manufacturing,\x20course)','applicable_scenes':['service_workflow','service_rental'],'industry_tags':['workflow','freelance','manufacturing','education'],'params':[{'name':'owner_address','type':'address','description':'Service\x20owner\x20(provider)','required':!![]},{'name':'permission_address','type':'address','description':'Permission\x20object\x20address','required':!![]},{'name':'description','type':'string','description':'Service\x20description','required':!![]},{'name':'machine_address','type':'address','description':'Published\x20Machine\x20with\x20Pay→Confirm→Deliver→Sign-off\x20nodes','required':!![]},{'name':'service_items','type':'object','description':'Array\x20of\x20{name,\x20price,\x20stock,\x20wip,\x20wip_hash}','required':!![]},{'name':'customer_required','type':'string[]','description':'Required\x20info\x20fields\x20(e.g.\x20[\x27name\x27,\x27project_brief\x27])','required':![],'default':[]}],'body':a=>({'object':null,'description':a['description'],'permission':a['permission_address'],'machine':a['machine_address'],'sales':{'op':'add','sales':a['service_items']},'customer_required':a['customer_required'],'order_allocators':[{'threshold':'0','sharing':[{'who':{'Object':a['owner_address']},'weight':0x64}]}]}),'notes':['Machine\x20MUST\x20be\x20published\x20before\x20binding\x20(via\x20the\x20Machine\x20publish\x20operation)','Each\x20order\x20creates\x20a\x20Progress\x20object\x20tracking\x20the\x20workflow','Named\x20operators\x20can\x20be\x20assigned\x20per\x20Forward\x20in\x20the\x20Machine','Service.bPaused\x20does\x20NOT\x20affect\x20already-created\x20Progress\x20(existing\x20orders\x20continue)'],'post_publish_considerations':['Machine\x20binding\x20is\x20PERMANENT\x20—\x20cannot\x20upgrade\x20workflow\x20post-publish','To\x20change\x20workflow:\x20clone\x20Service\x20with\x20new\x20Machine,\x20migrate\x20customers\x20via\x20discounts','customer_required\x20fields\x20can\x20be\x20updated\x20post-publish']},{'id':'T-S-05','name':'Arbitration-bound\x20Service\x20(dispute-ready)','description':'Service\x20with\x20multiple\x20Arbitration\x20objects\x20for\x20different\x20dispute\x20scopes\x20+\x20compensation_fund','applicable_scenes':['service_arbitration','service_arbitration_binding'],'industry_tags':['arbitration','dispute_resolution','high_value'],'params':[{'name':'owner_address','type':'address','description':'Service\x20owner','required':!![]},{'name':'permission_address','type':'address','description':'Permission\x20object\x20address','required':!![]},{'name':'description','type':'string','description':'Service\x20description','required':!![]},{'name':'arbitration_addresses','type':'string[]','description':'1-3\x20Arbitration\x20object\x20addresses\x20(different\x20scopes)','required':!![]},{'name':'compensation_fund_balance','type':'string','description':'Initial\x20compensation_fund\x20deposit\x20(base\x20units)','required':!![]},{'name':'setting_lock_duration_ms','type':'number','description':'Initial\x20setting_lock_duration\x20in\x20ms\x20(default\x2030\x20days)','required':![],'default':0x9a7ec800},{'name':'service_items','type':'object','description':'Array\x20of\x20{name,\x20price,\x20stock,\x20wip,\x20wip_hash}','required':!![]}],'body':a=>({'object':null,'description':a['description'],'permission':a['permission_address'],'arbitrations':{'op':'add','objects':a['arbitration_addresses']},'compensation_fund_add':{'balance':a['compensation_fund_balance']},'setting_lock_duration_add':a['setting_lock_duration_ms'],'sales':{'op':'add','sales':a['service_items']},'order_allocators':[{'threshold':'0','sharing':[{'who':{'Object':a['owner_address']},'weight':0x64}]}]}),'notes':['Use\x202-3\x20Arbitration\x20objects:\x20e.g.\x20one\x20for\x20quality\x20disputes,\x20one\x20for\x20delivery\x20disputes','compensation_fund\x20>\x200\x20REQUIRES\x20arbitrations\x20non-empty\x20(F-S-19,\x20E_ARBITRATION_NOT_SET_WITH_COMPENSATION_FUND)','compensation_fund\x20coin\x20type\x20MUST\x20match\x20Service<T>\x20type\x20parameter','setting_lock_duration\x20protects\x20customers\x20—\x20only-increase\x20mechanism'],'post_publish_considerations':['Arbitration\x20bindings\x20are\x20PERMANENT\x20—\x20verify\x20arb\x20reputation\x20before\x20publish','compensation_fund_add\x20(deposit)\x20is\x20always\x20mutable\x20post-publish','compensation_fund_withdraw\x20requires\x20bPaused=true\x20+\x20lock_duration\x20expired','Cannot\x20add\x20new\x20Arbitration\x20post-publish\x20—\x20only\x20pre-publish']},{'id':'T-S-06','name':'Compensation\x20fund\x20Service\x20(embedded\x20Balance<T>)','description':'Service\x20focused\x20on\x20compensation_fund\x20management\x20—\x20emphasizes\x20distinction\x20from\x20Treasury','applicable_scenes':['service_compensation_fund','service_arbitration'],'industry_tags':['finance','escrow','guarantee'],'params':[{'name':'owner_address','type':'address','description':'Service\x20owner','required':!![]},{'name':'permission_address','type':'address','description':'Permission\x20object\x20address','required':!![]},{'name':'description','type':'string','description':'Service\x20description','required':!![]},{'name':'arbitration_addresses','type':'string[]','description':'Arbitration\x20objects\x20(required\x20when\x20fund\x20>\x200)','required':!![]},{'name':'initial_deposit','type':'string','description':'Initial\x20compensation_fund\x20deposit\x20(base\x20units)','required':!![]},{'name':'lock_duration_ms','type':'number','description':'setting_lock_duration\x20(ms)','required':![],'default':0x9a7ec800},{'name':'service_items','type':'object','description':'Sales\x20items','required':!![]}],'body':a=>({'object':null,'description':a['description'],'permission':a['permission_address'],'arbitrations':{'op':'add','objects':a['arbitration_addresses']},'compensation_fund_add':{'balance':a['initial_deposit']},'setting_lock_duration_add':a['lock_duration_ms'],'sales':{'op':'add','sales':a['service_items']},'order_allocators':[{'threshold':'0','sharing':[{'who':{'Object':a['owner_address']},'weight':0x64}]}]}),'notes':['⚠️\x20compensation_fund\x20is\x20INTERNAL\x20Balance<T>\x20—\x20distinct\x20from\x20Treasury\x20(external)','Treasury\x20is\x20referenced\x20via\x20order_allocators.sharing.who=Entity\x20(Treasury\x20address)','compensation_fund\x20is\x20consumed\x20by\x20the\x20arbitration\x20compensation\x20claim\x20(driven\x20by\x20arb\x20result)','Owner\x20can\x20only\x20withdraw\x20via\x20compensation_fund_withdraw\x20(requires\x20paused\x20+\x20lock\x20expired)'],'post_publish_considerations':['Deposits\x20(compensation_fund_add)\x20always\x20allowed','Withdrawals\x20(compensation_fund_withdraw)\x20require\x20bPaused=true\x20+\x20lock_duration\x20expired','Receive\x20(compensation_fund_receive)\x20locked\x20by\x20duration','setting_lock_duration\x20only-increase\x20—\x20plan\x20withdrawal\x20timeline\x20carefully']},{'id':'T-S-07','name':'Dynamic\x20pricing\x20Service\x20(discount-driven)','description':'Service\x20with\x20promotional\x20discount\x20coupons\x20—\x20supports\x20rates\x20(basis\x20points,\x20per\x2010000)\x20and\x20minus\x20(direct\x20deduction)\x20types','applicable_scenes':['service_dynamic_pricing'],'industry_tags':['retail','marketing','promotion'],'params':[{'name':'owner_address','type':'address','description':'Service\x20owner','required':!![]},{'name':'permission_address','type':'address','description':'Permission\x20object\x20address','required':!![]},{'name':'description','type':'string','description':'Service\x20description','required':!![]},{'name':'service_items','type':'object','description':'Array\x20of\x20{name,\x20price,\x20stock,\x20wip,\x20wip_hash}','required':!![]},{'name':'discount_specs','type':'object','description':'Array\x20of\x20{name,\x20type,\x20data,\x20count,\x20expire_at}\x20for\x20initial\x20discounts','required':![],'default':[]}],'body':a=>({'object':null,'description':a['description'],'permission':a['permission_address'],'sales':{'op':'add','sales':a['service_items']},'order_allocators':[{'threshold':'0','sharing':[{'who':{'Object':a['owner_address']},'weight':0x64}]}]}),'notes':['Discounts\x20are\x20issued\x20POST-PUBLISH\x20via\x20discount\x20(312)\x20—\x20not\x20in\x20create\x20body','discount_type=0\x20rates\x20(basis\x20points,\x20e.g.\x201000=10%);\x201=minus\x20(direct\x20deduction,\x20base\x20units)','MAX_DISCOUNT_COUNT_ONCE\x20=\x201000\x20per\x20issue\x20call','MAX_DISCOUNT_RECEIVER_ONCE\x20=\x201000\x20receivers\x20per\x20call','MAX_DISCOUNT_TOTAL_COUNT\x20=\x2020000\x20total\x20coupons\x20per\x20Service','discount_destroy\x20is\x20holder-only\x20(no\x20SERVICE_DISCOUNT\x20permission\x20needed)','discount_send\x20transfers\x20owned\x20transferable:true\x20coupons\x20to\x20another\x20address\x20(holder-only)'],'post_publish_considerations':['Discount\x20coupons\x20can\x20be\x20issued/destroyed\x20freely','Sales\x20prices\x20can\x20be\x20updated\x20via\x20the\x20sales\x20update\x20operation\x20(existing\x20orders\x20unaffected)','Track\x20discount\x20usage\x20to\x20avoid\x20stockout\x20of\x20promotional\x20items']},{'id':'T-S-08','name':'Multi-allocator\x20Service\x20(tiered\x20fund\x20distribution)','description':'Service\x20with\x20multiple\x20allocator\x20tiers\x20—\x20guard-selected\x20distribution\x20based\x20on\x20order\x20value','applicable_scenes':['service_multi_allocator','service_order_allocator','service_reward'],'industry_tags':['marketplace','platform','logistics'],'params':[{'name':'owner_address','type':'address','description':'Service\x20owner\x20(merchant)','required':!![]},{'name':'permission_address','type':'address','description':'Permission\x20object\x20address','required':!![]},{'name':'description','type':'string','description':'Service\x20description','required':!![]},{'name':'platform_address','type':'address','description':'Platform\x20fee\x20recipient','required':!![]},{'name':'logistics_address','type':'address','description':'Logistics\x20fee\x20recipient\x20(optional)','required':![],'default':''},{'name':'service_items','type':'object','description':'Array\x20of\x20{name,\x20price,\x20stock,\x20wip,\x20wip_hash}','required':!![]},{'name':'tier1_threshold','type':'string','description':'Small\x20order\x20threshold\x20(base\x20units,\x20e.g.\x20\x270\x27)','required':![],'default':'0'},{'name':'tier2_threshold','type':'string','description':'Medium\x20order\x20threshold\x20(base\x20units)','required':![],'default':'10000000000'},{'name':'tier3_threshold','type':'string','description':'Large\x20order\x20threshold\x20(base\x20units)','required':![],'default':'100000000000'}],'body':a=>{const b=[{'threshold':a['tier1_threshold'],'sharing':[{'who':{'Object':a['owner_address']},'weight':0x5a},{'who':{'Object':a['platform_address']},'weight':0xa}]},{'threshold':a['tier2_threshold'],'sharing':a['logistics_address']?[{'who':{'Object':a['owner_address']},'weight':0x50},{'who':{'Object':a['platform_address']},'weight':0xa},{'who':{'Object':a['logistics_address']},'weight':0xa}]:[{'who':{'Object':a['owner_address']},'weight':0x55},{'who':{'Object':a['platform_address']},'weight':0xf}]},{'threshold':a['tier3_threshold'],'sharing':a['logistics_address']?[{'who':{'Object':a['owner_address']},'weight':0x46},{'who':{'Object':a['platform_address']},'weight':0xa},{'who':{'Object':a['logistics_address']},'weight':0x14}]:[{'who':{'Object':a['owner_address']},'weight':0x50},{'who':{'Object':a['platform_address']},'weight':0x14}]}];return{'object':null,'description':a['description'],'permission':a['permission_address'],'sales':{'op':'add','sales':a['service_items']},'order_allocators':b};},'notes':['Each\x20allocator\x20tier\x20is\x20bound\x20to\x20a\x20DIFFERENT\x20guard\x20—\x20the\x20caller\x27s\x20submitted\x20guard\x20selects\x20which\x20tier\x20fires','Each\x20tier\x20can\x20have\x20its\x20own\x20Guard\x20for\x20execution\x20authorization\x20(optional)','Thresholds\x20must\x20be\x20ascending\x20(tier1\x20<\x20tier2\x20<\x20tier3)','MAX_SHARING_COUNT\x20=\x20100\x20per\x20allocator\x20(sum\x20of\x20sharing\x20entries)','Treasury\x20addresses\x20can\x20be\x20referenced\x20via\x20sharing.who=Entity\x20(Treasury\x20object)'],'post_publish_considerations':['⚠️\x20order_allocators\x20is\x20IMMUTABLE\x20post-publish\x20(F-S-22)\x20—\x20verify\x20tiers\x20before\x20publish','To\x20change\x20fee\x20split:\x20clone\x20Service\x20with\x20new\x20allocators\x20(cannot\x20migrate\x20existing\x20Orders)','Sales\x20can\x20still\x20be\x20updated\x20post-publish\x20(only\x20allocator\x20is\x20locked)']},{'id':'T-S-09','name':'Supply\x20Chain\x20Sub-order\x20Service\x20(milestone\x20unlock\x20via\x20buy_guard)','description':'Sub-service\x20whose\x20buy_guard\x20verifies\x20the\x20user\x20purchased\x20the\x20main\x20service\x20order.\x20Each\x20milestone\x20=\x20one\x20sub-order.\x20Enables\x20supply\x20chain\x20composition:\x20main\x20service\x20→\x20multiple\x20sub-services\x20with\x20conditional\x20access.','applicable_scenes':['service_buy_guard'],'industry_tags':['travel','rental','education','freelance','ecommerce','supply_chain'],'params':[{'name':'owner_address','type':'address','description':'Sub-service\x20owner\x20address','required':!![]},{'name':'permission_address','type':'address','description':'Permission\x20object\x20address','required':!![]},{'name':'description','type':'string','description':'Sub-service\x20description\x20(e.g.,\x20\x27Hotel\x20booking\x20for\x20tour\x20package\x20X\x27)','required':!![]},{'name':'main_service_address','type':'address','description':'Main\x20Service\x20object\x20address\x20(the\x20parent\x20service)','required':!![]},{'name':'buy_guard_address','type':'address','description':'Guard\x20address\x20verifying\x20main\x20order\x20ownership\x20(order.owner==Signer\x20AND\x20order.service==main_service)','required':!![]},{'name':'price','type':'number','description':'Sub-service\x20price','required':!![]},{'name':'machine_address','type':'address','description':'Machine\x20object\x20for\x20sub-order\x20workflow','required':!![]}],'body':a=>({'object':null,'description':a['description'],'service_type':'supply_chain_sub','buy_guard':a['buy_guard_address'],'price':a['price'],'machine':a['machine_address'],'permission':a['permission_address']}),'notes':['VERIFIED:\x20buy_guard:\x20Option<address>;\x20the\x20Passport-verified\x20purchase\x20evaluates\x20buy_guard','VERIFIER-EVIDENCE\x20DESIGN:\x20user\x20submits\x20main\x20Order\x20as\x20evidence\x20(b_submission=true),\x20buy_guard\x20verifies\x20order.owner==Signer\x20AND\x20order.service==main_service_address','No\x20parent_order\x20field\x20needed\x20—\x20relationship\x20verified\x20via\x20buy_guard\x20querying\x20submitted\x20Order\x20fields','Each\x20milestone\x20=\x20one\x20sub-order\x20with\x20its\x20own\x20Service\x20+\x20buy_guard\x20+\x20Machine','Main\x20flow\x20Machine\x20can\x20branch\x20to\x20different\x20sub-services\x20based\x20on\x20node\x20progression','Use\x20tpl_buy_guard_order_holder\x20(guard-templates.ts)\x20for\x20the\x20buy_guard\x20design'],'post_publish_considerations':['buy_guard\x20is\x20mutable\x20post-publish\x20(can\x20update\x20the\x20guard\x20address)','If\x20main\x20service\x20is\x20unpublished,\x20sub-service\x20buy_guard\x20will\x20fail\x20(order.service\x20won\x27t\x20match)','Consider\x20publishing\x20main\x20service\x20before\x20sub-services']}];export const SERVICE_TEMPLATES_VERSION='1.0.0';export function getAllServiceTemplates(){return[...SERVICE_TEMPLATES];}export function getServiceTemplateById(a){return SERVICE_TEMPLATES['find'](b=>b['id']===a);}export function getServiceTemplatesByScene(a){return SERVICE_TEMPLATES['filter'](b=>b['applicable_scenes']['includes'](a));}export function getServiceTemplatesByIndustry(a){return SERVICE_TEMPLATES['filter'](b=>b['industry_tags']['includes'](a)||b['industry_tags']['includes']('universal'));}export function suggestServiceTemplateForScene(a){const b=getServiceTemplatesByScene(a);return b['length']>0x0?b[0x0]:undefined;}export function listServiceTemplates(){return SERVICE_TEMPLATES['map'](a=>({'id':a['id'],'name':a['name'],'description':a['description'],'scenes':a['applicable_scenes']}));}export const SERVICE_PRICING_NOTE='Pricing\x20coin:\x20prices\x20in\x20the\x20generated\x20body\x20are\x20denominated\x20in\x20the\x20object\x27s\x20type_parameter\x20token\x20(default\x200x2::wow::WOW),\x20which\x20is\x20FIXED\x20at\x20creation\x20—\x20buyers\x20must\x20hold\x20that\x20exact\x20token\x20to\x20order.\x20To\x20price\x20in\x20a\x20different\x20token,\x20pass\x20its\x20full\x20type\x20(from\x20wowok_buildin_info\x20\x27mainnet\x20bridge\x20tokens\x27\x20wowTypeTag)\x20as\x20type_parameter\x20BEFORE\x20creating.\x20Testnet\x20has\x20ONLY\x20WOW\x20(no\x20stablecoins\x20are\x20bridged);\x20multi-token\x20pricing\x20is\x20a\x20mainnet\x20capability.';export function fillServiceTemplate(a,b){const c=getServiceTemplateById(a);if(!c)return{'ok':![],'error':'Template\x20'+a+'\x20not\x20found'};const d=[];for(const f of c['params']){f['required']&&!(f['name']in b)&&d['push'](f['name']);}if(d['length']>0x0)return{'ok':![],'error':'Missing\x20required\x20params:\x20'+d['join'](',\x20'),'missing_required':d};const e={...b};for(const g of c['params']){!(g['name']in e)&&g['default']!==undefined&&(e[g['name']]=g['default']);}return{'ok':!![],'body':c['body'](e),'pricing_note':SERVICE_PRICING_NOTE};}
@@ -124,6 +124,9 @@ export interface IndustryTemplate extends TemplateFrontmatter {
124
124
  body: string;
125
125
  source_path: string;
126
126
  }
127
+ import { validateAllocatorRows } from "./template-validation.js";
128
+ export { validateAllocatorRows };
129
+ export declare function platformShareBps(fee: Record<string, number | string>): number | undefined;
127
130
  export declare function parseTemplateFile(raw: string): {
128
131
  frontmatter: Record<string, unknown>;
129
132
  body: string;
@@ -132,11 +135,12 @@ export declare const TEMPLATE_SENTINEL_KIND = "industry-template";
132
135
  export declare function renderTemplateFile(t: ArchetypeTemplate): string;
133
136
  export interface TemplateSeedResult {
134
137
  template: string;
135
- status: "written" | "updated" | "current" | "skipped_user_file" | "skipped_user_modified" | "would_update" | "error";
138
+ status: "written" | "restamped" | "current" | "skipped_modified" | "skipped_user_file" | "would_update" | "updated" | "error";
136
139
  path: string;
137
140
  detail?: string;
138
141
  }
139
142
  export declare function seedBuiltinTemplates(): TemplateSeedResult[];
143
+ export declare function summarizeTemplateDiff(onDiskContent: string, canonical: string): string;
140
144
  export declare function repairBuiltinTemplates(options?: {
141
145
  backup?: boolean;
142
146
  dryRun?: boolean;
@@ -144,7 +148,8 @@ export declare function repairBuiltinTemplates(options?: {
144
148
  export declare function builtinTemplateDrift(): Array<{
145
149
  template: string;
146
150
  path: string;
147
- state: "no_sentinel_legacy" | "stale_release" | "user_modified" | "missing";
151
+ state: "missing" | "modified";
152
+ repairable: boolean;
148
153
  detail: string;
149
154
  }>;
150
155
  export declare function reloadTemplates(): void;