@wowok/agent-mcp 2.7.0 → 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 (427) 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.d.ts +5 -1
  13. package/dist/customer/risk-assessment.js +1 -397
  14. package/dist/customer/types.js +1 -13
  15. package/dist/customer/user-preferences.js +1 -460
  16. package/dist/evaluation/arbitration-game.d.ts +23 -0
  17. package/dist/evaluation/arbitration-game.js +1 -0
  18. package/dist/evaluation/builtins/demand-match.d.ts +15 -0
  19. package/dist/evaluation/builtins/demand-match.js +1 -0
  20. package/dist/evaluation/builtins/index.d.ts +3 -0
  21. package/dist/evaluation/builtins/index.js +1 -0
  22. package/dist/evaluation/builtins/service-risk.d.ts +6 -0
  23. package/dist/evaluation/builtins/service-risk.js +1 -0
  24. package/dist/evaluation/capability.d.ts +50 -0
  25. package/dist/evaluation/capability.js +1 -0
  26. package/dist/evaluation/composer.d.ts +13 -0
  27. package/dist/evaluation/composer.js +1 -0
  28. package/dist/evaluation/engine.d.ts +18 -0
  29. package/dist/evaluation/engine.js +1 -0
  30. package/dist/evaluation/extract.d.ts +30 -0
  31. package/dist/evaluation/extract.js +1 -0
  32. package/dist/evaluation/game-strategy.d.ts +27 -0
  33. package/dist/evaluation/game-strategy.js +1 -0
  34. package/dist/evaluation/gap.d.ts +2 -0
  35. package/dist/evaluation/gap.js +1 -0
  36. package/dist/evaluation/index.d.ts +12 -0
  37. package/dist/evaluation/index.js +1 -0
  38. package/dist/evaluation/node-game.d.ts +62 -0
  39. package/dist/evaluation/node-game.js +1 -0
  40. package/dist/evaluation/region.d.ts +10 -0
  41. package/dist/evaluation/region.js +1 -0
  42. package/dist/evaluation/types.d.ts +77 -0
  43. package/dist/evaluation/types.js +1 -0
  44. package/dist/evaluation/user-injection.d.ts +6 -0
  45. package/dist/evaluation/user-injection.js +1 -0
  46. package/dist/examples/education-contact-create.json +40 -0
  47. package/dist/examples/freelance-contact-create.json +40 -0
  48. package/dist/examples/insurance-machine-create.json +1 -1
  49. package/dist/examples/insurance-service-allocators.json +1 -1
  50. package/dist/examples/machine-publish.json +1 -1
  51. package/dist/examples/rental-ziroom-service-create.json +1 -1
  52. package/dist/examples/retail-adv-guard-messenger-proof-create.json +1 -1
  53. package/dist/examples/retail-myshop-service-create.json +1 -1
  54. package/dist/examples/retail-myshop-service-customer-required.json +1 -1
  55. package/dist/examples/subscription-contact-create.json +40 -0
  56. package/dist/examples/threebody-machine-create.json +1 -1
  57. package/dist/examples/travel-machine-create.json +1 -1
  58. package/dist/examples/travel-service-create.json +1 -1
  59. package/dist/experience/experience-reuse.js +1 -103
  60. package/dist/experience/index.js +1 -5
  61. package/dist/experience/intent-distill.js +1 -83
  62. package/dist/experience/realtime-feedback.js +1 -94
  63. package/dist/experience/types.js +1 -1
  64. package/dist/experience/user-profile.js +1 -171
  65. package/dist/extensions/business-modules.js +1 -287
  66. package/dist/extensions/capability-manifest.js +1 -781
  67. package/dist/extensions/constraint-registry.js +1 -198
  68. package/dist/extensions/index.js +1 -6
  69. package/dist/extensions/metric-registry.js +1 -257
  70. package/dist/extensions/mode-evaluator.js +1 -170
  71. package/dist/extensions/modes.js +1 -499
  72. package/dist/extensions/registry.js +1 -717
  73. package/dist/extensions/types.js +1 -1
  74. package/dist/harness/auto-escalation.js +1 -68
  75. package/dist/harness/checkpoint.js +1 -129
  76. package/dist/harness/index.js +1 -78
  77. package/dist/harness/plan.js +1 -276
  78. package/dist/harness/recover.js +1 -139
  79. package/dist/harness/types.js +1 -1
  80. package/dist/harness/verify.js +1 -237
  81. package/dist/index.js +1 -273
  82. package/dist/intent/enrich.d.ts +1 -0
  83. package/dist/intent/enrich.js +1 -0
  84. package/dist/intent/index.d.ts +23 -0
  85. package/dist/intent/index.js +1 -0
  86. package/dist/intent/matcher.d.ts +2 -0
  87. package/dist/intent/matcher.js +1 -0
  88. package/dist/intent/store.d.ts +19 -0
  89. package/dist/intent/store.js +1 -0
  90. package/dist/intent/types.d.ts +33 -0
  91. package/dist/intent/types.js +1 -0
  92. package/dist/knowledge/acquisition-flywheel.js +1 -192
  93. package/dist/knowledge/allocation-confirm.js +1 -534
  94. package/dist/knowledge/allocation-context.js +1 -249
  95. package/dist/knowledge/allocation-ledger.js +1 -463
  96. package/dist/knowledge/allocation-puzzle.js +1 -298
  97. package/dist/knowledge/allocation-risk.js +1 -568
  98. package/dist/knowledge/allocation-templates.js +1 -970
  99. package/dist/knowledge/allocation-translation.js +1 -585
  100. package/dist/knowledge/arb-risk.js +1 -210
  101. package/dist/knowledge/arbitration-confirm.js +1 -559
  102. package/dist/knowledge/arbitration-context.js +1 -505
  103. package/dist/knowledge/arbitration-ledger.js +1 -521
  104. package/dist/knowledge/arbitration-puzzle.js +1 -304
  105. package/dist/knowledge/arbitration-risk.js +1 -433
  106. package/dist/knowledge/arbitration-templates.js +1 -276
  107. package/dist/knowledge/arbitration-translation.js +1 -487
  108. package/dist/knowledge/arbitration-trust.js +1 -117
  109. package/dist/knowledge/audit-rules.js +1 -141
  110. package/dist/knowledge/bridge-risk.js +1 -263
  111. package/dist/knowledge/contact-risk.js +1 -200
  112. package/dist/knowledge/contact-templates.d.ts +27 -0
  113. package/dist/knowledge/contact-templates.js +1 -0
  114. package/dist/knowledge/demand-confirm.js +1 -206
  115. package/dist/knowledge/demand-matching.js +1 -132
  116. package/dist/knowledge/demand-risk.js +1 -240
  117. package/dist/knowledge/demand-translation.js +1 -354
  118. package/dist/knowledge/deployment-scanner.js +1 -823
  119. package/dist/knowledge/dynamic-pricing.js +1 -87
  120. package/dist/knowledge/examples-scanner-cli.js +1 -26
  121. package/dist/knowledge/examples-scanner.js +1 -825
  122. package/dist/knowledge/flywheel-loop.js +1 -404
  123. package/dist/knowledge/fund-layer.js +1 -973
  124. package/dist/knowledge/glossary.js +1 -211
  125. package/dist/knowledge/guard-confirm.js +1 -406
  126. package/dist/knowledge/guard-context.js +1 -287
  127. package/dist/knowledge/guard-design-patterns.js +1 -360
  128. package/dist/knowledge/guard-ledger.js +1 -260
  129. package/dist/knowledge/guard-lint.js +1 -670
  130. package/dist/knowledge/guard-migration.js +1 -228
  131. package/dist/knowledge/guard-puzzle.js +1 -805
  132. package/dist/knowledge/guard-render.js +1 -700
  133. package/dist/knowledge/guard-risk.js +1 -1879
  134. package/dist/knowledge/guard-submission-prompt.js +1 -171
  135. package/dist/knowledge/guard-templates.js +1 -1105
  136. package/dist/knowledge/guard-translation.js +1 -1119
  137. package/dist/knowledge/index.js +1 -436
  138. package/dist/knowledge/industry-evolution.js +1 -323
  139. package/dist/knowledge/industry-generalizer.js +1 -381
  140. package/dist/knowledge/industry-registry.js +1 -174
  141. package/dist/knowledge/intent-metrics.d.ts +4 -3
  142. package/dist/knowledge/intent-metrics.js +1 -566
  143. package/dist/knowledge/machine-confirm.js +1 -559
  144. package/dist/knowledge/machine-context.js +1 -833
  145. package/dist/knowledge/machine-ledger.js +1 -338
  146. package/dist/knowledge/machine-puzzle.js +1 -494
  147. package/dist/knowledge/machine-render.js +1 -565
  148. package/dist/knowledge/machine-risk.js +1 -670
  149. package/dist/knowledge/machine-templates.js +1 -1597
  150. package/dist/knowledge/machine-topology.js +1 -234
  151. package/dist/knowledge/machine-translation.js +1 -513
  152. package/dist/knowledge/mcp-schema-audit-cli.js +1 -45
  153. package/dist/knowledge/mcp-schema-audit.d.ts +1 -1
  154. package/dist/knowledge/mcp-schema-audit.js +1 -773
  155. package/dist/knowledge/onchain-constants.js +1 -35
  156. package/dist/knowledge/order-confirm.js +1 -573
  157. package/dist/knowledge/order-context.js +1 -390
  158. package/dist/knowledge/order-ledger.js +1 -341
  159. package/dist/knowledge/order-puzzle.js +1 -255
  160. package/dist/knowledge/order-risk.js +1 -653
  161. package/dist/knowledge/order-templates.js +1 -368
  162. package/dist/knowledge/order-translation.js +1 -550
  163. package/dist/knowledge/overrides-loader.js +1 -65
  164. package/dist/knowledge/passport-confirm.js +1 -531
  165. package/dist/knowledge/passport-context.js +1 -306
  166. package/dist/knowledge/passport-ledger.js +1 -282
  167. package/dist/knowledge/passport-puzzle.js +1 -333
  168. package/dist/knowledge/passport-risk.js +1 -450
  169. package/dist/knowledge/passport-templates.js +1 -568
  170. package/dist/knowledge/passport-translation.js +1 -516
  171. package/dist/knowledge/payment-risk.js +1 -249
  172. package/dist/knowledge/permission-confirm.js +1 -426
  173. package/dist/knowledge/permission-context.js +1 -224
  174. package/dist/knowledge/permission-ledger.js +1 -403
  175. package/dist/knowledge/permission-puzzle.js +1 -173
  176. package/dist/knowledge/permission-risk.js +1 -411
  177. package/dist/knowledge/permission-templates.js +1 -234
  178. package/dist/knowledge/permission-translation.js +1 -350
  179. package/dist/knowledge/personal-risk.js +1 -212
  180. package/dist/knowledge/process-model.js +1 -160
  181. package/dist/knowledge/progress-confirm.js +1 -456
  182. package/dist/knowledge/progress-context.js +1 -452
  183. package/dist/knowledge/progress-ledger.js +1 -330
  184. package/dist/knowledge/progress-puzzle.js +1 -219
  185. package/dist/knowledge/progress-risk.js +1 -461
  186. package/dist/knowledge/progress-templates.js +1 -228
  187. package/dist/knowledge/progress-translation.js +1 -405
  188. package/dist/knowledge/proof-confirm.js +1 -187
  189. package/dist/knowledge/proof-risk.js +1 -207
  190. package/dist/knowledge/proof-translation.js +1 -283
  191. package/dist/knowledge/registrar-risk.js +1 -217
  192. package/dist/knowledge/repository-confirm.js +1 -286
  193. package/dist/knowledge/repository-risk.js +1 -373
  194. package/dist/knowledge/repository-translation.js +1 -445
  195. package/dist/knowledge/reputation-rules.js +1 -99
  196. package/dist/knowledge/resource-risk.js +1 -157
  197. package/dist/knowledge/reward-confirm.js +1 -526
  198. package/dist/knowledge/reward-context.js +1 -504
  199. package/dist/knowledge/reward-ledger.js +1 -502
  200. package/dist/knowledge/reward-puzzle.js +1 -300
  201. package/dist/knowledge/reward-risk.js +1 -627
  202. package/dist/knowledge/reward-templates.js +1 -197
  203. package/dist/knowledge/reward-translation.js +1 -501
  204. package/dist/knowledge/safety-rules.js +1 -404
  205. package/dist/knowledge/scenario-modes.js +1 -321
  206. package/dist/knowledge/service-confirm.js +1 -807
  207. package/dist/knowledge/service-context.js +1 -403
  208. package/dist/knowledge/service-ledger.js +1 -609
  209. package/dist/knowledge/service-puzzle.js +1 -236
  210. package/dist/knowledge/service-risk.js +1 -615
  211. package/dist/knowledge/service-templates.js +1 -456
  212. package/dist/knowledge/service-translation.js +1 -622
  213. package/dist/knowledge/template-registry.d.ts +1 -1
  214. package/dist/knowledge/template-registry.js +1 -341
  215. package/dist/knowledge/tool-constraints.js +1 -195
  216. package/dist/knowledge/tools-reference.js +1 -155
  217. package/dist/knowledge/treasury-confirm.js +1 -512
  218. package/dist/knowledge/treasury-context.js +1 -363
  219. package/dist/knowledge/treasury-ledger.js +1 -300
  220. package/dist/knowledge/treasury-puzzle.js +1 -216
  221. package/dist/knowledge/treasury-risk.js +1 -440
  222. package/dist/knowledge/treasury-templates.js +1 -358
  223. package/dist/knowledge/treasury-translation.js +1 -498
  224. package/dist/knowledge/trust-metrics.js +1 -198
  225. package/dist/knowledge/util-risk.js +1 -135
  226. package/dist/loop-engineering/aggregate.js +1 -132
  227. package/dist/loop-engineering/context-collect.js +1 -83
  228. package/dist/loop-engineering/diagnose.js +1 -273
  229. package/dist/loop-engineering/improve.js +1 -405
  230. package/dist/loop-engineering/index.js +1 -4
  231. package/dist/loop-engineering/pipeline.js +1 -56
  232. package/dist/mode-market/index.js +1 -3
  233. package/dist/mode-market/registry.js +1 -124
  234. package/dist/mode-market/review.js +1 -214
  235. package/dist/mode-market/submission.js +1 -85
  236. package/dist/participation/collaborator-interest.d.ts +23 -0
  237. package/dist/participation/collaborator-interest.js +1 -0
  238. package/dist/participation/customer-interest.d.ts +25 -0
  239. package/dist/participation/customer-interest.js +1 -0
  240. package/dist/participation/merchant-interest.js +1 -100
  241. package/dist/participation/radar-core.d.ts +13 -3
  242. package/dist/participation/radar-core.js +1 -269
  243. package/dist/participation/supplier-interest.d.ts +25 -0
  244. package/dist/participation/supplier-interest.js +1 -0
  245. package/dist/persona/analyzer.d.ts +16 -0
  246. package/dist/persona/analyzer.js +1 -0
  247. package/dist/persona/bridge.d.ts +5 -0
  248. package/dist/persona/bridge.js +1 -0
  249. package/dist/persona/defaults.d.ts +4 -0
  250. package/dist/persona/defaults.js +1 -0
  251. package/dist/persona/experience-bridge.d.ts +3 -0
  252. package/dist/persona/experience-bridge.js +1 -0
  253. package/dist/persona/index.d.ts +18 -0
  254. package/dist/persona/index.js +1 -0
  255. package/dist/persona/model.d.ts +7 -0
  256. package/dist/persona/model.js +1 -0
  257. package/dist/persona/store.d.ts +19 -0
  258. package/dist/persona/store.js +1 -0
  259. package/dist/persona/types.d.ts +45 -0
  260. package/dist/persona/types.js +1 -0
  261. package/dist/project/business-puzzle.js +1 -383
  262. package/dist/project/context-assembly.js +1 -254
  263. package/dist/project/deployment-bridge.js +1 -120
  264. package/dist/project/deployment-doc.js +1 -1126
  265. package/dist/project/edit-planner.js +1 -1342
  266. package/dist/project/evaluation.js +1 -2011
  267. package/dist/project/game-theory.js +1 -177
  268. package/dist/project/graph-builder.js +1 -656
  269. package/dist/project/graph.js +1 -340
  270. package/dist/project/handlers.d.ts +5 -0
  271. package/dist/project/handlers.js +1 -1762
  272. package/dist/project/index.d.ts +1 -0
  273. package/dist/project/index.js +1 -301
  274. package/dist/project/intent-analyzer.js +1 -149
  275. package/dist/project/machine-nodes.js +1 -36
  276. package/dist/project/merchant-guide.js +1 -264
  277. package/dist/project/migration.js +1 -125
  278. package/dist/project/mode-actions.js +1 -309
  279. package/dist/project/namespace.js +1 -206
  280. package/dist/project/participation-radar.js +1 -428
  281. package/dist/project/pipeline-actions.js +1 -109
  282. package/dist/project/project-store.js +1 -422
  283. package/dist/project/query.js +1 -153
  284. package/dist/project/reverse-mapping.d.ts +34 -0
  285. package/dist/project/reverse-mapping.js +1 -0
  286. package/dist/project/risk-aggregator.js +1 -295
  287. package/dist/project/rollback-policy.js +1 -290
  288. package/dist/project/semantic-assembler.js +1 -345
  289. package/dist/project/semantic-graph.js +1 -245
  290. package/dist/project/stage-gate.js +1 -369
  291. package/dist/project/substep-trace.js +1 -332
  292. package/dist/project/task-tracker.js +1 -78
  293. package/dist/role/derivation.d.ts +18 -0
  294. package/dist/role/derivation.js +1 -0
  295. package/dist/role/index.d.ts +5 -0
  296. package/dist/role/index.js +1 -0
  297. package/dist/role/model.d.ts +8 -0
  298. package/dist/role/model.js +1 -0
  299. package/dist/role/resolution.d.ts +11 -0
  300. package/dist/role/resolution.js +1 -0
  301. package/dist/role/types.d.ts +11 -0
  302. package/dist/role/types.js +1 -0
  303. package/dist/rules.d.ts +2 -0
  304. package/dist/rules.js +1 -9
  305. package/dist/safety/confirm-gate.js +1 -88
  306. package/dist/safety/index.js +1 -3
  307. package/dist/safety/preview.js +1 -52
  308. package/dist/schema/call/allocation.js +1 -34
  309. package/dist/schema/call/arbitration.js +1 -113
  310. package/dist/schema/call/base.d.ts +15 -15
  311. package/dist/schema/call/base.js +1 -370
  312. package/dist/schema/call/bridge-handler.js +1 -265
  313. package/dist/schema/call/bridge.d.ts +7 -7
  314. package/dist/schema/call/bridge.js +1 -458
  315. package/dist/schema/call/contact.js +1 -37
  316. package/dist/schema/call/demand.js +1 -47
  317. package/dist/schema/call/guard.js +1 -161
  318. package/dist/schema/call/handler.js +1 -322
  319. package/dist/schema/call/index.js +1 -20
  320. package/dist/schema/call/machine.js +1 -193
  321. package/dist/schema/call/order.js +1 -35
  322. package/dist/schema/call/payment.js +1 -37
  323. package/dist/schema/call/permission-handler.js +1 -54
  324. package/dist/schema/call/permission.js +1 -105
  325. package/dist/schema/call/personal.js +1 -78
  326. package/dist/schema/call/progress.js +1 -47
  327. package/dist/schema/call/proof.js +1 -33
  328. package/dist/schema/call/repository.js +1 -77
  329. package/dist/schema/call/reward.js +1 -30
  330. package/dist/schema/call/semantic.js +1 -1657
  331. package/dist/schema/call/service.js +1 -178
  332. package/dist/schema/call/treasury.js +1 -71
  333. package/dist/schema/common/index.js +1 -407
  334. package/dist/schema/config/index.js +1 -68
  335. package/dist/schema/evaluation/index.d.ts +4436 -0
  336. package/dist/schema/evaluation/index.js +1 -0
  337. package/dist/schema/index.d.ts +4 -0
  338. package/dist/schema/index.js +1 -13
  339. package/dist/schema/intent-radar/index.d.ts +284 -0
  340. package/dist/schema/intent-radar/index.js +1 -0
  341. package/dist/schema/local/index.d.ts +21 -21
  342. package/dist/schema/local/index.js +1 -927
  343. package/dist/schema/local/wip.js +1 -187
  344. package/dist/schema/messenger/index.d.ts +7 -7
  345. package/dist/schema/messenger/index.js +1 -475
  346. package/dist/schema/operations.d.ts +7 -7
  347. package/dist/schema/operations.js +1 -520
  348. package/dist/schema/persona/index.d.ts +1985 -0
  349. package/dist/schema/persona/index.js +1 -0
  350. package/dist/schema/project/index.d.ts +96 -50
  351. package/dist/schema/project/index.js +1 -2057
  352. package/dist/schema/query/index.d.ts +423 -7
  353. package/dist/schema/query/index.js +1 -1640
  354. package/dist/schema/schema-query/index.js +1 -104
  355. package/dist/schema/schema-version.js +1 -76
  356. package/dist/schema/sync-layer4.d.ts +1 -1
  357. package/dist/schema/sync-layer4.js +1 -282
  358. package/dist/schema/task-status.d.ts +168 -0
  359. package/dist/schema/task-status.js +1 -0
  360. package/dist/schema/trust/index.js +1 -314
  361. package/dist/schema/utils/guard-parser.js +1 -419
  362. package/dist/schema/utils/guard-query-utils.js +1 -46
  363. package/dist/schema/utils/node-parser.js +1 -369
  364. package/dist/schema/utils/object-type-utils.js +1 -35
  365. package/dist/schema/utils/permission-index-utils.js +1 -7
  366. package/dist/schema/utils/permission-machine-check.js +1 -121
  367. package/dist/schema/utils/skills-recommendation.js +1 -77
  368. package/dist/schema-query/index.js +1 -810
  369. package/dist/schemas/account_operation.output.json +5 -2
  370. package/dist/schemas/bridge_operation.output.json +5 -2
  371. package/dist/schemas/evaluation_operation.output.json +782 -0
  372. package/dist/schemas/evaluation_operation.schema.json +990 -0
  373. package/dist/schemas/index.json +25 -1
  374. package/dist/schemas/intent_radar.output.json +232 -0
  375. package/dist/schemas/intent_radar.schema.json +138 -0
  376. package/dist/schemas/local_info_operation.output.json +5 -2
  377. package/dist/schemas/local_mark_operation.output.json +5 -2
  378. package/dist/schemas/messenger_operation.output.json +5 -2
  379. package/dist/schemas/onchain_events.output.json +5 -2
  380. package/dist/schemas/onchain_operations.output.json +5 -2
  381. package/dist/schemas/onchain_operations.schema.json +6 -6
  382. package/dist/schemas/onchain_operations_allocation.schema.json +1 -1
  383. package/dist/schemas/onchain_operations_machine.schema.json +2 -2
  384. package/dist/schemas/onchain_operations_service.schema.json +3 -3
  385. package/dist/schemas/onchain_table_data.output.json +6 -3
  386. package/dist/schemas/persona_operation.output.json +392 -0
  387. package/dist/schemas/persona_operation.schema.json +250 -0
  388. package/dist/schemas/project_operation.output.json +28 -8
  389. package/dist/schemas/query_task_status.output.json +115 -0
  390. package/dist/schemas/query_task_status.schema.json +24 -0
  391. package/dist/schemas/query_toolkit.output.json +9 -6
  392. package/dist/schemas/trust_score.schema.json +1 -1
  393. package/dist/schemas/wowok_buildin_info.output.json +132 -0
  394. package/dist/schemas/wowok_buildin_info.schema.json +14 -0
  395. package/dist/telemetry/index.js +1 -112
  396. package/dist/telemetry/redact.js +1 -23
  397. package/dist/telemetry/storage.js +1 -80
  398. package/dist/tools/handlers/bridge.js +1 -1
  399. package/dist/tools/handlers/config.js +1 -74
  400. package/dist/tools/handlers/evaluation.d.ts +2 -0
  401. package/dist/tools/handlers/evaluation.js +1 -0
  402. package/dist/tools/handlers/file-export.js +1 -90
  403. package/dist/tools/handlers/intent-radar.d.ts +2 -0
  404. package/dist/tools/handlers/intent-radar.js +1 -0
  405. package/dist/tools/handlers/local.js +1 -53
  406. package/dist/tools/handlers/messenger.js +1 -188
  407. package/dist/tools/handlers/onchain.js +1 -1082
  408. package/dist/tools/handlers/persona.d.ts +4 -0
  409. package/dist/tools/handlers/persona.js +1 -0
  410. package/dist/tools/handlers/project.js +1 -211
  411. package/dist/tools/handlers/query.js +1 -434
  412. package/dist/tools/handlers/schema-query.js +1 -176
  413. package/dist/tools/handlers/task-status.d.ts +0 -168
  414. package/dist/tools/handlers/task-status.js +1 -55
  415. package/dist/tools/handlers/trust.js +1 -380
  416. package/dist/tools/handlers/wip.js +1 -90
  417. package/dist/tools/index.js +1 -1306
  418. package/dist/tools/retry.js +1 -85
  419. package/dist/tools/rules-hook.js +1 -23
  420. package/dist/tools/shared.js +1 -130
  421. package/dist/tools/types.js +1 -1
  422. package/dist/tools/upgrade-check.d.ts +19 -0
  423. package/dist/tools/upgrade-check.js +1 -0
  424. package/dist/tools/wip-deploy-assist.d.ts +1 -1
  425. package/dist/tools/wip-deploy-assist.js +1 -278
  426. package/dist/tools/wrap.js +1 -500
  427. package/package.json +5 -3
