@wowok/agent-mcp 3.1.3 → 3.1.4

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 (379) hide show
  1. package/dist/config/config-audit.spec.d.ts +1 -0
  2. package/dist/config/config-audit.spec.js +1 -0
  3. package/dist/config/exposure.d.ts +108 -0
  4. package/dist/config/exposure.js +1 -0
  5. package/dist/config/index.d.ts +2 -0
  6. package/dist/config/index.js +1 -1
  7. package/dist/config/judgment.d.ts +1228 -0
  8. package/dist/config/judgment.js +1 -0
  9. package/dist/config/judgment.spec.d.ts +1 -0
  10. package/dist/config/judgment.spec.js +1 -0
  11. package/dist/config/rule-engine.d.ts +299 -0
  12. package/dist/config/rule-engine.js +1 -0
  13. package/dist/config/rule-engine.spec.d.ts +1 -0
  14. package/dist/config/rule-engine.spec.js +1 -0
  15. package/dist/config/severity.d.ts +7 -0
  16. package/dist/config/severity.js +1 -0
  17. package/dist/customer/order-monitor.d.ts +3 -1
  18. package/dist/customer/order-monitor.js +1 -1
  19. package/dist/evaluation/acceptance.d.ts +1 -0
  20. package/dist/evaluation/acceptance.js +1 -1
  21. package/dist/evaluation/arbitration-game.js +1 -1
  22. package/dist/evaluation/builtins/demand-match.js +1 -1
  23. package/dist/evaluation/builtins/graph-service.js +1 -1
  24. package/dist/evaluation/builtins/graph-service.spec.js +1 -1
  25. package/dist/evaluation/engine.js +1 -1
  26. package/dist/evaluation/game-strategy.d.ts +2 -2
  27. package/dist/evaluation/game-strategy.js +1 -1
  28. package/dist/evaluation/match-operation.d.ts +2 -2
  29. package/dist/evaluation/match-operation.js +1 -1
  30. package/dist/evaluation/standards.d.ts +3 -25
  31. package/dist/evaluation/standards.js +1 -1
  32. package/dist/evaluation/types.d.ts +2 -1
  33. package/dist/experience/realtime-feedback.js +1 -1
  34. package/dist/extensions/business-modules.js +1 -1
  35. package/dist/extensions/custom-registry-file.js +1 -1
  36. package/dist/extensions/industry-audit.spec.d.ts +1 -0
  37. package/dist/extensions/industry-audit.spec.js +1 -0
  38. package/dist/extensions/industry-layers.d.ts +8 -0
  39. package/dist/extensions/industry-layers.js +1 -1
  40. package/dist/extensions/industry-pack.d.ts +2 -0
  41. package/dist/extensions/industry-pack.js +1 -1
  42. package/dist/extensions/mode-evaluator.js +1 -1
  43. package/dist/extensions/modes.js +1 -1
  44. package/dist/graph/onchain/analyze.d.ts +3 -1
  45. package/dist/graph/onchain/analyze.js +1 -1
  46. package/dist/graph/onchain/analyze.spec.js +1 -1
  47. package/dist/graph/onchain/edge-schema.d.ts +1 -0
  48. package/dist/graph/onchain/edge-schema.js +1 -1
  49. package/dist/graph/onchain/expand.js +1 -1
  50. package/dist/graph/onchain/exploration.d.ts +28 -0
  51. package/dist/graph/onchain/exploration.js +1 -0
  52. package/dist/graph/onchain/exploration.spec.d.ts +1 -0
  53. package/dist/graph/onchain/exploration.spec.js +1 -0
  54. package/dist/graph/onchain/exposure.d.ts +18 -0
  55. package/dist/graph/onchain/exposure.js +1 -0
  56. package/dist/graph/onchain/exposure.spec.d.ts +1 -0
  57. package/dist/graph/onchain/exposure.spec.js +1 -0
  58. package/dist/graph/onchain/graph-policy.spec.d.ts +1 -0
  59. package/dist/graph/onchain/graph-policy.spec.js +1 -0
  60. package/dist/graph/onchain/index.d.ts +6 -0
  61. package/dist/graph/onchain/index.js +1 -1
  62. package/dist/graph/onchain/interest.js +1 -1
  63. package/dist/graph/onchain/interest.spec.js +1 -1
  64. package/dist/graph/onchain/names.js +1 -1
  65. package/dist/graph/onchain/names.spec.js +1 -1
  66. package/dist/graph/onchain/policy.d.ts +8 -0
  67. package/dist/graph/onchain/policy.js +1 -0
  68. package/dist/graph/onchain/proposal-graph.js +1 -1
  69. package/dist/graph/onchain/proposal-graph.spec.js +1 -1
  70. package/dist/graph/onchain/synthesis.d.ts +20 -0
  71. package/dist/graph/onchain/synthesis.js +1 -0
  72. package/dist/graph/onchain/synthesis.spec.d.ts +1 -0
  73. package/dist/graph/onchain/synthesis.spec.js +1 -0
  74. package/dist/graph/onchain/types.d.ts +11 -1
  75. package/dist/keeper/keeper.spec.js +1 -1
  76. package/dist/knowledge/alloc-audit-policy.spec.d.ts +1 -0
  77. package/dist/knowledge/alloc-audit-policy.spec.js +1 -0
  78. package/dist/knowledge/allocation-ledger.js +1 -1
  79. package/dist/knowledge/allocation-puzzle.d.ts +1 -1
  80. package/dist/knowledge/allocation-puzzle.js +1 -1
  81. package/dist/knowledge/allocation-risk.d.ts +4 -1
  82. package/dist/knowledge/allocation-risk.js +1 -1
  83. package/dist/knowledge/allocation-templates.js +1 -1
  84. package/dist/knowledge/arb-risk.d.ts +6 -5
  85. package/dist/knowledge/arb-risk.js +1 -1
  86. package/dist/knowledge/arbitration-ledger.d.ts +4 -4
  87. package/dist/knowledge/arbitration-ledger.js +1 -1
  88. package/dist/knowledge/arbitration-puzzle.d.ts +1 -1
  89. package/dist/knowledge/arbitration-puzzle.js +1 -1
  90. package/dist/knowledge/arbitration-risk.d.ts +4 -1
  91. package/dist/knowledge/arbitration-risk.js +1 -1
  92. package/dist/knowledge/arbitration-templates.js +1 -1
  93. package/dist/knowledge/baselines/judgment-baselines.json +289 -0
  94. package/dist/knowledge/baselines/risk-baselines.spec.js +1 -1
  95. package/dist/knowledge/baselines/rules/alloc_audit.json +290 -0
  96. package/dist/knowledge/baselines/rules/allocation.json +492 -0
  97. package/dist/knowledge/baselines/rules/arb.json +155 -0
  98. package/dist/knowledge/baselines/rules/arbitration.json +366 -0
  99. package/dist/knowledge/baselines/rules/bridge.json +197 -0
  100. package/dist/knowledge/baselines/rules/contact.json +152 -0
  101. package/dist/knowledge/baselines/rules/demand.json +158 -0
  102. package/dist/knowledge/baselines/rules/graph.json +453 -0
  103. package/dist/knowledge/baselines/rules/guard.json +981 -0
  104. package/dist/knowledge/baselines/rules/machine.json +706 -0
  105. package/dist/knowledge/baselines/rules/order.json +549 -0
  106. package/dist/knowledge/baselines/rules/payment.json +205 -0
  107. package/dist/knowledge/baselines/rules/permission.json +330 -0
  108. package/dist/knowledge/baselines/rules/personal.json +139 -0
  109. package/dist/knowledge/baselines/rules/progress.json +346 -0
  110. package/dist/knowledge/baselines/rules/proof.json +158 -0
  111. package/dist/knowledge/baselines/rules/registrar.json +159 -0
  112. package/dist/knowledge/baselines/rules/repository.json +244 -0
  113. package/dist/knowledge/baselines/rules/resource.json +117 -0
  114. package/dist/knowledge/baselines/rules/reward.json +471 -0
  115. package/dist/knowledge/baselines/rules/service.json +595 -0
  116. package/dist/knowledge/baselines/rules/treasury.json +440 -0
  117. package/dist/knowledge/baselines/rules/util.json +101 -0
  118. package/dist/knowledge/bridge-risk.d.ts +6 -5
  119. package/dist/knowledge/bridge-risk.js +1 -1
  120. package/dist/knowledge/builtin-templates.d.ts +26 -0
  121. package/dist/knowledge/builtin-templates.js +1 -0
  122. package/dist/knowledge/contact-risk.d.ts +6 -5
  123. package/dist/knowledge/contact-risk.js +1 -1
  124. package/dist/knowledge/demand-risk.d.ts +6 -5
  125. package/dist/knowledge/demand-risk.js +1 -1
  126. package/dist/knowledge/event-semantics.js +1 -1
  127. package/dist/knowledge/facts-sync.spec.d.ts +1 -0
  128. package/dist/knowledge/facts-sync.spec.js +1 -0
  129. package/dist/knowledge/getting-started.js +1 -1
  130. package/dist/knowledge/guard-design-patterns.js +1 -1
  131. package/dist/knowledge/guard-field-cognition.d.ts +1 -1
  132. package/dist/knowledge/guard-field-cognition.js +1 -1
  133. package/dist/knowledge/guard-ledger.js +1 -1
  134. package/dist/knowledge/guard-risk.d.ts +4 -1
  135. package/dist/knowledge/guard-risk.js +1 -1
  136. package/dist/knowledge/guard-templates.js +1 -1
  137. package/dist/knowledge/guard-translation.js +1 -1
  138. package/dist/knowledge/index.d.ts +10 -2
  139. package/dist/knowledge/index.js +1 -1
  140. package/dist/knowledge/industry-registry.js +1 -1
  141. package/dist/knowledge/industry-strategy.js +1 -1
  142. package/dist/knowledge/jsonrpc-enum.js +1 -1
  143. package/dist/knowledge/machine-ledger.js +1 -1
  144. package/dist/knowledge/machine-risk.d.ts +4 -1
  145. package/dist/knowledge/machine-risk.js +1 -1
  146. package/dist/knowledge/machine-templates.js +1 -1
  147. package/dist/knowledge/machine-translation.js +1 -1
  148. package/dist/knowledge/migration-preflight.js +1 -1
  149. package/dist/knowledge/operation-dictionary.js +1 -1
  150. package/dist/knowledge/order-ledger.js +1 -1
  151. package/dist/knowledge/order-puzzle.d.ts +3 -3
  152. package/dist/knowledge/order-puzzle.js +1 -1
  153. package/dist/knowledge/order-risk.d.ts +6 -3
  154. package/dist/knowledge/order-risk.js +1 -1
  155. package/dist/knowledge/order-templates.js +1 -1
  156. package/dist/knowledge/passport-ledger.js +1 -1
  157. package/dist/knowledge/passport-templates.js +1 -1
  158. package/dist/knowledge/payment-risk.d.ts +8 -6
  159. package/dist/knowledge/payment-risk.js +1 -1
  160. package/dist/knowledge/payment-tracker.js +1 -1
  161. package/dist/knowledge/permission-ledger.js +1 -1
  162. package/dist/knowledge/permission-puzzle.d.ts +12 -12
  163. package/dist/knowledge/permission-puzzle.js +1 -1
  164. package/dist/knowledge/permission-risk.d.ts +4 -7
  165. package/dist/knowledge/permission-risk.js +1 -1
  166. package/dist/knowledge/permission-templates.js +1 -1
  167. package/dist/knowledge/personal-risk.d.ts +6 -5
  168. package/dist/knowledge/personal-risk.js +1 -1
  169. package/dist/knowledge/progress-ledger.js +1 -1
  170. package/dist/knowledge/progress-puzzle.d.ts +2 -2
  171. package/dist/knowledge/progress-puzzle.js +1 -1
  172. package/dist/knowledge/progress-risk.d.ts +4 -1
  173. package/dist/knowledge/progress-risk.js +1 -1
  174. package/dist/knowledge/progress-templates.js +1 -1
  175. package/dist/knowledge/proof-risk.d.ts +6 -5
  176. package/dist/knowledge/proof-risk.js +1 -1
  177. package/dist/knowledge/puzzle-projections.js +1 -1
  178. package/dist/knowledge/recipient-constraint.d.ts +20 -1
  179. package/dist/knowledge/recipient-constraint.js +1 -1
  180. package/dist/knowledge/registrar-risk.d.ts +6 -5
  181. package/dist/knowledge/registrar-risk.js +1 -1
  182. package/dist/knowledge/repository-risk.d.ts +7 -6
  183. package/dist/knowledge/repository-risk.js +1 -1
  184. package/dist/knowledge/resource-risk.d.ts +6 -5
  185. package/dist/knowledge/resource-risk.js +1 -1
  186. package/dist/knowledge/reward-ledger.d.ts +1 -1
  187. package/dist/knowledge/reward-ledger.js +1 -1
  188. package/dist/knowledge/reward-puzzle.d.ts +2 -2
  189. package/dist/knowledge/reward-puzzle.js +1 -1
  190. package/dist/knowledge/reward-risk.d.ts +4 -1
  191. package/dist/knowledge/reward-risk.js +1 -1
  192. package/dist/knowledge/rule-node-analyzers.spec.js +1 -1
  193. package/dist/knowledge/rule-outcome.js +1 -1
  194. package/dist/knowledge/scenario-modes.d.ts +2 -2
  195. package/dist/knowledge/scenario-modes.js +1 -1
  196. package/dist/knowledge/scenario-topology.js +1 -1
  197. package/dist/knowledge/service-allocator-audit-node.js +1 -1
  198. package/dist/knowledge/service-ledger.js +1 -1
  199. package/dist/knowledge/service-puzzle.d.ts +2 -2
  200. package/dist/knowledge/service-puzzle.js +1 -1
  201. package/dist/knowledge/service-risk-node.js +1 -1
  202. package/dist/knowledge/service-risk.d.ts +4 -1
  203. package/dist/knowledge/service-risk.js +1 -1
  204. package/dist/knowledge/service-templates.js +1 -1
  205. package/dist/knowledge/strategy-manuals.d.ts +1 -1
  206. package/dist/knowledge/strategy-manuals.js +1 -1
  207. package/dist/knowledge/template-loader.d.ts +84 -0
  208. package/dist/knowledge/template-loader.js +1 -0
  209. package/dist/knowledge/template-loader.spec.d.ts +1 -0
  210. package/dist/knowledge/template-loader.spec.js +1 -0
  211. package/dist/knowledge/template-registry.js +1 -1
  212. package/dist/knowledge/template-scanner.d.ts +17 -0
  213. package/dist/knowledge/template-scanner.js +1 -0
  214. package/dist/knowledge/template-scanner.spec.d.ts +1 -0
  215. package/dist/knowledge/template-scanner.spec.js +1 -0
  216. package/dist/knowledge/tools-reference.js +1 -1
  217. package/dist/knowledge/treasury-ledger.d.ts +1 -1
  218. package/dist/knowledge/treasury-ledger.js +1 -1
  219. package/dist/knowledge/treasury-puzzle.d.ts +3 -3
  220. package/dist/knowledge/treasury-puzzle.js +1 -1
  221. package/dist/knowledge/treasury-risk.d.ts +4 -1
  222. package/dist/knowledge/treasury-risk.js +1 -1
  223. package/dist/knowledge/treasury-templates.js +1 -1
  224. package/dist/knowledge/util-risk.d.ts +6 -5
  225. package/dist/knowledge/util-risk.js +1 -1
  226. package/dist/knowledge/workflow-guidance.d.ts +4 -0
  227. package/dist/knowledge/workflow-guidance.js +1 -1
  228. package/dist/knowledge/workspace-lists.js +1 -1
  229. package/dist/monitor/MonitorLoop.js +1 -1
  230. package/dist/participation/arbitrator-interest.js +1 -1
  231. package/dist/participation/radar-core.js +1 -1
  232. package/dist/persona/analyzer.js +1 -1
  233. package/dist/persona/index.js +1 -1
  234. package/dist/persona/model.js +1 -1
  235. package/dist/persona/persona-audit.spec.d.ts +1 -0
  236. package/dist/persona/persona-audit.spec.js +1 -0
  237. package/dist/persona/types.d.ts +2 -0
  238. package/dist/playbooks/service-build/business-puzzle.js +1 -1
  239. package/dist/playbooks/service-build/facet-money.d.ts +11 -0
  240. package/dist/playbooks/service-build/facet-money.js +1 -1
  241. package/dist/playbooks/service-build/machine-panorama.d.ts +17 -0
  242. package/dist/playbooks/service-build/machine-panorama.js +1 -1
  243. package/dist/playbooks/service-build/merchant-guide.d.ts +2 -2
  244. package/dist/playbooks/service-build/migration-planner.d.ts +43 -0
  245. package/dist/playbooks/service-build/migration-planner.js +1 -0
  246. package/dist/playbooks/service-build/object-panorama.d.ts +42 -1
  247. package/dist/playbooks/service-build/object-panorama.js +1 -1
  248. package/dist/playbooks/service-build/participation-radar.js +1 -1
  249. package/dist/playbooks/service-build/pipeline-actions.d.ts +1 -1
  250. package/dist/playbooks/service-build/reverse-mapping.d.ts +1 -0
  251. package/dist/playbooks/service-build/reverse-mapping.js +1 -1
  252. package/dist/playbooks/service-build/risk-aggregator.d.ts +2 -1
  253. package/dist/playbooks/service-build/risk-aggregator.js +1 -1
  254. package/dist/playbooks/service-build/semantic-graph.js +1 -1
  255. package/dist/playbooks/service-build/service-panorama.d.ts +53 -1
  256. package/dist/playbooks/service-build/service-panorama.js +1 -1
  257. package/dist/playbooks/service-build/topology-evaluation.spec.js +1 -1
  258. package/dist/playbooks/service-build/topology-query.js +1 -1
  259. package/dist/playbooks/service-build/workflow-design-assessment.d.ts +2 -2
  260. package/dist/playbooks/service-build/workflow-design-assessment.js +1 -1
  261. package/dist/relationship/registry.js +1 -1
  262. package/dist/review/machine.js +1 -1
  263. package/dist/review/order.js +1 -1
  264. package/dist/review/service.js +1 -1
  265. package/dist/review/types.d.ts +7 -0
  266. package/dist/safety/confirm-gate.js +1 -1
  267. package/dist/schema/benchmark-migration/index.d.ts +207 -0
  268. package/dist/schema/benchmark-migration/index.js +1 -0
  269. package/dist/schema/call/allocation.d.ts +1 -1
  270. package/dist/schema/call/allocation.js +1 -1
  271. package/dist/schema/call/arbitration.d.ts +1 -1
  272. package/dist/schema/call/arbitration.js +1 -1
  273. package/dist/schema/call/base.d.ts +5 -5
  274. package/dist/schema/call/base.js +1 -1
  275. package/dist/schema/call/contact.d.ts +1 -1
  276. package/dist/schema/call/demand.d.ts +1 -1
  277. package/dist/schema/call/guard.d.ts +3 -3
  278. package/dist/schema/call/machine.d.ts +5 -5
  279. package/dist/schema/call/order.d.ts +3 -3
  280. package/dist/schema/call/payment.js +1 -1
  281. package/dist/schema/call/permission-handler.d.ts +1 -1
  282. package/dist/schema/call/permission-handler.js +1 -1
  283. package/dist/schema/call/permission.d.ts +16 -16
  284. package/dist/schema/call/permission.js +1 -1
  285. package/dist/schema/call/personal.d.ts +8 -8
  286. package/dist/schema/call/personal.js +1 -1
  287. package/dist/schema/call/progress.d.ts +3 -3
  288. package/dist/schema/call/repository.d.ts +11 -11
  289. package/dist/schema/call/repository.js +1 -1
  290. package/dist/schema/call/reward.d.ts +1 -1
  291. package/dist/schema/call/semantic.js +1 -1
  292. package/dist/schema/call/service.d.ts +7 -7
  293. package/dist/schema/call/service.js +1 -1
  294. package/dist/schema/call/treasury.d.ts +1 -1
  295. package/dist/schema/common/index.d.ts +6 -6
  296. package/dist/schema/common/index.js +1 -1
  297. package/dist/schema/config/index.d.ts +50 -1
  298. package/dist/schema/config/index.js +1 -1
  299. package/dist/schema/evaluation/index.d.ts +27 -11
  300. package/dist/schema/evaluation/index.js +1 -1
  301. package/dist/schema/goal/index.d.ts +5 -5
  302. package/dist/schema/goal/planning.d.ts +15 -15
  303. package/dist/schema/goal/planning.js +1 -1
  304. package/dist/schema/index.d.ts +1 -0
  305. package/dist/schema/index.js +1 -1
  306. package/dist/schema/interaction/index.d.ts +1 -1
  307. package/dist/schema/local/index.js +1 -1
  308. package/dist/schema/messenger/index.d.ts +26 -26
  309. package/dist/schema/operations.d.ts +33 -33
  310. package/dist/schema/operations.js +1 -1
  311. package/dist/schema/persona/index.d.ts +4708 -0
  312. package/dist/schema/persona/index.js +1 -1
  313. package/dist/schema/query/bi.d.ts +232 -25
  314. package/dist/schema/query/bi.js +1 -1
  315. package/dist/schema/query/index.d.ts +35 -35
  316. package/dist/schema/query/index.js +1 -1
  317. package/dist/schema/schema-version.js +1 -1
  318. package/dist/schema/workflow/index.d.ts +1 -1
  319. package/dist/schema-query-impl/index.d.ts +9 -0
  320. package/dist/schema-query-impl/index.js +1 -1
  321. package/dist/schemas/benchmark_migration_operation.output.json +793 -0
  322. package/dist/schemas/benchmark_migration_operation.schema.json +83 -0
  323. package/dist/schemas/bridge_operation.schema.json +5 -5
  324. package/dist/schemas/config_operation.output.json +252 -0
  325. package/dist/schemas/config_operation.schema.json +21 -1
  326. package/dist/schemas/evaluation_operation.output.json +22 -10
  327. package/dist/schemas/goal_operation.schema.json +8 -8
  328. package/dist/schemas/guard2file.schema.json +1 -1
  329. package/dist/schemas/index.json +7 -1
  330. package/dist/schemas/machineNode2file.schema.json +1 -1
  331. package/dist/schemas/messenger_operation.schema.json +24 -12
  332. package/dist/schemas/onchain_events.output.json +1 -1
  333. package/dist/schemas/onchain_operations.output.json +4 -2
  334. package/dist/schemas/onchain_operations.schema.json +189 -139
  335. package/dist/schemas/onchain_operations_allocation.schema.json +13 -11
  336. package/dist/schemas/onchain_operations_arbitration.schema.json +10 -8
  337. package/dist/schemas/onchain_operations_contact.schema.json +7 -5
  338. package/dist/schemas/onchain_operations_demand.schema.json +7 -5
  339. package/dist/schemas/onchain_operations_gen_passport.schema.json +5 -3
  340. package/dist/schemas/onchain_operations_gen_proof.schema.json +1 -1
  341. package/dist/schemas/onchain_operations_guard.schema.json +5 -3
  342. package/dist/schemas/onchain_operations_machine.schema.json +22 -18
  343. package/dist/schemas/onchain_operations_order.schema.json +11 -7
  344. package/dist/schemas/onchain_operations_payment.schema.json +3 -3
  345. package/dist/schemas/onchain_operations_permission.schema.json +19 -11
  346. package/dist/schemas/onchain_operations_personal.schema.json +16 -10
  347. package/dist/schemas/onchain_operations_progress.schema.json +11 -7
  348. package/dist/schemas/onchain_operations_proof.schema.json +5 -3
  349. package/dist/schemas/onchain_operations_repository.schema.json +12 -8
  350. package/dist/schemas/onchain_operations_reward.schema.json +11 -9
  351. package/dist/schemas/onchain_operations_service.schema.json +28 -22
  352. package/dist/schemas/onchain_operations_treasury.schema.json +11 -9
  353. package/dist/schemas/onchain_table_data.output.json +27 -17
  354. package/dist/schemas/persona_operation.output.json +15875 -1
  355. package/dist/schemas/persona_operation.schema.json +3056 -478
  356. package/dist/schemas/query_toolkit.output.json +343 -63
  357. package/dist/schemas/query_toolkit.schema.json +1 -1
  358. package/dist/schemas/workflow_operation.schema.json +4 -2
  359. package/dist/strategy/scorecard.js +1 -1
  360. package/dist/tools/handlers/benchmark-migration.d.ts +2 -0
  361. package/dist/tools/handlers/benchmark-migration.js +1 -0
  362. package/dist/tools/handlers/config.js +1 -1
  363. package/dist/tools/handlers/industry-pack.js +1 -1
  364. package/dist/tools/handlers/onchain.js +1 -1
  365. package/dist/tools/handlers/query.js +1 -1
  366. package/dist/tools/handlers/schema-query.js +1 -1
  367. package/dist/tools/index.js +1 -1
  368. package/dist/tools/move-fn-index.gen.d.ts +3 -0
  369. package/dist/tools/move-fn-index.gen.js +1 -0
  370. package/dist/tools/registry/business.js +1 -1
  371. package/dist/tools/registry/config.js +1 -1
  372. package/dist/tools/registry/evaluation.js +1 -1
  373. package/dist/tools/registry/onchain.js +1 -1
  374. package/dist/tools/sanitize-output.d.ts +3 -0
  375. package/dist/tools/sanitize-output.js +1 -0
  376. package/dist/tools/sanitize-output.spec.d.ts +1 -0
  377. package/dist/tools/sanitize-output.spec.js +1 -0
  378. package/package.json +9 -4
  379. package/dist/knowledge/baselines/evaluation-baselines.json +0 -79
