@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,831 @@
1
+ "use strict";
2
+ /**
3
+ * @module plugin/schemas
4
+ * @description Zod schemas for every SAP v2 plugin tool.
5
+ *
6
+ * Each schema is an `{ input, output }` pair that drives:
7
+ * 1. Runtime validation (LLM → tool call)
8
+ * 2. LangChain StructuredTool generation
9
+ * 3. MCP/Vercel AI tool descriptors
10
+ *
11
+ * Conventions:
12
+ * - Solana public keys → `z.string().describe('Base58 public key …')`
13
+ * - BN/bigint amounts → `z.string().describe('Amount in lamports …')`
14
+ * - Hashes ([u8;32]) → `z.array(z.number()).length(32)`
15
+ * - Tool outputs always include `txSignature` for write ops
16
+ *
17
+ * @category Plugin
18
+ * @since v0.1.0
19
+ */
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.ledgerSchemas = exports.indexingSchemas = exports.vaultSchemas = exports.toolsSchemas = exports.escrowSchemas = exports.attestationSchemas = exports.feedbackSchemas = exports.agentSchemas = void 0;
22
+ const zod_1 = require("zod");
23
+ // ═══════════════════════════════════════════════════════════════════
24
+ // Shared Primitives
25
+ // ═══════════════════════════════════════════════════════════════════
26
+ /** Base58-encoded Solana public key (32–44 chars). */
27
+ const pubkey = zod_1.z
28
+ .string()
29
+ .min(32)
30
+ .max(44)
31
+ .describe("Solana public key (base58)");
32
+ /** Base58-encoded transaction signature. */
33
+ const txSig = zod_1.z.string().describe("Transaction signature (base58)");
34
+ /** 32-byte SHA-256 hash represented as a fixed-length integer array. */
35
+ const hash32 = zod_1.z.array(zod_1.z.number().int().min(0).max(255)).length(32);
36
+ /** Token amount in the smallest unit, serialized as a string for BN safety. */
37
+ const lamports = zod_1.z.string().describe("Amount in smallest token unit (string)");
38
+ /** Optional public key (nullable). */
39
+ const optPubkey = pubkey.nullish();
40
+ /** Standard write-operation output containing the transaction signature. */
41
+ const writeOutput = zod_1.z.object({ txSignature: txSig });
42
+ // ═══════════════════════════════════════════════════════════════════
43
+ // Nested Sub-schemas
44
+ // ═══════════════════════════════════════════════════════════════════
45
+ /** Reusable schema for an agent capability entry. */
46
+ const capabilitySchema = zod_1.z.object({
47
+ id: zod_1.z.string().describe("Capability identifier (e.g. 'jupiter:swap')"),
48
+ description: zod_1.z.string().nullish().describe("Human-readable description"),
49
+ protocolId: zod_1.z.string().nullish().describe("Protocol namespace"),
50
+ version: zod_1.z.string().nullish().describe("Semver version"),
51
+ });
52
+ /** Reusable schema for a volume curve breakpoint (tiered pricing). */
53
+ const volumeBreakpointSchema = zod_1.z.object({
54
+ afterCalls: zod_1.z.number().int().describe("Call threshold for this tier"),
55
+ pricePerCall: lamports.describe("Price per call after threshold"),
56
+ });
57
+ /** Reusable schema for a pricing tier with token, settlement, and volume curve config. */
58
+ const pricingTierSchema = zod_1.z.object({
59
+ tierId: zod_1.z.string().describe("Pricing tier ID (e.g. 'standard')"),
60
+ pricePerCall: lamports,
61
+ minPricePerCall: lamports.nullish().describe("Price floor"),
62
+ maxPricePerCall: lamports.nullish().describe("Price ceiling"),
63
+ rateLimit: zod_1.z.number().int().describe("Calls per second"),
64
+ maxCallsPerSession: zod_1.z.number().int().describe("0 = unlimited"),
65
+ burstLimit: zod_1.z.number().int().nullish(),
66
+ tokenType: zod_1.z
67
+ .enum(["sol", "usdc", "spl"])
68
+ .describe("Payment token type"),
69
+ tokenMint: optPubkey.describe("SPL token mint address (when tokenType=spl)"),
70
+ tokenDecimals: zod_1.z.number().int().nullish(),
71
+ settlementMode: zod_1.z
72
+ .enum(["instant", "escrow", "batched", "x402"])
73
+ .nullish()
74
+ .describe("Settlement mode"),
75
+ minEscrowDeposit: lamports.nullish(),
76
+ batchIntervalSec: zod_1.z.number().int().nullish(),
77
+ volumeCurve: zod_1.z.array(volumeBreakpointSchema).nullish(),
78
+ });
79
+ /** Reusable schema for a settlement entry (calls + service hash). */
80
+ const settlementSchema = zod_1.z.object({
81
+ callsToSettle: zod_1.z.string().describe("Number of calls to settle"),
82
+ serviceHash: hash32.describe("SHA-256 hash of the service rendered"),
83
+ });
84
+ // ═══════════════════════════════════════════════════════════════════
85
+ // Agent Schemas
86
+ // ═══════════════════════════════════════════════════════════════════
87
+ /**
88
+ * Zod input/output schemas for the **sap-agent** protocol (8 tools).
89
+ *
90
+ * @name agentSchemas
91
+ * @description Covers agent registration, updates, activation lifecycle,
92
+ * call reporting, reputation metrics, and on-chain data fetching.
93
+ * @category Plugin
94
+ * @since v0.1.0
95
+ */
96
+ exports.agentSchemas = {
97
+ registerAgent: {
98
+ input: zod_1.z.object({
99
+ name: zod_1.z.string().max(64).describe("Agent display name (max 64 chars)"),
100
+ description: zod_1.z
101
+ .string()
102
+ .max(512)
103
+ .describe("Agent description (max 512 chars)"),
104
+ capabilities: zod_1.z
105
+ .array(capabilitySchema)
106
+ .describe("List of capabilities this agent offers"),
107
+ pricing: zod_1.z
108
+ .array(pricingTierSchema)
109
+ .describe("Pricing tiers for agent services"),
110
+ protocols: zod_1.z
111
+ .array(zod_1.z.string())
112
+ .describe("Protocol IDs this agent supports"),
113
+ agentId: zod_1.z.string().nullish().describe("Optional DID-style agent ID"),
114
+ agentUri: zod_1.z
115
+ .string()
116
+ .url()
117
+ .nullish()
118
+ .describe("Optional agent metadata URI"),
119
+ x402Endpoint: zod_1.z
120
+ .string()
121
+ .url()
122
+ .nullish()
123
+ .describe("x402 payment endpoint URL"),
124
+ }),
125
+ output: writeOutput,
126
+ },
127
+ updateAgent: {
128
+ input: zod_1.z.object({
129
+ name: zod_1.z.string().max(64).nullish(),
130
+ description: zod_1.z.string().max(512).nullish(),
131
+ capabilities: zod_1.z.array(capabilitySchema).nullish(),
132
+ pricing: zod_1.z.array(pricingTierSchema).nullish(),
133
+ protocols: zod_1.z.array(zod_1.z.string()).nullish(),
134
+ agentId: zod_1.z.string().nullish(),
135
+ agentUri: zod_1.z.string().url().nullish(),
136
+ x402Endpoint: zod_1.z.string().url().nullish(),
137
+ }),
138
+ output: writeOutput,
139
+ },
140
+ deactivateAgent: {
141
+ input: zod_1.z.object({}),
142
+ output: writeOutput,
143
+ },
144
+ reactivateAgent: {
145
+ input: zod_1.z.object({}),
146
+ output: writeOutput,
147
+ },
148
+ reportCalls: {
149
+ input: zod_1.z.object({
150
+ callsServed: zod_1.z.number().int().positive().describe("Number of calls served"),
151
+ }),
152
+ output: writeOutput,
153
+ },
154
+ updateReputation: {
155
+ input: zod_1.z.object({
156
+ avgLatencyMs: zod_1.z.number().int().min(0).describe("Average latency in ms"),
157
+ uptimePercent: zod_1.z
158
+ .number()
159
+ .int()
160
+ .min(0)
161
+ .max(100)
162
+ .describe("Uptime percentage (0-100)"),
163
+ }),
164
+ output: writeOutput,
165
+ },
166
+ fetchAgent: {
167
+ input: zod_1.z.object({
168
+ wallet: pubkey.nullish().describe("Agent wallet (defaults to caller)"),
169
+ }),
170
+ output: zod_1.z.object({
171
+ name: zod_1.z.string(),
172
+ description: zod_1.z.string(),
173
+ isActive: zod_1.z.boolean(),
174
+ reputationScore: zod_1.z.number(),
175
+ totalCallsServed: zod_1.z.string(),
176
+ totalFeedbacks: zod_1.z.number(),
177
+ avgLatencyMs: zod_1.z.number(),
178
+ uptimePercent: zod_1.z.number(),
179
+ wallet: pubkey,
180
+ agentId: zod_1.z.string().nullish(),
181
+ x402Endpoint: zod_1.z.string().nullish(),
182
+ capabilities: zod_1.z.array(capabilitySchema),
183
+ pricing: zod_1.z.array(pricingTierSchema),
184
+ protocols: zod_1.z.array(zod_1.z.string()),
185
+ }),
186
+ },
187
+ fetchGlobalRegistry: {
188
+ input: zod_1.z.object({}),
189
+ output: zod_1.z.object({
190
+ totalAgents: zod_1.z.string(),
191
+ activeAgents: zod_1.z.string(),
192
+ totalFeedbacks: zod_1.z.string(),
193
+ totalCapabilities: zod_1.z.number(),
194
+ totalProtocols: zod_1.z.number(),
195
+ totalTools: zod_1.z.number(),
196
+ totalVaults: zod_1.z.number(),
197
+ totalEscrows: zod_1.z.number(),
198
+ totalAttestations: zod_1.z.number(),
199
+ authority: pubkey,
200
+ }),
201
+ },
202
+ };
203
+ // ═══════════════════════════════════════════════════════════════════
204
+ // Feedback Schemas
205
+ // ═══════════════════════════════════════════════════════════════════
206
+ /**
207
+ * Zod input/output schemas for the **sap-feedback** protocol (4 tools).
208
+ *
209
+ * @name feedbackSchemas
210
+ * @description Covers giving, updating, revoking, and fetching on-chain
211
+ * feedback entries tied to agent identity PDAs.
212
+ * @category Plugin
213
+ * @since v0.1.0
214
+ */
215
+ exports.feedbackSchemas = {
216
+ giveFeedback: {
217
+ input: zod_1.z.object({
218
+ agentWallet: pubkey.describe("Wallet of the agent to review"),
219
+ score: zod_1.z
220
+ .number()
221
+ .int()
222
+ .min(1)
223
+ .max(5)
224
+ .describe("Feedback score (1-5)"),
225
+ tag: zod_1.z
226
+ .string()
227
+ .max(32)
228
+ .describe("Short tag (e.g. 'reliable', 'fast', 'accurate')"),
229
+ commentHash: hash32
230
+ .nullish()
231
+ .describe("Optional SHA-256 hash of off-chain comment"),
232
+ }),
233
+ output: writeOutput,
234
+ },
235
+ updateFeedback: {
236
+ input: zod_1.z.object({
237
+ agentWallet: pubkey.describe("Wallet of the reviewed agent"),
238
+ newScore: zod_1.z.number().int().min(1).max(5).describe("Updated score (1-5)"),
239
+ newTag: zod_1.z.string().max(32).nullish().describe("Updated tag"),
240
+ commentHash: hash32.nullish(),
241
+ }),
242
+ output: writeOutput,
243
+ },
244
+ revokeFeedback: {
245
+ input: zod_1.z.object({
246
+ agentWallet: pubkey.describe("Wallet of the reviewed agent"),
247
+ }),
248
+ output: writeOutput,
249
+ },
250
+ fetchFeedback: {
251
+ input: zod_1.z.object({
252
+ agentWallet: pubkey.describe("Wallet of the reviewed agent"),
253
+ reviewer: pubkey.nullish().describe("Reviewer wallet (defaults to caller)"),
254
+ }),
255
+ output: zod_1.z.object({
256
+ agent: pubkey,
257
+ reviewer: pubkey,
258
+ score: zod_1.z.number(),
259
+ tag: zod_1.z.string(),
260
+ isRevoked: zod_1.z.boolean(),
261
+ createdAt: zod_1.z.string(),
262
+ updatedAt: zod_1.z.string(),
263
+ }),
264
+ },
265
+ };
266
+ // ═══════════════════════════════════════════════════════════════════
267
+ // Attestation Schemas
268
+ // ═══════════════════════════════════════════════════════════════════
269
+ /**
270
+ * Zod input/output schemas for the **sap-attestation** protocol (3 tools).
271
+ *
272
+ * @name attestationSchemas
273
+ * @description Covers creating, revoking, and fetching on-chain attestations
274
+ * between agents in the SAP Web of Trust.
275
+ * @category Plugin
276
+ * @since v0.1.0
277
+ */
278
+ exports.attestationSchemas = {
279
+ createAttestation: {
280
+ input: zod_1.z.object({
281
+ agentWallet: pubkey.describe("Wallet of the agent to attest"),
282
+ attestationType: zod_1.z
283
+ .string()
284
+ .max(32)
285
+ .describe("Type of attestation (e.g. 'identity', 'capability', 'compliance')"),
286
+ metadataHash: hash32.describe("SHA-256 hash of attestation metadata"),
287
+ expiresAt: zod_1.z
288
+ .string()
289
+ .describe("Unix timestamp (seconds) when attestation expires"),
290
+ }),
291
+ output: writeOutput,
292
+ },
293
+ revokeAttestation: {
294
+ input: zod_1.z.object({
295
+ agentWallet: pubkey.describe("Wallet of the attested agent"),
296
+ }),
297
+ output: writeOutput,
298
+ },
299
+ fetchAttestation: {
300
+ input: zod_1.z.object({
301
+ agentWallet: pubkey.describe("Wallet of the attested agent"),
302
+ attester: pubkey
303
+ .nullish()
304
+ .describe("Attester wallet (defaults to caller)"),
305
+ }),
306
+ output: zod_1.z.object({
307
+ agent: pubkey,
308
+ attester: pubkey,
309
+ attestationType: zod_1.z.string(),
310
+ isActive: zod_1.z.boolean(),
311
+ expiresAt: zod_1.z.string(),
312
+ createdAt: zod_1.z.string(),
313
+ }),
314
+ },
315
+ };
316
+ // ═══════════════════════════════════════════════════════════════════
317
+ // Escrow Schemas
318
+ // ═══════════════════════════════════════════════════════════════════
319
+ /**
320
+ * Zod input/output schemas for the **sap-escrow** protocol (6 tools).
321
+ *
322
+ * @name escrowSchemas
323
+ * @description Covers escrow creation, deposits, settlement (single and batch),
324
+ * withdrawal, and account data fetching for x402 micropayments.
325
+ * @category Plugin
326
+ * @since v0.1.0
327
+ */
328
+ exports.escrowSchemas = {
329
+ createEscrow: {
330
+ input: zod_1.z.object({
331
+ agentWallet: pubkey.describe("Agent wallet to deposit escrow for"),
332
+ pricePerCall: lamports.describe("Base price per call"),
333
+ maxCalls: zod_1.z.string().describe("Maximum calls allowed"),
334
+ initialDeposit: lamports.describe("Initial deposit amount"),
335
+ expiresAt: zod_1.z.string().describe("Expiry timestamp (unix seconds)"),
336
+ volumeCurve: zod_1.z.array(volumeBreakpointSchema).default([]),
337
+ tokenMint: optPubkey.describe("SPL token mint (null = native SOL)"),
338
+ tokenDecimals: zod_1.z
339
+ .number()
340
+ .int()
341
+ .default(9)
342
+ .describe("Token decimals (9=SOL, 6=USDC)"),
343
+ }),
344
+ output: writeOutput,
345
+ },
346
+ depositEscrow: {
347
+ input: zod_1.z.object({
348
+ agentWallet: pubkey.describe("Agent wallet of the escrow"),
349
+ amount: lamports.describe("Additional deposit amount"),
350
+ }),
351
+ output: writeOutput,
352
+ },
353
+ settleEscrow: {
354
+ input: zod_1.z.object({
355
+ depositorWallet: pubkey.describe("Depositor (client) wallet"),
356
+ callsToSettle: zod_1.z.string().describe("Number of calls to settle"),
357
+ serviceHash: hash32.describe("SHA-256 hash of the service rendered"),
358
+ }),
359
+ output: writeOutput,
360
+ },
361
+ withdrawEscrow: {
362
+ input: zod_1.z.object({
363
+ agentWallet: pubkey.describe("Agent wallet of the escrow"),
364
+ amount: lamports.describe("Amount to withdraw"),
365
+ }),
366
+ output: writeOutput,
367
+ },
368
+ batchSettle: {
369
+ input: zod_1.z.object({
370
+ depositorWallet: pubkey.describe("Depositor (client) wallet"),
371
+ settlements: zod_1.z
372
+ .array(settlementSchema)
373
+ .min(1)
374
+ .max(10)
375
+ .describe("Up to 10 settlement entries"),
376
+ }),
377
+ output: writeOutput,
378
+ },
379
+ fetchEscrow: {
380
+ input: zod_1.z.object({
381
+ agentWallet: pubkey.describe("Agent wallet"),
382
+ depositor: pubkey.nullish().describe("Depositor wallet (defaults to caller)"),
383
+ }),
384
+ output: zod_1.z.object({
385
+ agent: pubkey,
386
+ depositor: pubkey,
387
+ agentWallet: pubkey,
388
+ balance: zod_1.z.string(),
389
+ totalDeposited: zod_1.z.string(),
390
+ totalSettled: zod_1.z.string(),
391
+ totalCallsSettled: zod_1.z.string(),
392
+ pricePerCall: zod_1.z.string(),
393
+ maxCalls: zod_1.z.string(),
394
+ expiresAt: zod_1.z.string(),
395
+ tokenDecimals: zod_1.z.number(),
396
+ tokenMint: zod_1.z.string().nullish(),
397
+ }),
398
+ },
399
+ };
400
+ // ═══════════════════════════════════════════════════════════════════
401
+ // Tools Schemas
402
+ // ═══════════════════════════════════════════════════════════════════
403
+ /**
404
+ * Zod input/output schemas for the **sap-tools** protocol (7 tools).
405
+ *
406
+ * @name toolsSchemas
407
+ * @description Covers tool publishing, schema inscription, updates,
408
+ * activation lifecycle, invocation reporting, and descriptor fetching.
409
+ * @category Plugin
410
+ * @since v0.1.0
411
+ */
412
+ exports.toolsSchemas = {
413
+ publishToolByName: {
414
+ input: zod_1.z.object({
415
+ toolName: zod_1.z.string().max(64).describe("Tool name (e.g. 'swap')"),
416
+ protocolId: zod_1.z.string().describe("Protocol ID (e.g. 'jupiter')"),
417
+ description: zod_1.z
418
+ .string()
419
+ .max(256)
420
+ .describe("Tool description for LLM consumption"),
421
+ inputSchema: zod_1.z
422
+ .string()
423
+ .describe("JSON schema string for tool input"),
424
+ outputSchema: zod_1.z
425
+ .string()
426
+ .describe("JSON schema string for tool output"),
427
+ httpMethod: zod_1.z
428
+ .enum(["get", "post", "put", "delete", "compound"])
429
+ .describe("HTTP method"),
430
+ category: zod_1.z
431
+ .enum([
432
+ "swap",
433
+ "lend",
434
+ "stake",
435
+ "nft",
436
+ "payment",
437
+ "data",
438
+ "governance",
439
+ "bridge",
440
+ "analytics",
441
+ "custom",
442
+ ])
443
+ .describe("Tool category for discovery"),
444
+ paramsCount: zod_1.z.number().int().describe("Total parameter count"),
445
+ requiredParams: zod_1.z.number().int().describe("Required parameter count"),
446
+ isCompound: zod_1.z
447
+ .boolean()
448
+ .default(false)
449
+ .describe("Whether tool chains multiple actions"),
450
+ }),
451
+ output: writeOutput,
452
+ },
453
+ inscribeToolSchema: {
454
+ input: zod_1.z.object({
455
+ toolName: zod_1.z.string().describe("Tool name"),
456
+ schemaType: zod_1.z
457
+ .enum(["input", "output", "description"])
458
+ .describe("Schema type to inscribe"),
459
+ schemaData: zod_1.z.string().describe("Schema content (JSON string)"),
460
+ compression: zod_1.z
461
+ .enum(["none", "deflate", "gzip", "brotli"])
462
+ .default("none")
463
+ .describe("Compression algorithm"),
464
+ }),
465
+ output: writeOutput,
466
+ },
467
+ updateTool: {
468
+ input: zod_1.z.object({
469
+ toolName: zod_1.z.string().describe("Tool name to update"),
470
+ httpMethod: zod_1.z
471
+ .enum(["get", "post", "put", "delete", "compound"])
472
+ .nullish(),
473
+ category: zod_1.z
474
+ .enum([
475
+ "swap",
476
+ "lend",
477
+ "stake",
478
+ "nft",
479
+ "payment",
480
+ "data",
481
+ "governance",
482
+ "bridge",
483
+ "analytics",
484
+ "custom",
485
+ ])
486
+ .nullish(),
487
+ paramsCount: zod_1.z.number().int().nullish(),
488
+ requiredParams: zod_1.z.number().int().nullish(),
489
+ }),
490
+ output: writeOutput,
491
+ },
492
+ deactivateTool: {
493
+ input: zod_1.z.object({
494
+ toolName: zod_1.z.string().describe("Tool name to deactivate"),
495
+ }),
496
+ output: writeOutput,
497
+ },
498
+ reactivateTool: {
499
+ input: zod_1.z.object({
500
+ toolName: zod_1.z.string().describe("Tool name to reactivate"),
501
+ }),
502
+ output: writeOutput,
503
+ },
504
+ reportInvocations: {
505
+ input: zod_1.z.object({
506
+ toolName: zod_1.z.string().describe("Tool name"),
507
+ invocations: zod_1.z
508
+ .number()
509
+ .int()
510
+ .positive()
511
+ .describe("Number of invocations to report"),
512
+ }),
513
+ output: writeOutput,
514
+ },
515
+ fetchTool: {
516
+ input: zod_1.z.object({
517
+ agentWallet: pubkey.describe("Agent wallet that published the tool"),
518
+ toolName: zod_1.z.string().describe("Tool name"),
519
+ }),
520
+ output: zod_1.z.object({
521
+ toolName: zod_1.z.string(),
522
+ version: zod_1.z.number(),
523
+ isActive: zod_1.z.boolean(),
524
+ totalInvocations: zod_1.z.string(),
525
+ paramsCount: zod_1.z.number(),
526
+ requiredParams: zod_1.z.number(),
527
+ isCompound: zod_1.z.boolean(),
528
+ agent: pubkey,
529
+ createdAt: zod_1.z.string(),
530
+ updatedAt: zod_1.z.string(),
531
+ }),
532
+ },
533
+ };
534
+ // ═══════════════════════════════════════════════════════════════════
535
+ // Vault Schemas
536
+ // ═══════════════════════════════════════════════════════════════════
537
+ /**
538
+ * Zod input/output schemas for the **sap-vault** protocol (10 tools).
539
+ *
540
+ * @name vaultSchemas
541
+ * @description Covers vault initialization, session management, encrypted
542
+ * memory inscription, nonce rotation, delegate authorization, and
543
+ * vault/session data fetching.
544
+ * @category Plugin
545
+ * @since v0.1.0
546
+ */
547
+ exports.vaultSchemas = {
548
+ initVault: {
549
+ input: zod_1.z.object({
550
+ vaultNonce: hash32.describe("32-byte encryption nonce for vault initialization"),
551
+ }),
552
+ output: writeOutput,
553
+ },
554
+ openSession: {
555
+ input: zod_1.z.object({
556
+ sessionHash: hash32.describe("32-byte session identifier hash"),
557
+ }),
558
+ output: writeOutput,
559
+ },
560
+ inscribeMemory: {
561
+ input: zod_1.z.object({
562
+ sessionHash: zod_1.z
563
+ .string()
564
+ .describe("Hex-encoded session hash for PDA derivation"),
565
+ sequence: zod_1.z.number().int().describe("Sequence number within session"),
566
+ encryptedData: zod_1.z
567
+ .string()
568
+ .describe("Hex-encoded encrypted payload"),
569
+ nonce: zod_1.z
570
+ .array(zod_1.z.number().int().min(0).max(255))
571
+ .length(12)
572
+ .describe("12-byte AES-GCM nonce"),
573
+ contentHash: hash32.describe("SHA-256 of plaintext content"),
574
+ totalFragments: zod_1.z
575
+ .number()
576
+ .int()
577
+ .min(1)
578
+ .default(1)
579
+ .describe("Total fragments (1 = single)"),
580
+ fragmentIndex: zod_1.z.number().int().default(0).describe("Fragment index"),
581
+ compression: zod_1.z
582
+ .number()
583
+ .int()
584
+ .default(0)
585
+ .describe("Compression type (0=none, 1=deflate, 2=gzip, 3=brotli)"),
586
+ epochIndex: zod_1.z.number().int().default(0).describe("Epoch page index"),
587
+ }),
588
+ output: writeOutput,
589
+ },
590
+ closeSession: {
591
+ input: zod_1.z.object({
592
+ sessionHash: zod_1.z
593
+ .string()
594
+ .describe("Hex-encoded session hash for PDA derivation"),
595
+ }),
596
+ output: writeOutput,
597
+ },
598
+ closeVault: {
599
+ input: zod_1.z.object({}),
600
+ output: writeOutput,
601
+ },
602
+ rotateNonce: {
603
+ input: zod_1.z.object({
604
+ newNonce: hash32.describe("New 32-byte encryption nonce"),
605
+ }),
606
+ output: writeOutput,
607
+ },
608
+ addDelegate: {
609
+ input: zod_1.z.object({
610
+ delegatePubkey: pubkey.describe("Wallet to authorize as delegate"),
611
+ permissions: zod_1.z
612
+ .number()
613
+ .int()
614
+ .min(1)
615
+ .max(7)
616
+ .describe("Permission bitmask (1=inscribe, 2=closeSession, 4=openSession, 7=all)"),
617
+ expiresAt: zod_1.z
618
+ .string()
619
+ .describe("Delegation expiry (unix timestamp seconds)"),
620
+ }),
621
+ output: writeOutput,
622
+ },
623
+ revokeDelegate: {
624
+ input: zod_1.z.object({
625
+ delegatePubkey: pubkey.describe("Delegate wallet to revoke"),
626
+ }),
627
+ output: writeOutput,
628
+ },
629
+ fetchVault: {
630
+ input: zod_1.z.object({
631
+ agentWallet: pubkey
632
+ .nullish()
633
+ .describe("Agent wallet (defaults to caller)"),
634
+ }),
635
+ output: zod_1.z.object({
636
+ agent: pubkey,
637
+ wallet: pubkey,
638
+ totalSessions: zod_1.z.number(),
639
+ totalInscriptions: zod_1.z.string(),
640
+ totalBytesInscribed: zod_1.z.string(),
641
+ protocolVersion: zod_1.z.number(),
642
+ nonceVersion: zod_1.z.number(),
643
+ createdAt: zod_1.z.string(),
644
+ }),
645
+ },
646
+ fetchSession: {
647
+ input: zod_1.z.object({
648
+ agentWallet: pubkey.describe("Agent wallet"),
649
+ sessionHash: zod_1.z
650
+ .string()
651
+ .describe("Hex-encoded session hash"),
652
+ }),
653
+ output: zod_1.z.object({
654
+ vault: pubkey,
655
+ sequenceCounter: zod_1.z.number(),
656
+ totalBytes: zod_1.z.string(),
657
+ currentEpoch: zod_1.z.number(),
658
+ totalEpochs: zod_1.z.number(),
659
+ isClosed: zod_1.z.boolean(),
660
+ createdAt: zod_1.z.string(),
661
+ lastInscribedAt: zod_1.z.string(),
662
+ }),
663
+ },
664
+ };
665
+ // ═══════════════════════════════════════════════════════════════════
666
+ // Indexing Schemas
667
+ // ═══════════════════════════════════════════════════════════════════
668
+ /**
669
+ * Zod input/output schemas for the **sap-indexing** protocol (8 tools).
670
+ *
671
+ * @name indexingSchemas
672
+ * @description Covers capability and protocol index creation, agent
673
+ * registration/removal within indexes, and index data fetching.
674
+ * @category Plugin
675
+ * @since v0.1.0
676
+ */
677
+ exports.indexingSchemas = {
678
+ initCapabilityIndex: {
679
+ input: zod_1.z.object({
680
+ capabilityId: zod_1.z
681
+ .string()
682
+ .describe("Capability ID to index (e.g. 'jupiter:swap')"),
683
+ }),
684
+ output: writeOutput,
685
+ },
686
+ addToCapabilityIndex: {
687
+ input: zod_1.z.object({
688
+ capabilityId: zod_1.z.string().describe("Capability ID"),
689
+ }),
690
+ output: writeOutput,
691
+ },
692
+ removeFromCapabilityIndex: {
693
+ input: zod_1.z.object({
694
+ capabilityId: zod_1.z.string().describe("Capability ID"),
695
+ }),
696
+ output: writeOutput,
697
+ },
698
+ initProtocolIndex: {
699
+ input: zod_1.z.object({
700
+ protocolId: zod_1.z
701
+ .string()
702
+ .describe("Protocol ID to index (e.g. 'jupiter')"),
703
+ }),
704
+ output: writeOutput,
705
+ },
706
+ addToProtocolIndex: {
707
+ input: zod_1.z.object({
708
+ protocolId: zod_1.z.string().describe("Protocol ID"),
709
+ }),
710
+ output: writeOutput,
711
+ },
712
+ removeFromProtocolIndex: {
713
+ input: zod_1.z.object({
714
+ protocolId: zod_1.z.string().describe("Protocol ID"),
715
+ }),
716
+ output: writeOutput,
717
+ },
718
+ fetchCapabilityIndex: {
719
+ input: zod_1.z.object({
720
+ capabilityId: zod_1.z.string().describe("Capability ID to look up"),
721
+ }),
722
+ output: zod_1.z.object({
723
+ capabilityId: zod_1.z.string(),
724
+ agents: zod_1.z.array(pubkey).describe("Agents registered for this capability"),
725
+ totalPages: zod_1.z.number(),
726
+ lastUpdated: zod_1.z.string(),
727
+ }),
728
+ },
729
+ fetchProtocolIndex: {
730
+ input: zod_1.z.object({
731
+ protocolId: zod_1.z.string().describe("Protocol ID to look up"),
732
+ }),
733
+ output: zod_1.z.object({
734
+ protocolId: zod_1.z.string(),
735
+ agents: zod_1.z.array(pubkey).describe("Agents registered for this protocol"),
736
+ totalPages: zod_1.z.number(),
737
+ lastUpdated: zod_1.z.string(),
738
+ }),
739
+ },
740
+ };
741
+ // ═══════════════════════════════════════════════════════════════════
742
+ // Ledger Schemas
743
+ // ═══════════════════════════════════════════════════════════════════
744
+ /**
745
+ * Zod input/output schemas for the **sap-ledger** protocol (6 tools).
746
+ *
747
+ * @name ledgerSchemas
748
+ * @description Covers ledger initialization, ring-buffer writes, sealing
749
+ * to permanent pages, ledger closure, and metadata/page fetching.
750
+ * @category Plugin
751
+ * @since v0.1.0
752
+ */
753
+ exports.ledgerSchemas = {
754
+ initLedger: {
755
+ input: zod_1.z.object({
756
+ sessionHash: zod_1.z
757
+ .string()
758
+ .describe("Hex-encoded session hash (the session must exist)"),
759
+ agentWallet: pubkey
760
+ .nullish()
761
+ .describe("Agent wallet (defaults to caller)"),
762
+ }),
763
+ output: writeOutput,
764
+ },
765
+ writeLedger: {
766
+ input: zod_1.z.object({
767
+ sessionHash: zod_1.z.string().describe("Hex-encoded session hash"),
768
+ agentWallet: pubkey
769
+ .nullish()
770
+ .describe("Agent wallet (defaults to caller)"),
771
+ data: zod_1.z
772
+ .string()
773
+ .describe("Hex-encoded data to write to ring buffer"),
774
+ contentHash: hash32.describe("SHA-256 of the plaintext data"),
775
+ }),
776
+ output: writeOutput,
777
+ },
778
+ sealLedger: {
779
+ input: zod_1.z.object({
780
+ sessionHash: zod_1.z.string().describe("Hex-encoded session hash"),
781
+ agentWallet: pubkey
782
+ .nullish()
783
+ .describe("Agent wallet (defaults to caller)"),
784
+ }),
785
+ output: writeOutput,
786
+ },
787
+ closeLedger: {
788
+ input: zod_1.z.object({
789
+ sessionHash: zod_1.z.string().describe("Hex-encoded session hash"),
790
+ agentWallet: pubkey
791
+ .nullish()
792
+ .describe("Agent wallet (defaults to caller)"),
793
+ }),
794
+ output: writeOutput,
795
+ },
796
+ fetchLedger: {
797
+ input: zod_1.z.object({
798
+ sessionHash: zod_1.z.string().describe("Hex-encoded session hash"),
799
+ agentWallet: pubkey
800
+ .nullish()
801
+ .describe("Agent wallet (defaults to caller)"),
802
+ }),
803
+ output: zod_1.z.object({
804
+ session: pubkey,
805
+ authority: pubkey,
806
+ numEntries: zod_1.z.number(),
807
+ totalDataSize: zod_1.z.string(),
808
+ numPages: zod_1.z.number(),
809
+ createdAt: zod_1.z.string(),
810
+ updatedAt: zod_1.z.string(),
811
+ }),
812
+ },
813
+ fetchLedgerPage: {
814
+ input: zod_1.z.object({
815
+ sessionHash: zod_1.z.string().describe("Hex-encoded session hash"),
816
+ agentWallet: pubkey
817
+ .nullish()
818
+ .describe("Agent wallet (defaults to caller)"),
819
+ pageIndex: zod_1.z.number().int().describe("Page index"),
820
+ }),
821
+ output: zod_1.z.object({
822
+ ledger: pubkey,
823
+ pageIndex: zod_1.z.number(),
824
+ sealedAt: zod_1.z.string(),
825
+ entriesInPage: zod_1.z.number(),
826
+ dataSize: zod_1.z.number(),
827
+ data: zod_1.z.array(zod_1.z.number()).describe("Raw page data bytes"),
828
+ }),
829
+ },
830
+ };
831
+ //# sourceMappingURL=schemas.js.map