@wowok/agent-mcp 2.3.14 → 2.3.18
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/config/index.d.ts +1 -0
- package/dist/config/index.js +1 -0
- package/dist/config/runtime.d.ts +26 -0
- package/dist/config/runtime.js +217 -0
- package/dist/customer/index.d.ts +9 -0
- package/dist/customer/index.js +9 -0
- package/dist/customer/industry-risks.d.ts +40 -0
- package/dist/customer/industry-risks.js +438 -0
- package/dist/customer/info-puzzle.d.ts +102 -0
- package/dist/customer/info-puzzle.js +312 -0
- package/dist/customer/order-monitor.d.ts +75 -0
- package/dist/customer/order-monitor.js +327 -0
- package/dist/customer/order-strategy.d.ts +36 -0
- package/dist/customer/order-strategy.js +373 -0
- package/dist/customer/post-purchase.d.ts +42 -0
- package/dist/customer/post-purchase.js +350 -0
- package/dist/customer/reminder-system.d.ts +42 -0
- package/dist/customer/reminder-system.js +295 -0
- package/dist/customer/risk-assessment.d.ts +8 -0
- package/dist/customer/risk-assessment.js +337 -0
- package/dist/customer/types.d.ts +193 -0
- package/dist/customer/types.js +13 -0
- package/dist/customer/user-preferences.d.ts +70 -0
- package/dist/customer/user-preferences.js +460 -0
- package/dist/experience/experience-reuse.d.ts +10 -0
- package/dist/experience/experience-reuse.js +103 -0
- package/dist/experience/index.d.ts +6 -0
- package/dist/experience/index.js +5 -0
- package/dist/experience/intent-distill.d.ts +3 -0
- package/dist/experience/intent-distill.js +83 -0
- package/dist/experience/realtime-feedback.d.ts +5 -0
- package/dist/experience/realtime-feedback.js +94 -0
- package/dist/experience/types.d.ts +50 -0
- package/dist/experience/types.js +1 -0
- package/dist/experience/user-profile.d.ts +25 -0
- package/dist/experience/user-profile.js +171 -0
- package/dist/index.js +842 -371
- package/dist/knowledge/acquisition-flywheel.d.ts +53 -0
- package/dist/knowledge/acquisition-flywheel.js +192 -0
- package/dist/knowledge/arbitration-trust.d.ts +24 -0
- package/dist/knowledge/arbitration-trust.js +117 -0
- package/dist/knowledge/audit-rules.d.ts +28 -0
- package/dist/knowledge/audit-rules.js +141 -0
- package/dist/knowledge/demand-matching.d.ts +29 -0
- package/dist/knowledge/demand-matching.js +132 -0
- package/dist/knowledge/dynamic-pricing.d.ts +31 -0
- package/dist/knowledge/dynamic-pricing.js +87 -0
- package/dist/knowledge/flywheel-loop.d.ts +87 -0
- package/dist/knowledge/flywheel-loop.js +378 -0
- package/dist/knowledge/glossary.d.ts +18 -0
- package/dist/knowledge/glossary.js +209 -0
- package/dist/knowledge/guard-ledger.d.ts +19 -0
- package/dist/knowledge/guard-ledger.js +219 -0
- package/dist/knowledge/guard-puzzle.d.ts +93 -0
- package/dist/knowledge/guard-puzzle.js +278 -0
- package/dist/knowledge/guard-risk.d.ts +60 -0
- package/dist/knowledge/guard-risk.js +474 -0
- package/dist/knowledge/guard-translation.d.ts +46 -0
- package/dist/knowledge/guard-translation.js +487 -0
- package/dist/knowledge/index.d.ts +77 -0
- package/dist/knowledge/index.js +79 -0
- package/dist/knowledge/industry-evolution.d.ts +82 -0
- package/dist/knowledge/industry-evolution.js +323 -0
- package/dist/knowledge/industry-generalizer.d.ts +17 -0
- package/dist/knowledge/industry-generalizer.js +381 -0
- package/dist/knowledge/industry-registry.d.ts +48 -0
- package/dist/knowledge/industry-registry.js +187 -0
- package/dist/knowledge/intent-metrics.d.ts +42 -0
- package/dist/knowledge/intent-metrics.js +566 -0
- package/dist/knowledge/process-model.d.ts +24 -0
- package/dist/knowledge/process-model.js +160 -0
- package/dist/knowledge/reputation-rules.d.ts +42 -0
- package/dist/knowledge/reputation-rules.js +99 -0
- package/dist/knowledge/reward-templates.d.ts +25 -0
- package/dist/knowledge/reward-templates.js +125 -0
- package/dist/knowledge/safety-rules.d.ts +36 -0
- package/dist/knowledge/safety-rules.js +232 -0
- package/dist/knowledge/tool-constraints.d.ts +30 -0
- package/dist/knowledge/tool-constraints.js +175 -0
- package/dist/knowledge/trust-metrics.d.ts +37 -0
- package/dist/knowledge/trust-metrics.js +138 -0
- package/dist/loop-engineering/diagnose.d.ts +3 -2
- package/dist/loop-engineering/diagnose.js +94 -0
- package/dist/loop-engineering/improve.d.ts +1 -1
- package/dist/loop-engineering/improve.js +52 -1
- package/dist/project/graph.d.ts +71 -0
- package/dist/project/graph.js +314 -0
- package/dist/project/index.d.ts +62 -0
- package/dist/project/index.js +167 -0
- package/dist/project/namespace.d.ts +62 -0
- package/dist/project/namespace.js +181 -0
- package/dist/project/query.d.ts +40 -0
- package/dist/project/query.js +110 -0
- package/dist/safety/confirm-gate.d.ts +17 -0
- package/dist/safety/confirm-gate.js +88 -0
- package/dist/safety/index.d.ts +3 -0
- package/dist/safety/index.js +3 -0
- package/dist/safety/preview.d.ts +2 -0
- package/dist/safety/preview.js +36 -0
- package/dist/schema/call/allocation.d.ts +39 -14
- package/dist/schema/call/arbitration.d.ts +187 -162
- package/dist/schema/call/base.d.ts +1971 -87
- package/dist/schema/call/base.js +135 -3
- package/dist/schema/call/bridge-handler.js +15 -2
- package/dist/schema/call/bridge.d.ts +1478 -53
- package/dist/schema/call/bridge.js +50 -2
- package/dist/schema/call/contact.d.ts +25 -0
- package/dist/schema/call/demand.d.ts +79 -54
- package/dist/schema/call/guard.d.ts +125 -50
- package/dist/schema/call/handler.d.ts +3 -0
- package/dist/schema/call/handler.js +60 -14
- package/dist/schema/call/machine.d.ts +988 -938
- package/dist/schema/call/order.d.ts +25 -0
- package/dist/schema/call/payment.d.ts +25 -0
- package/dist/schema/call/permission.d.ts +244 -219
- package/dist/schema/call/personal.d.ts +25 -0
- package/dist/schema/call/progress.d.ts +25 -0
- package/dist/schema/call/proof.d.ts +62 -12
- package/dist/schema/call/proof.js +3 -3
- package/dist/schema/call/repository.d.ts +101 -76
- package/dist/schema/call/reward.d.ts +55 -30
- package/dist/schema/call/semantic.d.ts +10 -2
- package/dist/schema/call/semantic.js +616 -11
- package/dist/schema/call/service.d.ts +442 -417
- package/dist/schema/call/treasury.d.ts +25 -0
- package/dist/schema/common/index.js +3 -3
- 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 +237 -81
- package/dist/schema/local/index.js +42 -6
- package/dist/schema/messenger/index.d.ts +1018 -79
- package/dist/schema/messenger/index.js +26 -17
- package/dist/schema/operations.d.ts +3192 -1746
- package/dist/schema/operations.js +93 -98
- package/dist/schema/project/index.d.ts +21 -0
- package/dist/schema/project/index.js +32 -0
- package/dist/schema/query/index.d.ts +2762 -1856
- package/dist/schema/query/index.js +38 -35
- 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/schemas/account_operation.output.json +25 -16
- package/dist/schemas/account_operation.schema.json +1 -1
- package/dist/schemas/bridge_operation.output.json +744 -0
- package/dist/schemas/bridge_operation.schema.json +82 -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 +23 -0
- package/dist/schemas/index.json +19 -1
- package/dist/schemas/local_info_operation.output.json +23 -0
- package/dist/schemas/local_info_operation.schema.json +1 -1
- package/dist/schemas/local_mark_operation.output.json +24 -1
- package/dist/schemas/local_mark_operation.schema.json +4 -4
- package/dist/schemas/machineNode2file.schema.json +23 -0
- package/dist/schemas/messenger_operation.output.json +752 -0
- package/dist/schemas/onchain_events.output.json +718 -0
- package/dist/schemas/onchain_operations.output.json +627 -18
- package/dist/schemas/onchain_operations.schema.json +115 -39
- package/dist/schemas/onchain_operations_allocation.schema.json +23 -0
- package/dist/schemas/onchain_operations_arbitration.schema.json +23 -0
- package/dist/schemas/onchain_operations_contact.schema.json +23 -0
- package/dist/schemas/onchain_operations_demand.schema.json +23 -0
- package/dist/schemas/onchain_operations_gen_passport.schema.json +46 -0
- package/dist/schemas/onchain_operations_guard.schema.json +26 -16
- package/dist/schemas/onchain_operations_machine.schema.json +89 -23
- package/dist/schemas/onchain_operations_order.schema.json +23 -0
- package/dist/schemas/onchain_operations_payment.schema.json +23 -0
- package/dist/schemas/onchain_operations_permission.schema.json +23 -0
- package/dist/schemas/onchain_operations_personal.schema.json +23 -0
- package/dist/schemas/onchain_operations_progress.schema.json +23 -0
- package/dist/schemas/onchain_operations_repository.schema.json +23 -0
- package/dist/schemas/onchain_operations_reward.schema.json +23 -0
- package/dist/schemas/onchain_operations_service.schema.json +23 -0
- package/dist/schemas/onchain_operations_treasury.schema.json +23 -0
- package/dist/schemas/onchain_table_data.output.json +939 -69
- package/dist/schemas/onchain_table_data.schema.json +2 -2
- 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/package.json +2 -2
package/dist/schema/call/base.js
CHANGED
|
@@ -64,6 +64,11 @@ export const CallEnvSchema = z.object({
|
|
|
64
64
|
no_cache: z.boolean().optional().describe("Whether to disable caching."),
|
|
65
65
|
network: EntrypointSchema.optional(),
|
|
66
66
|
referrer: NameOrAddressSchema.optional().describe("Referrer ID. If the user is using the network for the first time, the referrer ID will be recorded."),
|
|
67
|
+
confirmed: z.boolean().optional().describe("Phase 2 ConfirmGate: set to true to proceed after a 'pending_confirmation' result. The operation is NOT executed until you re-call with confirmed=true after user consent."),
|
|
68
|
+
user_intent_phrases: z.array(z.string()).optional().describe("Phase 2 ConfirmGate: explicit user intent phrases collected from conversation context (e.g. 'use default account', 'force publish'). Used to bypass confirmation rules whose bypass_on_explicit_intent matches."),
|
|
69
|
+
project: z.string().optional().describe("Phase 2 ProjectService: explicit project prefix to assign this object to (e.g. 'myshop'). When set, the object is tagged with 'project:<prefix>' automatically. Overrides the prefix parsed from the object name."),
|
|
70
|
+
client_schema_version: z.string().optional().describe("Client-side schema version (semver, e.g. '1.0.0'). When provided, the server checks compatibility and attaches warnings if mismatched."),
|
|
71
|
+
schema_strict_mode: z.boolean().optional().describe("When true, schema incompatibility returns an error instead of a warning. Default: false (warn mode)."),
|
|
67
72
|
}).strict().describe(`IMPORTANT: Execution environment includes: account for signing operations, network selection (${ENTRYPOINT}), additional Guard permissions, and more. Used to specify context information during the call. If account is not specified, the default account ("") will be used.`);
|
|
68
73
|
export const ObjectsOpSchema = z.union([
|
|
69
74
|
z.object({
|
|
@@ -112,6 +117,96 @@ export const EventSemanticSchema = z.object({
|
|
|
112
117
|
related_object: z.string().optional().describe("Object ID the event relates to, if extractable. Example: '0x123...'"),
|
|
113
118
|
side_effect: z.string().optional().describe("Side effect description for AI. Example: 'Customers can now place orders against this Service'"),
|
|
114
119
|
}).strict().describe("An on-chain event annotated with business semantics");
|
|
120
|
+
export const ExperienceSchema = z.object({
|
|
121
|
+
advice: z.string().optional().describe("Advice from past experience. Example: 'Last time you forgot to set buy_guard; add it before publishing'"),
|
|
122
|
+
avoid: z.array(z.string()).optional().describe("Pitfalls to avoid based on history. Example: ['Guard rejection on delivery_proof']"),
|
|
123
|
+
relevance: z.number().min(0).max(1).optional().describe("Relevance score 0-1 of the matched experience. Example: 0.85"),
|
|
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.");
|
|
126
|
+
export const ServiceStatusSchema = z.object({
|
|
127
|
+
active: z.array(z.string()).describe("Phase 2 services currently active (enabled). Example: ['confirm_gate','project_service','experience_layer']"),
|
|
128
|
+
inactive: z.array(z.string()).optional().describe("Phase 2 services currently inactive (can be toggled via config_operation). Example: ['harness','graph_persist']"),
|
|
129
|
+
}).strict().describe("Phase 2 runtime service status (populated when semantic_rich is enabled). Lets AI see which services are active in each response.");
|
|
130
|
+
export const CustomerReminderSchema = z.object({
|
|
131
|
+
id: z.string().describe("Reminder rule id. Example: 'high_risk_score'"),
|
|
132
|
+
stage: z.enum(["browse", "evaluate", "preorder", "in_progress", "complete", "after_sale"]).describe("Order lifecycle stage when this reminder fires. Example: 'evaluate'"),
|
|
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,强烈建议不购买'"),
|
|
135
|
+
action: z.string().optional().describe("Suggested next action. Example: 'require merchant to bind Arbitration before ordering'"),
|
|
136
|
+
}).strict().describe("A buyer-side reminder triggered at a specific order lifecycle stage (Phase 3 C-3).");
|
|
137
|
+
export const PreferenceMatchSchema = z.object({
|
|
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: ['交付周期超出期望']"),
|
|
141
|
+
}).strict().describe("Service-to-preference match result (Phase 3 C-2). 7-dimension scoring: price/time/region/brand/bargain/emotion/risk.");
|
|
142
|
+
export const CustomerAdviceSchema = z.object({
|
|
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
|
+
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 必须人工审查'}]"),
|
|
147
|
+
preference_match: PreferenceMatchSchema.optional().describe("Service-to-preference match (populated when user preferences exist). Example: {score:75, matches:[...], mismatches:[...]}"),
|
|
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
|
+
export const EvolutionContextSchema = z.object({
|
|
150
|
+
industry_signal: z.string().optional().describe("Industry evolution signal summary. Example: '行业健康度 82/100(healthy);累积 25 个行业信号'"),
|
|
151
|
+
evolution_advice: z.string().optional().describe("Evolution advice for the current operation. Example: '建议强制配置仲裁 + 赔偿金 + 交付 Guard'"),
|
|
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
|
+
health_score: z.number().min(0).max(100).optional().describe("Industry health score 0-100 if available. Example: 82"),
|
|
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
|
+
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: ['强化忠诚度飞轮','优化首单转化']"),
|
|
157
|
+
role: z.enum(["user", "merchant", "arbitrator"]).optional().describe("Phase 4 P4-6.C: Role used for advice routing. Example: 'merchant'"),
|
|
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
|
+
export const GuardPuzzleStatusSchema = z.object({
|
|
160
|
+
intent: z.boolean().describe("Intent dimension complete (action + rule + failure conditions)"),
|
|
161
|
+
binding: z.boolean().describe("Binding dimension complete (host object + field + circular ref)"),
|
|
162
|
+
data: z.boolean().describe("Data dimension complete (table entries + witnesses)"),
|
|
163
|
+
query: z.boolean().describe("Query dimension complete (query instructions if needed)"),
|
|
164
|
+
logic: z.boolean().describe("Logic dimension complete (root node returns Bool)"),
|
|
165
|
+
constraints: z.boolean().describe("Constraints dimension complete (10 Pitfalls checked)"),
|
|
166
|
+
}).strict().describe("Guard information puzzle completeness status. 6 dimensions (A-F). false = missing, needs user input.");
|
|
167
|
+
export const GuardAvailableQuerySchema = z.object({
|
|
168
|
+
id: z.number().int().describe("Query instruction ID. Example: 1253"),
|
|
169
|
+
name: z.string().describe("Query instruction name. Example: 'progress.current_node_name'"),
|
|
170
|
+
objectType: z.string().describe("Target object type. Example: 'Progress'"),
|
|
171
|
+
returnType: z.string().describe("Return value type. Example: 'String'"),
|
|
172
|
+
description: z.string().optional().describe("Query description"),
|
|
173
|
+
}).strict().describe("A Guard query instruction available for the current context (subset of GUARDQUERY 375 entries).");
|
|
174
|
+
export const GuardAdviceSchema = z.object({
|
|
175
|
+
current_round: z.enum(["R1", "R2", "R3", "R4", "R5", "R6", "R7", "R8", "R9", "R10"]).optional()
|
|
176
|
+
.describe("Current R1-R10 dialogue round. R1=intent, R2=table, R3=tree, R4=rely, R5=binding, R6=review, R7=CREATE, R8=test, R9=bind, R10=verify. Example: 'R3'"),
|
|
177
|
+
puzzle_status: GuardPuzzleStatusSchema.optional()
|
|
178
|
+
.describe("Information puzzle completeness (6 dimensions). Missing dimensions need user input before CREATE."),
|
|
179
|
+
matched_scene: z.string().optional()
|
|
180
|
+
.describe("Matched Guard scene id from the 8 binding scenarios ledger. Example: 'machine_forward_guard'"),
|
|
181
|
+
scene_description: z.string().optional()
|
|
182
|
+
.describe("Human-readable scene description. Example: '工作流节点推进验证(Forward.guard)'"),
|
|
183
|
+
scene_constraints: z.array(z.string()).optional()
|
|
184
|
+
.describe("Special constraints for the matched scene. Example: ['Machine 发布后 Forward.guard 不可修改']"),
|
|
185
|
+
suggested_patterns: z.array(z.string()).optional()
|
|
186
|
+
.describe("Suggested Guard patterns based on user intent. Example: ['时间锁','进度状态检查']"),
|
|
187
|
+
available_queries: z.array(GuardAvailableQuerySchema).optional()
|
|
188
|
+
.describe("Available query instructions for the current context (subset of 375 GUARDQUERY entries)"),
|
|
189
|
+
risk_warnings: z.array(z.string()).optional()
|
|
190
|
+
.describe("Risk warnings for the current Guard design. Example: ['Guard 创建后不可修改','时间锁测试用 1000ms']"),
|
|
191
|
+
pending_questions: z.array(z.string()).optional()
|
|
192
|
+
.describe("Questions for the user to complete the puzzle. Example: ['Guard 将绑定到哪个 Host Object?']"),
|
|
193
|
+
confirmation_text: z.string().optional()
|
|
194
|
+
.describe("Structured semantic confirmation text for user review (generated when puzzle is complete). User must explicitly confirm before CREATE."),
|
|
195
|
+
test_result: z.object({
|
|
196
|
+
status: z.enum(["pass", "fail", "not_tested"]),
|
|
197
|
+
failure_node: z.string().optional().describe("Node that caused failure (if fail)"),
|
|
198
|
+
passport_id: z.string().optional().describe("Generated Passport ID (if pass)"),
|
|
199
|
+
}).optional().describe("gen_passport static test result. Must pass before CREATE."),
|
|
200
|
+
risk_assessment: z.object({
|
|
201
|
+
overall_risk: z.enum(["critical", "high", "medium", "low", "info"]).describe("Overall risk level (highest from all risks)"),
|
|
202
|
+
risk_count: z.number().int().describe("Total number of detected risks"),
|
|
203
|
+
critical_count: z.number().int().describe("Number of critical risks"),
|
|
204
|
+
high_count: z.number().int().describe("Number of high risks"),
|
|
205
|
+
needs_human_review: z.boolean().describe("Whether human review is required (critical or 2+ high risks)"),
|
|
206
|
+
top_risks: z.array(z.string()).describe("Top risk titles (critical and high, max 3)"),
|
|
207
|
+
stakeholder_advice: z.record(z.string(), z.array(z.string())).optional().describe("Per-stakeholder advice. Key=stakeholder (customer/provider/arbitrator/claimant), value=advice list"),
|
|
208
|
+
}).optional().describe("Business-layer risk assessment (game theory, data source trust, logic gaps). Populated during Guard design to warn about business risks beyond syntax."),
|
|
209
|
+
}).strict().describe("Guard advice (Phase 5 Guard capability system). Injected when user intent involves Guard. Provides context for Guard design, generation, confirmation, and execution.");
|
|
115
210
|
export const SemanticSummarySchema = z.object({
|
|
116
211
|
intent: z.string().describe("Inferred user intent / operation goal. Constraint: snake_case string. Relation: derived from operation_type + data signals. Example: 'publish_service'"),
|
|
117
212
|
status: z.enum(["success", "partial", "failed", "pending_input"]).describe("Business-level status (not raw tx status). 'pending_input' = needs Guard submission. Example: 'success'"),
|
|
@@ -122,15 +217,41 @@ export const SemanticSummarySchema = z.object({
|
|
|
122
217
|
events: z.array(EventSemanticSchema).optional().describe("On-chain events annotated with business semantics (S-8)"),
|
|
123
218
|
next_actions: z.array(NextActionSchema).optional().describe("Recommended next actions to drive the workflow forward"),
|
|
124
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)"),
|
|
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
|
+
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
|
+
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."),
|
|
224
|
+
guard_advice: GuardAdviceSchema.optional().describe("Phase 5 Guard capability advice (populated when user intent involves Guard). Provides puzzle status, scene matching, suggested patterns, available queries, risk warnings, and confirmation text. AI uses this to guide Guard design dialogue (R1-R10)."),
|
|
125
225
|
}).strict().describe("Business semantic summary: translates the raw transaction response into AI-directly-understandable business meaning");
|
|
126
226
|
export const CallResponseErrorSchema = z.object({
|
|
127
227
|
type: z.literal("error").describe("Discriminator for this result variant. Constraint: always 'error'. Example: 'error'"),
|
|
128
228
|
error: z.string().describe("Human-readable error message from the chain or SDK. Relation: enriched via enrichMoveError before classification. Example: 'Insufficient balance for gas'"),
|
|
129
|
-
error_code: z.enum(["invalid_parameter", "guard_rejected", "state_conflict", "insufficient_balance", "object_not_found", "permission_denied", "immutable_violation", "network_error", "unknown"]).optional().describe("Error classification for programmatic recovery. Constraint: enum of
|
|
130
|
-
retryable: z.boolean().optional().describe("Whether the same call can be retried as-is. Constraint: true
|
|
229
|
+
error_code: z.enum(["invalid_parameter", "guard_rejected", "state_conflict", "insufficient_balance", "object_not_found", "permission_denied", "immutable_violation", "network_error", "rate_limit", "gas_exceeded", "bcs_error", "signature_error", "config_error", "unknown"]).optional().describe("Error classification for programmatic recovery. Constraint: enum of 14 values. Relation: drives Recover Loop strategy selection. Example: 'insufficient_balance'"),
|
|
230
|
+
retryable: z.boolean().optional().describe("Whether the same call can be retried as-is. Constraint: true for network_error, rate_limit, gas_exceeded, and insufficient_balance. Example: true"),
|
|
131
231
|
recovery_hint: z.string().optional().describe("Recovery suggestion for AI or user. Relation: paired with error_code to guide Recover Loop. Example: 'Claim faucet tokens then retry'"),
|
|
132
232
|
related_object: z.string().optional().describe("Object ID related to the error, if any. Example: '0x123...'"),
|
|
133
233
|
}).describe("Error result. Contains the raw error message plus structured classification (error_code/retryable/recovery_hint) so AI can choose a recovery strategy without parsing the error string.");
|
|
234
|
+
export const OperationPreviewSchema = z.object({
|
|
235
|
+
level: z.enum(["none", "standard", "amount", "publish", "irreversible"]).describe("Confirmation level. 'irreversible' = cannot be undone (arb verdict, payment). 'publish' = locks immutable fields. 'amount' = amount-sensitive. 'standard' = default-value warnings."),
|
|
236
|
+
operation: z.string().describe("operation_type that triggered the gate. Example: 'payment'"),
|
|
237
|
+
object: z.union([z.string(), z.record(z.any()), z.null()]).optional().describe("Object name/id involved (string for existing, object for new creation). Example: 'myshop_service' or {name: 'myshop_service'}"),
|
|
238
|
+
network: z.string().optional().describe("Network in use. Example: 'mainnet'"),
|
|
239
|
+
account: z.string().optional().describe("Signing account ('' = default). Example: '' or '0xabc...'"),
|
|
240
|
+
amount: z.object({
|
|
241
|
+
value: z.string().describe("Smallest-unit value as string. Example: '2500000000'"),
|
|
242
|
+
token: z.string().describe("Coin type tag. Example: '0x2::wow::WOW'"),
|
|
243
|
+
human_readable: z.string().describe("Human-readable amount. Example: '2.5 WOW'"),
|
|
244
|
+
recipient: z.string().optional().describe("Recipient address if known. Example: '0xdef...'"),
|
|
245
|
+
}).optional().describe("Amount info for amount-level confirmations."),
|
|
246
|
+
immutable_after: z.array(z.string()).optional().describe("Fields that become immutable after this op (for publish). Example: ['machine','order_allocators']"),
|
|
247
|
+
warnings: z.array(z.string()).optional().describe("Default-value warnings. Example: ['Using default account (env.account=\"\")']"),
|
|
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).");
|
|
250
|
+
export const CallPendingConfirmationSchema = z.object({
|
|
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
|
+
preview: OperationPreviewSchema.describe("Preview of the operation awaiting confirmation."),
|
|
253
|
+
rule_id: z.string().optional().describe("Id of the confirmation rule that matched. Example: 'publish_immutable'"),
|
|
254
|
+
}).describe("Pending confirmation. The ConfirmGate blocked the operation. Read preview first; if user consents, re-invoke the SAME call with env.confirmed=true.");
|
|
134
255
|
export const GuardSubmissionToFillSchema = z.object({
|
|
135
256
|
guard: NameOrAddressSchema.describe("Guard object name or ID that requires submission data. Example: 'my-delivery-guard'"),
|
|
136
257
|
submission: z.array(GuardTableItemSchema).describe("User-submitted data matching the Guard's required fields. Relation: structure must match the Guard table's column definitions. Example: [{field:'delivery_proof', value:'Qm...'}]"),
|
|
@@ -168,7 +289,8 @@ export const CallResultSchema = z.discriminatedUnion("type", [
|
|
|
168
289
|
z.object({
|
|
169
290
|
type: z.literal("null").describe("Discriminator for this result variant. Constraint: always 'null'. Example: 'null'"),
|
|
170
291
|
}),
|
|
171
|
-
|
|
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.");
|
|
172
294
|
export const ObjectsSchema = z.union([
|
|
173
295
|
z.object({
|
|
174
296
|
op: z.union([z.literal('add'), z.literal('set')]),
|
|
@@ -208,9 +330,19 @@ export const HarnessReportSchema = z.object({
|
|
|
208
330
|
verify: VerifyReportSchema.describe("Verify Loop report comparing expected vs actual."),
|
|
209
331
|
recovery: RecoveryActionSchema.optional().describe("Recover Loop action. Present only when verify.status is 'fail' or 'warn', or when an error occurred."),
|
|
210
332
|
}).describe("L4 Harness report attached to CallOutput when the Harness is injected. Contains verify result and optional recovery action. AI should check verify.status first; if 'fail', consult recovery.strategy.");
|
|
333
|
+
export const SchemaWarningSchema = z.object({
|
|
334
|
+
compatible: z.boolean().describe("Whether the client schema version is compatible with the server."),
|
|
335
|
+
warnings: z.array(z.string()).describe("Schema compatibility warnings or errors."),
|
|
336
|
+
client_version: z.string().optional().describe("The client schema version that was checked."),
|
|
337
|
+
server_versions: z.object({
|
|
338
|
+
sdk: z.string().describe("Server-side SDK schema version."),
|
|
339
|
+
mcp: z.string().describe("Server-side MCP tool schema version."),
|
|
340
|
+
}).describe("Server-side schema versions."),
|
|
341
|
+
}).strict().describe("Schema compatibility warning attached to tool output when client_schema_version is provided and a mismatch is detected.");
|
|
211
342
|
export const CallOutputSchema = z.object({
|
|
212
343
|
result: CallResultSchema.describe("Discriminated result. Check result.type first: 'transaction'|'submission'|'error'|'data'|'null'. Each variant has different fields."),
|
|
213
344
|
message: z.string().optional().describe("Human-readable summary or hint. Constraint: always present for error/transaction results; may be omitted for data/null. Example: 'Transaction completed successfully'"),
|
|
214
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:'...'}"),
|
|
215
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
|
+
schema_warning: SchemaWarningSchema.optional().describe("Schema compatibility warning. Present only when client_schema_version is provided in env and a mismatch is detected."),
|
|
216
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'.");
|
|
@@ -116,8 +116,11 @@ export async function handleBridgeOperations(args) {
|
|
|
116
116
|
amount: BigInt(data.amount),
|
|
117
117
|
withdrawTo: data.withdrawTo,
|
|
118
118
|
waitForFinalization: false,
|
|
119
|
+
idempotencyKey: data.idempotencyKey,
|
|
120
|
+
idempotentByParams: data.idempotentByParams,
|
|
119
121
|
});
|
|
120
|
-
|
|
122
|
+
const idemMsg = result.idempotentHit ? " [IDEMPOTENT HIT — no new deposit]" : "";
|
|
123
|
+
return ok(`WOW→EVM cross-chain step 1 (deposit) submitted. transferId=${result.transferId}, activeEvmAccount=${result.activeEvmAccount}.${idemMsg} ` +
|
|
121
124
|
`Next: poll query_transfer_status until bridge signs (~1-5 min), then call claim_wow_to_evm to complete.`, result, ctx);
|
|
122
125
|
}
|
|
123
126
|
case "cross_chain_evm_to_wow": {
|
|
@@ -130,8 +133,11 @@ export async function handleBridgeOperations(args) {
|
|
|
130
133
|
amount: BigInt(data.amount),
|
|
131
134
|
recipientWowAddress,
|
|
132
135
|
waitForFinalization: false,
|
|
136
|
+
idempotencyKey: data.idempotencyKey,
|
|
137
|
+
idempotentByParams: data.idempotentByParams,
|
|
133
138
|
});
|
|
134
|
-
|
|
139
|
+
const idemMsg = result.idempotentHit ? " [IDEMPOTENT HIT — no new deposit]" : "";
|
|
140
|
+
return ok(`EVM→WOW cross-chain submitted. transferId=${result.transferId}, activeEvmAccount=${result.activeEvmAccount}.${idemMsg} ` +
|
|
135
141
|
`Bridge will auto-claim on WOW (~10-20 min). Poll query_transfer_status to monitor progress.`, result, ctx);
|
|
136
142
|
}
|
|
137
143
|
case "claim_wow_to_evm": {
|
|
@@ -141,6 +147,13 @@ export async function handleBridgeOperations(args) {
|
|
|
141
147
|
const result = await client.claimWowToEvm(data.transferId);
|
|
142
148
|
return ok(`WOW→EVM claim (step 2) completed. transferId=${result.transferId}, claimTxHash=${result.claimTxHash}`, result, ctx);
|
|
143
149
|
}
|
|
150
|
+
case "resume_transfer": {
|
|
151
|
+
validateMainnet(env);
|
|
152
|
+
const data = validated.data;
|
|
153
|
+
const client = getBridgeClient(env);
|
|
154
|
+
const result = await client.resumeTransfer(data.transferId);
|
|
155
|
+
return ok(`Transfer ${data.transferId} resumed. Current step: ${result.step}, status: ${result.status}.`, result, ctx);
|
|
156
|
+
}
|
|
144
157
|
case "withdraw": {
|
|
145
158
|
const data = validated.data;
|
|
146
159
|
const client = getBridgeClientForQuery();
|