@wowok/agent-mcp 2.7.2 → 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 (347) hide show
  1. package/dist/config/runtime.js +1 -1
  2. package/dist/customer/account-events.d.ts +32 -0
  3. package/dist/customer/account-events.js +1 -0
  4. package/dist/customer/customer-advice.d.ts +1 -0
  5. package/dist/customer/customer-advice.js +1 -1
  6. package/dist/customer/info-puzzle.js +1 -1
  7. package/dist/customer/order-strategy.d.ts +1 -1
  8. package/dist/customer/reminder-system.d.ts +2 -0
  9. package/dist/customer/reminder-system.js +1 -1
  10. package/dist/customer/risk-assessment.d.ts +1 -0
  11. package/dist/customer/risk-assessment.js +1 -1
  12. package/dist/customer/types.d.ts +2 -0
  13. package/dist/evaluation/builtins/arbitration-score.d.ts +41 -0
  14. package/dist/evaluation/builtins/arbitration-score.js +1 -0
  15. package/dist/evaluation/builtins/index.d.ts +1 -0
  16. package/dist/evaluation/builtins/index.js +1 -1
  17. package/dist/evaluation/category-match-rules.d.ts +30 -0
  18. package/dist/evaluation/category-match-rules.js +1 -0
  19. package/dist/evaluation/engine.js +1 -1
  20. package/dist/evaluation/extract.js +1 -1
  21. package/dist/evaluation/index.d.ts +1 -0
  22. package/dist/evaluation/index.js +1 -1
  23. package/dist/evaluation/location-match.d.ts +42 -0
  24. package/dist/evaluation/location-match.js +1 -0
  25. package/dist/evaluation/path-reasoning.d.ts +35 -0
  26. package/dist/evaluation/path-reasoning.js +1 -0
  27. package/dist/evaluation/region.d.ts +6 -0
  28. package/dist/evaluation/region.js +1 -1
  29. package/dist/evaluation/types.d.ts +17 -0
  30. package/dist/experience/realtime-feedback.js +1 -1
  31. package/dist/experience/user-profile.d.ts +1 -1
  32. package/dist/extensions/index.d.ts +6 -0
  33. package/dist/extensions/index.js +1 -1
  34. package/dist/extensions/industry-layers.d.ts +75 -0
  35. package/dist/extensions/industry-layers.js +1 -0
  36. package/dist/extensions/industry-pack.d.ts +105 -0
  37. package/dist/extensions/industry-pack.js +1 -0
  38. package/dist/extensions/metric-registry.js +1 -1
  39. package/dist/extensions/mode-evaluator.d.ts +1 -1
  40. package/dist/extensions/registry.d.ts +1 -0
  41. package/dist/extensions/registry.js +1 -1
  42. package/dist/graph/base.d.ts +8 -0
  43. package/dist/graph/base.js +1 -0
  44. package/dist/harness/index.d.ts +1 -0
  45. package/dist/harness/index.js +1 -1
  46. package/dist/harness/plan.d.ts +2 -0
  47. package/dist/harness/plan.js +1 -1
  48. package/dist/harness/recover.d.ts +1 -1
  49. package/dist/harness/types.d.ts +2 -3
  50. package/dist/index.js +1 -1
  51. package/dist/knowledge/allocation-confirm.js +1 -1
  52. package/dist/knowledge/anti-cheat.d.ts +37 -0
  53. package/dist/knowledge/anti-cheat.js +1 -0
  54. package/dist/knowledge/arb-confirm.d.ts +28 -0
  55. package/dist/knowledge/arb-confirm.js +1 -0
  56. package/dist/knowledge/arb-translation.d.ts +48 -0
  57. package/dist/knowledge/arb-translation.js +1 -0
  58. package/dist/knowledge/arbitration-context.js +1 -1
  59. package/dist/knowledge/bridge-confirm.d.ts +26 -0
  60. package/dist/knowledge/bridge-confirm.js +1 -0
  61. package/dist/knowledge/bridge-translation.d.ts +37 -0
  62. package/dist/knowledge/bridge-translation.js +1 -0
  63. package/dist/knowledge/contact-confirm.d.ts +27 -0
  64. package/dist/knowledge/contact-confirm.js +1 -0
  65. package/dist/knowledge/contact-translation.d.ts +39 -0
  66. package/dist/knowledge/contact-translation.js +1 -0
  67. package/dist/knowledge/demand-context.d.ts +17 -0
  68. package/dist/knowledge/demand-context.js +1 -0
  69. package/dist/knowledge/demand-ledger.d.ts +26 -0
  70. package/dist/knowledge/demand-ledger.js +1 -0
  71. package/dist/knowledge/demand-puzzle.d.ts +29 -0
  72. package/dist/knowledge/demand-puzzle.js +1 -0
  73. package/dist/knowledge/demand-templates.d.ts +12 -0
  74. package/dist/knowledge/demand-templates.js +1 -0
  75. package/dist/knowledge/demand-translation.js +1 -1
  76. package/dist/knowledge/deployment-scanner.js +1 -1
  77. package/dist/knowledge/evidence-review.d.ts +12 -0
  78. package/dist/knowledge/evidence-review.js +1 -0
  79. package/dist/knowledge/examples-scanner-cli.js +1 -1
  80. package/dist/knowledge/examples-scanner.js +1 -1
  81. package/dist/knowledge/flywheel-loop.d.ts +0 -1
  82. package/dist/knowledge/flywheel-loop.js +1 -1
  83. package/dist/knowledge/guard-design-patterns.js +1 -1
  84. package/dist/knowledge/guard-migration.d.ts +1 -1
  85. package/dist/knowledge/index.d.ts +71 -3
  86. package/dist/knowledge/index.js +1 -1
  87. package/dist/knowledge/industry-registry.js +1 -1
  88. package/dist/knowledge/machine-render.js +1 -1
  89. package/dist/knowledge/market-metrics.d.ts +12 -0
  90. package/dist/knowledge/market-metrics.js +1 -0
  91. package/dist/knowledge/market-operations.d.ts +46 -0
  92. package/dist/knowledge/market-operations.js +1 -0
  93. package/dist/knowledge/mcp-schema-audit-cli.js +1 -1
  94. package/dist/knowledge/mcp-schema-audit.d.ts +22 -22
  95. package/dist/knowledge/mcp-schema-audit.js +1 -1
  96. package/dist/knowledge/onchain-constants.js +1 -1
  97. package/dist/knowledge/payment-confirm.d.ts +26 -0
  98. package/dist/knowledge/payment-confirm.js +1 -0
  99. package/dist/knowledge/payment-translation.d.ts +37 -0
  100. package/dist/knowledge/payment-translation.js +1 -0
  101. package/dist/knowledge/permission-ledger.d.ts +11 -0
  102. package/dist/knowledge/permission-ledger.js +1 -1
  103. package/dist/knowledge/personal-confirm.d.ts +29 -0
  104. package/dist/knowledge/personal-confirm.js +1 -0
  105. package/dist/knowledge/personal-translation.d.ts +37 -0
  106. package/dist/knowledge/personal-translation.js +1 -0
  107. package/dist/knowledge/process-model.d.ts +1 -11
  108. package/dist/knowledge/process-model.js +1 -1
  109. package/dist/knowledge/proof-context.d.ts +17 -0
  110. package/dist/knowledge/proof-context.js +1 -0
  111. package/dist/knowledge/proof-ledger.d.ts +34 -0
  112. package/dist/knowledge/proof-ledger.js +1 -0
  113. package/dist/knowledge/proof-puzzle.d.ts +35 -0
  114. package/dist/knowledge/proof-puzzle.js +1 -0
  115. package/dist/knowledge/proof-templates.d.ts +22 -0
  116. package/dist/knowledge/proof-templates.js +1 -0
  117. package/dist/knowledge/registrar-confirm.d.ts +26 -0
  118. package/dist/knowledge/registrar-confirm.js +1 -0
  119. package/dist/knowledge/registrar-translation.d.ts +37 -0
  120. package/dist/knowledge/registrar-translation.js +1 -0
  121. package/dist/knowledge/repository-context.d.ts +12 -0
  122. package/dist/knowledge/repository-context.js +1 -0
  123. package/dist/knowledge/repository-ledger.d.ts +25 -0
  124. package/dist/knowledge/repository-ledger.js +1 -0
  125. package/dist/knowledge/repository-puzzle.d.ts +30 -0
  126. package/dist/knowledge/repository-puzzle.js +1 -0
  127. package/dist/knowledge/repository-templates.d.ts +14 -0
  128. package/dist/knowledge/repository-templates.js +1 -0
  129. package/dist/knowledge/resource-confirm.d.ts +25 -0
  130. package/dist/knowledge/resource-confirm.js +1 -0
  131. package/dist/knowledge/resource-translation.d.ts +37 -0
  132. package/dist/knowledge/resource-translation.js +1 -0
  133. package/dist/knowledge/reward-context.d.ts +2 -2
  134. package/dist/knowledge/safety-rules.d.ts +1 -0
  135. package/dist/knowledge/safety-rules.js +1 -1
  136. package/dist/knowledge/service-risk.d.ts +1 -1
  137. package/dist/knowledge/service-risk.js +1 -1
  138. package/dist/knowledge/template-registry.js +1 -1
  139. package/dist/knowledge/tools-reference.js +1 -1
  140. package/dist/knowledge/universal-template.d.ts +22 -0
  141. package/dist/knowledge/universal-template.js +1 -0
  142. package/dist/knowledge/util-confirm.d.ts +24 -0
  143. package/dist/knowledge/util-confirm.js +1 -0
  144. package/dist/knowledge/util-translation.d.ts +38 -0
  145. package/dist/knowledge/util-translation.js +1 -0
  146. package/dist/knowledge/workflow-guidance.d.ts +116 -0
  147. package/dist/knowledge/workflow-guidance.js +1 -0
  148. package/dist/participation/employee-kpi.d.ts +25 -0
  149. package/dist/participation/employee-kpi.js +1 -0
  150. package/dist/participation/employee-store.d.ts +16 -0
  151. package/dist/participation/employee-store.js +1 -0
  152. package/dist/participation/index.d.ts +2 -0
  153. package/dist/participation/index.js +1 -0
  154. package/dist/persona/defaults.js +1 -1
  155. package/dist/persona/index.d.ts +9 -2
  156. package/dist/persona/index.js +1 -1
  157. package/dist/persona/local-region.d.ts +20 -0
  158. package/dist/persona/local-region.js +1 -0
  159. package/dist/persona/model.js +1 -1
  160. package/dist/persona/overrides.d.ts +10 -0
  161. package/dist/persona/overrides.js +1 -0
  162. package/dist/persona/pack-personae.d.ts +11 -0
  163. package/dist/persona/pack-personae.js +1 -0
  164. package/dist/persona/strategy-intent.d.ts +20 -0
  165. package/dist/persona/strategy-intent.js +1 -0
  166. package/dist/persona/types.d.ts +3 -1
  167. package/dist/project/business-puzzle.d.ts +1 -1
  168. package/dist/project/business-puzzle.js +1 -1
  169. package/dist/project/deployment-doc.js +1 -1
  170. package/dist/project/edit-planner.js +1 -1
  171. package/dist/project/evaluation.d.ts +37 -1
  172. package/dist/project/evaluation.js +1 -1
  173. package/dist/project/graph.d.ts +3 -6
  174. package/dist/project/handlers.d.ts +33 -2
  175. package/dist/project/handlers.js +1 -1
  176. package/dist/project/index.d.ts +1 -0
  177. package/dist/project/index.js +1 -1
  178. package/dist/project/merchant-guide.d.ts +19 -0
  179. package/dist/project/merchant-guide.js +1 -1
  180. package/dist/project/mode-actions.js +1 -1
  181. package/dist/project/rollback-policy.js +1 -1
  182. package/dist/project/semantic-graph.d.ts +3 -5
  183. package/dist/project/workflow-design-assessment.d.ts +24 -0
  184. package/dist/project/workflow-design-assessment.js +1 -0
  185. package/dist/safety/confirm-gate.d.ts +1 -1
  186. package/dist/safety/confirm-gate.js +1 -1
  187. package/dist/schema/call/allocation.d.ts +186 -1385
  188. package/dist/schema/call/arbitration.d.ts +272 -1871
  189. package/dist/schema/call/base.d.ts +1831 -9076
  190. package/dist/schema/call/base.js +1 -1
  191. package/dist/schema/call/bridge.d.ts +911 -3171
  192. package/dist/schema/call/contact.d.ts +135 -931
  193. package/dist/schema/call/demand.d.ts +164 -1194
  194. package/dist/schema/call/guard.d.ts +298 -1140
  195. package/dist/schema/call/guard.js +1 -1
  196. package/dist/schema/call/machine.d.ts +459 -5403
  197. package/dist/schema/call/machine.js +1 -1
  198. package/dist/schema/call/order.d.ts +137 -844
  199. package/dist/schema/call/payment.d.ts +74 -561
  200. package/dist/schema/call/permission.d.ts +335 -2791
  201. package/dist/schema/call/personal.d.ts +227 -1814
  202. package/dist/schema/call/progress.d.ts +140 -843
  203. package/dist/schema/call/proof.d.ts +42 -258
  204. package/dist/schema/call/repository.d.ts +324 -2222
  205. package/dist/schema/call/reward.d.ts +153 -1183
  206. package/dist/schema/call/semantic.js +1 -1
  207. package/dist/schema/call/service.d.ts +376 -3431
  208. package/dist/schema/call/treasury.d.ts +252 -2158
  209. package/dist/schema/common/index.d.ts +222 -697
  210. package/dist/schema/common/index.js +1 -1
  211. package/dist/schema/config/index.d.ts +18 -161
  212. package/dist/schema/employee/index.d.ts +99 -0
  213. package/dist/schema/employee/index.js +1 -0
  214. package/dist/schema/evaluation/index.d.ts +1035 -3918
  215. package/dist/schema/evaluation/index.js +1 -1
  216. package/dist/schema/index.d.ts +3 -0
  217. package/dist/schema/index.js +1 -1
  218. package/dist/schema/industry-pack/index.d.ts +132 -0
  219. package/dist/schema/industry-pack/index.js +1 -0
  220. package/dist/schema/intent-radar/index.d.ts +92 -245
  221. package/dist/schema/intent-radar/index.js +1 -1
  222. package/dist/schema/local/index.d.ts +2045 -18080
  223. package/dist/schema/local/index.js +1 -1
  224. package/dist/schema/local/wip.d.ts +61 -651
  225. package/dist/schema/local/wip.js +1 -1
  226. package/dist/schema/messenger/index.d.ts +949 -5557
  227. package/dist/schema/messenger/index.js +1 -1
  228. package/dist/schema/operations.d.ts +2969 -26518
  229. package/dist/schema/operations.js +1 -1
  230. package/dist/schema/persona/index.d.ts +469 -1820
  231. package/dist/schema/persona/index.js +1 -1
  232. package/dist/schema/project/index.d.ts +1023 -8450
  233. package/dist/schema/project/index.js +1 -1
  234. package/dist/schema/query/index.d.ts +12042 -75678
  235. package/dist/schema/query/index.js +1 -1
  236. package/dist/schema/schema-query/index.d.ts +35 -98
  237. package/dist/schema/schema-query/index.js +1 -1
  238. package/dist/schema/schema-version.js +1 -1
  239. package/dist/schema/task-status.d.ts +26 -132
  240. package/dist/schema/trust/index.d.ts +194 -1290
  241. package/dist/schema/utils/guard-parser.js +1 -1
  242. package/dist/schema/utils/node-parser.js +1 -1
  243. package/dist/schema/utils/skills-recommendation.d.ts +1 -0
  244. package/dist/schema/utils/skills-recommendation.js +1 -1
  245. package/dist/schema/workspace/index.d.ts +69 -0
  246. package/dist/schema/workspace/index.js +1 -0
  247. package/dist/{schema-query → schema-query-impl}/index.js +1 -1
  248. package/dist/schemas/account_operation.output.json +3147 -1655
  249. package/dist/schemas/account_operation.schema.json +225 -218
  250. package/dist/schemas/bridge_operation.output.json +1168 -653
  251. package/dist/schemas/bridge_operation.schema.json +736 -504
  252. package/dist/schemas/config_operation.output.json +185 -179
  253. package/dist/schemas/config_operation.schema.json +21 -26
  254. package/dist/schemas/employee_operation.output.json +207 -0
  255. package/dist/schemas/employee_operation.schema.json +176 -0
  256. package/dist/schemas/evaluation_operation.output.json +2268 -601
  257. package/dist/schemas/evaluation_operation.schema.json +2919 -787
  258. package/dist/schemas/guard2file.output.json +58 -64
  259. package/dist/schemas/guard2file.schema.json +79 -81
  260. package/dist/schemas/index.json +29 -11
  261. package/dist/schemas/industry_pack_operation.output.json +594 -0
  262. package/dist/schemas/industry_pack_operation.schema.json +55 -0
  263. package/dist/schemas/intent_radar.output.json +275 -203
  264. package/dist/schemas/intent_radar.schema.json +124 -126
  265. package/dist/schemas/local_info_operation.output.json +1174 -660
  266. package/dist/schemas/local_info_operation.schema.json +119 -125
  267. package/dist/schemas/local_mark_operation.output.json +1239 -692
  268. package/dist/schemas/local_mark_operation.schema.json +91 -96
  269. package/dist/schemas/machineNode2file.output.json +63 -69
  270. package/dist/schemas/machineNode2file.schema.json +79 -81
  271. package/dist/schemas/messenger_operation.output.json +2722 -1531
  272. package/dist/schemas/messenger_operation.schema.json +1482 -1264
  273. package/dist/schemas/onchain_events.output.json +2590 -978
  274. package/dist/schemas/onchain_events.schema.json +117 -99
  275. package/dist/schemas/onchain_operations.output.json +3957 -2312
  276. package/dist/schemas/onchain_operations.schema.json +20799 -9285
  277. package/dist/schemas/onchain_operations_allocation.schema.json +171 -107
  278. package/dist/schemas/onchain_operations_arbitration.schema.json +233 -146
  279. package/dist/schemas/onchain_operations_contact.schema.json +129 -90
  280. package/dist/schemas/onchain_operations_demand.schema.json +170 -112
  281. package/dist/schemas/onchain_operations_gen_passport.schema.json +61 -646
  282. package/dist/schemas/onchain_operations_gen_proof.schema.json +40 -172
  283. package/dist/schemas/onchain_operations_guard.schema.json +3765 -294
  284. package/dist/schemas/onchain_operations_machine.schema.json +536 -163
  285. package/dist/schemas/onchain_operations_order.schema.json +126 -96
  286. package/dist/schemas/onchain_operations_payment.schema.json +82 -67
  287. package/dist/schemas/onchain_operations_permission.schema.json +331 -93
  288. package/dist/schemas/onchain_operations_personal.schema.json +636 -96
  289. package/dist/schemas/onchain_operations_progress.schema.json +125 -92
  290. package/dist/schemas/onchain_operations_proof.schema.json +76 -69
  291. package/dist/schemas/onchain_operations_repository.schema.json +636 -249
  292. package/dist/schemas/onchain_operations_reward.schema.json +218 -108
  293. package/dist/schemas/onchain_operations_service.schema.json +678 -220
  294. package/dist/schemas/onchain_operations_treasury.schema.json +401 -135
  295. package/dist/schemas/onchain_table_data.output.json +6018 -2433
  296. package/dist/schemas/onchain_table_data.schema.json +544 -430
  297. package/dist/schemas/persona_operation.output.json +1568 -268
  298. package/dist/schemas/persona_operation.schema.json +346 -205
  299. package/dist/schemas/project_operation.output.json +6922 -5132
  300. package/dist/schemas/project_operation.schema.json +1050 -1020
  301. package/dist/schemas/query_task_status.output.json +195 -99
  302. package/dist/schemas/query_task_status.schema.json +12 -18
  303. package/dist/schemas/query_toolkit.output.json +18862 -14561
  304. package/dist/schemas/query_toolkit.schema.json +614 -522
  305. package/dist/schemas/schema_query.output.json +127 -129
  306. package/dist/schemas/schema_query.schema.json +64 -69
  307. package/dist/schemas/trust_score.output.json +678 -587
  308. package/dist/schemas/trust_score.schema.json +289 -277
  309. package/dist/schemas/wip_file.output.json +116 -124
  310. package/dist/schemas/wip_file.schema.json +142 -143
  311. package/dist/schemas/workspace_operation.output.json +277 -0
  312. package/dist/schemas/workspace_operation.schema.json +45 -0
  313. package/dist/schemas/wowok_buildin_info.output.json +1682 -844
  314. package/dist/schemas/wowok_buildin_info.schema.json +576 -526
  315. package/dist/tools/handlers/bridge.d.ts +8 -1
  316. package/dist/tools/handlers/bridge.js +1 -1
  317. package/dist/tools/handlers/config.js +1 -1
  318. package/dist/tools/handlers/employee.d.ts +2 -0
  319. package/dist/tools/handlers/employee.js +1 -0
  320. package/dist/tools/handlers/evaluation.js +1 -1
  321. package/dist/tools/handlers/file-export.js +1 -1
  322. package/dist/tools/handlers/industry-pack.d.ts +2 -0
  323. package/dist/tools/handlers/industry-pack.js +1 -0
  324. package/dist/tools/handlers/onchain.js +1 -1
  325. package/dist/tools/handlers/persona.js +1 -1
  326. package/dist/tools/handlers/project.js +1 -1
  327. package/dist/tools/handlers/query.js +1 -1
  328. package/dist/tools/handlers/schema-query.js +1 -1
  329. package/dist/tools/handlers/trust.js +1 -1
  330. package/dist/tools/handlers/wip.js +1 -1
  331. package/dist/tools/handlers/workspace.d.ts +2 -0
  332. package/dist/tools/handlers/workspace.js +1 -0
  333. package/dist/tools/index.d.ts +2 -1
  334. package/dist/tools/index.js +1 -1
  335. package/dist/tools/rules-hook.d.ts +1 -1
  336. package/dist/tools/rules-hook.js +1 -1
  337. package/dist/tools/shared.d.ts +1 -1
  338. package/dist/tools/shared.js +1 -1
  339. package/dist/tools/types.d.ts +2 -1
  340. package/package.json +4 -5
  341. package/dist/knowledge/arbitration-trust.d.ts +0 -24
  342. package/dist/knowledge/arbitration-trust.js +0 -1
  343. package/dist/schema/call/bridge-handler.d.ts +0 -8
  344. package/dist/schema/call/bridge-handler.js +0 -1
  345. package/dist/schema/sync-layer4.d.ts +0 -21
  346. package/dist/schema/sync-layer4.js +0 -1
  347. /package/dist/{schema-query → schema-query-impl}/index.d.ts +0 -0
