@wowok/agent-mcp 2.7.1 → 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 (375) 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.js +1 -397
  13. package/dist/customer/types.js +1 -13
  14. package/dist/customer/user-preferences.js +1 -460
  15. package/dist/evaluation/arbitration-game.d.ts +9 -2
  16. package/dist/evaluation/arbitration-game.js +1 -48
  17. package/dist/evaluation/builtins/demand-match.js +1 -153
  18. package/dist/evaluation/builtins/index.js +1 -10
  19. package/dist/evaluation/builtins/service-risk.js +1 -55
  20. package/dist/evaluation/capability.js +1 -13
  21. package/dist/evaluation/composer.js +1 -40
  22. package/dist/evaluation/engine.js +1 -175
  23. package/dist/evaluation/extract.js +1 -115
  24. package/dist/evaluation/game-strategy.d.ts +27 -0
  25. package/dist/evaluation/game-strategy.js +1 -0
  26. package/dist/evaluation/gap.js +1 -100
  27. package/dist/evaluation/index.d.ts +1 -0
  28. package/dist/evaluation/index.js +1 -11
  29. package/dist/evaluation/node-game.d.ts +31 -3
  30. package/dist/evaluation/node-game.js +1 -57
  31. package/dist/evaluation/region.js +1 -36
  32. package/dist/evaluation/types.d.ts +1 -0
  33. package/dist/evaluation/types.js +1 -1
  34. package/dist/evaluation/user-injection.js +1 -27
  35. package/dist/experience/experience-reuse.js +1 -103
  36. package/dist/experience/index.js +1 -5
  37. package/dist/experience/intent-distill.js +1 -83
  38. package/dist/experience/realtime-feedback.js +1 -94
  39. package/dist/experience/types.js +1 -1
  40. package/dist/experience/user-profile.js +1 -171
  41. package/dist/extensions/business-modules.js +1 -287
  42. package/dist/extensions/capability-manifest.js +1 -781
  43. package/dist/extensions/constraint-registry.js +1 -198
  44. package/dist/extensions/index.js +1 -6
  45. package/dist/extensions/metric-registry.js +1 -257
  46. package/dist/extensions/mode-evaluator.js +1 -170
  47. package/dist/extensions/modes.js +1 -499
  48. package/dist/extensions/registry.js +1 -717
  49. package/dist/extensions/types.js +1 -1
  50. package/dist/harness/auto-escalation.js +1 -68
  51. package/dist/harness/checkpoint.js +1 -129
  52. package/dist/harness/index.js +1 -78
  53. package/dist/harness/plan.js +1 -315
  54. package/dist/harness/recover.js +1 -139
  55. package/dist/harness/types.js +1 -1
  56. package/dist/harness/verify.js +1 -237
  57. package/dist/index.js +1 -273
  58. package/dist/intent/enrich.js +1 -67
  59. package/dist/intent/index.js +1 -60
  60. package/dist/intent/matcher.js +1 -81
  61. package/dist/intent/store.js +1 -55
  62. package/dist/intent/types.js +1 -10
  63. package/dist/knowledge/acquisition-flywheel.js +1 -192
  64. package/dist/knowledge/allocation-confirm.js +1 -534
  65. package/dist/knowledge/allocation-context.js +1 -249
  66. package/dist/knowledge/allocation-ledger.js +1 -463
  67. package/dist/knowledge/allocation-puzzle.js +1 -298
  68. package/dist/knowledge/allocation-risk.js +1 -568
  69. package/dist/knowledge/allocation-templates.js +1 -970
  70. package/dist/knowledge/allocation-translation.js +1 -585
  71. package/dist/knowledge/arb-risk.js +1 -210
  72. package/dist/knowledge/arbitration-confirm.js +1 -559
  73. package/dist/knowledge/arbitration-context.js +1 -505
  74. package/dist/knowledge/arbitration-ledger.js +1 -521
  75. package/dist/knowledge/arbitration-puzzle.js +1 -304
  76. package/dist/knowledge/arbitration-risk.js +1 -423
  77. package/dist/knowledge/arbitration-templates.js +1 -276
  78. package/dist/knowledge/arbitration-translation.js +1 -487
  79. package/dist/knowledge/arbitration-trust.js +1 -117
  80. package/dist/knowledge/audit-rules.js +1 -141
  81. package/dist/knowledge/bridge-risk.js +1 -263
  82. package/dist/knowledge/contact-risk.js +1 -200
  83. package/dist/knowledge/contact-templates.js +1 -60
  84. package/dist/knowledge/demand-confirm.js +1 -206
  85. package/dist/knowledge/demand-matching.js +1 -132
  86. package/dist/knowledge/demand-risk.js +1 -240
  87. package/dist/knowledge/demand-translation.js +1 -354
  88. package/dist/knowledge/deployment-scanner.js +1 -823
  89. package/dist/knowledge/dynamic-pricing.js +1 -87
  90. package/dist/knowledge/examples-scanner-cli.js +1 -26
  91. package/dist/knowledge/examples-scanner.js +1 -843
  92. package/dist/knowledge/flywheel-loop.js +1 -404
  93. package/dist/knowledge/fund-layer.js +1 -973
  94. package/dist/knowledge/glossary.js +1 -211
  95. package/dist/knowledge/guard-confirm.js +1 -406
  96. package/dist/knowledge/guard-context.js +1 -287
  97. package/dist/knowledge/guard-design-patterns.js +1 -360
  98. package/dist/knowledge/guard-ledger.js +1 -260
  99. package/dist/knowledge/guard-lint.js +1 -670
  100. package/dist/knowledge/guard-migration.js +1 -228
  101. package/dist/knowledge/guard-puzzle.js +1 -805
  102. package/dist/knowledge/guard-render.js +1 -700
  103. package/dist/knowledge/guard-risk.js +1 -1879
  104. package/dist/knowledge/guard-submission-prompt.js +1 -171
  105. package/dist/knowledge/guard-templates.js +1 -1105
  106. package/dist/knowledge/guard-translation.js +1 -1119
  107. package/dist/knowledge/index.js +1 -436
  108. package/dist/knowledge/industry-evolution.js +1 -323
  109. package/dist/knowledge/industry-generalizer.js +1 -381
  110. package/dist/knowledge/industry-registry.js +1 -174
  111. package/dist/knowledge/intent-metrics.d.ts +4 -3
  112. package/dist/knowledge/intent-metrics.js +1 -566
  113. package/dist/knowledge/machine-confirm.js +1 -559
  114. package/dist/knowledge/machine-context.js +1 -833
  115. package/dist/knowledge/machine-ledger.js +1 -338
  116. package/dist/knowledge/machine-puzzle.js +1 -494
  117. package/dist/knowledge/machine-render.js +1 -565
  118. package/dist/knowledge/machine-risk.js +1 -669
  119. package/dist/knowledge/machine-templates.js +1 -1597
  120. package/dist/knowledge/machine-topology.js +1 -234
  121. package/dist/knowledge/machine-translation.js +1 -513
  122. package/dist/knowledge/mcp-schema-audit-cli.js +1 -45
  123. package/dist/knowledge/mcp-schema-audit.js +1 -777
  124. package/dist/knowledge/onchain-constants.js +1 -35
  125. package/dist/knowledge/order-confirm.js +1 -573
  126. package/dist/knowledge/order-context.js +1 -390
  127. package/dist/knowledge/order-ledger.js +1 -341
  128. package/dist/knowledge/order-puzzle.js +1 -255
  129. package/dist/knowledge/order-risk.js +1 -653
  130. package/dist/knowledge/order-templates.js +1 -368
  131. package/dist/knowledge/order-translation.js +1 -550
  132. package/dist/knowledge/overrides-loader.js +1 -65
  133. package/dist/knowledge/passport-confirm.js +1 -531
  134. package/dist/knowledge/passport-context.js +1 -306
  135. package/dist/knowledge/passport-ledger.js +1 -282
  136. package/dist/knowledge/passport-puzzle.js +1 -333
  137. package/dist/knowledge/passport-risk.js +1 -450
  138. package/dist/knowledge/passport-templates.js +1 -568
  139. package/dist/knowledge/passport-translation.js +1 -516
  140. package/dist/knowledge/payment-risk.js +1 -249
  141. package/dist/knowledge/permission-confirm.js +1 -426
  142. package/dist/knowledge/permission-context.js +1 -224
  143. package/dist/knowledge/permission-ledger.js +1 -403
  144. package/dist/knowledge/permission-puzzle.js +1 -173
  145. package/dist/knowledge/permission-risk.js +1 -411
  146. package/dist/knowledge/permission-templates.js +1 -234
  147. package/dist/knowledge/permission-translation.js +1 -350
  148. package/dist/knowledge/personal-risk.js +1 -212
  149. package/dist/knowledge/process-model.js +1 -160
  150. package/dist/knowledge/progress-confirm.js +1 -456
  151. package/dist/knowledge/progress-context.js +1 -452
  152. package/dist/knowledge/progress-ledger.js +1 -330
  153. package/dist/knowledge/progress-puzzle.js +1 -219
  154. package/dist/knowledge/progress-risk.js +1 -461
  155. package/dist/knowledge/progress-templates.js +1 -228
  156. package/dist/knowledge/progress-translation.js +1 -405
  157. package/dist/knowledge/proof-confirm.js +1 -187
  158. package/dist/knowledge/proof-risk.js +1 -207
  159. package/dist/knowledge/proof-translation.js +1 -283
  160. package/dist/knowledge/registrar-risk.js +1 -217
  161. package/dist/knowledge/repository-confirm.js +1 -286
  162. package/dist/knowledge/repository-risk.js +1 -373
  163. package/dist/knowledge/repository-translation.js +1 -445
  164. package/dist/knowledge/reputation-rules.js +1 -99
  165. package/dist/knowledge/resource-risk.js +1 -157
  166. package/dist/knowledge/reward-confirm.js +1 -526
  167. package/dist/knowledge/reward-context.js +1 -504
  168. package/dist/knowledge/reward-ledger.js +1 -502
  169. package/dist/knowledge/reward-puzzle.js +1 -300
  170. package/dist/knowledge/reward-risk.js +1 -627
  171. package/dist/knowledge/reward-templates.js +1 -197
  172. package/dist/knowledge/reward-translation.js +1 -501
  173. package/dist/knowledge/safety-rules.js +1 -404
  174. package/dist/knowledge/scenario-modes.js +1 -321
  175. package/dist/knowledge/service-confirm.js +1 -807
  176. package/dist/knowledge/service-context.js +1 -403
  177. package/dist/knowledge/service-ledger.js +1 -609
  178. package/dist/knowledge/service-puzzle.js +1 -236
  179. package/dist/knowledge/service-risk.js +1 -651
  180. package/dist/knowledge/service-templates.js +1 -456
  181. package/dist/knowledge/service-translation.js +1 -622
  182. package/dist/knowledge/template-registry.js +1 -353
  183. package/dist/knowledge/tool-constraints.js +1 -195
  184. package/dist/knowledge/tools-reference.js +1 -178
  185. package/dist/knowledge/treasury-confirm.js +1 -512
  186. package/dist/knowledge/treasury-context.js +1 -363
  187. package/dist/knowledge/treasury-ledger.js +1 -300
  188. package/dist/knowledge/treasury-puzzle.js +1 -216
  189. package/dist/knowledge/treasury-risk.js +1 -440
  190. package/dist/knowledge/treasury-templates.js +1 -358
  191. package/dist/knowledge/treasury-translation.js +1 -498
  192. package/dist/knowledge/trust-metrics.js +1 -198
  193. package/dist/knowledge/util-risk.js +1 -135
  194. package/dist/loop-engineering/aggregate.js +1 -132
  195. package/dist/loop-engineering/context-collect.js +1 -83
  196. package/dist/loop-engineering/diagnose.js +1 -273
  197. package/dist/loop-engineering/improve.js +1 -405
  198. package/dist/loop-engineering/index.js +1 -4
  199. package/dist/loop-engineering/pipeline.js +1 -56
  200. package/dist/mode-market/index.js +1 -3
  201. package/dist/mode-market/registry.js +1 -124
  202. package/dist/mode-market/review.js +1 -214
  203. package/dist/mode-market/submission.js +1 -85
  204. package/dist/participation/collaborator-interest.d.ts +23 -0
  205. package/dist/participation/collaborator-interest.js +1 -0
  206. package/dist/participation/customer-interest.d.ts +25 -0
  207. package/dist/participation/customer-interest.js +1 -0
  208. package/dist/participation/merchant-interest.js +1 -100
  209. package/dist/participation/radar-core.d.ts +13 -3
  210. package/dist/participation/radar-core.js +1 -269
  211. package/dist/participation/supplier-interest.d.ts +25 -0
  212. package/dist/participation/supplier-interest.js +1 -0
  213. package/dist/persona/analyzer.js +1 -66
  214. package/dist/persona/bridge.js +1 -86
  215. package/dist/persona/defaults.js +1 -195
  216. package/dist/persona/experience-bridge.js +1 -23
  217. package/dist/persona/index.js +1 -71
  218. package/dist/persona/model.js +1 -111
  219. package/dist/persona/store.js +1 -62
  220. package/dist/persona/types.d.ts +3 -1
  221. package/dist/persona/types.js +1 -5
  222. package/dist/project/business-puzzle.js +1 -383
  223. package/dist/project/context-assembly.js +1 -254
  224. package/dist/project/deployment-bridge.js +1 -120
  225. package/dist/project/deployment-doc.js +1 -1126
  226. package/dist/project/edit-planner.js +1 -1342
  227. package/dist/project/evaluation.js +1 -2011
  228. package/dist/project/game-theory.js +1 -177
  229. package/dist/project/graph-builder.js +1 -656
  230. package/dist/project/graph.js +1 -340
  231. package/dist/project/handlers.js +1 -1784
  232. package/dist/project/index.d.ts +1 -0
  233. package/dist/project/index.js +1 -301
  234. package/dist/project/intent-analyzer.js +1 -149
  235. package/dist/project/machine-nodes.js +1 -36
  236. package/dist/project/merchant-guide.js +1 -264
  237. package/dist/project/migration.js +1 -125
  238. package/dist/project/mode-actions.js +1 -309
  239. package/dist/project/namespace.js +1 -206
  240. package/dist/project/participation-radar.js +1 -428
  241. package/dist/project/pipeline-actions.js +1 -109
  242. package/dist/project/project-store.js +1 -422
  243. package/dist/project/query.js +1 -153
  244. package/dist/project/reverse-mapping.d.ts +34 -0
  245. package/dist/project/reverse-mapping.js +1 -0
  246. package/dist/project/risk-aggregator.js +1 -295
  247. package/dist/project/rollback-policy.js +1 -290
  248. package/dist/project/semantic-assembler.js +1 -345
  249. package/dist/project/semantic-graph.js +1 -292
  250. package/dist/project/stage-gate.js +1 -369
  251. package/dist/project/substep-trace.js +1 -332
  252. package/dist/project/task-tracker.js +1 -78
  253. package/dist/role/derivation.d.ts +18 -0
  254. package/dist/role/derivation.js +1 -0
  255. package/dist/role/index.d.ts +5 -0
  256. package/dist/role/index.js +1 -0
  257. package/dist/role/model.d.ts +8 -0
  258. package/dist/role/model.js +1 -0
  259. package/dist/role/resolution.d.ts +11 -0
  260. package/dist/role/resolution.js +1 -0
  261. package/dist/role/types.d.ts +11 -0
  262. package/dist/role/types.js +1 -0
  263. package/dist/rules.js +1 -52
  264. package/dist/safety/confirm-gate.js +1 -88
  265. package/dist/safety/index.js +1 -3
  266. package/dist/safety/preview.js +1 -52
  267. package/dist/schema/call/allocation.js +1 -34
  268. package/dist/schema/call/arbitration.js +1 -113
  269. package/dist/schema/call/base.d.ts +15 -15
  270. package/dist/schema/call/base.js +1 -370
  271. package/dist/schema/call/bridge-handler.js +1 -265
  272. package/dist/schema/call/bridge.d.ts +7 -7
  273. package/dist/schema/call/bridge.js +1 -458
  274. package/dist/schema/call/contact.js +1 -37
  275. package/dist/schema/call/demand.js +1 -47
  276. package/dist/schema/call/guard.js +1 -161
  277. package/dist/schema/call/handler.js +1 -322
  278. package/dist/schema/call/index.js +1 -20
  279. package/dist/schema/call/machine.js +1 -193
  280. package/dist/schema/call/order.js +1 -35
  281. package/dist/schema/call/payment.js +1 -37
  282. package/dist/schema/call/permission-handler.js +1 -54
  283. package/dist/schema/call/permission.js +1 -105
  284. package/dist/schema/call/personal.js +1 -78
  285. package/dist/schema/call/progress.js +1 -47
  286. package/dist/schema/call/proof.js +1 -33
  287. package/dist/schema/call/repository.js +1 -77
  288. package/dist/schema/call/reward.js +1 -30
  289. package/dist/schema/call/semantic.js +1 -1679
  290. package/dist/schema/call/service.js +1 -184
  291. package/dist/schema/call/treasury.js +1 -71
  292. package/dist/schema/common/index.js +1 -407
  293. package/dist/schema/config/index.js +1 -68
  294. package/dist/schema/evaluation/index.d.ts +213 -16
  295. package/dist/schema/evaluation/index.js +1 -356
  296. package/dist/schema/index.js +1 -17
  297. package/dist/schema/intent-radar/index.d.ts +13 -13
  298. package/dist/schema/intent-radar/index.js +1 -89
  299. package/dist/schema/local/index.d.ts +21 -21
  300. package/dist/schema/local/index.js +1 -927
  301. package/dist/schema/local/wip.js +1 -187
  302. package/dist/schema/messenger/index.d.ts +7 -7
  303. package/dist/schema/messenger/index.js +1 -475
  304. package/dist/schema/operations.d.ts +7 -7
  305. package/dist/schema/operations.js +1 -520
  306. package/dist/schema/persona/index.d.ts +54 -54
  307. package/dist/schema/persona/index.js +1 -148
  308. package/dist/schema/project/index.d.ts +94 -48
  309. package/dist/schema/project/index.js +1 -2057
  310. package/dist/schema/query/index.d.ts +423 -7
  311. package/dist/schema/query/index.js +1 -1646
  312. package/dist/schema/schema-query/index.js +1 -104
  313. package/dist/schema/schema-version.js +1 -76
  314. package/dist/schema/sync-layer4.js +1 -286
  315. package/dist/schema/task-status.js +1 -36
  316. package/dist/schema/trust/index.js +1 -314
  317. package/dist/schema/utils/guard-parser.js +1 -419
  318. package/dist/schema/utils/guard-query-utils.js +1 -46
  319. package/dist/schema/utils/node-parser.js +1 -369
  320. package/dist/schema/utils/object-type-utils.js +1 -35
  321. package/dist/schema/utils/permission-index-utils.js +1 -7
  322. package/dist/schema/utils/permission-machine-check.js +1 -121
  323. package/dist/schema/utils/skills-recommendation.js +1 -77
  324. package/dist/schema-query/index.js +1 -810
  325. package/dist/schemas/account_operation.output.json +5 -2
  326. package/dist/schemas/bridge_operation.output.json +5 -2
  327. package/dist/schemas/evaluation_operation.output.json +112 -7
  328. package/dist/schemas/evaluation_operation.schema.json +93 -6
  329. package/dist/schemas/index.json +1 -1
  330. package/dist/schemas/intent_radar.output.json +4 -1
  331. package/dist/schemas/intent_radar.schema.json +4 -1
  332. package/dist/schemas/local_info_operation.output.json +5 -2
  333. package/dist/schemas/local_mark_operation.output.json +5 -2
  334. package/dist/schemas/messenger_operation.output.json +5 -2
  335. package/dist/schemas/onchain_events.output.json +5 -2
  336. package/dist/schemas/onchain_operations.output.json +5 -2
  337. package/dist/schemas/onchain_operations.schema.json +4 -4
  338. package/dist/schemas/onchain_operations_allocation.schema.json +1 -1
  339. package/dist/schemas/onchain_operations_machine.schema.json +2 -2
  340. package/dist/schemas/onchain_operations_service.schema.json +1 -1
  341. package/dist/schemas/onchain_table_data.output.json +6 -3
  342. package/dist/schemas/persona_operation.output.json +4 -1
  343. package/dist/schemas/persona_operation.schema.json +4 -1
  344. package/dist/schemas/project_operation.output.json +28 -8
  345. package/dist/schemas/query_toolkit.output.json +8 -5
  346. package/dist/schemas/wowok_buildin_info.output.json +132 -0
  347. package/dist/schemas/wowok_buildin_info.schema.json +14 -0
  348. package/dist/telemetry/index.js +1 -112
  349. package/dist/telemetry/redact.js +1 -23
  350. package/dist/telemetry/storage.js +1 -80
  351. package/dist/tools/handlers/bridge.js +1 -1
  352. package/dist/tools/handlers/config.js +1 -74
  353. package/dist/tools/handlers/evaluation.js +1 -123
  354. package/dist/tools/handlers/file-export.js +1 -90
  355. package/dist/tools/handlers/intent-radar.js +1 -76
  356. package/dist/tools/handlers/local.js +1 -53
  357. package/dist/tools/handlers/messenger.js +1 -188
  358. package/dist/tools/handlers/onchain.js +1 -1180
  359. package/dist/tools/handlers/persona.js +1 -89
  360. package/dist/tools/handlers/project.js +1 -211
  361. package/dist/tools/handlers/query.js +1 -434
  362. package/dist/tools/handlers/schema-query.js +1 -176
  363. package/dist/tools/handlers/task-status.js +1 -26
  364. package/dist/tools/handlers/trust.js +1 -380
  365. package/dist/tools/handlers/wip.js +1 -90
  366. package/dist/tools/index.js +1 -1382
  367. package/dist/tools/retry.js +1 -85
  368. package/dist/tools/rules-hook.js +1 -23
  369. package/dist/tools/shared.js +1 -130
  370. package/dist/tools/types.js +1 -1
  371. package/dist/tools/upgrade-check.d.ts +19 -0
  372. package/dist/tools/upgrade-check.js +1 -0
  373. package/dist/tools/wip-deploy-assist.js +1 -306
  374. package/dist/tools/wrap.js +1 -500
  375. package/package.json +4 -2
