@wowok/agent-mcp 3.1.2 → 3.1.4

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 (544) hide show
  1. package/dist/config/config-audit.spec.d.ts +1 -0
  2. package/dist/config/config-audit.spec.js +1 -0
  3. package/dist/config/exposure.d.ts +108 -0
  4. package/dist/config/exposure.js +1 -0
  5. package/dist/config/index.d.ts +2 -0
  6. package/dist/config/index.js +1 -1
  7. package/dist/config/judgment.d.ts +1228 -0
  8. package/dist/config/judgment.js +1 -0
  9. package/dist/config/judgment.spec.d.ts +1 -0
  10. package/dist/config/judgment.spec.js +1 -0
  11. package/dist/config/rule-engine.d.ts +299 -0
  12. package/dist/config/rule-engine.js +1 -0
  13. package/dist/config/rule-engine.spec.d.ts +1 -0
  14. package/dist/config/rule-engine.spec.js +1 -0
  15. package/dist/config/runtime.js +1 -1
  16. package/dist/config/severity.d.ts +7 -0
  17. package/dist/config/severity.js +1 -0
  18. package/dist/customer/index.d.ts +3 -9
  19. package/dist/customer/index.js +1 -1
  20. package/dist/customer/industry-risks.d.ts +3 -17
  21. package/dist/customer/industry-risks.js +1 -1
  22. package/dist/customer/order-monitor.d.ts +3 -1
  23. package/dist/customer/order-monitor.js +1 -1
  24. package/dist/customer/types.d.ts +1 -165
  25. package/dist/customer/types.js +1 -1
  26. package/dist/customer/user-preferences.d.ts +0 -49
  27. package/dist/customer/user-preferences.js +1 -1
  28. package/dist/evaluation/acceptance.d.ts +1 -0
  29. package/dist/evaluation/acceptance.js +1 -1
  30. package/dist/evaluation/arbitration-game.js +1 -1
  31. package/dist/evaluation/architecture.spec.d.ts +1 -0
  32. package/dist/evaluation/architecture.spec.js +1 -0
  33. package/dist/evaluation/builtins/demand-match.js +1 -1
  34. package/dist/evaluation/builtins/graph-service.d.ts +16 -0
  35. package/dist/evaluation/builtins/graph-service.js +1 -0
  36. package/dist/evaluation/builtins/graph-service.spec.d.ts +1 -0
  37. package/dist/evaluation/builtins/graph-service.spec.js +1 -0
  38. package/dist/evaluation/builtins/index.d.ts +1 -1
  39. package/dist/evaluation/builtins/index.js +1 -1
  40. package/dist/evaluation/builtins/purity.spec.d.ts +1 -0
  41. package/dist/evaluation/builtins/purity.spec.js +1 -0
  42. package/dist/evaluation/engine.js +1 -1
  43. package/dist/evaluation/facets/catalog.d.ts +19 -0
  44. package/dist/evaluation/facets/catalog.js +1 -0
  45. package/dist/evaluation/game-strategy.d.ts +2 -2
  46. package/dist/evaluation/game-strategy.js +1 -1
  47. package/dist/evaluation/guard-scan.d.ts +10 -0
  48. package/dist/evaluation/guard-scan.js +1 -0
  49. package/dist/evaluation/match-operation.d.ts +2 -2
  50. package/dist/evaluation/match-operation.js +1 -1
  51. package/dist/evaluation/standards.d.ts +9 -0
  52. package/dist/evaluation/standards.js +1 -0
  53. package/dist/evaluation/standards.spec.d.ts +1 -0
  54. package/dist/evaluation/standards.spec.js +1 -0
  55. package/dist/evaluation/types.d.ts +11 -1
  56. package/dist/experience/realtime-feedback.js +1 -1
  57. package/dist/extensions/business-modules.js +1 -1
  58. package/dist/extensions/custom-registry-file.js +1 -1
  59. package/dist/extensions/index.d.ts +1 -1
  60. package/dist/extensions/index.js +1 -1
  61. package/dist/extensions/industry-audit.spec.d.ts +1 -0
  62. package/dist/extensions/industry-audit.spec.js +1 -0
  63. package/dist/extensions/industry-layers.d.ts +14 -5
  64. package/dist/extensions/industry-layers.js +1 -1
  65. package/dist/extensions/industry-pack.d.ts +2 -0
  66. package/dist/extensions/industry-pack.js +1 -1
  67. package/dist/extensions/mode-evaluator.js +1 -1
  68. package/dist/extensions/modes.js +1 -1
  69. package/dist/graph/onchain/analyze.d.ts +16 -1
  70. package/dist/graph/onchain/analyze.js +1 -1
  71. package/dist/graph/onchain/analyze.spec.js +1 -1
  72. package/dist/graph/onchain/dataplane.d.ts +1 -1
  73. package/dist/graph/onchain/dataplane.js +1 -1
  74. package/dist/graph/onchain/edge-batch.spec.d.ts +1 -0
  75. package/dist/graph/onchain/edge-batch.spec.js +1 -0
  76. package/dist/graph/onchain/edge-schema.d.ts +11 -2
  77. package/dist/graph/onchain/edge-schema.js +1 -1
  78. package/dist/graph/onchain/entity-profile.spec.d.ts +1 -0
  79. package/dist/graph/onchain/entity-profile.spec.js +1 -0
  80. package/dist/graph/onchain/event-history.spec.d.ts +1 -0
  81. package/dist/graph/onchain/event-history.spec.js +1 -0
  82. package/dist/graph/onchain/expand.js +1 -1
  83. package/dist/graph/onchain/exploration.d.ts +28 -0
  84. package/dist/graph/onchain/exploration.js +1 -0
  85. package/dist/graph/onchain/exploration.spec.d.ts +1 -0
  86. package/dist/graph/onchain/exploration.spec.js +1 -0
  87. package/dist/graph/onchain/exposure.d.ts +18 -0
  88. package/dist/graph/onchain/exposure.js +1 -0
  89. package/dist/graph/onchain/exposure.spec.d.ts +1 -0
  90. package/dist/graph/onchain/exposure.spec.js +1 -0
  91. package/dist/graph/onchain/extract-deep.spec.d.ts +1 -0
  92. package/dist/graph/onchain/extract-deep.spec.js +1 -0
  93. package/dist/graph/onchain/extract.d.ts +11 -3
  94. package/dist/graph/onchain/extract.js +1 -1
  95. package/dist/graph/onchain/facet-projection.d.ts +99 -0
  96. package/dist/graph/onchain/facet-projection.js +1 -0
  97. package/dist/graph/onchain/facet-projection.spec.d.ts +1 -0
  98. package/dist/graph/onchain/facet-projection.spec.js +1 -0
  99. package/dist/graph/onchain/facts.d.ts +103 -0
  100. package/dist/graph/onchain/facts.js +1 -0
  101. package/dist/graph/onchain/facts.spec.d.ts +1 -0
  102. package/dist/graph/onchain/facts.spec.js +1 -0
  103. package/dist/graph/onchain/field-manifest.d.ts +29 -0
  104. package/dist/graph/onchain/field-manifest.js +1 -0
  105. package/dist/graph/onchain/field-manifest.spec.d.ts +1 -0
  106. package/dist/graph/onchain/field-manifest.spec.js +1 -0
  107. package/dist/graph/onchain/fixtures.d.ts +80 -0
  108. package/dist/graph/onchain/fixtures.js +1 -0
  109. package/dist/graph/onchain/fixtures.spec.d.ts +1 -0
  110. package/dist/graph/onchain/fixtures.spec.js +1 -0
  111. package/dist/graph/onchain/graph-policy.spec.d.ts +1 -0
  112. package/dist/graph/onchain/graph-policy.spec.js +1 -0
  113. package/dist/graph/onchain/index.d.ts +14 -2
  114. package/dist/graph/onchain/index.js +1 -1
  115. package/dist/graph/onchain/interest.js +1 -1
  116. package/dist/graph/onchain/interest.spec.js +1 -1
  117. package/dist/graph/onchain/label-lint.spec.d.ts +1 -0
  118. package/dist/graph/onchain/label-lint.spec.js +1 -0
  119. package/dist/graph/onchain/names.d.ts +23 -0
  120. package/dist/graph/onchain/names.js +1 -0
  121. package/dist/graph/onchain/names.spec.d.ts +1 -0
  122. package/dist/graph/onchain/names.spec.js +1 -0
  123. package/dist/graph/onchain/onchain.spec.js +1 -1
  124. package/dist/graph/onchain/policy.d.ts +8 -0
  125. package/dist/graph/onchain/policy.js +1 -0
  126. package/dist/graph/onchain/proposal-graph.d.ts +11 -0
  127. package/dist/graph/onchain/proposal-graph.js +1 -0
  128. package/dist/graph/onchain/proposal-graph.spec.d.ts +1 -0
  129. package/dist/graph/onchain/proposal-graph.spec.js +1 -0
  130. package/dist/graph/onchain/sdk-batch.d.ts +5 -1
  131. package/dist/graph/onchain/sdk-batch.js +1 -1
  132. package/dist/graph/onchain/strategy.d.ts +16 -0
  133. package/dist/graph/onchain/strategy.js +1 -1
  134. package/dist/graph/onchain/strategy.spec.js +1 -1
  135. package/dist/graph/onchain/synthesis.d.ts +20 -0
  136. package/dist/graph/onchain/synthesis.js +1 -0
  137. package/dist/graph/onchain/synthesis.spec.d.ts +1 -0
  138. package/dist/graph/onchain/synthesis.spec.js +1 -0
  139. package/dist/graph/onchain/table-ledger.spec.d.ts +1 -0
  140. package/dist/graph/onchain/table-ledger.spec.js +1 -0
  141. package/dist/graph/onchain/types.d.ts +57 -7
  142. package/dist/graph/onchain/viewport.d.ts +1 -0
  143. package/dist/graph/onchain/viewport.js +1 -1
  144. package/dist/harness/index.d.ts +1 -5
  145. package/dist/harness/index.js +1 -1
  146. package/dist/harness/verify.d.ts +6 -1
  147. package/dist/harness/verify.js +1 -1
  148. package/dist/index.js +1 -1
  149. package/dist/keeper/keeper.spec.js +1 -1
  150. package/dist/knowledge/alloc-audit-policy.spec.d.ts +1 -0
  151. package/dist/knowledge/alloc-audit-policy.spec.js +1 -0
  152. package/dist/knowledge/allocation-ledger.js +1 -1
  153. package/dist/knowledge/allocation-puzzle.d.ts +1 -1
  154. package/dist/knowledge/allocation-puzzle.js +1 -1
  155. package/dist/knowledge/allocation-risk.d.ts +4 -3
  156. package/dist/knowledge/allocation-risk.js +1 -1
  157. package/dist/knowledge/allocation-templates.js +1 -1
  158. package/dist/knowledge/arb-risk.d.ts +6 -6
  159. package/dist/knowledge/arb-risk.js +1 -1
  160. package/dist/knowledge/arbitration-ledger.d.ts +4 -4
  161. package/dist/knowledge/arbitration-ledger.js +1 -1
  162. package/dist/knowledge/arbitration-puzzle.d.ts +1 -1
  163. package/dist/knowledge/arbitration-puzzle.js +1 -1
  164. package/dist/knowledge/arbitration-risk.d.ts +4 -3
  165. package/dist/knowledge/arbitration-risk.js +1 -1
  166. package/dist/knowledge/arbitration-templates.js +1 -1
  167. package/dist/knowledge/baselines/guard-lint-baseline.spec.d.ts +1 -0
  168. package/dist/knowledge/baselines/guard-lint-baseline.spec.js +1 -0
  169. package/dist/knowledge/baselines/judgment-baselines.json +289 -0
  170. package/dist/knowledge/baselines/risk-baselines.spec.d.ts +1 -0
  171. package/dist/knowledge/baselines/risk-baselines.spec.js +1 -0
  172. package/dist/knowledge/baselines/risk-cases.d.ts +8 -0
  173. package/dist/knowledge/baselines/risk-cases.js +1 -0
  174. package/dist/knowledge/baselines/rules/alloc_audit.json +290 -0
  175. package/dist/knowledge/baselines/rules/allocation.json +492 -0
  176. package/dist/knowledge/baselines/rules/arb.json +155 -0
  177. package/dist/knowledge/baselines/rules/arbitration.json +366 -0
  178. package/dist/knowledge/baselines/rules/bridge.json +197 -0
  179. package/dist/knowledge/baselines/rules/contact.json +152 -0
  180. package/dist/knowledge/baselines/rules/demand.json +158 -0
  181. package/dist/knowledge/baselines/rules/graph.json +453 -0
  182. package/dist/knowledge/baselines/rules/guard.json +981 -0
  183. package/dist/knowledge/baselines/rules/machine.json +706 -0
  184. package/dist/knowledge/baselines/rules/order.json +549 -0
  185. package/dist/knowledge/baselines/rules/payment.json +205 -0
  186. package/dist/knowledge/baselines/rules/permission.json +330 -0
  187. package/dist/knowledge/baselines/rules/personal.json +139 -0
  188. package/dist/knowledge/baselines/rules/progress.json +346 -0
  189. package/dist/knowledge/baselines/rules/proof.json +158 -0
  190. package/dist/knowledge/baselines/rules/registrar.json +159 -0
  191. package/dist/knowledge/baselines/rules/repository.json +244 -0
  192. package/dist/knowledge/baselines/rules/resource.json +117 -0
  193. package/dist/knowledge/baselines/rules/reward.json +471 -0
  194. package/dist/knowledge/baselines/rules/service.json +595 -0
  195. package/dist/knowledge/baselines/rules/treasury.json +440 -0
  196. package/dist/knowledge/baselines/rules/util.json +101 -0
  197. package/dist/knowledge/bridge-risk.d.ts +6 -6
  198. package/dist/knowledge/bridge-risk.js +1 -1
  199. package/dist/knowledge/builtin-templates.d.ts +26 -0
  200. package/dist/knowledge/builtin-templates.js +1 -0
  201. package/dist/knowledge/contact-risk.d.ts +6 -6
  202. package/dist/knowledge/contact-risk.js +1 -1
  203. package/dist/knowledge/contract-invariants.d.ts +1 -0
  204. package/dist/knowledge/contract-invariants.js +1 -1
  205. package/dist/knowledge/demand-risk.d.ts +6 -6
  206. package/dist/knowledge/demand-risk.js +1 -1
  207. package/dist/knowledge/event-semantics.js +1 -1
  208. package/dist/knowledge/facts-sync.spec.d.ts +1 -0
  209. package/dist/knowledge/facts-sync.spec.js +1 -0
  210. package/dist/knowledge/getting-started.js +1 -1
  211. package/dist/knowledge/guard-design-patterns.js +1 -1
  212. package/dist/knowledge/guard-eval.d.ts +15 -0
  213. package/dist/knowledge/guard-eval.js +1 -0
  214. package/dist/knowledge/guard-eval.spec.d.ts +1 -0
  215. package/dist/knowledge/guard-eval.spec.js +1 -0
  216. package/dist/knowledge/guard-field-cognition.d.ts +1 -1
  217. package/dist/knowledge/guard-field-cognition.js +1 -1
  218. package/dist/knowledge/guard-ledger.js +1 -1
  219. package/dist/knowledge/guard-lint.d.ts +1 -1
  220. package/dist/knowledge/guard-lint.js +1 -1
  221. package/dist/knowledge/guard-risk.d.ts +7 -19
  222. package/dist/knowledge/guard-risk.js +1 -1
  223. package/dist/knowledge/guard-templates.js +1 -1
  224. package/dist/knowledge/guard-translation.js +1 -1
  225. package/dist/knowledge/index.d.ts +51 -45
  226. package/dist/knowledge/index.js +1 -1
  227. package/dist/knowledge/industry-registry.js +1 -1
  228. package/dist/knowledge/industry-rule-node.d.ts +7 -0
  229. package/dist/knowledge/industry-rule-node.js +1 -0
  230. package/dist/knowledge/industry-strategy.js +1 -1
  231. package/dist/knowledge/jsonrpc-enum.js +1 -1
  232. package/dist/knowledge/machine-ledger.js +1 -1
  233. package/dist/knowledge/machine-risk.d.ts +4 -7
  234. package/dist/knowledge/machine-risk.js +1 -1
  235. package/dist/knowledge/machine-templates.js +1 -1
  236. package/dist/knowledge/machine-translation.js +1 -1
  237. package/dist/knowledge/migration-preflight.js +1 -1
  238. package/dist/knowledge/operation-dictionary.js +1 -1
  239. package/dist/knowledge/order-ledger.js +1 -1
  240. package/dist/knowledge/order-puzzle.d.ts +3 -3
  241. package/dist/knowledge/order-puzzle.js +1 -1
  242. package/dist/knowledge/order-risk.d.ts +7 -12
  243. package/dist/knowledge/order-risk.js +1 -1
  244. package/dist/knowledge/order-templates.js +1 -1
  245. package/dist/knowledge/passport-ledger.js +1 -1
  246. package/dist/knowledge/passport-templates.js +1 -1
  247. package/dist/knowledge/payment-risk.d.ts +8 -7
  248. package/dist/knowledge/payment-risk.js +1 -1
  249. package/dist/knowledge/payment-tracker.js +1 -1
  250. package/dist/knowledge/permission-ledger.js +1 -1
  251. package/dist/knowledge/permission-puzzle.d.ts +12 -12
  252. package/dist/knowledge/permission-puzzle.js +1 -1
  253. package/dist/knowledge/permission-risk.d.ts +4 -10
  254. package/dist/knowledge/permission-risk.js +1 -1
  255. package/dist/knowledge/permission-templates.js +1 -1
  256. package/dist/knowledge/personal-risk.d.ts +6 -6
  257. package/dist/knowledge/personal-risk.js +1 -1
  258. package/dist/knowledge/progress-ledger.js +1 -1
  259. package/dist/knowledge/progress-puzzle.d.ts +2 -2
  260. package/dist/knowledge/progress-puzzle.js +1 -1
  261. package/dist/knowledge/progress-risk.d.ts +4 -3
  262. package/dist/knowledge/progress-risk.js +1 -1
  263. package/dist/knowledge/progress-templates.js +1 -1
  264. package/dist/knowledge/proof-risk.d.ts +6 -6
  265. package/dist/knowledge/proof-risk.js +1 -1
  266. package/dist/knowledge/puzzle-projections.d.ts +11 -0
  267. package/dist/knowledge/puzzle-projections.js +1 -0
  268. package/dist/knowledge/recipient-constraint.d.ts +20 -1
  269. package/dist/knowledge/recipient-constraint.js +1 -1
  270. package/dist/knowledge/registrar-risk.d.ts +6 -6
  271. package/dist/knowledge/registrar-risk.js +1 -1
  272. package/dist/knowledge/repository-risk.d.ts +7 -7
  273. package/dist/knowledge/repository-risk.js +1 -1
  274. package/dist/knowledge/resource-risk.d.ts +6 -6
  275. package/dist/knowledge/resource-risk.js +1 -1
  276. package/dist/knowledge/reward-ledger.d.ts +1 -1
  277. package/dist/knowledge/reward-ledger.js +1 -1
  278. package/dist/knowledge/reward-puzzle.d.ts +2 -2
  279. package/dist/knowledge/reward-puzzle.js +1 -1
  280. package/dist/knowledge/reward-risk.d.ts +5 -6
  281. package/dist/knowledge/reward-risk.js +1 -1
  282. package/dist/knowledge/rule-node-analyzers.d.ts +43 -0
  283. package/dist/knowledge/rule-node-analyzers.js +1 -0
  284. package/dist/knowledge/rule-node-analyzers.spec.d.ts +1 -0
  285. package/dist/knowledge/rule-node-analyzers.spec.js +1 -0
  286. package/dist/knowledge/rule-outcome.d.ts +5 -0
  287. package/dist/knowledge/rule-outcome.js +1 -0
  288. package/dist/knowledge/safety-rules.js +1 -1
  289. package/dist/knowledge/scenario-modes.d.ts +2 -2
  290. package/dist/knowledge/scenario-modes.js +1 -1
  291. package/dist/knowledge/scenario-topology.js +1 -1
  292. package/dist/knowledge/service-allocator-audit-node.js +1 -1
  293. package/dist/knowledge/service-ledger.js +1 -1
  294. package/dist/knowledge/service-puzzle.d.ts +2 -2
  295. package/dist/knowledge/service-puzzle.js +1 -1
  296. package/dist/knowledge/service-risk-node.js +1 -1
  297. package/dist/knowledge/service-risk.d.ts +4 -4
  298. package/dist/knowledge/service-risk.js +1 -1
  299. package/dist/knowledge/service-templates.js +1 -1
  300. package/dist/knowledge/strategy-manuals.d.ts +1 -1
  301. package/dist/knowledge/strategy-manuals.js +1 -1
  302. package/dist/knowledge/template-loader.d.ts +84 -0
  303. package/dist/knowledge/template-loader.js +1 -0
  304. package/dist/knowledge/template-loader.spec.d.ts +1 -0
  305. package/dist/knowledge/template-loader.spec.js +1 -0
  306. package/dist/knowledge/template-registry.js +1 -1
  307. package/dist/knowledge/template-scanner.d.ts +17 -0
  308. package/dist/knowledge/template-scanner.js +1 -0
  309. package/dist/knowledge/template-scanner.spec.d.ts +1 -0
  310. package/dist/knowledge/template-scanner.spec.js +1 -0
  311. package/dist/knowledge/tools-reference.js +1 -1
  312. package/dist/knowledge/treasury-ledger.d.ts +1 -1
  313. package/dist/knowledge/treasury-ledger.js +1 -1
  314. package/dist/knowledge/treasury-puzzle.d.ts +3 -3
  315. package/dist/knowledge/treasury-puzzle.js +1 -1
  316. package/dist/knowledge/treasury-risk.d.ts +6 -4
  317. package/dist/knowledge/treasury-risk.js +1 -1
  318. package/dist/knowledge/treasury-templates.js +1 -1
  319. package/dist/knowledge/util-risk.d.ts +6 -6
  320. package/dist/knowledge/util-risk.js +1 -1
  321. package/dist/knowledge/workflow-guidance.d.ts +4 -0
  322. package/dist/knowledge/workflow-guidance.js +1 -1
  323. package/dist/knowledge/workspace-lists.js +1 -1
  324. package/dist/monitor/MonitorLoop.js +1 -1
  325. package/dist/participation/arbitrator-interest.js +1 -1
  326. package/dist/participation/radar-core.js +1 -1
  327. package/dist/persona/analyzer.js +1 -1
  328. package/dist/persona/bridge.js +1 -1
  329. package/dist/persona/facet-profile.d.ts +33 -0
  330. package/dist/persona/facet-profile.js +1 -0
  331. package/dist/persona/index.js +1 -1
  332. package/dist/persona/model.d.ts +2 -1
  333. package/dist/persona/model.js +1 -1
  334. package/dist/persona/persona-audit.spec.d.ts +1 -0
  335. package/dist/persona/persona-audit.spec.js +1 -0
  336. package/dist/persona/topology-focus.d.ts +2 -2
  337. package/dist/persona/topology-focus.js +1 -1
  338. package/dist/persona/types.d.ts +14 -0
  339. package/dist/playbooks/service-build/business-puzzle.js +1 -1
  340. package/dist/playbooks/service-build/facet-money.d.ts +33 -0
  341. package/dist/playbooks/service-build/facet-money.js +1 -0
  342. package/dist/playbooks/service-build/facet-money.spec.d.ts +1 -0
  343. package/dist/playbooks/service-build/facet-money.spec.js +1 -0
  344. package/dist/playbooks/service-build/machine-panorama.d.ts +20 -0
  345. package/dist/playbooks/service-build/machine-panorama.js +1 -1
  346. package/dist/playbooks/service-build/merchant-guide.d.ts +2 -2
  347. package/dist/playbooks/service-build/migration-planner.d.ts +43 -0
  348. package/dist/playbooks/service-build/migration-planner.js +1 -0
  349. package/dist/playbooks/service-build/object-panorama.d.ts +65 -24
  350. package/dist/playbooks/service-build/object-panorama.js +1 -1
  351. package/dist/playbooks/service-build/participation-radar.js +1 -1
  352. package/dist/playbooks/service-build/pipeline-actions.d.ts +3 -3
  353. package/dist/playbooks/service-build/pipeline-actions.js +1 -1
  354. package/dist/playbooks/service-build/reverse-mapping.d.ts +1 -0
  355. package/dist/playbooks/service-build/reverse-mapping.js +1 -1
  356. package/dist/playbooks/service-build/risk-aggregator.d.ts +4 -2
  357. package/dist/playbooks/service-build/risk-aggregator.js +1 -1
  358. package/dist/playbooks/service-build/semantic-graph.js +1 -1
  359. package/dist/playbooks/service-build/service-panorama.d.ts +56 -9
  360. package/dist/playbooks/service-build/service-panorama.js +1 -1
  361. package/dist/playbooks/service-build/topology-evaluation.spec.d.ts +1 -0
  362. package/dist/playbooks/service-build/topology-evaluation.spec.js +1 -0
  363. package/dist/playbooks/service-build/topology-query.d.ts +13 -2
  364. package/dist/playbooks/service-build/topology-query.js +1 -1
  365. package/dist/playbooks/service-build/workflow-design-assessment.d.ts +2 -2
  366. package/dist/playbooks/service-build/workflow-design-assessment.js +1 -1
  367. package/dist/relationship/registry.js +1 -1
  368. package/dist/review/arb.d.ts +0 -2
  369. package/dist/review/arb.js +1 -1
  370. package/dist/review/machine.js +1 -1
  371. package/dist/review/order.d.ts +0 -1
  372. package/dist/review/order.js +1 -1
  373. package/dist/review/service.js +1 -1
  374. package/dist/review/types.d.ts +7 -0
  375. package/dist/role/profiles.js +1 -1
  376. package/dist/rules.d.ts +1 -2
  377. package/dist/rules.js +1 -1
  378. package/dist/safety/confirm-gate.js +1 -1
  379. package/dist/schema/benchmark-migration/index.d.ts +207 -0
  380. package/dist/schema/benchmark-migration/index.js +1 -0
  381. package/dist/schema/call/allocation.d.ts +1 -1
  382. package/dist/schema/call/allocation.js +1 -1
  383. package/dist/schema/call/arbitration.d.ts +1 -1
  384. package/dist/schema/call/arbitration.js +1 -1
  385. package/dist/schema/call/base.d.ts +3374 -670
  386. package/dist/schema/call/base.js +1 -1
  387. package/dist/schema/call/contact.d.ts +1 -1
  388. package/dist/schema/call/demand.d.ts +1 -1
  389. package/dist/schema/call/guard.d.ts +3 -3
  390. package/dist/schema/call/handler.js +1 -1
  391. package/dist/schema/call/machine.d.ts +5 -5
  392. package/dist/schema/call/order.d.ts +3 -3
  393. package/dist/schema/call/payment.js +1 -1
  394. package/dist/schema/call/permission-handler.d.ts +1 -1
  395. package/dist/schema/call/permission-handler.js +1 -1
  396. package/dist/schema/call/permission.d.ts +16 -16
  397. package/dist/schema/call/permission.js +1 -1
  398. package/dist/schema/call/personal.d.ts +8 -8
  399. package/dist/schema/call/personal.js +1 -1
  400. package/dist/schema/call/progress.d.ts +3 -3
  401. package/dist/schema/call/receipt.d.ts +28 -0
  402. package/dist/schema/call/receipt.js +1 -0
  403. package/dist/schema/call/repository.d.ts +11 -11
  404. package/dist/schema/call/repository.js +1 -1
  405. package/dist/schema/call/reward.d.ts +1 -1
  406. package/dist/schema/call/semantic-customer-advice.spec.d.ts +1 -0
  407. package/dist/schema/call/semantic-customer-advice.spec.js +1 -0
  408. package/dist/schema/call/semantic.d.ts +5 -2
  409. package/dist/schema/call/semantic.js +1 -1
  410. package/dist/schema/call/service.d.ts +7 -7
  411. package/dist/schema/call/service.js +1 -1
  412. package/dist/schema/call/treasury.d.ts +1 -1
  413. package/dist/schema/call/treasury.js +1 -1
  414. package/dist/schema/common/index.d.ts +6 -6
  415. package/dist/schema/common/index.js +1 -1
  416. package/dist/schema/config/index.d.ts +50 -1
  417. package/dist/schema/config/index.js +1 -1
  418. package/dist/schema/evaluation/index.d.ts +307 -213
  419. package/dist/schema/evaluation/index.js +1 -1
  420. package/dist/schema/goal/index.d.ts +6 -6
  421. package/dist/schema/goal/planning.d.ts +17 -17
  422. package/dist/schema/goal/planning.js +1 -1
  423. package/dist/schema/index.d.ts +1 -1
  424. package/dist/schema/index.js +1 -1
  425. package/dist/schema/industry-pack/index.d.ts +1 -1
  426. package/dist/schema/interaction/index.d.ts +1 -1
  427. package/dist/schema/keeper/index.d.ts +1 -1
  428. package/dist/schema/local/index.js +1 -1
  429. package/dist/schema/messenger/index.d.ts +26 -26
  430. package/dist/schema/operations.d.ts +59 -43
  431. package/dist/schema/operations.js +1 -1
  432. package/dist/schema/persona/index.d.ts +4732 -24
  433. package/dist/schema/persona/index.js +1 -1
  434. package/dist/schema/query/bi.d.ts +830 -10
  435. package/dist/schema/query/bi.js +1 -1
  436. package/dist/schema/query/index.d.ts +44 -44
  437. package/dist/schema/query/index.js +1 -1
  438. package/dist/schema/schema-version.js +1 -1
  439. package/dist/schema/workflow/index.d.ts +1 -1
  440. package/dist/schema/workspace/index.d.ts +2 -2
  441. package/dist/schema-query-impl/index.d.ts +9 -0
  442. package/dist/schema-query-impl/index.js +1 -1
  443. package/dist/schemas/account_operation.output.json +1 -1
  444. package/dist/schemas/benchmark_migration_operation.output.json +793 -0
  445. package/dist/schemas/benchmark_migration_operation.schema.json +83 -0
  446. package/dist/schemas/bridge_operation.output.json +1 -1
  447. package/dist/schemas/bridge_operation.schema.json +5 -5
  448. package/dist/schemas/config_operation.output.json +252 -0
  449. package/dist/schemas/config_operation.schema.json +21 -1
  450. package/dist/schemas/evaluation_operation.output.json +702 -162
  451. package/dist/schemas/evaluation_operation.schema.json +0 -429
  452. package/dist/schemas/goal_operation.schema.json +8 -8
  453. package/dist/schemas/guard2file.schema.json +1 -1
  454. package/dist/schemas/index.json +7 -7
  455. package/dist/schemas/keeper_operation.output.json +1 -1
  456. package/dist/schemas/local_history_operation.output.json +1 -1
  457. package/dist/schemas/local_info_operation.output.json +1 -1
  458. package/dist/schemas/local_mark_operation.output.json +1 -1
  459. package/dist/schemas/machineNode2file.schema.json +1 -1
  460. package/dist/schemas/messenger_operation.output.json +1 -1
  461. package/dist/schemas/messenger_operation.schema.json +24 -12
  462. package/dist/schemas/monitor_events.output.json +1 -1
  463. package/dist/schemas/monitor_subscription.output.json +1 -1
  464. package/dist/schemas/onchain_events.output.json +2 -2
  465. package/dist/schemas/onchain_operations.output.json +6359 -3724
  466. package/dist/schemas/onchain_operations.schema.json +191 -141
  467. package/dist/schemas/onchain_operations_allocation.schema.json +13 -11
  468. package/dist/schemas/onchain_operations_arbitration.schema.json +10 -8
  469. package/dist/schemas/onchain_operations_contact.schema.json +7 -5
  470. package/dist/schemas/onchain_operations_demand.schema.json +7 -5
  471. package/dist/schemas/onchain_operations_gen_passport.schema.json +5 -3
  472. package/dist/schemas/onchain_operations_gen_proof.schema.json +1 -1
  473. package/dist/schemas/onchain_operations_guard.schema.json +5 -3
  474. package/dist/schemas/onchain_operations_machine.schema.json +22 -18
  475. package/dist/schemas/onchain_operations_order.schema.json +11 -7
  476. package/dist/schemas/onchain_operations_payment.schema.json +3 -3
  477. package/dist/schemas/onchain_operations_permission.schema.json +19 -11
  478. package/dist/schemas/onchain_operations_personal.schema.json +16 -10
  479. package/dist/schemas/onchain_operations_progress.schema.json +11 -7
  480. package/dist/schemas/onchain_operations_proof.schema.json +5 -3
  481. package/dist/schemas/onchain_operations_repository.schema.json +12 -8
  482. package/dist/schemas/onchain_operations_reward.schema.json +11 -9
  483. package/dist/schemas/onchain_operations_service.schema.json +28 -22
  484. package/dist/schemas/onchain_operations_treasury.schema.json +13 -11
  485. package/dist/schemas/onchain_table_data.output.json +88 -88
  486. package/dist/schemas/persona_operation.output.json +15875 -1
  487. package/dist/schemas/persona_operation.schema.json +3056 -478
  488. package/dist/schemas/query_toolkit.output.json +1325 -212
  489. package/dist/schemas/query_toolkit.schema.json +60 -2
  490. package/dist/schemas/workflow_operation.schema.json +4 -2
  491. package/dist/strategy/metrics.js +1 -1
  492. package/dist/strategy/scorecard.js +1 -1
  493. package/dist/tools/handlers/benchmark-migration.d.ts +2 -0
  494. package/dist/tools/handlers/benchmark-migration.js +1 -0
  495. package/dist/tools/handlers/bridge.js +1 -1
  496. package/dist/tools/handlers/config.js +1 -1
  497. package/dist/tools/handlers/dispatch-expectations.d.ts +3 -0
  498. package/dist/tools/handlers/dispatch-expectations.js +1 -0
  499. package/dist/tools/handlers/evaluation.js +1 -1
  500. package/dist/tools/handlers/industry-pack.js +1 -1
  501. package/dist/tools/handlers/onchain.js +1 -1
  502. package/dist/tools/handlers/query.js +1 -1
  503. package/dist/tools/handlers/schema-query.js +1 -1
  504. package/dist/tools/index.js +1 -1
  505. package/dist/tools/move-fn-index.gen.d.ts +3 -0
  506. package/dist/tools/move-fn-index.gen.js +1 -0
  507. package/dist/tools/registry/business.js +1 -1
  508. package/dist/tools/registry/config.js +1 -1
  509. package/dist/tools/registry/evaluation.d.ts +2 -0
  510. package/dist/tools/registry/evaluation.js +1 -0
  511. package/dist/tools/registry/onchain.js +1 -1
  512. package/dist/tools/registry/query.js +1 -1
  513. package/dist/tools/sanitize-output.d.ts +3 -0
  514. package/dist/tools/sanitize-output.js +1 -0
  515. package/dist/tools/sanitize-output.spec.d.ts +1 -0
  516. package/dist/tools/sanitize-output.spec.js +1 -0
  517. package/dist/tools/shared.d.ts +0 -1
  518. package/dist/tools/shared.js +1 -1
  519. package/dist/tools/wrap.js +1 -1
  520. package/package.json +9 -3
  521. package/dist/customer/customer-advice.d.ts +0 -32
  522. package/dist/customer/customer-advice.js +0 -1
  523. package/dist/customer/info-puzzle.d.ts +0 -146
  524. package/dist/customer/info-puzzle.js +0 -1
  525. package/dist/customer/order-strategy.d.ts +0 -17
  526. package/dist/customer/order-strategy.js +0 -1
  527. package/dist/customer/preorder-compare.d.ts +0 -24
  528. package/dist/customer/preorder-compare.js +0 -1
  529. package/dist/customer/reminder-system.d.ts +0 -42
  530. package/dist/customer/reminder-system.js +0 -1
  531. package/dist/customer/risk-assessment.d.ts +0 -13
  532. package/dist/customer/risk-assessment.js +0 -1
  533. package/dist/evaluation/builtins/service-risk.d.ts +0 -7
  534. package/dist/evaluation/builtins/service-risk.js +0 -1
  535. package/dist/knowledge/trust-metrics.d.ts +0 -66
  536. package/dist/knowledge/trust-metrics.js +0 -1
  537. package/dist/schema/trust/index.d.ts +0 -334
  538. package/dist/schema/trust/index.js +0 -1
  539. package/dist/schemas/trust_score.output.json +0 -847
  540. package/dist/schemas/trust_score.schema.json +0 -364
  541. package/dist/tools/handlers/trust.d.ts +0 -16
  542. package/dist/tools/handlers/trust.js +0 -1
  543. package/dist/tools/registry/trust.d.ts +0 -2
  544. package/dist/tools/registry/trust.js +0 -1
