@wowok/agent-mcp 2.4.1 → 2.5.0

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 (348) hide show
  1. package/dist/config/runtime.d.ts +4 -0
  2. package/dist/config/runtime.js +29 -5
  3. package/dist/harness/auto-escalation.d.ts +27 -0
  4. package/dist/harness/auto-escalation.js +68 -0
  5. package/dist/index.d.ts +2 -2
  6. package/dist/index.js +29 -1621
  7. package/dist/knowledge/allocation-confirm.d.ts +115 -0
  8. package/dist/knowledge/allocation-confirm.js +534 -0
  9. package/dist/knowledge/allocation-context.d.ts +58 -0
  10. package/dist/knowledge/allocation-context.js +249 -0
  11. package/dist/knowledge/allocation-ledger.d.ts +67 -0
  12. package/dist/knowledge/allocation-ledger.js +463 -0
  13. package/dist/knowledge/allocation-puzzle.d.ts +135 -0
  14. package/dist/knowledge/allocation-puzzle.js +298 -0
  15. package/dist/knowledge/allocation-risk.d.ts +78 -0
  16. package/dist/knowledge/allocation-risk.js +568 -0
  17. package/dist/knowledge/allocation-templates.d.ts +38 -0
  18. package/dist/knowledge/allocation-templates.js +970 -0
  19. package/dist/knowledge/allocation-translation.d.ts +72 -0
  20. package/dist/knowledge/allocation-translation.js +585 -0
  21. package/dist/knowledge/arb-risk.d.ts +37 -0
  22. package/dist/knowledge/arb-risk.js +210 -0
  23. package/dist/knowledge/arbitration-confirm.d.ts +135 -0
  24. package/dist/knowledge/arbitration-confirm.js +559 -0
  25. package/dist/knowledge/arbitration-context.d.ts +81 -0
  26. package/dist/knowledge/arbitration-context.js +505 -0
  27. package/dist/knowledge/arbitration-ledger.d.ts +62 -0
  28. package/dist/knowledge/arbitration-ledger.js +521 -0
  29. package/dist/knowledge/arbitration-puzzle.d.ts +84 -0
  30. package/dist/knowledge/arbitration-puzzle.js +304 -0
  31. package/dist/knowledge/arbitration-risk.d.ts +112 -0
  32. package/dist/knowledge/arbitration-risk.js +433 -0
  33. package/dist/knowledge/arbitration-templates.d.ts +38 -0
  34. package/dist/knowledge/arbitration-templates.js +276 -0
  35. package/dist/knowledge/arbitration-translation.d.ts +91 -0
  36. package/dist/knowledge/arbitration-translation.js +487 -0
  37. package/dist/knowledge/bridge-risk.d.ts +36 -0
  38. package/dist/knowledge/bridge-risk.js +263 -0
  39. package/dist/knowledge/contact-risk.d.ts +32 -0
  40. package/dist/knowledge/contact-risk.js +200 -0
  41. package/dist/knowledge/demand-confirm.d.ts +32 -0
  42. package/dist/knowledge/demand-confirm.js +206 -0
  43. package/dist/knowledge/demand-risk.d.ts +30 -0
  44. package/dist/knowledge/demand-risk.js +240 -0
  45. package/dist/knowledge/demand-translation.d.ts +55 -0
  46. package/dist/knowledge/demand-translation.js +354 -0
  47. package/dist/knowledge/deployment-scanner.d.ts +63 -0
  48. package/dist/knowledge/deployment-scanner.js +762 -0
  49. package/dist/knowledge/examples-scanner-cli.d.ts +1 -0
  50. package/dist/knowledge/examples-scanner-cli.js +26 -0
  51. package/dist/knowledge/examples-scanner.d.ts +121 -0
  52. package/dist/knowledge/examples-scanner.js +825 -0
  53. package/dist/knowledge/flywheel-loop.d.ts +3 -0
  54. package/dist/knowledge/flywheel-loop.js +32 -3
  55. package/dist/knowledge/glossary.js +3 -1
  56. package/dist/knowledge/guard-confirm.d.ts +86 -0
  57. package/dist/knowledge/guard-confirm.js +406 -0
  58. package/dist/knowledge/guard-context.d.ts +56 -0
  59. package/dist/knowledge/guard-context.js +287 -0
  60. package/dist/knowledge/guard-design-patterns.d.ts +37 -0
  61. package/dist/knowledge/guard-design-patterns.js +257 -0
  62. package/dist/knowledge/guard-ledger.js +14 -0
  63. package/dist/knowledge/guard-lint.d.ts +1 -0
  64. package/dist/knowledge/guard-lint.js +83 -3
  65. package/dist/knowledge/guard-migration.d.ts +48 -0
  66. package/dist/knowledge/guard-migration.js +228 -0
  67. package/dist/knowledge/guard-puzzle.js +3 -2
  68. package/dist/knowledge/guard-risk.d.ts +3 -1
  69. package/dist/knowledge/guard-risk.js +832 -64
  70. package/dist/knowledge/guard-templates.d.ts +1 -0
  71. package/dist/knowledge/guard-templates.js +278 -2
  72. package/dist/knowledge/guard-translation.js +6 -5
  73. package/dist/knowledge/index.d.ts +342 -0
  74. package/dist/knowledge/index.js +344 -0
  75. package/dist/knowledge/machine-confirm.d.ts +102 -0
  76. package/dist/knowledge/machine-confirm.js +559 -0
  77. package/dist/knowledge/machine-context.d.ts +160 -0
  78. package/dist/knowledge/machine-context.js +812 -0
  79. package/dist/knowledge/machine-ledger.d.ts +41 -0
  80. package/dist/knowledge/machine-ledger.js +315 -0
  81. package/dist/knowledge/machine-puzzle.d.ts +206 -0
  82. package/dist/knowledge/machine-puzzle.js +494 -0
  83. package/dist/knowledge/machine-risk.d.ts +75 -0
  84. package/dist/knowledge/machine-risk.js +644 -0
  85. package/dist/knowledge/machine-templates.d.ts +92 -0
  86. package/dist/knowledge/machine-templates.js +1592 -0
  87. package/dist/knowledge/machine-topology.d.ts +57 -0
  88. package/dist/knowledge/machine-topology.js +234 -0
  89. package/dist/knowledge/machine-translation.d.ts +96 -0
  90. package/dist/knowledge/machine-translation.js +513 -0
  91. package/dist/knowledge/mcp-schema-audit-cli.d.ts +1 -0
  92. package/dist/knowledge/mcp-schema-audit-cli.js +45 -0
  93. package/dist/knowledge/mcp-schema-audit.d.ts +90 -0
  94. package/dist/knowledge/mcp-schema-audit.js +772 -0
  95. package/dist/knowledge/onchain-constants.d.ts +4 -0
  96. package/dist/knowledge/onchain-constants.js +35 -0
  97. package/dist/knowledge/order-confirm.d.ts +115 -0
  98. package/dist/knowledge/order-confirm.js +573 -0
  99. package/dist/knowledge/order-context.d.ts +66 -0
  100. package/dist/knowledge/order-context.js +390 -0
  101. package/dist/knowledge/order-ledger.d.ts +69 -0
  102. package/dist/knowledge/order-ledger.js +341 -0
  103. package/dist/knowledge/order-puzzle.d.ts +159 -0
  104. package/dist/knowledge/order-puzzle.js +255 -0
  105. package/dist/knowledge/order-risk.d.ts +66 -0
  106. package/dist/knowledge/order-risk.js +653 -0
  107. package/dist/knowledge/order-templates.d.ts +50 -0
  108. package/dist/knowledge/order-templates.js +368 -0
  109. package/dist/knowledge/order-translation.d.ts +78 -0
  110. package/dist/knowledge/order-translation.js +550 -0
  111. package/dist/knowledge/passport-confirm.d.ts +130 -0
  112. package/dist/knowledge/passport-confirm.js +531 -0
  113. package/dist/knowledge/passport-context.d.ts +59 -0
  114. package/dist/knowledge/passport-context.js +306 -0
  115. package/dist/knowledge/passport-ledger.d.ts +48 -0
  116. package/dist/knowledge/passport-ledger.js +282 -0
  117. package/dist/knowledge/passport-puzzle.d.ts +108 -0
  118. package/dist/knowledge/passport-puzzle.js +333 -0
  119. package/dist/knowledge/passport-risk.d.ts +70 -0
  120. package/dist/knowledge/passport-risk.js +450 -0
  121. package/dist/knowledge/passport-templates.d.ts +40 -0
  122. package/dist/knowledge/passport-templates.js +568 -0
  123. package/dist/knowledge/passport-translation.d.ts +68 -0
  124. package/dist/knowledge/passport-translation.js +516 -0
  125. package/dist/knowledge/payment-risk.d.ts +33 -0
  126. package/dist/knowledge/payment-risk.js +182 -0
  127. package/dist/knowledge/permission-confirm.d.ts +110 -0
  128. package/dist/knowledge/permission-confirm.js +426 -0
  129. package/dist/knowledge/permission-context.d.ts +58 -0
  130. package/dist/knowledge/permission-context.js +224 -0
  131. package/dist/knowledge/permission-ledger.d.ts +38 -0
  132. package/dist/knowledge/permission-ledger.js +403 -0
  133. package/dist/knowledge/permission-puzzle.d.ts +122 -0
  134. package/dist/knowledge/permission-puzzle.js +173 -0
  135. package/dist/knowledge/permission-risk.d.ts +76 -0
  136. package/dist/knowledge/permission-risk.js +411 -0
  137. package/dist/knowledge/permission-templates.d.ts +38 -0
  138. package/dist/knowledge/permission-templates.js +234 -0
  139. package/dist/knowledge/permission-translation.d.ts +57 -0
  140. package/dist/knowledge/permission-translation.js +350 -0
  141. package/dist/knowledge/personal-risk.d.ts +36 -0
  142. package/dist/knowledge/personal-risk.js +212 -0
  143. package/dist/knowledge/progress-confirm.d.ts +108 -0
  144. package/dist/knowledge/progress-confirm.js +456 -0
  145. package/dist/knowledge/progress-context.d.ts +123 -0
  146. package/dist/knowledge/progress-context.js +452 -0
  147. package/dist/knowledge/progress-ledger.d.ts +63 -0
  148. package/dist/knowledge/progress-ledger.js +327 -0
  149. package/dist/knowledge/progress-puzzle.d.ts +82 -0
  150. package/dist/knowledge/progress-puzzle.js +219 -0
  151. package/dist/knowledge/progress-risk.d.ts +74 -0
  152. package/dist/knowledge/progress-risk.js +461 -0
  153. package/dist/knowledge/progress-templates.d.ts +38 -0
  154. package/dist/knowledge/progress-templates.js +228 -0
  155. package/dist/knowledge/progress-translation.d.ts +52 -0
  156. package/dist/knowledge/progress-translation.js +401 -0
  157. package/dist/knowledge/proof-confirm.d.ts +31 -0
  158. package/dist/knowledge/proof-confirm.js +187 -0
  159. package/dist/knowledge/proof-risk.d.ts +33 -0
  160. package/dist/knowledge/proof-risk.js +207 -0
  161. package/dist/knowledge/proof-translation.d.ts +52 -0
  162. package/dist/knowledge/proof-translation.js +283 -0
  163. package/dist/knowledge/registrar-risk.d.ts +34 -0
  164. package/dist/knowledge/registrar-risk.js +217 -0
  165. package/dist/knowledge/repository-confirm.d.ts +36 -0
  166. package/dist/knowledge/repository-confirm.js +242 -0
  167. package/dist/knowledge/repository-risk.d.ts +40 -0
  168. package/dist/knowledge/repository-risk.js +312 -0
  169. package/dist/knowledge/repository-translation.d.ts +58 -0
  170. package/dist/knowledge/repository-translation.js +422 -0
  171. package/dist/knowledge/resource-risk.d.ts +32 -0
  172. package/dist/knowledge/resource-risk.js +157 -0
  173. package/dist/knowledge/reward-confirm.d.ts +113 -0
  174. package/dist/knowledge/reward-confirm.js +496 -0
  175. package/dist/knowledge/reward-context.d.ts +127 -0
  176. package/dist/knowledge/reward-context.js +504 -0
  177. package/dist/knowledge/reward-ledger.d.ts +96 -0
  178. package/dist/knowledge/reward-ledger.js +502 -0
  179. package/dist/knowledge/reward-puzzle.d.ts +97 -0
  180. package/dist/knowledge/reward-puzzle.js +288 -0
  181. package/dist/knowledge/reward-risk.d.ts +84 -0
  182. package/dist/knowledge/reward-risk.js +545 -0
  183. package/dist/knowledge/reward-translation.d.ts +58 -0
  184. package/dist/knowledge/reward-translation.js +501 -0
  185. package/dist/knowledge/safety-rules.js +11 -3
  186. package/dist/knowledge/scenario-modes.d.ts +53 -0
  187. package/dist/knowledge/scenario-modes.js +302 -0
  188. package/dist/knowledge/service-confirm.d.ts +152 -0
  189. package/dist/knowledge/service-confirm.js +699 -0
  190. package/dist/knowledge/service-context.d.ts +66 -0
  191. package/dist/knowledge/service-context.js +403 -0
  192. package/dist/knowledge/service-ledger.d.ts +71 -0
  193. package/dist/knowledge/service-ledger.js +609 -0
  194. package/dist/knowledge/service-puzzle.d.ts +158 -0
  195. package/dist/knowledge/service-puzzle.js +236 -0
  196. package/dist/knowledge/service-risk.d.ts +108 -0
  197. package/dist/knowledge/service-risk.js +615 -0
  198. package/dist/knowledge/service-templates.d.ts +39 -0
  199. package/dist/knowledge/service-templates.js +418 -0
  200. package/dist/knowledge/service-translation.d.ts +103 -0
  201. package/dist/knowledge/service-translation.js +622 -0
  202. package/dist/knowledge/tools-reference.d.ts +17 -0
  203. package/dist/knowledge/tools-reference.js +151 -0
  204. package/dist/knowledge/treasury-confirm.d.ts +133 -0
  205. package/dist/knowledge/treasury-confirm.js +512 -0
  206. package/dist/knowledge/treasury-context.d.ts +64 -0
  207. package/dist/knowledge/treasury-context.js +363 -0
  208. package/dist/knowledge/treasury-ledger.d.ts +42 -0
  209. package/dist/knowledge/treasury-ledger.js +300 -0
  210. package/dist/knowledge/treasury-puzzle.d.ts +163 -0
  211. package/dist/knowledge/treasury-puzzle.js +216 -0
  212. package/dist/knowledge/treasury-risk.d.ts +86 -0
  213. package/dist/knowledge/treasury-risk.js +440 -0
  214. package/dist/knowledge/treasury-templates.d.ts +38 -0
  215. package/dist/knowledge/treasury-templates.js +316 -0
  216. package/dist/knowledge/treasury-translation.d.ts +78 -0
  217. package/dist/knowledge/treasury-translation.js +498 -0
  218. package/dist/knowledge/util-risk.d.ts +30 -0
  219. package/dist/knowledge/util-risk.js +135 -0
  220. package/dist/project/business-puzzle.d.ts +47 -0
  221. package/dist/project/business-puzzle.js +372 -0
  222. package/dist/project/deployment-doc.d.ts +61 -0
  223. package/dist/project/deployment-doc.js +432 -0
  224. package/dist/project/graph.d.ts +1 -0
  225. package/dist/project/graph.js +27 -1
  226. package/dist/project/index.d.ts +1 -0
  227. package/dist/project/index.js +39 -2
  228. package/dist/project/namespace.d.ts +11 -1
  229. package/dist/project/namespace.js +27 -2
  230. package/dist/project/query.d.ts +2 -0
  231. package/dist/project/query.js +56 -15
  232. package/dist/project/risk-aggregator.d.ts +50 -0
  233. package/dist/project/risk-aggregator.js +280 -0
  234. package/dist/project/substep-trace.d.ts +130 -0
  235. package/dist/project/substep-trace.js +332 -0
  236. package/dist/rules.d.ts +12 -0
  237. package/dist/rules.js +9 -0
  238. package/dist/schema/call/allocation.d.ts +44 -44
  239. package/dist/schema/call/arbitration.d.ts +141 -141
  240. package/dist/schema/call/base.d.ts +386 -386
  241. package/dist/schema/call/base.js +6 -6
  242. package/dist/schema/call/bridge-handler.d.ts +5 -2
  243. package/dist/schema/call/bridge.d.ts +159 -159
  244. package/dist/schema/call/contact.d.ts +110 -110
  245. package/dist/schema/call/demand.d.ts +76 -76
  246. package/dist/schema/call/handler.d.ts +2 -3
  247. package/dist/schema/call/handler.js +1 -1
  248. package/dist/schema/call/machine.d.ts +96 -96
  249. package/dist/schema/call/order.d.ts +98 -110
  250. package/dist/schema/call/permission-handler.d.ts +5 -0
  251. package/dist/schema/call/permission-handler.js +54 -0
  252. package/dist/schema/call/permission.d.ts +108 -108
  253. package/dist/schema/call/personal.d.ts +14 -14
  254. package/dist/schema/call/progress.d.ts +57 -72
  255. package/dist/schema/call/progress.js +7 -4
  256. package/dist/schema/call/proof.d.ts +18 -18
  257. package/dist/schema/call/proof.js +12 -7
  258. package/dist/schema/call/repository.d.ts +154 -154
  259. package/dist/schema/call/reward.d.ts +55 -55
  260. package/dist/schema/call/semantic.js +1 -1
  261. package/dist/schema/call/service.d.ts +238 -238
  262. package/dist/schema/call/treasury.d.ts +93 -93
  263. package/dist/schema/config/index.d.ts +178 -5
  264. package/dist/schema/config/index.js +52 -1
  265. package/dist/schema/local/index.d.ts +3554 -836
  266. package/dist/schema/local/index.js +2 -1
  267. package/dist/schema/messenger/index.d.ts +162 -162
  268. package/dist/schema/operations.d.ts +1102 -1118
  269. package/dist/schema/operations.js +7 -1
  270. package/dist/schema/project/index.d.ts +1392 -6
  271. package/dist/schema/project/index.js +426 -2
  272. package/dist/schema/query/index.d.ts +818 -818
  273. package/dist/schema/query/index.js +15 -9
  274. package/dist/schema/schema-query/index.d.ts +23 -3
  275. package/dist/schema/schema-query/index.js +13 -2
  276. package/dist/schema/sync-layer4.d.ts +21 -0
  277. package/dist/schema/sync-layer4.js +261 -0
  278. package/dist/schema/trust/index.d.ts +26 -26
  279. package/dist/schema/utils/guard-query-utils.d.ts +7 -0
  280. package/dist/schema/utils/guard-query-utils.js +14 -1
  281. package/dist/schemas/account_operation.output.json +718 -0
  282. package/dist/schemas/bridge_operation.output.json +1 -1
  283. package/dist/schemas/config_operation.output.json +173 -0
  284. package/dist/schemas/index.json +9 -1
  285. package/dist/schemas/local_info_operation.output.json +718 -0
  286. package/dist/schemas/local_mark_operation.output.json +718 -0
  287. package/dist/schemas/messenger_operation.output.json +1 -1
  288. package/dist/schemas/onchain_events.output.json +1 -1
  289. package/dist/schemas/onchain_operations.output.json +5 -4
  290. package/dist/schemas/onchain_operations.schema.json +1813 -333
  291. package/dist/schemas/onchain_operations_allocation.schema.json +9 -11
  292. package/dist/schemas/onchain_operations_arbitration.schema.json +2 -1
  293. package/dist/schemas/onchain_operations_contact.schema.json +2 -1
  294. package/dist/schemas/onchain_operations_demand.schema.json +2 -1
  295. package/dist/schemas/onchain_operations_gen_passport.schema.json +878 -872
  296. package/dist/schemas/onchain_operations_gen_proof.schema.json +273 -0
  297. package/dist/schemas/onchain_operations_guard.schema.json +584 -70
  298. package/dist/schemas/onchain_operations_machine.schema.json +4 -6
  299. package/dist/schemas/onchain_operations_order.schema.json +13 -9
  300. package/dist/schemas/onchain_operations_payment.schema.json +2 -1
  301. package/dist/schemas/onchain_operations_permission.schema.json +2 -1
  302. package/dist/schemas/onchain_operations_personal.schema.json +2 -1
  303. package/dist/schemas/onchain_operations_progress.schema.json +14 -10
  304. package/dist/schemas/onchain_operations_proof.schema.json +699 -0
  305. package/dist/schemas/onchain_operations_repository.schema.json +2 -1
  306. package/dist/schemas/onchain_operations_reward.schema.json +2 -1
  307. package/dist/schemas/onchain_operations_service.schema.json +4 -6
  308. package/dist/schemas/onchain_operations_treasury.schema.json +2 -1
  309. package/dist/schemas/onchain_table_data.output.json +6 -12
  310. package/dist/schemas/onchain_table_data.schema.json +32 -1
  311. package/dist/schemas/project_operation.output.json +879 -0
  312. package/dist/schemas/project_operation.schema.json +473 -2
  313. package/dist/schemas/query_toolkit.output.json +14906 -6
  314. package/dist/schemas/schema_query.output.json +38 -1
  315. package/dist/telemetry/index.d.ts +1 -1
  316. package/dist/tools/handlers/bridge.d.ts +1 -0
  317. package/dist/tools/handlers/bridge.js +1 -0
  318. package/dist/tools/handlers/config.d.ts +2 -0
  319. package/dist/tools/handlers/config.js +74 -0
  320. package/dist/tools/handlers/file-export.d.ts +3 -0
  321. package/dist/tools/handlers/file-export.js +90 -0
  322. package/dist/tools/handlers/local.d.ts +3 -0
  323. package/dist/tools/handlers/local.js +38 -0
  324. package/dist/tools/handlers/messenger.d.ts +16 -0
  325. package/dist/tools/handlers/messenger.js +188 -0
  326. package/dist/tools/handlers/onchain.d.ts +2 -0
  327. package/dist/tools/handlers/onchain.js +248 -0
  328. package/dist/tools/handlers/project.d.ts +2 -0
  329. package/dist/tools/handlers/project.js +293 -0
  330. package/dist/tools/handlers/query.d.ts +5 -0
  331. package/dist/tools/handlers/query.js +256 -0
  332. package/dist/tools/handlers/schema-query.d.ts +2 -0
  333. package/dist/tools/handlers/schema-query.js +93 -0
  334. package/dist/tools/handlers/trust.d.ts +2 -0
  335. package/dist/tools/handlers/trust.js +194 -0
  336. package/dist/tools/handlers/wip.d.ts +2 -0
  337. package/dist/tools/handlers/wip.js +44 -0
  338. package/dist/tools/index.d.ts +13 -0
  339. package/dist/tools/index.js +526 -0
  340. package/dist/tools/rules-hook.d.ts +2 -0
  341. package/dist/tools/rules-hook.js +23 -0
  342. package/dist/tools/shared.d.ts +20 -0
  343. package/dist/tools/shared.js +130 -0
  344. package/dist/tools/types.d.ts +35 -0
  345. package/dist/tools/types.js +1 -0
  346. package/dist/tools/wrap.d.ts +14 -0
  347. package/dist/tools/wrap.js +267 -0
  348. package/package.json +20 -6