@@ -5650,11 +5650,22 @@
5650
5650
  "perspective": {
5651
5651
  "type": "string",
5652
5652
  "enum": [
5653
+ "merchant",
5653
5654
  "customer",
5654
- "operator",
5655
- "observer"
5655
+ "prospect",
5656
+ "supplier",
5657
+ "collaborator",
5658
+ "arbitrator"
5656
5659
  ],
5657
- "description": "Derived from on-chain data (Order.builder + PermissionPerm grants), never caller-asserted."
5660
+ "description": "Derived commercial role from on-chain data (Order.builder + PermissionPerm grants + named operators), never caller-asserted."
5661
+ },
5662
+ "collaborator_kind": {
5663
+ "type": "string",
5664
+ "enum": [
5665
+ "permission_entity",
5666
+ "named_operator"
5667
+ ],
5668
+ "description": "Collaborator sub-kind when perspective === 'collaborator' (internal staff vs external operator)."
5658
5669
  },
5659
5670
  "roles": {
5660
5671
  "type": "array",
@@ -5718,6 +5729,10 @@
5718
5729
  "consequence": {
5719
5730
  "type": "string",
5720
5731
  "description": "Consequence hint (completion fund-release / refund path)."
5732
+ },
5733
+ "weight": {
5734
+ "type": "number",
5735
+ "description": "Forward weight (accumulates toward the pair's threshold)."
5721
5736
  }
5722
5737
  },
