@wowok/agent-mcp 2.7.1 → 2.7.3

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 (597) hide show
  1. package/dist/config/index.js +1 -1
  2. package/dist/config/runtime.js +1 -238
  3. package/dist/customer/account-events.d.ts +32 -0
  4. package/dist/customer/account-events.js +1 -0
  5. package/dist/customer/customer-advice.d.ts +1 -0
  6. package/dist/customer/customer-advice.js +1 -130
  7. package/dist/customer/index.js +1 -11
  8. package/dist/customer/industry-risks.js +1 -438
  9. package/dist/customer/info-puzzle.js +1 -681
  10. package/dist/customer/order-monitor.js +1 -328
  11. package/dist/customer/order-strategy.d.ts +1 -1
  12. package/dist/customer/order-strategy.js +1 -373
  13. package/dist/customer/post-purchase.js +1 -351
  14. package/dist/customer/preorder-compare.js +1 -34
  15. package/dist/customer/reminder-system.d.ts +2 -0
  16. package/dist/customer/reminder-system.js +1 -316
  17. package/dist/customer/risk-assessment.d.ts +1 -0
  18. package/dist/customer/risk-assessment.js +1 -397
  19. package/dist/customer/types.d.ts +2 -0
  20. package/dist/customer/types.js +1 -13
  21. package/dist/customer/user-preferences.js +1 -460
  22. package/dist/evaluation/arbitration-game.d.ts +9 -2
  23. package/dist/evaluation/arbitration-game.js +1 -48
  24. package/dist/evaluation/builtins/arbitration-score.d.ts +41 -0
  25. package/dist/evaluation/builtins/arbitration-score.js +1 -0
  26. package/dist/evaluation/builtins/demand-match.js +1 -153
  27. package/dist/evaluation/builtins/index.d.ts +1 -0
  28. package/dist/evaluation/builtins/index.js +1 -10
  29. package/dist/evaluation/builtins/service-risk.js +1 -55
  30. package/dist/evaluation/capability.js +1 -13
  31. package/dist/evaluation/category-match-rules.d.ts +30 -0
  32. package/dist/evaluation/category-match-rules.js +1 -0
  33. package/dist/evaluation/composer.js +1 -40
  34. package/dist/evaluation/engine.js +1 -175
  35. package/dist/evaluation/extract.js +1 -115
  36. package/dist/evaluation/game-strategy.d.ts +27 -0
  37. package/dist/evaluation/game-strategy.js +1 -0
  38. package/dist/evaluation/gap.js +1 -100
  39. package/dist/evaluation/index.d.ts +2 -0
  40. package/dist/evaluation/index.js +1 -11
  41. package/dist/evaluation/location-match.d.ts +42 -0
  42. package/dist/evaluation/location-match.js +1 -0
  43. package/dist/evaluation/node-game.d.ts +31 -3
  44. package/dist/evaluation/node-game.js +1 -57
  45. package/dist/evaluation/path-reasoning.d.ts +35 -0
  46. package/dist/evaluation/path-reasoning.js +1 -0
  47. package/dist/evaluation/region.d.ts +6 -0
  48. package/dist/evaluation/region.js +1 -36
  49. package/dist/evaluation/types.d.ts +18 -0
  50. package/dist/evaluation/types.js +1 -1
  51. package/dist/evaluation/user-injection.js +1 -27
  52. package/dist/experience/experience-reuse.js +1 -103
  53. package/dist/experience/index.js +1 -5
  54. package/dist/experience/intent-distill.js +1 -83
  55. package/dist/experience/realtime-feedback.js +1 -94
  56. package/dist/experience/types.js +1 -1
  57. package/dist/experience/user-profile.d.ts +1 -1
  58. package/dist/experience/user-profile.js +1 -171
  59. package/dist/extensions/business-modules.js +1 -287
  60. package/dist/extensions/capability-manifest.js +1 -781
  61. package/dist/extensions/constraint-registry.js +1 -198
  62. package/dist/extensions/index.d.ts +6 -0
  63. package/dist/extensions/index.js +1 -6
  64. package/dist/extensions/industry-layers.d.ts +75 -0
  65. package/dist/extensions/industry-layers.js +1 -0
  66. package/dist/extensions/industry-pack.d.ts +105 -0
  67. package/dist/extensions/industry-pack.js +1 -0
  68. package/dist/extensions/metric-registry.js +1 -257
  69. package/dist/extensions/mode-evaluator.d.ts +1 -1
  70. package/dist/extensions/mode-evaluator.js +1 -170
  71. package/dist/extensions/modes.js +1 -499
  72. package/dist/extensions/registry.d.ts +1 -0
  73. package/dist/extensions/registry.js +1 -717
  74. package/dist/extensions/types.js +1 -1
  75. package/dist/graph/base.d.ts +8 -0
  76. package/dist/graph/base.js +1 -0
  77. package/dist/harness/auto-escalation.js +1 -68
  78. package/dist/harness/checkpoint.js +1 -129
  79. package/dist/harness/index.d.ts +1 -0
  80. package/dist/harness/index.js +1 -78
  81. package/dist/harness/plan.d.ts +2 -0
  82. package/dist/harness/plan.js +1 -315
  83. package/dist/harness/recover.d.ts +1 -1
  84. package/dist/harness/recover.js +1 -139
  85. package/dist/harness/types.d.ts +2 -3
  86. package/dist/harness/types.js +1 -1
  87. package/dist/harness/verify.js +1 -237
  88. package/dist/index.js +1 -273
  89. package/dist/intent/enrich.js +1 -67
  90. package/dist/intent/index.js +1 -60
  91. package/dist/intent/matcher.js +1 -81
  92. package/dist/intent/store.js +1 -55
  93. package/dist/intent/types.js +1 -10
  94. package/dist/knowledge/acquisition-flywheel.js +1 -192
  95. package/dist/knowledge/allocation-confirm.js +1 -534
  96. package/dist/knowledge/allocation-context.js +1 -249
  97. package/dist/knowledge/allocation-ledger.js +1 -463
  98. package/dist/knowledge/allocation-puzzle.js +1 -298
  99. package/dist/knowledge/allocation-risk.js +1 -568
  100. package/dist/knowledge/allocation-templates.js +1 -970
  101. package/dist/knowledge/allocation-translation.js +1 -585
  102. package/dist/knowledge/anti-cheat.d.ts +37 -0
  103. package/dist/knowledge/anti-cheat.js +1 -0
  104. package/dist/knowledge/arb-confirm.d.ts +28 -0
  105. package/dist/knowledge/arb-confirm.js +1 -0
  106. package/dist/knowledge/arb-risk.js +1 -210
  107. package/dist/knowledge/arb-translation.d.ts +48 -0
  108. package/dist/knowledge/arb-translation.js +1 -0
  109. package/dist/knowledge/arbitration-confirm.js +1 -559
  110. package/dist/knowledge/arbitration-context.js +1 -505
  111. package/dist/knowledge/arbitration-ledger.js +1 -521
  112. package/dist/knowledge/arbitration-puzzle.js +1 -304
  113. package/dist/knowledge/arbitration-risk.js +1 -423
  114. package/dist/knowledge/arbitration-templates.js +1 -276
  115. package/dist/knowledge/arbitration-translation.js +1 -487
  116. package/dist/knowledge/audit-rules.js +1 -141
  117. package/dist/knowledge/bridge-confirm.d.ts +26 -0
  118. package/dist/knowledge/bridge-confirm.js +1 -0
  119. package/dist/knowledge/bridge-risk.js +1 -263
  120. package/dist/knowledge/bridge-translation.d.ts +37 -0
  121. package/dist/knowledge/bridge-translation.js +1 -0
  122. package/dist/knowledge/contact-confirm.d.ts +27 -0
  123. package/dist/knowledge/contact-confirm.js +1 -0
  124. package/dist/knowledge/contact-risk.js +1 -200
  125. package/dist/knowledge/contact-templates.js +1 -60
  126. package/dist/knowledge/contact-translation.d.ts +39 -0
  127. package/dist/knowledge/contact-translation.js +1 -0
  128. package/dist/knowledge/demand-confirm.js +1 -206
  129. package/dist/knowledge/demand-context.d.ts +17 -0
  130. package/dist/knowledge/demand-context.js +1 -0
  131. package/dist/knowledge/demand-ledger.d.ts +26 -0
  132. package/dist/knowledge/demand-ledger.js +1 -0
  133. package/dist/knowledge/demand-matching.js +1 -132
  134. package/dist/knowledge/demand-puzzle.d.ts +29 -0
  135. package/dist/knowledge/demand-puzzle.js +1 -0
  136. package/dist/knowledge/demand-risk.js +1 -240
  137. package/dist/knowledge/demand-templates.d.ts +12 -0
  138. package/dist/knowledge/demand-templates.js +1 -0
  139. package/dist/knowledge/demand-translation.js +1 -354
  140. package/dist/knowledge/deployment-scanner.js +1 -823
  141. package/dist/knowledge/dynamic-pricing.js +1 -87
  142. package/dist/knowledge/evidence-review.d.ts +12 -0
  143. package/dist/knowledge/evidence-review.js +1 -0
  144. package/dist/knowledge/examples-scanner-cli.js +1 -26
  145. package/dist/knowledge/examples-scanner.js +1 -843
  146. package/dist/knowledge/flywheel-loop.d.ts +0 -1
  147. package/dist/knowledge/flywheel-loop.js +1 -404
  148. package/dist/knowledge/fund-layer.js +1 -973
  149. package/dist/knowledge/glossary.js +1 -211
  150. package/dist/knowledge/guard-confirm.js +1 -406
  151. package/dist/knowledge/guard-context.js +1 -287
  152. package/dist/knowledge/guard-design-patterns.js +1 -360
  153. package/dist/knowledge/guard-ledger.js +1 -260
  154. package/dist/knowledge/guard-lint.js +1 -670
  155. package/dist/knowledge/guard-migration.d.ts +1 -1
  156. package/dist/knowledge/guard-migration.js +1 -228
  157. package/dist/knowledge/guard-puzzle.js +1 -805
  158. package/dist/knowledge/guard-render.js +1 -700
  159. package/dist/knowledge/guard-risk.js +1 -1879
  160. package/dist/knowledge/guard-submission-prompt.js +1 -171
  161. package/dist/knowledge/guard-templates.js +1 -1105
  162. package/dist/knowledge/guard-translation.js +1 -1119
  163. package/dist/knowledge/index.d.ts +71 -3
  164. package/dist/knowledge/index.js +1 -436
  165. package/dist/knowledge/industry-evolution.js +1 -323
  166. package/dist/knowledge/industry-generalizer.js +1 -381
  167. package/dist/knowledge/industry-registry.js +1 -174
  168. package/dist/knowledge/intent-metrics.d.ts +4 -3
  169. package/dist/knowledge/intent-metrics.js +1 -566
  170. package/dist/knowledge/machine-confirm.js +1 -559
  171. package/dist/knowledge/machine-context.js +1 -833
  172. package/dist/knowledge/machine-ledger.js +1 -338
  173. package/dist/knowledge/machine-puzzle.js +1 -494
  174. package/dist/knowledge/machine-render.js +1 -565
  175. package/dist/knowledge/machine-risk.js +1 -669
  176. package/dist/knowledge/machine-templates.js +1 -1597
  177. package/dist/knowledge/machine-topology.js +1 -234
  178. package/dist/knowledge/machine-translation.js +1 -513
  179. package/dist/knowledge/market-metrics.d.ts +12 -0
  180. package/dist/knowledge/market-metrics.js +1 -0
  181. package/dist/knowledge/market-operations.d.ts +46 -0
  182. package/dist/knowledge/market-operations.js +1 -0
  183. package/dist/knowledge/mcp-schema-audit-cli.js +1 -45
  184. package/dist/knowledge/mcp-schema-audit.d.ts +22 -22
  185. package/dist/knowledge/mcp-schema-audit.js +1 -777
  186. package/dist/knowledge/onchain-constants.js +1 -35
  187. package/dist/knowledge/order-confirm.js +1 -573
  188. package/dist/knowledge/order-context.js +1 -390
  189. package/dist/knowledge/order-ledger.js +1 -341
  190. package/dist/knowledge/order-puzzle.js +1 -255
  191. package/dist/knowledge/order-risk.js +1 -653
  192. package/dist/knowledge/order-templates.js +1 -368
  193. package/dist/knowledge/order-translation.js +1 -550
  194. package/dist/knowledge/overrides-loader.js +1 -65
  195. package/dist/knowledge/passport-confirm.js +1 -531
  196. package/dist/knowledge/passport-context.js +1 -306
  197. package/dist/knowledge/passport-ledger.js +1 -282
  198. package/dist/knowledge/passport-puzzle.js +1 -333
  199. package/dist/knowledge/passport-risk.js +1 -450
  200. package/dist/knowledge/passport-templates.js +1 -568
  201. package/dist/knowledge/passport-translation.js +1 -516
  202. package/dist/knowledge/payment-confirm.d.ts +26 -0
  203. package/dist/knowledge/payment-confirm.js +1 -0
  204. package/dist/knowledge/payment-risk.js +1 -249
  205. package/dist/knowledge/payment-translation.d.ts +37 -0
  206. package/dist/knowledge/payment-translation.js +1 -0
  207. package/dist/knowledge/permission-confirm.js +1 -426
  208. package/dist/knowledge/permission-context.js +1 -224
  209. package/dist/knowledge/permission-ledger.d.ts +11 -0
  210. package/dist/knowledge/permission-ledger.js +1 -403
  211. package/dist/knowledge/permission-puzzle.js +1 -173
  212. package/dist/knowledge/permission-risk.js +1 -411
  213. package/dist/knowledge/permission-templates.js +1 -234
  214. package/dist/knowledge/permission-translation.js +1 -350
  215. package/dist/knowledge/personal-confirm.d.ts +29 -0
  216. package/dist/knowledge/personal-confirm.js +1 -0
  217. package/dist/knowledge/personal-risk.js +1 -212
  218. package/dist/knowledge/personal-translation.d.ts +37 -0
  219. package/dist/knowledge/personal-translation.js +1 -0
  220. package/dist/knowledge/process-model.d.ts +1 -11
  221. package/dist/knowledge/process-model.js +1 -160
  222. package/dist/knowledge/progress-confirm.js +1 -456
  223. package/dist/knowledge/progress-context.js +1 -452
  224. package/dist/knowledge/progress-ledger.js +1 -330
  225. package/dist/knowledge/progress-puzzle.js +1 -219
  226. package/dist/knowledge/progress-risk.js +1 -461
  227. package/dist/knowledge/progress-templates.js +1 -228
  228. package/dist/knowledge/progress-translation.js +1 -405
  229. package/dist/knowledge/proof-confirm.js +1 -187
  230. package/dist/knowledge/proof-context.d.ts +17 -0
  231. package/dist/knowledge/proof-context.js +1 -0
  232. package/dist/knowledge/proof-ledger.d.ts +34 -0
  233. package/dist/knowledge/proof-ledger.js +1 -0
  234. package/dist/knowledge/proof-puzzle.d.ts +35 -0
  235. package/dist/knowledge/proof-puzzle.js +1 -0
  236. package/dist/knowledge/proof-risk.js +1 -207
  237. package/dist/knowledge/proof-templates.d.ts +22 -0
  238. package/dist/knowledge/proof-templates.js +1 -0
  239. package/dist/knowledge/proof-translation.js +1 -283
  240. package/dist/knowledge/registrar-confirm.d.ts +26 -0
  241. package/dist/knowledge/registrar-confirm.js +1 -0
  242. package/dist/knowledge/registrar-risk.js +1 -217
  243. package/dist/knowledge/registrar-translation.d.ts +37 -0
  244. package/dist/knowledge/registrar-translation.js +1 -0
  245. package/dist/knowledge/repository-confirm.js +1 -286
  246. package/dist/knowledge/repository-context.d.ts +12 -0
  247. package/dist/knowledge/repository-context.js +1 -0
  248. package/dist/knowledge/repository-ledger.d.ts +25 -0
  249. package/dist/knowledge/repository-ledger.js +1 -0
  250. package/dist/knowledge/repository-puzzle.d.ts +30 -0
  251. package/dist/knowledge/repository-puzzle.js +1 -0
  252. package/dist/knowledge/repository-risk.js +1 -373
  253. package/dist/knowledge/repository-templates.d.ts +14 -0
  254. package/dist/knowledge/repository-templates.js +1 -0
  255. package/dist/knowledge/repository-translation.js +1 -445
  256. package/dist/knowledge/reputation-rules.js +1 -99
  257. package/dist/knowledge/resource-confirm.d.ts +25 -0
  258. package/dist/knowledge/resource-confirm.js +1 -0
  259. package/dist/knowledge/resource-risk.js +1 -157
  260. package/dist/knowledge/resource-translation.d.ts +37 -0
  261. package/dist/knowledge/resource-translation.js +1 -0
  262. package/dist/knowledge/reward-confirm.js +1 -526
  263. package/dist/knowledge/reward-context.d.ts +2 -2
  264. package/dist/knowledge/reward-context.js +1 -504
  265. package/dist/knowledge/reward-ledger.js +1 -502
  266. package/dist/knowledge/reward-puzzle.js +1 -300
  267. package/dist/knowledge/reward-risk.js +1 -627
  268. package/dist/knowledge/reward-templates.js +1 -197
  269. package/dist/knowledge/reward-translation.js +1 -501
  270. package/dist/knowledge/safety-rules.d.ts +1 -0
  271. package/dist/knowledge/safety-rules.js +1 -404
  272. package/dist/knowledge/scenario-modes.js +1 -321
  273. package/dist/knowledge/service-confirm.js +1 -807
  274. package/dist/knowledge/service-context.js +1 -403
  275. package/dist/knowledge/service-ledger.js +1 -609
  276. package/dist/knowledge/service-puzzle.js +1 -236
  277. package/dist/knowledge/service-risk.d.ts +1 -1
  278. package/dist/knowledge/service-risk.js +1 -651
  279. package/dist/knowledge/service-templates.js +1 -456
  280. package/dist/knowledge/service-translation.js +1 -622
  281. package/dist/knowledge/template-registry.js +1 -353
  282. package/dist/knowledge/tool-constraints.js +1 -195
  283. package/dist/knowledge/tools-reference.js +1 -178
  284. package/dist/knowledge/treasury-confirm.js +1 -512
  285. package/dist/knowledge/treasury-context.js +1 -363
  286. package/dist/knowledge/treasury-ledger.js +1 -300
  287. package/dist/knowledge/treasury-puzzle.js +1 -216
  288. package/dist/knowledge/treasury-risk.js +1 -440
  289. package/dist/knowledge/treasury-templates.js +1 -358
  290. package/dist/knowledge/treasury-translation.js +1 -498
  291. package/dist/knowledge/trust-metrics.js +1 -198
  292. package/dist/knowledge/universal-template.d.ts +22 -0
  293. package/dist/knowledge/universal-template.js +1 -0
  294. package/dist/knowledge/util-confirm.d.ts +24 -0
  295. package/dist/knowledge/util-confirm.js +1 -0
  296. package/dist/knowledge/util-risk.js +1 -135
  297. package/dist/knowledge/util-translation.d.ts +38 -0
  298. package/dist/knowledge/util-translation.js +1 -0
  299. package/dist/knowledge/workflow-guidance.d.ts +116 -0
  300. package/dist/knowledge/workflow-guidance.js +1 -0
  301. package/dist/loop-engineering/aggregate.js +1 -132
  302. package/dist/loop-engineering/context-collect.js +1 -83
  303. package/dist/loop-engineering/diagnose.js +1 -273
  304. package/dist/loop-engineering/improve.js +1 -405
  305. package/dist/loop-engineering/index.js +1 -4
  306. package/dist/loop-engineering/pipeline.js +1 -56
  307. package/dist/mode-market/index.js +1 -3
  308. package/dist/mode-market/registry.js +1 -124
  309. package/dist/mode-market/review.js +1 -214
  310. package/dist/mode-market/submission.js +1 -85
  311. package/dist/participation/collaborator-interest.d.ts +23 -0
  312. package/dist/participation/collaborator-interest.js +1 -0
  313. package/dist/participation/customer-interest.d.ts +25 -0
  314. package/dist/participation/customer-interest.js +1 -0
  315. package/dist/participation/employee-kpi.d.ts +25 -0
  316. package/dist/participation/employee-kpi.js +1 -0
  317. package/dist/participation/employee-store.d.ts +16 -0
  318. package/dist/participation/employee-store.js +1 -0
  319. package/dist/participation/index.d.ts +2 -0
  320. package/dist/participation/index.js +1 -0
  321. package/dist/participation/merchant-interest.js +1 -100
  322. package/dist/participation/radar-core.d.ts +13 -3
  323. package/dist/participation/radar-core.js +1 -269
  324. package/dist/participation/supplier-interest.d.ts +25 -0
  325. package/dist/participation/supplier-interest.js +1 -0
  326. package/dist/persona/analyzer.js +1 -66
  327. package/dist/persona/bridge.js +1 -86
  328. package/dist/persona/defaults.js +1 -195
  329. package/dist/persona/experience-bridge.js +1 -23
  330. package/dist/persona/index.d.ts +9 -2
  331. package/dist/persona/index.js +1 -71
  332. package/dist/persona/local-region.d.ts +20 -0
  333. package/dist/persona/local-region.js +1 -0
  334. package/dist/persona/model.js +1 -111
  335. package/dist/persona/overrides.d.ts +10 -0
  336. package/dist/persona/overrides.js +1 -0
  337. package/dist/persona/pack-personae.d.ts +11 -0
  338. package/dist/persona/pack-personae.js +1 -0
  339. package/dist/persona/store.js +1 -62
  340. package/dist/persona/strategy-intent.d.ts +20 -0
  341. package/dist/persona/strategy-intent.js +1 -0
  342. package/dist/persona/types.d.ts +6 -2
  343. package/dist/persona/types.js +1 -5
  344. package/dist/project/business-puzzle.d.ts +1 -1
  345. package/dist/project/business-puzzle.js +1 -383
  346. package/dist/project/context-assembly.js +1 -254
  347. package/dist/project/deployment-bridge.js +1 -120
  348. package/dist/project/deployment-doc.js +1 -1126
  349. package/dist/project/edit-planner.js +1 -1342
  350. package/dist/project/evaluation.d.ts +37 -1
  351. package/dist/project/evaluation.js +1 -2011
  352. package/dist/project/game-theory.js +1 -177
  353. package/dist/project/graph-builder.js +1 -656
  354. package/dist/project/graph.d.ts +3 -6
  355. package/dist/project/graph.js +1 -340
  356. package/dist/project/handlers.d.ts +33 -2
  357. package/dist/project/handlers.js +1 -1784
  358. package/dist/project/index.d.ts +2 -0
  359. package/dist/project/index.js +1 -301
  360. package/dist/project/intent-analyzer.js +1 -149
  361. package/dist/project/machine-nodes.js +1 -36
  362. package/dist/project/merchant-guide.d.ts +19 -0
  363. package/dist/project/merchant-guide.js +1 -264
  364. package/dist/project/migration.js +1 -125
  365. package/dist/project/mode-actions.js +1 -309
  366. package/dist/project/namespace.js +1 -206
  367. package/dist/project/participation-radar.js +1 -428
  368. package/dist/project/pipeline-actions.js +1 -109
  369. package/dist/project/project-store.js +1 -422
  370. package/dist/project/query.js +1 -153
  371. package/dist/project/reverse-mapping.d.ts +34 -0
  372. package/dist/project/reverse-mapping.js +1 -0
  373. package/dist/project/risk-aggregator.js +1 -295
  374. package/dist/project/rollback-policy.js +1 -290
  375. package/dist/project/semantic-assembler.js +1 -345
  376. package/dist/project/semantic-graph.d.ts +3 -5
  377. package/dist/project/semantic-graph.js +1 -292
  378. package/dist/project/stage-gate.js +1 -369
  379. package/dist/project/substep-trace.js +1 -332
  380. package/dist/project/task-tracker.js +1 -78
  381. package/dist/project/workflow-design-assessment.d.ts +24 -0
  382. package/dist/project/workflow-design-assessment.js +1 -0
  383. package/dist/role/derivation.d.ts +18 -0
  384. package/dist/role/derivation.js +1 -0
  385. package/dist/role/index.d.ts +5 -0
  386. package/dist/role/index.js +1 -0
  387. package/dist/role/model.d.ts +8 -0
  388. package/dist/role/model.js +1 -0
  389. package/dist/role/resolution.d.ts +11 -0
  390. package/dist/role/resolution.js +1 -0
  391. package/dist/role/types.d.ts +11 -0
  392. package/dist/role/types.js +1 -0
  393. package/dist/rules.js +1 -52
  394. package/dist/safety/confirm-gate.d.ts +1 -1
  395. package/dist/safety/confirm-gate.js +1 -88
  396. package/dist/safety/index.js +1 -3
  397. package/dist/safety/preview.js +1 -52
  398. package/dist/schema/call/allocation.d.ts +186 -1385
  399. package/dist/schema/call/allocation.js +1 -34
  400. package/dist/schema/call/arbitration.d.ts +272 -1871
  401. package/dist/schema/call/arbitration.js +1 -113
  402. package/dist/schema/call/base.d.ts +1831 -9076
  403. package/dist/schema/call/base.js +1 -370
  404. package/dist/schema/call/bridge.d.ts +911 -3171
  405. package/dist/schema/call/bridge.js +1 -458
  406. package/dist/schema/call/contact.d.ts +135 -931
  407. package/dist/schema/call/contact.js +1 -37
  408. package/dist/schema/call/demand.d.ts +164 -1194
  409. package/dist/schema/call/demand.js +1 -47
  410. package/dist/schema/call/guard.d.ts +298 -1140
  411. package/dist/schema/call/guard.js +1 -161
  412. package/dist/schema/call/handler.js +1 -322
  413. package/dist/schema/call/index.js +1 -20
  414. package/dist/schema/call/machine.d.ts +459 -5403
  415. package/dist/schema/call/machine.js +1 -193
  416. package/dist/schema/call/order.d.ts +137 -844
  417. package/dist/schema/call/order.js +1 -35
  418. package/dist/schema/call/payment.d.ts +74 -561
  419. package/dist/schema/call/payment.js +1 -37
  420. package/dist/schema/call/permission-handler.js +1 -54
  421. package/dist/schema/call/permission.d.ts +335 -2791
  422. package/dist/schema/call/permission.js +1 -105
  423. package/dist/schema/call/personal.d.ts +227 -1814
  424. package/dist/schema/call/personal.js +1 -78
  425. package/dist/schema/call/progress.d.ts +140 -843
  426. package/dist/schema/call/progress.js +1 -47
  427. package/dist/schema/call/proof.d.ts +42 -258
  428. package/dist/schema/call/proof.js +1 -33
  429. package/dist/schema/call/repository.d.ts +324 -2222
  430. package/dist/schema/call/repository.js +1 -77
  431. package/dist/schema/call/reward.d.ts +153 -1183
  432. package/dist/schema/call/reward.js +1 -30
  433. package/dist/schema/call/semantic.js +1 -1679
  434. package/dist/schema/call/service.d.ts +376 -3431
  435. package/dist/schema/call/service.js +1 -184
  436. package/dist/schema/call/treasury.d.ts +252 -2158
  437. package/dist/schema/call/treasury.js +1 -71
  438. package/dist/schema/common/index.d.ts +222 -697
  439. package/dist/schema/common/index.js +1 -407
  440. package/dist/schema/config/index.d.ts +18 -161
  441. package/dist/schema/config/index.js +1 -68
  442. package/dist/schema/employee/index.d.ts +99 -0
  443. package/dist/schema/employee/index.js +1 -0
  444. package/dist/schema/evaluation/index.d.ts +1062 -3748
  445. package/dist/schema/evaluation/index.js +1 -356
  446. package/dist/schema/index.d.ts +3 -0
  447. package/dist/schema/index.js +1 -17
  448. package/dist/schema/industry-pack/index.d.ts +132 -0
  449. package/dist/schema/industry-pack/index.js +1 -0
  450. package/dist/schema/intent-radar/index.d.ts +92 -245
  451. package/dist/schema/intent-radar/index.js +1 -89
  452. package/dist/schema/local/index.d.ts +2045 -18080
  453. package/dist/schema/local/index.js +1 -927
  454. package/dist/schema/local/wip.d.ts +61 -651
  455. package/dist/schema/local/wip.js +1 -187
  456. package/dist/schema/messenger/index.d.ts +949 -5557
  457. package/dist/schema/messenger/index.js +1 -475
  458. package/dist/schema/operations.d.ts +2969 -26518
  459. package/dist/schema/operations.js +1 -520
  460. package/dist/schema/persona/index.d.ts +469 -1820
  461. package/dist/schema/persona/index.js +1 -148
  462. package/dist/schema/project/index.d.ts +1027 -8408
  463. package/dist/schema/project/index.js +1 -2057
  464. package/dist/schema/query/index.d.ts +12041 -75261
  465. package/dist/schema/query/index.js +1 -1646
  466. package/dist/schema/schema-query/index.d.ts +35 -98
  467. package/dist/schema/schema-query/index.js +1 -104
  468. package/dist/schema/schema-version.js +1 -76
  469. package/dist/schema/task-status.d.ts +26 -132
  470. package/dist/schema/task-status.js +1 -36
  471. package/dist/schema/trust/index.d.ts +194 -1290
  472. package/dist/schema/trust/index.js +1 -314
  473. package/dist/schema/utils/guard-parser.js +1 -419
  474. package/dist/schema/utils/guard-query-utils.js +1 -46
  475. package/dist/schema/utils/node-parser.js +1 -369
  476. package/dist/schema/utils/object-type-utils.js +1 -35
  477. package/dist/schema/utils/permission-index-utils.js +1 -7
  478. package/dist/schema/utils/permission-machine-check.js +1 -121
  479. package/dist/schema/utils/skills-recommendation.d.ts +1 -0
  480. package/dist/schema/utils/skills-recommendation.js +1 -77
  481. package/dist/schema/workspace/index.d.ts +69 -0
  482. package/dist/schema/workspace/index.js +1 -0
  483. package/dist/schema-query-impl/index.js +1 -0
  484. package/dist/schemas/account_operation.output.json +3147 -1652
  485. package/dist/schemas/account_operation.schema.json +225 -218
  486. package/dist/schemas/bridge_operation.output.json +1168 -650
  487. package/dist/schemas/bridge_operation.schema.json +736 -504
  488. package/dist/schemas/config_operation.output.json +185 -179
  489. package/dist/schemas/config_operation.schema.json +21 -26
  490. package/dist/schemas/employee_operation.output.json +207 -0
  491. package/dist/schemas/employee_operation.schema.json +176 -0
  492. package/dist/schemas/evaluation_operation.output.json +2329 -557
  493. package/dist/schemas/evaluation_operation.schema.json +2939 -720
  494. package/dist/schemas/guard2file.output.json +58 -64
  495. package/dist/schemas/guard2file.schema.json +79 -81
  496. package/dist/schemas/index.json +29 -11
  497. package/dist/schemas/industry_pack_operation.output.json +594 -0
  498. package/dist/schemas/industry_pack_operation.schema.json +55 -0
  499. package/dist/schemas/intent_radar.output.json +275 -200
  500. package/dist/schemas/intent_radar.schema.json +124 -123
  501. package/dist/schemas/local_info_operation.output.json +1174 -657
  502. package/dist/schemas/local_info_operation.schema.json +119 -125
  503. package/dist/schemas/local_mark_operation.output.json +1239 -689
  504. package/dist/schemas/local_mark_operation.schema.json +91 -96
  505. package/dist/schemas/machineNode2file.output.json +63 -69
  506. package/dist/schemas/machineNode2file.schema.json +79 -81
  507. package/dist/schemas/messenger_operation.output.json +2722 -1528
  508. package/dist/schemas/messenger_operation.schema.json +1482 -1264
  509. package/dist/schemas/onchain_events.output.json +2590 -975
  510. package/dist/schemas/onchain_events.schema.json +117 -99
  511. package/dist/schemas/onchain_operations.output.json +3957 -2309
  512. package/dist/schemas/onchain_operations.schema.json +20799 -9285
  513. package/dist/schemas/onchain_operations_allocation.schema.json +172 -108
  514. package/dist/schemas/onchain_operations_arbitration.schema.json +233 -146
  515. package/dist/schemas/onchain_operations_contact.schema.json +129 -90
  516. package/dist/schemas/onchain_operations_demand.schema.json +170 -112
  517. package/dist/schemas/onchain_operations_gen_passport.schema.json +61 -646
  518. package/dist/schemas/onchain_operations_gen_proof.schema.json +40 -172
  519. package/dist/schemas/onchain_operations_guard.schema.json +3765 -294
  520. package/dist/schemas/onchain_operations_machine.schema.json +537 -164
  521. package/dist/schemas/onchain_operations_order.schema.json +126 -96
  522. package/dist/schemas/onchain_operations_payment.schema.json +82 -67
  523. package/dist/schemas/onchain_operations_permission.schema.json +331 -93
  524. package/dist/schemas/onchain_operations_personal.schema.json +636 -96
  525. package/dist/schemas/onchain_operations_progress.schema.json +125 -92
  526. package/dist/schemas/onchain_operations_proof.schema.json +76 -69
  527. package/dist/schemas/onchain_operations_repository.schema.json +636 -249
  528. package/dist/schemas/onchain_operations_reward.schema.json +218 -108
  529. package/dist/schemas/onchain_operations_service.schema.json +679 -221
  530. package/dist/schemas/onchain_operations_treasury.schema.json +401 -135
  531. package/dist/schemas/onchain_table_data.output.json +6018 -2430
  532. package/dist/schemas/onchain_table_data.schema.json +544 -430
  533. package/dist/schemas/persona_operation.output.json +1568 -265
  534. package/dist/schemas/persona_operation.schema.json +346 -202
  535. package/dist/schemas/project_operation.output.json +6957 -5147
  536. package/dist/schemas/project_operation.schema.json +1050 -1020
  537. package/dist/schemas/query_task_status.output.json +195 -99
  538. package/dist/schemas/query_task_status.schema.json +12 -18
  539. package/dist/schemas/query_toolkit.output.json +18870 -14566
  540. package/dist/schemas/query_toolkit.schema.json +614 -522
  541. package/dist/schemas/schema_query.output.json +127 -129
  542. package/dist/schemas/schema_query.schema.json +64 -69
  543. package/dist/schemas/trust_score.output.json +678 -587
  544. package/dist/schemas/trust_score.schema.json +289 -277
  545. package/dist/schemas/wip_file.output.json +116 -124
  546. package/dist/schemas/wip_file.schema.json +142 -143
  547. package/dist/schemas/workspace_operation.output.json +277 -0
  548. package/dist/schemas/workspace_operation.schema.json +45 -0
  549. package/dist/schemas/wowok_buildin_info.output.json +1693 -723
  550. package/dist/schemas/wowok_buildin_info.schema.json +576 -512
  551. package/dist/telemetry/index.js +1 -112
  552. package/dist/telemetry/redact.js +1 -23
  553. package/dist/telemetry/storage.js +1 -80
  554. package/dist/tools/handlers/bridge.d.ts +8 -1
  555. package/dist/tools/handlers/bridge.js +1 -1
  556. package/dist/tools/handlers/config.js +1 -74
  557. package/dist/tools/handlers/employee.d.ts +2 -0
  558. package/dist/tools/handlers/employee.js +1 -0
  559. package/dist/tools/handlers/evaluation.js +1 -123
  560. package/dist/tools/handlers/file-export.js +1 -90
  561. package/dist/tools/handlers/industry-pack.d.ts +2 -0
  562. package/dist/tools/handlers/industry-pack.js +1 -0
  563. package/dist/tools/handlers/intent-radar.js +1 -76
  564. package/dist/tools/handlers/local.js +1 -53
  565. package/dist/tools/handlers/messenger.js +1 -188
  566. package/dist/tools/handlers/onchain.js +1 -1180
  567. package/dist/tools/handlers/persona.js +1 -89
  568. package/dist/tools/handlers/project.js +1 -211
  569. package/dist/tools/handlers/query.js +1 -434
  570. package/dist/tools/handlers/schema-query.js +1 -176
  571. package/dist/tools/handlers/task-status.js +1 -26
  572. package/dist/tools/handlers/trust.js +1 -380
  573. package/dist/tools/handlers/wip.js +1 -90
  574. package/dist/tools/handlers/workspace.d.ts +2 -0
  575. package/dist/tools/handlers/workspace.js +1 -0
  576. package/dist/tools/index.d.ts +2 -1
  577. package/dist/tools/index.js +1 -1382
  578. package/dist/tools/retry.js +1 -85
  579. package/dist/tools/rules-hook.d.ts +1 -1
  580. package/dist/tools/rules-hook.js +1 -23
  581. package/dist/tools/shared.d.ts +1 -1
  582. package/dist/tools/shared.js +1 -130
  583. package/dist/tools/types.d.ts +2 -1
  584. package/dist/tools/types.js +1 -1
  585. package/dist/tools/upgrade-check.d.ts +19 -0
  586. package/dist/tools/upgrade-check.js +1 -0
  587. package/dist/tools/wip-deploy-assist.js +1 -306
  588. package/dist/tools/wrap.js +1 -500
  589. package/package.json +7 -6
  590. package/dist/knowledge/arbitration-trust.d.ts +0 -24
  591. package/dist/knowledge/arbitration-trust.js +0 -117
  592. package/dist/schema/call/bridge-handler.d.ts +0 -8
  593. package/dist/schema/call/bridge-handler.js +0 -265
  594. package/dist/schema/sync-layer4.d.ts +0 -21
  595. package/dist/schema/sync-layer4.js +0 -286
  596. package/dist/schema-query/index.js +0 -810
  597. /package/dist/{schema-query → schema-query-impl}/index.d.ts +0 -0
