@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
@@ -1,139 +1 @@
1
- export const RECOVERY_RULES = {
2
- insufficient_balance: {
3
- error_code: "insufficient_balance",
4
- strategy: "claim_faucet",
5
- max_attempts: 3,
6
- automation: "semi",
7
- detail: "1. Testnet: claim WOW from the faucet 2. Mainnet: transfer ETH/USDT/USDC/WBTC via the ETH mainnet cross-chain bridge (query active EVM account → top up from external wallet → confirm → cross-chain) 3. Mention the WOW airdrop (under construction) 4. Retry original operation",
8
- user_prompt: "Insufficient balance for gas or operation. How to obtain WOW tokens: (1) Testnet — claim WOW from the faucet (https://faucet.testnet.wowok.net); all merchant and order testing can use WOW as the payment token. (2) Mainnet — transfer ETH / USDT / USDC / WBTC via the ETH mainnet cross-chain bridge: first query the active EVM account (bridge_operation query_active_evm_account, auto-generated on first use), then transfer from an external wallet (e.g. MetaMask) to that address, confirm the balance arrived, and cross-chain to WOW mainnet (bridge_operation cross_chain_evm_to_wow). (3) WOW mainnet airdrop: https://airdrop.wowok.net (under construction).",
9
- },
10
- network_error: {
11
- error_code: "network_error",
12
- strategy: "retry",
13
- max_attempts: 5,
14
- automation: "full",
15
- detail: "Exponential backoff retry: 1s / 2s / 4s / 8s / 16s. Switch RPC node if available.",
16
- },
17
- guard_rejected: {
18
- error_code: "guard_rejected",
19
- strategy: "fill_submission",
20
- max_attempts: 2,
21
- automation: "semi",
22
- detail: "1. Parse Guard table structure 2. Prompt user to fill submission fields 3. Resubmit with call_with_submission",
23
- user_prompt: "Guard verification rejected. Please fill in the required submission data and resubmit.",
24
- },
25
- immutable_violation: {
26
- error_code: "immutable_violation",
27
- strategy: "recreate",
28
- max_attempts: 1,
29
- automation: "semi",
30
- detail: "1. Stop modification attempt 2. Evaluate creating a new object as replacement 3. Re-plan affected phases",
31
- user_prompt: "Cannot modify an immutable object. A new object must be created as a replacement. Confirm to proceed with recreation.",
32
- },
33
- permission_denied: {
34
- error_code: "permission_denied",
35
- strategy: "switch_account",
36
- max_attempts: 2,
37
- automation: "semi",
38
- detail: "1. Query object's permission_guard 2. List accounts with permission 3. Switch account or prompt user to add permission",
39
- user_prompt: "Current account lacks permission for this operation. Switch to an authorized account or update the Permission object.",
40
- },
41
- object_not_found: {
42
- error_code: "object_not_found",
43
- strategy: "query_and_retry",
44
- max_attempts: 3,
45
- automation: "semi",
46
- detail: "1. Re-query the object (may be sync delay) 2. If truly absent, search for similar objects 3. Prompt user to reselect",
47
- user_prompt: "Referenced object not found. It may be a synchronization delay. Retrying... If the issue persists, please select a valid object.",
48
- },
49
- state_conflict: {
50
- error_code: "state_conflict",
51
- strategy: "adjust_params",
52
- max_attempts: 2,
53
- automation: "full",
54
- detail: "1. Query object's current true state 2. Update ODG status annotations 3. Adjust subsequent operations (e.g., skip completed steps)",
55
- },
56
- invalid_parameter: {
57
- error_code: "invalid_parameter",
58
- strategy: "adjust_params",
59
- max_attempts: 2,
60
- automation: "semi",
61
- detail: "1. Query the relevant schema 2. Auto-fix obvious errors (e.g., BigInt vs string) 3. If unfixable, prompt user",
62
- user_prompt: "Parameter validation failed. Please check the parameter types and values against the schema and retry.",
63
- },
64
- unknown: {
65
- error_code: "unknown",
66
- strategy: "escalate_human",
67
- max_attempts: 1,
68
- automation: "manual",
69
- detail: "1. Report full error context to telemetry 2. Escalate to human intervention 3. Flag for Loop Engineering rule addition",
70
- user_prompt: "An unclassified error occurred. Please review the error details and contact support if needed. This error has been logged for tool improvement.",
71
- },
72
- };
73
- const operationAttempts = new Map();
74
- function getAttemptCount(operationId, errorCode) {
75
- const opMap = operationAttempts.get(operationId);
76
- if (!opMap)
77
- return 0;
78
- return opMap.get(errorCode) ?? 0;
79
- }
80
- function incrementAttempt(operationId, errorCode) {
81
- if (!operationAttempts.has(operationId)) {
82
- operationAttempts.set(operationId, new Map());
83
- }
84
- const opMap = operationAttempts.get(operationId);
85
- const current = (opMap.get(errorCode) ?? 0) + 1;
86
- opMap.set(errorCode, current);
87
- return current;
88
- }
89
- function getTotalAttempts(operationId) {
90
- const opMap = operationAttempts.get(operationId);
91
- if (!opMap)
92
- return 0;
93
- let total = 0;
94
- for (const count of opMap.values())
95
- total += count;
96
- return total;
97
- }
98
- export function resetAttempts(operationId) {
99
- operationAttempts.delete(operationId);
100
- }
101
- export function recover(errorCode, operationId, context) {
102
- const rule = RECOVERY_RULES[errorCode] ?? RECOVERY_RULES.unknown;
103
- const TOTAL_RETRY_LIMIT = 5;
104
- const totalAttempts = getTotalAttempts(operationId);
105
- const typeAttempts = getAttemptCount(operationId, errorCode);
106
- if (totalAttempts >= TOTAL_RETRY_LIMIT) {
107
- return {
108
- strategy: "stop",
109
- should_retry: false,
110
- max_attempts: TOTAL_RETRY_LIMIT,
111
- current_attempt: totalAttempts,
112
- detail: `Total retry limit (${TOTAL_RETRY_LIMIT}) reached for operation ${operationId}. Escalating to human intervention.`,
113
- user_prompt: "Maximum retry attempts reached. Manual intervention required.",
114
- };
115
- }
116
- if (typeAttempts >= rule.max_attempts) {
117
- return {
118
- strategy: "escalate_human",
119
- should_retry: false,
120
- max_attempts: rule.max_attempts,
121
- current_attempt: typeAttempts,
122
- detail: `Per-error-code retry limit (${rule.max_attempts}) reached for ${errorCode}. Escalating to human.`,
123
- user_prompt: `Recovery attempts for ${errorCode} exhausted. Manual intervention required.`,
124
- };
125
- }
126
- const currentAttempt = incrementAttempt(operationId, errorCode);
127
- return {
128
- strategy: rule.strategy,
129
- should_retry: rule.automation === "full" || currentAttempt < rule.max_attempts,
130
- max_attempts: rule.max_attempts,
131
- current_attempt: currentAttempt,
132
- adjusted_params: rule.adjusted_params,
133
- user_prompt: rule.user_prompt,
134
- detail: rule.detail,
135
- };
136
- }
137
- export function getBackoffDelay(attempt) {
138
- return Math.pow(2, attempt - 1) * 1000;
139
- }
1
+ export const RECOVERY_RULES={'insufficient_balance':{'error_code':'insufficient_balance','strategy':'claim_faucet','max_attempts':0x3,'automation':'semi','detail':'1.\x20Testnet:\x20claim\x20WOW\x20from\x20the\x20faucet\x202.\x20Mainnet:\x20transfer\x20ETH/USDT/USDC/WBTC\x20via\x20the\x20ETH\x20mainnet\x20cross-chain\x20bridge\x20(query\x20active\x20EVM\x20account\x20→\x20top\x20up\x20from\x20external\x20wallet\x20→\x20confirm\x20→\x20cross-chain)\x203.\x20Mention\x20the\x20WOW\x20airdrop\x20(under\x20construction)\x204.\x20Retry\x20original\x20operation','user_prompt':'Insufficient\x20balance\x20for\x20gas\x20or\x20operation.\x20How\x20to\x20obtain\x20WOW\x20tokens:\x20(1)\x20Testnet\x20—\x20claim\x20WOW\x20from\x20the\x20faucet\x20(https://faucet.testnet.wowok.net);\x20all\x20merchant\x20and\x20order\x20testing\x20can\x20use\x20WOW\x20as\x20the\x20payment\x20token.\x20(2)\x20Mainnet\x20—\x20transfer\x20ETH\x20/\x20USDT\x20/\x20USDC\x20/\x20WBTC\x20via\x20the\x20ETH\x20mainnet\x20cross-chain\x20bridge:\x20first\x20query\x20the\x20active\x20EVM\x20account\x20(bridge_operation\x20query_active_evm_account,\x20auto-generated\x20on\x20first\x20use),\x20then\x20transfer\x20from\x20an\x20external\x20wallet\x20(e.g.\x20MetaMask)\x20to\x20that\x20address,\x20confirm\x20the\x20balance\x20arrived,\x20and\x20cross-chain\x20to\x20WOW\x20mainnet\x20(bridge_operation\x20cross_chain_evm_to_wow).\x20(3)\x20WOW\x20mainnet\x20airdrop:\x20https://airdrop.wowok.net\x20(under\x20construction).'},'network_error':{'error_code':'network_error','strategy':'retry','max_attempts':0x5,'automation':'full','detail':'Exponential\x20backoff\x20retry:\x201s\x20/\x202s\x20/\x204s\x20/\x208s\x20/\x2016s.\x20Switch\x20RPC\x20node\x20if\x20available.'},'guard_rejected':{'error_code':'guard_rejected','strategy':'fill_submission','max_attempts':0x2,'automation':'semi','detail':'1.\x20Parse\x20Guard\x20table\x20structure\x202.\x20Prompt\x20user\x20to\x20fill\x20submission\x20fields\x203.\x20Resubmit\x20with\x20call_with_submission','user_prompt':'Guard\x20verification\x20rejected.\x20Please\x20fill\x20in\x20the\x20required\x20submission\x20data\x20and\x20resubmit.'},'immutable_violation':{'error_code':'immutable_violation','strategy':'recreate','max_attempts':0x1,'automation':'semi','detail':'1.\x20Stop\x20modification\x20attempt\x202.\x20Evaluate\x20creating\x20a\x20new\x20object\x20as\x20replacement\x203.\x20Re-plan\x20affected\x20phases','user_prompt':'Cannot\x20modify\x20an\x20immutable\x20object.\x20A\x20new\x20object\x20must\x20be\x20created\x20as\x20a\x20replacement.\x20Confirm\x20to\x20proceed\x20with\x20recreation.'},'permission_denied':{'error_code':'permission_denied','strategy':'switch_account','max_attempts':0x2,'automation':'semi','detail':'1.\x20Query\x20object\x27s\x20permission_guard\x202.\x20List\x20accounts\x20with\x20permission\x203.\x20Switch\x20account\x20or\x20prompt\x20user\x20to\x20add\x20permission','user_prompt':'Current\x20account\x20lacks\x20permission\x20for\x20this\x20operation.\x20Switch\x20to\x20an\x20authorized\x20account\x20or\x20update\x20the\x20Permission\x20object.'},'object_not_found':{'error_code':'object_not_found','strategy':'query_and_retry','max_attempts':0x3,'automation':'semi','detail':'1.\x20Re-query\x20the\x20object\x20(may\x20be\x20sync\x20delay)\x202.\x20If\x20truly\x20absent,\x20search\x20for\x20similar\x20objects\x203.\x20Prompt\x20user\x20to\x20reselect','user_prompt':'Referenced\x20object\x20not\x20found.\x20It\x20may\x20be\x20a\x20synchronization\x20delay.\x20Retrying...\x20If\x20the\x20issue\x20persists,\x20please\x20select\x20a\x20valid\x20object.'},'state_conflict':{'error_code':'state_conflict','strategy':'adjust_params','max_attempts':0x2,'automation':'full','detail':'1.\x20Query\x20object\x27s\x20current\x20true\x20state\x202.\x20Update\x20ODG\x20status\x20annotations\x203.\x20Adjust\x20subsequent\x20operations\x20(e.g.,\x20skip\x20completed\x20steps)'},'invalid_parameter':{'error_code':'invalid_parameter','strategy':'adjust_params','max_attempts':0x2,'automation':'semi','detail':'1.\x20Query\x20the\x20relevant\x20schema\x202.\x20Auto-fix\x20obvious\x20errors\x20(e.g.,\x20BigInt\x20vs\x20string)\x203.\x20If\x20unfixable,\x20prompt\x20user','user_prompt':'Parameter\x20validation\x20failed.\x20Please\x20check\x20the\x20parameter\x20types\x20and\x20values\x20against\x20the\x20schema\x20and\x20retry.'},'unknown':{'error_code':'unknown','strategy':'escalate_human','max_attempts':0x1,'automation':'manual','detail':'1.\x20Report\x20full\x20error\x20context\x20to\x20telemetry\x202.\x20Escalate\x20to\x20human\x20intervention\x203.\x20Flag\x20for\x20Loop\x20Engineering\x20rule\x20addition','user_prompt':'An\x20unclassified\x20error\x20occurred.\x20Please\x20review\x20the\x20error\x20details\x20and\x20contact\x20support\x20if\x20needed.\x20This\x20error\x20has\x20been\x20logged\x20for\x20tool\x20improvement.'}};const operationAttempts=new Map();function getAttemptCount(a,b){const c=operationAttempts['get'](a);if(!c)return 0x0;return c['get'](b)??0x0;}function incrementAttempt(a,b){!operationAttempts['has'](a)&&operationAttempts['set'](a,new Map());const c=operationAttempts['get'](a),d=(c['get'](b)??0x0)+0x1;return c['set'](b,d),d;}function getTotalAttempts(a){const b=operationAttempts['get'](a);if(!b)return 0x0;let c=0x0;for(const d of b['values']())c+=d;return c;}export function resetAttempts(a){operationAttempts['delete'](a);}export function recover(a,b,c){const d=RECOVERY_RULES[a]??RECOVERY_RULES['unknown'],e=0x5,f=getTotalAttempts(b),g=getAttemptCount(b,a);if(f>=e)return{'strategy':'stop','should_retry':![],'max_attempts':e,'current_attempt':f,'detail':'Total\x20retry\x20limit\x20('+e+')\x20reached\x20for\x20operation\x20'+b+'.\x20Escalating\x20to\x20human\x20intervention.','user_prompt':'Maximum\x20retry\x20attempts\x20reached.\x20Manual\x20intervention\x20required.'};if(g>=d['max_attempts'])return{'strategy':'escalate_human','should_retry':![],'max_attempts':d['max_attempts'],'current_attempt':g,'detail':'Per-error-code\x20retry\x20limit\x20('+d['max_attempts']+')\x20reached\x20for\x20'+a+'.\x20Escalating\x20to\x20human.','user_prompt':'Recovery\x20attempts\x20for\x20'+a+'\x20exhausted.\x20Manual\x20intervention\x20required.'};const h=incrementAttempt(b,a);return{'strategy':d['strategy'],'should_retry':d['automation']==='full'||h<d['max_attempts'],'max_attempts':d['max_attempts'],'current_attempt':h,'adjusted_params':d['adjusted_params'],'user_prompt':d['user_prompt'],'detail':d['detail']};}export function getBackoffDelay(a){return Math['pow'](0x2,a-0x1)*0x3e8;}
@@ -1 +1 @@
1
- export {};
1
+ export{};
@@ -1,237 +1 @@
1
- function verifyCreated(expected, actual) {
2
- const mismatches = [];
3
- const expectedCreated = expected.expected.semantic_created ?? [];
4
- const actualCreated = actual.semantic?.created ?? [];
5
- for (const exp of expectedCreated) {
6
- const found = actualCreated.find((a) => a.role === exp.role);
7
- if (!found) {
8
- mismatches.push({
9
- dimension: "created",
10
- expected: `role=${exp.role}`,
11
- actual: "not found",
12
- severity: "fail",
13
- detail: `Expected to create object with role '${exp.role}', but none was created`,
14
- });
15
- }
16
- }
17
- for (const act of actualCreated) {
18
- const expected_role = expectedCreated.find((e) => e.role === act.role);
19
- if (!expected_role) {
20
- mismatches.push({
21
- dimension: "created",
22
- expected: `no object with role=${act.role}`,
23
- actual: `role=${act.role}`,
24
- severity: "warn",
25
- detail: `Unexpected object created with role '${act.role}' — may indicate rule table gap`,
26
- });
27
- }
28
- }
29
- return mismatches;
30
- }
31
- function verifyModified(expected, actual) {
32
- const mismatches = [];
33
- const expectedModified = expected.expected.semantic_modified ?? [];
34
- const actualModified = actual.semantic?.modified ?? [];
35
- for (const exp of expectedModified) {
36
- const found = actualModified.find((a) => a.role === exp.role);
37
- if (!found) {
38
- mismatches.push({
39
- dimension: "modified",
40
- expected: `role=${exp.role} fields=${JSON.stringify(exp.expect_fields ?? {})}`,
41
- actual: "not modified",
42
- severity: "fail",
43
- detail: `Expected to modify object with role '${exp.role}', but it was not modified`,
44
- });
45
- }
46
- }
47
- return mismatches;
48
- }
49
- function verifyReleased(expected, actual) {
50
- const mismatches = [];
51
- const expectedReleased = expected.expected.semantic_released ?? [];
52
- const actualReleased = actual.semantic?.released ?? [];
53
- for (const exp of expectedReleased) {
54
- const found = actualReleased.find((a) => a.role === exp.role);
55
- if (!found) {
56
- mismatches.push({
57
- dimension: "released",
58
- expected: `role=${exp.role} amount=${exp.amount ?? "?"} from=${exp.from ?? "?"} to=${exp.to ?? "?"}`,
59
- actual: "no fund movement",
60
- severity: "fail",
61
- detail: `Expected fund movement with role '${exp.role}', but none occurred — fund flow risk`,
62
- });
63
- }
64
- else {
65
- if (exp.amount && exp.amount !== found.amount) {
66
- mismatches.push({
67
- dimension: "released",
68
- expected: `amount=${exp.amount}`,
69
- actual: `amount=${found.amount}`,
70
- severity: "fail",
71
- detail: `Fund amount mismatch for role '${exp.role}' — fund flow risk`,
72
- });
73
- }
74
- if (exp.from && found.from && exp.from !== found.from) {
75
- mismatches.push({
76
- dimension: "released",
77
- expected: `from=${exp.from}`,
78
- actual: `from=${found.from}`,
79
- severity: "fail",
80
- detail: `Fund source mismatch for role '${exp.role}' — fund flow direction risk`,
81
- });
82
- }
83
- if (exp.to && found.to && exp.to !== found.to) {
84
- mismatches.push({
85
- dimension: "released",
86
- expected: `to=${exp.to}`,
87
- actual: `to=${found.to}`,
88
- severity: "fail",
89
- detail: `Fund destination mismatch for role '${exp.role}' — fund flow direction risk`,
90
- });
91
- }
92
- }
93
- }
94
- return mismatches;
95
- }
96
- function verifyEvents(expected, actual) {
97
- const mismatches = [];
98
- const expectedEvents = expected.expected.events ?? [];
99
- const actualEvents = actual.semantic?.events ?? [];
100
- for (const exp of expectedEvents) {
101
- const found = actualEvents.find((a) => a.event_type.includes(exp.type) || a.business_meaning.toLowerCase().includes(exp.type.toLowerCase()));
102
- if (!found) {
103
- mismatches.push({
104
- dimension: "event",
105
- expected: `event_type contains '${exp.type}'`,
106
- actual: "event not found",
107
- severity: "warn",
108
- detail: `Expected event '${exp.type}' was not found — may indicate semantic layer gap or operation didn't trigger it`,
109
- });
110
- }
111
- }
112
- return mismatches;
113
- }
114
- function verifyStateTransition(expected, actual) {
115
- const mismatches = [];
116
- const transition = expected.expected.state_transition;
117
- if (!transition)
118
- return mismatches;
119
- if (actual.semantic?.status === "success") {
120
- return mismatches;
121
- }
122
- if (actual.semantic?.status === "failed") {
123
- mismatches.push({
124
- dimension: "state",
125
- expected: `${transition.from} → ${transition.to}`,
126
- actual: "operation failed",
127
- severity: "fail",
128
- detail: `Expected state transition '${transition.from} → ${transition.to}' failed — operation did not succeed`,
129
- });
130
- }
131
- return mismatches;
132
- }
133
- export function verify(input) {
134
- const mismatches = [
135
- ...verifyCreated(input.expected, input.actual),
136
- ...verifyModified(input.expected, input.actual),
137
- ...verifyReleased(input.expected, input.actual),
138
- ...verifyEvents(input.expected, input.actual),
139
- ...verifyStateTransition(input.expected, input.actual),
140
- ];
141
- const hasFail = mismatches.some((m) => m.severity === "fail");
142
- const hasWarn = mismatches.some((m) => m.severity === "warn");
143
- const status = hasFail ? "fail" : hasWarn ? "warn" : "pass";
144
- const failCount = mismatches.filter((m) => m.severity === "fail").length;
145
- const warnCount = mismatches.filter((m) => m.severity === "warn").length;
146
- let summary;
147
- if (status === "pass") {
148
- summary = "All verifications passed — expected results match actual results";
149
- }
150
- else if (status === "warn") {
151
- summary = `${warnCount} warning(s) — operation succeeded with minor discrepancies`;
152
- }
153
- else {
154
- summary = `${failCount} failure(s), ${warnCount} warning(s) — expected results do not match actual results`;
155
- }
156
- return {
157
- status,
158
- mismatches,
159
- summary,
160
- timestamp: new Date().toISOString(),
161
- };
162
- }
163
- export function generateExpected(operation, intent, operationType, data) {
164
- const expected = {
165
- result_type: "transaction",
166
- };
167
- switch (operationType) {
168
- case "service":
169
- if (data?.publish === true || data?.bPublished === true) {
170
- expected.semantic_modified = [{ role: "Service", expect_fields: { bPublished: true } }];
171
- expected.state_transition = { from: "unpublished", to: "published" };
172
- }
173
- else {
174
- expected.semantic_created = [{ role: "Service" }];
175
- }
176
- break;
177
- case "machine":
178
- expected.semantic_created = [{ role: "Machine" }];
179
- break;
180
- case "guard":
181
- expected.semantic_created = [{ role: "Guard" }];
182
- expected.events = [{ type: "GuardCreated", expect_count: ">=1" }];
183
- break;
184
- case "permission":
185
- expected.semantic_created = [{ role: "Permission" }];
186
- break;
187
- case "order":
188
- if (data?.arb !== undefined) {
189
- expected.state_transition = { from: "ordered", to: "arbitration" };
190
- }
191
- else {
192
- expected.semantic_created = [{ role: "Order" }];
193
- expected.semantic_released = [{ role: "payment" }];
194
- expected.events = [{ type: "OrderPaid", expect_count: ">=1" }];
195
- }
196
- break;
197
- case "payment":
198
- expected.semantic_released = [{ role: "payment" }];
199
- break;
200
- case "treasury":
201
- if (data?.deposit !== undefined) {
202
- expected.semantic_released = [{ role: "deposit" }];
203
- }
204
- else {
205
- expected.semantic_released = [{ role: "release" }];
206
- }
207
- break;
208
- case "reward":
209
- if (data?.claim !== undefined || data?.withdraw !== undefined) {
210
- expected.semantic_released = [{ role: "reward" }];
211
- }
212
- else {
213
- expected.semantic_created = [{ role: "Reward" }];
214
- }
215
- break;
216
- case "allocation":
217
- expected.semantic_released = [{ role: "release" }];
218
- expected.events = [{ type: "Allocation", expect_count: ">=1" }];
219
- break;
220
- case "demand":
221
- if (data?.submit !== undefined) {
222
- expected.semantic_modified = [{ role: "Demand" }];
223
- }
224
- else {
225
- expected.semantic_created = [{ role: "Demand" }];
226
- }
227
- break;
228
- default:
229
- break;
230
- }
231
- return {
232
- operation,
233
- intent,
234
- pre_conditions: [],
235
- expected,
236
- };
237
- }
1
+ function verifyCreated(a,b){const c=[],d=a['expected']['semantic_created']??[],e=b['semantic']?.['created']??[];for(const f of d){const g=e['find'](h=>h['role']===f['role']);!g&&c['push']({'dimension':'created','expected':'role='+f['role'],'actual':'not\x20found','severity':'fail','detail':'Expected\x20to\x20create\x20object\x20with\x20role\x20\x27'+f['role']+'\x27,\x20but\x20none\x20was\x20created'});}for(const h of e){const i=d['find'](j=>j['role']===h['role']);!i&&c['push']({'dimension':'created','expected':'no\x20object\x20with\x20role='+h['role'],'actual':'role='+h['role'],'severity':'warn','detail':'Unexpected\x20object\x20created\x20with\x20role\x20\x27'+h['role']+'\x27\x20—\x20may\x20indicate\x20rule\x20table\x20gap'});}return c;}function verifyModified(a,b){const c=[],d=a['expected']['semantic_modified']??[],e=b['semantic']?.['modified']??[];for(const f of d){const g=e['find'](h=>h['role']===f['role']);!g&&c['push']({'dimension':'modified','expected':'role='+f['role']+'\x20fields='+JSON['stringify'](f['expect_fields']??{}),'actual':'not\x20modified','severity':'fail','detail':'Expected\x20to\x20modify\x20object\x20with\x20role\x20\x27'+f['role']+'\x27,\x20but\x20it\x20was\x20not\x20modified'});}return c;}function verifyReleased(a,b){const c=[],d=a['expected']['semantic_released']??[],e=b['semantic']?.['released']??[];for(const f of d){const g=e['find'](h=>h['role']===f['role']);!g?c['push']({'dimension':'released','expected':'role='+f['role']+'\x20amount='+(f['amount']??'?')+'\x20from='+(f['from']??'?')+'\x20to='+(f['to']??'?'),'actual':'no\x20fund\x20movement','severity':'fail','detail':'Expected\x20fund\x20movement\x20with\x20role\x20\x27'+f['role']+'\x27,\x20but\x20none\x20occurred\x20—\x20fund\x20flow\x20risk'}):(f['amount']&&f['amount']!==g['amount']&&c['push']({'dimension':'released','expected':'amount='+f['amount'],'actual':'amount='+g['amount'],'severity':'fail','detail':'Fund\x20amount\x20mismatch\x20for\x20role\x20\x27'+f['role']+'\x27\x20—\x20fund\x20flow\x20risk'}),f['from']&&g['from']&&f['from']!==g['from']&&c['push']({'dimension':'released','expected':'from='+f['from'],'actual':'from='+g['from'],'severity':'fail','detail':'Fund\x20source\x20mismatch\x20for\x20role\x20\x27'+f['role']+'\x27\x20—\x20fund\x20flow\x20direction\x20risk'}),f['to']&&g['to']&&f['to']!==g['to']&&c['push']({'dimension':'released','expected':'to='+f['to'],'actual':'to='+g['to'],'severity':'fail','detail':'Fund\x20destination\x20mismatch\x20for\x20role\x20\x27'+f['role']+'\x27\x20—\x20fund\x20flow\x20direction\x20risk'}));}return c;}function verifyEvents(a,b){const c=[],d=a['expected']['events']??[],e=b['semantic']?.['events']??[];for(const f of d){const g=e['find'](h=>h['event_type']['includes'](f['type'])||h['business_meaning']['toLowerCase']()['includes'](f['type']['toLowerCase']()));!g&&c['push']({'dimension':'event','expected':'event_type\x20contains\x20\x27'+f['type']+'\x27','actual':'event\x20not\x20found','severity':'warn','detail':'Expected\x20event\x20\x27'+f['type']+'\x27\x20was\x20not\x20found\x20—\x20may\x20indicate\x20semantic\x20layer\x20gap\x20or\x20operation\x20didn\x27t\x20trigger\x20it'});}return c;}function verifyStateTransition(a,b){const c=[],d=a['expected']['state_transition'];if(!d)return c;if(b['semantic']?.['status']==='success')return c;return b['semantic']?.['status']==='failed'&&c['push']({'dimension':'state','expected':d['from']+'\x20→\x20'+d['to'],'actual':'operation\x20failed','severity':'fail','detail':'Expected\x20state\x20transition\x20\x27'+d['from']+'\x20→\x20'+d['to']+'\x27\x20failed\x20—\x20operation\x20did\x20not\x20succeed'}),c;}export function verify(a){const b=[...verifyCreated(a['expected'],a['actual']),...verifyModified(a['expected'],a['actual']),...verifyReleased(a['expected'],a['actual']),...verifyEvents(a['expected'],a['actual']),...verifyStateTransition(a['expected'],a['actual'])],c=b['some'](i=>i['severity']==='fail'),d=b['some'](i=>i['severity']==='warn'),e=c?'fail':d?'warn':'pass',f=b['filter'](i=>i['severity']==='fail')['length'],g=b['filter'](i=>i['severity']==='warn')['length'];let h;if(e==='pass')h='All\x20verifications\x20passed\x20—\x20expected\x20results\x20match\x20actual\x20results';else e==='warn'?h=g+'\x20warning(s)\x20—\x20operation\x20succeeded\x20with\x20minor\x20discrepancies':h=f+'\x20failure(s),\x20'+g+'\x20warning(s)\x20—\x20expected\x20results\x20do\x20not\x20match\x20actual\x20results';return{'status':e,'mismatches':b,'summary':h,'timestamp':new Date()['toISOString']()};}export function generateExpected(a,b,c,d){const e={'result_type':'transaction'};switch(c){case'service':d?.['publish']===!![]||d?.['bPublished']===!![]?(e['semantic_modified']=[{'role':'Service','expect_fields':{'bPublished':!![]}}],e['state_transition']={'from':'unpublished','to':'published'}):e['semantic_created']=[{'role':'Service'}];break;case'machine':e['semantic_created']=[{'role':'Machine'}];break;case'guard':e['semantic_created']=[{'role':'Guard'}],e['events']=[{'type':'GuardCreated','expect_count':'>=1'}];break;case'permission':e['semantic_created']=[{'role':'Permission'}];break;case'order':d?.['arb']!==undefined?e['state_transition']={'from':'ordered','to':'arbitration'}:(e['semantic_created']=[{'role':'Order'}],e['semantic_released']=[{'role':'payment'}],e['events']=[{'type':'OrderPaid','expect_count':'>=1'}]);break;case'payment':e['semantic_released']=[{'role':'payment'}];break;case'treasury':d?.['deposit']!==undefined?e['semantic_released']=[{'role':'deposit'}]:e['semantic_released']=[{'role':'release'}];break;case'reward':d?.['claim']!==undefined||d?.['withdraw']!==undefined?e['semantic_released']=[{'role':'reward'}]:e['semantic_created']=[{'role':'Reward'}];break;case'allocation':e['semantic_released']=[{'role':'release'}],e['events']=[{'type':'Allocation','expect_count':'>=1'}];break;case'demand':d?.['submit']!==undefined?e['semantic_modified']=[{'role':'Demand'}]:e['semantic_created']=[{'role':'Demand'}];break;default:break;}return{'operation':a,'intent':b,'pre_conditions':[],'expected':e};}