5723
5738
  "required": [
@@ -5831,6 +5846,11 @@
5831
5846
  "type": "boolean",
5832
5847
  "description": "True when Machine data was unavailable — operable/waiting_on unknown."
5833
5848
  },
5849
+ "threshold": {
5850
+ "type": "integer",
5851
+ "minimum": 1,
5852
+ "description": "Current pair's threshold (accumulated forward weights to advance)."
5853
+ },
5834
5854
  "interest_analysis": {
5835
5855
  "type": "object",
5836
5856
  "properties": {
@@ -5839,7 +5859,7 @@
5839
5859
  "items": {
5840
5860
  "type": "string"
5841
5861
  },
5842
- "description": "Where money sits and what releases it (escrow, Allocation waterfall, compensation_fund)."
5862
+ "description": "Where money sits and what releases it (escrow, Allocation waterfall, compensation_fund, or the role's non-settlement stake)."
5843
5863
  },
5844
5864
  "responsibility": {
5845
5865
  "type": "array",
@@ -5853,18 +5873,18 @@
5853
5873
  "items": {
5854
5874
  "type": "string"
5855
5875
  },
5856
- "description": "Actions serving the merchant's own interest (settlement speed, evidence pre-upload, Messenger nudge). Informational only."
5876
+ "description": "Actions serving the role's own interest (settlement speed, evidence pre-upload, Messenger nudge, arbitration). Informational only."
5857
5877
  },
5858
5878
  "stakes": {
5859
5879
  "type": "array",
5860
5880
  "items": {
5861
5881
  "type": "string"
5862
5882
  },
5863
- "description": "Downside exposure (arbitration indemnity, arb-loss record, stall statistics, refund aftermath)."
5883
+ "description": "Downside exposure (arbitration indemnity, arb-loss record, stall statistics, non-delivery, refund aftermath)."
5864
5884
  },
5865
5885
  "summary": {
5866
5886
  "type": "string",
5867
- "description": "One-paragraph merchant-interest summary."
5887
+ "description": "One-paragraph role-interest summary."
5868
5888
  }
5869
5889
  },