@@ -20,6 +20,7 @@ export interface GuardTemplate {
20
20
  relevant_risks: string[];
21
21
  creation_notes: string[];
22
22
  example_use_case: string;
23
+ verifier_constraint_level?: "level1_strict" | "level2_identity_set" | "level3_scene_combined";
23
24
  }
24
25
  export declare const GUARD_TEMPLATES: GuardTemplate[];
25
26
  export declare function getTemplatesByScene(sceneId: string): GuardTemplate[];
@@ -26,6 +26,7 @@ export const GUARD_TEMPLATES = [
26
26
  "If the Service is already published, the table can use the address directly; otherwise use the name (P16 circular reference)",
27
27
  ],
28
28
  example_use_case: "Internal testing phase for camera equipment rental, allowing only the first 50 seed users to place rental orders.",
29
+ verifier_constraint_level: "level2_identity_set",
29
30
  },
30
31
  {
31
32
  id: "tpl_allocator_threshold",
@@ -55,6 +56,202 @@ export const GUARD_TEMPLATES = [
55
56
  "Threshold boundary must be tested: behavior when exactly equal to the threshold (> vs >=)",
56
57
  ],
57
58
  example_use_case: "E-commerce platform: order amount > 1000 WOW triggers 3-way allocation (platform + merchant + logistics); otherwise 2-way allocation (platform + merchant).",
59
+ verifier_constraint_level: "level3_scene_combined",
60
+ },
61
+ {
62
+ id: "tpl_allocator_treasury_personal",
63
+ scene_id: "service_order_allocators_guard",
64
+ name: "Treasury + personal address allocation (Entity sharing)",
65
+ description: "2 allocators representing 2 merchant collection approaches: (1) named Treasury address for public fund aggregation, (2) fixed personal address. " +
66
+ "Uses sharing.who=Entity so funds always flow to the legitimate recipient regardless of caller — no Signer binding needed in Guard. " +
67
+ "Guards verify the order is at the Complete node + belongs to the service (project binding).",
68
+ recommended_patterns: ["P02", "P10", "P16"],
69
+ parameters: [
70
+ { name: "service_name", type: "string", description: "Service object name (circular ref via P16 — resolved after Service publish)", required: true,
71
+ constraint: "Must be a name, not an address (the Service is not yet published when the Guard is created)" },
72
+ { name: "complete_node_name", type: "string", description: "Expected node name that triggers allocation (e.g. 'Complete')", required: true,
73
+ default: "Complete", constraint: "Must exactly match the Machine node name (case-sensitive)" },
74
+ { name: "treasury_name", type: "string", description: "Named Treasury object (created with the Service's permission)", required: true,
75
+ constraint: "Treasury must be created before the Service; use the SAME permission as the Service for consistency" },
76
+ { name: "personal_address", type: "address", description: "Fixed personal collection address (e.g. the permission creator's address)", required: true },
77
+ ],
78
+ example_table: [
79
+ { identifier: 0, b_submission: true, value_type: "Address", object_type: "Order",
80
+ name: "order_id (Order object submitted at runtime)" },
81
+ { identifier: 1, b_submission: false, value_type: "String", value: "${complete_node_name}",
82
+ name: "Expected Complete node name (case-sensitive)" },
83
+ { identifier: 2, b_submission: false, value_type: "Address", value: "${service_name}",
84
+ name: "Service object (project binding, circular ref via name)" },
85
+ ],
86
+ example_root: {
87
+ type: "logic_and",
88
+ nodes: [
89
+ {
90
+ type: "logic_equal",
91
+ nodes: [
92
+ { type: "query", query: "progress.current", object: { identifier: 0, convert_witness: "OrderProgress" }, parameters: [] },
93
+ { type: "identifier", identifier: 1 },
94
+ ],
95
+ },
96
+ {
97
+ type: "logic_equal",
98
+ nodes: [
99
+ { type: "query", query: "order.service", object: { identifier: 0 }, parameters: [] },
100
+ { type: "identifier", identifier: 2 },
101
+ ],
102
+ },
103
+ ],
104
+ },
105
+ applicable_industries: ["insurance", "ecommerce", "travel", "rental", "subscription"],
106
+ relevant_risks: ["R-C3-05", "R-C3-06", "R-X1-05", "R-X1-01"],
107
+ creation_notes: [
108
+ "2 Guard objects with IDENTICAL root/table but DIFFERENT descriptions (allocators require unique guard addresses — no two allocators may reference the same Guard).",
109
+ "sharing.who=Entity (Treasury/personal) — no Signer binding needed in the Guard (R-C3-06 safe).",
110
+ "First-match-wins: only the first allocator (Treasury) executes; the personal allocator is an alternative (swap the allocators order to activate personal collection).",
111
+ "Treasury should be created with the SAME permission as the Service (permission consistency — different permissions = minor risk).",
112
+ "order.service binding (query 1563) suppresses R-C3-05 (cross-project bypass prevents premature allocation on foreign orders).",
113
+ "order_allocators is immutable after Service publish — verify the Guard logic and sharing config before publishing.",
114
+ ],
115
+ example_use_case: "Insurance service: after a claim reaches the Complete node, order funds are allocated to the insurance Treasury " +
116
+ "(approach 1, for operational fund aggregation) or to the provider's personal address (approach 2, for direct income).",
117
+ verifier_constraint_level: "level3_scene_combined",
118
+ },
119
+ {
120
+ id: "tpl_allocator_identity_set_order_holder",
121
+ scene_id: "service_order_allocators_guard",
122
+ name: "Order-holder identity-set allocation (Level 2)",
123
+ description: "Level 2 identity-set binding: Signer is order.owner (1562, Address) OR order.agent (1567, Bool with [Signer] param). " +
124
+ "Demonstrates the mixed return-type construction pattern — Address-returning queries are wrapped in logic_equal, " +
125
+ "while Bool-returning queries (suffix 'has') are used directly as logic_or children. " +
126
+ "Combined with order.service binding (R-C3-05) for cross-service theft prevention. " +
127
+ "Use when either the order owner or an authorized agent should be able to trigger allocation (e.g. refund to caller).",
128
+ recommended_patterns: ["P02", "P10", "P16"],
129
+ parameters: [
130
+ { name: "service_name", type: "string", description: "Service object name (circular ref via P16)", required: true,
131
+ constraint: "Must be a name, not an address (the Service is not yet published when the Guard is created)" },
132
+ ],
133
+ example_table: [
134
+ { identifier: 0, b_submission: true, value_type: "Address", object_type: "Order",
135
+ name: "order_id (Order object submitted at runtime)" },
136
+ { identifier: 1, b_submission: false, value_type: "Address", value: "${service_name}",
137
+ name: "Service object (project binding, circular ref via name)" },
138
+ ],
139
+ example_root: {
140
+ type: "logic_and",
141
+ nodes: [
142
+ {
143
+ type: "logic_or",
144
+ nodes: [
145
+ {
146
+ type: "logic_equal",
147
+ nodes: [
148
+ { type: "query", query: "order.owner", object: { identifier: 0 }, parameters: [] },
149
+ { type: "context", context: "Signer" },
150
+ ],
151
+ },
152
+ {
153
+ type: "query",
154
+ query: "order.agent has",
155
+ object: { identifier: 0 },
156
+ parameters: [{ type: "context", context: "Signer" }],
157
+ },
158
+ ],
159
+ },
160
+ {
161
+ type: "logic_equal",
162
+ nodes: [
163
+ { type: "query", query: "order.service", object: { identifier: 0 }, parameters: [] },
164
+ { type: "identifier", identifier: 1 },
165
+ ],
166
+ },
167
+ ],
168
+ },
169
+ applicable_industries: ["ecommerce", "rental", "travel", "subscription"],
170
+ relevant_risks: ["R-C3-01", "R-C3-05", "R-C3-06", "R-C4-04"],
171
+ creation_notes: [
172
+ "MIXED RETURN-TYPE CONSTRUCTION (key Level 2 pattern): query 1562 (order.owner) returns Address → wrap in logic_equal with context(Signer); query 1567 (order.agent has) returns Bool → use directly as logic_or child with parameters: [context(Signer)].",
173
+ "logic_or wrapping of the Signer check suppresses R-C4-04 (Level 1 strict binding convenience warning) — this is the recommended Level 2 alternative.",
174
+ "Use this pattern when sharing.who=Signer (funds flow to caller) AND either the owner or an agent should be authorized to trigger allocation.",
175
+ "order.service binding (query 1563) suppresses R-C3-05 (cross-project bypass).",
176
+ "If agents are not needed, use the simpler Level 2 dynamic pattern: logic_equal[query(1562), context(Signer)] without logic_or.",
177
+ ],
178
+ example_use_case: "Refund allocation: when an order is cancelled, either the order owner or an authorized agent can trigger the refund. " +
179
+ "The Guard verifies Signer is order.owner OR order.agent, and that the order belongs to this service.",
180
+ verifier_constraint_level: "level2_identity_set",
181
+ },
182
+ {
183
+ id: "tpl_allocator_identity_set_service_provider_dynamic",
184
+ scene_id: "service_order_allocators_guard",
185
+ name: "Service-provider identity-set allocation with dynamic permission (Level 2)",
186
+ description: "Level 2 identity-set binding with DYNAMIC permission address: Signer is permission.owner (1002, Address) OR " +
187
+ "has admin (1004, Bool with [Signer] param). The permission address is submitted by the caller and verified " +
188
+ "against service.permission (1488) — this survives permission rotation without rebuilding the Guard. " +
189
+ "Use when the Service may rotate its permission (like a company changing its board) and a static permission " +
190
+ "address would break the Guard.",
191
+ recommended_patterns: ["P02", "P10", "P16"],
192
+ parameters: [
193
+ { name: "service_name", type: "string", description: "Service object name (circular ref via P16)", required: true,
194
+ constraint: "Must be a name, not an address (the Service is not yet published when the Guard is created)" },
195
+ ],
196
+ example_table: [
197
+ { identifier: 0, b_submission: true, value_type: "Address", object_type: "Order",
198
+ name: "order_id (Order object submitted at runtime)" },
199
+ { identifier: 1, b_submission: false, value_type: "Address", value: "${service_name}",
200
+ name: "Service object (project binding, circular ref via name)" },
201
+ { identifier: 2, b_submission: true, value_type: "Address", object_type: "Permission",
202
+ name: "permission_id (Permission object submitted by caller — must equal service.permission)" },
203
+ ],
204
+ example_root: {
205
+ type: "logic_and",
206
+ nodes: [
207
+ {
208
+ type: "logic_equal",
209
+ nodes: [
210
+ { type: "query", query: "order.service", object: { identifier: 0 }, parameters: [] },
211
+ { type: "identifier", identifier: 1 },
212
+ ],
213
+ },
214
+ {
215
+ type: "logic_equal",
216
+ nodes: [
217
+ { type: "query", query: "service.permission", object: { identifier: 1 }, parameters: [] },
218
+ { type: "identifier", identifier: 2 },
219
+ ],
220
+ },
221
+ {
222
+ type: "logic_or",
223
+ nodes: [
224
+ {
225
+ type: "logic_equal",
226
+ nodes: [
227
+ { type: "query", query: "permission.owner", object: { identifier: 2 }, parameters: [] },
228
+ { type: "context", context: "Signer" },
229
+ ],
230
+ },
231
+ {
232
+ type: "query",
233
+ query: "permission.admin has",
234
+ object: { identifier: 2 },
235
+ parameters: [{ type: "context", context: "Signer" }],
236
+ },
237
+ ],
238
+ },
239
+ ],
240
+ },
241
+ applicable_industries: ["ecommerce", "rental", "insurance", "travel", "subscription"],
242
+ relevant_risks: ["R-C3-01", "R-C3-05", "R-C3-06", "R-C4-04"],
243
+ creation_notes: [
244
+ "DYNAMIC PERMISSION VERIFICATION (key pattern): caller submits a Permission address (identifier 2); Guard verifies query(1488: service.permission) == submitted permission, then checks 1002/1004 against the submitted permission. This survives permission rotation — if the Service changes its permission, the Guard still works without rebuilding.",
245
+ "MIXED RETURN-TYPE CONSTRUCTION: query 1002 (permission.owner) returns Address → wrap in logic_equal; query 1004 (permission.admin has) returns Bool → use directly as logic_or child with parameters: [context(Signer)].",
246
+ "logic_or wrapping of the Signer check suppresses R-C4-04 (Level 1 strict binding convenience warning).",
247
+ "THREE conditions in logic_and: (1) order.service binding (R-C3-05), (2) dynamic permission verification, (3) identity set (owner OR admin).",
248
+ "Static permission alternative (simpler but breaks on rotation): use a table constant for the permission address instead of b_submission=true + 1488 verification.",
249
+ "Repository-based address set (most flexible, most complex): store the permission address set in a Repository and query dynamically — only for extreme flexibility needs.",
250
+ ],
251
+ example_use_case: "Merchant allocation: the Service may rotate its permission (like a company changing its board). " +
252
+ "The caller submits the current permission address; the Guard verifies it matches service.permission (1488), " +
253
+ "then checks that Signer is the permission owner or has admin rights.",
254
+ verifier_constraint_level: "level2_identity_set",
58
255
  },
