@wowok/agent-mcp 2.6.0 → 2.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/README.md +5 -3
  2. package/dist/extensions/capability-manifest.d.ts +125 -0
  3. package/dist/extensions/capability-manifest.js +594 -0
  4. package/dist/extensions/constraint-registry.d.ts +24 -0
  5. package/dist/extensions/constraint-registry.js +196 -0
  6. package/dist/extensions/index.d.ts +12 -0
  7. package/dist/extensions/index.js +6 -0
  8. package/dist/extensions/metric-registry.d.ts +26 -0
  9. package/dist/extensions/metric-registry.js +257 -0
  10. package/dist/extensions/mode-evaluator.d.ts +15 -0
  11. package/dist/extensions/mode-evaluator.js +170 -0
  12. package/dist/extensions/modes.d.ts +2 -0
  13. package/dist/extensions/modes.js +407 -0
  14. package/dist/extensions/registry.d.ts +48 -0
  15. package/dist/extensions/registry.js +629 -0
  16. package/dist/extensions/types.d.ts +218 -0
  17. package/dist/extensions/types.js +1 -0
  18. package/dist/knowledge/deployment-scanner.d.ts +3 -0
  19. package/dist/knowledge/deployment-scanner.js +64 -3
  20. package/dist/knowledge/guard-risk.d.ts +13 -0
  21. package/dist/knowledge/guard-risk.js +57 -0
  22. package/dist/knowledge/guard-templates.js +278 -0
  23. package/dist/knowledge/machine-templates.js +20 -1
  24. package/dist/knowledge/service-confirm.d.ts +14 -5
  25. package/dist/knowledge/service-confirm.js +116 -8
  26. package/dist/knowledge/tool-constraints.js +6 -2
  27. package/dist/project/deployment-bridge.d.ts +1 -1
  28. package/dist/project/deployment-bridge.js +27 -4
  29. package/dist/project/deployment-doc.d.ts +3 -0
  30. package/dist/project/deployment-doc.js +72 -10
  31. package/dist/project/evaluation.d.ts +2 -0
  32. package/dist/project/evaluation.js +569 -84
  33. package/dist/project/graph-builder.d.ts +4 -1
  34. package/dist/project/graph-builder.js +126 -61
  35. package/dist/project/graph.d.ts +1 -0
  36. package/dist/project/handlers.d.ts +219 -5
  37. package/dist/project/handlers.js +819 -9
  38. package/dist/project/stage-gate.d.ts +4 -0
  39. package/dist/project/stage-gate.js +64 -5
  40. package/dist/project/task-tracker.d.ts +26 -0
  41. package/dist/project/task-tracker.js +78 -0
  42. package/dist/safety/preview.js +16 -0
  43. package/dist/schema/call/allocation.d.ts +16 -16
  44. package/dist/schema/call/base.d.ts +21 -13
  45. package/dist/schema/call/base.js +27 -6
  46. package/dist/schema/call/bridge.d.ts +5 -5
  47. package/dist/schema/call/bridge.js +3 -1
  48. package/dist/schema/call/demand.d.ts +23 -31
  49. package/dist/schema/call/guard.js +1 -1
  50. package/dist/schema/call/machine.d.ts +402 -376
  51. package/dist/schema/call/order.d.ts +149 -228
  52. package/dist/schema/call/order.js +7 -3
  53. package/dist/schema/call/payment.d.ts +183 -3
  54. package/dist/schema/call/payment.js +21 -3
  55. package/dist/schema/call/personal.d.ts +241 -52
  56. package/dist/schema/call/progress.d.ts +53 -61
  57. package/dist/schema/call/progress.js +18 -4
  58. package/dist/schema/call/repository.d.ts +23 -31
  59. package/dist/schema/call/semantic.d.ts +1 -1
  60. package/dist/schema/call/semantic.js +30 -1
  61. package/dist/schema/call/service.d.ts +95 -119
  62. package/dist/schema/call/service.js +22 -1
  63. package/dist/schema/common/index.d.ts +11 -2
  64. package/dist/schema/common/index.js +43 -14
  65. package/dist/schema/local/index.d.ts +32 -35
  66. package/dist/schema/local/index.js +23 -5
  67. package/dist/schema/messenger/index.d.ts +274 -46
  68. package/dist/schema/operations.d.ts +680 -539
  69. package/dist/schema/operations.js +22 -0
  70. package/dist/schema/project/index.d.ts +1796 -80
  71. package/dist/schema/project/index.js +304 -14
  72. package/dist/schema/query/index.d.ts +705 -349
  73. package/dist/schema/query/index.js +164 -31
  74. package/dist/schema/schema-query/index.d.ts +15 -3
  75. package/dist/schema/schema-query/index.js +23 -5
  76. package/dist/schema/utils/node-parser.js +7 -4
  77. package/dist/schema-query/index.d.ts +7 -1
  78. package/dist/schema-query/index.js +204 -4
  79. package/dist/schemas/account_operation.output.json +7 -1
  80. package/dist/schemas/account_operation.schema.json +2 -2
  81. package/dist/schemas/bridge_operation.output.json +6 -0
  82. package/dist/schemas/bridge_operation.schema.json +1 -1
  83. package/dist/schemas/guard-templates.json +379 -0
  84. package/dist/schemas/guard2file.schema.json +1 -1
  85. package/dist/schemas/index.json +1 -1
  86. package/dist/schemas/local_info_operation.output.json +6 -0
  87. package/dist/schemas/local_mark_operation.output.json +7 -1
  88. package/dist/schemas/local_mark_operation.schema.json +1 -1
  89. package/dist/schemas/machineNode2file.schema.json +1 -1
  90. package/dist/schemas/messenger_operation.schema.json +4 -4
  91. package/dist/schemas/onchain_events.output.json +1 -1
  92. package/dist/schemas/onchain_operations.schema.json +348 -296
  93. package/dist/schemas/onchain_operations_allocation.schema.json +34 -25
  94. package/dist/schemas/onchain_operations_arbitration.schema.json +8 -8
  95. package/dist/schemas/onchain_operations_contact.schema.json +8 -8
  96. package/dist/schemas/onchain_operations_demand.schema.json +8 -8
  97. package/dist/schemas/onchain_operations_gen_passport.schema.json +14 -14
  98. package/dist/schemas/onchain_operations_gen_proof.schema.json +2 -2
  99. package/dist/schemas/onchain_operations_guard.schema.json +1 -1
  100. package/dist/schemas/onchain_operations_machine.schema.json +41 -33
  101. package/dist/schemas/onchain_operations_order.schema.json +71 -77
  102. package/dist/schemas/onchain_operations_payment.schema.json +141 -111
  103. package/dist/schemas/onchain_operations_permission.schema.json +2 -2
  104. package/dist/schemas/onchain_operations_personal.schema.json +7 -7
  105. package/dist/schemas/onchain_operations_progress.schema.json +8 -8
  106. package/dist/schemas/onchain_operations_proof.schema.json +7 -7
  107. package/dist/schemas/onchain_operations_repository.schema.json +8 -8
  108. package/dist/schemas/onchain_operations_reward.schema.json +10 -10
  109. package/dist/schemas/onchain_operations_service.schema.json +46 -35
  110. package/dist/schemas/onchain_operations_treasury.schema.json +8 -8
  111. package/dist/schemas/onchain_table_data.output.json +33 -25
  112. package/dist/schemas/onchain_table_data.schema.json +12 -12
  113. package/dist/schemas/project_operation.output.json +1175 -23
  114. package/dist/schemas/project_operation.schema.json +40 -4
  115. package/dist/schemas/query_toolkit.output.json +104 -76
  116. package/dist/schemas/query_toolkit.schema.json +9 -9
  117. package/dist/schemas/schema_query.output.json +7 -3
  118. package/dist/schemas/schema_query.schema.json +17 -3
  119. package/dist/tools/handlers/local.js +20 -5
  120. package/dist/tools/handlers/onchain.js +23 -0
  121. package/dist/tools/handlers/project.js +52 -3
  122. package/dist/tools/handlers/query.js +27 -0
  123. package/dist/tools/handlers/schema-query.js +19 -0
  124. package/dist/tools/handlers/task-status.d.ts +170 -0
  125. package/dist/tools/handlers/task-status.js +55 -0
  126. package/dist/tools/handlers/wip.js +47 -1
  127. package/dist/tools/index.js +211 -7
  128. package/dist/tools/retry.d.ts +8 -0
  129. package/dist/tools/retry.js +85 -0
  130. package/dist/tools/wip-deploy-assist.d.ts +28 -0
  131. package/dist/tools/wip-deploy-assist.js +278 -0
  132. package/package.json +2 -2
  133. package/dist/schemas/guard-node-examples.md +0 -199
