@wowok/agent-mcp 2.7.1 → 2.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (597) hide show
  1. package/dist/config/index.js +1 -1
  2. package/dist/config/runtime.js +1 -238
  3. package/dist/customer/account-events.d.ts +32 -0
  4. package/dist/customer/account-events.js +1 -0
  5. package/dist/customer/customer-advice.d.ts +1 -0
  6. package/dist/customer/customer-advice.js +1 -130
  7. package/dist/customer/index.js +1 -11
  8. package/dist/customer/industry-risks.js +1 -438
  9. package/dist/customer/info-puzzle.js +1 -681
  10. package/dist/customer/order-monitor.js +1 -328
  11. package/dist/customer/order-strategy.d.ts +1 -1
  12. package/dist/customer/order-strategy.js +1 -373
  13. package/dist/customer/post-purchase.js +1 -351
  14. package/dist/customer/preorder-compare.js +1 -34
  15. package/dist/customer/reminder-system.d.ts +2 -0
  16. package/dist/customer/reminder-system.js +1 -316
  17. package/dist/customer/risk-assessment.d.ts +1 -0
  18. package/dist/customer/risk-assessment.js +1 -397
  19. package/dist/customer/types.d.ts +2 -0
  20. package/dist/customer/types.js +1 -13
  21. package/dist/customer/user-preferences.js +1 -460
  22. package/dist/evaluation/arbitration-game.d.ts +9 -2
  23. package/dist/evaluation/arbitration-game.js +1 -48
  24. package/dist/evaluation/builtins/arbitration-score.d.ts +41 -0
  25. package/dist/evaluation/builtins/arbitration-score.js +1 -0
  26. package/dist/evaluation/builtins/demand-match.js +1 -153
  27. package/dist/evaluation/builtins/index.d.ts +1 -0
  28. package/dist/evaluation/builtins/index.js +1 -10
  29. package/dist/evaluation/builtins/service-risk.js +1 -55
  30. package/dist/evaluation/capability.js +1 -13
  31. package/dist/evaluation/category-match-rules.d.ts +30 -0
  32. package/dist/evaluation/category-match-rules.js +1 -0
  33. package/dist/evaluation/composer.js +1 -40
  34. package/dist/evaluation/engine.js +1 -175
  35. package/dist/evaluation/extract.js +1 -115
  36. package/dist/evaluation/game-strategy.d.ts +27 -0
  37. package/dist/evaluation/game-strategy.js +1 -0
  38. package/dist/evaluation/gap.js +1 -100
  39. package/dist/evaluation/index.d.ts +2 -0
  40. package/dist/evaluation/index.js +1 -11
  41. package/dist/evaluation/location-match.d.ts +42 -0
  42. package/dist/evaluation/location-match.js +1 -0
  43. package/dist/evaluation/node-game.d.ts +31 -3
  44. package/dist/evaluation/node-game.js +1 -57
  45. package/dist/evaluation/path-reasoning.d.ts +35 -0
  46. package/dist/evaluation/path-reasoning.js +1 -0
  47. package/dist/evaluation/region.d.ts +6 -0
  48. package/dist/evaluation/region.js +1 -36
  49. package/dist/evaluation/types.d.ts +18 -0
  50. package/dist/evaluation/types.js +1 -1
  51. package/dist/evaluation/user-injection.js +1 -27
  52. package/dist/experience/experience-reuse.js +1 -103
  53. package/dist/experience/index.js +1 -5
  54. package/dist/experience/intent-distill.js +1 -83
  55. package/dist/experience/realtime-feedback.js +1 -94
  56. package/dist/experience/types.js +1 -1
  57. package/dist/experience/user-profile.d.ts +1 -1
  58. package/dist/experience/user-profile.js +1 -171
  59. package/dist/extensions/business-modules.js +1 -287
  60. package/dist/extensions/capability-manifest.js +1 -781
  61. package/dist/extensions/constraint-registry.js +1 -198
  62. package/dist/extensions/index.d.ts +6 -0
  63. package/dist/extensions/index.js +1 -6
  64. package/dist/extensions/industry-layers.d.ts +75 -0
  65. package/dist/extensions/industry-layers.js +1 -0
  66. package/dist/extensions/industry-pack.d.ts +105 -0
  67. package/dist/extensions/industry-pack.js +1 -0
  68. package/dist/extensions/metric-registry.js +1 -257
  69. package/dist/extensions/mode-evaluator.d.ts +1 -1
  70. package/dist/extensions/mode-evaluator.js +1 -170
  71. package/dist/extensions/modes.js +1 -499
  72. package/dist/extensions/registry.d.ts +1 -0
  73. package/dist/extensions/registry.js +1 -717
  74. package/dist/extensions/types.js +1 -1
  75. package/dist/graph/base.d.ts +8 -0
  76. package/dist/graph/base.js +1 -0
  77. package/dist/harness/auto-escalation.js +1 -68
  78. package/dist/harness/checkpoint.js +1 -129
  79. package/dist/harness/index.d.ts +1 -0
  80. package/dist/harness/index.js +1 -78
  81. package/dist/harness/plan.d.ts +2 -0
  82. package/dist/harness/plan.js +1 -315
  83. package/dist/harness/recover.d.ts +1 -1
  84. package/dist/harness/recover.js +1 -139
  85. package/dist/harness/types.d.ts +2 -3
  86. package/dist/harness/types.js +1 -1
  87. package/dist/harness/verify.js +1 -237
  88. package/dist/index.js +1 -273
  89. package/dist/intent/enrich.js +1 -67
  90. package/dist/intent/index.js +1 -60
  91. package/dist/intent/matcher.js +1 -81
  92. package/dist/intent/store.js +1 -55
  93. package/dist/intent/types.js +1 -10
  94. package/dist/knowledge/acquisition-flywheel.js +1 -192
  95. package/dist/knowledge/allocation-confirm.js +1 -534
  96. package/dist/knowledge/allocation-context.js +1 -249
  97. package/dist/knowledge/allocation-ledger.js +1 -463
  98. package/dist/knowledge/allocation-puzzle.js +1 -298
  99. package/dist/knowledge/allocation-risk.js +1 -568
  100. package/dist/knowledge/allocation-templates.js +1 -970
  101. package/dist/knowledge/allocation-translation.js +1 -585
  102. package/dist/knowledge/anti-cheat.d.ts +37 -0
  103. package/dist/knowledge/anti-cheat.js +1 -0
  104. package/dist/knowledge/arb-confirm.d.ts +28 -0
  105. package/dist/knowledge/arb-confirm.js +1 -0
  106. package/dist/knowledge/arb-risk.js +1 -210
  107. package/dist/knowledge/arb-translation.d.ts +48 -0
  108. package/dist/knowledge/arb-translation.js +1 -0
  109. package/dist/knowledge/arbitration-confirm.js +1 -559
  110. package/dist/knowledge/arbitration-context.js +1 -505
  111. package/dist/knowledge/arbitration-ledger.js +1 -521
  112. package/dist/knowledge/arbitration-puzzle.js +1 -304
  113. package/dist/knowledge/arbitration-risk.js +1 -423
  114. package/dist/knowledge/arbitration-templates.js +1 -276
  115. package/dist/knowledge/arbitration-translation.js +1 -487
  116. package/dist/knowledge/audit-rules.js +1 -141
  117. package/dist/knowledge/bridge-confirm.d.ts +26 -0
  118. package/dist/knowledge/bridge-confirm.js +1 -0
  119. package/dist/knowledge/bridge-risk.js +1 -263
  120. package/dist/knowledge/bridge-translation.d.ts +37 -0
  121. package/dist/knowledge/bridge-translation.js +1 -0
  122. package/dist/knowledge/contact-confirm.d.ts +27 -0
  123. package/dist/knowledge/contact-confirm.js +1 -0
  124. package/dist/knowledge/contact-risk.js +1 -200
  125. package/dist/knowledge/contact-templates.js +1 -60
  126. package/dist/knowledge/contact-translation.d.ts +39 -0
  127. package/dist/knowledge/contact-translation.js +1 -0
  128. package/dist/knowledge/demand-confirm.js +1 -206
  129. package/dist/knowledge/demand-context.d.ts +17 -0
  130. package/dist/knowledge/demand-context.js +1 -0
  131. package/dist/knowledge/demand-ledger.d.ts +26 -0
  132. package/dist/knowledge/demand-ledger.js +1 -0
  133. package/dist/knowledge/demand-matching.js +1 -132
  134. package/dist/knowledge/demand-puzzle.d.ts +29 -0
  135. package/dist/knowledge/demand-puzzle.js +1 -0
  136. package/dist/knowledge/demand-risk.js +1 -240
  137. package/dist/knowledge/demand-templates.d.ts +12 -0
  138. package/dist/knowledge/demand-templates.js +1 -0
  139. package/dist/knowledge/demand-translation.js +1 -354
  140. package/dist/knowledge/deployment-scanner.js +1 -823
  141. package/dist/knowledge/dynamic-pricing.js +1 -87
  142. package/dist/knowledge/evidence-review.d.ts +12 -0
  143. package/dist/knowledge/evidence-review.js +1 -0
  144. package/dist/knowledge/examples-scanner-cli.js +1 -26
  145. package/dist/knowledge/examples-scanner.js +1 -843
  146. package/dist/knowledge/flywheel-loop.d.ts +0 -1
  147. package/dist/knowledge/flywheel-loop.js +1 -404
  148. package/dist/knowledge/fund-layer.js +1 -973
  149. package/dist/knowledge/glossary.js +1 -211
  150. package/dist/knowledge/guard-confirm.js +1 -406
  151. package/dist/knowledge/guard-context.js +1 -287
  152. package/dist/knowledge/guard-design-patterns.js +1 -360
  153. package/dist/knowledge/guard-ledger.js +1 -260
  154. package/dist/knowledge/guard-lint.js +1 -670
  155. package/dist/knowledge/guard-migration.d.ts +1 -1
  156. package/dist/knowledge/guard-migration.js +1 -228
  157. package/dist/knowledge/guard-puzzle.js +1 -805
  158. package/dist/knowledge/guard-render.js +1 -700
  159. package/dist/knowledge/guard-risk.js +1 -1879
  160. package/dist/knowledge/guard-submission-prompt.js +1 -171
  161. package/dist/knowledge/guard-templates.js +1 -1105
  162. package/dist/knowledge/guard-translation.js +1 -1119
  163. package/dist/knowledge/index.d.ts +71 -3
  164. package/dist/knowledge/index.js +1 -436
  165. package/dist/knowledge/industry-evolution.js +1 -323
  166. package/dist/knowledge/industry-generalizer.js +1 -381
  167. package/dist/knowledge/industry-registry.js +1 -174
  168. package/dist/knowledge/intent-metrics.d.ts +4 -3
  169. package/dist/knowledge/intent-metrics.js +1 -566
  170. package/dist/knowledge/machine-confirm.js +1 -559
  171. package/dist/knowledge/machine-context.js +1 -833
  172. package/dist/knowledge/machine-ledger.js +1 -338
  173. package/dist/knowledge/machine-puzzle.js +1 -494
  174. package/dist/knowledge/machine-render.js +1 -565
  175. package/dist/knowledge/machine-risk.js +1 -669
  176. package/dist/knowledge/machine-templates.js +1 -1597
  177. package/dist/knowledge/machine-topology.js +1 -234
  178. package/dist/knowledge/machine-translation.js +1 -513
  179. package/dist/knowledge/market-metrics.d.ts +12 -0
  180. package/dist/knowledge/market-metrics.js +1 -0
  181. package/dist/knowledge/market-operations.d.ts +46 -0
  182. package/dist/knowledge/market-operations.js +1 -0
  183. package/dist/knowledge/mcp-schema-audit-cli.js +1 -45
  184. package/dist/knowledge/mcp-schema-audit.d.ts +22 -22
  185. package/dist/knowledge/mcp-schema-audit.js +1 -777
  186. package/dist/knowledge/onchain-constants.js +1 -35
  187. package/dist/knowledge/order-confirm.js +1 -573
  188. package/dist/knowledge/order-context.js +1 -390
  189. package/dist/knowledge/order-ledger.js +1 -341
  190. package/dist/knowledge/order-puzzle.js +1 -255
  191. package/dist/knowledge/order-risk.js +1 -653
  192. package/dist/knowledge/order-templates.js +1 -368
  193. package/dist/knowledge/order-translation.js +1 -550
  194. package/dist/knowledge/overrides-loader.js +1 -65
  195. package/dist/knowledge/passport-confirm.js +1 -531
  196. package/dist/knowledge/passport-context.js +1 -306
  197. package/dist/knowledge/passport-ledger.js +1 -282
  198. package/dist/knowledge/passport-puzzle.js +1 -333
  199. package/dist/knowledge/passport-risk.js +1 -450
  200. package/dist/knowledge/passport-templates.js +1 -568
  201. package/dist/knowledge/passport-translation.js +1 -516
  202. package/dist/knowledge/payment-confirm.d.ts +26 -0
  203. package/dist/knowledge/payment-confirm.js +1 -0
  204. package/dist/knowledge/payment-risk.js +1 -249
  205. package/dist/knowledge/payment-translation.d.ts +37 -0
  206. package/dist/knowledge/payment-translation.js +1 -0
  207. package/dist/knowledge/permission-confirm.js +1 -426
  208. package/dist/knowledge/permission-context.js +1 -224
  209. package/dist/knowledge/permission-ledger.d.ts +11 -0
  210. package/dist/knowledge/permission-ledger.js +1 -403
  211. package/dist/knowledge/permission-puzzle.js +1 -173
  212. package/dist/knowledge/permission-risk.js +1 -411
  213. package/dist/knowledge/permission-templates.js +1 -234
  214. package/dist/knowledge/permission-translation.js +1 -350
  215. package/dist/knowledge/personal-confirm.d.ts +29 -0
  216. package/dist/knowledge/personal-confirm.js +1 -0
  217. package/dist/knowledge/personal-risk.js +1 -212
  218. package/dist/knowledge/personal-translation.d.ts +37 -0
  219. package/dist/knowledge/personal-translation.js +1 -0
  220. package/dist/knowledge/process-model.d.ts +1 -11
  221. package/dist/knowledge/process-model.js +1 -160
  222. package/dist/knowledge/progress-confirm.js +1 -456
  223. package/dist/knowledge/progress-context.js +1 -452
  224. package/dist/knowledge/progress-ledger.js +1 -330
  225. package/dist/knowledge/progress-puzzle.js +1 -219
  226. package/dist/knowledge/progress-risk.js +1 -461
  227. package/dist/knowledge/progress-templates.js +1 -228
  228. package/dist/knowledge/progress-translation.js +1 -405
  229. package/dist/knowledge/proof-confirm.js +1 -187
  230. package/dist/knowledge/proof-context.d.ts +17 -0
  231. package/dist/knowledge/proof-context.js +1 -0
  232. package/dist/knowledge/proof-ledger.d.ts +34 -0
  233. package/dist/knowledge/proof-ledger.js +1 -0
  234. package/dist/knowledge/proof-puzzle.d.ts +35 -0
  235. package/dist/knowledge/proof-puzzle.js +1 -0
  236. package/dist/knowledge/proof-risk.js +1 -207
  237. package/dist/knowledge/proof-templates.d.ts +22 -0
  238. package/dist/knowledge/proof-templates.js +1 -0
  239. package/dist/knowledge/proof-translation.js +1 -283
  240. package/dist/knowledge/registrar-confirm.d.ts +26 -0
  241. package/dist/knowledge/registrar-confirm.js +1 -0
  242. package/dist/knowledge/registrar-risk.js +1 -217
  243. package/dist/knowledge/registrar-translation.d.ts +37 -0
  244. package/dist/knowledge/registrar-translation.js +1 -0
  245. package/dist/knowledge/repository-confirm.js +1 -286
  246. package/dist/knowledge/repository-context.d.ts +12 -0
  247. package/dist/knowledge/repository-context.js +1 -0
  248. package/dist/knowledge/repository-ledger.d.ts +25 -0
  249. package/dist/knowledge/repository-ledger.js +1 -0
  250. package/dist/knowledge/repository-puzzle.d.ts +30 -0
  251. package/dist/knowledge/repository-puzzle.js +1 -0
  252. package/dist/knowledge/repository-risk.js +1 -373
  253. package/dist/knowledge/repository-templates.d.ts +14 -0
  254. package/dist/knowledge/repository-templates.js +1 -0
  255. package/dist/knowledge/repository-translation.js +1 -445
  256. package/dist/knowledge/reputation-rules.js +1 -99
  257. package/dist/knowledge/resource-confirm.d.ts +25 -0
  258. package/dist/knowledge/resource-confirm.js +1 -0
  259. package/dist/knowledge/resource-risk.js +1 -157
  260. package/dist/knowledge/resource-translation.d.ts +37 -0
  261. package/dist/knowledge/resource-translation.js +1 -0
  262. package/dist/knowledge/reward-confirm.js +1 -526
  263. package/dist/knowledge/reward-context.d.ts +2 -2
  264. package/dist/knowledge/reward-context.js +1 -504
  265. package/dist/knowledge/reward-ledger.js +1 -502
  266. package/dist/knowledge/reward-puzzle.js +1 -300
  267. package/dist/knowledge/reward-risk.js +1 -627
  268. package/dist/knowledge/reward-templates.js +1 -197
  269. package/dist/knowledge/reward-translation.js +1 -501
  270. package/dist/knowledge/safety-rules.d.ts +1 -0
  271. package/dist/knowledge/safety-rules.js +1 -404
  272. package/dist/knowledge/scenario-modes.js +1 -321
  273. package/dist/knowledge/service-confirm.js +1 -807
  274. package/dist/knowledge/service-context.js +1 -403
  275. package/dist/knowledge/service-ledger.js +1 -609
  276. package/dist/knowledge/service-puzzle.js +1 -236
  277. package/dist/knowledge/service-risk.d.ts +1 -1
  278. package/dist/knowledge/service-risk.js +1 -651
  279. package/dist/knowledge/service-templates.js +1 -456
  280. package/dist/knowledge/service-translation.js +1 -622
  281. package/dist/knowledge/template-registry.js +1 -353
  282. package/dist/knowledge/tool-constraints.js +1 -195
  283. package/dist/knowledge/tools-reference.js +1 -178
  284. package/dist/knowledge/treasury-confirm.js +1 -512
  285. package/dist/knowledge/treasury-context.js +1 -363
  286. package/dist/knowledge/treasury-ledger.js +1 -300
  287. package/dist/knowledge/treasury-puzzle.js +1 -216
  288. package/dist/knowledge/treasury-risk.js +1 -440
  289. package/dist/knowledge/treasury-templates.js +1 -358
  290. package/dist/knowledge/treasury-translation.js +1 -498
  291. package/dist/knowledge/trust-metrics.js +1 -198
  292. package/dist/knowledge/universal-template.d.ts +22 -0
  293. package/dist/knowledge/universal-template.js +1 -0
  294. package/dist/knowledge/util-confirm.d.ts +24 -0
  295. package/dist/knowledge/util-confirm.js +1 -0
  296. package/dist/knowledge/util-risk.js +1 -135
  297. package/dist/knowledge/util-translation.d.ts +38 -0
  298. package/dist/knowledge/util-translation.js +1 -0
  299. package/dist/knowledge/workflow-guidance.d.ts +116 -0
  300. package/dist/knowledge/workflow-guidance.js +1 -0
  301. package/dist/loop-engineering/aggregate.js +1 -132
  302. package/dist/loop-engineering/context-collect.js +1 -83
  303. package/dist/loop-engineering/diagnose.js +1 -273
  304. package/dist/loop-engineering/improve.js +1 -405
  305. package/dist/loop-engineering/index.js +1 -4
  306. package/dist/loop-engineering/pipeline.js +1 -56
  307. package/dist/mode-market/index.js +1 -3
  308. package/dist/mode-market/registry.js +1 -124
  309. package/dist/mode-market/review.js +1 -214
  310. package/dist/mode-market/submission.js +1 -85
  311. package/dist/participation/collaborator-interest.d.ts +23 -0
  312. package/dist/participation/collaborator-interest.js +1 -0
  313. package/dist/participation/customer-interest.d.ts +25 -0
  314. package/dist/participation/customer-interest.js +1 -0
  315. package/dist/participation/employee-kpi.d.ts +25 -0
  316. package/dist/participation/employee-kpi.js +1 -0
  317. package/dist/participation/employee-store.d.ts +16 -0
  318. package/dist/participation/employee-store.js +1 -0
  319. package/dist/participation/index.d.ts +2 -0
  320. package/dist/participation/index.js +1 -0
  321. package/dist/participation/merchant-interest.js +1 -100
  322. package/dist/participation/radar-core.d.ts +13 -3
  323. package/dist/participation/radar-core.js +1 -269
  324. package/dist/participation/supplier-interest.d.ts +25 -0
  325. package/dist/participation/supplier-interest.js +1 -0
  326. package/dist/persona/analyzer.js +1 -66
  327. package/dist/persona/bridge.js +1 -86
  328. package/dist/persona/defaults.js +1 -195
  329. package/dist/persona/experience-bridge.js +1 -23
  330. package/dist/persona/index.d.ts +9 -2
  331. package/dist/persona/index.js +1 -71
  332. package/dist/persona/local-region.d.ts +20 -0
  333. package/dist/persona/local-region.js +1 -0
  334. package/dist/persona/model.js +1 -111
  335. package/dist/persona/overrides.d.ts +10 -0
  336. package/dist/persona/overrides.js +1 -0
  337. package/dist/persona/pack-personae.d.ts +11 -0
  338. package/dist/persona/pack-personae.js +1 -0
  339. package/dist/persona/store.js +1 -62
  340. package/dist/persona/strategy-intent.d.ts +20 -0
  341. package/dist/persona/strategy-intent.js +1 -0
  342. package/dist/persona/types.d.ts +6 -2
  343. package/dist/persona/types.js +1 -5
  344. package/dist/project/business-puzzle.d.ts +1 -1
  345. package/dist/project/business-puzzle.js +1 -383
  346. package/dist/project/context-assembly.js +1 -254
  347. package/dist/project/deployment-bridge.js +1 -120
  348. package/dist/project/deployment-doc.js +1 -1126
  349. package/dist/project/edit-planner.js +1 -1342
  350. package/dist/project/evaluation.d.ts +37 -1
  351. package/dist/project/evaluation.js +1 -2011
  352. package/dist/project/game-theory.js +1 -177
  353. package/dist/project/graph-builder.js +1 -656
  354. package/dist/project/graph.d.ts +3 -6
  355. package/dist/project/graph.js +1 -340
  356. package/dist/project/handlers.d.ts +33 -2
  357. package/dist/project/handlers.js +1 -1784
  358. package/dist/project/index.d.ts +2 -0
  359. package/dist/project/index.js +1 -301
  360. package/dist/project/intent-analyzer.js +1 -149
  361. package/dist/project/machine-nodes.js +1 -36
  362. package/dist/project/merchant-guide.d.ts +19 -0
  363. package/dist/project/merchant-guide.js +1 -264
  364. package/dist/project/migration.js +1 -125
  365. package/dist/project/mode-actions.js +1 -309
  366. package/dist/project/namespace.js +1 -206
  367. package/dist/project/participation-radar.js +1 -428
  368. package/dist/project/pipeline-actions.js +1 -109
  369. package/dist/project/project-store.js +1 -422
  370. package/dist/project/query.js +1 -153
  371. package/dist/project/reverse-mapping.d.ts +34 -0
  372. package/dist/project/reverse-mapping.js +1 -0
  373. package/dist/project/risk-aggregator.js +1 -295
  374. package/dist/project/rollback-policy.js +1 -290
  375. package/dist/project/semantic-assembler.js +1 -345
  376. package/dist/project/semantic-graph.d.ts +3 -5
  377. package/dist/project/semantic-graph.js +1 -292
  378. package/dist/project/stage-gate.js +1 -369
  379. package/dist/project/substep-trace.js +1 -332
  380. package/dist/project/task-tracker.js +1 -78
  381. package/dist/project/workflow-design-assessment.d.ts +24 -0
  382. package/dist/project/workflow-design-assessment.js +1 -0
  383. package/dist/role/derivation.d.ts +18 -0
  384. package/dist/role/derivation.js +1 -0
  385. package/dist/role/index.d.ts +5 -0
  386. package/dist/role/index.js +1 -0
  387. package/dist/role/model.d.ts +8 -0
  388. package/dist/role/model.js +1 -0
  389. package/dist/role/resolution.d.ts +11 -0
  390. package/dist/role/resolution.js +1 -0
  391. package/dist/role/types.d.ts +11 -0
  392. package/dist/role/types.js +1 -0
  393. package/dist/rules.js +1 -52
  394. package/dist/safety/confirm-gate.d.ts +1 -1
  395. package/dist/safety/confirm-gate.js +1 -88
  396. package/dist/safety/index.js +1 -3
  397. package/dist/safety/preview.js +1 -52
  398. package/dist/schema/call/allocation.d.ts +186 -1385
  399. package/dist/schema/call/allocation.js +1 -34
  400. package/dist/schema/call/arbitration.d.ts +272 -1871
  401. package/dist/schema/call/arbitration.js +1 -113
  402. package/dist/schema/call/base.d.ts +1831 -9076
  403. package/dist/schema/call/base.js +1 -370
  404. package/dist/schema/call/bridge.d.ts +911 -3171
  405. package/dist/schema/call/bridge.js +1 -458
  406. package/dist/schema/call/contact.d.ts +135 -931
  407. package/dist/schema/call/contact.js +1 -37
  408. package/dist/schema/call/demand.d.ts +164 -1194
  409. package/dist/schema/call/demand.js +1 -47
  410. package/dist/schema/call/guard.d.ts +298 -1140
  411. package/dist/schema/call/guard.js +1 -161
  412. package/dist/schema/call/handler.js +1 -322
  413. package/dist/schema/call/index.js +1 -20
  414. package/dist/schema/call/machine.d.ts +459 -5403
  415. package/dist/schema/call/machine.js +1 -193
  416. package/dist/schema/call/order.d.ts +137 -844
  417. package/dist/schema/call/order.js +1 -35
  418. package/dist/schema/call/payment.d.ts +74 -561
  419. package/dist/schema/call/payment.js +1 -37
  420. package/dist/schema/call/permission-handler.js +1 -54
  421. package/dist/schema/call/permission.d.ts +335 -2791
  422. package/dist/schema/call/permission.js +1 -105
  423. package/dist/schema/call/personal.d.ts +227 -1814
  424. package/dist/schema/call/personal.js +1 -78
  425. package/dist/schema/call/progress.d.ts +140 -843
  426. package/dist/schema/call/progress.js +1 -47
  427. package/dist/schema/call/proof.d.ts +42 -258
  428. package/dist/schema/call/proof.js +1 -33
  429. package/dist/schema/call/repository.d.ts +324 -2222
  430. package/dist/schema/call/repository.js +1 -77
  431. package/dist/schema/call/reward.d.ts +153 -1183
  432. package/dist/schema/call/reward.js +1 -30
  433. package/dist/schema/call/semantic.js +1 -1679
  434. package/dist/schema/call/service.d.ts +376 -3431
  435. package/dist/schema/call/service.js +1 -184
  436. package/dist/schema/call/treasury.d.ts +252 -2158
  437. package/dist/schema/call/treasury.js +1 -71
  438. package/dist/schema/common/index.d.ts +222 -697
  439. package/dist/schema/common/index.js +1 -407
  440. package/dist/schema/config/index.d.ts +18 -161
  441. package/dist/schema/config/index.js +1 -68
  442. package/dist/schema/employee/index.d.ts +99 -0
  443. package/dist/schema/employee/index.js +1 -0
  444. package/dist/schema/evaluation/index.d.ts +1062 -3748
  445. package/dist/schema/evaluation/index.js +1 -356
  446. package/dist/schema/index.d.ts +3 -0
  447. package/dist/schema/index.js +1 -17
  448. package/dist/schema/industry-pack/index.d.ts +132 -0
  449. package/dist/schema/industry-pack/index.js +1 -0
  450. package/dist/schema/intent-radar/index.d.ts +92 -245
  451. package/dist/schema/intent-radar/index.js +1 -89
  452. package/dist/schema/local/index.d.ts +2045 -18080
  453. package/dist/schema/local/index.js +1 -927
  454. package/dist/schema/local/wip.d.ts +61 -651
  455. package/dist/schema/local/wip.js +1 -187
  456. package/dist/schema/messenger/index.d.ts +949 -5557
  457. package/dist/schema/messenger/index.js +1 -475
  458. package/dist/schema/operations.d.ts +2969 -26518
  459. package/dist/schema/operations.js +1 -520
  460. package/dist/schema/persona/index.d.ts +469 -1820
  461. package/dist/schema/persona/index.js +1 -148
  462. package/dist/schema/project/index.d.ts +1027 -8408
  463. package/dist/schema/project/index.js +1 -2057
  464. package/dist/schema/query/index.d.ts +12041 -75261
  465. package/dist/schema/query/index.js +1 -1646
  466. package/dist/schema/schema-query/index.d.ts +35 -98
  467. package/dist/schema/schema-query/index.js +1 -104
  468. package/dist/schema/schema-version.js +1 -76
  469. package/dist/schema/task-status.d.ts +26 -132
  470. package/dist/schema/task-status.js +1 -36
  471. package/dist/schema/trust/index.d.ts +194 -1290
  472. package/dist/schema/trust/index.js +1 -314
  473. package/dist/schema/utils/guard-parser.js +1 -419
  474. package/dist/schema/utils/guard-query-utils.js +1 -46
  475. package/dist/schema/utils/node-parser.js +1 -369
  476. package/dist/schema/utils/object-type-utils.js +1 -35
  477. package/dist/schema/utils/permission-index-utils.js +1 -7
  478. package/dist/schema/utils/permission-machine-check.js +1 -121
  479. package/dist/schema/utils/skills-recommendation.d.ts +1 -0
  480. package/dist/schema/utils/skills-recommendation.js +1 -77
  481. package/dist/schema/workspace/index.d.ts +69 -0
  482. package/dist/schema/workspace/index.js +1 -0
  483. package/dist/schema-query-impl/index.js +1 -0
  484. package/dist/schemas/account_operation.output.json +3147 -1652
  485. package/dist/schemas/account_operation.schema.json +225 -218
  486. package/dist/schemas/bridge_operation.output.json +1168 -650
  487. package/dist/schemas/bridge_operation.schema.json +736 -504
  488. package/dist/schemas/config_operation.output.json +185 -179
  489. package/dist/schemas/config_operation.schema.json +21 -26
  490. package/dist/schemas/employee_operation.output.json +207 -0
  491. package/dist/schemas/employee_operation.schema.json +176 -0
  492. package/dist/schemas/evaluation_operation.output.json +2329 -557
  493. package/dist/schemas/evaluation_operation.schema.json +2939 -720
  494. package/dist/schemas/guard2file.output.json +58 -64
  495. package/dist/schemas/guard2file.schema.json +79 -81
  496. package/dist/schemas/index.json +29 -11
  497. package/dist/schemas/industry_pack_operation.output.json +594 -0
  498. package/dist/schemas/industry_pack_operation.schema.json +55 -0
  499. package/dist/schemas/intent_radar.output.json +275 -200
  500. package/dist/schemas/intent_radar.schema.json +124 -123
  501. package/dist/schemas/local_info_operation.output.json +1174 -657
  502. package/dist/schemas/local_info_operation.schema.json +119 -125
  503. package/dist/schemas/local_mark_operation.output.json +1239 -689
  504. package/dist/schemas/local_mark_operation.schema.json +91 -96
  505. package/dist/schemas/machineNode2file.output.json +63 -69
  506. package/dist/schemas/machineNode2file.schema.json +79 -81
  507. package/dist/schemas/messenger_operation.output.json +2722 -1528
  508. package/dist/schemas/messenger_operation.schema.json +1482 -1264
  509. package/dist/schemas/onchain_events.output.json +2590 -975
  510. package/dist/schemas/onchain_events.schema.json +117 -99
  511. package/dist/schemas/onchain_operations.output.json +3957 -2309
  512. package/dist/schemas/onchain_operations.schema.json +20799 -9285
  513. package/dist/schemas/onchain_operations_allocation.schema.json +172 -108
  514. package/dist/schemas/onchain_operations_arbitration.schema.json +233 -146
  515. package/dist/schemas/onchain_operations_contact.schema.json +129 -90
  516. package/dist/schemas/onchain_operations_demand.schema.json +170 -112
  517. package/dist/schemas/onchain_operations_gen_passport.schema.json +61 -646
  518. package/dist/schemas/onchain_operations_gen_proof.schema.json +40 -172
  519. package/dist/schemas/onchain_operations_guard.schema.json +3765 -294
  520. package/dist/schemas/onchain_operations_machine.schema.json +537 -164
  521. package/dist/schemas/onchain_operations_order.schema.json +126 -96
  522. package/dist/schemas/onchain_operations_payment.schema.json +82 -67
  523. package/dist/schemas/onchain_operations_permission.schema.json +331 -93
  524. package/dist/schemas/onchain_operations_personal.schema.json +636 -96
  525. package/dist/schemas/onchain_operations_progress.schema.json +125 -92
  526. package/dist/schemas/onchain_operations_proof.schema.json +76 -69
  527. package/dist/schemas/onchain_operations_repository.schema.json +636 -249
  528. package/dist/schemas/onchain_operations_reward.schema.json +218 -108
  529. package/dist/schemas/onchain_operations_service.schema.json +679 -221
  530. package/dist/schemas/onchain_operations_treasury.schema.json +401 -135
  531. package/dist/schemas/onchain_table_data.output.json +6018 -2430
  532. package/dist/schemas/onchain_table_data.schema.json +544 -430
  533. package/dist/schemas/persona_operation.output.json +1568 -265
  534. package/dist/schemas/persona_operation.schema.json +346 -202
  535. package/dist/schemas/project_operation.output.json +6957 -5147
  536. package/dist/schemas/project_operation.schema.json +1050 -1020
  537. package/dist/schemas/query_task_status.output.json +195 -99
  538. package/dist/schemas/query_task_status.schema.json +12 -18
  539. package/dist/schemas/query_toolkit.output.json +18870 -14566
  540. package/dist/schemas/query_toolkit.schema.json +614 -522
  541. package/dist/schemas/schema_query.output.json +127 -129
  542. package/dist/schemas/schema_query.schema.json +64 -69
  543. package/dist/schemas/trust_score.output.json +678 -587
  544. package/dist/schemas/trust_score.schema.json +289 -277
  545. package/dist/schemas/wip_file.output.json +116 -124
  546. package/dist/schemas/wip_file.schema.json +142 -143
  547. package/dist/schemas/workspace_operation.output.json +277 -0
  548. package/dist/schemas/workspace_operation.schema.json +45 -0
  549. package/dist/schemas/wowok_buildin_info.output.json +1693 -723
  550. package/dist/schemas/wowok_buildin_info.schema.json +576 -512
  551. package/dist/telemetry/index.js +1 -112
  552. package/dist/telemetry/redact.js +1 -23
  553. package/dist/telemetry/storage.js +1 -80
  554. package/dist/tools/handlers/bridge.d.ts +8 -1
  555. package/dist/tools/handlers/bridge.js +1 -1
  556. package/dist/tools/handlers/config.js +1 -74
  557. package/dist/tools/handlers/employee.d.ts +2 -0
  558. package/dist/tools/handlers/employee.js +1 -0
  559. package/dist/tools/handlers/evaluation.js +1 -123
  560. package/dist/tools/handlers/file-export.js +1 -90
  561. package/dist/tools/handlers/industry-pack.d.ts +2 -0
  562. package/dist/tools/handlers/industry-pack.js +1 -0
  563. package/dist/tools/handlers/intent-radar.js +1 -76
  564. package/dist/tools/handlers/local.js +1 -53
  565. package/dist/tools/handlers/messenger.js +1 -188
  566. package/dist/tools/handlers/onchain.js +1 -1180
  567. package/dist/tools/handlers/persona.js +1 -89
  568. package/dist/tools/handlers/project.js +1 -211
  569. package/dist/tools/handlers/query.js +1 -434
  570. package/dist/tools/handlers/schema-query.js +1 -176
  571. package/dist/tools/handlers/task-status.js +1 -26
  572. package/dist/tools/handlers/trust.js +1 -380
  573. package/dist/tools/handlers/wip.js +1 -90
  574. package/dist/tools/handlers/workspace.d.ts +2 -0
  575. package/dist/tools/handlers/workspace.js +1 -0
  576. package/dist/tools/index.d.ts +2 -1
  577. package/dist/tools/index.js +1 -1382
  578. package/dist/tools/retry.js +1 -85
  579. package/dist/tools/rules-hook.d.ts +1 -1
  580. package/dist/tools/rules-hook.js +1 -23
  581. package/dist/tools/shared.d.ts +1 -1
  582. package/dist/tools/shared.js +1 -130
  583. package/dist/tools/types.d.ts +2 -1
  584. package/dist/tools/types.js +1 -1
  585. package/dist/tools/upgrade-check.d.ts +19 -0
  586. package/dist/tools/upgrade-check.js +1 -0
  587. package/dist/tools/wip-deploy-assist.js +1 -306
  588. package/dist/tools/wrap.js +1 -500
  589. package/package.json +7 -6
  590. package/dist/knowledge/arbitration-trust.d.ts +0 -24
  591. package/dist/knowledge/arbitration-trust.js +0 -117
  592. package/dist/schema/call/bridge-handler.d.ts +0 -8
  593. package/dist/schema/call/bridge-handler.js +0 -265
  594. package/dist/schema/sync-layer4.d.ts +0 -21
  595. package/dist/schema/sync-layer4.js +0 -286
  596. package/dist/schema-query/index.js +0 -810
  597. /package/dist/{schema-query → schema-query-impl}/index.d.ts +0 -0