@@ -1 +1 @@
1
- import{aggregateIndustryMetrics,evaluateIndustryHealth,suggestIndustryUpdate}from'./industry-evolution.js';import{getIndustryProfile,resolveIndustryName}from'./industry-registry.js';import{evaluateIndustryHealthByIntent,suggestIndustryUpdateByIntent,getRoleAdvice,filterSuggestionsByRole,getIntentProfile}from'./intent-metrics.js';import{existsSync,mkdirSync,readFileSync,writeFileSync}from'fs';import{dirname,join}from'path';import{getWowMcpDir}from'@wowok/wowok';export const FLYWHEEL_LOOP_VERSION=0x2;const MIN_SIGNALS_FOR_EVOLUTION=0xa,DEFAULT_SCHEDULE={'mode':'semi_realtime','signal_threshold':0x14,'time_interval_ms':0x5*0x3c*0x3e8,'auto_apply':![]},industrySchedules=new Map(),industryLastUpdate=new Map(),industryIntent=new Map(),signalBuffer=new Map(),decisionContexts=new Map(),latestMetrics=new Map(),latestHealth=new Map(),pendingSuggestions=new Map();export function recordIndustrySignal(a,b,c){if(!a)return;const d=resolveIndustryName(a)??a,e={'industry':d,'operation_type':b['type'],'success':c['success'],'error_code':c['error_code'],'timestamp':Date['now']()},f=sanitizeSignal(e),g=signalBuffer['get'](d)??[];g['push'](f),signalBuffer['set'](d,g),tryMaybeAutoTrigger(d,g['length']);}function tryMaybeAutoTrigger(a,b){const c=industrySchedules['get'](a)??DEFAULT_SCHEDULE;if(c['mode']==='manual')return;const d=Date['now'](),e=industryLastUpdate['get'](a)??0x0;if(c['mode']==='realtime'){b>=MIN_SIGNALS_FOR_EVOLUTION&&b%MIN_SIGNALS_FOR_EVOLUTION===0x0&&doAutoUpdate(a,c);return;}if(c['mode']==='semi_realtime'){const f=c['signal_threshold']??0x14,g=c['time_interval_ms']??0x5*0x3c*0x3e8,h=b>=f&&b%f===0x0,i=e>0x0&&d-e>=g;(h||i)&&doAutoUpdate(a,c);}}function doAutoUpdate(a,b){try{const c=updateIndustryCognition(a);industryLastUpdate['set'](a,Date['now']());if(b['auto_apply']&&c['suggestions_generated']>0x0){const d=pendingSuggestions['get'](a)??[],{applyIndustryUpdate:e}=require('./industry-evolution.js');for(const f of d){try{e(a,f);}catch{}}}}catch{}}export function setEvolutionSchedule(a,b){if(!a)return;const c=resolveIndustryName(a)??a;industrySchedules['set'](c,b);}export function getEvolutionSchedule(a){const b=resolveIndustryName(a)??a;return industrySchedules['get'](b)??DEFAULT_SCHEDULE;}export function setIndustryIntent(a,b){if(!a)return;const c=resolveIndustryName(a)??a;industryIntent['set'](c,b);}export function getIndustryIntent(a){const b=resolveIndustryName(a)??a;return industryIntent['get'](b)??'default';}export function getIndustrySignalCount(a){const b=resolveIndustryName(a)??a;return signalBuffer['get'](b)?.['length']??0x0;}export function getIndustrySignals(a){const b=resolveIndustryName(a)??a;return[...signalBuffer['get'](b)??[]];}export function listIndustriesWithSignals(){return Array['from'](signalBuffer['keys']());}export function getPendingSuggestions(a){const b=resolveIndustryName(a)??a;return[...pendingSuggestions['get'](b)??[]];}export function recordDecisionContext(a,b){if(!a['id']||!a['node_id'])return;const c=sanitizeDecisionContext(a);decisionContexts['set'](a['id'],c);if(b)try{b['attachDecisionContext'](a['node_id'],{'id':a['id'],'decided_at':a['decided_at'],'decider':a['decider'],'industry':a['industry'],'intent':a['intent'],'alternatives':a['alternatives'],'rationale':a['rationale'],'outcome':a['outcome']});}catch{}}export function queryDecisionsByIndustry(a){const b=resolveIndustryName(a)??a;return Array['from'](decisionContexts['values']())['filter'](c=>c['industry']===b)['sort']((c,d)=>d['decided_at']-c['decided_at']);}export function queryDecisionsByNode(a){return Array['from'](decisionContexts['values']())['filter'](b=>b['node_id']===a)['sort']((c,d)=>d['decided_at']-c['decided_at']);}export function backfillDecisionOutcome(a,b){const c=decisionContexts['get'](a);if(!c)return![];return c['outcome']=b,!![];}export function updateIndustryCognition(a,b){const c=resolveIndustryName(a)??a,d=signalBuffer['get'](c)??[],e={'industry':c,'metrics_updated':![],'health_recomputed':![],'suggestions_generated':0x0,'evolution_ready':d['length']>=MIN_SIGNALS_FOR_EVOLUTION};if(d['length']<MIN_SIGNALS_FOR_EVOLUTION&&(!b||b['length']===0x0))return e;let f;if(b&&b['length']>0x0)f=aggregateIndustryMetrics(c,b);else{const j=d['map'](k=>({'industry':c,'completed':k['success'],'has_dispute':!!k['error_code']&&k['error_code']['includes']('dispute'),'has_refund':!!k['error_code']&&k['error_code']['includes']('refund'),'ticket_size':0x0n,'timestamp':k['timestamp']}));f=aggregateIndustryMetrics(c,j);}latestMetrics['set'](c,f),e['metrics_updated']=!![];const g=industryIntent['get'](c)??'default';let h,i;return g!=='default'?(h=evaluateIndustryHealthByIntent(c,f,g),i=suggestIndustryUpdateByIntent(c,f,g)):(h=evaluateIndustryHealth(c,f),i=suggestIndustryUpdate(c,f)),latestHealth['set'](c,h),e['health_recomputed']=!![],pendingSuggestions['set'](c,i),e['suggestions_generated']=i['length'],e;}export function injectEvolutionContext(a,b,c){if(!b)return{'confidence':0x0};const d=resolveIndustryName(b)??b,e=getIndustryProfile(d);if(!e)return{'confidence':0x0,'industry_signal':'Industry\x20'+d+'\x20is\x20not\x20yet\x20registered;\x20recommend\x20synthesizing\x20a\x20profile\x20via\x20the\x20generalizer\x20engine'};const f=latestHealth['get'](d),g=latestMetrics['get'](d),h=pendingSuggestions['get'](d)??[],i=signalBuffer['get'](d)?.['length']??0x0,j=industryIntent['get'](d)??'default',k=[];let l,m=0.5;f&&(k['push']('Industry\x20health\x20'+f['health_score']+'/100\x20('+f['level']+')'),m=Math['max'](m,0.7),f['weaknesses']['length']>0x0&&(l='Weakness:\x20'+f['weaknesses'][0x0]),f['recommendations']['length']>0x0&&(l=l?l+';\x20recommendation:\x20'+f['recommendations'][0x0]:'Recommendation:\x20'+f['recommendations'][0x0]));g&&g['anomalies']['length']>0x0&&(k['push']('Anomaly:\x20'+g['anomalies'][0x0]),m=Math['max'](m,0.8));i>0x0&&k['push']('Accumulated\x20'+i+'\x20industry\x20signals');j!=='default'&&k['push']('Current\x20intent:\x20'+j);if(!l&&h['length']>0x0){const p=h['find'](q=>q['priority']==='high')??h[0x0];l=p['suggestion_type']+':\x20'+p['evidence'],m=Math['max'](m,p['confidence']);}let n,o=h;if(c){const q=getIntentProfile(j);q&&(n=getRoleAdvice(j,c));const r=q?.['suggestion_triggers']??[];o=filterSuggestionsByRole(h,c,r);if(o['length']>0x0){const s=o['find'](t=>t['priority']==='high')??o[0x0];l=s['suggestion_type']+'\x20('+c+'):\x20'+s['evidence'];}}return{'industry_signal':k['length']>0x0?k['join'](';\x20'):undefined,'evolution_advice':l,'confidence':m,'health_score':f?.['health_score'],'pending_suggestions':o['length'],'intent':j!=='default'?j:undefined,'role_advice':n&&n['length']>0x0?n:undefined,'role':c};}export function getIndustryEvolutionStatus(a){const b=resolveIndustryName(a)??a,c=getIndustryProfile(b);return{'industry':b,'version':c?.['version']??'v0','last_updated':c?.['evolution']?.['last_updated']??0x0,'signal_count':signalBuffer['get'](b)?.['length']??0x0,'health':latestHealth['get'](b),'pending_suggestions':pendingSuggestions['get'](b)?.['length']??0x0,'evolution_ready':(signalBuffer['get'](b)?.['length']??0x0)>=MIN_SIGNALS_FOR_EVOLUTION};}export const EVOLUTION_STATE_VERSION=0x1;function evolutionStateFilePath(){return join(getWowMcpDir(),'evolution-state.json');}export function saveEvolutionState(){const a=evolutionStateFilePath(),b=dirname(a);if(!existsSync(b))mkdirSync(b,{'recursive':!![]});const c={'version':EVOLUTION_STATE_VERSION,'saved_at':Date['now'](),'signal_buffer':Object['fromEntries'](signalBuffer),'decision_contexts':Object['fromEntries'](decisionContexts),'latest_metrics':Object['fromEntries'](latestMetrics),'latest_health':Object['fromEntries'](latestHealth),'pending_suggestions':Object['fromEntries'](pendingSuggestions),'industry_schedules':Object['fromEntries'](industrySchedules),'industry_last_update':Object['fromEntries'](industryLastUpdate),'industry_intent':Object['fromEntries'](industryIntent)},d=(e,f)=>{if(typeof f==='bigint')return{'__bigint__':f['toString']()};return f;};return writeFileSync(a,JSON['stringify'](c,d,0x2),'utf-8'),a;}export function loadEvolutionState(){const a=evolutionStateFilePath();if(!existsSync(a))return![];try{const b=readFileSync(a,'utf-8'),c=(e,f)=>{if(f&&typeof f==='object'&&'__bigint__'in f)return BigInt(f['__bigint__']);return f;},d=JSON['parse'](b,c);if(!d||d['version']!==EVOLUTION_STATE_VERSION)return![];_resetFlywheelLoopForTest();for(const [e,f]of Object['entries'](d['signal_buffer'])){signalBuffer['set'](e,f);}for(const [g,h]of Object['entries'](d['decision_contexts'])){decisionContexts['set'](g,h);}for(const [i,j]of Object['entries'](d['latest_metrics'])){latestMetrics['set'](i,j);}for(const [l,m]of Object['entries'](d['latest_health'])){latestHealth['set'](l,m);}for(const [n,o]of Object['entries'](d['pending_suggestions'])){pendingSuggestions['set'](n,o);}for(const [p,q]of Object['entries'](d['industry_schedules'])){industrySchedules['set'](p,q);}for(const [r,s]of Object['entries'](d['industry_last_update'])){industryLastUpdate['set'](r,s);}for(const [t,u]of Object['entries'](d['industry_intent'])){industryIntent['set'](t,u);}return!![];}catch{return![];}}export function hasPersistedEvolutionState(){return existsSync(evolutionStateFilePath());}export function sanitizeSignal(a){return{'industry':a['industry'],'operation_type':a['operation_type'],'success':a['success'],'error_code':a['error_code'],'timestamp':a['timestamp'],'decision_context_id':a['decision_context_id']};}export function sanitizeDecisionContext(a){return{'id':a['id'],'node_id':a['node_id'],'decided_at':a['decided_at'],'decider':a['decider'],'industry':a['industry'],'intent':a['intent'],'outcome':a['outcome']};}export function checkAndTriggerCognitionUpdate(a){return updateIndustryCognition(a);}export function _resetFlywheelLoopForTest(){signalBuffer['clear'](),decisionContexts['clear'](),latestMetrics['clear'](),latestHealth['clear'](),pendingSuggestions['clear'](),industrySchedules['clear'](),industryLastUpdate['clear'](),industryIntent['clear']();}export function _snapshotSignalBuffer(){return Object['fromEntries'](signalBuffer);}export{MIN_SIGNALS_FOR_EVOLUTION as FLYWHEEL_LOOP_MIN_SIGNALS};
1
+ import{aggregateIndustryMetrics,evaluateIndustryHealth,suggestIndustryUpdate}from'./industry-evolution.js';import{getIndustryProfile,resolveIndustryName}from'./industry-registry.js';import{evaluateIndustryHealthByIntent,suggestIndustryUpdateByIntent,getRoleAdvice,filterSuggestionsByRole,getIntentProfile}from'./intent-metrics.js';import{existsSync,mkdirSync,readFileSync,writeFileSync}from'fs';import{dirname,join}from'path';import{getWowMcpDir}from'@wowok/wowok';export const FLYWHEEL_LOOP_VERSION=0x2;const MIN_SIGNALS_FOR_EVOLUTION=0xa,DEFAULT_SCHEDULE={'mode':'semi_realtime','signal_threshold':0x14,'time_interval_ms':0x5*0x3c*0x3e8,'auto_apply':![]},industrySchedules=new Map(),industryLastUpdate=new Map(),industryIntent=new Map(),signalBuffer=new Map(),decisionContexts=new Map(),latestMetrics=new Map(),latestHealth=new Map(),pendingSuggestions=new Map();export function recordIndustrySignal(a,b,c){if(!a)return;const d=resolveIndustryName(a)??a,e={'industry':d,'operation_type':b['type'],'success':c['success'],'error_code':c['error_code'],'timestamp':Date['now']()},f=sanitizeSignal(e),g=signalBuffer['get'](d)??[];g['push'](f),signalBuffer['set'](d,g),tryMaybeAutoTrigger(d,g['length']);}function tryMaybeAutoTrigger(a,b){const c=industrySchedules['get'](a)??DEFAULT_SCHEDULE;if(c['mode']==='manual')return;const d=Date['now'](),e=industryLastUpdate['get'](a)??0x0;if(c['mode']==='realtime'){b>=MIN_SIGNALS_FOR_EVOLUTION&&b%MIN_SIGNALS_FOR_EVOLUTION===0x0&&doAutoUpdate(a,c);return;}if(c['mode']==='semi_realtime'){const f=c['signal_threshold']??0x14,g=c['time_interval_ms']??0x5*0x3c*0x3e8,h=b>=f&&b%f===0x0,i=e>0x0&&d-e>=g;(h||i)&&doAutoUpdate(a,c);}}function doAutoUpdate(a,b){try{const c=updateIndustryCognition(a);industryLastUpdate['set'](a,Date['now']());if(b['auto_apply']&&c['suggestions_generated']>0x0){const d=pendingSuggestions['get'](a)??[],{applyIndustryUpdate:e}=require('./industry-evolution.js');for(const f of d){try{e(a,f);}catch{}}}}catch{}}export function setEvolutionSchedule(a,b){if(!a)return;const c=resolveIndustryName(a)??a;industrySchedules['set'](c,b);}export function getEvolutionSchedule(a){const b=resolveIndustryName(a)??a;return industrySchedules['get'](b)??DEFAULT_SCHEDULE;}export function setIndustryIntent(a,b){if(!a)return;const c=resolveIndustryName(a)??a;industryIntent['set'](c,b);}export function getIndustryIntent(a){const b=resolveIndustryName(a)??a;return industryIntent['get'](b)??'default';}export function getIndustrySignalCount(a){const b=resolveIndustryName(a)??a;return signalBuffer['get'](b)?.['length']??0x0;}export function getIndustrySignals(a){const b=resolveIndustryName(a)??a;return[...signalBuffer['get'](b)??[]];}export function listIndustriesWithSignals(){return Array['from'](signalBuffer['keys']());}export function getPendingSuggestions(a){const b=resolveIndustryName(a)??a;return[...pendingSuggestions['get'](b)??[]];}export function recordDecisionContext(a,b){if(!a['id']||!a['node_id'])return;decisionContexts['set'](a['id'],a);if(b)try{b['attachDecisionContext'](a['node_id'],{'id':a['id'],'decided_at':a['decided_at'],'decider':a['decider'],'industry':a['industry'],'intent':a['intent'],'alternatives':a['alternatives'],'rationale':a['rationale'],'outcome':a['outcome']});}catch{}}export function queryDecisionsByIndustry(a){const b=resolveIndustryName(a)??a;return Array['from'](decisionContexts['values']())['filter'](c=>c['industry']===b)['sort']((c,d)=>d['decided_at']-c['decided_at']);}export function queryDecisionsByNode(a){return Array['from'](decisionContexts['values']())['filter'](b=>b['node_id']===a)['sort']((c,d)=>d['decided_at']-c['decided_at']);}export function backfillDecisionOutcome(a,b){const c=decisionContexts['get'](a);if(!c)return![];return c['outcome']=b,!![];}export function updateIndustryCognition(a,b){const c=resolveIndustryName(a)??a,d=signalBuffer['get'](c)??[],e={'industry':c,'metrics_updated':![],'health_recomputed':![],'suggestions_generated':0x0,'evolution_ready':d['length']>=MIN_SIGNALS_FOR_EVOLUTION};if(d['length']<MIN_SIGNALS_FOR_EVOLUTION&&(!b||b['length']===0x0))return e;let f;if(b&&b['length']>0x0)f=aggregateIndustryMetrics(c,b);else{const j=d['map'](k=>({'industry':c,'completed':k['success'],'has_dispute':!!k['error_code']&&k['error_code']['includes']('dispute'),'has_refund':!!k['error_code']&&k['error_code']['includes']('refund'),'ticket_size':0x0n,'timestamp':k['timestamp']}));f=aggregateIndustryMetrics(c,j);}latestMetrics['set'](c,f),e['metrics_updated']=!![];const g=industryIntent['get'](c)??'default';let h,i;return g!=='default'?(h=evaluateIndustryHealthByIntent(c,f,g),i=suggestIndustryUpdateByIntent(c,f,g)):(h=evaluateIndustryHealth(c,f),i=suggestIndustryUpdate(c,f)),latestHealth['set'](c,h),e['health_recomputed']=!![],pendingSuggestions['set'](c,i),e['suggestions_generated']=i['length'],e;}export function injectEvolutionContext(a,b,c){if(!b)return{'confidence':0x0};const d=resolveIndustryName(b)??b,e=getIndustryProfile(d);if(!e)return{'confidence':0x0,'industry_signal':'Industry\x20'+d+'\x20is\x20not\x20yet\x20registered;\x20recommend\x20synthesizing\x20a\x20profile\x20via\x20the\x20generalizer\x20engine'};const f=latestHealth['get'](d),g=latestMetrics['get'](d),h=pendingSuggestions['get'](d)??[],i=signalBuffer['get'](d)?.['length']??0x0,j=industryIntent['get'](d)??'default',k=[];let l,m=0.5;f&&(k['push']('Industry\x20health\x20'+f['health_score']+'/100\x20('+f['level']+')'),m=Math['max'](m,0.7),f['weaknesses']['length']>0x0&&(l='Weakness:\x20'+f['weaknesses'][0x0]),f['recommendations']['length']>0x0&&(l=l?l+';\x20recommendation:\x20'+f['recommendations'][0x0]:'Recommendation:\x20'+f['recommendations'][0x0]));g&&g['anomalies']['length']>0x0&&(k['push']('Anomaly:\x20'+g['anomalies'][0x0]),m=Math['max'](m,0.8));i>0x0&&k['push']('Accumulated\x20'+i+'\x20industry\x20signals');j!=='default'&&k['push']('Current\x20intent:\x20'+j);if(!l&&h['length']>0x0){const p=h['find'](q=>q['priority']==='high')??h[0x0];l=p['suggestion_type']+':\x20'+p['evidence'],m=Math['max'](m,p['confidence']);}let n,o=h;if(c){const q=getIntentProfile(j);q&&(n=getRoleAdvice(j,c));const r=q?.['suggestion_triggers']??[];o=filterSuggestionsByRole(h,c,r);if(o['length']>0x0){const s=o['find'](t=>t['priority']==='high')??o[0x0];l=s['suggestion_type']+'\x20('+c+'):\x20'+s['evidence'];}}return{'industry_signal':k['length']>0x0?k['join'](';\x20'):undefined,'evolution_advice':l,'confidence':m,'health_score':f?.['health_score'],'pending_suggestions':o['length'],'intent':j!=='default'?j:undefined,'role_advice':n&&n['length']>0x0?n:undefined,'role':c};}export function getIndustryEvolutionStatus(a){const b=resolveIndustryName(a)??a,c=getIndustryProfile(b);return{'industry':b,'version':c?.['version']??'v0','last_updated':c?.['evolution']?.['last_updated']??0x0,'signal_count':signalBuffer['get'](b)?.['length']??0x0,'health':latestHealth['get'](b),'pending_suggestions':pendingSuggestions['get'](b)?.['length']??0x0,'evolution_ready':(signalBuffer['get'](b)?.['length']??0x0)>=MIN_SIGNALS_FOR_EVOLUTION};}export const EVOLUTION_STATE_VERSION=0x1;function evolutionStateFilePath(){return join(getWowMcpDir(),'evolution-state.json');}export function saveEvolutionState(){const a=evolutionStateFilePath(),b=dirname(a);if(!existsSync(b))mkdirSync(b,{'recursive':!![]});const c={'version':EVOLUTION_STATE_VERSION,'saved_at':Date['now'](),'signal_buffer':Object['fromEntries'](signalBuffer),'decision_contexts':Object['fromEntries'](decisionContexts),'latest_metrics':Object['fromEntries'](latestMetrics),'latest_health':Object['fromEntries'](latestHealth),'pending_suggestions':Object['fromEntries'](pendingSuggestions),'industry_schedules':Object['fromEntries'](industrySchedules),'industry_last_update':Object['fromEntries'](industryLastUpdate),'industry_intent':Object['fromEntries'](industryIntent)},d=(e,f)=>{if(typeof f==='bigint')return{'__bigint__':f['toString']()};return f;};return writeFileSync(a,JSON['stringify'](c,d,0x2),'utf-8'),a;}export function loadEvolutionState(){const a=evolutionStateFilePath();if(!existsSync(a))return![];try{const b=readFileSync(a,'utf-8'),c=(e,f)=>{if(f&&typeof f==='object'&&'__bigint__'in f)return BigInt(f['__bigint__']);return f;},d=JSON['parse'](b,c);if(!d||d['version']!==EVOLUTION_STATE_VERSION)return![];_resetFlywheelLoopForTest();for(const [e,f]of Object['entries'](d['signal_buffer'])){signalBuffer['set'](e,f);}for(const [g,h]of Object['entries'](d['decision_contexts'])){decisionContexts['set'](g,h);}for(const [i,j]of Object['entries'](d['latest_metrics'])){latestMetrics['set'](i,j);}for(const [l,m]of Object['entries'](d['latest_health'])){latestHealth['set'](l,m);}for(const [n,o]of Object['entries'](d['pending_suggestions'])){pendingSuggestions['set'](n,o);}for(const [p,q]of Object['entries'](d['industry_schedules'])){industrySchedules['set'](p,q);}for(const [r,s]of Object['entries'](d['industry_last_update'])){industryLastUpdate['set'](r,s);}for(const [t,u]of Object['entries'](d['industry_intent'])){industryIntent['set'](t,u);}return!![];}catch{return![];}}export function hasPersistedEvolutionState(){return existsSync(evolutionStateFilePath());}export function sanitizeSignal(a){return{'industry':a['industry'],'operation_type':a['operation_type'],'success':a['success'],'error_code':a['error_code'],'timestamp':a['timestamp'],'decision_context_id':a['decision_context_id']};}export function checkAndTriggerCognitionUpdate(a){return updateIndustryCognition(a);}export function _resetFlywheelLoopForTest(){signalBuffer['clear'](),decisionContexts['clear'](),latestMetrics['clear'](),latestHealth['clear'](),pendingSuggestions['clear'](),industrySchedules['clear'](),industryLastUpdate['clear'](),industryIntent['clear']();}export function _snapshotSignalBuffer(){return Object['fromEntries'](signalBuffer);}export{MIN_SIGNALS_FOR_EVOLUTION as FLYWHEEL_LOOP_MIN_SIGNALS};
@@ -1 +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']},{'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;
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;
@@ -45,4 +45,4 @@ export interface ShorthandResult {
45
45
  name: string;
46
46
  };
