@wowok/agent-mcp 2.3.18 → 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/industry-risks.js +31 -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.js +50 -50
- package/dist/experience/intent-distill.js +6 -6
- package/dist/knowledge/acquisition-flywheel.js +64 -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 +1 -1
- package/dist/knowledge/guard-ledger.js +131 -104
- package/dist/knowledge/guard-lint.d.ts +76 -0
- package/dist/knowledge/guard-lint.js +590 -0
- package/dist/knowledge/guard-puzzle.d.ts +109 -14
- package/dist/knowledge/guard-puzzle.js +627 -101
- package/dist/knowledge/guard-risk.d.ts +8 -1
- package/dist/knowledge/guard-risk.js +868 -296
- package/dist/knowledge/guard-templates.d.ts +37 -0
- package/dist/knowledge/guard-templates.js +329 -0
- package/dist/knowledge/guard-translation.d.ts +14 -2
- package/dist/knowledge/guard-translation.js +825 -194
- package/dist/knowledge/index.d.ts +8 -4
- package/dist/knowledge/index.js +9 -5
- package/dist/knowledge/industry-evolution.js +29 -29
- package/dist/knowledge/industry-generalizer.js +52 -52
- package/dist/knowledge/industry-registry.js +20 -33
- 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 +3 -3
- package/dist/knowledge/tool-constraints.js +20 -4
- package/dist/knowledge/trust-metrics.js +26 -26
- package/dist/schema/call/base.js +16 -16
- package/dist/schema/call/bridge.d.ts +32 -32
- package/dist/schema/call/demand.d.ts +84 -84
- package/dist/schema/call/guard.d.ts +153 -0
- package/dist/schema/call/guard.js +50 -0
- package/dist/schema/call/permission.d.ts +78 -78
- package/dist/schema/call/repository.d.ts +22 -22
- package/dist/schema/call/semantic.js +228 -24
- package/dist/schema/local/wip.d.ts +39 -19
- package/dist/schema/local/wip.js +5 -5
- package/dist/schema/messenger/index.d.ts +26 -26
- package/dist/schema/messenger/index.js +2 -2
- package/dist/schema/operations.d.ts +222 -144
- package/dist/schema/query/index.d.ts +38 -38
- package/dist/schema/trust/index.d.ts +4 -4
- 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 +14 -14
- package/dist/schemas/index.json +1 -1
- package/dist/schemas/messenger_operation.output.json +17 -15
- package/dist/schemas/onchain_events.output.json +14 -14
- package/dist/schemas/onchain_operations.output.json +14 -14
- package/dist/schemas/onchain_table_data.output.json +14 -14
- package/dist/schemas/wip_file.output.json +24 -1
- package/package.json +2 -2
|
@@ -20,9 +20,9 @@ export function trackRefund(ctx) {
|
|
|
20
20
|
id: "refund_complete",
|
|
21
21
|
phase: "refund_tracking",
|
|
22
22
|
priority: "info",
|
|
23
|
-
title: "
|
|
24
|
-
message: `✅
|
|
25
|
-
next_step: "
|
|
23
|
+
title: "Refund complete",
|
|
24
|
+
message: `✅ Order ${ctx.order_id} refund fully received (${refunded} smallest units)`,
|
|
25
|
+
next_step: "You can close post-purchase tracking; recommend submitting an order review",
|
|
26
26
|
});
|
|
27
27
|
return actions;
|
|
28
28
|
}
|
|
@@ -32,9 +32,9 @@ export function trackRefund(ctx) {
|
|
|
32
32
|
id: "refund_partial",
|
|
33
33
|
phase: "refund_tracking",
|
|
34
34
|
priority: "required",
|
|
35
|
-
title: "
|
|
36
|
-
message: `⚠️
|
|
37
|
-
next_step: "
|
|
35
|
+
title: "Refund incomplete",
|
|
36
|
+
message: `⚠️ Order ${ctx.order_id} only refunded ${refunded}/${orderAmount}; the difference of ${diff} smallest units has not been received`,
|
|
37
|
+
next_step: "Urge the merchant via Messenger to make up the difference, or initiate arbitration to recover it",
|
|
38
38
|
tool: "messenger_send",
|
|
39
39
|
});
|
|
40
40
|
return actions;
|
|
@@ -44,9 +44,9 @@ export function trackRefund(ctx) {
|
|
|
44
44
|
id: "refund_waiting",
|
|
45
45
|
phase: "refund_tracking",
|
|
46
46
|
priority: "recommended",
|
|
47
|
-
title: "
|
|
48
|
-
message: `⏳
|
|
49
|
-
next_step: "
|
|
47
|
+
title: "Waiting for merchant refund",
|
|
48
|
+
message: `⏳ Order ${ctx.order_id} refund has been requested; waiting for the merchant to trigger the refund Allocator`,
|
|
49
|
+
next_step: "If not received within 48 hours, recommend urging via Messenger or initiating arbitration",
|
|
50
50
|
tool: "query_toolkit",
|
|
51
51
|
});
|
|
52
52
|
return actions;
|
|
@@ -57,9 +57,9 @@ export function trackRefund(ctx) {
|
|
|
57
57
|
id: "refund_trigger_available",
|
|
58
58
|
phase: "refund_tracking",
|
|
59
59
|
priority: "recommended",
|
|
60
|
-
title: "
|
|
61
|
-
message: `ℹ️
|
|
62
|
-
next_step: "
|
|
60
|
+
title: "Can trigger refund via Allocator",
|
|
61
|
+
message: `ℹ️ Order ${ctx.order_id} has a refund path; you can trigger the refund Allocator to refund`,
|
|
62
|
+
next_step: "Query the refund Allocator trigger conditions via query_toolkit and apply for a refund",
|
|
63
63
|
tool: "query_toolkit",
|
|
64
64
|
});
|
|
65
65
|
return actions;
|
|
@@ -68,9 +68,9 @@ export function trackRefund(ctx) {
|
|
|
68
68
|
id: "refund_no_path",
|
|
69
69
|
phase: "refund_tracking",
|
|
70
70
|
priority: "required",
|
|
71
|
-
title: "
|
|
72
|
-
message: `🔴
|
|
73
|
-
next_step: "
|
|
71
|
+
title: "No refund path; arbitration required",
|
|
72
|
+
message: `🔴 Order ${ctx.order_id} has no refund Allocator path; funds must be recovered via arbitration`,
|
|
73
|
+
next_step: "Switch to the arbitration_support phase and submit an arbitration application",
|
|
74
74
|
tool: "mark_arbitration",
|
|
75
75
|
});
|
|
76
76
|
return actions;
|
|
@@ -84,11 +84,11 @@ export function handleQualityIssue(ctx) {
|
|
|
84
84
|
id: "quality_wip_mismatch",
|
|
85
85
|
phase: "quality_issue",
|
|
86
86
|
priority: "required",
|
|
87
|
-
title: "
|
|
88
|
-
message: `🔴
|
|
89
|
-
`
|
|
90
|
-
`
|
|
91
|
-
next_step: "
|
|
87
|
+
title: "WIP hash mismatch detected",
|
|
88
|
+
message: `🔴 Order ${ctx.order_id} WIP hash differs from the one at order time; the deliverable may have been changed.\n` +
|
|
89
|
+
` Original: ${ctx.original_wip_hash}\n` +
|
|
90
|
+
` Current: ${ctx.wip_hash}`,
|
|
91
|
+
next_step: "Re-verify the WIP via query_toolkit and initiate arbitration immediately",
|
|
92
92
|
tool: "query_toolkit",
|
|
93
93
|
});
|
|
94
94
|
}
|
|
@@ -97,9 +97,9 @@ export function handleQualityIssue(ctx) {
|
|
|
97
97
|
id: "quality_wip_missing",
|
|
98
98
|
phase: "quality_issue",
|
|
99
99
|
priority: "recommended",
|
|
100
|
-
title: "
|
|
101
|
-
message: `⚠️
|
|
102
|
-
next_step: "
|
|
100
|
+
title: "Require merchant to provide WIP hash verification",
|
|
101
|
+
message: `⚠️ Order ${ctx.order_id} is missing the current WIP hash; deliverable integrity cannot be verified`,
|
|
102
|
+
next_step: "Request the latest WIP hash via Messenger and compare it with the original hash",
|
|
103
103
|
tool: "messenger_send",
|
|
104
104
|
});
|
|
105
105
|
}
|
|
@@ -109,12 +109,12 @@ export function handleQualityIssue(ctx) {
|
|
|
109
109
|
id: "quality_collect_evidence",
|
|
110
110
|
phase: "quality_issue",
|
|
111
111
|
priority: "recommended",
|
|
112
|
-
title: "
|
|
113
|
-
message: `📋
|
|
114
|
-
` •
|
|
115
|
-
` • Messenger
|
|
116
|
-
` •
|
|
117
|
-
next_step: "
|
|
112
|
+
title: "Collect evidence: screenshots, chat logs, deliverable samples",
|
|
113
|
+
message: `📋 Order ${ctx.order_id} has no evidence collected yet. Recommend collecting immediately:\n` +
|
|
114
|
+
` • Deliverable screenshots / screen recordings\n` +
|
|
115
|
+
` • Messenger chat logs (export WTS evidence)\n` +
|
|
116
|
+
` • Deliverable samples or test results`,
|
|
117
|
+
next_step: "Generate a WTS evidence file via messenger_mark_evidence",
|
|
118
118
|
tool: "messenger_mark_evidence",
|
|
119
119
|
});
|
|
120
120
|
}
|
|
@@ -123,10 +123,10 @@ export function handleQualityIssue(ctx) {
|
|
|
123
123
|
id: "quality_supplement_evidence",
|
|
124
124
|
phase: "quality_issue",
|
|
125
125
|
priority: "recommended",
|
|
126
|
-
title:
|
|
127
|
-
message: `⚠️
|
|
128
|
-
`
|
|
129
|
-
next_step: "
|
|
126
|
+
title: `Supplement more evidence (currently ${evidenceCount} item(s); recommend ≥3)`,
|
|
127
|
+
message: `⚠️ Order ${ctx.order_id} has collected ${evidenceCount} item(s) of evidence; recommend supplementing to at least 3 to strengthen the arbitration case.\n` +
|
|
128
|
+
` Current evidence: ${ctx.evidence?.join(" / ") ?? "none"}`,
|
|
129
|
+
next_step: "Add screenshots, chat logs, or third-party appraisal reports",
|
|
130
130
|
tool: "messenger_mark_evidence",
|
|
131
131
|
});
|
|
132
132
|
}
|
|
@@ -135,9 +135,9 @@ export function handleQualityIssue(ctx) {
|
|
|
135
135
|
id: "quality_ok",
|
|
136
136
|
phase: "quality_issue",
|
|
137
137
|
priority: "info",
|
|
138
|
-
title: "
|
|
139
|
-
message: `✅
|
|
140
|
-
next_step: "
|
|
138
|
+
title: "Quality verification passed",
|
|
139
|
+
message: `✅ Order ${ctx.order_id} WIP hash matches the original, and evidence is complete (${evidenceCount} item(s))`,
|
|
140
|
+
next_step: "You can proceed with the acceptance workflow",
|
|
141
141
|
});
|
|
142
142
|
}
|
|
143
143
|
return actions;
|
|
@@ -155,9 +155,9 @@ export function handleMerchantUnreachable(ctx) {
|
|
|
155
155
|
id: "unreachable_arb_recommend",
|
|
156
156
|
phase: "merchant_unreachable",
|
|
157
157
|
priority: "required",
|
|
158
|
-
title: "
|
|
159
|
-
message: `🔴
|
|
160
|
-
next_step: "
|
|
158
|
+
title: "Recommend initiating arbitration",
|
|
159
|
+
message: `🔴 Order ${ctx.order_id} merchant has been unreachable for ${days} days; funds may be frozen. Recommend initiating arbitration immediately.`,
|
|
160
|
+
next_step: "Switch to the arbitration_support phase and submit an arbitration application",
|
|
161
161
|
tool: "mark_arbitration",
|
|
162
162
|
});
|
|
163
163
|
}
|
|
@@ -166,9 +166,9 @@ export function handleMerchantUnreachable(ctx) {
|
|
|
166
166
|
id: "unreachable_no_arb",
|
|
167
167
|
phase: "merchant_unreachable",
|
|
168
168
|
priority: "required",
|
|
169
|
-
title: "
|
|
170
|
-
message: `🔴
|
|
171
|
-
next_step: "
|
|
169
|
+
title: "No arbitration channel; funds may be frozen; recommend contacting WoWok officials",
|
|
170
|
+
message: `🔴 Order ${ctx.order_id} merchant has been unreachable for ${days} days, and no arbitration channel is configured; funds may be frozen long-term. Recommend contacting WoWok officials for assistance.`,
|
|
171
|
+
next_step: "Contact WoWok official support and provide the order and communication records",
|
|
172
172
|
});
|
|
173
173
|
}
|
|
174
174
|
return actions;
|
|
@@ -178,9 +178,9 @@ export function handleMerchantUnreachable(ctx) {
|
|
|
178
178
|
id: "unreachable_urge",
|
|
179
179
|
phase: "merchant_unreachable",
|
|
180
180
|
priority: "recommended",
|
|
181
|
-
title: "
|
|
182
|
-
message: `⚠️
|
|
183
|
-
next_step: "
|
|
181
|
+
title: "Persistent no response; send a follow-up message",
|
|
182
|
+
message: `⚠️ Order ${ctx.order_id} merchant has not replied for ${days} days; recommend sending a follow-up message via Messenger and keeping a record`,
|
|
183
|
+
next_step: "If there is still no reply within 3 days, initiate arbitration",
|
|
184
184
|
tool: "messenger_send",
|
|
185
185
|
});
|
|
186
186
|
return actions;
|
|
@@ -189,9 +189,9 @@ export function handleMerchantUnreachable(ctx) {
|
|
|
189
189
|
id: "unreachable_wait",
|
|
190
190
|
phase: "merchant_unreachable",
|
|
191
191
|
priority: "info",
|
|
192
|
-
title: "
|
|
193
|
-
message: `ℹ️
|
|
194
|
-
next_step: "
|
|
192
|
+
title: "Merchant may be busy; await reply",
|
|
193
|
+
message: `ℹ️ Order ${ctx.order_id} merchant ${days === Infinity ? "has not replied yet" : `has not replied for ${days} day(s)`}; may be busy. Recommend waiting another 1-2 days`,
|
|
194
|
+
next_step: "If there is still no reply after 3 days, send a follow-up message",
|
|
195
195
|
});
|
|
196
196
|
return actions;
|
|
197
197
|
}
|
|
@@ -205,9 +205,9 @@ export function arbitrationSupport(ctx) {
|
|
|
205
205
|
id: "arb_not_initiated",
|
|
206
206
|
phase: "arbitration_support",
|
|
207
207
|
priority: "required",
|
|
208
|
-
title: "
|
|
209
|
-
message: `🔔
|
|
210
|
-
next_step: "
|
|
208
|
+
title: "Recommend initiating an arbitration application",
|
|
209
|
+
message: `🔔 Order ${ctx.order_id} has not initiated arbitration. Recommend generating an arbitration application template and submitting it immediately.`,
|
|
210
|
+
next_step: "Call generateArbitrationTemplate to generate the application template",
|
|
211
211
|
tool: "mark_arbitration",
|
|
212
212
|
});
|
|
213
213
|
if (arbWindowDays > 0 && arbWindowDays <= 7) {
|
|
@@ -215,9 +215,9 @@ export function arbitrationSupport(ctx) {
|
|
|
215
215
|
id: "arb_window_closing_soon",
|
|
216
216
|
phase: "arbitration_support",
|
|
217
217
|
priority: "required",
|
|
218
|
-
title:
|
|
219
|
-
message: `⏰
|
|
220
|
-
next_step: "
|
|
218
|
+
title: `Arbitration window will close in ${arbWindowDays} day(s)`,
|
|
219
|
+
message: `⏰ Order ${ctx.order_id} arbitration application window has only ${arbWindowDays} day(s) left; please submit the arbitration application as soon as possible`,
|
|
220
|
+
next_step: "Submit the arbitration application immediately",
|
|
221
221
|
deadline: ctx.now + arbWindowDays * 24 * 60 * 60 * 1000,
|
|
222
222
|
});
|
|
223
223
|
}
|
|
@@ -228,9 +228,9 @@ export function arbitrationSupport(ctx) {
|
|
|
228
228
|
id: "arb_window_urgent",
|
|
229
229
|
phase: "arbitration_support",
|
|
230
230
|
priority: "required",
|
|
231
|
-
title: "
|
|
232
|
-
message: `⏰
|
|
233
|
-
next_step: "
|
|
231
|
+
title: "Arbitration window about to close",
|
|
232
|
+
message: `⏰ Order ${ctx.order_id} arbitration window has only ${arbWindowDays} day(s) left; please supplement evidence and follow up on voting progress as soon as possible`,
|
|
233
|
+
next_step: "Immediately supplement evidence and query arbitration progress",
|
|
234
234
|
tool: "query_toolkit",
|
|
235
235
|
deadline: ctx.now + arbWindowDays * 24 * 60 * 60 * 1000,
|
|
236
236
|
});
|
|
@@ -240,12 +240,12 @@ export function arbitrationSupport(ctx) {
|
|
|
240
240
|
id: "arb_no_evidence",
|
|
241
241
|
phase: "arbitration_support",
|
|
242
242
|
priority: "required",
|
|
243
|
-
title: "
|
|
244
|
-
message: `📋
|
|
245
|
-
` • Messenger
|
|
246
|
-
` • WIP hash
|
|
247
|
-
` • Progress
|
|
248
|
-
next_step: "
|
|
243
|
+
title: "Supplement evidence",
|
|
244
|
+
message: `📋 Order ${ctx.order_id} arbitration has been initiated but no evidence is recorded. Recommend collecting immediately:\n` +
|
|
245
|
+
` • Messenger chat logs\n` +
|
|
246
|
+
` • WIP hash comparison records\n` +
|
|
247
|
+
` • Progress stall screenshots`,
|
|
248
|
+
next_step: "Generate an evidence file via messenger_mark_evidence and submit it",
|
|
249
249
|
tool: "messenger_mark_evidence",
|
|
250
250
|
});
|
|
251
251
|
}
|
|
@@ -254,10 +254,10 @@ export function arbitrationSupport(ctx) {
|
|
|
254
254
|
id: "arb_supplement_evidence",
|
|
255
255
|
phase: "arbitration_support",
|
|
256
256
|
priority: "recommended",
|
|
257
|
-
title:
|
|
258
|
-
message: `⚠️
|
|
259
|
-
`
|
|
260
|
-
next_step: "
|
|
257
|
+
title: `Supplement more evidence to strengthen the arbitration case (currently ${evidenceCount} item(s))`,
|
|
258
|
+
message: `⚠️ Order ${ctx.order_id} has submitted ${evidenceCount} item(s) of evidence; recommend supplementing to at least 3.\n` +
|
|
259
|
+
` Current evidence: ${ctx.evidence?.join(" / ") ?? "none"}`,
|
|
260
|
+
next_step: "Add third-party appraisals, chat logs, or deliverable screenshots",
|
|
261
261
|
tool: "messenger_mark_evidence",
|
|
262
262
|
});
|
|
263
263
|
}
|
|
@@ -266,9 +266,9 @@ export function arbitrationSupport(ctx) {
|
|
|
266
266
|
id: "arb_monitor_progress",
|
|
267
267
|
phase: "arbitration_support",
|
|
268
268
|
priority: "info",
|
|
269
|
-
title: "
|
|
270
|
-
message: `📊
|
|
271
|
-
next_step: "
|
|
269
|
+
title: "Arbitration in progress; continuously monitor voting progress",
|
|
270
|
+
message: `📊 Order ${ctx.order_id} arbitration has been initiated, with ${evidenceCount} item(s) of evidence complete. Recommend periodically querying voting progress and preparing supplemental evidence.`,
|
|
271
|
+
next_step: "Query arbitration voting status via query_toolkit",
|
|
272
272
|
tool: "query_toolkit",
|
|
273
273
|
});
|
|
274
274
|
}
|
|
@@ -277,44 +277,44 @@ export function arbitrationSupport(ctx) {
|
|
|
277
277
|
export function generateArbitrationTemplate(ctx) {
|
|
278
278
|
const phaseLabel = phaseToLabel(ctx.phase);
|
|
279
279
|
const evidenceCount = ctx.evidence?.length ?? 0;
|
|
280
|
-
const title =
|
|
280
|
+
const title = `Order ${ctx.order_id} Arbitration Application — ${phaseLabel}`;
|
|
281
281
|
const descriptionParts = [];
|
|
282
|
-
descriptionParts.push(
|
|
283
|
-
descriptionParts.push(`Service ID
|
|
284
|
-
descriptionParts.push(
|
|
282
|
+
descriptionParts.push(`Order ID: ${ctx.order_id}`);
|
|
283
|
+
descriptionParts.push(`Service ID: ${ctx.service_id}`);
|
|
284
|
+
descriptionParts.push(`Dispute type: ${phaseLabel}`);
|
|
285
285
|
switch (ctx.phase) {
|
|
286
286
|
case "refund_tracking":
|
|
287
|
-
descriptionParts.push(
|
|
287
|
+
descriptionParts.push(`Dispute summary: The merchant did not refund as required. Order amount ${ctx.order_amount ?? "unknown"} smallest units, refunded ${ctx.refunded_amount ?? 0n} smallest units.`);
|
|
288
288
|
break;
|
|
289
289
|
case "quality_issue":
|
|
290
|
-
descriptionParts.push(
|
|
290
|
+
descriptionParts.push(`Dispute summary: The deliverable has quality issues. Original WIP hash: ${ctx.original_wip_hash ?? "unknown"}, current: ${ctx.wip_hash ?? "unknown"}.`);
|
|
291
291
|
break;
|
|
292
292
|
case "merchant_unreachable":
|
|
293
|
-
descriptionParts.push(
|
|
293
|
+
descriptionParts.push(`Dispute summary: The merchant has been unreachable for a long time. Last reply time: ${ctx.last_merchant_reply_at ? new Date(ctx.last_merchant_reply_at).toISOString() : "unknown"}.`);
|
|
294
294
|
break;
|
|
295
295
|
case "arbitration_support":
|
|
296
|
-
descriptionParts.push("
|
|
296
|
+
descriptionParts.push("Dispute summary: See the phase records above.");
|
|
297
297
|
break;
|
|
298
298
|
}
|
|
299
|
-
descriptionParts.push(
|
|
299
|
+
descriptionParts.push(`Evidence collected: ${evidenceCount} item(s)`);
|
|
300
300
|
const description = descriptionParts.join("\n");
|
|
301
301
|
const evidence_required = [
|
|
302
|
-
"Messenger
|
|
303
|
-
"
|
|
304
|
-
"Progress
|
|
302
|
+
"Messenger communication logs (export WTS evidence file)",
|
|
303
|
+
"Order creation and payment proof",
|
|
304
|
+
"Progress node advancement records",
|
|
305
305
|
];
|
|
306
306
|
switch (ctx.phase) {
|
|
307
307
|
case "quality_issue":
|
|
308
|
-
evidence_required.push("WIP hash
|
|
309
|
-
evidence_required.push("
|
|
308
|
+
evidence_required.push("WIP hash comparison record (original vs current)");
|
|
309
|
+
evidence_required.push("Deliverable screenshots or samples");
|
|
310
310
|
break;
|
|
311
311
|
case "merchant_unreachable":
|
|
312
|
-
evidence_required.push("
|
|
313
|
-
evidence_required.push("
|
|
312
|
+
evidence_required.push("Unreachable duration record (based on last_merchant_reply_at)");
|
|
313
|
+
evidence_required.push("Follow-up message sending records");
|
|
314
314
|
break;
|
|
315
315
|
case "refund_tracking":
|
|
316
|
-
evidence_required.push("
|
|
317
|
-
evidence_required.push("
|
|
316
|
+
evidence_required.push("Refund application record");
|
|
317
|
+
evidence_required.push("Refund difference calculation proof");
|
|
318
318
|
break;
|
|
319
319
|
}
|
|
320
320
|
const claim = buildClaim(ctx);
|
|
@@ -322,10 +322,10 @@ export function generateArbitrationTemplate(ctx) {
|
|
|
322
322
|
}
|
|
323
323
|
function phaseToLabel(phase) {
|
|
324
324
|
switch (phase) {
|
|
325
|
-
case "refund_tracking": return "
|
|
326
|
-
case "quality_issue": return "
|
|
327
|
-
case "merchant_unreachable": return "
|
|
328
|
-
case "arbitration_support": return "
|
|
325
|
+
case "refund_tracking": return "Refund dispute";
|
|
326
|
+
case "quality_issue": return "Quality issue";
|
|
327
|
+
case "merchant_unreachable": return "Merchant unreachable";
|
|
328
|
+
case "arbitration_support": return "Arbitration support";
|
|
329
329
|
}
|
|
330
330
|
}
|
|
331
331
|
function buildClaim(ctx) {
|
|
@@ -335,16 +335,16 @@ function buildClaim(ctx) {
|
|
|
335
335
|
const refunded = ctx.refunded_amount ?? 0n;
|
|
336
336
|
const diff = orderAmount - refunded;
|
|
337
337
|
if (refunded === 0n) {
|
|
338
|
-
return
|
|
338
|
+
return `Request the arbitrator to order a full refund (${orderAmount} smallest units).`;
|
|
339
339
|
}
|
|
340
|
-
return
|
|
340
|
+
return `Request the arbitrator to order the merchant to make up the refund difference (${diff} smallest units).`;
|
|
341
341
|
}
|
|
342
342
|
case "quality_issue":
|
|
343
|
-
return "
|
|
343
|
+
return "Request the arbitrator to order the merchant to redeliver a deliverable that meets the agreement, or to fully refund.";
|
|
344
344
|
case "merchant_unreachable":
|
|
345
|
-
return "
|
|
345
|
+
return "Request the arbitrator to order the merchant to fulfill the order obligations or refund all payments, and to compensate for losses caused by being unreachable.";
|
|
346
346
|
case "arbitration_support":
|
|
347
|
-
return "
|
|
347
|
+
return "Request the arbitrator to support this party's claim, and based on the attached evidence, rule that the merchant breached the contract and order compensation.";
|
|
348
348
|
}
|
|
349
349
|
}
|
|
350
350
|
export { CUSTOMER_INTELLIGENCE_VERSION };
|
|
@@ -14,11 +14,11 @@ const REMINDER_RULES = [
|
|
|
14
14
|
priority: "recommended",
|
|
15
15
|
message: (ctx) => {
|
|
16
16
|
if (!ctx.avg_market_price || !ctx.service_price || ctx.avg_market_price === 0n) {
|
|
17
|
-
return "⚠️
|
|
17
|
+
return "⚠️ Price is abnormally low, beware of quality risk";
|
|
18
18
|
}
|
|
19
19
|
const ratio = Number(ctx.service_price * 100n / ctx.avg_market_price) / 100;
|
|
20
20
|
const below = Math.round((1 - ratio) * 100);
|
|
21
|
-
return `⚠️
|
|
21
|
+
return `⚠️ Price is ${below}% below the average for similar services, beware of quality risk`;
|
|
22
22
|
},
|
|
23
23
|
applies: (ctx) => {
|
|
24
24
|
if (!ctx.avg_market_price || !ctx.service_price)
|
|
@@ -34,7 +34,7 @@ const REMINDER_RULES = [
|
|
|
34
34
|
id: "browse_no_arbitration",
|
|
35
35
|
stage: "browse",
|
|
36
36
|
priority: "recommended",
|
|
37
|
-
message: "⚠️
|
|
37
|
+
message: "⚠️ This Service has no arbitration configured; disputes have no resolution channel",
|
|
38
38
|
applies: (ctx) => ctx.has_arbitration === false,
|
|
39
39
|
dedup_key: "no_arbitration",
|
|
40
40
|
},
|
|
@@ -42,7 +42,7 @@ const REMINDER_RULES = [
|
|
|
42
42
|
id: "browse_no_compensation",
|
|
43
43
|
stage: "browse",
|
|
44
44
|
priority: "recommended",
|
|
45
|
-
message: "⚠️
|
|
45
|
+
message: "⚠️ This Service has no compensation fund; no automatic payout source if the order fails",
|
|
46
46
|
applies: (ctx) => ctx.has_compensation === false,
|
|
47
47
|
dedup_key: "no_compensation",
|
|
48
48
|
},
|
|
@@ -66,7 +66,7 @@ const REMINDER_RULES = [
|
|
|
66
66
|
id: "evaluate_medium_high_risk",
|
|
67
67
|
stage: "evaluate",
|
|
68
68
|
priority: "recommended",
|
|
69
|
-
message: (ctx) => `🟠
|
|
69
|
+
message: (ctx) => `🟠 Composite risk score ${ctx.risk_score}/100, purchase with caution and focus on 2-3 key risks`,
|
|
70
70
|
applies: (ctx) => (ctx.risk_level ?? "low") === "medium_high",
|
|
71
71
|
dedup_key: "medium_high_risk",
|
|
72
72
|
},
|
|
@@ -74,7 +74,7 @@ const REMINDER_RULES = [
|
|
|
74
74
|
id: "evaluate_ambiguous_guard",
|
|
75
75
|
stage: "evaluate",
|
|
76
76
|
priority: "required",
|
|
77
|
-
message: (ctx) => `🔴
|
|
77
|
+
message: (ctx) => `🔴 Detected ${ctx.ambiguous_guards?.length ?? 0} ambiguous Guard(s); manual review is required before proceeding: ${ctx.ambiguous_guards?.join(", ") ?? ""}`,
|
|
78
78
|
applies: (ctx) => (ctx.ambiguous_guards?.length ?? 0) > 0,
|
|
79
79
|
dedup_key: "ambiguous_guard",
|
|
80
80
|
},
|
|
@@ -82,7 +82,7 @@ const REMINDER_RULES = [
|
|
|
82
82
|
id: "evaluate_no_refund_path",
|
|
83
83
|
stage: "evaluate",
|
|
84
84
|
priority: "recommended",
|
|
85
|
-
message: "⚠️
|
|
85
|
+
message: "⚠️ No refund path: if delivery fails, funds may be unrecoverable. Recommend negotiating refund terms via Messenger",
|
|
86
86
|
applies: (ctx) => ctx.has_refund_path === false,
|
|
87
87
|
dedup_key: "no_refund_path",
|
|
88
88
|
},
|
|
@@ -90,7 +90,7 @@ const REMINDER_RULES = [
|
|
|
90
90
|
id: "evaluate_no_user_operable",
|
|
91
91
|
stage: "evaluate",
|
|
92
92
|
priority: "required",
|
|
93
|
-
message: "🔴
|
|
93
|
+
message: "🔴 No user-operable steps in the workflow: order progress depends entirely on the merchant",
|
|
94
94
|
applies: (ctx) => ctx.has_user_operable === false,
|
|
95
95
|
dedup_key: "no_user_operable",
|
|
96
96
|
},
|
|
@@ -108,7 +108,7 @@ const REMINDER_RULES = [
|
|
|
108
108
|
id: "preorder_payment_confirm",
|
|
109
109
|
stage: "preorder",
|
|
110
110
|
priority: "required",
|
|
111
|
-
message: (ctx) => `🔔
|
|
111
|
+
message: (ctx) => `🔔 About to pay ${ctx.service_price} smallest units to the escrow account, please confirm`,
|
|
112
112
|
applies: (ctx) => ctx.service_price !== undefined,
|
|
113
113
|
dedup_key: "payment_confirm",
|
|
114
114
|
},
|
|
@@ -124,7 +124,7 @@ const REMINDER_RULES = [
|
|
|
124
124
|
id: "preorder_user_require_arb_missing",
|
|
125
125
|
stage: "preorder",
|
|
126
126
|
priority: "required",
|
|
127
|
-
message: "🔴
|
|
127
|
+
message: "🔴 Your preferences require arbitration, but this Service does not have it configured",
|
|
128
128
|
applies: (ctx) => ctx.user_require_arbitration === true && ctx.has_arbitration === false,
|
|
129
129
|
dedup_key: "user_require_arb_missing",
|
|
130
130
|
},
|
|
@@ -132,7 +132,7 @@ const REMINDER_RULES = [
|
|
|
132
132
|
id: "preorder_user_require_comp_missing",
|
|
133
133
|
stage: "preorder",
|
|
134
134
|
priority: "required",
|
|
135
|
-
message: "🔴
|
|
135
|
+
message: "🔴 Your preferences require a compensation fund, but this Service has none",
|
|
136
136
|
applies: (ctx) => ctx.user_require_compensation === true && ctx.has_compensation === false,
|
|
137
137
|
dedup_key: "user_require_comp_missing",
|
|
138
138
|
},
|
|
@@ -140,7 +140,7 @@ const REMINDER_RULES = [
|
|
|
140
140
|
id: "preorder_no_messenger",
|
|
141
141
|
stage: "preorder",
|
|
142
142
|
priority: "recommended",
|
|
143
|
-
message: "⚠️
|
|
143
|
+
message: "⚠️ Merchant has no Messenger channel; no way to negotiate or get post-sale support after ordering",
|
|
144
144
|
applies: (ctx) => ctx.has_messenger === false,
|
|
145
145
|
dedup_key: "no_messenger",
|
|
146
146
|
},
|
|
@@ -148,7 +148,7 @@ const REMINDER_RULES = [
|
|
|
148
148
|
id: "in_progress_progress_stalled",
|
|
149
149
|
stage: "in_progress",
|
|
150
150
|
priority: "recommended",
|
|
151
|
-
message: (ctx) => `⚠️
|
|
151
|
+
message: (ctx) => `⚠️ Order has been stuck at node ${ctx.current_node} for over ${ctx.hours_since_last_progress} hours, suggest contacting the merchant`,
|
|
152
152
|
applies: (ctx) => {
|
|
153
153
|
const stallHours = ctx.hours_since_last_progress ?? 0;
|
|
154
154
|
const expected = ctx.expected_progress_hours ?? 24;
|
|
@@ -160,7 +160,7 @@ const REMINDER_RULES = [
|
|
|
160
160
|
id: "in_progress_compensation_drop",
|
|
161
161
|
stage: "in_progress",
|
|
162
162
|
priority: "recommended",
|
|
163
|
-
message: "⚠️
|
|
163
|
+
message: "⚠️ Merchant compensation fund balance dropped 30%, please note",
|
|
164
164
|
applies: () => false,
|
|
165
165
|
dedup_key: "compensation_drop",
|
|
166
166
|
},
|
|
@@ -168,7 +168,7 @@ const REMINDER_RULES = [
|
|
|
168
168
|
id: "in_progress_user_action_required",
|
|
169
169
|
stage: "in_progress",
|
|
170
170
|
priority: "reminder",
|
|
171
|
-
message: (ctx) => `🔔
|
|
171
|
+
message: (ctx) => `🔔 Order advanced to node ${ctx.current_node}, your action is required`,
|
|
172
172
|
applies: (ctx) => ctx.current_node !== undefined && ctx.current_node !== "",
|
|
173
173
|
dedup_key: "user_action_required",
|
|
174
174
|
},
|
|
@@ -176,7 +176,7 @@ const REMINDER_RULES = [
|
|
|
176
176
|
id: "in_progress_messenger_unanswered",
|
|
177
177
|
stage: "in_progress",
|
|
178
178
|
priority: "recommended",
|
|
179
|
-
message: (ctx) => `⚠️
|
|
179
|
+
message: (ctx) => `⚠️ Merchant has not replied on Messenger for ${ctx.hours_since_messenger_reply} hours; consider initiating arbitration`,
|
|
180
180
|
applies: (ctx) => (ctx.hours_since_messenger_reply ?? 0) > 24,
|
|
181
181
|
dedup_key: "messenger_unanswered",
|
|
182
182
|
},
|
|
@@ -184,7 +184,7 @@ const REMINDER_RULES = [
|
|
|
184
184
|
id: "complete_review_reminder",
|
|
185
185
|
stage: "complete",
|
|
186
186
|
priority: "info",
|
|
187
|
-
message: "💡
|
|
187
|
+
message: "💡 Order completed, would you like to submit a review?",
|
|
188
188
|
applies: () => true,
|
|
189
189
|
dedup_key: "review_reminder",
|
|
190
190
|
},
|
|
@@ -192,7 +192,7 @@ const REMINDER_RULES = [
|
|
|
192
192
|
id: "complete_review_window",
|
|
193
193
|
stage: "complete",
|
|
194
194
|
priority: "reminder",
|
|
195
|
-
message: (ctx) => `⏰
|
|
195
|
+
message: (ctx) => `⏰ The review window will close in ${ctx.review_window_days} days`,
|
|
196
196
|
applies: (ctx) => (ctx.review_window_days ?? 0) > 0,
|
|
197
197
|
dedup_key: "review_window",
|
|
198
198
|
},
|
|
@@ -200,7 +200,7 @@ const REMINDER_RULES = [
|
|
|
200
200
|
id: "after_sale_arb_window",
|
|
201
201
|
stage: "after_sale",
|
|
202
202
|
priority: "reminder",
|
|
203
|
-
message: (ctx) => `⏰
|
|
203
|
+
message: (ctx) => `⏰ The arbitration application window will close in ${ctx.arb_window_days} day(s)`,
|
|
204
204
|
applies: (ctx) => (ctx.arb_window_days ?? 0) > 0,
|
|
205
205
|
dedup_key: "arb_window",
|
|
206
206
|
},
|
|
@@ -208,7 +208,7 @@ const REMINDER_RULES = [
|
|
|
208
208
|
id: "after_sale_refund_received",
|
|
209
209
|
stage: "after_sale",
|
|
210
210
|
priority: "info",
|
|
211
|
-
message: "✅
|
|
211
|
+
message: "✅ Refund received",
|
|
212
212
|
applies: () => false,
|
|
213
213
|
dedup_key: "refund_received",
|
|
214
214
|
},
|
|
@@ -273,21 +273,21 @@ export function getBlockingReminders(reminders) {
|
|
|
273
273
|
}
|
|
274
274
|
export function summarizeReminders(reminders) {
|
|
275
275
|
if (reminders.length === 0)
|
|
276
|
-
return "
|
|
276
|
+
return "No reminders";
|
|
277
277
|
const required = reminders.filter((r) => r.priority === "required");
|
|
278
278
|
const recommended = reminders.filter((r) => r.priority === "recommended");
|
|
279
279
|
const info = reminders.filter((r) => r.priority === "info");
|
|
280
280
|
const reminderOnly = reminders.filter((r) => r.priority === "reminder");
|
|
281
281
|
const parts = [];
|
|
282
282
|
if (required.length)
|
|
283
|
-
parts.push(`🔴
|
|
283
|
+
parts.push(`🔴 Must-read: ${required.length}`);
|
|
284
284
|
if (recommended.length)
|
|
285
|
-
parts.push(`⚠️
|
|
285
|
+
parts.push(`⚠️ Recommended: ${recommended.length}`);
|
|
286
286
|
if (info.length)
|
|
287
|
-
parts.push(`💡
|
|
287
|
+
parts.push(`💡 Info: ${info.length}`);
|
|
288
288
|
if (reminderOnly.length)
|
|
289
|
-
parts.push(`🔔
|
|
290
|
-
return parts.join("
|
|
289
|
+
parts.push(`🔔 Reminder: ${reminderOnly.length}`);
|
|
290
|
+
return parts.join(", ");
|
|
291
291
|
}
|
|
292
292
|
export function topReminders(reminders, n = 5) {
|
|
293
293
|
return sortAndCapReminders(reminders).slice(0, n);
|