@wowok/agent-mcp 2.6.1 → 2.6.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/info-puzzle.d.ts +1 -1
- package/dist/customer/info-puzzle.js +4 -2
- package/dist/customer/risk-assessment.js +26 -4
- package/dist/customer/types.d.ts +2 -0
- package/dist/examples/guard-template-balance-check.json +38 -0
- package/dist/examples/guard-template-time-lock.json +39 -0
- package/dist/examples/machine-template-7node-rental.json +114 -0
- package/dist/examples/rental-ziroom-machine-create.json +137 -0
- package/dist/examples/rental-ziroom-permission-create.json +35 -0
- package/dist/examples/rental-ziroom-service-create.json +80 -0
- package/dist/examples/retail-myshop-service-create.json +88 -0
- package/dist/extensions/capability-manifest.js +24 -24
- package/dist/extensions/constraint-registry.js +18 -18
- package/dist/extensions/metric-registry.js +14 -14
- package/dist/extensions/mode-evaluator.js +16 -16
- package/dist/extensions/modes.js +131 -45
- package/dist/extensions/registry.d.ts +2 -0
- package/dist/extensions/registry.js +63 -30
- package/dist/extensions/types.d.ts +1 -0
- package/dist/index.js +50 -0
- package/dist/knowledge/deployment-scanner.js +1 -1
- package/dist/knowledge/fund-layer.d.ts +72 -0
- package/dist/knowledge/fund-layer.js +420 -0
- package/dist/knowledge/guard-render.d.ts +57 -0
- package/dist/knowledge/guard-render.js +700 -0
- package/dist/knowledge/guard-submission-prompt.d.ts +31 -0
- package/dist/knowledge/guard-submission-prompt.js +171 -0
- package/dist/knowledge/machine-ledger.js +1 -1
- package/dist/knowledge/machine-render.d.ts +41 -0
- package/dist/knowledge/machine-render.js +565 -0
- package/dist/knowledge/machine-templates.js +4 -4
- package/dist/knowledge/reward-confirm.js +2 -2
- package/dist/knowledge/reward-puzzle.js +1 -1
- package/dist/knowledge/reward-risk.js +9 -9
- package/dist/knowledge/reward-templates.js +2 -2
- package/dist/knowledge/service-confirm.d.ts +1 -1
- package/dist/knowledge/service-confirm.js +3 -3
- package/dist/knowledge/service-context.js +1 -1
- package/dist/knowledge/service-ledger.js +1 -1
- package/dist/knowledge/service-risk.d.ts +1 -1
- package/dist/knowledge/service-risk.js +3 -3
- package/dist/knowledge/service-templates.js +2 -2
- package/dist/knowledge/service-translation.d.ts +1 -1
- package/dist/knowledge/service-translation.js +7 -7
- package/dist/project/deployment-bridge.js +6 -5
- package/dist/project/deployment-doc.js +5 -5
- package/dist/project/edit-planner.d.ts +123 -0
- package/dist/project/edit-planner.js +1371 -0
- package/dist/project/evaluation.js +314 -14
- package/dist/project/graph-builder.js +6 -1
- package/dist/project/handlers.d.ts +99 -2
- package/dist/project/handlers.js +358 -16
- package/dist/project/stage-gate.js +4 -4
- package/dist/schema/call/allocation.js +2 -2
- package/dist/schema/call/arbitration.js +19 -6
- package/dist/schema/call/contact.js +2 -2
- package/dist/schema/call/demand.js +2 -2
- package/dist/schema/call/guard.js +1 -1
- package/dist/schema/call/machine.d.ts +1975 -777
- package/dist/schema/call/machine.js +50 -4
- package/dist/schema/call/order.js +3 -6
- package/dist/schema/call/permission.js +2 -2
- package/dist/schema/call/repository.js +2 -2
- package/dist/schema/call/reward.js +3 -3
- package/dist/schema/call/semantic.js +7 -1
- package/dist/schema/call/service.d.ts +180 -8
- package/dist/schema/call/service.js +82 -27
- package/dist/schema/call/treasury.js +3 -3
- package/dist/schema/common/index.d.ts +2 -0
- package/dist/schema/common/index.js +46 -10
- package/dist/schema/local/index.js +5 -1
- package/dist/schema/operations.d.ts +755 -176
- package/dist/schema/operations.js +43 -7
- package/dist/schema/project/index.d.ts +969 -6
- package/dist/schema/project/index.js +268 -4
- package/dist/schema/query/index.d.ts +217 -0
- package/dist/schema/query/index.js +63 -33
- package/dist/schema/schema-query/index.d.ts +53 -3
- package/dist/schema/schema-query/index.js +17 -2
- package/dist/schema/utils/node-parser.js +13 -0
- package/dist/schema/utils/object-type-utils.d.ts +12 -0
- package/dist/schema/utils/object-type-utils.js +35 -0
- package/dist/schema/utils/permission-machine-check.d.ts +49 -0
- package/dist/schema/utils/permission-machine-check.js +121 -0
- package/dist/schema/utils/skills-recommendation.d.ts +2 -0
- package/dist/schema/utils/skills-recommendation.js +76 -0
- package/dist/schema-query/index.d.ts +14 -1
- package/dist/schema-query/index.js +104 -2
- package/dist/schemas/account_operation.schema.json +1 -1
- package/dist/schemas/index.json +1 -1
- package/dist/schemas/onchain_events.output.json +1 -1
- package/dist/schemas/onchain_operations.output.json +2820 -0
- package/dist/schemas/onchain_operations.schema.json +115 -53
- package/dist/schemas/onchain_operations_allocation.schema.json +5 -5
- package/dist/schemas/onchain_operations_arbitration.schema.json +9 -7
- package/dist/schemas/onchain_operations_contact.schema.json +3 -3
- package/dist/schemas/onchain_operations_demand.schema.json +3 -3
- package/dist/schemas/onchain_operations_gen_passport.schema.json +2 -2
- package/dist/schemas/onchain_operations_guard.schema.json +1 -1
- package/dist/schemas/onchain_operations_machine.schema.json +4 -4
- package/dist/schemas/onchain_operations_order.schema.json +3 -3
- package/dist/schemas/onchain_operations_payment.schema.json +1 -1
- package/dist/schemas/onchain_operations_permission.schema.json +2 -2
- package/dist/schemas/onchain_operations_progress.schema.json +1 -1
- package/dist/schemas/onchain_operations_proof.schema.json +1 -1
- package/dist/schemas/onchain_operations_repository.schema.json +3 -3
- package/dist/schemas/onchain_operations_reward.schema.json +6 -6
- package/dist/schemas/onchain_operations_service.schema.json +77 -17
- package/dist/schemas/onchain_operations_treasury.schema.json +4 -4
- package/dist/schemas/onchain_table_data.output.json +1 -1
- package/dist/schemas/onchain_table_data.schema.json +10 -9
- package/dist/schemas/project_operation.output.json +1026 -7
- package/dist/schemas/project_operation.schema.json +46 -4
- package/dist/schemas/query_toolkit.output.json +15 -15
- package/dist/schemas/query_toolkit.schema.json +3 -3
- package/dist/schemas/schema_query.output.json +64 -1
- package/dist/schemas/schema_query.schema.json +3 -2
- package/dist/schemas/wowok_buildin_info.output.json +81 -8
- package/dist/schemas/wowok_buildin_info.schema.json +46 -2
- package/dist/tools/handlers/onchain.js +571 -6
- package/dist/tools/handlers/project.js +25 -2
- package/dist/tools/handlers/schema-query.js +24 -1
- package/dist/tools/index.d.ts +8 -0
- package/dist/tools/index.js +177 -6
- package/package.json +2 -2
|
@@ -117,19 +117,19 @@ export class CapabilityRegistry {
|
|
|
117
117
|
: Math.round(((covered.length - conflicting.length) / (covered.length + missing.length)) * 100);
|
|
118
118
|
const recommendations = [];
|
|
119
119
|
if (missing.length > 0) {
|
|
120
|
-
recommendations.push(
|
|
120
|
+
recommendations.push(`Missing ${missing.length} capabilities, need to add: ${missing.slice(0, 5).join(", ")}${missing.length > 5 ? "..." : ""}`);
|
|
121
121
|
}
|
|
122
122
|
if (conflicting.length > 0) {
|
|
123
|
-
recommendations.push(
|
|
123
|
+
recommendations.push(`Detected ${conflicting.length} capabilities with large parameter differences, need to rewrite configuration`);
|
|
124
124
|
}
|
|
125
125
|
if (feasibility_score >= 80) {
|
|
126
|
-
recommendations.push("
|
|
126
|
+
recommendations.push("Migration feasibility is high, most capabilities can be reused directly");
|
|
127
127
|
}
|
|
128
128
|
else if (feasibility_score >= 50) {
|
|
129
|
-
recommendations.push("
|
|
129
|
+
recommendations.push("Migration feasibility is medium, need to supplement or rewrite some capabilities");
|
|
130
130
|
}
|
|
131
131
|
else {
|
|
132
|
-
recommendations.push("
|
|
132
|
+
recommendations.push("Migration feasibility is low, recommend regenerating the plan based on the target industry template");
|
|
133
133
|
}
|
|
134
134
|
return {
|
|
135
135
|
feasibility_score,
|
|
@@ -207,7 +207,7 @@ export class CapabilityRegistry {
|
|
|
207
207
|
this.registerCard({
|
|
208
208
|
capability_id: "permission.index_create",
|
|
209
209
|
display_name: "Permission Index Create",
|
|
210
|
-
description: "
|
|
210
|
+
description: "Create role permission index, supports multi-role permission assignment such as merchant/customer/arbiter",
|
|
211
211
|
object_type: "permission", module: "handler", category: "trust",
|
|
212
212
|
industry_agnostic: "high",
|
|
213
213
|
config_template: {
|
|
@@ -233,7 +233,7 @@ export class CapabilityRegistry {
|
|
|
233
233
|
this.registerCard({
|
|
234
234
|
capability_id: "permission.role_assign",
|
|
235
235
|
display_name: "Permission Role Assign",
|
|
236
|
-
description: "
|
|
236
|
+
description: "Assign role permission index to objects (Machine/Service/Allocation)",
|
|
237
237
|
object_type: "permission", module: "handler", category: "trust",
|
|
238
238
|
industry_agnostic: "high",
|
|
239
239
|
config_template: { target_object: "<obj>", role: "<role_name>" },
|
|
@@ -243,7 +243,7 @@ export class CapabilityRegistry {
|
|
|
243
243
|
this.registerCard({
|
|
244
244
|
capability_id: "guard.validate_buy",
|
|
245
245
|
display_name: "Guard Validate Buy",
|
|
246
|
-
description: "
|
|
246
|
+
description: "Order validation: check buyer eligibility, order parameters, inventory and other conditions",
|
|
247
247
|
object_type: "guard", module: "handler", category: "validation",
|
|
248
248
|
industry_agnostic: "medium",
|
|
249
249
|
config_template: { host: "service", templates: [] },
|
|
@@ -258,7 +258,7 @@ export class CapabilityRegistry {
|
|
|
258
258
|
this.registerCard({
|
|
259
259
|
capability_id: "guard.validate_wip_hash",
|
|
260
260
|
display_name: "Guard Validate WIP Hash",
|
|
261
|
-
description: "
|
|
261
|
+
description: "Validate WIP (Work-In-Progress) hash, used for milestone validation of digital deliverables",
|
|
262
262
|
object_type: "guard", module: "handler", category: "evidence",
|
|
263
263
|
industry_agnostic: "low",
|
|
264
264
|
config_template: { host: "machine", templates: ["tpl_validate_wip_hash"] },
|
|
@@ -272,7 +272,7 @@ export class CapabilityRegistry {
|
|
|
272
272
|
this.registerCard({
|
|
273
273
|
capability_id: "machine.node_topology",
|
|
274
274
|
display_name: "Machine Node Topology",
|
|
275
|
-
description: "
|
|
275
|
+
description: "Workflow node topology: define the state machine from order creation to completion",
|
|
276
276
|
object_type: "machine", module: "templates", category: "workflow",
|
|
277
277
|
industry_agnostic: "low",
|
|
278
278
|
config_template: {
|
|
@@ -311,7 +311,7 @@ export class CapabilityRegistry {
|
|
|
311
311
|
this.registerCard({
|
|
312
312
|
capability_id: "treasury.owner_receive",
|
|
313
313
|
display_name: "Treasury Owner Receive",
|
|
314
|
-
description: "
|
|
314
|
+
description: "Fund escrow: supports owner_receive mode, funds go directly into the object owner wallet",
|
|
315
315
|
object_type: "treasury", module: "handler", category: "fund_flow",
|
|
316
316
|
industry_agnostic: "high",
|
|
317
317
|
config_template: { owner_receive: true },
|
|
@@ -321,7 +321,7 @@ export class CapabilityRegistry {
|
|
|
321
321
|
this.registerCard({
|
|
322
322
|
capability_id: "allocation.distribute",
|
|
323
323
|
display_name: "Multi-tier Allocation Distribution",
|
|
324
|
-
description: "
|
|
324
|
+
description: "Multi-tier allocation: supports distributing funds to multiple recipients by ratio / by order / by condition",
|
|
325
325
|
object_type: "allocation", module: "handler", category: "fund_flow",
|
|
326
326
|
industry_agnostic: "medium",
|
|
327
327
|
config_template: {
|
|
@@ -339,7 +339,7 @@ export class CapabilityRegistry {
|
|
|
339
339
|
this.registerCard({
|
|
340
340
|
capability_id: "allocation.distribute_milestone",
|
|
341
341
|
display_name: "Milestone-based Allocation",
|
|
342
|
-
description: "
|
|
342
|
+
description: "Milestone allocation: release funds by delivery milestones, each milestone requires WIP hash validation",
|
|
343
343
|
object_type: "allocation", module: "handler", category: "fund_flow",
|
|
344
344
|
industry_agnostic: "low",
|
|
345
345
|
config_template: {
|
|
@@ -355,7 +355,7 @@ export class CapabilityRegistry {
|
|
|
355
355
|
this.registerCard({
|
|
356
356
|
capability_id: "service.publish",
|
|
357
357
|
display_name: "Service Publish",
|
|
358
|
-
description: "
|
|
358
|
+
description: "Publish Service object on-chain, bind Machine/Guard/Permission/Allocation and other dependencies",
|
|
359
359
|
object_type: "service", module: "handler", category: "lifecycle",
|
|
360
360
|
industry_agnostic: "high",
|
|
361
361
|
config_template: {
|
|
@@ -364,7 +364,7 @@ export class CapabilityRegistry {
|
|
|
364
364
|
permission: "<permission_name>",
|
|
365
365
|
order_allocators: ["<allocation_name>"],
|
|
366
366
|
compensation_fund_balance: 0,
|
|
367
|
-
compensation_fund_add_hint: "Post-publish: call service.compensation_fund_add with Coin<T>. Recommend
|
|
367
|
+
compensation_fund_add_hint: "Post-publish: call service.compensation_fund_add with Coin<T>. Recommend 3-10× max single-order amount (industry-specific: subscription 3×, retail 5×, rental 10×).",
|
|
368
368
|
},
|
|
369
369
|
observed_in_industries: {}, success_count: 0, failure_count: 0, known_failure_modes: [],
|
|
370
370
|
depends_on_capabilities: [
|
|
@@ -376,7 +376,7 @@ export class CapabilityRegistry {
|
|
|
376
376
|
this.registerCard({
|
|
377
377
|
capability_id: "progress.advance",
|
|
378
378
|
display_name: "Progress Advance",
|
|
379
|
-
description: "
|
|
379
|
+
description: "Order fulfillment progress advance: advance to next state based on Machine node topology",
|
|
380
380
|
object_type: "progress", module: "handler", category: "workflow",
|
|
381
381
|
industry_agnostic: "medium",
|
|
382
382
|
config_template: { parent: "<machine_name>" },
|
|
@@ -386,7 +386,7 @@ export class CapabilityRegistry {
|
|
|
386
386
|
this.registerCard({
|
|
387
387
|
capability_id: "arb.vote_weighted",
|
|
388
388
|
display_name: "Arbitration Vote Weighted",
|
|
389
|
-
description: "guard-based
|
|
389
|
+
description: "guard-based weighted voting arbitration: vote by Guard weight to determine arbitration result",
|
|
390
390
|
object_type: "arb", module: "handler", category: "trust",
|
|
391
391
|
industry_agnostic: "medium",
|
|
392
392
|
config_template: { guard: "<guard_name>", voting_rule: "guard_weighted" },
|
|
@@ -396,7 +396,7 @@ export class CapabilityRegistry {
|
|
|
396
396
|
this.registerCard({
|
|
397
397
|
capability_id: "reward.claim_guard",
|
|
398
398
|
display_name: "Reward Claim Guard",
|
|
399
|
-
description: "
|
|
399
|
+
description: "Reward claim: release reward after validating claim conditions (such as positive review, repurchase) via Guard",
|
|
400
400
|
object_type: "reward", module: "handler", category: "fund_flow",
|
|
401
401
|
industry_agnostic: "medium",
|
|
402
402
|
config_template: { claim_guard: "<guard_name>", max_guard_count: 1 },
|
|
@@ -406,7 +406,7 @@ export class CapabilityRegistry {
|
|
|
406
406
|
this.registerCard({
|
|
407
407
|
capability_id: "contact.im_create",
|
|
408
408
|
display_name: "Contact IM Create",
|
|
409
|
-
description: "
|
|
409
|
+
description: "Create IM contact object: buyer and seller communicate via Messenger",
|
|
410
410
|
object_type: "contact", module: "handler", category: "communication",
|
|
411
411
|
industry_agnostic: "high",
|
|
412
412
|
config_template: {},
|
|
@@ -416,7 +416,7 @@ export class CapabilityRegistry {
|
|
|
416
416
|
this.registerCard({
|
|
417
417
|
capability_id: "demand.matching",
|
|
418
418
|
display_name: "Demand Matching",
|
|
419
|
-
description: "
|
|
419
|
+
description: "Demand matching: match corresponding Service based on user demand",
|
|
420
420
|
object_type: "demand", module: "handler", category: "query",
|
|
421
421
|
industry_agnostic: "high",
|
|
422
422
|
config_template: {},
|
|
@@ -426,7 +426,7 @@ export class CapabilityRegistry {
|
|
|
426
426
|
this.registerCard({
|
|
427
427
|
capability_id: "repository.write_validate",
|
|
428
428
|
display_name: "Repository Write Validate",
|
|
429
|
-
description: "
|
|
429
|
+
description: "Knowledge base write validation: validate write permissions and data format via Guard",
|
|
430
430
|
object_type: "repository", module: "handler", category: "validation",
|
|
431
431
|
industry_agnostic: "high",
|
|
432
432
|
config_template: {},
|
|
@@ -436,7 +436,7 @@ export class CapabilityRegistry {
|
|
|
436
436
|
this.registerCard({
|
|
437
437
|
capability_id: "proof.evidence_anchor",
|
|
438
438
|
display_name: "Proof Evidence Anchor",
|
|
439
|
-
description: "
|
|
439
|
+
description: "Evidence on-chain: anchor delivery evidence (hash) to on-chain Progress node",
|
|
440
440
|
object_type: "proof", module: "handler", category: "evidence",
|
|
441
441
|
industry_agnostic: "medium",
|
|
442
442
|
config_template: {},
|
|
@@ -446,7 +446,7 @@ export class CapabilityRegistry {
|
|
|
446
446
|
this.registerCard({
|
|
447
447
|
capability_id: "personal.profile_manage",
|
|
448
448
|
display_name: "Personal Profile Manage",
|
|
449
|
-
description: "
|
|
449
|
+
description: "Personal profile management: user identity/preference/history management",
|
|
450
450
|
object_type: "personal", module: "handler", category: "data_model",
|
|
451
451
|
industry_agnostic: "high",
|
|
452
452
|
config_template: {},
|
|
@@ -456,7 +456,7 @@ export class CapabilityRegistry {
|
|
|
456
456
|
this.registerCard({
|
|
457
457
|
capability_id: "payment.settle",
|
|
458
458
|
display_name: "Payment Settle",
|
|
459
|
-
description: "
|
|
459
|
+
description: "Payment settlement: complete fund settlement in collaboration with Allocation",
|
|
460
460
|
object_type: "payment", module: "handler", category: "fund_flow",
|
|
461
461
|
industry_agnostic: "high",
|
|
462
462
|
config_template: {},
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const BUILTIN_CONSTRAINTS = [
|
|
2
2
|
{
|
|
3
3
|
constraint_id: "require_arbitration",
|
|
4
|
-
display_name: "
|
|
5
|
-
description: "
|
|
4
|
+
display_name: "Require Arbitration",
|
|
5
|
+
description: "Mode must include arbitration capability (arb.*) for dispute resolution",
|
|
6
6
|
rule: { type: "capability_required", capability_id: "arb.vote_weighted" },
|
|
7
7
|
severity: "hard",
|
|
8
8
|
on_violation: "block",
|
|
@@ -10,8 +10,8 @@ const BUILTIN_CONSTRAINTS = [
|
|
|
10
10
|
},
|
|
11
11
|
{
|
|
12
12
|
constraint_id: "require_compensation_fund",
|
|
13
|
-
display_name: "
|
|
14
|
-
description: "
|
|
13
|
+
display_name: "Require Compensation Fund",
|
|
14
|
+
description: "Mode must include fund escrow capability (treasury.*) for compensation fund",
|
|
15
15
|
rule: { type: "capability_required", capability_id: "treasury.owner_receive" },
|
|
16
16
|
severity: "hard",
|
|
17
17
|
on_violation: "block",
|
|
@@ -19,8 +19,8 @@ const BUILTIN_CONSTRAINTS = [
|
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
21
|
constraint_id: "require_wip_evidence",
|
|
22
|
-
display_name: "
|
|
23
|
-
description: "
|
|
22
|
+
display_name: "Require WIP Evidence",
|
|
23
|
+
description: "Mode must include WIP evidence capability (guard.validate_wip_hash) for digital delivery validation",
|
|
24
24
|
rule: { type: "capability_required", capability_id: "guard.validate_wip_hash" },
|
|
25
25
|
severity: "soft",
|
|
26
26
|
on_violation: "warn",
|
|
@@ -28,8 +28,8 @@ const BUILTIN_CONSTRAINTS = [
|
|
|
28
28
|
},
|
|
29
29
|
{
|
|
30
30
|
constraint_id: "max_single_transaction_limit",
|
|
31
|
-
display_name: "
|
|
32
|
-
description: "
|
|
31
|
+
display_name: "Single Transaction Limit",
|
|
32
|
+
description: "Single transaction amount must not exceed 10000 WOW (default value, can be overridden by mode)",
|
|
33
33
|
rule: { type: "numeric_limit", field: "max_single_transaction", max: 10000 },
|
|
34
34
|
severity: "soft",
|
|
35
35
|
on_violation: "warn",
|
|
@@ -117,10 +117,10 @@ export class ConstraintRegistry {
|
|
|
117
117
|
return {
|
|
118
118
|
constraint_id: constraint.constraint_id,
|
|
119
119
|
display_name: constraint.display_name,
|
|
120
|
-
violation:
|
|
120
|
+
violation: `Missing required capability: ${rule.capability_id}`,
|
|
121
121
|
severity: constraint.severity,
|
|
122
122
|
action: constraint.on_violation,
|
|
123
|
-
recommendation:
|
|
123
|
+
recommendation: `Add "${rule.capability_id}" to capabilities_used`,
|
|
124
124
|
};
|
|
125
125
|
}
|
|
126
126
|
return null;
|
|
@@ -130,10 +130,10 @@ export class ConstraintRegistry {
|
|
|
130
130
|
return {
|
|
131
131
|
constraint_id: constraint.constraint_id,
|
|
132
132
|
display_name: constraint.display_name,
|
|
133
|
-
violation:
|
|
133
|
+
violation: `Contains forbidden capability: ${rule.capability_id}`,
|
|
134
134
|
severity: constraint.severity,
|
|
135
135
|
action: constraint.on_violation,
|
|
136
|
-
recommendation:
|
|
136
|
+
recommendation: `Remove "${rule.capability_id}" from capabilities_used`,
|
|
137
137
|
};
|
|
138
138
|
}
|
|
139
139
|
return null;
|
|
@@ -146,20 +146,20 @@ export class ConstraintRegistry {
|
|
|
146
146
|
return {
|
|
147
147
|
constraint_id: constraint.constraint_id,
|
|
148
148
|
display_name: constraint.display_name,
|
|
149
|
-
violation: `${rule.field}=${fieldValue}
|
|
149
|
+
violation: `${rule.field}=${fieldValue} exceeds upper limit ${rule.max}`,
|
|
150
150
|
severity: constraint.severity,
|
|
151
151
|
action: constraint.on_violation,
|
|
152
|
-
recommendation:
|
|
152
|
+
recommendation: `Reduce ${rule.field} below ${rule.max}`,
|
|
153
153
|
};
|
|
154
154
|
}
|
|
155
155
|
if (rule.min !== undefined && fieldValue < rule.min) {
|
|
156
156
|
return {
|
|
157
157
|
constraint_id: constraint.constraint_id,
|
|
158
158
|
display_name: constraint.display_name,
|
|
159
|
-
violation: `${rule.field}=${fieldValue}
|
|
159
|
+
violation: `${rule.field}=${fieldValue} below lower limit ${rule.min}`,
|
|
160
160
|
severity: constraint.severity,
|
|
161
161
|
action: constraint.on_violation,
|
|
162
|
-
recommendation:
|
|
162
|
+
recommendation: `Increase ${rule.field} above ${rule.min}`,
|
|
163
163
|
};
|
|
164
164
|
}
|
|
165
165
|
return null;
|
|
@@ -168,10 +168,10 @@ export class ConstraintRegistry {
|
|
|
168
168
|
return {
|
|
169
169
|
constraint_id: constraint.constraint_id,
|
|
170
170
|
display_name: constraint.display_name,
|
|
171
|
-
violation:
|
|
171
|
+
violation: `Natural language condition pending AI evaluation: "${rule.condition}"`,
|
|
172
172
|
severity: constraint.severity,
|
|
173
173
|
action: constraint.on_violation,
|
|
174
|
-
recommendation:
|
|
174
|
+
recommendation: `Please have AI evaluate whether this condition is satisfied, and update the mode configuration`,
|
|
175
175
|
};
|
|
176
176
|
}
|
|
177
177
|
default:
|
|
@@ -6,8 +6,8 @@ const LEVEL_WEIGHT = {
|
|
|
6
6
|
const BUILTIN_RISK_METRICS = [
|
|
7
7
|
{
|
|
8
8
|
metric_id: "funds_risk",
|
|
9
|
-
display_name: "
|
|
10
|
-
description: "
|
|
9
|
+
display_name: "Funds Risk",
|
|
10
|
+
description: "Directly operates funds / affects fund flow / no fund risk",
|
|
11
11
|
type: "risk",
|
|
12
12
|
scale: "level",
|
|
13
13
|
weight: 1.0,
|
|
@@ -15,8 +15,8 @@ const BUILTIN_RISK_METRICS = [
|
|
|
15
15
|
},
|
|
16
16
|
{
|
|
17
17
|
metric_id: "trust_risk",
|
|
18
|
-
display_name: "
|
|
19
|
-
description: "
|
|
18
|
+
display_name: "Trust Risk",
|
|
19
|
+
description: "Degree of impact on trust mechanism",
|
|
20
20
|
type: "risk",
|
|
21
21
|
scale: "level",
|
|
22
22
|
weight: 1.0,
|
|
@@ -24,8 +24,8 @@ const BUILTIN_RISK_METRICS = [
|
|
|
24
24
|
},
|
|
25
25
|
{
|
|
26
26
|
metric_id: "delivery_risk",
|
|
27
|
-
display_name: "
|
|
28
|
-
description: "
|
|
27
|
+
display_name: "Delivery Risk",
|
|
28
|
+
description: "Degree of impact on order fulfillment",
|
|
29
29
|
type: "risk",
|
|
30
30
|
scale: "level",
|
|
31
31
|
weight: 1.0,
|
|
@@ -33,8 +33,8 @@ const BUILTIN_RISK_METRICS = [
|
|
|
33
33
|
},
|
|
34
34
|
{
|
|
35
35
|
metric_id: "compliance_risk",
|
|
36
|
-
display_name: "
|
|
37
|
-
description: "
|
|
36
|
+
display_name: "Compliance Risk",
|
|
37
|
+
description: "Degree of regulatory involvement",
|
|
38
38
|
type: "risk",
|
|
39
39
|
scale: "level",
|
|
40
40
|
weight: 1.0,
|
|
@@ -44,8 +44,8 @@ const BUILTIN_RISK_METRICS = [
|
|
|
44
44
|
const BUILTIN_BENEFIT_METRICS = [
|
|
45
45
|
{
|
|
46
46
|
metric_id: "automation_level",
|
|
47
|
-
display_name: "
|
|
48
|
-
description: "
|
|
47
|
+
display_name: "Automation Level",
|
|
48
|
+
description: "Fully automated / semi-automated / manual",
|
|
49
49
|
type: "benefit",
|
|
50
50
|
scale: "level",
|
|
51
51
|
weight: 1.0,
|
|
@@ -53,8 +53,8 @@ const BUILTIN_BENEFIT_METRICS = [
|
|
|
53
53
|
},
|
|
54
54
|
{
|
|
55
55
|
metric_id: "trust_boost",
|
|
56
|
-
display_name: "
|
|
57
|
-
description: "
|
|
56
|
+
display_name: "Trust Boost",
|
|
57
|
+
description: "Degree of enhancement to trust mechanism",
|
|
58
58
|
type: "benefit",
|
|
59
59
|
scale: "level",
|
|
60
60
|
weight: 1.0,
|
|
@@ -62,8 +62,8 @@ const BUILTIN_BENEFIT_METRICS = [
|
|
|
62
62
|
},
|
|
63
63
|
{
|
|
64
64
|
metric_id: "efficiency_gain",
|
|
65
|
-
display_name: "
|
|
66
|
-
description: "
|
|
65
|
+
display_name: "Efficiency Gain",
|
|
66
|
+
description: "Degree of efficiency improvement",
|
|
67
67
|
type: "benefit",
|
|
68
68
|
scale: "level",
|
|
69
69
|
weight: 1.0,
|
|
@@ -70,34 +70,34 @@ export class ModeEvaluator {
|
|
|
70
70
|
feasibility_score = Math.max(0, Math.min(100, Math.round(feasibility_score)));
|
|
71
71
|
const recommendations = [];
|
|
72
72
|
if (benefit_delta > 0) {
|
|
73
|
-
recommendations.push(
|
|
73
|
+
recommendations.push(`Benefit increased by ${benefit_delta.toFixed(1)} points, migration has positive value`);
|
|
74
74
|
}
|
|
75
75
|
else if (benefit_delta < 0) {
|
|
76
|
-
recommendations.push(
|
|
76
|
+
recommendations.push(`Benefit decreased by ${Math.abs(benefit_delta).toFixed(1)} points, need to evaluate migration necessity`);
|
|
77
77
|
}
|
|
78
78
|
if (risk_delta > 10) {
|
|
79
|
-
recommendations.push(
|
|
79
|
+
recommendations.push(`Risk increased by ${risk_delta.toFixed(1)} points, recommend strengthening risk control measures`);
|
|
80
80
|
}
|
|
81
81
|
else if (risk_delta < -10) {
|
|
82
|
-
recommendations.push(
|
|
82
|
+
recommendations.push(`Risk decreased by ${Math.abs(risk_delta).toFixed(1)} points, migration helps risk management`);
|
|
83
83
|
}
|
|
84
84
|
if (added_capabilities.length > 0) {
|
|
85
|
-
recommendations.push(
|
|
85
|
+
recommendations.push(`Added ${added_capabilities.length} capabilities, need extra configuration: ${added_capabilities.slice(0, 3).join(", ")}`);
|
|
86
86
|
}
|
|
87
87
|
if (removed_capabilities.length > 0) {
|
|
88
|
-
recommendations.push(
|
|
88
|
+
recommendations.push(`Removed ${removed_capabilities.length} capabilities, related features will be unavailable`);
|
|
89
89
|
}
|
|
90
90
|
if (conflicting_capabilities.length > 0) {
|
|
91
|
-
recommendations.push(
|
|
91
|
+
recommendations.push(`Detected ${conflicting_capabilities.length} capability conflicts, must be resolved before migration`);
|
|
92
92
|
}
|
|
93
93
|
if (feasibility_score >= 70) {
|
|
94
|
-
recommendations.push("
|
|
94
|
+
recommendations.push("Migration feasibility is high, recommend executing");
|
|
95
95
|
}
|
|
96
96
|
else if (feasibility_score >= 40) {
|
|
97
|
-
recommendations.push("
|
|
97
|
+
recommendations.push("Migration feasibility is medium, need careful evaluation");
|
|
98
98
|
}
|
|
99
99
|
else {
|
|
100
|
-
recommendations.push("
|
|
100
|
+
recommendations.push("Migration feasibility is low, recommend keeping the current mode or finding an alternative");
|
|
101
101
|
}
|
|
102
102
|
return {
|
|
103
103
|
feasibility_score,
|
|
@@ -142,13 +142,13 @@ export class ModeEvaluator {
|
|
|
142
142
|
generateRecommendations(mode, risk_score, benefit_score, capability_conflicts, violated_constraints, unmet_conditions) {
|
|
143
143
|
const recs = [];
|
|
144
144
|
if (capability_conflicts.length > 0) {
|
|
145
|
-
recs.push(
|
|
145
|
+
recs.push(`Detected ${capability_conflicts.length} capability conflicts, must be resolved before applying the mode`);
|
|
146
146
|
}
|
|
147
147
|
if (violated_constraints.length > 0) {
|
|
148
|
-
recs.push(
|
|
148
|
+
recs.push(`Detected ${violated_constraints.length} hard constraint violations, need to supplement missing capabilities or adjust mode configuration`);
|
|
149
149
|
}
|
|
150
150
|
if (unmet_conditions.length > 0) {
|
|
151
|
-
recs.push(
|
|
151
|
+
recs.push(`Detected ${unmet_conditions.length} soft constraints not met, recommend adjusting to improve mode quality`);
|
|
152
152
|
}
|
|
153
153
|
const appetiteThresholds = {
|
|
154
154
|
conservative: { max_risk: 30, min_benefit: 50 },
|
|
@@ -157,13 +157,13 @@ export class ModeEvaluator {
|
|
|
157
157
|
};
|
|
158
158
|
const threshold = appetiteThresholds[mode.risk_appetite];
|
|
159
159
|
if (risk_score > threshold.max_risk) {
|
|
160
|
-
recs.push(
|
|
160
|
+
recs.push(`Risk score ${risk_score} exceeds ${mode.risk_appetite} mode threshold ${threshold.max_risk}, recommend reducing risk or adjusting risk appetite`);
|
|
161
161
|
}
|
|
162
162
|
if (benefit_score < threshold.min_benefit) {
|
|
163
|
-
recs.push(
|
|
163
|
+
recs.push(`Benefit score ${benefit_score} below ${mode.risk_appetite} mode threshold ${threshold.min_benefit}, recommend adding benefit capabilities or adjusting risk appetite`);
|
|
164
164
|
}
|
|
165
165
|
if (recs.length === 0) {
|
|
166
|
-
recs.push(
|
|
166
|
+
recs.push(`Mode evaluation passed: risk ${risk_score} / benefit ${benefit_score} / risk-benefit ratio ${(benefit_score / Math.max(risk_score, 1)).toFixed(2)}`);
|
|
167
167
|
}
|
|
168
168
|
return recs;
|
|
169
169
|
}
|