@wowok/agent-mcp 2.3.16 → 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.
Files changed (106) hide show
  1. package/dist/customer/index.d.ts +9 -0
  2. package/dist/customer/index.js +9 -0
  3. package/dist/customer/industry-risks.d.ts +4 -0
  4. package/dist/customer/industry-risks.js +14 -0
  5. package/dist/customer/user-preferences.d.ts +3 -0
  6. package/dist/customer/user-preferences.js +9 -0
  7. package/dist/experience/realtime-feedback.js +17 -0
  8. package/dist/index.js +360 -273
  9. package/dist/knowledge/acquisition-flywheel.d.ts +3 -0
  10. package/dist/knowledge/acquisition-flywheel.js +9 -0
  11. package/dist/knowledge/guard-ledger.d.ts +19 -0
  12. package/dist/knowledge/guard-ledger.js +219 -0
  13. package/dist/knowledge/guard-puzzle.d.ts +93 -0
  14. package/dist/knowledge/guard-puzzle.js +278 -0
  15. package/dist/knowledge/guard-risk.d.ts +60 -0
  16. package/dist/knowledge/guard-risk.js +474 -0
  17. package/dist/knowledge/guard-translation.d.ts +46 -0
  18. package/dist/knowledge/guard-translation.js +487 -0
  19. package/dist/knowledge/index.d.ts +13 -0
  20. package/dist/knowledge/index.js +13 -0
  21. package/dist/knowledge/industry-registry.d.ts +1 -2
  22. package/dist/knowledge/industry-registry.js +23 -3
  23. package/dist/knowledge/safety-rules.js +61 -0
  24. package/dist/knowledge/tool-constraints.js +12 -22
  25. package/dist/safety/confirm-gate.d.ts +4 -2
  26. package/dist/safety/confirm-gate.js +48 -4
  27. package/dist/schema/call/allocation.d.ts +24 -14
  28. package/dist/schema/call/arbitration.d.ts +142 -132
  29. package/dist/schema/call/base.d.ts +901 -43
  30. package/dist/schema/call/base.js +66 -2
  31. package/dist/schema/call/bridge-handler.js +15 -2
  32. package/dist/schema/call/bridge.d.ts +769 -1
  33. package/dist/schema/call/bridge.js +37 -0
  34. package/dist/schema/call/contact.d.ts +10 -0
  35. package/dist/schema/call/demand.d.ts +10 -0
  36. package/dist/schema/call/guard.d.ts +76 -46
  37. package/dist/schema/call/handler.js +46 -14
  38. package/dist/schema/call/machine.d.ts +158 -138
  39. package/dist/schema/call/order.d.ts +10 -0
  40. package/dist/schema/call/payment.d.ts +10 -0
  41. package/dist/schema/call/permission.d.ts +232 -222
  42. package/dist/schema/call/personal.d.ts +10 -0
  43. package/dist/schema/call/progress.d.ts +10 -0
  44. package/dist/schema/call/proof.d.ts +20 -0
  45. package/dist/schema/call/repository.d.ts +32 -22
  46. package/dist/schema/call/reward.d.ts +10 -0
  47. package/dist/schema/call/semantic.d.ts +9 -2
  48. package/dist/schema/call/semantic.js +409 -21
  49. package/dist/schema/call/service.d.ts +20 -10
  50. package/dist/schema/call/treasury.d.ts +10 -0
  51. package/dist/schema/config/index.d.ts +18 -0
  52. package/dist/schema/config/index.js +17 -0
  53. package/dist/schema/index.d.ts +6 -0
  54. package/dist/schema/index.js +5 -0
  55. package/dist/schema/local/index.d.ts +9 -9
  56. package/dist/schema/local/index.js +9 -0
  57. package/dist/schema/messenger/index.d.ts +350 -29
  58. package/dist/schema/messenger/index.js +17 -17
  59. package/dist/schema/operations.d.ts +1667 -545
  60. package/dist/schema/operations.js +91 -96
  61. package/dist/schema/project/index.d.ts +21 -0
  62. package/dist/schema/project/index.js +32 -0
  63. package/dist/schema/query/index.d.ts +1074 -168
  64. package/dist/schema/query/index.js +8 -8
  65. package/dist/schema/schema-query/index.d.ts +33 -0
  66. package/dist/schema/schema-query/index.js +36 -0
  67. package/dist/schema/schema-version.d.ts +25 -0
  68. package/dist/schema/schema-version.js +76 -0
  69. package/dist/schema/trust/index.d.ts +407 -0
  70. package/dist/schema/trust/index.js +113 -0
  71. package/dist/schemas/bridge_operation.output.json +224 -0
  72. package/dist/schemas/bridge_operation.schema.json +67 -8
  73. package/dist/schemas/config_operation.output.json +18 -0
  74. package/dist/schemas/config_operation.schema.json +34 -0
  75. package/dist/schemas/guard-node-schema.json +82 -0
  76. package/dist/schemas/guard2file.schema.json +8 -0
  77. package/dist/schemas/index.json +19 -1
  78. package/dist/schemas/machineNode2file.schema.json +8 -0
  79. package/dist/schemas/messenger_operation.output.json +224 -0
  80. package/dist/schemas/onchain_events.output.json +718 -0
  81. package/dist/schemas/onchain_operations.output.json +277 -2
  82. package/dist/schemas/onchain_operations.schema.json +19 -16
  83. package/dist/schemas/onchain_operations_allocation.schema.json +8 -0
  84. package/dist/schemas/onchain_operations_arbitration.schema.json +8 -0
  85. package/dist/schemas/onchain_operations_contact.schema.json +8 -0
  86. package/dist/schemas/onchain_operations_demand.schema.json +8 -0
  87. package/dist/schemas/onchain_operations_gen_passport.schema.json +16 -0
  88. package/dist/schemas/onchain_operations_guard.schema.json +11 -16
  89. package/dist/schemas/onchain_operations_machine.schema.json +8 -0
  90. package/dist/schemas/onchain_operations_order.schema.json +8 -0
  91. package/dist/schemas/onchain_operations_payment.schema.json +8 -0
  92. package/dist/schemas/onchain_operations_permission.schema.json +8 -0
  93. package/dist/schemas/onchain_operations_personal.schema.json +8 -0
  94. package/dist/schemas/onchain_operations_progress.schema.json +8 -0
  95. package/dist/schemas/onchain_operations_repository.schema.json +8 -0
  96. package/dist/schemas/onchain_operations_reward.schema.json +8 -0
  97. package/dist/schemas/onchain_operations_service.schema.json +8 -0
  98. package/dist/schemas/onchain_operations_treasury.schema.json +8 -0
  99. package/dist/schemas/onchain_table_data.output.json +718 -0
  100. package/dist/schemas/project_operation.output.json +18 -0
  101. package/dist/schemas/project_operation.schema.json +42 -0
  102. package/dist/schemas/query_toolkit.schema.json +360 -368
  103. package/dist/schemas/schema_query.schema.json +6 -3
  104. package/dist/schemas/trust_score.output.json +327 -0
  105. package/dist/schemas/trust_score.schema.json +46 -0
  106. package/package.json +2 -2
