@agirails/sdk 2.0.0 → 2.0.1-beta

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 (405) hide show
  1. package/README.md +108 -116
  2. package/dist/ACTPClient.d.ts +33 -456
  3. package/dist/ACTPClient.d.ts.map +1 -1
  4. package/dist/ACTPClient.js +93 -477
  5. package/dist/ACTPClient.js.map +1 -1
  6. package/dist/abi/EscrowVault.json +38 -106
  7. package/dist/builders/DeliveryProofBuilder.d.ts +1 -60
  8. package/dist/builders/DeliveryProofBuilder.d.ts.map +1 -1
  9. package/dist/builders/DeliveryProofBuilder.js +5 -81
  10. package/dist/builders/DeliveryProofBuilder.js.map +1 -1
  11. package/dist/builders/QuoteBuilder.d.ts +0 -101
  12. package/dist/builders/QuoteBuilder.d.ts.map +1 -1
  13. package/dist/builders/QuoteBuilder.js +3 -120
  14. package/dist/builders/QuoteBuilder.js.map +1 -1
  15. package/dist/builders/index.d.ts +0 -4
  16. package/dist/builders/index.d.ts.map +1 -1
  17. package/dist/builders/index.js +0 -4
  18. package/dist/builders/index.js.map +1 -1
  19. package/dist/config/networks.d.ts +0 -28
  20. package/dist/config/networks.d.ts.map +1 -1
  21. package/dist/config/networks.js +12 -60
  22. package/dist/config/networks.js.map +1 -1
  23. package/dist/errors/index.d.ts +2 -165
  24. package/dist/errors/index.d.ts.map +1 -1
  25. package/dist/errors/index.js +2 -260
  26. package/dist/errors/index.js.map +1 -1
  27. package/dist/index.d.ts +13 -61
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js +36 -141
  30. package/dist/index.js.map +1 -1
  31. package/dist/protocol/ACTPKernel.d.ts +2 -229
  32. package/dist/protocol/ACTPKernel.d.ts.map +1 -1
  33. package/dist/protocol/ACTPKernel.js +33 -367
  34. package/dist/protocol/ACTPKernel.js.map +1 -1
  35. package/dist/protocol/EASHelper.d.ts +2 -57
  36. package/dist/protocol/EASHelper.d.ts.map +1 -1
  37. package/dist/protocol/EASHelper.js +37 -230
  38. package/dist/protocol/EASHelper.js.map +1 -1
  39. package/dist/protocol/EscrowVault.d.ts +2 -93
  40. package/dist/protocol/EscrowVault.d.ts.map +1 -1
  41. package/dist/protocol/EscrowVault.js +33 -122
  42. package/dist/protocol/EscrowVault.js.map +1 -1
  43. package/dist/protocol/EventMonitor.d.ts +1 -45
  44. package/dist/protocol/EventMonitor.d.ts.map +1 -1
  45. package/dist/protocol/EventMonitor.js +8 -64
  46. package/dist/protocol/EventMonitor.js.map +1 -1
  47. package/dist/protocol/MessageSigner.d.ts +2 -116
  48. package/dist/protocol/MessageSigner.d.ts.map +1 -1
  49. package/dist/protocol/MessageSigner.js +9 -215
  50. package/dist/protocol/MessageSigner.js.map +1 -1
  51. package/dist/protocol/ProofGenerator.d.ts +0 -93
  52. package/dist/protocol/ProofGenerator.d.ts.map +1 -1
  53. package/dist/protocol/ProofGenerator.js +9 -194
  54. package/dist/protocol/ProofGenerator.js.map +1 -1
  55. package/dist/protocol/QuoteBuilder.d.ts +0 -8
  56. package/dist/protocol/QuoteBuilder.d.ts.map +1 -1
  57. package/dist/protocol/QuoteBuilder.js +0 -8
  58. package/dist/protocol/QuoteBuilder.js.map +1 -1
  59. package/dist/types/eip712.d.ts +0 -34
  60. package/dist/types/eip712.d.ts.map +1 -1
  61. package/dist/types/eip712.js +5 -31
  62. package/dist/types/eip712.js.map +1 -1
  63. package/dist/types/escrow.d.ts +10 -17
  64. package/dist/types/escrow.d.ts.map +1 -1
  65. package/dist/types/index.d.ts +0 -5
  66. package/dist/types/index.d.ts.map +1 -1
  67. package/dist/types/index.js +0 -8
  68. package/dist/types/index.js.map +1 -1
  69. package/dist/types/message.d.ts +0 -32
  70. package/dist/types/message.d.ts.map +1 -1
  71. package/dist/types/message.js +0 -4
  72. package/dist/types/message.js.map +1 -1
  73. package/dist/types/state.d.ts +0 -28
  74. package/dist/types/state.d.ts.map +1 -1
  75. package/dist/types/state.js +6 -37
  76. package/dist/types/state.js.map +1 -1
  77. package/dist/types/transaction.d.ts +0 -17
  78. package/dist/types/transaction.d.ts.map +1 -1
  79. package/dist/utils/IPFSClient.d.ts +0 -113
  80. package/dist/utils/IPFSClient.d.ts.map +1 -1
  81. package/dist/utils/IPFSClient.js +7 -128
  82. package/dist/utils/IPFSClient.js.map +1 -1
  83. package/dist/utils/NonceManager.d.ts +1 -234
  84. package/dist/utils/NonceManager.d.ts.map +1 -1
  85. package/dist/utils/NonceManager.js +7 -372
  86. package/dist/utils/NonceManager.js.map +1 -1
  87. package/dist/utils/ReceivedNonceTracker.d.ts +0 -175
  88. package/dist/utils/ReceivedNonceTracker.d.ts.map +1 -1
  89. package/dist/utils/ReceivedNonceTracker.js +5 -261
  90. package/dist/utils/ReceivedNonceTracker.js.map +1 -1
  91. package/dist/utils/canonicalJson.d.ts +0 -22
  92. package/dist/utils/canonicalJson.d.ts.map +1 -1
  93. package/dist/utils/canonicalJson.js +3 -26
  94. package/dist/utils/canonicalJson.js.map +1 -1
  95. package/dist/utils/computeTypeHash.d.ts +0 -14
  96. package/dist/utils/computeTypeHash.d.ts.map +1 -1
  97. package/dist/utils/computeTypeHash.js +2 -19
  98. package/dist/utils/computeTypeHash.js.map +1 -1
  99. package/dist/utils/validation.d.ts +0 -40
  100. package/dist/utils/validation.d.ts.map +1 -1
  101. package/dist/utils/validation.js +7 -184
  102. package/dist/utils/validation.js.map +1 -1
  103. package/package.json +37 -54
  104. package/src/ACTPClient.ts +178 -692
  105. package/src/__tests__/ProofGenerator.test.ts +124 -0
  106. package/src/__tests__/QuoteBuilder.test.ts +516 -0
  107. package/src/__tests__/StateMachine.test.ts +82 -0
  108. package/src/__tests__/builders/DeliveryProofBuilder.test.ts +581 -0
  109. package/src/__tests__/integration/ACTPClient.test.ts +263 -0
  110. package/src/__tests__/integration.test.ts +289 -0
  111. package/src/__tests__/protocol/EASHelper.test.ts +472 -0
  112. package/src/__tests__/protocol/EventMonitor.test.ts +382 -0
  113. package/src/__tests__/security/ACTPKernel.security.test.ts +1167 -0
  114. package/src/__tests__/security/EscrowVault.security.test.ts +570 -0
  115. package/src/__tests__/security/MessageSigner.security.test.ts +286 -0
  116. package/src/__tests__/security/NonceReplay.security.test.ts +501 -0
  117. package/src/__tests__/security/validation.security.test.ts +376 -0
  118. package/src/__tests__/utils/IPFSClient.test.ts +262 -0
  119. package/src/__tests__/utils/NonceManager.test.ts +205 -0
  120. package/src/__tests__/utils/canonicalJson.test.ts +153 -0
  121. package/src/abi/EscrowVault.json +38 -106
  122. package/src/builders/DeliveryProofBuilder.ts +2 -3
  123. package/src/config/networks.ts +9 -32
  124. package/src/errors/index.ts +1 -298
  125. package/src/index.ts +71 -207
  126. package/src/protocol/ACTPKernel.ts +23 -175
  127. package/src/protocol/EASHelper.ts +46 -230
  128. package/src/protocol/EscrowVault.ts +50 -68
  129. package/src/protocol/EventMonitor.ts +15 -44
  130. package/src/protocol/MessageSigner.ts +13 -193
  131. package/src/protocol/ProofGenerator.ts +4 -223
  132. package/src/types/escrow.ts +11 -12
  133. package/src/types/index.ts +1 -5
  134. package/src/types/state.ts +3 -12
  135. package/src/types/transaction.ts +1 -4
  136. package/src/utils/IPFSClient.ts +5 -122
  137. package/src/utils/NonceManager.ts +8 -305
  138. package/src/utils/ReceivedNonceTracker.ts +0 -170
  139. package/src/utils/validation.ts +0 -164
  140. package/LICENSE +0 -190
  141. package/bin/actp +0 -10
  142. package/dist/abi/AgentRegistry.json +0 -782
  143. package/dist/abi/IdentityRegistry.json +0 -316
  144. package/dist/adapters/BaseAdapter.d.ts +0 -231
  145. package/dist/adapters/BaseAdapter.d.ts.map +0 -1
  146. package/dist/adapters/BaseAdapter.js +0 -393
  147. package/dist/adapters/BaseAdapter.js.map +0 -1
  148. package/dist/adapters/BeginnerAdapter.d.ts +0 -152
  149. package/dist/adapters/BeginnerAdapter.d.ts.map +0 -1
  150. package/dist/adapters/BeginnerAdapter.js +0 -168
  151. package/dist/adapters/BeginnerAdapter.js.map +0 -1
  152. package/dist/adapters/IntermediateAdapter.d.ts +0 -211
  153. package/dist/adapters/IntermediateAdapter.d.ts.map +0 -1
  154. package/dist/adapters/IntermediateAdapter.js +0 -260
  155. package/dist/adapters/IntermediateAdapter.js.map +0 -1
  156. package/dist/adapters/index.d.ts +0 -15
  157. package/dist/adapters/index.d.ts.map +0 -1
  158. package/dist/adapters/index.js +0 -26
  159. package/dist/adapters/index.js.map +0 -1
  160. package/dist/cli/commands/balance.d.ts +0 -13
  161. package/dist/cli/commands/balance.d.ts.map +0 -1
  162. package/dist/cli/commands/balance.js +0 -89
  163. package/dist/cli/commands/balance.js.map +0 -1
  164. package/dist/cli/commands/batch.d.ts +0 -24
  165. package/dist/cli/commands/batch.d.ts.map +0 -1
  166. package/dist/cli/commands/batch.js +0 -424
  167. package/dist/cli/commands/batch.js.map +0 -1
  168. package/dist/cli/commands/config.d.ts +0 -13
  169. package/dist/cli/commands/config.d.ts.map +0 -1
  170. package/dist/cli/commands/config.js +0 -192
  171. package/dist/cli/commands/config.js.map +0 -1
  172. package/dist/cli/commands/init.d.ts +0 -19
  173. package/dist/cli/commands/init.d.ts.map +0 -1
  174. package/dist/cli/commands/init.js +0 -143
  175. package/dist/cli/commands/init.js.map +0 -1
  176. package/dist/cli/commands/mint.d.ts +0 -13
  177. package/dist/cli/commands/mint.d.ts.map +0 -1
  178. package/dist/cli/commands/mint.js +0 -91
  179. package/dist/cli/commands/mint.js.map +0 -1
  180. package/dist/cli/commands/pay.d.ts +0 -18
  181. package/dist/cli/commands/pay.d.ts.map +0 -1
  182. package/dist/cli/commands/pay.js +0 -87
  183. package/dist/cli/commands/pay.js.map +0 -1
  184. package/dist/cli/commands/simulate.d.ts +0 -32
  185. package/dist/cli/commands/simulate.d.ts.map +0 -1
  186. package/dist/cli/commands/simulate.js +0 -290
  187. package/dist/cli/commands/simulate.js.map +0 -1
  188. package/dist/cli/commands/time.d.ts +0 -29
  189. package/dist/cli/commands/time.d.ts.map +0 -1
  190. package/dist/cli/commands/time.js +0 -252
  191. package/dist/cli/commands/time.js.map +0 -1
  192. package/dist/cli/commands/tx.d.ts +0 -16
  193. package/dist/cli/commands/tx.d.ts.map +0 -1
  194. package/dist/cli/commands/tx.js +0 -379
  195. package/dist/cli/commands/tx.js.map +0 -1
  196. package/dist/cli/commands/watch.d.ts +0 -20
  197. package/dist/cli/commands/watch.d.ts.map +0 -1
  198. package/dist/cli/commands/watch.js +0 -160
  199. package/dist/cli/commands/watch.js.map +0 -1
  200. package/dist/cli/index.d.ts +0 -17
  201. package/dist/cli/index.d.ts.map +0 -1
  202. package/dist/cli/index.js +0 -104
  203. package/dist/cli/index.js.map +0 -1
  204. package/dist/cli/utils/client.d.ts +0 -70
  205. package/dist/cli/utils/client.d.ts.map +0 -1
  206. package/dist/cli/utils/client.js +0 -240
  207. package/dist/cli/utils/client.js.map +0 -1
  208. package/dist/cli/utils/config.d.ts +0 -91
  209. package/dist/cli/utils/config.d.ts.map +0 -1
  210. package/dist/cli/utils/config.js +0 -240
  211. package/dist/cli/utils/config.js.map +0 -1
  212. package/dist/cli/utils/output.d.ts +0 -174
  213. package/dist/cli/utils/output.d.ts.map +0 -1
  214. package/dist/cli/utils/output.js +0 -380
  215. package/dist/cli/utils/output.js.map +0 -1
  216. package/dist/level0/Provider.d.ts +0 -106
  217. package/dist/level0/Provider.d.ts.map +0 -1
  218. package/dist/level0/Provider.js +0 -10
  219. package/dist/level0/Provider.js.map +0 -1
  220. package/dist/level0/ServiceDirectory.d.ts +0 -74
  221. package/dist/level0/ServiceDirectory.d.ts.map +0 -1
  222. package/dist/level0/ServiceDirectory.js +0 -122
  223. package/dist/level0/ServiceDirectory.js.map +0 -1
  224. package/dist/level0/index.d.ts +0 -10
  225. package/dist/level0/index.d.ts.map +0 -1
  226. package/dist/level0/index.js +0 -15
  227. package/dist/level0/index.js.map +0 -1
  228. package/dist/level0/provide.d.ts +0 -51
  229. package/dist/level0/provide.d.ts.map +0 -1
  230. package/dist/level0/provide.js +0 -113
  231. package/dist/level0/provide.js.map +0 -1
  232. package/dist/level0/request.d.ts +0 -53
  233. package/dist/level0/request.d.ts.map +0 -1
  234. package/dist/level0/request.js +0 -462
  235. package/dist/level0/request.js.map +0 -1
  236. package/dist/level1/Agent.d.ts +0 -472
  237. package/dist/level1/Agent.d.ts.map +0 -1
  238. package/dist/level1/Agent.js +0 -1091
  239. package/dist/level1/Agent.js.map +0 -1
  240. package/dist/level1/index.d.ts +0 -10
  241. package/dist/level1/index.d.ts.map +0 -1
  242. package/dist/level1/index.js +0 -30
  243. package/dist/level1/index.js.map +0 -1
  244. package/dist/level1/pricing/PriceCalculator.d.ts +0 -62
  245. package/dist/level1/pricing/PriceCalculator.d.ts.map +0 -1
  246. package/dist/level1/pricing/PriceCalculator.js +0 -237
  247. package/dist/level1/pricing/PriceCalculator.js.map +0 -1
  248. package/dist/level1/pricing/PricingStrategy.d.ts +0 -179
  249. package/dist/level1/pricing/PricingStrategy.d.ts.map +0 -1
  250. package/dist/level1/pricing/PricingStrategy.js +0 -11
  251. package/dist/level1/pricing/PricingStrategy.js.map +0 -1
  252. package/dist/level1/types/Job.d.ts +0 -166
  253. package/dist/level1/types/Job.d.ts.map +0 -1
  254. package/dist/level1/types/Job.js +0 -11
  255. package/dist/level1/types/Job.js.map +0 -1
  256. package/dist/level1/types/Options.d.ts +0 -258
  257. package/dist/level1/types/Options.d.ts.map +0 -1
  258. package/dist/level1/types/Options.js +0 -8
  259. package/dist/level1/types/Options.js.map +0 -1
  260. package/dist/level1/types/index.d.ts +0 -8
  261. package/dist/level1/types/index.d.ts.map +0 -1
  262. package/dist/level1/types/index.js +0 -8
  263. package/dist/level1/types/index.js.map +0 -1
  264. package/dist/protocol/AgentRegistry.d.ts +0 -177
  265. package/dist/protocol/AgentRegistry.d.ts.map +0 -1
  266. package/dist/protocol/AgentRegistry.js +0 -449
  267. package/dist/protocol/AgentRegistry.js.map +0 -1
  268. package/dist/protocol/DIDManager.d.ts +0 -289
  269. package/dist/protocol/DIDManager.d.ts.map +0 -1
  270. package/dist/protocol/DIDManager.js +0 -481
  271. package/dist/protocol/DIDManager.js.map +0 -1
  272. package/dist/protocol/DIDResolver.d.ts +0 -236
  273. package/dist/protocol/DIDResolver.d.ts.map +0 -1
  274. package/dist/protocol/DIDResolver.js +0 -495
  275. package/dist/protocol/DIDResolver.js.map +0 -1
  276. package/dist/runtime/BlockchainRuntime.d.ts +0 -360
  277. package/dist/runtime/BlockchainRuntime.d.ts.map +0 -1
  278. package/dist/runtime/BlockchainRuntime.js +0 -767
  279. package/dist/runtime/BlockchainRuntime.js.map +0 -1
  280. package/dist/runtime/IACTPRuntime.d.ts +0 -271
  281. package/dist/runtime/IACTPRuntime.d.ts.map +0 -1
  282. package/dist/runtime/IACTPRuntime.js +0 -15
  283. package/dist/runtime/IACTPRuntime.js.map +0 -1
  284. package/dist/runtime/MockRuntime.d.ts +0 -445
  285. package/dist/runtime/MockRuntime.d.ts.map +0 -1
  286. package/dist/runtime/MockRuntime.js +0 -1065
  287. package/dist/runtime/MockRuntime.js.map +0 -1
  288. package/dist/runtime/MockStateManager.d.ts +0 -233
  289. package/dist/runtime/MockStateManager.d.ts.map +0 -1
  290. package/dist/runtime/MockStateManager.js +0 -533
  291. package/dist/runtime/MockStateManager.js.map +0 -1
  292. package/dist/runtime/index.d.ts +0 -14
  293. package/dist/runtime/index.d.ts.map +0 -1
  294. package/dist/runtime/index.js +0 -42
  295. package/dist/runtime/index.js.map +0 -1
  296. package/dist/runtime/types/MockState.d.ts +0 -167
  297. package/dist/runtime/types/MockState.d.ts.map +0 -1
  298. package/dist/runtime/types/MockState.js +0 -43
  299. package/dist/runtime/types/MockState.js.map +0 -1
  300. package/dist/types/agent.d.ts +0 -76
  301. package/dist/types/agent.d.ts.map +0 -1
  302. package/dist/types/agent.js +0 -8
  303. package/dist/types/agent.js.map +0 -1
  304. package/dist/types/did.d.ts +0 -192
  305. package/dist/types/did.d.ts.map +0 -1
  306. package/dist/types/did.js +0 -38
  307. package/dist/types/did.js.map +0 -1
  308. package/dist/utils/ErrorRecoveryGuide.d.ts +0 -125
  309. package/dist/utils/ErrorRecoveryGuide.d.ts.map +0 -1
  310. package/dist/utils/ErrorRecoveryGuide.js +0 -579
  311. package/dist/utils/ErrorRecoveryGuide.js.map +0 -1
  312. package/dist/utils/Helpers.d.ts +0 -453
  313. package/dist/utils/Helpers.d.ts.map +0 -1
  314. package/dist/utils/Helpers.js +0 -623
  315. package/dist/utils/Helpers.js.map +0 -1
  316. package/dist/utils/Logger.d.ts +0 -195
  317. package/dist/utils/Logger.d.ts.map +0 -1
  318. package/dist/utils/Logger.js +0 -382
  319. package/dist/utils/Logger.js.map +0 -1
  320. package/dist/utils/RateLimiter.d.ts +0 -253
  321. package/dist/utils/RateLimiter.d.ts.map +0 -1
  322. package/dist/utils/RateLimiter.js +0 -424
  323. package/dist/utils/RateLimiter.js.map +0 -1
  324. package/dist/utils/SDKLifecycle.d.ts +0 -156
  325. package/dist/utils/SDKLifecycle.d.ts.map +0 -1
  326. package/dist/utils/SDKLifecycle.js +0 -347
  327. package/dist/utils/SDKLifecycle.js.map +0 -1
  328. package/dist/utils/SecureNonce.d.ts +0 -57
  329. package/dist/utils/SecureNonce.d.ts.map +0 -1
  330. package/dist/utils/SecureNonce.js +0 -80
  331. package/dist/utils/SecureNonce.js.map +0 -1
  332. package/dist/utils/Semaphore.d.ts +0 -123
  333. package/dist/utils/Semaphore.d.ts.map +0 -1
  334. package/dist/utils/Semaphore.js +0 -247
  335. package/dist/utils/Semaphore.js.map +0 -1
  336. package/dist/utils/UsedAttestationTracker.d.ts +0 -167
  337. package/dist/utils/UsedAttestationTracker.d.ts.map +0 -1
  338. package/dist/utils/UsedAttestationTracker.js +0 -309
  339. package/dist/utils/UsedAttestationTracker.js.map +0 -1
  340. package/dist/utils/fsSafe.d.ts +0 -14
  341. package/dist/utils/fsSafe.d.ts.map +0 -1
  342. package/dist/utils/fsSafe.js +0 -89
  343. package/dist/utils/fsSafe.js.map +0 -1
  344. package/dist/utils/index.d.ts +0 -15
  345. package/dist/utils/index.d.ts.map +0 -1
  346. package/dist/utils/index.js +0 -51
  347. package/dist/utils/index.js.map +0 -1
  348. package/dist/utils/security.d.ts +0 -147
  349. package/dist/utils/security.d.ts.map +0 -1
  350. package/dist/utils/security.js +0 -391
  351. package/dist/utils/security.js.map +0 -1
  352. package/src/abi/AgentRegistry.json +0 -782
  353. package/src/abi/IdentityRegistry.json +0 -316
  354. package/src/adapters/BaseAdapter.ts +0 -473
  355. package/src/adapters/BeginnerAdapter.ts +0 -232
  356. package/src/adapters/IntermediateAdapter.ts +0 -316
  357. package/src/adapters/index.ts +0 -25
  358. package/src/cli/commands/balance.ts +0 -110
  359. package/src/cli/commands/batch.ts +0 -487
  360. package/src/cli/commands/config.ts +0 -231
  361. package/src/cli/commands/init.ts +0 -161
  362. package/src/cli/commands/mint.ts +0 -116
  363. package/src/cli/commands/pay.ts +0 -113
  364. package/src/cli/commands/simulate.ts +0 -345
  365. package/src/cli/commands/time.ts +0 -303
  366. package/src/cli/commands/tx.ts +0 -448
  367. package/src/cli/commands/watch.ts +0 -211
  368. package/src/cli/index.ts +0 -116
  369. package/src/cli/utils/client.ts +0 -249
  370. package/src/cli/utils/config.ts +0 -282
  371. package/src/cli/utils/output.ts +0 -465
  372. package/src/level0/Provider.ts +0 -117
  373. package/src/level0/ServiceDirectory.ts +0 -131
  374. package/src/level0/index.ts +0 -10
  375. package/src/level0/provide.ts +0 -131
  376. package/src/level0/request.ts +0 -494
  377. package/src/level1/Agent.ts +0 -1432
  378. package/src/level1/index.ts +0 -10
  379. package/src/level1/pricing/PriceCalculator.ts +0 -255
  380. package/src/level1/pricing/PricingStrategy.ts +0 -198
  381. package/src/level1/types/Job.ts +0 -179
  382. package/src/level1/types/Options.ts +0 -291
  383. package/src/level1/types/index.ts +0 -8
  384. package/src/protocol/AgentRegistry.ts +0 -559
  385. package/src/protocol/DIDManager.ts +0 -629
  386. package/src/protocol/DIDResolver.ts +0 -554
  387. package/src/runtime/BlockchainRuntime.ts +0 -993
  388. package/src/runtime/IACTPRuntime.ts +0 -284
  389. package/src/runtime/MockRuntime.ts +0 -1244
  390. package/src/runtime/MockStateManager.ts +0 -576
  391. package/src/runtime/index.ts +0 -25
  392. package/src/runtime/types/MockState.ts +0 -227
  393. package/src/types/agent.ts +0 -79
  394. package/src/types/did.ts +0 -223
  395. package/src/utils/ErrorRecoveryGuide.ts +0 -675
  396. package/src/utils/Helpers.ts +0 -688
  397. package/src/utils/Logger.ts +0 -484
  398. package/src/utils/RateLimiter.ts +0 -534
  399. package/src/utils/SDKLifecycle.ts +0 -416
  400. package/src/utils/SecureNonce.ts +0 -78
  401. package/src/utils/Semaphore.ts +0 -276
  402. package/src/utils/UsedAttestationTracker.ts +0 -387
  403. package/src/utils/fsSafe.ts +0 -75
  404. package/src/utils/index.ts +0 -80
  405. package/src/utils/security.ts +0 -418
