@wowok/agent-mcp 2.4.3 → 2.5.0

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 (317) hide show
  1. package/dist/config/runtime.d.ts +4 -0
  2. package/dist/config/runtime.js +29 -5
  3. package/dist/harness/auto-escalation.d.ts +27 -0
  4. package/dist/harness/auto-escalation.js +68 -0
  5. package/dist/index.js +21 -0
  6. package/dist/knowledge/allocation-confirm.d.ts +115 -0
  7. package/dist/knowledge/allocation-confirm.js +534 -0
  8. package/dist/knowledge/allocation-context.d.ts +58 -0
  9. package/dist/knowledge/allocation-context.js +249 -0
  10. package/dist/knowledge/allocation-ledger.d.ts +67 -0
  11. package/dist/knowledge/allocation-ledger.js +463 -0
  12. package/dist/knowledge/allocation-puzzle.d.ts +135 -0
  13. package/dist/knowledge/allocation-puzzle.js +298 -0
  14. package/dist/knowledge/allocation-risk.d.ts +78 -0
  15. package/dist/knowledge/allocation-risk.js +568 -0
  16. package/dist/knowledge/allocation-templates.d.ts +38 -0
  17. package/dist/knowledge/allocation-templates.js +970 -0
  18. package/dist/knowledge/allocation-translation.d.ts +72 -0
  19. package/dist/knowledge/allocation-translation.js +585 -0
  20. package/dist/knowledge/arb-risk.d.ts +37 -0
  21. package/dist/knowledge/arb-risk.js +210 -0
  22. package/dist/knowledge/arbitration-confirm.d.ts +135 -0
  23. package/dist/knowledge/arbitration-confirm.js +559 -0
  24. package/dist/knowledge/arbitration-context.d.ts +81 -0
  25. package/dist/knowledge/arbitration-context.js +505 -0
  26. package/dist/knowledge/arbitration-ledger.d.ts +62 -0
  27. package/dist/knowledge/arbitration-ledger.js +521 -0
  28. package/dist/knowledge/arbitration-puzzle.d.ts +84 -0
  29. package/dist/knowledge/arbitration-puzzle.js +304 -0
  30. package/dist/knowledge/arbitration-risk.d.ts +112 -0
  31. package/dist/knowledge/arbitration-risk.js +433 -0
  32. package/dist/knowledge/arbitration-templates.d.ts +38 -0
  33. package/dist/knowledge/arbitration-templates.js +276 -0
  34. package/dist/knowledge/arbitration-translation.d.ts +91 -0
  35. package/dist/knowledge/arbitration-translation.js +487 -0
  36. package/dist/knowledge/bridge-risk.d.ts +36 -0
  37. package/dist/knowledge/bridge-risk.js +263 -0
  38. package/dist/knowledge/contact-risk.d.ts +32 -0
  39. package/dist/knowledge/contact-risk.js +200 -0
  40. package/dist/knowledge/demand-confirm.d.ts +32 -0
  41. package/dist/knowledge/demand-confirm.js +206 -0
  42. package/dist/knowledge/demand-risk.d.ts +30 -0
  43. package/dist/knowledge/demand-risk.js +240 -0
  44. package/dist/knowledge/demand-translation.d.ts +55 -0
  45. package/dist/knowledge/demand-translation.js +354 -0
  46. package/dist/knowledge/deployment-scanner.d.ts +63 -0
  47. package/dist/knowledge/deployment-scanner.js +762 -0
  48. package/dist/knowledge/examples-scanner-cli.d.ts +1 -0
  49. package/dist/knowledge/examples-scanner-cli.js +26 -0
  50. package/dist/knowledge/examples-scanner.d.ts +121 -0
  51. package/dist/knowledge/examples-scanner.js +825 -0
  52. package/dist/knowledge/flywheel-loop.d.ts +3 -0
  53. package/dist/knowledge/flywheel-loop.js +32 -3
  54. package/dist/knowledge/glossary.js +3 -1
  55. package/dist/knowledge/guard-confirm.d.ts +86 -0
  56. package/dist/knowledge/guard-confirm.js +406 -0
  57. package/dist/knowledge/guard-context.d.ts +56 -0
  58. package/dist/knowledge/guard-context.js +287 -0
  59. package/dist/knowledge/guard-design-patterns.d.ts +37 -0
  60. package/dist/knowledge/guard-design-patterns.js +257 -0
  61. package/dist/knowledge/guard-puzzle.js +3 -2
  62. package/dist/knowledge/guard-risk.d.ts +1 -1
  63. package/dist/knowledge/guard-risk.js +12 -14
  64. package/dist/knowledge/guard-templates.js +1 -1
  65. package/dist/knowledge/guard-translation.js +6 -5
  66. package/dist/knowledge/index.d.ts +342 -0
  67. package/dist/knowledge/index.js +344 -0
  68. package/dist/knowledge/machine-confirm.d.ts +102 -0
  69. package/dist/knowledge/machine-confirm.js +559 -0
  70. package/dist/knowledge/machine-context.d.ts +160 -0
  71. package/dist/knowledge/machine-context.js +812 -0
  72. package/dist/knowledge/machine-ledger.d.ts +41 -0
  73. package/dist/knowledge/machine-ledger.js +315 -0
  74. package/dist/knowledge/machine-puzzle.d.ts +206 -0
  75. package/dist/knowledge/machine-puzzle.js +494 -0
  76. package/dist/knowledge/machine-risk.d.ts +75 -0
  77. package/dist/knowledge/machine-risk.js +644 -0
  78. package/dist/knowledge/machine-templates.d.ts +92 -0
  79. package/dist/knowledge/machine-templates.js +1592 -0
  80. package/dist/knowledge/machine-topology.d.ts +57 -0
  81. package/dist/knowledge/machine-topology.js +234 -0
  82. package/dist/knowledge/machine-translation.d.ts +96 -0
  83. package/dist/knowledge/machine-translation.js +513 -0
  84. package/dist/knowledge/mcp-schema-audit-cli.d.ts +1 -0
  85. package/dist/knowledge/mcp-schema-audit-cli.js +45 -0
  86. package/dist/knowledge/mcp-schema-audit.d.ts +90 -0
  87. package/dist/knowledge/mcp-schema-audit.js +772 -0
  88. package/dist/knowledge/onchain-constants.d.ts +4 -0
  89. package/dist/knowledge/onchain-constants.js +35 -0
  90. package/dist/knowledge/order-confirm.d.ts +115 -0
  91. package/dist/knowledge/order-confirm.js +573 -0
  92. package/dist/knowledge/order-context.d.ts +66 -0
  93. package/dist/knowledge/order-context.js +390 -0
  94. package/dist/knowledge/order-ledger.d.ts +69 -0
  95. package/dist/knowledge/order-ledger.js +341 -0
  96. package/dist/knowledge/order-puzzle.d.ts +159 -0
  97. package/dist/knowledge/order-puzzle.js +255 -0
  98. package/dist/knowledge/order-risk.d.ts +66 -0
  99. package/dist/knowledge/order-risk.js +653 -0
  100. package/dist/knowledge/order-templates.d.ts +50 -0
  101. package/dist/knowledge/order-templates.js +368 -0
  102. package/dist/knowledge/order-translation.d.ts +78 -0
  103. package/dist/knowledge/order-translation.js +550 -0
  104. package/dist/knowledge/passport-confirm.d.ts +130 -0
  105. package/dist/knowledge/passport-confirm.js +531 -0
  106. package/dist/knowledge/passport-context.d.ts +59 -0
  107. package/dist/knowledge/passport-context.js +306 -0
  108. package/dist/knowledge/passport-ledger.d.ts +48 -0
  109. package/dist/knowledge/passport-ledger.js +282 -0
  110. package/dist/knowledge/passport-puzzle.d.ts +108 -0
  111. package/dist/knowledge/passport-puzzle.js +333 -0
  112. package/dist/knowledge/passport-risk.d.ts +70 -0
  113. package/dist/knowledge/passport-risk.js +450 -0
  114. package/dist/knowledge/passport-templates.d.ts +40 -0
  115. package/dist/knowledge/passport-templates.js +568 -0
  116. package/dist/knowledge/passport-translation.d.ts +68 -0
  117. package/dist/knowledge/passport-translation.js +516 -0
  118. package/dist/knowledge/payment-risk.d.ts +33 -0
  119. package/dist/knowledge/payment-risk.js +182 -0
  120. package/dist/knowledge/permission-confirm.d.ts +110 -0
  121. package/dist/knowledge/permission-confirm.js +426 -0
  122. package/dist/knowledge/permission-context.d.ts +58 -0
  123. package/dist/knowledge/permission-context.js +224 -0
  124. package/dist/knowledge/permission-ledger.d.ts +38 -0
  125. package/dist/knowledge/permission-ledger.js +403 -0
  126. package/dist/knowledge/permission-puzzle.d.ts +122 -0
  127. package/dist/knowledge/permission-puzzle.js +173 -0
  128. package/dist/knowledge/permission-risk.d.ts +76 -0
  129. package/dist/knowledge/permission-risk.js +411 -0
  130. package/dist/knowledge/permission-templates.d.ts +38 -0
  131. package/dist/knowledge/permission-templates.js +234 -0
  132. package/dist/knowledge/permission-translation.d.ts +57 -0
  133. package/dist/knowledge/permission-translation.js +350 -0
  134. package/dist/knowledge/personal-risk.d.ts +36 -0
  135. package/dist/knowledge/personal-risk.js +212 -0
  136. package/dist/knowledge/progress-confirm.d.ts +108 -0
  137. package/dist/knowledge/progress-confirm.js +456 -0
  138. package/dist/knowledge/progress-context.d.ts +123 -0
  139. package/dist/knowledge/progress-context.js +452 -0
  140. package/dist/knowledge/progress-ledger.d.ts +63 -0
  141. package/dist/knowledge/progress-ledger.js +327 -0
  142. package/dist/knowledge/progress-puzzle.d.ts +82 -0
  143. package/dist/knowledge/progress-puzzle.js +219 -0
  144. package/dist/knowledge/progress-risk.d.ts +74 -0
  145. package/dist/knowledge/progress-risk.js +461 -0
  146. package/dist/knowledge/progress-templates.d.ts +38 -0
  147. package/dist/knowledge/progress-templates.js +228 -0
  148. package/dist/knowledge/progress-translation.d.ts +52 -0
  149. package/dist/knowledge/progress-translation.js +401 -0
  150. package/dist/knowledge/proof-confirm.d.ts +31 -0
  151. package/dist/knowledge/proof-confirm.js +187 -0
  152. package/dist/knowledge/proof-risk.d.ts +33 -0
  153. package/dist/knowledge/proof-risk.js +207 -0
  154. package/dist/knowledge/proof-translation.d.ts +52 -0
  155. package/dist/knowledge/proof-translation.js +283 -0
  156. package/dist/knowledge/registrar-risk.d.ts +34 -0
  157. package/dist/knowledge/registrar-risk.js +217 -0
  158. package/dist/knowledge/repository-confirm.d.ts +36 -0
  159. package/dist/knowledge/repository-confirm.js +242 -0
  160. package/dist/knowledge/repository-risk.d.ts +40 -0
  161. package/dist/knowledge/repository-risk.js +312 -0
  162. package/dist/knowledge/repository-translation.d.ts +58 -0
  163. package/dist/knowledge/repository-translation.js +422 -0
  164. package/dist/knowledge/resource-risk.d.ts +32 -0
  165. package/dist/knowledge/resource-risk.js +157 -0
  166. package/dist/knowledge/reward-confirm.d.ts +113 -0
  167. package/dist/knowledge/reward-confirm.js +496 -0
  168. package/dist/knowledge/reward-context.d.ts +127 -0
  169. package/dist/knowledge/reward-context.js +504 -0
  170. package/dist/knowledge/reward-ledger.d.ts +96 -0
  171. package/dist/knowledge/reward-ledger.js +502 -0
  172. package/dist/knowledge/reward-puzzle.d.ts +97 -0
  173. package/dist/knowledge/reward-puzzle.js +288 -0
  174. package/dist/knowledge/reward-risk.d.ts +84 -0
  175. package/dist/knowledge/reward-risk.js +545 -0
  176. package/dist/knowledge/reward-translation.d.ts +58 -0
  177. package/dist/knowledge/reward-translation.js +501 -0
  178. package/dist/knowledge/safety-rules.js +11 -3
  179. package/dist/knowledge/scenario-modes.d.ts +53 -0
  180. package/dist/knowledge/scenario-modes.js +302 -0
  181. package/dist/knowledge/service-confirm.d.ts +152 -0
  182. package/dist/knowledge/service-confirm.js +699 -0
  183. package/dist/knowledge/service-context.d.ts +66 -0
  184. package/dist/knowledge/service-context.js +403 -0
  185. package/dist/knowledge/service-ledger.d.ts +71 -0
  186. package/dist/knowledge/service-ledger.js +609 -0
  187. package/dist/knowledge/service-puzzle.d.ts +158 -0
  188. package/dist/knowledge/service-puzzle.js +236 -0
  189. package/dist/knowledge/service-risk.d.ts +108 -0
  190. package/dist/knowledge/service-risk.js +615 -0
  191. package/dist/knowledge/service-templates.d.ts +39 -0
  192. package/dist/knowledge/service-templates.js +418 -0
  193. package/dist/knowledge/service-translation.d.ts +103 -0
  194. package/dist/knowledge/service-translation.js +622 -0
  195. package/dist/knowledge/tools-reference.d.ts +17 -0
  196. package/dist/knowledge/tools-reference.js +151 -0
  197. package/dist/knowledge/treasury-confirm.d.ts +133 -0
  198. package/dist/knowledge/treasury-confirm.js +512 -0
  199. package/dist/knowledge/treasury-context.d.ts +64 -0
  200. package/dist/knowledge/treasury-context.js +363 -0
  201. package/dist/knowledge/treasury-ledger.d.ts +42 -0
  202. package/dist/knowledge/treasury-ledger.js +300 -0
  203. package/dist/knowledge/treasury-puzzle.d.ts +163 -0
  204. package/dist/knowledge/treasury-puzzle.js +216 -0
  205. package/dist/knowledge/treasury-risk.d.ts +86 -0
  206. package/dist/knowledge/treasury-risk.js +440 -0
  207. package/dist/knowledge/treasury-templates.d.ts +38 -0
  208. package/dist/knowledge/treasury-templates.js +316 -0
  209. package/dist/knowledge/treasury-translation.d.ts +78 -0
  210. package/dist/knowledge/treasury-translation.js +498 -0
  211. package/dist/knowledge/util-risk.d.ts +30 -0
  212. package/dist/knowledge/util-risk.js +135 -0
  213. package/dist/project/business-puzzle.d.ts +47 -0
  214. package/dist/project/business-puzzle.js +372 -0
  215. package/dist/project/deployment-doc.d.ts +61 -0
  216. package/dist/project/deployment-doc.js +432 -0
  217. package/dist/project/risk-aggregator.d.ts +50 -0
  218. package/dist/project/risk-aggregator.js +280 -0
  219. package/dist/project/substep-trace.d.ts +130 -0
  220. package/dist/project/substep-trace.js +332 -0
  221. package/dist/schema/call/allocation.d.ts +34 -34
  222. package/dist/schema/call/arbitration.d.ts +141 -141
  223. package/dist/schema/call/base.d.ts +386 -386
  224. package/dist/schema/call/base.js +3 -3
  225. package/dist/schema/call/bridge-handler.d.ts +5 -2
  226. package/dist/schema/call/bridge.d.ts +159 -159
  227. package/dist/schema/call/contact.d.ts +110 -110
  228. package/dist/schema/call/demand.d.ts +76 -76
  229. package/dist/schema/call/handler.d.ts +2 -3
  230. package/dist/schema/call/handler.js +1 -1
  231. package/dist/schema/call/machine.d.ts +58 -58
  232. package/dist/schema/call/order.d.ts +98 -110
  233. package/dist/schema/call/permission-handler.d.ts +5 -0
  234. package/dist/schema/call/permission-handler.js +54 -0
  235. package/dist/schema/call/permission.d.ts +108 -108
  236. package/dist/schema/call/personal.d.ts +14 -14
  237. package/dist/schema/call/progress.d.ts +57 -72
  238. package/dist/schema/call/progress.js +7 -4
  239. package/dist/schema/call/proof.d.ts +18 -18
  240. package/dist/schema/call/proof.js +12 -7
  241. package/dist/schema/call/repository.d.ts +154 -154
  242. package/dist/schema/call/reward.d.ts +55 -55
  243. package/dist/schema/call/service.d.ts +231 -231
  244. package/dist/schema/call/treasury.d.ts +93 -93
  245. package/dist/schema/config/index.d.ts +178 -5
  246. package/dist/schema/config/index.js +52 -1
  247. package/dist/schema/local/index.d.ts +3554 -836
  248. package/dist/schema/local/index.js +2 -1
  249. package/dist/schema/messenger/index.d.ts +162 -162
  250. package/dist/schema/operations.d.ts +1058 -1074
  251. package/dist/schema/operations.js +7 -1
  252. package/dist/schema/project/index.d.ts +1392 -6
  253. package/dist/schema/project/index.js +426 -2
  254. package/dist/schema/query/index.d.ts +672 -672
  255. package/dist/schema/schema-query/index.d.ts +23 -3
  256. package/dist/schema/schema-query/index.js +13 -2
  257. package/dist/schema/sync-layer4.d.ts +21 -0
  258. package/dist/schema/sync-layer4.js +261 -0
  259. package/dist/schema/trust/index.d.ts +26 -26
  260. package/dist/schemas/account_operation.output.json +718 -0
  261. package/dist/schemas/config_operation.output.json +173 -0
  262. package/dist/schemas/index.json +9 -1
  263. package/dist/schemas/local_info_operation.output.json +718 -0
  264. package/dist/schemas/local_mark_operation.output.json +718 -0
  265. package/dist/schemas/onchain_operations.output.json +3 -2
  266. package/dist/schemas/onchain_operations.schema.json +1802 -313
  267. package/dist/schemas/onchain_operations_allocation.schema.json +2 -1
  268. package/dist/schemas/onchain_operations_arbitration.schema.json +2 -1
  269. package/dist/schemas/onchain_operations_contact.schema.json +2 -1
  270. package/dist/schemas/onchain_operations_demand.schema.json +2 -1
  271. package/dist/schemas/onchain_operations_gen_passport.schema.json +878 -872
  272. package/dist/schemas/onchain_operations_gen_proof.schema.json +273 -0
  273. package/dist/schemas/onchain_operations_guard.schema.json +584 -70
  274. package/dist/schemas/onchain_operations_machine.schema.json +2 -1
  275. package/dist/schemas/onchain_operations_order.schema.json +13 -9
  276. package/dist/schemas/onchain_operations_payment.schema.json +2 -1
  277. package/dist/schemas/onchain_operations_permission.schema.json +2 -1
  278. package/dist/schemas/onchain_operations_personal.schema.json +2 -1
  279. package/dist/schemas/onchain_operations_progress.schema.json +14 -10
  280. package/dist/schemas/onchain_operations_proof.schema.json +699 -0
  281. package/dist/schemas/onchain_operations_repository.schema.json +2 -1
  282. package/dist/schemas/onchain_operations_reward.schema.json +2 -1
  283. package/dist/schemas/onchain_operations_service.schema.json +2 -1
  284. package/dist/schemas/onchain_operations_treasury.schema.json +2 -1
  285. package/dist/schemas/onchain_table_data.schema.json +32 -1
  286. package/dist/schemas/project_operation.output.json +879 -0
  287. package/dist/schemas/project_operation.schema.json +473 -2
  288. package/dist/schemas/query_toolkit.output.json +14906 -6
  289. package/dist/schemas/schema_query.output.json +38 -1
  290. package/dist/telemetry/index.d.ts +1 -1
  291. package/dist/tools/handlers/config.d.ts +1 -1
  292. package/dist/tools/handlers/config.js +21 -18
  293. package/dist/tools/handlers/file-export.d.ts +2 -2
  294. package/dist/tools/handlers/local.d.ts +3 -30
  295. package/dist/tools/handlers/local.js +14 -3
  296. package/dist/tools/handlers/messenger.d.ts +1 -1
  297. package/dist/tools/handlers/messenger.js +2 -1
  298. package/dist/tools/handlers/onchain.d.ts +1 -1
  299. package/dist/tools/handlers/onchain.js +24 -22
  300. package/dist/tools/handlers/project.d.ts +1 -1
  301. package/dist/tools/handlers/project.js +258 -18
  302. package/dist/tools/handlers/query.d.ts +4 -4
  303. package/dist/tools/handlers/schema-query.d.ts +1 -1
  304. package/dist/tools/handlers/schema-query.js +21 -20
  305. package/dist/tools/handlers/trust.d.ts +1 -1
  306. package/dist/tools/handlers/trust.js +2 -2
  307. package/dist/tools/handlers/wip.d.ts +1 -1
  308. package/dist/tools/handlers/wip.js +1 -1
  309. package/dist/tools/index.d.ts +1 -1
  310. package/dist/tools/index.js +55 -8
  311. package/dist/tools/rules-hook.d.ts +1 -1
  312. package/dist/tools/rules-hook.js +3 -2
  313. package/dist/tools/shared.d.ts +13 -22
  314. package/dist/tools/types.d.ts +5 -5
  315. package/dist/tools/wrap.d.ts +10 -2
  316. package/dist/tools/wrap.js +212 -0
  317. package/package.json +3 -3
