@wowok/agent-mcp 2.7.1 → 2.7.3

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 (597) hide show
  1. package/dist/config/index.js +1 -1
  2. package/dist/config/runtime.js +1 -238
  3. package/dist/customer/account-events.d.ts +32 -0
  4. package/dist/customer/account-events.js +1 -0
  5. package/dist/customer/customer-advice.d.ts +1 -0
  6. package/dist/customer/customer-advice.js +1 -130
  7. package/dist/customer/index.js +1 -11
  8. package/dist/customer/industry-risks.js +1 -438
  9. package/dist/customer/info-puzzle.js +1 -681
  10. package/dist/customer/order-monitor.js +1 -328
  11. package/dist/customer/order-strategy.d.ts +1 -1
  12. package/dist/customer/order-strategy.js +1 -373
  13. package/dist/customer/post-purchase.js +1 -351
  14. package/dist/customer/preorder-compare.js +1 -34
  15. package/dist/customer/reminder-system.d.ts +2 -0
  16. package/dist/customer/reminder-system.js +1 -316
  17. package/dist/customer/risk-assessment.d.ts +1 -0
  18. package/dist/customer/risk-assessment.js +1 -397
  19. package/dist/customer/types.d.ts +2 -0
  20. package/dist/customer/types.js +1 -13
  21. package/dist/customer/user-preferences.js +1 -460
  22. package/dist/evaluation/arbitration-game.d.ts +9 -2
  23. package/dist/evaluation/arbitration-game.js +1 -48
  24. package/dist/evaluation/builtins/arbitration-score.d.ts +41 -0
  25. package/dist/evaluation/builtins/arbitration-score.js +1 -0
  26. package/dist/evaluation/builtins/demand-match.js +1 -153
  27. package/dist/evaluation/builtins/index.d.ts +1 -0
  28. package/dist/evaluation/builtins/index.js +1 -10
  29. package/dist/evaluation/builtins/service-risk.js +1 -55
  30. package/dist/evaluation/capability.js +1 -13
  31. package/dist/evaluation/category-match-rules.d.ts +30 -0
  32. package/dist/evaluation/category-match-rules.js +1 -0
  33. package/dist/evaluation/composer.js +1 -40
  34. package/dist/evaluation/engine.js +1 -175
  35. package/dist/evaluation/extract.js +1 -115
  36. package/dist/evaluation/game-strategy.d.ts +27 -0
  37. package/dist/evaluation/game-strategy.js +1 -0
  38. package/dist/evaluation/gap.js +1 -100
  39. package/dist/evaluation/index.d.ts +2 -0
  40. package/dist/evaluation/index.js +1 -11
  41. package/dist/evaluation/location-match.d.ts +42 -0
  42. package/dist/evaluation/location-match.js +1 -0
  43. package/dist/evaluation/node-game.d.ts +31 -3
  44. package/dist/evaluation/node-game.js +1 -57
  45. package/dist/evaluation/path-reasoning.d.ts +35 -0
  46. package/dist/evaluation/path-reasoning.js +1 -0
  47. package/dist/evaluation/region.d.ts +6 -0
  48. package/dist/evaluation/region.js +1 -36
  49. package/dist/evaluation/types.d.ts +18 -0
  50. package/dist/evaluation/types.js +1 -1
  51. package/dist/evaluation/user-injection.js +1 -27
  52. package/dist/experience/experience-reuse.js +1 -103
  53. package/dist/experience/index.js +1 -5
  54. package/dist/experience/intent-distill.js +1 -83
  55. package/dist/experience/realtime-feedback.js +1 -94
  56. package/dist/experience/types.js +1 -1
  57. package/dist/experience/user-profile.d.ts +1 -1
  58. package/dist/experience/user-profile.js +1 -171
  59. package/dist/extensions/business-modules.js +1 -287
  60. package/dist/extensions/capability-manifest.js +1 -781
  61. package/dist/extensions/constraint-registry.js +1 -198
  62. package/dist/extensions/index.d.ts +6 -0
  63. package/dist/extensions/index.js +1 -6
  64. package/dist/extensions/industry-layers.d.ts +75 -0
  65. package/dist/extensions/industry-layers.js +1 -0
  66. package/dist/extensions/industry-pack.d.ts +105 -0
  67. package/dist/extensions/industry-pack.js +1 -0
  68. package/dist/extensions/metric-registry.js +1 -257
  69. package/dist/extensions/mode-evaluator.d.ts +1 -1
  70. package/dist/extensions/mode-evaluator.js +1 -170
  71. package/dist/extensions/modes.js +1 -499
  72. package/dist/extensions/registry.d.ts +1 -0
  73. package/dist/extensions/registry.js +1 -717
  74. package/dist/extensions/types.js +1 -1
  75. package/dist/graph/base.d.ts +8 -0
  76. package/dist/graph/base.js +1 -0
  77. package/dist/harness/auto-escalation.js +1 -68
  78. package/dist/harness/checkpoint.js +1 -129
  79. package/dist/harness/index.d.ts +1 -0
  80. package/dist/harness/index.js +1 -78
  81. package/dist/harness/plan.d.ts +2 -0
  82. package/dist/harness/plan.js +1 -315
  83. package/dist/harness/recover.d.ts +1 -1
  84. package/dist/harness/recover.js +1 -139
  85. package/dist/harness/types.d.ts +2 -3
  86. package/dist/harness/types.js +1 -1
  87. package/dist/harness/verify.js +1 -237
  88. package/dist/index.js +1 -273
  89. package/dist/intent/enrich.js +1 -67
  90. package/dist/intent/index.js +1 -60
  91. package/dist/intent/matcher.js +1 -81
  92. package/dist/intent/store.js +1 -55
  93. package/dist/intent/types.js +1 -10
  94. package/dist/knowledge/acquisition-flywheel.js +1 -192
  95. package/dist/knowledge/allocation-confirm.js +1 -534
  96. package/dist/knowledge/allocation-context.js +1 -249
  97. package/dist/knowledge/allocation-ledger.js +1 -463
  98. package/dist/knowledge/allocation-puzzle.js +1 -298
  99. package/dist/knowledge/allocation-risk.js +1 -568
  100. package/dist/knowledge/allocation-templates.js +1 -970
  101. package/dist/knowledge/allocation-translation.js +1 -585
  102. package/dist/knowledge/anti-cheat.d.ts +37 -0
  103. package/dist/knowledge/anti-cheat.js +1 -0
  104. package/dist/knowledge/arb-confirm.d.ts +28 -0
  105. package/dist/knowledge/arb-confirm.js +1 -0
  106. package/dist/knowledge/arb-risk.js +1 -210
  107. package/dist/knowledge/arb-translation.d.ts +48 -0
  108. package/dist/knowledge/arb-translation.js +1 -0
  109. package/dist/knowledge/arbitration-confirm.js +1 -559
  110. package/dist/knowledge/arbitration-context.js +1 -505
  111. package/dist/knowledge/arbitration-ledger.js +1 -521
  112. package/dist/knowledge/arbitration-puzzle.js +1 -304
  113. package/dist/knowledge/arbitration-risk.js +1 -423
  114. package/dist/knowledge/arbitration-templates.js +1 -276
  115. package/dist/knowledge/arbitration-translation.js +1 -487
  116. package/dist/knowledge/audit-rules.js +1 -141
  117. package/dist/knowledge/bridge-confirm.d.ts +26 -0
  118. package/dist/knowledge/bridge-confirm.js +1 -0
  119. package/dist/knowledge/bridge-risk.js +1 -263
  120. package/dist/knowledge/bridge-translation.d.ts +37 -0
  121. package/dist/knowledge/bridge-translation.js +1 -0
  122. package/dist/knowledge/contact-confirm.d.ts +27 -0
  123. package/dist/knowledge/contact-confirm.js +1 -0
  124. package/dist/knowledge/contact-risk.js +1 -200
  125. package/dist/knowledge/contact-templates.js +1 -60
  126. package/dist/knowledge/contact-translation.d.ts +39 -0
  127. package/dist/knowledge/contact-translation.js +1 -0
  128. package/dist/knowledge/demand-confirm.js +1 -206
  129. package/dist/knowledge/demand-context.d.ts +17 -0
  130. package/dist/knowledge/demand-context.js +1 -0
  131. package/dist/knowledge/demand-ledger.d.ts +26 -0
  132. package/dist/knowledge/demand-ledger.js +1 -0
  133. package/dist/knowledge/demand-matching.js +1 -132
  134. package/dist/knowledge/demand-puzzle.d.ts +29 -0
  135. package/dist/knowledge/demand-puzzle.js +1 -0
  136. package/dist/knowledge/demand-risk.js +1 -240
  137. package/dist/knowledge/demand-templates.d.ts +12 -0
  138. package/dist/knowledge/demand-templates.js +1 -0
  139. package/dist/knowledge/demand-translation.js +1 -354
  140. package/dist/knowledge/deployment-scanner.js +1 -823
  141. package/dist/knowledge/dynamic-pricing.js +1 -87
  142. package/dist/knowledge/evidence-review.d.ts +12 -0
  143. package/dist/knowledge/evidence-review.js +1 -0
  144. package/dist/knowledge/examples-scanner-cli.js +1 -26
  145. package/dist/knowledge/examples-scanner.js +1 -843
  146. package/dist/knowledge/flywheel-loop.d.ts +0 -1
  147. package/dist/knowledge/flywheel-loop.js +1 -404
  148. package/dist/knowledge/fund-layer.js +1 -973
  149. package/dist/knowledge/glossary.js +1 -211
  150. package/dist/knowledge/guard-confirm.js +1 -406
  151. package/dist/knowledge/guard-context.js +1 -287
  152. package/dist/knowledge/guard-design-patterns.js +1 -360
  153. package/dist/knowledge/guard-ledger.js +1 -260
  154. package/dist/knowledge/guard-lint.js +1 -670
  155. package/dist/knowledge/guard-migration.d.ts +1 -1
  156. package/dist/knowledge/guard-migration.js +1 -228
  157. package/dist/knowledge/guard-puzzle.js +1 -805
  158. package/dist/knowledge/guard-render.js +1 -700
  159. package/dist/knowledge/guard-risk.js +1 -1879
  160. package/dist/knowledge/guard-submission-prompt.js +1 -171
  161. package/dist/knowledge/guard-templates.js +1 -1105
  162. package/dist/knowledge/guard-translation.js +1 -1119
  163. package/dist/knowledge/index.d.ts +71 -3
  164. package/dist/knowledge/index.js +1 -436
  165. package/dist/knowledge/industry-evolution.js +1 -323
  166. package/dist/knowledge/industry-generalizer.js +1 -381
  167. package/dist/knowledge/industry-registry.js +1 -174
  168. package/dist/knowledge/intent-metrics.d.ts +4 -3
  169. package/dist/knowledge/intent-metrics.js +1 -566
  170. package/dist/knowledge/machine-confirm.js +1 -559
  171. package/dist/knowledge/machine-context.js +1 -833
  172. package/dist/knowledge/machine-ledger.js +1 -338
  173. package/dist/knowledge/machine-puzzle.js +1 -494
  174. package/dist/knowledge/machine-render.js +1 -565
  175. package/dist/knowledge/machine-risk.js +1 -669
  176. package/dist/knowledge/machine-templates.js +1 -1597
  177. package/dist/knowledge/machine-topology.js +1 -234
  178. package/dist/knowledge/machine-translation.js +1 -513
  179. package/dist/knowledge/market-metrics.d.ts +12 -0
  180. package/dist/knowledge/market-metrics.js +1 -0
  181. package/dist/knowledge/market-operations.d.ts +46 -0
  182. package/dist/knowledge/market-operations.js +1 -0
  183. package/dist/knowledge/mcp-schema-audit-cli.js +1 -45
  184. package/dist/knowledge/mcp-schema-audit.d.ts +22 -22
  185. package/dist/knowledge/mcp-schema-audit.js +1 -777
  186. package/dist/knowledge/onchain-constants.js +1 -35
  187. package/dist/knowledge/order-confirm.js +1 -573
  188. package/dist/knowledge/order-context.js +1 -390
  189. package/dist/knowledge/order-ledger.js +1 -341
  190. package/dist/knowledge/order-puzzle.js +1 -255
  191. package/dist/knowledge/order-risk.js +1 -653
  192. package/dist/knowledge/order-templates.js +1 -368
  193. package/dist/knowledge/order-translation.js +1 -550
  194. package/dist/knowledge/overrides-loader.js +1 -65
  195. package/dist/knowledge/passport-confirm.js +1 -531
  196. package/dist/knowledge/passport-context.js +1 -306
  197. package/dist/knowledge/passport-ledger.js +1 -282
  198. package/dist/knowledge/passport-puzzle.js +1 -333
  199. package/dist/knowledge/passport-risk.js +1 -450
  200. package/dist/knowledge/passport-templates.js +1 -568
  201. package/dist/knowledge/passport-translation.js +1 -516
  202. package/dist/knowledge/payment-confirm.d.ts +26 -0
  203. package/dist/knowledge/payment-confirm.js +1 -0
  204. package/dist/knowledge/payment-risk.js +1 -249
  205. package/dist/knowledge/payment-translation.d.ts +37 -0
  206. package/dist/knowledge/payment-translation.js +1 -0
  207. package/dist/knowledge/permission-confirm.js +1 -426
  208. package/dist/knowledge/permission-context.js +1 -224
  209. package/dist/knowledge/permission-ledger.d.ts +11 -0
  210. package/dist/knowledge/permission-ledger.js +1 -403
  211. package/dist/knowledge/permission-puzzle.js +1 -173
  212. package/dist/knowledge/permission-risk.js +1 -411
  213. package/dist/knowledge/permission-templates.js +1 -234
  214. package/dist/knowledge/permission-translation.js +1 -350
  215. package/dist/knowledge/personal-confirm.d.ts +29 -0
  216. package/dist/knowledge/personal-confirm.js +1 -0
  217. package/dist/knowledge/personal-risk.js +1 -212
  218. package/dist/knowledge/personal-translation.d.ts +37 -0
  219. package/dist/knowledge/personal-translation.js +1 -0
  220. package/dist/knowledge/process-model.d.ts +1 -11
  221. package/dist/knowledge/process-model.js +1 -160
  222. package/dist/knowledge/progress-confirm.js +1 -456
  223. package/dist/knowledge/progress-context.js +1 -452
  224. package/dist/knowledge/progress-ledger.js +1 -330
  225. package/dist/knowledge/progress-puzzle.js +1 -219
  226. package/dist/knowledge/progress-risk.js +1 -461
  227. package/dist/knowledge/progress-templates.js +1 -228
  228. package/dist/knowledge/progress-translation.js +1 -405
  229. package/dist/knowledge/proof-confirm.js +1 -187
  230. package/dist/knowledge/proof-context.d.ts +17 -0
  231. package/dist/knowledge/proof-context.js +1 -0
  232. package/dist/knowledge/proof-ledger.d.ts +34 -0
  233. package/dist/knowledge/proof-ledger.js +1 -0
  234. package/dist/knowledge/proof-puzzle.d.ts +35 -0
  235. package/dist/knowledge/proof-puzzle.js +1 -0
  236. package/dist/knowledge/proof-risk.js +1 -207
  237. package/dist/knowledge/proof-templates.d.ts +22 -0
  238. package/dist/knowledge/proof-templates.js +1 -0
  239. package/dist/knowledge/proof-translation.js +1 -283
  240. package/dist/knowledge/registrar-confirm.d.ts +26 -0
  241. package/dist/knowledge/registrar-confirm.js +1 -0
  242. package/dist/knowledge/registrar-risk.js +1 -217
  243. package/dist/knowledge/registrar-translation.d.ts +37 -0
  244. package/dist/knowledge/registrar-translation.js +1 -0
  245. package/dist/knowledge/repository-confirm.js +1 -286
  246. package/dist/knowledge/repository-context.d.ts +12 -0
  247. package/dist/knowledge/repository-context.js +1 -0
  248. package/dist/knowledge/repository-ledger.d.ts +25 -0
  249. package/dist/knowledge/repository-ledger.js +1 -0
  250. package/dist/knowledge/repository-puzzle.d.ts +30 -0
  251. package/dist/knowledge/repository-puzzle.js +1 -0
  252. package/dist/knowledge/repository-risk.js +1 -373
  253. package/dist/knowledge/repository-templates.d.ts +14 -0
  254. package/dist/knowledge/repository-templates.js +1 -0
  255. package/dist/knowledge/repository-translation.js +1 -445
  256. package/dist/knowledge/reputation-rules.js +1 -99
  257. package/dist/knowledge/resource-confirm.d.ts +25 -0
  258. package/dist/knowledge/resource-confirm.js +1 -0
  259. package/dist/knowledge/resource-risk.js +1 -157
  260. package/dist/knowledge/resource-translation.d.ts +37 -0
  261. package/dist/knowledge/resource-translation.js +1 -0
  262. package/dist/knowledge/reward-confirm.js +1 -526
  263. package/dist/knowledge/reward-context.d.ts +2 -2
  264. package/dist/knowledge/reward-context.js +1 -504
  265. package/dist/knowledge/reward-ledger.js +1 -502
  266. package/dist/knowledge/reward-puzzle.js +1 -300
  267. package/dist/knowledge/reward-risk.js +1 -627
  268. package/dist/knowledge/reward-templates.js +1 -197
  269. package/dist/knowledge/reward-translation.js +1 -501
  270. package/dist/knowledge/safety-rules.d.ts +1 -0
  271. package/dist/knowledge/safety-rules.js +1 -404
  272. package/dist/knowledge/scenario-modes.js +1 -321
  273. package/dist/knowledge/service-confirm.js +1 -807
  274. package/dist/knowledge/service-context.js +1 -403
  275. package/dist/knowledge/service-ledger.js +1 -609
  276. package/dist/knowledge/service-puzzle.js +1 -236
  277. package/dist/knowledge/service-risk.d.ts +1 -1
  278. package/dist/knowledge/service-risk.js +1 -651
  279. package/dist/knowledge/service-templates.js +1 -456
  280. package/dist/knowledge/service-translation.js +1 -622
  281. package/dist/knowledge/template-registry.js +1 -353
  282. package/dist/knowledge/tool-constraints.js +1 -195
  283. package/dist/knowledge/tools-reference.js +1 -178
  284. package/dist/knowledge/treasury-confirm.js +1 -512
  285. package/dist/knowledge/treasury-context.js +1 -363
  286. package/dist/knowledge/treasury-ledger.js +1 -300
  287. package/dist/knowledge/treasury-puzzle.js +1 -216
  288. package/dist/knowledge/treasury-risk.js +1 -440
  289. package/dist/knowledge/treasury-templates.js +1 -358
  290. package/dist/knowledge/treasury-translation.js +1 -498
  291. package/dist/knowledge/trust-metrics.js +1 -198
  292. package/dist/knowledge/universal-template.d.ts +22 -0
  293. package/dist/knowledge/universal-template.js +1 -0
  294. package/dist/knowledge/util-confirm.d.ts +24 -0
  295. package/dist/knowledge/util-confirm.js +1 -0
  296. package/dist/knowledge/util-risk.js +1 -135
  297. package/dist/knowledge/util-translation.d.ts +38 -0
  298. package/dist/knowledge/util-translation.js +1 -0
  299. package/dist/knowledge/workflow-guidance.d.ts +116 -0
  300. package/dist/knowledge/workflow-guidance.js +1 -0
  301. package/dist/loop-engineering/aggregate.js +1 -132
  302. package/dist/loop-engineering/context-collect.js +1 -83
  303. package/dist/loop-engineering/diagnose.js +1 -273
  304. package/dist/loop-engineering/improve.js +1 -405
  305. package/dist/loop-engineering/index.js +1 -4
  306. package/dist/loop-engineering/pipeline.js +1 -56
  307. package/dist/mode-market/index.js +1 -3
  308. package/dist/mode-market/registry.js +1 -124
  309. package/dist/mode-market/review.js +1 -214
  310. package/dist/mode-market/submission.js +1 -85
  311. package/dist/participation/collaborator-interest.d.ts +23 -0
  312. package/dist/participation/collaborator-interest.js +1 -0
  313. package/dist/participation/customer-interest.d.ts +25 -0
  314. package/dist/participation/customer-interest.js +1 -0
  315. package/dist/participation/employee-kpi.d.ts +25 -0
  316. package/dist/participation/employee-kpi.js +1 -0
  317. package/dist/participation/employee-store.d.ts +16 -0
  318. package/dist/participation/employee-store.js +1 -0
  319. package/dist/participation/index.d.ts +2 -0
  320. package/dist/participation/index.js +1 -0
  321. package/dist/participation/merchant-interest.js +1 -100
  322. package/dist/participation/radar-core.d.ts +13 -3
  323. package/dist/participation/radar-core.js +1 -269
  324. package/dist/participation/supplier-interest.d.ts +25 -0
  325. package/dist/participation/supplier-interest.js +1 -0
  326. package/dist/persona/analyzer.js +1 -66
  327. package/dist/persona/bridge.js +1 -86
  328. package/dist/persona/defaults.js +1 -195
  329. package/dist/persona/experience-bridge.js +1 -23
  330. package/dist/persona/index.d.ts +9 -2
  331. package/dist/persona/index.js +1 -71
  332. package/dist/persona/local-region.d.ts +20 -0
  333. package/dist/persona/local-region.js +1 -0
  334. package/dist/persona/model.js +1 -111
  335. package/dist/persona/overrides.d.ts +10 -0
  336. package/dist/persona/overrides.js +1 -0
  337. package/dist/persona/pack-personae.d.ts +11 -0
  338. package/dist/persona/pack-personae.js +1 -0
  339. package/dist/persona/store.js +1 -62
  340. package/dist/persona/strategy-intent.d.ts +20 -0
  341. package/dist/persona/strategy-intent.js +1 -0
  342. package/dist/persona/types.d.ts +6 -2
  343. package/dist/persona/types.js +1 -5
  344. package/dist/project/business-puzzle.d.ts +1 -1
  345. package/dist/project/business-puzzle.js +1 -383
  346. package/dist/project/context-assembly.js +1 -254
  347. package/dist/project/deployment-bridge.js +1 -120
  348. package/dist/project/deployment-doc.js +1 -1126
  349. package/dist/project/edit-planner.js +1 -1342
  350. package/dist/project/evaluation.d.ts +37 -1
  351. package/dist/project/evaluation.js +1 -2011
  352. package/dist/project/game-theory.js +1 -177
  353. package/dist/project/graph-builder.js +1 -656
  354. package/dist/project/graph.d.ts +3 -6
  355. package/dist/project/graph.js +1 -340
  356. package/dist/project/handlers.d.ts +33 -2
  357. package/dist/project/handlers.js +1 -1784
  358. package/dist/project/index.d.ts +2 -0
  359. package/dist/project/index.js +1 -301
  360. package/dist/project/intent-analyzer.js +1 -149
  361. package/dist/project/machine-nodes.js +1 -36
  362. package/dist/project/merchant-guide.d.ts +19 -0
  363. package/dist/project/merchant-guide.js +1 -264
  364. package/dist/project/migration.js +1 -125
  365. package/dist/project/mode-actions.js +1 -309
  366. package/dist/project/namespace.js +1 -206
  367. package/dist/project/participation-radar.js +1 -428
  368. package/dist/project/pipeline-actions.js +1 -109
  369. package/dist/project/project-store.js +1 -422
  370. package/dist/project/query.js +1 -153
  371. package/dist/project/reverse-mapping.d.ts +34 -0
  372. package/dist/project/reverse-mapping.js +1 -0
  373. package/dist/project/risk-aggregator.js +1 -295
  374. package/dist/project/rollback-policy.js +1 -290
  375. package/dist/project/semantic-assembler.js +1 -345
  376. package/dist/project/semantic-graph.d.ts +3 -5
  377. package/dist/project/semantic-graph.js +1 -292
  378. package/dist/project/stage-gate.js +1 -369
  379. package/dist/project/substep-trace.js +1 -332
  380. package/dist/project/task-tracker.js +1 -78
  381. package/dist/project/workflow-design-assessment.d.ts +24 -0
  382. package/dist/project/workflow-design-assessment.js +1 -0
  383. package/dist/role/derivation.d.ts +18 -0
  384. package/dist/role/derivation.js +1 -0
  385. package/dist/role/index.d.ts +5 -0
  386. package/dist/role/index.js +1 -0
  387. package/dist/role/model.d.ts +8 -0
  388. package/dist/role/model.js +1 -0
  389. package/dist/role/resolution.d.ts +11 -0
  390. package/dist/role/resolution.js +1 -0
  391. package/dist/role/types.d.ts +11 -0
  392. package/dist/role/types.js +1 -0
  393. package/dist/rules.js +1 -52
  394. package/dist/safety/confirm-gate.d.ts +1 -1
  395. package/dist/safety/confirm-gate.js +1 -88
  396. package/dist/safety/index.js +1 -3
  397. package/dist/safety/preview.js +1 -52
  398. package/dist/schema/call/allocation.d.ts +186 -1385
  399. package/dist/schema/call/allocation.js +1 -34
  400. package/dist/schema/call/arbitration.d.ts +272 -1871
  401. package/dist/schema/call/arbitration.js +1 -113
  402. package/dist/schema/call/base.d.ts +1831 -9076
  403. package/dist/schema/call/base.js +1 -370
  404. package/dist/schema/call/bridge.d.ts +911 -3171
  405. package/dist/schema/call/bridge.js +1 -458
  406. package/dist/schema/call/contact.d.ts +135 -931
  407. package/dist/schema/call/contact.js +1 -37
  408. package/dist/schema/call/demand.d.ts +164 -1194
  409. package/dist/schema/call/demand.js +1 -47
  410. package/dist/schema/call/guard.d.ts +298 -1140
  411. package/dist/schema/call/guard.js +1 -161
  412. package/dist/schema/call/handler.js +1 -322
  413. package/dist/schema/call/index.js +1 -20
  414. package/dist/schema/call/machine.d.ts +459 -5403
  415. package/dist/schema/call/machine.js +1 -193
  416. package/dist/schema/call/order.d.ts +137 -844
  417. package/dist/schema/call/order.js +1 -35
  418. package/dist/schema/call/payment.d.ts +74 -561
  419. package/dist/schema/call/payment.js +1 -37
  420. package/dist/schema/call/permission-handler.js +1 -54
  421. package/dist/schema/call/permission.d.ts +335 -2791
  422. package/dist/schema/call/permission.js +1 -105
  423. package/dist/schema/call/personal.d.ts +227 -1814
  424. package/dist/schema/call/personal.js +1 -78
  425. package/dist/schema/call/progress.d.ts +140 -843
  426. package/dist/schema/call/progress.js +1 -47
  427. package/dist/schema/call/proof.d.ts +42 -258
  428. package/dist/schema/call/proof.js +1 -33
  429. package/dist/schema/call/repository.d.ts +324 -2222
  430. package/dist/schema/call/repository.js +1 -77
  431. package/dist/schema/call/reward.d.ts +153 -1183
  432. package/dist/schema/call/reward.js +1 -30
  433. package/dist/schema/call/semantic.js +1 -1679
  434. package/dist/schema/call/service.d.ts +376 -3431
  435. package/dist/schema/call/service.js +1 -184
  436. package/dist/schema/call/treasury.d.ts +252 -2158
  437. package/dist/schema/call/treasury.js +1 -71
  438. package/dist/schema/common/index.d.ts +222 -697
  439. package/dist/schema/common/index.js +1 -407
  440. package/dist/schema/config/index.d.ts +18 -161
  441. package/dist/schema/config/index.js +1 -68
  442. package/dist/schema/employee/index.d.ts +99 -0
  443. package/dist/schema/employee/index.js +1 -0
  444. package/dist/schema/evaluation/index.d.ts +1062 -3748
  445. package/dist/schema/evaluation/index.js +1 -356
  446. package/dist/schema/index.d.ts +3 -0
  447. package/dist/schema/index.js +1 -17
  448. package/dist/schema/industry-pack/index.d.ts +132 -0
  449. package/dist/schema/industry-pack/index.js +1 -0
  450. package/dist/schema/intent-radar/index.d.ts +92 -245
  451. package/dist/schema/intent-radar/index.js +1 -89
  452. package/dist/schema/local/index.d.ts +2045 -18080
  453. package/dist/schema/local/index.js +1 -927
  454. package/dist/schema/local/wip.d.ts +61 -651
  455. package/dist/schema/local/wip.js +1 -187
  456. package/dist/schema/messenger/index.d.ts +949 -5557
  457. package/dist/schema/messenger/index.js +1 -475
  458. package/dist/schema/operations.d.ts +2969 -26518
  459. package/dist/schema/operations.js +1 -520
  460. package/dist/schema/persona/index.d.ts +469 -1820
  461. package/dist/schema/persona/index.js +1 -148
  462. package/dist/schema/project/index.d.ts +1027 -8408
  463. package/dist/schema/project/index.js +1 -2057
  464. package/dist/schema/query/index.d.ts +12041 -75261
  465. package/dist/schema/query/index.js +1 -1646
  466. package/dist/schema/schema-query/index.d.ts +35 -98
  467. package/dist/schema/schema-query/index.js +1 -104
  468. package/dist/schema/schema-version.js +1 -76
  469. package/dist/schema/task-status.d.ts +26 -132
  470. package/dist/schema/task-status.js +1 -36
  471. package/dist/schema/trust/index.d.ts +194 -1290
  472. package/dist/schema/trust/index.js +1 -314
  473. package/dist/schema/utils/guard-parser.js +1 -419
  474. package/dist/schema/utils/guard-query-utils.js +1 -46
  475. package/dist/schema/utils/node-parser.js +1 -369
  476. package/dist/schema/utils/object-type-utils.js +1 -35
  477. package/dist/schema/utils/permission-index-utils.js +1 -7
  478. package/dist/schema/utils/permission-machine-check.js +1 -121
  479. package/dist/schema/utils/skills-recommendation.d.ts +1 -0
  480. package/dist/schema/utils/skills-recommendation.js +1 -77
  481. package/dist/schema/workspace/index.d.ts +69 -0
  482. package/dist/schema/workspace/index.js +1 -0
  483. package/dist/schema-query-impl/index.js +1 -0
  484. package/dist/schemas/account_operation.output.json +3147 -1652
  485. package/dist/schemas/account_operation.schema.json +225 -218
  486. package/dist/schemas/bridge_operation.output.json +1168 -650
  487. package/dist/schemas/bridge_operation.schema.json +736 -504
  488. package/dist/schemas/config_operation.output.json +185 -179
  489. package/dist/schemas/config_operation.schema.json +21 -26
  490. package/dist/schemas/employee_operation.output.json +207 -0
  491. package/dist/schemas/employee_operation.schema.json +176 -0
  492. package/dist/schemas/evaluation_operation.output.json +2329 -557
  493. package/dist/schemas/evaluation_operation.schema.json +2939 -720
  494. package/dist/schemas/guard2file.output.json +58 -64
  495. package/dist/schemas/guard2file.schema.json +79 -81
  496. package/dist/schemas/index.json +29 -11
  497. package/dist/schemas/industry_pack_operation.output.json +594 -0
  498. package/dist/schemas/industry_pack_operation.schema.json +55 -0
  499. package/dist/schemas/intent_radar.output.json +275 -200
  500. package/dist/schemas/intent_radar.schema.json +124 -123
  501. package/dist/schemas/local_info_operation.output.json +1174 -657
  502. package/dist/schemas/local_info_operation.schema.json +119 -125
  503. package/dist/schemas/local_mark_operation.output.json +1239 -689
  504. package/dist/schemas/local_mark_operation.schema.json +91 -96
  505. package/dist/schemas/machineNode2file.output.json +63 -69
  506. package/dist/schemas/machineNode2file.schema.json +79 -81
  507. package/dist/schemas/messenger_operation.output.json +2722 -1528
  508. package/dist/schemas/messenger_operation.schema.json +1482 -1264
  509. package/dist/schemas/onchain_events.output.json +2590 -975
  510. package/dist/schemas/onchain_events.schema.json +117 -99
  511. package/dist/schemas/onchain_operations.output.json +3957 -2309
  512. package/dist/schemas/onchain_operations.schema.json +20799 -9285
  513. package/dist/schemas/onchain_operations_allocation.schema.json +172 -108
  514. package/dist/schemas/onchain_operations_arbitration.schema.json +233 -146
  515. package/dist/schemas/onchain_operations_contact.schema.json +129 -90
  516. package/dist/schemas/onchain_operations_demand.schema.json +170 -112
  517. package/dist/schemas/onchain_operations_gen_passport.schema.json +61 -646
  518. package/dist/schemas/onchain_operations_gen_proof.schema.json +40 -172
  519. package/dist/schemas/onchain_operations_guard.schema.json +3765 -294
  520. package/dist/schemas/onchain_operations_machine.schema.json +537 -164
  521. package/dist/schemas/onchain_operations_order.schema.json +126 -96
  522. package/dist/schemas/onchain_operations_payment.schema.json +82 -67
  523. package/dist/schemas/onchain_operations_permission.schema.json +331 -93
  524. package/dist/schemas/onchain_operations_personal.schema.json +636 -96
  525. package/dist/schemas/onchain_operations_progress.schema.json +125 -92
  526. package/dist/schemas/onchain_operations_proof.schema.json +76 -69
  527. package/dist/schemas/onchain_operations_repository.schema.json +636 -249
  528. package/dist/schemas/onchain_operations_reward.schema.json +218 -108
  529. package/dist/schemas/onchain_operations_service.schema.json +679 -221
  530. package/dist/schemas/onchain_operations_treasury.schema.json +401 -135
  531. package/dist/schemas/onchain_table_data.output.json +6018 -2430
  532. package/dist/schemas/onchain_table_data.schema.json +544 -430
  533. package/dist/schemas/persona_operation.output.json +1568 -265
  534. package/dist/schemas/persona_operation.schema.json +346 -202
  535. package/dist/schemas/project_operation.output.json +6957 -5147
  536. package/dist/schemas/project_operation.schema.json +1050 -1020
  537. package/dist/schemas/query_task_status.output.json +195 -99
  538. package/dist/schemas/query_task_status.schema.json +12 -18
  539. package/dist/schemas/query_toolkit.output.json +18870 -14566
  540. package/dist/schemas/query_toolkit.schema.json +614 -522
  541. package/dist/schemas/schema_query.output.json +127 -129
  542. package/dist/schemas/schema_query.schema.json +64 -69
  543. package/dist/schemas/trust_score.output.json +678 -587
  544. package/dist/schemas/trust_score.schema.json +289 -277
  545. package/dist/schemas/wip_file.output.json +116 -124
  546. package/dist/schemas/wip_file.schema.json +142 -143
  547. package/dist/schemas/workspace_operation.output.json +277 -0
  548. package/dist/schemas/workspace_operation.schema.json +45 -0
  549. package/dist/schemas/wowok_buildin_info.output.json +1693 -723
  550. package/dist/schemas/wowok_buildin_info.schema.json +576 -512
  551. package/dist/telemetry/index.js +1 -112
  552. package/dist/telemetry/redact.js +1 -23
  553. package/dist/telemetry/storage.js +1 -80
  554. package/dist/tools/handlers/bridge.d.ts +8 -1
  555. package/dist/tools/handlers/bridge.js +1 -1
  556. package/dist/tools/handlers/config.js +1 -74
  557. package/dist/tools/handlers/employee.d.ts +2 -0
  558. package/dist/tools/handlers/employee.js +1 -0
  559. package/dist/tools/handlers/evaluation.js +1 -123
  560. package/dist/tools/handlers/file-export.js +1 -90
  561. package/dist/tools/handlers/industry-pack.d.ts +2 -0
  562. package/dist/tools/handlers/industry-pack.js +1 -0
  563. package/dist/tools/handlers/intent-radar.js +1 -76
  564. package/dist/tools/handlers/local.js +1 -53
  565. package/dist/tools/handlers/messenger.js +1 -188
  566. package/dist/tools/handlers/onchain.js +1 -1180
  567. package/dist/tools/handlers/persona.js +1 -89
  568. package/dist/tools/handlers/project.js +1 -211
  569. package/dist/tools/handlers/query.js +1 -434
  570. package/dist/tools/handlers/schema-query.js +1 -176
  571. package/dist/tools/handlers/task-status.js +1 -26
  572. package/dist/tools/handlers/trust.js +1 -380
  573. package/dist/tools/handlers/wip.js +1 -90
  574. package/dist/tools/handlers/workspace.d.ts +2 -0
  575. package/dist/tools/handlers/workspace.js +1 -0
  576. package/dist/tools/index.d.ts +2 -1
  577. package/dist/tools/index.js +1 -1382
  578. package/dist/tools/retry.js +1 -85
  579. package/dist/tools/rules-hook.d.ts +1 -1
  580. package/dist/tools/rules-hook.js +1 -23
  581. package/dist/tools/shared.d.ts +1 -1
  582. package/dist/tools/shared.js +1 -130
  583. package/dist/tools/types.d.ts +2 -1
  584. package/dist/tools/types.js +1 -1
  585. package/dist/tools/upgrade-check.d.ts +19 -0
  586. package/dist/tools/upgrade-check.js +1 -0
  587. package/dist/tools/wip-deploy-assist.js +1 -306
  588. package/dist/tools/wrap.js +1 -500
  589. package/package.json +7 -6
  590. package/dist/knowledge/arbitration-trust.d.ts +0 -24
  591. package/dist/knowledge/arbitration-trust.js +0 -117
  592. package/dist/schema/call/bridge-handler.d.ts +0 -8
  593. package/dist/schema/call/bridge-handler.js +0 -265
  594. package/dist/schema/sync-layer4.d.ts +0 -21
  595. package/dist/schema/sync-layer4.js +0 -286
  596. package/dist/schema-query/index.js +0 -810
  597. /package/dist/{schema-query → schema-query-impl}/index.d.ts +0 -0
