@wowok/agent-mcp 2.7.1 → 2.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (597) hide show
  1. package/dist/config/index.js +1 -1
  2. package/dist/config/runtime.js +1 -238
  3. package/dist/customer/account-events.d.ts +32 -0
  4. package/dist/customer/account-events.js +1 -0
  5. package/dist/customer/customer-advice.d.ts +1 -0
  6. package/dist/customer/customer-advice.js +1 -130
  7. package/dist/customer/index.js +1 -11
  8. package/dist/customer/industry-risks.js +1 -438
  9. package/dist/customer/info-puzzle.js +1 -681
  10. package/dist/customer/order-monitor.js +1 -328
  11. package/dist/customer/order-strategy.d.ts +1 -1
  12. package/dist/customer/order-strategy.js +1 -373
  13. package/dist/customer/post-purchase.js +1 -351
  14. package/dist/customer/preorder-compare.js +1 -34
  15. package/dist/customer/reminder-system.d.ts +2 -0
  16. package/dist/customer/reminder-system.js +1 -316
  17. package/dist/customer/risk-assessment.d.ts +1 -0
  18. package/dist/customer/risk-assessment.js +1 -397
  19. package/dist/customer/types.d.ts +2 -0
  20. package/dist/customer/types.js +1 -13
  21. package/dist/customer/user-preferences.js +1 -460
  22. package/dist/evaluation/arbitration-game.d.ts +9 -2
  23. package/dist/evaluation/arbitration-game.js +1 -48
  24. package/dist/evaluation/builtins/arbitration-score.d.ts +41 -0
  25. package/dist/evaluation/builtins/arbitration-score.js +1 -0
  26. package/dist/evaluation/builtins/demand-match.js +1 -153
  27. package/dist/evaluation/builtins/index.d.ts +1 -0
  28. package/dist/evaluation/builtins/index.js +1 -10
  29. package/dist/evaluation/builtins/service-risk.js +1 -55
  30. package/dist/evaluation/capability.js +1 -13
  31. package/dist/evaluation/category-match-rules.d.ts +30 -0
  32. package/dist/evaluation/category-match-rules.js +1 -0
  33. package/dist/evaluation/composer.js +1 -40
  34. package/dist/evaluation/engine.js +1 -175
  35. package/dist/evaluation/extract.js +1 -115
  36. package/dist/evaluation/game-strategy.d.ts +27 -0
  37. package/dist/evaluation/game-strategy.js +1 -0
  38. package/dist/evaluation/gap.js +1 -100
  39. package/dist/evaluation/index.d.ts +2 -0
  40. package/dist/evaluation/index.js +1 -11
  41. package/dist/evaluation/location-match.d.ts +42 -0
  42. package/dist/evaluation/location-match.js +1 -0
  43. package/dist/evaluation/node-game.d.ts +31 -3
  44. package/dist/evaluation/node-game.js +1 -57
  45. package/dist/evaluation/path-reasoning.d.ts +35 -0
  46. package/dist/evaluation/path-reasoning.js +1 -0
  47. package/dist/evaluation/region.d.ts +6 -0
  48. package/dist/evaluation/region.js +1 -36
  49. package/dist/evaluation/types.d.ts +18 -0
  50. package/dist/evaluation/types.js +1 -1
  51. package/dist/evaluation/user-injection.js +1 -27
  52. package/dist/experience/experience-reuse.js +1 -103
  53. package/dist/experience/index.js +1 -5
  54. package/dist/experience/intent-distill.js +1 -83
  55. package/dist/experience/realtime-feedback.js +1 -94
  56. package/dist/experience/types.js +1 -1
  57. package/dist/experience/user-profile.d.ts +1 -1
  58. package/dist/experience/user-profile.js +1 -171
  59. package/dist/extensions/business-modules.js +1 -287
  60. package/dist/extensions/capability-manifest.js +1 -781
  61. package/dist/extensions/constraint-registry.js +1 -198
  62. package/dist/extensions/index.d.ts +6 -0
  63. package/dist/extensions/index.js +1 -6
  64. package/dist/extensions/industry-layers.d.ts +75 -0
  65. package/dist/extensions/industry-layers.js +1 -0
  66. package/dist/extensions/industry-pack.d.ts +105 -0
  67. package/dist/extensions/industry-pack.js +1 -0
  68. package/dist/extensions/metric-registry.js +1 -257
  69. package/dist/extensions/mode-evaluator.d.ts +1 -1
  70. package/dist/extensions/mode-evaluator.js +1 -170
  71. package/dist/extensions/modes.js +1 -499
  72. package/dist/extensions/registry.d.ts +1 -0
  73. package/dist/extensions/registry.js +1 -717
  74. package/dist/extensions/types.js +1 -1
  75. package/dist/graph/base.d.ts +8 -0
  76. package/dist/graph/base.js +1 -0
  77. package/dist/harness/auto-escalation.js +1 -68
  78. package/dist/harness/checkpoint.js +1 -129
  79. package/dist/harness/index.d.ts +1 -0
  80. package/dist/harness/index.js +1 -78
  81. package/dist/harness/plan.d.ts +2 -0
  82. package/dist/harness/plan.js +1 -315
  83. package/dist/harness/recover.d.ts +1 -1
  84. package/dist/harness/recover.js +1 -139
  85. package/dist/harness/types.d.ts +2 -3
  86. package/dist/harness/types.js +1 -1
  87. package/dist/harness/verify.js +1 -237
  88. package/dist/index.js +1 -273
  89. package/dist/intent/enrich.js +1 -67
  90. package/dist/intent/index.js +1 -60
  91. package/dist/intent/matcher.js +1 -81
  92. package/dist/intent/store.js +1 -55
  93. package/dist/intent/types.js +1 -10
  94. package/dist/knowledge/acquisition-flywheel.js +1 -192
  95. package/dist/knowledge/allocation-confirm.js +1 -534
  96. package/dist/knowledge/allocation-context.js +1 -249
  97. package/dist/knowledge/allocation-ledger.js +1 -463
  98. package/dist/knowledge/allocation-puzzle.js +1 -298
  99. package/dist/knowledge/allocation-risk.js +1 -568
  100. package/dist/knowledge/allocation-templates.js +1 -970
  101. package/dist/knowledge/allocation-translation.js +1 -585
  102. package/dist/knowledge/anti-cheat.d.ts +37 -0
  103. package/dist/knowledge/anti-cheat.js +1 -0
  104. package/dist/knowledge/arb-confirm.d.ts +28 -0
  105. package/dist/knowledge/arb-confirm.js +1 -0
  106. package/dist/knowledge/arb-risk.js +1 -210
  107. package/dist/knowledge/arb-translation.d.ts +48 -0
  108. package/dist/knowledge/arb-translation.js +1 -0
  109. package/dist/knowledge/arbitration-confirm.js +1 -559
  110. package/dist/knowledge/arbitration-context.js +1 -505
  111. package/dist/knowledge/arbitration-ledger.js +1 -521
  112. package/dist/knowledge/arbitration-puzzle.js +1 -304
  113. package/dist/knowledge/arbitration-risk.js +1 -423
  114. package/dist/knowledge/arbitration-templates.js +1 -276
  115. package/dist/knowledge/arbitration-translation.js +1 -487
  116. package/dist/knowledge/audit-rules.js +1 -141
  117. package/dist/knowledge/bridge-confirm.d.ts +26 -0
  118. package/dist/knowledge/bridge-confirm.js +1 -0
  119. package/dist/knowledge/bridge-risk.js +1 -263
  120. package/dist/knowledge/bridge-translation.d.ts +37 -0
  121. package/dist/knowledge/bridge-translation.js +1 -0
  122. package/dist/knowledge/contact-confirm.d.ts +27 -0
  123. package/dist/knowledge/contact-confirm.js +1 -0
  124. package/dist/knowledge/contact-risk.js +1 -200
  125. package/dist/knowledge/contact-templates.js +1 -60
  126. package/dist/knowledge/contact-translation.d.ts +39 -0
  127. package/dist/knowledge/contact-translation.js +1 -0
  128. package/dist/knowledge/demand-confirm.js +1 -206
  129. package/dist/knowledge/demand-context.d.ts +17 -0
  130. package/dist/knowledge/demand-context.js +1 -0
  131. package/dist/knowledge/demand-ledger.d.ts +26 -0
  132. package/dist/knowledge/demand-ledger.js +1 -0
  133. package/dist/knowledge/demand-matching.js +1 -132
  134. package/dist/knowledge/demand-puzzle.d.ts +29 -0
  135. package/dist/knowledge/demand-puzzle.js +1 -0
  136. package/dist/knowledge/demand-risk.js +1 -240
  137. package/dist/knowledge/demand-templates.d.ts +12 -0
  138. package/dist/knowledge/demand-templates.js +1 -0
  139. package/dist/knowledge/demand-translation.js +1 -354
  140. package/dist/knowledge/deployment-scanner.js +1 -823
  141. package/dist/knowledge/dynamic-pricing.js +1 -87
  142. package/dist/knowledge/evidence-review.d.ts +12 -0
  143. package/dist/knowledge/evidence-review.js +1 -0
  144. package/dist/knowledge/examples-scanner-cli.js +1 -26
  145. package/dist/knowledge/examples-scanner.js +1 -843
  146. package/dist/knowledge/flywheel-loop.d.ts +0 -1
  147. package/dist/knowledge/flywheel-loop.js +1 -404
  148. package/dist/knowledge/fund-layer.js +1 -973
  149. package/dist/knowledge/glossary.js +1 -211
  150. package/dist/knowledge/guard-confirm.js +1 -406
  151. package/dist/knowledge/guard-context.js +1 -287
  152. package/dist/knowledge/guard-design-patterns.js +1 -360
  153. package/dist/knowledge/guard-ledger.js +1 -260
  154. package/dist/knowledge/guard-lint.js +1 -670
  155. package/dist/knowledge/guard-migration.d.ts +1 -1
  156. package/dist/knowledge/guard-migration.js +1 -228
  157. package/dist/knowledge/guard-puzzle.js +1 -805
  158. package/dist/knowledge/guard-render.js +1 -700
  159. package/dist/knowledge/guard-risk.js +1 -1879
  160. package/dist/knowledge/guard-submission-prompt.js +1 -171
  161. package/dist/knowledge/guard-templates.js +1 -1105
  162. package/dist/knowledge/guard-translation.js +1 -1119
  163. package/dist/knowledge/index.d.ts +71 -3
  164. package/dist/knowledge/index.js +1 -436
  165. package/dist/knowledge/industry-evolution.js +1 -323
  166. package/dist/knowledge/industry-generalizer.js +1 -381
  167. package/dist/knowledge/industry-registry.js +1 -174
  168. package/dist/knowledge/intent-metrics.d.ts +4 -3
  169. package/dist/knowledge/intent-metrics.js +1 -566
  170. package/dist/knowledge/machine-confirm.js +1 -559
  171. package/dist/knowledge/machine-context.js +1 -833
  172. package/dist/knowledge/machine-ledger.js +1 -338
  173. package/dist/knowledge/machine-puzzle.js +1 -494
  174. package/dist/knowledge/machine-render.js +1 -565
  175. package/dist/knowledge/machine-risk.js +1 -669
  176. package/dist/knowledge/machine-templates.js +1 -1597
  177. package/dist/knowledge/machine-topology.js +1 -234
  178. package/dist/knowledge/machine-translation.js +1 -513
  179. package/dist/knowledge/market-metrics.d.ts +12 -0
  180. package/dist/knowledge/market-metrics.js +1 -0
  181. package/dist/knowledge/market-operations.d.ts +46 -0
  182. package/dist/knowledge/market-operations.js +1 -0
  183. package/dist/knowledge/mcp-schema-audit-cli.js +1 -45
  184. package/dist/knowledge/mcp-schema-audit.d.ts +22 -22
  185. package/dist/knowledge/mcp-schema-audit.js +1 -777
  186. package/dist/knowledge/onchain-constants.js +1 -35
  187. package/dist/knowledge/order-confirm.js +1 -573
  188. package/dist/knowledge/order-context.js +1 -390
  189. package/dist/knowledge/order-ledger.js +1 -341
  190. package/dist/knowledge/order-puzzle.js +1 -255
  191. package/dist/knowledge/order-risk.js +1 -653
  192. package/dist/knowledge/order-templates.js +1 -368
  193. package/dist/knowledge/order-translation.js +1 -550
  194. package/dist/knowledge/overrides-loader.js +1 -65
  195. package/dist/knowledge/passport-confirm.js +1 -531
  196. package/dist/knowledge/passport-context.js +1 -306
  197. package/dist/knowledge/passport-ledger.js +1 -282
  198. package/dist/knowledge/passport-puzzle.js +1 -333
  199. package/dist/knowledge/passport-risk.js +1 -450
  200. package/dist/knowledge/passport-templates.js +1 -568
  201. package/dist/knowledge/passport-translation.js +1 -516
  202. package/dist/knowledge/payment-confirm.d.ts +26 -0
  203. package/dist/knowledge/payment-confirm.js +1 -0
  204. package/dist/knowledge/payment-risk.js +1 -249
  205. package/dist/knowledge/payment-translation.d.ts +37 -0
  206. package/dist/knowledge/payment-translation.js +1 -0
  207. package/dist/knowledge/permission-confirm.js +1 -426
  208. package/dist/knowledge/permission-context.js +1 -224
  209. package/dist/knowledge/permission-ledger.d.ts +11 -0
  210. package/dist/knowledge/permission-ledger.js +1 -403
  211. package/dist/knowledge/permission-puzzle.js +1 -173
  212. package/dist/knowledge/permission-risk.js +1 -411
  213. package/dist/knowledge/permission-templates.js +1 -234
  214. package/dist/knowledge/permission-translation.js +1 -350
  215. package/dist/knowledge/personal-confirm.d.ts +29 -0
  216. package/dist/knowledge/personal-confirm.js +1 -0
  217. package/dist/knowledge/personal-risk.js +1 -212
  218. package/dist/knowledge/personal-translation.d.ts +37 -0
  219. package/dist/knowledge/personal-translation.js +1 -0
  220. package/dist/knowledge/process-model.d.ts +1 -11
  221. package/dist/knowledge/process-model.js +1 -160
  222. package/dist/knowledge/progress-confirm.js +1 -456
  223. package/dist/knowledge/progress-context.js +1 -452
  224. package/dist/knowledge/progress-ledger.js +1 -330
  225. package/dist/knowledge/progress-puzzle.js +1 -219
  226. package/dist/knowledge/progress-risk.js +1 -461
  227. package/dist/knowledge/progress-templates.js +1 -228
  228. package/dist/knowledge/progress-translation.js +1 -405
  229. package/dist/knowledge/proof-confirm.js +1 -187
  230. package/dist/knowledge/proof-context.d.ts +17 -0
  231. package/dist/knowledge/proof-context.js +1 -0
  232. package/dist/knowledge/proof-ledger.d.ts +34 -0
  233. package/dist/knowledge/proof-ledger.js +1 -0
  234. package/dist/knowledge/proof-puzzle.d.ts +35 -0
  235. package/dist/knowledge/proof-puzzle.js +1 -0
  236. package/dist/knowledge/proof-risk.js +1 -207
  237. package/dist/knowledge/proof-templates.d.ts +22 -0
  238. package/dist/knowledge/proof-templates.js +1 -0
  239. package/dist/knowledge/proof-translation.js +1 -283
  240. package/dist/knowledge/registrar-confirm.d.ts +26 -0
  241. package/dist/knowledge/registrar-confirm.js +1 -0
  242. package/dist/knowledge/registrar-risk.js +1 -217
  243. package/dist/knowledge/registrar-translation.d.ts +37 -0
  244. package/dist/knowledge/registrar-translation.js +1 -0
  245. package/dist/knowledge/repository-confirm.js +1 -286
  246. package/dist/knowledge/repository-context.d.ts +12 -0
  247. package/dist/knowledge/repository-context.js +1 -0
  248. package/dist/knowledge/repository-ledger.d.ts +25 -0
  249. package/dist/knowledge/repository-ledger.js +1 -0
  250. package/dist/knowledge/repository-puzzle.d.ts +30 -0
  251. package/dist/knowledge/repository-puzzle.js +1 -0
  252. package/dist/knowledge/repository-risk.js +1 -373
  253. package/dist/knowledge/repository-templates.d.ts +14 -0
  254. package/dist/knowledge/repository-templates.js +1 -0
  255. package/dist/knowledge/repository-translation.js +1 -445
  256. package/dist/knowledge/reputation-rules.js +1 -99
  257. package/dist/knowledge/resource-confirm.d.ts +25 -0
  258. package/dist/knowledge/resource-confirm.js +1 -0
  259. package/dist/knowledge/resource-risk.js +1 -157
  260. package/dist/knowledge/resource-translation.d.ts +37 -0
  261. package/dist/knowledge/resource-translation.js +1 -0
  262. package/dist/knowledge/reward-confirm.js +1 -526
  263. package/dist/knowledge/reward-context.d.ts +2 -2
  264. package/dist/knowledge/reward-context.js +1 -504
  265. package/dist/knowledge/reward-ledger.js +1 -502
  266. package/dist/knowledge/reward-puzzle.js +1 -300
  267. package/dist/knowledge/reward-risk.js +1 -627
  268. package/dist/knowledge/reward-templates.js +1 -197
  269. package/dist/knowledge/reward-translation.js +1 -501
  270. package/dist/knowledge/safety-rules.d.ts +1 -0
  271. package/dist/knowledge/safety-rules.js +1 -404
  272. package/dist/knowledge/scenario-modes.js +1 -321
  273. package/dist/knowledge/service-confirm.js +1 -807
  274. package/dist/knowledge/service-context.js +1 -403
  275. package/dist/knowledge/service-ledger.js +1 -609
  276. package/dist/knowledge/service-puzzle.js +1 -236
  277. package/dist/knowledge/service-risk.d.ts +1 -1
  278. package/dist/knowledge/service-risk.js +1 -651
  279. package/dist/knowledge/service-templates.js +1 -456
  280. package/dist/knowledge/service-translation.js +1 -622
  281. package/dist/knowledge/template-registry.js +1 -353
  282. package/dist/knowledge/tool-constraints.js +1 -195
  283. package/dist/knowledge/tools-reference.js +1 -178
  284. package/dist/knowledge/treasury-confirm.js +1 -512
  285. package/dist/knowledge/treasury-context.js +1 -363
  286. package/dist/knowledge/treasury-ledger.js +1 -300
  287. package/dist/knowledge/treasury-puzzle.js +1 -216
  288. package/dist/knowledge/treasury-risk.js +1 -440
  289. package/dist/knowledge/treasury-templates.js +1 -358
  290. package/dist/knowledge/treasury-translation.js +1 -498
  291. package/dist/knowledge/trust-metrics.js +1 -198
  292. package/dist/knowledge/universal-template.d.ts +22 -0
  293. package/dist/knowledge/universal-template.js +1 -0
  294. package/dist/knowledge/util-confirm.d.ts +24 -0
  295. package/dist/knowledge/util-confirm.js +1 -0
  296. package/dist/knowledge/util-risk.js +1 -135
  297. package/dist/knowledge/util-translation.d.ts +38 -0
  298. package/dist/knowledge/util-translation.js +1 -0
  299. package/dist/knowledge/workflow-guidance.d.ts +116 -0
  300. package/dist/knowledge/workflow-guidance.js +1 -0
  301. package/dist/loop-engineering/aggregate.js +1 -132
  302. package/dist/loop-engineering/context-collect.js +1 -83
  303. package/dist/loop-engineering/diagnose.js +1 -273
  304. package/dist/loop-engineering/improve.js +1 -405
  305. package/dist/loop-engineering/index.js +1 -4
  306. package/dist/loop-engineering/pipeline.js +1 -56
  307. package/dist/mode-market/index.js +1 -3
  308. package/dist/mode-market/registry.js +1 -124
  309. package/dist/mode-market/review.js +1 -214
  310. package/dist/mode-market/submission.js +1 -85
  311. package/dist/participation/collaborator-interest.d.ts +23 -0
  312. package/dist/participation/collaborator-interest.js +1 -0
  313. package/dist/participation/customer-interest.d.ts +25 -0
  314. package/dist/participation/customer-interest.js +1 -0
  315. package/dist/participation/employee-kpi.d.ts +25 -0
  316. package/dist/participation/employee-kpi.js +1 -0
  317. package/dist/participation/employee-store.d.ts +16 -0
  318. package/dist/participation/employee-store.js +1 -0
  319. package/dist/participation/index.d.ts +2 -0
  320. package/dist/participation/index.js +1 -0
  321. package/dist/participation/merchant-interest.js +1 -100
  322. package/dist/participation/radar-core.d.ts +13 -3
  323. package/dist/participation/radar-core.js +1 -269
  324. package/dist/participation/supplier-interest.d.ts +25 -0
  325. package/dist/participation/supplier-interest.js +1 -0
  326. package/dist/persona/analyzer.js +1 -66
  327. package/dist/persona/bridge.js +1 -86
  328. package/dist/persona/defaults.js +1 -195
  329. package/dist/persona/experience-bridge.js +1 -23
  330. package/dist/persona/index.d.ts +9 -2
  331. package/dist/persona/index.js +1 -71
  332. package/dist/persona/local-region.d.ts +20 -0
  333. package/dist/persona/local-region.js +1 -0
  334. package/dist/persona/model.js +1 -111
  335. package/dist/persona/overrides.d.ts +10 -0
  336. package/dist/persona/overrides.js +1 -0
  337. package/dist/persona/pack-personae.d.ts +11 -0
  338. package/dist/persona/pack-personae.js +1 -0
  339. package/dist/persona/store.js +1 -62
  340. package/dist/persona/strategy-intent.d.ts +20 -0
  341. package/dist/persona/strategy-intent.js +1 -0
  342. package/dist/persona/types.d.ts +6 -2
  343. package/dist/persona/types.js +1 -5
  344. package/dist/project/business-puzzle.d.ts +1 -1
  345. package/dist/project/business-puzzle.js +1 -383
  346. package/dist/project/context-assembly.js +1 -254
  347. package/dist/project/deployment-bridge.js +1 -120
  348. package/dist/project/deployment-doc.js +1 -1126
  349. package/dist/project/edit-planner.js +1 -1342
  350. package/dist/project/evaluation.d.ts +37 -1
  351. package/dist/project/evaluation.js +1 -2011
  352. package/dist/project/game-theory.js +1 -177
  353. package/dist/project/graph-builder.js +1 -656
  354. package/dist/project/graph.d.ts +3 -6
  355. package/dist/project/graph.js +1 -340
  356. package/dist/project/handlers.d.ts +33 -2
  357. package/dist/project/handlers.js +1 -1784
  358. package/dist/project/index.d.ts +2 -0
  359. package/dist/project/index.js +1 -301
  360. package/dist/project/intent-analyzer.js +1 -149
  361. package/dist/project/machine-nodes.js +1 -36
  362. package/dist/project/merchant-guide.d.ts +19 -0
  363. package/dist/project/merchant-guide.js +1 -264
  364. package/dist/project/migration.js +1 -125
  365. package/dist/project/mode-actions.js +1 -309
  366. package/dist/project/namespace.js +1 -206
  367. package/dist/project/participation-radar.js +1 -428
  368. package/dist/project/pipeline-actions.js +1 -109
  369. package/dist/project/project-store.js +1 -422
  370. package/dist/project/query.js +1 -153
  371. package/dist/project/reverse-mapping.d.ts +34 -0
  372. package/dist/project/reverse-mapping.js +1 -0
  373. package/dist/project/risk-aggregator.js +1 -295
  374. package/dist/project/rollback-policy.js +1 -290
  375. package/dist/project/semantic-assembler.js +1 -345
  376. package/dist/project/semantic-graph.d.ts +3 -5
  377. package/dist/project/semantic-graph.js +1 -292
  378. package/dist/project/stage-gate.js +1 -369
  379. package/dist/project/substep-trace.js +1 -332
  380. package/dist/project/task-tracker.js +1 -78
  381. package/dist/project/workflow-design-assessment.d.ts +24 -0
  382. package/dist/project/workflow-design-assessment.js +1 -0
  383. package/dist/role/derivation.d.ts +18 -0
  384. package/dist/role/derivation.js +1 -0
  385. package/dist/role/index.d.ts +5 -0
  386. package/dist/role/index.js +1 -0
  387. package/dist/role/model.d.ts +8 -0
  388. package/dist/role/model.js +1 -0
  389. package/dist/role/resolution.d.ts +11 -0
  390. package/dist/role/resolution.js +1 -0
  391. package/dist/role/types.d.ts +11 -0
  392. package/dist/role/types.js +1 -0
  393. package/dist/rules.js +1 -52
  394. package/dist/safety/confirm-gate.d.ts +1 -1
  395. package/dist/safety/confirm-gate.js +1 -88
  396. package/dist/safety/index.js +1 -3
  397. package/dist/safety/preview.js +1 -52
  398. package/dist/schema/call/allocation.d.ts +186 -1385
  399. package/dist/schema/call/allocation.js +1 -34
  400. package/dist/schema/call/arbitration.d.ts +272 -1871
  401. package/dist/schema/call/arbitration.js +1 -113
  402. package/dist/schema/call/base.d.ts +1831 -9076
  403. package/dist/schema/call/base.js +1 -370
  404. package/dist/schema/call/bridge.d.ts +911 -3171
  405. package/dist/schema/call/bridge.js +1 -458
  406. package/dist/schema/call/contact.d.ts +135 -931
  407. package/dist/schema/call/contact.js +1 -37
  408. package/dist/schema/call/demand.d.ts +164 -1194
  409. package/dist/schema/call/demand.js +1 -47
  410. package/dist/schema/call/guard.d.ts +298 -1140
  411. package/dist/schema/call/guard.js +1 -161
  412. package/dist/schema/call/handler.js +1 -322
  413. package/dist/schema/call/index.js +1 -20
  414. package/dist/schema/call/machine.d.ts +459 -5403
  415. package/dist/schema/call/machine.js +1 -193
  416. package/dist/schema/call/order.d.ts +137 -844
  417. package/dist/schema/call/order.js +1 -35
  418. package/dist/schema/call/payment.d.ts +74 -561
  419. package/dist/schema/call/payment.js +1 -37
  420. package/dist/schema/call/permission-handler.js +1 -54
  421. package/dist/schema/call/permission.d.ts +335 -2791
  422. package/dist/schema/call/permission.js +1 -105
  423. package/dist/schema/call/personal.d.ts +227 -1814
  424. package/dist/schema/call/personal.js +1 -78
  425. package/dist/schema/call/progress.d.ts +140 -843
  426. package/dist/schema/call/progress.js +1 -47
  427. package/dist/schema/call/proof.d.ts +42 -258
  428. package/dist/schema/call/proof.js +1 -33
  429. package/dist/schema/call/repository.d.ts +324 -2222
  430. package/dist/schema/call/repository.js +1 -77
  431. package/dist/schema/call/reward.d.ts +153 -1183
  432. package/dist/schema/call/reward.js +1 -30
  433. package/dist/schema/call/semantic.js +1 -1679
  434. package/dist/schema/call/service.d.ts +376 -3431
  435. package/dist/schema/call/service.js +1 -184
  436. package/dist/schema/call/treasury.d.ts +252 -2158
  437. package/dist/schema/call/treasury.js +1 -71
  438. package/dist/schema/common/index.d.ts +222 -697
  439. package/dist/schema/common/index.js +1 -407
  440. package/dist/schema/config/index.d.ts +18 -161
  441. package/dist/schema/config/index.js +1 -68
  442. package/dist/schema/employee/index.d.ts +99 -0
  443. package/dist/schema/employee/index.js +1 -0
  444. package/dist/schema/evaluation/index.d.ts +1062 -3748
  445. package/dist/schema/evaluation/index.js +1 -356
  446. package/dist/schema/index.d.ts +3 -0
  447. package/dist/schema/index.js +1 -17
  448. package/dist/schema/industry-pack/index.d.ts +132 -0
  449. package/dist/schema/industry-pack/index.js +1 -0
  450. package/dist/schema/intent-radar/index.d.ts +92 -245
  451. package/dist/schema/intent-radar/index.js +1 -89
  452. package/dist/schema/local/index.d.ts +2045 -18080
  453. package/dist/schema/local/index.js +1 -927
  454. package/dist/schema/local/wip.d.ts +61 -651
  455. package/dist/schema/local/wip.js +1 -187
  456. package/dist/schema/messenger/index.d.ts +949 -5557
  457. package/dist/schema/messenger/index.js +1 -475
  458. package/dist/schema/operations.d.ts +2969 -26518
  459. package/dist/schema/operations.js +1 -520
  460. package/dist/schema/persona/index.d.ts +469 -1820
  461. package/dist/schema/persona/index.js +1 -148
  462. package/dist/schema/project/index.d.ts +1027 -8408
  463. package/dist/schema/project/index.js +1 -2057
  464. package/dist/schema/query/index.d.ts +12041 -75261
  465. package/dist/schema/query/index.js +1 -1646
  466. package/dist/schema/schema-query/index.d.ts +35 -98
  467. package/dist/schema/schema-query/index.js +1 -104
  468. package/dist/schema/schema-version.js +1 -76
  469. package/dist/schema/task-status.d.ts +26 -132
  470. package/dist/schema/task-status.js +1 -36
  471. package/dist/schema/trust/index.d.ts +194 -1290
  472. package/dist/schema/trust/index.js +1 -314
  473. package/dist/schema/utils/guard-parser.js +1 -419
  474. package/dist/schema/utils/guard-query-utils.js +1 -46
  475. package/dist/schema/utils/node-parser.js +1 -369
  476. package/dist/schema/utils/object-type-utils.js +1 -35
  477. package/dist/schema/utils/permission-index-utils.js +1 -7
  478. package/dist/schema/utils/permission-machine-check.js +1 -121
  479. package/dist/schema/utils/skills-recommendation.d.ts +1 -0
  480. package/dist/schema/utils/skills-recommendation.js +1 -77
  481. package/dist/schema/workspace/index.d.ts +69 -0
  482. package/dist/schema/workspace/index.js +1 -0
  483. package/dist/schema-query-impl/index.js +1 -0
  484. package/dist/schemas/account_operation.output.json +3147 -1652
  485. package/dist/schemas/account_operation.schema.json +225 -218
  486. package/dist/schemas/bridge_operation.output.json +1168 -650
  487. package/dist/schemas/bridge_operation.schema.json +736 -504
  488. package/dist/schemas/config_operation.output.json +185 -179
  489. package/dist/schemas/config_operation.schema.json +21 -26
  490. package/dist/schemas/employee_operation.output.json +207 -0
  491. package/dist/schemas/employee_operation.schema.json +176 -0
  492. package/dist/schemas/evaluation_operation.output.json +2329 -557
  493. package/dist/schemas/evaluation_operation.schema.json +2939 -720
  494. package/dist/schemas/guard2file.output.json +58 -64
  495. package/dist/schemas/guard2file.schema.json +79 -81
  496. package/dist/schemas/index.json +29 -11
  497. package/dist/schemas/industry_pack_operation.output.json +594 -0
  498. package/dist/schemas/industry_pack_operation.schema.json +55 -0
  499. package/dist/schemas/intent_radar.output.json +275 -200
  500. package/dist/schemas/intent_radar.schema.json +124 -123
  501. package/dist/schemas/local_info_operation.output.json +1174 -657
  502. package/dist/schemas/local_info_operation.schema.json +119 -125
  503. package/dist/schemas/local_mark_operation.output.json +1239 -689
  504. package/dist/schemas/local_mark_operation.schema.json +91 -96
  505. package/dist/schemas/machineNode2file.output.json +63 -69
  506. package/dist/schemas/machineNode2file.schema.json +79 -81
  507. package/dist/schemas/messenger_operation.output.json +2722 -1528
  508. package/dist/schemas/messenger_operation.schema.json +1482 -1264
  509. package/dist/schemas/onchain_events.output.json +2590 -975
  510. package/dist/schemas/onchain_events.schema.json +117 -99
  511. package/dist/schemas/onchain_operations.output.json +3957 -2309
  512. package/dist/schemas/onchain_operations.schema.json +20799 -9285
  513. package/dist/schemas/onchain_operations_allocation.schema.json +172 -108
  514. package/dist/schemas/onchain_operations_arbitration.schema.json +233 -146
  515. package/dist/schemas/onchain_operations_contact.schema.json +129 -90
  516. package/dist/schemas/onchain_operations_demand.schema.json +170 -112
  517. package/dist/schemas/onchain_operations_gen_passport.schema.json +61 -646
  518. package/dist/schemas/onchain_operations_gen_proof.schema.json +40 -172
  519. package/dist/schemas/onchain_operations_guard.schema.json +3765 -294
  520. package/dist/schemas/onchain_operations_machine.schema.json +537 -164
  521. package/dist/schemas/onchain_operations_order.schema.json +126 -96
  522. package/dist/schemas/onchain_operations_payment.schema.json +82 -67
  523. package/dist/schemas/onchain_operations_permission.schema.json +331 -93
  524. package/dist/schemas/onchain_operations_personal.schema.json +636 -96
  525. package/dist/schemas/onchain_operations_progress.schema.json +125 -92
  526. package/dist/schemas/onchain_operations_proof.schema.json +76 -69
  527. package/dist/schemas/onchain_operations_repository.schema.json +636 -249
  528. package/dist/schemas/onchain_operations_reward.schema.json +218 -108
  529. package/dist/schemas/onchain_operations_service.schema.json +679 -221
  530. package/dist/schemas/onchain_operations_treasury.schema.json +401 -135
  531. package/dist/schemas/onchain_table_data.output.json +6018 -2430
  532. package/dist/schemas/onchain_table_data.schema.json +544 -430
  533. package/dist/schemas/persona_operation.output.json +1568 -265
  534. package/dist/schemas/persona_operation.schema.json +346 -202
  535. package/dist/schemas/project_operation.output.json +6957 -5147
  536. package/dist/schemas/project_operation.schema.json +1050 -1020
  537. package/dist/schemas/query_task_status.output.json +195 -99
  538. package/dist/schemas/query_task_status.schema.json +12 -18
  539. package/dist/schemas/query_toolkit.output.json +18870 -14566
  540. package/dist/schemas/query_toolkit.schema.json +614 -522
  541. package/dist/schemas/schema_query.output.json +127 -129
  542. package/dist/schemas/schema_query.schema.json +64 -69
  543. package/dist/schemas/trust_score.output.json +678 -587
  544. package/dist/schemas/trust_score.schema.json +289 -277
  545. package/dist/schemas/wip_file.output.json +116 -124
  546. package/dist/schemas/wip_file.schema.json +142 -143
  547. package/dist/schemas/workspace_operation.output.json +277 -0
  548. package/dist/schemas/workspace_operation.schema.json +45 -0
  549. package/dist/schemas/wowok_buildin_info.output.json +1693 -723
  550. package/dist/schemas/wowok_buildin_info.schema.json +576 -512
  551. package/dist/telemetry/index.js +1 -112
  552. package/dist/telemetry/redact.js +1 -23
  553. package/dist/telemetry/storage.js +1 -80
  554. package/dist/tools/handlers/bridge.d.ts +8 -1
  555. package/dist/tools/handlers/bridge.js +1 -1
  556. package/dist/tools/handlers/config.js +1 -74
  557. package/dist/tools/handlers/employee.d.ts +2 -0
  558. package/dist/tools/handlers/employee.js +1 -0
  559. package/dist/tools/handlers/evaluation.js +1 -123
  560. package/dist/tools/handlers/file-export.js +1 -90
  561. package/dist/tools/handlers/industry-pack.d.ts +2 -0
  562. package/dist/tools/handlers/industry-pack.js +1 -0
  563. package/dist/tools/handlers/intent-radar.js +1 -76
  564. package/dist/tools/handlers/local.js +1 -53
  565. package/dist/tools/handlers/messenger.js +1 -188
  566. package/dist/tools/handlers/onchain.js +1 -1180
  567. package/dist/tools/handlers/persona.js +1 -89
  568. package/dist/tools/handlers/project.js +1 -211
  569. package/dist/tools/handlers/query.js +1 -434
  570. package/dist/tools/handlers/schema-query.js +1 -176
  571. package/dist/tools/handlers/task-status.js +1 -26
  572. package/dist/tools/handlers/trust.js +1 -380
  573. package/dist/tools/handlers/wip.js +1 -90
  574. package/dist/tools/handlers/workspace.d.ts +2 -0
  575. package/dist/tools/handlers/workspace.js +1 -0
  576. package/dist/tools/index.d.ts +2 -1
  577. package/dist/tools/index.js +1 -1382
  578. package/dist/tools/retry.js +1 -85
  579. package/dist/tools/rules-hook.d.ts +1 -1
  580. package/dist/tools/rules-hook.js +1 -23
  581. package/dist/tools/shared.d.ts +1 -1
  582. package/dist/tools/shared.js +1 -130
  583. package/dist/tools/types.d.ts +2 -1
  584. package/dist/tools/types.js +1 -1
  585. package/dist/tools/upgrade-check.d.ts +19 -0
  586. package/dist/tools/upgrade-check.js +1 -0
  587. package/dist/tools/wip-deploy-assist.js +1 -306
  588. package/dist/tools/wrap.js +1 -500
  589. package/package.json +7 -6
  590. package/dist/knowledge/arbitration-trust.d.ts +0 -24
  591. package/dist/knowledge/arbitration-trust.js +0 -117
  592. package/dist/schema/call/bridge-handler.d.ts +0 -8
  593. package/dist/schema/call/bridge-handler.js +0 -265
  594. package/dist/schema/sync-layer4.d.ts +0 -21
  595. package/dist/schema/sync-layer4.js +0 -286
  596. package/dist/schema-query/index.js +0 -810
  597. /package/dist/{schema-query → schema-query-impl}/index.d.ts +0 -0