@@ -1 +1 @@
1
- export const SERVICE_PERMISSIONS=[{'index':0x12c,'name':'SERVICE_NEW','description':'Create\x20new\x20Service','governed_operation':'service::new','post_publish_mutability':'na'},{'index':0x12d,'name':'SERVICE_DESCRIPTION','description':'Modify\x20Service\x20description','governed_operation':'service::description_set','post_publish_mutability':'mutable'},{'index':0x12f,'name':'SERVICE_LOCATION','description':'Set\x20Service\x20location/URL','governed_operation':'service::location_set','post_publish_mutability':'mutable'},{'index':0x130,'name':'SERVICE_REPOSITORY','description':'Add/remove\x20Repository\x20references','governed_operation':'service::repository_add/remove/clear','post_publish_mutability':'mutable'},{'index':0x131,'name':'SERVICE_SALES','description':'Add/set/remove/clear\x20sales\x20items','governed_operation':'service::sales_add/set/remove/clear','post_publish_mutability':'mutable'},{'index':0x132,'name':'SERVICE_MACHINE','description':'Bind/unbind\x20Machine\x20workflow\x20template','governed_operation':'service::machine_set/machine_none','post_publish_mutability':'immutable'},{'index':0x133,'name':'SERVICE_BUY_GUARD','description':'Set/clear\x20buy\x20Guard\x20(post-publish\x20mutable)','governed_operation':'service::buy_guard_set/buy_guard_none','post_publish_mutability':'mutable'},{'index':0x134,'name':'SERVICE_ARBITRATION','description':'Add/remove\x20Arbitration\x20references','governed_operation':'service::arbitration_add/remove/clear','post_publish_mutability':'immutable'},{'index':0x135,'name':'SERVICE_CUSTOMER_INFO_REQUIRED','description':'Set\x20customer\x20required\x20info\x20fields','governed_operation':'service::customer_required_set','post_publish_mutability':'mutable'},{'index':0x136,'name':'SERVICE_PAUSE','description':'Pause/resume\x20Service\x20(block\x20new\x20orders)','governed_operation':'service::pause','post_publish_mutability':'mutable'},{'index':0x137,'name':'SERVICE_PUBLISH','description':'Publish\x20Service\x20(IRREVERSIBLE)','governed_operation':'service::publish','post_publish_mutability':'one_shot'},{'index':0x138,'name':'SERVICE_DISCOUNT','description':'Issue/discount_destroy\x20discount\x20coupons','governed_operation':'service::discount','post_publish_mutability':'mutable'},{'index':0x139,'name':'SERVICE_ORDER_ALLOCATOR','description':'Set\x20order\x20allocator\x20strategy','governed_operation':'service::order_allocators_set','post_publish_mutability':'immutable'},{'index':0x13a,'name':'SERVICE_COMPENSATION_FUND_WITHDRAW','description':'Withdraw\x20compensation\x20fund\x20(time-locked)','governed_operation':'service::compensation_fund_withdraw','post_publish_mutability':'locked_by_duration'},{'index':0x13b,'name':'SERVICE_COMPENSATION_FUND_DEPOSIT','description':'Deposit\x20to\x20compensation\x20fund','governed_operation':'service::compensation_fund_add','post_publish_mutability':'mutable'},{'index':0x13c,'name':'SERVICE_COMPENSATION_FUND_RECEIVE','description':'Receive\x20compensation\x20fund\x20(arbitration\x20payout)','governed_operation':'service::compensation_fund_receive','post_publish_mutability':'mutable'},{'index':0x13d,'name':'SERVICE_COMPENSATION_LOCK_DURATION_ADD','description':'Extend\x20setting_lock_duration\x20(only-increase)','governed_operation':'service::setting_lock_duration_add','post_publish_mutability':'mutable'},{'index':0x13e,'name':'SERVICE_REWARD','description':'Add/remove\x20Reward\x20references\x20(remove/clear\x20time-locked)','governed_operation':'service::reward_add/remove/clear','post_publish_mutability':'locked_by_duration'},{'index':0x13f,'name':'SERVICE_OWNER_RECEIVE','description':'Receive\x20Payment/objects\x20to\x20owner','governed_operation':'service::owner_receive','post_publish_mutability':'mutable'},{'index':0x140,'name':'SERVICE_UM','description':'Bind/unbind\x20Contact\x20as\x20UM','governed_operation':'service::um_set/um_none','post_publish_mutability':'mutable'}];export const SERVICE_ORDER_FLOW_STAGES=[{'stage':0x1,'name':'pre_check','preconditions':['Service.bPublished\x20==\x20true\x20(else\x20E_NOT_PUBLISHED,\x20service:7)','Service.bPaused\x20==\x20false\x20(else\x20E_PAUSED,\x20service:19)','buy_guard\x20(if\x20set)\x20added\x20to\x20guards[]\x20list\x20for\x20verification'],'side_effects':[],'always_executed':!![]},{'stage':0x2,'name':'wip_verify','preconditions':['buy.items\x20non-empty','Each\x20item.name\x20matches\x20a\x20sale\x20in\x20Service.sales\x20(else\x20E_SALE_ITEM_NOT_FOUND,\x20service:32)','sale.suspension\x20==\x20false\x20(else\x20E_SALE_SUSPENDED)'],'side_effects':['If\x20buyer\x20passes\x20empty\x20wip_hash,\x20SDK\x20auto-fills\x20with\x20sale.wip_hash','verifiedWipUrls\x20Set\x20avoids\x20re-verifying\x20same\x20WIP\x20URL\x20across\x20items','verify_wip()\x20fetches\x20WIP\x20file\x20and\x20compares\x20hash\x20(else\x20E_WIP_HASH_NOT_MATCH)'],'always_executed':!![]},{'stage':0x3,'name':'quote','preconditions':['All\x20items\x20have\x20valid\x20sale\x20+\x20wip_hash\x20match','stock\x20>=\x20purchase\x20quantity\x20(else\x20E_STOCK_NOT_ENOUGH,\x20service:16)','discount\x20object\x20(if\x20used)\x20is\x20valid\x20and\x20within\x20its\x20[time_start,\x20time_end]\x20window\x20(else\x20E_DISCOUNT_TIME_INVALID)'],'side_effects':['quote_imp()\x20computes\x20total\x20price\x20(with\x20discount\x20if\x20applicable)','⚠️\x20Stock\x20is\x20deducted\x20(split)\x20—\x20side\x20effect\x20is\x20NOT\x20auto-rolled-back\x20on\x20later\x20failure','service::quote\x20or\x20service::quote_with_discount\x20MoveCall\x20(quote_with_discount\x20validates\x20the\x20Clock\x20time-window\x20check)'],'always_executed':!![]},{'stage':0x4,'name':'create_order','preconditions':['Quote\x20object\x20from\x20stage\x203','Registrar\x20+\x20Clock\x20objects\x20available'],'side_effects':['service::buy\x20or\x20service::buy_with_passport\x20MoveCall','Order\x20object\x20created\x20(builder=customer,\x20service=Service.id)','Order.id\x20recorded\x20for\x20stages\x205-7'],'always_executed':!![]},{'stage':0x5,'name':'create_allocation','preconditions':['Service.order_allocators\x20is\x20Some\x20(configured)','Order\x20from\x20stage\x204','CoinParam\x20for\x20total_pay\x20matches\x20Service<T>\x20type'],'side_effects':['service::order_allocation\x20MoveCall','Allocation\x20object\x20created\x20(first-match-wins\x20fund\x20distribution)','Order.allocation\x20=\x20Allocation\x20address'],'always_executed':!![]},{'stage':0x6,'name':'create_progress','preconditions':['Service.machine\x20is\x20Some\x20(machine\x20bound)','Order\x20from\x20stage\x204','Machine\x20from\x20Service.machine'],'side_effects':['service::order_progress\x20MoveCall','Progress\x20object\x20created\x20(Progress.machine\x20=\x20Service.machine,\x20Progress.task\x20=\x20Order.id)'],'always_executed':![]},{'stage':0x7,'name':'post_actions','preconditions':['Order/Allocation/Progress\x20objects\x20from\x20stages\x204-6'],'side_effects':['agent_set\x20(if\x20order_new.agents\x20provided)','order_required_info_update\x20(if\x20order_required_info\x20provided)','owner_change\x20(if\x20transfer\x20provided\x20—\x20sets\x20new\x20Order\x20owner)','namedNewOrder\x20/\x20namedNewAllocation\x20/\x20namedNewProgress\x20(local\x20naming)'],'always_executed':![]},{'stage':0x8,'name':'return_result','preconditions':['All\x20preceding\x20stages\x20succeeded'],'side_effects':['Returns\x20BuyResult\x20{\x20order,\x20allocation?,\x20progress?\x20}','Caller\x20proceeds\x20to\x20sign\x20+\x20submit\x20transaction'],'always_executed':!![]}];export const SERVICE_CROSS_OBJECT_BINDINGS=[{'object':'Machine','field':'machine','required':![],'locked_after_publish':!![],'notes':'Workflow\x20template;\x20post-publish\x20immutable\x20(F-S-20).\x20Progress.machine\x20inherits\x20this\x20value.'},{'object':'Guard','field':'buy_guard','required':![],'locked_after_publish':![],'notes':'Buyer\x20eligibility\x20guard;\x20post-publish\x20STILL\x20MUTABLE\x20(unusual\x20—\x20see\x20F-S-26)'},{'object':'Allocation','field':'order_allocators','required':!![],'locked_after_publish':!![],'notes':'Order\x20fund\x20distribution\x20strategy;\x20publish\x20prerequisite\x20(F-S-18).\x20Post-publish\x20immutable\x20(F-S-22).'},{'object':'Arbitration','field':'arbitrations','required':![],'locked_after_publish':![],'notes':'Dispute\x20handlers;\x20required\x20if\x20compensation_fund\x20>\x200\x20(F-S-19).\x20add\x20always\x20mutable;\x20remove/clear\x20time-locked\x20after\x20publish\x20(F-S-21).'},{'object':'Repository','field':'repositories','required':![],'locked_after_publish':![],'notes':'Shared\x20data\x20stores;\x20mutable\x20post-publish'},{'object':'Reward','field':'rewards','required':![],'locked_after_publish':![],'notes':'Marketing\x20incentives;\x20add\x20always\x20mutable;\x20remove/clear\x20time-locked\x20after\x20publish\x20(F-S-24)'},{'object':'Contact','field':'um','required':![],'locked_after_publish':![],'notes':'User\x20Manager\x20(Contact\x20object);\x20mutable\x20post-publish'},{'object':'Treasury','field':'(indirect\x20via\x20order_allocators.sharing.who=Entity)','required':![],'locked_after_publish':![],'notes':'Treasury\x20is\x20referenced\x20by\x20Allocation.sharing.who,\x20not\x20by\x20Service\x20directly'}];export const SERVICE_SCENES=[{'id':'service_retail','name':'Retail\x20e-commerce\x20Service','category':'retail','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['um_set','builder\x20(transfer)'],'admin_operations':['description_set','location_set','customer_required_set'],'permission_index_operations':['service::publish\x20(311)','service::pause\x20(310)','service::sales_add/set/remove/clear\x20(305)','service::order_allocators_set\x20(313)','service::buy_guard_set\x20(307)','service::discount\x20(312)'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['order_allocators\x20must\x20be\x20set\x20(F-S-18,\x20E_NO_ALLOCATOR)','If\x20compensation_fund\x20>\x200,\x20arbitrations\x20must\x20be\x20non-empty\x20(F-S-19)'],'common_patterns':['Multi-tier\x20pricing\x20via\x20sales[]\x20(Standard/Premium/Enterprise)','WIP\x20hash\x20per\x20sale\x20item\x20for\x20tamper-proof\x20product\x20info','buy_guard\x20for\x20KYC\x20whitelist\x20during\x20pre-sale,\x20then\x20null\x20for\x20public\x20sale','compensation_fund\x20deposited\x20before\x20publish\x20+\x20arbitrations\x20configured'],'recommended_templates':['T-S-01','T-S-06']},{'id':'service_rental','name':'Rental\x20Service\x20(short/long-term)','category':'rental','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['um_set','builder\x20(transfer)'],'admin_operations':['description_set','location_set'],'permission_index_operations':['service::publish\x20(311)','service::sales_add/set\x20(305)','service::machine_set\x20(306)\x20—\x20for\x20rental\x20workflow','service::arbitration_add\x20(308)\x20—\x20for\x20deposit\x20disputes'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['order_allocators\x20must\x20be\x20set','machine\x20recommended\x20(rental\x20workflow\x20with\x20deposit/return\x20stages)','arbitrations\x20recommended\x20(deposit\x20refund\x20disputes)'],'common_patterns':['Machine\x20workflow\x20with\x20\x27Deposit\x20→\x20Use\x20→\x20Return\x20→\x20Refund\x27\x20nodes','compensation_fund\x20holds\x20deposit\x20guarantees','buy_guard\x20verifies\x20renter\x20identity/KYC','stock=1\x20per\x20rental\x20item\x20(unique\x20items)'],'recommended_templates':['T-S-02','T-S-04']},{'id':'service_subscription','name':'Subscription\x20Service\x20(recurring)','category':'subscription','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['um_set','builder\x20(transfer)'],'admin_operations':['description_set','location_set'],'permission_index_operations':['service::publish\x20(311)','service::sales_add/set\x20(305)','service::discount\x20(312)\x20—\x20promotional\x20rates','service::reward_add\x20(318)\x20—\x20loyalty\x20rewards'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['order_allocators\x20must\x20be\x20set'],'common_patterns':['Tiered\x20plans\x20(Free/Pro/Enterprise)\x20as\x20sales[]','Discount\x20coupons\x20for\x20trial\x20periods','Rewards\x20for\x20long-term\x20subscribers','Renewal\x20handled\x20by\x20repeat\x20orders\x20(no\x20native\x20recurring\x20billing)'],'recommended_templates':['T-S-03']},{'id':'service_workflow','name':'Workflow-bound\x20Service\x20(machine-bound)','category':'workflow','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['um_set','builder\x20(transfer)'],'admin_operations':['description_set','location_set'],'permission_index_operations':['service::machine_set\x20(306)\x20—\x20bind\x20workflow','service::publish\x20(311)','service::order_allocators_set\x20(313)'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['order_allocators\x20must\x20be\x20set','machine\x20must\x20be\x20published\x20before\x20binding','machine\x20recommended\x20for\x20any\x20multi-stage\x20service\x20delivery'],'common_patterns':['Machine\x20defines\x20Pay\x20→\x20Confirm\x20→\x20Deliver\x20→\x20Sign-off\x20nodes','Progress\x20created\x20per\x20order\x20(stage\x206\x20of\x20buy\x20flow)','Named\x20operators\x20assigned\x20per\x20Forward\x20in\x20Machine','Service.paused\x20does\x20NOT\x20affect\x20already-created\x20Progress\x20(existing\x20orders\x20continue)'],'recommended_templates':['T-S-04']},{'id':'service_arbitration','name':'Arbitration-bound\x20Service\x20(dispute-ready)','category':'arbitration','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['um_set','builder\x20(transfer)'],'admin_operations':['description_set'],'permission_index_operations':['service::arbitration_add\x20(308)','service::compensation_fund_add\x20(315)','service::setting_lock_duration_add\x20(317)','service::publish\x20(311)'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['If\x20compensation_fund\x20>\x200,\x20arbitrations\x20must\x20be\x20non-empty\x20(F-S-19)','Arbitration\x20objects\x20must\x20be\x20created\x20before\x20binding','compensation_fund_add\x20before\x20publish\x20recommended\x20(else\x20post-publish\x20deposit\x20still\x20possible)'],'common_patterns':['2-3\x20Arbitration\x20objects\x20(different\x20arb\x20committees\x20for\x20different\x20dispute\x20types)','compensation_fund\x20deposited\x20as\x20%\x20of\x20expected\x20order\x20volume','setting_lock_duration\x20extended\x20by\x20owner\x20to\x20build\x20customer\x20trust','compensation_claim\x20triggered\x20by\x20arbitration\x20result\x20(not\x20by\x20Service\x20directly)'],'recommended_templates':['T-S-05','T-S-06']},{'id':'service_compensation_fund','name':'Compensation\x20Fund\x20Service\x20(embedded\x20balance)','category':'compensation_fund','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['um_set','builder\x20(transfer)'],'admin_operations':['description_set'],'permission_index_operations':['service::compensation_fund_add\x20(315)\x20—\x20deposit','service::compensation_fund_withdraw\x20(314)\x20—\x20withdraw\x20(time-locked\x20after\x20publish)','service::compensation_fund_receive\x20(316)\x20—\x20receive\x20arbitration\x20payout\x20(always\x20mutable)','service::setting_lock_duration_add\x20(317)\x20—\x20extend\x20lock'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['compensation_fund\x20>\x200\x20→\x20arbitrations\x20non-empty\x20(F-S-19)','compensation_fund\x20coin\x20type\x20must\x20match\x20Service<T>\x20type\x20parameter'],'common_patterns':['Fund\x20inflow:\x20compensation_fund_add\x20(315)\x20—\x20always\x20mutable','Fund\x20outflow:\x20compensation_fund_withdraw\x20(314)\x20—\x20requires\x20bPaused\x20+\x20lock_duration\x20expired','Fund\x20receive:\x20compensation_fund_receive\x20(316)\x20—\x20arbitration\x20payout,\x20always\x20mutable','Fund\x20consumer:\x20arbitration::compensation_claim\x20(driven\x20by\x20arb\x20result)','Distinct\x20from\x20Treasury:\x20Service-internal,\x20arbitration-bound,\x20lock-protected'],'recommended_templates':['T-S-06']},{'id':'service_reward','name':'Reward-attached\x20Service\x20(marketing)','category':'reward','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['um_set','builder\x20(transfer)'],'admin_operations':['description_set'],'permission_index_operations':['service::reward_add/remove/clear\x20(318)\x20—\x20add\x20always\x20mutable;\x20remove/clear\x20time-locked\x20after\x20publish','service::discount\x20(312)','service::publish\x20(311)'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['order_allocators\x20must\x20be\x20set'],'common_patterns':['Rewards\x20added\x20post-publish\x20(always\x20allowed;\x20remove/clear\x20is\x20time-locked\x20after\x20publish)','Reward\x20objects\x20must\x20exist\x20before\x20binding\x20(queryObjectsWithType\x20validation)','MAX_REWARD_COUNT\x20=\x2020\x20per\x20Service','Reward\x20remove/clear\x20requires\x20Service\x20paused\x20+\x20setting_lock_duration\x20elapsed\x20(protects\x20customer\x20expectations)'],'recommended_templates':['T-S-08']},{'id':'service_arbitration_binding','name':'Arbitration\x20Binding\x20Service\x20(post-publish\x20immutable)','category':'arbitration','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['um_set','builder\x20(transfer)'],'admin_operations':['description_set'],'permission_index_operations':['service::arbitration_add\x20(308)\x20—\x20pre-publish\x20only','service::arbitration_remove\x20(308)\x20—\x20pre-publish\x20only','service::arbitration_clear\x20(308)\x20—\x20pre-publish\x20only','service::publish\x20(311)'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['MAX_ARBITRATION_COUNT\x20=\x2020\x20per\x20Service\x20(F-S-04)','Each\x20Arbitration\x20object\x20must\x20be\x20valid\x20(queryObjectsWithType\x20validation)','Arbitration\x20bound\x20=\x20locked\x20post-publish\x20(F-S-21).\x20To\x20change:\x20create\x20new\x20Service.'],'common_patterns':['Pre-publish:\x20set\x201-3\x20Arbitration\x20objects\x20for\x20different\x20dispute\x20scopes','Post-publish:\x20immutable\x20—\x20clone\x20Service\x20if\x20change\x20needed','⚠️\x20Data\x20inconsistency:\x20dynamic-pricing.ts\x20marks\x20arbitrations\x20as\x20mutable,\x20but\x20SDK\x20blocks\x20it\x20(F-S-21)'],'recommended_templates':['T-S-05']},{'id':'service_buy_guard','name':'Buy\x20Guard\x20Service\x20(post-publish\x20mutable\x20guard)','category':'buy_guard','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['um_set','builder\x20(transfer)'],'admin_operations':['description_set'],'permission_index_operations':['service::buy_guard_set\x20(307)\x20—\x20bind\x20guard','service::buy_guard_none\x20(307)\x20—\x20clear\x20guard','service::publish\x20(311)'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['order_allocators\x20must\x20be\x20set'],'common_patterns':['Pre-sale\x20phase:\x20buy_guard\x20=\x20whitelist\x20Guard\x20(KYC\x20verified\x20buyers\x20only)','Public\x20sale:\x20buy_guard\x20=\x20null\x20(anyone\x20can\x20buy)','Restricted\x20phase:\x20buy_guard\x20=\x20KYC\x20Guard\x20(compliance)','⚠️\x20buy_guard\x20is\x20the\x20ONLY\x20publish-locked-field\x20exception\x20—\x20still\x20mutable\x20post-publish','buy_guard\x20verification\x20happens\x20at\x20Stage\x201\x20of\x20buy\x20flow\x20(pre_check)'],'recommended_templates':['T-S-01']},{'id':'service_order_allocator','name':'Order\x20Allocator\x20Service\x20(fund\x20distribution\x20config)','category':'order_allocator','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['um_set','builder\x20(transfer)'],'admin_operations':['description_set'],'permission_index_operations':['service::order_allocators_set\x20(313)\x20—\x20pre-publish\x20only','service::publish\x20(311)\x20—\x20requires\x20order_allocators\x20(F-S-18)'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['order_allocators\x20MUST\x20be\x20set\x20(F-S-18,\x20E_NO_ALLOCATOR)','Allocators.sharing.who\x20can\x20reference\x20Treasury\x20addresses\x20(indirect\x20Treasury\x20binding)','MAX_SHARING_COUNT\x20=\x20100\x20per\x20allocator'],'common_patterns':['Multi-party\x20split:\x20merchant\x2080%\x20/\x20platform\x2010%\x20/\x20logistics\x2010%','Threshold-based:\x20different\x20allocators\x20for\x20different\x20order\x20sizes','Guard-bound\x20allocator:\x20allocation\x20execution\x20requires\x20Guard\x20verification','Post-publish\x20immutable\x20—\x20clone\x20Service\x20to\x20change\x20allocation\x20strategy'],'recommended_templates':['T-S-08']},{'id':'service_dynamic_pricing','name':'Dynamic\x20Pricing\x20Service\x20(discount-driven)','category':'dynamic_pricing','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['um_set','builder\x20(transfer)'],'admin_operations':['description_set'],'permission_index_operations':['service::discount\x20(312)\x20—\x20issue\x20coupons','service::sales_add/set\x20(305)\x20—\x20adjust\x20base\x20prices','service::sales_remove\x20(305)\x20—\x20remove\x20deprecated\x20SKUs'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['order_allocators\x20must\x20be\x20set'],'common_patterns':['Discount\x20types:\x200=rates\x20(basis\x20points,\x20per\x2010000),\x201=minus\x20(direct\x20deduction)','MAX_DISCOUNT_COUNT_ONCE\x20=\x201000\x20per\x20issue\x20call','MAX_DISCOUNT_RECEIVER_ONCE\x20=\x201000\x20receivers\x20per\x20call','MAX_DISCOUNT_TOTAL_COUNT\x20=\x2020000\x20total\x20coupons','discount_destroy:\x20holder-only\x20(no\x20SERVICE_DISCOUNT\x20permission\x20needed)'],'recommended_templates':['T-S-07']},{'id':'service_multi_allocator','name':'Multi-Allocator\x20Service\x20(tiered\x20fund\x20distribution)','category':'multi_allocator','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['um_set','builder\x20(transfer)'],'admin_operations':['description_set'],'permission_index_operations':['service::order_allocators_set\x20(313)\x20—\x20pre-publish\x20only','service::publish\x20(311)'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['order_allocators\x20MUST\x20be\x20set','Each\x20allocator\x20has\x20its\x20own\x20Guard\x20+\x20sharing\x20+\x20threshold','First-match-wins:\x20first\x20allocator\x20whose\x20threshold\x20is\x20met\x20handles\x20the\x20order'],'common_patterns':['Tier\x201\x20(small\x20orders):\x20single-recipient\x20allocator\x20(low\x20fee)','Tier\x202\x20(medium\x20orders):\x20two-recipient\x20split\x20(merchant\x20+\x20platform)','Tier\x203\x20(large\x20orders):\x20three-recipient\x20split\x20(merchant\x20+\x20platform\x20+\x20logistics)','Each\x20tier\x20can\x20have\x20its\x20own\x20Guard\x20for\x20execution\x20authorization'],'recommended_templates':['T-S-08']}];export const SERVICE_LEDGER_VERSION='1.0.0';export function getScenesByCategory(a){return SERVICE_SCENES['filter'](b=>b['category']===a);}export function findSceneById(a){return SERVICE_SCENES['find'](b=>b['id']===a);}export function getServicePermissionByIndex(a){return SERVICE_PERMISSIONS['find'](b=>b['index']===a);}export function isServicePermission(a){return getServicePermissionByIndex(a)!==undefined;}export function getPermissionsByMutability(a){return SERVICE_PERMISSIONS['filter'](b=>b['post_publish_mutability']===a);}export function getImmutablePostPublishPermissions(){return SERVICE_PERMISSIONS['filter'](a=>a['post_publish_mutability']==='immutable'||a['post_publish_mutability']==='one_shot');}export function getLockedByDurationPermissions(){return SERVICE_PERMISSIONS['filter'](a=>a['post_publish_mutability']==='locked_by_duration');}export function inferSceneFromIntent(a){const b=a['toLowerCase'](),c=[['retail','retail'],['ecommerce','retail'],['rental','rental'],['rent','rental'],['short-term\x20rental','rental'],['long-term\x20rental','rental'],['subscription','subscription'],['subscribe','subscription'],['workflow','workflow'],['machine-bound','workflow'],['arbitration','arbitration'],['dispute','arbitration'],['compensation','compensation_fund'],['compensation_fund','compensation_fund'],['reward','reward'],['marketing','reward'],['buy_guard','buy_guard'],['kyc','buy_guard'],['whitelist','buy_guard'],['allocator','order_allocator'],['discount','dynamic_pricing'],['coupon','dynamic_pricing'],['multi-allocator','multi_allocator'],['tiered','multi_allocator']];for(const [d,e]of c){if(b['includes'](d)){const f=getScenesByCategory(e);if(f['length']>0x0)return f[0x0];}}if(b['includes']('service'))return findSceneById('service_retail');return undefined;}export function getAllServiceScenes(){return[...SERVICE_SCENES];}export function getServiceScenesCount(){return SERVICE_SCENES['length'];}export function getServicePermissionsCount(){return SERVICE_PERMISSIONS['length'];}export function getOrderFlowStage(a){return SERVICE_ORDER_FLOW_STAGES['find'](b=>b['stage']===a);}export function getCrossObjectBindings(){return[...SERVICE_CROSS_OBJECT_BINDINGS];}
1
+ export const SERVICE_PERMISSIONS=[{'index':0x12c,'name':'SERVICE_NEW','description':'Create\x20new\x20Service','governed_operation':'create\x20a\x20new\x20Service','post_publish_mutability':'na'},{'index':0x12d,'name':'SERVICE_DESCRIPTION','description':'Modify\x20Service\x20description','governed_operation':'modify\x20the\x20Service\x20description','post_publish_mutability':'mutable'},{'index':0x12f,'name':'SERVICE_LOCATION','description':'Set\x20Service\x20location/URL','governed_operation':'set\x20the\x20Service\x20location/URL','post_publish_mutability':'mutable'},{'index':0x130,'name':'SERVICE_REPOSITORY','description':'Add/remove\x20Repository\x20references','governed_operation':'add/remove/clear\x20Repository\x20references','post_publish_mutability':'mutable'},{'index':0x131,'name':'SERVICE_SALES','description':'Add/set/remove/clear\x20sales\x20items','governed_operation':'add/set/remove/clear\x20sales\x20items','post_publish_mutability':'mutable'},{'index':0x132,'name':'SERVICE_MACHINE','description':'Bind/unbind\x20Machine\x20workflow\x20template','governed_operation':'bind/unbind\x20the\x20Machine\x20workflow\x20template','post_publish_mutability':'immutable'},{'index':0x133,'name':'SERVICE_BUY_GUARD','description':'Set/clear\x20buy\x20Guard\x20(post-publish\x20mutable)','governed_operation':'set/clear\x20the\x20buy_guard\x20check','post_publish_mutability':'mutable'},{'index':0x134,'name':'SERVICE_ARBITRATION','description':'Add/remove\x20Arbitration\x20references','governed_operation':'add/remove/clear\x20Arbitration\x20references','post_publish_mutability':'immutable'},{'index':0x135,'name':'SERVICE_CUSTOMER_INFO_REQUIRED','description':'Set\x20customer\x20required\x20info\x20fields','governed_operation':'set\x20customer\x20required\x20info\x20fields','post_publish_mutability':'mutable'},{'index':0x136,'name':'SERVICE_PAUSE','description':'Pause/resume\x20Service\x20(block\x20new\x20orders)','governed_operation':'pause/resume\x20the\x20Service','post_publish_mutability':'mutable'},{'index':0x137,'name':'SERVICE_PUBLISH','description':'Publish\x20Service\x20(IRREVERSIBLE)','governed_operation':'publish\x20the\x20Service\x20(irreversible)','post_publish_mutability':'one_shot'},{'index':0x138,'name':'SERVICE_DISCOUNT','description':'Issue/discount_destroy\x20discount\x20coupons','governed_operation':'issue/destroy\x20discount\x20coupons','post_publish_mutability':'mutable'},{'index':0x139,'name':'SERVICE_ORDER_ALLOCATOR','description':'Set\x20order\x20allocator\x20strategy','governed_operation':'set\x20the\x20order_allocators\x20strategy','post_publish_mutability':'immutable'},{'index':0x13a,'name':'SERVICE_COMPENSATION_FUND_WITHDRAW','description':'Withdraw\x20compensation\x20fund\x20(time-locked)','governed_operation':'withdraw\x20from\x20the\x20compensation_fund\x20(time-locked)','post_publish_mutability':'locked_by_duration'},{'index':0x13b,'name':'SERVICE_COMPENSATION_FUND_DEPOSIT','description':'Deposit\x20to\x20compensation\x20fund','governed_operation':'deposit\x20to\x20the\x20compensation_fund','post_publish_mutability':'mutable'},{'index':0x13c,'name':'SERVICE_COMPENSATION_FUND_RECEIVE','description':'Receive\x20compensation\x20fund\x20(arbitration\x20payout)','governed_operation':'receive\x20the\x20compensation_fund\x20payout\x20(arbitration\x20payout)','post_publish_mutability':'mutable'},{'index':0x13d,'name':'SERVICE_COMPENSATION_LOCK_DURATION_ADD','description':'Extend\x20setting_lock_duration\x20(only-increase)','governed_operation':'extend\x20setting_lock_duration\x20(only-increase)','post_publish_mutability':'mutable'},{'index':0x13e,'name':'SERVICE_REWARD','description':'Add/remove\x20Reward\x20references\x20(remove/clear\x20time-locked)','governed_operation':'add/remove/clear\x20Reward\x20references','post_publish_mutability':'locked_by_duration'},{'index':0x13f,'name':'SERVICE_OWNER_RECEIVE','description':'Receive\x20Payment/objects\x20to\x20owner','governed_operation':'receive\x20Payments/objects\x20to\x20owner','post_publish_mutability':'mutable'},{'index':0x140,'name':'SERVICE_UM','description':'Bind/unbind\x20Contact\x20as\x20UM','governed_operation':'bind/unbind\x20Contact\x20as\x20UM','post_publish_mutability':'mutable'}];export const SERVICE_ORDER_FLOW_STAGES=[{'stage':0x1,'name':'pre_check','preconditions':['Service.bPublished\x20==\x20true\x20(else\x20E_NOT_PUBLISHED,\x20service:7)','Service.bPaused\x20==\x20false\x20(else\x20E_PAUSED,\x20service:19)','buy_guard\x20(if\x20set)\x20added\x20to\x20guards[]\x20list\x20for\x20verification'],'side_effects':[],'always_executed':!![]},{'stage':0x2,'name':'wip_verify','preconditions':['buy.items\x20non-empty','Each\x20item.name\x20matches\x20a\x20sale\x20in\x20Service.sales\x20(else\x20E_SALE_ITEM_NOT_FOUND,\x20service:32)','sale.suspension\x20==\x20false\x20(else\x20E_SALE_SUSPENDED)'],'side_effects':['If\x20buyer\x20passes\x20empty\x20wip_hash,\x20SDK\x20auto-fills\x20with\x20sale.wip_hash','verifiedWipUrls\x20Set\x20avoids\x20re-verifying\x20same\x20WIP\x20URL\x20across\x20items','verify_wip()\x20fetches\x20WIP\x20file\x20and\x20compares\x20hash\x20(else\x20E_WIP_HASH_NOT_MATCH)'],'always_executed':!![]},{'stage':0x3,'name':'quote','preconditions':['All\x20items\x20have\x20valid\x20sale\x20+\x20wip_hash\x20match','stock\x20>=\x20purchase\x20quantity\x20(else\x20E_STOCK_NOT_ENOUGH,\x20service:16)','discount\x20object\x20(if\x20used)\x20is\x20valid\x20and\x20within\x20its\x20[time_start,\x20time_end]\x20window\x20(else\x20E_DISCOUNT_TIME_INVALID)'],'side_effects':['The\x20quote\x20step\x20computes\x20the\x20total\x20price\x20(with\x20discount\x20if\x20applicable)','⚠️\x20Stock\x20is\x20deducted\x20(split)\x20—\x20side\x20effect\x20is\x20NOT\x20auto-rolled-back\x20on\x20later\x20failure','The\x20on-chain\x20quote\x20call\x20executes\x20(the\x20discount\x20path\x20validates\x20the\x20Clock\x20time-window\x20check)'],'always_executed':!![]},{'stage':0x4,'name':'create_order','preconditions':['Quote\x20object\x20from\x20stage\x203','Registrar\x20+\x20Clock\x20objects\x20available'],'side_effects':['The\x20atomic\x20on-chain\x20buy\x20call\x20executes\x20(passport-gated\x20variant\x20supported)','Order\x20object\x20created\x20(builder=customer,\x20service=Service.id)','Order.id\x20recorded\x20for\x20stages\x205-7'],'always_executed':!![]},{'stage':0x5,'name':'create_allocation','preconditions':['Service.order_allocators\x20is\x20Some\x20(configured)','Order\x20from\x20stage\x204','CoinParam\x20for\x20total_pay\x20matches\x20Service<T>\x20type'],'side_effects':['The\x20on-chain\x20allocation\x20call\x20executes','Allocation\x20object\x20created\x20(first-match-wins\x20fund\x20distribution)','Order.allocation\x20=\x20Allocation\x20address'],'always_executed':!![]},{'stage':0x6,'name':'create_progress','preconditions':['Service.machine\x20is\x20Some\x20(machine\x20bound)','Order\x20from\x20stage\x204','Machine\x20from\x20Service.machine'],'side_effects':['The\x20on-chain\x20progress-creation\x20call\x20executes','Progress\x20object\x20created\x20(Progress.machine\x20=\x20Service.machine,\x20Progress.task\x20=\x20Order.id)'],'always_executed':![]},{'stage':0x7,'name':'post_actions','preconditions':['Order/Allocation/Progress\x20objects\x20from\x20stages\x204-6'],'side_effects':['Attach\x20agents\x20to\x20the\x20order\x20(if\x20order_new.agents\x20provided)','order_required_info_update\x20(if\x20order_required_info\x20provided)','Transfer\x20Order\x20ownership\x20(if\x20transfer\x20provided\x20—\x20sets\x20new\x20Order\x20owner)','namedNewOrder\x20/\x20namedNewAllocation\x20/\x20namedNewProgress\x20(local\x20naming)'],'always_executed':![]},{'stage':0x8,'name':'return_result','preconditions':['All\x20preceding\x20stages\x20succeeded'],'side_effects':['Returns\x20BuyResult\x20{\x20order,\x20allocation?,\x20progress?\x20}','Caller\x20proceeds\x20to\x20sign\x20+\x20submit\x20transaction'],'always_executed':!![]}];export const SERVICE_CROSS_OBJECT_BINDINGS=[{'object':'Machine','field':'machine','required':![],'locked_after_publish':!![],'notes':'Workflow\x20template;\x20post-publish\x20immutable\x20(F-S-20).\x20Progress.machine\x20inherits\x20this\x20value.'},{'object':'Guard','field':'buy_guard','required':![],'locked_after_publish':![],'notes':'Buyer\x20eligibility\x20guard;\x20post-publish\x20STILL\x20MUTABLE\x20(unusual\x20—\x20see\x20F-S-26)'},{'object':'Allocation','field':'order_allocators','required':!![],'locked_after_publish':!![],'notes':'Order\x20fund\x20distribution\x20strategy;\x20publish\x20prerequisite\x20(F-S-18).\x20Post-publish\x20immutable\x20(F-S-22).'},{'object':'Arbitration','field':'arbitrations','required':![],'locked_after_publish':![],'notes':'Dispute\x20handlers;\x20required\x20if\x20compensation_fund\x20>\x200\x20(F-S-19).\x20add\x20always\x20mutable;\x20remove/clear\x20time-locked\x20after\x20publish\x20(F-S-21).'},{'object':'Repository','field':'repositories','required':![],'locked_after_publish':![],'notes':'Shared\x20data\x20stores;\x20mutable\x20post-publish'},{'object':'Reward','field':'rewards','required':![],'locked_after_publish':![],'notes':'Marketing\x20incentives;\x20add\x20always\x20mutable;\x20remove/clear\x20time-locked\x20after\x20publish\x20(F-S-24)'},{'object':'Contact','field':'um','required':![],'locked_after_publish':![],'notes':'User\x20Manager\x20(Contact\x20object);\x20mutable\x20post-publish'},{'object':'Treasury','field':'(indirect\x20via\x20order_allocators.sharing.who=Entity)','required':![],'locked_after_publish':![],'notes':'Treasury\x20is\x20referenced\x20by\x20Allocation.sharing.who,\x20not\x20by\x20Service\x20directly'}];export const SERVICE_SCENES=[{'id':'service_retail','name':'Retail\x20e-commerce\x20Service','category':'retail','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['bind/unbind\x20the\x20UM\x20Contact','builder\x20(transfer)'],'admin_operations':['update\x20the\x20description','set\x20the\x20location/URL','set\x20customer\x20required\x20info\x20fields'],'permission_index_operations':['publish\x20the\x20Service\x20(311)','pause/resume\x20the\x20Service\x20(310)','add/set/remove/clear\x20sales\x20items\x20(305)','set\x20the\x20order_allocators\x20strategy\x20(313)','set/clear\x20the\x20buy_guard\x20check\x20(307)','issue/destroy\x20discount\x20coupons\x20(312)'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['order_allocators\x20must\x20be\x20set\x20(F-S-18,\x20E_NO_ALLOCATOR)','If\x20compensation_fund\x20>\x200,\x20arbitrations\x20must\x20be\x20non-empty\x20(F-S-19)'],'common_patterns':['Multi-tier\x20pricing\x20via\x20sales[]\x20(Standard/Premium/Enterprise)','WIP\x20hash\x20per\x20sale\x20item\x20for\x20tamper-proof\x20product\x20info','buy_guard\x20for\x20KYC\x20whitelist\x20during\x20pre-sale,\x20then\x20null\x20for\x20public\x20sale','compensation_fund\x20deposited\x20before\x20publish\x20+\x20arbitrations\x20configured'],'recommended_templates':['T-S-01','T-S-06']},{'id':'service_rental','name':'Rental\x20Service\x20(short/long-term)','category':'rental','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['bind/unbind\x20the\x20UM\x20Contact','builder\x20(transfer)'],'admin_operations':['update\x20the\x20description','set\x20the\x20location/URL'],'permission_index_operations':['publish\x20the\x20Service\x20(311)','add/set\x20sales\x20items\x20(305)','bind\x20the\x20Machine\x20workflow\x20(306)\x20—\x20for\x20rental\x20workflow','add\x20Arbitration\x20references\x20(308)\x20—\x20for\x20deposit\x20disputes'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['order_allocators\x20must\x20be\x20set','machine\x20recommended\x20(rental\x20workflow\x20with\x20deposit/return\x20stages)','arbitrations\x20recommended\x20(deposit\x20refund\x20disputes)'],'common_patterns':['Machine\x20workflow\x20with\x20\x27Deposit\x20→\x20Use\x20→\x20Return\x20→\x20Refund\x27\x20nodes','compensation_fund\x20holds\x20deposit\x20guarantees','buy_guard\x20verifies\x20renter\x20identity/KYC','stock=1\x20per\x20rental\x20item\x20(unique\x20items)'],'recommended_templates':['T-S-02','T-S-04']},{'id':'service_subscription','name':'Subscription\x20Service\x20(recurring)','category':'subscription','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['bind/unbind\x20the\x20UM\x20Contact','builder\x20(transfer)'],'admin_operations':['update\x20the\x20description','set\x20the\x20location/URL'],'permission_index_operations':['publish\x20the\x20Service\x20(311)','add/set\x20sales\x20items\x20(305)','issue\x20discount\x20coupons\x20(312)\x20—\x20promotional\x20rates','add\x20Reward\x20references\x20(318)\x20—\x20loyalty\x20rewards'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['order_allocators\x20must\x20be\x20set'],'common_patterns':['Tiered\x20plans\x20(Free/Pro/Enterprise)\x20as\x20sales[]','Discount\x20coupons\x20for\x20trial\x20periods','Rewards\x20for\x20long-term\x20subscribers','Renewal\x20handled\x20by\x20repeat\x20orders\x20(no\x20native\x20recurring\x20billing)'],'recommended_templates':['T-S-03']},{'id':'service_workflow','name':'Workflow-bound\x20Service\x20(machine-bound)','category':'workflow','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['bind/unbind\x20the\x20UM\x20Contact','builder\x20(transfer)'],'admin_operations':['update\x20the\x20description','set\x20the\x20location/URL'],'permission_index_operations':['bind\x20the\x20Machine\x20workflow\x20(306)','publish\x20the\x20Service\x20(311)','set\x20the\x20order_allocators\x20strategy\x20(313)'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['order_allocators\x20must\x20be\x20set','machine\x20must\x20be\x20published\x20before\x20binding','machine\x20recommended\x20for\x20any\x20multi-stage\x20service\x20delivery'],'common_patterns':['Machine\x20defines\x20Pay\x20→\x20Confirm\x20→\x20Deliver\x20→\x20Sign-off\x20nodes','Progress\x20created\x20per\x20order\x20(stage\x206\x20of\x20buy\x20flow)','Named\x20operators\x20assigned\x20per\x20Forward\x20in\x20Machine','Service.paused\x20does\x20NOT\x20affect\x20already-created\x20Progress\x20(existing\x20orders\x20continue)'],'recommended_templates':['T-S-04']},{'id':'service_arbitration','name':'Arbitration-bound\x20Service\x20(dispute-ready)','category':'arbitration','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['bind/unbind\x20the\x20UM\x20Contact','builder\x20(transfer)'],'admin_operations':['update\x20the\x20description'],'permission_index_operations':['add\x20Arbitration\x20references\x20(308)','deposit\x20to\x20the\x20compensation_fund\x20(315)','extend\x20setting_lock_duration\x20(317)','publish\x20the\x20Service\x20(311)'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['If\x20compensation_fund\x20>\x200,\x20arbitrations\x20must\x20be\x20non-empty\x20(F-S-19)','Arbitration\x20objects\x20must\x20be\x20created\x20before\x20binding','compensation_fund_add\x20before\x20publish\x20recommended\x20(else\x20post-publish\x20deposit\x20still\x20possible)'],'common_patterns':['2-3\x20Arbitration\x20objects\x20(different\x20arb\x20committees\x20for\x20different\x20dispute\x20types)','compensation_fund\x20deposited\x20as\x20%\x20of\x20expected\x20order\x20volume','setting_lock_duration\x20extended\x20by\x20owner\x20to\x20build\x20customer\x20trust','Arbitration\x20compensation\x20payout\x20triggered\x20by\x20the\x20arbitration\x20result\x20(not\x20by\x20Service\x20directly)'],'recommended_templates':['T-S-05','T-S-06']},{'id':'service_compensation_fund','name':'Compensation\x20Fund\x20Service\x20(embedded\x20balance)','category':'compensation_fund','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['bind/unbind\x20the\x20UM\x20Contact','builder\x20(transfer)'],'admin_operations':['update\x20the\x20description'],'permission_index_operations':['deposit\x20to\x20the\x20compensation_fund\x20(315)','withdraw\x20from\x20the\x20compensation_fund\x20(314)\x20—\x20time-locked\x20after\x20publish','receive\x20the\x20compensation_fund\x20payout\x20(316)\x20—\x20arbitration\x20payout\x20(always\x20mutable)','extend\x20setting_lock_duration\x20(317)\x20—\x20extend\x20lock'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['compensation_fund\x20>\x200\x20→\x20arbitrations\x20non-empty\x20(F-S-19)','compensation_fund\x20coin\x20type\x20must\x20match\x20Service<T>\x20type\x20parameter'],'common_patterns':['Fund\x20inflow:\x20compensation_fund_add\x20(315)\x20—\x20always\x20mutable','Fund\x20outflow:\x20compensation_fund_withdraw\x20(314)\x20—\x20requires\x20bPaused\x20+\x20lock_duration\x20expired','Fund\x20receive:\x20compensation_fund_receive\x20(316)\x20—\x20arbitration\x20payout,\x20always\x20mutable','Fund\x20consumer:\x20arbitration\x20compensation\x20payout\x20(driven\x20by\x20arb\x20result)','Distinct\x20from\x20Treasury:\x20Service-internal,\x20arbitration-bound,\x20lock-protected'],'recommended_templates':['T-S-06']},{'id':'service_reward','name':'Reward-attached\x20Service\x20(marketing)','category':'reward','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['bind/unbind\x20the\x20UM\x20Contact','builder\x20(transfer)'],'admin_operations':['update\x20the\x20description'],'permission_index_operations':['add/remove/clear\x20Reward\x20references\x20(318)\x20—\x20add\x20always\x20mutable;\x20remove/clear\x20time-locked\x20after\x20publish','issue/destroy\x20discount\x20coupons\x20(312)','publish\x20the\x20Service\x20(311)'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['order_allocators\x20must\x20be\x20set'],'common_patterns':['Rewards\x20added\x20post-publish\x20(always\x20allowed;\x20remove/clear\x20is\x20time-locked\x20after\x20publish)','Reward\x20objects\x20must\x20exist\x20before\x20binding\x20(queryObjectsWithType\x20validation)','MAX_REWARD_COUNT\x20=\x2020\x20per\x20Service','Reward\x20remove/clear\x20requires\x20Service\x20paused\x20+\x20setting_lock_duration\x20elapsed\x20(protects\x20customer\x20expectations)'],'recommended_templates':['T-S-08']},{'id':'service_arbitration_binding','name':'Arbitration\x20Binding\x20Service\x20(post-publish\x20immutable)','category':'arbitration','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['bind/unbind\x20the\x20UM\x20Contact','builder\x20(transfer)'],'admin_operations':['update\x20the\x20description'],'permission_index_operations':['add\x20Arbitration\x20references\x20(308)\x20—\x20pre-publish\x20only','remove\x20an\x20Arbitration\x20reference\x20(308)\x20—\x20pre-publish\x20only','clear\x20Arbitration\x20references\x20(308)\x20—\x20pre-publish\x20only','publish\x20the\x20Service\x20(311)'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['MAX_ARBITRATION_COUNT\x20=\x2020\x20per\x20Service\x20(F-S-04)','Each\x20Arbitration\x20object\x20must\x20be\x20valid\x20(queryObjectsWithType\x20validation)','Arbitration\x20bound\x20=\x20locked\x20post-publish\x20(F-S-21).\x20To\x20change:\x20create\x20new\x20Service.'],'common_patterns':['Pre-publish:\x20set\x201-3\x20Arbitration\x20objects\x20for\x20different\x20dispute\x20scopes','Post-publish:\x20immutable\x20—\x20clone\x20Service\x20if\x20change\x20needed','⚠️\x20Data\x20inconsistency:\x20dynamic-pricing.ts\x20marks\x20arbitrations\x20as\x20mutable,\x20but\x20SDK\x20blocks\x20it\x20(F-S-21)'],'recommended_templates':['T-S-05']},{'id':'service_buy_guard','name':'Buy\x20Guard\x20Service\x20(post-publish\x20mutable\x20guard)','category':'buy_guard','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['bind/unbind\x20the\x20UM\x20Contact','builder\x20(transfer)'],'admin_operations':['update\x20the\x20description'],'permission_index_operations':['bind\x20the\x20buy_guard\x20Guard\x20(307)','clear\x20the\x20buy_guard\x20Guard\x20(307)','publish\x20the\x20Service\x20(311)'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['order_allocators\x20must\x20be\x20set'],'common_patterns':['Pre-sale\x20phase:\x20buy_guard\x20=\x20whitelist\x20Guard\x20(KYC\x20verified\x20buyers\x20only)','Public\x20sale:\x20buy_guard\x20=\x20null\x20(anyone\x20can\x20buy)','Restricted\x20phase:\x20buy_guard\x20=\x20KYC\x20Guard\x20(compliance)','⚠️\x20buy_guard\x20is\x20the\x20ONLY\x20publish-locked-field\x20exception\x20—\x20still\x20mutable\x20post-publish','buy_guard\x20verification\x20happens\x20at\x20Stage\x201\x20of\x20buy\x20flow\x20(pre_check)'],'recommended_templates':['T-S-01']},{'id':'service_order_allocator','name':'Order\x20Allocator\x20Service\x20(fund\x20distribution\x20config)','category':'order_allocator','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['bind/unbind\x20the\x20UM\x20Contact','builder\x20(transfer)'],'admin_operations':['update\x20the\x20description'],'permission_index_operations':['set\x20the\x20order_allocators\x20strategy\x20(313)\x20—\x20pre-publish\x20only','publish\x20the\x20Service\x20(311)\x20—\x20requires\x20order_allocators\x20(F-S-18)'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['order_allocators\x20MUST\x20be\x20set\x20(F-S-18,\x20E_NO_ALLOCATOR)','Allocators.sharing.who\x20can\x20reference\x20Treasury\x20addresses\x20(indirect\x20Treasury\x20binding)','MAX_SHARING_COUNT\x20=\x20100\x20per\x20allocator'],'common_patterns':['Multi-party\x20split:\x20merchant\x2080%\x20/\x20platform\x2010%\x20/\x20logistics\x2010%','Threshold-based:\x20different\x20allocators\x20for\x20different\x20order\x20sizes','Guard-bound\x20allocator:\x20allocation\x20execution\x20requires\x20Guard\x20verification','Post-publish\x20immutable\x20—\x20clone\x20Service\x20to\x20change\x20allocation\x20strategy'],'recommended_templates':['T-S-08']},{'id':'service_dynamic_pricing','name':'Dynamic\x20Pricing\x20Service\x20(discount-driven)','category':'dynamic_pricing','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['bind/unbind\x20the\x20UM\x20Contact','builder\x20(transfer)'],'admin_operations':['update\x20the\x20description'],'permission_index_operations':['issue\x20discount\x20coupons\x20(312)','add/set\x20sales\x20items\x20(305)\x20—\x20adjust\x20base\x20prices','remove\x20sales\x20items\x20(305)\x20—\x20remove\x20deprecated\x20SKUs'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['order_allocators\x20must\x20be\x20set'],'common_patterns':['Discount\x20types:\x200=rates\x20(basis\x20points,\x20per\x2010000),\x201=minus\x20(direct\x20deduction)','MAX_DISCOUNT_COUNT_ONCE\x20=\x201000\x20per\x20issue\x20call','MAX_DISCOUNT_RECEIVER_ONCE\x20=\x201000\x20receivers\x20per\x20call','MAX_DISCOUNT_TOTAL_COUNT\x20=\x2020000\x20total\x20coupons','discount_destroy:\x20holder-only\x20(no\x20SERVICE_DISCOUNT\x20permission\x20needed)'],'recommended_templates':['T-S-07']},{'id':'service_multi_allocator','name':'Multi-Allocator\x20Service\x20(tiered\x20fund\x20distribution)','category':'multi_allocator','permission_index_range':'300-320','builtin_indexes':SERVICE_PERMISSIONS,'cross_object_bindings':SERVICE_CROSS_OBJECT_BINDINGS,'order_flow_stages':SERVICE_ORDER_FLOW_STAGES,'owner_operations':['bind/unbind\x20the\x20UM\x20Contact','builder\x20(transfer)'],'admin_operations':['update\x20the\x20description'],'permission_index_operations':['set\x20the\x20order_allocators\x20strategy\x20(313)\x20—\x20pre-publish\x20only','publish\x20the\x20Service\x20(311)'],'mutable_after_publish':{'machine':![],'arbitrations':![],'order_allocators':![],'buy_guard':!![],'rewards':'locked_by_duration','compensation_fund_withdraw':'locked_by_duration','compensation_fund_receive':'mutable','sales':!![],'description':!![],'location':!![],'repositories':!![],'customer_required':!![],'discount':!![],'um':!![],'pause':!![]},'publish_prerequisites':['order_allocators\x20MUST\x20be\x20set','Each\x20allocator\x20has\x20its\x20own\x20Guard\x20+\x20sharing\x20+\x20threshold','First-match-wins:\x20first\x20allocator\x20whose\x20threshold\x20is\x20met\x20handles\x20the\x20order'],'common_patterns':['Tier\x201\x20(small\x20orders):\x20single-recipient\x20allocator\x20(low\x20fee)','Tier\x202\x20(medium\x20orders):\x20two-recipient\x20split\x20(merchant\x20+\x20platform)','Tier\x203\x20(large\x20orders):\x20three-recipient\x20split\x20(merchant\x20+\x20platform\x20+\x20logistics)','Each\x20tier\x20can\x20have\x20its\x20own\x20Guard\x20for\x20execution\x20authorization'],'recommended_templates':['T-S-08']}];export const SERVICE_LEDGER_VERSION='1.0.0';export function getScenesByCategory(a){return SERVICE_SCENES['filter'](b=>b['category']===a);}export function findSceneById(a){return SERVICE_SCENES['find'](b=>b['id']===a);}export function getServicePermissionByIndex(a){return SERVICE_PERMISSIONS['find'](b=>b['index']===a);}export function isServicePermission(a){return getServicePermissionByIndex(a)!==undefined;}export function getPermissionsByMutability(a){return SERVICE_PERMISSIONS['filter'](b=>b['post_publish_mutability']===a);}export function getImmutablePostPublishPermissions(){return SERVICE_PERMISSIONS['filter'](a=>a['post_publish_mutability']==='immutable'||a['post_publish_mutability']==='one_shot');}export function getLockedByDurationPermissions(){return SERVICE_PERMISSIONS['filter'](a=>a['post_publish_mutability']==='locked_by_duration');}export function inferSceneFromIntent(a){const b=a['toLowerCase'](),c=[['retail','retail'],['ecommerce','retail'],['rental','rental'],['rent','rental'],['short-term\x20rental','rental'],['long-term\x20rental','rental'],['subscription','subscription'],['subscribe','subscription'],['workflow','workflow'],['machine-bound','workflow'],['arbitration','arbitration'],['dispute','arbitration'],['compensation','compensation_fund'],['compensation_fund','compensation_fund'],['reward','reward'],['marketing','reward'],['buy_guard','buy_guard'],['kyc','buy_guard'],['whitelist','buy_guard'],['allocator','order_allocator'],['discount','dynamic_pricing'],['coupon','dynamic_pricing'],['multi-allocator','multi_allocator'],['tiered','multi_allocator']];for(const [d,e]of c){if(b['includes'](d)){const f=getScenesByCategory(e);if(f['length']>0x0)return f[0x0];}}if(b['includes']('service'))return findSceneById('service_retail');return undefined;}export function getAllServiceScenes(){return[...SERVICE_SCENES];}export function getServiceScenesCount(){return SERVICE_SCENES['length'];}export function getServicePermissionsCount(){return SERVICE_PERMISSIONS['length'];}export function getOrderFlowStage(a){return SERVICE_ORDER_FLOW_STAGES['find'](b=>b['stage']===a);}export function getCrossObjectBindings(){return[...SERVICE_CROSS_OBJECT_BINDINGS];}
@@ -32,7 +32,7 @@ export interface ServicePermissionAllocatorPuzzle {
32
32
  treasury_addresses_referenced: string[];
33
33
  }
34
34
  export interface ServiceGuardProtectionPuzzle {
35
- buy_guard_set: boolean;
35
+ buy_guard_bound: boolean;
36
36
  buy_guard_address?: string;
37
37
  buy_guard_post_publish_mutable: boolean;
38
38
  allocators_guards_count: number;
@@ -144,7 +144,7 @@ export declare function initPuzzleFromIntent(intent: Partial<ServiceIntentPuzzle
144
144
  export declare function checkPuzzleCompleteness(puzzle: ServicePuzzle): ServicePuzzleCompleteness;
145
145
  export interface ServiceConstraintViolation {
146
146
  constraint_id: string;
147
- severity: "CRITICAL" | "HIGH" | "MEDIUM" | "LOW";
147
+ severity: "critical" | "high" | "medium" | "low";
148
148
  message: string;
149
149
  current_value?: string | number;
150
150
  limit?: string | number;
@@ -1 +1 @@
1
- import{MAX_SALE_COUNT,MAX_REPOSITORY_COUNT,MAX_ARBITRATION_COUNT,MAX_DISCOUNT_COUNT_ONCE,MAX_DISCOUNT_TOTAL_COUNT,MAX_REQUIRED_INFO_SIZE,MAX_WIP_LENGTH,MAX_WIP_HASH_LENGTH}from'@wowok/wowok';export function initPuzzleFromIntent(a){const b={};return(a['action']||a['primary_goal'])&&(b['intent']={'action':a['action']??'create','business_scenario':a['business_scenario']??'general','lifecycle_phase':a['lifecycle_phase']??'draft','primary_goal':a['primary_goal']??'','failure_conditions':a['failure_conditions']??[]}),b['constraints']={'F_S_01_description_length_le_4000':!![],'F_S_02_sales_count_le_50':!![],'F_S_03_repositories_count_le_100':!![],'F_S_04_arbitrations_count_le_20':!![],'F_S_05_rewards_count_le_20':!![],'F_S_06_customer_required_count_le_10':!![],'F_S_07_customer_required_each_le_20':!![],'F_S_08_discount_once_le_1000':!![],'F_S_09_discount_receivers_le_1000':!![],'F_S_10_discount_total_le_20000':!![],'F_S_11_wip_url_length_le_1024':!![],'F_S_12_wip_hash_length_le_64':!![],'F_S_13_wip_hash_not_empty':!![],'F_S_14_quote_stock_sufficient':!![],'F_S_15_quote_sale_not_suspended':!![],'F_S_16_buy_requires_published':!![],'F_S_17_buy_requires_not_paused':!![],'F_S_18_publish_requires_order_allocators':!![],'F_S_19_publish_compensation_fund_requires_arbitrations':!![],'F_S_20_machine_immutable_post_publish':!![],'F_S_21_arbitrations_immutable_post_publish':!![],'F_S_22_order_allocators_immutable_post_publish':!![],'F_S_23_bPublished_irreversible':!![],'F_S_24_setting_lock_duration_only_increases':!![],'F_S_25_compensation_fund_withdraw_locked_by_duration':!![],'F_S_26_compensation_fund_withdraw_requires_paused':!![],'F_S_27_quote_deducts_stock_side_effect':!![],'F_S_28_order_service_must_match':!![],'F_S_29_order_one_to_one_with_service':!![],'F_S_30_permission_indexes_300_to_320':!![]},b;}export function checkPuzzleCompleteness(a){const b=[],c=[];if(!a['intent'])b['push']('A'),c['push']({'dimension':'A','reason':'Intent\x20not\x20specified\x20(action\x20+\x20primary_goal)'});else!a['intent']['primary_goal']&&(b['push']('A'),c['push']({'dimension':'A','reason':'primary_goal\x20is\x20empty'}));if(!a['binding'])b['push']('B'),c['push']({'dimension':'B','reason':'Binding\x20not\x20specified\x20(coin_type\x20+\x20permission\x20+\x20owner)'});else(!a['binding']['coin_type']||!a['binding']['permission']||!a['binding']['owner'])&&(b['push']('B'),c['push']({'dimension':'B','reason':'coin_type\x20/\x20permission\x20/\x20owner\x20missing'}));return!a['permission_allocator']&&a['intent']?.['action']==='create'&&(b['push']('C'),c['push']({'dimension':'C','reason':'Permission/allocator\x20config\x20not\x20specified'})),!a['guard_protection']&&(b['push']('D'),c['push']({'dimension':'D','reason':'Guard\x20protection\x20not\x20enumerated'})),!a['dispute_handling']&&a['intent']?.['action']==='publish'&&(b['push']('E'),c['push']({'dimension':'E','reason':'Dispute\x20handling\x20not\x20configured\x20(needed\x20for\x20publish)'})),!a['constraints']&&(b['push']('F'),c['push']({'dimension':'F','reason':'Constraints\x20not\x20checked'})),{'dimensions':['A','B','C','D','E','F'],'missing':b,'missing_details':c,'complete':b['length']===0x0,'next_step':b['length']===0x0?'Puzzle\x20complete\x20—\x20ready\x20for\x20confirmation\x20text\x20generation':'Next:\x20complete\x20dimension\x20'+b[0x0]+'\x20—\x20'+c[0x0]['reason']};}export function validateConstraints(a){const b=[];if(!a['constraints'])return b;const d=a['constraints'],e=[[!d['F_S_02_sales_count_le_50'],'F-S-02','CRITICAL','sales\x20count',MAX_SALE_COUNT],[!d['F_S_03_repositories_count_le_100'],'F-S-03','HIGH','repositories\x20count',MAX_REPOSITORY_COUNT],[!d['F_S_04_arbitrations_count_le_20'],'F-S-04','HIGH','arbitrations\x20count',MAX_ARBITRATION_COUNT],[!d['F_S_05_rewards_count_le_20'],'F-S-05','MEDIUM','rewards\x20count',0x14],[!d['F_S_06_customer_required_count_le_10'],'F-S-06','MEDIUM','customer_required\x20count',0xa],[!d['F_S_07_customer_required_each_le_20'],'F-S-07','LOW','customer_required\x20item\x20length',MAX_REQUIRED_INFO_SIZE],[!d['F_S_08_discount_once_le_1000'],'F-S-08','MEDIUM','discount\x20count\x20(once)',MAX_DISCOUNT_COUNT_ONCE],[!d['F_S_10_discount_total_le_20000'],'F-S-10','MEDIUM','discount\x20total\x20count',MAX_DISCOUNT_TOTAL_COUNT],[!d['F_S_11_wip_url_length_le_1024'],'F-S-11','HIGH','wip\x20URL\x20length',MAX_WIP_LENGTH],[!d['F_S_12_wip_hash_length_le_64'],'F-S-12','HIGH','wip_hash\x20length',MAX_WIP_HASH_LENGTH],[!d['F_S_13_wip_hash_not_empty'],'F-S-13','CRITICAL','wip_hash\x20empty',undefined],[!d['F_S_18_publish_requires_order_allocators'],'F-S-18','CRITICAL','publish\x20without\x20order_allocators',undefined],[!d['F_S_19_publish_compensation_fund_requires_arbitrations'],'F-S-19','CRITICAL','publish\x20with\x20compensation_fund\x20>\x200\x20but\x20no\x20arbitrations',undefined]];for(const [f,g,h,i,j]of e){f&&b['push']({'constraint_id':g,'severity':h,'message':i+'\x20violates\x20'+g,'limit':j});}return b;}export function generateConfirmationText(a){const c=[];c['push']('═══\x20Service\x20Confirmation\x20═══'),c['push']('');if(a['intent']){c['push']('Action:\x20'+a['intent']['action']),c['push']('Scenario:\x20'+a['intent']['business_scenario']),c['push']('Lifecycle:\x20'+a['intent']['lifecycle_phase']),c['push']('Goal:\x20'+a['intent']['primary_goal']);if(a['intent']['failure_conditions']['length']>0x0){c['push']('Failure\x20conditions:');for(const e of a['intent']['failure_conditions'])c['push']('\x20\x20-\x20'+e);}c['push']('');}if(a['binding']){c['push']('─\x20Binding\x20──────────────'),c['push']('Coin\x20type:\x20'+a['binding']['coin_type']),c['push']('Permission:\x20'+a['binding']['permission']),c['push']('Owner:\x20'+a['binding']['owner']),c['push']('Admins\x20('+a['binding']['admins']['length']+'):\x20'+a['binding']['admins']['join'](',\x20'));if(a['binding']['um']!==undefined)c['push']('UM:\x20'+(a['binding']['um']??'(none)'));if(a['binding']['machine']!==undefined)c['push']('Machine:\x20'+(a['binding']['machine']??'(none)')+'\x20'+(a['intent']?.['lifecycle_phase']==='published'?'[LOCKED]':''));if(a['binding']['buy_guard']!==undefined)c['push']('Buy\x20Guard:\x20'+(a['binding']['buy_guard']??'(none)')+'\x20[mutable\x20post-publish]');if(a['binding']['order_allocators']!==undefined)c['push']('Order\x20Allocators:\x20'+(a['binding']['order_allocators']?'configured':'(none)')+'\x20'+(a['intent']?.['lifecycle_phase']==='published'?'[LOCKED]':''));c['push']('Arbitrations\x20('+a['binding']['arbitrations']['length']+'):\x20'+a['binding']['arbitrations']['join'](',\x20')),c['push']('Rewards\x20('+a['binding']['rewards']['length']+')'),c['push']('Repositories\x20('+a['binding']['repositories']['length']+')'),c['push']('Compensation\x20fund:\x20'+a['binding']['compensation_fund_balance']),c['push']('Setting\x20lock\x20duration:\x20'+a['binding']['setting_lock_duration']+'\x20ms'),c['push']('');}if(a['permission_allocator']){c['push']('─\x20Permission\x20/\x20Allocators\x20──────────────'),c['push']('Permission\x20indexes\x20used\x20('+a['permission_allocator']['permission_indexes_used']['length']+'):');for(const f of a['permission_allocator']['permission_indexes_used']){c['push']('\x20\x20['+f['index']+']\x20'+f['name']+':\x20'+f['description']);}c['push']('Allocators\x20configured:\x20'+a['permission_allocator']['allocators_configured']),a['permission_allocator']['allocators_summary']&&c['push']('Allocators\x20summary:\x20'+a['permission_allocator']['allocators_summary']),c['push']('');}a['guard_protection']&&(c['push']('─\x20Guard\x20Protection\x20──────────────'),c['push']('Buy\x20guard\x20set:\x20'+a['guard_protection']['buy_guard_set']),a['guard_protection']['buy_guard_address']&&c['push']('Buy\x20guard:\x20'+a['guard_protection']['buy_guard_address']),c['push']('Buy\x20guard\x20post-publish\x20mutable:\x20'+a['guard_protection']['buy_guard_post_publish_mutable']),c['push']('Allocators\x20guards:\x20'+a['guard_protection']['allocators_guards_count']),c['push']('Repository\x20guards:\x20'+a['guard_protection']['repository_guards_count']),c['push'](''));if(a['dispute_handling']){c['push']('─\x20Dispute\x20Handling\x20──────────────'),c['push']('Arbitrations:\x20'+a['dispute_handling']['arbitrations_count']),c['push']('Compensation\x20fund:\x20'+a['dispute_handling']['compensation_fund_balance']),c['push']('Setting\x20lock\x20duration:\x20'+a['dispute_handling']['setting_lock_duration_ms']+'\x20ms\x20(only-increase:\x20'+a['dispute_handling']['setting_lock_duration_can_only_increase']+')'),c['push']('Publish\x20prerequisites\x20met:\x20'+a['dispute_handling']['publish_prerequisites_met']);if(a['dispute_handling']['publish_blockers']['length']>0x0){c['push']('Publish\x20blockers:');for(const g of a['dispute_handling']['publish_blockers'])c['push']('\x20\x20-\x20'+g);}c['push']('');}const d=validateConstraints(a);if(d['length']>0x0){c['push']('─\x20Constraint\x20Violations\x20──────────────');for(const h of d)c['push']('\x20\x20['+h['severity']+']\x20'+h['constraint_id']+':\x20'+h['message']);c['push']('');}return c['join']('\x0a');}export function initOrderFlowPuzzle(a,b){return{'stage_1_pre_check':{'bPublished':![],'bPaused':![],'ready':![]},'stage_2_wip_verify':{'items_count':a,'wip_verified':![],'wip_hash_mismatches':[]},'stage_3_quote':{'items_quoted':0x0,'stock_sufficient':![],'discount_applied':![],'total_pay':'0'},'stage_4_create_order':{'order_created':![],'passport_used':![]},'stage_5_create_allocation':{'allocation_created':![],'allocators_configured':![]},'stage_6_create_progress':{'progress_created':![],'machine_bound':b},'stage_7_post_actions':{'agents_set':![],'required_info_set':![],'transfer_set':![]},'stage_8_return_result':{}};}export function checkOrderFlowCompleteness(a){const b=[];if(!a['stage_1_pre_check']['ready'])b['push']('Stage\x201\x20pre_check\x20failed:\x20bPublished\x20&&\x20!bPaused\x20required');if(!a['stage_2_wip_verify']['wip_verified'])b['push']('Stage\x202\x20wip_verify\x20failed:\x20WIP\x20hash\x20mismatch');if(a['stage_2_wip_verify']['wip_hash_mismatches']['length']>0x0)b['push']('Stage\x202\x20mismatched\x20items:\x20'+a['stage_2_wip_verify']['wip_hash_mismatches']['join'](',\x20'));if(!a['stage_3_quote']['stock_sufficient'])b['push']('Stage\x203\x20quote\x20failed:\x20stock\x20insufficient');if(!a['stage_4_create_order']['order_created'])b['push']('Stage\x204\x20create_order\x20failed');if(!a['stage_5_create_allocation']['allocation_created'])b['push']('Stage\x205\x20create_allocation\x20failed\x20(allocators\x20not\x20configured?)');return a['stage_6_create_progress']['machine_bound']&&!a['stage_6_create_progress']['progress_created']&&b['push']('Stage\x206\x20create_progress\x20failed\x20(machine\x20bound\x20but\x20progress\x20not\x20created)'),{'complete':b['length']===0x0,'blockers':b};}
1
+ import{MAX_SALE_COUNT,MAX_REPOSITORY_COUNT,MAX_ARBITRATION_COUNT,MAX_DISCOUNT_COUNT_ONCE,MAX_DISCOUNT_TOTAL_COUNT,MAX_REQUIRED_INFO_SIZE,MAX_WIP_LENGTH,MAX_WIP_HASH_LENGTH}from'@wowok/wowok';export function initPuzzleFromIntent(a){const b={};return(a['action']||a['primary_goal'])&&(b['intent']={'action':a['action']??'create','business_scenario':a['business_scenario']??'general','lifecycle_phase':a['lifecycle_phase']??'draft','primary_goal':a['primary_goal']??'','failure_conditions':a['failure_conditions']??[]}),b['constraints']={'F_S_01_description_length_le_4000':!![],'F_S_02_sales_count_le_50':!![],'F_S_03_repositories_count_le_100':!![],'F_S_04_arbitrations_count_le_20':!![],'F_S_05_rewards_count_le_20':!![],'F_S_06_customer_required_count_le_10':!![],'F_S_07_customer_required_each_le_20':!![],'F_S_08_discount_once_le_1000':!![],'F_S_09_discount_receivers_le_1000':!![],'F_S_10_discount_total_le_20000':!![],'F_S_11_wip_url_length_le_1024':!![],'F_S_12_wip_hash_length_le_64':!![],'F_S_13_wip_hash_not_empty':!![],'F_S_14_quote_stock_sufficient':!![],'F_S_15_quote_sale_not_suspended':!![],'F_S_16_buy_requires_published':!![],'F_S_17_buy_requires_not_paused':!![],'F_S_18_publish_requires_order_allocators':!![],'F_S_19_publish_compensation_fund_requires_arbitrations':!![],'F_S_20_machine_immutable_post_publish':!![],'F_S_21_arbitrations_immutable_post_publish':!![],'F_S_22_order_allocators_immutable_post_publish':!![],'F_S_23_bPublished_irreversible':!![],'F_S_24_setting_lock_duration_only_increases':!![],'F_S_25_compensation_fund_withdraw_locked_by_duration':!![],'F_S_26_compensation_fund_withdraw_requires_paused':!![],'F_S_27_quote_deducts_stock_side_effect':!![],'F_S_28_order_service_must_match':!![],'F_S_29_order_one_to_one_with_service':!![],'F_S_30_permission_indexes_300_to_320':!![]},b;}export function checkPuzzleCompleteness(a){const b=[],c=[];if(!a['intent'])b['push']('A'),c['push']({'dimension':'A','reason':'Intent\x20not\x20specified\x20(action\x20+\x20primary_goal)'});else!a['intent']['primary_goal']&&(b['push']('A'),c['push']({'dimension':'A','reason':'primary_goal\x20is\x20empty'}));if(!a['binding'])b['push']('B'),c['push']({'dimension':'B','reason':'Binding\x20not\x20specified\x20(coin_type\x20+\x20permission\x20+\x20owner)'});else(!a['binding']['coin_type']||!a['binding']['permission']||!a['binding']['owner'])&&(b['push']('B'),c['push']({'dimension':'B','reason':'coin_type\x20/\x20permission\x20/\x20owner\x20missing'}));return!a['permission_allocator']&&a['intent']?.['action']==='create'&&(b['push']('C'),c['push']({'dimension':'C','reason':'Permission/allocator\x20config\x20not\x20specified'})),!a['guard_protection']&&(b['push']('D'),c['push']({'dimension':'D','reason':'Guard\x20protection\x20not\x20enumerated'})),!a['dispute_handling']&&a['intent']?.['action']==='publish'&&(b['push']('E'),c['push']({'dimension':'E','reason':'Dispute\x20handling\x20not\x20configured\x20(needed\x20for\x20publish)'})),!a['constraints']&&(b['push']('F'),c['push']({'dimension':'F','reason':'Constraints\x20not\x20checked'})),{'dimensions':['A','B','C','D','E','F'],'missing':b,'missing_details':c,'complete':b['length']===0x0,'next_step':b['length']===0x0?'Puzzle\x20complete\x20—\x20ready\x20for\x20confirmation\x20text\x20generation':'Next:\x20complete\x20dimension\x20'+b[0x0]+'\x20—\x20'+c[0x0]['reason']};}export function validateConstraints(a){const b=[];if(!a['constraints'])return b;const d=a['constraints'],e=[[!d['F_S_02_sales_count_le_50'],'F-S-02','critical','sales\x20count',MAX_SALE_COUNT],[!d['F_S_03_repositories_count_le_100'],'F-S-03','high','repositories\x20count',MAX_REPOSITORY_COUNT],[!d['F_S_04_arbitrations_count_le_20'],'F-S-04','high','arbitrations\x20count',MAX_ARBITRATION_COUNT],[!d['F_S_05_rewards_count_le_20'],'F-S-05','medium','rewards\x20count',0x14],[!d['F_S_06_customer_required_count_le_10'],'F-S-06','medium','customer_required\x20count',0xa],[!d['F_S_07_customer_required_each_le_20'],'F-S-07','low','customer_required\x20item\x20length',MAX_REQUIRED_INFO_SIZE],[!d['F_S_08_discount_once_le_1000'],'F-S-08','medium','discount\x20count\x20(once)',MAX_DISCOUNT_COUNT_ONCE],[!d['F_S_10_discount_total_le_20000'],'F-S-10','medium','discount\x20total\x20count',MAX_DISCOUNT_TOTAL_COUNT],[!d['F_S_11_wip_url_length_le_1024'],'F-S-11','high','wip\x20URL\x20length',MAX_WIP_LENGTH],[!d['F_S_12_wip_hash_length_le_64'],'F-S-12','high','wip_hash\x20length',MAX_WIP_HASH_LENGTH],[!d['F_S_13_wip_hash_not_empty'],'F-S-13','critical','wip_hash\x20empty',undefined],[!d['F_S_18_publish_requires_order_allocators'],'F-S-18','critical','publish\x20without\x20order_allocators',undefined],[!d['F_S_19_publish_compensation_fund_requires_arbitrations'],'F-S-19','critical','publish\x20with\x20compensation_fund\x20>\x200\x20but\x20no\x20arbitrations',undefined]];for(const [f,g,h,i,j]of e){f&&b['push']({'constraint_id':g,'severity':h,'message':i+'\x20violates\x20'+g,'limit':j});}return b;}export function generateConfirmationText(a){const c=[];c['push']('═══\x20Service\x20Confirmation\x20═══'),c['push']('');if(a['intent']){c['push']('Action:\x20'+a['intent']['action']),c['push']('Scenario:\x20'+a['intent']['business_scenario']),c['push']('Lifecycle:\x20'+a['intent']['lifecycle_phase']),c['push']('Goal:\x20'+a['intent']['primary_goal']);if(a['intent']['failure_conditions']['length']>0x0){c['push']('Failure\x20conditions:');for(const e of a['intent']['failure_conditions'])c['push']('\x20\x20-\x20'+e);}c['push']('');}if(a['binding']){c['push']('─\x20Binding\x20──────────────'),c['push']('Coin\x20type:\x20'+a['binding']['coin_type']),c['push']('Permission:\x20'+a['binding']['permission']),c['push']('Owner:\x20'+a['binding']['owner']),c['push']('Admins\x20('+a['binding']['admins']['length']+'):\x20'+a['binding']['admins']['join'](',\x20'));if(a['binding']['um']!==undefined)c['push']('UM:\x20'+(a['binding']['um']??'(none)'));if(a['binding']['machine']!==undefined)c['push']('Machine:\x20'+(a['binding']['machine']??'(none)')+'\x20'+(a['intent']?.['lifecycle_phase']==='published'?'[LOCKED]':''));if(a['binding']['buy_guard']!==undefined)c['push']('Buy\x20Guard:\x20'+(a['binding']['buy_guard']??'(none)')+'\x20[mutable\x20post-publish]');if(a['binding']['order_allocators']!==undefined)c['push']('Order\x20Allocators:\x20'+(a['binding']['order_allocators']?'configured':'(none)')+'\x20'+(a['intent']?.['lifecycle_phase']==='published'?'[LOCKED]':''));c['push']('Arbitrations\x20('+a['binding']['arbitrations']['length']+'):\x20'+a['binding']['arbitrations']['join'](',\x20')),c['push']('Rewards\x20('+a['binding']['rewards']['length']+')'),c['push']('Repositories\x20('+a['binding']['repositories']['length']+')'),c['push']('Compensation\x20fund:\x20'+a['binding']['compensation_fund_balance']),c['push']('Setting\x20lock\x20duration:\x20'+a['binding']['setting_lock_duration']+'\x20ms'),c['push']('');}if(a['permission_allocator']){c['push']('─\x20Permission\x20/\x20Allocators\x20──────────────'),c['push']('Permission\x20indexes\x20used\x20('+a['permission_allocator']['permission_indexes_used']['length']+'):');for(const f of a['permission_allocator']['permission_indexes_used']){c['push']('\x20\x20['+f['index']+']\x20'+f['name']+':\x20'+f['description']);}c['push']('Allocators\x20configured:\x20'+a['permission_allocator']['allocators_configured']),a['permission_allocator']['allocators_summary']&&c['push']('Allocators\x20summary:\x20'+a['permission_allocator']['allocators_summary']),c['push']('');}a['guard_protection']&&(c['push']('─\x20Guard\x20Protection\x20──────────────'),c['push']('Buy\x20guard\x20set:\x20'+a['guard_protection']['buy_guard_bound']),a['guard_protection']['buy_guard_address']&&c['push']('Buy\x20guard:\x20'+a['guard_protection']['buy_guard_address']),c['push']('Buy\x20guard\x20post-publish\x20mutable:\x20'+a['guard_protection']['buy_guard_post_publish_mutable']),c['push']('Allocators\x20guards:\x20'+a['guard_protection']['allocators_guards_count']),c['push']('Repository\x20guards:\x20'+a['guard_protection']['repository_guards_count']),c['push'](''));if(a['dispute_handling']){c['push']('─\x20Dispute\x20Handling\x20──────────────'),c['push']('Arbitrations:\x20'+a['dispute_handling']['arbitrations_count']),c['push']('Compensation\x20fund:\x20'+a['dispute_handling']['compensation_fund_balance']),c['push']('Setting\x20lock\x20duration:\x20'+a['dispute_handling']['setting_lock_duration_ms']+'\x20ms\x20(only-increase:\x20'+a['dispute_handling']['setting_lock_duration_can_only_increase']+')'),c['push']('Publish\x20prerequisites\x20met:\x20'+a['dispute_handling']['publish_prerequisites_met']);if(a['dispute_handling']['publish_blockers']['length']>0x0){c['push']('Publish\x20blockers:');for(const g of a['dispute_handling']['publish_blockers'])c['push']('\x20\x20-\x20'+g);}c['push']('');}const d=validateConstraints(a);if(d['length']>0x0){c['push']('─\x20Constraint\x20Violations\x20──────────────');for(const h of d)c['push']('\x20\x20['+h['severity']+']\x20'+h['constraint_id']+':\x20'+h['message']);c['push']('');}return c['join']('\x0a');}export function initOrderFlowPuzzle(a,b){return{'stage_1_pre_check':{'bPublished':![],'bPaused':![],'ready':![]},'stage_2_wip_verify':{'items_count':a,'wip_verified':![],'wip_hash_mismatches':[]},'stage_3_quote':{'items_quoted':0x0,'stock_sufficient':![],'discount_applied':![],'total_pay':'0'},'stage_4_create_order':{'order_created':![],'passport_used':![]},'stage_5_create_allocation':{'allocation_created':![],'allocators_configured':![]},'stage_6_create_progress':{'progress_created':![],'machine_bound':b},'stage_7_post_actions':{'agents_set':![],'required_info_set':![],'transfer_set':![]},'stage_8_return_result':{}};}export function checkOrderFlowCompleteness(a){const b=[];if(!a['stage_1_pre_check']['ready'])b['push']('Stage\x201\x20pre_check\x20failed:\x20bPublished\x20&&\x20!bPaused\x20required');if(!a['stage_2_wip_verify']['wip_verified'])b['push']('Stage\x202\x20wip_verify\x20failed:\x20WIP\x20hash\x20mismatch');if(a['stage_2_wip_verify']['wip_hash_mismatches']['length']>0x0)b['push']('Stage\x202\x20mismatched\x20items:\x20'+a['stage_2_wip_verify']['wip_hash_mismatches']['join'](',\x20'));if(!a['stage_3_quote']['stock_sufficient'])b['push']('Stage\x203\x20quote\x20failed:\x20stock\x20insufficient');if(!a['stage_4_create_order']['order_created'])b['push']('Stage\x204\x20create_order\x20failed');if(!a['stage_5_create_allocation']['allocation_created'])b['push']('Stage\x205\x20create_allocation\x20failed\x20(allocators\x20not\x20configured?)');return a['stage_6_create_progress']['machine_bound']&&!a['stage_6_create_progress']['progress_created']&&b['push']('Stage\x206\x20create_progress\x20failed\x20(machine\x20bound\x20but\x20progress\x20not\x20created)'),{'complete':b['length']===0x0,'blockers':b};}
@@ -1 +1 @@
1
- import{adaptNodeAnalyzer}from'../graph/onchain/index.js';import{assessServiceStateRisks}from'./service-risk.js';export const SERVICE_RISK_NODE_ANALYZER_ID='SR1';const STAKEHOLDER_ROLE={'owner':'merchant','provider':'merchant','customer':'buyer','arbitrator':'arbitrator','system':'system'},COPY={'R-S-4-05':{'title':()=>'Fulfillment\x20state:\x20Service\x20is\x20paused\x20(bPaused=true);\x20no\x20new\x20orders\x20can\x20be\x20placed\x20while\x20paused','detail':a=>'Shop\x20'+a+'\x20currently\x20has\x20bPaused=true:\x20the\x20merchant\x20paused\x20operations\x20voluntarily;\x20new\x20orders\x20cannot\x20be\x20submitted\x20until\x20it\x20resumes\x20(rule\x20R-S-4-05,\x20evidence\x20bPaused=true).','suggestion':'Ask\x20the\x20merchant\x20via\x20Messenger\x20when\x20operations\x20resume;\x20do\x20not\x20pay\x20for\x20orders\x20while\x20paused.'},'R-S-4-06':{'title':()=>'Fulfillment\x20state:\x20Service\x20is\x20unpublished\x20(draft),\x20invisible\x20to\x20the\x20market\x20and\x20order_new\x20will\x20fail','detail':a=>'Shop\x20'+a+'\x20currently\x20has\x20bPublished=false:\x20the\x20object\x20is\x20still\x20a\x20draft,\x20invisible\x20to\x20the\x20market,\x20and\x20any\x20order\x20attempt\x20fails\x20(rule\x20R-S-4-06,\x20evidence\x20bPublished=false).','suggestion':'Wait\x20for\x20the\x20merchant\x27s\x20official\x20publish\x20(publishing\x20is\x20irreversible\x20and\x20locks\x20the\x20config)\x20before\x20ordering;\x20a\x20draft\x20link\x20is\x20not\x20an\x20on-sale\x20promise.'},'R-S-5-05':{'title':()=>'Missing\x20payout\x20path:\x20compensation_fund\x20has\x20a\x20balance\x20but\x20no\x20Arbitration\x20is\x20bound','detail':(a,b)=>'Shop\x20'+a+'\x20has\x20compensation_fund\x20balance\x20but\x20empty\x20arbitrations:\x20payouts\x20require\x20dispute\x20->\x20ruling\x20->\x20arb_withdraw\x20to\x20claim,\x20'+('and\x20without\x20an\x20arbitration\x20binding\x20this\x20money\x20has\x20no\x20executable\x20claim\x20path\x20(rule\x20R-S-5-05,\x20evidence\x20'+(b['evidence']??'')+').'),'suggestion':'Require\x20the\x20merchant\x20to\x20bind\x20at\x20least\x20one\x20Arbitration\x20in\x20a\x20different\x20group\x20than\x20the\x20shop\x20Permission\x20before\x20ordering;\x20payout\x20promises\x20without\x20a\x20dispute\x20path\x20are\x20unenforceable.'}};export const serviceRiskNodeAnalyzer=adaptNodeAnalyzer({'id':SERVICE_RISK_NODE_ANALYZER_ID,'kind':'risk','objectType':'Service','inspect'(a){const b=a['raw'],c=b?.['data']??b;if(!c)return[];const e={};if(typeof c['bPaused']==='boolean')e['current_bPaused']=c['bPaused'];if(typeof c['bPublished']==='boolean')e['current_bPublished']=c['bPublished'];if(c['compensation_fund']!=null)e['current_compensation_fund_balance']=String(c['compensation_fund']);if(Array['isArray'](c['arbitrations']))e['current_arbitrations_count']=c['arbitrations']['length'];return assessServiceStateRisks(e)['map'](f=>{const g=COPY[f['id']];return{'severity':f['level']==='CRITICAL'||f['level']==='HIGH'?'high':f['level']==='MEDIUM'?'medium':'low','title':g['title'](a['id'],f),'detail':g['detail'](a['id'],f),'suggestion':g['suggestion'],'roles':[...new Set(f['affected_stakeholders']['map'](h=>STAKEHOLDER_ROLE[h]))]};});}});
1
+ import{adaptNodeAnalyzer}from'../graph/onchain/index.js';import{assessServiceRisks,assessServiceStateRisks}from'./service-risk.js';import{puzzlePayloadOf,riskToOutcome,safeRunPack}from'./rule-outcome.js';import{projectServicePuzzle}from'./puzzle-projections.js';export const SERVICE_RISK_NODE_ANALYZER_ID='SR1';const STAKEHOLDER_ROLE={'owner':'merchant','provider':'merchant','customer':'buyer','arbitrator':'arbitrator','system':'system'},COPY={'R-S-4-05':{'title':()=>'Fulfillment\x20state:\x20Service\x20is\x20paused\x20(bPaused=true);\x20no\x20new\x20orders\x20can\x20be\x20placed\x20while\x20paused','detail':a=>'Shop\x20'+a+'\x20currently\x20has\x20bPaused=true:\x20the\x20merchant\x20paused\x20operations\x20voluntarily;\x20new\x20orders\x20cannot\x20be\x20submitted\x20until\x20it\x20resumes\x20(rule\x20R-S-4-05,\x20evidence\x20bPaused=true).','suggestion':'Ask\x20the\x20merchant\x20via\x20Messenger\x20when\x20operations\x20resume;\x20do\x20not\x20pay\x20for\x20orders\x20while\x20paused.'},'R-S-4-06':{'title':()=>'Fulfillment\x20state:\x20Service\x20is\x20unpublished\x20(draft),\x20invisible\x20to\x20the\x20market\x20and\x20order_new\x20will\x20fail','detail':a=>'Shop\x20'+a+'\x20currently\x20has\x20bPublished=false:\x20the\x20object\x20is\x20still\x20a\x20draft,\x20invisible\x20to\x20the\x20market,\x20and\x20any\x20order\x20attempt\x20fails\x20(rule\x20R-S-4-06,\x20evidence\x20bPublished=false).','suggestion':'Wait\x20for\x20the\x20merchant\x27s\x20official\x20publish\x20(publishing\x20is\x20irreversible\x20and\x20locks\x20the\x20config)\x20before\x20ordering;\x20a\x20draft\x20link\x20is\x20not\x20an\x20on-sale\x20promise.'},'R-S-5-05':{'title':()=>'Missing\x20payout\x20path:\x20compensation_fund\x20has\x20a\x20balance\x20but\x20no\x20Arbitration\x20is\x20bound','detail':(a,b)=>'Shop\x20'+a+'\x20has\x20compensation_fund\x20balance\x20but\x20empty\x20arbitrations:\x20payouts\x20require\x20dispute\x20->\x20ruling\x20->\x20fee\x20withdrawal\x20to\x20claim,\x20'+('and\x20without\x20an\x20arbitration\x20binding\x20this\x20money\x20has\x20no\x20executable\x20claim\x20path\x20(rule\x20R-S-5-05,\x20evidence\x20'+(b['evidence']??'')+').'),'suggestion':'Require\x20the\x20merchant\x20to\x20bind\x20at\x20least\x20one\x20Arbitration\x20in\x20a\x20different\x20group\x20than\x20the\x20shop\x20Permission\x20before\x20ordering;\x20payout\x20promises\x20without\x20a\x20dispute\x20path\x20are\x20unenforceable.'}};export const serviceRiskNodeAnalyzer=adaptNodeAnalyzer({'id':SERVICE_RISK_NODE_ANALYZER_ID,'kind':'risk','objectType':'Service','inspect'(a){const b=puzzlePayloadOf(a);if(b){const g=projectServicePuzzle(b);return safeRunPack(h=>assessServiceRisks(h),g)['map'](h=>riskToOutcome(h,'derived'));}const c=a['raw'],e=c?.['data']??c;if(!e)return[];const f={};if(typeof e['bPaused']==='boolean')f['current_bPaused']=e['bPaused'];if(typeof e['bPublished']==='boolean')f['current_bPublished']=e['bPublished'];if(e['compensation_fund']!=null)f['current_compensation_fund_balance']=String(e['compensation_fund']);if(Array['isArray'](e['arbitrations']))f['current_arbitrations_count']=e['arbitrations']['length'];return assessServiceStateRisks(f)['map'](h=>{const i=COPY[h['id']],j=h['id']==='R-S-4-05'||h['id']==='R-S-4-06'?'low':h['level']==='critical'||h['level']==='high'?'high':h['level']==='medium'?'medium':'low';return{'severity':j,'title':i['title'](a['id'],h),'detail':i['detail'](a['id'],h),'suggestion':i['suggestion'],'roles':[...new Set(h['affected_stakeholders']['map'](k=>STAKEHOLDER_ROLE[k]))]};});}});
@@ -1,5 +1,6 @@
1
+ import { type Facts, type FindingExposure } from "../config/rule-engine.js";
1
2
  import { type ServiceScene } from "./service-ledger.js";
2
- export type ServiceRiskLevel = "CRITICAL" | "HIGH" | "MEDIUM" | "LOW";
3
+ export type ServiceRiskLevel = "critical" | "high" | "medium" | "low";
3
4
  export type ServiceRiskCategory = "structural" | "semantic" | "authority" | "lifecycle" | "cross_object";
4
5
  export interface ServiceRisk {
5
6
  id: string;
@@ -11,6 +12,7 @@ export interface ServiceRisk {
11
12
  scenario: string;
12
13
  mitigation: string;
13
14
  evidence?: string;
15
+ exposure?: FindingExposure;
14
16
  }
15
17
  export type ServiceStakeholder = "owner" | "customer" | "provider" | "arbitrator" | "system";
16
18
  export interface ServiceRiskRule {
@@ -92,12 +94,10 @@ export interface ServiceRiskCheckContext {
92
94
  builder?: string;
93
95
  target_objects_types?: string[];
94
96
  }
97
+ export declare function serviceRiskFacts(ctx: ServiceRiskCheckContext): Facts;
95
98
  export declare const SERVICE_RISK_VERSION = "1.1.0";
96
- export declare const SERVICE_STATE_RULE_IDS: readonly ["R-S-4-05", "R-S-4-06", "R-S-5-05"];
97
99
  export declare function assessServiceStateRisks(ctx: ServiceRiskCheckContext): ServiceRisk[];
98
100
  export declare function getAllServiceRiskRules(): ServiceRiskRule[];
99
- export declare function getServiceRiskRulesCount(): number;
100
- export declare function getServiceRiskRulesByCategory(category: ServiceRiskCategory): ServiceRiskRule[];
101
101
  export interface ServiceRiskAssessment {
102
102
  summary: string;
103
103
  scene?: ServiceScene;
@@ -1 +1 @@
1
- import{MAX_SALE_COUNT,MAX_REPOSITORY_COUNT,MAX_ARBITRATION_COUNT,MAX_DISCOUNT_TOTAL_COUNT,MAX_WIP_LENGTH,MAX_WIP_HASH_LENGTH}from'@wowok/wowok';const R_S_1_01={'id':'R-S-1-01','category':'structural','trigger':'sales\x20count\x20exceeds\x20MAX_SALE_COUNT\x20(50)','check':a=>{const b=a['current_sales_count']??0x0;if(a['sales']&&(a['sales']['op']==='add'||a['sales']['op']==='set')){const c=a['sales']['op']==='set'?a['sales']['sales']['length']:b+a['sales']['sales']['length'];if(c>MAX_SALE_COUNT)return{'id':'R-S-1-01','level':'HIGH','category':'structural','title':'Sales\x20count\x20exceeds\x20limit','description':'Service\x20would\x20have\x20'+c+'\x20sales\x20items,\x20exceeds\x20MAX_SALE_COUNT\x20'+MAX_SALE_COUNT,'affected_stakeholders':['owner','system'],'scenario':'Adding\x20too\x20many\x20product\x20SKUs','mitigation':'Split\x20into\x20multiple\x20Service\x20objects\x20or\x20remove\x20discontinued\x20items','evidence':'sales_count='+c};}return null;}},R_S_1_02={'id':'R-S-1-02','category':'structural','trigger':'repositories\x20count\x20exceeds\x20MAX_REPOSITORY_COUNT\x20(100)','check':a=>{const b=a['current_repositories_count']??0x0;if(a['repositories']&&(a['repositories']['op']==='add'||a['repositories']['op']==='set')){const c=a['repositories']['op']==='set'?a['repositories']['objects']['length']:b+a['repositories']['objects']['length'];if(c>MAX_REPOSITORY_COUNT)return{'id':'R-S-1-02','level':'MEDIUM','category':'structural','title':'Repositories\x20count\x20exceeds\x20limit','description':'Service\x20would\x20have\x20'+c+'\x20repositories,\x20exceeds\x20MAX_REPOSITORY_COUNT\x20'+MAX_REPOSITORY_COUNT,'affected_stakeholders':['owner'],'scenario':'Binding\x20too\x20many\x20data\x20repositories','mitigation':'Consolidate\x20repositories\x20or\x20remove\x20inactive\x20ones','evidence':'repositories_count='+c};}return null;}},R_S_1_03={'id':'R-S-1-03','category':'structural','trigger':'arbitrations\x20count\x20exceeds\x20MAX_ARBITRATION_COUNT\x20(20)','check':a=>{const b=a['current_arbitrations_count']??0x0;if(a['arbitrations']&&(a['arbitrations']['op']==='add'||a['arbitrations']['op']==='set')){const c=a['arbitrations']['op']==='set'?a['arbitrations']['objects']['length']:b+a['arbitrations']['objects']['length'];if(c>MAX_ARBITRATION_COUNT)return{'id':'R-S-1-03','level':'HIGH','category':'structural','title':'Arbitrations\x20count\x20exceeds\x20limit','description':'Service\x20would\x20have\x20'+c+'\x20arbitrations,\x20exceeds\x20MAX_ARBITRATION_COUNT\x20'+MAX_ARBITRATION_COUNT,'affected_stakeholders':['owner','arbitrator'],'scenario':'Binding\x20too\x20many\x20Arbitration\x20objects','mitigation':'Use\x201-3\x20Arbitration\x20objects\x20covering\x20different\x20dispute\x20scopes','evidence':'arbitrations_count='+c};}return null;}},R_S_1_04={'id':'R-S-1-04','category':'structural','trigger':'WIP\x20hash\x20length\x20exceeds\x20MAX_WIP_HASH_LENGTH\x20(64)\x20or\x20URL\x20exceeds\x20MAX_WIP_LENGTH\x20(1024)','check':a=>{if(a['sales']&&(a['sales']['op']==='add'||a['sales']['op']==='set'))for(const b of a['sales']['sales']){if(b['wip_hash']&&b['wip_hash']['length']>MAX_WIP_HASH_LENGTH)return{'id':'R-S-1-04','level':'HIGH','category':'structural','title':'WIP\x20hash\x20length\x20exceeds\x20limit','description':'Sale\x20\x22'+b['name']+'\x22\x20wip_hash\x20length\x20'+b['wip_hash']['length']+'\x20>\x20MAX_WIP_HASH_LENGTH\x20'+MAX_WIP_HASH_LENGTH,'affected_stakeholders':['owner','customer'],'scenario':'Malformed\x20WIP\x20hash\x20(should\x20be\x20sha256\x20hex,\x2064\x20chars)','mitigation':'Use\x20sha256\x20hex\x20hash\x20(64\x20characters,\x20no\x20prefix)','evidence':'wip_hash_length='+b['wip_hash']['length']};if(b['wip']&&b['wip']['length']>MAX_WIP_LENGTH)return{'id':'R-S-1-04','level':'HIGH','category':'structural','title':'WIP\x20URL\x20length\x20exceeds\x20limit','description':'Sale\x20\x22'+b['name']+'\x22\x20wip\x20URL\x20length\x20'+b['wip']['length']+'\x20>\x20MAX_WIP_LENGTH\x20'+MAX_WIP_LENGTH,'affected_stakeholders':['owner'],'scenario':'WIP\x20URL\x20too\x20long\x20(use\x20IPFS\x20or\x20short\x20HTTPS\x20URL)','mitigation':'Use\x20IPFS\x20CID\x20or\x20shorter\x20URL','evidence':'wip_url_length='+b['wip']['length']};}return null;}},R_S_1_05={'id':'R-S-1-05','category':'structural','trigger':'sale.wip\x20is\x20a\x20local\x20path\x20/\x20localhost\x20/\x20LAN\x20URL\x20(not\x20network-deployable)\x20—\x20every\x20customer\x20order\x20fails','check':a=>{if(a['sales']&&(a['sales']['op']==='add'||a['sales']['op']==='set'))for(const b of a['sales']['sales']){if(b['wip']&&b['wip']!==''){let c=null;const d=b['wip'];if(/^[A-Za-z]:[\\/]/['test'](d)||d['startsWith']('/')||d['startsWith']('./')||d['startsWith']('../'))c='local\x20filesystem\x20path';else{if(/^https?:\/\/(localhost|127\.0\.0\.1|\[::1\]|0\.0\.0\.0)([:/]|$)/i['test'](d))c='localhost/loopback\x20URL';else{if(/^https?:\/\/(10\.\d{1,3}\.\d{1,3}\.\d{1,3}|172\.(1[6-9]|2\d|3[01])\.\d{1,3}\.\d{1,3}|192\.168\.\d{1,3}\.\d{1,3})([:/]|$)/i['test'](d))c='LAN\x20(private\x20IP)\x20URL';else!/^https?:\/\//i['test'](d)&&!d['startsWith']('ipfs://')&&!d['startsWith']('data:')&&(c='unrecognized\x20format\x20(not\x20a\x20network\x20URL)');}}if(c)return{'id':'R-S-1-05','level':'CRITICAL','category':'structural','title':'WIP\x20is\x20not\x20network-deployed\x20—\x20every\x20customer\x20order\x20will\x20fail','description':'Sale\x20\x22'+b['name']+'\x22\x20wip\x20\x22'+b['wip']+'\x22\x20is\x20a\x20'+c+'.\x20It\x20passes\x20set-time\x20verification\x20'+'on\x20the\x20merchant\x27s\x20own\x20machine\x20but\x20is\x20unreachable\x20by\x20customers\x20on\x20other\x20machines\x20—\x20'+'order_new\x20aborts\x20100%\x20when\x20a\x20customer\x20tries\x20to\x20buy.','affected_stakeholders':['owner','customer'],'scenario':'Merchant\x20sets\x20wip\x20to\x20a\x20local\x20file\x20path\x20/\x20localhost\x20/\x20LAN\x20URL\x20and\x20publishes\x20the\x20Service;\x20'+'the\x20on-chain\x20wip\x20points\x20at\x20the\x20merchant\x27s\x20machine;\x20customers\x20cannot\x20fetch\x20it.','mitigation':'Deploy\x20the\x20.wip\x20file\x20to\x20a\x20public\x20host\x20(GitHub\x20Pages,\x20IPFS,\x20or\x20your\x20own\x20website)\x20and\x20set\x20'+'sale.wip\x20to\x20the\x20public\x20URL.\x20Or\x20leave\x20sale.wip\x20empty\x20(\x22\x22)\x20to\x20skip\x20WIP\x20verification\x20'+'(TESTING\x20ONLY\x20—\x20not\x20recommended\x20for\x20production).','evidence':'sale='+b['name']+',\x20wip='+b['wip']};}}return null;}},R_S_2_01={'id':'R-S-2-01','category':'semantic','trigger':'WIP\x20hash\x20tampering\x20risk\x20—\x20owner\x20updates\x20WIP\x20file\x20without\x20updating\x20wip_hash','check':a=>{if(a['sales']&&(a['sales']['op']==='add'||a['sales']['op']==='set'))for(const b of a['sales']['sales']){if(b['wip']&&!b['wip_hash'])return{'id':'R-S-2-01','level':'CRITICAL','category':'semantic','title':'WIP\x20hash\x20missing\x20—\x20tampering\x20risk','description':'Sale\x20\x22'+b['name']+'\x22\x20has\x20wip\x20URL\x20but\x20no\x20wip_hash.\x20Owner\x20could\x20replace\x20the\x20WIP\x20file\x20without\x20customers\x20noticing.','affected_stakeholders':['customer','owner'],'scenario':'Owner\x20sets\x20wip\x20without\x20hash,\x20then\x20changes\x20file\x20content\x20later','mitigation':'Always\x20compute\x20sha256(wip_file_content)\x20and\x20set\x20as\x20wip_hash.\x20SDK\x20auto-derives\x20if\x20omitted,\x20but\x20explicit\x20hash\x20is\x20safer.','evidence':'sale='+b['name']};}return null;}},R_S_2_02={'id':'R-S-2-02','category':'semantic','trigger':'compensation_fund\x20confused\x20with\x20Service\x20balance\x20(internal\x20Balance<T>)','check':a=>{if(a['compensation_fund_add'])return{'id':'R-S-2-02','level':'HIGH','category':'semantic','title':'compensation_fund\x20is\x20internal\x20Balance<T>,\x20NOT\x20Service-owned\x20Treasury','description':'Depositing\x20'+a['compensation_fund_add']['balance']+'\x20to\x20compensation_fund.\x20This\x20balance\x20is\x20internal\x20to\x20Service<T>\x20and\x20is\x20consumed\x20by\x20arbitration::compensation_claim,\x20not\x20by\x20owner\x20withdrawals.\x20Owner\x20can\x20only\x20withdraw\x20via\x20compensation_fund_withdraw\x20(requires\x20bPaused=true\x20+\x20lock_duration\x20expired).','affected_stakeholders':['owner','arbitrator','customer'],'scenario':'Owner\x20confuses\x20compensation_fund\x20with\x20general\x20Treasury','mitigation':'Use\x20external\x20Treasury\x20(referenced\x20via\x20order_allocators.sharing.who=Entity)\x20for\x20general\x20funds.\x20Use\x20compensation_fund\x20only\x20for\x20arbitration\x20payouts.','evidence':'deposit='+a['compensation_fund_add']['balance']};return null;}},R_S_2_03={'id':'R-S-2-03','category':'semantic','trigger':'quote\x20side\x20effect\x20—\x20stock\x20deduction\x20not\x20rolled\x20back\x20on\x20later\x20failure','check':a=>{if(a['order_new']&&a['order_new']['buy']['items']['length']>0x0)return{'id':'R-S-2-03','level':'HIGH','category':'semantic','title':'Order\x20flow:\x20stock\x20deducted\x20at\x20quote\x20stage\x20—\x20NOT\x20rolled\x20back\x20on\x20failure','description':'Order\x20will\x20deduct\x20stock\x20at\x20Stage\x203\x20(quote).\x20If\x20Stages\x204-7\x20fail,\x20stock\x20remains\x20deducted.\x20Customer\x20must\x20manually\x20re-add\x20stock\x20or\x20accept\x20the\x20loss.','affected_stakeholders':['owner','customer'],'scenario':'Customer\x27s\x20transaction\x20fails\x20after\x20quote\x20but\x20stock\x20is\x20gone','mitigation':'1)\x20Monitor\x20failed\x20transactions\x20and\x20re-add\x20stock\x20via\x20stock_add.\x202)\x20Set\x20sales\x20suspension\x20during\x20high-failure\x20periods.\x203)\x20Use\x20small\x20batch\x20orders\x20to\x20limit\x20blast\x20radius.','evidence':'items='+a['order_new']['buy']['items']['length']};return null;}},R_S_2_04={'id':'R-S-2-04','category':'semantic','trigger':'Discount\x20issuance\x20—\x20verify\x20type\x20and\x20total\x20count\x20semantics','check':a=>{if(a['discount']){const b=a['discount']['count'];if(b>MAX_DISCOUNT_TOTAL_COUNT)return{'id':'R-S-2-04','level':'MEDIUM','category':'semantic','title':'Discount\x20count\x20exceeds\x20total\x20cap','description':'Issuing\x20'+b+'\x20discounts\x20exceeds\x20MAX_DISCOUNT_TOTAL_COUNT\x20'+MAX_DISCOUNT_TOTAL_COUNT,'affected_stakeholders':['owner'],'scenario':'Bulk\x20discount\x20issuance','mitigation':'Issue\x20in\x20batches\x20of\x20<=\x201000\x20(MAX_DISCOUNT_COUNT_ONCE)\x20and\x20keep\x20total\x20<=\x20'+MAX_DISCOUNT_TOTAL_COUNT,'evidence':'count='+b};}return null;}},R_S_2_05={'id':'R-S-2-05','category':'semantic','trigger':'Order\x20placed\x20without\x20verifying\x20WIP\x20hash\x20—\x20buyer\x20passes\x20empty\x20wip_hash','check':a=>{if(a['order_new']){const b=a['order_new']['buy']['items']['filter'](c=>c['wip_hash']==='');if(b['length']>0x0)return{'id':'R-S-2-05','level':'MEDIUM','category':'semantic','title':'Order\x20with\x20empty\x20wip_hash\x20—\x20SDK\x20auto-fills\x20from\x20sale','description':b['length']+'\x20item(s)\x20have\x20empty\x20wip_hash.\x20SDK\x20will\x20auto-fill\x20from\x20sale.wip_hash\x20at\x20order\x20time.\x20If\x20owner\x20updates\x20the\x20WIP\x20file\x20between\x20viewing\x20and\x20ordering,\x20buyer\x20receives\x20the\x20new\x20(potentially\x20different)\x20content.','affected_stakeholders':['customer'],'scenario':'Time-of-check\x20to\x20time-of-use\x20WIP\x20mismatch','mitigation':'Buyer\x20should\x20explicitly\x20pass\x20the\x20wip_hash\x20they\x20saw\x20when\x20viewing\x20the\x20product.\x20Empty\x20string\x20is\x20convenience\x20but\x20riskier.','evidence':'empty_hash_items='+b['length']};}return null;}},R_S_3_01={'id':'R-S-3-01','category':'authority','trigger':'publish\x20operation\x20—\x20requires\x20SERVICE_PUBLISH\x20(311)\x20+\x20prerequisites','check':a=>{if(!a['publish'])return null;const b=[];if(!a['current_order_allocators_set'])b['push']('order_allocators\x20not\x20set\x20(F-S-18,\x20E_NO_ALLOCATOR)');const c=a['current_compensation_fund_balance']??'0';BigInt(c)>0x0n&&(a['current_arbitrations_count']??0x0)===0x0&&b['push']('compensation_fund\x20>\x200\x20but\x20no\x20arbitrations\x20(F-S-19,\x20E_ARBITRATION_NOT_SET_WITH_COMPENSATION_FUND)');if(b['length']>0x0)return{'id':'R-S-3-01','level':'CRITICAL','category':'authority','title':'Publish\x20blocked\x20—\x20prerequisites\x20not\x20met','description':'Cannot\x20publish:\x20'+b['join'](';\x20'),'affected_stakeholders':['owner'],'scenario':'Owner\x20attempts\x20publish\x20without\x20configuring\x20prerequisites','mitigation':'Configure\x20order_allocators\x20(and\x20arbitrations\x20if\x20compensation_fund\x20>\x200)\x20before\x20publish','evidence':'blockers='+b['length']};return null;}},R_S_3_02={'id':'R-S-3-02','category':'authority','trigger':'pause\x20operation\x20—\x20affects\x20new\x20orders\x20but\x20not\x20existing\x20Progress','check':a=>{if(a['pause']===undefined)return null;return{'id':'R-S-3-02','level':'MEDIUM','category':'authority','title':a['pause']?'Pausing\x20Service\x20—\x20new\x20orders\x20blocked,\x20existing\x20Progress\x20continues':'Resuming\x20Service\x20—\x20new\x20orders\x20accepted','description':a['pause']?'Service.bPaused\x20=\x20true\x20will\x20reject\x20new\x20orders\x20(E_PAUSED,\x20service:19).\x20Existing\x20orders\x27\x20Progress\x20continues\x20normally.':'Service.bPaused\x20=\x20false\x20will\x20allow\x20new\x20orders\x20again.','affected_stakeholders':['owner','customer'],'scenario':a['pause']?'Owner\x20pauses\x20for\x20maintenance/stockout':'Owner\x20resumes\x20after\x20maintenance','mitigation':a['pause']?'Communicate\x20pause\x20to\x20customers.\x20Use\x20compensation_fund_withdraw\x20only\x20when\x20paused.':'Verify\x20stock\x20levels\x20before\x20resuming.','evidence':'pause='+a['pause']};}},R_S_3_03={'id':'R-S-3-03','category':'authority','trigger':'buy_guard\x20change\x20—\x20post-publish\x20mutable\x20(unusual\x20exception)','check':a=>{if(a['buy_guard']===undefined)return null;if(a['current_bPublished'])return{'id':'R-S-3-03','level':'MEDIUM','category':'authority','title':'buy_guard\x20change\x20post-publish\x20—\x20unusual\x20mutability','description':'buy_guard\x20is\x20the\x20ONLY\x20publish-locked-field\x20exception:\x20it\x20remains\x20mutable\x20post-publish.\x20Other\x20fields\x20(machine/arbitrations/order_allocators)\x20are\x20immutable.','affected_stakeholders':['owner','customer'],'scenario':'Owner\x20changes\x20buy_guard\x20strategy\x20after\x20publish\x20(e.g.\x20whitelist\x20→\x20public)','mitigation':'Document\x20buy_guard\x20changes\x20for\x20transparency.\x20Customers\x20should\x20re-verify\x20buy_guard\x20before\x20ordering.','evidence':'buy_guard='+(a['buy_guard']??'(cleared)')};return null;}},R_S_3_04={'id':'R-S-3-04','category':'authority','trigger':'Ownership\x20transfer\x20(builder\x20field)\x20—\x20irreversible','check':a=>{if(!a['builder'])return null;return{'id':'R-S-3-04','level':'HIGH','category':'authority','title':'Service\x20ownership\x20transfer\x20—\x20IRREVERSIBLE','description':'Transferring\x20Service\x20to\x20'+a['builder']+'.\x20Original\x20owner\x20loses\x20ALL\x20control.\x20New\x20owner\x20inherits\x20permission\x20+\x20compensation_fund\x20+\x20all\x20bindings.','affected_stakeholders':['owner'],'scenario':'Owner\x20transfers\x20Service\x20to\x20new\x20address','mitigation':'1)\x20Verify\x20new\x20owner\x20address\x20twice.\x202)\x20Withdraw\x20compensation_fund\x20first\x20(if\x20applicable).\x203)\x20Export\x20Service\x20JSON\x20before\x20transfer.','evidence':'new_owner='+a['builder']};}},R_S_4_01={'id':'R-S-4-01','category':'lifecycle','trigger':'publish\x20is\x20irreversible\x20—\x20bPublished\x20cannot\x20be\x20reset\x20to\x20false','check':a=>{if(!a['publish'])return null;if(a['current_bPublished'])return{'id':'R-S-4-01','level':'HIGH','category':'lifecycle','title':'Service\x20already\x20published\x20—\x20publish\x20is\x20no-op','description':'Service.bPublished\x20is\x20already\x20true.\x20Subsequent\x20publish\x20calls\x20have\x20no\x20effect\x20(bPublished\x20is\x20one-shot,\x20cannot\x20revert).','affected_stakeholders':['owner'],'scenario':'Owner\x20calls\x20publish\x20again\x20on\x20already-published\x20Service','mitigation':'Skip\x20publish\x20if\x20already\x20published.\x20To\x20\x27reset\x27\x20a\x20Service,\x20create\x20a\x20new\x20one.','evidence':'bPublished=true'};return{'id':'R-S-4-01','level':'HIGH','category':'lifecycle','title':'Publish\x20is\x20IRREVERSIBLE\x20—\x203\x20fields\x20will\x20be\x20locked\x20forever','description':'Once\x20published:\x20machine\x20(306),\x20arbitrations\x20(308),\x20order_allocators\x20(313)\x20become\x20permanently\x20immutable.\x20bPublished\x20cannot\x20be\x20reset\x20to\x20false.\x20Clone\x20Service\x20to\x20make\x20changes.','affected_stakeholders':['owner','customer'],'scenario':'Owner\x20publishes\x20Service\x20for\x20the\x20first\x20time','mitigation':'Verify\x20all\x20configurations\x20before\x20publish.\x20Run\x20pre-publish\x20checklist\x20(confirm-gate.ts).','evidence':'bPublished=false→true'};}},R_S_4_02={'id':'R-S-4-02','category':'lifecycle','trigger':'setting_lock_duration\x20add\x20—\x20only-increase\x20mechanism','check':a=>{if(a['setting_lock_duration_add']===undefined)return null;return{'id':'R-S-4-02','level':'MEDIUM','category':'lifecycle','title':'setting_lock_duration\x20can\x20only\x20INCREASE','description':'Adding\x20'+a['setting_lock_duration_add']+'\x20ms\x20to\x20setting_lock_duration.\x20New\x20value\x20=\x20old\x20+\x20input\x20(safe_add).\x20Cannot\x20be\x20decreased\x20—\x20protects\x20customers\x20from\x20owner\x20reducing\x20lock\x20to\x20withdraw\x20compensation_fund\x20faster.','affected_stakeholders':['owner','customer'],'scenario':'Owner\x20extends\x20lock\x20period\x20to\x20build\x20trust','mitigation':'Ensure\x20extension\x20is\x20intentional.\x20Lock\x20affects\x20rewards/compensation_fund_withdraw/compensation_fund_receive.','evidence':'add_ms='+a['setting_lock_duration_add']};}},R_S_4_03={'id':'R-S-4-03','category':'lifecycle','trigger':'machine/arbitrations/order_allocators\x20modification\x20after\x20publish\x20—\x20SDK\x20blocks','check':a=>{if(!a['current_bPublished'])return null;const b=[];if(a['machine']!==undefined)b['push']('machine\x20(306)');if(a['arbitrations']!==undefined)b['push']('arbitrations\x20(308)');if(a['order_allocators']!==undefined)b['push']('order_allocators\x20(313)');if(b['length']>0x0)return{'id':'R-S-4-03','level':'HIGH','category':'lifecycle','title':'Post-publish\x20modification\x20blocked\x20by\x20SDK','description':'Service\x20is\x20published.\x20Cannot\x20modify:\x20'+b['join'](',\x20')+'.\x20SDK\x20checkNotPublished()\x20will\x20abort.\x20To\x20change\x20these\x20fields,\x20clone\x20the\x20Service.','affected_stakeholders':['owner'],'scenario':'Owner\x20attempts\x20to\x20change\x20locked\x20field\x20post-publish','mitigation':'Create\x20a\x20new\x20Service\x20with\x20the\x20desired\x20configuration.\x20Migrate\x20active\x20orders\x20if\x20needed.','evidence':'blocked='+b['join'](',')};return null;}},R_S_4_04={'id':'R-S-4-04','category':'lifecycle','trigger':'sales\x20modification\x20—\x20stock/price\x20changes\x20affect\x20future\x20orders\x20only','check':a=>{if(!a['sales'])return null;return{'id':'R-S-4-04','level':'LOW','category':'lifecycle','title':'Sales\x20modification\x20affects\x20future\x20orders\x20only','description':'Sales\x20add/set/remove/clear\x20changes\x20do\x20NOT\x20affect\x20already-created\x20Orders.\x20Existing\x20Orders\x27\x20Progress\x20continues\x20with\x20the\x20original\x20sale\x20parameters.','affected_stakeholders':['owner','customer'],'scenario':'Owner\x20updates\x20prices\x20mid-campaign','mitigation':'Communicate\x20price/stock\x20changes\x20to\x20customers.\x20Existing\x20orders\x20are\x20unaffected.','evidence':'sales_op='+a['sales']['op']};}},R_S_4_05={'id':'R-S-4-05','category':'lifecycle','trigger':'Service\x20paused\x20(state-only\x20buyer\x20rule)\x20—\x20new\x20orders\x20are\x20suspended','check':a=>{if(!a['current_bPaused'])return null;return{'id':'R-S-4-05','level':'HIGH','category':'lifecycle','title':'Service\x20is\x20paused\x20—\x20ordering\x20suspended','description':'Service.bPaused\x20is\x20true.\x20The\x20merchant\x20has\x20actively\x20paused\x20the\x20Service;\x20new\x20orders\x20cannot\x20be\x20placed\x20until\x20it\x20resumes.','affected_stakeholders':['customer'],'scenario':'Buyer\x20performs\x20due\x20diligence\x20on\x20a\x20paused\x20Service','mitigation':'Confirm\x20with\x20the\x20merchant\x20(via\x20Messenger)\x20when\x20the\x20Service\x20will\x20resume\x20before\x20ordering.','evidence':'bPaused=true'};}},R_S_4_06={'id':'R-S-4-06','category':'lifecycle','trigger':'Service\x20not\x20published\x20(state-only\x20buyer\x20rule)\x20—\x20cannot\x20be\x20ordered','check':a=>{if(a['current_bPublished']!==![])return null;return{'id':'R-S-4-06','level':'HIGH','category':'lifecycle','title':'Service\x20is\x20not\x20published\x20—\x20cannot\x20be\x20ordered','description':'Service.bPublished\x20is\x20false.\x20The\x20Service\x20is\x20still\x20a\x20draft:\x20it\x20is\x20not\x20visible\x20on\x20the\x20market\x20and\x20order_new\x20will\x20fail.','affected_stakeholders':['customer'],'scenario':'Buyer\x20evaluates\x20a\x20draft\x20Service\x20shared\x20out-of-band','mitigation':'Wait\x20until\x20the\x20merchant\x20publishes\x20the\x20Service\x20(publish\x20is\x20irreversible\x20—\x20configuration\x20is\x20locked\x20at\x20that\x20point).','evidence':'bPublished=false'};}},R_S_5_01={'id':'R-S-5-01','category':'cross_object','trigger':'Machine\x20binding\x20—\x20post-publish\x20immutable,\x20Progress\x20inherits','check':a=>{if(a['machine']===undefined)return null;if(a['current_bPublished'])return{'id':'R-S-5-01','level':'HIGH','category':'cross_object','title':'Machine\x20binding\x20immutable\x20post-publish','description':'Service\x20is\x20published;\x20machine\x20cannot\x20be\x20changed.\x20All\x20future\x20Progress\x20objects\x20will\x20use\x20the\x20bound\x20Machine.','affected_stakeholders':['owner'],'scenario':'Owner\x20wants\x20to\x20upgrade\x20workflow\x20post-publish','mitigation':'Create\x20new\x20Service\x20with\x20new\x20Machine.\x20Migrate\x20customers\x20via\x20discounts.','evidence':'machine='+(a['machine']??'(cleared)')};return{'id':'R-S-5-01','level':'MEDIUM','category':'cross_object','title':'Machine\x20binding\x20—\x20verify\x20Machine\x20is\x20published','description':'Binding\x20Machine\x20'+a['machine']+'.\x20Ensure\x20Machine\x20is\x20published\x20(machine::publish)\x20—\x20Service\x20cannot\x20bind\x20unpublished\x20Machine.','affected_stakeholders':['owner'],'scenario':'Owner\x20binds\x20Machine\x20before\x20publishing\x20Service','mitigation':'Verify\x20Machine.bPublished\x20=\x20true\x20before\x20binding.','evidence':'machine='+a['machine']};}},R_S_5_02={'id':'R-S-5-02','category':'cross_object','trigger':'Arbitration\x20binding\x20—\x20required\x20when\x20compensation_fund\x20>\x200','check':a=>{if(!a['arbitrations'])return null;const b=a['current_compensation_fund_balance']??'0';if(BigInt(b)>0x0n&&(a['current_arbitrations_count']??0x0)===0x0)return{'id':'R-S-5-02','level':'HIGH','category':'cross_object','title':'Arbitration\x20required\x20—\x20compensation_fund\x20has\x20balance','description':'compensation_fund\x20balance\x20is\x20'+b+'.\x20Publish\x20will\x20fail\x20(E_ARBITRATION_NOT_SET_WITH_COMPENSATION_FUND)\x20until\x20arbitrations\x20is\x20non-empty.','affected_stakeholders':['owner'],'scenario':'Owner\x20deposits\x20compensation_fund\x20without\x20configuring\x20arbitrations','mitigation':'Add\x20at\x20least\x201\x20Arbitration\x20object\x20before\x20publish.','evidence':'compensation_fund='+b};return null;}},R_S_5_03={'id':'R-S-5-03','category':'cross_object','trigger':'order_allocators\x20binding\x20—\x20publish\x20prerequisite,\x20post-publish\x20immutable','check':a=>{if(a['order_allocators']===undefined)return null;if(a['current_bPublished'])return{'id':'R-S-5-03','level':'HIGH','category':'cross_object','title':'order_allocators\x20immutable\x20post-publish','description':'Service\x20is\x20published;\x20order_allocators\x20cannot\x20be\x20changed.\x20Fund\x20distribution\x20strategy\x20is\x20permanently\x20locked.','affected_stakeholders':['owner'],'scenario':'Owner\x20wants\x20to\x20adjust\x20fee\x20split\x20post-publish','mitigation':'Create\x20new\x20Service\x20with\x20new\x20allocators.\x20Cannot\x20migrate\x20existing\x20Orders.','evidence':'order_allocators='+(a['order_allocators']?'(set)':'(cleared)')};if(a['publish']&&!a['order_allocators'])return{'id':'R-S-5-03','level':'CRITICAL','category':'cross_object','title':'Publish\x20without\x20order_allocators\x20—\x20will\x20fail','description':'Publish\x20will\x20abort\x20with\x20E_NO_ALLOCATOR.\x20order_allocators\x20is\x20a\x20mandatory\x20publish\x20prerequisite.','affected_stakeholders':['owner'],'scenario':'Owner\x20attempts\x20publish\x20without\x20configuring\x20allocators','mitigation':'Set\x20order_allocators\x20before\x20publish.','evidence':'order_allocators=null'};return null;}},R_S_5_04={'id':'R-S-5-04','category':'cross_object','trigger':'Repository/Reward\x20binding\x20—\x20verify\x20object\x20types\x20before\x20adding','check':a=>{if(a['repositories']&&(a['repositories']['op']==='add'||a['repositories']['op']==='set'))return{'id':'R-S-5-04','level':'LOW','category':'cross_object','title':'Repository\x20binding\x20—\x20verify\x20object\x20types','description':'Adding\x20'+a['repositories']['objects']['length']+'\x20repositories.\x20SDK\x20uses\x20queryObjectsWithType\x20to\x20validate\x20each\x20is\x20ObjectType.Repository\x20before\x20binding.','affected_stakeholders':['owner'],'scenario':'Owner\x20adds\x20non-Repository\x20object\x20by\x20mistake','mitigation':'Use\x20LocalMark\x20names\x20or\x20addresses\x20that\x20are\x20confirmed\x20Repository\x20objects.','evidence':'objects='+a['repositories']['objects']['length']};if(a['rewards']&&(a['rewards']['op']==='add'||a['rewards']['op']==='set'))return{'id':'R-S-5-04','level':'LOW','category':'cross_object','title':'Reward\x20binding\x20—\x20verify\x20object\x20types','description':'Adding\x20'+a['rewards']['objects']['length']+'\x20rewards.\x20SDK\x20validates\x20ObjectType.Reward.\x20add\x20is\x20always\x20allowed;\x20only\x20remove/clear\x20are\x20time-locked\x20after\x20publish.','affected_stakeholders':['owner'],'scenario':'Owner\x20adds\x20Reward\x20objects','mitigation':'Verify\x20Reward\x20objects\x20exist\x20and\x20are\x20active.\x20Remember\x20that\x20removing\x20them\x20later\x20requires\x20pause\x20+\x20setting_lock_duration\x20elapsed.','evidence':'objects='+a['rewards']['objects']['length']};return null;}},R_S_5_05={'id':'R-S-5-05','category':'cross_object','trigger':'compensation_fund\x20has\x20balance\x20but\x20no\x20Arbitration\x20bound\x20(state-only\x20buyer\x20rule)','check':a=>{const b=a['current_compensation_fund_balance'];if(b===undefined)return null;let c;try{c=BigInt(b);}catch{return null;}if(c>0x0n&&(a['current_arbitrations_count']??0x0)===0x0)return{'id':'R-S-5-05','level':'HIGH','category':'cross_object','title':'Compensation\x20fund\x20without\x20Arbitration\x20—\x20fund\x20is\x20unclaimable','description':'compensation_fund\x20balance\x20is\x20'+b+'\x20but\x20no\x20Arbitration\x20object\x20is\x20bound.\x20Compensation\x20is\x20claimed\x20via\x20dispute\x20→\x20arbitration()\x20ruling\x20with\x20indemnity\x20→\x20arb_withdraw;\x20without\x20an\x20Arbitration\x20binding\x20there\x20is\x20no\x20dispute\x20path\x20to\x20trigger\x20a\x20payout.','affected_stakeholders':['customer','owner'],'scenario':'Buyer\x20sees\x20a\x20compensation\x20fund\x20but\x20no\x20dispute\x20path\x20to\x20claim\x20it','mitigation':'Require\x20the\x20merchant\x20to\x20bind\x20at\x20least\x20one\x20Arbitration\x20object\x20before\x20ordering.','evidence':'compensation_fund='+b+',\x20arbitrations=0'};return null;}},ALL_RULES=[R_S_1_01,R_S_1_02,R_S_1_03,R_S_1_04,R_S_1_05,R_S_2_01,R_S_2_02,R_S_2_03,R_S_2_04,R_S_2_05,R_S_3_01,R_S_3_02,R_S_3_03,R_S_3_04,R_S_4_01,R_S_4_02,R_S_4_03,R_S_4_04,R_S_4_05,R_S_4_06,R_S_5_01,R_S_5_02,R_S_5_03,R_S_5_04,R_S_5_05];export const SERVICE_RISK_VERSION='1.1.0';export const SERVICE_STATE_RULE_IDS=['R-S-4-05','R-S-4-06','R-S-5-05'];export function assessServiceStateRisks(a){const b=new Set(SERVICE_STATE_RULE_IDS),c=[];for(const d of ALL_RULES){if(!b['has'](d['id']))continue;const e=d['check'](a);if(e)c['push'](e);}return c;}export function getAllServiceRiskRules(){return[...ALL_RULES];}export function getServiceRiskRulesCount(){return ALL_RULES['length'];}export function getServiceRiskRulesByCategory(a){return ALL_RULES['filter'](b=>b['category']===a);}export function assessServiceRisks(a){const b=[];for(const f of ALL_RULES){const g=f['check'](a);if(g)b['push'](g);}const c=b['length']===0x0?'LOW':b['some'](h=>h['level']==='CRITICAL')?'CRITICAL':b['some'](h=>h['level']==='HIGH')?'HIGH':b['some'](h=>h['level']==='MEDIUM')?'MEDIUM':'LOW',d={};for(const h of b){d[h['category']]=(d[h['category']]??0x0)+0x1;}const e={};for(const i of b){for(const j of i['affected_stakeholders']){if(!e[j])e[j]=[];e[j]['push'](i['id']+':\x20'+i['mitigation']);}}return{'summary':'Assessed\x20'+b['length']+'\x20risk(s)\x20across\x20'+Object['keys'](d)['length']+'\x20categories','risks':b,'overall_risk':c,'risks_by_category':d,'stakeholder_advice':e,'needs_human_review':b['some'](k=>k['level']==='CRITICAL'||k['level']==='HIGH')};}
1
+ import{MAX_SALE_COUNT,MAX_REPOSITORY_COUNT,MAX_ARBITRATION_COUNT,MAX_DISCOUNT_TOTAL_COUNT,MAX_WIP_LENGTH,MAX_WIP_HASH_LENGTH}from'@wowok/wowok';import{getJudgmentDoc,factoryRulePack}from'../config/judgment.js';import{evaluateRuleBook}from'../config/rule-engine.js';function wipLocalType(a){if(/^[A-Za-z]:[\\/]/['test'](a)||a['startsWith']('/')||a['startsWith']('./')||a['startsWith']('../'))return'local\x20filesystem\x20path';if(/^https?:\/\/(localhost|127\.0\.0\.1|\[::1\]|0\.0\.0\.0)([:/]|$)/i['test'](a))return'localhost/loopback\x20URL';if(/^https?:\/\/(10\.\d{1,3}\.\d{1,3}\.\d{1,3}|172\.(1[6-9]|2\d|3[01])\.\d{1,3}\.\d{1,3}|192\.168\.\d{1,3}\.\d{1,3})([:/]|$)/i['test'](a))return'LAN\x20(private\x20IP)\x20URL';if(!/^https?:\/\//i['test'](a)&&!a['startsWith']('ipfs://')&&!a['startsWith']('data:'))return'unrecognized\x20format\x20(not\x20a\x20network\x20URL)';return null;}export function serviceRiskFacts(a){const b=a['sales'],c=!!b&&(b['op']==='add'||b['op']==='set'),d=c?b['op']==='set'?b['sales']['length']:(a['current_sales_count']??0x0)+b['sales']['length']:undefined,e=a['repositories'],f=!!e&&(e['op']==='add'||e['op']==='set'),g=f?e['op']==='set'?(e['objects']??[])['length']:(a['current_repositories_count']??0x0)+(e['objects']??[])['length']:undefined,h=a['arbitrations'],i=!!h&&(h['op']==='add'||h['op']==='set'),j=i?h['op']==='set'?(h['objects']??[])['length']:(a['current_arbitrations_count']??0x0)+(h['objects']??[])['length']:undefined;let k,l;if(c)for(const A of b['sales']){const B=A??{};if(B['wip_hash']&&B['wip_hash']['length']>MAX_WIP_HASH_LENGTH){k=B,l='hash';break;}if(B['wip']&&B['wip']['length']>MAX_WIP_LENGTH){k=B,l='url';break;}}let m,n,o;if(c)for(const C of b['sales']){const D=C??{};if(!m&&D['wip']&&D['wip']!==''){const E=wipLocalType(D['wip']);E&&(m=D,n=E);}!o&&D['wip']&&!D['wip_hash']&&(o=D);}const p=a['current_compensation_fund_balance'],q=p??'0';let r=![],u=![];try{const F=BigInt(q)>0x0n,G=(a['current_arbitrations_count']??0x0)===0x0;r=F&&G,u=p!==undefined&&F&&G;}catch{}const v=[];if(!a['current_order_allocators_set'])v['push']('order_allocators\x20not\x20set\x20(F-S-18,\x20E_NO_ALLOCATOR)');if(r)v['push']('compensation_fund\x20>\x200\x20but\x20no\x20arbitrations\x20(F-S-19,\x20E_ARBITRATION_NOT_SET_WITH_COMPENSATION_FUND)');const w=[];if(a['machine']!==undefined)w['push']('machine\x20(306)');if(a['arbitrations']!==undefined)w['push']('arbitrations\x20(308)');if(a['order_allocators']!==undefined)w['push']('order_allocators\x20(313)');const x=a['order_new']?.['buy']?.['items'],y=a['rewards'],z=!!y&&(y['op']==='add'||y['op']==='set');return{'sales_op':a['sales']!=null?String(a['sales']['op']):undefined,'sales_projected_count':d,'sales_over_limit':d!==undefined&&d>MAX_SALE_COUNT,'max_sale_count':MAX_SALE_COUNT,'repositories_op':e?.['op'],'repositories_projected_count':g,'repositories_over_limit':g!==undefined&&g>MAX_REPOSITORY_COUNT,'max_repository_count':MAX_REPOSITORY_COUNT,'arbitrations_op':h?.['op'],'arbitrations_present':!!h,'arbitrations_projected_count':j,'arbitrations_over_limit':j!==undefined&&j>MAX_ARBITRATION_COUNT,'max_arbitration_count':MAX_ARBITRATION_COUNT,'max_wip_hash_length':MAX_WIP_HASH_LENGTH,'max_wip_length':MAX_WIP_LENGTH,'wip_hash_offender_present':l==='hash','wip_hash_offender_name':l==='hash'?String(k?.['name']):undefined,'wip_hash_offender_len':l==='hash'?k?.['wip_hash']?.['length']:undefined,'wip_url_offender_present':l==='url','wip_url_offender_name':l==='url'?String(k?.['name']):undefined,'wip_url_offender_len':l==='url'?k?.['wip']?.['length']:undefined,'wip_local_present':m!==undefined,'wip_local_sale_name':m!==undefined?String(m['name']):undefined,'wip_local_value':m?.['wip'],'wip_local_type':n,'wip_missing_hash_present':o!==undefined,'wip_missing_hash_name':o!==undefined?String(o['name']):undefined,'compensation_fund_add_present':a['compensation_fund_add']!==undefined&&a['compensation_fund_add']!==null,'compensation_fund_deposit':a['compensation_fund_add']!==undefined&&a['compensation_fund_add']!==null?String(a['compensation_fund_add']['balance']):undefined,'order_new_items_count':x?.['length'],'order_new_empty_hash_count':x?.['filter'](H=>H['wip_hash']==='')['length'],'discount_count':a['discount']?.['count'],'discount_over_cap':a['discount']!==undefined&&a['discount']!==null&&a['discount']['count']>MAX_DISCOUNT_TOTAL_COUNT,'max_discount_total_count':MAX_DISCOUNT_TOTAL_COUNT,'publish':a['publish'],'publish_blockers':v['length']>0x0?v['join'](';\x20'):undefined,'publish_blocker_count':v['length'],'pause':a['pause'],'buy_guard_display':a['buy_guard']!==undefined?a['buy_guard']??'(cleared)':undefined,'builder':a['builder'],'current_bPublished':a['current_bPublished'],'current_bPaused':a['current_bPaused'],'comp_fund_display':q,'comp_fund_positive_no_arb':r,'comp_fund_unclaimable':u,'setting_lock_duration_add':a['setting_lock_duration_add'],'post_publish_blocked_fields':w['length']>0x0?w['join'](',\x20'):undefined,'post_publish_blocked_fields_compact':w['length']>0x0?w['join'](','):undefined,'post_publish_blocked_count':w['length'],'machine':a['machine'],'machine_display_cleared':a['machine']!==undefined?a['machine']??'(cleared)':undefined,'order_allocators_display':a['order_allocators']!==undefined?a['order_allocators']?'(set)':'(cleared)':undefined,'repositories_addset_count':f?(e?.['objects']??[])['length']:undefined,'rewards_addset_count':z?(y?.['objects']??[])['length']:undefined,'rewards_op':y?.['op']};}function serviceRuleBook(){const a=getJudgmentDoc()['rules']['domains']['service'];if(!a)throw new Error('factory\x20rule\x20pack\x20\x27service\x27\x20missing\x20—\x20broken\x20installation');return a['rules'];}function findingToServiceRisk(a){return{'id':a['rule_id'],'level':a['level'],'category':a['dimension']??'structural','title':a['title'],'description':a['description'],'affected_stakeholders':a['stakeholders']??[],'scenario':a['scenario']??'','mitigation':a['mitigation']??'','evidence':a['evidence'],...a['exposure']!=null?{'exposure':a['exposure']}:{}};}export const SERVICE_RISK_VERSION='1.1.0';const SERVICE_STATE_RULE_IDS=['R-S-4-05','R-S-4-06','R-S-5-05'];export function assessServiceStateRisks(a){const b=new Set(SERVICE_STATE_RULE_IDS),{findings:c}=evaluateRuleBook(serviceRuleBook()['filter'](d=>b['has'](d['rule_id'])),serviceRiskFacts(a));return c['map'](findingToServiceRisk);}export function getAllServiceRiskRules(){const a=factoryRulePack('service');if(!a)return[];return a['rules']['map'](b=>({'id':b['rule_id'],'category':b['dimension']??'structural','trigger':b['trigger']??'','check':c=>{const {findings:d}=evaluateRuleBook([b],serviceRiskFacts(c));return d['length']>0x0?findingToServiceRisk(d[0x0]):null;}}));}export function assessServiceRisks(a){const {findings:b}=evaluateRuleBook(serviceRuleBook(),serviceRiskFacts(a)),c=b['map'](findingToServiceRisk),d=c['length']===0x0?'low':c['some'](g=>g['level']==='critical')?'critical':c['some'](g=>g['level']==='high')?'high':c['some'](g=>g['level']==='medium')?'medium':'low',e={};for(const g of c){e[g['category']]=(e[g['category']]??0x0)+0x1;}const f={};for(const h of c){for(const i of h['affected_stakeholders']){if(!f[i])f[i]=[];f[i]['push'](h['id']+':\x20'+h['mitigation']);}}return{'summary':'Assessed\x20'+c['length']+'\x20risk(s)\x20across\x20'+Object['keys'](e)['length']+'\x20categories','risks':c,'overall_risk':d,'risks_by_category':e,'stakeholder_advice':f,'needs_human_review':c['some'](j=>j['level']==='critical'||j['level']==='high')};}