zklicensing 0.1.0-beta.2 → 0.1.0-beta.21

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 (317) hide show
  1. package/README.md +417 -201
  2. package/build/agent.d.ts +371 -0
  3. package/build/agent.d.ts.map +1 -0
  4. package/build/agent.js +553 -0
  5. package/build/agent.js.map +1 -0
  6. package/build/agentActions.d.ts +841 -0
  7. package/build/agentActions.d.ts.map +1 -0
  8. package/build/agentActions.js +581 -0
  9. package/build/agentActions.js.map +1 -0
  10. package/build/agentRecord.d.ts +83 -0
  11. package/build/agentRecord.d.ts.map +1 -0
  12. package/build/agentRecord.js +69 -0
  13. package/build/agentRecord.js.map +1 -0
  14. package/build/agentVendor.d.ts +220 -0
  15. package/build/agentVendor.d.ts.map +1 -0
  16. package/build/agentVendor.js +306 -0
  17. package/build/agentVendor.js.map +1 -0
  18. package/build/appsLookup.d.ts +14 -0
  19. package/build/appsLookup.d.ts.map +1 -0
  20. package/build/appsLookup.js +12 -0
  21. package/build/appsLookup.js.map +1 -0
  22. package/build/archiveBootstrap.d.ts +31 -5
  23. package/build/archiveBootstrap.d.ts.map +1 -0
  24. package/build/archiveBootstrap.js +140 -47
  25. package/build/archiveBootstrap.js.map +1 -0
  26. package/build/atomicJson.d.ts +5 -0
  27. package/build/atomicJson.d.ts.map +1 -0
  28. package/build/atomicJson.js +55 -0
  29. package/build/atomicJson.js.map +1 -0
  30. package/build/bindClient.d.ts +85 -0
  31. package/build/bindClient.d.ts.map +1 -0
  32. package/build/bindClient.js +187 -0
  33. package/build/bindClient.js.map +1 -0
  34. package/build/buyClient.d.ts +27 -4
  35. package/build/buyClient.d.ts.map +1 -0
  36. package/build/buyClient.js +72 -26
  37. package/build/buyClient.js.map +1 -0
  38. package/build/chainHead.d.ts +61 -0
  39. package/build/chainHead.d.ts.map +1 -0
  40. package/build/chainHead.js +88 -0
  41. package/build/chainHead.js.map +1 -0
  42. package/build/compactMerkleMap.d.ts +72 -0
  43. package/build/compactMerkleMap.d.ts.map +1 -0
  44. package/build/compactMerkleMap.js +224 -0
  45. package/build/compactMerkleMap.js.map +1 -0
  46. package/build/contractInterface.d.ts +191 -51
  47. package/build/contractInterface.d.ts.map +1 -0
  48. package/build/contractInterface.js +234 -43
  49. package/build/contractInterface.js.map +1 -0
  50. package/build/contractTypes.d.ts +9 -0
  51. package/build/contractTypes.d.ts.map +1 -0
  52. package/build/contractTypes.js +28 -0
  53. package/build/contractTypes.js.map +1 -0
  54. package/build/countryStats.d.ts +12 -3
  55. package/build/countryStats.d.ts.map +1 -0
  56. package/build/countryStats.js +87 -23
  57. package/build/countryStats.js.map +1 -0
  58. package/build/deployClient.d.ts +138 -24
  59. package/build/deployClient.d.ts.map +1 -0
  60. package/build/deployClient.js +91 -31
  61. package/build/deployClient.js.map +1 -0
  62. package/build/deviceIdentity.d.ts +68 -0
  63. package/build/deviceIdentity.d.ts.map +1 -0
  64. package/build/deviceIdentity.js +209 -0
  65. package/build/deviceIdentity.js.map +1 -0
  66. package/build/freezeClient.d.ts +26 -6
  67. package/build/freezeClient.d.ts.map +1 -0
  68. package/build/freezeClient.js +30 -6
  69. package/build/freezeClient.js.map +1 -0
  70. package/build/generationClient.d.ts +6 -3
  71. package/build/generationClient.d.ts.map +1 -0
  72. package/build/generationClient.js +25 -38
  73. package/build/generationClient.js.map +1 -0
  74. package/build/holderSecret.d.ts +70 -0
  75. package/build/holderSecret.d.ts.map +1 -0
  76. package/build/holderSecret.js +76 -0
  77. package/build/holderSecret.js.map +1 -0
  78. package/build/index.d.ts +38 -38
  79. package/build/index.d.ts.map +1 -0
  80. package/build/index.js +97 -121
  81. package/build/index.js.map +1 -0
  82. package/build/keysClient.d.ts +142 -0
  83. package/build/keysClient.d.ts.map +1 -0
  84. package/build/keysClient.js +109 -0
  85. package/build/keysClient.js.map +1 -0
  86. package/build/licenseLeaf.d.ts +76 -0
  87. package/build/licenseLeaf.d.ts.map +1 -0
  88. package/build/licenseLeaf.js +189 -0
  89. package/build/licenseLeaf.js.map +1 -0
  90. package/build/licenseRecord.d.ts +68 -5
  91. package/build/licenseRecord.d.ts.map +1 -0
  92. package/build/licenseRecord.js +26 -1
  93. package/build/licenseRecord.js.map +1 -0
  94. package/build/licenseStore.d.ts +81 -4
  95. package/build/licenseStore.d.ts.map +1 -0
  96. package/build/licenseStore.js +400 -30
  97. package/build/licenseStore.js.map +1 -0
  98. package/build/licenseTrustless.d.ts +43 -0
  99. package/build/licenseTrustless.d.ts.map +1 -0
  100. package/build/licenseTrustless.js +180 -0
  101. package/build/licenseTrustless.js.map +1 -0
  102. package/build/manifestVerify.d.ts +29 -1
  103. package/build/manifestVerify.d.ts.map +1 -0
  104. package/build/manifestVerify.js +46 -4
  105. package/build/manifestVerify.js.map +1 -0
  106. package/build/minaPriceHistory.d.ts +9 -0
  107. package/build/minaPriceHistory.d.ts.map +1 -0
  108. package/build/minaPriceHistory.js +152 -0
  109. package/build/minaPriceHistory.js.map +1 -0
  110. package/build/onChainRoot.d.ts +60 -0
  111. package/build/onChainRoot.d.ts.map +1 -0
  112. package/build/onChainRoot.js +74 -0
  113. package/build/onChainRoot.js.map +1 -0
  114. package/build/ownershipLicenseHash.d.ts +25 -0
  115. package/build/ownershipLicenseHash.d.ts.map +1 -0
  116. package/build/ownershipLicenseHash.js +29 -0
  117. package/build/ownershipLicenseHash.js.map +1 -0
  118. package/build/ownershipSignature.d.ts +153 -0
  119. package/build/ownershipSignature.d.ts.map +1 -0
  120. package/build/ownershipSignature.js +297 -0
  121. package/build/ownershipSignature.js.map +1 -0
  122. package/build/permitCheckFlow.d.ts +155 -0
  123. package/build/permitCheckFlow.d.ts.map +1 -0
  124. package/build/permitCheckFlow.js +196 -0
  125. package/build/permitCheckFlow.js.map +1 -0
  126. package/build/permitDescribe.d.ts +124 -0
  127. package/build/permitDescribe.d.ts.map +1 -0
  128. package/build/permitDescribe.js +324 -0
  129. package/build/permitDescribe.js.map +1 -0
  130. package/build/permitInterface.d.ts +85 -0
  131. package/build/permitInterface.d.ts.map +1 -0
  132. package/build/permitInterface.js +121 -0
  133. package/build/permitInterface.js.map +1 -0
  134. package/build/permitMessages.d.ts +313 -0
  135. package/build/permitMessages.d.ts.map +1 -0
  136. package/build/permitMessages.js +462 -0
  137. package/build/permitMessages.js.map +1 -0
  138. package/build/permitProof.d.ts +108 -0
  139. package/build/permitProof.d.ts.map +1 -0
  140. package/build/permitProof.js +202 -0
  141. package/build/permitProof.js.map +1 -0
  142. package/build/permitRegistryRebuild.d.ts +166 -0
  143. package/build/permitRegistryRebuild.d.ts.map +1 -0
  144. package/build/permitRegistryRebuild.js +347 -0
  145. package/build/permitRegistryRebuild.js.map +1 -0
  146. package/build/permitTree.d.ts +88 -0
  147. package/build/permitTree.d.ts.map +1 -0
  148. package/build/permitTree.js +230 -0
  149. package/build/permitTree.js.map +1 -0
  150. package/build/permitsClient.d.ts +680 -0
  151. package/build/permitsClient.d.ts.map +1 -0
  152. package/build/permitsClient.js +597 -0
  153. package/build/permitsClient.js.map +1 -0
  154. package/build/proveErrors.d.ts +50 -0
  155. package/build/proveErrors.d.ts.map +1 -0
  156. package/build/proveErrors.js +76 -0
  157. package/build/proveErrors.js.map +1 -0
  158. package/build/receipt.d.ts +95 -0
  159. package/build/receipt.d.ts.map +1 -0
  160. package/build/receipt.js +84 -0
  161. package/build/receipt.js.map +1 -0
  162. package/build/refundClient.d.ts +7 -12
  163. package/build/refundClient.d.ts.map +1 -0
  164. package/build/refundClient.js +52 -21
  165. package/build/refundClient.js.map +1 -0
  166. package/build/registryTrustVerify.d.ts +78 -0
  167. package/build/registryTrustVerify.d.ts.map +1 -0
  168. package/build/registryTrustVerify.js +129 -0
  169. package/build/registryTrustVerify.js.map +1 -0
  170. package/build/releaseClient.d.ts +26 -0
  171. package/build/releaseClient.d.ts.map +1 -0
  172. package/build/releaseClient.js +65 -0
  173. package/build/releaseClient.js.map +1 -0
  174. package/build/renewClient.d.ts +28 -2
  175. package/build/renewClient.d.ts.map +1 -0
  176. package/build/renewClient.js +31 -27
  177. package/build/renewClient.js.map +1 -0
  178. package/build/seatName.d.ts +8 -0
  179. package/build/seatName.d.ts.map +1 -0
  180. package/build/seatName.js +136 -0
  181. package/build/seatName.js.map +1 -0
  182. package/build/slotConstants.d.ts +15 -0
  183. package/build/slotConstants.d.ts.map +1 -0
  184. package/build/slotConstants.js +17 -0
  185. package/build/slotConstants.js.map +1 -0
  186. package/build/statsClient.d.ts +61 -7
  187. package/build/statsClient.d.ts.map +1 -0
  188. package/build/statsClient.js +44 -5
  189. package/build/statsClient.js.map +1 -0
  190. package/build/successorChain.d.ts +35 -0
  191. package/build/successorChain.d.ts.map +1 -0
  192. package/build/successorChain.js +69 -0
  193. package/build/successorChain.js.map +1 -0
  194. package/build/taxId.d.ts +44 -0
  195. package/build/taxId.d.ts.map +1 -0
  196. package/build/taxId.js +212 -0
  197. package/build/taxId.js.map +1 -0
  198. package/build/trustAnchorVerify.d.ts +49 -0
  199. package/build/trustAnchorVerify.d.ts.map +1 -0
  200. package/build/trustAnchorVerify.js +432 -0
  201. package/build/trustAnchorVerify.js.map +1 -0
  202. package/build/trustAnchorVerifyCli.d.ts +45 -0
  203. package/build/trustAnchorVerifyCli.d.ts.map +1 -0
  204. package/build/trustAnchorVerifyCli.js +235 -0
  205. package/build/trustAnchorVerifyCli.js.map +1 -0
  206. package/build/txBroadcastClient.d.ts +26 -0
  207. package/build/txBroadcastClient.d.ts.map +1 -0
  208. package/build/txBroadcastClient.js +20 -0
  209. package/build/txBroadcastClient.js.map +1 -0
  210. package/build/unbindClient.d.ts +77 -0
  211. package/build/unbindClient.d.ts.map +1 -0
  212. package/build/unbindClient.js +169 -0
  213. package/build/unbindClient.js.map +1 -0
  214. package/build/units.d.ts +28 -0
  215. package/build/units.d.ts.map +1 -0
  216. package/build/units.js +65 -0
  217. package/build/units.js.map +1 -0
  218. package/build/vatRates.d.ts +54 -0
  219. package/build/vatRates.d.ts.map +1 -0
  220. package/build/vatRates.js +82 -0
  221. package/build/vatRates.js.map +1 -0
  222. package/build/vatRatesData.d.ts +5 -0
  223. package/build/vatRatesData.d.ts.map +1 -0
  224. package/build/vatRatesData.js +42 -0
  225. package/build/vatRatesData.js.map +1 -0
  226. package/build/vendorAccountClient.d.ts +66 -0
  227. package/build/vendorAccountClient.d.ts.map +1 -0
  228. package/build/vendorAccountClient.js +47 -0
  229. package/build/vendorAccountClient.js.map +1 -0
  230. package/build/verifyCore.d.ts +4 -1
  231. package/build/verifyCore.d.ts.map +1 -0
  232. package/build/verifyCore.js +21 -10
  233. package/build/verifyCore.js.map +1 -0
  234. package/build/verifyOffline.d.ts +85 -0
  235. package/build/verifyOffline.d.ts.map +1 -0
  236. package/build/verifyOffline.js +139 -0
  237. package/build/verifyOffline.js.map +1 -0
  238. package/build/verifyService.d.ts.map +1 -0
  239. package/build/verifyService.js +571 -501
  240. package/build/verifyService.js.map +1 -0
  241. package/build/verifyWithAncestors.d.ts +19 -0
  242. package/build/verifyWithAncestors.d.ts.map +1 -0
  243. package/build/verifyWithAncestors.js +127 -0
  244. package/build/verifyWithAncestors.js.map +1 -0
  245. package/build/zipToState.d.ts +2 -0
  246. package/build/zipToState.d.ts.map +1 -0
  247. package/build/zipToState.js +94 -0
  248. package/build/zipToState.js.map +1 -0
  249. package/package.json +141 -16
  250. package/src/agent.ts +682 -0
  251. package/src/agentActions.ts +637 -0
  252. package/src/agentRecord.ts +121 -0
  253. package/src/agentVendor.ts +356 -0
  254. package/src/appsLookup.ts +48 -0
  255. package/src/archiveBootstrap.ts +386 -0
  256. package/src/atomicJson.ts +53 -0
  257. package/src/bindClient.ts +297 -0
  258. package/src/buyClient.ts +344 -0
  259. package/src/chainHead.ts +106 -0
  260. package/src/compactMerkleMap.ts +222 -0
  261. package/src/contractInterface.ts +465 -0
  262. package/src/contractTypes.ts +31 -0
  263. package/src/countryStats.ts +200 -0
  264. package/src/deployClient.ts +517 -0
  265. package/src/deviceIdentity.ts +249 -0
  266. package/src/freezeClient.ts +162 -0
  267. package/src/generationClient.ts +145 -0
  268. package/src/holderSecret.ts +91 -0
  269. package/src/index.ts +362 -0
  270. package/src/keysClient.ts +135 -0
  271. package/src/licenseLeaf.ts +221 -0
  272. package/src/licenseRecord.ts +190 -0
  273. package/src/licenseStore.ts +767 -0
  274. package/src/licenseTrustless.ts +207 -0
  275. package/src/manifestVerify.ts +164 -0
  276. package/src/minaPriceHistory.ts +166 -0
  277. package/src/onChainRoot.ts +90 -0
  278. package/src/ownershipLicenseHash.ts +31 -0
  279. package/src/ownershipSignature.ts +421 -0
  280. package/src/permitCheckFlow.ts +227 -0
  281. package/src/permitDescribe.ts +362 -0
  282. package/src/permitInterface.ts +146 -0
  283. package/src/permitMessages.ts +572 -0
  284. package/src/permitProof.ts +230 -0
  285. package/src/permitRegistryRebuild.ts +423 -0
  286. package/src/permitTree.ts +232 -0
  287. package/src/permitsClient.ts +746 -0
  288. package/src/proveErrors.ts +98 -0
  289. package/src/receipt.ts +156 -0
  290. package/src/refundClient.ts +177 -0
  291. package/src/registryTrustVerify.ts +192 -0
  292. package/src/releaseClient.ts +101 -0
  293. package/src/renewClient.ts +234 -0
  294. package/src/seatName.ts +165 -0
  295. package/src/slotConstants.ts +18 -0
  296. package/src/statsClient.ts +249 -0
  297. package/src/successorChain.ts +87 -0
  298. package/src/taxId.ts +227 -0
  299. package/src/trustAnchorVerify.ts +550 -0
  300. package/src/trustAnchorVerifyCli.ts +234 -0
  301. package/src/txBroadcastClient.ts +48 -0
  302. package/src/unbindClient.ts +233 -0
  303. package/src/units.ts +74 -0
  304. package/src/vatRates.ts +100 -0
  305. package/src/vatRatesData.ts +43 -0
  306. package/src/vendorAccountClient.ts +120 -0
  307. package/src/verifyCore.ts +100 -0
  308. package/src/verifyOffline.ts +212 -0
  309. package/src/verifyService.ts +982 -0
  310. package/src/verifyWithAncestors.ts +163 -0
  311. package/src/zipToState.ts +94 -0
  312. package/build/licenseProof.d.ts +0 -26
  313. package/build/licenseProof.js +0 -41
  314. package/build/migrateClient.d.ts +0 -43
  315. package/build/migrateClient.js +0 -47
  316. package/build/ownership.d.ts +0 -34
  317. package/build/ownership.js +0 -147
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agentActions.d.ts","sourceRoot":"","sources":["../src/agentActions.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAgC,KAAK,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACxF,OAAO,EAAc,KAAK,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AAC7F,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAIzE;;;;;;;GAOG;AACH,eAAO,MAAM,wBAAwB,sEAAuE,CAAC;AAE7G,sFAAsF;AACtF,MAAM,MAAM,WAAW,GAAG,YAAY,CAAC;AAIvC,6EAA6E;AAC7E,MAAM,MAAM,eAAe,GACvB,cAAc,CAAC,QAAQ,CAAC,GACxB,cAAc,GAAG,sBAAsB,GAAG,kBAAkB,GAC5D,wBAAwB,GAAG,iBAAiB,GAAG,iBAAiB,GAAG,mBAAmB,GAAG,oBAAoB,GAC7G,cAAc,GAAG,iBAAiB,GAAG,gBAAgB,GACrD,qBAAqB,GAAG,uBAAuB,GAAG,cAAc,GAAG,YAAY,GAAG,gBAAgB,GAAG,cAAc,CAAC;AAExH,MAAM,MAAM,WAAW,GAAG;IACxB,cAAc,CAAC,EAAE,eAAe,EAAE,CAAC;IACnC,oEAAoE;IACpE,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,4CAA4C;IAC5C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,wDAAwD;IACxD,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;CACtB,CAAC;AAEF,0EAA0E;AAC1E,qBAAa,WAAW;IAEV,OAAO,CAAC,QAAQ,C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AAC;QAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GACvH;QAAE,IAAI,EAAE,QAAQ,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,SAAS,GAAG,WAAW,GAAG,QAAQ,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,GACpG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAC;QAAC,cAAc,CAAC,EAAE,MAAM,CAAA;KAAE,GAC/D;QAAE,IAAI,EAAE,UAAU,CAAC;QAAC,IAAI,EAAE,MAAM,EAAE,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE;;;GAU9D;AAED,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC,CAAC;AAExE,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,UAAU,EAAE,aAAa,EAAE,oBAAoB,EAAE,KAAK,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAExK,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,WAAW,EAAE,qBAAqB,EAAE,KAAK,WAAW,EAAE,KAAK,aAAa,EAAE,KAAK,gBAAgB,EAAE,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,581 @@
1
+ // Copyright (c) 2025-2026 zkLicensing project developers
2
+ // SPDX-License-Identifier: BUSL-1.1
3
+ /**
4
+ * agentActions.ts — `zklicensing/agent/actions`
5
+ *
6
+ * Lets an AI agent carry out actions with a key its owner gave it
7
+ * (PERMITS_PLAN.md §16.4): buy, renew and refund licenses, and accept
8
+ * permit grants. Every action starts from a `PreparedAction`
9
+ * (`zklicensing/agent` prepare*), then:
10
+ *
11
+ * - the owner's optional policy is checked (caps per action and per day,
12
+ * allowed actions, targets and networks) — none by default;
13
+ * - consent the action needs (a consumer's withdrawal waiver, permit
14
+ * conditions) must come from a **standing consent** the owner signed
15
+ * for this agent, and a vendor may require the human's own consent
16
+ * ('human-only'), in which case the agent gets the approval link instead;
17
+ * - the agent's wallet signs and pays; the result carries a confirmation
18
+ * that records who gave consent and under which authorisation.
19
+ *
20
+ * Loads o1js (identity derivation) on first use.
21
+ */
22
+ import { signActionRecord, policyHash } from './agentRecord.js';
23
+ import { AgentError } from './agent.js';
24
+ import { notifyBroadcast } from './txBroadcastClient.js';
25
+ import { minaUnit } from './units.js';
26
+ /**
27
+ * Error codes raised here before anything reaches the keeper, on top of the
28
+ * keeper's own codes (see /openapi.json). None is retryable as is.
29
+ * - POLICY_DENIED: the owner's policy doesn't allow the action.
30
+ * - CONSENT_HUMAN_ONLY: the vendor wants the human's own consent; hand them
31
+ * the approval link in the message.
32
+ * - CONSENT_REQUIRED: no standing consent covers what the action needs.
33
+ */
34
+ export const AGENT_ACTION_ERROR_CODES = ['POLICY_DENIED', 'CONSENT_HUMAN_ONLY', 'CONSENT_REQUIRED'];
35
+ /** Spend record for the per-day cap. Pass `load`/`save` to persist it. */
36
+ export class SpendLedger {
37
+ store;
38
+ entries = [];
39
+ constructor(store) {
40
+ this.store = store;
41
+ if (store)
42
+ this.entries = store.load().map(e => ({ at: e.at, nano: BigInt(e.nano) }));
43
+ }
44
+ spentOnDay(now = Date.now()) {
45
+ const day = Math.floor(now / 86_400_000);
46
+ return this.entries.filter(e => Math.floor(e.at / 86_400_000) === day).reduce((a, e) => a + e.nano, 0n);
47
+ }
48
+ record(nano, now = Date.now()) {
49
+ this.entries.push({ at: now, nano });
50
+ const cutoff = now - 2 * 86_400_000;
51
+ this.entries = this.entries.filter(e => e.at >= cutoff);
52
+ this.store?.save(this.entries.map(e => ({ at: e.at, nano: e.nano.toString() })));
53
+ }
54
+ }
55
+ const toNano = (mina) => BigInt(Math.round(mina * 1e9));
56
+ /** Throws POLICY_DENIED when the owner's policy doesn't allow this action. */
57
+ export function checkPolicy(policy, prepared, target, ledger, now = Date.now()) {
58
+ checkActionPolicy(policy, { action: prepared.action, network: prepared.network, target, amountNano: prepared.action === 'refund' ? 0n : BigInt(prepared.amounts.total) }, ledger, now);
59
+ }
60
+ /**
61
+ * The policy check for any action. `target` is the zkApp or registry acted
62
+ * on (none for a registry not yet deployed); `amountNano` what leaves the
63
+ * wallet besides transaction fees.
64
+ */
65
+ export function checkActionPolicy(policy, a, ledger, now = Date.now()) {
66
+ if (!policy)
67
+ return;
68
+ const deny = (why) => { throw new AgentError(`Not allowed by the owner's policy: ${why}`, 'POLICY_DENIED', 0, false); };
69
+ if (policy.allowedActions && !policy.allowedActions.includes(a.action))
70
+ deny(`action "${a.action}"`);
71
+ if (policy.networks && !policy.networks.includes(a.network))
72
+ deny(`network ${a.network}`);
73
+ if (policy.allowedTargets && a.target !== undefined && !policy.allowedTargets.includes(a.target))
74
+ deny(`target ${a.target}`);
75
+ const amount = a.amountNano ?? 0n;
76
+ if (policy.maxPerActionMina !== undefined && amount > toNano(policy.maxPerActionMina))
77
+ deny(`amount above ${policy.maxPerActionMina} ${minaUnit(a.network)} per action`);
78
+ // The daily cap counts what actions spend: one that spends nothing (terms,
79
+ // details, prices, listings, signatures, refunds) needs no ledger for it.
80
+ if (policy.maxPerDayMina !== undefined && amount > 0n) {
81
+ if (!ledger)
82
+ deny('a daily cap needs a SpendLedger');
83
+ if (ledger.spentOnDay(now) + amount > toNano(policy.maxPerDayMina))
84
+ deny(`daily cap of ${policy.maxPerDayMina} ${minaUnit(a.network)}`);
85
+ }
86
+ }
87
+ const KIND_TEXT = {
88
+ 'withdrawal-waiver': 'waive my right of withdrawal when a purchase or renewal takes effect immediately',
89
+ 'vendor-terms': 'accept the vendor terms of service and register apps, waiving my right of withdrawal on each registration fee',
90
+ 'authority-terms': 'accept authority terms of service',
91
+ 'permit-conditions': 'accept the conditions of permits granted to me',
92
+ };
93
+ export function standingConsentStatement(f) {
94
+ return [
95
+ 'zkLicensing standing consent',
96
+ `owner: ${f.owner}`,
97
+ `agent: ${f.agent}`,
98
+ `network: ${f.network}`,
99
+ `issuedAt: ${f.issuedAt}`,
100
+ `expiresAt: ${f.expiresAt ?? 'until revoked'}`,
101
+ 'I authorise this agent, acting with its own key, to give the following consents on my behalf:',
102
+ ...[...f.kinds].sort().map(k => `- ${KIND_TEXT[k]}`),
103
+ 'Each consent it gives is recorded as given by this agent under this authorisation.',
104
+ ].join('\n');
105
+ }
106
+ /** How long a standing consent lasts unless the owner chooses otherwise. */
107
+ export const DEFAULT_CONSENT_DAYS = 90;
108
+ /**
109
+ * The owner signs a standing consent for an agent with their own wallet.
110
+ * It expires after DEFAULT_CONSENT_DAYS unless `expiresAt` is given; pass
111
+ * `expiresAt: null` for a consent that lasts until revoked.
112
+ */
113
+ export async function grantStandingConsent(owner, f) {
114
+ if (f.kinds.length === 0)
115
+ throw new AgentError('kinds must not be empty', 'INVALID_REQUEST', 0, false);
116
+ const issued = new Date();
117
+ const expiresAt = f.expiresAt === undefined ? new Date(issued.getTime() + DEFAULT_CONSENT_DAYS * 86_400_000).toISOString() : f.expiresAt;
118
+ const fields = { owner: owner.address, agent: f.agent, kinds: f.kinds, network: f.network, issuedAt: issued.toISOString(), expiresAt };
119
+ const statement = standingConsentStatement(fields);
120
+ return { version: 1, ...fields, statement, signature: await owner.signMessage(statement) };
121
+ }
122
+ /** Checks a standing consent's text and signature (mina-signer, as for wallet text signatures). */
123
+ export async function verifyStandingConsent(c, now = Date.now()) {
124
+ if (c?.version !== 1)
125
+ return { ok: false, reason: 'unknown consent format' };
126
+ if (c.statement !== standingConsentStatement(c))
127
+ return { ok: false, reason: 'statement does not match its fields' };
128
+ if (c.expiresAt && Date.parse(c.expiresAt) <= now)
129
+ return { ok: false, reason: 'expired' };
130
+ const { default: Client } = await import('mina-signer');
131
+ const signer = new Client({ network: c.network === 'mainnet' ? 'mainnet' : 'testnet' });
132
+ const ok = signer.verifyMessage({ data: c.statement, publicKey: c.owner, signature: c.signature });
133
+ return ok ? { ok: true, reason: null } : { ok: false, reason: 'signature does not verify for the owner' };
134
+ }
135
+ /** SHA-256 (hex) of a consent's statement: how a consent is referred to and revoked. */
136
+ export async function consentId(c) {
137
+ return sha256Hex(c.statement);
138
+ }
139
+ /** The text an owner signs to revoke a standing consent. */
140
+ export function standingConsentRevocationStatement(f) {
141
+ return [
142
+ 'zkLicensing standing consent revocation',
143
+ `owner: ${f.owner}`,
144
+ `consent: ${f.statementSha256}`,
145
+ `network: ${f.network}`,
146
+ `revokedAt: ${f.revokedAt}`,
147
+ 'I revoke this standing consent. My agent may no longer give consent on my behalf under it.',
148
+ ].join('\n');
149
+ }
150
+ /** The owner revokes a standing consent at the keeper, signing with their own wallet. */
151
+ export async function revokeStandingConsent(owner, consent, opts) {
152
+ if (owner.address !== consent.owner)
153
+ throw new AgentError('Only the consent\'s owner can revoke it', 'FORBIDDEN', 0, false);
154
+ const statementSha256 = await consentId(consent);
155
+ const revokedAt = new Date().toISOString();
156
+ const statement = standingConsentRevocationStatement({ owner: owner.address, statementSha256, network: consent.network, revokedAt });
157
+ const signature = await owner.signMessage(statement);
158
+ const r = await (opts.fetcher ?? fetch)(`${opts.keeperUrl.replace(/\/+$/, '')}/consents/revoke`, {
159
+ method: 'POST', headers: { 'Content-Type': 'application/json' },
160
+ body: JSON.stringify({ owner: owner.address, statementSha256, network: consent.network, revokedAt, signature }),
161
+ });
162
+ const body = await r.json().catch(() => ({}));
163
+ if (!r.ok)
164
+ throw new AgentError(body.error ?? `HTTP ${r.status}`, body.code ?? 'UPSTREAM_UNAVAILABLE', r.status, body.retryable ?? r.status >= 500);
165
+ return { revokedAt };
166
+ }
167
+ /** Whether the owner has revoked a consent (asks the keeper). */
168
+ export async function isStandingConsentRevoked(consent, opts) {
169
+ const id = await consentId(consent);
170
+ const r = await (opts.fetcher ?? fetch)(`${opts.keeperUrl.replace(/\/+$/, '')}/consents/${id}?owner=${encodeURIComponent(consent.owner)}`);
171
+ if (!r.ok)
172
+ throw new AgentError(`Could not check whether the consent was revoked (HTTP ${r.status})`, 'UPSTREAM_UNAVAILABLE', r.status, true);
173
+ return (await r.json()).revoked === true;
174
+ }
175
+ /** Signs the action record; a failure becomes a warning (the payment is already sent). */
176
+ async function recordAction(opts, prepared, consent, f) {
177
+ try {
178
+ const actionRecord = await signActionRecord(opts.wallet, {
179
+ network: prepared.network, action: prepared.action, target: f.target, reference: f.reference, summary: prepared.summary,
180
+ amounts: prepared.amounts, txHash: f.txHash, receipt: f.receipt ?? null, policySha256: await policyHash(opts.policy),
181
+ consent: consent.givenBy === 'agent' ? { givenBy: 'agent', statementSha256: consent.statementSha256, kinds: [...consent.kinds] } : { givenBy: 'none' },
182
+ at: new Date().toISOString(),
183
+ });
184
+ return { actionRecord, warnings: [] };
185
+ }
186
+ catch (e) {
187
+ return { warnings: [`The action record could not be signed (${e?.message ?? e}).`] };
188
+ }
189
+ }
190
+ async function sha256Hex(text) {
191
+ const d = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(text));
192
+ return [...new Uint8Array(d)].map(b => b.toString(16).padStart(2, '0')).join('');
193
+ }
194
+ /**
195
+ * Consent the prepared action needs, from the standing consent. Refuses
196
+ * when the vendor requires the human's own consent, returning the approval
197
+ * link in the error so the agent can hand it to the human.
198
+ */
199
+ export async function consentFor(prepared, agentAddress, consent, keeper) {
200
+ const needed = prepared.requiresConsent;
201
+ if (needed.length === 0)
202
+ return { givenBy: 'none' };
203
+ if (needed.includes('withdrawal-waiver') && !prepared.agentMayConsent) {
204
+ throw new AgentError(`The vendor requires the buyer's own consent for this purchase. Ask the human to approve it: ${prepared.approvalUrl ?? '(no approval page)'}`, 'CONSENT_HUMAN_ONLY', 0, false);
205
+ }
206
+ if (!consent)
207
+ throw new AgentError(`This action needs consent (${needed.join(', ')}); none was given. Ask the human: ${prepared.approvalUrl ?? '(no approval page)'}`, 'CONSENT_REQUIRED', 0, false);
208
+ if (consent.agent !== agentAddress)
209
+ throw new AgentError('The standing consent is for another agent key', 'CONSENT_REQUIRED', 0, false);
210
+ if (consent.network !== prepared.network)
211
+ throw new AgentError('The standing consent is for another network', 'CONSENT_REQUIRED', 0, false);
212
+ const missing = needed.filter(k => !consent.kinds.includes(k));
213
+ if (missing.length)
214
+ throw new AgentError(`The standing consent does not cover: ${missing.join(', ')}`, 'CONSENT_REQUIRED', 0, false);
215
+ const v = await verifyStandingConsent(consent);
216
+ if (!v.ok)
217
+ throw new AgentError(`Standing consent is not valid: ${v.reason}`, 'CONSENT_REQUIRED', 0, false);
218
+ // Fails closed: an agent that can't confirm the consent still stands doesn't use it.
219
+ if (keeper && await isStandingConsentRevoked(consent, keeper))
220
+ throw new AgentError('The owner has revoked this standing consent', 'CONSENT_REQUIRED', 0, false);
221
+ return { givenBy: 'agent', agent: consent.agent, owner: consent.owner, kinds: needed, statementSha256: await sha256Hex(consent.statement), issuedAt: consent.issuedAt };
222
+ }
223
+ /** Runs the keeper confirm step after a transaction is sent; a failure becomes a warning. */
224
+ async function afterSend(confirm, step) {
225
+ let last;
226
+ for (let attempt = 0; attempt < 3; attempt++) {
227
+ try {
228
+ return { warnings: [], result: await confirm() };
229
+ }
230
+ catch (e) {
231
+ last = e;
232
+ await new Promise(r => setTimeout(r, 500 * 2 ** attempt));
233
+ }
234
+ }
235
+ return { warnings: [`The transaction was sent but the keeper did not record it (${last?.message}). Keep the result and retry ${step} with the transaction hash.`] };
236
+ }
237
+ function assertFresh(prepared) {
238
+ if (Date.parse(prepared.expiresAt) <= Date.now())
239
+ throw new AgentError('The prepared action has expired; prepare it again', 'REQUEST_STALE', 0, true);
240
+ }
241
+ function randomPassphrase() {
242
+ const b = crypto.getRandomValues(new Uint8Array(24));
243
+ return btoa(String.fromCharCode(...b)).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
244
+ }
245
+ // ── licensing ────────────────────────────────────────────────────────────────
246
+ /**
247
+ * Buys a license. The license belongs to a key derived from `passphrase`
248
+ * (generated if omitted) — keep the returned passphrase and license file:
249
+ * they are the license.
250
+ */
251
+ export async function buyLicense(prepared, opts) {
252
+ if (prepared.action !== 'buy')
253
+ throw new AgentError('Not a prepared purchase', 'INVALID_REQUEST', 0, false);
254
+ assertFresh(prepared);
255
+ const zkAppAddress = String(prepared.params.zkAppAddress);
256
+ checkPolicy(opts.policy, prepared, zkAppAddress, opts.ledger);
257
+ const consent = await consentFor(prepared, opts.wallet.address, opts.consent, { keeperUrl: opts.keeperUrl, fetcher: opts.fetcher });
258
+ const { deriveBuyIdentity, proveBuy, confirmBuy } = await import('./buyClient.js');
259
+ const passphrase = opts.passphrase ?? randomPassphrase();
260
+ const identity = await deriveBuyIdentity(passphrase, zkAppAddress);
261
+ const proved = await proveBuy({
262
+ keeperUrl: opts.keeperUrl, licenseHash: identity.licenseHash.toString(), buyerAddress: opts.wallet.address, zkAppAddress,
263
+ ownerPubKey: identity.publicKeyBase58, network: prepared.network, duration: prepared.params.duration,
264
+ buyerCountry: opts.buyerCountry, buyerZip: opts.buyerZip,
265
+ refundWaiverAccepted: prepared.params.escrowless === true, fetcher: opts.fetcher,
266
+ agentConsent: consent.givenBy === 'agent' ? opts.consent : undefined,
267
+ });
268
+ const txHash = await opts.wallet.signAndSendTransaction(proved.provenTxJson);
269
+ opts.ledger?.record(BigInt(prepared.amounts.total));
270
+ await notifyBroadcast({ keeperUrl: opts.keeperUrl, appId: proved.appKey, txHash, fetcher: opts.fetcher });
271
+ // The payment is sent: never throw past this point, or the passphrase
272
+ // (the license itself) would be lost with the error.
273
+ const { warnings, result: confirmed } = await afterSend(() => confirmBuy({ keeperUrl: opts.keeperUrl, zkAppAddress, licenseHash: proved.licenseHash, txHash, fetcher: opts.fetcher }), 'confirmBuy (zklicensing/buy)');
274
+ const rec = await recordAction(opts, prepared, consent, { target: zkAppAddress, reference: proved.licenseHash, txHash, receipt: confirmed?.receipt?.number });
275
+ return {
276
+ txHash,
277
+ warnings: [...warnings, ...rec.warnings],
278
+ ...(rec.actionRecord ? { actionRecord: rec.actionRecord } : {}),
279
+ passphrase,
280
+ // The receipt in the vendor's name (zklicensing/receipt): keep it apart from the license file.
281
+ ...(confirmed?.receipt ? { receipt: confirmed.receipt } : {}),
282
+ proofFile: {
283
+ licenseHash: proved.licenseHash, expirySlot: proved.expirySlot, zkAppAddress, network: prepared.network, txHash,
284
+ tier: proved.durationLabel, verificationKeyHash: proved.verificationKeyHash, purchaseSlot: proved.purchaseSlot,
285
+ purchaseAmount: proved.purchaseAmount, escrowless: prepared.params.escrowless === true, generation: proved.generation, pending: true,
286
+ },
287
+ confirmation: { action: 'buy', summary: prepared.summary, amounts: prepared.amounts, consent, at: new Date().toISOString() },
288
+ };
289
+ }
290
+ /** Renews a license; always needs the withdrawal waiver (renewals take effect immediately). */
291
+ export async function renewLicense(prepared, opts) {
292
+ if (prepared.action !== 'renew')
293
+ throw new AgentError('Not a prepared renewal', 'INVALID_REQUEST', 0, false);
294
+ assertFresh(prepared);
295
+ const zkAppAddress = String(prepared.params.zkAppAddress);
296
+ checkPolicy(opts.policy, prepared, zkAppAddress, opts.ledger);
297
+ const consent = await consentFor(prepared, opts.wallet.address, opts.consent, { keeperUrl: opts.keeperUrl, fetcher: opts.fetcher });
298
+ const { proveRenew, confirmRenew } = await import('./renewClient.js');
299
+ const proved = await proveRenew({
300
+ keeperUrl: opts.keeperUrl, licenseHash: String(prepared.params.licenseHash), buyerAddress: opts.wallet.address, zkAppAddress,
301
+ network: prepared.network, duration: prepared.params.duration, waiverAccepted: true, fetcher: opts.fetcher,
302
+ agentConsent: consent.givenBy === 'agent' ? opts.consent : undefined,
303
+ });
304
+ const txHash = await opts.wallet.signAndSendTransaction(proved.provenTxJson);
305
+ opts.ledger?.record(BigInt(prepared.amounts.total));
306
+ await notifyBroadcast({ keeperUrl: opts.keeperUrl, appId: proved.appKey, txHash, fetcher: opts.fetcher });
307
+ const { warnings, result: confirmed } = await afterSend(() => confirmRenew({ keeperUrl: opts.keeperUrl, zkAppAddress, licenseHash: proved.licenseHash, txHash, fetcher: opts.fetcher }), 'confirmRenew (zklicensing/renew)');
308
+ const rec = await recordAction(opts, prepared, consent, { target: zkAppAddress, reference: proved.licenseHash, txHash, receipt: confirmed?.receipt?.number });
309
+ return { txHash, warnings: [...warnings, ...rec.warnings], ...(rec.actionRecord ? { actionRecord: rec.actionRecord } : {}), newExpirySlot: proved.newExpirySlot, ...(confirmed?.receipt ? { receipt: confirmed.receipt } : {}), confirmation: { action: 'renew', summary: prepared.summary, amounts: prepared.amounts, consent, at: new Date().toISOString() } };
310
+ }
311
+ /** Refunds a license inside its 14-day window, to the wallet that bought it. */
312
+ export async function refundLicense(prepared, opts) {
313
+ if (prepared.action !== 'refund')
314
+ throw new AgentError('Not a prepared refund', 'INVALID_REQUEST', 0, false);
315
+ assertFresh(prepared);
316
+ const zkAppAddress = String(prepared.params.zkAppAddress);
317
+ checkPolicy(opts.policy, prepared, zkAppAddress, opts.ledger);
318
+ const { proveRefund, confirmRefund } = await import('./refundClient.js');
319
+ const proved = await proveRefund({
320
+ keeperUrl: opts.keeperUrl, licenseHash: String(prepared.params.licenseHash), buyerAddress: opts.wallet.address, zkAppAddress,
321
+ network: prepared.network, fetcher: opts.fetcher,
322
+ });
323
+ const txHash = await opts.wallet.signAndSendTransaction(proved.provenTxJson);
324
+ const { warnings, result: confirmed } = await afterSend(() => confirmRefund({ keeperUrl: opts.keeperUrl, zkAppAddress, licenseHash: proved.licenseHash, txHash, fetcher: opts.fetcher }), 'confirmRefund (zklicensing/refund)');
325
+ const rec = await recordAction(opts, prepared, { givenBy: 'none' }, { target: zkAppAddress, reference: proved.licenseHash, txHash, receipt: confirmed?.creditNote?.number });
326
+ return { txHash, warnings: [...warnings, ...rec.warnings], ...(rec.actionRecord ? { actionRecord: rec.actionRecord } : {}), ...(confirmed?.creditNote ? { creditNote: confirmed.creditNote } : {}), confirmation: { action: 'refund', summary: prepared.summary, amounts: prepared.amounts, consent: { givenBy: 'none' }, at: new Date().toISOString() } };
327
+ }
328
+ // ── permits ──────────────────────────────────────────────────────────────────
329
+ /**
330
+ * Accepts a permit grant as its holder (the agent's wallet must be the
331
+ * holder key) and pays with `payer` (default the same wallet).
332
+ */
333
+ export async function acceptPermitGrant(prepared, opts) {
334
+ if (prepared.action !== 'accept-permit')
335
+ throw new AgentError('Not a prepared permit acceptance', 'INVALID_REQUEST', 0, false);
336
+ assertFresh(prepared);
337
+ const registry = String(prepared.params.registry);
338
+ checkPolicy(opts.policy, prepared, registry, opts.ledger);
339
+ if (prepared.params.holderKey !== opts.wallet.address)
340
+ throw new AgentError('The agent wallet is not the permit holder', 'FORBIDDEN', 0, false);
341
+ const consent = await consentFor(prepared, opts.wallet.address, opts.consent, { keeperUrl: opts.keeperUrl, fetcher: opts.fetcher });
342
+ const { createPermitsClient } = await import('./permitsClient.js');
343
+ const client = createPermitsClient({ keeperUrl: opts.keeperUrl, network: prepared.network, wallet: opts.wallet, fetcher: opts.fetcher });
344
+ const res = await client.acceptGrant(String(prepared.params.requestId), opts.payer);
345
+ opts.ledger?.record(BigInt(prepared.amounts.total));
346
+ const rec = await recordAction(opts, prepared, consent, { target: registry, reference: res.subject, txHash: res.txHash, receipt: res.receipt?.number });
347
+ return { ...res, ...(rec.actionRecord ? { actionRecord: rec.actionRecord } : {}), ...(rec.warnings.length ? { warnings: rec.warnings } : {}), confirmation: { action: 'accept-permit', summary: prepared.summary, amounts: prepared.amounts, consent, docHash: prepared.params.docHash ?? null, at: new Date().toISOString() } };
348
+ }
349
+ // ── broadcasting ─────────────────────────────────────────────────────────────
350
+ /** Public Mina nodes used to broadcast when no URL is given (as onChainRoot's defaults). */
351
+ export const DEFAULT_SEND_GRAPHQL_URLS = {
352
+ mainnet: 'https://api.minascan.io/node/mainnet/v1/graphql',
353
+ devnet: 'https://devnet-plain-1.gcp.o1test.net/graphql',
354
+ };
355
+ /**
356
+ * A `send` for `minaSignerWallet` that posts the signed zkApp command to a
357
+ * Mina node's GraphQL `sendZkapp` — no o1js needed.
358
+ */
359
+ export function graphqlSender(network, opts = {}) {
360
+ const url = opts.url ?? DEFAULT_SEND_GRAPHQL_URLS[network];
361
+ const fetcher = opts.fetcher ?? fetch;
362
+ return async (zkappCommand) => {
363
+ const resp = await fetcher(url, {
364
+ method: 'POST',
365
+ headers: { 'Content-Type': 'application/json' },
366
+ body: JSON.stringify({
367
+ query: 'mutation($input: SendZkappInput!) { sendZkapp(input: $input) { zkapp { hash } } }',
368
+ variables: { input: { zkappCommand } },
369
+ }),
370
+ });
371
+ const body = await resp.json().catch(() => null);
372
+ const hash = body?.data?.sendZkapp?.zkapp?.hash;
373
+ if (!resp.ok || !hash) {
374
+ const why = body?.errors?.map(e => e.message).join('; ') || `HTTP ${resp.status}`;
375
+ throw new AgentError(`The Mina node refused the transaction: ${why}`, 'UPSTREAM_UNAVAILABLE', resp.status, resp.status >= 500);
376
+ }
377
+ return hash;
378
+ };
379
+ }
380
+ /**
381
+ * Every permits flow for an agent key, with the owner's policy checked
382
+ * first: as an operator (apply, withdraw, surrender, prove access) and as an
383
+ * authority key-set member (create and deploy a registry, decide
384
+ * applications, sign and execute requests, request changes). Signing a
385
+ * request is one key's approval; the registry's threshold still applies.
386
+ */
387
+ export async function createPermitAgent(opts) {
388
+ const { createPermitsClient } = await import('./permitsClient.js');
389
+ const client = createPermitsClient({ keeperUrl: opts.keeperUrl, network: opts.network, wallet: opts.wallet, fetcher: opts.fetcher });
390
+ const net = opts.network;
391
+ const allow = (action, target) => checkActionPolicy(opts.policy, { action, network: net, target }, opts.ledger);
392
+ const registryOf = async (requestId) => (await client.getRequest(requestId)).request;
393
+ // Pays an application, retrying while the keeper is busy (another proof,
394
+ // the registry syncing). If it still can't, the application stays saved
395
+ // unpaid: the error names it, so it is paid (or withdrawn) rather than
396
+ // applied for again, which would make another and use up the key's places.
397
+ const payWithRetry = async (id) => {
398
+ const until = Date.now() + (opts.payRetryMs ?? 180_000);
399
+ for (;;) {
400
+ try {
401
+ return await client.fileApplication(id);
402
+ }
403
+ catch (e) {
404
+ const wait = Math.min(60_000, Number(e?.body?.retryAfterMs ?? e?.retryAfterMs ?? 15_000));
405
+ if (e?.retryable === true && Date.now() + wait < until) {
406
+ await new Promise(r => setTimeout(r, wait));
407
+ continue;
408
+ }
409
+ throw new AgentError(`${e?.message ?? String(e)}. Application ${id} is saved unpaid: pay it with pay_permit_application (payApplication) or withdraw it; applying again makes another application.`, typeof e?.code === 'string' ? e.code : 'INTERNAL', typeof e?.status === 'number' ? e.status : 0, e?.retryable === true, e?.body?.retryAfterMs, { applicationId: id });
410
+ }
411
+ }
412
+ };
413
+ return {
414
+ client,
415
+ address: opts.wallet.address,
416
+ // operator
417
+ /**
418
+ * Applies for a permit (`subject`: renew or change this key's permit) and
419
+ * pays the fee into escrow from this key: a spend under the owner's
420
+ * policy (the full fee; on a rejection or withdrawal only the processing
421
+ * fee is kept, with no decision by the deadline nothing).
422
+ */
423
+ async apply(registry, a) {
424
+ allow('apply-permit', registry);
425
+ const { chain } = await client.getRegistry(registry);
426
+ const fee = BigInt((a.subject ? chain?.fees?.renewalFee : chain?.fees?.grantFee) ?? 0);
427
+ checkActionPolicy(opts.policy, { action: 'apply-permit', network: net, target: registry, amountNano: fee }, opts.ledger);
428
+ const created = await client.apply(registry, { ...a, holderKey: opts.wallet.address, pay: false });
429
+ const due = BigInt(created.apply?.fee ?? fee);
430
+ if (due !== fee)
431
+ checkActionPolicy(opts.policy, { action: 'apply-permit', network: net, target: registry, amountNano: due }, opts.ledger);
432
+ const filed = await payWithRetry(created.application.id);
433
+ opts.ledger?.record(due);
434
+ return { ...created, ...filed };
435
+ },
436
+ /**
437
+ * Pays an application this key made that is still unpaid (submitted):
438
+ * for one whose payment `apply` couldn't complete. A spend under the
439
+ * owner's policy, as `apply`.
440
+ */
441
+ async payApplication(id) {
442
+ const { application, apply } = await client.getApplication(id);
443
+ allow('apply-permit', application?.registry);
444
+ if (!apply)
445
+ throw new AgentError(`Application ${id} is ${application?.status}: nothing to pay`, 'CONFLICT', 409, false);
446
+ const due = BigInt(apply.fee ?? 0);
447
+ checkActionPolicy(opts.policy, { action: 'apply-permit', network: net, target: application.registry, amountNano: due }, opts.ledger);
448
+ const filed = await payWithRetry(id);
449
+ opts.ledger?.record(due);
450
+ return { application: { ...application, status: 'filed' }, ...filed };
451
+ },
452
+ /** Withdraws an application (paid: the processing fee is kept, the rest refunded). */
453
+ async withdrawApplication(id) {
454
+ const { application } = await client.getApplication(id);
455
+ allow('withdraw-application', application?.registry);
456
+ return client.withdrawApplication(id);
457
+ },
458
+ /** After the decision deadline: returns the whole fee to the payer. */
459
+ async reclaimApplication(id) {
460
+ const { application } = await client.getApplication(id);
461
+ allow('withdraw-application', application?.registry);
462
+ return client.reclaimApplication(id);
463
+ },
464
+ async surrender(registry, subject) {
465
+ allow('surrender-permit', registry);
466
+ return client.surrender(registry, subject);
467
+ },
468
+ /**
469
+ * Proves this key holds an active permit covering `requiredScope`,
470
+ * without revealing which permit (zero-knowledge holder proof). Give the
471
+ * verifier the proof. The challenge is bound to the verifier: `verifier`
472
+ * is the identity this agent is actually talking to (the service's URL,
473
+ * not a name it claims) and `nonce` the number it handed out, so two
474
+ * services cannot link the agent by agreeing on one challenge. The
475
+ * permit's secret is re-derived with this key (findHolderSecret).
476
+ */
477
+ async proveAccess(a) {
478
+ const [{ proveHolder, holderProofMessage, verifierContext, normalizeVerifier }, { findHolderSecret }, { recordToLeaf }, { PublicKey, Field }] = await Promise.all([
479
+ import('./permitProof.js'), import('./holderSecret.js'), import('./permitRegistryRebuild.js'), import('o1js'),
480
+ ]);
481
+ let context;
482
+ let verifier;
483
+ try {
484
+ verifier = normalizeVerifier(a.verifier);
485
+ context = verifierContext(verifier, a.nonce);
486
+ }
487
+ catch (e) {
488
+ throw new AgentError(e?.message ?? String(e), 'INVALID_REQUEST', 0, false);
489
+ }
490
+ const served = await client.getPermit(a.registry, a.subject);
491
+ if (!served.permit)
492
+ throw new AgentError('Permit not found', 'NOT_FOUND', 404, false);
493
+ if (served.permit.holderKey !== opts.wallet.address)
494
+ throw new AgentError('This key is not the permit holder', 'FORBIDDEN', 403, false);
495
+ // Asked through an earlier generation's address, the permit comes from the current one: prove there.
496
+ const home = served.registry ?? a.registry;
497
+ let secret;
498
+ try {
499
+ ({ secret } = await findHolderSecret(opts.wallet, { lineage: await client.registryLineage(home), network: net, subject: a.subject }));
500
+ }
501
+ catch (e) {
502
+ throw new AgentError(e?.message ?? String(e), 'FORBIDDEN', 403, false);
503
+ }
504
+ const msg = holderProofMessage(PublicKey.fromBase58(home), Field(served.root), Field(context));
505
+ const sig = await opts.wallet.signFields(msg.map((f) => f.toString()));
506
+ const r = await proveHolder({
507
+ registry: home, root: served.root, witness: served.witness, leaf: recordToLeaf(served.permit), holderSecret: secret,
508
+ slot: served.slot, requiredScope: a.requiredScope ?? 0n, context, holderSignature: sig,
509
+ });
510
+ return { ...r, registry: home, root: served.root, slot: served.slot, verifier, nonce: String(a.nonce), context: context.toString(), requiredScope: (a.requiredScope ?? 0n).toString() };
511
+ },
512
+ // authority
513
+ /**
514
+ * Accepts the Authority Terms with the agent key, for its owner. Needs a
515
+ * standing consent covering 'authority-terms'; the keeper records the
516
+ * acceptance as given by this agent under that authorisation.
517
+ */
518
+ async acceptAuthorityTerms(f) {
519
+ allow('accept-authority-terms');
520
+ const c = opts.consent;
521
+ if (!c || c.agent !== opts.wallet.address || c.network !== net || !c.kinds.includes('authority-terms')) {
522
+ throw new AgentError('Accepting the Authority Terms needs a standing consent from the owner covering authority-terms for this agent key', 'CONSENT_REQUIRED', 0, false);
523
+ }
524
+ const v = await verifyStandingConsent(c);
525
+ if (!v.ok)
526
+ throw new AgentError(`Standing consent is not valid: ${v.reason}`, 'CONSENT_REQUIRED', 0, false);
527
+ return client.acceptAuthorityTerms({ ...f, agentConsent: c });
528
+ },
529
+ async listApplications(registry, status) { return client.listApplications(registry, status); },
530
+ async listRequests(registry, status) { return client.listRequests(registry, status); },
531
+ async createRegistry(draft) {
532
+ allow('create-registry');
533
+ return client.createRegistry(draft);
534
+ },
535
+ async deployRegistry(requestId) {
536
+ allow('deploy-registry');
537
+ return client.deployRegistry(requestId);
538
+ },
539
+ /**
540
+ * Starts a redeploy to the current release: two requests for the keys,
541
+ * retire (sign, then execute_request) and the new registry (sign, then
542
+ * deployRegistry; after a pending hard fork). Every permit carries over to it.
543
+ */
544
+ async redeployRegistry(registry) {
545
+ allow('redeploy-registry', registry);
546
+ return client.redeployRegistry(registry);
547
+ },
548
+ /** Approves exactly what was applied for, or rejects (the processing fee is kept): a request for the authority keys to sign (an unpaid one whose payment waits for a Mina upgrade may be decided before payment; the request follows once paid). */
549
+ async decideApplication(id, d) {
550
+ const { application } = await client.getApplication(id);
551
+ allow('decide-application', application?.registry);
552
+ if (d.decision === 'reject')
553
+ return client.rejectApplication(id, d.reason, d.reasonCode);
554
+ return client.approveApplication(id);
555
+ },
556
+ async signRequest(requestId) {
557
+ allow('sign-request', (await registryOf(requestId)).registry);
558
+ return client.signRequest(requestId);
559
+ },
560
+ /** Proves and pays for a fully signed non-grant request (grants are paid by the holder). */
561
+ async executeRequest(requestId) {
562
+ allow('execute-request', (await registryOf(requestId)).registry);
563
+ return client.executeRequest(requestId);
564
+ },
565
+ async requestChange(registry, c) {
566
+ allow('request-change', registry);
567
+ switch (c.kind) {
568
+ case 'renewal': {
569
+ const { kind: _k, subject, ...change } = c;
570
+ return client.requestRenewal(registry, subject, change);
571
+ }
572
+ case 'status': return client.requestStatus(registry, c.subject, c.action, c.reasonCode);
573
+ case 'fees': return client.requestFees(registry, c.grantFeeMina, c.renewalFeeMina);
574
+ case 'rotation': return client.requestRotation(registry, c.keys, c.threshold);
575
+ }
576
+ },
577
+ };
578
+ }
579
+ export { signActionRecord, verifyActionRecord, actionRecordStatement, policyHash, canonicalJson, ACTION_RECORD_LIMITS } from './agentRecord.js';
580
+ export { createVendorAgent, vendorAcceptanceMessage, billingHash, REGISTRATION_FEE_MINA } from './agentVendor.js';
581
+ //# sourceMappingURL=agentActions.js.map