@@ -1,550 +1 @@
1
- import { MAX_AGENT_COUNT, MAX_DISPUTE_COUNT, } from "@wowok/wowok";
2
- import { ORDER_SCENES, inferSceneFromIntent, } from "./order-ledger.js";
3
- export const SEMANTIC_TO_SCHEMA_RULES = [
4
- {
5
- id: "P-O-01",
6
- pattern_name: "Create Order via service::buy (compound creation)",
7
- semantic_intent: "Buy items from a Service — atomically creates Order + Allocation + Progress, snapshots service.machine, emits NewOrderEvent",
8
- match_keywords: ["buy", "purchase", "order"],
9
- schema_fields: ["(via service::buy, not direct order::create)"],
10
- example_json: {
11
- _note: "Order is NOT created via CallOrder_Data. It is created via service::buy() which internally calls order::new + order::create.",
12
- _call_target: "service",
13
- object: "0xSERVICE_ADDRESS",
14
- buy: {
15
- items: [{ name: "Product A", price: "1000000000", quantity: 1, wip_hash: "0xABC..." }],
16
- discount: null,
17
- named_order: "my_order_alias",
18
- machine_forward: null,
19
- },
20
- },
21
- reverse_explanation: "Order creation is composite — service::buy atomically builds Order + Allocation + Progress + emits NewOrderEvent. order::create is package-only.",
22
- operation_field: "object",
23
- permission_layer: "L3_package_only",
24
- },
25
- {
26
- id: "P-O-02",
27
- pattern_name: "Advance Progress (forward/hold)",
28
- semantic_intent: "Advance Order's Progress to next node via forward or hold",
29
- match_keywords: ["advance", "forward", "progress", "next"],
30
- schema_fields: ["object", "progress"],
31
- example_json: {
32
- object: "0xORDER_ADDRESS",
33
- progress: {
34
- next_node_name: "shipped",
35
- forward: { name: "deliver", operator: null, guard: null },
36
- op: "next",
37
- message: "Order dispatched",
38
- },
39
- },
40
- reverse_explanation: "progress.forward triggers Progress::operate → order.progress node transition. Both owner and agent can advance (L2).",
41
- operation_field: "progress",
42
- permission_layer: "L2_owner_or_agent",
43
- },
44
- {
45
- id: "P-O-03",
46
- pattern_name: "Set agent list (owner-only, pre-progress)",
47
- semantic_intent: "Replace the entire agent list. Frozen after Progress binding.",
48
- match_keywords: ["set agent", "agent", "delegate"],
49
- schema_fields: ["object", "agent"],
50
- example_json: {
51
- object: "0xORDER_ADDRESS",
52
- agent: ["0xAGENT1", "0xAGENT2"],
53
- },
54
- reverse_explanation: "agent field overwrites entire agent list. Owner-only (L1). Aborts E_PROGRESS_NOT_SPECIFIED if Progress already bound. ⚠️ Boundary bug: actual max 11 (not 10).",
55
- operation_field: "agent",
56
- permission_layer: "L1_owner_only",
57
- },
58
- {
59
- id: "P-O-04",
60
- pattern_name: "Set required_info (Contact or WTS Proof)",
61
- semantic_intent: "Update recipient contact or delivery proof. Both owner and agent can update.",
62
- match_keywords: ["required_info", "recipient", "contact", "wts proof"],
63
- schema_fields: ["object", "required_info"],
64
- example_json: {
65
- object: "0xORDER_ADDRESS",
66
- required_info: "0xCONTACT_ADDRESS",
67
- },
68
- reverse_explanation: "required_info accepts Contact object (recipient) or WTS Proof object (delivery proof). null clears. L2 (owner or agent).",
69
- operation_field: "required_info",
70
- permission_layer: "L2_owner_or_agent",
71
- },
72
- {
73
- id: "P-O-05",
74
- pattern_name: "Apply for arbitration (arb_confirm)",
75
- semantic_intent: "File arbitration with confirm/deny + description + proposition. Triggers dispute() appending Arb to order.dispute.",
76
- match_keywords: ["arb_confirm", "apply arbitration", "file dispute", "compensation"],
77
- schema_fields: ["object", "arb_confirm"],
78
- example_json: {
79
- object: "0xORDER_ADDRESS",
80
- arb_confirm: {
81
- arb: "0xARB_ADDRESS",
82
- confirm: true,
83
- description: "Item never arrived",
84
- proposition: ["Refund full amount", "Compensation for delay"],
85
- },
86
- },
87
- reverse_explanation: "arb_confirm triggers arb::principal_confirm + arb::description_change + arb::proposition_change, and Arb module calls order::dispute(arb) to append. L2.",
88
- operation_field: "arb_confirm",
89
- permission_layer: "L2_owner_or_agent",
90
- },
91
- {
92
- id: "P-O-06",
93
- pattern_name: "Object to arbitration (arb_objection)",
94
- semantic_intent: "Object to Arb ruling and request re-arbitration",
95
- match_keywords: ["arb_objection", "object", "appeal"],
96
- schema_fields: ["object", "arb_objection"],
97
- example_json: {
98
- object: "0xORDER_ADDRESS",
99
- arb_objection: {
100
- arb: "0xARB_ADDRESS",
101
- objection: "Evidence was not properly reviewed",
102
- },
103
- },
104
- reverse_explanation: "arb_objection triggers arb::objection. Requires Arb status = Arbitrated. L2 (owner or agent). Irreversible.",
105
- operation_field: "arb_objection",
106
- permission_layer: "L2_owner_or_agent",
107
- },
108
- {
109
- id: "P-O-07",
110
- pattern_name: "Claim compensation (arb_claim_compensation)",
111
- semantic_intent: "Claim compensation from a ruled Arb. Sets claimed_by — ONE-TIME, IRREVERSIBLE, blocks future disputes.",
112
- match_keywords: ["arb_claim_compensation", "claim", "compensation"],
113
- schema_fields: ["object", "arb_claim_compensation"],
114
- example_json: {
115
- object: "0xORDER_ADDRESS",
116
- arb_claim_compensation: {
117
- arb: "0xRULED_ARB_ADDRESS",
118
- },
119
- },
120
- reverse_explanation: "arb_claim_compensation triggers service::compensation_claim → order::compensate(arb) → sets claimed_by=arb. IRREVERSIBLE. L2.",
121
- operation_field: "arb_claim_compensation",
122
- permission_layer: "L2_owner_or_agent",
123
- },
124
- {
125
- id: "P-O-08",
126
- pattern_name: "Receive payment/objects (owner-only)",
127
- semantic_intent: "Receive CoinWrapper or arbitrary Receiving<K> from Progress. Funds forwarded to owner.",
128
- match_keywords: ["receive", "collect", "extract"],
129
- schema_fields: ["object", "receive"],
130
- example_json: {
131
- object: "0xORDER_ADDRESS",
132
- receive: {
133
- received: "0xRECEIVING_OBJECT_ID",
134
- },
135
- },
136
- reverse_explanation: "receive calls order::owner_receive or owner_receive_object. Owner-only (L1) — agent CANNOT receive. Aborts E_ORDER_DELIVERING if Progress not at terminal.",
137
- operation_field: "receive",
138
- permission_layer: "L1_owner_only",
139
- },
140
- {
141
- id: "P-O-09",
142
- pattern_name: "Transfer ownership (transfer_to)",
143
- semantic_intent: "Transfer Order ownership to new address. IRREVERSIBLE. New owner takes over ALL permissions.",
144
- match_keywords: ["transfer", "transfer_to", "handover"],
145
- schema_fields: ["object", "transfer_to"],
146
- example_json: {
147
- object: "0xORDER_ADDRESS",
148
- transfer_to: "0xNEW_OWNER_ADDRESS",
149
- },
150
- reverse_explanation: "transfer_to calls order::owner_change(new_owner). Owner-only (L1). IRREVERSIBLE. Unlike agent_set, can be called after Progress binding.",
151
- operation_field: "transfer_to",
152
- permission_layer: "L1_owner_only",
153
- },
154
- {
155
- id: "P-O-10",
156
- pattern_name: "Query Order state (read-only)",
157
- semantic_intent: "Read Order fields: items, amount, owner/builder, agent, dispute, claimed_by, progress, machine, time",
158
- match_keywords: ["query", "read", "check", "status"],
159
- schema_fields: ["(read-only via query layer, not CallOrder_Data)"],
160
- example_json: {
161
- _note: "Query uses the query/object endpoint, not CallOrder_Data",
162
- _call_target: "query",
163
- object: "0xORDER_ADDRESS",
164
- fields: ["items", "amount", "owner", "agent", "dispute", "claimed_by", "progress", "machine"],
165
- },
166
- reverse_explanation: "Query is read-only — does not modify state. Use to verify state before any L1/L2 operation. SDK ObjectOrder returns all 14 fields.",
167
- operation_field: "object",
168
- },
169
- {
170
- id: "P-O-11",
171
- pattern_name: "Query Order history (event log)",
172
- semantic_intent: "Query Order lifecycle events. ⚠️ Only NewOrderEvent is actually emitted — other events must be INFERRED from field changes.",
173
- match_keywords: ["history", "events", "lifecycle", "audit"],
174
- schema_fields: ["(read-only via query layer, event filter)"],
175
- example_json: {
176
- _note: "Only NewOrderEvent is emitted on-chain. Other lifecycle events must be inferred by querying Order field diffs over time.",
177
- _call_target: "query",
178
- object: "0xORDER_ADDRESS",
179
- event_filter: { type: "order::NewOrderEvent" },
180
- },
181
- reverse_explanation: "Audit weakness: only 1 of 11 lifecycle events is actually emitted. Use status_inference formula from ORDER_AUDIT_FORMULAS to derive state.",
182
- operation_field: "object",
183
- },
184
- {
185
- id: "P-O-12",
186
- pattern_name: "Monitor Order status changes (polling)",
187
- semantic_intent: "Poll Order status to detect: Progress advance, dispute append, claimed_by set, ownership transfer",
188
- match_keywords: ["monitor", "poll", "watch", "track"],
189
- schema_fields: ["(read-only via query layer, polling)"],
190
- example_json: {
191
- _note: "Monitor by querying Order at intervals and diffing fields",
192
- _call_target: "query",
193
- object: "0xORDER_ADDRESS",
194
- poll_interval_ms: 5000,
195
- watch_fields: ["progress", "dispute", "claimed_by", "owner"],
196
- },
197
- reverse_explanation: "No push notifications — must poll. Track 4 critical fields: progress (advance), dispute (new arb), claimed_by (terminal), owner (transfer).",
198
- operation_field: "object",
199
- },
200
- ];
201
- export const SCHEMA_TO_SEMANTIC_RULES = [
202
- {
203
- element_type: "field",
204
- type_name: "object",
205
- semantic_explanation: "Order object address. STRING=operate existing Order. null/omitted is invalid (Order creation goes through service::buy).",
206
- constraints: ["Must be valid Order object ID", "Order must exist on-chain"],
207
- },
208
- {
209
- element_type: "field",
210
- type_name: "agent",
211
- semantic_explanation: "Agent address list (overwrites entire list). Owner-only (L1). Frozen after Progress binding. ⚠️ Boundary bug: actual max 11 (not 10).",
212
- constraints: [`<= ${MAX_AGENT_COUNT} agents (doc) / 11 (actual bug)`, "Owner-only", "Frozen after Progress binding"],
213
- },
214
- {
215
- element_type: "field",
216
- type_name: "required_info",
217
- semantic_explanation: "Contact object (recipient info) or WTS Proof object (delivery proof). null clears. L2 (owner or agent).",
218
- constraints: ["Must be Contact or WTS Proof object", "null clears the field"],
219
- },
220
- {
221
- element_type: "field",
222
- type_name: "progress",
223
- semantic_explanation: "Progress operation object — advance via forward/hold. Both owner and agent can advance. Node transition is irreversible.",
224
- constraints: ["Requires Progress binding (order.progress.is_some())", "L2 (owner or agent)", "Node transition irreversible"],
225
- },
226
- {
227
- element_type: "field",
228
- type_name: "arb_confirm",
229
- semantic_explanation: "Apply for arbitration compensation. Triggers dispute() appending Arb to order.dispute. L2. Irreversible.",
230
- constraints: ["Arb must exist", "L2 (owner or agent)", "claimed_by must be None"],
231
- },
232
- {
233
- element_type: "field",
234
- type_name: "arb_objection",
235
- semantic_explanation: "Object to Arb ruling and request re-arbitration. Requires Arb status = Arbitrated. L2. Irreversible.",
236
- constraints: ["Arb must be in Arbitrated state", "L2 (owner or agent)"],
237
- },
238
- {
239
- element_type: "field",
240
- type_name: "arb_claim_compensation",
241
- semantic_explanation: "Claim compensation from ruled Arb. Sets claimed_by. ONE-TIME, IRREVERSIBLE, blocks future disputes. L2.",
242
- constraints: ["Arb must be Arbitrated", "claimed_by must be None", "L2 (owner or agent)", "IRREVERSIBLE"],
243
- },
244
- {
245
- element_type: "field",
246
- type_name: "receive",
247
- semantic_explanation: "Receive CoinWrapper or arbitrary Receiving<K> from Progress. Funds forwarded to owner. Owner-only (L1) — agent CANNOT.",
248
- constraints: ["Owner-only (L1)", "Progress must be at terminal node (not delivering)", "Can be called multiple times"],
249
- },
250
- {
251
- element_type: "field",
252
- type_name: "transfer_to",
253
- semantic_explanation: "New owner address for ownership transfer. IRREVERSIBLE. New owner takes over ALL permissions. Owner-only (L1).",
254
- constraints: ["Owner-only (L1)", "IRREVERSIBLE", "Valid Wow address"],
255
- },
256
- {
257
- element_type: "op",
258
- type_name: "forward",
259
- semantic_explanation: "Advance Progress to next node via named forward. Triggers Progress::operate.",
260
- constraints: ["Forward name must exist on current node", "Guard (if any) must pass"],
261
- },
262
- {
263
- element_type: "op",
264
- type_name: "hold",
265
- semantic_explanation: "Hold at current Progress node (optional pause).",
266
- constraints: ["Node must support hold"],
267
- },
268
- {
269
- element_type: "op",
270
- type_name: "confirm",
271
- semantic_explanation: "In arb_confirm: true=confirm materials valid, false=deny materials.",
272
- constraints: ["Boolean — no other values"],
273
- },
274
- {
275
- element_type: "index",
276
- type_name: "dispute_index",
277
- semantic_explanation: "Position in order.dispute vector. 0-based. Max 10 disputes total.",
278
- constraints: [`<= ${MAX_DISPUTE_COUNT} disputes`, "Frozen when claimed_by.is_some()"],
279
- },
280
- {
281
- element_type: "error",
282
- type_name: "E_OWNER (code 1)",
283
- semantic_explanation: "Sender != order.owner. L1 operation attempted by non-owner (agent or third party).",
284
- constraints: ["Aborts assert_owner"],
285
- },
286
- {
287
- element_type: "error",
288
- type_name: "E_PERMISSION (code 5)",
289
- semantic_explanation: "Sender is neither owner nor in agent[]. L2 operation attempted by unauthorized caller.",
290
- constraints: ["Aborts assert_op_permission (via has_op_permission returning false)"],
291
- },
292
- {
293
- element_type: "error",
294
- type_name: "E_PROGRESS_NOT_SPECIFIED (code 3)",
295
- semantic_explanation: "⚠️ DUAL SEMANTICS: (a) order::create — machine is Some but progress is None; (b) agent_set/owner_change — progress is already bound (frozen).",
296
- constraints: ["Check context to disambiguate", "Same code, opposite meanings"],
297
- },
298
- {
299
- element_type: "error",
300
- type_name: "E_ORDER_ALREADY_CLAIMED (code 7)",
301
- semantic_explanation: "claimed_by is already Some. Cannot file new disputes, claim again, or call compensate.",
302
- constraints: ["IRREVERSIBLE — no way to reset claimed_by"],
303
- },
304
- {
305
- element_type: "error",
306
- type_name: "E_MAX_AGENT_COUNT (code 2)",
307
- semantic_explanation: "agent list exceeds MAX_AGENT_COUNT (10). ⚠️ Actual boundary uses <= so allows 11 (bug).",
308
- constraints: [`Doc limit: ${MAX_AGENT_COUNT}`, "Actual limit: 11 (boundary bug)"],
309
- },
310
- {
311
- element_type: "error",
312
- type_name: "E_MAX_DISPUTE_COUNT (code 6)",
313
- semantic_explanation: "dispute vector at MAX_DISPUTE_COUNT (10). Next dispute() call aborts.",
314
- constraints: [`Max: ${MAX_DISPUTE_COUNT}`],
315
- },
316
- {
317
- element_type: "error",
318
- type_name: "E_ALLOCATION_NOT_SPECIFIED (code 8)",
319
- semantic_explanation: "order::create with amount > 0 but allocation is None.",
320
- constraints: ["If amount > 0, allocation must be set"],
321
- },
322
- {
323
- element_type: "error",
324
- type_name: "E_ALLOCATION_ALREADY_SPECIFIED (code 9)",
325
- semantic_explanation: "on_allocation called twice. Allocation is one-time set.",
326
- constraints: ["One-time only"],
327
- },
328
- {
329
- element_type: "error",
330
- type_name: "E_PROGRESS_ALREADY_SPECIFIED (code 10)",
331
- semantic_explanation: "on_progress called twice. Progress is one-time set.",
332
- constraints: ["One-time only"],
333
- },
334
- ];
335
- export const ORDER_CONSTRAINT_RULES = [
336
- {
337
- id: "MC-O-01",
338
- category: "structural",
339
- rule: "Order has 14 fields; SDK uses 'builder' for Move's 'owner' (only naming deviation in 22 objects)",
340
- applies_to: ["object.owner", "object.builder"],
341
- },
342
- {
343
- id: "MC-O-02",
344
- category: "structural",
345
- rule: `agent count <= MAX_AGENT_COUNT (${MAX_AGENT_COUNT}) per docs; ⚠️ actual allows 11 due to <= bug`,
346
- applies_to: ["agent"],
347
- },
348
- {
349
- id: "MC-O-03",
350
- category: "structural",
351
- rule: `dispute count <= MAX_DISPUTE_COUNT (${MAX_DISPUTE_COUNT}); frozen when claimed_by.is_some()`,
352
- applies_to: ["dispute"],
353
- },
354
- {
355
- id: "MC-O-04",
356
- category: "structural",
357
- rule: "Order creation is COMPOSITE via service::buy — order::create is package-only",
358
- applies_to: ["(creation flow)"],
359
- },
360
- {
361
- id: "MC-O-05",
362
- category: "semantic",
363
- rule: "order.machine is a SNAPSHOT copied from service.machine at buy time (not a reference)",
364
- applies_to: ["machine"],
365
- },
366
- {
367
- id: "MC-O-06",
368
- category: "semantic",
369
- rule: "E_PROGRESS_NOT_SPECIFIED has DUAL semantics: (a) create: machine Some + progress None; (b) agent_set/owner_change: progress already bound",
370
- applies_to: ["error code 3"],
371
- },
372
- {
373
- id: "MC-O-07",
374
- category: "semantic",
375
- rule: "Only NewOrderEvent is actually emitted; 10 other lifecycle events must be inferred from field changes",
376
- applies_to: ["events"],
377
- },
378
- {
379
- id: "MC-O-08",
380
- category: "semantic",
381
- rule: "SaleItem.item ↔ PurchasedItem.name (different field names for same concept)",
382
- applies_to: ["items.item", "purchased_items.name"],
383
- },
384
- {
385
- id: "MC-O-09",
386
- category: "authority",
387
- rule: "L1 owner-only operations: receive, transfer_to, owner_change, agent_set (assert_owner)",
388
- applies_to: ["receive", "transfer_to", "agent"],
389
- },
390
- {
391
- id: "MC-O-10",
392
- category: "authority",
393
- rule: "L2 owner-or-agent operations: required_info, progress, arb_confirm, arb_objection, arb_claim_compensation (has_op_permission)",
394
- applies_to: ["required_info", "progress", "arb_confirm", "arb_objection", "arb_claim_compensation"],
395
- },
396
- {
397
- id: "MC-O-11",
398
- category: "authority",
399
- rule: "L3 package-only operations: on_progress, on_allocation, dispute, compensate (no external access)",
400
- applies_to: ["(package-only functions)"],
401
- },
402
- {
403
- id: "MC-O-12",
404
- category: "authority",
405
- rule: "Agent CANNOT receive payments — only owner can call owner_receive / owner_receive_object",
406
- applies_to: ["receive"],
407
- },
408
- {
409
- id: "MC-O-13",
410
- category: "lifecycle",
411
- rule: "Progress binding FREEZES owner and agent — agent_set/owner_change abort E_PROGRESS_NOT_SPECIFIED after binding",
412
- applies_to: ["agent", "transfer_to (pre-progress)", "owner_change"],
413
- },
414
- {
415
- id: "MC-O-14",
416
- category: "lifecycle",
417
- rule: "claimed_by is ONE-TIME, IRREVERSIBLE — blocks future dispute(), compensate(), and arb_claim_compensation",
418
- applies_to: ["claimed_by", "arb_claim_compensation", "dispute"],
419
- },
420
- {
421
- id: "MC-O-15",
422
- category: "cross_object",
423
- rule: "Order + Allocation + Progress are 1:1:1 bound at creation; cannot rebind or detach",
424
- applies_to: ["progress", "allocation"],
425
- },
426
- ];
427
- export const ORDER_TRANSLATION_VERSION = "1.0.0";
428
- export function matchSemanticPattern(userIntent) {
429
- const lower = userIntent.toLowerCase();
430
- return SEMANTIC_TO_SCHEMA_RULES.filter(rule => rule.match_keywords.some(kw => lower.includes(kw.toLowerCase())));
431
- }
432
- export function explainOrderCallData(data) {
433
- const lines = [];
434
- if (!data.object) {
435
- lines.push("Operation: ⚠️ INVALID — Order object address required (Order creation goes through service::buy, not CallOrder_Data)");
436
- return lines.join("\n");
437
- }
438
- lines.push(`Operation: MODIFY existing Order at ${data.object}`);
439
- if (data.agent) {
440
- lines.push(`- ⚠️ Set agent list (${data.agent.length} agent(s)): [${data.agent.join(", ")}]`);
441
- lines.push(` Owner-only (L1). Frozen after Progress binding. Boundary bug allows max 11 (not 10).`);
442
- }
443
- if (data.required_info !== undefined) {
444
- if (data.required_info === null) {
445
- lines.push(`- Clear required_info (L2 — owner or agent)`);
446
- }
447
- else {
448
- lines.push(`- Set required_info: ${data.required_info} (Contact or WTS Proof; L2 — owner or agent)`);
449
- }
450
- }
451
- if (data.progress) {
452
- const p = data.progress;
453
- lines.push(`- Advance Progress (L2 — owner or agent)`);
454
- if (p.next_node_name)
455
- lines.push(` Next node: ${p.next_node_name}`);
456
- if (p.forward)
457
- lines.push(` Forward: ${p.forward.name}${p.forward.operator ? ` (operator: ${p.forward.operator})` : ""}`);
458
- if (p.op)
459
- lines.push(` Op: ${p.op}`);
460
- if (p.message)
461
- lines.push(` Message: "${p.message}"`);
462
- }
463
- if (data.arb_confirm) {
464
- const a = data.arb_confirm;
465
- lines.push(`- ⚠️ Apply for arbitration (L2 — owner or agent, IRREVERSIBLE)`);
466
- lines.push(` Arb: ${a.arb}`);
467
- lines.push(` Confirm: ${a.confirm ? "valid materials" : "deny materials"}`);
468
- if (a.description)
469
- lines.push(` Description: "${a.description}"`);
470
- if (a.proposition && a.proposition.length > 0) {
471
- lines.push(` Propositions: ${a.proposition.length} claim(s)`);
472
- }
473
- }
474
- if (data.arb_objection) {
475
- const a = data.arb_objection;
476
- lines.push(`- ⚠️ Object to Arb ruling (L2 — owner or agent, IRREVERSIBLE)`);
477
- lines.push(` Arb: ${a.arb}`);
478
- lines.push(` Objection: "${a.objection}"`);
479
- }
480
- if (data.arb_claim_compensation) {
481
- const a = data.arb_claim_compensation;
482
- lines.push(`- ⚠️⚠️ CLAIM COMPENSATION (L2 — owner or agent, ONE-TIME, IRREVERSIBLE)`);
483
- lines.push(` Arb: ${a.arb}`);
484
- lines.push(` After claim: NO new disputes can be filed (E_ORDER_ALREADY_CLAIMED)`);
485
- }
486
- if (data.receive) {
487
- lines.push(`- Receive (L1 — OWNER-ONLY, agent CANNOT)`);
488
- lines.push(` Received object: ${data.receive.received}`);
489
- lines.push(` Funds/objects forwarded to owner address`);
490
- }
491
- if (data.transfer_to) {
492
- lines.push(`- ⚠️⚠️ TRANSFER OWNERSHIP to ${data.transfer_to} (L1 — OWNER-ONLY, IRREVERSIBLE)`);
493
- lines.push(` New owner takes over ALL permissions`);
494
- lines.push(` Can be called even after Progress binding (unlike agent_set)`);
495
- }
496
- return lines.join("\n");
497
- }
498
- export function explainField(fieldName) {
499
- return SCHEMA_TO_SEMANTIC_RULES.find(r => r.element_type === "field" && r.type_name === fieldName);
500
- }
501
- export function explainOp(opName) {
502
- return SCHEMA_TO_SEMANTIC_RULES.find(r => r.element_type === "op" && r.type_name === opName);
503
- }
504
- export function explainOrderError(errorNameOrCode) {
505
- const str = String(errorNameOrCode);
506
- return SCHEMA_TO_SEMANTIC_RULES.find(r => r.element_type === "error" && (r.type_name === str ||
507
- r.type_name.startsWith(str + " ") ||
508
- r.type_name.includes(str)));
509
- }
510
- export function getConstraintsByCategory(category) {
511
- return ORDER_CONSTRAINT_RULES.filter(r => r.category === category);
512
- }
513
- export function explainPermissionLayer(layer) {
514
- const descriptions = {
515
- L1_owner_only: "L1 — Owner-only (assert_owner). Aborts E_OWNER (code 1) if sender != owner. Agent CANNOT perform L1 ops.",
516
- L2_owner_or_agent: "L2 — Owner or agent (has_op_permission). Aborts E_PERMISSION (code 5) if sender is neither owner nor in agent[].",
517
- L3_package_only: "L3 — Package-only (no external access). Called by other wow-framework modules (progress, allocation, arbitration).",
518
- };
519
- return descriptions[layer];
520
- }
521
- export function resolveFieldName(sdkOrMoveName) {
522
- if (sdkOrMoveName === "builder" || sdkOrMoveName === "owner") {
523
- return { sdk_name: "builder", move_name: "owner", is_deviation: true };
524
- }
525
- return { sdk_name: sdkOrMoveName, move_name: sdkOrMoveName, is_deviation: false };
526
- }
527
- export function matchSceneFromOperation(operationField) {
528
- const scenes = ORDER_SCENES.filter(s => s.operation_field === operationField);
529
- return scenes.length > 0 ? scenes[0] : undefined;
530
- }
531
- export function explainOrderIntent(intent) {
532
- const matchedScene = inferSceneFromIntent(intent);
533
- const matchedPatterns = matchSemanticPattern(intent);
534
- const relevantConstraints = matchedScene
535
- ? ORDER_CONSTRAINT_RULES.filter(c => {
536
- if (matchedScene.permission_layer === "L1_owner_only") {
537
- return c.category === "authority" || c.category === "lifecycle";
538
- }
539
- if (matchedScene.permission_layer === "L2_owner_or_agent") {
540
- return c.category === "authority" || c.category === "semantic";
541
- }
542
- return c.category === "structural" || c.category === "cross_object";
543
- })
544
- : ORDER_CONSTRAINT_RULES;
545
- return {
546
- matched_scene: matchedScene,
547
- matched_patterns: matchedPatterns,
548
- relevant_constraints: relevantConstraints,
549
- };
550
- }
1
+ import{MAX_AGENT_COUNT,MAX_DISPUTE_COUNT}from'@wowok/wowok';import{ORDER_SCENES,inferSceneFromIntent}from'./order-ledger.js';export const SEMANTIC_TO_SCHEMA_RULES=[{'id':'P-O-01','pattern_name':'Create\x20Order\x20via\x20service::buy\x20(compound\x20creation)','semantic_intent':'Buy\x20items\x20from\x20a\x20Service\x20—\x20atomically\x20creates\x20Order\x20+\x20Allocation\x20+\x20Progress,\x20snapshots\x20service.machine,\x20emits\x20NewOrderEvent','match_keywords':['buy','purchase','order'],'schema_fields':['(via\x20service::buy,\x20not\x20direct\x20order::create)'],'example_json':{'_note':'Order\x20is\x20NOT\x20created\x20via\x20CallOrder_Data.\x20It\x20is\x20created\x20via\x20service::buy()\x20which\x20internally\x20calls\x20order::new\x20+\x20order::create.','_call_target':'service','object':'0xSERVICE_ADDRESS','buy':{'items':[{'name':'Product\x20A','price':'1000000000','quantity':0x1,'wip_hash':'0xABC...'}],'discount':null,'named_order':'my_order_alias','machine_forward':null}},'reverse_explanation':'Order\x20creation\x20is\x20composite\x20—\x20service::buy\x20atomically\x20builds\x20Order\x20+\x20Allocation\x20+\x20Progress\x20+\x20emits\x20NewOrderEvent.\x20order::create\x20is\x20package-only.','operation_field':'object','permission_layer':'L3_package_only'},{'id':'P-O-02','pattern_name':'Advance\x20Progress\x20(forward/hold)','semantic_intent':'Advance\x20Order\x27s\x20Progress\x20to\x20next\x20node\x20via\x20forward\x20or\x20hold','match_keywords':['advance','forward','progress','next'],'schema_fields':['object','progress'],'example_json':{'object':'0xORDER_ADDRESS','progress':{'next_node_name':'shipped','forward':{'name':'deliver','operator':null,'guard':null},'op':'next','message':'Order\x20dispatched'}},'reverse_explanation':'progress.forward\x20triggers\x20Progress::operate\x20→\x20order.progress\x20node\x20transition.\x20Both\x20owner\x20and\x20agent\x20can\x20advance\x20(L2).','operation_field':'progress','permission_layer':'L2_owner_or_agent'},{'id':'P-O-03','pattern_name':'Set\x20agent\x20list\x20(owner-only,\x20pre-progress)','semantic_intent':'Replace\x20the\x20entire\x20agent\x20list.\x20Frozen\x20after\x20Progress\x20binding.','match_keywords':['set\x20agent','agent','delegate'],'schema_fields':['object','agent'],'example_json':{'object':'0xORDER_ADDRESS','agent':['0xAGENT1','0xAGENT2']},'reverse_explanation':'agent\x20field\x20overwrites\x20entire\x20agent\x20list.\x20Owner-only\x20(L1).\x20Aborts\x20E_PROGRESS_NOT_SPECIFIED\x20if\x20Progress\x20already\x20bound.\x20⚠️\x20Boundary\x20bug:\x20actual\x20max\x2011\x20(not\x2010).','operation_field':'agent','permission_layer':'L1_owner_only'},{'id':'P-O-04','pattern_name':'Set\x20required_info\x20(Contact\x20or\x20WTS\x20Proof)','semantic_intent':'Update\x20recipient\x20contact\x20or\x20delivery\x20proof.\x20Both\x20owner\x20and\x20agent\x20can\x20update.','match_keywords':['required_info','recipient','contact','wts\x20proof'],'schema_fields':['object','required_info'],'example_json':{'object':'0xORDER_ADDRESS','required_info':'0xCONTACT_ADDRESS'},'reverse_explanation':'required_info\x20accepts\x20Contact\x20object\x20(recipient)\x20or\x20WTS\x20Proof\x20object\x20(delivery\x20proof).\x20null\x20clears.\x20L2\x20(owner\x20or\x20agent).','operation_field':'required_info','permission_layer':'L2_owner_or_agent'},{'id':'P-O-05','pattern_name':'Apply\x20for\x20arbitration\x20(arb_confirm)','semantic_intent':'File\x20arbitration\x20with\x20confirm/deny\x20+\x20description\x20+\x20proposition.\x20Triggers\x20dispute()\x20appending\x20Arb\x20to\x20order.dispute.','match_keywords':['arb_confirm','apply\x20arbitration','file\x20dispute','compensation'],'schema_fields':['object','arb_confirm'],'example_json':{'object':'0xORDER_ADDRESS','arb_confirm':{'arb':'0xARB_ADDRESS','confirm':!![],'description':'Item\x20never\x20arrived','proposition':['Refund\x20full\x20amount','Compensation\x20for\x20delay']}},'reverse_explanation':'arb_confirm\x20triggers\x20arb::principal_confirm\x20+\x20arb::description_change\x20+\x20arb::proposition_change,\x20and\x20Arb\x20module\x20calls\x20order::dispute(arb)\x20to\x20append.\x20L2.','operation_field':'arb_confirm','permission_layer':'L2_owner_or_agent'},{'id':'P-O-06','pattern_name':'Object\x20to\x20arbitration\x20(arb_objection)','semantic_intent':'Object\x20to\x20Arb\x20ruling\x20and\x20request\x20re-arbitration','match_keywords':['arb_objection','object','appeal'],'schema_fields':['object','arb_objection'],'example_json':{'object':'0xORDER_ADDRESS','arb_objection':{'arb':'0xARB_ADDRESS','objection':'Evidence\x20was\x20not\x20properly\x20reviewed'}},'reverse_explanation':'arb_objection\x20triggers\x20arb::objection.\x20Requires\x20Arb\x20status\x20=\x20Arbitrated.\x20L2\x20(owner\x20or\x20agent).\x20Irreversible.','operation_field':'arb_objection','permission_layer':'L2_owner_or_agent'},{'id':'P-O-07','pattern_name':'Claim\x20compensation\x20(arb_claim_compensation)','semantic_intent':'Claim\x20compensation\x20from\x20a\x20ruled\x20Arb.\x20Sets\x20claimed_by\x20—\x20ONE-TIME,\x20IRREVERSIBLE,\x20blocks\x20future\x20disputes.','match_keywords':['arb_claim_compensation','claim','compensation'],'schema_fields':['object','arb_claim_compensation'],'example_json':{'object':'0xORDER_ADDRESS','arb_claim_compensation':{'arb':'0xRULED_ARB_ADDRESS'}},'reverse_explanation':'arb_claim_compensation\x20triggers\x20service::compensation_claim\x20→\x20order::compensate(arb)\x20→\x20sets\x20claimed_by=arb.\x20IRREVERSIBLE.\x20L2.','operation_field':'arb_claim_compensation','permission_layer':'L2_owner_or_agent'},{'id':'P-O-08','pattern_name':'Receive\x20payment/objects\x20(owner-only)','semantic_intent':'Receive\x20CoinWrapper\x20or\x20arbitrary\x20Receiving<K>\x20from\x20Progress.\x20Funds\x20forwarded\x20to\x20owner.','match_keywords':['receive','collect','extract'],'schema_fields':['object','receive'],'example_json':{'object':'0xORDER_ADDRESS','receive':{'received':'0xRECEIVING_OBJECT_ID'}},'reverse_explanation':'receive\x20calls\x20order::owner_receive\x20or\x20owner_receive_object.\x20Owner-only\x20(L1)\x20—\x20agent\x20CANNOT\x20receive.\x20Aborts\x20E_ORDER_DELIVERING\x20if\x20Progress\x20not\x20at\x20terminal.','operation_field':'receive','permission_layer':'L1_owner_only'},{'id':'P-O-09','pattern_name':'Transfer\x20ownership\x20(transfer_to)','semantic_intent':'Transfer\x20Order\x20ownership\x20to\x20new\x20address.\x20IRREVERSIBLE.\x20New\x20owner\x20takes\x20over\x20ALL\x20permissions.','match_keywords':['transfer','transfer_to','handover'],'schema_fields':['object','transfer_to'],'example_json':{'object':'0xORDER_ADDRESS','transfer_to':'0xNEW_OWNER_ADDRESS'},'reverse_explanation':'transfer_to\x20calls\x20order::owner_change(new_owner).\x20Owner-only\x20(L1).\x20IRREVERSIBLE.\x20Unlike\x20agent_set,\x20can\x20be\x20called\x20after\x20Progress\x20binding.','operation_field':'transfer_to','permission_layer':'L1_owner_only'},{'id':'P-O-10','pattern_name':'Query\x20Order\x20state\x20(read-only)','semantic_intent':'Read\x20Order\x20fields:\x20items,\x20amount,\x20owner/builder,\x20agent,\x20dispute,\x20claimed_by,\x20progress,\x20machine,\x20time','match_keywords':['query','read','check','status'],'schema_fields':['(read-only\x20via\x20query\x20layer,\x20not\x20CallOrder_Data)'],'example_json':{'_note':'Query\x20uses\x20the\x20query/object\x20endpoint,\x20not\x20CallOrder_Data','_call_target':'query','object':'0xORDER_ADDRESS','fields':['items','amount','owner','agent','dispute','claimed_by','progress','machine']},'reverse_explanation':'Query\x20is\x20read-only\x20—\x20does\x20not\x20modify\x20state.\x20Use\x20to\x20verify\x20state\x20before\x20any\x20L1/L2\x20operation.\x20SDK\x20ObjectOrder\x20returns\x20all\x2014\x20fields.','operation_field':'object'},{'id':'P-O-11','pattern_name':'Query\x20Order\x20history\x20(event\x20log)','semantic_intent':'Query\x20Order\x20lifecycle\x20events.\x20⚠️\x20Only\x20NewOrderEvent\x20is\x20actually\x20emitted\x20—\x20other\x20events\x20must\x20be\x20INFERRED\x20from\x20field\x20changes.','match_keywords':['history','events','lifecycle','audit'],'schema_fields':['(read-only\x20via\x20query\x20layer,\x20event\x20filter)'],'example_json':{'_note':'Only\x20NewOrderEvent\x20is\x20emitted\x20on-chain.\x20Other\x20lifecycle\x20events\x20must\x20be\x20inferred\x20by\x20querying\x20Order\x20field\x20diffs\x20over\x20time.','_call_target':'query','object':'0xORDER_ADDRESS','event_filter':{'type':'order::NewOrderEvent'}},'reverse_explanation':'Audit\x20weakness:\x20only\x201\x20of\x2011\x20lifecycle\x20events\x20is\x20actually\x20emitted.\x20Use\x20status_inference\x20formula\x20from\x20ORDER_AUDIT_FORMULAS\x20to\x20derive\x20state.','operation_field':'object'},{'id':'P-O-12','pattern_name':'Monitor\x20Order\x20status\x20changes\x20(polling)','semantic_intent':'Poll\x20Order\x20status\x20to\x20detect:\x20Progress\x20advance,\x20dispute\x20append,\x20claimed_by\x20set,\x20ownership\x20transfer','match_keywords':['monitor','poll','watch','track'],'schema_fields':['(read-only\x20via\x20query\x20layer,\x20polling)'],'example_json':{'_note':'Monitor\x20by\x20querying\x20Order\x20at\x20intervals\x20and\x20diffing\x20fields','_call_target':'query','object':'0xORDER_ADDRESS','poll_interval_ms':0x1388,'watch_fields':['progress','dispute','claimed_by','owner']},'reverse_explanation':'No\x20push\x20notifications\x20—\x20must\x20poll.\x20Track\x204\x20critical\x20fields:\x20progress\x20(advance),\x20dispute\x20(new\x20arb),\x20claimed_by\x20(terminal),\x20owner\x20(transfer).','operation_field':'object'}];export const SCHEMA_TO_SEMANTIC_RULES=[{'element_type':'field','type_name':'object','semantic_explanation':'Order\x20object\x20address.\x20STRING=operate\x20existing\x20Order.\x20null/omitted\x20is\x20invalid\x20(Order\x20creation\x20goes\x20through\x20service::buy).','constraints':['Must\x20be\x20valid\x20Order\x20object\x20ID','Order\x20must\x20exist\x20on-chain']},{'element_type':'field','type_name':'agent','semantic_explanation':'Agent\x20address\x20list\x20(overwrites\x20entire\x20list).\x20Owner-only\x20(L1).\x20Frozen\x20after\x20Progress\x20binding.\x20⚠️\x20Boundary\x20bug:\x20actual\x20max\x2011\x20(not\x2010).','constraints':['<=\x20'+MAX_AGENT_COUNT+'\x20agents\x20(doc)\x20/\x2011\x20(actual\x20bug)','Owner-only','Frozen\x20after\x20Progress\x20binding']},{'element_type':'field','type_name':'required_info','semantic_explanation':'Contact\x20object\x20(recipient\x20info)\x20or\x20WTS\x20Proof\x20object\x20(delivery\x20proof).\x20null\x20clears.\x20L2\x20(owner\x20or\x20agent).','constraints':['Must\x20be\x20Contact\x20or\x20WTS\x20Proof\x20object','null\x20clears\x20the\x20field']},{'element_type':'field','type_name':'progress','semantic_explanation':'Progress\x20operation\x20object\x20—\x20advance\x20via\x20forward/hold.\x20Both\x20owner\x20and\x20agent\x20can\x20advance.\x20Node\x20transition\x20is\x20irreversible.','constraints':['Requires\x20Progress\x20binding\x20(order.progress.is_some())','L2\x20(owner\x20or\x20agent)','Node\x20transition\x20irreversible']},{'element_type':'field','type_name':'arb_confirm','semantic_explanation':'Apply\x20for\x20arbitration\x20compensation.\x20Triggers\x20dispute()\x20appending\x20Arb\x20to\x20order.dispute.\x20L2.\x20Irreversible.','constraints':['Arb\x20must\x20exist','L2\x20(owner\x20or\x20agent)','claimed_by\x20must\x20be\x20None']},{'element_type':'field','type_name':'arb_objection','semantic_explanation':'Object\x20to\x20Arb\x20ruling\x20and\x20request\x20re-arbitration.\x20Requires\x20Arb\x20status\x20=\x20Arbitrated.\x20L2.\x20Irreversible.','constraints':['Arb\x20must\x20be\x20in\x20Arbitrated\x20state','L2\x20(owner\x20or\x20agent)']},{'element_type':'field','type_name':'arb_claim_compensation','semantic_explanation':'Claim\x20compensation\x20from\x20ruled\x20Arb.\x20Sets\x20claimed_by.\x20ONE-TIME,\x20IRREVERSIBLE,\x20blocks\x20future\x20disputes.\x20L2.','constraints':['Arb\x20must\x20be\x20Arbitrated','claimed_by\x20must\x20be\x20None','L2\x20(owner\x20or\x20agent)','IRREVERSIBLE']},{'element_type':'field','type_name':'receive','semantic_explanation':'Receive\x20CoinWrapper\x20or\x20arbitrary\x20Receiving<K>\x20from\x20Progress.\x20Funds\x20forwarded\x20to\x20owner.\x20Owner-only\x20(L1)\x20—\x20agent\x20CANNOT.','constraints':['Owner-only\x20(L1)','Progress\x20must\x20be\x20at\x20terminal\x20node\x20(not\x20delivering)','Can\x20be\x20called\x20multiple\x20times']},{'element_type':'field','type_name':'transfer_to','semantic_explanation':'New\x20owner\x20address\x20for\x20ownership\x20transfer.\x20IRREVERSIBLE.\x20New\x20owner\x20takes\x20over\x20ALL\x20permissions.\x20Owner-only\x20(L1).','constraints':['Owner-only\x20(L1)','IRREVERSIBLE','Valid\x20Wow\x20address']},{'element_type':'op','type_name':'forward','semantic_explanation':'Advance\x20Progress\x20to\x20next\x20node\x20via\x20named\x20forward.\x20Triggers\x20Progress::operate.','constraints':['Forward\x20name\x20must\x20exist\x20on\x20current\x20node','Guard\x20(if\x20any)\x20must\x20pass']},{'element_type':'op','type_name':'hold','semantic_explanation':'Hold\x20at\x20current\x20Progress\x20node\x20(optional\x20pause).','constraints':['Node\x20must\x20support\x20hold']},{'element_type':'op','type_name':'confirm','semantic_explanation':'In\x20arb_confirm:\x20true=confirm\x20materials\x20valid,\x20false=deny\x20materials.','constraints':['Boolean\x20—\x20no\x20other\x20values']},{'element_type':'index','type_name':'dispute_index','semantic_explanation':'Position\x20in\x20order.dispute\x20vector.\x200-based.\x20Max\x2010\x20disputes\x20total.','constraints':['<=\x20'+MAX_DISPUTE_COUNT+'\x20disputes','Frozen\x20when\x20claimed_by.is_some()']},{'element_type':'error','type_name':'E_OWNER\x20(code\x201)','semantic_explanation':'Sender\x20!=\x20order.owner.\x20L1\x20operation\x20attempted\x20by\x20non-owner\x20(agent\x20or\x20third\x20party).','constraints':['Aborts\x20assert_owner']},{'element_type':'error','type_name':'E_PERMISSION\x20(code\x205)','semantic_explanation':'Sender\x20is\x20neither\x20owner\x20nor\x20in\x20agent[].\x20L2\x20operation\x20attempted\x20by\x20unauthorized\x20caller.','constraints':['Aborts\x20assert_op_permission\x20(via\x20has_op_permission\x20returning\x20false)']},{'element_type':'error','type_name':'E_PROGRESS_NOT_SPECIFIED\x20(code\x203)','semantic_explanation':'⚠️\x20DUAL\x20SEMANTICS:\x20(a)\x20order::create\x20—\x20machine\x20is\x20Some\x20but\x20progress\x20is\x20None;\x20(b)\x20agent_set/owner_change\x20—\x20progress\x20is\x20already\x20bound\x20(frozen).','constraints':['Check\x20context\x20to\x20disambiguate','Same\x20code,\x20opposite\x20meanings']},{'element_type':'error','type_name':'E_ORDER_ALREADY_CLAIMED\x20(code\x207)','semantic_explanation':'claimed_by\x20is\x20already\x20Some.\x20Cannot\x20file\x20new\x20disputes,\x20claim\x20again,\x20or\x20call\x20compensate.','constraints':['IRREVERSIBLE\x20—\x20no\x20way\x20to\x20reset\x20claimed_by']},{'element_type':'error','type_name':'E_MAX_AGENT_COUNT\x20(code\x202)','semantic_explanation':'agent\x20list\x20exceeds\x20MAX_AGENT_COUNT\x20(10).\x20⚠️\x20Actual\x20boundary\x20uses\x20<=\x20so\x20allows\x2011\x20(bug).','constraints':['Doc\x20limit:\x20'+MAX_AGENT_COUNT,'Actual\x20limit:\x2011\x20(boundary\x20bug)']},{'element_type':'error','type_name':'E_MAX_DISPUTE_COUNT\x20(code\x206)','semantic_explanation':'dispute\x20vector\x20at\x20MAX_DISPUTE_COUNT\x20(10).\x20Next\x20dispute()\x20call\x20aborts.','constraints':['Max:\x20'+MAX_DISPUTE_COUNT]},{'element_type':'error','type_name':'E_ALLOCATION_NOT_SPECIFIED\x20(code\x208)','semantic_explanation':'order::create\x20with\x20amount\x20>\x200\x20but\x20allocation\x20is\x20None.','constraints':['If\x20amount\x20>\x200,\x20allocation\x20must\x20be\x20set']},{'element_type':'error','type_name':'E_ALLOCATION_ALREADY_SPECIFIED\x20(code\x209)','semantic_explanation':'on_allocation\x20called\x20twice.\x20Allocation\x20is\x20one-time\x20set.','constraints':['One-time\x20only']},{'element_type':'error','type_name':'E_PROGRESS_ALREADY_SPECIFIED\x20(code\x2010)','semantic_explanation':'on_progress\x20called\x20twice.\x20Progress\x20is\x20one-time\x20set.','constraints':['One-time\x20only']}];export const ORDER_CONSTRAINT_RULES=[{'id':'MC-O-01','category':'structural','rule':'Order\x20has\x2014\x20fields;\x20SDK\x20uses\x20\x27builder\x27\x20for\x20Move\x27s\x20\x27owner\x27\x20(only\x20naming\x20deviation\x20in\x2022\x20objects)','applies_to':['object.owner','object.builder']},{'id':'MC-O-02','category':'structural','rule':'agent\x20count\x20<=\x20MAX_AGENT_COUNT\x20('+MAX_AGENT_COUNT+')\x20per\x20docs;\x20⚠️\x20actual\x20allows\x2011\x20due\x20to\x20<=\x20bug','applies_to':['agent']},{'id':'MC-O-03','category':'structural','rule':'dispute\x20count\x20<=\x20MAX_DISPUTE_COUNT\x20('+MAX_DISPUTE_COUNT+');\x20frozen\x20when\x20claimed_by.is_some()','applies_to':['dispute']},{'id':'MC-O-04','category':'structural','rule':'Order\x20creation\x20is\x20COMPOSITE\x20via\x20service::buy\x20—\x20order::create\x20is\x20package-only','applies_to':['(creation\x20flow)']},{'id':'MC-O-05','category':'semantic','rule':'order.machine\x20is\x20a\x20SNAPSHOT\x20copied\x20from\x20service.machine\x20at\x20buy\x20time\x20(not\x20a\x20reference)','applies_to':['machine']},{'id':'MC-O-06','category':'semantic','rule':'E_PROGRESS_NOT_SPECIFIED\x20has\x20DUAL\x20semantics:\x20(a)\x20create:\x20machine\x20Some\x20+\x20progress\x20None;\x20(b)\x20agent_set/owner_change:\x20progress\x20already\x20bound','applies_to':['error\x20code\x203']},{'id':'MC-O-07','category':'semantic','rule':'Only\x20NewOrderEvent\x20is\x20actually\x20emitted;\x2010\x20other\x20lifecycle\x20events\x20must\x20be\x20inferred\x20from\x20field\x20changes','applies_to':['events']},{'id':'MC-O-08','category':'semantic','rule':'SaleItem.item\x20↔\x20PurchasedItem.name\x20(different\x20field\x20names\x20for\x20same\x20concept)','applies_to':['items.item','purchased_items.name']},{'id':'MC-O-09','category':'authority','rule':'L1\x20owner-only\x20operations:\x20receive,\x20transfer_to,\x20owner_change,\x20agent_set\x20(assert_owner)','applies_to':['receive','transfer_to','agent']},{'id':'MC-O-10','category':'authority','rule':'L2\x20owner-or-agent\x20operations:\x20required_info,\x20progress,\x20arb_confirm,\x20arb_objection,\x20arb_claim_compensation\x20(has_op_permission)','applies_to':['required_info','progress','arb_confirm','arb_objection','arb_claim_compensation']},{'id':'MC-O-11','category':'authority','rule':'L3\x20package-only\x20operations:\x20on_progress,\x20on_allocation,\x20dispute,\x20compensate\x20(no\x20external\x20access)','applies_to':['(package-only\x20functions)']},{'id':'MC-O-12','category':'authority','rule':'Agent\x20CANNOT\x20receive\x20payments\x20—\x20only\x20owner\x20can\x20call\x20owner_receive\x20/\x20owner_receive_object','applies_to':['receive']},{'id':'MC-O-13','category':'lifecycle','rule':'Progress\x20binding\x20FREEZES\x20owner\x20and\x20agent\x20—\x20agent_set/owner_change\x20abort\x20E_PROGRESS_NOT_SPECIFIED\x20after\x20binding','applies_to':['agent','transfer_to\x20(pre-progress)','owner_change']},{'id':'MC-O-14','category':'lifecycle','rule':'claimed_by\x20is\x20ONE-TIME,\x20IRREVERSIBLE\x20—\x20blocks\x20future\x20dispute(),\x20compensate(),\x20and\x20arb_claim_compensation','applies_to':['claimed_by','arb_claim_compensation','dispute']},{'id':'MC-O-15','category':'cross_object','rule':'Order\x20+\x20Allocation\x20+\x20Progress\x20are\x201:1:1\x20bound\x20at\x20creation;\x20cannot\x20rebind\x20or\x20detach','applies_to':['progress','allocation']}];export const ORDER_TRANSLATION_VERSION='1.0.0';export function matchSemanticPattern(a){const b=a['toLowerCase']();return SEMANTIC_TO_SCHEMA_RULES['filter'](c=>c['match_keywords']['some'](d=>b['includes'](d['toLowerCase']())));}export function explainOrderCallData(b){const c=[];if(!b['object'])return c['push']('Operation:\x20⚠️\x20INVALID\x20—\x20Order\x20object\x20address\x20required\x20(Order\x20creation\x20goes\x20through\x20service::buy,\x20not\x20CallOrder_Data)'),c['join']('\x0a');c['push']('Operation:\x20MODIFY\x20existing\x20Order\x20at\x20'+b['object']);b['agent']&&(c['push']('-\x20⚠️\x20Set\x20agent\x20list\x20('+b['agent']['length']+'\x20agent(s)):\x20['+b['agent']['join'](',\x20')+']'),c['push']('\x20\x20Owner-only\x20(L1).\x20Frozen\x20after\x20Progress\x20binding.\x20Boundary\x20bug\x20allows\x20max\x2011\x20(not\x2010).'));b['required_info']!==undefined&&(b['required_info']===null?c['push']('-\x20Clear\x20required_info\x20(L2\x20—\x20owner\x20or\x20agent)'):c['push']('-\x20Set\x20required_info:\x20'+b['required_info']+'\x20(Contact\x20or\x20WTS\x20Proof;\x20L2\x20—\x20owner\x20or\x20agent)'));if(b['progress']){const d=b['progress'];c['push']('-\x20Advance\x20Progress\x20(L2\x20—\x20owner\x20or\x20agent)');if(d['next_node_name'])c['push']('\x20\x20Next\x20node:\x20'+d['next_node_name']);if(d['forward'])c['push']('\x20\x20Forward:\x20'+d['forward']['name']+(d['forward']['operator']?'\x20(operator:\x20'+d['forward']['operator']+')':''));if(d['op'])c['push']('\x20\x20Op:\x20'+d['op']);if(d['message'])c['push']('\x20\x20Message:\x20\x22'+d['message']+'\x22');}if(b['arb_confirm']){const e=b['arb_confirm'];c['push']('-\x20⚠️\x20Apply\x20for\x20arbitration\x20(L2\x20—\x20owner\x20or\x20agent,\x20IRREVERSIBLE)'),c['push']('\x20\x20Arb:\x20'+e['arb']),c['push']('\x20\x20Confirm:\x20'+(e['confirm']?'valid\x20materials':'deny\x20materials'));if(e['description'])c['push']('\x20\x20Description:\x20\x22'+e['description']+'\x22');e['proposition']&&e['proposition']['length']>0x0&&c['push']('\x20\x20Propositions:\x20'+e['proposition']['length']+'\x20claim(s)');}if(b['arb_objection']){const f=b['arb_objection'];c['push']('-\x20⚠️\x20Object\x20to\x20Arb\x20ruling\x20(L2\x20—\x20owner\x20or\x20agent,\x20IRREVERSIBLE)'),c['push']('\x20\x20Arb:\x20'+f['arb']),c['push']('\x20\x20Objection:\x20\x22'+f['objection']+'\x22');}if(b['arb_claim_compensation']){const g=b['arb_claim_compensation'];c['push']('-\x20⚠️⚠️\x20CLAIM\x20COMPENSATION\x20(L2\x20—\x20owner\x20or\x20agent,\x20ONE-TIME,\x20IRREVERSIBLE)'),c['push']('\x20\x20Arb:\x20'+g['arb']),c['push']('\x20\x20After\x20claim:\x20NO\x20new\x20disputes\x20can\x20be\x20filed\x20(E_ORDER_ALREADY_CLAIMED)');}return b['receive']&&(c['push']('-\x20Receive\x20(L1\x20—\x20OWNER-ONLY,\x20agent\x20CANNOT)'),c['push']('\x20\x20Received\x20object:\x20'+b['receive']['received']),c['push']('\x20\x20Funds/objects\x20forwarded\x20to\x20owner\x20address')),b['transfer_to']&&(c['push']('-\x20⚠️⚠️\x20TRANSFER\x20OWNERSHIP\x20to\x20'+b['transfer_to']+'\x20(L1\x20—\x20OWNER-ONLY,\x20IRREVERSIBLE)'),c['push']('\x20\x20New\x20owner\x20takes\x20over\x20ALL\x20permissions'),c['push']('\x20\x20Can\x20be\x20called\x20even\x20after\x20Progress\x20binding\x20(unlike\x20agent_set)')),c['join']('\x0a');}export function explainField(a){return SCHEMA_TO_SEMANTIC_RULES['find'](b=>b['element_type']==='field'&&b['type_name']===a);}export function explainOp(a){return SCHEMA_TO_SEMANTIC_RULES['find'](b=>b['element_type']==='op'&&b['type_name']===a);}export function explainOrderError(a){const b=String(a);return SCHEMA_TO_SEMANTIC_RULES['find'](c=>c['element_type']==='error'&&(c['type_name']===b||c['type_name']['startsWith'](b+'\x20')||c['type_name']['includes'](b)));}export function getConstraintsByCategory(a){return ORDER_CONSTRAINT_RULES['filter'](b=>b['category']===a);}export function explainPermissionLayer(a){const b={'L1_owner_only':'L1\x20—\x20Owner-only\x20(assert_owner).\x20Aborts\x20E_OWNER\x20(code\x201)\x20if\x20sender\x20!=\x20owner.\x20Agent\x20CANNOT\x20perform\x20L1\x20ops.','L2_owner_or_agent':'L2\x20—\x20Owner\x20or\x20agent\x20(has_op_permission).\x20Aborts\x20E_PERMISSION\x20(code\x205)\x20if\x20sender\x20is\x20neither\x20owner\x20nor\x20in\x20agent[].','L3_package_only':'L3\x20—\x20Package-only\x20(no\x20external\x20access).\x20Called\x20by\x20other\x20wow-framework\x20modules\x20(progress,\x20allocation,\x20arbitration).'};return b[a];}export function resolveFieldName(a){if(a==='builder'||a==='owner')return{'sdk_name':'builder','move_name':'owner','is_deviation':!![]};return{'sdk_name':a,'move_name':a,'is_deviation':![]};}export function matchSceneFromOperation(a){const b=ORDER_SCENES['filter'](c=>c['operation_field']===a);return b['length']>0x0?b[0x0]:undefined;}export function explainOrderIntent(a){const b=inferSceneFromIntent(a),c=matchSemanticPattern(a),d=b?ORDER_CONSTRAINT_RULES['filter'](e=>{if(b['permission_layer']==='L1_owner_only')return e['category']==='authority'||e['category']==='lifecycle';if(b['permission_layer']==='L2_owner_or_agent')return e['category']==='authority'||e['category']==='semantic';return e['category']==='structural'||e['category']==='cross_object';}):ORDER_CONSTRAINT_RULES;return{'matched_scene':b,'matched_patterns':c,'relevant_constraints':d};}