@@ -1,306 +1 @@
1
- import { PASSPORT_SCENARIOS, MAX_GUARD_COUNT_PASSPORT, MAX_SUBMISSION_SIZE_PASSPORT, PASSPORT_ERROR_CODES, findScenarioById, inferScenarioFromIntent, getAllScenarios, } from "./passport-ledger.js";
2
- import { PASSPORT_TEMPLATES, PASSPORT_TEMPLATES_VERSION, getTemplateById, getTemplatesByScenario, suggestTemplateForScenario, } from "./passport-templates.js";
3
- import { SEMANTIC_TO_SCHEMA_RULES, PASSPORT_CONSTRAINT_RULES, matchSemanticPattern, explainPassport, passportJsonToSemantic, semanticToPassportJson, explainField, explainOp, explainImpack, explainReliesLogic, explainError, getConstraintsByCategory, } from "./passport-translation.js";
4
- import { getAllRiskRules, assessPassportRisks, PASSPORT_RISK_VERSION, } from "./passport-risk.js";
5
- import { initPuzzleFromIntent, checkPuzzleCompleteness, validateConstraints, buildPassportPuzzle, buildResultPuzzle, } from "./passport-puzzle.js";
6
- import { PASSPORT_CONFIRMATION_RULES, PASSPORT_CONFIRM_VERSION, preCheckPassportCreation, preCheckPassportOperation, checkPassportStateConsistency, runPassportConfirmGate, getAllConfirmationRules, } from "./passport-confirm.js";
7
- export const PASSPORT_CONTEXT_VERSION = "1.0.0";
8
- export function buildPassportContext(input) {
9
- const max_length = input.max_length ?? 4000;
10
- let matched_scenario;
11
- if (input.intent) {
12
- matched_scenario = inferScenarioFromIntent(input.intent);
13
- }
14
- if (!matched_scenario && input.target_consumer) {
15
- const scenarios = getAllScenarios().filter(s => s.consumer_object === input.target_consumer);
16
- if (scenarios.length > 0)
17
- matched_scenario = scenarios[0];
18
- }
19
- let matched_template;
20
- if (matched_scenario) {
21
- const tpl = suggestTemplateForScenario(matched_scenario.id);
22
- if (tpl)
23
- matched_template = tpl;
24
- }
25
- let matched_pattern;
26
- if (input.intent) {
27
- const patterns = matchSemanticPattern(input.intent);
28
- if (patterns.length > 0)
29
- matched_pattern = patterns[0];
30
- }
31
- let puzzle_state;
32
- let puzzle_completeness;
33
- if (input.mode === "initial_design" && input.intent) {
34
- puzzle_state = initPuzzleFromIntent({ protected_operation: input.intent });
35
- puzzle_completeness = checkPuzzleCompleteness(puzzle_state);
36
- }
37
- const relevant_risks = filterRiskRules(input.mode, input.stakeholder, matched_scenario);
38
- let risk_assessment;
39
- if (input.mode === "pre_verify" && input.passport_state) {
40
- const ctx = {
41
- object: input.passport_state.object,
42
- has_verified: input.passport_state.has_verified,
43
- guard_count: input.passport_state.info.length,
44
- has_impack_guard: input.passport_state.info.some(g => g.impack),
45
- operation_type: "verify",
46
- constants_synced: true,
47
- knowledge_files_present: true,
48
- matched_scenario,
49
- };
50
- risk_assessment = assessPassportRisks(ctx);
51
- }
52
- const relevant_checklist = filterChecklist(input.mode);
53
- const cross_object_refs = buildCrossObjectRefs(matched_scenario);
54
- const onchain_constraints = buildOnchainConstraints();
55
- const hasImpack = input.passport_state?.info.some(g => g.impack) ?? false;
56
- const hasRelies = input.passport_state?.info.some(g => false) ?? false;
57
- const rendering_hints = buildRenderingHints(input.mode, max_length, hasImpack, hasRelies);
58
- return {
59
- version: PASSPORT_CONTEXT_VERSION,
60
- mode: input.mode,
61
- stakeholder_perspective: input.stakeholder,
62
- matched_scenario,
63
- matched_template,
64
- matched_pattern,
65
- puzzle_state,
66
- puzzle_completeness,
67
- relevant_risks,
68
- risk_assessment,
69
- relevant_checklist,
70
- cross_object_refs,
71
- onchain_constraints,
72
- rendering_hints,
73
- };
74
- }
75
- export const getPassportContext = buildPassportContext;
76
- function filterRiskRules(mode, stakeholder, scenario) {
77
- const rules = getAllRiskRules();
78
- if (mode === "initial_design") {
79
- return rules.filter(r => r.category === "structural" || r.category === "lifecycle");
80
- }
81
- if (mode === "pre_verify") {
82
- return rules;
83
- }
84
- if (mode === "stakeholder_review" && stakeholder) {
85
- if (stakeholder === "creator") {
86
- return rules.filter(r => r.category === "lifecycle" || r.category === "logic");
87
- }
88
- if (stakeholder === "consumer") {
89
- return rules.filter(r => r.category === "operational" || r.category === "lifecycle");
90
- }
91
- if (stakeholder === "guard_owner") {
92
- return rules.filter(r => r.category === "logic");
93
- }
94
- if (stakeholder === "system") {
95
- return rules.filter(r => r.category === "knowledge" || r.category === "operational");
96
- }
97
- }
98
- return rules;
99
- }
100
- function filterChecklist(mode) {
101
- if (mode === "initial_design") {
102
- return PASSPORT_CONFIRMATION_RULES.creation;
103
- }
104
- if (mode === "pre_verify") {
105
- return getAllConfirmationRules();
106
- }
107
- if (mode === "post_verify_use") {
108
- return PASSPORT_CONFIRMATION_RULES.consistency;
109
- }
110
- return getAllConfirmationRules();
111
- }
112
- function buildCrossObjectRefs(scenario) {
113
- const refs = [];
114
- refs.push({
115
- object: "Guard",
116
- field: "guard_objects",
117
- scenario_id: scenario?.id ?? "passport_generic",
118
- description: "Passport.guard references Guard objects for verification (guard::relies, guard::verify_guard)",
119
- });
120
- refs.push({
121
- object: "Clock",
122
- field: "time",
123
- scenario_id: scenario?.id ?? "passport_generic",
124
- description: "Passport.time = clock::timestamp_ms(clock) at creation",
125
- });
126
- refs.push({
127
- object: "Transaction",
128
- field: "tx_hash",
129
- scenario_id: scenario?.id ?? "passport_generic",
130
- description: "Passport.tx_hash = tx_context::digest(ctx) — binds Passport to its creation transaction",
131
- });
132
- if (scenario) {
133
- refs.push({
134
- object: scenario.consumer_object,
135
- field: scenario.sdk_entry,
136
- scenario_id: scenario.id,
137
- description: `${scenario.name}: ${scenario.passport_purpose}`,
138
- });
139
- }
140
- for (const s of PASSPORT_SCENARIOS) {
141
- if (scenario && s.id === scenario.id)
142
- continue;
143
- refs.push({
144
- object: s.consumer_object,
145
- field: s.sdk_entry,
146
- scenario_id: s.id,
147
- description: `${s.name} (alternative consumer)`,
148
- });
149
- }
150
- return refs;
151
- }
152
- function buildOnchainConstraints() {
153
- return [
154
- {
155
- name: "MAX_GUARD_COUNT_PASSPORT",
156
- value: MAX_GUARD_COUNT_PASSPORT,
157
- description: "Maximum Guard count per Passport (Move: passport.move:9)",
158
- },
159
- {
160
- name: "MAX_SUBMISSION_SIZE_PASSPORT",
161
- value: MAX_SUBMISSION_SIZE_PASSPORT,
162
- description: "Maximum serialized byte size per submission entry (Move: passport.move:10)",
163
- },
164
- {
165
- name: "E_GUARD_COUNT_EXCEEDED",
166
- value: PASSPORT_ERROR_CODES.E_GUARD_COUNT_EXCEEDED,
167
- description: "Guard count > 20 — abort guard_add",
168
- },
169
- {
170
- name: "E_HAS_VERIFIED",
171
- value: PASSPORT_ERROR_CODES.E_HAS_VERIFIED,
172
- description: "verify() one-time — aborts guard_add/guard_clear/verify if already verified",
173
- },
174
- {
175
- name: "E_IMPACK_GUARD_NOT_FOUND",
176
- value: PASSPORT_ERROR_CODES.E_IMPACK_GUARD_NOT_FOUND,
177
- description: "verify() requires at least 1 impack=true Guard",
178
- },
179
- {
180
- name: "E_TX_NOT_MATCH",
181
- value: PASSPORT_ERROR_CODES.E_TX_NOT_MATCH,
182
- description: "result() requires tx_hash match — Passport is tx-bound",
183
- },
184
- {
185
- name: "E_DIGEST_NOT_MATCH",
186
- value: PASSPORT_ERROR_CODES.E_DIGEST_NOT_MATCH,
187
- description: "guard_add/verify/guard_clear require tx_hash match (write ops are tx-bound)",
188
- },
189
- {
190
- name: "E_RELIES_GUARD_NOT_ADDED",
191
- value: PASSPORT_ERROR_CODES.E_RELIES_GUARD_NOT_ADDED,
192
- description: "Relied Guard must be added before the dependent Guard (topological order)",
193
- },
194
- ];
195
- }
196
- function buildRenderingHints(mode, max_length, hasImpack, hasRelies) {
197
- return {
198
- include_puzzle_template: mode === "initial_design",
199
- include_risk_details: mode === "pre_verify" || mode === "stakeholder_review",
200
- include_tx_hash_warning: mode === "pre_verify" || mode === "post_verify_use",
201
- include_one_time_verify_warning: mode === "pre_verify",
202
- include_impack_warning: hasImpack || mode === "pre_verify",
203
- include_relies_warning: hasRelies,
204
- max_length,
205
- };
206
- }
207
- export function buildPromptFromPassportContext(bundle) {
208
- const lines = [];
209
- const h = bundle.rendering_hints;
210
- lines.push(`═══ Passport Context (mode: ${bundle.mode}) ═══`);
211
- lines.push("");
212
- if (bundle.matched_scenario) {
213
- lines.push(`Scenario: ${bundle.matched_scenario.name}`);
214
- lines.push(`Consumer: ${bundle.matched_scenario.consumer_object} (${bundle.matched_scenario.sdk_entry})`);
215
- lines.push(`Purpose: ${bundle.matched_scenario.passport_purpose}`);
216
- lines.push(`Typical impack: ${bundle.matched_scenario.typical_impack}`);
217
- lines.push(`Uses relies: ${bundle.matched_scenario.uses_relies}`);
218
- lines.push("");
219
- }
220
- if (bundle.matched_template) {
221
- lines.push(`Suggested template: ${bundle.matched_template.id} — ${bundle.matched_template.name}`);
222
- lines.push("");
223
- }
224
- if (h.include_puzzle_template && bundle.puzzle_completeness) {
225
- const c = bundle.puzzle_completeness;
226
- lines.push("─ Puzzle Completeness ──────────────");
227
- lines.push(`Complete: ${c.complete ? "YES" : "NO"}`);
228
- if (c.missing.length > 0) {
229
- lines.push(`Missing: ${c.missing.join(", ")}`);
230
- }
231
- lines.push(`Next: ${c.next_step}`);
232
- lines.push("");
233
- }
234
- if (h.include_risk_details && bundle.relevant_risks.length > 0) {
235
- lines.push(`─ Relevant Risk Rules (${bundle.relevant_risks.length}) ──────────────`);
236
- for (const r of bundle.relevant_risks.slice(0, 5)) {
237
- lines.push(` ${r.id} — ${r.trigger}`);
238
- }
239
- if (bundle.relevant_risks.length > 5) {
240
- lines.push(` ... and ${bundle.relevant_risks.length - 5} more`);
241
- }
242
- lines.push("");
243
- }
244
- if (bundle.risk_assessment) {
245
- lines.push("─ Risk Assessment ──────────────");
246
- lines.push(`Overall: ${bundle.risk_assessment.summary}`);
247
- lines.push(`Detected: ${bundle.risk_assessment.risks.length} risk(s)`);
248
- lines.push(`Blocks publish: ${bundle.risk_assessment.blocks_publish ? "YES" : "no"}`);
249
- lines.push("");
250
- }
251
- if (h.include_tx_hash_warning) {
252
- lines.push("⚠️ TX_HASH BINDING — Passport is bound to its creation transaction.");
253
- lines.push(" All write operations (guard_add/verify) and result queries MUST happen in the same tx.");
254
- lines.push("");
255
- }
256
- if (h.include_one_time_verify_warning) {
257
- lines.push("⚠️ ONE-TIME VERIFY — verify() is irreversible. After verify, Guard config cannot be modified.");
258
- lines.push(" Double-confirm all Guard selections and submission data before calling verify().");
259
- lines.push("");
260
- }
261
- if (h.include_impack_warning) {
262
- lines.push("⚠️ IMPACK MECHANISM — At least 1 impack=true Guard is required.");
263
- lines.push(" impack Guard failing → overall result=false (immediate return).");
264
- lines.push(" non-impack Guards only record per-Guard result, do NOT affect final result.");
265
- lines.push("");
266
- }
267
- if (h.include_relies_warning) {
268
- lines.push("⚠️ RELIES LOGIC — Guards with relies must be added in topological order.");
269
- lines.push(" AND logic: all relies must pass (short-circuit on first false).");
270
- lines.push(" OR logic: any rely may pass (short-circuit on first true).");
271
- lines.push(" Transitive dependencies are NOT allowed (relied Guard cannot have its own relies).");
272
- lines.push("");
273
- }
274
- if (bundle.onchain_constraints.length > 0) {
275
- lines.push("─ On-chain Constraints ──────────────");
276
- for (const c of bundle.onchain_constraints) {
277
- lines.push(` ${c.name} = ${c.value} — ${c.description}`);
278
- }
279
- lines.push("");
280
- }
281
- if (bundle.cross_object_refs.length > 0) {
282
- lines.push(`─ Cross-object References (${bundle.cross_object_refs.length}) ──────────────`);
283
- for (const ref of bundle.cross_object_refs.slice(0, 6)) {
284
- lines.push(` [${ref.object}] ${ref.scenario_id}: ${ref.description}`);
285
- }
286
- if (bundle.cross_object_refs.length > 6) {
287
- lines.push(` ... and ${bundle.cross_object_refs.length - 6} more`);
288
- }
289
- lines.push("");
290
- }
291
- return lines.join("\n");
292
- }
293
- export function getPassportContextSummary(bundle) {
294
- const parts = [
295
- `mode=${bundle.mode}`,
296
- `scenario=${bundle.matched_scenario?.id ?? "none"}`,
297
- `risks=${bundle.relevant_risks.length}`,
298
- `refs=${bundle.cross_object_refs.length}`,
299
- ];
300
- if (bundle.stakeholder_perspective)
301
- parts.push(`stakeholder=${bundle.stakeholder_perspective}`);
302
- if (bundle.risk_assessment)
303
- parts.push(`summary=${bundle.risk_assessment.summary}`);
304
- return parts.join(", ");
305
- }
306
- export { PASSPORT_SCENARIOS, MAX_GUARD_COUNT_PASSPORT, MAX_SUBMISSION_SIZE_PASSPORT, PASSPORT_ERROR_CODES, findScenarioById, inferScenarioFromIntent, getAllScenarios, PASSPORT_TEMPLATES, getTemplateById, getTemplatesByScenario, suggestTemplateForScenario, SEMANTIC_TO_SCHEMA_RULES, PASSPORT_CONSTRAINT_RULES, matchSemanticPattern, explainPassport, passportJsonToSemantic, semanticToPassportJson, explainField, explainOp, explainImpack, explainReliesLogic, explainError, getConstraintsByCategory, getAllRiskRules, assessPassportRisks, initPuzzleFromIntent, checkPuzzleCompleteness, validateConstraints, buildPassportPuzzle, buildResultPuzzle, PASSPORT_CONFIRMATION_RULES, preCheckPassportCreation, preCheckPassportOperation, checkPassportStateConsistency, runPassportConfirmGate, PASSPORT_RISK_VERSION, PASSPORT_CONFIRM_VERSION, PASSPORT_TEMPLATES_VERSION, };
1
+ import{PASSPORT_SCENARIOS,MAX_GUARD_COUNT_PASSPORT,MAX_SUBMISSION_SIZE_PASSPORT,PASSPORT_ERROR_CODES,findScenarioById,inferScenarioFromIntent,getAllScenarios}from'./passport-ledger.js';import{PASSPORT_TEMPLATES,PASSPORT_TEMPLATES_VERSION,getTemplateById,getTemplatesByScenario,suggestTemplateForScenario}from'./passport-templates.js';import{SEMANTIC_TO_SCHEMA_RULES,PASSPORT_CONSTRAINT_RULES,matchSemanticPattern,explainPassport,passportJsonToSemantic,semanticToPassportJson,explainField,explainOp,explainImpack,explainReliesLogic,explainError,getConstraintsByCategory}from'./passport-translation.js';import{getAllRiskRules,assessPassportRisks,PASSPORT_RISK_VERSION}from'./passport-risk.js';import{initPuzzleFromIntent,checkPuzzleCompleteness,validateConstraints,buildPassportPuzzle,buildResultPuzzle}from'./passport-puzzle.js';import{PASSPORT_CONFIRMATION_RULES,PASSPORT_CONFIRM_VERSION,preCheckPassportCreation,preCheckPassportOperation,checkPassportStateConsistency,runPassportConfirmGate,getAllConfirmationRules}from'./passport-confirm.js';export const PASSPORT_CONTEXT_VERSION='1.0.0';export function buildPassportContext(a){const b=a['max_length']??0xfa0;let c;a['intent']&&(c=inferScenarioFromIntent(a['intent']));if(!c&&a['target_consumer']){const p=getAllScenarios()['filter'](q=>q['consumer_object']===a['target_consumer']);if(p['length']>0x0)c=p[0x0];}let d;if(c){const q=suggestTemplateForScenario(c['id']);if(q)d=q;}let e;if(a['intent']){const r=matchSemanticPattern(a['intent']);if(r['length']>0x0)e=r[0x0];}let f,g;a['mode']==='initial_design'&&a['intent']&&(f=initPuzzleFromIntent({'protected_operation':a['intent']}),g=checkPuzzleCompleteness(f));const h=filterRiskRules(a['mode'],a['stakeholder'],c);let i;if(a['mode']==='pre_verify'&&a['passport_state']){const s={'object':a['passport_state']['object'],'has_verified':a['passport_state']['has_verified'],'guard_count':a['passport_state']['info']['length'],'has_impack_guard':a['passport_state']['info']['some'](t=>t['impack']),'operation_type':'verify','constants_synced':!![],'knowledge_files_present':!![],'matched_scenario':c};i=assessPassportRisks(s);}const j=filterChecklist(a['mode']),k=buildCrossObjectRefs(c),l=buildOnchainConstraints(),m=a['passport_state']?.['info']['some'](t=>t['impack'])??![],n=a['passport_state']?.['info']['some'](t=>![])??![],o=buildRenderingHints(a['mode'],b,m,n);return{'version':PASSPORT_CONTEXT_VERSION,'mode':a['mode'],'stakeholder_perspective':a['stakeholder'],'matched_scenario':c,'matched_template':d,'matched_pattern':e,'puzzle_state':f,'puzzle_completeness':g,'relevant_risks':h,'risk_assessment':i,'relevant_checklist':j,'cross_object_refs':k,'onchain_constraints':l,'rendering_hints':o};}export const getPassportContext=buildPassportContext;function filterRiskRules(a,b,c){const d=getAllRiskRules();if(a==='initial_design')return d['filter'](e=>e['category']==='structural'||e['category']==='lifecycle');if(a==='pre_verify')return d;if(a==='stakeholder_review'&&b){if(b==='creator')return d['filter'](e=>e['category']==='lifecycle'||e['category']==='logic');if(b==='consumer')return d['filter'](e=>e['category']==='operational'||e['category']==='lifecycle');if(b==='guard_owner')return d['filter'](e=>e['category']==='logic');if(b==='system')return d['filter'](e=>e['category']==='knowledge'||e['category']==='operational');}return d;}function filterChecklist(a){if(a==='initial_design')return PASSPORT_CONFIRMATION_RULES['creation'];if(a==='pre_verify')return getAllConfirmationRules();if(a==='post_verify_use')return PASSPORT_CONFIRMATION_RULES['consistency'];return getAllConfirmationRules();}function buildCrossObjectRefs(a){const b=[];b['push']({'object':'Guard','field':'guard_objects','scenario_id':a?.['id']??'passport_generic','description':'Passport.guard\x20references\x20Guard\x20objects\x20for\x20verification\x20(guard::relies,\x20guard::verify_guard)'}),b['push']({'object':'Clock','field':'time','scenario_id':a?.['id']??'passport_generic','description':'Passport.time\x20=\x20clock::timestamp_ms(clock)\x20at\x20creation'}),b['push']({'object':'Transaction','field':'tx_hash','scenario_id':a?.['id']??'passport_generic','description':'Passport.tx_hash\x20=\x20tx_context::digest(ctx)\x20—\x20binds\x20Passport\x20to\x20its\x20creation\x20transaction'});a&&b['push']({'object':a['consumer_object'],'field':a['sdk_entry'],'scenario_id':a['id'],'description':a['name']+':\x20'+a['passport_purpose']});for(const c of PASSPORT_SCENARIOS){if(a&&c['id']===a['id'])continue;b['push']({'object':c['consumer_object'],'field':c['sdk_entry'],'scenario_id':c['id'],'description':c['name']+'\x20(alternative\x20consumer)'});}return b;}function buildOnchainConstraints(){return[{'name':'MAX_GUARD_COUNT_PASSPORT','value':MAX_GUARD_COUNT_PASSPORT,'description':'Maximum\x20Guard\x20count\x20per\x20Passport\x20(Move:\x20passport.move:9)'},{'name':'MAX_SUBMISSION_SIZE_PASSPORT','value':MAX_SUBMISSION_SIZE_PASSPORT,'description':'Maximum\x20serialized\x20byte\x20size\x20per\x20submission\x20entry\x20(Move:\x20passport.move:10)'},{'name':'E_GUARD_COUNT_EXCEEDED','value':PASSPORT_ERROR_CODES['E_GUARD_COUNT_EXCEEDED'],'description':'Guard\x20count\x20>\x2020\x20—\x20abort\x20guard_add'},{'name':'E_HAS_VERIFIED','value':PASSPORT_ERROR_CODES['E_HAS_VERIFIED'],'description':'verify()\x20one-time\x20—\x20aborts\x20guard_add/guard_clear/verify\x20if\x20already\x20verified'},{'name':'E_IMPACK_GUARD_NOT_FOUND','value':PASSPORT_ERROR_CODES['E_IMPACK_GUARD_NOT_FOUND'],'description':'verify()\x20requires\x20at\x20least\x201\x20impack=true\x20Guard'},{'name':'E_TX_NOT_MATCH','value':PASSPORT_ERROR_CODES['E_TX_NOT_MATCH'],'description':'result()\x20requires\x20tx_hash\x20match\x20—\x20Passport\x20is\x20tx-bound'},{'name':'E_DIGEST_NOT_MATCH','value':PASSPORT_ERROR_CODES['E_DIGEST_NOT_MATCH'],'description':'guard_add/verify/guard_clear\x20require\x20tx_hash\x20match\x20(write\x20ops\x20are\x20tx-bound)'},{'name':'E_RELIES_GUARD_NOT_ADDED','value':PASSPORT_ERROR_CODES['E_RELIES_GUARD_NOT_ADDED'],'description':'Relied\x20Guard\x20must\x20be\x20added\x20before\x20the\x20dependent\x20Guard\x20(topological\x20order)'}];}function buildRenderingHints(a,b,c,d){return{'include_puzzle_template':a==='initial_design','include_risk_details':a==='pre_verify'||a==='stakeholder_review','include_tx_hash_warning':a==='pre_verify'||a==='post_verify_use','include_one_time_verify_warning':a==='pre_verify','include_impack_warning':c||a==='pre_verify','include_relies_warning':d,'max_length':b};}export function buildPromptFromPassportContext(a){const b=[],d=a['rendering_hints'];b['push']('═══\x20Passport\x20Context\x20(mode:\x20'+a['mode']+')\x20═══'),b['push']('');a['matched_scenario']&&(b['push']('Scenario:\x20'+a['matched_scenario']['name']),b['push']('Consumer:\x20'+a['matched_scenario']['consumer_object']+'\x20('+a['matched_scenario']['sdk_entry']+')'),b['push']('Purpose:\x20'+a['matched_scenario']['passport_purpose']),b['push']('Typical\x20impack:\x20'+a['matched_scenario']['typical_impack']),b['push']('Uses\x20relies:\x20'+a['matched_scenario']['uses_relies']),b['push'](''));a['matched_template']&&(b['push']('Suggested\x20template:\x20'+a['matched_template']['id']+'\x20—\x20'+a['matched_template']['name']),b['push'](''));if(d['include_puzzle_template']&&a['puzzle_completeness']){const e=a['puzzle_completeness'];b['push']('─\x20Puzzle\x20Completeness\x20──────────────'),b['push']('Complete:\x20'+(e['complete']?'YES':'NO')),e['missing']['length']>0x0&&b['push']('Missing:\x20'+e['missing']['join'](',\x20')),b['push']('Next:\x20'+e['next_step']),b['push']('');}if(d['include_risk_details']&&a['relevant_risks']['length']>0x0){b['push']('─\x20Relevant\x20Risk\x20Rules\x20('+a['relevant_risks']['length']+')\x20──────────────');for(const f of a['relevant_risks']['slice'](0x0,0x5)){b['push']('\x20\x20'+f['id']+'\x20—\x20'+f['trigger']);}a['relevant_risks']['length']>0x5&&b['push']('\x20\x20...\x20and\x20'+(a['relevant_risks']['length']-0x5)+'\x20more'),b['push']('');}a['risk_assessment']&&(b['push']('─\x20Risk\x20Assessment\x20──────────────'),b['push']('Overall:\x20'+a['risk_assessment']['summary']),b['push']('Detected:\x20'+a['risk_assessment']['risks']['length']+'\x20risk(s)'),b['push']('Blocks\x20publish:\x20'+(a['risk_assessment']['blocks_publish']?'YES':'no')),b['push'](''));d['include_tx_hash_warning']&&(b['push']('⚠️\x20TX_HASH\x20BINDING\x20—\x20Passport\x20is\x20bound\x20to\x20its\x20creation\x20transaction.'),b['push']('\x20\x20\x20All\x20write\x20operations\x20(guard_add/verify)\x20and\x20result\x20queries\x20MUST\x20happen\x20in\x20the\x20same\x20tx.'),b['push'](''));d['include_one_time_verify_warning']&&(b['push']('⚠️\x20ONE-TIME\x20VERIFY\x20—\x20verify()\x20is\x20irreversible.\x20After\x20verify,\x20Guard\x20config\x20cannot\x20be\x20modified.'),b['push']('\x20\x20\x20Double-confirm\x20all\x20Guard\x20selections\x20and\x20submission\x20data\x20before\x20calling\x20verify().'),b['push'](''));d['include_impack_warning']&&(b['push']('⚠️\x20IMPACK\x20MECHANISM\x20—\x20At\x20least\x201\x20impack=true\x20Guard\x20is\x20required.'),b['push']('\x20\x20\x20impack\x20Guard\x20failing\x20→\x20overall\x20result=false\x20(immediate\x20return).'),b['push']('\x20\x20\x20non-impack\x20Guards\x20only\x20record\x20per-Guard\x20result,\x20do\x20NOT\x20affect\x20final\x20result.'),b['push'](''));d['include_relies_warning']&&(b['push']('⚠️\x20RELIES\x20LOGIC\x20—\x20Guards\x20with\x20relies\x20must\x20be\x20added\x20in\x20topological\x20order.'),b['push']('\x20\x20\x20AND\x20logic:\x20all\x20relies\x20must\x20pass\x20(short-circuit\x20on\x20first\x20false).'),b['push']('\x20\x20\x20OR\x20logic:\x20any\x20rely\x20may\x20pass\x20(short-circuit\x20on\x20first\x20true).'),b['push']('\x20\x20\x20Transitive\x20dependencies\x20are\x20NOT\x20allowed\x20(relied\x20Guard\x20cannot\x20have\x20its\x20own\x20relies).'),b['push'](''));if(a['onchain_constraints']['length']>0x0){b['push']('─\x20On-chain\x20Constraints\x20──────────────');for(const g of a['onchain_constraints']){b['push']('\x20\x20'+g['name']+'\x20=\x20'+g['value']+'\x20—\x20'+g['description']);}b['push']('');}if(a['cross_object_refs']['length']>0x0){b['push']('─\x20Cross-object\x20References\x20('+a['cross_object_refs']['length']+')\x20──────────────');for(const i of a['cross_object_refs']['slice'](0x0,0x6)){b['push']('\x20\x20['+i['object']+']\x20'+i['scenario_id']+':\x20'+i['description']);}a['cross_object_refs']['length']>0x6&&b['push']('\x20\x20...\x20and\x20'+(a['cross_object_refs']['length']-0x6)+'\x20more'),b['push']('');}return b['join']('\x0a');}export function getPassportContextSummary(a){const b=['mode='+a['mode'],'scenario='+(a['matched_scenario']?.['id']??'none'),'risks='+a['relevant_risks']['length'],'refs='+a['cross_object_refs']['length']];if(a['stakeholder_perspective'])b['push']('stakeholder='+a['stakeholder_perspective']);if(a['risk_assessment'])b['push']('summary='+a['risk_assessment']['summary']);return b['join'](',\x20');}export{PASSPORT_SCENARIOS,MAX_GUARD_COUNT_PASSPORT,MAX_SUBMISSION_SIZE_PASSPORT,PASSPORT_ERROR_CODES,findScenarioById,inferScenarioFromIntent,getAllScenarios,PASSPORT_TEMPLATES,getTemplateById,getTemplatesByScenario,suggestTemplateForScenario,SEMANTIC_TO_SCHEMA_RULES,PASSPORT_CONSTRAINT_RULES,matchSemanticPattern,explainPassport,passportJsonToSemantic,semanticToPassportJson,explainField,explainOp,explainImpack,explainReliesLogic,explainError,getConstraintsByCategory,getAllRiskRules,assessPassportRisks,initPuzzleFromIntent,checkPuzzleCompleteness,validateConstraints,buildPassportPuzzle,buildResultPuzzle,PASSPORT_CONFIRMATION_RULES,preCheckPassportCreation,preCheckPassportOperation,checkPassportStateConsistency,runPassportConfirmGate,PASSPORT_RISK_VERSION,PASSPORT_CONFIRM_VERSION,PASSPORT_TEMPLATES_VERSION};
@@ -1,282 +1 @@
1
- import { MAX_GUARD_COUNT_PASSPORT, MAX_SUBMISSION_SIZE_PASSPORT, } from "@wowok/wowok";
2
- export { MAX_GUARD_COUNT_PASSPORT };
3
- export { MAX_SUBMISSION_SIZE_PASSPORT };
4
- export const PASSPORT_ERROR_CODES = {
5
- E_GUARD_COUNT_EXCEEDED: 1,
6
- E_RELIES_GUARD_NOT_ADDED: 2,
7
- E_SUBMISSION_SIZE_EXCEEDED: 3,
8
- E_HAS_VERIFIED: 4,
9
- E_NOT_VERIFIED: 5,
10
- E_NOT_IMPACK_GUARD: 6,
11
- E_VERIFY_FAILED: 7,
12
- E_TX_NOT_MATCH: 8,
13
- E_IMPACK_GUARD_NOT_FOUND: 9,
14
- E_SUBMISSION_NOT_FOUND: 10,
15
- E_DIGEST_NOT_MATCH: 11,
16
- };
17
- export const PASSPORT_SCENARIOS = [
18
- {
19
- id: "passport_service_buy",
20
- name: "Service buy with Passport (verify buy_guard)",
21
- consumer_object: "Service",
22
- sdk_entry: "buy_with_passport",
23
- passport_purpose: "Verify customer's eligibility to buy (buy_guard)",
24
- typical_impack: "impack",
25
- uses_relies: false,
26
- lifecycle_stage: "use",
27
- participants: ["customer", "merchant"],
28
- risk_notes: [
29
- "tx_hash binding requires Passport creation + buy in the same transaction",
30
- "Service.buy_guard is typically configured as impack=true",
31
- ],
32
- dependencies: ["Service", "Guard"],
33
- },
34
- {
35
- id: "passport_arbitration_compensation",
36
- name: "Order arbitration compensation (verify arb permission)",
37
- consumer_object: "Order",
38
- sdk_entry: "arb_claim_compensation_with_passport",
39
- passport_purpose: "Verify customer's right to claim arbitration compensation",
40
- typical_impack: "impack",
41
- uses_relies: false,
42
- lifecycle_stage: "use",
43
- participants: ["customer", "arbitrator"],
44
- risk_notes: [
45
- "Compensation is one-shot — Passport.tx_hash prevents replay",
46
- "result_for_guard hard-verifies the impack Guard (E_VERIFY_FAILED if mismatch)",
47
- ],
48
- dependencies: ["Order", "Arbitration", "Guard"],
49
- },
50
- {
51
- id: "passport_progress_next",
52
- name: "Progress advance (verify Forward.guard)",
53
- consumer_object: "Progress",
54
- sdk_entry: "next_with_passport",
55
- passport_purpose: "Verify that the next node's Forward.guard passes before advancing",
56
- typical_impack: "impack",
57
- uses_relies: true,
58
- lifecycle_stage: "use",
59
- participants: ["customer", "merchant"],
60
- risk_notes: [
61
- "Forward.guard may have relies on previous node Guards (AND/OR logic)",
62
- "Relies Guards MUST be added in topological order (E_RELIES_GUARD_NOT_ADDED)",
63
- ],
64
- dependencies: ["Progress", "Machine", "Guard"],
65
- },
66
- {
67
- id: "passport_arbitration_dispute",
68
- name: "Arbitration dispute (verify usage_guard)",
69
- consumer_object: "Arbitration",
70
- sdk_entry: "dispute_with_passport",
71
- passport_purpose: "Verify usage_guard before opening a dispute case",
72
- typical_impack: "impack",
73
- uses_relies: false,
74
- lifecycle_stage: "use",
75
- participants: ["customer", "arbitrator"],
76
- risk_notes: [
77
- "Arbitration.usage_guard determines who may open disputes",
78
- "Dispute must be filed within the same transaction that created the Passport",
79
- ],
80
- dependencies: ["Arbitration", "Guard"],
81
- },
82
- {
83
- id: "passport_arbitration_vote",
84
- name: "Arbitration vote (resolve VoteValue::GuardIdentifier weight)",
85
- consumer_object: "Arbitration",
86
- sdk_entry: "vote_with_voting_guard",
87
- passport_purpose: "Resolve voting weight from Passport submission (GuardIdentifier)",
88
- typical_impack: "impack",
89
- uses_relies: false,
90
- lifecycle_stage: "use",
91
- participants: ["arbitrator"],
92
- risk_notes: [
93
- "Voting weight is read via submission_get(guard, identifier)",
94
- "Identifier type must match the voting_guard's expected type",
95
- ],
96
- dependencies: ["Arbitration", "Guard"],
97
- },
98
- {
99
- id: "passport_reward_claim",
100
- name: "Reward claim (verify Guard + resolve recipient/amount)",
101
- consumer_object: "Reward",
102
- sdk_entry: "claim_with_passport",
103
- passport_purpose: "Verify claim eligibility and resolve dynamic recipient/amount from submission",
104
- typical_impack: "impack",
105
- uses_relies: false,
106
- lifecycle_stage: "use",
107
- participants: ["customer"],
108
- risk_notes: [
109
- "Guard may use GuardIdentifier to dynamically resolve recipient address",
110
- "Claim is one-shot per Passport (tx_hash binding prevents replay)",
111
- ],
112
- dependencies: ["Reward", "Guard"],
113
- },
114
- {
115
- id: "passport_permission_assert",
116
- name: "Permission assert (Guard verification replaces owner check)",
117
- consumer_object: "Permission",
118
- sdk_entry: "assert_with_passport",
119
- passport_purpose: "Use Guard verification as a dynamic substitute for static owner/admin check",
120
- typical_impack: "impack",
121
- uses_relies: true,
122
- lifecycle_stage: "use",
123
- participants: ["customer", "platform"],
124
- risk_notes: [
125
- "Allows composing multi-factor authorization via relies logic",
126
- "Permission assert bypass requires the Passport to be verified in the same tx",
127
- ],
128
- dependencies: ["Permission", "Guard"],
129
- },
130
- {
131
- id: "passport_allocation_alloc",
132
- name: "Allocation distribute (verify alloc permission via Guard)",
133
- consumer_object: "Allocation",
134
- sdk_entry: "alloc_with_passport",
135
- passport_purpose: "Verify the caller's right to trigger allocation distribution",
136
- typical_impack: "impack",
137
- uses_relies: false,
138
- lifecycle_stage: "use",
139
- participants: ["customer", "merchant"],
140
- risk_notes: [
141
- "Caller-specified guard: Passport must contain the specific Guard referenced by alloc_by_guard",
142
- "result_for_guard hard-verifies (E_VERIFY_FAILED if the impack Guard fails)",
143
- ],
144
- dependencies: ["Allocation", "Guard"],
145
- },
146
- {
147
- id: "passport_treasury_withdraw",
148
- name: "Treasury withdraw (verify withdraw permission)",
149
- consumer_object: "Treasury",
150
- sdk_entry: "withdraw_with_passport",
151
- passport_purpose: "Verify the caller's right to withdraw funds from Treasury",
152
- typical_impack: "impack",
153
- uses_relies: false,
154
- lifecycle_stage: "use",
155
- participants: ["customer", "platform"],
156
- risk_notes: [
157
- "Treasury withdraw is high-value — strongly recommend multi-Guard relies (AND)",
158
- "Guard should bind Signer to prevent unauthorized withdraw",
159
- ],
160
- dependencies: ["Treasury", "Guard"],
161
- },
162
- {
163
- id: "passport_repository_query",
164
- name: "Repository query (verify read permission + extract data)",
165
- consumer_object: "Repository",
166
- sdk_entry: "query_with_passport",
167
- passport_purpose: "Verify read permission and extract submission data for repository write",
168
- typical_impack: "impack",
169
- uses_relies: false,
170
- lifecycle_stage: "use",
171
- participants: ["customer", "merchant"],
172
- risk_notes: [
173
- "Repository policies may extract data from Passport submission (quote_guard pattern)",
174
- "Submitted data must be ≤ 256 bytes per submission entry",
175
- ],
176
- dependencies: ["Repository", "Guard"],
177
- },
178
- {
179
- id: "passport_demand_submit",
180
- name: "Demand submit (verify demand permission)",
181
- consumer_object: "Demand",
182
- sdk_entry: "demand_with_passport",
183
- passport_purpose: "Verify the caller's right to submit or match a Demand",
184
- typical_impack: "impack",
185
- uses_relies: false,
186
- lifecycle_stage: "use",
187
- participants: ["customer", "merchant"],
188
- risk_notes: [
189
- "Demand.guard may filter which submissions are eligible for matching",
190
- "Demand uses MAX_GUARD_COUNT_DEMAND=20 (separate constant, do not confuse)",
191
- ],
192
- dependencies: ["Demand", "Guard"],
193
- },
194
- ];
195
- export const PASSPORT_LEDGER_VERSION = "1.0.0";
196
- export function getAllScenarios() {
197
- return [...PASSPORT_SCENARIOS];
198
- }
199
- export function getScenariosCount() {
200
- return PASSPORT_SCENARIOS.length;
201
- }
202
- export function findScenarioById(id) {
203
- return PASSPORT_SCENARIOS.find(s => s.id === id);
204
- }
205
- export function getScenariosByConsumer(consumer) {
206
- return PASSPORT_SCENARIOS.filter(s => s.consumer_object === consumer);
207
- }
208
- export function getScenariosUsingRelies() {
209
- return PASSPORT_SCENARIOS.filter(s => s.uses_relies);
210
- }
211
- export function inferScenarioFromIntent(intent) {
212
- const lower = intent.toLowerCase();
213
- if (lower.includes("buy") || lower.includes("purchase") || lower.includes("service")) {
214
- return findScenarioById("passport_service_buy");
215
- }
216
- if (lower.includes("compensation") || lower.includes("compensate") || lower.includes("arb_claim")) {
217
- return findScenarioById("passport_arbitration_compensation");
218
- }
219
- if (lower.includes("progress") || lower.includes("advance") || lower.includes("next")) {
220
- return findScenarioById("passport_progress_next");
221
- }
222
- if (lower.includes("dispute") || lower.includes("grievance")) {
223
- return findScenarioById("passport_arbitration_dispute");
224
- }
225
- if (lower.includes("vote") || lower.includes("ballot") || lower.includes("voting")) {
226
- return findScenarioById("passport_arbitration_vote");
227
- }
228
- if (lower.includes("reward") || lower.includes("claim") || lower.includes("redeem") || lower.includes("bonus")) {
229
- return findScenarioById("passport_reward_claim");
230
- }
231
- if (lower.includes("permission") || lower.includes("assert") || lower.includes("authorize")) {
232
- return findScenarioById("passport_permission_assert");
233
- }
234
- if (lower.includes("alloc") || lower.includes("distribute") || lower.includes("distribution")) {
235
- return findScenarioById("passport_allocation_alloc");
236
- }
237
- if (lower.includes("withdraw") || lower.includes("extract") || lower.includes("treasury")) {
238
- return findScenarioById("passport_treasury_withdraw");
239
- }
240
- if (lower.includes("repository") || lower.includes("query") || lower.includes("lookup")) {
241
- return findScenarioById("passport_repository_query");
242
- }
243
- if (lower.includes("demand") || lower.includes("requirement")) {
244
- return findScenarioById("passport_demand_submit");
245
- }
246
- return undefined;
247
- }
248
- export function impackRoleFromBoolean(impack) {
249
- return impack ? "impack" : "non_impack";
250
- }
251
- export function impackRoleToBoolean(role) {
252
- return role === "impack";
253
- }
254
- export function reliesLogicFromBoolean(relies_logic_and) {
255
- return relies_logic_and ? "AND" : "OR";
256
- }
257
- export function reliesLogicToBoolean(logic) {
258
- return logic === "AND";
259
- }
260
- export function getErrorName(code) {
261
- for (const [name, c] of Object.entries(PASSPORT_ERROR_CODES)) {
262
- if (c === code)
263
- return name;
264
- }
265
- return undefined;
266
- }
267
- export function getErrorDescription(code) {
268
- const descriptions = {
269
- 1: "Guard count exceeds MAX_GUARD_COUNT_PASSPORT (20)",
270
- 2: "Relied Guard not yet added to Passport (topological order required)",
271
- 3: "Submission serialized size exceeds MAX_SUBMISSION_SIZE_PASSPORT (256 bytes)",
272
- 4: "Passport already verified — verify is one-time, configuration is now immutable",
273
- 5: "result() called before verify() — Passport has not been verified yet",
274
- 6: "result_for_guard called on a non-impack Guard — only impack Guards can be hard-verified",
275
- 7: "result_for_guard / result_for_permission called when overall result=false",
276
- 8: "result() called from a different transaction — tx_hash does not match current tx",
277
- 9: "verify() found no impack Guard — at least 1 impack=true Guard is required",
278
- 10: "submission_get found no entry for the (guard, identifier) pair",
279
- 11: "guard_add / verify / guard_clear called from a different transaction — tx_hash mismatch",
280
- };
281
- return descriptions[code];
282
- }
1
+ import{MAX_GUARD_COUNT_PASSPORT,MAX_SUBMISSION_SIZE_PASSPORT}from'@wowok/wowok';export{MAX_GUARD_COUNT_PASSPORT};export{MAX_SUBMISSION_SIZE_PASSPORT};export const PASSPORT_ERROR_CODES={'E_GUARD_COUNT_EXCEEDED':0x1,'E_RELIES_GUARD_NOT_ADDED':0x2,'E_SUBMISSION_SIZE_EXCEEDED':0x3,'E_HAS_VERIFIED':0x4,'E_NOT_VERIFIED':0x5,'E_NOT_IMPACK_GUARD':0x6,'E_VERIFY_FAILED':0x7,'E_TX_NOT_MATCH':0x8,'E_IMPACK_GUARD_NOT_FOUND':0x9,'E_SUBMISSION_NOT_FOUND':0xa,'E_DIGEST_NOT_MATCH':0xb};export const PASSPORT_SCENARIOS=[{'id':'passport_service_buy','name':'Service\x20buy\x20with\x20Passport\x20(verify\x20buy_guard)','consumer_object':'Service','sdk_entry':'buy_with_passport','passport_purpose':'Verify\x20customer\x27s\x20eligibility\x20to\x20buy\x20(buy_guard)','typical_impack':'impack','uses_relies':![],'lifecycle_stage':'use','participants':['customer','merchant'],'risk_notes':['tx_hash\x20binding\x20requires\x20Passport\x20creation\x20+\x20buy\x20in\x20the\x20same\x20transaction','Service.buy_guard\x20is\x20typically\x20configured\x20as\x20impack=true'],'dependencies':['Service','Guard']},{'id':'passport_arbitration_compensation','name':'Order\x20arbitration\x20compensation\x20(verify\x20arb\x20permission)','consumer_object':'Order','sdk_entry':'arb_claim_compensation_with_passport','passport_purpose':'Verify\x20customer\x27s\x20right\x20to\x20claim\x20arbitration\x20compensation','typical_impack':'impack','uses_relies':![],'lifecycle_stage':'use','participants':['customer','arbitrator'],'risk_notes':['Compensation\x20is\x20one-shot\x20—\x20Passport.tx_hash\x20prevents\x20replay','result_for_guard\x20hard-verifies\x20the\x20impack\x20Guard\x20(E_VERIFY_FAILED\x20if\x20mismatch)'],'dependencies':['Order','Arbitration','Guard']},{'id':'passport_progress_next','name':'Progress\x20advance\x20(verify\x20Forward.guard)','consumer_object':'Progress','sdk_entry':'next_with_passport','passport_purpose':'Verify\x20that\x20the\x20next\x20node\x27s\x20Forward.guard\x20passes\x20before\x20advancing','typical_impack':'impack','uses_relies':!![],'lifecycle_stage':'use','participants':['customer','merchant'],'risk_notes':['Forward.guard\x20may\x20have\x20relies\x20on\x20previous\x20node\x20Guards\x20(AND/OR\x20logic)','Relies\x20Guards\x20MUST\x20be\x20added\x20in\x20topological\x20order\x20(E_RELIES_GUARD_NOT_ADDED)'],'dependencies':['Progress','Machine','Guard']},{'id':'passport_arbitration_dispute','name':'Arbitration\x20dispute\x20(verify\x20usage_guard)','consumer_object':'Arbitration','sdk_entry':'dispute_with_passport','passport_purpose':'Verify\x20usage_guard\x20before\x20opening\x20a\x20dispute\x20case','typical_impack':'impack','uses_relies':![],'lifecycle_stage':'use','participants':['customer','arbitrator'],'risk_notes':['Arbitration.usage_guard\x20determines\x20who\x20may\x20open\x20disputes','Dispute\x20must\x20be\x20filed\x20within\x20the\x20same\x20transaction\x20that\x20created\x20the\x20Passport'],'dependencies':['Arbitration','Guard']},{'id':'passport_arbitration_vote','name':'Arbitration\x20vote\x20(resolve\x20VoteValue::GuardIdentifier\x20weight)','consumer_object':'Arbitration','sdk_entry':'vote_with_voting_guard','passport_purpose':'Resolve\x20voting\x20weight\x20from\x20Passport\x20submission\x20(GuardIdentifier)','typical_impack':'impack','uses_relies':![],'lifecycle_stage':'use','participants':['arbitrator'],'risk_notes':['Voting\x20weight\x20is\x20read\x20via\x20submission_get(guard,\x20identifier)','Identifier\x20type\x20must\x20match\x20the\x20voting_guard\x27s\x20expected\x20type'],'dependencies':['Arbitration','Guard']},{'id':'passport_reward_claim','name':'Reward\x20claim\x20(verify\x20Guard\x20+\x20resolve\x20recipient/amount)','consumer_object':'Reward','sdk_entry':'claim_with_passport','passport_purpose':'Verify\x20claim\x20eligibility\x20and\x20resolve\x20dynamic\x20recipient/amount\x20from\x20submission','typical_impack':'impack','uses_relies':![],'lifecycle_stage':'use','participants':['customer'],'risk_notes':['Guard\x20may\x20use\x20GuardIdentifier\x20to\x20dynamically\x20resolve\x20recipient\x20address','Claim\x20is\x20one-shot\x20per\x20Passport\x20(tx_hash\x20binding\x20prevents\x20replay)'],'dependencies':['Reward','Guard']},{'id':'passport_permission_assert','name':'Permission\x20assert\x20(Guard\x20verification\x20replaces\x20owner\x20check)','consumer_object':'Permission','sdk_entry':'assert_with_passport','passport_purpose':'Use\x20Guard\x20verification\x20as\x20a\x20dynamic\x20substitute\x20for\x20static\x20owner/admin\x20check','typical_impack':'impack','uses_relies':!![],'lifecycle_stage':'use','participants':['customer','platform'],'risk_notes':['Allows\x20composing\x20multi-factor\x20authorization\x20via\x20relies\x20logic','Permission\x20assert\x20bypass\x20requires\x20the\x20Passport\x20to\x20be\x20verified\x20in\x20the\x20same\x20tx'],'dependencies':['Permission','Guard']},{'id':'passport_allocation_alloc','name':'Allocation\x20distribute\x20(verify\x20alloc\x20permission\x20via\x20Guard)','consumer_object':'Allocation','sdk_entry':'alloc_with_passport','passport_purpose':'Verify\x20the\x20caller\x27s\x20right\x20to\x20trigger\x20allocation\x20distribution','typical_impack':'impack','uses_relies':![],'lifecycle_stage':'use','participants':['customer','merchant'],'risk_notes':['Caller-specified\x20guard:\x20Passport\x20must\x20contain\x20the\x20specific\x20Guard\x20referenced\x20by\x20alloc_by_guard','result_for_guard\x20hard-verifies\x20(E_VERIFY_FAILED\x20if\x20the\x20impack\x20Guard\x20fails)'],'dependencies':['Allocation','Guard']},{'id':'passport_treasury_withdraw','name':'Treasury\x20withdraw\x20(verify\x20withdraw\x20permission)','consumer_object':'Treasury','sdk_entry':'withdraw_with_passport','passport_purpose':'Verify\x20the\x20caller\x27s\x20right\x20to\x20withdraw\x20funds\x20from\x20Treasury','typical_impack':'impack','uses_relies':![],'lifecycle_stage':'use','participants':['customer','platform'],'risk_notes':['Treasury\x20withdraw\x20is\x20high-value\x20—\x20strongly\x20recommend\x20multi-Guard\x20relies\x20(AND)','Guard\x20should\x20bind\x20Signer\x20to\x20prevent\x20unauthorized\x20withdraw'],'dependencies':['Treasury','Guard']},{'id':'passport_repository_query','name':'Repository\x20query\x20(verify\x20read\x20permission\x20+\x20extract\x20data)','consumer_object':'Repository','sdk_entry':'query_with_passport','passport_purpose':'Verify\x20read\x20permission\x20and\x20extract\x20submission\x20data\x20for\x20repository\x20write','typical_impack':'impack','uses_relies':![],'lifecycle_stage':'use','participants':['customer','merchant'],'risk_notes':['Repository\x20policies\x20may\x20extract\x20data\x20from\x20Passport\x20submission\x20(quote_guard\x20pattern)','Submitted\x20data\x20must\x20be\x20≤\x20256\x20bytes\x20per\x20submission\x20entry'],'dependencies':['Repository','Guard']},{'id':'passport_demand_submit','name':'Demand\x20submit\x20(verify\x20demand\x20permission)','consumer_object':'Demand','sdk_entry':'demand_with_passport','passport_purpose':'Verify\x20the\x20caller\x27s\x20right\x20to\x20submit\x20or\x20match\x20a\x20Demand','typical_impack':'impack','uses_relies':![],'lifecycle_stage':'use','participants':['customer','merchant'],'risk_notes':['Demand.guard\x20may\x20filter\x20which\x20submissions\x20are\x20eligible\x20for\x20matching','Demand\x20uses\x20MAX_GUARD_COUNT_DEMAND=20\x20(separate\x20constant,\x20do\x20not\x20confuse)'],'dependencies':['Demand','Guard']}];export const PASSPORT_LEDGER_VERSION='1.0.0';export function getAllScenarios(){return[...PASSPORT_SCENARIOS];}export function getScenariosCount(){return PASSPORT_SCENARIOS['length'];}export function findScenarioById(a){return PASSPORT_SCENARIOS['find'](b=>b['id']===a);}export function getScenariosByConsumer(a){return PASSPORT_SCENARIOS['filter'](b=>b['consumer_object']===a);}export function getScenariosUsingRelies(){return PASSPORT_SCENARIOS['filter'](a=>a['uses_relies']);}export function inferScenarioFromIntent(a){const b=a['toLowerCase']();if(b['includes']('buy')||b['includes']('purchase')||b['includes']('service'))return findScenarioById('passport_service_buy');if(b['includes']('compensation')||b['includes']('compensate')||b['includes']('arb_claim'))return findScenarioById('passport_arbitration_compensation');if(b['includes']('progress')||b['includes']('advance')||b['includes']('next'))return findScenarioById('passport_progress_next');if(b['includes']('dispute')||b['includes']('grievance'))return findScenarioById('passport_arbitration_dispute');if(b['includes']('vote')||b['includes']('ballot')||b['includes']('voting'))return findScenarioById('passport_arbitration_vote');if(b['includes']('reward')||b['includes']('claim')||b['includes']('redeem')||b['includes']('bonus'))return findScenarioById('passport_reward_claim');if(b['includes']('permission')||b['includes']('assert')||b['includes']('authorize'))return findScenarioById('passport_permission_assert');if(b['includes']('alloc')||b['includes']('distribute')||b['includes']('distribution'))return findScenarioById('passport_allocation_alloc');if(b['includes']('withdraw')||b['includes']('extract')||b['includes']('treasury'))return findScenarioById('passport_treasury_withdraw');if(b['includes']('repository')||b['includes']('query')||b['includes']('lookup'))return findScenarioById('passport_repository_query');if(b['includes']('demand')||b['includes']('requirement'))return findScenarioById('passport_demand_submit');return undefined;}export function impackRoleFromBoolean(a){return a?'impack':'non_impack';}export function impackRoleToBoolean(a){return a==='impack';}export function reliesLogicFromBoolean(a){return a?'AND':'OR';}export function reliesLogicToBoolean(a){return a==='AND';}export function getErrorName(a){for(const [b,d]of Object['entries'](PASSPORT_ERROR_CODES)){if(d===a)return b;}return undefined;}export function getErrorDescription(a){const b={0x1:'Guard\x20count\x20exceeds\x20MAX_GUARD_COUNT_PASSPORT\x20(20)',0x2:'Relied\x20Guard\x20not\x20yet\x20added\x20to\x20Passport\x20(topological\x20order\x20required)',0x3:'Submission\x20serialized\x20size\x20exceeds\x20MAX_SUBMISSION_SIZE_PASSPORT\x20(256\x20bytes)',0x4:'Passport\x20already\x20verified\x20—\x20verify\x20is\x20one-time,\x20configuration\x20is\x20now\x20immutable',0x5:'result()\x20called\x20before\x20verify()\x20—\x20Passport\x20has\x20not\x20been\x20verified\x20yet',0x6:'result_for_guard\x20called\x20on\x20a\x20non-impack\x20Guard\x20—\x20only\x20impack\x20Guards\x20can\x20be\x20hard-verified',0x7:'result_for_guard\x20/\x20result_for_permission\x20called\x20when\x20overall\x20result=false',0x8:'result()\x20called\x20from\x20a\x20different\x20transaction\x20—\x20tx_hash\x20does\x20not\x20match\x20current\x20tx',0x9:'verify()\x20found\x20no\x20impack\x20Guard\x20—\x20at\x20least\x201\x20impack=true\x20Guard\x20is\x20required',0xa:'submission_get\x20found\x20no\x20entry\x20for\x20the\x20(guard,\x20identifier)\x20pair',0xb:'guard_add\x20/\x20verify\x20/\x20guard_clear\x20called\x20from\x20a\x20different\x20transaction\x20—\x20tx_hash\x20mismatch'};return b[a];}