@@ -1,360 +1 @@
1
- export const GUARD_DESIGN_PATTERNS = [
2
- {
3
- id: "pattern.identity_check_single",
4
- business_requirement: "Only the author can purchase this service (strict single-identity)",
5
- data_source: "SystemContext",
6
- host: "service_buy_guard",
7
- verifier_level: "level1_strict_single",
8
- logic_summary: "logic_equal[context(Signer), identifier[N](fixed_address)]",
9
- key_queries: [],
10
- mitigated_risks: ["R-C4-04"],
11
- notes: [
12
- "Maximally secure but maximally inconvenient",
13
- "If address is unavailable (key loss, rotation), Guard permanently blocks",
14
- "Avoid unless role is permanently tied to one address",
15
- ],
16
- },
17
- {
18
- id: "pattern.identity_check_allowlist",
19
- business_requirement: "Customer must be in an allowlist to purchase",
20
- data_source: "SystemContext",
21
- host: "service_buy_guard",
22
- verifier_level: "level2_identity_set",
23
- logic_summary: "vec_contains_address[identifier[N](allowlist_vec), context(Signer)]",
24
- key_queries: [],
25
- mitigated_risks: ["R-C4-04"],
26
- notes: ["Allowlist stored as Address vector in table constant"],
27
- },
28
- {
29
- id: "pattern.identity_check_order_holder",
30
- business_requirement: "Only order owner or agent can perform operation",
31
- data_source: "OnChainConstant",
32
- host: "machine_forward",
33
- verifier_level: "level2_identity_set",
34
- logic_summary: "logic_or[logic_equal[query(1562 order.owner), context(Signer)], query(1567 order.agent has, Signer)]",
35
- key_queries: ["order.owner", "order.agent has"],
36
- mitigated_risks: ["R-C4-04", "R-C3-06"],
37
- notes: [
38
- "1562 returns Address → wrap in logic_equal",
39
- "1567 returns Bool → use directly as logic_or child",
40
- "Recommended Level 2 alternative to Level 1 strict binding",
41
- ],
42
- },
43
- {
44
- id: "pattern.identity_check_service_provider_dynamic",
45
- business_requirement: "Verify caller is service's current permission owner (survives permission rotation)",
46
- data_source: "SubmittedObject",
47
- host: "machine_forward",
48
- verifier_level: "level2_identity_set",
49
- logic_summary: "logic_and[logic_equal[query(1488 service.permission), identifier[N](submitted_perm)], logic_or[logic_equal[query(1002 permission.owner), context(Signer)], query(1004 permission.admin has, Signer)]]",
50
- key_queries: ["service.permission", "permission.owner", "permission.admin has"],
51
- mitigated_risks: ["R-C4-04", "R-C3-05"],
52
- notes: [
53
- "Dynamic permission address (RECOMMENDED) — survives Service permission rotation",
54
- "Caller submits permission address; Guard verifies match then checks identity",
55
- "More complex than static but far more robust",
56
- ],
57
- },
58
- {
59
- id: "pattern.time_lock_progress",
60
- business_requirement: "Customer must wait N hours before completing (time-lock)",
61
- data_source: "WitnessDerived",
62
- host: "machine_forward",
63
- verifier_level: "none",
64
- logic_summary: "logic_as_u256_ge[context(Clock), calc_number_add[query(1272 progress.current_time, witness=OrderProgress), identifier[N](duration_ms)]]",
65
- key_queries: ["progress.current_time"],
66
- witness_types: ["OrderProgress"],
67
- mitigated_risks: [],
68
- notes: [
69
- "Use convert_witness=100 (OrderProgress) to derive Progress from submitted Order ID",
70
- "Duration in milliseconds — test with small values first",
71
- ],
72
- },
73
- {
74
- id: "pattern.time_lock_absolute",
75
- business_requirement: "Operation allowed only after a fixed timestamp",
76
- data_source: "SystemContext",
77
- host: "service_buy_guard",
78
- verifier_level: "none",
79
- logic_summary: "logic_as_u256_ge[context(Clock), identifier[N](release_timestamp)]",
80
- key_queries: [],
81
- mitigated_risks: [],
82
- notes: ["Useful for pre-sale windows, embargo periods"],
83
- },
84
- {
85
- id: "pattern.repository_data_check",
86
- business_requirement: "External data must match expected value (e.g., weather, price feed)",
87
- data_source: "OnChainConstant",
88
- host: "machine_forward",
89
- verifier_level: "none",
90
- logic_summary: "logic_equal[query(1167 repository.data, policy, key), identifier[N](expected_value)]",
91
- key_queries: ["repository.data"],
92
- mitigated_risks: [],
93
- notes: [
94
- "Repository address declared as table constant",
95
- "Timestamp keys may need convert_number_address",
96
- "quote_guard context: fails in gen_passport (impack_list empty), works in on-chain business operations (see R-X1-10)",
97
- ],
98
- },
99
- {
100
- id: "pattern.repository_quote_guard_subscription",
101
- business_requirement: "Repository data access requires payment proof (subscription revenue model)",
102
- data_source: "SubmittedObject",
103
- host: "repository_write",
104
- verifier_level: "level3_scene_combined",
105
- logic_summary: "Repository policy sets quote_guard (is_depended: immutable + rep=true). " +
106
- "When a Guard queries this Repository's data (query 1167), check_repository_quote_guard verifies " +
107
- "the quote_guard is in impack_list. The quote_guard itself verifies a submitted Payment " +
108
- "(payment.info.for matches Repository, payment.amount meets subscription price). " +
109
- "User submits Payment via Passport → quote_guard verified → added to impack_list → query 1167 passes.",
110
- key_queries: ["repository.data", "payment.info.for", "payment.amount"],
111
- mitigated_risks: ["R-X1-10"],
112
- applicable_industries: ["subscription", "travel", "rental", "education"],
113
- notes: [
114
- "VERIFIED: passport.rs#L545-612 (check_repository_quote_guard), passport.rs#L758-769 (trigger at query_id==1167)",
115
- "Repository.owner_receive<T> accepts Payment as subscription revenue (repository.move#L714-717)",
116
- "quote_guard must be is_depended: immutable=true, relies empty, rep=true (guard.move#L133-135)",
117
- "VERIFIER-EVIDENCE DESIGN: user submits valid Payment, quote_guard verifies Payment fields — no affiliation needed",
118
- "gen_passport context: quote_guard fails (impack_list empty) — only use for on-chain business operations",
119
- "Business model: data provider publishes weather/market/oracle data to Repository, " +
120
- "users pay subscription to access data in their Machine flows",
121
- ],
122
- },
123
- {
124
- id: "pattern.supply_chain_suborder_verification",
125
- business_requirement: "Sub-service purchase requires ownership of main service order (supply chain milestone unlock)",
126
- data_source: "SubmittedObject",
127
- host: "service_buy_guard",
128
- verifier_level: "level2_identity_set",
129
- logic_summary: "Sub-service buy_guard verifies submitted main Order: " +
130
- "logic_and[logic_equal[query(order.owner), context(Signer)], logic_equal[query(order.service), identifier[N](main_service_address)]]. " +
131
- "User submits main Order via Passport (b_submission=true), buy_guard verifies ownership + service match.",
132
- key_queries: ["order.owner", "order.service"],
133
- mitigated_risks: ["R-C3-05"],
134
- applicable_industries: ["travel", "rental", "education", "freelance"],
135
- notes: [
136
- "VERIFIER-EVIDENCE DESIGN: user submits main Order as evidence, buy_guard verifies order.owner==Signer AND order.service==main_service",
137
- "Each milestone = one sub-order with its own Service + buy_guard referencing the main order",
138
- "Main flow can branch to different sub-services based on Machine node progression",
139
- "No parent_order field needed — relationship verified via buy_guard querying submitted Order fields",
140
- "Enables supply chain composition: main service → multiple sub-services with conditional access",
141
- ],
142
- },
143
- {
144
- id: "pattern.payment_exception_compensation",
145
- business_requirement: "Exception branch triggers compensation Payment (e.g., delivery delay > 30min auto-compensates customer)",
146
- data_source: "SubmittedObject",
147
- host: "machine_forward",
148
- verifier_level: "level3_scene_combined",
149
- logic_summary: "Exception forward guard verifies 4-dimensional anti-reuse binding: logic_and[" +
150
- "logic_equal[query(payment.info.for), identifier[N](order_address)], " +
151
- "logic_equal[query(payment.info.guard), identifier[N](this_guard_address)], " +
152
- "logic_as_u256_ge[query(payment.amount), identifier[N](compensation_amount)], " +
153
- "logic_as_u256_equal[query(payment.info.index), query(progress.history count)], " +
154
- "logic_string_nocase_equal[query(payment.info.remark), query(progress.current)]]. " +
155
- "Treasury withdraws to customer with PaymentInfo(for_object=order, for_guard=this, index=history_count_at_creation, remark=node_name). " +
156
- "Customer submits Payment via Passport; guard verifies index matches current unique step (progress.history count, U64, monotonically increasing — unique even in cycles) AND remark matches current node name (progress.current, String — may repeat across cycles but bound to this step by index).",
157
- key_queries: [
158
- "payment.info.for",
159
- "payment.info.guard",
160
- "payment.info.index",
161
- "payment.info.remark",
162
- "payment.amount",
163
- "progress.history count",
164
- "progress.current",
165
- ],
166
- mitigated_risks: [],
167
- applicable_industries: ["rental", "travel", "general", "freelance"],
168
- notes: [
169
- "VERIFIED: payment.move#L66-71 (PaymentInfo: for_object, for_guard, remark, index), payment.move#L82-86 (payment_info_with_guard)",
170
- "VERIFIED: treasury.move#L249-264 (withdraw creates Payment via payment::new_singleton + from_object_set)",
171
- "Payment is freeze_object (immutable, payment.move#L160) — cannot be modified after creation",
172
- "VERIFIED INDEX QUERY: progress.history count (id 1273, U64) — guard-ins.ts#L1228-1237. From progress.move L440-441 (session_accomplish pushes a new History entry) + L475/L482 (parent_table_vec::length returns current session id). This count is the unique monotonically increasing step index — even in cycles, each entry has a different count.",
173
- "VERIFIED NODE NAME QUERY: progress.current (id 1253, String) — guard-ins.ts#L1025-1032. Returns the current node name. A node CAN be entered multiple times in cycles, so node name alone is NOT unique — it MUST be paired with progress.history count for uniqueness.",
174
- "DESIGN INTENT (USER): to validate index (U64 type), use progress.history count (unique, non-repeating); to validate node name (may repeat in cycles), store it in PaymentInfo.remark and do string comparison with progress.current.",
175
- "ANTI-REUSE 4-DIMENSIONAL BINDING: for_object (Order) + for_guard (Guard) + index (unique step via progress.history count) + remark (node name via progress.current). Same Payment cannot be reused in other contexts — at least one field will mismatch.",
176
- "VERIFIER-EVIDENCE DESIGN: customer submits Payment, guard verifies binding fields match current context",
177
- "Enables user-friendly exception handling: delay → auto-compensation → friendly branch flow",
178
- "No affiliation registration needed — guard only verifies submitted Payment's field accuracy",
179
- ],
180
- },
181
- {
182
- id: "pattern.verifier_evidence_philosophy",
183
- business_requirement: "Guard design philosophy: verifier provides evidence, guard verifies logic + data accuracy (NOT data discovery)",
184
- data_source: "SubmittedObject",
185
- host: "gen_passport",
186
- verifier_level: "none",
187
- logic_summary: "Guard is a PURE VERIFICATION engine. Participants submit evidence (Payment, Order, Proof, etc.) " +
188
- "via Passport submissions (b_submission=true). Guard verifies: (1) logic completeness, (2) data usage accuracy. " +
189
- "Guard does NOT discover/fetch objects via affiliation. Affiliation is for object lifecycle bookkeeping, " +
190
- "NOT for guard data discovery.",
191
- key_queries: [],
192
- mitigated_risks: ["R-C3-05", "R-C3-06"],
193
- notes: [
194
- "CORE PRINCIPLE: Guard only validates submitted evidence — it never fetches data on its own",
195
- "For Payment verification: user submits valid Payment → guard checks for_object/for_guard/index match",
196
- "For multi-order verification: verifier submits Order data → guard checks service/owner relationships",
197
- "For Repository access: user submits Payment → quote_guard verifies → impack_list updated → data query passes",
198
- "Type 3 (SubmittedObject) data source class embodies this philosophy — b_submission=true entries",
199
- "This pattern is foundational for all guard designs — always prefer verifier-evidence over complex object discovery",
200
- ],
201
- },
202
- {
203
- id: "pattern.progress_state_check",
204
- business_requirement: "Specific forward has been accomplished (customer confirms delivery)",
205
- data_source: "WitnessDerived",
206
- host: "reward_claim",
207
- verifier_level: "none",
208
- logic_summary: "logic_equal[query_progress_history_find(...).accomplished, identifier[N](true)]",
209
- key_queries: ["progress.current", "progress.current_time"],
210
- witness_types: ["OrderProgress"],
211
- mitigated_risks: [],
212
- notes: ["Chain query_progress_history_find → query_progress_history_session_forward_find"],
213
- },
214
- {
215
- id: "pattern.reward_one_time_claim",
216
- business_requirement: "User can only claim reward once (no prior claims)",
217
- data_source: "OnChainConstant",
218
- host: "reward_claim",
219
- verifier_level: "none",
220
- logic_summary: "logic_equal[query_reward_record_count(recipient=Signer), identifier[N](0)]",
221
- key_queries: ["reward.record_count"],
222
- mitigated_risks: [],
223
- notes: ["Record count check prevents double-claim"],
224
- },
225
- {
226
- id: "pattern.reward_multi_condition",
227
- business_requirement: "Order payment > threshold AND reached 'complete' to claim reward",
228
- data_source: "WitnessDerived",
229
- host: "reward_claim",
230
- verifier_level: "none",
231
- logic_summary: "logic_and[logic_as_u256_gt[query(order.amount), threshold], logic_equal[query(progress.current), 'complete'], logic_equal[query(order.service), identifier[N](expected_service)]]",
232
- key_queries: ["order.amount", "progress.current", "order.service"],
233
- witness_types: ["OrderProgress"],
234
- mitigated_risks: ["R-C3-05"],
235
- notes: ["Multi-condition: amount + progress state + service match"],
236
- },
237
- {
238
- id: "pattern.arbitration_voting_weight",
239
- business_requirement: "Vote weight equals reputation score (dynamic weight from Passport)",
240
- data_source: "SubmittedObject",
241
- host: "arbitration_voting",
242
- verifier_level: "none",
243
- logic_summary: "GuardIdentifier extracts numeric value from Passport submission",
244
- key_queries: [],
245
- mitigated_risks: ["R-C3-02"],
246
- notes: [
247
- "Table needs numeric submission entry at referenced index",
248
- "Weight must come from on-chain EntityRegistrar, not submission",
249
- "BINDING_01: voting_guard GuardIdentifier must be numeric (U8-U256)",
250
- ],
251
- },
252
- {
253
- id: "pattern.arbitration_membership_check",
254
- business_requirement: "Only premium members can file disputes",
255
- data_source: "OnChainConstant",
256
- host: "arbitration_usage",
257
- verifier_level: "none",
258
- logic_summary: "logic_and[query(entity exists), logic_as_u256_ge[query(entity tier), identifier[N](premium_tier)]]",
259
- key_queries: ["entity.registrar", "entity.linker"],
260
- mitigated_risks: [],
261
- notes: ["ENTITY_REGISTRAR_ADDRESS (0xaab) / ENTITY_LINKER_ADDRESS (0xaaa) must be in table"],
262
- },
263
- {
264
- id: "pattern.scene_allocator_entity_recipient",
265
- business_requirement: "Service allocator with sharing.who=Entity — no Signer binding needed",
266
- data_source: "OnChainConstant",
267
- host: "service_allocator_guard",
268
- verifier_level: "level3_scene_combined",
269
- logic_summary: "Scene verifies fund flow safety — Guard only validates allocation rules",
270
- key_queries: ["service.permission", "order.amount"],
271
- mitigated_risks: ["R-C3-06"],
272
- notes: [
273
- "Funds flow to fixed Treasury/address regardless of caller",
274
- "sharing.who=Entity already guarantees recipient safety",
275
- "No Signer binding required — R-C3-06 safe",
276
- ],
277
- },
278
- {
279
- id: "pattern.scene_machine_forward_operator",
280
- business_requirement: "Machine forward with permissionIndex/namedOperator already verifies operator",
281
- data_source: "OnChainConstant",
282
- host: "machine_forward",
283
- verifier_level: "level3_scene_combined",
284
- logic_summary: "Forward's permissionIndex/namedOperator verifies operator — Guard only validates submitted data",
285
- key_queries: [],
286
- mitigated_risks: [],
287
- notes: [
288
- "Scene verifies operator permission via permissionIndex/namedOperator",
289
- "Signer binding only needed if submitted data must belong to operator",
290
- "Evaluate scene before adding Signer binding",
291
- ],
292
- },
293
- ];
294
- export const VERIFIER_LEVEL_GUIDANCE = [
295
- {
296
- level: "level1_strict_single",
297
- pattern: "logic_equal[context(Signer), identifier[N](fixed_address)]",
298
- when_to_use: "Role permanently tied to one address AND designer accepts lock-in risk",
299
- risk_rules: ["R-C4-04"],
300
- recommendation: "avoid",
301
- },
302
- {
303
- level: "level2_identity_set",
304
- pattern: "logic_or of multiple identity checks",
305
- when_to_use: "Role-based access — multiple authorized identities",
306
- risk_rules: ["R-C4-04 (suppressed)"],
307
- recommendation: "recommended",
308
- },
309
- {
310
- level: "level3_scene_combined",
311
- pattern: "Scene itself verifies identity — no Signer binding needed",
312
- when_to_use: "Scene's host object already verifies operator (e.g., Machine forward, sharing.who=Entity)",
313
- risk_rules: [],
314
- recommendation: "default",
315
- },
316
- {
317
- level: "none",
318
- pattern: "No Signer binding required",
319
- when_to_use: "Resource flow matters more than caller identity",
320
- risk_rules: [],
321
- recommendation: "default",
322
- },
323
- ];
324
- export function getGuardDesignPattern(id) {
325
- return GUARD_DESIGN_PATTERNS.find((p) => p.id === id);
326
- }
327
- export function searchGuardDesignPatterns(query) {
328
- const q = query.toLowerCase();
329
- return GUARD_DESIGN_PATTERNS.filter((p) => {
330
- if (p.business_requirement.toLowerCase().includes(q))
331
- return true;
332
- if (p.logic_summary.toLowerCase().includes(q))
333
- return true;
334
- if (p.key_queries.some((k) => k.toLowerCase().includes(q)))
335
- return true;
336
- return false;
337
- });
338
- }
339
- export function getPatternsByHost(host) {
340
- return GUARD_DESIGN_PATTERNS.filter((p) => p.host === host);
341
- }
342
- export function getPatternsByIndustry(industry) {
343
- return GUARD_DESIGN_PATTERNS.filter((p) => p.applicable_industries?.includes(industry));
344
- }
345
- export function getPatternsByDataSourceClass(source) {
346
- return GUARD_DESIGN_PATTERNS.filter((p) => p.data_source === source);
347
- }
348
- export function getVerifierLevelGuidance(level) {
349
- return VERIFIER_LEVEL_GUIDANCE.find((g) => g.level === level);
350
- }
351
- export function suggestPatternForRequirement(requirement) {
352
- const matches = searchGuardDesignPatterns(requirement);
353
- if (matches.length === 0) {
354
- const fallback = GUARD_DESIGN_PATTERNS[0];
355
- return { best: fallback, alternatives: [] };
356
- }
357
- const [best, ...alternatives] = matches;
358
- return { best, alternatives };
359
- }
360
- export const GUARD_DESIGN_PATTERNS_VERSION = 1;
1
+ export const GUARD_DESIGN_PATTERNS=[{'id':'pattern.identity_check_single','business_requirement':'Only\x20the\x20author\x20can\x20purchase\x20this\x20service\x20(strict\x20single-identity)','data_source':'SystemContext','host':'service_buy_guard','verifier_level':'level1_strict_single','logic_summary':'logic_equal[context(Signer),\x20identifier[N](fixed_address)]','key_queries':[],'mitigated_risks':['R-C4-04'],'notes':['Maximally\x20secure\x20but\x20maximally\x20inconvenient','If\x20address\x20is\x20unavailable\x20(key\x20loss,\x20rotation),\x20Guard\x20permanently\x20blocks','Avoid\x20unless\x20role\x20is\x20permanently\x20tied\x20to\x20one\x20address']},{'id':'pattern.identity_check_allowlist','business_requirement':'Customer\x20must\x20be\x20in\x20an\x20allowlist\x20to\x20purchase','data_source':'SystemContext','host':'service_buy_guard','verifier_level':'level2_identity_set','logic_summary':'vec_contains_address[identifier[N](allowlist_vec),\x20context(Signer)]','key_queries':[],'mitigated_risks':['R-C4-04'],'notes':['Allowlist\x20stored\x20as\x20Address\x20vector\x20in\x20table\x20constant']},{'id':'pattern.identity_check_order_holder','business_requirement':'Only\x20order\x20owner\x20or\x20agent\x20can\x20perform\x20operation','data_source':'OnChainConstant','host':'machine_forward','verifier_level':'level2_identity_set','logic_summary':'logic_or[logic_equal[query(1562\x20order.owner),\x20context(Signer)],\x20query(1567\x20order.agent\x20has,\x20Signer)]','key_queries':['order.owner','order.agent\x20has'],'mitigated_risks':['R-C4-04','R-C3-06'],'notes':['1562\x20returns\x20Address\x20→\x20wrap\x20in\x20logic_equal','1567\x20returns\x20Bool\x20→\x20use\x20directly\x20as\x20logic_or\x20child','Recommended\x20Level\x202\x20alternative\x20to\x20Level\x201\x20strict\x20binding']},{'id':'pattern.identity_check_service_provider_dynamic','business_requirement':'Verify\x20caller\x20is\x20service\x27s\x20current\x20permission\x20owner\x20(survives\x20permission\x20rotation)','data_source':'SubmittedObject','host':'machine_forward','verifier_level':'level2_identity_set','logic_summary':'logic_and[logic_equal[query(1488\x20service.permission),\x20identifier[N](submitted_perm)],\x20logic_or[logic_equal[query(1002\x20permission.owner),\x20context(Signer)],\x20query(1004\x20permission.admin\x20has,\x20Signer)]]','key_queries':['service.permission','permission.owner','permission.admin\x20has'],'mitigated_risks':['R-C4-04','R-C3-05'],'notes':['Dynamic\x20permission\x20address\x20(RECOMMENDED)\x20—\x20survives\x20Service\x20permission\x20rotation','Caller\x20submits\x20permission\x20address;\x20Guard\x20verifies\x20match\x20then\x20checks\x20identity','More\x20complex\x20than\x20static\x20but\x20far\x20more\x20robust']},{'id':'pattern.time_lock_progress','business_requirement':'Customer\x20must\x20wait\x20N\x20hours\x20before\x20completing\x20(time-lock)','data_source':'WitnessDerived','host':'machine_forward','verifier_level':'none','logic_summary':'logic_as_u256_ge[context(Clock),\x20calc_number_add[query(1272\x20progress.current_time,\x20witness=OrderProgress),\x20identifier[N](duration_ms)]]','key_queries':['progress.current_time'],'witness_types':['OrderProgress'],'mitigated_risks':[],'notes':['Use\x20convert_witness=100\x20(OrderProgress)\x20to\x20derive\x20Progress\x20from\x20submitted\x20Order\x20ID','Duration\x20in\x20milliseconds\x20—\x20test\x20with\x20small\x20values\x20first']},{'id':'pattern.time_lock_absolute','business_requirement':'Operation\x20allowed\x20only\x20after\x20a\x20fixed\x20timestamp','data_source':'SystemContext','host':'service_buy_guard','verifier_level':'none','logic_summary':'logic_as_u256_ge[context(Clock),\x20identifier[N](release_timestamp)]','key_queries':[],'mitigated_risks':[],'notes':['Useful\x20for\x20pre-sale\x20windows,\x20embargo\x20periods']},{'id':'pattern.repository_data_check','business_requirement':'External\x20data\x20must\x20match\x20expected\x20value\x20(e.g.,\x20weather,\x20price\x20feed)','data_source':'OnChainConstant','host':'machine_forward','verifier_level':'none','logic_summary':'logic_equal[query(1167\x20repository.data,\x20policy,\x20key),\x20identifier[N](expected_value)]','key_queries':['repository.data'],'mitigated_risks':[],'notes':['Repository\x20address\x20declared\x20as\x20table\x20constant','Timestamp\x20keys\x20may\x20need\x20convert_number_address','quote_guard\x20context:\x20fails\x20in\x20gen_passport\x20(impack_list\x20empty),\x20works\x20in\x20on-chain\x20business\x20operations\x20(see\x20R-X1-10)']},{'id':'pattern.repository_quote_guard_subscription','business_requirement':'Repository\x20data\x20access\x20requires\x20payment\x20proof\x20(subscription\x20revenue\x20model)','data_source':'SubmittedObject','host':'repository_write','verifier_level':'level3_scene_combined','logic_summary':'Repository\x20policy\x20sets\x20quote_guard\x20(is_depended:\x20immutable\x20+\x20rep=true).\x20'+'When\x20a\x20Guard\x20queries\x20this\x20Repository\x27s\x20data\x20(query\x201167),\x20check_repository_quote_guard\x20verifies\x20'+'the\x20quote_guard\x20is\x20in\x20impack_list.\x20The\x20quote_guard\x20itself\x20verifies\x20a\x20submitted\x20Payment\x20'+'(payment.info.for\x20matches\x20Repository,\x20payment.amount\x20meets\x20subscription\x20price).\x20'+'User\x20submits\x20Payment\x20via\x20Passport\x20→\x20quote_guard\x20verified\x20→\x20added\x20to\x20impack_list\x20→\x20query\x201167\x20passes.','key_queries':['repository.data','payment.info.for','payment.amount'],'mitigated_risks':['R-X1-10'],'applicable_industries':['subscription','travel','rental','education'],'notes':['VERIFIED:\x20passport.rs#L545-612\x20(check_repository_quote_guard),\x20passport.rs#L758-769\x20(trigger\x20at\x20query_id==1167)','Repository.owner_receive<T>\x20accepts\x20Payment\x20as\x20subscription\x20revenue\x20(repository.move#L714-717)','quote_guard\x20must\x20be\x20is_depended:\x20immutable=true,\x20relies\x20empty,\x20rep=true\x20(guard.move#L133-135)','VERIFIER-EVIDENCE\x20DESIGN:\x20user\x20submits\x20valid\x20Payment,\x20quote_guard\x20verifies\x20Payment\x20fields\x20—\x20no\x20affiliation\x20needed','gen_passport\x20context:\x20quote_guard\x20fails\x20(impack_list\x20empty)\x20—\x20only\x20use\x20for\x20on-chain\x20business\x20operations','Business\x20model:\x20data\x20provider\x20publishes\x20weather/market/oracle\x20data\x20to\x20Repository,\x20'+'users\x20pay\x20subscription\x20to\x20access\x20data\x20in\x20their\x20Machine\x20flows','MODE\x20A\x20(direct\x20payment\x20verify)\x20—\x20four\x20verifiable\x20elements\x20on\x20the\x20submitted\x20Payment:\x20'+'1)\x20amount:\x20logic_as_u256_ge[payment.amount,\x20N]\x20(>=\x20subscription\x20price);\x20'+'2)\x20subscription\x20type:\x20payment.info.remark\x20/\x20payment.info.index\x20encodes\x20the\x20tier/plan;\x20'+'3)\x20fixed\x20recipient:\x20payment.record.recipient\x20must\x20equal\x20the\x20designated\x20payee\x20(Treasury/owner\x20address);\x20'+'4)\x20occurrence\x20time:\x20payment.time\x20within\x20the\x20validity\x20window\x20(logic_as_u256_ge/le\x20vs\x20context(Clock))','Payment\x20is\x20freeze_object\x20after\x20creation\x20—\x20all\x20four\x20elements\x20are\x20tamper-proof\x20evidence','For\x20a\x20LOWER\x20user-cost\x20variant\x20(no\x20per-user\x20payment\x20submission),\x20see\x20pattern.repository_whitelist_sync\x20(Mode\x20B)']},{'id':'pattern.repository_whitelist_sync','business_requirement':'Entitlement\x20check\x20via\x20a\x20synced\x20allowlist\x20Repository\x20instead\x20of\x20per-user\x20payment\x20submission\x20(low-friction\x20entitlements:\x20memberships,\x20authorizations,\x20paid-user\x20lists)','data_source':'OnChainConstant','host':'machine_forward','verifier_level':'none','logic_summary':'Off-chain\x20collector\x20gathers\x20eligible\x20users\x20(transfers\x20/\x20Payments\x20to\x20the\x20designated\x20receiving\x20address\x20or\x20object,\x20'+'Service\x20orders,\x20or\x20any\x20off-chain\x20record)\x20and\x20syncs\x20the\x20list\x20into\x20a\x20dedicated\x20Repository\x20object\x20'+'(entries\x20may\x20carry\x20a\x20validity\x20window,\x20e.g.\x20authorized\x20time\x20period).\x20'+'The\x20consuming\x20Guard\x20checks\x20membership\x20via\x20query\x201166/1167\x20(repository.data)\x20keyed\x20by\x20the\x20caller:\x20'+'vec_contains_address-style\x20logic_or\x20over\x20[repository.data(key=Signer)]\x20or\x20logic_equal[repository.data(...),\x20identifier[N](expected)].\x20'+'Repository\x20writes\x20go\x20through\x20id_data\x20/\x20id_data_add\x20/\x20id_data_remove\x20(batch\x20up\x20to\x20100\x20entries\x20per\x20tx).','key_queries':['repository.data'],'mitigated_risks':['R-X1-10'],'applicable_industries':['subscription','travel','rental','education'],'notes':['MODE\x20B\x20(whitelist\x20sync)\x20—\x20user-cost\x20optimization\x20of\x20Mode\x20A\x20(pattern.repository_quote_guard_subscription):\x20'+'users\x20do\x20NOT\x20submit\x20a\x20Payment\x20at\x20verification\x20time;\x20the\x20operator\x20proves\x20eligibility\x20off-chain\x20and\x20syncs\x20the\x20roster','TRADE-OFF:\x20eventual\x20consistency\x20—\x20the\x20roster\x20updates\x20at\x20the\x20collector\x27s\x20sync\x20frequency\x20(slight\x20delay),\x20'+'vs\x20Mode\x20A\x27s\x20instant\x20per-payment\x20proof.\x20Choose\x20by\x20business:\x20high-frequency\x20low-value\x20→\x20Mode\x20B;\x20'+'high-value\x20instant\x20entitlement\x20→\x20Mode\x20A','Entry\x20shape:\x20key\x20=\x20user\x20address\x20(or\x20derived\x20id),\x20value\x20=\x20expiry\x20timestamp\x20/\x20tier\x20/\x20scope;\x20'+'time-window\x20enforcement\x20compares\x20entry\x20value\x20against\x20context(Clock)\x20in\x20the\x20Guard','VERIFIED:\x20repository.move\x20id_data*\x20(batch\x20≤100),\x20guard-ins.ts\x201166/1167\x20(repository.data\x20queries),\x20'+'guard.move\x20is_depended\x20(1167\x20marks\x20query-only\x20repositories)','The\x20collector\x20can\x20source\x20eligibility\x20from:\x20transfers\x20or\x20Payments\x20to\x20a\x20fixed\x20receiving\x20address/object,\x20'+'Service\x20orders\x20(order.service\x20==\x20designated\x20service),\x20or\x20external\x20off-chain\x20records','Repository\x20access\x20economics\x20stay\x20OUT\x20of\x20this\x20pattern\x20(K3\x2010\x20§5\x20D5\x20ruling:\x20reuse\x20Reward/Allocation\x20'+'outside\x20the\x20Repository\x20for\x20payment;\x20the\x20Repository\x20here\x20is\x20the\x20roster,\x20not\x20the\x20payment\x20rail)']},{'id':'pattern.supply_chain_suborder_verification','business_requirement':'Sub-service\x20purchase\x20requires\x20ownership\x20of\x20main\x20service\x20order\x20(supply\x20chain\x20milestone\x20unlock)','data_source':'SubmittedObject','host':'service_buy_guard','verifier_level':'level2_identity_set','logic_summary':'Sub-service\x20buy_guard\x20verifies\x20submitted\x20main\x20Order:\x20'+'logic_and[logic_equal[query(order.owner),\x20context(Signer)],\x20logic_equal[query(order.service),\x20identifier[N](main_service_address)]].\x20'+'User\x20submits\x20main\x20Order\x20via\x20Passport\x20(b_submission=true),\x20buy_guard\x20verifies\x20ownership\x20+\x20service\x20match.','key_queries':['order.owner','order.service'],'mitigated_risks':['R-C3-05'],'applicable_industries':['travel','rental','education','freelance'],'notes':['VERIFIER-EVIDENCE\x20DESIGN:\x20user\x20submits\x20main\x20Order\x20as\x20evidence,\x20buy_guard\x20verifies\x20order.owner==Signer\x20AND\x20order.service==main_service','Each\x20milestone\x20=\x20one\x20sub-order\x20with\x20its\x20own\x20Service\x20+\x20buy_guard\x20referencing\x20the\x20main\x20order','Main\x20flow\x20can\x20branch\x20to\x20different\x20sub-services\x20based\x20on\x20Machine\x20node\x20progression','No\x20parent_order\x20field\x20needed\x20—\x20relationship\x20verified\x20via\x20buy_guard\x20querying\x20submitted\x20Order\x20fields','Enables\x20supply\x20chain\x20composition:\x20main\x20service\x20→\x20multiple\x20sub-services\x20with\x20conditional\x20access']},{'id':'pattern.payment_exception_compensation','business_requirement':'Exception\x20branch\x20triggers\x20compensation\x20Payment\x20(e.g.,\x20delivery\x20delay\x20>\x2030min\x20auto-compensates\x20customer)','data_source':'SubmittedObject','host':'machine_forward','verifier_level':'level3_scene_combined','logic_summary':'Exception\x20forward\x20guard\x20verifies\x204-dimensional\x20anti-reuse\x20binding:\x20logic_and['+'logic_equal[query(payment.info.for),\x20identifier[N](order_address)],\x20'+'logic_equal[query(payment.info.guard),\x20identifier[N](this_guard_address)],\x20'+'logic_as_u256_ge[query(payment.amount),\x20identifier[N](compensation_amount)],\x20'+'logic_as_u256_equal[query(payment.info.index),\x20query(progress.history\x20count)],\x20'+'logic_string_nocase_equal[query(payment.info.remark),\x20query(progress.current)]].\x20'+'Treasury\x20withdraws\x20to\x20customer\x20with\x20PaymentInfo(for_object=order,\x20for_guard=this,\x20index=history_count_at_creation,\x20remark=node_name).\x20'+'Customer\x20submits\x20Payment\x20via\x20Passport;\x20guard\x20verifies\x20index\x20matches\x20current\x20unique\x20step\x20(progress.history\x20count,\x20U64,\x20monotonically\x20increasing\x20—\x20unique\x20even\x20in\x20cycles)\x20AND\x20remark\x20matches\x20current\x20node\x20name\x20(progress.current,\x20String\x20—\x20may\x20repeat\x20across\x20cycles\x20but\x20bound\x20to\x20this\x20step\x20by\x20index).','key_queries':['payment.info.for','payment.info.guard','payment.info.index','payment.info.remark','payment.amount','progress.history\x20count','progress.current'],'mitigated_risks':[],'applicable_industries':['rental','travel','general','freelance'],'notes':['VERIFIED:\x20payment.move#L66-71\x20(PaymentInfo:\x20for_object,\x20for_guard,\x20remark,\x20index),\x20payment.move#L82-86\x20(payment_info_with_guard)','VERIFIED:\x20treasury.move#L249-264\x20(withdraw\x20creates\x20Payment\x20via\x20payment::new_singleton\x20+\x20from_object_set)','Payment\x20is\x20freeze_object\x20(immutable,\x20payment.move#L160)\x20—\x20cannot\x20be\x20modified\x20after\x20creation','VERIFIED\x20INDEX\x20QUERY:\x20progress.history\x20count\x20(id\x201273,\x20U64)\x20—\x20guard-ins.ts#L1228-1237.\x20From\x20progress.move\x20L440-441\x20(session_accomplish\x20pushes\x20a\x20new\x20History\x20entry)\x20+\x20L475/L482\x20(parent_table_vec::length\x20returns\x20current\x20session\x20id).\x20This\x20count\x20is\x20the\x20unique\x20monotonically\x20increasing\x20step\x20index\x20—\x20even\x20in\x20cycles,\x20each\x20entry\x20has\x20a\x20different\x20count.','VERIFIED\x20NODE\x20NAME\x20QUERY:\x20progress.current\x20(id\x201253,\x20String)\x20—\x20guard-ins.ts#L1025-1032.\x20Returns\x20the\x20current\x20node\x20name.\x20A\x20node\x20CAN\x20be\x20entered\x20multiple\x20times\x20in\x20cycles,\x20so\x20node\x20name\x20alone\x20is\x20NOT\x20unique\x20—\x20it\x20MUST\x20be\x20paired\x20with\x20progress.history\x20count\x20for\x20uniqueness.','DESIGN\x20INTENT\x20(USER):\x20to\x20validate\x20index\x20(U64\x20type),\x20use\x20progress.history\x20count\x20(unique,\x20non-repeating);\x20to\x20validate\x20node\x20name\x20(may\x20repeat\x20in\x20cycles),\x20store\x20it\x20in\x20PaymentInfo.remark\x20and\x20do\x20string\x20comparison\x20with\x20progress.current.','ANTI-REUSE\x204-DIMENSIONAL\x20BINDING:\x20for_object\x20(Order)\x20+\x20for_guard\x20(Guard)\x20+\x20index\x20(unique\x20step\x20via\x20progress.history\x20count)\x20+\x20remark\x20(node\x20name\x20via\x20progress.current).\x20Same\x20Payment\x20cannot\x20be\x20reused\x20in\x20other\x20contexts\x20—\x20at\x20least\x20one\x20field\x20will\x20mismatch.','VERIFIER-EVIDENCE\x20DESIGN:\x20customer\x20submits\x20Payment,\x20guard\x20verifies\x20binding\x20fields\x20match\x20current\x20context','Enables\x20user-friendly\x20exception\x20handling:\x20delay\x20→\x20auto-compensation\x20→\x20friendly\x20branch\x20flow','No\x20affiliation\x20registration\x20needed\x20—\x20guard\x20only\x20verifies\x20submitted\x20Payment\x27s\x20field\x20accuracy']},{'id':'pattern.verifier_evidence_philosophy','business_requirement':'Guard\x20design\x20philosophy:\x20verifier\x20provides\x20evidence,\x20guard\x20verifies\x20logic\x20+\x20data\x20accuracy\x20(NOT\x20data\x20discovery)','data_source':'SubmittedObject','host':'gen_passport','verifier_level':'none','logic_summary':'Guard\x20is\x20a\x20PURE\x20VERIFICATION\x20engine.\x20Participants\x20submit\x20evidence\x20(Payment,\x20Order,\x20Proof,\x20etc.)\x20'+'via\x20Passport\x20submissions\x20(b_submission=true).\x20Guard\x20verifies:\x20(1)\x20logic\x20completeness,\x20(2)\x20data\x20usage\x20accuracy.\x20'+'Guard\x20does\x20NOT\x20discover/fetch\x20objects\x20via\x20affiliation.\x20Affiliation\x20is\x20for\x20object\x20lifecycle\x20bookkeeping,\x20'+'NOT\x20for\x20guard\x20data\x20discovery.','key_queries':[],'mitigated_risks':['R-C3-05','R-C3-06'],'notes':['CORE\x20PRINCIPLE:\x20Guard\x20only\x20validates\x20submitted\x20evidence\x20—\x20it\x20never\x20fetches\x20data\x20on\x20its\x20own','For\x20Payment\x20verification:\x20user\x20submits\x20valid\x20Payment\x20→\x20guard\x20checks\x20for_object/for_guard/index\x20match','For\x20multi-order\x20verification:\x20verifier\x20submits\x20Order\x20data\x20→\x20guard\x20checks\x20service/owner\x20relationships','For\x20Repository\x20access:\x20user\x20submits\x20Payment\x20→\x20quote_guard\x20verifies\x20→\x20impack_list\x20updated\x20→\x20data\x20query\x20passes','Type\x203\x20(SubmittedObject)\x20data\x20source\x20class\x20embodies\x20this\x20philosophy\x20—\x20b_submission=true\x20entries','This\x20pattern\x20is\x20foundational\x20for\x20all\x20guard\x20designs\x20—\x20always\x20prefer\x20verifier-evidence\x20over\x20complex\x20object\x20discovery']},{'id':'pattern.progress_state_check','business_requirement':'Specific\x20forward\x20has\x20been\x20accomplished\x20(customer\x20confirms\x20delivery)','data_source':'WitnessDerived','host':'reward_claim','verifier_level':'none','logic_summary':'logic_equal[query_progress_history_find(...).accomplished,\x20identifier[N](true)]','key_queries':['progress.current','progress.current_time'],'witness_types':['OrderProgress'],'mitigated_risks':[],'notes':['Chain\x20query_progress_history_find\x20→\x20query_progress_history_session_forward_find']},{'id':'pattern.reward_one_time_claim','business_requirement':'User\x20can\x20only\x20claim\x20reward\x20once\x20(no\x20prior\x20claims)','data_source':'OnChainConstant','host':'reward_claim','verifier_level':'none','logic_summary':'logic_equal[query_reward_record_count(recipient=Signer),\x20identifier[N](0)]','key_queries':['reward.record_count'],'mitigated_risks':[],'notes':['Record\x20count\x20check\x20prevents\x20double-claim']},{'id':'pattern.reward_multi_condition','business_requirement':'Order\x20payment\x20>\x20threshold\x20AND\x20reached\x20\x27complete\x27\x20to\x20claim\x20reward','data_source':'WitnessDerived','host':'reward_claim','verifier_level':'none','logic_summary':'logic_and[logic_as_u256_gt[query(order.amount),\x20threshold],\x20logic_equal[query(progress.current),\x20\x27complete\x27],\x20logic_equal[query(order.service),\x20identifier[N](expected_service)]]','key_queries':['order.amount','progress.current','order.service'],'witness_types':['OrderProgress'],'mitigated_risks':['R-C3-05'],'notes':['Multi-condition:\x20amount\x20+\x20progress\x20state\x20+\x20service\x20match']},{'id':'pattern.arbitration_voting_weight','business_requirement':'Vote\x20weight\x20equals\x20reputation\x20score\x20(dynamic\x20weight\x20from\x20Passport)','data_source':'SubmittedObject','host':'arbitration_voting','verifier_level':'none','logic_summary':'GuardIdentifier\x20extracts\x20numeric\x20value\x20from\x20Passport\x20submission','key_queries':[],'mitigated_risks':['R-C3-02'],'notes':['Table\x20needs\x20numeric\x20submission\x20entry\x20at\x20referenced\x20index','Weight\x20must\x20come\x20from\x20on-chain\x20EntityRegistrar,\x20not\x20submission','BINDING_01:\x20voting_guard\x20GuardIdentifier\x20must\x20be\x20numeric\x20(U8-U256)']},{'id':'pattern.arbitration_membership_check','business_requirement':'Only\x20premium\x20members\x20can\x20file\x20disputes','data_source':'OnChainConstant','host':'arbitration_usage','verifier_level':'none','logic_summary':'logic_and[query(entity\x20exists),\x20logic_as_u256_ge[query(entity\x20tier),\x20identifier[N](premium_tier)]]','key_queries':['entity.registrar','entity.linker'],'mitigated_risks':[],'notes':['ENTITY_REGISTRAR_ADDRESS\x20(0xaab)\x20/\x20ENTITY_LINKER_ADDRESS\x20(0xaaa)\x20must\x20be\x20in\x20table']},{'id':'pattern.scene_allocator_entity_recipient','business_requirement':'Service\x20allocator\x20with\x20sharing.who=Entity\x20—\x20no\x20Signer\x20binding\x20needed','data_source':'OnChainConstant','host':'service_allocator_guard','verifier_level':'level3_scene_combined','logic_summary':'Scene\x20verifies\x20fund\x20flow\x20safety\x20—\x20Guard\x20only\x20validates\x20allocation\x20rules','key_queries':['service.permission','order.amount'],'mitigated_risks':['R-C3-06'],'notes':['Funds\x20flow\x20to\x20fixed\x20Treasury/address\x20regardless\x20of\x20caller','sharing.who=Entity\x20already\x20guarantees\x20recipient\x20safety','No\x20Signer\x20binding\x20required\x20—\x20R-C3-06\x20safe']},{'id':'pattern.scene_machine_forward_operator','business_requirement':'Machine\x20forward\x20with\x20permissionIndex/namedOperator\x20already\x20verifies\x20operator','data_source':'OnChainConstant','host':'machine_forward','verifier_level':'level3_scene_combined','logic_summary':'Forward\x27s\x20permissionIndex/namedOperator\x20verifies\x20operator\x20—\x20Guard\x20only\x20validates\x20submitted\x20data','key_queries':[],'mitigated_risks':[],'notes':['Scene\x20verifies\x20operator\x20permission\x20via\x20permissionIndex/namedOperator','Signer\x20binding\x20only\x20needed\x20if\x20submitted\x20data\x20must\x20belong\x20to\x20operator','Evaluate\x20scene\x20before\x20adding\x20Signer\x20binding']}];export const VERIFIER_LEVEL_GUIDANCE=[{'level':'level1_strict_single','pattern':'logic_equal[context(Signer),\x20identifier[N](fixed_address)]','when_to_use':'Role\x20permanently\x20tied\x20to\x20one\x20address\x20AND\x20designer\x20accepts\x20lock-in\x20risk','risk_rules':['R-C4-04'],'recommendation':'avoid'},{'level':'level2_identity_set','pattern':'logic_or\x20of\x20multiple\x20identity\x20checks','when_to_use':'Role-based\x20access\x20—\x20multiple\x20authorized\x20identities','risk_rules':['R-C4-04\x20(suppressed)'],'recommendation':'recommended'},{'level':'level3_scene_combined','pattern':'Scene\x20itself\x20verifies\x20identity\x20—\x20no\x20Signer\x20binding\x20needed','when_to_use':'Scene\x27s\x20host\x20object\x20already\x20verifies\x20operator\x20(e.g.,\x20Machine\x20forward,\x20sharing.who=Entity)','risk_rules':[],'recommendation':'default'},{'level':'none','pattern':'No\x20Signer\x20binding\x20required','when_to_use':'Resource\x20flow\x20matters\x20more\x20than\x20caller\x20identity','risk_rules':[],'recommendation':'default'}];export function getGuardDesignPattern(a){return GUARD_DESIGN_PATTERNS['find'](b=>b['id']===a);}export function searchGuardDesignPatterns(a){const b=a['toLowerCase']();return GUARD_DESIGN_PATTERNS['filter'](c=>{if(c['business_requirement']['toLowerCase']()['includes'](b))return!![];if(c['logic_summary']['toLowerCase']()['includes'](b))return!![];if(c['key_queries']['some'](d=>d['toLowerCase']()['includes'](b)))return!![];return![];});}export function getPatternsByHost(a){return GUARD_DESIGN_PATTERNS['filter'](b=>b['host']===a);}export function getPatternsByIndustry(a){return GUARD_DESIGN_PATTERNS['filter'](b=>b['applicable_industries']?.['includes'](a));}export function getPatternsByDataSourceClass(a){return GUARD_DESIGN_PATTERNS['filter'](b=>b['data_source']===a);}export function getVerifierLevelGuidance(a){return VERIFIER_LEVEL_GUIDANCE['find'](b=>b['level']===a);}export function suggestPatternForRequirement(a){const b=searchGuardDesignPatterns(a);if(b['length']===0x0){const e=GUARD_DESIGN_PATTERNS[0x0];return{'best':e,'alternatives':[]};}const [c,...d]=b;return{'best':c,'alternatives':d};}export const GUARD_DESIGN_PATTERNS_VERSION=0x1;