@wowok/agent-mcp 2.3.13 → 2.3.16
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/industry-risks.d.ts +36 -0
- package/dist/customer/industry-risks.js +424 -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 +67 -0
- package/dist/customer/user-preferences.js +451 -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 +77 -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/harness/checkpoint.d.ts +8 -0
- package/dist/harness/checkpoint.js +129 -0
- package/dist/harness/index.d.ts +33 -0
- package/dist/harness/index.js +75 -0
- package/dist/harness/plan.d.ts +18 -0
- package/dist/harness/plan.js +252 -0
- package/dist/harness/recover.d.ts +17 -0
- package/dist/harness/recover.js +139 -0
- package/dist/harness/types.d.ts +137 -0
- package/dist/harness/types.js +1 -0
- package/dist/harness/verify.d.ts +42 -0
- package/dist/harness/verify.js +237 -0
- package/dist/index.js +667 -201
- package/dist/knowledge/acquisition-flywheel.d.ts +50 -0
- package/dist/knowledge/acquisition-flywheel.js +183 -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/index.d.ts +64 -0
- package/dist/knowledge/index.js +66 -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 +49 -0
- package/dist/knowledge/industry-registry.js +167 -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 +171 -0
- package/dist/knowledge/tool-constraints.d.ts +30 -0
- package/dist/knowledge/tool-constraints.js +185 -0
- package/dist/knowledge/trust-metrics.d.ts +37 -0
- package/dist/knowledge/trust-metrics.js +138 -0
- package/dist/loop-engineering/aggregate.d.ts +50 -0
- package/dist/loop-engineering/aggregate.js +132 -0
- package/dist/loop-engineering/diagnose.d.ts +22 -0
- package/dist/loop-engineering/diagnose.js +273 -0
- package/dist/loop-engineering/improve.d.ts +26 -0
- package/dist/loop-engineering/improve.js +229 -0
- package/dist/loop-engineering/index.d.ts +4 -0
- package/dist/loop-engineering/index.js +4 -0
- package/dist/loop-engineering/pipeline.d.ts +17 -0
- package/dist/loop-engineering/pipeline.js +56 -0
- package/dist/mode-market/index.d.ts +3 -0
- package/dist/mode-market/index.js +3 -0
- package/dist/mode-market/registry.d.ts +53 -0
- package/dist/mode-market/registry.js +124 -0
- package/dist/mode-market/review.d.ts +27 -0
- package/dist/mode-market/review.js +214 -0
- package/dist/mode-market/submission.d.ts +25 -0
- package/dist/mode-market/submission.js +85 -0
- 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 +15 -0
- package/dist/safety/confirm-gate.js +44 -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 +55 -40
- package/dist/schema/call/arbitration.d.ts +201 -186
- package/dist/schema/call/base.d.ts +2104 -24
- package/dist/schema/call/base.js +168 -22
- package/dist/schema/call/bridge-handler.js +36 -18
- package/dist/schema/call/bridge.d.ts +777 -120
- package/dist/schema/call/bridge.js +13 -2
- package/dist/schema/call/contact.d.ts +15 -0
- package/dist/schema/call/demand.d.ts +69 -54
- package/dist/schema/call/guard.d.ts +125 -80
- package/dist/schema/call/handler.d.ts +5 -1
- package/dist/schema/call/handler.js +108 -3
- package/dist/schema/call/index.d.ts +1 -0
- package/dist/schema/call/index.js +1 -0
- package/dist/schema/call/machine.d.ts +830 -800
- package/dist/schema/call/order.d.ts +27 -12
- package/dist/schema/call/payment.d.ts +15 -0
- package/dist/schema/call/permission.d.ts +15 -0
- package/dist/schema/call/personal.d.ts +15 -0
- package/dist/schema/call/progress.d.ts +21 -6
- package/dist/schema/call/proof.d.ts +42 -12
- package/dist/schema/call/proof.js +3 -3
- package/dist/schema/call/repository.d.ts +91 -76
- package/dist/schema/call/reward.d.ts +51 -36
- package/dist/schema/call/semantic.d.ts +24 -0
- package/dist/schema/call/semantic.js +981 -0
- package/dist/schema/call/service.d.ts +444 -429
- package/dist/schema/call/treasury.d.ts +219 -204
- package/dist/schema/common/index.js +3 -3
- package/dist/schema/local/index.d.ts +341 -74
- package/dist/schema/local/index.js +44 -7
- package/dist/schema/messenger/index.d.ts +1034 -92
- package/dist/schema/messenger/index.js +18 -0
- package/dist/schema/operations.d.ts +2634 -1817
- package/dist/schema/operations.js +16 -5
- package/dist/schema/query/index.d.ts +2293 -2289
- package/dist/schema/query/index.js +34 -28
- package/dist/schemas/account_operation.output.json +28 -16
- package/dist/schemas/account_operation.schema.json +2 -2
- package/dist/schemas/bridge_operation.output.json +520 -0
- package/dist/schemas/bridge_operation.schema.json +15 -0
- package/dist/schemas/guard2file.schema.json +15 -0
- package/dist/schemas/index.json +1 -1
- package/dist/schemas/local_info_operation.output.json +26 -0
- package/dist/schemas/local_info_operation.schema.json +1 -1
- package/dist/schemas/local_mark_operation.output.json +27 -1
- package/dist/schemas/local_mark_operation.schema.json +4 -4
- package/dist/schemas/machineNode2file.schema.json +15 -0
- package/dist/schemas/messenger_operation.output.json +549 -0
- package/dist/schemas/messenger_operation.schema.json +21 -0
- package/dist/schemas/onchain_events.output.json +3 -0
- package/dist/schemas/onchain_operations.output.json +814 -37
- package/dist/schemas/onchain_operations.schema.json +117 -40
- package/dist/schemas/onchain_operations_allocation.schema.json +26 -9
- package/dist/schemas/onchain_operations_arbitration.schema.json +26 -9
- package/dist/schemas/onchain_operations_contact.schema.json +26 -9
- package/dist/schemas/onchain_operations_demand.schema.json +26 -9
- package/dist/schemas/onchain_operations_gen_passport.schema.json +51 -17
- package/dist/schemas/onchain_operations_guard.schema.json +26 -9
- package/dist/schemas/onchain_operations_machine.schema.json +92 -32
- package/dist/schemas/onchain_operations_order.schema.json +26 -9
- package/dist/schemas/onchain_operations_payment.schema.json +26 -9
- package/dist/schemas/onchain_operations_permission.schema.json +26 -9
- package/dist/schemas/onchain_operations_personal.schema.json +26 -9
- package/dist/schemas/onchain_operations_progress.schema.json +26 -9
- package/dist/schemas/onchain_operations_repository.schema.json +26 -9
- package/dist/schemas/onchain_operations_reward.schema.json +26 -9
- package/dist/schemas/onchain_operations_service.schema.json +26 -9
- package/dist/schemas/onchain_operations_treasury.schema.json +26 -9
- package/dist/schemas/onchain_table_data.output.json +224 -69
- package/dist/schemas/onchain_table_data.schema.json +2 -2
- package/dist/schemas/query_toolkit.schema.json +5 -1
- package/dist/telemetry/index.d.ts +19 -0
- package/dist/telemetry/index.js +112 -0
- package/dist/telemetry/redact.d.ts +2 -0
- package/dist/telemetry/redact.js +23 -0
- package/dist/telemetry/storage.d.ts +8 -0
- package/dist/telemetry/storage.js +80 -0
- package/package.json +6 -3
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
import { CUSTOMER_INTELLIGENCE_VERSION } from "./types.js";
|
|
2
|
+
const SCENARIO_SPECS = {
|
|
3
|
+
info_asymmetry: {
|
|
4
|
+
scenario: "info_asymmetry",
|
|
5
|
+
merchant_tactic: "隐藏关键流程信息,Machine 不公开",
|
|
6
|
+
user_strategy: "要求查看 machineNode2file 导出 + Guard 配置;通过 Messenger 询问关键节点",
|
|
7
|
+
nash_equilibrium: "商家透明化(提供完整 Machine 文档)↔ 用户购买",
|
|
8
|
+
fallback: "放弃购买",
|
|
9
|
+
confidence: (puzzle) => {
|
|
10
|
+
if (puzzle.workflow_analysis === undefined)
|
|
11
|
+
return 0.9;
|
|
12
|
+
if (puzzle.completeness < 0.5)
|
|
13
|
+
return 0.9;
|
|
14
|
+
return 0.5;
|
|
15
|
+
},
|
|
16
|
+
rationale: (puzzle) => {
|
|
17
|
+
if (puzzle.workflow_analysis === undefined) {
|
|
18
|
+
return "流程结构分析缺失,信息严重不对称";
|
|
19
|
+
}
|
|
20
|
+
if (puzzle.completeness < 0.5) {
|
|
21
|
+
return `信息完整度仅 ${Math.round(puzzle.completeness * 100)}%,关键碎片缺失`;
|
|
22
|
+
}
|
|
23
|
+
return "信息完整度尚可,但仍建议索取 Machine 文档";
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
fund_safety: {
|
|
27
|
+
scenario: "fund_safety",
|
|
28
|
+
merchant_tactic: "无赔偿金或赔偿金不足",
|
|
29
|
+
user_strategy: "要求商家补充 compensation_fund 到订单金额 100%;写入 WTS 协议",
|
|
30
|
+
nash_equilibrium: "商家补足赔偿金 ↔ 用户购买",
|
|
31
|
+
fallback: "选择其他商家或要求仲裁前置",
|
|
32
|
+
confidence: (puzzle) => {
|
|
33
|
+
const fund = puzzle.fund_safety;
|
|
34
|
+
if (!fund)
|
|
35
|
+
return 0.6;
|
|
36
|
+
if (fund.compensation_covers_order === false)
|
|
37
|
+
return 0.95;
|
|
38
|
+
return 0.4;
|
|
39
|
+
},
|
|
40
|
+
rationale: (puzzle) => {
|
|
41
|
+
const fund = puzzle.fund_safety;
|
|
42
|
+
if (!fund)
|
|
43
|
+
return "资金安全分析缺失";
|
|
44
|
+
if (fund.compensation_covers_order === false) {
|
|
45
|
+
return `赔偿金仅覆盖 ${Math.round(fund.compensation_ratio * 100)}% 订单金额`;
|
|
46
|
+
}
|
|
47
|
+
return "赔偿金已覆盖订单金额";
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
refund_dispute: {
|
|
51
|
+
scenario: "refund_dispute",
|
|
52
|
+
merchant_tactic: "无退款路径或退款 Allocator 配置不公平",
|
|
53
|
+
user_strategy: "通过 Messenger 协商退款条款 + 要求 100%→Order Allocator",
|
|
54
|
+
nash_equilibrium: "商家配置退款 Allocator ↔ 用户购买",
|
|
55
|
+
fallback: "仲裁",
|
|
56
|
+
confidence: (puzzle) => {
|
|
57
|
+
const wf = puzzle.workflow_analysis;
|
|
58
|
+
if (!wf)
|
|
59
|
+
return 0.5;
|
|
60
|
+
if (wf.has_refund_path === false)
|
|
61
|
+
return 0.85;
|
|
62
|
+
return 0.4;
|
|
63
|
+
},
|
|
64
|
+
rationale: (puzzle) => {
|
|
65
|
+
const wf = puzzle.workflow_analysis;
|
|
66
|
+
if (!wf)
|
|
67
|
+
return "流程结构缺失,无法确认退款路径";
|
|
68
|
+
if (wf.has_refund_path === false)
|
|
69
|
+
return "流程中未检测到退款路径";
|
|
70
|
+
return "退款路径已存在";
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
arbitration_fairness: {
|
|
74
|
+
scenario: "arbitration_fairness",
|
|
75
|
+
merchant_tactic: "自建仲裁(owner=service owner)",
|
|
76
|
+
user_strategy: "要求第三方仲裁;通过 query_toolkit 验证 arb owner",
|
|
77
|
+
nash_equilibrium: "第三方仲裁 ↔ 用户购买",
|
|
78
|
+
fallback: "不购买",
|
|
79
|
+
confidence: (puzzle) => {
|
|
80
|
+
const trust = puzzle.trust_signals;
|
|
81
|
+
if (!trust)
|
|
82
|
+
return 0.6;
|
|
83
|
+
if (trust.arbitration_independent === false)
|
|
84
|
+
return 0.9;
|
|
85
|
+
return 0.3;
|
|
86
|
+
},
|
|
87
|
+
rationale: (puzzle) => {
|
|
88
|
+
const trust = puzzle.trust_signals;
|
|
89
|
+
if (!trust)
|
|
90
|
+
return "信任信号缺失,无法判断仲裁独立性";
|
|
91
|
+
if (trust.arbitration_independent === false) {
|
|
92
|
+
return "仲裁方与商家为同一地址,公正性存疑";
|
|
93
|
+
}
|
|
94
|
+
return "仲裁独立,公正性有保障";
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
pricing: {
|
|
98
|
+
scenario: "pricing",
|
|
99
|
+
merchant_tactic: "价格高于市场均价 20%+",
|
|
100
|
+
user_strategy: "引用 puzzle.market_context.avg_price 谈判;要求折扣或 Reward",
|
|
101
|
+
nash_equilibrium: "商家降价或提供 Reward ↔ 用户购买",
|
|
102
|
+
fallback: "接受当前价格但要求额外权益",
|
|
103
|
+
confidence: (puzzle) => {
|
|
104
|
+
const market = puzzle.market_context;
|
|
105
|
+
if (!market)
|
|
106
|
+
return 0.4;
|
|
107
|
+
if (market.price_percentile > 0.8)
|
|
108
|
+
return 0.7;
|
|
109
|
+
return 0.3;
|
|
110
|
+
},
|
|
111
|
+
rationale: (puzzle) => {
|
|
112
|
+
const market = puzzle.market_context;
|
|
113
|
+
if (!market)
|
|
114
|
+
return "市场环境数据缺失";
|
|
115
|
+
return `价格处于市场分位 ${Math.round(market.price_percentile * 100)}%`;
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
delivery_sla: {
|
|
119
|
+
scenario: "delivery_sla",
|
|
120
|
+
merchant_tactic: "无里程碑节点 / 无交付时间承诺",
|
|
121
|
+
user_strategy: "要求配置 milestone 节点 + 时间承诺写入 WTS",
|
|
122
|
+
nash_equilibrium: "商家配置 SLA ↔ 用户购买",
|
|
123
|
+
fallback: "接受但通过 Messenger 书面约定时间",
|
|
124
|
+
confidence: (puzzle) => {
|
|
125
|
+
const wf = puzzle.workflow_analysis;
|
|
126
|
+
if (!wf)
|
|
127
|
+
return 0.5;
|
|
128
|
+
if (wf.has_milestone_nodes === false)
|
|
129
|
+
return 0.8;
|
|
130
|
+
return 0.3;
|
|
131
|
+
},
|
|
132
|
+
rationale: (puzzle) => {
|
|
133
|
+
const wf = puzzle.workflow_analysis;
|
|
134
|
+
if (!wf)
|
|
135
|
+
return "流程结构缺失,无法判断里程碑";
|
|
136
|
+
if (wf.has_milestone_nodes === false)
|
|
137
|
+
return "未检测到里程碑节点";
|
|
138
|
+
return "已配置里程碑节点";
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
quality_verification: {
|
|
142
|
+
scenario: "quality_verification",
|
|
143
|
+
merchant_tactic: "WIP hash 未验证",
|
|
144
|
+
user_strategy: "要求 WIP hash 验证;要求样品或阶段性交付证据",
|
|
145
|
+
nash_equilibrium: "商家提供 WIP 验证 ↔ 用户购买",
|
|
146
|
+
fallback: "通过 Messenger 索取样品",
|
|
147
|
+
confidence: (puzzle) => {
|
|
148
|
+
const basics = puzzle.service_basics;
|
|
149
|
+
if (basics.wip_verified === false)
|
|
150
|
+
return 0.85;
|
|
151
|
+
return 0.3;
|
|
152
|
+
},
|
|
153
|
+
rationale: (puzzle) => {
|
|
154
|
+
const basics = puzzle.service_basics;
|
|
155
|
+
if (basics.wip_verified === false)
|
|
156
|
+
return "WIP hash 未经验证,交付物可能被篡改";
|
|
157
|
+
return "WIP hash 已验证";
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
after_sales: {
|
|
161
|
+
scenario: "after_sales",
|
|
162
|
+
merchant_tactic: "无 Messenger 或售后支持",
|
|
163
|
+
user_strategy: "要求配置 Messenger;要求写入售后条款",
|
|
164
|
+
nash_equilibrium: "商家提供售后通道 ↔ 用户购买",
|
|
165
|
+
fallback: "通过 Contact 通道替代",
|
|
166
|
+
confidence: (puzzle) => {
|
|
167
|
+
const trust = puzzle.trust_signals;
|
|
168
|
+
if (!trust)
|
|
169
|
+
return 0.5;
|
|
170
|
+
if (trust.has_messenger === false)
|
|
171
|
+
return 0.75;
|
|
172
|
+
return 0.3;
|
|
173
|
+
},
|
|
174
|
+
rationale: (puzzle) => {
|
|
175
|
+
const trust = puzzle.trust_signals;
|
|
176
|
+
if (!trust)
|
|
177
|
+
return "信任信号缺失,无法确认 Messenger";
|
|
178
|
+
if (trust.has_messenger === false)
|
|
179
|
+
return "未配置 Messenger,售后无通道";
|
|
180
|
+
return "已配置 Messenger";
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
};
|
|
184
|
+
export function recommendStrategy(scenario, ctx) {
|
|
185
|
+
const spec = SCENARIO_SPECS[scenario];
|
|
186
|
+
const { puzzle, prefs } = ctx;
|
|
187
|
+
const strategy = {
|
|
188
|
+
scenario: spec.scenario,
|
|
189
|
+
merchant_tactic: spec.merchant_tactic,
|
|
190
|
+
user_strategy: spec.user_strategy,
|
|
191
|
+
nash_equilibrium: spec.nash_equilibrium,
|
|
192
|
+
};
|
|
193
|
+
const confidence = clampConfidence(spec.confidence(puzzle));
|
|
194
|
+
const fallback = applyPrefsToFallback(scenario, spec.fallback, prefs);
|
|
195
|
+
const rationale = spec.rationale(puzzle);
|
|
196
|
+
return {
|
|
197
|
+
scenario: spec.scenario,
|
|
198
|
+
strategy,
|
|
199
|
+
confidence,
|
|
200
|
+
fallback,
|
|
201
|
+
rationale,
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
export function detectScenarios(puzzle) {
|
|
205
|
+
const scenarios = [];
|
|
206
|
+
if (puzzle.workflow_analysis === undefined || puzzle.completeness < 0.5) {
|
|
207
|
+
scenarios.push("info_asymmetry");
|
|
208
|
+
}
|
|
209
|
+
if (puzzle.fund_safety?.compensation_covers_order === false) {
|
|
210
|
+
scenarios.push("fund_safety");
|
|
211
|
+
}
|
|
212
|
+
if (puzzle.workflow_analysis?.has_refund_path === false) {
|
|
213
|
+
scenarios.push("refund_dispute");
|
|
214
|
+
}
|
|
215
|
+
if (puzzle.trust_signals?.arbitration_independent === false) {
|
|
216
|
+
scenarios.push("arbitration_fairness");
|
|
217
|
+
}
|
|
218
|
+
if (puzzle.market_context && puzzle.market_context.price_percentile > 0.8) {
|
|
219
|
+
scenarios.push("pricing");
|
|
220
|
+
}
|
|
221
|
+
if (puzzle.workflow_analysis?.has_milestone_nodes === false) {
|
|
222
|
+
scenarios.push("delivery_sla");
|
|
223
|
+
}
|
|
224
|
+
if (puzzle.service_basics.wip_verified === false) {
|
|
225
|
+
scenarios.push("quality_verification");
|
|
226
|
+
}
|
|
227
|
+
if (puzzle.trust_signals?.has_messenger === false) {
|
|
228
|
+
scenarios.push("after_sales");
|
|
229
|
+
}
|
|
230
|
+
return scenarios.slice(0, 3);
|
|
231
|
+
}
|
|
232
|
+
export function flowMigrationStrategy(puzzle) {
|
|
233
|
+
const wf = puzzle.workflow_analysis;
|
|
234
|
+
if (!wf || wf.machine_published === false) {
|
|
235
|
+
return {
|
|
236
|
+
strategy: "Machine 未发布,强烈建议要求商家发布后再下单",
|
|
237
|
+
risk: "high",
|
|
238
|
+
advice: "Machine 未发布意味着流程尚未生效,下单后订单可能无法按预期路径推进。建议通过 Messenger 要求商家先发布 Machine 再下单。",
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
if (wf.machine_paused === true) {
|
|
242
|
+
return {
|
|
243
|
+
strategy: "Machine 已暂停,确认原因后再下单",
|
|
244
|
+
risk: "medium",
|
|
245
|
+
advice: "Machine 已被商家暂停,可能是临时维护或主动停售。建议通过 Messenger 询问暂停原因并确认恢复时间后再下单。",
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
return {
|
|
249
|
+
strategy: "可放心下单,流程稳定",
|
|
250
|
+
risk: "low",
|
|
251
|
+
advice: "Machine 已发布且未暂停,流程处于活跃状态,可放心下单。仍建议下单后通过 Progress 节点监控推进。",
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
export function repeatGameStrategy(puzzle, history) {
|
|
255
|
+
const isLongTerm = history.completed >= 5 &&
|
|
256
|
+
(history.completed === 0 || history.disputes / history.completed < 0.2);
|
|
257
|
+
if (isLongTerm) {
|
|
258
|
+
const disputeRate = history.completed > 0
|
|
259
|
+
? Math.round((history.disputes / history.completed) * 100)
|
|
260
|
+
: 0;
|
|
261
|
+
return {
|
|
262
|
+
strategy: "已建立长期信任,可考虑批量下单/优惠谈判",
|
|
263
|
+
is_long_term_partner: true,
|
|
264
|
+
advice: `历史已完成 ${history.completed} 单,争议率 ${disputeRate}%,信任度较高。` +
|
|
265
|
+
"可考虑批量下单以争取折扣,或协商长期合作协议。仍建议保留 WTS 凭证以备后续维权。",
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
if (history.completed < 5) {
|
|
269
|
+
return {
|
|
270
|
+
strategy: "首次合作,建议先小单测试,建立信任后再扩大",
|
|
271
|
+
is_long_term_partner: false,
|
|
272
|
+
advice: `历史合作仅 ${history.completed} 单,样本不足以判断长期信任。` +
|
|
273
|
+
"建议先用小额订单测试商家履约能力与沟通效率," +
|
|
274
|
+
"积累信任后再扩大订单规模。重点关注退款路径与仲裁配置。",
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
const disputeRate = Math.round((history.disputes / history.completed) * 100);
|
|
278
|
+
return {
|
|
279
|
+
strategy: "历史争议率较高,建议谨慎下单并加强风险保障",
|
|
280
|
+
is_long_term_partner: false,
|
|
281
|
+
advice: `历史 ${history.completed} 单中争议率 ${disputeRate}% 偏高,建议本次下单要求商家补足赔偿金、写入 WTS 协议,并强化仲裁前置条款。`,
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
export function rightsProtectionStrategy(puzzle, prefs) {
|
|
285
|
+
const required = [];
|
|
286
|
+
const negotiable = [];
|
|
287
|
+
const red_lines = [];
|
|
288
|
+
const hasRefundPath = puzzle.workflow_analysis?.has_refund_path ?? false;
|
|
289
|
+
const hasArbPath = puzzle.workflow_analysis?.has_arbitration_path ?? false;
|
|
290
|
+
const arbIndependent = puzzle.trust_signals?.arbitration_independent ?? true;
|
|
291
|
+
const compensationRatio = puzzle.fund_safety?.compensation_ratio ?? 0;
|
|
292
|
+
if (!hasRefundPath) {
|
|
293
|
+
required.push("要求商家配置退款 Allocator(100%→Order)");
|
|
294
|
+
}
|
|
295
|
+
else {
|
|
296
|
+
required.push("确认退款路径可用");
|
|
297
|
+
}
|
|
298
|
+
if (!hasArbPath) {
|
|
299
|
+
required.push("要求商家绑定第三方仲裁服务");
|
|
300
|
+
}
|
|
301
|
+
else if (!arbIndependent) {
|
|
302
|
+
required.push("要求商家更换为第三方仲裁(当前为自建仲裁)");
|
|
303
|
+
}
|
|
304
|
+
else {
|
|
305
|
+
required.push("确认仲裁路径可用");
|
|
306
|
+
}
|
|
307
|
+
if (compensationRatio < 1) {
|
|
308
|
+
required.push(`要求商家补充赔偿金至订单金额 100%(当前覆盖 ${Math.round(compensationRatio * 100)}%)`);
|
|
309
|
+
}
|
|
310
|
+
else {
|
|
311
|
+
required.push("确认赔偿金充足");
|
|
312
|
+
}
|
|
313
|
+
if (prefs?.require_arbitration && !hasArbPath) {
|
|
314
|
+
required.push("用户偏好要求必备仲裁");
|
|
315
|
+
}
|
|
316
|
+
if (prefs?.require_compensation_fund && compensationRatio < 1) {
|
|
317
|
+
required.push("用户偏好要求必备赔偿金");
|
|
318
|
+
}
|
|
319
|
+
negotiable.push("价格(基于市场均价谈判)");
|
|
320
|
+
negotiable.push("交付时间(通过 Messenger 书面约定)");
|
|
321
|
+
negotiable.push("Reward 或折扣(基于 puzzle.market_context)");
|
|
322
|
+
if (prefs) {
|
|
323
|
+
if (prefs.bargain_hunting > 0.5) {
|
|
324
|
+
negotiable.push("额外折扣(用户占便宜心态强烈)");
|
|
325
|
+
}
|
|
326
|
+
if (prefs.reward_seeking) {
|
|
327
|
+
negotiable.push("Reward 激励条款");
|
|
328
|
+
}
|
|
329
|
+
if (prefs.delivery_speed_priority === "urgent") {
|
|
330
|
+
negotiable.push("加急交付承诺");
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
if (!hasArbPath && !hasRefundPath) {
|
|
334
|
+
red_lines.push("无仲裁且无退款路径:商家可任意违约,资金无保障,建议不购买");
|
|
335
|
+
}
|
|
336
|
+
if (compensationRatio < 0.5) {
|
|
337
|
+
red_lines.push(`赔偿金覆盖率仅 ${Math.round(compensationRatio * 100)}%(<50%):订单失败时赔付严重不足,建议不购买`);
|
|
338
|
+
}
|
|
339
|
+
if (prefs) {
|
|
340
|
+
const trustScore = puzzle.trust_signals?.trust_score ?? 100;
|
|
341
|
+
if (trustScore < prefs.min_trust_score) {
|
|
342
|
+
red_lines.push(`综合信任分 ${trustScore} 低于用户最低要求 ${prefs.min_trust_score}`);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
return {
|
|
346
|
+
required_rights: required,
|
|
347
|
+
negotiable_rights: negotiable,
|
|
348
|
+
red_lines: red_lines,
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
function clampConfidence(value) {
|
|
352
|
+
if (value < 0)
|
|
353
|
+
return 0;
|
|
354
|
+
if (value > 1)
|
|
355
|
+
return 1;
|
|
356
|
+
return value;
|
|
357
|
+
}
|
|
358
|
+
function applyPrefsToFallback(scenario, defaultFallback, prefs) {
|
|
359
|
+
if (!prefs)
|
|
360
|
+
return defaultFallback;
|
|
361
|
+
if (prefs.risk_appetite === "conservative") {
|
|
362
|
+
if (scenario === "arbitration_fairness" || scenario === "fund_safety") {
|
|
363
|
+
return "放弃购买(保守型用户)";
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
if (prefs.risk_appetite === "aggressive") {
|
|
367
|
+
if (scenario === "pricing") {
|
|
368
|
+
return "接受当前价格但要求额外 Reward 或折扣";
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
return defaultFallback;
|
|
372
|
+
}
|
|
373
|
+
export { CUSTOMER_INTELLIGENCE_VERSION };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { InfoPuzzle } from "./types.js";
|
|
2
|
+
import { CUSTOMER_INTELLIGENCE_VERSION } from "./types.js";
|
|
3
|
+
export type PostPurchasePhase = "refund_tracking" | "quality_issue" | "merchant_unreachable" | "arbitration_support";
|
|
4
|
+
export interface PostPurchaseContext {
|
|
5
|
+
phase: PostPurchasePhase;
|
|
6
|
+
order_id: string;
|
|
7
|
+
service_id: string;
|
|
8
|
+
puzzle?: InfoPuzzle;
|
|
9
|
+
order_amount?: bigint;
|
|
10
|
+
refunded_amount?: bigint;
|
|
11
|
+
wip_hash?: string;
|
|
12
|
+
original_wip_hash?: string;
|
|
13
|
+
last_merchant_reply_at?: number;
|
|
14
|
+
now: number;
|
|
15
|
+
arbitration_initiated?: boolean;
|
|
16
|
+
arb_window_days?: number;
|
|
17
|
+
evidence?: string[];
|
|
18
|
+
has_arbitration?: boolean;
|
|
19
|
+
refund_requested?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface PostPurchaseAction {
|
|
22
|
+
id: string;
|
|
23
|
+
phase: PostPurchasePhase;
|
|
24
|
+
priority: "required" | "recommended" | "info";
|
|
25
|
+
title: string;
|
|
26
|
+
message: string;
|
|
27
|
+
next_step?: string;
|
|
28
|
+
tool?: string;
|
|
29
|
+
deadline?: number;
|
|
30
|
+
}
|
|
31
|
+
export declare function generatePostPurchaseAdvice(ctx: PostPurchaseContext): PostPurchaseAction[];
|
|
32
|
+
export declare function trackRefund(ctx: PostPurchaseContext): PostPurchaseAction[];
|
|
33
|
+
export declare function handleQualityIssue(ctx: PostPurchaseContext): PostPurchaseAction[];
|
|
34
|
+
export declare function handleMerchantUnreachable(ctx: PostPurchaseContext): PostPurchaseAction[];
|
|
35
|
+
export declare function arbitrationSupport(ctx: PostPurchaseContext): PostPurchaseAction[];
|
|
36
|
+
export declare function generateArbitrationTemplate(ctx: PostPurchaseContext): {
|
|
37
|
+
title: string;
|
|
38
|
+
description: string;
|
|
39
|
+
evidence_required: string[];
|
|
40
|
+
claim: string;
|
|
41
|
+
};
|
|
42
|
+
export { CUSTOMER_INTELLIGENCE_VERSION };
|