@oobe-protocol-labs/synapse-sap-sdk 0.1.0

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 (315) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +882 -0
  3. package/dist/cjs/constants/index.js +43 -0
  4. package/dist/cjs/constants/index.js.map +1 -0
  5. package/dist/cjs/constants/limits.js +161 -0
  6. package/dist/cjs/constants/limits.js.map +1 -0
  7. package/dist/cjs/constants/programs.js +78 -0
  8. package/dist/cjs/constants/programs.js.map +1 -0
  9. package/dist/cjs/constants/seeds.js +57 -0
  10. package/dist/cjs/constants/seeds.js.map +1 -0
  11. package/dist/cjs/core/client.js +391 -0
  12. package/dist/cjs/core/client.js.map +1 -0
  13. package/dist/cjs/core/connection.js +319 -0
  14. package/dist/cjs/core/connection.js.map +1 -0
  15. package/dist/cjs/core/index.js +24 -0
  16. package/dist/cjs/core/index.js.map +1 -0
  17. package/dist/cjs/errors/index.js +334 -0
  18. package/dist/cjs/errors/index.js.map +1 -0
  19. package/dist/cjs/events/index.js +136 -0
  20. package/dist/cjs/events/index.js.map +1 -0
  21. package/dist/cjs/idl/index.js +63 -0
  22. package/dist/cjs/idl/index.js.map +1 -0
  23. package/dist/cjs/idl/synapse_agent_sap.json +9710 -0
  24. package/dist/cjs/index.js +147 -0
  25. package/dist/cjs/index.js.map +1 -0
  26. package/dist/cjs/modules/agent.js +272 -0
  27. package/dist/cjs/modules/agent.js.map +1 -0
  28. package/dist/cjs/modules/attestation.js +147 -0
  29. package/dist/cjs/modules/attestation.js.map +1 -0
  30. package/dist/cjs/modules/base.js +128 -0
  31. package/dist/cjs/modules/base.js.map +1 -0
  32. package/dist/cjs/modules/escrow.js +246 -0
  33. package/dist/cjs/modules/escrow.js.map +1 -0
  34. package/dist/cjs/modules/feedback.js +166 -0
  35. package/dist/cjs/modules/feedback.js.map +1 -0
  36. package/dist/cjs/modules/index.js +35 -0
  37. package/dist/cjs/modules/index.js.map +1 -0
  38. package/dist/cjs/modules/indexing.js +375 -0
  39. package/dist/cjs/modules/indexing.js.map +1 -0
  40. package/dist/cjs/modules/ledger.js +234 -0
  41. package/dist/cjs/modules/ledger.js.map +1 -0
  42. package/dist/cjs/modules/tools.js +319 -0
  43. package/dist/cjs/modules/tools.js.map +1 -0
  44. package/dist/cjs/modules/vault.js +410 -0
  45. package/dist/cjs/modules/vault.js.map +1 -0
  46. package/dist/cjs/pda/index.js +377 -0
  47. package/dist/cjs/pda/index.js.map +1 -0
  48. package/dist/cjs/plugin/index.js +934 -0
  49. package/dist/cjs/plugin/index.js.map +1 -0
  50. package/dist/cjs/plugin/protocols.js +282 -0
  51. package/dist/cjs/plugin/protocols.js.map +1 -0
  52. package/dist/cjs/plugin/schemas.js +831 -0
  53. package/dist/cjs/plugin/schemas.js.map +1 -0
  54. package/dist/cjs/postgres/adapter.js +715 -0
  55. package/dist/cjs/postgres/adapter.js.map +1 -0
  56. package/dist/cjs/postgres/index.js +50 -0
  57. package/dist/cjs/postgres/index.js.map +1 -0
  58. package/dist/cjs/postgres/serializers.js +381 -0
  59. package/dist/cjs/postgres/serializers.js.map +1 -0
  60. package/dist/cjs/postgres/sync.js +221 -0
  61. package/dist/cjs/postgres/sync.js.map +1 -0
  62. package/dist/cjs/postgres/types.js +44 -0
  63. package/dist/cjs/postgres/types.js.map +1 -0
  64. package/dist/cjs/registries/builder.js +414 -0
  65. package/dist/cjs/registries/builder.js.map +1 -0
  66. package/dist/cjs/registries/discovery.js +362 -0
  67. package/dist/cjs/registries/discovery.js.map +1 -0
  68. package/dist/cjs/registries/index.js +51 -0
  69. package/dist/cjs/registries/index.js.map +1 -0
  70. package/dist/cjs/registries/session.js +433 -0
  71. package/dist/cjs/registries/session.js.map +1 -0
  72. package/dist/cjs/registries/x402.js +577 -0
  73. package/dist/cjs/registries/x402.js.map +1 -0
  74. package/dist/cjs/types/accounts.js +13 -0
  75. package/dist/cjs/types/accounts.js.map +1 -0
  76. package/dist/cjs/types/common.js +13 -0
  77. package/dist/cjs/types/common.js.map +1 -0
  78. package/dist/cjs/types/enums.js +174 -0
  79. package/dist/cjs/types/enums.js.map +1 -0
  80. package/dist/cjs/types/index.js +36 -0
  81. package/dist/cjs/types/index.js.map +1 -0
  82. package/dist/cjs/types/instructions.js +92 -0
  83. package/dist/cjs/types/instructions.js.map +1 -0
  84. package/dist/cjs/utils/hash.js +58 -0
  85. package/dist/cjs/utils/hash.js.map +1 -0
  86. package/dist/cjs/utils/index.js +27 -0
  87. package/dist/cjs/utils/index.js.map +1 -0
  88. package/dist/cjs/utils/serialization.js +105 -0
  89. package/dist/cjs/utils/serialization.js.map +1 -0
  90. package/dist/cjs/utils/validation.js +36 -0
  91. package/dist/cjs/utils/validation.js.map +1 -0
  92. package/dist/esm/constants/index.js +29 -0
  93. package/dist/esm/constants/index.js.map +1 -0
  94. package/dist/esm/constants/limits.js +158 -0
  95. package/dist/esm/constants/limits.js.map +1 -0
  96. package/dist/esm/constants/programs.js +75 -0
  97. package/dist/esm/constants/programs.js.map +1 -0
  98. package/dist/esm/constants/seeds.js +54 -0
  99. package/dist/esm/constants/seeds.js.map +1 -0
  100. package/dist/esm/core/client.js +384 -0
  101. package/dist/esm/core/client.js.map +1 -0
  102. package/dist/esm/core/connection.js +315 -0
  103. package/dist/esm/core/connection.js.map +1 -0
  104. package/dist/esm/core/index.js +19 -0
  105. package/dist/esm/core/index.js.map +1 -0
  106. package/dist/esm/errors/index.js +325 -0
  107. package/dist/esm/errors/index.js.map +1 -0
  108. package/dist/esm/events/index.js +132 -0
  109. package/dist/esm/events/index.js.map +1 -0
  110. package/dist/esm/idl/index.js +57 -0
  111. package/dist/esm/idl/index.js.map +1 -0
  112. package/dist/esm/idl/synapse_agent_sap.json +9710 -0
  113. package/dist/esm/index.js +70 -0
  114. package/dist/esm/index.js.map +1 -0
  115. package/dist/esm/modules/agent.js +268 -0
  116. package/dist/esm/modules/agent.js.map +1 -0
  117. package/dist/esm/modules/attestation.js +143 -0
  118. package/dist/esm/modules/attestation.js.map +1 -0
  119. package/dist/esm/modules/base.js +124 -0
  120. package/dist/esm/modules/base.js.map +1 -0
  121. package/dist/esm/modules/escrow.js +242 -0
  122. package/dist/esm/modules/escrow.js.map +1 -0
  123. package/dist/esm/modules/feedback.js +162 -0
  124. package/dist/esm/modules/feedback.js.map +1 -0
  125. package/dist/esm/modules/index.js +23 -0
  126. package/dist/esm/modules/index.js.map +1 -0
  127. package/dist/esm/modules/indexing.js +371 -0
  128. package/dist/esm/modules/indexing.js.map +1 -0
  129. package/dist/esm/modules/ledger.js +230 -0
  130. package/dist/esm/modules/ledger.js.map +1 -0
  131. package/dist/esm/modules/tools.js +315 -0
  132. package/dist/esm/modules/tools.js.map +1 -0
  133. package/dist/esm/modules/vault.js +406 -0
  134. package/dist/esm/modules/vault.js.map +1 -0
  135. package/dist/esm/pda/index.js +357 -0
  136. package/dist/esm/pda/index.js.map +1 -0
  137. package/dist/esm/plugin/index.js +927 -0
  138. package/dist/esm/plugin/index.js.map +1 -0
  139. package/dist/esm/plugin/protocols.js +279 -0
  140. package/dist/esm/plugin/protocols.js.map +1 -0
  141. package/dist/esm/plugin/schemas.js +828 -0
  142. package/dist/esm/plugin/schemas.js.map +1 -0
  143. package/dist/esm/postgres/adapter.js +678 -0
  144. package/dist/esm/postgres/adapter.js.map +1 -0
  145. package/dist/esm/postgres/index.js +27 -0
  146. package/dist/esm/postgres/index.js.map +1 -0
  147. package/dist/esm/postgres/serializers.js +362 -0
  148. package/dist/esm/postgres/serializers.js.map +1 -0
  149. package/dist/esm/postgres/sync.js +217 -0
  150. package/dist/esm/postgres/sync.js.map +1 -0
  151. package/dist/esm/postgres/types.js +41 -0
  152. package/dist/esm/postgres/types.js.map +1 -0
  153. package/dist/esm/registries/builder.js +410 -0
  154. package/dist/esm/registries/builder.js.map +1 -0
  155. package/dist/esm/registries/discovery.js +358 -0
  156. package/dist/esm/registries/discovery.js.map +1 -0
  157. package/dist/esm/registries/index.js +44 -0
  158. package/dist/esm/registries/index.js.map +1 -0
  159. package/dist/esm/registries/session.js +429 -0
  160. package/dist/esm/registries/session.js.map +1 -0
  161. package/dist/esm/registries/x402.js +573 -0
  162. package/dist/esm/registries/x402.js.map +1 -0
  163. package/dist/esm/types/accounts.js +12 -0
  164. package/dist/esm/types/accounts.js.map +1 -0
  165. package/dist/esm/types/common.js +12 -0
  166. package/dist/esm/types/common.js.map +1 -0
  167. package/dist/esm/types/enums.js +171 -0
  168. package/dist/esm/types/enums.js.map +1 -0
  169. package/dist/esm/types/index.js +25 -0
  170. package/dist/esm/types/index.js.map +1 -0
  171. package/dist/esm/types/instructions.js +89 -0
  172. package/dist/esm/types/instructions.js.map +1 -0
  173. package/dist/esm/utils/hash.js +53 -0
  174. package/dist/esm/utils/hash.js.map +1 -0
  175. package/dist/esm/utils/index.js +19 -0
  176. package/dist/esm/utils/index.js.map +1 -0
  177. package/dist/esm/utils/serialization.js +98 -0
  178. package/dist/esm/utils/serialization.js.map +1 -0
  179. package/dist/esm/utils/validation.js +33 -0
  180. package/dist/esm/utils/validation.js.map +1 -0
  181. package/dist/types/constants/index.d.ts +27 -0
  182. package/dist/types/constants/index.d.ts.map +1 -0
  183. package/dist/types/constants/limits.d.ts +149 -0
  184. package/dist/types/constants/limits.d.ts.map +1 -0
  185. package/dist/types/constants/programs.d.ts +69 -0
  186. package/dist/types/constants/programs.d.ts.map +1 -0
  187. package/dist/types/constants/seeds.d.ts +61 -0
  188. package/dist/types/constants/seeds.d.ts.map +1 -0
  189. package/dist/types/core/client.d.ts +323 -0
  190. package/dist/types/core/client.d.ts.map +1 -0
  191. package/dist/types/core/connection.d.ts +279 -0
  192. package/dist/types/core/connection.d.ts.map +1 -0
  193. package/dist/types/core/index.d.ts +20 -0
  194. package/dist/types/core/index.d.ts.map +1 -0
  195. package/dist/types/errors/index.d.ts +276 -0
  196. package/dist/types/errors/index.d.ts.map +1 -0
  197. package/dist/types/events/index.d.ts +248 -0
  198. package/dist/types/events/index.d.ts.map +1 -0
  199. package/dist/types/idl/index.d.ts +70 -0
  200. package/dist/types/idl/index.d.ts.map +1 -0
  201. package/dist/types/index.d.ts +68 -0
  202. package/dist/types/index.d.ts.map +1 -0
  203. package/dist/types/modules/agent.d.ts +166 -0
  204. package/dist/types/modules/agent.d.ts.map +1 -0
  205. package/dist/types/modules/attestation.d.ts +96 -0
  206. package/dist/types/modules/attestation.d.ts.map +1 -0
  207. package/dist/types/modules/base.d.ts +126 -0
  208. package/dist/types/modules/base.d.ts.map +1 -0
  209. package/dist/types/modules/escrow.d.ts +151 -0
  210. package/dist/types/modules/escrow.d.ts.map +1 -0
  211. package/dist/types/modules/feedback.d.ts +105 -0
  212. package/dist/types/modules/feedback.d.ts.map +1 -0
  213. package/dist/types/modules/index.d.ts +24 -0
  214. package/dist/types/modules/index.d.ts.map +1 -0
  215. package/dist/types/modules/indexing.d.ts +200 -0
  216. package/dist/types/modules/indexing.d.ts.map +1 -0
  217. package/dist/types/modules/ledger.d.ts +150 -0
  218. package/dist/types/modules/ledger.d.ts.map +1 -0
  219. package/dist/types/modules/tools.d.ts +182 -0
  220. package/dist/types/modules/tools.d.ts.map +1 -0
  221. package/dist/types/modules/vault.d.ts +240 -0
  222. package/dist/types/modules/vault.d.ts.map +1 -0
  223. package/dist/types/pda/index.d.ts +296 -0
  224. package/dist/types/pda/index.d.ts.map +1 -0
  225. package/dist/types/plugin/index.d.ts +171 -0
  226. package/dist/types/plugin/index.d.ts.map +1 -0
  227. package/dist/types/plugin/protocols.d.ts +152 -0
  228. package/dist/types/plugin/protocols.d.ts.map +1 -0
  229. package/dist/types/plugin/schemas.d.ts +823 -0
  230. package/dist/types/plugin/schemas.d.ts.map +1 -0
  231. package/dist/types/postgres/adapter.d.ts +355 -0
  232. package/dist/types/postgres/adapter.d.ts.map +1 -0
  233. package/dist/types/postgres/index.d.ts +24 -0
  234. package/dist/types/postgres/index.d.ts.map +1 -0
  235. package/dist/types/postgres/serializers.d.ts +30 -0
  236. package/dist/types/postgres/serializers.d.ts.map +1 -0
  237. package/dist/types/postgres/sync.d.ts +132 -0
  238. package/dist/types/postgres/sync.d.ts.map +1 -0
  239. package/dist/types/postgres/types.d.ts +167 -0
  240. package/dist/types/postgres/types.d.ts.map +1 -0
  241. package/dist/types/registries/builder.d.ts +340 -0
  242. package/dist/types/registries/builder.d.ts.map +1 -0
  243. package/dist/types/registries/discovery.d.ts +333 -0
  244. package/dist/types/registries/discovery.d.ts.map +1 -0
  245. package/dist/types/registries/index.d.ts +48 -0
  246. package/dist/types/registries/index.d.ts.map +1 -0
  247. package/dist/types/registries/session.d.ts +323 -0
  248. package/dist/types/registries/session.d.ts.map +1 -0
  249. package/dist/types/registries/x402.d.ts +463 -0
  250. package/dist/types/registries/x402.d.ts.map +1 -0
  251. package/dist/types/types/accounts.d.ts +565 -0
  252. package/dist/types/types/accounts.d.ts.map +1 -0
  253. package/dist/types/types/common.d.ts +166 -0
  254. package/dist/types/types/common.d.ts.map +1 -0
  255. package/dist/types/types/enums.d.ts +238 -0
  256. package/dist/types/types/enums.d.ts.map +1 -0
  257. package/dist/types/types/index.d.ts +28 -0
  258. package/dist/types/types/index.d.ts.map +1 -0
  259. package/dist/types/types/instructions.d.ts +366 -0
  260. package/dist/types/types/instructions.d.ts.map +1 -0
  261. package/dist/types/utils/hash.d.ts +48 -0
  262. package/dist/types/utils/hash.d.ts.map +1 -0
  263. package/dist/types/utils/index.d.ts +19 -0
  264. package/dist/types/utils/index.d.ts.map +1 -0
  265. package/dist/types/utils/serialization.d.ts +69 -0
  266. package/dist/types/utils/serialization.d.ts.map +1 -0
  267. package/dist/types/utils/validation.d.ts +29 -0
  268. package/dist/types/utils/validation.d.ts.map +1 -0
  269. package/package.json +178 -0
  270. package/src/constants/index.ts +44 -0
  271. package/src/constants/limits.ts +165 -0
  272. package/src/constants/programs.ts +83 -0
  273. package/src/constants/seeds.ts +66 -0
  274. package/src/core/client.ts +416 -0
  275. package/src/core/connection.ts +409 -0
  276. package/src/core/index.ts +20 -0
  277. package/src/errors/index.ts +346 -0
  278. package/src/events/index.ts +335 -0
  279. package/src/idl/index.ts +76 -0
  280. package/src/idl/synapse_agent_sap.json +9710 -0
  281. package/src/index.ts +253 -0
  282. package/src/modules/agent.ts +319 -0
  283. package/src/modules/attestation.ts +168 -0
  284. package/src/modules/base.ts +158 -0
  285. package/src/modules/escrow.ts +308 -0
  286. package/src/modules/feedback.ts +186 -0
  287. package/src/modules/index.ts +24 -0
  288. package/src/modules/indexing.ts +444 -0
  289. package/src/modules/ledger.ts +262 -0
  290. package/src/modules/tools.ts +411 -0
  291. package/src/modules/vault.ts +533 -0
  292. package/src/pda/index.ts +512 -0
  293. package/src/plugin/index.ts +1202 -0
  294. package/src/plugin/protocols.ts +404 -0
  295. package/src/plugin/schemas.ts +909 -0
  296. package/src/postgres/adapter.ts +904 -0
  297. package/src/postgres/index.ts +59 -0
  298. package/src/postgres/schema.sql +683 -0
  299. package/src/postgres/serializers.ts +485 -0
  300. package/src/postgres/sync.ts +254 -0
  301. package/src/postgres/types.ts +245 -0
  302. package/src/registries/builder.ts +607 -0
  303. package/src/registries/discovery.ts +572 -0
  304. package/src/registries/index.ts +77 -0
  305. package/src/registries/session.ts +613 -0
  306. package/src/registries/x402.ts +906 -0
  307. package/src/types/accounts.ts +618 -0
  308. package/src/types/common.ts +187 -0
  309. package/src/types/enums.ts +214 -0
  310. package/src/types/index.ts +92 -0
  311. package/src/types/instructions.ts +413 -0
  312. package/src/utils/hash.ts +57 -0
  313. package/src/utils/index.ts +19 -0
  314. package/src/utils/serialization.ts +98 -0
  315. package/src/utils/validation.ts +36 -0
