@wowok/agent-mcp 2.7.1 → 2.7.2

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 (375) hide show
  1. package/dist/config/index.js +1 -1
  2. package/dist/config/runtime.js +1 -238
  3. package/dist/customer/customer-advice.js +1 -130
  4. package/dist/customer/index.js +1 -11
  5. package/dist/customer/industry-risks.js +1 -438
  6. package/dist/customer/info-puzzle.js +1 -681
  7. package/dist/customer/order-monitor.js +1 -328
  8. package/dist/customer/order-strategy.js +1 -373
  9. package/dist/customer/post-purchase.js +1 -351
  10. package/dist/customer/preorder-compare.js +1 -34
  11. package/dist/customer/reminder-system.js +1 -316
  12. package/dist/customer/risk-assessment.js +1 -397
  13. package/dist/customer/types.js +1 -13
  14. package/dist/customer/user-preferences.js +1 -460
  15. package/dist/evaluation/arbitration-game.d.ts +9 -2
  16. package/dist/evaluation/arbitration-game.js +1 -48
  17. package/dist/evaluation/builtins/demand-match.js +1 -153
  18. package/dist/evaluation/builtins/index.js +1 -10
  19. package/dist/evaluation/builtins/service-risk.js +1 -55
  20. package/dist/evaluation/capability.js +1 -13
  21. package/dist/evaluation/composer.js +1 -40
  22. package/dist/evaluation/engine.js +1 -175
  23. package/dist/evaluation/extract.js +1 -115
  24. package/dist/evaluation/game-strategy.d.ts +27 -0
  25. package/dist/evaluation/game-strategy.js +1 -0
  26. package/dist/evaluation/gap.js +1 -100
  27. package/dist/evaluation/index.d.ts +1 -0
  28. package/dist/evaluation/index.js +1 -11
  29. package/dist/evaluation/node-game.d.ts +31 -3
  30. package/dist/evaluation/node-game.js +1 -57
  31. package/dist/evaluation/region.js +1 -36
  32. package/dist/evaluation/types.d.ts +1 -0
  33. package/dist/evaluation/types.js +1 -1
  34. package/dist/evaluation/user-injection.js +1 -27
  35. package/dist/experience/experience-reuse.js +1 -103
  36. package/dist/experience/index.js +1 -5
  37. package/dist/experience/intent-distill.js +1 -83
  38. package/dist/experience/realtime-feedback.js +1 -94
  39. package/dist/experience/types.js +1 -1
  40. package/dist/experience/user-profile.js +1 -171
  41. package/dist/extensions/business-modules.js +1 -287
  42. package/dist/extensions/capability-manifest.js +1 -781
  43. package/dist/extensions/constraint-registry.js +1 -198
  44. package/dist/extensions/index.js +1 -6
  45. package/dist/extensions/metric-registry.js +1 -257
  46. package/dist/extensions/mode-evaluator.js +1 -170
  47. package/dist/extensions/modes.js +1 -499
  48. package/dist/extensions/registry.js +1 -717
  49. package/dist/extensions/types.js +1 -1
  50. package/dist/harness/auto-escalation.js +1 -68
  51. package/dist/harness/checkpoint.js +1 -129
  52. package/dist/harness/index.js +1 -78
  53. package/dist/harness/plan.js +1 -315
  54. package/dist/harness/recover.js +1 -139
  55. package/dist/harness/types.js +1 -1
  56. package/dist/harness/verify.js +1 -237
  57. package/dist/index.js +1 -273
  58. package/dist/intent/enrich.js +1 -67
  59. package/dist/intent/index.js +1 -60
  60. package/dist/intent/matcher.js +1 -81
  61. package/dist/intent/store.js +1 -55
  62. package/dist/intent/types.js +1 -10
  63. package/dist/knowledge/acquisition-flywheel.js +1 -192
  64. package/dist/knowledge/allocation-confirm.js +1 -534
  65. package/dist/knowledge/allocation-context.js +1 -249
  66. package/dist/knowledge/allocation-ledger.js +1 -463
  67. package/dist/knowledge/allocation-puzzle.js +1 -298
  68. package/dist/knowledge/allocation-risk.js +1 -568
  69. package/dist/knowledge/allocation-templates.js +1 -970
  70. package/dist/knowledge/allocation-translation.js +1 -585
  71. package/dist/knowledge/arb-risk.js +1 -210
  72. package/dist/knowledge/arbitration-confirm.js +1 -559
  73. package/dist/knowledge/arbitration-context.js +1 -505
  74. package/dist/knowledge/arbitration-ledger.js +1 -521
  75. package/dist/knowledge/arbitration-puzzle.js +1 -304
  76. package/dist/knowledge/arbitration-risk.js +1 -423
  77. package/dist/knowledge/arbitration-templates.js +1 -276
  78. package/dist/knowledge/arbitration-translation.js +1 -487
  79. package/dist/knowledge/arbitration-trust.js +1 -117
  80. package/dist/knowledge/audit-rules.js +1 -141
  81. package/dist/knowledge/bridge-risk.js +1 -263
  82. package/dist/knowledge/contact-risk.js +1 -200
  83. package/dist/knowledge/contact-templates.js +1 -60
  84. package/dist/knowledge/demand-confirm.js +1 -206
  85. package/dist/knowledge/demand-matching.js +1 -132
  86. package/dist/knowledge/demand-risk.js +1 -240
  87. package/dist/knowledge/demand-translation.js +1 -354
  88. package/dist/knowledge/deployment-scanner.js +1 -823
  89. package/dist/knowledge/dynamic-pricing.js +1 -87
  90. package/dist/knowledge/examples-scanner-cli.js +1 -26
  91. package/dist/knowledge/examples-scanner.js +1 -843
  92. package/dist/knowledge/flywheel-loop.js +1 -404
  93. package/dist/knowledge/fund-layer.js +1 -973
  94. package/dist/knowledge/glossary.js +1 -211
  95. package/dist/knowledge/guard-confirm.js +1 -406
  96. package/dist/knowledge/guard-context.js +1 -287
  97. package/dist/knowledge/guard-design-patterns.js +1 -360
  98. package/dist/knowledge/guard-ledger.js +1 -260
  99. package/dist/knowledge/guard-lint.js +1 -670
  100. package/dist/knowledge/guard-migration.js +1 -228
  101. package/dist/knowledge/guard-puzzle.js +1 -805
  102. package/dist/knowledge/guard-render.js +1 -700
  103. package/dist/knowledge/guard-risk.js +1 -1879
  104. package/dist/knowledge/guard-submission-prompt.js +1 -171
  105. package/dist/knowledge/guard-templates.js +1 -1105
  106. package/dist/knowledge/guard-translation.js +1 -1119
  107. package/dist/knowledge/index.js +1 -436
  108. package/dist/knowledge/industry-evolution.js +1 -323
  109. package/dist/knowledge/industry-generalizer.js +1 -381
  110. package/dist/knowledge/industry-registry.js +1 -174
  111. package/dist/knowledge/intent-metrics.d.ts +4 -3
  112. package/dist/knowledge/intent-metrics.js +1 -566
  113. package/dist/knowledge/machine-confirm.js +1 -559
  114. package/dist/knowledge/machine-context.js +1 -833
  115. package/dist/knowledge/machine-ledger.js +1 -338
  116. package/dist/knowledge/machine-puzzle.js +1 -494
  117. package/dist/knowledge/machine-render.js +1 -565
  118. package/dist/knowledge/machine-risk.js +1 -669
  119. package/dist/knowledge/machine-templates.js +1 -1597
  120. package/dist/knowledge/machine-topology.js +1 -234
  121. package/dist/knowledge/machine-translation.js +1 -513
  122. package/dist/knowledge/mcp-schema-audit-cli.js +1 -45
  123. package/dist/knowledge/mcp-schema-audit.js +1 -777
  124. package/dist/knowledge/onchain-constants.js +1 -35
  125. package/dist/knowledge/order-confirm.js +1 -573
  126. package/dist/knowledge/order-context.js +1 -390
  127. package/dist/knowledge/order-ledger.js +1 -341
  128. package/dist/knowledge/order-puzzle.js +1 -255
  129. package/dist/knowledge/order-risk.js +1 -653
  130. package/dist/knowledge/order-templates.js +1 -368
  131. package/dist/knowledge/order-translation.js +1 -550
  132. package/dist/knowledge/overrides-loader.js +1 -65
  133. package/dist/knowledge/passport-confirm.js +1 -531
  134. package/dist/knowledge/passport-context.js +1 -306
  135. package/dist/knowledge/passport-ledger.js +1 -282
  136. package/dist/knowledge/passport-puzzle.js +1 -333
  137. package/dist/knowledge/passport-risk.js +1 -450
  138. package/dist/knowledge/passport-templates.js +1 -568
  139. package/dist/knowledge/passport-translation.js +1 -516
  140. package/dist/knowledge/payment-risk.js +1 -249
  141. package/dist/knowledge/permission-confirm.js +1 -426
  142. package/dist/knowledge/permission-context.js +1 -224
  143. package/dist/knowledge/permission-ledger.js +1 -403
  144. package/dist/knowledge/permission-puzzle.js +1 -173
  145. package/dist/knowledge/permission-risk.js +1 -411
  146. package/dist/knowledge/permission-templates.js +1 -234
  147. package/dist/knowledge/permission-translation.js +1 -350
  148. package/dist/knowledge/personal-risk.js +1 -212
  149. package/dist/knowledge/process-model.js +1 -160
  150. package/dist/knowledge/progress-confirm.js +1 -456
  151. package/dist/knowledge/progress-context.js +1 -452
  152. package/dist/knowledge/progress-ledger.js +1 -330
  153. package/dist/knowledge/progress-puzzle.js +1 -219
  154. package/dist/knowledge/progress-risk.js +1 -461
  155. package/dist/knowledge/progress-templates.js +1 -228
  156. package/dist/knowledge/progress-translation.js +1 -405
  157. package/dist/knowledge/proof-confirm.js +1 -187
  158. package/dist/knowledge/proof-risk.js +1 -207
  159. package/dist/knowledge/proof-translation.js +1 -283
  160. package/dist/knowledge/registrar-risk.js +1 -217
  161. package/dist/knowledge/repository-confirm.js +1 -286
  162. package/dist/knowledge/repository-risk.js +1 -373
  163. package/dist/knowledge/repository-translation.js +1 -445
  164. package/dist/knowledge/reputation-rules.js +1 -99
  165. package/dist/knowledge/resource-risk.js +1 -157
  166. package/dist/knowledge/reward-confirm.js +1 -526
  167. package/dist/knowledge/reward-context.js +1 -504
  168. package/dist/knowledge/reward-ledger.js +1 -502
  169. package/dist/knowledge/reward-puzzle.js +1 -300
  170. package/dist/knowledge/reward-risk.js +1 -627
  171. package/dist/knowledge/reward-templates.js +1 -197
  172. package/dist/knowledge/reward-translation.js +1 -501
  173. package/dist/knowledge/safety-rules.js +1 -404
  174. package/dist/knowledge/scenario-modes.js +1 -321
  175. package/dist/knowledge/service-confirm.js +1 -807
  176. package/dist/knowledge/service-context.js +1 -403
  177. package/dist/knowledge/service-ledger.js +1 -609
  178. package/dist/knowledge/service-puzzle.js +1 -236
  179. package/dist/knowledge/service-risk.js +1 -651
  180. package/dist/knowledge/service-templates.js +1 -456
  181. package/dist/knowledge/service-translation.js +1 -622
  182. package/dist/knowledge/template-registry.js +1 -353
  183. package/dist/knowledge/tool-constraints.js +1 -195
  184. package/dist/knowledge/tools-reference.js +1 -178
  185. package/dist/knowledge/treasury-confirm.js +1 -512
  186. package/dist/knowledge/treasury-context.js +1 -363
  187. package/dist/knowledge/treasury-ledger.js +1 -300
  188. package/dist/knowledge/treasury-puzzle.js +1 -216
  189. package/dist/knowledge/treasury-risk.js +1 -440
  190. package/dist/knowledge/treasury-templates.js +1 -358
  191. package/dist/knowledge/treasury-translation.js +1 -498
  192. package/dist/knowledge/trust-metrics.js +1 -198
  193. package/dist/knowledge/util-risk.js +1 -135
  194. package/dist/loop-engineering/aggregate.js +1 -132
  195. package/dist/loop-engineering/context-collect.js +1 -83
  196. package/dist/loop-engineering/diagnose.js +1 -273
  197. package/dist/loop-engineering/improve.js +1 -405
  198. package/dist/loop-engineering/index.js +1 -4
  199. package/dist/loop-engineering/pipeline.js +1 -56
  200. package/dist/mode-market/index.js +1 -3
  201. package/dist/mode-market/registry.js +1 -124
  202. package/dist/mode-market/review.js +1 -214
  203. package/dist/mode-market/submission.js +1 -85
  204. package/dist/participation/collaborator-interest.d.ts +23 -0
  205. package/dist/participation/collaborator-interest.js +1 -0
  206. package/dist/participation/customer-interest.d.ts +25 -0
  207. package/dist/participation/customer-interest.js +1 -0
  208. package/dist/participation/merchant-interest.js +1 -100
  209. package/dist/participation/radar-core.d.ts +13 -3
  210. package/dist/participation/radar-core.js +1 -269
  211. package/dist/participation/supplier-interest.d.ts +25 -0
  212. package/dist/participation/supplier-interest.js +1 -0
  213. package/dist/persona/analyzer.js +1 -66
  214. package/dist/persona/bridge.js +1 -86
  215. package/dist/persona/defaults.js +1 -195
  216. package/dist/persona/experience-bridge.js +1 -23
  217. package/dist/persona/index.js +1 -71
  218. package/dist/persona/model.js +1 -111
  219. package/dist/persona/store.js +1 -62
  220. package/dist/persona/types.d.ts +3 -1
  221. package/dist/persona/types.js +1 -5
  222. package/dist/project/business-puzzle.js +1 -383
  223. package/dist/project/context-assembly.js +1 -254
  224. package/dist/project/deployment-bridge.js +1 -120
  225. package/dist/project/deployment-doc.js +1 -1126
  226. package/dist/project/edit-planner.js +1 -1342
  227. package/dist/project/evaluation.js +1 -2011
  228. package/dist/project/game-theory.js +1 -177
  229. package/dist/project/graph-builder.js +1 -656
  230. package/dist/project/graph.js +1 -340
  231. package/dist/project/handlers.js +1 -1784
  232. package/dist/project/index.d.ts +1 -0
  233. package/dist/project/index.js +1 -301
  234. package/dist/project/intent-analyzer.js +1 -149
  235. package/dist/project/machine-nodes.js +1 -36
  236. package/dist/project/merchant-guide.js +1 -264
  237. package/dist/project/migration.js +1 -125
  238. package/dist/project/mode-actions.js +1 -309
  239. package/dist/project/namespace.js +1 -206
  240. package/dist/project/participation-radar.js +1 -428
  241. package/dist/project/pipeline-actions.js +1 -109
  242. package/dist/project/project-store.js +1 -422
  243. package/dist/project/query.js +1 -153
  244. package/dist/project/reverse-mapping.d.ts +34 -0
  245. package/dist/project/reverse-mapping.js +1 -0
  246. package/dist/project/risk-aggregator.js +1 -295
  247. package/dist/project/rollback-policy.js +1 -290
  248. package/dist/project/semantic-assembler.js +1 -345
  249. package/dist/project/semantic-graph.js +1 -292
  250. package/dist/project/stage-gate.js +1 -369
  251. package/dist/project/substep-trace.js +1 -332
  252. package/dist/project/task-tracker.js +1 -78
  253. package/dist/role/derivation.d.ts +18 -0
  254. package/dist/role/derivation.js +1 -0
  255. package/dist/role/index.d.ts +5 -0
  256. package/dist/role/index.js +1 -0
  257. package/dist/role/model.d.ts +8 -0
  258. package/dist/role/model.js +1 -0
  259. package/dist/role/resolution.d.ts +11 -0
  260. package/dist/role/resolution.js +1 -0
  261. package/dist/role/types.d.ts +11 -0
  262. package/dist/role/types.js +1 -0
  263. package/dist/rules.js +1 -52
  264. package/dist/safety/confirm-gate.js +1 -88
  265. package/dist/safety/index.js +1 -3
  266. package/dist/safety/preview.js +1 -52
  267. package/dist/schema/call/allocation.js +1 -34
  268. package/dist/schema/call/arbitration.js +1 -113
  269. package/dist/schema/call/base.d.ts +15 -15
  270. package/dist/schema/call/base.js +1 -370
  271. package/dist/schema/call/bridge-handler.js +1 -265
  272. package/dist/schema/call/bridge.d.ts +7 -7
  273. package/dist/schema/call/bridge.js +1 -458
  274. package/dist/schema/call/contact.js +1 -37
  275. package/dist/schema/call/demand.js +1 -47
  276. package/dist/schema/call/guard.js +1 -161
  277. package/dist/schema/call/handler.js +1 -322
  278. package/dist/schema/call/index.js +1 -20
  279. package/dist/schema/call/machine.js +1 -193
  280. package/dist/schema/call/order.js +1 -35
  281. package/dist/schema/call/payment.js +1 -37
  282. package/dist/schema/call/permission-handler.js +1 -54
  283. package/dist/schema/call/permission.js +1 -105
  284. package/dist/schema/call/personal.js +1 -78
  285. package/dist/schema/call/progress.js +1 -47
  286. package/dist/schema/call/proof.js +1 -33
  287. package/dist/schema/call/repository.js +1 -77
  288. package/dist/schema/call/reward.js +1 -30
  289. package/dist/schema/call/semantic.js +1 -1679
  290. package/dist/schema/call/service.js +1 -184
  291. package/dist/schema/call/treasury.js +1 -71
  292. package/dist/schema/common/index.js +1 -407
  293. package/dist/schema/config/index.js +1 -68
  294. package/dist/schema/evaluation/index.d.ts +213 -16
  295. package/dist/schema/evaluation/index.js +1 -356
  296. package/dist/schema/index.js +1 -17
  297. package/dist/schema/intent-radar/index.d.ts +13 -13
  298. package/dist/schema/intent-radar/index.js +1 -89
  299. package/dist/schema/local/index.d.ts +21 -21
  300. package/dist/schema/local/index.js +1 -927
  301. package/dist/schema/local/wip.js +1 -187
  302. package/dist/schema/messenger/index.d.ts +7 -7
  303. package/dist/schema/messenger/index.js +1 -475
  304. package/dist/schema/operations.d.ts +7 -7
  305. package/dist/schema/operations.js +1 -520
  306. package/dist/schema/persona/index.d.ts +54 -54
  307. package/dist/schema/persona/index.js +1 -148
  308. package/dist/schema/project/index.d.ts +94 -48
  309. package/dist/schema/project/index.js +1 -2057
  310. package/dist/schema/query/index.d.ts +423 -7
  311. package/dist/schema/query/index.js +1 -1646
  312. package/dist/schema/schema-query/index.js +1 -104
  313. package/dist/schema/schema-version.js +1 -76
  314. package/dist/schema/sync-layer4.js +1 -286
  315. package/dist/schema/task-status.js +1 -36
  316. package/dist/schema/trust/index.js +1 -314
  317. package/dist/schema/utils/guard-parser.js +1 -419
  318. package/dist/schema/utils/guard-query-utils.js +1 -46
  319. package/dist/schema/utils/node-parser.js +1 -369
  320. package/dist/schema/utils/object-type-utils.js +1 -35
  321. package/dist/schema/utils/permission-index-utils.js +1 -7
  322. package/dist/schema/utils/permission-machine-check.js +1 -121
  323. package/dist/schema/utils/skills-recommendation.js +1 -77
  324. package/dist/schema-query/index.js +1 -810
  325. package/dist/schemas/account_operation.output.json +5 -2
  326. package/dist/schemas/bridge_operation.output.json +5 -2
  327. package/dist/schemas/evaluation_operation.output.json +112 -7
  328. package/dist/schemas/evaluation_operation.schema.json +93 -6
  329. package/dist/schemas/index.json +1 -1
  330. package/dist/schemas/intent_radar.output.json +4 -1
  331. package/dist/schemas/intent_radar.schema.json +4 -1
  332. package/dist/schemas/local_info_operation.output.json +5 -2
  333. package/dist/schemas/local_mark_operation.output.json +5 -2
  334. package/dist/schemas/messenger_operation.output.json +5 -2
  335. package/dist/schemas/onchain_events.output.json +5 -2
  336. package/dist/schemas/onchain_operations.output.json +5 -2
  337. package/dist/schemas/onchain_operations.schema.json +4 -4
  338. package/dist/schemas/onchain_operations_allocation.schema.json +1 -1
  339. package/dist/schemas/onchain_operations_machine.schema.json +2 -2
  340. package/dist/schemas/onchain_operations_service.schema.json +1 -1
  341. package/dist/schemas/onchain_table_data.output.json +6 -3
  342. package/dist/schemas/persona_operation.output.json +4 -1
  343. package/dist/schemas/persona_operation.schema.json +4 -1
  344. package/dist/schemas/project_operation.output.json +28 -8
  345. package/dist/schemas/query_toolkit.output.json +8 -5
  346. package/dist/schemas/wowok_buildin_info.output.json +132 -0
  347. package/dist/schemas/wowok_buildin_info.schema.json +14 -0
  348. package/dist/telemetry/index.js +1 -112
  349. package/dist/telemetry/redact.js +1 -23
  350. package/dist/telemetry/storage.js +1 -80
  351. package/dist/tools/handlers/bridge.js +1 -1
  352. package/dist/tools/handlers/config.js +1 -74
  353. package/dist/tools/handlers/evaluation.js +1 -123
  354. package/dist/tools/handlers/file-export.js +1 -90
  355. package/dist/tools/handlers/intent-radar.js +1 -76
  356. package/dist/tools/handlers/local.js +1 -53
  357. package/dist/tools/handlers/messenger.js +1 -188
  358. package/dist/tools/handlers/onchain.js +1 -1180
  359. package/dist/tools/handlers/persona.js +1 -89
  360. package/dist/tools/handlers/project.js +1 -211
  361. package/dist/tools/handlers/query.js +1 -434
  362. package/dist/tools/handlers/schema-query.js +1 -176
  363. package/dist/tools/handlers/task-status.js +1 -26
  364. package/dist/tools/handlers/trust.js +1 -380
  365. package/dist/tools/handlers/wip.js +1 -90
  366. package/dist/tools/index.js +1 -1382
  367. package/dist/tools/retry.js +1 -85
  368. package/dist/tools/rules-hook.js +1 -23
  369. package/dist/tools/shared.js +1 -130
  370. package/dist/tools/types.js +1 -1
  371. package/dist/tools/upgrade-check.d.ts +19 -0
  372. package/dist/tools/upgrade-check.js +1 -0
  373. package/dist/tools/wip-deploy-assist.js +1 -306
  374. package/dist/tools/wrap.js +1 -500
  375. package/package.json +4 -2
