@wowok/agent-mcp 3.1.3 → 3.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (384) 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/workspace/index.d.ts +53 -0
  320. package/dist/schema/workspace/index.js +1 -1
  321. package/dist/schema-query-impl/index.d.ts +9 -0
  322. package/dist/schema-query-impl/index.js +1 -1
  323. package/dist/schemas/benchmark_migration_operation.output.json +793 -0
  324. package/dist/schemas/benchmark_migration_operation.schema.json +83 -0
  325. package/dist/schemas/bridge_operation.schema.json +5 -5
  326. package/dist/schemas/config_operation.output.json +252 -0
  327. package/dist/schemas/config_operation.schema.json +21 -1
  328. package/dist/schemas/evaluation_operation.output.json +22 -10
  329. package/dist/schemas/goal_operation.schema.json +8 -8
  330. package/dist/schemas/guard2file.schema.json +1 -1
  331. package/dist/schemas/index.json +7 -1
  332. package/dist/schemas/machineNode2file.schema.json +1 -1
  333. package/dist/schemas/messenger_operation.schema.json +24 -12
  334. package/dist/schemas/onchain_events.output.json +1 -1
  335. package/dist/schemas/onchain_operations.output.json +4 -2
  336. package/dist/schemas/onchain_operations.schema.json +189 -139
  337. package/dist/schemas/onchain_operations_allocation.schema.json +13 -11
  338. package/dist/schemas/onchain_operations_arbitration.schema.json +10 -8
  339. package/dist/schemas/onchain_operations_contact.schema.json +7 -5
  340. package/dist/schemas/onchain_operations_demand.schema.json +7 -5
  341. package/dist/schemas/onchain_operations_gen_passport.schema.json +5 -3
  342. package/dist/schemas/onchain_operations_gen_proof.schema.json +1 -1
  343. package/dist/schemas/onchain_operations_guard.schema.json +5 -3
  344. package/dist/schemas/onchain_operations_machine.schema.json +22 -18
  345. package/dist/schemas/onchain_operations_order.schema.json +11 -7
  346. package/dist/schemas/onchain_operations_payment.schema.json +3 -3
  347. package/dist/schemas/onchain_operations_permission.schema.json +19 -11
  348. package/dist/schemas/onchain_operations_personal.schema.json +16 -10
  349. package/dist/schemas/onchain_operations_progress.schema.json +11 -7
  350. package/dist/schemas/onchain_operations_proof.schema.json +5 -3
  351. package/dist/schemas/onchain_operations_repository.schema.json +12 -8
  352. package/dist/schemas/onchain_operations_reward.schema.json +11 -9
  353. package/dist/schemas/onchain_operations_service.schema.json +28 -22
  354. package/dist/schemas/onchain_operations_treasury.schema.json +11 -9
  355. package/dist/schemas/onchain_table_data.output.json +27 -17
  356. package/dist/schemas/persona_operation.output.json +15875 -1
  357. package/dist/schemas/persona_operation.schema.json +3056 -478
  358. package/dist/schemas/query_toolkit.output.json +343 -63
  359. package/dist/schemas/query_toolkit.schema.json +1 -1
  360. package/dist/schemas/workflow_operation.schema.json +4 -2
  361. package/dist/schemas/workspace_operation.output.json +181 -1
  362. package/dist/schemas/workspace_operation.schema.json +61 -2
  363. package/dist/strategy/scorecard.js +1 -1
  364. package/dist/tools/handlers/benchmark-migration.d.ts +2 -0
  365. package/dist/tools/handlers/benchmark-migration.js +1 -0
  366. package/dist/tools/handlers/config.js +1 -1
  367. package/dist/tools/handlers/industry-pack.js +1 -1
  368. package/dist/tools/handlers/onchain.js +1 -1
  369. package/dist/tools/handlers/query.js +1 -1
  370. package/dist/tools/handlers/schema-query.js +1 -1
  371. package/dist/tools/handlers/workspace.js +1 -1
  372. package/dist/tools/index.js +1 -1
  373. package/dist/tools/move-fn-index.gen.d.ts +3 -0
  374. package/dist/tools/move-fn-index.gen.js +1 -0
  375. package/dist/tools/registry/business.js +1 -1
  376. package/dist/tools/registry/config.js +1 -1
  377. package/dist/tools/registry/evaluation.js +1 -1
  378. package/dist/tools/registry/onchain.js +1 -1
  379. package/dist/tools/sanitize-output.d.ts +3 -0
  380. package/dist/tools/sanitize-output.js +1 -0
  381. package/dist/tools/sanitize-output.spec.d.ts +1 -0
  382. package/dist/tools/sanitize-output.spec.js +1 -0
  383. package/package.json +9 -4
  384. package/dist/knowledge/baselines/evaluation-baselines.json +0 -79
