@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,622 +1 @@
1
- import { MAX_SALE_COUNT, MAX_REPOSITORY_COUNT, MAX_ARBITRATION_COUNT, MAX_DISCOUNT_COUNT_ONCE, MAX_DISCOUNT_TOTAL_COUNT, MAX_WIP_LENGTH, MAX_WIP_HASH_LENGTH, } from "@wowok/wowok";
2
- import { isServicePermission, getServicePermissionByIndex, } from "./service-ledger.js";
3
- export const SEMANTIC_TO_SCHEMA_RULES = [
4
- {
5
- id: "P-S-01",
6
- pattern_name: "Create new Service",
7
- semantic_intent: "Create a new Service<T> with owner, permission, description, coin type",
8
- match_keywords: ["create", "new", "open"],
9
- schema_fields: ["object(null)", "description", "permission", "owner", "coin_type"],
10
- example_json: {
11
- object: null,
12
- description: "My retail shop",
13
- permission: "0xPERMISSION_ADDRESS",
14
- },
15
- reverse_explanation: "object=null indicates creation; permission must be a valid Permission object owned by signer",
16
- },
17
- {
18
- id: "P-S-02",
19
- pattern_name: "Modify description / location / customer_required",
20
- semantic_intent: "Update Service metadata fields (mutable pre and post publish)",
21
- match_keywords: ["describe", "locate", "customer_required", "update", "modify"],
22
- schema_fields: ["object", "description", "location", "customer_required"],
23
- example_json: {
24
- object: "0xSERVICE_ADDRESS",
25
- description: "Updated description",
26
- location: "Shanghai",
27
- customer_required: ["name", "phone"],
28
- },
29
- reverse_explanation: "These fields are always mutable. customer_required is a string[] of field names buyers must provide at order time.",
30
- },
31
- {
32
- id: "P-S-03",
33
- pattern_name: "Manage sales items (add/set/remove/clear)",
34
- semantic_intent: "Add product SKUs, update prices/stock, remove deprecated items, or clear all",
35
- match_keywords: ["sales", "product", "sku", "inventory", "price"],
36
- schema_fields: ["object", "sales"],
37
- example_json: {
38
- object: "0xSERVICE_ADDRESS",
39
- sales: {
40
- op: "add",
41
- sales: [
42
- { name: "standard", price: "1000000000", stock: 100, wip: "https://ipfs/wip", wip_hash: "abcd...64" },
43
- ],
44
- },
45
- },
46
- reverse_explanation: "sales.op=add appends; set replaces matching name; remove deletes by name; clear empties all. wip_hash is REQUIRED for tamper protection.",
47
- },
48
- {
49
- id: "P-S-04",
50
- pattern_name: "Bind/unbind Machine workflow",
51
- semantic_intent: "Bind a Machine workflow template to Service (post-publish immutable)",
52
- match_keywords: ["machine", "workflow", "bind machine"],
53
- schema_fields: ["object", "machine"],
54
- example_json: {
55
- object: "0xSERVICE_ADDRESS",
56
- machine: "0xMACHINE_ADDRESS",
57
- },
58
- reverse_explanation: "machine=<address> binds; machine=null unbinds (pre-publish only). Once published, machine is immutable (F-S-20). Progress inherits this binding.",
59
- },
60
- {
61
- id: "P-S-05",
62
- pattern_name: "Set/clear buy Guard",
63
- semantic_intent: "Set buyer eligibility Guard (KYC/whitelist) or clear it",
64
- match_keywords: ["buy_guard", "kyc", "whitelist"],
65
- schema_fields: ["object", "buy_guard"],
66
- example_json: {
67
- object: "0xSERVICE_ADDRESS",
68
- buy_guard: "0xGUARD_ADDRESS",
69
- },
70
- reverse_explanation: "buy_guard is the ONLY field still mutable post-publish (F-S-26 exception). Pre-sale: set to whitelist; public sale: set to null.",
71
- },
72
- {
73
- id: "P-S-06",
74
- pattern_name: "Manage arbitrations (add/remove/clear)",
75
- semantic_intent: "Bind Arbitration objects for dispute handling (post-publish immutable)",
76
- match_keywords: ["arbitration", "arbitrator", "dispute"],
77
- schema_fields: ["object", "arbitrations"],
78
- example_json: {
79
- object: "0xSERVICE_ADDRESS",
80
- arbitrations: { op: "add", objects: ["0xARB_ADDRESS"] },
81
- },
82
- reverse_explanation: "Required when compensation_fund > 0 (F-S-19). Post-publish immutable (F-S-21). Use 1-3 Arbitration objects covering different scopes.",
83
- },
84
- {
85
- id: "P-S-07",
86
- pattern_name: "Manage repositories (add/remove/clear)",
87
- semantic_intent: "Bind Repository objects (data stores) — mutable post-publish",
88
- match_keywords: ["repository", "data store", "storage", "data source"],
89
- schema_fields: ["object", "repositories"],
90
- example_json: {
91
- object: "0xSERVICE_ADDRESS",
92
- repositories: { op: "add", objects: ["0xREPO_ADDRESS"] },
93
- },
94
- reverse_explanation: "Mutable post-publish. SDK validates ObjectType.Repository via queryObjectsWithType. Max 100 (MAX_REPOSITORY_COUNT).",
95
- },
96
- {
97
- id: "P-S-08",
98
- pattern_name: "Manage rewards (add/remove/clear)",
99
- semantic_intent: "Bind Reward objects for marketing incentives (locked by setting_lock_duration)",
100
- match_keywords: ["reward", "incentive", "marketing"],
101
- schema_fields: ["object", "rewards"],
102
- example_json: {
103
- object: "0xSERVICE_ADDRESS",
104
- rewards: { op: "add", objects: ["0xREWARD_ADDRESS"] },
105
- },
106
- reverse_explanation: "Mutable but locked by setting_lock_duration (F-S-24). Cannot be removed until lock expires. Max 20 (MAX_REWARD_COUNT).",
107
- },
108
- {
109
- id: "P-S-09",
110
- pattern_name: "Set order_allocators",
111
- semantic_intent: "Configure fund distribution strategy (publish prerequisite, post-publish immutable)",
112
- match_keywords: ["allocator", "order_allocators"],
113
- schema_fields: ["object", "order_allocators"],
114
- example_json: {
115
- object: "0xSERVICE_ADDRESS",
116
- order_allocators: [
117
- {
118
- threshold: "0",
119
- sharing: [
120
- { who: { Object: "0xOWNER" }, weight: 80 },
121
- { who: { Object: "0xPLATFORM" }, weight: 20 },
122
- ],
123
- },
124
- ],
125
- },
126
- reverse_explanation: "MANDATORY before publish (F-S-18, E_NO_ALLOCATOR). First-match-wins: first allocator whose threshold <= order value handles distribution. Post-publish immutable (F-S-22).",
127
- },
128
- {
129
- id: "P-S-10",
130
- pattern_name: "Pause/resume Service",
131
- semantic_intent: "Block new orders (pause) or resume accepting orders",
132
- match_keywords: ["pause", "resume"],
133
- schema_fields: ["object", "pause"],
134
- example_json: {
135
- object: "0xSERVICE_ADDRESS",
136
- pause: true,
137
- },
138
- reverse_explanation: "pause=true blocks new orders (E_SERVICE_PAUSED); pause=false resumes. Existing Progress continues normally. compensation_fund_withdraw requires paused=true.",
139
- },
140
- {
141
- id: "P-S-11",
142
- pattern_name: "Publish Service (IRREVERSIBLE)",
143
- semantic_intent: "Publish Service — makes it buyable. One-shot, cannot revert.",
144
- match_keywords: ["publish", "go live", "release"],
145
- schema_fields: ["object", "publish"],
146
- example_json: {
147
- object: "0xSERVICE_ADDRESS",
148
- publish: true,
149
- },
150
- reverse_explanation: "⚠️ IRREVERSIBLE. Requires SERVICE_PUBLISH (311) permission. Prerequisites: order_allocators set; if compensation_fund > 0, arbitrations non-empty. Locks machine/arbitrations/order_allocators forever.",
151
- },
152
- {
153
- id: "P-S-12",
154
- pattern_name: "Issue/destroy discount coupons",
155
- semantic_intent: "Issue promotional discount coupons or destroy (redeem) them",
156
- match_keywords: ["discount", "coupon"],
157
- schema_fields: ["object", "discount"],
158
- example_json: {
159
- object: "0xSERVICE_ADDRESS",
160
- discount: {
161
- name: "SUMMER10",
162
- discount_type: 0,
163
- data: 1000,
164
- count: 100,
165
- receivers: ["0xUSER1", "0xUSER2"],
166
- expire_at: 1735689600000,
167
- },
168
- },
169
- reverse_explanation: "discount_type=0 rates (basis points, per 10000), 1=minus (direct deduction). Max 1000 per call (MAX_DISCOUNT_COUNT_ONCE), 20000 total (MAX_DISCOUNT_TOTAL_COUNT). discount_destroy is holder-only.",
170
- },
171
- {
172
- id: "P-S-13",
173
- pattern_name: "Compensation fund operations (add/withdraw/receive)",
174
- semantic_intent: "Deposit to compensation_fund, withdraw (locked), or receive (locked)",
175
- match_keywords: ["compensation_fund", "compensation", "deposit", "withdraw"],
176
- schema_fields: ["object", "compensation_fund_add", "compensation_fund_withdraw", "compensation_fund_receive"],
177
- example_json: {
178
- object: "0xSERVICE_ADDRESS",
179
- compensation_fund_add: { balance: "1000000000" },
180
- },
181
- reverse_explanation: "add=always mutable; withdraw/receive locked by setting_lock_duration AND requires bPaused=true. Internal Balance<T>, distinct from Treasury.",
182
- },
183
- {
184
- id: "P-S-14",
185
- pattern_name: "Extend setting_lock_duration",
186
- semantic_intent: "Add milliseconds to setting_lock_duration (only-increase mechanism)",
187
- match_keywords: ["setting_lock_duration", "lock_duration", "lock period", "extend lock"],
188
- schema_fields: ["object", "setting_lock_duration_add"],
189
- example_json: {
190
- object: "0xSERVICE_ADDRESS",
191
- setting_lock_duration_add: 2592000000,
192
- },
193
- reverse_explanation: "Only-increase (safe_add). Default 2592000000ms (30 days). Affects rewards/compensation_fund_withdraw/compensation_fund_receive mutability windows.",
194
- },
195
- {
196
- id: "P-S-15",
197
- pattern_name: "Buy (8-stage composite order flow)",
198
- semantic_intent: "Customer places order — atomic creation of Order + Allocation + Progress",
199
- match_keywords: ["buy", "order", "purchase"],
200
- schema_fields: ["object", "order_new"],
201
- example_json: {
202
- object: "0xSERVICE_ADDRESS",
203
- order_new: {
204
- buy: {
205
- items: [{ name: "standard", wip_hash: "abcd...64", count: 1 }],
206
- discount: "0xDISCOUNT_ADDRESS",
207
- total_pay: "1000000000",
208
- passport: null,
209
- },
210
- order_required_info: { name: "Alice", phone: "+86..." },
211
- agents: ["0xAGENT1"],
212
- transfer: null,
213
- },
214
- },
215
- reverse_explanation: "8 stages: pre_check → wip_verify → quote (deducts stock!) → create_order → create_allocation → create_progress → post_actions → return_result. Stock deduction is NOT rolled back on later failure.",
216
- },
217
- {
218
- id: "P-S-16",
219
- pattern_name: "Transfer ownership (IRREVERSIBLE)",
220
- semantic_intent: "Transfer Service ownership to a new address",
221
- match_keywords: ["transfer", "handover"],
222
- schema_fields: ["object", "builder"],
223
- example_json: {
224
- object: "0xSERVICE_ADDRESS",
225
- builder: "0xNEW_OWNER",
226
- },
227
- reverse_explanation: "⚠️ IRREVERSIBLE. Original owner loses ALL control. New owner inherits permission, compensation_fund, all bindings. Export JSON before transfer.",
228
- },
229
- ];
230
- export const SCHEMA_TO_SEMANTIC_RULES = [
231
- {
232
- element_type: "field",
233
- type_name: "object",
234
- semantic_explanation: "Service object address. STRING=operate existing; null/omitted=create new",
235
- },
236
- {
237
- element_type: "field",
238
- type_name: "description",
239
- semantic_explanation: "Human-readable Service description. Mutable pre/post publish. Max 4000 chars.",
240
- },
241
- {
242
- element_type: "field",
243
- type_name: "location",
244
- semantic_explanation: "Geographic location of the service (city/region). Mutable. Index 303 (SERVICE_LOCATION).",
245
- },
246
- {
247
- element_type: "field",
248
- type_name: "customer_required",
249
- semantic_explanation: "String[] of field names buyers must provide at order time (e.g. ['name','phone']). Mutable. Index 309.",
250
- },
251
- {
252
- element_type: "field",
253
- type_name: "sales",
254
- semantic_explanation: "Product SKU list. op=add/set/remove/clear. Each sale has name/price/stock/wip/wip_hash. Index 305 (SERVICE_SALES).",
255
- },
256
- {
257
- element_type: "field",
258
- type_name: "machine",
259
- semantic_explanation: "Machine workflow template binding. ⚠️ IMMUTABLE post-publish (F-S-20). Index 306 (SERVICE_MACHINE).",
260
- },
261
- {
262
- element_type: "field",
263
- type_name: "buy_guard",
264
- semantic_explanation: "Buyer eligibility Guard. ⚠️ UNUSUAL: still mutable post-publish (F-S-26 exception). Index 307 (SERVICE_BUY_GUARD).",
265
- },
266
- {
267
- element_type: "field",
268
- type_name: "arbitrations",
269
- semantic_explanation: "Arbitration object list. Required if compensation_fund > 0. ⚠️ IMMUTABLE post-publish (F-S-21). Index 308.",
270
- },
271
- {
272
- element_type: "field",
273
- type_name: "repositories",
274
- semantic_explanation: "Repository object list. Mutable. Max 100 (MAX_REPOSITORY_COUNT). Index 304 (SERVICE_REPOSITORY).",
275
- },
276
- {
277
- element_type: "field",
278
- type_name: "rewards",
279
- semantic_explanation: "Reward object list. Mutable but locked by setting_lock_duration (F-S-24). Max 20 (MAX_REWARD_COUNT). Index 318.",
280
- },
281
- {
282
- element_type: "field",
283
- type_name: "order_allocators",
284
- semantic_explanation: "Fund distribution strategy. ⚠️ MANDATORY for publish (F-S-18). IMMUTABLE post-publish (F-S-22). Index 313.",
285
- },
286
- {
287
- element_type: "field",
288
- type_name: "discount",
289
- semantic_explanation: "Discount coupon issuance. discount_type=0 rates, 1=minus. Index 312 (SERVICE_DISCOUNT).",
290
- },
291
- {
292
- element_type: "field",
293
- type_name: "pause",
294
- semantic_explanation: "true=pause (block new orders); false=resume. Existing Progress unaffected. Index 310 (SERVICE_PAUSE).",
295
- },
296
- {
297
- element_type: "field",
298
- type_name: "publish",
299
- semantic_explanation: "⚠️ IRREVERSIBLE one-shot. Requires prerequisites. Locks 3 fields forever. Index 311 (SERVICE_PUBLISH).",
300
- },
301
- {
302
- element_type: "field",
303
- type_name: "compensation_fund_add",
304
- semantic_explanation: "Deposit to internal Balance<T>. Always mutable. Index 315. Distinct from Treasury.",
305
- },
306
- {
307
- element_type: "field",
308
- type_name: "compensation_fund_withdraw",
309
- semantic_explanation: "Withdraw from internal Balance<T>. Requires bPaused=true + lock_duration expired. Index 314. Locked by duration (F-S-25).",
310
- },
311
- {
312
- element_type: "field",
313
- type_name: "compensation_fund_receive",
314
- semantic_explanation: "Receive compensation_fund (for arbitration payouts). Locked by setting_lock_duration. Index 316.",
315
- },
316
- {
317
- element_type: "field",
318
- type_name: "setting_lock_duration_add",
319
- semantic_explanation: "Extend setting_lock_duration (only-increase, safe_add). Index 317 (SERVICE_COMPENSATION_LOCK_DURATION_ADD).",
320
- },
321
- {
322
- element_type: "field",
323
- type_name: "order_new",
324
- semantic_explanation: "Composite buy operation. Triggers 8-stage flow: pre_check → wip_verify → quote → create_order/allocation/progress → post_actions → return_result.",
325
- },
326
- {
327
- element_type: "field",
328
- type_name: "builder",
329
- semantic_explanation: "Transfer ownership. ⚠️ IRREVERSIBLE. Original owner loses ALL control.",
330
- },
331
- {
332
- element_type: "field",
333
- type_name: "um",
334
- semantic_explanation: "User Manager (Contact object). Mutable. Index 320 (SERVICE_UM).",
335
- },
336
- {
337
- element_type: "field",
338
- type_name: "owner_receive",
339
- semantic_explanation: "Receive Payment/objects to owner. Index 319 (SERVICE_OWNER_RECEIVE).",
340
- },
341
- {
342
- element_type: "op",
343
- type_name: "add",
344
- semantic_explanation: "Append new items (sales/arbitrations/repositories/rewards). Additive, does not replace.",
345
- },
346
- {
347
- element_type: "op",
348
- type_name: "set",
349
- semantic_explanation: "Replace existing item by name (sales) or replace entire list (repositories/rewards/arbitrations).",
350
- },
351
- {
352
- element_type: "op",
353
- type_name: "remove",
354
- semantic_explanation: "Remove specific items by name (sales) or address (repositories/rewards/arbitrations).",
355
- },
356
- {
357
- element_type: "op",
358
- type_name: "clear",
359
- semantic_explanation: "Remove all items from the list.",
360
- },
361
- ];
362
- export const SERVICE_CONSTRAINT_RULES = [
363
- {
364
- id: "MC-S-01",
365
- category: "structural",
366
- rule: `Service builtin permission indexes must be in range 300-320 (302 reserved/commented)`,
367
- applies_to: ["permission table.index (when applied to Service)"],
368
- },
369
- {
370
- id: "MC-S-02",
371
- category: "structural",
372
- rule: `sales count <= MAX_SALE_COUNT (${MAX_SALE_COUNT})`,
373
- applies_to: ["sales.sales"],
374
- },
375
- {
376
- id: "MC-S-03",
377
- category: "structural",
378
- rule: `repositories count <= MAX_REPOSITORY_COUNT (${MAX_REPOSITORY_COUNT})`,
379
- applies_to: ["repositories.objects"],
380
- },
381
- {
382
- id: "MC-S-04",
383
- category: "structural",
384
- rule: `arbitrations count <= MAX_ARBITRATION_COUNT (${MAX_ARBITRATION_COUNT})`,
385
- applies_to: ["arbitrations.objects"],
386
- },
387
- {
388
- id: "MC-S-05",
389
- category: "structural",
390
- rule: `rewards count <= MAX_REWARD_COUNT (20)`,
391
- applies_to: ["rewards.objects"],
392
- },
393
- {
394
- id: "MC-S-06",
395
- category: "structural",
396
- rule: `customer_required count <= 10, each item length <= 20`,
397
- applies_to: ["customer_required"],
398
- },
399
- {
400
- id: "MC-S-07",
401
- category: "structural",
402
- rule: `wip URL length <= MAX_WIP_LENGTH (${MAX_WIP_LENGTH})`,
403
- applies_to: ["sales.sales[].wip"],
404
- },
405
- {
406
- id: "MC-S-08",
407
- category: "structural",
408
- rule: `wip_hash length <= MAX_WIP_HASH_LENGTH (${MAX_WIP_HASH_LENGTH}) — sha256 hex (64 chars, no prefix)`,
409
- applies_to: ["sales.sales[].wip_hash", "order_new.buy.items[].wip_hash"],
410
- },
411
- {
412
- id: "MC-S-09",
413
- category: "semantic",
414
- rule: `wip_hash must NOT be empty when wip URL is set (tamper protection)`,
415
- applies_to: ["sales.sales[]"],
416
- },
417
- {
418
- id: "MC-S-10",
419
- category: "authority",
420
- rule: `publish requires order_allocators set (F-S-18, E_NO_ALLOCATOR)`,
421
- applies_to: ["publish", "order_allocators"],
422
- },
423
- {
424
- id: "MC-S-11",
425
- category: "authority",
426
- rule: `publish with compensation_fund > 0 requires arbitrations non-empty (F-S-19, E_ARBITRATION_NOT_SET_WITH_COMPENSATION_FUND)`,
427
- applies_to: ["publish", "arbitrations", "compensation_fund_add"],
428
- },
429
- {
430
- id: "MC-S-12",
431
- category: "lifecycle",
432
- rule: `machine IMMUTABLE post-publish (F-S-20) — SDK checkNotPublished() blocks`,
433
- applies_to: ["machine"],
434
- },
435
- {
436
- id: "MC-S-13",
437
- category: "lifecycle",
438
- rule: `arbitrations IMMUTABLE post-publish (F-S-21) — SDK checkNotPublished() blocks`,
439
- applies_to: ["arbitrations"],
440
- },
441
- {
442
- id: "MC-S-14",
443
- category: "lifecycle",
444
- rule: `order_allocators IMMUTABLE post-publish (F-S-22) — SDK checkNotPublished() blocks`,
445
- applies_to: ["order_allocators"],
446
- },
447
- {
448
- id: "MC-S-15",
449
- category: "lifecycle",
450
- rule: `bPublished is IRREVERSIBLE (one-shot, cannot revert to false) — to 'reset', create new Service`,
451
- applies_to: ["publish"],
452
- },
453
- {
454
- id: "MC-S-16",
455
- category: "lifecycle",
456
- rule: `setting_lock_duration only-increase (safe_add) — cannot be decreased; protects customers`,
457
- applies_to: ["setting_lock_duration_add"],
458
- },
459
- {
460
- id: "MC-S-17",
461
- category: "lifecycle",
462
- rule: `compensation_fund_withdraw requires bPaused=true AND setting_lock_duration expired (F-S-25, F-S-26)`,
463
- applies_to: ["compensation_fund_withdraw", "pause"],
464
- },
465
- {
466
- id: "MC-S-18",
467
- category: "semantic",
468
- rule: `discount count <= MAX_DISCOUNT_TOTAL_COUNT (${MAX_DISCOUNT_TOTAL_COUNT}); per-call <= MAX_DISCOUNT_COUNT_ONCE (${MAX_DISCOUNT_COUNT_ONCE})`,
469
- applies_to: ["discount.count"],
470
- },
471
- {
472
- id: "MC-S-19",
473
- category: "semantic",
474
- rule: `buy_guard is the ONLY field still mutable post-publish (F-S-26 exception) — all other guarded fields are immutable`,
475
- applies_to: ["buy_guard"],
476
- },
477
- {
478
- id: "MC-S-20",
479
- category: "authority",
480
- rule: `Ownership transfer (builder) is IRREVERSIBLE — new owner inherits permission + compensation_fund + all bindings`,
481
- applies_to: ["builder"],
482
- },
483
- ];
484
- export const SERVICE_TRANSLATION_VERSION = "1.0.0";
485
- export function matchSemanticPattern(userIntent) {
486
- const lower = userIntent.toLowerCase();
487
- return SEMANTIC_TO_SCHEMA_RULES.filter(rule => rule.match_keywords.some(kw => lower.includes(kw.toLowerCase())));
488
- }
489
- export function explainServiceCallData(data) {
490
- const lines = [];
491
- if (data.object === null || data.object === undefined) {
492
- lines.push("Operation: CREATE new Service");
493
- }
494
- else {
495
- lines.push(`Operation: MODIFY existing Service at ${data.object}`);
496
- }
497
- if (data.description)
498
- lines.push(`- Set description: "${data.description}"`);
499
- if (data.location)
500
- lines.push(`- Set location: ${data.location}`);
501
- if (data.customer_required)
502
- lines.push(`- Customer required fields: [${data.customer_required.join(", ")}]`);
503
- if (data.sales) {
504
- const s = data.sales;
505
- if (s.op === "clear") {
506
- lines.push(`- Sales: CLEAR all items`);
507
- }
508
- else if (s.op === "remove") {
509
- lines.push(`- Sales REMOVE: [${s.sales_name.join(", ")}]`);
510
- }
511
- else {
512
- lines.push(`- Sales ${s.op.toUpperCase()}: ${s.sales.length} item(s)`);
513
- for (const item of s.sales) {
514
- const hashInfo = item.wip_hash ? ` hash=${item.wip_hash.slice(0, 8)}...` : " ⚠️NO_HASH";
515
- lines.push(` • ${item.name} price=${item.price ?? "?"} stock=${item.stock ?? "?"}${hashInfo}`);
516
- }
517
- }
518
- }
519
- if (data.machine !== undefined) {
520
- lines.push(data.machine === null ? `- Machine: unbind (pre-publish only)` : `- Machine: bind ${data.machine}`);
521
- }
522
- if (data.buy_guard !== undefined) {
523
- lines.push(data.buy_guard === null ? `- Buy Guard: clear` : `- Buy Guard: set ${data.buy_guard} [mutable post-publish]`);
524
- }
525
- if (data.arbitrations) {
526
- const a = data.arbitrations;
527
- if (a.op === "clear") {
528
- lines.push(`- Arbitrations: CLEAR (pre-publish only)`);
529
- }
530
- else {
531
- lines.push(`- Arbitrations ${a.op.toUpperCase()}: ${a.objects.length} object(s)`);
532
- }
533
- }
534
- if (data.repositories) {
535
- const r = data.repositories;
536
- if (r.op === "clear") {
537
- lines.push(`- Repositories: CLEAR`);
538
- }
539
- else {
540
- lines.push(`- Repositories ${r.op.toUpperCase()}: ${r.objects.length} object(s)`);
541
- }
542
- }
543
- if (data.rewards) {
544
- const r = data.rewards;
545
- if (r.op === "clear") {
546
- lines.push(`- Rewards: CLEAR (locked by duration)`);
547
- }
548
- else {
549
- lines.push(`- Rewards ${r.op.toUpperCase()}: ${r.objects.length} object(s) [locked by duration]`);
550
- }
551
- }
552
- if (data.order_allocators !== undefined) {
553
- lines.push(`- Order Allocators: ${data.order_allocators ? "configured" : "(clear)"} [immutable post-publish]`);
554
- }
555
- if (data.discount) {
556
- const d = data.discount;
557
- const typeName = d.discount_type === 0 ? "rates (basis points, per 10000)" : "minus (direct deduction)";
558
- lines.push(`- Discount: ${d.name} type=${typeName} data=${d.data} count=${d.count}`);
559
- }
560
- if (data.pause !== undefined) {
561
- lines.push(`- Pause: ${data.pause ? "PAUSE (block new orders)" : "RESUME"}`);
562
- }
563
- if (data.publish) {
564
- lines.push(`- ⚠️ PUBLISH (IRREVERSIBLE — locks machine/arbitrations/order_allocators forever)`);
565
- }
566
- if (data.compensation_fund_add) {
567
- lines.push(`- Compensation fund deposit: ${data.compensation_fund_add.balance} (internal Balance<T>)`);
568
- }
569
- if (data.compensation_fund_withdraw) {
570
- lines.push(`- ⚠️ Compensation fund withdraw (requires bPaused=true + lock_duration expired)`);
571
- }
572
- if (data.compensation_fund_receive) {
573
- lines.push(`- Compensation fund receive (locked by duration)`);
574
- }
575
- if (data.setting_lock_duration_add !== undefined) {
576
- lines.push(`- Setting lock duration +${data.setting_lock_duration_add}ms (only-increase)`);
577
- }
578
- if (data.order_new) {
579
- const o = data.order_new;
580
- lines.push(`- ⚠️ ORDER NEW (8-stage composite flow):`);
581
- lines.push(` Items: ${o.buy.items.length}`);
582
- lines.push(` Total pay: ${o.buy.total_pay}`);
583
- if (o.buy.discount)
584
- lines.push(` Discount: ${o.buy.discount}`);
585
- lines.push(` Stages: pre_check → wip_verify → quote (deducts stock!) → create_order/allocation/progress → return`);
586
- }
587
- if (data.builder) {
588
- lines.push(`- ⚠️ TRANSFER ownership to ${data.builder} (IRREVERSIBLE)`);
589
- }
590
- if (data.um !== undefined) {
591
- lines.push(data.um === null ? `- UM: revoke` : `- UM: set to ${data.um}`);
592
- }
593
- if (data.owner_receive) {
594
- lines.push(`- Owner receive: receive Payment/objects to owner`);
595
- }
596
- return lines.join("\n");
597
- }
598
- export function explainField(fieldName) {
599
- return SCHEMA_TO_SEMANTIC_RULES.find(r => r.element_type === "field" && r.type_name === fieldName);
600
- }
601
- export function explainOp(opName) {
602
- return SCHEMA_TO_SEMANTIC_RULES.find(r => r.element_type === "op" && r.type_name === opName);
603
- }
604
- export function getConstraintsByCategory(category) {
605
- return SERVICE_CONSTRAINT_RULES.filter(r => r.category === category);
606
- }
607
- export function explainServicePermissionIndex(index) {
608
- if (isServicePermission(index)) {
609
- const entry = getServicePermissionByIndex(index);
610
- if (!entry)
611
- return `Unknown Service permission (${index})`;
612
- const mutabilityNote = entry.post_publish_mutability === "immutable"
613
- ? " [IMMUTABLE post-publish]"
614
- : entry.post_publish_mutability === "one_shot"
615
- ? " [ONE-SHOT, irreversible]"
616
- : entry.post_publish_mutability === "locked_by_duration"
617
- ? " [locked by setting_lock_duration]"
618
- : "";
619
- return `${entry.name} (${index}) — ${entry.description}${mutabilityNote}`;
620
- }
621
- return `Non-Service permission (${index}) — verify against host object's index range`;
622
- }
1
+ import{MAX_SALE_COUNT,MAX_REPOSITORY_COUNT,MAX_ARBITRATION_COUNT,MAX_DISCOUNT_COUNT_ONCE,MAX_DISCOUNT_TOTAL_COUNT,MAX_WIP_LENGTH,MAX_WIP_HASH_LENGTH}from'@wowok/wowok';import{isServicePermission,getServicePermissionByIndex}from'./service-ledger.js';export const SEMANTIC_TO_SCHEMA_RULES=[{'id':'P-S-01','pattern_name':'Create\x20new\x20Service','semantic_intent':'Create\x20a\x20new\x20Service<T>\x20with\x20owner,\x20permission,\x20description,\x20coin\x20type','match_keywords':['create','new','open'],'schema_fields':['object(null)','description','permission','owner','coin_type'],'example_json':{'object':null,'description':'My\x20retail\x20shop','permission':'0xPERMISSION_ADDRESS'},'reverse_explanation':'object=null\x20indicates\x20creation;\x20permission\x20must\x20be\x20a\x20valid\x20Permission\x20object\x20owned\x20by\x20signer'},{'id':'P-S-02','pattern_name':'Modify\x20description\x20/\x20location\x20/\x20customer_required','semantic_intent':'Update\x20Service\x20metadata\x20fields\x20(mutable\x20pre\x20and\x20post\x20publish)','match_keywords':['describe','locate','customer_required','update','modify'],'schema_fields':['object','description','location','customer_required'],'example_json':{'object':'0xSERVICE_ADDRESS','description':'Updated\x20description','location':'Shanghai','customer_required':['name','phone']},'reverse_explanation':'These\x20fields\x20are\x20always\x20mutable.\x20customer_required\x20is\x20a\x20string[]\x20of\x20field\x20names\x20buyers\x20must\x20provide\x20at\x20order\x20time.'},{'id':'P-S-03','pattern_name':'Manage\x20sales\x20items\x20(add/set/remove/clear)','semantic_intent':'Add\x20product\x20SKUs,\x20update\x20prices/stock,\x20remove\x20deprecated\x20items,\x20or\x20clear\x20all','match_keywords':['sales','product','sku','inventory','price'],'schema_fields':['object','sales'],'example_json':{'object':'0xSERVICE_ADDRESS','sales':{'op':'add','sales':[{'name':'standard','price':'1000000000','stock':0x64,'wip':'https://ipfs/wip','wip_hash':'abcd...64'}]}},'reverse_explanation':'sales.op=add\x20appends;\x20set\x20replaces\x20matching\x20name;\x20remove\x20deletes\x20by\x20name;\x20clear\x20empties\x20all.\x20wip_hash\x20is\x20REQUIRED\x20for\x20tamper\x20protection.'},{'id':'P-S-04','pattern_name':'Bind/unbind\x20Machine\x20workflow','semantic_intent':'Bind\x20a\x20Machine\x20workflow\x20template\x20to\x20Service\x20(post-publish\x20immutable)','match_keywords':['machine','workflow','bind\x20machine'],'schema_fields':['object','machine'],'example_json':{'object':'0xSERVICE_ADDRESS','machine':'0xMACHINE_ADDRESS'},'reverse_explanation':'machine=<address>\x20binds;\x20machine=null\x20unbinds\x20(pre-publish\x20only).\x20Once\x20published,\x20machine\x20is\x20immutable\x20(F-S-20).\x20Progress\x20inherits\x20this\x20binding.'},{'id':'P-S-05','pattern_name':'Set/clear\x20buy\x20Guard','semantic_intent':'Set\x20buyer\x20eligibility\x20Guard\x20(KYC/whitelist)\x20or\x20clear\x20it','match_keywords':['buy_guard','kyc','whitelist'],'schema_fields':['object','buy_guard'],'example_json':{'object':'0xSERVICE_ADDRESS','buy_guard':'0xGUARD_ADDRESS'},'reverse_explanation':'buy_guard\x20is\x20the\x20ONLY\x20field\x20still\x20mutable\x20post-publish\x20(F-S-26\x20exception).\x20Pre-sale:\x20set\x20to\x20whitelist;\x20public\x20sale:\x20set\x20to\x20null.'},{'id':'P-S-06','pattern_name':'Manage\x20arbitrations\x20(add/remove/clear)','semantic_intent':'Bind\x20Arbitration\x20objects\x20for\x20dispute\x20handling\x20(post-publish\x20immutable)','match_keywords':['arbitration','arbitrator','dispute'],'schema_fields':['object','arbitrations'],'example_json':{'object':'0xSERVICE_ADDRESS','arbitrations':{'op':'add','objects':['0xARB_ADDRESS']}},'reverse_explanation':'Required\x20when\x20compensation_fund\x20>\x200\x20(F-S-19).\x20Post-publish\x20immutable\x20(F-S-21).\x20Use\x201-3\x20Arbitration\x20objects\x20covering\x20different\x20scopes.'},{'id':'P-S-07','pattern_name':'Manage\x20repositories\x20(add/remove/clear)','semantic_intent':'Bind\x20Repository\x20objects\x20(data\x20stores)\x20—\x20mutable\x20post-publish','match_keywords':['repository','data\x20store','storage','data\x20source'],'schema_fields':['object','repositories'],'example_json':{'object':'0xSERVICE_ADDRESS','repositories':{'op':'add','objects':['0xREPO_ADDRESS']}},'reverse_explanation':'Mutable\x20post-publish.\x20SDK\x20validates\x20ObjectType.Repository\x20via\x20queryObjectsWithType.\x20Max\x20100\x20(MAX_REPOSITORY_COUNT).'},{'id':'P-S-08','pattern_name':'Manage\x20rewards\x20(add/remove/clear)','semantic_intent':'Bind\x20Reward\x20objects\x20for\x20marketing\x20incentives\x20(locked\x20by\x20setting_lock_duration)','match_keywords':['reward','incentive','marketing'],'schema_fields':['object','rewards'],'example_json':{'object':'0xSERVICE_ADDRESS','rewards':{'op':'add','objects':['0xREWARD_ADDRESS']}},'reverse_explanation':'Mutable\x20but\x20locked\x20by\x20setting_lock_duration\x20(F-S-24).\x20Cannot\x20be\x20removed\x20until\x20lock\x20expires.\x20Max\x2020\x20(MAX_REWARD_COUNT).'},{'id':'P-S-09','pattern_name':'Set\x20order_allocators','semantic_intent':'Configure\x20fund\x20distribution\x20strategy\x20(publish\x20prerequisite,\x20post-publish\x20immutable)','match_keywords':['allocator','order_allocators'],'schema_fields':['object','order_allocators'],'example_json':{'object':'0xSERVICE_ADDRESS','order_allocators':[{'threshold':'0','sharing':[{'who':{'Object':'0xOWNER'},'weight':0x50},{'who':{'Object':'0xPLATFORM'},'weight':0x14}]}]},'reverse_explanation':'MANDATORY\x20before\x20publish\x20(F-S-18,\x20E_NO_ALLOCATOR).\x20First-match-wins:\x20first\x20allocator\x20whose\x20threshold\x20<=\x20order\x20value\x20handles\x20distribution.\x20Post-publish\x20immutable\x20(F-S-22).'},{'id':'P-S-10','pattern_name':'Pause/resume\x20Service','semantic_intent':'Block\x20new\x20orders\x20(pause)\x20or\x20resume\x20accepting\x20orders','match_keywords':['pause','resume'],'schema_fields':['object','pause'],'example_json':{'object':'0xSERVICE_ADDRESS','pause':!![]},'reverse_explanation':'pause=true\x20blocks\x20new\x20orders\x20(E_SERVICE_PAUSED);\x20pause=false\x20resumes.\x20Existing\x20Progress\x20continues\x20normally.\x20compensation_fund_withdraw\x20requires\x20paused=true.'},{'id':'P-S-11','pattern_name':'Publish\x20Service\x20(IRREVERSIBLE)','semantic_intent':'Publish\x20Service\x20—\x20makes\x20it\x20buyable.\x20One-shot,\x20cannot\x20revert.','match_keywords':['publish','go\x20live','release'],'schema_fields':['object','publish'],'example_json':{'object':'0xSERVICE_ADDRESS','publish':!![]},'reverse_explanation':'⚠️\x20IRREVERSIBLE.\x20Requires\x20SERVICE_PUBLISH\x20(311)\x20permission.\x20Prerequisites:\x20order_allocators\x20set;\x20if\x20compensation_fund\x20>\x200,\x20arbitrations\x20non-empty.\x20Locks\x20machine/arbitrations/order_allocators\x20forever.'},{'id':'P-S-12','pattern_name':'Issue/destroy\x20discount\x20coupons','semantic_intent':'Issue\x20promotional\x20discount\x20coupons\x20or\x20destroy\x20(redeem)\x20them','match_keywords':['discount','coupon'],'schema_fields':['object','discount'],'example_json':{'object':'0xSERVICE_ADDRESS','discount':{'name':'SUMMER10','discount_type':0x0,'data':0x3e8,'count':0x64,'receivers':['0xUSER1','0xUSER2'],'expire_at':0x1941f297c00}},'reverse_explanation':'discount_type=0\x20rates\x20(basis\x20points,\x20per\x2010000),\x201=minus\x20(direct\x20deduction).\x20Max\x201000\x20per\x20call\x20(MAX_DISCOUNT_COUNT_ONCE),\x2020000\x20total\x20(MAX_DISCOUNT_TOTAL_COUNT).\x20discount_destroy\x20is\x20holder-only.'},{'id':'P-S-13','pattern_name':'Compensation\x20fund\x20operations\x20(add/withdraw/receive)','semantic_intent':'Deposit\x20to\x20compensation_fund,\x20withdraw\x20(locked),\x20or\x20receive\x20(locked)','match_keywords':['compensation_fund','compensation','deposit','withdraw'],'schema_fields':['object','compensation_fund_add','compensation_fund_withdraw','compensation_fund_receive'],'example_json':{'object':'0xSERVICE_ADDRESS','compensation_fund_add':{'balance':'1000000000'}},'reverse_explanation':'add=always\x20mutable;\x20withdraw/receive\x20locked\x20by\x20setting_lock_duration\x20AND\x20requires\x20bPaused=true.\x20Internal\x20Balance<T>,\x20distinct\x20from\x20Treasury.'},{'id':'P-S-14','pattern_name':'Extend\x20setting_lock_duration','semantic_intent':'Add\x20milliseconds\x20to\x20setting_lock_duration\x20(only-increase\x20mechanism)','match_keywords':['setting_lock_duration','lock_duration','lock\x20period','extend\x20lock'],'schema_fields':['object','setting_lock_duration_add'],'example_json':{'object':'0xSERVICE_ADDRESS','setting_lock_duration_add':0x9a7ec800},'reverse_explanation':'Only-increase\x20(safe_add).\x20Default\x202592000000ms\x20(30\x20days).\x20Affects\x20rewards/compensation_fund_withdraw/compensation_fund_receive\x20mutability\x20windows.'},{'id':'P-S-15','pattern_name':'Buy\x20(8-stage\x20composite\x20order\x20flow)','semantic_intent':'Customer\x20places\x20order\x20—\x20atomic\x20creation\x20of\x20Order\x20+\x20Allocation\x20+\x20Progress','match_keywords':['buy','order','purchase'],'schema_fields':['object','order_new'],'example_json':{'object':'0xSERVICE_ADDRESS','order_new':{'buy':{'items':[{'name':'standard','wip_hash':'abcd...64','count':0x1}],'discount':'0xDISCOUNT_ADDRESS','total_pay':'1000000000','passport':null},'order_required_info':{'name':'Alice','phone':'+86...'},'agents':['0xAGENT1'],'transfer':null}},'reverse_explanation':'8\x20stages:\x20pre_check\x20→\x20wip_verify\x20→\x20quote\x20(deducts\x20stock!)\x20→\x20create_order\x20→\x20create_allocation\x20→\x20create_progress\x20→\x20post_actions\x20→\x20return_result.\x20Stock\x20deduction\x20is\x20NOT\x20rolled\x20back\x20on\x20later\x20failure.'},{'id':'P-S-16','pattern_name':'Transfer\x20ownership\x20(IRREVERSIBLE)','semantic_intent':'Transfer\x20Service\x20ownership\x20to\x20a\x20new\x20address','match_keywords':['transfer','handover'],'schema_fields':['object','builder'],'example_json':{'object':'0xSERVICE_ADDRESS','builder':'0xNEW_OWNER'},'reverse_explanation':'⚠️\x20IRREVERSIBLE.\x20Original\x20owner\x20loses\x20ALL\x20control.\x20New\x20owner\x20inherits\x20permission,\x20compensation_fund,\x20all\x20bindings.\x20Export\x20JSON\x20before\x20transfer.'}];export const SCHEMA_TO_SEMANTIC_RULES=[{'element_type':'field','type_name':'object','semantic_explanation':'Service\x20object\x20address.\x20STRING=operate\x20existing;\x20null/omitted=create\x20new'},{'element_type':'field','type_name':'description','semantic_explanation':'Human-readable\x20Service\x20description.\x20Mutable\x20pre/post\x20publish.\x20Max\x204000\x20chars.'},{'element_type':'field','type_name':'location','semantic_explanation':'Geographic\x20location\x20of\x20the\x20service\x20(city/region).\x20Mutable.\x20Index\x20303\x20(SERVICE_LOCATION).'},{'element_type':'field','type_name':'customer_required','semantic_explanation':'String[]\x20of\x20field\x20names\x20buyers\x20must\x20provide\x20at\x20order\x20time\x20(e.g.\x20[\x27name\x27,\x27phone\x27]).\x20Mutable.\x20Index\x20309.'},{'element_type':'field','type_name':'sales','semantic_explanation':'Product\x20SKU\x20list.\x20op=add/set/remove/clear.\x20Each\x20sale\x20has\x20name/price/stock/wip/wip_hash.\x20Index\x20305\x20(SERVICE_SALES).'},{'element_type':'field','type_name':'machine','semantic_explanation':'Machine\x20workflow\x20template\x20binding.\x20⚠️\x20IMMUTABLE\x20post-publish\x20(F-S-20).\x20Index\x20306\x20(SERVICE_MACHINE).'},{'element_type':'field','type_name':'buy_guard','semantic_explanation':'Buyer\x20eligibility\x20Guard.\x20⚠️\x20UNUSUAL:\x20still\x20mutable\x20post-publish\x20(F-S-26\x20exception).\x20Index\x20307\x20(SERVICE_BUY_GUARD).'},{'element_type':'field','type_name':'arbitrations','semantic_explanation':'Arbitration\x20object\x20list.\x20Required\x20if\x20compensation_fund\x20>\x200.\x20⚠️\x20IMMUTABLE\x20post-publish\x20(F-S-21).\x20Index\x20308.'},{'element_type':'field','type_name':'repositories','semantic_explanation':'Repository\x20object\x20list.\x20Mutable.\x20Max\x20100\x20(MAX_REPOSITORY_COUNT).\x20Index\x20304\x20(SERVICE_REPOSITORY).'},{'element_type':'field','type_name':'rewards','semantic_explanation':'Reward\x20object\x20list.\x20Mutable\x20but\x20locked\x20by\x20setting_lock_duration\x20(F-S-24).\x20Max\x2020\x20(MAX_REWARD_COUNT).\x20Index\x20318.'},{'element_type':'field','type_name':'order_allocators','semantic_explanation':'Fund\x20distribution\x20strategy.\x20⚠️\x20MANDATORY\x20for\x20publish\x20(F-S-18).\x20IMMUTABLE\x20post-publish\x20(F-S-22).\x20Index\x20313.'},{'element_type':'field','type_name':'discount','semantic_explanation':'Discount\x20coupon\x20issuance.\x20discount_type=0\x20rates,\x201=minus.\x20Index\x20312\x20(SERVICE_DISCOUNT).'},{'element_type':'field','type_name':'pause','semantic_explanation':'true=pause\x20(block\x20new\x20orders);\x20false=resume.\x20Existing\x20Progress\x20unaffected.\x20Index\x20310\x20(SERVICE_PAUSE).'},{'element_type':'field','type_name':'publish','semantic_explanation':'⚠️\x20IRREVERSIBLE\x20one-shot.\x20Requires\x20prerequisites.\x20Locks\x203\x20fields\x20forever.\x20Index\x20311\x20(SERVICE_PUBLISH).'},{'element_type':'field','type_name':'compensation_fund_add','semantic_explanation':'Deposit\x20to\x20internal\x20Balance<T>.\x20Always\x20mutable.\x20Index\x20315.\x20Distinct\x20from\x20Treasury.'},{'element_type':'field','type_name':'compensation_fund_withdraw','semantic_explanation':'Withdraw\x20from\x20internal\x20Balance<T>.\x20Requires\x20bPaused=true\x20+\x20lock_duration\x20expired.\x20Index\x20314.\x20Locked\x20by\x20duration\x20(F-S-25).'},{'element_type':'field','type_name':'compensation_fund_receive','semantic_explanation':'Receive\x20compensation_fund\x20(for\x20arbitration\x20payouts).\x20Locked\x20by\x20setting_lock_duration.\x20Index\x20316.'},{'element_type':'field','type_name':'setting_lock_duration_add','semantic_explanation':'Extend\x20setting_lock_duration\x20(only-increase,\x20safe_add).\x20Index\x20317\x20(SERVICE_COMPENSATION_LOCK_DURATION_ADD).'},{'element_type':'field','type_name':'order_new','semantic_explanation':'Composite\x20buy\x20operation.\x20Triggers\x208-stage\x20flow:\x20pre_check\x20→\x20wip_verify\x20→\x20quote\x20→\x20create_order/allocation/progress\x20→\x20post_actions\x20→\x20return_result.'},{'element_type':'field','type_name':'builder','semantic_explanation':'Transfer\x20ownership.\x20⚠️\x20IRREVERSIBLE.\x20Original\x20owner\x20loses\x20ALL\x20control.'},{'element_type':'field','type_name':'um','semantic_explanation':'User\x20Manager\x20(Contact\x20object).\x20Mutable.\x20Index\x20320\x20(SERVICE_UM).'},{'element_type':'field','type_name':'owner_receive','semantic_explanation':'Receive\x20Payment/objects\x20to\x20owner.\x20Index\x20319\x20(SERVICE_OWNER_RECEIVE).'},{'element_type':'op','type_name':'add','semantic_explanation':'Append\x20new\x20items\x20(sales/arbitrations/repositories/rewards).\x20Additive,\x20does\x20not\x20replace.'},{'element_type':'op','type_name':'set','semantic_explanation':'Replace\x20existing\x20item\x20by\x20name\x20(sales)\x20or\x20replace\x20entire\x20list\x20(repositories/rewards/arbitrations).'},{'element_type':'op','type_name':'remove','semantic_explanation':'Remove\x20specific\x20items\x20by\x20name\x20(sales)\x20or\x20address\x20(repositories/rewards/arbitrations).'},{'element_type':'op','type_name':'clear','semantic_explanation':'Remove\x20all\x20items\x20from\x20the\x20list.'}];export const SERVICE_CONSTRAINT_RULES=[{'id':'MC-S-01','category':'structural','rule':'Service\x20builtin\x20permission\x20indexes\x20must\x20be\x20in\x20range\x20300-320\x20(302\x20reserved/commented)','applies_to':['permission\x20table.index\x20(when\x20applied\x20to\x20Service)']},{'id':'MC-S-02','category':'structural','rule':'sales\x20count\x20<=\x20MAX_SALE_COUNT\x20('+MAX_SALE_COUNT+')','applies_to':['sales.sales']},{'id':'MC-S-03','category':'structural','rule':'repositories\x20count\x20<=\x20MAX_REPOSITORY_COUNT\x20('+MAX_REPOSITORY_COUNT+')','applies_to':['repositories.objects']},{'id':'MC-S-04','category':'structural','rule':'arbitrations\x20count\x20<=\x20MAX_ARBITRATION_COUNT\x20('+MAX_ARBITRATION_COUNT+')','applies_to':['arbitrations.objects']},{'id':'MC-S-05','category':'structural','rule':'rewards\x20count\x20<=\x20MAX_REWARD_COUNT\x20(20)','applies_to':['rewards.objects']},{'id':'MC-S-06','category':'structural','rule':'customer_required\x20count\x20<=\x2010,\x20each\x20item\x20length\x20<=\x2020','applies_to':['customer_required']},{'id':'MC-S-07','category':'structural','rule':'wip\x20URL\x20length\x20<=\x20MAX_WIP_LENGTH\x20('+MAX_WIP_LENGTH+')','applies_to':['sales.sales[].wip']},{'id':'MC-S-08','category':'structural','rule':'wip_hash\x20length\x20<=\x20MAX_WIP_HASH_LENGTH\x20('+MAX_WIP_HASH_LENGTH+')\x20—\x20sha256\x20hex\x20(64\x20chars,\x20no\x20prefix)','applies_to':['sales.sales[].wip_hash','order_new.buy.items[].wip_hash']},{'id':'MC-S-09','category':'semantic','rule':'wip_hash\x20must\x20NOT\x20be\x20empty\x20when\x20wip\x20URL\x20is\x20set\x20(tamper\x20protection)','applies_to':['sales.sales[]']},{'id':'MC-S-10','category':'authority','rule':'publish\x20requires\x20order_allocators\x20set\x20(F-S-18,\x20E_NO_ALLOCATOR)','applies_to':['publish','order_allocators']},{'id':'MC-S-11','category':'authority','rule':'publish\x20with\x20compensation_fund\x20>\x200\x20requires\x20arbitrations\x20non-empty\x20(F-S-19,\x20E_ARBITRATION_NOT_SET_WITH_COMPENSATION_FUND)','applies_to':['publish','arbitrations','compensation_fund_add']},{'id':'MC-S-12','category':'lifecycle','rule':'machine\x20IMMUTABLE\x20post-publish\x20(F-S-20)\x20—\x20SDK\x20checkNotPublished()\x20blocks','applies_to':['machine']},{'id':'MC-S-13','category':'lifecycle','rule':'arbitrations\x20IMMUTABLE\x20post-publish\x20(F-S-21)\x20—\x20SDK\x20checkNotPublished()\x20blocks','applies_to':['arbitrations']},{'id':'MC-S-14','category':'lifecycle','rule':'order_allocators\x20IMMUTABLE\x20post-publish\x20(F-S-22)\x20—\x20SDK\x20checkNotPublished()\x20blocks','applies_to':['order_allocators']},{'id':'MC-S-15','category':'lifecycle','rule':'bPublished\x20is\x20IRREVERSIBLE\x20(one-shot,\x20cannot\x20revert\x20to\x20false)\x20—\x20to\x20\x27reset\x27,\x20create\x20new\x20Service','applies_to':['publish']},{'id':'MC-S-16','category':'lifecycle','rule':'setting_lock_duration\x20only-increase\x20(safe_add)\x20—\x20cannot\x20be\x20decreased;\x20protects\x20customers','applies_to':['setting_lock_duration_add']},{'id':'MC-S-17','category':'lifecycle','rule':'compensation_fund_withdraw\x20requires\x20bPaused=true\x20AND\x20setting_lock_duration\x20expired\x20(F-S-25,\x20F-S-26)','applies_to':['compensation_fund_withdraw','pause']},{'id':'MC-S-18','category':'semantic','rule':'discount\x20count\x20<=\x20MAX_DISCOUNT_TOTAL_COUNT\x20('+MAX_DISCOUNT_TOTAL_COUNT+');\x20per-call\x20<=\x20MAX_DISCOUNT_COUNT_ONCE\x20('+MAX_DISCOUNT_COUNT_ONCE+')','applies_to':['discount.count']},{'id':'MC-S-19','category':'semantic','rule':'buy_guard\x20is\x20the\x20ONLY\x20field\x20still\x20mutable\x20post-publish\x20(F-S-26\x20exception)\x20—\x20all\x20other\x20guarded\x20fields\x20are\x20immutable','applies_to':['buy_guard']},{'id':'MC-S-20','category':'authority','rule':'Ownership\x20transfer\x20(builder)\x20is\x20IRREVERSIBLE\x20—\x20new\x20owner\x20inherits\x20permission\x20+\x20compensation_fund\x20+\x20all\x20bindings','applies_to':['builder']}];export const SERVICE_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 explainServiceCallData(b){const c=[];b['object']===null||b['object']===undefined?c['push']('Operation:\x20CREATE\x20new\x20Service'):c['push']('Operation:\x20MODIFY\x20existing\x20Service\x20at\x20'+b['object']);if(b['description'])c['push']('-\x20Set\x20description:\x20\x22'+b['description']+'\x22');if(b['location'])c['push']('-\x20Set\x20location:\x20'+b['location']);if(b['customer_required'])c['push']('-\x20Customer\x20required\x20fields:\x20['+b['customer_required']['join'](',\x20')+']');if(b['sales']){const e=b['sales'];if(e['op']==='clear')c['push']('-\x20Sales:\x20CLEAR\x20all\x20items');else{if(e['op']==='remove')c['push']('-\x20Sales\x20REMOVE:\x20['+e['sales_name']['join'](',\x20')+']');else{c['push']('-\x20Sales\x20'+e['op']['toUpperCase']()+':\x20'+e['sales']['length']+'\x20item(s)');for(const f of e['sales']){const g=f['wip_hash']?'\x20hash='+f['wip_hash']['slice'](0x0,0x8)+'...':'\x20⚠️NO_HASH';c['push']('\x20\x20\x20\x20•\x20'+f['name']+'\x20price='+(f['price']??'?')+'\x20stock='+(f['stock']??'?')+g);}}}}b['machine']!==undefined&&c['push'](b['machine']===null?'-\x20Machine:\x20unbind\x20(pre-publish\x20only)':'-\x20Machine:\x20bind\x20'+b['machine']);b['buy_guard']!==undefined&&c['push'](b['buy_guard']===null?'-\x20Buy\x20Guard:\x20clear':'-\x20Buy\x20Guard:\x20set\x20'+b['buy_guard']+'\x20[mutable\x20post-publish]');if(b['arbitrations']){const h=b['arbitrations'];h['op']==='clear'?c['push']('-\x20Arbitrations:\x20CLEAR\x20(pre-publish\x20only)'):c['push']('-\x20Arbitrations\x20'+h['op']['toUpperCase']()+':\x20'+h['objects']['length']+'\x20object(s)');}if(b['repositories']){const i=b['repositories'];i['op']==='clear'?c['push']('-\x20Repositories:\x20CLEAR'):c['push']('-\x20Repositories\x20'+i['op']['toUpperCase']()+':\x20'+i['objects']['length']+'\x20object(s)');}if(b['rewards']){const j=b['rewards'];j['op']==='clear'?c['push']('-\x20Rewards:\x20CLEAR\x20(locked\x20by\x20duration)'):c['push']('-\x20Rewards\x20'+j['op']['toUpperCase']()+':\x20'+j['objects']['length']+'\x20object(s)\x20[locked\x20by\x20duration]');}b['order_allocators']!==undefined&&c['push']('-\x20Order\x20Allocators:\x20'+(b['order_allocators']?'configured':'(clear)')+'\x20[immutable\x20post-publish]');if(b['discount']){const k=b['discount'],l=k['discount_type']===0x0?'rates\x20(basis\x20points,\x20per\x2010000)':'minus\x20(direct\x20deduction)';c['push']('-\x20Discount:\x20'+k['name']+'\x20type='+l+'\x20data='+k['data']+'\x20count='+k['count']);}b['pause']!==undefined&&c['push']('-\x20Pause:\x20'+(b['pause']?'PAUSE\x20(block\x20new\x20orders)':'RESUME'));b['publish']&&c['push']('-\x20⚠️\x20PUBLISH\x20(IRREVERSIBLE\x20—\x20locks\x20machine/arbitrations/order_allocators\x20forever)');b['compensation_fund_add']&&c['push']('-\x20Compensation\x20fund\x20deposit:\x20'+b['compensation_fund_add']['balance']+'\x20(internal\x20Balance<T>)');b['compensation_fund_withdraw']&&c['push']('-\x20⚠️\x20Compensation\x20fund\x20withdraw\x20(requires\x20bPaused=true\x20+\x20lock_duration\x20expired)');b['compensation_fund_receive']&&c['push']('-\x20Compensation\x20fund\x20receive\x20(locked\x20by\x20duration)');b['setting_lock_duration_add']!==undefined&&c['push']('-\x20Setting\x20lock\x20duration\x20+'+b['setting_lock_duration_add']+'ms\x20(only-increase)');if(b['order_new']){const m=b['order_new'];c['push']('-\x20⚠️\x20ORDER\x20NEW\x20(8-stage\x20composite\x20flow):'),c['push']('\x20\x20\x20\x20Items:\x20'+m['buy']['items']['length']),c['push']('\x20\x20\x20\x20Total\x20pay:\x20'+m['buy']['total_pay']);if(m['buy']['discount'])c['push']('\x20\x20\x20\x20Discount:\x20'+m['buy']['discount']);c['push']('\x20\x20\x20\x20Stages:\x20pre_check\x20→\x20wip_verify\x20→\x20quote\x20(deducts\x20stock!)\x20→\x20create_order/allocation/progress\x20→\x20return');}return b['builder']&&c['push']('-\x20⚠️\x20TRANSFER\x20ownership\x20to\x20'+b['builder']+'\x20(IRREVERSIBLE)'),b['um']!==undefined&&c['push'](b['um']===null?'-\x20UM:\x20revoke':'-\x20UM:\x20set\x20to\x20'+b['um']),b['owner_receive']&&c['push']('-\x20Owner\x20receive:\x20receive\x20Payment/objects\x20to\x20owner'),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 getConstraintsByCategory(a){return SERVICE_CONSTRAINT_RULES['filter'](b=>b['category']===a);}export function explainServicePermissionIndex(a){if(isServicePermission(a)){const b=getServicePermissionByIndex(a);if(!b)return'Unknown\x20Service\x20permission\x20('+a+')';const c=b['post_publish_mutability']==='immutable'?'\x20[IMMUTABLE\x20post-publish]':b['post_publish_mutability']==='one_shot'?'\x20[ONE-SHOT,\x20irreversible]':b['post_publish_mutability']==='locked_by_duration'?'\x20[locked\x20by\x20setting_lock_duration]':'';return b['name']+'\x20('+a+')\x20—\x20'+b['description']+c;}return'Non-Service\x20permission\x20('+a+')\x20—\x20verify\x20against\x20host\x20object\x27s\x20index\x20range';}