@@ -1,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)};}
@@ -0,0 +1,39 @@
1
+ export declare const CONTACT_TRANSLATION_VERSION = "1.0.0";
2
+ export interface SemanticToContactSchemaRule {
3
+ id: string;
4
+ pattern_name: string;
5
+ semantic_intent: string;
6
+ match_keywords: string[];
7
+ required_fields: string[];
8
+ optional_fields: string[];
9
+ example: Record<string, unknown>;
10
+ }
11
+ export declare const SEMANTIC_TO_CONTACT_SCHEMA_RULES: SemanticToContactSchemaRule[];
12
+ export interface ContactFieldTranslation {
13
+ field_name: string;
14
+ value_type: string;
15
+ semantic: string;
16
+ format_example: string;
17
+ validation_rules: string[];
18
+ }
19
+ export declare const CONTACT_FIELD_TRANSLATIONS: ContactFieldTranslation[];
20
+ export interface ContactConstraintRule {
21
+ id: string;
22
+ name: string;
23
+ description: string;
24
+ related_field: string;
25
+ }
26
+ export declare const CONTACT_CONSTRAINT_RULES: ContactConstraintRule[];
27
+ export interface ContactExplainInput {
28
+ description?: string;
29
+ location?: string;
30
+ im_count?: number;
31
+ bound_to_permission_um?: boolean;
32
+ }
33
+ export interface ContactExplanation {
34
+ summary: string;
35
+ location_status: string;
36
+ im_status: string;
37
+ warnings: string[];
38
+ }
39
+ export declare function explainContact(input: ContactExplainInput): ContactExplanation;
@@ -0,0 +1 @@
1
+ import{MAX_IM_COUNT}from'@wowok/wowok';export const CONTACT_TRANSLATION_VERSION='1.0.0';export const SEMANTIC_TO_CONTACT_SCHEMA_RULES=[{'id':'P-CONTACT-01','pattern_name':'Create\x20contact','semantic_intent':'Create\x20a\x20shared\x20Contact\x20object\x20owned\x20by\x20a\x20Permission\x20(index\x20450).','match_keywords':['create\x20contact','new\x20contact','customer\x20service'],'required_fields':['permission','description'],'optional_fields':[],'example':{'description':'Customer\x20service\x20contact'}},{'id':'P-CONTACT-02','pattern_name':'Add\x20IM\x20member','semantic_intent':'Add\x20an\x20IM\x20entry\x20to\x20the\x20contact\x20list\x20(permission\x20index\x20453).','match_keywords':['add\x20im','add\x20member','add\x20contact\x20im'],'required_fields':['im'],'optional_fields':['description'],'example':{'im':'0x...','description':'support\x20desk'}},{'id':'P-CONTACT-03','pattern_name':'Set\x20location','semantic_intent':'Set\x20the\x20contact\x27s\x20geographic\x20region\x20(permission\x20index\x20452,\x20LONG_NAME).','match_keywords':['set\x20location','update\x20location'],'required_fields':['location'],'optional_fields':[],'example':{'location':'cn-guangdong-shenzhen'}}];export const CONTACT_FIELD_TRANSLATIONS=[{'field_name':'description','value_type':'string','semantic':'Human-readable\x20description\x20of\x20the\x20Contact\x20(common::DESCRIPTION\x20validation).','format_example':'Customer\x20service\x20contact','validation_rules':['common::DESCRIPTION\x20max\x20length']},{'field_name':'location','value_type':'string','semantic':'Geographic\x20region\x20string;\x20defaults\x20to\x20empty\x20(unset).','format_example':'cn-guangdong-shenzhen','validation_rules':['common::LONG_NAME\x20validation','empty\x20means\x20unset']},{'field_name':'ims','value_type':'vector<Im>','semantic':'IM\x20entry\x20list\x20(≤\x20MAX_IM_COUNT\x20'+MAX_IM_COUNT+').\x20Each\x20Im\x20has\x20at/status/join_time/description.','format_example':'[{at,\x20status,\x20join_time,\x20description}]','validation_rules':['im_add\x20aborts\x20E_IM_COUNT_EXCEEDED\x20(1)\x20at\x20cap']},{'field_name':'permission','value_type':'address','semantic':'Owning\x20Permission\x20address\x20(set\x20at\x20creation).','format_example':'0x...permission...','validation_rules':['set\x20via\x20new(permission,\x20…)\x20index\x20450']}];export const CONTACT_CONSTRAINT_RULES=[{'id':'CONTACT_C_01','name':'IM\x20count\x20cap','description':'ims\x20length\x20<\x20MAX_IM_COUNT\x20('+MAX_IM_COUNT+').','related_field':'ims'},{'id':'CONTACT_C_02','name':'description\x20validation','description':'description\x20uses\x20common::DESCRIPTION.','related_field':'description'},{'id':'CONTACT_C_03','name':'location\x20validation','description':'location\x20uses\x20common::LONG_NAME.','related_field':'location'},{'id':'CONTACT_C_04','name':'im\x20description\x20validation','description':'im_add\x20description\x20uses\x20common::LONG_NAME\x20(not\x20DESCRIPTION).','related_field':'ims'},{'id':'CONTACT_C_05','name':'permission\x20gating','description':'create=450,\x20description_set=451,\x20location_set=452,\x20im_add/remove/clear=453,\x20owner_receive=454.','related_field':'permission'}];export function explainContact(a){const b=[],c=a['location']?'location=\x22'+a['location']+'\x22':'location\x20unset\x20(empty\x20string)',d=a['im_count']!==undefined?a['im_count']+'/'+MAX_IM_COUNT+'\x20IM\x20entries':'IM\x20count\x20unknown';return a['im_count']!==undefined&&a['im_count']>=MAX_IM_COUNT&&b['push']('IM\x20list\x20at\x20cap\x20('+MAX_IM_COUNT+');\x20im_add\x20will\x20abort\x20E_IM_COUNT_EXCEEDED'),a['bound_to_permission_um']&&b['push']('Contact\x20is\x20bound\x20as\x20Permission.um;\x20unbind\x20before\x20deletion'),{'summary':'Contact\x20('+(a['description']??'no\x20description')+').\x20'+c+'.\x20'+d+'.','location_status':c,'im_status':d,'warnings':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');}
@@ -0,0 +1,17 @@
1
+ import { type DemandScene } from "./demand-ledger.js";
2
+ export declare const DEMAND_CONTEXT_VERSION = "1.0.0";
3
+ export interface DemandContextBundle {
4
+ scene?: DemandScene;
5
+ rewarded: boolean;
6
+ guarded: boolean;
7
+ summary: string;
8
+ }
9
+ export interface BuildDemandContextInput {
10
+ description?: string;
11
+ reward_count?: number;
12
+ guard_count?: number;
13
+ }
14
+ export declare function buildDemandContext(input: BuildDemandContextInput): DemandContextBundle;
15
+ export declare function getDemandContextSummary(ctx: DemandContextBundle): string;
16
+ export declare function isRewardedDemand(ctx: DemandContextBundle): boolean;
17
+ export declare function getDemandSceneByIdSafe(id: string): DemandScene | undefined;
@@ -0,0 +1 @@
1
+ import{getDemandSceneById}from'./demand-ledger.js';export const DEMAND_CONTEXT_VERSION='1.0.0';export function buildDemandContext(a){const b=(a['reward_count']??0x0)>0x0,c=(a['guard_count']??0x0)>0x0,d=[];return a['description']&&d['push']('demand\x20\x22'+a['description']+'\x22'),d['push'](b?'rewarded':'not\x20rewarded'),d['push'](c?'guarded\x20present':'open\x20present'),{'scene':undefined,'rewarded':b,'guarded':c,'summary':d['join']('\x20·\x20')};}export function getDemandContextSummary(a){return a['summary'];}export function isRewardedDemand(a){return a['rewarded'];}export function getDemandSceneByIdSafe(a){return getDemandSceneById(a);}
@@ -0,0 +1,26 @@
1
+ export declare const DEMAND_LEDGER_VERSION = "1.0.0";
2
+ export type DemandSceneClassification = "publish" | "present" | "feedback";
3
+ export interface DemandScene {
4
+ id: string;
5
+ classification: DemandSceneClassification;
6
+ semantic: string;
7
+ }
8
+ export declare const DEMAND_SCENES: DemandScene[];
9
+ export interface DemandFieldEntry {
10
+ field: string;
11
+ value_type: string;
12
+ semantic: string;
13
+ required: boolean;
14
+ }
15
+ export declare const DEMAND_FIELDS: DemandFieldEntry[];
16
+ export interface DemandErrorEntry {
17
+ code: string;
18
+ value: number;
19
+ description: string;
20
+ }
21
+ export declare const DEMAND_ERROR_CODES: DemandErrorEntry[];
22
+ export declare function getDemandField(field: string): DemandFieldEntry | undefined;
23
+ export declare function getDemandErrorByCode(code: string): DemandErrorEntry | undefined;
24
+ export declare function getDemandErrorByValue(value: number): DemandErrorEntry | undefined;
25
+ export declare function getDemandSceneById(id: string): DemandScene | undefined;
26
+ export declare function inferDemandSceneFromIntent(intent: string): DemandScene | undefined;
@@ -0,0 +1 @@
1
+ export const DEMAND_LEDGER_VERSION='1.0.0';export const DEMAND_SCENES=[{'id':'demand_publish','classification':'publish','semantic':'Create\x20+\x20share\x20the\x20Demand\x20(description\x20+\x20location\x20+\x20rewards\x20+\x20guards).'},{'id':'demand_present','classification':'present','semantic':'A\x20presenter\x20(service/merchant)\x20submits\x20a\x20recommendation\x20to\x20the\x20Demand.'},{'id':'demand_feedback','classification':'feedback','semantic':'Demand\x20owner\x20rates\x20a\x20presenter\x27s\x20submission\x20(acceptance_score\x20+\x20feedback).'}];export const DEMAND_FIELDS=[{'field':'description','value_type':'string','semantic':'Demand\x20description\x20(common::DESCRIPTION\x20validation).','required':!![]},{'field':'location','value_type':'string','semantic':'Geographic\x20region\x20string\x20(structured\x20via\x20region.ts).','required':!![]},{'field':'rewards','value_type':'vector<address>','semantic':'Reward\x20objects\x20offered\x20(≤\x20MAX_REWARD_COUNT\x2020).','required':![]},{'field':'guards','value_type':'vector<ServiceGuard>','semantic':'Guards\x20a\x20presenter\x20must\x20pass\x20to\x20present\x20(≤\x20MAX_GUARD_COUNT\x2020).','required':![]},{'field':'presenters','value_type':'ParentTable<address,\x20ServiceInfo>','semantic':'Presenter\x20submissions\x20(who\x20→\x20recommend/service/acceptance).','required':![]},{'field':'um','value_type':'Option<address>','semantic':'User\x20manager\x20(optional).','required':![]},{'field':'permission','value_type':'address','semantic':'Owning\x20Permission\x20organization.','required':!![]}];export const DEMAND_ERROR_CODES=[{'code':'E_MAX_REWARD_COUNT_EXCEEDED','value':0x1,'description':'rewards\x20>\x20MAX_REWARD_COUNT\x20(20).'},{'code':'E_MAX_GUARD_COUNT_EXCEEDED','value':0x2,'description':'guards\x20>\x20MAX_GUARD_COUNT\x20(20).'},{'code':'E_NEED_PASSPORT','value':0x3,'description':'present\x20requires\x20empty\x20guards\x20(no\x20guard\x20→\x20no\x20passport).'},{'code':'E_GUARD_NOT_FOUND','value':0x4,'description':'Referenced\x20guard\x20not\x20found.'}];export function getDemandField(a){return DEMAND_FIELDS['find'](b=>b['field']===a);}export function getDemandErrorByCode(a){return DEMAND_ERROR_CODES['find'](b=>b['code']===a);}export function getDemandErrorByValue(a){return DEMAND_ERROR_CODES['find'](b=>b['value']===a);}export function getDemandSceneById(a){return DEMAND_SCENES['find'](b=>b['id']===a);}export function inferDemandSceneFromIntent(a){const b=a['toLowerCase']();if(/(publish|post|announce|create|发需求|发布)/['test'](b))return DEMAND_SCENES['find'](c=>c['classification']==='publish');if(/(present|apply|submit|bid|报价|应征)/['test'](b))return DEMAND_SCENES['find'](c=>c['classification']==='present');if(/(feedback|accept|score|rate|评价|采纳)/['test'](b))return DEMAND_SCENES['find'](c=>c['classification']==='feedback');return undefined;}