@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
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export type AntiCheatSeverity = "high" | "medium" | "low";
|
|
2
|
+
export interface AntiCheatSignal {
|
|
3
|
+
kind: "fake_order" | "fake_review" | "shell_merchant" | "reputation_trade";
|
|
4
|
+
severity: AntiCheatSeverity;
|
|
5
|
+
description: string;
|
|
6
|
+
}
|
|
7
|
+
export interface OrderEvidence {
|
|
8
|
+
id: string;
|
|
9
|
+
buyer: string;
|
|
10
|
+
seller: string;
|
|
11
|
+
amount: number | bigint | string;
|
|
12
|
+
status: string;
|
|
13
|
+
allocation?: string | null;
|
|
14
|
+
}
|
|
15
|
+
export interface ReviewEvidence {
|
|
16
|
+
reviewer: string;
|
|
17
|
+
rating: "like" | "dislike";
|
|
18
|
+
orderRef?: string;
|
|
19
|
+
verified?: boolean;
|
|
20
|
+
timestamp?: number;
|
|
21
|
+
}
|
|
22
|
+
export interface MerchantEvidence {
|
|
23
|
+
service: {
|
|
24
|
+
object: string;
|
|
25
|
+
arbitrations: string[];
|
|
26
|
+
compensation_fund: number | bigint | string;
|
|
27
|
+
machine: string | null;
|
|
28
|
+
bPublished: boolean;
|
|
29
|
+
};
|
|
30
|
+
orders: OrderEvidence[];
|
|
31
|
+
reviews: ReviewEvidence[];
|
|
32
|
+
}
|
|
33
|
+
export declare function detectFakeOrders(orders: OrderEvidence[]): AntiCheatSignal[];
|
|
34
|
+
export declare function detectFakeReviews(reviews: ReviewEvidence[]): AntiCheatSignal[];
|
|
35
|
+
export declare function detectShellMerchant(service: MerchantEvidence["service"]): AntiCheatSignal[];
|
|
36
|
+
export declare function reputationTradeNote(): AntiCheatSignal;
|
|
37
|
+
export declare function assessAntiCheat(evidence: MerchantEvidence): AntiCheatSignal[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function detectFakeOrders(a){const b=[];if(a['length']===0x0)return b;const c=a['filter'](h=>h['buyer']===h['seller']);c['length']>0x0&&b['push']({'kind':'fake_order','severity':'high','description':c['length']+'\x20order(s)\x20with\x20buyer\x20==\x20seller\x20(self-buy-sell)'});const d=new Set(a['map'](h=>h['buyer'])),e=new Set(a['map'](h=>h['seller'])),f=a['filter'](h=>d['has'](h['seller'])&&e['has'](h['buyer']));f['length']>=0x2&&b['push']({'kind':'fake_order','severity':'medium','description':f['length']+'\x20order(s)\x20in\x20a\x20reciprocal\x20buyer/seller\x20loop\x20(possible\x20fund\x20circulation)'});const g=a['filter'](h=>!h['allocation']&&h['status']==='completed');return g['length']>0x0&&b['push']({'kind':'fake_order','severity':'medium','description':g['length']+'\x20completed\x20order(s)\x20without\x20an\x20Allocation\x20(no\x20fund-closure\x20evidence)'}),b;}export function detectFakeReviews(a){const b=[];if(a['length']===0x0)return b;const c=a['filter'](g=>!g['verified']);c['length']>0x0&&c['length']===a['length']&&b['push']({'kind':'fake_review','severity':'high','description':'all\x20'+a['length']+'\x20review(s)\x20are\x20unverified\x20(no\x20completed-order\x20credential)'});const d=new Map();for(const g of a){d['set'](g['reviewer'],(d['get'](g['reviewer'])??0x0)+0x1);}const e=[...d['values']()]['filter'](h=>h>0x1)['length'];e>0x0&&b['push']({'kind':'fake_review','severity':'medium','description':e+'\x20address(es)\x20submitted\x20multiple\x20reviews'});const f=a['filter'](h=>h['timestamp']!=null);if(f['length']>0xa){const h=[...f]['sort']((j,k)=>(j['timestamp']??0x0)-(k['timestamp']??0x0)),i=(h[h['length']-0x1]['timestamp']??0x0)-(h[0x0]['timestamp']??0x0);i>0x0&&i<0x36ee80&&b['push']({'kind':'fake_review','severity':'medium','description':f['length']+'\x20review(s)\x20within\x201\x20hour\x20(concentrated\x20timing)'});}return b;}export function detectShellMerchant(a){const b=[];if(!a['bPublished'])return b;a['arbitrations']['length']===0x0&&b['push']({'kind':'shell_merchant','severity':a['machine']?'low':'medium','description':'published\x20Service\x20has\x20no\x20Arbitration\x20binding\x20(no\x20dispute\x20path)'});const c=toBigInt(a['compensation_fund'])??0x0n;return c>0x0n&&a['arbitrations']['length']===0x0&&b['push']({'kind':'shell_merchant','severity':'high','description':'funded\x20compensation_fund\x20but\x20no\x20Arbitration\x20(compensation\x20cannot\x20be\x20ruled/disbursed)'}),!a['machine']&&b['push']({'kind':'shell_merchant','severity':'low','description':'published\x20Service\x20has\x20no\x20Machine\x20(no\x20workflow)'}),b;}export function reputationTradeNote(){return{'kind':'reputation_trade','severity':'low','description':'reputation\x20aggregates\x20by\x20historical\x20fulfillment\x20and\x20is\x20not\x20transferable\x20with\x20the\x20object\x20—\x20reputation\x20trading\x20is\x20structurally\x20prevented'};}export function assessAntiCheat(a){return[...detectFakeOrders(a['orders']),...detectFakeReviews(a['reviews']),...detectShellMerchant(a['service']),reputationTradeNote()];}function toBigInt(a){if(a===undefined||a===null)return undefined;try{return BigInt(a);}catch{return undefined;}}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export declare const ARB_CONFIRM_VERSION = "1.0.0";
|
|
2
|
+
export type ConfirmSeverity = "block" | "warn" | "info";
|
|
3
|
+
export interface ArbConfirmItem {
|
|
4
|
+
id: string;
|
|
5
|
+
severity: ConfirmSeverity;
|
|
6
|
+
title: string;
|
|
7
|
+
description: string;
|
|
8
|
+
passed: boolean;
|
|
9
|
+
evidence?: string;
|
|
10
|
+
fix_hint?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface ArbOpCheckInput {
|
|
13
|
+
status?: number;
|
|
14
|
+
invalid_transition?: boolean;
|
|
15
|
+
proposition_count?: number;
|
|
16
|
+
votor_count?: number;
|
|
17
|
+
voting_deadline_none?: boolean;
|
|
18
|
+
withdraw_too_early?: boolean;
|
|
19
|
+
order_mismatch?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare function preCheckArbOp(input: ArbOpCheckInput): ArbConfirmItem[];
|
|
22
|
+
export declare function canProceedArbOp(input: ArbOpCheckInput): {
|
|
23
|
+
canProceed: boolean;
|
|
24
|
+
blockers: ArbConfirmItem[];
|
|
25
|
+
warnings: ArbConfirmItem[];
|
|
26
|
+
info: ArbConfirmItem[];
|
|
27
|
+
};
|
|
28
|
+
export declare function formatArbOpSummary(input: ArbOpCheckInput): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{MAX_PROPOSITION_COUNT,MAX_VOTOR_COUNT}from'@wowok/wowok';export const ARB_CONFIRM_VERSION='1.0.0';function checkStatusTransition(a){if(!a['invalid_transition'])return{'id':'C-ARB-01','severity':'info','title':'Status\x20transition\x20is\x20valid','description':'Each\x20Arb\x20op\x20asserts\x20the\x20current\x20status;\x20out-of-order\x20calls\x20abort\x20with\x20E_STATUS_NOT_MATCH\x20(3).','passed':!![],'evidence':a['status']===undefined?'status\x20not\x20provided':'status='+a['status']};return{'id':'C-ARB-01','severity':'block','title':'Invalid\x20state\x20transition\x20—\x20will\x20abort\x20with\x20E_STATUS_NOT_MATCH\x20(3)','description':'Arb\x20is\x20a\x207-state\x20machine\x20(0\x20Principal_confirming\x20→\x20…\x20→\x206\x20Withdrawn).\x20Calling\x20an\x20op\x20out\x20of\x20order\x20leaves\x20the\x20case\x20stuck.','passed':![],'evidence':'invalid_transition=true,\x20status='+(a['status']??'?'),'fix_hint':'Validate\x20current\x20status\x20against\x20the\x20op\x27s\x20expected\x20pre-state\x20before\x20submitting.'};}function checkOrderMatch(a){if(!a['order_mismatch'])return{'id':'C-ARB-02','severity':'info','title':'Order\x20matches\x20arb.order','description':'ops\x20assert\x20self.order\x20==\x20id_address(order),\x20else\x20E_ARB_ORDER_NOT_MATCH\x20(2).','passed':!![],'evidence':'order\x20assumed\x20matching'};return{'id':'C-ARB-02','severity':'block','title':'Order\x20mismatch\x20—\x20aborts\x20with\x20E_ARB_ORDER_NOT_MATCH\x20(2)','description':'The\x20passed\x20Order\x20address\x20must\x20equal\x20the\x20Arb\x27s\x20bound\x20order.','passed':![],'evidence':'order_mismatch=true','fix_hint':'Pass\x20the\x20Order\x20that\x20created\x20this\x20Arb.'};}function checkPropositionCount(a){if(a['proposition_count']===undefined)return{'id':'C-ARB-03','severity':'info','title':'proposition_count\x20≤\x20MAX_PROPOSITION_COUNT\x20('+MAX_PROPOSITION_COUNT+')','description':'proposition_change\x20aborts\x20with\x20E_MAX_PROPOSITION_COUNT\x20(1)\x20above\x20the\x20cap.','passed':!![],'evidence':'not\x20provided'};const b=a['proposition_count']<=MAX_PROPOSITION_COUNT;return{'id':'C-ARB-03','severity':b?'info':'block','title':'proposition_count\x20≤\x20MAX_PROPOSITION_COUNT\x20('+MAX_PROPOSITION_COUNT+')','description':'proposition\x20may\x20hold\x20at\x20most\x20MAX_PROPOSITION_COUNT='+MAX_PROPOSITION_COUNT+'\x20entries.','passed':b,'evidence':'proposition_count='+a['proposition_count']+',\x20limit='+MAX_PROPOSITION_COUNT,'fix_hint':'Trim\x20the\x20proposition\x20list\x20to\x20the\x20voting\x20options.'};}function checkVotorCount(a){if(a['votor_count']===undefined)return{'id':'C-ARB-04','severity':'info','title':'votor_count\x20<\x20MAX_VOTOR_COUNT\x20('+MAX_VOTOR_COUNT+')','description':'vote\x20aborts\x20with\x20E_MAX_VOTOR_COUNT\x20(6)\x20at\x20the\x20boundary.','passed':!![],'evidence':'not\x20provided'};const b=a['votor_count']<MAX_VOTOR_COUNT;return{'id':'C-ARB-04','severity':b?'info':'warn','title':'votor_count\x20<\x20MAX_VOTOR_COUNT\x20('+MAX_VOTOR_COUNT+')','description':'A\x20single\x20Arb\x20may\x20record\x20up\x20to\x20MAX_VOTOR_COUNT='+MAX_VOTOR_COUNT+'\x20voters;\x20large\x20juries\x20inflate\x20tally\x20cost.','passed':b,'evidence':'votor_count='+a['votor_count']+',\x20limit='+MAX_VOTOR_COUNT,'fix_hint':'Self-limit\x20voter\x20count\x20based\x20on\x20the\x20Arbitration\x20rule\x27s\x20quorum.'};}function checkVotingDeadline(a){if(!a['voting_deadline_none'])return{'id':'C-ARB-05','severity':'info','title':'voting_deadline\x20is\x20set\x20(Some)','description':'When\x20Some(t),\x20vote()\x20aborts\x20with\x20E_VOTING_DEADLINE_PASSED\x20(7)\x20if\x20clock\x20>\x20t.','passed':!![],'evidence':'deadline\x20set'};return{'id':'C-ARB-05','severity':'warn','title':'voting_deadline\x20is\x20None\x20—\x20open-ended\x20vote','description':'None\x20means\x20no\x20deadline;\x20the\x20vote\x20can\x20stall\x20indefinitely\x20and\x20E_VOTING_DEADLINE_PASSED\x20never\x20triggers.','passed':![],'evidence':'voting_deadline_none=true','fix_hint':'Set\x20an\x20explicit\x20deadline\x20via\x20arbitrator_confirm\x20unless\x20an\x20open\x20vote\x20is\x20intended.'};}function checkWithdraw(a){if(!a['withdraw_too_early'])return{'id':'C-ARB-06','severity':'info','title':'Withdraw\x20timing\x20is\x20valid','description':'Finished(5)\x20withdraws\x20immediately;\x20Arbitrated(3)/Objectionable(4)\x20wait\x20WITHDRAW_DURATION_TIME\x20(30\x20days).','passed':!![],'evidence':'withdraw\x20timing\x20ok'};return{'id':'C-ARB-06','severity':'warn','title':'Withdraw\x20too\x20early\x20—\x20funds\x20still\x20locked\x20(30-day\x20window)','description':'From\x20Arbitrated/Objectionable,\x20the\x20fee\x20Balance\x20is\x20locked\x20until\x20indemnity.time\x20+\x20WITHDRAW_DURATION_TIME\x20(30\x20days).','passed':![],'evidence':'withdraw_too_early=true','fix_hint':'Drive\x20the\x20case\x20to\x20Finished(5)\x20for\x20immediate\x20withdraw,\x20or\x20wait\x20out\x20the\x20lock.'};}export function preCheckArbOp(a){return[checkStatusTransition(a),checkOrderMatch(a),checkPropositionCount(a),checkVotorCount(a),checkVotingDeadline(a),checkWithdraw(a)];}export function canProceedArbOp(a){const b=preCheckArbOp(a);return{'canProceed':b['every'](c=>c['severity']!=='block'||c['passed']),'blockers':b['filter'](c=>c['severity']==='block'&&!c['passed']),'warnings':b['filter'](c=>c['severity']==='warn'&&!c['passed']),'info':b['filter'](c=>c['severity']==='info')};}export function formatArbOpSummary(a){const {canProceed:b,blockers:c,warnings:d}=canProceedArbOp(a),e=[b?'✓\x20Arb\x20operation\x20pre-check\x20PASSED':'✗\x20Arb\x20operation\x20pre-check\x20FAILED',''];return c['length']>0x0&&(e['push']('BLOCKERS:'),c['forEach'](f=>e['push']('\x20\x20['+f['id']+']\x20'+f['title']+'\x20—\x20'+(f['evidence']??''))),e['push']('')),d['length']>0x0&&(e['push']('WARNINGS:'),d['forEach'](f=>e['push']('\x20\x20['+f['id']+']\x20'+f['title']+'\x20—\x20'+(f['evidence']??'')))),e['join']('\x0a');}
|
|
@@ -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'];}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export declare const ARB_TRANSLATION_VERSION = "1.0.0";
|
|
2
|
+
export declare const ARB_STATUS: {
|
|
3
|
+
readonly PRINCIPAL_CONFIRMING: 0;
|
|
4
|
+
readonly ARBITRATOR_CONFIRMING: 1;
|
|
5
|
+
readonly VOTING: 2;
|
|
6
|
+
readonly ARBITRATED: 3;
|
|
7
|
+
readonly OBJECTIONABLE: 4;
|
|
8
|
+
readonly FINISHED: 5;
|
|
9
|
+
readonly WITHDRAWN: 6;
|
|
10
|
+
};
|
|
11
|
+
export interface SemanticToArbSchemaRule {
|
|
12
|
+
id: string;
|
|
13
|
+
pattern_name: string;
|
|
14
|
+
semantic_intent: string;
|
|
15
|
+
match_keywords: string[];
|
|
16
|
+
required_fields: string[];
|
|
17
|
+
optional_fields: string[];
|
|
18
|
+
example: Record<string, unknown>;
|
|
19
|
+
}
|
|
20
|
+
export declare const SEMANTIC_TO_ARB_SCHEMA_RULES: SemanticToArbSchemaRule[];
|
|
21
|
+
export interface ArbFieldTranslation {
|
|
22
|
+
field_name: string;
|
|
23
|
+
value_type: string;
|
|
24
|
+
semantic: string;
|
|
25
|
+
format_example: string;
|
|
26
|
+
validation_rules: string[];
|
|
27
|
+
}
|
|
28
|
+
export declare const ARB_FIELD_TRANSLATIONS: ArbFieldTranslation[];
|
|
29
|
+
export interface ArbConstraintRule {
|
|
30
|
+
id: string;
|
|
31
|
+
name: string;
|
|
32
|
+
description: string;
|
|
33
|
+
related_field: string;
|
|
34
|
+
}
|
|
35
|
+
export declare const ARB_CONSTRAINT_RULES: ArbConstraintRule[];
|
|
36
|
+
export interface ArbExplainInput {
|
|
37
|
+
status?: number;
|
|
38
|
+
voting_deadline?: number | null;
|
|
39
|
+
indemnity_amount?: number | null;
|
|
40
|
+
proposition_count?: number;
|
|
41
|
+
}
|
|
42
|
+
export interface ArbExplanation {
|
|
43
|
+
summary: string;
|
|
44
|
+
status_label: string;
|
|
45
|
+
deadline: string;
|
|
46
|
+
warnings: string[];
|
|
47
|
+
}
|
|
48
|
+
export declare function explainArb(input: ArbExplainInput): ArbExplanation;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{MAX_PROPOSITION_COUNT,MAX_VOTOR_COUNT}from'@wowok/wowok';export const ARB_TRANSLATION_VERSION='1.0.0';export const ARB_STATUS={'PRINCIPAL_CONFIRMING':0x0,'ARBITRATOR_CONFIRMING':0x1,'VOTING':0x2,'ARBITRATED':0x3,'OBJECTIONABLE':0x4,'FINISHED':0x5,'WITHDRAWN':0x6};export const SEMANTIC_TO_ARB_SCHEMA_RULES=[{'id':'P-ARB-01','pattern_name':'Create\x20arbitration\x20case','semantic_intent':'Create\x20a\x20shared\x20Arb\x20object\x20bound\x20to\x20an\x20Order\x20+\x20Arbitration.','match_keywords':['open\x20dispute','create\x20arbitration','start\x20case'],'required_fields':['arbitration','order','description','proposition'],'optional_fields':['fee'],'example':{'arbitration':'0x...','order':'0x...','description':'delivery\x20dispute','proposition':['refund','redeliver']}},{'id':'P-ARB-02','pattern_name':'Cast\x20vote','semantic_intent':'A\x20voter\x20casts\x20weighted\x20votes\x20on\x20propositions\x20(Voting\x20status).','match_keywords':['vote','cast\x20vote','jury\x20vote'],'required_fields':['voter','votes','weight'],'optional_fields':[],'example':{'voter':'0x...','votes':[0x0],'weight':0xa}},{'id':'P-ARB-03','pattern_name':'Finalize\x20arbitration','semantic_intent':'Arbitrator\x20finalizes\x20with\x20feedback\x20+\x20indemnity\x20(Voting\x20→\x20Arbitrated).','match_keywords':['arbitrate','finalize','rule','indemnity'],'required_fields':['feedback','indemnity_amount'],'optional_fields':[],'example':{'feedback':'refund\x20awarded','indemnity_amount':0x3b9aca00}}];export const ARB_FIELD_TRANSLATIONS=[{'field_name':'status','value_type':'u8','semantic':'7-state\x20machine:\x200\x20Principal_confirming\x20→\x201\x20Arbitrator_confirming\x20→\x202\x20Voting\x20→\x203\x20Arbitrated\x20→\x204\x20Objectionable\x20→\x205\x20Finished\x20→\x206\x20Withdrawn.','format_example':'2\x20(Voting)','validation_rules':['E_STATUS_NOT_MATCH\x20(3)\x20on\x20out-of-order\x20op']},{'field_name':'order','value_type':'address','semantic':'Bound\x20Order\x20address;\x20ops\x20assert\x20equality\x20(E_ARB_ORDER_NOT_MATCH\x202).','format_example':'0x...order...','validation_rules':['E_ARB_ORDER_NOT_MATCH\x20(2)']},{'field_name':'proposition','value_type':'vector<Proposition>','semantic':'Voting\x20options\x20(≤\x20MAX_PROPOSITION_COUNT\x20'+MAX_PROPOSITION_COUNT+').','format_example':'[{name,\x20votes}]','validation_rules':['E_MAX_PROPOSITION_COUNT\x20(1)']},{'field_name':'voted','value_type':'vector<Voted>','semantic':'Voter\x20records\x20(≤\x20MAX_VOTOR_COUNT\x20'+MAX_VOTOR_COUNT+').','format_example':'[{voter,\x20agrees,\x20weight,\x20time}]','validation_rules':['E_MAX_VOTOR_COUNT\x20(6)']},{'field_name':'voting_deadline','value_type':'Option<u64>','semantic':'None=open-ended;\x20Some(t)\x20enforces\x20deadline\x20(E_VOTING_DEADLINE_PASSED\x207).','format_example':'null\x20or\x201710000000000','validation_rules':['E_VOTING_DEADLINE_PASSED\x20(7)','E_VOTING_DEADLINE_NOT_PASSED\x20(4)']},{'field_name':'indemnity','value_type':'Option<Indemnity>','semantic':'None=no\x20compensation;\x20Some({amount,time}).','format_example':'{amount:\x201000000000,\x20time:\x20...}','validation_rules':['finish()\x20returns\x20amount\x20(0\x20when\x20None)']},{'field_name':'compensation_time','value_type':'Option<u64>','semantic':'Claim-ready\x20time\x20(set\x20when\x20Finished).','format_example':'1710000000000','validation_rules':['set\x20by\x20finish()']}];export const ARB_CONSTRAINT_RULES=[{'id':'ARB_C_01','name':'status\x20transition','description':'each\x20op\x20asserts\x20current\x20status\x20(E_STATUS_NOT_MATCH\x203).','related_field':'status'},{'id':'ARB_C_02','name':'order\x20match','description':'self.order\x20==\x20id_address(order)\x20(E_ARB_ORDER_NOT_MATCH\x202).','related_field':'order'},{'id':'ARB_C_03','name':'proposition\x20cap','description':'proposition\x20≤\x20MAX_PROPOSITION_COUNT\x20('+MAX_PROPOSITION_COUNT+').','related_field':'proposition'},{'id':'ARB_C_04','name':'voter\x20cap','description':'voted\x20<\x20MAX_VOTOR_COUNT\x20('+MAX_VOTOR_COUNT+').','related_field':'voted'},{'id':'ARB_C_05','name':'deadline','description':'vote\x20enforces\x20voting_deadline\x20when\x20Some\x20(E_VOTING_DEADLINE_PASSED\x207).','related_field':'voting_deadline'}];const STATUS_LABELS={0x0:'Principal_confirming',0x1:'Arbitrator_confirming',0x2:'Voting',0x3:'Arbitrated',0x4:'Objectionable',0x5:'Finished',0x6:'Withdrawn'};export function explainArb(a){const b=[],c=a['status']!==undefined?STATUS_LABELS[a['status']]??'unknown('+a['status']+')':'unknown',d=a['voting_deadline']==null?'open-ended\x20(None)':'deadline='+a['voting_deadline'];return a['voting_deadline']==null&&b['push']('voting_deadline\x20None\x20—\x20open-ended\x20vote,\x20may\x20never\x20finalize'),a['indemnity_amount']==null&&b['push']('indemnity\x20None\x20—\x20no\x20compensation\x20awarded'),a['proposition_count']!==undefined&&a['proposition_count']>MAX_PROPOSITION_COUNT&&b['push']('proposition_count\x20'+a['proposition_count']+'\x20exceeds\x20'+MAX_PROPOSITION_COUNT),{'summary':'Arb\x20status='+c+'.\x20Voting\x20'+d+'.\x20Indemnity\x20'+(a['indemnity_amount']==null?'none':a['indemnity_amount'])+'.','status_label':c,'deadline':d,'warnings':b};}
|