5870
5890
  "required": [
@@ -5875,7 +5895,7 @@
5875
5895
  "summary"
5876
5896
  ],
5877
5897
  "additionalProperties": false,
5878
- "description": "Merchant-side interest analysis (fund_flow/responsibility/leverage/stakes) — present ONLY when perspective='operator' and order data is available. AI MUST surface it as neutral information; the merchant decides."
5898
+ "description": "Role-specific interest analysis (fund_flow/responsibility/leverage/stakes) — present when order data is available. merchant → merchant-interest; supplier → supplier-interest; collaborator → collaborator-interest; customer → customer-interest. AI MUST surface it as neutral information; the role decides."
5879
5899
  },
5880
5900
  "summary": {
5881
5901
  "type": "string",
@@ -2829,7 +2829,7 @@
2829
2829
  "number",
2830
2830
  "string"
2831
2831
  ],
2832
- "description": "Allocation value. SEMANTICS DEPEND ON `mode`:\n• mode='Amount': absolute amount in smallest unit (e.g., '750000000' for 0.75 WOW, '250000000' for 0.25 WOW). Allocated first; sum of Amount items cached as `fix`.\n• mode='Rate': basis-points rate, 10000 = 100% (e.g., '7500' for 75%, '2500' for 25%). When no Surplus in same Allocator, sum MUST == 10000; when Surplus present, sum MUST <= 10000.\n• mode='Surplus': IGNORED (contract forces to 0). Set to '0' for clarity. Receives remaining balance after Amount + Rate allocations."
2832
+ "description": "Allocation value. SEMANTICS DEPEND ON `mode`:\n• mode='Amount': absolute amount in smallest unit (e.g., '750000000' for 0.75 WOW, '250000000' for 0.25 WOW). Allocated first; sum of Amount items cached as `fix`.\n• mode='Rate': basis-points rate, 10000 = 100% (e.g., '7500' for 75%, '2500' for 25%). When no Surplus in same Allocator, sum MUST == 10000; when Surplus present, sum MUST <= 10000.\n• mode='Surplus': IGNORED (contract forces to 0). Set to '0' for clarity. Receives remaining balance after Amount + Rate allocations.\n⚠️ T1 LOSSY POINT (B-2): the value is PRE-CONFIGURED and STATIC. A continuous/conditional amount (e.g. 'pay exactly the assessed loss amount') CANNOT be expressed — there is no runtime formula field. Model variable payouts as (a) a fixed-tier Allocator list guarded by distinct Guards, or (b) an Amount with a `max` cap — both are finite configurations, not free-form formulas."
2833
2833
  },