@@ -1,9 +1,15 @@
1
- import { readFileSync, existsSync } from "fs";
2
- import { resolve, join } from "path";
1
+ import { readFileSync, existsSync, writeFileSync, mkdirSync } from "fs";
2
+ import { resolve, join, dirname } from "path";
3
3
  import { fileURLToPath } from "url";
4
4
  const __filename = fileURLToPath(import.meta.url);
5
5
  const __dirname = fileURLToPath(new URL(".", import.meta.url));
6
6
  const SCHEMAS_DIR = resolve(__dirname, "../../dist/schemas");
7
+ const GUARD_TEMPLATES_PATH_SCRIPTS = resolve(__dirname, "../../scripts/guard-templates.json");
8
+ const GUARD_TEMPLATES_PATH_DIST = resolve(__dirname, "../../dist/schemas/guard-templates.json");
9
+ const GUARD_TEMPLATES_PATH = existsSync(GUARD_TEMPLATES_PATH_SCRIPTS)
10
+ ? GUARD_TEMPLATES_PATH_SCRIPTS
11
+ : GUARD_TEMPLATES_PATH_DIST;
12
+ const WORKSPACE_TMP_DIR = resolve(process.cwd(), ".trae", "tmp");
7
13
  export function areSchemasAvailable() {
8
14
  return existsSync(SCHEMAS_DIR) && existsSync(join(SCHEMAS_DIR, "index.json"));
9
15
  }
