@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.
Files changed (121) hide show
  1. package/dist/customer/industry-risks.js +31 -31
  2. package/dist/customer/order-monitor.js +57 -57
  3. package/dist/customer/order-strategy.js +89 -89
  4. package/dist/customer/post-purchase.js +97 -97
  5. package/dist/customer/reminder-system.js +26 -26
  6. package/dist/customer/risk-assessment.js +46 -46
  7. package/dist/customer/types.d.ts +4 -4
  8. package/dist/customer/types.js +4 -4
  9. package/dist/customer/user-preferences.js +50 -50
  10. package/dist/experience/intent-distill.js +6 -6
  11. package/dist/index.d.ts +2 -2
  12. package/dist/index.js +11 -1624
  13. package/dist/knowledge/acquisition-flywheel.js +64 -64
  14. package/dist/knowledge/arbitration-trust.js +10 -10
  15. package/dist/knowledge/demand-matching.js +8 -8
  16. package/dist/knowledge/dynamic-pricing.js +18 -18
  17. package/dist/knowledge/flywheel-loop.js +11 -11
  18. package/dist/knowledge/glossary.js +22 -22
  19. package/dist/knowledge/guard-ledger.d.ts +1 -1
  20. package/dist/knowledge/guard-ledger.js +145 -104
  21. package/dist/knowledge/guard-lint.d.ts +77 -0
  22. package/dist/knowledge/guard-lint.js +670 -0
  23. package/dist/knowledge/guard-migration.d.ts +48 -0
  24. package/dist/knowledge/guard-migration.js +228 -0
  25. package/dist/knowledge/guard-puzzle.d.ts +109 -14
  26. package/dist/knowledge/guard-puzzle.js +627 -101
  27. package/dist/knowledge/guard-risk.d.ts +10 -1
  28. package/dist/knowledge/guard-risk.js +1634 -292
  29. package/dist/knowledge/guard-templates.d.ts +38 -0
  30. package/dist/knowledge/guard-templates.js +605 -0
  31. package/dist/knowledge/guard-translation.d.ts +14 -2
  32. package/dist/knowledge/guard-translation.js +825 -194
  33. package/dist/knowledge/index.d.ts +8 -4
  34. package/dist/knowledge/index.js +9 -5
  35. package/dist/knowledge/industry-evolution.js +29 -29
  36. package/dist/knowledge/industry-generalizer.js +52 -52
  37. package/dist/knowledge/industry-registry.js +20 -33
  38. package/dist/knowledge/intent-metrics.js +67 -67
  39. package/dist/knowledge/process-model.js +80 -80
  40. package/dist/knowledge/reputation-rules.js +9 -9
  41. package/dist/knowledge/reward-templates.js +51 -51
  42. package/dist/knowledge/safety-rules.js +3 -3
  43. package/dist/knowledge/tool-constraints.js +20 -4
  44. package/dist/knowledge/trust-metrics.js +26 -26
  45. package/dist/project/graph.d.ts +1 -0
  46. package/dist/project/graph.js +27 -1
  47. package/dist/project/index.d.ts +1 -0
  48. package/dist/project/index.js +39 -2
  49. package/dist/project/namespace.d.ts +11 -1
  50. package/dist/project/namespace.js +27 -2
  51. package/dist/project/query.d.ts +2 -0
  52. package/dist/project/query.js +56 -15
  53. package/dist/rules.d.ts +12 -0
  54. package/dist/rules.js +9 -0
  55. package/dist/schema/call/allocation.d.ts +10 -10
  56. package/dist/schema/call/base.js +19 -19
  57. package/dist/schema/call/bridge.d.ts +32 -32
  58. package/dist/schema/call/demand.d.ts +84 -84
  59. package/dist/schema/call/guard.d.ts +153 -0
  60. package/dist/schema/call/guard.js +50 -0
  61. package/dist/schema/call/machine.d.ts +38 -38
  62. package/dist/schema/call/permission.d.ts +78 -78
  63. package/dist/schema/call/repository.d.ts +22 -22
  64. package/dist/schema/call/semantic.js +229 -25
  65. package/dist/schema/call/service.d.ts +7 -7
  66. package/dist/schema/local/wip.d.ts +39 -19
  67. package/dist/schema/local/wip.js +5 -5
  68. package/dist/schema/messenger/index.d.ts +26 -26
  69. package/dist/schema/messenger/index.js +2 -2
  70. package/dist/schema/operations.d.ts +270 -192
  71. package/dist/schema/query/index.d.ts +184 -184
  72. package/dist/schema/query/index.js +15 -9
  73. package/dist/schema/trust/index.d.ts +4 -4
  74. package/dist/schema/utils/guard-parser.js +4 -4
  75. package/dist/schema/utils/guard-query-utils.d.ts +7 -0
  76. package/dist/schema/utils/guard-query-utils.js +14 -1
  77. package/dist/schema/utils/node-parser.js +14 -14
  78. package/dist/schemas/bridge_operation.output.json +15 -15
  79. package/dist/schemas/index.json +1 -1
  80. package/dist/schemas/messenger_operation.output.json +18 -16
  81. package/dist/schemas/onchain_events.output.json +15 -15
  82. package/dist/schemas/onchain_operations.output.json +16 -16
  83. package/dist/schemas/onchain_operations.schema.json +11 -20
  84. package/dist/schemas/onchain_operations_allocation.schema.json +7 -10
  85. package/dist/schemas/onchain_operations_machine.schema.json +2 -5
  86. package/dist/schemas/onchain_operations_service.schema.json +2 -5
  87. package/dist/schemas/onchain_table_data.output.json +20 -26
  88. package/dist/schemas/wip_file.output.json +24 -1
  89. package/dist/tools/handlers/bridge.d.ts +1 -0
  90. package/dist/tools/handlers/bridge.js +1 -0
  91. package/dist/tools/handlers/config.d.ts +2 -0
  92. package/dist/tools/handlers/config.js +71 -0
  93. package/dist/tools/handlers/file-export.d.ts +3 -0
  94. package/dist/tools/handlers/file-export.js +90 -0
  95. package/dist/tools/handlers/local.d.ts +30 -0
  96. package/dist/tools/handlers/local.js +27 -0
  97. package/dist/tools/handlers/messenger.d.ts +16 -0
  98. package/dist/tools/handlers/messenger.js +187 -0
  99. package/dist/tools/handlers/onchain.d.ts +2 -0
  100. package/dist/tools/handlers/onchain.js +246 -0
  101. package/dist/tools/handlers/project.d.ts +2 -0
  102. package/dist/tools/handlers/project.js +53 -0
  103. package/dist/tools/handlers/query.d.ts +5 -0
  104. package/dist/tools/handlers/query.js +256 -0
  105. package/dist/tools/handlers/schema-query.d.ts +2 -0
  106. package/dist/tools/handlers/schema-query.js +92 -0
  107. package/dist/tools/handlers/trust.d.ts +2 -0
  108. package/dist/tools/handlers/trust.js +194 -0
  109. package/dist/tools/handlers/wip.d.ts +2 -0
  110. package/dist/tools/handlers/wip.js +44 -0
  111. package/dist/tools/index.d.ts +13 -0
  112. package/dist/tools/index.js +479 -0
  113. package/dist/tools/rules-hook.d.ts +2 -0
  114. package/dist/tools/rules-hook.js +22 -0
  115. package/dist/tools/shared.d.ts +29 -0
  116. package/dist/tools/shared.js +130 -0
  117. package/dist/tools/types.d.ts +35 -0
  118. package/dist/tools/types.js +1 -0
  119. package/dist/tools/wrap.d.ts +6 -0
  120. package/dist/tools/wrap.js +55 -0
  121. package/package.json +19 -5
