@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
|
@@ -79,7 +79,16 @@ export function getDefaultPreferences(industry) {
|
|
|
79
79
|
after_sales_expectation: tpl.after_sales_expectation,
|
|
80
80
|
};
|
|
81
81
|
}
|
|
82
|
+
let _registryLookup = null;
|
|
83
|
+
export function _setRegistryLookup(fn) {
|
|
84
|
+
_registryLookup = fn;
|
|
85
|
+
}
|
|
82
86
|
export function getIndustryTemplate(industry) {
|
|
87
|
+
if (_registryLookup) {
|
|
88
|
+
const profile = _registryLookup(industry);
|
|
89
|
+
if (profile?.preference_template)
|
|
90
|
+
return { ...profile.preference_template };
|
|
91
|
+
}
|
|
83
92
|
return { ...INDUSTRY_TEMPLATES[industry] };
|
|
84
93
|
}
|
|
85
94
|
export function inferPreferences(history, basePrefs) {
|
|
@@ -87,7 +96,7 @@ export function inferPreferences(history, basePrefs) {
|
|
|
87
96
|
const confidence = {};
|
|
88
97
|
const signals = [];
|
|
89
98
|
if (history.length < 3) {
|
|
90
|
-
signals.push(`history=${history.length} < 3
|
|
99
|
+
signals.push(`history=${history.length} < 3, keeping default preferences`);
|
|
91
100
|
return { preferences: prefs, confidence, signals };
|
|
92
101
|
}
|
|
93
102
|
const lowPricePicks = history.filter((h) => h.avg_market_price > 0n && h.price < (h.avg_market_price * 90n) / 100n);
|
|
@@ -96,28 +105,28 @@ export function inferPreferences(history, basePrefs) {
|
|
|
96
105
|
prefs.value_orientation = "budget";
|
|
97
106
|
confidence.price_sensitivity = 0.8;
|
|
98
107
|
confidence.value_orientation = 0.7;
|
|
99
|
-
signals.push(
|
|
108
|
+
signals.push(`Consecutive ${lowPricePicks.length} picks of Service priced 10%+ below average → price_sensitivity=high`);
|
|
100
109
|
}
|
|
101
110
|
else if (lowPricePicks.length >= 1) {
|
|
102
111
|
prefs.price_sensitivity = "medium";
|
|
103
112
|
confidence.price_sensitivity = 0.5;
|
|
104
|
-
signals.push(`${lowPricePicks.length}
|
|
113
|
+
signals.push(`${lowPricePicks.length} low-price picks → price_sensitivity=medium`);
|
|
105
114
|
}
|
|
106
115
|
const discountUsers = history.filter((h) => h.used_discount);
|
|
107
116
|
if (discountUsers.length >= 2) {
|
|
108
117
|
prefs.discount_sensitivity = 0.8;
|
|
109
118
|
confidence.discount_sensitivity = 0.85;
|
|
110
|
-
signals.push(
|
|
119
|
+
signals.push(`Used discount ${discountUsers.length} times → discount_sensitivity=0.8`);
|
|
111
120
|
}
|
|
112
121
|
if (history.some((h) => h.used_referral)) {
|
|
113
122
|
prefs.referral_participation = true;
|
|
114
123
|
confidence.referral_participation = 1.0;
|
|
115
|
-
signals.push("
|
|
124
|
+
signals.push("Has used a referral code → referral_participation=true");
|
|
116
125
|
}
|
|
117
126
|
if (discountUsers.length >= 2 || history.some((h) => h.used_referral)) {
|
|
118
127
|
prefs.reward_seeking = true;
|
|
119
128
|
confidence.reward_seeking = 0.75;
|
|
120
|
-
signals.push("Reward
|
|
129
|
+
signals.push("Reward behavior detected → reward_seeking=true");
|
|
121
130
|
}
|
|
122
131
|
const bargainSignals = discountUsers.length + (history.some((h) => h.used_referral) ? 1 : 0);
|
|
123
132
|
if (bargainSignals >= 3) {
|
|
@@ -142,24 +151,24 @@ export function inferPreferences(history, basePrefs) {
|
|
|
142
151
|
if (preferredIndustries.length > 0) {
|
|
143
152
|
prefs.preferred_industries = preferredIndustries;
|
|
144
153
|
confidence.preferred_industries = Math.min(1, (industryCounts.get(preferredIndustries[0]) ?? 0) / 5);
|
|
145
|
-
signals.push(
|
|
154
|
+
signals.push(`Preferred industries: ${preferredIndustries.join(", ")}`);
|
|
146
155
|
}
|
|
147
156
|
const arbPicks = history.filter((h) => h.has_arbitration);
|
|
148
157
|
if (arbPicks.length >= 3 && arbPicks.length === history.length) {
|
|
149
158
|
prefs.require_arbitration = true;
|
|
150
159
|
confidence.require_arbitration = 0.85;
|
|
151
|
-
signals.push("100%
|
|
160
|
+
signals.push("100% of historical orders picked Services with arbitration → require_arbitration=true (confirmed)");
|
|
152
161
|
}
|
|
153
162
|
else if (arbPicks.length < history.length / 2) {
|
|
154
163
|
prefs.require_arbitration = false;
|
|
155
164
|
confidence.require_arbitration = 0.5;
|
|
156
|
-
signals.push(`${arbPicks.length}/${history.length}
|
|
165
|
+
signals.push(`${arbPicks.length}/${history.length} orders had arbitration → require_arbitration=false`);
|
|
157
166
|
}
|
|
158
167
|
const compPicks = history.filter((h) => h.has_compensation);
|
|
159
168
|
if (compPicks.length >= 3 && compPicks.length === history.length) {
|
|
160
169
|
prefs.require_compensation_fund = true;
|
|
161
170
|
confidence.require_compensation_fund = 0.85;
|
|
162
|
-
signals.push("100%
|
|
171
|
+
signals.push("100% of historical orders had compensation fund → require_compensation_fund=true (confirmed)");
|
|
163
172
|
}
|
|
164
173
|
else if (compPicks.length < history.length / 2) {
|
|
165
174
|
prefs.require_compensation_fund = false;
|
|
@@ -175,13 +184,13 @@ export function inferPreferences(history, basePrefs) {
|
|
|
175
184
|
prefs.min_trust_score = 70;
|
|
176
185
|
confidence.risk_appetite = 0.8;
|
|
177
186
|
confidence.min_trust_score = 0.7;
|
|
178
|
-
signals.push(
|
|
187
|
+
signals.push(`Lowest risk score in history ${minRisk} ≥ 70 → risk_appetite=conservative`);
|
|
179
188
|
}
|
|
180
189
|
else if (minRisk < 50) {
|
|
181
190
|
prefs.risk_appetite = "aggressive";
|
|
182
191
|
prefs.min_trust_score = Math.max(0, minRisk - 10);
|
|
183
192
|
confidence.risk_appetite = 0.7;
|
|
184
|
-
signals.push(
|
|
193
|
+
signals.push(`Lowest risk score in history ${minRisk} < 50 → risk_appetite=aggressive`);
|
|
185
194
|
}
|
|
186
195
|
}
|
|
187
196
|
const messengerUsers = history.filter((h) => h.used_messenger);
|
|
@@ -190,12 +199,12 @@ export function inferPreferences(history, basePrefs) {
|
|
|
190
199
|
if (avgMsgs >= 10) {
|
|
191
200
|
prefs.communication_style = "formal";
|
|
192
201
|
confidence.communication_style = 0.6;
|
|
193
|
-
signals.push(
|
|
202
|
+
signals.push(`Average ${avgMsgs.toFixed(1)} Messenger messages → communication_style=formal`);
|
|
194
203
|
}
|
|
195
204
|
else if (avgMsgs <= 3) {
|
|
196
205
|
prefs.communication_style = "casual";
|
|
197
206
|
confidence.communication_style = 0.5;
|
|
198
|
-
signals.push(
|
|
207
|
+
signals.push(`Average ${avgMsgs.toFixed(1)} Messenger messages → communication_style=casual`);
|
|
199
208
|
}
|
|
200
209
|
prefs.transparency_demand = Math.min(1, avgMsgs / 20);
|
|
201
210
|
confidence.transparency_demand = 0.6;
|
|
@@ -206,7 +215,7 @@ export function inferPreferences(history, basePrefs) {
|
|
|
206
215
|
prefs.after_sales_expectation = "full";
|
|
207
216
|
confidence.transparency_demand = Math.max(confidence.transparency_demand ?? 0, 0.7);
|
|
208
217
|
confidence.after_sales_expectation = 0.7;
|
|
209
|
-
signals.push(`${disputedCount}
|
|
218
|
+
signals.push(`${disputedCount} disputes → transparency_demand increased, after_sales=full`);
|
|
210
219
|
}
|
|
211
220
|
const merchantCounts = new Map();
|
|
212
221
|
for (const h of history) {
|
|
@@ -221,7 +230,7 @@ export function inferPreferences(history, basePrefs) {
|
|
|
221
230
|
.map(([m]) => m);
|
|
222
231
|
if (prefs.preferred_merchants.length > 0) {
|
|
223
232
|
confidence.preferred_merchants = 0.8;
|
|
224
|
-
signals.push(
|
|
233
|
+
signals.push(`Patronized ${prefs.preferred_merchants.length} merchants ≥2 times`);
|
|
225
234
|
}
|
|
226
235
|
return { preferences: prefs, confidence, signals };
|
|
227
236
|
}
|
|
@@ -235,14 +244,14 @@ export function matchServiceToPreferences(service, prefs) {
|
|
|
235
244
|
if (prefs.budget_range) {
|
|
236
245
|
if (service.price >= prefs.budget_range.min && service.price <= prefs.budget_range.max) {
|
|
237
246
|
score += 20;
|
|
238
|
-
matches.push("
|
|
247
|
+
matches.push("Price within budget range");
|
|
239
248
|
}
|
|
240
249
|
else if (service.price < prefs.budget_range.min) {
|
|
241
250
|
score += 15;
|
|
242
|
-
matches.push("
|
|
251
|
+
matches.push("Price below budget minimum");
|
|
243
252
|
}
|
|
244
253
|
else {
|
|
245
|
-
mismatches.push("
|
|
254
|
+
mismatches.push("Price exceeds budget maximum");
|
|
246
255
|
}
|
|
247
256
|
}
|
|
248
257
|
else if (service.avg_market_price && service.avg_market_price > 0n) {
|
|
@@ -250,30 +259,30 @@ export function matchServiceToPreferences(service, prefs) {
|
|
|
250
259
|
if (prefs.price_sensitivity === "high") {
|
|
251
260
|
if (ratio <= 0.9) {
|
|
252
261
|
score += 25;
|
|
253
|
-
matches.push(
|
|
262
|
+
matches.push(`Price is ${(1 - ratio) * 100 | 0}% below average (bonus for high-sensitivity user)`);
|
|
254
263
|
}
|
|
255
264
|
else if (ratio <= 1.1) {
|
|
256
265
|
score += 15;
|
|
257
|
-
matches.push("
|
|
266
|
+
matches.push("Price on par with average");
|
|
258
267
|
}
|
|
259
268
|
else {
|
|
260
|
-
mismatches.push(
|
|
269
|
+
mismatches.push(`Price is ${((ratio - 1) * 100 | 0)}% above average (high-sensitivity user)`);
|
|
261
270
|
}
|
|
262
271
|
}
|
|
263
272
|
else if (prefs.price_sensitivity === "low") {
|
|
264
273
|
score += 20;
|
|
265
|
-
matches.push("
|
|
274
|
+
matches.push("Low price sensitivity");
|
|
266
275
|
}
|
|
267
276
|
else {
|
|
268
277
|
if (ratio <= 1.0) {
|
|
269
278
|
score += 20;
|
|
270
|
-
matches.push("
|
|
279
|
+
matches.push("Price not above average");
|
|
271
280
|
}
|
|
272
281
|
else if (ratio <= 1.2) {
|
|
273
282
|
score += 12;
|
|
274
283
|
}
|
|
275
284
|
else {
|
|
276
|
-
mismatches.push("
|
|
285
|
+
mismatches.push("Price significantly above average");
|
|
277
286
|
}
|
|
278
287
|
}
|
|
279
288
|
}
|
|
@@ -285,17 +294,17 @@ export function matchServiceToPreferences(service, prefs) {
|
|
|
285
294
|
if (cycle > 0) {
|
|
286
295
|
if (cycle <= prefs.max_acceptable_cycle) {
|
|
287
296
|
score += 10;
|
|
288
|
-
matches.push(
|
|
297
|
+
matches.push(`Delivery cycle ${cycle} days ≤ expected ${prefs.max_acceptable_cycle} days`);
|
|
289
298
|
if (prefs.delivery_speed_priority === "urgent" && cycle <= Math.max(1, prefs.max_acceptable_cycle / 3)) {
|
|
290
299
|
score += 5;
|
|
291
|
-
matches.push("
|
|
300
|
+
matches.push("Urgent delivery need satisfied");
|
|
292
301
|
}
|
|
293
302
|
else if (prefs.delivery_speed_priority === "urgent") {
|
|
294
|
-
warnings.push("
|
|
303
|
+
warnings.push("Urgent delivery need but cycle is long");
|
|
295
304
|
}
|
|
296
305
|
}
|
|
297
306
|
else {
|
|
298
|
-
mismatches.push(
|
|
307
|
+
mismatches.push(`Delivery cycle ${cycle} days > expected ${prefs.max_acceptable_cycle} days`);
|
|
299
308
|
}
|
|
300
309
|
}
|
|
301
310
|
else {
|
|
@@ -305,10 +314,10 @@ export function matchServiceToPreferences(service, prefs) {
|
|
|
305
314
|
if (prefs.preferred_region) {
|
|
306
315
|
if (service.merchant_region && service.merchant_region === prefs.preferred_region) {
|
|
307
316
|
score += 10;
|
|
308
|
-
matches.push(
|
|
317
|
+
matches.push(`Merchant region ${service.merchant_region} matches preference`);
|
|
309
318
|
}
|
|
310
319
|
else if (service.merchant_region) {
|
|
311
|
-
mismatches.push(
|
|
320
|
+
mismatches.push(`Merchant region ${service.merchant_region} does not match preference ${prefs.preferred_region}`);
|
|
312
321
|
}
|
|
313
322
|
else {
|
|
314
323
|
score += 5;
|
|
@@ -320,18 +329,18 @@ export function matchServiceToPreferences(service, prefs) {
|
|
|
320
329
|
maxScore += 10;
|
|
321
330
|
if (service.merchant_order_history_count >= prefs.min_order_history) {
|
|
322
331
|
score += 7;
|
|
323
|
-
matches.push(
|
|
332
|
+
matches.push(`Merchant history ${service.merchant_order_history_count} orders ≥ required ${prefs.min_order_history} orders`);
|
|
324
333
|
}
|
|
325
334
|
else {
|
|
326
|
-
mismatches.push(
|
|
335
|
+
mismatches.push(`Merchant history ${service.merchant_order_history_count} orders < required ${prefs.min_order_history} orders`);
|
|
327
336
|
}
|
|
328
337
|
if (prefs.merchant_preference !== "neutral") {
|
|
329
338
|
if (service.merchant_age === prefs.merchant_preference) {
|
|
330
339
|
score += 3;
|
|
331
|
-
matches.push(
|
|
340
|
+
matches.push(`Merchant type ${service.merchant_age} matches preference`);
|
|
332
341
|
}
|
|
333
342
|
else if (service.merchant_age !== "unknown") {
|
|
334
|
-
mismatches.push(
|
|
343
|
+
mismatches.push(`Merchant type ${service.merchant_age} ≠ preference ${prefs.merchant_preference}`);
|
|
335
344
|
}
|
|
336
345
|
}
|
|
337
346
|
else {
|
|
@@ -341,14 +350,14 @@ export function matchServiceToPreferences(service, prefs) {
|
|
|
341
350
|
let bargainScore = 0;
|
|
342
351
|
if (service.has_reward_activity) {
|
|
343
352
|
bargainScore += 8;
|
|
344
|
-
matches.push("
|
|
353
|
+
matches.push("Has Reward activity");
|
|
345
354
|
}
|
|
346
355
|
if (service.has_discount) {
|
|
347
356
|
bargainScore += 7;
|
|
348
|
-
matches.push("
|
|
357
|
+
matches.push("Has discount");
|
|
349
358
|
}
|
|
350
359
|
if (prefs.bargain_hunting >= 0.7 && bargainScore === 0) {
|
|
351
|
-
mismatches.push("
|
|
360
|
+
mismatches.push("User has high bargain_hunting but no Reward/discount");
|
|
352
361
|
}
|
|
353
362
|
else if (prefs.bargain_hunting < 0.3) {
|
|
354
363
|
if (bargainScore === 0)
|
|
@@ -363,22 +372,22 @@ export function matchServiceToPreferences(service, prefs) {
|
|
|
363
372
|
maxScore += 10;
|
|
364
373
|
if (service.after_sales_support_level === prefs.after_sales_expectation) {
|
|
365
374
|
score += 5;
|
|
366
|
-
matches.push(
|
|
375
|
+
matches.push(`After-sales support ${service.after_sales_support_level} matches expectation`);
|
|
367
376
|
}
|
|
368
377
|
else if ((prefs.after_sales_expectation === "full" && service.after_sales_support_level === "basic") ||
|
|
369
378
|
(prefs.after_sales_expectation === "full" && service.after_sales_support_level === "minimal") ||
|
|
370
379
|
(prefs.after_sales_expectation === "basic" && service.after_sales_support_level === "minimal")) {
|
|
371
|
-
mismatches.push(
|
|
380
|
+
mismatches.push(`After-sales support ${service.after_sales_support_level} < expectation ${prefs.after_sales_expectation}`);
|
|
372
381
|
}
|
|
373
382
|
else {
|
|
374
383
|
score += 3;
|
|
375
384
|
}
|
|
376
385
|
if (prefs.transparency_demand >= 0.7 && service.requires_messenger) {
|
|
377
386
|
score += 5;
|
|
378
|
-
matches.push("
|
|
387
|
+
matches.push("Merchant supports Messenger communication (high transparency demand)");
|
|
379
388
|
}
|
|
380
389
|
else if (prefs.transparency_demand >= 0.7 && !service.requires_messenger) {
|
|
381
|
-
mismatches.push("
|
|
390
|
+
mismatches.push("High transparency demand but merchant has no Messenger");
|
|
382
391
|
}
|
|
383
392
|
else {
|
|
384
393
|
score += 3;
|
|
@@ -386,19 +395,19 @@ export function matchServiceToPreferences(service, prefs) {
|
|
|
386
395
|
maxScore += 15;
|
|
387
396
|
if (service.risk_score >= prefs.min_trust_score) {
|
|
388
397
|
score += 8;
|
|
389
|
-
matches.push(
|
|
398
|
+
matches.push(`Risk score ${service.risk_score} ≥ required ${prefs.min_trust_score}`);
|
|
390
399
|
}
|
|
391
400
|
else {
|
|
392
|
-
mismatches.push(
|
|
401
|
+
mismatches.push(`Risk score ${service.risk_score} < required ${prefs.min_trust_score}`);
|
|
393
402
|
}
|
|
394
403
|
if (prefs.require_arbitration) {
|
|
395
404
|
if (service.has_arbitration) {
|
|
396
405
|
score += 4;
|
|
397
|
-
matches.push("
|
|
406
|
+
matches.push("Arbitration configured");
|
|
398
407
|
}
|
|
399
408
|
else {
|
|
400
|
-
mismatches.push("
|
|
401
|
-
warnings.push("⚠️
|
|
409
|
+
mismatches.push("User requires arbitration but Service is not configured");
|
|
410
|
+
warnings.push("⚠️ No arbitration: user preference requires arbitration as mandatory");
|
|
402
411
|
}
|
|
403
412
|
}
|
|
404
413
|
else {
|
|
@@ -407,11 +416,11 @@ export function matchServiceToPreferences(service, prefs) {
|
|
|
407
416
|
if (prefs.require_compensation_fund) {
|
|
408
417
|
if (service.has_compensation_fund) {
|
|
409
418
|
score += 3;
|
|
410
|
-
matches.push("
|
|
419
|
+
matches.push("Has compensation fund");
|
|
411
420
|
}
|
|
412
421
|
else {
|
|
413
|
-
mismatches.push("
|
|
414
|
-
warnings.push("⚠️
|
|
422
|
+
mismatches.push("User requires compensation fund but Service has none");
|
|
423
|
+
warnings.push("⚠️ No compensation fund: user preference requires it as mandatory");
|
|
415
424
|
}
|
|
416
425
|
}
|
|
417
426
|
else {
|
|
@@ -23,12 +23,12 @@ const URGENCY_RULES = [
|
|
|
23
23
|
{ operation_type: "local_info", urgency: "low" },
|
|
24
24
|
];
|
|
25
25
|
const SCENARIO_RULES = [
|
|
26
|
-
{ signals: (d) => typeof d?.description === "string" && /freelance
|
|
27
|
-
{ signals: (d) => typeof d?.description === "string" && /rental
|
|
28
|
-
{ signals: (d) => typeof d?.description === "string" && /course
|
|
29
|
-
{ signals: (d) => typeof d?.description === "string" && /travel
|
|
30
|
-
{ signals: (d) => typeof d?.description === "string" && /subscri
|
|
31
|
-
{ signals: (d) => typeof d?.namedNew?.name === "string" && /shop|store
|
|
26
|
+
{ signals: (d) => typeof d?.description === "string" && /freelance|freelancer|design|development|outsourcing/i.test(d.description), scenario: "freelance" },
|
|
27
|
+
{ signals: (d) => typeof d?.description === "string" && /rental|rent|lease/i.test(d.description), scenario: "rental" },
|
|
28
|
+
{ signals: (d) => typeof d?.description === "string" && /course|education|training/i.test(d.description), scenario: "education" },
|
|
29
|
+
{ signals: (d) => typeof d?.description === "string" && /travel|tour|trip/i.test(d.description), scenario: "travel" },
|
|
30
|
+
{ signals: (d) => typeof d?.description === "string" && /subscri|subscription|membership/i.test(d.description), scenario: "subscription" },
|
|
31
|
+
{ signals: (d) => typeof d?.namedNew?.name === "string" && /shop|store|retail/i.test(d.namedNew.name), scenario: "retail" },
|
|
32
32
|
];
|
|
33
33
|
const SECONDARY_INTENT_RULES = [
|
|
34
34
|
{ signals: (d) => d?.publish === true, intent: "immutable_commit" },
|
|
@@ -2,6 +2,8 @@ import { distillIntent, extractSignals } from "./intent-distill.js";
|
|
|
2
2
|
import { getProfile, updateFromOperation } from "./user-profile.js";
|
|
3
3
|
import { findMatches, recordSignature } from "./experience-reuse.js";
|
|
4
4
|
import { EXPERIENCE_LAYER_VERSION } from "./types.js";
|
|
5
|
+
import { isEnabled as isRuntimeEnabled } from "../config/index.js";
|
|
6
|
+
import { recordIndustrySignal } from "../knowledge/flywheel-loop.js";
|
|
5
7
|
export { EXPERIENCE_LAYER_VERSION };
|
|
6
8
|
export function getExperienceFeedback(operation_type, data, baseIntent) {
|
|
7
9
|
try {
|
|
@@ -30,6 +32,21 @@ export function recordOperationOutcome(operation_type, data, baseIntent, outcome
|
|
|
30
32
|
error_code: errorCode,
|
|
31
33
|
});
|
|
32
34
|
updateFromOperation(distilled.primary_intent, distilled.scenario, outcome, errorCode, referencedObjects);
|
|
35
|
+
try {
|
|
36
|
+
if (isRuntimeEnabled("industry_evolution")) {
|
|
37
|
+
const industryHint = (typeof data?.industry === "string" && data.industry.trim())
|
|
38
|
+
? data.industry.trim()
|
|
39
|
+
: undefined;
|
|
40
|
+
if (industryHint) {
|
|
41
|
+
const signalOutcome = outcome === "success"
|
|
42
|
+
? { success: true }
|
|
43
|
+
: { success: false, error_code: errorCode };
|
|
44
|
+
recordIndustrySignal(industryHint, { type: operation_type, data }, signalOutcome);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
}
|
|
33
50
|
}
|
|
34
51
|
catch {
|
|
35
52
|
}
|