@@ -0,0 +1,296 @@
1
+ /**
2
+ * @module pda
3
+ * @description Deterministic PDA derivation for every SAP v2 account.
4
+ *
5
+ * Each function returns `[PublicKey, bump]` and is pure — no network
6
+ * calls. All results are memoizable by the caller.
7
+ *
8
+ * Seeds mirror the Rust `#[account(seeds = [...])]` definitions exactly.
9
+ *
10
+ * @category PDA
11
+ * @since v0.1.0
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * import { deriveAgent, deriveEscrow } from "@synapse-sap/sdk/pda";
16
+ *
17
+ * const [agentPda, bump] = deriveAgent(walletPublicKey);
18
+ * const [escrowPda] = deriveEscrow(agentPda, depositor);
19
+ * ```
20
+ */
21
+ import { PublicKey } from "@solana/web3.js";
22
+ /**
23
+ * Tuple returned by all PDA derivation functions.
24
+ *
25
+ * @name PdaResult
26
+ * @description A readonly tuple of `[pda, bump]` where `pda` is the derived
27
+ * `PublicKey` and `bump` is the canonical bump seed (`u8`).
28
+ * @category PDA
29
+ * @since v0.1.0
30
+ */
31
+ type PdaResult = readonly [pda: PublicKey, bump: number];
32
+ /**
33
+ * Derive the **GlobalRegistry** PDA.
34
+ *
35
+ * Seeds: `["sap_global"]`
36
+ *
37
+ * @name deriveGlobalRegistry
38
+ * @description Returns the singleton global registry address used by the SAP program.
39
+ * @param programId - Override program ID (defaults to {@link SAP_PROGRAM_ID}).
40
+ * @returns {PdaResult} `[pda, bump]` tuple.
41
+ * @category PDA
42
+ * @since v0.1.0
43
+ * @see GlobalRegistry account type
44
+ */
45
+ export declare const deriveGlobalRegistry: (programId?: PublicKey) => PdaResult;
46
+ /**
47
+ * Derive the **AgentAccount** PDA for a given wallet.
48
+ *
49
+ * Seeds: `["sap_agent", wallet]`
50
+ *
51
+ * @name deriveAgent
52
+ * @description Computes the unique agent PDA owned by `wallet`.
53
+ * @param wallet - The agent owner’s wallet `PublicKey`.
54
+ * @param programId - Override program ID (defaults to {@link SAP_PROGRAM_ID}).
55
+ * @returns {PdaResult} `[pda, bump]` tuple.
56
+ * @category PDA
57
+ * @since v0.1.0
58
+ * @see AgentAccount
59
+ */
60
+ export declare const deriveAgent: (wallet: PublicKey, programId?: PublicKey) => PdaResult;
61
+ /**
62
+ * Derive the **AgentStats** PDA for a given agent.
63
+ *
64
+ * Seeds: `["sap_stats", agent_pda]`
65
+ *
66
+ * @name deriveAgentStats
67
+ * @description Computes the stats account PDA associated with an agent.
68
+ * @param agentPda - The agent’s on-chain PDA.
69
+ * @param programId - Override program ID (defaults to {@link SAP_PROGRAM_ID}).
70
+ * @returns {PdaResult} `[pda, bump]` tuple.
71
+ * @category PDA
72
+ * @since v0.1.0
73
+ * @see AgentStats
74
+ */
75
+ export declare const deriveAgentStats: (agentPda: PublicKey, programId?: PublicKey) => PdaResult;
76
+ /**
77
+ * Derive the **Feedback** PDA for a reviewer on a specific agent.
78
+ *
79
+ * Seeds: `["sap_feedback", agent_pda, reviewer_wallet]`
80
+ *
81
+ * @name deriveFeedback
82
+ * @description Computes the feedback account PDA scoped to a reviewer–agent pair.
83
+ * @param agentPda - The target agent’s PDA.
84
+ * @param reviewer - The reviewer’s wallet `PublicKey`.
85
+ * @param programId - Override program ID (defaults to {@link SAP_PROGRAM_ID}).
86
+ * @returns {PdaResult} `[pda, bump]` tuple.
87
+ * @category PDA
88
+ * @since v0.1.0
89
+ * @see FeedbackAccount
90
+ */
91
+ export declare const deriveFeedback: (agentPda: PublicKey, reviewer: PublicKey, programId?: PublicKey) => PdaResult;
92
+ /**
93
+ * Derive the **CapabilityIndex** PDA for a hashed capability string.
94
+ *
95
+ * Seeds: `["sap_cap_idx", capability_hash]`
96
+ *
97
+ * @name deriveCapabilityIndex
98
+ * @description Computes the capability index PDA used to look up agents by capability.
99
+ * @param capabilityHash - SHA-256 hash of the capability string (32 bytes).
100
+ * @param programId - Override program ID (defaults to {@link SAP_PROGRAM_ID}).
101
+ * @returns {PdaResult} `[pda, bump]` tuple.
102
+ * @category PDA
103
+ * @since v0.1.0
104
+ * @see CapabilityIndex
105
+ */
106
+ export declare const deriveCapabilityIndex: (capabilityHash: Uint8Array, programId?: PublicKey) => PdaResult;
107
+ /**
108
+ * Derive the **ProtocolIndex** PDA for a hashed protocol string.
109
+ *
110
+ * Seeds: `["sap_proto_idx", protocol_hash]`
111
+ *
112
+ * @name deriveProtocolIndex
113
+ * @description Computes the protocol index PDA used to look up agents by protocol.
114
+ * @param protocolHash - SHA-256 hash of the protocol string (32 bytes).
115
+ * @param programId - Override program ID (defaults to {@link SAP_PROGRAM_ID}).
116
+ * @returns {PdaResult} `[pda, bump]` tuple.
117
+ * @category PDA
118
+ * @since v0.1.0
119
+ * @see ProtocolIndex
120
+ */
121
+ export declare const deriveProtocolIndex: (protocolHash: Uint8Array, programId?: PublicKey) => PdaResult;
122
+ /**
123
+ * Derive the **ToolCategoryIndex** PDA for a tool category discriminant.
124
+ *
125
+ * Seeds: `["sap_tool_cat", category_u8]`
126
+ *
127
+ * @name deriveToolCategoryIndex
128
+ * @description Computes the tool category index PDA used to look up tools by category.
129
+ * @param category - The `u8` category discriminant (see {@link TOOL_CATEGORY_VALUES}).
130
+ * @param programId - Override program ID (defaults to {@link SAP_PROGRAM_ID}).
131
+ * @returns {PdaResult} `[pda, bump]` tuple.
132
+ * @category PDA
133
+ * @since v0.1.0
134
+ * @see ToolCategoryIndex
135
+ */
136
+ export declare const deriveToolCategoryIndex: (category: number, programId?: PublicKey) => PdaResult;
137
+ /**
138
+ * Derive the **MemoryVault** PDA for a given agent.
139
+ *
140
+ * Seeds: `["sap_vault", agent_pda]`
141
+ *
142
+ * @name deriveVault
143
+ * @description Computes the memory vault PDA owned by the specified agent.
144
+ * @param agentPda - The agent’s on-chain PDA.
145
+ * @param programId - Override program ID (defaults to {@link SAP_PROGRAM_ID}).
146
+ * @returns {PdaResult} `[pda, bump]` tuple.
147
+ * @category PDA
148
+ * @since v0.1.0
149
+ * @see MemoryVault
150
+ */
151
+ export declare const deriveVault: (agentPda: PublicKey, programId?: PublicKey) => PdaResult;
152
+ /**
153
+ * Derive the **Session** PDA for a vault and session hash.
154
+ *
155
+ * Seeds: `["sap_session", vault_pda, session_hash]`
156
+ *
157
+ * @name deriveSession
158
+ * @description Computes the session PDA scoped to a vault and unique session identifier.
159
+ * @param vaultPda - The parent vault’s PDA.
160
+ * @param sessionHash - SHA-256 hash identifying the session (32 bytes).
161
+ * @param programId - Override program ID (defaults to {@link SAP_PROGRAM_ID}).
162
+ * @returns {PdaResult} `[pda, bump]` tuple.
163
+ * @category PDA
164
+ * @since v0.1.0
165
+ * @see SessionAccount
166
+ */
167
+ export declare const deriveSession: (vaultPda: PublicKey, sessionHash: Uint8Array, programId?: PublicKey) => PdaResult;
168
+ /**
169
+ * Derive the **EpochPage** PDA for a session at a given epoch index.
170
+ *
171
+ * Seeds: `["sap_epoch", session_pda, epoch_index_u32_le]`
172
+ *
173
+ * @name deriveEpochPage
174
+ * @description Computes the epoch page PDA for paginated memory inscriptions.
175
+ * @param sessionPda - The parent session’s PDA.
176
+ * @param epochIndex - Zero-based epoch page index.
177
+ * @param programId - Override program ID (defaults to {@link SAP_PROGRAM_ID}).
178
+ * @returns {PdaResult} `[pda, bump]` tuple.
179
+ * @category PDA
180
+ * @since v0.1.0
181
+ * @see EpochPage
182
+ */
183
+ export declare const deriveEpochPage: (sessionPda: PublicKey, epochIndex: number, programId?: PublicKey) => PdaResult;
184
+ /**
185
+ * Derive the **VaultDelegate** PDA for a delegate on a vault.
186
+ *
187
+ * Seeds: `["sap_delegate", vault_pda, delegate_pubkey]`
188
+ *
189
+ * @name deriveVaultDelegate
190
+ * @description Computes the delegate authorization PDA granting a wallet write access to a vault.
191
+ * @param vaultPda - The parent vault’s PDA.
192
+ * @param delegate - The delegate’s wallet `PublicKey`.
193
+ * @param programId - Override program ID (defaults to {@link SAP_PROGRAM_ID}).
194
+ * @returns {PdaResult} `[pda, bump]` tuple.
195
+ * @category PDA
196
+ * @since v0.1.0
197
+ * @see VaultDelegate
198
+ */
199
+ export declare const deriveVaultDelegate: (vaultPda: PublicKey, delegate: PublicKey, programId?: PublicKey) => PdaResult;
200
+ /**
201
+ * Derive the **Checkpoint** PDA for a session at a given checkpoint index.
202
+ *
203
+ * Seeds: `["sap_checkpoint", session_pda, checkpoint_index_u32_le]`
204
+ *
205
+ * @name deriveCheckpoint
206
+ * @description Computes the checkpoint PDA storing a Merkle snapshot of session state.
207
+ * @param sessionPda - The parent session’s PDA.
208
+ * @param checkpointIndex - Zero-based checkpoint index.
209
+ * @param programId - Override program ID (defaults to {@link SAP_PROGRAM_ID}).
210
+ * @returns {PdaResult} `[pda, bump]` tuple.
211
+ * @category PDA
212
+ * @since v0.1.0
213
+ * @see Checkpoint
214
+ */
215
+ export declare const deriveCheckpoint: (sessionPda: PublicKey, checkpointIndex: number, programId?: PublicKey) => PdaResult;
216
+ /**
217
+ * Derive the **Tool** PDA for an agent and tool name hash.
218
+ *
219
+ * Seeds: `["sap_tool", agent_pda, tool_name_hash]`
220
+ *
221
+ * @name deriveTool
222
+ * @description Computes the tool registration PDA scoped to an agent and tool identifier.
223
+ * @param agentPda - The owning agent’s PDA.
224
+ * @param toolNameHash - SHA-256 hash of the tool name (32 bytes).
225
+ * @param programId - Override program ID (defaults to {@link SAP_PROGRAM_ID}).
226
+ * @returns {PdaResult} `[pda, bump]` tuple.
227
+ * @category PDA
228
+ * @since v0.1.0
229
+ * @see ToolAccount
230
+ */
231
+ export declare const deriveTool: (agentPda: PublicKey, toolNameHash: Uint8Array, programId?: PublicKey) => PdaResult;
232
+ /**
233
+ * Derive the **Escrow** PDA for an agent–depositor pair.
234
+ *
235
+ * Seeds: `["sap_escrow", agent_pda, depositor_wallet]`
236
+ *
237
+ * @name deriveEscrow
238
+ * @description Computes the escrow PDA holding deposited funds for service payments.
239
+ * @param agentPda - The service-providing agent’s PDA.
240
+ * @param depositor - The depositor’s wallet `PublicKey`.
241
+ * @param programId - Override program ID (defaults to {@link SAP_PROGRAM_ID}).
242
+ * @returns {PdaResult} `[pda, bump]` tuple.
243
+ * @category PDA
244
+ * @since v0.1.0
245
+ * @see EscrowAccount
246
+ */
247
+ export declare const deriveEscrow: (agentPda: PublicKey, depositor: PublicKey, programId?: PublicKey) => PdaResult;
248
+ /**
249
+ * Derive the **Attestation** PDA for an attester on a specific agent.
250
+ *
251
+ * Seeds: `["sap_attest", agent_pda, attester_wallet]`
252
+ *
253
+ * @name deriveAttestation
254
+ * @description Computes the attestation PDA recording a third-party’s trust assertion.
255
+ * @param agentPda - The attested agent’s PDA.
256
+ * @param attester - The attester’s wallet `PublicKey`.
257
+ * @param programId - Override program ID (defaults to {@link SAP_PROGRAM_ID}).
258
+ * @returns {PdaResult} `[pda, bump]` tuple.
259
+ * @category PDA
260
+ * @since v0.1.0
261
+ * @see AttestationAccount
262
+ */
263
+ export declare const deriveAttestation: (agentPda: PublicKey, attester: PublicKey, programId?: PublicKey) => PdaResult;
264
+ /**
265
+ * Derive the **MemoryLedger** PDA for a session.
266
+ *
267
+ * Seeds: `["sap_ledger", session_pda]`
268
+ *
269
+ * @name deriveLedger
270
+ * @description Computes the ledger PDA that tracks append-only entries for a session.
271
+ * @param sessionPda - The parent session’s PDA.
272
+ * @param programId - Override program ID (defaults to {@link SAP_PROGRAM_ID}).
273
+ * @returns {PdaResult} `[pda, bump]` tuple.
274
+ * @category PDA
275
+ * @since v0.1.0
276
+ * @see MemoryLedger
277
+ */
278
+ export declare const deriveLedger: (sessionPda: PublicKey, programId?: PublicKey) => PdaResult;
279
+ /**
280
+ * Derive the **LedgerPage** PDA for a ledger at a given page index.
281
+ *
282
+ * Seeds: `["sap_page", ledger_pda, page_index_u32_le]`
283
+ *
284
+ * @name deriveLedgerPage
285
+ * @description Computes the ledger page PDA for paginated ledger data storage.
286
+ * @param ledgerPda - The parent ledger’s PDA.
287
+ * @param pageIndex - Zero-based page index.
288
+ * @param programId - Override program ID (defaults to {@link SAP_PROGRAM_ID}).
289
+ * @returns {PdaResult} `[pda, bump]` tuple.
290
+ * @category PDA
291
+ * @since v0.1.0
292
+ * @see LedgerPage
293
+ */
294
+ export declare const deriveLedgerPage: (ledgerPda: PublicKey, pageIndex: number, programId?: PublicKey) => PdaResult;
295
+ export {};
296
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/pda/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG5C;;;;;;;;GAQG;AACH,KAAK,SAAS,GAAG,SAAS,CAAC,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AAoDzD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,oBAAoB,GAC/B,qBAA0B,KACzB,SAC4C,CAAC;AAEhD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,WAAW,GACtB,QAAQ,SAAS,EACjB,qBAA0B,KACzB,SAC8D,CAAC;AAElE;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,gBAAgB,GAC3B,UAAU,SAAS,EACnB,qBAA0B,KACzB,SACgE,CAAC;AAMpE;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,cAAc,GACzB,UAAU,SAAS,EACnB,UAAU,SAAS,EACnB,qBAA0B,KACzB,SAIA,CAAC;AAMJ;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,qBAAqB,GAChC,gBAAgB,UAAU,EAC1B,qBAA0B,KACzB,SAIA,CAAC;AAEJ;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,mBAAmB,GAC9B,cAAc,UAAU,EACxB,qBAA0B,KACzB,SAIA,CAAC;AAEJ;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,uBAAuB,GAClC,UAAU,MAAM,EAChB,qBAA0B,KACzB,SAIA,CAAC;AAMJ;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,WAAW,GACtB,UAAU,SAAS,EACnB,qBAA0B,KACzB,SACgE,CAAC;AAEpE;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,aAAa,GACxB,UAAU,SAAS,EACnB,aAAa,UAAU,EACvB,qBAA0B,KACzB,SAQA,CAAC;AAEJ;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,eAAe,GAC1B,YAAY,SAAS,EACrB,YAAY,MAAM,EAClB,qBAA0B,KACzB,SAIA,CAAC;AAEJ;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,mBAAmB,GAC9B,UAAU,SAAS,EACnB,UAAU,SAAS,EACnB,qBAA0B,KACzB,SAIA,CAAC;AAEJ;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,gBAAgB,GAC3B,YAAY,SAAS,EACrB,iBAAiB,MAAM,EACvB,qBAA0B,KACzB,SAQA,CAAC;AAMJ;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,UAAU,GACrB,UAAU,SAAS,EACnB,cAAc,UAAU,EACxB,qBAA0B,KACzB,SAIA,CAAC;AAMJ;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,YAAY,GACvB,UAAU,SAAS,EACnB,WAAW,SAAS,EACpB,qBAA0B,KACzB,SAIA,CAAC;AAMJ;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,iBAAiB,GAC5B,UAAU,SAAS,EACnB,UAAU,SAAS,EACnB,qBAA0B,KACzB,SAIA,CAAC;AAMJ;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,YAAY,GACvB,YAAY,SAAS,EACrB,qBAA0B,KACzB,SACmE,CAAC;AAEvE;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,gBAAgB,GAC3B,WAAW,SAAS,EACpB,WAAW,MAAM,EACjB,qBAA0B,KACzB,SAIA,CAAC"}
@@ -0,0 +1,171 @@
1
+ /**
2
+ * @module plugin
3
+ * @description SynapsePlugin adapter for SAP v2.
4
+ *
5
+ * Exposes 52 tools across 8 on-chain protocol domains as a drop-in
6
+ * `SynapsePlugin` for `SynapseAgentKit`:
7
+ *
8
+ * ```ts
9
+ * import { SynapseAgentKit } from '@oobe-protocol-labs/synapse-client-sdk/ai/plugins';
10
+ * import { createSAPPlugin } from '@synapse-sap/sdk/plugin';
11
+ *
12
+ * const sapPlugin = createSAPPlugin({ provider });
13
+ * const kit = new SynapseAgentKit({ rpcUrl })
14
+ * .use(sapPlugin);
15
+ *
16
+ * const tools = kit.getTools(); // → StructuredTool[] (LangChain)
17
+ * ```
18
+ *
19
+ * Architecture:
20
+ * 1. Schemas (Zod) → runtime validation + LLM-friendly descriptions
21
+ * 2. Protocols → 8 domain method registries (agent, feedback, …)
22
+ * 3. Executor → dispatches tool calls to SapClient module methods
23
+ * 4. Serialization → PublicKey↔string, BN↔string bridging
24
+ *
25
+ * @category Plugin
26
+ * @since v0.1.0
27
+ */
28
+ import { type AnchorProvider } from "@coral-xyz/anchor";
29
+ import { PublicKey } from "@solana/web3.js";
30
+ import { type PluginProtocol, type ProtocolMethod } from "./protocols";
31
+ /**
32
+ * Plugin metadata exposed via {@link SynapsePlugin.meta}.
33
+ *
34
+ * @interface PluginMeta
35
+ * @name PluginMeta
36
+ * @description Describes a SynapsePlugin’s identity, version, and
37
+ * discovery tags for the SynapseAgentKit plugin registry.
38
+ * @category Plugin
39
+ * @since v0.1.0
40
+ */
41
+ export interface PluginMeta {
42
+ readonly id: string;
43
+ readonly name: string;
44
+ readonly version: string;
45
+ readonly description: string;
46
+ readonly tags: readonly string[];
47
+ }
48
+ /**
49
+ * Context injected by SynapseAgentKit during `install()`.
50
+ *
51
+ * @interface PluginContext
52
+ * @name PluginContext
53
+ * @description Provides the RPC transport and original AgentKit configuration
54
+ * to the plugin at installation time.
55
+ * @category Plugin
56
+ * @since v0.1.0
57
+ */
58
+ export interface PluginContext {
59
+ /** The SynapseClient providing RPC transport. */
60
+ readonly client: {
61
+ readonly transport: unknown;
62
+ };
63
+ /** Original AgentKitConfig. */
64
+ readonly config: Record<string, unknown>;
65
+ }
66
+ /**
67
+ * Result of `install()` containing the tool executor and optional teardown.
68
+ *
69
+ * @interface PluginInstallResult
70
+ * @name PluginInstallResult
71
+ * @description Returned by {@link SynapsePlugin.install}. The `executor`
72
+ * dispatches incoming tool calls to the correct SapClient module method.
73
+ * The optional `teardown` callback is invoked on `kit.destroy()`.
74
+ * @category Plugin
75
+ * @since v0.1.0
76
+ */
77
+ export interface PluginInstallResult {
78
+ /** Main executor dispatching method calls. */
79
+ executor: (method: ProtocolMethod, input: unknown) => Promise<unknown>;
80
+ /** Optional teardown for cleanup on `kit.destroy()`. */
81
+ teardown?: () => Promise<void>;
82
+ }
83
+ /**
84
+ * The SynapsePlugin interface (duck-typed for zero external deps).
85
+ *
86
+ * @interface SynapsePlugin
87
+ * @name SynapsePlugin
88
+ * @description Core contract for SynapseAgentKit plugins. Provides metadata,
89
+ * protocol definitions, and an `install()` entry point that yields
90
+ * a tool executor.
91
+ * @category Plugin
92
+ * @since v0.1.0
93
+ */
94
+ export interface SynapsePlugin {
95
+ readonly meta: PluginMeta;
96
+ readonly protocols: readonly PluginProtocol[];
97
+ install(context: PluginContext): PluginInstallResult;
98
+ }
99
+ /**
100
+ * Configuration for the SAP plugin.
101
+ *
102
+ * @interface SAPPluginConfig
103
+ * @name SAPPluginConfig
104
+ * @description Options passed to {@link createSAPPlugin} to instantiate
105
+ * the SAP v2 plugin with an Anchor provider and optional program ID override.
106
+ * @category Plugin
107
+ * @since v0.1.0
108
+ */
109
+ export interface SAPPluginConfig {
110
+ /**
111
+ * Anchor provider with wallet signer.
112
+ * Required for all write operations (transactions).
113
+ */
114
+ readonly provider: AnchorProvider;
115
+ /**
116
+ * Override the SAP program ID.
117
+ * Defaults to the canonical program ID from constants.
118
+ */
119
+ readonly programId?: PublicKey;
120
+ }
121
+ /**
122
+ * Create a SynapsePlugin for SAP v2.
123
+ *
124
+ * @name createSAPPlugin
125
+ * @description Factory function that returns a fully configured
126
+ * {@link SynapsePlugin} exposing 52 tools across 8 on-chain
127
+ * protocol domains. The plugin can be installed into a
128
+ * `SynapseAgentKit` instance or used standalone.
129
+ * @param config - Plugin configuration with Anchor provider and optional program ID
130
+ * @returns A configured {@link SynapsePlugin} instance
131
+ * @category Plugin
132
+ * @since v0.1.0
133
+ *
134
+ * @example
135
+ * ```ts
136
+ * import { createSAPPlugin } from '@synapse-sap/sdk/plugin';
137
+ *
138
+ * const sapPlugin = createSAPPlugin({ provider });
139
+ *
140
+ * // Use with SynapseAgentKit:
141
+ * kit.use(sapPlugin);
142
+ *
143
+ * // Or standalone:
144
+ * const executor = sapPlugin.install({ client, config: {} }).executor;
145
+ * await executor(someMethod, someInput);
146
+ * ```
147
+ */
148
+ export declare function createSAPPlugin(config: SAPPluginConfig): SynapsePlugin;
149
+ /**
150
+ * Pre-built plugin object for static use patterns.
151
+ *
152
+ * @name SAPPlugin
153
+ * @description Convenience namespace exposing a `configure` method
154
+ * that delegates to {@link createSAPPlugin}. Useful for concise
155
+ * one-liner instantiation.
156
+ * @category Plugin
157
+ * @since v0.1.0
158
+ *
159
+ * @example
160
+ * ```ts
161
+ * import { SAPPlugin } from '@synapse-sap/sdk/plugin';
162
+ *
163
+ * const plugin = SAPPlugin.configure({ provider });
164
+ * kit.use(plugin);
165
+ * ```
166
+ */
167
+ export declare const SAPPlugin: {
168
+ /** Create a configured SynapsePlugin from an AnchorProvider. */
169
+ readonly configure: typeof createSAPPlugin;
170
+ };
171
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugin/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG5C,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,cAAc,EACpB,MAAM,aAAa,CAAC;AAqBrB;;;;;;;;;GASG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;CAClC;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,aAAa;IAC5B,iDAAiD;IACjD,QAAQ,CAAC,MAAM,EAAE;QACf,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;KAC7B,CAAC;IACF,+BAA+B;IAC/B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC1C;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,mBAAmB;IAClC,8CAA8C;IAC9C,QAAQ,EAAE,CAAC,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACvE,wDAAwD;IACxD,QAAQ,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAChC;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,SAAS,cAAc,EAAE,CAAC;IAC9C,OAAO,CAAC,OAAO,EAAE,aAAa,GAAG,mBAAmB,CAAC;CACtD;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAElC;;;OAGG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC;CAChC;AAw8BD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,eAAe,GAAG,aAAa,CAgCtE;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,SAAS;IACpB,gEAAgE;;CAExD,CAAC"}
@@ -0,0 +1,152 @@
1
+ /**
2
+ * @module plugin/protocols
3
+ * @description Protocol definitions + method registries for the SAP v2 plugin.
4
+ *
5
+ * Each protocol maps 1:1 to a SAP SDK domain module.
6
+ * Methods carry Zod-typed input/output + LLM-friendly descriptions.
7
+ *
8
+ * Follows the `SynapsePlugin.protocols` contract exactly.
9
+ *
10
+ * @category Plugin
11
+ * @since v0.1.0
12
+ */
13
+ import type { z } from "zod";
14
+ /**
15
+ * A single tool method exposed by a protocol.
16
+ *
17
+ * @interface ProtocolMethod
18
+ * @name ProtocolMethod
19
+ * @description Defines a callable tool within a SAP protocol domain,
20
+ * including its name, LLM-friendly description, Zod input/output schemas,
21
+ * and parent protocol identifier.
22
+ * @category Plugin
23
+ * @since v0.1.0
24
+ */
25
+ export interface ProtocolMethod {
26
+ readonly name: string;
27
+ readonly description: string;
28
+ readonly input: z.ZodTypeAny;
29
+ readonly output: z.ZodTypeAny;
30
+ readonly protocol: string;
31
+ }
32
+ /**
33
+ * A protocol group containing typed methods.
34
+ *
35
+ * @interface PluginProtocol
36
+ * @name PluginProtocol
37
+ * @description Groups related tool methods under a named protocol domain
38
+ * (e.g. `"sap-agent"`, `"sap-escrow"`). Each protocol maps 1:1 to a
39
+ * SapClient domain module.
40
+ * @category Plugin
41
+ * @since v0.1.0
42
+ */
43
+ export interface PluginProtocol {
44
+ readonly id: string;
45
+ readonly name: string;
46
+ readonly methods: ProtocolMethod[];
47
+ readonly requiresClient: boolean;
48
+ }
49
+ /**
50
+ * SAP Agent Identity protocol — 8 tools for on-chain agent registration,
51
+ * updates, activation lifecycle, call reporting, and reputation metrics.
52
+ *
53
+ * @name sapAgentProtocol
54
+ * @description Covers `registerAgent`, `updateAgent`, `deactivateAgent`,
55
+ * `reactivateAgent`, `reportCalls`, `updateReputation`, `fetchAgent`,
56
+ * and `fetchGlobalRegistry`.
57
+ * @category Plugin
58
+ * @since v0.1.0
59
+ */
60
+ export declare const sapAgentProtocol: PluginProtocol;
61
+ /**
62
+ * SAP Trustless Reputation protocol — 4 tools for on-chain feedback
63
+ * (give, update, revoke, fetch) tied to agent identity PDAs.
64
+ *
65
+ * @name sapFeedbackProtocol
66
+ * @description Covers `giveFeedback`, `updateFeedback`, `revokeFeedback`,
67
+ * and `fetchFeedback`.
68
+ * @category Plugin
69
+ * @since v0.1.0
70
+ */
71
+ export declare const sapFeedbackProtocol: PluginProtocol;
72
+ /**
73
+ * SAP Web of Trust protocol — 3 tools for creating, revoking, and
74
+ * fetching on-chain attestations between agents.
75
+ *
76
+ * @name sapAttestationProtocol
77
+ * @description Covers `createAttestation`, `revokeAttestation`,
78
+ * and `fetchAttestation`.
79
+ * @category Plugin
80
+ * @since v0.1.0
81
+ */
82
+ export declare const sapAttestationProtocol: PluginProtocol;
83
+ /**
84
+ * SAP x402 Escrow protocol — 6 tools for creating, depositing into,
85
+ * settling, withdrawing from, batch-settling, and fetching escrow accounts.
86
+ *
87
+ * @name sapEscrowProtocol
88
+ * @description Covers `createEscrow`, `depositEscrow`, `settleEscrow`,
89
+ * `withdrawEscrow`, `batchSettle`, and `fetchEscrow`.
90
+ * @category Plugin
91
+ * @since v0.1.0
92
+ */
93
+ export declare const sapEscrowProtocol: PluginProtocol;
94
+ /**
95
+ * SAP Tool Registry protocol — 7 tools for publishing, updating,
96
+ * deactivating/reactivating tool descriptors and reporting invocations.
97
+ *
98
+ * @name sapToolsProtocol
99
+ * @description Covers `publishToolByName`, `inscribeToolSchema`, `updateTool`,
100
+ * `deactivateTool`, `reactivateTool`, `reportInvocations`, and `fetchTool`.
101
+ * @category Plugin
102
+ * @since v0.1.0
103
+ */
104
+ export declare const sapToolsProtocol: PluginProtocol;
105
+ /**
106
+ * SAP Encrypted Memory Vault protocol — 10 tools for vault lifecycle,
107
+ * session management, encrypted memory inscription, nonce rotation,
108
+ * and delegate authorization.
109
+ *
110
+ * @name sapVaultProtocol
111
+ * @description Covers `initVault`, `openSession`, `inscribeMemory`,
112
+ * `closeSession`, `closeVault`, `rotateNonce`, `addDelegate`,
113
+ * `revokeDelegate`, `fetchVault`, and `fetchSession`.
114
+ * @category Plugin
115
+ * @since v0.1.0
116
+ */
117
+ export declare const sapVaultProtocol: PluginProtocol;
118
+ /**
119
+ * SAP Discovery Indexes protocol — 8 tools for creating and managing
120
+ * capability and protocol indexes used for agent discovery.
121
+ *
122
+ * @name sapIndexingProtocol
123
+ * @description Covers `initCapabilityIndex`, `addToCapabilityIndex`,
124
+ * `removeFromCapabilityIndex`, `initProtocolIndex`, `addToProtocolIndex`,
125
+ * `removeFromProtocolIndex`, `fetchCapabilityIndex`, and `fetchProtocolIndex`.
126
+ * @category Plugin
127
+ * @since v0.1.0
128
+ */
129
+ export declare const sapIndexingProtocol: PluginProtocol;
130
+ /**
131
+ * SAP Unified Memory Ledger protocol — 6 tools for initializing,
132
+ * writing to, sealing, closing, and fetching ring-buffer ledgers
133
+ * and their sealed archive pages.
134
+ *
135
+ * @name sapLedgerProtocol
136
+ * @description Covers `initLedger`, `writeLedger`, `sealLedger`,
137
+ * `closeLedger`, `fetchLedger`, and `fetchLedgerPage`.
138
+ * @category Plugin
139
+ * @since v0.1.0
140
+ */
141
+ export declare const sapLedgerProtocol: PluginProtocol;
142
+ /**
143
+ * Ordered array of all 8 SAP v2 plugin protocols.
144
+ *
145
+ * @name SAP_PROTOCOLS
146
+ * @description Contains agent, feedback, attestation, escrow, tools,
147
+ * vault, indexing, and ledger protocols (52 tools total).
148
+ * @category Plugin
149
+ * @since v0.1.0
150
+ */
151
+ export declare const SAP_PROTOCOLS: readonly PluginProtocol[];
152
+ //# sourceMappingURL=protocols.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocols.d.ts","sourceRoot":"","sources":["../../../src/plugin/protocols.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAiBH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B;;;;;;;;;;GAUG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC,UAAU,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,UAAU,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,cAAc,EAAE,CAAC;IACnC,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;CAClC;AAwCD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,gBAAgB,EAAE,cAoB9B,CAAC;AAMF;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB,EAAE,cAcjC,CAAC;AAMF;;;;;;;;;GASG;AACH,eAAO,MAAM,sBAAsB,EAAE,cAYpC,CAAC;AAMF;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,EAAE,cAkB/B,CAAC;AAMF;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB,EAAE,cAkB9B,CAAC;AAMF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,gBAAgB,EAAE,cAyB9B,CAAC;AAMF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,mBAAmB,EAAE,cAsBjC,CAAC;AAMF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,iBAAiB,EAAE,cAkB/B,CAAC;AAMF;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa,EAAE,SAAS,cAAc,EASzC,CAAC"}