@wowok/agent-mcp 2.3.14 → 2.3.18
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/index.d.ts +1 -0
- package/dist/config/index.js +1 -0
- package/dist/config/runtime.d.ts +26 -0
- package/dist/config/runtime.js +217 -0
- package/dist/customer/index.d.ts +9 -0
- package/dist/customer/index.js +9 -0
- package/dist/customer/industry-risks.d.ts +40 -0
- package/dist/customer/industry-risks.js +438 -0
- package/dist/customer/info-puzzle.d.ts +102 -0
- package/dist/customer/info-puzzle.js +312 -0
- package/dist/customer/order-monitor.d.ts +75 -0
- package/dist/customer/order-monitor.js +327 -0
- package/dist/customer/order-strategy.d.ts +36 -0
- package/dist/customer/order-strategy.js +373 -0
- package/dist/customer/post-purchase.d.ts +42 -0
- package/dist/customer/post-purchase.js +350 -0
- package/dist/customer/reminder-system.d.ts +42 -0
- package/dist/customer/reminder-system.js +295 -0
- package/dist/customer/risk-assessment.d.ts +8 -0
- package/dist/customer/risk-assessment.js +337 -0
- package/dist/customer/types.d.ts +193 -0
- package/dist/customer/types.js +13 -0
- package/dist/customer/user-preferences.d.ts +70 -0
- package/dist/customer/user-preferences.js +460 -0
- package/dist/experience/experience-reuse.d.ts +10 -0
- package/dist/experience/experience-reuse.js +103 -0
- package/dist/experience/index.d.ts +6 -0
- package/dist/experience/index.js +5 -0
- package/dist/experience/intent-distill.d.ts +3 -0
- package/dist/experience/intent-distill.js +83 -0
- package/dist/experience/realtime-feedback.d.ts +5 -0
- package/dist/experience/realtime-feedback.js +94 -0
- package/dist/experience/types.d.ts +50 -0
- package/dist/experience/types.js +1 -0
- package/dist/experience/user-profile.d.ts +25 -0
- package/dist/experience/user-profile.js +171 -0
- package/dist/index.js +842 -371
- package/dist/knowledge/acquisition-flywheel.d.ts +53 -0
- package/dist/knowledge/acquisition-flywheel.js +192 -0
- package/dist/knowledge/arbitration-trust.d.ts +24 -0
- package/dist/knowledge/arbitration-trust.js +117 -0
- package/dist/knowledge/audit-rules.d.ts +28 -0
- package/dist/knowledge/audit-rules.js +141 -0
- package/dist/knowledge/demand-matching.d.ts +29 -0
- package/dist/knowledge/demand-matching.js +132 -0
- package/dist/knowledge/dynamic-pricing.d.ts +31 -0
- package/dist/knowledge/dynamic-pricing.js +87 -0
- package/dist/knowledge/flywheel-loop.d.ts +87 -0
- package/dist/knowledge/flywheel-loop.js +378 -0
- package/dist/knowledge/glossary.d.ts +18 -0
- package/dist/knowledge/glossary.js +209 -0
- package/dist/knowledge/guard-ledger.d.ts +19 -0
- package/dist/knowledge/guard-ledger.js +219 -0
- package/dist/knowledge/guard-puzzle.d.ts +93 -0
- package/dist/knowledge/guard-puzzle.js +278 -0
- package/dist/knowledge/guard-risk.d.ts +60 -0
- package/dist/knowledge/guard-risk.js +474 -0
- package/dist/knowledge/guard-translation.d.ts +46 -0
- package/dist/knowledge/guard-translation.js +487 -0
- package/dist/knowledge/index.d.ts +77 -0
- package/dist/knowledge/index.js +79 -0
- package/dist/knowledge/industry-evolution.d.ts +82 -0
- package/dist/knowledge/industry-evolution.js +323 -0
- package/dist/knowledge/industry-generalizer.d.ts +17 -0
- package/dist/knowledge/industry-generalizer.js +381 -0
- package/dist/knowledge/industry-registry.d.ts +48 -0
- package/dist/knowledge/industry-registry.js +187 -0
- package/dist/knowledge/intent-metrics.d.ts +42 -0
- package/dist/knowledge/intent-metrics.js +566 -0
- package/dist/knowledge/process-model.d.ts +24 -0
- package/dist/knowledge/process-model.js +160 -0
- package/dist/knowledge/reputation-rules.d.ts +42 -0
- package/dist/knowledge/reputation-rules.js +99 -0
- package/dist/knowledge/reward-templates.d.ts +25 -0
- package/dist/knowledge/reward-templates.js +125 -0
- package/dist/knowledge/safety-rules.d.ts +36 -0
- package/dist/knowledge/safety-rules.js +232 -0
- package/dist/knowledge/tool-constraints.d.ts +30 -0
- package/dist/knowledge/tool-constraints.js +175 -0
- package/dist/knowledge/trust-metrics.d.ts +37 -0
- package/dist/knowledge/trust-metrics.js +138 -0
- package/dist/loop-engineering/diagnose.d.ts +3 -2
- package/dist/loop-engineering/diagnose.js +94 -0
- package/dist/loop-engineering/improve.d.ts +1 -1
- package/dist/loop-engineering/improve.js +52 -1
- package/dist/project/graph.d.ts +71 -0
- package/dist/project/graph.js +314 -0
- package/dist/project/index.d.ts +62 -0
- package/dist/project/index.js +167 -0
- package/dist/project/namespace.d.ts +62 -0
- package/dist/project/namespace.js +181 -0
- package/dist/project/query.d.ts +40 -0
- package/dist/project/query.js +110 -0
- package/dist/safety/confirm-gate.d.ts +17 -0
- package/dist/safety/confirm-gate.js +88 -0
- package/dist/safety/index.d.ts +3 -0
- package/dist/safety/index.js +3 -0
- package/dist/safety/preview.d.ts +2 -0
- package/dist/safety/preview.js +36 -0
- package/dist/schema/call/allocation.d.ts +39 -14
- package/dist/schema/call/arbitration.d.ts +187 -162
- package/dist/schema/call/base.d.ts +1971 -87
- package/dist/schema/call/base.js +135 -3
- package/dist/schema/call/bridge-handler.js +15 -2
- package/dist/schema/call/bridge.d.ts +1478 -53
- package/dist/schema/call/bridge.js +50 -2
- package/dist/schema/call/contact.d.ts +25 -0
- package/dist/schema/call/demand.d.ts +79 -54
- package/dist/schema/call/guard.d.ts +125 -50
- package/dist/schema/call/handler.d.ts +3 -0
- package/dist/schema/call/handler.js +60 -14
- package/dist/schema/call/machine.d.ts +988 -938
- package/dist/schema/call/order.d.ts +25 -0
- package/dist/schema/call/payment.d.ts +25 -0
- package/dist/schema/call/permission.d.ts +244 -219
- package/dist/schema/call/personal.d.ts +25 -0
- package/dist/schema/call/progress.d.ts +25 -0
- package/dist/schema/call/proof.d.ts +62 -12
- package/dist/schema/call/proof.js +3 -3
- package/dist/schema/call/repository.d.ts +101 -76
- package/dist/schema/call/reward.d.ts +55 -30
- package/dist/schema/call/semantic.d.ts +10 -2
- package/dist/schema/call/semantic.js +616 -11
- package/dist/schema/call/service.d.ts +442 -417
- package/dist/schema/call/treasury.d.ts +25 -0
- package/dist/schema/common/index.js +3 -3
- package/dist/schema/config/index.d.ts +18 -0
- package/dist/schema/config/index.js +17 -0
- package/dist/schema/index.d.ts +6 -0
- package/dist/schema/index.js +5 -0
- package/dist/schema/local/index.d.ts +237 -81
- package/dist/schema/local/index.js +42 -6
- package/dist/schema/messenger/index.d.ts +1018 -79
- package/dist/schema/messenger/index.js +26 -17
- package/dist/schema/operations.d.ts +3192 -1746
- package/dist/schema/operations.js +93 -98
- package/dist/schema/project/index.d.ts +21 -0
- package/dist/schema/project/index.js +32 -0
- package/dist/schema/query/index.d.ts +2762 -1856
- package/dist/schema/query/index.js +38 -35
- package/dist/schema/schema-query/index.d.ts +33 -0
- package/dist/schema/schema-query/index.js +36 -0
- package/dist/schema/schema-version.d.ts +25 -0
- package/dist/schema/schema-version.js +76 -0
- package/dist/schema/trust/index.d.ts +407 -0
- package/dist/schema/trust/index.js +113 -0
- package/dist/schemas/account_operation.output.json +25 -16
- package/dist/schemas/account_operation.schema.json +1 -1
- package/dist/schemas/bridge_operation.output.json +744 -0
- package/dist/schemas/bridge_operation.schema.json +82 -8
- package/dist/schemas/config_operation.output.json +18 -0
- package/dist/schemas/config_operation.schema.json +34 -0
- package/dist/schemas/guard-node-schema.json +82 -0
- package/dist/schemas/guard2file.schema.json +23 -0
- package/dist/schemas/index.json +19 -1
- package/dist/schemas/local_info_operation.output.json +23 -0
- package/dist/schemas/local_info_operation.schema.json +1 -1
- package/dist/schemas/local_mark_operation.output.json +24 -1
- package/dist/schemas/local_mark_operation.schema.json +4 -4
- package/dist/schemas/machineNode2file.schema.json +23 -0
- package/dist/schemas/messenger_operation.output.json +752 -0
- package/dist/schemas/onchain_events.output.json +718 -0
- package/dist/schemas/onchain_operations.output.json +627 -18
- package/dist/schemas/onchain_operations.schema.json +115 -39
- package/dist/schemas/onchain_operations_allocation.schema.json +23 -0
- package/dist/schemas/onchain_operations_arbitration.schema.json +23 -0
- package/dist/schemas/onchain_operations_contact.schema.json +23 -0
- package/dist/schemas/onchain_operations_demand.schema.json +23 -0
- package/dist/schemas/onchain_operations_gen_passport.schema.json +46 -0
- package/dist/schemas/onchain_operations_guard.schema.json +26 -16
- package/dist/schemas/onchain_operations_machine.schema.json +89 -23
- package/dist/schemas/onchain_operations_order.schema.json +23 -0
- package/dist/schemas/onchain_operations_payment.schema.json +23 -0
- package/dist/schemas/onchain_operations_permission.schema.json +23 -0
- package/dist/schemas/onchain_operations_personal.schema.json +23 -0
- package/dist/schemas/onchain_operations_progress.schema.json +23 -0
- package/dist/schemas/onchain_operations_repository.schema.json +23 -0
- package/dist/schemas/onchain_operations_reward.schema.json +23 -0
- package/dist/schemas/onchain_operations_service.schema.json +23 -0
- package/dist/schemas/onchain_operations_treasury.schema.json +23 -0
- package/dist/schemas/onchain_table_data.output.json +939 -69
- package/dist/schemas/onchain_table_data.schema.json +2 -2
- package/dist/schemas/project_operation.output.json +18 -0
- package/dist/schemas/project_operation.schema.json +42 -0
- package/dist/schemas/query_toolkit.schema.json +360 -368
- package/dist/schemas/schema_query.schema.json +6 -3
- package/dist/schemas/trust_score.output.json +327 -0
- package/dist/schemas/trust_score.schema.json +46 -0
- package/package.json +2 -2
|
@@ -0,0 +1,566 @@
|
|
|
1
|
+
import { INDUSTRY_EVOLUTION_THRESHOLDS } from "./industry-evolution.js";
|
|
2
|
+
export const BUILTIN_INTENT_SPECS = {
|
|
3
|
+
default: {
|
|
4
|
+
intent: "default",
|
|
5
|
+
display_name: "默认(Phase 4 原始模型)",
|
|
6
|
+
weights: {
|
|
7
|
+
completed_rate: 35,
|
|
8
|
+
dispute_rate: 25,
|
|
9
|
+
refund_rate: 15,
|
|
10
|
+
repeat_buyer_rate: 15,
|
|
11
|
+
cycle_efficiency: 10,
|
|
12
|
+
},
|
|
13
|
+
healthy_thresholds: {
|
|
14
|
+
completed_rate: 0.9,
|
|
15
|
+
dispute_rate: 0.05,
|
|
16
|
+
refund_rate: 0.05,
|
|
17
|
+
repeat_buyer_rate: 0.3,
|
|
18
|
+
cycle_efficiency: 24 * 7,
|
|
19
|
+
},
|
|
20
|
+
suggestion_triggers: [],
|
|
21
|
+
level_thresholds: { thriving: 85, healthy: 65, stressed: 45 },
|
|
22
|
+
},
|
|
23
|
+
growth: {
|
|
24
|
+
intent: "growth",
|
|
25
|
+
display_name: "增长(关注新客、复购、订单增速)",
|
|
26
|
+
weights: {
|
|
27
|
+
repeat_buyer_rate: 35,
|
|
28
|
+
completed_rate: 25,
|
|
29
|
+
dispute_rate: 15,
|
|
30
|
+
refund_rate: 10,
|
|
31
|
+
cycle_efficiency: 15,
|
|
32
|
+
},
|
|
33
|
+
healthy_thresholds: {
|
|
34
|
+
completed_rate: 0.85,
|
|
35
|
+
dispute_rate: 0.08,
|
|
36
|
+
repeat_buyer_rate: 0.25,
|
|
37
|
+
cycle_efficiency: 24 * 14,
|
|
38
|
+
},
|
|
39
|
+
suggestion_triggers: [
|
|
40
|
+
{
|
|
41
|
+
metric: "repeat_buyer_rate",
|
|
42
|
+
operator: ">=",
|
|
43
|
+
threshold: 0.3,
|
|
44
|
+
suggestion_type: "update_flywheel",
|
|
45
|
+
field: "flywheel.rewardStrategy",
|
|
46
|
+
suggested_value: "强化忠诚度 Reward + 阶梯复购奖励 + 推荐返现",
|
|
47
|
+
evidence_template: "增长意图下复购率 {value}% ≥ {threshold}%,建议强化忠诚度飞轮",
|
|
48
|
+
confidence: 0.85,
|
|
49
|
+
priority: "high",
|
|
50
|
+
target_roles: ["merchant"],
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
metric: "repeat_buyer_rate",
|
|
54
|
+
operator: "<",
|
|
55
|
+
threshold: 0.15,
|
|
56
|
+
suggestion_type: "update_flywheel",
|
|
57
|
+
field: "flywheel.rewardStrategy",
|
|
58
|
+
suggested_value: "首单奖励 + 7 日内复购折扣 + 推荐返现",
|
|
59
|
+
evidence_template: "增长意图下复购率 {value}% < {threshold}%,建议加强首单激励",
|
|
60
|
+
confidence: 0.75,
|
|
61
|
+
priority: "medium",
|
|
62
|
+
target_roles: ["merchant"],
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
level_thresholds: { thriving: 80, healthy: 60, stressed: 40 },
|
|
66
|
+
role_advice_routing: {
|
|
67
|
+
user: ["关注复购 Reward 与推荐返现"],
|
|
68
|
+
merchant: ["强化忠诚度飞轮", "优化首单转化", "加大 Reward 投入"],
|
|
69
|
+
arbitrator: [],
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
retention: {
|
|
73
|
+
intent: "retention",
|
|
74
|
+
display_name: "留存(关注复购、争议、退款)",
|
|
75
|
+
weights: {
|
|
76
|
+
repeat_buyer_rate: 30,
|
|
77
|
+
dispute_rate: 30,
|
|
78
|
+
refund_rate: 25,
|
|
79
|
+
completed_rate: 15,
|
|
80
|
+
cycle_efficiency: 0,
|
|
81
|
+
},
|
|
82
|
+
healthy_thresholds: {
|
|
83
|
+
completed_rate: 0.8,
|
|
84
|
+
dispute_rate: 0.05,
|
|
85
|
+
refund_rate: 0.05,
|
|
86
|
+
repeat_buyer_rate: 0.25,
|
|
87
|
+
},
|
|
88
|
+
suggestion_triggers: [
|
|
89
|
+
{
|
|
90
|
+
metric: "dispute_rate",
|
|
91
|
+
operator: ">",
|
|
92
|
+
threshold: 0.1,
|
|
93
|
+
suggestion_type: "add_risk_check",
|
|
94
|
+
field: "risk_checks",
|
|
95
|
+
suggested_value: {
|
|
96
|
+
id: "retention_dispute_check",
|
|
97
|
+
description: "留存意图:争议率高,建议强制仲裁 + 赔偿金",
|
|
98
|
+
weight: 35,
|
|
99
|
+
},
|
|
100
|
+
evidence_template: "留存意图下争议率 {value}% > {threshold}%,建议加强纠纷解决通道",
|
|
101
|
+
confidence: 0.85,
|
|
102
|
+
priority: "high",
|
|
103
|
+
target_roles: ["merchant", "arbitrator"],
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
metric: "refund_rate",
|
|
107
|
+
operator: ">",
|
|
108
|
+
threshold: 0.1,
|
|
109
|
+
suggestion_type: "adjust_preference",
|
|
110
|
+
field: "preference_template.require_arbitration",
|
|
111
|
+
suggested_value: true,
|
|
112
|
+
evidence_template: "留存意图下退款率 {value}% > {threshold}%,建议强制仲裁",
|
|
113
|
+
confidence: 0.8,
|
|
114
|
+
priority: "high",
|
|
115
|
+
target_roles: ["user", "merchant"],
|
|
116
|
+
},
|
|
117
|
+
],
|
|
118
|
+
level_thresholds: { thriving: 80, healthy: 60, stressed: 45 },
|
|
119
|
+
role_advice_routing: {
|
|
120
|
+
user: ["优先选择有仲裁的商家", "关注退款政策"],
|
|
121
|
+
merchant: ["降低争议率", "优化退款流程", "加强交付质量"],
|
|
122
|
+
arbitrator: ["关注高争议行业", "主动提供纠纷解决通道"],
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
compliance: {
|
|
126
|
+
intent: "compliance",
|
|
127
|
+
display_name: "合规(关注仲裁、赔偿金、监管)",
|
|
128
|
+
weights: {
|
|
129
|
+
arbitration_coverage: 35,
|
|
130
|
+
compensation_coverage: 30,
|
|
131
|
+
dispute_rate: 20,
|
|
132
|
+
refund_rate: 15,
|
|
133
|
+
completed_rate: 0,
|
|
134
|
+
repeat_buyer_rate: 0,
|
|
135
|
+
cycle_efficiency: 0,
|
|
136
|
+
},
|
|
137
|
+
healthy_thresholds: {
|
|
138
|
+
arbitration_coverage: 1.0,
|
|
139
|
+
compensation_coverage: 0.8,
|
|
140
|
+
dispute_rate: 0.05,
|
|
141
|
+
},
|
|
142
|
+
suggestion_triggers: [
|
|
143
|
+
{
|
|
144
|
+
metric: "arbitration_coverage",
|
|
145
|
+
operator: "<",
|
|
146
|
+
threshold: 1.0,
|
|
147
|
+
suggestion_type: "adjust_preference",
|
|
148
|
+
field: "preference_template.require_arbitration",
|
|
149
|
+
suggested_value: true,
|
|
150
|
+
evidence_template: "合规意图下仲裁覆盖率 {value}% < 100%,建议强制配置仲裁",
|
|
151
|
+
confidence: 0.95,
|
|
152
|
+
priority: "high",
|
|
153
|
+
target_roles: ["merchant", "arbitrator"],
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
metric: "compensation_coverage",
|
|
157
|
+
operator: "<",
|
|
158
|
+
threshold: 0.8,
|
|
159
|
+
suggestion_type: "add_risk_check",
|
|
160
|
+
field: "risk_checks",
|
|
161
|
+
suggested_value: {
|
|
162
|
+
id: "compliance_compensation_check",
|
|
163
|
+
description: "合规意图:赔偿金覆盖率不足",
|
|
164
|
+
weight: 40,
|
|
165
|
+
},
|
|
166
|
+
evidence_template: "合规意图下赔偿金覆盖率 {value}% < {threshold}%,建议增加赔偿金",
|
|
167
|
+
confidence: 0.9,
|
|
168
|
+
priority: "high",
|
|
169
|
+
target_roles: ["merchant"],
|
|
170
|
+
},
|
|
171
|
+
],
|
|
172
|
+
level_thresholds: { thriving: 90, healthy: 70, stressed: 50 },
|
|
173
|
+
role_advice_routing: {
|
|
174
|
+
user: ["只与有仲裁的商家交易", "确认赔偿金充足"],
|
|
175
|
+
merchant: ["配置仲裁", "增加赔偿金", "合规优先"],
|
|
176
|
+
arbitrator: ["主动监控高监管行业", "提供合规咨询"],
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
efficiency: {
|
|
180
|
+
intent: "efficiency",
|
|
181
|
+
display_name: "效率(关注周期、里程碑、沟通)",
|
|
182
|
+
weights: {
|
|
183
|
+
cycle_efficiency: 45,
|
|
184
|
+
milestone_adoption: 25,
|
|
185
|
+
completed_rate: 20,
|
|
186
|
+
dispute_rate: 10,
|
|
187
|
+
refund_rate: 0,
|
|
188
|
+
repeat_buyer_rate: 0,
|
|
189
|
+
},
|
|
190
|
+
healthy_thresholds: {
|
|
191
|
+
cycle_efficiency: 24 * 3,
|
|
192
|
+
milestone_adoption: 0.6,
|
|
193
|
+
completed_rate: 0.9,
|
|
194
|
+
},
|
|
195
|
+
suggestion_triggers: [
|
|
196
|
+
{
|
|
197
|
+
metric: "cycle_efficiency",
|
|
198
|
+
operator: ">",
|
|
199
|
+
threshold: 24 * 14,
|
|
200
|
+
suggestion_type: "adjust_preference",
|
|
201
|
+
field: "preference_template.max_acceptable_cycle",
|
|
202
|
+
suggested_value: 14,
|
|
203
|
+
evidence_template: "效率意图下平均周期 {value} 小时 > {threshold} 小时,建议缩短最大可接受周期",
|
|
204
|
+
confidence: 0.8,
|
|
205
|
+
priority: "high",
|
|
206
|
+
target_roles: ["merchant"],
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
metric: "milestone_adoption",
|
|
210
|
+
operator: "<",
|
|
211
|
+
threshold: 0.4,
|
|
212
|
+
suggestion_type: "update_flywheel",
|
|
213
|
+
field: "flywheel.keyActions",
|
|
214
|
+
suggested_value: "增加里程碑节点 + 分阶段验收 Reward",
|
|
215
|
+
evidence_template: "效率意图下里程碑采用率 {value}% < {threshold}%,建议引入里程碑",
|
|
216
|
+
confidence: 0.75,
|
|
217
|
+
priority: "medium",
|
|
218
|
+
target_roles: ["merchant"],
|
|
219
|
+
},
|
|
220
|
+
],
|
|
221
|
+
level_thresholds: { thriving: 85, healthy: 65, stressed: 45 },
|
|
222
|
+
role_advice_routing: {
|
|
223
|
+
user: ["优先选择有里程碑的商家"],
|
|
224
|
+
merchant: ["优化 Machine 节点拆分", "引入里程碑验收", "缩短交付周期"],
|
|
225
|
+
arbitrator: [],
|
|
226
|
+
},
|
|
227
|
+
},
|
|
228
|
+
trust_building: {
|
|
229
|
+
intent: "trust_building",
|
|
230
|
+
display_name: "信任建设(关注仲裁独立性、评价、赔偿金)",
|
|
231
|
+
weights: {
|
|
232
|
+
arbitration_coverage: 25,
|
|
233
|
+
compensation_coverage: 25,
|
|
234
|
+
review_openness: 20,
|
|
235
|
+
dispute_rate: 15,
|
|
236
|
+
completed_rate: 15,
|
|
237
|
+
repeat_buyer_rate: 0,
|
|
238
|
+
refund_rate: 0,
|
|
239
|
+
cycle_efficiency: 0,
|
|
240
|
+
},
|
|
241
|
+
healthy_thresholds: {
|
|
242
|
+
arbitration_coverage: 1.0,
|
|
243
|
+
compensation_coverage: 0.8,
|
|
244
|
+
review_openness: 0.5,
|
|
245
|
+
dispute_rate: 0.05,
|
|
246
|
+
},
|
|
247
|
+
suggestion_triggers: [
|
|
248
|
+
{
|
|
249
|
+
metric: "review_openness",
|
|
250
|
+
operator: "<",
|
|
251
|
+
threshold: 0.3,
|
|
252
|
+
suggestion_type: "update_flywheel",
|
|
253
|
+
field: "flywheel.trustSellingPoints",
|
|
254
|
+
suggested_value: "公开评价上链 + 带凭证评价权重更高",
|
|
255
|
+
evidence_template: "信任建设意图下评价公开度 {value}% < {threshold}%,建议引入公开评价",
|
|
256
|
+
confidence: 0.8,
|
|
257
|
+
priority: "medium",
|
|
258
|
+
target_roles: ["merchant"],
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
metric: "arbitration_coverage",
|
|
262
|
+
operator: "<",
|
|
263
|
+
threshold: 1.0,
|
|
264
|
+
suggestion_type: "add_risk_check",
|
|
265
|
+
field: "risk_checks",
|
|
266
|
+
suggested_value: {
|
|
267
|
+
id: "trust_arbitration_check",
|
|
268
|
+
description: "信任建设:仲裁未配置",
|
|
269
|
+
weight: 35,
|
|
270
|
+
},
|
|
271
|
+
evidence_template: "信任建设意图下仲裁覆盖率 {value}% < 100%,建议强制配置仲裁",
|
|
272
|
+
confidence: 0.9,
|
|
273
|
+
priority: "high",
|
|
274
|
+
target_roles: ["merchant", "arbitrator"],
|
|
275
|
+
},
|
|
276
|
+
],
|
|
277
|
+
level_thresholds: { thriving: 85, healthy: 65, stressed: 50 },
|
|
278
|
+
role_advice_routing: {
|
|
279
|
+
user: ["查看公开评价", "确认仲裁独立性"],
|
|
280
|
+
merchant: ["引入公开评价 Repository", "配置仲裁", "增加赔偿金"],
|
|
281
|
+
arbitrator: ["保持独立性", "主动公开判决理由"],
|
|
282
|
+
},
|
|
283
|
+
},
|
|
284
|
+
custom: {
|
|
285
|
+
intent: "custom",
|
|
286
|
+
display_name: "自定义(运行时注册)",
|
|
287
|
+
weights: {},
|
|
288
|
+
healthy_thresholds: {},
|
|
289
|
+
suggestion_triggers: [],
|
|
290
|
+
},
|
|
291
|
+
};
|
|
292
|
+
const intentRegistry = new Map();
|
|
293
|
+
for (const [k, v] of Object.entries(BUILTIN_INTENT_SPECS)) {
|
|
294
|
+
intentRegistry.set(k, v);
|
|
295
|
+
}
|
|
296
|
+
export function registerIntentProfile(spec) {
|
|
297
|
+
if (!spec.intent || !spec.weights)
|
|
298
|
+
return false;
|
|
299
|
+
intentRegistry.set(spec.intent, spec);
|
|
300
|
+
return true;
|
|
301
|
+
}
|
|
302
|
+
export function getIntentProfile(intent) {
|
|
303
|
+
return intentRegistry.get(intent);
|
|
304
|
+
}
|
|
305
|
+
export function listIntents() {
|
|
306
|
+
return Array.from(intentRegistry.keys());
|
|
307
|
+
}
|
|
308
|
+
export function _resetIntentRegistryForTest() {
|
|
309
|
+
intentRegistry.clear();
|
|
310
|
+
for (const [k, v] of Object.entries(BUILTIN_INTENT_SPECS)) {
|
|
311
|
+
intentRegistry.set(k, v);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
export function evaluateIndustryHealthByIntent(industry, metrics, intent = "default") {
|
|
315
|
+
const spec = intentRegistry.get(intent) ?? intentRegistry.get("default");
|
|
316
|
+
const weights = spec.weights;
|
|
317
|
+
const thresholds = spec.healthy_thresholds;
|
|
318
|
+
const totalWeight = Object.values(weights).reduce((s, w) => s + (w ?? 0), 0) || 100;
|
|
319
|
+
const strengths = [];
|
|
320
|
+
const weaknesses = [];
|
|
321
|
+
const recommendations = [];
|
|
322
|
+
if (metrics.sample_size < INDUSTRY_EVOLUTION_THRESHOLDS.min_sample_size) {
|
|
323
|
+
weaknesses.push(`样本量不足(${metrics.sample_size} < ${INDUSTRY_EVOLUTION_THRESHOLDS.min_sample_size}),评估置信度低`);
|
|
324
|
+
recommendations.push("继续累积订单数据以提升评估精度");
|
|
325
|
+
}
|
|
326
|
+
let healthScore = 0;
|
|
327
|
+
const wCompleted = weights.completed_rate ?? 0;
|
|
328
|
+
if (wCompleted > 0) {
|
|
329
|
+
const score = metrics.completed_rate * wCompleted;
|
|
330
|
+
healthScore += score;
|
|
331
|
+
const thr = thresholds.completed_rate ?? 0.9;
|
|
332
|
+
if (metrics.completed_rate >= thr) {
|
|
333
|
+
strengths.push(`完成率高(${Math.round(metrics.completed_rate * 100)}%)`);
|
|
334
|
+
}
|
|
335
|
+
else if (metrics.completed_rate < thr * 0.8) {
|
|
336
|
+
weaknesses.push(`完成率偏低(${Math.round(metrics.completed_rate * 100)}%)`);
|
|
337
|
+
recommendations.push("排查未完成订单根因,加强 Messenger 沟通");
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
const wDispute = weights.dispute_rate ?? 0;
|
|
341
|
+
if (wDispute > 0) {
|
|
342
|
+
const score = (1 - Math.min(1, metrics.dispute_rate)) * wDispute;
|
|
343
|
+
healthScore += score;
|
|
344
|
+
const thr = thresholds.dispute_rate ?? 0.05;
|
|
345
|
+
if (metrics.dispute_rate <= thr) {
|
|
346
|
+
strengths.push(`争议率低(${Math.round(metrics.dispute_rate * 100)}%)`);
|
|
347
|
+
}
|
|
348
|
+
else if (metrics.dispute_rate > thr * 2) {
|
|
349
|
+
weaknesses.push(`争议率高(${Math.round(metrics.dispute_rate * 100)}%)`);
|
|
350
|
+
recommendations.push("争议率超阈值,建议强制配置仲裁 + 赔偿金 + 交付 Guard");
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
const wRefund = weights.refund_rate ?? 0;
|
|
354
|
+
if (wRefund > 0) {
|
|
355
|
+
const score = (1 - Math.min(1, metrics.refund_rate)) * wRefund;
|
|
356
|
+
healthScore += score;
|
|
357
|
+
if (metrics.refund_rate > 0.2) {
|
|
358
|
+
weaknesses.push(`退款率高(${Math.round(metrics.refund_rate * 100)}%)`);
|
|
359
|
+
recommendations.push("退款率异常,建议检查交付质量或商品描述一致性");
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
const wRepeat = weights.repeat_buyer_rate ?? 0;
|
|
363
|
+
if (wRepeat > 0) {
|
|
364
|
+
const score = Math.min(1, metrics.repeat_buyer_rate) * wRepeat;
|
|
365
|
+
healthScore += score;
|
|
366
|
+
const thr = thresholds.repeat_buyer_rate ?? 0.25;
|
|
367
|
+
if (metrics.repeat_buyer_rate >= thr) {
|
|
368
|
+
strengths.push(`复购率高(${Math.round(metrics.repeat_buyer_rate * 100)}%)`);
|
|
369
|
+
}
|
|
370
|
+
else if (metrics.repeat_buyer_rate < thr * 0.5 && metrics.sample_size >= 20) {
|
|
371
|
+
weaknesses.push(`复购率低(${Math.round(metrics.repeat_buyer_rate * 100)}%)`);
|
|
372
|
+
recommendations.push("复购率低,建议设置忠诚度 Reward + 推荐返现");
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
const wCycle = weights.cycle_efficiency ?? 0;
|
|
376
|
+
if (wCycle > 0 && metrics.avg_cycle_hours > 0) {
|
|
377
|
+
const cycleScore = Math.max(0, Math.min(1, 1 - (metrics.avg_cycle_hours / 24 - 7) / 23));
|
|
378
|
+
healthScore += cycleScore * wCycle;
|
|
379
|
+
const thr = thresholds.cycle_efficiency ?? 24 * 7;
|
|
380
|
+
if (metrics.avg_cycle_hours <= thr) {
|
|
381
|
+
strengths.push(`交付周期短(${Math.round(metrics.avg_cycle_hours)} 小时)`);
|
|
382
|
+
}
|
|
383
|
+
else if (metrics.avg_cycle_hours > 24 * 30) {
|
|
384
|
+
weaknesses.push(`交付周期过长(${Math.round(metrics.avg_cycle_hours / 24)} 天)`);
|
|
385
|
+
recommendations.push("交付周期过长,建议优化 Machine 节点拆分");
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
const wArb = weights.arbitration_coverage ?? 0;
|
|
389
|
+
if (wArb > 0) {
|
|
390
|
+
const hasArbAnomaly = metrics.anomalies.some((a) => a.includes("仲裁"));
|
|
391
|
+
const coverage = hasArbAnomaly ? 0 : 1;
|
|
392
|
+
const score = coverage * wArb;
|
|
393
|
+
healthScore += score;
|
|
394
|
+
if (coverage < 1) {
|
|
395
|
+
weaknesses.push("仲裁覆盖率不足");
|
|
396
|
+
recommendations.push("建议强制配置仲裁(合规/信任意图下必备)");
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
const wComp = weights.compensation_coverage ?? 0;
|
|
400
|
+
if (wComp > 0) {
|
|
401
|
+
const hasCompAnomaly = metrics.anomalies.some((a) => a.includes("赔偿金"));
|
|
402
|
+
const coverage = hasCompAnomaly ? 0 : 1;
|
|
403
|
+
const score = coverage * wComp;
|
|
404
|
+
healthScore += score;
|
|
405
|
+
if (coverage < 0.8) {
|
|
406
|
+
weaknesses.push("赔偿金覆盖率不足");
|
|
407
|
+
recommendations.push("建议增加 compensation_fund 余额");
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
const wMilestone = weights.milestone_adoption ?? 0;
|
|
411
|
+
if (wMilestone > 0) {
|
|
412
|
+
const adoptionSignal = metrics.trait_signals.long_cycle === true ? 0.6 : 0.3;
|
|
413
|
+
const score = adoptionSignal * wMilestone;
|
|
414
|
+
healthScore += score;
|
|
415
|
+
if (adoptionSignal < 0.4) {
|
|
416
|
+
weaknesses.push("里程碑采用率低");
|
|
417
|
+
recommendations.push("建议引入里程碑节点 + 分阶段验收");
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
const wReview = weights.review_openness ?? 0;
|
|
421
|
+
if (wReview > 0) {
|
|
422
|
+
const hasReviewPattern = metrics.emerging_patterns.some((p) => p.includes("评价"));
|
|
423
|
+
const openness = hasReviewPattern ? 0.6 : 0.3;
|
|
424
|
+
const score = openness * wReview;
|
|
425
|
+
healthScore += score;
|
|
426
|
+
if (openness < 0.4) {
|
|
427
|
+
weaknesses.push("评价公开度低");
|
|
428
|
+
recommendations.push("建议引入公开评价 Repository");
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
const normalizedScore = Math.round((healthScore / totalWeight) * 100);
|
|
432
|
+
const lvlThr = spec.level_thresholds ?? {};
|
|
433
|
+
const thrivingThr = lvlThr.thriving ?? 85;
|
|
434
|
+
const healthyThr = lvlThr.healthy ?? 65;
|
|
435
|
+
const stressedThr = lvlThr.stressed ?? 45;
|
|
436
|
+
let level;
|
|
437
|
+
if (normalizedScore >= thrivingThr)
|
|
438
|
+
level = "thriving";
|
|
439
|
+
else if (normalizedScore >= healthyThr)
|
|
440
|
+
level = "healthy";
|
|
441
|
+
else if (normalizedScore >= stressedThr)
|
|
442
|
+
level = "stressed";
|
|
443
|
+
else
|
|
444
|
+
level = "declining";
|
|
445
|
+
return {
|
|
446
|
+
industry,
|
|
447
|
+
health_score: normalizedScore,
|
|
448
|
+
level,
|
|
449
|
+
strengths,
|
|
450
|
+
weaknesses,
|
|
451
|
+
recommendations,
|
|
452
|
+
trait_drift: undefined,
|
|
453
|
+
};
|
|
454
|
+
}
|
|
455
|
+
export function suggestIndustryUpdateByIntent(industry, metrics, intent = "default") {
|
|
456
|
+
if (metrics.sample_size < INDUSTRY_EVOLUTION_THRESHOLDS.min_sample_size) {
|
|
457
|
+
return [];
|
|
458
|
+
}
|
|
459
|
+
const spec = intentRegistry.get(intent) ?? intentRegistry.get("default");
|
|
460
|
+
const suggestions = [];
|
|
461
|
+
for (const trigger of spec.suggestion_triggers) {
|
|
462
|
+
const metricValue = getMetricValue(metrics, trigger.metric);
|
|
463
|
+
if (metricValue === undefined)
|
|
464
|
+
continue;
|
|
465
|
+
const matched = compareMetric(metricValue, trigger.operator, trigger.threshold);
|
|
466
|
+
if (matched) {
|
|
467
|
+
suggestions.push({
|
|
468
|
+
industry,
|
|
469
|
+
suggestion_type: trigger.suggestion_type,
|
|
470
|
+
field: trigger.field,
|
|
471
|
+
current_value: metricValue,
|
|
472
|
+
suggested_value: trigger.suggested_value,
|
|
473
|
+
evidence: renderEvidence(trigger.evidence_template, metricValue, trigger.threshold),
|
|
474
|
+
confidence: trigger.confidence,
|
|
475
|
+
priority: trigger.priority,
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
return suggestions;
|
|
480
|
+
}
|
|
481
|
+
function getMetricValue(metrics, dim) {
|
|
482
|
+
switch (dim) {
|
|
483
|
+
case "completed_rate": return metrics.completed_rate;
|
|
484
|
+
case "dispute_rate": return metrics.dispute_rate;
|
|
485
|
+
case "refund_rate": return metrics.refund_rate;
|
|
486
|
+
case "repeat_buyer_rate": return metrics.repeat_buyer_rate;
|
|
487
|
+
case "cycle_efficiency": return metrics.avg_cycle_hours;
|
|
488
|
+
case "arbitration_coverage":
|
|
489
|
+
return metrics.anomalies.some((a) => a.includes("仲裁")) ? 0 : 1;
|
|
490
|
+
case "compensation_coverage":
|
|
491
|
+
return metrics.anomalies.some((a) => a.includes("赔偿金")) ? 0 : 1;
|
|
492
|
+
case "milestone_adoption":
|
|
493
|
+
return metrics.trait_signals.long_cycle === true ? 0.6 : 0.3;
|
|
494
|
+
case "review_openness":
|
|
495
|
+
return metrics.emerging_patterns.some((p) => p.includes("评价")) ? 0.6 : 0.3;
|
|
496
|
+
default: return undefined;
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
function compareMetric(value, op, threshold) {
|
|
500
|
+
switch (op) {
|
|
501
|
+
case ">=": return value >= threshold;
|
|
502
|
+
case "<=": return value <= threshold;
|
|
503
|
+
case ">": return value > threshold;
|
|
504
|
+
case "<": return value < threshold;
|
|
505
|
+
case "==": return value === threshold;
|
|
506
|
+
default: return false;
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
function renderEvidence(template, value, threshold) {
|
|
510
|
+
return template
|
|
511
|
+
.replace(/\{value\}/g, String(Math.round(value * 100)))
|
|
512
|
+
.replace(/\{threshold\}/g, String(Math.round(threshold * 100)));
|
|
513
|
+
}
|
|
514
|
+
export function evaluateIndustryHealthMultiIntent(industry, metrics, intents) {
|
|
515
|
+
if (intents.length === 0) {
|
|
516
|
+
return evaluateIndustryHealthByIntent(industry, metrics, "default");
|
|
517
|
+
}
|
|
518
|
+
const totalWeight = intents.reduce((s, i) => s + i.weight, 0) || 1;
|
|
519
|
+
let combinedScore = 0;
|
|
520
|
+
const allStrengths = [];
|
|
521
|
+
const allWeaknesses = [];
|
|
522
|
+
const allRecommendations = [];
|
|
523
|
+
for (const { intent, weight } of intents) {
|
|
524
|
+
const report = evaluateIndustryHealthByIntent(industry, metrics, intent);
|
|
525
|
+
combinedScore += report.health_score * weight;
|
|
526
|
+
allStrengths.push(...report.strengths);
|
|
527
|
+
allWeaknesses.push(...report.weaknesses);
|
|
528
|
+
allRecommendations.push(...report.recommendations);
|
|
529
|
+
}
|
|
530
|
+
const finalScore = Math.round(combinedScore / totalWeight);
|
|
531
|
+
const strengths = Array.from(new Set(allStrengths));
|
|
532
|
+
const weaknesses = Array.from(new Set(allWeaknesses));
|
|
533
|
+
const recommendations = Array.from(new Set(allRecommendations));
|
|
534
|
+
let level;
|
|
535
|
+
if (finalScore >= 85)
|
|
536
|
+
level = "thriving";
|
|
537
|
+
else if (finalScore >= 65)
|
|
538
|
+
level = "healthy";
|
|
539
|
+
else if (finalScore >= 45)
|
|
540
|
+
level = "stressed";
|
|
541
|
+
else
|
|
542
|
+
level = "declining";
|
|
543
|
+
return {
|
|
544
|
+
industry,
|
|
545
|
+
health_score: finalScore,
|
|
546
|
+
level,
|
|
547
|
+
strengths,
|
|
548
|
+
weaknesses,
|
|
549
|
+
recommendations,
|
|
550
|
+
trait_drift: undefined,
|
|
551
|
+
};
|
|
552
|
+
}
|
|
553
|
+
export function getRoleAdvice(intent, role) {
|
|
554
|
+
const spec = intentRegistry.get(intent);
|
|
555
|
+
if (!spec?.role_advice_routing)
|
|
556
|
+
return [];
|
|
557
|
+
return spec.role_advice_routing[role] ?? [];
|
|
558
|
+
}
|
|
559
|
+
export function filterSuggestionsByRole(suggestions, role, triggers = []) {
|
|
560
|
+
return suggestions.filter((s) => {
|
|
561
|
+
const trigger = triggers.find((t) => t.suggestion_type === s.suggestion_type && t.field === s.field);
|
|
562
|
+
if (!trigger?.target_roles)
|
|
563
|
+
return true;
|
|
564
|
+
return trigger.target_roles.includes(role);
|
|
565
|
+
});
|
|
566
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type PermissionScope = "organization" | "order" | "order_holder";
|
|
2
|
+
export interface PermissionTypeDef {
|
|
3
|
+
name: "Permission" | "NamedOperator" | "OrderHolder";
|
|
4
|
+
scope: PermissionScope;
|
|
5
|
+
definedOn: string;
|
|
6
|
+
controls: string;
|
|
7
|
+
grantedBy: string;
|
|
8
|
+
example: string;
|
|
9
|
+
}
|
|
10
|
+
export declare const PERMISSION_TYPES: PermissionTypeDef[];
|
|
11
|
+
export type GameElementType = "player" | "strategy" | "payoff" | "utility" | "equilibrium" | "information" | "sequence" | "repetition" | "commitment" | "punishment" | "reward" | "reputation" | "signaling" | "screening" | "bargaining" | "auction" | "mechanism" | "constraint" | "uncertainty" | "cooperation";
|
|
12
|
+
export interface GameElementDef {
|
|
13
|
+
id: number;
|
|
14
|
+
type: GameElementType;
|
|
15
|
+
name: string;
|
|
16
|
+
description: string;
|
|
17
|
+
wowokApplication: string;
|
|
18
|
+
onChainMechanism: string;
|
|
19
|
+
}
|
|
20
|
+
export declare const GAME_ELEMENTS: GameElementDef[];
|
|
21
|
+
export declare function getPermissionType(name: string): PermissionTypeDef | undefined;
|
|
22
|
+
export declare function getGameElement(id: number): GameElementDef | undefined;
|
|
23
|
+
export declare function getGameElementsByType(type: GameElementType): GameElementDef[];
|
|
24
|
+
export declare const PROCESS_MODEL_VERSION = 1;
|