@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,500 +1 @@
1
- import { classifyError, buildDataSemantic, } from "../schema/call/semantic.js";
2
- import { buildClassifiedErrorResult } from "./shared.js";
3
- import { shouldRunLightHooks, shouldRunHeavyHooks, recordOperationFailure, recordCriticalRisk, recordCriticalOperation, recordSubstepFailure, } from "../harness/auto-escalation.js";
4
- import { getHarnessTier, setHarnessTier } from "../config/runtime.js";
5
- import { getHarness } from "../harness/index.js";
6
- import { recordOperationOutcome } from "../experience/index.js";
7
- import { recordIndustrySignal } from "../knowledge/flywheel-loop.js";
8
- import { getStageCache } from "../project/index.js";
9
- import { extractAmount, getAmountThreshold, formatAmount } from "../knowledge/safety-rules.js";
10
- export function withTimeout(promise, timeoutMs = 30000, operationName = "operation") {
11
- let timer;
12
- return Promise.race([
13
- promise.finally(() => {
14
- if (timer)
15
- clearTimeout(timer);
16
- }),
17
- new Promise((_, reject) => {
18
- timer = setTimeout(() => {
19
- let hint = "";
20
- if (operationName.includes("messenger")) {
21
- hint = " This is a messenger network operation. Possible causes: " +
22
- "(1) messenger server (https://messenger.wowok.net) unreachable, " +
23
- "(2) no messenger-enabled account configured (use account_operation to set messenger name), " +
24
- "(3) network connectivity issue. " +
25
- "Ensure you have a messenger-enabled account and the server is reachable.";
26
- }
27
- reject(new Error(`Operation '${operationName}' timed out after ${timeoutMs}ms.${hint}`));
28
- }, timeoutMs);
29
- }),
30
- ]);
31
- }
32
- export function wrapHandlerWithErrorShape(handler, timeoutMs, toolName, errorShapeBuilder) {
33
- return async (args) => {
34
- try {
35
- return await withTimeout(handler(args), timeoutMs, toolName);
36
- }
37
- catch (error) {
38
- if (errorShapeBuilder) {
39
- const errorMessage = error instanceof Error ? error.message : String(error);
40
- const classified = classifyError(errorMessage);
41
- const ctx = { operation_type: toolName, data: args };
42
- const structuredContent = errorShapeBuilder(errorMessage, classified, ctx);
43
- return {
44
- content: [{ type: "text", text: `Error: ${errorMessage}` }],
45
- structuredContent,
46
- };
47
- }
48
- throw error;
49
- }
50
- };
51
- }
52
- export const statusErrorShape = (error, classified, ctx) => ({
53
- result: buildClassifiedErrorResult({ status: "error" }, error, classified),
54
- semantic: buildDataSemantic(undefined, ctx, true, error),
55
- });
56
- export const operationErrorShape = (error, classified, ctx) => ({
57
- result: buildClassifiedErrorResult({ operation: "error" }, error, classified),
58
- semantic: buildDataSemantic(undefined, ctx, true, error),
59
- });
60
- export const strictStatusErrorShape = (error, _classified, _ctx) => ({
61
- result: { status: "error", error },
62
- });
63
- function checkProjectStage(action, project, version) {
64
- const stageOrder = {
65
- analyze_intent: 2,
66
- aggregate_risks: 3,
67
- generate_deployment_doc: 4,
68
- trace_substeps: 5,
69
- };
70
- const requiredStage = stageOrder[action];
71
- if (!requiredStage)
72
- return null;
73
- const entry = getStageCache(project, version);
74
- if (!entry) {
75
- if (action === "analyze_intent") {
76
- return null;
77
- }
78
- return `project_stage: calling '${action}' before 'analyze_intent' — recommend calling analyze_intent first for project '${project}:${version}'`;
79
- }
80
- if (entry.stage < requiredStage - 1) {
81
- return `project_stage: calling '${action}' (stage ${requiredStage}) but project is at stage ${entry.stage} — recommend completing prior stages first for '${project}:${version}'`;
82
- }
83
- if (action === "generate_deployment_doc" && entry.risk_can_proceed === false) {
84
- return `project_stage: calling 'generate_deployment_doc' but CRITICAL risks are unresolved — recommend fixing risks first for '${project}:${version}'`;
85
- }
86
- if (action === "trace_substeps" && entry.doc_error_count && entry.doc_error_count > 0) {
87
- return `project_stage: calling 'trace_substeps' but deployment doc has ${entry.doc_error_count} D-error(s) — recommend fixing doc errors first for '${project}:${version}'`;
88
- }
89
- return null;
90
- }
91
- export function dispatchWithHarness(handler, toolName) {
92
- return async (args) => {
93
- const harnessWarnings = [];
94
- const harness = getHarness();
95
- const runLight = shouldRunLightHooks();
96
- const runHeavy = shouldRunHeavyHooks();
97
- const publishIntent = isPublishOperation(toolName, args);
98
- const signIntent = isSignOperation(toolName, args);
99
- const tierNow = getHarnessTier();
100
- let expectedResult;
101
- if (runLight) {
102
- try {
103
- const operationType = extractOperationType(toolName, args);
104
- const intent = extractIntent(toolName, args);
105
- if (operationType && intent) {
106
- expectedResult = harness.expect(toolName, intent, operationType, extractData(args));
107
- }
108
- }
109
- catch (e) {
110
- harnessWarnings.push(`pre_call hook failed: ${e instanceof Error ? e.message : String(e)}`);
111
- }
112
- }
113
- if (toolName === "project_operation" && runLight) {
114
- try {
115
- const projArgs = args;
116
- const action = projArgs?.action;
117
- const project = projArgs?.project;
118
- const version = projArgs?.version;
119
- if (action && project && version) {
120
- const stageCheck = checkProjectStage(action, project, version);
121
- if (stageCheck) {
122
- harnessWarnings.push(stageCheck);
123
- }
124
- }
125
- }
126
- catch {
127
- }
128
- }
129
- if (publishIntent && tierNow === "lightweight") {
130
- setHarnessTier("full");
131
- harnessWarnings.push("pre_publish: tier forced to full for publish-class operation (GLM5-21 §3.3)");
132
- }
133
- if (publishIntent && tierNow !== "off") {
134
- try {
135
- const check = runPrePublishChecks(toolName, args);
136
- harnessWarnings.push(...check.warnings);
137
- if (check.critical.length > 0) {
138
- for (const c of check.critical) {
139
- const esc = recordCriticalRisk(c);
140
- if (esc)
141
- harnessWarnings.push(`Harness escalated to full tier: ${esc.reason}`);
142
- }
143
- return buildHarnessBlockResult("pre_publish", `Publish BLOCKED by Harness pre-publish gate (GLM5-21 V6): ` +
144
- `${check.critical.length} CRITICAL risk(s) must be resolved before publish.`, check.critical, check.warnings, "immutable_violation", "Fix the CRITICAL risks listed in the message (e.g. rename dispute/refund nodes per R-M1-11, add the entry pair prev_node=\"\"), then retry publish. Nodes/pairs/forwards are immutable after publish — verify via machineNode2file first.");
145
- }
146
- }
147
- catch (e) {
148
- harnessWarnings.push(`pre_publish hook failed: ${e instanceof Error ? e.message : String(e)}`);
149
- }
150
- }
151
- if (signIntent && runHeavy) {
152
- try {
153
- const data = extractData(args);
154
- const amt = data ? extractAmount(data) : null;
155
- if (amt !== null) {
156
- const threshold = getAmountThreshold();
157
- let value = null;
158
- try {
159
- value = BigInt(amt);
160
- }
161
- catch {
162
- value = null;
163
- }
164
- if (value !== null && value > threshold) {
165
- return buildHarnessBlockResult("pre_sign", `Sign BLOCKED by Harness pre-sign gate (GLM5-21 V7): amount ${formatAmount(value)} WOW exceeds the full-tier threshold ${formatAmount(threshold)} WOW.`, [`amount ${amt} (smallest unit) > threshold ${threshold.toString()} (smallest unit)`], [], "invalid_parameter", "Raise WOWOK_AMOUNT_THRESHOLD to match the intended amount, split the transaction, or reset the harness tier to lightweight (config_operation) after explicit user confirmation.");
166
- }
167
- }
168
- }
169
- catch (e) {
170
- harnessWarnings.push(`pre_sign hook failed: ${e instanceof Error ? e.message : String(e)}`);
171
- }
172
- }
173
- let result;
174
- try {
175
- result = await handler(args);
176
- }
177
- catch (e) {
178
- const errorCode = e instanceof Error ? e.message : String(e);
179
- const escalation = recordOperationFailure(toolName, errorCode);
180
- if (escalation) {
181
- harnessWarnings.push(`Harness escalated to full tier: ${escalation.reason}`);
182
- }
183
- if (toolName === "onchain_operations") {
184
- try {
185
- const classified = classifyError(errorCode, e);
186
- if (!classified.retryable && classified.error_code !== "unknown") {
187
- const esc2 = recordCriticalOperation(toolName, classified.error_code);
188
- if (esc2)
189
- harnessWarnings.push(`Harness escalated to full tier: ${esc2.reason}`);
190
- }
191
- }
192
- catch { }
193
- }
194
- throw e;
195
- }
196
- if (runLight && expectedResult) {
197
- try {
198
- if (result?.structuredContent) {
199
- const verifyInput = buildVerifyInput(expectedResult, result);
200
- const report = harness.verify(verifyInput);
201
- if (report.status === "fail") {
202
- harnessWarnings.push(`Harness verify FAIL: ${report.summary}`);
203
- }
204
- else if (report.status === "warn") {
205
- harnessWarnings.push(`Harness verify WARN: ${report.summary}`);
206
- }
207
- }
208
- }
209
- catch (e) {
210
- harnessWarnings.push(`post_call hook failed: ${e instanceof Error ? e.message : String(e)}`);
211
- }
212
- }
213
- if (toolName === "onchain_operations") {
214
- try {
215
- if (classifyOutcome(result) === "failed") {
216
- const errText = extractErrorCode(result) ?? "";
217
- const classified = classifyError(errText);
218
- if (!classified.retryable && classified.error_code !== "unknown") {
219
- const esc = recordCriticalOperation(toolName, classified.error_code);
220
- if (esc)
221
- harnessWarnings.push(`Harness escalated to full tier: ${esc.reason}`);
222
- }
223
- }
224
- }
225
- catch { }
226
- }
227
- if (toolName === "project_operation") {
228
- try {
229
- const action = args?.action;
230
- if (action === "generate_deployment_doc" || action === "trace_substeps") {
231
- const crit = extractCriticalFindingCount(result);
232
- if (crit > 0) {
233
- const esc = recordSubstepFailure(`${String(action)}: ${crit} critical finding(s)`);
234
- if (esc)
235
- harnessWarnings.push(`Harness escalated to full tier: ${esc.reason}`);
236
- }
237
- }
238
- }
239
- catch { }
240
- }
241
- if (isWriteClassTool(toolName)) {
242
- try {
243
- const operationType = extractOperationType(toolName, args) ?? toolName;
244
- const intent = extractIntent(toolName, args) ?? toolName;
245
- const data = extractData(args) ?? args;
246
- const outcome = classifyOutcome(result);
247
- const errorCode = extractErrorCode(result);
248
- const industry = extractIndustry(args) ?? "general";
249
- recordOperationOutcome(operationType, data, intent, outcome, errorCode);
250
- recordIndustrySignal(industry, { type: operationType }, {
251
- success: outcome === "success",
252
- error_code: errorCode,
253
- });
254
- }
255
- catch (e) {
256
- harnessWarnings.push(`signal collection failed: ${e instanceof Error ? e.message : String(e)}`);
257
- }
258
- }
259
- if (harnessWarnings.length > 0) {
260
- if (result?.structuredContent) {
261
- const sc = result.structuredContent;
262
- const semantic = sc.semantic;
263
- if (semantic) {
264
- const existing = Array.isArray(semantic.warnings) ? semantic.warnings : [];
265
- semantic.warnings = [...existing, ...harnessWarnings];
266
- }
267
- else {
268
- for (const w of harnessWarnings) {
269
- console.warn(`[harness] ${w}`);
270
- }
271
- }
272
- }
273
- else {
274
- for (const w of harnessWarnings) {
275
- console.warn(`[harness] ${w}`);
276
- }
277
- }
278
- }
279
- return result;
280
- };
281
- }
282
- function isPublishOperation(toolName, args) {
283
- if (toolName !== "onchain_operations")
284
- return false;
285
- const opType = extractOperationType(toolName, args);
286
- if (opType !== "service" && opType !== "machine")
287
- return false;
288
- const data = extractData(args);
289
- return data?.publish === true || data?.bPublished === true;
290
- }
291
- function isSignOperation(toolName, args) {
292
- if (toolName === "wip_file") {
293
- const data = args?.operation_type;
294
- return data === "sign";
295
- }
296
- return toolName === "onchain_operations";
297
- }
298
- function extractOperationType(toolName, args) {
299
- if (!args || typeof args !== "object")
300
- return undefined;
301
- const obj = args;
302
- if (toolName === "onchain_operations") {
303
- return typeof obj.operation_type === "string" ? obj.operation_type : undefined;
304
- }
305
- if (toolName === "project_operation") {
306
- return typeof obj.action === "string" ? obj.action : undefined;
307
- }
308
- return typeof obj.operation_type === "string" ? obj.operation_type : undefined;
309
- }
310
- function extractIntent(toolName, args) {
311
- if (!args || typeof args !== "object")
312
- return undefined;
313
- const obj = args;
314
- if (toolName === "project_operation" && typeof obj.action === "string") {
315
- return `project:${obj.action}`;
316
- }
317
- const opType = obj.operation_type;
318
- if (typeof opType === "string")
319
- return `${toolName}:${opType}`;
320
- return toolName;
321
- }
322
- function extractData(args) {
323
- if (!args || typeof args !== "object")
324
- return undefined;
325
- const obj = args;
326
- const data = obj.data;
327
- return data && typeof data === "object" ? data : undefined;
328
- }
329
- function buildVerifyInput(expected, result) {
330
- const sc = (result.structuredContent ?? {});
331
- const semantic = sc.semantic;
332
- return {
333
- expected,
334
- actual: {
335
- result_type: typeof sc.result_type === "string" ? sc.result_type : undefined,
336
- semantic,
337
- error_code: typeof sc.error_code === "string" ? sc.error_code : undefined,
338
- error: typeof sc.error === "string" ? sc.error : undefined,
339
- },
340
- };
341
- }
342
- const WRITE_CLASS_TOOLS = new Set([
343
- "onchain_operations",
344
- "project_operation",
345
- "wip_file",
346
- "messenger_operation",
347
- "bridge_operation",
348
- ]);
349
- function isWriteClassTool(toolName) {
350
- return WRITE_CLASS_TOOLS.has(toolName);
351
- }
352
- function classifyOutcome(result) {
353
- if (!result?.structuredContent)
354
- return "failed";
355
- const sc = result.structuredContent;
356
- const status = typeof sc.status === "string" ? sc.status
357
- : typeof sc.result_type === "string" ? sc.result_type
358
- : "";
359
- if (status === "error" || status === "failed")
360
- return "failed";
361
- if (status === "partial")
362
- return "partial";
363
- return "success";
364
- }
365
- function extractErrorCode(result) {
366
- if (!result?.structuredContent)
367
- return undefined;
368
- const sc = result.structuredContent;
369
- if (typeof sc.error_code === "string")
370
- return sc.error_code;
371
- const err = sc.error;
372
- if (typeof err === "string")
373
- return err;
374
- if (err && typeof err === "object") {
375
- const code = err.code;
376
- if (typeof code === "string")
377
- return code;
378
- }
379
- return undefined;
380
- }
381
- function extractIndustry(args) {
382
- if (!args || typeof args !== "object")
383
- return undefined;
384
- const obj = args;
385
- if (typeof obj.industry === "string")
386
- return obj.industry;
387
- const data = obj.data;
388
- if (data && typeof data === "object") {
389
- const d = data;
390
- if (typeof d.industry === "string")
391
- return d.industry;
392
- }
393
- return undefined;
394
- }
395
- const ANTI_PATTERN_NODE_REGEX = /(^|_)(disputed?|refund(?:ed)?|arbitration|arb)(_|$)/i;
396
- function runPrePublishChecks(toolName, args) {
397
- const critical = [];
398
- const warnings = [];
399
- const opType = extractOperationType(toolName, args);
400
- const data = extractData(args) ?? {};
401
- if (opType === "machine") {
402
- const nodeOp = data.node;
403
- const nodes = Array.isArray(nodeOp)
404
- ? nodeOp
405
- : Array.isArray(nodeOp?.nodes)
406
- ? nodeOp.nodes
407
- : [];
408
- if (nodes.length > 0) {
409
- for (const n of nodes) {
410
- const name = typeof n?.name === "string" ? n.name : "";
411
- if (name && ANTI_PATTERN_NODE_REGEX.test(name)) {
412
- critical.push(`R-M1-11: machine node "${name}" models dispute/refund flow — ` +
413
- `refunds must route via an Allocator triggered by business states, ` +
414
- `disputes via the separate Arbitration object (off-Machine)`);
415
- }
416
- }
417
- const seen = new Set();
418
- for (const n of nodes) {
419
- const name = typeof n?.name === "string" ? n.name : "";
420
- if (!name)
421
- continue;
422
- if (seen.has(name)) {
423
- critical.push(`MC-C-04: duplicate machine node name "${name}" — on-chain will reject the publish transaction`);
424
- }
425
- seen.add(name);
426
- }
427
- const hasEntry = nodes.some((n) => Array.isArray(n?.pairs) && n.pairs.some((p) => p?.prev_node === ""));
428
- if (!hasEntry) {
429
- critical.push(`Machine has no entry pair (prev_node="") — Progress can never advance ` +
430
- `from the initial state; orders are permanently stuck`);
431
- }
432
- for (const n of nodes) {
433
- const nodeName = typeof n?.name === "string" ? n.name : "?";
434
- for (const p of n?.pairs ?? []) {
435
- for (const f of (p?.forwards ?? [])) {
436
- const hasOp = f?.namedOperator !== undefined && f?.namedOperator !== null;
437
- const hasIdx = f?.permissionIndex !== undefined && f?.permissionIndex !== null;
438
- if (!hasOp && !hasIdx) {
439
- warnings.push(`pre_publish: node "${nodeName}" forward "${String(f?.name ?? "?")}" has neither namedOperator nor permissionIndex — no one can advance it`);
440
- }
441
- }
442
- }
443
- }
444
- }
445
- else {
446
- warnings.push("pre_publish: publishing machine without inline node data — topology not verifiable in this call; " +
447
- "verify nodes/pairs/forwards via machineNode2file BEFORE publish (immutable after publish, IMMUT-001)");
448
- }
449
- warnings.push("pre_publish: machine nodes/pairs/forwards become immutable after publish (IMMUT-001)");
450
- }
451
- if (opType === "service") {
452
- warnings.push("pre_publish: service machine/order_allocators/arbitrations become immutable after publish (IMMUT-002); sales remains modifiable");
453
- if (data.machine === undefined) {
454
- warnings.push("pre_publish: 'machine' not set in this call — if the service was never bound to a published machine, " +
455
- "it cannot process orders and CANNOT be fixed after publish");
456
- }
457
- if (data.order_allocators === undefined) {
458
- warnings.push("pre_publish: 'order_allocators' not set in this call — immutable after publish; " +
459
- "orders will have no fund distribution if never configured");
460
- }
461
- }
462
- return { critical, warnings };
463
- }
464
- function buildHarnessBlockResult(gate, reason, critical, warnings, errorCode, recoveryHint) {
465
- const detail = [
466
- ...critical.map((c) => `CRITICAL: ${c}`),
467
- ...warnings.map((w) => `WARN: ${w}`),
468
- ].join("\n");
469
- const text = `Error: ${reason}${detail ? `\n${detail}` : ""}\nRecovery: ${recoveryHint}`;
470
- return {
471
- content: [{ type: "text", text }],
472
- structuredContent: {
473
- result: {
474
- type: "error",
475
- error: `${reason} [gate=${gate}]`,
476
- error_code: errorCode,
477
- retryable: false,
478
- recovery_hint: recoveryHint,
479
- },
480
- message: text,
481
- },
482
- };
483
- }
484
- function extractCriticalFindingCount(result) {
485
- const sc = result?.structuredContent;
486
- if (!sc)
487
- return 0;
488
- const semantic = sc.semantic;
489
- const summary = semantic?.summary;
490
- if (typeof summary?.critical_count === "number" && summary.critical_count > 0) {
491
- return summary.critical_count;
492
- }
493
- const findings = (sc.findings ?? semantic?.findings);
494
- if (Array.isArray(findings)) {
495
- return findings.filter((f) => f?.severity === "error").length;
496
- }
497
- const text = result?.content?.map((c) => ("text" in c ? c.text : "")).join("\n") ?? "";
498
- const matches = text.match(/\[AUDIT ERROR\]/g);
499
- return matches ? matches.length : 0;
500
- }
1
+ import{classifyError,buildDataSemantic}from'../schema/call/semantic.js';import{buildClassifiedErrorResult}from'./shared.js';import{shouldRunLightHooks,shouldRunHeavyHooks,recordOperationFailure,recordCriticalRisk,recordCriticalOperation,recordSubstepFailure}from'../harness/auto-escalation.js';import{getHarnessTier,setHarnessTier}from'../config/runtime.js';import{getHarness}from'../harness/index.js';import{recordOperationOutcome}from'../experience/index.js';import{recordIndustrySignal}from'../knowledge/flywheel-loop.js';import{getStageCache}from'../project/index.js';import{extractAmount,getAmountThreshold,formatAmount}from'../knowledge/safety-rules.js';export function withTimeout(a,b=0x7530,c='operation'){let d;return Promise['race']([a['finally'](()=>{if(d)clearTimeout(d);}),new Promise((e,f)=>{d=setTimeout(()=>{let g='';c['includes']('messenger')&&(g='\x20This\x20is\x20a\x20messenger\x20network\x20operation.\x20Possible\x20causes:\x20'+'(1)\x20messenger\x20server\x20(https://messenger.wowok.net)\x20unreachable,\x20'+'(2)\x20no\x20messenger-enabled\x20account\x20configured\x20(use\x20account_operation\x20to\x20set\x20messenger\x20name),\x20'+'(3)\x20network\x20connectivity\x20issue.\x20'+'Ensure\x20you\x20have\x20a\x20messenger-enabled\x20account\x20and\x20the\x20server\x20is\x20reachable.'),f(new Error('Operation\x20\x27'+c+'\x27\x20timed\x20out\x20after\x20'+b+'ms.'+g));},b);})]);}export function wrapHandlerWithErrorShape(a,b,c,d){return async e=>{try{return await withTimeout(a(e),b,c);}catch(f){if(d){const g=f instanceof Error?f['message']:String(f),h=classifyError(g),i={'operation_type':c,'data':e},j=d(g,h,i);return{'content':[{'type':'text','text':'Error:\x20'+g}],'structuredContent':j};}throw f;}};}export const statusErrorShape=(a,b,c)=>({'result':buildClassifiedErrorResult({'status':'error'},a,b),'semantic':buildDataSemantic(undefined,c,!![],a)});export const operationErrorShape=(a,b,c)=>({'result':buildClassifiedErrorResult({'operation':'error'},a,b),'semantic':buildDataSemantic(undefined,c,!![],a)});export const strictStatusErrorShape=(a,b,c)=>({'result':{'status':'error','error':a}});function checkProjectStage(a,b,c){const d={'analyze_intent':0x2,'aggregate_risks':0x3,'generate_deployment_doc':0x4,'trace_substeps':0x5},e=d[a];if(!e)return null;const f=getStageCache(b,c);if(!f){if(a==='analyze_intent')return null;return'project_stage:\x20calling\x20\x27'+a+'\x27\x20before\x20\x27analyze_intent\x27\x20—\x20recommend\x20calling\x20analyze_intent\x20first\x20for\x20project\x20\x27'+b+':'+c+'\x27';}if(f['stage']<e-0x1)return'project_stage:\x20calling\x20\x27'+a+'\x27\x20(stage\x20'+e+')\x20but\x20project\x20is\x20at\x20stage\x20'+f['stage']+'\x20—\x20recommend\x20completing\x20prior\x20stages\x20first\x20for\x20\x27'+b+':'+c+'\x27';if(a==='generate_deployment_doc'&&f['risk_can_proceed']===![])return'project_stage:\x20calling\x20\x27generate_deployment_doc\x27\x20but\x20CRITICAL\x20risks\x20are\x20unresolved\x20—\x20recommend\x20fixing\x20risks\x20first\x20for\x20\x27'+b+':'+c+'\x27';if(a==='trace_substeps'&&f['doc_error_count']&&f['doc_error_count']>0x0)return'project_stage:\x20calling\x20\x27trace_substeps\x27\x20but\x20deployment\x20doc\x20has\x20'+f['doc_error_count']+'\x20D-error(s)\x20—\x20recommend\x20fixing\x20doc\x20errors\x20first\x20for\x20\x27'+b+':'+c+'\x27';return null;}export function dispatchWithHarness(a,b){return async d=>{const f=[],g=getHarness(),h=shouldRunLightHooks(),i=shouldRunHeavyHooks(),j=isPublishOperation(b,d),k=isSignOperation(b,d),l=getHarnessTier();let m;if(h)try{const o=extractOperationType(b,d),p=extractIntent(b,d);o&&p&&(m=g['expect'](b,p,o,extractData(d)));}catch(q){f['push']('pre_call\x20hook\x20failed:\x20'+(q instanceof Error?q['message']:String(q)));}if(b==='project_operation'&&h)try{const r=d,s=r?.['action'],t=r?.['project'],u=r?.['version'];if(s&&t&&u){const v=checkProjectStage(s,t,u);v&&f['push'](v);}}catch{}j&&l==='lightweight'&&(setHarnessTier('full'),f['push']('pre_publish:\x20tier\x20forced\x20to\x20full\x20for\x20publish-class\x20operation\x20(GLM5-21\x20§3.3)'));if(j&&l!=='off')try{const x=runPrePublishChecks(b,d);f['push'](...x['warnings']);if(x['critical']['length']>0x0){for(const y of x['critical']){const z=recordCriticalRisk(y);if(z)f['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+z['reason']);}return buildHarnessBlockResult('pre_publish','Publish\x20BLOCKED\x20by\x20Harness\x20pre-publish\x20gate\x20(GLM5-21\x20V6):\x20'+(x['critical']['length']+'\x20CRITICAL\x20risk(s)\x20must\x20be\x20resolved\x20before\x20publish.'),x['critical'],x['warnings'],'immutable_violation','Fix\x20the\x20CRITICAL\x20risks\x20listed\x20in\x20the\x20message\x20(e.g.\x20rename\x20dispute/refund\x20nodes\x20per\x20R-M1-11,\x20add\x20the\x20entry\x20pair\x20prev_node=\x22\x22),\x20then\x20retry\x20publish.\x20Nodes/pairs/forwards\x20are\x20immutable\x20after\x20publish\x20—\x20verify\x20via\x20machineNode2file\x20first.');}}catch(A){f['push']('pre_publish\x20hook\x20failed:\x20'+(A instanceof Error?A['message']:String(A)));}if(k&&i)try{const B=extractData(d),C=B?extractAmount(B):null;if(C!==null){const D=getAmountThreshold();let E=null;try{E=BigInt(C);}catch{E=null;}if(E!==null&&E>D)return buildHarnessBlockResult('pre_sign','Sign\x20BLOCKED\x20by\x20Harness\x20pre-sign\x20gate\x20(GLM5-21\x20V7):\x20amount\x20'+formatAmount(E)+'\x20WOW\x20exceeds\x20the\x20full-tier\x20threshold\x20'+formatAmount(D)+'\x20WOW.',['amount\x20'+C+'\x20(smallest\x20unit)\x20>\x20threshold\x20'+D['toString']()+'\x20(smallest\x20unit)'],[],'invalid_parameter','Raise\x20WOWOK_AMOUNT_THRESHOLD\x20to\x20match\x20the\x20intended\x20amount,\x20split\x20the\x20transaction,\x20or\x20reset\x20the\x20harness\x20tier\x20to\x20lightweight\x20(config_operation)\x20after\x20explicit\x20user\x20confirmation.');}}catch(F){f['push']('pre_sign\x20hook\x20failed:\x20'+(F instanceof Error?F['message']:String(F)));}let n;try{n=await a(d);}catch(G){const H=G instanceof Error?G['message']:String(G),I=recordOperationFailure(b,H);I&&f['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+I['reason']);if(b==='onchain_operations')try{const J=classifyError(H,G);if(!J['retryable']&&J['error_code']!=='unknown'){const K=recordCriticalOperation(b,J['error_code']);if(K)f['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+K['reason']);}}catch{}throw G;}if(h&&m)try{if(n?.['structuredContent']){const L=buildVerifyInput(m,n),M=g['verify'](L);if(M['status']==='fail')f['push']('Harness\x20verify\x20FAIL:\x20'+M['summary']);else M['status']==='warn'&&f['push']('Harness\x20verify\x20WARN:\x20'+M['summary']);}}catch(N){f['push']('post_call\x20hook\x20failed:\x20'+(N instanceof Error?N['message']:String(N)));}if(b==='onchain_operations')try{if(classifyOutcome(n)==='failed'){const O=extractErrorCode(n)??'',P=classifyError(O);if(!P['retryable']&&P['error_code']!=='unknown'){const Q=recordCriticalOperation(b,P['error_code']);if(Q)f['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+Q['reason']);}}}catch{}if(b==='project_operation')try{const R=d?.['action'];if(R==='generate_deployment_doc'||R==='trace_substeps'){const S=extractCriticalFindingCount(n);if(S>0x0){const T=recordSubstepFailure(String(R)+':\x20'+S+'\x20critical\x20finding(s)');if(T)f['push']('Harness\x20escalated\x20to\x20full\x20tier:\x20'+T['reason']);}}}catch{}if(isWriteClassTool(b))try{const U=extractOperationType(b,d)??b,V=extractIntent(b,d)??b,W=extractData(d)??d,X=classifyOutcome(n),Y=extractErrorCode(n),Z=extractIndustry(d)??'general';recordOperationOutcome(U,W,V,X,Y),recordIndustrySignal(Z,{'type':U},{'success':X==='success','error_code':Y});}catch(a0){f['push']('signal\x20collection\x20failed:\x20'+(a0 instanceof Error?a0['message']:String(a0)));}if(f['length']>0x0){if(n?.['structuredContent']){const a1=n['structuredContent'],a2=a1['semantic'];if(a2){const a3=Array['isArray'](a2['warnings'])?a2['warnings']:[];a2['warnings']=[...a3,...f];}else for(const a4 of f){console['warn']('[harness]\x20'+a4);}}else for(const a5 of f){console['warn']('[harness]\x20'+a5);}}return n;};}function isPublishOperation(a,b){if(a!=='onchain_operations')return![];const c=extractOperationType(a,b);if(c!=='service'&&c!=='machine')return![];const d=extractData(b);return d?.['publish']===!![]||d?.['bPublished']===!![];}function isSignOperation(a,b){if(a==='wip_file'){const c=b?.['operation_type'];return c==='sign';}return a==='onchain_operations';}function extractOperationType(a,b){if(!b||typeof b!=='object')return undefined;const c=b;if(a==='onchain_operations')return typeof c['operation_type']==='string'?c['operation_type']:undefined;if(a==='project_operation')return typeof c['action']==='string'?c['action']:undefined;return typeof c['operation_type']==='string'?c['operation_type']:undefined;}function extractIntent(a,b){if(!b||typeof b!=='object')return undefined;const c=b;if(a==='project_operation'&&typeof c['action']==='string')return'project:'+c['action'];const d=c['operation_type'];if(typeof d==='string')return a+':'+d;return a;}function extractData(a){if(!a||typeof a!=='object')return undefined;const b=a,c=b['data'];return c&&typeof c==='object'?c:undefined;}function buildVerifyInput(a,b){const c=b['structuredContent']??{},d=c['semantic'];return{'expected':a,'actual':{'result_type':typeof c['result_type']==='string'?c['result_type']:undefined,'semantic':d,'error_code':typeof c['error_code']==='string'?c['error_code']:undefined,'error':typeof c['error']==='string'?c['error']:undefined}};}const WRITE_CLASS_TOOLS=new Set(['onchain_operations','project_operation','wip_file','messenger_operation','bridge_operation']);function isWriteClassTool(a){return WRITE_CLASS_TOOLS['has'](a);}function classifyOutcome(a){if(!a?.['structuredContent'])return'failed';const b=a['structuredContent'],c=typeof b['status']==='string'?b['status']:typeof b['result_type']==='string'?b['result_type']:'';if(c==='error'||c==='failed')return'failed';if(c==='partial')return'partial';return'success';}function extractErrorCode(a){if(!a?.['structuredContent'])return undefined;const b=a['structuredContent'];if(typeof b['error_code']==='string')return b['error_code'];const c=b['error'];if(typeof c==='string')return c;if(c&&typeof c==='object'){const d=c['code'];if(typeof d==='string')return d;}return undefined;}function extractIndustry(a){if(!a||typeof a!=='object')return undefined;const b=a;if(typeof b['industry']==='string')return b['industry'];const c=b['data'];if(c&&typeof c==='object'){const e=c;if(typeof e['industry']==='string')return e['industry'];}return undefined;}const ANTI_PATTERN_NODE_REGEX=/(^|_)(disputed?|refund(?:ed)?|arbitration|arb)(_|$)/i;function runPrePublishChecks(a,b){const c=[],d=[],e=extractOperationType(a,b),g=extractData(b)??{};if(e==='machine'){const h=g['node'],i=Array['isArray'](h)?h:Array['isArray'](h?.['nodes'])?h['nodes']:[];if(i['length']>0x0){for(const l of i){const m=typeof l?.['name']==='string'?l['name']:'';m&&ANTI_PATTERN_NODE_REGEX['test'](m)&&c['push']('R-M1-11:\x20machine\x20node\x20\x22'+m+'\x22\x20models\x20dispute/refund\x20flow\x20—\x20'+'refunds\x20must\x20route\x20via\x20an\x20Allocator\x20triggered\x20by\x20business\x20states,\x20'+'disputes\x20via\x20the\x20separate\x20Arbitration\x20object\x20(off-Machine)');}const j=new Set();for(const o of i){const q=typeof o?.['name']==='string'?o['name']:'';if(!q)continue;j['has'](q)&&c['push']('MC-C-04:\x20duplicate\x20machine\x20node\x20name\x20\x22'+q+'\x22\x20—\x20on-chain\x20will\x20reject\x20the\x20publish\x20transaction'),j['add'](q);}const k=i['some'](r=>Array['isArray'](r?.['pairs'])&&r['pairs']['some'](s=>s?.['prev_node']===''));!k&&c['push']('Machine\x20has\x20no\x20entry\x20pair\x20(prev_node=\x22\x22)\x20—\x20Progress\x20can\x20never\x20advance\x20'+'from\x20the\x20initial\x20state;\x20orders\x20are\x20permanently\x20stuck');for(const r of i){const s=typeof r?.['name']==='string'?r['name']:'?';for(const t of r?.['pairs']??[]){for(const u of t?.['forwards']??[]){const v=u?.['namedOperator']!==undefined&&u?.['namedOperator']!==null,w=u?.['permissionIndex']!==undefined&&u?.['permissionIndex']!==null;!v&&!w&&d['push']('pre_publish:\x20node\x20\x22'+s+'\x22\x20forward\x20\x22'+String(u?.['name']??'?')+'\x22\x20has\x20neither\x20namedOperator\x20nor\x20permissionIndex\x20—\x20no\x20one\x20can\x20advance\x20it');}}}}else d['push']('pre_publish:\x20publishing\x20machine\x20without\x20inline\x20node\x20data\x20—\x20topology\x20not\x20verifiable\x20in\x20this\x20call;\x20'+'verify\x20nodes/pairs/forwards\x20via\x20machineNode2file\x20BEFORE\x20publish\x20(immutable\x20after\x20publish,\x20IMMUT-001)');d['push']('pre_publish:\x20machine\x20nodes/pairs/forwards\x20become\x20immutable\x20after\x20publish\x20(IMMUT-001)');}return e==='service'&&(d['push']('pre_publish:\x20service\x20machine/order_allocators/arbitrations\x20become\x20immutable\x20after\x20publish\x20(IMMUT-002);\x20sales\x20remains\x20modifiable'),g['machine']===undefined&&d['push']('pre_publish:\x20\x27machine\x27\x20not\x20set\x20in\x20this\x20call\x20—\x20if\x20the\x20service\x20was\x20never\x20bound\x20to\x20a\x20published\x20machine,\x20'+'it\x20cannot\x20process\x20orders\x20and\x20CANNOT\x20be\x20fixed\x20after\x20publish'),g['order_allocators']===undefined&&d['push']('pre_publish:\x20\x27order_allocators\x27\x20not\x20set\x20in\x20this\x20call\x20—\x20immutable\x20after\x20publish;\x20'+'orders\x20will\x20have\x20no\x20fund\x20distribution\x20if\x20never\x20configured')),{'critical':c,'warnings':d};}function buildHarnessBlockResult(a,b,c,d,e,f){const g=[...c['map'](i=>'CRITICAL:\x20'+i),...d['map'](i=>'WARN:\x20'+i)]['join']('\x0a'),h='Error:\x20'+b+(g?'\x0a'+g:'')+'\x0aRecovery:\x20'+f;return{'content':[{'type':'text','text':h}],'structuredContent':{'result':{'type':'error','error':b+'\x20[gate='+a+']','error_code':e,'retryable':![],'recovery_hint':f},'message':h}};}function extractCriticalFindingCount(a){const b=a?.['structuredContent'];if(!b)return 0x0;const c=b['semantic'],d=c?.['summary'];if(typeof d?.['critical_count']==='number'&&d['critical_count']>0x0)return d['critical_count'];const e=b['findings']??c?.['findings'];if(Array['isArray'](e))return e['filter'](h=>h?.['severity']==='error')['length'];const f=a?.['content']?.['map'](h=>'text'in h?h['text']:'')['join']('\x0a')??'',g=f['match'](/\[AUDIT ERROR\]/g);return g?g['length']:0x0;}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wowok/agent-mcp",
3
- "version": "2.7.0",
3
+ "version": "2.7.2",
4
4
  "description": "Making It Easy for AI Agents to Communicate, Collaborate, Trade, and Trust.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -50,20 +50,22 @@
50
50
  "license": "Apache-2.0",
51
51
  "dependencies": {
52
52
  "@modelcontextprotocol/sdk": "^1.29.0",
53
- "@wowok/wowok": "2.7.0",
53
+ "@wowok/wowok": "2.7.1",
54
54
  "lodash": "^4.18.1",
55
55
  "zod": "^3.25.76",
56
56
  "zod-to-json-schema": "^3.25.2"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@types/node": "^22.19.19",
60
+ "javascript-obfuscator": "^4.1.1",
60
61
  "tsx": "^4.21.0",
61
62
  "typescript": "^5.8.2",
62
63
  "vitest": "^2.1.0"
63
64
  },
64
65
  "scripts": {
65
66
  "clean": "rm -rf dist",
66
- "build": "tsc && pnpm generate:schemas",
67
+ "build": "tsc && pnpm generate:schemas && pnpm obfuscate",
68
+ "obfuscate": "javascript-obfuscator dist --output dist --config obfuscator.json",
67
69
  "watch": "tsc --watch",
68
70
  "start": "tsx src/index.ts",
69
71
  "generate:schemas": "node --max-old-space-size=4096 --import tsx/esm scripts/generate-json-schemas.ts",