@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,286 +1 @@
1
- import { MAX_POLICY_COUNT, MAX_POLICY_DESCRIPTION_LEN, MAX_POLICY_GUARD_COUNT, MAX_DATA_SIZE, MAX_ID_COUNT_ONCE, MAX_REWARD_COUNT, } from "@wowok/wowok";
2
- function normalizeIdFrom(v) {
3
- if (typeof v === "number")
4
- return v;
5
- const lower = String(v).toLowerCase();
6
- if (lower === "none")
7
- return 0;
8
- if (lower === "clock")
9
- return 1;
10
- if (lower === "signer")
11
- return 2;
12
- const parsed = Number(v);
13
- return Number.isNaN(parsed) ? -1 : parsed;
14
- }
15
- function checkPolicyCount(input) {
16
- if (!input.policies || input.existing_policy_count === undefined) {
17
- return {
18
- id: "C-REP-01",
19
- severity: "info",
20
- title: `Policy count within MAX_POLICY_COUNT (${MAX_POLICY_COUNT})`,
21
- description: "Skipped: no policy count provided.",
22
- passed: true,
23
- };
24
- }
25
- const total = input.existing_policy_count + input.policies.length;
26
- const passed = total <= MAX_POLICY_COUNT;
27
- return {
28
- id: "C-REP-01",
29
- severity: passed ? "info" : "block",
30
- title: `Policy count within MAX_POLICY_COUNT (${MAX_POLICY_COUNT})`,
31
- description: "A single Repository may hold up to MAX_POLICY_COUNT policies. Exceeding aborts with E_POLICY_COUNT_EXCEEDED (3). " +
32
- "Each policy is a named data slot with its own write_guard and id_from routing.",
33
- passed,
34
- evidence: `existing=${input.existing_policy_count}, adding=${input.policies.length}, total=${total}`,
35
- fix_hint: `Consolidate or split across multiple Repository objects. Limit=${MAX_POLICY_COUNT}.`,
36
- };
37
- }
38
- function checkWriteGuardRequiredWhenIdFromNone(input) {
39
- if (!input.policies) {
40
- return { id: "C-REP-02", severity: "info", title: "write_guard/id_from consistency (R-D-1)", description: "Skipped: no policies.", passed: true };
41
- }
42
- const offenders = input.policies.filter(p => normalizeIdFrom(p.id_from) === 0 && p.write_guard_count === 0);
43
- const passed = offenders.length === 0;
44
- return {
45
- id: "C-REP-02",
46
- severity: passed ? "info" : "block",
47
- title: "write_guard non-empty when id_from=None (R-D-1 Move assert)",
48
- description: "When id_from is None, the data ID comes from the caller — without write_guard, ANY address can write " +
49
- "data with any ID. Move aborts with E_POLICY_WRITE_GUARD_REQUIRED (22) in policy_add_imp() [R-D-1=A].",
50
- passed,
51
- evidence: passed ? "all policies with id_from=None have write_guard" :
52
- `offenders: ${offenders.map(p => p.name).join(", ")}`,
53
- fix_hint: "Add at least one PolicyGuard to write_guard, OR switch id_from to Clock/Signer.",
54
- };
55
- }
56
- function checkWriteGuardForbiddenWhenIdFromClockSigner(input) {
57
- if (!input.policies) {
58
- return { id: "C-REP-03", severity: "info", title: "id_from_submission null when id_from=Clock/Signer (R-D-1)", description: "Skipped: no policies.", passed: true };
59
- }
60
- const offenders = input.policies.filter(p => {
61
- const idFrom = normalizeIdFrom(p.id_from);
62
- return (idFrom === 1 || idFrom === 2) && p.has_id_from_submission;
63
- });
64
- const passed = offenders.length === 0;
65
- return {
66
- id: "C-REP-03",
67
- severity: passed ? "info" : "block",
68
- title: "id_from_submission null when id_from=Clock/Signer (R-D-1 Move assert)",
69
- description: "When id_from is Clock/Signer, the ID is auto-generated — id_from_submission would conflict. " +
70
- "data_from_submission is still allowed (used by data_when_id_from_set_with_passport). " +
71
- "Move aborts with E_POLICY_ID_FROM_SUBMISSION_FORBIDDEN (23) in policy_add_imp() [R-D-1=A, refined].",
72
- passed,
73
- evidence: passed ? "all policies with id_from=Clock/Signer have id_from_submission=null" :
74
- `offenders: ${offenders.map(p => `${p.name}(id_from=${p.id_from})`).join(", ")}`,
75
- fix_hint: "Set id_from_submission=null on all write_guard entries, OR switch id_from to None.",
76
- };
77
- }
78
- function checkPolicyGuardCount(input) {
79
- if (!input.policies) {
80
- return { id: "C-REP-04", severity: "info", title: `write_guard count ≤ ${MAX_POLICY_GUARD_COUNT}`, description: "Skipped: no policies.", passed: true };
81
- }
82
- const offenders = input.policies.filter(p => p.write_guard_count > MAX_POLICY_GUARD_COUNT);
83
- const passed = offenders.length === 0;
84
- return {
85
- id: "C-REP-04",
86
- severity: passed ? "info" : "block",
87
- title: `Each policy write_guard count ≤ MAX_POLICY_GUARD_COUNT (${MAX_POLICY_GUARD_COUNT})`,
88
- description: "Each policy may define up to MAX_POLICY_GUARD_COUNT guard entries. Move aborts with E_POLICY_GUARD_COUNT_EXCEEDED (2).",
89
- passed,
90
- evidence: passed ? "all policies within limit" :
91
- `offenders: ${offenders.map(p => `${p.name}(${p.write_guard_count})`).join(", ")}`,
92
- fix_hint: `Reduce write_guard entries to ≤ ${MAX_POLICY_GUARD_COUNT} per policy.`,
93
- };
94
- }
95
- function checkPolicyDescription(input) {
96
- if (!input.policies) {
97
- return { id: "C-REP-05", severity: "info", title: `Policy description ≤ ${MAX_POLICY_DESCRIPTION_LEN}`, description: "Skipped: no policies.", passed: true };
98
- }
99
- const offenders = input.policies.filter(p => p.description !== undefined && p.description.length > MAX_POLICY_DESCRIPTION_LEN);
100
- const passed = offenders.length === 0;
101
- return {
102
- id: "C-REP-05",
103
- severity: passed ? "info" : "block",
104
- title: `Each policy description ≤ MAX_POLICY_DESCRIPTION_LEN (${MAX_POLICY_DESCRIPTION_LEN})`,
105
- description: "Policy description is bounded by MAX_POLICY_DESCRIPTION_LEN. Move aborts with E_POLICY_DESCRIPTION_EXCEEDED (1).",
106
- passed,
107
- evidence: passed ? "all descriptions within limit" :
108
- `offenders: ${offenders.map(p => `${p.name}(len=${p.description.length})`).join(", ")}`,
109
- fix_hint: `Shorten policy descriptions to ≤ ${MAX_POLICY_DESCRIPTION_LEN} chars.`,
110
- };
111
- }
112
- function checkDataSize(input) {
113
- if (input.data_size === undefined) {
114
- return { id: "C-REP-06", severity: "info", title: `Data value ≤ MAX_DATA_SIZE (${MAX_DATA_SIZE})`, description: "Skipped: no data_size.", passed: true };
115
- }
116
- const passed = input.data_size <= MAX_DATA_SIZE;
117
- return {
118
- id: "C-REP-06",
119
- severity: passed ? "info" : "block",
120
- title: `Data value ≤ MAX_DATA_SIZE (${MAX_DATA_SIZE} bytes)`,
121
- description: "Each data value must be ≤ MAX_DATA_SIZE bytes (BCS-serialized, type-tag prefixed). Move aborts with E_DATA_EXCEEDED (4). " +
122
- "Store large payloads off-chain and reference by hash.",
123
- passed,
124
- evidence: `data_size=${input.data_size}, limit=${MAX_DATA_SIZE}`,
125
- fix_hint: `Store large data off-chain; write only the content hash. Limit=${MAX_DATA_SIZE} bytes.`,
126
- };
127
- }
128
- function checkIdCountOnce(input) {
129
- if (input.id_count_once === undefined) {
130
- return { id: "C-REP-07", severity: "info", title: `ID count ≤ MAX_ID_COUNT_ONCE (${MAX_ID_COUNT_ONCE})`, description: "Skipped: no id_count.", passed: true };
131
- }
132
- const passed = input.id_count_once <= MAX_ID_COUNT_ONCE;
133
- return {
134
- id: "C-REP-07",
135
- severity: passed ? "info" : "block",
136
- title: `ID count per op ≤ MAX_ID_COUNT_ONCE (${MAX_ID_COUNT_ONCE})`,
137
- description: "A single Repository call may operate on at most MAX_ID_COUNT_ONCE IDs. Move aborts with E_ID_COUNT_EXCEEDED (5). " +
138
- "Batch large operations across multiple transactions.",
139
- passed,
140
- evidence: `id_count=${input.id_count_once}, limit=${MAX_ID_COUNT_ONCE}`,
141
- fix_hint: `Split into batches of ≤ ${MAX_ID_COUNT_ONCE} IDs per transaction.`,
142
- };
143
- }
144
- function checkRewardCount(input) {
145
- if (input.reward_count === undefined) {
146
- return { id: "C-REP-08", severity: "info", title: `Reward count ≤ MAX_REWARD_COUNT (${MAX_REWARD_COUNT})`, description: "Skipped: no reward_count.", passed: true };
147
- }
148
- const passed = input.reward_count <= MAX_REWARD_COUNT;
149
- return {
150
- id: "C-REP-08",
151
- severity: passed ? "info" : "block",
152
- title: `Reward count ≤ MAX_REWARD_COUNT (${MAX_REWARD_COUNT})`,
153
- description: "A Repository may reference up to MAX_REWARD_COUNT Reward objects. Move aborts with E_MAX_REWARD_COUNT_EXCEEDED (19).",
154
- passed,
155
- evidence: `reward_count=${input.reward_count}, limit=${MAX_REWARD_COUNT}`,
156
- fix_hint: `Consolidate rewards or use a separate Repository. Limit=${MAX_REWARD_COUNT}.`,
157
- };
158
- }
159
- function checkDataRemoveWithPassportSubmission(input) {
160
- if (!input.is_data_remove_with_passport || !input.policies) {
161
- return { id: "C-REP-09", severity: "info", title: "id_data_remove_with_passport submission check (R-D-2)", description: "Skipped: not applicable.", passed: true };
162
- }
163
- const offenders = input.policies.filter(p => p.has_data_from_submission);
164
- const passed = offenders.length === 0;
165
- return {
166
- id: "C-REP-09",
167
- severity: passed ? "info" : "block",
168
- title: "id_data_remove_with_passport: no data_from_submission (R-D-2 Move assert)",
169
- description: "id_data_remove_with_passport only removes data by caller-provided id; it cannot consume Passport " +
170
- "submissions. Move now checks BOTH id_from_submission AND data_from_submission are None [R-D-2=A], " +
171
- "aborting with E_GUARD_SPECIFIED_ID_FROM_SUBMISSION (11).",
172
- passed,
173
- evidence: passed ? "no policies with data_from_submission" :
174
- `offenders: ${offenders.map(p => p.name).join(", ")}`,
175
- fix_hint: "Use id_data_mixed_remove_with_passport for submission-based removal, or unset data_from_submission.",
176
- };
177
- }
178
- function checkIdFromString(input) {
179
- if (!input.policies) {
180
- return { id: "C-REP-10", severity: "info", title: "id_from string form valid (P1-2 parseIdFrom)", description: "Skipped: no policies.", passed: true };
181
- }
182
- const offenders = input.policies.filter(p => {
183
- const n = normalizeIdFrom(p.id_from);
184
- return n < 0 || n > 2;
185
- });
186
- const passed = offenders.length === 0;
187
- return {
188
- id: "C-REP-10",
189
- severity: passed ? "info" : "warn",
190
- title: "id_from string form is recognized (P1-2 parseIdFrom)",
191
- description: "SDK parseIdFrom normalizes string id_from (e.g. \"none\"/\"clock\"/\"signer\") to numeric enum before " +
192
- "comparison [P1-2 fix]. Unrecognized values fall through to Move which aborts with E_INVALID_ID_FROM (18).",
193
- passed,
194
- evidence: passed ? "all id_from values recognized" :
195
- `offenders: ${offenders.map(p => `${p.name}(id_from=${p.id_from})`).join(", ")}`,
196
- fix_hint: "Use 0/1/2, or 'None'/'Clock'/'Signer' (case-insensitive).",
197
- };
198
- }
199
- function checkQuoteGuardIsDepended(input) {
200
- if (!input.has_quote_guard) {
201
- return { id: "C-REP-11", severity: "info", title: "quote_guard is_depended check", description: "Skipped: no quote_guard set.", passed: true };
202
- }
203
- const passed = input.quote_guard_is_depended === true;
204
- return {
205
- id: "C-REP-11",
206
- severity: passed ? "info" : "block",
207
- title: "quote_guard satisfies is_depended (immutable + rep=true + no relies)",
208
- description: "When quote_guard is set, it MUST satisfy guard::is_depended (guard.move#L133-135): " +
209
- "immutable=true, relies empty, rep=true. Move aborts with E_NEED_DEPENDENT_GUARD (repository.move#L422). " +
210
- "VERIFIED: passport.rs#L545-612 — check_repository_quote_guard enforces this at query time. " +
211
- "quote_guard is a RIGID verification requirement: any guard querying this Repository's data must satisfy it.",
212
- passed,
213
- evidence: passed ? "quote_guard is is_depended" : "quote_guard NOT is_depended (will abort)",
214
- fix_hint: "Ensure the quote_guard Guard object has: immutable=true, relies=empty, rep=true.",
215
- };
216
- }
217
- function checkQuoteGuardSubscriptionDesign(input) {
218
- if (!input.has_quote_guard) {
219
- return { id: "C-REP-12", severity: "info", title: "quote_guard subscription design check", description: "Skipped: no quote_guard set.", passed: true };
220
- }
221
- const issues = [];
222
- if (!input.quote_guard_verifies_payment)
223
- issues.push("quote_guard does not verify Payment for subscription");
224
- if (!input.has_owner_receive)
225
- issues.push("Repository missing owner_receive for Payment revenue");
226
- const passed = issues.length === 0;
227
- return {
228
- id: "C-REP-12",
229
- severity: passed ? "info" : "warn",
230
- title: "quote_guard data subscription design — Payment verification + owner_receive revenue",
231
- description: "For data subscription pattern (Repository+quote_guard+Payment): " +
232
- "(1) quote_guard should verify Payment (for_object matches Repository, amount meets subscription price); " +
233
- "(2) Repository should have owner_receive<T> configured to accept Payment as subscription revenue " +
234
- "(repository.move#L714-717). VERIFIED: passport.rs#L545-612. " +
235
- "DESIGN: user submits Payment via Passport → quote_guard verifies → repository data query passes.",
236
- passed,
237
- evidence: passed ? "quote_guard subscription design complete" : issues.join("; "),
238
- fix_hint: "Use tpl_repository_quote_guard_subscription (guard-templates.ts) as the design template.",
239
- };
240
- }
241
- export function preCheckRepositoryOp(input) {
242
- return [
243
- checkPolicyCount(input),
244
- checkWriteGuardRequiredWhenIdFromNone(input),
245
- checkWriteGuardForbiddenWhenIdFromClockSigner(input),
246
- checkPolicyGuardCount(input),
247
- checkPolicyDescription(input),
248
- checkDataSize(input),
249
- checkIdCountOnce(input),
250
- checkRewardCount(input),
251
- checkDataRemoveWithPassportSubmission(input),
252
- checkIdFromString(input),
253
- checkQuoteGuardIsDepended(input),
254
- checkQuoteGuardSubscriptionDesign(input),
255
- ];
256
- }
257
- export function canProceedRepositoryOp(input) {
258
- const items = preCheckRepositoryOp(input);
259
- return {
260
- canProceed: items.every(i => i.severity !== "block" || i.passed),
261
- blockers: items.filter(i => i.severity === "block" && !i.passed),
262
- warnings: items.filter(i => i.severity === "warn" && !i.passed),
263
- info: items.filter(i => i.severity === "info"),
264
- };
265
- }
266
- export function formatRepositoryOpSummary(input) {
267
- const { canProceed, blockers, warnings, info } = canProceedRepositoryOp(input);
268
- const lines = [];
269
- lines.push(canProceed ? `✓ Repository ${input.op} pre-check PASSED` : `✗ Repository ${input.op} pre-check FAILED`);
270
- lines.push("");
271
- if (blockers.length > 0) {
272
- lines.push("BLOCKERS (must fix before operation):");
273
- blockers.forEach(b => lines.push(` [${b.id}] ${b.title} — ${b.evidence ?? ""}`));
274
- lines.push("");
275
- }
276
- if (warnings.length > 0) {
277
- lines.push("WARNINGS (review recommended):");
278
- warnings.forEach(w => lines.push(` [${w.id}] ${w.title} — ${w.evidence ?? ""}`));
279
- lines.push("");
280
- }
281
- if (info.length > 0) {
282
- lines.push("INFO:");
283
- info.forEach(i => lines.push(` [${i.id}] ${i.title}`));
284
- }
285
- return lines.join("\n");
286
- }
1
+ import{MAX_POLICY_COUNT,MAX_POLICY_DESCRIPTION_LEN,MAX_POLICY_GUARD_COUNT,MAX_DATA_SIZE,MAX_ID_COUNT_ONCE,MAX_REWARD_COUNT}from'@wowok/wowok';function normalizeIdFrom(a){if(typeof a==='number')return a;const b=String(a)['toLowerCase']();if(b==='none')return 0x0;if(b==='clock')return 0x1;if(b==='signer')return 0x2;const c=Number(a);return Number['isNaN'](c)?-0x1:c;}function checkPolicyCount(a){if(!a['policies']||a['existing_policy_count']===undefined)return{'id':'C-REP-01','severity':'info','title':'Policy\x20count\x20within\x20MAX_POLICY_COUNT\x20('+MAX_POLICY_COUNT+')','description':'Skipped:\x20no\x20policy\x20count\x20provided.','passed':!![]};const b=a['existing_policy_count']+a['policies']['length'],c=b<=MAX_POLICY_COUNT;return{'id':'C-REP-01','severity':c?'info':'block','title':'Policy\x20count\x20within\x20MAX_POLICY_COUNT\x20('+MAX_POLICY_COUNT+')','description':'A\x20single\x20Repository\x20may\x20hold\x20up\x20to\x20MAX_POLICY_COUNT\x20policies.\x20Exceeding\x20aborts\x20with\x20E_POLICY_COUNT_EXCEEDED\x20(3).\x20'+'Each\x20policy\x20is\x20a\x20named\x20data\x20slot\x20with\x20its\x20own\x20write_guard\x20and\x20id_from\x20routing.','passed':c,'evidence':'existing='+a['existing_policy_count']+',\x20adding='+a['policies']['length']+',\x20total='+b,'fix_hint':'Consolidate\x20or\x20split\x20across\x20multiple\x20Repository\x20objects.\x20Limit='+MAX_POLICY_COUNT+'.'};}function checkWriteGuardRequiredWhenIdFromNone(a){if(!a['policies'])return{'id':'C-REP-02','severity':'info','title':'write_guard/id_from\x20consistency\x20(R-D-1)','description':'Skipped:\x20no\x20policies.','passed':!![]};const b=a['policies']['filter'](d=>normalizeIdFrom(d['id_from'])===0x0&&d['write_guard_count']===0x0),c=b['length']===0x0;return{'id':'C-REP-02','severity':c?'info':'block','title':'write_guard\x20non-empty\x20when\x20id_from=None\x20(R-D-1\x20Move\x20assert)','description':'When\x20id_from\x20is\x20None,\x20the\x20data\x20ID\x20comes\x20from\x20the\x20caller\x20—\x20without\x20write_guard,\x20ANY\x20address\x20can\x20write\x20'+'data\x20with\x20any\x20ID.\x20Move\x20aborts\x20with\x20E_POLICY_WRITE_GUARD_REQUIRED\x20(22)\x20in\x20policy_add_imp()\x20[R-D-1=A].','passed':c,'evidence':c?'all\x20policies\x20with\x20id_from=None\x20have\x20write_guard':'offenders:\x20'+b['map'](d=>d['name'])['join'](',\x20'),'fix_hint':'Add\x20at\x20least\x20one\x20PolicyGuard\x20to\x20write_guard,\x20OR\x20switch\x20id_from\x20to\x20Clock/Signer.'};}function checkWriteGuardForbiddenWhenIdFromClockSigner(a){if(!a['policies'])return{'id':'C-REP-03','severity':'info','title':'id_from_submission\x20null\x20when\x20id_from=Clock/Signer\x20(R-D-1)','description':'Skipped:\x20no\x20policies.','passed':!![]};const b=a['policies']['filter'](d=>{const e=normalizeIdFrom(d['id_from']);return(e===0x1||e===0x2)&&d['has_id_from_submission'];}),c=b['length']===0x0;return{'id':'C-REP-03','severity':c?'info':'block','title':'id_from_submission\x20null\x20when\x20id_from=Clock/Signer\x20(R-D-1\x20Move\x20assert)','description':'When\x20id_from\x20is\x20Clock/Signer,\x20the\x20ID\x20is\x20auto-generated\x20—\x20id_from_submission\x20would\x20conflict.\x20'+'data_from_submission\x20is\x20still\x20allowed\x20(used\x20by\x20data_when_id_from_set_with_passport).\x20'+'Move\x20aborts\x20with\x20E_POLICY_ID_FROM_SUBMISSION_FORBIDDEN\x20(23)\x20in\x20policy_add_imp()\x20[R-D-1=A,\x20refined].','passed':c,'evidence':c?'all\x20policies\x20with\x20id_from=Clock/Signer\x20have\x20id_from_submission=null':'offenders:\x20'+b['map'](d=>d['name']+'(id_from='+d['id_from']+')')['join'](',\x20'),'fix_hint':'Set\x20id_from_submission=null\x20on\x20all\x20write_guard\x20entries,\x20OR\x20switch\x20id_from\x20to\x20None.'};}function checkPolicyGuardCount(a){if(!a['policies'])return{'id':'C-REP-04','severity':'info','title':'write_guard\x20count\x20≤\x20'+MAX_POLICY_GUARD_COUNT,'description':'Skipped:\x20no\x20policies.','passed':!![]};const b=a['policies']['filter'](d=>d['write_guard_count']>MAX_POLICY_GUARD_COUNT),c=b['length']===0x0;return{'id':'C-REP-04','severity':c?'info':'block','title':'Each\x20policy\x20write_guard\x20count\x20≤\x20MAX_POLICY_GUARD_COUNT\x20('+MAX_POLICY_GUARD_COUNT+')','description':'Each\x20policy\x20may\x20define\x20up\x20to\x20MAX_POLICY_GUARD_COUNT\x20guard\x20entries.\x20Move\x20aborts\x20with\x20E_POLICY_GUARD_COUNT_EXCEEDED\x20(2).','passed':c,'evidence':c?'all\x20policies\x20within\x20limit':'offenders:\x20'+b['map'](d=>d['name']+'('+d['write_guard_count']+')')['join'](',\x20'),'fix_hint':'Reduce\x20write_guard\x20entries\x20to\x20≤\x20'+MAX_POLICY_GUARD_COUNT+'\x20per\x20policy.'};}function checkPolicyDescription(a){if(!a['policies'])return{'id':'C-REP-05','severity':'info','title':'Policy\x20description\x20≤\x20'+MAX_POLICY_DESCRIPTION_LEN,'description':'Skipped:\x20no\x20policies.','passed':!![]};const b=a['policies']['filter'](d=>d['description']!==undefined&&d['description']['length']>MAX_POLICY_DESCRIPTION_LEN),c=b['length']===0x0;return{'id':'C-REP-05','severity':c?'info':'block','title':'Each\x20policy\x20description\x20≤\x20MAX_POLICY_DESCRIPTION_LEN\x20('+MAX_POLICY_DESCRIPTION_LEN+')','description':'Policy\x20description\x20is\x20bounded\x20by\x20MAX_POLICY_DESCRIPTION_LEN.\x20Move\x20aborts\x20with\x20E_POLICY_DESCRIPTION_EXCEEDED\x20(1).','passed':c,'evidence':c?'all\x20descriptions\x20within\x20limit':'offenders:\x20'+b['map'](d=>d['name']+'(len='+d['description']['length']+')')['join'](',\x20'),'fix_hint':'Shorten\x20policy\x20descriptions\x20to\x20≤\x20'+MAX_POLICY_DESCRIPTION_LEN+'\x20chars.'};}function checkDataSize(a){if(a['data_size']===undefined)return{'id':'C-REP-06','severity':'info','title':'Data\x20value\x20≤\x20MAX_DATA_SIZE\x20('+MAX_DATA_SIZE+')','description':'Skipped:\x20no\x20data_size.','passed':!![]};const b=a['data_size']<=MAX_DATA_SIZE;return{'id':'C-REP-06','severity':b?'info':'block','title':'Data\x20value\x20≤\x20MAX_DATA_SIZE\x20('+MAX_DATA_SIZE+'\x20bytes)','description':'Each\x20data\x20value\x20must\x20be\x20≤\x20MAX_DATA_SIZE\x20bytes\x20(BCS-serialized,\x20type-tag\x20prefixed).\x20Move\x20aborts\x20with\x20E_DATA_EXCEEDED\x20(4).\x20'+'Store\x20large\x20payloads\x20off-chain\x20and\x20reference\x20by\x20hash.','passed':b,'evidence':'data_size='+a['data_size']+',\x20limit='+MAX_DATA_SIZE,'fix_hint':'Store\x20large\x20data\x20off-chain;\x20write\x20only\x20the\x20content\x20hash.\x20Limit='+MAX_DATA_SIZE+'\x20bytes.'};}function checkIdCountOnce(a){if(a['id_count_once']===undefined)return{'id':'C-REP-07','severity':'info','title':'ID\x20count\x20≤\x20MAX_ID_COUNT_ONCE\x20('+MAX_ID_COUNT_ONCE+')','description':'Skipped:\x20no\x20id_count.','passed':!![]};const b=a['id_count_once']<=MAX_ID_COUNT_ONCE;return{'id':'C-REP-07','severity':b?'info':'block','title':'ID\x20count\x20per\x20op\x20≤\x20MAX_ID_COUNT_ONCE\x20('+MAX_ID_COUNT_ONCE+')','description':'A\x20single\x20Repository\x20call\x20may\x20operate\x20on\x20at\x20most\x20MAX_ID_COUNT_ONCE\x20IDs.\x20Move\x20aborts\x20with\x20E_ID_COUNT_EXCEEDED\x20(5).\x20'+'Batch\x20large\x20operations\x20across\x20multiple\x20transactions.','passed':b,'evidence':'id_count='+a['id_count_once']+',\x20limit='+MAX_ID_COUNT_ONCE,'fix_hint':'Split\x20into\x20batches\x20of\x20≤\x20'+MAX_ID_COUNT_ONCE+'\x20IDs\x20per\x20transaction.'};}function checkRewardCount(a){if(a['reward_count']===undefined)return{'id':'C-REP-08','severity':'info','title':'Reward\x20count\x20≤\x20MAX_REWARD_COUNT\x20('+MAX_REWARD_COUNT+')','description':'Skipped:\x20no\x20reward_count.','passed':!![]};const b=a['reward_count']<=MAX_REWARD_COUNT;return{'id':'C-REP-08','severity':b?'info':'block','title':'Reward\x20count\x20≤\x20MAX_REWARD_COUNT\x20('+MAX_REWARD_COUNT+')','description':'A\x20Repository\x20may\x20reference\x20up\x20to\x20MAX_REWARD_COUNT\x20Reward\x20objects.\x20Move\x20aborts\x20with\x20E_MAX_REWARD_COUNT_EXCEEDED\x20(19).','passed':b,'evidence':'reward_count='+a['reward_count']+',\x20limit='+MAX_REWARD_COUNT,'fix_hint':'Consolidate\x20rewards\x20or\x20use\x20a\x20separate\x20Repository.\x20Limit='+MAX_REWARD_COUNT+'.'};}function checkDataRemoveWithPassportSubmission(a){if(!a['is_data_remove_with_passport']||!a['policies'])return{'id':'C-REP-09','severity':'info','title':'id_data_remove_with_passport\x20submission\x20check\x20(R-D-2)','description':'Skipped:\x20not\x20applicable.','passed':!![]};const b=a['policies']['filter'](d=>d['has_data_from_submission']),c=b['length']===0x0;return{'id':'C-REP-09','severity':c?'info':'block','title':'id_data_remove_with_passport:\x20no\x20data_from_submission\x20(R-D-2\x20Move\x20assert)','description':'id_data_remove_with_passport\x20only\x20removes\x20data\x20by\x20caller-provided\x20id;\x20it\x20cannot\x20consume\x20Passport\x20'+'submissions.\x20Move\x20now\x20checks\x20BOTH\x20id_from_submission\x20AND\x20data_from_submission\x20are\x20None\x20[R-D-2=A],\x20'+'aborting\x20with\x20E_GUARD_SPECIFIED_ID_FROM_SUBMISSION\x20(11).','passed':c,'evidence':c?'no\x20policies\x20with\x20data_from_submission':'offenders:\x20'+b['map'](d=>d['name'])['join'](',\x20'),'fix_hint':'Use\x20id_data_mixed_remove_with_passport\x20for\x20submission-based\x20removal,\x20or\x20unset\x20data_from_submission.'};}function checkIdFromString(a){if(!a['policies'])return{'id':'C-REP-10','severity':'info','title':'id_from\x20string\x20form\x20valid\x20(P1-2\x20parseIdFrom)','description':'Skipped:\x20no\x20policies.','passed':!![]};const b=a['policies']['filter'](d=>{const e=normalizeIdFrom(d['id_from']);return e<0x0||e>0x2;}),c=b['length']===0x0;return{'id':'C-REP-10','severity':c?'info':'warn','title':'id_from\x20string\x20form\x20is\x20recognized\x20(P1-2\x20parseIdFrom)','description':'SDK\x20parseIdFrom\x20normalizes\x20string\x20id_from\x20(e.g.\x20\x22none\x22/\x22clock\x22/\x22signer\x22)\x20to\x20numeric\x20enum\x20before\x20'+'comparison\x20[P1-2\x20fix].\x20Unrecognized\x20values\x20fall\x20through\x20to\x20Move\x20which\x20aborts\x20with\x20E_INVALID_ID_FROM\x20(18).','passed':c,'evidence':c?'all\x20id_from\x20values\x20recognized':'offenders:\x20'+b['map'](d=>d['name']+'(id_from='+d['id_from']+')')['join'](',\x20'),'fix_hint':'Use\x200/1/2,\x20or\x20\x27None\x27/\x27Clock\x27/\x27Signer\x27\x20(case-insensitive).'};}function checkQuoteGuardIsDepended(a){if(!a['has_quote_guard'])return{'id':'C-REP-11','severity':'info','title':'quote_guard\x20is_depended\x20check','description':'Skipped:\x20no\x20quote_guard\x20set.','passed':!![]};const b=a['quote_guard_is_depended']===!![];return{'id':'C-REP-11','severity':b?'info':'block','title':'quote_guard\x20satisfies\x20is_depended\x20(immutable\x20+\x20rep=true\x20+\x20no\x20relies)','description':'When\x20quote_guard\x20is\x20set,\x20it\x20MUST\x20satisfy\x20guard::is_depended\x20(guard.move#L133-135):\x20'+'immutable=true,\x20relies\x20empty,\x20rep=true.\x20Move\x20aborts\x20with\x20E_NEED_DEPENDENT_GUARD\x20(repository.move#L422).\x20'+'VERIFIED:\x20passport.rs#L545-612\x20—\x20check_repository_quote_guard\x20enforces\x20this\x20at\x20query\x20time.\x20'+'quote_guard\x20is\x20a\x20RIGID\x20verification\x20requirement:\x20any\x20guard\x20querying\x20this\x20Repository\x27s\x20data\x20must\x20satisfy\x20it.','passed':b,'evidence':b?'quote_guard\x20is\x20is_depended':'quote_guard\x20NOT\x20is_depended\x20(will\x20abort)','fix_hint':'Ensure\x20the\x20quote_guard\x20Guard\x20object\x20has:\x20immutable=true,\x20relies=empty,\x20rep=true.'};}function checkQuoteGuardSubscriptionDesign(a){if(!a['has_quote_guard'])return{'id':'C-REP-12','severity':'info','title':'quote_guard\x20subscription\x20design\x20check','description':'Skipped:\x20no\x20quote_guard\x20set.','passed':!![]};const b=[];if(!a['quote_guard_verifies_payment'])b['push']('quote_guard\x20does\x20not\x20verify\x20Payment\x20for\x20subscription');if(!a['has_owner_receive'])b['push']('Repository\x20missing\x20owner_receive\x20for\x20Payment\x20revenue');const c=b['length']===0x0;return{'id':'C-REP-12','severity':c?'info':'warn','title':'quote_guard\x20data\x20subscription\x20design\x20—\x20Payment\x20verification\x20+\x20owner_receive\x20revenue','description':'For\x20data\x20subscription\x20pattern\x20(Repository+quote_guard+Payment):\x20'+'(1)\x20quote_guard\x20should\x20verify\x20Payment\x20(for_object\x20matches\x20Repository,\x20amount\x20meets\x20subscription\x20price);\x20'+'(2)\x20Repository\x20should\x20have\x20owner_receive<T>\x20configured\x20to\x20accept\x20Payment\x20as\x20subscription\x20revenue\x20'+'(repository.move#L714-717).\x20VERIFIED:\x20passport.rs#L545-612.\x20'+'DESIGN:\x20user\x20submits\x20Payment\x20via\x20Passport\x20→\x20quote_guard\x20verifies\x20→\x20repository\x20data\x20query\x20passes.','passed':c,'evidence':c?'quote_guard\x20subscription\x20design\x20complete':b['join'](';\x20'),'fix_hint':'Use\x20tpl_repository_quote_guard_subscription\x20(guard-templates.ts)\x20as\x20the\x20design\x20template.'};}export function preCheckRepositoryOp(a){return[checkPolicyCount(a),checkWriteGuardRequiredWhenIdFromNone(a),checkWriteGuardForbiddenWhenIdFromClockSigner(a),checkPolicyGuardCount(a),checkPolicyDescription(a),checkDataSize(a),checkIdCountOnce(a),checkRewardCount(a),checkDataRemoveWithPassportSubmission(a),checkIdFromString(a),checkQuoteGuardIsDepended(a),checkQuoteGuardSubscriptionDesign(a)];}export function canProceedRepositoryOp(a){const b=preCheckRepositoryOp(a);return{'canProceed':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 formatRepositoryOpSummary(a){const {canProceed:b,blockers:c,warnings:d,info:e}=canProceedRepositoryOp(a),f=[];return f['push'](b?'✓\x20Repository\x20'+a['op']+'\x20pre-check\x20PASSED':'✗\x20Repository\x20'+a['op']+'\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');}