@wowok/agent-mcp 2.3.18 → 2.4.3
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/index.d.ts +2 -2
- package/dist/index.js +11 -1624
- 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 +145 -104
- package/dist/knowledge/guard-lint.d.ts +77 -0
- package/dist/knowledge/guard-lint.js +670 -0
- package/dist/knowledge/guard-migration.d.ts +48 -0
- package/dist/knowledge/guard-migration.js +228 -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 +10 -1
- package/dist/knowledge/guard-risk.js +1634 -292
- package/dist/knowledge/guard-templates.d.ts +38 -0
- package/dist/knowledge/guard-templates.js +605 -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/project/graph.d.ts +1 -0
- package/dist/project/graph.js +27 -1
- package/dist/project/index.d.ts +1 -0
- package/dist/project/index.js +39 -2
- package/dist/project/namespace.d.ts +11 -1
- package/dist/project/namespace.js +27 -2
- package/dist/project/query.d.ts +2 -0
- package/dist/project/query.js +56 -15
- package/dist/rules.d.ts +12 -0
- package/dist/rules.js +9 -0
- package/dist/schema/call/allocation.d.ts +10 -10
- package/dist/schema/call/base.js +19 -19
- 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/machine.d.ts +38 -38
- package/dist/schema/call/permission.d.ts +78 -78
- package/dist/schema/call/repository.d.ts +22 -22
- package/dist/schema/call/semantic.js +229 -25
- package/dist/schema/call/service.d.ts +7 -7
- 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 +270 -192
- package/dist/schema/query/index.d.ts +184 -184
- package/dist/schema/query/index.js +15 -9
- package/dist/schema/trust/index.d.ts +4 -4
- package/dist/schema/utils/guard-parser.js +4 -4
- package/dist/schema/utils/guard-query-utils.d.ts +7 -0
- package/dist/schema/utils/guard-query-utils.js +14 -1
- package/dist/schema/utils/node-parser.js +14 -14
- package/dist/schemas/bridge_operation.output.json +15 -15
- package/dist/schemas/index.json +1 -1
- package/dist/schemas/messenger_operation.output.json +18 -16
- package/dist/schemas/onchain_events.output.json +15 -15
- package/dist/schemas/onchain_operations.output.json +16 -16
- package/dist/schemas/onchain_operations.schema.json +11 -20
- package/dist/schemas/onchain_operations_allocation.schema.json +7 -10
- package/dist/schemas/onchain_operations_machine.schema.json +2 -5
- package/dist/schemas/onchain_operations_service.schema.json +2 -5
- package/dist/schemas/onchain_table_data.output.json +20 -26
- package/dist/schemas/wip_file.output.json +24 -1
- package/dist/tools/handlers/bridge.d.ts +1 -0
- package/dist/tools/handlers/bridge.js +1 -0
- package/dist/tools/handlers/config.d.ts +2 -0
- package/dist/tools/handlers/config.js +71 -0
- package/dist/tools/handlers/file-export.d.ts +3 -0
- package/dist/tools/handlers/file-export.js +90 -0
- package/dist/tools/handlers/local.d.ts +30 -0
- package/dist/tools/handlers/local.js +27 -0
- package/dist/tools/handlers/messenger.d.ts +16 -0
- package/dist/tools/handlers/messenger.js +187 -0
- package/dist/tools/handlers/onchain.d.ts +2 -0
- package/dist/tools/handlers/onchain.js +246 -0
- package/dist/tools/handlers/project.d.ts +2 -0
- package/dist/tools/handlers/project.js +53 -0
- package/dist/tools/handlers/query.d.ts +5 -0
- package/dist/tools/handlers/query.js +256 -0
- package/dist/tools/handlers/schema-query.d.ts +2 -0
- package/dist/tools/handlers/schema-query.js +92 -0
- package/dist/tools/handlers/trust.d.ts +2 -0
- package/dist/tools/handlers/trust.js +194 -0
- package/dist/tools/handlers/wip.d.ts +2 -0
- package/dist/tools/handlers/wip.js +44 -0
- package/dist/tools/index.d.ts +13 -0
- package/dist/tools/index.js +479 -0
- package/dist/tools/rules-hook.d.ts +2 -0
- package/dist/tools/rules-hook.js +22 -0
- package/dist/tools/shared.d.ts +29 -0
- package/dist/tools/shared.js +130 -0
- package/dist/tools/types.d.ts +35 -0
- package/dist/tools/types.js +1 -0
- package/dist/tools/wrap.d.ts +6 -0
- package/dist/tools/wrap.js +55 -0
- package/package.json +19 -5
|
@@ -2,7 +2,7 @@ import { INDUSTRY_EVOLUTION_THRESHOLDS } from "./industry-evolution.js";
|
|
|
2
2
|
export const BUILTIN_INTENT_SPECS = {
|
|
3
3
|
default: {
|
|
4
4
|
intent: "default",
|
|
5
|
-
display_name: "
|
|
5
|
+
display_name: "Default (Phase 4 original model)",
|
|
6
6
|
weights: {
|
|
7
7
|
completed_rate: 35,
|
|
8
8
|
dispute_rate: 25,
|
|
@@ -22,7 +22,7 @@ export const BUILTIN_INTENT_SPECS = {
|
|
|
22
22
|
},
|
|
23
23
|
growth: {
|
|
24
24
|
intent: "growth",
|
|
25
|
-
display_name: "
|
|
25
|
+
display_name: "Growth (focus on new customers, repurchase, order-volume growth)",
|
|
26
26
|
weights: {
|
|
27
27
|
repeat_buyer_rate: 35,
|
|
28
28
|
completed_rate: 25,
|
|
@@ -43,8 +43,8 @@ export const BUILTIN_INTENT_SPECS = {
|
|
|
43
43
|
threshold: 0.3,
|
|
44
44
|
suggestion_type: "update_flywheel",
|
|
45
45
|
field: "flywheel.rewardStrategy",
|
|
46
|
-
suggested_value: "
|
|
47
|
-
evidence_template: "
|
|
46
|
+
suggested_value: "Strengthen loyalty Reward + tiered repurchase reward + referral cashback",
|
|
47
|
+
evidence_template: "Under growth intent, repurchase rate {value}% ≥ {threshold}%; recommend strengthening the loyalty flywheel",
|
|
48
48
|
confidence: 0.85,
|
|
49
49
|
priority: "high",
|
|
50
50
|
target_roles: ["merchant"],
|
|
@@ -55,8 +55,8 @@ export const BUILTIN_INTENT_SPECS = {
|
|
|
55
55
|
threshold: 0.15,
|
|
56
56
|
suggestion_type: "update_flywheel",
|
|
57
57
|
field: "flywheel.rewardStrategy",
|
|
58
|
-
suggested_value: "
|
|
59
|
-
evidence_template: "
|
|
58
|
+
suggested_value: "First-order reward + 7-day repurchase discount + referral cashback",
|
|
59
|
+
evidence_template: "Under growth intent, repurchase rate {value}% < {threshold}%; recommend strengthening first-order incentives",
|
|
60
60
|
confidence: 0.75,
|
|
61
61
|
priority: "medium",
|
|
62
62
|
target_roles: ["merchant"],
|
|
@@ -64,14 +64,14 @@ export const BUILTIN_INTENT_SPECS = {
|
|
|
64
64
|
],
|
|
65
65
|
level_thresholds: { thriving: 80, healthy: 60, stressed: 40 },
|
|
66
66
|
role_advice_routing: {
|
|
67
|
-
user: ["
|
|
68
|
-
merchant: ["
|
|
67
|
+
user: ["Focus on repurchase Reward and referral cashback"],
|
|
68
|
+
merchant: ["Strengthen the loyalty flywheel", "Optimize first-order conversion", "Increase Reward investment"],
|
|
69
69
|
arbitrator: [],
|
|
70
70
|
},
|
|
71
71
|
},
|
|
72
72
|
retention: {
|
|
73
73
|
intent: "retention",
|
|
74
|
-
display_name: "
|
|
74
|
+
display_name: "Retention (focus on repurchase, disputes, refunds)",
|
|
75
75
|
weights: {
|
|
76
76
|
repeat_buyer_rate: 30,
|
|
77
77
|
dispute_rate: 30,
|
|
@@ -94,10 +94,10 @@ export const BUILTIN_INTENT_SPECS = {
|
|
|
94
94
|
field: "risk_checks",
|
|
95
95
|
suggested_value: {
|
|
96
96
|
id: "retention_dispute_check",
|
|
97
|
-
description: "
|
|
97
|
+
description: "Retention intent: high dispute rate; recommend mandatory arbitration + compensation fund",
|
|
98
98
|
weight: 35,
|
|
99
99
|
},
|
|
100
|
-
evidence_template: "
|
|
100
|
+
evidence_template: "Under retention intent, dispute rate {value}% > {threshold}%; recommend strengthening dispute-resolution channels",
|
|
101
101
|
confidence: 0.85,
|
|
102
102
|
priority: "high",
|
|
103
103
|
target_roles: ["merchant", "arbitrator"],
|
|
@@ -109,7 +109,7 @@ export const BUILTIN_INTENT_SPECS = {
|
|
|
109
109
|
suggestion_type: "adjust_preference",
|
|
110
110
|
field: "preference_template.require_arbitration",
|
|
111
111
|
suggested_value: true,
|
|
112
|
-
evidence_template: "
|
|
112
|
+
evidence_template: "Under retention intent, refund rate {value}% > {threshold}%; recommend mandatory arbitration",
|
|
113
113
|
confidence: 0.8,
|
|
114
114
|
priority: "high",
|
|
115
115
|
target_roles: ["user", "merchant"],
|
|
@@ -117,14 +117,14 @@ export const BUILTIN_INTENT_SPECS = {
|
|
|
117
117
|
],
|
|
118
118
|
level_thresholds: { thriving: 80, healthy: 60, stressed: 45 },
|
|
119
119
|
role_advice_routing: {
|
|
120
|
-
user: ["
|
|
121
|
-
merchant: ["
|
|
122
|
-
arbitrator: ["
|
|
120
|
+
user: ["Prefer merchants with arbitration", "Pay attention to refund policy"],
|
|
121
|
+
merchant: ["Reduce dispute rate", "Optimize refund process", "Strengthen delivery quality"],
|
|
122
|
+
arbitrator: ["Watch high-dispute industries", "Proactively provide dispute-resolution channels"],
|
|
123
123
|
},
|
|
124
124
|
},
|
|
125
125
|
compliance: {
|
|
126
126
|
intent: "compliance",
|
|
127
|
-
display_name: "
|
|
127
|
+
display_name: "Compliance (focus on arbitration, compensation fund, regulation)",
|
|
128
128
|
weights: {
|
|
129
129
|
arbitration_coverage: 35,
|
|
130
130
|
compensation_coverage: 30,
|
|
@@ -147,7 +147,7 @@ export const BUILTIN_INTENT_SPECS = {
|
|
|
147
147
|
suggestion_type: "adjust_preference",
|
|
148
148
|
field: "preference_template.require_arbitration",
|
|
149
149
|
suggested_value: true,
|
|
150
|
-
evidence_template: "
|
|
150
|
+
evidence_template: "Under compliance intent, arbitration coverage {value}% < 100%; recommend mandatory arbitration configuration",
|
|
151
151
|
confidence: 0.95,
|
|
152
152
|
priority: "high",
|
|
153
153
|
target_roles: ["merchant", "arbitrator"],
|
|
@@ -160,10 +160,10 @@ export const BUILTIN_INTENT_SPECS = {
|
|
|
160
160
|
field: "risk_checks",
|
|
161
161
|
suggested_value: {
|
|
162
162
|
id: "compliance_compensation_check",
|
|
163
|
-
description: "
|
|
163
|
+
description: "Compliance intent: compensation fund coverage insufficient",
|
|
164
164
|
weight: 40,
|
|
165
165
|
},
|
|
166
|
-
evidence_template: "
|
|
166
|
+
evidence_template: "Under compliance intent, compensation fund coverage {value}% < {threshold}%; recommend increasing the compensation fund",
|
|
167
167
|
confidence: 0.9,
|
|
168
168
|
priority: "high",
|
|
169
169
|
target_roles: ["merchant"],
|
|
@@ -171,14 +171,14 @@ export const BUILTIN_INTENT_SPECS = {
|
|
|
171
171
|
],
|
|
172
172
|
level_thresholds: { thriving: 90, healthy: 70, stressed: 50 },
|
|
173
173
|
role_advice_routing: {
|
|
174
|
-
user: ["
|
|
175
|
-
merchant: ["
|
|
176
|
-
arbitrator: ["
|
|
174
|
+
user: ["Only transact with merchants that have arbitration", "Confirm compensation fund adequacy"],
|
|
175
|
+
merchant: ["Configure arbitration", "Increase compensation fund", "Compliance first"],
|
|
176
|
+
arbitrator: ["Proactively monitor highly regulated industries", "Provide compliance consulting"],
|
|
177
177
|
},
|
|
178
178
|
},
|
|
179
179
|
efficiency: {
|
|
180
180
|
intent: "efficiency",
|
|
181
|
-
display_name: "
|
|
181
|
+
display_name: "Efficiency (focus on cycle, milestones, communication)",
|
|
182
182
|
weights: {
|
|
183
183
|
cycle_efficiency: 45,
|
|
184
184
|
milestone_adoption: 25,
|
|
@@ -200,7 +200,7 @@ export const BUILTIN_INTENT_SPECS = {
|
|
|
200
200
|
suggestion_type: "adjust_preference",
|
|
201
201
|
field: "preference_template.max_acceptable_cycle",
|
|
202
202
|
suggested_value: 14,
|
|
203
|
-
evidence_template: "
|
|
203
|
+
evidence_template: "Under efficiency intent, average cycle {value} hours > {threshold} hours; recommend shortening the maximum acceptable cycle",
|
|
204
204
|
confidence: 0.8,
|
|
205
205
|
priority: "high",
|
|
206
206
|
target_roles: ["merchant"],
|
|
@@ -211,8 +211,8 @@ export const BUILTIN_INTENT_SPECS = {
|
|
|
211
211
|
threshold: 0.4,
|
|
212
212
|
suggestion_type: "update_flywheel",
|
|
213
213
|
field: "flywheel.keyActions",
|
|
214
|
-
suggested_value: "
|
|
215
|
-
evidence_template: "
|
|
214
|
+
suggested_value: "Add milestone nodes + phased-acceptance Reward",
|
|
215
|
+
evidence_template: "Under efficiency intent, milestone adoption {value}% < {threshold}%; recommend introducing milestones",
|
|
216
216
|
confidence: 0.75,
|
|
217
217
|
priority: "medium",
|
|
218
218
|
target_roles: ["merchant"],
|
|
@@ -220,14 +220,14 @@ export const BUILTIN_INTENT_SPECS = {
|
|
|
220
220
|
],
|
|
221
221
|
level_thresholds: { thriving: 85, healthy: 65, stressed: 45 },
|
|
222
222
|
role_advice_routing: {
|
|
223
|
-
user: ["
|
|
224
|
-
merchant: ["
|
|
223
|
+
user: ["Prefer merchants with milestones"],
|
|
224
|
+
merchant: ["Optimize Machine node splitting", "Introduce milestone acceptance", "Shorten the delivery cycle"],
|
|
225
225
|
arbitrator: [],
|
|
226
226
|
},
|
|
227
227
|
},
|
|
228
228
|
trust_building: {
|
|
229
229
|
intent: "trust_building",
|
|
230
|
-
display_name: "
|
|
230
|
+
display_name: "Trust building (focus on arbitration independence, reviews, compensation fund)",
|
|
231
231
|
weights: {
|
|
232
232
|
arbitration_coverage: 25,
|
|
233
233
|
compensation_coverage: 25,
|
|
@@ -251,8 +251,8 @@ export const BUILTIN_INTENT_SPECS = {
|
|
|
251
251
|
threshold: 0.3,
|
|
252
252
|
suggestion_type: "update_flywheel",
|
|
253
253
|
field: "flywheel.trustSellingPoints",
|
|
254
|
-
suggested_value: "
|
|
255
|
-
evidence_template: "
|
|
254
|
+
suggested_value: "On-chain public reviews + higher weight for credential-backed reviews",
|
|
255
|
+
evidence_template: "Under trust-building intent, review openness {value}% < {threshold}%; recommend introducing public reviews",
|
|
256
256
|
confidence: 0.8,
|
|
257
257
|
priority: "medium",
|
|
258
258
|
target_roles: ["merchant"],
|
|
@@ -265,10 +265,10 @@ export const BUILTIN_INTENT_SPECS = {
|
|
|
265
265
|
field: "risk_checks",
|
|
266
266
|
suggested_value: {
|
|
267
267
|
id: "trust_arbitration_check",
|
|
268
|
-
description: "
|
|
268
|
+
description: "Trust building: arbitration not configured",
|
|
269
269
|
weight: 35,
|
|
270
270
|
},
|
|
271
|
-
evidence_template: "
|
|
271
|
+
evidence_template: "Under trust-building intent, arbitration coverage {value}% < 100%; recommend mandatory arbitration configuration",
|
|
272
272
|
confidence: 0.9,
|
|
273
273
|
priority: "high",
|
|
274
274
|
target_roles: ["merchant", "arbitrator"],
|
|
@@ -276,14 +276,14 @@ export const BUILTIN_INTENT_SPECS = {
|
|
|
276
276
|
],
|
|
277
277
|
level_thresholds: { thriving: 85, healthy: 65, stressed: 50 },
|
|
278
278
|
role_advice_routing: {
|
|
279
|
-
user: ["
|
|
280
|
-
merchant: ["
|
|
281
|
-
arbitrator: ["
|
|
279
|
+
user: ["View public reviews", "Confirm arbitration independence"],
|
|
280
|
+
merchant: ["Introduce a public review Repository", "Configure arbitration", "Increase compensation fund"],
|
|
281
|
+
arbitrator: ["Maintain independence", "Proactively disclose verdict rationale"],
|
|
282
282
|
},
|
|
283
283
|
},
|
|
284
284
|
custom: {
|
|
285
285
|
intent: "custom",
|
|
286
|
-
display_name: "
|
|
286
|
+
display_name: "Custom (registered at runtime)",
|
|
287
287
|
weights: {},
|
|
288
288
|
healthy_thresholds: {},
|
|
289
289
|
suggestion_triggers: [],
|
|
@@ -320,8 +320,8 @@ export function evaluateIndustryHealthByIntent(industry, metrics, intent = "defa
|
|
|
320
320
|
const weaknesses = [];
|
|
321
321
|
const recommendations = [];
|
|
322
322
|
if (metrics.sample_size < INDUSTRY_EVOLUTION_THRESHOLDS.min_sample_size) {
|
|
323
|
-
weaknesses.push(
|
|
324
|
-
recommendations.push("
|
|
323
|
+
weaknesses.push(`Insufficient sample size (${metrics.sample_size} < ${INDUSTRY_EVOLUTION_THRESHOLDS.min_sample_size}); evaluation confidence is low`);
|
|
324
|
+
recommendations.push("Continue accumulating order data to improve evaluation accuracy");
|
|
325
325
|
}
|
|
326
326
|
let healthScore = 0;
|
|
327
327
|
const wCompleted = weights.completed_rate ?? 0;
|
|
@@ -330,11 +330,11 @@ export function evaluateIndustryHealthByIntent(industry, metrics, intent = "defa
|
|
|
330
330
|
healthScore += score;
|
|
331
331
|
const thr = thresholds.completed_rate ?? 0.9;
|
|
332
332
|
if (metrics.completed_rate >= thr) {
|
|
333
|
-
strengths.push(
|
|
333
|
+
strengths.push(`High completion rate (${Math.round(metrics.completed_rate * 100)}%)`);
|
|
334
334
|
}
|
|
335
335
|
else if (metrics.completed_rate < thr * 0.8) {
|
|
336
|
-
weaknesses.push(
|
|
337
|
-
recommendations.push("
|
|
336
|
+
weaknesses.push(`Low completion rate (${Math.round(metrics.completed_rate * 100)}%)`);
|
|
337
|
+
recommendations.push("Investigate the root cause of incomplete orders; strengthen Messenger communication");
|
|
338
338
|
}
|
|
339
339
|
}
|
|
340
340
|
const wDispute = weights.dispute_rate ?? 0;
|
|
@@ -343,11 +343,11 @@ export function evaluateIndustryHealthByIntent(industry, metrics, intent = "defa
|
|
|
343
343
|
healthScore += score;
|
|
344
344
|
const thr = thresholds.dispute_rate ?? 0.05;
|
|
345
345
|
if (metrics.dispute_rate <= thr) {
|
|
346
|
-
strengths.push(
|
|
346
|
+
strengths.push(`Low dispute rate (${Math.round(metrics.dispute_rate * 100)}%)`);
|
|
347
347
|
}
|
|
348
348
|
else if (metrics.dispute_rate > thr * 2) {
|
|
349
|
-
weaknesses.push(
|
|
350
|
-
recommendations.push("
|
|
349
|
+
weaknesses.push(`High dispute rate (${Math.round(metrics.dispute_rate * 100)}%)`);
|
|
350
|
+
recommendations.push("Dispute rate exceeds threshold; recommend mandatory arbitration + compensation fund + delivery Guard");
|
|
351
351
|
}
|
|
352
352
|
}
|
|
353
353
|
const wRefund = weights.refund_rate ?? 0;
|
|
@@ -355,8 +355,8 @@ export function evaluateIndustryHealthByIntent(industry, metrics, intent = "defa
|
|
|
355
355
|
const score = (1 - Math.min(1, metrics.refund_rate)) * wRefund;
|
|
356
356
|
healthScore += score;
|
|
357
357
|
if (metrics.refund_rate > 0.2) {
|
|
358
|
-
weaknesses.push(
|
|
359
|
-
recommendations.push("
|
|
358
|
+
weaknesses.push(`High refund rate (${Math.round(metrics.refund_rate * 100)}%)`);
|
|
359
|
+
recommendations.push("Abnormal refund rate; recommend checking delivery quality or product description consistency");
|
|
360
360
|
}
|
|
361
361
|
}
|
|
362
362
|
const wRepeat = weights.repeat_buyer_rate ?? 0;
|
|
@@ -365,11 +365,11 @@ export function evaluateIndustryHealthByIntent(industry, metrics, intent = "defa
|
|
|
365
365
|
healthScore += score;
|
|
366
366
|
const thr = thresholds.repeat_buyer_rate ?? 0.25;
|
|
367
367
|
if (metrics.repeat_buyer_rate >= thr) {
|
|
368
|
-
strengths.push(
|
|
368
|
+
strengths.push(`High repurchase rate (${Math.round(metrics.repeat_buyer_rate * 100)}%)`);
|
|
369
369
|
}
|
|
370
370
|
else if (metrics.repeat_buyer_rate < thr * 0.5 && metrics.sample_size >= 20) {
|
|
371
|
-
weaknesses.push(
|
|
372
|
-
recommendations.push("
|
|
371
|
+
weaknesses.push(`Low repurchase rate (${Math.round(metrics.repeat_buyer_rate * 100)}%)`);
|
|
372
|
+
recommendations.push("Low repurchase rate; recommend setting loyalty Reward + referral cashback");
|
|
373
373
|
}
|
|
374
374
|
}
|
|
375
375
|
const wCycle = weights.cycle_efficiency ?? 0;
|
|
@@ -378,33 +378,33 @@ export function evaluateIndustryHealthByIntent(industry, metrics, intent = "defa
|
|
|
378
378
|
healthScore += cycleScore * wCycle;
|
|
379
379
|
const thr = thresholds.cycle_efficiency ?? 24 * 7;
|
|
380
380
|
if (metrics.avg_cycle_hours <= thr) {
|
|
381
|
-
strengths.push(
|
|
381
|
+
strengths.push(`Short delivery cycle (${Math.round(metrics.avg_cycle_hours)} hours)`);
|
|
382
382
|
}
|
|
383
383
|
else if (metrics.avg_cycle_hours > 24 * 30) {
|
|
384
|
-
weaknesses.push(
|
|
385
|
-
recommendations.push("
|
|
384
|
+
weaknesses.push(`Long delivery cycle (${Math.round(metrics.avg_cycle_hours / 24)} days)`);
|
|
385
|
+
recommendations.push("Delivery cycle too long; recommend optimizing Machine node splitting");
|
|
386
386
|
}
|
|
387
387
|
}
|
|
388
388
|
const wArb = weights.arbitration_coverage ?? 0;
|
|
389
389
|
if (wArb > 0) {
|
|
390
|
-
const hasArbAnomaly = metrics.anomalies.some((a) => a.includes("
|
|
390
|
+
const hasArbAnomaly = metrics.anomalies.some((a) => a.includes("arbitration"));
|
|
391
391
|
const coverage = hasArbAnomaly ? 0 : 1;
|
|
392
392
|
const score = coverage * wArb;
|
|
393
393
|
healthScore += score;
|
|
394
394
|
if (coverage < 1) {
|
|
395
|
-
weaknesses.push("
|
|
396
|
-
recommendations.push("
|
|
395
|
+
weaknesses.push("Insufficient arbitration coverage");
|
|
396
|
+
recommendations.push("Recommend mandatory arbitration configuration (required under compliance/trust intents)");
|
|
397
397
|
}
|
|
398
398
|
}
|
|
399
399
|
const wComp = weights.compensation_coverage ?? 0;
|
|
400
400
|
if (wComp > 0) {
|
|
401
|
-
const hasCompAnomaly = metrics.anomalies.some((a) => a.includes("
|
|
401
|
+
const hasCompAnomaly = metrics.anomalies.some((a) => a.includes("compensation fund"));
|
|
402
402
|
const coverage = hasCompAnomaly ? 0 : 1;
|
|
403
403
|
const score = coverage * wComp;
|
|
404
404
|
healthScore += score;
|
|
405
405
|
if (coverage < 0.8) {
|
|
406
|
-
weaknesses.push("
|
|
407
|
-
recommendations.push("
|
|
406
|
+
weaknesses.push("Insufficient compensation fund coverage");
|
|
407
|
+
recommendations.push("Recommend increasing the compensation_fund balance");
|
|
408
408
|
}
|
|
409
409
|
}
|
|
410
410
|
const wMilestone = weights.milestone_adoption ?? 0;
|
|
@@ -413,19 +413,19 @@ export function evaluateIndustryHealthByIntent(industry, metrics, intent = "defa
|
|
|
413
413
|
const score = adoptionSignal * wMilestone;
|
|
414
414
|
healthScore += score;
|
|
415
415
|
if (adoptionSignal < 0.4) {
|
|
416
|
-
weaknesses.push("
|
|
417
|
-
recommendations.push("
|
|
416
|
+
weaknesses.push("Low milestone adoption rate");
|
|
417
|
+
recommendations.push("Recommend introducing milestone nodes + phased acceptance");
|
|
418
418
|
}
|
|
419
419
|
}
|
|
420
420
|
const wReview = weights.review_openness ?? 0;
|
|
421
421
|
if (wReview > 0) {
|
|
422
|
-
const hasReviewPattern = metrics.emerging_patterns.some((p) => p.includes("
|
|
422
|
+
const hasReviewPattern = metrics.emerging_patterns.some((p) => p.includes("review"));
|
|
423
423
|
const openness = hasReviewPattern ? 0.6 : 0.3;
|
|
424
424
|
const score = openness * wReview;
|
|
425
425
|
healthScore += score;
|
|
426
426
|
if (openness < 0.4) {
|
|
427
|
-
weaknesses.push("
|
|
428
|
-
recommendations.push("
|
|
427
|
+
weaknesses.push("Low review openness");
|
|
428
|
+
recommendations.push("Recommend introducing a public review Repository");
|
|
429
429
|
}
|
|
430
430
|
}
|
|
431
431
|
const normalizedScore = Math.round((healthScore / totalWeight) * 100);
|
|
@@ -486,13 +486,13 @@ function getMetricValue(metrics, dim) {
|
|
|
486
486
|
case "repeat_buyer_rate": return metrics.repeat_buyer_rate;
|
|
487
487
|
case "cycle_efficiency": return metrics.avg_cycle_hours;
|
|
488
488
|
case "arbitration_coverage":
|
|
489
|
-
return metrics.anomalies.some((a) => a.includes("
|
|
489
|
+
return metrics.anomalies.some((a) => a.includes("arbitration")) ? 0 : 1;
|
|
490
490
|
case "compensation_coverage":
|
|
491
|
-
return metrics.anomalies.some((a) => a.includes("
|
|
491
|
+
return metrics.anomalies.some((a) => a.includes("compensation fund")) ? 0 : 1;
|
|
492
492
|
case "milestone_adoption":
|
|
493
493
|
return metrics.trait_signals.long_cycle === true ? 0.6 : 0.3;
|
|
494
494
|
case "review_openness":
|
|
495
|
-
return metrics.emerging_patterns.some((p) => p.includes("
|
|
495
|
+
return metrics.emerging_patterns.some((p) => p.includes("review")) ? 0.6 : 0.3;
|
|
496
496
|
default: return undefined;
|
|
497
497
|
}
|
|
498
498
|
}
|
|
@@ -26,124 +26,124 @@ export const PERMISSION_TYPES = [
|
|
|
26
26
|
];
|
|
27
27
|
export const GAME_ELEMENTS = [
|
|
28
28
|
{
|
|
29
|
-
id: 1, type: "player", name: "
|
|
30
|
-
description: "
|
|
31
|
-
wowokApplication: "Service
|
|
32
|
-
onChainMechanism: "Service + Order
|
|
29
|
+
id: 1, type: "player", name: "Merchant vs Customer",
|
|
30
|
+
description: "The basic participants of the game: the merchant providing the service and the customer purchasing the service.",
|
|
31
|
+
wowokApplication: "Service creator (merchant) and Order creator (customer).",
|
|
32
|
+
onChainMechanism: "Service + Order objects, each with an independent on-chain address.",
|
|
33
33
|
},
|
|
34
34
|
{
|
|
35
|
-
id: 2, type: "player", name: "
|
|
36
|
-
description: "
|
|
37
|
-
wowokApplication: "Arb
|
|
38
|
-
onChainMechanism: "Arbitration
|
|
35
|
+
id: 2, type: "player", name: "Arbitrator",
|
|
36
|
+
description: "Third-party arbitrators participate in the dispute resolution game.",
|
|
37
|
+
wowokApplication: "NamedOperator of the Arb object, designated by the Service.",
|
|
38
|
+
onChainMechanism: "Arbitration object + NamedOperator permission.",
|
|
39
39
|
},
|
|
40
40
|
{
|
|
41
|
-
id: 3, type: "strategy", name: "
|
|
42
|
-
description: "
|
|
43
|
-
wowokApplication: "
|
|
44
|
-
onChainMechanism: "Progress
|
|
41
|
+
id: 3, type: "strategy", name: "Cooperation vs Deception",
|
|
42
|
+
description: "The merchant can choose honest fulfillment (cooperation) or fraud (deception). The customer can choose to trust or refuse.",
|
|
43
|
+
wowokApplication: "Merchant ships vs doesn't ship; customer pays vs refuses to pay.",
|
|
44
|
+
onChainMechanism: "Progress node advancement + immutable on-chain state.",
|
|
45
45
|
},
|
|
46
46
|
{
|
|
47
|
-
id: 4, type: "payoff", name: "
|
|
48
|
-
description: "
|
|
49
|
-
wowokApplication: "compensation_fund
|
|
50
|
-
onChainMechanism: "Service.compensation_fund + Treasury
|
|
47
|
+
id: 4, type: "payoff", name: "Fulfillment payoff vs Fraud payoff",
|
|
48
|
+
description: "Honest fulfillment yields sustained income + reputation; fraud yields one-time income but loses reputation and compensation fund.",
|
|
49
|
+
wowokApplication: "compensation_fund as economic penalty for fraud; repeat business as long-term payoff for cooperation.",
|
|
50
|
+
onChainMechanism: "Service.compensation_fund + Treasury locked funds.",
|
|
51
51
|
},
|
|
52
52
|
{
|
|
53
|
-
id: 5, type: "utility", name: "
|
|
54
|
-
description: "
|
|
55
|
-
wowokApplication: "
|
|
56
|
-
onChainMechanism: "ReviewRepository (
|
|
53
|
+
id: 5, type: "utility", name: "Reputation utility",
|
|
54
|
+
description: "Merchant's total utility = immediate income + reputation-discounted future income - expected penalty.",
|
|
55
|
+
wowokApplication: "Merchants with high reputation scores get more orders (Demand matching priority).",
|
|
56
|
+
onChainMechanism: "ReviewRepository (on-chain public reviews) + Demand matching engine.",
|
|
57
57
|
},
|
|
58
58
|
{
|
|
59
|
-
id: 6, type: "equilibrium", name: "
|
|
60
|
-
description: "
|
|
61
|
-
wowokApplication: "compensation_fund
|
|
62
|
-
onChainMechanism: "Guard
|
|
59
|
+
id: 6, type: "equilibrium", name: "Nash equilibrium: mutual cooperation",
|
|
60
|
+
description: "When penalties are large enough and reputation is important enough, the strategy profile of mutual cooperation becomes a Nash equilibrium.",
|
|
61
|
+
wowokApplication: "compensation_fund large enough + immutable on-chain reputation -> cooperation becomes the optimal strategy.",
|
|
62
|
+
onChainMechanism: "Guard verifies compensation_fund amount + ReviewRepository public.",
|
|
63
63
|
},
|
|
64
64
|
{
|
|
65
|
-
id: 7, type: "information", name: "
|
|
66
|
-
description: "
|
|
67
|
-
wowokApplication: "Service.description + Guard
|
|
68
|
-
onChainMechanism: "Guard + Personal
|
|
65
|
+
id: 7, type: "information", name: "Incomplete information",
|
|
66
|
+
description: "Customers don't fully understand the merchant's service quality; merchants don't fully understand the customer's payment capacity.",
|
|
67
|
+
wowokApplication: "Service.description + Guard verification as signals; customer wallet balance is queryable on-chain.",
|
|
68
|
+
onChainMechanism: "Guard + Personal object + on-chain transaction history.",
|
|
69
69
|
},
|
|
70
70
|
{
|
|
71
|
-
id: 8, type: "sequence", name: "
|
|
72
|
-
description: "
|
|
73
|
-
wowokApplication: "Order
|
|
74
|
-
onChainMechanism: "Machine
|
|
71
|
+
id: 8, type: "sequence", name: "Sequential game",
|
|
72
|
+
description: "Customer places order and pays first, merchant fulfills later — this is a typical sequential game.",
|
|
73
|
+
wowokApplication: "Order creation -> Progress advancement -> Acceptance/Arbitration.",
|
|
74
|
+
onChainMechanism: "Machine node sequence + Progress state machine.",
|
|
75
75
|
},
|
|
76
76
|
{
|
|
77
|
-
id: 9, type: "repetition", name: "
|
|
78
|
-
description: "
|
|
79
|
-
wowokApplication: "
|
|
80
|
-
onChainMechanism: "ReviewRepository
|
|
77
|
+
id: 9, type: "repetition", name: "Repeated game",
|
|
78
|
+
description: "Merchants and customers may transact multiple times; repeated games make cooperation strategies superior.",
|
|
79
|
+
wowokApplication: "Customer repeat purchases + Demand matching prioritizes high-reputation merchants.",
|
|
80
|
+
onChainMechanism: "ReviewRepository accumulates reviews + Demand matching engine.",
|
|
81
81
|
},
|
|
82
82
|
{
|
|
83
|
-
id: 10, type: "commitment", name: "
|
|
84
|
-
description: "
|
|
85
|
-
wowokApplication: "Service.compensation_fund
|
|
86
|
-
onChainMechanism: "Treasury
|
|
83
|
+
id: 10, type: "commitment", name: "Compensation fund commitment",
|
|
84
|
+
description: "Merchants make a credible commitment by locking compensation_fund, reducing customers' risk perception.",
|
|
85
|
+
wowokApplication: "Service.compensation_fund locks funds; customers can claim compensation in case of fraud.",
|
|
86
|
+
onChainMechanism: "Treasury object + Guard verifies amount + withdrawal rules.",
|
|
87
87
|
},
|
|
88
88
|
{
|
|
89
|
-
id: 11, type: "punishment", name: "
|
|
90
|
-
description: "
|
|
91
|
-
wowokApplication: "Arbitration
|
|
92
|
-
onChainMechanism: "Arbitration verdict + Treasury
|
|
89
|
+
id: 11, type: "punishment", name: "Compensation fund penalty",
|
|
90
|
+
description: "When a merchant commits fraud, the compensation fund is transferred to the customer, constituting economic punishment.",
|
|
91
|
+
wowokApplication: "Arbitration verdict -> compensation_fund withdrawal -> customer receives compensation.",
|
|
92
|
+
onChainMechanism: "Arbitration verdict + Treasury withdrawal rules.",
|
|
93
93
|
},
|
|
94
94
|
{
|
|
95
|
-
id: 12, type: "reward", name: "Reward
|
|
96
|
-
description: "
|
|
97
|
-
wowokApplication: "Reward
|
|
98
|
-
onChainMechanism: "Reward
|
|
95
|
+
id: 12, type: "reward", name: "Reward marketing incentive",
|
|
96
|
+
description: "Merchants issue rewards via Reward objects, incentivizing customer behavior (first order, referral, loyalty).",
|
|
97
|
+
wowokApplication: "Reward object + Guard verifies claim conditions (e.g., completed first order).",
|
|
98
|
+
onChainMechanism: "Reward object + Guard claim conditions + Allocation distribution.",
|
|
99
99
|
},
|
|
100
100
|
{
|
|
101
|
-
id: 13, type: "reputation", name: "
|
|
102
|
-
description: "
|
|
103
|
-
wowokApplication: "ReviewRepository
|
|
104
|
-
onChainMechanism: "Repository
|
|
101
|
+
id: 13, type: "reputation", name: "On-chain public reputation",
|
|
102
|
+
description: "All transactions and reviews are recorded on-chain, forming an immutable reputation system.",
|
|
103
|
+
wowokApplication: "ReviewRepository stores like/dislike/review tags, queryable on-chain.",
|
|
104
|
+
onChainMechanism: "Repository object + Guard anti-spam + address-keyed review records.",
|
|
105
105
|
},
|
|
106
106
|
{
|
|
107
|
-
id: 14, type: "signaling", name: "
|
|
108
|
-
description: "
|
|
109
|
-
wowokApplication: "buy_guard
|
|
110
|
-
onChainMechanism: "Guard + Treasury + Machine
|
|
107
|
+
id: 14, type: "signaling", name: "Quality signal",
|
|
108
|
+
description: "Merchants send quality signals via Guard verification, compensation_fund amount, and Machine transparency.",
|
|
109
|
+
wowokApplication: "buy_guard verification -> signal; compensation_fund amount -> signal; Machine public -> signal.",
|
|
110
|
+
onChainMechanism: "Guard + Treasury + Machine object's on-chain public data.",
|
|
111
111
|
},
|
|
112
112
|
{
|
|
113
|
-
id: 15, type: "screening", name: "
|
|
114
|
-
description: "
|
|
115
|
-
wowokApplication: "Service.buy_guard
|
|
116
|
-
onChainMechanism: "Guard
|
|
113
|
+
id: 15, type: "screening", name: "Customer screening",
|
|
114
|
+
description: "Merchants screen customers via Guard (e.g., verify identity, credit score, wallet balance).",
|
|
115
|
+
wowokApplication: "Service.buy_guard verifies customer eligibility.",
|
|
116
|
+
onChainMechanism: "Guard object + gen_passport verifies credentials.",
|
|
117
117
|
},
|
|
118
118
|
{
|
|
119
|
-
id: 16, type: "bargaining", name: "
|
|
120
|
-
description: "
|
|
121
|
-
wowokApplication: "Messenger
|
|
122
|
-
onChainMechanism: "Contact + Messenger + Demand
|
|
119
|
+
id: 16, type: "bargaining", name: "Price bargaining",
|
|
120
|
+
description: "Customers and merchants can bargain via Messenger; the final price is submitted via Demand.",
|
|
121
|
+
wowokApplication: "Messenger encrypted communication -> Demand submits demand with reward.",
|
|
122
|
+
onChainMechanism: "Contact + Messenger + Demand objects.",
|
|
123
123
|
},
|
|
124
124
|
{
|
|
125
|
-
id: 17, type: "auction", name: "Demand
|
|
126
|
-
description: "
|
|
127
|
-
wowokApplication: "Demand
|
|
128
|
-
onChainMechanism: "Demand
|
|
125
|
+
id: 17, type: "auction", name: "Demand bidding",
|
|
126
|
+
description: "Multiple service providers can compete for the same Demand, forming a bidding mechanism.",
|
|
127
|
+
wowokApplication: "Demand publishes demand -> multiple Services submit proposals -> customer chooses.",
|
|
128
|
+
onChainMechanism: "Demand object + order creation + Progress advancement.",
|
|
129
129
|
},
|
|
130
130
|
{
|
|
131
|
-
id: 18, type: "mechanism", name: "
|
|
132
|
-
description: "WoWok
|
|
133
|
-
wowokApplication: "compensation_fund + Arbitration + ReviewRepository
|
|
134
|
-
onChainMechanism: "Move
|
|
131
|
+
id: 18, type: "mechanism", name: "Mechanism design",
|
|
132
|
+
description: "WoWok's overall architecture is mechanism design: incentivizing cooperation and punishing fraud via on-chain rules.",
|
|
133
|
+
wowokApplication: "compensation_fund + Arbitration + ReviewRepository combine to form a trust mechanism.",
|
|
134
|
+
onChainMechanism: "Move contract-level object composition + Guard verification + immutability.",
|
|
135
135
|
},
|
|
136
136
|
{
|
|
137
|
-
id: 19, type: "constraint", name: "
|
|
138
|
-
description: "compensation_fund
|
|
139
|
-
wowokApplication: "
|
|
140
|
-
onChainMechanism: "Treasury + Allocation
|
|
137
|
+
id: 19, type: "constraint", name: "Fund constraint",
|
|
138
|
+
description: "compensation_fund and Reward fund locks constitute economic constraints, limiting the merchant's incentive to commit fraud.",
|
|
139
|
+
wowokApplication: "Fund lock > fraud payoff -> cooperation is the rational choice.",
|
|
140
|
+
onChainMechanism: "Treasury + Allocation fund lock.",
|
|
141
141
|
},
|
|
142
142
|
{
|
|
143
|
-
id: 20, type: "cooperation", name: "
|
|
144
|
-
description: "
|
|
145
|
-
wowokApplication: "Service
|
|
146
|
-
onChainMechanism: "Allocation + Machine Forward + Progress
|
|
143
|
+
id: 20, type: "cooperation", name: "Supply chain collaboration",
|
|
144
|
+
description: "Multiple merchants combine via Machine to form a supply chain, cooperating to fulfill complex orders (sub-orders).",
|
|
145
|
+
wowokApplication: "Service's order_allocators supports multi-supplier allocation; Machine node forwards combine.",
|
|
146
|
+
onChainMechanism: "Allocation + Machine Forward + Progress cross-object composition.",
|
|
147
147
|
},
|
|
148
148
|
];
|
|
149
149
|
const PERMISSION_INDEX = new Map(PERMISSION_TYPES.map((p) => [p.name, p]));
|
|
@@ -3,13 +3,13 @@ export function buildReviewRepositorySetup(serviceName) {
|
|
|
3
3
|
return {
|
|
4
4
|
repositoryName: `${serviceName}_reviews`,
|
|
5
5
|
guardName: `${serviceName}_review_guard`,
|
|
6
|
-
guardRules: "
|
|
6
|
+
guardRules: "Verify that the submitter has a completed order for this Service (query order history == completed) — anti-review-spam",
|
|
7
7
|
setupSteps: [
|
|
8
|
-
`1.
|
|
9
|
-
`2.
|
|
10
|
-
`3.
|
|
11
|
-
`4.
|
|
12
|
-
`5.
|
|
8
|
+
`1. Create Guard: name='${serviceName}_review_guard', rule verifies buyer identity`,
|
|
9
|
+
`2. Create Repository: name='${serviceName}_reviews', attach Guard`,
|
|
10
|
+
`3. Associate Repository with Service: onchain_operations service modify`,
|
|
11
|
+
`4. When user submits a review: onchain_operations repository write (Guard auto-validates)`,
|
|
12
|
+
`5. Query reviews: onchain_table_data repository query`,
|
|
13
13
|
],
|
|
14
14
|
};
|
|
15
15
|
}
|
|
@@ -81,18 +81,18 @@ export function detectReviewManipulation(reviews) {
|
|
|
81
81
|
}
|
|
82
82
|
const duplicates = Array.from(reviewerCounts.entries()).filter(([, count]) => count > 1);
|
|
83
83
|
if (duplicates.length > 0) {
|
|
84
|
-
reasons.push(`${duplicates.length}
|
|
84
|
+
reasons.push(`${duplicates.length} address(es) submitted multiple reviews`);
|
|
85
85
|
}
|
|
86
86
|
const allLikes = reviews.every((r) => r.rating === "like");
|
|
87
87
|
const noneVerified = reviews.every((r) => !r.verified);
|
|
88
88
|
if (allLikes && reviews.length > 5 && noneVerified) {
|
|
89
|
-
reasons.push("
|
|
89
|
+
reasons.push("All likes but no verified reviews; possible review spam");
|
|
90
90
|
}
|
|
91
91
|
if (reviews.length > 10) {
|
|
92
92
|
const sorted = [...reviews].sort((a, b) => (a.timestamp ?? 0) - (b.timestamp ?? 0));
|
|
93
93
|
const timeSpan = (sorted[sorted.length - 1].timestamp ?? 0) - (sorted[0].timestamp ?? 0);
|
|
94
94
|
if (timeSpan > 0 && timeSpan < 3600 * 1000) {
|
|
95
|
-
reasons.push(`${reviews.length}
|
|
95
|
+
reasons.push(`${reviews.length} reviews submitted within 1 hour; abnormally concentrated timing`);
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
return { suspicious: reasons.length > 0, reasons };
|