@@ -59,6 +65,78 @@ export function getOutputSchema(name) {
59
65
  return null;
60
66
  }
61
67
  }
68
+ export function getGuardTemplates(templateName) {
69
+ try {
70
+ if (!existsSync(GUARD_TEMPLATES_PATH)) {
71
+ return null;
72
+ }
73
+ const content = readFileSync(GUARD_TEMPLATES_PATH, "utf-8");
74
+ const catalog = JSON.parse(content);
75
+ if (!templateName) {
76
+ return {
77
+ version: catalog.version,
78
+ description: catalog.description,
79
+ templates: (catalog.templates || []).map((t) => ({
80
+ name: t.name,
81
+ title: t.title,
82
+ description: t.description,
83
+ use_case: t.use_case,
84
+ })),
85
+ query_reference: catalog.query_reference,
86
+ node_return_types: catalog.node_return_types,
87
+ };
88
+ }
89
+ const template = (catalog.templates || []).find((t) => t.name === templateName);
90
+ if (!template) {
91
+ return null;
92
+ }
93
+ return template;
94
+ }
95
+ catch {
96
+ return null;
97
+ }
98
+ }
99
+ export function getSchemaField(name, fieldPath) {
100
+ const schema = getSchema(name);
101
+ if (!schema)
102
+ return null;
103
+ const parts = fieldPath.split(".").filter(Boolean);
104
+ let current = schema;
105
+ for (const part of parts) {
106
+ if (!current || typeof current !== "object")
107
+ return null;
108
+ if (current.properties && part in current.properties) {
109
+ current = current.properties[part];
110
+ continue;
111
+ }
112
+ if (current.items && typeof current.items === "object") {
113
+ if (/^\d+$/.test(part)) {
114
+ current = current.items;
115
+ continue;
116
+ }
117
+ if (current.items.properties && part in current.items.properties) {
118
+ current = current.items.properties[part];
119
+ continue;
120
+ }
121
+ }
122
+ if (Array.isArray(current.oneOf) || Array.isArray(current.anyOf)) {
123
+ const variants = current.oneOf ?? current.anyOf;
124
+ for (const v of variants) {
125
+ if (v && typeof v === "object" && v.properties && part in v.properties) {
126
+ current = v.properties[part];
127
+ break;
128
+ }
129
+ }
130
+ continue;
131
+ }
132
+ if (part in current) {
133
+ current = current[part];
134
+ continue;
135
+ }
136
+ return null;
137
+ }
138
+ return current;
139
+ }
62
140
  function resolveSchemaRefs(schema, visited = new Set()) {
63
141
  if (!schema || typeof schema !== "object") {
64
142
  return schema;
@@ -124,8 +202,71 @@ export function listOperations() {
124
202
  return [];
125
203
  return (index.operations || []).filter(op => op.name.startsWith("onchain_operations_"));
126
204
  }
205
+ function writeResponseToFile(data, preferredPath) {
206
+ try {
207
+ let targetPath;
208
+ if (preferredPath) {
209
+ targetPath = resolve(process.cwd(), preferredPath);
210
+ }
211
+ else {
212
+ if (!existsSync(WORKSPACE_TMP_DIR)) {
213
+ mkdirSync(WORKSPACE_TMP_DIR, { recursive: true });
214
+ }
215
+ const timestamp = Date.now();
216
+ targetPath = join(WORKSPACE_TMP_DIR, `schema-${timestamp}.json`);
217
+ }
218
+ const parentDir = dirname(targetPath);
219
+ if (!existsSync(parentDir)) {
220
+ mkdirSync(parentDir, { recursive: true });
221
+ }
222
+ const jsonStr = typeof data === "string" ? data : JSON.stringify(data, null, 2);
223
+ writeFileSync(targetPath, jsonStr, "utf-8");
224
+ return targetPath;
225
+ }
226
+ catch (e) {
227
+ return null;
228
+ }
229
+ }
127
230
  export function processSchemaQuery(request) {
128
- const { action, name, query } = request;
231
+ const { action, name, query, field_path, template, output_file } = request;
232
+ if (action === "get_guard_templates") {
233
+ const templates = getGuardTemplates(template);
234
+ if (!templates) {
235
+ return {
236
+ success: false,
237
+ action,
238
+ data: null,
239
+ message: template
240
+ ? `Guard template '${template}' not found. Omit 'template' to list all available templates.`
241
+ : "Guard templates file not found. Ensure scripts/guard-templates.json exists.",
242
+ suggestions: [
243
+ "Omit 'template' to list all available templates.",
244
+ "Available template names: signer_verification, progress_node_check, order_owner_verification, service_belonging_check, reward_not_claimed, combined_reward_guard",
245
+ ],
246
+ };
247
+ }
248
+ if (output_file) {
249
+ const filePath = writeResponseToFile(templates, output_file);
250
+ if (filePath) {
251
+ return {
252
+ success: true,
253
+ action,
254
+ data: null,
255
+ message: `Guard template${template ? ` '${template}'` : "s"} written to file: ${filePath}`,
256
+ output_file_path: filePath,
257
+ suggestions: [`Use Read tool to open ${filePath}`],
258
+ };
259
+ }
260
+ }
261
+ return {
262
+ success: true,
263
+ action,
264
+ data: templates,
265
+ message: template
266
+ ? `Retrieved Guard template: ${template}`
267
+ : `Retrieved ${Array.isArray(templates.templates) ? templates.templates.length : 0} Guard templates`,
268
+ };
269
+ }
129
270
  if (!areSchemasAvailable()) {
130
271
  return {
131
272
  success: false,
@@ -168,6 +309,19 @@ export function processSchemaQuery(request) {
168
309
  : ["Use 'list' action to see available schemas"],
169
310
  };
170
311
  }
312
+ if (output_file) {
313
+ const filePath = writeResponseToFile(schema, output_file);
314
+ if (filePath) {
315
+ return {
316
+ success: true,
317
+ action,
318
+ data: null,
319
+ message: `Schema '${name}' written to file: ${filePath}`,
320
+ output_file_path: filePath,
321
+ suggestions: [`Use Read tool to open ${filePath}`],
322
+ };
323
+ }
324
+ }
171
325
  return {
172
326
  success: true,
173
327
  action,
@@ -175,6 +329,39 @@ export function processSchemaQuery(request) {
175
329
  message: `Retrieved schema: ${name}`,
176
330
  };
177
331
  }
332
+ case "get_field": {
333
+ if (!name || !field_path) {
334
+ return {
335
+ success: false,
336
+ action,
337
+ data: null,
338
+ message: "Both 'name' and 'field_path' are required for 'get_field' action",
339
+ suggestions: [
340
+ "Example: {action: 'get_field', name: 'onchain_operations_machine', field_path: 'data.node'}",
341
+ "Use 'get' action to retrieve the full schema",
342
+ ],
343
+ };
344
+ }
345
+ const fieldSchema = getSchemaField(name, field_path);
346
+ if (!fieldSchema) {
347
+ return {
348
+ success: false,
349
+ action,
350
+ data: null,
351
+ message: `Field path '${field_path}' not found in schema '${name}'`,
352
+ suggestions: [
353
+ "Check the field path (dot-separated, e.g. 'data.node')",
354
+ "Use 'get' action to see the full schema structure",
355
+ ],
356
+ };
357
+ }
358
+ return {
359
+ success: true,
360
+ action,
361
+ data: fieldSchema,
362
+ message: `Retrieved field '${field_path}' from schema '${name}'`,
363
+ };
364
+ }
178
365
  case "search": {
179
366
  if (!query) {
180
367
  return {
@@ -235,6 +422,19 @@ export function processSchemaQuery(request) {
235
422
  : ["Use 'list' action to see available tools"],
236
423
  };
237
424
  }
425
+ if (output_file) {
426
+ const filePath = writeResponseToFile(schema, output_file);
427
+ if (filePath) {
428
+ return {
429
+ success: true,
430
+ action,
431
+ data: null,
432
+ message: `Output schema '${name}' written to file: ${filePath}`,
433
+ output_file_path: filePath,
434
+ suggestions: [`Use Read tool to open ${filePath}`],
435
+ };
436
+ }
437
+ }
238
438
  return {
239
439
  success: true,
240
440
  action,
@@ -248,7 +448,7 @@ export function processSchemaQuery(request) {
248
448
  action,
249
449
  data: null,
250
450
  message: `Unknown action: ${action}`,
251
- suggestions: ["Use 'list', 'get', 'search', or 'list_operations'"],
451
+ suggestions: ["Use 'list', 'get', 'get_field', 'get_output', 'search', 'list_operations', or 'get_guard_templates'"],
252
452
  };
253
453
  }
254
454
  }
@@ -1271,7 +1271,7 @@
1271
1271
  "testnet",
1272
1272
  "mainnet"
1273
1273
  ],
1274
- "description": "Network entrypoint: Specifies which network the operation occurs on"
1274
+ "description": "Network entrypoint: Specifies which network the operation occurs on. FIX-010 cross-network note: LocalMark names are scoped per network (testnet marks are invisible on mainnet and vice versa). When migrating from testnet to mainnet, recreate all objects on mainnet and re-register LocalMark names with the SAME names to keep name-based references working across networks. Use project_operation action='clone_project_to_network' to clone the project blueprint to the target network, then re-run onchain_operations with env.network=target_network to deploy."
1275
1275
  }
1276
1276
  },
1277
1277
  "required": [
@@ -1359,6 +1359,12 @@
1359
1359
  "permission_denied",
1360
1360
  "immutable_violation",
1361
1361
  "network_error",
1362
+ "rate_limit",
1363
+ "gas_exceeded",
1364
+ "bcs_error",
1365
+ "signature_error",
1366
+ "config_error",
1367
+ "wip_verification_failed",
1362
1368
  "unknown"
1363
1369
  ],
1364
1370
  "description": "Error classification for programmatic recovery"
@@ -140,7 +140,7 @@
140
140
  "testnet",
141
141
  "mainnet"
142
142
  ],
143
- "description": "Network entrypoint: Specifies which network the operation occurs on"
143
+ "description": "Network entrypoint: Specifies which network the operation occurs on. FIX-010 cross-network note: LocalMark names are scoped per network (testnet marks are invisible on mainnet and vice versa). When migrating from testnet to mainnet, recreate all objects on mainnet and re-register LocalMark names with the SAME names to keep name-based references working across networks. Use project_operation action='clone_project_to_network' to clone the project blueprint to the target network, then re-run onchain_operations with env.network=target_network to deploy."
144
144
  }
