@wowok/agent-mcp 2.7.1 → 2.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (597) hide show
  1. package/dist/config/index.js +1 -1
  2. package/dist/config/runtime.js +1 -238
  3. package/dist/customer/account-events.d.ts +32 -0
  4. package/dist/customer/account-events.js +1 -0
  5. package/dist/customer/customer-advice.d.ts +1 -0
  6. package/dist/customer/customer-advice.js +1 -130
  7. package/dist/customer/index.js +1 -11
  8. package/dist/customer/industry-risks.js +1 -438
  9. package/dist/customer/info-puzzle.js +1 -681
  10. package/dist/customer/order-monitor.js +1 -328
  11. package/dist/customer/order-strategy.d.ts +1 -1
  12. package/dist/customer/order-strategy.js +1 -373
  13. package/dist/customer/post-purchase.js +1 -351
  14. package/dist/customer/preorder-compare.js +1 -34
  15. package/dist/customer/reminder-system.d.ts +2 -0
  16. package/dist/customer/reminder-system.js +1 -316
  17. package/dist/customer/risk-assessment.d.ts +1 -0
  18. package/dist/customer/risk-assessment.js +1 -397
  19. package/dist/customer/types.d.ts +2 -0
  20. package/dist/customer/types.js +1 -13
  21. package/dist/customer/user-preferences.js +1 -460
  22. package/dist/evaluation/arbitration-game.d.ts +9 -2
  23. package/dist/evaluation/arbitration-game.js +1 -48
  24. package/dist/evaluation/builtins/arbitration-score.d.ts +41 -0
  25. package/dist/evaluation/builtins/arbitration-score.js +1 -0
  26. package/dist/evaluation/builtins/demand-match.js +1 -153
  27. package/dist/evaluation/builtins/index.d.ts +1 -0
  28. package/dist/evaluation/builtins/index.js +1 -10
  29. package/dist/evaluation/builtins/service-risk.js +1 -55
  30. package/dist/evaluation/capability.js +1 -13
  31. package/dist/evaluation/category-match-rules.d.ts +30 -0
  32. package/dist/evaluation/category-match-rules.js +1 -0
  33. package/dist/evaluation/composer.js +1 -40
  34. package/dist/evaluation/engine.js +1 -175
  35. package/dist/evaluation/extract.js +1 -115
  36. package/dist/evaluation/game-strategy.d.ts +27 -0
  37. package/dist/evaluation/game-strategy.js +1 -0
  38. package/dist/evaluation/gap.js +1 -100
  39. package/dist/evaluation/index.d.ts +2 -0
  40. package/dist/evaluation/index.js +1 -11
  41. package/dist/evaluation/location-match.d.ts +42 -0
  42. package/dist/evaluation/location-match.js +1 -0
  43. package/dist/evaluation/node-game.d.ts +31 -3
  44. package/dist/evaluation/node-game.js +1 -57
  45. package/dist/evaluation/path-reasoning.d.ts +35 -0
  46. package/dist/evaluation/path-reasoning.js +1 -0
  47. package/dist/evaluation/region.d.ts +6 -0
  48. package/dist/evaluation/region.js +1 -36
  49. package/dist/evaluation/types.d.ts +18 -0
  50. package/dist/evaluation/types.js +1 -1
  51. package/dist/evaluation/user-injection.js +1 -27
  52. package/dist/experience/experience-reuse.js +1 -103
  53. package/dist/experience/index.js +1 -5
  54. package/dist/experience/intent-distill.js +1 -83
  55. package/dist/experience/realtime-feedback.js +1 -94
  56. package/dist/experience/types.js +1 -1
  57. package/dist/experience/user-profile.d.ts +1 -1
  58. package/dist/experience/user-profile.js +1 -171
  59. package/dist/extensions/business-modules.js +1 -287
  60. package/dist/extensions/capability-manifest.js +1 -781
  61. package/dist/extensions/constraint-registry.js +1 -198
  62. package/dist/extensions/index.d.ts +6 -0
  63. package/dist/extensions/index.js +1 -6
  64. package/dist/extensions/industry-layers.d.ts +75 -0
  65. package/dist/extensions/industry-layers.js +1 -0
  66. package/dist/extensions/industry-pack.d.ts +105 -0
  67. package/dist/extensions/industry-pack.js +1 -0
  68. package/dist/extensions/metric-registry.js +1 -257
  69. package/dist/extensions/mode-evaluator.d.ts +1 -1
  70. package/dist/extensions/mode-evaluator.js +1 -170
  71. package/dist/extensions/modes.js +1 -499
  72. package/dist/extensions/registry.d.ts +1 -0
  73. package/dist/extensions/registry.js +1 -717
  74. package/dist/extensions/types.js +1 -1
  75. package/dist/graph/base.d.ts +8 -0
  76. package/dist/graph/base.js +1 -0
  77. package/dist/harness/auto-escalation.js +1 -68
  78. package/dist/harness/checkpoint.js +1 -129
  79. package/dist/harness/index.d.ts +1 -0
  80. package/dist/harness/index.js +1 -78
  81. package/dist/harness/plan.d.ts +2 -0
  82. package/dist/harness/plan.js +1 -315
  83. package/dist/harness/recover.d.ts +1 -1
  84. package/dist/harness/recover.js +1 -139
  85. package/dist/harness/types.d.ts +2 -3
  86. package/dist/harness/types.js +1 -1
  87. package/dist/harness/verify.js +1 -237
  88. package/dist/index.js +1 -273
  89. package/dist/intent/enrich.js +1 -67
  90. package/dist/intent/index.js +1 -60
  91. package/dist/intent/matcher.js +1 -81
  92. package/dist/intent/store.js +1 -55
  93. package/dist/intent/types.js +1 -10
  94. package/dist/knowledge/acquisition-flywheel.js +1 -192
  95. package/dist/knowledge/allocation-confirm.js +1 -534
  96. package/dist/knowledge/allocation-context.js +1 -249
  97. package/dist/knowledge/allocation-ledger.js +1 -463
  98. package/dist/knowledge/allocation-puzzle.js +1 -298
  99. package/dist/knowledge/allocation-risk.js +1 -568
  100. package/dist/knowledge/allocation-templates.js +1 -970
  101. package/dist/knowledge/allocation-translation.js +1 -585
  102. package/dist/knowledge/anti-cheat.d.ts +37 -0
  103. package/dist/knowledge/anti-cheat.js +1 -0
  104. package/dist/knowledge/arb-confirm.d.ts +28 -0
  105. package/dist/knowledge/arb-confirm.js +1 -0
  106. package/dist/knowledge/arb-risk.js +1 -210
  107. package/dist/knowledge/arb-translation.d.ts +48 -0
  108. package/dist/knowledge/arb-translation.js +1 -0
  109. package/dist/knowledge/arbitration-confirm.js +1 -559
  110. package/dist/knowledge/arbitration-context.js +1 -505
  111. package/dist/knowledge/arbitration-ledger.js +1 -521
  112. package/dist/knowledge/arbitration-puzzle.js +1 -304
  113. package/dist/knowledge/arbitration-risk.js +1 -423
  114. package/dist/knowledge/arbitration-templates.js +1 -276
  115. package/dist/knowledge/arbitration-translation.js +1 -487
  116. package/dist/knowledge/audit-rules.js +1 -141
  117. package/dist/knowledge/bridge-confirm.d.ts +26 -0
  118. package/dist/knowledge/bridge-confirm.js +1 -0
  119. package/dist/knowledge/bridge-risk.js +1 -263
  120. package/dist/knowledge/bridge-translation.d.ts +37 -0
  121. package/dist/knowledge/bridge-translation.js +1 -0
  122. package/dist/knowledge/contact-confirm.d.ts +27 -0
  123. package/dist/knowledge/contact-confirm.js +1 -0
  124. package/dist/knowledge/contact-risk.js +1 -200
  125. package/dist/knowledge/contact-templates.js +1 -60
  126. package/dist/knowledge/contact-translation.d.ts +39 -0
  127. package/dist/knowledge/contact-translation.js +1 -0
  128. package/dist/knowledge/demand-confirm.js +1 -206
  129. package/dist/knowledge/demand-context.d.ts +17 -0
  130. package/dist/knowledge/demand-context.js +1 -0
  131. package/dist/knowledge/demand-ledger.d.ts +26 -0
  132. package/dist/knowledge/demand-ledger.js +1 -0
  133. package/dist/knowledge/demand-matching.js +1 -132
  134. package/dist/knowledge/demand-puzzle.d.ts +29 -0
  135. package/dist/knowledge/demand-puzzle.js +1 -0
  136. package/dist/knowledge/demand-risk.js +1 -240
  137. package/dist/knowledge/demand-templates.d.ts +12 -0
  138. package/dist/knowledge/demand-templates.js +1 -0
  139. package/dist/knowledge/demand-translation.js +1 -354
  140. package/dist/knowledge/deployment-scanner.js +1 -823
  141. package/dist/knowledge/dynamic-pricing.js +1 -87
  142. package/dist/knowledge/evidence-review.d.ts +12 -0
  143. package/dist/knowledge/evidence-review.js +1 -0
  144. package/dist/knowledge/examples-scanner-cli.js +1 -26
  145. package/dist/knowledge/examples-scanner.js +1 -843
  146. package/dist/knowledge/flywheel-loop.d.ts +0 -1
  147. package/dist/knowledge/flywheel-loop.js +1 -404
  148. package/dist/knowledge/fund-layer.js +1 -973
  149. package/dist/knowledge/glossary.js +1 -211
  150. package/dist/knowledge/guard-confirm.js +1 -406
  151. package/dist/knowledge/guard-context.js +1 -287
  152. package/dist/knowledge/guard-design-patterns.js +1 -360
  153. package/dist/knowledge/guard-ledger.js +1 -260
  154. package/dist/knowledge/guard-lint.js +1 -670
  155. package/dist/knowledge/guard-migration.d.ts +1 -1
  156. package/dist/knowledge/guard-migration.js +1 -228
  157. package/dist/knowledge/guard-puzzle.js +1 -805
  158. package/dist/knowledge/guard-render.js +1 -700
  159. package/dist/knowledge/guard-risk.js +1 -1879
  160. package/dist/knowledge/guard-submission-prompt.js +1 -171
  161. package/dist/knowledge/guard-templates.js +1 -1105
  162. package/dist/knowledge/guard-translation.js +1 -1119
  163. package/dist/knowledge/index.d.ts +71 -3
  164. package/dist/knowledge/index.js +1 -436
  165. package/dist/knowledge/industry-evolution.js +1 -323
  166. package/dist/knowledge/industry-generalizer.js +1 -381
  167. package/dist/knowledge/industry-registry.js +1 -174
  168. package/dist/knowledge/intent-metrics.d.ts +4 -3
  169. package/dist/knowledge/intent-metrics.js +1 -566
  170. package/dist/knowledge/machine-confirm.js +1 -559
  171. package/dist/knowledge/machine-context.js +1 -833
  172. package/dist/knowledge/machine-ledger.js +1 -338
  173. package/dist/knowledge/machine-puzzle.js +1 -494
  174. package/dist/knowledge/machine-render.js +1 -565
  175. package/dist/knowledge/machine-risk.js +1 -669
  176. package/dist/knowledge/machine-templates.js +1 -1597
  177. package/dist/knowledge/machine-topology.js +1 -234
  178. package/dist/knowledge/machine-translation.js +1 -513
  179. package/dist/knowledge/market-metrics.d.ts +12 -0
  180. package/dist/knowledge/market-metrics.js +1 -0
  181. package/dist/knowledge/market-operations.d.ts +46 -0
  182. package/dist/knowledge/market-operations.js +1 -0
  183. package/dist/knowledge/mcp-schema-audit-cli.js +1 -45
  184. package/dist/knowledge/mcp-schema-audit.d.ts +22 -22
  185. package/dist/knowledge/mcp-schema-audit.js +1 -777
  186. package/dist/knowledge/onchain-constants.js +1 -35
  187. package/dist/knowledge/order-confirm.js +1 -573
  188. package/dist/knowledge/order-context.js +1 -390
  189. package/dist/knowledge/order-ledger.js +1 -341
  190. package/dist/knowledge/order-puzzle.js +1 -255
  191. package/dist/knowledge/order-risk.js +1 -653
  192. package/dist/knowledge/order-templates.js +1 -368
  193. package/dist/knowledge/order-translation.js +1 -550
  194. package/dist/knowledge/overrides-loader.js +1 -65
  195. package/dist/knowledge/passport-confirm.js +1 -531
  196. package/dist/knowledge/passport-context.js +1 -306
  197. package/dist/knowledge/passport-ledger.js +1 -282
  198. package/dist/knowledge/passport-puzzle.js +1 -333
  199. package/dist/knowledge/passport-risk.js +1 -450
  200. package/dist/knowledge/passport-templates.js +1 -568
  201. package/dist/knowledge/passport-translation.js +1 -516
  202. package/dist/knowledge/payment-confirm.d.ts +26 -0
  203. package/dist/knowledge/payment-confirm.js +1 -0
  204. package/dist/knowledge/payment-risk.js +1 -249
  205. package/dist/knowledge/payment-translation.d.ts +37 -0
  206. package/dist/knowledge/payment-translation.js +1 -0
  207. package/dist/knowledge/permission-confirm.js +1 -426
  208. package/dist/knowledge/permission-context.js +1 -224
  209. package/dist/knowledge/permission-ledger.d.ts +11 -0
  210. package/dist/knowledge/permission-ledger.js +1 -403
  211. package/dist/knowledge/permission-puzzle.js +1 -173
  212. package/dist/knowledge/permission-risk.js +1 -411
  213. package/dist/knowledge/permission-templates.js +1 -234
  214. package/dist/knowledge/permission-translation.js +1 -350
  215. package/dist/knowledge/personal-confirm.d.ts +29 -0
  216. package/dist/knowledge/personal-confirm.js +1 -0
  217. package/dist/knowledge/personal-risk.js +1 -212
  218. package/dist/knowledge/personal-translation.d.ts +37 -0
  219. package/dist/knowledge/personal-translation.js +1 -0
  220. package/dist/knowledge/process-model.d.ts +1 -11
  221. package/dist/knowledge/process-model.js +1 -160
  222. package/dist/knowledge/progress-confirm.js +1 -456
  223. package/dist/knowledge/progress-context.js +1 -452
  224. package/dist/knowledge/progress-ledger.js +1 -330
  225. package/dist/knowledge/progress-puzzle.js +1 -219
  226. package/dist/knowledge/progress-risk.js +1 -461
  227. package/dist/knowledge/progress-templates.js +1 -228
  228. package/dist/knowledge/progress-translation.js +1 -405
  229. package/dist/knowledge/proof-confirm.js +1 -187
  230. package/dist/knowledge/proof-context.d.ts +17 -0
  231. package/dist/knowledge/proof-context.js +1 -0
  232. package/dist/knowledge/proof-ledger.d.ts +34 -0
  233. package/dist/knowledge/proof-ledger.js +1 -0
  234. package/dist/knowledge/proof-puzzle.d.ts +35 -0
  235. package/dist/knowledge/proof-puzzle.js +1 -0
  236. package/dist/knowledge/proof-risk.js +1 -207
  237. package/dist/knowledge/proof-templates.d.ts +22 -0
  238. package/dist/knowledge/proof-templates.js +1 -0
  239. package/dist/knowledge/proof-translation.js +1 -283
  240. package/dist/knowledge/registrar-confirm.d.ts +26 -0
  241. package/dist/knowledge/registrar-confirm.js +1 -0
  242. package/dist/knowledge/registrar-risk.js +1 -217
  243. package/dist/knowledge/registrar-translation.d.ts +37 -0
  244. package/dist/knowledge/registrar-translation.js +1 -0
  245. package/dist/knowledge/repository-confirm.js +1 -286
  246. package/dist/knowledge/repository-context.d.ts +12 -0
  247. package/dist/knowledge/repository-context.js +1 -0
  248. package/dist/knowledge/repository-ledger.d.ts +25 -0
  249. package/dist/knowledge/repository-ledger.js +1 -0
  250. package/dist/knowledge/repository-puzzle.d.ts +30 -0
  251. package/dist/knowledge/repository-puzzle.js +1 -0
  252. package/dist/knowledge/repository-risk.js +1 -373
  253. package/dist/knowledge/repository-templates.d.ts +14 -0
  254. package/dist/knowledge/repository-templates.js +1 -0
  255. package/dist/knowledge/repository-translation.js +1 -445
  256. package/dist/knowledge/reputation-rules.js +1 -99
  257. package/dist/knowledge/resource-confirm.d.ts +25 -0
  258. package/dist/knowledge/resource-confirm.js +1 -0
  259. package/dist/knowledge/resource-risk.js +1 -157
  260. package/dist/knowledge/resource-translation.d.ts +37 -0
  261. package/dist/knowledge/resource-translation.js +1 -0
  262. package/dist/knowledge/reward-confirm.js +1 -526
  263. package/dist/knowledge/reward-context.d.ts +2 -2
  264. package/dist/knowledge/reward-context.js +1 -504
  265. package/dist/knowledge/reward-ledger.js +1 -502
  266. package/dist/knowledge/reward-puzzle.js +1 -300
  267. package/dist/knowledge/reward-risk.js +1 -627
  268. package/dist/knowledge/reward-templates.js +1 -197
  269. package/dist/knowledge/reward-translation.js +1 -501
  270. package/dist/knowledge/safety-rules.d.ts +1 -0
  271. package/dist/knowledge/safety-rules.js +1 -404
  272. package/dist/knowledge/scenario-modes.js +1 -321
  273. package/dist/knowledge/service-confirm.js +1 -807
  274. package/dist/knowledge/service-context.js +1 -403
  275. package/dist/knowledge/service-ledger.js +1 -609
  276. package/dist/knowledge/service-puzzle.js +1 -236
  277. package/dist/knowledge/service-risk.d.ts +1 -1
  278. package/dist/knowledge/service-risk.js +1 -651
  279. package/dist/knowledge/service-templates.js +1 -456
  280. package/dist/knowledge/service-translation.js +1 -622
  281. package/dist/knowledge/template-registry.js +1 -353
  282. package/dist/knowledge/tool-constraints.js +1 -195
  283. package/dist/knowledge/tools-reference.js +1 -178
  284. package/dist/knowledge/treasury-confirm.js +1 -512
  285. package/dist/knowledge/treasury-context.js +1 -363
  286. package/dist/knowledge/treasury-ledger.js +1 -300
  287. package/dist/knowledge/treasury-puzzle.js +1 -216
  288. package/dist/knowledge/treasury-risk.js +1 -440
  289. package/dist/knowledge/treasury-templates.js +1 -358
  290. package/dist/knowledge/treasury-translation.js +1 -498
  291. package/dist/knowledge/trust-metrics.js +1 -198
  292. package/dist/knowledge/universal-template.d.ts +22 -0
  293. package/dist/knowledge/universal-template.js +1 -0
  294. package/dist/knowledge/util-confirm.d.ts +24 -0
  295. package/dist/knowledge/util-confirm.js +1 -0
  296. package/dist/knowledge/util-risk.js +1 -135
  297. package/dist/knowledge/util-translation.d.ts +38 -0
  298. package/dist/knowledge/util-translation.js +1 -0
  299. package/dist/knowledge/workflow-guidance.d.ts +116 -0
  300. package/dist/knowledge/workflow-guidance.js +1 -0
  301. package/dist/loop-engineering/aggregate.js +1 -132
  302. package/dist/loop-engineering/context-collect.js +1 -83
  303. package/dist/loop-engineering/diagnose.js +1 -273
  304. package/dist/loop-engineering/improve.js +1 -405
  305. package/dist/loop-engineering/index.js +1 -4
  306. package/dist/loop-engineering/pipeline.js +1 -56
  307. package/dist/mode-market/index.js +1 -3
  308. package/dist/mode-market/registry.js +1 -124
  309. package/dist/mode-market/review.js +1 -214
  310. package/dist/mode-market/submission.js +1 -85
  311. package/dist/participation/collaborator-interest.d.ts +23 -0
  312. package/dist/participation/collaborator-interest.js +1 -0
  313. package/dist/participation/customer-interest.d.ts +25 -0
  314. package/dist/participation/customer-interest.js +1 -0
  315. package/dist/participation/employee-kpi.d.ts +25 -0
  316. package/dist/participation/employee-kpi.js +1 -0
  317. package/dist/participation/employee-store.d.ts +16 -0
  318. package/dist/participation/employee-store.js +1 -0
  319. package/dist/participation/index.d.ts +2 -0
  320. package/dist/participation/index.js +1 -0
  321. package/dist/participation/merchant-interest.js +1 -100
  322. package/dist/participation/radar-core.d.ts +13 -3
  323. package/dist/participation/radar-core.js +1 -269
  324. package/dist/participation/supplier-interest.d.ts +25 -0
  325. package/dist/participation/supplier-interest.js +1 -0
  326. package/dist/persona/analyzer.js +1 -66
  327. package/dist/persona/bridge.js +1 -86
  328. package/dist/persona/defaults.js +1 -195
  329. package/dist/persona/experience-bridge.js +1 -23
  330. package/dist/persona/index.d.ts +9 -2
  331. package/dist/persona/index.js +1 -71
  332. package/dist/persona/local-region.d.ts +20 -0
  333. package/dist/persona/local-region.js +1 -0
  334. package/dist/persona/model.js +1 -111
  335. package/dist/persona/overrides.d.ts +10 -0
  336. package/dist/persona/overrides.js +1 -0
  337. package/dist/persona/pack-personae.d.ts +11 -0
  338. package/dist/persona/pack-personae.js +1 -0
  339. package/dist/persona/store.js +1 -62
  340. package/dist/persona/strategy-intent.d.ts +20 -0
  341. package/dist/persona/strategy-intent.js +1 -0
  342. package/dist/persona/types.d.ts +6 -2
  343. package/dist/persona/types.js +1 -5
  344. package/dist/project/business-puzzle.d.ts +1 -1
  345. package/dist/project/business-puzzle.js +1 -383
  346. package/dist/project/context-assembly.js +1 -254
  347. package/dist/project/deployment-bridge.js +1 -120
  348. package/dist/project/deployment-doc.js +1 -1126
  349. package/dist/project/edit-planner.js +1 -1342
  350. package/dist/project/evaluation.d.ts +37 -1
  351. package/dist/project/evaluation.js +1 -2011
  352. package/dist/project/game-theory.js +1 -177
  353. package/dist/project/graph-builder.js +1 -656
  354. package/dist/project/graph.d.ts +3 -6
  355. package/dist/project/graph.js +1 -340
  356. package/dist/project/handlers.d.ts +33 -2
  357. package/dist/project/handlers.js +1 -1784
  358. package/dist/project/index.d.ts +2 -0
  359. package/dist/project/index.js +1 -301
  360. package/dist/project/intent-analyzer.js +1 -149
  361. package/dist/project/machine-nodes.js +1 -36
  362. package/dist/project/merchant-guide.d.ts +19 -0
  363. package/dist/project/merchant-guide.js +1 -264
  364. package/dist/project/migration.js +1 -125
  365. package/dist/project/mode-actions.js +1 -309
  366. package/dist/project/namespace.js +1 -206
  367. package/dist/project/participation-radar.js +1 -428
  368. package/dist/project/pipeline-actions.js +1 -109
  369. package/dist/project/project-store.js +1 -422
  370. package/dist/project/query.js +1 -153
  371. package/dist/project/reverse-mapping.d.ts +34 -0
  372. package/dist/project/reverse-mapping.js +1 -0
  373. package/dist/project/risk-aggregator.js +1 -295
  374. package/dist/project/rollback-policy.js +1 -290
  375. package/dist/project/semantic-assembler.js +1 -345
  376. package/dist/project/semantic-graph.d.ts +3 -5
  377. package/dist/project/semantic-graph.js +1 -292
  378. package/dist/project/stage-gate.js +1 -369
  379. package/dist/project/substep-trace.js +1 -332
  380. package/dist/project/task-tracker.js +1 -78
  381. package/dist/project/workflow-design-assessment.d.ts +24 -0
  382. package/dist/project/workflow-design-assessment.js +1 -0
  383. package/dist/role/derivation.d.ts +18 -0
  384. package/dist/role/derivation.js +1 -0
  385. package/dist/role/index.d.ts +5 -0
  386. package/dist/role/index.js +1 -0
  387. package/dist/role/model.d.ts +8 -0
  388. package/dist/role/model.js +1 -0
  389. package/dist/role/resolution.d.ts +11 -0
  390. package/dist/role/resolution.js +1 -0
  391. package/dist/role/types.d.ts +11 -0
  392. package/dist/role/types.js +1 -0
  393. package/dist/rules.js +1 -52
  394. package/dist/safety/confirm-gate.d.ts +1 -1
  395. package/dist/safety/confirm-gate.js +1 -88
  396. package/dist/safety/index.js +1 -3
  397. package/dist/safety/preview.js +1 -52
  398. package/dist/schema/call/allocation.d.ts +186 -1385
  399. package/dist/schema/call/allocation.js +1 -34
  400. package/dist/schema/call/arbitration.d.ts +272 -1871
  401. package/dist/schema/call/arbitration.js +1 -113
  402. package/dist/schema/call/base.d.ts +1831 -9076
  403. package/dist/schema/call/base.js +1 -370
  404. package/dist/schema/call/bridge.d.ts +911 -3171
  405. package/dist/schema/call/bridge.js +1 -458
  406. package/dist/schema/call/contact.d.ts +135 -931
  407. package/dist/schema/call/contact.js +1 -37
  408. package/dist/schema/call/demand.d.ts +164 -1194
  409. package/dist/schema/call/demand.js +1 -47
  410. package/dist/schema/call/guard.d.ts +298 -1140
  411. package/dist/schema/call/guard.js +1 -161
  412. package/dist/schema/call/handler.js +1 -322
  413. package/dist/schema/call/index.js +1 -20
  414. package/dist/schema/call/machine.d.ts +459 -5403
  415. package/dist/schema/call/machine.js +1 -193
  416. package/dist/schema/call/order.d.ts +137 -844
  417. package/dist/schema/call/order.js +1 -35
  418. package/dist/schema/call/payment.d.ts +74 -561
  419. package/dist/schema/call/payment.js +1 -37
  420. package/dist/schema/call/permission-handler.js +1 -54
  421. package/dist/schema/call/permission.d.ts +335 -2791
  422. package/dist/schema/call/permission.js +1 -105
  423. package/dist/schema/call/personal.d.ts +227 -1814
  424. package/dist/schema/call/personal.js +1 -78
  425. package/dist/schema/call/progress.d.ts +140 -843
  426. package/dist/schema/call/progress.js +1 -47
  427. package/dist/schema/call/proof.d.ts +42 -258
  428. package/dist/schema/call/proof.js +1 -33
  429. package/dist/schema/call/repository.d.ts +324 -2222
  430. package/dist/schema/call/repository.js +1 -77
  431. package/dist/schema/call/reward.d.ts +153 -1183
  432. package/dist/schema/call/reward.js +1 -30
  433. package/dist/schema/call/semantic.js +1 -1679
  434. package/dist/schema/call/service.d.ts +376 -3431
  435. package/dist/schema/call/service.js +1 -184
  436. package/dist/schema/call/treasury.d.ts +252 -2158
  437. package/dist/schema/call/treasury.js +1 -71
  438. package/dist/schema/common/index.d.ts +222 -697
  439. package/dist/schema/common/index.js +1 -407
  440. package/dist/schema/config/index.d.ts +18 -161
  441. package/dist/schema/config/index.js +1 -68
  442. package/dist/schema/employee/index.d.ts +99 -0
  443. package/dist/schema/employee/index.js +1 -0
  444. package/dist/schema/evaluation/index.d.ts +1062 -3748
  445. package/dist/schema/evaluation/index.js +1 -356
  446. package/dist/schema/index.d.ts +3 -0
  447. package/dist/schema/index.js +1 -17
  448. package/dist/schema/industry-pack/index.d.ts +132 -0
  449. package/dist/schema/industry-pack/index.js +1 -0
  450. package/dist/schema/intent-radar/index.d.ts +92 -245
  451. package/dist/schema/intent-radar/index.js +1 -89
  452. package/dist/schema/local/index.d.ts +2045 -18080
  453. package/dist/schema/local/index.js +1 -927
  454. package/dist/schema/local/wip.d.ts +61 -651
  455. package/dist/schema/local/wip.js +1 -187
  456. package/dist/schema/messenger/index.d.ts +949 -5557
  457. package/dist/schema/messenger/index.js +1 -475
  458. package/dist/schema/operations.d.ts +2969 -26518
  459. package/dist/schema/operations.js +1 -520
  460. package/dist/schema/persona/index.d.ts +469 -1820
  461. package/dist/schema/persona/index.js +1 -148
  462. package/dist/schema/project/index.d.ts +1027 -8408
  463. package/dist/schema/project/index.js +1 -2057
  464. package/dist/schema/query/index.d.ts +12041 -75261
  465. package/dist/schema/query/index.js +1 -1646
  466. package/dist/schema/schema-query/index.d.ts +35 -98
  467. package/dist/schema/schema-query/index.js +1 -104
  468. package/dist/schema/schema-version.js +1 -76
  469. package/dist/schema/task-status.d.ts +26 -132
  470. package/dist/schema/task-status.js +1 -36
  471. package/dist/schema/trust/index.d.ts +194 -1290
  472. package/dist/schema/trust/index.js +1 -314
  473. package/dist/schema/utils/guard-parser.js +1 -419
  474. package/dist/schema/utils/guard-query-utils.js +1 -46
  475. package/dist/schema/utils/node-parser.js +1 -369
  476. package/dist/schema/utils/object-type-utils.js +1 -35
  477. package/dist/schema/utils/permission-index-utils.js +1 -7
  478. package/dist/schema/utils/permission-machine-check.js +1 -121
  479. package/dist/schema/utils/skills-recommendation.d.ts +1 -0
  480. package/dist/schema/utils/skills-recommendation.js +1 -77
  481. package/dist/schema/workspace/index.d.ts +69 -0
  482. package/dist/schema/workspace/index.js +1 -0
  483. package/dist/schema-query-impl/index.js +1 -0
  484. package/dist/schemas/account_operation.output.json +3147 -1652
  485. package/dist/schemas/account_operation.schema.json +225 -218
  486. package/dist/schemas/bridge_operation.output.json +1168 -650
  487. package/dist/schemas/bridge_operation.schema.json +736 -504
  488. package/dist/schemas/config_operation.output.json +185 -179
  489. package/dist/schemas/config_operation.schema.json +21 -26
  490. package/dist/schemas/employee_operation.output.json +207 -0
  491. package/dist/schemas/employee_operation.schema.json +176 -0
  492. package/dist/schemas/evaluation_operation.output.json +2329 -557
  493. package/dist/schemas/evaluation_operation.schema.json +2939 -720
  494. package/dist/schemas/guard2file.output.json +58 -64
  495. package/dist/schemas/guard2file.schema.json +79 -81
  496. package/dist/schemas/index.json +29 -11
  497. package/dist/schemas/industry_pack_operation.output.json +594 -0
  498. package/dist/schemas/industry_pack_operation.schema.json +55 -0
  499. package/dist/schemas/intent_radar.output.json +275 -200
  500. package/dist/schemas/intent_radar.schema.json +124 -123
  501. package/dist/schemas/local_info_operation.output.json +1174 -657
  502. package/dist/schemas/local_info_operation.schema.json +119 -125
  503. package/dist/schemas/local_mark_operation.output.json +1239 -689
  504. package/dist/schemas/local_mark_operation.schema.json +91 -96
  505. package/dist/schemas/machineNode2file.output.json +63 -69
  506. package/dist/schemas/machineNode2file.schema.json +79 -81
  507. package/dist/schemas/messenger_operation.output.json +2722 -1528
  508. package/dist/schemas/messenger_operation.schema.json +1482 -1264
  509. package/dist/schemas/onchain_events.output.json +2590 -975
  510. package/dist/schemas/onchain_events.schema.json +117 -99
  511. package/dist/schemas/onchain_operations.output.json +3957 -2309
  512. package/dist/schemas/onchain_operations.schema.json +20799 -9285
  513. package/dist/schemas/onchain_operations_allocation.schema.json +172 -108
  514. package/dist/schemas/onchain_operations_arbitration.schema.json +233 -146
  515. package/dist/schemas/onchain_operations_contact.schema.json +129 -90
  516. package/dist/schemas/onchain_operations_demand.schema.json +170 -112
  517. package/dist/schemas/onchain_operations_gen_passport.schema.json +61 -646
  518. package/dist/schemas/onchain_operations_gen_proof.schema.json +40 -172
  519. package/dist/schemas/onchain_operations_guard.schema.json +3765 -294
  520. package/dist/schemas/onchain_operations_machine.schema.json +537 -164
  521. package/dist/schemas/onchain_operations_order.schema.json +126 -96
  522. package/dist/schemas/onchain_operations_payment.schema.json +82 -67
  523. package/dist/schemas/onchain_operations_permission.schema.json +331 -93
  524. package/dist/schemas/onchain_operations_personal.schema.json +636 -96
  525. package/dist/schemas/onchain_operations_progress.schema.json +125 -92
  526. package/dist/schemas/onchain_operations_proof.schema.json +76 -69
  527. package/dist/schemas/onchain_operations_repository.schema.json +636 -249
  528. package/dist/schemas/onchain_operations_reward.schema.json +218 -108
  529. package/dist/schemas/onchain_operations_service.schema.json +679 -221
  530. package/dist/schemas/onchain_operations_treasury.schema.json +401 -135
  531. package/dist/schemas/onchain_table_data.output.json +6018 -2430
  532. package/dist/schemas/onchain_table_data.schema.json +544 -430
  533. package/dist/schemas/persona_operation.output.json +1568 -265
  534. package/dist/schemas/persona_operation.schema.json +346 -202
  535. package/dist/schemas/project_operation.output.json +6957 -5147
  536. package/dist/schemas/project_operation.schema.json +1050 -1020
  537. package/dist/schemas/query_task_status.output.json +195 -99
  538. package/dist/schemas/query_task_status.schema.json +12 -18
  539. package/dist/schemas/query_toolkit.output.json +18870 -14566
  540. package/dist/schemas/query_toolkit.schema.json +614 -522
  541. package/dist/schemas/schema_query.output.json +127 -129
  542. package/dist/schemas/schema_query.schema.json +64 -69
  543. package/dist/schemas/trust_score.output.json +678 -587
  544. package/dist/schemas/trust_score.schema.json +289 -277
  545. package/dist/schemas/wip_file.output.json +116 -124
  546. package/dist/schemas/wip_file.schema.json +142 -143
  547. package/dist/schemas/workspace_operation.output.json +277 -0
  548. package/dist/schemas/workspace_operation.schema.json +45 -0
  549. package/dist/schemas/wowok_buildin_info.output.json +1693 -723
  550. package/dist/schemas/wowok_buildin_info.schema.json +576 -512
  551. package/dist/telemetry/index.js +1 -112
  552. package/dist/telemetry/redact.js +1 -23
  553. package/dist/telemetry/storage.js +1 -80
  554. package/dist/tools/handlers/bridge.d.ts +8 -1
  555. package/dist/tools/handlers/bridge.js +1 -1
  556. package/dist/tools/handlers/config.js +1 -74
  557. package/dist/tools/handlers/employee.d.ts +2 -0
  558. package/dist/tools/handlers/employee.js +1 -0
  559. package/dist/tools/handlers/evaluation.js +1 -123
  560. package/dist/tools/handlers/file-export.js +1 -90
  561. package/dist/tools/handlers/industry-pack.d.ts +2 -0
  562. package/dist/tools/handlers/industry-pack.js +1 -0
  563. package/dist/tools/handlers/intent-radar.js +1 -76
  564. package/dist/tools/handlers/local.js +1 -53
  565. package/dist/tools/handlers/messenger.js +1 -188
  566. package/dist/tools/handlers/onchain.js +1 -1180
  567. package/dist/tools/handlers/persona.js +1 -89
  568. package/dist/tools/handlers/project.js +1 -211
  569. package/dist/tools/handlers/query.js +1 -434
  570. package/dist/tools/handlers/schema-query.js +1 -176
  571. package/dist/tools/handlers/task-status.js +1 -26
  572. package/dist/tools/handlers/trust.js +1 -380
  573. package/dist/tools/handlers/wip.js +1 -90
  574. package/dist/tools/handlers/workspace.d.ts +2 -0
  575. package/dist/tools/handlers/workspace.js +1 -0
  576. package/dist/tools/index.d.ts +2 -1
  577. package/dist/tools/index.js +1 -1382
  578. package/dist/tools/retry.js +1 -85
  579. package/dist/tools/rules-hook.d.ts +1 -1
  580. package/dist/tools/rules-hook.js +1 -23
  581. package/dist/tools/shared.d.ts +1 -1
  582. package/dist/tools/shared.js +1 -130
  583. package/dist/tools/types.d.ts +2 -1
  584. package/dist/tools/types.js +1 -1
  585. package/dist/tools/upgrade-check.d.ts +19 -0
  586. package/dist/tools/upgrade-check.js +1 -0
  587. package/dist/tools/wip-deploy-assist.js +1 -306
  588. package/dist/tools/wrap.js +1 -500
  589. package/package.json +7 -6
  590. package/dist/knowledge/arbitration-trust.d.ts +0 -24
  591. package/dist/knowledge/arbitration-trust.js +0 -117
  592. package/dist/schema/call/bridge-handler.d.ts +0 -8
  593. package/dist/schema/call/bridge-handler.js +0 -265
  594. package/dist/schema/sync-layer4.d.ts +0 -21
  595. package/dist/schema/sync-layer4.js +0 -286
  596. package/dist/schema-query/index.js +0 -810
  597. /package/dist/{schema-query → schema-query-impl}/index.d.ts +0 -0
@@ -1,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];}