@wowok/agent-mcp 3.4.0 → 3.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -0
- package/dist/chain-semantics/composition-truth.d.ts +102 -0
- package/dist/chain-semantics/composition-truth.js +1 -0
- package/dist/chain-semantics/eval-order.js +1 -1
- package/dist/chain-semantics/fund-flow.js +1 -1
- package/dist/chain-semantics/index.d.ts +1 -0
- package/dist/chain-semantics/index.js +1 -1
- package/dist/composition/audit.js +1 -1
- package/dist/composition/blueprint-view.d.ts +3 -3
- package/dist/composition/blueprint-view.js +1 -1
- package/dist/composition/compile.d.ts +24 -3
- package/dist/composition/compile.js +1 -1
- package/dist/composition/emit-phases.d.ts +206 -0
- package/dist/composition/emit-phases.js +1 -0
- package/dist/composition/generate.d.ts +40 -0
- package/dist/composition/generate.js +1 -0
- package/dist/composition/guard-fill.d.ts +44 -0
- package/dist/composition/guard-fill.js +1 -0
- package/dist/composition/inflight.d.ts +20 -2
- package/dist/composition/inflight.js +1 -1
- package/dist/composition/input-normalize.d.ts +15 -0
- package/dist/composition/input-normalize.js +1 -0
- package/dist/composition/materialize.d.ts +18 -13
- package/dist/composition/materialize.js +1 -1
- package/dist/composition/mode-gates.d.ts +35 -0
- package/dist/composition/mode-gates.js +1 -0
- package/dist/composition/param-disclosure.js +1 -1
- package/dist/composition/plan-retry-ledger.d.ts +21 -0
- package/dist/composition/plan-retry-ledger.js +1 -0
- package/dist/composition/plan.d.ts +7 -2
- package/dist/composition/plan.js +1 -1
- package/dist/composition/product-card.d.ts +94 -0
- package/dist/composition/product-card.js +1 -0
- package/dist/composition/supply-chain-emit.d.ts +46 -0
- package/dist/composition/supply-chain-emit.js +1 -0
- package/dist/config/config-audit.spec.js +1 -1
- package/dist/config/config-warnings.d.ts +2 -0
- package/dist/config/config-warnings.js +1 -0
- package/dist/config/exposure.d.ts +2 -2
- package/dist/config/judgment.d.ts +31 -5
- package/dist/config/judgment.js +1 -1
- package/dist/config/judgment.spec.js +1 -1
- package/dist/config/match-policy-file.d.ts +34 -0
- package/dist/config/match-policy-file.js +1 -0
- package/dist/config/match-policy-file.spec.d.ts +1 -0
- package/dist/config/match-policy-file.spec.js +1 -0
- package/dist/config/rule-engine.d.ts +5 -5
- package/dist/config/rule-engine.js +1 -1
- package/dist/config/runtime.d.ts +0 -1
- package/dist/config/runtime.js +1 -1
- package/dist/config/severity.d.ts +0 -2
- package/dist/config/severity.js +1 -1
- package/dist/config/store-policy.spec.js +1 -1
- package/dist/config/template-params.d.ts +42 -0
- package/dist/config/template-params.js +1 -0
- package/dist/config/template-params.spec.d.ts +1 -0
- package/dist/config/template-params.spec.js +1 -0
- package/dist/data/api/api.spec.js +1 -1
- package/dist/data/api/server.js +1 -1
- package/dist/data/projection/store.d.ts +2 -1
- package/dist/data/projection/store.js +1 -1
- package/dist/data/projection/types.d.ts +22 -0
- package/dist/data/sync/cdc.d.ts +1 -2
- package/dist/data/sync/cdc.js +1 -1
- package/dist/evaluation/acceptance.d.ts +8 -0
- package/dist/evaluation/acceptance.js +1 -1
- package/dist/evaluation/builtins/demand-match.js +1 -1
- package/dist/evaluation/builtins/graph-service.spec.js +1 -1
- package/dist/evaluation/capability.d.ts +2 -0
- package/dist/evaluation/category-match-rules.d.ts +0 -1
- package/dist/evaluation/category-match-rules.js +1 -1
- package/dist/evaluation/composer.d.ts +25 -0
- package/dist/evaluation/composer.js +1 -1
- package/dist/evaluation/engine.js +1 -1
- package/dist/evaluation/extract.d.ts +7 -0
- package/dist/evaluation/extract.js +1 -1
- package/dist/evaluation/game-strategy.d.ts +0 -3
- package/dist/evaluation/game-strategy.js +1 -1
- package/dist/evaluation/match-operation.d.ts +9 -0
- package/dist/evaluation/match-operation.js +1 -1
- package/dist/evaluation/match-policy-resolver.d.ts +9 -0
- package/dist/evaluation/match-policy-resolver.js +1 -0
- package/dist/evaluation/match-policy.d.ts +3 -1
- package/dist/evaluation/match-policy.js +1 -1
- package/dist/evaluation/region.d.ts +0 -6
- package/dist/evaluation/region.js +1 -1
- package/dist/evaluation/standards.d.ts +2 -1
- package/dist/evaluation/standards.js +1 -1
- package/dist/evaluation/structured-lines.d.ts +8 -0
- package/dist/evaluation/structured-lines.js +1 -0
- package/dist/evaluation/types.d.ts +6 -0
- package/dist/experience/realtime-feedback.js +1 -1
- package/dist/extensions/capability-manifest.d.ts +1 -0
- package/dist/extensions/capability-manifest.js +1 -1
- package/dist/extensions/capability.d.ts +91 -0
- package/dist/extensions/capability.js +1 -0
- package/dist/extensions/industry-audit.spec.js +1 -1
- package/dist/extensions/industry-pack.d.ts +13 -0
- package/dist/extensions/industry-pack.js +1 -1
- package/dist/extensions/modes.js +1 -1
- package/dist/extensions/registry.d.ts +0 -2
- package/dist/extensions/registry.js +1 -1
- package/dist/goal/GoalEngine.js +1 -1
- package/dist/graph/onchain/analyze.js +1 -1
- package/dist/graph/onchain/expand.js +1 -1
- package/dist/graph/onchain/exposure.js +1 -1
- package/dist/graph/onchain/facts.js +1 -1
- package/dist/graph/onchain/order-status.d.ts +0 -1
- package/dist/graph/onchain/order-status.js +1 -1
- package/dist/harness/recover.js +1 -1
- package/dist/harness/verify.d.ts +0 -3
- package/dist/harness/verify.js +1 -1
- package/dist/intent/types.d.ts +0 -1
- package/dist/intent/types.js +1 -1
- package/dist/keeper/detectors.js +1 -1
- package/dist/keeper/types.d.ts +0 -1
- package/dist/keeper/types.js +1 -1
- package/dist/knowledge/allocation-risk.d.ts +1 -0
- package/dist/knowledge/allocation-risk.js +1 -1
- package/dist/knowledge/allocator-rail-verifier.d.ts +6 -1
- package/dist/knowledge/allocator-rail-verifier.js +1 -1
- package/dist/knowledge/arbitration-ledger.js +1 -1
- package/dist/knowledge/arbitration-puzzle.js +1 -1
- package/dist/knowledge/arbitration-templates.js +1 -1
- package/dist/knowledge/audit-rules.d.ts +4 -3
- package/dist/knowledge/audit-rules.js +1 -1
- package/dist/knowledge/baselines/judgment-baselines.json +21 -2
- package/dist/knowledge/baselines/rules/oracle.json +120 -0
- package/dist/knowledge/baselines/rules/plan.json +384 -17
- package/dist/knowledge/baselines/rules/progress.json +20 -2
- package/dist/knowledge/builtin-templates.d.ts +28 -1
- package/dist/knowledge/builtin-templates.js +1 -1
- package/dist/knowledge/component-schema.js +1 -1
- package/dist/knowledge/contact-templates.d.ts +0 -1
- package/dist/knowledge/contact-templates.js +1 -1
- package/dist/knowledge/dynamic-pricing.js +1 -1
- package/dist/knowledge/fee-param-bindings.js +1 -1
- package/dist/knowledge/fund-layer.d.ts +1 -0
- package/dist/knowledge/fund-layer.js +1 -1
- package/dist/knowledge/game-scenarios.js +1 -1
- package/dist/knowledge/getting-started.js +1 -1
- package/dist/knowledge/guard-binding-table.d.ts +52 -0
- package/dist/knowledge/guard-binding-table.js +1 -0
- package/dist/knowledge/guard-binding-verifier.d.ts +30 -0
- package/dist/knowledge/guard-binding-verifier.js +1 -0
- package/dist/knowledge/guard-bindings.js +1 -1
- package/dist/knowledge/guard-blueprint.d.ts +68 -0
- package/dist/knowledge/guard-blueprint.js +1 -0
- package/dist/knowledge/guard-design-patterns.d.ts +1 -1
- package/dist/knowledge/guard-design-patterns.js +1 -1
- package/dist/knowledge/guard-field-cognition.js +1 -1
- package/dist/knowledge/guard-host-context.d.ts +24 -0
- package/dist/knowledge/guard-host-context.js +1 -0
- package/dist/knowledge/guard-lint.js +1 -1
- package/dist/knowledge/guard-node-gates.d.ts +3 -0
- package/dist/knowledge/guard-node-gates.js +1 -1
- package/dist/knowledge/guard-puzzle.js +1 -1
- package/dist/knowledge/guard-render.js +1 -1
- package/dist/knowledge/guard-risk.js +1 -1
- package/dist/knowledge/guard-submission-prompt.d.ts +11 -0
- package/dist/knowledge/guard-submission-prompt.js +1 -1
- package/dist/knowledge/guard-templates.d.ts +1 -1
- package/dist/knowledge/guard-templates.js +1 -1
- package/dist/knowledge/guard-translation.js +1 -1
- package/dist/knowledge/index.d.ts +1 -1
- package/dist/knowledge/index.js +1 -1
- package/dist/knowledge/industry-generalizer.d.ts +6 -1
- package/dist/knowledge/industry-generalizer.js +1 -1
- package/dist/knowledge/industry-registry.js +1 -1
- package/dist/knowledge/jsonrpc-enum.d.ts +38 -0
- package/dist/knowledge/jsonrpc-enum.js +1 -1
- package/dist/knowledge/machine-topology.js +1 -1
- package/dist/knowledge/machine-translation.js +1 -1
- package/dist/knowledge/object-dependency.d.ts +31 -0
- package/dist/knowledge/object-dependency.js +1 -0
- package/dist/knowledge/onchain-constants.d.ts +2 -0
- package/dist/knowledge/onchain-constants.js +1 -1
- package/dist/knowledge/param-schema.d.ts +23 -0
- package/dist/knowledge/param-schema.js +1 -1
- package/dist/knowledge/param-tiers.js +1 -1
- package/dist/knowledge/passport-ledger.js +1 -1
- package/dist/knowledge/path-oracle/coverage.d.ts +16 -0
- package/dist/knowledge/path-oracle/coverage.js +1 -0
- package/dist/knowledge/path-oracle/index.d.ts +5 -0
- package/dist/knowledge/path-oracle/index.js +1 -0
- package/dist/knowledge/path-oracle/products/food-delivery.d.ts +2 -0
- package/dist/knowledge/path-oracle/products/food-delivery.js +1 -0
- package/dist/knowledge/path-oracle/schema.d.ts +188 -0
- package/dist/knowledge/path-oracle/schema.js +1 -0
- package/dist/knowledge/pattern-resolutions.d.ts +2 -0
- package/dist/knowledge/pattern-resolutions.js +1 -1
- package/dist/knowledge/progress-ledger.js +1 -1
- package/dist/knowledge/progress-risk.js +1 -1
- package/dist/knowledge/projection.spec.js +1 -1
- package/dist/knowledge/protocol-facts.js +1 -1
- package/dist/knowledge/requirement-families.d.ts +13 -0
- package/dist/knowledge/requirement-families.js +1 -0
- package/dist/knowledge/reward-ledger.js +1 -1
- package/dist/knowledge/scenario-modes.d.ts +1 -0
- package/dist/knowledge/scenario-modes.js +1 -1
- package/dist/knowledge/semantic-ir.d.ts +4 -0
- package/dist/knowledge/semantic-ir.js +1 -1
- package/dist/knowledge/service-ledger.d.ts +1 -1
- package/dist/knowledge/service-ledger.js +1 -1
- package/dist/knowledge/sku-name-gate.d.ts +17 -0
- package/dist/knowledge/sku-name-gate.js +1 -0
- package/dist/knowledge/supply-chain.d.ts +9 -0
- package/dist/knowledge/supply-chain.js +1 -1
- package/dist/knowledge/template-loader.d.ts +14 -6
- package/dist/knowledge/template-loader.js +1 -1
- package/dist/knowledge/template-nav.d.ts +3 -1
- package/dist/knowledge/template-nav.js +1 -1
- package/dist/knowledge/template-prose.d.ts +1 -1
- package/dist/knowledge/template-registry.js +1 -1
- package/dist/knowledge/template-scanner.d.ts +62 -0
- package/dist/knowledge/template-scanner.js +1 -1
- package/dist/knowledge/template-test-profiles.js +1 -1
- package/dist/knowledge/tools-reference.js +1 -1
- package/dist/knowledge/workflow-guidance.d.ts +5 -0
- package/dist/knowledge/workflow-guidance.js +1 -1
- package/dist/monitor/MonitorLoop.js +1 -1
- package/dist/participation/customer-interest.d.ts +4 -0
- package/dist/participation/customer-interest.js +1 -1
- package/dist/participation/node-action-advisor.d.ts +4 -0
- package/dist/participation/node-action-advisor.js +1 -1
- package/dist/participation/radar-core.js +1 -1
- package/dist/participation/time-window.d.ts +11 -0
- package/dist/participation/time-window.js +1 -1
- package/dist/persona/address-format.d.ts +0 -1
- package/dist/persona/address-format.js +1 -1
- package/dist/persona/bridge.js +1 -1
- package/dist/persona/index.d.ts +0 -2
- package/dist/persona/index.js +1 -1
- package/dist/persona/model.js +1 -1
- package/dist/persona/persona-audit.spec.js +1 -1
- package/dist/persona/types.d.ts +6 -0
- package/dist/playbooks/service-build/business-puzzle.js +1 -1
- package/dist/playbooks/service-build/game-theory.d.ts +2 -2
- package/dist/playbooks/service-build/intent-analyzer.js +1 -1
- package/dist/playbooks/service-build/machine-panorama.js +1 -1
- package/dist/playbooks/service-build/merchant-guide.d.ts +50 -23
- package/dist/playbooks/service-build/merchant-guide.js +1 -1
- package/dist/playbooks/service-build/migration-planner.d.ts +2 -0
- package/dist/playbooks/service-build/migration-planner.js +1 -1
- package/dist/playbooks/service-build/mode-actions.js +1 -1
- package/dist/playbooks/service-build/object-panorama.d.ts +8 -0
- package/dist/playbooks/service-build/object-panorama.js +1 -1
- package/dist/playbooks/service-build/participation-radar.js +1 -1
- package/dist/playbooks/service-build/relationship-profile.js +1 -1
- package/dist/playbooks/service-build/reverse-mapping.d.ts +6 -0
- package/dist/playbooks/service-build/reverse-mapping.js +1 -1
- package/dist/playbooks/service-build/service-panorama.d.ts +1 -0
- package/dist/playbooks/service-build/service-panorama.js +1 -1
- package/dist/playbooks/service-build/service-quote.js +1 -1
- package/dist/playbooks/service-build/service-quote.spec.js +1 -1
- package/dist/playbooks/service-build/workflow-design-assessment.d.ts +10 -1
- package/dist/playbooks/service-build/workflow-design-assessment.js +1 -1
- package/dist/review/index.js +1 -1
- package/dist/review/repository.js +1 -1
- package/dist/safety/confirm-gate.js +1 -1
- package/dist/schema/benchmark-migration/index.d.ts +104 -0
- package/dist/schema/benchmark-migration/index.js +1 -1
- package/dist/schema/call/allocation.d.ts +15 -6
- package/dist/schema/call/allocation.js +1 -1
- package/dist/schema/call/base.d.ts +256 -0
- package/dist/schema/call/base.js +1 -1
- package/dist/schema/call/bridge.d.ts +32 -6
- package/dist/schema/call/demand.d.ts +15 -6
- package/dist/schema/call/demand.js +1 -1
- package/dist/schema/call/guard.d.ts +8 -8
- package/dist/schema/call/guard.js +1 -1
- package/dist/schema/call/handler.d.ts +3 -0
- package/dist/schema/call/handler.js +1 -1
- package/dist/schema/call/machine.d.ts +32 -8
- package/dist/schema/call/machine.js +1 -1
- package/dist/schema/call/order.d.ts +26 -8
- package/dist/schema/call/order.js +1 -1
- package/dist/schema/call/payment.d.ts +20 -8
- package/dist/schema/call/payment.js +1 -1
- package/dist/schema/call/permission-handler.js +1 -1
- package/dist/schema/call/permission.d.ts +330 -114
- package/dist/schema/call/permission.js +1 -1
- package/dist/schema/call/personal.d.ts +10 -4
- package/dist/schema/call/personal.js +1 -1
- package/dist/schema/call/progress.d.ts +16 -4
- package/dist/schema/call/proof.js +1 -1
- package/dist/schema/call/reward.d.ts +10 -4
- package/dist/schema/call/reward.js +1 -1
- package/dist/schema/call/semantic.d.ts +1 -0
- package/dist/schema/call/semantic.js +1 -1
- package/dist/schema/call/service.d.ts +143 -45
- package/dist/schema/call/service.js +1 -1
- package/dist/schema/call/treasury.d.ts +15 -6
- package/dist/schema/call/treasury.js +1 -1
- package/dist/schema/common/index.js +1 -1
- package/dist/schema/config/index.d.ts +61 -0
- package/dist/schema/config/index.js +1 -1
- package/dist/schema/envelope-unify.d.ts +4 -0
- package/dist/schema/envelope-unify.js +1 -0
- package/dist/schema/evaluation/index.d.ts +216 -19
- package/dist/schema/evaluation/index.js +1 -1
- package/dist/schema/goal/index.d.ts +47 -0
- package/dist/schema/goal/planning.d.ts +115 -1
- package/dist/schema/goal/planning.js +1 -1
- package/dist/schema/industry-pack/index.d.ts +137 -6
- package/dist/schema/industry-pack/index.js +1 -1
- package/dist/schema/industry-pack/modes.d.ts +6 -6
- package/dist/schema/keeper/index.d.ts +26 -0
- package/dist/schema/local/index.d.ts +137 -0
- package/dist/schema/local/index.js +1 -1
- package/dist/schema/local/wip.d.ts +6 -0
- package/dist/schema/local/wip.js +1 -1
- package/dist/schema/messenger/index.d.ts +26 -0
- package/dist/schema/operations.d.ts +345 -84
- package/dist/schema/operations.js +1 -1
- package/dist/schema/persona/index.d.ts +2907 -640
- package/dist/schema/persona/index.js +1 -1
- package/dist/schema/query/bi.d.ts +145 -4
- package/dist/schema/query/bi.js +1 -1
- package/dist/schema/query/index.d.ts +266 -73
- package/dist/schema/query/index.js +1 -1
- package/dist/schema/schema-query/index.d.ts +1 -1
- package/dist/schema/schema-query/index.js +1 -1
- package/dist/schema/schema-version.js +1 -1
- package/dist/schema/utils/permission-machine-check.d.ts +2 -0
- package/dist/schema/utils/permission-machine-check.js +1 -1
- package/dist/schema/watch/index.d.ts +16 -0
- package/dist/schema/watch/index.js +1 -1
- package/dist/schema/workflow/index.d.ts +2 -2
- package/dist/schema/workflow/index.js +1 -1
- package/dist/schema-query-impl/index.d.ts +1 -1
- package/dist/schema-query-impl/index.js +1 -1
- package/dist/schemas/account_operation.output.json +94 -0
- package/dist/schemas/benchmark_migration_operation.output.json +338 -9
- package/dist/schemas/benchmark_migration_operation.schema.json +27 -2
- package/dist/schemas/bridge_operation.output.json +94 -0
- package/dist/schemas/config_operation.output.json +352 -0
- package/dist/schemas/config_operation.schema.json +20 -2
- package/dist/schemas/evaluation_operation.output.json +570 -4
- package/dist/schemas/evaluation_operation.schema.json +194 -3
- package/dist/schemas/goal_operation.schema.json +183 -0
- package/dist/schemas/index.json +1 -1
- package/dist/schemas/industry_pack_operation.output.json +621 -0
- package/dist/schemas/industry_pack_operation.schema.json +20 -2
- package/dist/schemas/keeper_operation.output.json +94 -0
- package/dist/schemas/local_cache_operation.output.json +94 -0
- package/dist/schemas/local_history_operation.output.json +94 -0
- package/dist/schemas/local_info_operation.output.json +94 -0
- package/dist/schemas/local_mark_operation.output.json +94 -0
- package/dist/schemas/messenger_operation.output.json +94 -0
- package/dist/schemas/monitor_events.output.json +94 -0
- package/dist/schemas/monitor_subscription.output.json +94 -0
- package/dist/schemas/onchain_events.output.json +94 -0
- package/dist/schemas/onchain_operations.output.json +313 -1
- package/dist/schemas/onchain_operations.schema.json +1265 -671
- package/dist/schemas/onchain_operations_allocation.schema.json +30 -15
- package/dist/schemas/onchain_operations_arbitration.schema.json +9 -2
- package/dist/schemas/onchain_operations_contact.schema.json +8 -1
- package/dist/schemas/onchain_operations_demand.schema.json +29 -14
- package/dist/schemas/onchain_operations_gen_passport.schema.json +8 -1
- package/dist/schemas/onchain_operations_guard.schema.json +290 -105
- package/dist/schemas/onchain_operations_machine.schema.json +49 -34
- package/dist/schemas/onchain_operations_order.schema.json +63 -40
- package/dist/schemas/onchain_operations_payment.schema.json +26 -11
- package/dist/schemas/onchain_operations_permission.schema.json +362 -235
- package/dist/schemas/onchain_operations_personal.schema.json +27 -15
- package/dist/schemas/onchain_operations_progress.schema.json +45 -30
- package/dist/schemas/onchain_operations_proof.schema.json +9 -2
- package/dist/schemas/onchain_operations_repository.schema.json +8 -1
- package/dist/schemas/onchain_operations_reward.schema.json +32 -17
- package/dist/schemas/onchain_operations_service.schema.json +232 -125
- package/dist/schemas/onchain_operations_treasury.schema.json +32 -17
- package/dist/schemas/onchain_table_data.output.json +258 -6
- package/dist/schemas/onchain_table_data.schema.json +92 -52
- package/dist/schemas/persona_operation.output.json +7752 -0
- package/dist/schemas/persona_operation.schema.json +1232 -4
- package/dist/schemas/query_toolkit.output.json +756 -116
- package/dist/schemas/query_toolkit.schema.json +138 -7
- package/dist/schemas/schema_query.schema.json +1 -1
- package/dist/schemas/watch_operation.output.json +83 -0
- package/dist/schemas/wip_file.output.json +8 -0
- package/dist/schemas/workflow_operation.schema.json +2 -2
- package/dist/tools/handlers/benchmark-migration.d.ts +20 -3
- package/dist/tools/handlers/benchmark-migration.js +1 -1
- package/dist/tools/handlers/config.js +1 -1
- package/dist/tools/handlers/evaluation.js +1 -1
- package/dist/tools/handlers/evaluation.spec.js +1 -1
- package/dist/tools/handlers/industry-pack.js +1 -1
- package/dist/tools/handlers/onchain.d.ts +30 -0
- package/dist/tools/handlers/onchain.js +1 -1
- package/dist/tools/handlers/persona.js +1 -1
- package/dist/tools/handlers/query.d.ts +8 -0
- package/dist/tools/handlers/query.js +1 -1
- package/dist/tools/handlers/winner-derivation.d.ts +20 -0
- package/dist/tools/handlers/winner-derivation.js +1 -0
- package/dist/tools/handlers/wip-upload.js +1 -1
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/index.js +1 -1
- package/dist/tools/registry/business.js +1 -1
- package/dist/tools/registry/config.js +1 -1
- package/dist/tools/registry/evaluation.js +1 -1
- package/dist/tools/registry/identity.js +1 -1
- package/dist/tools/registry/query.js +1 -1
- package/dist/tools/transport-integrity.d.ts +7 -0
- package/dist/tools/transport-integrity.js +1 -0
- package/dist/tools/upgrade-check.js +1 -1
- package/dist/tools/wrap.d.ts +5 -0
- package/dist/tools/wrap.js +1 -1
- package/package.json +2 -2
- package/dist/extensions/business-modules.d.ts +0 -54
- package/dist/extensions/business-modules.js +0 -1
- package/dist/schemas/guard-templates.json +0 -379
package/dist/keeper/types.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export type KeeperDetectorKind = "payment_unclaimed" | "progress_actionable" | "settlement_pending" | "timeout_intermediate";
|
|
2
|
-
export declare const KEEPER_DETECTORS: readonly KeeperDetectorKind[];
|
|
3
2
|
export declare const AUTO_EXECUTABLE_DETECTORS: readonly KeeperDetectorKind[];
|
|
4
3
|
export type KeeperTaskStatus = "pending" | "executed" | "dismissed" | "superseded";
|
|
5
4
|
export interface KeeperTask {
|
package/dist/keeper/types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const
|
|
1
|
+
export const AUTO_EXECUTABLE_DETECTORS=['payment_unclaimed'];export const KEEPER_DEFAULTS={'scan_interval_ms':0x1d4c0,'max_scan_objects':0x14,'max_auto_execute_per_scan':0x5,'auto_retry_cooldown_ms':0x1b7740,'timeout_intermediate_ms':0x5265c00};export const KEEPER_MIN={'scan_interval_ms':0x7530,'max_scan_objects':0x1,'max_auto_execute_per_scan':0x1,'auto_retry_cooldown_ms':0xea60,'timeout_intermediate_ms':0x36ee80};export function defaultKeeperConfig(){return{'enabled':!![],'detectors':{'payment_unclaimed':!![],'progress_actionable':!![],'settlement_pending':!![],'timeout_intermediate':!![]},'scan_interval_ms':KEEPER_DEFAULTS['scan_interval_ms'],'max_scan_objects':KEEPER_DEFAULTS['max_scan_objects'],'max_auto_execute_per_scan':KEEPER_DEFAULTS['max_auto_execute_per_scan'],'auto_retry_cooldown_ms':KEEPER_DEFAULTS['auto_retry_cooldown_ms'],'timeout_intermediate_ms':KEEPER_DEFAULTS['timeout_intermediate_ms']};}export function clampKeeperConfig(a){const b=(c,d,e)=>{const f=Number(c);return Number['isFinite'](f)?Math['max'](e,Math['floor'](f)):d;};return{...a,'scan_interval_ms':b(a['scan_interval_ms'],KEEPER_DEFAULTS['scan_interval_ms'],KEEPER_MIN['scan_interval_ms']),'max_scan_objects':b(a['max_scan_objects'],KEEPER_DEFAULTS['max_scan_objects'],KEEPER_MIN['max_scan_objects']),'max_auto_execute_per_scan':b(a['max_auto_execute_per_scan'],KEEPER_DEFAULTS['max_auto_execute_per_scan'],KEEPER_MIN['max_auto_execute_per_scan']),'auto_retry_cooldown_ms':b(a['auto_retry_cooldown_ms'],KEEPER_DEFAULTS['auto_retry_cooldown_ms'],KEEPER_MIN['auto_retry_cooldown_ms']),'timeout_intermediate_ms':b(a['timeout_intermediate_ms'],KEEPER_DEFAULTS['timeout_intermediate_ms'],KEEPER_MIN['timeout_intermediate_ms'])};}export function newKeeperTaskId(){return'ktask_'+Date['now']()['toString'](0x24)+'_'+Math['random']()['toString'](0x24)['slice'](0x2,0x8);}export function newKeeperRuleId(){return'krule_'+Date['now']()['toString'](0x24)+'_'+Math['random']()['toString'](0x24)['slice'](0x2,0x8);}
|
|
@@ -63,6 +63,7 @@ export interface AllocationRiskCheckContext {
|
|
|
63
63
|
order_already_has_allocation?: boolean;
|
|
64
64
|
builder_address?: string;
|
|
65
65
|
}
|
|
66
|
+
export declare const STUCK_POOL_REMEDY: string;
|
|
66
67
|
export declare function allocationRiskFacts(ctx: AllocationRiskCheckContext): Facts;
|
|
67
68
|
export declare const ALLOCATION_RISK_VERSION = "1.2.0";
|
|
68
69
|
export declare function getAllRiskRules(): AllocationRiskRule[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{MAX_ALLOCATOR_COUNT,RATE_TOTAL_FULL,ALLOCATION_ERROR_CODES}from'./allocation-ledger.js';import{isUnboundSignerTheft}from'./recipient-constraint.js';import{checkEntityRecipientsSync}from'./entity-recipient-guard.js';import{getJudgmentDoc,factoryRulePack}from'../config/judgment.js';import{evaluateRuleBook,evaluateCondition}from'../config/rule-engine.js';const AUTO_FIXABLE=new Set(['R-A-1-02#0','R-A-1-02#1','R-A-1-02#2','R-A-1-02#3','R-A-1-02#4','R-A-1-03#0','R-A-1-03#2','R-A-2-03#0','R-A-5-03#0']),RELATED_MOVE_ERROR={'R-A-1-01#0':'EALLOCATORS_EMPTY\x20(8)\x20/\x20ENO_ALLOCATOR\x20(3)','R-A-1-01#1':'ENO_ALLOCATOR\x20(3)','R-A-1-02#0':'ERATE_NOT_10000\x20(4)','R-A-1-02#1':'ERATE_EXCEEDS_10000\x20(6)','R-A-1-02#2':'ERATE_EXCEEDS_10000\x20(6)','R-A-1-02#3':'ERATE_EXCEEDS_10000\x20(6)','R-A-1-02#4':'ERATE_EXCEEDS_10000\x20(6)','R-A-1-02#5':'EMIXED_RATE_BASES\x20(17)','R-A-1-03#0':'EMULTIPLE_SURPLUS\x20(5)','R-A-1-04#0':'NO\x20chain\x20rejection\x20—\x20allocation\x20pays\x20Rate\x20legs\x20then\x20the\x20Surplus\x20remainder\x20verbatim,\x20and\x20order_allocators\x20freezes\x20at\x20Service\x20publish\x20(E_ALREADY_PUBLISHED\x20=\x206),\x20so\x20the\x20misrouted\x20share\x20is\x20permanent','R-A-1-03#1':'EAMOUNT_BELOW_THRESHOLD\x20(12)','R-A-1-03#2':'EAMOUNT_EXCEEDS_MAX\x20(13)','R-A-2-02#0':'ERECIPIENT_IDENTIFIER_NOT_ADDRESS\x20(1)','R-A-2-04#0':'ERECIPIENT_NOT_FOR_OBJECT\x20(15)','R-A-2-04#1':'NO\x20chain\x20rejection\x20when\x20the\x20anchor\x20is\x20None\x20—\x20the\x20on-chain\x20allocation\x20only\x20asserts\x20ERECIPIENT_NOT_FOR_OBJECT\x20(15)\x20when\x20an\x20anchor\x20is\x20present,\x20and\x20the\x20on-chain\x20design\x20hands\x20the\x20due-diligence\x20obligation\x20to\x20this\x20tooling\x20layer;\x20order\x20and\x20arbitration\x20flows\x20always\x20anchor,\x20so\x20None\x20is\x20reachable\x20only\x20via\x20standalone/custom\x20PaymentInfo','R-A-2-04#2':'a\x20submission\x20that\x20MATCHES\x20the\x20anchor\x20pays\x20the\x20anchor\x20object\x20by\x20design\x20(order\x20/\x20arbitration\x20refunds):\x20the\x20CoinWrapper\x20is\x20transferred\x20to\x20the\x20bound\x20object\x20and\x20the\x20Order\x27s\x20owner-claim\x20entry\x20extracts\x20it\x20to\x20order.owner\x20at\x20extraction\x20time\x20(an\x20ownership\x20change\x20is\x20followed;\x20any\x20keeper\x20may\x20drive\x20step\x202).\x20A\x20MISMATCHED\x20submission\x20aborts\x20ERECIPIENT_NOT_FOR_OBJECT\x20(15)\x20—\x20that\x20is\x20the\x20cross-order\x20redirect\x20guard,\x20not\x20a\x20ban\x20on\x20the\x20shape','R-A-5-01#0':'E_ALLOCATION_ALREADY_SPECIFIED','R-A-5-02#0':'ENO_PAYMENT_INFO\x20(9)','R-RECIPIENT-03#0':'NO\x20chain\x20rejection\x20for\x20an\x20Entity\x20recipient\x20of\x20any\x20address\x20—\x20the\x20SDK\x20substitutes\x20the\x20default\x20local\x20account\x20before\x20the\x20address\x20reaches\x20the\x20on-chain\x20layer,\x20and\x20the\x20on-chain\x20allocation\x20swallows\x20a\x20Recipient::Entity\x20in\x20a\x20catch-all\x20at\x20declaration\x20while\x20the\x20payout\x20constructor\x20receives\x20the\x20raw\x20address\x20unchanged\x20(retracted\x202026-10-06:\x20there\x20is\x20no\x20ERECIPIENT_ZERO_ENTITY\x20constant;\x20no\x20such\x20abort\x20exists\x20on-chain)'},RELATED_GUARD_RISK={'R-A-2-01#0':'R-C3-06','R-A-3-04#0':'R-C3-06\x20(Signer\x20binding)\x20/\x20time-lock\x20patterns','R-A-4-01#0':'R-X1-05','R-A-4-03#0':'reentrancy\x20low'};export function allocationRiskFacts(b){const c=b['allocators_config'],d=!!c,e=d?c['allocators']:[];let f,g;if(d&&e['length']>0x0)for(let a4=0x0;a4<e['length'];a4++){if(e[a4]['sharing']['length']===0x0){f=a4,g=e[a4]['guard'];break;}}let h,j,k,l=![],n=![];if(d)for(let a5=0x0;a5<e['length'];a5++){const a6=e[a5],a7=a6['sharing']['some'](af=>af['mode']==='RateGross'),a8=a6['sharing']['filter'](af=>af['mode']==='Amount')['reduce']((af,ag)=>af+Number(ag['sharing']),0x0);if(a7&&a8>0x0)continue;const a9=a7&&a8===0x0&&a6['sharing']['some'](af=>af['mode']==='Rate'),aa=a6['sharing']['filter'](af=>af['mode']==='Rate'||a9&&af['mode']==='RateGross');if(aa['length']===0x0)continue;const ab=aa['map'](af=>Number(af['sharing']));if(ab['some'](af=>!Number['isFinite'](af)))continue;const ad=ab['reduce']((af,ag)=>af+ag,0x0),ae=a6['sharing']['some'](af=>af['mode']==='Surplus');if(!ae&&ad!==RATE_TOTAL_FULL){h=a5,j=a6['guard'],k=ad,l=!![];break;}if(ae&&ad>RATE_TOTAL_FULL){h=a5,j=a6['guard'],k=ad,n=!![];break;}}let o,p,q,r,t,u,v=![],w,x;if(d)for(let af=0x0;af<e['length'];af++){const ag=e[af],ah=ag['sharing']['some'](am=>am['mode']==='Rate'),ai=ag['sharing']['filter'](am=>am['mode']==='RateGross');if(ai['length']===0x0)continue;const aj=ag['sharing']['filter'](am=>am['mode']==='Amount')['reduce']((am,an)=>am+Number(an['sharing']),0x0);if(ah){if(aj>0x0){v=!![],w=af,x=ag['guard'];break;}continue;}const ak=ai['map'](am=>Number(am['sharing']));if(ak['some'](am=>!Number['isFinite'](am))||!Number['isFinite'](aj))continue;const al=ak['reduce']((am,an)=>am+an,0x0);if(al>RATE_TOTAL_FULL){o='sum_exceeds_10000',p=af,q=ag['guard'],r=al,t=aj;break;}if(ag['max']!=null){const am=Number(ag['max']);if(Number['isFinite'](am)&&aj*RATE_TOTAL_FULL+al*am>am*RATE_TOTAL_FULL){o='cap_fit',p=af,q=ag['guard'],r=al,t=aj,u=am;break;}}else{if(aj>0x0&&al>=RATE_TOTAL_FULL){o='fixed_full',p=af,q=ag['guard'],r=al,t=aj;break;}}}let y,z,A,B,C,D,E;if(d){const an=Number(c['threshold']);for(let ao=0x0;ao<e['length'];ao++){const ap=e[ao],aq=ap['sharing']['filter'](at=>at['mode']==='Surplus')['length'];if(aq>0x1){y='multiple_surplus',z=ao,A=ap['guard'],B=aq;break;}const ar=ap['sharing']['filter'](at=>at['mode']==='Amount')['reduce']((at,au)=>at+Number(au['sharing']),0x0),as=ap['sharing']['some'](at=>at['mode']==='Rate'||at['mode']==='Surplus'||at['mode']==='Formula');if(!as&&ar>0x0&&ar<an){y='below_threshold',z=ao,A=ap['guard'],C=ar,D=an;break;}if(ap['max']!=null&&ar>Number(ap['max'])){y='exceeds_max',z=ao,A=ap['guard'],C=ar,E=Number(ap['max']);break;}}}let F=![],G,H,I;if(d)for(let at=0x0;at<e['length'];at++){const au=e[at],av=au['sharing']['some'](ax=>'Signer'in ax['who']),aw=b['guard_signer_bindings']?.[au['guard']]===!![];if(isUnboundSignerTheft({'recipient_is_signer':av,'caller_identity_constrained':aw})){F=!![],G=at,H=au['guard'],I=aw;break;}}let J,K,L;if(d&&b['passport_identifier_types'])for(let ax=0x0;ax<e['length'];ax++){const ay=e[ax],az=ay['sharing']['find'](aC=>'GuardIdentifier'in aC['who']);if(!az)continue;const aA=az['who']['GuardIdentifier'],aB=b['passport_identifier_types'][aA];if(aB!==undefined&&aB!=='address'){J=aA,K=aB,L=ax;break;}}let M=![],N,O,P,Q;if(d){const aC=e['map'](aE=>aE['guard']),aD=new Set(aC);if(aD['size']!==aC['length']){const aE=aC['filter']((aF,aG)=>aC['indexOf'](aF)!==aG);M=!![],N=aC['length'],O=aD['size'],P=aE['join'](',\x20'),Q=aE['join'](',');}}const R=b['payment_info_for_object']!==undefined,S=d&&e['some'](aF=>aF['sharing']['some'](aG=>'GuardIdentifier'in aG['who'])),T=!!b['payment_info_for_object'];let U=![],V,W;if(d&&b['referenced_treasuries_permissions']&&b['host_service_permission'])for(const aF of e){for(const aG of aF['sharing']){if(!(aG['who']!==null&&typeof aG['who']==='object'&&'Entity'in aG['who']))continue;const aH=aG['who']['Entity'],aI=b['referenced_treasuries_permissions'][aH];if(aI&&aI!==b['host_service_permission']){U=!![],V=aH,W=aI;break;}}if(U)break;}let X;if(b['trigger_source']==='standalone'&&d){const aJ=[];for(const aK of e){const aL=b['guard_signer_bindings']?.[aK['guard']]===!![],aM=b['guard_has_time_lock']?.[aK['guard']]===!![];if(!aL&&!aM)aJ['push'](aK['guard']);}X=aJ;}let Y;if(d)for(let aN=0x0;aN<e['length'];aN++){const aO=e[aN],aP=aO['sharing']['length']>0x0&&aO['sharing']['every'](aQ=>aQ['mode']==='Amount');if(aP){Y=aN;break;}}let Z,a0,a1;if(d){const aQ=aS=>{if(aS!==null&&typeof aS==='object'){if('Entity'in aS)return'entity:'+String(aS['Entity'])['trim']()['toLowerCase']();if('GuardIdentifier'in aS)return'guard_identifier:'+Number(aS['GuardIdentifier']);if('Signer'in aS)return'signer';}return undefined;},aR=aS=>{if(aS!==null&&typeof aS==='object'){if('Entity'in aS)return'Entity('+aS['Entity']+')';if('GuardIdentifier'in aS)return'GuardIdentifier('+aS['GuardIdentifier']+')';if('Signer'in aS)return'Signer';}return String(aS);};for(let aS=0x0;aS<e['length'];aS++){const aT=e[aS],aU=new Set(aT['sharing']['filter'](aW=>aW['mode']==='Rate'||aW['mode']==='RateGross')['map'](aW=>aQ(aW['who']))['filter'](aW=>aW!==undefined));if(aU['size']===0x0)continue;const aV=aT['sharing']['find'](aW=>{if(aW['mode']!=='Surplus')return![];const aX=aQ(aW['who']);return aX!==undefined&&aU['has'](aX);});if(aV){Z=aS,a0=aT['guard'],a1=aR(aV['who']);break;}}}const a2=d?checkEntityRecipientsSync(c,{'builderAddress':b['builder_address']}):[],a3=a2['map'](aW=>'Allocator['+aW['allocator_index']+'].sharing['+aW['sharing_index']+']\x20('+aW['reason']+')');return{'allocators_config_present':d,'allocators_count':d?e['length']:undefined,'allocators_empty':d&&e['length']===0x0,'empty_sharing_allocator_index':f,'empty_sharing_allocator_guard':g,'rate_rule_index':h,'rate_rule_guard':j,'rate_rule_sum':k,'rate_rule_pure':l,'rate_rule_exceed':n,'rate_total_full':RATE_TOTAL_FULL,'rate_gross_branch':o,'rate_gross_index':p,'rate_gross_guard':q,'rate_gross_sum':r,'rate_gross_fix':t,'rate_gross_max':u,'mixed_rate_bases_present':v,'mixed_rate_bases_index':w,'mixed_rate_bases_guard':x,'amount_rule_branch':y,'amount_rule_index':z,'amount_rule_guard':A,'amount_rule_surplus_count':B,'amount_rule_amount_sum':C,'amount_rule_threshold':D,'amount_rule_max':E,'surplus_dup_rate_index':Z,'surplus_dup_rate_guard':a0,'surplus_dup_rate_recipient':a1,'signer_theft_detected':F,'signer_theft_index':G,'signer_theft_guard':H,'signer_theft_guard_bound':I,'guard_id_bad_identifier':J,'guard_id_bad_type':K,'guard_id_bad_index':L,'entity_recipient_bad_count':a2['length'],'entity_recipient_bad_count_display':String(a2['length']),'entity_recipient_bad_rows_csv_sp':a3['length']>0x0?a3['join'](',\x20'):undefined,'entity_recipient_bad_rows_csv':a3['length']>0x0?a3['join'](','):undefined,'duplicate_guards_present':M,'allocators_total':N,'allocators_unique':O,'duplicate_guards_csv_sp':P,'duplicate_guards_csv':Q,'for_object_anchor_known':R,'guard_identifier_recipient_present':S,'for_object_anchor_set':T,'for_object_anchor':R&&T?b['payment_info_for_object']??undefined:undefined,'host_service_published':b['host_service_published'],'treasury_perm_mismatch':U,'treasury_perm_entity':V,'treasury_perm_treasury':W,'host_service_permission':b['host_service_permission'],'allocation_create_op':b['operation_type']==='create','allocation_standalone':b['trigger_source']==='standalone','trigger_source_display':b['trigger_source']??'unknown','standalone_weak_guards_count':X?.['length'],'standalone_weak_guards_csv_sp':X?.['join'](',\x20'),'standalone_weak_guards_csv':X?.['join'](','),'has_fallback_allocator':b['has_fallback_allocator'],'guard_conditions_mutually_exclusive':b['guard_conditions_mutually_exclusive'],'has_fallback_allocator_display':String(b['has_fallback_allocator']??![]),'mutually_exclusive_display':String(b['guard_conditions_mutually_exclusive']??![]),'pure_amount_index':Y,'order_already_has_allocation':b['order_already_has_allocation'],'bound_order_display':b['bound_order']??'unknown','bound_order_paren_display':b['bound_order']??'(unknown)','has_payment_info':b['has_payment_info'],'operation_type':b['operation_type'],'max_allocator_count':MAX_ALLOCATOR_COUNT};}function allocationRuleBook(){const a=getJudgmentDoc()['rules']['domains']['allocation'];if(!a)throw new Error('factory\x20rule\x20pack\x20\x27allocation\x27\x20missing\x20—\x20broken\x20installation');return a['rules'];}function firedCaseKey(a,b,c){const d=a['find'](e=>e['rule_id']===c);if(d)for(let e=0x0;e<d['cases']['length'];e++){if(evaluateCondition(d['cases'][e]['when'],b))return c+'#'+e;}return c+'#0';}function findingToAllocationRisk(a,b){const c=RELATED_MOVE_ERROR[b],d=RELATED_GUARD_RISK[b];return{'id':a['rule_id'],'level':a['level'],'category':a['dimension']??'structural','title':a['title'],'description':a['description'],'affected_stakeholders':a['stakeholders']??[],'scenario':a['scenario']??'','mitigation':a['mitigation']??'','evidence':a['evidence'],...c!==undefined?{'related_move_error':c}:{},...d!==undefined?{'related_guard_risk':d}:{},'auto_fixable':AUTO_FIXABLE['has'](b),...a['exposure']!=null?{'exposure':a['exposure']}:{}};}export const ALLOCATION_RISK_VERSION='1.2.0';export function getAllRiskRules(){const a=factoryRulePack('allocation');if(!a)return[];return a['rules']['map'](b=>({'id':b['rule_id'],'category':b['dimension']??'structural','trigger':b['trigger']??'','check':c=>{const d=allocationRiskFacts(c),{findings:e}=evaluateRuleBook([b],d);return e['length']>0x0?findingToAllocationRisk(e[0x0],firedCaseKey([b],d,b['rule_id'])):null;}}));}export function assessAllocationRisks(a){const b=allocationRuleBook(),c=allocationRiskFacts(a),{findings:d}=evaluateRuleBook(b,c),e=d['map'](j=>findingToAllocationRisk(j,firedCaseKey(b,c,j['rule_id']))),f=e['length']===0x0?'low':e['some'](j=>j['level']==='critical')?'critical':e['some'](j=>j['level']==='high')?'high':e['some'](j=>j['level']==='medium')?'medium':'low',g={},h={};for(const j of e){g[j['category']]=(g[j['category']]??0x0)+0x1,h[j['level']]=(h[j['level']]??0x0)+0x1;}const i={};for(const k of e){for(const l of k['affected_stakeholders']){if(!i[l])i[l]=[];i[l]['push'](k['id']+':\x20'+k['mitigation']);}}return{'summary':'Assessed\x20'+e['length']+'\x20risk(s)\x20across\x20'+Object['keys'](g)['length']+'\x20categories','risks':e,'overall_risk':f,'risks_by_category':g,'risks_by_level':h,'stakeholder_advice':i,'needs_human_review':e['some'](m=>m['level']==='critical'||m['level']==='high'),'blocks_publish':e['some'](m=>m['level']==='critical')};}export{ALLOCATION_ERROR_CODES};
|
|
1
|
+
import{MAX_ALLOCATOR_COUNT,RATE_TOTAL_FULL,ALLOCATION_ERROR_CODES}from'./allocation-ledger.js';import{isUnboundSignerTheft}from'./recipient-constraint.js';import{checkEntityRecipientsSync}from'./entity-recipient-guard.js';import{getJudgmentDoc,factoryRulePack}from'../config/judgment.js';import{evaluateRuleBook,evaluateCondition}from'../config/rule-engine.js';const AUTO_FIXABLE=new Set(['R-A-1-02#0','R-A-1-02#1','R-A-1-02#2','R-A-1-02#3','R-A-1-02#4','R-A-1-03#0','R-A-1-03#2','R-A-2-03#0','R-A-5-03#0']),RELATED_MOVE_ERROR={'R-A-1-01#0':'EALLOCATORS_EMPTY\x20(8)\x20/\x20ENO_ALLOCATOR\x20(3)','R-A-1-01#1':'ENO_ALLOCATOR\x20(3)','R-A-1-02#0':'ERATE_NOT_10000\x20(4)','R-A-1-02#1':'ERATE_EXCEEDS_10000\x20(6)','R-A-1-02#2':'ERATE_EXCEEDS_10000\x20(6)','R-A-1-02#3':'ERATE_EXCEEDS_10000\x20(6)','R-A-1-02#4':'ERATE_EXCEEDS_10000\x20(6)','R-A-1-02#5':'EMIXED_RATE_BASES\x20(17)','R-A-1-03#0':'EMULTIPLE_SURPLUS\x20(5)','R-A-1-04#0':'NO\x20chain\x20rejection\x20—\x20allocation\x20pays\x20Rate\x20legs\x20then\x20the\x20Surplus\x20remainder\x20verbatim,\x20and\x20order_allocators\x20freezes\x20at\x20Service\x20publish\x20(E_ALREADY_PUBLISHED\x20=\x206),\x20so\x20the\x20misrouted\x20share\x20is\x20permanent','R-A-1-03#1':'EAMOUNT_BELOW_THRESHOLD\x20(12)','R-A-1-03#2':'EAMOUNT_EXCEEDS_MAX\x20(13)','R-A-2-02#0':'ERECIPIENT_IDENTIFIER_NOT_ADDRESS\x20(1)','R-A-2-04#0':'ERECIPIENT_NOT_FOR_OBJECT\x20(15)','R-A-2-04#1':'NO\x20chain\x20rejection\x20when\x20the\x20anchor\x20is\x20None\x20—\x20the\x20on-chain\x20allocation\x20only\x20asserts\x20ERECIPIENT_NOT_FOR_OBJECT\x20(15)\x20when\x20an\x20anchor\x20is\x20present,\x20and\x20the\x20on-chain\x20design\x20hands\x20the\x20due-diligence\x20obligation\x20to\x20this\x20tooling\x20layer;\x20order\x20and\x20arbitration\x20flows\x20always\x20anchor,\x20so\x20None\x20is\x20reachable\x20only\x20via\x20standalone/custom\x20PaymentInfo','R-A-2-04#2':'a\x20submission\x20that\x20MATCHES\x20the\x20anchor\x20pays\x20the\x20anchor\x20object\x20by\x20design\x20(order\x20/\x20arbitration\x20refunds):\x20the\x20CoinWrapper\x20is\x20transferred\x20to\x20the\x20bound\x20object\x20and\x20the\x20Order\x27s\x20owner-claim\x20entry\x20extracts\x20it\x20to\x20order.owner\x20at\x20extraction\x20time\x20(an\x20ownership\x20change\x20is\x20followed;\x20any\x20keeper\x20may\x20drive\x20step\x202).\x20A\x20MISMATCHED\x20submission\x20aborts\x20ERECIPIENT_NOT_FOR_OBJECT\x20(15)\x20—\x20that\x20is\x20the\x20cross-order\x20redirect\x20guard,\x20not\x20a\x20ban\x20on\x20the\x20shape','R-A-5-01#0':'E_ALLOCATION_ALREADY_SPECIFIED','R-A-5-02#0':'ENO_PAYMENT_INFO\x20(9)','R-RECIPIENT-03#0':'NO\x20chain\x20rejection\x20for\x20an\x20Entity\x20recipient\x20of\x20any\x20address\x20—\x20the\x20SDK\x20substitutes\x20the\x20default\x20local\x20account\x20before\x20the\x20address\x20reaches\x20the\x20on-chain\x20layer,\x20and\x20the\x20on-chain\x20allocation\x20swallows\x20a\x20Recipient::Entity\x20in\x20a\x20catch-all\x20at\x20declaration\x20while\x20the\x20payout\x20constructor\x20receives\x20the\x20raw\x20address\x20unchanged\x20(retracted\x202026-10-06:\x20there\x20is\x20no\x20ERECIPIENT_ZERO_ENTITY\x20constant;\x20no\x20such\x20abort\x20exists\x20on-chain)'};export const STUCK_POOL_REMEDY='REMEDY\x20(protocol-builtin):\x20a\x20missing\x20fund-exit\x20leg\x20can\x20be\x20added\x20post-publish\x20via\x20'+'operation\x20order_allocators_append\x20(permission\x20index\x20313,\x20'+'J1\x20append-only\x20window\x20—\x20prior\x20legs\x20are\x20preserved;\x20a\x20WRONG\x20leg\x20cannot\x20be\x20repaired\x20this\x20way,\x20'+'only\x20a\x20MISSING\x20leg\x20can\x20be\x20added).\x20Configure\x20the\x20new\x20leg\x27s\x20guard\x20to\x20open\x20under\x20consensus\x20'+'(e.g.\x20a\x20refund\x20leg\x20keyed\x20to\x20the\x20buyer\x27s\x20dispute\x20window).\x20There\x20is\x20NO\x20other\x20exit:\x20any\x20'+'guard-bypassing\x20drain\x20is\x20a\x20backdoor\x20by\x20construction\x20—\x20the\x20chain\x20preserves\x20prior\x20legs\x20'+'verbatim\x20and\x20re-asserts\x20old-leg\x20drift\x20—\x20and\x20is\x20permanently\x20disapproved.';const RELATED_GUARD_RISK={'R-A-2-01#0':'R-C3-06','R-A-3-04#0':'R-C3-06\x20(Signer\x20binding)\x20/\x20time-lock\x20patterns','R-A-4-01#0':'R-X1-05','R-A-4-03#0':'reentrancy\x20low'};export function allocationRiskFacts(b){const c=b['allocators_config'],d=!!c,e=d?c['allocators']:[];let f,g;if(d&&e['length']>0x0)for(let a4=0x0;a4<e['length'];a4++){if(e[a4]['sharing']['length']===0x0){f=a4,g=e[a4]['guard'];break;}}let h,j,k,l=![],n=![];if(d)for(let a5=0x0;a5<e['length'];a5++){const a6=e[a5],a7=a6['sharing']['some'](af=>af['mode']==='RateGross'),a8=a6['sharing']['filter'](af=>af['mode']==='Amount')['reduce']((af,ag)=>af+Number(ag['sharing']),0x0);if(a7&&a8>0x0)continue;const a9=a7&&a8===0x0&&a6['sharing']['some'](af=>af['mode']==='Rate'),aa=a6['sharing']['filter'](af=>af['mode']==='Rate'||a9&&af['mode']==='RateGross');if(aa['length']===0x0)continue;const ab=aa['map'](af=>Number(af['sharing']));if(ab['some'](af=>!Number['isFinite'](af)))continue;const ad=ab['reduce']((af,ag)=>af+ag,0x0),ae=a6['sharing']['some'](af=>af['mode']==='Surplus');if(!ae&&ad!==RATE_TOTAL_FULL){h=a5,j=a6['guard'],k=ad,l=!![];break;}if(ae&&ad>RATE_TOTAL_FULL){h=a5,j=a6['guard'],k=ad,n=!![];break;}}let o,p,q,r,t,u,v=![],w,x;if(d)for(let af=0x0;af<e['length'];af++){const ag=e[af],ah=ag['sharing']['some'](am=>am['mode']==='Rate'),ai=ag['sharing']['filter'](am=>am['mode']==='RateGross');if(ai['length']===0x0)continue;const aj=ag['sharing']['filter'](am=>am['mode']==='Amount')['reduce']((am,an)=>am+Number(an['sharing']),0x0);if(ah){if(aj>0x0){v=!![],w=af,x=ag['guard'];break;}continue;}const ak=ai['map'](am=>Number(am['sharing']));if(ak['some'](am=>!Number['isFinite'](am))||!Number['isFinite'](aj))continue;const al=ak['reduce']((am,an)=>am+an,0x0);if(al>RATE_TOTAL_FULL){o='sum_exceeds_10000',p=af,q=ag['guard'],r=al,t=aj;break;}if(ag['max']!=null){const am=Number(ag['max']);if(Number['isFinite'](am)&&aj*RATE_TOTAL_FULL+al*am>am*RATE_TOTAL_FULL){o='cap_fit',p=af,q=ag['guard'],r=al,t=aj,u=am;break;}}else{if(aj>0x0&&al>=RATE_TOTAL_FULL){o='fixed_full',p=af,q=ag['guard'],r=al,t=aj;break;}}}let y,z,A,B,C,D,E;if(d){const an=Number(c['threshold']);for(let ao=0x0;ao<e['length'];ao++){const ap=e[ao],aq=ap['sharing']['filter'](at=>at['mode']==='Surplus')['length'];if(aq>0x1){y='multiple_surplus',z=ao,A=ap['guard'],B=aq;break;}const ar=ap['sharing']['filter'](at=>at['mode']==='Amount')['reduce']((at,au)=>at+Number(au['sharing']),0x0),as=ap['sharing']['some'](at=>at['mode']==='Rate'||at['mode']==='Surplus'||at['mode']==='Formula');if(!as&&ar>0x0&&ar<an){y='below_threshold',z=ao,A=ap['guard'],C=ar,D=an;break;}if(ap['max']!=null&&ar>Number(ap['max'])){y='exceeds_max',z=ao,A=ap['guard'],C=ar,E=Number(ap['max']);break;}}}let F=![],G,H,I;if(d)for(let at=0x0;at<e['length'];at++){const au=e[at],av=au['sharing']['some'](ax=>'Signer'in ax['who']),aw=b['guard_signer_bindings']?.[au['guard']]===!![];if(isUnboundSignerTheft({'recipient_is_signer':av,'caller_identity_constrained':aw})){F=!![],G=at,H=au['guard'],I=aw;break;}}let J,K,L;if(d&&b['passport_identifier_types'])for(let ax=0x0;ax<e['length'];ax++){const ay=e[ax],az=ay['sharing']['find'](aC=>'GuardIdentifier'in aC['who']);if(!az)continue;const aA=az['who']['GuardIdentifier'],aB=b['passport_identifier_types'][aA];if(aB!==undefined&&aB!=='address'){J=aA,K=aB,L=ax;break;}}let M=![],N,O,P,Q;if(d){const aC=e['map'](aE=>aE['guard']),aD=new Set(aC);if(aD['size']!==aC['length']){const aE=aC['filter']((aF,aG)=>aC['indexOf'](aF)!==aG);M=!![],N=aC['length'],O=aD['size'],P=aE['join'](',\x20'),Q=aE['join'](',');}}const R=b['payment_info_for_object']!==undefined,S=d&&e['some'](aF=>aF['sharing']['some'](aG=>'GuardIdentifier'in aG['who'])),T=!!b['payment_info_for_object'];let U=![],V,W;if(d&&b['referenced_treasuries_permissions']&&b['host_service_permission'])for(const aF of e){for(const aG of aF['sharing']){if(!(aG['who']!==null&&typeof aG['who']==='object'&&'Entity'in aG['who']))continue;const aH=aG['who']['Entity'],aI=b['referenced_treasuries_permissions'][aH];if(aI&&aI!==b['host_service_permission']){U=!![],V=aH,W=aI;break;}}if(U)break;}let X;if(b['trigger_source']==='standalone'&&d){const aJ=[];for(const aK of e){const aL=b['guard_signer_bindings']?.[aK['guard']]===!![],aM=b['guard_has_time_lock']?.[aK['guard']]===!![];if(!aL&&!aM)aJ['push'](aK['guard']);}X=aJ;}let Y;if(d)for(let aN=0x0;aN<e['length'];aN++){const aO=e[aN],aP=aO['sharing']['length']>0x0&&aO['sharing']['every'](aQ=>aQ['mode']==='Amount');if(aP){Y=aN;break;}}let Z,a0,a1;if(d){const aQ=aS=>{if(aS!==null&&typeof aS==='object'){if('Entity'in aS)return'entity:'+String(aS['Entity'])['trim']()['toLowerCase']();if('GuardIdentifier'in aS)return'guard_identifier:'+Number(aS['GuardIdentifier']);if('Signer'in aS)return'signer';}return undefined;},aR=aS=>{if(aS!==null&&typeof aS==='object'){if('Entity'in aS)return'Entity('+aS['Entity']+')';if('GuardIdentifier'in aS)return'GuardIdentifier('+aS['GuardIdentifier']+')';if('Signer'in aS)return'Signer';}return String(aS);};for(let aS=0x0;aS<e['length'];aS++){const aT=e[aS],aU=new Set(aT['sharing']['filter'](aW=>aW['mode']==='Rate'||aW['mode']==='RateGross')['map'](aW=>aQ(aW['who']))['filter'](aW=>aW!==undefined));if(aU['size']===0x0)continue;const aV=aT['sharing']['find'](aW=>{if(aW['mode']!=='Surplus')return![];const aX=aQ(aW['who']);return aX!==undefined&&aU['has'](aX);});if(aV){Z=aS,a0=aT['guard'],a1=aR(aV['who']);break;}}}const a2=d?checkEntityRecipientsSync(c,{'builderAddress':b['builder_address']}):[],a3=a2['map'](aW=>'Allocator['+aW['allocator_index']+'].sharing['+aW['sharing_index']+']\x20('+aW['reason']+')');return{'allocators_config_present':d,'allocators_count':d?e['length']:undefined,'allocators_empty':d&&e['length']===0x0,'empty_sharing_allocator_index':f,'empty_sharing_allocator_guard':g,'rate_rule_index':h,'rate_rule_guard':j,'rate_rule_sum':k,'rate_rule_pure':l,'rate_rule_exceed':n,'rate_total_full':RATE_TOTAL_FULL,'rate_gross_branch':o,'rate_gross_index':p,'rate_gross_guard':q,'rate_gross_sum':r,'rate_gross_fix':t,'rate_gross_max':u,'mixed_rate_bases_present':v,'mixed_rate_bases_index':w,'mixed_rate_bases_guard':x,'amount_rule_branch':y,'amount_rule_index':z,'amount_rule_guard':A,'amount_rule_surplus_count':B,'amount_rule_amount_sum':C,'amount_rule_threshold':D,'amount_rule_max':E,'surplus_dup_rate_index':Z,'surplus_dup_rate_guard':a0,'surplus_dup_rate_recipient':a1,'signer_theft_detected':F,'signer_theft_index':G,'signer_theft_guard':H,'signer_theft_guard_bound':I,'guard_id_bad_identifier':J,'guard_id_bad_type':K,'guard_id_bad_index':L,'entity_recipient_bad_count':a2['length'],'entity_recipient_bad_count_display':String(a2['length']),'entity_recipient_bad_rows_csv_sp':a3['length']>0x0?a3['join'](',\x20'):undefined,'entity_recipient_bad_rows_csv':a3['length']>0x0?a3['join'](','):undefined,'duplicate_guards_present':M,'allocators_total':N,'allocators_unique':O,'duplicate_guards_csv_sp':P,'duplicate_guards_csv':Q,'for_object_anchor_known':R,'guard_identifier_recipient_present':S,'for_object_anchor_set':T,'for_object_anchor':R&&T?b['payment_info_for_object']??undefined:undefined,'host_service_published':b['host_service_published'],'treasury_perm_mismatch':U,'treasury_perm_entity':V,'treasury_perm_treasury':W,'host_service_permission':b['host_service_permission'],'allocation_create_op':b['operation_type']==='create','allocation_standalone':b['trigger_source']==='standalone','trigger_source_display':b['trigger_source']??'unknown','standalone_weak_guards_count':X?.['length'],'standalone_weak_guards_csv_sp':X?.['join'](',\x20'),'standalone_weak_guards_csv':X?.['join'](','),'has_fallback_allocator':b['has_fallback_allocator'],'guard_conditions_mutually_exclusive':b['guard_conditions_mutually_exclusive'],'has_fallback_allocator_display':String(b['has_fallback_allocator']??![]),'mutually_exclusive_display':String(b['guard_conditions_mutually_exclusive']??![]),'pure_amount_index':Y,'order_already_has_allocation':b['order_already_has_allocation'],'bound_order_display':b['bound_order']??'unknown','bound_order_paren_display':b['bound_order']??'(unknown)','has_payment_info':b['has_payment_info'],'operation_type':b['operation_type'],'max_allocator_count':MAX_ALLOCATOR_COUNT};}function allocationRuleBook(){const a=getJudgmentDoc()['rules']['domains']['allocation'];if(!a)throw new Error('factory\x20rule\x20pack\x20\x27allocation\x27\x20missing\x20—\x20broken\x20installation');return a['rules'];}function firedCaseKey(a,b,c){const d=a['find'](e=>e['rule_id']===c);if(d)for(let e=0x0;e<d['cases']['length'];e++){if(evaluateCondition(d['cases'][e]['when'],b))return c+'#'+e;}return c+'#0';}function findingToAllocationRisk(a,b){const c=RELATED_MOVE_ERROR[b],d=RELATED_GUARD_RISK[b];return{'id':a['rule_id'],'level':a['level'],'category':a['dimension']??'structural','title':a['title'],'description':a['description'],'affected_stakeholders':a['stakeholders']??[],'scenario':a['scenario']??'','mitigation':a['mitigation']??'','evidence':a['evidence'],...c!==undefined?{'related_move_error':c}:{},...d!==undefined?{'related_guard_risk':d}:{},'auto_fixable':AUTO_FIXABLE['has'](b),...a['exposure']!=null?{'exposure':a['exposure']}:{}};}export const ALLOCATION_RISK_VERSION='1.2.0';export function getAllRiskRules(){const a=factoryRulePack('allocation');if(!a)return[];return a['rules']['map'](b=>({'id':b['rule_id'],'category':b['dimension']??'structural','trigger':b['trigger']??'','check':c=>{const d=allocationRiskFacts(c),{findings:e}=evaluateRuleBook([b],d);return e['length']>0x0?findingToAllocationRisk(e[0x0],firedCaseKey([b],d,b['rule_id'])):null;}}));}export function assessAllocationRisks(a){const b=allocationRuleBook(),c=allocationRiskFacts(a),{findings:d}=evaluateRuleBook(b,c),e=d['map'](j=>findingToAllocationRisk(j,firedCaseKey(b,c,j['rule_id']))),f=e['length']===0x0?'low':e['some'](j=>j['level']==='critical')?'critical':e['some'](j=>j['level']==='high')?'high':e['some'](j=>j['level']==='medium')?'medium':'low',g={},h={};for(const j of e){g[j['category']]=(g[j['category']]??0x0)+0x1,h[j['level']]=(h[j['level']]??0x0)+0x1;}const i={};for(const k of e){for(const l of k['affected_stakeholders']){if(!i[l])i[l]=[];i[l]['push'](k['id']+':\x20'+k['mitigation']);}}return{'summary':'Assessed\x20'+e['length']+'\x20risk(s)\x20across\x20'+Object['keys'](g)['length']+'\x20categories','risks':e,'overall_risk':f,'risks_by_category':g,'risks_by_level':h,'stakeholder_advice':i,'needs_human_review':e['some'](m=>m['level']==='critical'||m['level']==='high'),'blocks_publish':e['some'](m=>m['level']==='critical')};}export{ALLOCATION_ERROR_CODES};
|
|
@@ -20,19 +20,24 @@ export interface RailGuardInput {
|
|
|
20
20
|
key: string;
|
|
21
21
|
track: "settlement" | "refund";
|
|
22
22
|
table: unknown[];
|
|
23
|
+
recoverTwin?: boolean;
|
|
23
24
|
root?: unknown;
|
|
24
25
|
}
|
|
25
26
|
export interface RailNodeInput {
|
|
26
27
|
name: string;
|
|
27
28
|
semanticRole?: string;
|
|
29
|
+
fromNodes?: string[];
|
|
28
30
|
}
|
|
29
|
-
export type RailFindingCode = "RAIL_TERMINAL_UNCOVERED" | "RAIL_AWARD_EXIT_MISSING" | "
|
|
31
|
+
export type RailFindingCode = "RAIL_TERMINAL_UNCOVERED" | "RAIL_AWARD_EXIT_MISSING" | "RAIL_CLAIMED_BY_LEG" | "RAIL_DEAD_LITERAL" | "RAIL_NO_CALLER_IDENTITY_BOUND" | "RAIL_NO_CALLER_IDENTITY" | "REFUND_RAIL_REPLAY_DISCLOSURE";
|
|
30
32
|
export type RailFindingLevel = "critical" | "info";
|
|
31
33
|
export interface RailFinding {
|
|
32
34
|
code: RailFindingCode;
|
|
33
35
|
level: RailFindingLevel;
|
|
34
36
|
detail: string;
|
|
37
|
+
railKey?: string;
|
|
35
38
|
}
|
|
39
|
+
export declare function hasCallerIdentityLeg(tree: unknown): boolean;
|
|
36
40
|
export declare function verifyAllocatorRails(guards: RailGuardInput[], nodes: RailNodeInput[], opts?: {
|
|
37
41
|
arbitrationBound?: boolean;
|
|
42
|
+
declaredKeys?: ReadonlySet<string>;
|
|
38
43
|
}): RailFinding[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const SYM_NODE='progress.current',SYM_CLAIMED='order.claimed_by\x20some';function slotValue(a,b){if(b===undefined)return{'value':undefined,'isSubmission':![]};const c=a['find'](d=>d['identifier']===b);if(!c)return{'value':undefined,'isSubmission':![]};return{'value':c['value'],'isSubmission':c['b_submission']===!![]};}function classifyQueryLhs(a){if(a===SYM_NODE)return{'kind':'node'};if(a===SYM_CLAIMED)return{'kind':'claimed'};return{'kind':'unknown'};}function resolveValue(a,b){if(!b||b['type']!=='identifier')return{'known':![]};const c=slotValue(a,b['identifier']);if(c['isSubmission'])return{'known':![]};if(c['value']===undefined)return{'known':![]};return{'known':!![],'value':c['value']};}function evaluate(a,b,d){if(!b||typeof b['type']!=='string')return undefined;switch(b['type']){case'logic_and':{const e=Array['isArray'](b['nodes'])?b['nodes']:[];let f=![];for(const g of e){const h=evaluate(a,g,d);if(h===![])return![];if(h===undefined)f=!![];}return f?undefined:!![];}case'logic_or':{const i=Array['isArray'](b['nodes'])?b['nodes']:[];let j=![];for(const k of i){const l=evaluate(a,k,d);if(l===!![])return!![];if(l===undefined)j=!![];}return j?undefined:![];}case'logic_not':{const m=evaluate(a,b['node'],d);if(m===undefined)return undefined;return!m;}case'logic_equal':{const n=Array['isArray'](b['nodes'])?b['nodes']:[];if(n['length']<0x2)return undefined;const o=classifyQueryLhs(n[0x0]?.['query']),p=resolveValue(a,n[0x1]),q=o['kind']==='unknown'?classifyQueryLhs(n[0x1]?.['query']):o,r=!p['known']&&n[0x1]?.['query']!==undefined?resolveValue(a,n[0x0]):p;if(q['kind']==='node'){if(!r['known']||typeof r['value']!=='string')return undefined;return d['node']===r['value'];}if(q['kind']==='claimed'){if(!r['known']||typeof r['value']!=='boolean')return undefined;return d['claimed']===r['value'];}return undefined;}default:return undefined;}}function satisfiable(a,b,c){return evaluate(a,b,c)!==![];}function findDeadLiterals(a,b,c,d){if(!a||typeof a['type']!=='string')return;if(a['type']==='logic_and'&&Array['isArray'](a['nodes'])){const e=new Map();for(const f of a['nodes']){const g=resolvableEquality(f,b);if(g)e['set'](g['symbol'],g['value']);}for(const h of a['nodes']){const i=resolvableEquality(h,b);if(i){const k=e['get'](i['symbol']);if(k!==undefined&&k!==i['value']){d['push']({'code':'RAIL_DEAD_LITERAL','level':'critical','detail':deadLiteralDetail(c,i['symbol'],k,i['value'])});return;}continue;}const j=findClash(h,b,e);if(j){d['push']({'code':'RAIL_DEAD_LITERAL','level':'critical','detail':deadLiteralDetail(c,j['symbol'],j['pinned'],j['value'])});return;}}for(const l of a['nodes'])findDeadLiterals(l,b,c,d);return;}if(Array['isArray'](a['nodes'])){for(const m of a['nodes'])findDeadLiterals(m,b,c,d);}if(a['node'])findDeadLiterals(a['node'],b,c,d);}function resolvableEquality(c,d){if(!c||c['type']!=='logic_equal'||!Array['isArray'](c['nodes']))return undefined;for(const [e,f]of[[c['nodes'][0x0],c['nodes'][0x1]],[c['nodes'][0x1],c['nodes'][0x0]]]){if(!e||typeof e['query']!=='string')continue;const g=classifyQueryLhs(e['query']);if(g['kind']==='unknown')continue;const h=resolveValue(d,f);if(!h['known'])continue;return{'symbol':g['kind']==='node'?SYM_NODE:SYM_CLAIMED,'value':h['value']};}return undefined;}function findClash(a,b,c){if(!a||typeof a['type']!=='string')return undefined;if(a['type']==='logic_not')return undefined;const d=resolvableEquality(a,b);if(d){const e=c['get'](d['symbol']);if(e!==undefined&&e!==d['value'])return{'symbol':d['symbol'],'pinned':e,'value':d['value']};return undefined;}if(Array['isArray'](a['nodes']))for(const f of a['nodes']){const g=findClash(f,b,c);if(g)return g;}if(a['node'])return findClash(a['node'],b,c);return undefined;}function deadLiteralDetail(a,b,c,d){return'allocator\x20guard\x20\x27'+a+'\x27:\x20one\x20conjunction\x20scope\x20carries\x20'+b+'\x20'+('==\x20'+JSON['stringify'](c)+'\x20and\x20ALSO\x20'+b+'\x20==\x20'+JSON['stringify'](d)+'\x20—\x20the\x20second\x20')+'literal\x20contradicts\x20the\x20first\x20and\x20is\x20a\x20DEAD\x20literal\x20(azx7-mn-261014\x20CR-azx7-01:\x20a\x20pinned\x20'+'node\x20equality\x20made\x20the\x20sibling\x20closed_cancel/item_lost\x20legs\x20unreachable,\x20stranding\x20the\x20'+'escrow\x20at\x20every\x20other\x20terminal).\x20Hoist\x20the\x20node\x20predicate\x20to\x20ONE\x20top-level\x20n-ary\x20logic_or\x20'+'instead\x20of\x20AND-prepending\x20a\x20single-node\x20gate.';}function hasArbitrationEvidenceLeg(a){if(!a||typeof a!=='object')return![];const b=a;if(typeof b['query']==='string'){const d=b['query'];return d['startsWith']('arb.')||d['startsWith']('order.dispute');}if(Array['isArray'](b['nodes'])){for(const e of b['nodes'])if(hasArbitrationEvidenceLeg(e))return!![];}if(b['node']&&hasArbitrationEvidenceLeg(b['node']))return!![];return![];}export function verifyAllocatorRails(a,b,c){const d=[];if(a['length']===0x0)return d;if(c?.['arbitrationBound']===!![]){const j=a['filter'](k=>k['track']==='refund'&&k['root']!==undefined&&!hasArbitrationEvidenceLeg(k['root']))['map'](k=>k['key']);j['length']>0x0&&d['push']({'code':'RAIL_RULING_WINDOW','level':'info','detail':'refund\x20rail(s)\x20['+j['join'](',\x20')+']\x20carry\x20no\x20arbitration-side\x20evidence\x20leg\x20'+'(arb.*\x20/\x20order.dispute*)\x20—\x20the\x20\x22ruled\x20but\x20unclaimed\x22\x20window\x20stays\x20open:\x20after\x20a\x20'+'buyer-favored\x20ruling\x20awards\x20compensation\x20but\x20BEFORE\x20the\x20claim/conclude\x20stamps\x20'+'order.claimed_by,\x20the\x20claimed_by-none\x20refund\x20route\x20can\x20still\x20drain\x20the\x20escrow\x20'+'(dual-track\x20overlap\x20is\x20a\x20LEGITIMATE\x20chain-allowed\x20commercial\x20shape\x20—\x20disclosure,\x20not\x20a\x20violation).\x20To\x20close\x20it,\x20gate\x20the\x20rail\x20'+'on\x20ruling\x20evidence\x20(arb.indemnity\x20legs)\x20—\x20buildable\x20ONLY\x20when\x20this\x20rail\x20is\x20reachable\x20'+'exclusively\x20from\x20dispute-state\x20nodes,\x20or\x20sequence\x20the\x20edge\x20behind\x20the\x20claimed_by\x20stamp\x20'+'(tpl_forward_arb_ruling_won/dismissed\x204R-03b\x20form).\x20See\x20pattern.arb_status_escrow_holdback.'});}if(b['length']===0x0)return d;const e=b['filter'](k=>k['semanticRole']==='cancelled'||k['semanticRole']==='final'),f=b['map'](k=>({'node':k['name'],'claimed':!![]}));for(const k of a){if(k['root']===undefined)continue;const l=k['table'];findDeadLiterals(k['root'],l,k['key'],d);}for(const m of e){const n={'node':m['name'],'claimed':![]},o=a['some'](p=>satisfiable(p['table'],p['root'],n));!o&&d['push']({'code':'RAIL_TERMINAL_UNCOVERED','level':'critical','detail':'terminal\x20node\x20\x27'+m['name']+'\x27\x20(role\x20'+m['semanticRole']+')\x20has\x20NO\x20allocator\x20rail\x20'+'satisfiable\x20at\x20claimed_by=none\x20—\x20a\x20normal\x20(unclaimed)\x20order\x20reaching\x20this\x20'+'terminal\x20strands\x20its\x20escrow\x20forever\x20(azx7-mn-261014\x20CR-azx7-01:\x20refund\x20'+'rejected\x20abort\x207\x20at\x20closed_cancel/item_lost;\x20crs-mn-261014\x20F-30:\x20double-'+'negated\x20claimed_by\x20leg\x20bricked\x20the\x20refund\x20at\x20returned).\x20Guards/allocators\x20'+'freeze\x20at\x20publish\x20—\x20fix\x20the\x20rail\x20polarity/node-set\x20BEFORE\x20publishing.'});}const h=a['some'](p=>f['some'](q=>satisfiable(p['table'],p['root'],q)));!h&&d['push']({'code':'RAIL_AWARD_EXIT_MISSING','level':'critical','detail':'no\x20allocator\x20rail\x20is\x20satisfiable\x20at\x20claimed_by=some\x20on\x20ANY\x20machine\x20node\x20—\x20an\x20'+'arbitration-paid\x20order\x20has\x20NO\x20escrow\x20exit\x20(escrow-exit\x20invariant,\x20az-mn-261007).\x20'+'Pair\x20the\x20refund\x20rail\x20with\x20a\x20merchant-recovery\x20allocator\x20asserting\x20order.claimed_by\x20'+'some\x20==\x20true\x20(query\x201570)\x20on\x20the\x20post-delivery\x20node\x20set.\x20R2-05\x20DISMISSAL-STAMP\x20CAUTION\x20'+'(alg26-tn-261026\x20O11):\x20a\x20concluded\x20DISMISSAL\x20(indemnity=0)\x20ALSO\x20stamps\x20order.claimed_by\x20'+'(permissionless\x20keeper\x20conclude;\x20on\x20protocol\x20>=\x20154\x20the\x20ruled-zero\x20'+'seal\x20closes\x20claimed_by-none\x20refund\x20rails\x20BY\x20DESIGN,\x20F-BS-54/56).\x20A\x20recover\x20rail\x20discriminated\x20'+'ONLY\x20on\x20the\x20bare\x20order\x20stamp\x20routes\x20to\x20its\x20STATIC\x20recipient\x20regardless\x20of\x20the\x20ruling\x20direction\x20—\x20'+'under\x20a\x20dismissal\x20that\x20static\x20recipient\x20can\x20be\x20the\x20LOSING\x20party\x20(O11:\x20assignee\x20took\x200.15\x20after\x20'+'losing).\x20Split\x20the\x20recover\x20rail\x20by\x20arb\x20outcome\x20or\x20bind\x20its\x20recipient\x20to\x20the\x20winning\x20side\x20—\x20'+'discriminate\x20on\x20the\x20arb-side\x20award\x20(indemnity\x20>\x200\x20/\x20award-claimed\x20polarity),\x20never\x20the\x20bare\x20'+'order\x20stamp:\x20\x27claimed_by\x20some\x20⇒\x20recover-safe\x27\x20holds\x20ONLY\x20when\x20indemnity\x20>\x200.'});const i=a['filter'](p=>p['root']!==undefined);for(const p of f){const q=i['some'](u=>u['track']==='refund'&&satisfiable(u['table'],u['root'],p));if(!q)continue;const r=a['some'](u=>claimedTrueLegPasses(u,p));r&&d['push']({'code':'RAIL_POLARITY_COLLISION','level':'critical','detail':'at\x20node\x20\x27'+p['node']+'\x27\x20with\x20claimed_by=some,\x20BOTH\x20a\x20refund-track\x20rail\x20and\x20an\x20'+'award-polarity\x20rail\x20(claimed_by\x20some\x20==\x20true)\x20are\x20satisfiable\x20—\x20the\x20pairing\x20'+'can\x20double-pay\x20the\x20same\x20escrow\x20(crs-mn-261014\x20F-30:\x20the\x20double-negated\x20refund\x20'+'leg\x20passed\x20only\x20AFTER\x20the\x20award\x20paid;\x20dry-run\x20simulated\x20the\x20escrow\x20draining\x20'+'on\x20top\x20of\x20a\x20paid\x20ruling).\x20The\x20refund\x20leg\x20must\x20be\x20logic_equal[query\x20'+'\x27order.claimed_by\x20some\x27,\x20Bool\x20false]\x20—\x20never\x20logic_not(query)==false.'});}return d;}function claimedTrueLegPasses(a,b){const c=a['table'],d={'node':b['node'],'claimed':!![]};return satisfiable(c,a['root'],d)&&!satisfiable(c,a['root'],{'node':b['node'],'claimed':![]});}
|
|
1
|
+
import{ONCE_SLOT_BYTES,TASK_BINDING_SLOT}from'./onchain-constants.js';const SYM_NODE='progress.current',SYM_CLAIMED='order.claimed_by\x20some';function slotValue(a,b){if(b===undefined)return{'value':undefined,'isSubmission':![]};const c=a['find'](d=>d['identifier']===b);if(!c)return{'value':undefined,'isSubmission':![]};return{'value':c['value'],'isSubmission':c['b_submission']===!![]};}function classifyQueryLhs(a){if(a===SYM_NODE)return{'kind':'node'};if(a===SYM_CLAIMED)return{'kind':'claimed'};return{'kind':'unknown'};}function resolveValue(a,b){if(!b||b['type']!=='identifier')return{'known':![]};const c=slotValue(a,b['identifier']);if(c['isSubmission'])return{'known':![]};if(c['value']===undefined)return{'known':![]};return{'known':!![],'value':c['value']};}function evaluate(a,b,d){if(!b||typeof b['type']!=='string')return undefined;switch(b['type']){case'logic_and':{const e=Array['isArray'](b['nodes'])?b['nodes']:[];let f=![];for(const g of e){const h=evaluate(a,g,d);if(h===![])return![];if(h===undefined)f=!![];}return f?undefined:!![];}case'logic_or':{const i=Array['isArray'](b['nodes'])?b['nodes']:[];let j=![];for(const k of i){const l=evaluate(a,k,d);if(l===!![])return!![];if(l===undefined)j=!![];}return j?undefined:![];}case'logic_not':{const m=evaluate(a,b['node'],d);if(m===undefined)return undefined;return!m;}case'logic_equal':{const n=Array['isArray'](b['nodes'])?b['nodes']:[];if(n['length']<0x2)return undefined;const o=classifyQueryLhs(n[0x0]?.['query']),p=resolveValue(a,n[0x1]),q=o['kind']==='unknown'?classifyQueryLhs(n[0x1]?.['query']):o,r=!p['known']&&n[0x1]?.['query']!==undefined?resolveValue(a,n[0x0]):p;if(q['kind']==='node'){if(!r['known']||typeof r['value']!=='string')return undefined;return d['node']===r['value'];}if(q['kind']==='claimed'){if(!r['known']||typeof r['value']!=='boolean')return undefined;return d['claimed']===r['value'];}return undefined;}default:return undefined;}}function satisfiable(a,b,c){return evaluate(a,b,c)!==![];}function findDeadLiterals(a,b,c,d){if(!a||typeof a['type']!=='string')return;if(a['type']==='logic_and'&&Array['isArray'](a['nodes'])){const e=new Map();for(const f of a['nodes']){const g=resolvableEquality(f,b);if(g)e['set'](g['symbol'],g['value']);}for(const h of a['nodes']){const i=resolvableEquality(h,b);if(i){const k=e['get'](i['symbol']);if(k!==undefined&&k!==i['value']){d['push']({'code':'RAIL_DEAD_LITERAL','level':'critical','detail':deadLiteralDetail(c,i['symbol'],k,i['value'])});return;}continue;}const j=findClash(h,b,e);if(j){d['push']({'code':'RAIL_DEAD_LITERAL','level':'critical','detail':deadLiteralDetail(c,j['symbol'],j['pinned'],j['value'])});return;}}for(const l of a['nodes'])findDeadLiterals(l,b,c,d);return;}if(Array['isArray'](a['nodes'])){for(const m of a['nodes'])findDeadLiterals(m,b,c,d);}if(a['node'])findDeadLiterals(a['node'],b,c,d);}function resolvableEquality(c,d){if(!c||c['type']!=='logic_equal'||!Array['isArray'](c['nodes']))return undefined;for(const [e,f]of[[c['nodes'][0x0],c['nodes'][0x1]],[c['nodes'][0x1],c['nodes'][0x0]]]){if(!e||typeof e['query']!=='string')continue;const g=classifyQueryLhs(e['query']);if(g['kind']==='unknown')continue;const h=resolveValue(d,f);if(!h['known'])continue;return{'symbol':g['kind']==='node'?SYM_NODE:SYM_CLAIMED,'value':h['value']};}return undefined;}function findClash(a,b,c){if(!a||typeof a['type']!=='string')return undefined;if(a['type']==='logic_not')return undefined;const d=resolvableEquality(a,b);if(d){const e=c['get'](d['symbol']);if(e!==undefined&&e!==d['value'])return{'symbol':d['symbol'],'pinned':e,'value':d['value']};return undefined;}if(Array['isArray'](a['nodes']))for(const f of a['nodes']){const g=findClash(f,b,c);if(g)return g;}if(a['node'])return findClash(a['node'],b,c);return undefined;}function deadLiteralDetail(a,b,c,d){return'allocator\x20guard\x20\x27'+a+'\x27:\x20one\x20conjunction\x20scope\x20carries\x20'+b+'\x20'+('==\x20'+JSON['stringify'](c)+'\x20and\x20ALSO\x20'+b+'\x20==\x20'+JSON['stringify'](d)+'\x20—\x20the\x20second\x20')+'literal\x20contradicts\x20the\x20first\x20and\x20is\x20a\x20DEAD\x20literal\x20(azx7-mn-261014\x20CR-azx7-01:\x20a\x20pinned\x20'+'node\x20equality\x20made\x20the\x20sibling\x20closed_cancel/item_lost\x20legs\x20unreachable,\x20stranding\x20the\x20'+'escrow\x20at\x20every\x20other\x20terminal).\x20Hoist\x20the\x20node\x20predicate\x20to\x20ONE\x20top-level\x20n-ary\x20logic_or\x20'+'instead\x20of\x20AND-prepending\x20a\x20single-node\x20gate.';}export function hasCallerIdentityLeg(a){let b=![];const c=d=>{if(b||d===null||typeof d!=='object')return;if(Array['isArray'](d)){for(const f of d)c(f);return;}const e=d;if(e['type']==='context'&&e['context']==='Signer'){b=!![];return;}if(typeof e['query']==='string'){const g=e['query']['toLowerCase']();if(g['startsWith']('context')||g['includes']('signer'))b=!![];else{if(/order\.agent|permission\.(owner|admin)|named.?operator/['test'](g))b=!![];}}if(!b){for(const h of Object['keys'](e))c(e[h]);}};return c(a),b;}function claimedAxisSensitive(a,b){const c=a['table'];return satisfiable(c,a['root'],{'node':b,'claimed':!![]})!==satisfiable(c,a['root'],{'node':b,'claimed':![]});}export function verifyAllocatorRails(a,b,c){const d=[];if(a['length']===0x0)return d;{const j=c?.['declaredKeys'],k=[],l=[],m=[];for(const n of a){if(n['root']===undefined||hasCallerIdentityLeg(n['root']))continue;const o=n['track']==='settlement'||n['track']==='refund'||n['recoverTwin']===!![];if(!o){m['push'](n['key']);continue;}if(j?.['has'](n['key']))l['push'](n);else k['push'](n);}for(const q of k){d['push']({'code':'RAIL_NO_CALLER_IDENTITY_BOUND','level':'critical','railKey':q['key'],'detail':'allocator\x20rail\x20\x27'+q['key']+'\x27\x20('+q['track']+'\x20track'+((q['recoverTwin']===!![]?',\x20merchant-recovery\x20twin':'')+')\x20carries\x20NO\x20caller-identity\x20leg\x20')+'(no\x20context(Signer)\x20comparison,\x20no\x20order.agent\x20has\x20/\x20permission.*\x20/\x20named-operator\x20query\x20'+'resolving\x20the\x20caller)\x20—\x20ANY\x20address\x20whose\x20tx\x20reaches\x20the\x20allocator\x20can\x20trigger\x20this\x20route\x20'+'(ks11:\x20an\x20unexpected\x20account\x20swept\x20a\x20merchant-recovery\x20payout\x20and\x20doubled\x20the\x20allocation\x20draw).\x20'+'Money\x20rails\x20are\x20not\x20forwards\x20—\x20the\x20chain\x20injects\x20no\x20caller\x20rail\x20on\x20them,\x20so\x20the\x20guard\x20IS\x20the\x20'+'only\x20gate.\x20Bind\x20the\x20caller\x20per\x20pattern.identity_check_order_holder\x20(order.owner/agent,\x20host\x20'+'machine_forward)\x20or\x20pattern.repository_write_authorization\x20(permission-resolved,\x20host\x20'+'service_allocator_guard);\x20see\x20guard-host-context.ts\x20for\x20the\x20per-host\x20signer\x20semantics\x20—\x20the\x20'+'caller\x20of\x20an\x20allocator\x20gate\x20is\x20the\x20SETTLEMENT\x20TRIGGERER,\x20not\x20the\x20order\x20owner,\x20so\x20a\x20'+'forward-edge\x20identity\x20guard\x20pasted\x20here\x20checks\x20the\x20WRONG\x20subject.\x20A\x20deliberately\x20legless\x20'+'rail\x20(the\x20merchant-recovery\x20sweep\x20face:\x20payee\x20bound\x20by\x20the\x20paired\x20allocator\x20row,\x20'+'permissionless\x20keeper\x20firing)\x20must\x20carry\x20an\x20explicit\x20declare\x20—\x20guard_resolutions\x20'+'{kind:\x27declare\x27,\x20reason}\x20or\x20the\x20template\x27s\x20identity_leg_exempt\x20—\x20and\x20then\x20ships\x20with\x20a\x20'+'permanent\x20non-blocking\x20disclosure\x20instead\x20of\x20this\x20block.'});}for(const r of l){d['push']({'code':'RAIL_NO_CALLER_IDENTITY','level':'info','railKey':r['key'],'detail':'allocator\x20rail\x20\x27'+r['key']+'\x27\x20carries\x20no\x20caller-identity\x20leg\x20and\x20ships\x20under\x20an\x20explicit\x20'+'declare\x20exemption\x20({kind:\x27declare\x27}\x20/\x20identity_leg_exempt):\x20the\x20legless\x20shape\x20is\x20the\x20'+'sanctioned\x20merchant-recovery\x20face\x20—\x20the\x20payee\x20is\x20bound\x20by\x20the\x20paired\x20allocator\x20row,\x20never\x20'+'by\x20the\x20caller.\x20This\x20receipt\x20rides\x20the\x20plan\x20notes\x20and\x20is\x20re-surfaced\x20at\x20publish;\x20it\x20never\x20blocks.'});}m['length']>0x0&&d['push']({'code':'RAIL_NO_CALLER_IDENTITY','level':'info','detail':'allocator\x20rail(s)\x20['+m['join'](',\x20')+']\x20carry\x20no\x20caller-identity\x20leg\x20'+'(no\x20context(Signer)\x20comparison,\x20no\x20order.agent\x20has\x20/\x20permission.*\x20/\x20named-operator\x20'+'query\x20resolving\x20the\x20caller)\x20—\x20ANY\x20address\x20whose\x20tx\x20reaches\x20the\x20allocator\x20can\x20'+'trigger\x20this\x20settlement\x20route\x20(sahr:\x20a\x20bystander\x20accelerated\x20another\x20party\x27s\x20'+'payout).\x20LEGITIMATE\x20when\x20the\x20scene\x20verifies\x20identity\x20upstream\x20(verifier_level\x20'+'level3_scene_combined)\x20or\x20the\x20venue\x20is\x20intentionally\x20open-trigger;\x20otherwise\x20bind\x20'+'the\x20caller\x20per\x20pattern.identity_check_order_holder\x20(order.owner/agent,\x20host\x20'+'machine_forward)\x20or\x20pattern.repository_write_authorization\x20(permission-resolved,\x20'+'host\x20service_allocator_guard).\x20See\x20guard-host-context.ts\x20for\x20the\x20per-host\x20signer\x20'+'semantics\x20—\x20the\x20caller\x20of\x20an\x20allocator\x20gate\x20is\x20the\x20SETTLEMENT\x20TRIGGERER,\x20not\x20the\x20'+'order\x20owner,\x20so\x20a\x20forward-edge\x20identity\x20guard\x20pasted\x20here\x20checks\x20the\x20WRONG\x20subject.'});}for(const u of a){if(u['track']!=='refund'||u['root']===undefined)continue;const v=u['table']['some'](w=>w['identifier']===TASK_BINDING_SLOT||w['identifier']===ONCE_SLOT_BYTES);if(v)continue;d['push']({'code':'REFUND_RAIL_REPLAY_DISCLOSURE','level':'info','railKey':u['key'],'detail':'refund\x20rail\x20\x27'+u['key']+'\x27\x20carries\x20no\x20once-key\x20row\x20(no\x20per-order\x20254\x20anchor,\x20no\x20per-period\x20255\x20key):\x20'+'the\x20refund\x20leg\x20stays\x20re-triggerable\x20on\x20its\x20node\x20state\x20across\x20the\x20order\x27s\x20life.\x20This\x20is\x20the\x20'+'SANCTIONED\x20shape\x20—\x20the\x20once-key\x20injection\x20is\x20deliberately\x20banned\x20on\x20refund\x20tracks\x20(a\x20refund\x20may\x20'+'fire\x20on\x20several\x20terminal\x20legs;\x20a\x20per-order\x20once\x20anchor\x20deadlocks\x20the\x20second\x20leg),\x20so\x20the\x20'+'replay\x20surface\x20is\x20disclosed,\x20not\x20gated.\x20Replay\x20cannot\x20redirect\x20funds:\x20the\x20recipient\x20binding\x20pins\x20'+'every\x20payout\x20to\x20the\x20paying\x20order,\x20and\x20balance\x20exhaustion\x20bounds\x20repetition\x20—\x20a\x20firing\x20aborts\x20on\x20'+'zero/insufficient\x20balance\x20once\x20the\x20pool\x20can\x20no\x20longer\x20fund\x20the\x20group\x20(a\x20Rate\x20group\x20summing\x20to\x20'+'10000\x20empties\x20the\x20pool\x20on\x20the\x20first\x20payout;\x20an\x20Amount-shaped\x20group\x20repeats\x20until\x20the\x20balance\x20'+'runs\x20below\x20the\x20fixed\x20leg).'});}if(b['length']===0x0)return d;const e=b['filter'](w=>w['semanticRole']==='cancelled'||w['semanticRole']==='final'),f=b['map'](w=>({'node':w['name'],'claimed':!![]}));for(const w of a){if(w['root']===undefined)continue;const x=w['table'];findDeadLiterals(w['root'],x,w['key'],d);}for(const y of e){const z=[{'node':y['name'],'claimed':![]}];for(const B of y['fromNodes']??[])z['push']({'node':B,'claimed':![]});const A=a['some'](C=>z['some'](D=>satisfiable(C['table'],C['root'],D)));!A&&d['push']({'code':'RAIL_TERMINAL_UNCOVERED','level':'critical','detail':'terminal\x20node\x20\x27'+y['name']+'\x27\x20(role\x20'+y['semanticRole']+')\x20has\x20NO\x20allocator\x20rail\x20'+'satisfiable\x20on\x20it\x20or\x20its\x20direct\x20predecessors\x20—\x20an\x20order\x20reaching\x20this\x20terminal\x20'+'strands\x20its\x20escrow\x20forever\x20(azx7-mn-261014\x20CR-azx7-01:\x20refund\x20'+'rejected\x20with\x20the\x20allocation\x20EINSUFFICIENT_BALANCE\x20abort\x20at\x20closed_cancel/item_lost;\x20crs-mn-261014\x20F-30:\x20a\x20double-'+'negated\x20claimed_by\x20leg\x20—\x20a\x20banned\x20shape\x20since\x20decision\x2011\x20—\x20bricked\x20the\x20refund\x20at\x20returned).\x20'+'Guards/allocators\x20freeze\x20at\x20publish\x20—\x20fix\x20the\x20rail\x27s\x20NODE-SET\x20before\x20publishing\x20'+'(decision\x2011:\x20exits\x20are\x20node-gated;\x20there\x20is\x20no\x20claimed_by\x20polarity\x20leg\x20to\x20fall\x20back\x20on).'});}const h=a['some'](C=>f['some'](D=>satisfiable(C['table'],C['root'],D)));!h&&d['push']({'code':'RAIL_AWARD_EXIT_MISSING','level':'critical','detail':'no\x20allocator\x20rail\x20is\x20satisfiable\x20on\x20ANY\x20machine\x20node\x20—\x20every\x20order\x20state\x20'+'(awarded\x20or\x20not)\x20strands\x20its\x20escrow\x20(escrow-exit\x20invariant,\x20az-mn-261007).\x20'+'Decision\x2011\x20two-rail\x20independence:\x20exits\x20are\x20NODE-GATED\x20—\x20an\x20awarded\x20order\x20exits\x20'+'through\x20the\x20SAME\x20terminal\x20rails\x20as\x20any\x20other\x20order\x20(its\x20award\x20is\x20a\x20separate\x20'+'commercial\x20indemnity;\x20a\x20claimed_by\x20gate\x20would\x20be\x20the\x20RAIL_CLAIMED_BY_LEG\x20violation,\x20'+'not\x20the\x20cure).\x20Partition\x20the\x20terminals\x20between\x20a\x20refund/settle\x20rail\x20and\x20a\x20'+'merchant-side\x20recovery\x20sweep\x20(tpl_allocator_node_gate_recover,\x20terminal-node-gated).\x20'+'Historical\x20(O11,\x20alg26-tn-261026):\x20a\x20recover\x20rail\x20keyed\x20on\x20the\x20bare\x20claimed_by\x20stamp\x20'+'routed\x20a\x20dismissal\x20to\x20the\x20LOSING\x20party\x20—\x20that\x20polarity\x20shape\x20is\x20banned\x20since\x20decision\x2011.'});const i=a['filter'](C=>C['root']!==undefined);{const C=new Set();for(const D of b){for(const E of i){if(claimedAxisSensitive(E,D['name']))C['add'](E['key']);}}C['size']>0x0&&d['push']({'code':'RAIL_CLAIMED_BY_LEG','level':'critical','detail':'allocator\x20rail(s)\x20['+[...C]['join'](',\x20')+']\x20flip\x20on\x20the\x20order.claimed_by\x20axis\x20—\x20'+'a\x20fund\x20rail\x20READS\x20the\x20arbitration\x20payout\x20stamp\x20(decision\x2011\x20two-rail\x20independence\x20violation;\x20'+'mirrors\x20R-FUND-RAIL-CLAIMED-BY).\x20The\x20fund\x20track\x20completes\x20by\x20ORDER-LEVEL\x20NODE\x20STATE:\x20gate\x20the\x20'+'rail\x20on\x20progress.current\x20node\x20sets\x20(refund/settle\x20faces),\x20partition\x20the\x20terminals\x20with\x20a\x20'+'terminal-node-gated\x20recovery\x20sweep\x20(tpl_allocator_node_gate_recover),\x20and\x20let\x20the\x20arbitrator\x20'+'rule\x20on\x20the\x20order\x27s\x20state\x20and\x20fund\x20destinations\x20—\x20a\x20double\x20collection\x20(settle+indemnity,\x20'+'refund+bounty)\x20is\x20a\x20legal\x20commercial\x20outcome\x20disclosed\x20at\x20the\x20MCP\x20confirmation\x20gate.\x20'+'Historical:\x20the\x20INV-C1\x20polarity\x20pair\x20(refund\x20some==false\x20/\x20recover\x20some==true)\x20was\x20the\x20old\x20'+'cure\x20and\x20the\x20W5-01\x20direction-blind\x20bug\x27s\x20cause\x20—\x20both\x20legs\x20were\x20removed\x20template-wide.'});}return d;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const ARB_STATUS_CODE={'Principal_confirming':0x0,'Arbitrator_confirming':0x1,'Voting':0x2,'Arbitrated':0x3,'Objectionable':0x4,'Finished':0x5,'Withdrawn':0x6};export const ARB_TERMINAL_STATUSES=['Finished','Withdrawn'];export const ARB_STATUS_ALIASES={'created':'Principal_confirming','voting':'Voting','feedback':'Arbitrator_confirming','confirmed':'Arbitrated','completed':'Finished','reset':'Objectionable','disputed':'Withdrawn'};export const ARBITRATION_PERMISSIONS=[{'index':0x15e,'name':'ARBITRATION_NEW','description':'Create\x20new\x20Arbitration\x20object','governed_operations':['create\x20a\x20new\x20arbitration\x20service']},{'index':0x15f,'name':'ARBITRATION_DESCRIPTION','description':'Modify\x20Arbitration\x20description','governed_operations':['modify\x20the\x20arbitration\x20description']},{'index':0x160,'name':'ARBITRATION_ENDPOINT','description':'Reserved\x20placeholder\x20—\x20not\x20used\x20on-chain\x20(SDK\x20commented\x20out)','governed_operations':[],'is_reserved':!![]},{'index':0x161,'name':'ARBITRATION_LOCATION','description':'Set\x20Arbitration\x20location','governed_operations':['set\x20the\x20arbitration\x20location']},{'index':0x162,'name':'ARBITRATION_VOTING_GUARD','description':'Manage\x20voting_guard\x20list\x20(add\x20/\x20remove\x20/\x20clear)\x20—\x20controls\x20vote\x20weight','governed_operations':['add\x20a\x20passport-identifier\x20voting\x20guard\x20(dynamic\x20weight)','add\x20a\x20fixed-weight\x20voting\x20guard','remove\x20a\x20voting\x20guard','clear\x20the\x20voting\x20guard\x20list']},{'index':0x163,'name':'ARBITRATION_USAGE_GUARD','description':'Set\x20/\x20clear\x20usage_guard\x20—\x20controls\x20who\x20can\x20file\x20disputes','governed_operations':['set\x20the\x20usage\x20guard\x20(restrict\x20who\x20can\x20file\x20disputes)','clear\x20the\x20usage\x20guard']},{'index':0x164,'name':'ARBITRATION_PAUSE','description':'Pause\x20/\x20resume\x20Arbitration\x20(bPaused\x20default\x20true)','governed_operations':['pause/resume\x20the\x20arbitration\x20service']},{'index':0x165,'name':'ARBITRATION_FEE','description':'Set\x20dispute\x20application\x20fee\x20(u64)','governed_operations':['set\x20the\x20dispute\x20application\x20fee']},{'index':0x166,'name':'ARBITRATION_VOTE','description':'Cast\x20a\x20vote.\x20With\x20an\x20EMPTY\x20voting_guard\x20this\x20is\x20an\x20equal-weight\x20vote\x20(1\x20person\x201\x20vote)\x20—\x20'+'NOT\x20permissionless:\x20plain\x20voting\x20asserts\x20permission\x20358\x20on\x20the\x20arbitration\x27s\x20bound\x20Permission,\x20'+'whose\x20admin\x20ALWAYS\x20passes\x20the\x20assert\x20(a\x20fresh\x20Permission\x20seeds\x20its\x20creator\x20as\x20the\x20sole\x20admin;\x20'+'the\x20table\x20starts\x20empty).\x20So\x20only\x20the\x20arb-side\x20admin\x20and\x20explicit\x20358\x20grantees\x20can\x20vote\x20—\x20the\x20'+'disputing\x20customer\x20must\x20be\x20GRANTED\x20358\x20first,\x20or\x20voting\x20collapses\x20to\x20admin-only\x20(E-13,\x20test/6)','governed_operations':['cast\x20a\x20vote\x20(empty\x20voting_guard\x20=\x201\x20person\x201\x20vote,\x20permission\x20358\x20still\x20required)','cast\x20a\x20weighted\x20vote\x20via\x20voting_guard\x20(weights\x20resolved\x20per\x20guard)']},{'index':0x167,'name':'ARBITRATION_ARBITRATION','description':'Make\x20definitive\x20arbitration\x20ruling\x20(with\x20indemnity)','governed_operations':['issue\x20the\x20definitive\x20arbitration\x20ruling\x20(with\x20indemnity)']},{'index':0x168,'name':'ARBITRATION_FEEDBACK','description':'Provide\x20feedback\x20on\x20Arb\x20case','governed_operations':['attach\x20feedback\x20to\x20the\x20Arb\x20case']},{'index':0x169,'name':'ARBITRATION_CONFIRM','description':'Confirm\x20materials\x20submitted\x20by\x20principal\x20(starts\x20voting\x20phase)','governed_operations':['confirm\x20the\x20principal\x27s\x20materials\x20(starts\x20the\x20voting\x20phase)']},{'index':0x16a,'name':'ARBITRATION_VOTING_DEADLINE_CHANGE','description':'Change\x20voting\x20deadline\x20for\x20an\x20Arb\x20case','governed_operations':['change\x20the\x20voting\x20deadline\x20for\x20an\x20Arb\x20case']},{'index':0x16b,'name':'ARBITRATION_RESET','description':'Reset\x20arbitration\x20—\x20principal\x20resubmits\x20materials,\x20restart\x20lifecycle','governed_operations':['reset\x20the\x20arbitration\x20(principal\x20resubmits\x20materials)']},{'index':0x16c,'name':'ARBITRATION_ARB_WITHDRAW','description':'Withdraw\x20arbitration\x20fees\x20from\x20Arb\x20into\x20Arbitration.balance','governed_operations':['withdraw\x20arbitration\x20fees\x20from\x20the\x20Arb\x20into\x20Arbitration.balance']},{'index':0x16d,'name':'ARBITRATION_FEES_ALLOC','description':'Allocate\x20arbitration\x20fees\x20to\x20Allocation\x20object','governed_operations':['allocate\x20arbitration\x20fees\x20to\x20an\x20Allocation\x20object']},{'index':0x16e,'name':'ARBITRATION_FEES_TRANSFER','description':'Transfer\x20arbitration\x20fees\x20to\x20Treasury\x20object','governed_operations':['transfer\x20arbitration\x20fees\x20to\x20a\x20Treasury\x20object']},{'index':0x16f,'name':'ARBITRATION_OWNER_RECEIVE','description':'Owner\x20receive\x20(unwrap\x20received\x20Coin/Object\x20and\x20send\x20to\x20Permission\x20owner)','governed_operations':['owner\x20receipt\x20of\x20payments\x20(unwrapped\x20to\x20the\x20owner)','owner\x20receipt\x20of\x20whole\x20objects']},{'index':0x170,'name':'ARBITRATION_UM','description':'Set\x20/\x20clear\x20User\x20Manager\x20(Contact\x20object)','governed_operations':['bind\x20a\x20Contact\x20as\x20the\x20UM\x20coordinator','unbind\x20the\x20UM\x20Contact']}];export const DUAL_GUARD_MATRIX=[{'voting_guard_empty':!![],'usage_guard_empty':!![],'dispute_method':'dispute','vote_method':'vote','scenario':'Open\x20dispute\x20+\x20open\x20voting\x20(1\x20person\x201\x20vote)'},{'voting_guard_empty':!![],'usage_guard_empty':![],'dispute_method':'dispute_via_passport','vote_method':'vote','scenario':'Restricted\x20dispute\x20+\x20open\x20voting'},{'voting_guard_empty':![],'usage_guard_empty':!![],'dispute_method':'dispute','vote_method':'vote_weighted_by_guard','scenario':'Open\x20dispute\x20+\x20weighted\x20voting'},{'voting_guard_empty':![],'usage_guard_empty':![],'dispute_method':'dispute_via_passport','vote_method':'vote_weighted_by_guard','scenario':'Restricted\x20dispute\x20+\x20weighted\x20voting\x20(most\x20controlled)'}];export const ARBITRATION_SCENES=[{'id':'arbitration_create','name':'Create\x20new\x20Arbitration\x20service','operation_category':'lifecycle','permission_index':0x15e,'permission_name':'ARBITRATION_NEW','requires_voting_guard':'any','requires_usage_guard':'any','has_passport_variant':!![],'governed_operations':['create\x20a\x20new\x20arbitration\x20service'],'common_patterns':['Pre-publish\x20config:\x20create\x20Arbitration\x20+\x20Permission\x20together','bPaused\x20defaults\x20to\x20true\x20—\x20must\x20call\x20pause(false)\x20to\x20enable','Generic\x20T:\x20choose\x20Coin\x20type\x20(e.g.\x200x2::wow::WOW)\x20at\x20creation','object-linker\x20binding\x20(core):\x20permission\x20+\x20arbitration\x20linked\x20by\x20an\x20affiliation\x20core\x20binding'],'recommended_templates':['T-AB-01','T-AB-02']},{'id':'arbitration_dispute','name':'File\x20dispute\x20against\x20an\x20Order\x20(creates\x20Arb\x20case)','operation_category':'dispute','permission_index':0x0,'permission_name':'(order\x20op\x20permission\x20—\x20no\x20ARBITRATION_*\x20index)','required_arb_status':[],'resulting_arb_status':'Arbitrator_confirming','requires_voting_guard':'any','requires_usage_guard':'any','has_passport_variant':!![],'governed_operations':['file\x20a\x20dispute\x20against\x20an\x20Order\x20(creates\x20the\x20Arb\x20case)'],'common_patterns':['Fee\x20gate:\x20coin::value(&fee)\x20>=\x20self.fee,\x20else\x20E_FEE_NOT_ENOUGH','Order\x20op\x20permission\x20check\x20required\x20(caller\x20must\x20hold\x20the\x20matching\x20order\x20operation\x20permission)','Creates\x20independent\x20Arb<T>\x20object\x20with\x20its\x20own\x20lifecycle','If\x20usage_guard\x20is\x20Some\x20→\x20the\x20dispute\x20must\x20go\x20through\x20passport\x20verification','Order.dispute\x20list:\x20appends\x20new\x20Arb\x20(max\x2010\x20per\x20Order)','One-shot\x20filing:\x20the\x20Arb\x20is\x20created\x20directly\x20in\x20Arbitrator_confirming\x20status\x20—\x20proposition\x20and\x20description\x20are\x20final\x20at\x20filing;\x20edits\x20require\x20the\x20arbitrator\x20to\x20reset\x20the\x20case\x20back\x20to\x20Principal_confirming\x20first.\x20Assemble\x20the\x20complete\x20proposition\x20before\x20calling\x20dispute.'],'recommended_templates':['T-AB-01','T-AB-03','T-AB-04']},{'id':'arbitration_vote','name':'Vote\x20on\x20Arb\x20propositions','operation_category':'voting','permission_index':0x166,'permission_name':'ARBITRATION_VOTE','required_arb_status':['Voting'],'requires_voting_guard':'any','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['open\x20a\x20vote\x20(1\x20person\x201\x20vote)','cast\x20a\x20weighted\x20vote\x20(weights\x20resolved\x20from\x20the\x20voting\x20guard)'],'common_patterns':['Open\x20vote:\x20voting_guard\x20empty\x20→\x20plain\x20vote\x20(passport\x20variant\x20supported);\x20equal\x20weight\x20'+'(1\x20person\x201\x20vote)\x20but\x20permission\x20358\x20still\x20gates\x20every\x20NON-admin\x20voter\x20—\x20the\x20bound\x20'+'Permission\x27s\x20admin\x20(its\x20creator,\x20by\x20default)\x20always\x20passes,\x20so\x20grant\x20358\x20to\x20the\x20disputing\x20'+'parties\x20or\x20voting\x20collapses\x20to\x20admin-only\x20(E-13)','Weighted\x20vote:\x20voting_guard\x20non-empty\x20→\x20vote\x20weight\x20resolved\x20per\x20voting\x20guard','votes:\x20u8\x20array\x20—\x20index\x20into\x20proposition\x20list\x20(0..N-1)','Mismatch:\x20vote()\x20with\x20non-empty\x20voting_guard\x20→\x20E_VOTING_GUARD_USED','Guard\x20not\x20in\x20list:\x20E_VOTING_GUARD_NOT_FOUND','E-15:\x20the\x20voting_deadline\x20IS\x20the\x20dispute-resolution\x20delay\x20window\x20—\x20the\x20ruling\x20(arbitration)\x20'+'aborts\x20with\x20E_VOTING_DEADLINE_NOT_PASSED\x20until\x20the\x20deadline\x20elapses.\x20Size\x20the\x20window\x20to\x20the\x20'+'business\x20expectation\x20(e.g.\x2010\x20minutes\x20for\x20tests,\x20days\x20for\x20production)'],'recommended_templates':['T-AB-02','T-AB-03']},{'id':'arbitration_confirm','name':'Confirm\x20principal\x20materials\x20and\x20start\x20voting\x20phase','operation_category':'ruling','permission_index':0x169,'permission_name':'ARBITRATION_CONFIRM','required_arb_status':['Arbitrator_confirming'],'resulting_arb_status':'Voting','requires_voting_guard':'any','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['confirm\x20the\x20principal\x27s\x20materials\x20(starts\x20the\x20voting\x20phase)'],'common_patterns':['Transitions\x20Arb\x20from\x20Arbitrator_confirming\x20→\x20Voting','voting_deadline:\x20u64\x20timestamp_ms\x20(null\x20=\x20no\x20deadline)','Once\x20in\x20Voting,\x20only\x20vote\x20/\x20voting_deadline_change\x20/\x20reset\x20allowed'],'recommended_templates':['T-AB-01','T-AB-02']},{'id':'arbitration_feedback','name':'Provide\x20feedback\x20on\x20Arb\x20case','operation_category':'ruling','permission_index':0x168,'permission_name':'ARBITRATION_FEEDBACK','required_arb_status':['Principal_confirming','Arbitrator_confirming','Voting','Arbitrated','Objectionable'],'requires_voting_guard':'not_applicable','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['attach\x20feedback\x20to\x20the\x20Arb\x20case'],'common_patterns':['Feedback\x20is\x20informational\x20—\x20does\x20not\x20change\x20Arb\x20status','Used\x20by\x20principal\x20/\x20arbitrator\x20/\x20voters\x20to\x20attach\x20notes','No\x20state\x20transition;\x20supplements\x20the\x20case\x20record'],'recommended_templates':['T-AB-01','T-AB-07']},{'id':'arbitration_ruling','name':'Make\x20definitive\x20arbitration\x20ruling\x20with\x20indemnity','operation_category':'ruling','permission_index':0x167,'permission_name':'ARBITRATION_ARBITRATION','required_arb_status':['Voting'],'resulting_arb_status':'Arbitrated','requires_voting_guard':'any','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['issue\x20the\x20definitive\x20arbitration\x20ruling\x20(with\x20indemnity)'],'common_patterns':['Ruling\x20produces:\x20feedback\x20(string)\x20+\x20indemnity\x20(u64)','indemnity\x20is\x20compensation\x20amount\x20—\x20paid\x20through\x20the\x20order\x20compensation\x20flow','compensation\x20is\x20package-internal\x20—\x20only\x20the\x20order\x20lifecycle\x20can\x20trigger\x20it','Once\x20Arbitrated,\x20case\x20enters\x20Objectionable\x20window\x20(reset\x20possible)','E-16:\x20the\x20indemnity\x20is\x20paid\x20from\x20the\x20SERVICE\x27s\x20merchant-prepaid\x20compensation_fund\x20pool,\x20'+'NOT\x20from\x20the\x20order\x20escrow.\x20If\x20the\x20pool\x20is\x20smaller\x20than\x20the\x20indemnity,\x20arb_claim_compensation\x20'+'aborts\x20with\x20code\x2027\x20(E_COMPENSATION_NOT_MATCH)\x20—\x20the\x20ruling\x20stands\x20but\x20is\x20unpayable\x20until\x20the\x20'+'merchant\x20tops\x20up\x20(the\x20abort\x20does\x20NOT\x20consume\x20the\x20claim)','E-17/E-17b:\x20the\x20ruling\x20does\x20NOT\x20propagate\x20to\x20the\x20Machine/Allocation\x20escrow,\x20so\x20a\x20settlement\x20'+'forward\x20can\x20still\x20FIRE\x20after\x20a\x20claim.\x20Where\x20the\x20SEAL\x20actually\x20lives\x20(corrected\x20per\x20rex2-261024\x20'+'C-02):\x20the\x20escrow\x27s\x20Order-side\x20receive\x20has\x20deliberately\x20NO\x20claimed_by\x20gate\x20'+'(on-chain\x20note\x20—\x20principal\x20restitution\x20and\x20damages\x20are\x20two\x20INDEPENDENT\x20tracks;\x20gating\x20receive\x20'+'would\x20strand\x20the\x20principal\x20inside\x20the\x20order.\x20rex2\x20T9\x20live-proven:\x20claim\x20first,\x20then\x20owner_receive\x20'+'extracted\x20the\x20full\x20principal).\x20The\x20mutual\x20exclusion\x20lives\x20at\x20the\x20ALLOCATOR-GUARD\x20layer\x20instead:\x20'+'the\x20merchant\x27s\x20rail\x20pairing\x20—\x20refund\x20rail\x20gated\x20order.claimed_by\x20none\x20+\x20paired\x20recover\x20rail\x20'+'gated\x20claimed_by\x20some\x20(D-BUG-2,\x20template-shipped\x20refund_gate/recover_gate)\x20—\x20is\x20what\x20closes\x20the\x20'+'buyer\x20refund\x20leg\x20once\x20claimed_by\x20is\x20set.\x20That\x20pairing\x20is\x20a\x20MERCHANT\x20choice:\x20a\x20service\x20without\x20it\x20'+'can\x20stack\x20refund\x20+\x20compensation\x20in\x20both\x20directions\x20(rex2\x20T6/T9\x20live\x20double\x20payout,\x20297M\x20>\x20250M\x20'+'principal),\x20which\x20is\x20why\x20the\x20client\x20keeps\x20the\x20acknowledge_dual_payout\x20gate\x20(keeper\x20posture\x20拍板⑧\x20'+'dm-mtw-261027:\x20the\x20flag\x20stays\x20a\x20HUMAN\x20netting\x20decision\x20—\x20an\x20automated\x20keeper\x20refused\x20with\x20'+'dual_payout_unconfirmed\x20must\x20stop\x20and\x20escalate,\x20never\x20self-ack;\x20every\x20refusal\x20envelope\x20carries\x20the\x20'+'KEEPER\x20DIRECTIVE\x20verbatim).\x20claim\x20mechanics:\x20'+'compensate()\x20sets\x20claimed_by\x20when\x20an\x20award\x20is\x20CLAIMED\x20—\x20and\x20since\x20BF-14\x20a\x20zero-award\x20claim\x20aborts\x20'+'E_ZERO_INDEMNITY_CLAIM\x20inside\x20arbitration\x20finalization\x20BEFORE\x20any\x20state\x20change,\x20so\x20a\x20plain\x20dismissal\x20leaves\x20'+'the\x20flag\x20unset\x20and\x20refund\x20rails\x20live.\x20RULED-ZERO\x20SEAL\x20(F-BS-54/56,\x20protocol\x20154\x20'+'enable_arb_dismissal_conclusion_gate):\x20the\x20arbitration\x20conclusion\x20operation\x20stamps\x20claimed_by\x20on\x20a\x20CONCLUDED\x20DISMISSAL\x20'+'(amount-insensitive,\x20BKN-P1\x20decision\x20option\x20a)\x20—\x20on\x20protocol\x20>=\x20154\x20a\x20ruled-zero\x20closes\x20the\x20'+'claimed_by-none\x20refund\x20rails\x20at\x20ruling\x20time\x20and\x20the\x20recover\x20rail\x20becomes\x20the\x20only\x20escrow\x20exit\x20'+'(principal\x20exits\x20to\x20the\x20MERCHANT,\x20not\x20the\x20buyer).\x20On\x20a\x20PRE-154\x20network,\x20or\x20when\x20no\x20keeper\x20runs\x20'+'the\x20arbitration\x20conclusion\x20operation,\x20a\x20ruled-zero\x20does\x20NOT\x20seal:\x20the\x20buyer\x20can\x20lose\x20the\x20arbitration\x20and\x20still\x20walk\x20the\x20'+'refund\x20rail\x20—\x20probe\x20the\x20protocol\x20feature\x20before\x20relying\x20on\x20it.\x20STRANDING\x20IS\x20A\x20SERVICE-SHAPE\x20BUG,\x20'+'NOT\x20A\x20CHAIN\x20RULE:\x20gating\x20a\x20refund\x20rail\x20on\x20claimed_by\x20none\x20while\x20shipping\x20NO\x20recover\x20rail\x20leaves\x20a\x20'+'claimed\x20order\x20with\x20no\x20escrow\x20exit\x20(h1b-tn-261024\x20O11\x20live:\x201.0\x20WOW\x20stranded\x20after\x20a\x20zero-payout\x20'+'dismissal).\x20The\x20compile-time\x20rail\x20verifier\x20blocks\x20that\x20shape\x20pre-publish\x20'+'(RAIL_AWARD_EXIT_MISSING).\x20The\x20pairing\x20guarantees\x20no\x20stranding,\x20not\x20no-misallocation:\x20'+'award-amount\x20polarity\x20is\x20not\x20expressible\x20on\x20the\x20refund\x20track\x20(long-term:\x20N-9\x20order-authority\x20'+'model\x20window)'],'recommended_templates':['T-AB-01','T-AB-05']},{'id':'arbitration_reset','name':'Reset\x20arbitration\x20—\x20principal\x20resubmits\x20materials','operation_category':'ruling','permission_index':0x16b,'permission_name':'ARBITRATION_RESET','required_arb_status':['Objectionable','Arbitrator_confirming'],'resulting_arb_status':'Principal_confirming','requires_voting_guard':'any','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['reset\x20the\x20arbitration\x20(principal\x20resubmits\x20materials)'],'common_patterns':['Resets\x20Arb\x20from\x20Objectionable/Arbitrator_confirming\x20→\x20Principal_confirming','Used\x20when\x20principal\x20objects\x20to\x20ruling\x20and\x20resubmits\x20materials','Feedback\x20required\x20(string\x20explaining\x20reset\x20reason)','Restart\x20full\x20lifecycle:\x20Principal_confirming\x20→\x20...\x20→\x20Finished'],'recommended_templates':['T-AB-07']},{'id':'arbitration_arb_withdraw','name':'Withdraw\x20arbitration\x20fees\x20from\x20Arb\x20into\x20Arbitration.balance','operation_category':'fund','permission_index':0x16c,'permission_name':'ARBITRATION_ARB_WITHDRAW','required_arb_status':['Finished','Arbitrated'],'requires_voting_guard':'not_applicable','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['withdraw\x20arbitration\x20fees\x20from\x20the\x20Arb\x20into\x20Arbitration.balance'],'common_patterns':['Moves\x20fees\x20from\x20the\x20Arb\x20object\x20into\x20Arbitration.balance\x20(clock-checked)','Finished:\x20withdraw\x20immediately','Arbitrated:\x20must\x20wait\x20WITHDRAW_DURATION_TIME\x20(30d)\x20past\x20indemnity.time\x20—\x20silence\x20=\x20acceptance','Objectionable:\x20NEVER\x20withdrawable\x20(protocol\x20141)\x20—\x20the\x20fee\x20stays\x20escrowed\x20until\x20the\x20objection\x20cycle\x20is\x20closed\x20by\x20the\x20principal\x20re-confirming','Increases\x20Arbitration.balance\x20—\x20funds\x20available\x20for\x20fee\x20allocation/transfer'],'recommended_templates':['T-AB-06']},{'id':'arbitration_fees_alloc','name':'Allocate\x20arbitration\x20fees\x20to\x20Allocation\x20object','operation_category':'fund','permission_index':0x16d,'permission_name':'ARBITRATION_FEES_ALLOC','requires_voting_guard':'not_applicable','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['allocate\x20arbitration\x20fees\x20to\x20an\x20Allocation\x20object'],'common_patterns':['Destination:\x20Allocation\x20object\x20(parameterized\x20fund\x20distribution)','payment_remark\x20+\x20payment_index:\x20bookkeeping\x20for\x20Payment\x20object','May\x20create\x20new\x20Payment\x20object\x20if\x20newPayment\x20name\x20provided','Triggers\x20balance::withdraw_all\x20—\x20extracts\x20ALL\x20balance'],'recommended_templates':['T-AB-06']},{'id':'arbitration_fees_transfer','name':'Transfer\x20arbitration\x20fees\x20to\x20Treasury\x20object','operation_category':'fund','permission_index':0x16e,'permission_name':'ARBITRATION_FEES_TRANSFER','requires_voting_guard':'not_applicable','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['transfer\x20arbitration\x20fees\x20to\x20a\x20Treasury\x20object'],'common_patterns':['Destination:\x20Treasury\x20object\x20(general\x20fund\x20pool)','Same\x20bookkeeping\x20as\x20fee\x20allocation\x20(remark\x20+\x20index\x20+\x20newPayment)','Triggers\x20balance::withdraw_all\x20—\x20extracts\x20ALL\x20balance','Choose\x20Allocation\x20vs\x20Treasury\x20by\x20distribution\x20need'],'recommended_templates':['T-AB-06']},{'id':'arbitration_voting_guard_config','name':'Configure\x20voting_guard\x20list\x20(add\x20/\x20set\x20/\x20remove\x20/\x20clear)','operation_category':'guard','permission_index':0x162,'permission_name':'ARBITRATION_VOTING_GUARD','requires_voting_guard':'any','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['add\x20a\x20passport-identifier\x20voting\x20guard\x20(dynamic\x20weight)','add\x20a\x20fixed-weight\x20voting\x20guard','remove\x20a\x20voting\x20guard','clear\x20the\x20voting\x20guard\x20list'],'common_patterns':['Max\x2050\x20guards:\x20MAX_VOTING_GUARD_COUNT=50\x20(off-by-one-safe:\x20len<50\x20allows\x20add)','GuardIdentifier(u8):\x20dynamic\x20weight\x20from\x20Passport\x20submission\x20value','FixedValue(u32):\x20static\x20weight\x20(e.g.\x20100\x20votes\x20per\x20holder)','Add\x20same\x20guard\x20twice\x20→\x20updates\x20vote_weight\x20(no\x20duplicate)','op=\x27set\x27\x20=\x20clear\x20then\x20add;\x20op=\x27add\x27\x20=\x20append;\x20op=\x27remove\x27\x20=\x20by\x20address'],'recommended_templates':['T-AB-02','T-AB-03']},{'id':'arbitration_usage_guard_config','name':'Configure\x20usage_guard\x20(set\x20/\x20clear)','operation_category':'guard','permission_index':0x163,'permission_name':'ARBITRATION_USAGE_GUARD','requires_voting_guard':'not_applicable','requires_usage_guard':'any','has_passport_variant':!![],'governed_operations':['set\x20the\x20usage\x20guard\x20(restrict\x20who\x20can\x20file\x20disputes)','clear\x20the\x20usage\x20guard'],'common_patterns':['Single\x20guard\x20(Option<address>)\x20—\x20not\x20a\x20list','Some(guard):\x20the\x20dispute\x20must\x20go\x20through\x20passport\x20verification','None:\x20dispute\x20can\x20use\x20either\x20variant\x20(no\x20passport\x20needed)','object-linker\x20affiliation\x20change:\x20updates\x20link\x20when\x20guard\x20changes'],'recommended_templates':['T-AB-04']},{'id':'arbitration_pause','name':'Pause\x20/\x20resume\x20Arbitration\x20service','operation_category':'lifecycle','permission_index':0x164,'permission_name':'ARBITRATION_PAUSE','requires_voting_guard':'not_applicable','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['pause/resume\x20the\x20arbitration\x20service'],'common_patterns':['bPaused\x20default\x20true\x20—\x20new\x20Arbitration\x20cannot\x20accept\x20disputes','pause(false)\x20to\x20enable,\x20pause(true)\x20to\x20disable','Paused\x20Arbitration\x20rejects\x20dispute\x20(E_PAUSED)','Does\x20not\x20affect\x20already-open\x20Arb\x20cases'],'recommended_templates':['T-AB-01']},{'id':'arbitration_service_statement','name':'Service\x20(defendant)\x20appends\x20a\x20text\x20statement\x20to\x20the\x20case\x20record','operation_category':'dispute','permission_index':0x141,'permission_name':'SERVICE_ARB_STATEMENT','requires_voting_guard':'not_applicable','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['append\x20the\x20seller\x27s\x20text\x20statement\x20to\x20a\x20case\x20against\x20an\x20order\x20of\x20the\x20service\x20(ArbStatementEvent)'],'common_patterns':['Defendant-side\x20voice\x20WITHOUT\x20holding\x20the\x20order\x20—\x20the\x20arb/arbitration\x20function\x20family\x20is\x20order-anchored;\x20this\x20entry\x20is\x20service-anchored','PRIMARY\x20evidence\x20channel\x20is\x20Messenger:\x20submit\x20encrypted\x20WTS\x20records\x20of\x20the\x20exchange\x20with\x20the\x20order\x20customer\x20first','This\x20statement\x20is\x20the\x20SECONDARY\x20channel:\x20declare\x20facts\x20or\x20report\x20customer\x20behavior\x20(absence,\x20non-cooperation)\x20on\x20the\x20case\x20record','Event-only:\x20nothing\x20on\x20the\x20Arb\x20object\x20is\x20mutated;\x20the\x20record\x20cannot\x20be\x20rewritten\x20or\x20deleted\x20by\x20any\x20party','Text\x20length\x20cap\x20identical\x20to\x20description/objection\x20(DESCRIPTION\x20bound,\x204000)'],'recommended_templates':[]}];export const ARBITRATION_LEDGER_VERSION='1.0.0';export function getScenesByCategory(a){return ARBITRATION_SCENES['filter'](b=>b['operation_category']===a);}export function findSceneById(a){return ARBITRATION_SCENES['find'](b=>b['id']===a);}export function findSceneByPermissionIndex(a){return ARBITRATION_SCENES['find'](b=>b['permission_index']===a);}export function getPermissionByIndex(a){return ARBITRATION_PERMISSIONS['find'](b=>b['index']===a);}export function getPermissionByName(a){return ARBITRATION_PERMISSIONS['find'](b=>b['name']===a);}export function isReservedIndex(a){const b=getPermissionByIndex(a);return!!b?.['is_reserved'];}export function isUsedPermissionIndex(a){const b=getPermissionByIndex(a);return!!b&&!b['is_reserved'];}export function getActivePermissionCount(){return ARBITRATION_PERMISSIONS['filter'](a=>!a['is_reserved'])['length'];}export function inferSceneFromIntent(a){const b=a['toLowerCase'](),c=[{'keywords':['create','new'],'sceneId':'arbitration_create'},{'keywords':['dispute','file','complaint'],'sceneId':'arbitration_dispute'},{'keywords':['vote','voting','decide'],'sceneId':'arbitration_vote'},{'keywords':['confirm','materials'],'sceneId':'arbitration_confirm'},{'keywords':['feedback','opinion'],'sceneId':'arbitration_feedback'},{'keywords':['ruling','arbitration','verdict'],'sceneId':'arbitration_ruling'},{'keywords':['reset','resubmit'],'sceneId':'arbitration_reset'},{'keywords':['arb_withdraw','withdraw','withdraw\x20fees'],'sceneId':'arbitration_arb_withdraw'},{'keywords':['allocate','allocate\x20fees','fees\x20allocation'],'sceneId':'arbitration_fees_alloc'},{'keywords':['fees_transfer','transfer','transfer\x20in'],'sceneId':'arbitration_fees_transfer'},{'keywords':['voting_guard','voting\x20guard'],'sceneId':'arbitration_voting_guard_config'},{'keywords':['usage_guard','usage\x20guard'],'sceneId':'arbitration_usage_guard_config'},{'keywords':['pause','enable'],'sceneId':'arbitration_pause'}];for(const {keywords:d,sceneId:e}of c){if(d['some'](f=>b['includes'](f['toLowerCase']()))){const f=findSceneById(e);if(f)return f;}}return undefined;}export function getDualGuardMatrixEntry(a,b){return DUAL_GUARD_MATRIX['find'](c=>c['voting_guard_empty']===a&&c['usage_guard_empty']===b);}export function isValidArbStatusTransition(a,b){const c={'Principal_confirming':['Arbitrator_confirming'],'Arbitrator_confirming':['Voting','Principal_confirming'],'Voting':['Arbitrated'],'Arbitrated':['Objectionable','Finished','Withdrawn'],'Objectionable':['Principal_confirming'],'Finished':['Withdrawn'],'Withdrawn':[]};return c[a]?.['includes'](b)??![];}export function isTerminalArbStatus(a){return ARB_TERMINAL_STATUSES['includes'](a);}export function getScenesProducingStatus(a){return ARBITRATION_SCENES['filter'](b=>b['resulting_arb_status']===a);}export function getScenesRequiringStatus(a){return ARBITRATION_SCENES['filter'](b=>b['required_arb_status']?.['includes'](a));}export function getArbitrationScenesCount(){return ARBITRATION_SCENES['length'];}export function getAllArbitrationPermissions(){return[...ARBITRATION_PERMISSIONS];}export function getActiveArbitrationPermissions(){return ARBITRATION_PERMISSIONS['filter'](a=>!a['is_reserved']);}
|
|
1
|
+
export const ARB_STATUS_CODE={'Principal_confirming':0x0,'Arbitrator_confirming':0x1,'Voting':0x2,'Arbitrated':0x3,'Objectionable':0x4,'Finished':0x5,'Withdrawn':0x6};export const ARB_TERMINAL_STATUSES=['Finished','Withdrawn'];export const ARB_STATUS_ALIASES={'created':'Principal_confirming','voting':'Voting','feedback':'Arbitrator_confirming','confirmed':'Arbitrated','completed':'Finished','reset':'Objectionable','disputed':'Withdrawn'};export const ARBITRATION_PERMISSIONS=[{'index':0x15e,'name':'ARBITRATION_NEW','description':'Create\x20new\x20Arbitration\x20object','governed_operations':['create\x20a\x20new\x20arbitration\x20service']},{'index':0x15f,'name':'ARBITRATION_DESCRIPTION','description':'Modify\x20Arbitration\x20description','governed_operations':['modify\x20the\x20arbitration\x20description']},{'index':0x160,'name':'ARBITRATION_ENDPOINT','description':'Reserved\x20placeholder\x20—\x20not\x20used\x20on-chain\x20(SDK\x20commented\x20out)','governed_operations':[],'is_reserved':!![]},{'index':0x161,'name':'ARBITRATION_LOCATION','description':'Set\x20Arbitration\x20location','governed_operations':['set\x20the\x20arbitration\x20location']},{'index':0x162,'name':'ARBITRATION_VOTING_GUARD','description':'Manage\x20voting_guard\x20list\x20(add\x20/\x20remove\x20/\x20clear)\x20—\x20controls\x20vote\x20weight','governed_operations':['add\x20a\x20passport-identifier\x20voting\x20guard\x20(dynamic\x20weight)','add\x20a\x20fixed-weight\x20voting\x20guard','remove\x20a\x20voting\x20guard','clear\x20the\x20voting\x20guard\x20list']},{'index':0x163,'name':'ARBITRATION_USAGE_GUARD','description':'Set\x20/\x20clear\x20usage_guard\x20—\x20controls\x20who\x20can\x20file\x20disputes','governed_operations':['set\x20the\x20usage\x20guard\x20(restrict\x20who\x20can\x20file\x20disputes)','clear\x20the\x20usage\x20guard']},{'index':0x164,'name':'ARBITRATION_PAUSE','description':'Pause\x20/\x20resume\x20Arbitration\x20(bPaused\x20default\x20true)','governed_operations':['pause/resume\x20the\x20arbitration\x20service']},{'index':0x165,'name':'ARBITRATION_FEE','description':'Set\x20dispute\x20application\x20fee\x20(u64)','governed_operations':['set\x20the\x20dispute\x20application\x20fee']},{'index':0x166,'name':'ARBITRATION_VOTE','description':'Cast\x20a\x20vote.\x20With\x20an\x20EMPTY\x20voting_guard\x20this\x20is\x20an\x20equal-weight\x20vote\x20(1\x20person\x201\x20vote)\x20—\x20'+'NOT\x20permissionless:\x20plain\x20voting\x20asserts\x20permission\x20358\x20on\x20the\x20arbitration\x27s\x20bound\x20Permission,\x20'+'whose\x20admin\x20ALWAYS\x20passes\x20the\x20assert\x20(a\x20fresh\x20Permission\x20seeds\x20its\x20creator\x20as\x20the\x20sole\x20admin;\x20'+'the\x20table\x20starts\x20empty).\x20So\x20only\x20the\x20arb-side\x20admin\x20and\x20explicit\x20358\x20grantees\x20can\x20vote\x20—\x20the\x20'+'disputing\x20customer\x20must\x20be\x20GRANTED\x20358\x20first,\x20or\x20voting\x20collapses\x20to\x20admin-only\x20(E-13,\x20test/6)','governed_operations':['cast\x20a\x20vote\x20(empty\x20voting_guard\x20=\x201\x20person\x201\x20vote,\x20permission\x20358\x20still\x20required)','cast\x20a\x20weighted\x20vote\x20via\x20voting_guard\x20(weights\x20resolved\x20per\x20guard)']},{'index':0x167,'name':'ARBITRATION_ARBITRATION','description':'Make\x20definitive\x20arbitration\x20ruling\x20(with\x20indemnity)','governed_operations':['issue\x20the\x20definitive\x20arbitration\x20ruling\x20(with\x20indemnity)']},{'index':0x168,'name':'ARBITRATION_FEEDBACK','description':'Provide\x20feedback\x20on\x20Arb\x20case','governed_operations':['attach\x20feedback\x20to\x20the\x20Arb\x20case']},{'index':0x169,'name':'ARBITRATION_CONFIRM','description':'Confirm\x20materials\x20submitted\x20by\x20principal\x20(starts\x20voting\x20phase)','governed_operations':['confirm\x20the\x20principal\x27s\x20materials\x20(starts\x20the\x20voting\x20phase)']},{'index':0x16a,'name':'ARBITRATION_VOTING_DEADLINE_CHANGE','description':'Change\x20voting\x20deadline\x20for\x20an\x20Arb\x20case','governed_operations':['change\x20the\x20voting\x20deadline\x20for\x20an\x20Arb\x20case']},{'index':0x16b,'name':'ARBITRATION_RESET','description':'Reset\x20arbitration\x20—\x20principal\x20resubmits\x20materials,\x20restart\x20lifecycle','governed_operations':['reset\x20the\x20arbitration\x20(principal\x20resubmits\x20materials)']},{'index':0x16c,'name':'ARBITRATION_ARB_WITHDRAW','description':'Withdraw\x20arbitration\x20fees\x20from\x20Arb\x20into\x20Arbitration.balance','governed_operations':['withdraw\x20arbitration\x20fees\x20from\x20the\x20Arb\x20into\x20Arbitration.balance']},{'index':0x16d,'name':'ARBITRATION_FEES_ALLOC','description':'Allocate\x20arbitration\x20fees\x20to\x20Allocation\x20object','governed_operations':['allocate\x20arbitration\x20fees\x20to\x20an\x20Allocation\x20object']},{'index':0x16e,'name':'ARBITRATION_FEES_TRANSFER','description':'Transfer\x20arbitration\x20fees\x20to\x20Treasury\x20object','governed_operations':['transfer\x20arbitration\x20fees\x20to\x20a\x20Treasury\x20object']},{'index':0x16f,'name':'ARBITRATION_OWNER_RECEIVE','description':'Owner\x20receive\x20(unwrap\x20received\x20Coin/Object\x20and\x20send\x20to\x20Permission\x20owner)','governed_operations':['owner\x20receipt\x20of\x20payments\x20(unwrapped\x20to\x20the\x20owner)','owner\x20receipt\x20of\x20whole\x20objects']},{'index':0x170,'name':'ARBITRATION_UM','description':'Set\x20/\x20clear\x20User\x20Manager\x20(Contact\x20object)','governed_operations':['bind\x20a\x20Contact\x20as\x20the\x20UM\x20coordinator','unbind\x20the\x20UM\x20Contact']}];export const DUAL_GUARD_MATRIX=[{'voting_guard_empty':!![],'usage_guard_empty':!![],'dispute_method':'dispute','vote_method':'vote','scenario':'Open\x20dispute\x20+\x20open\x20voting\x20(1\x20person\x201\x20vote)'},{'voting_guard_empty':!![],'usage_guard_empty':![],'dispute_method':'dispute_via_passport','vote_method':'vote','scenario':'Restricted\x20dispute\x20+\x20open\x20voting'},{'voting_guard_empty':![],'usage_guard_empty':!![],'dispute_method':'dispute','vote_method':'vote_weighted_by_guard','scenario':'Open\x20dispute\x20+\x20weighted\x20voting'},{'voting_guard_empty':![],'usage_guard_empty':![],'dispute_method':'dispute_via_passport','vote_method':'vote_weighted_by_guard','scenario':'Restricted\x20dispute\x20+\x20weighted\x20voting\x20(most\x20controlled)'}];export const ARBITRATION_SCENES=[{'id':'arbitration_create','name':'Create\x20new\x20Arbitration\x20service','operation_category':'lifecycle','permission_index':0x15e,'permission_name':'ARBITRATION_NEW','requires_voting_guard':'any','requires_usage_guard':'any','has_passport_variant':!![],'governed_operations':['create\x20a\x20new\x20arbitration\x20service'],'common_patterns':['Pre-publish\x20config:\x20create\x20Arbitration\x20+\x20Permission\x20together','bPaused\x20defaults\x20to\x20true\x20—\x20must\x20call\x20pause(false)\x20to\x20enable','Generic\x20T:\x20choose\x20Coin\x20type\x20(e.g.\x200x2::wow::WOW)\x20at\x20creation','object-linker\x20binding\x20(core):\x20permission\x20+\x20arbitration\x20linked\x20by\x20an\x20affiliation\x20core\x20binding'],'recommended_templates':['T-AB-01','T-AB-02']},{'id':'arbitration_dispute','name':'File\x20dispute\x20against\x20an\x20Order\x20(creates\x20Arb\x20case)','operation_category':'dispute','permission_index':0x0,'permission_name':'(order\x20op\x20permission\x20—\x20no\x20ARBITRATION_*\x20index)','required_arb_status':[],'resulting_arb_status':'Arbitrator_confirming','requires_voting_guard':'any','requires_usage_guard':'any','has_passport_variant':!![],'governed_operations':['file\x20a\x20dispute\x20against\x20an\x20Order\x20(creates\x20the\x20Arb\x20case)'],'common_patterns':['Fee\x20gate:\x20coin::value(&fee)\x20>=\x20self.fee,\x20else\x20E_FEE_NOT_ENOUGH','Order\x20op\x20permission\x20check\x20required\x20(caller\x20must\x20hold\x20the\x20matching\x20order\x20operation\x20permission)','Creates\x20independent\x20Arb<T>\x20object\x20with\x20its\x20own\x20lifecycle','If\x20usage_guard\x20is\x20Some\x20→\x20the\x20dispute\x20must\x20go\x20through\x20passport\x20verification','Order.dispute\x20list:\x20appends\x20new\x20Arb\x20(max\x2010\x20per\x20Order)','One-shot\x20filing:\x20the\x20Arb\x20is\x20created\x20directly\x20in\x20Arbitrator_confirming\x20status\x20—\x20proposition\x20and\x20description\x20are\x20final\x20at\x20filing;\x20edits\x20require\x20the\x20arbitrator\x20to\x20reset\x20the\x20case\x20back\x20to\x20Principal_confirming\x20first.\x20Assemble\x20the\x20complete\x20proposition\x20before\x20calling\x20dispute.'],'recommended_templates':['T-AB-01','T-AB-03','T-AB-04']},{'id':'arbitration_vote','name':'Vote\x20on\x20Arb\x20propositions','operation_category':'voting','permission_index':0x166,'permission_name':'ARBITRATION_VOTE','required_arb_status':['Voting'],'requires_voting_guard':'any','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['open\x20a\x20vote\x20(1\x20person\x201\x20vote)','cast\x20a\x20weighted\x20vote\x20(weights\x20resolved\x20from\x20the\x20voting\x20guard)'],'common_patterns':['Open\x20vote:\x20voting_guard\x20empty\x20→\x20plain\x20vote\x20(passport\x20variant\x20supported);\x20equal\x20weight\x20'+'(1\x20person\x201\x20vote)\x20but\x20permission\x20358\x20still\x20gates\x20every\x20NON-admin\x20voter\x20—\x20the\x20bound\x20'+'Permission\x27s\x20admin\x20(its\x20creator,\x20by\x20default)\x20always\x20passes,\x20so\x20grant\x20358\x20to\x20the\x20disputing\x20'+'parties\x20or\x20voting\x20collapses\x20to\x20admin-only\x20(E-13)','Weighted\x20vote:\x20voting_guard\x20non-empty\x20→\x20vote\x20weight\x20resolved\x20per\x20voting\x20guard','votes:\x20u8\x20array\x20—\x20index\x20into\x20proposition\x20list\x20(0..N-1)','Mismatch:\x20vote()\x20with\x20non-empty\x20voting_guard\x20→\x20E_VOTING_GUARD_USED','Guard\x20not\x20in\x20list:\x20E_VOTING_GUARD_NOT_FOUND','E-15:\x20the\x20voting_deadline\x20IS\x20the\x20dispute-resolution\x20delay\x20window\x20—\x20the\x20ruling\x20(arbitration)\x20'+'aborts\x20with\x20E_VOTING_DEADLINE_NOT_PASSED\x20until\x20the\x20deadline\x20elapses.\x20Size\x20the\x20window\x20to\x20the\x20'+'business\x20expectation\x20(e.g.\x2010\x20minutes\x20for\x20tests,\x20days\x20for\x20production)'],'recommended_templates':['T-AB-02','T-AB-03']},{'id':'arbitration_confirm','name':'Confirm\x20principal\x20materials\x20and\x20start\x20voting\x20phase','operation_category':'ruling','permission_index':0x169,'permission_name':'ARBITRATION_CONFIRM','required_arb_status':['Arbitrator_confirming'],'resulting_arb_status':'Voting','requires_voting_guard':'any','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['confirm\x20the\x20principal\x27s\x20materials\x20(starts\x20the\x20voting\x20phase)'],'common_patterns':['Transitions\x20Arb\x20from\x20Arbitrator_confirming\x20→\x20Voting','voting_deadline:\x20u64\x20timestamp_ms\x20(null\x20=\x20no\x20deadline)','Once\x20in\x20Voting,\x20only\x20vote\x20/\x20voting_deadline_change\x20/\x20reset\x20allowed'],'recommended_templates':['T-AB-01','T-AB-02']},{'id':'arbitration_feedback','name':'Provide\x20feedback\x20on\x20Arb\x20case','operation_category':'ruling','permission_index':0x168,'permission_name':'ARBITRATION_FEEDBACK','required_arb_status':['Principal_confirming','Arbitrator_confirming','Voting','Arbitrated','Objectionable'],'requires_voting_guard':'not_applicable','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['attach\x20feedback\x20to\x20the\x20Arb\x20case'],'common_patterns':['Feedback\x20is\x20informational\x20—\x20does\x20not\x20change\x20Arb\x20status','Used\x20by\x20principal\x20/\x20arbitrator\x20/\x20voters\x20to\x20attach\x20notes','No\x20state\x20transition;\x20supplements\x20the\x20case\x20record'],'recommended_templates':['T-AB-01','T-AB-07']},{'id':'arbitration_ruling','name':'Make\x20definitive\x20arbitration\x20ruling\x20with\x20indemnity','operation_category':'ruling','permission_index':0x167,'permission_name':'ARBITRATION_ARBITRATION','required_arb_status':['Voting'],'resulting_arb_status':'Arbitrated','requires_voting_guard':'any','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['issue\x20the\x20definitive\x20arbitration\x20ruling\x20(with\x20indemnity)'],'common_patterns':['Ruling\x20produces:\x20feedback\x20(string)\x20+\x20indemnity\x20(u64)','indemnity\x20is\x20compensation\x20amount\x20—\x20paid\x20through\x20the\x20order\x20compensation\x20flow','compensation\x20is\x20package-internal\x20—\x20only\x20the\x20order\x20lifecycle\x20can\x20trigger\x20it','Once\x20Arbitrated,\x20case\x20enters\x20Objectionable\x20window\x20(reset\x20possible)','E-16:\x20the\x20indemnity\x20is\x20paid\x20from\x20the\x20SERVICE\x27s\x20merchant-prepaid\x20compensation_fund\x20pool,\x20'+'NOT\x20from\x20the\x20order\x20escrow.\x20If\x20the\x20pool\x20is\x20smaller\x20than\x20the\x20indemnity,\x20arb_claim_compensation\x20'+'aborts\x20with\x20code\x2027\x20(E_COMPENSATION_NOT_MATCH)\x20—\x20the\x20ruling\x20stands\x20but\x20is\x20unpayable\x20until\x20the\x20'+'merchant\x20tops\x20up\x20(the\x20abort\x20does\x20NOT\x20consume\x20the\x20claim)','W5-15\x20(ddmc4\x20B-28\x20/\x20h1w9\x20F-08):\x20AWARD\x20≠\x20RECEIPT\x20—\x20the\x20ruling\x20writes\x20the\x20indemnity\x20on\x20the\x20case\x20and\x20'+'moves\x20NO\x20funds;\x20the\x20buyer\x20is\x20paid\x20only\x20at\x20arb_claim_compensation.\x20A\x20ZERO-indemnity\x20ruling\x20pays\x20'+'nothing\x20by\x20design\x20(its\x20claim\x20closes\x20the\x20case).\x20The\x20chain\x20checks\x20only\x20the\x203x\x20ceiling\x20at\x20the\x20'+'ruling\x20entry,\x20never\x20the\x20pool\x20—\x20the\x20MCP\x20ruling\x20receipt\x20now\x20probes\x20it\x20(\x22the\x20pool\x20can\x20currently\x20'+'pay\x20X;\x20this\x20case\x20needs\x20Y\x22),\x20and\x20a\x20definitely-unpayable\x20claim\x20is\x20refused\x20pre-flight\x20with\x20'+'compensation_pool_insufficient\x20(top-up\x20path\x20named)','E-17/E-17b:\x20the\x20ruling\x20does\x20NOT\x20propagate\x20to\x20the\x20Machine/Allocation\x20escrow,\x20so\x20a\x20settlement\x20'+'forward\x20can\x20still\x20FIRE\x20after\x20a\x20claim.\x20TWO-RAIL\x20INDEPENDENCE\x20(decision\x2011):\x20principal\x20restitution\x20'+'(order\x20fund\x20rails)\x20and\x20damages\x20(arbitration\x20indemnity)\x20are\x20two\x20INDEPENDENT\x20commercial\x20tracks\x20—\x20'+'the\x20escrow\x27s\x20Order-side\x20receive\x20has\x20deliberately\x20NO\x20claimed_by\x20gate\x20(rex2\x20T9\x20live-proven:\x20claim\x20'+'first,\x20then\x20owner_receive\x20extracted\x20the\x20full\x20principal),\x20and\x20decision-11\x20refund/settle\x20rails\x20are\x20'+'NODE-GATED\x20(terminal\x20refund/settle\x20node)\x20and\x20NEVER\x20read\x20order.claimed_by;\x20the\x20recover\x20rail\x20is\x20a\x20'+'terminal-node-gated\x20sweep\x20(RAIL_CLAIMED_BY_LEG\x20critical\x20bans\x20any\x20claimed_by\x20leg\x20on\x20a\x20fund\x20rail).\x20'+'The\x20old\x20allocator-pairing\x20seal\x20—\x20refund\x20rail\x20gated\x20order.claimed_by\x20none\x20+\x20recover\x20rail\x20gated\x20'+'claimed_by\x20some\x20(D-BUG-2\x20shape,\x20historically\x20shipped\x20as\x20refund_gate/recover_gate)\x20—\x20is\x20RETIRED:\x20'+'no\x20mutual\x20exclusion\x20is\x20engineered\x20between\x20the\x20tracks,\x20and\x20refund\x20+\x20award\x20overlap\x20is\x20LEGAL,\x20'+'disclosed\x20at\x20the\x20MCP\x20dual-payout\x20confirmation\x20gate\x20(rex2\x20T6/T9\x20live\x20double\x20payout,\x20297M\x20>\x20250M\x20'+'principal,\x20is\x20the\x20shape\x20the\x20gate\x20covers).\x20Keeper\x20posture\x20拍板⑧\x20'+'dm-mtw-261027:\x20the\x20acknowledge_dual_payout\x20flag\x20stays\x20a\x20HUMAN\x20netting\x20decision\x20—\x20an\x20automated\x20keeper\x20refused\x20with\x20'+'dual_payout_unconfirmed\x20must\x20stop\x20and\x20escalate,\x20never\x20self-ack;\x20every\x20refusal\x20envelope\x20carries\x20the\x20'+'KEEPER\x20DIRECTIVE\x20verbatim.\x20claim\x20mechanics\x20(arbitration\x20side):\x20'+'compensate()\x20sets\x20claimed_by\x20when\x20an\x20award\x20is\x20CLAIMED\x20—\x20and\x20since\x20BF-14\x20a\x20zero-award\x20claim\x20aborts\x20'+'E_ZERO_INDEMNITY_CLAIM\x20inside\x20arbitration\x20finalization\x20BEFORE\x20any\x20state\x20change,\x20so\x20a\x20plain\x20dismissal\x20leaves\x20'+'the\x20flag\x20unset.\x20RULED-ZERO\x20STAMP\x20(F-BS-54/56,\x20protocol\x20154\x20'+'enable_arb_dismissal_conclusion_gate):\x20the\x20arbitration\x20conclusion\x20operation\x20stamps\x20claimed_by\x20on\x20a\x20CONCLUDED\x20DISMISSAL\x20'+'(amount-insensitive,\x20BKN-P1\x20decision\x20option\x20a)\x20—\x20the\x20stamp\x20is\x20arbitration-side\x20EVIDENCE\x20for\x20the\x20'+'indemnity\x20track;\x20decision-11\x20fund\x20rails\x20do\x20not\x20read\x20it,\x20so\x20it\x20does\x20not\x20close\x20any\x20escrow\x20exit\x20'+'(the\x20recover\x20rail\x20sweeps\x20at\x20its\x20terminal\x20node\x20regardless).\x20Probe\x20the\x20protocol\x20feature\x20before\x20'+'relying\x20on\x20the\x20stamp\x27s\x20arbitration-side\x20effects.\x20STRANDING\x20IS\x20A\x20SERVICE-SHAPE\x20BUG,\x20'+'NOT\x20A\x20CHAIN\x20RULE:\x20a\x20refund\x20rail\x20with\x20NO\x20node-gated\x20exit\x20—\x20the\x20pre-decision-11\x20claimed_by-none\x20'+'gate\x20historically\x20produced\x20exactly\x20this\x20—\x20leaves\x20an\x20order\x20with\x20no\x20escrow\x20exit\x20'+'(h1b-tn-261024\x20O11\x20live:\x201.0\x20WOW\x20stranded\x20after\x20a\x20zero-payout\x20'+'dismissal).\x20The\x20compile-time\x20rail\x20verifier\x20blocks\x20that\x20shape\x20pre-publish\x20'+'(RAIL_AWARD_EXIT_MISSING).\x20The\x20tracks\x20guarantee\x20no\x20stranding,\x20not\x20no-misallocation:\x20'+'award-amount\x20polarity\x20is\x20not\x20expressible\x20on\x20the\x20refund\x20track\x20(long-term:\x20N-9\x20order-authority\x20'+'model\x20window)'],'recommended_templates':['T-AB-01','T-AB-05']},{'id':'arbitration_reset','name':'Reset\x20arbitration\x20—\x20principal\x20resubmits\x20materials','operation_category':'ruling','permission_index':0x16b,'permission_name':'ARBITRATION_RESET','required_arb_status':['Objectionable','Arbitrator_confirming'],'resulting_arb_status':'Principal_confirming','requires_voting_guard':'any','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['reset\x20the\x20arbitration\x20(principal\x20resubmits\x20materials)'],'common_patterns':['Resets\x20Arb\x20from\x20Objectionable/Arbitrator_confirming\x20→\x20Principal_confirming','Used\x20when\x20principal\x20objects\x20to\x20ruling\x20and\x20resubmits\x20materials','Feedback\x20required\x20(string\x20explaining\x20reset\x20reason)','Restart\x20full\x20lifecycle:\x20Principal_confirming\x20→\x20...\x20→\x20Finished'],'recommended_templates':['T-AB-07']},{'id':'arbitration_arb_withdraw','name':'Withdraw\x20arbitration\x20fees\x20from\x20Arb\x20into\x20Arbitration.balance','operation_category':'fund','permission_index':0x16c,'permission_name':'ARBITRATION_ARB_WITHDRAW','required_arb_status':['Finished','Arbitrated'],'requires_voting_guard':'not_applicable','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['withdraw\x20arbitration\x20fees\x20from\x20the\x20Arb\x20into\x20Arbitration.balance'],'common_patterns':['Moves\x20fees\x20from\x20the\x20Arb\x20object\x20into\x20Arbitration.balance\x20(clock-checked)','Finished:\x20withdraw\x20immediately','Arbitrated:\x20must\x20wait\x20WITHDRAW_DURATION_TIME\x20(30d)\x20past\x20indemnity.time\x20—\x20silence\x20=\x20acceptance','Objectionable:\x20NEVER\x20withdrawable\x20(protocol\x20141)\x20—\x20the\x20fee\x20stays\x20escrowed\x20until\x20the\x20objection\x20cycle\x20is\x20closed\x20by\x20the\x20principal\x20re-confirming','Increases\x20Arbitration.balance\x20—\x20funds\x20available\x20for\x20fee\x20allocation/transfer'],'recommended_templates':['T-AB-06']},{'id':'arbitration_fees_alloc','name':'Allocate\x20arbitration\x20fees\x20to\x20Allocation\x20object','operation_category':'fund','permission_index':0x16d,'permission_name':'ARBITRATION_FEES_ALLOC','requires_voting_guard':'not_applicable','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['allocate\x20arbitration\x20fees\x20to\x20an\x20Allocation\x20object'],'common_patterns':['Destination:\x20Allocation\x20object\x20(parameterized\x20fund\x20distribution)','payment_remark\x20+\x20payment_index:\x20bookkeeping\x20for\x20Payment\x20object','May\x20create\x20new\x20Payment\x20object\x20if\x20newPayment\x20name\x20provided','Triggers\x20balance::withdraw_all\x20—\x20extracts\x20ALL\x20balance'],'recommended_templates':['T-AB-06']},{'id':'arbitration_fees_transfer','name':'Transfer\x20arbitration\x20fees\x20to\x20Treasury\x20object','operation_category':'fund','permission_index':0x16e,'permission_name':'ARBITRATION_FEES_TRANSFER','requires_voting_guard':'not_applicable','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['transfer\x20arbitration\x20fees\x20to\x20a\x20Treasury\x20object'],'common_patterns':['Destination:\x20Treasury\x20object\x20(general\x20fund\x20pool)','Same\x20bookkeeping\x20as\x20fee\x20allocation\x20(remark\x20+\x20index\x20+\x20newPayment)','Triggers\x20balance::withdraw_all\x20—\x20extracts\x20ALL\x20balance','Choose\x20Allocation\x20vs\x20Treasury\x20by\x20distribution\x20need'],'recommended_templates':['T-AB-06']},{'id':'arbitration_voting_guard_config','name':'Configure\x20voting_guard\x20list\x20(add\x20/\x20set\x20/\x20remove\x20/\x20clear)','operation_category':'guard','permission_index':0x162,'permission_name':'ARBITRATION_VOTING_GUARD','requires_voting_guard':'any','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['add\x20a\x20passport-identifier\x20voting\x20guard\x20(dynamic\x20weight)','add\x20a\x20fixed-weight\x20voting\x20guard','remove\x20a\x20voting\x20guard','clear\x20the\x20voting\x20guard\x20list'],'common_patterns':['Max\x2050\x20guards:\x20MAX_VOTING_GUARD_COUNT=50\x20(off-by-one-safe:\x20len<50\x20allows\x20add)','GuardIdentifier(u8):\x20dynamic\x20weight\x20from\x20Passport\x20submission\x20value','FixedValue(u32):\x20static\x20weight\x20(e.g.\x20100\x20votes\x20per\x20holder)','Add\x20same\x20guard\x20twice\x20→\x20updates\x20vote_weight\x20(no\x20duplicate)','op=\x27set\x27\x20=\x20clear\x20then\x20add;\x20op=\x27add\x27\x20=\x20append;\x20op=\x27remove\x27\x20=\x20by\x20address'],'recommended_templates':['T-AB-02','T-AB-03']},{'id':'arbitration_usage_guard_config','name':'Configure\x20usage_guard\x20(set\x20/\x20clear)','operation_category':'guard','permission_index':0x163,'permission_name':'ARBITRATION_USAGE_GUARD','requires_voting_guard':'not_applicable','requires_usage_guard':'any','has_passport_variant':!![],'governed_operations':['set\x20the\x20usage\x20guard\x20(restrict\x20who\x20can\x20file\x20disputes)','clear\x20the\x20usage\x20guard'],'common_patterns':['Single\x20guard\x20(Option<address>)\x20—\x20not\x20a\x20list','Some(guard):\x20the\x20dispute\x20must\x20go\x20through\x20passport\x20verification','None:\x20dispute\x20can\x20use\x20either\x20variant\x20(no\x20passport\x20needed)','object-linker\x20affiliation\x20change:\x20updates\x20link\x20when\x20guard\x20changes'],'recommended_templates':['T-AB-04']},{'id':'arbitration_pause','name':'Pause\x20/\x20resume\x20Arbitration\x20service','operation_category':'lifecycle','permission_index':0x164,'permission_name':'ARBITRATION_PAUSE','requires_voting_guard':'not_applicable','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['pause/resume\x20the\x20arbitration\x20service'],'common_patterns':['bPaused\x20default\x20true\x20—\x20new\x20Arbitration\x20cannot\x20accept\x20disputes','pause(false)\x20to\x20enable,\x20pause(true)\x20to\x20disable','Paused\x20Arbitration\x20rejects\x20dispute\x20(E_PAUSED)','Does\x20not\x20affect\x20already-open\x20Arb\x20cases'],'recommended_templates':['T-AB-01']},{'id':'arbitration_service_statement','name':'Service\x20(defendant)\x20appends\x20a\x20text\x20statement\x20to\x20the\x20case\x20record','operation_category':'dispute','permission_index':0x141,'permission_name':'SERVICE_ARB_STATEMENT','requires_voting_guard':'not_applicable','requires_usage_guard':'not_applicable','has_passport_variant':!![],'governed_operations':['append\x20the\x20seller\x27s\x20text\x20statement\x20to\x20a\x20case\x20against\x20an\x20order\x20of\x20the\x20service\x20(ArbStatementEvent)'],'common_patterns':['Defendant-side\x20voice\x20WITHOUT\x20holding\x20the\x20order\x20—\x20the\x20arb/arbitration\x20function\x20family\x20is\x20order-anchored;\x20this\x20entry\x20is\x20service-anchored','PRIMARY\x20evidence\x20channel\x20is\x20Messenger:\x20submit\x20encrypted\x20WTS\x20records\x20of\x20the\x20exchange\x20with\x20the\x20order\x20customer\x20first','This\x20statement\x20is\x20the\x20SECONDARY\x20channel:\x20declare\x20facts\x20or\x20report\x20customer\x20behavior\x20(absence,\x20non-cooperation)\x20on\x20the\x20case\x20record','Event-only:\x20nothing\x20on\x20the\x20Arb\x20object\x20is\x20mutated;\x20the\x20record\x20cannot\x20be\x20rewritten\x20or\x20deleted\x20by\x20any\x20party','Text\x20length\x20cap\x20identical\x20to\x20description/objection\x20(DESCRIPTION\x20bound,\x204000)'],'recommended_templates':[]}];export const ARBITRATION_LEDGER_VERSION='1.0.0';export function getScenesByCategory(a){return ARBITRATION_SCENES['filter'](b=>b['operation_category']===a);}export function findSceneById(a){return ARBITRATION_SCENES['find'](b=>b['id']===a);}export function findSceneByPermissionIndex(a){return ARBITRATION_SCENES['find'](b=>b['permission_index']===a);}export function getPermissionByIndex(a){return ARBITRATION_PERMISSIONS['find'](b=>b['index']===a);}export function getPermissionByName(a){return ARBITRATION_PERMISSIONS['find'](b=>b['name']===a);}export function isReservedIndex(a){const b=getPermissionByIndex(a);return!!b?.['is_reserved'];}export function isUsedPermissionIndex(a){const b=getPermissionByIndex(a);return!!b&&!b['is_reserved'];}export function getActivePermissionCount(){return ARBITRATION_PERMISSIONS['filter'](a=>!a['is_reserved'])['length'];}export function inferSceneFromIntent(a){const b=a['toLowerCase'](),c=[{'keywords':['create','new'],'sceneId':'arbitration_create'},{'keywords':['dispute','file','complaint'],'sceneId':'arbitration_dispute'},{'keywords':['vote','voting','decide'],'sceneId':'arbitration_vote'},{'keywords':['confirm','materials'],'sceneId':'arbitration_confirm'},{'keywords':['feedback','opinion'],'sceneId':'arbitration_feedback'},{'keywords':['ruling','arbitration','verdict'],'sceneId':'arbitration_ruling'},{'keywords':['reset','resubmit'],'sceneId':'arbitration_reset'},{'keywords':['arb_withdraw','withdraw','withdraw\x20fees'],'sceneId':'arbitration_arb_withdraw'},{'keywords':['allocate','allocate\x20fees','fees\x20allocation'],'sceneId':'arbitration_fees_alloc'},{'keywords':['fees_transfer','transfer','transfer\x20in'],'sceneId':'arbitration_fees_transfer'},{'keywords':['voting_guard','voting\x20guard'],'sceneId':'arbitration_voting_guard_config'},{'keywords':['usage_guard','usage\x20guard'],'sceneId':'arbitration_usage_guard_config'},{'keywords':['pause','enable'],'sceneId':'arbitration_pause'}];for(const {keywords:d,sceneId:e}of c){if(d['some'](f=>b['includes'](f['toLowerCase']()))){const f=findSceneById(e);if(f)return f;}}return undefined;}export function getDualGuardMatrixEntry(a,b){return DUAL_GUARD_MATRIX['find'](c=>c['voting_guard_empty']===a&&c['usage_guard_empty']===b);}export function isValidArbStatusTransition(a,b){const c={'Principal_confirming':['Arbitrator_confirming'],'Arbitrator_confirming':['Voting','Principal_confirming'],'Voting':['Arbitrated'],'Arbitrated':['Objectionable','Finished','Withdrawn'],'Objectionable':['Principal_confirming'],'Finished':['Withdrawn'],'Withdrawn':[]};return c[a]?.['includes'](b)??![];}export function isTerminalArbStatus(a){return ARB_TERMINAL_STATUSES['includes'](a);}export function getScenesProducingStatus(a){return ARBITRATION_SCENES['filter'](b=>b['resulting_arb_status']===a);}export function getScenesRequiringStatus(a){return ARBITRATION_SCENES['filter'](b=>b['required_arb_status']?.['includes'](a));}export function getArbitrationScenesCount(){return ARBITRATION_SCENES['length'];}export function getAllArbitrationPermissions(){return[...ARBITRATION_PERMISSIONS];}export function getActiveArbitrationPermissions(){return ARBITRATION_PERMISSIONS['filter'](a=>!a['is_reserved']);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{MAX_VOTING_GUARD_COUNT}from'@wowok/wowok';import{getDualGuardMatrixEntry,isValidArbStatusTransition}from'./arbitration-ledger.js';export function initPuzzleFromIntent(a){const b={};return(a['action']||a['rule_sentence'])&&(b['intent']={'action':a['action']??'create_arbitration','target_arb':a['target_arb'],'target_order':a['target_order'],'rule_sentence':a['rule_sentence']??'','failure_conditions':a['failure_conditions']??[]}),b['constraints']={'F_AB_01_coin_type_valid':!![],'F_AB_02_permission_address_valid':!![],'F_AB_03_bPaused_default_true':!![],'F_AB_04_fee_u64_nonneg':!![],'F_AB_05_voting_guard_count_le_50':!![],'F_AB_06_voting_guard_no_duplicate':!![],'F_AB_07_usage_guard_single':!![],'F_AB_08_arb_status_transition_valid':!![],'F_AB_09_arb_belongs_to_arbitration':!![],'F_AB_10_order_op_permission':!![],'F_AB_11_dispute_fee_sufficient':!![],'F_AB_12_dual_guard_coherent':!![]},b['voting_guard']={'guards':[],'weight_mode':'none'},b['usage_guard']={'guard':null,'passport_required':![],'filter_rules':[]},b;}export function checkPuzzleCompleteness(a){const b=[],c=[];if(!a['intent'])b['push']('A'),c['push']({'dimension':'A','reason':'Intent\x20not\x20specified\x20(action\x20+\x20rule_sentence)'});else{if(!a['intent']['rule_sentence'])b['push']('A'),c['push']({'dimension':'A','reason':'rule_sentence\x20is\x20empty'});else{const d=a['intent']['action'];(d==='file_dispute'||d==='vote'||d==='confirm_materials'||d==='provide_feedback'||d==='make_ruling'||d==='reset_arbitration'||d==='withdraw_fees')&&!a['intent']['target_arb']&&!a['intent']['target_order']&&(b['push']('A'),c['push']({'dimension':'A','reason':d+'\x20requires\x20target_arb\x20or\x20target_order'})),d==='file_dispute'&&!a['intent']['target_order']&&(b['push']('A'),c['push']({'dimension':'A','reason':'file_dispute\x20requires\x20target_order'}));}}if(!a['arbitration_config']){const e=a['intent']?.['action']==='create_arbitration'||a['intent']?.['action']==='configure';e&&(b['push']('B'),c['push']({'dimension':'B','reason':'Arbitration\x20config\x20not\x20specified'}));}else a['intent']?.['action']==='create_arbitration'&&(!a['arbitration_config']['coin_type']&&(b['push']('B'),c['push']({'dimension':'B','reason':'coin_type\x20(generic\x20T)\x20required\x20for\x20create_arbitration'})),!a['arbitration_config']['permission_address']&&(b['push']('B'),c['push']({'dimension':'B','reason':'permission_address\x20required\x20for\x20create_arbitration'})));if(!a['voting_guard'])(a['intent']?.['action']==='configure_voting_guard'||a['intent']?.['action']==='vote')&&(b['push']('C'),c['push']({'dimension':'C','reason':'voting_guard\x20config\x20not\x20specified'}));else a['intent']?.['action']==='vote'&&a['voting_guard']['guards']['length']>0x0&&(a['voting_guard']['weight_mode']==='none'&&(b['push']('C'),c['push']({'dimension':'C','reason':'weight_mode\x20must\x20be\x20set\x20when\x20guards\x20non-empty'})));!a['usage_guard']&&((a['intent']?.['action']==='configure_usage_guard'||a['intent']?.['action']==='file_dispute')&&(b['push']('D'),c['push']({'dimension':'D','reason':'usage_guard\x20config\x20not\x20specified'})));if(!a['arbiter_config'])(a['intent']?.['action']==='vote'||a['intent']?.['action']==='make_ruling')&&(b['push']('E'),c['push']({'dimension':'E','reason':'Arbiter\x20config\x20not\x20specified'}));else a['intent']?.['action']==='vote'&&a['arbiter_config']['arbitrators']['length']===0x0&&(b['push']('E'),c['push']({'dimension':'E','reason':'At\x20least\x20one\x20arbitrator\x20required\x20for\x20voting'}));if(!a['constraints'])b['push']('F'),c['push']({'dimension':'F','reason':'Constraints\x20not\x20checked'});else{const f=['confirm_materials','vote','provide_feedback','make_ruling','reset_arbitration','withdraw_fees'];a['intent']&&f['includes'](a['intent']['action'])&&(!a['current_arb_status']&&(b['push']('F'),c['push']({'dimension':'F','reason':'current_arb_status\x20required\x20for\x20Arb\x20operations'})),!a['expected_arb_status']&&a['intent']['action']!=='provide_feedback'&&(b['push']('F'),c['push']({'dimension':'F','reason':'expected_arb_status\x20required\x20(non-feedback\x20Arb\x20ops)'})));}return{'dimensions':['A','B','C','D','E','F'],'missing':b,'missing_details':c,'complete':b['length']===0x0,'next_step':b['length']===0x0?'Puzzle\x20complete\x20—\x20ready\x20for\x20confirmation\x20text\x20generation':'Next:\x20complete\x20dimension\x20'+b[0x0]+'\x20—\x20'+c[0x0]['reason']};}export function validateConstraints(a){const b=[];a['voting_guard']&&a['voting_guard']['guards']['length']>MAX_VOTING_GUARD_COUNT&&b['push']({'constraint_id':'F-AB-05','severity':'high','message':'voting_guard\x20count\x20'+a['voting_guard']['guards']['length']+'\x20exceeds\x20MAX_VOTING_GUARD_COUNT\x20'+MAX_VOTING_GUARD_COUNT,'current_value':a['voting_guard']['guards']['length'],'limit':MAX_VOTING_GUARD_COUNT});if(a['voting_guard']&&a['voting_guard']['guards']['length']>0x0){const c=a['voting_guard']['guards']['map'](e=>e['guard']),d=c['filter']((e,f)=>c['indexOf'](e)!==f);d['length']>0x0&&b['push']({'constraint_id':'F-AB-06','severity':'medium','message':'Duplicate\x20voting_guard\x20addresses:\x20'+d['join'](',\x20'),'current_value':d['join'](',')});}a['current_arb_status']&&a['expected_arb_status']&&(a['current_arb_status']!==a['expected_arb_status']&&!isValidArbStatusTransition(a['current_arb_status'],a['expected_arb_status'])&&b['push']({'constraint_id':'F-AB-08','severity':'critical','message':'Invalid\x20Arb\x20status\x20transition:\x20'+a['current_arb_status']+'\x20→\x20'+a['expected_arb_status'],'current_value':a['current_arb_status']+'\x20→\x20'+a['expected_arb_status']}));a['intent']?.['action']==='file_dispute'&&a['arbitration_config']?.['fee']&&(a['arbitration_config']['fee']==='0'&&b['push']({'constraint_id':'F-AB-11','severity':'high','message':'Dispute\x20fee\x20is\x200\x20—\x20likely\x20below\x20arbitration.fee\x20threshold','current_value':'0'}));if(a['voting_guard']&&a['usage_guard']){const e=getDualGuardMatrixEntry(a['voting_guard']['guards']['length']===0x0,a['usage_guard']['guard']===null);a['intent']?.['action']==='file_dispute'&&(a['usage_guard']['guard']!==null&&!a['usage_guard']['passport_required']&&b['push']({'constraint_id':'F-AB-12','severity':'high','message':'usage_guard\x20is\x20Some\x20but\x20passport_required=false\x20—\x20dispute\x20will\x20fail\x20with\x20E_NEED_PASSPORT'})),a['intent']?.['action']==='vote'&&(a['voting_guard']['guards']['length']>0x0&&!a['intent']['target_arb']&&b['push']({'constraint_id':'F-AB-12','severity':'high','message':'voting_guard\x20is\x20non-empty\x20but\x20vote\x20target_arb\x20missing\x20—\x20must\x20use\x20the\x20Passport-verified\x20voting\x20path'}));}if(a['intent']?.['action']==='file_dispute'){}return b;}export function generateConfirmationText(a){const b=[];b['push']('═══\x20Arbitration\x20Confirmation\x20═══'),b['push']('');if(a['intent']){b['push']('Action:\x20'+a['intent']['action']);if(a['intent']['target_arb'])b['push']('Target\x20Arb:\x20'+a['intent']['target_arb']);if(a['intent']['target_order'])b['push']('Target\x20Order:\x20'+a['intent']['target_order']);b['push']('Rule:\x20'+a['intent']['rule_sentence']);if(a['intent']['failure_conditions']['length']>0x0){b['push']('Failure\x20conditions:');for(const e of a['intent']['failure_conditions'])b['push']('\x20\x20-\x20'+e);}b['push']('');}if(a['arbitration_config']){b['push']('─\x20Arbitration\x20Config\x20──────────────');const f=a['arbitration_config'];if(f['description'])b['push']('Description:\x20'+f['description']);if(f['location'])b['push']('Location:\x20'+f['location']);if(f['fee']!==undefined)b['push']('Fee:\x20'+f['fee']);if(f['bPaused']!==undefined)b['push']('bPaused:\x20'+f['bPaused']+'\x20(default\x20true\x20on\x20creation)');if(f['coin_type'])b['push']('Coin\x20type\x20(T):\x20'+f['coin_type']);if(f['permission_address'])b['push']('Permission:\x20'+f['permission_address']);if(f['um']!==undefined)b['push']('UM:\x20'+(f['um']??'(none)'));b['push']('');}if(a['voting_guard']&&a['voting_guard']['guards']['length']>0x0){b['push']('─\x20voting_guard\x20Config\x20──────────────'),b['push']('Count:\x20'+a['voting_guard']['guards']['length']+'\x20/\x20'+MAX_VOTING_GUARD_COUNT),b['push']('Weight\x20mode:\x20'+a['voting_guard']['weight_mode']);for(const h of a['voting_guard']['guards']){const i='GuardIdentifier'in h['vote_weight']?'GuardIdentifier('+h['vote_weight']['GuardIdentifier']+')':'FixedValue('+h['vote_weight']['FixedValue']+')';b['push']('\x20\x20'+h['guard']+':\x20'+i);}a['voting_guard']['cooperation_matrix']&&b['push']('Cooperation:\x20'+a['voting_guard']['cooperation_matrix']['scenario']),b['push']('');}if(a['usage_guard']&&a['usage_guard']['guard']!==null){b['push']('─\x20usage_guard\x20Config\x20──────────────'),b['push']('Guard:\x20'+a['usage_guard']['guard']),b['push']('Passport\x20required:\x20'+a['usage_guard']['passport_required']);if(a['usage_guard']['filter_rules']['length']>0x0){b['push']('Filter\x20rules:');for(const j of a['usage_guard']['filter_rules'])b['push']('\x20\x20-\x20'+j);}b['push']('');}if(a['arbiter_config']&&a['arbiter_config']['arbitrators']['length']>0x0){b['push']('─\x20Arbiter\x20Config\x20──────────────'),b['push']('Arbitrators\x20('+a['arbiter_config']['arbitrators']['length']+'):\x20'+a['arbiter_config']['arbitrators']['join'](',\x20')),b['push']('Vote\x20distribution:\x20'+a['arbiter_config']['vote_distribution']),b['push']('Ruling\x20authority:\x20'+a['arbiter_config']['ruling_authority']);if(a['arbiter_config']['fees_split']){b['push']('Fees\x20split:');const k=a['arbiter_config']['fees_split'];if(k['allocation'])b['push']('\x20\x20→\x20Allocation:\x20'+k['allocation']);if(k['treasury'])b['push']('\x20\x20→\x20Treasury:\x20'+k['treasury']);if(k['remark'])b['push']('\x20\x20Remark:\x20'+k['remark']);if(k['payment_index']!==undefined)b['push']('\x20\x20Payment\x20index:\x20'+k['payment_index']);}b['push']('');}if(a['current_arb_status']||a['expected_arb_status']){b['push']('─\x207-State\x20Flow\x20──────────────');if(a['current_arb_status'])b['push']('Current:\x20'+a['current_arb_status']);if(a['expected_arb_status'])b['push']('Expected\x20after:\x20'+a['expected_arb_status']);b['push']('');}const d=validateConstraints(a);if(d['length']>0x0){b['push']('─\x20Constraint\x20Violations\x20──────────────');for(const l of d){b['push']('\x20\x20['+l['severity']+']\x20'+l['constraint_id']+':\x20'+l['message']);}b['push']('');}return b['join']('\x0a');}
|
|
1
|
+
import{MAX_VOTING_GUARD_COUNT}from'@wowok/wowok';import{getDualGuardMatrixEntry,isValidArbStatusTransition}from'./arbitration-ledger.js';export function initPuzzleFromIntent(a){const b={};return(a['action']||a['rule_sentence'])&&(b['intent']={'action':a['action']??'create_arbitration','target_arb':a['target_arb'],'target_order':a['target_order'],'rule_sentence':a['rule_sentence']??'','failure_conditions':a['failure_conditions']??[]}),b['constraints']={'F_AB_01_coin_type_valid':!![],'F_AB_02_permission_address_valid':!![],'F_AB_03_bPaused_default_true':!![],'F_AB_04_fee_u64_nonneg':!![],'F_AB_05_voting_guard_count_le_50':!![],'F_AB_06_voting_guard_no_duplicate':!![],'F_AB_07_usage_guard_single':!![],'F_AB_08_arb_status_transition_valid':!![],'F_AB_09_arb_belongs_to_arbitration':!![],'F_AB_10_order_op_permission':!![],'F_AB_11_dispute_fee_sufficient':!![],'F_AB_12_dual_guard_coherent':!![]},b['voting_guard']={'guards':[],'weight_mode':'none'},b['usage_guard']={'guard':null,'passport_required':![],'filter_rules':[]},b;}export function checkPuzzleCompleteness(a){const b=[],c=[];if(!a['intent'])b['push']('A'),c['push']({'dimension':'A','reason':'Intent\x20not\x20specified\x20(action\x20+\x20rule_sentence)'});else{if(!a['intent']['rule_sentence'])b['push']('A'),c['push']({'dimension':'A','reason':'rule_sentence\x20is\x20empty'});else{const d=a['intent']['action'];(d==='file_dispute'||d==='vote'||d==='confirm_materials'||d==='provide_feedback'||d==='make_ruling'||d==='reset_arbitration'||d==='withdraw_fees')&&!a['intent']['target_arb']&&!a['intent']['target_order']&&(b['push']('A'),c['push']({'dimension':'A','reason':d+'\x20requires\x20target_arb\x20or\x20target_order'})),d==='file_dispute'&&!a['intent']['target_order']&&(b['push']('A'),c['push']({'dimension':'A','reason':'file_dispute\x20requires\x20target_order'}));}}if(!a['arbitration_config']){const e=a['intent']?.['action']==='create_arbitration'||a['intent']?.['action']==='configure';e&&(b['push']('B'),c['push']({'dimension':'B','reason':'Arbitration\x20config\x20not\x20specified'}));}else a['intent']?.['action']==='create_arbitration'&&(!a['arbitration_config']['coin_type']&&(b['push']('B'),c['push']({'dimension':'B','reason':'coin_type\x20(generic\x20T)\x20required\x20for\x20create_arbitration'})),!a['arbitration_config']['permission_address']&&(b['push']('B'),c['push']({'dimension':'B','reason':'permission_address\x20required\x20for\x20create_arbitration'})));if(!a['voting_guard'])(a['intent']?.['action']==='configure_voting_guard'||a['intent']?.['action']==='vote')&&(b['push']('C'),c['push']({'dimension':'C','reason':'voting_guard\x20config\x20not\x20specified'}));else a['intent']?.['action']==='vote'&&a['voting_guard']['guards']['length']>0x0&&(a['voting_guard']['weight_mode']==='none'&&(b['push']('C'),c['push']({'dimension':'C','reason':'weight_mode\x20must\x20be\x20set\x20when\x20guards\x20non-empty'})));!a['usage_guard']&&((a['intent']?.['action']==='configure_usage_guard'||a['intent']?.['action']==='file_dispute')&&(b['push']('D'),c['push']({'dimension':'D','reason':'usage_guard\x20config\x20not\x20specified'})));if(!a['arbiter_config'])(a['intent']?.['action']==='vote'||a['intent']?.['action']==='make_ruling')&&(b['push']('E'),c['push']({'dimension':'E','reason':'Arbiter\x20config\x20not\x20specified'}));else a['intent']?.['action']==='vote'&&a['arbiter_config']['arbitrators']['length']===0x0&&(b['push']('E'),c['push']({'dimension':'E','reason':'At\x20least\x20one\x20arbitrator\x20required\x20for\x20voting'}));if(!a['constraints'])b['push']('F'),c['push']({'dimension':'F','reason':'Constraints\x20not\x20checked'});else{const f=['confirm_materials','vote','provide_feedback','make_ruling','reset_arbitration','withdraw_fees'];a['intent']&&f['includes'](a['intent']['action'])&&(!a['current_arb_status']&&(b['push']('F'),c['push']({'dimension':'F','reason':'current_arb_status\x20required\x20for\x20Arb\x20operations'})),!a['expected_arb_status']&&a['intent']['action']!=='provide_feedback'&&(b['push']('F'),c['push']({'dimension':'F','reason':'expected_arb_status\x20required\x20(non-feedback\x20Arb\x20ops)'})));}return{'dimensions':['A','B','C','D','E','F'],'missing':b,'missing_details':c,'complete':b['length']===0x0,'next_step':b['length']===0x0?'Puzzle\x20complete\x20—\x20ready\x20for\x20confirmation\x20text\x20generation':'Next:\x20complete\x20dimension\x20'+b[0x0]+'\x20—\x20'+c[0x0]['reason']};}export function validateConstraints(a){const b=[];a['voting_guard']&&a['voting_guard']['guards']['length']>MAX_VOTING_GUARD_COUNT&&b['push']({'constraint_id':'F-AB-05','severity':'high','message':'voting_guard\x20count\x20'+a['voting_guard']['guards']['length']+'\x20exceeds\x20MAX_VOTING_GUARD_COUNT\x20'+MAX_VOTING_GUARD_COUNT,'current_value':a['voting_guard']['guards']['length'],'limit':MAX_VOTING_GUARD_COUNT});if(a['voting_guard']&&a['voting_guard']['guards']['length']>0x0){const c=a['voting_guard']['guards']['map'](e=>e['guard']),d=c['filter']((e,f)=>c['indexOf'](e)!==f);d['length']>0x0&&b['push']({'constraint_id':'F-AB-06','severity':'medium','message':'Duplicate\x20voting_guard\x20addresses:\x20'+d['join'](',\x20'),'current_value':d['join'](',')});}a['current_arb_status']&&a['expected_arb_status']&&(a['current_arb_status']!==a['expected_arb_status']&&!isValidArbStatusTransition(a['current_arb_status'],a['expected_arb_status'])&&b['push']({'constraint_id':'F-AB-08','severity':'critical','message':'Invalid\x20Arb\x20status\x20transition:\x20'+a['current_arb_status']+'\x20→\x20'+a['expected_arb_status'],'current_value':a['current_arb_status']+'\x20→\x20'+a['expected_arb_status']}));a['intent']?.['action']==='file_dispute'&&a['arbitration_config']?.['fee']&&(a['arbitration_config']['fee']==='0'&&b['push']({'constraint_id':'F-AB-11','severity':'high','message':'Dispute\x20fee\x20is\x200\x20—\x20likely\x20below\x20arbitration.fee\x20threshold','current_value':'0'}));a['voting_guard']&&a['usage_guard']&&(getDualGuardMatrixEntry(a['voting_guard']['guards']['length']===0x0,a['usage_guard']['guard']===null),a['intent']?.['action']==='file_dispute'&&(a['usage_guard']['guard']!==null&&!a['usage_guard']['passport_required']&&b['push']({'constraint_id':'F-AB-12','severity':'high','message':'usage_guard\x20is\x20Some\x20but\x20passport_required=false\x20—\x20dispute\x20will\x20fail\x20with\x20E_NEED_PASSPORT'})),a['intent']?.['action']==='vote'&&(a['voting_guard']['guards']['length']>0x0&&!a['intent']['target_arb']&&b['push']({'constraint_id':'F-AB-12','severity':'high','message':'voting_guard\x20is\x20non-empty\x20but\x20vote\x20target_arb\x20missing\x20—\x20must\x20use\x20the\x20Passport-verified\x20voting\x20path'})));if(a['intent']?.['action']==='file_dispute'){}return b;}export function generateConfirmationText(a){const b=[];b['push']('═══\x20Arbitration\x20Confirmation\x20═══'),b['push']('');if(a['intent']){b['push']('Action:\x20'+a['intent']['action']);if(a['intent']['target_arb'])b['push']('Target\x20Arb:\x20'+a['intent']['target_arb']);if(a['intent']['target_order'])b['push']('Target\x20Order:\x20'+a['intent']['target_order']);b['push']('Rule:\x20'+a['intent']['rule_sentence']);if(a['intent']['failure_conditions']['length']>0x0){b['push']('Failure\x20conditions:');for(const e of a['intent']['failure_conditions'])b['push']('\x20\x20-\x20'+e);}b['push']('');}if(a['arbitration_config']){b['push']('─\x20Arbitration\x20Config\x20──────────────');const f=a['arbitration_config'];if(f['description'])b['push']('Description:\x20'+f['description']);if(f['location'])b['push']('Location:\x20'+f['location']);if(f['fee']!==undefined)b['push']('Fee:\x20'+f['fee']);if(f['bPaused']!==undefined)b['push']('bPaused:\x20'+f['bPaused']+'\x20(default\x20true\x20on\x20creation)');if(f['coin_type'])b['push']('Coin\x20type\x20(T):\x20'+f['coin_type']);if(f['permission_address'])b['push']('Permission:\x20'+f['permission_address']);if(f['um']!==undefined)b['push']('UM:\x20'+(f['um']??'(none)'));b['push']('');}if(a['voting_guard']&&a['voting_guard']['guards']['length']>0x0){b['push']('─\x20voting_guard\x20Config\x20──────────────'),b['push']('Count:\x20'+a['voting_guard']['guards']['length']+'\x20/\x20'+MAX_VOTING_GUARD_COUNT),b['push']('Weight\x20mode:\x20'+a['voting_guard']['weight_mode']);for(const h of a['voting_guard']['guards']){const i='GuardIdentifier'in h['vote_weight']?'GuardIdentifier('+h['vote_weight']['GuardIdentifier']+')':'FixedValue('+h['vote_weight']['FixedValue']+')';b['push']('\x20\x20'+h['guard']+':\x20'+i);}a['voting_guard']['cooperation_matrix']&&b['push']('Cooperation:\x20'+a['voting_guard']['cooperation_matrix']['scenario']),b['push']('');}if(a['usage_guard']&&a['usage_guard']['guard']!==null){b['push']('─\x20usage_guard\x20Config\x20──────────────'),b['push']('Guard:\x20'+a['usage_guard']['guard']),b['push']('Passport\x20required:\x20'+a['usage_guard']['passport_required']);if(a['usage_guard']['filter_rules']['length']>0x0){b['push']('Filter\x20rules:');for(const j of a['usage_guard']['filter_rules'])b['push']('\x20\x20-\x20'+j);}b['push']('');}if(a['arbiter_config']&&a['arbiter_config']['arbitrators']['length']>0x0){b['push']('─\x20Arbiter\x20Config\x20──────────────'),b['push']('Arbitrators\x20('+a['arbiter_config']['arbitrators']['length']+'):\x20'+a['arbiter_config']['arbitrators']['join'](',\x20')),b['push']('Vote\x20distribution:\x20'+a['arbiter_config']['vote_distribution']),b['push']('Ruling\x20authority:\x20'+a['arbiter_config']['ruling_authority']);if(a['arbiter_config']['fees_split']){b['push']('Fees\x20split:');const k=a['arbiter_config']['fees_split'];if(k['allocation'])b['push']('\x20\x20→\x20Allocation:\x20'+k['allocation']);if(k['treasury'])b['push']('\x20\x20→\x20Treasury:\x20'+k['treasury']);if(k['remark'])b['push']('\x20\x20Remark:\x20'+k['remark']);if(k['payment_index']!==undefined)b['push']('\x20\x20Payment\x20index:\x20'+k['payment_index']);}b['push']('');}if(a['current_arb_status']||a['expected_arb_status']){b['push']('─\x207-State\x20Flow\x20──────────────');if(a['current_arb_status'])b['push']('Current:\x20'+a['current_arb_status']);if(a['expected_arb_status'])b['push']('Expected\x20after:\x20'+a['expected_arb_status']);b['push']('');}const d=validateConstraints(a);if(d['length']>0x0){b['push']('─\x20Constraint\x20Violations\x20──────────────');for(const l of d){b['push']('\x20\x20['+l['severity']+']\x20'+l['constraint_id']+':\x20'+l['message']);}b['push']('');}return b['join']('\x0a');}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const ARBITRATION_ACTIVATION_NOTES=['ACTIVATION:\x20a\x20newly\x20created\x20Arbitration\x20is\x20born\x20PAUSED\x20(bPaused=true).\x20This\x20template\x20passes\x20pause:false\x20in\x20the\x20create\x20payload\x20to\x20unpause\x20in\x20the\x20SAME\x20transaction\x20(the\x20creator\x20is\x20an\x20admin\x20of\x20the\x20new\x20Permission,\x20so\x20the\x20356\x20check\x20passes).\x20If\x20the\x20unpause\x20is\x20skipped,\x20no\x20dispute\x20can\x20be\x20filed\x20(E_PAUSED)\x20until\x20a\x20separate\x20{operation_type:\x27arbitration\x27,\x20data:{object:\x27<arb>\x27,\x20pause:false}}\x20is\x20issued.','PERMISSIONS:\x20a\x20freshly\x20created\x20Arbitration\x27s\x20Permission\x20table\x20starts\x20EMPTY\x20—\x20its\x20CREATOR\x20is\x20seeded\x20as\x20the\x20sole\x20admin\x20and\x20always\x20passes\x20every\x20assert,\x20so\x20only\x20NON-admin\x20callers\x20abort\x20with\x20\x27Missing\x20permission\x27\x20(code\x205)\x20until\x20grants\x20are\x20issued\x20via\x20its\x20Permission\x20object:\x20356\x20(pause/unpause),\x20358\x20(vote),\x20359\x20(issue\x20ruling),\x20361\x20(arbitrator\x20material\x20confirm),\x20plus\x20357/362/363/364-368\x20(fee\x20/\x20deadline\x20/\x20reset\x20/\x20withdraw\x20/\x20receive).','OPEN\x20VOTE\x20IS\x20NOT\x20PERMISSIONLESS:\x20an\x20empty\x20voting_guard\x20means\x20EQUAL\x20WEIGHT\x20(1\x20person\x201\x20vote),\x20but\x20vote()\x20still\x20asserts\x20ARBITRATION_VOTE=358\x20—\x20\x27anyone\x20can\x20vote\x27\x20requires\x20granting\x20358\x20to\x20the\x20intended\x20voters\x20first.'];export const ARBITRATION_TEMPLATES=[{'id':'T-AB-01','name':'Single-arbiter\x20quick\x20ruling','description':'Simplest\x20Arbitration:\x20one\x20arbiter\x20makes\x20all\x20rulings.\x20voting_guard\x20empty\x20(open\x20vote,\x20but\x20only\x20arbiter\x20has\x20358\x20perm).\x20Suitable\x20for\x20small-scale\x20/\x20fast\x20dispute\x20resolution.','applicable_scenes':['arbitration_create','arbitration_ruling','arbitration_confirm'],'industry_tags':['retail','freelance','small_business'],'params':[{'name':'owner_address','type':'address','description':'Arbitration\x20owner\x20(also\x20admin)','required':!![]},{'name':'arbiter_address','type':'address','description':'Single\x20arbiter\x20address\x20(gets\x20ARBITRATION_VOTE=358\x20+\x20ARBITRATION_ARBITRATION=359)','required':!![]},{'name':'coin_type','type':'string','description':'Coin\x20type\x20for\x20arbitration\x20fee\x20(e.g.\x200x2::wow::WOW)','required':!![]},{'name':'description','type':'string','description':'Arbitration\x20description','required':!![]},{'name':'fee_amount','type':'number','description':'Dispute\x20application\x20fee\x20(u64,\x20in\x20Coin\x20base\x20units)','required':![],'default':0x0},{'name':'arbitration_name','type':'string','description':'Local\x20name\x20for\x20the\x20Arbitration\x20object','required':![]}],'body':a=>({'object':{'name':a['arbitration_name']??'single_arb_arbitration','type_parameter':a['coin_type'],'permission':{'name':(a['arbitration_name']??'single_arb')+'_permission'}},'description':a['description'],'fee':String(a['fee_amount']??0x0),'pause':![]}),'notes':['voting_guard\x20remains\x20empty\x20→\x20plain\x20votes\x20hard-require\x20the\x20vote\x20permission\x20(358):\x20by\x20default\x20ONLY\x20the\x20creator-admin\x20can\x20vote\x20(here\x20the\x20arbiter).\x20This\x20is\x20NOT\x20open\x20voting\x20—\x20a\x20dispute\x20dead-locks\x20when\x20that\x20admin\x20is\x20unresponsive\x20(crs9-F-36;\x20R-ARB-VOTE-LOCK\x20blocks\x20the\x20service\x20publish).\x20Weight\x20semantics\x20stay\x20one-voter-one-vote;\x20for\x20real\x20open\x20voting\x20bind\x20the\x20always-true\x20guard\x20(T-AB-03\x20/\x20tpl_voting_guard_open_vote)','Only\x20arbiter_address\x20should\x20be\x20granted\x20ARBITRATION_VOTE\x20(358)\x20+\x20ARBITRATION_ARBITRATION\x20(359)','Fast\x20ruling:\x20arbiter\x20confirms\x20materials\x20→\x20votes\x20→\x20makes\x20ruling\x20in\x20one\x20session','Not\x20suitable\x20for\x20high-value\x20disputes\x20(no\x20consensus\x20check)',...ARBITRATION_ACTIVATION_NOTES]},{'id':'T-AB-02','name':'Multi-arbiter\x20voting\x20(weighted)','description':'Multiple\x20arbiters\x20vote\x20with\x20weighted\x20voting_guard.\x20Each\x20arbiter\x27s\x20Guard\x20has\x20FixedValue\x20weight.\x20Ruling\x20requires\x20majority\x20weight.','applicable_scenes':['arbitration_create','arbitration_vote','arbitration_voting_guard_config'],'industry_tags':['governance','dao','committee'],'params':[{'name':'owner_address','type':'address','description':'Arbitration\x20owner','required':!![]},{'name':'arbiter_guards','type':'string[]','description':'Guard\x20addresses\x20for\x20each\x20arbiter\x20(will\x20be\x20added\x20to\x20voting_guard)','required':!![]},{'name':'vote_weights','type':'string[]','description':'FixedValue\x20weights\x20for\x20each\x20arbiter\x20(parallel\x20to\x20arbiter_guards)','required':!![]},{'name':'coin_type','type':'string','description':'Coin\x20type','required':!![]},{'name':'description','type':'string','description':'Arbitration\x20description','required':!![]},{'name':'fee_amount','type':'number','description':'Dispute\x20fee','required':![],'default':0x0}],'body':a=>{const b=a['arbiter_guards']['map']((c,d)=>({'guard':c,'vote_weight':{'FixedValue':Number(a['vote_weights'][d]??0x1)}}));return{'object':{'name':'weighted_arbitration','type_parameter':a['coin_type'],'permission':{'name':'weighted_arb_permission'}},'description':a['description'],'fee':String(a['fee_amount']??0x0),'pause':![],'voting_guard':{'op':'set','guards':b}};},'notes':['voting_guard\x20non-empty\x20→\x20votes\x20MUST\x20be\x20submitted\x20via\x20the\x20Passport-verified\x20voting\x20path','Each\x20arbiter\x27s\x20Guard\x20must\x20be\x20a\x20valid\x20Guard\x20object\x20they\x20can\x20submit\x20Passport\x20for','Consider:\x20max(arbiter_weights)\x20/\x20total_weights\x20<\x200.5\x20to\x20avoid\x20collusion\x20(see\x20R-AB-3-01)','Max\x2050\x20voting_guards\x20(MAX_VOTING_GUARD_COUNT)',...ARBITRATION_ACTIVATION_NOTES]},{'id':'T-AB-03','name':'Public\x20voting\x20arbitration','description':'voting_guard\x20allows\x20public\x20to\x20vote\x20(anyone\x20with\x20a\x20Guard\x20can\x20vote).\x20Suitable\x20for\x20community-driven\x20dispute\x20resolution.','applicable_scenes':['arbitration_create','arbitration_vote','arbitration_voting_guard_config'],'industry_tags':['community','public_goods','social'],'params':[{'name':'owner_address','type':'address','description':'Arbitration\x20owner','required':!![]},{'name':'public_guard','type':'address','description':'Guard\x20address\x20anyone\x20can\x20submit\x20Passport\x20for\x20(e.g.\x20based\x20on\x20account\x20existence)','required':!![]},{'name':'vote_weight','type':'number','description':'FixedValue\x20weight\x20per\x20public\x20voter\x20(e.g.\x201)','required':![],'default':0x1},{'name':'coin_type','type':'string','description':'Coin\x20type','required':!![]},{'name':'description','type':'string','description':'Arbitration\x20description','required':!![]}],'body':a=>({'object':{'name':'public_arbitration','type_parameter':a['coin_type'],'permission':{'name':'public_arb_permission'}},'description':a['description'],'fee':'0','pause':![],'voting_guard':{'op':'set','guards':[{'guard':a['public_guard'],'vote_weight':{'FixedValue':Number(a['vote_weight']??0x1)}}]}}),'notes':['Public\x20voting:\x20anyone\x20holding\x20the\x20public_guard\x20can\x20vote','This\x20shape\x20also\x20clears\x20R-ARB-VOTE-LOCK:\x20an\x20EMPTY\x20voting_guard\x20is\x20NOT\x20open\x20voting\x20(plain\x20votes\x20would\x20hard-require\x20the\x20vote\x20permission\x20358,\x20admin-only\x20by\x20default,\x20crs9-F-36)\x20—\x20the\x20always-true\x20guard\x20is\x20the\x20declared\x20voter\x20universe\x20(tpl_voting_guard_open_vote\x20is\x20the\x20guard-side\x20template)','Once\x20voting_guard\x20is\x20set,\x20every\x20vote\x20call\x20MUST\x20carry\x20voting_guard\x20in\x20the\x20payload\x20(a\x20plain\x20vote\x20aborts\x20on-chain\x20with\x20E_VOTING_GUARD_USED,\x20abort\x202)','Consider\x20using\x20GuardIdentifier\x20(dynamic\x20weight)\x20for\x20token-weighted\x20voting','Low/zero\x20fee\x20to\x20encourage\x20participation\x20—\x20but\x20watch\x20for\x20spam\x20disputes','Suitable\x20for\x20community\x20moderation,\x20content\x20disputes,\x20public\x20goods\x20arbitration',...ARBITRATION_ACTIVATION_NOTES]},{'id':'T-AB-04','name':'Scope-restricted\x20arbitration','description':'usage_guard\x20filters\x20which\x20disputes\x20can\x20be\x20filed.\x20Only\x20users\x20passing\x20the\x20Guard\x20can\x20file\x20disputes.\x20Suitable\x20for\x20verified-merchant\x20/\x20KYC\x20arbitration.','applicable_scenes':['arbitration_create','arbitration_usage_guard_config','arbitration_dispute'],'industry_tags':['kyc','verified_merchant','enterprise'],'params':[{'name':'owner_address','type':'address','description':'Arbitration\x20owner','required':!![]},{'name':'usage_guard_address','type':'address','description':'Guard\x20address\x20that\x20filters\x20who\x20can\x20file\x20disputes\x20(KYC/verification)','required':!![]},{'name':'coin_type','type':'string','description':'Coin\x20type','required':!![]},{'name':'description','type':'string','description':'Arbitration\x20description','required':!![]},{'name':'arbiter_address','type':'address','description':'Arbiter\x20address\x20(single\x20arbiter\x20for\x20simplicity)','required':!![]},{'name':'fee_amount','type':'number','description':'Dispute\x20fee\x20(higher\x20to\x20deter\x20spam)','required':![],'default':0x3b9aca00}],'body':a=>({'object':{'name':'restricted_arbitration','type_parameter':a['coin_type'],'permission':{'name':'restricted_arb_permission'}},'description':a['description'],'fee':String(a['fee_amount']??0x3b9aca00),'pause':![],'usage_guard':a['usage_guard_address']}),'notes':['usage_guard\x20set\x20→\x20disputes\x20MUST\x20be\x20filed\x20via\x20the\x20Passport-verified\x20dispute\x20variant','Guard\x20verifies:\x20KYC\x20/\x20membership\x20/\x20token-balance\x20/\x20etc.','Higher\x20fee\x20(default\x201\x20WOW)\x20to\x20deter\x20spam\x20from\x20verified\x20users','Arbiter\x20should\x20also\x20be\x20Guard-verified\x20for\x20consistency',...ARBITRATION_ACTIVATION_NOTES]},{'id':'T-AB-05','name':'Arbitration\x20committee','description':'Multi-arbiter\x20committee\x20with\x20weighted\x20voting\x20+\x20usage_guard.\x20Most\x20controlled\x20configuration\x20—\x20restricted\x20dispute\x20filing\x20+\x20weighted\x20voting\x20+\x20multi-arbiter\x20ruling.','applicable_scenes':['arbitration_create','arbitration_voting_guard_config','arbitration_usage_guard_config','arbitration_ruling'],'industry_tags':['enterprise','legal','high_value'],'params':[{'name':'owner_address','type':'address','description':'Committee\x20owner','required':!![]},{'name':'committee_guards','type':'string[]','description':'Guard\x20addresses\x20for\x20each\x20committee\x20member','required':!![]},{'name':'member_weights','type':'string[]','description':'Vote\x20weights\x20for\x20each\x20member\x20(parallel\x20to\x20committee_guards)','required':!![]},{'name':'membership_guard','type':'address','description':'usage_guard\x20for\x20dispute\x20filing\x20(membership\x20verification)','required':!![]},{'name':'coin_type','type':'string','description':'Coin\x20type','required':!![]},{'name':'description','type':'string','description':'Arbitration\x20description','required':!![]},{'name':'fee_amount','type':'number','description':'Dispute\x20fee\x20(high\x20for\x20high-value\x20disputes)','required':![],'default':0x2540be400}],'body':a=>{const b=a['committee_guards']['map']((c,d)=>({'guard':c,'vote_weight':{'FixedValue':Number(a['member_weights'][d]??0x1)}}));return{'object':{'name':'committee_arbitration','type_parameter':a['coin_type'],'permission':{'name':'committee_arb_permission'}},'description':a['description'],'fee':String(a['fee_amount']??0x2540be400),'pause':![],'voting_guard':{'op':'set','guards':b},'usage_guard':a['membership_guard']};},'notes':['Most\x20restrictive\x20config:\x20weighted\x20voting\x20+\x20restricted\x20filing','Suitable\x20for\x20high-value\x20B2B\x20disputes,\x20legal\x20arbitration,\x20enterprise\x20SLA\x20enforcement','Committee\x20members\x20should\x20have\x20clear\x20escalation\x20/\x20tiebreaker\x20rules','All\x20disputes\x20require\x20Passport\x20(both\x20filing\x20and\x20voting)',...ARBITRATION_ACTIVATION_NOTES]},{'id':'T-AB-06','name':'Fee-split\x20arbitration','description':'Pre-configured\x20fee-distribution\x20destination.\x20After\x20the\x20fee\x20withdrawal\x20(364),\x20fees\x20are\x20automatically\x20distributed\x20to\x20the\x20Allocation\x20(for\x20arbiter\x20compensation).','applicable_scenes':['arbitration_create','arbitration_arb_withdraw','arbitration_fees_alloc'],'industry_tags':['marketplace','service','platform'],'params':[{'name':'owner_address','type':'address','description':'Arbitration\x20owner','required':!![]},{'name':'allocation_address','type':'address','description':'Allocation\x20object\x20address\x20for\x20fee\x20distribution\x20to\x20arbiters','required':!![]},{'name':'coin_type','type':'string','description':'Coin\x20type','required':!![]},{'name':'description','type':'string','description':'Arbitration\x20description','required':!![]},{'name':'arbiter_address','type':'address','description':'Arbiter\x20(single\x20for\x20simplicity)','required':!![]},{'name':'fee_amount','type':'number','description':'Dispute\x20fee\x20(will\x20be\x20split\x20to\x20arbiters\x20via\x20Allocation)','required':![],'default':0x12a05f200}],'body':a=>({'object':{'name':'feesplit_arbitration','type_parameter':a['coin_type'],'permission':{'name':'feesplit_arb_permission'}},'description':a['description'],'fee':String(a['fee_amount']??0x12a05f200),'pause':![]}),'notes':['Fee-split\x20is\x20a\x202-step\x20process:\x20withdraw\x20fees\x20from\x20the\x20Arb\x20object\x20(364)\x20→\x20transfer\x20them\x20out\x20of\x20the\x20Arbitration\x20balance\x20(365/366)','Fee\x20withdrawal\x20(364)\x20moves\x20fees\x20from\x20the\x20Arb\x20object\x20into\x20the\x20Arbitration\x20balance','Fee\x20distribution\x20(365)\x20or\x20the\x20balance\x20transfer\x20(366)\x20moves\x20fees\x20to\x20the\x20Allocation/Treasury','Allocation\x20policy\x20determines\x20how\x20fees\x20are\x20split\x20among\x20arbiters','Payment\x20object\x20is\x20created\x20for\x20bookkeeping\x20(payment_remark\x20+\x20payment_index)',...ARBITRATION_ACTIVATION_NOTES]},{'id':'T-AB-07','name':'Appeal\x20arbitration\x20(reset\x20flow)','description':'Template\x20for\x20reset\x20operation\x20—\x20disputant\x20objects\x20to\x20ruling\x20and\x20resubmits\x20materials.\x20Restarts\x20Arb\x20lifecycle\x20from\x20Principal_confirming.','applicable_scenes':['arbitration_reset','arbitration_ruling'],'industry_tags':['legal','appeal','high_value'],'params':[{'name':'arbitration_object','type':'address','description':'Existing\x20Arbitration\x20object\x20address','required':!![]},{'name':'arb_address','type':'address','description':'Arb\x20object\x20address\x20to\x20reset\x20(must\x20be\x20in\x20Objectionable/Arbitrated\x20status)','required':!![]},{'name':'reset_feedback','type':'string','description':'Feedback\x20explaining\x20why\x20disputant\x20objects\x20to\x20the\x20ruling','required':!![]}],'body':a=>({'object':a['arbitration_object'],'reset':{'arb':a['arb_address'],'feedback':a['reset_feedback']}}),'notes':['Precondition:\x20Arb\x20must\x20be\x20in\x20Objectionable\x20(4)\x20or\x20Arbitrated\x20(3)\x20status','Post-condition:\x20Arb\x20status\x20→\x20Principal_confirming\x20(0),\x20lifecycle\x20restarts','Original\x20ruling\x20is\x20invalidated\x20—\x20new\x20voting\x20+\x20ruling\x20required','Consider\x20capping\x20reset\x20count\x20to\x20prevent\x20infinite\x20appeals','reset\x20feedback\x20is\x20permanent\x20—\x20recorded\x20on-chain\x20for\x20audit\x20trail']}];export const ARBITRATION_TEMPLATES_VERSION='1.0.0';export function getAllTemplates(){return[...ARBITRATION_TEMPLATES];}export function getTemplateById(a){return ARBITRATION_TEMPLATES['find'](b=>b['id']===a);}export function getTemplatesByScene(a){return ARBITRATION_TEMPLATES['filter'](b=>b['applicable_scenes']['includes'](a));}export function getTemplatesByIndustry(a){return ARBITRATION_TEMPLATES['filter'](b=>b['industry_tags']['includes'](a)||b['industry_tags']['includes']('universal'));}export function suggestTemplateForScene(a){const b=getTemplatesByScene(a);return b['length']>0x0?b[0x0]:undefined;}export function listTemplates(){return ARBITRATION_TEMPLATES['map'](a=>({'id':a['id'],'name':a['name'],'description':a['description'],'scenes':a['applicable_scenes']}));}export function fillTemplate(a,b){const c=getTemplateById(a);if(!c)return{'ok':![],'error':'Template\x20'+a+'\x20not\x20found'};for(const d of c['params']){if(d['required']&&!(d['name']in b))return{'ok':![],'error':'Missing\x20required\x20param:\x20'+d['name']};}return{'ok':!![],'body':c['body'](b)};}
|
|
1
|
+
export const ARBITRATION_ACTIVATION_NOTES=['ACTIVATION:\x20a\x20newly\x20created\x20Arbitration\x20is\x20born\x20PAUSED\x20(bPaused=true).\x20This\x20template\x20passes\x20pause:false\x20in\x20the\x20create\x20payload\x20to\x20unpause\x20in\x20the\x20SAME\x20transaction\x20(the\x20creator\x20is\x20an\x20admin\x20of\x20the\x20new\x20Permission,\x20so\x20the\x20356\x20check\x20passes).\x20If\x20the\x20unpause\x20is\x20skipped,\x20no\x20dispute\x20can\x20be\x20filed\x20(E_PAUSED)\x20until\x20a\x20separate\x20{operation_type:\x27arbitration\x27,\x20data:{object:\x27<arb>\x27,\x20pause:false}}\x20is\x20issued.','PERMISSIONS:\x20a\x20freshly\x20created\x20Arbitration\x27s\x20Permission\x20table\x20starts\x20EMPTY\x20—\x20its\x20CREATOR\x20is\x20seeded\x20as\x20the\x20sole\x20admin\x20and\x20always\x20passes\x20every\x20assert,\x20so\x20only\x20NON-admin\x20callers\x20abort\x20with\x20\x27Missing\x20permission\x27\x20(code\x205)\x20until\x20grants\x20are\x20issued\x20via\x20its\x20Permission\x20object:\x20356\x20(pause/unpause),\x20358\x20(vote),\x20359\x20(issue\x20ruling),\x20361\x20(arbitrator\x20material\x20confirm),\x20plus\x20357/362/363/364-368\x20(fee\x20/\x20deadline\x20/\x20reset\x20/\x20withdraw\x20/\x20receive).','OPEN\x20VOTE\x20IS\x20NOT\x20PERMISSIONLESS:\x20an\x20empty\x20voting_guard\x20means\x20EQUAL\x20WEIGHT\x20(1\x20person\x201\x20vote),\x20but\x20vote()\x20still\x20asserts\x20ARBITRATION_VOTE=358\x20—\x20\x27anyone\x20can\x20vote\x27\x20requires\x20granting\x20358\x20to\x20the\x20intended\x20voters\x20first.','VOTER\x20UNIVERSE\x20IS\x20DECLARED\x20BY\x20THE\x20voting_guard:\x20always-true\x20root\x20=\x20public\x20venue\x20(tpl_voting_guard_open_vote);\x20party-restricted\x20root\x20=\x20closed\x20venue\x20(tpl_voting_guard_party_only:\x20panel\x20vec_contains_address\x20∨\x20order.owner\x20with\x20the\x20arb.order==order\x20anti-spoof\x20leg).\x20Upw2-mn\x20pddk-b4:\x20a\x20closed\x20venue\x20shipping\x20a\x20constant-true\x20guard\x20let\x20an\x20outsider\x20vote\x20—\x20pick\x20the\x20twin\x20deliberately.'];export const ARBITRATION_TEMPLATES=[{'id':'T-AB-01','name':'Single-arbiter\x20quick\x20ruling','description':'Simplest\x20Arbitration:\x20one\x20arbiter\x20makes\x20all\x20rulings.\x20voting_guard\x20empty\x20(open\x20vote,\x20but\x20only\x20arbiter\x20has\x20358\x20perm).\x20Suitable\x20for\x20small-scale\x20/\x20fast\x20dispute\x20resolution.','applicable_scenes':['arbitration_create','arbitration_ruling','arbitration_confirm'],'industry_tags':['retail','freelance','small_business'],'params':[{'name':'owner_address','type':'address','description':'Arbitration\x20owner\x20(also\x20admin)','required':!![]},{'name':'arbiter_address','type':'address','description':'Single\x20arbiter\x20address\x20(gets\x20ARBITRATION_VOTE=358\x20+\x20ARBITRATION_ARBITRATION=359)','required':!![]},{'name':'coin_type','type':'string','description':'Coin\x20type\x20for\x20arbitration\x20fee\x20(e.g.\x200x2::wow::WOW)','required':!![]},{'name':'description','type':'string','description':'Arbitration\x20description','required':!![]},{'name':'fee_amount','type':'number','description':'Dispute\x20application\x20fee\x20(u64,\x20in\x20Coin\x20base\x20units)','required':![],'default':0x0},{'name':'arbitration_name','type':'string','description':'Local\x20name\x20for\x20the\x20Arbitration\x20object','required':![]}],'body':a=>({'object':{'name':a['arbitration_name']??'single_arb_arbitration','type_parameter':a['coin_type'],'permission':{'name':(a['arbitration_name']??'single_arb')+'_permission'}},'description':a['description'],'fee':String(a['fee_amount']??0x0),'pause':![]}),'notes':['voting_guard\x20remains\x20empty\x20→\x20plain\x20votes\x20hard-require\x20the\x20vote\x20permission\x20(358):\x20by\x20default\x20ONLY\x20the\x20creator-admin\x20can\x20vote\x20(here\x20the\x20arbiter).\x20This\x20is\x20NOT\x20open\x20voting\x20—\x20a\x20dispute\x20dead-locks\x20when\x20that\x20admin\x20is\x20unresponsive\x20(crs9-F-36;\x20R-ARB-VOTE-LOCK\x20blocks\x20the\x20service\x20publish).\x20Weight\x20semantics\x20stay\x20one-voter-one-vote;\x20for\x20real\x20open\x20voting\x20bind\x20the\x20always-true\x20guard\x20(T-AB-03\x20/\x20tpl_voting_guard_open_vote);\x20for\x20a\x20closed\x20venue\x20where\x20only\x20the\x20dispute\x20parties\x20+\x20venue\x20staff\x20may\x20vote,\x20bind\x20tpl_voting_guard_party_only\x20instead','Only\x20arbiter_address\x20should\x20be\x20granted\x20ARBITRATION_VOTE\x20(358)\x20+\x20ARBITRATION_ARBITRATION\x20(359)','Fast\x20ruling:\x20arbiter\x20confirms\x20materials\x20→\x20votes\x20→\x20makes\x20ruling\x20in\x20one\x20session','Not\x20suitable\x20for\x20high-value\x20disputes\x20(no\x20consensus\x20check)',...ARBITRATION_ACTIVATION_NOTES]},{'id':'T-AB-02','name':'Multi-arbiter\x20voting\x20(weighted)','description':'Multiple\x20arbiters\x20vote\x20with\x20weighted\x20voting_guard.\x20Each\x20arbiter\x27s\x20Guard\x20has\x20FixedValue\x20weight.\x20Ruling\x20requires\x20majority\x20weight.','applicable_scenes':['arbitration_create','arbitration_vote','arbitration_voting_guard_config'],'industry_tags':['governance','dao','committee'],'params':[{'name':'owner_address','type':'address','description':'Arbitration\x20owner','required':!![]},{'name':'arbiter_guards','type':'string[]','description':'Guard\x20addresses\x20for\x20each\x20arbiter\x20(will\x20be\x20added\x20to\x20voting_guard)','required':!![]},{'name':'vote_weights','type':'string[]','description':'FixedValue\x20weights\x20for\x20each\x20arbiter\x20(parallel\x20to\x20arbiter_guards)','required':!![]},{'name':'coin_type','type':'string','description':'Coin\x20type','required':!![]},{'name':'description','type':'string','description':'Arbitration\x20description','required':!![]},{'name':'fee_amount','type':'number','description':'Dispute\x20fee','required':![],'default':0x0}],'body':a=>{const b=a['arbiter_guards']['map']((c,d)=>({'guard':c,'vote_weight':{'FixedValue':Number(a['vote_weights'][d]??0x1)}}));return{'object':{'name':'weighted_arbitration','type_parameter':a['coin_type'],'permission':{'name':'weighted_arb_permission'}},'description':a['description'],'fee':String(a['fee_amount']??0x0),'pause':![],'voting_guard':{'op':'set','guards':b}};},'notes':['voting_guard\x20non-empty\x20→\x20votes\x20MUST\x20be\x20submitted\x20via\x20the\x20Passport-verified\x20voting\x20path','Each\x20arbiter\x27s\x20Guard\x20must\x20be\x20a\x20valid\x20Guard\x20object\x20they\x20can\x20submit\x20Passport\x20for','Consider:\x20max(arbiter_weights)\x20/\x20total_weights\x20<\x200.5\x20to\x20avoid\x20collusion\x20(see\x20R-AB-3-01)','Max\x2050\x20voting_guards\x20(MAX_VOTING_GUARD_COUNT)',...ARBITRATION_ACTIVATION_NOTES]},{'id':'T-AB-03','name':'Public\x20voting\x20arbitration','description':'voting_guard\x20allows\x20public\x20to\x20vote\x20(anyone\x20with\x20a\x20Guard\x20can\x20vote).\x20Suitable\x20for\x20community-driven\x20dispute\x20resolution.','applicable_scenes':['arbitration_create','arbitration_vote','arbitration_voting_guard_config'],'industry_tags':['community','public_goods','social'],'params':[{'name':'owner_address','type':'address','description':'Arbitration\x20owner','required':!![]},{'name':'public_guard','type':'address','description':'Guard\x20address\x20anyone\x20can\x20submit\x20Passport\x20for\x20(e.g.\x20based\x20on\x20account\x20existence)','required':!![]},{'name':'vote_weight','type':'number','description':'FixedValue\x20weight\x20per\x20public\x20voter\x20(e.g.\x201)','required':![],'default':0x1},{'name':'coin_type','type':'string','description':'Coin\x20type','required':!![]},{'name':'description','type':'string','description':'Arbitration\x20description','required':!![]}],'body':a=>({'object':{'name':'public_arbitration','type_parameter':a['coin_type'],'permission':{'name':'public_arb_permission'}},'description':a['description'],'fee':'0','pause':![],'voting_guard':{'op':'set','guards':[{'guard':a['public_guard'],'vote_weight':{'FixedValue':Number(a['vote_weight']??0x1)}}]}}),'notes':['Public\x20voting:\x20anyone\x20holding\x20the\x20public_guard\x20can\x20vote','This\x20shape\x20also\x20clears\x20R-ARB-VOTE-LOCK:\x20an\x20EMPTY\x20voting_guard\x20is\x20NOT\x20open\x20voting\x20(plain\x20votes\x20would\x20hard-require\x20the\x20vote\x20permission\x20358,\x20admin-only\x20by\x20default,\x20crs9-F-36)\x20—\x20the\x20always-true\x20guard\x20is\x20the\x20declared\x20voter\x20universe\x20(tpl_voting_guard_open_vote\x20is\x20the\x20guard-side\x20template).\x20Use\x20this\x20shape\x20ONLY\x20for\x20deliberately\x20public\x20venues:\x20a\x20closed\x20commercial\x20venue\x20must\x20restrict\x20its\x20voter\x20universe\x20(tpl_voting_guard_party_only\x20—\x20the\x20parties\x20+\x20venue\x20panel),\x20or\x20every\x20Passport\x20holder\x20can\x20vote\x20(upw2-mn\x20pddk-b4)','Once\x20voting_guard\x20is\x20set,\x20every\x20vote\x20call\x20MUST\x20carry\x20voting_guard\x20in\x20the\x20payload\x20(a\x20plain\x20vote\x20aborts\x20on-chain\x20with\x20E_VOTING_GUARD_USED,\x20abort\x202)','Consider\x20using\x20GuardIdentifier\x20(dynamic\x20weight)\x20for\x20token-weighted\x20voting','Low/zero\x20fee\x20to\x20encourage\x20participation\x20—\x20but\x20watch\x20for\x20spam\x20disputes','Suitable\x20for\x20community\x20moderation,\x20content\x20disputes,\x20public\x20goods\x20arbitration',...ARBITRATION_ACTIVATION_NOTES]},{'id':'T-AB-04','name':'Scope-restricted\x20arbitration','description':'usage_guard\x20filters\x20which\x20disputes\x20can\x20be\x20filed.\x20Only\x20users\x20passing\x20the\x20Guard\x20can\x20file\x20disputes.\x20Suitable\x20for\x20verified-merchant\x20/\x20KYC\x20arbitration.','applicable_scenes':['arbitration_create','arbitration_usage_guard_config','arbitration_dispute'],'industry_tags':['kyc','verified_merchant','enterprise'],'params':[{'name':'owner_address','type':'address','description':'Arbitration\x20owner','required':!![]},{'name':'usage_guard_address','type':'address','description':'Guard\x20address\x20that\x20filters\x20who\x20can\x20file\x20disputes\x20(KYC/verification)','required':!![]},{'name':'coin_type','type':'string','description':'Coin\x20type','required':!![]},{'name':'description','type':'string','description':'Arbitration\x20description','required':!![]},{'name':'arbiter_address','type':'address','description':'Arbiter\x20address\x20(single\x20arbiter\x20for\x20simplicity)','required':!![]},{'name':'fee_amount','type':'number','description':'Dispute\x20fee\x20(higher\x20to\x20deter\x20spam)','required':![],'default':0x3b9aca00}],'body':a=>({'object':{'name':'restricted_arbitration','type_parameter':a['coin_type'],'permission':{'name':'restricted_arb_permission'}},'description':a['description'],'fee':String(a['fee_amount']??0x3b9aca00),'pause':![],'usage_guard':a['usage_guard_address']}),'notes':['usage_guard\x20set\x20→\x20disputes\x20MUST\x20be\x20filed\x20via\x20the\x20Passport-verified\x20dispute\x20variant','Guard\x20verifies:\x20KYC\x20/\x20membership\x20/\x20token-balance\x20/\x20etc.','Higher\x20fee\x20(default\x201\x20WOW)\x20to\x20deter\x20spam\x20from\x20verified\x20users','Arbiter\x20should\x20also\x20be\x20Guard-verified\x20for\x20consistency',...ARBITRATION_ACTIVATION_NOTES]},{'id':'T-AB-05','name':'Arbitration\x20committee','description':'Multi-arbiter\x20committee\x20with\x20weighted\x20voting\x20+\x20usage_guard.\x20Most\x20controlled\x20configuration\x20—\x20restricted\x20dispute\x20filing\x20+\x20weighted\x20voting\x20+\x20multi-arbiter\x20ruling.','applicable_scenes':['arbitration_create','arbitration_voting_guard_config','arbitration_usage_guard_config','arbitration_ruling'],'industry_tags':['enterprise','legal','high_value'],'params':[{'name':'owner_address','type':'address','description':'Committee\x20owner','required':!![]},{'name':'committee_guards','type':'string[]','description':'Guard\x20addresses\x20for\x20each\x20committee\x20member','required':!![]},{'name':'member_weights','type':'string[]','description':'Vote\x20weights\x20for\x20each\x20member\x20(parallel\x20to\x20committee_guards)','required':!![]},{'name':'membership_guard','type':'address','description':'usage_guard\x20for\x20dispute\x20filing\x20(membership\x20verification)','required':!![]},{'name':'coin_type','type':'string','description':'Coin\x20type','required':!![]},{'name':'description','type':'string','description':'Arbitration\x20description','required':!![]},{'name':'fee_amount','type':'number','description':'Dispute\x20fee\x20(high\x20for\x20high-value\x20disputes)','required':![],'default':0x2540be400}],'body':a=>{const b=a['committee_guards']['map']((c,d)=>({'guard':c,'vote_weight':{'FixedValue':Number(a['member_weights'][d]??0x1)}}));return{'object':{'name':'committee_arbitration','type_parameter':a['coin_type'],'permission':{'name':'committee_arb_permission'}},'description':a['description'],'fee':String(a['fee_amount']??0x2540be400),'pause':![],'voting_guard':{'op':'set','guards':b},'usage_guard':a['membership_guard']};},'notes':['Most\x20restrictive\x20config:\x20weighted\x20voting\x20+\x20restricted\x20filing','Suitable\x20for\x20high-value\x20B2B\x20disputes,\x20legal\x20arbitration,\x20enterprise\x20SLA\x20enforcement','Committee\x20members\x20should\x20have\x20clear\x20escalation\x20/\x20tiebreaker\x20rules','All\x20disputes\x20require\x20Passport\x20(both\x20filing\x20and\x20voting)',...ARBITRATION_ACTIVATION_NOTES]},{'id':'T-AB-06','name':'Fee-split\x20arbitration','description':'Pre-configured\x20fee-distribution\x20destination.\x20After\x20the\x20fee\x20withdrawal\x20(364),\x20fees\x20are\x20automatically\x20distributed\x20to\x20the\x20Allocation\x20(for\x20arbiter\x20compensation).','applicable_scenes':['arbitration_create','arbitration_arb_withdraw','arbitration_fees_alloc'],'industry_tags':['marketplace','service','platform'],'params':[{'name':'owner_address','type':'address','description':'Arbitration\x20owner','required':!![]},{'name':'allocation_address','type':'address','description':'Allocation\x20object\x20address\x20for\x20fee\x20distribution\x20to\x20arbiters','required':!![]},{'name':'coin_type','type':'string','description':'Coin\x20type','required':!![]},{'name':'description','type':'string','description':'Arbitration\x20description','required':!![]},{'name':'arbiter_address','type':'address','description':'Arbiter\x20(single\x20for\x20simplicity)','required':!![]},{'name':'fee_amount','type':'number','description':'Dispute\x20fee\x20(will\x20be\x20split\x20to\x20arbiters\x20via\x20Allocation)','required':![],'default':0x12a05f200}],'body':a=>({'object':{'name':'feesplit_arbitration','type_parameter':a['coin_type'],'permission':{'name':'feesplit_arb_permission'}},'description':a['description'],'fee':String(a['fee_amount']??0x12a05f200),'pause':![]}),'notes':['Fee-split\x20is\x20a\x202-step\x20process:\x20withdraw\x20fees\x20from\x20the\x20Arb\x20object\x20(364)\x20→\x20transfer\x20them\x20out\x20of\x20the\x20Arbitration\x20balance\x20(365/366)','Fee\x20withdrawal\x20(364)\x20moves\x20fees\x20from\x20the\x20Arb\x20object\x20into\x20the\x20Arbitration\x20balance','Fee\x20distribution\x20(365)\x20or\x20the\x20balance\x20transfer\x20(366)\x20moves\x20fees\x20to\x20the\x20Allocation/Treasury','Allocation\x20policy\x20determines\x20how\x20fees\x20are\x20split\x20among\x20arbiters','Payment\x20object\x20is\x20created\x20for\x20bookkeeping\x20(payment_remark\x20+\x20payment_index)',...ARBITRATION_ACTIVATION_NOTES]},{'id':'T-AB-07','name':'Appeal\x20arbitration\x20(reset\x20flow)','description':'Template\x20for\x20reset\x20operation\x20—\x20disputant\x20objects\x20to\x20ruling\x20and\x20resubmits\x20materials.\x20Restarts\x20Arb\x20lifecycle\x20from\x20Principal_confirming.','applicable_scenes':['arbitration_reset','arbitration_ruling'],'industry_tags':['legal','appeal','high_value'],'params':[{'name':'arbitration_object','type':'address','description':'Existing\x20Arbitration\x20object\x20address','required':!![]},{'name':'arb_address','type':'address','description':'Arb\x20object\x20address\x20to\x20reset\x20(must\x20be\x20in\x20Objectionable/Arbitrated\x20status)','required':!![]},{'name':'reset_feedback','type':'string','description':'Feedback\x20explaining\x20why\x20disputant\x20objects\x20to\x20the\x20ruling','required':!![]}],'body':a=>({'object':a['arbitration_object'],'reset':{'arb':a['arb_address'],'feedback':a['reset_feedback']}}),'notes':['Precondition:\x20Arb\x20must\x20be\x20in\x20Objectionable\x20(4)\x20or\x20Arbitrated\x20(3)\x20status','Post-condition:\x20Arb\x20status\x20→\x20Principal_confirming\x20(0),\x20lifecycle\x20restarts','Original\x20ruling\x20is\x20invalidated\x20—\x20new\x20voting\x20+\x20ruling\x20required','Consider\x20capping\x20reset\x20count\x20to\x20prevent\x20infinite\x20appeals','reset\x20feedback\x20is\x20permanent\x20—\x20recorded\x20on-chain\x20for\x20audit\x20trail']}];export const ARBITRATION_TEMPLATES_VERSION='1.0.0';export function getAllTemplates(){return[...ARBITRATION_TEMPLATES];}export function getTemplateById(a){return ARBITRATION_TEMPLATES['find'](b=>b['id']===a);}export function getTemplatesByScene(a){return ARBITRATION_TEMPLATES['filter'](b=>b['applicable_scenes']['includes'](a));}export function getTemplatesByIndustry(a){return ARBITRATION_TEMPLATES['filter'](b=>b['industry_tags']['includes'](a)||b['industry_tags']['includes']('universal'));}export function suggestTemplateForScene(a){const b=getTemplatesByScene(a);return b['length']>0x0?b[0x0]:undefined;}export function listTemplates(){return ARBITRATION_TEMPLATES['map'](a=>({'id':a['id'],'name':a['name'],'description':a['description'],'scenes':a['applicable_scenes']}));}export function fillTemplate(a,b){const c=getTemplateById(a);if(!c)return{'ok':![],'error':'Template\x20'+a+'\x20not\x20found'};for(const d of c['params']){if(d['required']&&!(d['name']in b))return{'ok':![],'error':'Missing\x20required\x20param:\x20'+d['name']};}return{'ok':!![],'body':c['body'](b)};}
|