145
145
  },
146
146
  "required": [
@@ -169,7 +169,7 @@
169
169
  },
170
170
  "network": {
171
171
  "$ref": "#/definitions/account_operation/properties/transfer/properties/network",
172
- "description": "Network entrypoint: Specifies which network the operation occurs on"
172
+ "description": "Network entrypoint: Specifies which network the operation occurs on. FIX-010 cross-network note: LocalMark names are scoped per network (testnet marks are invisible on mainnet and vice versa). When migrating from testnet to mainnet, recreate all objects on mainnet and re-register LocalMark names with the SAME names to keep name-based references working across networks. Use project_operation action='clone_project_to_network' to clone the project blueprint to the target network, then re-run onchain_operations with env.network=target_network to deploy."
173
173
  }
174
174
  },
175
175
  "required": [
@@ -53,6 +53,12 @@
53
53
  "permission_denied",
54
54
  "immutable_violation",
55
55
  "network_error",
56
+ "rate_limit",
57
+ "gas_exceeded",
58
+ "bcs_error",
59
+ "signature_error",
60
+ "config_error",
61
+ "wip_verification_failed",
56
62
  "unknown"
57
63
  ],
58
64
  "description": "Error classification for programmatic recovery"
@@ -81,7 +81,7 @@
81
81
  "testnet",
82
82
  "mainnet"
83
83
  ],
84
- "description": "Network entrypoint: Specifies which network the operation occurs on"
84
+ "description": "Network entrypoint: Specifies which network the operation occurs on. FIX-010 cross-network note: LocalMark names are scoped per network (testnet marks are invisible on mainnet and vice versa). When migrating from testnet to mainnet, recreate all objects on mainnet and re-register LocalMark names with the SAME names to keep name-based references working across networks. Use project_operation action='clone_project_to_network' to clone the project blueprint to the target network, then re-run onchain_operations with env.network=target_network to deploy."
85
85
  },
86
86
  "referrer": {
87
87
  "$ref": "#/definitions/bridge_operation/anyOf/0/properties/env/properties/account",