2834
2834
  "mode": {
2835
2835
  "anyOf": [
@@ -4960,7 +4960,7 @@
4960
4960
  "number",
4961
4961
  "string"
4962
4962
  ],
4963
- "description": "Allocation value. SEMANTICS DEPEND ON `mode`:\n• mode='Amount': absolute amount in smallest unit (e.g., '750000000' for 0.75 WOW, '250000000' for 0.25 WOW). Allocated first; sum of Amount items cached as `fix`.\n• mode='Rate': basis-points rate, 10000 = 100% (e.g., '7500' for 75%, '2500' for 25%). When no Surplus in same Allocator, sum MUST == 10000; when Surplus present, sum MUST <= 10000.\n• mode='Surplus': IGNORED (contract forces to 0). Set to '0' for clarity. Receives remaining balance after Amount + Rate allocations."
4963
+ "description": "Allocation value. SEMANTICS DEPEND ON `mode`:\n• mode='Amount': absolute amount in smallest unit (e.g., '750000000' for 0.75 WOW, '250000000' for 0.25 WOW). Allocated first; sum of Amount items cached as `fix`.\n• mode='Rate': basis-points rate, 10000 = 100% (e.g., '7500' for 75%, '2500' for 25%). When no Surplus in same Allocator, sum MUST == 10000; when Surplus present, sum MUST <= 10000.\n• mode='Surplus': IGNORED (contract forces to 0). Set to '0' for clarity. Receives remaining balance after Amount + Rate allocations.\n⚠️ T1 LOSSY POINT (B-2): the value is PRE-CONFIGURED and STATIC. A continuous/conditional amount (e.g. 'pay exactly the assessed loss amount') CANNOT be expressed — there is no runtime formula field. Model variable payouts as (a) a fixed-tier Allocator list guarded by distinct Guards, or (b) an Amount with a `max` cap — both are finite configurations, not free-form formulas."
4964
4964
  },
4965
4965
  "mode": {
4966
4966
  "anyOf": [
@@ -13132,7 +13132,7 @@
13132
13132
  "type": "null"
13133
13133
  }
13134
13134
  ],
13135
- "description": "Guard reference for this forward. Accepts TWO formats:\n• STRING (preferred): \"my_guard_name\" — the Guard's name or address as a plain string.\n• OBJECT (only when retained_submission is needed): {guard: \"my_guard_name\", retained_submission: [1,2,3]}.\nFOLLOW THE SCHEMA FIELD STRUCTURE: A Guard reference is fundamentally a STRING (the Guard object's name or address). Provide a string when you only need to reference a Guard — do NOT wrap a bare string in an object structure. The OBJECT form {guard: \"...\", retained_submission: [...]} exists ONLY to carry additional `retained_submission` data alongside the string reference; inside the object, the `guard` field is STILL a string. In short: string-in for a string reference, object-in only when you need to pass extra data.\nCOGNITIVE PRINCIPLE: Guard validation ALWAYS occurs BEFORE the forward operation. A Guard that queries state of the SAME Progress object this forward operates on (e.g. progress.current) will see the PRE-transition value (source node), NOT the target node. If the Guard checks progress.current == target_node, it will ALWAYS FAIL. Querying a DIFFERENT Progress object (cross-machine) is safe and reasonable — that progress is not modified by this forward. For target-node verification after transition, bind the Guard to the Allocator instead (allocation.alloc runs AFTER the state transition completes)."
13135
+ "description": "Guard reference for this forward. Accepts TWO formats:\n• STRING (preferred): \"my_guard_name\" — the Guard's name or address as a plain string.\n• OBJECT (only when retained_submission is needed): {guard: \"my_guard_name\", retained_submission: [1,2,3]}.\nFOLLOW THE SCHEMA FIELD STRUCTURE: A Guard reference is fundamentally a STRING (the Guard object's name or address). Provide a string when you only need to reference a Guard — do NOT wrap a bare string in an object structure. The OBJECT form {guard: \"...\", retained_submission: [...]} exists ONLY to carry additional `retained_submission` data alongside the string reference; inside the object, the `guard` field is STILL a string. In short: string-in for a string reference, object-in only when you need to pass extra data.\nCOGNITIVE PRINCIPLE: Guard validation ALWAYS occurs BEFORE the forward operation. A Guard that queries state of the SAME Progress object this forward operates on (e.g. progress.current) will see the PRE-transition value (source node), NOT the target node. If the Guard checks progress.current == target_node, it will ALWAYS FAIL. Querying a DIFFERENT Progress object (cross-machine) is safe and reasonable — that progress is not modified by this forward. For target-node verification after transition, bind the Guard to the Allocator instead (allocation.alloc runs AFTER the state transition completes).\n⚠️ T1 LOSSY POINT (B-3): WoWok has NO on-chain cron. A business phrase like 'after N days, auto-X' is NOT an automatic trigger — it decomposes into (1) a time_guard that checks elapsed time, and (2) an OFF-CHAIN keeper that must submit the forward when the guard passes. Configuring a time_guard WITHOUT a keeper means nothing ever fires."
13136
13136
  }
13137
13137
  },
13138
13138
  "required": [
@@ -15136,13 +15136,16 @@
15136
15136
  "items": {
15137
15137
  "type": "string"
15138
15138
  },
15139
- "description": "Phase 4 P4-6.C: Role-targeted advice strings (user/merchant/arbitrator). Example: ['Strengthen loyalty flywheel','Optimize first-order conversion']"
15139
+ "description": "Phase 4 P4-6.C: Role-targeted advice strings (merchant/customer/prospect/supplier/collaborator/arbitrator). Example: ['Strengthen loyalty flywheel','Optimize first-order conversion']"
15140
15140
  },
15141
15141
  "role": {
15142
15142
  "type": "string",
15143
15143
  "enum": [
15144
- "user",
15145
15144
  "merchant",
15145
+ "customer",
15146
+ "prospect",
15147
+ "supplier",
15148
+ "collaborator",
15146
15149
  "arbitrator"
15147
15150
  ],
15148
15151
  "description": "Phase 4 P4-6.C: Role used for advice routing. Example: 'merchant'"
@@ -835,6 +835,138 @@
835
835
  "result"
836
836
  ],
837
837
  "additionalProperties": false