@@ -1,970 +1 @@
1
- export const ALLOCATION_TEMPLATES = [
2
- {
3
- id: "T-A-01",
4
- name: "Single Rate 100% to Treasury",
5
- description: "Simplest allocation — single Allocator, single Rate=10000 sharing to one Treasury/personal address",
6
- applicable_scenes: ["allocation_merchant_full_payment"],
7
- industry_tags: ["universal", "retail", "service"],
8
- params: [
9
- {
10
- name: "allocation_name",
11
- type: "string",
12
- description: "Local name for the new Allocation object",
13
- required: true,
14
- },
15
- {
16
- name: "coin_type",
17
- type: "string",
18
- description: "Coin<T> type string (e.g. '0x2::wow::WOW')",
19
- required: true,
20
- },
21
- {
22
- name: "recipient_address",
23
- type: "address",
24
- description: "Treasury or personal wallet address to receive 100%",
25
- required: true,
26
- },
27
- {
28
- name: "guard_address",
29
- type: "address",
30
- description: "Guard object address (verifies order completion)",
31
- required: true,
32
- },
33
- {
34
- name: "description",
35
- type: "string",
36
- description: "Allocation description",
37
- required: false,
38
- default: "Single Rate 100% allocation",
39
- },
40
- ],
41
- body: (p) => ({
42
- object: { name: p.allocation_name, type_parameter: p.coin_type },
43
- allocators: {
44
- description: p.description ?? "Single Rate 100% allocation",
45
- threshold: "0",
46
- allocators: [
47
- {
48
- guard: p.guard_address,
49
- sharing: [
50
- {
51
- who: { Entity: p.recipient_address },
52
- sharing: "10000",
53
- mode: "Rate",
54
- },
55
- ],
56
- max: null,
57
- },
58
- ],
59
- },
60
- coin: { name: `${p.allocation_name}_coin` },
61
- payment_info: {},
62
- }),
63
- notes: [
64
- "Simplest configuration — no multi-party coordination",
65
- "Guard only needs to verify order status, no complex conditions",
66
- "Suitable for solo merchants or single-treasury services",
67
- ],
68
- },
69
- {
70
- id: "T-A-02",
71
- name: "Standard 3-way Rate split",
72
- description: "Three-way split: merchant / platform / logistics. Pure Rate mode, sum(rates) MUST equal 10000",
73
- applicable_scenes: ["allocation_standard_three_way_split"],
74
- industry_tags: ["retail", "ecommerce", "logistics"],
75
- params: [
76
- {
77
- name: "allocation_name",
78
- type: "string",
79
- description: "Local name for the new Allocation object",
80
- required: true,
81
- },
82
- {
83
- name: "coin_type",
84
- type: "string",
85
- description: "Coin<T> type string",
86
- required: true,
87
- },
88
- {
89
- name: "merchant_treasury",
90
- type: "address",
91
- description: "Merchant Treasury address",
92
- required: true,
93
- },
94
- {
95
- name: "platform_treasury",
96
- type: "address",
97
- description: "Platform Treasury address",
98
- required: true,
99
- },
100
- {
101
- name: "logistics_treasury",
102
- type: "address",
103
- description: "Logistics Treasury address (set to platform_treasury if N/A)",
104
- required: true,
105
- },
106
- {
107
- name: "merchant_rate",
108
- type: "number",
109
- description: "Merchant rate in basis points (e.g. 8000 = 80%)",
110
- required: true,
111
- default: 8000,
112
- },
113
- {
114
- name: "platform_rate",
115
- type: "number",
116
- description: "Platform rate in basis points (e.g. 1000 = 10%)",
117
- required: true,
118
- default: 1000,
119
- },
120
- {
121
- name: "logistics_rate",
122
- type: "number",
123
- description: "Logistics rate in basis points (e.g. 1000 = 10%)",
124
- required: true,
125
- default: 1000,
126
- },
127
- {
128
- name: "guard_address",
129
- type: "address",
130
- description: "Guard object address (verifies order completion + service binding)",
131
- required: true,
132
- },
133
- ],
134
- body: (p) => {
135
- const merchantRate = Number(p.merchant_rate);
136
- const platformRate = Number(p.platform_rate);
137
- const logisticsRate = Number(p.logistics_rate);
138
- const total = merchantRate + platformRate + logisticsRate;
139
- if (total !== 10000) {
140
- throw new Error(`T-A-02: sum(rates) MUST equal 10000 (RATE_TOTAL_FULL), got ${total} ` +
141
- `(merchant=${merchantRate} + platform=${platformRate} + logistics=${logisticsRate})`);
142
- }
143
- return {
144
- object: { name: p.allocation_name, type_parameter: p.coin_type },
145
- allocators: {
146
- description: `3-way split: merchant ${merchantRate}/10000, platform ${platformRate}/10000, logistics ${logisticsRate}/10000`,
147
- threshold: "0",
148
- allocators: [
149
- {
150
- guard: p.guard_address,
151
- sharing: [
152
- { who: { Entity: p.merchant_treasury }, sharing: String(merchantRate), mode: "Rate" },
153
- { who: { Entity: p.platform_treasury }, sharing: String(platformRate), mode: "Rate" },
154
- { who: { Entity: p.logistics_treasury }, sharing: String(logisticsRate), mode: "Rate" },
155
- ],
156
- max: null,
157
- },
158
- ],
159
- },
160
- coin: { name: `${p.allocation_name}_coin` },
161
- payment_info: {},
162
- };
163
- },
164
- notes: [
165
- "F-A-05: sum(rates) MUST equal 10000 (pure Rate mode, no Surplus)",
166
- "Treasury Permission should match Service Permission (R-A-3-02)",
167
- "Guard should verify order.service binding (query 1563) to prevent cross-project bypass",
168
- ],
169
- },
170
- {
171
- id: "T-A-03",
172
- name: "Refund-first + Surplus-to-merchant (Amount + Surplus hybrid)",
173
- description: "Single Allocator with 2 sharing items: Amount=refund_value to customer, Surplus to merchant",
174
- applicable_scenes: ["allocation_refund_first_surplus_to_merchant"],
175
- industry_tags: ["retail", "refund", "customer_protection"],
176
- params: [
177
- {
178
- name: "allocation_name",
179
- type: "string",
180
- description: "Local name for the new Allocation object",
181
- required: true,
182
- },
183
- {
184
- name: "coin_type",
185
- type: "string",
186
- description: "Coin<T> type string",
187
- required: true,
188
- },
189
- {
190
- name: "customer_address",
191
- type: "address",
192
- description: "Customer address to receive refund Amount",
193
- required: true,
194
- },
195
- {
196
- name: "merchant_treasury",
197
- type: "address",
198
- description: "Merchant Treasury address to receive Surplus",
199
- required: true,
200
- },
201
- {
202
- name: "refund_amount",
203
- type: "number",
204
- description: "Refund amount in smallest coin unit (e.g. MIST for WOW)",
205
- required: true,
206
- },
207
- {
208
- name: "guard_address",
209
- type: "address",
210
- description: "Guard object address (verifies refund approval)",
211
- required: true,
212
- },
213
- {
214
- name: "description",
215
- type: "string",
216
- description: "Allocation description",
217
- required: false,
218
- default: "Refund-first + Surplus-to-merchant",
219
- },
220
- ],
221
- body: (p) => {
222
- const refundAmount = Number(p.refund_amount);
223
- if (refundAmount <= 0) {
224
- throw new Error(`T-A-03: refund_amount MUST be > 0, got ${refundAmount}`);
225
- }
226
- return {
227
- object: { name: p.allocation_name, type_parameter: p.coin_type },
228
- allocators: {
229
- description: p.description ?? "Refund-first + Surplus-to-merchant",
230
- threshold: String(refundAmount),
231
- allocators: [
232
- {
233
- guard: p.guard_address,
234
- sharing: [
235
- {
236
- who: { Entity: p.customer_address },
237
- sharing: String(refundAmount),
238
- mode: "Amount",
239
- },
240
- {
241
- who: { Entity: p.merchant_treasury },
242
- sharing: "0",
243
- mode: "Surplus",
244
- },
245
- ],
246
- max: null,
247
- },
248
- ],
249
- },
250
- coin: { name: `${p.allocation_name}_coin` },
251
- payment_info: {},
252
- };
253
- },
254
- notes: [
255
- "F-A-04: at most 1 Surplus per Allocator (✓ single Surplus here)",
256
- "F-A-07: threshold = refundAmount (ensure balance covers Amount)",
257
- "fix is cached as refundAmount at allocator_add time",
258
- "Guard must verify customer refund eligibility (e.g. order status = Refunded)",
259
- ],
260
- },
261
- {
262
- id: "T-A-04",
263
- name: "Treasury + Personal alternative (caller-specified guard, 2 Allocators)",
264
- description: "2 Allocators as alternative strategies: caller selects Treasury or Personal wallet via alloc_by_guard (hard verification per call)",
265
- applicable_scenes: ["allocation_treasury_personal_alternatives"],
266
- industry_tags: ["universal", "alternative", "treasury"],
267
- params: [
268
- {
269
- name: "allocation_name",
270
- type: "string",
271
- description: "Local name for the new Allocation object",
272
- required: true,
273
- },
274
- {
275
- name: "coin_type",
276
- type: "string",
277
- description: "Coin<T> type string",
278
- required: true,
279
- },
280
- {
281
- name: "treasury_address",
282
- type: "address",
283
- description: "Treasury address (primary recipient)",
284
- required: true,
285
- },
286
- {
287
- name: "personal_address",
288
- type: "address",
289
- description: "Personal wallet address (alternative recipient)",
290
- required: true,
291
- },
292
- {
293
- name: "treasury_guard",
294
- type: "address",
295
- description: "Guard for Treasury path (verifies treasury operational)",
296
- required: true,
297
- },
298
- {
299
- name: "personal_guard",
300
- type: "address",
301
- description: "Guard for Personal path (verifies personal wallet active) — MUST differ from treasury_guard",
302
- required: true,
303
- },
304
- ],
305
- body: (p) => {
306
- if (p.treasury_guard === p.personal_guard) {
307
- throw new Error(`T-A-04: treasury_guard and personal_guard MUST be different addresses (F-A-14: allocators[].guard must be unique)`);
308
- }
309
- return {
310
- object: { name: p.allocation_name, type_parameter: p.coin_type },
311
- allocators: {
312
- description: "Treasury / Personal alternative (caller-specified guard)",
313
- threshold: "0",
314
- allocators: [
315
- {
316
- guard: p.treasury_guard,
317
- sharing: [
318
- { who: { Entity: p.treasury_address }, sharing: "10000", mode: "Rate" },
319
- ],
320
- max: null,
321
- },
322
- {
323
- guard: p.personal_guard,
324
- sharing: [
325
- { who: { Entity: p.personal_address }, sharing: "10000", mode: "Rate" },
326
- ],
327
- max: null,
328
- },
329
- ],
330
- },
331
- coin: { name: `${p.allocation_name}_coin` },
332
- payment_info: {},
333
- };
334
- },
335
- notes: [
336
- "F-A-14: treasury_guard != personal_guard (Allocator Guards must be unique)",
337
- "caller-specified guard: alloc_by_guard explicitly selects an Allocator; passport::result_for_guard hard-verifies (failure aborts E_VERIFY_FAILED)",
338
- "No auto-fallback: on verification failure the caller must switch guard and retry",
339
- "R-A-4-02: if the caller's submitted Passport satisfies both Guards simultaneously, the caller may freely choose between the two paths (mutual exclusion is a design clarity recommendation, not a correctness requirement)",
340
- ],
341
- },
342
- {
343
- id: "T-A-05",
344
- name: "Tiered by order amount (mutually exclusive Guard conditions)",
345
- description: "2 Allocators triggered by mutually exclusive Guard conditions (small order vs large order)",
346
- applicable_scenes: ["allocation_tiered_by_order_amount"],
347
- industry_tags: ["retail", "tiered_pricing", "volume_discount"],
348
- params: [
349
- {
350
- name: "allocation_name",
351
- type: "string",
352
- description: "Local name for the new Allocation object",
353
- required: true,
354
- },
355
- {
356
- name: "coin_type",
357
- type: "string",
358
- description: "Coin<T> type string",
359
- required: true,
360
- },
361
- {
362
- name: "merchant_treasury",
363
- type: "address",
364
- description: "Merchant Treasury address",
365
- required: true,
366
- },
367
- {
368
- name: "platform_treasury",
369
- type: "address",
370
- description: "Platform Treasury address",
371
- required: true,
372
- },
373
- {
374
- name: "small_order_guard",
375
- type: "address",
376
- description: "Guard verifying order.amount < threshold (small order path)",
377
- required: true,
378
- },
379
- {
380
- name: "large_order_guard",
381
- type: "address",
382
- description: "Guard verifying order.amount >= threshold (large order path) — MUST differ from small_order_guard",
383
- required: true,
384
- },
385
- {
386
- name: "small_order_merchant_rate",
387
- type: "number",
388
- description: "Merchant rate for small orders (e.g. 10000 = 100%)",
389
- required: true,
390
- default: 10000,
391
- },
392
- {
393
- name: "large_order_merchant_rate",
394
- type: "number",
395
- description: "Merchant rate for large orders (e.g. 8000 = 80%)",
396
- required: true,
397
- default: 8000,
398
- },
399
- {
400
- name: "large_order_platform_rate",
401
- type: "number",
402
- description: "Platform rate for large orders (e.g. 2000 = 20%)",
403
- required: true,
404
- default: 2000,
405
- },
406
- ],
407
- body: (p) => {
408
- if (p.small_order_guard === p.large_order_guard) {
409
- throw new Error(`T-A-05: small_order_guard and large_order_guard MUST be different addresses (F-A-14)`);
410
- }
411
- const smallRate = Number(p.small_order_merchant_rate);
412
- if (smallRate !== 10000) {
413
- throw new Error(`T-A-05: small_order_merchant_rate MUST equal 10000 (pure Rate, no Surplus in this Allocator), got ${smallRate}`);
414
- }
415
- const largeMerchantRate = Number(p.large_order_merchant_rate);
416
- const largePlatformRate = Number(p.large_order_platform_rate);
417
- const largeTotal = largeMerchantRate + largePlatformRate;
418
- if (largeTotal !== 10000) {
419
- throw new Error(`T-A-05: large_order rates MUST sum to 10000, got ${largeTotal} (merchant=${largeMerchantRate} + platform=${largePlatformRate})`);
420
- }
421
- return {
422
- object: { name: p.allocation_name, type_parameter: p.coin_type },
423
- allocators: {
424
- description: "Tiered by order amount: small=100% merchant, large=80/20 merchant/platform",
425
- threshold: "0",
426
- allocators: [
427
- {
428
- guard: p.small_order_guard,
429
- sharing: [
430
- { who: { Entity: p.merchant_treasury }, sharing: "10000", mode: "Rate" },
431
- ],
432
- max: null,
433
- },
434
- {
435
- guard: p.large_order_guard,
436
- sharing: [
437
- { who: { Entity: p.merchant_treasury }, sharing: String(largeMerchantRate), mode: "Rate" },
438
- { who: { Entity: p.platform_treasury }, sharing: String(largePlatformRate), mode: "Rate" },
439
- ],
440
- max: null,
441
- },
442
- ],
443
- },
444
- coin: { name: `${p.allocation_name}_coin` },
445
- payment_info: {},
446
- };
447
- },
448
- notes: [
449
- "Guard conditions MUST be mutually exclusive (R-A-4-02)",
450
- "Sequence-sensitive: strict condition (small order) first, relaxed condition (large order) last",
451
- "Guard queries order.amount (query 1561) to determine which Allocator fires",
452
- "If neither Guard passes, funds are silently locked (R-A-4-02)",
453
- ],
454
- },
455
- {
456
- id: "T-A-06",
457
- name: "Dynamic recipient via GuardIdentifier (referrer from Passport)",
458
- description: "Single Allocator with 3 Rate sharing items, one recipient resolved from customer's Passport table[0]",
459
- applicable_scenes: ["allocation_dynamic_recipient"],
460
- industry_tags: ["referral", "affiliate", "marketing"],
461
- params: [
462
- {
463
- name: "allocation_name",
464
- type: "string",
465
- description: "Local name for the new Allocation object",
466
- required: true,
467
- },
468
- {
469
- name: "coin_type",
470
- type: "string",
471
- description: "Coin<T> type string",
472
- required: true,
473
- },
474
- {
475
- name: "merchant_treasury",
476
- type: "address",
477
- description: "Merchant Treasury address",
478
- required: true,
479
- },
480
- {
481
- name: "platform_treasury",
482
- type: "address",
483
- description: "Platform Treasury address",
484
- required: true,
485
- },
486
- {
487
- name: "guard_address",
488
- type: "address",
489
- description: "Guard object address (must be configured with identifier=0 as address type)",
490
- required: true,
491
- },
492
- {
493
- name: "passport_identifier",
494
- type: "number",
495
- description: "Passport table identifier (u8, 0-255) — customer submits referrer address at this slot",
496
- required: true,
497
- default: 0,
498
- },
499
- {
500
- name: "merchant_rate",
501
- type: "number",
502
- description: "Merchant rate in basis points (e.g. 8000 = 80%)",
503
- required: true,
504
- default: 8000,
505
- },
506
- {
507
- name: "platform_rate",
508
- type: "number",
509
- description: "Platform rate in basis points (e.g. 1000 = 10%)",
510
- required: true,
511
- default: 1000,
512
- },
513
- {
514
- name: "referrer_rate",
515
- type: "number",
516
- description: "Referrer rate in basis points (e.g. 1000 = 10%)",
517
- required: true,
518
- default: 1000,
519
- },
520
- ],
521
- body: (p) => {
522
- const merchantRate = Number(p.merchant_rate);
523
- const platformRate = Number(p.platform_rate);
524
- const referrerRate = Number(p.referrer_rate);
525
- const total = merchantRate + platformRate + referrerRate;
526
- if (total !== 10000) {
527
- throw new Error(`T-A-06: sum(rates) MUST equal 10000, got ${total} (merchant=${merchantRate} + platform=${platformRate} + referrer=${referrerRate})`);
528
- }
529
- const identifier = Number(p.passport_identifier);
530
- if (identifier < 0 || identifier > 255) {
531
- throw new Error(`T-A-06: passport_identifier MUST be u8 (0-255), got ${identifier}`);
532
- }
533
- return {
534
- object: { name: p.allocation_name, type_parameter: p.coin_type },
535
- allocators: {
536
- description: `Dynamic recipient: merchant ${merchantRate}/10000, platform ${platformRate}/10000, referrer ${referrerRate}/10000 (from Passport identifier=${identifier})`,
537
- threshold: "0",
538
- allocators: [
539
- {
540
- guard: p.guard_address,
541
- sharing: [
542
- { who: { Entity: p.merchant_treasury }, sharing: String(merchantRate), mode: "Rate" },
543
- { who: { Entity: p.platform_treasury }, sharing: String(platformRate), mode: "Rate" },
544
- { who: { GuardIdentifier: identifier }, sharing: String(referrerRate), mode: "Rate" },
545
- ],
546
- max: null,
547
- },
548
- ],
549
- },
550
- coin: { name: `${p.allocation_name}_coin` },
551
- payment_info: {},
552
- };
553
- },
554
- notes: [
555
- "F-A-13: Passport table[identifier] MUST be address type (else ERECIPIENT_IDENTIFIER_NOT_ADDRESS=1)",
556
- "Guard.is_identifier_address(guard, identifier) MUST be true at allocator_add time (else allocator_add fails)",
557
- "Customer must submit Passport with referrer address at the specified identifier slot",
558
- "Guard should verify Passport completeness before alloc() executes",
559
- ],
560
- },
561
- {
562
- id: "T-A-07",
563
- name: "Refund to Order (100% to Order object, not personal wallet)",
564
- description: "Single Allocator, 1 Rate=10000 sharing to Order object address. Refund funds return to Order for downstream handling.",
565
- applicable_scenes: ["allocation_refund_to_order"],
566
- industry_tags: ["refund", "customer_protection", "order_lifecycle"],
567
- params: [
568
- {
569
- name: "allocation_name",
570
- type: "string",
571
- description: "Local name for the new Allocation object",
572
- required: true,
573
- },
574
- {
575
- name: "coin_type",
576
- type: "string",
577
- description: "Coin<T> type string",
578
- required: true,
579
- },
580
- {
581
- name: "order_address",
582
- type: "address",
583
- description: "Order object address (NOT personal wallet) — funds flow back to Order",
584
- required: true,
585
- },
586
- {
587
- name: "guard_address",
588
- type: "address",
589
- description: "Guard object address (verifies customer refund request and eligibility)",
590
- required: true,
591
- },
592
- ],
593
- body: (p) => ({
594
- object: { name: p.allocation_name, type_parameter: p.coin_type },
595
- allocators: {
596
- description: "Refund to Order (100% to Order object for downstream handling)",
597
- threshold: "0",
598
- allocators: [
599
- {
600
- guard: p.guard_address,
601
- sharing: [
602
- {
603
- who: { Entity: p.order_address },
604
- sharing: "10000",
605
- mode: "Rate",
606
- },
607
- ],
608
- max: null,
609
- },
610
- ],
611
- },
612
- coin: { name: `${p.allocation_name}_coin` },
613
- payment_info: {},
614
- }),
615
- notes: [
616
- "⚠️ who=Entity MUST be Order object address (not personal address)",
617
- "Customer due-diligence rewards this configuration (8-point weight in customer/risk-assessment.ts)",
618
- "Refund funds return to Order for downstream handling (e.g. customer withdrawal)",
619
- "Guard must verify customer refund eligibility (e.g. dispute resolved in customer's favor)",
620
- ],
621
- },
622
- {
623
- id: "T-A-08",
624
- name: "Arbitration fees split (arbitrator 80% / platform 20%)",
625
- description: "Single Allocator, 2 Rate sharing items. Triggered by Arbitration.fees_alloc (permission 365) or fees_alloc_with_passport.",
626
- applicable_scenes: ["allocation_arbitration_fees"],
627
- industry_tags: ["arbitration", "dispute", "fees"],
628
- params: [
629
- {
630
- name: "allocation_name",
631
- type: "string",
632
- description: "Local name for the new Allocation object",
633
- required: true,
634
- },
635
- {
636
- name: "coin_type",
637
- type: "string",
638
- description: "Coin<T> type string (must match Arbitration fee Coin type)",
639
- required: true,
640
- },
641
- {
642
- name: "arbitrator_treasury",
643
- type: "address",
644
- description: "Arbitrator Treasury address",
645
- required: true,
646
- },
647
- {
648
- name: "platform_treasury",
649
- type: "address",
650
- description: "Platform Treasury address",
651
- required: true,
652
- },
653
- {
654
- name: "arbitrator_rate",
655
- type: "number",
656
- description: "Arbitrator rate in basis points (e.g. 8000 = 80%)",
657
- required: true,
658
- default: 8000,
659
- },
660
- {
661
- name: "platform_rate",
662
- type: "number",
663
- description: "Platform rate in basis points (e.g. 2000 = 20%)",
664
- required: true,
665
- default: 2000,
666
- },
667
- {
668
- name: "guard_address",
669
- type: "address",
670
- description: "Guard object address (verifies Arbitration ruling finalized)",
671
- required: true,
672
- },
673
- ],
674
- body: (p) => {
675
- const arbRate = Number(p.arbitrator_rate);
676
- const platRate = Number(p.platform_rate);
677
- const total = arbRate + platRate;
678
- if (total !== 10000) {
679
- throw new Error(`T-A-08: sum(rates) MUST equal 10000, got ${total} (arbitrator=${arbRate} + platform=${platRate})`);
680
- }
681
- return {
682
- object: { name: p.allocation_name, type_parameter: p.coin_type },
683
- allocators: {
684
- description: `Arbitration fees split: arbitrator ${arbRate}/10000, platform ${platRate}/10000`,
685
- threshold: "0",
686
- allocators: [
687
- {
688
- guard: p.guard_address,
689
- sharing: [
690
- { who: { Entity: p.arbitrator_treasury }, sharing: String(arbRate), mode: "Rate" },
691
- { who: { Entity: p.platform_treasury }, sharing: String(platRate), mode: "Rate" },
692
- ],
693
- max: null,
694
- },
695
- ],
696
- },
697
- coin: { name: `${p.allocation_name}_coin` },
698
- payment_info: {},
699
- };
700
- },
701
- notes: [
702
- "Triggered by Arbitration.fees_alloc (permission ARBITRATION_FEES_ALLOC=365) or fees_alloc_with_passport",
703
- "Independent from Service-order Allocation (this Allocation is not bound to Order)",
704
- "payment_info typically reuses Arbitration's payment_info",
705
- "Caller MUST hold ARBITRATION_FEES_ALLOC=365 permission",
706
- ],
707
- },
708
- {
709
- id: "T-A-09",
710
- name: "Standalone periodic split (investment dividends / shared income)",
711
- description: "Standalone Allocation with single Allocator, N Rate sharing items to beneficiary wallets. No Service context. Guard provides time-based or signer-based access control.",
712
- applicable_scenes: ["allocation_standalone_periodic_split"],
713
- industry_tags: ["standalone", "investment", "dividends", "shared_income"],
714
- params: [
715
- {
716
- name: "allocation_name",
717
- type: "string",
718
- description: "Local name for the new Allocation object",
719
- required: true,
720
- },
721
- {
722
- name: "coin_type",
723
- type: "string",
724
- description: "Coin<T> type string (e.g. '0x2::wow::WOW' or profit token type)",
725
- required: true,
726
- },
727
- {
728
- name: "beneficiaries",
729
- type: "address[]",
730
- description: "Array of beneficiary wallet addresses (NOT Treasury objects — standalone mode has no Service context)",
731
- required: true,
732
- },
733
- {
734
- name: "rates",
735
- type: "string[]",
736
- description: "Array of rates in basis points (e.g. ['5000','3000','2000'] = 50%/30%/20%). MUST sum to 10000.",
737
- required: true,
738
- },
739
- {
740
- name: "guard_address",
741
- type: "address",
742
- description: "Guard object address — MUST bind Signer or verify time-based trigger (R-A-3-04: standalone has no Service-layer access control)",
743
- required: true,
744
- },
745
- {
746
- name: "description",
747
- type: "string",
748
- description: "Allocation description",
749
- required: false,
750
- default: "Standalone periodic split",
751
- },
752
- ],
753
- body: (p) => {
754
- const beneficiaries = p.beneficiaries;
755
- const rates = p.rates.map(r => Number(r));
756
- if (beneficiaries.length !== rates.length) {
757
- throw new Error(`T-A-09: beneficiaries (${beneficiaries.length}) and rates (${rates.length}) MUST have equal length`);
758
- }
759
- if (beneficiaries.length === 0) {
760
- throw new Error(`T-A-09: at least 1 beneficiary required`);
761
- }
762
- if (beneficiaries.length > 100) {
763
- throw new Error(`T-A-09: beneficiaries count ${beneficiaries.length} exceeds MAX_SHARING_COUNT (100)`);
764
- }
765
- const total = rates.reduce((sum, r) => sum + r, 0);
766
- if (total !== 10000) {
767
- throw new Error(`T-A-09: sum(rates) MUST equal 10000 (RATE_TOTAL_FULL), got ${total}`);
768
- }
769
- return {
770
- object: { name: p.allocation_name, type_parameter: p.coin_type },
771
- allocators: {
772
- description: p.description ?? "Standalone periodic split",
773
- threshold: "0",
774
- allocators: [
775
- {
776
- guard: p.guard_address,
777
- sharing: beneficiaries.map((addr, i) => ({
778
- who: { Entity: addr },
779
- sharing: String(rates[i]),
780
- mode: "Rate",
781
- })),
782
- max: null,
783
- },
784
- ],
785
- },
786
- coin: { name: `${p.allocation_name}_coin` },
787
- payment_info: {},
788
- };
789
- },
790
- notes: [
791
- "Standalone mode (§0): no Service/Order/Arbitration context required",
792
- "R-A-3-04: Guard MUST bind Signer or verify time-based trigger — no Service-layer access control exists",
793
- "F-A-05: sum(rates) MUST equal 10000 (pure Rate mode, no Surplus)",
794
- "Caller lifecycle: receive() to deposit funds → alloc() to trigger distribution",
795
- "Guard should bind context(Signer)==authorized to prevent unauthorized alloc() calls",
796
- "beneficiaries are personal wallets, NOT Treasury objects (no Service context)",
797
- ],
798
- },
799
- {
800
- id: "T-A-10",
801
- name: "Standalone vesting release (time-locked multi-stage unlock)",
802
- description: "Standalone Allocation with N Allocators (default 3 stages), each triggered by a time-locked Guard. Stages 1..N-1 use Amount mode; final stage uses Surplus to drain remaining balance. No Service context.",
803
- applicable_scenes: ["allocation_standalone_vesting"],
804
- industry_tags: ["standalone", "vesting", "time_lock", "team_tokens"],
805
- params: [
806
- {
807
- name: "allocation_name",
808
- type: "string",
809
- description: "Local name for the new Allocation object",
810
- required: true,
811
- },
812
- {
813
- name: "coin_type",
814
- type: "string",
815
- description: "Coin<T> type string (vested asset, e.g. locked team tokens)",
816
- required: true,
817
- },
818
- {
819
- name: "beneficiary_address",
820
- type: "address",
821
- description: "Single beneficiary wallet address (vesting recipient)",
822
- required: true,
823
- },
824
- {
825
- name: "stage_1_guard",
826
- type: "address",
827
- description: "Guard for stage 1 (verifies context(Clock).timestamp >= stage_1_unlock)",
828
- required: true,
829
- },
830
- {
831
- name: "stage_1_amount",
832
- type: "number",
833
- description: "Amount to release at stage 1 (smallest coin unit, e.g. MIST)",
834
- required: true,
835
- },
836
- {
837
- name: "stage_2_guard",
838
- type: "address",
839
- description: "Guard for stage 2 (verifies context(Clock).timestamp >= stage_2_unlock) — MUST differ from stage_1_guard",
840
- required: true,
841
- },
842
- {
843
- name: "stage_2_amount",
844
- type: "number",
845
- description: "Amount to release at stage 2 (smallest coin unit)",
846
- required: true,
847
- },
848
- {
849
- name: "stage_3_guard",
850
- type: "address",
851
- description: "Guard for stage 3 (final stage, uses Surplus to drain remaining balance) — MUST differ from stage_1_guard and stage_2_guard",
852
- required: true,
853
- },
854
- {
855
- name: "max_cap",
856
- type: "number",
857
- description: "Maximum cumulative release cap (applied to stages 1 and 2 via max field). Stage 3 uses Surplus so no max needed.",
858
- required: false,
859
- },
860
- {
861
- name: "description",
862
- type: "string",
863
- description: "Allocation description",
864
- required: false,
865
- default: "Standalone vesting release (3-stage time-locked)",
866
- },
867
- ],
868
- body: (p) => {
869
- const guards = [p.stage_1_guard, p.stage_2_guard, p.stage_3_guard];
870
- const unique = new Set(guards);
871
- if (unique.size !== guards.length) {
872
- const dupes = guards.filter((g, i) => guards.indexOf(g) !== i);
873
- throw new Error(`T-A-10: stage guards MUST be unique (F-A-14), duplicates: ${dupes.join(", ")}`);
874
- }
875
- const stage1Amount = Number(p.stage_1_amount);
876
- const stage2Amount = Number(p.stage_2_amount);
877
- if (stage1Amount <= 0 || stage2Amount <= 0) {
878
- throw new Error(`T-A-10: stage_1_amount and stage_2_amount MUST be > 0, got stage1=${stage1Amount}, stage2=${stage2Amount}`);
879
- }
880
- const totalFix = stage1Amount + stage2Amount;
881
- const maxCap = p.max_cap != null ? Number(p.max_cap) : null;
882
- if (maxCap !== null && totalFix > maxCap) {
883
- throw new Error(`T-A-10: stage_1_amount + stage_2_amount (${totalFix}) MUST be <= max_cap (${maxCap}) — F-A-08 (EAMOUNT_EXCEEDS_MAX)`);
884
- }
885
- return {
886
- object: { name: p.allocation_name, type_parameter: p.coin_type },
887
- allocators: {
888
- description: p.description ?? "Standalone vesting release (3-stage time-locked)",
889
- threshold: "0",
890
- allocators: [
891
- {
892
- guard: p.stage_1_guard,
893
- sharing: [
894
- { who: { Entity: p.beneficiary_address }, sharing: String(stage1Amount), mode: "Amount" },
895
- ],
896
- max: maxCap != null ? String(maxCap) : null,
897
- },
898
- {
899
- guard: p.stage_2_guard,
900
- sharing: [
901
- { who: { Entity: p.beneficiary_address }, sharing: String(stage2Amount), mode: "Amount" },
902
- ],
903
- max: maxCap != null ? String(maxCap) : null,
904
- },
905
- {
906
- guard: p.stage_3_guard,
907
- sharing: [
908
- { who: { Entity: p.beneficiary_address }, sharing: "0", mode: "Surplus" },
909
- ],
910
- max: null,
911
- },
912
- ],
913
- },
914
- coin: { name: `${p.allocation_name}_coin` },
915
- payment_info: {},
916
- };
917
- },
918
- notes: [
919
- "Standalone mode (§0): no Service/Order/Arbitration context required",
920
- "R-A-3-04: Guard time-lock MUST be enforced — no Service-layer access control exists",
921
- "F-A-14: stage_1_guard, stage_2_guard, stage_3_guard MUST be unique (duplicate guards are dead code)",
922
- "F-A-04: at most 1 Surplus per Allocator (stage 3 uses Surplus to drain remainder)",
923
- "F-A-08: stage_1_amount + stage_2_amount MUST be <= max_cap (if max_cap provided)",
924
- "R-A-4-01: if caller calls alloc() before stage time-lock expires, alloc() silently returns — caller should check balance==0 after alloc()",
925
- "R-A-4-02: Guard conditions SHOULD be mutually exclusive by timestamp (e.g. stage_1: ts<stage_2_unlock, stage_2: stage_2_unlock<=ts<stage_3_unlock, stage_3: ts>=stage_3_unlock)",
926
- "Caller lifecycle: receive() to deposit locked tokens → alloc() at each vesting milestone",
927
- ],
928
- },
929
- ];
930
- export const ALLOCATION_TEMPLATES_VERSION = "1.0.0";
931
- export function getAllTemplates() {
932
- return [...ALLOCATION_TEMPLATES];
933
- }
934
- export function getTemplateById(id) {
935
- return ALLOCATION_TEMPLATES.find(t => t.id === id);
936
- }
937
- export function getTemplatesByScene(sceneId) {
938
- return ALLOCATION_TEMPLATES.filter(t => t.applicable_scenes.includes(sceneId));
939
- }
940
- export function getTemplatesByIndustry(industry) {
941
- return ALLOCATION_TEMPLATES.filter(t => t.industry_tags.includes(industry) || t.industry_tags.includes("universal"));
942
- }
943
- export function suggestTemplateForScene(sceneId) {
944
- const matches = getTemplatesByScene(sceneId);
945
- return matches.length > 0 ? matches[0] : undefined;
946
- }
947
- export function listTemplates() {
948
- return ALLOCATION_TEMPLATES.map(t => ({
949
- id: t.id,
950
- name: t.name,
951
- description: t.description,
952
- scenes: t.applicable_scenes,
953
- }));
954
- }
955
- export function fillTemplate(templateId, params) {
956
- const tpl = getTemplateById(templateId);
957
- if (!tpl)
958
- return { ok: false, error: `Template ${templateId} not found` };
959
- for (const p of tpl.params) {
960
- if (p.required && !(p.name in params)) {
961
- return { ok: false, error: `Missing required param: ${p.name}` };
962
- }
963
- }
964
- try {
965
- return { ok: true, body: tpl.body(params) };
966
- }
967
- catch (e) {
968
- return { ok: false, error: e instanceof Error ? e.message : String(e) };
969
- }
970
- }
1
+ export const ALLOCATION_TEMPLATES=[{'id':'T-A-01','name':'Single\x20Rate\x20100%\x20to\x20Treasury','description':'Simplest\x20allocation\x20—\x20single\x20Allocator,\x20single\x20Rate=10000\x20sharing\x20to\x20one\x20Treasury/personal\x20address','applicable_scenes':['allocation_merchant_full_payment'],'industry_tags':['universal','retail','service'],'params':[{'name':'allocation_name','type':'string','description':'Local\x20name\x20for\x20the\x20new\x20Allocation\x20object','required':!![]},{'name':'coin_type','type':'string','description':'Coin<T>\x20type\x20string\x20(e.g.\x20\x270x2::wow::WOW\x27)','required':!![]},{'name':'recipient_address','type':'address','description':'Treasury\x20or\x20personal\x20wallet\x20address\x20to\x20receive\x20100%','required':!![]},{'name':'guard_address','type':'address','description':'Guard\x20object\x20address\x20(verifies\x20order\x20completion)','required':!![]},{'name':'description','type':'string','description':'Allocation\x20description','required':![],'default':'Single\x20Rate\x20100%\x20allocation'}],'body':a=>({'object':{'name':a['allocation_name'],'type_parameter':a['coin_type']},'allocators':{'description':a['description']??'Single\x20Rate\x20100%\x20allocation','threshold':'0','allocators':[{'guard':a['guard_address'],'sharing':[{'who':{'Entity':a['recipient_address']},'sharing':'10000','mode':'Rate'}],'max':null}]},'coin':{'name':a['allocation_name']+'_coin'},'payment_info':{}}),'notes':['Simplest\x20configuration\x20—\x20no\x20multi-party\x20coordination','Guard\x20only\x20needs\x20to\x20verify\x20order\x20status,\x20no\x20complex\x20conditions','Suitable\x20for\x20solo\x20merchants\x20or\x20single-treasury\x20services']},{'id':'T-A-02','name':'Standard\x203-way\x20Rate\x20split','description':'Three-way\x20split:\x20merchant\x20/\x20platform\x20/\x20logistics.\x20Pure\x20Rate\x20mode,\x20sum(rates)\x20MUST\x20equal\x2010000','applicable_scenes':['allocation_standard_three_way_split'],'industry_tags':['retail','ecommerce','logistics'],'params':[{'name':'allocation_name','type':'string','description':'Local\x20name\x20for\x20the\x20new\x20Allocation\x20object','required':!![]},{'name':'coin_type','type':'string','description':'Coin<T>\x20type\x20string','required':!![]},{'name':'merchant_treasury','type':'address','description':'Merchant\x20Treasury\x20address','required':!![]},{'name':'platform_treasury','type':'address','description':'Platform\x20Treasury\x20address','required':!![]},{'name':'logistics_treasury','type':'address','description':'Logistics\x20Treasury\x20address\x20(set\x20to\x20platform_treasury\x20if\x20N/A)','required':!![]},{'name':'merchant_rate','type':'number','description':'Merchant\x20rate\x20in\x20basis\x20points\x20(e.g.\x208000\x20=\x2080%)','required':!![],'default':0x1f40},{'name':'platform_rate','type':'number','description':'Platform\x20rate\x20in\x20basis\x20points\x20(e.g.\x201000\x20=\x2010%)','required':!![],'default':0x3e8},{'name':'logistics_rate','type':'number','description':'Logistics\x20rate\x20in\x20basis\x20points\x20(e.g.\x201000\x20=\x2010%)','required':!![],'default':0x3e8},{'name':'guard_address','type':'address','description':'Guard\x20object\x20address\x20(verifies\x20order\x20completion\x20+\x20service\x20binding)','required':!![]}],'body':a=>{const b=Number(a['merchant_rate']),c=Number(a['platform_rate']),d=Number(a['logistics_rate']),e=b+c+d;if(e!==0x2710)throw new Error('T-A-02:\x20sum(rates)\x20MUST\x20equal\x2010000\x20(RATE_TOTAL_FULL),\x20got\x20'+e+'\x20'+('(merchant='+b+'\x20+\x20platform='+c+'\x20+\x20logistics='+d+')'));return{'object':{'name':a['allocation_name'],'type_parameter':a['coin_type']},'allocators':{'description':'3-way\x20split:\x20merchant\x20'+b+'/10000,\x20platform\x20'+c+'/10000,\x20logistics\x20'+d+'/10000','threshold':'0','allocators':[{'guard':a['guard_address'],'sharing':[{'who':{'Entity':a['merchant_treasury']},'sharing':String(b),'mode':'Rate'},{'who':{'Entity':a['platform_treasury']},'sharing':String(c),'mode':'Rate'},{'who':{'Entity':a['logistics_treasury']},'sharing':String(d),'mode':'Rate'}],'max':null}]},'coin':{'name':a['allocation_name']+'_coin'},'payment_info':{}};},'notes':['F-A-05:\x20sum(rates)\x20MUST\x20equal\x2010000\x20(pure\x20Rate\x20mode,\x20no\x20Surplus)','Treasury\x20Permission\x20should\x20match\x20Service\x20Permission\x20(R-A-3-02)','Guard\x20should\x20verify\x20order.service\x20binding\x20(query\x201563)\x20to\x20prevent\x20cross-project\x20bypass']},{'id':'T-A-03','name':'Refund-first\x20+\x20Surplus-to-merchant\x20(Amount\x20+\x20Surplus\x20hybrid)','description':'Single\x20Allocator\x20with\x202\x20sharing\x20items:\x20Amount=refund_value\x20to\x20customer,\x20Surplus\x20to\x20merchant','applicable_scenes':['allocation_refund_first_surplus_to_merchant'],'industry_tags':['retail','refund','customer_protection'],'params':[{'name':'allocation_name','type':'string','description':'Local\x20name\x20for\x20the\x20new\x20Allocation\x20object','required':!![]},{'name':'coin_type','type':'string','description':'Coin<T>\x20type\x20string','required':!![]},{'name':'customer_address','type':'address','description':'Customer\x20address\x20to\x20receive\x20refund\x20Amount','required':!![]},{'name':'merchant_treasury','type':'address','description':'Merchant\x20Treasury\x20address\x20to\x20receive\x20Surplus','required':!![]},{'name':'refund_amount','type':'number','description':'Refund\x20amount\x20in\x20smallest\x20coin\x20unit\x20(e.g.\x20MIST\x20for\x20WOW)','required':!![]},{'name':'guard_address','type':'address','description':'Guard\x20object\x20address\x20(verifies\x20refund\x20approval)','required':!![]},{'name':'description','type':'string','description':'Allocation\x20description','required':![],'default':'Refund-first\x20+\x20Surplus-to-merchant'}],'body':a=>{const b=Number(a['refund_amount']);if(b<=0x0)throw new Error('T-A-03:\x20refund_amount\x20MUST\x20be\x20>\x200,\x20got\x20'+b);return{'object':{'name':a['allocation_name'],'type_parameter':a['coin_type']},'allocators':{'description':a['description']??'Refund-first\x20+\x20Surplus-to-merchant','threshold':String(b),'allocators':[{'guard':a['guard_address'],'sharing':[{'who':{'Entity':a['customer_address']},'sharing':String(b),'mode':'Amount'},{'who':{'Entity':a['merchant_treasury']},'sharing':'0','mode':'Surplus'}],'max':null}]},'coin':{'name':a['allocation_name']+'_coin'},'payment_info':{}};},'notes':['F-A-04:\x20at\x20most\x201\x20Surplus\x20per\x20Allocator\x20(✓\x20single\x20Surplus\x20here)','F-A-07:\x20threshold\x20=\x20refundAmount\x20(ensure\x20balance\x20covers\x20Amount)','fix\x20is\x20cached\x20as\x20refundAmount\x20at\x20allocator_add\x20time','Guard\x20must\x20verify\x20customer\x20refund\x20eligibility\x20(e.g.\x20order\x20status\x20=\x20Refunded)']},{'id':'T-A-04','name':'Treasury\x20+\x20Personal\x20alternative\x20(caller-specified\x20guard,\x202\x20Allocators)','description':'2\x20Allocators\x20as\x20alternative\x20strategies:\x20caller\x20selects\x20Treasury\x20or\x20Personal\x20wallet\x20via\x20alloc_by_guard\x20(hard\x20verification\x20per\x20call)','applicable_scenes':['allocation_treasury_personal_alternatives'],'industry_tags':['universal','alternative','treasury'],'params':[{'name':'allocation_name','type':'string','description':'Local\x20name\x20for\x20the\x20new\x20Allocation\x20object','required':!![]},{'name':'coin_type','type':'string','description':'Coin<T>\x20type\x20string','required':!![]},{'name':'treasury_address','type':'address','description':'Treasury\x20address\x20(primary\x20recipient)','required':!![]},{'name':'personal_address','type':'address','description':'Personal\x20wallet\x20address\x20(alternative\x20recipient)','required':!![]},{'name':'treasury_guard','type':'address','description':'Guard\x20for\x20Treasury\x20path\x20(verifies\x20treasury\x20operational)','required':!![]},{'name':'personal_guard','type':'address','description':'Guard\x20for\x20Personal\x20path\x20(verifies\x20personal\x20wallet\x20active)\x20—\x20MUST\x20differ\x20from\x20treasury_guard','required':!![]}],'body':a=>{if(a['treasury_guard']===a['personal_guard'])throw new Error('T-A-04:\x20treasury_guard\x20and\x20personal_guard\x20MUST\x20be\x20different\x20addresses\x20(F-A-14:\x20allocators[].guard\x20must\x20be\x20unique)');return{'object':{'name':a['allocation_name'],'type_parameter':a['coin_type']},'allocators':{'description':'Treasury\x20/\x20Personal\x20alternative\x20(caller-specified\x20guard)','threshold':'0','allocators':[{'guard':a['treasury_guard'],'sharing':[{'who':{'Entity':a['treasury_address']},'sharing':'10000','mode':'Rate'}],'max':null},{'guard':a['personal_guard'],'sharing':[{'who':{'Entity':a['personal_address']},'sharing':'10000','mode':'Rate'}],'max':null}]},'coin':{'name':a['allocation_name']+'_coin'},'payment_info':{}};},'notes':['F-A-14:\x20treasury_guard\x20!=\x20personal_guard\x20(Allocator\x20Guards\x20must\x20be\x20unique)','caller-specified\x20guard:\x20alloc_by_guard\x20explicitly\x20selects\x20an\x20Allocator;\x20passport::result_for_guard\x20hard-verifies\x20(failure\x20aborts\x20E_VERIFY_FAILED)','No\x20auto-fallback:\x20on\x20verification\x20failure\x20the\x20caller\x20must\x20switch\x20guard\x20and\x20retry','R-A-4-02:\x20if\x20the\x20caller\x27s\x20submitted\x20Passport\x20satisfies\x20both\x20Guards\x20simultaneously,\x20the\x20caller\x20may\x20freely\x20choose\x20between\x20the\x20two\x20paths\x20(mutual\x20exclusion\x20is\x20a\x20design\x20clarity\x20recommendation,\x20not\x20a\x20correctness\x20requirement)']},{'id':'T-A-05','name':'Tiered\x20by\x20order\x20amount\x20(mutually\x20exclusive\x20Guard\x20conditions)','description':'2\x20Allocators\x20triggered\x20by\x20mutually\x20exclusive\x20Guard\x20conditions\x20(small\x20order\x20vs\x20large\x20order)','applicable_scenes':['allocation_tiered_by_order_amount'],'industry_tags':['retail','tiered_pricing','volume_discount'],'params':[{'name':'allocation_name','type':'string','description':'Local\x20name\x20for\x20the\x20new\x20Allocation\x20object','required':!![]},{'name':'coin_type','type':'string','description':'Coin<T>\x20type\x20string','required':!![]},{'name':'merchant_treasury','type':'address','description':'Merchant\x20Treasury\x20address','required':!![]},{'name':'platform_treasury','type':'address','description':'Platform\x20Treasury\x20address','required':!![]},{'name':'small_order_guard','type':'address','description':'Guard\x20verifying\x20order.amount\x20<\x20threshold\x20(small\x20order\x20path)','required':!![]},{'name':'large_order_guard','type':'address','description':'Guard\x20verifying\x20order.amount\x20>=\x20threshold\x20(large\x20order\x20path)\x20—\x20MUST\x20differ\x20from\x20small_order_guard','required':!![]},{'name':'small_order_merchant_rate','type':'number','description':'Merchant\x20rate\x20for\x20small\x20orders\x20(e.g.\x2010000\x20=\x20100%)','required':!![],'default':0x2710},{'name':'large_order_merchant_rate','type':'number','description':'Merchant\x20rate\x20for\x20large\x20orders\x20(e.g.\x208000\x20=\x2080%)','required':!![],'default':0x1f40},{'name':'large_order_platform_rate','type':'number','description':'Platform\x20rate\x20for\x20large\x20orders\x20(e.g.\x202000\x20=\x2020%)','required':!![],'default':0x7d0}],'body':a=>{if(a['small_order_guard']===a['large_order_guard'])throw new Error('T-A-05:\x20small_order_guard\x20and\x20large_order_guard\x20MUST\x20be\x20different\x20addresses\x20(F-A-14)');const b=Number(a['small_order_merchant_rate']);if(b!==0x2710)throw new Error('T-A-05:\x20small_order_merchant_rate\x20MUST\x20equal\x2010000\x20(pure\x20Rate,\x20no\x20Surplus\x20in\x20this\x20Allocator),\x20got\x20'+b);const c=Number(a['large_order_merchant_rate']),d=Number(a['large_order_platform_rate']),e=c+d;if(e!==0x2710)throw new Error('T-A-05:\x20large_order\x20rates\x20MUST\x20sum\x20to\x2010000,\x20got\x20'+e+'\x20(merchant='+c+'\x20+\x20platform='+d+')');return{'object':{'name':a['allocation_name'],'type_parameter':a['coin_type']},'allocators':{'description':'Tiered\x20by\x20order\x20amount:\x20small=100%\x20merchant,\x20large=80/20\x20merchant/platform','threshold':'0','allocators':[{'guard':a['small_order_guard'],'sharing':[{'who':{'Entity':a['merchant_treasury']},'sharing':'10000','mode':'Rate'}],'max':null},{'guard':a['large_order_guard'],'sharing':[{'who':{'Entity':a['merchant_treasury']},'sharing':String(c),'mode':'Rate'},{'who':{'Entity':a['platform_treasury']},'sharing':String(d),'mode':'Rate'}],'max':null}]},'coin':{'name':a['allocation_name']+'_coin'},'payment_info':{}};},'notes':['Guard\x20conditions\x20MUST\x20be\x20mutually\x20exclusive\x20(R-A-4-02)','Sequence-sensitive:\x20strict\x20condition\x20(small\x20order)\x20first,\x20relaxed\x20condition\x20(large\x20order)\x20last','Guard\x20queries\x20order.amount\x20(query\x201561)\x20to\x20determine\x20which\x20Allocator\x20fires','If\x20neither\x20Guard\x20passes,\x20funds\x20are\x20silently\x20locked\x20(R-A-4-02)']},{'id':'T-A-06','name':'Dynamic\x20recipient\x20via\x20GuardIdentifier\x20(referrer\x20from\x20Passport)','description':'Single\x20Allocator\x20with\x203\x20Rate\x20sharing\x20items,\x20one\x20recipient\x20resolved\x20from\x20customer\x27s\x20Passport\x20table[0]','applicable_scenes':['allocation_dynamic_recipient'],'industry_tags':['referral','affiliate','marketing'],'params':[{'name':'allocation_name','type':'string','description':'Local\x20name\x20for\x20the\x20new\x20Allocation\x20object','required':!![]},{'name':'coin_type','type':'string','description':'Coin<T>\x20type\x20string','required':!![]},{'name':'merchant_treasury','type':'address','description':'Merchant\x20Treasury\x20address','required':!![]},{'name':'platform_treasury','type':'address','description':'Platform\x20Treasury\x20address','required':!![]},{'name':'guard_address','type':'address','description':'Guard\x20object\x20address\x20(must\x20be\x20configured\x20with\x20identifier=0\x20as\x20address\x20type)','required':!![]},{'name':'passport_identifier','type':'number','description':'Passport\x20table\x20identifier\x20(u8,\x200-255)\x20—\x20customer\x20submits\x20referrer\x20address\x20at\x20this\x20slot','required':!![],'default':0x0},{'name':'merchant_rate','type':'number','description':'Merchant\x20rate\x20in\x20basis\x20points\x20(e.g.\x208000\x20=\x2080%)','required':!![],'default':0x1f40},{'name':'platform_rate','type':'number','description':'Platform\x20rate\x20in\x20basis\x20points\x20(e.g.\x201000\x20=\x2010%)','required':!![],'default':0x3e8},{'name':'referrer_rate','type':'number','description':'Referrer\x20rate\x20in\x20basis\x20points\x20(e.g.\x201000\x20=\x2010%)','required':!![],'default':0x3e8}],'body':a=>{const b=Number(a['merchant_rate']),c=Number(a['platform_rate']),d=Number(a['referrer_rate']),e=b+c+d;if(e!==0x2710)throw new Error('T-A-06:\x20sum(rates)\x20MUST\x20equal\x2010000,\x20got\x20'+e+'\x20(merchant='+b+'\x20+\x20platform='+c+'\x20+\x20referrer='+d+')');const f=Number(a['passport_identifier']);if(f<0x0||f>0xff)throw new Error('T-A-06:\x20passport_identifier\x20MUST\x20be\x20u8\x20(0-255),\x20got\x20'+f);return{'object':{'name':a['allocation_name'],'type_parameter':a['coin_type']},'allocators':{'description':'Dynamic\x20recipient:\x20merchant\x20'+b+'/10000,\x20platform\x20'+c+'/10000,\x20referrer\x20'+d+'/10000\x20(from\x20Passport\x20identifier='+f+')','threshold':'0','allocators':[{'guard':a['guard_address'],'sharing':[{'who':{'Entity':a['merchant_treasury']},'sharing':String(b),'mode':'Rate'},{'who':{'Entity':a['platform_treasury']},'sharing':String(c),'mode':'Rate'},{'who':{'GuardIdentifier':f},'sharing':String(d),'mode':'Rate'}],'max':null}]},'coin':{'name':a['allocation_name']+'_coin'},'payment_info':{}};},'notes':['F-A-13:\x20Passport\x20table[identifier]\x20MUST\x20be\x20address\x20type\x20(else\x20ERECIPIENT_IDENTIFIER_NOT_ADDRESS=1)','Guard.is_identifier_address(guard,\x20identifier)\x20MUST\x20be\x20true\x20at\x20allocator_add\x20time\x20(else\x20allocator_add\x20fails)','Customer\x20must\x20submit\x20Passport\x20with\x20referrer\x20address\x20at\x20the\x20specified\x20identifier\x20slot','Guard\x20should\x20verify\x20Passport\x20completeness\x20before\x20alloc()\x20executes']},{'id':'T-A-07','name':'Refund\x20to\x20Order\x20(100%\x20to\x20Order\x20object,\x20not\x20personal\x20wallet)','description':'Single\x20Allocator,\x201\x20Rate=10000\x20sharing\x20to\x20Order\x20object\x20address.\x20Refund\x20funds\x20return\x20to\x20Order\x20for\x20downstream\x20handling.','applicable_scenes':['allocation_refund_to_order'],'industry_tags':['refund','customer_protection','order_lifecycle'],'params':[{'name':'allocation_name','type':'string','description':'Local\x20name\x20for\x20the\x20new\x20Allocation\x20object','required':!![]},{'name':'coin_type','type':'string','description':'Coin<T>\x20type\x20string','required':!![]},{'name':'order_address','type':'address','description':'Order\x20object\x20address\x20(NOT\x20personal\x20wallet)\x20—\x20funds\x20flow\x20back\x20to\x20Order','required':!![]},{'name':'guard_address','type':'address','description':'Guard\x20object\x20address\x20(verifies\x20customer\x20refund\x20request\x20and\x20eligibility)','required':!![]}],'body':a=>({'object':{'name':a['allocation_name'],'type_parameter':a['coin_type']},'allocators':{'description':'Refund\x20to\x20Order\x20(100%\x20to\x20Order\x20object\x20for\x20downstream\x20handling)','threshold':'0','allocators':[{'guard':a['guard_address'],'sharing':[{'who':{'Entity':a['order_address']},'sharing':'10000','mode':'Rate'}],'max':null}]},'coin':{'name':a['allocation_name']+'_coin'},'payment_info':{}}),'notes':['⚠️\x20who=Entity\x20MUST\x20be\x20Order\x20object\x20address\x20(not\x20personal\x20address)','Customer\x20due-diligence\x20rewards\x20this\x20configuration\x20(8-point\x20weight\x20in\x20customer/risk-assessment.ts)','Refund\x20funds\x20return\x20to\x20Order\x20for\x20downstream\x20handling\x20(e.g.\x20customer\x20withdrawal)','Guard\x20must\x20verify\x20customer\x20refund\x20eligibility\x20(e.g.\x20dispute\x20resolved\x20in\x20customer\x27s\x20favor)']},{'id':'T-A-08','name':'Arbitration\x20fees\x20split\x20(arbitrator\x2080%\x20/\x20platform\x2020%)','description':'Single\x20Allocator,\x202\x20Rate\x20sharing\x20items.\x20Triggered\x20by\x20Arbitration.fees_alloc\x20(permission\x20365)\x20or\x20fees_alloc_with_passport.','applicable_scenes':['allocation_arbitration_fees'],'industry_tags':['arbitration','dispute','fees'],'params':[{'name':'allocation_name','type':'string','description':'Local\x20name\x20for\x20the\x20new\x20Allocation\x20object','required':!![]},{'name':'coin_type','type':'string','description':'Coin<T>\x20type\x20string\x20(must\x20match\x20Arbitration\x20fee\x20Coin\x20type)','required':!![]},{'name':'arbitrator_treasury','type':'address','description':'Arbitrator\x20Treasury\x20address','required':!![]},{'name':'platform_treasury','type':'address','description':'Platform\x20Treasury\x20address','required':!![]},{'name':'arbitrator_rate','type':'number','description':'Arbitrator\x20rate\x20in\x20basis\x20points\x20(e.g.\x208000\x20=\x2080%)','required':!![],'default':0x1f40},{'name':'platform_rate','type':'number','description':'Platform\x20rate\x20in\x20basis\x20points\x20(e.g.\x202000\x20=\x2020%)','required':!![],'default':0x7d0},{'name':'guard_address','type':'address','description':'Guard\x20object\x20address\x20(verifies\x20Arbitration\x20ruling\x20finalized)','required':!![]}],'body':a=>{const b=Number(a['arbitrator_rate']),c=Number(a['platform_rate']),d=b+c;if(d!==0x2710)throw new Error('T-A-08:\x20sum(rates)\x20MUST\x20equal\x2010000,\x20got\x20'+d+'\x20(arbitrator='+b+'\x20+\x20platform='+c+')');return{'object':{'name':a['allocation_name'],'type_parameter':a['coin_type']},'allocators':{'description':'Arbitration\x20fees\x20split:\x20arbitrator\x20'+b+'/10000,\x20platform\x20'+c+'/10000','threshold':'0','allocators':[{'guard':a['guard_address'],'sharing':[{'who':{'Entity':a['arbitrator_treasury']},'sharing':String(b),'mode':'Rate'},{'who':{'Entity':a['platform_treasury']},'sharing':String(c),'mode':'Rate'}],'max':null}]},'coin':{'name':a['allocation_name']+'_coin'},'payment_info':{}};},'notes':['Triggered\x20by\x20Arbitration.fees_alloc\x20(permission\x20ARBITRATION_FEES_ALLOC=365)\x20or\x20fees_alloc_with_passport','Independent\x20from\x20Service-order\x20Allocation\x20(this\x20Allocation\x20is\x20not\x20bound\x20to\x20Order)','payment_info\x20typically\x20reuses\x20Arbitration\x27s\x20payment_info','Caller\x20MUST\x20hold\x20ARBITRATION_FEES_ALLOC=365\x20permission']},{'id':'T-A-09','name':'Standalone\x20periodic\x20split\x20(investment\x20dividends\x20/\x20shared\x20income)','description':'Standalone\x20Allocation\x20with\x20single\x20Allocator,\x20N\x20Rate\x20sharing\x20items\x20to\x20beneficiary\x20wallets.\x20No\x20Service\x20context.\x20Guard\x20provides\x20time-based\x20or\x20signer-based\x20access\x20control.','applicable_scenes':['allocation_standalone_periodic_split'],'industry_tags':['standalone','investment','dividends','shared_income'],'params':[{'name':'allocation_name','type':'string','description':'Local\x20name\x20for\x20the\x20new\x20Allocation\x20object','required':!![]},{'name':'coin_type','type':'string','description':'Coin<T>\x20type\x20string\x20(e.g.\x20\x270x2::wow::WOW\x27\x20or\x20profit\x20token\x20type)','required':!![]},{'name':'beneficiaries','type':'address[]','description':'Array\x20of\x20beneficiary\x20wallet\x20addresses\x20(NOT\x20Treasury\x20objects\x20—\x20standalone\x20mode\x20has\x20no\x20Service\x20context)','required':!![]},{'name':'rates','type':'string[]','description':'Array\x20of\x20rates\x20in\x20basis\x20points\x20(e.g.\x20[\x275000\x27,\x273000\x27,\x272000\x27]\x20=\x2050%/30%/20%).\x20MUST\x20sum\x20to\x2010000.','required':!![]},{'name':'guard_address','type':'address','description':'Guard\x20object\x20address\x20—\x20MUST\x20bind\x20Signer\x20or\x20verify\x20time-based\x20trigger\x20(R-A-3-04:\x20standalone\x20has\x20no\x20Service-layer\x20access\x20control)','required':!![]},{'name':'description','type':'string','description':'Allocation\x20description','required':![],'default':'Standalone\x20periodic\x20split'}],'body':a=>{const b=a['beneficiaries'],c=a['rates']['map'](e=>Number(e));if(b['length']!==c['length'])throw new Error('T-A-09:\x20beneficiaries\x20('+b['length']+')\x20and\x20rates\x20('+c['length']+')\x20MUST\x20have\x20equal\x20length');if(b['length']===0x0)throw new Error('T-A-09:\x20at\x20least\x201\x20beneficiary\x20required');if(b['length']>0x64)throw new Error('T-A-09:\x20beneficiaries\x20count\x20'+b['length']+'\x20exceeds\x20MAX_SHARING_COUNT\x20(100)');const d=c['reduce']((e,f)=>e+f,0x0);if(d!==0x2710)throw new Error('T-A-09:\x20sum(rates)\x20MUST\x20equal\x2010000\x20(RATE_TOTAL_FULL),\x20got\x20'+d);return{'object':{'name':a['allocation_name'],'type_parameter':a['coin_type']},'allocators':{'description':a['description']??'Standalone\x20periodic\x20split','threshold':'0','allocators':[{'guard':a['guard_address'],'sharing':b['map']((e,f)=>({'who':{'Entity':e},'sharing':String(c[f]),'mode':'Rate'})),'max':null}]},'coin':{'name':a['allocation_name']+'_coin'},'payment_info':{}};},'notes':['Standalone\x20mode\x20(§0):\x20no\x20Service/Order/Arbitration\x20context\x20required','R-A-3-04:\x20Guard\x20MUST\x20bind\x20Signer\x20or\x20verify\x20time-based\x20trigger\x20—\x20no\x20Service-layer\x20access\x20control\x20exists','F-A-05:\x20sum(rates)\x20MUST\x20equal\x2010000\x20(pure\x20Rate\x20mode,\x20no\x20Surplus)','Caller\x20lifecycle:\x20receive()\x20to\x20deposit\x20funds\x20→\x20alloc()\x20to\x20trigger\x20distribution','Guard\x20should\x20bind\x20context(Signer)==authorized\x20to\x20prevent\x20unauthorized\x20alloc()\x20calls','beneficiaries\x20are\x20personal\x20wallets,\x20NOT\x20Treasury\x20objects\x20(no\x20Service\x20context)']},{'id':'T-A-10','name':'Standalone\x20vesting\x20release\x20(time-locked\x20multi-stage\x20unlock)','description':'Standalone\x20Allocation\x20with\x20N\x20Allocators\x20(default\x203\x20stages),\x20each\x20triggered\x20by\x20a\x20time-locked\x20Guard.\x20Stages\x201..N-1\x20use\x20Amount\x20mode;\x20final\x20stage\x20uses\x20Surplus\x20to\x20drain\x20remaining\x20balance.\x20No\x20Service\x20context.','applicable_scenes':['allocation_standalone_vesting'],'industry_tags':['standalone','vesting','time_lock','team_tokens'],'params':[{'name':'allocation_name','type':'string','description':'Local\x20name\x20for\x20the\x20new\x20Allocation\x20object','required':!![]},{'name':'coin_type','type':'string','description':'Coin<T>\x20type\x20string\x20(vested\x20asset,\x20e.g.\x20locked\x20team\x20tokens)','required':!![]},{'name':'beneficiary_address','type':'address','description':'Single\x20beneficiary\x20wallet\x20address\x20(vesting\x20recipient)','required':!![]},{'name':'stage_1_guard','type':'address','description':'Guard\x20for\x20stage\x201\x20(verifies\x20context(Clock).timestamp\x20>=\x20stage_1_unlock)','required':!![]},{'name':'stage_1_amount','type':'number','description':'Amount\x20to\x20release\x20at\x20stage\x201\x20(smallest\x20coin\x20unit,\x20e.g.\x20MIST)','required':!![]},{'name':'stage_2_guard','type':'address','description':'Guard\x20for\x20stage\x202\x20(verifies\x20context(Clock).timestamp\x20>=\x20stage_2_unlock)\x20—\x20MUST\x20differ\x20from\x20stage_1_guard','required':!![]},{'name':'stage_2_amount','type':'number','description':'Amount\x20to\x20release\x20at\x20stage\x202\x20(smallest\x20coin\x20unit)','required':!![]},{'name':'stage_3_guard','type':'address','description':'Guard\x20for\x20stage\x203\x20(final\x20stage,\x20uses\x20Surplus\x20to\x20drain\x20remaining\x20balance)\x20—\x20MUST\x20differ\x20from\x20stage_1_guard\x20and\x20stage_2_guard','required':!![]},{'name':'max_cap','type':'number','description':'Maximum\x20cumulative\x20release\x20cap\x20(applied\x20to\x20stages\x201\x20and\x202\x20via\x20max\x20field).\x20Stage\x203\x20uses\x20Surplus\x20so\x20no\x20max\x20needed.','required':![]},{'name':'description','type':'string','description':'Allocation\x20description','required':![],'default':'Standalone\x20vesting\x20release\x20(3-stage\x20time-locked)'}],'body':a=>{const b=[a['stage_1_guard'],a['stage_2_guard'],a['stage_3_guard']],c=new Set(b);if(c['size']!==b['length']){const h=b['filter']((j,k)=>b['indexOf'](j)!==k);throw new Error('T-A-10:\x20stage\x20guards\x20MUST\x20be\x20unique\x20(F-A-14),\x20duplicates:\x20'+h['join'](',\x20'));}const d=Number(a['stage_1_amount']),e=Number(a['stage_2_amount']);if(d<=0x0||e<=0x0)throw new Error('T-A-10:\x20stage_1_amount\x20and\x20stage_2_amount\x20MUST\x20be\x20>\x200,\x20got\x20stage1='+d+',\x20stage2='+e);const f=d+e,g=a['max_cap']!=null?Number(a['max_cap']):null;if(g!==null&&f>g)throw new Error('T-A-10:\x20stage_1_amount\x20+\x20stage_2_amount\x20('+f+')\x20MUST\x20be\x20<=\x20max_cap\x20('+g+')\x20—\x20F-A-08\x20(EAMOUNT_EXCEEDS_MAX)');return{'object':{'name':a['allocation_name'],'type_parameter':a['coin_type']},'allocators':{'description':a['description']??'Standalone\x20vesting\x20release\x20(3-stage\x20time-locked)','threshold':'0','allocators':[{'guard':a['stage_1_guard'],'sharing':[{'who':{'Entity':a['beneficiary_address']},'sharing':String(d),'mode':'Amount'}],'max':g!=null?String(g):null},{'guard':a['stage_2_guard'],'sharing':[{'who':{'Entity':a['beneficiary_address']},'sharing':String(e),'mode':'Amount'}],'max':g!=null?String(g):null},{'guard':a['stage_3_guard'],'sharing':[{'who':{'Entity':a['beneficiary_address']},'sharing':'0','mode':'Surplus'}],'max':null}]},'coin':{'name':a['allocation_name']+'_coin'},'payment_info':{}};},'notes':['Standalone\x20mode\x20(§0):\x20no\x20Service/Order/Arbitration\x20context\x20required','R-A-3-04:\x20Guard\x20time-lock\x20MUST\x20be\x20enforced\x20—\x20no\x20Service-layer\x20access\x20control\x20exists','F-A-14:\x20stage_1_guard,\x20stage_2_guard,\x20stage_3_guard\x20MUST\x20be\x20unique\x20(duplicate\x20guards\x20are\x20dead\x20code)','F-A-04:\x20at\x20most\x201\x20Surplus\x20per\x20Allocator\x20(stage\x203\x20uses\x20Surplus\x20to\x20drain\x20remainder)','F-A-08:\x20stage_1_amount\x20+\x20stage_2_amount\x20MUST\x20be\x20<=\x20max_cap\x20(if\x20max_cap\x20provided)','R-A-4-01:\x20if\x20caller\x20calls\x20alloc()\x20before\x20stage\x20time-lock\x20expires,\x20alloc()\x20silently\x20returns\x20—\x20caller\x20should\x20check\x20balance==0\x20after\x20alloc()','R-A-4-02:\x20Guard\x20conditions\x20SHOULD\x20be\x20mutually\x20exclusive\x20by\x20timestamp\x20(e.g.\x20stage_1:\x20ts<stage_2_unlock,\x20stage_2:\x20stage_2_unlock<=ts<stage_3_unlock,\x20stage_3:\x20ts>=stage_3_unlock)','Caller\x20lifecycle:\x20receive()\x20to\x20deposit\x20locked\x20tokens\x20→\x20alloc()\x20at\x20each\x20vesting\x20milestone']}];export const ALLOCATION_TEMPLATES_VERSION='1.0.0';export function getAllTemplates(){return[...ALLOCATION_TEMPLATES];}export function getTemplateById(a){return ALLOCATION_TEMPLATES['find'](b=>b['id']===a);}export function getTemplatesByScene(a){return ALLOCATION_TEMPLATES['filter'](b=>b['applicable_scenes']['includes'](a));}export function getTemplatesByIndustry(a){return ALLOCATION_TEMPLATES['filter'](b=>b['industry_tags']['includes'](a)||b['industry_tags']['includes']('universal'));}export function suggestTemplateForScene(a){const b=getTemplatesByScene(a);return b['length']>0x0?b[0x0]:undefined;}export function listTemplates(){return ALLOCATION_TEMPLATES['map'](a=>({'id':a['id'],'name':a['name'],'description':a['description'],'scenes':a['applicable_scenes']}));}export function fillTemplate(a,b){const c=getTemplateById(a);if(!c)return{'ok':![],'error':'Template\x20'+a+'\x20not\x20found'};for(const d of c['params']){if(d['required']&&!(d['name']in b))return{'ok':![],'error':'Missing\x20required\x20param:\x20'+d['name']};}try{return{'ok':!![],'body':c['body'](b)};}catch(f){return{'ok':![],'error':f instanceof Error?f['message']:String(f)};}}