@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{fillGuardTemplate}from'../knowledge/guard-templates.js';import{ONCE_SLOT_BYTES}from'../knowledge/onchain-constants.js';import{P,ref}from'./plan.js';const MS_PER_DAY=0x5265c00,DEFAULT_ACK_WINDOW_DAYS=0x3,query=(a,b,c,d=[])=>({'type':'query','query':a,'object':c===undefined?{'identifier':b}:{'identifier':b,'convert_witness':c},'parameters':d}),idn=a=>({'type':'identifier','identifier':a}),ctx=a=>({'type':'context','context':a}),eq=(c,d)=>({'type':'logic_equal','nodes':[c,d]}),anyOf=a=>({'type':'logic_or','nodes':a}),allOf=a=>({'type':'logic_and','nodes':a}),u256Gte=(c,d)=>({'type':'logic_as_u256_greater_or_equal','nodes':[c,d]}),u256Gt=(c,d)=>({'type':'logic_as_u256_greater','nodes':[c,d]}),numAdd=(c,d)=>({'type':'calc_number_add','nodes':[c,d]}),keysWhereAddressEq=(a,b,c)=>({'type':'query_repository_data_keys_where','object':{'identifier':a},'id':{'identifier':b},'where':{'kind':'addressEq','identifier':c}}),vecContainsString=(a,b)=>({'type':'vec_contains_string','nodes':[a,b]}),nodeEntryTime=(a,b,c)=>({'type':'query_progress_history_time','object':{'identifier':a,'convert_witness':'OrderProgress'},'where':{'nextNode':b},'find':c}),submittedOrder=(a,b)=>({'identifier':a,'b_submission':!![],'value_type':'Address','object_type':'Order','name':b}),constantAddress=(a,b,c)=>({'identifier':a,'b_submission':![],'value_type':'Address','value':b,'name':c}),constantString=(a,b,c)=>({'identifier':a,'b_submission':![],'value_type':'String','value':b,'name':c}),constantU64=(a,b,c)=>({'identifier':a,'b_submission':![],'value_type':'U64','value':b,'name':c});function conjunctsOf(a){if(typeof a==='object'&&a!==null){const b=a;if(b['type']==='logic_and'&&Array['isArray'](b['nodes']))return b['nodes'];}return[a];}function hostOrderSlot(a){const b=a['find'](c=>c['b_submission']===!![]&&c['value_type']==='Address'&&c['object_type']==='Order'&&typeof c['identifier']==='number'&&c['identifier']<0xc8);return b===undefined?undefined:b['identifier'];}export function emitSupplyChainPromise(a){const b=[],c=[],d=[],e=a['axis'],f=a['form']??'rendezvous',g=a['fact_key']??'fulfilment',h=g+'_sub',i=a['ack_key']??g+'_ack',j=a['id_prefix']??'sc',k=a['service_step_id']??'service',l=a['ack_window_days']??(e==='merchant_procured'?DEFAULT_ACK_WINDOW_DAYS:0x0),m=a['payout_rate']??0x2710;for(const [F,G]of[['sub_service',a['sub_service']],['service_name',a['service_name']],['done_node',a['done_node']]]){(typeof G!=='string'||G['trim']()==='')&&b['push']({'code':'SUPPLY_CHAIN_PROMISE_INCOMPLETE','detail':'A\x20supply-chain\x20promise\x20needs\x20\x27'+F+'\x27:\x20the\x20procured\x20provider,\x20the\x20host\x20Service\x20and\x20the\x20node\x20'+'that\x20releases\x20the\x20money\x20are\x20the\x20three\x20facts\x20the\x20gate\x20is\x20built\x20from.\x20Nothing\x20was\x20guessed.'});}e!=='merchant_procured'&&e!=='user_procured'&&b['push']({'code':'SUPPLY_CHAIN_PROMISE_INCOMPLETE','detail':'fulfillment\x20axis\x20\x27'+String(e)+'\x27\x20is\x20not\x20a\x20procuring\x20axis.\x20Staff\x20under\x20the\x20shop\x27s\x20own\x20permission\x20'+'need\x20no\x20composition\x20(they\x20are\x20the\x20merchant),\x20and\x20self-fulfilment\x20has\x20no\x20third\x20party\x20to\x20pay\x20or\x20to\x20'+'disclose.\x20Declare\x20merchant_procured\x20or\x20user_procured.'});(!Number['isInteger'](m)||m<0x1||m>0x2710)&&b['push']({'code':'SUPPLY_CHAIN_PAYOUT_RATE','detail':'payout_rate\x20'+String(m)+'\x20is\x20outside\x201..10000\x20basis\x20points\x20of\x20the\x20settlement\x20rail.\x20Rate\x20legs\x20'+'must\x20sum\x20to\x20exactly\x2010000\x20when\x20nothing\x20takes\x20the\x20remainder,\x20so\x20an\x20out-of-range\x20share\x20aborts\x20the\x20'+'release\x20rather\x20than\x20paying\x20less.'});e==='merchant_procured'&&f==='rendezvous'&&l===0x0&&b['push']({'code':'SUPPLY_CHAIN_ACK_WITHOUT_DEADLINE','detail':'A\x20buyer\x20acknowledgement\x20with\x20no\x20deadline\x20gives\x20the\x20buyer\x20a\x20costless\x20veto\x20over\x20the\x20merchant\x27s\x20'+'settlement:\x20silence\x20would\x20hold\x20the\x20rail\x20shut\x20forever.\x20Pass\x20ack_window_days\x20(the\x20default\x20is\x20'+(DEFAULT_ACK_WINDOW_DAYS+')\x20so\x20silence\x20turns\x20into\x20acknowledgement,\x20or\x20drop\x20the\x20acknowledgement\x20')+'requirement\x20and\x20price\x20the\x20merchant-asserted\x20fact\x20into\x20the\x20listing\x20instead.'});if(b['length']>0x0)return{'steps':[],'inputs':{},'primitives':[],'notes':c,'blockers':b};const n=[],o=new Set(),p=j+'_gate',q='tpl_allocator_node_gate_settle_once',r=fillGuardTemplate(q,{'service_name':a['service_name']??'','settle_node':a['done_node'],'settle_node_alt':a['done_node_alt']??a['done_node'],'settle_node_alt2':a['done_node_alt2']??a['done_node']});if(!r['ok'])return{'steps':[],'inputs':{},'primitives':[],'notes':c,'blockers':[...b,{'code':'SUPPLY_CHAIN_GATE_TEMPLATE','detail':q+'\x20did\x20not\x20fill:\x20'+r['error']}]};const s=r['table']['map'](H=>({...H})),t=new Set(s['map'](H=>H['identifier'])),u=()=>{let H=0x3;while(t['has'](H))H+=0x1;return t['add'](H),H;},v=hostOrderSlot(s)??0x0,w=[],x=[],y=(H,I)=>{return x['push']('slot\x20'+String(H['identifier'])+'\x20`'+String(H['name'])+'`:\x20'+I),s['push'](H),H;},z=a['repository']??a['repository_name']??(a['service_name']??'')+'_supply_chain',A=a['repository']===undefined,B=j+'_rendezvous';let C=[],D='',E='';if(f==='rendezvous'){o['add']('P1');const H=u(),I=u(),J=u(),K=u(),L=u();y(constantAddress(H,z,'ledger'),A?'the\x20rendezvous\x20Repository\x20this\x20build\x20creates\x20and\x20binds\x20to\x20the\x20host\x20Service\x20(a\x20circular\x20'+'reference\x20by\x20name\x20—\x20resolved\x20when\x20the\x20plan\x20materializes)':'the\x20rendezvous\x20Repository\x20shared\x20with\x20the\x20fulfilment\x20side\x20(an\x20existing\x20object,\x20not\x20created\x20here)'),y(constantString(I,g,'fact_key'),'the\x20forward\x20policy\x20key:\x20the\x20ledger\x20row\x20whose\x20id\x20is\x20the\x20HOST\x20order\x20and\x20whose\x20value\x20is\x20the\x20fulfilment\x20order'),y(constantString(J,h,'reverse_key'),'the\x20reverse\x20policy\x20key:\x20the\x20ledger\x20row\x20whose\x20id\x20is\x20the\x20FULFILMENT\x20order\x20and\x20whose\x20value\x20is\x20the\x20host\x20order'),y(submittedOrder(K,'fulfilment_order'),'SUBMITTED\x20at\x20the\x20gate:\x20the\x20fulfilment\x20order\x20the\x20ledger\x20pairs\x20with\x20this\x20host\x20order.\x20Both\x20ledger\x20'+'directions\x20must\x20name\x20it,\x20so\x20a\x20delivery\x20that\x20was\x20never\x20paired\x20here\x20cannot\x20settle\x20this\x20order.'),y(constantAddress(L,a['sub_service'],'sub_service'),'the\x20procured\x20sub-Service\x20—\x20the\x20build-time\x20commitment.\x20The\x20submitted\x20fulfilment\x20order\x20must\x20be\x20an\x20'+'order\x20AT\x20this\x20Service,\x20which\x20is\x20what\x20stops\x20any\x20order\x20from\x20being\x20presented\x20as\x20the\x20fulfilment.'),w['push'](vecContainsString(keysWhereAddressEq(H,v,K),idn(I)),vecContainsString(keysWhereAddressEq(H,K,v),idn(J)));if(e==='merchant_procured'){n['push']({'op':'create','id':j+'_write','object':'guard','params':P({'description':'Fulfilment\x20write\x20credential\x20(merchant-procured):\x20the\x20writer\x20must\x20hold\x20the\x20fulfilment\x20'+('order,\x20and\x20that\x20order\x20must\x20belong\x20to\x20the\x20promised\x20provider\x20\x27'+a['sub_service']+'\x27.\x20')+'Slot\x20legend\x20—\x20slot\x200\x20`host_order`:\x20SUBMITTED,\x20the\x20host\x20order\x20this\x20fulfilment\x20serves;\x20it\x20'+'becomes\x20the\x20forward\x20ledger\x20row\x27s\x20id,\x20and\x20it\x20is\x20data\x20the\x20writer\x20ASSERTS\x20rather\x20than\x20an\x20'+'identity\x20they\x20prove.\x20Slot\x201\x20`fulfilment_order`:\x20SUBMITTED,\x20the\x20order\x20the\x20writer\x20holds\x20at\x20'+'the\x20procured\x20provider;\x20it\x20becomes\x20the\x20reverse\x20row\x27s\x20id.\x20Slot\x202\x20`sub_service`:\x20CONSTANT,\x20'+'the\x20build-time\x20commitment\x20slot\x201\x20is\x20checked\x20against.','table':[submittedOrder(0x0,'host_order'),submittedOrder(0x1,'fulfilment_order'),constantAddress(0x2,a['sub_service'],'sub_service')],'root':allOf([anyOf([eq(query('order.owner',0x1),ctx('Signer')),query('order.agent\x20has',0x1,undefined,[ctx('Signer')])]),eq(query('order.service',0x1),idn(0x2))])}),'notes':'No\x20once\x20slot\x20here:\x20the\x20consumed-once\x20table\x20lives\x20on\x20the\x20Allocation,\x20so\x20a\x20write\x20credential\x20gains\x20'+'nothing\x20from\x20one.\x20Replay\x20is\x20refused\x20by\x20the\x20two\x20write-once\x20policies\x20instead.\x20The\x20host\x20order\x20in\x20'+'slot\x200\x20is\x20data\x20the\x20writer\x20asserts,\x20not\x20an\x20identity\x20they\x20prove\x20—\x20that\x20asymmetry\x20is\x20what\x20the\x20'+'buyer\x20acknowledgement\x20leg\x20covers.'});const M=fillGuardTemplate('tpl_repository_write_order_holder',{});if(!M['ok'])return{'steps':n,'inputs':{},'primitives':[...o],'notes':c,'blockers':[{'code':'SUPPLY_CHAIN_GATE_TEMPLATE','detail':'tpl_repository_write_order_holder\x20did\x20not\x20fill:\x20'+M['error']}]};n['push']({'op':'create','id':j+'_ack','object':'guard','params':P({'description':'Buyer\x20acknowledgement\x20credential:\x20only\x20the\x20holder\x20of\x20the\x20host\x20order\x20(or\x20their\x20agent)\x20can\x20'+'confirm\x20that\x20the\x20procured\x20fulfilment\x20actually\x20reached\x20them.','table':M['table'],'root':M['root']}),'notes':'Canonical\x20order-holder\x20write\x20credential,\x20unmodified.'});const N=u();y(constantString(N,i,'ack_key'),'the\x20acknowledgement\x20policy\x20key:\x20a\x20write-once\x20row\x20keyed\x20by\x20the\x20HOST\x20order,\x20written\x20by\x20the\x20buyer\x20'+'(or\x20their\x20agent)\x20to\x20confirm\x20the\x20procured\x20fulfilment\x20actually\x20reached\x20them.');const O=[query('repository.data\x20has',H,undefined,[idn(N),idn(v)])];if(l>0x0){const Q=l*MS_PER_DAY,R=u();y(constantU64(R,Q,'ack_window_ms'),'the\x20acknowledgement\x20window\x20in\x20milliseconds\x20('+l+'\x20day(s)):\x20after\x20this\x20long\x20with\x20no\x20'+'acknowledgement\x20row,\x20the\x20buyer\x27s\x20silence\x20counts\x20as\x20acknowledgement.');const S=u();y(constantU64(S,0x0,'no_entry'),'constant\x200\x20—\x20the\x20value\x20query\x201280\x20returns\x20when\x20the\x20order\x20has\x20NO\x20recorded\x20entry\x20into\x20the\x20'+'anchoring\x20node.\x20The\x20deadline\x20leg\x20is\x20gated\x20on\x20the\x20anchor\x20being\x20above\x20it.');const T=nodeEntryTime(v,a['done_node'],'last');O['push'](allOf([u256Gt(T,idn(S)),u256Gte(ctx('Clock'),numAdd(T,idn(R)))])),d['push']({'param':j+'.ack_window_ms','from':'ack_window_days','input':l,'value':Q,'at_ms':Date['now'](),'note':'The\x20chain\x20compares\x20one\x20absolute\x20millisecond\x20timestamp,\x20so\x20the\x20day\x20count\x20is\x20converted\x20here\x20'+'and\x20the\x20product\x20rides\x20in\x20the\x20guard\x20table\x20where\x20the\x20buyer\x20can\x20read\x20it.'}),c['push']('Buyer\x20silence\x20counts\x20as\x20acknowledgement\x20'+l+'\x20day(s)\x20after\x20the\x20order\x20LAST\x20entered\x20'+('\x27'+a['done_node']+'\x27\x20(defaulted\x20—\x20raise\x20or\x20lower\x20ack_window_days;\x20it\x20is\x20the\x20merchant\x27s\x20risk\x20')+'parameter,\x20not\x20a\x20protocol\x20constant).\x20Residual:\x20a\x20Machine\x20that\x20lets\x20the\x20buyer\x20re-enter\x20'+('\x27'+a['done_node']+'\x27\x20re-arms\x20that\x20window,\x20so\x20do\x20not\x20offer\x20a\x20buyer-triggered\x20forward\x20back\x20into\x20')+'it\x20—\x20or\x20treat\x20the\x20window\x20as\x20a\x20floor\x20rather\x20than\x20a\x20deadline.'),c['push']('The\x20deadline\x20only\x20runs\x20from\x20a\x20RECORDED\x20entry\x20into\x20\x27'+a['done_node']+'\x27.\x20An\x20order\x20sitting\x20at\x20'+('\x27'+(a['done_node_alt']??a['done_node'])+'\x27\x20instead,\x20or\x20one\x20created\x20at\x20the\x20node\x20without\x20a\x20')+'forward,\x20has\x20no\x20entry\x20to\x20anchor\x20on\x20—\x20there\x20the\x20acknowledgement\x20row\x20is\x20the\x20only\x20way\x20to\x20settle.');}w['push'](anyOf(O)),D='Rendezvous\x20ledger\x20between\x20the\x20host\x20Service\x20and\x20its\x20procured\x20fulfilment\x20provider.\x20Rows\x20are\x20'+'public\x20and\x20permanent:\x20they\x20carry\x20order\x20addresses\x20only,\x20never\x20a\x20name,\x20a\x20phone\x20number\x20or\x20an\x20'+'address\x20to\x20deliver\x20to.',C=[{'name':g,'description':'One\x20write-once\x20row\x20per\x20HOST\x20order\x20(key\x20=\x20the\x20host\x20order\x20address,\x20value\x20=\x20the\x20'+'fulfilment\x20order\x20the\x20merchant\x20says\x20served\x20it).\x20The\x20money\x20gate\x20reads\x20it\x20through\x20'+'query\x201177,\x20which\x20type-checks\x20the\x20stored\x20Address\x20against\x20the\x20submitted\x20one.','write_guard':[{'guard':ref(j+'_write'),'id_from_submission':0x0,'data_from_submission':0x1}],'id_from':'none','value_type':'Address','write_once':!![]},{'name':h,'description':'One\x20write-once\x20row\x20per\x20FULFILMENT\x20order\x20(key\x20=\x20the\x20fulfilment\x20order\x20address,\x20value\x20'+'=\x20the\x20host\x20order\x20it\x20served).\x20This\x20is\x20the\x20pairing\x20key:\x20because\x20the\x20row\x20is\x20write-once\x20'+'on\x20the\x20fulfilment\x20order,\x20ONE\x20delivery\x20can\x20never\x20be\x20presented\x20against\x20two\x20host\x20'+'orders,\x20and\x20the\x20gate\x27s\x20reverse\x20leg\x20proves\x20the\x20pairing\x20in\x20that\x20direction.','write_guard':[{'guard':ref(j+'_write'),'id_from_submission':0x1,'data_from_submission':0x0}],'id_from':'none','value_type':'Address','write_once':!![]},{'name':i,'description':'One\x20write-once\x20row\x20per\x20HOST\x20order,\x20written\x20by\x20the\x20buyer\x20(or\x20their\x20agent)\x20to\x20confirm\x20'+'receipt.\x20The\x20money\x20gate\x20accepts\x20either\x20this\x20row\x20or\x20an\x20expired\x20acknowledgement\x20'+'window.','write_guard':[{'guard':ref(j+'_ack'),'id_from_submission':0x0,'data_from_submission':0x1}],'id_from':'none','value_type':'U64','write_once':!![]}],E='The\x20fulfilment\x20side\x20writes\x20both\x20fulfilment\x20rows\x20(one\x20call\x20per\x20policy\x20key,\x20both\x20under\x20the\x20same\x20'+'credential);\x20the\x20acknowledgement\x20row\x20is\x20written\x20by\x20the\x20buyer.\x20No\x20row\x20carries\x20a\x20delivery\x20address\x20'+'—\x20see\x20the\x20privacy\x20note\x20for\x20where\x20that\x20belongs.',c['push']('Merchant-asserted\x20fact:\x20the\x20merchant\x20names\x20which\x20host\x20order\x20a\x20delivery\x20served,\x20and\x20the\x20chain\x20can\x20'+'verify\x20the\x20provider\x20and\x20the\x20pairing\x27s\x20uniqueness\x20but\x20NOT\x20that\x20the\x20delivery\x20physically\x20reached\x20this\x20'+'buyer.\x20The\x20buyer\x27s\x20acknowledgement\x20row\x20is\x20the\x20only\x20tie\x20to\x20reality,\x20so\x20the\x20acknowledgement\x20window\x20is\x20'+'a\x20real\x20risk\x20parameter\x20—\x20a\x20long\x20window\x20means\x20the\x20merchant\x20waits,\x20a\x20short\x20one\x20means\x20the\x20buyer\x20loses\x20'+'the\x20chance\x20to\x20object.');}else{const U=j+'_write',V=fillGuardTemplate('tpl_repository_write_order_holder',{});if(!V['ok'])return{'steps':n,'inputs':{},'primitives':[...o],'notes':c,'blockers':[{'code':'SUPPLY_CHAIN_GATE_TEMPLATE','detail':'tpl_repository_write_order_holder\x20did\x20not\x20fill:\x20'+V['error']}]};const W=V['table']['map'](Y=>({...Y})),X=W['find'](Y=>Y['identifier']===0x1);X!==undefined&&(X['value_type']='Address',X['object_type']='Order',X['name']='fulfilment_order'),n['push']({'op':'create','id':U,'object':'guard','params':P({'description':'Fulfilment\x20write\x20credential\x20(user-procured):\x20the\x20holder\x20of\x20the\x20host\x20order\x20records\x20which\x20'+'fulfilment\x20order\x20they\x20procured\x20for\x20it.\x20Slot\x20legend\x20—\x20slot\x200\x20`host_order`:\x20SUBMITTED,\x20the\x20'+'buyer\x27s\x20own\x20host\x20order;\x20the\x20caller\x20must\x20hold\x20it.\x20Slot\x201\x20`fulfilment_order`:\x20SUBMITTED,\x20'+'the\x20fulfilment\x20order\x20the\x20buyer\x20procured,\x20retyped\x20here\x20to\x20an\x20order\x20Address\x20because\x20the\x20'+'ledger\x20row\x20it\x20fills\x20is\x20keyed\x20by\x20an\x20address,\x20not\x20a\x20receipt\x20marker.','table':W,'root':V['root']}),'notes':'Canonical\x20order-holder\x20write\x20credential;\x20only\x20the\x20value\x20slot\x20is\x20retyped\x20to\x20an\x20order\x20address.'}),D='Rendezvous\x20ledger\x20for\x20a\x20user-procured\x20fulfilment.\x20Rows\x20are\x20public\x20and\x20permanent:\x20they\x20carry\x20'+'order\x20addresses\x20only,\x20never\x20a\x20name,\x20a\x20phone\x20number\x20or\x20an\x20address\x20to\x20deliver\x20to.',C=[{'name':g,'description':'One\x20write-once\x20row\x20per\x20HOST\x20order\x20(key\x20=\x20the\x20host\x20order\x20address,\x20value\x20=\x20the\x20'+'fulfilment\x20order\x20the\x20buyer\x20procured\x20for\x20it).','write_guard':[{'guard':ref(U),'id_from_submission':0x0,'data_from_submission':0x1}],'id_from':'none','value_type':'Address','write_once':!![]},{'name':h,'description':'One\x20write-once\x20row\x20per\x20FULFILMENT\x20order\x20(key\x20=\x20the\x20fulfilment\x20order\x20address,\x20value\x20'+'=\x20the\x20host\x20order\x20it\x20served).\x20Without\x20it\x20the\x20buyer\x20could\x20procure\x20one\x20delivery\x20and\x20'+'present\x20it\x20against\x20every\x20host\x20order\x20they\x20own.','write_guard':[{'guard':ref(U),'id_from_submission':0x1,'data_from_submission':0x0}],'id_from':'none','value_type':'Address','write_once':!![]}],E='Write-once\x20in\x20both\x20directions:\x20one\x20fulfilment\x20fact\x20per\x20host\x20order\x20and\x20one\x20host\x20order\x20per\x20fulfilment.';}A?n['push']({'op':'create','id':B,'object':'repository','params':P({'name':z,'description':D,'policies':C}),'notes':E}):c['push']('Reusing\x20the\x20existing\x20rendezvous\x20Repository\x20\x27'+z+'\x27:\x20this\x20build\x20neither\x20creates\x20nor\x20binds\x20'+('it.\x20It\x20must\x20ALREADY\x20carry\x20'+C['map'](Y=>'\x27'+String(Y['name'])+'\x27\x20(write_once,\x20'+String(Y['value_type'])+')')['join'](',\x20')+'\x20with\x20the\x20row\x20ids\x20the\x20handoff\x20describes,\x20or\x20the\x20gate\x20can\x20never\x20be\x20satisfied\x20—\x20and\x20')+'a\x20Repository\x27s\x20policies\x20cannot\x20be\x20re-pointed\x20at\x20another\x20write\x20guard\x20afterwards.'),o['add']('P2'),o['add']('P3'),w['push'](eq(query('order.service',K),idn(L))),e==='user_procured'?w['push'](eq(query('order.owner',K),query('order.owner',v))):c['push']('No\x20owner\x20tie\x20is\x20emitted:\x20on\x20the\x20merchant-procured\x20axis\x20the\x20buyer\x20does\x20not\x20own\x20the\x20fulfilment\x20'+'order,\x20so\x20an\x20equality\x20between\x20the\x20two\x20owners\x20could\x20never\x20hold.\x20The\x20provider\x20pin\x20plus\x20the\x20'+'write-once\x20bijection\x20plus\x20the\x20buyer\x20acknowledgement\x20are\x20the\x20tie\x20instead.');}else{o['add']('P2'),o['add']('P3');const Y=u(),Z=u();y(submittedOrder(Y,'fulfilment_order'),'SUBMITTED\x20at\x20the\x20gate:\x20the\x20fulfilment\x20order\x20the\x20caller\x20presents.\x20It\x20must\x20be\x20an\x20order\x20at\x20the\x20promised\x20'+'provider,\x20and\x20on\x20the\x20user-procured\x20axis\x20it\x20must\x20belong\x20to\x20the\x20same\x20owner\x20as\x20this\x20host\x20order.'),y(constantAddress(Z,a['sub_service'],'sub_service'),'the\x20procured\x20sub-Service\x20—\x20the\x20build-time\x20commitment\x20the\x20submitted\x20fulfilment\x20order\x20is\x20checked\x20against.'),y(submittedOrder(ONCE_SLOT_BYTES,'once_key'),'protocol\x20slot\x20255\x20—\x20the\x20byte-keyed\x20ONCE\x20slot.\x20Submit\x20the\x20SAME\x20fulfilment\x20order\x20address\x20as\x20'+'`fulfilment_order`;\x20the\x20Allocation\x27s\x20consumed-once\x20table\x20then\x20makes\x20that\x20delivery\x20single-use\x20'+'across\x20EVERY\x20order\x20of\x20this\x20Service,\x20which\x20the\x20chain-derived\x20254\x20(once\x20per\x20paying\x20order)\x20cannot\x20do.'),w['push'](eq(query('order.service',Y),idn(Z)),eq(idn(ONCE_SLOT_BYTES),idn(Y))),e==='user_procured'?w['push'](eq(query('order.owner',Y),query('order.owner',v))):c['push']('No\x20owner\x20tie\x20is\x20emitted:\x20on\x20the\x20merchant-procured\x20axis\x20the\x20buyer\x20does\x20not\x20own\x20the\x20fulfilment\x20order.'),c['push']('Submission\x20form:\x20the\x20fulfilment\x20order\x20is\x20named\x20at\x20the\x20gate\x20instead\x20of\x20being\x20recorded\x20in\x20a\x20shared\x20'+'ledger.\x20The\x20255\x20once\x20key\x20makes\x20each\x20delivery\x20single-use\x20across\x20the\x20Service,\x20but\x20NOTHING\x20binds\x20it\x20to\x20'+'THIS\x20host\x20order\x20—\x20a\x20merchant\x20can\x20present\x20any\x20order\x20at\x20the\x20promised\x20provider.\x20Prefer\x20the\x20rendezvous\x20'+'form,\x20which\x20proves\x20the\x20pairing\x20in\x20both\x20directions.');}n['push']({'op':'create','id':p,'object':'guard','params':P({'description':'Settlement\x20gate\x20for\x20a\x20'+(e==='merchant_procured'?'merchant-procured':'user-procured')+'\x20'+('fulfilment\x20('+f+'\x20form):\x20the\x20canonical\x20single-shot\x20settlement\x20gate\x20plus\x20the\x20composition\x20legs\x20the\x20')+'promise\x20requires.'+(x['length']>0x0?'\x20Slot\x20legend\x20—\x20the\x20on-chain\x20row\x20names\x20are\x20short\x20identifiers,\x20so\x20this\x20is\x20what\x20each\x20'+('composition\x20slot\x20carries:\x0a'+x['map'](a0=>'-\x20'+a0)['join']('\x0a')):''),'table':s,'root':allOf([...conjunctsOf(r['root']),...w])}),'notes':'Built\x20on\x20'+q+'\x20(node-set\x20arrival,\x20claimed_by\x20polarity,\x20caller\x20authorization\x20and\x20the\x20'+'chain-derived\x20254\x20once\x20key),\x20extended\x20with\x20the\x20supply-chain\x20legs.\x20Every\x20leg\x20is\x20evaluated:\x20the\x20evaluator\x20'+'has\x20no\x20short-circuit,\x20so\x20a\x20submission\x20the\x20caller\x20omits\x20aborts\x20the\x20call\x20rather\x20than\x20passing\x20silently.'});f==='rendezvous'&&A&&n['push']({'op':'configure','id':j+'_bind_repository','target':ref(k),'method':'repositories','params':P({'op':'add','objects':[ref(B)]}),'requires':[k,B]});if(a['payout_to']!==undefined&&a['payout_to']['trim']()!==''){const a0=[{'guard':ref(p),'track':'settlement','mode':'rate','sharing':[{'who':{'Entity':a['payout_to']},'rate':String(m)}]}];if(m<0x2710)a0['push']({'guard':ref(p),'track':'settlement','mode':'surplus'});n['push']({'op':'configure','id':j+'_alloc','target':ref(k),'method':'order_allocators','params':P({'allocators':a0}),'requires':[k,p],'notes':'Pays\x20the\x20fulfilment\x20party\x20'+m/0x64+'%\x20of\x20the\x20settlement\x20rail'+(m<0x2710?';\x20the\x20remainder\x20goes\x20to\x20the\x20shop':'')+'.\x20Allocator\x20rows\x20are\x20append-only\x20once\x20the\x20Service\x20is\x20published,\x20so\x20this\x20leg\x20cannot\x20be\x20added\x20later\x20'+'to\x20repair\x20a\x20missing\x20payout\x20path.'}),c['push']('This\x20adds\x20a\x20SECOND\x20settlement\x20rail\x20beside\x20the\x20shop\x27s\x20own.\x20Both\x20draw\x20on\x20the\x20same\x20order\x20balance\x20and\x20the\x20'+'order\x20in\x20which\x20they\x20are\x20fired\x20decides\x20who\x20is\x20paid\x20first\x20—\x20fire\x20the\x20composition\x20gate\x20only\x20after\x20the\x20'+'fulfilment\x20fact\x20is\x20true,\x20or\x20the\x20shop\x27s\x20own\x20rail\x20may\x20find\x20nothing\x20left.');}else c['push']('No\x20payout\x20leg\x20was\x20emitted\x20for\x20the\x20fulfilment\x20party.\x20With\x20no\x20third-party\x20rail\x20and\x20no\x20reward\x20pool,\x20a\x20'+'ruling\x20in\x20that\x20party\x27s\x20favour\x20has\x20no\x20execution\x20path\x20—\x20the\x20publish\x20audit\x20refuses\x20that\x20combination\x20'+'(COMPOSE-LIABILITY-01).\x20Pass\x20payout_to\x20(and\x20payout_rate)\x20to\x20open\x20the\x20rail,\x20or\x20mount\x20a\x20reward\x20pool\x20the\x20'+'party\x20can\x20claim\x20from.');return c['push']('Privacy:\x20the\x20fulfilment\x20party\x20needs\x20the\x20buyer\x27s\x20contact\x20or\x20delivery\x20details,\x20and\x20NOTHING\x20on\x20chain\x20carries\x20'+'them\x20privately\x20—\x20a\x20ledger\x20row,\x20a\x20forward\x20message\x20and\x20a\x20retained\x20submission\x20are\x20all\x20public\x20forever.\x20Send\x20'+'them\x20through\x20the\x20encrypted\x20channel\x20and\x20keep\x20only\x20a\x20hash\x20or\x20an\x20order\x20address\x20on\x20chain.'),{'steps':n,'inputs':{'fulfillment_axis':e},'primitives':[...o]['sort'](),'notes':c,'blockers':b,...f==='rendezvous'?{'handoff':{'repository':z,'writes':handoffWrites(C)}}:{},...d['length']>0x0?{'derived_params':d}:{}};}function handoffWrites(a){const b=(c,d)=>{if(c===0x0)return'the\x20HOST\x20order\x20address';if(c===0x1)return d==='U64'?'1\x20(a\x20receipt\x20marker)':'the\x20FULFILMENT\x20order\x20address';return'supplied\x20explicitly\x20by\x20the\x20caller\x20(no\x20submission\x20slot)';};return a['map'](c=>{const d=c['write_guard']??[],e=d[0x0]?.['id_from_submission'],f=d[0x0]?.['data_from_submission'];return{'policy':String(c['name']??''),'row_id':b(e,c['value_type']),'value':b(f,c['value_type']),'write_guard':String(d[0x0]?.['guard']?.['$ref']??''),'submissions':'slot\x200\x20=\x20the\x20host\x20order,\x20slot\x201\x20=\x20the\x20other\x20side\x20of\x20the\x20row'};});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{afterEach,beforeEach,describe,expect,it}from'vitest';import{existsSync,mkdtempSync,rmSync,writeFileSync}from'node:fs';import{tmpdir}from'node:os';import{join}from'node:path';import{ENTRYPOINT}from'@wowok/wowok';import{clearJudgmentLayers,clearJudgmentOverride,clearJudgmentOverrides,getJudgmentDoc,judgmentDisableTrace,judgmentLayerError,judgmentStatus,patchUserJudgmentDoc,setJudgmentIndustryOverlay,setJudgmentOverride,setJudgmentPersonaFragment}from'./judgment.js';import{checkUtilRisks}from'../knowledge/util-risk.js';import{appetiteMultiplier,evaluateOutcome,resolveInterests}from'../evaluation/game-strategy.js';import{evaluateArbGame}from'../evaluation/arbitration-game.js';import{registerDemandMatchEvaluation,matchDemandToServices}from'../evaluation/builtins/demand-match.js';import{extractDemandCapability}from'../evaluation/extract.js';import{monitorOrder}from'../customer/order-monitor.js';import{ModeEvaluator}from'../extensions/mode-evaluator.js';import{mergedBaselinesOverlay,registerIndustryBaselines}from'../extensions/industry-layers.js';import{scoreScorecard}from'../strategy/scorecard.js';import{FakeDataPlane}from'../graph/onchain/dataplane.js';import{expandTopology}from'../graph/onchain/expand.js';import{FULL,fullServiceState}from'../graph/onchain/fixtures.js';import{buildViewport}from'../graph/onchain/viewport.js';import{runAnalyzers}from'../graph/onchain/analyze.js';import{EVALUATION_SERVICE_INTENTS,resolveExpansionStrategy,withEvaluationBundle}from'../graph/onchain/strategy.js';import{projectEvaluationFacts}from'../graph/onchain/facts.js';import{evaluateGraphServiceFacts,registerGraphServiceEvaluations}from'../evaluation/builtins/graph-service.js';let configDir;function writeUserDoc(a){writeFileSync(join(configDir,'judgment.json'),JSON['stringify'](a,null,0x2),'utf-8');}beforeEach(()=>{configDir=mkdtempSync(join(tmpdir(),'wowok-config-audit-')),process['env']['WOWOK_CONFIG_DIR']=configDir,registerDemandMatchEvaluation();}),afterEach(()=>{delete process['env']['WOWOK_CONFIG_DIR'];if(existsSync(configDir))rmSync(configDir,{'recursive':!![],'force':!![]});clearJudgmentOverrides(),clearJudgmentLayers();});async function projectFixture(){registerGraphServiceEvaluations();const a=withEvaluationBundle(resolveExpansionStrategy({'intents':[...EVALUATION_SERVICE_INTENTS]})),b=await expandTopology(new FakeDataPlane(fullServiceState()),{'network':ENTRYPOINT['Mainnet'],'seed':FULL['svc'],'edges':a['edges'],'budget':a['budget']}),c=buildViewport(b,FULL['svc'],'neutral');return projectEvaluationFacts(c,FULL['svc'],runAnalyzers(c));}const demandCap=extractDemandCapability({'object':'0xdemand','location':'Shanghai','description':'need\x20a\x20freelance\x20designer'},{'industry':'freelance','price_max':0x96n,'keywords':['design','logo'],'capabilities':{'has_arbitration':!![],'has_refund_path':!![],'has_milestone_nodes':![],'has_compensation_fund':![],'has_wip_verification':!![],'has_messenger':![],'has_buy_guard':![],'has_dynamic_pricing':![],'is_published':!![],'is_paused':![]}}),inRegionService={'object':'0xgood','location':'Shanghai','description':'freelance\x20logo\x20design','sales':[{'price':'100','wip_hash':'abc'}],'arbitrations':['0xarb'],'compensation_fund':'500','bPublished':!![],'bPaused':![]},breakdownOf=(a,b)=>a['breakdown']['find'](c=>c['rule_id']===b);describe('config\x20audit\x20—\x20evaluation\x20section',()=>{it('1.\x20weights.trust_reviews\x20flows\x20into\x20the\x20aggregated\x20trust\x20total\x20(user\x20doc\x20channel)',async()=>{const a=await projectFixture(),b=await evaluateGraphServiceFacts(a);expect(b['trust']['breakdown']['find'](d=>d['rule_id']==='trust_reviews')['weight'])['toBe'](0x23),writeUserDoc({'version':0x1,'evaluation':{'weights':{'trust_reviews':0x46}}});const c=await evaluateGraphServiceFacts(a);expect(c['trust']['breakdown']['find'](d=>d['rule_id']==='trust_reviews')['weight'])['toBe'](0x46),expect(c['trust']['total'])['toBe'](0x2f);}),it('2.\x20severity_deduction.critical\x2050→5\x20lifts\x20the\x20risk-side\x20rule\x20score\x20(session\x20override)',async()=>{const a=await projectFixture(),b=await evaluateGraphServiceFacts(a);expect(b['risk']['breakdown']['find'](d=>d['rule_id']==='risk_fund')['score'])['toBe'](0x19),expect(setJudgmentOverride('evaluation.severity_deduction.critical',0x5))['toEqual']({'ok':!![]});const c=await evaluateGraphServiceFacts(a);expect(c['risk']['breakdown']['find'](d=>d['rule_id']==='risk_fund')['score'])['toBe'](0x46),expect(c['risk']['breakdown']['find'](d=>d['rule_id']==='risk_trust')['score'])['toBe'](0x41),expect(c['risk']['total'])['toBe'](0x56);}),it('3.\x20level_bands\x20first\x20band\x20min\x2085→30\x20flips\x20the\x20level\x20of\x20an\x20unchanged\x20score\x20(session\x20override)',async()=>{const a=await projectFixture(),b=await evaluateGraphServiceFacts(a);expect(b['trust']['total'])['toBe'](0x31),expect(b['trust']['level'])['toBe']('high'),setJudgmentOverride('evaluation.level_bands',[{'min':0x1e,'level':'low'},{'min':0x46,'level':'medium_low'},{'min':0x32,'level':'medium_high'},{'min':0x0,'level':'high'}]);const c=await evaluateGraphServiceFacts(a);expect(c['trust']['total'])['toBe'](0x31),expect(c['trust']['level'])['toBe']('low');}),it('4.\x20grade_words.trust\x20first\x20band\x20min\x2070→20\x20flips\x20the\x20rendered\x20grade\x20word\x20(session\x20override)',async()=>{const a=await projectFixture(),b=await evaluateGraphServiceFacts(a);expect(b['trust']['summary'])['toContain']('grade:\x20weak'),setJudgmentOverride('evaluation.grade_words.trust',[{'min':0x14,'word':'strong'},{'min':0x32,'word':'fair'},{'min':0x0,'word':'weak'}]);const c=await evaluateGraphServiceFacts(a);expect(c['trust']['summary'])['toContain']('grade:\x20strong');}),it('5.\x20dimensions.<id>.label\x20retune\x20reaches\x20the\x20live\x20summary\x20rendering\x20(industry\x20overlay\x20channel)',async()=>{const a=await projectFixture(),b=await evaluateGraphServiceFacts(a);expect(b['trust']['summary'])['toContain']('weakest\x20Fund\x20safety'),setJudgmentIndustryOverlay({'evaluation':{'dimensions':{'trust_fund_safety':{'label':'Fund\x20Cushion','description':'audit\x20retune'}}}},'pack:audit');const c=await evaluateGraphServiceFacts(a);expect(c['trust']['summary'])['toContain']('weakest\x20Fund\x20Cushion'),expect(c['trust']['breakdown']['find'](d=>d['rule_id']==='trust_fund_safety')['dimension'])['toBe']('Fund\x20Cushion');});}),describe('config\x20audit\x20—\x20game\x20section',()=>{it('6.\x20scoring.base\x2060→80\x20lifts\x20every\x20net\x20score\x20(judgment_doc_patch\x20channel)',()=>{expect(evaluateOutcome('refund','customer')['net_score'])['toBe'](0x50);const a=patchUserJudgmentDoc({'game':{'scoring':{'base':0x50}}});expect(a['applied'])['toBe'](!![]),expect(evaluateOutcome('refund','customer')['net_score'])['toBe'](0x64);}),it('7.\x20appetite_multipliers.conservative\x201.5→0.6\x20changes\x20the\x20conservative\x20sensitivity\x20result\x20(session\x20override)',()=>{const a=evaluateOutcome('refund','merchant',{'risk_appetite':'conservative'});expect(a['risk_score'])['toBe'](0x4b),expect(a['net_score'])['toBe'](0x0),setJudgmentOverride('game.appetite_multipliers.conservative',0.6);const b=evaluateOutcome('refund','merchant',{'risk_appetite':'conservative'});expect(b['risk_score'])['toBe'](0x1e),expect(b['net_score'])['toBe'](0x1e),expect(appetiteMultiplier('conservative'))['toBe'](0.6);}),it('8.\x20role_interests.customer.prefer\x20+\x20node_advanced\x20adds\x20a\x20gain\x20(industry\x20overlay\x20channel)',()=>{const a=evaluateOutcome('advance','customer');expect(a['gains'])['toEqual']([]),expect(a['net_score'])['toBe'](0x3c),setJudgmentIndustryOverlay({'game':{'role_interests':{'customer':{'prefer':['fund_returned_to_buyer','node_advanced'],'avoid':[],'sensitivity':0x1}}}},'pack:audit');const b=evaluateOutcome('advance','customer');expect(b['gains'])['toEqual'](['node_advanced']),expect(b['net_score'])['toBe'](0x50);}),it('9.\x20a\x20new\x20keyword_rules\x20entry\x20re-anchors\x20prefer\x20on\x20a\x20matching\x20requirement\x20(user\x20doc\x20channel)',()=>{const a=resolveInterests('system',{'requirements':['please\x20test\x20it']});expect(a['prefer'])['toEqual']([]),writeUserDoc({'version':0x1,'game':{'keyword_rules':[{'id':'kw_audit_testing','keywords':['test'],'effect':'node_advanced','anchor':'prefer','when_forbidden':![]}]}});const b=resolveInterests('system',{'requirements':['please\x20test\x20it']});expect(b['prefer'])['toEqual'](['node_advanced']);}),it('10.\x20forbid_pattern\x20rewritten\x20to\x20a\x20non-matching\x20pattern\x20disarms\x20when_forbidden\x20rules\x20(user\x20doc\x20channel)',()=>{const a=resolveInterests('neutral',{'requirements':['never\x20arbitration']});expect(a['avoid'])['toContain']('arbitration_review_triggered'),writeUserDoc({'version':0x1,'game':{'forbid_pattern':'zzz_never_matches'}});const b=resolveInterests('neutral',{'requirements':['never\x20arbitration']});expect(b['avoid'])['toEqual']([]);});}),describe('config\x20audit\x20—\x20game.arb\x20section\x20(7-state\x20game)',()=>{it('11.\x20arb.scoring.per_gain\x2020→40\x20moves\x20the\x20favorability\x20of\x20a\x201-gain\x20move\x20(session\x20override)',()=>{const a=evaluateArbGame('Voting','arbitrator');expect(a['actions'][0x0]?.['gain_score'])['toBe'](0x14),expect(a['actions'][0x0]?.['favorability'])['toBe'](0x50),setJudgmentOverride('game.arb.scoring.per_gain',0x28);const b=evaluateArbGame('Voting','arbitrator');expect(b['actions'][0x0]?.['gain_score'])['toBe'](0x28),expect(b['actions'][0x0]?.['favorability'])['toBe'](0x64);}),it('12.\x20a\x20new\x20arb\x20keyword_rules\x20entry\x20re-anchors\x20a\x20perspective\x27s\x20prefer\x20(user\x20doc\x20channel)',()=>{const a=evaluateArbGame('Principal_confirming','customer',{'requirements':['expedite\x20please']});expect(a['actions'][0x0]?.['gain_score'])['toBe'](0x0),expect(a['actions'][0x0]?.['favorability'])['toBe'](0x3c),writeUserDoc({'version':0x1,'game':{'arb':{'keyword_rules':[{'id':'arb_kw_audit_expedite','keywords':['expedite'],'effect':'case_advanced','anchor':'prefer','when_forbidden':![]}]}}});const b=evaluateArbGame('Principal_confirming','customer',{'requirements':['expedite\x20please']});expect(b['actions'][0x0]?.['gain_score'])['toBe'](0x14),expect(b['actions'][0x0]?.['favorability'])['toBe'](0x50);});}),describe('config\x20audit\x20—\x20match\x20section',()=>{it('13.\x20region_scores.exact\x20100→50\x20halves\x20the\x20region\x20rule\x20score\x20(session\x20override)',async()=>{const [a]=await matchDemandToServices(demandCap,[inRegionService]);expect(breakdownOf(a['result'],'region')['score'])['toBe'](0x64),setJudgmentOverride('match.region_scores.exact',0x32);const [b]=await matchDemandToServices(demandCap,[inRegionService]);expect(breakdownOf(b['result'],'region')['score'])['toBe'](0x32),expect(b['result']['total'])['toBeLessThan'](a['result']['total']);}),it('14.\x20weights.capabilities\x2030→60\x20raises\x20its\x20renormalized\x20share\x20(session\x20override)',async()=>{const [a]=await matchDemandToServices(demandCap,[inRegionService]);expect(breakdownOf(a['result'],'capabilities')['weight'])['toBe'](0x1e),expect(a['result']['total'])['toBe'](0x43),setJudgmentOverride('match.weights.capabilities',0x3c);const [b]=await matchDemandToServices(demandCap,[inRegionService]);expect(breakdownOf(b['result'],'capabilities')['weight'])['toBe'](0x3c),expect(breakdownOf(b['result'],'region')['weight'])['toBe'](0xf),expect(b['result']['total'])['toBe'](0x4a);}),it('15.\x20trust_bands\x20second\x20band\x20score\x2060→10\x20(extracted\x20trust_score\x20is\x2050\x20→\x20band\x20#2)\x20(session\x20override)',async()=>{const [a]=await matchDemandToServices(demandCap,[inRegionService]);expect(breakdownOf(a['result'],'trust')['score'])['toBe'](0x3c),setJudgmentOverride('match.trust_bands',[{'min':0x4b,'score':0x64},{'min':0x32,'score':0xa},{'min':0x19,'score':0x1e},{'min':0x0,'score':0x0}]);const [b]=await matchDemandToServices(demandCap,[inRegionService]);expect(breakdownOf(b['result'],'trust')['score'])['toBe'](0xa);}),it('16.\x20neutral_score\x2050→10\x20changes\x20unknown-signal\x20scoring\x20(user\x20doc\x20channel)',async()=>{const a=extractDemandCapability({'object':'0xdemand','location':'Shanghai','description':'anything'},{'industry':'freelance','price_max':0x96n,'keywords':[],'capabilities':{'has_arbitration':![],'has_refund_path':![],'has_milestone_nodes':![],'has_compensation_fund':![],'has_wip_verification':![],'has_messenger':![],'has_buy_guard':![],'has_dynamic_pricing':![],'is_published':![],'is_paused':![]}}),[b]=await matchDemandToServices(a,[inRegionService]);expect(breakdownOf(b['result'],'tags')['score'])['toBe'](0x32),writeUserDoc({'version':0x1,'match':{'neutral_score':0xa}});const [c]=await matchDemandToServices(a,[inRegionService]);expect(breakdownOf(c['result'],'tags')['score'])['toBe'](0xa);}),it('17.\x20price_over_budget_tolerance_pct\x2010→100\x20turns\x20a\x20rejection\x20into\x20a\x20partial\x20score\x20(session\x20override)',async()=>{const a={...inRegionService,'object':'0xpricey','sales':[{'price':'200','wip_hash':'x'}]},[b]=await matchDemandToServices(demandCap,[a]);expect(breakdownOf(b['result'],'price')['score'])['toBe'](0x0),setJudgmentOverride('match.price_over_budget_tolerance_pct',0x64);const [c]=await matchDemandToServices(demandCap,[a]);expect(breakdownOf(c['result'],'price')['score'])['toBe'](0x32);}),it('18.\x20top_n\x205→2\x20caps\x20the\x20returned\x20candidate\x20count\x20(session\x20override)',async()=>{const a=[inRegionService,{...inRegionService,'object':'0xb'},{...inRegionService,'object':'0xc'}];expect((await matchDemandToServices(demandCap,a))['length'])['toBe'](0x3),setJudgmentOverride('match.top_n',0x2),expect((await matchDemandToServices(demandCap,a))['length'])['toBe'](0x2);});}),describe('config\x20audit\x20—\x20monitor\x20section',()=>{const a=0x36ee80,b=c=>({'order_id':'0xorder','service_id':'0xservice','created_at':0x64*a,'now':0x64*a,...c});it('19.\x20messenger_timeout_hours\x2024→1\x20surfaces\x20the\x20timeout\x20finding\x20(user\x20doc\x20hot\x20reload)',()=>{const c=b({'last_user_message_at':0x62*a,'has_messenger':!![]});expect(monitorOrder({'current':c})['map'](f=>f['id']))['not']['toContain']('messenger_unanswered'),writeUserDoc({'version':0x1,'monitor':{'thresholds':{'messenger_timeout_hours':0x1}}});const d=monitorOrder({'current':c}),e=d['find'](f=>f['id']==='messenger_unanswered');expect(e?.['severity'])['toBe']('high');}),it('20.\x20escalation.stall_escalation_multiplier\x202→1\x20moves\x20the\x20critical\x20escalation\x20point\x20(session\x20override)',()=>{const c=b({'current_node':'Pay','last_progress_at':0x14*a}),d=monitorOrder({'current':c})['find'](f=>f['id']==='progress_stall');expect(d?.['severity'])['toBe']('high'),setJudgmentOverride('monitor.escalation.stall_escalation_multiplier',0x1);const e=monitorOrder({'current':c})['find'](f=>f['id']==='progress_stall');expect(e?.['severity'])['toBe']('critical');}),it('21.\x20compensation_coverage_min\x201.0→5\x20surfaces\x20the\x20insufficient-coverage\x20finding\x20(session\x20override)',()=>{const c=b({'compensation_balance':0x12cn,'order_amount':0x64n});expect(monitorOrder({'current':c})['map'](e=>e['id']))['not']['toContain']('compensation_insufficient'),setJudgmentOverride('monitor.thresholds.compensation_coverage_min',0x5);const d=monitorOrder({'current':c})['find'](e=>e['id']==='compensation_insufficient');expect(d?.['severity'])['toBe']('high');}),it('22.\x20explicit\x20MonitorThresholds\x20argument\x20wins\x20over\x20the\x20document\x20(caller\x20precedence)',()=>{const c=b({'last_user_message_at':0x62*a,'has_messenger':!![]});setJudgmentOverride('monitor.thresholds.messenger_timeout_hours',0x1),expect(monitorOrder({'current':c})['map'](d=>d['id']))['toContain']('messenger_unanswered'),expect(monitorOrder({'current':c,'thresholds':{'messenger_timeout_hours':0x48}})['map'](d=>d['id']))['not']['toContain']('messenger_unanswered'),clearJudgmentOverride('monitor.thresholds.messenger_timeout_hours');});}),describe('config\x20audit\x20—\x20mode\x20section',()=>{it('23.\x20appetite_thresholds.conservative.max_risk\x2030→99\x20flips\x20the\x20risk\x20recommendation\x20(session\x20override)',()=>{const a={'getCard':f=>({'constraints':{},'risk_profile':{'funds_risk':'medium'}})},b=new ModeEvaluator(a),c={'name':'audit_mode','traits':[],'machine_shape':{},'capabilities_used':['cap_audit'],'risk_appetite':'conservative','risk_constraints':{}},d=b['evaluateMode'](c);expect(d['risk_score'])['toBe'](0x3c),expect(d['recommendations']['join']('\x0a'))['toContain']('exceeds\x20conservative\x20mode\x20threshold\x2030'),setJudgmentOverride('mode.appetite_thresholds.conservative.max_risk',0x63);const e=b['evaluateMode'](c);expect(e['risk_score'])['toBe'](0x3c),expect(e['recommendations']['join']('\x0a'))['not']['toContain']('exceeds');});}),describe('config\x20audit\x20—\x20scorecard\x20section',()=>{function a(c){return{'account':'0xshop','industry':'education','network':'testnet','collected_at':0x0,'metrics':c,'unavailable':[],'errors':[]};}const b=(c,d)=>({'id':c,'source':'market_operations','status':'ok','value':d,'collected_at':0x0});it('24.\x20metrics.order_count.good_threshold\x2020→1\x20drives\x20the\x20metric\x20to\x20full\x20score\x20(session\x20override)',()=>{const d=a([b('order_count',0x1)]),e=scoreScorecard(d,'balanced');expect(e['metric_scores'][0x0]?.['score'])['toBe'](0x0),expect(e['overall'])['toBe'](0x0),setJudgmentOverride('scorecard.metrics.order_count.good_threshold',0x1);const f=scoreScorecard(d,'balanced');expect(f['metric_scores'][0x0]?.['score'])['toBe'](0x64),expect(f['overall'])['toBe'](0x64);}),it('25.\x20metrics.completion_rate.weight\x20posture\x20retune\x20changes\x20the\x20normalized\x20overall\x20(session\x20override)',()=>{const d=a([b('order_count',0x5),b('completion_rate',0.75)]),e=scoreScorecard(d,'margin');expect(e['metric_scores'][0x1]?.['weight'])['toBe'](0.15),expect(e['overall'])['toBe'](0x26),setJudgmentOverride('scorecard.metrics.completion_rate.weight',{'volume':0.15,'balanced':0.2,'margin':0.9});const f=scoreScorecard(d,'margin');expect(f['metric_scores'][0x1]?.['weight'])['toBe'](0.9),expect(f['overall'])['toBe'](0x2f);}),it('26.\x20shop_evidence_metrics\x20cleared\x20→\x20market-only\x20evidence\x20yields\x20a\x20null\x20overall\x20(session\x20override)',()=>{const d=a([b('order_count',0x14),b('supply_demand_ratio',0x2)]),e=scoreScorecard(d,'balanced');expect(e['overall'])['toBe'](0x5e),setJudgmentOverride('scorecard.shop_evidence_metrics',[]);const f=scoreScorecard(d,'balanced');expect(f['overall'])['toBeNull']();});}),describe('config\x20audit\x20—\x20rules\x20section\x20(declarative\x20rule\x20book)',()=>{it('27.\x20a\x20retuned\x20case\x20level\x20low→high\x20changes\x20the\x20finding\x20severity\x20(user\x20doc\x20channel)',()=>{const a=checkUtilRisks({'large_util_import':!![]})['find'](c=>c['id']==='R-UTIL-03');expect(a?.['level'])['toBe']('low'),writeUserDoc({'version':0x1,'rules':{'domains':{'util':{'rules':[{'rule_id':'R-UTIL-03','cases':[{'when':{'field':'large_util_import','op':'eq','value':!![]},'level':'high','title':'AUDIT:\x20util\x20import\x20retuned\x20to\x20high','description':'Audit-rewritten\x20description\x20for\x20R-UTIL-03.'}]}]}}}});const b=checkUtilRisks({'large_util_import':!![]})['find'](c=>c['id']==='R-UTIL-03');expect(b?.['level'])['toBe']('high'),expect(b?.['title'])['toContain']('AUDIT');}),it('28.\x20enabled:false\x20via\x20the\x20industry\x20layer\x20silences\x20the\x20finding\x20AND\x20leaves\x20a\x20disable\x20trace',()=>{expect(checkUtilRisks({'large_util_import':!![],'expects_util_events':!![]})['map'](a=>a['id']))['toEqual'](['R-UTIL-03','R-UTIL-04']),expect(setJudgmentIndustryOverlay({'rules':{'domains':{'util':{'rules':[{'rule_id':'R-UTIL-03','enabled':![]}]}}}},'pack:audit')['ok'])['toBe'](!![]),expect(checkUtilRisks({'large_util_import':!![],'expects_util_events':!![]})['map'](a=>a['id']))['toEqual'](['R-UTIL-04']),expect(judgmentDisableTrace())['toEqual']([{'layer':'pack:audit','domain':'util','rule_id':'R-UTIL-03'}]);}),it('29.\x20case.title/description\x20rewording\x20is\x20visible\x20in\x20the\x20finding\x20text\x20(user\x20doc\x20channel)',()=>{const a=checkUtilRisks({'bcs_manually_synced':!![]})['find'](c=>c['id']==='R-UTIL-05');expect(a?.['title'])['toContain']('SDK\x20BCS\x20structures\x20must\x20stay\x20in\x20sync'),writeUserDoc({'version':0x1,'rules':{'domains':{'util':{'rules':[{'rule_id':'R-UTIL-05','cases':[{'when':{'field':'bcs_manually_synced','op':'eq','value':!![]},'level':'medium','title':'AUDIT:\x20hand-maintained\x20BCS\x20layouts\x20drift\x20from\x20Move\x20structs','description':'Audit-rewritten\x20description\x20for\x20R-UTIL-05.'}]}]}}}});const b=checkUtilRisks({'bcs_manually_synced':!![]})['find'](c=>c['id']==='R-UTIL-05');expect(b?.['title'])['toContain']('AUDIT:\x20hand-maintained\x20BCS'),expect(b?.['description'])['toContain']('Audit-rewritten\x20description\x20for\x20R-UTIL-05.');});}),describe('config\x20audit\x20—\x20layer\x20chain\x20and\x20composition',()=>{it('30.\x20precedence\x20chain:\x20industry\x20X=61\x20<\x20persona\x20X=62\x20<\x20user\x20doc\x20X=63,\x20unwinding\x20in\x20reverse',()=>{expect(getJudgmentDoc()['game']['scoring']['base'])['toBe'](0x3c),setJudgmentIndustryOverlay({'game':{'scoring':{'base':0x3d}}},'pack:x'),expect(getJudgmentDoc()['game']['scoring']['base'])['toBe'](0x3d),setJudgmentPersonaFragment({'game':{'scoring':{'base':0x3e}}},'persona:y'),expect(getJudgmentDoc()['game']['scoring']['base'])['toBe'](0x3e),writeUserDoc({'version':0x1,'game':{'scoring':{'base':0x3f}}}),expect(getJudgmentDoc()['game']['scoring']['base'])['toBe'](0x3f),expect(evaluateOutcome('refund','customer')['net_score'])['toBe'](0x53),rmSync(join(configDir,'judgment.json')),expect(getJudgmentDoc()['game']['scoring']['base'])['toBe'](0x3e),setJudgmentPersonaFragment(null),expect(getJudgmentDoc()['game']['scoring']['base'])['toBe'](0x3d),setJudgmentIndustryOverlay(null),expect(getJudgmentDoc()['game']['scoring']['base'])['toBe'](0x3c);}),it('31.\x20mergedBaselinesOverlay:\x20the\x20later\x20industry\x20in\x20the\x20list\x20wins,\x20and\x20the\x20merged\x20overlay\x20drives\x20the\x20engine',()=>{registerIndustryBaselines({'category':'audit-a','fragment':{'monitor':{'thresholds':{'messenger_timeout_hours':0x1}}}}),registerIndustryBaselines({'category':'audit-b','fragment':{'monitor':{'thresholds':{'messenger_timeout_hours':0x2}}}});const a=mergedBaselinesOverlay(['audit-a','audit-b']);expect(a['monitor']?.['thresholds']?.['messenger_timeout_hours'])['toBe'](0x2),expect(setJudgmentIndustryOverlay(mergedBaselinesOverlay(['audit-a','audit-b']),'merged:audit')['ok'])['toBe'](!![]),expect(getJudgmentDoc()['monitor']['thresholds']['messenger_timeout_hours'])['toBe'](0x2);const b=0x36ee80,c={'order_id':'0xorder','service_id':'0xs','created_at':0x64*b,'now':0x64*b,'last_user_message_at':98.5*b,'has_messenger':!![]};expect(monitorOrder({'current':c})['map'](d=>d['id']))['not']['toContain']('messenger_unanswered');}),it('32.\x20an\x20invalid\x20persona\x20fragment\x20is\x20rejected,\x20the\x20layer\x20error\x20is\x20visible,\x20the\x20last\x20good\x20stays\x20in\x20force',()=>{expect(setJudgmentPersonaFragment({'game':{'scoring':{'base':0x46}}},'persona:audit')['ok'])['toBe'](!![]),expect(getJudgmentDoc()['game']['scoring']['base'])['toBe'](0x46);const a=setJudgmentPersonaFragment({'game':{'scoring':{'bse':0x1}}},'persona:audit');expect(a['ok'])['toBe'](![]),expect(judgmentLayerError('persona'))['toContain']('bse'),expect(judgmentStatus()['layer_errors']['persona'])['toContain']('bse'),expect(getJudgmentDoc()['game']['scoring']['base'])['toBe'](0x46);}),it('33.\x20severity_deduction\x20×\x20level_bands\x20combo:\x20a\x20big\x20deduction\x20pushes\x20the\x20score\x20across\x20a\x20band\x20boundary',async()=>{const a=await projectFixture(),b=await evaluateGraphServiceFacts(a);expect(b['risk']['total'])['toBe'](0x4a),expect(b['risk']['level'])['toBe']('medium_low'),setJudgmentOverride('evaluation.severity_deduction.high',0x50);const c=await evaluateGraphServiceFacts(a);expect(c['risk']['total'])['toBe'](0x39),expect(c['risk']['level'])['toBe']('medium_high');});}),describe('config\x20audit\x20—\x20rejection\x20semantics',()=>{it('34a.\x20user-document\x20guardrails:\x20typoed\x20weight,\x20invented\x20rule\x20id,\x20non-enum\x20severity\x20word',()=>{writeUserDoc({'version':0x1,'evaluation':{'weights':{'trust_revews':0x32}}}),getJudgmentDoc(),expect(judgmentStatus()['last_reload_error'])['toContain']('unknown\x20dimension\x20\x27trust_revews\x27'),expect(getJudgmentDoc()['evaluation']['weights']['trust_reviews'])['toBe'](0x23),writeUserDoc({'version':0x1,'rules':{'domains':{'service':{'rules':[{'rule_id':'R-S-9-99','enabled':![]}]}}}}),getJudgmentDoc(),expect(judgmentStatus()['last_reload_error'])['toContain']('unknown\x20rule\x20\x27R-S-9-99\x27'),writeUserDoc({'version':0x1,'evaluation':{'severity_deduction':{'warning':0x19}}}),getJudgmentDoc(),expect(judgmentStatus()['last_reload_error'])['toMatch'](/warning/i),expect(getJudgmentDoc()['evaluation']['severity_deduction']['critical'])['toBe'](0x32);}),it('34b.\x20judgment_set\x20guardrails:\x20type\x20mismatch\x20and\x20unknown\x20path\x20are\x20rejected',()=>{expect(setJudgmentOverride('evaluation.weights.trust_reviews','high')['ok'])['toBe'](![]),expect(setJudgmentOverride('evaluation.weights.does_not_exist',0x1)['ok'])['toBe'](![]),expect(getJudgmentDoc()['evaluation']['weights']['trust_reviews'])['toBe'](0x23);});});
|
|
1
|
+
import{afterEach,beforeEach,describe,expect,it}from'vitest';import{existsSync,mkdtempSync,rmSync,writeFileSync}from'node:fs';import{tmpdir}from'node:os';import{join}from'node:path';import{ENTRYPOINT}from'@wowok/wowok';import{clearJudgmentLayers,clearJudgmentOverride,clearJudgmentOverrides,getJudgmentDoc,judgmentDisableTrace,judgmentLayerError,judgmentStatus,patchUserJudgmentDoc,setJudgmentIndustryOverlay,setJudgmentOverride,setJudgmentPersonaFragment}from'./judgment.js';import{checkUtilRisks}from'../knowledge/util-risk.js';import{appetiteMultiplier,evaluateOutcome,resolveInterests}from'../evaluation/game-strategy.js';import{evaluateArbGame}from'../evaluation/arbitration-game.js';import{registerDemandMatchEvaluation,matchDemandToServices}from'../evaluation/builtins/demand-match.js';import{extractDemandCapability}from'../evaluation/extract.js';import{monitorOrder}from'../customer/order-monitor.js';import{ModeEvaluator}from'../extensions/mode-evaluator.js';import{mergedBaselinesOverlay,registerIndustryBaselines}from'../extensions/industry-layers.js';import{scoreScorecard}from'../strategy/scorecard.js';import{FakeDataPlane}from'../graph/onchain/dataplane.js';import{expandTopology}from'../graph/onchain/expand.js';import{FULL,fullServiceState}from'../graph/onchain/fixtures.js';import{buildViewport}from'../graph/onchain/viewport.js';import{runAnalyzers}from'../graph/onchain/analyze.js';import{EVALUATION_SERVICE_INTENTS,resolveExpansionStrategy,withEvaluationBundle}from'../graph/onchain/strategy.js';import{projectEvaluationFacts}from'../graph/onchain/facts.js';import{evaluateGraphServiceFacts,registerGraphServiceEvaluations}from'../evaluation/builtins/graph-service.js';let configDir;function writeUserDoc(a){writeFileSync(join(configDir,'judgment.json'),JSON['stringify'](a,null,0x2),'utf-8');}beforeEach(()=>{configDir=mkdtempSync(join(tmpdir(),'wowok-config-audit-')),process['env']['WOWOK_CONFIG_DIR']=configDir,registerDemandMatchEvaluation();}),afterEach(()=>{delete process['env']['WOWOK_CONFIG_DIR'];if(existsSync(configDir))rmSync(configDir,{'recursive':!![],'force':!![]});clearJudgmentOverrides(),clearJudgmentLayers();});async function projectFixture(){registerGraphServiceEvaluations();const a=withEvaluationBundle(resolveExpansionStrategy({'intents':[...EVALUATION_SERVICE_INTENTS]})),b=await expandTopology(new FakeDataPlane(fullServiceState()),{'network':ENTRYPOINT['Mainnet'],'seed':FULL['svc'],'edges':a['edges'],'budget':a['budget']}),c=buildViewport(b,FULL['svc'],'neutral');return projectEvaluationFacts(c,FULL['svc'],runAnalyzers(c));}const demandCap=extractDemandCapability({'object':'0xdemand','location':'Shanghai','description':'need\x20a\x20freelance\x20designer'},{'industry':'freelance','price_max':0x96n,'keywords':['design','logo'],'capabilities':{'has_arbitration':!![],'has_refund_path':!![],'has_milestone_nodes':![],'has_compensation_fund':![],'has_wip_verification':!![],'has_messenger':![],'has_buy_guard':![],'has_dynamic_pricing':![],'is_published':!![],'is_paused':![]}}),inRegionService={'object':'0xgood','location':'Shanghai','description':'freelance\x20logo\x20design','sales':[{'price':'100','wip_hash':'abc'}],'arbitrations':['0xarb'],'compensation_fund':'500','bPublished':!![],'bPaused':![]},breakdownOf=(a,b)=>a['breakdown']['find'](c=>c['rule_id']===b);describe('config\x20audit\x20—\x20evaluation\x20section',()=>{it('1.\x20weights.trust_reviews\x20flows\x20into\x20the\x20aggregated\x20trust\x20total\x20(user\x20doc\x20channel)',async()=>{const a=await projectFixture(),b=await evaluateGraphServiceFacts(a);expect(b['trust']['breakdown']['find'](d=>d['rule_id']==='trust_reviews')['weight'])['toBe'](0x23),writeUserDoc({'version':0x1,'evaluation':{'weights':{'trust_reviews':0x46}}});const c=await evaluateGraphServiceFacts(a);expect(c['trust']['breakdown']['find'](d=>d['rule_id']==='trust_reviews')['weight'])['toBe'](0x46),expect(c['trust']['total'])['toBe'](0x2f);}),it('2.\x20severity_deduction.critical\x2050→5\x20lifts\x20the\x20risk-side\x20rule\x20score\x20(session\x20override)',async()=>{const a=await projectFixture(),b=await evaluateGraphServiceFacts(a);expect(b['risk']['breakdown']['find'](d=>d['rule_id']==='risk_fund')['score'])['toBe'](0x19),expect(setJudgmentOverride('evaluation.severity_deduction.critical',0x5))['toEqual']({'ok':!![]});const c=await evaluateGraphServiceFacts(a);expect(c['risk']['breakdown']['find'](d=>d['rule_id']==='risk_fund')['score'])['toBe'](0x46),expect(c['risk']['breakdown']['find'](d=>d['rule_id']==='risk_trust')['score'])['toBe'](0x41),expect(c['risk']['total'])['toBe'](0x56);}),it('3.\x20level_bands\x20first\x20band\x20min\x2085→30\x20flips\x20the\x20level\x20of\x20an\x20unchanged\x20score\x20(session\x20override)',async()=>{const a=await projectFixture(),b=await evaluateGraphServiceFacts(a);expect(b['trust']['total'])['toBe'](0x31),expect(b['trust']['level'])['toBe']('high'),setJudgmentOverride('evaluation.level_bands',[{'min':0x1e,'level':'low'},{'min':0x46,'level':'medium_low'},{'min':0x32,'level':'medium_high'},{'min':0x0,'level':'high'}]);const c=await evaluateGraphServiceFacts(a);expect(c['trust']['total'])['toBe'](0x31),expect(c['trust']['level'])['toBe']('low');}),it('4.\x20grade_words.trust\x20first\x20band\x20min\x2070→20\x20flips\x20the\x20rendered\x20grade\x20word\x20(session\x20override)',async()=>{const a=await projectFixture(),b=await evaluateGraphServiceFacts(a);expect(b['trust']['summary'])['toContain']('grade:\x20weak'),setJudgmentOverride('evaluation.grade_words.trust',[{'min':0x14,'word':'strong'},{'min':0x32,'word':'fair'},{'min':0x0,'word':'weak'}]);const c=await evaluateGraphServiceFacts(a);expect(c['trust']['summary'])['toContain']('grade:\x20strong');}),it('5.\x20dimensions.<id>.label\x20retune\x20reaches\x20the\x20live\x20summary\x20rendering\x20(industry\x20overlay\x20channel)',async()=>{const a=await projectFixture(),b=await evaluateGraphServiceFacts(a);expect(b['trust']['summary'])['toContain']('weakest\x20Fund\x20safety'),setJudgmentIndustryOverlay({'evaluation':{'dimensions':{'trust_fund_safety':{'label':'Fund\x20Cushion','description':'audit\x20retune'}}}},'pack:audit');const c=await evaluateGraphServiceFacts(a);expect(c['trust']['summary'])['toContain']('weakest\x20Fund\x20Cushion'),expect(c['trust']['breakdown']['find'](d=>d['rule_id']==='trust_fund_safety')['dimension'])['toBe']('Fund\x20Cushion');});}),describe('config\x20audit\x20—\x20game\x20section',()=>{it('6.\x20scoring.base\x2060→80\x20lifts\x20every\x20net\x20score\x20(judgment_doc_patch\x20channel)',()=>{expect(evaluateOutcome('refund','customer')['net_score'])['toBe'](0x50);const a=patchUserJudgmentDoc({'game':{'scoring':{'base':0x50}}});expect(a['applied'])['toBe'](!![]),expect(evaluateOutcome('refund','customer')['net_score'])['toBe'](0x64);}),it('7.\x20appetite_multipliers.conservative\x201.5→0.6\x20changes\x20the\x20conservative\x20sensitivity\x20result\x20(session\x20override)',()=>{const a=evaluateOutcome('refund','merchant',{'risk_appetite':'conservative'});expect(a['risk_score'])['toBe'](0x4b),expect(a['net_score'])['toBe'](0x0),setJudgmentOverride('game.appetite_multipliers.conservative',0.6);const b=evaluateOutcome('refund','merchant',{'risk_appetite':'conservative'});expect(b['risk_score'])['toBe'](0x1e),expect(b['net_score'])['toBe'](0x1e),expect(appetiteMultiplier('conservative'))['toBe'](0.6);}),it('8.\x20role_interests.customer.prefer\x20+\x20node_advanced\x20adds\x20a\x20gain\x20(industry\x20overlay\x20channel)',()=>{const a=evaluateOutcome('advance','customer');expect(a['gains'])['toEqual']([]),expect(a['net_score'])['toBe'](0x3c),setJudgmentIndustryOverlay({'game':{'role_interests':{'customer':{'prefer':['fund_returned_to_buyer','node_advanced'],'avoid':[],'sensitivity':0x1}}}},'pack:audit');const b=evaluateOutcome('advance','customer');expect(b['gains'])['toEqual'](['node_advanced']),expect(b['net_score'])['toBe'](0x50);}),it('9.\x20a\x20new\x20keyword_rules\x20entry\x20re-anchors\x20prefer\x20on\x20a\x20matching\x20requirement\x20(user\x20doc\x20channel)',()=>{const a=resolveInterests('system',{'requirements':['please\x20test\x20it']});expect(a['prefer'])['toEqual']([]),writeUserDoc({'version':0x1,'game':{'keyword_rules':[{'id':'kw_audit_testing','keywords':['test'],'effect':'node_advanced','anchor':'prefer','when_forbidden':![]}]}});const b=resolveInterests('system',{'requirements':['please\x20test\x20it']});expect(b['prefer'])['toEqual'](['node_advanced']);}),it('10.\x20forbid_pattern\x20rewritten\x20to\x20a\x20non-matching\x20pattern\x20disarms\x20when_forbidden\x20rules\x20(user\x20doc\x20channel)',()=>{const a=resolveInterests('neutral',{'requirements':['never\x20arbitration']});expect(a['avoid'])['toContain']('arbitration_review_triggered'),writeUserDoc({'version':0x1,'game':{'forbid_pattern':'zzz_never_matches'}});const b=resolveInterests('neutral',{'requirements':['never\x20arbitration']});expect(b['avoid'])['toEqual']([]);});}),describe('config\x20audit\x20—\x20game.arb\x20section\x20(7-state\x20game)',()=>{it('11.\x20arb.scoring.per_gain\x2020→40\x20moves\x20the\x20favorability\x20of\x20a\x201-gain\x20move\x20(session\x20override)',()=>{const a=evaluateArbGame('Voting','arbitrator');expect(a['actions'][0x0]?.['gain_score'])['toBe'](0x14),expect(a['actions'][0x0]?.['favorability'])['toBe'](0x50),setJudgmentOverride('game.arb.scoring.per_gain',0x28);const b=evaluateArbGame('Voting','arbitrator');expect(b['actions'][0x0]?.['gain_score'])['toBe'](0x28),expect(b['actions'][0x0]?.['favorability'])['toBe'](0x64);}),it('12.\x20a\x20new\x20arb\x20keyword_rules\x20entry\x20re-anchors\x20a\x20perspective\x27s\x20prefer\x20(user\x20doc\x20channel)',()=>{const a=evaluateArbGame('Principal_confirming','customer',{'requirements':['expedite\x20please']});expect(a['actions'][0x0]?.['gain_score'])['toBe'](0x0),expect(a['actions'][0x0]?.['favorability'])['toBe'](0x3c),writeUserDoc({'version':0x1,'game':{'arb':{'keyword_rules':[{'id':'arb_kw_audit_expedite','keywords':['expedite'],'effect':'case_advanced','anchor':'prefer','when_forbidden':![]}]}}});const b=evaluateArbGame('Principal_confirming','customer',{'requirements':['expedite\x20please']});expect(b['actions'][0x0]?.['gain_score'])['toBe'](0x14),expect(b['actions'][0x0]?.['favorability'])['toBe'](0x50);});}),describe('config\x20audit\x20—\x20match\x20section',()=>{it('13.\x20region_scores.exact\x20100→50\x20halves\x20the\x20region\x20rule\x20score\x20(session\x20override)',async()=>{const [a]=await matchDemandToServices(demandCap,[inRegionService]);expect(breakdownOf(a['result'],'region')['score'])['toBe'](0x64),setJudgmentOverride('match.region_scores.exact',0x32);const [b]=await matchDemandToServices(demandCap,[inRegionService]);expect(breakdownOf(b['result'],'region')['score'])['toBe'](0x32),expect(b['result']['total'])['toBeLessThan'](a['result']['total']);}),it('14.\x20weights.capabilities\x2030→60\x20raises\x20its\x20renormalized\x20share\x20(session\x20override)',async()=>{const [a]=await matchDemandToServices(demandCap,[inRegionService]);expect(breakdownOf(a['result'],'capabilities')['weight'])['toBe'](0x1e),expect(a['result']['total'])['toBe'](0x49),setJudgmentOverride('match.weights.capabilities',0x3c);const [b]=await matchDemandToServices(demandCap,[inRegionService]);expect(breakdownOf(b['result'],'capabilities')['weight'])['toBe'](0x3c),expect(breakdownOf(b['result'],'region')['weight'])['toBe'](0xf),expect(b['result']['total'])['toBe'](0x4e);}),it('15.\x20trust_bands\x20second\x20band\x20score\x2060→10\x20(extracted\x20trust_score\x20is\x2050\x20→\x20band\x20#2)\x20(session\x20override)',async()=>{const [a]=await matchDemandToServices(demandCap,[inRegionService]);expect(breakdownOf(a['result'],'trust')['score'])['toBe'](0x3c),setJudgmentOverride('match.trust_bands',[{'min':0x4b,'score':0x64},{'min':0x32,'score':0xa},{'min':0x19,'score':0x1e},{'min':0x0,'score':0x0}]);const [b]=await matchDemandToServices(demandCap,[inRegionService]);expect(breakdownOf(b['result'],'trust')['score'])['toBe'](0xa);}),it('16.\x20neutral_score\x2050→10\x20changes\x20unknown-signal\x20scoring\x20(user\x20doc\x20channel)',async()=>{const a=extractDemandCapability({'object':'0xdemand','location':'Shanghai','description':'anything'},{'industry':'freelance','price_max':0x96n,'keywords':[],'capabilities':{'has_arbitration':![],'has_refund_path':![],'has_milestone_nodes':![],'has_compensation_fund':![],'has_wip_verification':![],'has_messenger':![],'has_buy_guard':![],'has_dynamic_pricing':![],'is_published':![],'is_paused':![]}}),[b]=await matchDemandToServices(a,[inRegionService]);expect(breakdownOf(b['result'],'tags')['score'])['toBe'](0x32),writeUserDoc({'version':0x1,'match':{'neutral_score':0xa}});const [c]=await matchDemandToServices(a,[inRegionService]);expect(breakdownOf(c['result'],'tags')['score'])['toBe'](0xa);}),it('17.\x20price_over_budget_tolerance_pct\x2010→100\x20turns\x20a\x20rejection\x20into\x20a\x20partial\x20score\x20(session\x20override)',async()=>{const a={...inRegionService,'object':'0xpricey','sales':[{'price':'200','wip_hash':'x'}]},[b]=await matchDemandToServices(demandCap,[a]);expect(breakdownOf(b['result'],'price')['score'])['toBe'](0x0),setJudgmentOverride('match.price_over_budget_tolerance_pct',0x64);const [c]=await matchDemandToServices(demandCap,[a]);expect(breakdownOf(c['result'],'price')['score'])['toBe'](0x32);}),it('18.\x20top_n\x205→2\x20caps\x20the\x20returned\x20candidate\x20count\x20(session\x20override)',async()=>{const a=[inRegionService,{...inRegionService,'object':'0xb'},{...inRegionService,'object':'0xc'}];expect((await matchDemandToServices(demandCap,a))['length'])['toBe'](0x3),setJudgmentOverride('match.top_n',0x2),expect((await matchDemandToServices(demandCap,a))['length'])['toBe'](0x2);});}),describe('config\x20audit\x20—\x20monitor\x20section',()=>{const a=0x36ee80,b=c=>({'order_id':'0xorder','service_id':'0xservice','created_at':0x64*a,'now':0x64*a,...c});it('19.\x20messenger_timeout_hours\x2024→1\x20surfaces\x20the\x20timeout\x20finding\x20(user\x20doc\x20hot\x20reload)',()=>{const c=b({'last_user_message_at':0x62*a,'has_messenger':!![]});expect(monitorOrder({'current':c})['map'](f=>f['id']))['not']['toContain']('messenger_unanswered'),writeUserDoc({'version':0x1,'monitor':{'thresholds':{'messenger_timeout_hours':0x1}}});const d=monitorOrder({'current':c}),e=d['find'](f=>f['id']==='messenger_unanswered');expect(e?.['severity'])['toBe']('high');}),it('20.\x20escalation.stall_escalation_multiplier\x202→1\x20moves\x20the\x20critical\x20escalation\x20point\x20(session\x20override)',()=>{const c=b({'current_node':'Pay','last_progress_at':0x14*a}),d=monitorOrder({'current':c})['find'](f=>f['id']==='progress_stall');expect(d?.['severity'])['toBe']('high'),setJudgmentOverride('monitor.escalation.stall_escalation_multiplier',0x1);const e=monitorOrder({'current':c})['find'](f=>f['id']==='progress_stall');expect(e?.['severity'])['toBe']('critical');}),it('21.\x20compensation_coverage_min\x201.0→5\x20surfaces\x20the\x20insufficient-coverage\x20finding\x20(session\x20override)',()=>{const c=b({'compensation_balance':0x12cn,'order_amount':0x64n});expect(monitorOrder({'current':c})['map'](e=>e['id']))['not']['toContain']('compensation_insufficient'),setJudgmentOverride('monitor.thresholds.compensation_coverage_min',0x5);const d=monitorOrder({'current':c})['find'](e=>e['id']==='compensation_insufficient');expect(d?.['severity'])['toBe']('high');}),it('22.\x20explicit\x20MonitorThresholds\x20argument\x20wins\x20over\x20the\x20document\x20(caller\x20precedence)',()=>{const c=b({'last_user_message_at':0x62*a,'has_messenger':!![]});setJudgmentOverride('monitor.thresholds.messenger_timeout_hours',0x1),expect(monitorOrder({'current':c})['map'](d=>d['id']))['toContain']('messenger_unanswered'),expect(monitorOrder({'current':c,'thresholds':{'messenger_timeout_hours':0x48}})['map'](d=>d['id']))['not']['toContain']('messenger_unanswered'),clearJudgmentOverride('monitor.thresholds.messenger_timeout_hours');});}),describe('config\x20audit\x20—\x20mode\x20section',()=>{it('23.\x20appetite_thresholds.conservative.max_risk\x2030→99\x20flips\x20the\x20risk\x20recommendation\x20(session\x20override)',()=>{const a={'getCard':f=>({'constraints':{},'risk_profile':{'funds_risk':'medium'}})},b=new ModeEvaluator(a),c={'name':'audit_mode','traits':[],'machine_shape':{},'capabilities_used':['cap_audit'],'risk_appetite':'conservative','risk_constraints':{}},d=b['evaluateMode'](c);expect(d['risk_score'])['toBe'](0x3c),expect(d['recommendations']['join']('\x0a'))['toContain']('exceeds\x20conservative\x20mode\x20threshold\x2030'),setJudgmentOverride('mode.appetite_thresholds.conservative.max_risk',0x63);const e=b['evaluateMode'](c);expect(e['risk_score'])['toBe'](0x3c),expect(e['recommendations']['join']('\x0a'))['not']['toContain']('exceeds');});}),describe('config\x20audit\x20—\x20scorecard\x20section',()=>{function a(c){return{'account':'0xshop','industry':'education','network':'testnet','collected_at':0x0,'metrics':c,'unavailable':[],'errors':[]};}const b=(c,d)=>({'id':c,'source':'market_operations','status':'ok','value':d,'collected_at':0x0});it('24.\x20metrics.order_count.good_threshold\x2020→1\x20drives\x20the\x20metric\x20to\x20full\x20score\x20(session\x20override)',()=>{const d=a([b('order_count',0x1)]),e=scoreScorecard(d,'balanced');expect(e['metric_scores'][0x0]?.['score'])['toBe'](0x0),expect(e['overall'])['toBe'](0x0),setJudgmentOverride('scorecard.metrics.order_count.good_threshold',0x1);const f=scoreScorecard(d,'balanced');expect(f['metric_scores'][0x0]?.['score'])['toBe'](0x64),expect(f['overall'])['toBe'](0x64);}),it('25.\x20metrics.completion_rate.weight\x20posture\x20retune\x20changes\x20the\x20normalized\x20overall\x20(session\x20override)',()=>{const d=a([b('order_count',0x5),b('completion_rate',0.75)]),e=scoreScorecard(d,'margin');expect(e['metric_scores'][0x1]?.['weight'])['toBe'](0.15),expect(e['overall'])['toBe'](0x26),setJudgmentOverride('scorecard.metrics.completion_rate.weight',{'volume':0.15,'balanced':0.2,'margin':0.9});const f=scoreScorecard(d,'margin');expect(f['metric_scores'][0x1]?.['weight'])['toBe'](0.9),expect(f['overall'])['toBe'](0x2f);}),it('26.\x20shop_evidence_metrics\x20cleared\x20→\x20market-only\x20evidence\x20yields\x20a\x20null\x20overall\x20(session\x20override)',()=>{const d=a([b('order_count',0x14),b('supply_demand_ratio',0x2)]),e=scoreScorecard(d,'balanced');expect(e['overall'])['toBe'](0x5e),setJudgmentOverride('scorecard.shop_evidence_metrics',[]);const f=scoreScorecard(d,'balanced');expect(f['overall'])['toBeNull']();});}),describe('config\x20audit\x20—\x20rules\x20section\x20(declarative\x20rule\x20book)',()=>{it('27.\x20a\x20retuned\x20case\x20level\x20low→high\x20changes\x20the\x20finding\x20severity\x20(user\x20doc\x20channel)',()=>{const a=checkUtilRisks({'large_util_import':!![]})['find'](c=>c['id']==='R-UTIL-03');expect(a?.['level'])['toBe']('low'),writeUserDoc({'version':0x1,'rules':{'domains':{'util':{'rules':[{'rule_id':'R-UTIL-03','cases':[{'when':{'field':'large_util_import','op':'eq','value':!![]},'level':'high','title':'AUDIT:\x20util\x20import\x20retuned\x20to\x20high','description':'Audit-rewritten\x20description\x20for\x20R-UTIL-03.'}]}]}}}});const b=checkUtilRisks({'large_util_import':!![]})['find'](c=>c['id']==='R-UTIL-03');expect(b?.['level'])['toBe']('high'),expect(b?.['title'])['toContain']('AUDIT');}),it('28.\x20enabled:false\x20via\x20the\x20industry\x20layer\x20silences\x20the\x20finding\x20AND\x20leaves\x20a\x20disable\x20trace',()=>{expect(checkUtilRisks({'large_util_import':!![],'expects_util_events':!![]})['map'](a=>a['id']))['toEqual'](['R-UTIL-03','R-UTIL-04']),expect(setJudgmentIndustryOverlay({'rules':{'domains':{'util':{'rules':[{'rule_id':'R-UTIL-03','enabled':![]}]}}}},'pack:audit')['ok'])['toBe'](!![]),expect(checkUtilRisks({'large_util_import':!![],'expects_util_events':!![]})['map'](a=>a['id']))['toEqual'](['R-UTIL-04']),expect(judgmentDisableTrace())['toEqual']([{'layer':'pack:audit','domain':'util','rule_id':'R-UTIL-03'}]);}),it('29.\x20case.title/description\x20rewording\x20is\x20visible\x20in\x20the\x20finding\x20text\x20(user\x20doc\x20channel)',()=>{const a=checkUtilRisks({'bcs_manually_synced':!![]})['find'](c=>c['id']==='R-UTIL-05');expect(a?.['title'])['toContain']('SDK\x20BCS\x20structures\x20must\x20stay\x20in\x20sync'),writeUserDoc({'version':0x1,'rules':{'domains':{'util':{'rules':[{'rule_id':'R-UTIL-05','cases':[{'when':{'field':'bcs_manually_synced','op':'eq','value':!![]},'level':'medium','title':'AUDIT:\x20hand-maintained\x20BCS\x20layouts\x20drift\x20from\x20Move\x20structs','description':'Audit-rewritten\x20description\x20for\x20R-UTIL-05.'}]}]}}}});const b=checkUtilRisks({'bcs_manually_synced':!![]})['find'](c=>c['id']==='R-UTIL-05');expect(b?.['title'])['toContain']('AUDIT:\x20hand-maintained\x20BCS'),expect(b?.['description'])['toContain']('Audit-rewritten\x20description\x20for\x20R-UTIL-05.');});}),describe('config\x20audit\x20—\x20layer\x20chain\x20and\x20composition',()=>{it('30.\x20precedence\x20chain:\x20industry\x20X=61\x20<\x20user\x20doc\x20X=63\x20<\x20persona\x20X=62,\x20unwinding\x20in\x20reverse',()=>{expect(getJudgmentDoc()['game']['scoring']['base'])['toBe'](0x3c),setJudgmentIndustryOverlay({'game':{'scoring':{'base':0x3d}}},'pack:x'),expect(getJudgmentDoc()['game']['scoring']['base'])['toBe'](0x3d),writeUserDoc({'version':0x1,'game':{'scoring':{'base':0x3f}}}),expect(getJudgmentDoc()['game']['scoring']['base'])['toBe'](0x3f),setJudgmentPersonaFragment({'game':{'scoring':{'base':0x3e}}},'persona:y'),expect(getJudgmentDoc()['game']['scoring']['base'])['toBe'](0x3e),expect(evaluateOutcome('refund','customer')['net_score'])['toBe'](0x52),rmSync(join(configDir,'judgment.json')),expect(getJudgmentDoc()['game']['scoring']['base'])['toBe'](0x3e),setJudgmentPersonaFragment(null),expect(getJudgmentDoc()['game']['scoring']['base'])['toBe'](0x3d),setJudgmentIndustryOverlay(null),expect(getJudgmentDoc()['game']['scoring']['base'])['toBe'](0x3c);}),it('31.\x20mergedBaselinesOverlay:\x20the\x20later\x20industry\x20in\x20the\x20list\x20wins,\x20and\x20the\x20merged\x20overlay\x20drives\x20the\x20engine',()=>{registerIndustryBaselines({'category':'audit-a','fragment':{'monitor':{'thresholds':{'messenger_timeout_hours':0x1}}}}),registerIndustryBaselines({'category':'audit-b','fragment':{'monitor':{'thresholds':{'messenger_timeout_hours':0x2}}}});const a=mergedBaselinesOverlay(['audit-a','audit-b']);expect(a['monitor']?.['thresholds']?.['messenger_timeout_hours'])['toBe'](0x2),expect(setJudgmentIndustryOverlay(mergedBaselinesOverlay(['audit-a','audit-b']),'merged:audit')['ok'])['toBe'](!![]),expect(getJudgmentDoc()['monitor']['thresholds']['messenger_timeout_hours'])['toBe'](0x2);const b=0x36ee80,c={'order_id':'0xorder','service_id':'0xs','created_at':0x64*b,'now':0x64*b,'last_user_message_at':98.5*b,'has_messenger':!![]};expect(monitorOrder({'current':c})['map'](d=>d['id']))['not']['toContain']('messenger_unanswered');}),it('32.\x20an\x20invalid\x20persona\x20fragment\x20is\x20rejected,\x20the\x20layer\x20error\x20is\x20visible,\x20the\x20last\x20good\x20stays\x20in\x20force',()=>{expect(setJudgmentPersonaFragment({'game':{'scoring':{'base':0x46}}},'persona:audit')['ok'])['toBe'](!![]),expect(getJudgmentDoc()['game']['scoring']['base'])['toBe'](0x46);const a=setJudgmentPersonaFragment({'game':{'scoring':{'bse':0x1}}},'persona:audit');expect(a['ok'])['toBe'](![]),expect(judgmentLayerError('persona'))['toContain']('bse'),expect(judgmentStatus()['layer_errors']['persona'])['toContain']('bse'),expect(getJudgmentDoc()['game']['scoring']['base'])['toBe'](0x46);}),it('33.\x20severity_deduction\x20×\x20level_bands\x20combo:\x20a\x20big\x20deduction\x20pushes\x20the\x20score\x20across\x20a\x20band\x20boundary',async()=>{const a=await projectFixture(),b=await evaluateGraphServiceFacts(a);expect(b['risk']['total'])['toBe'](0x4a),expect(b['risk']['level'])['toBe']('medium_low'),setJudgmentOverride('evaluation.severity_deduction.high',0x50);const c=await evaluateGraphServiceFacts(a);expect(c['risk']['total'])['toBe'](0x39),expect(c['risk']['level'])['toBe']('medium_high');});}),describe('config\x20audit\x20—\x20rejection\x20semantics',()=>{it('34a.\x20user-document\x20guardrails:\x20typoed\x20weight,\x20invented\x20rule\x20id,\x20non-enum\x20severity\x20word',()=>{writeUserDoc({'version':0x1,'evaluation':{'weights':{'trust_revews':0x32}}}),getJudgmentDoc(),expect(judgmentStatus()['last_reload_error'])['toContain']('unknown\x20dimension\x20\x27trust_revews\x27'),expect(getJudgmentDoc()['evaluation']['weights']['trust_reviews'])['toBe'](0x23),writeUserDoc({'version':0x1,'rules':{'domains':{'service':{'rules':[{'rule_id':'R-S-9-99','enabled':![]}]}}}}),getJudgmentDoc(),expect(judgmentStatus()['last_reload_error'])['toContain']('unknown\x20rule\x20\x27R-S-9-99\x27'),writeUserDoc({'version':0x1,'evaluation':{'severity_deduction':{'warning':0x19}}}),getJudgmentDoc(),expect(judgmentStatus()['last_reload_error'])['toMatch'](/warning/i),expect(getJudgmentDoc()['evaluation']['severity_deduction']['critical'])['toBe'](0x32);}),it('34b.\x20judgment_set\x20guardrails:\x20type\x20mismatch\x20and\x20unknown\x20path\x20are\x20rejected',()=>{expect(setJudgmentOverride('evaluation.weights.trust_reviews','high')['ok'])['toBe'](![]),expect(setJudgmentOverride('evaluation.weights.does_not_exist',0x1)['ok'])['toBe'](![]),expect(getJudgmentDoc()['evaluation']['weights']['trust_reviews'])['toBe'](0x23);});});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function isPlainObject(a){return typeof a==='object'&&a!==null&&!Array['isArray'](a);}export function matchPolicyWarnings(a,b){const c=[];if(!isPlainObject(b))return c;const d=isPlainObject(b['weights'])?Object['entries'](b['weights'])['filter'](([,f])=>typeof f==='number'):[];if(d['length']>0x0){for(const [f,g]of d){g===0x0&&c['push'](a+'.weights.\x27'+f+'\x27\x20=\x200\x20—\x20the\x20rule\x20contributes\x20nothing\x20to\x20the\x20score\x20(effectively\x20disabled).\x20Remove\x20the\x20entry\x20or\x20give\x20it\x20a\x20positive\x20weight\x20if\x20you\x20meant\x20it\x20to\x20count.');}if(d['length']>=0x2){const h=[...d]['sort']((l,m)=>m[0x1]-l[0x1]),[i,j]=h[0x0],k=h[0x1][0x1];j>0x0&&k>=0x0&&j>k*0x5&&c['push'](a+'.weights.\x27'+i+'\x27\x20('+j+')\x20is\x20more\x20than\x205x\x20the\x20next\x20largest\x20('+k+')\x20—\x20the\x20ranking\x20is\x20dominated\x20by\x20one\x20rule;\x20the\x20others\x20barely\x20move\x20the\x20order.\x20Balance\x20the\x20weights\x20if\x20that\x20is\x20not\x20intended.');}}b['unknown_policy']==='drop'&&c['push'](a+'.unknown_policy\x20=\x20\x27drop\x27\x20—\x20candidates\x20whose\x20gate\x20inputs\x20are\x20missing\x20are\x20silently\x20discarded\x20(recall\x20loss).\x20Use\x20\x27neutral_score\x27\x20(the\x20default)\x20unless\x20you\x20really\x20want\x20them\x20gone.');const e=b['output'];return isPlainObject(e)&&typeof e['top_n']==='number'&&Number['isFinite'](e['top_n'])&&e['top_n']>0xc8&&c['push'](a+'.output.top_n\x20=\x20'+e['top_n']+'\x20—\x20very\x20large\x20result\x20lists\x20slow\x20every\x20matching\x20call;\x20>200\x20is\x20rarely\x20useful\x20(cap\x20is\x20500).'),c;}export function judgmentDocWarnings(a){const b=[],c=(d,e)=>{if(Array['isArray'](d)){d['forEach']((g,h)=>c(g,e+'['+h+']'));return;}if(!isPlainObject(d))return;const f=isPlainObject(d['weights'])||d['unknown_policy']!==undefined||isPlainObject(d['output'])&&d['output']['top_n']!==undefined;if(f)b['push'](...matchPolicyWarnings(e||'(root)',d));for(const [g,h]of Object['entries'](d))c(h,e?e+'.'+g:g);};return c(a,''),b;}
|
|
@@ -31,9 +31,9 @@ export declare const GainPathDataSchema: z.ZodObject<{
|
|
|
31
31
|
}>;
|
|
32
32
|
path: z.ZodString;
|
|
33
33
|
viability: z.ZodUnion<readonly [z.ZodEnum<{
|
|
34
|
+
blocked: "blocked";
|
|
34
35
|
viable: "viable";
|
|
35
36
|
conditional: "conditional";
|
|
36
|
-
blocked: "blocked";
|
|
37
37
|
unverifiable: "unverifiable";
|
|
38
38
|
}>, z.ZodString]>;
|
|
39
39
|
gate: z.ZodString;
|
|
@@ -63,9 +63,9 @@ export declare const ExposureFragmentSchema: z.ZodObject<{
|
|
|
63
63
|
}>;
|
|
64
64
|
path: z.ZodString;
|
|
65
65
|
viability: z.ZodUnion<readonly [z.ZodEnum<{
|
|
66
|
+
blocked: "blocked";
|
|
66
67
|
viable: "viable";
|
|
67
68
|
conditional: "conditional";
|
|
68
|
-
blocked: "blocked";
|
|
69
69
|
unverifiable: "unverifiable";
|
|
70
70
|
}>, z.ZodString]>;
|
|
71
71
|
gate: z.ZodString;
|
|
@@ -35,6 +35,10 @@ export declare const EvaluationSectionSchema: z.ZodObject<{
|
|
|
35
35
|
min: z.ZodNumber;
|
|
36
36
|
word: z.ZodString;
|
|
37
37
|
}, z.core.$strict>>;
|
|
38
|
+
match: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
39
|
+
min: z.ZodNumber;
|
|
40
|
+
word: z.ZodString;
|
|
41
|
+
}, z.core.$strict>>>;
|
|
38
42
|
}, z.core.$strict>;
|
|
39
43
|
}, z.core.$strict>;
|
|
40
44
|
export declare const EvaluationSectionInputSchema: z.ZodObject<{
|
|
@@ -59,6 +63,10 @@ export declare const EvaluationSectionInputSchema: z.ZodObject<{
|
|
|
59
63
|
min: z.ZodNumber;
|
|
60
64
|
word: z.ZodString;
|
|
61
65
|
}, z.core.$strict>>>;
|
|
66
|
+
match: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
67
|
+
min: z.ZodNumber;
|
|
68
|
+
word: z.ZodString;
|
|
69
|
+
}, z.core.$strict>>>;
|
|
62
70
|
}, z.core.$strict>>;
|
|
63
71
|
}, z.core.$strict>;
|
|
64
72
|
export declare const ArbGameSectionSchema: z.ZodObject<{
|
|
@@ -236,6 +244,7 @@ export declare const MatchSectionSchema: z.ZodObject<{
|
|
|
236
244
|
price: z.ZodNumber;
|
|
237
245
|
trust: z.ZodNumber;
|
|
238
246
|
capabilities: z.ZodNumber;
|
|
247
|
+
buyable: z.ZodNumber;
|
|
239
248
|
tags: z.ZodNumber;
|
|
240
249
|
acceptance: z.ZodNumber;
|
|
241
250
|
}, z.core.$strict>;
|
|
@@ -262,6 +271,7 @@ export declare const MatchSectionInputSchema: z.ZodObject<{
|
|
|
262
271
|
price: z.ZodOptional<z.ZodNumber>;
|
|
263
272
|
trust: z.ZodOptional<z.ZodNumber>;
|
|
264
273
|
capabilities: z.ZodOptional<z.ZodNumber>;
|
|
274
|
+
buyable: z.ZodOptional<z.ZodNumber>;
|
|
265
275
|
tags: z.ZodOptional<z.ZodNumber>;
|
|
266
276
|
acceptance: z.ZodOptional<z.ZodNumber>;
|
|
267
277
|
}, z.core.$strict>>;
|
|
@@ -456,9 +466,9 @@ export declare const RulesSectionSchema: z.ZodObject<{
|
|
|
456
466
|
}>;
|
|
457
467
|
path: z.ZodString;
|
|
458
468
|
viability: z.ZodUnion<readonly [z.ZodEnum<{
|
|
469
|
+
blocked: "blocked";
|
|
459
470
|
viable: "viable";
|
|
460
471
|
conditional: "conditional";
|
|
461
|
-
blocked: "blocked";
|
|
462
472
|
unverifiable: "unverifiable";
|
|
463
473
|
}>, z.ZodString]>;
|
|
464
474
|
gate: z.ZodString;
|
|
@@ -518,9 +528,9 @@ export declare const RulesSectionInputSchema: z.ZodObject<{
|
|
|
518
528
|
}>;
|
|
519
529
|
path: z.ZodString;
|
|
520
530
|
viability: z.ZodUnion<readonly [z.ZodEnum<{
|
|
531
|
+
blocked: "blocked";
|
|
521
532
|
viable: "viable";
|
|
522
533
|
conditional: "conditional";
|
|
523
|
-
blocked: "blocked";
|
|
524
534
|
unverifiable: "unverifiable";
|
|
525
535
|
}>, z.ZodString]>;
|
|
526
536
|
gate: z.ZodString;
|
|
@@ -568,6 +578,10 @@ export declare const JudgmentDocSchema: z.ZodObject<{
|
|
|
568
578
|
min: z.ZodNumber;
|
|
569
579
|
word: z.ZodString;
|
|
570
580
|
}, z.core.$strict>>;
|
|
581
|
+
match: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
582
|
+
min: z.ZodNumber;
|
|
583
|
+
word: z.ZodString;
|
|
584
|
+
}, z.core.$strict>>>;
|
|
571
585
|
}, z.core.$strict>;
|
|
572
586
|
}, z.core.$strict>;
|
|
573
587
|
game: z.ZodObject<{
|
|
@@ -640,6 +654,7 @@ export declare const JudgmentDocSchema: z.ZodObject<{
|
|
|
640
654
|
price: z.ZodNumber;
|
|
641
655
|
trust: z.ZodNumber;
|
|
642
656
|
capabilities: z.ZodNumber;
|
|
657
|
+
buyable: z.ZodNumber;
|
|
643
658
|
tags: z.ZodNumber;
|
|
644
659
|
acceptance: z.ZodNumber;
|
|
645
660
|
}, z.core.$strict>;
|
|
@@ -742,9 +757,9 @@ export declare const JudgmentDocSchema: z.ZodObject<{
|
|
|
742
757
|
}>;
|
|
743
758
|
path: z.ZodString;
|
|
744
759
|
viability: z.ZodUnion<readonly [z.ZodEnum<{
|
|
760
|
+
blocked: "blocked";
|
|
745
761
|
viable: "viable";
|
|
746
762
|
conditional: "conditional";
|
|
747
|
-
blocked: "blocked";
|
|
748
763
|
unverifiable: "unverifiable";
|
|
749
764
|
}>, z.ZodString]>;
|
|
750
765
|
gate: z.ZodString;
|
|
@@ -809,6 +824,10 @@ export declare const JudgmentDocInputSchema: z.ZodObject<{
|
|
|
809
824
|
min: z.ZodNumber;
|
|
810
825
|
word: z.ZodString;
|
|
811
826
|
}, z.core.$strict>>>;
|
|
827
|
+
match: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
828
|
+
min: z.ZodNumber;
|
|
829
|
+
word: z.ZodString;
|
|
830
|
+
}, z.core.$strict>>>;
|
|
812
831
|
}, z.core.$strict>>;
|
|
813
832
|
}, z.core.$strict>>;
|
|
814
833
|
game: z.ZodOptional<z.ZodObject<{
|
|
@@ -881,6 +900,7 @@ export declare const JudgmentDocInputSchema: z.ZodObject<{
|
|
|
881
900
|
price: z.ZodOptional<z.ZodNumber>;
|
|
882
901
|
trust: z.ZodOptional<z.ZodNumber>;
|
|
883
902
|
capabilities: z.ZodOptional<z.ZodNumber>;
|
|
903
|
+
buyable: z.ZodOptional<z.ZodNumber>;
|
|
884
904
|
tags: z.ZodOptional<z.ZodNumber>;
|
|
885
905
|
acceptance: z.ZodOptional<z.ZodNumber>;
|
|
886
906
|
}, z.core.$strict>>;
|
|
@@ -983,9 +1003,9 @@ export declare const JudgmentDocInputSchema: z.ZodObject<{
|
|
|
983
1003
|
}>;
|
|
984
1004
|
path: z.ZodString;
|
|
985
1005
|
viability: z.ZodUnion<readonly [z.ZodEnum<{
|
|
1006
|
+
blocked: "blocked";
|
|
986
1007
|
viable: "viable";
|
|
987
1008
|
conditional: "conditional";
|
|
988
|
-
blocked: "blocked";
|
|
989
1009
|
unverifiable: "unverifiable";
|
|
990
1010
|
}>, z.ZodString]>;
|
|
991
1011
|
gate: z.ZodString;
|
|
@@ -1051,6 +1071,7 @@ export declare const JudgmentFragmentSchema: z.ZodObject<{
|
|
|
1051
1071
|
price: z.ZodOptional<z.ZodNumber>;
|
|
1052
1072
|
trust: z.ZodOptional<z.ZodNumber>;
|
|
1053
1073
|
capabilities: z.ZodOptional<z.ZodNumber>;
|
|
1074
|
+
buyable: z.ZodOptional<z.ZodNumber>;
|
|
1054
1075
|
tags: z.ZodOptional<z.ZodNumber>;
|
|
1055
1076
|
acceptance: z.ZodOptional<z.ZodNumber>;
|
|
1056
1077
|
}, z.core.$strict>>;
|
|
@@ -1106,9 +1127,9 @@ export declare const JudgmentFragmentSchema: z.ZodObject<{
|
|
|
1106
1127
|
}>;
|
|
1107
1128
|
path: z.ZodString;
|
|
1108
1129
|
viability: z.ZodUnion<readonly [z.ZodEnum<{
|
|
1130
|
+
blocked: "blocked";
|
|
1109
1131
|
viable: "viable";
|
|
1110
1132
|
conditional: "conditional";
|
|
1111
|
-
blocked: "blocked";
|
|
1112
1133
|
unverifiable: "unverifiable";
|
|
1113
1134
|
}>, z.ZodString]>;
|
|
1114
1135
|
gate: z.ZodString;
|
|
@@ -1147,6 +1168,10 @@ export declare const JudgmentFragmentSchema: z.ZodObject<{
|
|
|
1147
1168
|
min: z.ZodNumber;
|
|
1148
1169
|
word: z.ZodString;
|
|
1149
1170
|
}, z.core.$strict>>>;
|
|
1171
|
+
match: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1172
|
+
min: z.ZodNumber;
|
|
1173
|
+
word: z.ZodString;
|
|
1174
|
+
}, z.core.$strict>>>;
|
|
1150
1175
|
}, z.core.$strict>>;
|
|
1151
1176
|
}, z.core.$strict>>;
|
|
1152
1177
|
game: z.ZodOptional<z.ZodObject<{
|
|
@@ -1359,5 +1384,6 @@ export interface JudgmentDocPatchResult {
|
|
|
1359
1384
|
version: number;
|
|
1360
1385
|
changed: JudgmentDocPatchChange[];
|
|
1361
1386
|
reload_error: string | null;
|
|
1387
|
+
warnings: string[];
|
|
1362
1388
|
}
|
|
1363
1389
|
export declare function patchUserJudgmentDoc(patch: unknown): JudgmentDocPatchResult;
|