@@ -0,0 +1,158 @@
1
+ {
2
+ "comment": "Proof rule pack (R-PROOF) — declarative form of the retired in-code Proof risk rules. Facts are produced by the kernel extractor (proof-risk.ts, bound to the on-chain proof/pubkey/signature size limits and the reserved proof_type range); 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. R-PROOF-07 stays LAST in the array: it is the unconditional immutability reminder the retired check appended after every evaluation.",
3
+ "facts": {
4
+ "proof_length": "Length of the 'proof' content string, passed through for evidence text.",
5
+ "proof_size_exceeded": "True when a non-empty proof content exceeds the chain proof size limit.",
6
+ "server_pubkey_length": "Length of the server_pubkey string, passed through for evidence text.",
7
+ "server_pubkey_size_exceeded": "True when a non-empty server_pubkey exceeds the chain pubkey size limit.",
8
+ "server_signature_length": "Length of the server_signature string, passed through for evidence text.",
9
+ "server_signature_size_exceeded": "True when a non-empty server_signature exceeds the chain signature size limit.",
10
+ "proof_type": "Raw proof_type value (number / bigint / numeric string), passed through for evidence text.",
11
+ "proof_type_reserved": "True when proof_type is provided, is not the WTS type, and falls in the Wowok-reserved 2-100 range.",
12
+ "about_address": "Raw about_address value — falsy (null/undefined/empty) means the Proof has no on-chain binding.",
13
+ "description_empty": "True when description is provided but is the empty string.",
14
+ "constants_synced": "True when the proof constants are in sync with the published chain constants (false = knowledge-layer regression).",
15
+ "always_true": "Unconditional marker fact — rules that fire for every evaluation reference it.",
16
+ "max_proof_size": "KERNEL CONSTANT — maximum proof content size in bytes.",
17
+ "max_server_pubkey_size": "KERNEL CONSTANT — maximum server_pubkey size in bytes.",
18
+ "max_server_signature_size": "KERNEL CONSTANT — maximum server_signature size in bytes.",
19
+ "wowok_wts_proof_type": "KERNEL CONSTANT — the proof_type value reserved for Will-To-Sign (WTS) proofs."
20
+ },
21
+ "rules": [
22
+ {
23
+ "rule_id": "R-PROOF-01",
24
+ "dimension": "structural",
25
+ "trigger": "proof content exceeds the chain proof size limit",
26
+ "cases": [
27
+ {
28
+ "when": { "field": "proof_size_exceeded", "op": "eq", "value": true },
29
+ "level": "high",
30
+ "title": "proof content exceeds MAX_PROOF_SIZE (${max_proof_size} bytes)",
31
+ "description": "The 'proof' string field is bounded by MAX_PROOF_SIZE=${max_proof_size} bytes. Exceeding this limit aborts with E_MAX_PROOF_SIZE (1). The proof content typically holds a merkle tree root or similar compact cryptographic digest — large data should be stored in a Repository and referenced by address, not inlined into the Proof object.",
32
+ "scenario": "Caller submits a proof string longer than 10240 bytes",
33
+ "mitigation": "Keep proof content compact (merkle root, hash digest). For larger payloads, store data in a Repository object and set about_address to the Repository address, or use item_count to indicate the off-chain data size.",
34
+ "evidence": "proof.length=${proof_length}, limit=${max_proof_size}",
35
+ "stakeholders": ["creator"]
36
+ }
37
+ ]
38
+ },
39
+ {
40
+ "rule_id": "R-PROOF-02",
41
+ "dimension": "structural",
42
+ "trigger": "server_pubkey exceeds the chain pubkey size limit",
43
+ "cases": [
44
+ {
45
+ "when": { "field": "server_pubkey_size_exceeded", "op": "eq", "value": true },
46
+ "level": "medium",
47
+ "title": "server_pubkey exceeds MAX_SERVER_PUBKEY_SIZE (${max_server_pubkey_size} bytes)",
48
+ "description": "The 'server_pubkey' field is bounded by MAX_SERVER_PUBKEY_SIZE=${max_server_pubkey_size} bytes. Exceeding this limit aborts with E_MAX_SERVER_PUBKEY_SIZE (2). Typical public keys (Ed25519=32 bytes, RSA-2048=256 bytes, BLS12-381 G1=48 bytes, G2=96 bytes) fit comfortably within this limit.",
49
+ "scenario": "Caller submits an oversized server public key (e.g. certificate chain instead of raw key)",
50
+ "mitigation": "Submit only the raw public key bytes (hex-encoded), not a full certificate or JWK structure.",
51
+ "evidence": "server_pubkey.length=${server_pubkey_length}, limit=${max_server_pubkey_size}",
52
+ "stakeholders": ["creator"]
53
+ }
54
+ ]
55
+ },
56
+ {
57
+ "rule_id": "R-PROOF-03",
58
+ "dimension": "structural",
59
+ "trigger": "server_signature exceeds the chain signature size limit",
60
+ "cases": [
61
+ {
62
+ "when": { "field": "server_signature_size_exceeded", "op": "eq", "value": true },
63
+ "level": "medium",
64
+ "title": "server_signature exceeds MAX_SERVER_SIGNATURE_SIZE (${max_server_signature_size} bytes)",
65
+ "description": "The 'server_signature' field is bounded by MAX_SERVER_SIGNATURE_SIZE=${max_server_signature_size} bytes. Exceeding this limit aborts with E_MAX_SERVER_SIGNATURE_SIZE (3). Most signature schemes produce signatures well under this limit (Ed25519=64 bytes, ECDSA=64-72 bytes, BLS12-381=96 bytes, RSA-2048=256 bytes).",
66
+ "scenario": "Caller submits an oversized signature (e.g. bundled with metadata)",
67
+ "mitigation": "Submit only the raw signature bytes (hex-encoded), not bundled metadata or certificate chains.",
68
+ "evidence": "server_signature.length=${server_signature_length}, limit=${max_server_signature_size}",
69
+ "stakeholders": ["creator"]
70
+ }
71
+ ]
72
+ },
73
+ {
74
+ "rule_id": "R-PROOF-04",
75
+ "dimension": "semantic",
76
+ "trigger": "proof_type falls in the Wowok-reserved 2-100 range without authority",
77
+ "cases": [
78
+ {
79
+ "when": { "field": "proof_type_reserved", "op": "eq", "value": true },
80
+ "level": "medium",
81
+ "title": "proof_type in reserved range without authority (1-100 reserved for Wowok)",
82
+ "description": "proof_type=${wowok_wts_proof_type} is WOWOK_WTS_PROOF_TYPE (Will-To-Sign). Values 2-100 are reserved for future Wowok-defined proof types. User-defined proof types must use values > 100. While the Move contract does not currently enforce this range at the type level (it accepts any u64), using a reserved value without authority creates semantic confusion: consumers may misinterpret the proof's verification rules.",
83
+ "scenario": "User creates a custom proof with proof_type=5 (a reserved value)",
84
+ "mitigation": "Use proof_type > 100 for user-defined proof types. Use proof_type=1 only for WTS proofs signed by an off-chain server (with server_pubkey + server_signature). Document the verification rule for custom types.",
85
+ "evidence": "proof_type=${proof_type} (reserved range 2-100)",
86
+ "stakeholders": ["creator", "consumer", "verifier"]
87
+ }
88
+ ]
89
+ },
90
+ {
91
+ "rule_id": "R-PROOF-05",
92
+ "dimension": "semantic",
93
+ "trigger": "about_address left null/undefined",
94
+ "cases": [
95
+ {
96
+ "when": { "field": "about_address", "op": "falsy" },
97
+ "level": "low",
98
+ "title": "about_address not provided — consumers cannot locate the referenced entity",
99
+ "description": "about_address is the on-chain address of the entity being proved (e.g. a user, an order, a Repository). When null/undefined, the Proof has no on-chain binding — it is a free-standing cryptographic statement. Consumers (Repository, Service, etc.) that reference this Proof cannot automatically resolve which entity it applies to. This is acceptable for generic proofs but problematic for entity-bound attestations.",
100
+ "scenario": "Caller creates a Proof without about_address, then a Repository tries to bind it to a data entry",
101
+ "mitigation": "Set about_address when the Proof attests to a specific on-chain entity. Leave it null only for free-standing cryptographic statements (e.g. a server's timestamp attestation).",
102
+ "evidence": "about_address=null/undefined",
103
+ "stakeholders": ["creator", "consumer"]
104
+ }
105
+ ]
106
+ },
107
+ {
108
+ "rule_id": "R-PROOF-06",
109
+ "dimension": "lifecycle",
110
+ "trigger": "description provided as the empty string",
111
+ "cases": [
112
+ {
113
+ "when": { "field": "description_empty", "op": "eq", "value": true },
114
+ "level": "low",
115
+ "title": "description missing — Proof hard to identify in queries and audit logs",
116
+ "description": "description is a REQUIRED field (PF-D-2=A). The Move contract stores it as a String field and SDK passes it to the proof-creation call. An empty description (\"\") is technically valid but makes the Proof hard to identify in query results and audit logs. Non-empty descriptions are strongly recommended.",
117
+ "scenario": "Caller passes description=\"\" to save typing",
118
+ "mitigation": "Provide a one-line description like \"KYC attestation for user 0xabc\" or \"merkle root for batch #42\".",
119
+ "evidence": "description=\"\" (empty)",
120
+ "stakeholders": ["creator", "verifier"]
121
+ }
122
+ ]
123
+ },
124
+ {
125
+ "rule_id": "R-PROOF-08",
126
+ "dimension": "knowledge",
127
+ "trigger": "proof constants not synced to the knowledge constant table",
128
+ "cases": [
129
+ {
130
+ "when": { "field": "constants_synced", "op": "falsy" },
131
+ "level": "info",
132
+ "title": "Knowledge layer & constant sync — RESOLVED",
133
+ "description": "All 4 Proof constants (WOWOK_WTS_PROOF_TYPE, MAX_PROOF_SIZE, MAX_SERVER_PUBKEY_SIZE, MAX_SERVER_SIGNATURE_SIZE) are now synced to onchain-constants.ts (P-PROOF-P2-5). The MCP Knowledge layer now includes proof-risk.ts, proof-confirm.ts, proof-translation.ts (P-PROOF-P2-6). This risk rule is retained for historical audit and to detect future regressions.",
134
+ "scenario": "Future regression: someone removes a Proof constant from onchain-constants.ts",
135
+ "mitigation": "Run the onchain-constants sync test to detect drift.",
136
+ "evidence": "constants_synced=false",
137
+ "stakeholders": ["system"]
138
+ }
139
+ ]
140
+ },
141
+ {
142
+ "rule_id": "R-PROOF-07",
143
+ "dimension": "lifecycle",
144
+ "trigger": "unconditional — fires for every evaluation (appended last by the retired check)",
145
+ "cases": [
146
+ {
147
+ "when": { "field": "always_true", "op": "eq", "value": true },
148
+ "level": "high",
149
+ "title": "Proof is immutable — cannot modify after creation (freeze_object)",
150
+ "description": "Proof is created via transfer::freeze_object(obj) in Move. Once frozen, the object cannot be modified, transferred, or deleted. All fields (proof, server_pubkey, server_signature, about, proof_type, signer, time, description, item_count) are permanently fixed at the value set during creation. To 'update' a Proof, create a new one and update references.",
151
+ "scenario": "Caller wants to update server_signature after key rotation — cannot, must create new Proof",
152
+ "mitigation": "Verify all fields before creating the Proof. For scenarios requiring key rotation, create a new Proof and update the referencing object (Repository data, Service config, etc.) to point to the new Proof address.",
153
+ "stakeholders": ["creator", "consumer"]
154
+ }
155
+ ]
156
+ }
157
+ ]
158
+ }
@@ -0,0 +1,159 @@
1
+ {
2
+ "comment": "Registrar+Entity rule pack (R-REG) — declarative form of the retired in-code Registrar/Entity risk rules. Facts are produced by the kernel extractor (registrar-risk.ts, bound to the on-chain registrar limits and the Vote.info bitmask); 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
+ "expects_singleton_migration": "The caller assumes the Entity/Registrar system singletons can be re-deployed or migrated (they cannot).",
5
+ "address_count": "Number of addresses registered (or about to be registered) in the Entity/Registrar ParentTables.",
6
+ "address_count_at_limit": "address_count has reached MAX_ADDRESS_COUNT (chain-limit comparison sunk into the extractor).",
7
+ "uses_reserved_vote_bits": "The caller relies on reserved Vote.info bits 4-7 staying unused.",
8
+ "expects_fresh_resource_on_register": "The caller calls entity_register expecting a fresh Resource (registration is idempotent).",
9
+ "expects_affiliation_event": "The caller expects object-linker affiliation/disaffiliation to emit events (none are emitted).",
10
+ "relies_on_typed_value_convention": "The caller relies on the Record.typed_value first-byte ValueType convention (docs-only enforcement).",
11
+ "is_resource_transfer": "The caller is performing an entity resource transfer.",
12
+ "expects_vote_time_only_on_like": "The caller expects Vote.time to update only on like (it updates on every toggle).",
13
+ "bit_no_info": "KERNEL CONSTANT — Vote.info bitmask value for no-info (BIT_NO_INFO).",
14
+ "bit_like": "KERNEL CONSTANT — Vote.info bitmask value for like (BIT_LIKE).",
15
+ "bit_dislike": "KERNEL CONSTANT — Vote.info bitmask value for dislike (BIT_DISLIKE).",
16
+ "bit_affiliation": "KERNEL CONSTANT — Vote.info bitmask value for affiliation (BIT_AFFILIATION).",
17
+ "max_address_count": "KERNEL CONSTANT — ParentTable address cap (MAX_ADDRESS_COUNT).",
18
+ "max_record_length": "KERNEL CONSTANT — per-record byte cap (MAX_RECORD_LENGTH).",
19
+ "max_record_count_registrar": "KERNEL CONSTANT — per-user record count cap (MAX_RECORD_COUNT_REGISTRAR)."
20
+ },
21
+ "rules": [
22
+ {
23
+ "rule_id": "R-REG-01",
24
+ "dimension": "lifecycle",
25
+ "trigger": "caller assumes the Entity/Registrar singletons can be migrated post-deploy",
26
+ "cases": [
27
+ {
28
+ "when": { "field": "expects_singleton_migration", "op": "eq", "value": true },
29
+ "level": "high",
30
+ "title": "Entity and Registrar are system singletons — cannot be migrated post-deploy",
31
+ "description": "Entity and Registrar are created once at package init by @0x0 and are globally unique. They cannot be re-created, migrated, or re-initialized. If the singleton's storage layout needs to change (e.g. ParentTable schema), the only option is a new package version with a migration path. There is no in-place migration API. All 22 objects depend on these singletons via object-linker bindings, so a migration would cascade to every object.",
32
+ "scenario": "Operator wants to migrate Entity to a new schema; no migration API exists",
33
+ "mitigation": "Confirm the schema before deployment. For schema evolution, plan a new package version with an explicit migration script. Never assume the singleton can be 'reset'.",
34
+ "evidence": "expects_singleton_migration=true (no migration API)",
35
+ "stakeholders": ["system", "user"]
36
+ }
37
+ ]
38
+ },
39
+ {
40
+ "rule_id": "R-REG-02",
41
+ "dimension": "structural",
42
+ "trigger": "registered address count reaches MAX_ADDRESS_COUNT",
43
+ "cases": [
44
+ {
45
+ "when": { "field": "address_count_at_limit", "op": "eq", "value": true },
46
+ "level": "medium",
47
+ "title": "MAX_ADDRESS_COUNT=${max_address_count} may be insufficient for large deployments",
48
+ "description": "The Entity and Registrar ParentTables are bounded by MAX_ADDRESS_COUNT=${max_address_count}. Exceeding the cap aborts address registration. For mass-market applications, ${max_address_count} entries may be too few; the limit is a single Move constant that requires a package upgrade to change.",
49
+ "scenario": "Popular service reaches 5200 registered users; new registrations abort",
50
+ "mitigation": "Monitor address_count. Plan a package upgrade that raises MAX_ADDRESS_COUNT before hitting the cap. For shardable workloads, consider multiple Entity tables in a future package version.",
51
+ "evidence": "address_count=${address_count}, limit=${max_address_count}",
52
+ "stakeholders": ["system", "user"]
53
+ }
54
+ ]
55
+ },
56
+ {
57
+ "rule_id": "R-REG-03",
58
+ "dimension": "semantic",
59
+ "trigger": "caller relies on reserved Vote.info bits 4-7",
60
+ "cases": [
61
+ {
62
+ "when": { "field": "uses_reserved_vote_bits", "op": "eq", "value": true },
63
+ "level": "medium",
64
+ "title": "Vote.info uses u8 bitmask — bits 4-7 reserved, future expansion must stay compatible",
65
+ "description": "Vote.info is a u8 bitmask: BIT_NO_INFO=${bit_no_info}, BIT_LIKE=${bit_like}, BIT_DISLIKE=${bit_dislike}, BIT_AFFILIATION=${bit_affiliation}. Bits 4-7 are reserved. A future version that repurposes bits 4-7 would conflict with any off-chain code that reads the raw byte. The reserved bits MUST be treated as zero today; non-zero values in bits 4-7 indicate a forward-incompatible voter.",
66
+ "scenario": "Future version assigns bit 4 to a new flag; old indexers misread the byte",
67
+ "mitigation": "Off-chain code must mask to bits 0-3 today and ignore bits 4-7. When a new flag is assigned, ship a coordinated Move + SDK + indexer update.",
68
+ "evidence": "uses_reserved_vote_bits=true (bits 4-7 are reserved)",
69
+ "stakeholders": ["voter", "system"]
70
+ }
71
+ ]
72
+ },
73
+ {
74
+ "rule_id": "R-REG-05",
75
+ "dimension": "cross_object",
76
+ "trigger": "caller expects object-linker affiliation changes to emit events",
77
+ "cases": [
78
+ {
79
+ "when": { "field": "expects_affiliation_event", "op": "eq", "value": true },
80
+ "level": "medium",
81
+ "title": "object-linker affiliation / disaffiliation emit no events — indexers must poll object_linker tables",
82
+ "description": "The affiliation binding, unbinding, and binding-change operations mutate the binding graph but emit no events. External indexers that track the object-dependency graph cannot rely on an event stream; they must poll the ParentTable, which is expensive as the graph grows.",
83
+ "scenario": "Indexer expects an AffiliationEvent; none is emitted, dependency graph is stale",
84
+ "mitigation": "Indexers should poll object_linker tables on a cadence and diff. Future versions may add AffiliationEvent; until then, do not build critical UX on affiliation event streams.",
85
+ "evidence": "expects_affiliation_event=true (no events)",
86
+ "stakeholders": ["system"]
87
+ }
88
+ ]
89
+ },
90
+ {
91
+ "rule_id": "R-REG-04",
92
+ "dimension": "lifecycle",
93
+ "trigger": "caller expects a fresh Resource from idempotent registration",
94
+ "cases": [
95
+ {
96
+ "when": { "field": "expects_fresh_resource_on_register", "op": "eq", "value": true },
97
+ "level": "low",
98
+ "title": "Registration is idempotent — returns existing Resource, not a fresh one",
99
+ "description": "Registration checks whether the sender already has an Entity record. If so, it returns the existing Resource address without creating a new one. Callers who expect a fresh Resource on each call (e.g. after a forced destroy) will silently receive the old one. Use the forced re-registration path to force-reallocate, and only when the old Resource is truly gone.",
100
+ "scenario": "User destroys their Resource then re-registers; gets the old (now-invalid) address",
101
+ "mitigation": "Document the idempotent behavior. After a forced destroy, callers MUST use the forced re-registration path. SDK should detect destroyed Resource and route accordingly.",
102
+ "evidence": "expects_fresh_resource_on_register=true (idempotent)",
103
+ "stakeholders": ["user"]
104
+ }
105
+ ]
106
+ },
107
+ {
108
+ "rule_id": "R-REG-06",
109
+ "dimension": "semantic",
110
+ "trigger": "caller relies on the Record.typed_value ValueType byte convention",
111
+ "cases": [
112
+ {
113
+ "when": { "field": "relies_on_typed_value_convention", "op": "eq", "value": true },
114
+ "level": "low",
115
+ "title": "Record.typed_value first byte is a ValueType — convention enforced only by docs",
116
+ "description": "Record.typed_value is a vector<u8> whose first byte encodes the ValueType. The Move layer validates that the vector is non-empty and within MAX_RECORD_LENGTH=${max_record_length}, but it does not validate that the first byte is a known ValueType. Off-chain consumers must agree on the ValueType byte layout; a misencoded record will deserialize to garbage without an on-chain abort. Record count is bounded by MAX_RECORD_COUNT_REGISTRAR=${max_record_count_registrar}.",
117
+ "scenario": "Caller writes a record with first byte 0xFF; no on-chain error, but consumers cannot decode",
118
+ "mitigation": "SDK must validate the first byte against the ValueType enum before submitting. Document the ValueType byte layout in both Move and SDK. Add a sync test that asserts the ValueType enum matches across layers.",
119
+ "evidence": "relies_on_typed_value_convention=true (docs-only enforcement)",
120
+ "stakeholders": ["user", "system"]
121
+ }
122
+ ]
123
+ },
124
+ {
125
+ "rule_id": "R-REG-07",
126
+ "dimension": "cross_object",
127
+ "trigger": "an entity resource transfer detaches the Resource from its source address",
128
+ "cases": [
129
+ {
130
+ "when": { "field": "is_resource_transfer", "op": "eq", "value": true },
131
+ "level": "medium",
132
+ "title": "Resource transfer detaches the Resource from the source address",
133
+ "description": "The entity resource transfer moves the Resource backing a user's identity mark to a new address. After transfer, the source address has no Resource — any downstream service that keyed identity on the source address loses the binding. There is no automatic forwarding stub left behind.",
134
+ "scenario": "User transfers Resource to a new wallet; old-wallet-based services break",
135
+ "mitigation": "Surface a 'transfer will detach the Resource from this address' warning. Consumers should track users by Resource address, not by user address. Provide a migration window where both addresses are valid.",
136
+ "evidence": "is_resource_transfer=true (source loses Resource)",
137
+ "stakeholders": ["user", "system"]
138
+ }
139
+ ]
140
+ },
141
+ {
142
+ "rule_id": "R-REG-08",
143
+ "dimension": "semantic",
144
+ "trigger": "caller expects Vote.time to advance only on like",
145
+ "cases": [
146
+ {
147
+ "when": { "field": "expects_vote_time_only_on_like", "op": "eq", "value": true },
148
+ "level": "low",
149
+ "title": "Vote.time updates on every toggle — including like→no-like",
150
+ "description": "Vote.time is set to clock.timestamp_ms() on every like/dislike operation, including toggles that remove a like (like→no-like). Consumers who interpret Vote.time as 'last liked at' will be confused when it advances on an un-like. The field semantically means 'last vote op time', not 'last positive vote'.",
151
+ "scenario": "User un-likes; Vote.time advances; indexer reads it as 'recently liked'",
152
+ "mitigation": "Document Vote.time as 'last vote operation time'. For 'last liked at' semantics, track the previous Vote.info state and only record time when BIT_LIKE transitions to set.",
153
+ "evidence": "expects_vote_time_only_on_like=true (updates on toggle)",
154
+ "stakeholders": ["voter", "system"]
155
+ }
156
+ ]
157
+ }
158
+ ]
159
+ }
@@ -0,0 +1,244 @@
1
+ {
2
+ "comment": "Repository rule pack (R-REP) — declarative form of the retired in-code Repository risk rules. Facts are produced by the kernel extractor (repository-risk.ts, bound to the live repository limits and the id_from routing semantics); 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
+ "policies": "The policy drafts under evaluation (name, id_from routing, write_guard size, submission routing flags).",
5
+ "existing_policy_count": "Number of policies already stored on the Repository object.",
6
+ "data_size": "Data payload size in bytes of the current write.",
7
+ "id_count_once": "Number of data IDs targeted by the current single operation.",
8
+ "reward_count": "Number of Reward objects referenced by the Repository.",
9
+ "is_data_remove_with_passport": "Whether the operation is the passport-driven data removal entry point (R-D-2 check).",
10
+ "constants_synced": "Whether the Repository constants are synced to onchain-constants.ts (the sync reminder fires when falsy).",
11
+ "has_quote_guard": "Whether quote_guard is set (Some) on any policy.",
12
+ "quote_guard_is_depended": "Whether the quote_guard satisfies is_depended (immutable + no relies + rep=true).",
13
+ "quote_guard_verifies_payment": "Whether the quote_guard verifies Payment for subscription.",
14
+ "has_owner_receive": "Whether the Repository has owner_receive configured for Payment revenue.",
15
+ "max_policy_count": "KERNEL CONSTANT — live MAX_POLICY_COUNT limit from the published package.",
16
+ "max_policy_guard_count": "KERNEL CONSTANT — live MAX_POLICY_GUARD_COUNT limit from the published package.",
17
+ "max_data_size": "KERNEL CONSTANT — live MAX_DATA_SIZE limit in bytes from the published package.",
18
+ "max_id_count_once": "KERNEL CONSTANT — live MAX_ID_COUNT_ONCE limit from the published package.",
19
+ "max_reward_count": "KERNEL CONSTANT — live MAX_REWARD_COUNT limit from the published package.",
20
+ "policies_count": "KERNEL — number of policy drafts being added in this operation.",
21
+ "total_policy_count": "KERNEL — existing_policy_count + policies_count (present only when both inputs exist).",
22
+ "policy_count_over_limit": "KERNEL — total_policy_count exceeds the live MAX_POLICY_COUNT.",
23
+ "policy_none_guard_no_id_count": "KERNEL — policies with id_from=None (caller-provided id) AND an empty write_guard list.",
24
+ "policy_none_guard_no_id_list": "KERNEL — comma-space joined names of the id_from=None + empty write_guard policies.",
25
+ "policy_auto_id_submission_count": "KERNEL — policies with id_from=Clock/Signer (auto-generated id) whose guard sets id_from_submission.",
26
+ "policy_auto_id_submission_list": "KERNEL — comma-space joined 'name(id_from=<raw>)' entries of the auto-id + id_from_submission policies.",
27
+ "policy_guard_over_limit_count": "KERNEL — policies whose write_guard count exceeds the live MAX_POLICY_GUARD_COUNT.",
28
+ "policy_guard_over_limit_list": "KERNEL — comma-space joined 'name(count)' entries of the over-limit policies.",
29
+ "data_size_over_limit": "KERNEL — data_size exceeds the live MAX_DATA_SIZE.",
30
+ "id_count_over_limit": "KERNEL — id_count_once exceeds the live MAX_ID_COUNT_ONCE.",
31
+ "reward_count_at_limit": "KERNEL — reward_count has reached the live MAX_REWARD_COUNT (>= limit).",
32
+ "policy_data_sub_no_id_sub_count": "KERNEL — policies whose guard sets data_from_submission without id_from_submission (Mode 5 mixed write).",
33
+ "policy_data_sub_no_id_sub_list": "KERNEL — comma-space joined names of the data_from_submission-only policies.",
34
+ "policy_data_sub_removal_count": "KERNEL — policies whose guard sets data_from_submission while the operation is passport-driven data removal.",
35
+ "policy_data_sub_removal_list": "KERNEL — comma-space joined names of those policies.",
36
+ "quote_guard_gap": "KERNEL — what the quote_guard subscription design is missing ('quote_guard does not verify Payment' / 'Repository missing owner_receive for revenue', joined by '; '; empty when fully configured)."
37
+ },
38
+ "rules": [
39
+ {
40
+ "rule_id": "R-REP-01",
41
+ "dimension": "structural",
42
+ "trigger": "existing + new policy count exceeds MAX_POLICY_COUNT",
43
+ "cases": [
44
+ {
45
+ "when": { "field": "policy_count_over_limit", "op": "eq", "value": true },
46
+ "level": "medium",
47
+ "title": "Policy count exceeds MAX_POLICY_COUNT (${max_policy_count})",
48
+ "description": "A single Repository may hold up to MAX_POLICY_COUNT=${max_policy_count} policies. Exceeding this limit aborts with E_POLICY_COUNT_EXCEEDED (3) when a policy is added. Each policy defines a named data slot with its own write_guard list and id_from routing — having too many policies makes the Repository hard to audit and increases gas cost for policy lookups (an O(n) scan by policy name).",
49
+ "scenario": "Caller adds 51 policies to a single Repository",
50
+ "mitigation": "Consolidate related data under fewer policies. If truly needed, split data across multiple Repository objects and reference them via Service.repository or Progress.context_repositories.",
51
+ "evidence": "existing=${existing_policy_count}, adding=${policies_count}, total=${total_policy_count}, limit=${max_policy_count}",
52
+ "stakeholders": ["creator"]
53
+ }
54
+ ]
55
+ },
56
+ {
57
+ "rule_id": "R-REP-02",
58
+ "dimension": "policy",
59
+ "trigger": "a policy sets id_from=None with an empty write_guard list",
60
+ "cases": [
61
+ {
62
+ "when": { "field": "policy_none_guard_no_id_count", "op": "gt", "value": 0 },
63
+ "level": "high",
64
+ "title": "write_guard empty when id_from=None — unauthorized writes (R-D-1 Move assert)",
65
+ "description": "When id_from is None, the data ID must be provided by the caller (via the passport-guarded data write or the mixed id+data write). Without a write_guard, ANY address can write data with any ID — this is almost certainly a misconfiguration. The Move contract now enforces this via E_POLICY_WRITE_GUARD_REQUIRED (22) at policy-add time [R-D-1=A].",
66
+ "scenario": "Caller creates a policy with id_from=None and empty write_guard list",
67
+ "mitigation": "When id_from=None, provide at least one PolicyGuard entry in write_guard. If you want unrestricted writes, use id_from=Clock or id_from=Signer instead (which auto-generates the ID and requires empty write_guard).",
68
+ "evidence": "policies with id_from=None + empty write_guard: ${policy_none_guard_no_id_list}",
69
+ "stakeholders": ["creator", "writer"]
70
+ }
71
+ ]
72
+ },
73
+ {
74
+ "rule_id": "R-REP-03",
75
+ "dimension": "policy",
76
+ "trigger": "a guard sets id_from_submission while the policy routes id_from=Clock/Signer",
77
+ "cases": [
78
+ {
79
+ "when": { "field": "policy_auto_id_submission_count", "op": "gt", "value": 0 },
80
+ "level": "high",
81
+ "title": "id_from_submission set when id_from=Clock/Signer — id routing conflict (R-D-1 Move assert)",
82
+ "description": "When id_from is Clock or Signer, the data ID is auto-generated (timestamp or signer address). A PolicyGuard with id_from_submission set would try to route the id from a Passport submission, conflicting with the auto-generated id_from path. The Move contract enforces that id_from_submission MUST be None for every PolicyGuard when id_from is Clock/Signer (data_from_submission is still allowed — it is used by the guarded data-extraction entry point to extract data from the submission). Violations abort with E_POLICY_ID_FROM_SUBMISSION_FORBIDDEN (23) at policy-add time [R-D-1=A, refined].",
83
+ "scenario": "Caller creates a policy with id_from=Clock and a write_guard entry whose id_from_submission is set",
84
+ "mitigation": "When id_from=Clock or Signer, ensure every PolicyGuard has id_from_submission=null. data_from_submission may still be set if you want the guard to supply the data payload (routed via the guarded data-extraction entry point). If you need submission-derived ids, switch to id_from=None and set id_from_submission on the guard.",
85
+ "evidence": "policies with id_from=Clock/Signer + id_from_submission set: ${policy_auto_id_submission_list}",
86
+ "stakeholders": ["creator", "writer"]
87
+ }
88
+ ]
89
+ },
90
+ {
91
+ "rule_id": "R-REP-04",
92
+ "dimension": "structural",
93
+ "trigger": "a policy's write_guard count exceeds MAX_POLICY_GUARD_COUNT",
94
+ "cases": [
95
+ {
96
+ "when": { "field": "policy_guard_over_limit_count", "op": "gt", "value": 0 },
97
+ "level": "medium",
98
+ "title": "Policy write_guard count exceeds MAX_POLICY_GUARD_COUNT (${max_policy_guard_count})",
99
+ "description": "Each policy may define up to MAX_POLICY_GUARD_COUNT=${max_policy_guard_count} guard entries in its write_guard list. Exceeding this limit aborts with E_POLICY_GUARD_COUNT_EXCEEDED (2). Each entry maps to a Guard object that must be verified via Passport submission, so more guards = more complex write authorization semantics.",
100
+ "scenario": "Caller creates a policy with 11 guard entries in write_guard",
101
+ "mitigation": "Consolidate guard logic. If multiple guards must verify the same data, consider composing them into a single Guard with relies/rep fields, or split the data across multiple policies with fewer guards each.",
102
+ "evidence": "policies exceeding guard count: ${policy_guard_over_limit_list}",
103
+ "stakeholders": ["creator"]
104
+ }
105
+ ]
106
+ },
107
+ {
108
+ "rule_id": "R-REP-05",
109
+ "dimension": "structural",
110
+ "trigger": "a data payload exceeds MAX_DATA_SIZE",
111
+ "cases": [
112
+ {
113
+ "when": { "field": "data_size_over_limit", "op": "eq", "value": true },
114
+ "level": "medium",
115
+ "title": "Data value exceeds MAX_DATA_SIZE (${max_data_size} bytes)",
116
+ "description": "A single Repository data value must be ≤ MAX_DATA_SIZE=${max_data_size} bytes. Exceeding this limit aborts with E_DATA_EXCEEDED (4). The value is stored as a BCS-serialized vector<u8> with a type-tag prefix byte. Large data should be stored off-chain (e.g. IPFS, Walrus) and referenced by hash/address, NOT inlined into the Repository data value.",
117
+ "scenario": "Caller writes a 50KB JSON blob as a Repository data value",
118
+ "mitigation": "Store large payloads off-chain and write only the content hash (32-64 bytes) to the Repository. Use about_address on a Proof object to bind the off-chain data to an on-chain attestation.",
119
+ "evidence": "data_size=${data_size}, limit=${max_data_size}",
120
+ "stakeholders": ["writer"]
121
+ }
122
+ ]
123
+ },
124
+ {
125
+ "rule_id": "R-REP-06",
126
+ "dimension": "routing",
127
+ "trigger": "a guard sets data_from_submission without id_from_submission (Mode 5 mixed write)",
128
+ "cases": [
129
+ {
130
+ "when": { "field": "policy_data_sub_no_id_sub_count", "op": "gt", "value": 0 },
131
+ "level": "low",
132
+ "title": "Policy has data_from_submission but no id_from_submission — verify Mode 5 routing intent",
133
+ "description": "When a PolicyGuard has data_from_submission set (data comes from Passport submission) but no id_from_submission (id comes from caller), the SDK routes to the mixed id+data passport write (Mode 5). This is a valid but advanced pattern — ensure the caller provides matching id vectors. The SDK hasSubmissionSettings helper now correctly detects this case [P1-1 fix, R-D-3=A].",
134
+ "scenario": "Policy has a guard with data_from_submission=2, id_from_submission=undefined",
135
+ "mitigation": "Document the expected caller input shape. Ensure the caller provides both the id vector (positional) and the Passport submission (for data). Verify routing via the SDK hasSubmissionSettings helper.",
136
+ "evidence": "policies with data_from_submission but no id_from_submission: ${policy_data_sub_no_id_sub_list}",
137
+ "stakeholders": ["creator", "writer"]
138
+ }
139
+ ]
140
+ },
141
+ {
142
+ "rule_id": "R-REP-07",
143
+ "dimension": "submission",
144
+ "trigger": "passport-driven data removal targets a policy whose guard sets data_from_submission",
145
+ "cases": [
146
+ {
147
+ "when": { "field": "policy_data_sub_removal_count", "op": "gt", "value": 0 },
148
+ "level": "high",
149
+ "title": "data_from_submission set on a policy used for passport-driven data removal — Move will abort (R-D-2)",
150
+ "description": "Passport-driven data removal only removes data identified by the caller-provided id vector; it cannot consume Passport submissions for either id or data. The Move contract now enforces that BOTH id_from_submission AND data_from_submission MUST be None for this entry point [R-D-2=A], aborting with E_GUARD_SPECIFIED_ID_FROM_SUBMISSION (11). Previously, only id_from_submission was checked, allowing data_from_submission to be silently ignored — masking a routing bug.",
151
+ "scenario": "Caller uses passport-driven data removal on a policy whose guard has data_from_submission=2",
152
+ "mitigation": "For data removal via Passport, use the mixed id+data removal entry point instead (which requires id_from_submission and derives the id from the submission). Do not set data_from_submission on policies intended for passport-driven data removal.",
153
+ "evidence": "policies with data_from_submission used in passport-driven data removal: ${policy_data_sub_removal_list}",
154
+ "stakeholders": ["writer", "verifier"]
155
+ }
156
+ ]
157
+ },
158
+ {
159
+ "rule_id": "R-REP-08",
160
+ "dimension": "structural",
161
+ "trigger": "a single op's ID count exceeds MAX_ID_COUNT_ONCE",
162
+ "cases": [
163
+ {
164
+ "when": { "field": "id_count_over_limit", "op": "eq", "value": true },
165
+ "level": "low",
166
+ "title": "ID count per single op exceeds MAX_ID_COUNT_ONCE (${max_id_count_once})",
167
+ "description": "A single Repository call (data_add, data_remove, id_data_*) may operate on at most MAX_ID_COUNT_ONCE=${max_id_count_once} IDs. Exceeding this limit aborts with E_ID_COUNT_EXCEEDED (5). Batch large operations across multiple transactions.",
168
+ "scenario": "Caller passes 150 IDs in a single data_remove call",
169
+ "mitigation": "Split into batches of ≤ ${max_id_count_once} IDs per transaction.",
170
+ "evidence": "id_count=${id_count_once}, limit=${max_id_count_once}",
171
+ "stakeholders": ["writer"]
172
+ }
173
+ ]
174
+ },
175
+ {
176
+ "rule_id": "R-REP-09",
177
+ "dimension": "structural",
178
+ "trigger": "reward count reaches MAX_REWARD_COUNT",
179
+ "cases": [
180
+ {
181
+ "when": { "field": "reward_count_at_limit", "op": "eq", "value": true },
182
+ "level": "info",
183
+ "title": "Reward count approaches MAX_REWARD_COUNT (${max_reward_count})",
184
+ "description": "A Repository may reference up to MAX_REWARD_COUNT=${max_reward_count} Reward objects. Exceeding this limit aborts with E_MAX_REWARD_COUNT_EXCEEDED (19). Rewards incentivize data contribution; having many rewards is fine but increases accounting complexity.",
185
+ "scenario": "Caller adds 20 rewards to a Repository (at the limit)",
186
+ "mitigation": "Monitor reward count. If more incentives are needed, consolidate rewards or use a separate Repository.",
187
+ "evidence": "reward_count=${reward_count}, limit=${max_reward_count}",
188
+ "stakeholders": ["creator"]
189
+ }
190
+ ]
191
+ },
192
+ {
193
+ "rule_id": "R-REP-10",
194
+ "dimension": "knowledge",
195
+ "trigger": "constants drift from onchain-constants.ts / knowledge-layer gaps (sync reminder)",
196
+ "cases": [
197
+ {
198
+ "when": { "field": "constants_synced", "op": "falsy" },
199
+ "level": "info",
200
+ "title": "Knowledge layer & constant sync — RESOLVED",
201
+ "description": "All 6 Repository constants (MAX_POLICY_COUNT, MAX_POLICY_DESCRIPTION_LEN, MAX_POLICY_GUARD_COUNT, MAX_DATA_SIZE, MAX_ID_COUNT_ONCE, MAX_REWARD_COUNT) are now synced to onchain-constants.ts. The MCP Knowledge layer now includes repository-risk.ts, repository-confirm.ts, repository-translation.ts (R-D-4=A). The SDK hasSubmissionSettings helper now correctly checks both id_from_submission AND data_from_submission (P1-1). parseIdFrom is used in data/data_remove (P1-2). This risk rule is retained for historical audit and to detect future regressions.",
202
+ "scenario": "Future regression: someone removes a Repository constant from onchain-constants.ts",
203
+ "mitigation": "Run the onchain-constants sync test to detect drift.",
204
+ "evidence": "constants_synced=false",
205
+ "stakeholders": ["system"]
206
+ }
207
+ ]
208
+ },
209
+ {
210
+ "rule_id": "R-REP-11",
211
+ "dimension": "policy",
212
+ "trigger": "quote_guard set but not dependency-safe",
213
+ "cases": [
214
+ {
215
+ "when": { "all": [ { "field": "has_quote_guard", "op": "truthy" }, { "field": "quote_guard_is_depended", "op": "falsy" } ] },
216
+ "level": "high",
217
+ "title": "quote_guard must be dependency-safe (immutable + rep=true + no relies) — Move assert",
218
+ "description": "Repository policy's quote_guard must satisfy the dependency-safety requirement: immutable=true, relies empty, rep=true. This ensures the quote_guard is a stable, repository-querying guard that can be depended upon. Move aborts with E_NEED_DEPENDENT_GUARD if the guard is not dependency-safe. VERIFIED: passport.rs#L545-612 (check_repository_quote_guard enforces this at query time).",
219
+ "scenario": "Creator sets quote_guard to a Guard that is not dependency-safe (e.g., has relies or is mutable)",
220
+ "mitigation": "Ensure the quote_guard Guard object has: immutable=true, relies=empty, rep=true. Use pattern.repository_quote_guard_subscription as the design template.",
221
+ "evidence": "quote_guard set but not dependency-safe (immutable + rep=true + no relies)",
222
+ "stakeholders": ["creator", "reader"]
223
+ }
224
+ ]
225
+ },
226
+ {
227
+ "rule_id": "R-REP-12",
228
+ "dimension": "knowledge",
229
+ "trigger": "quote_guard subscription without Payment verification or owner_receive revenue",
230
+ "cases": [
231
+ {
232
+ "when": { "all": [ { "field": "has_quote_guard", "op": "truthy" }, { "field": "quote_guard_gap", "op": "truthy" } ] },
233
+ "level": "medium",
234
+ "title": "quote_guard data subscription design — verify Payment verification + owner_receive revenue",
235
+ "description": "When using quote_guard for data subscription (Repository+quote_guard+Payment pattern), ensure: (1) quote_guard verifies Payment fields (for_object matches Repository, amount meets price), (2) Repository has owner_receive<T> configured to accept Payment as subscription revenue. VERIFIED: passport.rs#L545-612. DESIGN: quote_guard is a RIGID verification requirement — any guard querying this Repository's data MUST satisfy the quote_guard (see R-X1-10 in guard-risk.ts).",
236
+ "scenario": "Creator sets quote_guard but does not configure Payment verification or owner_receive",
237
+ "mitigation": "1) Ensure quote_guard verifies Payment (for_object, amount); 2) Configure Repository owner_receive<T> to accept subscription Payment revenue; 3) Use pattern.repository_quote_guard_subscription (guard-design-patterns.ts) and tpl_repository_quote_guard_subscription (guard-templates.ts) as design templates.",
238
+ "evidence": "${quote_guard_gap}",
239
+ "stakeholders": ["creator", "reader", "verifier"]
240
+ }
241
+ ]
242
+ }
243
+ ]
244
+ }