@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
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { CUSTOMER_INTELLIGENCE_VERSION, RISK_LEVELS, RISK_DIMENSION_MAX, type PuzzleDepth, type ServiceBasics, type WorkflowAnalysis, type FundSafety, type TrustSignals, type MerchantBehavior, type MarketContext, type InfoPuzzle, type RiskDimensionName, type RiskCheck, type RiskDimensionScore, type RiskLevel, type RiskScore, type UserPreferences, type ReminderPriority, type Reminder, type GameScenario, type GameStrategy, type CustomerAdvice, } from "./types.js";
|
|
2
|
+
export { assembleServiceBasics, assembleWorkflowAnalysis, assembleFundSafety, assembleTrustSignals, assembleMerchantBehavior, assembleMarketContext, assembleInfoPuzzle, type ServiceRawData, type MachineNodeRaw, type ReviewRaw, type EventRaw, type PuzzleRawData, } from "./info-puzzle.js";
|
|
3
|
+
export { riskLevelFromScore, riskLevelLabel, riskLevelEmoji, assessRisk, passesRiskThreshold, } from "./risk-assessment.js";
|
|
4
|
+
export { getIndustryRiskChecks, getIndustryNeeds, checkIndustryNeeds, assessIndustryRisks, inferIndustry, type IndustryNeedTier, type IndustryNeed, type IndustryRiskCheck, type IndustryRiskResult, } from "./industry-risks.js";
|
|
5
|
+
export { getDefaultPreferences, getIndustryTemplate, inferPreferences, matchServiceToPreferences, mergePreferences, validatePreferences, SUPPORTED_INDUSTRIES, type Industry, type IndustryTemplate, type OrderHistoryEntry, type PreferenceInference, type ServiceForMatching, type PreferenceMatchResult, } from "./user-preferences.js";
|
|
6
|
+
export { monitorOrder, sortAlerts, getCriticalAlerts, getActionableAlerts, summarizeAlerts, isBlockingAlert, alertsToReminders, type AlertSeverity, type AlertCategory, type MonitorAlert, type OrderSnapshot, type OrderHistorySnapshot, type OrderMonitorContext, type MonitorThresholds, } from "./order-monitor.js";
|
|
7
|
+
export { recommendStrategy, detectScenarios, flowMigrationStrategy, repeatGameStrategy, rightsProtectionStrategy, type StrategyContext, type StrategyRecommendation, } from "./order-strategy.js";
|
|
8
|
+
export { generatePostPurchaseAdvice, trackRefund, handleQualityIssue, handleMerchantUnreachable, arbitrationSupport, generateArbitrationTemplate, type PostPurchasePhase, type PostPurchaseContext, type PostPurchaseAction, } from "./post-purchase.js";
|
|
9
|
+
export { generateReminders, sortAndCapReminders, generateMultiStageReminders, isBlocking, getBlockingReminders, summarizeReminders, topReminders, type ReminderStage, type ReminderContext, } from "./reminder-system.js";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { CUSTOMER_INTELLIGENCE_VERSION, RISK_LEVELS, RISK_DIMENSION_MAX, } from "./types.js";
|
|
2
|
+
export { assembleServiceBasics, assembleWorkflowAnalysis, assembleFundSafety, assembleTrustSignals, assembleMerchantBehavior, assembleMarketContext, assembleInfoPuzzle, } from "./info-puzzle.js";
|
|
3
|
+
export { riskLevelFromScore, riskLevelLabel, riskLevelEmoji, assessRisk, passesRiskThreshold, } from "./risk-assessment.js";
|
|
4
|
+
export { getIndustryRiskChecks, getIndustryNeeds, checkIndustryNeeds, assessIndustryRisks, inferIndustry, } from "./industry-risks.js";
|
|
5
|
+
export { getDefaultPreferences, getIndustryTemplate, inferPreferences, matchServiceToPreferences, mergePreferences, validatePreferences, SUPPORTED_INDUSTRIES, } from "./user-preferences.js";
|
|
6
|
+
export { monitorOrder, sortAlerts, getCriticalAlerts, getActionableAlerts, summarizeAlerts, isBlockingAlert, alertsToReminders, } from "./order-monitor.js";
|
|
7
|
+
export { recommendStrategy, detectScenarios, flowMigrationStrategy, repeatGameStrategy, rightsProtectionStrategy, } from "./order-strategy.js";
|
|
8
|
+
export { generatePostPurchaseAdvice, trackRefund, handleQualityIssue, handleMerchantUnreachable, arbitrationSupport, generateArbitrationTemplate, } from "./post-purchase.js";
|
|
9
|
+
export { generateReminders, sortAndCapReminders, generateMultiStageReminders, isBlocking, getBlockingReminders, summarizeReminders, topReminders, } from "./reminder-system.js";
|
|
@@ -25,6 +25,10 @@ export interface IndustryRiskResult {
|
|
|
25
25
|
score_adjustment: number;
|
|
26
26
|
summary: string;
|
|
27
27
|
}
|
|
28
|
+
export declare function _setRegistryLookup(fn: ((industry: string) => {
|
|
29
|
+
risk_checks?: IndustryRiskCheck[];
|
|
30
|
+
needs?: IndustryNeed[];
|
|
31
|
+
} | undefined) | null): void;
|
|
28
32
|
export declare function getIndustryRiskChecks(industry: Industry): IndustryRiskCheck[];
|
|
29
33
|
export declare function getIndustryNeeds(industry: Industry): IndustryNeed[];
|
|
30
34
|
export declare function checkIndustryNeeds(puzzle: InfoPuzzle, industry: Industry): {
|
|
@@ -22,14 +22,14 @@ const INDUSTRY_RISK_CHECKS = {
|
|
|
22
22
|
description: "WIP hash verified (work traceable)",
|
|
23
23
|
weight: 30,
|
|
24
24
|
passed: wipVerified,
|
|
25
|
-
advice: "⚠️ WIP
|
|
25
|
+
advice: "⚠️ WIP not verified: freelance deliverables cannot be traced. Recommend asking the merchant to provide a WIP hash and write it into WTS.",
|
|
26
26
|
},
|
|
27
27
|
{
|
|
28
28
|
id: "fr_milestone_nodes", industry: "freelance", dimension: "workflow",
|
|
29
|
-
description: "
|
|
29
|
+
description: "Has milestone nodes (phased acceptance)",
|
|
30
30
|
weight: 25,
|
|
31
31
|
passed: hasMilestoneNodes,
|
|
32
|
-
advice: "⚠️
|
|
32
|
+
advice: "⚠️ No milestone nodes: delivery is completed in one go without intermediate acceptance. Recommend asking the merchant to add phased delivery nodes.",
|
|
33
33
|
},
|
|
34
34
|
{
|
|
35
35
|
id: "fr_refund_path", industry: "freelance", dimension: "workflow",
|
|
@@ -49,17 +49,17 @@ const INDUSTRY_RISK_CHECKS = {
|
|
|
49
49
|
rental: [
|
|
50
50
|
{
|
|
51
51
|
id: "rt_compensation_full", industry: "rental", dimension: "fund",
|
|
52
|
-
description: "
|
|
52
|
+
description: "Compensation fully covers order amount",
|
|
53
53
|
weight: 30,
|
|
54
54
|
passed: compensationCoversOrder,
|
|
55
|
-
advice: "🔴
|
|
55
|
+
advice: "🔴 Compensation not fully covered: insufficient payout when rental item is damaged. Recommend choosing a merchant with sufficient compensation fund.",
|
|
56
56
|
},
|
|
57
57
|
{
|
|
58
58
|
id: "rt_lock_duration", industry: "rental", dimension: "fund",
|
|
59
|
-
description: "
|
|
59
|
+
description: "Lock duration safe (compensation cannot be withdrawn by merchant at any time)",
|
|
60
60
|
weight: 25,
|
|
61
61
|
passed: lockDurationSafe,
|
|
62
|
-
advice: "⚠️
|
|
62
|
+
advice: "⚠️ Lock duration not safe: merchant may withdraw compensation at any time, deposit safety not guaranteed.",
|
|
63
63
|
},
|
|
64
64
|
{
|
|
65
65
|
id: "rt_arbitration", industry: "rental", dimension: "workflow",
|
|
@@ -70,10 +70,10 @@ const INDUSTRY_RISK_CHECKS = {
|
|
|
70
70
|
},
|
|
71
71
|
{
|
|
72
72
|
id: "rt_user_operable", industry: "rental", dimension: "workflow",
|
|
73
|
-
description: "
|
|
73
|
+
description: "Has user-operable path (return/confirm)",
|
|
74
74
|
weight: 20,
|
|
75
75
|
passed: (p) => userOperableForwards(p) > 0,
|
|
76
|
-
advice: "🔴
|
|
76
|
+
advice: "🔴 No user-operable path: return process relies entirely on merchant, may be maliciously delayed.",
|
|
77
77
|
},
|
|
78
78
|
],
|
|
79
79
|
education: [
|
|
@@ -176,17 +176,17 @@ const INDUSTRY_RISK_CHECKS = {
|
|
|
176
176
|
},
|
|
177
177
|
{
|
|
178
178
|
id: "ret_compensation_full", industry: "retail", dimension: "fund",
|
|
179
|
-
description: "
|
|
179
|
+
description: "Compensation fully covers",
|
|
180
180
|
weight: 25,
|
|
181
181
|
passed: compensationCoversOrder,
|
|
182
|
-
advice: "⚠️
|
|
182
|
+
advice: "⚠️ Compensation not fully covered: insufficient payout for return/exchange disputes.",
|
|
183
183
|
},
|
|
184
184
|
{
|
|
185
185
|
id: "ret_refund_path", industry: "retail", dimension: "workflow",
|
|
186
|
-
description: "
|
|
186
|
+
description: "Has refund path (return/exchange)",
|
|
187
187
|
weight: 25,
|
|
188
188
|
passed: hasRefundPath,
|
|
189
|
-
advice: "🔴
|
|
189
|
+
advice: "🔴 No refund path: return/exchange not guaranteed.",
|
|
190
190
|
},
|
|
191
191
|
{
|
|
192
192
|
id: "ret_arbitration", industry: "retail", dimension: "workflow",
|
|
@@ -201,15 +201,15 @@ function commonNeeds() {
|
|
|
201
201
|
return [
|
|
202
202
|
{
|
|
203
203
|
id: "need_arbitration", tier: "common",
|
|
204
|
-
description: "
|
|
204
|
+
description: "Arbitration configured (dispute resolution channel)",
|
|
205
205
|
satisfied: hasArbitrationPath,
|
|
206
|
-
advice: "
|
|
206
|
+
advice: "Arbitration not configured: no third-party resolution channel for disputes.",
|
|
207
207
|
},
|
|
208
208
|
{
|
|
209
209
|
id: "need_refund_path", tier: "common",
|
|
210
210
|
description: "Has refund path",
|
|
211
211
|
satisfied: hasRefundPath,
|
|
212
|
-
advice: "
|
|
212
|
+
advice: "No refund path: funds hard to recover when delivery fails.",
|
|
213
213
|
},
|
|
214
214
|
{
|
|
215
215
|
id: "need_user_operable", tier: "common",
|
|
@@ -221,7 +221,7 @@ function commonNeeds() {
|
|
|
221
221
|
id: "need_messenger", tier: "common",
|
|
222
222
|
description: "Messenger configured",
|
|
223
223
|
satisfied: hasMessenger,
|
|
224
|
-
advice: "
|
|
224
|
+
advice: "Merchant has no Messenger channel, cannot negotiate or conduct after-sales communication.",
|
|
225
225
|
},
|
|
226
226
|
];
|
|
227
227
|
}
|
|
@@ -230,9 +230,9 @@ const INDUSTRY_NEEDS = {
|
|
|
230
230
|
...commonNeeds(),
|
|
231
231
|
{
|
|
232
232
|
id: "need_wip_verified", tier: "personalized",
|
|
233
|
-
description: "WIP
|
|
233
|
+
description: "WIP verified (work IP traceable)",
|
|
234
234
|
satisfied: wipVerified,
|
|
235
|
-
advice: "WIP
|
|
235
|
+
advice: "WIP not verified: IP ownership and originality of work cannot be traced.",
|
|
236
236
|
},
|
|
237
237
|
{
|
|
238
238
|
id: "need_milestone_nodes", tier: "personalized",
|
|
@@ -242,9 +242,9 @@ const INDUSTRY_NEEDS = {
|
|
|
242
242
|
},
|
|
243
243
|
{
|
|
244
244
|
id: "need_merchant_history", tier: "advanced",
|
|
245
|
-
description: "
|
|
245
|
+
description: "Merchant history ≥3 orders (fulfillment experience)",
|
|
246
246
|
satisfied: (p) => merchantTotalOrders(p) >= 3,
|
|
247
|
-
advice: "
|
|
247
|
+
advice: "Merchant history orders less than 3: fulfillment experience is limited.",
|
|
248
248
|
},
|
|
249
249
|
],
|
|
250
250
|
rental: [
|
|
@@ -278,15 +278,15 @@ const INDUSTRY_NEEDS = {
|
|
|
278
278
|
},
|
|
279
279
|
{
|
|
280
280
|
id: "need_long_cycle_ok", tier: "personalized",
|
|
281
|
-
description: "
|
|
281
|
+
description: "Long cycle acceptable",
|
|
282
282
|
satisfied: () => true,
|
|
283
|
-
advice: "
|
|
283
|
+
advice: "Long cycles are normal in education; recommend tracking lesson consumption and attendance.",
|
|
284
284
|
},
|
|
285
285
|
{
|
|
286
286
|
id: "need_high_reputation", tier: "advanced",
|
|
287
|
-
description: "
|
|
287
|
+
description: "High reputation score (trust_score ≥70)",
|
|
288
288
|
satisfied: (p) => trustScore(p) >= 70,
|
|
289
|
-
advice: "
|
|
289
|
+
advice: "Merchant reputation score below 70: course reputation may be poor.",
|
|
290
290
|
},
|
|
291
291
|
],
|
|
292
292
|
travel: [
|
|
@@ -299,9 +299,9 @@ const INDUSTRY_NEEDS = {
|
|
|
299
299
|
},
|
|
300
300
|
{
|
|
301
301
|
id: "need_compensation_full", tier: "personalized",
|
|
302
|
-
description: "
|
|
302
|
+
description: "Compensation fully covers (breach compensation)",
|
|
303
303
|
satisfied: compensationCoversOrder,
|
|
304
|
-
advice: "
|
|
304
|
+
advice: "Compensation not fully covered: insufficient payout for itinerary breach.",
|
|
305
305
|
},
|
|
306
306
|
{
|
|
307
307
|
id: "need_high_reputation", tier: "advanced",
|
|
@@ -314,9 +314,9 @@ const INDUSTRY_NEEDS = {
|
|
|
314
314
|
...commonNeeds(),
|
|
315
315
|
{
|
|
316
316
|
id: "need_no_lockin", tier: "personalized",
|
|
317
|
-
description: "
|
|
317
|
+
description: "No long-term lock-in (no dead-end nodes)",
|
|
318
318
|
satisfied: (p) => deadEndCount(p) === 0,
|
|
319
|
-
advice: "
|
|
319
|
+
advice: "Dead-end nodes exist: subscription may be locked, auto-renewal trap exists.",
|
|
320
320
|
},
|
|
321
321
|
{
|
|
322
322
|
id: "need_low_dispute", tier: "personalized",
|
|
@@ -341,9 +341,9 @@ const INDUSTRY_NEEDS = {
|
|
|
341
341
|
},
|
|
342
342
|
{
|
|
343
343
|
id: "need_compensation_full", tier: "personalized",
|
|
344
|
-
description: "
|
|
344
|
+
description: "Compensation fully covers",
|
|
345
345
|
satisfied: compensationCoversOrder,
|
|
346
|
-
advice: "
|
|
346
|
+
advice: "Compensation not fully covered: insufficient payout for return/exchange disputes.",
|
|
347
347
|
},
|
|
348
348
|
{
|
|
349
349
|
id: "need_high_reputation", tier: "advanced",
|
|
@@ -353,10 +353,24 @@ const INDUSTRY_NEEDS = {
|
|
|
353
353
|
},
|
|
354
354
|
],
|
|
355
355
|
};
|
|
356
|
+
let _registryLookup = null;
|
|
357
|
+
export function _setRegistryLookup(fn) {
|
|
358
|
+
_registryLookup = fn;
|
|
359
|
+
}
|
|
356
360
|
export function getIndustryRiskChecks(industry) {
|
|
361
|
+
if (_registryLookup) {
|
|
362
|
+
const profile = _registryLookup(industry);
|
|
363
|
+
if (profile?.risk_checks)
|
|
364
|
+
return profile.risk_checks;
|
|
365
|
+
}
|
|
357
366
|
return INDUSTRY_RISK_CHECKS[industry];
|
|
358
367
|
}
|
|
359
368
|
export function getIndustryNeeds(industry) {
|
|
369
|
+
if (_registryLookup) {
|
|
370
|
+
const profile = _registryLookup(industry);
|
|
371
|
+
if (profile?.needs)
|
|
372
|
+
return profile.needs;
|
|
373
|
+
}
|
|
360
374
|
return INDUSTRY_NEEDS[industry];
|
|
361
375
|
}
|
|
362
376
|
export function checkIndustryNeeds(puzzle, industry) {
|
|
@@ -20,8 +20,8 @@ export function monitorOrder(ctx) {
|
|
|
20
20
|
id: "refund_received",
|
|
21
21
|
category: "refund_received",
|
|
22
22
|
severity: "info",
|
|
23
|
-
title: "
|
|
24
|
-
message:
|
|
23
|
+
title: "Refund received",
|
|
24
|
+
message: `Order ${cur.order_id} refund has been received`,
|
|
25
25
|
timestamp: cur.now,
|
|
26
26
|
order_id: cur.order_id,
|
|
27
27
|
service_id: cur.service_id,
|
|
@@ -36,9 +36,9 @@ export function monitorOrder(ctx) {
|
|
|
36
36
|
id: "user_action_required",
|
|
37
37
|
category: "user_action_required",
|
|
38
38
|
severity: "info",
|
|
39
|
-
title: "
|
|
40
|
-
message:
|
|
41
|
-
action: "
|
|
39
|
+
title: "Waiting for user action",
|
|
40
|
+
message: `Order ${cur.order_id} advanced to node ${cur.current_node ?? "unknown"}; your action is required to continue`,
|
|
41
|
+
action: "View the Machine node requirements and submit the corresponding Guard submission",
|
|
42
42
|
timestamp: cur.now,
|
|
43
43
|
order_id: cur.order_id,
|
|
44
44
|
service_id: cur.service_id,
|
|
@@ -62,20 +62,20 @@ function detectProgressStall(cur, prev, t) {
|
|
|
62
62
|
id: "progress_stall",
|
|
63
63
|
category: "progress_stall",
|
|
64
64
|
severity,
|
|
65
|
-
title: severity === "critical" ? "
|
|
66
|
-
message:
|
|
65
|
+
title: severity === "critical" ? "Order severely stalled" : "Order progress stalled",
|
|
66
|
+
message: `Order has been stuck at node ${cur.current_node} for over ${Math.round(stallHours)} hours (expected ${expected} hours)`,
|
|
67
67
|
action: severity === "critical"
|
|
68
|
-
? "
|
|
69
|
-
: "
|
|
68
|
+
? "Recommend contacting the merchant immediately via Messenger; if the merchant remains unresponsive, consider initiating arbitration"
|
|
69
|
+
: "Recommend contacting the merchant via Messenger to ask about progress",
|
|
70
70
|
timestamp: cur.now,
|
|
71
71
|
order_id: cur.order_id,
|
|
72
72
|
service_id: cur.service_id,
|
|
73
73
|
node: cur.current_node,
|
|
74
74
|
metric: {
|
|
75
|
-
label: "
|
|
75
|
+
label: "Stall duration",
|
|
76
76
|
value: Math.round(stallHours),
|
|
77
77
|
threshold: Math.round(threshold),
|
|
78
|
-
unit: "
|
|
78
|
+
unit: "hours",
|
|
79
79
|
},
|
|
80
80
|
});
|
|
81
81
|
}
|
|
@@ -87,18 +87,18 @@ function detectProgressStall(cur, prev, t) {
|
|
|
87
87
|
id: "node_unchanged",
|
|
88
88
|
category: "progress_stall",
|
|
89
89
|
severity: "warning",
|
|
90
|
-
title: "
|
|
91
|
-
message:
|
|
92
|
-
action: "
|
|
90
|
+
title: "Node unchanged",
|
|
91
|
+
message: `Since the last check (${Math.round(sincePrevHours)} hours), the order is still at ${cur.current_node}`,
|
|
92
|
+
action: "Confirm whether this is expected; if not, contact the merchant",
|
|
93
93
|
timestamp: cur.now,
|
|
94
94
|
order_id: cur.order_id,
|
|
95
95
|
service_id: cur.service_id,
|
|
96
96
|
node: cur.current_node,
|
|
97
97
|
metric: {
|
|
98
|
-
label: "
|
|
98
|
+
label: "Node stay duration",
|
|
99
99
|
value: Math.round(sincePrevHours),
|
|
100
100
|
threshold: Math.round(expected),
|
|
101
|
-
unit: "
|
|
101
|
+
unit: "hours",
|
|
102
102
|
},
|
|
103
103
|
});
|
|
104
104
|
}
|
|
@@ -117,14 +117,14 @@ function detectCompensationChange(cur, prev, t) {
|
|
|
117
117
|
id: "compensation_insufficient",
|
|
118
118
|
category: "compensation_insufficient",
|
|
119
119
|
severity,
|
|
120
|
-
title: "
|
|
121
|
-
message:
|
|
122
|
-
action: "
|
|
120
|
+
title: "Compensation fund coverage insufficient",
|
|
121
|
+
message: `Merchant compensation fund covers only ${Math.round(ratio * 100)}% of the order amount (required ${Math.round(t.compensation_coverage_min * 100)}%)`,
|
|
122
|
+
action: "Require the merchant to top up the compensation fund before ordering, or negotiate higher coverage via Messenger",
|
|
123
123
|
timestamp: cur.now,
|
|
124
124
|
order_id: cur.order_id,
|
|
125
125
|
service_id: cur.service_id,
|
|
126
126
|
metric: {
|
|
127
|
-
label: "
|
|
127
|
+
label: "Compensation coverage",
|
|
128
128
|
value: Math.round(ratio * 100),
|
|
129
129
|
threshold: Math.round(t.compensation_coverage_min * 100),
|
|
130
130
|
unit: "%",
|
|
@@ -142,14 +142,14 @@ function detectCompensationChange(cur, prev, t) {
|
|
|
142
142
|
id: "compensation_drop",
|
|
143
143
|
category: "compensation_drop",
|
|
144
144
|
severity,
|
|
145
|
-
title: "
|
|
146
|
-
message:
|
|
147
|
-
action: "
|
|
145
|
+
title: "Compensation fund balance dropped significantly",
|
|
146
|
+
message: `Merchant compensation fund dropped from ${prevBal} to ${cur.compensation_balance} (down ${Math.round(dropRatio * 100)}%)`,
|
|
147
|
+
action: "Immediately ask the merchant for the reason; if it keeps dropping, the merchant may be processing payouts for other orders, which is a risk",
|
|
148
148
|
timestamp: cur.now,
|
|
149
149
|
order_id: cur.order_id,
|
|
150
150
|
service_id: cur.service_id,
|
|
151
151
|
metric: {
|
|
152
|
-
label: "
|
|
152
|
+
label: "Compensation drop ratio",
|
|
153
153
|
value: Math.round(dropRatio * 100),
|
|
154
154
|
threshold: Math.round(t.compensation_drop_ratio * 100),
|
|
155
155
|
unit: "%",
|
|
@@ -167,9 +167,9 @@ function detectMessengerTimeout(cur, t) {
|
|
|
167
167
|
id: "no_messenger_channel",
|
|
168
168
|
category: "messenger_timeout",
|
|
169
169
|
severity: "info",
|
|
170
|
-
title: "
|
|
171
|
-
message: "
|
|
172
|
-
action: "
|
|
170
|
+
title: "Merchant has no Messenger channel",
|
|
171
|
+
message: "Merchant has not configured Messenger; no way to negotiate online or get post-sale support",
|
|
172
|
+
action: "Confirm other contact methods before ordering; recommend requiring the merchant to configure Messenger",
|
|
173
173
|
timestamp: cur.now,
|
|
174
174
|
order_id: cur.order_id,
|
|
175
175
|
service_id: cur.service_id,
|
|
@@ -185,19 +185,19 @@ function detectMessengerTimeout(cur, t) {
|
|
|
185
185
|
id: "messenger_unanswered",
|
|
186
186
|
category: "messenger_timeout",
|
|
187
187
|
severity,
|
|
188
|
-
title: "
|
|
189
|
-
message:
|
|
188
|
+
title: "Merchant Messenger no reply",
|
|
189
|
+
message: `Merchant has not replied to your Messenger message for ${Math.round(unansweredHours)} hours`,
|
|
190
190
|
action: cur.has_arbitration
|
|
191
|
-
? "
|
|
192
|
-
: "
|
|
191
|
+
? "Consider initiating an arbitration application (arbitration window is limited)"
|
|
192
|
+
: "Merchant has no arbitration configured; recommend urging via other contact methods; if there is no response, funds may be frozen",
|
|
193
193
|
timestamp: cur.now,
|
|
194
194
|
order_id: cur.order_id,
|
|
195
195
|
service_id: cur.service_id,
|
|
196
196
|
metric: {
|
|
197
|
-
label: "
|
|
197
|
+
label: "No-reply duration",
|
|
198
198
|
value: Math.round(unansweredHours),
|
|
199
199
|
threshold: Math.round(t.messenger_timeout_hours),
|
|
200
|
-
unit: "
|
|
200
|
+
unit: "hours",
|
|
201
201
|
},
|
|
202
202
|
});
|
|
203
203
|
}
|
|
@@ -211,17 +211,17 @@ function detectMessengerTimeout(cur, t) {
|
|
|
211
211
|
id: "messenger_re_unanswered",
|
|
212
212
|
category: "messenger_timeout",
|
|
213
213
|
severity: "warning",
|
|
214
|
-
title: "
|
|
215
|
-
message:
|
|
216
|
-
action: "
|
|
214
|
+
title: "Merchant did not reply again",
|
|
215
|
+
message: `The merchant has not replied to your message from ${Math.round(unansweredHours)} hours ago`,
|
|
216
|
+
action: "Send a follow-up message; if the merchant remains unresponsive, consider arbitration",
|
|
217
217
|
timestamp: cur.now,
|
|
218
218
|
order_id: cur.order_id,
|
|
219
219
|
service_id: cur.service_id,
|
|
220
220
|
metric: {
|
|
221
|
-
label: "
|
|
221
|
+
label: "Re-no-reply duration",
|
|
222
222
|
value: Math.round(unansweredHours),
|
|
223
223
|
threshold: Math.round(t.messenger_timeout_hours),
|
|
224
|
-
unit: "
|
|
224
|
+
unit: "hours",
|
|
225
225
|
},
|
|
226
226
|
});
|
|
227
227
|
}
|
|
@@ -236,17 +236,17 @@ function detectPostCompletionAlerts(cur, t) {
|
|
|
236
236
|
id: "review_window_closing",
|
|
237
237
|
category: "review_window",
|
|
238
238
|
severity: "info",
|
|
239
|
-
title: "
|
|
240
|
-
message:
|
|
241
|
-
action: "
|
|
239
|
+
title: "Review window about to close",
|
|
240
|
+
message: `The review window will close in ${cur.review_window_days} day(s)`,
|
|
241
|
+
action: "Submit a review as soon as possible (evidence can be submitted together if available)",
|
|
242
242
|
timestamp: cur.now,
|
|
243
243
|
order_id: cur.order_id,
|
|
244
244
|
service_id: cur.service_id,
|
|
245
245
|
metric: {
|
|
246
|
-
label: "
|
|
246
|
+
label: "Remaining days",
|
|
247
247
|
value: cur.review_window_days,
|
|
248
248
|
threshold: t.review_window_closing_days,
|
|
249
|
-
unit: "
|
|
249
|
+
unit: "days",
|
|
250
250
|
},
|
|
251
251
|
});
|
|
252
252
|
}
|
|
@@ -255,9 +255,9 @@ function detectPostCompletionAlerts(cur, t) {
|
|
|
255
255
|
id: "review_reminder",
|
|
256
256
|
category: "review_window",
|
|
257
257
|
severity: "info",
|
|
258
|
-
title: "
|
|
259
|
-
message:
|
|
260
|
-
action: "
|
|
258
|
+
title: "Order completed",
|
|
259
|
+
message: `Order completed; review window has ${cur.review_window_days} day(s) remaining`,
|
|
260
|
+
action: "Submit a review to help other users decide",
|
|
261
261
|
timestamp: cur.now,
|
|
262
262
|
order_id: cur.order_id,
|
|
263
263
|
service_id: cur.service_id,
|
|
@@ -270,17 +270,17 @@ function detectPostCompletionAlerts(cur, t) {
|
|
|
270
270
|
id: "arb_window_closing",
|
|
271
271
|
category: "arb_window",
|
|
272
272
|
severity: "warning",
|
|
273
|
-
title: "
|
|
274
|
-
message:
|
|
275
|
-
action: "
|
|
273
|
+
title: "Arbitration application window about to close",
|
|
274
|
+
message: `The arbitration application window will close in ${cur.arb_window_days} day(s)`,
|
|
275
|
+
action: "If there are unresolved disputes, initiate an arbitration application immediately",
|
|
276
276
|
timestamp: cur.now,
|
|
277
277
|
order_id: cur.order_id,
|
|
278
278
|
service_id: cur.service_id,
|
|
279
279
|
metric: {
|
|
280
|
-
label: "
|
|
280
|
+
label: "Remaining days",
|
|
281
281
|
value: cur.arb_window_days,
|
|
282
282
|
threshold: t.arb_window_closing_days,
|
|
283
|
-
unit: "
|
|
283
|
+
unit: "days",
|
|
284
284
|
},
|
|
285
285
|
});
|
|
286
286
|
}
|
|
@@ -299,18 +299,18 @@ export function getActionableAlerts(alerts) {
|
|
|
299
299
|
}
|
|
300
300
|
export function summarizeAlerts(alerts) {
|
|
301
301
|
if (alerts.length === 0)
|
|
302
|
-
return "✅
|
|
302
|
+
return "✅ No alerts; order status is normal";
|
|
303
303
|
const critical = alerts.filter((a) => a.severity === "critical");
|
|
304
304
|
const warning = alerts.filter((a) => a.severity === "warning");
|
|
305
305
|
const info = alerts.filter((a) => a.severity === "info");
|
|
306
306
|
const parts = [];
|
|
307
307
|
if (critical.length > 0)
|
|
308
|
-
parts.push(`🔴 ${critical.length}
|
|
308
|
+
parts.push(`🔴 ${critical.length} critical alert(s)`);
|
|
309
309
|
if (warning.length > 0)
|
|
310
|
-
parts.push(`🟠 ${warning.length}
|
|
310
|
+
parts.push(`🟠 ${warning.length} warning(s)`);
|
|
311
311
|
if (info.length > 0)
|
|
312
|
-
parts.push(`ℹ️ ${info.length}
|
|
313
|
-
return parts.join("
|
|
312
|
+
parts.push(`ℹ️ ${info.length} info`);
|
|
313
|
+
return parts.join(", ");
|
|
314
314
|
}
|
|
315
315
|
export function isBlockingAlert(alert) {
|
|
316
316
|
return alert.severity === "critical";
|
|
@@ -321,7 +321,7 @@ export function alertsToReminders(alerts) {
|
|
|
321
321
|
priority: a.severity === "critical" ? "required"
|
|
322
322
|
: a.severity === "warning" ? "recommended"
|
|
323
323
|
: "info",
|
|
324
|
-
message: `${a.title}
|
|
324
|
+
message: `${a.title}: ${a.message}`,
|
|
325
325
|
}));
|
|
326
326
|
}
|
|
327
327
|
export { CUSTOMER_INTELLIGENCE_VERSION };
|