@hashgraphonline/standards-sdk 0.1.136 → 0.1.137-feat-hcs-21.canary.5802d65.32

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 (234) hide show
  1. package/dist/cjs/hcs-21/base-client.d.ts +31 -0
  2. package/dist/cjs/hcs-21/base-client.d.ts.map +1 -0
  3. package/dist/cjs/hcs-21/browser.d.ts +20 -0
  4. package/dist/cjs/hcs-21/browser.d.ts.map +1 -0
  5. package/dist/cjs/hcs-21/errors.d.ts +6 -0
  6. package/dist/cjs/hcs-21/errors.d.ts.map +1 -0
  7. package/dist/cjs/hcs-21/index.d.ts +7 -0
  8. package/dist/cjs/hcs-21/index.d.ts.map +1 -0
  9. package/dist/cjs/hcs-21/sdk.d.ts +48 -0
  10. package/dist/cjs/hcs-21/sdk.d.ts.map +1 -0
  11. package/dist/cjs/hcs-21/tx.d.ts +20 -0
  12. package/dist/cjs/hcs-21/tx.d.ts.map +1 -0
  13. package/dist/cjs/hcs-21/types.d.ts +72 -0
  14. package/dist/cjs/hcs-21/types.d.ts.map +1 -0
  15. package/dist/cjs/index.d.ts +1 -0
  16. package/dist/cjs/index.d.ts.map +1 -1
  17. package/dist/cjs/services/registry-broker/client.d.ts.map +1 -1
  18. package/dist/cjs/services/registry-broker/types.d.ts.map +1 -1
  19. package/dist/cjs/services/types.d.ts +1 -1
  20. package/dist/cjs/services/types.d.ts.map +1 -1
  21. package/dist/cjs/standards-sdk.cjs +1 -1
  22. package/dist/cjs/standards-sdk.cjs.map +1 -1
  23. package/dist/es/hcs-21/base-client.d.ts +31 -0
  24. package/dist/es/hcs-21/base-client.d.ts.map +1 -0
  25. package/dist/es/hcs-21/browser.d.ts +20 -0
  26. package/dist/es/hcs-21/browser.d.ts.map +1 -0
  27. package/dist/es/hcs-21/errors.d.ts +6 -0
  28. package/dist/es/hcs-21/errors.d.ts.map +1 -0
  29. package/dist/es/hcs-21/index.d.ts +7 -0
  30. package/dist/es/hcs-21/index.d.ts.map +1 -0
  31. package/dist/es/hcs-21/sdk.d.ts +48 -0
  32. package/dist/es/hcs-21/sdk.d.ts.map +1 -0
  33. package/dist/es/hcs-21/tx.d.ts +20 -0
  34. package/dist/es/hcs-21/tx.d.ts.map +1 -0
  35. package/dist/es/hcs-21/types.d.ts +72 -0
  36. package/dist/es/hcs-21/types.d.ts.map +1 -0
  37. package/dist/es/index.d.ts +1 -0
  38. package/dist/es/index.d.ts.map +1 -1
  39. package/dist/es/services/registry-broker/client.d.ts.map +1 -1
  40. package/dist/es/services/registry-broker/types.d.ts.map +1 -1
  41. package/dist/es/services/types.d.ts +1 -1
  42. package/dist/es/services/types.d.ts.map +1 -1
  43. package/dist/es/standards-sdk.es.js +66 -48
  44. package/dist/es/standards-sdk.es.js.map +1 -1
  45. package/dist/es/standards-sdk.es10.js +2 -2
  46. package/dist/es/standards-sdk.es100.js +231 -28
  47. package/dist/es/standards-sdk.es100.js.map +1 -1
  48. package/dist/es/standards-sdk.es101.js +109 -18
  49. package/dist/es/standards-sdk.es101.js.map +1 -1
  50. package/dist/es/standards-sdk.es102.js +32 -158
  51. package/dist/es/standards-sdk.es102.js.map +1 -1
  52. package/dist/es/standards-sdk.es103.js +80 -204
  53. package/dist/es/standards-sdk.es103.js.map +1 -1
  54. package/dist/es/standards-sdk.es104.js +21 -780
  55. package/dist/es/standards-sdk.es104.js.map +1 -1
  56. package/dist/es/standards-sdk.es105.js +140 -11
  57. package/dist/es/standards-sdk.es105.js.map +1 -1
  58. package/dist/es/standards-sdk.es106.js +29 -567
  59. package/dist/es/standards-sdk.es106.js.map +1 -1
  60. package/dist/es/standards-sdk.es107.js +17 -597
  61. package/dist/es/standards-sdk.es107.js.map +1 -1
  62. package/dist/es/standards-sdk.es108.js +159 -12
  63. package/dist/es/standards-sdk.es108.js.map +1 -1
  64. package/dist/es/standards-sdk.es109.js +208 -2
  65. package/dist/es/standards-sdk.es109.js.map +1 -1
  66. package/dist/es/standards-sdk.es110.js +774 -67
  67. package/dist/es/standards-sdk.es110.js.map +1 -1
  68. package/dist/es/standards-sdk.es111.js +11 -37
  69. package/dist/es/standards-sdk.es111.js.map +1 -1
  70. package/dist/es/standards-sdk.es112.js +567 -2
  71. package/dist/es/standards-sdk.es112.js.map +1 -1
  72. package/dist/es/standards-sdk.es113.js +576 -197
  73. package/dist/es/standards-sdk.es113.js.map +1 -1
  74. package/dist/es/standards-sdk.es114.js +12 -1139
  75. package/dist/es/standards-sdk.es114.js.map +1 -1
  76. package/dist/es/standards-sdk.es115.js +2 -306
  77. package/dist/es/standards-sdk.es115.js.map +1 -1
  78. package/dist/es/standards-sdk.es116.js +79 -418
  79. package/dist/es/standards-sdk.es116.js.map +1 -1
  80. package/dist/es/standards-sdk.es117.js +35 -351
  81. package/dist/es/standards-sdk.es117.js.map +1 -1
  82. package/dist/es/standards-sdk.es118.js +2 -761
  83. package/dist/es/standards-sdk.es118.js.map +1 -1
  84. package/dist/es/standards-sdk.es119.js +204 -185
  85. package/dist/es/standards-sdk.es119.js.map +1 -1
  86. package/dist/es/standards-sdk.es12.js +1 -1
  87. package/dist/es/standards-sdk.es120.js +1055 -1482
  88. package/dist/es/standards-sdk.es120.js.map +1 -1
  89. package/dist/es/standards-sdk.es121.js +264 -2046
  90. package/dist/es/standards-sdk.es121.js.map +1 -1
  91. package/dist/es/standards-sdk.es122.js +420 -50
  92. package/dist/es/standards-sdk.es122.js.map +1 -1
  93. package/dist/es/standards-sdk.es123.js +350 -82
  94. package/dist/es/standards-sdk.es123.js.map +1 -1
  95. package/dist/es/standards-sdk.es124.js +741 -139
  96. package/dist/es/standards-sdk.es124.js.map +1 -1
  97. package/dist/es/standards-sdk.es125.js +204 -7
  98. package/dist/es/standards-sdk.es125.js.map +1 -1
  99. package/dist/es/standards-sdk.es126.js +1533 -52
  100. package/dist/es/standards-sdk.es126.js.map +1 -1
  101. package/dist/es/standards-sdk.es127.js +2077 -59
  102. package/dist/es/standards-sdk.es127.js.map +1 -1
  103. package/dist/es/standards-sdk.es128.js +52 -28
  104. package/dist/es/standards-sdk.es128.js.map +1 -1
  105. package/dist/es/standards-sdk.es129.js +80 -131
  106. package/dist/es/standards-sdk.es129.js.map +1 -1
  107. package/dist/es/standards-sdk.es13.js +1 -1
  108. package/dist/es/standards-sdk.es130.js +152 -35
  109. package/dist/es/standards-sdk.es130.js.map +1 -1
  110. package/dist/es/standards-sdk.es131.js +7 -694
  111. package/dist/es/standards-sdk.es131.js.map +1 -1
  112. package/dist/es/standards-sdk.es132.js +53 -12241
  113. package/dist/es/standards-sdk.es132.js.map +1 -1
  114. package/dist/es/standards-sdk.es133.js +61 -13
  115. package/dist/es/standards-sdk.es133.js.map +1 -1
  116. package/dist/es/standards-sdk.es134.js +28 -56
  117. package/dist/es/standards-sdk.es134.js.map +1 -1
  118. package/dist/es/standards-sdk.es135.js +128 -54
  119. package/dist/es/standards-sdk.es135.js.map +1 -1
  120. package/dist/es/standards-sdk.es136.js +38 -168
  121. package/dist/es/standards-sdk.es136.js.map +1 -1
  122. package/dist/es/standards-sdk.es137.js +694 -322
  123. package/dist/es/standards-sdk.es137.js.map +1 -1
  124. package/dist/es/standards-sdk.es138.js +12220 -292
  125. package/dist/es/standards-sdk.es138.js.map +1 -1
  126. package/dist/es/standards-sdk.es139.js +55 -452
  127. package/dist/es/standards-sdk.es139.js.map +1 -1
  128. package/dist/es/standards-sdk.es14.js +1 -1
  129. package/dist/es/standards-sdk.es140.js +52 -319
  130. package/dist/es/standards-sdk.es140.js.map +1 -1
  131. package/dist/es/standards-sdk.es141.js +162 -66
  132. package/dist/es/standards-sdk.es141.js.map +1 -1
  133. package/dist/es/standards-sdk.es142.js +325 -0
  134. package/dist/es/standards-sdk.es142.js.map +1 -0
  135. package/dist/es/standards-sdk.es143.js +349 -0
  136. package/dist/es/standards-sdk.es143.js.map +1 -0
  137. package/dist/es/standards-sdk.es144.js +456 -0
  138. package/dist/es/standards-sdk.es144.js.map +1 -0
  139. package/dist/es/standards-sdk.es145.js +334 -0
  140. package/dist/es/standards-sdk.es145.js.map +1 -0
  141. package/dist/es/standards-sdk.es146.js +79 -0
  142. package/dist/es/standards-sdk.es146.js.map +1 -0
  143. package/dist/es/standards-sdk.es147.js +20 -0
  144. package/dist/es/standards-sdk.es147.js.map +1 -0
  145. package/dist/es/standards-sdk.es15.js +1 -1
  146. package/dist/es/standards-sdk.es16.js +17 -12
  147. package/dist/es/standards-sdk.es16.js.map +1 -1
  148. package/dist/es/standards-sdk.es17.js +5 -5
  149. package/dist/es/standards-sdk.es19.js +12 -12
  150. package/dist/es/standards-sdk.es19.js.map +1 -1
  151. package/dist/es/standards-sdk.es2.js.map +1 -1
  152. package/dist/es/standards-sdk.es20.js +9 -9
  153. package/dist/es/standards-sdk.es21.js +1 -1
  154. package/dist/es/standards-sdk.es22.js +1 -1
  155. package/dist/es/standards-sdk.es23.js +1 -1
  156. package/dist/es/standards-sdk.es24.js +1 -1
  157. package/dist/es/standards-sdk.es25.js +1 -1
  158. package/dist/es/standards-sdk.es26.js +1 -1
  159. package/dist/es/standards-sdk.es27.js +1 -1
  160. package/dist/es/standards-sdk.es28.js +12 -12
  161. package/dist/es/standards-sdk.es3.js +2 -2
  162. package/dist/es/standards-sdk.es31.js +2 -2
  163. package/dist/es/standards-sdk.es32.js +4 -4
  164. package/dist/es/standards-sdk.es33.js +1 -1
  165. package/dist/es/standards-sdk.es36.js +6 -6
  166. package/dist/es/standards-sdk.es37.js +4 -4
  167. package/dist/es/standards-sdk.es38.js +2 -2
  168. package/dist/es/standards-sdk.es39.js +2 -2
  169. package/dist/es/standards-sdk.es40.js +1 -1
  170. package/dist/es/standards-sdk.es41.js +1 -1
  171. package/dist/es/standards-sdk.es42.js +2 -2
  172. package/dist/es/standards-sdk.es47.js +1 -1
  173. package/dist/es/standards-sdk.es5.js +2 -2
  174. package/dist/es/standards-sdk.es52.js +1 -1
  175. package/dist/es/standards-sdk.es54.js +1 -1
  176. package/dist/es/standards-sdk.es57.js +2 -2
  177. package/dist/es/standards-sdk.es59.js +1 -1
  178. package/dist/es/standards-sdk.es6.js +2 -2
  179. package/dist/es/standards-sdk.es60.js +1 -1
  180. package/dist/es/standards-sdk.es61.js +7 -7
  181. package/dist/es/standards-sdk.es63.js +1 -1
  182. package/dist/es/standards-sdk.es65.js +2 -2
  183. package/dist/es/standards-sdk.es66.js +3 -3
  184. package/dist/es/standards-sdk.es69.js +2 -2
  185. package/dist/es/standards-sdk.es7.js +2 -2
  186. package/dist/es/standards-sdk.es70.js +3 -3
  187. package/dist/es/standards-sdk.es71.js +2 -2
  188. package/dist/es/standards-sdk.es72.js +1 -1
  189. package/dist/es/standards-sdk.es75.js +2 -2
  190. package/dist/es/standards-sdk.es77.js +2 -2
  191. package/dist/es/standards-sdk.es78.js +4 -4
  192. package/dist/es/standards-sdk.es79.js +1 -1
  193. package/dist/es/standards-sdk.es8.js +1 -1
  194. package/dist/es/standards-sdk.es80.js +25 -27
  195. package/dist/es/standards-sdk.es80.js.map +1 -1
  196. package/dist/es/standards-sdk.es81.js +6 -78
  197. package/dist/es/standards-sdk.es81.js.map +1 -1
  198. package/dist/es/standards-sdk.es82.js +27 -64
  199. package/dist/es/standards-sdk.es82.js.map +1 -1
  200. package/dist/es/standards-sdk.es83.js +67 -23
  201. package/dist/es/standards-sdk.es83.js.map +1 -1
  202. package/dist/es/standards-sdk.es84.js +165 -23
  203. package/dist/es/standards-sdk.es84.js.map +1 -1
  204. package/dist/es/standards-sdk.es85.js +31 -166
  205. package/dist/es/standards-sdk.es85.js.map +1 -1
  206. package/dist/es/standards-sdk.es86.js +24 -127
  207. package/dist/es/standards-sdk.es86.js.map +1 -1
  208. package/dist/es/standards-sdk.es87.js +65 -142
  209. package/dist/es/standards-sdk.es87.js.map +1 -1
  210. package/dist/es/standards-sdk.es88.js +52 -127
  211. package/dist/es/standards-sdk.es88.js.map +1 -1
  212. package/dist/es/standards-sdk.es89.js +26 -41
  213. package/dist/es/standards-sdk.es89.js.map +1 -1
  214. package/dist/es/standards-sdk.es90.js +23 -261
  215. package/dist/es/standards-sdk.es90.js.map +1 -1
  216. package/dist/es/standards-sdk.es91.js +162 -93
  217. package/dist/es/standards-sdk.es91.js.map +1 -1
  218. package/dist/es/standards-sdk.es92.js +112 -83
  219. package/dist/es/standards-sdk.es92.js.map +1 -1
  220. package/dist/es/standards-sdk.es93.js +156 -28
  221. package/dist/es/standards-sdk.es93.js.map +1 -1
  222. package/dist/es/standards-sdk.es94.js +133 -225
  223. package/dist/es/standards-sdk.es94.js.map +1 -1
  224. package/dist/es/standards-sdk.es95.js +40 -108
  225. package/dist/es/standards-sdk.es95.js.map +1 -1
  226. package/dist/es/standards-sdk.es96.js +253 -24
  227. package/dist/es/standards-sdk.es96.js.map +1 -1
  228. package/dist/es/standards-sdk.es97.js +96 -80
  229. package/dist/es/standards-sdk.es97.js.map +1 -1
  230. package/dist/es/standards-sdk.es98.js +91 -21
  231. package/dist/es/standards-sdk.es98.js.map +1 -1
  232. package/dist/es/standards-sdk.es99.js +28 -141
  233. package/dist/es/standards-sdk.es99.js.map +1 -1
  234. package/package.json +2 -1
