@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
|
@@ -3,92 +3,92 @@ export const INDUSTRY_FLYWHEELS = [
|
|
|
3
3
|
{
|
|
4
4
|
industry: "freelance",
|
|
5
5
|
trustSellingPoints: [
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"compensation_fund
|
|
6
|
+
"Delivery acceptance + fund escrow + arbitration guarantee",
|
|
7
|
+
"Transparent process: Machine defines clear delivery nodes",
|
|
8
|
+
"compensation_fund secures customer rights",
|
|
9
9
|
],
|
|
10
10
|
keyActions: [
|
|
11
|
-
{ action: "
|
|
12
|
-
{ action: "
|
|
13
|
-
{ action: "
|
|
14
|
-
{ action: "
|
|
11
|
+
{ action: "Set Reward first-order bonus", purpose: "Attract new customers to place orders", mutableField: "rewards", metricToWatch: "New customer order rate" },
|
|
12
|
+
{ action: "Cumulative-spend tiered Reward", purpose: "Incentivize repurchase", mutableField: "rewards", metricToWatch: "Repurchase rate" },
|
|
13
|
+
{ action: "Adjust Machine nodes", purpose: "Optimize delivery process speed", mutableField: "description", metricToWatch: "Average completion time" },
|
|
14
|
+
{ action: "Increase compensation_fund", purpose: "Improve trust score", mutableField: "compensation_fund", metricToWatch: "Trust score" },
|
|
15
15
|
],
|
|
16
|
-
rewardStrategy: "
|
|
17
|
-
discountStrategy: "
|
|
18
|
-
trustDescription: "
|
|
16
|
+
rewardStrategy: "First-order reward + cumulative-spend tiered reward (e.g. discount after 5 orders)",
|
|
17
|
+
discountStrategy: "Monthly discount + long-term cooperation discount",
|
|
18
|
+
trustDescription: "Fund escrow + delivery acceptance + arbitration guarantee",
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
21
|
industry: "rental",
|
|
22
22
|
trustSellingPoints: [
|
|
23
|
-
"
|
|
24
|
-
"Guard
|
|
25
|
-
"compensation_fund
|
|
23
|
+
"Deposit escrow + damage Guard + return process",
|
|
24
|
+
"Guard verifies item condition to prevent disputes",
|
|
25
|
+
"compensation_fund covers damage risk",
|
|
26
26
|
],
|
|
27
27
|
keyActions: [
|
|
28
|
-
{ action: "
|
|
29
|
-
{ action: "
|
|
30
|
-
{ action: "
|
|
31
|
-
{ action: "
|
|
28
|
+
{ action: "Set Discount long-term rental bonus", purpose: "Incentivize long-term rental", mutableField: "discount", metricToWatch: "Long-term rental ratio" },
|
|
29
|
+
{ action: "Credit-accumulation Reward", purpose: "Multi-rental credit accumulation", mutableField: "rewards", metricToWatch: "Re-rental rate" },
|
|
30
|
+
{ action: "Configure damage Guard", purpose: "Reduce dispute rate", mutableField: "buy_guard", metricToWatch: "Dispute rate" },
|
|
31
|
+
{ action: "Increase compensation_fund", purpose: "Cover damage risk", mutableField: "compensation_fund", metricToWatch: "Trust score" },
|
|
32
32
|
],
|
|
33
|
-
rewardStrategy: "
|
|
34
|
-
discountStrategy: "
|
|
35
|
-
trustDescription: "
|
|
33
|
+
rewardStrategy: "Credit accumulation + long-term rental discount + referral cashback",
|
|
34
|
+
discountStrategy: "Monthly 10% off + quarterly 20% off + annual 30% off",
|
|
35
|
+
trustDescription: "Deposit escrow + Guard verification + return guarantee",
|
|
36
36
|
},
|
|
37
37
|
{
|
|
38
38
|
industry: "education",
|
|
39
39
|
trustSellingPoints: [
|
|
40
|
-
"
|
|
41
|
-
"Machine
|
|
40
|
+
"Transparent course progress + refund Guard",
|
|
41
|
+
"Machine defines learning stages and acceptance nodes",
|
|
42
42
|
],
|
|
43
43
|
keyActions: [
|
|
44
|
-
{ action: "
|
|
45
|
-
{ action: "
|
|
44
|
+
{ action: "Set milestone Reward", purpose: "Incentivize course completion", mutableField: "rewards", metricToWatch: "Course completion rate" },
|
|
45
|
+
{ action: "Referral cashback Reward", purpose: "Viral acquisition", mutableField: "rewards", metricToWatch: "Referral rate" },
|
|
46
46
|
],
|
|
47
|
-
rewardStrategy: "
|
|
48
|
-
discountStrategy: "
|
|
49
|
-
trustDescription: "
|
|
47
|
+
rewardStrategy: "Milestone reward + referral cashback + trial-class discount",
|
|
48
|
+
discountStrategy: "Early-bird price + group-buy price + student-aid discount",
|
|
49
|
+
trustDescription: "Transparent progress + refund guarantee + acceptance nodes",
|
|
50
50
|
},
|
|
51
51
|
{
|
|
52
52
|
industry: "travel",
|
|
53
53
|
trustSellingPoints: [
|
|
54
|
-
"
|
|
55
|
-
"Guard
|
|
54
|
+
"Itinerary escrow + cancellation Guard + arbitration guarantee",
|
|
55
|
+
"Guard verifies itinerary change conditions",
|
|
56
56
|
],
|
|
57
57
|
keyActions: [
|
|
58
|
-
{ action: "
|
|
59
|
-
{ action: "
|
|
58
|
+
{ action: "Limited-time flash-sale Reward", purpose: "Clearance promotion", mutableField: "rewards", metricToWatch: "Conversion rate" },
|
|
59
|
+
{ action: "Spend cashback Reward", purpose: "Improve repurchase", mutableField: "rewards", metricToWatch: "Repurchase rate" },
|
|
60
60
|
],
|
|
61
|
-
rewardStrategy: "
|
|
62
|
-
discountStrategy: "
|
|
63
|
-
trustDescription: "
|
|
61
|
+
rewardStrategy: "Limited-time flash sale + spend cashback + referral commission",
|
|
62
|
+
discountStrategy: "Early-bird price + group-buy price + member price",
|
|
63
|
+
trustDescription: "Itinerary escrow + cancellation guarantee + arbitration",
|
|
64
64
|
},
|
|
65
65
|
{
|
|
66
66
|
industry: "subscription",
|
|
67
67
|
trustSellingPoints: [
|
|
68
|
-
"
|
|
69
|
-
"Machine
|
|
68
|
+
"Transparent subscription + auto-renewal Guard + cancel anytime",
|
|
69
|
+
"Machine defines billing cycles and auto-debit",
|
|
70
70
|
],
|
|
71
71
|
keyActions: [
|
|
72
|
-
{ action: "
|
|
73
|
-
{ action: "
|
|
72
|
+
{ action: "Loyalty Reward", purpose: "Long-term retention", mutableField: "rewards", metricToWatch: "Renewal rate" },
|
|
73
|
+
{ action: "Referral cashback Reward", purpose: "Viral acquisition", mutableField: "rewards", metricToWatch: "Referral rate" },
|
|
74
74
|
],
|
|
75
|
-
rewardStrategy: "
|
|
76
|
-
discountStrategy: "
|
|
77
|
-
trustDescription: "
|
|
75
|
+
rewardStrategy: "Loyalty reward + referral cashback + first-month discount",
|
|
76
|
+
discountStrategy: "Annual discount + team discount + upgrade discount",
|
|
77
|
+
trustDescription: "Transparent subscription + renewal guarantee + cancel anytime",
|
|
78
78
|
},
|
|
79
79
|
{
|
|
80
80
|
industry: "retail",
|
|
81
81
|
trustSellingPoints: [
|
|
82
|
-
"
|
|
83
|
-
"Guard
|
|
82
|
+
"Transaction escrow + logistics Guard + refund guarantee",
|
|
83
|
+
"Guard verifies shipping and receipt",
|
|
84
84
|
],
|
|
85
85
|
keyActions: [
|
|
86
|
-
{ action: "
|
|
87
|
-
{ action: "
|
|
86
|
+
{ action: "First-order discount", purpose: "Attract new customers", mutableField: "discount", metricToWatch: "New customer order rate" },
|
|
87
|
+
{ action: "Spend cashback Reward", purpose: "Improve repurchase", mutableField: "rewards", metricToWatch: "Repurchase rate" },
|
|
88
88
|
],
|
|
89
|
-
rewardStrategy: "
|
|
90
|
-
discountStrategy: "
|
|
91
|
-
trustDescription: "
|
|
89
|
+
rewardStrategy: "First-order discount + spend cashback + spend-threshold discount",
|
|
90
|
+
discountStrategy: "Spend-threshold discount + limited-time discount + member price",
|
|
91
|
+
trustDescription: "Transaction escrow + logistics Guard + refund guarantee",
|
|
92
92
|
},
|
|
93
93
|
];
|
|
94
94
|
let _registryLookup = null;
|
|
@@ -119,29 +119,29 @@ export function generateTrustDescription(params) {
|
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
if (params.orderCount !== undefined && params.orderCount > 0) {
|
|
122
|
-
parts.push(
|
|
122
|
+
parts.push(`Completed ${params.orderCount} orders`);
|
|
123
123
|
}
|
|
124
124
|
if (params.completedRate !== undefined) {
|
|
125
|
-
parts.push(
|
|
125
|
+
parts.push(`Completion rate ${Math.round(params.completedRate * 100)}%`);
|
|
126
126
|
}
|
|
127
127
|
if (params.avgCompletionTime !== undefined) {
|
|
128
128
|
if (params.avgCompletionTime < 1) {
|
|
129
|
-
parts.push(
|
|
129
|
+
parts.push(`Average completion time ${Math.round(params.avgCompletionTime * 60)} minutes`);
|
|
130
130
|
}
|
|
131
131
|
else {
|
|
132
|
-
parts.push(
|
|
132
|
+
parts.push(`Average completion time ${Math.round(params.avgCompletionTime)} hours`);
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
135
|
if (params.hasCompensationFund) {
|
|
136
|
-
parts.push("
|
|
136
|
+
parts.push("Sufficient compensation fund");
|
|
137
137
|
}
|
|
138
138
|
if (params.hasArbitration) {
|
|
139
|
-
parts.push("
|
|
139
|
+
parts.push("Third-party arbitration guarantee");
|
|
140
140
|
}
|
|
141
141
|
if (params.reviewCount !== undefined && params.reviewCount > 0 && params.reviewLikeRate !== undefined) {
|
|
142
|
-
parts.push(
|
|
142
|
+
parts.push(`Like rate ${Math.round(params.reviewLikeRate * 100)}% (${params.reviewCount} reviews)`);
|
|
143
143
|
}
|
|
144
|
-
return parts.join("
|
|
144
|
+
return parts.join("; ") || "No trust data available";
|
|
145
145
|
}
|
|
146
146
|
export function buildAcquisitionDashboard(params) {
|
|
147
147
|
const { orderCount, completedRate, avgCompletionTime, repeatCustomerRate, reviewLikeRate, reviewCount } = params;
|
|
@@ -154,27 +154,27 @@ export function buildAcquisitionDashboard(params) {
|
|
|
154
154
|
stage = "growing";
|
|
155
155
|
const suggestions = [];
|
|
156
156
|
if (stage === "cold_start") {
|
|
157
|
-
suggestions.push("
|
|
158
|
-
suggestions.push("
|
|
157
|
+
suggestions.push("Cold-start stage: set first-order Reward to attract new customers");
|
|
158
|
+
suggestions.push("Increase compensation_fund to boost initial trust");
|
|
159
159
|
}
|
|
160
160
|
else if (stage === "growing") {
|
|
161
|
-
suggestions.push("
|
|
161
|
+
suggestions.push("Growing stage: set referral cashback Reward for viral acquisition");
|
|
162
162
|
if (repeatCustomerRate !== undefined && repeatCustomerRate < 0.2) {
|
|
163
|
-
suggestions.push("
|
|
163
|
+
suggestions.push("Repurchase rate is low; consider setting cumulative-spend tiered Reward");
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
166
|
else if (stage === "mature") {
|
|
167
167
|
if (reviewLikeRate !== undefined && reviewLikeRate > 0.8) {
|
|
168
|
-
suggestions.push("
|
|
168
|
+
suggestions.push("High like rate; you can highlight trust metrics in the description");
|
|
169
169
|
}
|
|
170
170
|
if (repeatCustomerRate !== undefined && repeatCustomerRate > 0.3) {
|
|
171
|
-
suggestions.push("
|
|
171
|
+
suggestions.push("High repurchase rate; consider setting loyalty Reward to incentivize long-term customers");
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
else {
|
|
175
|
-
suggestions.push("
|
|
175
|
+
suggestions.push("Optimization stage: fine-tune pricing and Reward strategies");
|
|
176
176
|
if (avgCompletionTime !== undefined && avgCompletionTime > 48) {
|
|
177
|
-
suggestions.push("
|
|
177
|
+
suggestions.push("Completion time is long; consider optimizing the Machine process");
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
180
|
return {
|
|
@@ -87,31 +87,31 @@ function scoreLevel(score) {
|
|
|
87
87
|
function buildWarnings(score, metrics, components) {
|
|
88
88
|
const warnings = [];
|
|
89
89
|
if (score < 50) {
|
|
90
|
-
warnings.push(
|
|
91
|
-
|
|
90
|
+
warnings.push(`Arbitrator trust score is low (${score}/100, ${scoreLevel(score)}). ` +
|
|
91
|
+
`Customers should choose this arbitrator with caution. The user retains data usage authority; the system does not block usage.`);
|
|
92
92
|
}
|
|
93
93
|
if (metrics.disputedVerdicts > 0 && metrics.totalCases > 0) {
|
|
94
94
|
const disputeRate = metrics.disputedVerdicts / metrics.totalCases;
|
|
95
95
|
if (disputeRate > 0.3) {
|
|
96
|
-
warnings.push(
|
|
97
|
-
`${metrics.disputedVerdicts}/${metrics.totalCases}
|
|
96
|
+
warnings.push(`High dispute rate (${(disputeRate * 100).toFixed(1)}%): ` +
|
|
97
|
+
`${metrics.disputedVerdicts}/${metrics.totalCases} cases had disputes.`);
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
if (!metrics.hasVerifiedIdentity) {
|
|
101
|
-
warnings.push("
|
|
101
|
+
warnings.push("Arbitrator has not verified on-chain identity (no Personal object); recommend verifying authenticity.");
|
|
102
102
|
}
|
|
103
103
|
if (metrics.avgResponseHours > 72) {
|
|
104
|
-
warnings.push(
|
|
104
|
+
warnings.push(`Arbitrator average response time is long (${metrics.avgResponseHours}h), which may affect dispute resolution efficiency.`);
|
|
105
105
|
}
|
|
106
106
|
return warnings;
|
|
107
107
|
}
|
|
108
108
|
export function quickRiskAssessment(score) {
|
|
109
109
|
const level = scoreLevel(score);
|
|
110
110
|
switch (level) {
|
|
111
|
-
case "high_risk": return "
|
|
112
|
-
case "caution": return "
|
|
113
|
-
case "moderate": return "
|
|
114
|
-
case "trusted": return "
|
|
111
|
+
case "high_risk": return "High risk: recommend changing arbitrator or adding compensation fund protection";
|
|
112
|
+
case "caution": return "Caution: trust score is low, recommend careful evaluation";
|
|
113
|
+
case "moderate": return "Moderate trust: acceptable, recommend continued observation";
|
|
114
|
+
case "trusted": return "High trust: arbitrator performs well";
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
export const ARBITRATION_TRUST_VERSION = 1;
|
|
@@ -23,41 +23,41 @@ function computeMatchScore(demand, service) {
|
|
|
23
23
|
const tagScore = computeTagScore(demand.tags, service.tags);
|
|
24
24
|
score += tagScore;
|
|
25
25
|
if (tagScore >= WEIGHTS.tags * 0.8) {
|
|
26
|
-
reasons.push(`tags
|
|
26
|
+
reasons.push(`High tags match (${tagScore}/${WEIGHTS.tags})`);
|
|
27
27
|
}
|
|
28
28
|
const priceScore = computePriceScore(demand.maxPrice, service.price);
|
|
29
29
|
score += priceScore;
|
|
30
30
|
if (priceScore === WEIGHTS.price) {
|
|
31
|
-
reasons.push(
|
|
31
|
+
reasons.push(`Price within budget`);
|
|
32
32
|
}
|
|
33
33
|
else if (priceScore === 0 && demand.maxPrice && service.price) {
|
|
34
|
-
warnings.push(
|
|
34
|
+
warnings.push(`Price exceeds budget (${service.price} > ${demand.maxPrice})`);
|
|
35
35
|
}
|
|
36
36
|
const scenarioScore = computeScenarioScore(demand.scenario, service.scenario);
|
|
37
37
|
score += scenarioScore;
|
|
38
38
|
if (scenarioScore === WEIGHTS.scenario) {
|
|
39
|
-
reasons.push(
|
|
39
|
+
reasons.push(`Industry scenario matches (${service.scenario})`);
|
|
40
40
|
}
|
|
41
41
|
const trustScore = computeTrustScore(service.trustScore, demand.minTrustScore);
|
|
42
42
|
score += trustScore;
|
|
43
43
|
if (service.trustScore !== undefined) {
|
|
44
44
|
if (service.trustScore >= 75) {
|
|
45
|
-
reasons.push(
|
|
45
|
+
reasons.push(`High trust score (${service.trustScore}/100)`);
|
|
46
46
|
}
|
|
47
47
|
else if (service.trustScore < 50) {
|
|
48
|
-
warnings.push(
|
|
48
|
+
warnings.push(`Low trust score (${service.trustScore}/100)`);
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
const locationScore = computeLocationScore(demand.location, service.location);
|
|
52
52
|
score += locationScore;
|
|
53
53
|
if (locationScore === WEIGHTS.location && demand.location) {
|
|
54
|
-
reasons.push(
|
|
54
|
+
reasons.push(`Geographic location matches (${service.location})`);
|
|
55
55
|
}
|
|
56
56
|
const keywordScore = computeKeywordScore(demand.keywords, service.description);
|
|
57
57
|
score += keywordScore;
|
|
58
58
|
if (demand.minTrustScore !== undefined && service.trustScore !== undefined) {
|
|
59
59
|
if (service.trustScore < demand.minTrustScore) {
|
|
60
|
-
warnings.push(
|
|
60
|
+
warnings.push(`Trust score below requirement (${service.trustScore} < ${demand.minTrustScore})`);
|
|
61
61
|
score -= 10;
|
|
62
62
|
}
|
|
63
63
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
export const DYNAMIC_PRICING_VERSION = 1;
|
|
2
2
|
export const MUTABLE_FIELDS = [
|
|
3
|
-
{ field: "sales", purpose: "
|
|
4
|
-
{ field: "discount", purpose: "
|
|
5
|
-
{ field: "description", purpose: "
|
|
6
|
-
{ field: "rewards", purpose: "Reward
|
|
7
|
-
{ field: "arbitrations", purpose: "
|
|
8
|
-
{ field: "compensation_fund", purpose: "
|
|
9
|
-
{ field: "buy_guard", purpose: "
|
|
10
|
-
{ field: "pause", purpose: "
|
|
11
|
-
{ field: "machine", purpose: "
|
|
12
|
-
{ field: "order_allocators", purpose: "
|
|
13
|
-
{ field: "type_parameter", purpose: "
|
|
3
|
+
{ field: "sales", purpose: "Adjust product/price", mutableAfterPublish: true, adjustmentMechanism: "Service.sales mutable", metricToWatch: "Order rate" },
|
|
4
|
+
{ field: "discount", purpose: "Marketing promotion", mutableAfterPublish: true, adjustmentMechanism: "add/set/destroy", metricToWatch: "Conversion rate" },
|
|
5
|
+
{ field: "description", purpose: "Trust description", mutableAfterPublish: true, adjustmentMechanism: "mutable", metricToWatch: "Browse duration" },
|
|
6
|
+
{ field: "rewards", purpose: "Reward marketing campaigns", mutableAfterPublish: true, adjustmentMechanism: "add/remove", metricToWatch: "Repeat rate" },
|
|
7
|
+
{ field: "arbitrations", purpose: "Arbitration upgrade", mutableAfterPublish: true, adjustmentMechanism: "mutable", metricToWatch: "Arbitration rate" },
|
|
8
|
+
{ field: "compensation_fund", purpose: "Trust enhancement", mutableAfterPublish: true, adjustmentMechanism: "add", metricToWatch: "Trust score" },
|
|
9
|
+
{ field: "buy_guard", purpose: "Purchase threshold", mutableAfterPublish: true, adjustmentMechanism: "mutable", metricToWatch: "Order rate" },
|
|
10
|
+
{ field: "pause", purpose: "Pause/resume", mutableAfterPublish: true, adjustmentMechanism: "mutable", metricToWatch: "Inventory status" },
|
|
11
|
+
{ field: "machine", purpose: "Workflow template", mutableAfterPublish: false, adjustmentMechanism: "Locked after publish, new Service required", metricToWatch: "Process speed" },
|
|
12
|
+
{ field: "order_allocators", purpose: "Fund allocation", mutableAfterPublish: false, adjustmentMechanism: "Locked after publish, new Service required", metricToWatch: "Allocation fairness" },
|
|
13
|
+
{ field: "type_parameter", purpose: "Payment token", mutableAfterPublish: false, adjustmentMechanism: "Immutable, can create new Service + Reward to guide migration", metricToWatch: "Token preference" },
|
|
14
14
|
];
|
|
15
15
|
export function suggestPricing(signals) {
|
|
16
16
|
const { supplyCount, demandCount, avgPrice, myPrice, competitorPrices, recentOrderCount, repeatCustomerRate } = signals;
|
|
@@ -20,7 +20,7 @@ export function suggestPricing(signals) {
|
|
|
20
20
|
return {
|
|
21
21
|
action: "increase",
|
|
22
22
|
adjustmentPercent: increasePercent,
|
|
23
|
-
reason:
|
|
23
|
+
reason: `Demand/supply ratio ${supplyDemandRatio.toFixed(1)}, market demand exceeds supply, suggest price increase of ${increasePercent}%`,
|
|
24
24
|
confidence: Math.min(0.9, 0.5 + supplyDemandRatio * 0.1),
|
|
25
25
|
};
|
|
26
26
|
}
|
|
@@ -29,7 +29,7 @@ export function suggestPricing(signals) {
|
|
|
29
29
|
return {
|
|
30
30
|
action: "decrease",
|
|
31
31
|
adjustmentPercent: decreasePercent,
|
|
32
|
-
reason:
|
|
32
|
+
reason: `Demand/supply ratio ${supplyDemandRatio.toFixed(1)}, market supply exceeds demand, suggest price decrease of ${decreasePercent}% to improve competitiveness`,
|
|
33
33
|
confidence: Math.min(0.85, 0.5 + (1 - supplyDemandRatio) * 0.15),
|
|
34
34
|
};
|
|
35
35
|
}
|
|
@@ -42,7 +42,7 @@ export function suggestPricing(signals) {
|
|
|
42
42
|
return {
|
|
43
43
|
action: "decrease",
|
|
44
44
|
adjustmentPercent: 10,
|
|
45
|
-
reason:
|
|
45
|
+
reason: `Current price is 20%+ above market average, suggest price decrease to improve competitiveness`,
|
|
46
46
|
confidence: 0.7,
|
|
47
47
|
};
|
|
48
48
|
}
|
|
@@ -50,7 +50,7 @@ export function suggestPricing(signals) {
|
|
|
50
50
|
return {
|
|
51
51
|
action: "increase",
|
|
52
52
|
adjustmentPercent: 10,
|
|
53
|
-
reason:
|
|
53
|
+
reason: `Current price is 20%+ below market average, room for price increase`,
|
|
54
54
|
confidence: 0.65,
|
|
55
55
|
};
|
|
56
56
|
}
|
|
@@ -61,7 +61,7 @@ export function suggestPricing(signals) {
|
|
|
61
61
|
if (repeatCustomerRate !== undefined && repeatCustomerRate > 0.4) {
|
|
62
62
|
return {
|
|
63
63
|
action: "maintain",
|
|
64
|
-
reason:
|
|
64
|
+
reason: `Repeat customer rate ${Math.round(repeatCustomerRate * 100)}%, pricing strategy effective, suggest maintaining`,
|
|
65
65
|
confidence: 0.8,
|
|
66
66
|
};
|
|
67
67
|
}
|
|
@@ -69,13 +69,13 @@ export function suggestPricing(signals) {
|
|
|
69
69
|
return {
|
|
70
70
|
action: "decrease",
|
|
71
71
|
adjustmentPercent: 5,
|
|
72
|
-
reason:
|
|
72
|
+
reason: `Repeat customer rate only ${Math.round(repeatCustomerRate * 100)}%, suggest slight price decrease or add Reward to attract repeat purchases`,
|
|
73
73
|
confidence: 0.6,
|
|
74
74
|
};
|
|
75
75
|
}
|
|
76
76
|
return {
|
|
77
77
|
action: "maintain",
|
|
78
|
-
reason: "
|
|
78
|
+
reason: "Market supply and demand balanced, suggest maintaining current pricing",
|
|
79
79
|
confidence: 0.5,
|
|
80
80
|
};
|
|
81
81
|
}
|
|
@@ -204,7 +204,7 @@ export function injectEvolutionContext(_semantic, industry, role) {
|
|
|
204
204
|
if (!profile) {
|
|
205
205
|
return {
|
|
206
206
|
confidence: 0,
|
|
207
|
-
industry_signal:
|
|
207
|
+
industry_signal: `Industry ${resolved} is not yet registered; recommend synthesizing a profile via the generalizer engine`,
|
|
208
208
|
};
|
|
209
209
|
}
|
|
210
210
|
const health = latestHealth.get(resolved);
|
|
@@ -216,30 +216,30 @@ export function injectEvolutionContext(_semantic, industry, role) {
|
|
|
216
216
|
let advice;
|
|
217
217
|
let confidence = 0.5;
|
|
218
218
|
if (health) {
|
|
219
|
-
parts.push(
|
|
219
|
+
parts.push(`Industry health ${health.health_score}/100 (${health.level})`);
|
|
220
220
|
confidence = Math.max(confidence, 0.7);
|
|
221
221
|
if (health.weaknesses.length > 0) {
|
|
222
|
-
advice =
|
|
222
|
+
advice = `Weakness: ${health.weaknesses[0]}`;
|
|
223
223
|
}
|
|
224
224
|
if (health.recommendations.length > 0) {
|
|
225
225
|
advice = advice
|
|
226
|
-
? `${advice}
|
|
227
|
-
:
|
|
226
|
+
? `${advice}; recommendation: ${health.recommendations[0]}`
|
|
227
|
+
: `Recommendation: ${health.recommendations[0]}`;
|
|
228
228
|
}
|
|
229
229
|
}
|
|
230
230
|
if (metrics && metrics.anomalies.length > 0) {
|
|
231
|
-
parts.push(
|
|
231
|
+
parts.push(`Anomaly: ${metrics.anomalies[0]}`);
|
|
232
232
|
confidence = Math.max(confidence, 0.8);
|
|
233
233
|
}
|
|
234
234
|
if (signalCount > 0) {
|
|
235
|
-
parts.push(
|
|
235
|
+
parts.push(`Accumulated ${signalCount} industry signals`);
|
|
236
236
|
}
|
|
237
237
|
if (intent !== "default") {
|
|
238
|
-
parts.push(
|
|
238
|
+
parts.push(`Current intent: ${intent}`);
|
|
239
239
|
}
|
|
240
240
|
if (!advice && suggestions.length > 0) {
|
|
241
241
|
const highPriority = suggestions.find((s) => s.priority === "high") ?? suggestions[0];
|
|
242
|
-
advice = `${highPriority.suggestion_type}
|
|
242
|
+
advice = `${highPriority.suggestion_type}: ${highPriority.evidence}`;
|
|
243
243
|
confidence = Math.max(confidence, highPriority.confidence);
|
|
244
244
|
}
|
|
245
245
|
let roleAdvice;
|
|
@@ -253,11 +253,11 @@ export function injectEvolutionContext(_semantic, industry, role) {
|
|
|
253
253
|
filteredSuggestions = filterSuggestionsByRole(suggestions, role, triggers);
|
|
254
254
|
if (filteredSuggestions.length > 0) {
|
|
255
255
|
const topRole = filteredSuggestions.find((s) => s.priority === "high") ?? filteredSuggestions[0];
|
|
256
|
-
advice = `${topRole.suggestion_type}
|
|
256
|
+
advice = `${topRole.suggestion_type} (${role}): ${topRole.evidence}`;
|
|
257
257
|
}
|
|
258
258
|
}
|
|
259
259
|
return {
|
|
260
|
-
industry_signal: parts.length > 0 ? parts.join("
|
|
260
|
+
industry_signal: parts.length > 0 ? parts.join("; ") : undefined,
|
|
261
261
|
evolution_advice: advice,
|
|
262
262
|
confidence,
|
|
263
263
|
health_score: health?.health_score,
|