47
47
  }
48
- export declare function buildShorthand(orNode: GuardNode, result: ConversionResult, newIdentifier: number): ShorthandResult | null;
48
+ export declare function buildShorthand(_orNode: GuardNode, result: ConversionResult, newIdentifier: number): ShorthandResult | null;
@@ -1,8 +1,8 @@
1
1
  import { CONCEPT_GLOSSARY, CONCEPT_GLOSSARY_VERSION, resolveTerm, lookupEntry, validateText, auditSchemaFields, type GlossaryEntry, type GlossaryCategory, type GlossaryDrift } from "./glossary.js";
2
+ import { fetchMachineNodes, buildWorkflowGuidance, buildWorkflowReceipt, enrichWorkflowGuidance, mergeGuidanceIntoOutput, resolvePermissionRole, type GuidanceResult, type ReceiptResult, type ParsedMachineNode, type ParsedPair, type ParsedForward } from "./workflow-guidance.js";
2
3
  import { CONFIRMATION_RULES, SAFETY_RULES_VERSION, OBJECT_REUSE_RULES, CREATE_VS_MODIFY_PATTERN, IMMUTABILITY_RULES, OPERATION_TYPE_CLASSIFICATION, OPERATION_CLASS_META, classifyTool, NAMING_CONVENTIONS, checkObjectReuseRules, checkImmutabilityRules, type ConfirmationRule, type OperationPreview, type ConfirmLevel, type ReuseRecommendation, type ObjectReuseRule, type ImmutabilityRule, type OperationClass, type OperationClassMeta, type SafetyRiskItem } from "./safety-rules.js";