@@ -67,6 +67,8 @@ export const CallEnvSchema = z.object({
67
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
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
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)."),
70
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.`);
71
73
  export const ObjectsOpSchema = z.union([
72
74
  z.object({
@@ -154,6 +156,57 @@ export const EvolutionContextSchema = z.object({
154
156
  role_advice: z.array(z.string()).optional().describe("Phase 4 P4-6.C: Role-targeted advice strings (user/merchant/arbitrator). Example: ['强化忠诚度飞轮','优化首单转化']"),
155
157
  role: z.enum(["user", "merchant", "arbitrator"]).optional().describe("Phase 4 P4-6.C: Role used for advice routing. Example: 'merchant'"),
156
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.");
157
210
  export const SemanticSummarySchema = z.object({
158
211
  intent: z.string().describe("Inferred user intent / operation goal. Constraint: snake_case string. Relation: derived from operation_type + data signals. Example: 'publish_service'"),
159
212
  status: z.enum(["success", "partial", "failed", "pending_input"]).describe("Business-level status (not raw tx status). 'pending_input' = needs Guard submission. Example: 'success'"),
@@ -168,12 +221,13 @@ export const SemanticSummarySchema = z.object({
168
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."),
169
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."),
170
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)."),
171
225
  }).strict().describe("Business semantic summary: translates the raw transaction response into AI-directly-understandable business meaning");
172
226
  export const CallResponseErrorSchema = z.object({
173
227
  type: z.literal("error").describe("Discriminator for this result variant. Constraint: always 'error'. Example: 'error'"),
174
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'"),
175
- 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 9 values. Relation: drives Recover Loop strategy selection. Example: 'insufficient_balance'"),
176
- retryable: z.boolean().optional().describe("Whether the same call can be retried as-is. Constraint: true only for network_error and insufficient_balance. Example: 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"),
177
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'"),
178
232
  related_object: z.string().optional().describe("Object ID related to the error, if any. Example: '0x123...'"),
179
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.");
@@ -276,9 +330,19 @@ export const HarnessReportSchema = z.object({
276
330
  verify: VerifyReportSchema.describe("Verify Loop report comparing expected vs actual."),
277
331
  recovery: RecoveryActionSchema.optional().describe("Recover Loop action. Present only when verify.status is 'fail' or 'warn', or when an error occurred."),
278
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.");
279
342
  export const CallOutputSchema = z.object({
280
343
  result: CallResultSchema.describe("Discriminated result. Check result.type first: 'transaction'|'submission'|'error'|'data'|'null'. Each variant has different fields."),
281
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'"),
282
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:'...'}"),
283
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."),
284
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
- return ok(`WOW→EVM cross-chain step 1 (deposit) submitted. transferId=${result.transferId}, activeEvmAccount=${result.activeEvmAccount}. ` +
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
- return ok(`EVM→WOW cross-chain submitted. transferId=${result.transferId}, activeEvmAccount=${result.activeEvmAccount}. ` +
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();