@@ -1,35 +1,76 @@
1
1
  import { LocalMark } from "@wowok/wowok";
2
- import { extractProjectPrefix, TAG_PREFIX } from "./namespace.js";
2
+ import { extractAllProjectVersions, TAG_PREFIX } from "./namespace.js";
3
3
  export async function listProjects() {
4
4
  const marks = await LocalMark.Instance().list(undefined);
5
5
  const byProject = new Map();
6
6
  for (const m of marks) {
7
- const prefix = extractProjectPrefix(m.tags);
8
- if (!prefix)
7
+ const entries = extractAllProjectVersions(m.tags);
8
+ if (entries.length === 0)
9
9
  continue;
10
- if (!byProject.has(prefix)) {
11
- byProject.set(prefix, { prefix, objectCount: 0, types: [], objects: [] });
10
+ const byPrefix = new Map();
11
+ for (const entry of entries) {
12
+ if (!byPrefix.has(entry.prefix))
13
+ byPrefix.set(entry.prefix, []);
14
+ byPrefix.get(entry.prefix).push(entry.version);
12
15
  }
13
- const proj = byProject.get(prefix);
14
- proj.objectCount++;
15
16
  const typeTag = m.tags?.find((t) => t.startsWith(TAG_PREFIX.type));
16
17
  const type = typeTag?.slice(TAG_PREFIX.type.length);
17
- if (type && !proj.types.includes(type))
18
- proj.types.push(type);
19
- proj.objects.push({ name: m.name, address: m.address, type });
18
+ for (const [prefix, versions] of byPrefix) {
19
+ const hasVersioned = versions.some((v) => v !== undefined);
20
+ const effectiveVersions = hasVersioned
21
+ ? versions.filter((v) => v !== undefined)
22
+ : versions;
23
+ if (!byProject.has(prefix)) {
24
+ byProject.set(prefix, {
25
+ prefix,
26
+ objectCount: 0,
27
+ types: [],
28
+ versions: [],
29
+ objects: [],
30
+ });
31
+ }
32
+ const proj = byProject.get(prefix);
33
+ if (type && !proj.types.includes(type))
34
+ proj.types.push(type);
35
+ for (const v of effectiveVersions) {
36
+ proj.objectCount++;
37
+ if (v && !proj.versions.includes(v)) {
38
+ proj.versions.push(v);
39
+ }
40
+ proj.objects.push({
41
+ name: m.name,
42
+ address: m.address,
43
+ type,
44
+ version: v,
45
+ });
46
+ }
47
+ }
20
48
  }
21
49
  return Array.from(byProject.values()).sort((a, b) => b.objectCount - a.objectCount);
22
50
  }
23
51
  export async function listProjectObjects(prefix) {
24
- const marks = await LocalMark.Instance().list({ tags: [`${TAG_PREFIX.project}${prefix}`] });
25
- return marks.map((m) => {
52
+ const marks = await LocalMark.Instance().list(undefined);
53
+ const results = [];
54
+ const isVersionedFilter = prefix.includes("_v");
55
+ for (const m of marks) {
56
+ const entries = extractAllProjectVersions(m.tags);
57
+ const matched = entries.find((e) => {
58
+ if (isVersionedFilter) {
59
+ return e.version ? `${e.prefix}_${e.version}` === prefix : false;
60
+ }
61
+ return e.prefix === prefix;
62
+ });
63
+ if (!matched)
64
+ continue;
26
65
  const typeTag = m.tags?.find((t) => t.startsWith(TAG_PREFIX.type));
27
- return {
66
+ results.push({
28
67
  name: m.name,
29
68
  address: m.address,
30
69
  type: typeTag?.slice(TAG_PREFIX.type.length),
31
- };
32
- });
70
+ version: matched.version,
71
+ });
72
+ }
73
+ return results;
33
74
  }
34
75
  export async function listShareableObjects() {
35
76
  const marks = await LocalMark.Instance().list({ tags: [`${TAG_PREFIX.shareable}true`] });
@@ -0,0 +1,12 @@
1
+ export { validateOperation, hasBlockingViolations, getWarningViolations, type ConstraintViolation, } from "./knowledge/tool-constraints.js";
2
+ export { computeServiceTrustScore, type ServiceTrustMetrics, } from "./knowledge/trust-metrics.js";
3
+ export { AUDIT_RULES, auditService, hasBlockingErrors, getErrors, getWarnings, summarizeFindings, type AuditFinding, } from "./knowledge/audit-rules.js";
4
+ export { confirmGate, isConfirmGateEnabled, isExplicitlyConfirmed, getFailMode, type ConfirmResult, type FailMode, } from "./safety/confirm-gate.js";
5
+ export { renderPreview } from "./safety/preview.js";
6
+ export { CONFIRMATION_RULES, SAFETY_RULES_VERSION, DEFAULT_AMOUNT_THRESHOLD, getAmountThreshold, formatAmount, collectDefaultWarnings, type OperationPreview, type ConfirmLevel, type ConfirmationRule, } from "./knowledge/safety-rules.js";
7
+ export { distillIntent, extractSignals } from "./experience/intent-distill.js";
8
+ export type { DistilledIntent } from "./experience/types.js";
9
+ export { Harness, getHarness, setHarness } from "./harness/index.js";
10
+ export type { ODG, ExpectedResult, VerifyReport, RecoveryAction, Checkpoint, } from "./harness/types.js";
11
+ export { getDefaultPreferences, inferPreferences, matchServiceToPreferences, mergePreferences, validatePreferences, SUPPORTED_INDUSTRIES, type IndustryTemplate, type Industry, type PreferenceInference, type ServiceForMatching, type PreferenceMatchResult, } from "./customer/user-preferences.js";
12
+ export type { UserPreferences } from "./customer/types.js";
package/dist/rules.js ADDED
@@ -0,0 +1,9 @@
1
+ export { validateOperation, hasBlockingViolations, getWarningViolations, } from "./knowledge/tool-constraints.js";
2
+ export { computeServiceTrustScore, } from "./knowledge/trust-metrics.js";
3
+ export { AUDIT_RULES, auditService, hasBlockingErrors, getErrors, getWarnings, summarizeFindings, } from "./knowledge/audit-rules.js";
4
+ export { confirmGate, isConfirmGateEnabled, isExplicitlyConfirmed, getFailMode, } from "./safety/confirm-gate.js";
5
+ export { renderPreview } from "./safety/preview.js";
6
+ export { CONFIRMATION_RULES, SAFETY_RULES_VERSION, DEFAULT_AMOUNT_THRESHOLD, getAmountThreshold, formatAmount, collectDefaultWarnings, } from "./knowledge/safety-rules.js";
7
+ export { distillIntent, extractSignals } from "./experience/intent-distill.js";
8
+ export { Harness, getHarness, setHarness } from "./harness/index.js";
9
+ export { getDefaultPreferences, inferPreferences, matchServiceToPreferences, mergePreferences, validatePreferences, SUPPORTED_INDUSTRIES, } from "./customer/user-preferences.js";
@@ -22,7 +22,7 @@ export declare const CallAllocation_CreateSchema: z.ZodObject<{
22
22
  }>;
23
23
  allocators: z.ZodObject<{
24
24
  description: z.ZodEffects<z.ZodString, string, string>;
25
- threshold: z.ZodUnion<[z.ZodNumber, z.ZodString]>;
25
+ threshold: z.ZodDefault<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
26
26
  allocators: z.ZodArray<z.ZodObject<{
27
27
  guard: z.ZodEffects<z.ZodString, string, string>;
28
28
  sharing: z.ZodArray<z.ZodObject<{
@@ -152,7 +152,6 @@ export declare const CallAllocation_CreateSchema: z.ZodObject<{
152
152
  }[];
153
153
  }, {
154
154
  description: string;
155
- threshold: string | number;
156
155
  allocators: {
157
156
  guard: string;
158
157
  sharing: {
@@ -172,6 +171,7 @@ export declare const CallAllocation_CreateSchema: z.ZodObject<{
172
171
  max?: string | number | null | undefined;
173
172
  fix?: string | number | undefined;
174
173
  }[];
174
+ threshold?: string | number | undefined;
175
175
  }>;
176
176
  coin: z.ZodUnion<[z.ZodObject<{
177
177
  balance: z.ZodUnion<[z.ZodNumber, z.ZodString]>;
@@ -259,7 +259,6 @@ export declare const CallAllocation_CreateSchema: z.ZodObject<{
259
259
  };
260
260
  allocators: {
261
261
  description: string;
262
- threshold: string | number;
263
262
  allocators: {
264
263
  guard: string;
265
264
  sharing: {
@@ -279,6 +278,7 @@ export declare const CallAllocation_CreateSchema: z.ZodObject<{
279
278
  max?: string | number | null | undefined;
280
279
  fix?: string | number | undefined;
281
280
  }[];
281
+ threshold?: string | number | undefined;
282
282
  };
283
283
  payment_info: {
284
284
  index: string | number;
@@ -371,7 +371,7 @@ export declare const CallAllocation_DataSchema: z.ZodUnion<[z.ZodObject<{
371
371
  }>;
372
372
  allocators: z.ZodObject<{
373
373
  description: z.ZodEffects<z.ZodString, string, string>;
374
- threshold: z.ZodUnion<[z.ZodNumber, z.ZodString]>;
374
+ threshold: z.ZodDefault<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
375
375
  allocators: z.ZodArray<z.ZodObject<{
376
376
  guard: z.ZodEffects<z.ZodString, string, string>;
377
377
  sharing: z.ZodArray<z.ZodObject<{
@@ -501,7 +501,6 @@ export declare const CallAllocation_DataSchema: z.ZodUnion<[z.ZodObject<{
501
501
  }[];
502
502
  }, {
503
503
  description: string;
504
- threshold: string | number;
505
504
  allocators: {
506
505
  guard: string;
507
506
  sharing: {
@@ -521,6 +520,7 @@ export declare const CallAllocation_DataSchema: z.ZodUnion<[z.ZodObject<{
521
520
  max?: string | number | null | undefined;
522
521
  fix?: string | number | undefined;
523
522
  }[];
523
+ threshold?: string | number | undefined;
524
524
  }>;
525
525
  coin: z.ZodUnion<[z.ZodObject<{
526
526
  balance: z.ZodUnion<[z.ZodNumber, z.ZodString]>;
@@ -608,7 +608,6 @@ export declare const CallAllocation_DataSchema: z.ZodUnion<[z.ZodObject<{
608
608
  };
609
609
  allocators: {
610
610
  description: string;
611
- threshold: string | number;
612
611
  allocators: {
613
612
  guard: string;
614
613
  sharing: {
@@ -628,6 +627,7 @@ export declare const CallAllocation_DataSchema: z.ZodUnion<[z.ZodObject<{
628
627
  max?: string | number | null | undefined;
629
628
  fix?: string | number | undefined;
630
629
  }[];
630
+ threshold?: string | number | undefined;
631
631
  };
632
632
  payment_info: {
633
633
  index: string | number;
@@ -720,7 +720,7 @@ export declare const CallAllocation_InputSchema: z.ZodObject<{
720
720
  }>;
721
721
  allocators: z.ZodObject<{
722
722
  description: z.ZodEffects<z.ZodString, string, string>;
723
- threshold: z.ZodUnion<[z.ZodNumber, z.ZodString]>;
723
+ threshold: z.ZodDefault<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
724
724
  allocators: z.ZodArray<z.ZodObject<{
725
725
  guard: z.ZodEffects<z.ZodString, string, string>;
726
726
  sharing: z.ZodArray<z.ZodObject<{
@@ -850,7 +850,6 @@ export declare const CallAllocation_InputSchema: z.ZodObject<{
850
850
  }[];
851
851
  }, {
852
852
  description: string;
853
- threshold: string | number;
854
853
  allocators: {
855
854
  guard: string;
856
855
  sharing: {
@@ -870,6 +869,7 @@ export declare const CallAllocation_InputSchema: z.ZodObject<{
870
869
  max?: string | number | null | undefined;
871
870
  fix?: string | number | undefined;
872
871
  }[];
872
+ threshold?: string | number | undefined;
873
873
  }>;
874
874
  coin: z.ZodUnion<[z.ZodObject<{
875
875
  balance: z.ZodUnion<[z.ZodNumber, z.ZodString]>;
@@ -957,7 +957,6 @@ export declare const CallAllocation_InputSchema: z.ZodObject<{
957
957
  };
958
958
  allocators: {
959
959
  description: string;
960
- threshold: string | number;
961
960
  allocators: {
962
961
  guard: string;
963
962
  sharing: {
@@ -977,6 +976,7 @@ export declare const CallAllocation_InputSchema: z.ZodObject<{
977
976
  max?: string | number | null | undefined;
978
977
  fix?: string | number | undefined;
979
978
  }[];
979
+ threshold?: string | number | undefined;
980
980
  };
981
981
  payment_info: {
982
982
  index: string | number;
@@ -1370,7 +1370,6 @@ export declare const CallAllocation_InputSchema: z.ZodObject<{
1370
1370
  };
1371
1371
  allocators: {
1372
1372
  description: string;
1373
- threshold: string | number;
1374
1373
  allocators: {
1375
1374
  guard: string;
1376
1375
  sharing: {
@@ -1390,6 +1389,7 @@ export declare const CallAllocation_InputSchema: z.ZodObject<{
1390
1389
  max?: string | number | null | undefined;
1391
1390
  fix?: string | number | undefined;
1392
1391
  }[];
1392
+ threshold?: string | number | undefined;
1393
1393
  };
1394
1394
  payment_info: {
1395
1395
  index: string | number;
@@ -122,7 +122,7 @@ export const ExperienceSchema = z.object({
122
122
  avoid: z.array(z.string()).optional().describe("Pitfalls to avoid based on history. Example: ['Guard rejection on delivery_proof']"),
123
123
  relevance: z.number().min(0).max(1).optional().describe("Relevance score 0-1 of the matched experience. Example: 0.85"),
124
124
  matched_scenario: z.string().optional().describe("Matched historical scenario. Example: 'publish_service_freelance'"),
125
- }).strict().describe("Experience layer feedback from past operations (Phase 2 议题 2). Provides advice and pitfalls based on historical patterns.");
125
+ }).strict().describe("Experience layer feedback from past operations (Phase 2 Topic 2). Provides advice and pitfalls based on historical patterns.");
126
126
  export const ServiceStatusSchema = z.object({
127
127
  active: z.array(z.string()).describe("Phase 2 services currently active (enabled). Example: ['confirm_gate','project_service','experience_layer']"),
128
128
  inactive: z.array(z.string()).optional().describe("Phase 2 services currently inactive (can be toggled via config_operation). Example: ['harness','graph_persist']"),
@@ -131,29 +131,29 @@ export const CustomerReminderSchema = z.object({
131
131
  id: z.string().describe("Reminder rule id. Example: 'high_risk_score'"),
132
132
  stage: z.enum(["browse", "evaluate", "preorder", "in_progress", "complete", "after_sale"]).describe("Order lifecycle stage when this reminder fires. Example: 'evaluate'"),
133
133
  priority: z.enum(["required", "recommended", "info", "reminder"]).describe("Priority. 'required' = blocks purchase; 'recommended' = strong caution. Example: 'required'"),
134
- message: z.string().describe("Human-readable reminder message. Example: '🔴 综合风险分 25/100,强烈建议不购买'"),
134
+ message: z.string().describe("Human-readable reminder message. Example: 'Composite risk score 25/100, strongly discourage purchase'"),
135
135
  action: z.string().optional().describe("Suggested next action. Example: 'require merchant to bind Arbitration before ordering'"),
136
136
  }).strict().describe("A buyer-side reminder triggered at a specific order lifecycle stage (Phase 3 C-3).");
137
137
  export const PreferenceMatchSchema = z.object({
138
138
  score: z.number().min(0).max(100).describe("Match score 0-100 (higher = better fit). Example: 75"),
139
- matches: z.array(z.string()).describe("Aspects that match user preferences. Example: ['价格低于均价 10%','有仲裁']"),
140
- mismatches: z.array(z.string()).describe("Aspects that mismatch user preferences. Example: ['交付周期超出期望']"),
139
+ matches: z.array(z.string()).describe("Aspects that match user preferences. Example: ['Price 10% below average','Has arbitration']"),
140
+ mismatches: z.array(z.string()).describe("Aspects that mismatch user preferences. Example: ['Delivery cycle exceeds expectation']"),
141
141
  }).strict().describe("Service-to-preference match result (Phase 3 C-2). 7-dimension scoring: price/time/region/brand/bargain/emotion/risk.");
142
142
  export const CustomerAdviceSchema = z.object({
143
143
  risk_score: z.number().min(0).max(100).optional().describe("Composite risk score 0-100 (higher = safer). Relation: from risk-assessment.ts 4-dimension scoring. Example: 75"),
144
144
  risk_level: z.enum(["low", "medium_low", "medium_high", "high"]).optional().describe("Risk level bucket. 'high' = strongly discourage purchase. Example: 'medium_high'"),
145
- recommendations: z.array(z.string()).describe("Actionable recommendations for the buyer. Example: ['要求商家配置仲裁','通过 Messenger 协商退款条款']"),
146
- reminders: z.array(CustomerReminderSchema).describe("Stage-specific reminders (deduped, sorted by priority, capped to 3 high-risk). Example: [{priority:'required', message:'🔴 模糊 Guard 必须人工审查'}]"),
145
+ recommendations: z.array(z.string()).describe("Actionable recommendations for the buyer. Example: ['Require merchant to configure arbitration','Negotiate refund terms via Messenger']"),
146
+ reminders: z.array(CustomerReminderSchema).describe("Stage-specific reminders (deduped, sorted by priority, capped to 3 high-risk). Example: [{priority:'required', message:'Ambiguous Guard must be human-reviewed'}]"),
147
147
  preference_match: PreferenceMatchSchema.optional().describe("Service-to-preference match (populated when user preferences exist). Example: {score:75, matches:[...], mismatches:[...]}"),
148
148
  }).strict().describe("Buyer-side advice (Phase 3 C-3.3). Populated in semantic.customer_advice for order/query operations when customer_intelligence service is enabled.");
149
149
  export const EvolutionContextSchema = z.object({
150
- industry_signal: z.string().optional().describe("Industry evolution signal summary. Example: '行业健康度 82/100healthy);累积 25 个行业信号'"),
151
- evolution_advice: z.string().optional().describe("Evolution advice for the current operation. Example: '建议强制配置仲裁 + 赔偿金 + 交付 Guard'"),
150
+ industry_signal: z.string().optional().describe("Industry evolution signal summary. Example: 'Industry health 82/100 (healthy); 25 cumulative industry signals'"),
151
+ evolution_advice: z.string().optional().describe("Evolution advice for the current operation. Example: 'Recommend mandatory arbitration + compensation fund + delivery Guard'"),
152
152
  confidence: z.number().min(0).max(1).describe("Confidence of the evolution context 0-1. <0.5 means no data yet. Example: 0.75"),
153
153
  health_score: z.number().min(0).max(100).optional().describe("Industry health score 0-100 if available. Example: 82"),
154
154
  pending_suggestions: z.number().int().min(0).optional().describe("Count of pending industry update suggestions (filtered by role if role is set). Example: 3"),
155
155
  intent: z.enum(["default", "growth", "retention", "compliance", "efficiency", "trust_building", "custom"]).optional().describe("Phase 4 P4-6.C: Current business intent driving the scoring model. Absent = 'default'. Example: 'growth'"),
156
- role_advice: z.array(z.string()).optional().describe("Phase 4 P4-6.C: Role-targeted advice strings (user/merchant/arbitrator). Example: ['强化忠诚度飞轮','优化首单转化']"),
156
+ role_advice: z.array(z.string()).optional().describe("Phase 4 P4-6.C: Role-targeted advice strings (user/merchant/arbitrator). Example: ['Strengthen loyalty flywheel','Optimize first-order conversion']"),
157
157
  role: z.enum(["user", "merchant", "arbitrator"]).optional().describe("Phase 4 P4-6.C: Role used for advice routing. Example: 'merchant'"),
158
158
  }).strict().describe("Phase 4 industry evolution context (populated when industry_evolution service is enabled). Provides AI with industry-level health signals, evolution advice, and role-targeted recommendations.");
159
159
  export const GuardPuzzleStatusSchema = z.object({
@@ -166,7 +166,7 @@ export const GuardPuzzleStatusSchema = z.object({
166
166
  }).strict().describe("Guard information puzzle completeness status. 6 dimensions (A-F). false = missing, needs user input.");
167
167
  export const GuardAvailableQuerySchema = z.object({
168
168
  id: z.number().int().describe("Query instruction ID. Example: 1253"),
169
- name: z.string().describe("Query instruction name. Example: 'progress.current_node_name'"),
169
+ name: z.string().describe("Query instruction name. Example: 'progress.current'"),
170
170
  objectType: z.string().describe("Target object type. Example: 'Progress'"),
171
171
  returnType: z.string().describe("Return value type. Example: 'String'"),
172
172
  description: z.string().optional().describe("Query description"),
@@ -179,17 +179,17 @@ export const GuardAdviceSchema = z.object({
179
179
  matched_scene: z.string().optional()
180
180
  .describe("Matched Guard scene id from the 8 binding scenarios ledger. Example: 'machine_forward_guard'"),
181
181
  scene_description: z.string().optional()
182
- .describe("Human-readable scene description. Example: '工作流节点推进验证(Forward.guard'"),
182
+ .describe("Human-readable scene description. Example: 'Workflow node forward validation (Forward.guard)'"),
183
183
  scene_constraints: z.array(z.string()).optional()
184
- .describe("Special constraints for the matched scene. Example: ['Machine 发布后 Forward.guard 不可修改']"),
184
+ .describe("Special constraints for the matched scene. Example: ['Forward.guard cannot be modified after Machine is published']"),
185
185
  suggested_patterns: z.array(z.string()).optional()
186
- .describe("Suggested Guard patterns based on user intent. Example: ['时间锁','进度状态检查']"),
186
+ .describe("Suggested Guard patterns based on user intent. Example: ['time lock','progress status check']"),
187
187
  available_queries: z.array(GuardAvailableQuerySchema).optional()
188
188
  .describe("Available query instructions for the current context (subset of 375 GUARDQUERY entries)"),
189
189
  risk_warnings: z.array(z.string()).optional()
190
- .describe("Risk warnings for the current Guard design. Example: ['Guard 创建后不可修改','时间锁测试用 1000ms']"),
190
+ .describe("Risk warnings for the current Guard design. Example: ['Guard cannot be modified after creation','Time lock test uses 1000ms']"),
191
191
  pending_questions: z.array(z.string()).optional()
192
- .describe("Questions for the user to complete the puzzle. Example: ['Guard 将绑定到哪个 Host Object']"),
192
+ .describe("Questions for the user to complete the puzzle. Example: ['Which Host Object will the Guard bind to?']"),
193
193
  confirmation_text: z.string().optional()
194
194
  .describe("Structured semantic confirmation text for user review (generated when puzzle is complete). User must explicitly confirm before CREATE."),
195
195
  test_result: z.object({
@@ -217,7 +217,7 @@ export const SemanticSummarySchema = z.object({
217
217
  events: z.array(EventSemanticSchema).optional().describe("On-chain events annotated with business semantics (S-8)"),
218
218
  next_actions: z.array(NextActionSchema).optional().describe("Recommended next actions to drive the workflow forward"),
219
219
  warnings: z.array(z.string()).optional().describe("Business-level warnings. Example: 'order_allocators not configured; order funds cannot be distributed'"),
220
- experience: ExperienceSchema.optional().describe("Experience layer feedback from past operations (Phase 2 议题 2)"),
220
+ experience: ExperienceSchema.optional().describe("Experience layer feedback from past operations (Phase 2 Topic 2)"),
221
221
  service_status: ServiceStatusSchema.optional().describe("Phase 2 runtime service status (populated when semantic_rich is enabled). Lets AI see active services in each response."),
222
222
  customer_advice: CustomerAdviceSchema.optional().describe("Buyer-side advice (Phase 3 C-3.3). Populated when customer_intelligence service is enabled AND operation is order/query on a Service. Contains risk_score, recommendations, reminders, and preference_match."),
223
223
  evolution_context: EvolutionContextSchema.optional().describe("Phase 4 industry evolution context (populated when industry_evolution service is enabled). Provides AI with industry health signals and evolution advice."),
@@ -246,7 +246,7 @@ export const OperationPreviewSchema = z.object({
246
246
  immutable_after: z.array(z.string()).optional().describe("Fields that become immutable after this op (for publish). Example: ['machine','order_allocators']"),
247
247
  warnings: z.array(z.string()).optional().describe("Default-value warnings. Example: ['Using default account (env.account=\"\")']"),
248
248
  irreversible: z.boolean().optional().describe("True when the operation cannot be reverted. Example: true"),
249
- }).strict().describe("Preview of an operation awaiting user confirmation (Phase 2 议题 4 ConfirmGate).");
249
+ }).strict().describe("Preview of an operation awaiting user confirmation (Phase 2 Topic 4 ConfirmGate).");
250
250
  export const CallPendingConfirmationSchema = z.object({
251
251
  type: z.literal("pending_confirmation").describe("Discriminator. The operation was NOT executed; it is blocked pending user confirmation. Re-call with env.confirmed=true to proceed, or modify/cancel."),
252
252
  preview: OperationPreviewSchema.describe("Preview of the operation awaiting confirmation."),
@@ -290,7 +290,7 @@ export const CallResultSchema = z.discriminatedUnion("type", [
290
290
  type: z.literal("null").describe("Discriminator for this result variant. Constraint: always 'null'. Example: 'null'"),
291
291
  }),
292
292
  CallPendingConfirmationSchema,
293
- ]).describe("Discriminated union of 6 result types: 'transaction' (raw Sui response), 'submission' (Guard verification needed), 'error' (failed with error_code), 'data' (query result array), 'null' (no-op completed), 'pending_confirmation' (ConfirmGate blocked — re-call with env.confirmed=true). AI should check result.type first to determine how to process the response.");
293
+ ]).describe("Discriminated union of 6 result types: 'transaction' (raw Wow response), 'submission' (Guard verification needed), 'error' (failed with error_code), 'data' (query result array), 'null' (no-op completed), 'pending_confirmation' (ConfirmGate blocked — re-call with env.confirmed=true). AI should check result.type first to determine how to process the response.");
294
294
  export const ObjectsSchema = z.union([
295
295
  z.object({
296
296
  op: z.union([z.literal('add'), z.literal('set')]),
@@ -345,4 +345,4 @@ export const CallOutputSchema = z.object({
345
345
  semantic: SemanticSummarySchema.optional().describe("Business semantic summary. AI should read semantic first; fall back to parsing result only when semantic is absent. Relation: populated by MCP server from operation context; undefined when intent cannot be confidently inferred or for non-transaction tools. Example: {intent:'publish_service', status:'success', summary:'...'}"),
346
346
  harness_report: HarnessReportSchema.optional().describe("L4 Harness report (Verify + Recover). Present only when the Harness is injected and an Expected Result was declared for this operation. Relation: produced by handler.ts calling harness.verify() and harness.recover(). Example: {verify:{status:'fail', mismatches:[...]}, recovery:{strategy:'recreate'}}"),
347
347
  schema_warning: SchemaWarningSchema.optional().describe("Schema compatibility warning. Present only when client_schema_version is provided in env and a mismatch is detected."),
348
- }).strict().describe("Unified MCP tool output. result.type discriminates 5 outcomes: 'transaction' (raw Sui response), 'submission' (needs Guard data), 'error' (failed with error_code), 'data' (query result), 'null' (no-op). When semantic is present, prefer it over raw result parsing. When harness_report is present, check verify.status first and follow recovery.strategy if status is 'fail'.");
348
+ }).strict().describe("Unified MCP tool output. result.type discriminates 5 outcomes: 'transaction' (raw Wow response), 'submission' (needs Guard data), 'error' (failed with error_code), 'data' (query result), 'null' (no-op). When semantic is present, prefer it over raw result parsing. When harness_report is present, check verify.status first and follow recovery.strategy if status is 'fail'.");