@wowok/agent-mcp 2.7.1 → 2.7.2

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 (375) hide show
  1. package/dist/config/index.js +1 -1
  2. package/dist/config/runtime.js +1 -238
  3. package/dist/customer/customer-advice.js +1 -130
  4. package/dist/customer/index.js +1 -11
  5. package/dist/customer/industry-risks.js +1 -438
  6. package/dist/customer/info-puzzle.js +1 -681
  7. package/dist/customer/order-monitor.js +1 -328
  8. package/dist/customer/order-strategy.js +1 -373
  9. package/dist/customer/post-purchase.js +1 -351
  10. package/dist/customer/preorder-compare.js +1 -34
  11. package/dist/customer/reminder-system.js +1 -316
  12. package/dist/customer/risk-assessment.js +1 -397
  13. package/dist/customer/types.js +1 -13
  14. package/dist/customer/user-preferences.js +1 -460
  15. package/dist/evaluation/arbitration-game.d.ts +9 -2
  16. package/dist/evaluation/arbitration-game.js +1 -48
  17. package/dist/evaluation/builtins/demand-match.js +1 -153
  18. package/dist/evaluation/builtins/index.js +1 -10
  19. package/dist/evaluation/builtins/service-risk.js +1 -55
  20. package/dist/evaluation/capability.js +1 -13
  21. package/dist/evaluation/composer.js +1 -40
  22. package/dist/evaluation/engine.js +1 -175
  23. package/dist/evaluation/extract.js +1 -115
  24. package/dist/evaluation/game-strategy.d.ts +27 -0
  25. package/dist/evaluation/game-strategy.js +1 -0
  26. package/dist/evaluation/gap.js +1 -100
  27. package/dist/evaluation/index.d.ts +1 -0
  28. package/dist/evaluation/index.js +1 -11
  29. package/dist/evaluation/node-game.d.ts +31 -3
  30. package/dist/evaluation/node-game.js +1 -57
  31. package/dist/evaluation/region.js +1 -36
  32. package/dist/evaluation/types.d.ts +1 -0
  33. package/dist/evaluation/types.js +1 -1
  34. package/dist/evaluation/user-injection.js +1 -27
  35. package/dist/experience/experience-reuse.js +1 -103
  36. package/dist/experience/index.js +1 -5
  37. package/dist/experience/intent-distill.js +1 -83
  38. package/dist/experience/realtime-feedback.js +1 -94
  39. package/dist/experience/types.js +1 -1
  40. package/dist/experience/user-profile.js +1 -171
  41. package/dist/extensions/business-modules.js +1 -287
  42. package/dist/extensions/capability-manifest.js +1 -781
  43. package/dist/extensions/constraint-registry.js +1 -198
  44. package/dist/extensions/index.js +1 -6
  45. package/dist/extensions/metric-registry.js +1 -257
  46. package/dist/extensions/mode-evaluator.js +1 -170
  47. package/dist/extensions/modes.js +1 -499
  48. package/dist/extensions/registry.js +1 -717
  49. package/dist/extensions/types.js +1 -1
  50. package/dist/harness/auto-escalation.js +1 -68
  51. package/dist/harness/checkpoint.js +1 -129
  52. package/dist/harness/index.js +1 -78
  53. package/dist/harness/plan.js +1 -315
  54. package/dist/harness/recover.js +1 -139
  55. package/dist/harness/types.js +1 -1
  56. package/dist/harness/verify.js +1 -237
  57. package/dist/index.js +1 -273
  58. package/dist/intent/enrich.js +1 -67
  59. package/dist/intent/index.js +1 -60
  60. package/dist/intent/matcher.js +1 -81
  61. package/dist/intent/store.js +1 -55
  62. package/dist/intent/types.js +1 -10
  63. package/dist/knowledge/acquisition-flywheel.js +1 -192
  64. package/dist/knowledge/allocation-confirm.js +1 -534
  65. package/dist/knowledge/allocation-context.js +1 -249
  66. package/dist/knowledge/allocation-ledger.js +1 -463
  67. package/dist/knowledge/allocation-puzzle.js +1 -298
  68. package/dist/knowledge/allocation-risk.js +1 -568
  69. package/dist/knowledge/allocation-templates.js +1 -970
  70. package/dist/knowledge/allocation-translation.js +1 -585
  71. package/dist/knowledge/arb-risk.js +1 -210
  72. package/dist/knowledge/arbitration-confirm.js +1 -559
  73. package/dist/knowledge/arbitration-context.js +1 -505
  74. package/dist/knowledge/arbitration-ledger.js +1 -521
  75. package/dist/knowledge/arbitration-puzzle.js +1 -304
  76. package/dist/knowledge/arbitration-risk.js +1 -423
  77. package/dist/knowledge/arbitration-templates.js +1 -276
  78. package/dist/knowledge/arbitration-translation.js +1 -487
  79. package/dist/knowledge/arbitration-trust.js +1 -117
  80. package/dist/knowledge/audit-rules.js +1 -141
  81. package/dist/knowledge/bridge-risk.js +1 -263
  82. package/dist/knowledge/contact-risk.js +1 -200
  83. package/dist/knowledge/contact-templates.js +1 -60
  84. package/dist/knowledge/demand-confirm.js +1 -206
  85. package/dist/knowledge/demand-matching.js +1 -132
  86. package/dist/knowledge/demand-risk.js +1 -240
  87. package/dist/knowledge/demand-translation.js +1 -354
  88. package/dist/knowledge/deployment-scanner.js +1 -823
  89. package/dist/knowledge/dynamic-pricing.js +1 -87
  90. package/dist/knowledge/examples-scanner-cli.js +1 -26
  91. package/dist/knowledge/examples-scanner.js +1 -843
  92. package/dist/knowledge/flywheel-loop.js +1 -404
  93. package/dist/knowledge/fund-layer.js +1 -973
  94. package/dist/knowledge/glossary.js +1 -211
  95. package/dist/knowledge/guard-confirm.js +1 -406
  96. package/dist/knowledge/guard-context.js +1 -287
  97. package/dist/knowledge/guard-design-patterns.js +1 -360
  98. package/dist/knowledge/guard-ledger.js +1 -260
  99. package/dist/knowledge/guard-lint.js +1 -670
  100. package/dist/knowledge/guard-migration.js +1 -228
  101. package/dist/knowledge/guard-puzzle.js +1 -805
  102. package/dist/knowledge/guard-render.js +1 -700
  103. package/dist/knowledge/guard-risk.js +1 -1879
  104. package/dist/knowledge/guard-submission-prompt.js +1 -171
  105. package/dist/knowledge/guard-templates.js +1 -1105
  106. package/dist/knowledge/guard-translation.js +1 -1119
  107. package/dist/knowledge/index.js +1 -436
  108. package/dist/knowledge/industry-evolution.js +1 -323
  109. package/dist/knowledge/industry-generalizer.js +1 -381
  110. package/dist/knowledge/industry-registry.js +1 -174
  111. package/dist/knowledge/intent-metrics.d.ts +4 -3
  112. package/dist/knowledge/intent-metrics.js +1 -566
  113. package/dist/knowledge/machine-confirm.js +1 -559
  114. package/dist/knowledge/machine-context.js +1 -833
  115. package/dist/knowledge/machine-ledger.js +1 -338
  116. package/dist/knowledge/machine-puzzle.js +1 -494
  117. package/dist/knowledge/machine-render.js +1 -565
  118. package/dist/knowledge/machine-risk.js +1 -669
  119. package/dist/knowledge/machine-templates.js +1 -1597
  120. package/dist/knowledge/machine-topology.js +1 -234
  121. package/dist/knowledge/machine-translation.js +1 -513
  122. package/dist/knowledge/mcp-schema-audit-cli.js +1 -45
  123. package/dist/knowledge/mcp-schema-audit.js +1 -777
  124. package/dist/knowledge/onchain-constants.js +1 -35
  125. package/dist/knowledge/order-confirm.js +1 -573
  126. package/dist/knowledge/order-context.js +1 -390
  127. package/dist/knowledge/order-ledger.js +1 -341
  128. package/dist/knowledge/order-puzzle.js +1 -255
  129. package/dist/knowledge/order-risk.js +1 -653
  130. package/dist/knowledge/order-templates.js +1 -368
  131. package/dist/knowledge/order-translation.js +1 -550
  132. package/dist/knowledge/overrides-loader.js +1 -65
  133. package/dist/knowledge/passport-confirm.js +1 -531
  134. package/dist/knowledge/passport-context.js +1 -306
  135. package/dist/knowledge/passport-ledger.js +1 -282
  136. package/dist/knowledge/passport-puzzle.js +1 -333
  137. package/dist/knowledge/passport-risk.js +1 -450
  138. package/dist/knowledge/passport-templates.js +1 -568
  139. package/dist/knowledge/passport-translation.js +1 -516
  140. package/dist/knowledge/payment-risk.js +1 -249
  141. package/dist/knowledge/permission-confirm.js +1 -426
  142. package/dist/knowledge/permission-context.js +1 -224
  143. package/dist/knowledge/permission-ledger.js +1 -403
  144. package/dist/knowledge/permission-puzzle.js +1 -173
  145. package/dist/knowledge/permission-risk.js +1 -411
  146. package/dist/knowledge/permission-templates.js +1 -234
  147. package/dist/knowledge/permission-translation.js +1 -350
  148. package/dist/knowledge/personal-risk.js +1 -212
  149. package/dist/knowledge/process-model.js +1 -160
  150. package/dist/knowledge/progress-confirm.js +1 -456
  151. package/dist/knowledge/progress-context.js +1 -452
  152. package/dist/knowledge/progress-ledger.js +1 -330
  153. package/dist/knowledge/progress-puzzle.js +1 -219
  154. package/dist/knowledge/progress-risk.js +1 -461
  155. package/dist/knowledge/progress-templates.js +1 -228
  156. package/dist/knowledge/progress-translation.js +1 -405
  157. package/dist/knowledge/proof-confirm.js +1 -187
  158. package/dist/knowledge/proof-risk.js +1 -207
  159. package/dist/knowledge/proof-translation.js +1 -283
  160. package/dist/knowledge/registrar-risk.js +1 -217
  161. package/dist/knowledge/repository-confirm.js +1 -286
  162. package/dist/knowledge/repository-risk.js +1 -373
  163. package/dist/knowledge/repository-translation.js +1 -445
  164. package/dist/knowledge/reputation-rules.js +1 -99
  165. package/dist/knowledge/resource-risk.js +1 -157
  166. package/dist/knowledge/reward-confirm.js +1 -526
  167. package/dist/knowledge/reward-context.js +1 -504
  168. package/dist/knowledge/reward-ledger.js +1 -502
  169. package/dist/knowledge/reward-puzzle.js +1 -300
  170. package/dist/knowledge/reward-risk.js +1 -627
  171. package/dist/knowledge/reward-templates.js +1 -197
  172. package/dist/knowledge/reward-translation.js +1 -501
  173. package/dist/knowledge/safety-rules.js +1 -404
  174. package/dist/knowledge/scenario-modes.js +1 -321
  175. package/dist/knowledge/service-confirm.js +1 -807
  176. package/dist/knowledge/service-context.js +1 -403
  177. package/dist/knowledge/service-ledger.js +1 -609
  178. package/dist/knowledge/service-puzzle.js +1 -236
  179. package/dist/knowledge/service-risk.js +1 -651
  180. package/dist/knowledge/service-templates.js +1 -456
  181. package/dist/knowledge/service-translation.js +1 -622
  182. package/dist/knowledge/template-registry.js +1 -353
  183. package/dist/knowledge/tool-constraints.js +1 -195
  184. package/dist/knowledge/tools-reference.js +1 -178
  185. package/dist/knowledge/treasury-confirm.js +1 -512
  186. package/dist/knowledge/treasury-context.js +1 -363
  187. package/dist/knowledge/treasury-ledger.js +1 -300
  188. package/dist/knowledge/treasury-puzzle.js +1 -216
  189. package/dist/knowledge/treasury-risk.js +1 -440
  190. package/dist/knowledge/treasury-templates.js +1 -358
  191. package/dist/knowledge/treasury-translation.js +1 -498
  192. package/dist/knowledge/trust-metrics.js +1 -198
  193. package/dist/knowledge/util-risk.js +1 -135
  194. package/dist/loop-engineering/aggregate.js +1 -132
  195. package/dist/loop-engineering/context-collect.js +1 -83
  196. package/dist/loop-engineering/diagnose.js +1 -273
  197. package/dist/loop-engineering/improve.js +1 -405
  198. package/dist/loop-engineering/index.js +1 -4
  199. package/dist/loop-engineering/pipeline.js +1 -56
  200. package/dist/mode-market/index.js +1 -3
  201. package/dist/mode-market/registry.js +1 -124
  202. package/dist/mode-market/review.js +1 -214
  203. package/dist/mode-market/submission.js +1 -85
  204. package/dist/participation/collaborator-interest.d.ts +23 -0
  205. package/dist/participation/collaborator-interest.js +1 -0
  206. package/dist/participation/customer-interest.d.ts +25 -0
  207. package/dist/participation/customer-interest.js +1 -0
  208. package/dist/participation/merchant-interest.js +1 -100
  209. package/dist/participation/radar-core.d.ts +13 -3
  210. package/dist/participation/radar-core.js +1 -269
  211. package/dist/participation/supplier-interest.d.ts +25 -0
  212. package/dist/participation/supplier-interest.js +1 -0
  213. package/dist/persona/analyzer.js +1 -66
  214. package/dist/persona/bridge.js +1 -86
  215. package/dist/persona/defaults.js +1 -195
  216. package/dist/persona/experience-bridge.js +1 -23
  217. package/dist/persona/index.js +1 -71
  218. package/dist/persona/model.js +1 -111
  219. package/dist/persona/store.js +1 -62
  220. package/dist/persona/types.d.ts +3 -1
  221. package/dist/persona/types.js +1 -5
  222. package/dist/project/business-puzzle.js +1 -383
  223. package/dist/project/context-assembly.js +1 -254
  224. package/dist/project/deployment-bridge.js +1 -120
  225. package/dist/project/deployment-doc.js +1 -1126
  226. package/dist/project/edit-planner.js +1 -1342
  227. package/dist/project/evaluation.js +1 -2011
  228. package/dist/project/game-theory.js +1 -177
  229. package/dist/project/graph-builder.js +1 -656
  230. package/dist/project/graph.js +1 -340
  231. package/dist/project/handlers.js +1 -1784
  232. package/dist/project/index.d.ts +1 -0
  233. package/dist/project/index.js +1 -301
  234. package/dist/project/intent-analyzer.js +1 -149
  235. package/dist/project/machine-nodes.js +1 -36
  236. package/dist/project/merchant-guide.js +1 -264
  237. package/dist/project/migration.js +1 -125
  238. package/dist/project/mode-actions.js +1 -309
  239. package/dist/project/namespace.js +1 -206
  240. package/dist/project/participation-radar.js +1 -428
  241. package/dist/project/pipeline-actions.js +1 -109
  242. package/dist/project/project-store.js +1 -422
  243. package/dist/project/query.js +1 -153
  244. package/dist/project/reverse-mapping.d.ts +34 -0
  245. package/dist/project/reverse-mapping.js +1 -0
  246. package/dist/project/risk-aggregator.js +1 -295
  247. package/dist/project/rollback-policy.js +1 -290
  248. package/dist/project/semantic-assembler.js +1 -345
  249. package/dist/project/semantic-graph.js +1 -292
  250. package/dist/project/stage-gate.js +1 -369
  251. package/dist/project/substep-trace.js +1 -332
  252. package/dist/project/task-tracker.js +1 -78
  253. package/dist/role/derivation.d.ts +18 -0
  254. package/dist/role/derivation.js +1 -0
  255. package/dist/role/index.d.ts +5 -0
  256. package/dist/role/index.js +1 -0
  257. package/dist/role/model.d.ts +8 -0
  258. package/dist/role/model.js +1 -0
  259. package/dist/role/resolution.d.ts +11 -0
  260. package/dist/role/resolution.js +1 -0
  261. package/dist/role/types.d.ts +11 -0
  262. package/dist/role/types.js +1 -0
  263. package/dist/rules.js +1 -52
  264. package/dist/safety/confirm-gate.js +1 -88
  265. package/dist/safety/index.js +1 -3
  266. package/dist/safety/preview.js +1 -52
  267. package/dist/schema/call/allocation.js +1 -34
  268. package/dist/schema/call/arbitration.js +1 -113
  269. package/dist/schema/call/base.d.ts +15 -15
  270. package/dist/schema/call/base.js +1 -370
  271. package/dist/schema/call/bridge-handler.js +1 -265
  272. package/dist/schema/call/bridge.d.ts +7 -7
  273. package/dist/schema/call/bridge.js +1 -458
  274. package/dist/schema/call/contact.js +1 -37
  275. package/dist/schema/call/demand.js +1 -47
  276. package/dist/schema/call/guard.js +1 -161
  277. package/dist/schema/call/handler.js +1 -322
  278. package/dist/schema/call/index.js +1 -20
  279. package/dist/schema/call/machine.js +1 -193
  280. package/dist/schema/call/order.js +1 -35
  281. package/dist/schema/call/payment.js +1 -37
  282. package/dist/schema/call/permission-handler.js +1 -54
  283. package/dist/schema/call/permission.js +1 -105
  284. package/dist/schema/call/personal.js +1 -78
  285. package/dist/schema/call/progress.js +1 -47
  286. package/dist/schema/call/proof.js +1 -33
  287. package/dist/schema/call/repository.js +1 -77
  288. package/dist/schema/call/reward.js +1 -30
  289. package/dist/schema/call/semantic.js +1 -1679
  290. package/dist/schema/call/service.js +1 -184
  291. package/dist/schema/call/treasury.js +1 -71
  292. package/dist/schema/common/index.js +1 -407
  293. package/dist/schema/config/index.js +1 -68
  294. package/dist/schema/evaluation/index.d.ts +213 -16
  295. package/dist/schema/evaluation/index.js +1 -356
  296. package/dist/schema/index.js +1 -17
  297. package/dist/schema/intent-radar/index.d.ts +13 -13
  298. package/dist/schema/intent-radar/index.js +1 -89
  299. package/dist/schema/local/index.d.ts +21 -21
  300. package/dist/schema/local/index.js +1 -927
  301. package/dist/schema/local/wip.js +1 -187
  302. package/dist/schema/messenger/index.d.ts +7 -7
  303. package/dist/schema/messenger/index.js +1 -475
  304. package/dist/schema/operations.d.ts +7 -7
  305. package/dist/schema/operations.js +1 -520
  306. package/dist/schema/persona/index.d.ts +54 -54
  307. package/dist/schema/persona/index.js +1 -148
  308. package/dist/schema/project/index.d.ts +94 -48
  309. package/dist/schema/project/index.js +1 -2057
  310. package/dist/schema/query/index.d.ts +423 -7
  311. package/dist/schema/query/index.js +1 -1646
  312. package/dist/schema/schema-query/index.js +1 -104
  313. package/dist/schema/schema-version.js +1 -76
  314. package/dist/schema/sync-layer4.js +1 -286
  315. package/dist/schema/task-status.js +1 -36
  316. package/dist/schema/trust/index.js +1 -314
  317. package/dist/schema/utils/guard-parser.js +1 -419
  318. package/dist/schema/utils/guard-query-utils.js +1 -46
  319. package/dist/schema/utils/node-parser.js +1 -369
  320. package/dist/schema/utils/object-type-utils.js +1 -35
  321. package/dist/schema/utils/permission-index-utils.js +1 -7
  322. package/dist/schema/utils/permission-machine-check.js +1 -121
  323. package/dist/schema/utils/skills-recommendation.js +1 -77
  324. package/dist/schema-query/index.js +1 -810
  325. package/dist/schemas/account_operation.output.json +5 -2
  326. package/dist/schemas/bridge_operation.output.json +5 -2
  327. package/dist/schemas/evaluation_operation.output.json +112 -7
  328. package/dist/schemas/evaluation_operation.schema.json +93 -6
  329. package/dist/schemas/index.json +1 -1
  330. package/dist/schemas/intent_radar.output.json +4 -1
  331. package/dist/schemas/intent_radar.schema.json +4 -1
  332. package/dist/schemas/local_info_operation.output.json +5 -2
  333. package/dist/schemas/local_mark_operation.output.json +5 -2
  334. package/dist/schemas/messenger_operation.output.json +5 -2
  335. package/dist/schemas/onchain_events.output.json +5 -2
  336. package/dist/schemas/onchain_operations.output.json +5 -2
  337. package/dist/schemas/onchain_operations.schema.json +4 -4
  338. package/dist/schemas/onchain_operations_allocation.schema.json +1 -1
  339. package/dist/schemas/onchain_operations_machine.schema.json +2 -2
  340. package/dist/schemas/onchain_operations_service.schema.json +1 -1
  341. package/dist/schemas/onchain_table_data.output.json +6 -3
  342. package/dist/schemas/persona_operation.output.json +4 -1
  343. package/dist/schemas/persona_operation.schema.json +4 -1
  344. package/dist/schemas/project_operation.output.json +28 -8
  345. package/dist/schemas/query_toolkit.output.json +8 -5
  346. package/dist/schemas/wowok_buildin_info.output.json +132 -0
  347. package/dist/schemas/wowok_buildin_info.schema.json +14 -0
  348. package/dist/telemetry/index.js +1 -112
  349. package/dist/telemetry/redact.js +1 -23
  350. package/dist/telemetry/storage.js +1 -80
  351. package/dist/tools/handlers/bridge.js +1 -1
  352. package/dist/tools/handlers/config.js +1 -74
  353. package/dist/tools/handlers/evaluation.js +1 -123
  354. package/dist/tools/handlers/file-export.js +1 -90
  355. package/dist/tools/handlers/intent-radar.js +1 -76
  356. package/dist/tools/handlers/local.js +1 -53
  357. package/dist/tools/handlers/messenger.js +1 -188
  358. package/dist/tools/handlers/onchain.js +1 -1180
  359. package/dist/tools/handlers/persona.js +1 -89
  360. package/dist/tools/handlers/project.js +1 -211
  361. package/dist/tools/handlers/query.js +1 -434
  362. package/dist/tools/handlers/schema-query.js +1 -176
  363. package/dist/tools/handlers/task-status.js +1 -26
  364. package/dist/tools/handlers/trust.js +1 -380
  365. package/dist/tools/handlers/wip.js +1 -90
  366. package/dist/tools/index.js +1 -1382
  367. package/dist/tools/retry.js +1 -85
  368. package/dist/tools/rules-hook.js +1 -23
  369. package/dist/tools/shared.js +1 -130
  370. package/dist/tools/types.js +1 -1
  371. package/dist/tools/upgrade-check.d.ts +19 -0
  372. package/dist/tools/upgrade-check.js +1 -0
  373. package/dist/tools/wip-deploy-assist.js +1 -306
  374. package/dist/tools/wrap.js +1 -500
  375. package/package.json +4 -2
