@wowok/agent-mcp 3.1.2 → 3.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config/runtime.js +1 -1
- 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/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/architecture.spec.d.ts +1 -0
- package/dist/evaluation/architecture.spec.js +1 -0
- 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/guard-scan.d.ts +10 -0
- package/dist/evaluation/guard-scan.js +1 -0
- package/dist/evaluation/standards.d.ts +31 -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 +9 -0
- package/dist/experience/realtime-feedback.js +1 -1
- package/dist/extensions/index.d.ts +1 -1
- package/dist/extensions/index.js +1 -1
- package/dist/extensions/industry-layers.d.ts +6 -5
- package/dist/extensions/industry-layers.js +1 -1
- package/dist/extensions/industry-pack.js +1 -1
- package/dist/graph/onchain/analyze.d.ts +13 -0
- 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 +10 -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/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/index.d.ts +8 -2
- package/dist/graph/onchain/index.js +1 -1
- package/dist/graph/onchain/interest.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/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/table-ledger.spec.d.ts +1 -0
- package/dist/graph/onchain/table-ledger.spec.js +1 -0
- package/dist/graph/onchain/types.d.ts +46 -6
- 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/knowledge/allocation-ledger.js +1 -1
- package/dist/knowledge/allocation-risk.d.ts +0 -2
- package/dist/knowledge/allocation-risk.js +1 -1
- package/dist/knowledge/arb-risk.d.ts +0 -1
- package/dist/knowledge/arb-risk.js +1 -1
- package/dist/knowledge/arbitration-risk.d.ts +0 -2
- package/dist/knowledge/arbitration-risk.js +1 -1
- package/dist/knowledge/baselines/evaluation-baselines.json +79 -0
- 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/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/bridge-risk.d.ts +0 -1
- package/dist/knowledge/bridge-risk.js +1 -1
- package/dist/knowledge/contact-risk.d.ts +0 -1
- 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 +0 -1
- package/dist/knowledge/demand-risk.js +1 -1
- package/dist/knowledge/getting-started.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-lint.d.ts +1 -1
- package/dist/knowledge/guard-lint.js +1 -1
- package/dist/knowledge/guard-risk.d.ts +4 -19
- package/dist/knowledge/guard-risk.js +1 -1
- package/dist/knowledge/index.d.ts +41 -43
- 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/jsonrpc-enum.js +1 -1
- package/dist/knowledge/machine-risk.d.ts +0 -6
- package/dist/knowledge/machine-risk.js +1 -1
- package/dist/knowledge/order-risk.d.ts +1 -9
- package/dist/knowledge/order-risk.js +1 -1
- package/dist/knowledge/payment-risk.d.ts +0 -1
- package/dist/knowledge/payment-risk.js +1 -1
- package/dist/knowledge/permission-risk.d.ts +0 -3
- package/dist/knowledge/permission-risk.js +1 -1
- package/dist/knowledge/personal-risk.d.ts +0 -1
- package/dist/knowledge/personal-risk.js +1 -1
- package/dist/knowledge/progress-risk.d.ts +0 -2
- package/dist/knowledge/progress-risk.js +1 -1
- package/dist/knowledge/proof-risk.d.ts +0 -1
- 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/registrar-risk.d.ts +0 -1
- package/dist/knowledge/registrar-risk.js +1 -1
- package/dist/knowledge/repository-risk.d.ts +0 -1
- package/dist/knowledge/repository-risk.js +1 -1
- package/dist/knowledge/resource-risk.d.ts +0 -1
- package/dist/knowledge/resource-risk.js +1 -1
- package/dist/knowledge/reward-risk.d.ts +1 -5
- 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-topology.js +1 -1
- package/dist/knowledge/service-risk-node.js +1 -1
- package/dist/knowledge/service-risk.d.ts +0 -3
- package/dist/knowledge/service-risk.js +1 -1
- package/dist/knowledge/template-registry.js +1 -1
- package/dist/knowledge/tools-reference.js +1 -1
- package/dist/knowledge/treasury-risk.d.ts +2 -3
- package/dist/knowledge/treasury-risk.js +1 -1
- package/dist/knowledge/util-risk.d.ts +0 -1
- package/dist/knowledge/util-risk.js +1 -1
- package/dist/monitor/MonitorLoop.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/model.d.ts +2 -1
- package/dist/persona/model.js +1 -1
- package/dist/persona/topology-focus.d.ts +2 -2
- package/dist/persona/topology-focus.js +1 -1
- package/dist/persona/types.d.ts +12 -0
- package/dist/playbooks/service-build/business-puzzle.js +1 -1
- package/dist/playbooks/service-build/facet-money.d.ts +22 -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 +3 -0
- package/dist/playbooks/service-build/machine-panorama.js +1 -1
- package/dist/playbooks/service-build/object-panorama.d.ts +27 -27
- package/dist/playbooks/service-build/object-panorama.js +1 -1
- package/dist/playbooks/service-build/pipeline-actions.d.ts +2 -2
- package/dist/playbooks/service-build/pipeline-actions.js +1 -1
- package/dist/playbooks/service-build/risk-aggregator.d.ts +2 -1
- package/dist/playbooks/service-build/risk-aggregator.js +1 -1
- package/dist/playbooks/service-build/service-panorama.d.ts +4 -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/review/arb.d.ts +0 -2
- package/dist/review/arb.js +1 -1
- package/dist/review/order.d.ts +0 -1
- package/dist/review/order.js +1 -1
- 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/call/base.d.ts +3372 -668
- package/dist/schema/call/base.js +1 -1
- package/dist/schema/call/handler.js +1 -1
- package/dist/schema/call/receipt.d.ts +28 -0
- package/dist/schema/call/receipt.js +1 -0
- 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/treasury.js +1 -1
- package/dist/schema/common/index.js +1 -1
- package/dist/schema/evaluation/index.d.ts +289 -211
- package/dist/schema/evaluation/index.js +1 -1
- package/dist/schema/goal/index.d.ts +1 -1
- package/dist/schema/goal/planning.d.ts +2 -2
- package/dist/schema/index.d.ts +0 -1
- package/dist/schema/index.js +1 -1
- package/dist/schema/industry-pack/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/operations.d.ts +26 -10
- package/dist/schema/operations.js +1 -1
- package/dist/schema/persona/index.d.ts +24 -24
- package/dist/schema/query/bi.d.ts +613 -0
- package/dist/schema/query/bi.js +1 -1
- package/dist/schema/query/index.d.ts +9 -9
- package/dist/schema/schema-version.js +1 -1
- package/dist/schema/workspace/index.d.ts +2 -2
- package/dist/schema-query-impl/index.js +1 -1
- package/dist/schemas/account_operation.output.json +1 -1
- package/dist/schemas/bridge_operation.output.json +1 -1
- package/dist/schemas/evaluation_operation.output.json +691 -163
- package/dist/schemas/evaluation_operation.schema.json +0 -429
- package/dist/schemas/index.json +1 -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/messenger_operation.output.json +1 -1
- 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 +1 -1
- package/dist/schemas/onchain_operations.output.json +6357 -3724
- package/dist/schemas/onchain_operations.schema.json +2 -2
- package/dist/schemas/onchain_operations_treasury.schema.json +2 -2
- package/dist/schemas/onchain_table_data.output.json +61 -71
- package/dist/schemas/query_toolkit.output.json +841 -8
- package/dist/schemas/query_toolkit.schema.json +59 -1
- package/dist/strategy/metrics.js +1 -1
- 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/onchain.js +1 -1
- package/dist/tools/handlers/query.js +1 -1
- package/dist/tools/index.js +1 -1
- package/dist/tools/registry/evaluation.d.ts +2 -0
- package/dist/tools/registry/evaluation.js +1 -0
- package/dist/tools/registry/query.js +1 -1
- 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 +4 -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
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;
|
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';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IndustryServicePuzzle } from "./types.js";
|
|
2
2
|
import { CUSTOMER_INTELLIGENCE_VERSION } from "./types.js";
|
|
3
3
|
import type { Industry } from "./user-preferences.js";
|
|
4
4
|
export type IndustryNeedTier = "common" | "personalized" | "advanced";
|
|
@@ -6,7 +6,7 @@ export interface IndustryNeed {
|
|
|
6
6
|
id: string;
|
|
7
7
|
tier: IndustryNeedTier;
|
|
8
8
|
description: string;
|
|
9
|
-
satisfied: (puzzle:
|
|
9
|
+
satisfied: (puzzle: IndustryServicePuzzle) => boolean;
|
|
10
10
|
advice?: string;
|
|
11
11
|
}
|
|
12
12
|
export interface IndustryRiskCheck {
|
|
@@ -14,27 +14,13 @@ export interface IndustryRiskCheck {
|
|
|
14
14
|
industry: Industry;
|
|
15
15
|
description: string;
|
|
16
16
|
weight: number;
|
|
17
|
-
passed: (puzzle:
|
|
17
|
+
passed: (puzzle: IndustryServicePuzzle) => boolean;
|
|
18
18
|
advice?: string;
|
|
19
19
|
}
|
|
20
|
-
export interface IndustryRiskResult {
|
|
21
|
-
industry: Industry;
|
|
22
|
-
checks: RiskCheck[];
|
|
23
|
-
needs: IndustryNeed[];
|
|
24
|
-
unmet_needs: IndustryNeed[];
|
|
25
|
-
score_adjustment: number;
|
|
26
|
-
summary: string;
|
|
27
|
-
}
|
|
28
20
|
export declare function _setRegistryLookup(fn: ((industry: string) => {
|
|
29
21
|
risk_checks?: IndustryRiskCheck[];
|
|
30
22
|
needs?: IndustryNeed[];
|
|
31
23
|
} | undefined) | null): void;
|
|
32
24
|
export declare function getIndustryRiskChecks(industry: Industry): IndustryRiskCheck[];
|
|
33
25
|
export declare function getIndustryNeeds(industry: Industry): IndustryNeed[];
|
|
34
|
-
export declare function checkIndustryNeeds(puzzle: InfoPuzzle, industry: Industry): {
|
|
35
|
-
met: IndustryNeed[];
|
|
36
|
-
unmet: IndustryNeed[];
|
|
37
|
-
};
|
|
38
|
-
export declare function assessIndustryRisks(puzzle: InfoPuzzle, industry: Industry): IndustryRiskResult;
|
|
39
|
-
export declare function inferIndustry(puzzle: InfoPuzzle): Industry | undefined;
|
|
40
26
|
export { CUSTOMER_INTELLIGENCE_VERSION };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{CUSTOMER_INTELLIGENCE_VERSION}from'./types.js';const hasRefundPath=a=>a['workflow_analysis']?.['has_refund_path']??![],hasArbitrationPath=a=>a['workflow_analysis']?.['has_arbitration_path']??![],hasMilestoneNodes=a=>a['workflow_analysis']?.['has_milestone_nodes']??![],hasMessenger=a=>a['trust_signals']?.['has_messenger']??![],compensationCoversOrder=a=>a['fund_safety']?.['compensation_covers_order']??![],lockDurationSafe=a=>a['fund_safety']?.['lock_duration_safe']??![],userOperableForwards=a=>a['workflow_analysis']?.['user_operable_forwards']??0x0,wipVerified=a=>a['service_basics']['wip_verified']===!![],hasCompensationFund=a=>a['service_basics']['compensation_fund_balance']>0x0n,deadEndCount=a=>a['workflow_analysis']?.['dead_end_nodes']?.['length']??0x0,totalNodes=a=>a['workflow_analysis']?.['total_nodes']??0x0,trustScore=a=>a['trust_signals']?.['trust_score']??0x0,reviewTotal=a=>a['trust_signals']?.['review_total']??0x0,merchantTotalOrders=a=>a['merchant_behavior']?.['total_orders']??0x0,repeatBuyerRate=a=>a['merchant_behavior']?.['repeat_buyer_rate']??0x0,disputeRate=a=>a['merchant_behavior']?.['dispute_rate']??0x1,INDUSTRY_RISK_CHECKS={'freelance':[{'id':'fr_wip_verified','industry':'freelance','dimension':'trust','description':'WIP\x20hash\x20verified\x20(work\x20traceable)','weight':0x1e,'passed':wipVerified,'advice':'⚠️\x20WIP\x20not\x20verified:\x20freelance\x20deliverables\x20cannot\x20be\x20traced.\x20Recommend\x20asking\x20the\x20merchant\x20to\x20provide\x20a\x20WIP\x20hash\x20and\x20write\x20it\x20into\x20WTS.'},{'id':'fr_milestone_nodes','industry':'freelance','dimension':'workflow','description':'Has\x20milestone\x20nodes\x20(phased\x20acceptance)','weight':0x19,'passed':hasMilestoneNodes,'advice':'⚠️\x20No\x20milestone\x20nodes:\x20delivery\x20is\x20completed\x20in\x20one\x20go\x20without\x20intermediate\x20acceptance.\x20Recommend\x20asking\x20the\x20merchant\x20to\x20add\x20phased\x20delivery\x20nodes.'},{'id':'fr_refund_path','industry':'freelance','dimension':'workflow','description':'Has\x20refund\x20path','weight':0x19,'passed':hasRefundPath,'advice':'⚠️\x20No\x20refund\x20path:\x20if\x20freelance\x20order\x20delivery\x20is\x20not\x20satisfactory,\x20funds\x20are\x20hard\x20to\x20recover.'},{'id':'fr_response_time','industry':'freelance','dimension':'trust','description':'Messenger\x20configured\x20(communication\x20response\x20guarantee)','weight':0x14,'passed':hasMessenger,'advice':'⚠️\x20Messenger\x20not\x20configured:\x20cannot\x20conduct\x20requirement\x20confirmation\x20and\x20revision\x20communication.'}],'rental':[{'id':'rt_compensation_full','industry':'rental','dimension':'fund','description':'Compensation\x20fully\x20covers\x20order\x20amount','weight':0x1e,'passed':compensationCoversOrder,'advice':'🔴\x20Compensation\x20not\x20fully\x20covered:\x20insufficient\x20payout\x20when\x20rental\x20item\x20is\x20damaged.\x20Recommend\x20choosing\x20a\x20merchant\x20with\x20sufficient\x20compensation\x20fund.'},{'id':'rt_lock_duration','industry':'rental','dimension':'fund','description':'Lock\x20duration\x20safe\x20(compensation\x20cannot\x20be\x20withdrawn\x20by\x20merchant\x20at\x20any\x20time)','weight':0x19,'passed':lockDurationSafe,'advice':'⚠️\x20Lock\x20duration\x20not\x20safe:\x20merchant\x20may\x20withdraw\x20compensation\x20at\x20any\x20time,\x20deposit\x20safety\x20not\x20guaranteed.'},{'id':'rt_arbitration','industry':'rental','dimension':'workflow','description':'Arbitration\x20configured\x20(damage\x20dispute\x20resolution)','weight':0x19,'passed':hasArbitrationPath,'advice':'⚠️\x20Arbitration\x20not\x20configured:\x20no\x20third-party\x20ruling\x20channel\x20for\x20rental\x20damage\x20disputes.'},{'id':'rt_user_operable','industry':'rental','dimension':'workflow','description':'Has\x20user-operable\x20path\x20(return/confirm)','weight':0x14,'passed':a=>userOperableForwards(a)>0x0,'advice':'🔴\x20No\x20user-operable\x20path:\x20return\x20process\x20relies\x20entirely\x20on\x20merchant,\x20may\x20be\x20maliciously\x20delayed.'}],'education':[{'id':'ed_refund_path','industry':'education','dimension':'workflow','description':'Has\x20refund\x20path\x20(refund\x20guarantee)','weight':0x1e,'passed':hasRefundPath,'advice':'🔴\x20No\x20refund\x20path:\x20course\x20refund\x20not\x20guaranteed,\x20recommend\x20asking\x20the\x20merchant\x20to\x20configure\x20a\x20refund\x20Allocator.'},{'id':'ed_compensation','industry':'education','dimension':'fund','description':'Has\x20compensation\x20fund','weight':0x19,'passed':hasCompensationFund,'advice':'⚠️\x20No\x20compensation\x20fund:\x20no\x20automatic\x20compensation\x20source\x20when\x20course\x20service\x20quality\x20is\x20not\x20up\x20to\x20standard.'},{'id':'ed_arbitration','industry':'education','dimension':'workflow','description':'Arbitration\x20configured','weight':0x19,'passed':hasArbitrationPath,'advice':'⚠️\x20Arbitration\x20not\x20configured:\x20no\x20resolution\x20channel\x20for\x20course\x20quality\x20disputes.'},{'id':'ed_long_cycle_ok','industry':'education','dimension':'workflow','description':'Long\x20cycle\x20acceptable\x20(education\x20industry\x20allows\x20long\x20cycles,\x20over\x2090\x20days\x20needs\x20attention)','weight':0x14,'passed':()=>!![],'advice':'ℹ️\x20Long\x20delivery\x20cycles\x20are\x20normal\x20in\x20education,\x20but\x20if\x20the\x20actual\x20cycle\x20exceeds\x2090\x20days,\x20recommend\x20periodically\x20checking\x20learning\x20progress\x20and\x20lesson\x20consumption.'}],'travel':[{'id':'tr_urgent_delivery','industry':'travel','dimension':'workflow','description':'Urgent\x20delivery\x20configuration\x20(needs\x20milestone\x20nodes\x20for\x20phased\x20acceptance)','weight':0x1e,'passed':hasMilestoneNodes,'advice':'⚠️\x20No\x20milestone\x20nodes:\x20travel\x20itinerary\x20has\x20no\x20phased\x20acceptance,\x20recommend\x20setting\x20nodes\x20by\x20itinerary\x20stage.'},{'id':'tr_compensation_full','industry':'travel','dimension':'fund','description':'Compensation\x20fully\x20covers\x20(breach\x20compensation)','weight':0x19,'passed':compensationCoversOrder,'advice':'🔴\x20Compensation\x20not\x20fully\x20covered:\x20insufficient\x20payout\x20when\x20itinerary\x20breaches.'},{'id':'tr_refund_path','industry':'travel','dimension':'workflow','description':'Has\x20refund\x20path\x20(itinerary\x20change/cancellation)','weight':0x19,'passed':hasRefundPath,'advice':'⚠️\x20No\x20refund\x20path:\x20funds\x20hard\x20to\x20recover\x20when\x20itinerary\x20changes\x20or\x20cancels\x20due\x20to\x20force\x20majeure.'},{'id':'tr_messenger','industry':'travel','dimension':'trust','description':'Messenger\x20configured\x20(emergency\x20communication)','weight':0x14,'passed':hasMessenger,'advice':'⚠️\x20Messenger\x20not\x20configured:\x20cannot\x20immediately\x20contact\x20merchant\x20during\x20travel\x20emergencies.'}],'subscription':[{'id':'sub_no_lockin','industry':'subscription','dimension':'workflow','description':'No\x20long-term\x20lock-in\x20(no\x20dead-end\x20nodes,\x20can\x20exit)','weight':0x1e,'passed':a=>deadEndCount(a)===0x0,'advice':'🔴\x20Dead-end\x20nodes\x20exist:\x20subscription\x20may\x20be\x20locked\x20and\x20unable\x20to\x20exit,\x20auto-renewal\x20trap\x20exists.'},{'id':'sub_refund_path','industry':'subscription','dimension':'workflow','description':'Has\x20refund\x20path\x20(exit\x20mechanism)','weight':0x19,'passed':hasRefundPath,'advice':'⚠️\x20No\x20refund\x20path:\x20remaining\x20cycle\x20fees\x20hard\x20to\x20recover\x20after\x20subscription\x20exit.'},{'id':'sub_user_operable','industry':'subscription','dimension':'workflow','description':'Has\x20user-operable\x20path\x20(pause/downgrade/cancel)','weight':0x19,'passed':a=>userOperableForwards(a)>0x0,'advice':'🔴\x20No\x20user-operable\x20path:\x20subscription\x20status\x20entirely\x20controlled\x20by\x20merchant,\x20cannot\x20pause\x20or\x20cancel\x20independently.'},{'id':'sub_compensation_optional','industry':'subscription','dimension':'fund','description':'Compensation\x20optional\x20(not\x20mandatory\x20for\x20subscription\x20industry)','weight':0x14,'passed':()=>!![],'advice':'ℹ️\x20Compensation\x20is\x20not\x20mandatory\x20for\x20subscription\x20industry;\x20having\x20it\x20is\x20better.'}],'retail':[{'id':'ret_wip_verified','industry':'retail','dimension':'trust','description':'WIP\x20verified\x20(authenticity/logistics\x20traceable)','weight':0x19,'passed':wipVerified,'advice':'⚠️\x20WIP\x20not\x20verified:\x20product\x20traceability\x20info\x20missing,\x20recommend\x20confirming\x20authenticity\x20guarantee.'},{'id':'ret_compensation_full','industry':'retail','dimension':'fund','description':'Compensation\x20fully\x20covers','weight':0x19,'passed':compensationCoversOrder,'advice':'⚠️\x20Compensation\x20not\x20fully\x20covered:\x20insufficient\x20payout\x20for\x20return/exchange\x20disputes.'},{'id':'ret_refund_path','industry':'retail','dimension':'workflow','description':'Has\x20refund\x20path\x20(return/exchange)','weight':0x19,'passed':hasRefundPath,'advice':'🔴\x20No\x20refund\x20path:\x20return/exchange\x20not\x20guaranteed.'},{'id':'ret_arbitration','industry':'retail','dimension':'workflow','description':'Arbitration\x20configured','weight':0x19,'passed':hasArbitrationPath,'advice':'⚠️\x20Arbitration\x20not\x20configured:\x20no\x20third-party\x20ruling\x20for\x20return/exchange\x20disputes.'}]};function commonNeeds(){return[{'id':'need_arbitration','tier':'common','description':'Arbitration\x20configured\x20(dispute\x20resolution\x20channel)','satisfied':hasArbitrationPath,'advice':'Arbitration\x20not\x20configured:\x20no\x20third-party\x20resolution\x20channel\x20for\x20disputes.'},{'id':'need_refund_path','tier':'common','description':'Has\x20refund\x20path','satisfied':hasRefundPath,'advice':'No\x20refund\x20path:\x20funds\x20hard\x20to\x20recover\x20when\x20delivery\x20fails.'},{'id':'need_user_operable','tier':'common','description':'Has\x20user-operable\x20Forward','satisfied':a=>userOperableForwards(a)>0x0,'advice':'No\x20user-operable\x20steps\x20in\x20workflow,\x20order\x20progress\x20depends\x20entirely\x20on\x20merchant.'},{'id':'need_messenger','tier':'common','description':'Messenger\x20configured','satisfied':hasMessenger,'advice':'Merchant\x20has\x20no\x20Messenger\x20channel,\x20cannot\x20negotiate\x20or\x20conduct\x20after-sales\x20communication.'}];}const INDUSTRY_NEEDS={'freelance':[...commonNeeds(),{'id':'need_wip_verified','tier':'personalized','description':'WIP\x20verified\x20(work\x20IP\x20traceable)','satisfied':wipVerified,'advice':'WIP\x20not\x20verified:\x20IP\x20ownership\x20and\x20originality\x20of\x20work\x20cannot\x20be\x20traced.'},{'id':'need_milestone_nodes','tier':'personalized','description':'Milestone\x20nodes\x20(phased\x20feedback)','satisfied':hasMilestoneNodes,'advice':'No\x20milestone\x20nodes:\x20lack\x20of\x20phased\x20feedback\x20and\x20revision\x20round\x20control.'},{'id':'need_merchant_history','tier':'advanced','description':'Merchant\x20history\x20≥3\x20orders\x20(fulfillment\x20experience)','satisfied':a=>merchantTotalOrders(a)>=0x3,'advice':'Merchant\x20history\x20orders\x20less\x20than\x203:\x20fulfillment\x20experience\x20is\x20limited.'}],'rental':[...commonNeeds(),{'id':'need_lock_duration_safe','tier':'personalized','description':'Lock\x20duration\x20safe\x20(deposit\x20cannot\x20be\x20withdrawn)','satisfied':lockDurationSafe,'advice':'Lock\x20duration\x20not\x20safe:\x20deposit\x20may\x20be\x20withdrawn\x20by\x20merchant\x20at\x20any\x20time.'},{'id':'need_compensation_full','tier':'personalized','description':'Compensation\x20fully\x20covers','satisfied':compensationCoversOrder,'advice':'Compensation\x20not\x20fully\x20covered:\x20insufficient\x20payout\x20for\x20rental\x20item\x20damage.'},{'id':'need_merchant_history','tier':'advanced','description':'Merchant\x20history\x20≥5\x20orders\x20(rental\x20experience)','satisfied':a=>merchantTotalOrders(a)>=0x5,'advice':'Merchant\x20history\x20orders\x20less\x20than\x205:\x20rental\x20service\x20experience\x20limited.'}],'education':[...commonNeeds(),{'id':'need_has_compensation','tier':'personalized','description':'Has\x20compensation\x20fund\x20(course\x20quality\x20guarantee)','satisfied':hasCompensationFund,'advice':'No\x20compensation\x20fund:\x20no\x20compensation\x20source\x20when\x20course\x20quality\x20is\x20not\x20up\x20to\x20standard.'},{'id':'need_long_cycle_ok','tier':'personalized','description':'Long\x20cycle\x20acceptable','satisfied':()=>!![],'advice':'Long\x20cycles\x20are\x20normal\x20in\x20education;\x20recommend\x20tracking\x20lesson\x20consumption\x20and\x20attendance.'},{'id':'need_high_reputation','tier':'advanced','description':'High\x20reputation\x20score\x20(trust_score\x20≥70)','satisfied':a=>trustScore(a)>=0x46,'advice':'Merchant\x20reputation\x20score\x20below\x2070:\x20course\x20reputation\x20may\x20be\x20poor.'}],'travel':[...commonNeeds(),{'id':'need_urgent_delivery','tier':'personalized','description':'Urgent\x20delivery\x20configuration\x20(milestone\x20phasing)','satisfied':hasMilestoneNodes,'advice':'No\x20milestone\x20nodes:\x20itinerary\x20has\x20no\x20phased\x20acceptance,\x20urgent\x20delivery\x20guarantee\x20insufficient.'},{'id':'need_compensation_full','tier':'personalized','description':'Compensation\x20fully\x20covers\x20(breach\x20compensation)','satisfied':compensationCoversOrder,'advice':'Compensation\x20not\x20fully\x20covered:\x20insufficient\x20payout\x20for\x20itinerary\x20breach.'},{'id':'need_high_reputation','tier':'advanced','description':'High\x20reputation\x20score\x20(trust_score\x20≥70)','satisfied':a=>trustScore(a)>=0x46,'advice':'Merchant\x20reputation\x20score\x20below\x2070:\x20travel\x20service\x20reputation\x20may\x20be\x20poor.'}],'subscription':[...commonNeeds(),{'id':'need_no_lockin','tier':'personalized','description':'No\x20long-term\x20lock-in\x20(no\x20dead-end\x20nodes)','satisfied':a=>deadEndCount(a)===0x0,'advice':'Dead-end\x20nodes\x20exist:\x20subscription\x20may\x20be\x20locked,\x20auto-renewal\x20trap\x20exists.'},{'id':'need_low_dispute','tier':'personalized','description':'Low\x20dispute\x20rate\x20(≤15%,\x20stable\x20content\x20quality)','satisfied':a=>disputeRate(a)<=0.15,'advice':'Dispute\x20rate\x20is\x20high:\x20subscription\x20content\x20quality\x20may\x20be\x20unstable.'},{'id':'need_repeat_rate','tier':'advanced','description':'Repeat\x20buyer\x20rate\x20≥20%\x20(strong\x20subscription\x20renewal\x20willingness)','satisfied':a=>repeatBuyerRate(a)>=0.2,'advice':'Repeat\x20buyer\x20rate\x20below\x2020%:\x20subscription\x20renewal\x20willingness\x20is\x20weak,\x20service\x20may\x20not\x20be\x20worth\x20long-term\x20subscription.'}],'retail':[...commonNeeds(),{'id':'need_wip_verified','tier':'personalized','description':'WIP\x20verified\x20(authenticity/logistics\x20traceability)','satisfied':wipVerified,'advice':'WIP\x20not\x20verified:\x20product\x20authenticity\x20and\x20logistics\x20traceability\x20info\x20missing.'},{'id':'need_compensation_full','tier':'personalized','description':'Compensation\x20fully\x20covers','satisfied':compensationCoversOrder,'advice':'Compensation\x20not\x20fully\x20covered:\x20insufficient\x20payout\x20for\x20return/exchange\x20disputes.'},{'id':'need_high_reputation','tier':'advanced','description':'High\x20reputation\x20score\x20(trust_score\x20≥70)','satisfied':a=>trustScore(a)>=0x46,'advice':'Merchant\x20reputation\x20score\x20below\x2070:\x20product\x20or\x20service\x20reputation\x20may\x20be\x20poor.'}]};let _registryLookup=null;export function _setRegistryLookup(a){_registryLookup=a;}export function getIndustryRiskChecks(a){if(_registryLookup){const b=_registryLookup(a);if(b?.['risk_checks'])return b['risk_checks'];}return INDUSTRY_RISK_CHECKS[a];}export function getIndustryNeeds(a){if(_registryLookup){const b=_registryLookup(a);if(b?.['needs'])return b['needs'];}return INDUSTRY_NEEDS[a];}export function checkIndustryNeeds(a,b){const c=getIndustryNeeds(b),d=[],e=[];for(const f of c){if(f['satisfied'](a))d['push'](f);else e['push'](f);}return{'met':d,'unmet':e};}export function assessIndustryRisks(a,b){const c=INDUSTRY_RISK_CHECKS[b],d=c['reduce']((p,q)=>p+q['weight'],0x0),e=c['map'](p=>{const q=p['passed'](a);return{'id':p['id'],'dimension':p['dimension'],'description':p['description'],'weight':p['weight'],'passed':q,'advice':q?undefined:p['advice']};}),f=e['reduce']((p,q)=>p+(q['passed']?q['weight']:0x0),0x0),g=d>0x0?f/d:0x0,h=Math['round']((g-0.5)*0x14),i=Math['max'](-0xa,Math['min'](0xa,h)),j=getIndustryNeeds(b),{met:k,unmet:l}=checkIndustryNeeds(a,b),m=e['filter'](p=>p['passed'])['length'],n=i>=0x0?'+':'',o=b+'\x20industry\x20risk\x20check:\x20'+m+'\x20checks\x20passed\x20out\x20of\x20'+e['length']+('\x20(pass\x20rate\x20'+Math['round'](g*0x64)+'%);\x20'+k['length']+'\x20needs\x20satisfied\x20out\x20of\x20'+j['length']+';')+('\x20Score\x20adjustment\x20'+n+i+'.');return{'industry':b,'checks':e,'needs':j,'unmet_needs':l,'score_adjustment':i,'summary':o};}export function inferIndustry(a){const b=a['service_basics'];if(b['price_raw']<0x3b9aca00n&&b['has_wip'])return'retail';if(b['compensation_lock_duration']>0x7)return'rental';if(reviewTotal(a)>0x32)return'retail';if(totalNodes(a)>0xa)return'education';return'freelance';}export{CUSTOMER_INTELLIGENCE_VERSION};
|
|
1
|
+
import{CUSTOMER_INTELLIGENCE_VERSION}from'./types.js';const hasRefundPath=a=>a['workflow_analysis']?.['has_refund_path']??![],hasArbitrationPath=a=>a['workflow_analysis']?.['has_arbitration_path']??![],hasMilestoneNodes=a=>a['workflow_analysis']?.['has_milestone_nodes']??![],hasMessenger=a=>a['trust_signals']?.['has_messenger']??![],compensationCoversOrder=a=>a['fund_safety']?.['compensation_covers_order']??![],lockDurationSafe=a=>a['fund_safety']?.['lock_duration_safe']??![],userOperableForwards=a=>a['workflow_analysis']?.['user_operable_forwards']??0x0,wipVerified=a=>a['service_basics']['wip_verified']===!![],hasCompensationFund=a=>a['service_basics']['compensation_fund_balance']>0x0n,deadEndCount=a=>a['workflow_analysis']?.['dead_end_nodes']?.['length']??0x0,trustScore=a=>a['trust_signals']?.['trust_score']??0x0,merchantTotalOrders=a=>a['merchant_behavior']?.['total_orders']??0x0,repeatBuyerRate=a=>a['merchant_behavior']?.['repeat_buyer_rate']??0x0,disputeRate=a=>a['merchant_behavior']?.['dispute_rate']??0x1,INDUSTRY_RISK_CHECKS={'freelance':[{'id':'fr_wip_verified','industry':'freelance','dimension':'trust','description':'WIP\x20hash\x20verified\x20(work\x20traceable)','weight':0x1e,'passed':wipVerified,'advice':'⚠️\x20WIP\x20not\x20verified:\x20freelance\x20deliverables\x20cannot\x20be\x20traced.\x20Recommend\x20asking\x20the\x20merchant\x20to\x20provide\x20a\x20WIP\x20hash\x20and\x20write\x20it\x20into\x20WTS.'},{'id':'fr_milestone_nodes','industry':'freelance','dimension':'workflow','description':'Has\x20milestone\x20nodes\x20(phased\x20acceptance)','weight':0x19,'passed':hasMilestoneNodes,'advice':'⚠️\x20No\x20milestone\x20nodes:\x20delivery\x20is\x20completed\x20in\x20one\x20go\x20without\x20intermediate\x20acceptance.\x20Recommend\x20asking\x20the\x20merchant\x20to\x20add\x20phased\x20delivery\x20nodes.'},{'id':'fr_refund_path','industry':'freelance','dimension':'workflow','description':'Has\x20refund\x20path','weight':0x19,'passed':hasRefundPath,'advice':'⚠️\x20No\x20refund\x20path:\x20if\x20freelance\x20order\x20delivery\x20is\x20not\x20satisfactory,\x20funds\x20are\x20hard\x20to\x20recover.'},{'id':'fr_response_time','industry':'freelance','dimension':'trust','description':'Messenger\x20configured\x20(communication\x20response\x20guarantee)','weight':0x14,'passed':hasMessenger,'advice':'⚠️\x20Messenger\x20not\x20configured:\x20cannot\x20conduct\x20requirement\x20confirmation\x20and\x20revision\x20communication.'}],'rental':[{'id':'rt_compensation_full','industry':'rental','dimension':'fund','description':'Compensation\x20fully\x20covers\x20order\x20amount','weight':0x1e,'passed':compensationCoversOrder,'advice':'🔴\x20Compensation\x20not\x20fully\x20covered:\x20insufficient\x20payout\x20when\x20rental\x20item\x20is\x20damaged.\x20Recommend\x20choosing\x20a\x20merchant\x20with\x20sufficient\x20compensation\x20fund.'},{'id':'rt_lock_duration','industry':'rental','dimension':'fund','description':'Lock\x20duration\x20safe\x20(compensation\x20cannot\x20be\x20withdrawn\x20by\x20merchant\x20at\x20any\x20time)','weight':0x19,'passed':lockDurationSafe,'advice':'⚠️\x20Lock\x20duration\x20not\x20safe:\x20merchant\x20may\x20withdraw\x20compensation\x20at\x20any\x20time,\x20deposit\x20safety\x20not\x20guaranteed.'},{'id':'rt_arbitration','industry':'rental','dimension':'workflow','description':'Arbitration\x20configured\x20(damage\x20dispute\x20resolution)','weight':0x19,'passed':hasArbitrationPath,'advice':'⚠️\x20Arbitration\x20not\x20configured:\x20no\x20third-party\x20ruling\x20channel\x20for\x20rental\x20damage\x20disputes.'},{'id':'rt_user_operable','industry':'rental','dimension':'workflow','description':'Has\x20user-operable\x20path\x20(return/confirm)','weight':0x14,'passed':a=>userOperableForwards(a)>0x0,'advice':'🔴\x20No\x20user-operable\x20path:\x20return\x20process\x20relies\x20entirely\x20on\x20merchant,\x20may\x20be\x20maliciously\x20delayed.'}],'education':[{'id':'ed_refund_path','industry':'education','dimension':'workflow','description':'Has\x20refund\x20path\x20(refund\x20guarantee)','weight':0x1e,'passed':hasRefundPath,'advice':'🔴\x20No\x20refund\x20path:\x20course\x20refund\x20not\x20guaranteed,\x20recommend\x20asking\x20the\x20merchant\x20to\x20configure\x20a\x20refund\x20Allocator.'},{'id':'ed_compensation','industry':'education','dimension':'fund','description':'Has\x20compensation\x20fund','weight':0x19,'passed':hasCompensationFund,'advice':'⚠️\x20No\x20compensation\x20fund:\x20no\x20automatic\x20compensation\x20source\x20when\x20course\x20service\x20quality\x20is\x20not\x20up\x20to\x20standard.'},{'id':'ed_arbitration','industry':'education','dimension':'workflow','description':'Arbitration\x20configured','weight':0x19,'passed':hasArbitrationPath,'advice':'⚠️\x20Arbitration\x20not\x20configured:\x20no\x20resolution\x20channel\x20for\x20course\x20quality\x20disputes.'},{'id':'ed_long_cycle_ok','industry':'education','dimension':'workflow','description':'Long\x20cycle\x20acceptable\x20(education\x20industry\x20allows\x20long\x20cycles,\x20over\x2090\x20days\x20needs\x20attention)','weight':0x14,'passed':()=>!![],'advice':'ℹ️\x20Long\x20delivery\x20cycles\x20are\x20normal\x20in\x20education,\x20but\x20if\x20the\x20actual\x20cycle\x20exceeds\x2090\x20days,\x20recommend\x20periodically\x20checking\x20learning\x20progress\x20and\x20lesson\x20consumption.'}],'travel':[{'id':'tr_urgent_delivery','industry':'travel','dimension':'workflow','description':'Urgent\x20delivery\x20configuration\x20(needs\x20milestone\x20nodes\x20for\x20phased\x20acceptance)','weight':0x1e,'passed':hasMilestoneNodes,'advice':'⚠️\x20No\x20milestone\x20nodes:\x20travel\x20itinerary\x20has\x20no\x20phased\x20acceptance,\x20recommend\x20setting\x20nodes\x20by\x20itinerary\x20stage.'},{'id':'tr_compensation_full','industry':'travel','dimension':'fund','description':'Compensation\x20fully\x20covers\x20(breach\x20compensation)','weight':0x19,'passed':compensationCoversOrder,'advice':'🔴\x20Compensation\x20not\x20fully\x20covered:\x20insufficient\x20payout\x20when\x20itinerary\x20breaches.'},{'id':'tr_refund_path','industry':'travel','dimension':'workflow','description':'Has\x20refund\x20path\x20(itinerary\x20change/cancellation)','weight':0x19,'passed':hasRefundPath,'advice':'⚠️\x20No\x20refund\x20path:\x20funds\x20hard\x20to\x20recover\x20when\x20itinerary\x20changes\x20or\x20cancels\x20due\x20to\x20force\x20majeure.'},{'id':'tr_messenger','industry':'travel','dimension':'trust','description':'Messenger\x20configured\x20(emergency\x20communication)','weight':0x14,'passed':hasMessenger,'advice':'⚠️\x20Messenger\x20not\x20configured:\x20cannot\x20immediately\x20contact\x20merchant\x20during\x20travel\x20emergencies.'}],'subscription':[{'id':'sub_no_lockin','industry':'subscription','dimension':'workflow','description':'No\x20long-term\x20lock-in\x20(no\x20dead-end\x20nodes,\x20can\x20exit)','weight':0x1e,'passed':a=>deadEndCount(a)===0x0,'advice':'🔴\x20Dead-end\x20nodes\x20exist:\x20subscription\x20may\x20be\x20locked\x20and\x20unable\x20to\x20exit,\x20auto-renewal\x20trap\x20exists.'},{'id':'sub_refund_path','industry':'subscription','dimension':'workflow','description':'Has\x20refund\x20path\x20(exit\x20mechanism)','weight':0x19,'passed':hasRefundPath,'advice':'⚠️\x20No\x20refund\x20path:\x20remaining\x20cycle\x20fees\x20hard\x20to\x20recover\x20after\x20subscription\x20exit.'},{'id':'sub_user_operable','industry':'subscription','dimension':'workflow','description':'Has\x20user-operable\x20path\x20(pause/downgrade/cancel)','weight':0x19,'passed':a=>userOperableForwards(a)>0x0,'advice':'🔴\x20No\x20user-operable\x20path:\x20subscription\x20status\x20entirely\x20controlled\x20by\x20merchant,\x20cannot\x20pause\x20or\x20cancel\x20independently.'},{'id':'sub_compensation_optional','industry':'subscription','dimension':'fund','description':'Compensation\x20optional\x20(not\x20mandatory\x20for\x20subscription\x20industry)','weight':0x14,'passed':()=>!![],'advice':'ℹ️\x20Compensation\x20is\x20not\x20mandatory\x20for\x20subscription\x20industry;\x20having\x20it\x20is\x20better.'}],'retail':[{'id':'ret_wip_verified','industry':'retail','dimension':'trust','description':'WIP\x20verified\x20(authenticity/logistics\x20traceable)','weight':0x19,'passed':wipVerified,'advice':'⚠️\x20WIP\x20not\x20verified:\x20product\x20traceability\x20info\x20missing,\x20recommend\x20confirming\x20authenticity\x20guarantee.'},{'id':'ret_compensation_full','industry':'retail','dimension':'fund','description':'Compensation\x20fully\x20covers','weight':0x19,'passed':compensationCoversOrder,'advice':'⚠️\x20Compensation\x20not\x20fully\x20covered:\x20insufficient\x20payout\x20for\x20return/exchange\x20disputes.'},{'id':'ret_refund_path','industry':'retail','dimension':'workflow','description':'Has\x20refund\x20path\x20(return/exchange)','weight':0x19,'passed':hasRefundPath,'advice':'🔴\x20No\x20refund\x20path:\x20return/exchange\x20not\x20guaranteed.'},{'id':'ret_arbitration','industry':'retail','dimension':'workflow','description':'Arbitration\x20configured','weight':0x19,'passed':hasArbitrationPath,'advice':'⚠️\x20Arbitration\x20not\x20configured:\x20no\x20third-party\x20ruling\x20for\x20return/exchange\x20disputes.'}]};function commonNeeds(){return[{'id':'need_arbitration','tier':'common','description':'Arbitration\x20configured\x20(dispute\x20resolution\x20channel)','satisfied':hasArbitrationPath,'advice':'Arbitration\x20not\x20configured:\x20no\x20third-party\x20resolution\x20channel\x20for\x20disputes.'},{'id':'need_refund_path','tier':'common','description':'Has\x20refund\x20path','satisfied':hasRefundPath,'advice':'No\x20refund\x20path:\x20funds\x20hard\x20to\x20recover\x20when\x20delivery\x20fails.'},{'id':'need_user_operable','tier':'common','description':'Has\x20user-operable\x20Forward','satisfied':a=>userOperableForwards(a)>0x0,'advice':'No\x20user-operable\x20steps\x20in\x20workflow,\x20order\x20progress\x20depends\x20entirely\x20on\x20merchant.'},{'id':'need_messenger','tier':'common','description':'Messenger\x20configured','satisfied':hasMessenger,'advice':'Merchant\x20has\x20no\x20Messenger\x20channel,\x20cannot\x20negotiate\x20or\x20conduct\x20after-sales\x20communication.'}];}const INDUSTRY_NEEDS={'freelance':[...commonNeeds(),{'id':'need_wip_verified','tier':'personalized','description':'WIP\x20verified\x20(work\x20IP\x20traceable)','satisfied':wipVerified,'advice':'WIP\x20not\x20verified:\x20IP\x20ownership\x20and\x20originality\x20of\x20work\x20cannot\x20be\x20traced.'},{'id':'need_milestone_nodes','tier':'personalized','description':'Milestone\x20nodes\x20(phased\x20feedback)','satisfied':hasMilestoneNodes,'advice':'No\x20milestone\x20nodes:\x20lack\x20of\x20phased\x20feedback\x20and\x20revision\x20round\x20control.'},{'id':'need_merchant_history','tier':'advanced','description':'Merchant\x20history\x20≥3\x20orders\x20(fulfillment\x20experience)','satisfied':a=>merchantTotalOrders(a)>=0x3,'advice':'Merchant\x20history\x20orders\x20less\x20than\x203:\x20fulfillment\x20experience\x20is\x20limited.'}],'rental':[...commonNeeds(),{'id':'need_lock_duration_safe','tier':'personalized','description':'Lock\x20duration\x20safe\x20(deposit\x20cannot\x20be\x20withdrawn)','satisfied':lockDurationSafe,'advice':'Lock\x20duration\x20not\x20safe:\x20deposit\x20may\x20be\x20withdrawn\x20by\x20merchant\x20at\x20any\x20time.'},{'id':'need_compensation_full','tier':'personalized','description':'Compensation\x20fully\x20covers','satisfied':compensationCoversOrder,'advice':'Compensation\x20not\x20fully\x20covered:\x20insufficient\x20payout\x20for\x20rental\x20item\x20damage.'},{'id':'need_merchant_history','tier':'advanced','description':'Merchant\x20history\x20≥5\x20orders\x20(rental\x20experience)','satisfied':a=>merchantTotalOrders(a)>=0x5,'advice':'Merchant\x20history\x20orders\x20less\x20than\x205:\x20rental\x20service\x20experience\x20limited.'}],'education':[...commonNeeds(),{'id':'need_has_compensation','tier':'personalized','description':'Has\x20compensation\x20fund\x20(course\x20quality\x20guarantee)','satisfied':hasCompensationFund,'advice':'No\x20compensation\x20fund:\x20no\x20compensation\x20source\x20when\x20course\x20quality\x20is\x20not\x20up\x20to\x20standard.'},{'id':'need_long_cycle_ok','tier':'personalized','description':'Long\x20cycle\x20acceptable','satisfied':()=>!![],'advice':'Long\x20cycles\x20are\x20normal\x20in\x20education;\x20recommend\x20tracking\x20lesson\x20consumption\x20and\x20attendance.'},{'id':'need_high_reputation','tier':'advanced','description':'High\x20reputation\x20score\x20(trust_score\x20≥70)','satisfied':a=>trustScore(a)>=0x46,'advice':'Merchant\x20reputation\x20score\x20below\x2070:\x20course\x20reputation\x20may\x20be\x20poor.'}],'travel':[...commonNeeds(),{'id':'need_urgent_delivery','tier':'personalized','description':'Urgent\x20delivery\x20configuration\x20(milestone\x20phasing)','satisfied':hasMilestoneNodes,'advice':'No\x20milestone\x20nodes:\x20itinerary\x20has\x20no\x20phased\x20acceptance,\x20urgent\x20delivery\x20guarantee\x20insufficient.'},{'id':'need_compensation_full','tier':'personalized','description':'Compensation\x20fully\x20covers\x20(breach\x20compensation)','satisfied':compensationCoversOrder,'advice':'Compensation\x20not\x20fully\x20covered:\x20insufficient\x20payout\x20for\x20itinerary\x20breach.'},{'id':'need_high_reputation','tier':'advanced','description':'High\x20reputation\x20score\x20(trust_score\x20≥70)','satisfied':a=>trustScore(a)>=0x46,'advice':'Merchant\x20reputation\x20score\x20below\x2070:\x20travel\x20service\x20reputation\x20may\x20be\x20poor.'}],'subscription':[...commonNeeds(),{'id':'need_no_lockin','tier':'personalized','description':'No\x20long-term\x20lock-in\x20(no\x20dead-end\x20nodes)','satisfied':a=>deadEndCount(a)===0x0,'advice':'Dead-end\x20nodes\x20exist:\x20subscription\x20may\x20be\x20locked,\x20auto-renewal\x20trap\x20exists.'},{'id':'need_low_dispute','tier':'personalized','description':'Low\x20dispute\x20rate\x20(≤15%,\x20stable\x20content\x20quality)','satisfied':a=>disputeRate(a)<=0.15,'advice':'Dispute\x20rate\x20is\x20high:\x20subscription\x20content\x20quality\x20may\x20be\x20unstable.'},{'id':'need_repeat_rate','tier':'advanced','description':'Repeat\x20buyer\x20rate\x20≥20%\x20(strong\x20subscription\x20renewal\x20willingness)','satisfied':a=>repeatBuyerRate(a)>=0.2,'advice':'Repeat\x20buyer\x20rate\x20below\x2020%:\x20subscription\x20renewal\x20willingness\x20is\x20weak,\x20service\x20may\x20not\x20be\x20worth\x20long-term\x20subscription.'}],'retail':[...commonNeeds(),{'id':'need_wip_verified','tier':'personalized','description':'WIP\x20verified\x20(authenticity/logistics\x20traceability)','satisfied':wipVerified,'advice':'WIP\x20not\x20verified:\x20product\x20authenticity\x20and\x20logistics\x20traceability\x20info\x20missing.'},{'id':'need_compensation_full','tier':'personalized','description':'Compensation\x20fully\x20covers','satisfied':compensationCoversOrder,'advice':'Compensation\x20not\x20fully\x20covered:\x20insufficient\x20payout\x20for\x20return/exchange\x20disputes.'},{'id':'need_high_reputation','tier':'advanced','description':'High\x20reputation\x20score\x20(trust_score\x20≥70)','satisfied':a=>trustScore(a)>=0x46,'advice':'Merchant\x20reputation\x20score\x20below\x2070:\x20product\x20or\x20service\x20reputation\x20may\x20be\x20poor.'}]};let _registryLookup=null;export function _setRegistryLookup(a){_registryLookup=a;}export function getIndustryRiskChecks(a){if(_registryLookup){const b=_registryLookup(a);if(b?.['risk_checks'])return b['risk_checks'];}return INDUSTRY_RISK_CHECKS[a];}export function getIndustryNeeds(a){if(_registryLookup){const b=_registryLookup(a);if(b?.['needs'])return b['needs'];}return INDUSTRY_NEEDS[a];}export{CUSTOMER_INTELLIGENCE_VERSION};
|
package/dist/customer/types.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export type PuzzleDepth = "browse" | "evaluate" | "preorder" | "monitor";
|
|
2
1
|
export interface ServiceBasics {
|
|
3
2
|
service_id: string;
|
|
4
3
|
name: string;
|
|
@@ -82,131 +81,16 @@ export interface MerchantBehavior {
|
|
|
82
81
|
like_ratio: number;
|
|
83
82
|
};
|
|
84
83
|
}
|
|
85
|
-
export interface
|
|
86
|
-
similar_services_count: number;
|
|
87
|
-
avg_price: bigint;
|
|
88
|
-
min_price: bigint;
|
|
89
|
-
max_price: bigint;
|
|
90
|
-
price_percentile: number;
|
|
91
|
-
supply_demand_ratio: number;
|
|
92
|
-
}
|
|
93
|
-
export type UserMetricEvaluatorType = "threshold" | "ratio" | "boolean" | "presence" | "regex_match" | "custom_query";
|
|
94
|
-
export interface UserMetric {
|
|
95
|
-
name: string;
|
|
96
|
-
label: string;
|
|
97
|
-
evaluator: UserMetricEvaluatorType;
|
|
98
|
-
params: {
|
|
99
|
-
path?: string;
|
|
100
|
-
threshold?: number | string;
|
|
101
|
-
invert?: boolean;
|
|
102
|
-
min?: number;
|
|
103
|
-
max?: number;
|
|
104
|
-
pattern?: string;
|
|
105
|
-
query_key?: string;
|
|
106
|
-
};
|
|
107
|
-
weight: number;
|
|
108
|
-
advice_on_fail?: string;
|
|
109
|
-
advice_on_pass?: string;
|
|
110
|
-
}
|
|
111
|
-
export interface UserMetricsConfig {
|
|
112
|
-
version: number;
|
|
113
|
-
source_file?: string;
|
|
114
|
-
metrics: UserMetric[];
|
|
115
|
-
adjustment_cap?: number;
|
|
116
|
-
}
|
|
117
|
-
export interface UserMetricResult {
|
|
118
|
-
name: string;
|
|
119
|
-
label: string;
|
|
120
|
-
passed: boolean;
|
|
121
|
-
score: number;
|
|
122
|
-
observed_value?: string | number | boolean;
|
|
123
|
-
weight: number;
|
|
124
|
-
advice?: string;
|
|
125
|
-
}
|
|
126
|
-
export interface UserMetricsResult {
|
|
127
|
-
metrics: UserMetricResult[];
|
|
128
|
-
score: number;
|
|
129
|
-
adjustment: number;
|
|
130
|
-
source_file?: string;
|
|
131
|
-
evaluated_at: number;
|
|
132
|
-
}
|
|
133
|
-
export interface ServiceNestingEvaluation {
|
|
134
|
-
depth_reached: number;
|
|
135
|
-
truncated: boolean;
|
|
136
|
-
bindings: {
|
|
137
|
-
machine?: {
|
|
138
|
-
object_id: string;
|
|
139
|
-
published: boolean;
|
|
140
|
-
risk_level: "low" | "medium" | "high" | "critical";
|
|
141
|
-
issues: string[];
|
|
142
|
-
};
|
|
143
|
-
arbitrations: Array<{
|
|
144
|
-
object_id: string;
|
|
145
|
-
voting_guard_count: number;
|
|
146
|
-
fee_balance: string;
|
|
147
|
-
paused: boolean;
|
|
148
|
-
risk_level: "low" | "medium" | "high" | "critical";
|
|
149
|
-
issues: string[];
|
|
150
|
-
}>;
|
|
151
|
-
rewards: Array<{
|
|
152
|
-
object_id: string;
|
|
153
|
-
balance: string;
|
|
154
|
-
guard_count: number;
|
|
155
|
-
risk_level: "low" | "medium" | "high" | "critical";
|
|
156
|
-
issues: string[];
|
|
157
|
-
}>;
|
|
158
|
-
repositories: Array<{
|
|
159
|
-
object_id: string;
|
|
160
|
-
risk_level: "low" | "medium" | "high" | "critical";
|
|
161
|
-
issues: string[];
|
|
162
|
-
}>;
|
|
163
|
-
};
|
|
164
|
-
overall_risk_level: "low" | "medium" | "high" | "critical";
|
|
165
|
-
overall_risk_score: number;
|
|
166
|
-
total_bindings_evaluated: number;
|
|
167
|
-
evaluated_at: number;
|
|
168
|
-
}
|
|
169
|
-
export interface InfoPuzzle {
|
|
84
|
+
export interface IndustryServicePuzzle {
|
|
170
85
|
service_id: string;
|
|
171
86
|
service_basics: ServiceBasics;
|
|
172
87
|
workflow_analysis?: WorkflowAnalysis;
|
|
173
88
|
fund_safety?: FundSafety;
|
|
174
89
|
trust_signals?: TrustSignals;
|
|
175
90
|
merchant_behavior?: MerchantBehavior;
|
|
176
|
-
market_context?: MarketContext;
|
|
177
|
-
user_metrics?: UserMetricsResult;
|
|
178
|
-
service_nesting?: ServiceNestingEvaluation;
|
|
179
|
-
completeness: number;
|
|
180
|
-
gaps: string[];
|
|
181
|
-
assembled_at: number;
|
|
182
91
|
}
|
|
183
92
|
export type RiskDimensionName = "workflow" | "fund" | "trust" | "behavior";
|
|
184
|
-
export interface RiskCheck {
|
|
185
|
-
id: string;
|
|
186
|
-
dimension: RiskDimensionName;
|
|
187
|
-
description: string;
|
|
188
|
-
weight: number;
|
|
189
|
-
passed: boolean;
|
|
190
|
-
advice?: string;
|
|
191
|
-
}
|
|
192
|
-
export interface RiskDimensionScore {
|
|
193
|
-
name: RiskDimensionName;
|
|
194
|
-
score: number;
|
|
195
|
-
max_score: number;
|
|
196
|
-
checks: RiskCheck[];
|
|
197
|
-
}
|
|
198
93
|
export type RiskLevel = "low" | "medium_low" | "medium_high" | "high";
|
|
199
|
-
export interface RiskScore {
|
|
200
|
-
total: number;
|
|
201
|
-
base_total: number;
|
|
202
|
-
level: RiskLevel;
|
|
203
|
-
dimensions: RiskDimensionScore[];
|
|
204
|
-
user_metrics_adjustment?: number;
|
|
205
|
-
service_nesting_risk?: number;
|
|
206
|
-
service_nesting_level?: "low" | "medium" | "high" | "critical";
|
|
207
|
-
red_flags: string[];
|
|
208
|
-
advice: string[];
|
|
209
|
-
}
|
|
210
94
|
export interface UserPreferences {
|
|
211
95
|
price_sensitivity: "low" | "medium" | "high";
|
|
212
96
|
budget_range?: {
|
|
@@ -237,52 +121,4 @@ export interface UserPreferences {
|
|
|
237
121
|
preferred_tokens: string[];
|
|
238
122
|
preferred_merchants: string[];
|
|
239
123
|
}
|
|
240
|
-
export type ReminderPriority = "required" | "recommended" | "info" | "reminder";
|
|
241
|
-
export interface Reminder {
|
|
242
|
-
id: string;
|
|
243
|
-
stage: "browse" | "evaluate" | "preorder" | "in_progress" | "complete" | "after_sale";
|
|
244
|
-
priority: ReminderPriority;
|
|
245
|
-
message: string;
|
|
246
|
-
action?: string;
|
|
247
|
-
}
|
|
248
|
-
export type GameScenario = "info_asymmetry" | "fund_safety" | "refund_dispute" | "arbitration_fairness" | "pricing" | "delivery_sla" | "quality_verification" | "after_sales";
|
|
249
|
-
export interface GameStrategy {
|
|
250
|
-
scenario: GameScenario;
|
|
251
|
-
merchant_tactic: string;
|
|
252
|
-
user_strategy: string;
|
|
253
|
-
nash_equilibrium: string;
|
|
254
|
-
}
|
|
255
|
-
export interface CustomerAdvice {
|
|
256
|
-
risk_score?: number;
|
|
257
|
-
risk_level?: RiskLevel;
|
|
258
|
-
recommendations: string[];
|
|
259
|
-
reminders: Reminder[];
|
|
260
|
-
preference_match?: {
|
|
261
|
-
score: number;
|
|
262
|
-
matches: string[];
|
|
263
|
-
mismatches: string[];
|
|
264
|
-
};
|
|
265
|
-
}
|
|
266
124
|
export declare const CUSTOMER_INTELLIGENCE_VERSION = 1;
|
|
267
|
-
export declare const RISK_LEVELS: readonly [{
|
|
268
|
-
readonly min: 85;
|
|
269
|
-
readonly level: "low";
|
|
270
|
-
readonly label: "Low risk";
|
|
271
|
-
readonly color: "🟢";
|
|
272
|
-
}, {
|
|
273
|
-
readonly min: 70;
|
|
274
|
-
readonly level: "medium_low";
|
|
275
|
-
readonly label: "Medium-low risk";
|
|
276
|
-
readonly color: "🟡";
|
|
277
|
-
}, {
|
|
278
|
-
readonly min: 50;
|
|
279
|
-
readonly level: "medium_high";
|
|
280
|
-
readonly label: "Medium-high risk";
|
|
281
|
-
readonly color: "🟠";
|
|
282
|
-
}, {
|
|
283
|
-
readonly min: 0;
|
|
284
|
-
readonly level: "high";
|
|
285
|
-
readonly label: "High risk";
|
|
286
|
-
readonly color: "🔴";
|
|
287
|
-
}];
|
|
288
|
-
export declare const RISK_DIMENSION_MAX: Record<RiskDimensionName, number>;
|
package/dist/customer/types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const CUSTOMER_INTELLIGENCE_VERSION=0x1;
|
|
1
|
+
export const CUSTOMER_INTELLIGENCE_VERSION=0x1;
|
|
@@ -16,55 +16,6 @@ export declare function _setRegistryLookup(fn: ((industry: string) => {
|
|
|
16
16
|
preference_template?: IndustryTemplate;
|
|
17
17
|
} | undefined) | null): void;
|
|
18
18
|
export declare function getIndustryTemplate(industry: Industry): IndustryTemplate;
|
|
19
|
-
export interface OrderHistoryEntry {
|
|
20
|
-
service_id: string;
|
|
21
|
-
service_owner?: string;
|
|
22
|
-
industry?: string;
|
|
23
|
-
price: bigint;
|
|
24
|
-
avg_market_price: bigint;
|
|
25
|
-
used_discount: boolean;
|
|
26
|
-
used_referral: boolean;
|
|
27
|
-
has_arbitration: boolean;
|
|
28
|
-
has_compensation: boolean;
|
|
29
|
-
risk_score_at_purchase?: number;
|
|
30
|
-
used_messenger: boolean;
|
|
31
|
-
messenger_messages?: number;
|
|
32
|
-
completed: boolean;
|
|
33
|
-
has_dispute: boolean;
|
|
34
|
-
timestamp: number;
|
|
35
|
-
}
|
|
36
|
-
export interface PreferenceInference {
|
|
37
|
-
preferences: UserPreferences;
|
|
38
|
-
confidence: Record<keyof UserPreferences, number>;
|
|
39
|
-
signals: string[];
|
|
40
|
-
}
|
|
41
|
-
export declare function inferPreferences(history: OrderHistoryEntry[], basePrefs?: UserPreferences): PreferenceInference;
|
|
42
|
-
export interface ServiceForMatching {
|
|
43
|
-
service_id: string;
|
|
44
|
-
price: bigint;
|
|
45
|
-
token_type: string;
|
|
46
|
-
avg_market_price?: bigint;
|
|
47
|
-
estimated_cycle_days?: number;
|
|
48
|
-
estimated_response_hours?: number;
|
|
49
|
-
merchant_region?: string;
|
|
50
|
-
merchant_order_history_count: number;
|
|
51
|
-
merchant_age: "established" | "emerging" | "unknown";
|
|
52
|
-
has_arbitration: boolean;
|
|
53
|
-
has_compensation_fund: boolean;
|
|
54
|
-
has_reward_activity: boolean;
|
|
55
|
-
has_discount: boolean;
|
|
56
|
-
risk_score: number;
|
|
57
|
-
trust_score: number;
|
|
58
|
-
requires_messenger: boolean;
|
|
59
|
-
after_sales_support_level: "full" | "basic" | "minimal";
|
|
60
|
-
}
|
|
61
|
-
export interface PreferenceMatchResult {
|
|
62
|
-
score: number;
|
|
63
|
-
matches: string[];
|
|
64
|
-
mismatches: string[];
|
|
65
|
-
warnings: string[];
|
|
66
|
-
}
|
|
67
|
-
export declare function matchServiceToPreferences(service: ServiceForMatching, prefs: UserPreferences): PreferenceMatchResult;
|
|
68
19
|
export declare function mergePreferences(inferred: UserPreferences, manual: Partial<UserPreferences>): UserPreferences;
|
|
69
20
|
export declare function validatePreferences(prefs: UserPreferences): string[];
|
|
70
21
|
export { CUSTOMER_INTELLIGENCE_VERSION };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{CUSTOMER_INTELLIGENCE_VERSION}from'./types.js';export const SUPPORTED_INDUSTRIES=['freelance','rental','education','travel','subscription','retail'];const INDUSTRY_TEMPLATES={'freelance':{'max_acceptable_cycle':0x1e,'response_time_expectation':0x4,'require_arbitration':!![],'require_compensation_fund':!![],'risk_appetite':'balanced','delivery_speed_priority':'normal','after_sales_expectation':'full'},'rental':{'max_acceptable_cycle':0x7,'response_time_expectation':0x8,'require_arbitration':!![],'require_compensation_fund':!![],'risk_appetite':'conservative','delivery_speed_priority':'normal','after_sales_expectation':'full'},'education':{'max_acceptable_cycle':0x5a,'response_time_expectation':0x18,'require_arbitration':!![],'require_compensation_fund':!![],'risk_appetite':'conservative','delivery_speed_priority':'flexible','after_sales_expectation':'full'},'travel':{'max_acceptable_cycle':0xe,'response_time_expectation':0x2,'require_arbitration':!![],'require_compensation_fund':!![],'risk_appetite':'conservative','delivery_speed_priority':'urgent','after_sales_expectation':'full'},'subscription':{'max_acceptable_cycle':0x1e,'response_time_expectation':0x18,'require_arbitration':![],'require_compensation_fund':![],'risk_appetite':'aggressive','delivery_speed_priority':'normal','after_sales_expectation':'basic'},'retail':{'max_acceptable_cycle':0x7,'response_time_expectation':0x8,'require_arbitration':!![],'require_compensation_fund':!![],'risk_appetite':'balanced','delivery_speed_priority':'normal','after_sales_expectation':'full'}},BASE_DEFAULTS={'price_sensitivity':'medium','value_orientation':'balanced','discount_sensitivity':0.3,'delivery_speed_priority':'normal','max_acceptable_cycle':0xe,'response_time_expectation':0x8,'merchant_preference':'neutral','min_order_history':0x3,'bargain_hunting':0.3,'reward_seeking':![],'referral_participation':![],'communication_style':'friendly','transparency_demand':0.5,'after_sales_expectation':'basic','risk_appetite':'balanced','min_trust_score':0x32,'require_arbitration':!![],'require_compensation_fund':!![],'preferred_industries':[],'preferred_tokens':['0x2::wow::WOW'],'preferred_merchants':[]};export function getDefaultPreferences(a){if(!a||!INDUSTRY_TEMPLATES[a])return{...BASE_DEFAULTS};const b=INDUSTRY_TEMPLATES[a];return{...BASE_DEFAULTS,'max_acceptable_cycle':b['max_acceptable_cycle'],'response_time_expectation':b['response_time_expectation'],'require_arbitration':b['require_arbitration'],'require_compensation_fund':b['require_compensation_fund'],'risk_appetite':b['risk_appetite'],'delivery_speed_priority':b['delivery_speed_priority'],'after_sales_expectation':b['after_sales_expectation']};}let _registryLookup=null;export function _setRegistryLookup(a){_registryLookup=a;}export function getIndustryTemplate(a){if(_registryLookup){const b=_registryLookup(a);if(b?.['preference_template'])return{...b['preference_template']};}return{...INDUSTRY_TEMPLATES[a]};}export function inferPreferences(a,b){const c={...b??getDefaultPreferences()},d={},e=[];if(a['length']<0x3)return e['push']('history='+a['length']+'\x20<\x203,\x20keeping\x20default\x20preferences'),{'preferences':c,'confidence':d,'signals':e};const f=a['filter'](r=>r['avg_market_price']>0x0n&&r['price']<r['avg_market_price']*0x5an/0x64n);if(f['length']>=0x3)c['price_sensitivity']='high',c['value_orientation']='budget',d['price_sensitivity']=0.8,d['value_orientation']=0.7,e['push']('Consecutive\x20'+f['length']+'\x20picks\x20of\x20Service\x20priced\x2010%+\x20below\x20average\x20→\x20price_sensitivity=high');else f['length']>=0x1&&(c['price_sensitivity']='medium',d['price_sensitivity']=0.5,e['push'](f['length']+'\x20low-price\x20picks\x20→\x20price_sensitivity=medium'));const g=a['filter'](r=>r['used_discount']);g['length']>=0x2&&(c['discount_sensitivity']=0.8,d['discount_sensitivity']=0.85,e['push']('Used\x20discount\x20'+g['length']+'\x20times\x20→\x20discount_sensitivity=0.8'));a['some'](r=>r['used_referral'])&&(c['referral_participation']=!![],d['referral_participation']=0x1,e['push']('Has\x20used\x20a\x20referral\x20code\x20→\x20referral_participation=true'));(g['length']>=0x2||a['some'](r=>r['used_referral']))&&(c['reward_seeking']=!![],d['reward_seeking']=0.75,e['push']('Reward\x20behavior\x20detected\x20→\x20reward_seeking=true'));const i=g['length']+(a['some'](r=>r['used_referral'])?0x1:0x0);if(i>=0x3)c['bargain_hunting']=0.8,d['bargain_hunting']=0.8;else i>=0x1&&(c['bargain_hunting']=0.5,d['bargain_hunting']=0.6);const j=new Map();for(const r of a){r['industry']&&j['set'](r['industry'],(j['get'](r['industry'])??0x0)+0x1);}const k=Array['from'](j['entries']())['filter'](([,s])=>s>=0x1)['sort']((s,t)=>t[0x1]-s[0x1])['slice'](0x0,0x3)['map'](([s])=>s);k['length']>0x0&&(c['preferred_industries']=k,d['preferred_industries']=Math['min'](0x1,(j['get'](k[0x0])??0x0)/0x5),e['push']('Preferred\x20industries:\x20'+k['join'](',\x20')));const l=a['filter'](s=>s['has_arbitration']);if(l['length']>=0x3&&l['length']===a['length'])c['require_arbitration']=!![],d['require_arbitration']=0.85,e['push']('100%\x20of\x20historical\x20orders\x20picked\x20Services\x20with\x20arbitration\x20→\x20require_arbitration=true\x20(confirmed)');else l['length']<a['length']/0x2&&(c['require_arbitration']=![],d['require_arbitration']=0.5,e['push'](l['length']+'/'+a['length']+'\x20orders\x20had\x20arbitration\x20→\x20require_arbitration=false'));const m=a['filter'](s=>s['has_compensation']);if(m['length']>=0x3&&m['length']===a['length'])c['require_compensation_fund']=!![],d['require_compensation_fund']=0.85,e['push']('100%\x20of\x20historical\x20orders\x20had\x20compensation\x20fund\x20→\x20require_compensation_fund=true\x20(confirmed)');else m['length']<a['length']/0x2&&(c['require_compensation_fund']=![],d['require_compensation_fund']=0.5);const n=a['map'](s=>s['risk_score_at_purchase'])['filter'](t=>typeof t==='number');if(n['length']>=0x5){const s=Math['min'](...n);if(s>=0x46)c['risk_appetite']='conservative',c['min_trust_score']=0x46,d['risk_appetite']=0.8,d['min_trust_score']=0.7,e['push']('Lowest\x20risk\x20score\x20in\x20history\x20'+s+'\x20≥\x2070\x20→\x20risk_appetite=conservative');else s<0x32&&(c['risk_appetite']='aggressive',c['min_trust_score']=Math['max'](0x0,s-0xa),d['risk_appetite']=0.7,e['push']('Lowest\x20risk\x20score\x20in\x20history\x20'+s+'\x20<\x2050\x20→\x20risk_appetite=aggressive'));}const o=a['filter'](t=>t['used_messenger']);if(o['length']>=0x2){const t=o['reduce']((u,v)=>u+(v['messenger_messages']??0x0),0x0)/o['length'];if(t>=0xa)c['communication_style']='formal',d['communication_style']=0.6,e['push']('Average\x20'+t['toFixed'](0x1)+'\x20Messenger\x20messages\x20→\x20communication_style=formal');else t<=0x3&&(c['communication_style']='casual',d['communication_style']=0.5,e['push']('Average\x20'+t['toFixed'](0x1)+'\x20Messenger\x20messages\x20→\x20communication_style=casual'));c['transparency_demand']=Math['min'](0x1,t/0x14),d['transparency_demand']=0.6;}const p=a['filter'](u=>u['has_dispute'])['length'];p>0x0&&(c['transparency_demand']=Math['max'](c['transparency_demand'],0.7),c['after_sales_expectation']='full',d['transparency_demand']=Math['max'](d['transparency_demand']??0x0,0.7),d['after_sales_expectation']=0.7,e['push'](p+'\x20disputes\x20→\x20transparency_demand\x20increased,\x20after_sales=full'));const q=new Map();for(const u of a){u['service_owner']&&q['set'](u['service_owner'],(q['get'](u['service_owner'])??0x0)+0x1);}return c['preferred_merchants']=Array['from'](q['entries']())['filter'](([,v])=>v>=0x2)['sort']((v,w)=>w[0x1]-v[0x1])['slice'](0x0,0x5)['map'](([v])=>v),c['preferred_merchants']['length']>0x0&&(d['preferred_merchants']=0.8,e['push']('Patronized\x20'+c['preferred_merchants']['length']+'\x20merchants\x20≥2\x20times')),{'preferences':c,'confidence':d,'signals':e};}export function matchServiceToPreferences(a,b){const c=[],d=[],e=[];let f=0x0,g=0x0;g+=0x19;if(b['budget_range']){if(a['price']>=b['budget_range']['min']&&a['price']<=b['budget_range']['max'])f+=0x14,c['push']('Price\x20within\x20budget\x20range');else a['price']<b['budget_range']['min']?(f+=0xf,c['push']('Price\x20below\x20budget\x20minimum')):d['push']('Price\x20exceeds\x20budget\x20maximum');}else{if(a['avg_market_price']&&a['avg_market_price']>0x0n){const k=Number(a['price']*0x64n/a['avg_market_price'])/0x64;if(b['price_sensitivity']==='high'){if(k<=0.9)f+=0x19,c['push']('Price\x20is\x20'+((0x1-k)*0x64|0x0)+'%\x20below\x20average\x20(bonus\x20for\x20high-sensitivity\x20user)');else k<=1.1?(f+=0xf,c['push']('Price\x20on\x20par\x20with\x20average')):d['push']('Price\x20is\x20'+((k-0x1)*0x64|0x0)+'%\x20above\x20average\x20(high-sensitivity\x20user)');}else{if(b['price_sensitivity']==='low')f+=0x14,c['push']('Low\x20price\x20sensitivity');else{if(k<=0x1)f+=0x14,c['push']('Price\x20not\x20above\x20average');else k<=1.2?f+=0xc:d['push']('Price\x20significantly\x20above\x20average');}}}else f+=0xc;}g+=0xf;const h=a['estimated_cycle_days']??0x0;if(h>0x0){if(h<=b['max_acceptable_cycle']){f+=0xa,c['push']('Delivery\x20cycle\x20'+h+'\x20days\x20≤\x20expected\x20'+b['max_acceptable_cycle']+'\x20days');if(b['delivery_speed_priority']==='urgent'&&h<=Math['max'](0x1,b['max_acceptable_cycle']/0x3))f+=0x5,c['push']('Urgent\x20delivery\x20need\x20satisfied');else b['delivery_speed_priority']==='urgent'&&e['push']('Urgent\x20delivery\x20need\x20but\x20cycle\x20is\x20long');}else d['push']('Delivery\x20cycle\x20'+h+'\x20days\x20>\x20expected\x20'+b['max_acceptable_cycle']+'\x20days');}else f+=0x7;g+=0xa;if(b['preferred_region']){if(a['merchant_region']&&a['merchant_region']===b['preferred_region'])f+=0xa,c['push']('Merchant\x20region\x20'+a['merchant_region']+'\x20matches\x20preference');else a['merchant_region']?d['push']('Merchant\x20region\x20'+a['merchant_region']+'\x20does\x20not\x20match\x20preference\x20'+b['preferred_region']):f+=0x5;}else f+=0x7;g+=0xa;a['merchant_order_history_count']>=b['min_order_history']?(f+=0x7,c['push']('Merchant\x20history\x20'+a['merchant_order_history_count']+'\x20orders\x20≥\x20required\x20'+b['min_order_history']+'\x20orders')):d['push']('Merchant\x20history\x20'+a['merchant_order_history_count']+'\x20orders\x20<\x20required\x20'+b['min_order_history']+'\x20orders');if(b['merchant_preference']!=='neutral'){if(a['merchant_age']===b['merchant_preference'])f+=0x3,c['push']('Merchant\x20type\x20'+a['merchant_age']+'\x20matches\x20preference');else a['merchant_age']!=='unknown'&&d['push']('Merchant\x20type\x20'+a['merchant_age']+'\x20≠\x20preference\x20'+b['merchant_preference']);}else f+=0x3;g+=0xf;let i=0x0;a['has_reward_activity']&&(i+=0x8,c['push']('Has\x20Reward\x20activity'));a['has_discount']&&(i+=0x7,c['push']('Has\x20discount'));if(b['bargain_hunting']>=0.7&&i===0x0)d['push']('User\x20has\x20high\x20bargain_hunting\x20but\x20no\x20Reward/discount');else{if(b['bargain_hunting']<0.3){if(i===0x0)i=0xa;else i=Math['min'](i,0x5);}else b['bargain_hunting']<0.7&&i===0x0&&(i=0x5);}f+=i,g+=0xa;if(a['after_sales_support_level']===b['after_sales_expectation'])f+=0x5,c['push']('After-sales\x20support\x20'+a['after_sales_support_level']+'\x20matches\x20expectation');else b['after_sales_expectation']==='full'&&a['after_sales_support_level']==='basic'||b['after_sales_expectation']==='full'&&a['after_sales_support_level']==='minimal'||b['after_sales_expectation']==='basic'&&a['after_sales_support_level']==='minimal'?d['push']('After-sales\x20support\x20'+a['after_sales_support_level']+'\x20<\x20expectation\x20'+b['after_sales_expectation']):f+=0x3;if(b['transparency_demand']>=0.7&&a['requires_messenger'])f+=0x5,c['push']('Merchant\x20supports\x20Messenger\x20communication\x20(high\x20transparency\x20demand)');else b['transparency_demand']>=0.7&&!a['requires_messenger']?d['push']('High\x20transparency\x20demand\x20but\x20merchant\x20has\x20no\x20Messenger'):f+=0x3;g+=0xf;a['risk_score']>=b['min_trust_score']?(f+=0x8,c['push']('Risk\x20score\x20'+a['risk_score']+'\x20≥\x20required\x20'+b['min_trust_score'])):d['push']('Risk\x20score\x20'+a['risk_score']+'\x20<\x20required\x20'+b['min_trust_score']);b['require_arbitration']?a['has_arbitration']?(f+=0x4,c['push']('Arbitration\x20configured')):(d['push']('User\x20requires\x20arbitration\x20but\x20Service\x20is\x20not\x20configured'),e['push']('⚠️\x20No\x20arbitration:\x20user\x20preference\x20requires\x20arbitration\x20as\x20mandatory')):f+=0x4;b['require_compensation_fund']?a['has_compensation_fund']?(f+=0x3,c['push']('Has\x20compensation\x20fund')):(d['push']('User\x20requires\x20compensation\x20fund\x20but\x20Service\x20has\x20none'),e['push']('⚠️\x20No\x20compensation\x20fund:\x20user\x20preference\x20requires\x20it\x20as\x20mandatory')):f+=0x3;const j=g>0x0?Math['round'](f/g*0x64):0x0;return{'score':j,'matches':c,'mismatches':d,'warnings':e};}export function mergePreferences(a,b){return{...a,...b};}export function validatePreferences(a){const b=[];return a['budget_range']&&a['budget_range']['min']>a['budget_range']['max']&&b['push']('budget_range.min\x20>\x20budget_range.max'),(a['discount_sensitivity']<0x0||a['discount_sensitivity']>0x1)&&b['push']('discount_sensitivity\x20must\x20be\x20in\x20[0,1]'),(a['bargain_hunting']<0x0||a['bargain_hunting']>0x1)&&b['push']('bargain_hunting\x20must\x20be\x20in\x20[0,1]'),(a['transparency_demand']<0x0||a['transparency_demand']>0x1)&&b['push']('transparency_demand\x20must\x20be\x20in\x20[0,1]'),(a['min_trust_score']<0x0||a['min_trust_score']>0x64)&&b['push']('min_trust_score\x20must\x20be\x20in\x20[0,100]'),a['max_acceptable_cycle']<0x0&&b['push']('max_acceptable_cycle\x20must\x20be\x20≥\x200'),a['response_time_expectation']<0x0&&b['push']('response_time_expectation\x20must\x20be\x20≥\x200'),b;}export{CUSTOMER_INTELLIGENCE_VERSION};
|
|
1
|
+
import{CUSTOMER_INTELLIGENCE_VERSION}from'./types.js';export const SUPPORTED_INDUSTRIES=['freelance','rental','education','travel','subscription','retail'];const INDUSTRY_TEMPLATES={'freelance':{'max_acceptable_cycle':0x1e,'response_time_expectation':0x4,'require_arbitration':!![],'require_compensation_fund':!![],'risk_appetite':'balanced','delivery_speed_priority':'normal','after_sales_expectation':'full'},'rental':{'max_acceptable_cycle':0x7,'response_time_expectation':0x8,'require_arbitration':!![],'require_compensation_fund':!![],'risk_appetite':'conservative','delivery_speed_priority':'normal','after_sales_expectation':'full'},'education':{'max_acceptable_cycle':0x5a,'response_time_expectation':0x18,'require_arbitration':!![],'require_compensation_fund':!![],'risk_appetite':'conservative','delivery_speed_priority':'flexible','after_sales_expectation':'full'},'travel':{'max_acceptable_cycle':0xe,'response_time_expectation':0x2,'require_arbitration':!![],'require_compensation_fund':!![],'risk_appetite':'conservative','delivery_speed_priority':'urgent','after_sales_expectation':'full'},'subscription':{'max_acceptable_cycle':0x1e,'response_time_expectation':0x18,'require_arbitration':![],'require_compensation_fund':![],'risk_appetite':'aggressive','delivery_speed_priority':'normal','after_sales_expectation':'basic'},'retail':{'max_acceptable_cycle':0x7,'response_time_expectation':0x8,'require_arbitration':!![],'require_compensation_fund':!![],'risk_appetite':'balanced','delivery_speed_priority':'normal','after_sales_expectation':'full'}},BASE_DEFAULTS={'price_sensitivity':'medium','value_orientation':'balanced','discount_sensitivity':0.3,'delivery_speed_priority':'normal','max_acceptable_cycle':0xe,'response_time_expectation':0x8,'merchant_preference':'neutral','min_order_history':0x3,'bargain_hunting':0.3,'reward_seeking':![],'referral_participation':![],'communication_style':'friendly','transparency_demand':0.5,'after_sales_expectation':'basic','risk_appetite':'balanced','min_trust_score':0x32,'require_arbitration':!![],'require_compensation_fund':!![],'preferred_industries':[],'preferred_tokens':['0x2::wow::WOW'],'preferred_merchants':[]};export function getDefaultPreferences(a){if(!a||!INDUSTRY_TEMPLATES[a])return{...BASE_DEFAULTS};const b=INDUSTRY_TEMPLATES[a];return{...BASE_DEFAULTS,'max_acceptable_cycle':b['max_acceptable_cycle'],'response_time_expectation':b['response_time_expectation'],'require_arbitration':b['require_arbitration'],'require_compensation_fund':b['require_compensation_fund'],'risk_appetite':b['risk_appetite'],'delivery_speed_priority':b['delivery_speed_priority'],'after_sales_expectation':b['after_sales_expectation']};}let _registryLookup=null;export function _setRegistryLookup(a){_registryLookup=a;}export function getIndustryTemplate(a){if(_registryLookup){const b=_registryLookup(a);if(b?.['preference_template'])return{...b['preference_template']};}return{...INDUSTRY_TEMPLATES[a]};}export function mergePreferences(a,b){return{...a,...b};}export function validatePreferences(a){const b=[];return a['budget_range']&&a['budget_range']['min']>a['budget_range']['max']&&b['push']('budget_range.min\x20>\x20budget_range.max'),(a['discount_sensitivity']<0x0||a['discount_sensitivity']>0x1)&&b['push']('discount_sensitivity\x20must\x20be\x20in\x20[0,1]'),(a['bargain_hunting']<0x0||a['bargain_hunting']>0x1)&&b['push']('bargain_hunting\x20must\x20be\x20in\x20[0,1]'),(a['transparency_demand']<0x0||a['transparency_demand']>0x1)&&b['push']('transparency_demand\x20must\x20be\x20in\x20[0,1]'),(a['min_trust_score']<0x0||a['min_trust_score']>0x64)&&b['push']('min_trust_score\x20must\x20be\x20in\x20[0,100]'),a['max_acceptable_cycle']<0x0&&b['push']('max_acceptable_cycle\x20must\x20be\x20≥\x200'),a['response_time_expectation']<0x0&&b['push']('response_time_expectation\x20must\x20be\x20≥\x200'),b;}export{CUSTOMER_INTELLIGENCE_VERSION};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{describe,expect,it}from'vitest';import{dirname,join}from'node:path';import{fileURLToPath}from'node:url';import{ENTRYPOINT}from'@wowok/wowok';import{FakeDataPlane}from'../graph/onchain/dataplane.js';import{expandTopology}from'../graph/onchain/expand.js';import{FULL,fullServiceState}from'../graph/onchain/fixtures.js';import{buildViewport}from'../graph/onchain/viewport.js';import{runAnalyzers}from'../graph/onchain/analyze.js';import{RETENTION_RANK}from'../graph/onchain/analyze.js';import{EVALUATION_SERVICE_INTENTS,resolveExpansionStrategy,withEvaluationBundle}from'../graph/onchain/strategy.js';import{projectEvaluationFacts}from'../graph/onchain/facts.js';import{registerGraphServiceEvaluations}from'./builtins/graph-service.js';import{importSourcesOf,listRuntimeSources,namedSdkImportsOf,onchainIoCalls,SDK_CONSTANT_ALLOWLIST}from'./guard-scan.js';const EVAL_DIR=dirname(fileURLToPath(import.meta.url)),GRAPH_ONCHAIN_DIR=join(EVAL_DIR,'..','graph','onchain'),DATA_PLANE_IMPLS=new Set(['sdk-dataplane.ts','sdk-batch.ts']),CONFIDENCES=new Set(['exact','bounded','windowed','derived']);describe('Task\x2017\x20engine\x20purity\x20architecture\x20guard\x20(TR-17.1)',()=>{it('(a)\x20evaluation/\x20runtime\x20files:\x20relative\x20imports\x20only,\x20no\x20chain-IO\x20entry',async()=>{const a=await import('../playbooks/service-build/topology-query.js');expect(typeof a['evaluateServiceFromGraph'])['toBe']('function');const b=listRuntimeSources(EVAL_DIR);expect(b['length'])['toBeGreaterThan'](0x0);for(const {file:c,text:d}of b){for(const e of importSourcesOf(d)){if(e['startsWith']('.'))continue;if(e['startsWith']('node:'))continue;if(e==='@wowok/wowok'){const f=namedSdkImportsOf(d)['filter'](g=>!SDK_CONSTANT_ALLOWLIST['has'](g));expect(f,c+'\x20imports\x20non-constant\x20SDK\x20symbols:\x20'+f['join'](',\x20'))['toEqual']([]);continue;}throw new Error(c+'\x20imports\x20non-relative\x20module\x20\x22'+e+'\x22\x20—\x20evaluation\x20must\x20stay\x20pure');}expect(onchainIoCalls(d),c+'\x20performs\x20chain\x20IO')['toEqual']([]);}}),it('(b)\x20every\x20projected\x20Fact\x20carries\x20provenance\x20(path/retention/confidence)',async()=>{registerGraphServiceEvaluations();const a=withEvaluationBundle(resolveExpansionStrategy({'intents':[...EVALUATION_SERVICE_INTENTS]})),b=await expandTopology(new FakeDataPlane(fullServiceState()),{'network':ENTRYPOINT['Mainnet'],'seed':FULL['svc'],'budget':a['budget'],'edges':a['edges']}),c=buildViewport(b,FULL['svc'],'neutral'),d=projectEvaluationFacts(c,FULL['svc'],runAnalyzers(c));expect(d['facts']['length'])['toBeGreaterThan'](0x0);for(const e of d['facts']){const f=e['provenance'];expect(f,e['dimension']+'/'+e['key']+'\x20has\x20no\x20provenance')['toBeDefined'](),expect(Array['isArray'](f['path'])&&f['path']['length']>0x0,e['dimension']+'/'+e['key']+'\x20provenance.path\x20empty')['toBe'](!![]),expect(f['path']['every'](g=>typeof g==='string'&&g!==''),e['dimension']+'/'+e['key']+'\x20provenance.path\x20has\x20non-string\x20segments')['toBe'](!![]),expect(RETENTION_RANK[f['retention']],e['dimension']+'/'+e['key']+'\x20unknown\x20retention\x20'+f['retention'])['toBeDefined'](),expect(CONFIDENCES['has'](f['confidence']),e['dimension']+'/'+e['key']+'\x20unknown\x20confidence\x20'+f['confidence'])['toBe'](!![]);}for(const g of d['slots']){expect(typeof g['slot'])['toBe']('string'),expect(['present','empty','gap'])['toContain'](g['state']);}}),it('(c)\x20graph/onchain\x20chain\x20IO\x20lives\x20only\x20in\x20the\x20DataPlane\x20implementations',()=>{const a=listRuntimeSources(GRAPH_ONCHAIN_DIR);expect(a['length'])['toBeGreaterThan'](0x0);const b=a['filter'](({file:c,text:d})=>!DATA_PLANE_IMPLS['has'](c)&&onchainIoCalls(d)['length']>0x0)['map'](({file:c})=>c);expect(b,'evaluation\x20fetch\x20path\x20leaked\x20outside\x20the\x20DataPlane\x20implementations:\x20'+b['join'](',\x20'))['toEqual']([]);}),it('red-light:\x20the\x20scanners\x20flag\x20violation\x20samples',()=>{expect(onchainIoCalls('const\x20p\x20=\x20new\x20SdkDataPlane(net);\x20await\x20query_table({...});'))['toEqual'](expect['arrayContaining'](['SdkDataPlane\x20construction','SDK\x20query\x20call'])),expect(onchainIoCalls('const\x20names\x20=\x20await\x20LocalMark.Instance().get_many_address(x);'))['toEqual'](expect['arrayContaining'](['LocalMark\x20store\x20access'])),expect(namedSdkImportsOf('import\x20{\x20LocalMark\x20}\x20from\x20\x22@wowok/wowok\x22;'))['toEqual'](['LocalMark']),expect(onchainIoCalls('//\x20pulled\x20by\x20the\x20handler\x20via\x20query_arbs\x0aexport\x20const\x20K\x20=\x201;'))['toEqual']([]);});});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type CoverageSlot, type CoverageVocabulary, type GraphEvaluationFacts } from "../../graph/onchain/facts.js";
|
|
2
|
+
import type { EvaluationResult, UserInjection } from "../types.js";
|
|
3
|
+
export declare const GRAPH_TRUST_EVALUATION = "graph_service_trust";
|
|
4
|
+
export declare const GRAPH_RISK_EVALUATION = "graph_service_risk";
|
|
5
|
+
export declare const GRAPH_RULE_INPUT_FACTS: Readonly<Record<string, readonly string[]>>;
|
|
6
|
+
export declare function registerGraphServiceEvaluations(engine?: import("../engine.js").EvaluationEngine): void;
|
|
7
|
+
export interface GraphServiceEvaluation {
|
|
8
|
+
target: string;
|
|
9
|
+
trust: EvaluationResult;
|
|
10
|
+
risk: EvaluationResult;
|
|
11
|
+
completeness: number;
|
|
12
|
+
coverage: CoverageSlot[];
|
|
13
|
+
unverified: string[];
|
|
14
|
+
vocabulary: CoverageVocabulary;
|
|
15
|
+
}
|
|
16
|
+
export declare function evaluateGraphServiceFacts(projected: GraphEvaluationFacts, injection?: UserInjection): Promise<GraphServiceEvaluation>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{COVERAGE_VOCABULARY}from'../../graph/onchain/facts.js';import{getEvaluationEngine}from'../engine.js';import{defaultWeights,dimensionLabel,gradeWord,severityDeduction}from'../standards.js';export const GRAPH_TRUST_EVALUATION='graph_service_trust';export const GRAPH_RISK_EVALUATION='graph_service_risk';export const GRAPH_RULE_INPUT_FACTS={'trust_arbitration':['arbitration.binding'],'trust_reviews':['reviews.votes'],'trust_fulfillment':['fulfillment.orders'],'trust_fund_safety':['fund.compensation','fund.exposure'],'trust_transparency':['transparency.profile'],'risk_workflow':['risk_workflow.findings'],'risk_fund':['risk_fund.findings'],'risk_trust':['risk_trust.findings'],'risk_behavior':['risk_behavior.findings']};const WEIGHTS=defaultWeights(),dsGraphFacts={'id':'ds_graph_facts','description':'Unpack\x20the\x20graph-projected\x20evaluation\x20facts\x20(Task\x2013\x20projection)\x20into\x20the\x20rule\x20context','evaluation_ids':[GRAPH_TRUST_EVALUATION,GRAPH_RISK_EVALUATION],'extract':a=>{const b=a['entities']['graph_facts'],c={'target':b['target'],'completeness':b['completeness']};for(const d of b['facts'])c[d['key']]=d;return c;}};function inputFact(a,b){const c=GRAPH_RULE_INPUT_FACTS[b];return c?a['facts'][c[0x0]]:undefined;}function factOf(a,b){return a['facts']['find'](c=>c['key']===b);}function trustArbitrationRule(){const a='trust_arbitration';return{'id':a,'description':'Arbitration\x20trust\x20dimension\x20(binding\x20material\x20from\x20the\x20graph\x20facts)','dimension':dimensionLabel(a),'weight':WEIGHTS['trust_arbitration'],'evaluation_ids':[GRAPH_TRUST_EVALUATION],'evaluate':b=>{const c=inputFact(b,a);if(!c||c['state']==='gap')return null;const d=c['value']??[];if(d['length']===0x0)return{'score':0x0,'weight':WEIGHTS['trust_arbitration'],'reason':'No\x20arbitration\x20binding\x20configured\x20(verified\x20absence)\x20—\x20'+c['evidence'],'mismatched':['arbitration_binding']};let e=0x0;const f=[],g=[];if(d['every'](h=>h['votingGuards']>0x0))e+=0x8,f['push']('arbitrator\x20roster\x20configured');else g['push']('no\x20arbitrator\x20roster');if(d['every'](h=>BigInt(h['fee']||'0')>0x0n))e+=0x6,f['push']('arbitration\x20fee\x20funded');else g['push']('arbitration\x20fee\x20unfunded');if(!d['some'](h=>h['paused']))e+=0x6,f['push']('arbitration\x20active');else g['push']('arbitration\x20paused');return{'score':Math['round'](e/0x14*0x64),'weight':WEIGHTS['trust_arbitration'],'reason':'Arbitration\x20'+e+'/20\x20—\x20'+c['evidence'],'matched':f,'mismatched':g};}};}function trustReviewsRule(){const a='trust_reviews';return{'id':a,'description':'Review\x20reputation\x20dimension\x20(registrar\x20votes\x20from\x20the\x20graph\x20facts)','dimension':dimensionLabel(a),'weight':WEIGHTS['trust_reviews'],'evaluation_ids':[GRAPH_TRUST_EVALUATION],'evaluate':b=>{const c=inputFact(b,a);if(!c||c['state']==='gap')return null;const d=c['value']??{'total':0x0,'like':0x0,'dislike':0x0,'favor':0x0};if(c['state']==='empty'||d['total']===0x0)return{'score':0x32,'weight':WEIGHTS['trust_reviews'],'reason':'No\x20reputation\x20signal\x20(verified\x20empty\x20window)\x20—\x20'+c['evidence']};const e=d['like']/d['total'],f=Math['min'](0x23,Math['round'](e*0x19)+Math['min'](0xa,d['favor']));return{'score':Math['round'](f/0x23*0x64),'weight':WEIGHTS['trust_reviews'],'reason':'Reviews\x20'+f+'/35\x20(like\x20rate\x20'+Math['round'](e*0x64)+'%)\x20—\x20'+c['evidence'],'matched':['vote\x20window\x20read\x20without\x20truncation'],'mismatched':d['like']<d['dislike']?['dislike\x20majority']:[]};}};}function trustFulfillmentRule(){const a='trust_fulfillment';return{'id':a,'description':'Fulfillment\x20dimension\x20(windowed\x20order\x20record\x20from\x20the\x20graph\x20facts)','dimension':dimensionLabel(a),'weight':WEIGHTS['trust_fulfillment'],'evaluation_ids':[GRAPH_TRUST_EVALUATION],'evaluate':b=>{const c=inputFact(b,a);if(!c||c['state']==='gap')return null;const d=c['value'];if(c['state']==='empty'||!d||d['observed']===0x0)return{'score':0x32,'weight':WEIGHTS['trust_fulfillment'],'reason':'No\x20fulfillment\x20record\x20yet\x20(verified\x20empty\x20window)\x20—\x20'+c['evidence']};const e=Math['min'](0xa,Math['floor'](d['observed']/0x5)),f=d['completed']+d['inProgress'],g=f>0x0?Math['round'](d['completed']/f*0xa):0x5,h=Math['min'](0x14,e+g);return{'score':Math['round'](h/0x14*0x64),'weight':WEIGHTS['trust_fulfillment'],'reason':'Fulfillment\x20'+h+'/20\x20(recent\x20orders:\x20'+d['observed']+')\x20—\x20'+c['evidence'],'matched':['completion\x20'+d['completed']+'/'+(f||d['observed'])+'\x20resolved'],'mismatched':d['completed']===0x0?['no\x20completed\x20order\x20in\x20window']:[]};}};}function trustFundSafetyRule(){const a='trust_fund_safety';return{'id':a,'description':'Fund\x20safety\x20dimension\x20(compensation\x20fund\x20vs\x20windowed\x20exposure\x20from\x20the\x20graph\x20facts)','dimension':dimensionLabel(a),'weight':WEIGHTS['trust_fund_safety'],'evaluation_ids':[GRAPH_TRUST_EVALUATION],'evaluate':b=>{const c=GRAPH_RULE_INPUT_FACTS[a],d=b['facts'][c[0x0]],e=b['facts'][c[0x1]];if(!d||!e||d['state']==='gap'||e['state']==='gap')return null;const f=BigInt(d['value']?.['fund']??'0'),g=[];let h;const i=e['value'],j=BigInt(i?.['windowedAmount']??'0');if(e['state']==='empty'||j===0x0n){h=f>0x0n?0xf:0x0;if(f===0x0n)g['push']('no\x20compensation\x20fund');}else{if(i['coverageMet'])h=0xf;else{const k=BigInt(i['neededCeiling']||'1');if(f>=j){const l=Number(f*0x3e8n/k)/0x3e8;h=0xa+Math['round']((l-0x1/0x3)/(0x2/0x3)*0x5);}else h=Math['round'](Number(f*0x3e8n/j)/0x3e8*0xa);g['push']('compensation\x20fund\x20below\x20the\x20statutory\x203x\x20exposure\x20ceiling');}}return{'score':Math['round'](Math['max'](0x0,h)/0xf*0x64),'weight':WEIGHTS['trust_fund_safety'],'reason':'Fund\x20safety\x20'+Math['max'](0x0,h)+'/15\x20—\x20'+d['evidence']+'\x20'+e['evidence'],'matched':g['length']===0x0?['exposure\x20covered']:[],'mismatched':g};}};}function trustTransparencyRule(){const a='trust_transparency';return{'id':a,'description':'Transparency\x20dimension\x20(snapshot\x20self-description\x20from\x20the\x20graph\x20facts)','dimension':dimensionLabel(a),'weight':WEIGHTS['trust_transparency'],'evaluation_ids':[GRAPH_TRUST_EVALUATION],'evaluate':b=>{const c=inputFact(b,a);if(!c||c['state']==='gap')return null;const d=c['value'];if(c['state']==='empty'||!d)return{'score':0x32,'weight':WEIGHTS['trust_transparency'],'reason':'No\x20transparency\x20profile\x20material\x20—\x20'+c['evidence']};let e=0x0;const f=[],g=[];if(d['published'])e+=0x4,f['push']('service\x20published');else g['push']('service\x20unpublished');if(d['description']!=='')e+=0x3,f['push']('description\x20present');else g['push']('empty\x20description');if(d['location']!=='')e+=0x3,f['push']('location\x20present');else g['push']('empty\x20location');return{'score':Math['round'](e/0xa*0x64),'weight':WEIGHTS['trust_transparency'],'reason':'Transparency\x20'+e+'/10\x20—\x20'+c['evidence'],'matched':f,'mismatched':g};}};}function riskRule(a,b){const c=dimensionLabel(a);return{'id':a,'description':c+'\x20structural\x20risk\x20dimension\x20(analyzer\x20findings\x20reused\x20by\x20reference)','dimension':c,'weight':b,'evaluation_ids':[GRAPH_RISK_EVALUATION],'evaluate':d=>{const e=inputFact(d,a);if(!e||e['state']==='gap')return null;const f=e['value']?.['findings']??[];if(e['state']==='empty')return{'score':0x32,'weight':b,'reason':'No\x20'+c+'\x20material\x20configured\x20(verified\x20absence)\x20—\x20'+e['evidence']};const g=f['reduce']((i,j)=>i+severityDeduction(j['severity']),0x0),h=Math['max'](0x0,0x64-g);return{'score':h,'weight':b,'reason':f['length']>0x0?f['length']+'\x20structural\x20finding(s):\x20'+f['map'](i=>'['+i['severity']+']\x20'+i['title'])['join'](';\x20')+'\x20—\x20'+e['evidence']:'No\x20structural\x20risk\x20fired\x20—\x20'+e['evidence'],'matched':f['length']===0x0?['no\x20structural\x20findings']:[],'mismatched':[...new Set(f['map'](i=>i['title']))],'finding_refs':f['map'](i=>({'id':i['id'],'title':i['title'],'severity':i['severity']})),'red_flag':f['some'](i=>i['severity']==='critical')};}};}export function registerGraphServiceEvaluations(a=getEvaluationEngine()){a['registerDataSource'](dsGraphFacts);const b=[trustArbitrationRule(),trustReviewsRule(),trustFulfillmentRule(),trustFundSafetyRule(),trustTransparencyRule(),riskRule('risk_workflow',WEIGHTS['risk_workflow']),riskRule('risk_fund',WEIGHTS['risk_fund']),riskRule('risk_trust',WEIGHTS['risk_trust']),riskRule('risk_behavior',WEIGHTS['risk_behavior'])];for(const c of b)a['registerRule'](c);}function collectUnverified(a){const b=new Map(a['facts']['map'](d=>[d['key'],d['state']])),c=[];for(const [d,e]of Object['entries'](GRAPH_RULE_INPUT_FACTS)){if(e['some'](f=>b['get'](f)==='gap'))c['push'](d);}return c;}function summarize(a,b,c,d){const e=['Service\x20'+b+'\x20'+a['total']+'/100\x20(grade:\x20'+gradeWord(b,a['total'])+')'],f=[...a['breakdown']]['sort']((g,h)=>g['score']-h['score'])[0x0];if(f){const g=(GRAPH_RULE_INPUT_FACTS[f['rule_id']]??[])['map'](h=>factOf(c,h)?.['evidence'])['filter'](Boolean)['join']('\x20');if(g)e['push']('weakest\x20'+dimensionLabel(f['rule_id'])+'\x20'+f['score']+'/100\x20—\x20'+g);}if(d['length']>0x0)e['push']('unverifiable\x20(excluded\x20from\x20aggregation):\x20'+d['map'](dimensionLabel)['join'](',\x20'));if(a['blocked'])e['push']('blocked:\x20'+(a['red_flags'][0x0]??'red\x20flag'));return e['join']('\x20—\x20');}export async function evaluateGraphServiceFacts(a,b){const c=getEvaluationEngine(),d={'graph_facts':a},e=await c['evaluate'](GRAPH_TRUST_EVALUATION,d,b),f=await c['evaluate'](GRAPH_RISK_EVALUATION,d,b),g=collectUnverified(a);return e['unverified']=g,f['unverified']=g,e['summary']=summarize(e,'trust',a,g),f['summary']=summarize(f,'risk',a,g),{'target':a['target'],'trust':e,'risk':f,'completeness':a['completeness'],'coverage':a['slots'],'unverified':g,'vocabulary':COVERAGE_VOCABULARY};}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|