@wowok/agent-mcp 2.7.1 → 2.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config/index.js +1 -1
- package/dist/config/runtime.js +1 -238
- package/dist/customer/account-events.d.ts +32 -0
- package/dist/customer/account-events.js +1 -0
- package/dist/customer/customer-advice.d.ts +1 -0
- package/dist/customer/customer-advice.js +1 -130
- package/dist/customer/index.js +1 -11
- package/dist/customer/industry-risks.js +1 -438
- package/dist/customer/info-puzzle.js +1 -681
- package/dist/customer/order-monitor.js +1 -328
- package/dist/customer/order-strategy.d.ts +1 -1
- package/dist/customer/order-strategy.js +1 -373
- package/dist/customer/post-purchase.js +1 -351
- package/dist/customer/preorder-compare.js +1 -34
- package/dist/customer/reminder-system.d.ts +2 -0
- package/dist/customer/reminder-system.js +1 -316
- package/dist/customer/risk-assessment.d.ts +1 -0
- package/dist/customer/risk-assessment.js +1 -397
- package/dist/customer/types.d.ts +2 -0
- package/dist/customer/types.js +1 -13
- package/dist/customer/user-preferences.js +1 -460
- package/dist/evaluation/arbitration-game.d.ts +9 -2
- package/dist/evaluation/arbitration-game.js +1 -48
- package/dist/evaluation/builtins/arbitration-score.d.ts +41 -0
- package/dist/evaluation/builtins/arbitration-score.js +1 -0
- package/dist/evaluation/builtins/demand-match.js +1 -153
- package/dist/evaluation/builtins/index.d.ts +1 -0
- package/dist/evaluation/builtins/index.js +1 -10
- package/dist/evaluation/builtins/service-risk.js +1 -55
- package/dist/evaluation/capability.js +1 -13
- package/dist/evaluation/category-match-rules.d.ts +30 -0
- package/dist/evaluation/category-match-rules.js +1 -0
- package/dist/evaluation/composer.js +1 -40
- package/dist/evaluation/engine.js +1 -175
- package/dist/evaluation/extract.js +1 -115
- package/dist/evaluation/game-strategy.d.ts +27 -0
- package/dist/evaluation/game-strategy.js +1 -0
- package/dist/evaluation/gap.js +1 -100
- package/dist/evaluation/index.d.ts +2 -0
- package/dist/evaluation/index.js +1 -11
- package/dist/evaluation/location-match.d.ts +42 -0
- package/dist/evaluation/location-match.js +1 -0
- package/dist/evaluation/node-game.d.ts +31 -3
- package/dist/evaluation/node-game.js +1 -57
- package/dist/evaluation/path-reasoning.d.ts +35 -0
- package/dist/evaluation/path-reasoning.js +1 -0
- package/dist/evaluation/region.d.ts +6 -0
- package/dist/evaluation/region.js +1 -36
- package/dist/evaluation/types.d.ts +18 -0
- package/dist/evaluation/types.js +1 -1
- package/dist/evaluation/user-injection.js +1 -27
- package/dist/experience/experience-reuse.js +1 -103
- package/dist/experience/index.js +1 -5
- package/dist/experience/intent-distill.js +1 -83
- package/dist/experience/realtime-feedback.js +1 -94
- package/dist/experience/types.js +1 -1
- package/dist/experience/user-profile.d.ts +1 -1
- package/dist/experience/user-profile.js +1 -171
- package/dist/extensions/business-modules.js +1 -287
- package/dist/extensions/capability-manifest.js +1 -781
- package/dist/extensions/constraint-registry.js +1 -198
- package/dist/extensions/index.d.ts +6 -0
- package/dist/extensions/index.js +1 -6
- package/dist/extensions/industry-layers.d.ts +75 -0
- package/dist/extensions/industry-layers.js +1 -0
- package/dist/extensions/industry-pack.d.ts +105 -0
- package/dist/extensions/industry-pack.js +1 -0
- package/dist/extensions/metric-registry.js +1 -257
- package/dist/extensions/mode-evaluator.d.ts +1 -1
- package/dist/extensions/mode-evaluator.js +1 -170
- package/dist/extensions/modes.js +1 -499
- package/dist/extensions/registry.d.ts +1 -0
- package/dist/extensions/registry.js +1 -717
- package/dist/extensions/types.js +1 -1
- package/dist/graph/base.d.ts +8 -0
- package/dist/graph/base.js +1 -0
- package/dist/harness/auto-escalation.js +1 -68
- package/dist/harness/checkpoint.js +1 -129
- package/dist/harness/index.d.ts +1 -0
- package/dist/harness/index.js +1 -78
- package/dist/harness/plan.d.ts +2 -0
- package/dist/harness/plan.js +1 -315
- package/dist/harness/recover.d.ts +1 -1
- package/dist/harness/recover.js +1 -139
- package/dist/harness/types.d.ts +2 -3
- package/dist/harness/types.js +1 -1
- package/dist/harness/verify.js +1 -237
- package/dist/index.js +1 -273
- package/dist/intent/enrich.js +1 -67
- package/dist/intent/index.js +1 -60
- package/dist/intent/matcher.js +1 -81
- package/dist/intent/store.js +1 -55
- package/dist/intent/types.js +1 -10
- package/dist/knowledge/acquisition-flywheel.js +1 -192
- package/dist/knowledge/allocation-confirm.js +1 -534
- package/dist/knowledge/allocation-context.js +1 -249
- package/dist/knowledge/allocation-ledger.js +1 -463
- package/dist/knowledge/allocation-puzzle.js +1 -298
- package/dist/knowledge/allocation-risk.js +1 -568
- package/dist/knowledge/allocation-templates.js +1 -970
- package/dist/knowledge/allocation-translation.js +1 -585
- package/dist/knowledge/anti-cheat.d.ts +37 -0
- package/dist/knowledge/anti-cheat.js +1 -0
- package/dist/knowledge/arb-confirm.d.ts +28 -0
- package/dist/knowledge/arb-confirm.js +1 -0
- package/dist/knowledge/arb-risk.js +1 -210
- package/dist/knowledge/arb-translation.d.ts +48 -0
- package/dist/knowledge/arb-translation.js +1 -0
- package/dist/knowledge/arbitration-confirm.js +1 -559
- package/dist/knowledge/arbitration-context.js +1 -505
- package/dist/knowledge/arbitration-ledger.js +1 -521
- package/dist/knowledge/arbitration-puzzle.js +1 -304
- package/dist/knowledge/arbitration-risk.js +1 -423
- package/dist/knowledge/arbitration-templates.js +1 -276
- package/dist/knowledge/arbitration-translation.js +1 -487
- package/dist/knowledge/audit-rules.js +1 -141
- package/dist/knowledge/bridge-confirm.d.ts +26 -0
- package/dist/knowledge/bridge-confirm.js +1 -0
- package/dist/knowledge/bridge-risk.js +1 -263
- package/dist/knowledge/bridge-translation.d.ts +37 -0
- package/dist/knowledge/bridge-translation.js +1 -0
- package/dist/knowledge/contact-confirm.d.ts +27 -0
- package/dist/knowledge/contact-confirm.js +1 -0
- package/dist/knowledge/contact-risk.js +1 -200
- package/dist/knowledge/contact-templates.js +1 -60
- package/dist/knowledge/contact-translation.d.ts +39 -0
- package/dist/knowledge/contact-translation.js +1 -0
- package/dist/knowledge/demand-confirm.js +1 -206
- package/dist/knowledge/demand-context.d.ts +17 -0
- package/dist/knowledge/demand-context.js +1 -0
- package/dist/knowledge/demand-ledger.d.ts +26 -0
- package/dist/knowledge/demand-ledger.js +1 -0
- package/dist/knowledge/demand-matching.js +1 -132
- package/dist/knowledge/demand-puzzle.d.ts +29 -0
- package/dist/knowledge/demand-puzzle.js +1 -0
- package/dist/knowledge/demand-risk.js +1 -240
- package/dist/knowledge/demand-templates.d.ts +12 -0
- package/dist/knowledge/demand-templates.js +1 -0
- package/dist/knowledge/demand-translation.js +1 -354
- package/dist/knowledge/deployment-scanner.js +1 -823
- package/dist/knowledge/dynamic-pricing.js +1 -87
- package/dist/knowledge/evidence-review.d.ts +12 -0
- package/dist/knowledge/evidence-review.js +1 -0
- package/dist/knowledge/examples-scanner-cli.js +1 -26
- package/dist/knowledge/examples-scanner.js +1 -843
- package/dist/knowledge/flywheel-loop.d.ts +0 -1
- package/dist/knowledge/flywheel-loop.js +1 -404
- package/dist/knowledge/fund-layer.js +1 -973
- package/dist/knowledge/glossary.js +1 -211
- package/dist/knowledge/guard-confirm.js +1 -406
- package/dist/knowledge/guard-context.js +1 -287
- package/dist/knowledge/guard-design-patterns.js +1 -360
- package/dist/knowledge/guard-ledger.js +1 -260
- package/dist/knowledge/guard-lint.js +1 -670
- package/dist/knowledge/guard-migration.d.ts +1 -1
- package/dist/knowledge/guard-migration.js +1 -228
- package/dist/knowledge/guard-puzzle.js +1 -805
- package/dist/knowledge/guard-render.js +1 -700
- package/dist/knowledge/guard-risk.js +1 -1879
- package/dist/knowledge/guard-submission-prompt.js +1 -171
- package/dist/knowledge/guard-templates.js +1 -1105
- package/dist/knowledge/guard-translation.js +1 -1119
- package/dist/knowledge/index.d.ts +71 -3
- package/dist/knowledge/index.js +1 -436
- package/dist/knowledge/industry-evolution.js +1 -323
- package/dist/knowledge/industry-generalizer.js +1 -381
- package/dist/knowledge/industry-registry.js +1 -174
- package/dist/knowledge/intent-metrics.d.ts +4 -3
- package/dist/knowledge/intent-metrics.js +1 -566
- package/dist/knowledge/machine-confirm.js +1 -559
- package/dist/knowledge/machine-context.js +1 -833
- package/dist/knowledge/machine-ledger.js +1 -338
- package/dist/knowledge/machine-puzzle.js +1 -494
- package/dist/knowledge/machine-render.js +1 -565
- package/dist/knowledge/machine-risk.js +1 -669
- package/dist/knowledge/machine-templates.js +1 -1597
- package/dist/knowledge/machine-topology.js +1 -234
- package/dist/knowledge/machine-translation.js +1 -513
- package/dist/knowledge/market-metrics.d.ts +12 -0
- package/dist/knowledge/market-metrics.js +1 -0
- package/dist/knowledge/market-operations.d.ts +46 -0
- package/dist/knowledge/market-operations.js +1 -0
- package/dist/knowledge/mcp-schema-audit-cli.js +1 -45
- package/dist/knowledge/mcp-schema-audit.d.ts +22 -22
- package/dist/knowledge/mcp-schema-audit.js +1 -777
- package/dist/knowledge/onchain-constants.js +1 -35
- package/dist/knowledge/order-confirm.js +1 -573
- package/dist/knowledge/order-context.js +1 -390
- package/dist/knowledge/order-ledger.js +1 -341
- package/dist/knowledge/order-puzzle.js +1 -255
- package/dist/knowledge/order-risk.js +1 -653
- package/dist/knowledge/order-templates.js +1 -368
- package/dist/knowledge/order-translation.js +1 -550
- package/dist/knowledge/overrides-loader.js +1 -65
- package/dist/knowledge/passport-confirm.js +1 -531
- package/dist/knowledge/passport-context.js +1 -306
- package/dist/knowledge/passport-ledger.js +1 -282
- package/dist/knowledge/passport-puzzle.js +1 -333
- package/dist/knowledge/passport-risk.js +1 -450
- package/dist/knowledge/passport-templates.js +1 -568
- package/dist/knowledge/passport-translation.js +1 -516
- package/dist/knowledge/payment-confirm.d.ts +26 -0
- package/dist/knowledge/payment-confirm.js +1 -0
- package/dist/knowledge/payment-risk.js +1 -249
- package/dist/knowledge/payment-translation.d.ts +37 -0
- package/dist/knowledge/payment-translation.js +1 -0
- package/dist/knowledge/permission-confirm.js +1 -426
- package/dist/knowledge/permission-context.js +1 -224
- package/dist/knowledge/permission-ledger.d.ts +11 -0
- package/dist/knowledge/permission-ledger.js +1 -403
- package/dist/knowledge/permission-puzzle.js +1 -173
- package/dist/knowledge/permission-risk.js +1 -411
- package/dist/knowledge/permission-templates.js +1 -234
- package/dist/knowledge/permission-translation.js +1 -350
- package/dist/knowledge/personal-confirm.d.ts +29 -0
- package/dist/knowledge/personal-confirm.js +1 -0
- package/dist/knowledge/personal-risk.js +1 -212
- package/dist/knowledge/personal-translation.d.ts +37 -0
- package/dist/knowledge/personal-translation.js +1 -0
- package/dist/knowledge/process-model.d.ts +1 -11
- package/dist/knowledge/process-model.js +1 -160
- package/dist/knowledge/progress-confirm.js +1 -456
- package/dist/knowledge/progress-context.js +1 -452
- package/dist/knowledge/progress-ledger.js +1 -330
- package/dist/knowledge/progress-puzzle.js +1 -219
- package/dist/knowledge/progress-risk.js +1 -461
- package/dist/knowledge/progress-templates.js +1 -228
- package/dist/knowledge/progress-translation.js +1 -405
- package/dist/knowledge/proof-confirm.js +1 -187
- package/dist/knowledge/proof-context.d.ts +17 -0
- package/dist/knowledge/proof-context.js +1 -0
- package/dist/knowledge/proof-ledger.d.ts +34 -0
- package/dist/knowledge/proof-ledger.js +1 -0
- package/dist/knowledge/proof-puzzle.d.ts +35 -0
- package/dist/knowledge/proof-puzzle.js +1 -0
- package/dist/knowledge/proof-risk.js +1 -207
- package/dist/knowledge/proof-templates.d.ts +22 -0
- package/dist/knowledge/proof-templates.js +1 -0
- package/dist/knowledge/proof-translation.js +1 -283
- package/dist/knowledge/registrar-confirm.d.ts +26 -0
- package/dist/knowledge/registrar-confirm.js +1 -0
- package/dist/knowledge/registrar-risk.js +1 -217
- package/dist/knowledge/registrar-translation.d.ts +37 -0
- package/dist/knowledge/registrar-translation.js +1 -0
- package/dist/knowledge/repository-confirm.js +1 -286
- package/dist/knowledge/repository-context.d.ts +12 -0
- package/dist/knowledge/repository-context.js +1 -0
- package/dist/knowledge/repository-ledger.d.ts +25 -0
- package/dist/knowledge/repository-ledger.js +1 -0
- package/dist/knowledge/repository-puzzle.d.ts +30 -0
- package/dist/knowledge/repository-puzzle.js +1 -0
- package/dist/knowledge/repository-risk.js +1 -373
- package/dist/knowledge/repository-templates.d.ts +14 -0
- package/dist/knowledge/repository-templates.js +1 -0
- package/dist/knowledge/repository-translation.js +1 -445
- package/dist/knowledge/reputation-rules.js +1 -99
- package/dist/knowledge/resource-confirm.d.ts +25 -0
- package/dist/knowledge/resource-confirm.js +1 -0
- package/dist/knowledge/resource-risk.js +1 -157
- package/dist/knowledge/resource-translation.d.ts +37 -0
- package/dist/knowledge/resource-translation.js +1 -0
- package/dist/knowledge/reward-confirm.js +1 -526
- package/dist/knowledge/reward-context.d.ts +2 -2
- package/dist/knowledge/reward-context.js +1 -504
- package/dist/knowledge/reward-ledger.js +1 -502
- package/dist/knowledge/reward-puzzle.js +1 -300
- package/dist/knowledge/reward-risk.js +1 -627
- package/dist/knowledge/reward-templates.js +1 -197
- package/dist/knowledge/reward-translation.js +1 -501
- package/dist/knowledge/safety-rules.d.ts +1 -0
- package/dist/knowledge/safety-rules.js +1 -404
- package/dist/knowledge/scenario-modes.js +1 -321
- package/dist/knowledge/service-confirm.js +1 -807
- package/dist/knowledge/service-context.js +1 -403
- package/dist/knowledge/service-ledger.js +1 -609
- package/dist/knowledge/service-puzzle.js +1 -236
- package/dist/knowledge/service-risk.d.ts +1 -1
- package/dist/knowledge/service-risk.js +1 -651
- package/dist/knowledge/service-templates.js +1 -456
- package/dist/knowledge/service-translation.js +1 -622
- package/dist/knowledge/template-registry.js +1 -353
- package/dist/knowledge/tool-constraints.js +1 -195
- package/dist/knowledge/tools-reference.js +1 -178
- package/dist/knowledge/treasury-confirm.js +1 -512
- package/dist/knowledge/treasury-context.js +1 -363
- package/dist/knowledge/treasury-ledger.js +1 -300
- package/dist/knowledge/treasury-puzzle.js +1 -216
- package/dist/knowledge/treasury-risk.js +1 -440
- package/dist/knowledge/treasury-templates.js +1 -358
- package/dist/knowledge/treasury-translation.js +1 -498
- package/dist/knowledge/trust-metrics.js +1 -198
- package/dist/knowledge/universal-template.d.ts +22 -0
- package/dist/knowledge/universal-template.js +1 -0
- package/dist/knowledge/util-confirm.d.ts +24 -0
- package/dist/knowledge/util-confirm.js +1 -0
- package/dist/knowledge/util-risk.js +1 -135
- package/dist/knowledge/util-translation.d.ts +38 -0
- package/dist/knowledge/util-translation.js +1 -0
- package/dist/knowledge/workflow-guidance.d.ts +116 -0
- package/dist/knowledge/workflow-guidance.js +1 -0
- package/dist/loop-engineering/aggregate.js +1 -132
- package/dist/loop-engineering/context-collect.js +1 -83
- package/dist/loop-engineering/diagnose.js +1 -273
- package/dist/loop-engineering/improve.js +1 -405
- package/dist/loop-engineering/index.js +1 -4
- package/dist/loop-engineering/pipeline.js +1 -56
- package/dist/mode-market/index.js +1 -3
- package/dist/mode-market/registry.js +1 -124
- package/dist/mode-market/review.js +1 -214
- package/dist/mode-market/submission.js +1 -85
- package/dist/participation/collaborator-interest.d.ts +23 -0
- package/dist/participation/collaborator-interest.js +1 -0
- package/dist/participation/customer-interest.d.ts +25 -0
- package/dist/participation/customer-interest.js +1 -0
- package/dist/participation/employee-kpi.d.ts +25 -0
- package/dist/participation/employee-kpi.js +1 -0
- package/dist/participation/employee-store.d.ts +16 -0
- package/dist/participation/employee-store.js +1 -0
- package/dist/participation/index.d.ts +2 -0
- package/dist/participation/index.js +1 -0
- package/dist/participation/merchant-interest.js +1 -100
- package/dist/participation/radar-core.d.ts +13 -3
- package/dist/participation/radar-core.js +1 -269
- package/dist/participation/supplier-interest.d.ts +25 -0
- package/dist/participation/supplier-interest.js +1 -0
- package/dist/persona/analyzer.js +1 -66
- package/dist/persona/bridge.js +1 -86
- package/dist/persona/defaults.js +1 -195
- package/dist/persona/experience-bridge.js +1 -23
- package/dist/persona/index.d.ts +9 -2
- package/dist/persona/index.js +1 -71
- package/dist/persona/local-region.d.ts +20 -0
- package/dist/persona/local-region.js +1 -0
- package/dist/persona/model.js +1 -111
- package/dist/persona/overrides.d.ts +10 -0
- package/dist/persona/overrides.js +1 -0
- package/dist/persona/pack-personae.d.ts +11 -0
- package/dist/persona/pack-personae.js +1 -0
- package/dist/persona/store.js +1 -62
- package/dist/persona/strategy-intent.d.ts +20 -0
- package/dist/persona/strategy-intent.js +1 -0
- package/dist/persona/types.d.ts +6 -2
- package/dist/persona/types.js +1 -5
- package/dist/project/business-puzzle.d.ts +1 -1
- package/dist/project/business-puzzle.js +1 -383
- package/dist/project/context-assembly.js +1 -254
- package/dist/project/deployment-bridge.js +1 -120
- package/dist/project/deployment-doc.js +1 -1126
- package/dist/project/edit-planner.js +1 -1342
- package/dist/project/evaluation.d.ts +37 -1
- package/dist/project/evaluation.js +1 -2011
- package/dist/project/game-theory.js +1 -177
- package/dist/project/graph-builder.js +1 -656
- package/dist/project/graph.d.ts +3 -6
- package/dist/project/graph.js +1 -340
- package/dist/project/handlers.d.ts +33 -2
- package/dist/project/handlers.js +1 -1784
- package/dist/project/index.d.ts +2 -0
- package/dist/project/index.js +1 -301
- package/dist/project/intent-analyzer.js +1 -149
- package/dist/project/machine-nodes.js +1 -36
- package/dist/project/merchant-guide.d.ts +19 -0
- package/dist/project/merchant-guide.js +1 -264
- package/dist/project/migration.js +1 -125
- package/dist/project/mode-actions.js +1 -309
- package/dist/project/namespace.js +1 -206
- package/dist/project/participation-radar.js +1 -428
- package/dist/project/pipeline-actions.js +1 -109
- package/dist/project/project-store.js +1 -422
- package/dist/project/query.js +1 -153
- package/dist/project/reverse-mapping.d.ts +34 -0
- package/dist/project/reverse-mapping.js +1 -0
- package/dist/project/risk-aggregator.js +1 -295
- package/dist/project/rollback-policy.js +1 -290
- package/dist/project/semantic-assembler.js +1 -345
- package/dist/project/semantic-graph.d.ts +3 -5
- package/dist/project/semantic-graph.js +1 -292
- package/dist/project/stage-gate.js +1 -369
- package/dist/project/substep-trace.js +1 -332
- package/dist/project/task-tracker.js +1 -78
- package/dist/project/workflow-design-assessment.d.ts +24 -0
- package/dist/project/workflow-design-assessment.js +1 -0
- package/dist/role/derivation.d.ts +18 -0
- package/dist/role/derivation.js +1 -0
- package/dist/role/index.d.ts +5 -0
- package/dist/role/index.js +1 -0
- package/dist/role/model.d.ts +8 -0
- package/dist/role/model.js +1 -0
- package/dist/role/resolution.d.ts +11 -0
- package/dist/role/resolution.js +1 -0
- package/dist/role/types.d.ts +11 -0
- package/dist/role/types.js +1 -0
- package/dist/rules.js +1 -52
- package/dist/safety/confirm-gate.d.ts +1 -1
- package/dist/safety/confirm-gate.js +1 -88
- package/dist/safety/index.js +1 -3
- package/dist/safety/preview.js +1 -52
- package/dist/schema/call/allocation.d.ts +186 -1385
- package/dist/schema/call/allocation.js +1 -34
- package/dist/schema/call/arbitration.d.ts +272 -1871
- package/dist/schema/call/arbitration.js +1 -113
- package/dist/schema/call/base.d.ts +1831 -9076
- package/dist/schema/call/base.js +1 -370
- package/dist/schema/call/bridge.d.ts +911 -3171
- package/dist/schema/call/bridge.js +1 -458
- package/dist/schema/call/contact.d.ts +135 -931
- package/dist/schema/call/contact.js +1 -37
- package/dist/schema/call/demand.d.ts +164 -1194
- package/dist/schema/call/demand.js +1 -47
- package/dist/schema/call/guard.d.ts +298 -1140
- package/dist/schema/call/guard.js +1 -161
- package/dist/schema/call/handler.js +1 -322
- package/dist/schema/call/index.js +1 -20
- package/dist/schema/call/machine.d.ts +459 -5403
- package/dist/schema/call/machine.js +1 -193
- package/dist/schema/call/order.d.ts +137 -844
- package/dist/schema/call/order.js +1 -35
- package/dist/schema/call/payment.d.ts +74 -561
- package/dist/schema/call/payment.js +1 -37
- package/dist/schema/call/permission-handler.js +1 -54
- package/dist/schema/call/permission.d.ts +335 -2791
- package/dist/schema/call/permission.js +1 -105
- package/dist/schema/call/personal.d.ts +227 -1814
- package/dist/schema/call/personal.js +1 -78
- package/dist/schema/call/progress.d.ts +140 -843
- package/dist/schema/call/progress.js +1 -47
- package/dist/schema/call/proof.d.ts +42 -258
- package/dist/schema/call/proof.js +1 -33
- package/dist/schema/call/repository.d.ts +324 -2222
- package/dist/schema/call/repository.js +1 -77
- package/dist/schema/call/reward.d.ts +153 -1183
- package/dist/schema/call/reward.js +1 -30
- package/dist/schema/call/semantic.js +1 -1679
- package/dist/schema/call/service.d.ts +376 -3431
- package/dist/schema/call/service.js +1 -184
- package/dist/schema/call/treasury.d.ts +252 -2158
- package/dist/schema/call/treasury.js +1 -71
- package/dist/schema/common/index.d.ts +222 -697
- package/dist/schema/common/index.js +1 -407
- package/dist/schema/config/index.d.ts +18 -161
- package/dist/schema/config/index.js +1 -68
- package/dist/schema/employee/index.d.ts +99 -0
- package/dist/schema/employee/index.js +1 -0
- package/dist/schema/evaluation/index.d.ts +1062 -3748
- package/dist/schema/evaluation/index.js +1 -356
- package/dist/schema/index.d.ts +3 -0
- package/dist/schema/index.js +1 -17
- package/dist/schema/industry-pack/index.d.ts +132 -0
- package/dist/schema/industry-pack/index.js +1 -0
- package/dist/schema/intent-radar/index.d.ts +92 -245
- package/dist/schema/intent-radar/index.js +1 -89
- package/dist/schema/local/index.d.ts +2045 -18080
- package/dist/schema/local/index.js +1 -927
- package/dist/schema/local/wip.d.ts +61 -651
- package/dist/schema/local/wip.js +1 -187
- package/dist/schema/messenger/index.d.ts +949 -5557
- package/dist/schema/messenger/index.js +1 -475
- package/dist/schema/operations.d.ts +2969 -26518
- package/dist/schema/operations.js +1 -520
- package/dist/schema/persona/index.d.ts +469 -1820
- package/dist/schema/persona/index.js +1 -148
- package/dist/schema/project/index.d.ts +1027 -8408
- package/dist/schema/project/index.js +1 -2057
- package/dist/schema/query/index.d.ts +12041 -75261
- package/dist/schema/query/index.js +1 -1646
- package/dist/schema/schema-query/index.d.ts +35 -98
- package/dist/schema/schema-query/index.js +1 -104
- package/dist/schema/schema-version.js +1 -76
- package/dist/schema/task-status.d.ts +26 -132
- package/dist/schema/task-status.js +1 -36
- package/dist/schema/trust/index.d.ts +194 -1290
- package/dist/schema/trust/index.js +1 -314
- package/dist/schema/utils/guard-parser.js +1 -419
- package/dist/schema/utils/guard-query-utils.js +1 -46
- package/dist/schema/utils/node-parser.js +1 -369
- package/dist/schema/utils/object-type-utils.js +1 -35
- package/dist/schema/utils/permission-index-utils.js +1 -7
- package/dist/schema/utils/permission-machine-check.js +1 -121
- package/dist/schema/utils/skills-recommendation.d.ts +1 -0
- package/dist/schema/utils/skills-recommendation.js +1 -77
- package/dist/schema/workspace/index.d.ts +69 -0
- package/dist/schema/workspace/index.js +1 -0
- package/dist/schema-query-impl/index.js +1 -0
- package/dist/schemas/account_operation.output.json +3147 -1652
- package/dist/schemas/account_operation.schema.json +225 -218
- package/dist/schemas/bridge_operation.output.json +1168 -650
- package/dist/schemas/bridge_operation.schema.json +736 -504
- package/dist/schemas/config_operation.output.json +185 -179
- package/dist/schemas/config_operation.schema.json +21 -26
- package/dist/schemas/employee_operation.output.json +207 -0
- package/dist/schemas/employee_operation.schema.json +176 -0
- package/dist/schemas/evaluation_operation.output.json +2329 -557
- package/dist/schemas/evaluation_operation.schema.json +2939 -720
- package/dist/schemas/guard2file.output.json +58 -64
- package/dist/schemas/guard2file.schema.json +79 -81
- package/dist/schemas/index.json +29 -11
- package/dist/schemas/industry_pack_operation.output.json +594 -0
- package/dist/schemas/industry_pack_operation.schema.json +55 -0
- package/dist/schemas/intent_radar.output.json +275 -200
- package/dist/schemas/intent_radar.schema.json +124 -123
- package/dist/schemas/local_info_operation.output.json +1174 -657
- package/dist/schemas/local_info_operation.schema.json +119 -125
- package/dist/schemas/local_mark_operation.output.json +1239 -689
- package/dist/schemas/local_mark_operation.schema.json +91 -96
- package/dist/schemas/machineNode2file.output.json +63 -69
- package/dist/schemas/machineNode2file.schema.json +79 -81
- package/dist/schemas/messenger_operation.output.json +2722 -1528
- package/dist/schemas/messenger_operation.schema.json +1482 -1264
- package/dist/schemas/onchain_events.output.json +2590 -975
- package/dist/schemas/onchain_events.schema.json +117 -99
- package/dist/schemas/onchain_operations.output.json +3957 -2309
- package/dist/schemas/onchain_operations.schema.json +20799 -9285
- package/dist/schemas/onchain_operations_allocation.schema.json +172 -108
- package/dist/schemas/onchain_operations_arbitration.schema.json +233 -146
- package/dist/schemas/onchain_operations_contact.schema.json +129 -90
- package/dist/schemas/onchain_operations_demand.schema.json +170 -112
- package/dist/schemas/onchain_operations_gen_passport.schema.json +61 -646
- package/dist/schemas/onchain_operations_gen_proof.schema.json +40 -172
- package/dist/schemas/onchain_operations_guard.schema.json +3765 -294
- package/dist/schemas/onchain_operations_machine.schema.json +537 -164
- package/dist/schemas/onchain_operations_order.schema.json +126 -96
- package/dist/schemas/onchain_operations_payment.schema.json +82 -67
- package/dist/schemas/onchain_operations_permission.schema.json +331 -93
- package/dist/schemas/onchain_operations_personal.schema.json +636 -96
- package/dist/schemas/onchain_operations_progress.schema.json +125 -92
- package/dist/schemas/onchain_operations_proof.schema.json +76 -69
- package/dist/schemas/onchain_operations_repository.schema.json +636 -249
- package/dist/schemas/onchain_operations_reward.schema.json +218 -108
- package/dist/schemas/onchain_operations_service.schema.json +679 -221
- package/dist/schemas/onchain_operations_treasury.schema.json +401 -135
- package/dist/schemas/onchain_table_data.output.json +6018 -2430
- package/dist/schemas/onchain_table_data.schema.json +544 -430
- package/dist/schemas/persona_operation.output.json +1568 -265
- package/dist/schemas/persona_operation.schema.json +346 -202
- package/dist/schemas/project_operation.output.json +6957 -5147
- package/dist/schemas/project_operation.schema.json +1050 -1020
- package/dist/schemas/query_task_status.output.json +195 -99
- package/dist/schemas/query_task_status.schema.json +12 -18
- package/dist/schemas/query_toolkit.output.json +18870 -14566
- package/dist/schemas/query_toolkit.schema.json +614 -522
- package/dist/schemas/schema_query.output.json +127 -129
- package/dist/schemas/schema_query.schema.json +64 -69
- package/dist/schemas/trust_score.output.json +678 -587
- package/dist/schemas/trust_score.schema.json +289 -277
- package/dist/schemas/wip_file.output.json +116 -124
- package/dist/schemas/wip_file.schema.json +142 -143
- package/dist/schemas/workspace_operation.output.json +277 -0
- package/dist/schemas/workspace_operation.schema.json +45 -0
- package/dist/schemas/wowok_buildin_info.output.json +1693 -723
- package/dist/schemas/wowok_buildin_info.schema.json +576 -512
- package/dist/telemetry/index.js +1 -112
- package/dist/telemetry/redact.js +1 -23
- package/dist/telemetry/storage.js +1 -80
- package/dist/tools/handlers/bridge.d.ts +8 -1
- package/dist/tools/handlers/bridge.js +1 -1
- package/dist/tools/handlers/config.js +1 -74
- package/dist/tools/handlers/employee.d.ts +2 -0
- package/dist/tools/handlers/employee.js +1 -0
- package/dist/tools/handlers/evaluation.js +1 -123
- package/dist/tools/handlers/file-export.js +1 -90
- package/dist/tools/handlers/industry-pack.d.ts +2 -0
- package/dist/tools/handlers/industry-pack.js +1 -0
- package/dist/tools/handlers/intent-radar.js +1 -76
- package/dist/tools/handlers/local.js +1 -53
- package/dist/tools/handlers/messenger.js +1 -188
- package/dist/tools/handlers/onchain.js +1 -1180
- package/dist/tools/handlers/persona.js +1 -89
- package/dist/tools/handlers/project.js +1 -211
- package/dist/tools/handlers/query.js +1 -434
- package/dist/tools/handlers/schema-query.js +1 -176
- package/dist/tools/handlers/task-status.js +1 -26
- package/dist/tools/handlers/trust.js +1 -380
- package/dist/tools/handlers/wip.js +1 -90
- package/dist/tools/handlers/workspace.d.ts +2 -0
- package/dist/tools/handlers/workspace.js +1 -0
- package/dist/tools/index.d.ts +2 -1
- package/dist/tools/index.js +1 -1382
- package/dist/tools/retry.js +1 -85
- package/dist/tools/rules-hook.d.ts +1 -1
- package/dist/tools/rules-hook.js +1 -23
- package/dist/tools/shared.d.ts +1 -1
- package/dist/tools/shared.js +1 -130
- package/dist/tools/types.d.ts +2 -1
- package/dist/tools/types.js +1 -1
- package/dist/tools/upgrade-check.d.ts +19 -0
- package/dist/tools/upgrade-check.js +1 -0
- package/dist/tools/wip-deploy-assist.js +1 -306
- package/dist/tools/wrap.js +1 -500
- package/package.json +7 -6
- package/dist/knowledge/arbitration-trust.d.ts +0 -24
- package/dist/knowledge/arbitration-trust.js +0 -117
- package/dist/schema/call/bridge-handler.d.ts +0 -8
- package/dist/schema/call/bridge-handler.js +0 -265
- package/dist/schema/sync-layer4.d.ts +0 -21
- package/dist/schema/sync-layer4.js +0 -286
- package/dist/schema-query/index.js +0 -810
- /package/dist/{schema-query → schema-query-impl}/index.d.ts +0 -0
|
@@ -1,423 +1 @@
|
|
|
1
|
-
import { MAX_VOTING_GUARD_COUNT, } from "@wowok/wowok";
|
|
2
|
-
import { isTerminalArbStatus, isValidArbStatusTransition, } from "./arbitration-ledger.js";
|
|
3
|
-
const R_AB_1_01 = {
|
|
4
|
-
id: "R-AB-1-01",
|
|
5
|
-
category: "structural",
|
|
6
|
-
trigger: "voting_guard count exceeds MAX_VOTING_GUARD_COUNT (50)",
|
|
7
|
-
check: (ctx) => {
|
|
8
|
-
if (!ctx.voting_guard)
|
|
9
|
-
return null;
|
|
10
|
-
if (ctx.voting_guard.op === "add" || ctx.voting_guard.op === "set") {
|
|
11
|
-
const newCount = ctx.voting_guard.op === "set"
|
|
12
|
-
? ctx.voting_guard.guards.length
|
|
13
|
-
: (ctx.current_voting_guard_count ?? 0) + ctx.voting_guard.guards.length;
|
|
14
|
-
if (newCount > MAX_VOTING_GUARD_COUNT) {
|
|
15
|
-
return {
|
|
16
|
-
id: "R-AB-1-01",
|
|
17
|
-
level: "HIGH",
|
|
18
|
-
category: "structural",
|
|
19
|
-
title: "voting_guard count exceeds limit",
|
|
20
|
-
description: `voting_guard would have ${newCount} entries, exceeds MAX_VOTING_GUARD_COUNT ${MAX_VOTING_GUARD_COUNT}`,
|
|
21
|
-
affected_stakeholders: ["owner", "arbiter"],
|
|
22
|
-
scenario: "Adding too many voting guards",
|
|
23
|
-
mitigation: `Remove unused guards before adding new ones; max ${MAX_VOTING_GUARD_COUNT}`,
|
|
24
|
-
evidence: `count=${newCount}`,
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return null;
|
|
29
|
-
},
|
|
30
|
-
};
|
|
31
|
-
const R_AB_1_02 = {
|
|
32
|
-
id: "R-AB-1-02",
|
|
33
|
-
category: "structural",
|
|
34
|
-
trigger: "Dispute fee below arbitration.fee threshold",
|
|
35
|
-
check: (ctx) => {
|
|
36
|
-
if (!ctx.dispute || ctx.current_arbitration_fee === undefined)
|
|
37
|
-
return null;
|
|
38
|
-
const feeRequired = typeof ctx.current_arbitration_fee === "string"
|
|
39
|
-
? BigInt(ctx.current_arbitration_fee)
|
|
40
|
-
: BigInt(ctx.current_arbitration_fee);
|
|
41
|
-
const feeProvided = typeof ctx.dispute.fee === "object" && ctx.dispute.fee !== null && "balance" in ctx.dispute.fee
|
|
42
|
-
? BigInt(ctx.dispute.fee.balance ?? 0)
|
|
43
|
-
: BigInt(0);
|
|
44
|
-
if (feeProvided < feeRequired) {
|
|
45
|
-
return {
|
|
46
|
-
id: "R-AB-1-02",
|
|
47
|
-
level: "CRITICAL",
|
|
48
|
-
category: "structural",
|
|
49
|
-
title: "Dispute fee insufficient (E_FEE_NOT_ENOUGH)",
|
|
50
|
-
description: `Provided fee ${feeProvided.toString()} < required ${feeRequired.toString()}`,
|
|
51
|
-
affected_stakeholders: ["disputant"],
|
|
52
|
-
scenario: "Filing dispute with insufficient fee",
|
|
53
|
-
mitigation: `Increase dispute.fee.balance to >= ${feeRequired.toString()}`,
|
|
54
|
-
evidence: `provided=${feeProvided.toString()}, required=${feeRequired.toString()}`,
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
return null;
|
|
58
|
-
},
|
|
59
|
-
};
|
|
60
|
-
const R_AB_1_03 = {
|
|
61
|
-
id: "R-AB-1-03",
|
|
62
|
-
category: "structural",
|
|
63
|
-
trigger: "Arbitration paused (bPaused=true) — dispute will fail with E_PAUSED",
|
|
64
|
-
check: (ctx) => {
|
|
65
|
-
if (ctx.dispute && ctx.current_bPaused === true) {
|
|
66
|
-
return {
|
|
67
|
-
id: "R-AB-1-03",
|
|
68
|
-
level: "HIGH",
|
|
69
|
-
category: "structural",
|
|
70
|
-
title: "Arbitration paused — cannot file dispute",
|
|
71
|
-
description: "Arbitration.bPaused=true; dispute() will abort with E_PAUSED",
|
|
72
|
-
affected_stakeholders: ["disputant"],
|
|
73
|
-
scenario: "Filing dispute against a paused Arbitration",
|
|
74
|
-
mitigation: "Call pause(false) (requires ARBITRATION_PAUSE=356) to resume",
|
|
75
|
-
evidence: `bPaused=true`,
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
return null;
|
|
79
|
-
},
|
|
80
|
-
};
|
|
81
|
-
const R_AB_1_04 = {
|
|
82
|
-
id: "R-AB-1-04",
|
|
83
|
-
category: "structural",
|
|
84
|
-
trigger: "voting_deadline in the past — vote will be rejected",
|
|
85
|
-
check: (ctx) => {
|
|
86
|
-
const deadline = ctx.confirm?.voting_deadline ?? ctx.voting_deadline_change?.voting_deadline;
|
|
87
|
-
if (deadline !== undefined && deadline !== null && ctx.current_timestamp_ms !== undefined) {
|
|
88
|
-
if (deadline < ctx.current_timestamp_ms) {
|
|
89
|
-
return {
|
|
90
|
-
id: "R-AB-1-04",
|
|
91
|
-
level: "HIGH",
|
|
92
|
-
category: "structural",
|
|
93
|
-
title: "voting_deadline in the past",
|
|
94
|
-
description: `Deadline ${deadline} is before current time ${ctx.current_timestamp_ms}`,
|
|
95
|
-
affected_stakeholders: ["voter", "arbiter"],
|
|
96
|
-
scenario: "Setting voting deadline to an already-elapsed timestamp",
|
|
97
|
-
mitigation: "Use a future timestamp (e.g. now + 7 days in ms)",
|
|
98
|
-
evidence: `deadline=${deadline}, now=${ctx.current_timestamp_ms}`,
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
return null;
|
|
103
|
-
},
|
|
104
|
-
};
|
|
105
|
-
const R_AB_2_01 = {
|
|
106
|
-
id: "R-AB-2-01",
|
|
107
|
-
category: "semantic",
|
|
108
|
-
trigger: "voting_guard misconfiguration — dispute cannot be resolved",
|
|
109
|
-
check: (ctx) => {
|
|
110
|
-
if (ctx.vote && ctx.vote.voting_guard) {
|
|
111
|
-
if (!ctx.current_voting_guard_addresses || ctx.current_voting_guard_addresses.length === 0) {
|
|
112
|
-
return {
|
|
113
|
-
id: "R-AB-2-01",
|
|
114
|
-
level: "HIGH",
|
|
115
|
-
category: "semantic",
|
|
116
|
-
title: "voting_guard misconfiguration — dispute cannot be resolved",
|
|
117
|
-
description: "vote.voting_guard provided but Arbitration.voting_guard is empty; E_VOTING_GUARD_NOT_FOUND will abort",
|
|
118
|
-
affected_stakeholders: ["voter", "arbiter", "disputant"],
|
|
119
|
-
scenario: "voting_guard misconfiguration prevents vote — dispute stuck",
|
|
120
|
-
mitigation: "Either add the Guard to voting_guard list (354) or use open vote() without voting_guard",
|
|
121
|
-
evidence: `vote.voting_guard=${ctx.vote.voting_guard}`,
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
if (!ctx.current_voting_guard_addresses.includes(ctx.vote.voting_guard)) {
|
|
125
|
-
return {
|
|
126
|
-
id: "R-AB-2-01",
|
|
127
|
-
level: "HIGH",
|
|
128
|
-
category: "semantic",
|
|
129
|
-
title: "voting_guard misconfiguration — dispute cannot be resolved",
|
|
130
|
-
description: `vote.voting_guard ${ctx.vote.voting_guard} not in Arbitration.voting_guard list`,
|
|
131
|
-
affected_stakeholders: ["voter", "arbiter", "disputant"],
|
|
132
|
-
scenario: "Voter's Guard not registered — vote will fail with E_VOTING_GUARD_NOT_FOUND",
|
|
133
|
-
mitigation: `Add guard ${ctx.vote.voting_guard} via voting_guard_add (354), or use a registered guard`,
|
|
134
|
-
evidence: `provided=${ctx.vote.voting_guard}, registered=${ctx.current_voting_guard_addresses.join(",")}`,
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
return null;
|
|
139
|
-
},
|
|
140
|
-
};
|
|
141
|
-
const R_AB_2_03 = {
|
|
142
|
-
id: "R-AB-2-03",
|
|
143
|
-
category: "semantic",
|
|
144
|
-
trigger: "VoteValue.GuardIdentifier with non-numeric Guard submission type",
|
|
145
|
-
check: (ctx) => {
|
|
146
|
-
if (ctx.voting_guard && (ctx.voting_guard.op === "add" || ctx.voting_guard.op === "set")) {
|
|
147
|
-
for (const g of ctx.voting_guard.guards) {
|
|
148
|
-
const vw = g.vote_weight;
|
|
149
|
-
if ("GuardIdentifier" in vw && vw.GuardIdentifier !== undefined) {
|
|
150
|
-
if (vw.GuardIdentifier > 255) {
|
|
151
|
-
return {
|
|
152
|
-
id: "R-AB-2-03",
|
|
153
|
-
level: "HIGH",
|
|
154
|
-
category: "semantic",
|
|
155
|
-
title: "GuardIdentifier index > u8::max (255)",
|
|
156
|
-
description: `GuardIdentifier ${vw.GuardIdentifier} exceeds u8 max (255)`,
|
|
157
|
-
affected_stakeholders: ["owner"],
|
|
158
|
-
scenario: "Setting GuardIdentifier index beyond u8 range",
|
|
159
|
-
mitigation: "Use GuardIdentifier index 0-255",
|
|
160
|
-
evidence: `identifier=${vw.GuardIdentifier}`,
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
if ("FixedValue" in vw && vw.FixedValue !== undefined) {
|
|
165
|
-
if (vw.FixedValue > 4294967295) {
|
|
166
|
-
return {
|
|
167
|
-
id: "R-AB-2-03",
|
|
168
|
-
level: "HIGH",
|
|
169
|
-
category: "semantic",
|
|
170
|
-
title: "FixedValue > u32::max (4294967295)",
|
|
171
|
-
description: `FixedValue ${vw.FixedValue} exceeds u32 max`,
|
|
172
|
-
affected_stakeholders: ["owner"],
|
|
173
|
-
scenario: "Setting FixedValue beyond u32 range",
|
|
174
|
-
mitigation: "Use FixedValue 0-4294967295",
|
|
175
|
-
evidence: `fixed=${vw.FixedValue}`,
|
|
176
|
-
};
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
return null;
|
|
182
|
-
},
|
|
183
|
-
};
|
|
184
|
-
const R_AB_3_01 = {
|
|
185
|
-
id: "R-AB-3-01",
|
|
186
|
-
category: "authority",
|
|
187
|
-
trigger: "Arbiter collusion — single voter controls >50% of total weight",
|
|
188
|
-
check: (ctx) => {
|
|
189
|
-
if (!ctx.voting_guard || ctx.voting_guard.op !== "add" && ctx.voting_guard.op !== "set")
|
|
190
|
-
return null;
|
|
191
|
-
const guards = ctx.voting_guard.guards;
|
|
192
|
-
if (guards.length < 2)
|
|
193
|
-
return null;
|
|
194
|
-
const fixedWeights = guards
|
|
195
|
-
.filter(g => "FixedValue" in g.vote_weight && g.vote_weight.FixedValue !== undefined)
|
|
196
|
-
.map(g => g.vote_weight.FixedValue);
|
|
197
|
-
if (fixedWeights.length === 0)
|
|
198
|
-
return null;
|
|
199
|
-
const total = fixedWeights.reduce((a, b) => a + b, 0);
|
|
200
|
-
const max = Math.max(...fixedWeights);
|
|
201
|
-
if (total > 0 && max / total > 0.5) {
|
|
202
|
-
return {
|
|
203
|
-
id: "R-AB-3-01",
|
|
204
|
-
level: "MEDIUM",
|
|
205
|
-
category: "authority",
|
|
206
|
-
title: "Arbiter collusion risk — single guard controls >50% weight",
|
|
207
|
-
description: `One voting_guard has ${max} of ${total} total weight (${((max / total) * 100).toFixed(1)}%)`,
|
|
208
|
-
affected_stakeholders: ["owner", "disputant"],
|
|
209
|
-
scenario: "Weighted voting with dominant arbiter — can single-handedly decide rulings",
|
|
210
|
-
mitigation: "Distribute weight more evenly, or require multi-arbiter consensus",
|
|
211
|
-
evidence: `max=${max}, total=${total}, ratio=${((max / total) * 100).toFixed(1)}%`,
|
|
212
|
-
};
|
|
213
|
-
}
|
|
214
|
-
return null;
|
|
215
|
-
},
|
|
216
|
-
};
|
|
217
|
-
const R_AB_3_02 = {
|
|
218
|
-
id: "R-AB-3-02",
|
|
219
|
-
category: "authority",
|
|
220
|
-
trigger: "Permission over-concentration — single admin (owner)",
|
|
221
|
-
check: (ctx) => {
|
|
222
|
-
if (ctx.builder) {
|
|
223
|
-
return {
|
|
224
|
-
id: "R-AB-3-02",
|
|
225
|
-
level: "HIGH",
|
|
226
|
-
category: "authority",
|
|
227
|
-
title: "Arbitration ownership transfer — IRREVERSIBLE",
|
|
228
|
-
description: `Transferring Arbitration to ${ctx.builder}; original owner loses all control permanently`,
|
|
229
|
-
affected_stakeholders: ["owner"],
|
|
230
|
-
scenario: "Transferring Arbitration ownership",
|
|
231
|
-
mitigation: "1) Verify new owner twice. 2) Confirm new owner has 350-368 permissions configured. 3) Coordinate before transfer.",
|
|
232
|
-
evidence: `new_owner=${ctx.builder}`,
|
|
233
|
-
};
|
|
234
|
-
}
|
|
235
|
-
return null;
|
|
236
|
-
},
|
|
237
|
-
};
|
|
238
|
-
const R_AB_3_03 = {
|
|
239
|
-
id: "R-AB-3-03",
|
|
240
|
-
category: "authority",
|
|
241
|
-
trigger: "ARBITRATION_ARBITRATION (359) granted to wide audience",
|
|
242
|
-
check: (ctx) => {
|
|
243
|
-
if (ctx.arbitration && !ctx.current_voting_guard_addresses?.length) {
|
|
244
|
-
return {
|
|
245
|
-
id: "R-AB-3-03",
|
|
246
|
-
level: "MEDIUM",
|
|
247
|
-
category: "authority",
|
|
248
|
-
title: "Ruling without voting_guard — single-arbiter can rule unchallenged",
|
|
249
|
-
description: "make_ruling (359) without voting_guard means any permission holder can unilaterally decide",
|
|
250
|
-
affected_stakeholders: ["disputant", "voter"],
|
|
251
|
-
scenario: "Single-arbiter Arbitration without consensus check",
|
|
252
|
-
mitigation: "Configure voting_guard (354) to require multi-arbiter consensus before ruling",
|
|
253
|
-
evidence: `voting_guard=empty`,
|
|
254
|
-
};
|
|
255
|
-
}
|
|
256
|
-
return null;
|
|
257
|
-
},
|
|
258
|
-
};
|
|
259
|
-
const R_AB_4_01 = {
|
|
260
|
-
id: "R-AB-4-01",
|
|
261
|
-
category: "lifecycle",
|
|
262
|
-
trigger: "Invalid Arb status transition (7-state flow violation)",
|
|
263
|
-
check: (ctx) => {
|
|
264
|
-
if (!ctx.current_arb_status || !ctx.expected_arb_status)
|
|
265
|
-
return null;
|
|
266
|
-
if (ctx.current_arb_status === ctx.expected_arb_status)
|
|
267
|
-
return null;
|
|
268
|
-
if (!isValidArbStatusTransition(ctx.current_arb_status, ctx.expected_arb_status)) {
|
|
269
|
-
return {
|
|
270
|
-
id: "R-AB-4-01",
|
|
271
|
-
level: "CRITICAL",
|
|
272
|
-
category: "lifecycle",
|
|
273
|
-
title: "Invalid Arb status transition",
|
|
274
|
-
description: `${ctx.current_arb_status} → ${ctx.expected_arb_status} is not a valid 7-state flow transition`,
|
|
275
|
-
affected_stakeholders: ["arbiter", "disputant"],
|
|
276
|
-
scenario: "Attempting operation out of order (e.g. vote before confirm)",
|
|
277
|
-
mitigation: "Follow the 7-state flow: Principal_confirming → Arbitrator_confirming → Voting → Arbitrated → Objectionable → Finished/Withdrawn",
|
|
278
|
-
evidence: `${ctx.current_arb_status} → ${ctx.expected_arb_status}`,
|
|
279
|
-
};
|
|
280
|
-
}
|
|
281
|
-
return null;
|
|
282
|
-
},
|
|
283
|
-
};
|
|
284
|
-
const R_AB_4_02 = {
|
|
285
|
-
id: "R-AB-4-02",
|
|
286
|
-
category: "lifecycle",
|
|
287
|
-
trigger: "Operation on terminal Arb status (Finished/Withdrawn)",
|
|
288
|
-
check: (ctx) => {
|
|
289
|
-
if (!ctx.current_arb_status)
|
|
290
|
-
return null;
|
|
291
|
-
if (isTerminalArbStatus(ctx.current_arb_status)) {
|
|
292
|
-
const allowedOpOnTerminal = ctx.arb_withdraw;
|
|
293
|
-
if (!allowedOpOnTerminal && (ctx.vote || ctx.confirm || ctx.arbitration || ctx.reset || ctx.feedback)) {
|
|
294
|
-
return {
|
|
295
|
-
id: "R-AB-4-02",
|
|
296
|
-
level: "HIGH",
|
|
297
|
-
category: "lifecycle",
|
|
298
|
-
title: "Operation on terminal Arb status — irreversible",
|
|
299
|
-
description: `Arb is in terminal status ${ctx.current_arb_status}; only arb_withdraw is allowed`,
|
|
300
|
-
affected_stakeholders: ["arbiter", "disputant"],
|
|
301
|
-
scenario: "Voting/ruling/reset on a Finished or Withdrawn Arb",
|
|
302
|
-
mitigation: "Open a new Arb case via dispute() if further arbitration is needed",
|
|
303
|
-
evidence: `status=${ctx.current_arb_status}`,
|
|
304
|
-
};
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
return null;
|
|
308
|
-
},
|
|
309
|
-
};
|
|
310
|
-
const R_AB_4_03 = {
|
|
311
|
-
id: "R-AB-4-03",
|
|
312
|
-
category: "lifecycle",
|
|
313
|
-
trigger: "reset operation — may indefinitely extend arbitration",
|
|
314
|
-
check: (ctx) => {
|
|
315
|
-
if (!ctx.reset)
|
|
316
|
-
return null;
|
|
317
|
-
return {
|
|
318
|
-
id: "R-AB-4-03",
|
|
319
|
-
level: "MEDIUM",
|
|
320
|
-
category: "lifecycle",
|
|
321
|
-
title: "reset operation — arbitration lifecycle extended",
|
|
322
|
-
description: `reset on Arb ${ctx.reset.arb} restarts lifecycle to Principal_confirming; feedback required`,
|
|
323
|
-
affected_stakeholders: ["arbiter", "disputant"],
|
|
324
|
-
scenario: "Disputant objects to ruling and resubmits materials",
|
|
325
|
-
mitigation: "Track reset count — consider capping resets to prevent abuse",
|
|
326
|
-
evidence: `arb=${ctx.reset.arb}`,
|
|
327
|
-
};
|
|
328
|
-
},
|
|
329
|
-
};
|
|
330
|
-
const R_AB_5_01 = {
|
|
331
|
-
id: "R-AB-5-01",
|
|
332
|
-
category: "cross_object",
|
|
333
|
-
trigger: "fees_alloc/fees_transfer unfair distribution — destination not verified",
|
|
334
|
-
check: (ctx) => {
|
|
335
|
-
if (!ctx.fees_transfer)
|
|
336
|
-
return null;
|
|
337
|
-
const dest = "allocation" in ctx.fees_transfer.to
|
|
338
|
-
? `Allocation ${ctx.fees_transfer.to.allocation}`
|
|
339
|
-
: `Treasury ${ctx.fees_transfer.to.treasury}`;
|
|
340
|
-
return {
|
|
341
|
-
id: "R-AB-5-01",
|
|
342
|
-
level: "MEDIUM",
|
|
343
|
-
category: "cross_object",
|
|
344
|
-
title: "fees_alloc/fees_transfer — verify destination fairness",
|
|
345
|
-
description: `All Arbitration.balance will be transferred to ${dest}; ensure destination policy is fair to arbiters`,
|
|
346
|
-
affected_stakeholders: ["arbiter", "owner"],
|
|
347
|
-
scenario: "Distributing arbitration fees without verifying allocation rules",
|
|
348
|
-
mitigation: `Verify ${dest} has fair distribution policy; consider allocating to arbiters' Allocation`,
|
|
349
|
-
evidence: `dest=${dest}, remark=${ctx.fees_transfer.payment_remark}`,
|
|
350
|
-
};
|
|
351
|
-
},
|
|
352
|
-
};
|
|
353
|
-
const R_AB_5_02 = {
|
|
354
|
-
id: "R-AB-5-02",
|
|
355
|
-
category: "cross_object",
|
|
356
|
-
trigger: "Dispute filed but Order op permission not verified — E_OP_PERMISSION",
|
|
357
|
-
check: (ctx) => {
|
|
358
|
-
if (!ctx.dispute)
|
|
359
|
-
return null;
|
|
360
|
-
return {
|
|
361
|
-
id: "R-AB-5-02",
|
|
362
|
-
level: "HIGH",
|
|
363
|
-
category: "cross_object",
|
|
364
|
-
title: "Order op permission required for dispute",
|
|
365
|
-
description: `dispute on Order ${ctx.dispute.order} requires order::assert_op_permission; signer must have Order's dispute permission`,
|
|
366
|
-
affected_stakeholders: ["disputant"],
|
|
367
|
-
scenario: "Filing dispute without Order op permission",
|
|
368
|
-
mitigation: "Ensure signer has Order's dispute operation permission (custom index or builtin)",
|
|
369
|
-
evidence: `order=${ctx.dispute.order}`,
|
|
370
|
-
};
|
|
371
|
-
},
|
|
372
|
-
};
|
|
373
|
-
const ALL_RULES = [
|
|
374
|
-
R_AB_1_01, R_AB_1_02, R_AB_1_03, R_AB_1_04,
|
|
375
|
-
R_AB_2_01, R_AB_2_03,
|
|
376
|
-
R_AB_3_01, R_AB_3_02, R_AB_3_03,
|
|
377
|
-
R_AB_4_01, R_AB_4_02, R_AB_4_03,
|
|
378
|
-
R_AB_5_01, R_AB_5_02,
|
|
379
|
-
];
|
|
380
|
-
export const ARBITRATION_RISK_VERSION = "1.0.0";
|
|
381
|
-
export function getAllRiskRules() {
|
|
382
|
-
return [...ALL_RULES];
|
|
383
|
-
}
|
|
384
|
-
export function getRiskRulesCount() {
|
|
385
|
-
return ALL_RULES.length;
|
|
386
|
-
}
|
|
387
|
-
export function getRiskRulesByCategory(category) {
|
|
388
|
-
return ALL_RULES.filter(r => r.category === category);
|
|
389
|
-
}
|
|
390
|
-
export function assessArbitrationRisks(ctx) {
|
|
391
|
-
const risks = [];
|
|
392
|
-
for (const rule of ALL_RULES) {
|
|
393
|
-
const r = rule.check(ctx);
|
|
394
|
-
if (r)
|
|
395
|
-
risks.push(r);
|
|
396
|
-
}
|
|
397
|
-
const overall = risks.length === 0
|
|
398
|
-
? "LOW"
|
|
399
|
-
: risks.some(r => r.level === "CRITICAL") ? "CRITICAL"
|
|
400
|
-
: risks.some(r => r.level === "HIGH") ? "HIGH"
|
|
401
|
-
: risks.some(r => r.level === "MEDIUM") ? "MEDIUM"
|
|
402
|
-
: "LOW";
|
|
403
|
-
const byCategory = {};
|
|
404
|
-
for (const r of risks) {
|
|
405
|
-
byCategory[r.category] = (byCategory[r.category] ?? 0) + 1;
|
|
406
|
-
}
|
|
407
|
-
const advice = {};
|
|
408
|
-
for (const r of risks) {
|
|
409
|
-
for (const s of r.affected_stakeholders) {
|
|
410
|
-
if (!advice[s])
|
|
411
|
-
advice[s] = [];
|
|
412
|
-
advice[s].push(`${r.id}: ${r.mitigation}`);
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
return {
|
|
416
|
-
summary: `Assessed ${risks.length} risk(s) across ${Object.keys(byCategory).length} categories`,
|
|
417
|
-
risks,
|
|
418
|
-
overall_risk: overall,
|
|
419
|
-
risks_by_category: byCategory,
|
|
420
|
-
stakeholder_advice: advice,
|
|
421
|
-
needs_human_review: risks.some(r => r.level === "CRITICAL" || r.level === "HIGH"),
|
|
422
|
-
};
|
|
423
|
-
}
|
|
1
|
+
import{MAX_VOTING_GUARD_COUNT}from'@wowok/wowok';import{isTerminalArbStatus,isValidArbStatusTransition}from'./arbitration-ledger.js';const R_AB_1_01={'id':'R-AB-1-01','category':'structural','trigger':'voting_guard\x20count\x20exceeds\x20MAX_VOTING_GUARD_COUNT\x20(50)','check':a=>{if(!a['voting_guard'])return null;if(a['voting_guard']['op']==='add'||a['voting_guard']['op']==='set'){const b=a['voting_guard']['op']==='set'?a['voting_guard']['guards']['length']:(a['current_voting_guard_count']??0x0)+a['voting_guard']['guards']['length'];if(b>MAX_VOTING_GUARD_COUNT)return{'id':'R-AB-1-01','level':'HIGH','category':'structural','title':'voting_guard\x20count\x20exceeds\x20limit','description':'voting_guard\x20would\x20have\x20'+b+'\x20entries,\x20exceeds\x20MAX_VOTING_GUARD_COUNT\x20'+MAX_VOTING_GUARD_COUNT,'affected_stakeholders':['owner','arbiter'],'scenario':'Adding\x20too\x20many\x20voting\x20guards','mitigation':'Remove\x20unused\x20guards\x20before\x20adding\x20new\x20ones;\x20max\x20'+MAX_VOTING_GUARD_COUNT,'evidence':'count='+b};}return null;}},R_AB_1_02={'id':'R-AB-1-02','category':'structural','trigger':'Dispute\x20fee\x20below\x20arbitration.fee\x20threshold','check':a=>{if(!a['dispute']||a['current_arbitration_fee']===undefined)return null;const b=typeof a['current_arbitration_fee']==='string'?BigInt(a['current_arbitration_fee']):BigInt(a['current_arbitration_fee']),c=typeof a['dispute']['fee']==='object'&&a['dispute']['fee']!==null&&'balance'in a['dispute']['fee']?BigInt(a['dispute']['fee']['balance']??0x0):BigInt(0x0);if(c<b)return{'id':'R-AB-1-02','level':'CRITICAL','category':'structural','title':'Dispute\x20fee\x20insufficient\x20(E_FEE_NOT_ENOUGH)','description':'Provided\x20fee\x20'+c['toString']()+'\x20<\x20required\x20'+b['toString'](),'affected_stakeholders':['disputant'],'scenario':'Filing\x20dispute\x20with\x20insufficient\x20fee','mitigation':'Increase\x20dispute.fee.balance\x20to\x20>=\x20'+b['toString'](),'evidence':'provided='+c['toString']()+',\x20required='+b['toString']()};return null;}},R_AB_1_03={'id':'R-AB-1-03','category':'structural','trigger':'Arbitration\x20paused\x20(bPaused=true)\x20—\x20dispute\x20will\x20fail\x20with\x20E_PAUSED','check':a=>{if(a['dispute']&&a['current_bPaused']===!![])return{'id':'R-AB-1-03','level':'HIGH','category':'structural','title':'Arbitration\x20paused\x20—\x20cannot\x20file\x20dispute','description':'Arbitration.bPaused=true;\x20dispute()\x20will\x20abort\x20with\x20E_PAUSED','affected_stakeholders':['disputant'],'scenario':'Filing\x20dispute\x20against\x20a\x20paused\x20Arbitration','mitigation':'Call\x20pause(false)\x20(requires\x20ARBITRATION_PAUSE=356)\x20to\x20resume','evidence':'bPaused=true'};return null;}},R_AB_1_04={'id':'R-AB-1-04','category':'structural','trigger':'voting_deadline\x20in\x20the\x20past\x20—\x20vote\x20will\x20be\x20rejected','check':a=>{const b=a['confirm']?.['voting_deadline']??a['voting_deadline_change']?.['voting_deadline'];if(b!==undefined&&b!==null&&a['current_timestamp_ms']!==undefined){if(b<a['current_timestamp_ms'])return{'id':'R-AB-1-04','level':'HIGH','category':'structural','title':'voting_deadline\x20in\x20the\x20past','description':'Deadline\x20'+b+'\x20is\x20before\x20current\x20time\x20'+a['current_timestamp_ms'],'affected_stakeholders':['voter','arbiter'],'scenario':'Setting\x20voting\x20deadline\x20to\x20an\x20already-elapsed\x20timestamp','mitigation':'Use\x20a\x20future\x20timestamp\x20(e.g.\x20now\x20+\x207\x20days\x20in\x20ms)','evidence':'deadline='+b+',\x20now='+a['current_timestamp_ms']};}return null;}},R_AB_2_01={'id':'R-AB-2-01','category':'semantic','trigger':'voting_guard\x20misconfiguration\x20—\x20dispute\x20cannot\x20be\x20resolved','check':a=>{if(a['vote']&&a['vote']['voting_guard']){if(!a['current_voting_guard_addresses']||a['current_voting_guard_addresses']['length']===0x0)return{'id':'R-AB-2-01','level':'HIGH','category':'semantic','title':'voting_guard\x20misconfiguration\x20—\x20dispute\x20cannot\x20be\x20resolved','description':'vote.voting_guard\x20provided\x20but\x20Arbitration.voting_guard\x20is\x20empty;\x20E_VOTING_GUARD_NOT_FOUND\x20will\x20abort','affected_stakeholders':['voter','arbiter','disputant'],'scenario':'voting_guard\x20misconfiguration\x20prevents\x20vote\x20—\x20dispute\x20stuck','mitigation':'Either\x20add\x20the\x20Guard\x20to\x20voting_guard\x20list\x20(354)\x20or\x20use\x20open\x20vote()\x20without\x20voting_guard','evidence':'vote.voting_guard='+a['vote']['voting_guard']};if(!a['current_voting_guard_addresses']['includes'](a['vote']['voting_guard']))return{'id':'R-AB-2-01','level':'HIGH','category':'semantic','title':'voting_guard\x20misconfiguration\x20—\x20dispute\x20cannot\x20be\x20resolved','description':'vote.voting_guard\x20'+a['vote']['voting_guard']+'\x20not\x20in\x20Arbitration.voting_guard\x20list','affected_stakeholders':['voter','arbiter','disputant'],'scenario':'Voter\x27s\x20Guard\x20not\x20registered\x20—\x20vote\x20will\x20fail\x20with\x20E_VOTING_GUARD_NOT_FOUND','mitigation':'Add\x20guard\x20'+a['vote']['voting_guard']+'\x20via\x20voting_guard_add\x20(354),\x20or\x20use\x20a\x20registered\x20guard','evidence':'provided='+a['vote']['voting_guard']+',\x20registered='+a['current_voting_guard_addresses']['join'](',')};}return null;}},R_AB_2_03={'id':'R-AB-2-03','category':'semantic','trigger':'VoteValue.GuardIdentifier\x20with\x20non-numeric\x20Guard\x20submission\x20type','check':a=>{if(a['voting_guard']&&(a['voting_guard']['op']==='add'||a['voting_guard']['op']==='set'))for(const b of a['voting_guard']['guards']){const c=b['vote_weight'];if('GuardIdentifier'in c&&c['GuardIdentifier']!==undefined){if(c['GuardIdentifier']>0xff)return{'id':'R-AB-2-03','level':'HIGH','category':'semantic','title':'GuardIdentifier\x20index\x20>\x20u8::max\x20(255)','description':'GuardIdentifier\x20'+c['GuardIdentifier']+'\x20exceeds\x20u8\x20max\x20(255)','affected_stakeholders':['owner'],'scenario':'Setting\x20GuardIdentifier\x20index\x20beyond\x20u8\x20range','mitigation':'Use\x20GuardIdentifier\x20index\x200-255','evidence':'identifier='+c['GuardIdentifier']};}if('FixedValue'in c&&c['FixedValue']!==undefined){if(c['FixedValue']>0xffffffff)return{'id':'R-AB-2-03','level':'HIGH','category':'semantic','title':'FixedValue\x20>\x20u32::max\x20(4294967295)','description':'FixedValue\x20'+c['FixedValue']+'\x20exceeds\x20u32\x20max','affected_stakeholders':['owner'],'scenario':'Setting\x20FixedValue\x20beyond\x20u32\x20range','mitigation':'Use\x20FixedValue\x200-4294967295','evidence':'fixed='+c['FixedValue']};}}return null;}},R_AB_3_01={'id':'R-AB-3-01','category':'authority','trigger':'Arbiter\x20collusion\x20—\x20single\x20voter\x20controls\x20>50%\x20of\x20total\x20weight','check':a=>{if(!a['voting_guard']||a['voting_guard']['op']!=='add'&&a['voting_guard']['op']!=='set')return null;const b=a['voting_guard']['guards'];if(b['length']<0x2)return null;const c=b['filter'](f=>'FixedValue'in f['vote_weight']&&f['vote_weight']['FixedValue']!==undefined)['map'](f=>f['vote_weight']['FixedValue']);if(c['length']===0x0)return null;const d=c['reduce']((f,g)=>f+g,0x0),e=Math['max'](...c);if(d>0x0&&e/d>0.5)return{'id':'R-AB-3-01','level':'MEDIUM','category':'authority','title':'Arbiter\x20collusion\x20risk\x20—\x20single\x20guard\x20controls\x20>50%\x20weight','description':'One\x20voting_guard\x20has\x20'+e+'\x20of\x20'+d+'\x20total\x20weight\x20('+(e/d*0x64)['toFixed'](0x1)+'%)','affected_stakeholders':['owner','disputant'],'scenario':'Weighted\x20voting\x20with\x20dominant\x20arbiter\x20—\x20can\x20single-handedly\x20decide\x20rulings','mitigation':'Distribute\x20weight\x20more\x20evenly,\x20or\x20require\x20multi-arbiter\x20consensus','evidence':'max='+e+',\x20total='+d+',\x20ratio='+(e/d*0x64)['toFixed'](0x1)+'%'};return null;}},R_AB_3_02={'id':'R-AB-3-02','category':'authority','trigger':'Permission\x20over-concentration\x20—\x20single\x20admin\x20(owner)','check':a=>{if(a['builder'])return{'id':'R-AB-3-02','level':'HIGH','category':'authority','title':'Arbitration\x20ownership\x20transfer\x20—\x20IRREVERSIBLE','description':'Transferring\x20Arbitration\x20to\x20'+a['builder']+';\x20original\x20owner\x20loses\x20all\x20control\x20permanently','affected_stakeholders':['owner'],'scenario':'Transferring\x20Arbitration\x20ownership','mitigation':'1)\x20Verify\x20new\x20owner\x20twice.\x202)\x20Confirm\x20new\x20owner\x20has\x20350-368\x20permissions\x20configured.\x203)\x20Coordinate\x20before\x20transfer.','evidence':'new_owner='+a['builder']};return null;}},R_AB_3_03={'id':'R-AB-3-03','category':'authority','trigger':'ARBITRATION_ARBITRATION\x20(359)\x20granted\x20to\x20wide\x20audience','check':a=>{if(a['arbitration']&&!a['current_voting_guard_addresses']?.['length'])return{'id':'R-AB-3-03','level':'MEDIUM','category':'authority','title':'Ruling\x20without\x20voting_guard\x20—\x20single-arbiter\x20can\x20rule\x20unchallenged','description':'make_ruling\x20(359)\x20without\x20voting_guard\x20means\x20any\x20permission\x20holder\x20can\x20unilaterally\x20decide','affected_stakeholders':['disputant','voter'],'scenario':'Single-arbiter\x20Arbitration\x20without\x20consensus\x20check','mitigation':'Configure\x20voting_guard\x20(354)\x20to\x20require\x20multi-arbiter\x20consensus\x20before\x20ruling','evidence':'voting_guard=empty'};return null;}},R_AB_4_01={'id':'R-AB-4-01','category':'lifecycle','trigger':'Invalid\x20Arb\x20status\x20transition\x20(7-state\x20flow\x20violation)','check':a=>{if(!a['current_arb_status']||!a['expected_arb_status'])return null;if(a['current_arb_status']===a['expected_arb_status'])return null;if(!isValidArbStatusTransition(a['current_arb_status'],a['expected_arb_status']))return{'id':'R-AB-4-01','level':'CRITICAL','category':'lifecycle','title':'Invalid\x20Arb\x20status\x20transition','description':a['current_arb_status']+'\x20→\x20'+a['expected_arb_status']+'\x20is\x20not\x20a\x20valid\x207-state\x20flow\x20transition','affected_stakeholders':['arbiter','disputant'],'scenario':'Attempting\x20operation\x20out\x20of\x20order\x20(e.g.\x20vote\x20before\x20confirm)','mitigation':'Follow\x20the\x207-state\x20flow:\x20Principal_confirming\x20→\x20Arbitrator_confirming\x20→\x20Voting\x20→\x20Arbitrated\x20→\x20Objectionable\x20→\x20Finished/Withdrawn','evidence':a['current_arb_status']+'\x20→\x20'+a['expected_arb_status']};return null;}},R_AB_4_02={'id':'R-AB-4-02','category':'lifecycle','trigger':'Operation\x20on\x20terminal\x20Arb\x20status\x20(Finished/Withdrawn)','check':a=>{if(!a['current_arb_status'])return null;if(isTerminalArbStatus(a['current_arb_status'])){const b=a['arb_withdraw'];if(!b&&(a['vote']||a['confirm']||a['arbitration']||a['reset']||a['feedback']))return{'id':'R-AB-4-02','level':'HIGH','category':'lifecycle','title':'Operation\x20on\x20terminal\x20Arb\x20status\x20—\x20irreversible','description':'Arb\x20is\x20in\x20terminal\x20status\x20'+a['current_arb_status']+';\x20only\x20arb_withdraw\x20is\x20allowed','affected_stakeholders':['arbiter','disputant'],'scenario':'Voting/ruling/reset\x20on\x20a\x20Finished\x20or\x20Withdrawn\x20Arb','mitigation':'Open\x20a\x20new\x20Arb\x20case\x20via\x20dispute()\x20if\x20further\x20arbitration\x20is\x20needed','evidence':'status='+a['current_arb_status']};}return null;}},R_AB_4_03={'id':'R-AB-4-03','category':'lifecycle','trigger':'reset\x20operation\x20—\x20may\x20indefinitely\x20extend\x20arbitration','check':a=>{if(!a['reset'])return null;return{'id':'R-AB-4-03','level':'MEDIUM','category':'lifecycle','title':'reset\x20operation\x20—\x20arbitration\x20lifecycle\x20extended','description':'reset\x20on\x20Arb\x20'+a['reset']['arb']+'\x20restarts\x20lifecycle\x20to\x20Principal_confirming;\x20feedback\x20required','affected_stakeholders':['arbiter','disputant'],'scenario':'Disputant\x20objects\x20to\x20ruling\x20and\x20resubmits\x20materials','mitigation':'Track\x20reset\x20count\x20—\x20consider\x20capping\x20resets\x20to\x20prevent\x20abuse','evidence':'arb='+a['reset']['arb']};}},R_AB_5_01={'id':'R-AB-5-01','category':'cross_object','trigger':'fees_alloc/fees_transfer\x20unfair\x20distribution\x20—\x20destination\x20not\x20verified','check':a=>{if(!a['fees_transfer'])return null;const b='allocation'in a['fees_transfer']['to']?'Allocation\x20'+a['fees_transfer']['to']['allocation']:'Treasury\x20'+a['fees_transfer']['to']['treasury'];return{'id':'R-AB-5-01','level':'MEDIUM','category':'cross_object','title':'fees_alloc/fees_transfer\x20—\x20verify\x20destination\x20fairness','description':'All\x20Arbitration.balance\x20will\x20be\x20transferred\x20to\x20'+b+';\x20ensure\x20destination\x20policy\x20is\x20fair\x20to\x20arbiters','affected_stakeholders':['arbiter','owner'],'scenario':'Distributing\x20arbitration\x20fees\x20without\x20verifying\x20allocation\x20rules','mitigation':'Verify\x20'+b+'\x20has\x20fair\x20distribution\x20policy;\x20consider\x20allocating\x20to\x20arbiters\x27\x20Allocation','evidence':'dest='+b+',\x20remark='+a['fees_transfer']['payment_remark']};}},R_AB_5_02={'id':'R-AB-5-02','category':'cross_object','trigger':'Dispute\x20filed\x20but\x20Order\x20op\x20permission\x20not\x20verified\x20—\x20E_OP_PERMISSION','check':a=>{if(!a['dispute'])return null;return{'id':'R-AB-5-02','level':'HIGH','category':'cross_object','title':'Order\x20op\x20permission\x20required\x20for\x20dispute','description':'dispute\x20on\x20Order\x20'+a['dispute']['order']+'\x20requires\x20order::assert_op_permission;\x20signer\x20must\x20have\x20Order\x27s\x20dispute\x20permission','affected_stakeholders':['disputant'],'scenario':'Filing\x20dispute\x20without\x20Order\x20op\x20permission','mitigation':'Ensure\x20signer\x20has\x20Order\x27s\x20dispute\x20operation\x20permission\x20(custom\x20index\x20or\x20builtin)','evidence':'order='+a['dispute']['order']};}},ALL_RULES=[R_AB_1_01,R_AB_1_02,R_AB_1_03,R_AB_1_04,R_AB_2_01,R_AB_2_03,R_AB_3_01,R_AB_3_02,R_AB_3_03,R_AB_4_01,R_AB_4_02,R_AB_4_03,R_AB_5_01,R_AB_5_02];export const ARBITRATION_RISK_VERSION='1.0.0';export function getAllRiskRules(){return[...ALL_RULES];}export function getRiskRulesCount(){return ALL_RULES['length'];}export function getRiskRulesByCategory(a){return ALL_RULES['filter'](b=>b['category']===a);}export function assessArbitrationRisks(a){const b=[];for(const f of ALL_RULES){const g=f['check'](a);if(g)b['push'](g);}const c=b['length']===0x0?'LOW':b['some'](h=>h['level']==='CRITICAL')?'CRITICAL':b['some'](h=>h['level']==='HIGH')?'HIGH':b['some'](h=>h['level']==='MEDIUM')?'MEDIUM':'LOW',d={};for(const h of b){d[h['category']]=(d[h['category']]??0x0)+0x1;}const e={};for(const i of b){for(const j of i['affected_stakeholders']){if(!e[j])e[j]=[];e[j]['push'](i['id']+':\x20'+i['mitigation']);}}return{'summary':'Assessed\x20'+b['length']+'\x20risk(s)\x20across\x20'+Object['keys'](d)['length']+'\x20categories','risks':b,'overall_risk':c,'risks_by_category':d,'stakeholder_advice':e,'needs_human_review':b['some'](k=>k['level']==='CRITICAL'||k['level']==='HIGH')};}
|