@@ -1,200 +1 @@
1
- import { MAX_IM_COUNT } from "@wowok/wowok";
2
- const R_C_01 = {
3
- rule: {
4
- id: "R-CONTACT-01",
5
- level: "MEDIUM",
6
- category: "permission",
7
- title: "change_status has no permission check — IM list pollution risk",
8
- description: "change_status lets any IM member self-update their status string without Permission " +
9
- "verification (contact.move:32-43). If an attacker's address is added to the ims list " +
10
- "(via im_add, which requires permission index 453), the attacker can freely pollute " +
11
- "their status field (e.g. set status to 'fraud'). The risk is bounded by the im_add " +
12
- "permission gate, but a misconfigured Permission could expose the IM list.",
13
- affected_stakeholders: ["creator", "im_member"],
14
- scenario: "Contact's IM list is misconfigured to allow public adds; attacker pollutes status",
15
- mitigation: "Restrict permission index 453 (CONTACT_IM) to trusted guardians. Audit the IM list " +
16
- "periodically. Business layer may validate status strings against an allowlist.",
17
- auto_fixable: false,
18
- },
19
- check: (ctx) => {
20
- if (!ctx.change_status_no_permission)
21
- return null;
22
- return { ...R_C_01.rule, evidence: "change_status_no_permission=true" };
23
- },
24
- };
25
- const R_C_02 = {
26
- rule: {
27
- id: "R-CONTACT-02",
28
- level: "LOW",
29
- category: "structural",
30
- title: `MAX_IM_COUNT=${MAX_IM_COUNT} is permissive — on-chain storage cost`,
31
- description: `A single Contact may hold up to MAX_IM_COUNT=${MAX_IM_COUNT} IM entries (contact.move:14). ` +
32
- `Aborting with E_IM_COUNT_EXCEEDED (1) only triggers at the boundary. 200 entries is ` +
33
- `relatively permissive for a social scenario; loading the full list on every read ` +
34
- `increases gas and storage cost.`,
35
- affected_stakeholders: ["creator"],
36
- scenario: "Caller adds 200 IM entries to a single Contact",
37
- mitigation: "Business layer should self-limit IM count well below 200. For high-volume contact " +
38
- "lists, shard across multiple Contact objects and aggregate off-chain.",
39
- related_move_error: "E_IM_COUNT_EXCEEDED (1)",
40
- auto_fixable: false,
41
- },
42
- check: (ctx) => {
43
- if (ctx.im_count === undefined)
44
- return null;
45
- if (ctx.im_count < MAX_IM_COUNT)
46
- return null;
47
- return { ...R_C_02.rule, evidence: `im_count=${ctx.im_count}, limit=${MAX_IM_COUNT}` };
48
- },
49
- };
50
- const R_C_03 = {
51
- rule: {
52
- id: "R-CONTACT-03",
53
- level: "MEDIUM",
54
- category: "semantic",
55
- title: "IM list mutations emit no events — external indexers must poll",
56
- description: "im_add / im_remove / im_clear do not emit events (contact.move:70-100). External " +
57
- "indexers and notification systems cannot rely on event streams to track IM list " +
58
- "changes; they must poll the ims field directly, increasing latency and RPC cost.",
59
- affected_stakeholders: ["creator", "consumer"],
60
- scenario: "Indexer expects an event on im_add but none is emitted; UI fails to refresh",
61
- mitigation: "External indexers should poll the Contact.ims field on a cadence. A future version " +
62
- "may add IMEvent; until then, do not build critical UX on IM event streams.",
63
- auto_fixable: false,
64
- },
65
- check: (ctx) => null,
66
- };
67
- const R_C_04 = {
68
- rule: {
69
- id: "R-CONTACT-04",
70
- level: "LOW",
71
- category: "semantic",
72
- title: "location defaults to empty string — may be misread as 'unset'",
73
- description: "A freshly created Contact has location=\"\" (empty String). The Move type does not " +
74
- "distinguish 'unset' from 'empty', so consumers may misinterpret an empty location " +
75
- "as 'globally applicable' or as 'missing data'.",
76
- affected_stakeholders: ["creator", "consumer"],
77
- scenario: "Consumer reads location=\"\" and treats the Contact as global when it was never set",
78
- mitigation: "Document that empty location means 'not specified'. If a default region is required, " +
79
- "set location explicitly at creation time.",
80
- auto_fixable: true,
81
- },
82
- check: (ctx) => {
83
- if (!ctx.location_empty)
84
- return null;
85
- return { ...R_C_04.rule, evidence: "location=\"\" (empty, default)" };
86
- },
87
- };
88
- const R_C_05 = {
89
- rule: {
90
- id: "R-CONTACT-05",
91
- level: "MEDIUM",
92
- category: "lifecycle",
93
- title: "my_status silently fails for non-IM-members",
94
- description: "my_status only updates the caller's status entry if the caller is in the ims list " +
95
- "(contact.move:35-42). For a non-IM-member, the call silently succeeds without any " +
96
- "state change — there is no abort and no event. Users get no feedback, making it " +
97
- "impossible to distinguish 'status updated' from 'operation ignored'.",
98
- affected_stakeholders: ["im_member"],
99
- scenario: "Non-IM-member calls my_status expecting an error; operation is silently ignored",
100
- mitigation: "SDK layer should pre-validate IM membership before submitting my_status and return a " +
101
- "clear error. UI should show 'not an IM member' instead of 'success'.",
102
- auto_fixable: false,
103
- },
104
- check: (ctx) => {
105
- if (!ctx.my_status_from_non_member)
106
- return null;
107
- return { ...R_C_05.rule, evidence: "my_status_from_non_member=true (will be silently ignored)" };
108
- },
109
- };
110
- const R_C_06 = {
111
- rule: {
112
- id: "R-CONTACT-06",
113
- level: "LOW",
114
- category: "semantic",
115
- title: "im_add description uses LONG_NAME (not DESCRIPTION) — different length cap",
116
- description: "im_add's description parameter is validated with common::LONG_NAME rather than " +
117
- "common::DESCRIPTION (contact.move:70-86). The two validators have different length " +
118
- "limits; callers expecting DESCRIPTION semantics may submit overly long strings and " +
119
- "hit an unexpected abort.",
120
- affected_stakeholders: ["creator"],
121
- scenario: "Caller submits an im_add description sized for DESCRIPTION but hits LONG_NAME limit",
122
- mitigation: "Document that im_add description uses LONG_NAME validation. SDK should expose the " +
123
- "exact limit so callers size their strings correctly.",
124
- auto_fixable: false,
125
- },
126
- check: (ctx) => {
127
- if (!ctx.im_add_description_uses_long_name)
128
- return null;
129
- return { ...R_C_06.rule, evidence: "im_add description validated with LONG_NAME" };
130
- },
131
- };
132
- const R_C_07 = {
133
- rule: {
134
- id: "R-CONTACT-07",
135
- level: "MEDIUM",
136
- category: "cross_object",
137
- title: "permission_um_set creates Contact ↔ Permission bidirectional dependency",
138
- description: "When Contact is set as a Permission's um via permission_um_set (contact.move:207-209), " +
139
- "a bidirectional dependency forms: Permission.um → Contact, and Contact.permission → " +
140
- "Permission. Deleting the Contact without first clearing the um reference leaves a " +
141
- "dangling pointer in Permission.um.",
142
- affected_stakeholders: ["creator", "consumer"],
143
- scenario: "Contact is deleted while still bound as Permission.um; Permission.um becomes dangling",
144
- mitigation: "Document the deletion order: (1) clear Permission.um via permission_um_set(null) " +
145
- "first, (2) then delete the Contact. SDK should refuse to delete a Contact that is " +
146
- "still bound as a um.",
147
- auto_fixable: false,
148
- },
149
- check: (ctx) => {
150
- if (!ctx.bound_to_permission_um)
151
- return null;
152
- return { ...R_C_07.rule, evidence: "bound_to_permission_um=true (deletion requires unbinding)" };
153
- },
154
- };
155
- const R_C_08 = {
156
- rule: {
157
- id: "R-CONTACT-08",
158
- level: "LOW",
159
- category: "knowledge",
160
- title: "Knowledge layer & constant sync — RESOLVED",
161
- description: `MAX_IM_COUNT is now synced to onchain-constants.ts (${MAX_IM_COUNT}). The MCP ` +
162
- `Knowledge layer now includes contact-risk.ts. This risk rule is retained for ` +
163
- `historical audit and to detect future regressions.`,
164
- affected_stakeholders: ["system"],
165
- scenario: "Future regression: someone removes MAX_IM_COUNT from onchain-constants.ts",
166
- mitigation: "Run the onchain-constants sync test to detect drift.",
167
- auto_fixable: false,
168
- },
169
- check: (ctx) => {
170
- if (ctx.constants_synced)
171
- return null;
172
- return { ...R_C_08.rule, evidence: "constants_synced=false" };
173
- },
174
- };
175
- export const CONTACT_RISK_RULES = [
176
- R_C_01,
177
- R_C_02,
178
- R_C_03,
179
- R_C_04,
180
- R_C_05,
181
- R_C_06,
182
- R_C_07,
183
- R_C_08,
184
- ];
185
- export const CONTACT_RISK_VERSION = "1.0.0";
186
- export function checkContactRisks(ctx) {
187
- const risks = [];
188
- for (const rule of CONTACT_RISK_RULES) {
189
- const r = rule.check(ctx);
190
- if (r)
191
- risks.push(r);
192
- }
193
- if (!risks.find(r => r.id === "R-CONTACT-03")) {
194
- risks.push(R_C_03.rule);
195
- }
196
- return risks;
197
- }
198
- export function getContactRiskById(id) {
199
- return CONTACT_RISK_RULES.find(r => r.rule.id === id)?.rule;
200
- }
1
+ import{MAX_IM_COUNT}from'@wowok/wowok';const R_C_01={'rule':{'id':'R-CONTACT-01','level':'MEDIUM','category':'permission','title':'change_status\x20has\x20no\x20permission\x20check\x20—\x20IM\x20list\x20pollution\x20risk','description':'change_status\x20lets\x20any\x20IM\x20member\x20self-update\x20their\x20status\x20string\x20without\x20Permission\x20'+'verification\x20(contact.move:32-43).\x20If\x20an\x20attacker\x27s\x20address\x20is\x20added\x20to\x20the\x20ims\x20list\x20'+'(via\x20im_add,\x20which\x20requires\x20permission\x20index\x20453),\x20the\x20attacker\x20can\x20freely\x20pollute\x20'+'their\x20status\x20field\x20(e.g.\x20set\x20status\x20to\x20\x27fraud\x27).\x20The\x20risk\x20is\x20bounded\x20by\x20the\x20im_add\x20'+'permission\x20gate,\x20but\x20a\x20misconfigured\x20Permission\x20could\x20expose\x20the\x20IM\x20list.','affected_stakeholders':['creator','im_member'],'scenario':'Contact\x27s\x20IM\x20list\x20is\x20misconfigured\x20to\x20allow\x20public\x20adds;\x20attacker\x20pollutes\x20status','mitigation':'Restrict\x20permission\x20index\x20453\x20(CONTACT_IM)\x20to\x20trusted\x20guardians.\x20Audit\x20the\x20IM\x20list\x20'+'periodically.\x20Business\x20layer\x20may\x20validate\x20status\x20strings\x20against\x20an\x20allowlist.','auto_fixable':![]},'check':a=>{if(!a['change_status_no_permission'])return null;return{...R_C_01['rule'],'evidence':'change_status_no_permission=true'};}},R_C_02={'rule':{'id':'R-CONTACT-02','level':'LOW','category':'structural','title':'MAX_IM_COUNT='+MAX_IM_COUNT+'\x20is\x20permissive\x20—\x20on-chain\x20storage\x20cost','description':'A\x20single\x20Contact\x20may\x20hold\x20up\x20to\x20MAX_IM_COUNT='+MAX_IM_COUNT+'\x20IM\x20entries\x20(contact.move:14).\x20'+'Aborting\x20with\x20E_IM_COUNT_EXCEEDED\x20(1)\x20only\x20triggers\x20at\x20the\x20boundary.\x20200\x20entries\x20is\x20'+'relatively\x20permissive\x20for\x20a\x20social\x20scenario;\x20loading\x20the\x20full\x20list\x20on\x20every\x20read\x20'+'increases\x20gas\x20and\x20storage\x20cost.','affected_stakeholders':['creator'],'scenario':'Caller\x20adds\x20200\x20IM\x20entries\x20to\x20a\x20single\x20Contact','mitigation':'Business\x20layer\x20should\x20self-limit\x20IM\x20count\x20well\x20below\x20200.\x20For\x20high-volume\x20contact\x20'+'lists,\x20shard\x20across\x20multiple\x20Contact\x20objects\x20and\x20aggregate\x20off-chain.','related_move_error':'E_IM_COUNT_EXCEEDED\x20(1)','auto_fixable':![]},'check':a=>{if(a['im_count']===undefined)return null;if(a['im_count']<MAX_IM_COUNT)return null;return{...R_C_02['rule'],'evidence':'im_count='+a['im_count']+',\x20limit='+MAX_IM_COUNT};}},R_C_03={'rule':{'id':'R-CONTACT-03','level':'MEDIUM','category':'semantic','title':'IM\x20list\x20mutations\x20emit\x20no\x20events\x20—\x20external\x20indexers\x20must\x20poll','description':'im_add\x20/\x20im_remove\x20/\x20im_clear\x20do\x20not\x20emit\x20events\x20(contact.move:70-100).\x20External\x20'+'indexers\x20and\x20notification\x20systems\x20cannot\x20rely\x20on\x20event\x20streams\x20to\x20track\x20IM\x20list\x20'+'changes;\x20they\x20must\x20poll\x20the\x20ims\x20field\x20directly,\x20increasing\x20latency\x20and\x20RPC\x20cost.','affected_stakeholders':['creator','consumer'],'scenario':'Indexer\x20expects\x20an\x20event\x20on\x20im_add\x20but\x20none\x20is\x20emitted;\x20UI\x20fails\x20to\x20refresh','mitigation':'External\x20indexers\x20should\x20poll\x20the\x20Contact.ims\x20field\x20on\x20a\x20cadence.\x20A\x20future\x20version\x20'+'may\x20add\x20IMEvent;\x20until\x20then,\x20do\x20not\x20build\x20critical\x20UX\x20on\x20IM\x20event\x20streams.','auto_fixable':![]},'check':a=>null},R_C_04={'rule':{'id':'R-CONTACT-04','level':'LOW','category':'semantic','title':'location\x20defaults\x20to\x20empty\x20string\x20—\x20may\x20be\x20misread\x20as\x20\x27unset\x27','description':'A\x20freshly\x20created\x20Contact\x20has\x20location=\x22\x22\x20(empty\x20String).\x20The\x20Move\x20type\x20does\x20not\x20'+'distinguish\x20\x27unset\x27\x20from\x20\x27empty\x27,\x20so\x20consumers\x20may\x20misinterpret\x20an\x20empty\x20location\x20'+'as\x20\x27globally\x20applicable\x27\x20or\x20as\x20\x27missing\x20data\x27.','affected_stakeholders':['creator','consumer'],'scenario':'Consumer\x20reads\x20location=\x22\x22\x20and\x20treats\x20the\x20Contact\x20as\x20global\x20when\x20it\x20was\x20never\x20set','mitigation':'Document\x20that\x20empty\x20location\x20means\x20\x27not\x20specified\x27.\x20If\x20a\x20default\x20region\x20is\x20required,\x20'+'set\x20location\x20explicitly\x20at\x20creation\x20time.','auto_fixable':!![]},'check':a=>{if(!a['location_empty'])return null;return{...R_C_04['rule'],'evidence':'location=\x22\x22\x20(empty,\x20default)'};}},R_C_05={'rule':{'id':'R-CONTACT-05','level':'MEDIUM','category':'lifecycle','title':'my_status\x20silently\x20fails\x20for\x20non-IM-members','description':'my_status\x20only\x20updates\x20the\x20caller\x27s\x20status\x20entry\x20if\x20the\x20caller\x20is\x20in\x20the\x20ims\x20list\x20'+'(contact.move:35-42).\x20For\x20a\x20non-IM-member,\x20the\x20call\x20silently\x20succeeds\x20without\x20any\x20'+'state\x20change\x20—\x20there\x20is\x20no\x20abort\x20and\x20no\x20event.\x20Users\x20get\x20no\x20feedback,\x20making\x20it\x20'+'impossible\x20to\x20distinguish\x20\x27status\x20updated\x27\x20from\x20\x27operation\x20ignored\x27.','affected_stakeholders':['im_member'],'scenario':'Non-IM-member\x20calls\x20my_status\x20expecting\x20an\x20error;\x20operation\x20is\x20silently\x20ignored','mitigation':'SDK\x20layer\x20should\x20pre-validate\x20IM\x20membership\x20before\x20submitting\x20my_status\x20and\x20return\x20a\x20'+'clear\x20error.\x20UI\x20should\x20show\x20\x27not\x20an\x20IM\x20member\x27\x20instead\x20of\x20\x27success\x27.','auto_fixable':![]},'check':a=>{if(!a['my_status_from_non_member'])return null;return{...R_C_05['rule'],'evidence':'my_status_from_non_member=true\x20(will\x20be\x20silently\x20ignored)'};}},R_C_06={'rule':{'id':'R-CONTACT-06','level':'LOW','category':'semantic','title':'im_add\x20description\x20uses\x20LONG_NAME\x20(not\x20DESCRIPTION)\x20—\x20different\x20length\x20cap','description':'im_add\x27s\x20description\x20parameter\x20is\x20validated\x20with\x20common::LONG_NAME\x20rather\x20than\x20'+'common::DESCRIPTION\x20(contact.move:70-86).\x20The\x20two\x20validators\x20have\x20different\x20length\x20'+'limits;\x20callers\x20expecting\x20DESCRIPTION\x20semantics\x20may\x20submit\x20overly\x20long\x20strings\x20and\x20'+'hit\x20an\x20unexpected\x20abort.','affected_stakeholders':['creator'],'scenario':'Caller\x20submits\x20an\x20im_add\x20description\x20sized\x20for\x20DESCRIPTION\x20but\x20hits\x20LONG_NAME\x20limit','mitigation':'Document\x20that\x20im_add\x20description\x20uses\x20LONG_NAME\x20validation.\x20SDK\x20should\x20expose\x20the\x20'+'exact\x20limit\x20so\x20callers\x20size\x20their\x20strings\x20correctly.','auto_fixable':![]},'check':a=>{if(!a['im_add_description_uses_long_name'])return null;return{...R_C_06['rule'],'evidence':'im_add\x20description\x20validated\x20with\x20LONG_NAME'};}},R_C_07={'rule':{'id':'R-CONTACT-07','level':'MEDIUM','category':'cross_object','title':'permission_um_set\x20creates\x20Contact\x20↔\x20Permission\x20bidirectional\x20dependency','description':'When\x20Contact\x20is\x20set\x20as\x20a\x20Permission\x27s\x20um\x20via\x20permission_um_set\x20(contact.move:207-209),\x20'+'a\x20bidirectional\x20dependency\x20forms:\x20Permission.um\x20→\x20Contact,\x20and\x20Contact.permission\x20→\x20'+'Permission.\x20Deleting\x20the\x20Contact\x20without\x20first\x20clearing\x20the\x20um\x20reference\x20leaves\x20a\x20'+'dangling\x20pointer\x20in\x20Permission.um.','affected_stakeholders':['creator','consumer'],'scenario':'Contact\x20is\x20deleted\x20while\x20still\x20bound\x20as\x20Permission.um;\x20Permission.um\x20becomes\x20dangling','mitigation':'Document\x20the\x20deletion\x20order:\x20(1)\x20clear\x20Permission.um\x20via\x20permission_um_set(null)\x20'+'first,\x20(2)\x20then\x20delete\x20the\x20Contact.\x20SDK\x20should\x20refuse\x20to\x20delete\x20a\x20Contact\x20that\x20is\x20'+'still\x20bound\x20as\x20a\x20um.','auto_fixable':![]},'check':a=>{if(!a['bound_to_permission_um'])return null;return{...R_C_07['rule'],'evidence':'bound_to_permission_um=true\x20(deletion\x20requires\x20unbinding)'};}},R_C_08={'rule':{'id':'R-CONTACT-08','level':'LOW','category':'knowledge','title':'Knowledge\x20layer\x20&\x20constant\x20sync\x20—\x20RESOLVED','description':'MAX_IM_COUNT\x20is\x20now\x20synced\x20to\x20onchain-constants.ts\x20('+MAX_IM_COUNT+').\x20The\x20MCP\x20'+'Knowledge\x20layer\x20now\x20includes\x20contact-risk.ts.\x20This\x20risk\x20rule\x20is\x20retained\x20for\x20'+'historical\x20audit\x20and\x20to\x20detect\x20future\x20regressions.','affected_stakeholders':['system'],'scenario':'Future\x20regression:\x20someone\x20removes\x20MAX_IM_COUNT\x20from\x20onchain-constants.ts','mitigation':'Run\x20the\x20onchain-constants\x20sync\x20test\x20to\x20detect\x20drift.','auto_fixable':![]},'check':a=>{if(a['constants_synced'])return null;return{...R_C_08['rule'],'evidence':'constants_synced=false'};}};export const CONTACT_RISK_RULES=[R_C_01,R_C_02,R_C_03,R_C_04,R_C_05,R_C_06,R_C_07,R_C_08];export const CONTACT_RISK_VERSION='1.0.0';export function checkContactRisks(a){const b=[];for(const c of CONTACT_RISK_RULES){const d=c['check'](a);if(d)b['push'](d);}return!b['find'](e=>e['id']==='R-CONTACT-03')&&b['push'](R_C_03['rule']),b;}export function getContactRiskById(a){return CONTACT_RISK_RULES['find'](b=>b['rule']['id']===a)?.['rule'];}
@@ -1,60 +1 @@
1
- export const CONTACT_TEMPLATES = [
2
- {
3
- id: "T-C-01",
4
- name: "Basic contact",
5
- description: "Named contact with a permission reference and description. Bind to a Service via `um`.",
6
- applicable_scenes: ["contact_basic"],
7
- industry_tags: ["universal"],
8
- params: [
9
- { name: "name", type: "string", description: "Contact object name", required: true },
10
- { name: "permission", type: "string", description: "Permission object name/address", required: true },
11
- { name: "description", type: "string", description: "Contact description shown to customers", required: true },
12
- ],
13
- body: (p) => ({
14
- object: { name: p.name, permission: p.permission, replaceExistName: true },
15
- description: p.description,
16
- }),
17
- notes: ["Bind this contact to a Service via the service call's 'um' field"],
18
- },
19
- {
20
- id: "T-C-02",
21
- name: "Support contact with IM",
22
- description: "Contact with an initial IM entry pointing at a support account (after-sales / pre-order).",
23
- applicable_scenes: ["contact_support"],
24
- industry_tags: ["retail", "rental", "education", "travel", "freelance", "subscription"],
25
- params: [
26
- { name: "name", type: "string", description: "Contact object name", required: true },
27
- { name: "permission", type: "string", description: "Permission object name/address", required: true },
28
- { name: "description", type: "string", description: "Contact description shown to customers", required: true },
29
- { name: "support_account", type: "string", description: "Support account name or 0x address for IM", required: true },
30
- { name: "im_description", type: "string", description: "IM entry description (e.g. 'Primary support representative')", required: true },
31
- ],
32
- body: (p) => ({
33
- object: { name: p.name, permission: p.permission, replaceExistName: true },
34
- description: p.description,
35
- ims: {
36
- op: "add",
37
- im: [{ at: p.support_account, description: p.im_description }],
38
- },
39
- }),
40
- notes: [
41
- "ims.im[].at accepts an account name or a full 0x address",
42
- "ims is an op discriminated union — {op:'add'|'set'|'remove'|'clear'}",
43
- ],
44
- },
45
- ];
46
- export const CONTACT_TEMPLATES_VERSION = "1.0.0";
47
- export function getContactTemplateById(id) {
48
- return CONTACT_TEMPLATES.find((t) => t.id === id);
49
- }
50
- export function fillTemplate(templateId, params) {
51
- const tpl = getContactTemplateById(templateId);
52
- if (!tpl)
53
- return { ok: false, error: `Template ${templateId} not found` };
54
- for (const p of tpl.params) {
55
- if (p.required && !(p.name in params)) {
56
- return { ok: false, error: `Missing required param: ${p.name}` };
57
- }
58
- }
59
- return { ok: true, body: tpl.body(params) };
60
- }
1
+ export const CONTACT_TEMPLATES=[{'id':'T-C-01','name':'Basic\x20contact','description':'Named\x20contact\x20with\x20a\x20permission\x20reference\x20and\x20description.\x20Bind\x20to\x20a\x20Service\x20via\x20`um`.','applicable_scenes':['contact_basic'],'industry_tags':['universal'],'params':[{'name':'name','type':'string','description':'Contact\x20object\x20name','required':!![]},{'name':'permission','type':'string','description':'Permission\x20object\x20name/address','required':!![]},{'name':'description','type':'string','description':'Contact\x20description\x20shown\x20to\x20customers','required':!![]}],'body':a=>({'object':{'name':a['name'],'permission':a['permission'],'replaceExistName':!![]},'description':a['description']}),'notes':['Bind\x20this\x20contact\x20to\x20a\x20Service\x20via\x20the\x20service\x20call\x27s\x20\x27um\x27\x20field']},{'id':'T-C-02','name':'Support\x20contact\x20with\x20IM','description':'Contact\x20with\x20an\x20initial\x20IM\x20entry\x20pointing\x20at\x20a\x20support\x20account\x20(after-sales\x20/\x20pre-order).','applicable_scenes':['contact_support'],'industry_tags':['retail','rental','education','travel','freelance','subscription'],'params':[{'name':'name','type':'string','description':'Contact\x20object\x20name','required':!![]},{'name':'permission','type':'string','description':'Permission\x20object\x20name/address','required':!![]},{'name':'description','type':'string','description':'Contact\x20description\x20shown\x20to\x20customers','required':!![]},{'name':'support_account','type':'string','description':'Support\x20account\x20name\x20or\x200x\x20address\x20for\x20IM','required':!![]},{'name':'im_description','type':'string','description':'IM\x20entry\x20description\x20(e.g.\x20\x27Primary\x20support\x20representative\x27)','required':!![]}],'body':a=>({'object':{'name':a['name'],'permission':a['permission'],'replaceExistName':!![]},'description':a['description'],'ims':{'op':'add','im':[{'at':a['support_account'],'description':a['im_description']}]}}),'notes':['ims.im[].at\x20accepts\x20an\x20account\x20name\x20or\x20a\x20full\x200x\x20address','ims\x20is\x20an\x20op\x20discriminated\x20union\x20—\x20{op:\x27add\x27|\x27set\x27|\x27remove\x27|\x27clear\x27}']}];export const CONTACT_TEMPLATES_VERSION='1.0.0';export function getContactTemplateById(a){return CONTACT_TEMPLATES['find'](b=>b['id']===a);}export function fillTemplate(a,b){const c=getContactTemplateById(a);if(!c)return{'ok':![],'error':'Template\x20'+a+'\x20not\x20found'};for(const d of c['params']){if(d['required']&&!(d['name']in b))return{'ok':![],'error':'Missing\x20required\x20param:\x20'+d['name']};}return{'ok':!![],'body':c['body'](b)};}
@@ -1,206 +1 @@
1
- import { MAX_REWARD_COUNT, MAX_GUARD_COUNT_DEMAND, MAX_DESCRIPTION_LENGTH, MAX_LONG_NAME_LENGTH, } from "@wowok/wowok";
2
- const MAX_FEEDBACK_COUNT = 20;
3
- function checkDescription(input) {
4
- const len = input.description?.length ?? 0;
5
- const passed = len > 0 && len <= MAX_DESCRIPTION_LENGTH;
6
- return {
7
- id: "C-DEM-01",
8
- severity: passed ? "info" : (len === 0 ? "warn" : "block"),
9
- title: `description non-empty and within MAX_DESCRIPTION_LENGTH (${MAX_DESCRIPTION_LENGTH} chars)`,
10
- description: "description is a REQUIRED field. Move contract validates via common::DESCRIPTION (demand.move:157,177). " +
11
- "Empty string is technically rejected by common::DESCRIPTION only if NAME_ALLOW_EMPTY is not used; the new_imp " +
12
- "path uses common::DESCRIPTION which allows empty but enforces the 4000-char limit. Non-empty descriptions are " +
13
- "strongly recommended for Demand discoverability.",
14
- passed,
15
- evidence: input.description === undefined ? "undefined" : `length=${len}, limit=${MAX_DESCRIPTION_LENGTH}`,
16
- fix_hint: passed ? undefined : `Provide a description of 1..${MAX_DESCRIPTION_LENGTH} characters.`,
17
- };
18
- }
19
- function checkLocation(input) {
20
- const len = input.location?.length ?? 0;
21
- const passed = len <= MAX_LONG_NAME_LENGTH;
22
- return {
23
- id: "C-DEM-02",
24
- severity: passed ? "info" : "block",
25
- title: `location within MAX_LONG_NAME_LENGTH (${MAX_LONG_NAME_LENGTH} chars)`,
26
- description: "location is set via location_set_imp (demand.move:179-182) which validates via common::LONG_NAME. " +
27
- "Move aborts with E_LONG_NAME_LENGTH_EXCEEDED (11) on overflow. Empty location (\"\") is valid — new_imp " +
28
- "initializes location to empty string. Use location_set to update after creation.",
29
- passed,
30
- evidence: input.location === undefined ? "undefined" : `length=${len}, limit=${MAX_LONG_NAME_LENGTH}`,
31
- fix_hint: passed ? undefined : `Trim location to ≤ ${MAX_LONG_NAME_LENGTH} characters.`,
32
- };
33
- }
34
- function checkRewards(input) {
35
- const count = input.rewards?.length ?? 0;
36
- const passed = count <= MAX_REWARD_COUNT;
37
- return {
38
- id: "C-DEM-03",
39
- severity: passed ? "info" : "block",
40
- title: `rewards count within MAX_REWARD_COUNT (${MAX_REWARD_COUNT})`,
41
- description: "Each reward_add_imp (demand.move:184-191) checks `vector::length(&self.rewards) < MAX_REWARD_COUNT` " +
42
- "before pushing (after de-duplication). Move aborts with E_MAX_REWARD_COUNT_EXCEEDED (1) on overflow. " +
43
- "Rewards are affiliated via the Registrar — adding/removing triggers affiliation/disaffiliation.",
44
- passed,
45
- evidence: `count=${count}, limit=${MAX_REWARD_COUNT}`,
46
- fix_hint: passed ? undefined : `Remove rewards before adding new ones. Limit=${MAX_REWARD_COUNT}.`,
47
- };
48
- }
49
- function checkGuards(input) {
50
- const count = input.guards?.length ?? 0;
51
- const passed = count <= MAX_GUARD_COUNT_DEMAND;
52
- return {
53
- id: "C-DEM-04",
54
- severity: passed ? "info" : "block",
55
- title: `guards count within MAX_GUARD_COUNT_DEMAND (${MAX_GUARD_COUNT_DEMAND})`,
56
- description: "Each guard_add_imp (demand.move:213-242) checks `vector::length(&self.guards) < MAX_GUARD_COUNT` " +
57
- "before pushing (after duplicate check — duplicates update service_identifier in place). " +
58
- "Move aborts with E_MAX_GUARD_COUNT_EXCEEDED (2) on overflow. Guards are affiliated via the Registrar.",
59
- passed,
60
- evidence: `count=${count}, limit=${MAX_GUARD_COUNT_DEMAND}`,
61
- fix_hint: passed ? undefined : `Remove guards before adding new ones. Limit=${MAX_GUARD_COUNT_DEMAND}.`,
62
- };
63
- }
64
- function checkFeedback(input) {
65
- const count = input.feedback?.length ?? 0;
66
- const passed = count <= MAX_FEEDBACK_COUNT;
67
- return {
68
- id: "C-DEM-05",
69
- severity: passed ? "info" : "block",
70
- title: `feedback batch count within MAX_FEEDBACK_COUNT (${MAX_FEEDBACK_COUNT})`,
71
- description: "Move feedback (demand.move:352) updates ONE presenter per call — feedback_imp writes to a single " +
72
- "ServiceInfo record. The SDK batches multiple feedback calls and caps the batch at MAX_FEEDBACK_COUNT=" +
73
- `${MAX_FEEDBACK_COUNT} (SDK-only limit, NOT in onchain-constants.ts). Exceeding the SDK batch limit is ` +
74
- "rejected before transaction building. Each feedback string is validated by common::DESCRIPTION (4000 chars).",
75
- passed,
76
- evidence: `count=${count}, limit=${MAX_FEEDBACK_COUNT}`,
77
- fix_hint: passed ? undefined : `Split feedback into batches of ≤ ${MAX_FEEDBACK_COUNT} entries.`,
78
- };
79
- }
80
- function checkServiceIdentifier(input) {
81
- const sid = input.service_identifier;
82
- if (sid === null || sid === undefined) {
83
- return {
84
- id: "C-DEM-06",
85
- severity: "info",
86
- title: "service_identifier is null/undefined → Option::none (use supplied service address)",
87
- description: "When service_identifier is None, guard_add_imp stores Option::none in ServiceGuard. At present_with_passport " +
88
- "time, present_with_passport_imp uses the service parameter (or Option::none for plain present_with_passport). " +
89
- "Use None when the Demand does not need to route presentations through a specific Service submission.",
90
- passed: true,
91
- evidence: "null/undefined → Option::none",
92
- };
93
- }
94
- const isU8 = typeof sid === "number" && Number.isInteger(sid) && sid >= 0 && sid <= 255;
95
- return {
96
- id: "C-DEM-06",
97
- severity: isU8 ? "info" : "block",
98
- title: "service_identifier is a valid u8 (0-255) when provided",
99
- description: "When provided, service_identifier must be a u8 index into the Guard's submission registry. " +
100
- "guard_add_imp (demand.move:218-222) calls guard::get_submission_object_type(guard, *i) and " +
101
- "common::assert_service_object_type(t) — the submission at that index MUST exist and have type " +
102
- "ObjectType::Service. At present_with_passport time, the submission address is extracted from the Passport " +
103
- "via passport::submission_get(passport, &g, *service_identifier).",
104
- passed: isU8,
105
- evidence: `service_identifier=${sid}`,
106
- fix_hint: isU8 ? undefined : "Provide an integer in [0, 255] that indexes a Service-typed submission in the Guard.",
107
- };
108
- }
109
- function checkByGuard(input) {
110
- const byGuard = input.by_guard;
111
- if (byGuard === null || byGuard === undefined) {
112
- return {
113
- id: "C-DEM-07",
114
- severity: "info",
115
- title: "by_guard is null → use plain present (requires empty guards vector)",
116
- description: "When by_guard is None, the caller uses plain present (demand.move:100) which asserts " +
117
- "`vector::is_empty(&self.guards)` — aborts with E_NEED_PASSPORT (3) if guards exist. Use this path " +
118
- "for open Demands (no guards).",
119
- passed: true,
120
- evidence: "null/undefined → plain present path",
121
- };
122
- }
123
- if (input.guards === undefined) {
124
- return {
125
- id: "C-DEM-07",
126
- severity: "info",
127
- title: "by_guard provided (cannot verify membership — guards list not supplied)",
128
- description: "present_with_passport_imp (demand.move:110-129) iterates the guards vector looking for a matching " +
129
- "guard address. If not found, it aborts with E_GUARD_NOT_FOUND (4). The caller must ensure by_guard " +
130
- "is in Demand.guards — this check could not verify because the guards list was not supplied.",
131
- passed: true,
132
- evidence: `by_guard=${byGuard.substring(0, 10)}... (guards list not supplied)`,
133
- fix_hint: "Pass input.guards to enable membership verification.",
134
- };
135
- }
136
- const isInGuards = input.guards.includes(byGuard);
137
- return {
138
- id: "C-DEM-07",
139
- severity: isInGuards ? "info" : "block",
140
- title: "by_guard exists in Demand.guards (when specified)",
141
- description: "When by_guard is specified, present_with_passport_imp (demand.move:110-129) iterates the guards vector " +
142
- "looking for a matching guard address. If not found, it aborts with E_GUARD_NOT_FOUND (4). The caller " +
143
- "MUST ensure by_guard was previously added via guard_add.",
144
- passed: isInGuards,
145
- evidence: `by_guard=${byGuard.substring(0, 10)}..., in guards=${isInGuards}`,
146
- fix_hint: isInGuards ? undefined : "Call guard_add(permission, guard, service_identifier) first.",
147
- };
148
- }
149
- function checkPermissionSetAvailable(input) {
150
- const available = input.permission_set_available !== false;
151
- return {
152
- id: "C-DEM-08",
153
- severity: available ? "info" : "warn",
154
- title: "permission_set available via CallPermission.apply (DE-D-2=A)",
155
- description: "The Move permission_set function (demand.move:286) is exposed in the SDK via the CallPermission.apply " +
156
- "mechanism (DE-D-2=A). It calls permission::assert_owner(old) and registrar::affiliation_change to migrate " +
157
- "the affiliation. Permission indices for Demand (demand.move:20): 400=DEMAND_NEW, 401=DEMAND_DESCRIPTION, " +
158
- "402=DEMAND_LOCATION, 404=DEMAND_GUARD, 405=DEMAND_REWARD, 406=DEMAND_FEEDBACK, 407=DEMAND_OWNER_RECEIVE, " +
159
- "408=DEMAND_UM. This is an info check — it confirms the capability is available, not a creation prerequisite.",
160
- passed: available,
161
- evidence: available ? "exposed via CallPermission.apply" : "not available (regression)",
162
- fix_hint: available ? undefined : "Restore the CallPermission.apply path for permission_set.",
163
- };
164
- }
165
- export function preCheckDemandCreation(input) {
166
- return [
167
- checkDescription(input),
168
- checkLocation(input),
169
- checkRewards(input),
170
- checkGuards(input),
171
- checkFeedback(input),
172
- checkServiceIdentifier(input),
173
- checkByGuard(input),
174
- checkPermissionSetAvailable(input),
175
- ];
176
- }
177
- export function canCreateDemand(input) {
178
- const items = preCheckDemandCreation(input);
179
- return {
180
- canCreate: items.every(i => i.severity !== "block" || i.passed),
181
- blockers: items.filter(i => i.severity === "block" && !i.passed),
182
- warnings: items.filter(i => i.severity === "warn" && !i.passed),
183
- info: items.filter(i => i.severity === "info"),
184
- };
185
- }
186
- export function formatDemandCreationSummary(input) {
187
- const { canCreate, blockers, warnings, info } = canCreateDemand(input);
188
- const lines = [];
189
- lines.push(canCreate ? "✓ Demand pre-check PASSED" : "✗ Demand pre-check FAILED");
190
- lines.push("");
191
- if (blockers.length > 0) {
192
- lines.push("BLOCKERS (must fix before operation):");
193
- blockers.forEach(b => lines.push(` [${b.id}] ${b.title} — ${b.evidence ?? ""}`));
194
- lines.push("");
195
- }
196
- if (warnings.length > 0) {
197
- lines.push("WARNINGS (review recommended):");
198
- warnings.forEach(w => lines.push(` [${w.id}] ${w.title} — ${w.evidence ?? ""}`));
199
- lines.push("");
200
- }
201
- if (info.length > 0) {
202
- lines.push("INFO:");
203
- info.forEach(i => lines.push(` [${i.id}] ${i.title}`));
204
- }
205
- return lines.join("\n");
206
- }
1
+ import{MAX_REWARD_COUNT,MAX_GUARD_COUNT_DEMAND,MAX_DESCRIPTION_LENGTH,MAX_LONG_NAME_LENGTH}from'@wowok/wowok';const MAX_FEEDBACK_COUNT=0x14;function checkDescription(a){const b=a['description']?.['length']??0x0,c=b>0x0&&b<=MAX_DESCRIPTION_LENGTH;return{'id':'C-DEM-01','severity':c?'info':b===0x0?'warn':'block','title':'description\x20non-empty\x20and\x20within\x20MAX_DESCRIPTION_LENGTH\x20('+MAX_DESCRIPTION_LENGTH+'\x20chars)','description':'description\x20is\x20a\x20REQUIRED\x20field.\x20Move\x20contract\x20validates\x20via\x20common::DESCRIPTION\x20(demand.move:157,177).\x20'+'Empty\x20string\x20is\x20technically\x20rejected\x20by\x20common::DESCRIPTION\x20only\x20if\x20NAME_ALLOW_EMPTY\x20is\x20not\x20used;\x20the\x20new_imp\x20'+'path\x20uses\x20common::DESCRIPTION\x20which\x20allows\x20empty\x20but\x20enforces\x20the\x204000-char\x20limit.\x20Non-empty\x20descriptions\x20are\x20'+'strongly\x20recommended\x20for\x20Demand\x20discoverability.','passed':c,'evidence':a['description']===undefined?'undefined':'length='+b+',\x20limit='+MAX_DESCRIPTION_LENGTH,'fix_hint':c?undefined:'Provide\x20a\x20description\x20of\x201..'+MAX_DESCRIPTION_LENGTH+'\x20characters.'};}function checkLocation(a){const b=a['location']?.['length']??0x0,c=b<=MAX_LONG_NAME_LENGTH;return{'id':'C-DEM-02','severity':c?'info':'block','title':'location\x20within\x20MAX_LONG_NAME_LENGTH\x20('+MAX_LONG_NAME_LENGTH+'\x20chars)','description':'location\x20is\x20set\x20via\x20location_set_imp\x20(demand.move:179-182)\x20which\x20validates\x20via\x20common::LONG_NAME.\x20'+'Move\x20aborts\x20with\x20E_LONG_NAME_LENGTH_EXCEEDED\x20(11)\x20on\x20overflow.\x20Empty\x20location\x20(\x22\x22)\x20is\x20valid\x20—\x20new_imp\x20'+'initializes\x20location\x20to\x20empty\x20string.\x20Use\x20location_set\x20to\x20update\x20after\x20creation.','passed':c,'evidence':a['location']===undefined?'undefined':'length='+b+',\x20limit='+MAX_LONG_NAME_LENGTH,'fix_hint':c?undefined:'Trim\x20location\x20to\x20≤\x20'+MAX_LONG_NAME_LENGTH+'\x20characters.'};}function checkRewards(a){const b=a['rewards']?.['length']??0x0,c=b<=MAX_REWARD_COUNT;return{'id':'C-DEM-03','severity':c?'info':'block','title':'rewards\x20count\x20within\x20MAX_REWARD_COUNT\x20('+MAX_REWARD_COUNT+')','description':'Each\x20reward_add_imp\x20(demand.move:184-191)\x20checks\x20`vector::length(&self.rewards)\x20<\x20MAX_REWARD_COUNT`\x20'+'before\x20pushing\x20(after\x20de-duplication).\x20Move\x20aborts\x20with\x20E_MAX_REWARD_COUNT_EXCEEDED\x20(1)\x20on\x20overflow.\x20'+'Rewards\x20are\x20affiliated\x20via\x20the\x20Registrar\x20—\x20adding/removing\x20triggers\x20affiliation/disaffiliation.','passed':c,'evidence':'count='+b+',\x20limit='+MAX_REWARD_COUNT,'fix_hint':c?undefined:'Remove\x20rewards\x20before\x20adding\x20new\x20ones.\x20Limit='+MAX_REWARD_COUNT+'.'};}function checkGuards(a){const b=a['guards']?.['length']??0x0,c=b<=MAX_GUARD_COUNT_DEMAND;return{'id':'C-DEM-04','severity':c?'info':'block','title':'guards\x20count\x20within\x20MAX_GUARD_COUNT_DEMAND\x20('+MAX_GUARD_COUNT_DEMAND+')','description':'Each\x20guard_add_imp\x20(demand.move:213-242)\x20checks\x20`vector::length(&self.guards)\x20<\x20MAX_GUARD_COUNT`\x20'+'before\x20pushing\x20(after\x20duplicate\x20check\x20—\x20duplicates\x20update\x20service_identifier\x20in\x20place).\x20'+'Move\x20aborts\x20with\x20E_MAX_GUARD_COUNT_EXCEEDED\x20(2)\x20on\x20overflow.\x20Guards\x20are\x20affiliated\x20via\x20the\x20Registrar.','passed':c,'evidence':'count='+b+',\x20limit='+MAX_GUARD_COUNT_DEMAND,'fix_hint':c?undefined:'Remove\x20guards\x20before\x20adding\x20new\x20ones.\x20Limit='+MAX_GUARD_COUNT_DEMAND+'.'};}function checkFeedback(a){const b=a['feedback']?.['length']??0x0,c=b<=MAX_FEEDBACK_COUNT;return{'id':'C-DEM-05','severity':c?'info':'block','title':'feedback\x20batch\x20count\x20within\x20MAX_FEEDBACK_COUNT\x20('+MAX_FEEDBACK_COUNT+')','description':'Move\x20feedback\x20(demand.move:352)\x20updates\x20ONE\x20presenter\x20per\x20call\x20—\x20feedback_imp\x20writes\x20to\x20a\x20single\x20'+'ServiceInfo\x20record.\x20The\x20SDK\x20batches\x20multiple\x20feedback\x20calls\x20and\x20caps\x20the\x20batch\x20at\x20MAX_FEEDBACK_COUNT='+(MAX_FEEDBACK_COUNT+'\x20(SDK-only\x20limit,\x20NOT\x20in\x20onchain-constants.ts).\x20Exceeding\x20the\x20SDK\x20batch\x20limit\x20is\x20')+'rejected\x20before\x20transaction\x20building.\x20Each\x20feedback\x20string\x20is\x20validated\x20by\x20common::DESCRIPTION\x20(4000\x20chars).','passed':c,'evidence':'count='+b+',\x20limit='+MAX_FEEDBACK_COUNT,'fix_hint':c?undefined:'Split\x20feedback\x20into\x20batches\x20of\x20≤\x20'+MAX_FEEDBACK_COUNT+'\x20entries.'};}function checkServiceIdentifier(a){const b=a['service_identifier'];if(b===null||b===undefined)return{'id':'C-DEM-06','severity':'info','title':'service_identifier\x20is\x20null/undefined\x20→\x20Option::none\x20(use\x20supplied\x20service\x20address)','description':'When\x20service_identifier\x20is\x20None,\x20guard_add_imp\x20stores\x20Option::none\x20in\x20ServiceGuard.\x20At\x20present_with_passport\x20'+'time,\x20present_with_passport_imp\x20uses\x20the\x20service\x20parameter\x20(or\x20Option::none\x20for\x20plain\x20present_with_passport).\x20'+'Use\x20None\x20when\x20the\x20Demand\x20does\x20not\x20need\x20to\x20route\x20presentations\x20through\x20a\x20specific\x20Service\x20submission.','passed':!![],'evidence':'null/undefined\x20→\x20Option::none'};const c=typeof b==='number'&&Number['isInteger'](b)&&b>=0x0&&b<=0xff;return{'id':'C-DEM-06','severity':c?'info':'block','title':'service_identifier\x20is\x20a\x20valid\x20u8\x20(0-255)\x20when\x20provided','description':'When\x20provided,\x20service_identifier\x20must\x20be\x20a\x20u8\x20index\x20into\x20the\x20Guard\x27s\x20submission\x20registry.\x20'+'guard_add_imp\x20(demand.move:218-222)\x20calls\x20guard::get_submission_object_type(guard,\x20*i)\x20and\x20'+'common::assert_service_object_type(t)\x20—\x20the\x20submission\x20at\x20that\x20index\x20MUST\x20exist\x20and\x20have\x20type\x20'+'ObjectType::Service.\x20At\x20present_with_passport\x20time,\x20the\x20submission\x20address\x20is\x20extracted\x20from\x20the\x20Passport\x20'+'via\x20passport::submission_get(passport,\x20&g,\x20*service_identifier).','passed':c,'evidence':'service_identifier='+b,'fix_hint':c?undefined:'Provide\x20an\x20integer\x20in\x20[0,\x20255]\x20that\x20indexes\x20a\x20Service-typed\x20submission\x20in\x20the\x20Guard.'};}function checkByGuard(a){const b=a['by_guard'];if(b===null||b===undefined)return{'id':'C-DEM-07','severity':'info','title':'by_guard\x20is\x20null\x20→\x20use\x20plain\x20present\x20(requires\x20empty\x20guards\x20vector)','description':'When\x20by_guard\x20is\x20None,\x20the\x20caller\x20uses\x20plain\x20present\x20(demand.move:100)\x20which\x20asserts\x20'+'`vector::is_empty(&self.guards)`\x20—\x20aborts\x20with\x20E_NEED_PASSPORT\x20(3)\x20if\x20guards\x20exist.\x20Use\x20this\x20path\x20'+'for\x20open\x20Demands\x20(no\x20guards).','passed':!![],'evidence':'null/undefined\x20→\x20plain\x20present\x20path'};if(a['guards']===undefined)return{'id':'C-DEM-07','severity':'info','title':'by_guard\x20provided\x20(cannot\x20verify\x20membership\x20—\x20guards\x20list\x20not\x20supplied)','description':'present_with_passport_imp\x20(demand.move:110-129)\x20iterates\x20the\x20guards\x20vector\x20looking\x20for\x20a\x20matching\x20'+'guard\x20address.\x20If\x20not\x20found,\x20it\x20aborts\x20with\x20E_GUARD_NOT_FOUND\x20(4).\x20The\x20caller\x20must\x20ensure\x20by_guard\x20'+'is\x20in\x20Demand.guards\x20—\x20this\x20check\x20could\x20not\x20verify\x20because\x20the\x20guards\x20list\x20was\x20not\x20supplied.','passed':!![],'evidence':'by_guard='+b['substring'](0x0,0xa)+'...\x20(guards\x20list\x20not\x20supplied)','fix_hint':'Pass\x20input.guards\x20to\x20enable\x20membership\x20verification.'};const c=a['guards']['includes'](b);return{'id':'C-DEM-07','severity':c?'info':'block','title':'by_guard\x20exists\x20in\x20Demand.guards\x20(when\x20specified)','description':'When\x20by_guard\x20is\x20specified,\x20present_with_passport_imp\x20(demand.move:110-129)\x20iterates\x20the\x20guards\x20vector\x20'+'looking\x20for\x20a\x20matching\x20guard\x20address.\x20If\x20not\x20found,\x20it\x20aborts\x20with\x20E_GUARD_NOT_FOUND\x20(4).\x20The\x20caller\x20'+'MUST\x20ensure\x20by_guard\x20was\x20previously\x20added\x20via\x20guard_add.','passed':c,'evidence':'by_guard='+b['substring'](0x0,0xa)+'...,\x20in\x20guards='+c,'fix_hint':c?undefined:'Call\x20guard_add(permission,\x20guard,\x20service_identifier)\x20first.'};}function checkPermissionSetAvailable(a){const b=a['permission_set_available']!==![];return{'id':'C-DEM-08','severity':b?'info':'warn','title':'permission_set\x20available\x20via\x20CallPermission.apply\x20(DE-D-2=A)','description':'The\x20Move\x20permission_set\x20function\x20(demand.move:286)\x20is\x20exposed\x20in\x20the\x20SDK\x20via\x20the\x20CallPermission.apply\x20'+'mechanism\x20(DE-D-2=A).\x20It\x20calls\x20permission::assert_owner(old)\x20and\x20registrar::affiliation_change\x20to\x20migrate\x20'+'the\x20affiliation.\x20Permission\x20indices\x20for\x20Demand\x20(demand.move:20):\x20400=DEMAND_NEW,\x20401=DEMAND_DESCRIPTION,\x20'+'402=DEMAND_LOCATION,\x20404=DEMAND_GUARD,\x20405=DEMAND_REWARD,\x20406=DEMAND_FEEDBACK,\x20407=DEMAND_OWNER_RECEIVE,\x20'+'408=DEMAND_UM.\x20This\x20is\x20an\x20info\x20check\x20—\x20it\x20confirms\x20the\x20capability\x20is\x20available,\x20not\x20a\x20creation\x20prerequisite.','passed':b,'evidence':b?'exposed\x20via\x20CallPermission.apply':'not\x20available\x20(regression)','fix_hint':b?undefined:'Restore\x20the\x20CallPermission.apply\x20path\x20for\x20permission_set.'};}export function preCheckDemandCreation(a){return[checkDescription(a),checkLocation(a),checkRewards(a),checkGuards(a),checkFeedback(a),checkServiceIdentifier(a),checkByGuard(a),checkPermissionSetAvailable(a)];}export function canCreateDemand(a){const b=preCheckDemandCreation(a);return{'canCreate':b['every'](c=>c['severity']!=='block'||c['passed']),'blockers':b['filter'](c=>c['severity']==='block'&&!c['passed']),'warnings':b['filter'](c=>c['severity']==='warn'&&!c['passed']),'info':b['filter'](c=>c['severity']==='info')};}export function formatDemandCreationSummary(a){const {canCreate:b,blockers:c,warnings:d,info:e}=canCreateDemand(a),f=[];return f['push'](b?'✓\x20Demand\x20pre-check\x20PASSED':'✗\x20Demand\x20pre-check\x20FAILED'),f['push'](''),c['length']>0x0&&(f['push']('BLOCKERS\x20(must\x20fix\x20before\x20operation):'),c['forEach'](g=>f['push']('\x20\x20['+g['id']+']\x20'+g['title']+'\x20—\x20'+(g['evidence']??''))),f['push']('')),d['length']>0x0&&(f['push']('WARNINGS\x20(review\x20recommended):'),d['forEach'](g=>f['push']('\x20\x20['+g['id']+']\x20'+g['title']+'\x20—\x20'+(g['evidence']??''))),f['push']('')),e['length']>0x0&&(f['push']('INFO:'),e['forEach'](g=>f['push']('\x20\x20['+g['id']+']\x20'+g['title']))),f['join']('\x0a');}