@@ -15,19 +15,39 @@ export declare const SchemaQueryInputSchema: z.ZodObject<{
15
15
  export declare const SchemaQueryOutputSchema: z.ZodObject<{
16
16
  success: z.ZodBoolean;
17
17
  action: z.ZodString;
18
- data: z.ZodAny;
18
+ data: z.ZodUnion<[z.ZodArray<z.ZodObject<{
19
+ name: z.ZodString;
20
+ title: z.ZodOptional<z.ZodString>;
21
+ description: z.ZodOptional<z.ZodString>;
22
+ }, "strict", z.ZodTypeAny, {
23
+ name: string;
24
+ description?: string | undefined;
25
+ title?: string | undefined;
26
+ }, {
27
+ name: string;
28
+ description?: string | undefined;
29
+ title?: string | undefined;
30
+ }>, "many">, z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodNull]>;
19
31
  message: z.ZodString;
20
32
  suggestions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
21
33
  }, "strict", z.ZodTypeAny, {
22
34
  message: string;
35
+ data: Record<string, unknown> | {
36
+ name: string;
37
+ description?: string | undefined;
38
+ title?: string | undefined;
39
+ }[] | null;
23
40
  success: boolean;
24
41
  action: string;
25
- data?: any;
26
42
  suggestions?: string[] | undefined;
27
43
  }, {
28
44
  message: string;
45
+ data: Record<string, unknown> | {
46
+ name: string;
47
+ description?: string | undefined;
48
+ title?: string | undefined;
49
+ }[] | null;
29
50
  success: boolean;
30
51
  action: string;
31
- data?: any;
32
52
  suggestions?: string[] | undefined;
33
53
  }>;
@@ -20,13 +20,24 @@ export const SchemaQueryInputSchema = z
20
20
  .describe("Search query for 'search' action"),
21
21
  })
