@wowok/agent-mcp 3.1.3 → 3.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config/config-audit.spec.d.ts +1 -0
- package/dist/config/config-audit.spec.js +1 -0
- package/dist/config/exposure.d.ts +108 -0
- package/dist/config/exposure.js +1 -0
- package/dist/config/index.d.ts +2 -0
- package/dist/config/index.js +1 -1
- package/dist/config/judgment.d.ts +1228 -0
- package/dist/config/judgment.js +1 -0
- package/dist/config/judgment.spec.d.ts +1 -0
- package/dist/config/judgment.spec.js +1 -0
- package/dist/config/rule-engine.d.ts +299 -0
- package/dist/config/rule-engine.js +1 -0
- package/dist/config/rule-engine.spec.d.ts +1 -0
- package/dist/config/rule-engine.spec.js +1 -0
- package/dist/config/severity.d.ts +7 -0
- package/dist/config/severity.js +1 -0
- package/dist/customer/order-monitor.d.ts +3 -1
- package/dist/customer/order-monitor.js +1 -1
- package/dist/evaluation/acceptance.d.ts +1 -0
- package/dist/evaluation/acceptance.js +1 -1
- package/dist/evaluation/arbitration-game.js +1 -1
- package/dist/evaluation/builtins/demand-match.js +1 -1
- package/dist/evaluation/builtins/graph-service.js +1 -1
- package/dist/evaluation/builtins/graph-service.spec.js +1 -1
- package/dist/evaluation/engine.js +1 -1
- package/dist/evaluation/game-strategy.d.ts +2 -2
- package/dist/evaluation/game-strategy.js +1 -1
- package/dist/evaluation/match-operation.d.ts +2 -2
- package/dist/evaluation/match-operation.js +1 -1
- package/dist/evaluation/standards.d.ts +3 -25
- package/dist/evaluation/standards.js +1 -1
- package/dist/evaluation/types.d.ts +2 -1
- package/dist/experience/realtime-feedback.js +1 -1
- package/dist/extensions/business-modules.js +1 -1
- package/dist/extensions/custom-registry-file.js +1 -1
- package/dist/extensions/industry-audit.spec.d.ts +1 -0
- package/dist/extensions/industry-audit.spec.js +1 -0
- package/dist/extensions/industry-layers.d.ts +8 -0
- package/dist/extensions/industry-layers.js +1 -1
- package/dist/extensions/industry-pack.d.ts +2 -0
- package/dist/extensions/industry-pack.js +1 -1
- package/dist/extensions/mode-evaluator.js +1 -1
- package/dist/extensions/modes.js +1 -1
- package/dist/graph/onchain/analyze.d.ts +3 -1
- package/dist/graph/onchain/analyze.js +1 -1
- package/dist/graph/onchain/analyze.spec.js +1 -1
- package/dist/graph/onchain/edge-schema.d.ts +1 -0
- package/dist/graph/onchain/edge-schema.js +1 -1
- package/dist/graph/onchain/expand.js +1 -1
- package/dist/graph/onchain/exploration.d.ts +28 -0
- package/dist/graph/onchain/exploration.js +1 -0
- package/dist/graph/onchain/exploration.spec.d.ts +1 -0
- package/dist/graph/onchain/exploration.spec.js +1 -0
- package/dist/graph/onchain/exposure.d.ts +18 -0
- package/dist/graph/onchain/exposure.js +1 -0
- package/dist/graph/onchain/exposure.spec.d.ts +1 -0
- package/dist/graph/onchain/exposure.spec.js +1 -0
- package/dist/graph/onchain/graph-policy.spec.d.ts +1 -0
- package/dist/graph/onchain/graph-policy.spec.js +1 -0
- package/dist/graph/onchain/index.d.ts +6 -0
- package/dist/graph/onchain/index.js +1 -1
- package/dist/graph/onchain/interest.js +1 -1
- package/dist/graph/onchain/interest.spec.js +1 -1
- package/dist/graph/onchain/names.js +1 -1
- package/dist/graph/onchain/names.spec.js +1 -1
- package/dist/graph/onchain/policy.d.ts +8 -0
- package/dist/graph/onchain/policy.js +1 -0
- package/dist/graph/onchain/proposal-graph.js +1 -1
- package/dist/graph/onchain/proposal-graph.spec.js +1 -1
- package/dist/graph/onchain/synthesis.d.ts +20 -0
- package/dist/graph/onchain/synthesis.js +1 -0
- package/dist/graph/onchain/synthesis.spec.d.ts +1 -0
- package/dist/graph/onchain/synthesis.spec.js +1 -0
- package/dist/graph/onchain/types.d.ts +11 -1
- package/dist/keeper/keeper.spec.js +1 -1
- package/dist/knowledge/alloc-audit-policy.spec.d.ts +1 -0
- package/dist/knowledge/alloc-audit-policy.spec.js +1 -0
- package/dist/knowledge/allocation-ledger.js +1 -1
- package/dist/knowledge/allocation-puzzle.d.ts +1 -1
- package/dist/knowledge/allocation-puzzle.js +1 -1
- package/dist/knowledge/allocation-risk.d.ts +4 -1
- package/dist/knowledge/allocation-risk.js +1 -1
- package/dist/knowledge/allocation-templates.js +1 -1
- package/dist/knowledge/arb-risk.d.ts +6 -5
- package/dist/knowledge/arb-risk.js +1 -1
- package/dist/knowledge/arbitration-ledger.d.ts +4 -4
- package/dist/knowledge/arbitration-ledger.js +1 -1
- package/dist/knowledge/arbitration-puzzle.d.ts +1 -1
- package/dist/knowledge/arbitration-puzzle.js +1 -1
- package/dist/knowledge/arbitration-risk.d.ts +4 -1
- package/dist/knowledge/arbitration-risk.js +1 -1
- package/dist/knowledge/arbitration-templates.js +1 -1
- package/dist/knowledge/baselines/judgment-baselines.json +289 -0
- package/dist/knowledge/baselines/risk-baselines.spec.js +1 -1
- package/dist/knowledge/baselines/rules/alloc_audit.json +290 -0
- package/dist/knowledge/baselines/rules/allocation.json +492 -0
- package/dist/knowledge/baselines/rules/arb.json +155 -0
- package/dist/knowledge/baselines/rules/arbitration.json +366 -0
- package/dist/knowledge/baselines/rules/bridge.json +197 -0
- package/dist/knowledge/baselines/rules/contact.json +152 -0
- package/dist/knowledge/baselines/rules/demand.json +158 -0
- package/dist/knowledge/baselines/rules/graph.json +453 -0
- package/dist/knowledge/baselines/rules/guard.json +981 -0
- package/dist/knowledge/baselines/rules/machine.json +706 -0
- package/dist/knowledge/baselines/rules/order.json +549 -0
- package/dist/knowledge/baselines/rules/payment.json +205 -0
- package/dist/knowledge/baselines/rules/permission.json +330 -0
- package/dist/knowledge/baselines/rules/personal.json +139 -0
- package/dist/knowledge/baselines/rules/progress.json +346 -0
- package/dist/knowledge/baselines/rules/proof.json +158 -0
- package/dist/knowledge/baselines/rules/registrar.json +159 -0
- package/dist/knowledge/baselines/rules/repository.json +244 -0
- package/dist/knowledge/baselines/rules/resource.json +117 -0
- package/dist/knowledge/baselines/rules/reward.json +471 -0
- package/dist/knowledge/baselines/rules/service.json +595 -0
- package/dist/knowledge/baselines/rules/treasury.json +440 -0
- package/dist/knowledge/baselines/rules/util.json +101 -0
- package/dist/knowledge/bridge-risk.d.ts +6 -5
- package/dist/knowledge/bridge-risk.js +1 -1
- package/dist/knowledge/builtin-templates.d.ts +26 -0
- package/dist/knowledge/builtin-templates.js +1 -0
- package/dist/knowledge/contact-risk.d.ts +6 -5
- package/dist/knowledge/contact-risk.js +1 -1
- package/dist/knowledge/demand-risk.d.ts +6 -5
- package/dist/knowledge/demand-risk.js +1 -1
- package/dist/knowledge/event-semantics.js +1 -1
- package/dist/knowledge/facts-sync.spec.d.ts +1 -0
- package/dist/knowledge/facts-sync.spec.js +1 -0
- package/dist/knowledge/getting-started.js +1 -1
- package/dist/knowledge/guard-design-patterns.js +1 -1
- package/dist/knowledge/guard-field-cognition.d.ts +1 -1
- package/dist/knowledge/guard-field-cognition.js +1 -1
- package/dist/knowledge/guard-ledger.js +1 -1
- package/dist/knowledge/guard-risk.d.ts +4 -1
- package/dist/knowledge/guard-risk.js +1 -1
- package/dist/knowledge/guard-templates.js +1 -1
- package/dist/knowledge/guard-translation.js +1 -1
- package/dist/knowledge/index.d.ts +10 -2
- package/dist/knowledge/index.js +1 -1
- package/dist/knowledge/industry-registry.js +1 -1
- package/dist/knowledge/industry-strategy.js +1 -1
- package/dist/knowledge/jsonrpc-enum.js +1 -1
- package/dist/knowledge/machine-ledger.js +1 -1
- package/dist/knowledge/machine-risk.d.ts +4 -1
- package/dist/knowledge/machine-risk.js +1 -1
- package/dist/knowledge/machine-templates.js +1 -1
- package/dist/knowledge/machine-translation.js +1 -1
- package/dist/knowledge/migration-preflight.js +1 -1
- package/dist/knowledge/operation-dictionary.js +1 -1
- package/dist/knowledge/order-ledger.js +1 -1
- package/dist/knowledge/order-puzzle.d.ts +3 -3
- package/dist/knowledge/order-puzzle.js +1 -1
- package/dist/knowledge/order-risk.d.ts +6 -3
- package/dist/knowledge/order-risk.js +1 -1
- package/dist/knowledge/order-templates.js +1 -1
- package/dist/knowledge/passport-ledger.js +1 -1
- package/dist/knowledge/passport-templates.js +1 -1
- package/dist/knowledge/payment-risk.d.ts +8 -6
- package/dist/knowledge/payment-risk.js +1 -1
- package/dist/knowledge/payment-tracker.js +1 -1
- package/dist/knowledge/permission-ledger.js +1 -1
- package/dist/knowledge/permission-puzzle.d.ts +12 -12
- package/dist/knowledge/permission-puzzle.js +1 -1
- package/dist/knowledge/permission-risk.d.ts +4 -7
- package/dist/knowledge/permission-risk.js +1 -1
- package/dist/knowledge/permission-templates.js +1 -1
- package/dist/knowledge/personal-risk.d.ts +6 -5
- package/dist/knowledge/personal-risk.js +1 -1
- package/dist/knowledge/progress-ledger.js +1 -1
- package/dist/knowledge/progress-puzzle.d.ts +2 -2
- package/dist/knowledge/progress-puzzle.js +1 -1
- package/dist/knowledge/progress-risk.d.ts +4 -1
- package/dist/knowledge/progress-risk.js +1 -1
- package/dist/knowledge/progress-templates.js +1 -1
- package/dist/knowledge/proof-risk.d.ts +6 -5
- package/dist/knowledge/proof-risk.js +1 -1
- package/dist/knowledge/puzzle-projections.js +1 -1
- package/dist/knowledge/recipient-constraint.d.ts +20 -1
- package/dist/knowledge/recipient-constraint.js +1 -1
- package/dist/knowledge/registrar-risk.d.ts +6 -5
- package/dist/knowledge/registrar-risk.js +1 -1
- package/dist/knowledge/repository-risk.d.ts +7 -6
- package/dist/knowledge/repository-risk.js +1 -1
- package/dist/knowledge/resource-risk.d.ts +6 -5
- package/dist/knowledge/resource-risk.js +1 -1
- package/dist/knowledge/reward-ledger.d.ts +1 -1
- package/dist/knowledge/reward-ledger.js +1 -1
- package/dist/knowledge/reward-puzzle.d.ts +2 -2
- package/dist/knowledge/reward-puzzle.js +1 -1
- package/dist/knowledge/reward-risk.d.ts +4 -1
- package/dist/knowledge/reward-risk.js +1 -1
- package/dist/knowledge/rule-node-analyzers.spec.js +1 -1
- package/dist/knowledge/rule-outcome.js +1 -1
- package/dist/knowledge/scenario-modes.d.ts +2 -2
- package/dist/knowledge/scenario-modes.js +1 -1
- package/dist/knowledge/scenario-topology.js +1 -1
- package/dist/knowledge/service-allocator-audit-node.js +1 -1
- package/dist/knowledge/service-ledger.js +1 -1
- package/dist/knowledge/service-puzzle.d.ts +2 -2
- package/dist/knowledge/service-puzzle.js +1 -1
- package/dist/knowledge/service-risk-node.js +1 -1
- package/dist/knowledge/service-risk.d.ts +4 -1
- package/dist/knowledge/service-risk.js +1 -1
- package/dist/knowledge/service-templates.js +1 -1
- package/dist/knowledge/strategy-manuals.d.ts +1 -1
- package/dist/knowledge/strategy-manuals.js +1 -1
- package/dist/knowledge/template-loader.d.ts +84 -0
- package/dist/knowledge/template-loader.js +1 -0
- package/dist/knowledge/template-loader.spec.d.ts +1 -0
- package/dist/knowledge/template-loader.spec.js +1 -0
- package/dist/knowledge/template-registry.js +1 -1
- package/dist/knowledge/template-scanner.d.ts +17 -0
- package/dist/knowledge/template-scanner.js +1 -0
- package/dist/knowledge/template-scanner.spec.d.ts +1 -0
- package/dist/knowledge/template-scanner.spec.js +1 -0
- package/dist/knowledge/tools-reference.js +1 -1
- package/dist/knowledge/treasury-ledger.d.ts +1 -1
- package/dist/knowledge/treasury-ledger.js +1 -1
- package/dist/knowledge/treasury-puzzle.d.ts +3 -3
- package/dist/knowledge/treasury-puzzle.js +1 -1
- package/dist/knowledge/treasury-risk.d.ts +4 -1
- package/dist/knowledge/treasury-risk.js +1 -1
- package/dist/knowledge/treasury-templates.js +1 -1
- package/dist/knowledge/util-risk.d.ts +6 -5
- package/dist/knowledge/util-risk.js +1 -1
- package/dist/knowledge/workflow-guidance.d.ts +4 -0
- package/dist/knowledge/workflow-guidance.js +1 -1
- package/dist/knowledge/workspace-lists.js +1 -1
- package/dist/monitor/MonitorLoop.js +1 -1
- package/dist/participation/arbitrator-interest.js +1 -1
- package/dist/participation/radar-core.js +1 -1
- package/dist/persona/analyzer.js +1 -1
- package/dist/persona/index.js +1 -1
- package/dist/persona/model.js +1 -1
- package/dist/persona/persona-audit.spec.d.ts +1 -0
- package/dist/persona/persona-audit.spec.js +1 -0
- package/dist/persona/types.d.ts +2 -0
- package/dist/playbooks/service-build/business-puzzle.js +1 -1
- package/dist/playbooks/service-build/facet-money.d.ts +11 -0
- package/dist/playbooks/service-build/facet-money.js +1 -1
- package/dist/playbooks/service-build/machine-panorama.d.ts +17 -0
- package/dist/playbooks/service-build/machine-panorama.js +1 -1
- package/dist/playbooks/service-build/merchant-guide.d.ts +2 -2
- package/dist/playbooks/service-build/migration-planner.d.ts +43 -0
- package/dist/playbooks/service-build/migration-planner.js +1 -0
- package/dist/playbooks/service-build/object-panorama.d.ts +42 -1
- 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/pipeline-actions.d.ts +1 -1
- package/dist/playbooks/service-build/reverse-mapping.d.ts +1 -0
- package/dist/playbooks/service-build/reverse-mapping.js +1 -1
- package/dist/playbooks/service-build/risk-aggregator.d.ts +2 -1
- package/dist/playbooks/service-build/risk-aggregator.js +1 -1
- package/dist/playbooks/service-build/semantic-graph.js +1 -1
- package/dist/playbooks/service-build/service-panorama.d.ts +53 -1
- package/dist/playbooks/service-build/service-panorama.js +1 -1
- package/dist/playbooks/service-build/topology-evaluation.spec.js +1 -1
- package/dist/playbooks/service-build/topology-query.js +1 -1
- package/dist/playbooks/service-build/workflow-design-assessment.d.ts +2 -2
- package/dist/playbooks/service-build/workflow-design-assessment.js +1 -1
- package/dist/relationship/registry.js +1 -1
- package/dist/review/machine.js +1 -1
- package/dist/review/order.js +1 -1
- package/dist/review/service.js +1 -1
- package/dist/review/types.d.ts +7 -0
- package/dist/safety/confirm-gate.js +1 -1
- package/dist/schema/benchmark-migration/index.d.ts +207 -0
- package/dist/schema/benchmark-migration/index.js +1 -0
- package/dist/schema/call/allocation.d.ts +1 -1
- package/dist/schema/call/allocation.js +1 -1
- package/dist/schema/call/arbitration.d.ts +1 -1
- package/dist/schema/call/arbitration.js +1 -1
- package/dist/schema/call/base.d.ts +5 -5
- package/dist/schema/call/base.js +1 -1
- package/dist/schema/call/contact.d.ts +1 -1
- package/dist/schema/call/demand.d.ts +1 -1
- package/dist/schema/call/guard.d.ts +3 -3
- package/dist/schema/call/machine.d.ts +5 -5
- package/dist/schema/call/order.d.ts +3 -3
- package/dist/schema/call/payment.js +1 -1
- package/dist/schema/call/permission-handler.d.ts +1 -1
- package/dist/schema/call/permission-handler.js +1 -1
- package/dist/schema/call/permission.d.ts +16 -16
- package/dist/schema/call/permission.js +1 -1
- package/dist/schema/call/personal.d.ts +8 -8
- package/dist/schema/call/personal.js +1 -1
- package/dist/schema/call/progress.d.ts +3 -3
- package/dist/schema/call/repository.d.ts +11 -11
- package/dist/schema/call/repository.js +1 -1
- package/dist/schema/call/reward.d.ts +1 -1
- package/dist/schema/call/semantic.js +1 -1
- package/dist/schema/call/service.d.ts +7 -7
- package/dist/schema/call/service.js +1 -1
- package/dist/schema/call/treasury.d.ts +1 -1
- package/dist/schema/common/index.d.ts +6 -6
- package/dist/schema/common/index.js +1 -1
- package/dist/schema/config/index.d.ts +50 -1
- package/dist/schema/config/index.js +1 -1
- package/dist/schema/evaluation/index.d.ts +27 -11
- package/dist/schema/evaluation/index.js +1 -1
- package/dist/schema/goal/index.d.ts +5 -5
- package/dist/schema/goal/planning.d.ts +15 -15
- package/dist/schema/goal/planning.js +1 -1
- package/dist/schema/index.d.ts +1 -0
- package/dist/schema/index.js +1 -1
- package/dist/schema/interaction/index.d.ts +1 -1
- package/dist/schema/local/index.js +1 -1
- package/dist/schema/messenger/index.d.ts +26 -26
- package/dist/schema/operations.d.ts +33 -33
- package/dist/schema/operations.js +1 -1
- package/dist/schema/persona/index.d.ts +4708 -0
- package/dist/schema/persona/index.js +1 -1
- package/dist/schema/query/bi.d.ts +232 -25
- package/dist/schema/query/bi.js +1 -1
- package/dist/schema/query/index.d.ts +35 -35
- package/dist/schema/query/index.js +1 -1
- package/dist/schema/schema-version.js +1 -1
- package/dist/schema/workflow/index.d.ts +1 -1
- package/dist/schema/workspace/index.d.ts +53 -0
- package/dist/schema/workspace/index.js +1 -1
- package/dist/schema-query-impl/index.d.ts +9 -0
- package/dist/schema-query-impl/index.js +1 -1
- package/dist/schemas/benchmark_migration_operation.output.json +793 -0
- package/dist/schemas/benchmark_migration_operation.schema.json +83 -0
- package/dist/schemas/bridge_operation.schema.json +5 -5
- package/dist/schemas/config_operation.output.json +252 -0
- package/dist/schemas/config_operation.schema.json +21 -1
- package/dist/schemas/evaluation_operation.output.json +22 -10
- package/dist/schemas/goal_operation.schema.json +8 -8
- package/dist/schemas/guard2file.schema.json +1 -1
- package/dist/schemas/index.json +7 -1
- package/dist/schemas/machineNode2file.schema.json +1 -1
- package/dist/schemas/messenger_operation.schema.json +24 -12
- package/dist/schemas/onchain_events.output.json +1 -1
- package/dist/schemas/onchain_operations.output.json +4 -2
- package/dist/schemas/onchain_operations.schema.json +189 -139
- package/dist/schemas/onchain_operations_allocation.schema.json +13 -11
- package/dist/schemas/onchain_operations_arbitration.schema.json +10 -8
- package/dist/schemas/onchain_operations_contact.schema.json +7 -5
- package/dist/schemas/onchain_operations_demand.schema.json +7 -5
- package/dist/schemas/onchain_operations_gen_passport.schema.json +5 -3
- package/dist/schemas/onchain_operations_gen_proof.schema.json +1 -1
- package/dist/schemas/onchain_operations_guard.schema.json +5 -3
- package/dist/schemas/onchain_operations_machine.schema.json +22 -18
- package/dist/schemas/onchain_operations_order.schema.json +11 -7
- package/dist/schemas/onchain_operations_payment.schema.json +3 -3
- package/dist/schemas/onchain_operations_permission.schema.json +19 -11
- package/dist/schemas/onchain_operations_personal.schema.json +16 -10
- package/dist/schemas/onchain_operations_progress.schema.json +11 -7
- package/dist/schemas/onchain_operations_proof.schema.json +5 -3
- package/dist/schemas/onchain_operations_repository.schema.json +12 -8
- package/dist/schemas/onchain_operations_reward.schema.json +11 -9
- package/dist/schemas/onchain_operations_service.schema.json +28 -22
- package/dist/schemas/onchain_operations_treasury.schema.json +11 -9
- package/dist/schemas/onchain_table_data.output.json +27 -17
- package/dist/schemas/persona_operation.output.json +15875 -1
- package/dist/schemas/persona_operation.schema.json +3056 -478
- package/dist/schemas/query_toolkit.output.json +343 -63
- package/dist/schemas/query_toolkit.schema.json +1 -1
- package/dist/schemas/workflow_operation.schema.json +4 -2
- package/dist/schemas/workspace_operation.output.json +181 -1
- package/dist/schemas/workspace_operation.schema.json +61 -2
- package/dist/strategy/scorecard.js +1 -1
- package/dist/tools/handlers/benchmark-migration.d.ts +2 -0
- package/dist/tools/handlers/benchmark-migration.js +1 -0
- package/dist/tools/handlers/config.js +1 -1
- package/dist/tools/handlers/industry-pack.js +1 -1
- package/dist/tools/handlers/onchain.js +1 -1
- package/dist/tools/handlers/query.js +1 -1
- package/dist/tools/handlers/schema-query.js +1 -1
- package/dist/tools/handlers/workspace.js +1 -1
- package/dist/tools/index.js +1 -1
- package/dist/tools/move-fn-index.gen.d.ts +3 -0
- package/dist/tools/move-fn-index.gen.js +1 -0
- 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/onchain.js +1 -1
- package/dist/tools/sanitize-output.d.ts +3 -0
- package/dist/tools/sanitize-output.js +1 -0
- package/dist/tools/sanitize-output.spec.d.ts +1 -0
- package/dist/tools/sanitize-output.spec.js +1 -0
- package/package.json +9 -4
- package/dist/knowledge/baselines/evaluation-baselines.json +0 -79
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +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':0x64n,'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);});});
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { Severity } from "./severity.js";
|
|
3
|
+
export declare const EXPOSURE_ROLES: readonly ["buyer", "merchant", "supplier", "collaborator", "arbitrator", "system", "neutral"];
|
|
4
|
+
export type ExposureRole = (typeof EXPOSURE_ROLES)[number];
|
|
5
|
+
export declare const GAIN_VIABILITIES: readonly ["viable", "conditional", "blocked", "unverifiable"];
|
|
6
|
+
export type GainViability = (typeof GAIN_VIABILITIES)[number];
|
|
7
|
+
export declare const FactRefSchema: z.ZodString;
|
|
8
|
+
export declare function factRef(name: string): string;
|
|
9
|
+
export declare function parseFactRef(v: string): string | null;
|
|
10
|
+
export declare const ExposurePartyDataSchema: z.ZodObject<{
|
|
11
|
+
role: z.ZodEnum<{
|
|
12
|
+
merchant: "merchant";
|
|
13
|
+
supplier: "supplier";
|
|
14
|
+
collaborator: "collaborator";
|
|
15
|
+
arbitrator: "arbitrator";
|
|
16
|
+
neutral: "neutral";
|
|
17
|
+
system: "system";
|
|
18
|
+
buyer: "buyer";
|
|
19
|
+
}>;
|
|
20
|
+
basis: z.ZodString;
|
|
21
|
+
}, z.core.$strict>;
|
|
22
|
+
export declare const GainPathDataSchema: z.ZodObject<{
|
|
23
|
+
role: z.ZodEnum<{
|
|
24
|
+
merchant: "merchant";
|
|
25
|
+
supplier: "supplier";
|
|
26
|
+
collaborator: "collaborator";
|
|
27
|
+
arbitrator: "arbitrator";
|
|
28
|
+
neutral: "neutral";
|
|
29
|
+
system: "system";
|
|
30
|
+
buyer: "buyer";
|
|
31
|
+
}>;
|
|
32
|
+
path: z.ZodString;
|
|
33
|
+
viability: z.ZodUnion<readonly [z.ZodEnum<{
|
|
34
|
+
conditional: "conditional";
|
|
35
|
+
viable: "viable";
|
|
36
|
+
blocked: "blocked";
|
|
37
|
+
unverifiable: "unverifiable";
|
|
38
|
+
}>, z.ZodString]>;
|
|
39
|
+
gate: z.ZodString;
|
|
40
|
+
}, z.core.$strict>;
|
|
41
|
+
export declare const ExposureFragmentSchema: z.ZodObject<{
|
|
42
|
+
loss_parties: z.ZodArray<z.ZodObject<{
|
|
43
|
+
role: z.ZodEnum<{
|
|
44
|
+
merchant: "merchant";
|
|
45
|
+
supplier: "supplier";
|
|
46
|
+
collaborator: "collaborator";
|
|
47
|
+
arbitrator: "arbitrator";
|
|
48
|
+
neutral: "neutral";
|
|
49
|
+
system: "system";
|
|
50
|
+
buyer: "buyer";
|
|
51
|
+
}>;
|
|
52
|
+
basis: z.ZodString;
|
|
53
|
+
}, z.core.$strict>>;
|
|
54
|
+
gain_paths: z.ZodArray<z.ZodObject<{
|
|
55
|
+
role: z.ZodEnum<{
|
|
56
|
+
merchant: "merchant";
|
|
57
|
+
supplier: "supplier";
|
|
58
|
+
collaborator: "collaborator";
|
|
59
|
+
arbitrator: "arbitrator";
|
|
60
|
+
neutral: "neutral";
|
|
61
|
+
system: "system";
|
|
62
|
+
buyer: "buyer";
|
|
63
|
+
}>;
|
|
64
|
+
path: z.ZodString;
|
|
65
|
+
viability: z.ZodUnion<readonly [z.ZodEnum<{
|
|
66
|
+
conditional: "conditional";
|
|
67
|
+
viable: "viable";
|
|
68
|
+
blocked: "blocked";
|
|
69
|
+
unverifiable: "unverifiable";
|
|
70
|
+
}>, z.ZodString]>;
|
|
71
|
+
gate: z.ZodString;
|
|
72
|
+
}, z.core.$strict>>;
|
|
73
|
+
downgrade_exempt: z.ZodOptional<z.ZodBoolean>;
|
|
74
|
+
}, z.core.$strict>;
|
|
75
|
+
export type ExposureFragment = z.infer<typeof ExposureFragmentSchema>;
|
|
76
|
+
export type GainPathViability = GainViability;
|
|
77
|
+
export interface ExposureParty {
|
|
78
|
+
role: ExposureRole | (string & {});
|
|
79
|
+
basis: string;
|
|
80
|
+
}
|
|
81
|
+
export interface GainPath {
|
|
82
|
+
role: ExposureRole | (string & {});
|
|
83
|
+
path: string;
|
|
84
|
+
viability: GainPathViability;
|
|
85
|
+
gate: string;
|
|
86
|
+
}
|
|
87
|
+
export type ExposureVerdict = "confirmed" | "downgraded" | "pending-disclosure";
|
|
88
|
+
export interface FindingExposure {
|
|
89
|
+
lossParties: ExposureParty[];
|
|
90
|
+
gainPaths: GainPath[];
|
|
91
|
+
verdict: ExposureVerdict;
|
|
92
|
+
baseSeverity?: Severity;
|
|
93
|
+
}
|
|
94
|
+
export declare function resolveViability(viability: string, facts: Record<string, unknown>): GainViability;
|
|
95
|
+
export declare function resolveExposureFragment(frag: ExposureFragment, facts: Record<string, unknown>, interpolate: (template: string) => string): {
|
|
96
|
+
lossParties: ExposureParty[];
|
|
97
|
+
gainPaths: GainPath[];
|
|
98
|
+
downgradeExempt: boolean;
|
|
99
|
+
};
|
|
100
|
+
export declare function applyExposureGate(severity: Severity, exposure: {
|
|
101
|
+
lossParties: ExposureParty[];
|
|
102
|
+
gainPaths: GainPath[];
|
|
103
|
+
}, opts?: {
|
|
104
|
+
downgradeExempt?: boolean;
|
|
105
|
+
}): {
|
|
106
|
+
severity: Severity;
|
|
107
|
+
exposure: FindingExposure;
|
|
108
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{z}from'zod';export const EXPOSURE_ROLES=['buyer','merchant','supplier','collaborator','arbitrator','system','neutral'];export const GAIN_VIABILITIES=['viable','conditional','blocked','unverifiable'];const FACT_REF_RE=/^fact:([A-Za-z0-9_.-]+)$/;export const FactRefSchema=z['string']()['regex'](FACT_REF_RE);export function factRef(a){return'fact:'+a;}export function parseFactRef(a){const b=FACT_REF_RE['exec'](a);return b?b[0x1]:null;}const RoleSchema=z['enum'](EXPOSURE_ROLES),ViabilitySchema=z['union']([z['enum'](GAIN_VIABILITIES),z['string']()['regex'](FACT_REF_RE)]);export const ExposurePartyDataSchema=z['object']({'role':RoleSchema,'basis':z['string']()})['strict']();export const GainPathDataSchema=z['object']({'role':RoleSchema,'path':z['string'](),'viability':ViabilitySchema,'gate':z['string']()})['strict']();export const ExposureFragmentSchema=z['object']({'loss_parties':z['array'](ExposurePartyDataSchema),'gain_paths':z['array'](GainPathDataSchema),'downgrade_exempt':z['boolean']()['optional']()})['strict']();export function resolveViability(a,b){const c=parseFactRef(a);if(c===null)return a;const d=b[c];return GAIN_VIABILITIES['includes'](String(d))?String(d):'unverifiable';}export function resolveExposureFragment(a,b,c){return{'lossParties':a['loss_parties']['map'](d=>({'role':d['role'],'basis':c(d['basis'])})),'gainPaths':a['gain_paths']['map'](d=>({'role':d['role'],'path':c(d['path']),'viability':resolveViability(d['viability'],b),'gate':c(d['gate'])})),'downgradeExempt':a['downgrade_exempt']===!![]};}export function applyExposureGate(a,b,c){const {lossParties:d,gainPaths:e}=b;if(!c?.['downgradeExempt']&&e['length']>0x0&&e['every'](i=>i['viability']==='blocked'))return{'severity':'info','exposure':{'lossParties':d,'gainPaths':e,'verdict':'downgraded','baseSeverity':a}};const f=e['some'](i=>i['viability']==='unverifiable'),g=e['some'](i=>i['viability']==='viable'||i['viability']==='conditional'),h=g?'confirmed':f?'pending-disclosure':'confirmed';return{'severity':a,'exposure':{'lossParties':d,'gainPaths':e,'verdict':h}};}
|
package/dist/config/index.d.ts
CHANGED
package/dist/config/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export*from'./runtime.js';
|
|
1
|
+
export*from'./runtime.js';export*from'./severity.js';export*from'./judgment.js';
|