59
256
  {
60
257
  id: "tpl_forward_node_check",
@@ -75,8 +272,8 @@ export const GUARD_TEMPLATES = [
75
272
  example_root: {
76
273
  type: "logic_equal",
77
274
  left: {
78
- type: "query", query: "progress.current_node_name",
79
- object: { identifier: 0, convert_witness: 100 },
275
+ type: "query", query: "progress.current",
276
+ object: { identifier: 0, convert_witness: "OrderProgress" },
80
277
  parameters: [],
81
278
  },
82
279
  right: { type: "identifier", identifier: 1 },
@@ -89,6 +286,79 @@ export const GUARD_TEMPLATES = [
89
286
  "Node names are case-sensitive; query returns a String type",
90
287
  ],
91
288
  example_use_case: "Camera equipment rental flow: the user must be at the 'pending return' node to perform the return operation.",
289
+ verifier_constraint_level: "level3_scene_combined",
290
+ },
291
+ {
292
+ id: "tpl_forward_privacy_delivery_proof",
293
+ scene_id: "machine_forward_guard",
294
+ name: "Privacy-delivery Proof verification (strict mode, Messenger → on-chain Proof)",
295
+ description: "Strict-mode guard for 'privacy information delivered via Messenger but not suitable for on-chain publication' " +
296
+ "(e.g. shipping details, return addresses, private credentials). The verifier submits BOTH a Proof object address " +
297
+ "(generated by messenger.submitChainProof) AND the Order object address. Three conditions verify: " +
298
+ "(1) Signer == proof.signer (submitter accountability — 'whoever benefits bears the burden of proof'), " +
299
+ "(2) proof.time > order.time (proof created after the order — freshness, prevents stale-proof replay), " +
300
+ "(3) order.service == service (project binding, suppresses R-C3-05 cross-project bypass). " +
301
+ "No content verification — only submission responsibility. The counterparty can dispute by checking their own " +
302
+ "Messenger conversation. Broad-mode alternative (verify Merkle Root string length == 66 via P15) is documented " +
303
+ "in creation_notes — broad mode trusts the submitter's honesty and is suitable when the Guard is mainly an " +
304
+ "arbitration basis rather than a fund-flow gate.",
305
+ recommended_patterns: ["P10", "P15"],
306
+ parameters: [
307
+ { name: "service_name", type: "string", description: "Service object name (circular ref via P16 — resolved after Service publish)", required: true,
308
+ constraint: "Must be a name, not an address (the Service is not yet published when the Guard is created)" },
309
+ ],
310
+ example_table: [
311
+ { identifier: 0, b_submission: true, value_type: "Address", object_type: "Proof",
312
+ name: "proof_object (Proof address generated by messenger.submitChainProof, submitted by verifier at runtime)",
313
+ binding_constraint: "Must be a Proof object created AFTER the order; signer must equal the transaction Signer" },
314
+ { identifier: 1, b_submission: true, value_type: "Address", object_type: "Order",
315
+ name: "order_object (Order address submitted by verifier at runtime)",
316
+ binding_constraint: "Must belong to the service declared in identifier 2 (order.service == service)" },
317
+ { identifier: 2, b_submission: false, value_type: "Address", value: "${service_name}",
318
+ name: "Service object (project binding, circular ref via name)" },
319
+ ],
320
+ example_root: {
321
+ type: "logic_and",
322
+ nodes: [
323
+ {
324
+ type: "logic_equal",
325
+ nodes: [
326
+ { type: "context", context: "Signer" },
327
+ { type: "query", query: "proof.signer", object: { identifier: 0 }, parameters: [] },
328
+ ],
329
+ },
330
+ {
331
+ type: "logic_as_u256_greater",
332
+ nodes: [
333
+ { type: "query", query: "proof.time", object: { identifier: 0 }, parameters: [] },
334
+ { type: "query", query: "order.time", object: { identifier: 1 }, parameters: [] },
335
+ ],
336
+ },
337
+ {
338
+ type: "logic_equal",
339
+ nodes: [
340
+ { type: "query", query: "order.service", object: { identifier: 1 }, parameters: [] },
341
+ { type: "identifier", identifier: 2 },
342
+ ],
343
+ },
344
+ ],
345
+ },
346
+ applicable_industries: ["ecommerce", "logistics", "service", "privacy delivery"],
347
+ relevant_risks: ["R-C3-01", "R-C3-05", "R-X1-12"],
348
+ creation_notes: [
349
+ "STRICT MODE (this template): verifier submits Proof + Order addresses. Three conditions: Signer==proof.signer (submitter accountability), proof.time>order.time (freshness), order.service==service (project binding). No content verification — only submission responsibility ('beneficiary bears burden of proof' principle).",
350
+ "BROAD MODE ALTERNATIVE: use P15 retained_submission with a String submission (the Merkle Root) and verify calc_string_length == 66 (0x prefix + 64 hex chars). Broad mode trusts the submitter's honesty; the counterparty can dispute by checking their own Messenger conversation. Broad mode is suitable when the Guard is mainly an arbitration basis, not a fund-flow gate.",
351
+ "Guard table supports MULTIPLE b_submission=true Address identifiers (no submission count limit) — this template uses two: Proof (identifier 0) and Order (identifier 1).",
352
+ "submitChainProof(env, peerAddress, description?) sets Proof.about = peerAddress (the counterparty's address). Pass the order_id as a string in the description parameter to associate the Proof with an order (e.g. description: 'order:0x123...').",
353
+ "Query IDs (all zero-parameter): proof.signer=1958, proof.time=1960 (invariant clock_derived, always >0), order.time=1574, order.service=1563.",
354
+ "Forward.guard is immutable after Machine publish — choose broad vs strict before publishing.",
355
+ "The same strict Guard can be reused across ALL Machine forwards that need merkle-root verification (shipping, lost, returns, etc.) — the verifier just submits the relevant Proof + Order each time.",
356
+ "Condition (1) Signer==proof.signer suppresses R-C3-01 (submission not bound to Signer). Condition (3) order.service==service suppresses R-C3-05 (cross-project submission bypass).",
357
+ ],
358
+ example_use_case: "MyShop e-commerce: after delivering shipping details / return addresses via Messenger (privacy info not suitable for on-chain publication), " +
359
+ "the provider generates a Proof via submitChainProof and submits it with the Order address to advance the Machine forward. " +
360
+ "The Guard verifies the submitter is the Proof's signer, the Proof was created after the order, and the order belongs to this service.",
361
+ verifier_constraint_level: "level3_scene_combined",
92
362
  },
93
363
  {
94
364
  id: "tpl_submission_signer_binding",
@@ -126,6 +396,7 @@ export const GUARD_TEMPLATES = [
126
396
  "Providing a binding_constraint field describing value rules is recommended (R-X1-12)",
127
397
  ],
128
398
  example_use_case: "On equipment return, the user submits the 'return' operation; the Guard verifies that the submitter is the service provider and that the operation type is correct.",
399
+ verifier_constraint_level: "level1_strict",
129
400
  },
130
401
  {
131
402
  id: "tpl_reward_one_time_claim",
@@ -160,6 +431,7 @@ export const GUARD_TEMPLATES = [
160
431
  "Reward guard is iterable; duplicate-claim protection requires rebuilding the Guard to update the Repository address",
161
432
  ],
162
433
  example_use_case: "New-user first-order reward: query the user's historical order count via Repository; allow claim only when record_count==0.",
434
+ verifier_constraint_level: "level3_scene_combined",
163
435
  },
164
436
  {
165
437
  id: "tpl_write_guard_type_check",
@@ -201,6 +473,7 @@ export const GUARD_TEMPLATES = [
201
473
  "EntityRegistrar (0xaab) and EntityLinker (0xaaa) are fixed system addresses",
202
474
  ],
203
475
  example_use_case: "E-commerce platform merchant writes product review data; the Guard verifies that the writer is a registered Entity and not a system address.",
476
+ verifier_constraint_level: "level1_strict",
204
477
  },
205
478
  {
206
479
  id: "tpl_usage_guard_threshold",
@@ -231,6 +504,7 @@ export const GUARD_TEMPLATES = [
231
504
  "When Arbitration bPaused=true, blocking takes priority (checked before Guard)",
232
505
  ],
233
506
  example_use_case: "Rental service dispute: only disputes with order amount ≥ 10 WOW are accepted, filtering out small-amount conflicts.",
507
+ verifier_constraint_level: "level3_scene_combined",
234
508
  },
235
509
  {
236
510
  id: "tpl_voting_guard_numeric_weight",
@@ -261,6 +535,7 @@ export const GUARD_TEMPLATES = [
261
535
  "Deriving weights from the Arb object via witness is recommended, rather than submitting them directly",
262
536
  ],
263
537
  example_use_case: "3-person arbitration panel: chief arbitrator weight 3, regular arbitrators weight 1, majority vote decision.",
538
+ verifier_constraint_level: "level2_identity_set",
264
539
  },
265
540
  {
266
541
  id: "tpl_gen_passport_identity",
@@ -291,6 +566,7 @@ export const GUARD_TEMPLATES = [
291
566
  "The generated Passport can be used as submission data for subsequent operations",
292
567
  ],
293
568
  example_use_case: "After the user passes identity verification, a Passport is generated; this Passport is then submitted as an identity credential in subsequent service purchases.",
569
+ verifier_constraint_level: "level1_strict",
294
570
  },
295
571
  ];
296
572
  export function getTemplatesByScene(sceneId) {
@@ -1,3 +1,4 @@
1
+ import { MAX_SUBMISSION_SIZE_PASSPORT } from "@wowok/wowok";
1
2
  export const SEMANTIC_TO_SCHEMA_RULES = [
2
3
  {
3
4
  id: "P02",
@@ -523,7 +524,7 @@ export const SEMANTIC_TO_SCHEMA_RULES = [
523
524
  "The submitted object address should be bound to Signer (query the signer/owner field of the submitted object to validate ownership)",
524
525
  "Submitted numeric values should have range checks (>= min, <= max)",
525
526
  "Total table size must not exceed 40000 bytes",
526
- "Total submission bytes must not exceed 256",
527
+ `Total submission bytes must not exceed ${MAX_SUBMISSION_SIZE_PASSPORT}`,
527
528
  ],
528
529
  example: {
529
530
  root: {
@@ -1000,12 +1001,12 @@ export const GUARD_CONSTRAINT_RULES = [
1000
1001
  },
1001
1002
  {
1002
1003
  id: "RUN_SUB_03",
1003
- name: "submission total bytes ≤ MAX_SUBMISSION_SIZE (256)",
1004
- description: "The total bytes of all data submitted at runtime must not exceed 256",
1004
+ name: `submission total bytes ≤ MAX_SUBMISSION_SIZE_PASSPORT (${MAX_SUBMISSION_SIZE_PASSPORT})`,
1005
+ description: `The total bytes of all data submitted at runtime must not exceed ${MAX_SUBMISSION_SIZE_PASSPORT}`,
1005
1006
  category: "table",
1006
1007
  phase: "runtime",
1007
- validation_logic: "total_submission_bytes <= 256",
1008
- failure_message: "Submission exceeds MAX_SUBMISSION_SIZE (256 bytes)",
1008
+ validation_logic: `total_submission_bytes <= ${MAX_SUBMISSION_SIZE_PASSPORT}`,
1009
+ failure_message: `Submission exceeds MAX_SUBMISSION_SIZE_PASSPORT (${MAX_SUBMISSION_SIZE_PASSPORT} bytes)`,
1009
1010
  verification_location: "Move verify L252",
1010
1011
  },
1011
1012
  {