@wowok/agent-mcp 2.7.0 → 2.7.2

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 (427) hide show
  1. package/dist/config/index.js +1 -1
  2. package/dist/config/runtime.js +1 -238
  3. package/dist/customer/customer-advice.js +1 -130
  4. package/dist/customer/index.js +1 -11
  5. package/dist/customer/industry-risks.js +1 -438
  6. package/dist/customer/info-puzzle.js +1 -681
  7. package/dist/customer/order-monitor.js +1 -328
  8. package/dist/customer/order-strategy.js +1 -373
  9. package/dist/customer/post-purchase.js +1 -351
  10. package/dist/customer/preorder-compare.js +1 -34
  11. package/dist/customer/reminder-system.js +1 -316
  12. package/dist/customer/risk-assessment.d.ts +5 -1
  13. package/dist/customer/risk-assessment.js +1 -397
  14. package/dist/customer/types.js +1 -13
  15. package/dist/customer/user-preferences.js +1 -460
  16. package/dist/evaluation/arbitration-game.d.ts +23 -0
  17. package/dist/evaluation/arbitration-game.js +1 -0
  18. package/dist/evaluation/builtins/demand-match.d.ts +15 -0
  19. package/dist/evaluation/builtins/demand-match.js +1 -0
  20. package/dist/evaluation/builtins/index.d.ts +3 -0
  21. package/dist/evaluation/builtins/index.js +1 -0
  22. package/dist/evaluation/builtins/service-risk.d.ts +6 -0
  23. package/dist/evaluation/builtins/service-risk.js +1 -0
  24. package/dist/evaluation/capability.d.ts +50 -0
  25. package/dist/evaluation/capability.js +1 -0
  26. package/dist/evaluation/composer.d.ts +13 -0
  27. package/dist/evaluation/composer.js +1 -0
  28. package/dist/evaluation/engine.d.ts +18 -0
  29. package/dist/evaluation/engine.js +1 -0
  30. package/dist/evaluation/extract.d.ts +30 -0
  31. package/dist/evaluation/extract.js +1 -0
  32. package/dist/evaluation/game-strategy.d.ts +27 -0
  33. package/dist/evaluation/game-strategy.js +1 -0
  34. package/dist/evaluation/gap.d.ts +2 -0
  35. package/dist/evaluation/gap.js +1 -0
  36. package/dist/evaluation/index.d.ts +12 -0
  37. package/dist/evaluation/index.js +1 -0
  38. package/dist/evaluation/node-game.d.ts +62 -0
  39. package/dist/evaluation/node-game.js +1 -0
  40. package/dist/evaluation/region.d.ts +10 -0
  41. package/dist/evaluation/region.js +1 -0
  42. package/dist/evaluation/types.d.ts +77 -0
  43. package/dist/evaluation/types.js +1 -0
  44. package/dist/evaluation/user-injection.d.ts +6 -0
  45. package/dist/evaluation/user-injection.js +1 -0
  46. package/dist/examples/education-contact-create.json +40 -0
  47. package/dist/examples/freelance-contact-create.json +40 -0
  48. package/dist/examples/insurance-machine-create.json +1 -1
  49. package/dist/examples/insurance-service-allocators.json +1 -1
  50. package/dist/examples/machine-publish.json +1 -1
  51. package/dist/examples/rental-ziroom-service-create.json +1 -1
  52. package/dist/examples/retail-adv-guard-messenger-proof-create.json +1 -1
  53. package/dist/examples/retail-myshop-service-create.json +1 -1
  54. package/dist/examples/retail-myshop-service-customer-required.json +1 -1
  55. package/dist/examples/subscription-contact-create.json +40 -0
  56. package/dist/examples/threebody-machine-create.json +1 -1
  57. package/dist/examples/travel-machine-create.json +1 -1
  58. package/dist/examples/travel-service-create.json +1 -1
  59. package/dist/experience/experience-reuse.js +1 -103
  60. package/dist/experience/index.js +1 -5
  61. package/dist/experience/intent-distill.js +1 -83
  62. package/dist/experience/realtime-feedback.js +1 -94
  63. package/dist/experience/types.js +1 -1
  64. package/dist/experience/user-profile.js +1 -171
  65. package/dist/extensions/business-modules.js +1 -287
  66. package/dist/extensions/capability-manifest.js +1 -781
  67. package/dist/extensions/constraint-registry.js +1 -198
  68. package/dist/extensions/index.js +1 -6
  69. package/dist/extensions/metric-registry.js +1 -257
  70. package/dist/extensions/mode-evaluator.js +1 -170
  71. package/dist/extensions/modes.js +1 -499
  72. package/dist/extensions/registry.js +1 -717
  73. package/dist/extensions/types.js +1 -1
  74. package/dist/harness/auto-escalation.js +1 -68
  75. package/dist/harness/checkpoint.js +1 -129
  76. package/dist/harness/index.js +1 -78
  77. package/dist/harness/plan.js +1 -276
  78. package/dist/harness/recover.js +1 -139
  79. package/dist/harness/types.js +1 -1
  80. package/dist/harness/verify.js +1 -237
  81. package/dist/index.js +1 -273
  82. package/dist/intent/enrich.d.ts +1 -0
  83. package/dist/intent/enrich.js +1 -0
  84. package/dist/intent/index.d.ts +23 -0
  85. package/dist/intent/index.js +1 -0
  86. package/dist/intent/matcher.d.ts +2 -0
  87. package/dist/intent/matcher.js +1 -0
  88. package/dist/intent/store.d.ts +19 -0
  89. package/dist/intent/store.js +1 -0
  90. package/dist/intent/types.d.ts +33 -0
  91. package/dist/intent/types.js +1 -0
  92. package/dist/knowledge/acquisition-flywheel.js +1 -192
  93. package/dist/knowledge/allocation-confirm.js +1 -534
  94. package/dist/knowledge/allocation-context.js +1 -249
  95. package/dist/knowledge/allocation-ledger.js +1 -463
  96. package/dist/knowledge/allocation-puzzle.js +1 -298
  97. package/dist/knowledge/allocation-risk.js +1 -568
  98. package/dist/knowledge/allocation-templates.js +1 -970
  99. package/dist/knowledge/allocation-translation.js +1 -585
  100. package/dist/knowledge/arb-risk.js +1 -210
  101. package/dist/knowledge/arbitration-confirm.js +1 -559
  102. package/dist/knowledge/arbitration-context.js +1 -505
  103. package/dist/knowledge/arbitration-ledger.js +1 -521
  104. package/dist/knowledge/arbitration-puzzle.js +1 -304
  105. package/dist/knowledge/arbitration-risk.js +1 -433
  106. package/dist/knowledge/arbitration-templates.js +1 -276
  107. package/dist/knowledge/arbitration-translation.js +1 -487
  108. package/dist/knowledge/arbitration-trust.js +1 -117
  109. package/dist/knowledge/audit-rules.js +1 -141
  110. package/dist/knowledge/bridge-risk.js +1 -263
  111. package/dist/knowledge/contact-risk.js +1 -200
  112. package/dist/knowledge/contact-templates.d.ts +27 -0
  113. package/dist/knowledge/contact-templates.js +1 -0
  114. package/dist/knowledge/demand-confirm.js +1 -206
  115. package/dist/knowledge/demand-matching.js +1 -132
  116. package/dist/knowledge/demand-risk.js +1 -240
  117. package/dist/knowledge/demand-translation.js +1 -354
  118. package/dist/knowledge/deployment-scanner.js +1 -823
  119. package/dist/knowledge/dynamic-pricing.js +1 -87
  120. package/dist/knowledge/examples-scanner-cli.js +1 -26
  121. package/dist/knowledge/examples-scanner.js +1 -825
  122. package/dist/knowledge/flywheel-loop.js +1 -404
  123. package/dist/knowledge/fund-layer.js +1 -973
  124. package/dist/knowledge/glossary.js +1 -211
  125. package/dist/knowledge/guard-confirm.js +1 -406
  126. package/dist/knowledge/guard-context.js +1 -287
  127. package/dist/knowledge/guard-design-patterns.js +1 -360
  128. package/dist/knowledge/guard-ledger.js +1 -260
  129. package/dist/knowledge/guard-lint.js +1 -670
  130. package/dist/knowledge/guard-migration.js +1 -228
  131. package/dist/knowledge/guard-puzzle.js +1 -805
  132. package/dist/knowledge/guard-render.js +1 -700
  133. package/dist/knowledge/guard-risk.js +1 -1879
  134. package/dist/knowledge/guard-submission-prompt.js +1 -171
  135. package/dist/knowledge/guard-templates.js +1 -1105
  136. package/dist/knowledge/guard-translation.js +1 -1119
  137. package/dist/knowledge/index.js +1 -436
  138. package/dist/knowledge/industry-evolution.js +1 -323
  139. package/dist/knowledge/industry-generalizer.js +1 -381
  140. package/dist/knowledge/industry-registry.js +1 -174
  141. package/dist/knowledge/intent-metrics.d.ts +4 -3
  142. package/dist/knowledge/intent-metrics.js +1 -566
  143. package/dist/knowledge/machine-confirm.js +1 -559
  144. package/dist/knowledge/machine-context.js +1 -833
  145. package/dist/knowledge/machine-ledger.js +1 -338
  146. package/dist/knowledge/machine-puzzle.js +1 -494
  147. package/dist/knowledge/machine-render.js +1 -565
  148. package/dist/knowledge/machine-risk.js +1 -670
  149. package/dist/knowledge/machine-templates.js +1 -1597
  150. package/dist/knowledge/machine-topology.js +1 -234
  151. package/dist/knowledge/machine-translation.js +1 -513
  152. package/dist/knowledge/mcp-schema-audit-cli.js +1 -45
  153. package/dist/knowledge/mcp-schema-audit.d.ts +1 -1
  154. package/dist/knowledge/mcp-schema-audit.js +1 -773
  155. package/dist/knowledge/onchain-constants.js +1 -35
  156. package/dist/knowledge/order-confirm.js +1 -573
  157. package/dist/knowledge/order-context.js +1 -390
  158. package/dist/knowledge/order-ledger.js +1 -341
  159. package/dist/knowledge/order-puzzle.js +1 -255
  160. package/dist/knowledge/order-risk.js +1 -653
  161. package/dist/knowledge/order-templates.js +1 -368
  162. package/dist/knowledge/order-translation.js +1 -550
  163. package/dist/knowledge/overrides-loader.js +1 -65
  164. package/dist/knowledge/passport-confirm.js +1 -531
  165. package/dist/knowledge/passport-context.js +1 -306
  166. package/dist/knowledge/passport-ledger.js +1 -282
  167. package/dist/knowledge/passport-puzzle.js +1 -333
  168. package/dist/knowledge/passport-risk.js +1 -450
  169. package/dist/knowledge/passport-templates.js +1 -568
  170. package/dist/knowledge/passport-translation.js +1 -516
  171. package/dist/knowledge/payment-risk.js +1 -249
  172. package/dist/knowledge/permission-confirm.js +1 -426
  173. package/dist/knowledge/permission-context.js +1 -224
  174. package/dist/knowledge/permission-ledger.js +1 -403
  175. package/dist/knowledge/permission-puzzle.js +1 -173
  176. package/dist/knowledge/permission-risk.js +1 -411
  177. package/dist/knowledge/permission-templates.js +1 -234
  178. package/dist/knowledge/permission-translation.js +1 -350
  179. package/dist/knowledge/personal-risk.js +1 -212
  180. package/dist/knowledge/process-model.js +1 -160
  181. package/dist/knowledge/progress-confirm.js +1 -456
  182. package/dist/knowledge/progress-context.js +1 -452
  183. package/dist/knowledge/progress-ledger.js +1 -330
  184. package/dist/knowledge/progress-puzzle.js +1 -219
  185. package/dist/knowledge/progress-risk.js +1 -461
  186. package/dist/knowledge/progress-templates.js +1 -228
  187. package/dist/knowledge/progress-translation.js +1 -405
  188. package/dist/knowledge/proof-confirm.js +1 -187
  189. package/dist/knowledge/proof-risk.js +1 -207
  190. package/dist/knowledge/proof-translation.js +1 -283
  191. package/dist/knowledge/registrar-risk.js +1 -217
  192. package/dist/knowledge/repository-confirm.js +1 -286
  193. package/dist/knowledge/repository-risk.js +1 -373
  194. package/dist/knowledge/repository-translation.js +1 -445
  195. package/dist/knowledge/reputation-rules.js +1 -99
  196. package/dist/knowledge/resource-risk.js +1 -157
  197. package/dist/knowledge/reward-confirm.js +1 -526
  198. package/dist/knowledge/reward-context.js +1 -504
  199. package/dist/knowledge/reward-ledger.js +1 -502
  200. package/dist/knowledge/reward-puzzle.js +1 -300
  201. package/dist/knowledge/reward-risk.js +1 -627
  202. package/dist/knowledge/reward-templates.js +1 -197
  203. package/dist/knowledge/reward-translation.js +1 -501
  204. package/dist/knowledge/safety-rules.js +1 -404
  205. package/dist/knowledge/scenario-modes.js +1 -321
  206. package/dist/knowledge/service-confirm.js +1 -807
  207. package/dist/knowledge/service-context.js +1 -403
  208. package/dist/knowledge/service-ledger.js +1 -609
  209. package/dist/knowledge/service-puzzle.js +1 -236
  210. package/dist/knowledge/service-risk.js +1 -615
  211. package/dist/knowledge/service-templates.js +1 -456
  212. package/dist/knowledge/service-translation.js +1 -622
  213. package/dist/knowledge/template-registry.d.ts +1 -1
  214. package/dist/knowledge/template-registry.js +1 -341
  215. package/dist/knowledge/tool-constraints.js +1 -195
  216. package/dist/knowledge/tools-reference.js +1 -155
  217. package/dist/knowledge/treasury-confirm.js +1 -512
  218. package/dist/knowledge/treasury-context.js +1 -363
  219. package/dist/knowledge/treasury-ledger.js +1 -300
  220. package/dist/knowledge/treasury-puzzle.js +1 -216
  221. package/dist/knowledge/treasury-risk.js +1 -440
  222. package/dist/knowledge/treasury-templates.js +1 -358
  223. package/dist/knowledge/treasury-translation.js +1 -498
  224. package/dist/knowledge/trust-metrics.js +1 -198
  225. package/dist/knowledge/util-risk.js +1 -135
  226. package/dist/loop-engineering/aggregate.js +1 -132
  227. package/dist/loop-engineering/context-collect.js +1 -83
  228. package/dist/loop-engineering/diagnose.js +1 -273
  229. package/dist/loop-engineering/improve.js +1 -405
  230. package/dist/loop-engineering/index.js +1 -4
  231. package/dist/loop-engineering/pipeline.js +1 -56
  232. package/dist/mode-market/index.js +1 -3
  233. package/dist/mode-market/registry.js +1 -124
  234. package/dist/mode-market/review.js +1 -214
  235. package/dist/mode-market/submission.js +1 -85
  236. package/dist/participation/collaborator-interest.d.ts +23 -0
  237. package/dist/participation/collaborator-interest.js +1 -0
  238. package/dist/participation/customer-interest.d.ts +25 -0
  239. package/dist/participation/customer-interest.js +1 -0
  240. package/dist/participation/merchant-interest.js +1 -100
  241. package/dist/participation/radar-core.d.ts +13 -3
  242. package/dist/participation/radar-core.js +1 -269
  243. package/dist/participation/supplier-interest.d.ts +25 -0
  244. package/dist/participation/supplier-interest.js +1 -0
  245. package/dist/persona/analyzer.d.ts +16 -0
  246. package/dist/persona/analyzer.js +1 -0
  247. package/dist/persona/bridge.d.ts +5 -0
  248. package/dist/persona/bridge.js +1 -0
  249. package/dist/persona/defaults.d.ts +4 -0
  250. package/dist/persona/defaults.js +1 -0
  251. package/dist/persona/experience-bridge.d.ts +3 -0
  252. package/dist/persona/experience-bridge.js +1 -0
  253. package/dist/persona/index.d.ts +18 -0
  254. package/dist/persona/index.js +1 -0
  255. package/dist/persona/model.d.ts +7 -0
  256. package/dist/persona/model.js +1 -0
  257. package/dist/persona/store.d.ts +19 -0
  258. package/dist/persona/store.js +1 -0
  259. package/dist/persona/types.d.ts +45 -0
  260. package/dist/persona/types.js +1 -0
  261. package/dist/project/business-puzzle.js +1 -383
  262. package/dist/project/context-assembly.js +1 -254
  263. package/dist/project/deployment-bridge.js +1 -120
  264. package/dist/project/deployment-doc.js +1 -1126
  265. package/dist/project/edit-planner.js +1 -1342
  266. package/dist/project/evaluation.js +1 -2011
  267. package/dist/project/game-theory.js +1 -177
  268. package/dist/project/graph-builder.js +1 -656
  269. package/dist/project/graph.js +1 -340
  270. package/dist/project/handlers.d.ts +5 -0
  271. package/dist/project/handlers.js +1 -1762
  272. package/dist/project/index.d.ts +1 -0
  273. package/dist/project/index.js +1 -301
  274. package/dist/project/intent-analyzer.js +1 -149
  275. package/dist/project/machine-nodes.js +1 -36
  276. package/dist/project/merchant-guide.js +1 -264
  277. package/dist/project/migration.js +1 -125
  278. package/dist/project/mode-actions.js +1 -309
  279. package/dist/project/namespace.js +1 -206
  280. package/dist/project/participation-radar.js +1 -428
  281. package/dist/project/pipeline-actions.js +1 -109
  282. package/dist/project/project-store.js +1 -422
  283. package/dist/project/query.js +1 -153
  284. package/dist/project/reverse-mapping.d.ts +34 -0
  285. package/dist/project/reverse-mapping.js +1 -0
  286. package/dist/project/risk-aggregator.js +1 -295
  287. package/dist/project/rollback-policy.js +1 -290
  288. package/dist/project/semantic-assembler.js +1 -345
  289. package/dist/project/semantic-graph.js +1 -245
  290. package/dist/project/stage-gate.js +1 -369
  291. package/dist/project/substep-trace.js +1 -332
  292. package/dist/project/task-tracker.js +1 -78
  293. package/dist/role/derivation.d.ts +18 -0
  294. package/dist/role/derivation.js +1 -0
  295. package/dist/role/index.d.ts +5 -0
  296. package/dist/role/index.js +1 -0
  297. package/dist/role/model.d.ts +8 -0
  298. package/dist/role/model.js +1 -0
  299. package/dist/role/resolution.d.ts +11 -0
  300. package/dist/role/resolution.js +1 -0
  301. package/dist/role/types.d.ts +11 -0
  302. package/dist/role/types.js +1 -0
  303. package/dist/rules.d.ts +2 -0
  304. package/dist/rules.js +1 -9
  305. package/dist/safety/confirm-gate.js +1 -88
  306. package/dist/safety/index.js +1 -3
  307. package/dist/safety/preview.js +1 -52
  308. package/dist/schema/call/allocation.js +1 -34
  309. package/dist/schema/call/arbitration.js +1 -113
  310. package/dist/schema/call/base.d.ts +15 -15
  311. package/dist/schema/call/base.js +1 -370
  312. package/dist/schema/call/bridge-handler.js +1 -265
  313. package/dist/schema/call/bridge.d.ts +7 -7
  314. package/dist/schema/call/bridge.js +1 -458
  315. package/dist/schema/call/contact.js +1 -37
  316. package/dist/schema/call/demand.js +1 -47
  317. package/dist/schema/call/guard.js +1 -161
  318. package/dist/schema/call/handler.js +1 -322
  319. package/dist/schema/call/index.js +1 -20
  320. package/dist/schema/call/machine.js +1 -193
  321. package/dist/schema/call/order.js +1 -35
  322. package/dist/schema/call/payment.js +1 -37
  323. package/dist/schema/call/permission-handler.js +1 -54
  324. package/dist/schema/call/permission.js +1 -105
  325. package/dist/schema/call/personal.js +1 -78
  326. package/dist/schema/call/progress.js +1 -47
  327. package/dist/schema/call/proof.js +1 -33
  328. package/dist/schema/call/repository.js +1 -77
  329. package/dist/schema/call/reward.js +1 -30
  330. package/dist/schema/call/semantic.js +1 -1657
  331. package/dist/schema/call/service.js +1 -178
  332. package/dist/schema/call/treasury.js +1 -71
  333. package/dist/schema/common/index.js +1 -407
  334. package/dist/schema/config/index.js +1 -68
  335. package/dist/schema/evaluation/index.d.ts +4436 -0
  336. package/dist/schema/evaluation/index.js +1 -0
  337. package/dist/schema/index.d.ts +4 -0
  338. package/dist/schema/index.js +1 -13
  339. package/dist/schema/intent-radar/index.d.ts +284 -0
  340. package/dist/schema/intent-radar/index.js +1 -0
  341. package/dist/schema/local/index.d.ts +21 -21
  342. package/dist/schema/local/index.js +1 -927
  343. package/dist/schema/local/wip.js +1 -187
  344. package/dist/schema/messenger/index.d.ts +7 -7
  345. package/dist/schema/messenger/index.js +1 -475
  346. package/dist/schema/operations.d.ts +7 -7
  347. package/dist/schema/operations.js +1 -520
  348. package/dist/schema/persona/index.d.ts +1985 -0
  349. package/dist/schema/persona/index.js +1 -0
  350. package/dist/schema/project/index.d.ts +96 -50
  351. package/dist/schema/project/index.js +1 -2057
  352. package/dist/schema/query/index.d.ts +423 -7
  353. package/dist/schema/query/index.js +1 -1640
  354. package/dist/schema/schema-query/index.js +1 -104
  355. package/dist/schema/schema-version.js +1 -76
  356. package/dist/schema/sync-layer4.d.ts +1 -1
  357. package/dist/schema/sync-layer4.js +1 -282
  358. package/dist/schema/task-status.d.ts +168 -0
  359. package/dist/schema/task-status.js +1 -0
  360. package/dist/schema/trust/index.js +1 -314
  361. package/dist/schema/utils/guard-parser.js +1 -419
  362. package/dist/schema/utils/guard-query-utils.js +1 -46
  363. package/dist/schema/utils/node-parser.js +1 -369
  364. package/dist/schema/utils/object-type-utils.js +1 -35
  365. package/dist/schema/utils/permission-index-utils.js +1 -7
  366. package/dist/schema/utils/permission-machine-check.js +1 -121
  367. package/dist/schema/utils/skills-recommendation.js +1 -77
  368. package/dist/schema-query/index.js +1 -810
  369. package/dist/schemas/account_operation.output.json +5 -2
  370. package/dist/schemas/bridge_operation.output.json +5 -2
  371. package/dist/schemas/evaluation_operation.output.json +782 -0
  372. package/dist/schemas/evaluation_operation.schema.json +990 -0
  373. package/dist/schemas/index.json +25 -1
  374. package/dist/schemas/intent_radar.output.json +232 -0
  375. package/dist/schemas/intent_radar.schema.json +138 -0
  376. package/dist/schemas/local_info_operation.output.json +5 -2
  377. package/dist/schemas/local_mark_operation.output.json +5 -2
  378. package/dist/schemas/messenger_operation.output.json +5 -2
  379. package/dist/schemas/onchain_events.output.json +5 -2
  380. package/dist/schemas/onchain_operations.output.json +5 -2
  381. package/dist/schemas/onchain_operations.schema.json +6 -6
  382. package/dist/schemas/onchain_operations_allocation.schema.json +1 -1
  383. package/dist/schemas/onchain_operations_machine.schema.json +2 -2
  384. package/dist/schemas/onchain_operations_service.schema.json +3 -3
  385. package/dist/schemas/onchain_table_data.output.json +6 -3
  386. package/dist/schemas/persona_operation.output.json +392 -0
  387. package/dist/schemas/persona_operation.schema.json +250 -0
  388. package/dist/schemas/project_operation.output.json +28 -8
  389. package/dist/schemas/query_task_status.output.json +115 -0
  390. package/dist/schemas/query_task_status.schema.json +24 -0
  391. package/dist/schemas/query_toolkit.output.json +9 -6
  392. package/dist/schemas/trust_score.schema.json +1 -1
  393. package/dist/schemas/wowok_buildin_info.output.json +132 -0
  394. package/dist/schemas/wowok_buildin_info.schema.json +14 -0
  395. package/dist/telemetry/index.js +1 -112
  396. package/dist/telemetry/redact.js +1 -23
  397. package/dist/telemetry/storage.js +1 -80
  398. package/dist/tools/handlers/bridge.js +1 -1
  399. package/dist/tools/handlers/config.js +1 -74
  400. package/dist/tools/handlers/evaluation.d.ts +2 -0
  401. package/dist/tools/handlers/evaluation.js +1 -0
  402. package/dist/tools/handlers/file-export.js +1 -90
  403. package/dist/tools/handlers/intent-radar.d.ts +2 -0
  404. package/dist/tools/handlers/intent-radar.js +1 -0
  405. package/dist/tools/handlers/local.js +1 -53
  406. package/dist/tools/handlers/messenger.js +1 -188
  407. package/dist/tools/handlers/onchain.js +1 -1082
  408. package/dist/tools/handlers/persona.d.ts +4 -0
  409. package/dist/tools/handlers/persona.js +1 -0
  410. package/dist/tools/handlers/project.js +1 -211
  411. package/dist/tools/handlers/query.js +1 -434
  412. package/dist/tools/handlers/schema-query.js +1 -176
  413. package/dist/tools/handlers/task-status.d.ts +0 -168
  414. package/dist/tools/handlers/task-status.js +1 -55
  415. package/dist/tools/handlers/trust.js +1 -380
  416. package/dist/tools/handlers/wip.js +1 -90
  417. package/dist/tools/index.js +1 -1306
  418. package/dist/tools/retry.js +1 -85
  419. package/dist/tools/rules-hook.js +1 -23
  420. package/dist/tools/shared.js +1 -130
  421. package/dist/tools/types.js +1 -1
  422. package/dist/tools/upgrade-check.d.ts +19 -0
  423. package/dist/tools/upgrade-check.js +1 -0
  424. package/dist/tools/wip-deploy-assist.d.ts +1 -1
  425. package/dist/tools/wip-deploy-assist.js +1 -278
  426. package/dist/tools/wrap.js +1 -500
  427. package/package.json +5 -3