22
22
  .strict();
23
+ const SchemaListItemSchema = z
24
+ .object({
25
+ name: z.string().describe("Schema/tool identifier (e.g. 'onchain_operations')."),
26
+ title: z.string().optional().describe("Human-readable title, if known."),
27
+ description: z.string().optional().describe("Short description, if known."),
28
+ })
29
+ .strict();
23
30
  export const SchemaQueryOutputSchema = z
24
31
  .object({
25
32
  success: z.boolean().describe("Whether the request was successful"),
26
33
  action: z.string().describe("The action that was performed"),
27
34
  data: z
28
- .any()
29
- .describe("Response data - JSON Schema object for 'get'/'get_output', array of schema info for 'list'/'search'/'list_operations'"),
35
+ .union([
36
+ z.array(SchemaListItemSchema).describe("List of schema summaries (list/search/list_operations)."),
37
+ z.record(z.unknown()).describe("JSON Schema object (get/get_output)."),
38
+ z.null().describe("No data — lookup failed or returned nothing."),
39
+ ])
40
+ .describe("Response data — array of schema summaries for list-like actions, JSON Schema object for get/get_output, null on failure."),
30
41
  message: z.string().describe("Human-readable message describing the result"),
31
42
  suggestions: z
32
43
  .array(z.string())
@@ -0,0 +1,21 @@
1
+ export declare const LAYER3_DIR: string;
2
+ export declare const LAYER4_DIR: string;
3
+ export declare const TOOLS_17: readonly string[];
4
+ export interface SyncResult {
5
+ ok: number;
6
+ failed: number;
7
+ errors: Array<{
8
+ tool: string;
9
+ error: string;
10
+ }>;
11
+ layer3Dir: string;
12
+ layer4Dir: string;
13
+ total: number;
14
+ }
15
+ export interface SyncOptions {
16
+ silent?: boolean;
17
+ layer3Dir?: string;
18
+ layer4Dir?: string;
19
+ }
20
+ export declare function syncDeployedToolDescriptors(options?: SyncOptions): SyncResult;
21
+ export declare function shouldAutoSyncAtStartup(): boolean;
@@ -0,0 +1,261 @@
1
+ import * as fs from 'fs';
2
+ import * as path from 'path';
3
+ export const LAYER3_DIR = path.resolve('d:/wowok/agent/mcp/dist/schemas');
4
+ export const LAYER4_DIR = path.resolve('c:/Users/zhou/.trae-cn/mcps/s_wowok-7838e181/solo_agent/mcp_wagent/tools');
5
+ export const TOOLS_17 = [
6
+ 'onchain_operations',
7
+ 'account_operation',
8
+ 'local_mark_operation',
9
+ 'local_info_operation',
10
+ 'wip_file',
11
+ 'messenger_operation',
12
+ 'guard2file',
13
+ 'machineNode2file',
14
+ 'query_toolkit',
15
+ 'onchain_table_data',
16
+ 'onchain_events',
17
+ 'wowok_buildin_info',
18
+ 'schema_query',
19
+ 'bridge_operation',
20
+ 'project_operation',
21
+ 'config_operation',
22
+ 'trust_score',
23
+ ];
24
+ const JSON_SCHEMA_DRAFT7 = 'http://json-schema.org/draft-07/schema#';
25
+ function createExternalFileCache() {
26
+ return new Map();
27
+ }
28
+ function loadExternalFile(filePath, layer3Dir, cache) {
29
+ if (cache.has(filePath)) {
30
+ return cache.get(filePath);
31
+ }
32
+ const fullPath = path.resolve(layer3Dir, filePath);
33
+ if (!fs.existsSync(fullPath)) {
34
+ throw new Error(`External $ref file not found: ${fullPath}`);
35
+ }
36
+ const parsed = JSON.parse(fs.readFileSync(fullPath, 'utf-8'));
37
+ cache.set(filePath, parsed);
38
+ return parsed;
39
+ }
40
+ function resolveRefTarget(ref, root, layer3Dir, cache) {
41
+ if (!ref.startsWith('#')) {
42
+ const [filePath, innerPath] = ref.split('#', 2);
43
+ const external = loadExternalFile(filePath, layer3Dir, cache);
44
+ if (!innerPath || innerPath === '/') {
45
+ return external;
46
+ }
47
+ if (!innerPath.startsWith('/')) {
48
+ throw new Error(`Unsupported external $ref format: ${ref}`);
49
+ }
50
+ const parts = innerPath.slice(1).split('/');
51
+ let target = external;
52
+ for (const part of parts) {
53
+ if (target === null || typeof target !== 'object') {
54
+ throw new Error(`Cannot resolve $ref part "${part}" in ${ref}`);
55
+ }
56
+ target = target[part];
57
+ }
58
+ return target;
59
+ }
60
+ if (!ref.startsWith('#/')) {
61
+ throw new Error(`Unsupported $ref (must start with "#/" or be external file): ${ref}`);
62
+ }
63
+ const parts = ref.slice(2).split('/');
64
+ let target = root;
65
+ for (const part of parts) {
66
+ if (target === null || typeof target !== 'object') {
67
+ return undefined;
68
+ }
69
+ target = target[part];
70
+ }
71
+ return target;
72
+ }
73
+ function resolveRefs(node, root, layer3Dir, cache, seen = new Set()) {
74
+ if (node === null || typeof node !== 'object') {
75
+ return node;
76
+ }
77
+ if (Array.isArray(node)) {
78
+ return node.map((item) => resolveRefs(item, root, layer3Dir, cache, seen));
79
+ }
80
+ if (typeof node.$ref === 'string') {
81
+ const ref = node.$ref;
82
+ if (seen.has(ref)) {
83
+ return { $ref: ref, description: node.description };
84
+ }
85
+ const target = resolveRefTarget(ref, root, layer3Dir, cache);
86
+ if (target === undefined || target === null) {
87
+ throw new Error(`Cannot resolve $ref target: ${ref}`);
88
+ }
89
+ const nextSeen = new Set(seen);
90
+ nextSeen.add(ref);
91
+ const externalRoot = ref.startsWith('#')
92
+ ? root
93
+ : loadExternalFile(ref.split('#', 2)[0], layer3Dir, cache);
94
+ const resolved = resolveRefs(target, externalRoot, layer3Dir, cache, nextSeen);
95
+ if (node.description && !resolved.description) {
96
+ resolved.description = node.description;
97
+ }
98
+ return resolved;
99
+ }
100
+ const result = {};
101
+ for (const [key, value] of Object.entries(node)) {
102
+ result[key] = resolveRefs(value, root, layer3Dir, cache, seen);
103
+ }
104
+ return result;
105
+ }
106
+ function extractSchemaBody(layer3, layer3Dir, cache) {
107
+ const rootForResolution = {
108
+ ...layer3,
109
+ definitions: layer3.definitions,
110
+ };
111
+ let body;
112
+ if (layer3.$ref) {
113
+ const ref = layer3.$ref;
114
+ const target = resolveRefTarget(ref, rootForResolution, layer3Dir, cache);
115
+ if (target === undefined || target === null) {
116
+ throw new Error(`Top-level $ref cannot be resolved: ${ref}`);
117
+ }
118
+ const innerRoot = ref.startsWith('#')
119
+ ? rootForResolution
120
+ : loadExternalFile(ref.split('#', 2)[0], layer3Dir, cache);
121
+ body = resolveRefs(target, innerRoot, layer3Dir, cache);
122
+ }
123
+ else {
124
+ const { $schema, $id, title, definitions, description, ...rest } = layer3;
125
+ body = resolveRefs(rest, rootForResolution, layer3Dir, cache);
126
+ }
127
+ return body;
128
+ }
129
+ function buildDeployedFile(toolName, layer3Dir, layer4Dir, cache) {
130
+ const l3Path = path.join(layer3Dir, `${toolName}.schema.json`);
131
+ const l4Path = path.join(layer4Dir, `${toolName}.json`);
132
+ if (!fs.existsSync(l3Path)) {
133
+ throw new Error(`Layer 3 schema not found: ${l3Path}`);
134
+ }
135
+ const layer3 = JSON.parse(fs.readFileSync(l3Path, 'utf-8'));
136
+ const body = extractSchemaBody(layer3, layer3Dir, cache);
137
+ const argsObj = {
138
+ type: body.type ?? 'object',
139
+ properties: body.properties ?? {},
140
+ required: body.required ?? [],
141
+ $schema: JSON_SCHEMA_DRAFT7,
142
+ };
143
+ if (body.additionalProperties !== undefined) {
144
+ argsObj.additionalProperties = body.additionalProperties;
145
+ }
146
+ if (body.description) {
147
+ argsObj.description = body.description;
148
+ }
149
+ if (body.oneOf) {
150
+ argsObj.oneOf = body.oneOf;
151
+ }
152
+ if (body.anyOf) {
153
+ argsObj.anyOf = body.anyOf;
154
+ }
155
+ if (body.allOf) {
156
+ argsObj.allOf = body.allOf;
157
+ }
158
+ let description = layer3.description ?? `${toolName} operation`;
159
+ if (fs.existsSync(l4Path)) {
160
+ try {
161
+ const existing = JSON.parse(fs.readFileSync(l4Path, 'utf-8'));
162
+ if (existing.description && existing.description.length > 0) {
163
+ description = existing.description;
164
+ }
165
+ }
166
+ catch {
167
+ }
168
+ }
169
+ if (!description.includes('schema_query')) {
170
+ const hint = `\n\n💡 Schema hint: Use schema_query with action='get' and name='${toolName}' ` +
171
+ `to retrieve the exact parameter schema before calling.`;
172
+ description = description + hint;
173
+ }
174
+ return {
175
+ name: toolName,
176
+ description,
177
+ arguments: argsObj,
178
+ };
179
+ }
180
+ export function syncDeployedToolDescriptors(options = {}) {
181
+ const silent = options.silent ?? false;
182
+ const layer3Dir = options.layer3Dir ?? LAYER3_DIR;
183
+ const layer4Dir = options.layer4Dir ?? LAYER4_DIR;
184
+ const log = (msg) => {
185
+ if (!silent)
186
+ console.log(msg);
187
+ };
188
+ const logErr = (msg) => {
189
+ if (!silent)
190
+ console.error(msg);
191
+ };
192
+ log('🔄 Syncing Layer 4 deployed tool descriptors from Layer 3 ...\n');
193
+ log(`Layer 3 source: ${layer3Dir}`);
194
+ log(`Layer 4 target: ${layer4Dir}\n`);
195
+ if (!fs.existsSync(layer3Dir)) {
196
+ const msg = `Layer 3 directory does not exist: ${layer3Dir}`;
197
+ logErr(`✗ ${msg}`);
198
+ throw new Error(`${msg} (run 'pnpm generate:schemas' first)`);
199
+ }
200
+ if (!fs.existsSync(layer4Dir)) {
201
+ const msg = `Layer 4 directory does not exist: ${layer4Dir}`;
202
+ logErr(`✗ ${msg}`);
203
+ throw new Error(msg);
204
+ }
205
+ const cache = createExternalFileCache();
206
+ let succeeded = 0;
207
+ let failed = 0;
208
+ const failures = [];
209
+ for (const tool of TOOLS_17) {
210
+ try {
211
+ const deployed = buildDeployedFile(tool, layer3Dir, layer4Dir, cache);
212
+ const outputPath = path.join(layer4Dir, `${tool}.json`);
213
+ fs.writeFileSync(outputPath, JSON.stringify(deployed, null, 2) + '\n', 'utf-8');
214
+ const argCount = Object.keys(deployed.arguments.properties).length;
215
+ const requiredCount = deployed.arguments.required.length;
216
+ const unionType = deployed.arguments.oneOf
217
+ ? 'oneOf'
218
+ : deployed.arguments.anyOf
219
+ ? 'anyOf'
220
+ : deployed.arguments.allOf
221
+ ? 'allOf'
222
+ : '';
223
+ const unionInfo = unionType
224
+ ? ` [${unionType}=${deployed.arguments[unionType].length}]`
225
+ : '';
226
+ log(` ✓ ${tool.padEnd(28)} props=${String(argCount).padStart(2)} required=${String(requiredCount).padStart(2)}${unionInfo}`);
227
+ succeeded++;
228
+ }
229
+ catch (e) {
230
+ logErr(` ✗ ${tool}: ${e.message}`);
231
+ failures.push({ tool, error: e.message });
232
+ failed++;
233
+ }
234
+ }
235
+ log(`\n✅ Succeeded: ${succeeded}/${TOOLS_17.length}`);
236
+ if (failed > 0) {
237
+ logErr(`❌ Failed: ${failed}`);
238
+ for (const f of failures) {
239
+ logErr(` - ${f.tool}: ${f.error}`);
240
+ }
241
+ }
242
+ else {
243
+ log('All 17 Layer 4 deployed files are now FULL schemas (no stubs remain).');
244
+ }
245
+ return {
246
+ ok: succeeded,
247
+ failed,
248
+ errors: failures,
249
+ layer3Dir,
250
+ layer4Dir,
251
+ total: TOOLS_17.length,
252
+ };
253
+ }
254
+ export function shouldAutoSyncAtStartup() {
255
+ const v = process.env.WOWOK_SYNC_LAYER4;
256
+ if (v === undefined || v === '' || v === 'auto')
257
+ return true;
258
+ if (v === 'never' || v === '0' || v === 'false')
259
+ return false;
260
+ return true;
261
+ }
@@ -69,9 +69,9 @@ export declare const TrustScoreOutputSchema: z.ZodObject<{
69
69
  humanReadable: string;
70
70
  }>, "many">;
71
71
  }, "strip", z.ZodTypeAny, {
72
- score: number;
73
72
  summary: string;
74
73
  warnings: string[];
74
+ score: number;
75
75
  level: "high_risk" | "caution" | "moderate" | "trusted";
76
76
  breakdown: {
77
77
  description: string;
@@ -80,9 +80,9 @@ export declare const TrustScoreOutputSchema: z.ZodObject<{
80
80
  humanReadable: string;
81
81
  }[];
82
82
  }, {
83
- score: number;
84
83
  summary: string;
85
84
  warnings: string[];
85
+ score: number;
86
86
  level: "high_risk" | "caution" | "moderate" | "trusted";
87
87
  breakdown: {
88
88
  description: string;
@@ -127,7 +127,6 @@ export declare const TrustScoreOutputSchema: z.ZodObject<{
127
127
  }, "strip", z.ZodTypeAny, {
128
128
  name: "fund" | "workflow" | "trust" | "behavior";
129
129
  score: number;
130
- max_score: number;
131
130
  checks: {
132
131
  description: string;
133
132
  id: string;
@@ -136,10 +135,10 @@ export declare const TrustScoreOutputSchema: z.ZodObject<{
136
135
  passed: boolean;
137
136
  advice?: string | undefined;
138
137
  }[];
138
+ max_score: number;
139
139
  }, {
140
140
  name: "fund" | "workflow" | "trust" | "behavior";
141
141
  score: number;
142
- max_score: number;
143
142
  checks: {
144
143
  description: string;
145
144
  id: string;
@@ -148,16 +147,14 @@ export declare const TrustScoreOutputSchema: z.ZodObject<{
148
147
  passed: boolean;
149
148
  advice?: string | undefined;
150
149
  }[];
150
+ max_score: number;
151
151
  }>, "many">;
152
152
  }, "strip", z.ZodTypeAny, {
153
153
  advice: string[];
154
154
  level: "low" | "medium_low" | "medium_high" | "high";
155
- total: number;
156
- red_flags: string[];
157
155
  dimensions: {
158
156
  name: "fund" | "workflow" | "trust" | "behavior";
159
157
  score: number;
160
- max_score: number;
161
158
  checks: {
162
159
  description: string;
163
160
  id: string;
@@ -166,16 +163,16 @@ export declare const TrustScoreOutputSchema: z.ZodObject<{
166
163
  passed: boolean;
167
164
  advice?: string | undefined;
168
165
  }[];
166
+ max_score: number;
169
167
  }[];
168
+ total: number;
169
+ red_flags: string[];
170
170
  }, {
171
171
  advice: string[];
172
172
  level: "low" | "medium_low" | "medium_high" | "high";
173
- total: number;
174
- red_flags: string[];
175
173
  dimensions: {
176
174
  name: "fund" | "workflow" | "trust" | "behavior";
177
175
  score: number;
178
- max_score: number;
179
176
  checks: {
180
177
  description: string;
181
178
  id: string;
@@ -184,7 +181,10 @@ export declare const TrustScoreOutputSchema: z.ZodObject<{
184
181
  passed: boolean;
185
182
  advice?: string | undefined;
186
183
  }[];
184
+ max_score: number;
187
185
  }[];
186
+ total: number;
187
+ red_flags: string[];
188
188
  }>>;
189
189
  info_puzzle: z.ZodOptional<z.ZodObject<{
190
190
  completeness: z.ZodNumber;
@@ -201,9 +201,9 @@ export declare const TrustScoreOutputSchema: z.ZodObject<{
201
201
  }>>;
202
202
  }, "strip", z.ZodTypeAny, {
203
203
  trust_score: {
204
- score: number;
205
204
  summary: string;
206
205
  warnings: string[];
206
+ score: number;
207
207
  level: "high_risk" | "caution" | "moderate" | "trusted";
208
208
  breakdown: {
209
209
  description: string;
@@ -228,12 +228,9 @@ export declare const TrustScoreOutputSchema: z.ZodObject<{
228
228
  risk_score?: {
229
229
  advice: string[];
230
230
  level: "low" | "medium_low" | "medium_high" | "high";
231
- total: number;
232
- red_flags: string[];
233
231
  dimensions: {
234
232
  name: "fund" | "workflow" | "trust" | "behavior";
235
233
  score: number;
236
- max_score: number;
237
234
  checks: {
238
235
  description: string;
239
236
  id: string;
@@ -242,7 +239,10 @@ export declare const TrustScoreOutputSchema: z.ZodObject<{
242
239
  passed: boolean;
243
240
  advice?: string | undefined;
244
241
  }[];
242
+ max_score: number;
245
243
  }[];
244
+ total: number;
245
+ red_flags: string[];
246
246
  } | undefined;
247
247
  info_puzzle?: {
248
248
  completeness: number;
@@ -251,9 +251,9 @@ export declare const TrustScoreOutputSchema: z.ZodObject<{
251
251
  } | undefined;
252
252
  }, {
253
253
  trust_score: {
254
- score: number;
255
254
  summary: string;
256
255
  warnings: string[];
256
+ score: number;
257
257
  level: "high_risk" | "caution" | "moderate" | "trusted";
258
258
  breakdown: {
259
259
  description: string;
@@ -278,12 +278,9 @@ export declare const TrustScoreOutputSchema: z.ZodObject<{
278
278
  risk_score?: {
279
279
  advice: string[];
280
280
  level: "low" | "medium_low" | "medium_high" | "high";
281
- total: number;
282
- red_flags: string[];
283
281
  dimensions: {
284
282
  name: "fund" | "workflow" | "trust" | "behavior";
285
283
  score: number;
286
- max_score: number;
287
284
  checks: {
288
285
  description: string;
289
286
  id: string;
@@ -292,7 +289,10 @@ export declare const TrustScoreOutputSchema: z.ZodObject<{
292
289
  passed: boolean;
293
290
  advice?: string | undefined;
294
291
  }[];
292
+ max_score: number;
295
293
  }[];
294
+ total: number;
295
+ red_flags: string[];
296
296
  } | undefined;
297
297
  info_puzzle?: {
298
298
  completeness: number;
@@ -303,9 +303,9 @@ export declare const TrustScoreOutputSchema: z.ZodObject<{
303
303
  }, "strip", z.ZodTypeAny, {
304
304
  result: {
305
305
  trust_score: {
306
- score: number;
307
306
  summary: string;
308
307
  warnings: string[];
308
+ score: number;
309
309
  level: "high_risk" | "caution" | "moderate" | "trusted";
310
310
  breakdown: {
311
311
  description: string;
@@ -330,12 +330,9 @@ export declare const TrustScoreOutputSchema: z.ZodObject<{
330
330
  risk_score?: {
331
331
  advice: string[];
332
332
  level: "low" | "medium_low" | "medium_high" | "high";
333
- total: number;
334
- red_flags: string[];
335
333
  dimensions: {
336
334
  name: "fund" | "workflow" | "trust" | "behavior";
337
335
  score: number;
338
- max_score: number;
339
336
  checks: {
340
337
  description: string;
341
338
  id: string;
@@ -344,7 +341,10 @@ export declare const TrustScoreOutputSchema: z.ZodObject<{
344
341
  passed: boolean;
345
342
  advice?: string | undefined;
346
343
  }[];
344
+ max_score: number;
347
345
  }[];
346
+ total: number;
347
+ red_flags: string[];
348
348
  } | undefined;
349
349
  info_puzzle?: {
350
350
  completeness: number;
@@ -355,9 +355,9 @@ export declare const TrustScoreOutputSchema: z.ZodObject<{
355
355
  }, {
356
356
  result: {
357
357
  trust_score: {
358
- score: number;
359
358
  summary: string;
360
359
  warnings: string[];
360
+ score: number;
361
361
  level: "high_risk" | "caution" | "moderate" | "trusted";
362
362
  breakdown: {
363
363
  description: string;
@@ -382,12 +382,9 @@ export declare const TrustScoreOutputSchema: z.ZodObject<{
382
382
  risk_score?: {
383
383
  advice: string[];
384
384
  level: "low" | "medium_low" | "medium_high" | "high";
385
- total: number;
386
- red_flags: string[];
387
385
  dimensions: {
388
386
  name: "fund" | "workflow" | "trust" | "behavior";
389
387
  score: number;
390
- max_score: number;
391
388
  checks: {
392
389
  description: string;
393
390
  id: string;
@@ -396,7 +393,10 @@ export declare const TrustScoreOutputSchema: z.ZodObject<{
396
393
  passed: boolean;
397
394
  advice?: string | undefined;
398
395
  }[];
396
+ max_score: number;
399
397
  }[];
398
+ total: number;
399
+ red_flags: string[];
400
400
  } | undefined;
401
401
  info_puzzle?: {
402
402
  completeness: number;