@wowok/agent-mcp 2.3.16 → 2.4.1
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/customer/index.d.ts +9 -0
- package/dist/customer/index.js +9 -0
- package/dist/customer/industry-risks.d.ts +4 -0
- package/dist/customer/industry-risks.js +45 -31
- package/dist/customer/order-monitor.js +57 -57
- package/dist/customer/order-strategy.js +89 -89
- package/dist/customer/post-purchase.js +97 -97
- package/dist/customer/reminder-system.js +26 -26
- package/dist/customer/risk-assessment.js +46 -46
- package/dist/customer/types.d.ts +4 -4
- package/dist/customer/types.js +4 -4
- package/dist/customer/user-preferences.d.ts +3 -0
- package/dist/customer/user-preferences.js +59 -50
- package/dist/experience/intent-distill.js +6 -6
- package/dist/experience/realtime-feedback.js +17 -0
- package/dist/index.js +360 -273
- package/dist/knowledge/acquisition-flywheel.d.ts +3 -0
- package/dist/knowledge/acquisition-flywheel.js +73 -64
- package/dist/knowledge/arbitration-trust.js +10 -10
- package/dist/knowledge/demand-matching.js +8 -8
- package/dist/knowledge/dynamic-pricing.js +18 -18
- package/dist/knowledge/flywheel-loop.js +11 -11
- package/dist/knowledge/glossary.js +22 -22
- package/dist/knowledge/guard-ledger.d.ts +19 -0
- package/dist/knowledge/guard-ledger.js +246 -0
- package/dist/knowledge/guard-lint.d.ts +76 -0
- package/dist/knowledge/guard-lint.js +590 -0
- package/dist/knowledge/guard-puzzle.d.ts +188 -0
- package/dist/knowledge/guard-puzzle.js +804 -0
- package/dist/knowledge/guard-risk.d.ts +67 -0
- package/dist/knowledge/guard-risk.js +1046 -0
- package/dist/knowledge/guard-templates.d.ts +37 -0
- package/dist/knowledge/guard-templates.js +329 -0
- package/dist/knowledge/guard-translation.d.ts +58 -0
- package/dist/knowledge/guard-translation.js +1118 -0
- package/dist/knowledge/index.d.ts +17 -0
- package/dist/knowledge/index.js +17 -0
- package/dist/knowledge/industry-evolution.js +29 -29
- package/dist/knowledge/industry-generalizer.js +52 -52
- package/dist/knowledge/industry-registry.d.ts +1 -2
- package/dist/knowledge/industry-registry.js +43 -36
- package/dist/knowledge/intent-metrics.js +67 -67
- package/dist/knowledge/process-model.js +80 -80
- package/dist/knowledge/reputation-rules.js +9 -9
- package/dist/knowledge/reward-templates.js +51 -51
- package/dist/knowledge/safety-rules.js +63 -2
- package/dist/knowledge/tool-constraints.js +17 -11
- package/dist/knowledge/trust-metrics.js +26 -26
- package/dist/safety/confirm-gate.d.ts +4 -2
- package/dist/safety/confirm-gate.js +48 -4
- package/dist/schema/call/allocation.d.ts +24 -14
- package/dist/schema/call/arbitration.d.ts +142 -132
- package/dist/schema/call/base.d.ts +901 -43
- package/dist/schema/call/base.js +77 -13
- package/dist/schema/call/bridge-handler.js +15 -2
- package/dist/schema/call/bridge.d.ts +795 -27
- package/dist/schema/call/bridge.js +37 -0
- package/dist/schema/call/contact.d.ts +10 -0
- package/dist/schema/call/demand.d.ts +94 -84
- package/dist/schema/call/guard.d.ts +229 -46
- package/dist/schema/call/guard.js +50 -0
- package/dist/schema/call/handler.js +46 -14
- package/dist/schema/call/machine.d.ts +158 -138
- package/dist/schema/call/order.d.ts +10 -0
- package/dist/schema/call/payment.d.ts +10 -0
- package/dist/schema/call/permission.d.ts +314 -304
- package/dist/schema/call/personal.d.ts +10 -0
- package/dist/schema/call/progress.d.ts +10 -0
- package/dist/schema/call/proof.d.ts +20 -0
- package/dist/schema/call/repository.d.ts +32 -22
- package/dist/schema/call/reward.d.ts +10 -0
- package/dist/schema/call/semantic.d.ts +9 -2
- package/dist/schema/call/semantic.js +617 -25
- package/dist/schema/call/service.d.ts +20 -10
- package/dist/schema/call/treasury.d.ts +10 -0
- 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 +9 -9
- package/dist/schema/local/index.js +9 -0
- package/dist/schema/local/wip.d.ts +39 -19
- package/dist/schema/local/wip.js +5 -5
- package/dist/schema/messenger/index.d.ts +376 -55
- package/dist/schema/messenger/index.js +19 -19
- package/dist/schema/operations.d.ts +1881 -681
- package/dist/schema/operations.js +91 -96
- package/dist/schema/project/index.d.ts +21 -0
- package/dist/schema/project/index.js +32 -0
- package/dist/schema/query/index.d.ts +1074 -168
- package/dist/schema/query/index.js +8 -8
- 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/schema/utils/guard-parser.js +4 -4
- package/dist/schema/utils/node-parser.js +14 -14
- package/dist/schemas/bridge_operation.output.json +233 -9
- package/dist/schemas/bridge_operation.schema.json +67 -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 +8 -0
- package/dist/schemas/index.json +19 -1
- package/dist/schemas/machineNode2file.schema.json +8 -0
- package/dist/schemas/messenger_operation.output.json +236 -10
- package/dist/schemas/onchain_events.output.json +718 -0
- package/dist/schemas/onchain_operations.output.json +286 -11
- package/dist/schemas/onchain_operations.schema.json +19 -16
- package/dist/schemas/onchain_operations_allocation.schema.json +8 -0
- package/dist/schemas/onchain_operations_arbitration.schema.json +8 -0
- package/dist/schemas/onchain_operations_contact.schema.json +8 -0
- package/dist/schemas/onchain_operations_demand.schema.json +8 -0
- package/dist/schemas/onchain_operations_gen_passport.schema.json +16 -0
- package/dist/schemas/onchain_operations_guard.schema.json +11 -16
- package/dist/schemas/onchain_operations_machine.schema.json +8 -0
- package/dist/schemas/onchain_operations_order.schema.json +8 -0
- package/dist/schemas/onchain_operations_payment.schema.json +8 -0
- package/dist/schemas/onchain_operations_permission.schema.json +8 -0
- package/dist/schemas/onchain_operations_personal.schema.json +8 -0
- package/dist/schemas/onchain_operations_progress.schema.json +8 -0
- package/dist/schemas/onchain_operations_repository.schema.json +8 -0
- package/dist/schemas/onchain_operations_reward.schema.json +8 -0
- package/dist/schemas/onchain_operations_service.schema.json +8 -0
- package/dist/schemas/onchain_operations_treasury.schema.json +8 -0
- package/dist/schemas/onchain_table_data.output.json +718 -0
- 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/dist/schemas/wip_file.output.json +24 -1
- package/package.json +2 -2
|
@@ -5,7 +5,7 @@ export function riskLevelFromScore(score) {
|
|
|
5
5
|
}
|
|
6
6
|
export function riskLevelLabel(level) {
|
|
7
7
|
const entry = RISK_LEVELS.find((l) => l.level === level);
|
|
8
|
-
return entry ? `${entry.color} ${entry.label}` : "🔴
|
|
8
|
+
return entry ? `${entry.color} ${entry.label}` : "🔴 High risk";
|
|
9
9
|
}
|
|
10
10
|
export function riskLevelEmoji(level) {
|
|
11
11
|
const entry = RISK_LEVELS.find((l) => l.level === level);
|
|
@@ -18,47 +18,47 @@ function assessWorkflowRisk(puzzle) {
|
|
|
18
18
|
checks.push({
|
|
19
19
|
id: "wf_refund_path",
|
|
20
20
|
dimension: "workflow",
|
|
21
|
-
description: "
|
|
21
|
+
description: "Refund path exists (100%→Order Allocator)",
|
|
22
22
|
weight: 10,
|
|
23
23
|
passed: hasRefund,
|
|
24
|
-
advice: hasRefund ? undefined : "⚠️
|
|
24
|
+
advice: hasRefund ? undefined : "⚠️ No refund path: if delivery fails, funds may not be recoverable. Recommend negotiating refund terms with the merchant via Messenger and writing them into the WTS before ordering.",
|
|
25
25
|
});
|
|
26
26
|
const hasArb = wf?.has_arbitration_path ?? false;
|
|
27
27
|
checks.push({
|
|
28
28
|
id: "wf_arbitration_path",
|
|
29
29
|
dimension: "workflow",
|
|
30
|
-
description: "
|
|
30
|
+
description: "Arbitration path exists",
|
|
31
31
|
weight: 10,
|
|
32
32
|
passed: hasArb,
|
|
33
|
-
advice: hasArb ? undefined : "⚠️
|
|
33
|
+
advice: hasArb ? undefined : "⚠️ No arbitration path: disputes cannot be escalated to third-party arbitration. Recommend requiring the merchant to bind an Arbitration service before ordering.",
|
|
34
34
|
});
|
|
35
35
|
const userOps = wf?.user_operable_forwards ?? 0;
|
|
36
36
|
checks.push({
|
|
37
37
|
id: "wf_user_operable",
|
|
38
38
|
dimension: "workflow",
|
|
39
|
-
description: "
|
|
39
|
+
description: "At least 1 user-operable Forward",
|
|
40
40
|
weight: 8,
|
|
41
41
|
passed: userOps > 0,
|
|
42
|
-
advice: userOps > 0 ? undefined : "🔴
|
|
42
|
+
advice: userOps > 0 ? undefined : "🔴 No user-operable steps in the workflow: order progress depends entirely on the merchant, leaving you in a passive position.",
|
|
43
43
|
});
|
|
44
44
|
const deadEnds = wf?.dead_end_nodes ?? [];
|
|
45
45
|
const noDeadEnds = deadEnds.length === 0;
|
|
46
46
|
checks.push({
|
|
47
47
|
id: "wf_no_dead_ends",
|
|
48
48
|
dimension: "workflow",
|
|
49
|
-
description: "
|
|
49
|
+
description: "No potential dead-end nodes",
|
|
50
50
|
weight: 4,
|
|
51
51
|
passed: noDeadEnds,
|
|
52
|
-
advice: noDeadEnds ? undefined : `⚠️
|
|
52
|
+
advice: noDeadEnds ? undefined : `⚠️ Detected ${deadEnds.length} potential dead-end node(s): ${deadEnds.join(", ")}. All exits of these nodes depend on merchant action.`,
|
|
53
53
|
});
|
|
54
54
|
const machineUsable = wf ? (wf.machine_published && !wf.machine_paused) : false;
|
|
55
55
|
checks.push({
|
|
56
56
|
id: "wf_machine_usable",
|
|
57
57
|
dimension: "workflow",
|
|
58
|
-
description: "Machine
|
|
58
|
+
description: "Machine is published and not paused",
|
|
59
59
|
weight: 3,
|
|
60
60
|
passed: machineUsable,
|
|
61
|
-
advice: machineUsable ? undefined : "⚠️ Machine
|
|
61
|
+
advice: machineUsable ? undefined : "⚠️ Machine is not published or is paused: the workflow may not be in effect or has been actively paused by the merchant.",
|
|
62
62
|
});
|
|
63
63
|
const score = checks.reduce((sum, c) => sum + (c.passed ? c.weight : 0), 0);
|
|
64
64
|
return { name: "workflow", score, max_score: RISK_DIMENSION_MAX.workflow, checks };
|
|
@@ -74,11 +74,11 @@ function assessFundRisk(puzzle) {
|
|
|
74
74
|
}
|
|
75
75
|
else if (fund.compensation_ratio > 0) {
|
|
76
76
|
compScore = Math.round(fund.compensation_ratio * 10);
|
|
77
|
-
compAdvice = `⚠️
|
|
77
|
+
compAdvice = `⚠️ Compensation fund covers only ${Math.round(fund.compensation_ratio * 100)}% of the order amount; insufficient for a full payout.`;
|
|
78
78
|
}
|
|
79
79
|
else {
|
|
80
80
|
compScore = 0;
|
|
81
|
-
compAdvice = "🔴
|
|
81
|
+
compAdvice = "🔴 No compensation fund: the merchant has not set up a compensation_fund; no automatic payout source if the order fails.";
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
else {
|
|
@@ -87,7 +87,7 @@ function assessFundRisk(puzzle) {
|
|
|
87
87
|
checks.push({
|
|
88
88
|
id: "fund_compensation",
|
|
89
89
|
dimension: "fund",
|
|
90
|
-
description: "
|
|
90
|
+
description: "Compensation fund adequacy (covers the order amount)",
|
|
91
91
|
weight: 10,
|
|
92
92
|
passed: compScore >= 7,
|
|
93
93
|
advice: compAdvice,
|
|
@@ -96,28 +96,28 @@ function assessFundRisk(puzzle) {
|
|
|
96
96
|
checks.push({
|
|
97
97
|
id: "fund_refund_allocator",
|
|
98
98
|
dimension: "fund",
|
|
99
|
-
description: "
|
|
99
|
+
description: "100%→Order refund Allocator exists",
|
|
100
100
|
weight: 8,
|
|
101
101
|
passed: hasRefundAllocator,
|
|
102
|
-
advice: hasRefundAllocator ? undefined : "⚠️
|
|
102
|
+
advice: hasRefundAllocator ? undefined : "⚠️ No 100%→Order Allocator detected: refunds require manual merchant action or arbitration ruling.",
|
|
103
103
|
});
|
|
104
104
|
const priceOk = fund ? fund.price_anomaly === "none" : true;
|
|
105
105
|
checks.push({
|
|
106
106
|
id: "fund_price_normal",
|
|
107
107
|
dimension: "fund",
|
|
108
|
-
description: "
|
|
108
|
+
description: "No price anomaly (compared with compensation fund and market price)",
|
|
109
109
|
weight: 4,
|
|
110
110
|
passed: priceOk,
|
|
111
|
-
advice: priceOk ? undefined : `⚠️
|
|
111
|
+
advice: priceOk ? undefined : `⚠️ Price anomaly (${fund?.price_anomaly}): possible fraudulent pricing or abnormally-low-price lure.`,
|
|
112
112
|
});
|
|
113
113
|
const lockSafe = fund?.lock_duration_safe ?? true;
|
|
114
114
|
checks.push({
|
|
115
115
|
id: "fund_lock_safe",
|
|
116
116
|
dimension: "fund",
|
|
117
|
-
description: "
|
|
117
|
+
description: "Compensation fund lock period is reasonable (≥7 days or no lock)",
|
|
118
118
|
weight: 3,
|
|
119
119
|
passed: lockSafe,
|
|
120
|
-
advice: lockSafe ? undefined : "⚠️
|
|
120
|
+
advice: lockSafe ? undefined : "⚠️ Compensation fund lock period is too short: the merchant may withdraw funds at any time.",
|
|
121
121
|
});
|
|
122
122
|
const naiveScore = checks.reduce((sum, c) => sum + (c.passed ? c.weight : 0), 0);
|
|
123
123
|
const score = fund && !fund.compensation_covers_order && fund.compensation_ratio > 0
|
|
@@ -132,10 +132,10 @@ function assessTrustRisk(puzzle) {
|
|
|
132
132
|
checks.push({
|
|
133
133
|
id: "trust_arb_independent",
|
|
134
134
|
dimension: "trust",
|
|
135
|
-
description: "
|
|
135
|
+
description: "Arbitrator has no conflict of interest with the merchant",
|
|
136
136
|
weight: 6,
|
|
137
137
|
passed: arbIndependent,
|
|
138
|
-
advice: arbIndependent ? undefined : "🔴
|
|
138
|
+
advice: arbIndependent ? undefined : "🔴 Arbitrator and merchant are the same address: arbitration fairness cannot be guaranteed.",
|
|
139
139
|
});
|
|
140
140
|
let reviewPassed = false;
|
|
141
141
|
let reviewAdvice;
|
|
@@ -146,11 +146,11 @@ function assessTrustRisk(puzzle) {
|
|
|
146
146
|
}
|
|
147
147
|
else if (likeRate >= 0.6) {
|
|
148
148
|
reviewPassed = true;
|
|
149
|
-
reviewAdvice = `⚠️
|
|
149
|
+
reviewAdvice = `⚠️ Like rate is ${Math.round(likeRate * 100)}%; there is some controversy.`;
|
|
150
150
|
}
|
|
151
151
|
else {
|
|
152
152
|
reviewPassed = false;
|
|
153
|
-
reviewAdvice = `🔴
|
|
153
|
+
reviewAdvice = `🔴 Like rate is only ${Math.round(likeRate * 100)}% (${trust.review_likes}/${trust.review_total}); many negative reviews.`;
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
else if (trust) {
|
|
@@ -162,7 +162,7 @@ function assessTrustRisk(puzzle) {
|
|
|
162
162
|
checks.push({
|
|
163
163
|
id: "trust_review_reputation",
|
|
164
164
|
dimension: "trust",
|
|
165
|
-
description: "
|
|
165
|
+
description: "Good review reputation (like rate ≥60%)",
|
|
166
166
|
weight: 5,
|
|
167
167
|
passed: reviewPassed,
|
|
168
168
|
advice: reviewAdvice,
|
|
@@ -172,20 +172,20 @@ function assessTrustRisk(puzzle) {
|
|
|
172
172
|
checks.push({
|
|
173
173
|
id: "trust_score",
|
|
174
174
|
dimension: "trust",
|
|
175
|
-
description:
|
|
175
|
+
description: `Composite trust score ≥50 (current ${trustScore})`,
|
|
176
176
|
weight: 4,
|
|
177
177
|
passed: trustPassed,
|
|
178
|
-
advice: trustPassed ? undefined : `🔴
|
|
178
|
+
advice: trustPassed ? undefined : `🔴 Composite trust score is only ${trustScore}/100; recommend finding a more trustworthy merchant.`,
|
|
179
179
|
});
|
|
180
180
|
const hasContact = trust?.has_contact ?? false;
|
|
181
181
|
const hasMessenger = trust?.has_messenger ?? false;
|
|
182
182
|
checks.push({
|
|
183
183
|
id: "trust_contact",
|
|
184
184
|
dimension: "trust",
|
|
185
|
-
description: "
|
|
185
|
+
description: "Merchant has a contactable Messenger channel",
|
|
186
186
|
weight: 5,
|
|
187
187
|
passed: hasContact && hasMessenger,
|
|
188
|
-
advice: (hasContact && hasMessenger) ? undefined : "🔴
|
|
188
|
+
advice: (hasContact && hasMessenger) ? undefined : "🔴 Merchant has no contactable channel (um is empty): no way to conduct pre-order negotiation or post-sale communication.",
|
|
189
189
|
});
|
|
190
190
|
const score = checks.reduce((sum, c) => sum + (c.passed ? c.weight : 0), 0);
|
|
191
191
|
return { name: "trust", score, max_score: RISK_DIMENSION_MAX.trust, checks };
|
|
@@ -204,7 +204,7 @@ function assessBehaviorRisk(puzzle) {
|
|
|
204
204
|
}
|
|
205
205
|
else {
|
|
206
206
|
trendPassed = false;
|
|
207
|
-
trendAdvice = "🔴
|
|
207
|
+
trendAdvice = "🔴 Merchant's recent dispute rate is rising: fulfillment quality may be deteriorating.";
|
|
208
208
|
}
|
|
209
209
|
}
|
|
210
210
|
else {
|
|
@@ -213,7 +213,7 @@ function assessBehaviorRisk(puzzle) {
|
|
|
213
213
|
checks.push({
|
|
214
214
|
id: "behavior_trend",
|
|
215
215
|
dimension: "behavior",
|
|
216
|
-
description: "
|
|
216
|
+
description: "Recent fulfillment trend is stable or improving",
|
|
217
217
|
weight: 6,
|
|
218
218
|
passed: trendPassed,
|
|
219
219
|
advice: trendAdvice,
|
|
@@ -222,37 +222,37 @@ function assessBehaviorRisk(puzzle) {
|
|
|
222
222
|
checks.push({
|
|
223
223
|
id: "behavior_completion_rate",
|
|
224
224
|
dimension: "behavior",
|
|
225
|
-
description: "
|
|
225
|
+
description: "Order completion rate ≥85%",
|
|
226
226
|
weight: 4,
|
|
227
227
|
passed: completionPassed,
|
|
228
|
-
advice: completionPassed ? undefined : `🔴
|
|
228
|
+
advice: completionPassed ? undefined : `🔴 Completion rate is only ${Math.round((beh?.completed_rate ?? 0) * 100)}%: a higher-than-average share of orders end in failure.`,
|
|
229
229
|
});
|
|
230
230
|
const disputeOk = beh ? beh.dispute_rate <= 0.1 : true;
|
|
231
231
|
checks.push({
|
|
232
232
|
id: "behavior_low_dispute",
|
|
233
233
|
dimension: "behavior",
|
|
234
|
-
description: "
|
|
234
|
+
description: "Dispute rate ≤10%",
|
|
235
235
|
weight: 4,
|
|
236
236
|
passed: disputeOk,
|
|
237
|
-
advice: disputeOk ? undefined : `⚠️
|
|
237
|
+
advice: disputeOk ? undefined : `⚠️ Dispute rate is ${Math.round((beh?.dispute_rate ?? 0) * 100)}%: above the industry average.`,
|
|
238
238
|
});
|
|
239
239
|
const arbLossOk = beh ? beh.arb_loss_rate <= 0.3 : true;
|
|
240
240
|
checks.push({
|
|
241
241
|
id: "behavior_arb_loss",
|
|
242
242
|
dimension: "behavior",
|
|
243
|
-
description: "
|
|
243
|
+
description: "Arbitration loss rate ≤30%",
|
|
244
244
|
weight: 3,
|
|
245
245
|
passed: arbLossOk,
|
|
246
|
-
advice: arbLossOk ? undefined : `🔴
|
|
246
|
+
advice: arbLossOk ? undefined : `🔴 Arbitration loss rate is ${Math.round((beh?.arb_loss_rate ?? 0) * 100)}%: the merchant has lost multiple arbitration cases, indicating a tendency to violate rules.`,
|
|
247
247
|
});
|
|
248
248
|
const noRedFlags = beh ? beh.red_flags.length === 0 : true;
|
|
249
249
|
checks.push({
|
|
250
250
|
id: "behavior_no_red_flags",
|
|
251
251
|
dimension: "behavior",
|
|
252
|
-
description: "
|
|
252
|
+
description: "No behavior red_flags",
|
|
253
253
|
weight: 3,
|
|
254
254
|
passed: noRedFlags,
|
|
255
|
-
advice: noRedFlags ? undefined : `⚠️
|
|
255
|
+
advice: noRedFlags ? undefined : `⚠️ Detected behavioral warning signals: ${beh?.red_flags.join(", ")}`,
|
|
256
256
|
});
|
|
257
257
|
const score = checks.reduce((sum, c) => sum + (c.passed ? c.weight : 0), 0);
|
|
258
258
|
return { name: "behavior", score, max_score: RISK_DIMENSION_MAX.behavior, checks };
|
|
@@ -297,18 +297,18 @@ function generateAdvice(puzzle, total, level, dimensions) {
|
|
|
297
297
|
const advice = [];
|
|
298
298
|
const emoji = riskLevelEmoji(level);
|
|
299
299
|
const levelEntry = RISK_LEVELS.find((l) => l.level === level);
|
|
300
|
-
advice.push(`${emoji}
|
|
300
|
+
advice.push(`${emoji} Composite risk score: ${total}/100 (${levelEntry?.label ?? "unknown"})`);
|
|
301
301
|
if (level === "high") {
|
|
302
|
-
advice.push("🚫
|
|
302
|
+
advice.push("🚫 Recommend abandoning this order: the risk level is too high; fund safety cannot be guaranteed.");
|
|
303
303
|
}
|
|
304
304
|
else if (level === "medium_high") {
|
|
305
|
-
advice.push("⚠️
|
|
305
|
+
advice.push("⚠️ Recommend ordering with caution: be sure to negotiate supplementary terms via Messenger and request a WTS evidence file.");
|
|
306
306
|
}
|
|
307
307
|
else if (level === "medium_low") {
|
|
308
|
-
advice.push("✅
|
|
308
|
+
advice.push("✅ You may order: recommend continuously monitoring order progress and keeping communication records.");
|
|
309
309
|
}
|
|
310
310
|
else {
|
|
311
|
-
advice.push("✅
|
|
311
|
+
advice.push("✅ Safe order: you can order with confidence; still recommend enabling order monitoring reminders.");
|
|
312
312
|
}
|
|
313
313
|
const sortedDims = [...dimensions].sort((a, b) => (a.score / a.max_score) - (b.score / b.max_score));
|
|
314
314
|
for (const dim of sortedDims) {
|
|
@@ -316,7 +316,7 @@ function generateAdvice(puzzle, total, level, dimensions) {
|
|
|
316
316
|
if (ratio < 0.5) {
|
|
317
317
|
const failedChecks = dim.checks.filter((c) => !c.passed);
|
|
318
318
|
if (failedChecks.length > 0) {
|
|
319
|
-
advice.push(`📊 ${dim.name}
|
|
319
|
+
advice.push(`📊 ${dim.name} dimension ${dim.score}/${dim.max_score}: ${failedChecks.length} check(s) failed.`);
|
|
320
320
|
const critical = failedChecks.find((c) => c.advice?.startsWith("🔴"));
|
|
321
321
|
if (critical?.advice)
|
|
322
322
|
advice.push(critical.advice);
|
|
@@ -324,7 +324,7 @@ function generateAdvice(puzzle, total, level, dimensions) {
|
|
|
324
324
|
}
|
|
325
325
|
}
|
|
326
326
|
if (puzzle.completeness < 0.8) {
|
|
327
|
-
advice.push(`ℹ️
|
|
327
|
+
advice.push(`ℹ️ Information completeness is only ${Math.round(puzzle.completeness * 100)}%; missing: ${puzzle.gaps.join(", ") || "none"}. Recommend supplementing data before making a decision.`);
|
|
328
328
|
}
|
|
329
329
|
return advice;
|
|
330
330
|
}
|
package/dist/customer/types.d.ts
CHANGED
|
@@ -172,22 +172,22 @@ export declare const CUSTOMER_INTELLIGENCE_VERSION = 1;
|
|
|
172
172
|
export declare const RISK_LEVELS: readonly [{
|
|
173
173
|
readonly min: 85;
|
|
174
174
|
readonly level: "low";
|
|
175
|
-
readonly label: "
|
|
175
|
+
readonly label: "Low risk";
|
|
176
176
|
readonly color: "🟢";
|
|
177
177
|
}, {
|
|
178
178
|
readonly min: 70;
|
|
179
179
|
readonly level: "medium_low";
|
|
180
|
-
readonly label: "
|
|
180
|
+
readonly label: "Medium-low risk";
|
|
181
181
|
readonly color: "🟡";
|
|
182
182
|
}, {
|
|
183
183
|
readonly min: 50;
|
|
184
184
|
readonly level: "medium_high";
|
|
185
|
-
readonly label: "
|
|
185
|
+
readonly label: "Medium-high risk";
|
|
186
186
|
readonly color: "🟠";
|
|
187
187
|
}, {
|
|
188
188
|
readonly min: 0;
|
|
189
189
|
readonly level: "high";
|
|
190
|
-
readonly label: "
|
|
190
|
+
readonly label: "High risk";
|
|
191
191
|
readonly color: "🔴";
|
|
192
192
|
}];
|
|
193
193
|
export declare const RISK_DIMENSION_MAX: Record<RiskDimensionName, number>;
|
package/dist/customer/types.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export const CUSTOMER_INTELLIGENCE_VERSION = 1;
|
|
2
2
|
export const RISK_LEVELS = [
|
|
3
|
-
{ min: 85, level: "low", label: "
|
|
4
|
-
{ min: 70, level: "medium_low", label: "
|
|
5
|
-
{ min: 50, level: "medium_high", label: "
|
|
6
|
-
{ min: 0, level: "high", label: "
|
|
3
|
+
{ min: 85, level: "low", label: "Low risk", color: "🟢" },
|
|
4
|
+
{ min: 70, level: "medium_low", label: "Medium-low risk", color: "🟡" },
|
|
5
|
+
{ min: 50, level: "medium_high", label: "Medium-high risk", color: "🟠" },
|
|
6
|
+
{ min: 0, level: "high", label: "High risk", color: "🔴" },
|
|
7
7
|
];
|
|
8
8
|
export const RISK_DIMENSION_MAX = {
|
|
9
9
|
workflow: 35,
|
|
@@ -12,6 +12,9 @@ export interface IndustryTemplate {
|
|
|
12
12
|
after_sales_expectation: UserPreferences["after_sales_expectation"];
|
|
13
13
|
}
|
|
14
14
|
export declare function getDefaultPreferences(industry?: Industry): UserPreferences;
|
|
15
|
+
export declare function _setRegistryLookup(fn: ((industry: string) => {
|
|
16
|
+
preference_template?: IndustryTemplate;
|
|
17
|
+
} | undefined) | null): void;
|
|
15
18
|
export declare function getIndustryTemplate(industry: Industry): IndustryTemplate;
|
|
16
19
|
export interface OrderHistoryEntry {
|
|
17
20
|
service_id: string;
|