@@ -1,166 +0,0 @@
1
- /**
2
- * Job - Represents a work request from requester to provider
3
- *
4
- * This is the core data structure passed to service handlers
5
- * in the Basic and Standard APIs.
6
- *
7
- * @packageDocumentation
8
- */
9
- /**
10
- * Job interface - work request data
11
- *
12
- * @example
13
- * ```typescript
14
- * const job: Job = {
15
- * id: '0x1234...abcd',
16
- * service: 'translation',
17
- * input: { text: 'Hello', from: 'en', to: 'de' },
18
- * budget: 10,
19
- * deadline: new Date('2025-12-14T12:00:00Z'),
20
- * requester: '0xRequester...',
21
- * metadata: { priority: 'high' }
22
- * }
23
- * ```
24
- */
25
- export interface Job {
26
- /**
27
- * Unique job identifier (transaction ID from ACTP protocol)
28
- */
29
- id: string;
30
- /**
31
- * Service type being requested (e.g., 'translation', 'echo', 'image-gen')
32
- */
33
- service: string;
34
- /**
35
- * Input data for the service (service-specific)
36
- *
37
- * This is the data the requester wants processed.
38
- * Structure depends on the service type.
39
- */
40
- input: any;
41
- /**
42
- * Budget in USDC (decimal format, e.g., 10 = $10.00)
43
- *
44
- * This is the maximum amount the requester is willing to pay.
45
- */
46
- budget: number;
47
- /**
48
- * Deadline by which work must be completed
49
- */
50
- deadline: Date;
51
- /**
52
- * Ethereum address of the requester
53
- */
54
- requester: string;
55
- /**
56
- * Additional metadata (optional, service-specific)
57
- */
58
- metadata: Record<string, any>;
59
- }
60
- /**
61
- * Job handler function type
62
- *
63
- * This is the function signature providers must implement.
64
- *
65
- * @param job - The job to process
66
- * @param context - Job execution context
67
- * @returns Promise resolving to job result (service-specific)
68
- *
69
- * @example
70
- * ```typescript
71
- * const handler: JobHandler = async (job, ctx) => {
72
- * ctx.progress(50, 'Processing...');
73
- * const result = await doWork(job.input);
74
- * ctx.progress(100, 'Done!');
75
- * return result;
76
- * };
77
- * ```
78
- */
79
- export type JobHandler = (job: Job, context: JobContext) => Promise<any>;
80
- /**
81
- * JobContext - Execution context passed to job handlers
82
- *
83
- * Provides utilities for progress reporting, logging, state management,
84
- * and cancellation handling.
85
- */
86
- export interface JobContext {
87
- /**
88
- * Reference to the Agent instance processing this job
89
- */
90
- agent: any;
91
- /**
92
- * Report job progress
93
- *
94
- * @param percent - Progress percentage (0-100)
95
- * @param message - Optional progress message
96
- *
97
- * @example
98
- * ```typescript
99
- * ctx.progress(25, 'Downloaded input file');
100
- * ctx.progress(50, 'Processing data');
101
- * ctx.progress(100, 'Complete!');
102
- * ```
103
- */
104
- progress(percent: number, message?: string): void;
105
- /**
106
- * Logging utilities
107
- */
108
- log: {
109
- debug(message: string, meta?: any): void;
110
- info(message: string, meta?: any): void;
111
- warn(message: string, meta?: any): void;
112
- error(message: string, meta?: any): void;
113
- };
114
- /**
115
- * Job-scoped state storage
116
- *
117
- * Allows handlers to store intermediate state that persists
118
- * across async operations (e.g., for resumable jobs).
119
- *
120
- * @example
121
- * ```typescript
122
- * // Store checkpoint
123
- * ctx.state.set('lastProcessedIndex', 42);
124
- *
125
- * // Retrieve checkpoint
126
- * const lastIndex = ctx.state.get<number>('lastProcessedIndex') || 0;
127
- * ```
128
- */
129
- state: {
130
- get<T>(key: string): T | undefined;
131
- set<T>(key: string, value: T): void;
132
- };
133
- /**
134
- * Whether the job has been cancelled
135
- *
136
- * Handlers should check this periodically for long-running jobs
137
- * and exit gracefully if true.
138
- *
139
- * @example
140
- * ```typescript
141
- * for (let i = 0; i < items.length; i++) {
142
- * if (ctx.cancelled) {
143
- * throw new Error('Job cancelled by requester');
144
- * }
145
- * await processItem(items[i]);
146
- * }
147
- * ```
148
- */
149
- cancelled: boolean;
150
- /**
151
- * Register cancellation handler
152
- *
153
- * Called when the job is cancelled, allowing cleanup.
154
- *
155
- * @example
156
- * ```typescript
157
- * const stream = openFileStream();
158
- * ctx.onCancel(() => {
159
- * stream.close();
160
- * console.log('Cleaned up resources');
161
- * });
162
- * ```
163
- */
164
- onCancel(handler: () => void): void;
165
- }
166
- //# sourceMappingURL=Job.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Job.d.ts","sourceRoot":"","sources":["../../../src/level1/types/Job.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,GAAG;IAClB;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;;;;OAKG;IACH,KAAK,EAAE,GAAG,CAAC;IAEX;;;;OAIG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,QAAQ,EAAE,IAAI,CAAC;IAEf;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC/B;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,UAAU,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;AAEzE;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,KAAK,EAAE,GAAG,CAAC;IAEX;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAElD;;OAEG;IACH,GAAG,EAAE;QACH,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC;QACzC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC;QACxC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC;QACxC,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC;KAC1C,CAAC;IAEF;;;;;;;;;;;;;;OAcG;IACH,KAAK,EAAE;QACL,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS,CAAC;QACnC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;KACrC,CAAC;IAEF;;;;;;;;;;;;;;;OAeG;IACH,SAAS,EAAE,OAAO,CAAC;IAEnB;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;CACrC"}
@@ -1,11 +0,0 @@
1
- "use strict";
2
- /**
3
- * Job - Represents a work request from requester to provider
4
- *
5
- * This is the core data structure passed to service handlers
6
- * in the Basic and Standard APIs.
7
- *
8
- * @packageDocumentation
9
- */
10
- Object.defineProperty(exports, "__esModule", { value: true });
11
- //# sourceMappingURL=Job.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Job.js","sourceRoot":"","sources":["../../../src/level1/types/Job.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG"}
@@ -1,258 +0,0 @@
1
- /**
2
- * Options for Basic and Standard APIs
3
- *
4
- * @packageDocumentation
5
- */
6
- import { Job } from './Job';
7
- /**
8
- * Wallet configuration options
9
- */
10
- export type WalletOption = 'auto' | 'connect' | string | {
11
- privateKey: string;
12
- };
13
- /**
14
- * Network options
15
- */
16
- export type NetworkOption = 'mock' | 'testnet' | 'mainnet';
17
- /**
18
- * Options for provide() function (Basic API)
19
- */
20
- export interface ProvideOptions {
21
- /**
22
- * Wallet configuration
23
- *
24
- * - 'auto': SDK generates and manages a wallet automatically
25
- * - 'connect': Open browser wallet connection (MetaMask, etc.) - FUTURE
26
- * - string: Private key (0x-prefixed hex)
27
- * - object: { privateKey: string }
28
- *
29
- * @default 'auto'
30
- */
31
- wallet?: WalletOption;
32
- /**
33
- * Job filtering criteria
34
- *
35
- * Only accept jobs matching these filters.
36
- */
37
- filter?: {
38
- /**
39
- * Minimum budget in USDC
40
- *
41
- * @example
42
- * filter: { minBudget: 5 } // Only accept jobs with budget >= $5
43
- */
44
- minBudget?: number;
45
- /**
46
- * Maximum budget in USDC
47
- *
48
- * @example
49
- * filter: { maxBudget: 100 } // Only accept jobs with budget <= $100
50
- */
51
- maxBudget?: number;
52
- };
53
- /**
54
- * Auto-accept policy
55
- *
56
- * - true: Automatically accept all jobs matching filter
57
- * - false: Require manual acceptance
58
- * - function: Custom logic to decide whether to accept
59
- *
60
- * @default true
61
- *
62
- * @example
63
- * ```typescript
64
- * // Auto-accept if budget >= 10
65
- * autoAccept: (job) => job.budget >= 10
66
- *
67
- * // Auto-accept high-priority jobs
68
- * autoAccept: (job) => job.metadata?.priority === 'high'
69
- * ```
70
- */
71
- autoAccept?: boolean | ((job: Job) => boolean | Promise<boolean>);
72
- /**
73
- * Network to operate on
74
- *
75
- * @default 'mock'
76
- */
77
- network?: NetworkOption;
78
- /**
79
- * RPC URL for blockchain connection (required for testnet/mainnet)
80
- *
81
- * If not provided, defaults to public RPC from network config:
82
- * - testnet: https://sepolia.base.org
83
- * - mainnet: https://mainnet.base.org
84
- *
85
- * For production, consider using a dedicated RPC provider (Alchemy, Infura, etc.)
86
- * for better reliability and rate limits.
87
- *
88
- * @example
89
- * rpcUrl: 'https://base-sepolia.g.alchemy.com/v2/YOUR_API_KEY'
90
- */
91
- rpcUrl?: string;
92
- /**
93
- * State directory for mock mode
94
- *
95
- * Where to store mock state file.
96
- * Only used when network is 'mock'.
97
- *
98
- * @default process.cwd()
99
- */
100
- stateDirectory?: string;
101
- }
102
- /**
103
- * Request status updates
104
- */
105
- export interface RequestStatus {
106
- /**
107
- * Current state of the request
108
- */
109
- state: 'initiated' | 'quoted' | 'committed' | 'in_progress' | 'delivered' | 'settled' | 'disputed' | 'cancelled';
110
- /**
111
- * Progress percentage (0-100) if provider is reporting progress
112
- */
113
- progress?: number;
114
- /**
115
- * Progress message if available
116
- */
117
- message?: string;
118
- /**
119
- * Estimated time to completion (seconds)
120
- */
121
- eta?: number;
122
- }
123
- /**
124
- * Options for request() function (Basic API)
125
- */
126
- export interface RequestOptions {
127
- /**
128
- * Input data to send to the service
129
- */
130
- input: any;
131
- /**
132
- * Budget in USDC (decimal format)
133
- *
134
- * @example
135
- * budget: 10 // $10.00
136
- */
137
- budget: number;
138
- /**
139
- * Wallet configuration (same as ProvideOptions)
140
- *
141
- * @default 'auto'
142
- */
143
- wallet?: WalletOption;
144
- /**
145
- * Network to operate on
146
- *
147
- * @default 'mock'
148
- */
149
- network?: NetworkOption;
150
- /**
151
- * Timeout in milliseconds
152
- *
153
- * @default 300000 (5 minutes)
154
- */
155
- timeout?: number;
156
- /**
157
- * Deadline for job completion
158
- *
159
- * Can be a timestamp (seconds) or Date object.
160
- * If not specified, defaults to now + timeout.
161
- *
162
- * @example
163
- * deadline: Math.floor(Date.now() / 1000) + 3600 // 1 hour from now
164
- * deadline: new Date('2025-12-14T12:00:00Z')
165
- */
166
- deadline?: number | Date;
167
- /**
168
- * Provider selection strategy
169
- *
170
- * - string: Specific provider address
171
- * - 'any': First available provider
172
- * - 'best': Provider with highest reputation
173
- * - 'cheapest': Provider with lowest price
174
- *
175
- * @default 'any'
176
- */
177
- provider?: string | 'any' | 'best' | 'cheapest';
178
- /**
179
- * Progress callback
180
- *
181
- * Called when provider reports progress updates.
182
- *
183
- * @example
184
- * ```typescript
185
- * onProgress: (status) => {
186
- * console.log(`${status.state}: ${status.progress}% - ${status.message}`);
187
- * }
188
- * ```
189
- */
190
- onProgress?: (status: RequestStatus) => void;
191
- /**
192
- * State directory for mock mode
193
- *
194
- * @default process.cwd()
195
- */
196
- stateDirectory?: string;
197
- /**
198
- * RPC URL for blockchain connection (required for testnet/mainnet)
199
- *
200
- * If not provided, defaults to public RPC from network config:
201
- * - testnet: https://sepolia.base.org
202
- * - mainnet: https://mainnet.base.org
203
- *
204
- * For production, consider using a dedicated RPC provider (Alchemy, Infura, etc.)
205
- * for better reliability and rate limits.
206
- *
207
- * @example
208
- * rpcUrl: 'https://base-sepolia.g.alchemy.com/v2/YOUR_API_KEY'
209
- */
210
- rpcUrl?: string;
211
- /**
212
- * Dispute window duration in seconds
213
- *
214
- * Time after delivery during which requester can dispute.
215
- *
216
- * @default 172800 (2 days)
217
- */
218
- disputeWindow?: number;
219
- }
220
- /**
221
- * Result of request() function
222
- */
223
- export interface RequestResult {
224
- /**
225
- * The result returned by the provider's handler
226
- */
227
- result: any;
228
- /**
229
- * Transaction metadata
230
- */
231
- transaction: {
232
- /**
233
- * Transaction ID (ACTP protocol)
234
- */
235
- id: string;
236
- /**
237
- * Provider address
238
- */
239
- provider: string;
240
- /**
241
- * Amount paid (USDC)
242
- */
243
- amount: number;
244
- /**
245
- * Platform fee (USDC)
246
- */
247
- fee: number;
248
- /**
249
- * Job duration (milliseconds)
250
- */
251
- duration: number;
252
- /**
253
- * Delivery proof hash
254
- */
255
- proof: string;
256
- };
257
- }
258
- //# sourceMappingURL=Options.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Options.d.ts","sourceRoot":"","sources":["../../../src/level1/types/Options.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAc,GAAG,EAAE,MAAM,OAAO,CAAC;AAExC;;GAEG;AACH,MAAM,MAAM,YAAY,GACpB,MAAM,GACN,SAAS,GACT,MAAM,GACN;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3B;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,CAAC;AAE3D;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAE,YAAY,CAAC;IAEtB;;;;OAIG;IACH,MAAM,CAAC,EAAE;QACP;;;;;WAKG;QACH,SAAS,CAAC,EAAE,MAAM,CAAC;QAEnB;;;;;WAKG;QACH,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;IAEF;;;;;;;;;;;;;;;;;OAiBG;IACH,UAAU,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;IAElE;;;;OAIG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC;IAExB;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;;;;OAOG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,KAAK,EAAE,WAAW,GAAG,QAAQ,GAAG,WAAW,GAAG,aAAa,GAAG,WAAW,GAAG,SAAS,GAAG,UAAU,GAAG,WAAW,CAAC;IAEjH;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,KAAK,EAAE,GAAG,CAAC;IAEX;;;;;OAKG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;;;OAIG;IACH,MAAM,CAAC,EAAE,YAAY,CAAC;IAEtB;;;;OAIG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC;IAExB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;;;;;;OASG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEzB;;;;;;;;;OASG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,UAAU,CAAC;IAEhD;;;;;;;;;;;OAWG;IACH,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,IAAI,CAAC;IAE7C;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,MAAM,EAAE,GAAG,CAAC;IAEZ;;OAEG;IACH,WAAW,EAAE;QACX;;WAEG;QACH,EAAE,EAAE,MAAM,CAAC;QAEX;;WAEG;QACH,QAAQ,EAAE,MAAM,CAAC;QAEjB;;WAEG;QACH,MAAM,EAAE,MAAM,CAAC;QAEf;;WAEG;QACH,GAAG,EAAE,MAAM,CAAC;QAEZ;;WAEG;QACH,QAAQ,EAAE,MAAM,CAAC;QAEjB;;WAEG;QACH,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;CACH"}
@@ -1,8 +0,0 @@
1
- "use strict";
2
- /**
3
- * Options for Basic and Standard APIs
4
- *
5
- * @packageDocumentation
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- //# sourceMappingURL=Options.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Options.js","sourceRoot":"","sources":["../../../src/level1/types/Options.ts"],"names":[],"mappings":";AAAA;;;;GAIG"}
@@ -1,8 +0,0 @@
1
- /**
2
- * Standard API Types - Job, Options, and related interfaces
3
- *
4
- * @packageDocumentation
5
- */
6
- export { Job, JobHandler, JobContext } from './Job';
7
- export { ProvideOptions, RequestOptions, RequestResult, RequestStatus, WalletOption, NetworkOption } from './Options';
8
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/level1/types/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,aAAa,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC"}
@@ -1,8 +0,0 @@
1
- "use strict";
2
- /**
3
- * Standard API Types - Job, Options, and related interfaces
4
- *
5
- * @packageDocumentation
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/level1/types/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG"}
@@ -1,177 +0,0 @@
1
- import { Signer } from 'ethers';
2
- import { AgentProfile, ServiceDescriptor, RegisterAgentParams, QueryAgentsParams } from '../types';
3
- /**
4
- * Gas options for transactions
5
- */
6
- interface GasOptions {
7
- maxFeePerGas?: bigint;
8
- maxPriorityFeePerGas?: bigint;
9
- }
10
- /**
11
- * AgentRegistry - Agent Identity & Reputation SDK Module (AIP-7)
12
- *
13
- * Provides methods for:
14
- * - Registering AI agents on-chain
15
- * - Managing agent profiles and services
16
- * - Querying agents by service type
17
- * - Reading reputation scores
18
- *
19
- * Reference: AIP-7 Agent Identity, Registry & Storage System
20
- */
21
- export declare class AgentRegistry {
22
- private readonly address;
23
- private contract;
24
- private readonly gasSettings?;
25
- constructor(address: string, signer: Signer, gasSettings?: GasOptions);
26
- /**
27
- * Get gas buffer multiplier based on operation complexity
28
- */
29
- private getGasBufferMultiplier;
30
- /**
31
- * Build transaction options with gas settings
32
- */
33
- private buildTxOptions;
34
- /**
35
- * Get registry contract address
36
- */
37
- getAddress(): string;
38
- /**
39
- * Compute service type hash
40
- * Service types must be lowercase with only a-z, 0-9, and hyphens
41
- *
42
- * @param serviceType - Human-readable service type (e.g., "text-generation")
43
- * @returns keccak256 hash of the service type
44
- */
45
- computeServiceTypeHash(serviceType: string): string;
46
- /**
47
- * Register a new agent profile
48
- *
49
- * @param params - Registration parameters
50
- * @returns Transaction hash
51
- *
52
- * @example
53
- * ```typescript
54
- * await registry.registerAgent({
55
- * endpoint: 'https://myagent.example.com/webhook',
56
- * serviceDescriptors: [{
57
- * serviceTypeHash: registry.computeServiceTypeHash('text-generation'),
58
- * serviceType: 'text-generation',
59
- * schemaURI: 'ipfs://Qm...',
60
- * minPrice: 1_000_000n, // 1 USDC
61
- * maxPrice: 100_000_000n, // 100 USDC
62
- * avgCompletionTime: 60,
63
- * metadataCID: 'Qm...'
64
- * }]
65
- * });
66
- * ```
67
- */
68
- registerAgent(params: RegisterAgentParams): Promise<string>;
69
- /**
70
- * Update agent endpoint URL
71
- *
72
- * @param newEndpoint - New webhook/IPFS gateway URL
73
- */
74
- updateEndpoint(newEndpoint: string): Promise<string>;
75
- /**
76
- * Add a new service type to agent profile
77
- *
78
- * @param serviceType - Lowercase service type (e.g., "code-review")
79
- */
80
- addServiceType(serviceType: string): Promise<string>;
81
- /**
82
- * Remove a service type from agent profile
83
- *
84
- * @param serviceTypeHash - Hash of service type to remove
85
- */
86
- removeServiceType(serviceTypeHash: string): Promise<string>;
87
- /**
88
- * Set agent active/inactive status
89
- *
90
- * @param isActive - Whether agent is accepting new requests
91
- */
92
- setActiveStatus(isActive: boolean): Promise<string>;
93
- /**
94
- * Get agent profile by address
95
- *
96
- * @param agentAddress - Agent's Ethereum address
97
- * @returns Agent profile or null if not registered
98
- */
99
- getAgent(agentAddress: string): Promise<AgentProfile | null>;
100
- /**
101
- * Get agent profile by DID
102
- *
103
- * @param did - Agent's DID (e.g., "did:ethr:8453:0x...")
104
- * @returns Agent profile or null if not found
105
- */
106
- getAgentByDID(did: string): Promise<AgentProfile | null>;
107
- /**
108
- * Query agents by service type
109
- *
110
- * **IMPORTANT - Query Cap Limitation (L-4)**:
111
- *
112
- * This method will throw `QueryCapExceededError` when the registry contains
113
- * more than 1000 agents. This is an intentional DoS prevention measure.
114
- *
115
- * When you encounter this error, migrate to an off-chain indexer:
116
- * - The Graph: https://thegraph.com/
117
- * - Goldsky: https://goldsky.com/
118
- * - Alchemy Subgraphs: https://docs.alchemy.com/docs/subgraphs-overview
119
- *
120
- * See `QueryCapExceededError` documentation for event schemas to index.
121
- *
122
- * @param params - Query parameters
123
- * @returns List of agent addresses matching criteria
124
- * @throws {QueryCapExceededError} When registry exceeds 1000 agents
125
- * @throws {ValidationError} For invalid parameters
126
- *
127
- * @example
128
- * ```typescript
129
- * try {
130
- * const agents = await registry.queryAgentsByService({
131
- * serviceTypeHash: registry.computeServiceTypeHash('text-generation'),
132
- * minReputation: 5000,
133
- * limit: 50
134
- * });
135
- * } catch (error) {
136
- * if (error instanceof QueryCapExceededError) {
137
- * console.log('Registry too large, use off-chain indexer');
138
- * // Fallback to your indexer implementation
139
- * }
140
- * }
141
- * ```
142
- */
143
- queryAgentsByService(params: QueryAgentsParams): Promise<string[]>;
144
- /**
145
- * Get service descriptors for an agent
146
- *
147
- * @param agentAddress - Agent's Ethereum address
148
- * @returns List of service descriptors
149
- */
150
- getServiceDescriptors(agentAddress: string): Promise<ServiceDescriptor[]>;
151
- /**
152
- * Check if agent supports a service type
153
- *
154
- * @param agentAddress - Agent's Ethereum address
155
- * @param serviceTypeHash - Service type hash
156
- * @returns True if supported
157
- */
158
- supportsService(agentAddress: string, serviceTypeHash: string): Promise<boolean>;
159
- /**
160
- * Get the chain ID used for DID generation
161
- */
162
- getChainId(): Promise<number>;
163
- /**
164
- * Build a DID for an address on the current chain
165
- *
166
- * @param address - Ethereum address
167
- * @returns DID string (e.g., "did:ethr:8453:0x...")
168
- */
169
- buildDID(address: string): Promise<string>;
170
- /**
171
- * Safely convert bigint to number, throwing if precision would be lost
172
- */
173
- private safeToNumber;
174
- private _mapProfile;
175
- }
176
- export {};
177
- //# sourceMappingURL=AgentRegistry.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AgentRegistry.d.ts","sourceRoot":"","sources":["../../src/protocol/AgentRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,MAAM,EAA0B,MAAM,QAAQ,CAAC;AAElE,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,UAAU,CAAC;AAIlB;;GAEG;AACH,UAAU,UAAU;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED;;;;;;;;;;GAUG;AACH,qBAAa,aAAa;IAKtB,OAAO,CAAC,QAAQ,CAAC,OAAO;IAJ1B,OAAO,CAAC,QAAQ,CAAW;IAC3B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAa;gBAGvB,OAAO,EAAE,MAAM,EAChC,MAAM,EAAE,MAAM,EACd,WAAW,CAAC,EAAE,UAAU;IAM1B;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAY9B;;OAEG;IACH,OAAO,CAAC,cAAc;IAsBtB;;OAEG;IACH,UAAU,IAAI,MAAM;IAIpB;;;;;;OAMG;IACH,sBAAsB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM;IAsBnD;;;;;;;;;;;;;;;;;;;;;OAqBG;IACG,aAAa,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC;IAkFjE;;;;OAIG;IACG,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAqB1D;;;;OAIG;IACG,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAqB1D;;;;OAIG;IACG,iBAAiB,CAAC,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IA0BjE;;;;OAIG;IACG,eAAe,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC;IAoBzD;;;;;OAKG;IACG,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IAalE;;;;;OAKG;IACG,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IAgC9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmCG;IACG,oBAAoB,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAiDxE;;;;;OAKG;IACG,qBAAqB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAgB/E;;;;;;OAMG;IACG,eAAe,CAAC,YAAY,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAKtF;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC;IAInC;;;;;OAKG;IACG,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAQhD;;OAEG;IACH,OAAO,CAAC,YAAY;IAWpB,OAAO,CAAC,WAAW;CAgBpB"}