3
4
  import { TOOL_CONSTRAINTS, TOOL_CONSTRAINTS_VERSION, validateOperation, hasBlockingViolations, getWarningViolations, type ConstraintSeverity, type FieldConstraint, type OperationConstraint, type ConstraintViolation } from "./tool-constraints.js";
4
5
  import { PERMISSION_TYPES, GAME_ELEMENTS, getPermissionType, getGameElement, getGameElementsByType, PROCESS_MODEL_VERSION, type PermissionScope, type PermissionTypeDef, type GameElementType, type GameElementDef } from "./process-model.js";
5
- import { computeTrustScore, quickRiskAssessment, ARBITRATION_TRUST_VERSION, type ArbMetrics, type TrustScore, type TrustComponent } from "./arbitration-trust.js";
6
6
  import { REWARD_TEMPLATES, REWARD_TEMPLATES_VERSION, getRewardTemplate, listRewardTemplates, suggestRewardTemplate, type RewardTemplateType, type RewardTemplate } from "./reward-templates.js";
7
7
  import { AUDIT_RULES, AUDIT_RULES_VERSION, auditService, hasBlockingErrors, getErrors, getWarnings, summarizeFindings, type AuditSeverity, type AuditFinding, type AuditRule, type AuditContext } from "./audit-rules.js";