@@ -0,0 +1,205 @@
1
+ {
2
+ "comment": "Payment rule pack (R-PAYMENT) — declarative form of the retired in-code Payment risk rules. Facts are produced by the kernel extractor (payment-risk.ts, bound to the on-chain recipient cap); rules only reference fact names. Note the pack order carries the old check() semantics: R-PAYMENT-05 sits LAST in the rules array because the retired check appended its always-on variant guidance after every other rule. Levels/wording can be retuned per rule and rules can be disabled (enabled=false, trace left) via the judgment document — factory rules can never be deleted or invented here.",
3
+ "facts": {
4
+ "recipient_count": "Recipient count for the new Payment.",
5
+ "recipient_count_at_limit": "recipient_count has reached MAX_RECIPIENT_COUNT (chain-limit comparison sunk into the extractor).",
6
+ "uses_unsafe_unwrap": "The caller uses the unchecked unwrap (no Payment match check) instead of the type-checked variant.",
7
+ "expects_mutation": "The caller relies on post-creation modification (impossible — Payment is frozen at create).",
8
+ "coin_field_lint_reviewed": "Whether the CoinWrapper coin_field lint suppression has been intentionally reviewed (false keeps the review reminder audible).",
9
+ "expects_user_recipient_registered": "The caller expects every recipient to be registered via the object-linker tx index (only object-address recipients are).",
10
+ "uses_signer_for_provenance": "The caller relies on Payment.signer for provenance (informational only, not authorization).",
11
+ "uses_scene_binding": "The Payment uses the for_object + for_guard + index scene binding (exception branch anti-reuse).",
12
+ "scene_binding_missing": "Rendered list of missing scene-binding legs ('for_object not set (Order binding missing)', etc.), ', '-joined — empty when the binding is complete.",
13
+ "scene_binding_missing_count": "Number of missing scene-binding legs (0 when complete).",
14
+ "payment_info_variant_display": "Rendered PaymentInfo constructor variant name, 'unknown' when the context carries none.",
15
+ "max_recipient_count": "KERNEL CONSTANT — recipients per Payment cap (MAX_RECIPIENT_COUNT).",
16
+ "always_true": "Extractor sentinel — unconditionally true; marks the always-on guidance rule (R-PAYMENT-05)."
17
+ },
18
+ "rules": [
19
+ {
20
+ "rule_id": "R-PAYMENT-01",
21
+ "dimension": "permission",
22
+ "trigger": "caller uses the unchecked unwrap",
23
+ "cases": [
24
+ {
25
+ "when": { "field": "uses_unsafe_unwrap", "op": "eq", "value": true },
26
+ "level": "high",
27
+ "title": "unwrap() performs no Payment match check — may unwrap wrong CoinWrapper",
28
+ "description": "unwrap(wrapper, ctx) returns (Coin, payment_address) without verifying that wrapper.payment matches any expected Payment. Callers who use the unchecked unwrap can release a CoinWrapper that was minted for a different Payment, leading to fund loss or accounting corruption. The type-checked unwrap variant exists specifically to enforce the match.",
29
+ "scenario": "Caller uses unwrap on a wrapper from a different Payment; funds are released anyway",
30
+ "mitigation": "SDK should force callers to use the type-checked unwrap and deprecate the unchecked variant. The only safe use of unwrap is when the caller has already verified the match off-chain.",
31
+ "evidence": "uses_unsafe_unwrap=true (no Payment match check)",
32
+ "stakeholders": ["signer", "recipient"],
33
+ "exposure": {
34
+ "loss_parties": [
35
+ { "role": "buyer", "basis": "Compensation escrowed in a wrapper can be released outside its intended payment flow — the match check is the only pin tying the wrapper to the Payment it was minted for." },
36
+ { "role": "merchant", "basis": "Order-payment wrappers released through the unchecked unwrap land outside the intended distribution flow — accounting corrupts silently." }
37
+ ],
38
+ "gain_paths": [
39
+ {
40
+ "role": "neutral",
41
+ "path": "A caller extracts a wrapper minted for a different Payment and walks away with the released coin — no on-chain check ties the release back to the expected Payment.",
42
+ "viability": "viable",
43
+ "gate": "The unchecked unwrap performs no Payment match verification; the type-checked variant exists precisely to enforce it."
44
+ }
45
+ ]
46
+ }
47
+ }
48
+ ]
49
+ },
50
+ {
51
+ "rule_id": "R-PAYMENT-02",
52
+ "dimension": "structural",
53
+ "trigger": "recipient count reaches MAX_RECIPIENT_COUNT",
54
+ "cases": [
55
+ {
56
+ "when": { "field": "recipient_count_at_limit", "op": "eq", "value": true },
57
+ "level": "medium",
58
+ "title": "MAX_RECIPIENT_COUNT=${max_recipient_count} permissive — gas and confirmation cost",
59
+ "description": "A single Payment may carry up to MAX_RECIPIENT_COUNT=${max_recipient_count} recipients. The limit aborts with ERECIPIENT_COUNT_EXCEEDED (1) only at the boundary. 200 recipients in one transaction inflates gas, slows finalization, and complicates retry on partial failure.",
60
+ "scenario": "Caller submits a Payment with 200 recipients; transaction is heavy and slow",
61
+ "mitigation": "Business layer should self-limit recipient count (e.g. ≤50). For mass payouts, split across multiple Payment objects in separate transactions.",
62
+ "evidence": "recipient_count=${recipient_count}, limit=${max_recipient_count}",
63
+ "stakeholders": ["signer", "recipient"]
64
+ }
65
+ ]
66
+ },
67
+ {
68
+ "rule_id": "R-PAYMENT-03",
69
+ "dimension": "lifecycle",
70
+ "trigger": "caller relies on post-creation modification (Payment is frozen)",
71
+ "cases": [
72
+ {
73
+ "when": { "field": "expects_mutation", "op": "eq", "value": true },
74
+ "level": "low",
75
+ "title": "Payment is immutable after create — errors cannot be corrected",
76
+ "description": "create() calls transfer::freeze_object(payment). All fields (amount, time, info, from_object, signer, record) are permanently fixed. There is no update, refund, or void API on the Payment object itself — correction requires a new Payment (and off-chain reconciliation).",
77
+ "scenario": "Signer mistypes a recipient address; the Payment cannot be edited post-create",
78
+ "mitigation": "Verify all fields before calling create. For refunds, create a new Payment in the opposite direction. Off-chain systems should treat Payment as an immutable receipt.",
79
+ "evidence": "expects_mutation=true (Payment is frozen at create)",
80
+ "stakeholders": ["signer", "consumer"]
81
+ }
82
+ ]
83
+ },
84
+ {
85
+ "rule_id": "R-PAYMENT-04",
86
+ "dimension": "structural",
87
+ "trigger": "coin_field lint suppression not reviewed",
88
+ "cases": [
89
+ {
90
+ "when": { "field": "coin_field_lint_reviewed", "op": "falsy" },
91
+ "level": "medium",
92
+ "title": "CoinWrapper suppresses coin_field lint — Balance<T> stored in a struct field",
93
+ "description": "CoinWrapper<phantom T> stores Balance<T> directly in a struct field and uses #[allow(lint(coin_field))] to suppress the Wow lint. The lint normally warns against storing Balance in arbitrary structs because of object lifecycle concerns. The suppression is intentional but should be reviewed whenever the Wow framework updates its coin_field rules.",
94
+ "scenario": "Wow framework tightens coin_field lint semantics; CoinWrapper becomes non-compliant",
95
+ "mitigation": "Review the coin_field suppression on each Wow upgrade. Confirm that Balance<T> ownership transfer in the unchecked and type-checked unwrap paths is correct.",
96
+ "evidence": "coin_field_lint_reviewed=false (needs review)",
97
+ "stakeholders": ["system"]
98
+ }
99
+ ]
100
+ },
101
+ {
102
+ "rule_id": "R-PAYMENT-06",
103
+ "dimension": "cross_object",
104
+ "trigger": "caller expects user-address recipients in the object-linker tx registration",
105
+ "cases": [
106
+ {
107
+ "when": { "field": "expects_user_recipient_registered", "op": "eq", "value": true },
108
+ "level": "medium",
109
+ "title": "object-linker tx registration filters recipients by the object-address check — user addresses skipped",
110
+ "description": "create() iterates recipients and registers an object-linker affiliation only for addresses that pass the on-chain object-address check. User addresses (EOAs) are not registered in the object-linker tx index. Callers who expect every recipient to appear in object-linker tx queries will miss EOA recipients.",
111
+ "scenario": "Caller queries object-linker tx for all Payment recipients; EOA recipients are missing",
112
+ "mitigation": "Document that the affiliation link is registered only for object-address recipients. Off-chain systems should track EOA recipients via the NewPaymentEvent record, not via object-linker tx.",
113
+ "evidence": "expects_user_recipient_registered=true (EOAs are skipped)",
114
+ "stakeholders": ["signer", "consumer"]
115
+ }
116
+ ]
117
+ },
118
+ {
119
+ "rule_id": "R-PAYMENT-07",
120
+ "dimension": "semantic",
121
+ "trigger": "caller relies on Payment.signer for provenance",
122
+ "cases": [
123
+ {
124
+ "when": { "field": "uses_signer_for_provenance", "op": "eq", "value": true },
125
+ "level": "low",
126
+ "title": "Payment.signer records payer — useful for provenance but not authorization",
127
+ "description": "Payment.signer is set to ctx.sender() at creation. It can be read back from the Payment object for provenance (e.g. 'who paid for this order'). It is purely informational — it does NOT authorize any later operation. Consumers must not treat signer as a permission grant.",
128
+ "scenario": "Consumer treats Payment.signer as authorizing a refund; signer is just provenance",
129
+ "mitigation": "Use Payment.signer only for audit/provenance. Authorization must come from the referencing object's own Permission, not from Payment.signer.",
130
+ "evidence": "uses_signer_for_provenance=true (informational only)",
131
+ "stakeholders": ["consumer"]
132
+ }
133
+ ]
134
+ },
135
+ {
136
+ "rule_id": "R-PAYMENT-08",
137
+ "dimension": "semantic",
138
+ "trigger": "scene binding used but a binding leg (for_object/for_guard/index) is missing",
139
+ "cases": [
140
+ {
141
+ "when": { "all": [
142
+ { "field": "uses_scene_binding", "op": "eq", "value": true },
143
+ { "field": "scene_binding_missing_count", "op": "gte", "value": 1 }
144
+ ] },
145
+ "level": "medium",
146
+ "title": "Payment scene binding (for_object + for_guard + index) — anti-reuse for exception branches",
147
+ "description": "PaymentInfo supports for_object (binds to specific Order), for_guard (binds to specific Guard), and index (binds to specific Progress step). When all three are set via payment_info_with_guard, the Payment is scene-bound: it can ONLY be used in the specific order + guard + progress context. This is the anti-reuse design for exception branch compensation (e.g., delivery delay >30min triggers auto-compensation). Payment is immutable (freeze_object) — binding cannot be altered. VERIFIER-EVIDENCE DESIGN: customer submits Payment, Guard verifies binding fields match current context.",
148
+ "scenario": "Treasury creates compensation Payment with PaymentInfo(for_object=order, for_guard=exception_guard, index=current_progress) for delivery delay",
149
+ "mitigation": "Use payment_info_with_guard for all exception branch Payments. Ensure for_object, for_guard, and index all match the intended context. Use tpl_payment_exception_compensation (guard-templates.ts) as design template.",
150
+ "evidence": "incomplete scene binding: ${scene_binding_missing}",
151
+ "stakeholders": ["signer", "recipient", "consumer"],
152
+ "exposure": {
153
+ "loss_parties": [
154
+ { "role": "merchant", "basis": "Exception-branch compensation minted for one specific order context can be redeemed in another — the missing binding legs are the only pin against reuse, and the funds come out of the merchant's compensation pocket." }
155
+ ],
156
+ "gain_paths": [
157
+ {
158
+ "role": "neutral",
159
+ "path": "A claimant redeploys the weakly-bound Payment in a different order/guard context than the one it was minted for.",
160
+ "viability": "conditional",
161
+ "gate": "Executes only if the consuming Guard's verification accepts the incomplete binding — audit the consumer template to confirm or block the reuse."
162
+ }
163
+ ]
164
+ }
165
+ }
166
+ ]
167
+ },
168
+ {
169
+ "rule_id": "R-PAYMENT-09",
170
+ "dimension": "semantic",
171
+ "trigger": "scene binding used without the full payment_info_with_guard variant",
172
+ "cases": [
173
+ {
174
+ "when": { "all": [
175
+ { "field": "uses_scene_binding", "op": "eq", "value": true },
176
+ { "field": "payment_info_variant_display", "op": "neq", "value": "payment_info_with_guard" }
177
+ ] },
178
+ "level": "low",
179
+ "title": "PaymentInfo variant selection — use payment_info_with_guard for exception branches",
180
+ "description": "PaymentInfo has 4 constructor variants: payment_info (for_object+remark+index, no for_guard), payment_info_basic (remark+index, no for_object/for_guard), payment_info_with_guard (for_object+for_guard+remark+index — FULL binding), payment_info_basic_guarded (for_guard+remark+index, no for_object). For exception branch compensation, ALWAYS use payment_info_with_guard to get full scene binding. Using payment_info (without for_guard) or payment_info_basic (without for_object) weakens anti-reuse protection.",
181
+ "scenario": "Caller uses payment_info instead of payment_info_with_guard for exception compensation; for_guard is lost",
182
+ "mitigation": "For exception branch Payments: always use payment_info_with_guard(for_object, for_guard, remark, index). For simple Payments without scene binding: payment_info or payment_info_basic is fine. SDK should auto-select the variant based on which fields are provided.",
183
+ "evidence": "uses_scene_binding=true but variant=${payment_info_variant_display} (should be payment_info_with_guard)",
184
+ "stakeholders": ["signer", "consumer"]
185
+ }
186
+ ]
187
+ },
188
+ {
189
+ "rule_id": "R-PAYMENT-05",
190
+ "dimension": "semantic",
191
+ "trigger": "always — PaymentInfo variant guidance applies to every construction (the retired check appended it last)",
192
+ "cases": [
193
+ {
194
+ "when": { "field": "always_true", "op": "eq", "value": true },
195
+ "level": "low",
196
+ "title": "PaymentInfo has 4 constructor variants — caller may pick the wrong one",
197
+ "description": "PaymentInfo can be built via payment_info (for_object+remark+index), payment_info_basic (remark+index, no for_object), payment_info_with_guard (for_object+for_guard+remark+index), or payment_info_basic_guarded (for_guard+remark+index, no for_object). Selecting the wrong variant leaves for_object/for_guard as None, breaking downstream lookups.",
198
+ "scenario": "Caller uses payment_info_basic when they meant payment_info_with_guard; for_object is lost",
199
+ "mitigation": "Document each variant's use case clearly. SDK should pick the variant automatically based on which optional fields the caller provides.",
200
+ "stakeholders": ["signer", "consumer"]
201
+ }
202
+ ]
203
+ }
204
+ ]
205
+ }
@@ -0,0 +1,330 @@
1
+ {
2
+ "comment": "Permission rule pack (R-P) — declarative form of the retired in-code Permission risk rules. Facts are produced by the kernel extractor (permission-risk.ts, bound to the live permission limits, the builtin-index ledger and the scene catalog); rules only reference fact names. Levels/wording can be retuned per rule and rules can be disabled (enabled=false, trace left) via the judgment document — factory rules can never be deleted or invented here.",
3
+ "facts": {
4
+ "apply": "Target object addresses of the apply operation (raw list; presence gates R-P-5-01).",
5
+ "builder": "New owner address of the ownership transfer operation.",
6
+ "um": "UM (User Manager) Contact address being set.",
7
+ "current_admin_count": "Number of admins already configured on the Permission object.",
8
+ "current_entity_count": "Number of entities already configured on the Permission object.",
9
+ "target_objects_types": "Host object types of the apply targets (e.g. Service, Machine, Progress).",
10
+ "user_defined_perm_index_start": "KERNEL CONSTANT — live USER_DEFINED_PERM_INDEX_START (custom indexes start here).",
11
+ "max_entity_count": "KERNEL CONSTANT — live MAX_ENTITY_COUNT limit from the published package.",
12
+ "max_perm_for_entity": "KERNEL CONSTANT — live MAX_PERM_FOR_ENTITY limit from the published package.",
13
+ "max_admin_count": "KERNEL CONSTANT — live MAX_ADMIN_COUNT limit from the published package.",
14
+ "table_index_number": "KERNEL — the table op's permission index when given as a number (absent for the by-entity form).",
15
+ "table_entity": "KERNEL — the entity address of a by-entity table op (index array form).",
16
+ "perm_count_for_entity": "KERNEL — number of permission indexes in a by-entity table op.",
17
+ "admin_op": "KERNEL — the admin operation kind (add / remove / set).",
18
+ "admin_address_count": "KERNEL — number of addresses in the admin operation.",
19
+ "admin_effective_count": "KERNEL — projected admin count after the operation (add: current + incoming; otherwise the incoming count).",
20
+ "admin_dispersion_count": "KERNEL — dispersion view of the admin set (set: incoming count; otherwise the current count).",
21
+ "entity_op": "KERNEL — the entity operation kind (swap / replace / copy / del).",
22
+ "entity_replace_from": "KERNEL — entity1 of a replace operation (loses all permissions).",
23
+ "entity_replace_to": "KERNEL — entity2 of a replace operation (the replacement).",
24
+ "custom_index_invalid": "KERNEL — the table op's numeric index is below USER_DEFINED_PERM_INDEX_START and is not a builtin permission.",
25
+ "custom_index_without_remark": "KERNEL — the table op uses a custom index (>= start) and the same call does not set a remark for it.",
26
+ "entity_count": "KERNEL — effective entity count (current_entity_count, defaulting to 0).",
27
+ "entity_count_over_limit": "KERNEL — entity_count exceeds the live MAX_ENTITY_COUNT.",
28
+ "perm_count_over_limit": "KERNEL — perm_count_for_entity exceeds the live MAX_PERM_FOR_ENTITY.",
29
+ "admin_count_over_limit": "KERNEL — admin_effective_count exceeds the live MAX_ADMIN_COUNT.",
30
+ "builtin_permission_name": "KERNEL — builtin constant name of the table op's index (from the permission scene ledger).",
31
+ "perm_scene_host_object": "KERNEL — host object type of the scene that consumes the table op's builtin index.",
32
+ "target_types_mismatched_count": "KERNEL — apply targets whose host object type differs from the builtin index's scene.",
33
+ "mismatched_targets_csv": "KERNEL — comma-space joined mismatched apply target types.",
34
+ "mismatched_targets_csv_nospace": "KERNEL — comma joined mismatched apply target types (compact form).",
35
+ "targets_include_progress": "KERNEL — whether the apply target types include Progress (post-bind mutability limit).",
36
+ "um_is_builder": "KERNEL — UM is set to the same address as the builder (owner self-reference heuristic).",
37
+ "apply_count": "KERNEL — number of apply targets (present only when apply is given).",
38
+ "unique_target_type_count": "KERNEL — number of distinct host object types among the apply targets.",
39
+ "unique_target_types_csv": "KERNEL — comma-space joined distinct apply target types.",
40
+ "unique_target_types_csv_nospace": "KERNEL — comma joined distinct apply target types (compact form).",
41
+ "treasury_external_guard_name": "KERNEL — builtin constant name when the index is a treasury external guard index (255/256).",
42
+ "treasury_external_guard_op": "KERNEL — 'deposit' or 'withdraw' for the matching treasury external guard index."
43
+ },
44
+ "rules": [
45
+ {
46
+ "rule_id": "R-P-1-01",
47
+ "dimension": "structural",
48
+ "trigger": "custom permission index below USER_DEFINED_PERM_INDEX_START and not builtin",
49
+ "cases": [
50
+ {
51
+ "when": { "field": "custom_index_invalid", "op": "eq", "value": true },
52
+ "level": "critical",
53
+ "title": "Invalid permission index (< 1000 and not builtin)",
54
+ "description": "Permission index ${table_index_number} is below USER_DEFINED_PERM_INDEX_START (${user_defined_perm_index_start}) and not a builtin permission. Custom indexes must be >= 1000.",
55
+ "scenario": "User defines a custom permission with index < 1000",
56
+ "mitigation": "Use index >= ${user_defined_perm_index_start} for custom permissions, or use a builtin index if applicable",
57
+ "evidence": "index=${table_index_number}",
58
+ "stakeholders": ["owner", "admin", "system"]
59
+ }
60
+ ]
61
+ },
62
+ {
63
+ "rule_id": "R-P-1-02",
64
+ "dimension": "structural",
65
+ "trigger": "entity count exceeds MAX_ENTITY_COUNT",
66
+ "cases": [
67
+ {
68
+ "when": { "field": "entity_count_over_limit", "op": "eq", "value": true },
69
+ "level": "high",
70
+ "title": "Entity count exceeds limit",
71
+ "description": "Permission has ${entity_count} entities, exceeds MAX_ENTITY_COUNT ${max_entity_count}",
72
+ "scenario": "Adding entities beyond the protocol limit",
73
+ "mitigation": "Split into multiple Permission objects or remove inactive entities",
74
+ "evidence": "entity_count=${entity_count}",
75
+ "stakeholders": ["owner", "admin"]
76
+ }
77
+ ]
78
+ },
79
+ {
80
+ "rule_id": "R-P-1-03",
81
+ "dimension": "structural",
82
+ "trigger": "per-entity permission count exceeds MAX_PERM_FOR_ENTITY",
83
+ "cases": [
84
+ {
85
+ "when": { "field": "perm_count_over_limit", "op": "eq", "value": true },
86
+ "level": "high",
87
+ "title": "Per-entity permission count exceeds limit",
88
+ "description": "Entity ${table_entity} has ${perm_count_for_entity} permissions, exceeds MAX_PERM_FOR_ENTITY ${max_perm_for_entity}",
89
+ "scenario": "Granting too many permissions to one entity",
90
+ "mitigation": "Consolidate similar permissions or split entity into multiple roles",
91
+ "evidence": "perm_count=${perm_count_for_entity}",
92
+ "stakeholders": ["entity", "admin"]
93
+ }
94
+ ]
95
+ },
96
+ {
97
+ "rule_id": "R-P-1-04",
98
+ "dimension": "structural",
99
+ "trigger": "projected admin count exceeds MAX_ADMIN_COUNT",
100
+ "cases": [
101
+ {
102
+ "when": { "field": "admin_count_over_limit", "op": "eq", "value": true },
103
+ "level": "high",
104
+ "title": "Admin count exceeds limit",
105
+ "description": "Admin count would be ${admin_effective_count}, exceeds MAX_ADMIN_COUNT ${max_admin_count}",
106
+ "scenario": "Adding too many admins",
107
+ "mitigation": "Remove inactive admins before adding new ones",
108
+ "evidence": "admin_count=${admin_effective_count}",
109
+ "stakeholders": ["owner", "admin"]
110
+ }
111
+ ]
112
+ },
113
+ {
114
+ "rule_id": "R-P-2-01",
115
+ "dimension": "semantic",
116
+ "trigger": "builtin permission index used outside its host object scene",
117
+ "cases": [
118
+ {
119
+ "when": { "field": "target_types_mismatched_count", "op": "gt", "value": 0 },
120
+ "level": "high",
121
+ "title": "Permission index host object mismatch",
122
+ "description": "Permission ${table_index_number} (${builtin_permission_name}) is for ${perm_scene_host_object}, but apply targets: ${mismatched_targets_csv}",
123
+ "scenario": "Using SERVICE_* index on Machine object",
124
+ "mitigation": "Use ${perm_scene_host_object}-specific permission indexes for ${mismatched_targets_csv}",
125
+ "evidence": "index=${table_index_number}, targets=${mismatched_targets_csv_nospace}",
126
+ "stakeholders": ["owner", "admin"]
127
+ }
128
+ ]
129
+ },
130
+ {
131
+ "rule_id": "R-P-2-02",
132
+ "dimension": "semantic",
133
+ "trigger": "custom permission (>= 1000) without a remark in the same call",
134
+ "cases": [
135
+ {
136
+ "when": { "field": "custom_index_without_remark", "op": "eq", "value": true },
137
+ "level": "low",
138
+ "title": "Custom permission without remark",
139
+ "description": "Custom permission ${table_index_number} has no remark; future maintainers won't know its purpose",
140
+ "scenario": "Adding custom permission without documentation",
141
+ "mitigation": "Add remark: { op: \"set\", index: ${table_index_number}, remark: \"<purpose>\" }",
142
+ "evidence": "index=${table_index_number}",
143
+ "stakeholders": ["admin"]
144
+ }
145
+ ]
146
+ },
147
+ {
148
+ "rule_id": "R-P-3-01",
149
+ "dimension": "authority",
150
+ "trigger": "permission over-concentration: owner is the only admin (set with a single address)",
151
+ "cases": [
152
+ {
153
+ "when": { "all": [ { "field": "admin_op", "op": "eq", "value": "set" }, { "field": "admin_address_count", "op": "eq", "value": 1 } ] },
154
+ "level": "medium",
155
+ "title": "Permission over-concentration",
156
+ "description": "Only one admin (likely owner); loss of owner key means permanent lockout",
157
+ "scenario": "Single-admin Permission",
158
+ "mitigation": "Add 1-2 backup admins with limited permission indexes",
159
+ "evidence": "admin_count=1",
160
+ "stakeholders": ["owner"],
161
+ "exposure": {
162
+ "loss_parties": [
163
+ { "role": "merchant", "basis": "With a single admin (the owner), losing that key permanently locks the Permission object — every role assignment, authority grant and fund-flow control it carries becomes unreachable, with no recovery path on-chain." }
164
+ ],
165
+ "gain_paths": []
166
+ }
167
+ }
168
+ ]
169
+ },
170
+ {
171
+ "rule_id": "R-P-3-02",
172
+ "dimension": "authority",
173
+ "trigger": "permission over-dispersion: admin count above 50",
174
+ "cases": [
175
+ {
176
+ "when": { "field": "admin_dispersion_count", "op": "gt", "value": 50 },
177
+ "level": "medium",
178
+ "title": "Permission over-dispersion",
179
+ "description": "${admin_dispersion_count} admins increases coordination cost and key-management risk",
180
+ "scenario": "Large admin committee",
181
+ "mitigation": "Use multi-sig or hierarchical admin structure",
182
+ "evidence": "admin_count=${admin_dispersion_count}",
183
+ "stakeholders": ["owner", "admin"]
184
+ }
185
+ ]
186
+ },
187
+ {
188
+ "rule_id": "R-P-3-03",
189
+ "dimension": "authority",
190
+ "trigger": "UM is the owner self-reference (same address as builder)",
191
+ "cases": [
192
+ {
193
+ "when": { "field": "um_is_builder", "op": "eq", "value": true },
194
+ "level": "medium",
195
+ "title": "UM is owner self-reference",
196
+ "description": "Setting UM to owner address defeats separation of concerns",
197
+ "scenario": "Owner delegates UM to self",
198
+ "mitigation": "Use a separate Contact object address for UM",
199
+ "evidence": "um=${um}",
200
+ "stakeholders": ["owner"]
201
+ }
202
+ ]
203
+ },
204
+ {
205
+ "rule_id": "R-P-4-01",
206
+ "dimension": "lifecycle",
207
+ "trigger": "ownership transfer operation (builder field set)",
208
+ "cases": [
209
+ {
210
+ "when": { "field": "builder", "op": "truthy" },
211
+ "level": "high",
212
+ "title": "Ownership transfer — irreversible",
213
+ "description": "Transferring Permission to ${builder}. Once executed, original owner loses ALL control permanently.",
214
+ "scenario": "Owner transfers Permission to new address",
215
+ "mitigation": "1) Verify new owner address twice. 2) Export Permission JSON before transfer. 3) Coordinate with new owner to confirm receipt.",
216
+ "evidence": "new_owner=${builder}",
217
+ "stakeholders": ["owner"]
218
+ }
219
+ ]
220
+ },
221
+ {
222
+ "rule_id": "R-P-4-02",
223
+ "dimension": "lifecycle",
224
+ "trigger": "apply to more than 3 objects at once",
225
+ "cases": [
226
+ {
227
+ "when": { "field": "apply_count", "op": "gt", "value": 3 },
228
+ "level": "medium",
229
+ "title": "Batch apply to multiple objects",
230
+ "description": "Applying Permission to ${apply_count} objects at once; if any object type mismatches, transaction may fail or silently misalign",
231
+ "scenario": "Batch apply across heterogeneous objects",
232
+ "mitigation": "Apply to 1-3 objects at a time; verify each object type matches permission indexes",
233
+ "evidence": "apply_count=${apply_count}",
234
+ "stakeholders": ["owner"]
235
+ }
236
+ ]
237
+ },
238
+ {
239
+ "rule_id": "R-P-4-03",
240
+ "dimension": "lifecycle",
241
+ "trigger": "entity replace operation (destructive)",
242
+ "cases": [
243
+ {
244
+ "when": { "field": "entity_op", "op": "eq", "value": "replace" },
245
+ "level": "medium",
246
+ "title": "Entity replace — destructive",
247
+ "description": "Replacing ${entity_replace_from} with ${entity_replace_to}; entity1 loses ALL permissions permanently",
248
+ "scenario": "Replacing a user who left the organization",
249
+ "mitigation": "Prefer 'copy' over 'replace' if entity1 should retain permissions",
250
+ "evidence": "entity1=${entity_replace_from}, entity2=${entity_replace_to}",
251
+ "stakeholders": ["entity"]
252
+ }
253
+ ]
254
+ },
255
+ {
256
+ "rule_id": "R-P-5-01",
257
+ "dimension": "cross_object",
258
+ "trigger": "apply to a Progress object (Permission becomes immutable on bind)",
259
+ "cases": [
260
+ {
261
+ "when": { "all": [ { "field": "apply", "op": "present" }, { "field": "targets_include_progress", "op": "eq", "value": true } ] },
262
+ "level": "medium",
263
+ "title": "Apply to Progress — post-bind mutability limited",
264
+ "description": "Once Permission is bound to Progress (which binds Machine), permission table changes may not affect already-published Machine workflow",
265
+ "scenario": "Permission shared across Machine/Progress",
266
+ "mitigation": "Configure all permission indexes before Machine publish",
267
+ "evidence": "target=Progress",
268
+ "stakeholders": ["owner"]
269
+ }
270
+ ]
271
+ },
272
+ {
273
+ "rule_id": "R-P-5-02",
274
+ "dimension": "cross_object",
275
+ "trigger": "permission reused across multiple host object types",
276
+ "cases": [
277
+ {
278
+ "when": { "field": "unique_target_type_count", "op": "gt", "value": 1 },
279
+ "level": "medium",
280
+ "title": "Permission shared across heterogeneous objects",
281
+ "description": "Single Permission applied to ${unique_target_types_csv}; permission indexes may have different semantics per object",
282
+ "scenario": "One Permission for both Service and Treasury",
283
+ "mitigation": "Use separate Permission objects per host object type for clarity",
284
+ "evidence": "types=${unique_target_types_csv_nospace}",
285
+ "stakeholders": ["owner", "admin"]
286
+ }
287
+ ]
288
+ },
289
+ {
290
+ "rule_id": "R-P-5-03",
291
+ "dimension": "cross_object",
292
+ "trigger": "treasury external_*_guard management index (255/256) granted — verify guard lists are populated",
293
+ "cases": [
294
+ {
295
+ "when": { "field": "treasury_external_guard_op", "op": "eq", "value": "withdraw" },
296
+ "level": "high",
297
+ "title": "Treasury external guard management granted — populate guard lists",
298
+ "description": "Permission ${table_index_number} (${treasury_external_guard_name}) granted; ensure external_${treasury_external_guard_op}_guard list is populated via external_*_guard_add so external operations are authorized",
299
+ "scenario": "External treasury guard management without populated guard lists",
300
+ "mitigation": "Call treasury.external_${treasury_external_guard_op}_guard_add to register Guard objects; external_deposit/external_withdraw require Guard + Passport (no Permission index)",
301
+ "evidence": "index=${table_index_number}",
302
+ "stakeholders": ["owner", "admin"],
303
+ "exposure": {
304
+ "loss_parties": [
305
+ { "role": "merchant", "basis": "The 256-class grant lets its holder remount the Treasury's release Guards, opening a permission-free external_withdraw gate over the Treasury balance." }
306
+ ],
307
+ "gain_paths": [
308
+ {
309
+ "role": "collaborator",
310
+ "path": "A non-owner holder of index ${table_index_number} replaces the external_withdraw_guard list with a permissive Guard and pulls funds to an address they control (the release pays the transaction sender).",
311
+ "viability": "viable",
312
+ "gate": "Guard-list write power is implied by the grant and the withdraw itself needs no Treasury Permission; confirm the holder is not the owner and review guard-list history."
313
+ }
314
+ ]
315
+ }
316
+ },
317
+ {
318
+ "when": { "field": "treasury_external_guard_op", "op": "eq", "value": "deposit" },
319
+ "level": "high",
320
+ "title": "Treasury external guard management granted — populate guard lists",
321
+ "description": "Permission ${table_index_number} (${treasury_external_guard_name}) granted; ensure external_${treasury_external_guard_op}_guard list is populated via external_*_guard_add so external operations are authorized",
322
+ "scenario": "External treasury guard management without populated guard lists",
323
+ "mitigation": "Call treasury.external_${treasury_external_guard_op}_guard_add to register Guard objects; external_deposit/external_withdraw require Guard + Passport (no Permission index)",
324
+ "evidence": "index=${table_index_number}",
325
+ "stakeholders": ["owner", "admin"]
326
+ }
327
+ ]
328
+ }
329
+ ]
330
+ }