@wowok/agent-mcp 3.1.2 → 3.1.4
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/runtime.js +1 -1
- package/dist/config/severity.d.ts +7 -0
- package/dist/config/severity.js +1 -0
- package/dist/customer/index.d.ts +3 -9
- package/dist/customer/index.js +1 -1
- package/dist/customer/industry-risks.d.ts +3 -17
- package/dist/customer/industry-risks.js +1 -1
- package/dist/customer/order-monitor.d.ts +3 -1
- package/dist/customer/order-monitor.js +1 -1
- package/dist/customer/types.d.ts +1 -165
- package/dist/customer/types.js +1 -1
- package/dist/customer/user-preferences.d.ts +0 -49
- package/dist/customer/user-preferences.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/architecture.spec.d.ts +1 -0
- package/dist/evaluation/architecture.spec.js +1 -0
- package/dist/evaluation/builtins/demand-match.js +1 -1
- package/dist/evaluation/builtins/graph-service.d.ts +16 -0
- package/dist/evaluation/builtins/graph-service.js +1 -0
- package/dist/evaluation/builtins/graph-service.spec.d.ts +1 -0
- package/dist/evaluation/builtins/graph-service.spec.js +1 -0
- package/dist/evaluation/builtins/index.d.ts +1 -1
- package/dist/evaluation/builtins/index.js +1 -1
- package/dist/evaluation/builtins/purity.spec.d.ts +1 -0
- package/dist/evaluation/builtins/purity.spec.js +1 -0
- package/dist/evaluation/engine.js +1 -1
- package/dist/evaluation/facets/catalog.d.ts +19 -0
- package/dist/evaluation/facets/catalog.js +1 -0
- package/dist/evaluation/game-strategy.d.ts +2 -2
- package/dist/evaluation/game-strategy.js +1 -1
- package/dist/evaluation/guard-scan.d.ts +10 -0
- package/dist/evaluation/guard-scan.js +1 -0
- package/dist/evaluation/match-operation.d.ts +2 -2
- package/dist/evaluation/match-operation.js +1 -1
- package/dist/evaluation/standards.d.ts +9 -0
- package/dist/evaluation/standards.js +1 -0
- package/dist/evaluation/standards.spec.d.ts +1 -0
- package/dist/evaluation/standards.spec.js +1 -0
- package/dist/evaluation/types.d.ts +11 -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/index.d.ts +1 -1
- package/dist/extensions/index.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 +14 -5
- 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 +16 -1
- package/dist/graph/onchain/analyze.js +1 -1
- package/dist/graph/onchain/analyze.spec.js +1 -1
- package/dist/graph/onchain/dataplane.d.ts +1 -1
- package/dist/graph/onchain/dataplane.js +1 -1
- package/dist/graph/onchain/edge-batch.spec.d.ts +1 -0
- package/dist/graph/onchain/edge-batch.spec.js +1 -0
- package/dist/graph/onchain/edge-schema.d.ts +11 -2
- package/dist/graph/onchain/edge-schema.js +1 -1
- package/dist/graph/onchain/entity-profile.spec.d.ts +1 -0
- package/dist/graph/onchain/entity-profile.spec.js +1 -0
- package/dist/graph/onchain/event-history.spec.d.ts +1 -0
- package/dist/graph/onchain/event-history.spec.js +1 -0
- 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/extract-deep.spec.d.ts +1 -0
- package/dist/graph/onchain/extract-deep.spec.js +1 -0
- package/dist/graph/onchain/extract.d.ts +11 -3
- package/dist/graph/onchain/extract.js +1 -1
- package/dist/graph/onchain/facet-projection.d.ts +99 -0
- package/dist/graph/onchain/facet-projection.js +1 -0
- package/dist/graph/onchain/facet-projection.spec.d.ts +1 -0
- package/dist/graph/onchain/facet-projection.spec.js +1 -0
- package/dist/graph/onchain/facts.d.ts +103 -0
- package/dist/graph/onchain/facts.js +1 -0
- package/dist/graph/onchain/facts.spec.d.ts +1 -0
- package/dist/graph/onchain/facts.spec.js +1 -0
- package/dist/graph/onchain/field-manifest.d.ts +29 -0
- package/dist/graph/onchain/field-manifest.js +1 -0
- package/dist/graph/onchain/field-manifest.spec.d.ts +1 -0
- package/dist/graph/onchain/field-manifest.spec.js +1 -0
- package/dist/graph/onchain/fixtures.d.ts +80 -0
- package/dist/graph/onchain/fixtures.js +1 -0
- package/dist/graph/onchain/fixtures.spec.d.ts +1 -0
- package/dist/graph/onchain/fixtures.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 +14 -2
- 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/label-lint.spec.d.ts +1 -0
- package/dist/graph/onchain/label-lint.spec.js +1 -0
- package/dist/graph/onchain/names.d.ts +23 -0
- package/dist/graph/onchain/names.js +1 -0
- package/dist/graph/onchain/names.spec.d.ts +1 -0
- package/dist/graph/onchain/names.spec.js +1 -0
- package/dist/graph/onchain/onchain.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.d.ts +11 -0
- package/dist/graph/onchain/proposal-graph.js +1 -0
- package/dist/graph/onchain/proposal-graph.spec.d.ts +1 -0
- package/dist/graph/onchain/proposal-graph.spec.js +1 -0
- package/dist/graph/onchain/sdk-batch.d.ts +5 -1
- package/dist/graph/onchain/sdk-batch.js +1 -1
- package/dist/graph/onchain/strategy.d.ts +16 -0
- package/dist/graph/onchain/strategy.js +1 -1
- package/dist/graph/onchain/strategy.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/table-ledger.spec.d.ts +1 -0
- package/dist/graph/onchain/table-ledger.spec.js +1 -0
- package/dist/graph/onchain/types.d.ts +57 -7
- package/dist/graph/onchain/viewport.d.ts +1 -0
- package/dist/graph/onchain/viewport.js +1 -1
- package/dist/harness/index.d.ts +1 -5
- package/dist/harness/index.js +1 -1
- package/dist/harness/verify.d.ts +6 -1
- package/dist/harness/verify.js +1 -1
- package/dist/index.js +1 -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 -3
- package/dist/knowledge/allocation-risk.js +1 -1
- package/dist/knowledge/allocation-templates.js +1 -1
- package/dist/knowledge/arb-risk.d.ts +6 -6
- 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 -3
- package/dist/knowledge/arbitration-risk.js +1 -1
- package/dist/knowledge/arbitration-templates.js +1 -1
- package/dist/knowledge/baselines/guard-lint-baseline.spec.d.ts +1 -0
- package/dist/knowledge/baselines/guard-lint-baseline.spec.js +1 -0
- package/dist/knowledge/baselines/judgment-baselines.json +289 -0
- package/dist/knowledge/baselines/risk-baselines.spec.d.ts +1 -0
- package/dist/knowledge/baselines/risk-baselines.spec.js +1 -0
- package/dist/knowledge/baselines/risk-cases.d.ts +8 -0
- package/dist/knowledge/baselines/risk-cases.js +1 -0
- 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 -6
- 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 -6
- package/dist/knowledge/contact-risk.js +1 -1
- package/dist/knowledge/contract-invariants.d.ts +1 -0
- package/dist/knowledge/contract-invariants.js +1 -1
- package/dist/knowledge/demand-risk.d.ts +6 -6
- 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-eval.d.ts +15 -0
- package/dist/knowledge/guard-eval.js +1 -0
- package/dist/knowledge/guard-eval.spec.d.ts +1 -0
- package/dist/knowledge/guard-eval.spec.js +1 -0
- 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-lint.d.ts +1 -1
- package/dist/knowledge/guard-lint.js +1 -1
- package/dist/knowledge/guard-risk.d.ts +7 -19
- 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 +51 -45
- package/dist/knowledge/index.js +1 -1
- package/dist/knowledge/industry-registry.js +1 -1
- package/dist/knowledge/industry-rule-node.d.ts +7 -0
- package/dist/knowledge/industry-rule-node.js +1 -0
- 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 -7
- 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 +7 -12
- 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 -7
- 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 -10
- package/dist/knowledge/permission-risk.js +1 -1
- package/dist/knowledge/permission-templates.js +1 -1
- package/dist/knowledge/personal-risk.d.ts +6 -6
- 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 -3
- package/dist/knowledge/progress-risk.js +1 -1
- package/dist/knowledge/progress-templates.js +1 -1
- package/dist/knowledge/proof-risk.d.ts +6 -6
- package/dist/knowledge/proof-risk.js +1 -1
- package/dist/knowledge/puzzle-projections.d.ts +11 -0
- package/dist/knowledge/puzzle-projections.js +1 -0
- 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 -6
- package/dist/knowledge/registrar-risk.js +1 -1
- package/dist/knowledge/repository-risk.d.ts +7 -7
- package/dist/knowledge/repository-risk.js +1 -1
- package/dist/knowledge/resource-risk.d.ts +6 -6
- 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 +5 -6
- package/dist/knowledge/reward-risk.js +1 -1
- package/dist/knowledge/rule-node-analyzers.d.ts +43 -0
- package/dist/knowledge/rule-node-analyzers.js +1 -0
- package/dist/knowledge/rule-node-analyzers.spec.d.ts +1 -0
- package/dist/knowledge/rule-node-analyzers.spec.js +1 -0
- package/dist/knowledge/rule-outcome.d.ts +5 -0
- package/dist/knowledge/rule-outcome.js +1 -0
- package/dist/knowledge/safety-rules.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 -4
- 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 +6 -4
- package/dist/knowledge/treasury-risk.js +1 -1
- package/dist/knowledge/treasury-templates.js +1 -1
- package/dist/knowledge/util-risk.d.ts +6 -6
- 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/bridge.js +1 -1
- package/dist/persona/facet-profile.d.ts +33 -0
- package/dist/persona/facet-profile.js +1 -0
- package/dist/persona/index.js +1 -1
- package/dist/persona/model.d.ts +2 -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/topology-focus.d.ts +2 -2
- package/dist/persona/topology-focus.js +1 -1
- package/dist/persona/types.d.ts +14 -0
- package/dist/playbooks/service-build/business-puzzle.js +1 -1
- package/dist/playbooks/service-build/facet-money.d.ts +33 -0
- package/dist/playbooks/service-build/facet-money.js +1 -0
- package/dist/playbooks/service-build/facet-money.spec.d.ts +1 -0
- package/dist/playbooks/service-build/facet-money.spec.js +1 -0
- package/dist/playbooks/service-build/machine-panorama.d.ts +20 -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 +65 -24
- 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 +3 -3
- package/dist/playbooks/service-build/pipeline-actions.js +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 +4 -2
- 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 +56 -9
- package/dist/playbooks/service-build/service-panorama.js +1 -1
- package/dist/playbooks/service-build/topology-evaluation.spec.d.ts +1 -0
- package/dist/playbooks/service-build/topology-evaluation.spec.js +1 -0
- package/dist/playbooks/service-build/topology-query.d.ts +13 -2
- 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/arb.d.ts +0 -2
- package/dist/review/arb.js +1 -1
- package/dist/review/machine.js +1 -1
- package/dist/review/order.d.ts +0 -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/role/profiles.js +1 -1
- package/dist/rules.d.ts +1 -2
- package/dist/rules.js +1 -1
- 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 +3374 -670
- 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/handler.js +1 -1
- 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/receipt.d.ts +28 -0
- package/dist/schema/call/receipt.js +1 -0
- 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-customer-advice.spec.d.ts +1 -0
- package/dist/schema/call/semantic-customer-advice.spec.js +1 -0
- package/dist/schema/call/semantic.d.ts +5 -2
- 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/call/treasury.js +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 +307 -213
- package/dist/schema/evaluation/index.js +1 -1
- package/dist/schema/goal/index.d.ts +6 -6
- package/dist/schema/goal/planning.d.ts +17 -17
- package/dist/schema/goal/planning.js +1 -1
- package/dist/schema/index.d.ts +1 -1
- package/dist/schema/index.js +1 -1
- package/dist/schema/industry-pack/index.d.ts +1 -1
- package/dist/schema/interaction/index.d.ts +1 -1
- package/dist/schema/keeper/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 +59 -43
- package/dist/schema/operations.js +1 -1
- package/dist/schema/persona/index.d.ts +4732 -24
- package/dist/schema/persona/index.js +1 -1
- package/dist/schema/query/bi.d.ts +830 -10
- package/dist/schema/query/bi.js +1 -1
- package/dist/schema/query/index.d.ts +44 -44
- 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 +2 -2
- package/dist/schema-query-impl/index.d.ts +9 -0
- package/dist/schema-query-impl/index.js +1 -1
- package/dist/schemas/account_operation.output.json +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.output.json +1 -1
- 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 +702 -162
- package/dist/schemas/evaluation_operation.schema.json +0 -429
- package/dist/schemas/goal_operation.schema.json +8 -8
- package/dist/schemas/guard2file.schema.json +1 -1
- package/dist/schemas/index.json +7 -7
- package/dist/schemas/keeper_operation.output.json +1 -1
- package/dist/schemas/local_history_operation.output.json +1 -1
- package/dist/schemas/local_info_operation.output.json +1 -1
- package/dist/schemas/local_mark_operation.output.json +1 -1
- package/dist/schemas/machineNode2file.schema.json +1 -1
- package/dist/schemas/messenger_operation.output.json +1 -1
- package/dist/schemas/messenger_operation.schema.json +24 -12
- package/dist/schemas/monitor_events.output.json +1 -1
- package/dist/schemas/monitor_subscription.output.json +1 -1
- package/dist/schemas/onchain_events.output.json +2 -2
- package/dist/schemas/onchain_operations.output.json +6359 -3724
- package/dist/schemas/onchain_operations.schema.json +191 -141
- 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 +13 -11
- package/dist/schemas/onchain_table_data.output.json +88 -88
- 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 +1325 -212
- package/dist/schemas/query_toolkit.schema.json +60 -2
- package/dist/schemas/workflow_operation.schema.json +4 -2
- package/dist/strategy/metrics.js +1 -1
- 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/bridge.js +1 -1
- package/dist/tools/handlers/config.js +1 -1
- package/dist/tools/handlers/dispatch-expectations.d.ts +3 -0
- package/dist/tools/handlers/dispatch-expectations.js +1 -0
- package/dist/tools/handlers/evaluation.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/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.d.ts +2 -0
- package/dist/tools/registry/evaluation.js +1 -0
- package/dist/tools/registry/onchain.js +1 -1
- package/dist/tools/registry/query.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/dist/tools/shared.d.ts +0 -1
- package/dist/tools/shared.js +1 -1
- package/dist/tools/wrap.js +1 -1
- package/package.json +9 -3
- package/dist/customer/customer-advice.d.ts +0 -32
- package/dist/customer/customer-advice.js +0 -1
- package/dist/customer/info-puzzle.d.ts +0 -146
- package/dist/customer/info-puzzle.js +0 -1
- package/dist/customer/order-strategy.d.ts +0 -17
- package/dist/customer/order-strategy.js +0 -1
- package/dist/customer/preorder-compare.d.ts +0 -24
- package/dist/customer/preorder-compare.js +0 -1
- package/dist/customer/reminder-system.d.ts +0 -42
- package/dist/customer/reminder-system.js +0 -1
- package/dist/customer/risk-assessment.d.ts +0 -13
- package/dist/customer/risk-assessment.js +0 -1
- package/dist/evaluation/builtins/service-risk.d.ts +0 -7
- package/dist/evaluation/builtins/service-risk.js +0 -1
- package/dist/knowledge/trust-metrics.d.ts +0 -66
- package/dist/knowledge/trust-metrics.js +0 -1
- package/dist/schema/trust/index.d.ts +0 -334
- package/dist/schema/trust/index.js +0 -1
- package/dist/schemas/trust_score.output.json +0 -847
- package/dist/schemas/trust_score.schema.json +0 -364
- package/dist/tools/handlers/trust.d.ts +0 -16
- package/dist/tools/handlers/trust.js +0 -1
- package/dist/tools/registry/trust.d.ts +0 -2
- package/dist/tools/registry/trust.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{existsSync,readFileSync,readdirSync,statSync,writeFileSync,renameSync,mkdirSync,copyFileSync}from'node:fs';import{fileURLToPath}from'node:url';import{dirname,join}from'node:path';import{z}from'zod';import{getWowMcpDir}from'@wowok/wowok';import{SEVERITY_ORDER}from'./severity.js';import{RuleDomainPackSchema,RuleDomainPackInputSchema}from'./rule-engine.js';import{parseFactRef}from'./exposure.js';export const EXPECTED_JUDGMENT_VERSION=0x1;export const JUDGMENT_SECTION_NAMES=['evaluation','game','match','monitor','mode','scorecard','rules'];const SeverityKeySchema=z['enum'](SEVERITY_ORDER);export const DimensionStandardSchema=z['object']({'label':z['string'](),'description':z['string']()})['strict']();const LevelBandSchema=z['object']({'min':z['number'](),'level':z['string']()})['strict'](),GradeWordBandSchema=z['object']({'min':z['number'](),'word':z['string']()})['strict']();export const EvaluationSectionSchema=z['object']({'comment':z['string']()['optional'](),'weights':z['record'](z['string'](),z['number']()),'dimensions':z['record'](z['string'](),DimensionStandardSchema),'severity_deduction':z['record'](SeverityKeySchema,z['number']()),'level_bands':z['array'](LevelBandSchema),'grade_words':z['object']({'comment':z['string']()['optional'](),'trust':z['array'](GradeWordBandSchema),'risk':z['array'](GradeWordBandSchema)})['strict']()})['strict']();export const EvaluationSectionInputSchema=z['object']({'comment':z['string']()['optional'](),'weights':z['record'](z['string'](),z['number']())['optional'](),'dimensions':z['record'](z['string'](),DimensionStandardSchema)['optional'](),'severity_deduction':z['record'](z['string'](),z['number']())['optional'](),'level_bands':z['array'](LevelBandSchema)['optional'](),'grade_words':z['object']({'comment':z['string']()['optional'](),'trust':z['array'](GradeWordBandSchema)['optional'](),'risk':z['array'](GradeWordBandSchema)['optional']()})['strict']()['optional']()})['strict']();const RoleInterestSchema=z['object']({'prefer':z['array'](z['string']()),'avoid':z['array'](z['string']()),'sensitivity':z['number']()})['strict'](),KeywordRuleSchema=z['object']({'id':z['string'](),'keywords':z['array'](z['string']())['min'](0x1),'effect':z['string'](),'anchor':z['enum'](['prefer','avoid']),'when_forbidden':z['boolean']()})['strict']();export const ArbGameSectionSchema=z['object']({'comment':z['string']()['optional'](),'effect_semantics':z['record'](z['string'](),z['array'](z['string']())),'role_interests':z['record'](z['string'](),RoleInterestSchema),'keyword_rules':z['array'](KeywordRuleSchema),'forbid_pattern':z['string'](),'scoring':z['object']({'base':z['number'](),'per_gain':z['number'](),'per_risk':z['number']()})['strict']()})['strict']();export const ArbGameSectionInputSchema=ArbGameSectionSchema['partial']();export const GameSectionSchema=z['object']({'comment':z['string']()['optional'](),'outcome_semantics':z['record'](z['string'](),z['array'](z['string']())),'role_interests':z['record'](z['string'](),RoleInterestSchema),'appetite_multipliers':z['object']({'conservative':z['number'](),'balanced':z['number'](),'aggressive':z['number']()})['strict'](),'scoring':z['object']({'base':z['number'](),'per_gain':z['number'](),'per_risk':z['number']()})['strict'](),'keyword_rules':z['array'](KeywordRuleSchema),'forbid_pattern':z['string'](),'arb':ArbGameSectionSchema})['strict']();export const GameSectionInputSchema=z['object']({'comment':z['string']()['optional'](),'outcome_semantics':z['record'](z['string'](),z['array'](z['string']()))['optional'](),'role_interests':z['record'](z['string'](),RoleInterestSchema)['optional'](),'appetite_multipliers':z['object']({'conservative':z['number']()['optional'](),'balanced':z['number']()['optional'](),'aggressive':z['number']()['optional']()})['strict']()['optional'](),'scoring':z['object']({'base':z['number']()['optional'](),'per_gain':z['number']()['optional'](),'per_risk':z['number']()['optional']()})['strict']()['optional'](),'keyword_rules':z['array'](KeywordRuleSchema)['optional'](),'forbid_pattern':z['string']()['optional'](),'arb':ArbGameSectionInputSchema['optional']()})['strict']();const MatchBandSchema=z['object']({'min':z['number'](),'score':z['number']()})['strict']();export const MatchSectionSchema=z['object']({'comment':z['string']()['optional'](),'region_scores':z['object']({'exact':z['number'](),'contains':z['number'](),'compatible':z['number'](),'overlap':z['number'](),'mismatch':z['number']()})['strict'](),'weights':z['object']({'region':z['number'](),'industry':z['number'](),'price':z['number'](),'trust':z['number'](),'capabilities':z['number'](),'tags':z['number'](),'acceptance':z['number']()})['strict'](),'trust_bands':z['array'](MatchBandSchema),'neutral_score':z['number'](),'price_over_budget_tolerance_pct':z['number'](),'top_n':z['number']()['int']()})['strict']();export const MatchSectionInputSchema=z['object']({'comment':z['string']()['optional'](),'region_scores':z['object']({'exact':z['number']()['optional'](),'contains':z['number']()['optional'](),'compatible':z['number']()['optional'](),'overlap':z['number']()['optional'](),'mismatch':z['number']()['optional']()})['strict']()['optional'](),'weights':z['object']({'region':z['number']()['optional'](),'industry':z['number']()['optional'](),'price':z['number']()['optional'](),'trust':z['number']()['optional'](),'capabilities':z['number']()['optional'](),'tags':z['number']()['optional'](),'acceptance':z['number']()['optional']()})['strict']()['optional'](),'trust_bands':z['array'](MatchBandSchema)['optional'](),'neutral_score':z['number']()['optional'](),'price_over_budget_tolerance_pct':z['number']()['optional'](),'top_n':z['number']()['int']()['optional']()})['strict']();const MonitorThresholdsFullSchema=z['object']({'progress_stall_hours':z['number'](),'compensation_drop_ratio':z['number'](),'compensation_coverage_min':z['number'](),'messenger_timeout_hours':z['number'](),'review_window_closing_days':z['number'](),'arb_window_closing_days':z['number']()})['strict'](),MonitorEscalationSchema=z['object']({'default_expected_progress_hours':z['number'](),'stall_expected_multiplier':z['number'](),'stall_escalation_multiplier':z['number'](),'messenger_escalation_multiplier':z['number'](),'ratio_critical_threshold':z['number']()})['strict']();export const MonitorSectionSchema=z['object']({'comment':z['string']()['optional'](),'thresholds':MonitorThresholdsFullSchema,'escalation':MonitorEscalationSchema})['strict']();export const MonitorSectionInputSchema=z['object']({'comment':z['string']()['optional'](),'thresholds':z['object']({'progress_stall_hours':z['number']()['optional'](),'compensation_drop_ratio':z['number']()['optional'](),'compensation_coverage_min':z['number']()['optional'](),'messenger_timeout_hours':z['number']()['optional'](),'review_window_closing_days':z['number']()['optional'](),'arb_window_closing_days':z['number']()['optional']()})['strict']()['optional'](),'escalation':z['object']({'default_expected_progress_hours':z['number']()['optional'](),'stall_expected_multiplier':z['number']()['optional'](),'stall_escalation_multiplier':z['number']()['optional'](),'messenger_escalation_multiplier':z['number']()['optional'](),'ratio_critical_threshold':z['number']()['optional']()})['strict']()['optional']()})['strict']();const AppetitePostureSchema=z['object']({'max_risk':z['number'](),'min_benefit':z['number']()})['strict']();export const ModeSectionSchema=z['object']({'comment':z['string']()['optional'](),'appetite_thresholds':z['object']({'conservative':AppetitePostureSchema,'balanced':AppetitePostureSchema,'aggressive':AppetitePostureSchema})['strict']()})['strict']();export const ModeSectionInputSchema=z['object']({'comment':z['string']()['optional'](),'appetite_thresholds':z['object']({'conservative':AppetitePostureSchema['optional'](),'balanced':AppetitePostureSchema['optional'](),'aggressive':AppetitePostureSchema['optional']()})['strict']()['optional']()})['strict']();const PostureWeightSchema=z['object']({'volume':z['number'](),'balanced':z['number'](),'margin':z['number']()})['strict'](),MetricTuneSchema=z['object']({'weight':PostureWeightSchema['optional'](),'good_threshold':z['number']()['optional'](),'bad_threshold':z['number']()['optional']()})['strict']();export const ScorecardSectionSchema=z['object']({'comment':z['string']()['optional'](),'metrics':z['record'](z['string'](),MetricTuneSchema),'shop_evidence_metrics':z['array'](z['string']())})['strict']();export const ScorecardSectionInputSchema=z['object']({'comment':z['string']()['optional'](),'metrics':z['record'](z['string'](),MetricTuneSchema)['optional'](),'shop_evidence_metrics':z['array'](z['string']())['optional']()})['strict']();export const RulesSectionSchema=z['object']({'comment':z['string']()['optional'](),'domains':z['record'](z['string'](),RuleDomainPackSchema)})['strict']();export const RulesSectionInputSchema=z['object']({'comment':z['string']()['optional'](),'domains':z['record'](z['string'](),RuleDomainPackInputSchema)['optional']()})['strict']();export const JudgmentDocSchema=z['object']({'version':z['number']()['int'](),'description':z['string']()['optional'](),'evaluation':EvaluationSectionSchema,'game':GameSectionSchema,'match':MatchSectionSchema,'monitor':MonitorSectionSchema,'mode':ModeSectionSchema,'scorecard':ScorecardSectionSchema,'rules':RulesSectionSchema})['strict']();export const JudgmentDocInputSchema=z['object']({'version':z['number']()['int'](),'description':z['string']()['optional'](),'evaluation':EvaluationSectionInputSchema['optional'](),'game':GameSectionInputSchema['optional'](),'match':MatchSectionInputSchema['optional'](),'monitor':MonitorSectionInputSchema['optional'](),'mode':ModeSectionInputSchema['optional'](),'scorecard':ScorecardSectionInputSchema['optional'](),'rules':RulesSectionInputSchema['optional']()})['strict']();export const JudgmentFragmentSchema=JudgmentDocInputSchema['omit']({'version':!![]})['extend']({'version':z['number']()['int']()['optional']()});function isPlainObject(a){return typeof a==='object'&&a!==null&&!Array['isArray'](a);}function entryId(a){if(isPlainObject(a)){if(typeof a['rule_id']==='string')return a['rule_id'];if(typeof a['id']==='string')return a['id'];}return null;}export function mergeJudgmentValues(a,b){if(Array['isArray'](a)&&Array['isArray'](b)){if(a['length']===0x0)return[...b];if(b['length']===0x0)return[...a];const c=[...a,...b]['every'](f=>entryId(f)!==null);if(!c)return[...b];const d=new Map();for(const f of a)d['set'](entryId(f),f);for(const g of b){const h=entryId(g),i=d['get'](h);d['set'](h,i===undefined?g:mergeJudgmentValues(i,g));}return[...d['values']()];}if(isPlainObject(a)&&isPlainObject(b)){const j={...a};for(const [l,m]of Object['entries'](b)){j[l]=mergeJudgmentValues(a[l],m);}return j;}return b===undefined?a:b;}const FACTORY_PATH=fileURLToPath(new URL('../knowledge/baselines/judgment-baselines.json',import.meta.url)),USER_DOC_NAME='judgment.json',LEGACY_USER_DOC_NAME='judgment-baselines.json';export function userJudgmentDocPath(){const a=process['env']['WOWOK_CONFIG_DIR']||getWowMcpDir();return join(a,USER_DOC_NAME);}function resolveUserDocPath(){const a=process['env']['WOWOK_CONFIG_DIR']||getWowMcpDir(),b=join(a,USER_DOC_NAME);if(existsSync(b))return b;const c=join(a,LEGACY_USER_DOC_NAME);return existsSync(c)?c:b;}function zodMessage(a){return a['issues']['slice'](0x0,0x5)['map'](b=>(b['path']['join']('.')||'(root)')+':\x20'+b['message'])['join'](';\x20');}function loadFactory(){let a;try{a=readFileSync(FACTORY_PATH,'utf-8');}catch{throw new Error('Judgment\x20baselines\x20document\x20not\x20found\x20(knowledge/baselines/judgment-baselines.json)\x20—\x20broken\x20installation.');}const b=JudgmentDocSchema['parse'](JSON['parse'](a));if(b['version']!==EXPECTED_JUDGMENT_VERSION)throw new Error('Factory\x20judgment\x20document\x20has\x20version\x20'+b['version']+',\x20expected\x20'+EXPECTED_JUDGMENT_VERSION+'\x20—\x20broken\x20installation.');return b;}const FACTORY=loadFactory(),RULE_PACKS_DIR=fileURLToPath(new URL('../knowledge/baselines/rules/',import.meta.url));function loadFactoryRulePacks(){let a=[];try{a=readdirSync(RULE_PACKS_DIR)['filter'](c=>c['endsWith']('.json'));}catch{return{};}const b={};for(const c of a){const d=c['replace'](/\.json$/,''),e=readFileSync(join(RULE_PACKS_DIR,c),'utf-8');b[d]=RuleDomainPackSchema['parse'](JSON['parse'](e));}return b;}const FACTORY_RULE_PACKS=loadFactoryRulePacks();export function factoryRulePack(a){return FACTORY_RULE_PACKS[a]??null;}function withFactoryRulePacks(a){const b=a['rules']??{'domains':{}},c=mergeJudgmentValues(FACTORY_RULE_PACKS,b['domains']??{});return{...a,'rules':{...b,'domains':c}};}function unknownRuleRef(a){for(const [b,c]of Object['entries'](a['rules']?.['domains']??{})){const d=FACTORY_RULE_PACKS[b];if(!d)return'rules.domains:\x20unknown\x20domain\x20\x27'+b+'\x27\x20(not\x20in\x20the\x20factory\x20rule\x20packs\x20—\x20check\x20for\x20a\x20typo)';const e=new Set(d['rules']['map'](f=>f['rule_id']));for(const f of c['rules']){if(!e['has'](f['rule_id']))return'rules.domains.'+b+':\x20unknown\x20rule\x20\x27'+f['rule_id']+'\x27\x20(users\x20may\x20tune\x20or\x20disable\x20factory\x20rules,\x20not\x20invent\x20them)';}}return null;}function unknownDimensionKey(a){for(const b of Object['keys'](a['evaluation']['weights'])){if(!(b in FACTORY['evaluation']['weights']))return'evaluation.weights:\x20unknown\x20dimension\x20\x27'+b+'\x27\x20(not\x20in\x20the\x20factory\x20document\x20—\x20check\x20for\x20a\x20typo)';}for(const c of Object['keys'](a['evaluation']['dimensions'])){if(!(c in FACTORY['evaluation']['dimensions']))return'evaluation.dimensions:\x20unknown\x20dimension\x20\x27'+c+'\x27\x20(not\x20in\x20the\x20factory\x20document\x20—\x20check\x20for\x20a\x20typo)';}return null;}function unknownGameRef(a){for(const d of Object['keys'](a['game']['role_interests'])){if(!(d in FACTORY['game']['role_interests']))return'game.role_interests:\x20unknown\x20role\x20\x27'+d+'\x27\x20(not\x20in\x20the\x20factory\x20document\x20—\x20check\x20for\x20a\x20typo)';}for(const f of Object['keys'](a['game']['outcome_semantics'])){if(!(f in FACTORY['game']['outcome_semantics']))return'game.outcome_semantics:\x20unknown\x20outcome\x20\x27'+f+'\x27\x20(not\x20in\x20the\x20factory\x20document\x20—\x20check\x20for\x20a\x20typo)';}const b=new Set(Object['values'](FACTORY['game']['outcome_semantics'])['flat']());for(const g of a['game']['keyword_rules']){if(!b['has'](g['effect']))return'game.keyword_rules.'+g['id']+':\x20unknown\x20effect\x20\x27'+g['effect']+'\x27\x20(must\x20be\x20an\x20effect\x20defined\x20in\x20game.outcome_semantics)';}const c=a['game']['arb'];if(c){const h=FACTORY['game']['arb'];for(const j of Object['keys'](c['role_interests'])){if(!(j in h['role_interests']))return'game.arb.role_interests:\x20unknown\x20perspective\x20\x27'+j+'\x27\x20(not\x20in\x20the\x20factory\x20document\x20—\x20check\x20for\x20a\x20typo)';}const i=new Set(Object['keys'](h['effect_semantics']));for(const k of c['keyword_rules']){if(!i['has'](k['effect']))return'game.arb.keyword_rules.'+k['id']+':\x20unknown\x20effect\x20\x27'+k['effect']+'\x27\x20(must\x20be\x20an\x20effect\x20defined\x20in\x20game.arb.effect_semantics)';}for(const [l,m]of Object['entries'](c['role_interests'])){for(const n of[...m['prefer'],...m['avoid']]){if(!i['has'](n))return'game.arb.role_interests.'+l+':\x20unknown\x20effect\x20\x27'+n+'\x27\x20(must\x20be\x20an\x20effect\x20defined\x20in\x20game.arb.effect_semantics)';}}}return null;}function unknownScorecardRef(a){for(const b of Object['keys'](a['scorecard']['metrics'])){if(!(b in FACTORY['scorecard']['metrics']))return'scorecard.metrics:\x20unknown\x20metric\x20\x27'+b+'\x27\x20(not\x20in\x20the\x20factory\x20document\x20—\x20check\x20for\x20a\x20typo)';}for(const c of a['scorecard']['shop_evidence_metrics']){if(!(c in FACTORY['scorecard']['metrics']))return'scorecard.shop_evidence_metrics:\x20unknown\x20metric\x20\x27'+c+'\x27\x20(not\x20in\x20the\x20factory\x20document\x20—\x20check\x20for\x20a\x20typo)';}return null;}function unknownExposureRef(a){for(const [b,d]of Object['entries'](a['rules']?.['domains']??{})){const e=FACTORY_RULE_PACKS[b];if(!e)continue;const f=new Set(Object['keys'](e['facts']??{}));for(const g of d['rules']){for(const [h,i]of g['cases']['entries']()){const j=parseFactRef(String(i['level']));if(j!==null&&!f['has'](j))return'rules.domains.'+b+'.'+g['rule_id']+'.cases['+h+'].level:\x20unknown\x20fact\x20reference\x20\x27fact:'+j+'\x27\x20(not\x20in\x20the\x20factory\x20\x27'+b+'\x27\x20fact\x20vocabulary)';for(const [k,l]of(i['exposure']?.['gain_paths']??[])['entries']()){const m=parseFactRef(String(l['viability']));if(m!==null&&!f['has'](m))return'rules.domains.'+b+'.'+g['rule_id']+'.cases['+h+'].exposure.gain_paths['+k+'].viability:\x20unknown\x20fact\x20reference\x20\x27fact:'+m+'\x27\x20(not\x20in\x20the\x20factory\x20\x27'+b+'\x27\x20fact\x20vocabulary)';}}}}return null;}let userState=null,lastReloadError=null,effectiveCache=null;function invalidate(){effectiveCache=null;}function probeUserDoc(){const a=resolveUserDocPath();let b=null,c=0x0;try{b=readFileSync(a,'utf-8'),c=statSync(a)['mtimeMs'];}catch{b=null;}if(b===null){if(userState!==null||lastReloadError!==null)return userState=null,lastReloadError=null,invalidate(),!![];return![];}if(userState&&userState['raw']===b)return![];try{const d=JSON['parse'](b),f=JudgmentDocInputSchema['parse'](d);if(f['version']!==EXPECTED_JUDGMENT_VERSION)throw new Error('version:\x20unsupported\x20document\x20version\x20'+f['version']+'\x20(expected\x20'+EXPECTED_JUDGMENT_VERSION+')');const g=withFactoryRulePacks(mergeJudgmentValues(FACTORY,f)),h=unknownDimensionKey(g)??unknownRuleRef(g)??unknownExposureRef(g)??unknownGameRef(g)??unknownScorecardRef(g);if(h)throw new Error(h);const i=JudgmentDocSchema['safeParse'](g);if(!i['success'])throw new Error('schema:\x20'+zodMessage(i['error']));return userState={'raw':b,'mtimeMs':c,'doc':f},lastReloadError=null,invalidate(),!![];}catch(j){return lastReloadError=j instanceof z['ZodError']?'schema:\x20'+zodMessage(j):j instanceof Error?j['message']:String(j),![];}}function effective(){if(!effectiveCache){let a=withFactoryRulePacks(mergeJudgmentValues(mergeJudgmentValues(FACTORY,layerSlots['industry']?.['fragment']??{}),layerSlots['persona']?.['fragment']??{}));a=mergeJudgmentValues(a,userState?.['doc']??{});for(const [b,c]of overrides){a=applyPath(a,b,c);}effectiveCache=JudgmentDocSchema['parse'](a);}return effectiveCache;}const layerSlots={'persona':null,'industry':null},layerErrors={'persona':null,'industry':null};let disableTrace=[];function recordDisableTrace(a,b,c){disableTrace=disableTrace['filter'](d=>d['layer']!==b);for(const [d,e]of Object['entries'](c['rules']?.['domains']??{})){for(const f of e['rules']??[]){f['enabled']===![]&&disableTrace['push']({'layer':b,'domain':d,'rule_id':f['rule_id']});}}}function parseLayerFragment(a,b){let c;try{c=JudgmentFragmentSchema['parse'](a);}catch(h){return{'error':b+':\x20'+(h instanceof z['ZodError']?zodMessage(h):String(h))};}if(c['version']!==undefined&&c['version']!==EXPECTED_JUDGMENT_VERSION)return{'error':b+':\x20unsupported\x20fragment\x20version\x20'+c['version']+'\x20(expected\x20'+EXPECTED_JUDGMENT_VERSION+')'};const d=withFactoryRulePacks(mergeJudgmentValues(FACTORY,c)),f=unknownDimensionKey(d)??unknownRuleRef(d)??unknownExposureRef(d)??unknownGameRef(d)??unknownScorecardRef(d);if(f)return{'error':b+':\x20'+f};const g=JudgmentDocSchema['safeParse'](d);if(!g['success'])return{'error':b+':\x20schema:\x20'+zodMessage(g['error'])};return{'fragment':c};}function setLayerFragment(a,b,c){if(b===null||b===undefined)return(layerSlots[a]!==null||layerErrors[a]!==null)&&(layerSlots[a]=null,layerErrors[a]=null,disableTrace=disableTrace['filter'](f=>f['layer']!==c),invalidate()),{'ok':!![]};let d;try{d=JSON['stringify'](b)??'';}catch{return{'ok':![],'error':c+':\x20fragment\x20is\x20not\x20JSON-serializable'};}if(layerSlots[a]?.['raw']===d)return{'ok':!![]};const e=parseLayerFragment(b,c);if(e['error']||!e['fragment'])return layerErrors[a]=e['error']??'rejected',{'ok':![],'error':layerErrors[a]??undefined};return layerSlots[a]={'raw':d,'fragment':e['fragment'],'label':c},layerErrors[a]=null,recordDisableTrace(a,c,e['fragment']),invalidate(),{'ok':!![]};}export function setJudgmentPersonaFragment(a,b='persona'){return setLayerFragment('persona',a,b);}export function setJudgmentIndustryOverlay(a,b='industry\x20packs'){return setLayerFragment('industry',a,b);}export function judgmentLayerError(a){return layerErrors[a];}export function validateJudgmentFragment(a,b='judgment'){return parseLayerFragment(a,b)['error']??null;}export function judgmentDisableTrace(){return disableTrace['map'](a=>({...a}));}export function clearJudgmentLayers(){layerSlots['persona']=null,layerSlots['industry']=null,layerErrors['persona']=null,layerErrors['industry']=null,disableTrace=[],invalidate();}const overrides=new Map();function resolvePath(a,b){let c=a;for(const d of b){if(!isPlainObject(c))return undefined;c=c[d];if(c===undefined)return undefined;}return c;}function applyPath(a,b,c){const d=b['split']('.'),e=structuredClone(a);let f=e;for(let g=0x0;g<d['length']-0x1;g++){f=f[d[g]];}return f[d[d['length']-0x1]]=c,e;}function typeName(a){if(Array['isArray'](a))return'array';if(a===null)return'null';return typeof a;}function sameShape(a,b){const c=typeName(a),d=typeName(b);if(c==='object'&&d==='object')return isPlainObject(a)&&isPlainObject(b);return c===d;}export function setJudgmentOverride(a,b){const c=typeof a==='string'?a['trim']():'';if(!c)return{'ok':![],'error':'\x27path\x27\x20is\x20required\x20(dotted,\x20e.g.\x20evaluation.weights.trust_reviews)'};if(b===undefined||b===null||!(typeof b==='number'||typeof b==='string'||typeof b==='boolean'||Array['isArray'](b)||isPlainObject(b)))return{'ok':![],'error':'\x27value\x27\x20must\x20be\x20a\x20JSON\x20value\x20(number\x20/\x20string\x20/\x20boolean\x20/\x20array\x20/\x20object)'};const d=c['split']('.')['filter'](Boolean),f=d[0x0];if(!JUDGMENT_SECTION_NAMES['includes'](f))return{'ok':![],'error':'Unknown\x20section\x20\x27'+f+'\x27\x20—\x20sections:\x20'+JUDGMENT_SECTION_NAMES['join'](',\x20')};probeUserDoc();const g=resolvePath(effective(),d);if(g===undefined)return{'ok':![],'error':'Unknown\x20judgment\x20path\x20\x27'+c+'\x27'};if(!sameShape(g,b))return{'ok':![],'error':'Type\x20mismatch\x20at\x20\x27'+c+'\x27\x20—\x20expected\x20'+typeName(g)+',\x20got\x20'+typeName(b)};try{JudgmentDocSchema['parse'](applyPath(effective(),c,b));}catch(h){return{'ok':![],'error':'Rejected:\x20'+(h instanceof z['ZodError']?zodMessage(h):h instanceof Error?h['message']:String(h))};}return overrides['set'](c,b),invalidate(),{'ok':!![]};}export function clearJudgmentOverride(a){const b=overrides['delete'](typeof a==='string'?a['trim']():'');if(b)invalidate();return b;}export function clearJudgmentOverrides(){const a=overrides['size'];return a>0x0&&(overrides['clear'](),invalidate()),a;}export function judgmentOverrides(){return Array['from'](overrides['entries']())['map'](([a,b])=>({'path':a,'value':b}));}export function getJudgmentDoc(){return probeUserDoc(),structuredClone(effective());}let policyRunDoc=null;export function beginPolicyRun(){policyRunDoc=getJudgmentDoc();}export function endPolicyRun(){policyRunDoc=null;}export function policyJudgmentDoc(){return policyRunDoc??getJudgmentDoc();}export function evaluationSection(){return getJudgmentDoc()['evaluation'];}export function factoryJudgmentDoc(){return structuredClone(withFactoryRulePacks(FACTORY));}export function readUserJudgmentDocView(){probeUserDoc();if(userState)return{'user_path':userJudgmentDocPath(),'exists':!![],'version':EXPECTED_JUDGMENT_VERSION,'doc':structuredClone(userState['doc'])};return{'user_path':userJudgmentDocPath(),'exists':![],'version':EXPECTED_JUDGMENT_VERSION,'doc':factoryJudgmentDoc()};}export function judgmentStatus(){probeUserDoc();const a=effective(),b={};for(const c of JUDGMENT_SECTION_NAMES){const d=a[c];if(c==='rules'&&isPlainObject(d)){const e=d['domains']??{};b[c]=Object['values'](e)['reduce']((f,g)=>f+(Array['isArray'](g['rules'])?g['rules']['length']:0x0),0x0);continue;}b[c]=Array['isArray'](d)?d['length']:isPlainObject(d)?Object['keys'](d)['length']:0x0;}return{'version':a['version'],'factory_path':FACTORY_PATH,'user_path':userJudgmentDocPath(),'user_doc_loaded':userState!==null,'user_mtime':userState?new Date(userState['mtimeMs'])['toISOString']():null,'last_reload_error':lastReloadError,'user_doc':userState?structuredClone(userState['doc']):null,'persona_fragment_loaded':layerSlots['persona']!==null,'industry_overlay_loaded':layerSlots['industry']!==null,'layer_errors':{'persona':layerErrors['persona'],'industry':layerErrors['industry']},'disable_trace':judgmentDisableTrace(),'sections':b,'overrides':judgmentOverrides()};}function jsonEqual(c,d){if(c===d)return!![];if(Array['isArray'](c)&&Array['isArray'](d))return JSON['stringify'](c)===JSON['stringify'](d);if(isPlainObject(c)&&isPlainObject(d)){const e=Object['keys'](c);if(e['length']!==Object['keys'](d)['length'])return![];return e['every'](f=>f in d&&jsonEqual(c[f],d[f]));}return![];}function collectChanges(a,c,d,e){if(isPlainObject(c)){const f=isPlainObject(a)?a:{};for(const [g,h]of Object['entries'](c)){collectChanges(f[g],h,d?d+'.'+g:g,e);}return;}!jsonEqual(a,c)&&e['push']({'path':d||'(root)','old':a===undefined?null:a,'new':c});}export function patchUserJudgmentDoc(a){const b=userJudgmentDocPath(),c=join(dirname(b),'judgment.backup.json'),d=resolveUserDocPath();if(!isPlainObject(a))throw new Error('\x27patch\x27\x20must\x20be\x20a\x20partial\x20judgment\x20document\x20object\x20(e.g.\x20{\x22evaluation\x22:\x20{\x22weights\x22:\x20{…}}})');if(a['version']!==undefined&&a['version']!==EXPECTED_JUDGMENT_VERSION)throw new Error('patch.version:\x20unsupported\x20version\x20'+String(a['version'])+'\x20(expected\x20'+EXPECTED_JUDGMENT_VERSION+')');const {version:f,...g}=a;let h;try{h=JudgmentFragmentSchema['parse'](g);}catch(r){throw new Error('patch\x20rejected:\x20'+(r instanceof z['ZodError']?zodMessage(r):r instanceof Error?r['message']:String(r)));}if(Object['keys'](h)['length']===0x0)throw new Error('\x27patch\x27\x20is\x20empty\x20—\x20nothing\x20to\x20apply\x20(sections:\x20'+JUDGMENT_SECTION_NAMES['join'](',\x20')+')');let i=null,j=![];try{const s=readFileSync(d,'utf-8');j=!![];const t=JSON['parse'](s);i=JudgmentDocInputSchema['parse'](t);}catch(u){if(j)throw new Error('the\x20current\x20user\x20document\x20is\x20not\x20a\x20valid\x20judgment\x20document\x20('+(u instanceof Error?u['message']:String(u))+')\x20—\x20fix\x20or\x20remove\x20'+d+'\x20by\x20hand\x20first');i=null;}const k=mergeJudgmentValues(i??{'version':EXPECTED_JUDGMENT_VERSION},h);k['version']=EXPECTED_JUDGMENT_VERSION;const l=withFactoryRulePacks(mergeJudgmentValues(FACTORY,k)),m=unknownDimensionKey(l)??unknownRuleRef(l)??unknownExposureRef(l)??unknownGameRef(l)??unknownScorecardRef(l);if(m)throw new Error('patch\x20rejected:\x20'+m);const n=JudgmentDocSchema['safeParse'](l);if(!n['success'])throw new Error('patch\x20rejected:\x20schema:\x20'+zodMessage(n['error']));const o=[];collectChanges(i??{},h,'',o);if(o['length']===0x0)return{'applied':!![],'user_path':b,'backup_path':null,'version':EXPECTED_JUDGMENT_VERSION,'changed':o,'reload_error':null};const p=JSON['stringify'](k,null,0x2)+'\x0a';mkdirSync(dirname(b),{'recursive':!![]});if(j)copyFileSync(d,c);const q=b+'.tmp';writeFileSync(q,p,'utf-8'),renameSync(q,b);try{userState={'raw':p,'mtimeMs':statSync(b)['mtimeMs'],'doc':k},lastReloadError=null;}catch(v){lastReloadError=v instanceof Error?v['message']:String(v);}return invalidate(),{'applied':!![],'user_path':b,'backup_path':j?c:null,'version':EXPECTED_JUDGMENT_VERSION,'changed':o,'reload_error':lastReloadError};}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{afterEach,beforeEach,describe,expect,it}from'vitest';import{existsSync,mkdtempSync,readFileSync,rmSync,statSync,writeFileSync}from'node:fs';import{tmpdir}from'node:os';import{join}from'node:path';import{EXPECTED_JUDGMENT_VERSION,clearJudgmentOverride,clearJudgmentOverrides,clearJudgmentLayers,getJudgmentDoc,judgmentDisableTrace,judgmentLayerError,judgmentOverrides,judgmentStatus,mergeJudgmentValues,patchUserJudgmentDoc,readUserJudgmentDocView,setJudgmentIndustryOverlay,setJudgmentOverride,setJudgmentPersonaFragment,userJudgmentDocPath}from'./judgment.js';import{defaultWeights}from'../evaluation/standards.js';import{checkUtilRisks}from'../knowledge/util-risk.js';import{appetiteMultiplier,evaluateOutcome,interestsOf,resolveInterests}from'../evaluation/game-strategy.js';import{monitorOrder}from'../customer/order-monitor.js';import{scoreMetricValue,scoreScorecard}from'../strategy/scorecard.js';import{evaluateArbGame}from'../evaluation/arbitration-game.js';let configDir;function userDocPath(){return join(configDir,'judgment.json');}function writeUserDoc(a){writeFileSync(userDocPath(),JSON['stringify'](a,null,0x2),'utf-8');}function userDocText(){return readFileSync(userDocPath(),'utf-8');}beforeEach(()=>{configDir=mkdtempSync(join(tmpdir(),'wowok-judgment-')),process['env']['WOWOK_CONFIG_DIR']=configDir;}),afterEach(()=>{delete process['env']['WOWOK_CONFIG_DIR'];if(existsSync(configDir))rmSync(configDir,{'recursive':!![],'force':!![]});clearJudgmentOverrides(),clearJudgmentLayers();}),describe('judgment\x20baselines\x20—\x20factory\x20document',()=>{it('loads\x20the\x20factory\x20document\x20with\x20every\x20section\x20present',()=>{const a=getJudgmentDoc();expect(a['version'])['toBe'](EXPECTED_JUDGMENT_VERSION),expect(a['evaluation']['weights']['trust_reviews'])['toBe'](0x23),expect(a['evaluation']['severity_deduction']['critical'])['toBe'](0x32),expect(Object['keys'](a['game']['role_interests']))['toContain']('customer'),expect(a['game']['appetite_multipliers']['conservative'])['toBe'](1.5),expect(a['match']['region_scores']['exact'])['toBe'](0x64),expect(a['match']['top_n'])['toBe'](0x5),expect(a['monitor']['thresholds']['messenger_timeout_hours'])['toBe'](0x18),expect(a['mode']['appetite_thresholds']['balanced'])['toEqual']({'max_risk':0x3c,'min_benefit':0x3c}),expect(Object['keys'](a['scorecard']['metrics']))['toContain']('order_count'),expect(a['scorecard']['metrics']['order_count']?.['good_threshold'])['toBe'](0x14),expect(a['scorecard']['shop_evidence_metrics'])['toContain']('completion_rate'),expect(Object['keys'](a['rules']['domains']))['toContain']('util');}),it('reports\x20a\x20healthy\x20status\x20with\x20the\x20user\x20document\x20absent',()=>{const a=judgmentStatus();expect(a['user_doc_loaded'])['toBe'](![]),expect(a['last_reload_error'])['toBeNull'](),expect(a['user_path'])['toBe'](userJudgmentDocPath()),expect(a['sections']['evaluation'])['toBeGreaterThan'](0x0);});}),describe('judgment\x20baselines\x20—\x20user\x20document\x20(hot\x20reload\x20+\x20merge)',()=>{it('merges\x20user\x20keys\x20over\x20the\x20factory\x20at\x20key\x20granularity\x20(no\x20deletion)',()=>{writeUserDoc({'version':0x1,'evaluation':{'weights':{'trust_reviews':0x2d}}});const a=getJudgmentDoc();expect(a['evaluation']['weights']['trust_reviews'])['toBe'](0x2d),expect(a['evaluation']['weights']['trust_arbitration'])['toBe'](0x14),expect(a['evaluation']['dimensions']['trust_reviews']?.['label'])['toBe']('Reputation'),expect(a['evaluation']['severity_deduction']['high'])['toBe'](0x19),expect(a['evaluation']['level_bands'][0x0])['toEqual']({'min':0x55,'level':'low'});}),it('reflects\x20a\x20document\x20edit\x20on\x20the\x20next\x20read\x20—\x20no\x20restart\x20(Q6)',()=>{writeUserDoc({'version':0x1,'evaluation':{'weights':{'trust_reviews':0x2d}}}),expect(getJudgmentDoc()['evaluation']['weights']['trust_reviews'])['toBe'](0x2d),writeUserDoc({'version':0x1,'evaluation':{'weights':{'trust_reviews':0x32}}}),expect(defaultWeights()['trust_reviews'])['toBe'](0x32);}),it('keeps\x20the\x20last\x20good\x20document\x20when\x20an\x20edit\x20is\x20invalid\x20(parse\x20error)',()=>{writeUserDoc({'version':0x1,'evaluation':{'weights':{'trust_reviews':0x2d}}}),expect(getJudgmentDoc()['evaluation']['weights']['trust_reviews'])['toBe'](0x2d),writeFileSync(userDocPath(),'{\x20not\x20json','utf-8');const a=getJudgmentDoc();expect(a['evaluation']['weights']['trust_reviews'])['toBe'](0x2d);const b=judgmentStatus();expect(b['last_reload_error'])['toBeTruthy'](),expect(b['user_doc_loaded'])['toBe'](!![]);}),it('rejects\x20unknown\x20keys\x20and\x20wrong\x20section\x20shapes\x20loudly',()=>{writeUserDoc({'version':0x1,'evaluation':{'weights':{'trust_reviews':0x2d,'typoed_weight':0x1}}}),getJudgmentDoc(),expect(judgmentStatus()['last_reload_error'])['toMatch'](/unknown dimension 'typoed_weight'/),expect(getJudgmentDoc()['evaluation']['weights']['trust_reviews'])['toBe'](0x2d),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('gates\x20on\x20the\x20document\x20version',()=>{writeUserDoc({'version':0x63,'evaluation':{'weights':{'trust_reviews':0x2d}}}),getJudgmentDoc(),expect(judgmentStatus()['last_reload_error'])['toMatch'](/version/),expect(getJudgmentDoc()['evaluation']['weights']['trust_reviews'])['toBe'](0x2d);}),it('recovers\x20when\x20the\x20invalid\x20edit\x20is\x20fixed,\x20and\x20unloads\x20when\x20the\x20file\x20is\x20removed',()=>{writeUserDoc({'version':0x63}),getJudgmentDoc(),expect(judgmentStatus()['last_reload_error'])['toMatch'](/version/),writeUserDoc({'version':0x1,'evaluation':{'weights':{'trust_reviews':0x2a}}}),expect(getJudgmentDoc()['evaluation']['weights']['trust_reviews'])['toBe'](0x2a),expect(judgmentStatus()['last_reload_error'])['toBeNull'](),rmSync(userDocPath()),expect(getJudgmentDoc()['evaluation']['weights']['trust_reviews'])['toBe'](0x23);const a=judgmentStatus();expect(a['user_doc_loaded'])['toBe'](![]),expect(a['last_reload_error'])['toBeNull']();});}),describe('judgment\x20baselines\x20—\x20user\x20document\x20patch\x20channel\x20(judgment_doc_patch)',()=>{it('merges\x20a\x20patch\x20into\x20the\x20user\x20document\x20and\x20the\x20change\x20is\x20in\x20force\x20immediately',()=>{const a=patchUserJudgmentDoc({'evaluation':{'weights':{'trust_reviews':0x2d}}});expect(a['applied'])['toBe'](!![]),expect(a['user_path'])['toBe'](userJudgmentDocPath()),expect(a['backup_path'])['toBeNull'](),expect(a['changed'])['toEqual']([{'path':'evaluation.weights.trust_reviews','old':null,'new':0x2d}]),expect(getJudgmentDoc()['evaluation']['weights']['trust_reviews'])['toBe'](0x2d);const b=JSON['parse'](userDocText());expect(b['version'])['toBe'](EXPECTED_JUDGMENT_VERSION);}),it('reads\x20the\x20legacy\x20judgment-baselines.json\x20and\x20writes\x20the\x20new\x20judgment.json\x20on\x20patch',()=>{const a=join(configDir,'judgment-baselines.json');writeFileSync(a,JSON['stringify']({'version':0x1,'evaluation':{'weights':{'trust_reviews':0x2d}}},null,0x2),'utf-8'),expect(getJudgmentDoc()['evaluation']['weights']['trust_reviews'])['toBe'](0x2d);const b=patchUserJudgmentDoc({'evaluation':{'weights':{'trust_reviews':0x32}}});expect(b['user_path'])['toBe'](userDocPath()),expect(existsSync(userDocPath()))['toBe'](!![]),expect(JSON['parse'](readFileSync(a,'utf-8')))['toEqual']({'version':0x1,'evaluation':{'weights':{'trust_reviews':0x2d}}}),expect(getJudgmentDoc()['evaluation']['weights']['trust_reviews'])['toBe'](0x32),expect(judgmentStatus()['user_doc_loaded'])['toBe'](!![]);}),it('reports\x20old\x20values\x20from\x20the\x20CURRENT\x20user\x20document\x20and\x20backs\x20it\x20up',()=>{patchUserJudgmentDoc({'evaluation':{'weights':{'trust_reviews':0x2d}}});const a=patchUserJudgmentDoc({'evaluation':{'weights':{'trust_reviews':0x32}}});expect(a['changed'])['toEqual']([{'path':'evaluation.weights.trust_reviews','old':0x2d,'new':0x32}]),expect(a['backup_path'])['toBeTruthy'](),expect(existsSync(a['backup_path']))['toBe'](!![]);const b=JSON['parse'](readFileSync(a['backup_path'],'utf-8'));expect(b['evaluation']?.['weights']?.['trust_reviews'])['toBe'](0x2d),expect(getJudgmentDoc()['evaluation']['weights']['trust_reviews'])['toBe'](0x32);}),it('rejects\x20a\x20patch\x20without\x20touching\x20the\x20file',()=>{writeUserDoc({'version':0x1,'evaluation':{'weights':{'trust_reviews':0x2d}}}),expect(()=>patchUserJudgmentDoc({'evaluation':{'weights':{'typoed_weight':0x1}}}))['toThrow'](/unknown dimension 'typoed_weight'/),expect(()=>patchUserJudgmentDoc({'rules':{'domains':{'util':{'rules':[{'rule_id':'INVENTED','enabled':![]}]}}}}))['toThrow'](/unknown rule|not a valid judgment fragment|INVENTED/i),expect(()=>patchUserJudgmentDoc({'version':0x63}))['toThrow'](/version/);const a=JSON['parse'](userDocText());expect(a['evaluation']?.['weights']?.['trust_reviews'])['toBe'](0x2d),expect(judgmentStatus()['last_reload_error'])['toBeNull']();}),it('refuses\x20to\x20patch\x20on\x20top\x20of\x20a\x20hand-broken\x20user\x20document',()=>{writeFileSync(userDocPath(),'{\x20not\x20json','utf-8'),expect(()=>getJudgmentDoc())['not']['toThrow'](),expect(()=>patchUserJudgmentDoc({'evaluation':{'weights':{'trust_reviews':0x2d}}}))['toThrow'](/not a valid judgment document/);}),it('is\x20a\x20no-op\x20when\x20the\x20patch\x20would\x20change\x20nothing',()=>{patchUserJudgmentDoc({'evaluation':{'weights':{'trust_reviews':0x2d}}});const a=statSync(userDocPath())['mtimeMs'],b=patchUserJudgmentDoc({'evaluation':{'weights':{'trust_reviews':0x2d}}});expect(b['changed'])['toEqual']([]),expect(b['backup_path'])['toBeNull'](),expect(statSync(userDocPath())['mtimeMs'])['toBe'](a);});}),describe('judgment\x20baselines\x20—\x20editable\x20view\x20(judgment_doc_read)',()=>{it('serves\x20the\x20full\x20factory\x20document\x20when\x20no\x20user\x20document\x20exists',()=>{const a=readUserJudgmentDocView();expect(a['exists'])['toBe'](![]),expect(a['user_path'])['toBe'](userJudgmentDocPath()),expect(a['version'])['toBe'](EXPECTED_JUDGMENT_VERSION);const b=a['doc'];expect(b['version'])['toBe'](EXPECTED_JUDGMENT_VERSION),expect(b['evaluation']?.['weights']?.['trust_reviews'])['toBe'](0x23),expect(Object['keys'](b['rules']?.['domains']??{}))['toContain']('util');}),it('serves\x20the\x20current\x20user\x20document\x20once\x20one\x20exists,\x20and\x20survives\x20a\x20hot\x20reload',()=>{writeUserDoc({'version':0x1,'evaluation':{'weights':{'trust_reviews':0x2d}}}),getJudgmentDoc();const a=readUserJudgmentDocView();expect(a['exists'])['toBe'](!![]);const b=a['doc'];expect(b['evaluation']?.['weights']?.['trust_reviews'])['toBe'](0x2d),expect(Object['keys'](b['evaluation']?.['weights']??{}))['toEqual'](['trust_reviews']),writeUserDoc({'version':0x1,'evaluation':{'weights':{'trust_reviews':0x32}}}),expect(readUserJudgmentDocView()['doc']['evaluation']?.['weights']?.['trust_reviews'])['toBe'](0x32);}),it('round-trips:\x20the\x20factory\x20view\x20can\x20be\x20saved\x20back\x20as\x20a\x20valid\x20user\x20document',()=>{const a=readUserJudgmentDocView(),{version:b,...c}=a['doc'];expect(()=>patchUserJudgmentDoc(c))['not']['toThrow'](),expect(existsSync(userDocPath()))['toBe'](!![]);const d=readUserJudgmentDocView();expect(d['exists'])['toBe'](!![]);});}),describe('judgment\x20baselines\x20—\x20session\x20runtime\x20overrides',()=>{it('overrides\x20one\x20value\x20above\x20the\x20user\x20document,\x20type-checked',()=>{writeUserDoc({'version':0x1,'evaluation':{'weights':{'trust_reviews':0x2d}}}),getJudgmentDoc();const a=setJudgmentOverride('evaluation.weights.trust_reviews',0x3c);expect(a)['toEqual']({'ok':!![]}),expect(getJudgmentDoc()['evaluation']['weights']['trust_reviews'])['toBe'](0x3c),expect(judgmentOverrides())['toEqual']([{'path':'evaluation.weights.trust_reviews','value':0x3c}]),expect(setJudgmentOverride('evaluation.weights.trust_reviews','high')['ok'])['toBe'](![]),expect(setJudgmentOverride('evaluation.weights.does_not_exist',0x1)['ok'])['toBe'](![]),expect(setJudgmentOverride('bogus.weight',0x1)['ok'])['toBe'](![]),expect(clearJudgmentOverride('evaluation.weights.trust_reviews'))['toBe'](!![]),expect(getJudgmentDoc()['evaluation']['weights']['trust_reviews'])['toBe'](0x2d);}),it('clears\x20all\x20overrides\x20at\x20once',()=>{writeUserDoc({'version':0x1,'evaluation':{'weights':{'trust_reviews':0x2d}}}),getJudgmentDoc(),setJudgmentOverride('evaluation.weights.trust_reviews',0x3c),setJudgmentOverride('evaluation.severity_deduction.critical',0x28),expect(clearJudgmentOverrides())['toBe'](0x2),expect(getJudgmentDoc()['evaluation']['weights']['trust_reviews'])['toBe'](0x2d),expect(getJudgmentDoc()['evaluation']['severity_deduction']['critical'])['toBe'](0x32);});}),describe('judgment\x20baselines\x20—\x20rules\x20namespace\x20(declarative\x20rule\x20book)',()=>{it('loads\x20the\x20util\x20factory\x20pack\x20and\x20evaluates\x20through\x20the\x20live\x20book',()=>{const a=getJudgmentDoc();expect(a['rules']['domains']['util']?.['rules']['map'](c=>c['rule_id']))['toEqual'](['R-UTIL-01','R-UTIL-02','R-UTIL-03','R-UTIL-04','R-UTIL-05']);const b=Object['values'](a['rules']['domains'])['reduce']((c,e)=>c+e['rules']['length'],0x0);expect(b)['toBeGreaterThan'](0x0),expect(judgmentStatus()['sections']['rules'])['toBe'](b),expect(checkUtilRisks({'large_util_import':!![]})['map'](c=>c['id']))['toEqual'](['R-UTIL-03']);}),it('disables\x20a\x20factory\x20rule\x20via\x20a\x20disable-only\x20override\x20—\x20silent\x20+\x20trace\x20(Q12)',()=>{writeUserDoc({'version':0x1,'rules':{'domains':{'util':{'rules':[{'rule_id':'R-UTIL-03','enabled':![]}]}}}}),getJudgmentDoc(),expect(checkUtilRisks({'large_util_import':!![],'expects_util_events':!![]})['map'](b=>b['id']))['toEqual'](['R-UTIL-04']);const a=getJudgmentDoc()['rules']['domains']['util']?.['rules']['find'](b=>b['rule_id']==='R-UTIL-03');expect(a?.['enabled'])['toBe'](![]),expect(a?.['cases']['length'])['toBeGreaterThan'](0x0);}),it('rejects\x20an\x20invented\x20domain\x20with\x20a\x20loud\x20error',()=>{writeUserDoc({'version':0x1,'rules':{'domains':{'typoed_domain':{'rules':[]}}}}),getJudgmentDoc(),expect(judgmentStatus()['last_reload_error'])['toContain']('unknown\x20domain\x20\x27typoed_domain\x27');}),it('rejects\x20an\x20invented\x20rule\x20id\x20inside\x20a\x20known\x20domain',()=>{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');});}),describe('judgment\x20baselines\x20—\x20merge\x20kernel',()=>{it('merges\x20plain\x20objects\x20recursively\x20and\x20replaces\x20non-id\x20arrays',()=>{const a=mergeJudgmentValues({'a':{'x':0x1,'y':0x2},'bands':[{'min':0x1,'level':'l'}]},{'a':{'y':0x3},'bands':[{'min':0x0,'level':'zero'}]});expect(a['a'])['toEqual']({'x':0x1,'y':0x3}),expect(a['bands'])['toEqual']([{'min':0x0,'level':'zero'}]);}),it('merges\x20id-bearing\x20arrays\x20by\x20entry\x20id\x20and\x20never\x20deletes\x20base\x20entries',()=>{const a=mergeJudgmentValues({'rules':[{'rule_id':'r1','severity':'high'},{'rule_id':'r2','severity':'low'}]},{'rules':[{'rule_id':'r1','severity':'critical'},{'rule_id':'r3','severity':'medium'}]}),b=new Map(a['rules']['map'](c=>[c['rule_id'],c['severity']]));expect(b['get']('r1'))['toBe']('critical'),expect(b['get']('r2'))['toBe']('low'),expect(b['get']('r3'))['toBe']('medium'),expect(a['rules'])['toHaveLength'](0x3);});}),describe('judgment\x20baselines\x20—\x20phase-3\x20sections\x20(game\x20/\x20match\x20/\x20monitor\x20/\x20mode)',()=>{it('game:\x20a\x20session\x20override\x20to\x20the\x20scoring\x20constants\x20flows\x20into\x20evaluateOutcome\x20hot',()=>{expect(evaluateOutcome('refund','customer')['net_score'])['toBe'](0x50);const a=setJudgmentOverride('game.scoring.per_gain',0x28);expect(a)['toEqual']({'ok':!![]}),expect(evaluateOutcome('refund','customer')['net_score'])['toBe'](0x64),clearJudgmentOverride('game.scoring.per_gain'),expect(evaluateOutcome('refund','customer')['net_score'])['toBe'](0x50);}),it('game:\x20appetite\x20multipliers\x20are\x20live\x20data\x20(Q8\x20numeric\x20rail)',()=>{expect(appetiteMultiplier('conservative'))['toBe'](1.5),setJudgmentOverride('game.appetite_multipliers.conservative',2.5),expect(appetiteMultiplier('conservative'))['toBe'](2.5);const a={'risk_appetite':'conservative','requirements':['never\x20arbitrate']},b=resolveInterests('customer',a);expect(b['sensitivity'])['toBeCloseTo'](2.5,0x5),clearJudgmentOverride('game.appetite_multipliers.conservative'),expect(appetiteMultiplier('conservative'))['toBe'](1.5);}),it('game:\x20a\x20user\x20document\x20can\x20retune\x20one\x20role\x27s\x20anchors\x20(key-granularity)',()=>{writeUserDoc({'version':0x1,'game':{'role_interests':{'customer':{'prefer':['node_advanced'],'avoid':[],'sensitivity':0x1}}}}),expect(interestsOf('customer')['prefer'])['toEqual'](['node_advanced']),expect(interestsOf('merchant')['prefer'])['toEqual'](['fund_released_to_merchant']);}),it('game:\x20the\x20Q5\x20keyword\x20dictionary\x20is\x20data\x20—\x20a\x20user\x20rule\x20lands\x20hot',()=>{writeUserDoc({'version':0x1,'game':{'keyword_rules':[{'id':'kw_testing','keywords':['testing'],'effect':'node_advanced','anchor':'prefer','when_forbidden':![]}]}});const a=resolveInterests('arbitrator',{'requirements':['testing\x20please']});expect(a['prefer'])['toContain']('node_advanced'),expect(resolveInterests('arbitrator',{'requirements':['milestone\x20based']})['prefer'])['toContain']('node_advanced');}),it('game:\x20invented\x20vocabulary\x20is\x20rejected\x20loudly\x20(roles\x20/\x20outcomes\x20/\x20keyword\x20effects)',()=>{writeUserDoc({'version':0x1,'game':{'role_interests':{'custmr':{'prefer':[],'avoid':[],'sensitivity':0x1}}}}),getJudgmentDoc(),expect(judgmentStatus()['last_reload_error'])['toContain']('unknown\x20role\x20\x27custmr\x27'),writeUserDoc({'version':0x1,'game':{'outcome_semantics':{'frozen':['fund_frozen']}}}),getJudgmentDoc(),expect(judgmentStatus()['last_reload_error'])['toContain']('unknown\x20outcome\x20\x27frozen\x27'),writeUserDoc({'version':0x1,'game':{'keyword_rules':[{'id':'kw_bad','keywords':['x'],'effect':'fund_frozen_forever','anchor':'avoid','when_forbidden':!![]}]}}),getJudgmentDoc(),expect(judgmentStatus()['last_reload_error'])['toContain']('unknown\x20effect\x20\x27fund_frozen_forever\x27');}),it('monitor:\x20a\x20threshold\x20override\x20changes\x20monitorOrder\x20behavior\x20hot',()=>{const a=0x36ee80,b=0x64*a,c={'order_id':'0xorder','service_id':'0xservice','created_at':b-0x2*a,'now':b,'last_user_message_at':b-0x2*a,'has_messenger':!![],'has_arbitration':![]};expect(monitorOrder({'current':c})['map'](g=>g['id']))['not']['toContain']('messenger_unanswered'),setJudgmentOverride('monitor.thresholds.messenger_timeout_hours',0x1);const d=monitorOrder({'current':c}),e=d['find'](g=>g['id']==='messenger_unanswered');expect(e?.['severity'])['toBe']('high'),setJudgmentOverride('monitor.escalation.messenger_escalation_multiplier',1.5),expect(monitorOrder({'current':c})['find'](g=>g['id']==='messenger_unanswered')?.['severity'])['toBe']('critical'),clearJudgmentOverrides();const f=monitorOrder({'current':c,'thresholds':{'messenger_timeout_hours':0x1}});expect(f['find'](g=>g['id']==='messenger_unanswered')?.['severity'])['toBe']('high');}),it('match\x20and\x20mode:\x20parameter\x20overrides\x20land\x20in\x20the\x20effective\x20document',()=>{setJudgmentOverride('match.neutral_score',0x1e),setJudgmentOverride('match.top_n',0x3),setJudgmentOverride('mode.appetite_thresholds.aggressive',{'max_risk':0x5a,'min_benefit':0x46});const a=getJudgmentDoc();expect(a['match']['neutral_score'])['toBe'](0x1e),expect(a['match']['top_n'])['toBe'](0x3),expect(a['mode']['appetite_thresholds']['aggressive'])['toEqual']({'max_risk':0x5a,'min_benefit':0x46}),expect(a['match']['region_scores']['exact'])['toBe'](0x64),expect(a['mode']['appetite_thresholds']['balanced'])['toEqual']({'max_risk':0x3c,'min_benefit':0x3c});});}),describe('judgment\x20baselines\x20—\x20scorecard\x20section\x20(Q7\x20one\x20scoring\x20document)',()=>{function a(b){return{'account':'0xshop','industry':'education','network':'testnet','collected_at':0x0,'metrics':[{'id':'order_count','source':'market_operations','status':'ok','value':b,'collected_at':0x0}],'unavailable':[],'errors':[]};}it('scorecard:\x20anchor\x20override\x20changes\x20scoreMetricValue\x20hot',()=>{expect(scoreMetricValue('order_count',12.5))['toBe'](0x32),setJudgmentOverride('scorecard.metrics.order_count.good_threshold',0xf),expect(scoreMetricValue('order_count',12.5))['toBe'](0x4b),clearJudgmentOverride('scorecard.metrics.order_count.good_threshold'),expect(scoreMetricValue('order_count',12.5))['toBe'](0x32);}),it('scorecard:\x20posture\x20weight\x20override\x20flows\x20into\x20scoreScorecard\x20hot',()=>{const b=scoreScorecard(a(12.5),'margin')['metric_scores'][0x0]['weight'];expect(b)['toBe'](0.05),setJudgmentOverride('scorecard.metrics.order_count.weight',{'volume':0.2,'balanced':0.15,'margin':0.5}),expect(scoreScorecard(a(12.5),'margin')['metric_scores'][0x0]['weight'])['toBe'](0.5),clearJudgmentOverride('scorecard.metrics.order_count.weight');}),it('scorecard:\x20shop-evidence\x20gate\x20set\x20is\x20live\x20data',()=>{writeUserDoc({'version':0x1,'scorecard':{'shop_evidence_metrics':['order_count']}}),expect(getJudgmentDoc()['scorecard']['shop_evidence_metrics'])['toEqual'](['order_count']);}),it('scorecard:\x20invented\x20metric\x20ids\x20are\x20rejected\x20loudly',()=>{writeUserDoc({'version':0x1,'scorecard':{'metrics':{'ordr_count':{'good_threshold':0x1}}}}),getJudgmentDoc(),expect(judgmentStatus()['last_reload_error'])['toContain']('unknown\x20metric\x20\x27ordr_count\x27'),writeUserDoc({'version':0x1,'scorecard':{'shop_evidence_metrics':['phantom_metric']}}),getJudgmentDoc(),expect(judgmentStatus()['last_reload_error'])['toContain']('unknown\x20metric\x20\x27phantom_metric\x27');});}),describe('judgment\x20baselines\x20—\x20persona\x20+\x20industry\x20layers\x20(Q4/Q12)',()=>{it('layers\x20merge\x20in\x20precedence\x20order:\x20factory\x20<\x20industry\x20pack\x20<\x20persona\x20<\x20user\x20document',()=>{expect(getJudgmentDoc()['monitor']['thresholds']['messenger_timeout_hours'])['toBe'](0x18),setJudgmentIndustryOverlay({'monitor':{'thresholds':{'messenger_timeout_hours':0x6}}},'pack:education'),expect(getJudgmentDoc()['monitor']['thresholds']['messenger_timeout_hours'])['toBe'](0x6),setJudgmentPersonaFragment({'monitor':{'thresholds':{'messenger_timeout_hours':0xc}}},'persona'),expect(getJudgmentDoc()['monitor']['thresholds']['messenger_timeout_hours'])['toBe'](0xc),writeUserDoc({'version':0x1,'monitor':{'thresholds':{'messenger_timeout_hours':0x30}}}),expect(getJudgmentDoc()['monitor']['thresholds']['messenger_timeout_hours'])['toBe'](0x30),expect(getJudgmentDoc()['monitor']['thresholds']['progress_stall_hours'])['toBe'](0x0);const a=judgmentStatus();expect(a['industry_overlay_loaded'])['toBe'](!![]),expect(a['persona_fragment_loaded'])['toBe'](!![]),expect(a['layer_errors']['persona'])['toBeNull'](),expect(a['layer_errors']['industry'])['toBeNull']();}),it('persona\x20fragment:\x20invalid\x20edit\x20is\x20rejected,\x20last\x20good\x20stays\x20in\x20force,\x20null\x20clears',()=>{setJudgmentPersonaFragment({'game':{'scoring':{'base':0x46}}}),expect(getJudgmentDoc()['game']['scoring']['base'])['toBe'](0x46);const a=setJudgmentPersonaFragment({'game':{'scoring':{'bse':0x1}}});expect(a['ok'])['toBe'](![]),expect(judgmentLayerError('persona'))['toContain']('bse'),expect(getJudgmentDoc()['game']['scoring']['base'])['toBe'](0x46),setJudgmentPersonaFragment(null),expect(judgmentLayerError('persona'))['toBeNull'](),expect(getJudgmentDoc()['game']['scoring']['base'])['toBe'](0x3c);}),it('industry\x20pack:\x20disabling\x20a\x20factory\x20rule\x20leaves\x20a\x20trace\x20and\x20lands\x20in\x20the\x20book\x20(Q12)',()=>{const a=getJudgmentDoc()['rules']['domains']['util']?.['rules'][0x0]?.['rule_id'];expect(a)['toBeTruthy']();const b=setJudgmentIndustryOverlay({'rules':{'domains':{'util':{'rules':[{'rule_id':a,'enabled':![]}]}}}},'pack:education');expect(b['ok'])['toBe'](!![]);const c=getJudgmentDoc()['rules']['domains']['util']?.['rules']['find'](d=>d['rule_id']===a);expect(c?.['enabled'])['toBe'](![]),expect(judgmentDisableTrace())['toEqual']([{'layer':'pack:education','domain':'util','rule_id':a}]),setJudgmentIndustryOverlay({'rules':{'domains':{'util':{'rules':[{'rule_id':a,'enabled':!![]}]}}}},'pack:education'),expect(judgmentDisableTrace())['toEqual']([]);}),it('layers\x20cannot\x20invent\x20rule\x20ids\x20or\x20vocabulary',()=>{const a=setJudgmentIndustryOverlay({'rules':{'domains':{'util':{'rules':[{'rule_id':'R-X-0-99','enabled':![]}]}}}});expect(a['ok'])['toBe'](![]),expect(judgmentLayerError('industry'))['toContain']('unknown\x20rule\x20\x27R-X-0-99\x27'),expect(judgmentStatus()['industry_overlay_loaded'])['toBe'](![]);const b=setJudgmentPersonaFragment({'game':{'role_interests':{'custmr':{'prefer':[],'avoid':[],'sensitivity':0x1}}}});expect(b['ok'])['toBe'](![]),expect(judgmentLayerError('persona'))['toContain']('unknown\x20role\x20\x27custmr\x27');});}),describe('judgment\x20baselines\x20—\x20arb\x20game\x20tunables\x20(game.arb)',()=>{it('factory\x20anchors\x20are\x20live\x20and\x20scoring\x20retunes\x20hot',()=>{expect(getJudgmentDoc()['game']['arb']['scoring'])['toEqual']({'base':0x3c,'per_gain':0x14,'per_risk':0x19}),expect(evaluateArbGame('Finished','arbitrator')['actions'][0x0]?.['gain_score'])['toBe'](0x28),writeUserDoc({'version':0x1,'game':{'arb':{'scoring':{'base':0x3c,'per_gain':0x28,'per_risk':0x19}}}}),expect(evaluateArbGame('Finished','arbitrator')['actions'][0x0]?.['gain_score'])['toBe'](0x50),expect(getJudgmentDoc()['game']['arb']['effect_semantics']['reversal_chance'])['toBeTruthy']();}),it('arb\x20game:\x20invented\x20perspectives\x20and\x20effects\x20are\x20rejected\x20loudly',()=>{writeUserDoc({'version':0x1,'game':{'arb':{'role_interests':{'judge':{'prefer':[],'avoid':[],'sensitivity':0x1}}}}}),getJudgmentDoc(),expect(judgmentStatus()['last_reload_error'])['toContain']('unknown\x20perspective\x20\x27judge\x27'),expect(getJudgmentDoc()['game']['arb']['scoring']['per_gain'])['toBe'](0x28),writeUserDoc({'version':0x1,'game':{'arb':{'keyword_rules':[{'id':'kw_x','keywords':['x'],'effect':'case_won','anchor':'prefer','when_forbidden':![]}]}}}),getJudgmentDoc(),expect(judgmentStatus()['last_reload_error'])['toContain']('unknown\x20effect\x20\x27case_won\x27');});});
|
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { type Severity } from "./severity.js";
|
|
3
|
+
import { type FindingExposure } from "./exposure.js";
|
|
4
|
+
declare const LEAF_OPS: readonly ["present", "missing", "truthy", "falsy", "eq", "neq", "gt", "gte", "lt", "lte", "in", "nin", "contains", "matches", "size"];
|
|
5
|
+
export type RuleLeafOp = (typeof LEAF_OPS)[number];
|
|
6
|
+
export interface RuleLeafCondition {
|
|
7
|
+
field: string;
|
|
8
|
+
op: RuleLeafOp;
|
|
9
|
+
value?: unknown;
|
|
10
|
+
flags?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface RuleAllCondition {
|
|
13
|
+
all: RuleCondition[];
|
|
14
|
+
}
|
|
15
|
+
export interface RuleAnyCondition {
|
|
16
|
+
any: RuleCondition[];
|
|
17
|
+
}
|
|
18
|
+
export interface RuleNotCondition {
|
|
19
|
+
not: RuleCondition;
|
|
20
|
+
}
|
|
21
|
+
export type RuleCondition = RuleLeafCondition | RuleAllCondition | RuleAnyCondition | RuleNotCondition;
|
|
22
|
+
export declare const RuleConditionSchema: z.ZodType<RuleCondition>;
|
|
23
|
+
export declare const RuleCaseSchema: z.ZodObject<{
|
|
24
|
+
when: z.ZodType<RuleCondition, unknown, z.core.$ZodTypeInternals<RuleCondition, unknown>>;
|
|
25
|
+
level: z.ZodType<"low" | "high" | "info" | "critical" | "medium", unknown, z.core.$ZodTypeInternals<"low" | "high" | "info" | "critical" | "medium", unknown>>;
|
|
26
|
+
title: z.ZodString;
|
|
27
|
+
description: z.ZodString;
|
|
28
|
+
scenario: z.ZodOptional<z.ZodString>;
|
|
29
|
+
mitigation: z.ZodOptional<z.ZodString>;
|
|
30
|
+
evidence: z.ZodOptional<z.ZodString>;
|
|
31
|
+
stakeholders: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
32
|
+
exposure: z.ZodOptional<z.ZodObject<{
|
|
33
|
+
loss_parties: z.ZodArray<z.ZodObject<{
|
|
34
|
+
role: z.ZodEnum<{
|
|
35
|
+
merchant: "merchant";
|
|
36
|
+
supplier: "supplier";
|
|
37
|
+
collaborator: "collaborator";
|
|
38
|
+
arbitrator: "arbitrator";
|
|
39
|
+
neutral: "neutral";
|
|
40
|
+
system: "system";
|
|
41
|
+
buyer: "buyer";
|
|
42
|
+
}>;
|
|
43
|
+
basis: z.ZodString;
|
|
44
|
+
}, z.core.$strict>>;
|
|
45
|
+
gain_paths: z.ZodArray<z.ZodObject<{
|
|
46
|
+
role: z.ZodEnum<{
|
|
47
|
+
merchant: "merchant";
|
|
48
|
+
supplier: "supplier";
|
|
49
|
+
collaborator: "collaborator";
|
|
50
|
+
arbitrator: "arbitrator";
|
|
51
|
+
neutral: "neutral";
|
|
52
|
+
system: "system";
|
|
53
|
+
buyer: "buyer";
|
|
54
|
+
}>;
|
|
55
|
+
path: z.ZodString;
|
|
56
|
+
viability: z.ZodUnion<readonly [z.ZodEnum<{
|
|
57
|
+
conditional: "conditional";
|
|
58
|
+
viable: "viable";
|
|
59
|
+
blocked: "blocked";
|
|
60
|
+
unverifiable: "unverifiable";
|
|
61
|
+
}>, z.ZodString]>;
|
|
62
|
+
gate: z.ZodString;
|
|
63
|
+
}, z.core.$strict>>;
|
|
64
|
+
downgrade_exempt: z.ZodOptional<z.ZodBoolean>;
|
|
65
|
+
}, z.core.$strict>>;
|
|
66
|
+
}, z.core.$strict>;
|
|
67
|
+
export declare const RuleEntrySchema: z.ZodObject<{
|
|
68
|
+
rule_id: z.ZodString;
|
|
69
|
+
dimension: z.ZodOptional<z.ZodString>;
|
|
70
|
+
trigger: z.ZodOptional<z.ZodString>;
|
|
71
|
+
cases: z.ZodArray<z.ZodObject<{
|
|
72
|
+
when: z.ZodType<RuleCondition, unknown, z.core.$ZodTypeInternals<RuleCondition, unknown>>;
|
|
73
|
+
level: z.ZodType<"low" | "high" | "info" | "critical" | "medium", unknown, z.core.$ZodTypeInternals<"low" | "high" | "info" | "critical" | "medium", unknown>>;
|
|
74
|
+
title: z.ZodString;
|
|
75
|
+
description: z.ZodString;
|
|
76
|
+
scenario: z.ZodOptional<z.ZodString>;
|
|
77
|
+
mitigation: z.ZodOptional<z.ZodString>;
|
|
78
|
+
evidence: z.ZodOptional<z.ZodString>;
|
|
79
|
+
stakeholders: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
80
|
+
exposure: z.ZodOptional<z.ZodObject<{
|
|
81
|
+
loss_parties: z.ZodArray<z.ZodObject<{
|
|
82
|
+
role: z.ZodEnum<{
|
|
83
|
+
merchant: "merchant";
|
|
84
|
+
supplier: "supplier";
|
|
85
|
+
collaborator: "collaborator";
|
|
86
|
+
arbitrator: "arbitrator";
|
|
87
|
+
neutral: "neutral";
|
|
88
|
+
system: "system";
|
|
89
|
+
buyer: "buyer";
|
|
90
|
+
}>;
|
|
91
|
+
basis: z.ZodString;
|
|
92
|
+
}, z.core.$strict>>;
|
|
93
|
+
gain_paths: z.ZodArray<z.ZodObject<{
|
|
94
|
+
role: z.ZodEnum<{
|
|
95
|
+
merchant: "merchant";
|
|
96
|
+
supplier: "supplier";
|
|
97
|
+
collaborator: "collaborator";
|
|
98
|
+
arbitrator: "arbitrator";
|
|
99
|
+
neutral: "neutral";
|
|
100
|
+
system: "system";
|
|
101
|
+
buyer: "buyer";
|
|
102
|
+
}>;
|
|
103
|
+
path: z.ZodString;
|
|
104
|
+
viability: z.ZodUnion<readonly [z.ZodEnum<{
|
|
105
|
+
conditional: "conditional";
|
|
106
|
+
viable: "viable";
|
|
107
|
+
blocked: "blocked";
|
|
108
|
+
unverifiable: "unverifiable";
|
|
109
|
+
}>, z.ZodString]>;
|
|
110
|
+
gate: z.ZodString;
|
|
111
|
+
}, z.core.$strict>>;
|
|
112
|
+
downgrade_exempt: z.ZodOptional<z.ZodBoolean>;
|
|
113
|
+
}, z.core.$strict>>;
|
|
114
|
+
}, z.core.$strict>>;
|
|
115
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
116
|
+
}, z.core.$strict>;
|
|
117
|
+
export declare const RuleDomainPackSchema: z.ZodObject<{
|
|
118
|
+
comment: z.ZodOptional<z.ZodString>;
|
|
119
|
+
facts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
120
|
+
rules: z.ZodArray<z.ZodObject<{
|
|
121
|
+
rule_id: z.ZodString;
|
|
122
|
+
dimension: z.ZodOptional<z.ZodString>;
|
|
123
|
+
trigger: z.ZodOptional<z.ZodString>;
|
|
124
|
+
cases: z.ZodArray<z.ZodObject<{
|
|
125
|
+
when: z.ZodType<RuleCondition, unknown, z.core.$ZodTypeInternals<RuleCondition, unknown>>;
|
|
126
|
+
level: z.ZodType<"low" | "high" | "info" | "critical" | "medium", unknown, z.core.$ZodTypeInternals<"low" | "high" | "info" | "critical" | "medium", unknown>>;
|
|
127
|
+
title: z.ZodString;
|
|
128
|
+
description: z.ZodString;
|
|
129
|
+
scenario: z.ZodOptional<z.ZodString>;
|
|
130
|
+
mitigation: z.ZodOptional<z.ZodString>;
|
|
131
|
+
evidence: z.ZodOptional<z.ZodString>;
|
|
132
|
+
stakeholders: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
133
|
+
exposure: z.ZodOptional<z.ZodObject<{
|
|
134
|
+
loss_parties: z.ZodArray<z.ZodObject<{
|
|
135
|
+
role: z.ZodEnum<{
|
|
136
|
+
merchant: "merchant";
|
|
137
|
+
supplier: "supplier";
|
|
138
|
+
collaborator: "collaborator";
|
|
139
|
+
arbitrator: "arbitrator";
|
|
140
|
+
neutral: "neutral";
|
|
141
|
+
system: "system";
|
|
142
|
+
buyer: "buyer";
|
|
143
|
+
}>;
|
|
144
|
+
basis: z.ZodString;
|
|
145
|
+
}, z.core.$strict>>;
|
|
146
|
+
gain_paths: z.ZodArray<z.ZodObject<{
|
|
147
|
+
role: z.ZodEnum<{
|
|
148
|
+
merchant: "merchant";
|
|
149
|
+
supplier: "supplier";
|
|
150
|
+
collaborator: "collaborator";
|
|
151
|
+
arbitrator: "arbitrator";
|
|
152
|
+
neutral: "neutral";
|
|
153
|
+
system: "system";
|
|
154
|
+
buyer: "buyer";
|
|
155
|
+
}>;
|
|
156
|
+
path: z.ZodString;
|
|
157
|
+
viability: z.ZodUnion<readonly [z.ZodEnum<{
|
|
158
|
+
conditional: "conditional";
|
|
159
|
+
viable: "viable";
|
|
160
|
+
blocked: "blocked";
|
|
161
|
+
unverifiable: "unverifiable";
|
|
162
|
+
}>, z.ZodString]>;
|
|
163
|
+
gate: z.ZodString;
|
|
164
|
+
}, z.core.$strict>>;
|
|
165
|
+
downgrade_exempt: z.ZodOptional<z.ZodBoolean>;
|
|
166
|
+
}, z.core.$strict>>;
|
|
167
|
+
}, z.core.$strict>>;
|
|
168
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
169
|
+
}, z.core.$strict>>;
|
|
170
|
+
}, z.core.$strict>;
|
|
171
|
+
export type RuleCase = z.infer<typeof RuleCaseSchema>;
|
|
172
|
+
export type RuleEntry = z.infer<typeof RuleEntrySchema>;
|
|
173
|
+
export type RuleDomainPack = z.infer<typeof RuleDomainPackSchema>;
|
|
174
|
+
export declare const RuleEntryInputSchema: z.ZodObject<{
|
|
175
|
+
rule_id: z.ZodString;
|
|
176
|
+
dimension: z.ZodOptional<z.ZodString>;
|
|
177
|
+
trigger: z.ZodOptional<z.ZodString>;
|
|
178
|
+
cases: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
179
|
+
when: z.ZodType<RuleCondition, unknown, z.core.$ZodTypeInternals<RuleCondition, unknown>>;
|
|
180
|
+
level: z.ZodType<"low" | "high" | "info" | "critical" | "medium", unknown, z.core.$ZodTypeInternals<"low" | "high" | "info" | "critical" | "medium", unknown>>;
|
|
181
|
+
title: z.ZodString;
|
|
182
|
+
description: z.ZodString;
|
|
183
|
+
scenario: z.ZodOptional<z.ZodString>;
|
|
184
|
+
mitigation: z.ZodOptional<z.ZodString>;
|
|
185
|
+
evidence: z.ZodOptional<z.ZodString>;
|
|
186
|
+
stakeholders: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
187
|
+
exposure: z.ZodOptional<z.ZodObject<{
|
|
188
|
+
loss_parties: z.ZodArray<z.ZodObject<{
|
|
189
|
+
role: z.ZodEnum<{
|
|
190
|
+
merchant: "merchant";
|
|
191
|
+
supplier: "supplier";
|
|
192
|
+
collaborator: "collaborator";
|
|
193
|
+
arbitrator: "arbitrator";
|
|
194
|
+
neutral: "neutral";
|
|
195
|
+
system: "system";
|
|
196
|
+
buyer: "buyer";
|
|
197
|
+
}>;
|
|
198
|
+
basis: z.ZodString;
|
|
199
|
+
}, z.core.$strict>>;
|
|
200
|
+
gain_paths: z.ZodArray<z.ZodObject<{
|
|
201
|
+
role: z.ZodEnum<{
|
|
202
|
+
merchant: "merchant";
|
|
203
|
+
supplier: "supplier";
|
|
204
|
+
collaborator: "collaborator";
|
|
205
|
+
arbitrator: "arbitrator";
|
|
206
|
+
neutral: "neutral";
|
|
207
|
+
system: "system";
|
|
208
|
+
buyer: "buyer";
|
|
209
|
+
}>;
|
|
210
|
+
path: z.ZodString;
|
|
211
|
+
viability: z.ZodUnion<readonly [z.ZodEnum<{
|
|
212
|
+
conditional: "conditional";
|
|
213
|
+
viable: "viable";
|
|
214
|
+
blocked: "blocked";
|
|
215
|
+
unverifiable: "unverifiable";
|
|
216
|
+
}>, z.ZodString]>;
|
|
217
|
+
gate: z.ZodString;
|
|
218
|
+
}, z.core.$strict>>;
|
|
219
|
+
downgrade_exempt: z.ZodOptional<z.ZodBoolean>;
|
|
220
|
+
}, z.core.$strict>>;
|
|
221
|
+
}, z.core.$strict>>>;
|
|
222
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
223
|
+
}, z.core.$strict>;
|
|
224
|
+
export declare const RuleDomainPackInputSchema: z.ZodObject<{
|
|
225
|
+
comment: z.ZodOptional<z.ZodString>;
|
|
226
|
+
facts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
227
|
+
rules: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
228
|
+
rule_id: z.ZodString;
|
|
229
|
+
dimension: z.ZodOptional<z.ZodString>;
|
|
230
|
+
trigger: z.ZodOptional<z.ZodString>;
|
|
231
|
+
cases: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
232
|
+
when: z.ZodType<RuleCondition, unknown, z.core.$ZodTypeInternals<RuleCondition, unknown>>;
|
|
233
|
+
level: z.ZodType<"low" | "high" | "info" | "critical" | "medium", unknown, z.core.$ZodTypeInternals<"low" | "high" | "info" | "critical" | "medium", unknown>>;
|
|
234
|
+
title: z.ZodString;
|
|
235
|
+
description: z.ZodString;
|
|
236
|
+
scenario: z.ZodOptional<z.ZodString>;
|
|
237
|
+
mitigation: z.ZodOptional<z.ZodString>;
|
|
238
|
+
evidence: z.ZodOptional<z.ZodString>;
|
|
239
|
+
stakeholders: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
240
|
+
exposure: z.ZodOptional<z.ZodObject<{
|
|
241
|
+
loss_parties: z.ZodArray<z.ZodObject<{
|
|
242
|
+
role: z.ZodEnum<{
|
|
243
|
+
merchant: "merchant";
|
|
244
|
+
supplier: "supplier";
|
|
245
|
+
collaborator: "collaborator";
|
|
246
|
+
arbitrator: "arbitrator";
|
|
247
|
+
neutral: "neutral";
|
|
248
|
+
system: "system";
|
|
249
|
+
buyer: "buyer";
|
|
250
|
+
}>;
|
|
251
|
+
basis: z.ZodString;
|
|
252
|
+
}, z.core.$strict>>;
|
|
253
|
+
gain_paths: z.ZodArray<z.ZodObject<{
|
|
254
|
+
role: z.ZodEnum<{
|
|
255
|
+
merchant: "merchant";
|
|
256
|
+
supplier: "supplier";
|
|
257
|
+
collaborator: "collaborator";
|
|
258
|
+
arbitrator: "arbitrator";
|
|
259
|
+
neutral: "neutral";
|
|
260
|
+
system: "system";
|
|
261
|
+
buyer: "buyer";
|
|
262
|
+
}>;
|
|
263
|
+
path: z.ZodString;
|
|
264
|
+
viability: z.ZodUnion<readonly [z.ZodEnum<{
|
|
265
|
+
conditional: "conditional";
|
|
266
|
+
viable: "viable";
|
|
267
|
+
blocked: "blocked";
|
|
268
|
+
unverifiable: "unverifiable";
|
|
269
|
+
}>, z.ZodString]>;
|
|
270
|
+
gate: z.ZodString;
|
|
271
|
+
}, z.core.$strict>>;
|
|
272
|
+
downgrade_exempt: z.ZodOptional<z.ZodBoolean>;
|
|
273
|
+
}, z.core.$strict>>;
|
|
274
|
+
}, z.core.$strict>>>;
|
|
275
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
276
|
+
}, z.core.$strict>>>;
|
|
277
|
+
}, z.core.$strict>;
|
|
278
|
+
export type RuleDomainPackInput = z.infer<typeof RuleDomainPackInputSchema>;
|
|
279
|
+
export type { FindingExposure, GainPath, ExposureParty, ExposureVerdict, GainPathViability, } from "./exposure.js";
|
|
280
|
+
export type Facts = Record<string, unknown>;
|
|
281
|
+
export declare function evaluateCondition(cond: RuleCondition, facts: Facts): boolean;
|
|
282
|
+
export declare function interpolate(template: string, facts: Facts): string;
|
|
283
|
+
export interface RuleBookFinding {
|
|
284
|
+
rule_id: string;
|
|
285
|
+
dimension?: string;
|
|
286
|
+
level: Severity;
|
|
287
|
+
title: string;
|
|
288
|
+
description: string;
|
|
289
|
+
scenario?: string;
|
|
290
|
+
mitigation?: string;
|
|
291
|
+
evidence?: string;
|
|
292
|
+
stakeholders?: string[];
|
|
293
|
+
exposure?: FindingExposure;
|
|
294
|
+
}
|
|
295
|
+
export interface RuleBookResult {
|
|
296
|
+
findings: RuleBookFinding[];
|
|
297
|
+
disabled_traces: string[];
|
|
298
|
+
}
|
|
299
|
+
export declare function evaluateRuleBook(rules: RuleEntry[], facts: Facts): RuleBookResult;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{z}from'zod';import{SEVERITY_ORDER}from'./severity.js';import{ExposureFragmentSchema,FactRefSchema,applyExposureGate,parseFactRef,resolveExposureFragment}from'./exposure.js';const LEAF_OPS=['present','missing','truthy','falsy','eq','neq','gt','gte','lt','lte','in','nin','contains','matches','size'];export const RuleConditionSchema=z['lazy'](()=>z['union']([z['object']({'all':z['array'](RuleConditionSchema)})['strict'](),z['object']({'any':z['array'](RuleConditionSchema)})['strict'](),z['object']({'not':RuleConditionSchema})['strict'](),z['object']({'field':z['string'](),'op':z['enum'](LEAF_OPS),'value':z['unknown']()['optional'](),'flags':z['string']()['optional']()})['strict']()]));const CaseLevelSchema=z['union']([z['enum'](SEVERITY_ORDER),FactRefSchema]);export const RuleCaseSchema=z['object']({'when':RuleConditionSchema,'level':CaseLevelSchema,'title':z['string'](),'description':z['string'](),'scenario':z['string']()['optional'](),'mitigation':z['string']()['optional'](),'evidence':z['string']()['optional'](),'stakeholders':z['array'](z['string']())['optional'](),'exposure':ExposureFragmentSchema['optional']()})['strict']();export const RuleEntrySchema=z['object']({'rule_id':z['string'](),'dimension':z['string']()['optional'](),'trigger':z['string']()['optional'](),'cases':z['array'](RuleCaseSchema)['min'](0x1),'enabled':z['boolean']()['optional']()})['strict']();export const RuleDomainPackSchema=z['object']({'comment':z['string']()['optional'](),'facts':z['record'](z['string'](),z['string']())['optional'](),'rules':z['array'](RuleEntrySchema)})['strict']();export const RuleEntryInputSchema=z['object']({'rule_id':z['string'](),'dimension':z['string']()['optional'](),'trigger':z['string']()['optional'](),'cases':z['array'](RuleCaseSchema)['optional'](),'enabled':z['boolean']()['optional']()})['strict']();export const RuleDomainPackInputSchema=z['object']({'comment':z['string']()['optional'](),'facts':z['record'](z['string'](),z['string']())['optional'](),'rules':z['array'](RuleEntryInputSchema)['optional']()})['strict']();function lookup(a,b){let c=a;for(const d of b['split']('.')){if(c===null||typeof c!=='object')return undefined;c=c[d];if(c===undefined)return undefined;}return c;}function isPlainObject(a){return typeof a==='object'&&a!==null&&!Array['isArray'](a);}function toNumber(a){if(typeof a==='number'&&Number['isFinite'](a))return a;if(typeof a==='string'&&a['trim']()!==''&&Number['isFinite'](Number(a)))return Number(a);return null;}function matchesOp(c,d){const e=lookup(d,c['field']);switch(c['op']){case'present':return e!==undefined;case'missing':return e===undefined;case'truthy':return Array['isArray'](e)?e['length']>0x0:Boolean(e);case'falsy':return Array['isArray'](e)?e['length']===0x0:!e;case'eq':return e===c['value'];case'neq':return e!==c['value'];case'gt':case'gte':case'lt':case'lte':{const f=toNumber(e),g=toNumber(c['value']);if(f===null||g===null)return![];if(c['op']==='gt')return f>g;if(c['op']==='gte')return f>=g;if(c['op']==='lt')return f<g;return f<=g;}case'in':case'nin':{const h=Array['isArray'](c['value'])?c['value']:[],i=h['some'](j=>j===e);return c['op']==='in'?i:!i;}case'contains':if(Array['isArray'](e))return e['some'](j=>j===c['value']);if(typeof e==='string'&&typeof c['value']==='string')return e['includes'](c['value']);return![];case'matches':{if(typeof e!=='string'||typeof c['value']!=='string')return![];return new RegExp(c['value'],c['flags']??'i')['test'](e);}case'size':if(Array['isArray'](e))return e['length']===c['value'];if(typeof e==='string')return e['length']===c['value'];return![];}}export function evaluateCondition(a,b){if('all'in a)return a['all']['every'](d=>evaluateCondition(d,b));if('any'in a)return a['any']['some'](d=>evaluateCondition(d,b));if('not'in a)return!evaluateCondition(a['not'],b);return matchesOp(a,b);}export function interpolate(a,b){return a['replace'](/\$\{([^}]+)\}/g,(c,d)=>{const e=lookup(b,d['trim']());if(e===undefined)return c;if(typeof e==='object')return JSON['stringify'](e);return String(e);});}function resolveLevel(a,b){const c=parseFactRef(a);if(c===null)return a;const d=b[c];return SEVERITY_ORDER['includes'](String(d))?String(d):'info';}export function evaluateRuleBook(a,b){const d=[],e=[];for(const f of a){if(f['enabled']===![]){e['push'](f['rule_id']);continue;}for(const g of f['cases']){if(!evaluateCondition(g['when'],b))continue;const h=resolveLevel(g['level'],b),i=g['exposure']?resolveExposureFragment(g['exposure'],b,k=>interpolate(k,b)):undefined,j=i?applyExposureGate(h,i,{'downgradeExempt':i['downgradeExempt']}):undefined;d['push']({'rule_id':f['rule_id'],'dimension':f['dimension'],'level':j?j['severity']:h,'title':interpolate(g['title'],b),'description':interpolate(g['description'],b),'scenario':g['scenario']===undefined?undefined:interpolate(g['scenario'],b),'mitigation':g['mitigation']===undefined?undefined:interpolate(g['mitigation'],b),'evidence':g['evidence']===undefined?undefined:interpolate(g['evidence'],b),'stakeholders':g['stakeholders'],...j?{'exposure':j['exposure']}:{}});break;}}return{'findings':d,'disabled_traces':e};}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{describe,expect,it}from'vitest';import{evaluateCondition,evaluateRuleBook,interpolate,RuleDomainPackSchema,RuleEntrySchema}from'./rule-engine.js';const F={'count':0x3c,'name':'Hero\x20SKU','tags':['vip','beta'],'nested':{'deep':0x5},'empty':'','zero':0x0,'list':[],'flag':!![]},leaf=(a,b,c,d)=>({'field':a,'op':b,...c!==undefined?{'value':c}:{},...d?{'flags':d}:{}});function entry(a,b,c='medium',d={}){return RuleEntrySchema['parse']({'rule_id':a,'cases':[{'when':b,'level':c,'title':'t\x20'+a,'description':'d\x20'+a,...d}]});}describe('leaf\x20operators',()=>{it('present\x20/\x20missing',()=>{expect(evaluateCondition(leaf('count','present'),F))['toBe'](!![]),expect(evaluateCondition(leaf('absent','present'),F))['toBe'](![]),expect(evaluateCondition(leaf('absent','missing'),F))['toBe'](!![]),expect(evaluateCondition(leaf('nested.deep','present'),F))['toBe'](!![]),expect(evaluateCondition(leaf('nested.absent','missing'),F))['toBe'](!![]);}),it('truthy\x20/\x20falsy\x20follow\x20JS\x20semantics\x20with\x20empty-array\x20falsy',()=>{expect(evaluateCondition(leaf('flag','truthy'),F))['toBe'](!![]),expect(evaluateCondition(leaf('empty','truthy'),F))['toBe'](![]),expect(evaluateCondition(leaf('zero','truthy'),F))['toBe'](![]),expect(evaluateCondition(leaf('list','truthy'),F))['toBe'](![]),expect(evaluateCondition(leaf('tags','truthy'),F))['toBe'](!![]),expect(evaluateCondition(leaf('zero','falsy'),F))['toBe'](!![]),expect(evaluateCondition(leaf('absent','falsy'),F))['toBe'](!![]);}),it('eq\x20/\x20neq\x20are\x20strict',()=>{expect(evaluateCondition(leaf('count','eq',0x3c),F))['toBe'](!![]),expect(evaluateCondition(leaf('count','eq','60'),F))['toBe'](![]),expect(evaluateCondition(leaf('count','neq','60'),F))['toBe'](!![]);}),it('numeric\x20comparisons\x20coerce\x20numeric\x20strings,\x20refuse\x20the\x20rest',()=>{expect(evaluateCondition(leaf('count','gt',0x3b),F))['toBe'](!![]),expect(evaluateCondition(leaf('count','gte',0x3c),F))['toBe'](!![]),expect(evaluateCondition(leaf('count','lt',0x3d),F))['toBe'](!![]),expect(evaluateCondition(leaf('count','lte',0x3c),F))['toBe'](!![]),expect(evaluateCondition(leaf('name','gt',0x0),F))['toBe'](![]),expect(evaluateCondition(leaf('absent','gt',0x0),F))['toBe'](![]);}),it('in\x20/\x20nin\x20membership',()=>{expect(evaluateCondition(leaf('name','in',['Hero\x20SKU','X']),F))['toBe'](!![]),expect(evaluateCondition(leaf('name','nin',['X']),F))['toBe'](!![]),expect(evaluateCondition(leaf('name','in',['X']),F))['toBe'](![]);}),it('contains\x20works\x20on\x20arrays\x20and\x20strings',()=>{expect(evaluateCondition(leaf('tags','contains','vip'),F))['toBe'](!![]),expect(evaluateCondition(leaf('name','contains','SKU'),F))['toBe'](!![]),expect(evaluateCondition(leaf('tags','contains','nope'),F))['toBe'](![]),expect(evaluateCondition(leaf('count','contains',0x3c),F))['toBe'](![]);}),it('matches\x20uses\x20case-insensitive\x20by\x20default\x20and\x20honors\x20flags',()=>{expect(evaluateCondition(leaf('name','matches','^hero'),F))['toBe'](!![]),expect(evaluateCondition(leaf('name','matches','^hero','s'),F))['toBe'](![]);}),it('size\x20checks\x20array/string\x20length',()=>{expect(evaluateCondition(leaf('tags','size',0x2),F))['toBe'](!![]),expect(evaluateCondition(leaf('name','size',0x8),F))['toBe'](!![]),expect(evaluateCondition(leaf('tags','size',0x3),F))['toBe'](![]);});}),describe('combinators',()=>{it('all\x20/\x20any\x20/\x20not',()=>{const a={'all':[leaf('count','gt',0x0),leaf('flag','truthy')]},b={'any':[leaf('absent','present'),leaf('flag','truthy')]};expect(evaluateCondition(a,F))['toBe'](!![]),expect(evaluateCondition(b,F))['toBe'](!![]),expect(evaluateCondition({'not':leaf('flag','truthy')},F))['toBe'](![]),expect(evaluateCondition({'all':[]},F))['toBe'](!![]),expect(evaluateCondition({'any':[]},F))['toBe'](![]);}),it('nested\x20combinators',()=>{const a={'all':[leaf('count','gte',0x3c),{'not':{'any':[leaf('name','eq','X'),leaf('flag','falsy')]}}]};expect(evaluateCondition(a,F))['toBe'](!![]);});}),describe('interpolate',()=>{it('substitutes\x20facts\x20and\x20JSON-stringifies\x20objects',()=>{expect(interpolate('have\x20${count}\x20of\x20${name}',F))['toBe']('have\x2060\x20of\x20Hero\x20SKU'),expect(interpolate('deep=${nested.deep}',F))['toBe']('deep=5'),expect(interpolate('tags=${tags}',F))['toBe']('tags=[\x22vip\x22,\x22beta\x22]');}),it('leaves\x20the\x20literal\x20token\x20for\x20an\x20absent\x20fact',()=>{expect(interpolate('value\x20${absent}\x20stays',F))['toBe']('value\x20${absent}\x20stays');});}),describe('evaluateRuleBook',()=>{it('fires\x20the\x20FIRST\x20satisfied\x20case\x20only',()=>{const a=[entry('R1',leaf('count','gt',0x64),'high'),{'rule_id':'R2','cases':[{'when':leaf('count','gt',0x64),'level':'critical','title':'extreme','description':'e'},{'when':leaf('count','gt',0x32),'level':'medium','title':'moderate','description':'m'}]}],b=evaluateRuleBook(a,F);expect(b['findings'])['toHaveLength'](0x1),expect(b['findings'][0x0]['rule_id'])['toBe']('R2'),expect(b['findings'][0x0]['level'])['toBe']('medium'),expect(b['findings'][0x0]['title'])['toBe']('moderate');}),it('a\x20rule\x20with\x20no\x20satisfied\x20case\x20stays\x20silent',()=>{const a=evaluateRuleBook([entry('R1',leaf('count','gt',0x3e8))],F);expect(a['findings'])['toHaveLength'](0x0);}),it('interpolates\x20text\x20fields\x20from\x20facts',()=>{const a=[entry('R1',leaf('count','gt',0x32),'high',{'description':'count\x20is\x20${count}\x20for\x20${name}','evidence':'count=${count}'})],b=evaluateRuleBook(a,F);expect(b['findings'][0x0]['description'])['toBe']('count\x20is\x2060\x20for\x20Hero\x20SKU'),expect(b['findings'][0x0]['evidence'])['toBe']('count=60');}),it('disabled\x20rules\x20leave\x20a\x20trace\x20and\x20never\x20fire\x20(Q12)',()=>{const a=[entry('R1',leaf('count','gt',0x0))];a[0x0]['enabled']=![];const b=evaluateRuleBook(a,F);expect(b['findings'])['toHaveLength'](0x0),expect(b['disabled_traces'])['toEqual'](['R1']);}),it('document\x20order\x20defines\x20finding\x20order',()=>{const a=[entry('RB',leaf('flag','truthy')),entry('RA',leaf('flag','truthy'))],b=evaluateRuleBook(a,F);expect(b['findings']['map'](c=>c['rule_id']))['toEqual'](['RB','RA']);});}),describe('schemas',()=>{it('accepts\x20a\x20well-formed\x20domain\x20pack',()=>{const a={'comment':'demo','facts':{'count':'item\x20count'},'rules':[{'rule_id':'R-1','dimension':'structural','trigger':'count\x20too\x20big','cases':[{'when':{'field':'count','op':'gt','value':0x32},'level':'high','title':'Too\x20many','description':'count\x20${count}'}]}]};expect(RuleDomainPackSchema['safeParse'](a)['success'])['toBe'](!![]);}),it('rejects\x20legacy\x20severity\x20words\x20and\x20unknown\x20keys',()=>{const a={'rules':[{'rule_id':'R-1','cases':[{'when':{'field':'x','op':'present'},'level':'warning','title':'t','description':'d'}]}]};expect(RuleDomainPackSchema['safeParse'](a)['success'])['toBe'](![]);const b={'rules':[{'rule_id':'R-1','hacker':!![],'cases':[{'when':{'field':'x','op':'present'},'level':'low','title':'t','description':'d'}]}]};expect(RuleEntrySchema['safeParse'](b['rules'][0x0])['success'])['toBe'](![]);}),it('rejects\x20an\x20empty\x20cases\x20list',()=>{expect(RuleEntrySchema['safeParse']({'rule_id':'R-1','cases':[]})['success'])['toBe'](![]);});});
|
package/dist/config/runtime.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{readFileSync,writeFileSync,existsSync,mkdirSync}from'fs';import{dirname,join}from'path';import{getWowMcpDir}from'@wowok/wowok';export const SERVICE_REGISTRY=[{'name':'confirm_gate','description':'Security\x20confirmation\x20gate\x20—\x20prompts\x20user\x20confirmation\x20before\x20amount,\x20default\x20account,\x20publish,\x20or\x20irreversible\x20operations','defaultEnabled':!![],'envVar':'WOWOK_CONFIRM_GATE','remindOnToggle':!![]},{'name':'harness','description':'L4\x20Harness\
|
|
1
|
+
import{readFileSync,writeFileSync,existsSync,mkdirSync}from'fs';import{dirname,join}from'path';import{getWowMcpDir}from'@wowok/wowok';export const SERVICE_REGISTRY=[{'name':'confirm_gate','description':'Security\x20confirmation\x20gate\x20—\x20prompts\x20user\x20confirmation\x20before\x20amount,\x20default\x20account,\x20publish,\x20or\x20irreversible\x20operations','defaultEnabled':!![],'envVar':'WOWOK_CONFIRM_GATE','remindOnToggle':!![]},{'name':'harness','description':'L4\x20Harness\x20wrap-level\x20hooks\x20—\x20auto-escalation,\x20pre-publish/pre-sign\x20gates,\x20legacy-tool\x20recovery\x20guidance.\x20GLM5:\x20default\x20ON\x20with\x20tiered\x20enforcement\x20(off/lightweight/full).','defaultEnabled':!![],'envVar':'WOWOK_HARNESS_ENABLED','remindOnToggle':!![]},{'name':'semantic_rich','description':'Semantic\x20layer\x20enrichment\x20—\x20attaches\x20extra\x20reminder\x20info\x20such\x20as\x20service_status\x20in\x20responses','defaultEnabled':!![],'envVar':'WOWOK_SEMANTIC_RICH','remindOnToggle':![]},{'name':'experience_layer','description':'Real-time\x20experience\x20layer\x20—\x20intent\x20distillation\x20+\x20user\x20profiling\x20+\x20experience\x20reuse,\x20gets\x20smarter\x20with\x20usage','defaultEnabled':!![],'envVar':'WOWOK_EXPERIENCE_LAYER','remindOnToggle':!![]},{'name':'customer_intelligence','description':'Buyer\x20intelligence\x20(Phase\x203\x20C-3)\x20—\x20attaches\x20risk\x20reminders,\x20preference\x20matching,\x20and\x20blocking\x20alerts\x20in\x20semantic.customer_advice\x20for\x20order/query\x20operations','defaultEnabled':!![],'envVar':'WOWOK_CUSTOMER_INTELLIGENCE','remindOnToggle':!![]},{'name':'order_monitor','description':'In-progress\x20order\x20monitoring\x20(Phase\x203\x20C-3.2)\x20—\x20detects\x20Progress\x20stalls\x20/\x20compensation\x20balance\x20changes\x20/\x20Messenger\x20timeouts;\x20disabled\x20by\x20default,\x20must\x20be\x20actively\x20enabled','defaultEnabled':![],'envVar':'WOWOK_ORDER_MONITOR','remindOnToggle':!![]},{'name':'industry_evolution','description':'Industry\x20specialization\x20evolution\x20(Phase\x204)\x20—\x20AI-Human-WOW\x20flywheel\x20loop:\x20captures\x20industry\x20signals\x20+\x20updates\x20knowledge\x20+\x20injects\x20evolution\x20context','defaultEnabled':!![],'envVar':'WOWOK_INDUSTRY_EVOLUTION','remindOnToggle':!![]}];const SERVICE_MAP=new Map(SERVICE_REGISTRY['map'](a=>[a['name'],a])),runtimeOverrides=new Map();let harnessTierOverride;function configFilePath(){if(process['env']['WOWOK_CONFIG_DIR'])return join(process['env']['WOWOK_CONFIG_DIR'],'runtime-config.json');return join(getWowMcpDir(),'runtime-config.json');}function isPersistEnabled(){const a=process['env']['WOWOK_RUNTIME_CONFIG_PERSIST'];return a==='1'||a==='true';}function loadPersisted(){if(!isPersistEnabled())return null;try{const a=configFilePath();if(!existsSync(a))return null;const b=readFileSync(a,'utf-8'),c=JSON['parse'](b);if(c&&typeof c==='object'&&c['services'])return c;}catch{}return null;}function savePersisted(){if(!isPersistEnabled())return;try{const a=configFilePath(),b=dirname(a);if(!existsSync(b))mkdirSync(b,{'recursive':!![]});const c={'version':0x2,'services':Object['fromEntries'](runtimeOverrides),'harness_tier':harnessTierOverride,'updatedAt':Date['now']()};writeFileSync(a,JSON['stringify'](c,null,0x2),'utf-8');}catch{}}{const persisted=loadPersisted();if(persisted){for(const [name,enabled]of Object['entries'](persisted['services'])){SERVICE_MAP['has'](name)&&runtimeOverrides['set'](name,enabled);}persisted['harness_tier']&&(harnessTierOverride=persisted['harness_tier']);}}export function getHarnessTier(){if(!isEnabled('harness'))return'off';if(harnessTierOverride)return harnessTierOverride;const a=process['env']['WOWOK_HARNESS_TIER'];if(a==='off'||a==='lightweight'||a==='full')return a;return'lightweight';}export function setHarnessTier(a){harnessTierOverride=a,savePersisted();}export function resetHarnessTier(){harnessTierOverride=undefined,savePersisted();}export function isEnabled(a){if(runtimeOverrides['has'](a))return runtimeOverrides['get'](a);const b=SERVICE_MAP['get'](a);if(b){const c=process['env'][b['envVar']];if(c!==undefined){if(c==='0'||c==='false')return![];if(c==='1'||c==='true')return!![];}return b['defaultEnabled'];}return![];}export function setEnabled(a,b){runtimeOverrides['set'](a,b),savePersisted();}export function toggle(a){const b=!isEnabled(a);return setEnabled(a,b),b;}export function reset(a){runtimeOverrides['delete'](a),savePersisted();}export function listServices(){return SERVICE_REGISTRY['map'](a=>{const b=runtimeOverrides['has'](a['name']),c=isEnabled(a['name']);return{'name':a['name'],'enabled':c,'defaultEnabled':a['defaultEnabled'],'description':a['description'],'overridden':b,'envVar':a['envVar'],'reminder':a['remindOnToggle']?buildReminder(a['name'],c):undefined};});}export function getServiceInfo(a){const b=SERVICE_MAP['get'](a);if(!b)return undefined;return{'name':b['name'],'enabled':isEnabled(b['name']),'defaultEnabled':b['defaultEnabled'],'description':b['description'],'overridden':runtimeOverrides['has'](b['name']),'envVar':b['envVar'],'reminder':b['remindOnToggle']?buildReminder(b['name'],isEnabled(b['name'])):undefined};}function buildReminder(a,b){switch(a){case'confirm_gate':return b?'ConfirmGate\x20is\x20ON:\x20prompts\x20confirmation\x20before\x20amount,\x20default\x20account,\x20publish,\x20or\x20irreversible\x20operations.\x20To\x20disable,\x20call\x20config_operation\x20toggle\x20confirm_gate.':'ConfirmGate\x20is\x20OFF:\x20operations\x20will\x20execute\x20directly\x20without\x20confirmation.\x20Note\x20the\x20risk\x20of\x20irreversible\x20operations.\x20To\x20re-enable,\x20call\x20config_operation\x20toggle\x20confirm_gate.';case'harness':return b?'Harness\x20is\x20ON\x20(tier:\x20'+getHarnessTier()+'):\x20wrap-level\x20safety\x20hooks\x20(auto-escalation,\x20pre-publish/pre-sign\x20gates,\x20legacy-tool\x20recovery\x20guidance).\x20lightweight=post-call\x20checks;\x20full=also\x20pre-publish/pre-sign\x20gates.\x20Recovery\x20and\x20diagnosis\x20on\x20tool\x20outputs\x20always\x20run.\x20To\x20change\x20tier,\x20set\x20WOWOK_HARNESS_TIER\x20or\x20call\x20harness\x20API.\x20To\x20disable,\x20call\x20config_operation\x20toggle\x20harness.':'Harness\x20is\x20OFF.\x20GLM5\x20recommends\x20keeping\x20it\x20ON\x20(lightweight\x20tier)\x20for\x20safety.\x20To\x20enable,\x20call\x20config_operation\x20toggle\x20harness.';case'semantic_rich':return undefined;case'experience_layer':return b?'Experience\x20layer\x20is\x20ON:\x20provides\x20suggestions\x20in\x20semantic.experience\x20based\x20on\x20historical\x20operation\x20experience.\x20To\x20disable,\x20call\x20config_operation\x20toggle\x20experience_layer.':'Experience\x20layer\x20is\x20OFF:\x20no\x20experience\x20suggestions\x20will\x20be\x20attached.\x20To\x20enable,\x20call\x20config_operation\x20toggle\x20experience_layer.';case'customer_intelligence':return b?'Customer\x20intelligence\x20is\x20ON:\x20order/query\x20operations\x20will\x20attach\x20risk/preference/blocking\x20alerts\x20in\x20semantic.customer_advice.\x20To\x20disable,\x20call\x20config_operation\x20toggle\x20customer_intelligence.':'Customer\x20intelligence\x20is\x20OFF:\x20semantic.customer_advice\x20will\x20not\x20be\x20populated.\x20To\x20enable,\x20call\x20config_operation\x20toggle\x20customer_intelligence.';case'order_monitor':return b?'Order\x20monitor\x20is\x20ON:\x20detects\x20Progress\x20stalls,\x20compensation\x20balance\x20changes,\x20and\x20Messenger\x20timeouts.\x20To\x20disable,\x20call\x20config_operation\x20toggle\x20order_monitor.':'Order\x20monitor\x20is\x20OFF:\x20will\x20not\x20actively\x20detect\x20order\x20anomalies.\x20To\x20enable\x20(recommended\x20when\x20there\x20are\x20active\x20orders),\x20call\x20config_operation\x20toggle\x20order_monitor.';}}export const RUNTIME_CONFIG_VERSION=0x1;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const SEVERITY_ORDER: readonly ["critical", "high", "medium", "low", "info"];
|
|
2
|
+
export type Severity = (typeof SEVERITY_ORDER)[number];
|
|
3
|
+
export declare function compareSeverity(a: Severity, b: Severity): number;
|
|
4
|
+
export declare function severityRank(s: Severity): number;
|
|
5
|
+
export declare function maxSeverity(list: ReadonlyArray<Severity>): Severity;
|
|
6
|
+
export declare function normalizeSeverity(raw: string): Severity;
|
|
7
|
+
export declare function isSeverity(raw: string): raw is Severity;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const SEVERITY_ORDER=['critical','high','medium','low','info'];const RANK={'critical':0x4,'high':0x3,'medium':0x2,'low':0x1,'info':0x0},LEGACY_ALIASES={'warning':'high','warn':'high'};export function compareSeverity(c,d){return RANK[c]-RANK[d];}export function severityRank(a){return RANK[a];}export function maxSeverity(a){let b='info';for(const c of a){if(RANK[c]>RANK[b])b=c;}return b;}export function normalizeSeverity(a){const b=a?.['toLowerCase']();if(SEVERITY_ORDER['includes'](b))return b;return LEGACY_ALIASES[b]??'info';}export function isSeverity(a){return SEVERITY_ORDER['includes'](a?.['toLowerCase']());}
|
package/dist/customer/index.d.ts
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
export { CUSTOMER_INTELLIGENCE_VERSION,
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export { getIndustryRiskChecks, getIndustryNeeds, checkIndustryNeeds, assessIndustryRisks, inferIndustry, type IndustryNeedTier, type IndustryNeed, type IndustryRiskCheck, type IndustryRiskResult, } from "./industry-risks.js";
|
|
5
|
-
export { getDefaultPreferences, getIndustryTemplate, inferPreferences, matchServiceToPreferences, mergePreferences, validatePreferences, SUPPORTED_INDUSTRIES, type Industry, type IndustryTemplate, type OrderHistoryEntry, type PreferenceInference, type ServiceForMatching, type PreferenceMatchResult, } from "./user-preferences.js";
|
|
1
|
+
export { CUSTOMER_INTELLIGENCE_VERSION, type IndustryServicePuzzle, type RiskDimensionName, type RiskLevel, type UserPreferences, } from "./types.js";
|
|
2
|
+
export { getIndustryRiskChecks, getIndustryNeeds, type IndustryNeedTier, type IndustryNeed, type IndustryRiskCheck, } from "./industry-risks.js";
|
|
3
|
+
export { getDefaultPreferences, getIndustryTemplate, mergePreferences, validatePreferences, SUPPORTED_INDUSTRIES, type Industry, type IndustryTemplate, } from "./user-preferences.js";
|
|
6
4
|
export { monitorOrder, sortAlerts, type AlertSeverity, type AlertCategory, type MonitorAlert, type OrderSnapshot, type OrderHistorySnapshot, type OrderMonitorContext, type MonitorThresholds, } from "./order-monitor.js";
|
|
7
|
-
export { recommendStrategy, detectScenarios, type StrategyContext, type StrategyRecommendation, } from "./order-strategy.js";
|
|
8
|
-
export { generateReminders, sortAndCapReminders, isBlocking, getBlockingReminders, type ReminderStage, type ReminderContext, } from "./reminder-system.js";
|
|
9
|
-
export { assemblePreorderAdvice, type PreorderAdviceInput, type PreorderAdvice, type ConfidenceScore, } from "./customer-advice.js";
|
|
10
|
-
export { buildPreorderComparison, type PreorderCompareRow, type PreorderComparison, } from "./preorder-compare.js";
|
package/dist/customer/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{CUSTOMER_INTELLIGENCE_VERSION
|
|
1
|
+
export{CUSTOMER_INTELLIGENCE_VERSION}from'./types.js';export{getIndustryRiskChecks,getIndustryNeeds}from'./industry-risks.js';export{getDefaultPreferences,getIndustryTemplate,mergePreferences,validatePreferences,SUPPORTED_INDUSTRIES}from'./user-preferences.js';export{monitorOrder,sortAlerts}from'./order-monitor.js';
|