838
+ },
839
+ {
840
+ "type": "object",
841
+ "properties": {
842
+ "info": {
843
+ "type": "string",
844
+ "const": "upgrade_check"
845
+ },
846
+ "result": {
847
+ "type": "object",
848
+ "properties": {
849
+ "mcp": {
850
+ "type": "object",
851
+ "properties": {
852
+ "current": {
853
+ "type": [
854
+ "string",
855
+ "null"
856
+ ],
857
+ "description": "Currently installed/running version"
858
+ },
859
+ "latest": {
860
+ "type": [
861
+ "string",
862
+ "null"
863
+ ],
864
+ "description": "Latest published npm version (null when offline/unreachable)"
865
+ },
866
+ "outdated": {
867
+ "type": "boolean",
868
+ "description": "true when a newer version is available"
869
+ }
870
+ },
871
+ "required": [
872
+ "current",
873
+ "latest",
874
+ "outdated"
875
+ ],
876
+ "additionalProperties": false,
877
+ "description": "WoWok MCP server version comparison"
878
+ },
879
+ "sdk": {
880
+ "type": "object",
881
+ "properties": {
882
+ "current": {
883
+ "$ref": "#/definitions/wowok_buildin_info/properties/result/anyOf/8/properties/result/properties/mcp/properties/current"
884
+ },
885
+ "latest": {
886
+ "$ref": "#/definitions/wowok_buildin_info/properties/result/anyOf/8/properties/result/properties/mcp/properties/latest"
887
+ },
888
+ "outdated": {
889
+ "$ref": "#/definitions/wowok_buildin_info/properties/result/anyOf/8/properties/result/properties/mcp/properties/outdated"
890
+ }
891
+ },
892
+ "required": [
893
+ "current",
894
+ "latest",
895
+ "outdated"
896
+ ],
897
+ "additionalProperties": false,
898
+ "description": "WoWok SDK version comparison"
899
+ },
900
+ "client_installed": {
901
+ "type": "boolean",
902
+ "description": "Whether the WoWok desktop client is installed"
903
+ },
904
+ "client_install_hint": {
905
+ "type": [
906
+ "string",
907
+ "null"
908
+ ],
909
+ "description": "Where to get the desktop client (e.g. download URL)"
910
+ },
911
+ "upgrade_available": {
912
+ "type": "boolean",
913
+ "description": "true when any component is outdated"
914
+ },
915
+ "reminder": {
916
+ "type": "object",
917
+ "properties": {
918
+ "type": {
919
+ "type": "string",
920
+ "enum": [
921
+ "upgrade",
922
+ "install_client",
923
+ "none"
924
+ ],
925
+ "description": "Reminder kind"
926
+ },
927
+ "due": {
928
+ "type": "boolean",
929
+ "description": "Whether to surface the reminder in this conversation"
930
+ },
931
+ "message": {
932
+ "type": [
933
+ "string",
934
+ "null"
935
+ ],
936
+ "description": "Ready-to-use, benefit-focused reminder message; null when not due"
937
+ }
938
+ },
939
+ "required": [
940
+ "type",
941
+ "due",
942
+ "message"
943
+ ],
944
+ "additionalProperties": false,
945
+ "description": "Reminder decision"
946
+ },
947
+ "checked_at": {
948
+ "type": "string",
949
+ "description": "ISO timestamp of the check"
950
+ }
951
+ },
952
+ "required": [
953
+ "mcp",
954
+ "sdk",
955
+ "client_installed",
956
+ "client_install_hint",
957
+ "upgrade_available",
958
+ "reminder",
959
+ "checked_at"
960
+ ],
961
+ "additionalProperties": false,
962
+ "description": "Upgrade & client-install reminder check result"
963
+ }
964
+ },
965
+ "required": [
966
+ "info",
967
+ "result"
968
+ ],
969
+ "additionalProperties": false
838
970
  }
839
971
  ],
840
972
  "description": "Protocol info result"
@@ -551,6 +551,20 @@
551
551
  ],
552
552
  "additionalProperties": false,
553
553
  "description": "Funding guidance query - how to obtain WOW gas and payment tokens. Returns testnet faucet info, 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."
554
+ },
555
+ {
556
+ "type": "object",
557
+ "properties": {
558
+ "info": {
559
+ "type": "string",
560
+ "const": "upgrade_check"
561
+ }
562
+ },
563
+ "required": [
564
+ "info"
565
+ ],
566
+ "additionalProperties": false,
567
+ "description": "Upgrade check - returns current vs latest npm versions of the WoWok MCP server and SDK, whether the WoWok desktop client is installed, and whether an upgrade/install reminder is due. Call at the start of a conversation to decide whether to remind the user to upgrade or install the client."
554
568
  }
555
569
  ],
556
570
  "description": "WoWok Build-in infomation query"