8
8
  import { matchDemand, extractDemandInfo, DEMAND_MATCHING_VERSION, type ServiceInfo, type DemandInfo, type DemandMatch } from "./demand-matching.js";
@@ -108,7 +108,6 @@ export { CONCEPT_GLOSSARY, CONCEPT_GLOSSARY_VERSION, resolveTerm, lookupEntry, v
108
108
  export { CONFIRMATION_RULES, SAFETY_RULES_VERSION, OBJECT_REUSE_RULES, CREATE_VS_MODIFY_PATTERN, IMMUTABILITY_RULES, OPERATION_TYPE_CLASSIFICATION, OPERATION_CLASS_META, classifyTool, NAMING_CONVENTIONS, checkObjectReuseRules, checkImmutabilityRules, type ConfirmationRule, type OperationPreview, type ConfirmLevel, type ReuseRecommendation, type ObjectReuseRule, type ImmutabilityRule, type OperationClass, type OperationClassMeta, type SafetyRiskItem, };
109
109
  export { TOOL_CONSTRAINTS, TOOL_CONSTRAINTS_VERSION, validateOperation, hasBlockingViolations, getWarningViolations, type ConstraintSeverity, type FieldConstraint, type OperationConstraint, type ConstraintViolation, };
110
110
  export { PERMISSION_TYPES, GAME_ELEMENTS, getPermissionType, getGameElement, getGameElementsByType, PROCESS_MODEL_VERSION, type PermissionScope, type PermissionTypeDef, type GameElementType, type GameElementDef, };
111
- export { computeTrustScore, quickRiskAssessment, ARBITRATION_TRUST_VERSION, type ArbMetrics, type TrustScore, type TrustComponent, };
112
111
  export { REWARD_TEMPLATES, REWARD_TEMPLATES_VERSION, getRewardTemplate, listRewardTemplates, suggestRewardTemplate, type RewardTemplateType, type RewardTemplate, };
113
112
  export { AUDIT_RULES, AUDIT_RULES_VERSION, auditService, hasBlockingErrors, getErrors, getWarnings, summarizeFindings, type AuditSeverity, type AuditFinding, type AuditRule, type AuditContext, };
114
113
  export { matchDemand, extractDemandInfo, DEMAND_MATCHING_VERSION, type ServiceInfo, type DemandInfo, type DemandMatch, };
@@ -191,12 +190,25 @@ export { PASSPORT_CONTEXT_VERSION, buildPassportContext, getPassportContext, bui
191
190
  export { PROOF_RISK_RULES, checkProofRisks, getProofRiskById, type ProofRiskLevel, type ProofRiskCategory, type ProofStakeholder, type ProofRisk, type ProofRiskCheckContext, };
192
191
  export { preCheckProofCreation, canCreateProof, formatProofCreationSummary, type ProofConfirmSeverity, type ProofConfirmItem, type ProofCreationCheckInput, };
193
192
  export { SEMANTIC_TO_PROOF_SCHEMA_RULES, PROOF_FIELD_TRANSLATIONS, PROOF_CONSTRAINT_RULES, explainProof, type SemanticToProofSchemaRule, type ProofFieldTranslation, type ProofConstraintRule, type ProofExplainInput, type ProofExplanation, };
193
+ export { PROOF_LEDGER_VERSION, PROOF_FIELDS, PROOF_ERROR_CODES, PROOF_SCENES, getProofField, getProofFieldsCount, getProofErrorByCode, getProofErrorByValue, getProofSceneByType, inferProofSceneFromIntent, type ProofFieldMutability, type ProofFieldEntry, type ProofErrorEntry, type ProofSceneClassification, type ProofScene, } from "./proof-ledger.js";
194
+ export { PROOF_PUZZLE_VERSION, initProofPuzzleFromIntent, checkProofPuzzleCompleteness, generateProofConfirmationText, type ProofPuzzleDimension, type ProofIntentPuzzle, type ProofFieldState, type ProofPuzzle, type ProofPuzzleCompleteness, type InitProofPuzzleInput, } from "./proof-puzzle.js";
195
+ export { PROOF_TEMPLATES_VERSION, PROOF_TEMPLATES, getProofTemplateById, getProofTemplatesByScene, suggestProofTemplateForScene, listProofTemplates, type ProofTemplateParamType, type ProofTemplateParam, type ProofTemplate, } from "./proof-templates.js";
196
+ export { PROOF_CONTEXT_VERSION, buildProofContext, getProofContextSummary, isWtsProof, type ProofContextBundle, type BuildProofContextInput, } from "./proof-context.js";
194
197
  export { REPOSITORY_RISK_RULES, checkRepositoryRisks, getRepositoryRiskById, parseIdFromForRiskCheck, type RepositoryRiskLevel, type RepositoryRiskCategory, type RepositoryStakeholder, type RepositoryRisk, type RepositoryRiskCheckContext, };
195
198
  export { preCheckRepositoryOp, canProceedRepositoryOp, formatRepositoryOpSummary, type RepositoryConfirmSeverity, type RepositoryConfirmItem, type RepositoryConfirmPolicyInput, type RepositoryOpCheckInput, };
196
199
  export { SEMANTIC_TO_REPOSITORY_SCHEMA_RULES, REPOSITORY_FIELD_TRANSLATIONS, REPOSITORY_CONSTRAINT_RULES, explainRepository, type SemanticToRepositorySchemaRule, type RepositoryFieldTranslation, type RepositoryConstraintRule, type RepositoryTranslationPolicyInput, type RepositoryExplainInput, type RepositoryExplanation, };
200
+ export { REPOSITORY_LEDGER_VERSION, REPOSITORY_ID_FROM, REPOSITORY_POLICY_FIELDS, REPOSITORY_ERROR_CODES, getRepositoryIdFrom, getRepositoryErrorByCode, getRepositoryErrorByValue, getRepositoryErrorsCount, type RepositoryIdFromMode, type RepositoryIdFromEntry, type RepositoryFieldEntry, type RepositoryErrorEntry, } from "./repository-ledger.js";
201
+ export { REPOSITORY_PUZZLE_VERSION, initRepositoryPuzzleFromIntent, checkRepositoryPuzzleCompleteness, type RepositoryIntentPuzzle, type RepositoryFieldState, type RepositoryPuzzle, type RepositoryPuzzleCompleteness, type InitRepositoryPuzzleInput, } from "./repository-puzzle.js";
202
+ export { REPOSITORY_TEMPLATES_VERSION, REPOSITORY_TEMPLATES, getRepositoryTemplateById, listRepositoryTemplates, suggestRepositoryTemplateForMode, type RepositoryTemplate, } from "./repository-templates.js";
203
+ export { REPOSITORY_CONTEXT_VERSION, buildRepositoryContext, getRepositoryContextSummary, type RepositoryContextBundle, type BuildRepositoryContextInput, } from "./repository-context.js";
204
+ export { assessEvidenceReview, type EvidenceKind, type EvidenceReviewInput, type EvidenceReviewResult } from "./evidence-review.js";
197
205
  export { DEMAND_RISK_RULES, checkDemandRisks, getDemandRiskById, type DemandRiskLevel, type DemandRiskCategory, type DemandStakeholder, type DemandRisk, type DemandRiskCheckContext, };
198
206
  export { preCheckDemandCreation, canCreateDemand, formatDemandCreationSummary, type DemandConfirmSeverity, type DemandConfirmItem, type DemandCreationCheckInput, };
199
207
  export { SEMANTIC_TO_DEMAND_SCHEMA_RULES, DEMAND_FIELD_TRANSLATIONS, DEMAND_CONSTRAINT_RULES, explainDemand, type SemanticToDemandSchemaRule, type DemandFieldTranslation, type DemandConstraintRule, type DemandExplainInput, type DemandExplanation, };
208
+ export { DEMAND_LEDGER_VERSION, DEMAND_SCENES, DEMAND_FIELDS, DEMAND_ERROR_CODES, getDemandField, getDemandErrorByCode, getDemandErrorByValue, getDemandSceneById, inferDemandSceneFromIntent, type DemandSceneClassification, type DemandScene, type DemandFieldEntry, type DemandErrorEntry, } from "./demand-ledger.js";
209
+ export { DEMAND_PUZZLE_VERSION, initDemandPuzzleFromIntent, checkDemandPuzzleCompleteness, type DemandIntentPuzzle, type DemandFieldState, type DemandPuzzle, type DemandPuzzleCompleteness, type InitDemandPuzzleInput, } from "./demand-puzzle.js";
210
+ export { DEMAND_TEMPLATES_VERSION, DEMAND_TEMPLATES, getDemandTemplateById, listDemandTemplates, suggestDemandTemplate, type DemandTemplate, } from "./demand-templates.js";
211
+ export { DEMAND_CONTEXT_VERSION, buildDemandContext, getDemandContextSummary, isRewardedDemand, getDemandSceneByIdSafe, type DemandContextBundle, type BuildDemandContextInput, } from "./demand-context.js";
200
212
  export { CONTACT_RISK_RULES, CONTACT_RISK_VERSION, checkContactRisks, getContactRiskById, type ContactRiskLevel, type ContactRiskCategory, type ContactStakeholder, type ContactRisk, type ContactRiskCheckContext, };
201
213
  export { RESOURCE_RISK_RULES, RESOURCE_RISK_VERSION, checkResourceRisks, getResourceRiskById, type ResourceRiskLevel, type ResourceRiskCategory, type ResourceStakeholder, type ResourceRisk, type ResourceRiskCheckContext, };
202
214
  export { PAYMENT_RISK_RULES, PAYMENT_RISK_VERSION, checkPaymentRisks, getPaymentRiskById, type PaymentRiskLevel, type PaymentRiskCategory, type PaymentStakeholder, type PaymentRisk, type PaymentRiskCheckContext, };
@@ -205,6 +217,22 @@ export { PERSONAL_RISK_RULES, PERSONAL_RISK_VERSION, checkPersonalRisks, getPers
205
217
  export { UTIL_RISK_RULES, UTIL_RISK_VERSION, checkUtilRisks, getUtilRiskById, type UtilRiskLevel, type UtilRiskCategory, type UtilStakeholder, type UtilRisk, type UtilRiskCheckContext, };
206
218
  export { REGISTRAR_RISK_RULES, REGISTRAR_RISK_VERSION, checkRegistrarRisks, getRegistrarRiskById, type RegistrarRiskLevel, type RegistrarRiskCategory, type RegistrarStakeholder, type RegistrarRisk, type RegistrarRiskCheckContext, };
207
219
  export { BRIDGE_RISK_RULES, BRIDGE_RISK_VERSION, checkBridgeRisks, getBridgeRiskById, type BridgeRiskLevel, type BridgeRiskCategory, type BridgeStakeholder, type BridgeRisk, type BridgeRiskCheckContext, };
220
+ export { CONTACT_CONFIRM_VERSION, preCheckContactOp, canProceedContactOp, formatContactOpSummary, type ConfirmSeverity as ContactConfirmSeverity, type ContactConfirmItem, type ContactOpCheckInput, } from "./contact-confirm.js";
221
+ export { CONTACT_TRANSLATION_VERSION, SEMANTIC_TO_CONTACT_SCHEMA_RULES, CONTACT_FIELD_TRANSLATIONS, CONTACT_CONSTRAINT_RULES, explainContact, type SemanticToContactSchemaRule, type ContactFieldTranslation, type ContactConstraintRule, type ContactExplainInput, type ContactExplanation, } from "./contact-translation.js";
222
+ export { PERSONAL_CONFIRM_VERSION, preCheckPersonalOp, canProceedPersonalOp, formatPersonalOpSummary, type ConfirmSeverity as PersonalConfirmSeverity, type PersonalConfirmItem, type PersonalOpCheckInput, } from "./personal-confirm.js";
223
+ export { PERSONAL_TRANSLATION_VERSION, SEMANTIC_TO_PERSONAL_SCHEMA_RULES, PERSONAL_FIELD_TRANSLATIONS, PERSONAL_CONSTRAINT_RULES, explainPersonal, type SemanticToPersonalSchemaRule, type PersonalFieldTranslation, type PersonalConstraintRule, type PersonalExplainInput, type PersonalExplanation, } from "./personal-translation.js";
224
+ export { RESOURCE_CONFIRM_VERSION, preCheckResourceOp, canProceedResourceOp, formatResourceOpSummary, type ConfirmSeverity as ResourceConfirmSeverity, type ResourceConfirmItem, type ResourceOpCheckInput, } from "./resource-confirm.js";
225
+ export { RESOURCE_TRANSLATION_VERSION, SEMANTIC_TO_RESOURCE_SCHEMA_RULES, RESOURCE_FIELD_TRANSLATIONS, RESOURCE_CONSTRAINT_RULES, explainResource, type SemanticToResourceSchemaRule, type ResourceFieldTranslation, type ResourceConstraintRule, type ResourceExplainInput, type ResourceExplanation, } from "./resource-translation.js";
226
+ export { PAYMENT_CONFIRM_VERSION, preCheckPaymentCreation, canCreatePayment, formatPaymentCreationSummary, type ConfirmSeverity as PaymentConfirmSeverity, type PaymentConfirmItem, type PaymentCreationCheckInput, } from "./payment-confirm.js";
227
+ export { PAYMENT_TRANSLATION_VERSION, SEMANTIC_TO_PAYMENT_SCHEMA_RULES, PAYMENT_FIELD_TRANSLATIONS, PAYMENT_CONSTRAINT_RULES, explainPayment, type SemanticToPaymentSchemaRule, type PaymentFieldTranslation, type PaymentConstraintRule, type PaymentExplainInput, type PaymentExplanation, } from "./payment-translation.js";
228
+ export { ARB_CONFIRM_VERSION, preCheckArbOp, canProceedArbOp, formatArbOpSummary, type ConfirmSeverity as ArbConfirmSeverity, type ArbConfirmItem, type ArbOpCheckInput, } from "./arb-confirm.js";
229
+ export { ARB_TRANSLATION_VERSION, ARB_STATUS, SEMANTIC_TO_ARB_SCHEMA_RULES, ARB_FIELD_TRANSLATIONS, ARB_CONSTRAINT_RULES, explainArb, type SemanticToArbSchemaRule, type ArbFieldTranslation, type ArbConstraintRule, type ArbExplainInput, type ArbExplanation, } from "./arb-translation.js";
230
+ export { UTIL_CONFIRM_VERSION, preCheckUtilCall, canProceedUtilCall, formatUtilCallSummary, type ConfirmSeverity as UtilConfirmSeverity, type UtilConfirmItem, type UtilCallCheckInput, } from "./util-confirm.js";
231
+ export { UTIL_TRANSLATION_VERSION, UTIL_ADDRESS_BYTES, SEMANTIC_TO_UTIL_SCHEMA_RULES, UTIL_FIELD_TRANSLATIONS, UTIL_CONSTRAINT_RULES, explainUtil, type SemanticToUtilSchemaRule, type UtilFieldTranslation, type UtilConstraintRule, type UtilExplainInput, type UtilExplanation, } from "./util-translation.js";
232
+ export { REGISTRAR_CONFIRM_VERSION, preCheckRegistrarOp, canProceedRegistrarOp, formatRegistrarOpSummary, type ConfirmSeverity as RegistrarConfirmSeverity, type RegistrarConfirmItem, type RegistrarOpCheckInput, } from "./registrar-confirm.js";
233
+ export { REGISTRAR_TRANSLATION_VERSION, SEMANTIC_TO_REGISTRAR_SCHEMA_RULES, REGISTRAR_FIELD_TRANSLATIONS, REGISTRAR_CONSTRAINT_RULES, explainRegistrar, type SemanticToRegistrarSchemaRule, type RegistrarFieldTranslation, type RegistrarConstraintRule, type RegistrarExplainInput, type RegistrarExplanation, } from "./registrar-translation.js";
234
+ export { BRIDGE_CONFIRM_VERSION, preCheckBridgeOp, canProceedBridgeOp, formatBridgeOpSummary, type ConfirmSeverity as BridgeConfirmSeverity, type BridgeConfirmItem, type BridgeOpCheckInput, } from "./bridge-confirm.js";
235
+ export { BRIDGE_TRANSLATION_VERSION, SEMANTIC_TO_BRIDGE_SCHEMA_RULES, BRIDGE_FIELD_TRANSLATIONS, BRIDGE_CONSTRAINT_RULES, explainBridge, type SemanticToBridgeSchemaRule, type BridgeFieldTranslation, type BridgeConstraintRule, type BridgeExplainInput, type BridgeExplanation, } from "./bridge-translation.js";
208
236
  export { TOOLS_REFERENCE, getToolReference, searchToolReference, getToolSequence, type ToolReferenceEntry, };
209
237
  export { SCENARIO_MODES, SCENARIO_MODES_VERSION, MODE_COMPOSITIONS, matchScenarioMode, inferScenarioTraits, getScenarioMode, listScenarioModes, getShippedModes, getModeCompositions, type IndustryModeName, type ScenarioTraits, type ModeAllocatorStrategy, type ModeGuardRef, type ModeMachineNode, type ScenarioMode, type ModeComposition, };
210
238
  export { GUARD_DESIGN_PATTERNS, GUARD_DESIGN_PATTERNS_VERSION, VERIFIER_LEVEL_GUIDANCE, getGuardDesignPattern, searchGuardDesignPatterns, getPatternsByHost, getPatternsByIndustry, getPatternsByDataSourceClass, getVerifierLevelGuidance, suggestPatternForRequirement, type GuardDataSourceClass, type VerifierConstraintLevel, type GuardHostObject, type GuardDesignPattern, type VerifierLevelGuidance, };
@@ -217,7 +245,6 @@ export declare function getKnowledgeBase(): {
217
245
  safety: number;
218
246
  tool_constraints: number;
219
247
  process_model: number;
220
- arbitration_trust: number;
221
248
  reward_templates: number;
222
249
  audit_rules: number;
223
250
  demand_matching: number;
@@ -284,6 +311,18 @@ export declare function getKnowledgeBase(): {
284
311
  passport_translation: string;
285
312
  passport_templates: string;
286
313
  passport_context: string;
314
+ proof_ledger: string;
315
+ proof_puzzle: string;
316
+ proof_templates: string;
317
+ proof_context: string;
318
+ repository_ledger: string;
319
+ repository_puzzle: string;
320
+ repository_templates: string;
321
+ repository_context: string;
322
+ demand_ledger: string;
323
+ demand_puzzle: string;
324
+ demand_templates: string;
325
+ demand_context: string;
287
326
  contact_risk: string;
288
327
  resource_risk: string;
289
328
  payment_risk: string;
@@ -292,6 +331,22 @@ export declare function getKnowledgeBase(): {
292
331
  util_risk: string;
293
332
  registrar_risk: string;
294
333
  bridge_risk: string;
334
+ contact_confirm: string;
335
+ contact_translation: string;
336
+ personal_confirm: string;
337
+ personal_translation: string;
338
+ resource_confirm: string;
339
+ resource_translation: string;
340
+ payment_confirm: string;
341
+ payment_translation: string;
342
+ arb_confirm: string;
343
+ arb_translation: string;
344
+ util_confirm: string;
345
+ util_translation: string;
346
+ registrar_confirm: string;
347
+ registrar_translation: string;
348
+ bridge_confirm: string;
349
+ bridge_translation: string;
295
350
  scenario_modes: number;
296
351
  guard_design_patterns: number;
297
352
  };
@@ -406,10 +461,22 @@ export declare function getKnowledgeBase(): {
406
461
  passport_context_enabled: boolean;
407
462
  proof_risk_rules_count: number;
408
463
  proof_constraint_rules_count: number;
464
+ proof_fields_count: number;
465
+ proof_error_codes_count: number;
466
+ proof_scenes_count: number;
467
+ proof_templates_count: number;
409
468
  repository_risk_rules_count: number;
410
469
  repository_constraint_rules_count: number;
470
+ repository_id_from_count: number;
471
+ repository_policy_fields_count: number;
472
+ repository_error_codes_count: number;
473
+ repository_templates_count: number;
411
474
  demand_risk_rules_count: number;
412
475
  demand_constraint_rules_count: number;
476
+ demand_scenes_count: number;
477
+ demand_fields_count: number;
478
+ demand_error_codes_count: number;
479
+ demand_templates_count: number;
413
480
  contact_risk_rules_count: number;
414
481
  resource_risk_rules_count: number;
415
482
  payment_risk_rules_count: number;
@@ -424,3 +491,4 @@ export declare function getKnowledgeBase(): {
424
491
  guard_design_patterns_count: number;
425
492
  verifier_level_guidance_count: number;
426
493
  };
494
+ export { fetchMachineNodes, buildWorkflowGuidance, buildWorkflowReceipt, enrichWorkflowGuidance, mergeGuidanceIntoOutput, resolvePermissionRole, type GuidanceResult, type ReceiptResult, type ParsedMachineNode, type ParsedPair, type ParsedForward, };