@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,627 +1 @@
1
- import { MAX_GUARD_COUNT_REWARD, MAX_RECORD_COUNT_REWARD, } from "./onchain-constants.js";
2
- import { resolveGuardConstructor, } from "./reward-ledger.js";
3
- const R_R_1_01 = {
4
- id: "R-R-1-01",
5
- category: "structural",
6
- trigger: "guard_add would exceed MAX_GUARD_COUNT_REWARD (200)",
7
- check: (ctx) => {
8
- if (!ctx.guard_add || ctx.guard_add.length === 0)
9
- return null;
10
- const current = ctx.current_guard_count ?? 0;
11
- const wouldAdd = ctx.guard_add.length;
12
- if (current + wouldAdd > MAX_GUARD_COUNT_REWARD) {
13
- return {
14
- id: "R-R-1-01",
15
- level: "HIGH",
16
- category: "structural",
17
- title: "guard_add would exceed MAX_GUARD_COUNT_REWARD",
18
- description: `Reward has ${current} guards, adding ${wouldAdd} would total ${current + wouldAdd}, ` +
19
- `exceeds MAX_GUARD_COUNT_REWARD ${MAX_GUARD_COUNT_REWARD}. Move aborts with E_GUARD_COUNT_EXCEEDED (3).`,
20
- affected_stakeholders: ["owner", "service_provider"],
21
- scenario: "Adding too many guards to a single Reward (e.g. milestone reward with > 200 recipients)",
22
- mitigation: "Split into multiple Reward objects, or use GuardIdentifier recipient to handle multiple recipients with a single guard.",
23
- evidence: `current=${current}, add=${wouldAdd}`,
24
- related_move_error: "E_GUARD_COUNT_EXCEEDED (3)",
25
- auto_fixable: false,
26
- };
27
- }
28
- return null;
29
- },
30
- };
31
- const R_R_1_02 = {
32
- id: "R-R-1-02",
33
- category: "structural",
34
- trigger: "claim would push recipient record count to MAX_RECORD_COUNT_REWARD (5200)",
35
- check: (ctx) => {
36
- if (!ctx.claim)
37
- return null;
38
- const current = ctx.current_record_count_for_recipient ?? 0;
39
- if (current >= MAX_RECORD_COUNT_REWARD) {
40
- return {
41
- id: "R-R-1-02",
42
- level: "HIGH",
43
- category: "structural",
44
- title: "claim blocked — recipient record count at limit",
45
- description: `Recipient already has ${current} records, at MAX_RECORD_COUNT_REWARD ${MAX_RECORD_COUNT_REWARD}. ` +
46
- `Next claim will abort with E_RECORD_COUNT_EXCEEDED (8). The recipient can no longer claim from this Reward.`,
47
- affected_stakeholders: ["claimer"],
48
- scenario: "High-frequency claimer hits the 5200-record ceiling (e.g. cashback on every micro-order)",
49
- mitigation: "Owner can create a new Reward for the same recipient, OR redesign the Guard to batch claims (larger amount per claim).",
50
- evidence: `recipient_records=${current}`,
51
- related_move_error: "E_RECORD_COUNT_EXCEEDED (8)",
52
- auto_fixable: false,
53
- };
54
- }
55
- return null;
56
- },
57
- };
58
- const R_R_1_03 = {
59
- id: "R-R-1-03",
60
- category: "structural",
61
- trigger: "guard_add batch size > MAX_GUARD_COUNT_REWARD (200) — schema-level overflow",
62
- check: (ctx) => {
63
- if (!ctx.guard_add)
64
- return null;
65
- if (ctx.guard_add.length > MAX_GUARD_COUNT_REWARD) {
66
- return {
67
- id: "R-R-1-03",
68
- level: "CRITICAL",
69
- category: "structural",
70
- title: "guard_add batch exceeds absolute limit",
71
- description: `Single guard_add call tries to add ${ctx.guard_add.length} guards in one transaction, ` +
72
- `exceeds MAX_GUARD_COUNT_REWARD ${MAX_GUARD_COUNT_REWARD}. SDK rejects this in operate().`,
73
- affected_stakeholders: ["owner"],
74
- scenario: "Bulk guard addition without splitting transactions",
75
- mitigation: `Split into multiple transactions, each ≤ ${MAX_GUARD_COUNT_REWARD} new guards.`,
76
- evidence: `batch_size=${ctx.guard_add.length}`,
77
- auto_fixable: true,
78
- };
79
- }
80
- return null;
81
- },
82
- };
83
- const R_R_2_01 = {
84
- id: "R-R-2-01",
85
- category: "semantic",
86
- trigger: "guard_add with GuardIdentifier recipient where identifier type is not address",
87
- check: (ctx) => {
88
- if (!ctx.guard_add)
89
- return null;
90
- for (let i = 0; i < ctx.guard_add.length; i++) {
91
- const g = ctx.guard_add[i];
92
- if ("GuardIdentifier" in g.recipient) {
93
- const id = g.recipient.GuardIdentifier;
94
- if (ctx.passport_identifier_is_address && ctx.passport_identifier_is_address[id] === false) {
95
- return {
96
- id: "R-R-2-01",
97
- level: "HIGH",
98
- category: "semantic",
99
- title: `guard_add[${i}]: recipient GuardIdentifier ${id} is not address-typed`,
100
- description: `RewardGuard constructor calls is_identifier_address(guard, ${id}). If the identifier type is not address, ` +
101
- `Move aborts with E_RECIPIENT_IDENTIFIER_NOT_ADDRESS (4).`,
102
- affected_stakeholders: ["owner"],
103
- scenario: "Misconfigured Guard — recipient identifier is u64/bool instead of address",
104
- mitigation: "Use a Guard with an address-typed identifier for recipient, OR switch to Entity/Signer recipient.",
105
- evidence: `guard_add[${i}].recipient.GuardIdentifier=${id}, is_address=false`,
106
- related_move_error: "E_RECIPIENT_IDENTIFIER_NOT_ADDRESS (4)",
107
- auto_fixable: false,
108
- };
109
- }
110
- }
111
- }
112
- return null;
113
- },
114
- };
115
- const R_R_2_02 = {
116
- id: "R-R-2-02",
117
- category: "semantic",
118
- trigger: "guard_add with GuardU64Identifier amount where identifier type is not u64",
119
- check: (ctx) => {
120
- if (!ctx.guard_add)
121
- return null;
122
- for (let i = 0; i < ctx.guard_add.length; i++) {
123
- const g = ctx.guard_add[i];
124
- const amountTypeStr = String(g.amount.type).toUpperCase();
125
- if (amountTypeStr === "GUARDU64IDENTIFIER" || amountTypeStr === "GUARD_U64_IDENTIFIER") {
126
- if (typeof g.amount.value !== "number")
127
- continue;
128
- const id = g.amount.value;
129
- if (ctx.passport_submission_value_types && ctx.passport_submission_value_types[id] !== "u64") {
130
- return {
131
- id: "R-R-2-02",
132
- level: "HIGH",
133
- category: "semantic",
134
- title: `guard_add[${i}]: amount GuardU64Identifier ${id} is not u64-typed`,
135
- description: `RewardGuard constructor calls get_submission_value_type(guard, ${id}); if None or ≠ TYPE_U64, ` +
136
- `Move aborts with E_AMOUNT_NOT_U64 (5).`,
137
- affected_stakeholders: ["owner"],
138
- scenario: "Misconfigured Guard — amount identifier is not u64-typed",
139
- mitigation: "Use a Guard with a u64-typed identifier for amount, OR switch to Fixed amount.",
140
- evidence: `guard_add[${i}].amount.value=${id}, value_type=${ctx.passport_submission_value_types[id] ?? "unknown"}`,
141
- related_move_error: "E_AMOUNT_NOT_U64 (5)",
142
- auto_fixable: false,
143
- };
144
- }
145
- }
146
- }
147
- return null;
148
- },
149
- };
150
- const R_R_2_03 = {
151
- id: "R-R-2-03",
152
- category: "semantic",
153
- trigger: "guard_add with store_from_id set but identifier is not number/address compatible",
154
- check: (ctx) => {
155
- if (!ctx.guard_add)
156
- return null;
157
- for (let i = 0; i < ctx.guard_add.length; i++) {
158
- const g = ctx.guard_add[i];
159
- if (g.store_from_id == null)
160
- continue;
161
- if (ctx.guard_store_from_id_compatible && ctx.guard_store_from_id_compatible[g.guard] === false) {
162
- return {
163
- id: "R-R-2-03",
164
- level: "MEDIUM",
165
- category: "semantic",
166
- title: `guard_add[${i}]: store_from_id incompatible with guard`,
167
- description: `RewardGuard constructor with store_from_id=Some calls is_identifier_address_compatible(guard, store_from_id). ` +
168
- `If the identifier type is not number or address, Move aborts with E_STORE_FROM_ID_NOT_COMPATIBLE (12).`,
169
- affected_stakeholders: ["owner"],
170
- scenario: "Misconfigured Guard — store_from_id points to a non-address/non-number identifier",
171
- mitigation: "Use a compatible identifier, OR drop store_from_id (set to null) if cross-reference is not needed.",
172
- evidence: `guard=${g.guard}, store_from_id=${g.store_from_id}`,
173
- related_move_error: "E_STORE_FROM_ID_NOT_COMPATIBLE (12)",
174
- auto_fixable: true,
175
- };
176
- }
177
- }
178
- return null;
179
- },
180
- };
181
- const R_R_2_04 = {
182
- id: "R-R-2-04",
183
- category: "semantic",
184
- trigger: "guard_add with invalid Recipient × Amount pairing (no matching constructor)",
185
- check: (ctx) => {
186
- if (!ctx.guard_add)
187
- return null;
188
- const recipientTypeMap = {
189
- GuardIdentifier: "GuardIdentifier",
190
- Entity: "Entity",
191
- Signer: "Signer",
192
- };
193
- for (let i = 0; i < ctx.guard_add.length; i++) {
194
- const g = ctx.guard_add[i];
195
- const recipientKey = Object.keys(g.recipient)[0];
196
- const recipientType = recipientTypeMap[recipientKey];
197
- const amountTypeStr = String(g.amount.type).toUpperCase();
198
- const amountType = amountTypeStr === "FIXED" ? "Fixed" : "GuardU64Identifier";
199
- const constructor = resolveGuardConstructor(recipientType, amountType);
200
- if (!constructor) {
201
- return {
202
- id: "R-R-2-04",
203
- level: "HIGH",
204
- category: "semantic",
205
- title: `guard_add[${i}]: invalid Recipient × Amount pairing`,
206
- description: `recipient=${recipientType}, amount=${amountType} — no matching Move constructor. ` +
207
- `SDK reward_guard() will W_ERROR with "Invalid recipient or amount type combination".`,
208
- affected_stakeholders: ["owner"],
209
- scenario: "Schema validation bypassed or stale client",
210
- mitigation: "Use one of the 6 valid pairings: guard_u8_u8, guard_u8_u64, guard_entity_u8, guard_entity_u64, guard_signer_u8, guard_signer_u64.",
211
- evidence: `recipient=${recipientType}, amount=${amountType}`,
212
- auto_fixable: false,
213
- };
214
- }
215
- }
216
- return null;
217
- },
218
- };
219
- const R_R_3_01 = {
220
- id: "R-R-3-01",
221
- category: "permission",
222
- trigger: "claim attempted without permission context — claim is passport-driven",
223
- check: (ctx) => {
224
- if (!ctx.claim)
225
- return null;
226
- return {
227
- id: "R-R-3-01",
228
- level: "MEDIUM",
229
- category: "permission",
230
- title: "claim is permission-free — anyone with a valid Passport can claim",
231
- description: `reward::claim() does NOT assert any permission index. Eligibility is determined entirely by the ` +
232
- `Guard verification (passport::result_for_guard). If the Guard is too permissive, funds can be drained by anyone.`,
233
- affected_stakeholders: ["owner", "service_provider"],
234
- scenario: "Loose Guard allows unauthorized claims (e.g. time-only Guard without service binding)",
235
- mitigation: "1) Use Guards that bind to specific Service/Order context. 2) Set expiration_time. 3) Monitor balance and refill only what's needed.",
236
- evidence: `claim=${ctx.claim}`,
237
- auto_fixable: false,
238
- };
239
- },
240
- };
241
- const R_R_3_02 = {
242
- id: "R-R-3-02",
243
- category: "permission",
244
- trigger: "owner_receive (156) — broad blast radius, owner can drain balance",
245
- check: (ctx) => {
246
- if (ctx.owner_receive == null)
247
- return null;
248
- return {
249
- id: "R-R-3-02",
250
- level: "HIGH",
251
- category: "permission",
252
- title: "owner_receive drains balance to Permission owner",
253
- description: `reward::owner_receive (156 permission) unwraps Receiving<K> / CoinWrapper<K> and forwards to Permission owner. ` +
254
- `If 156 is granted too broadly, any 156-holder can sweep receivables. (Note: owner_receive does NOT directly drain balance — ` +
255
- `only Receiving<K> envelopes sent to the Reward's id.)`,
256
- affected_stakeholders: ["owner", "service_provider"],
257
- scenario: "Compromised 156-holder sweeps receivables before owner",
258
- mitigation: "1) Grant 156 only to the Permission owner address. 2) Reconcile Receiving<K> inflows vs owner_receive events.",
259
- evidence: `owner_receive set`,
260
- auto_fixable: false,
261
- };
262
- },
263
- };
264
- const R_R_3_03 = {
265
- id: "R-R-3-03",
266
- category: "permission",
267
- trigger: "guard_expiration_time_add (155) — can permanently lock guard additions",
268
- check: (ctx) => {
269
- if (ctx.guard_expiration_time === undefined)
270
- return null;
271
- if (ctx.guard_expiration_time !== null && ctx.current_clock_ms !== undefined) {
272
- const lockDurationMs = ctx.guard_expiration_time - ctx.current_clock_ms;
273
- const oneYearMs = 365 * 24 * 60 * 60 * 1000;
274
- if (lockDurationMs > oneYearMs) {
275
- return {
276
- id: "R-R-3-03",
277
- level: "MEDIUM",
278
- category: "permission",
279
- title: "guard_expiration_time_add locks guard additions for > 1 year",
280
- description: `Setting guard_not_added_expiration_time to ${ctx.guard_expiration_time} ` +
281
- `(> 1 year from now) effectively freezes the guard list. While this is sometimes intentional ` +
282
- `(milestone rewards), it cannot be undone without setting a new time (which itself requires 155 permission).`,
283
- affected_stakeholders: ["owner"],
284
- scenario: "Operator sets excessively long lock period by mistake",
285
- mitigation: "Confirm intent. If wrong, call guard_expiration_time_add again with a shorter time (must be ≥ current clock per E_GUARD_LOCKED_TIME_NOT_INCREASING).",
286
- evidence: `lock_until=${ctx.guard_expiration_time}, clock=${ctx.current_clock_ms}`,
287
- auto_fixable: false,
288
- };
289
- }
290
- }
291
- return null;
292
- },
293
- };
294
- const R_R_4_01 = {
295
- id: "R-R-4-01",
296
- category: "lifecycle",
297
- trigger: "claim on guard with expiration_time < now (E_GUARD_EXPIRED)",
298
- check: (ctx) => {
299
- if (!ctx.claim)
300
- return null;
301
- return null;
302
- },
303
- };
304
- const R_R_4_02 = {
305
- id: "R-R-4-02",
306
- category: "lifecycle",
307
- trigger: "claim: balance < amount (E_INSUFFICIENT_BALANCE)",
308
- check: (ctx) => {
309
- if (!ctx.claim)
310
- return null;
311
- if (ctx.current_balance !== undefined && ctx.current_guard_count !== undefined) {
312
- const balance = BigInt(ctx.current_balance);
313
- if (balance === 0n) {
314
- return {
315
- id: "R-R-4-02",
316
- level: "HIGH",
317
- category: "lifecycle",
318
- title: "claim on Reward with zero balance",
319
- description: `Reward balance is 0. Any claim will abort with E_INSUFFICIENT_BALANCE (6). ` +
320
- `Owner must coin_add (153) or receive (154) to replenish.`,
321
- affected_stakeholders: ["claimer", "owner"],
322
- scenario: "Marketing campaign budget exhausted but guards remain active",
323
- mitigation: "1) Owner: coin_add to replenish. 2) Owner: guard_remove_expired + guard_expiration_time_add to deactivate. 3) Claimer: wait for replenishment.",
324
- evidence: `balance=0`,
325
- related_move_error: "E_INSUFFICIENT_BALANCE (6)",
326
- auto_fixable: false,
327
- };
328
- }
329
- }
330
- return null;
331
- },
332
- };
333
- const R_R_4_03 = {
334
- id: "R-R-4-03",
335
- category: "lifecycle",
336
- trigger: "guard_add while guard_not_added_expiration_time is Some and clock ≤ expiration (E_GUARD_LOCKED_TIME)",
337
- check: (ctx) => {
338
- if (!ctx.guard_add || ctx.guard_add.length === 0)
339
- return null;
340
- if (ctx.current_guard_not_added_expiration_time == null)
341
- return null;
342
- if (ctx.current_clock_ms === undefined)
343
- return null;
344
- if (ctx.current_clock_ms <= ctx.current_guard_not_added_expiration_time) {
345
- return {
346
- id: "R-R-4-03",
347
- level: "HIGH",
348
- category: "lifecycle",
349
- title: "guard_add blocked by time-lock (guard_not_added_expiration_time)",
350
- description: `guard_not_added_expiration_time is Some(${ctx.current_guard_not_added_expiration_time}); ` +
351
- `clock is ${ctx.current_clock_ms}. Move asserts clock > expiration_time ` +
352
- `(E_GUARD_LOCKED_TIME = 10).`,
353
- affected_stakeholders: ["owner"],
354
- scenario: "Trying to add guards during a flash sale lock period",
355
- mitigation: "1) Wait until clock > expiration_time. 2) Call guard_expiration_time_add (155) to extend the lock (cannot shorten below current clock).",
356
- evidence: `lock_until=${ctx.current_guard_not_added_expiration_time}, clock=${ctx.current_clock_ms}`,
357
- related_move_error: "E_GUARD_LOCKED_TIME (10)",
358
- auto_fixable: false,
359
- };
360
- }
361
- return null;
362
- },
363
- };
364
- const R_R_4_04 = {
365
- id: "R-R-4-04",
366
- category: "lifecycle",
367
- trigger: "guard_expiration_time_add regression (new time < current clock)",
368
- check: (ctx) => {
369
- if (ctx.guard_expiration_time === undefined)
370
- return null;
371
- if (ctx.guard_expiration_time === null)
372
- return null;
373
- if (ctx.current_clock_ms === undefined)
374
- return null;
375
- if (ctx.guard_expiration_time <= ctx.current_clock_ms) {
376
- return {
377
- id: "R-R-4-04",
378
- level: "HIGH",
379
- category: "lifecycle",
380
- title: "guard_expiration_time_add: new time must be in the future",
381
- description: `New guard_not_added_expiration_time = ${ctx.guard_expiration_time} ≤ clock ${ctx.current_clock_ms}. ` +
382
- `Move aborts with E_GUARD_LOCKED_TIME_INVALID (11).`,
383
- affected_stakeholders: ["owner"],
384
- scenario: "Operator sets lock time in the past by mistake",
385
- mitigation: `Set guard_expiration_time to a value > ${ctx.current_clock_ms} (current clock).`,
386
- evidence: `new_time=${ctx.guard_expiration_time}, clock=${ctx.current_clock_ms}`,
387
- related_move_error: "E_GUARD_LOCKED_TIME_INVALID (11)",
388
- auto_fixable: true,
389
- };
390
- }
391
- return null;
392
- },
393
- };
394
- const R_R_5_01 = {
395
- id: "R-R-5-01",
396
- category: "cross_object",
397
- trigger: "claim: guard not found in self.guards (E_GUARD_NOT_FOUND)",
398
- check: (ctx) => {
399
- if (!ctx.claim)
400
- return null;
401
- if (!ctx.target_guard_addresses)
402
- return null;
403
- if (!ctx.target_guard_addresses.includes(ctx.claim)) {
404
- return {
405
- id: "R-R-5-01",
406
- level: "HIGH",
407
- category: "cross_object",
408
- title: "claim: supplied guard not in Reward.guards",
409
- description: `Guard ${ctx.claim} is not in the Reward's guard list. Move iterates self.guards and ` +
410
- `aborts with E_GUARD_NOT_FOUND (7) if no match.`,
411
- affected_stakeholders: ["claimer"],
412
- scenario: "Claimer uses the wrong Guard object (typo or wrong Service)",
413
- mitigation: "1) Verify the Guard address via query ObjectReward. 2) Ensure the Guard was added via guard_add (152).",
414
- evidence: `claim_guard=${ctx.claim}, known_guards=${ctx.target_guard_addresses.join(",")}`,
415
- related_move_error: "E_GUARD_NOT_FOUND (7)",
416
- auto_fixable: false,
417
- };
418
- }
419
- return null;
420
- },
421
- };
422
- const R_R_5_02 = {
423
- id: "R-R-5-02",
424
- category: "cross_object",
425
- trigger: "coin_add: coin type T mismatch with Reward<T>",
426
- check: (ctx) => {
427
- if (!ctx.coin_add || !ctx.reward_type)
428
- return null;
429
- if (ctx.coin_add.coin_type !== ctx.reward_type) {
430
- return {
431
- id: "R-R-5-02",
432
- level: "CRITICAL",
433
- category: "cross_object",
434
- title: "coin_add: coin type T mismatch",
435
- description: `Reward is Reward<${ctx.reward_type}> but coin_add passes Coin<${ctx.coin_add.coin_type}>. ` +
436
- `Move type-system mismatch; SDK W_ERROR in operate().`,
437
- affected_stakeholders: ["owner"],
438
- scenario: "Operator tries to deposit wrong coin type (e.g. USDC into a WOW Reward)",
439
- mitigation: `Use Coin<${ctx.reward_type}> for coin_add.`,
440
- evidence: `reward_type=${ctx.reward_type}, coin_type=${ctx.coin_add.coin_type}`,
441
- auto_fixable: false,
442
- };
443
- }
444
- return null;
445
- },
446
- };
447
- const R_R_5_03 = {
448
- id: "R-R-5-03",
449
- category: "cross_object",
450
- trigger: "receive: Payment<T> type mismatch with Reward<T>",
451
- check: (ctx) => {
452
- if (!ctx.receive || !ctx.reward_type)
453
- return null;
454
- if (ctx.receive.token_type !== ctx.reward_type) {
455
- return {
456
- id: "R-R-5-03",
457
- level: "CRITICAL",
458
- category: "cross_object",
459
- title: "receive: Payment token_type mismatch",
460
- description: `Reward is Reward<${ctx.reward_type}> but receive's Payment<CoinWrapper<${ctx.receive.token_type}>>. ` +
461
- `SDK W_ERROR in operate().`,
462
- affected_stakeholders: ["owner"],
463
- scenario: "Operator tries to receive wrong-token Payment",
464
- mitigation: `Use Payment<${ctx.reward_type}> for receive.`,
465
- evidence: `reward_type=${ctx.reward_type}, payment_token=${ctx.receive.token_type}`,
466
- auto_fixable: false,
467
- };
468
- }
469
- return null;
470
- },
471
- };
472
- const R_R_6_01 = {
473
- id: "R-R-6-01",
474
- category: "business_semantic",
475
- trigger: "intent mentions praise/positive-review but Guard checks non-wonder progress node",
476
- check: (ctx) => {
477
- if (!ctx.user_intent_phrases || ctx.user_intent_phrases.length === 0)
478
- return null;
479
- if (!ctx.guard_expected_progress_state)
480
- return null;
481
- const intentLower = ctx.user_intent_phrases.join(" ").toLowerCase();
482
- const praiseKeywords = [
483
- "praise", "wonder", "thumbs_up",
484
- "positive review", "satisfaction reward", "praise reward",
485
- ];
486
- const isPraiseIntent = praiseKeywords.some(kw => intentLower.includes(kw.toLowerCase()));
487
- if (!isPraiseIntent)
488
- return null;
489
- if (ctx.machine_has_wonder_node === false)
490
- return null;
491
- const expected = ctx.guard_expected_progress_state;
492
- if (expected !== "wonder") {
493
- return {
494
- id: "R-R-6-01",
495
- level: "HIGH",
496
- category: "business_semantic",
497
- title: `Guard checks progress=="${expected}" but intent indicates praise reward (wonder node)`,
498
- description: `User intent mentions praise/positive-review/wonder, which maps to the 'wonder' progress node ` +
499
- `(customer gives positive review AFTER service completion). But the Guard's table bakes ` +
500
- `expected state="${expected}", allowing reward claim at the wrong lifecycle stage. ` +
501
- `This violates the business semantics: "praise reward" should only be claimable AFTER the ` +
502
- `customer advances to the 'wonder' node, not before. ` +
503
- `Guard is immutable — fixing this requires creating a new Guard + Reward pair.`,
504
- affected_stakeholders: ["owner", "service_provider", "claimer"],
505
- scenario: "Designer builds Guard checking 'completed' instead of 'wonder' for a praise reward",
506
- mitigation: "Set the Guard table's expected progress state to 'wonder' (the positive-review node). " +
507
- "The correct pattern: ordered → in_service → completed → wonder (praise) triggers reward claim. " +
508
- "Reference: reward-templates.ts wonder_praise template.",
509
- evidence: `intent="${intentLower}", expected_state="${expected}", expected_wonder=true`,
510
- auto_fixable: false,
511
- };
512
- }
513
- return null;
514
- },
515
- };
516
- const R_R_6_02 = {
517
- id: "R-R-6-02",
518
- category: "business_semantic",
519
- trigger: "Guard checks wonder node but intent does not mention praise",
520
- check: (ctx) => {
521
- if (!ctx.user_intent_phrases || ctx.user_intent_phrases.length === 0)
522
- return null;
523
- if (!ctx.guard_expected_progress_state)
524
- return null;
525
- if (ctx.guard_expected_progress_state !== "wonder")
526
- return null;
527
- const intentLower = ctx.user_intent_phrases.join(" ").toLowerCase();
528
- const praiseKeywords = [
529
- "praise", "wonder", "thumbs_up",
530
- "positive review", "satisfaction reward", "praise reward",
531
- ];
532
- const isPraiseIntent = praiseKeywords.some(kw => intentLower.includes(kw.toLowerCase()));
533
- if (isPraiseIntent)
534
- return null;
535
- return {
536
- id: "R-R-6-02",
537
- level: "MEDIUM",
538
- category: "business_semantic",
539
- title: "Guard checks wonder node but intent does not mention praise",
540
- description: `Guard's expected progress state is "wonder" (positive-review node), but the user intent ` +
541
- `does not mention any praise/positive-review keyword. This may be a copy-paste from a wonder_praise ` +
542
- `template without adjusting the Guard for the actual business semantics. If this is a ` +
543
- `general feedback reward (wonder_feedback), this is fine. Otherwise, verify the node choice.`,
544
- affected_stakeholders: ["owner"],
545
- scenario: "Designer copies wonder_praise template but actually wants a completion-based reward",
546
- mitigation: "Verify: if intent is praise reward, add 'praise/positive review' to description. " +
547
- "If intent is completion-based reward, change Guard to check 'completed' node.",
548
- evidence: `expected_state="wonder", intent="${intentLower}" (no praise keyword)`,
549
- auto_fixable: false,
550
- };
551
- },
552
- };
553
- const ALL_RULES = [
554
- R_R_1_01, R_R_1_02, R_R_1_03,
555
- R_R_2_01, R_R_2_02, R_R_2_03, R_R_2_04,
556
- R_R_3_01, R_R_3_02, R_R_3_03,
557
- R_R_4_01, R_R_4_02, R_R_4_03, R_R_4_04,
558
- R_R_5_01, R_R_5_02, R_R_5_03,
559
- R_R_6_01, R_R_6_02,
560
- ];
561
- export const REWARD_RISK_VERSION = "1.0.0";
562
- export function getAllRewardRiskRules() {
563
- return [...ALL_RULES];
564
- }
565
- export function getRewardRiskRulesCount() {
566
- return ALL_RULES.length;
567
- }
568
- export function getRewardRiskRulesByCategory(category) {
569
- return ALL_RULES.filter(r => r.category === category);
570
- }
571
- export function assessRewardRisks(ctx) {
572
- const risks = [];
573
- for (const rule of ALL_RULES) {
574
- const r = rule.check(ctx);
575
- if (r)
576
- risks.push(r);
577
- }
578
- const overall = risks.length === 0
579
- ? "LOW"
580
- : risks.some(r => r.level === "CRITICAL") ? "CRITICAL"
581
- : risks.some(r => r.level === "HIGH") ? "HIGH"
582
- : risks.some(r => r.level === "MEDIUM") ? "MEDIUM"
583
- : "LOW";
584
- const byCategory = {};
585
- for (const r of risks) {
586
- byCategory[r.category] = (byCategory[r.category] ?? 0) + 1;
587
- }
588
- const advice = {};
589
- for (const r of risks) {
590
- for (const s of r.affected_stakeholders) {
591
- if (!advice[s])
592
- advice[s] = [];
593
- advice[s].push(`${r.id}: ${r.mitigation}`);
594
- }
595
- }
596
- return {
597
- summary: `Assessed ${risks.length} risk(s) across ${Object.keys(byCategory).length} categories`,
598
- risks,
599
- overall_risk: overall,
600
- risks_by_category: byCategory,
601
- stakeholder_advice: advice,
602
- needs_human_review: risks.some(r => r.level === "CRITICAL" || r.level === "HIGH"),
603
- };
604
- }
605
- export const REWARD_STAKEHOLDERS = [
606
- "owner",
607
- "claimer",
608
- "service_provider",
609
- "system",
610
- ];
611
- export function getRewardRiskRulesByStakeholder(stakeholder) {
612
- return ALL_RULES.filter(rule => {
613
- if (stakeholder === "owner") {
614
- return ["structural", "permission", "lifecycle", "business_semantic"].includes(rule.category);
615
- }
616
- if (stakeholder === "claimer") {
617
- return rule.id.startsWith("R-R-4-0") || rule.id === "R-R-5-01" || rule.id === "R-R-1-02" || rule.id === "R-R-6-01";
618
- }
619
- if (stakeholder === "service_provider") {
620
- return rule.id === "R-R-4-02" || rule.id === "R-R-3-01" || rule.id === "R-R-3-02" || rule.id === "R-R-6-01";
621
- }
622
- if (stakeholder === "system") {
623
- return rule.category === "cross_object";
624
- }
625
- return false;
626
- });
627
- }
1
+ import{MAX_GUARD_COUNT_REWARD,MAX_RECORD_COUNT_REWARD}from'./onchain-constants.js';import{resolveGuardConstructor}from'./reward-ledger.js';const R_R_1_01={'id':'R-R-1-01','category':'structural','trigger':'guard_add\x20would\x20exceed\x20MAX_GUARD_COUNT_REWARD\x20(200)','check':a=>{if(!a['guard_add']||a['guard_add']['length']===0x0)return null;const b=a['current_guard_count']??0x0,c=a['guard_add']['length'];if(b+c>MAX_GUARD_COUNT_REWARD)return{'id':'R-R-1-01','level':'HIGH','category':'structural','title':'guard_add\x20would\x20exceed\x20MAX_GUARD_COUNT_REWARD','description':'Reward\x20has\x20'+b+'\x20guards,\x20adding\x20'+c+'\x20would\x20total\x20'+(b+c)+',\x20'+('exceeds\x20MAX_GUARD_COUNT_REWARD\x20'+MAX_GUARD_COUNT_REWARD+'.\x20Move\x20aborts\x20with\x20E_GUARD_COUNT_EXCEEDED\x20(3).'),'affected_stakeholders':['owner','service_provider'],'scenario':'Adding\x20too\x20many\x20guards\x20to\x20a\x20single\x20Reward\x20(e.g.\x20milestone\x20reward\x20with\x20>\x20200\x20recipients)','mitigation':'Split\x20into\x20multiple\x20Reward\x20objects,\x20or\x20use\x20GuardIdentifier\x20recipient\x20to\x20handle\x20multiple\x20recipients\x20with\x20a\x20single\x20guard.','evidence':'current='+b+',\x20add='+c,'related_move_error':'E_GUARD_COUNT_EXCEEDED\x20(3)','auto_fixable':![]};return null;}},R_R_1_02={'id':'R-R-1-02','category':'structural','trigger':'claim\x20would\x20push\x20recipient\x20record\x20count\x20to\x20MAX_RECORD_COUNT_REWARD\x20(5200)','check':a=>{if(!a['claim'])return null;const b=a['current_record_count_for_recipient']??0x0;if(b>=MAX_RECORD_COUNT_REWARD)return{'id':'R-R-1-02','level':'HIGH','category':'structural','title':'claim\x20blocked\x20—\x20recipient\x20record\x20count\x20at\x20limit','description':'Recipient\x20already\x20has\x20'+b+'\x20records,\x20at\x20MAX_RECORD_COUNT_REWARD\x20'+MAX_RECORD_COUNT_REWARD+'.\x20'+'Next\x20claim\x20will\x20abort\x20with\x20E_RECORD_COUNT_EXCEEDED\x20(8).\x20The\x20recipient\x20can\x20no\x20longer\x20claim\x20from\x20this\x20Reward.','affected_stakeholders':['claimer'],'scenario':'High-frequency\x20claimer\x20hits\x20the\x205200-record\x20ceiling\x20(e.g.\x20cashback\x20on\x20every\x20micro-order)','mitigation':'Owner\x20can\x20create\x20a\x20new\x20Reward\x20for\x20the\x20same\x20recipient,\x20OR\x20redesign\x20the\x20Guard\x20to\x20batch\x20claims\x20(larger\x20amount\x20per\x20claim).','evidence':'recipient_records='+b,'related_move_error':'E_RECORD_COUNT_EXCEEDED\x20(8)','auto_fixable':![]};return null;}},R_R_1_03={'id':'R-R-1-03','category':'structural','trigger':'guard_add\x20batch\x20size\x20>\x20MAX_GUARD_COUNT_REWARD\x20(200)\x20—\x20schema-level\x20overflow','check':a=>{if(!a['guard_add'])return null;if(a['guard_add']['length']>MAX_GUARD_COUNT_REWARD)return{'id':'R-R-1-03','level':'CRITICAL','category':'structural','title':'guard_add\x20batch\x20exceeds\x20absolute\x20limit','description':'Single\x20guard_add\x20call\x20tries\x20to\x20add\x20'+a['guard_add']['length']+'\x20guards\x20in\x20one\x20transaction,\x20'+('exceeds\x20MAX_GUARD_COUNT_REWARD\x20'+MAX_GUARD_COUNT_REWARD+'.\x20SDK\x20rejects\x20this\x20in\x20operate().'),'affected_stakeholders':['owner'],'scenario':'Bulk\x20guard\x20addition\x20without\x20splitting\x20transactions','mitigation':'Split\x20into\x20multiple\x20transactions,\x20each\x20≤\x20'+MAX_GUARD_COUNT_REWARD+'\x20new\x20guards.','evidence':'batch_size='+a['guard_add']['length'],'auto_fixable':!![]};return null;}},R_R_2_01={'id':'R-R-2-01','category':'semantic','trigger':'guard_add\x20with\x20GuardIdentifier\x20recipient\x20where\x20identifier\x20type\x20is\x20not\x20address','check':a=>{if(!a['guard_add'])return null;for(let b=0x0;b<a['guard_add']['length'];b++){const c=a['guard_add'][b];if('GuardIdentifier'in c['recipient']){const d=c['recipient']['GuardIdentifier'];if(a['passport_identifier_is_address']&&a['passport_identifier_is_address'][d]===![])return{'id':'R-R-2-01','level':'HIGH','category':'semantic','title':'guard_add['+b+']:\x20recipient\x20GuardIdentifier\x20'+d+'\x20is\x20not\x20address-typed','description':'RewardGuard\x20constructor\x20calls\x20is_identifier_address(guard,\x20'+d+').\x20If\x20the\x20identifier\x20type\x20is\x20not\x20address,\x20'+'Move\x20aborts\x20with\x20E_RECIPIENT_IDENTIFIER_NOT_ADDRESS\x20(4).','affected_stakeholders':['owner'],'scenario':'Misconfigured\x20Guard\x20—\x20recipient\x20identifier\x20is\x20u64/bool\x20instead\x20of\x20address','mitigation':'Use\x20a\x20Guard\x20with\x20an\x20address-typed\x20identifier\x20for\x20recipient,\x20OR\x20switch\x20to\x20Entity/Signer\x20recipient.','evidence':'guard_add['+b+'].recipient.GuardIdentifier='+d+',\x20is_address=false','related_move_error':'E_RECIPIENT_IDENTIFIER_NOT_ADDRESS\x20(4)','auto_fixable':![]};}}return null;}},R_R_2_02={'id':'R-R-2-02','category':'semantic','trigger':'guard_add\x20with\x20GuardU64Identifier\x20amount\x20where\x20identifier\x20type\x20is\x20not\x20u64','check':a=>{if(!a['guard_add'])return null;for(let b=0x0;b<a['guard_add']['length'];b++){const c=a['guard_add'][b],d=String(c['amount']['type'])['toUpperCase']();if(d==='GUARDU64IDENTIFIER'||d==='GUARD_U64_IDENTIFIER'){if(typeof c['amount']['value']!=='number')continue;const e=c['amount']['value'];if(a['passport_submission_value_types']&&a['passport_submission_value_types'][e]!=='u64')return{'id':'R-R-2-02','level':'HIGH','category':'semantic','title':'guard_add['+b+']:\x20amount\x20GuardU64Identifier\x20'+e+'\x20is\x20not\x20u64-typed','description':'RewardGuard\x20constructor\x20calls\x20get_submission_value_type(guard,\x20'+e+');\x20if\x20None\x20or\x20≠\x20TYPE_U64,\x20'+'Move\x20aborts\x20with\x20E_AMOUNT_NOT_U64\x20(5).','affected_stakeholders':['owner'],'scenario':'Misconfigured\x20Guard\x20—\x20amount\x20identifier\x20is\x20not\x20u64-typed','mitigation':'Use\x20a\x20Guard\x20with\x20a\x20u64-typed\x20identifier\x20for\x20amount,\x20OR\x20switch\x20to\x20Fixed\x20amount.','evidence':'guard_add['+b+'].amount.value='+e+',\x20value_type='+(a['passport_submission_value_types'][e]??'unknown'),'related_move_error':'E_AMOUNT_NOT_U64\x20(5)','auto_fixable':![]};}}return null;}},R_R_2_03={'id':'R-R-2-03','category':'semantic','trigger':'guard_add\x20with\x20store_from_id\x20set\x20but\x20identifier\x20is\x20not\x20number/address\x20compatible','check':a=>{if(!a['guard_add'])return null;for(let b=0x0;b<a['guard_add']['length'];b++){const c=a['guard_add'][b];if(c['store_from_id']==null)continue;if(a['guard_store_from_id_compatible']&&a['guard_store_from_id_compatible'][c['guard']]===![])return{'id':'R-R-2-03','level':'MEDIUM','category':'semantic','title':'guard_add['+b+']:\x20store_from_id\x20incompatible\x20with\x20guard','description':'RewardGuard\x20constructor\x20with\x20store_from_id=Some\x20calls\x20is_identifier_address_compatible(guard,\x20store_from_id).\x20'+'If\x20the\x20identifier\x20type\x20is\x20not\x20number\x20or\x20address,\x20Move\x20aborts\x20with\x20E_STORE_FROM_ID_NOT_COMPATIBLE\x20(12).','affected_stakeholders':['owner'],'scenario':'Misconfigured\x20Guard\x20—\x20store_from_id\x20points\x20to\x20a\x20non-address/non-number\x20identifier','mitigation':'Use\x20a\x20compatible\x20identifier,\x20OR\x20drop\x20store_from_id\x20(set\x20to\x20null)\x20if\x20cross-reference\x20is\x20not\x20needed.','evidence':'guard='+c['guard']+',\x20store_from_id='+c['store_from_id'],'related_move_error':'E_STORE_FROM_ID_NOT_COMPATIBLE\x20(12)','auto_fixable':!![]};}return null;}},R_R_2_04={'id':'R-R-2-04','category':'semantic','trigger':'guard_add\x20with\x20invalid\x20Recipient\x20×\x20Amount\x20pairing\x20(no\x20matching\x20constructor)','check':a=>{if(!a['guard_add'])return null;const b={'GuardIdentifier':'GuardIdentifier','Entity':'Entity','Signer':'Signer'};for(let c=0x0;c<a['guard_add']['length'];c++){const d=a['guard_add'][c],e=Object['keys'](d['recipient'])[0x0],f=b[e],h=String(d['amount']['type'])['toUpperCase'](),j=h==='FIXED'?'Fixed':'GuardU64Identifier',k=resolveGuardConstructor(f,j);if(!k)return{'id':'R-R-2-04','level':'HIGH','category':'semantic','title':'guard_add['+c+']:\x20invalid\x20Recipient\x20×\x20Amount\x20pairing','description':'recipient='+f+',\x20amount='+j+'\x20—\x20no\x20matching\x20Move\x20constructor.\x20'+'SDK\x20reward_guard()\x20will\x20W_ERROR\x20with\x20\x22Invalid\x20recipient\x20or\x20amount\x20type\x20combination\x22.','affected_stakeholders':['owner'],'scenario':'Schema\x20validation\x20bypassed\x20or\x20stale\x20client','mitigation':'Use\x20one\x20of\x20the\x206\x20valid\x20pairings:\x20guard_u8_u8,\x20guard_u8_u64,\x20guard_entity_u8,\x20guard_entity_u64,\x20guard_signer_u8,\x20guard_signer_u64.','evidence':'recipient='+f+',\x20amount='+j,'auto_fixable':![]};}return null;}},R_R_3_01={'id':'R-R-3-01','category':'permission','trigger':'claim\x20attempted\x20without\x20permission\x20context\x20—\x20claim\x20is\x20passport-driven','check':a=>{if(!a['claim'])return null;return{'id':'R-R-3-01','level':'MEDIUM','category':'permission','title':'claim\x20is\x20permission-free\x20—\x20anyone\x20with\x20a\x20valid\x20Passport\x20can\x20claim','description':'reward::claim()\x20does\x20NOT\x20assert\x20any\x20permission\x20index.\x20Eligibility\x20is\x20determined\x20entirely\x20by\x20the\x20'+'Guard\x20verification\x20(passport::result_for_guard).\x20If\x20the\x20Guard\x20is\x20too\x20permissive,\x20funds\x20can\x20be\x20drained\x20by\x20anyone.','affected_stakeholders':['owner','service_provider'],'scenario':'Loose\x20Guard\x20allows\x20unauthorized\x20claims\x20(e.g.\x20time-only\x20Guard\x20without\x20service\x20binding)','mitigation':'1)\x20Use\x20Guards\x20that\x20bind\x20to\x20specific\x20Service/Order\x20context.\x202)\x20Set\x20expiration_time.\x203)\x20Monitor\x20balance\x20and\x20refill\x20only\x20what\x27s\x20needed.','evidence':'claim='+a['claim'],'auto_fixable':![]};}},R_R_3_02={'id':'R-R-3-02','category':'permission','trigger':'owner_receive\x20(156)\x20—\x20broad\x20blast\x20radius,\x20owner\x20can\x20drain\x20balance','check':a=>{if(a['owner_receive']==null)return null;return{'id':'R-R-3-02','level':'HIGH','category':'permission','title':'owner_receive\x20drains\x20balance\x20to\x20Permission\x20owner','description':'reward::owner_receive\x20(156\x20permission)\x20unwraps\x20Receiving<K>\x20/\x20CoinWrapper<K>\x20and\x20forwards\x20to\x20Permission\x20owner.\x20'+'If\x20156\x20is\x20granted\x20too\x20broadly,\x20any\x20156-holder\x20can\x20sweep\x20receivables.\x20(Note:\x20owner_receive\x20does\x20NOT\x20directly\x20drain\x20balance\x20—\x20'+'only\x20Receiving<K>\x20envelopes\x20sent\x20to\x20the\x20Reward\x27s\x20id.)','affected_stakeholders':['owner','service_provider'],'scenario':'Compromised\x20156-holder\x20sweeps\x20receivables\x20before\x20owner','mitigation':'1)\x20Grant\x20156\x20only\x20to\x20the\x20Permission\x20owner\x20address.\x202)\x20Reconcile\x20Receiving<K>\x20inflows\x20vs\x20owner_receive\x20events.','evidence':'owner_receive\x20set','auto_fixable':![]};}},R_R_3_03={'id':'R-R-3-03','category':'permission','trigger':'guard_expiration_time_add\x20(155)\x20—\x20can\x20permanently\x20lock\x20guard\x20additions','check':a=>{if(a['guard_expiration_time']===undefined)return null;if(a['guard_expiration_time']!==null&&a['current_clock_ms']!==undefined){const b=a['guard_expiration_time']-a['current_clock_ms'],c=0x16d*0x18*0x3c*0x3c*0x3e8;if(b>c)return{'id':'R-R-3-03','level':'MEDIUM','category':'permission','title':'guard_expiration_time_add\x20locks\x20guard\x20additions\x20for\x20>\x201\x20year','description':'Setting\x20guard_not_added_expiration_time\x20to\x20'+a['guard_expiration_time']+'\x20'+'(>\x201\x20year\x20from\x20now)\x20effectively\x20freezes\x20the\x20guard\x20list.\x20While\x20this\x20is\x20sometimes\x20intentional\x20'+'(milestone\x20rewards),\x20it\x20cannot\x20be\x20undone\x20without\x20setting\x20a\x20new\x20time\x20(which\x20itself\x20requires\x20155\x20permission).','affected_stakeholders':['owner'],'scenario':'Operator\x20sets\x20excessively\x20long\x20lock\x20period\x20by\x20mistake','mitigation':'Confirm\x20intent.\x20If\x20wrong,\x20call\x20guard_expiration_time_add\x20again\x20with\x20a\x20shorter\x20time\x20(must\x20be\x20≥\x20current\x20clock\x20per\x20E_GUARD_LOCKED_TIME_NOT_INCREASING).','evidence':'lock_until='+a['guard_expiration_time']+',\x20clock='+a['current_clock_ms'],'auto_fixable':![]};}return null;}},R_R_4_01={'id':'R-R-4-01','category':'lifecycle','trigger':'claim\x20on\x20guard\x20with\x20expiration_time\x20<\x20now\x20(E_GUARD_EXPIRED)','check':a=>{if(!a['claim'])return null;return null;}},R_R_4_02={'id':'R-R-4-02','category':'lifecycle','trigger':'claim:\x20balance\x20<\x20amount\x20(E_INSUFFICIENT_BALANCE)','check':a=>{if(!a['claim'])return null;if(a['current_balance']!==undefined&&a['current_guard_count']!==undefined){const b=BigInt(a['current_balance']);if(b===0x0n)return{'id':'R-R-4-02','level':'HIGH','category':'lifecycle','title':'claim\x20on\x20Reward\x20with\x20zero\x20balance','description':'Reward\x20balance\x20is\x200.\x20Any\x20claim\x20will\x20abort\x20with\x20E_INSUFFICIENT_BALANCE\x20(6).\x20'+'Owner\x20must\x20coin_add\x20(153)\x20or\x20receive\x20(154)\x20to\x20replenish.','affected_stakeholders':['claimer','owner'],'scenario':'Marketing\x20campaign\x20budget\x20exhausted\x20but\x20guards\x20remain\x20active','mitigation':'1)\x20Owner:\x20coin_add\x20to\x20replenish.\x202)\x20Owner:\x20guard_remove_expired\x20+\x20guard_expiration_time_add\x20to\x20deactivate.\x203)\x20Claimer:\x20wait\x20for\x20replenishment.','evidence':'balance=0','related_move_error':'E_INSUFFICIENT_BALANCE\x20(6)','auto_fixable':![]};}return null;}},R_R_4_03={'id':'R-R-4-03','category':'lifecycle','trigger':'guard_add\x20while\x20guard_not_added_expiration_time\x20is\x20Some\x20and\x20clock\x20≤\x20expiration\x20(E_GUARD_LOCKED_TIME)','check':a=>{if(!a['guard_add']||a['guard_add']['length']===0x0)return null;if(a['current_guard_not_added_expiration_time']==null)return null;if(a['current_clock_ms']===undefined)return null;if(a['current_clock_ms']<=a['current_guard_not_added_expiration_time'])return{'id':'R-R-4-03','level':'HIGH','category':'lifecycle','title':'guard_add\x20blocked\x20by\x20time-lock\x20(guard_not_added_expiration_time)','description':'guard_not_added_expiration_time\x20is\x20Some('+a['current_guard_not_added_expiration_time']+');\x20'+('clock\x20is\x20'+a['current_clock_ms']+'.\x20Move\x20asserts\x20clock\x20>\x20expiration_time\x20')+'(E_GUARD_LOCKED_TIME\x20=\x2010).','affected_stakeholders':['owner'],'scenario':'Trying\x20to\x20add\x20guards\x20during\x20a\x20flash\x20sale\x20lock\x20period','mitigation':'1)\x20Wait\x20until\x20clock\x20>\x20expiration_time.\x202)\x20Call\x20guard_expiration_time_add\x20(155)\x20to\x20extend\x20the\x20lock\x20(cannot\x20shorten\x20below\x20current\x20clock).','evidence':'lock_until='+a['current_guard_not_added_expiration_time']+',\x20clock='+a['current_clock_ms'],'related_move_error':'E_GUARD_LOCKED_TIME\x20(10)','auto_fixable':![]};return null;}},R_R_4_04={'id':'R-R-4-04','category':'lifecycle','trigger':'guard_expiration_time_add\x20regression\x20(new\x20time\x20<\x20current\x20clock)','check':a=>{if(a['guard_expiration_time']===undefined)return null;if(a['guard_expiration_time']===null)return null;if(a['current_clock_ms']===undefined)return null;if(a['guard_expiration_time']<=a['current_clock_ms'])return{'id':'R-R-4-04','level':'HIGH','category':'lifecycle','title':'guard_expiration_time_add:\x20new\x20time\x20must\x20be\x20in\x20the\x20future','description':'New\x20guard_not_added_expiration_time\x20=\x20'+a['guard_expiration_time']+'\x20≤\x20clock\x20'+a['current_clock_ms']+'.\x20'+'Move\x20aborts\x20with\x20E_GUARD_LOCKED_TIME_INVALID\x20(11).','affected_stakeholders':['owner'],'scenario':'Operator\x20sets\x20lock\x20time\x20in\x20the\x20past\x20by\x20mistake','mitigation':'Set\x20guard_expiration_time\x20to\x20a\x20value\x20>\x20'+a['current_clock_ms']+'\x20(current\x20clock).','evidence':'new_time='+a['guard_expiration_time']+',\x20clock='+a['current_clock_ms'],'related_move_error':'E_GUARD_LOCKED_TIME_INVALID\x20(11)','auto_fixable':!![]};return null;}},R_R_5_01={'id':'R-R-5-01','category':'cross_object','trigger':'claim:\x20guard\x20not\x20found\x20in\x20self.guards\x20(E_GUARD_NOT_FOUND)','check':a=>{if(!a['claim'])return null;if(!a['target_guard_addresses'])return null;if(!a['target_guard_addresses']['includes'](a['claim']))return{'id':'R-R-5-01','level':'HIGH','category':'cross_object','title':'claim:\x20supplied\x20guard\x20not\x20in\x20Reward.guards','description':'Guard\x20'+a['claim']+'\x20is\x20not\x20in\x20the\x20Reward\x27s\x20guard\x20list.\x20Move\x20iterates\x20self.guards\x20and\x20'+'aborts\x20with\x20E_GUARD_NOT_FOUND\x20(7)\x20if\x20no\x20match.','affected_stakeholders':['claimer'],'scenario':'Claimer\x20uses\x20the\x20wrong\x20Guard\x20object\x20(typo\x20or\x20wrong\x20Service)','mitigation':'1)\x20Verify\x20the\x20Guard\x20address\x20via\x20query\x20ObjectReward.\x202)\x20Ensure\x20the\x20Guard\x20was\x20added\x20via\x20guard_add\x20(152).','evidence':'claim_guard='+a['claim']+',\x20known_guards='+a['target_guard_addresses']['join'](','),'related_move_error':'E_GUARD_NOT_FOUND\x20(7)','auto_fixable':![]};return null;}},R_R_5_02={'id':'R-R-5-02','category':'cross_object','trigger':'coin_add:\x20coin\x20type\x20T\x20mismatch\x20with\x20Reward<T>','check':a=>{if(!a['coin_add']||!a['reward_type'])return null;if(a['coin_add']['coin_type']!==a['reward_type'])return{'id':'R-R-5-02','level':'CRITICAL','category':'cross_object','title':'coin_add:\x20coin\x20type\x20T\x20mismatch','description':'Reward\x20is\x20Reward<'+a['reward_type']+'>\x20but\x20coin_add\x20passes\x20Coin<'+a['coin_add']['coin_type']+'>.\x20'+'Move\x20type-system\x20mismatch;\x20SDK\x20W_ERROR\x20in\x20operate().','affected_stakeholders':['owner'],'scenario':'Operator\x20tries\x20to\x20deposit\x20wrong\x20coin\x20type\x20(e.g.\x20USDC\x20into\x20a\x20WOW\x20Reward)','mitigation':'Use\x20Coin<'+a['reward_type']+'>\x20for\x20coin_add.','evidence':'reward_type='+a['reward_type']+',\x20coin_type='+a['coin_add']['coin_type'],'auto_fixable':![]};return null;}},R_R_5_03={'id':'R-R-5-03','category':'cross_object','trigger':'receive:\x20Payment<T>\x20type\x20mismatch\x20with\x20Reward<T>','check':a=>{if(!a['receive']||!a['reward_type'])return null;if(a['receive']['token_type']!==a['reward_type'])return{'id':'R-R-5-03','level':'CRITICAL','category':'cross_object','title':'receive:\x20Payment\x20token_type\x20mismatch','description':'Reward\x20is\x20Reward<'+a['reward_type']+'>\x20but\x20receive\x27s\x20Payment<CoinWrapper<'+a['receive']['token_type']+'>>.\x20'+'SDK\x20W_ERROR\x20in\x20operate().','affected_stakeholders':['owner'],'scenario':'Operator\x20tries\x20to\x20receive\x20wrong-token\x20Payment','mitigation':'Use\x20Payment<'+a['reward_type']+'>\x20for\x20receive.','evidence':'reward_type='+a['reward_type']+',\x20payment_token='+a['receive']['token_type'],'auto_fixable':![]};return null;}},R_R_6_01={'id':'R-R-6-01','category':'business_semantic','trigger':'intent\x20mentions\x20praise/positive-review\x20but\x20Guard\x20checks\x20non-wonder\x20progress\x20node','check':a=>{if(!a['user_intent_phrases']||a['user_intent_phrases']['length']===0x0)return null;if(!a['guard_expected_progress_state'])return null;const b=a['user_intent_phrases']['join']('\x20')['toLowerCase'](),c=['praise','wonder','thumbs_up','positive\x20review','satisfaction\x20reward','praise\x20reward'],d=c['some'](f=>b['includes'](f['toLowerCase']()));if(!d)return null;if(a['machine_has_wonder_node']===![])return null;const e=a['guard_expected_progress_state'];if(e!=='wonder')return{'id':'R-R-6-01','level':'HIGH','category':'business_semantic','title':'Guard\x20checks\x20progress==\x22'+e+'\x22\x20but\x20intent\x20indicates\x20praise\x20reward\x20(wonder\x20node)','description':'User\x20intent\x20mentions\x20praise/positive-review/wonder,\x20which\x20maps\x20to\x20the\x20\x27wonder\x27\x20progress\x20node\x20'+'(customer\x20gives\x20positive\x20review\x20AFTER\x20service\x20completion).\x20But\x20the\x20Guard\x27s\x20table\x20bakes\x20'+('expected\x20state=\x22'+e+'\x22,\x20allowing\x20reward\x20claim\x20at\x20the\x20wrong\x20lifecycle\x20stage.\x20')+'This\x20violates\x20the\x20business\x20semantics:\x20\x22praise\x20reward\x22\x20should\x20only\x20be\x20claimable\x20AFTER\x20the\x20'+'customer\x20advances\x20to\x20the\x20\x27wonder\x27\x20node,\x20not\x20before.\x20'+'Guard\x20is\x20immutable\x20—\x20fixing\x20this\x20requires\x20creating\x20a\x20new\x20Guard\x20+\x20Reward\x20pair.','affected_stakeholders':['owner','service_provider','claimer'],'scenario':'Designer\x20builds\x20Guard\x20checking\x20\x27completed\x27\x20instead\x20of\x20\x27wonder\x27\x20for\x20a\x20praise\x20reward','mitigation':'Set\x20the\x20Guard\x20table\x27s\x20expected\x20progress\x20state\x20to\x20\x27wonder\x27\x20(the\x20positive-review\x20node).\x20'+'The\x20correct\x20pattern:\x20ordered\x20→\x20in_service\x20→\x20completed\x20→\x20wonder\x20(praise)\x20triggers\x20reward\x20claim.\x20'+'Reference:\x20reward-templates.ts\x20wonder_praise\x20template.','evidence':'intent=\x22'+b+'\x22,\x20expected_state=\x22'+e+'\x22,\x20expected_wonder=true','auto_fixable':![]};return null;}},R_R_6_02={'id':'R-R-6-02','category':'business_semantic','trigger':'Guard\x20checks\x20wonder\x20node\x20but\x20intent\x20does\x20not\x20mention\x20praise','check':a=>{if(!a['user_intent_phrases']||a['user_intent_phrases']['length']===0x0)return null;if(!a['guard_expected_progress_state'])return null;if(a['guard_expected_progress_state']!=='wonder')return null;const b=a['user_intent_phrases']['join']('\x20')['toLowerCase'](),c=['praise','wonder','thumbs_up','positive\x20review','satisfaction\x20reward','praise\x20reward'],d=c['some'](e=>b['includes'](e['toLowerCase']()));if(d)return null;return{'id':'R-R-6-02','level':'MEDIUM','category':'business_semantic','title':'Guard\x20checks\x20wonder\x20node\x20but\x20intent\x20does\x20not\x20mention\x20praise','description':'Guard\x27s\x20expected\x20progress\x20state\x20is\x20\x22wonder\x22\x20(positive-review\x20node),\x20but\x20the\x20user\x20intent\x20'+'does\x20not\x20mention\x20any\x20praise/positive-review\x20keyword.\x20This\x20may\x20be\x20a\x20copy-paste\x20from\x20a\x20wonder_praise\x20'+'template\x20without\x20adjusting\x20the\x20Guard\x20for\x20the\x20actual\x20business\x20semantics.\x20If\x20this\x20is\x20a\x20'+'general\x20feedback\x20reward\x20(wonder_feedback),\x20this\x20is\x20fine.\x20Otherwise,\x20verify\x20the\x20node\x20choice.','affected_stakeholders':['owner'],'scenario':'Designer\x20copies\x20wonder_praise\x20template\x20but\x20actually\x20wants\x20a\x20completion-based\x20reward','mitigation':'Verify:\x20if\x20intent\x20is\x20praise\x20reward,\x20add\x20\x27praise/positive\x20review\x27\x20to\x20description.\x20'+'If\x20intent\x20is\x20completion-based\x20reward,\x20change\x20Guard\x20to\x20check\x20\x27completed\x27\x20node.','evidence':'expected_state=\x22wonder\x22,\x20intent=\x22'+b+'\x22\x20(no\x20praise\x20keyword)','auto_fixable':![]};}},ALL_RULES=[R_R_1_01,R_R_1_02,R_R_1_03,R_R_2_01,R_R_2_02,R_R_2_03,R_R_2_04,R_R_3_01,R_R_3_02,R_R_3_03,R_R_4_01,R_R_4_02,R_R_4_03,R_R_4_04,R_R_5_01,R_R_5_02,R_R_5_03,R_R_6_01,R_R_6_02];export const REWARD_RISK_VERSION='1.0.0';export function getAllRewardRiskRules(){return[...ALL_RULES];}export function getRewardRiskRulesCount(){return ALL_RULES['length'];}export function getRewardRiskRulesByCategory(a){return ALL_RULES['filter'](b=>b['category']===a);}export function assessRewardRisks(a){const b=[];for(const f of ALL_RULES){const g=f['check'](a);if(g)b['push'](g);}const c=b['length']===0x0?'LOW':b['some'](h=>h['level']==='CRITICAL')?'CRITICAL':b['some'](h=>h['level']==='HIGH')?'HIGH':b['some'](h=>h['level']==='MEDIUM')?'MEDIUM':'LOW',d={};for(const h of b){d[h['category']]=(d[h['category']]??0x0)+0x1;}const e={};for(const i of b){for(const j of i['affected_stakeholders']){if(!e[j])e[j]=[];e[j]['push'](i['id']+':\x20'+i['mitigation']);}}return{'summary':'Assessed\x20'+b['length']+'\x20risk(s)\x20across\x20'+Object['keys'](d)['length']+'\x20categories','risks':b,'overall_risk':c,'risks_by_category':d,'stakeholder_advice':e,'needs_human_review':b['some'](k=>k['level']==='CRITICAL'||k['level']==='HIGH')};}export const REWARD_STAKEHOLDERS=['owner','claimer','service_provider','system'];export function getRewardRiskRulesByStakeholder(a){return ALL_RULES['filter'](b=>{if(a==='owner')return['structural','permission','lifecycle','business_semantic']['includes'](b['category']);if(a==='claimer')return b['id']['startsWith']('R-R-4-0')||b['id']==='R-R-5-01'||b['id']==='R-R-1-02'||b['id']==='R-R-6-01';if(a==='service_provider')return b['id']==='R-R-4-02'||b['id']==='R-R-3-01'||b['id']==='R-R-3-02'||b['id']==='R-R-6-01';if(a==='system')return b['category']==='cross_object';return![];});}