@@ -1,210 +1 @@
1
- import { MAX_VOTOR_COUNT, WITHDRAW_DURATION_TIME, } from "@wowok/wowok";
2
- const R_A_01 = {
3
- rule: {
4
- id: "R-ARB-01",
5
- level: "HIGH",
6
- category: "lifecycle",
7
- title: "7-state machine — invalid transitions can deadlock the arbitration",
8
- description: "Arb has a 7-state machine: Principal_confirming(0) → Arbitrator_confirming(1) → " +
9
- "Voting(2) → Arbitrated(3) → Objectionable(4) → Finished(5) → Withdrawn(6). reset() " +
10
- "can revert from {1, 4} back to 0. Each op asserts the current status; calling an op " +
11
- "out of order aborts with E_STATUS_NOT_MATCH (3). Repeated mis-calls leave the Arb " +
12
- "stuck in a non-terminal state with no automatic recovery.",
13
- affected_stakeholders: ["principal", "arbitrator", "voter"],
14
- scenario: "Caller calls vote() when status is still Arbitrator_confirming; abort blocks progress",
15
- mitigation: "Strictly validate the current status before submitting any Arb op. The SDK should " +
16
- "expose a status-aware state machine helper. Provide a recovery path (reset) for " +
17
- "Arbitrator_confirming and Objectionable states.",
18
- related_move_error: "E_STATUS_NOT_MATCH (3)",
19
- auto_fixable: false,
20
- },
21
- check: (ctx) => {
22
- if (!ctx.invalid_transition)
23
- return null;
24
- return { ...R_A_01.rule, evidence: `invalid_transition=true (status=${ctx.status ?? "?"})` };
25
- },
26
- };
27
- const R_A_02 = {
28
- rule: {
29
- id: "R-ARB-02",
30
- level: "MEDIUM",
31
- category: "lifecycle",
32
- title: `WITHDRAW_DURATION_TIME=${WITHDRAW_DURATION_TIME}ms (30 days) — funds locked`,
33
- description: `After arbitration, the fee Balance can only be withdrawn after ` +
34
- `WITHDRAW_DURATION_TIME=${WITHDRAW_DURATION_TIME}ms (30 days) when status is ` +
35
- `Arbitrated(3) or Objectionable(4). From Finished(5), withdraw is immediate. ` +
36
- `The 30-day lock is a dispute-window safeguard, but it locks funds for a long time ` +
37
- `and users may not understand why.`,
38
- affected_stakeholders: ["principal", "arbitrator"],
39
- scenario: "Arbitrator finishes a case but must wait 30 days to claim the fee",
40
- mitigation: "Surface the unlock timestamp in the UI. To shorten the lock, drive the case to " +
41
- "Finished(5) via finish() rather than leaving it in Arbitrated/Objectionable.",
42
- related_move_error: "E_WITHDRAW_DURATION_TIME_NOT_PASSED (8)",
43
- auto_fixable: false,
44
- },
45
- check: (ctx) => {
46
- if (!ctx.withdraw_too_early)
47
- return null;
48
- return { ...R_A_02.rule, evidence: `withdraw_too_early=true (limit=${WITHDRAW_DURATION_TIME}ms)` };
49
- },
50
- };
51
- const R_A_03 = {
52
- rule: {
53
- id: "R-ARB-03",
54
- level: "MEDIUM",
55
- category: "structural",
56
- title: `MAX_VOTOR_COUNT=${MAX_VOTOR_COUNT} permissive — voting efficiency cost`,
57
- description: `A single Arb may record up to MAX_VOTOR_COUNT=${MAX_VOTOR_COUNT} voters (arb.move:236). ` +
58
- `The limit aborts with E_MAX_VOTOR_COUNT (6) only at the boundary. 520 voters in one ` +
59
- `Arb inflates the voted vector, slowing tally and gas, and complicates weighted-quorum ` +
60
- `reasoning.`,
61
- affected_stakeholders: ["voter", "arbitrator"],
62
- scenario: "Arbitration allows 520 voters; tallying the vote vector is slow and gas-heavy",
63
- mitigation: "Business layer should self-limit voter count based on the Arbitration rule's quorum. " +
64
- "For large juries, shard across multiple Arb instances or aggregate off-chain.",
65
- related_move_error: "E_MAX_VOTOR_COUNT (6)",
66
- auto_fixable: false,
67
- },
68
- check: (ctx) => {
69
- if (ctx.votor_count === undefined)
70
- return null;
71
- if (ctx.votor_count < MAX_VOTOR_COUNT)
72
- return null;
73
- return { ...R_A_03.rule, evidence: `votor_count=${ctx.votor_count}, limit=${MAX_VOTOR_COUNT}` };
74
- },
75
- };
76
- const R_A_04 = {
77
- rule: {
78
- id: "R-ARB-04",
79
- level: "LOW",
80
- category: "semantic",
81
- title: "proposition_change may not emit a discrete event — indexers must infer",
82
- description: "proposition_change (arb.move) updates the proposition vector in place. Unlike " +
83
- "state transitions (which emit ArbEvent), proposition edits may not produce a " +
84
- "discrete event — indexers must infer changes by diffing the proposition vector " +
85
- "across polls.",
86
- affected_stakeholders: ["arbitrator", "voter"],
87
- scenario: "Indexer expects a PropositionChangedEvent; none is emitted, UI fails to refresh",
88
- mitigation: "External indexers should poll the proposition vector. UI should display 'propositions " +
89
- "may have changed' on each poll rather than relying on event-driven refresh.",
90
- auto_fixable: false,
91
- },
92
- check: (ctx) => {
93
- if (!ctx.expects_proposition_event)
94
- return null;
95
- return { ...R_A_04.rule, evidence: "expects_proposition_event=true (poll instead)" };
96
- },
97
- };
98
- const R_A_05 = {
99
- rule: {
100
- id: "R-ARB-05",
101
- level: "MEDIUM",
102
- category: "semantic",
103
- title: "voting_deadline is Option<u64> — None means open-ended vote",
104
- description: "voting_deadline is Option<u64>. When None, voting has no deadline (open-ended) and " +
105
- "E_VOTING_DEADLINE_PASSED (7) never triggers. When Some(t), vote() aborts if " +
106
- "clock.timestamp_ms() > t. Callers who assume a default deadline may be surprised by " +
107
- "an open-ended vote that never finalizes.",
108
- affected_stakeholders: ["voter", "arbitrator"],
109
- scenario: "Voter assumes a deadline; voting_deadline is None and the case stalls indefinitely",
110
- mitigation: "Document that None means open-ended. Arbitrators should set an explicit deadline via " +
111
- "arbitrator_confirm unless they intend an open vote. SDK should surface voting_deadline " +
112
- "prominently.",
113
- related_move_error: "E_VOTING_DEADLINE_PASSED (7) / E_VOTING_DEADLINE_NOT_PASSED (4)",
114
- auto_fixable: false,
115
- },
116
- check: (ctx) => {
117
- if (!ctx.voting_deadline_none)
118
- return null;
119
- return { ...R_A_05.rule, evidence: "voting_deadline_none=true (open-ended vote)" };
120
- },
121
- };
122
- const R_A_06 = {
123
- rule: {
124
- id: "R-ARB-06",
125
- level: "LOW",
126
- category: "semantic",
127
- title: "indemnity is Option<Indemnity> — None means no compensation",
128
- description: "indemnity is Option<Indemnity>. When None, the arbitration produces no compensation " +
129
- "(e.g. a pure declaratory ruling). Consumers who assume a non-null indemnity will " +
130
- "mis-handle None cases. finish() returns the indemnity amount (0 when None).",
131
- affected_stakeholders: ["principal"],
132
- scenario: "Principal expects compensation; indemnity is None and finish() returns 0",
133
- mitigation: "Document that None means no compensation. UI should show 'no compensation awarded' " +
134
- "rather than 'compensation pending'.",
135
- auto_fixable: false,
136
- },
137
- check: (ctx) => {
138
- if (!ctx.indemnity_none)
139
- return null;
140
- return { ...R_A_06.rule, evidence: "indemnity_none=true (no compensation)" };
141
- },
142
- };
143
- const R_A_07 = {
144
- rule: {
145
- id: "R-ARB-07",
146
- level: "MEDIUM",
147
- category: "permission",
148
- title: "Voted.weight is set by the Arbitration rule — concentrated weight risk",
149
- description: "Voted.weight (u32) is assigned by the Arbitration object's voting_guard logic, not " +
150
- "by the voter. If the Arbitration rule concentrates weight in one voter (e.g. an " +
151
- "admin with weight 1000 vs. others with weight 1), a single voter can dictate the " +
152
- "outcome. The Arb contract itself does not detect concentration — that is the " +
153
- "Arbitration designer's responsibility.",
154
- affected_stakeholders: ["voter", "arbitrator"],
155
- scenario: "Arbitration rule gives one voter weight 1000; that voter single-handedly decides the case",
156
- mitigation: "When designing the Arbitration rule, cap individual voter weight and require a " +
157
- "quorum. Audit the voting_guard to ensure no single voter can exceed the quorum alone.",
158
- auto_fixable: false,
159
- },
160
- check: (ctx) => {
161
- if (!ctx.weight_concentrated)
162
- return null;
163
- return { ...R_A_07.rule, evidence: "weight_concentrated=true (rule-level risk)" };
164
- },
165
- };
166
- const R_A_08 = {
167
- rule: {
168
- id: "R-ARB-08",
169
- level: "LOW",
170
- category: "semantic",
171
- title: "Status uses u8 constants — Move enum is commented out",
172
- description: "The 7 statuses are defined as u8 constants (Status_Principal_confirming=0, etc.). " +
173
- "The Move enum definition is commented out (arb.move). Consumers cannot rely on a " +
174
- "type-safe enum and must compare against magic numbers. A future Wow release enabling " +
175
- "the enum would be a breaking change to downstream code.",
176
- affected_stakeholders: ["system"],
177
- scenario: "Developer expects a Status enum; only u8 constants are available, causing type errors",
178
- mitigation: "SDK should expose a TypeScript enum mirroring the u8 constants. Document that the " +
179
- "Move enum is intentionally disabled and may be enabled in a future version.",
180
- auto_fixable: false,
181
- },
182
- check: (ctx) => {
183
- if (!ctx.expects_status_enum)
184
- return null;
185
- return { ...R_A_08.rule, evidence: "expects_status_enum=true (only u8 constants exist)" };
186
- },
187
- };
188
- export const ARB_RISK_RULES = [
189
- R_A_01,
190
- R_A_02,
191
- R_A_03,
192
- R_A_04,
193
- R_A_05,
194
- R_A_06,
195
- R_A_07,
196
- R_A_08,
197
- ];
198
- export const ARB_RISK_VERSION = "1.0.0";
199
- export function checkArbRisks(ctx) {
200
- const risks = [];
201
- for (const rule of ARB_RISK_RULES) {
202
- const r = rule.check(ctx);
203
- if (r)
204
- risks.push(r);
205
- }
206
- return risks;
207
- }
208
- export function getArbRiskById(id) {
209
- return ARB_RISK_RULES.find(r => r.rule.id === id)?.rule;
210
- }
1
+ import{MAX_VOTOR_COUNT,WITHDRAW_DURATION_TIME}from'@wowok/wowok';const R_A_01={'rule':{'id':'R-ARB-01','level':'HIGH','category':'lifecycle','title':'7-state\x20machine\x20—\x20invalid\x20transitions\x20can\x20deadlock\x20the\x20arbitration','description':'Arb\x20has\x20a\x207-state\x20machine:\x20Principal_confirming(0)\x20→\x20Arbitrator_confirming(1)\x20→\x20'+'Voting(2)\x20→\x20Arbitrated(3)\x20→\x20Objectionable(4)\x20→\x20Finished(5)\x20→\x20Withdrawn(6).\x20reset()\x20'+'can\x20revert\x20from\x20{1,\x204}\x20back\x20to\x200.\x20Each\x20op\x20asserts\x20the\x20current\x20status;\x20calling\x20an\x20op\x20'+'out\x20of\x20order\x20aborts\x20with\x20E_STATUS_NOT_MATCH\x20(3).\x20Repeated\x20mis-calls\x20leave\x20the\x20Arb\x20'+'stuck\x20in\x20a\x20non-terminal\x20state\x20with\x20no\x20automatic\x20recovery.','affected_stakeholders':['principal','arbitrator','voter'],'scenario':'Caller\x20calls\x20vote()\x20when\x20status\x20is\x20still\x20Arbitrator_confirming;\x20abort\x20blocks\x20progress','mitigation':'Strictly\x20validate\x20the\x20current\x20status\x20before\x20submitting\x20any\x20Arb\x20op.\x20The\x20SDK\x20should\x20'+'expose\x20a\x20status-aware\x20state\x20machine\x20helper.\x20Provide\x20a\x20recovery\x20path\x20(reset)\x20for\x20'+'Arbitrator_confirming\x20and\x20Objectionable\x20states.','related_move_error':'E_STATUS_NOT_MATCH\x20(3)','auto_fixable':![]},'check':a=>{if(!a['invalid_transition'])return null;return{...R_A_01['rule'],'evidence':'invalid_transition=true\x20(status='+(a['status']??'?')+')'};}},R_A_02={'rule':{'id':'R-ARB-02','level':'MEDIUM','category':'lifecycle','title':'WITHDRAW_DURATION_TIME='+WITHDRAW_DURATION_TIME+'ms\x20(30\x20days)\x20—\x20funds\x20locked','description':'After\x20arbitration,\x20the\x20fee\x20Balance\x20can\x20only\x20be\x20withdrawn\x20after\x20'+('WITHDRAW_DURATION_TIME='+WITHDRAW_DURATION_TIME+'ms\x20(30\x20days)\x20when\x20status\x20is\x20')+'Arbitrated(3)\x20or\x20Objectionable(4).\x20From\x20Finished(5),\x20withdraw\x20is\x20immediate.\x20'+'The\x2030-day\x20lock\x20is\x20a\x20dispute-window\x20safeguard,\x20but\x20it\x20locks\x20funds\x20for\x20a\x20long\x20time\x20'+'and\x20users\x20may\x20not\x20understand\x20why.','affected_stakeholders':['principal','arbitrator'],'scenario':'Arbitrator\x20finishes\x20a\x20case\x20but\x20must\x20wait\x2030\x20days\x20to\x20claim\x20the\x20fee','mitigation':'Surface\x20the\x20unlock\x20timestamp\x20in\x20the\x20UI.\x20To\x20shorten\x20the\x20lock,\x20drive\x20the\x20case\x20to\x20'+'Finished(5)\x20via\x20finish()\x20rather\x20than\x20leaving\x20it\x20in\x20Arbitrated/Objectionable.','related_move_error':'E_WITHDRAW_DURATION_TIME_NOT_PASSED\x20(8)','auto_fixable':![]},'check':a=>{if(!a['withdraw_too_early'])return null;return{...R_A_02['rule'],'evidence':'withdraw_too_early=true\x20(limit='+WITHDRAW_DURATION_TIME+'ms)'};}},R_A_03={'rule':{'id':'R-ARB-03','level':'MEDIUM','category':'structural','title':'MAX_VOTOR_COUNT='+MAX_VOTOR_COUNT+'\x20permissive\x20—\x20voting\x20efficiency\x20cost','description':'A\x20single\x20Arb\x20may\x20record\x20up\x20to\x20MAX_VOTOR_COUNT='+MAX_VOTOR_COUNT+'\x20voters\x20(arb.move:236).\x20'+'The\x20limit\x20aborts\x20with\x20E_MAX_VOTOR_COUNT\x20(6)\x20only\x20at\x20the\x20boundary.\x20520\x20voters\x20in\x20one\x20'+'Arb\x20inflates\x20the\x20voted\x20vector,\x20slowing\x20tally\x20and\x20gas,\x20and\x20complicates\x20weighted-quorum\x20'+'reasoning.','affected_stakeholders':['voter','arbitrator'],'scenario':'Arbitration\x20allows\x20520\x20voters;\x20tallying\x20the\x20vote\x20vector\x20is\x20slow\x20and\x20gas-heavy','mitigation':'Business\x20layer\x20should\x20self-limit\x20voter\x20count\x20based\x20on\x20the\x20Arbitration\x20rule\x27s\x20quorum.\x20'+'For\x20large\x20juries,\x20shard\x20across\x20multiple\x20Arb\x20instances\x20or\x20aggregate\x20off-chain.','related_move_error':'E_MAX_VOTOR_COUNT\x20(6)','auto_fixable':![]},'check':a=>{if(a['votor_count']===undefined)return null;if(a['votor_count']<MAX_VOTOR_COUNT)return null;return{...R_A_03['rule'],'evidence':'votor_count='+a['votor_count']+',\x20limit='+MAX_VOTOR_COUNT};}},R_A_04={'rule':{'id':'R-ARB-04','level':'LOW','category':'semantic','title':'proposition_change\x20may\x20not\x20emit\x20a\x20discrete\x20event\x20—\x20indexers\x20must\x20infer','description':'proposition_change\x20(arb.move)\x20updates\x20the\x20proposition\x20vector\x20in\x20place.\x20Unlike\x20'+'state\x20transitions\x20(which\x20emit\x20ArbEvent),\x20proposition\x20edits\x20may\x20not\x20produce\x20a\x20'+'discrete\x20event\x20—\x20indexers\x20must\x20infer\x20changes\x20by\x20diffing\x20the\x20proposition\x20vector\x20'+'across\x20polls.','affected_stakeholders':['arbitrator','voter'],'scenario':'Indexer\x20expects\x20a\x20PropositionChangedEvent;\x20none\x20is\x20emitted,\x20UI\x20fails\x20to\x20refresh','mitigation':'External\x20indexers\x20should\x20poll\x20the\x20proposition\x20vector.\x20UI\x20should\x20display\x20\x27propositions\x20'+'may\x20have\x20changed\x27\x20on\x20each\x20poll\x20rather\x20than\x20relying\x20on\x20event-driven\x20refresh.','auto_fixable':![]},'check':a=>{if(!a['expects_proposition_event'])return null;return{...R_A_04['rule'],'evidence':'expects_proposition_event=true\x20(poll\x20instead)'};}},R_A_05={'rule':{'id':'R-ARB-05','level':'MEDIUM','category':'semantic','title':'voting_deadline\x20is\x20Option<u64>\x20—\x20None\x20means\x20open-ended\x20vote','description':'voting_deadline\x20is\x20Option<u64>.\x20When\x20None,\x20voting\x20has\x20no\x20deadline\x20(open-ended)\x20and\x20'+'E_VOTING_DEADLINE_PASSED\x20(7)\x20never\x20triggers.\x20When\x20Some(t),\x20vote()\x20aborts\x20if\x20'+'clock.timestamp_ms()\x20>\x20t.\x20Callers\x20who\x20assume\x20a\x20default\x20deadline\x20may\x20be\x20surprised\x20by\x20'+'an\x20open-ended\x20vote\x20that\x20never\x20finalizes.','affected_stakeholders':['voter','arbitrator'],'scenario':'Voter\x20assumes\x20a\x20deadline;\x20voting_deadline\x20is\x20None\x20and\x20the\x20case\x20stalls\x20indefinitely','mitigation':'Document\x20that\x20None\x20means\x20open-ended.\x20Arbitrators\x20should\x20set\x20an\x20explicit\x20deadline\x20via\x20'+'arbitrator_confirm\x20unless\x20they\x20intend\x20an\x20open\x20vote.\x20SDK\x20should\x20surface\x20voting_deadline\x20'+'prominently.','related_move_error':'E_VOTING_DEADLINE_PASSED\x20(7)\x20/\x20E_VOTING_DEADLINE_NOT_PASSED\x20(4)','auto_fixable':![]},'check':a=>{if(!a['voting_deadline_none'])return null;return{...R_A_05['rule'],'evidence':'voting_deadline_none=true\x20(open-ended\x20vote)'};}},R_A_06={'rule':{'id':'R-ARB-06','level':'LOW','category':'semantic','title':'indemnity\x20is\x20Option<Indemnity>\x20—\x20None\x20means\x20no\x20compensation','description':'indemnity\x20is\x20Option<Indemnity>.\x20When\x20None,\x20the\x20arbitration\x20produces\x20no\x20compensation\x20'+'(e.g.\x20a\x20pure\x20declaratory\x20ruling).\x20Consumers\x20who\x20assume\x20a\x20non-null\x20indemnity\x20will\x20'+'mis-handle\x20None\x20cases.\x20finish()\x20returns\x20the\x20indemnity\x20amount\x20(0\x20when\x20None).','affected_stakeholders':['principal'],'scenario':'Principal\x20expects\x20compensation;\x20indemnity\x20is\x20None\x20and\x20finish()\x20returns\x200','mitigation':'Document\x20that\x20None\x20means\x20no\x20compensation.\x20UI\x20should\x20show\x20\x27no\x20compensation\x20awarded\x27\x20'+'rather\x20than\x20\x27compensation\x20pending\x27.','auto_fixable':![]},'check':a=>{if(!a['indemnity_none'])return null;return{...R_A_06['rule'],'evidence':'indemnity_none=true\x20(no\x20compensation)'};}},R_A_07={'rule':{'id':'R-ARB-07','level':'MEDIUM','category':'permission','title':'Voted.weight\x20is\x20set\x20by\x20the\x20Arbitration\x20rule\x20—\x20concentrated\x20weight\x20risk','description':'Voted.weight\x20(u32)\x20is\x20assigned\x20by\x20the\x20Arbitration\x20object\x27s\x20voting_guard\x20logic,\x20not\x20'+'by\x20the\x20voter.\x20If\x20the\x20Arbitration\x20rule\x20concentrates\x20weight\x20in\x20one\x20voter\x20(e.g.\x20an\x20'+'admin\x20with\x20weight\x201000\x20vs.\x20others\x20with\x20weight\x201),\x20a\x20single\x20voter\x20can\x20dictate\x20the\x20'+'outcome.\x20The\x20Arb\x20contract\x20itself\x20does\x20not\x20detect\x20concentration\x20—\x20that\x20is\x20the\x20'+'Arbitration\x20designer\x27s\x20responsibility.','affected_stakeholders':['voter','arbitrator'],'scenario':'Arbitration\x20rule\x20gives\x20one\x20voter\x20weight\x201000;\x20that\x20voter\x20single-handedly\x20decides\x20the\x20case','mitigation':'When\x20designing\x20the\x20Arbitration\x20rule,\x20cap\x20individual\x20voter\x20weight\x20and\x20require\x20a\x20'+'quorum.\x20Audit\x20the\x20voting_guard\x20to\x20ensure\x20no\x20single\x20voter\x20can\x20exceed\x20the\x20quorum\x20alone.','auto_fixable':![]},'check':a=>{if(!a['weight_concentrated'])return null;return{...R_A_07['rule'],'evidence':'weight_concentrated=true\x20(rule-level\x20risk)'};}},R_A_08={'rule':{'id':'R-ARB-08','level':'LOW','category':'semantic','title':'Status\x20uses\x20u8\x20constants\x20—\x20Move\x20enum\x20is\x20commented\x20out','description':'The\x207\x20statuses\x20are\x20defined\x20as\x20u8\x20constants\x20(Status_Principal_confirming=0,\x20etc.).\x20'+'The\x20Move\x20enum\x20definition\x20is\x20commented\x20out\x20(arb.move).\x20Consumers\x20cannot\x20rely\x20on\x20a\x20'+'type-safe\x20enum\x20and\x20must\x20compare\x20against\x20magic\x20numbers.\x20A\x20future\x20Wow\x20release\x20enabling\x20'+'the\x20enum\x20would\x20be\x20a\x20breaking\x20change\x20to\x20downstream\x20code.','affected_stakeholders':['system'],'scenario':'Developer\x20expects\x20a\x20Status\x20enum;\x20only\x20u8\x20constants\x20are\x20available,\x20causing\x20type\x20errors','mitigation':'SDK\x20should\x20expose\x20a\x20TypeScript\x20enum\x20mirroring\x20the\x20u8\x20constants.\x20Document\x20that\x20the\x20'+'Move\x20enum\x20is\x20intentionally\x20disabled\x20and\x20may\x20be\x20enabled\x20in\x20a\x20future\x20version.','auto_fixable':![]},'check':a=>{if(!a['expects_status_enum'])return null;return{...R_A_08['rule'],'evidence':'expects_status_enum=true\x20(only\x20u8\x20constants\x20exist)'};}};export const ARB_RISK_RULES=[R_A_01,R_A_02,R_A_03,R_A_04,R_A_05,R_A_06,R_A_07,R_A_08];export const ARB_RISK_VERSION='1.0.0';export function checkArbRisks(a){const b=[];for(const c of ARB_RISK_RULES){const d=c['check'](a);if(d)b['push'](d);}return b;}export function getArbRiskById(a){return ARB_RISK_RULES['find'](b=>b['rule']['id']===a)?.['rule'];}