@@ -1,112 +1 @@
1
- import { getStorage } from "./storage.js";
2
- import { redactObject } from "./redact.js";
3
- let _enabled = true;
4
- export function setTelemetryEnabled(enabled) {
5
- _enabled = enabled;
6
- }
7
- export function isTelemetryEnabled() {
8
- return _enabled;
9
- }
10
- function extractFromOutput(structuredContent, toolName, operationTypeHint) {
11
- if (!structuredContent) {
12
- return { tool_name: toolName, semantic_hit: false };
13
- }
14
- const semantic = structuredContent.semantic;
15
- const result = structuredContent.result;
16
- const event = {
17
- tool_name: toolName,
18
- semantic_hit: !!semantic,
19
- };
20
- if (semantic) {
21
- event.intent = semantic.intent;
22
- event.status = semantic.status;
23
- }
24
- if (result?.type === "error") {
25
- event.status = event.status || "failed";
26
- event.error_code = result.error_code;
27
- if (result.error) {
28
- const truncated = String(result.error).slice(0, 500);
29
- event.error_message = redactObject(truncated);
30
- }
31
- }
32
- if (operationTypeHint) {
33
- event.operation_type = operationTypeHint;
34
- }
35
- else if (semantic?.intent) {
36
- event.operation_type = "unknown";
37
- }
38
- return event;
39
- }
40
- export async function captureTelemetry(toolName, structuredContent, durationMs, operationTypeHint) {
41
- if (!_enabled)
42
- return;
43
- try {
44
- const extracted = extractFromOutput(structuredContent, toolName, operationTypeHint);
45
- const event = {
46
- timestamp: new Date().toISOString(),
47
- tool_name: extracted.tool_name || toolName,
48
- operation_type: extracted.operation_type || "unknown",
49
- intent: extracted.intent,
50
- status: extracted.status,
51
- error_code: extracted.error_code,
52
- duration_ms: durationMs,
53
- semantic_hit: extracted.semantic_hit ?? false,
54
- error_message: extracted.error_message,
55
- };
56
- await getStorage().append(event);
57
- }
58
- catch {
59
- }
60
- }
61
- export async function captureTelemetryError(toolName, error, durationMs, operationTypeHint) {
62
- if (!_enabled)
63
- return;
64
- try {
65
- const errorMsg = String(error?.message ?? error).slice(0, 500);
66
- const event = {
67
- timestamp: new Date().toISOString(),
68
- tool_name: toolName,
69
- operation_type: operationTypeHint || "unknown",
70
- status: "failed",
71
- duration_ms: durationMs,
72
- semantic_hit: false,
73
- error_message: redactObject(errorMsg),
74
- };
75
- await getStorage().append(event);
76
- }
77
- catch {
78
- }
79
- }
80
- export function withTelemetry(toolName, handler) {
81
- return async (args) => {
82
- const start = Date.now();
83
- let output;
84
- try {
85
- output = await handler(args);
86
- return output;
87
- }
88
- catch (error) {
89
- await captureTelemetryError(toolName, error, Date.now() - start, extractOperationType(args));
90
- throw error;
91
- }
92
- finally {
93
- if (output) {
94
- await captureTelemetry(toolName, output?.structuredContent, Date.now() - start, extractOperationType(args));
95
- }
96
- }
97
- };
98
- }
99
- function extractOperationType(args) {
100
- if (!args || typeof args !== "object")
101
- return undefined;
102
- if (typeof args.operation_type === "string") {
103
- if (args.operation_type.startsWith("cross_chain") || args.operation_type.startsWith("claim") ||
104
- args.operation_type.startsWith("withdraw") || args.operation_type.startsWith("query_")) {
105
- return "bridge_" + args.operation_type;
106
- }
107
- return args.operation_type;
108
- }
109
- if (args.data?.operation_type)
110
- return args.data.operation_type;
111
- return undefined;
112
- }
1
+ import{getStorage}from'./storage.js';import{redactObject}from'./redact.js';let _enabled=!![];export function setTelemetryEnabled(a){_enabled=a;}export function isTelemetryEnabled(){return _enabled;}function extractFromOutput(a,b,c){if(!a)return{'tool_name':b,'semantic_hit':![]};const d=a['semantic'],e=a['result'],f={'tool_name':b,'semantic_hit':!!d};d&&(f['intent']=d['intent'],f['status']=d['status']);if(e?.['type']==='error'){f['status']=f['status']||'failed',f['error_code']=e['error_code'];if(e['error']){const g=String(e['error'])['slice'](0x0,0x1f4);f['error_message']=redactObject(g);}}if(c)f['operation_type']=c;else d?.['intent']&&(f['operation_type']='unknown');return f;}export async function captureTelemetry(a,b,c,d){if(!_enabled)return;try{const e=extractFromOutput(b,a,d),f={'timestamp':new Date()['toISOString'](),'tool_name':e['tool_name']||a,'operation_type':e['operation_type']||'unknown','intent':e['intent'],'status':e['status'],'error_code':e['error_code'],'duration_ms':c,'semantic_hit':e['semantic_hit']??![],'error_message':e['error_message']};await getStorage()['append'](f);}catch{}}export async function captureTelemetryError(a,b,c,d){if(!_enabled)return;try{const e=String(b?.['message']??b)['slice'](0x0,0x1f4),f={'timestamp':new Date()['toISOString'](),'tool_name':a,'operation_type':d||'unknown','status':'failed','duration_ms':c,'semantic_hit':![],'error_message':redactObject(e)};await getStorage()['append'](f);}catch{}}export function withTelemetry(a,b){return async c=>{const d=Date['now']();let e;try{return e=await b(c),e;}catch(f){await captureTelemetryError(a,f,Date['now']()-d,extractOperationType(c));throw f;}finally{e&&await captureTelemetry(a,e?.['structuredContent'],Date['now']()-d,extractOperationType(c));}};}function extractOperationType(a){if(!a||typeof a!=='object')return undefined;if(typeof a['operation_type']==='string'){if(a['operation_type']['startsWith']('cross_chain')||a['operation_type']['startsWith']('claim')||a['operation_type']['startsWith']('withdraw')||a['operation_type']['startsWith']('query_'))return'bridge_'+a['operation_type'];return a['operation_type'];}if(a['data']?.['operation_type'])return a['data']['operation_type'];return undefined;}
@@ -1,23 +1 @@
1
- import { createHash } from "crypto";
2
- const ADDRESS_PATTERN = /^0x[0-9a-fA-F]{40,}$/;
3
- export function redactAddress(value) {
4
- if (typeof value !== "string")
5
- return value;
6
- if (!ADDRESS_PATTERN.test(value))
7
- return value;
8
- const hash = createHash("sha256").update(value.toLowerCase()).digest("hex");
9
- return "0x" + hash.slice(0, 16);
10
- }
11
- export function redactObject(obj) {
12
- if (typeof obj === "string")
13
- return redactAddress(obj);
14
- if (Array.isArray(obj))
15
- return obj.map(redactObject);
16
- if (obj && typeof obj === "object" && obj.constructor === Object) {
17
- const out = {};
18
- for (const k of Object.keys(obj))
19
- out[k] = redactObject(obj[k]);
20
- return out;
21
- }
22
- return obj;
23
- }
1
+ import{createHash}from'crypto';const ADDRESS_PATTERN=/^0x[0-9a-fA-F]{40,}$/;export function redactAddress(a){if(typeof a!=='string')return a;if(!ADDRESS_PATTERN['test'](a))return a;const b=createHash('sha256')['update'](a['toLowerCase']())['digest']('hex');return'0x'+b['slice'](0x0,0x10);}export function redactObject(a){if(typeof a==='string')return redactAddress(a);if(Array['isArray'](a))return a['map'](redactObject);if(a&&typeof a==='object'&&a['constructor']===Object){const b={};for(const c of Object['keys'](a))b[c]=redactObject(a[c]);return b;}return a;}
@@ -1,80 +1 @@
1
- import { mkdir, appendFile, stat, rename } from "fs/promises";
2
- import { dirname, join } from "path";
3
- import { getWowMcpDir } from "@wowok/wowok";
4
- const MAX_SIZE_BYTES = 10 * 1024 * 1024;
5
- const DATA_DIR = join(getWowMcpDir(), "data");
6
- const TELEMETRY_FILE = join(DATA_DIR, "telemetry.jsonl");
7
- const ROTATED_FILE = join(DATA_DIR, "telemetry.jsonl.1");
8
- class JsonlStorage {
9
- filePath;
10
- rotatedPath;
11
- writeQueue = Promise.resolve();
12
- constructor(filePath = TELEMETRY_FILE, rotatedPath = ROTATED_FILE) {
13
- this.filePath = filePath;
14
- this.rotatedPath = rotatedPath;
15
- }
16
- async append(event) {
17
- this.writeQueue = this.writeQueue.then(async () => {
18
- try {
19
- await mkdir(dirname(this.filePath), { recursive: true });
20
- const line = JSON.stringify(event) + "\n";
21
- await appendFile(this.filePath, line, "utf8");
22
- await this.maybeRotate();
23
- }
24
- catch {
25
- }
26
- });
27
- return this.writeQueue;
28
- }
29
- async query(filter) {
30
- try {
31
- const { readFile } = await import("fs/promises");
32
- const content = await readFile(this.filePath, "utf8");
33
- const lines = content.split("\n").filter((l) => l.trim());
34
- const events = lines.map((l) => {
35
- try {
36
- return JSON.parse(l);
37
- }
38
- catch {
39
- return null;
40
- }
41
- }).filter((e) => e !== null);
42
- return events.filter((e) => {
43
- return Object.entries(filter).every(([k, v]) => e[k] === v);
44
- });
45
- }
46
- catch {
47
- return [];
48
- }
49
- }
50
- async rotate() {
51
- try {
52
- await rename(this.filePath, this.rotatedPath).catch(() => { });
53
- }
54
- catch {
55
- }
56
- }
57
- async maybeRotate() {
58
- try {
59
- const stats = await stat(this.filePath);
60
- if (stats.size >= MAX_SIZE_BYTES) {
61
- await this.rotate();
62
- }
63
- }
64
- catch {
65
- }
66
- }
67
- }
68
- let _storage = null;
69
- export function getStorage() {
70
- if (!_storage) {
71
- _storage = new JsonlStorage();
72
- }
73
- return _storage;
74
- }
75
- export function setStorage(storage) {
76
- _storage = storage;
77
- }
78
- export function getTelemetryFilePath() {
79
- return TELEMETRY_FILE;
80
- }
1
+ import{mkdir,appendFile,stat,rename}from'fs/promises';import{dirname,join}from'path';import{getWowMcpDir}from'@wowok/wowok';const MAX_SIZE_BYTES=0xa*0x400*0x400,DATA_DIR=join(getWowMcpDir(),'data'),TELEMETRY_FILE=join(DATA_DIR,'telemetry.jsonl'),ROTATED_FILE=join(DATA_DIR,'telemetry.jsonl.1');class JsonlStorage{['filePath'];['rotatedPath'];['writeQueue']=Promise['resolve']();constructor(a=TELEMETRY_FILE,b=ROTATED_FILE){this['filePath']=a,this['rotatedPath']=b;}async['append'](a){return this['writeQueue']=this['writeQueue']['then'](async()=>{try{await mkdir(dirname(this['filePath']),{'recursive':!![]});const b=JSON['stringify'](a)+'\x0a';await appendFile(this['filePath'],b,'utf8'),await this['maybeRotate']();}catch{}}),this['writeQueue'];}async['query'](a){try{const {readFile:b}=await import('fs/promises'),c=await b(this['filePath'],'utf8'),d=c['split']('\x0a')['filter'](f=>f['trim']()),e=d['map'](f=>{try{return JSON['parse'](f);}catch{return null;}})['filter'](f=>f!==null);return e['filter'](f=>{return Object['entries'](a)['every'](([g,h])=>f[g]===h);});}catch{return[];}}async['rotate'](){try{await rename(this['filePath'],this['rotatedPath'])['catch'](()=>{});}catch{}}async['maybeRotate'](){try{const a=await stat(this['filePath']);a['size']>=MAX_SIZE_BYTES&&await this['rotate']();}catch{}}}let _storage=null;export function getStorage(){return!_storage&&(_storage=new JsonlStorage()),_storage;}export function setStorage(a){_storage=a;}export function getTelemetryFilePath(){return TELEMETRY_FILE;}
@@ -1 +1 @@
1
- export { handleBridgeOperations } from "../../schema/call/bridge-handler.js";
1
+ export{handleBridgeOperations}from'../../schema/call/bridge-handler.js';
@@ -1,74 +1 @@
1
- import { listServices, getServiceInfo, toggle as toggleService, setEnabled as setServiceEnabled, reset as resetService, } from "../../config/index.js";
2
- import { strictParse } from "../../schema/index.js";
3
- import { ConfigOperationInputSchema } from "../../schema/config/index.js";
4
- export async function handleConfigOperation(args) {
5
- const validated = strictParse(ConfigOperationInputSchema, args, "config_operation input");
6
- const { action, service: serviceRaw } = validated;
7
- let result;
8
- switch (action) {
9
- case "list":
10
- result = { action: "list", services: listServices() };
11
- break;
12
- case "toggle": {
13
- if (!serviceRaw)
14
- throw new Error("'service' param is required for toggle");
15
- const service = serviceRaw;
16
- const existing = getServiceInfo(service);
17
- if (!existing) {
18
- throw new Error(`Unknown service: ${service}. Use action='list' to see all valid services.`);
19
- }
20
- const newState = toggleService(service);
21
- result = { action: "toggle", service, enabled: newState, reminder: existing.reminder };
22
- break;
23
- }
24
- case "enable": {
25
- if (!serviceRaw)
26
- throw new Error("'service' param is required for enable");
27
- const service = serviceRaw;
28
- const existing = getServiceInfo(service);
29
- if (!existing)
30
- throw new Error(`Unknown service: ${service}. Use action='list' to see all valid services.`);
31
- setServiceEnabled(service, true);
32
- result = { action: "enable", service, enabled: true, reminder: existing.reminder };
33
- break;
34
- }
35
- case "disable": {
36
- if (!serviceRaw)
37
- throw new Error("'service' param is required for disable");
38
- const service = serviceRaw;
39
- const existing = getServiceInfo(service);
40
- if (!existing)
41
- throw new Error(`Unknown service: ${service}. Use action='list' to see all valid services.`);
42
- setServiceEnabled(service, false);
43
- result = { action: "disable", service, enabled: false, reminder: existing.reminder };
44
- break;
45
- }
46
- case "reset": {
47
- if (!serviceRaw)
48
- throw new Error("'service' param is required for reset");
49
- const service = serviceRaw;
50
- const existing = getServiceInfo(service);
51
- if (!existing)
52
- throw new Error(`Unknown service: ${service}. Use action='list' to see all valid services.`);
53
- resetService(service);
54
- result = { action: "reset", service, enabled: getServiceInfo(service)?.enabled, reminder: existing.reminder, reset: true };
55
- break;
56
- }
57
- case "info": {
58
- if (!serviceRaw)
59
- throw new Error("'service' param is required for info");
60
- const service = serviceRaw;
61
- const info = getServiceInfo(service);
62
- if (!info)
63
- throw new Error(`Unknown service: ${service}. Use action='list' to see all valid services.`);
64
- result = { action: "info", ...info };
65
- break;
66
- }
67
- default:
68
- throw new Error(`Unknown config_operation action: ${String(action)}`);
69
- }
70
- return {
71
- content: [{ type: "text", text: JSON.stringify({ result }) }],
72
- structuredContent: { result },
73
- };
74
- }
1
+ import{listServices,getServiceInfo,toggle as a300a,setEnabled as a300b,reset as a300c}from'../../config/index.js';import{strictParse}from'../../schema/index.js';import{ConfigOperationInputSchema}from'../../schema/config/index.js';export async function handleConfigOperation(a){const b=strictParse(ConfigOperationInputSchema,a,'config_operation\x20input'),{action:c,service:d}=b;let e;switch(c){case'list':e={'action':'list','services':listServices()};break;case'toggle':{if(!d)throw new Error('\x27service\x27\x20param\x20is\x20required\x20for\x20toggle');const f=d,g=getServiceInfo(f);if(!g)throw new Error('Unknown\x20service:\x20'+f+'.\x20Use\x20action=\x27list\x27\x20to\x20see\x20all\x20valid\x20services.');const h=a300a(f);e={'action':'toggle','service':f,'enabled':h,'reminder':g['reminder']};break;}case'enable':{if(!d)throw new Error('\x27service\x27\x20param\x20is\x20required\x20for\x20enable');const i=d,j=getServiceInfo(i);if(!j)throw new Error('Unknown\x20service:\x20'+i+'.\x20Use\x20action=\x27list\x27\x20to\x20see\x20all\x20valid\x20services.');a300b(i,!![]),e={'action':'enable','service':i,'enabled':!![],'reminder':j['reminder']};break;}case'disable':{if(!d)throw new Error('\x27service\x27\x20param\x20is\x20required\x20for\x20disable');const k=d,l=getServiceInfo(k);if(!l)throw new Error('Unknown\x20service:\x20'+k+'.\x20Use\x20action=\x27list\x27\x20to\x20see\x20all\x20valid\x20services.');a300b(k,![]),e={'action':'disable','service':k,'enabled':![],'reminder':l['reminder']};break;}case'reset':{if(!d)throw new Error('\x27service\x27\x20param\x20is\x20required\x20for\x20reset');const m=d,n=getServiceInfo(m);if(!n)throw new Error('Unknown\x20service:\x20'+m+'.\x20Use\x20action=\x27list\x27\x20to\x20see\x20all\x20valid\x20services.');a300c(m),e={'action':'reset','service':m,'enabled':getServiceInfo(m)?.['enabled'],'reminder':n['reminder'],'reset':!![]};break;}case'info':{if(!d)throw new Error('\x27service\x27\x20param\x20is\x20required\x20for\x20info');const o=d,p=getServiceInfo(o);if(!p)throw new Error('Unknown\x20service:\x20'+o+'.\x20Use\x20action=\x27list\x27\x20to\x20see\x20all\x20valid\x20services.');e={'action':'info',...p};break;}default:throw new Error('Unknown\x20config_operation\x20action:\x20'+String(c));}return{'content':[{'type':'text','text':JSON['stringify']({'result':e})}],'structuredContent':{'result':e}};}