@@ -1,325 +1,697 @@
1
- import { proto } from "@hashgraph/proto";
2
- import { Long } from "@hashgraph/sdk";
3
- import { hasTransactionType, parseKey } from "./standards-sdk.es141.js";
4
- import { Buffer } from "buffer";
5
- class FileParser {
6
- /**
7
- * Parse File Service transaction using unified dual-branch approach
8
- * This handles both regular transactions and signed transaction variants
9
- */
10
- static parseFileTransaction(transaction, originalBytes) {
11
- try {
12
- if (originalBytes || transaction.toBytes) {
13
- try {
14
- const bytesToParse = originalBytes || transaction.toBytes();
15
- const decoded = proto.TransactionList.decode(bytesToParse);
16
- if (decoded.transactionList && decoded.transactionList.length > 0) {
17
- const tx = decoded.transactionList[0];
18
- let txBody = null;
19
- if (tx.bodyBytes && tx.bodyBytes.length > 0) {
20
- txBody = proto.TransactionBody.decode(tx.bodyBytes);
21
- } else if (tx.signedTransactionBytes && tx.signedTransactionBytes.length > 0) {
22
- const signedTx = proto.SignedTransaction.decode(
23
- tx.signedTransactionBytes
24
- );
25
- if (signedTx.bodyBytes) {
26
- txBody = proto.TransactionBody.decode(signedTx.bodyBytes);
27
- }
28
- }
29
- if (txBody) {
30
- const protoResult = this.parseFromProtobufTxBody(txBody);
31
- if (protoResult.type && protoResult.type !== "UNKNOWN") {
32
- return protoResult;
33
- }
34
- }
35
- }
36
- } catch (protoError) {
37
- }
38
- }
39
- return this.parseFromTransactionInternals(transaction);
40
- } catch (error) {
41
- return { type: "UNKNOWN", humanReadableType: "Unknown File Transaction" };
42
- }
43
- }
44
- /**
45
- * Parse file transaction from protobuf TransactionBody
46
- * Handles all file operations from decoded protobuf data
47
- */
48
- static parseFromProtobufTxBody(txBody) {
49
- if (txBody.fileCreate) {
50
- const fileCreate = this.parseFileCreate(txBody.fileCreate);
51
- if (fileCreate) {
52
- return {
53
- type: "FILECREATE",
54
- humanReadableType: "File Create",
55
- fileCreate
56
- };
57
- }
58
- }
59
- if (txBody.fileAppend) {
60
- const fileAppend = this.parseFileAppend(txBody.fileAppend);
61
- if (fileAppend) {
62
- return {
63
- type: "FILEAPPEND",
64
- humanReadableType: "File Append",
65
- fileAppend
66
- };
67
- }
68
- }
69
- if (txBody.fileUpdate) {
70
- const fileUpdate = this.parseFileUpdate(txBody.fileUpdate);
71
- if (fileUpdate) {
72
- return {
73
- type: "FILEUPDATE",
74
- humanReadableType: "File Update",
75
- fileUpdate
76
- };
77
- }
78
- }
79
- if (txBody.fileDelete) {
80
- const fileDelete = this.parseFileDelete(txBody.fileDelete);
81
- if (fileDelete) {
82
- return {
83
- type: "FILEDELETE",
84
- humanReadableType: "File Delete",
85
- fileDelete
86
- };
87
- }
88
- }
89
- return {};
90
- }
91
- /**
92
- * Extract file data from Transaction internal fields
93
- * This handles cases where data is stored in Transaction object internals
94
- */
95
- static parseFromTransactionInternals(transaction) {
96
- try {
97
- const tx = transaction;
98
- if (hasTransactionType(transaction, "fileCreate")) {
99
- const fileCreate = {};
100
- if (tx._contents) {
101
- const contentInfo = this.analyzeContent(tx._contents);
102
- fileCreate.contents = contentInfo.encoded;
103
- if (contentInfo.contentType) {
104
- fileCreate.contentType = contentInfo.contentType;
105
- }
106
- if (contentInfo.size) {
107
- fileCreate.contentSize = contentInfo.size;
108
- }
109
- }
110
- if (tx._keys && tx._keys.length > 0) {
111
- const keyList = {
112
- keys: tx._keys
113
- };
114
- fileCreate.keys = parseKey({ keyList });
115
- }
116
- if (tx._expirationTime) {
117
- fileCreate.expirationTime = tx._expirationTime.toString();
118
- }
119
- if (tx._memo) {
120
- fileCreate.memo = tx._memo;
121
- }
122
- return {
123
- type: "FILECREATE",
124
- humanReadableType: "File Create",
125
- fileCreate
126
- };
127
- }
128
- if (hasTransactionType(transaction, "fileAppend")) {
129
- const fileAppend = {
130
- fileId: tx._fileId.toString()
131
- };
132
- if (tx._contents) {
133
- const contentInfo = this.analyzeContent(tx._contents);
134
- fileAppend.contents = contentInfo.encoded;
135
- if (contentInfo.size) {
136
- fileAppend.contentSize = contentInfo.size;
137
- }
138
- }
139
- return {
140
- type: "FILEAPPEND",
141
- humanReadableType: "File Append",
142
- fileAppend
143
- };
144
- }
145
- if (hasTransactionType(transaction, "fileUpdate")) {
146
- const fileUpdate = {
147
- fileId: tx._fileId.toString()
148
- };
149
- if (tx._contents) {
150
- const contentInfo = this.analyzeContent(tx._contents);
151
- fileUpdate.contents = contentInfo.encoded;
152
- if (contentInfo.size) {
153
- fileUpdate.contentSize = contentInfo.size;
154
- }
155
- }
156
- if (tx._keys && tx._keys.length > 0) {
157
- const keyList = {
158
- keys: tx._keys
159
- };
160
- fileUpdate.keys = parseKey({ keyList });
161
- }
162
- if (tx._expirationTime) {
163
- fileUpdate.expirationTime = tx._expirationTime.toString();
164
- }
165
- if (tx._memo) {
166
- fileUpdate.memo = tx._memo;
167
- }
168
- return {
169
- type: "FILEUPDATE",
170
- humanReadableType: "File Update",
171
- fileUpdate
172
- };
173
- }
174
- if (hasTransactionType(transaction, "fileDelete")) {
175
- const fileDelete = {
176
- fileId: tx._fileId.toString()
177
- };
178
- return {
179
- type: "FILEDELETE",
180
- humanReadableType: "File Delete",
181
- fileDelete
182
- };
183
- }
184
- return {};
185
- } catch (error) {
186
- return {};
187
- }
188
- }
189
- /**
190
- * Enhanced content analysis with type detection and metadata
191
- */
192
- static analyzeContent(contents) {
193
- const size = contents.length;
194
- const contentBuffer = Buffer.from(contents);
195
- let contentType;
196
- if (size >= 4) {
197
- const header = contentBuffer.subarray(0, 4);
198
- const headerHex = header.toString("hex");
199
- const signatures = {
200
- "89504e47": "image/png",
201
- ffd8ffe0: "image/jpeg",
202
- ffd8ffe1: "image/jpeg",
203
- "47494638": "image/gif",
204
- "25504446": "application/pdf",
205
- "504b0304": "application/zip",
206
- "7f454c46": "application/x-executable",
207
- d0cf11e0: "application/msoffice"
208
- };
209
- contentType = signatures[headerHex.toLowerCase()];
210
- }
211
- if (!contentType) {
212
- try {
213
- const textContent = contentBuffer.toString("utf8");
214
- const hasControlChars = /[\x00-\x08\x0B\x0E-\x1F\x7F]/.test(
215
- textContent
216
- );
217
- const hasReplacementChars = textContent.includes("�");
218
- if (!hasControlChars && !hasReplacementChars) {
219
- if (textContent.trim().startsWith("{") && textContent.trim().endsWith("}")) {
220
- contentType = "application/json";
221
- } else if (textContent.includes("<?xml") || textContent.includes("<html")) {
222
- contentType = "text/xml";
223
- } else if (textContent.includes("<!DOCTYPE html")) {
224
- contentType = "text/html";
225
- } else {
226
- contentType = "text/plain";
227
- }
228
- } else {
229
- contentType = "application/octet-stream";
230
- }
231
- } catch {
232
- contentType = "application/octet-stream";
233
- }
234
- }
235
- let encoded;
236
- if (contentType?.startsWith("text/") || contentType === "application/json") {
237
- try {
238
- encoded = contentBuffer.toString("utf8");
239
- if (encoded.includes("�") || /[\x00-\x08\x0B\x0E-\x1F\x7F]/.test(encoded)) {
240
- encoded = contentBuffer.toString("base64");
241
- }
242
- } catch {
243
- encoded = contentBuffer.toString("base64");
244
- }
245
- } else {
246
- encoded = contentBuffer.toString("base64");
247
- }
248
- return {
249
- encoded,
250
- contentType,
251
- size
252
- };
253
- }
254
- static parseFileCreate(body) {
255
- if (!body) return void 0;
256
- const data = {};
257
- if (body.expirationTime?.seconds) {
258
- data.expirationTime = `${Long.fromValue(
259
- body.expirationTime.seconds
260
- ).toString()}.${body.expirationTime.nanos}`;
261
- }
262
- if (body.keys) {
263
- data.keys = parseKey({ keyList: body.keys });
264
- }
265
- if (body.contents) {
266
- data.contents = Buffer.from(body.contents).toString("base64");
267
- }
268
- if (body.memo) {
269
- data.memo = body.memo;
270
- }
271
- return data;
272
- }
273
- static parseFileAppend(body) {
274
- if (!body) return void 0;
275
- const data = {};
276
- if (body.fileID) {
277
- data.fileId = `${body.fileID.shardNum ?? 0}.${body.fileID.realmNum ?? 0}.${body.fileID.fileNum ?? 0}`;
278
- }
279
- if (body.contents) {
280
- data.contents = Buffer.from(body.contents).toString("base64");
281
- }
282
- return data;
283
- }
284
- static parseFileUpdate(body) {
285
- if (!body) return void 0;
286
- const data = {};
287
- if (body.fileID) {
288
- data.fileId = `${body.fileID.shardNum ?? 0}.${body.fileID.realmNum ?? 0}.${body.fileID.fileNum ?? 0}`;
289
- }
290
- if (body.expirationTime?.seconds) {
291
- data.expirationTime = `${Long.fromValue(
292
- body.expirationTime.seconds
293
- ).toString()}.${body.expirationTime.nanos}`;
294
- }
295
- if (body.keys) {
296
- data.keys = parseKey({ keyList: body.keys });
297
- }
298
- if (body.contents) {
299
- data.contents = Buffer.from(body.contents).toString("base64");
300
- }
301
- if (body.memo?.value !== void 0) {
302
- data.memo = body.memo.value;
303
- }
304
- return data;
305
- }
306
- static parseFileDelete(body) {
307
- if (!body) return void 0;
308
- const data = {};
309
- if (body.fileID) {
310
- data.fileId = `${body.fileID.shardNum ?? 0}.${body.fileID.realmNum ?? 0}.${body.fileID.fileNum ?? 0}`;
311
- }
312
- return data;
313
- }
314
- /**
315
- * Parse File Service transaction from Transaction object
316
- * This is the unified entry point that delegates to the comprehensive parsing logic
317
- */
318
- static parseFromTransactionObject(transaction) {
319
- return this.parseFileTransaction(transaction);
320
- }
321
- }
1
+ import { z } from "zod";
2
+ import { AIAgentCapability, AIAgentType } from "./standards-sdk.es29.js";
3
+ const capabilitySchema = z.nativeEnum(AIAgentCapability);
4
+ const capabilityValueSchema = z.union([capabilitySchema, z.string()]);
5
+ const jsonPrimitiveSchema = z.union([
6
+ z.string(),
7
+ z.number(),
8
+ z.boolean(),
9
+ z.null()
10
+ ]);
11
+ const jsonValueSchema = z.lazy(
12
+ () => z.union([
13
+ jsonPrimitiveSchema,
14
+ z.array(jsonValueSchema),
15
+ z.record(jsonValueSchema)
16
+ ])
17
+ );
18
+ const agentProfileSchema = z.object({
19
+ version: z.string(),
20
+ type: z.number(),
21
+ display_name: z.string(),
22
+ alias: z.string().optional(),
23
+ bio: z.string().optional(),
24
+ socials: z.array(jsonValueSchema).optional(),
25
+ aiAgent: z.object({
26
+ type: z.nativeEnum(AIAgentType),
27
+ creator: z.string().optional(),
28
+ model: z.string().optional(),
29
+ capabilities: z.array(capabilitySchema).optional()
30
+ }).optional(),
31
+ uaid: z.string().optional()
32
+ }).catchall(jsonValueSchema);
33
+ const cipherEnvelopeRecipientSchema = z.object({
34
+ uaid: z.string().optional(),
35
+ ledgerAccountId: z.string().optional(),
36
+ userId: z.string().optional(),
37
+ email: z.string().optional(),
38
+ encryptedShare: z.string()
39
+ });
40
+ const cipherEnvelopeSchema = z.object({
41
+ algorithm: z.string(),
42
+ ciphertext: z.string(),
43
+ nonce: z.string(),
44
+ associatedData: z.string().optional(),
45
+ keyLocator: z.object({
46
+ sessionId: z.string().optional(),
47
+ revision: z.number().optional()
48
+ }).optional(),
49
+ recipients: z.array(cipherEnvelopeRecipientSchema)
50
+ });
51
+ const peerSummarySchema = z.object({
52
+ keyType: z.string(),
53
+ publicKey: z.string(),
54
+ uaid: z.string().optional(),
55
+ ledgerAccountId: z.string().optional(),
56
+ userId: z.string().optional(),
57
+ email: z.string().optional()
58
+ });
59
+ const handshakeParticipantSchema = z.object({
60
+ role: z.enum(["requester", "responder"]),
61
+ uaid: z.string().optional(),
62
+ userId: z.string().optional(),
63
+ ledgerAccountId: z.string().optional(),
64
+ keyType: z.string(),
65
+ longTermPublicKey: z.string().optional(),
66
+ ephemeralPublicKey: z.string(),
67
+ signature: z.string().optional(),
68
+ metadata: z.record(jsonValueSchema).optional(),
69
+ submittedAt: z.string()
70
+ });
71
+ const encryptionHandshakeRecordSchema = z.object({
72
+ sessionId: z.string(),
73
+ algorithm: z.string(),
74
+ createdAt: z.string(),
75
+ expiresAt: z.number(),
76
+ status: z.enum(["pending", "complete"]),
77
+ requester: handshakeParticipantSchema.optional(),
78
+ responder: handshakeParticipantSchema.optional()
79
+ });
80
+ const sessionEncryptionSummarySchema = z.object({
81
+ enabled: z.boolean(),
82
+ algorithm: z.string(),
83
+ requireCiphertext: z.boolean(),
84
+ requester: peerSummarySchema.nullable().optional(),
85
+ responder: peerSummarySchema.nullable().optional(),
86
+ handshake: encryptionHandshakeRecordSchema.nullable().optional()
87
+ });
88
+ const chatHistoryEntrySchema = z.object({
89
+ messageId: z.string(),
90
+ role: z.enum(["user", "agent"]),
91
+ content: z.string(),
92
+ timestamp: z.string(),
93
+ cipherEnvelope: cipherEnvelopeSchema.optional(),
94
+ metadata: z.record(jsonValueSchema).optional()
95
+ });
96
+ const searchHitSchema = z.object({
97
+ id: z.string(),
98
+ uaid: z.string(),
99
+ registry: z.string(),
100
+ name: z.string(),
101
+ description: z.string().optional(),
102
+ capabilities: z.array(capabilityValueSchema),
103
+ endpoints: z.union([z.record(jsonValueSchema), z.array(z.string())]).optional(),
104
+ metadata: z.record(jsonValueSchema).optional(),
105
+ profile: agentProfileSchema.optional(),
106
+ createdAt: z.string().optional(),
107
+ updatedAt: z.string().optional(),
108
+ lastSeen: z.string().optional(),
109
+ lastIndexed: z.string().optional()
110
+ });
111
+ const searchResponseSchema = z.object({
112
+ hits: z.array(searchHitSchema),
113
+ total: z.number(),
114
+ page: z.number(),
115
+ limit: z.number()
116
+ });
117
+ const statsResponseSchema = z.object({
118
+ totalAgents: z.number(),
119
+ registries: z.record(z.number()),
120
+ capabilities: z.record(z.number()),
121
+ lastUpdate: z.string(),
122
+ status: z.string()
123
+ });
124
+ const registriesResponseSchema = z.object({
125
+ registries: z.array(z.string())
126
+ });
127
+ const popularResponseSchema = z.object({
128
+ searches: z.array(z.string())
129
+ });
130
+ const resolveResponseSchema = z.object({
131
+ agent: searchHitSchema
132
+ });
133
+ const createSessionResponseSchema = z.object({
134
+ sessionId: z.string(),
135
+ uaid: z.string().nullable().optional(),
136
+ agent: z.object({
137
+ name: z.string(),
138
+ description: z.string().optional(),
139
+ capabilities: z.record(jsonValueSchema).nullable().optional(),
140
+ skills: z.array(z.string()).optional()
141
+ }),
142
+ history: z.array(chatHistoryEntrySchema),
143
+ historyTtlSeconds: z.number().nullable().optional(),
144
+ encryption: sessionEncryptionSummarySchema.nullable().optional()
145
+ });
146
+ const sendMessageResponseSchema = z.object({
147
+ sessionId: z.string(),
148
+ uaid: z.string().nullable().optional(),
149
+ message: z.string(),
150
+ timestamp: z.string(),
151
+ rawResponse: jsonValueSchema.optional(),
152
+ content: z.string().optional(),
153
+ history: z.array(chatHistoryEntrySchema).optional(),
154
+ historyTtlSeconds: z.number().nullable().optional(),
155
+ encrypted: z.boolean().optional()
156
+ });
157
+ const chatHistorySnapshotResponseSchema = z.object({
158
+ sessionId: z.string(),
159
+ history: z.array(chatHistoryEntrySchema),
160
+ historyTtlSeconds: z.number()
161
+ });
162
+ z.object({
163
+ preserveEntries: z.number().int().min(0).optional()
164
+ }).strict();
165
+ const chatHistoryCompactionResponseSchema = z.object({
166
+ sessionId: z.string(),
167
+ history: z.array(chatHistoryEntrySchema),
168
+ summaryEntry: chatHistoryEntrySchema,
169
+ preservedEntries: z.array(chatHistoryEntrySchema),
170
+ historyTtlSeconds: z.number(),
171
+ creditsDebited: z.number(),
172
+ metadata: z.record(jsonValueSchema).optional()
173
+ });
174
+ const sessionEncryptionStatusResponseSchema = z.object({
175
+ sessionId: z.string(),
176
+ encryption: sessionEncryptionSummarySchema.nullable()
177
+ });
178
+ const encryptionHandshakeResponseSchema = z.object({
179
+ sessionId: z.string(),
180
+ handshake: encryptionHandshakeRecordSchema
181
+ });
182
+ const registerEncryptionKeyResponseSchema = z.object({
183
+ id: z.string(),
184
+ keyType: z.string(),
185
+ publicKey: z.string(),
186
+ uaid: z.string().nullable(),
187
+ ledgerAccountId: z.string().nullable(),
188
+ ledgerNetwork: z.string().nullable().optional(),
189
+ userId: z.string().nullable().optional(),
190
+ email: z.string().nullable().optional(),
191
+ createdAt: z.string(),
192
+ updatedAt: z.string()
193
+ });
194
+ const ledgerChallengeResponseSchema = z.object({
195
+ challengeId: z.string(),
196
+ message: z.string(),
197
+ expiresAt: z.string()
198
+ });
199
+ const ledgerApiKeySummarySchema = z.object({
200
+ id: z.string(),
201
+ label: z.string().optional(),
202
+ prefix: z.string(),
203
+ lastFour: z.string(),
204
+ createdAt: z.string(),
205
+ lastUsedAt: z.string().nullable().optional(),
206
+ ownerType: z.literal("ledger"),
207
+ ledgerAccountId: z.string().optional(),
208
+ ledgerNetwork: z.string().optional(),
209
+ ledgerNetworkCanonical: z.string().optional()
210
+ });
211
+ const ledgerVerifyResponseSchema = z.object({
212
+ key: z.string(),
213
+ apiKey: ledgerApiKeySummarySchema,
214
+ accountId: z.string(),
215
+ network: z.string(),
216
+ networkCanonical: z.string().optional()
217
+ });
218
+ const protocolsResponseSchema = z.object({
219
+ protocols: z.array(z.string())
220
+ });
221
+ const detectProtocolResponseSchema = z.object({
222
+ protocol: z.string().nullable()
223
+ });
224
+ const registrySearchByNamespaceSchema = z.object({
225
+ hits: z.array(searchHitSchema),
226
+ total: z.number(),
227
+ page: z.number().optional(),
228
+ limit: z.number().optional()
229
+ });
230
+ const vectorSearchFilterSchema = z.object({
231
+ capabilities: z.array(z.string()).optional(),
232
+ type: z.string().optional(),
233
+ registry: z.string().optional(),
234
+ protocols: z.array(z.string()).optional()
235
+ }).strict();
236
+ z.object({
237
+ query: z.string(),
238
+ filter: vectorSearchFilterSchema.optional(),
239
+ limit: z.number().int().min(1).max(100).optional(),
240
+ offset: z.number().int().min(0).optional()
241
+ }).strict();
242
+ const vectorSearchHitSchema = z.object({
243
+ agent: searchHitSchema,
244
+ score: z.number().optional(),
245
+ highlights: z.record(z.array(z.string())).optional()
246
+ });
247
+ const vectorSearchResponseSchema = z.object({
248
+ hits: z.array(vectorSearchHitSchema),
249
+ total: z.number(),
250
+ took: z.number(),
251
+ credits_used: z.number().optional()
252
+ });
253
+ const websocketStatsResponseSchema = z.object({
254
+ clients: z.number(),
255
+ stats: z.object({
256
+ totalClients: z.number().optional(),
257
+ clientsByRegistry: z.record(z.number()).optional(),
258
+ clientsByEventType: z.record(z.number()).optional()
259
+ }).passthrough()
260
+ });
261
+ const durationStatsSchema = z.object({
262
+ p50: z.number(),
263
+ p90: z.number(),
264
+ p95: z.number(),
265
+ p99: z.number()
266
+ });
267
+ const metricsSummaryResponseSchema = z.object({
268
+ http: z.object({
269
+ requestsTotal: z.number(),
270
+ activeConnections: z.number(),
271
+ requestDuration: durationStatsSchema
272
+ }),
273
+ search: z.object({
274
+ queriesTotal: z.number(),
275
+ queryDuration: durationStatsSchema
276
+ }),
277
+ indexing: z.object({ agentsTotal: z.number(), crawlErrors: z.number() }),
278
+ registration: z.object({
279
+ total: z.number(),
280
+ failures: z.number(),
281
+ duration: durationStatsSchema
282
+ }),
283
+ cache: z.object({
284
+ hits: z.number(),
285
+ misses: z.number(),
286
+ hitRate: z.number()
287
+ }),
288
+ websocket: z.object({ connections: z.number() })
289
+ });
290
+ const uaidValidationResponseSchema = z.object({
291
+ uaid: z.string(),
292
+ valid: z.boolean(),
293
+ formats: z.array(z.string())
294
+ });
295
+ const adapterConnectionSchema = z.object({
296
+ id: z.string(),
297
+ agentId: z.string(),
298
+ protocol: z.string(),
299
+ endpoint: z.string(),
300
+ status: z.enum(["connected", "disconnected", "error"]),
301
+ metadata: z.record(jsonPrimitiveSchema).optional(),
302
+ createdAt: z.string()
303
+ });
304
+ const uaidConnectionStatusSchema = z.object({
305
+ connected: z.boolean(),
306
+ connection: adapterConnectionSchema.optional(),
307
+ adapter: z.string().optional(),
308
+ agentId: z.string().optional()
309
+ });
310
+ const dashboardStatsResponseSchema = z.object({
311
+ operatorId: z.string().optional(),
312
+ adapters: z.array(
313
+ z.object({
314
+ name: z.string(),
315
+ version: z.string(),
316
+ status: z.string(),
317
+ agentCount: z.number(),
318
+ lastDiscovery: z.string(),
319
+ registryType: z.string(),
320
+ health: z.string()
321
+ })
322
+ ).optional(),
323
+ totalAgents: z.number().optional(),
324
+ elasticsearchDocumentCount: z.number().optional(),
325
+ agentsByAdapter: z.record(z.number()).optional(),
326
+ agentsByRegistry: z.record(z.number()).optional(),
327
+ systemInfo: z.object({
328
+ uptime: z.number().optional(),
329
+ version: z.string().optional(),
330
+ network: z.string().optional()
331
+ }).optional()
332
+ });
333
+ const registrationAgentSchema = z.object({
334
+ id: z.string(),
335
+ name: z.string(),
336
+ type: z.string(),
337
+ endpoint: z.string().optional(),
338
+ capabilities: z.array(capabilityValueSchema),
339
+ registry: z.string().optional(),
340
+ protocol: z.string().optional(),
341
+ profile: agentProfileSchema.optional(),
342
+ nativeId: z.string().optional(),
343
+ metadata: z.record(jsonValueSchema).optional()
344
+ });
345
+ const registrationProfileInfoSchema = z.object({
346
+ tId: z.string().nullable(),
347
+ sizeBytes: z.number().optional()
348
+ });
349
+ const profileRegistrySchema = z.object({
350
+ topicId: z.string().optional(),
351
+ sequenceNumber: z.number().optional(),
352
+ profileReference: z.string().optional(),
353
+ profileTopicId: z.string().optional()
354
+ }).passthrough().nullable().optional();
355
+ const additionalRegistryResultSchema = z.object({
356
+ registry: z.string(),
357
+ status: z.enum([
358
+ "created",
359
+ "duplicate",
360
+ "skipped",
361
+ "error",
362
+ "updated",
363
+ "pending"
364
+ ]),
365
+ agentId: z.string().nullable().optional(),
366
+ agentUri: z.string().nullable().optional(),
367
+ error: z.string().optional(),
368
+ metadata: z.record(jsonValueSchema).optional(),
369
+ registryKey: z.string().optional(),
370
+ networkId: z.string().optional(),
371
+ networkName: z.string().optional(),
372
+ chainId: z.number().optional(),
373
+ estimatedCredits: z.number().nullable().optional(),
374
+ gasEstimateCredits: z.number().nullable().optional(),
375
+ gasEstimateUsd: z.number().nullable().optional(),
376
+ gasPriceGwei: z.number().nullable().optional(),
377
+ gasLimit: z.number().nullable().optional(),
378
+ creditMode: z.enum(["fixed", "gas"]).nullable().optional(),
379
+ minCredits: z.number().nullable().optional(),
380
+ consumedCredits: z.number().nullable().optional(),
381
+ cost: z.object({
382
+ credits: z.number(),
383
+ usd: z.number(),
384
+ eth: z.number(),
385
+ gasUsedWei: z.string(),
386
+ effectiveGasPriceWei: z.string().nullable().optional(),
387
+ transactions: z.array(
388
+ z.object({
389
+ hash: z.string(),
390
+ gasUsedWei: z.string(),
391
+ effectiveGasPriceWei: z.string().nullable().optional(),
392
+ costWei: z.string()
393
+ })
394
+ ).optional()
395
+ }).optional()
396
+ });
397
+ const registrationCreditsSchema = z.object({
398
+ base: z.number(),
399
+ additional: z.number(),
400
+ total: z.number()
401
+ });
402
+ const hcs10RegistrySchema = z.object({
403
+ status: z.string(),
404
+ uaid: z.string().optional(),
405
+ transactionId: z.string().optional(),
406
+ consensusTimestamp: z.string().optional(),
407
+ registryTopicId: z.string().optional(),
408
+ topicSequenceNumber: z.number().optional(),
409
+ payloadHash: z.string().optional(),
410
+ profileReference: z.string().optional(),
411
+ tId: z.string().optional(),
412
+ profileSizeBytes: z.number().optional(),
413
+ error: z.string().optional()
414
+ }).passthrough();
415
+ const additionalRegistryNetworkSchema = z.object({
416
+ key: z.string(),
417
+ registryId: z.string().optional(),
418
+ networkId: z.string().optional(),
419
+ name: z.string().optional(),
420
+ chainId: z.number().optional(),
421
+ label: z.string().optional(),
422
+ estimatedCredits: z.number().nullable().optional(),
423
+ baseCredits: z.number().nullable().optional(),
424
+ gasPortionCredits: z.number().nullable().optional(),
425
+ gasPortionUsd: z.number().nullable().optional(),
426
+ gasEstimateCredits: z.number().nullable().optional(),
427
+ gasEstimateUsd: z.number().nullable().optional(),
428
+ gasPriceGwei: z.number().nullable().optional(),
429
+ gasLimit: z.number().nullable().optional(),
430
+ minCredits: z.number().nullable().optional(),
431
+ creditMode: z.string().nullable().optional()
432
+ }).passthrough();
433
+ const additionalRegistryDescriptorSchema = z.object({
434
+ id: z.string(),
435
+ label: z.string(),
436
+ networks: z.array(additionalRegistryNetworkSchema)
437
+ });
438
+ const additionalRegistryCatalogResponseSchema = z.object({
439
+ registries: z.array(additionalRegistryDescriptorSchema)
440
+ });
441
+ const registerAgentSuccessResponse = z.object({
442
+ success: z.literal(true),
443
+ status: z.enum(["created", "duplicate", "updated"]).optional(),
444
+ uaid: z.string(),
445
+ agentId: z.string(),
446
+ message: z.string().optional(),
447
+ registry: z.string().optional(),
448
+ attemptId: z.string().nullable().optional(),
449
+ agent: registrationAgentSchema,
450
+ openConvAI: z.object({
451
+ compatible: z.boolean(),
452
+ hcs11Profile: agentProfileSchema.optional(),
453
+ bridgeEndpoint: z.string().optional()
454
+ }).optional(),
455
+ profile: registrationProfileInfoSchema.optional(),
456
+ profileRegistry: profileRegistrySchema.nullable().optional(),
457
+ hcs10Registry: hcs10RegistrySchema.nullable().optional(),
458
+ credits: registrationCreditsSchema.optional(),
459
+ additionalRegistries: z.array(additionalRegistryResultSchema).optional(),
460
+ additionalRegistryCredits: z.array(additionalRegistryResultSchema).optional(),
461
+ additionalRegistryCostPerRegistry: z.number().optional()
462
+ });
463
+ const registerAgentPendingResponse = z.object({
464
+ success: z.literal(true),
465
+ status: z.literal("pending"),
466
+ message: z.string(),
467
+ uaid: z.string(),
468
+ agentId: z.string(),
469
+ registry: z.string().optional(),
470
+ attemptId: z.string().nullable(),
471
+ agent: registrationAgentSchema,
472
+ openConvAI: z.object({
473
+ compatible: z.boolean(),
474
+ hcs11Profile: agentProfileSchema.optional(),
475
+ bridgeEndpoint: z.string().optional()
476
+ }).optional(),
477
+ profile: registrationProfileInfoSchema.optional(),
478
+ profileRegistry: profileRegistrySchema.nullable().optional(),
479
+ hcs10Registry: hcs10RegistrySchema.nullable().optional(),
480
+ credits: registrationCreditsSchema,
481
+ additionalRegistries: z.array(additionalRegistryResultSchema),
482
+ additionalRegistryCredits: z.array(additionalRegistryResultSchema).optional(),
483
+ additionalRegistryCostPerRegistry: z.number().optional()
484
+ });
485
+ const registerAgentPartialResponse = z.object({
486
+ success: z.literal(false),
487
+ status: z.literal("partial"),
488
+ message: z.string(),
489
+ uaid: z.string(),
490
+ agentId: z.string(),
491
+ registry: z.string().optional(),
492
+ attemptId: z.string().nullable().optional(),
493
+ agent: registrationAgentSchema,
494
+ openConvAI: z.object({
495
+ compatible: z.boolean(),
496
+ hcs11Profile: agentProfileSchema.optional(),
497
+ bridgeEndpoint: z.string().optional()
498
+ }).optional(),
499
+ profile: registrationProfileInfoSchema.optional(),
500
+ profileRegistry: profileRegistrySchema.nullable().optional(),
501
+ hcs10Registry: hcs10RegistrySchema.nullable().optional(),
502
+ credits: registrationCreditsSchema.optional(),
503
+ additionalRegistries: z.array(additionalRegistryResultSchema).optional(),
504
+ additionalRegistryCredits: z.array(additionalRegistryResultSchema).optional(),
505
+ additionalRegistryCostPerRegistry: z.number().optional(),
506
+ errors: z.array(
507
+ z.object({
508
+ registry: z.string(),
509
+ registryKey: z.string().nullable().optional(),
510
+ error: z.string()
511
+ })
512
+ ).min(1)
513
+ });
514
+ const registerAgentResponseSchema = z.union([
515
+ registerAgentSuccessResponse,
516
+ registerAgentPendingResponse,
517
+ registerAgentPartialResponse
518
+ ]);
519
+ const registrationProgressAdditionalEntry = z.object({
520
+ registryId: z.string(),
521
+ registryKey: z.string(),
522
+ networkId: z.string().optional(),
523
+ networkName: z.string().optional(),
524
+ chainId: z.number().optional(),
525
+ label: z.string().optional(),
526
+ status: z.enum(["pending", "in_progress", "completed", "failed"]),
527
+ error: z.string().optional(),
528
+ credits: z.number().nullable().optional(),
529
+ agentId: z.string().nullable().optional(),
530
+ agentUri: z.string().nullable().optional(),
531
+ metadata: z.record(jsonValueSchema).optional(),
532
+ lastUpdated: z.string()
533
+ });
534
+ const registrationProgressRecord = z.object({
535
+ attemptId: z.string(),
536
+ mode: z.enum(["register", "update"]),
537
+ status: z.enum(["pending", "partial", "completed", "failed"]),
538
+ uaid: z.string().optional(),
539
+ agentId: z.string().optional(),
540
+ registryNamespace: z.string(),
541
+ accountId: z.string().optional(),
542
+ startedAt: z.string(),
543
+ completedAt: z.string().optional(),
544
+ primary: z.object({
545
+ status: z.enum(["pending", "completed", "failed"]),
546
+ finishedAt: z.string().optional(),
547
+ error: z.string().optional()
548
+ }),
549
+ additionalRegistries: z.record(
550
+ z.string(),
551
+ registrationProgressAdditionalEntry
552
+ ),
553
+ errors: z.array(z.string()).optional()
554
+ });
555
+ const registrationProgressResponseSchema = z.object({
556
+ progress: registrationProgressRecord
557
+ });
558
+ const registrationQuoteResponseSchema = z.object({
559
+ accountId: z.string().nullable().optional(),
560
+ registry: z.string().optional(),
561
+ protocol: z.string().optional(),
562
+ requiredCredits: z.number(),
563
+ availableCredits: z.number().nullable().optional(),
564
+ shortfallCredits: z.number().nullable().optional(),
565
+ creditsPerHbar: z.number().nullable().optional(),
566
+ estimatedHbar: z.number().nullable().optional()
567
+ });
568
+ const creditPurchaseResponseSchema = z.object({
569
+ success: z.boolean().optional(),
570
+ purchaser: z.string(),
571
+ credits: z.number(),
572
+ hbarAmount: z.number(),
573
+ transactionId: z.string(),
574
+ consensusTimestamp: z.string().nullable().optional()
575
+ });
576
+ const x402SettlementSchema = z.object({
577
+ success: z.boolean().optional(),
578
+ transaction: z.string().optional(),
579
+ network: z.string().optional(),
580
+ payer: z.string().optional(),
581
+ errorReason: z.string().optional()
582
+ }).strict();
583
+ const x402CreditPurchaseResponseSchema = z.object({
584
+ success: z.boolean(),
585
+ accountId: z.string(),
586
+ creditedCredits: z.number(),
587
+ usdAmount: z.number(),
588
+ balance: z.number(),
589
+ payment: z.object({
590
+ payer: z.string().optional(),
591
+ requirement: z.record(jsonValueSchema).optional(),
592
+ settlement: x402SettlementSchema.optional()
593
+ }).optional()
594
+ });
595
+ const x402MinimumsResponseSchema = z.object({
596
+ minimums: z.record(
597
+ z.object({
598
+ network: z.string().optional(),
599
+ gasLimit: z.number().optional(),
600
+ gasPriceWei: z.string().optional(),
601
+ gasUsd: z.number().optional(),
602
+ minUsd: z.number().optional(),
603
+ ethUsd: z.number().optional(),
604
+ fetchedAt: z.string().optional(),
605
+ source: z.string().optional()
606
+ })
607
+ ).optional(),
608
+ creditUnitUsd: z.number().optional()
609
+ });
610
+ const adaptersResponseSchema = z.object({
611
+ adapters: z.array(z.string())
612
+ });
613
+ const adapterChatProfileSchema = z.object({
614
+ supportsChat: z.boolean(),
615
+ delivery: z.string().optional(),
616
+ transport: z.string().optional(),
617
+ streaming: z.boolean().optional(),
618
+ requiresAuth: z.array(z.string()).optional(),
619
+ notes: z.string().optional()
620
+ });
621
+ const adapterCapabilitiesSchema = z.object({
622
+ discovery: z.boolean(),
623
+ routing: z.boolean(),
624
+ communication: z.boolean(),
625
+ translation: z.boolean(),
626
+ protocols: z.array(z.string())
627
+ });
628
+ const adapterDescriptorSchema = z.object({
629
+ id: z.string(),
630
+ name: z.string(),
631
+ version: z.string(),
632
+ author: z.string(),
633
+ description: z.string(),
634
+ supportedProtocols: z.array(z.string()),
635
+ registryType: z.enum(["web2", "web3", "hybrid"]),
636
+ chatProfile: adapterChatProfileSchema.optional(),
637
+ capabilities: adapterCapabilitiesSchema,
638
+ enabled: z.boolean(),
639
+ priority: z.number(),
640
+ status: z.enum(["running", "stopped"])
641
+ });
642
+ const adapterDetailsResponseSchema = z.object({
643
+ adapters: z.array(adapterDescriptorSchema)
644
+ });
645
+ const metadataFacetOptionSchema = z.object({
646
+ value: z.union([z.string(), z.number(), z.boolean()]),
647
+ label: z.string()
648
+ });
649
+ const searchFacetSchema = z.object({
650
+ key: z.string(),
651
+ label: z.string(),
652
+ description: z.string().optional(),
653
+ type: z.enum(["string", "boolean", "number"]),
654
+ adapters: z.array(z.string()).optional(),
655
+ options: z.array(metadataFacetOptionSchema).optional()
656
+ });
657
+ const searchFacetsResponseSchema = z.object({
658
+ facets: z.array(searchFacetSchema)
659
+ });
322
660
  export {
323
- FileParser
661
+ adapterChatProfileSchema,
662
+ adapterDescriptorSchema,
663
+ adapterDetailsResponseSchema,
664
+ adaptersResponseSchema,
665
+ additionalRegistryCatalogResponseSchema,
666
+ chatHistoryCompactionResponseSchema,
667
+ chatHistorySnapshotResponseSchema,
668
+ createSessionResponseSchema,
669
+ creditPurchaseResponseSchema,
670
+ dashboardStatsResponseSchema,
671
+ detectProtocolResponseSchema,
672
+ encryptionHandshakeResponseSchema,
673
+ ledgerChallengeResponseSchema,
674
+ ledgerVerifyResponseSchema,
675
+ metricsSummaryResponseSchema,
676
+ popularResponseSchema,
677
+ protocolsResponseSchema,
678
+ registerAgentResponseSchema,
679
+ registerEncryptionKeyResponseSchema,
680
+ registrationProgressResponseSchema,
681
+ registrationQuoteResponseSchema,
682
+ registriesResponseSchema,
683
+ registrySearchByNamespaceSchema,
684
+ resolveResponseSchema,
685
+ searchFacetsResponseSchema,
686
+ searchResponseSchema,
687
+ sendMessageResponseSchema,
688
+ sessionEncryptionStatusResponseSchema,
689
+ statsResponseSchema,
690
+ uaidConnectionStatusSchema,
691
+ uaidValidationResponseSchema,
692
+ vectorSearchResponseSchema,
693
+ websocketStatsResponseSchema,
694
+ x402CreditPurchaseResponseSchema,
695
+ x402MinimumsResponseSchema
324
696
  };
325
697
  //# sourceMappingURL=standards-sdk.es137.js.map