@@ -1,1306 +1 @@
1
- import { z } from "zod";
2
- import { zodToJsonSchema } from "zod-to-json-schema";
3
- import { readFileSync } from "fs";
4
- import { fileURLToPath } from "url";
5
- import { dirname, join } from "path";
6
- import { ListToolsRequestSchema } from "@modelcontextprotocol/sdk/types.js";
7
- const __filename = fileURLToPath(import.meta.url);
8
- const __dirname = dirname(__filename);
9
- const SCHEMA_DIR_CANDIDATES = [
10
- join(__dirname, "..", "schemas"),
11
- join(__dirname, "..", "..", "dist", "schemas"),
12
- ];
13
- const preGeneratedSchemaCache = new Map();
14
- import { wrapHandlerWithErrorShape, statusErrorShape, operationErrorShape, strictStatusErrorShape, dispatchWithHarness, } from "./wrap.js";
15
- import { withTelemetry } from "../telemetry/index.js";
16
- import { handleOnchainOperations } from "./handlers/onchain.js";
17
- import { handleAccountOperation, handleMarkOperation, handleInfoOperation } from "./handlers/local.js";
18
- import { handleWipOperations } from "./handlers/wip.js";
19
- import { handleMessengerOperation } from "./handlers/messenger.js";
20
- import { handleGuard2File, handleMachineNode2File } from "./handlers/file-export.js";
21
- import { handleWatchQueryOperations, handleOnchainTableData, handleOnchainEvents, handleWowokInfo, } from "./handlers/query.js";
22
- import { handleSchemaQuery } from "./handlers/schema-query.js";
23
- import { handleBridgeOperations } from "./handlers/bridge.js";
24
- import { handleProjectOperation } from "./handlers/project.js";
25
- import { handleConfigOperation } from "./handlers/config.js";
26
- import { handleTrustScore } from "./handlers/trust.js";
27
- import { handleQueryTaskStatus, QueryTaskStatusInputSchema, QueryTaskStatusOutputSchema } from "./handlers/task-status.js";
28
- import { applyOnchainRules } from "./rules-hook.js";
29
- import { createToolMeta, OnchainOperationsSchema, AccountOperationSchema, LocalMarkOperationSchema, LocalInfoOperationSchema, WipOperationsSchema, MessengerOperationInputSchema, Guard2File_InputSchema, MachineNode2File_InputSchema, WatchQueryOperationsSchema, WatchQueryOperationsResultSchema, OnchainTableDataSchema, OnchainEventsInputSchema, ProtocolInfoQuerySchema, SchemaQueryInputSchema, BridgeOperationsSchema, ProjectOperationInputSchema, ConfigOperationInputSchema, TrustScoreInputSchema, CallOutputSchema, AccountOperationOutputWrappedSchema, LocalMarkOperationOutputWrappedSchema, LocalInfoOperationOutputWrappedSchema, WipOperationOutputSchema, MessengerOperationOutputSchema, Guard2File_OutputWrappedSchema, MachineNode2File_OutputWrappedSchema, OnchainTableDataResultSchema, OnchainEventsResultSchema, ProtocolInfoResultSchema, SchemaQueryOutputSchema, BridgeCallOutputSchema, ProjectOperationOutputSchema, ConfigOperationOutputSchema, TrustScoreOutputSchema, } from "../schema/index.js";
30
- export const TOOL_REGISTRY = [
31
- {
32
- name: "onchain_operations",
33
- handler: handleOnchainOperations,
34
- config: {
35
- title: "⛓️ On-chain Operations",
36
- description: "On-chain operations for WoWok object: service (marketplace listings), machine (workflow templates), progress (order tracking), repository (on-chain database), arbitration (dispute resolution), contact (IM management), treasury (team funds), reward (incentive pools), allocation (auto-distribution), permission (access control), guard (programmable trust rules), personal (public profile), payment (direct coin transfers), demand (service requests), order (order management), gen_passport (verified credentials), proof (on-chain proof objects), gen_proof (generate proof shortcut).\n\n💰 FUND SAFETY (service/arbitration/treasury/reward/allocation/payment): amounts are parsed against the target object's IMMUTABLE generic token type (e.g. Treasury<USDT> accepts ONLY USDT — mismatched coins/token_types are BLOCKED before execution). Monetary input with unresolvable token precision is BLOCKED (never guesses decimals) with known-token suggestions; retry once the token info resolves. Display-format amounts like \"2WOW\" are converted to raw u64 using the token's own decimals.\n\n📌 Project association: Pass env.project='<prefix>' to auto-tag the object on-chain AND auto-associate it to the SQLite project (created objects are automatically added). For complex builds, create a project first (project_operation action='create_project'). For single objects, just pass env.project. See PROJECT ASSOCIATION POLICY in system prompt.\n\n💡 Schema hint: Use schema_query with action='get' and name='onchain_operations' to retrieve the complete parameter schema. For individual operation schemas (e.g., 'onchain_operations_permission'), use schema_query with action='list_operations' to see all available operation schemas.",
37
- inputSchema: OnchainOperationsSchema,
38
- outputSchema: CallOutputSchema,
39
- annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: true },
40
- _meta: createToolMeta("operation", ["service", "machine", "progress", "repository", "arbitration", "contact", "treasury", "reward", "allocation", "permission", "guard", "personal", "payment", "demand", "order", "gen_passport", "proof", "gen_proof", "on-chain", "blockchain"]),
41
- },
42
- applyRules: applyOnchainRules,
43
- },
44
- {
45
- name: "account_operation",
46
- handler: handleAccountOperation,
47
- config: {
48
- title: "🔒 LOCAL ONLY: Account - Wallet Management",
49
- description: "🔒 100% LOCAL, NEVER ON-CHAIN 🔒 Manage WoWok accounts locally on device: generate, suspend, resume, faucet-test, operate assets, sign data, etc.\n\n💡 Schema hint: Use schema_query with action='get' and name='account_operation' to retrieve the exact parameter schema before calling.",
50
- inputSchema: AccountOperationSchema,
51
- outputSchema: AccountOperationOutputWrappedSchema,
52
- annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
53
- _meta: createToolMeta("operation", ["account", "local", "private", "wallet", "off-chain"]),
54
- },
55
- errorShapeBuilder: statusErrorShape,
56
- },
57
- {
58
- name: "local_mark_operation",
59
- handler: handleMarkOperation,
60
- config: {
61
- title: "🔒 LOCAL ONLY: LocalMark - Address Book Management",
62
- description: "100% LOCAL, NEVER ON-CHAIN 🔒 Manage ID names and tags stored ONLY on your local device for easy identification of user address or object IDs by name.\n\n💡 Schema hint: Use schema_query with action='get' and name='local_mark_operation' to retrieve the exact parameter schema before calling.",
63
- inputSchema: LocalMarkOperationSchema,
64
- outputSchema: LocalMarkOperationOutputWrappedSchema,
65
- annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
66
- _meta: createToolMeta("operation", ["mark", "local", "private", "address-book", "off-chain"]),
67
- },
68
- errorShapeBuilder: statusErrorShape,
69
- },
70
- {
71
- name: "local_info_operation",
72
- handler: handleInfoOperation,
73
- config: {
74
- title: "🔒 LOCAL ONLY: LocalInfo - Private Data Management",
75
- description: "100% LOCAL, NEVER ON-CHAIN 🔒 Manage sensitive personal information stored ONLY on your device: delivery addresses, phone numbers, contacts.\n\n💡 Schema hint: Use schema_query with action='get' and name='local_info_operation' to retrieve the exact parameter schema before calling.",
76
- inputSchema: LocalInfoOperationSchema,
77
- outputSchema: LocalInfoOperationOutputWrappedSchema,
78
- annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
79
- _meta: createToolMeta("operation", ["info", "local", "private", "data-management", "off-chain"]),
80
- },
81
- errorShapeBuilder: statusErrorShape,
82
- },
83
- {
84
- name: "wip_file",
85
- handler: handleWipOperations,
86
- config: {
87
- title: "🤝 Witness Immutable Promise File Operations",
88
- description: "generate (create WIP files from markdown and images), verify (integrity check), sign (add signatures), or wip2html (convert to HTML).\n\n⚠️ IMPORTANT — On-chain WIP URL requirement: When using a WIP file URL in `service.sales[].wip` (stored on-chain), the URL MUST be publicly reachable. Local file paths (e.g., 'C:\\\\path\\\\file.wip' or '/home/user/file.wip') are NOT acceptable on-chain — they only work locally and will fail verification for buyers.\n\nDeployment options for the .wip file:\n • GitHub Pages: https://raw.githubusercontent.com/<user>/<repo>/<branch>/<file>.wip\n • IPFS: https://ipfs.io/ipfs/<CID> or https://cloudflare-ipfs.com/ipfs/<CID> (upload via pinata.cloud)\n • User's own static website URL\n\nUse type='generate' to create the WIP file first, upload it to any of the above, then use the resulting URL in service.sales[].wip.\n\n💡 Schema hint: Use schema_query with action='get' and name='wip_file' to retrieve the exact parameter schema before calling.",
89
- inputSchema: WipOperationsSchema,
90
- outputSchema: z.object({
91
- result: WipOperationOutputSchema,
92
- }),
93
- annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
94
- _meta: createToolMeta("operation", ["wip", "promise", "file-generation", "verification", "signature", "local"]),
95
- },
96
- },
97
- {
98
- name: "messenger_operation",
99
- handler: handleMessengerOperation,
100
- config: {
101
- title: "💬 Messenger Operations",
102
- description: "WoWok encrypted messenger operations: watch conversations (with unread filtering, preview messages), send message, send file, watch messages (with viewed status filtering), extract zip messages, generate WTS, verify WTS, sign WTS, WTS to HTML, proof message on-chain, manage blacklist, friendslist, guardlist, settings, mark messages as viewed, mark conversation as viewed, and pull messages from server.\n\n💡 Schema hint: Use schema_query with action='get' and name='messenger_operation' to retrieve the exact parameter schema before calling.",
103
- inputSchema: MessengerOperationInputSchema,
104
- outputSchema: MessengerOperationOutputSchema,
105
- annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: true },
106
- _meta: createToolMeta("operation", ["messenger", "message", "file", "wts", "blacklist", "friendslist", "guardlist", "settings", "proof", "communication"]),
107
- },
108
- errorShapeBuilder: operationErrorShape,
109
- timeoutMs: 30000,
110
- },
111
- {
112
- name: "guard2file",
113
- handler: handleGuard2File,
114
- config: {
115
- title: "📄 Guard to File - Export Guard Definition",
116
- description: "Export a Guard object's definition from the blockchain to a local JSON or Markdown file for editing and creating new Guard objects. Note: To query on-chain object information, use the 'query_toolkit' tool instead.\n\n💡 Schema hint: Use schema_query with action='get' and name='guard2file' to retrieve the exact parameter schema before calling.",
117
- inputSchema: Guard2File_InputSchema,
118
- outputSchema: Guard2File_OutputWrappedSchema,
119
- annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
120
- _meta: createToolMeta("generate file", ["guard", "export", "file", "json", "markdown", "on-chain"]),
121
- },
122
- errorShapeBuilder: strictStatusErrorShape,
123
- },
124
- {
125
- name: "machineNode2file",
126
- handler: handleMachineNode2File,
127
- config: {
128
- title: "⚙️ Machine Node to File - Export Machine Node Definition",
129
- description: "Export a Machine object's node definition from the blockchain to a local JSON or Markdown file for editing and creating new Machine objects. Note: To query on-chain object information, use the 'query_toolkit' tool instead.\n\n💡 Schema hint: Use schema_query with action='get' and name='machineNode2file' to retrieve the exact parameter schema before calling.",
130
- inputSchema: MachineNode2File_InputSchema,
131
- outputSchema: MachineNode2File_OutputWrappedSchema,
132
- annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
133
- _meta: createToolMeta("generate file", ["machine", "export", "file", "json", "markdown", "on-chain", "workflow"]),
134
- },
135
- errorShapeBuilder: strictStatusErrorShape,
136
- },
137
- {
138
- name: "query_toolkit",
139
- handler: handleWatchQueryOperations,
140
- config: {
141
- title: "🔍 Data Query Toolkit",
142
- description: "WOWOK data query toolkit — 13 query types covering local device data and on-chain blockchain data:\n\n"
143
- + "LOCAL (device-only, never on-chain):\n"
144
- + "1. local_mark_list — Query your LOCAL address book: maps human-readable names to blockchain addresses with optional tags. Use to resolve names→addresses or find addresses by tag.\n"
145
- + "2. account_list — Query your LOCAL accounts (addresses, messenger status, suspension state). Use filter.includePubkey=true to also include public keys. Use to discover available accounts before operations.\n"
146
- + "3. local_info_list — Query your LOCAL private info: sensitive data like delivery addresses, phone numbers, contacts stored ONLY on this device.\n"
147
- + "4. token_list — Query cached token metadata: symbol, decimals, icon URL, description for tokens previously fetched from chain. Use to look up token precision/decimals before performing token operations. Returns: TokenTypeInfo[] (type, alias, name, symbol, decimals, iconUrl).\n"
148
- + "5. account_balance — Query an account's coin balance OR Paginated coin objects. Use balance=true for total amount, or coin={cursor,limit} to list individual coin objects. Supports multi-token via token_type parameter. Results include `_money_display` with unit-converted values + decimals reminder.\n"
149
- + "6. local_names — Query local names by a list of addresses. For each address, returns the resolved account name (if exists) and local mark name (if exists). Returns: { account?, local_mark?, address }[].\n\n"
150
- + "ONCHAIN (blockchain):\n"
151
- + "7. onchain_personal_profile — Query any user's PUBLIC on-chain profile: social links, reputation (likes/dislikes), personal info records, voting history, referrer.\n"
152
- + "8. onchain_objects — Batch query on-chain WOWOK objects by ID or name: supports Service, Machine, Order, Treasury, Reward, Arb, Personal, Contact, and more. Monetary fields include `_money_display` annotations (token type from the object's immutable generic).\n"
153
- + "9. onchain_received — Query objects (Payments, Tokens, NFTs) received by a specific object. Supports pagination and type filter. CoinWrapper mode returns token-aware `_money_display`.\n"
154
- + "10. onchain_transaction — Verify what a specific transaction did on-chain (status, object changes, balance changes, gas, events). Balance changes include `_money_display` (unit-converted via each change's own coin_type; signed amounts supported).\n"
155
- + "11. onchain_object_history — FORENSICS: all transactions that touched an object (auditing only — prefer assemble_context for AI context building).\n"
156
- + "12. onchain_address_activity — FORENSICS: all transactions sent by an address (auditing only).\n"
157
- + "13. token_value_convert — Convert between raw on-chain smallest units (u64) and human unit values in EITHER direction (e.g. \"2200000000\" ↔ \"2.2\" WOW). Unit→raw is REFUSED when token precision cannot be resolved (never guesses decimals).\n\n"
158
- + "For dynamic table data queries (pagination, table items), use the 'onchain_table_data' tool.\n\n"
159
- + "💡 Schema hint: Use schema_query with action='get' and name='query_toolkit' to retrieve the exact parameter schema with all query types and field definitions.",
160
- inputSchema: WatchQueryOperationsSchema,
161
- outputSchema: WatchQueryOperationsResultSchema,
162
- annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
163
- _meta: createToolMeta("query", ["watch", "query", "on-chain", "local", "events", "objects", "tokens", "balance", "profile"]),
164
- },
165
- },
166
- {
167
- name: "onchain_table_data",
168
- handler: handleOnchainTableData,
169
- config: {
170
- title: "📊 Watch WoWok On-chain Table Data Query",
171
- description: "Query dynamic table data of on-chain objects — supports paginated table queries and specific table item lookups. Each table item belongs to a parent object type and has a specific meaning:\n\n"
172
- + "1. onchain_table — Paginated query of ANY object's dynamic fields table (Parent: any object). Returns all entries with keys, types, and object IDs. Use to explore all sub-items of an object.\n"
173
- + "2. onchain_table_item_repository_data — Query a record from a Repository's on-chain key-value database (Parent: Repository). Key: name + entity (address or number). Returns the stored data record with typed value.\n"
174
- + "3. onchain_table_item_permission_perm — Query a permission entry from a Permission object's access control table (Parent: Permission). Key: user address or Guard ID. Returns the permission list (perm[]) granted to that user/guard.\n"
175
- + "4. onchain_table_item_entity_registrar — Query an entity's registration record from the GLOBAL EntityRegistrar (Parent: system EntityRegistrar). Key: user address. Returns registration info: description, referrer, records, mark_object.\n"
176
- + "5. onchain_table_item_entity_linker — Query community votes/endorsements for an entity from the GLOBAL EntityLinker (Parent: system EntityLinker). Key: entity address. Returns vote records (likes/dislikes) showing community trust.\n"
177
- + "6. onchain_table_item_reward_record — Query a reward claim record from a Reward object's distribution table (Parent: Reward). Key: recipient address. Returns claim history: guard used, total claimed, per-claim details.\n"
178
- + "7. onchain_table_item_demand_presenter — Query a demand submission from a Demand object's presenter table (Parent: Demand). Key: presenter address. Returns submission details: recommendation, service, feedback, acceptance score.\n"
179
- + "8. onchain_table_item_treasury_history — Query a payment record from a Treasury's history table (Parent: Treasury). Key: payment ID (address). Returns payment details: operation type, signer, amount, external guard.\n"
180
- + "9. onchain_table_item_machine_node — Query a workflow node definition from a Machine object's node table (Parent: Machine). Key: node name (string). Returns node configuration: pairs, forwards, guards, thresholds.\n"
181
- + "10. onchain_table_item_progress_history — Query a progress step record from a Progress object's history table (Parent: Progress). Key: sequence number (u64). Returns step details: node, next_node, session state, time.\n"
182
- + "11. onchain_table_item_address_mark — Query a PUBLIC on-chain name/tag mark from an AddressMark object's table (Parent: AddressMark). Key: address. Returns public labels: entity, name, tags[]. Unlike local marks, these are published on-chain.\n"
183
- + "12. onchain_table_item_generic — Query a generic table item from ANY object's dynamic fields (Parent: any object). Supports arbitrary key types (address, u64, string, object ID, etc.). Use for custom objects and general-purpose table lookups. Returns: ObjectBase | undefined.\n\n"
184
- + "💡 Schema hint: Use schema_query with action='get' and name='onchain_table_data' to retrieve the exact parameter schema with all table item types and field definitions.",
185
- inputSchema: OnchainTableDataSchema,
186
- outputSchema: OnchainTableDataResultSchema,
187
- annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
188
- _meta: createToolMeta("table query", ["on-chain", "table", "dynamic fields", "pagination", "repository", "permission", "reward", "demand", "treasury", "machine", "progress"]),
189
- },
190
- },
191
- {
192
- name: "onchain_events",
193
- handler: handleOnchainEvents,
194
- config: {
195
- title: "📅 Watch WoWok On-chain Events",
196
- description: "Watch on-chain WoWok events by type. Supports arbitration events, new order events, progress events, demand presentation events, demand feedback events, and new entity registration events. Use pagination cursor for fetching large result sets. NewOrderEvent.amount includes `_money_display` annotation (unit-converted via the order's Service generic token type; raw-only with retry hint when precision is unavailable).\n\n💡 Schema hint: Use schema_query with action='get' and name='onchain_events' to retrieve the exact parameter schema with all event types and field definitions.",
197
- inputSchema: OnchainEventsInputSchema,
198
- outputSchema: OnchainEventsResultSchema,
199
- annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
200
- _meta: createToolMeta("watch wowook events", ["events", "on-chain", "arbitration", "order", "progress", "demand", "entity"]),
201
- },
202
- },
203
- {
204
- name: "wowok_buildin_info",
205
- handler: handleWowokInfo,
206
- config: {
207
- title: "ℹ️ WoWok Build-in Information",
208
- description: "Query WoWok protocol information: 'constants', 'built-in permissions', 'common mistakes', 'guard instructions', 'current network', 'value types', 'mainnet bridge tokens', or 'funding guidance'. Use 'common mistakes' to proactively learn known field-name/unit/workflow pitfalls before submitting an operation (e.g. filter operation:\"compensation_fund_add\"). For 'mainnet bridge tokens': returns cross-chain bridge tokens (ETH, WETH, WBTC, USDC, USDT) with each token's symbol, WOW-side type tag (wowTypeTag), EVM address, decimals, and description. The wowTypeTag (format {address}::{module}::{struct}) can be used directly as the `type_parameter` of Service / Treasury / Reward / Allocation objects to set their payment token — e.g. use USDT's wowTypeTag to create a Service that accepts USDT payments. For 'funding guidance': returns how to obtain WOW gas and payment tokens — testnet faucet, mainnet ETH cross-chain bridge flow, and the WOW mainnet airdrop link. Use this when a user asks how to obtain tokens/gas/funds, or as a proactive first-use reminder.",
209
- inputSchema: ProtocolInfoQuerySchema,
210
- outputSchema: ProtocolInfoResultSchema,
211
- annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
212
- _meta: createToolMeta("WoWok info", ["build-in", "constants", "permissions", "guard", "network", "value-types", "bridge-tokens", "funding-guidance", "faucet", "airdrop"]),
213
- },
214
- },
215
- {
216
- name: "schema_query",
217
- handler: handleSchemaQuery,
218
- config: {
219
- title: "📋 Schema Query",
220
- description: "Look up JSON Schemas for WoWok MCP tools and on-chain operations. " +
221
- "This is the authoritative reference for exact parameter structures, types, and required fields. " +
222
- "Always check the schema before calling an unfamiliar tool.\n\n" +
223
- "Actions:\n" +
224
- " 'list' - Show all available schemas (tools + on-chain operations). Start here to discover what exists.\n" +
225
- " 'get' - Fetch the full input JSON Schema by name (e.g. 'onchain_operations'). Use with the 'name' param.\n" +
226
- " 'get_output' - Fetch the output JSON Schema of a tool by name (e.g. 'onchain_operations'). Use with the 'name' param. Use this to understand a tool's return value structure.\n" +
227
- " 'get_field' - Query a single field by dot-path (e.g. field_path='data.node.nodes.0.pairs'). Cheaper than 'get' when you only need one subtree.\n" +
228
- " 'search' - Find schemas by keyword, matching name/title/description. Use with the 'query' param.\n" +
229
- " 'list_operations' - Show only on-chain operation schemas (prefixed 'onchain_operations_'). Narrower than 'list'.\n" +
230
- " 'get_guard_templates' - Guard creation templates + best practices (e.g. signer_verification, progress_node_check). Omit 'template' to list all.\n" +
231
- " 'search_examples' - Search verified example files by keyword (matches title/description/tags/operation_type/industry). Use with the 'query' param.\n" +
232
- " 'get_tool_reference' - MCP tool usage reference (summaries, actions, prerequisites, notes). Pass name='<tool>' for one tool, query='<keyword>' to search, or omit for the full catalog.\n" +
233
- " 'get_guard_design_patterns' - Curated Guard design patterns (business requirement → logic tree template). Pass name='<pattern_id>', query='<host>' (e.g. 'service_buy_guard', 'machine_forward'), or omit for the full catalog.\n" +
234
- " 'get_safety_rules' - Safety rule tables sunk from the wowok-safety skill: object reuse, immutability-after-publish, LOCAL/ONCHAIN/QUERY classification, naming conventions.",
235
- inputSchema: SchemaQueryInputSchema,
236
- outputSchema: SchemaQueryOutputSchema,
237
- annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
238
- _meta: createToolMeta("schema", ["schema", "json-schema", "types", "structure", "validation", "reference"]),
239
- },
240
- },
241
- {
242
- name: "bridge_operation",
243
- handler: handleBridgeOperations,
244
- config: {
245
- title: "🌉 Bridge - Cross-Chain Operations",
246
- description: "🌉 Simplified cross-chain bridge between WOW and EVM (Ethereum mainnet). Only WOW mainnet provides cross-chain functionality.\n\n" +
247
- "Key concepts (transparent to user):\n" +
248
- " • Global single activeEvmAccount - auto-generated on first use, holds cross-chain assets.\n" +
249
- " • WOW→EVM: assets auto-claim to activeEvmAccount; optional withdrawTo transfers to a final EVM address.\n" +
250
- " • EVM→WOW: deposit from activeEvmAccount (balance checked first), assets arrive at the WOW account.\n\n" +
251
- "Operations (operation_type):\n" +
252
- " • cross_chain_wow_to_evm - WOW→EVM cross-chain (asset to activeEvmAccount or withdrawTo). [Requires WOW mainnet env]\n" +
253
- " • cross_chain_evm_to_wow - EVM→WOW cross-chain (from activeEvmAccount to WOW account). [Requires WOW mainnet env]\n" +
254
- " • withdraw - Withdraw from activeEvmAccount to another EVM address (non-cross-chain). [No env needed]\n" +
255
- " • query_active_evm_account - Query activeEvmAccount address + balances (per chain or all). [No env needed]\n" +
256
- " • query_supported_evm_chains - List supported EVM chains (enum/description/chainId/RPC health). [No env needed]\n" +
257
- " • query_supported_tokens - List supported Bridge tokens per chain (WOW/EVM contract addresses, decimals, description). [No env needed]\n" +
258
- " • query_transfer_list - Query transfer history list with optional filters (status/direction/token/limit). [No env needed]\n" +
259
- " • query_transfer_status - Query single transfer detail by transferId. [No env needed]\n" +
260
- " • manage_evm_rpc - Manage EVM RPC endpoints (list/add/remove/set/ping) to handle 429 rate limits. [No env needed]\n\n" +
261
- "Token support follows SDK config (ETH/WETH/WBTC/USDC/USDT). WOW account names are supported (resolved via LocalMark).\n" +
262
- "NOTE: Use schema_query (name='bridge_operation') to retrieve the exact JSON Schema with all field definitions before calling.",
263
- inputSchema: BridgeOperationsSchema,
264
- outputSchema: BridgeCallOutputSchema,
265
- annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: true },
266
- _meta: createToolMeta("operation", ["bridge", "cross-chain", "evm", "ethereum", "wow", "transfer", "rpc"]),
267
- },
268
- },
269
- {
270
- name: "project_operation",
271
- handler: handleProjectOperation,
272
- config: {
273
- title: "🗂️ Project - Entity Management & Evaluation",
274
- description: "Project management service — manage projects as first-class entities with SQLite persistence, " +
275
- "rigid project-object relationships, three-pathway graph construction, and a dual rule-based + " +
276
- "LLM-assisted evaluation engine.\n\n" +
277
- "📌 Project policy: Complex builds → auto-create project first + check for similar projects. " +
278
- "Single object → remind user to add to a project. " +
279
- "Consumer → create_project_from_onchain + evaluate before buying.\n\n" +
280
- "═══════════════════════════════════════════════════════════════\n" +
281
- " PROJECT ENTITY + EVALUATION (15 actions, GLM6)\n" +
282
- "═══════════════════════════════════════════════════════════════\n" +
283
- " • list_projects — List all projects (with object count + types). Supports filter_status, filter_perspective, filter_network.\n" +
284
- " • create_project — Create a new project (producer/consumer/both, bound to a network).\n" +
285
- " • create_project_from_onchain — Create a consumer project from an on-chain Service address (auto-discovers objects + graph).\n" +
286
- " • update_project — Update project metadata, status, labels, service address, etc.\n" +
287
- " • get_project_detail — Get full project detail (objects, graph edges, evaluations, versions).\n" +
288
- " • add_object — Add an on-chain object to a project (by address or LocalMark name).\n" +
289
- " • remove_object — Remove an object from a project.\n" +
290
- " • create_version — Create a project version (e.g. 'v2') with optional fork from a source version.\n" +
291
- " • build_graph — Build relationship graph via 3 pathways (internal refs, Registrar, potential). Configurable depth.\n" +
292
- " • get_graph — Get persisted graph edges.\n" +
293
- " • evaluate_project — Evaluate project (risk/trust/completeness = rule-based; value/worth_buying = LLM-assisted with prompt).\n" +
294
- " • save_evaluation — Save an LLM-produced evaluation result.\n" +
295
- " • compare_projects — Compare multiple projects by evaluation type.\n" +
296
- " • refresh_objects — Refresh object cache from chain (batch query, rate-limited).\n" +
297
- " • get_object_diff — Get field-level diff of an object between two timestamps.\n\n" +
298
- "═══════════════════════════════════════════════════════════════\n" +
299
- " INDUSTRY MODE RECOMMENDATION + REGISTRY (9 actions, GLM6/92 §E)\n" +
300
- "═══════════════════════════════════════════════════════════════\n" +
301
- " • recommend_industry — CALL THIS FIRST when the user describes a business without naming an industry. " +
302
- "Returns top-3 similar industries + verified reference examples ('from scratch vs giants' shoulders').\n" +
303
- " • list_modes — List builtin industry modes + your custom modes.\n" +
304
- " • derive_user_mode — Derive a custom mode from a builtin (modify machine_shape/allocator/config). R-M1-11 enforced.\n" +
305
- " • evolve_user_mode — Iterate a custom mode (version bump + evolution history).\n" +
306
- " • register_user_mode — Register a fully custom mode (requires machine_shape + key_risk).\n" +
307
- " • unregister_user_mode — Delete a custom mode.\n" +
308
- " • register_custom_metric / register_custom_constraint — Extend the evaluation registries.\n" +
309
- " • list_metrics_constraints — List metrics + constraints (filterable by type/scope).\n\n" +
310
- "═══════════════════════════════════════════════════════════════\n" +
311
- " INTENT → RISK → SUBSTEP PIPELINE (3 actions, GLM5-31 §V3/V4)\n" +
312
- "═══════════════════════════════════════════════════════════════\n" +
313
- " • analyze_intent (C1) — Business intent text → parsed intent (primary/secondary objects, " +
314
- "detected scenes, industry) + per-object puzzle snapshots + recommended creation order. " +
315
- "Required: intent.\n" +
316
- " • aggregate_risks (C2) — Puzzle snapshots → calibrated risks (CRITICAL/HIGH/MEDIUM/LOW/INFO) " +
317
- "with blocking status (RISK_BLOCKED / RISK_PENDING_CONFIRM / RISK_PASSED). Required: project + " +
318
- "(puzzles OR intent — when intent is given, analyze_intent runs first automatically). " +
319
- "Optional: planned_objects (OBJECT_REUSE check), planned_operations (IMMUTABILITY check).\n" +
320
- " • trace_substeps (C3) — Substep execution records → DAG coherence analysis (dangling inputs, " +
321
- "circular refs, missing outputs, cross-step breaks, topological order, D-10 verdict). " +
322
- "Required: project + substeps.\n\n" +
323
- "═══════════════════════════════════════════════════════════════\n" +
324
- " MERCHANT ONBOARDING WIZARD (1 action, GLM6/93 §5)\n" +
325
- "═══════════════════════════════════════════════════════════════\n" +
326
- " • merchant_guide — 10-step guided flow from 'I want to sell X' to a validated creation plan: " +
327
- "intent analysis → industry matching → module adoption → semantic blueprint → evaluation preview → " +
328
- "harness check → ordered creation plan. Stateless: pass guide_state UNCHANGED between calls, " +
329
- "advance via guide_confirm. NEVER executes on-chain — materialize the plan via create_project + " +
330
- "onchain_operations. Required: intent (first call) or guide_state.\n\n" +
331
- "═══════════════════════════════════════════════════════════════\n" +
332
- " CONTEXT ASSEMBLY (1 action)\n" +
333
- "═══════════════════════════════════════════════════════════════\n" +
334
- " • assemble_context — Query on-chain object states + extract embedded history + optional events, " +
335
- "and assemble a structured semantic context for LLM consumption. Required: context_objects (array of IDs/names).\n\n" +
336
- "Correct object creation order (topological): Permission → Allocation → Guard → Machine → Service.\n" +
337
- "All objects created as draft (publish=false) first; publish Machine before Service (last).\n\n" +
338
- "💡 Schema hint: Use schema_query with action='get' and name='project_operation' for exact field definitions.",
339
- inputSchema: ProjectOperationInputSchema,
340
- outputSchema: ProjectOperationOutputSchema,
341
- annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
342
- _meta: createToolMeta("project", ["project", "entity", "sqlite", "graph", "evaluation", "risk", "trust", "completeness", "worth_buying", "registrar", "diff", "version", "context", "assembly"]),
343
- },
344
- },
345
- {
346
- name: "config_operation",
347
- handler: handleConfigOperation,
348
- config: {
349
- title: "⚙️ Config - Runtime Service Toggles",
350
- description: "Phase 2 runtime configuration — toggle Phase 2 services on/off at runtime WITHOUT restarting the MCP server. " +
351
- "This is the session-level switch mechanism: AI can toggle based on user conversation context, or users can " +
352
- "directly control which Phase 2 features are active.\n\n" +
353
- "Actions:\n" +
354
- " • list — List all services with current state + reminders.\n" +
355
- " • toggle — Toggle a service on/off (requires `service` param). Returns reminder text.\n" +
356
- " • enable — Enable a service (requires `service` param).\n" +
357
- " • disable — Disable a service (requires `service` param).\n" +
358
- " • reset — Reset a service to its default (requires `service` param).\n" +
359
- " • info — Get detailed info about a service (requires `service` param).\n\n" +
360
- "Services:\n" +
361
- " • confirm_gate — Safety Confirmation Gate (default ON)\n" +
362
- " • project_service — On-chain project tag auto-injection (default ON). When ON, objects created via onchain_operations are auto-tagged with project:<prefix> for on-chain grouping. Use project_operation for SQLite-based project management (evaluation, graph, versioning).\n" +
363
- " • harness — L4 Verify/Recover Loop (default OFF)\n" +
364
- " • graph_persist — Graph Persistence to File (default OFF)\n" +
365
- " • semantic_rich — Semantic Layer Enrichment Reminder (default ON)\n" +
366
- " • experience_layer — Real-time Experience Layer (Phase 2 Topic 2, default ON)\n" +
367
- " • customer_intelligence — Buyer Intelligence / Risk & Preference Alerts (Phase 3 C-3, default ON)\n" +
368
- " • order_monitor — In-progress Order Monitoring (Phase 3 C-3.2, default OFF)\n" +
369
- " • industry_evolution — Industry Specialization Evolution Flywheel (Phase 4, default ON)\n\n" +
370
- "NOTE: Toggles persist for the MCP process lifetime. Set WOWOK_RUNTIME_CONFIG_PERSIST=1 " +
371
- "to persist across sessions to ~/.wow/mcp/runtime-config.json.\n\n" +
372
- "💡 Schema hint: Use schema_query with action='get' and name='config_operation' to retrieve the exact parameter schema with all actions and field definitions.",
373
- inputSchema: ConfigOperationInputSchema,
374
- outputSchema: ConfigOperationOutputSchema,
375
- annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
376
- _meta: createToolMeta("config", ["config", "toggle", "service", "runtime", "switch", "enable", "disable"]),
377
- },
378
- },
379
- {
380
- name: "trust_score",
381
- handler: handleTrustScore,
382
- config: {
383
- title: "🛡️ Trust Score - Service Risk & Trust Assessment",
384
- description: "Proactively query the trust score and risk assessment of a Service object. " +
385
- "This is the standalone query form of the trust_score field that is otherwise only " +
386
- "passively injected into onchain_operations semantic output.\n\n" +
387
- "Returns:\n" +
388
- " • trust_score (0-100, 5 dimensions: arbitration/reviews/fulfillment/fund_safety/transparency)\n" +
389
- " • risk_score (4 dimensions: workflow/fund/trust/behavior, 100-point) when depth >= 'evaluate'\n" +
390
- " • info_puzzle completeness + gaps summary\n" +
391
- " • service_basics snapshot (published/paused/sales/guards/arbitrations)\n\n" +
392
- "Use this tool when the user asks 'is this service trustworthy?', 'should I buy from this merchant?', " +
393
- "'what's the risk of ordering this service?', or any explicit trust/risk inquiry about a Service.\n\n" +
394
- "Parameters:\n" +
395
- " • service (required) — Service object ID or local_mark name.\n" +
396
- " • order_amount (optional) — Order amount in smallest token unit (e.g. 2000000000 for 2 WOW). " +
397
- "Defaults to the service's first active sale price.\n" +
398
- " • depth (optional, default 'evaluate') — 'browse' (trust score only), 'evaluate' (+ risk assessment), " +
399
- "'preorder' (most thorough, includes market context dimension).\n\n" +
400
- "💡 Schema hint: Use schema_query with action='get' and name='trust_score' to retrieve the exact parameter schema.",
401
- inputSchema: TrustScoreInputSchema,
402
- outputSchema: TrustScoreOutputSchema,
403
- annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
404
- _meta: createToolMeta("trust", ["trust", "score", "risk", "service", "merchant", "reputation", "safety", "evaluate"]),
405
- },
406
- },
407
- {
408
- name: "query_task_status",
409
- handler: handleQueryTaskStatus,
410
- config: {
411
- title: "📊 Task Status - Async Operation Tracking",
412
- description: "Query the status of a long-running async task (created by build_graph or evaluate_project " +
413
- "with async_mode=true). Returns progress percentage, current status, and the final result " +
414
- "when completed.\n\n" +
415
- "Tasks are ephemeral (retained 5 minutes after completion, in-memory only).\n\n" +
416
- "Usage:\n" +
417
- " • Pass task_id to query a single task's status.\n" +
418
- " • Omit task_id to list all recent tasks (max 50, most recent first).\n" +
419
- " • Pass project_id (with task_id omitted) to filter by project.\n\n" +
420
- "This tool is read-only and always safe to call. Use it to check if a long-running " +
421
- "operation (e.g. build_graph with enablePotential=true) has completed.\n\n" +
422
- "💡 Schema hint: Use schema_query with action='get' and name='query_task_status' to retrieve the exact parameter schema.",
423
- inputSchema: QueryTaskStatusInputSchema,
424
- outputSchema: QueryTaskStatusOutputSchema,
425
- annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
426
- _meta: createToolMeta("task", ["task", "status", "async", "progress", "background", "tracker"]),
427
- },
428
- },
429
- ];
430
- export const TOOL_REGISTRY_MAP = new Map(TOOL_REGISTRY.map(t => [t.name, t]));
431
- const SUB_TOOL_NAMES = TOOL_REGISTRY.map(t => t.name);
432
- const WowokToolRuntimeSchema = z.unknown().describe("WoWok unified tool input. Expected: { tool: \"<sub-tool>\", data: {<params>} }. " +
433
- "Aliases accepted: tool_name→tool, args→data, name→tool, params→data. " +
434
- "If parameters don't match the sub-tool's schema, the response includes the correct schema for self-correction.");
435
- const WowokToolDisplaySchema = z.object({
436
- tool: z.enum(SUB_TOOL_NAMES).optional().describe("The sub-tool to execute. Each sub-tool has its own parameter schema."),
437
- data: z.record(z.unknown()).optional().describe("Sub-tool specific parameters. If validation fails, the response includes the correct schema for this sub-tool — read it, fix your params, and retry."),
438
- tool_name: z.enum(SUB_TOOL_NAMES).optional().describe("DEPRECATED alias for 'tool'. Use 'tool' instead."),
439
- args: z.record(z.unknown()).optional().describe("DEPRECATED alias for 'data'. Use 'data' instead."),
440
- name: z.enum(SUB_TOOL_NAMES).optional().describe("DEPRECATED alias for 'tool'. Use 'tool' instead."),
441
- params: z.record(z.unknown()).optional().describe("DEPRECATED alias for 'data'. Use 'data' instead."),
442
- }).describe("WoWok unified tool input. Call with { tool: \"<sub-tool>\", data: {<params>} }. " +
443
- "Aliases: tool_name/name→tool, args/params→data.");
444
- const WOWOK_TOOL_DESCRIPTION = [
445
- "WoWok MCP unified interface. Call with { tool: \"<sub-tool>\", data: {<params>} }.",
446
- "",
447
- " tool: name of the sub-tool (string)",
448
- " data: sub-tool parameters (object)",
449
- "",
450
- " Aliases accepted (deprecated): tool_name/name for tool, args/params for data.",
451
- " Inline params also accepted: { tool: \"<sub-tool>\", <param1>: ..., <param2>: ... }",
452
- "",
453
- " EXAMPLE: wowok({ tool: \"schema_query\", data: { action: \"get\", name: \"onchain_operations\" } })",
454
- " EXAMPLE: wowok({ tool: \"wowok_buildin_info\", data: { info: \"mainnet bridge tokens\" } })",
455
- " EXAMPLE (inline params): wowok({ tool: \"schema_query\", action: \"get\", name: \"onchain_operations\" })",
456
- "",
457
- "Available sub-tools:",
458
- " onchain_operations — On-chain ops: service, machine, progress, repository, arbitration, etc.",
459
- " account_operation — LOCAL wallet management (generate, suspend, faucet, sign).",
460
- " local_mark_operation — LOCAL address book (name/tag for addresses and object IDs).",
461
- " local_info_operation — LOCAL private data (delivery addresses, phone numbers).",
462
- " wip_file — Work-in-progress file management.",
463
- " messenger_operation — End-to-end encrypted messaging.",
464
- " guard2file — Export guard rules to file.",
465
- " machineNode2file — Export machine nodes to file.",
466
- " query_toolkit — Query on-chain objects by ID/type/owner.",
467
- " onchain_table_data — Query on-chain dynamic field tables with pagination.",
468
- " onchain_events — Watch on-chain events (arbitration, order, progress, demand).",
469
- " wowok_buildin_info — Protocol constants, built-in permissions, bridge tokens, funding guidance.",
470
- " schema_query — Query JSON schemas for any sub-tool (action: list/get/get_output/search).",
471
- " bridge_operation — Cross-chain bridge between WOW and EVM (mainnet only).",
472
- " project_operation — Project entity management (SQLite) + 3-pathway graph + evaluation engine.",
473
- " config_operation — Runtime service toggles (confirm_gate, harness, etc.).",
474
- " trust_score — Service trust/risk assessment (0-100 score, 5 dimensions).",
475
- "",
476
- "SCHEMA-GATED EXECUTION:",
477
- " If your parameters don't match the sub-tool's schema, the response will include:",
478
- " result.status = \"schema_mismatch\"",
479
- " result.errors = specific validation errors (field path + expected type)",
480
- " result.hint = instructions to fix and retry",
481
- " schema.input = the correct JSON schema for the sub-tool",
482
- " schema.tool = which sub-tool this schema belongs to",
483
- " Read the schema, fix your params, and retry. This is normal — no need to call schema_query separately.",
484
- "",
485
- "SCHEMA CACHING:",
486
- " Each sub-tool has a DIFFERENT schema. When you receive a schema in a mismatch response:",
487
- " 1. Read the schema carefully",
488
- " 2. Fix your parameters",
489
- " 3. Retry the call",
490
- " 4. CACHE the schema in your context for future calls to the SAME sub-tool",
491
- " You should only need to see each sub-tool's schema once per conversation.",
492
- "",
493
- "PROJECT MANAGEMENT (SQLite-based):",
494
- " project_operation action='list_projects' → list all projects with object counts",
495
- " project_operation action='create_project' → create a new project (producer/consumer/both)",
496
- " project_operation action='get_project_detail' → full project info (objects, graph, evaluations, versions)",
497
- " project_operation action='build_graph' → build 3-pathway relationship graph",
498
- " project_operation action='evaluate_project' → rule-based (risk/trust/completeness) or LLM-assisted (value/worth_buying)",
499
- " project_operation action='assemble_context' → assemble semantic context for LLM consumption",
500
- "",
501
- "═══════════════════════════════════════════════════════════════",
502
- "PROJECT ASSOCIATION POLICY (context-aware, read before build/buy):",
503
- "═══════════════════════════════════════════════════════════════",
504
- "",
505
- "Projects are the core organizing unit for all WoWok workflows. The policy is context-aware:",
506
- "",
507
- "CASE 1 — COMPLEX REQUIREMENT (user wants to build/deploy a full service):",
508
- " Examples: 'build a travel guide service', 'open a toy store', 'create a rental service'",
509
- " → You MUST auto-create a project FIRST, then create objects.",
510
- " → Check for similar existing projects first: project_operation action='list_projects'",
511
- " If similar projects exist (same industry), remind the user: 'Found similar project X. Reuse or create new?'",
512
- " → Workflow:",
513
- " 1. project_operation action='create_project' (perspective='producer', project_industry=<best match>)",
514
- " 2. Create on-chain objects via onchain_operations with env.project='<prefix>' (auto-tags + auto-associates to SQLite project)",
515
- " 3. After EACH creation, objects are auto-added to the project (via env.project)",
516
- " 4. project_operation action='build_graph' — build 3-pathway relationship graph",
517
- " 5. project_operation action='evaluate_project' (completeness → R1-R12 check, then risk)",
518
- " 6. Report results, fix critical findings, then publish Service",
519
- "",
520
- "CASE 2 — SINGLE OBJECT CREATION (user wants one specific object):",
521
- " Examples: 'create a Permission', 'add a Contact', 'build a Guard'",
522
- " → Do NOT auto-create a project. If the user has an existing project, create with env.project='<prefix>' to auto-associate.",
523
- " → If no existing project, after creation, REMIND the user:",
524
- " 'This object has been created. Consider adding it to a project for management: project_operation action=\"add_object\"",
525
- " If no project exists yet, use action=\"create_project\" to create one. Existing projects: [list projects if any]'",
526
- " → If the user then says 'yes, create a project' or 'add to project X', proceed accordingly.",
527
- "",
528
- "CASE 3 — CONSUMER FLOW (user wants to buy/evaluate a service):",
529
- " → Suggest: project_operation action='create_project_from_onchain' (auto-discovers objects + graph)",
530
- " → Then: project_operation action='evaluate_project' (risk → trust → worth_buying)",
531
- " → Report findings, let user decide whether to proceed with onchain_operations service_buy",
532
- "",
533
- "CASE 4 — SIMPLE QUERY (user wants to check object info, balance, etc.):",
534
- " → No project needed. Proceed directly with the query.",
535
- "",
536
- "INDUSTRY MATCHING (for create_project project_industry param):",
537
- " travel → tour guides, transportation, accommodation, sightseeing",
538
- " retail → shops, e-commerce, physical goods",
539
- " service → professional services, consulting, design",
540
- " rental → equipment rental, property rental",
541
- " freelance → freelance work, gig economy",
542
- " education → courses, training, tutoring",
543
- " subscription → subscription services, memberships",
544
- " general → fallback for unclear industry",
545
- "═══════════════════════════════════════════════════════════════",
546
- ].join("\n");
547
- function formatZodErrors(error, input) {
548
- return error.issues.map(issue => {
549
- const path = issue.path.length > 0
550
- ? issue.path.map(p => typeof p === "number" ? `[${p}]` : p).join(".").replace(".[", "[")
551
- : "(root)";
552
- const code = issue.code;
553
- const message = issue.message;
554
- let extras = "";
555
- const issueAny = issue;
556
- if (code === "invalid_type") {
557
- const expected = issueAny.expected;
558
- const received = issueAny.received;
559
- if (typeof expected === "string" && typeof received === "string") {
560
- extras = ` (expected: ${expected}; received: ${received})`;
561
- }
562
- }
563
- else if (code === "invalid_literal" || code === "invalid_enum_value") {
564
- const expected = issueAny.expected;
565
- if (expected !== undefined) {
566
- const expStr = typeof expected === "string" ? expected : JSON.stringify(expected);
567
- extras = ` (expected: ${expStr.slice(0, 60)})`;
568
- }
569
- }
570
- else if (code === "too_big" || code === "too_small") {
571
- const maximum = issueAny.maximum ?? issueAny.minimum;
572
- const origin = issueAny.origin;
573
- if (maximum !== undefined && origin !== undefined) {
574
- extras = ` (${origin}: ${maximum})`;
575
- }
576
- }
577
- const receivedVal = extractValueAtPath(input, issue.path);
578
- if (receivedVal !== undefined) {
579
- const valStr = typeof receivedVal === "string"
580
- ? `"${receivedVal.slice(0, 60)}"`
581
- : typeof receivedVal === "object"
582
- ? JSON.stringify(receivedVal).slice(0, 60)
583
- : String(receivedVal);
584
- if (!extras.includes("received:")) {
585
- extras += ` (received value: ${valStr})`;
586
- }
587
- }
588
- return `${path} [${code}]: ${message}${extras}`;
589
- });
590
- }
591
- function generateSuggestion(code, issue, receivedValue) {
592
- const issueAny = issue;
593
- switch (code) {
594
- case "invalid_type": {
595
- const expected = issueAny.expected;
596
- const received = issueAny.received;
597
- if (expected === "number" && typeof receivedValue === "string") {
598
- return `Convert to number: ${Number(receivedValue)}`;
599
- }
600
- if (expected === "string") {
601
- return `Wrap in quotes or call String(...)`;
602
- }
603
- if (expected === "array") {
604
- return `Wrap in array: [${JSON.stringify(receivedValue)}]`;
605
- }
606
- if (expected === "object") {
607
- return `Provide an object, not a primitive`;
608
- }
609
- return `Convert value to ${expected ?? "the expected type"}`;
610
- }
611
- case "invalid_enum_value": {
612
- const options = issueAny.options;
613
- const optionsStr = Array.isArray(options)
614
- ? options.map((v) => JSON.stringify(v)).join(" | ")
615
- : String(options);
616
- return `Use one of: ${optionsStr}`;
617
- }
618
- case "invalid_literal": {
619
- const expected = issueAny.expected;
620
- return `Use the exact value: ${JSON.stringify(expected)}`;
621
- }
622
- case "too_small": {
623
- const minimum = issueAny.minimum;
624
- const type = issueAny.type;
625
- if (type === "array") {
626
- return `Add at least ${minimum} element(s) to the array`;
627
- }
628
- if (type === "string") {
629
- return `String must be at least ${minimum} character(s) long`;
630
- }
631
- if (type === "number") {
632
- return `Use a value >= ${minimum}`;
633
- }
634
- return `Value must be >= ${minimum}`;
635
- }
636
- case "too_big": {
637
- const maximum = issueAny.maximum;
638
- const type = issueAny.type;
639
- if (type === "array") {
640
- return `Reduce array to at most ${maximum} element(s)`;
641
- }
642
- if (type === "string") {
643
- return `Shorten string to at most ${maximum} character(s)`;
644
- }
645
- if (type === "number") {
646
- return `Use a value <= ${maximum}`;
647
- }
648
- return `Value must be <= ${maximum}`;
649
- }
650
- case "unrecognized_keys": {
651
- const keys = issueAny.keys;
652
- return `Remove unknown field(s): ${(keys ?? []).join(", ")}. Check the schema for valid field names.`;
653
- }
654
- case "invalid_union": {
655
- return `Value does not match any of the union variants. Check the schema for valid shapes.`;
656
- }
657
- case "invalid_string": {
658
- const validation = issueAny.validation;
659
- if (validation === "url")
660
- return `Provide a valid URL string`;
661
- if (validation === "email")
662
- return `Provide a valid email string`;
663
- if (validation === "uuid")
664
- return `Provide a valid UUID string`;
665
- if (validation === "regex")
666
- return `String does not match the required pattern`;
667
- return `Provide a valid string matching the validation: ${validation ?? "unknown"}`;
668
- }
669
- case "invalid_date": {
670
- return `Provide a valid Date object or ISO date string`;
671
- }
672
- case "not_finite": {
673
- return `Use a finite number (not Infinity or NaN)`;
674
- }
675
- case "invalid_arguments": {
676
- return `Arguments do not match the expected schema`;
677
- }
678
- case "invalid_return_type": {
679
- return `Return type does not match the expected schema`;
680
- }
681
- case "custom": {
682
- return `Custom validation failed — see the field's description in the schema`;
683
- }
684
- default: {
685
- return `Fix the value at '${issue.path.join(".")}' based on the schema`;
686
- }
687
- }
688
- }
689
- function formatZodErrorsStructured(error, input) {
690
- return error.issues.map(issue => {
691
- const path = issue.path.length > 0
692
- ? issue.path.map(p => typeof p === "number" ? `[${p}]` : p).join(".").replace(".[", "[")
693
- : "(root)";
694
- const code = issue.code;
695
- const message = issue.message;
696
- const issueAny = issue;
697
- let expected;
698
- if (code === "invalid_type") {
699
- const exp = issueAny.expected;
700
- const rec = issueAny.received;
701
- if (typeof exp === "string" && typeof rec === "string") {
702
- expected = exp;
703
- }
704
- }
705
- else if (code === "invalid_literal") {
706
- const exp = issueAny.expected;
707
- if (exp !== undefined) {
708
- expected = typeof exp === "string" ? exp : JSON.stringify(exp);
709
- }
710
- }
711
- else if (code === "invalid_enum_value") {
712
- const options = issueAny.options;
713
- if (Array.isArray(options)) {
714
- expected = options.map((v) => JSON.stringify(v)).join(" | ");
715
- }
716
- }
717
- else if (code === "too_big" || code === "too_small") {
718
- const threshold = issueAny.maximum ?? issueAny.minimum;
719
- if (threshold !== undefined) {
720
- expected = String(threshold);
721
- }
722
- }
723
- const receivedVal = extractValueAtPath(input, issue.path);
724
- const suggestion = generateSuggestion(code, issue, receivedVal);
725
- return {
726
- path,
727
- code,
728
- message,
729
- expected,
730
- received_value: receivedVal,
731
- suggestion,
732
- };
733
- });
734
- }
735
- function extractValueAtPath(input, path) {
736
- if (input === undefined || input === null || path.length === 0) {
737
- return undefined;
738
- }
739
- let current = input;
740
- for (const key of path) {
741
- if (current === undefined || current === null)
742
- return undefined;
743
- if (typeof key === "number") {
744
- if (!Array.isArray(current))
745
- return undefined;
746
- current = current[key];
747
- }
748
- else {
749
- if (typeof current !== "object")
750
- return undefined;
751
- current = current[key];
752
- }
753
- }
754
- return current;
755
- }
756
- function checkUnknownFields(schema, input) {
757
- let innerSchema = schema;
758
- while (true) {
759
- const def = innerSchema._def;
760
- if (!def || def.typeName !== "ZodEffects")
761
- break;
762
- innerSchema = def.schema ?? innerSchema;
763
- }
764
- const def = innerSchema._def;
765
- const shape = def?.shape?.();
766
- if (!shape || typeof input !== "object" || input === null)
767
- return [];
768
- const allowedFields = Object.keys(shape);
769
- const inputFields = Object.keys(input);
770
- return inputFields.filter(f => !allowedFields.includes(f));
771
- }
772
- function extractRelevantSchema(fullSchema, toolName, data) {
773
- if (toolName === "onchain_operations" && typeof data === "object" && data !== null) {
774
- const opType = data.operation_type;
775
- if (typeof opType === "string") {
776
- const subSchemaName = `onchain_operations_${opType}`;
777
- const subSchema = loadPreGeneratedSchema(subSchemaName);
778
- if (subSchema)
779
- return subSchema;
780
- }
781
- }
782
- return fullSchema;
783
- }
784
- function isSchemaValidationError(message) {
785
- return (message.startsWith("Unknown ") && message.includes("field") ||
786
- message.includes("expected") && message.includes("received") ||
787
- message.includes("Invalid input") ||
788
- message.includes("Required"));
789
- }
790
- function buildSchemaPreview(schema, toolName, data) {
791
- try {
792
- const lines = [`Schema preview for ${toolName}:`];
793
- let topProps;
794
- let topRequired = [];
795
- let topDescription = "";
796
- if (schema.properties && typeof schema.properties === "object") {
797
- topProps = schema.properties;
798
- topRequired = Array.isArray(schema.required) ? schema.required : [];
799
- topDescription = typeof schema.description === "string" ? schema.description : "";
800
- }
801
- else if (Array.isArray(schema.oneOf) || Array.isArray(schema.anyOf)) {
802
- const variants = (schema.oneOf ?? schema.anyOf);
803
- for (const v of variants) {
804
- if (v && typeof v === "object") {
805
- const vo = v;
806
- if (vo.properties && typeof vo.properties === "object") {
807
- topProps = vo.properties;
808
- topRequired = Array.isArray(vo.required) ? vo.required : [];
809
- topDescription = typeof vo.description === "string" ? vo.description : "";
810
- break;
811
- }
812
- }
813
- }
814
- if (!topProps) {
815
- lines.push(` (discriminated union with ${variants.length} variants — see structuredContent for full schema)`);
816
- return lines.join("\n");
817
- }
818
- }
819
- if (topDescription && topDescription.length > 0 && topDescription.length < 200) {
820
- lines.push(` ${topDescription}`);
821
- }
822
- if (!topProps) {
823
- lines.push(" (no properties available — see structuredContent for full schema)");
824
- return lines.join("\n");
825
- }
826
- const requiredSet = new Set(topRequired);
827
- const requiredList = topRequired.length > 0 ? topRequired.join(", ") : "(none)";
828
- const optionalList = Object.keys(topProps).filter(k => !requiredSet.has(k)).join(", ");
829
- lines.push(`Required: ${requiredList}`);
830
- if (optionalList) {
831
- lines.push(`Optional: ${optionalList}`);
832
- }
833
- lines.push("Fields:");
834
- for (const [fieldName, fieldSchema] of Object.entries(topProps)) {
835
- if (fieldSchema && typeof fieldSchema === "object") {
836
- const f = fieldSchema;
837
- const type = describeSchemaType(f);
838
- const required = requiredSet.has(fieldName) ? "required" : "optional";
839
- let desc = typeof f.description === "string" ? f.description : "";
840
- if (desc.length > 120)
841
- desc = desc.slice(0, 117) + "...";
842
- let subFields = "";
843
- if (f.properties && typeof f.properties === "object") {
844
- const subProps = Object.keys(f.properties);
845
- if (subProps.length > 0) {
846
- subFields = ` { ${subProps.slice(0, 8).join(", ")}${subProps.length > 8 ? ", ..." : ""} }`;
847
- }
848
- }
849
- if (f.items && typeof f.items === "object") {
850
- const items = f.items;
851
- const itemType = describeSchemaType(items);
852
- subFields = ` (array of ${itemType})`;
853
- }
854
- if (Array.isArray(f.enum)) {
855
- subFields = ` (enum: ${f.enum.slice(0, 6).map(v => JSON.stringify(v)).join(", ")}${f.enum.length > 6 ? ", ..." : ""})`;
856
- }
857
- lines.push(` - ${fieldName} (${type}, ${required})${subFields}${desc ? ` — ${desc}` : ""}`);
858
- }
859
- }
860
- if (toolName === "onchain_operations" && typeof data === "object" && data !== null) {
861
- const opType = data.operation_type;
862
- if (typeof opType === "string") {
863
- lines.push(``);
864
- lines.push(`operation_type-specific schema: onchain_operations_${opType}`);
865
- lines.push(`(Use schema_query with action='get' and name='onchain_operations_${opType}' for the full sub-schema.)`);
866
- }
867
- }
868
- return lines.join("\n");
869
- }
870
- catch {
871
- return `Schema preview for ${toolName}: (unable to build preview — see structuredContent for full schema)`;
872
- }
873
- }
874
- function describeSchemaType(schema) {
875
- if (typeof schema.type === "string")
876
- return schema.type;
877
- if (Array.isArray(schema.type))
878
- return schema.type.join("|");
879
- if (schema.$ref)
880
- return "$ref";
881
- if (Array.isArray(schema.oneOf))
882
- return "oneOf";
883
- if (Array.isArray(schema.anyOf))
884
- return "anyOf";
885
- if (Array.isArray(schema.allOf))
886
- return "allOf";
887
- if (schema.enum)
888
- return "enum";
889
- if (schema.const)
890
- return `const(${JSON.stringify(schema.const)})`;
891
- return "object";
892
- }
893
- export async function dispatchToolCall(name, args, options) {
894
- if (name === "wowok") {
895
- return handleWowok(args);
896
- }
897
- const entry = TOOL_REGISTRY_MAP.get(name);
898
- if (!entry) {
899
- throw new Error(`Unknown tool: ${name}. Available: ${TOOL_REGISTRY.map(t => t.name).join(", ")}`);
900
- }
901
- if (entry.applyRules && !options?.skipRules) {
902
- const ruleResult = entry.applyRules(args);
903
- if (ruleResult)
904
- return ruleResult;
905
- }
906
- const harnessWrapped = dispatchWithHarness(entry.handler, name);
907
- const timeoutMs = entry.timeoutMs ?? 60000;
908
- const wrapped = wrapHandlerWithErrorShape(harnessWrapped, timeoutMs, name, entry.errorShapeBuilder);
909
- return wrapped(args);
910
- }
911
- const TOOL_FIELD_ALIASES = ["tool", "tool_name", "name"];
912
- const DATA_FIELD_ALIASES = ["data", "args", "params", "parameters"];
913
- const RESERVED_FIELD_NAMES = new Set([
914
- ...TOOL_FIELD_ALIASES,
915
- ...DATA_FIELD_ALIASES,
916
- ]);
917
- function normalizeInput(args) {
918
- const notes = [];
919
- if (!args || typeof args !== "object" || Array.isArray(args)) {
920
- return { tool: undefined, data: {}, normalizationNotes: ["input is not an object"] };
921
- }
922
- const obj = args;
923
- let tool;
924
- for (const alias of TOOL_FIELD_ALIASES) {
925
- if (typeof obj[alias] === "string" && obj[alias]) {
926
- tool = obj[alias];
927
- if (alias !== "tool") {
928
- notes.push(`normalized '${alias}' → 'tool'`);
929
- }
930
- break;
931
- }
932
- }
933
- let data;
934
- for (const alias of DATA_FIELD_ALIASES) {
935
- const v = obj[alias];
936
- if (v !== undefined && v !== null && typeof v === "object" && !Array.isArray(v)) {
937
- data = v;
938
- if (alias !== "data") {
939
- notes.push(`normalized '${alias}' → 'data'`);
940
- }
941
- break;
942
- }
943
- }
944
- if (!data) {
945
- const inlineParams = {};
946
- let hasInline = false;
947
- for (const key of Object.keys(obj)) {
948
- if (!RESERVED_FIELD_NAMES.has(key)) {
949
- inlineParams[key] = obj[key];
950
- hasInline = true;
951
- }
952
- }
953
- if (hasInline) {
954
- data = inlineParams;
955
- notes.push("extracted inline params → 'data' (no data wrapper was provided)");
956
- }
957
- else {
958
- data = {};
959
- }
960
- }
961
- return { tool, data, normalizationNotes: notes };
962
- }
963
- async function handleWowok(args) {
964
- const { tool: normalizedToolName, data: normalizedData, normalizationNotes } = normalizeInput(args);
965
- if (!normalizedToolName) {
966
- const receivedKeys = (args && typeof args === "object" && !Array.isArray(args))
967
- ? Object.keys(args).join(", ") || "(none)"
968
- : `(non-object input: ${typeof args})`;
969
- const errors = [
970
- `Missing 'tool' field. Received keys: ${receivedKeys}`,
971
- `Expected one of: ${SUB_TOOL_NAMES.join(", ")}`,
972
- ];
973
- return {
974
- content: [{
975
- type: "text",
976
- text: `Missing 'tool' field. Call format: wowok({ tool: "<sub-tool>", data: {<params>} }). Received keys: ${receivedKeys}. Available sub-tools: ${SUB_TOOL_NAMES.join(", ")}`,
977
- }],
978
- structuredContent: {
979
- result: {
980
- status: "schema_mismatch",
981
- errors,
982
- hint: `Provide 'tool' (one of: ${SUB_TOOL_NAMES.join(", ")}) and 'data' (sub-tool parameters). Aliases accepted: tool_name/name→tool, args/params→data.`,
983
- received: args,
984
- },
985
- schema: {
986
- input: zodToJsonSchemaSafe(WowokToolDisplaySchema, "wowok"),
987
- tool: "wowok",
988
- },
989
- },
990
- };
991
- }
992
- const entry = TOOL_REGISTRY_MAP.get(normalizedToolName);
993
- if (!entry) {
994
- const suggestions = TOOL_REGISTRY
995
- .map(t => t.name)
996
- .filter(name => name.includes(normalizedToolName) || normalizedToolName.includes(name))
997
- .slice(0, 5);
998
- return {
999
- content: [{
1000
- type: "text",
1001
- text: `Unknown sub-tool: '${normalizedToolName}'. Available: ${TOOL_REGISTRY.map(t => t.name).join(", ")}${suggestions.length > 0 ? `. Did you mean: ${suggestions.join(", ")}?` : ""}`,
1002
- }],
1003
- structuredContent: {
1004
- result: {
1005
- status: "error",
1006
- errors: [`Unknown sub-tool: ${normalizedToolName}`],
1007
- hint: `Available sub-tools: ${TOOL_REGISTRY.map(t => t.name).join(", ")}${suggestions.length > 0 ? `. Did you mean: ${suggestions.join(", ")}?` : ""}`,
1008
- suggestions,
1009
- },
1010
- schema: null,
1011
- },
1012
- };
1013
- }
1014
- if (normalizationNotes.length > 0) {
1015
- console.warn(`[wowok] input normalization for '${normalizedToolName}': ${normalizationNotes.join("; ")}`);
1016
- }
1017
- const validationResult = entry.config.inputSchema.safeParse(normalizedData);
1018
- const unknownFields = checkUnknownFields(entry.config.inputSchema, normalizedData);
1019
- if (!validationResult.success || unknownFields.length > 0) {
1020
- const allErrors = [];
1021
- if (!validationResult.success) {
1022
- allErrors.push(...formatZodErrors(validationResult.error, normalizedData));
1023
- }
1024
- if (unknownFields.length > 0) {
1025
- allErrors.push(`Unknown field(s): ${unknownFields.join(", ")}`);
1026
- }
1027
- const structuredErrors = [];
1028
- if (!validationResult.success) {
1029
- structuredErrors.push(...formatZodErrorsStructured(validationResult.error, normalizedData));
1030
- }
1031
- if (unknownFields.length > 0) {
1032
- for (const f of unknownFields) {
1033
- structuredErrors.push({
1034
- path: f,
1035
- code: "unrecognized_keys",
1036
- message: `Unknown field '${f}' is not allowed`,
1037
- suggestion: `Remove field '${f}' or check the schema for valid field names`,
1038
- });
1039
- }
1040
- }
1041
- const fullSchema = loadPreGeneratedSchema(normalizedToolName) ?? zodToJsonSchemaSafe(entry.config.inputSchema, normalizedToolName);
1042
- const relevantSchema = extractRelevantSchema(fullSchema, normalizedToolName, normalizedData);
1043
- const firstSuggestion = structuredErrors[0]?.suggestion
1044
- ? ` FIRST ERROR SUGGESTION: ${structuredErrors[0].suggestion}`
1045
- : '';
1046
- const errorPreview = allErrors.slice(0, 5).map((e, i) => ` ${i + 1}. ${e}`).join("\n");
1047
- const schemaPreview = buildSchemaPreview(relevantSchema, normalizedToolName, normalizedData);
1048
- const textContent = [
1049
- `Schema mismatch for ${normalizedToolName}. ${allErrors.length} error(s).${firstSuggestion}`,
1050
- errorPreview,
1051
- "",
1052
- schemaPreview,
1053
- "",
1054
- "Fix the parameters based on the errors above and the schema summary, then retry.",
1055
- `Full JSON Schema is in the structuredContent.schema.input field (cache it for future ${normalizedToolName} calls).`,
1056
- `Structured errors with fix suggestions are in structuredContent.result.structured_errors (ARCH-02).`,
1057
- ].filter(Boolean).join("\n");
1058
- return {
1059
- content: [{
1060
- type: "text",
1061
- text: textContent,
1062
- }],
1063
- structuredContent: {
1064
- result: {
1065
- status: "schema_mismatch",
1066
- errors: allErrors,
1067
- structured_errors: structuredErrors,
1068
- hint: `Fix your parameters based on the schema below and retry. CACHE THIS SCHEMA for future ${normalizedToolName} calls — you don't need to query it again.`,
1069
- },
1070
- schema: {
1071
- input: relevantSchema,
1072
- tool: normalizedToolName,
1073
- },
1074
- },
1075
- };
1076
- }
1077
- try {
1078
- const subResult = await dispatchToolCall(normalizedToolName, normalizedData);
1079
- const sc = subResult.structuredContent;
1080
- const resultField = sc?.result;
1081
- const isErrorResponse = resultField?.status === "error" || resultField?.operation === "error";
1082
- if (isErrorResponse) {
1083
- return {
1084
- content: subResult.content,
1085
- structuredContent: {
1086
- result: {
1087
- status: "error",
1088
- data: subResult.structuredContent,
1089
- errors: [subResult.content[0]?.text ?? "Sub-tool returned an error"],
1090
- },
1091
- schema: null,
1092
- },
1093
- };
1094
- }
1095
- return {
1096
- content: subResult.content,
1097
- structuredContent: {
1098
- result: {
1099
- status: "success",
1100
- data: subResult.structuredContent,
1101
- },
1102
- schema: null,
1103
- },
1104
- };
1105
- }
1106
- catch (error) {
1107
- const errorMessage = error instanceof Error ? error.message : String(error);
1108
- if (isSchemaValidationError(errorMessage)) {
1109
- const fullSchema = loadPreGeneratedSchema(normalizedToolName) ?? zodToJsonSchemaSafe(entry.config.inputSchema, normalizedToolName);
1110
- const relevantSchema = extractRelevantSchema(fullSchema, normalizedToolName, normalizedData);
1111
- const schemaPreview = buildSchemaPreview(relevantSchema, normalizedToolName, normalizedData);
1112
- const structuredErrors = [{
1113
- path: "(runtime)",
1114
- code: "schema_validation_error",
1115
- message: errorMessage,
1116
- suggestion: "Check the error message and the schema below for the correct field format",
1117
- }];
1118
- const textContent = [
1119
- `Schema mismatch for ${normalizedToolName}: ${errorMessage}`,
1120
- "",
1121
- schemaPreview,
1122
- "",
1123
- "Fix the parameters and retry. Full JSON Schema is in structuredContent.schema.input.",
1124
- "Structured errors with fix suggestions are in structuredContent.result.structured_errors (ARCH-02).",
1125
- ].join("\n");
1126
- return {
1127
- content: [{
1128
- type: "text",
1129
- text: textContent,
1130
- }],
1131
- structuredContent: {
1132
- result: {
1133
- status: "schema_mismatch",
1134
- errors: [errorMessage],
1135
- structured_errors: structuredErrors,
1136
- hint: `Fix your parameters based on the schema below and retry. CACHE THIS SCHEMA for future ${normalizedToolName} calls.`,
1137
- },
1138
- schema: {
1139
- input: relevantSchema,
1140
- tool: normalizedToolName,
1141
- },
1142
- },
1143
- };
1144
- }
1145
- return {
1146
- content: [{ type: "text", text: `Error: ${errorMessage}` }],
1147
- structuredContent: {
1148
- result: {
1149
- status: "error",
1150
- errors: [errorMessage],
1151
- },
1152
- schema: null,
1153
- },
1154
- };
1155
- }
1156
- }
1157
- function zodToJsonSchemaSafe(schema, name) {
1158
- try {
1159
- const jsonSchema = zodToJsonSchema(schema, {
1160
- name,
1161
- $refStrategy: "root",
1162
- basePath: ["#"],
1163
- effectStrategy: "input",
1164
- });
1165
- if (jsonSchema && typeof jsonSchema === "object" && !Array.isArray(jsonSchema)) {
1166
- const { $schema: _omit, ...rest } = jsonSchema;
1167
- return rest;
1168
- }
1169
- return { type: "object" };
1170
- }
1171
- catch {
1172
- return { type: "object", additionalProperties: true };
1173
- }
1174
- }
1175
- function resolveSchemaRefs(schema) {
1176
- const STRIP_KEYS = new Set(["definitions", "$schema", "$id"]);
1177
- function navigatePointer(path) {
1178
- if (!path.startsWith("#/"))
1179
- return null;
1180
- const parts = path.slice(2).split("/");
1181
- let target = schema;
1182
- for (const part of parts) {
1183
- if (target == null || typeof target !== "object") {
1184
- return null;
1185
- }
1186
- target = target[part];
1187
- }
1188
- return target;
1189
- }
1190
- function resolveNode(node, visiting) {
1191
- if (!node || typeof node !== "object") {
1192
- return node;
1193
- }
1194
- if (Array.isArray(node)) {
1195
- return node.map((item) => resolveNode(item, visiting));
1196
- }
1197
- const obj = node;
1198
- if (typeof obj.$ref === "string") {
1199
- const ref = obj.$ref;
1200
- if (visiting.has(ref)) {
1201
- return { type: "object", additionalProperties: true };
1202
- }
1203
- const target = navigatePointer(ref);
1204
- if (target && typeof target === "object" && !Array.isArray(target)) {
1205
- const newVisiting = new Set(visiting);
1206
- newVisiting.add(ref);
1207
- const resolved = resolveNode(target, newVisiting);
1208
- const siblings = {};
1209
- for (const [k, v] of Object.entries(obj)) {
1210
- if (k !== "$ref" && !STRIP_KEYS.has(k))
1211
- siblings[k] = v;
1212
- }
1213
- return {
1214
- ...resolved,
1215
- ...siblings,
1216
- };
1217
- }
1218
- return { type: "object", additionalProperties: true };
1219
- }
1220
- const result = {};
1221
- for (const [k, v] of Object.entries(obj)) {
1222
- if (STRIP_KEYS.has(k))
1223
- continue;
1224
- result[k] = resolveNode(v, visiting);
1225
- }
1226
- return result;
1227
- }
1228
- return resolveNode(schema, new Set());
1229
- }
1230
- function loadPreGeneratedSchema(toolName) {
1231
- const cached = preGeneratedSchemaCache.get(toolName);
1232
- if (cached)
1233
- return cached;
1234
- for (const dir of SCHEMA_DIR_CANDIDATES) {
1235
- try {
1236
- const schemaPath = join(dir, `${toolName}.schema.json`);
1237
- const raw = readFileSync(schemaPath, "utf-8");
1238
- const schema = JSON.parse(raw);
1239
- const resolved = resolveSchemaRefs(schema);
1240
- preGeneratedSchemaCache.set(toolName, resolved);
1241
- return resolved;
1242
- }
1243
- catch {
1244
- }
1245
- }
1246
- return null;
1247
- }
1248
- const preGeneratedOutputSchemaCache = new Map();
1249
- function loadPreGeneratedOutputSchema(toolName) {
1250
- const cached = preGeneratedOutputSchemaCache.get(toolName);
1251
- if (cached)
1252
- return cached;
1253
- for (const dir of SCHEMA_DIR_CANDIDATES) {
1254
- try {
1255
- const schemaPath = join(dir, `${toolName}.output.json`);
1256
- const raw = readFileSync(schemaPath, "utf-8");
1257
- const schema = JSON.parse(raw);
1258
- const resolved = resolveSchemaRefs(schema);
1259
- preGeneratedOutputSchemaCache.set(toolName, resolved);
1260
- return resolved;
1261
- }
1262
- catch {
1263
- }
1264
- }
1265
- return null;
1266
- }
1267
- export function listTools() {
1268
- return [{
1269
- name: "wowok",
1270
- title: "WoWok MCP",
1271
- description: WOWOK_TOOL_DESCRIPTION,
1272
- inputSchema: resolveSchemaRefs(zodToJsonSchemaSafe(WowokToolDisplaySchema, "wowok")),
1273
- }];
1274
- }
1275
- export function registerAllTools(server) {
1276
- const timeoutMs = 120000;
1277
- const wrapped = wrapHandlerWithErrorShape(handleWowok, timeoutMs, "wowok", undefined);
1278
- server.registerTool("wowok", {
1279
- title: "WoWok MCP",
1280
- description: WOWOK_TOOL_DESCRIPTION,
1281
- inputSchema: WowokToolRuntimeSchema,
1282
- annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: true },
1283
- }, withTelemetry("wowok", wrapped));
1284
- overrideToolsListHandler(server);
1285
- }
1286
- function overrideToolsListHandler(server) {
1287
- server.server.setRequestHandler(ListToolsRequestSchema, () => ({
1288
- tools: [{
1289
- name: "wowok",
1290
- title: "WoWok MCP",
1291
- description: WOWOK_TOOL_DESCRIPTION,
1292
- inputSchema: ensureObjectType(zodToJsonSchemaSafe(WowokToolDisplaySchema, "wowok")),
1293
- annotations: {
1294
- readOnlyHint: false,
1295
- destructiveHint: true,
1296
- idempotentHint: false,
1297
- openWorldHint: true,
1298
- },
1299
- }],
1300
- }));
1301
- }
1302
- function ensureObjectType(schema) {
1303
- if (schema.type === "object")
1304
- return schema;
1305
- return { ...schema, type: "object" };
1306
- }
1
+ import{z}from'zod';import{zodToJsonSchema}from'zod-to-json-schema';import{readFileSync}from'fs';import{fileURLToPath}from'url';import{dirname,join}from'path';import{ListToolsRequestSchema}from'@modelcontextprotocol/sdk/types.js';const __filename=fileURLToPath(import.meta.url),__dirname=dirname(__filename),SCHEMA_DIR_CANDIDATES=[join(__dirname,'..','schemas'),join(__dirname,'..','..','dist','schemas')],preGeneratedSchemaCache=new Map();import{wrapHandlerWithErrorShape,statusErrorShape,operationErrorShape,strictStatusErrorShape,dispatchWithHarness}from'./wrap.js';import{withTelemetry}from'../telemetry/index.js';import{handleOnchainOperations}from'./handlers/onchain.js';import{handleAccountOperation,handleMarkOperation,handleInfoOperation}from'./handlers/local.js';import{handleWipOperations}from'./handlers/wip.js';import{handleMessengerOperation}from'./handlers/messenger.js';import{handleGuard2File,handleMachineNode2File}from'./handlers/file-export.js';import{handleWatchQueryOperations,handleOnchainTableData,handleOnchainEvents,handleWowokInfo}from'./handlers/query.js';import{handleSchemaQuery}from'./handlers/schema-query.js';import{handleBridgeOperations}from'./handlers/bridge.js';import{handleProjectOperation}from'./handlers/project.js';import{handleConfigOperation}from'./handlers/config.js';import{handleTrustScore}from'./handlers/trust.js';import{handleEvaluationOperation}from'./handlers/evaluation.js';import{handlePersonaOperation}from'./handlers/persona.js';import{handleIntentRadar}from'./handlers/intent-radar.js';import{handleQueryTaskStatus}from'./handlers/task-status.js';import{applyOnchainRules}from'./rules-hook.js';import{createToolMeta,OnchainOperationsSchema,AccountOperationSchema,LocalMarkOperationSchema,LocalInfoOperationSchema,WipOperationsSchema,MessengerOperationInputSchema,Guard2File_InputSchema,MachineNode2File_InputSchema,WatchQueryOperationsSchema,WatchQueryOperationsResultSchema,OnchainTableDataSchema,OnchainEventsInputSchema,ProtocolInfoQuerySchema,SchemaQueryInputSchema,BridgeOperationsSchema,ProjectOperationInputSchema,ConfigOperationInputSchema,TrustScoreInputSchema,CallOutputSchema,AccountOperationOutputWrappedSchema,LocalMarkOperationOutputWrappedSchema,LocalInfoOperationOutputWrappedSchema,WipOperationOutputSchema,MessengerOperationOutputSchema,Guard2File_OutputWrappedSchema,MachineNode2File_OutputWrappedSchema,OnchainTableDataResultSchema,OnchainEventsResultSchema,ProtocolInfoResultSchema,SchemaQueryOutputSchema,BridgeCallOutputSchema,ProjectOperationOutputSchema,ConfigOperationOutputSchema,TrustScoreOutputSchema,EvaluationOperationInputSchema,EvaluationOperationOutputSchema,PersonaOperationInputSchema,PersonaOperationOutputSchema,IntentRadarInputSchema,IntentRadarOutputSchema,QueryTaskStatusInputSchema,QueryTaskStatusOutputSchema}from'../schema/index.js';export const TOOL_REGISTRY=[{'name':'onchain_operations','handler':handleOnchainOperations,'config':{'title':'⛓️\x20On-chain\x20Operations','description':'On-chain\x20operations\x20for\x20WoWok\x20object:\x20service\x20(marketplace\x20listings),\x20machine\x20(workflow\x20templates),\x20progress\x20(order\x20tracking),\x20repository\x20(on-chain\x20database),\x20arbitration\x20(dispute\x20resolution),\x20contact\x20(IM\x20management),\x20treasury\x20(team\x20funds),\x20reward\x20(incentive\x20pools),\x20allocation\x20(auto-distribution),\x20permission\x20(access\x20control),\x20guard\x20(programmable\x20trust\x20rules),\x20personal\x20(public\x20profile),\x20payment\x20(direct\x20coin\x20transfers),\x20demand\x20(service\x20requests),\x20order\x20(order\x20management),\x20gen_passport\x20(verified\x20credentials),\x20proof\x20(on-chain\x20proof\x20objects),\x20gen_proof\x20(generate\x20proof\x20shortcut).\x0a\x0a💰\x20FUND\x20SAFETY\x20(service/arbitration/treasury/reward/allocation/payment):\x20amounts\x20are\x20parsed\x20against\x20the\x20target\x20object\x27s\x20IMMUTABLE\x20generic\x20token\x20type\x20(e.g.\x20Treasury<USDT>\x20accepts\x20ONLY\x20USDT\x20—\x20mismatched\x20coins/token_types\x20are\x20BLOCKED\x20before\x20execution).\x20Monetary\x20input\x20with\x20unresolvable\x20token\x20precision\x20is\x20BLOCKED\x20(never\x20guesses\x20decimals)\x20with\x20known-token\x20suggestions;\x20retry\x20once\x20the\x20token\x20info\x20resolves.\x20Display-format\x20amounts\x20like\x20\x222WOW\x22\x20are\x20converted\x20to\x20raw\x20u64\x20using\x20the\x20token\x27s\x20own\x20decimals.\x0a\x0a📌\x20Project\x20association:\x20Pass\x20env.project=\x27<prefix>\x27\x20to\x20auto-tag\x20the\x20object\x20on-chain\x20AND\x20auto-associate\x20it\x20to\x20the\x20SQLite\x20project\x20(created\x20objects\x20are\x20automatically\x20added).\x20For\x20complex\x20builds,\x20create\x20a\x20project\x20first\x20(project_operation\x20action=\x27create_project\x27).\x20For\x20single\x20objects,\x20just\x20pass\x20env.project.\x20See\x20PROJECT\x20ASSOCIATION\x20POLICY\x20in\x20system\x20prompt.\x0a\x0a💡\x20Schema\x20hint:\x20Use\x20schema_query\x20with\x20action=\x27get\x27\x20and\x20name=\x27onchain_operations\x27\x20to\x20retrieve\x20the\x20complete\x20parameter\x20schema.\x20For\x20individual\x20operation\x20schemas\x20(e.g.,\x20\x27onchain_operations_permission\x27),\x20use\x20schema_query\x20with\x20action=\x27list_operations\x27\x20to\x20see\x20all\x20available\x20operation\x20schemas.','inputSchema':OnchainOperationsSchema,'outputSchema':CallOutputSchema,'annotations':{'readOnlyHint':![],'destructiveHint':!![],'idempotentHint':![],'openWorldHint':!![]},'_meta':createToolMeta('operation',['service','machine','progress','repository','arbitration','contact','treasury','reward','allocation','permission','guard','personal','payment','demand','order','gen_passport','proof','gen_proof','on-chain','blockchain'])},'applyRules':applyOnchainRules},{'name':'account_operation','handler':handleAccountOperation,'config':{'title':'🔒\x20LOCAL\x20ONLY:\x20Account\x20-\x20Wallet\x20Management','description':'🔒\x20100%\x20LOCAL,\x20NEVER\x20ON-CHAIN\x20🔒\x20Manage\x20WoWok\x20accounts\x20locally\x20on\x20device:\x20generate,\x20suspend,\x20resume,\x20faucet-test,\x20operate\x20assets,\x20sign\x20data,\x20etc.\x0a\x0a💡\x20Schema\x20hint:\x20Use\x20schema_query\x20with\x20action=\x27get\x27\x20and\x20name=\x27account_operation\x27\x20to\x20retrieve\x20the\x20exact\x20parameter\x20schema\x20before\x20calling.','inputSchema':AccountOperationSchema,'outputSchema':AccountOperationOutputWrappedSchema,'annotations':{'readOnlyHint':![],'destructiveHint':!![],'idempotentHint':!![],'openWorldHint':![]},'_meta':createToolMeta('operation',['account','local','private','wallet','off-chain'])},'errorShapeBuilder':statusErrorShape},{'name':'local_mark_operation','handler':handleMarkOperation,'config':{'title':'🔒\x20LOCAL\x20ONLY:\x20LocalMark\x20-\x20Address\x20Book\x20Management','description':'100%\x20LOCAL,\x20NEVER\x20ON-CHAIN\x20🔒\x20Manage\x20ID\x20names\x20and\x20tags\x20stored\x20ONLY\x20on\x20your\x20local\x20device\x20for\x20easy\x20identification\x20of\x20user\x20address\x20or\x20object\x20IDs\x20by\x20name.\x0a\x0a💡\x20Schema\x20hint:\x20Use\x20schema_query\x20with\x20action=\x27get\x27\x20and\x20name=\x27local_mark_operation\x27\x20to\x20retrieve\x20the\x20exact\x20parameter\x20schema\x20before\x20calling.','inputSchema':LocalMarkOperationSchema,'outputSchema':LocalMarkOperationOutputWrappedSchema,'annotations':{'readOnlyHint':![],'destructiveHint':!![],'idempotentHint':!![],'openWorldHint':![]},'_meta':createToolMeta('operation',['mark','local','private','address-book','off-chain'])},'errorShapeBuilder':statusErrorShape},{'name':'local_info_operation','handler':handleInfoOperation,'config':{'title':'🔒\x20LOCAL\x20ONLY:\x20LocalInfo\x20-\x20Private\x20Data\x20Management','description':'100%\x20LOCAL,\x20NEVER\x20ON-CHAIN\x20🔒\x20Manage\x20sensitive\x20personal\x20information\x20stored\x20ONLY\x20on\x20your\x20device:\x20delivery\x20addresses,\x20phone\x20numbers,\x20contacts.\x0a\x0a💡\x20Schema\x20hint:\x20Use\x20schema_query\x20with\x20action=\x27get\x27\x20and\x20name=\x27local_info_operation\x27\x20to\x20retrieve\x20the\x20exact\x20parameter\x20schema\x20before\x20calling.','inputSchema':LocalInfoOperationSchema,'outputSchema':LocalInfoOperationOutputWrappedSchema,'annotations':{'readOnlyHint':![],'destructiveHint':!![],'idempotentHint':!![],'openWorldHint':![]},'_meta':createToolMeta('operation',['info','local','private','data-management','off-chain'])},'errorShapeBuilder':statusErrorShape},{'name':'wip_file','handler':handleWipOperations,'config':{'title':'🤝\x20Witness\x20Immutable\x20Promise\x20File\x20Operations','description':'generate\x20(create\x20WIP\x20files\x20from\x20markdown\x20and\x20images),\x20verify\x20(integrity\x20check),\x20sign\x20(add\x20signatures),\x20or\x20wip2html\x20(convert\x20to\x20HTML).\x0a\x0a⚠️\x20IMPORTANT\x20—\x20On-chain\x20WIP\x20URL\x20requirement:\x20When\x20using\x20a\x20WIP\x20file\x20URL\x20in\x20`service.sales[].wip`\x20(stored\x20on-chain),\x20the\x20URL\x20MUST\x20be\x20publicly\x20reachable.\x20Local\x20file\x20paths\x20(e.g.,\x20\x27C:\x5c\x5cpath\x5c\x5cfile.wip\x27\x20or\x20\x27/home/user/file.wip\x27)\x20are\x20NOT\x20acceptable\x20on-chain\x20—\x20they\x20only\x20work\x20locally\x20and\x20will\x20fail\x20verification\x20for\x20buyers.\x0a\x0aDeployment\x20options\x20for\x20the\x20.wip\x20file:\x0a\x20\x20•\x20GitHub\x20Pages:\x20https://raw.githubusercontent.com/<user>/<repo>/<branch>/<file>.wip\x0a\x20\x20•\x20IPFS:\x20https://ipfs.io/ipfs/<CID>\x20or\x20https://cloudflare-ipfs.com/ipfs/<CID>\x20(upload\x20via\x20pinata.cloud)\x0a\x20\x20•\x20User\x27s\x20own\x20static\x20website\x20URL\x0a\x0aUse\x20type=\x27generate\x27\x20to\x20create\x20the\x20WIP\x20file\x20first,\x20upload\x20it\x20to\x20any\x20of\x20the\x20above,\x20then\x20use\x20the\x20resulting\x20URL\x20in\x20service.sales[].wip.\x0a\x0a💡\x20Schema\x20hint:\x20Use\x20schema_query\x20with\x20action=\x27get\x27\x20and\x20name=\x27wip_file\x27\x20to\x20retrieve\x20the\x20exact\x20parameter\x20schema\x20before\x20calling.','inputSchema':WipOperationsSchema,'outputSchema':z['object']({'result':WipOperationOutputSchema}),'annotations':{'readOnlyHint':![],'destructiveHint':![],'idempotentHint':![],'openWorldHint':![]},'_meta':createToolMeta('operation',['wip','promise','file-generation','verification','signature','local'])}},{'name':'messenger_operation','handler':handleMessengerOperation,'config':{'title':'💬\x20Messenger\x20Operations','description':'WoWok\x20encrypted\x20messenger\x20operations:\x20watch\x20conversations\x20(with\x20unread\x20filtering,\x20preview\x20messages),\x20send\x20message,\x20send\x20file,\x20watch\x20messages\x20(with\x20viewed\x20status\x20filtering),\x20extract\x20zip\x20messages,\x20generate\x20WTS,\x20verify\x20WTS,\x20sign\x20WTS,\x20WTS\x20to\x20HTML,\x20proof\x20message\x20on-chain,\x20manage\x20blacklist,\x20friendslist,\x20guardlist,\x20settings,\x20mark\x20messages\x20as\x20viewed,\x20mark\x20conversation\x20as\x20viewed,\x20and\x20pull\x20messages\x20from\x20server.\x0a\x0a💡\x20Schema\x20hint:\x20Use\x20schema_query\x20with\x20action=\x27get\x27\x20and\x20name=\x27messenger_operation\x27\x20to\x20retrieve\x20the\x20exact\x20parameter\x20schema\x20before\x20calling.','inputSchema':MessengerOperationInputSchema,'outputSchema':MessengerOperationOutputSchema,'annotations':{'readOnlyHint':![],'destructiveHint':!![],'idempotentHint':![],'openWorldHint':!![]},'_meta':createToolMeta('operation',['messenger','message','file','wts','blacklist','friendslist','guardlist','settings','proof','communication'])},'errorShapeBuilder':operationErrorShape,'timeoutMs':0x7530},{'name':'guard2file','handler':handleGuard2File,'config':{'title':'📄\x20Guard\x20to\x20File\x20-\x20Export\x20Guard\x20Definition','description':'Export\x20a\x20Guard\x20object\x27s\x20definition\x20from\x20the\x20blockchain\x20to\x20a\x20local\x20JSON\x20or\x20Markdown\x20file\x20for\x20editing\x20and\x20creating\x20new\x20Guard\x20objects.\x20Note:\x20To\x20query\x20on-chain\x20object\x20information,\x20use\x20the\x20\x27query_toolkit\x27\x20tool\x20instead.\x0a\x0a💡\x20Schema\x20hint:\x20Use\x20schema_query\x20with\x20action=\x27get\x27\x20and\x20name=\x27guard2file\x27\x20to\x20retrieve\x20the\x20exact\x20parameter\x20schema\x20before\x20calling.','inputSchema':Guard2File_InputSchema,'outputSchema':Guard2File_OutputWrappedSchema,'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![],'openWorldHint':!![]},'_meta':createToolMeta('generate\x20file',['guard','export','file','json','markdown','on-chain'])},'errorShapeBuilder':strictStatusErrorShape},{'name':'machineNode2file','handler':handleMachineNode2File,'config':{'title':'⚙️\x20Machine\x20Node\x20to\x20File\x20-\x20Export\x20Machine\x20Node\x20Definition','description':'Export\x20a\x20Machine\x20object\x27s\x20node\x20definition\x20from\x20the\x20blockchain\x20to\x20a\x20local\x20JSON\x20or\x20Markdown\x20file\x20for\x20editing\x20and\x20creating\x20new\x20Machine\x20objects.\x20Note:\x20To\x20query\x20on-chain\x20object\x20information,\x20use\x20the\x20\x27query_toolkit\x27\x20tool\x20instead.\x0a\x0a💡\x20Schema\x20hint:\x20Use\x20schema_query\x20with\x20action=\x27get\x27\x20and\x20name=\x27machineNode2file\x27\x20to\x20retrieve\x20the\x20exact\x20parameter\x20schema\x20before\x20calling.','inputSchema':MachineNode2File_InputSchema,'outputSchema':MachineNode2File_OutputWrappedSchema,'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![],'openWorldHint':!![]},'_meta':createToolMeta('generate\x20file',['machine','export','file','json','markdown','on-chain','workflow'])},'errorShapeBuilder':strictStatusErrorShape},{'name':'query_toolkit','handler':handleWatchQueryOperations,'config':{'title':'🔍\x20Data\x20Query\x20Toolkit','description':'WOWOK\x20data\x20query\x20toolkit\x20—\x2013\x20query\x20types\x20covering\x20local\x20device\x20data\x20and\x20on-chain\x20blockchain\x20data:\x0a\x0a'+'LOCAL\x20(device-only,\x20never\x20on-chain):\x0a'+'1.\x20local_mark_list\x20—\x20Query\x20your\x20LOCAL\x20address\x20book:\x20maps\x20human-readable\x20names\x20to\x20blockchain\x20addresses\x20with\x20optional\x20tags.\x20Use\x20to\x20resolve\x20names→addresses\x20or\x20find\x20addresses\x20by\x20tag.\x0a'+'2.\x20account_list\x20—\x20Query\x20your\x20LOCAL\x20accounts\x20(addresses,\x20messenger\x20status,\x20suspension\x20state).\x20Use\x20filter.includePubkey=true\x20to\x20also\x20include\x20public\x20keys.\x20Use\x20to\x20discover\x20available\x20accounts\x20before\x20operations.\x0a'+'3.\x20local_info_list\x20—\x20Query\x20your\x20LOCAL\x20private\x20info:\x20sensitive\x20data\x20like\x20delivery\x20addresses,\x20phone\x20numbers,\x20contacts\x20stored\x20ONLY\x20on\x20this\x20device.\x0a'+'4.\x20token_list\x20—\x20Query\x20cached\x20token\x20metadata:\x20symbol,\x20decimals,\x20icon\x20URL,\x20description\x20for\x20tokens\x20previously\x20fetched\x20from\x20chain.\x20Use\x20to\x20look\x20up\x20token\x20precision/decimals\x20before\x20performing\x20token\x20operations.\x20Returns:\x20TokenTypeInfo[]\x20(type,\x20alias,\x20name,\x20symbol,\x20decimals,\x20iconUrl).\x0a'+'5.\x20account_balance\x20—\x20Query\x20an\x20account\x27s\x20coin\x20balance\x20OR\x20Paginated\x20coin\x20objects.\x20Use\x20balance=true\x20for\x20total\x20amount,\x20or\x20coin={cursor,limit}\x20to\x20list\x20individual\x20coin\x20objects.\x20Supports\x20multi-token\x20via\x20token_type\x20parameter.\x20Results\x20include\x20`_money_display`\x20with\x20unit-converted\x20values\x20+\x20decimals\x20reminder.\x0a'+'6.\x20local_names\x20—\x20Query\x20local\x20names\x20by\x20a\x20list\x20of\x20addresses.\x20For\x20each\x20address,\x20returns\x20the\x20resolved\x20account\x20name\x20(if\x20exists)\x20and\x20local\x20mark\x20name\x20(if\x20exists).\x20Returns:\x20{\x20account?,\x20local_mark?,\x20address\x20}[].\x0a\x0a'+'ONCHAIN\x20(blockchain):\x0a'+'7.\x20onchain_personal_profile\x20—\x20Query\x20any\x20user\x27s\x20PUBLIC\x20on-chain\x20profile:\x20social\x20links,\x20reputation\x20(likes/dislikes),\x20personal\x20info\x20records,\x20voting\x20history,\x20referrer.\x0a'+'8.\x20onchain_objects\x20—\x20Batch\x20query\x20on-chain\x20WOWOK\x20objects\x20by\x20ID\x20or\x20name:\x20supports\x20Service,\x20Machine,\x20Order,\x20Treasury,\x20Reward,\x20Arb,\x20Personal,\x20Contact,\x20and\x20more.\x20Monetary\x20fields\x20include\x20`_money_display`\x20annotations\x20(token\x20type\x20from\x20the\x20object\x27s\x20immutable\x20generic).\x0a'+'9.\x20onchain_received\x20—\x20Query\x20objects\x20(Payments,\x20Tokens,\x20NFTs)\x20received\x20by\x20a\x20specific\x20object.\x20Supports\x20pagination\x20and\x20type\x20filter.\x20CoinWrapper\x20mode\x20returns\x20token-aware\x20`_money_display`.\x0a'+'10.\x20onchain_transaction\x20—\x20Verify\x20what\x20a\x20specific\x20transaction\x20did\x20on-chain\x20(status,\x20object\x20changes,\x20balance\x20changes,\x20gas,\x20events).\x20Balance\x20changes\x20include\x20`_money_display`\x20(unit-converted\x20via\x20each\x20change\x27s\x20own\x20coin_type;\x20signed\x20amounts\x20supported).\x0a'+'11.\x20onchain_object_history\x20—\x20FORENSICS:\x20all\x20transactions\x20that\x20touched\x20an\x20object\x20(auditing\x20only\x20—\x20prefer\x20assemble_context\x20for\x20AI\x20context\x20building).\x0a'+'12.\x20onchain_address_activity\x20—\x20FORENSICS:\x20all\x20transactions\x20sent\x20by\x20an\x20address\x20(auditing\x20only).\x0a'+'13.\x20token_value_convert\x20—\x20Convert\x20between\x20raw\x20on-chain\x20smallest\x20units\x20(u64)\x20and\x20human\x20unit\x20values\x20in\x20EITHER\x20direction\x20(e.g.\x20\x222200000000\x22\x20↔\x20\x222.2\x22\x20WOW).\x20Unit→raw\x20is\x20REFUSED\x20when\x20token\x20precision\x20cannot\x20be\x20resolved\x20(never\x20guesses\x20decimals).\x0a\x0a'+'For\x20dynamic\x20table\x20data\x20queries\x20(pagination,\x20table\x20items),\x20use\x20the\x20\x27onchain_table_data\x27\x20tool.\x20For\x20state-transition\x20events,\x20use\x20the\x20\x27onchain_events\x27\x20tool.\x0a\x0a'+'💡\x20Schema\x20hint:\x20Use\x20schema_query\x20with\x20action=\x27get\x27\x20and\x20name=\x27query_toolkit\x27\x20to\x20retrieve\x20the\x20exact\x20parameter\x20schema\x20with\x20all\x20query\x20types\x20and\x20field\x20definitions.','inputSchema':WatchQueryOperationsSchema,'outputSchema':WatchQueryOperationsResultSchema,'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![],'openWorldHint':!![]},'_meta':createToolMeta('query',['watch','query','on-chain','local','events','objects','tokens','balance','profile'])}},{'name':'onchain_table_data','handler':handleOnchainTableData,'config':{'title':'📊\x20Query\x20WoWok\x20On-chain\x20Table\x20Data','description':'Query\x20the\x20dynamic\x20table\x20data\x20of\x20on-chain\x20objects\x20(ONE-TIME\x20query\x20—\x20NOT\x20a\x20realtime\x20subscription).\x20Supports\x20paginated\x20table\x20queries\x20and\x20specific\x20table\x20item\x20lookups.\x20Each\x20table\x20item\x20belongs\x20to\x20a\x20parent\x20object\x20type\x20and\x20has\x20a\x20specific\x20meaning:\x0a\x0a'+'1.\x20onchain_table\x20—\x20Paginated\x20query\x20of\x20ANY\x20object\x27s\x20dynamic\x20fields\x20table\x20(Parent:\x20any\x20object).\x20Returns\x20all\x20entries\x20with\x20keys,\x20types,\x20and\x20object\x20IDs.\x20Use\x20to\x20explore\x20all\x20sub-items\x20of\x20an\x20object.\x0a'+'2.\x20onchain_table_item_repository_data\x20—\x20Query\x20a\x20record\x20from\x20a\x20Repository\x27s\x20on-chain\x20key-value\x20database\x20(Parent:\x20Repository).\x20Key:\x20name\x20+\x20entity\x20(address\x20or\x20number).\x20Returns\x20the\x20stored\x20data\x20record\x20with\x20typed\x20value.\x0a'+'3.\x20onchain_table_item_permission_perm\x20—\x20Query\x20a\x20permission\x20entry\x20from\x20a\x20Permission\x20object\x27s\x20access\x20control\x20table\x20(Parent:\x20Permission).\x20Key:\x20user\x20address\x20or\x20Guard\x20ID.\x20Returns\x20the\x20permission\x20list\x20(perm[])\x20granted\x20to\x20that\x20user/guard.\x0a'+'4.\x20onchain_table_item_entity_registrar\x20—\x20Query\x20an\x20entity\x27s\x20registration\x20record\x20from\x20the\x20GLOBAL\x20EntityRegistrar\x20(Parent:\x20system\x20EntityRegistrar).\x20Key:\x20user\x20address.\x20Returns\x20registration\x20info:\x20description,\x20referrer,\x20records,\x20mark_object.\x0a'+'5.\x20onchain_table_item_entity_linker\x20—\x20Query\x20community\x20votes/endorsements\x20for\x20an\x20entity\x20from\x20the\x20GLOBAL\x20EntityLinker\x20(Parent:\x20system\x20EntityLinker).\x20Key:\x20entity\x20address.\x20Returns\x20vote\x20records\x20(likes/dislikes)\x20showing\x20community\x20trust.\x0a'+'6.\x20onchain_table_item_reward_record\x20—\x20Query\x20a\x20reward\x20claim\x20record\x20from\x20a\x20Reward\x20object\x27s\x20distribution\x20table\x20(Parent:\x20Reward).\x20Key:\x20recipient\x20address.\x20Returns\x20claim\x20history:\x20guard\x20used,\x20total\x20claimed,\x20per-claim\x20details.\x0a'+'7.\x20onchain_table_item_demand_presenter\x20—\x20Query\x20a\x20demand\x20submission\x20from\x20a\x20Demand\x20object\x27s\x20presenter\x20table\x20(Parent:\x20Demand).\x20Key:\x20presenter\x20address.\x20Returns\x20submission\x20details:\x20recommendation,\x20service,\x20feedback,\x20acceptance\x20score.\x0a'+'8.\x20onchain_table_item_treasury_history\x20—\x20Query\x20a\x20payment\x20record\x20from\x20a\x20Treasury\x27s\x20history\x20table\x20(Parent:\x20Treasury).\x20Key:\x20payment\x20ID\x20(address).\x20Returns\x20payment\x20details:\x20operation\x20type,\x20signer,\x20amount,\x20external\x20guard.\x0a'+'9.\x20onchain_table_item_machine_node\x20—\x20Query\x20a\x20workflow\x20node\x20definition\x20from\x20a\x20Machine\x20object\x27s\x20node\x20table\x20(Parent:\x20Machine).\x20Key:\x20node\x20name\x20(string).\x20Returns\x20node\x20configuration:\x20pairs,\x20forwards,\x20guards,\x20thresholds.\x0a'+'10.\x20onchain_table_item_progress_history\x20—\x20Query\x20a\x20progress\x20step\x20record\x20from\x20a\x20Progress\x20object\x27s\x20history\x20table\x20(Parent:\x20Progress).\x20Key:\x20sequence\x20number\x20(u64).\x20Returns\x20step\x20details:\x20node,\x20next_node,\x20session\x20state,\x20time.\x0a'+'11.\x20onchain_table_item_address_mark\x20—\x20Query\x20a\x20PUBLIC\x20on-chain\x20name/tag\x20mark\x20from\x20an\x20AddressMark\x20object\x27s\x20table\x20(Parent:\x20AddressMark).\x20Key:\x20address.\x20Returns\x20public\x20labels:\x20entity,\x20name,\x20tags[].\x20Unlike\x20local\x20marks,\x20these\x20are\x20published\x20on-chain.\x0a'+'12.\x20onchain_table_item_generic\x20—\x20Query\x20a\x20generic\x20table\x20item\x20from\x20ANY\x20object\x27s\x20dynamic\x20fields\x20(Parent:\x20any\x20object).\x20Supports\x20arbitrary\x20key\x20types\x20(address,\x20u64,\x20string,\x20object\x20ID,\x20etc.).\x20Use\x20for\x20custom\x20objects\x20and\x20general-purpose\x20table\x20lookups.\x20Returns:\x20ObjectBase\x20|\x20undefined.\x0a\x0a'+'🧭\x20Tool\x20selection\x20(avoid\x20confusion):\x20use\x20query_toolkit\x20to\x20query\x20a\x20WHOLE\x20object/balance/profile;\x20use\x20onchain_events\x20to\x20query\x20state-transition\x20events;\x20use\x20onchain_table_data\x20(this\x20tool)\x20to\x20paginate\x20over\x20ONE\x20object\x27s\x20dynamic\x20table\x20fields\x20or\x20read\x20a\x20single\x20table\x20item.\x0a\x0a'+'💡\x20Schema\x20hint:\x20Use\x20schema_query\x20with\x20action=\x27get\x27\x20and\x20name=\x27onchain_table_data\x27\x20to\x20retrieve\x20the\x20exact\x20parameter\x20schema\x20with\x20all\x20table\x20item\x20types\x20and\x20field\x20definitions.','inputSchema':OnchainTableDataSchema,'outputSchema':OnchainTableDataResultSchema,'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![],'openWorldHint':!![]},'_meta':createToolMeta('table\x20query',['on-chain','table','dynamic\x20fields','pagination','repository','permission','reward','demand','treasury','machine','progress'])}},{'name':'onchain_events','handler':handleOnchainEvents,'config':{'title':'📅\x20Query\x20WoWok\x20On-chain\x20Events','description':'Query\x20on-chain\x20WoWok\x20state-transition\x20events\x20by\x20type\x20(a\x20ONE-TIME\x20paginated\x20query\x20—\x20NOT\x20a\x20realtime\x20subscription).\x20Supports\x20arbitration\x20events,\x20new\x20order\x20events,\x20progress\x20events,\x20demand\x20presentation\x20events,\x20demand\x20feedback\x20events,\x20and\x20new\x20entity\x20registration\x20events.\x20Use\x20pagination\x20cursor\x20for\x20fetching\x20large\x20result\x20sets.\x20NewOrderEvent.amount\x20includes\x20`_money_display`\x20annotation\x20(unit-converted\x20via\x20the\x20order\x27s\x20Service\x20generic\x20token\x20type;\x20raw-only\x20with\x20retry\x20hint\x20when\x20precision\x20is\x20unavailable).\x0a\x0a🧭\x20Tool\x20selection\x20(avoid\x20confusion):\x20use\x20query_toolkit\x20to\x20query\x20whole\x20objects/balances/profiles;\x20use\x20onchain_table_data\x20to\x20query\x20ONE\x20object\x27s\x20dynamic\x20table\x20fields;\x20use\x20onchain_events\x20(this\x20tool)\x20to\x20query\x20state-transition\x20EVENTS\x20by\x20type.\x0a\x0a💡\x20Schema\x20hint:\x20Use\x20schema_query\x20with\x20action=\x27get\x27\x20and\x20name=\x27onchain_events\x27\x20to\x20retrieve\x20the\x20exact\x20parameter\x20schema\x20with\x20all\x20event\x20types\x20and\x20field\x20definitions.','inputSchema':OnchainEventsInputSchema,'outputSchema':OnchainEventsResultSchema,'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![],'openWorldHint':!![]},'_meta':createToolMeta('watch\x20wowook\x20events',['events','on-chain','arbitration','order','progress','demand','entity'])}},{'name':'wowok_buildin_info','handler':handleWowokInfo,'config':{'title':'ℹ️\x20WoWok\x20Build-in\x20Information','description':'Query\x20WoWok\x20protocol\x20information:\x20\x27constants\x27,\x20\x27built-in\x20permissions\x27,\x20\x27common\x20mistakes\x27,\x20\x27guard\x20instructions\x27,\x20\x27current\x20network\x27,\x20\x27value\x20types\x27,\x20\x27mainnet\x20bridge\x20tokens\x27,\x20or\x20\x27funding\x20guidance\x27.\x20Use\x20\x27common\x20mistakes\x27\x20to\x20proactively\x20learn\x20known\x20field-name/unit/workflow\x20pitfalls\x20before\x20submitting\x20an\x20operation\x20(e.g.\x20filter\x20operation:\x22compensation_fund_add\x22).\x20For\x20\x27mainnet\x20bridge\x20tokens\x27:\x20returns\x20cross-chain\x20bridge\x20tokens\x20(ETH,\x20WETH,\x20WBTC,\x20USDC,\x20USDT)\x20with\x20each\x20token\x27s\x20symbol,\x20WOW-side\x20type\x20tag\x20(wowTypeTag),\x20EVM\x20address,\x20decimals,\x20and\x20description.\x20The\x20wowTypeTag\x20(format\x20{address}::{module}::{struct})\x20can\x20be\x20used\x20directly\x20as\x20the\x20`type_parameter`\x20of\x20Service\x20/\x20Treasury\x20/\x20Reward\x20/\x20Allocation\x20objects\x20to\x20set\x20their\x20payment\x20token\x20—\x20e.g.\x20use\x20USDT\x27s\x20wowTypeTag\x20to\x20create\x20a\x20Service\x20that\x20accepts\x20USDT\x20payments.\x20For\x20\x27funding\x20guidance\x27:\x20returns\x20how\x20to\x20obtain\x20WOW\x20gas\x20and\x20payment\x20tokens\x20—\x20testnet\x20faucet,\x20mainnet\x20ETH\x20cross-chain\x20bridge\x20flow,\x20and\x20the\x20WOW\x20mainnet\x20airdrop\x20link.\x20Use\x20this\x20when\x20a\x20user\x20asks\x20how\x20to\x20obtain\x20tokens/gas/funds,\x20or\x20as\x20a\x20proactive\x20first-use\x20reminder.','inputSchema':ProtocolInfoQuerySchema,'outputSchema':ProtocolInfoResultSchema,'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![],'openWorldHint':!![]},'_meta':createToolMeta('WoWok\x20info',['build-in','constants','permissions','guard','network','value-types','bridge-tokens','funding-guidance','faucet','airdrop'])}},{'name':'schema_query','handler':handleSchemaQuery,'config':{'title':'📋\x20Schema\x20Query','description':'Look\x20up\x20JSON\x20Schemas\x20for\x20WoWok\x20MCP\x20tools\x20and\x20on-chain\x20operations.\x20'+'This\x20is\x20the\x20authoritative\x20reference\x20for\x20exact\x20parameter\x20structures,\x20types,\x20and\x20required\x20fields.\x20'+'Always\x20check\x20the\x20schema\x20before\x20calling\x20an\x20unfamiliar\x20tool.\x0a\x0a'+'Actions:\x0a'+'\x20\x20\x27list\x27\x20-\x20Show\x20all\x20available\x20schemas\x20(tools\x20+\x20on-chain\x20operations).\x20Start\x20here\x20to\x20discover\x20what\x20exists.\x0a'+'\x20\x20\x27get\x27\x20-\x20Fetch\x20the\x20full\x20input\x20JSON\x20Schema\x20by\x20name\x20(e.g.\x20\x27onchain_operations\x27).\x20Use\x20with\x20the\x20\x27name\x27\x20param.\x0a'+'\x20\x20\x27get_output\x27\x20-\x20Fetch\x20the\x20output\x20JSON\x20Schema\x20of\x20a\x20tool\x20by\x20name\x20(e.g.\x20\x27onchain_operations\x27).\x20Use\x20with\x20the\x20\x27name\x27\x20param.\x20Use\x20this\x20to\x20understand\x20a\x20tool\x27s\x20return\x20value\x20structure.\x0a'+'\x20\x20\x27get_field\x27\x20-\x20Query\x20a\x20single\x20field\x20by\x20dot-path\x20(e.g.\x20field_path=\x27data.node.nodes.0.pairs\x27).\x20Cheaper\x20than\x20\x27get\x27\x20when\x20you\x20only\x20need\x20one\x20subtree.\x0a'+'\x20\x20\x27search\x27\x20-\x20Find\x20schemas\x20by\x20keyword,\x20matching\x20name/title/description.\x20Use\x20with\x20the\x20\x27query\x27\x20param.\x0a'+'\x20\x20\x27list_operations\x27\x20-\x20Show\x20only\x20on-chain\x20operation\x20schemas\x20(prefixed\x20\x27onchain_operations_\x27).\x20Narrower\x20than\x20\x27list\x27.\x0a'+'\x20\x20\x27get_guard_templates\x27\x20-\x20Guard\x20creation\x20templates\x20+\x20best\x20practices\x20(e.g.\x20signer_verification,\x20progress_node_check).\x20Omit\x20\x27template\x27\x20to\x20list\x20all.\x0a'+'\x20\x20\x27search_examples\x27\x20-\x20Search\x20verified\x20example\x20files\x20by\x20keyword\x20(matches\x20title/description/tags/operation_type/industry).\x20Use\x20with\x20the\x20\x27query\x27\x20param.\x0a'+'\x20\x20\x27get_tool_reference\x27\x20-\x20MCP\x20tool\x20usage\x20reference\x20(summaries,\x20actions,\x20prerequisites,\x20notes).\x20Pass\x20name=\x27<tool>\x27\x20for\x20one\x20tool,\x20query=\x27<keyword>\x27\x20to\x20search,\x20or\x20omit\x20for\x20the\x20full\x20catalog.\x0a'+'\x20\x20\x27get_guard_design_patterns\x27\x20-\x20Curated\x20Guard\x20design\x20patterns\x20(business\x20requirement\x20→\x20logic\x20tree\x20template).\x20Pass\x20name=\x27<pattern_id>\x27,\x20query=\x27<host>\x27\x20(e.g.\x20\x27service_buy_guard\x27,\x20\x27machine_forward\x27),\x20or\x20omit\x20for\x20the\x20full\x20catalog.\x0a'+'\x20\x20\x27get_safety_rules\x27\x20-\x20Safety\x20rule\x20tables\x20sunk\x20from\x20the\x20wowok-safety\x20skill:\x20object\x20reuse,\x20immutability-after-publish,\x20LOCAL/ONCHAIN/QUERY\x20classification,\x20naming\x20conventions.','inputSchema':SchemaQueryInputSchema,'outputSchema':SchemaQueryOutputSchema,'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![],'openWorldHint':![]},'_meta':createToolMeta('schema',['schema','json-schema','types','structure','validation','reference'])}},{'name':'bridge_operation','handler':handleBridgeOperations,'config':{'title':'🌉\x20Bridge\x20-\x20Cross-Chain\x20Operations','description':'🌉\x20Simplified\x20cross-chain\x20bridge\x20between\x20WOW\x20and\x20EVM\x20(Ethereum\x20mainnet).\x20Only\x20WOW\x20mainnet\x20provides\x20cross-chain\x20functionality.\x0a\x0a'+'Key\x20concepts\x20(transparent\x20to\x20user):\x0a'+'\x20\x20•\x20Global\x20single\x20activeEvmAccount\x20-\x20auto-generated\x20on\x20first\x20use,\x20holds\x20cross-chain\x20assets.\x0a'+'\x20\x20•\x20WOW→EVM:\x20assets\x20auto-claim\x20to\x20activeEvmAccount;\x20optional\x20withdrawTo\x20transfers\x20to\x20a\x20final\x20EVM\x20address.\x0a'+'\x20\x20•\x20EVM→WOW:\x20deposit\x20from\x20activeEvmAccount\x20(balance\x20checked\x20first),\x20assets\x20arrive\x20at\x20the\x20WOW\x20account.\x0a\x0a'+'Operations\x20(operation_type):\x0a'+'\x20\x20•\x20cross_chain_wow_to_evm\x20-\x20WOW→EVM\x20cross-chain\x20(asset\x20to\x20activeEvmAccount\x20or\x20withdrawTo).\x20[Requires\x20WOW\x20mainnet\x20env]\x0a'+'\x20\x20•\x20cross_chain_evm_to_wow\x20-\x20EVM→WOW\x20cross-chain\x20(from\x20activeEvmAccount\x20to\x20WOW\x20account).\x20[Requires\x20WOW\x20mainnet\x20env]\x0a'+'\x20\x20•\x20withdraw\x20-\x20Withdraw\x20from\x20activeEvmAccount\x20to\x20another\x20EVM\x20address\x20(non-cross-chain).\x20[No\x20env\x20needed]\x0a'+'\x20\x20•\x20query_active_evm_account\x20-\x20Query\x20activeEvmAccount\x20address\x20+\x20balances\x20(per\x20chain\x20or\x20all).\x20[No\x20env\x20needed]\x0a'+'\x20\x20•\x20query_supported_evm_chains\x20-\x20List\x20supported\x20EVM\x20chains\x20(enum/description/chainId/RPC\x20health).\x20[No\x20env\x20needed]\x0a'+'\x20\x20•\x20query_supported_tokens\x20-\x20List\x20supported\x20Bridge\x20tokens\x20per\x20chain\x20(WOW/EVM\x20contract\x20addresses,\x20decimals,\x20description).\x20[No\x20env\x20needed]\x0a'+'\x20\x20•\x20query_transfer_list\x20-\x20Query\x20transfer\x20history\x20list\x20with\x20optional\x20filters\x20(status/direction/token/limit).\x20[No\x20env\x20needed]\x0a'+'\x20\x20•\x20query_transfer_status\x20-\x20Query\x20single\x20transfer\x20detail\x20by\x20transferId.\x20[No\x20env\x20needed]\x0a'+'\x20\x20•\x20manage_evm_rpc\x20-\x20Manage\x20EVM\x20RPC\x20endpoints\x20(list/add/remove/set/ping)\x20to\x20handle\x20429\x20rate\x20limits.\x20[No\x20env\x20needed]\x0a\x0a'+'Token\x20support\x20follows\x20SDK\x20config\x20(ETH/WETH/WBTC/USDC/USDT).\x20WOW\x20account\x20names\x20are\x20supported\x20(resolved\x20via\x20LocalMark).\x0a'+'NOTE:\x20Use\x20schema_query\x20(name=\x27bridge_operation\x27)\x20to\x20retrieve\x20the\x20exact\x20JSON\x20Schema\x20with\x20all\x20field\x20definitions\x20before\x20calling.','inputSchema':BridgeOperationsSchema,'outputSchema':BridgeCallOutputSchema,'annotations':{'readOnlyHint':![],'destructiveHint':!![],'idempotentHint':![],'openWorldHint':!![]},'_meta':createToolMeta('operation',['bridge','cross-chain','evm','ethereum','wow','transfer','rpc'])}},{'name':'project_operation','handler':handleProjectOperation,'config':{'title':'🗂️\x20Project\x20-\x20Entity\x20Management\x20&\x20Evaluation','description':'Project\x20management\x20service\x20—\x20manage\x20projects\x20as\x20first-class\x20entities\x20with\x20SQLite\x20persistence,\x20'+'rigid\x20project-object\x20relationships,\x20three-pathway\x20graph\x20construction,\x20and\x20a\x20dual\x20rule-based\x20+\x20'+'LLM-assisted\x20evaluation\x20engine.\x0a\x0a'+'📌\x20Project\x20policy:\x20Complex\x20builds\x20→\x20auto-create\x20project\x20first\x20+\x20check\x20for\x20similar\x20projects.\x20'+'Single\x20object\x20→\x20remind\x20user\x20to\x20add\x20to\x20a\x20project.\x20'+'Consumer\x20→\x20create_project_from_onchain\x20+\x20evaluate\x20before\x20buying.\x0a\x0a'+'═══════════════════════════════════════════════════════════════\x0a'+'\x20\x20PROJECT\x20ENTITY\x20+\x20EVALUATION\x20(15\x20actions,\x20GLM6)\x0a'+'═══════════════════════════════════════════════════════════════\x0a'+'\x20\x20•\x20list_projects\x20—\x20List\x20all\x20projects\x20(with\x20object\x20count\x20+\x20types).\x20Supports\x20filter_status,\x20filter_perspective,\x20filter_network.\x0a'+'\x20\x20•\x20create_project\x20—\x20Create\x20a\x20new\x20project\x20(producer/consumer/both,\x20bound\x20to\x20a\x20network).\x0a'+'\x20\x20•\x20create_project_from_onchain\x20—\x20Create\x20a\x20consumer\x20project\x20from\x20an\x20on-chain\x20Service\x20address\x20(auto-discovers\x20objects\x20+\x20graph).\x0a'+'\x20\x20•\x20update_project\x20—\x20Update\x20project\x20metadata,\x20status,\x20labels,\x20service\x20address,\x20etc.\x0a'+'\x20\x20•\x20get_project_detail\x20—\x20Get\x20full\x20project\x20detail\x20(objects,\x20graph\x20edges,\x20evaluations,\x20versions).\x0a'+'\x20\x20•\x20add_object\x20—\x20Add\x20an\x20on-chain\x20object\x20to\x20a\x20project\x20(by\x20address\x20or\x20LocalMark\x20name).\x0a'+'\x20\x20•\x20remove_object\x20—\x20Remove\x20an\x20object\x20from\x20a\x20project.\x0a'+'\x20\x20•\x20create_version\x20—\x20Create\x20a\x20project\x20version\x20(e.g.\x20\x27v2\x27)\x20with\x20optional\x20fork\x20from\x20a\x20source\x20version.\x0a'+'\x20\x20•\x20build_graph\x20—\x20Build\x20relationship\x20graph\x20via\x203\x20pathways\x20(internal\x20refs,\x20Registrar,\x20potential).\x20Configurable\x20depth.\x0a'+'\x20\x20•\x20get_graph\x20—\x20Get\x20persisted\x20graph\x20edges.\x0a'+'\x20\x20•\x20evaluate_project\x20—\x20Evaluate\x20project\x20(risk/trust/completeness\x20=\x20rule-based;\x20value/worth_buying\x20=\x20LLM-assisted\x20with\x20prompt).\x0a'+'\x20\x20•\x20save_evaluation\x20—\x20Save\x20an\x20LLM-produced\x20evaluation\x20result.\x0a'+'\x20\x20•\x20compare_projects\x20—\x20Compare\x20multiple\x20projects\x20by\x20evaluation\x20type.\x0a'+'\x20\x20•\x20refresh_objects\x20—\x20Refresh\x20object\x20cache\x20from\x20chain\x20(batch\x20query,\x20rate-limited).\x0a'+'\x20\x20•\x20get_object_diff\x20—\x20Get\x20field-level\x20diff\x20of\x20an\x20object\x20between\x20two\x20timestamps.\x0a\x0a'+'═══════════════════════════════════════════════════════════════\x0a'+'\x20\x20INDUSTRY\x20MODE\x20RECOMMENDATION\x20+\x20REGISTRY\x20(9\x20actions,\x20GLM6/92\x20§E)\x0a'+'═══════════════════════════════════════════════════════════════\x0a'+'\x20\x20•\x20recommend_industry\x20—\x20CALL\x20THIS\x20FIRST\x20when\x20the\x20user\x20describes\x20a\x20business\x20without\x20naming\x20an\x20industry.\x20'+'Returns\x20top-3\x20similar\x20industries\x20+\x20verified\x20reference\x20examples\x20(\x27from\x20scratch\x20vs\x20giants\x27\x20shoulders\x27).\x0a'+'\x20\x20•\x20list_modes\x20—\x20List\x20builtin\x20industry\x20modes\x20+\x20your\x20custom\x20modes.\x0a'+'\x20\x20•\x20derive_user_mode\x20—\x20Derive\x20a\x20custom\x20mode\x20from\x20a\x20builtin\x20(modify\x20machine_shape/allocator/config).\x20R-M1-11\x20enforced.\x0a'+'\x20\x20•\x20evolve_user_mode\x20—\x20Iterate\x20a\x20custom\x20mode\x20(version\x20bump\x20+\x20evolution\x20history).\x0a'+'\x20\x20•\x20register_user_mode\x20—\x20Register\x20a\x20fully\x20custom\x20mode\x20(requires\x20machine_shape\x20+\x20key_risk).\x0a'+'\x20\x20•\x20unregister_user_mode\x20—\x20Delete\x20a\x20custom\x20mode.\x0a'+'\x20\x20•\x20register_custom_metric\x20/\x20register_custom_constraint\x20—\x20Extend\x20the\x20evaluation\x20registries.\x0a'+'\x20\x20•\x20list_metrics_constraints\x20—\x20List\x20metrics\x20+\x20constraints\x20(filterable\x20by\x20type/scope).\x0a\x0a'+'═══════════════════════════════════════════════════════════════\x0a'+'\x20\x20INTENT\x20→\x20RISK\x20→\x20SUBSTEP\x20PIPELINE\x20(3\x20actions,\x20GLM5-31\x20§V3/V4)\x0a'+'═══════════════════════════════════════════════════════════════\x0a'+'\x20\x20•\x20analyze_intent\x20(C1)\x20—\x20Business\x20intent\x20text\x20→\x20parsed\x20intent\x20(primary/secondary\x20objects,\x20'+'detected\x20scenes,\x20industry)\x20+\x20per-object\x20puzzle\x20snapshots\x20+\x20recommended\x20creation\x20order.\x20'+'Required:\x20intent.\x0a'+'\x20\x20•\x20aggregate_risks\x20(C2)\x20—\x20Puzzle\x20snapshots\x20→\x20calibrated\x20risks\x20(CRITICAL/HIGH/MEDIUM/LOW/INFO)\x20'+'with\x20blocking\x20status\x20(RISK_BLOCKED\x20/\x20RISK_PENDING_CONFIRM\x20/\x20RISK_PASSED).\x20Required:\x20project\x20+\x20'+'(puzzles\x20OR\x20intent\x20—\x20when\x20intent\x20is\x20given,\x20analyze_intent\x20runs\x20first\x20automatically).\x20'+'Optional:\x20planned_objects\x20(OBJECT_REUSE\x20check),\x20planned_operations\x20(IMMUTABILITY\x20check).\x0a'+'\x20\x20•\x20trace_substeps\x20(C3)\x20—\x20Substep\x20execution\x20records\x20→\x20DAG\x20coherence\x20analysis\x20(dangling\x20inputs,\x20'+'circular\x20refs,\x20missing\x20outputs,\x20cross-step\x20breaks,\x20topological\x20order,\x20D-10\x20verdict).\x20'+'Required:\x20project\x20+\x20substeps.\x0a\x0a'+'═══════════════════════════════════════════════════════════════\x0a'+'\x20\x20MERCHANT\x20ONBOARDING\x20WIZARD\x20(1\x20action,\x20GLM6/93\x20§5)\x0a'+'═══════════════════════════════════════════════════════════════\x0a'+'\x20\x20•\x20merchant_guide\x20—\x2010-step\x20guided\x20flow\x20from\x20\x27I\x20want\x20to\x20sell\x20X\x27\x20to\x20a\x20validated\x20creation\x20plan:\x20'+'intent\x20analysis\x20→\x20industry\x20matching\x20→\x20module\x20adoption\x20→\x20semantic\x20blueprint\x20→\x20evaluation\x20preview\x20→\x20'+'harness\x20check\x20→\x20ordered\x20creation\x20plan.\x20Stateless:\x20pass\x20guide_state\x20UNCHANGED\x20between\x20calls,\x20'+'advance\x20via\x20guide_confirm.\x20NEVER\x20executes\x20on-chain\x20—\x20materialize\x20the\x20plan\x20via\x20create_project\x20+\x20'+'onchain_operations.\x20Required:\x20intent\x20(first\x20call)\x20or\x20guide_state.\x0a\x0a'+'═══════════════════════════════════════════════════════════════\x0a'+'\x20\x20CONTEXT\x20ASSEMBLY\x20(1\x20action)\x0a'+'═══════════════════════════════════════════════════════════════\x0a'+'\x20\x20•\x20assemble_context\x20—\x20Query\x20on-chain\x20object\x20states\x20+\x20extract\x20embedded\x20history\x20+\x20optional\x20events,\x20'+'and\x20assemble\x20a\x20structured\x20semantic\x20context\x20for\x20LLM\x20consumption.\x20Required:\x20context_objects\x20(array\x20of\x20IDs/names).\x0a\x0a'+'Correct\x20object\x20creation\x20order\x20(topological):\x20Permission\x20→\x20Allocation\x20→\x20Guard\x20→\x20Machine\x20→\x20Service.\x0a'+'All\x20objects\x20created\x20as\x20draft\x20(publish=false)\x20first;\x20publish\x20Machine\x20before\x20Service\x20(last).\x0a\x0a'+'💡\x20Schema\x20hint:\x20Use\x20schema_query\x20with\x20action=\x27get\x27\x20and\x20name=\x27project_operation\x27\x20for\x20exact\x20field\x20definitions.','inputSchema':ProjectOperationInputSchema,'outputSchema':ProjectOperationOutputSchema,'annotations':{'readOnlyHint':![],'destructiveHint':![],'idempotentHint':![],'openWorldHint':![]},'_meta':createToolMeta('project',['project','entity','sqlite','graph','evaluation','risk','trust','completeness','worth_buying','registrar','diff','version','context','assembly'])}},{'name':'config_operation','handler':handleConfigOperation,'config':{'title':'⚙️\x20Config\x20-\x20Runtime\x20Service\x20Toggles','description':'Phase\x202\x20runtime\x20configuration\x20—\x20toggle\x20Phase\x202\x20services\x20on/off\x20at\x20runtime\x20WITHOUT\x20restarting\x20the\x20MCP\x20server.\x20'+'This\x20is\x20the\x20session-level\x20switch\x20mechanism:\x20AI\x20can\x20toggle\x20based\x20on\x20user\x20conversation\x20context,\x20or\x20users\x20can\x20'+'directly\x20control\x20which\x20Phase\x202\x20features\x20are\x20active.\x0a\x0a'+'Actions:\x0a'+'\x20\x20•\x20list\x20—\x20List\x20all\x20services\x20with\x20current\x20state\x20+\x20reminders.\x0a'+'\x20\x20•\x20toggle\x20—\x20Toggle\x20a\x20service\x20on/off\x20(requires\x20`service`\x20param).\x20Returns\x20reminder\x20text.\x0a'+'\x20\x20•\x20enable\x20—\x20Enable\x20a\x20service\x20(requires\x20`service`\x20param).\x0a'+'\x20\x20•\x20disable\x20—\x20Disable\x20a\x20service\x20(requires\x20`service`\x20param).\x0a'+'\x20\x20•\x20reset\x20—\x20Reset\x20a\x20service\x20to\x20its\x20default\x20(requires\x20`service`\x20param).\x0a'+'\x20\x20•\x20info\x20—\x20Get\x20detailed\x20info\x20about\x20a\x20service\x20(requires\x20`service`\x20param).\x0a\x0a'+'Services:\x0a'+'\x20\x20•\x20confirm_gate\x20—\x20Safety\x20Confirmation\x20Gate\x20(default\x20ON)\x0a'+'\x20\x20•\x20project_service\x20—\x20On-chain\x20project\x20tag\x20auto-injection\x20(default\x20ON).\x20When\x20ON,\x20objects\x20created\x20via\x20onchain_operations\x20are\x20auto-tagged\x20with\x20project:<prefix>\x20for\x20on-chain\x20grouping.\x20Use\x20project_operation\x20for\x20SQLite-based\x20project\x20management\x20(evaluation,\x20graph,\x20versioning).\x0a'+'\x20\x20•\x20harness\x20—\x20L4\x20Verify/Recover\x20Loop\x20(default\x20OFF)\x0a'+'\x20\x20•\x20graph_persist\x20—\x20Graph\x20Persistence\x20to\x20File\x20(default\x20OFF)\x0a'+'\x20\x20•\x20semantic_rich\x20—\x20Semantic\x20Layer\x20Enrichment\x20Reminder\x20(default\x20ON)\x0a'+'\x20\x20•\x20experience_layer\x20—\x20Real-time\x20Experience\x20Layer\x20(Phase\x202\x20Topic\x202,\x20default\x20ON)\x0a'+'\x20\x20•\x20customer_intelligence\x20—\x20Buyer\x20Intelligence\x20/\x20Risk\x20&\x20Preference\x20Alerts\x20(Phase\x203\x20C-3,\x20default\x20ON)\x0a'+'\x20\x20•\x20order_monitor\x20—\x20In-progress\x20Order\x20Monitoring\x20(Phase\x203\x20C-3.2,\x20default\x20OFF)\x0a'+'\x20\x20•\x20industry_evolution\x20—\x20Industry\x20Specialization\x20Evolution\x20Flywheel\x20(Phase\x204,\x20default\x20ON)\x0a\x0a'+'NOTE:\x20Toggles\x20persist\x20for\x20the\x20MCP\x20process\x20lifetime.\x20Set\x20WOWOK_RUNTIME_CONFIG_PERSIST=1\x20'+'to\x20persist\x20across\x20sessions\x20to\x20~/.wow/mcp/runtime-config.json.\x0a\x0a'+'💡\x20Schema\x20hint:\x20Use\x20schema_query\x20with\x20action=\x27get\x27\x20and\x20name=\x27config_operation\x27\x20to\x20retrieve\x20the\x20exact\x20parameter\x20schema\x20with\x20all\x20actions\x20and\x20field\x20definitions.','inputSchema':ConfigOperationInputSchema,'outputSchema':ConfigOperationOutputSchema,'annotations':{'readOnlyHint':![],'destructiveHint':![],'idempotentHint':!![],'openWorldHint':![]},'_meta':createToolMeta('config',['config','toggle','service','runtime','switch','enable','disable'])}},{'name':'trust_score','handler':handleTrustScore,'config':{'title':'🛡️\x20Trust\x20Score\x20-\x20Service\x20Risk\x20&\x20Trust\x20Assessment','description':'Proactively\x20query\x20the\x20trust\x20score\x20and\x20risk\x20assessment\x20of\x20a\x20Service\x20object.\x20'+'This\x20is\x20the\x20standalone\x20query\x20form\x20of\x20the\x20trust_score\x20field\x20that\x20is\x20otherwise\x20only\x20'+'passively\x20injected\x20into\x20onchain_operations\x20semantic\x20output.\x0a\x0a'+'Returns:\x0a'+'\x20\x20•\x20trust_score\x20(0-100,\x205\x20dimensions:\x20arbitration/reviews/fulfillment/fund_safety/transparency)\x0a'+'\x20\x20•\x20risk_score\x20(4\x20dimensions:\x20workflow/fund/trust/behavior,\x20100-point)\x20when\x20depth\x20>=\x20\x27evaluate\x27\x0a'+'\x20\x20•\x20info_puzzle\x20completeness\x20+\x20gaps\x20summary\x0a'+'\x20\x20•\x20service_basics\x20snapshot\x20(published/paused/sales/guards/arbitrations)\x0a\x0a'+'Use\x20this\x20tool\x20when\x20the\x20user\x20asks\x20\x27is\x20this\x20service\x20trustworthy?\x27,\x20\x27should\x20I\x20buy\x20from\x20this\x20merchant?\x27,\x20'+'\x27what\x27s\x20the\x20risk\x20of\x20ordering\x20this\x20service?\x27,\x20or\x20any\x20explicit\x20trust/risk\x20inquiry\x20about\x20a\x20Service.\x0a\x0a'+'🧭\x20Tool\x20selection\x20(avoid\x20confusion):\x20trust_score\x20=\x20trust/risk\x20of\x20ONE\x20Service;\x20'+'evaluation_operation\x20=\x20game-theory\x20best-move\x20advice\x20at\x20an\x20Arb/Progress\x20state;\x20'+'project_operation.evaluate_project\x20=\x20multi-object\x20project-level\x20evaluation.\x0a\x0a'+'Parameters:\x0a'+'\x20\x20•\x20service\x20(required)\x20—\x20Service\x20object\x20ID\x20or\x20local_mark\x20name.\x0a'+'\x20\x20•\x20order_amount\x20(optional)\x20—\x20Order\x20amount\x20in\x20smallest\x20token\x20unit\x20(e.g.\x202000000000\x20for\x202\x20WOW).\x20'+'Defaults\x20to\x20the\x20service\x27s\x20first\x20active\x20sale\x20price.\x0a'+'\x20\x20•\x20depth\x20(optional,\x20default\x20\x27evaluate\x27)\x20—\x20\x27browse\x27\x20(trust\x20score\x20only),\x20\x27evaluate\x27\x20(+\x20risk\x20assessment),\x20'+'\x27preorder\x27\x20(most\x20thorough,\x20includes\x20market\x20context\x20dimension).\x0a\x0a'+'💡\x20Schema\x20hint:\x20Use\x20schema_query\x20with\x20action=\x27get\x27\x20and\x20name=\x27trust_score\x27\x20to\x20retrieve\x20the\x20exact\x20parameter\x20schema.','inputSchema':TrustScoreInputSchema,'outputSchema':TrustScoreOutputSchema,'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![],'openWorldHint':![]},'_meta':createToolMeta('trust',['trust','score','risk','service','merchant','reputation','safety','evaluate'])}},{'name':'query_task_status','handler':handleQueryTaskStatus,'config':{'title':'📊\x20Task\x20Status\x20-\x20Async\x20Operation\x20Tracking','description':'Query\x20the\x20status\x20of\x20a\x20long-running\x20async\x20task\x20(created\x20by\x20build_graph\x20or\x20evaluate_project\x20'+'with\x20async_mode=true).\x20Returns\x20progress\x20percentage,\x20current\x20status,\x20and\x20the\x20final\x20result\x20'+'when\x20completed.\x0a\x0a'+'Tasks\x20are\x20ephemeral\x20(retained\x205\x20minutes\x20after\x20completion,\x20in-memory\x20only).\x0a\x0a'+'Usage:\x0a'+'\x20\x20•\x20Pass\x20task_id\x20to\x20query\x20a\x20single\x20task\x27s\x20status.\x0a'+'\x20\x20•\x20Omit\x20task_id\x20to\x20list\x20all\x20recent\x20tasks\x20(max\x2050,\x20most\x20recent\x20first).\x0a'+'\x20\x20•\x20Pass\x20project_id\x20(with\x20task_id\x20omitted)\x20to\x20filter\x20by\x20project.\x0a\x0a'+'This\x20tool\x20is\x20read-only\x20and\x20always\x20safe\x20to\x20call.\x20Use\x20it\x20to\x20check\x20if\x20a\x20long-running\x20'+'operation\x20(e.g.\x20build_graph\x20with\x20enablePotential=true)\x20has\x20completed.\x0a\x0a'+'💡\x20Schema\x20hint:\x20Use\x20schema_query\x20with\x20action=\x27get\x27\x20and\x20name=\x27query_task_status\x27\x20to\x20retrieve\x20the\x20exact\x20parameter\x20schema.','inputSchema':QueryTaskStatusInputSchema,'outputSchema':QueryTaskStatusOutputSchema,'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![],'openWorldHint':![]},'_meta':createToolMeta('task',['task','status','async','progress','background','tracker'])}},{'name':'evaluation_operation','handler':handleEvaluationOperation,'config':{'title':'🧠\x20Evaluation\x20-\x20Pluggable\x20Business\x20Intelligence','description':'Run\x20pluggable\x20business\x20evaluations\x20(data\x20sources\x20+\x20rules\x20+\x20user\x20injection).\x20'+'Each\x20evaluation\x20returns\x20ranked\x20best-move\x20recommendations\x20with\x20payoff\x20notes\x20and\x20risks.\x0a\x0a'+'Actions:\x0a'+'\x20\x20•\x20arb_game\x20—\x20advise\x20the\x20best\x20move\x20at\x20an\x20Arb\x20state\x20(7-state\x20lifecycle)\x20for\x20a\x20perspective\x20(customer/merchant/arbitrator).\x0a'+'\x20\x20•\x20node_game\x20—\x20advise\x20the\x20best\x20move\x20at\x20a\x20Progress\x20node\x20for\x20a\x20perspective\x20(merchant/customer/prospect/supplier/collaborator/arbitrator).\x0a\x0a'+'Read-only:\x20computes\x20recommendations\x20from\x20pure\x20data;\x20never\x20mutates\x20chain\x20state.\x20'+'The\x20caller\x20decides\x20and\x20acts\x20via\x20onchain_operations\x20/\x20messenger_operation.\x0a\x0a'+'🧭\x20Tool\x20selection\x20(avoid\x20confusion):\x20evaluation_operation\x20=\x20best-move\x20advice\x20at\x20an\x20Arb/Progress\x20state\x20(game\x20theory);\x20'+'trust_score\x20=\x20trust/risk\x20of\x20ONE\x20Service;\x20project_operation\x20=\x20project-level\x20evaluation.\x0a\x0a'+'💡\x20Schema\x20hint:\x20Use\x20schema_query\x20with\x20action=\x27get\x27\x20and\x20name=\x27evaluation_operation\x27\x20to\x20retrieve\x20the\x20exact\x20parameter\x20schema.','inputSchema':EvaluationOperationInputSchema,'outputSchema':EvaluationOperationOutputSchema,'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![],'openWorldHint':![]},'_meta':createToolMeta('evaluation',['evaluate','risk','match','game','score','arb','node','compose','gap'])}},{'name':'persona_operation','handler':handlePersonaOperation,'config':{'title':'👤\x20Persona\x20-\x20User\x20Identity\x20Setting','description':'Read/write\x20the\x20user\x27s\x20systematic\x20identity\x20setting\x20(persona):\x20preferences,\x20'+'competitive\x20strategy,\x20experience\x20rules,\x20self\x20profile,\x20and\x20spec.\x0a\x0a'+'LAYERS:\x20long_term\x20=\x20STABLE\x20identity\x20(USER-DRIVEN\x20only\x20—\x20never\x20auto-rewrite).\x20'+'current\x20=\x20transient\x20context\x20(SMART-UPDATABLE\x20—\x20AI\x20may\x20merge/replace\x20from\x20'+'conversation\x20experience\x20or\x20account\x20behavior).\x20Scope:\x20system\x20(all\x20accounts,\x20'+'be\x20conservative)\x20or\x20account\x20(one\x20chain\x20address,\x20higher\x20priority).\x0a\x0a'+'Actions:\x0a'+'\x20\x20•\x20get\x20—\x20resolve\x20the\x20priority-merged\x20effective\x20persona\x20(+\x20injection\x20+\x20context\x20text).\x0a'+'\x20\x20•\x20list\x20—\x20list\x20stored\x20personas\x20and\x20built-in\x20industry\x20defaults.\x0a'+'\x20\x20•\x20set\x20—\x20user-driven\x20write/update\x20of\x20any\x20layer\x20(≤300\x20lines\x20enforced).\x0a'+'\x20\x20•\x20analyze\x20—\x20extract\x20identity\x20signals\x20from\x20free-form\x20context\x20(website\x20/\x20experience\x20summary).\x0a'+'\x20\x20•\x20apply\x20—\x20merge/replace\x20analyzed\x20signals\x20into\x20the\x20CURRENT\x20layer\x20only.\x0a'+'\x20\x20•\x20sync\x20—\x20merge\x20account\x20behavior\x20(experience\x20layer)\x20into\x20the\x20CURRENT\x20layer.\x0a'+'\x20\x20•\x20remove\x20—\x20delete\x20a\x20persona\x20(fall\x20back\x20to\x20defaults).\x0a\x0a'+'Read/write\x20local\x20state\x20only;\x20never\x20mutates\x20chain\x20state.\x0a\x0a'+'💡\x20Schema\x20hint:\x20Use\x20schema_query\x20with\x20action=\x27get\x27\x20and\x20name=\x27persona_operation\x27\x20to\x20retrieve\x20the\x20exact\x20parameter\x20schema.','inputSchema':PersonaOperationInputSchema,'outputSchema':PersonaOperationOutputSchema,'annotations':{'readOnlyHint':![],'destructiveHint':![],'idempotentHint':!![],'openWorldHint':![]},'_meta':createToolMeta('persona',['persona','profile','identity','preference','strategy','spec','portrait'])}},{'name':'intent_radar','handler':handleIntentRadar,'config':{'title':'📡\x20Intent\x20Radar\x20-\x20User\x20Intent\x20×\x20Chain\x20Event\x20Matching','description':'Persist\x20the\x20user\x27s\x20standing\x20business\x20intents\x20and\x20match\x20them\x20against\x20on-chain\x20events/data.\x20'+'This\x20closes\x20the\x20loop:\x20user\x20records\x20an\x20intent\x20(e.g.\x20\x27find\x20subscription\x20services\x27),\x20'+'the\x20system\x20pulls\x20recent\x20chain\x20events\x20and\x20returns\x20ranked\x20hits.\x0a\x0a'+'Actions:\x0a'+'\x20\x20•\x20save\x20—\x20record\x20an\x20intent\x20(industry/keywords\x20resolved\x20once;\x20optionally\x20bound\x20to\x20an\x20account).\x0a'+'\x20\x20•\x20list\x20—\x20list\x20persisted\x20intents\x20(optionally\x20filtered\x20by\x20account).\x0a'+'\x20\x20•\x20remove\x20—\x20delete\x20an\x20intent.\x0a'+'\x20\x20•\x20match\x20—\x20score\x20events\x20against\x20intents\x20(pass\x20`events`\x20from\x20onchain_events,\x20or\x20auto-pull\x20recent\x20events).\x0a\x0a'+'Read-only\x20w.r.t.\x20chain\x20state\x20(reads\x20events\x20+\x20local\x20intent\x20store\x20only).\x0a\x0a'+'💡\x20Schema\x20hint:\x20Use\x20schema_query\x20with\x20action=\x27get\x27\x20and\x20name=\x27intent_radar\x27\x20to\x20retrieve\x20the\x20exact\x20parameter\x20schema.','inputSchema':IntentRadarInputSchema,'outputSchema':IntentRadarOutputSchema,'annotations':{'readOnlyHint':!![],'destructiveHint':![],'idempotentHint':!![],'openWorldHint':![]},'_meta':createToolMeta('intent',['intent','radar','match','event','watch','business','intelligence'])}}];export const TOOL_REGISTRY_MAP=new Map(TOOL_REGISTRY['map'](a=>[a['name'],a]));const SUB_TOOL_NAMES=TOOL_REGISTRY['map'](a=>a['name']),WowokToolRuntimeSchema=z['unknown']()['describe']('WoWok\x20unified\x20tool\x20input.\x20Expected:\x20{\x20tool:\x20\x22<sub-tool>\x22,\x20data:\x20{<params>}\x20}.\x20'+'Aliases\x20accepted:\x20tool_name→tool,\x20args→data,\x20name→tool,\x20params→data.\x20'+'If\x20parameters\x20don\x27t\x20match\x20the\x20sub-tool\x27s\x20schema,\x20the\x20response\x20includes\x20the\x20correct\x20schema\x20for\x20self-correction.'),WowokToolDisplaySchema=z['object']({'tool':z['enum'](SUB_TOOL_NAMES)['optional']()['describe']('The\x20sub-tool\x20to\x20execute.\x20Each\x20sub-tool\x20has\x20its\x20own\x20parameter\x20schema.'),'data':z['record'](z['unknown']())['optional']()['describe']('Sub-tool\x20specific\x20parameters.\x20If\x20validation\x20fails,\x20the\x20response\x20includes\x20the\x20correct\x20schema\x20for\x20this\x20sub-tool\x20—\x20read\x20it,\x20fix\x20your\x20params,\x20and\x20retry.'),'tool_name':z['enum'](SUB_TOOL_NAMES)['optional']()['describe']('DEPRECATED\x20alias\x20for\x20\x27tool\x27.\x20Use\x20\x27tool\x27\x20instead.'),'args':z['record'](z['unknown']())['optional']()['describe']('DEPRECATED\x20alias\x20for\x20\x27data\x27.\x20Use\x20\x27data\x27\x20instead.'),'name':z['enum'](SUB_TOOL_NAMES)['optional']()['describe']('DEPRECATED\x20alias\x20for\x20\x27tool\x27.\x20Use\x20\x27tool\x27\x20instead.'),'params':z['record'](z['unknown']())['optional']()['describe']('DEPRECATED\x20alias\x20for\x20\x27data\x27.\x20Use\x20\x27data\x27\x20instead.')})['describe']('WoWok\x20unified\x20tool\x20input.\x20Call\x20with\x20{\x20tool:\x20\x22<sub-tool>\x22,\x20data:\x20{<params>}\x20}.\x20'+'Aliases:\x20tool_name/name→tool,\x20args/params→data.'),WOWOK_TOOL_DESCRIPTION=['WoWok\x20MCP\x20unified\x20interface.\x20Call\x20with\x20{\x20tool:\x20\x22<sub-tool>\x22,\x20data:\x20{<params>}\x20}.','','\x20\x20tool:\x20name\x20of\x20the\x20sub-tool\x20(string)','\x20\x20data:\x20sub-tool\x20parameters\x20(object)','','\x20\x20Aliases\x20accepted\x20(deprecated):\x20tool_name/name\x20for\x20tool,\x20args/params\x20for\x20data.','\x20\x20Inline\x20params\x20also\x20accepted:\x20{\x20tool:\x20\x22<sub-tool>\x22,\x20<param1>:\x20...,\x20<param2>:\x20...\x20}','','\x20\x20EXAMPLE:\x20wowok({\x20tool:\x20\x22schema_query\x22,\x20data:\x20{\x20action:\x20\x22get\x22,\x20name:\x20\x22onchain_operations\x22\x20}\x20})','\x20\x20EXAMPLE:\x20wowok({\x20tool:\x20\x22wowok_buildin_info\x22,\x20data:\x20{\x20info:\x20\x22mainnet\x20bridge\x20tokens\x22\x20}\x20})','\x20\x20EXAMPLE\x20(inline\x20params):\x20wowok({\x20tool:\x20\x22schema_query\x22,\x20action:\x20\x22get\x22,\x20name:\x20\x22onchain_operations\x22\x20})','','Available\x20sub-tools:','\x20\x20onchain_operations\x20—\x20On-chain\x20ops:\x20service,\x20machine,\x20progress,\x20repository,\x20arbitration,\x20etc.','\x20\x20account_operation\x20—\x20LOCAL\x20wallet\x20management\x20(generate,\x20suspend,\x20faucet,\x20sign).','\x20\x20local_mark_operation\x20—\x20LOCAL\x20address\x20book\x20(name/tag\x20for\x20addresses\x20and\x20object\x20IDs).','\x20\x20local_info_operation\x20—\x20LOCAL\x20private\x20data\x20(delivery\x20addresses,\x20phone\x20numbers).','\x20\x20wip_file\x20—\x20Work-in-progress\x20file\x20management.','\x20\x20messenger_operation\x20—\x20End-to-end\x20encrypted\x20messaging.','\x20\x20guard2file\x20—\x20Export\x20guard\x20rules\x20to\x20file.','\x20\x20machineNode2file\x20—\x20Export\x20machine\x20nodes\x20to\x20file.','\x20\x20query_toolkit\x20—\x20Query\x20on-chain\x20objects\x20by\x20ID/type/owner.','\x20\x20onchain_table_data\x20—\x20Query\x20on-chain\x20dynamic\x20field\x20tables\x20with\x20pagination.','\x20\x20onchain_events\x20—\x20Watch\x20on-chain\x20events\x20(arbitration,\x20order,\x20progress,\x20demand).','\x20\x20wowok_buildin_info\x20—\x20Protocol\x20constants,\x20built-in\x20permissions,\x20bridge\x20tokens,\x20funding\x20guidance.','\x20\x20schema_query\x20—\x20Query\x20JSON\x20schemas\x20for\x20any\x20sub-tool\x20(action:\x20list/get/get_output/search).','\x20\x20bridge_operation\x20—\x20Cross-chain\x20bridge\x20between\x20WOW\x20and\x20EVM\x20(mainnet\x20only).','\x20\x20project_operation\x20—\x20Project\x20entity\x20management\x20(SQLite)\x20+\x203-pathway\x20graph\x20+\x20evaluation\x20engine.','\x20\x20config_operation\x20—\x20Runtime\x20service\x20toggles\x20(confirm_gate,\x20harness,\x20etc.).','\x20\x20trust_score\x20—\x20Service\x20trust/risk\x20assessment\x20(0-100\x20score,\x205\x20dimensions).','','SCHEMA-GATED\x20EXECUTION:','\x20\x20If\x20your\x20parameters\x20don\x27t\x20match\x20the\x20sub-tool\x27s\x20schema,\x20the\x20response\x20will\x20include:','\x20\x20\x20\x20result.status\x20=\x20\x22schema_mismatch\x22','\x20\x20\x20\x20result.errors\x20=\x20specific\x20validation\x20errors\x20(field\x20path\x20+\x20expected\x20type)','\x20\x20\x20\x20result.hint\x20=\x20instructions\x20to\x20fix\x20and\x20retry','\x20\x20\x20\x20schema.input\x20=\x20the\x20correct\x20JSON\x20schema\x20for\x20the\x20sub-tool','\x20\x20\x20\x20schema.tool\x20=\x20which\x20sub-tool\x20this\x20schema\x20belongs\x20to','\x20\x20Read\x20the\x20schema,\x20fix\x20your\x20params,\x20and\x20retry.\x20This\x20is\x20normal\x20—\x20no\x20need\x20to\x20call\x20schema_query\x20separately.','','SCHEMA\x20CACHING:','\x20\x20Each\x20sub-tool\x20has\x20a\x20DIFFERENT\x20schema.\x20When\x20you\x20receive\x20a\x20schema\x20in\x20a\x20mismatch\x20response:','\x20\x20\x20\x201.\x20Read\x20the\x20schema\x20carefully','\x20\x20\x20\x202.\x20Fix\x20your\x20parameters','\x20\x20\x20\x203.\x20Retry\x20the\x20call','\x20\x20\x20\x204.\x20CACHE\x20the\x20schema\x20in\x20your\x20context\x20for\x20future\x20calls\x20to\x20the\x20SAME\x20sub-tool','\x20\x20You\x20should\x20only\x20need\x20to\x20see\x20each\x20sub-tool\x27s\x20schema\x20once\x20per\x20conversation.','','PROJECT\x20MANAGEMENT\x20(SQLite-based):','\x20\x20project_operation\x20action=\x27list_projects\x27\x20→\x20list\x20all\x20projects\x20with\x20object\x20counts','\x20\x20project_operation\x20action=\x27create_project\x27\x20→\x20create\x20a\x20new\x20project\x20(producer/consumer/both)','\x20\x20project_operation\x20action=\x27get_project_detail\x27\x20→\x20full\x20project\x20info\x20(objects,\x20graph,\x20evaluations,\x20versions)','\x20\x20project_operation\x20action=\x27build_graph\x27\x20→\x20build\x203-pathway\x20relationship\x20graph','\x20\x20project_operation\x20action=\x27evaluate_project\x27\x20→\x20rule-based\x20(risk/trust/completeness)\x20or\x20LLM-assisted\x20(value/worth_buying)','\x20\x20project_operation\x20action=\x27assemble_context\x27\x20→\x20assemble\x20semantic\x20context\x20for\x20LLM\x20consumption','','═══════════════════════════════════════════════════════════════','PROJECT\x20ASSOCIATION\x20POLICY\x20(context-aware,\x20read\x20before\x20build/buy):','═══════════════════════════════════════════════════════════════','','Projects\x20are\x20the\x20core\x20organizing\x20unit\x20for\x20all\x20WoWok\x20workflows.\x20The\x20policy\x20is\x20context-aware:','','CASE\x201\x20—\x20COMPLEX\x20REQUIREMENT\x20(user\x20wants\x20to\x20build/deploy\x20a\x20full\x20service):','\x20\x20Examples:\x20\x27build\x20a\x20travel\x20guide\x20service\x27,\x20\x27open\x20a\x20toy\x20store\x27,\x20\x27create\x20a\x20rental\x20service\x27','\x20\x20→\x20You\x20MUST\x20auto-create\x20a\x20project\x20FIRST,\x20then\x20create\x20objects.','\x20\x20→\x20Check\x20for\x20similar\x20existing\x20projects\x20first:\x20project_operation\x20action=\x27list_projects\x27','\x20\x20\x20\x20If\x20similar\x20projects\x20exist\x20(same\x20industry),\x20remind\x20the\x20user:\x20\x27Found\x20similar\x20project\x20X.\x20Reuse\x20or\x20create\x20new?\x27','\x20\x20→\x20Workflow:','\x20\x20\x20\x201.\x20project_operation\x20action=\x27create_project\x27\x20(perspective=\x27producer\x27,\x20project_industry=<best\x20match>)','\x20\x20\x20\x202.\x20Create\x20on-chain\x20objects\x20via\x20onchain_operations\x20with\x20env.project=\x27<prefix>\x27\x20(auto-tags\x20+\x20auto-associates\x20to\x20SQLite\x20project)','\x20\x20\x20\x203.\x20After\x20EACH\x20creation,\x20objects\x20are\x20auto-added\x20to\x20the\x20project\x20(via\x20env.project)','\x20\x20\x20\x204.\x20project_operation\x20action=\x27build_graph\x27\x20—\x20build\x203-pathway\x20relationship\x20graph','\x20\x20\x20\x205.\x20project_operation\x20action=\x27evaluate_project\x27\x20(completeness\x20→\x20R1-R12\x20check,\x20then\x20risk)','\x20\x20\x20\x206.\x20Report\x20results,\x20fix\x20critical\x20findings,\x20then\x20publish\x20Service','','CASE\x202\x20—\x20SINGLE\x20OBJECT\x20CREATION\x20(user\x20wants\x20one\x20specific\x20object):','\x20\x20Examples:\x20\x27create\x20a\x20Permission\x27,\x20\x27add\x20a\x20Contact\x27,\x20\x27build\x20a\x20Guard\x27','\x20\x20→\x20Do\x20NOT\x20auto-create\x20a\x20project.\x20If\x20the\x20user\x20has\x20an\x20existing\x20project,\x20create\x20with\x20env.project=\x27<prefix>\x27\x20to\x20auto-associate.','\x20\x20→\x20If\x20no\x20existing\x20project,\x20after\x20creation,\x20REMIND\x20the\x20user:','\x20\x20\x20\x20\x27This\x20object\x20has\x20been\x20created.\x20Consider\x20adding\x20it\x20to\x20a\x20project\x20for\x20management:\x20project_operation\x20action=\x22add_object\x22','\x20\x20\x20\x20If\x20no\x20project\x20exists\x20yet,\x20use\x20action=\x22create_project\x22\x20to\x20create\x20one.\x20Existing\x20projects:\x20[list\x20projects\x20if\x20any]\x27','\x20\x20→\x20If\x20the\x20user\x20then\x20says\x20\x27yes,\x20create\x20a\x20project\x27\x20or\x20\x27add\x20to\x20project\x20X\x27,\x20proceed\x20accordingly.','','CASE\x203\x20—\x20CONSUMER\x20FLOW\x20(user\x20wants\x20to\x20buy/evaluate\x20a\x20service):','\x20\x20→\x20Suggest:\x20project_operation\x20action=\x27create_project_from_onchain\x27\x20(auto-discovers\x20objects\x20+\x20graph)','\x20\x20→\x20Then:\x20project_operation\x20action=\x27evaluate_project\x27\x20(risk\x20→\x20trust\x20→\x20worth_buying)','\x20\x20→\x20Report\x20findings,\x20let\x20user\x20decide\x20whether\x20to\x20proceed\x20with\x20onchain_operations\x20service_buy','','CASE\x204\x20—\x20SIMPLE\x20QUERY\x20(user\x20wants\x20to\x20check\x20object\x20info,\x20balance,\x20etc.):','\x20\x20→\x20No\x20project\x20needed.\x20Proceed\x20directly\x20with\x20the\x20query.','','INDUSTRY\x20MATCHING\x20(for\x20create_project\x20project_industry\x20param):','\x20\x20travel\x20→\x20tour\x20guides,\x20transportation,\x20accommodation,\x20sightseeing','\x20\x20retail\x20→\x20shops,\x20e-commerce,\x20physical\x20goods','\x20\x20service\x20→\x20professional\x20services,\x20consulting,\x20design','\x20\x20rental\x20→\x20equipment\x20rental,\x20property\x20rental','\x20\x20freelance\x20→\x20freelance\x20work,\x20gig\x20economy','\x20\x20education\x20→\x20courses,\x20training,\x20tutoring','\x20\x20subscription\x20→\x20subscription\x20services,\x20memberships','\x20\x20general\x20→\x20fallback\x20for\x20unclear\x20industry','═══════════════════════════════════════════════════════════════']['join']('\x0a');function formatZodErrors(a,b){return a['issues']['map'](c=>{const d=c['path']['length']>0x0?c['path']['map'](j=>typeof j==='number'?'['+j+']':j)['join']('.')['replace']('.[','['):'(root)',e=c['code'],f=c['message'];let g='';const h=c;if(e==='invalid_type'){const j=h['expected'],k=h['received'];typeof j==='string'&&typeof k==='string'&&(g='\x20(expected:\x20'+j+';\x20received:\x20'+k+')');}else{if(e==='invalid_literal'||e==='invalid_enum_value'){const l=h['expected'];if(l!==undefined){const m=typeof l==='string'?l:JSON['stringify'](l);g='\x20(expected:\x20'+m['slice'](0x0,0x3c)+')';}}else{if(e==='too_big'||e==='too_small'){const n=h['maximum']??h['minimum'],o=h['origin'];n!==undefined&&o!==undefined&&(g='\x20('+o+':\x20'+n+')');}}}const i=extractValueAtPath(b,c['path']);if(i!==undefined){const p=typeof i==='string'?'\x22'+i['slice'](0x0,0x3c)+'\x22':typeof i==='object'?JSON['stringify'](i)['slice'](0x0,0x3c):String(i);!g['includes']('received:')&&(g+='\x20(received\x20value:\x20'+p+')');}return d+'\x20['+e+']:\x20'+f+g;});}function generateSuggestion(a,b,c){const d=b;switch(a){case'invalid_type':{const e=d['expected'],f=d['received'];if(e==='number'&&typeof c==='string')return'Convert\x20to\x20number:\x20'+Number(c);if(e==='string')return'Wrap\x20in\x20quotes\x20or\x20call\x20String(...)';if(e==='array')return'Wrap\x20in\x20array:\x20['+JSON['stringify'](c)+']';if(e==='object')return'Provide\x20an\x20object,\x20not\x20a\x20primitive';return'Convert\x20value\x20to\x20'+(e??'the\x20expected\x20type');}case'invalid_enum_value':{const g=d['options'],h=Array['isArray'](g)?g['map'](i=>JSON['stringify'](i))['join']('\x20|\x20'):String(g);return'Use\x20one\x20of:\x20'+h;}case'invalid_literal':{const i=d['expected'];return'Use\x20the\x20exact\x20value:\x20'+JSON['stringify'](i);}case'too_small':{const j=d['minimum'],k=d['type'];if(k==='array')return'Add\x20at\x20least\x20'+j+'\x20element(s)\x20to\x20the\x20array';if(k==='string')return'String\x20must\x20be\x20at\x20least\x20'+j+'\x20character(s)\x20long';if(k==='number')return'Use\x20a\x20value\x20>=\x20'+j;return'Value\x20must\x20be\x20>=\x20'+j;}case'too_big':{const l=d['maximum'],m=d['type'];if(m==='array')return'Reduce\x20array\x20to\x20at\x20most\x20'+l+'\x20element(s)';if(m==='string')return'Shorten\x20string\x20to\x20at\x20most\x20'+l+'\x20character(s)';if(m==='number')return'Use\x20a\x20value\x20<=\x20'+l;return'Value\x20must\x20be\x20<=\x20'+l;}case'unrecognized_keys':{const n=d['keys'];return'Remove\x20unknown\x20field(s):\x20'+(n??[])['join'](',\x20')+'.\x20Check\x20the\x20schema\x20for\x20valid\x20field\x20names.';}case'invalid_union':{return'Value\x20does\x20not\x20match\x20any\x20of\x20the\x20union\x20variants.\x20Check\x20the\x20schema\x20for\x20valid\x20shapes.';}case'invalid_string':{const o=d['validation'];if(o==='url')return'Provide\x20a\x20valid\x20URL\x20string';if(o==='email')return'Provide\x20a\x20valid\x20email\x20string';if(o==='uuid')return'Provide\x20a\x20valid\x20UUID\x20string';if(o==='regex')return'String\x20does\x20not\x20match\x20the\x20required\x20pattern';return'Provide\x20a\x20valid\x20string\x20matching\x20the\x20validation:\x20'+(o??'unknown');}case'invalid_date':{return'Provide\x20a\x20valid\x20Date\x20object\x20or\x20ISO\x20date\x20string';}case'not_finite':{return'Use\x20a\x20finite\x20number\x20(not\x20Infinity\x20or\x20NaN)';}case'invalid_arguments':{return'Arguments\x20do\x20not\x20match\x20the\x20expected\x20schema';}case'invalid_return_type':{return'Return\x20type\x20does\x20not\x20match\x20the\x20expected\x20schema';}case'custom':{return'Custom\x20validation\x20failed\x20—\x20see\x20the\x20field\x27s\x20description\x20in\x20the\x20schema';}default:{return'Fix\x20the\x20value\x20at\x20\x27'+b['path']['join']('.')+'\x27\x20based\x20on\x20the\x20schema';}}}function formatZodErrorsStructured(a,b){return a['issues']['map'](c=>{const d=c['path']['length']>0x0?c['path']['map'](k=>typeof k==='number'?'['+k+']':k)['join']('.')['replace']('.[','['):'(root)',e=c['code'],f=c['message'],g=c;let h;if(e==='invalid_type'){const k=g['expected'],l=g['received'];typeof k==='string'&&typeof l==='string'&&(h=k);}else{if(e==='invalid_literal'){const m=g['expected'];m!==undefined&&(h=typeof m==='string'?m:JSON['stringify'](m));}else{if(e==='invalid_enum_value'){const n=g['options'];Array['isArray'](n)&&(h=n['map'](o=>JSON['stringify'](o))['join']('\x20|\x20'));}else{if(e==='too_big'||e==='too_small'){const o=g['maximum']??g['minimum'];o!==undefined&&(h=String(o));}}}}const i=extractValueAtPath(b,c['path']),j=generateSuggestion(e,c,i);return{'path':d,'code':e,'message':f,'expected':h,'received_value':i,'suggestion':j};});}function extractValueAtPath(a,b){if(a===undefined||a===null||b['length']===0x0)return undefined;let c=a;for(const d of b){if(c===undefined||c===null)return undefined;if(typeof d==='number'){if(!Array['isArray'](c))return undefined;c=c[d];}else{if(typeof c!=='object')return undefined;c=c[d];}}return c;}function checkUnknownFields(a,b){let c=a;while(!![]){const h=c['_def'];if(!h||h['typeName']!=='ZodEffects')break;c=h['schema']??c;}const d=c['_def'],e=d?.['shape']?.();if(!e||typeof b!=='object'||b===null)return[];const f=Object['keys'](e),g=Object['keys'](b);return g['filter'](i=>!f['includes'](i));}function extractRelevantSchema(a,b,c){if(b==='onchain_operations'&&typeof c==='object'&&c!==null){const d=c['operation_type'];if(typeof d==='string'){const e='onchain_operations_'+d,f=loadPreGeneratedSchema(e);if(f)return f;}}return a;}function isSchemaValidationError(a){return a['startsWith']('Unknown\x20')&&a['includes']('field')||a['includes']('expected')&&a['includes']('received')||a['includes']('Invalid\x20input')||a['includes']('Required');}function buildSchemaPreview(a,b,c){try{const d=['Schema\x20preview\x20for\x20'+b+':'];let e,g=[],h='';if(a['properties']&&typeof a['properties']==='object')e=a['properties'],g=Array['isArray'](a['required'])?a['required']:[],h=typeof a['description']==='string'?a['description']:'';else{if(Array['isArray'](a['oneOf'])||Array['isArray'](a['anyOf'])){const l=a['oneOf']??a['anyOf'];for(const m of l){if(m&&typeof m==='object'){const n=m;if(n['properties']&&typeof n['properties']==='object'){e=n['properties'],g=Array['isArray'](n['required'])?n['required']:[],h=typeof n['description']==='string'?n['description']:'';break;}}}if(!e)return d['push']('\x20\x20(discriminated\x20union\x20with\x20'+l['length']+'\x20variants\x20—\x20see\x20structuredContent\x20for\x20full\x20schema)'),d['join']('\x0a');}}h&&h['length']>0x0&&h['length']<0xc8&&d['push']('\x20\x20'+h);if(!e)return d['push']('\x20\x20(no\x20properties\x20available\x20—\x20see\x20structuredContent\x20for\x20full\x20schema)'),d['join']('\x0a');const i=new Set(g),j=g['length']>0x0?g['join'](',\x20'):'(none)',k=Object['keys'](e)['filter'](o=>!i['has'](o))['join'](',\x20');d['push']('Required:\x20'+j);k&&d['push']('Optional:\x20'+k);d['push']('Fields:');for(const [o,p]of Object['entries'](e)){if(p&&typeof p==='object'){const q=p,r=describeSchemaType(q),s=i['has'](o)?'required':'optional';let t=typeof q['description']==='string'?q['description']:'';if(t['length']>0x78)t=t['slice'](0x0,0x75)+'...';let u='';if(q['properties']&&typeof q['properties']==='object'){const w=Object['keys'](q['properties']);w['length']>0x0&&(u='\x20{\x20'+w['slice'](0x0,0x8)['join'](',\x20')+(w['length']>0x8?',\x20...':'')+'\x20}');}if(q['items']&&typeof q['items']==='object'){const x=q['items'],y=describeSchemaType(x);u='\x20(array\x20of\x20'+y+')';}Array['isArray'](q['enum'])&&(u='\x20(enum:\x20'+q['enum']['slice'](0x0,0x6)['map'](A=>JSON['stringify'](A))['join'](',\x20')+(q['enum']['length']>0x6?',\x20...':'')+')'),d['push']('\x20\x20-\x20'+o+'\x20('+r+',\x20'+s+')'+u+(t?'\x20—\x20'+t:''));}}if(b==='onchain_operations'&&typeof c==='object'&&c!==null){const A=c['operation_type'];typeof A==='string'&&(d['push'](''),d['push']('operation_type-specific\x20schema:\x20onchain_operations_'+A),d['push']('(Use\x20schema_query\x20with\x20action=\x27get\x27\x20and\x20name=\x27onchain_operations_'+A+'\x27\x20for\x20the\x20full\x20sub-schema.)'));}return d['join']('\x0a');}catch{return'Schema\x20preview\x20for\x20'+b+':\x20(unable\x20to\x20build\x20preview\x20—\x20see\x20structuredContent\x20for\x20full\x20schema)';}}function describeSchemaType(a){if(typeof a['type']==='string')return a['type'];if(Array['isArray'](a['type']))return a['type']['join']('|');if(a['$ref'])return'$ref';if(Array['isArray'](a['oneOf']))return'oneOf';if(Array['isArray'](a['anyOf']))return'anyOf';if(Array['isArray'](a['allOf']))return'allOf';if(a['enum'])return'enum';if(a['const'])return'const('+JSON['stringify'](a['const'])+')';return'object';}export async function dispatchToolCall(a,b,c){if(a==='wowok')return handleWowok(b);const d=TOOL_REGISTRY_MAP['get'](a);if(!d)throw new Error('Unknown\x20tool:\x20'+a+'.\x20Available:\x20'+TOOL_REGISTRY['map'](h=>h['name'])['join'](',\x20'));if(d['applyRules']&&!c?.['skipRules']){const h=d['applyRules'](b);if(h)return h;}const e=dispatchWithHarness(d['handler'],a),f=d['timeoutMs']??0xea60,g=wrapHandlerWithErrorShape(e,f,a,d['errorShapeBuilder']);return g(b);}const TOOL_FIELD_ALIASES=['tool','tool_name','name'],DATA_FIELD_ALIASES=['data','args','params','parameters'],RESERVED_FIELD_NAMES=new Set([...TOOL_FIELD_ALIASES,...DATA_FIELD_ALIASES]);function normalizeInput(a){const b=[];if(!a||typeof a!=='object'||Array['isArray'](a))return{'tool':undefined,'data':{},'normalizationNotes':['input\x20is\x20not\x20an\x20object']};const c=a;let d;for(const f of TOOL_FIELD_ALIASES){if(typeof c[f]==='string'&&c[f]){d=c[f];f!=='tool'&&b['push']('normalized\x20\x27'+f+'\x27\x20→\x20\x27tool\x27');break;}}let e;for(const g of DATA_FIELD_ALIASES){const h=c[g];if(h!==undefined&&h!==null&&typeof h==='object'&&!Array['isArray'](h)){e=h;g!=='data'&&b['push']('normalized\x20\x27'+g+'\x27\x20→\x20\x27data\x27');break;}}if(!e){const i={};let j=![];for(const k of Object['keys'](c)){!RESERVED_FIELD_NAMES['has'](k)&&(i[k]=c[k],j=!![]);}j?(e=i,b['push']('extracted\x20inline\x20params\x20→\x20\x27data\x27\x20(no\x20data\x20wrapper\x20was\x20provided)')):e={};}return{'tool':d,'data':e,'normalizationNotes':b};}async function handleWowok(a){const {tool:b,data:c,normalizationNotes:d}=normalizeInput(a);if(!b){const i=a&&typeof a==='object'&&!Array['isArray'](a)?Object['keys'](a)['join'](',\x20')||'(none)':'(non-object\x20input:\x20'+typeof a+')',j=['Missing\x20\x27tool\x27\x20field.\x20Received\x20keys:\x20'+i,'Expected\x20one\x20of:\x20'+SUB_TOOL_NAMES['join'](',\x20')];return{'content':[{'type':'text','text':'Missing\x20\x27tool\x27\x20field.\x20Call\x20format:\x20wowok({\x20tool:\x20\x22<sub-tool>\x22,\x20data:\x20{<params>}\x20}).\x20Received\x20keys:\x20'+i+'.\x20Available\x20sub-tools:\x20'+SUB_TOOL_NAMES['join'](',\x20')}],'structuredContent':{'result':{'status':'schema_mismatch','errors':j,'hint':'Provide\x20\x27tool\x27\x20(one\x20of:\x20'+SUB_TOOL_NAMES['join'](',\x20')+')\x20and\x20\x27data\x27\x20(sub-tool\x20parameters).\x20Aliases\x20accepted:\x20tool_name/name→tool,\x20args/params→data.','received':a},'schema':{'input':zodToJsonSchemaSafe(WowokToolDisplaySchema,'wowok'),'tool':'wowok'}}};}const e=TOOL_REGISTRY_MAP['get'](b);if(!e){const k=TOOL_REGISTRY['map'](l=>l['name'])['filter'](l=>l['includes'](b)||b['includes'](l))['slice'](0x0,0x5);return{'content':[{'type':'text','text':'Unknown\x20sub-tool:\x20\x27'+b+'\x27.\x20Available:\x20'+TOOL_REGISTRY['map'](l=>l['name'])['join'](',\x20')+(k['length']>0x0?'.\x20Did\x20you\x20mean:\x20'+k['join'](',\x20')+'?':'')}],'structuredContent':{'result':{'status':'error','errors':['Unknown\x20sub-tool:\x20'+b],'hint':'Available\x20sub-tools:\x20'+TOOL_REGISTRY['map'](l=>l['name'])['join'](',\x20')+(k['length']>0x0?'.\x20Did\x20you\x20mean:\x20'+k['join'](',\x20')+'?':''),'suggestions':k},'schema':null}};}d['length']>0x0&&console['warn']('[wowok]\x20input\x20normalization\x20for\x20\x27'+b+'\x27:\x20'+d['join'](';\x20'));const g=e['config']['inputSchema']['safeParse'](c),h=checkUnknownFields(e['config']['inputSchema'],c);if(!g['success']||h['length']>0x0){const l=[];!g['success']&&l['push'](...formatZodErrors(g['error'],c));h['length']>0x0&&l['push']('Unknown\x20field(s):\x20'+h['join'](',\x20'));const m=[];!g['success']&&m['push'](...formatZodErrorsStructured(g['error'],c));if(h['length']>0x0)for(const t of h){m['push']({'path':t,'code':'unrecognized_keys','message':'Unknown\x20field\x20\x27'+t+'\x27\x20is\x20not\x20allowed','suggestion':'Remove\x20field\x20\x27'+t+'\x27\x20or\x20check\x20the\x20schema\x20for\x20valid\x20field\x20names'});}const n=loadPreGeneratedSchema(b)??zodToJsonSchemaSafe(e['config']['inputSchema'],b),o=extractRelevantSchema(n,b,c),p=m[0x0]?.['suggestion']?'\x20FIRST\x20ERROR\x20SUGGESTION:\x20'+m[0x0]['suggestion']:'',q=l['slice'](0x0,0x5)['map']((u,v)=>'\x20\x20'+(v+0x1)+'.\x20'+u)['join']('\x0a'),r=buildSchemaPreview(o,b,c),s=['Schema\x20mismatch\x20for\x20'+b+'.\x20'+l['length']+'\x20error(s).'+p,q,'',r,'','Fix\x20the\x20parameters\x20based\x20on\x20the\x20errors\x20above\x20and\x20the\x20schema\x20summary,\x20then\x20retry.','Full\x20JSON\x20Schema\x20is\x20in\x20the\x20structuredContent.schema.input\x20field\x20(cache\x20it\x20for\x20future\x20'+b+'\x20calls).','Structured\x20errors\x20with\x20fix\x20suggestions\x20are\x20in\x20structuredContent.result.structured_errors\x20(ARCH-02).']['filter'](Boolean)['join']('\x0a');return{'content':[{'type':'text','text':s}],'structuredContent':{'result':{'status':'schema_mismatch','errors':l,'structured_errors':m,'hint':'Fix\x20your\x20parameters\x20based\x20on\x20the\x20schema\x20below\x20and\x20retry.\x20CACHE\x20THIS\x20SCHEMA\x20for\x20future\x20'+b+'\x20calls\x20—\x20you\x20don\x27t\x20need\x20to\x20query\x20it\x20again.'},'schema':{'input':o,'tool':b}}};}try{const u=await dispatchToolCall(b,c),v=u['structuredContent'],w=v?.['result'],x=w?.['status']==='error'||w?.['operation']==='error';if(x)return{'content':u['content'],'structuredContent':{'result':{'status':'error','data':u['structuredContent'],'errors':[u['content'][0x0]?.['text']??'Sub-tool\x20returned\x20an\x20error']},'schema':null}};return{'content':u['content'],'structuredContent':{'result':{'status':'success','data':u['structuredContent']},'schema':null}};}catch(y){const A=y instanceof Error?y['message']:String(y);if(isSchemaValidationError(A)){const B=loadPreGeneratedSchema(b)??zodToJsonSchemaSafe(e['config']['inputSchema'],b),C=extractRelevantSchema(B,b,c),D=buildSchemaPreview(C,b,c),E=[{'path':'(runtime)','code':'schema_validation_error','message':A,'suggestion':'Check\x20the\x20error\x20message\x20and\x20the\x20schema\x20below\x20for\x20the\x20correct\x20field\x20format'}],F=['Schema\x20mismatch\x20for\x20'+b+':\x20'+A,'',D,'','Fix\x20the\x20parameters\x20and\x20retry.\x20Full\x20JSON\x20Schema\x20is\x20in\x20structuredContent.schema.input.','Structured\x20errors\x20with\x20fix\x20suggestions\x20are\x20in\x20structuredContent.result.structured_errors\x20(ARCH-02).']['join']('\x0a');return{'content':[{'type':'text','text':F}],'structuredContent':{'result':{'status':'schema_mismatch','errors':[A],'structured_errors':E,'hint':'Fix\x20your\x20parameters\x20based\x20on\x20the\x20schema\x20below\x20and\x20retry.\x20CACHE\x20THIS\x20SCHEMA\x20for\x20future\x20'+b+'\x20calls.'},'schema':{'input':C,'tool':b}}};}return{'content':[{'type':'text','text':'Error:\x20'+A}],'structuredContent':{'result':{'status':'error','errors':[A]},'schema':null}};}}function zodToJsonSchemaSafe(a,b){try{const c=zodToJsonSchema(a,{'name':b,'$refStrategy':'root','basePath':['#'],'effectStrategy':'input'});if(c&&typeof c==='object'&&!Array['isArray'](c)){const {$schema:d,...e}=c;return e;}return{'type':'object'};}catch{return{'type':'object','additionalProperties':!![]};}}function resolveSchemaRefs(a){const b=new Set(['definitions','$schema','$id']);function c(e){if(!e['startsWith']('#/'))return null;const f=e['slice'](0x2)['split']('/');let g=a;for(const h of f){if(g==null||typeof g!=='object')return null;g=g[h];}return g;}function d(e,f){if(!e||typeof e!=='object')return e;if(Array['isArray'](e))return e['map'](i=>d(i,f));const g=e;if(typeof g['$ref']==='string'){const i=g['$ref'];if(f['has'](i))return{'type':'object','additionalProperties':!![]};const j=c(i);if(j&&typeof j==='object'&&!Array['isArray'](j)){const l=new Set(f);l['add'](i);const m=d(j,l),n={};for(const [o,p]of Object['entries'](g)){if(o!=='$ref'&&!b['has'](o))n[o]=p;}return{...m,...n};}return{'type':'object','additionalProperties':!![]};}const h={};for(const [q,r]of Object['entries'](g)){if(b['has'](q))continue;h[q]=d(r,f);}return h;}return d(a,new Set());}function loadPreGeneratedSchema(a){const b=preGeneratedSchemaCache['get'](a);if(b)return b;for(const c of SCHEMA_DIR_CANDIDATES){try{const d=join(c,a+'.schema.json'),e=readFileSync(d,'utf-8'),f=JSON['parse'](e),g=resolveSchemaRefs(f);return preGeneratedSchemaCache['set'](a,g),g;}catch{}}return null;}const preGeneratedOutputSchemaCache=new Map();function loadPreGeneratedOutputSchema(a){const b=preGeneratedOutputSchemaCache['get'](a);if(b)return b;for(const c of SCHEMA_DIR_CANDIDATES){try{const d=join(c,a+'.output.json'),e=readFileSync(d,'utf-8'),f=JSON['parse'](e),g=resolveSchemaRefs(f);return preGeneratedOutputSchemaCache['set'](a,g),g;}catch{}}return null;}export function listTools(){return[{'name':'wowok','title':'WoWok\x20MCP','description':WOWOK_TOOL_DESCRIPTION,'inputSchema':resolveSchemaRefs(zodToJsonSchemaSafe(WowokToolDisplaySchema,'wowok'))}];}export function registerAllTools(a){const b=0x1d4c0,c=wrapHandlerWithErrorShape(handleWowok,b,'wowok',undefined);a['registerTool']('wowok',{'title':'WoWok\x20MCP','description':WOWOK_TOOL_DESCRIPTION,'inputSchema':WowokToolRuntimeSchema,'annotations':{'readOnlyHint':![],'destructiveHint':!![],'idempotentHint':![],'openWorldHint':!![]}},withTelemetry('wowok',c)),overrideToolsListHandler(a);}function overrideToolsListHandler(a){a['server']['setRequestHandler'](ListToolsRequestSchema,()=>({'tools':[{'name':'wowok','title':'WoWok\x20MCP','description':WOWOK_TOOL_DESCRIPTION,'inputSchema':ensureObjectType(zodToJsonSchemaSafe(WowokToolDisplaySchema,'wowok')),'annotations':{'readOnlyHint':![],'destructiveHint':!![],'idempotentHint':![],'openWorldHint':!![]}}]}));}function ensureObjectType(a){if(a['type']==='object')return a;return{...a,'type':'object'};}