@hashgraphonline/standards-sdk 0.1.146-chore-jsr-improvements.canary.46c0c0f.91 → 0.1.146-chore-jsr-improvements.canary.62a5b19.93

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 (175) hide show
  1. package/dist/cjs/services/registry-broker/client/adapters.d.ts +4 -19
  2. package/dist/cjs/services/registry-broker/client/adapters.d.ts.map +1 -1
  3. package/dist/cjs/services/registry-broker/client/agents.d.ts +4 -15
  4. package/dist/cjs/services/registry-broker/client/agents.d.ts.map +1 -1
  5. package/dist/cjs/services/registry-broker/client/base-client.d.ts +64 -1
  6. package/dist/cjs/services/registry-broker/client/base-client.d.ts.map +1 -1
  7. package/dist/cjs/services/registry-broker/client/chat-history.d.ts +4 -22
  8. package/dist/cjs/services/registry-broker/client/chat-history.d.ts.map +1 -1
  9. package/dist/cjs/services/registry-broker/client/chat.d.ts +4 -32
  10. package/dist/cjs/services/registry-broker/client/chat.d.ts.map +1 -1
  11. package/dist/cjs/services/registry-broker/client/credits.d.ts +4 -39
  12. package/dist/cjs/services/registry-broker/client/credits.d.ts.map +1 -1
  13. package/dist/cjs/services/registry-broker/client/encrypted-chat-manager.d.ts +4 -34
  14. package/dist/cjs/services/registry-broker/client/encrypted-chat-manager.d.ts.map +1 -1
  15. package/dist/cjs/services/registry-broker/client/encryption.d.ts +4 -32
  16. package/dist/cjs/services/registry-broker/client/encryption.d.ts.map +1 -1
  17. package/dist/cjs/services/registry-broker/client/ledger-auth.d.ts +4 -9
  18. package/dist/cjs/services/registry-broker/client/ledger-auth.d.ts.map +1 -1
  19. package/dist/cjs/services/registry-broker/client/search-helpers.d.ts +16 -0
  20. package/dist/cjs/services/registry-broker/client/search-helpers.d.ts.map +1 -0
  21. package/dist/cjs/services/registry-broker/client/search.d.ts +5 -18
  22. package/dist/cjs/services/registry-broker/client/search.d.ts.map +1 -1
  23. package/dist/cjs/services/registry-broker/client.d.ts +4 -0
  24. package/dist/cjs/services/registry-broker/client.d.ts.map +1 -1
  25. package/dist/cjs/standards-sdk.cjs +3 -3
  26. package/dist/cjs/standards-sdk.cjs.map +1 -1
  27. package/dist/es/services/registry-broker/client/adapters.d.ts +4 -19
  28. package/dist/es/services/registry-broker/client/adapters.d.ts.map +1 -1
  29. package/dist/es/services/registry-broker/client/agents.d.ts +4 -15
  30. package/dist/es/services/registry-broker/client/agents.d.ts.map +1 -1
  31. package/dist/es/services/registry-broker/client/base-client.d.ts +64 -1
  32. package/dist/es/services/registry-broker/client/base-client.d.ts.map +1 -1
  33. package/dist/es/services/registry-broker/client/chat-history.d.ts +4 -22
  34. package/dist/es/services/registry-broker/client/chat-history.d.ts.map +1 -1
  35. package/dist/es/services/registry-broker/client/chat.d.ts +4 -32
  36. package/dist/es/services/registry-broker/client/chat.d.ts.map +1 -1
  37. package/dist/es/services/registry-broker/client/credits.d.ts +4 -39
  38. package/dist/es/services/registry-broker/client/credits.d.ts.map +1 -1
  39. package/dist/es/services/registry-broker/client/encrypted-chat-manager.d.ts +4 -34
  40. package/dist/es/services/registry-broker/client/encrypted-chat-manager.d.ts.map +1 -1
  41. package/dist/es/services/registry-broker/client/encryption.d.ts +4 -32
  42. package/dist/es/services/registry-broker/client/encryption.d.ts.map +1 -1
  43. package/dist/es/services/registry-broker/client/ledger-auth.d.ts +4 -9
  44. package/dist/es/services/registry-broker/client/ledger-auth.d.ts.map +1 -1
  45. package/dist/es/services/registry-broker/client/search-helpers.d.ts +16 -0
  46. package/dist/es/services/registry-broker/client/search-helpers.d.ts.map +1 -0
  47. package/dist/es/services/registry-broker/client/search.d.ts +5 -18
  48. package/dist/es/services/registry-broker/client/search.d.ts.map +1 -1
  49. package/dist/es/services/registry-broker/client.d.ts +4 -0
  50. package/dist/es/services/registry-broker/client.d.ts.map +1 -1
  51. package/dist/es/standards-sdk.es.js +9 -17
  52. package/dist/es/standards-sdk.es.js.map +1 -1
  53. package/dist/es/standards-sdk.es101.js +1 -1
  54. package/dist/es/standards-sdk.es103.js +1 -1
  55. package/dist/es/standards-sdk.es109.js +2 -10
  56. package/dist/es/standards-sdk.es109.js.map +1 -1
  57. package/dist/es/standards-sdk.es11.js +1 -1
  58. package/dist/es/standards-sdk.es110.js +5 -5
  59. package/dist/es/standards-sdk.es12.js +1 -1
  60. package/dist/es/standards-sdk.es120.js +1 -1
  61. package/dist/es/standards-sdk.es121.js +1 -1
  62. package/dist/es/standards-sdk.es122.js +5 -5
  63. package/dist/es/standards-sdk.es124.js +1 -1
  64. package/dist/es/standards-sdk.es125.js +1 -1
  65. package/dist/es/standards-sdk.es127.js +624 -155
  66. package/dist/es/standards-sdk.es127.js.map +1 -1
  67. package/dist/es/standards-sdk.es128.js +15 -205
  68. package/dist/es/standards-sdk.es128.js.map +1 -1
  69. package/dist/es/standards-sdk.es129.js +74 -97
  70. package/dist/es/standards-sdk.es129.js.map +1 -1
  71. package/dist/es/standards-sdk.es130.js +78 -112
  72. package/dist/es/standards-sdk.es130.js.map +1 -1
  73. package/dist/es/standards-sdk.es131.js +51 -238
  74. package/dist/es/standards-sdk.es131.js.map +1 -1
  75. package/dist/es/standards-sdk.es132.js +146 -167
  76. package/dist/es/standards-sdk.es132.js.map +1 -1
  77. package/dist/es/standards-sdk.es133.js +8 -123
  78. package/dist/es/standards-sdk.es133.js.map +1 -1
  79. package/dist/es/standards-sdk.es134.js +77 -317
  80. package/dist/es/standards-sdk.es134.js.map +1 -1
  81. package/dist/es/standards-sdk.es135.js +61 -460
  82. package/dist/es/standards-sdk.es135.js.map +1 -1
  83. package/dist/es/standards-sdk.es136.js +30 -17
  84. package/dist/es/standards-sdk.es136.js.map +1 -1
  85. package/dist/es/standards-sdk.es137.js +34 -81
  86. package/dist/es/standards-sdk.es137.js.map +1 -1
  87. package/dist/es/standards-sdk.es138.js +28 -87
  88. package/dist/es/standards-sdk.es138.js.map +1 -1
  89. package/dist/es/standards-sdk.es139.js +932 -59
  90. package/dist/es/standards-sdk.es139.js.map +1 -1
  91. package/dist/es/standards-sdk.es140.js +12263 -133
  92. package/dist/es/standards-sdk.es140.js.map +1 -1
  93. package/dist/es/standards-sdk.es141.js +138 -7
  94. package/dist/es/standards-sdk.es141.js.map +1 -1
  95. package/dist/es/standards-sdk.es142.js +36 -80
  96. package/dist/es/standards-sdk.es142.js.map +1 -1
  97. package/dist/es/standards-sdk.es143.js +49 -58
  98. package/dist/es/standards-sdk.es143.js.map +1 -1
  99. package/dist/es/standards-sdk.es144.js +84 -30
  100. package/dist/es/standards-sdk.es144.js.map +1 -1
  101. package/dist/es/standards-sdk.es145.js +17 -34
  102. package/dist/es/standards-sdk.es145.js.map +1 -1
  103. package/dist/es/standards-sdk.es146.js +172 -28
  104. package/dist/es/standards-sdk.es146.js.map +1 -1
  105. package/dist/es/standards-sdk.es147.js +299 -115
  106. package/dist/es/standards-sdk.es147.js.map +1 -1
  107. package/dist/es/standards-sdk.es148.js +340 -36
  108. package/dist/es/standards-sdk.es148.js.map +1 -1
  109. package/dist/es/standards-sdk.es149.js +453 -959
  110. package/dist/es/standards-sdk.es149.js.map +1 -1
  111. package/dist/es/standards-sdk.es150.js +267 -12225
  112. package/dist/es/standards-sdk.es150.js.map +1 -1
  113. package/dist/es/standards-sdk.es151.js +74 -15
  114. package/dist/es/standards-sdk.es151.js.map +1 -1
  115. package/dist/es/standards-sdk.es152.js +132 -49
  116. package/dist/es/standards-sdk.es152.js.map +1 -1
  117. package/dist/es/standards-sdk.es16.js +2 -10
  118. package/dist/es/standards-sdk.es16.js.map +1 -1
  119. package/dist/es/standards-sdk.es18.js +5 -13
  120. package/dist/es/standards-sdk.es18.js.map +1 -1
  121. package/dist/es/standards-sdk.es19.js +3 -11
  122. package/dist/es/standards-sdk.es19.js.map +1 -1
  123. package/dist/es/standards-sdk.es22.js +1 -1
  124. package/dist/es/standards-sdk.es27.js +5 -13
  125. package/dist/es/standards-sdk.es27.js.map +1 -1
  126. package/dist/es/standards-sdk.es30.js +1 -1
  127. package/dist/es/standards-sdk.es31.js +1 -1
  128. package/dist/es/standards-sdk.es35.js +3 -11
  129. package/dist/es/standards-sdk.es35.js.map +1 -1
  130. package/dist/es/standards-sdk.es36.js +3 -3
  131. package/dist/es/standards-sdk.es37.js +1 -1
  132. package/dist/es/standards-sdk.es4.js +1 -1
  133. package/dist/es/standards-sdk.es53.js +1 -1
  134. package/dist/es/standards-sdk.es56.js +1 -1
  135. package/dist/es/standards-sdk.es58.js +1 -1
  136. package/dist/es/standards-sdk.es59.js +1 -1
  137. package/dist/es/standards-sdk.es60.js +3 -11
  138. package/dist/es/standards-sdk.es60.js.map +1 -1
  139. package/dist/es/standards-sdk.es62.js +1 -1
  140. package/dist/es/standards-sdk.es64.js +1 -1
  141. package/dist/es/standards-sdk.es65.js +2 -2
  142. package/dist/es/standards-sdk.es68.js +2 -2
  143. package/dist/es/standards-sdk.es69.js +1 -1
  144. package/dist/es/standards-sdk.es7.js +1 -1
  145. package/dist/es/standards-sdk.es71.js +1 -1
  146. package/dist/es/standards-sdk.es76.js +1 -1
  147. package/dist/es/standards-sdk.es77.js +2 -10
  148. package/dist/es/standards-sdk.es77.js.map +1 -1
  149. package/dist/es/standards-sdk.es78.js +1 -1
  150. package/dist/es/standards-sdk.es81.js +1 -1
  151. package/dist/es/standards-sdk.es83.js +1 -1
  152. package/dist/es/standards-sdk.es87.js +3 -3
  153. package/dist/es/standards-sdk.es91.js +1 -1
  154. package/dist/es/standards-sdk.es92.js +1 -1
  155. package/dist/es/standards-sdk.es97.js +1 -1
  156. package/dist/es/standards-sdk.es99.js +1 -1
  157. package/package.json +1 -1
  158. package/dist/es/standards-sdk.es153.js +0 -87
  159. package/dist/es/standards-sdk.es153.js.map +0 -1
  160. package/dist/es/standards-sdk.es154.js +0 -175
  161. package/dist/es/standards-sdk.es154.js.map +0 -1
  162. package/dist/es/standards-sdk.es155.js +0 -325
  163. package/dist/es/standards-sdk.es155.js.map +0 -1
  164. package/dist/es/standards-sdk.es156.js +0 -349
  165. package/dist/es/standards-sdk.es156.js.map +0 -1
  166. package/dist/es/standards-sdk.es157.js +0 -456
  167. package/dist/es/standards-sdk.es157.js.map +0 -1
  168. package/dist/es/standards-sdk.es158.js +0 -334
  169. package/dist/es/standards-sdk.es158.js.map +0 -1
  170. package/dist/es/standards-sdk.es159.js +0 -79
  171. package/dist/es/standards-sdk.es159.js.map +0 -1
  172. package/dist/es/standards-sdk.es160.js +0 -242
  173. package/dist/es/standards-sdk.es160.js.map +0 -1
  174. package/dist/es/standards-sdk.es161.js +0 -247
  175. package/dist/es/standards-sdk.es161.js.map +0 -1
@@ -1,962 +1,456 @@
1
- import { z } from "zod";
2
- import { adapterDeclarationSchema } from "./standards-sdk.es79.js";
3
- var AIAgentType = /* @__PURE__ */ ((AIAgentType2) => {
4
- AIAgentType2[AIAgentType2["MANUAL"] = 0] = "MANUAL";
5
- AIAgentType2[AIAgentType2["AUTONOMOUS"] = 1] = "AUTONOMOUS";
6
- return AIAgentType2;
7
- })(AIAgentType || {});
8
- var AIAgentCapability = /* @__PURE__ */ ((AIAgentCapability2) => {
9
- AIAgentCapability2[AIAgentCapability2["TEXT_GENERATION"] = 0] = "TEXT_GENERATION";
10
- AIAgentCapability2[AIAgentCapability2["IMAGE_GENERATION"] = 1] = "IMAGE_GENERATION";
11
- AIAgentCapability2[AIAgentCapability2["AUDIO_GENERATION"] = 2] = "AUDIO_GENERATION";
12
- AIAgentCapability2[AIAgentCapability2["VIDEO_GENERATION"] = 3] = "VIDEO_GENERATION";
13
- AIAgentCapability2[AIAgentCapability2["CODE_GENERATION"] = 4] = "CODE_GENERATION";
14
- AIAgentCapability2[AIAgentCapability2["LANGUAGE_TRANSLATION"] = 5] = "LANGUAGE_TRANSLATION";
15
- AIAgentCapability2[AIAgentCapability2["SUMMARIZATION_EXTRACTION"] = 6] = "SUMMARIZATION_EXTRACTION";
16
- AIAgentCapability2[AIAgentCapability2["KNOWLEDGE_RETRIEVAL"] = 7] = "KNOWLEDGE_RETRIEVAL";
17
- AIAgentCapability2[AIAgentCapability2["DATA_INTEGRATION"] = 8] = "DATA_INTEGRATION";
18
- AIAgentCapability2[AIAgentCapability2["MARKET_INTELLIGENCE"] = 9] = "MARKET_INTELLIGENCE";
19
- AIAgentCapability2[AIAgentCapability2["TRANSACTION_ANALYTICS"] = 10] = "TRANSACTION_ANALYTICS";
20
- AIAgentCapability2[AIAgentCapability2["SMART_CONTRACT_AUDIT"] = 11] = "SMART_CONTRACT_AUDIT";
21
- AIAgentCapability2[AIAgentCapability2["GOVERNANCE_FACILITATION"] = 12] = "GOVERNANCE_FACILITATION";
22
- AIAgentCapability2[AIAgentCapability2["SECURITY_MONITORING"] = 13] = "SECURITY_MONITORING";
23
- AIAgentCapability2[AIAgentCapability2["COMPLIANCE_ANALYSIS"] = 14] = "COMPLIANCE_ANALYSIS";
24
- AIAgentCapability2[AIAgentCapability2["FRAUD_DETECTION"] = 15] = "FRAUD_DETECTION";
25
- AIAgentCapability2[AIAgentCapability2["MULTI_AGENT_COORDINATION"] = 16] = "MULTI_AGENT_COORDINATION";
26
- AIAgentCapability2[AIAgentCapability2["API_INTEGRATION"] = 17] = "API_INTEGRATION";
27
- AIAgentCapability2[AIAgentCapability2["WORKFLOW_AUTOMATION"] = 18] = "WORKFLOW_AUTOMATION";
28
- return AIAgentCapability2;
29
- })(AIAgentCapability || {});
30
- const capabilitySchema = z.nativeEnum(AIAgentCapability);
31
- const capabilityValueSchema = z.union([z.number(), z.string()]);
32
- const jsonPrimitiveSchema = z.union([
33
- z.string(),
34
- z.number(),
35
- z.boolean(),
36
- z.null()
37
- ]);
38
- const jsonValueSchema = z.lazy(
39
- () => z.union([
40
- jsonPrimitiveSchema,
41
- z.array(jsonValueSchema),
42
- z.record(jsonValueSchema)
43
- ])
44
- );
45
- const agentProfileSchema = z.object({
46
- version: z.string(),
47
- type: z.number(),
48
- display_name: z.string(),
49
- alias: z.string().optional(),
50
- bio: z.string().optional(),
51
- socials: z.array(jsonValueSchema).optional(),
52
- aiAgent: z.object({
53
- type: z.nativeEnum(AIAgentType),
54
- creator: z.string().optional(),
55
- model: z.string().optional(),
56
- capabilities: z.array(z.union([capabilitySchema, z.number()])).optional()
57
- }).optional(),
58
- uaid: z.string().optional()
59
- }).catchall(jsonValueSchema);
60
- const cipherEnvelopeRecipientSchema = z.object({
61
- uaid: z.string().optional(),
62
- ledgerAccountId: z.string().optional(),
63
- userId: z.string().optional(),
64
- email: z.string().optional(),
65
- encryptedShare: z.string()
66
- });
67
- const cipherEnvelopeSchema = z.object({
68
- algorithm: z.string(),
69
- ciphertext: z.string(),
70
- nonce: z.string(),
71
- associatedData: z.string().optional(),
72
- keyLocator: z.object({
73
- sessionId: z.string().optional(),
74
- revision: z.number().optional()
75
- }).optional(),
76
- recipients: z.array(cipherEnvelopeRecipientSchema)
77
- });
78
- const peerSummarySchema = z.object({
79
- keyType: z.string(),
80
- publicKey: z.string(),
81
- uaid: z.string().optional(),
82
- ledgerAccountId: z.string().optional(),
83
- userId: z.string().optional(),
84
- email: z.string().optional()
85
- });
86
- const handshakeParticipantSchema = z.object({
87
- role: z.enum(["requester", "responder"]),
88
- uaid: z.string().optional(),
89
- userId: z.string().optional(),
90
- ledgerAccountId: z.string().optional(),
91
- keyType: z.string(),
92
- longTermPublicKey: z.string().optional(),
93
- ephemeralPublicKey: z.string(),
94
- signature: z.string().optional(),
95
- metadata: z.record(jsonValueSchema).optional(),
96
- submittedAt: z.string()
97
- });
98
- const encryptionHandshakeRecordSchema = z.object({
99
- sessionId: z.string(),
100
- algorithm: z.string(),
101
- createdAt: z.string(),
102
- expiresAt: z.number(),
103
- status: z.enum(["pending", "complete"]),
104
- requester: handshakeParticipantSchema.optional(),
105
- responder: handshakeParticipantSchema.optional()
106
- });
107
- const sessionEncryptionSummarySchema = z.object({
108
- enabled: z.boolean(),
109
- algorithm: z.string(),
110
- requireCiphertext: z.boolean(),
111
- requester: peerSummarySchema.nullable().optional(),
112
- responder: peerSummarySchema.nullable().optional(),
113
- handshake: encryptionHandshakeRecordSchema.nullable().optional()
114
- });
115
- const chatHistoryEntrySchema = z.object({
116
- messageId: z.string(),
117
- role: z.enum(["user", "agent"]),
118
- content: z.string(),
119
- timestamp: z.string(),
120
- cipherEnvelope: cipherEnvelopeSchema.optional(),
121
- metadata: z.record(jsonValueSchema).optional()
122
- });
123
- const metadataFacetSchema = z.record(
124
- z.union([
125
- z.array(jsonValueSchema),
126
- z.record(jsonValueSchema),
127
- jsonValueSchema
128
- ])
129
- ).optional();
130
- const searchHitSchema = z.object({
131
- id: z.string(),
132
- uaid: z.string(),
133
- registry: z.string(),
134
- name: z.string(),
135
- description: z.string().optional(),
136
- capabilities: z.array(capabilityValueSchema),
137
- endpoints: z.union([z.record(jsonValueSchema), z.array(z.string())]).optional(),
138
- metadata: z.record(jsonValueSchema).optional(),
139
- metadataFacet: metadataFacetSchema,
140
- profile: agentProfileSchema.optional(),
141
- protocols: z.array(z.string()).optional(),
142
- adapter: z.string().optional(),
143
- originalId: z.string().optional(),
144
- communicationSupported: z.boolean().optional(),
145
- routingSupported: z.boolean().optional(),
146
- available: z.boolean().optional(),
147
- availabilityStatus: z.string().optional(),
148
- availabilityCheckedAt: z.string().optional(),
149
- availabilitySource: z.string().optional(),
150
- availabilityLatencyMs: z.number().optional(),
151
- availabilityScore: z.number().optional(),
152
- capabilityLabels: z.array(z.string()).optional(),
153
- capabilityTokens: z.array(z.string()).optional(),
154
- image: z.string().optional(),
155
- createdAt: z.string().optional(),
156
- updatedAt: z.string().optional(),
157
- lastSeen: z.string().optional(),
158
- lastIndexed: z.string().optional()
159
- }).passthrough();
160
- const searchResponseSchema = z.object({
161
- hits: z.array(searchHitSchema),
162
- total: z.number(),
163
- page: z.number(),
164
- limit: z.number()
165
- });
166
- const statsResponseSchema = z.object({
167
- totalAgents: z.number(),
168
- registries: z.record(z.number()),
169
- capabilities: z.record(z.number()),
170
- lastUpdate: z.string(),
171
- status: z.string()
172
- });
173
- const registriesResponseSchema = z.object({
174
- registries: z.array(z.string())
175
- });
176
- const popularResponseSchema = z.object({
177
- searches: z.array(z.string())
178
- });
179
- const resolveResponseSchema = z.object({
180
- agent: searchHitSchema
181
- });
182
- const agentFeedbackSummarySchema = z.object({
183
- averageScore: z.number(),
184
- totalFeedbacks: z.number(),
185
- registry: z.string().optional(),
186
- network: z.string().optional(),
187
- updatedAt: z.string().optional()
188
- });
189
- const agentFeedbackEntrySchema = z.object({
190
- registry: z.string(),
191
- network: z.string().optional(),
192
- agentId: z.number(),
193
- client: z.string(),
194
- score: z.number(),
195
- tag1: z.string().nullable().optional(),
196
- tag2: z.string().nullable().optional(),
197
- revoked: z.boolean(),
198
- feedbackIndex: z.number().nullable().optional(),
199
- fileUri: z.string().nullable().optional(),
200
- fileHash: z.string().nullable().optional(),
201
- createdAt: z.string().nullable().optional()
202
- });
203
- const agentFeedbackResponseSchema = z.object({
204
- uaid: z.string(),
205
- summary: agentFeedbackSummarySchema,
206
- entries: z.array(agentFeedbackEntrySchema)
207
- });
208
- const agentFeedbackEligibilityResponseSchema = z.object({
209
- uaid: z.string(),
210
- sessionId: z.string(),
211
- eligible: z.boolean(),
212
- messageCount: z.number(),
213
- minimumMessages: z.number(),
214
- reason: z.string().optional(),
215
- onchain: z.object({
216
- eligible: z.boolean(),
217
- reason: z.string().optional(),
218
- estimatedCredits: z.number().optional(),
219
- usdEstimate: z.number().optional(),
220
- nativeFeeEstimate: z.number().optional()
221
- }).optional()
222
- });
223
- const agentFeedbackSubmissionResponseSchema = z.object({
224
- uaid: z.string(),
225
- registry: z.string(),
226
- network: z.string().optional(),
227
- agentId: z.number(),
228
- score: z.number(),
229
- tag1: z.string().nullable().optional(),
230
- tag2: z.string().nullable().optional(),
231
- fileUri: z.string().nullable().optional(),
232
- fileHash: z.string().nullable().optional(),
233
- feedbackIndex: z.number().nullable().optional(),
234
- transactionHash: z.string().nullable().optional(),
235
- signature: z.string().nullable().optional(),
236
- submittedAt: z.string()
237
- });
238
- const agentFeedbackIndexResponseSchema = z.object({
239
- page: z.number(),
240
- limit: z.number(),
241
- total: z.number(),
242
- items: z.array(
243
- z.object({
244
- uaid: z.string(),
245
- registry: z.string(),
246
- network: z.string().optional(),
247
- agentId: z.number().nullable().optional(),
248
- summary: agentFeedbackSummarySchema.nullable(),
249
- trustScore: z.number().nullable().optional()
250
- })
251
- )
252
- });
253
- const agentFeedbackEntriesIndexResponseSchema = z.object({
254
- page: z.number(),
255
- limit: z.number(),
256
- total: z.number(),
257
- items: z.array(
258
- z.object({
259
- uaid: z.string(),
260
- entry: agentFeedbackEntrySchema
261
- })
262
- )
263
- });
264
- const createSessionResponseSchema = z.object({
265
- sessionId: z.string(),
266
- uaid: z.string().nullable().optional(),
267
- agent: z.object({
268
- name: z.string(),
269
- description: z.string().optional(),
270
- capabilities: z.record(jsonValueSchema).nullable().optional(),
271
- skills: z.array(z.string()).optional()
272
- }),
273
- history: z.array(chatHistoryEntrySchema).optional().default([]),
274
- historyTtlSeconds: z.number().nullable().optional(),
275
- encryption: sessionEncryptionSummarySchema.nullable().optional()
276
- });
277
- const sendMessageResponseSchema = z.object({
278
- sessionId: z.string(),
279
- uaid: z.string().nullable().optional(),
280
- message: z.string(),
281
- timestamp: z.string(),
282
- rawResponse: jsonValueSchema.optional(),
283
- content: z.string().optional(),
284
- ops: z.array(z.record(jsonValueSchema)).optional(),
285
- history: z.array(chatHistoryEntrySchema).optional(),
286
- historyTtlSeconds: z.number().nullable().optional(),
287
- encrypted: z.boolean().optional()
288
- });
289
- const chatHistorySnapshotResponseSchema = z.object({
290
- sessionId: z.string(),
291
- history: z.array(chatHistoryEntrySchema),
292
- historyTtlSeconds: z.number()
293
- });
294
- z.object({
295
- preserveEntries: z.number().int().min(0).optional()
296
- }).strict();
297
- const chatHistoryCompactionResponseSchema = z.object({
298
- sessionId: z.string(),
299
- history: z.array(chatHistoryEntrySchema),
300
- summaryEntry: chatHistoryEntrySchema,
301
- preservedEntries: z.array(chatHistoryEntrySchema),
302
- historyTtlSeconds: z.number(),
303
- creditsDebited: z.number(),
304
- metadata: z.record(jsonValueSchema).optional()
305
- });
306
- const sessionEncryptionStatusResponseSchema = z.object({
307
- sessionId: z.string(),
308
- encryption: sessionEncryptionSummarySchema.nullable()
309
- });
310
- const encryptionHandshakeResponseSchema = z.object({
311
- sessionId: z.string(),
312
- handshake: encryptionHandshakeRecordSchema
313
- });
314
- const registerEncryptionKeyResponseSchema = z.object({
315
- id: z.string(),
316
- keyType: z.string(),
317
- publicKey: z.string(),
318
- uaid: z.string().nullable(),
319
- ledgerAccountId: z.string().nullable(),
320
- ledgerNetwork: z.string().nullable().optional(),
321
- userId: z.string().nullable().optional(),
322
- email: z.string().nullable().optional(),
323
- createdAt: z.string(),
324
- updatedAt: z.string()
325
- });
326
- const ledgerChallengeResponseSchema = z.object({
327
- challengeId: z.string(),
328
- message: z.string(),
329
- expiresAt: z.string()
330
- });
331
- const ledgerApiKeySummarySchema = z.object({
332
- id: z.string(),
333
- label: z.string().optional(),
334
- prefix: z.string(),
335
- lastFour: z.string(),
336
- createdAt: z.string(),
337
- lastUsedAt: z.string().nullable().optional(),
338
- ownerType: z.literal("ledger"),
339
- ledgerAccountId: z.string().optional(),
340
- ledgerNetwork: z.string().optional(),
341
- ledgerNetworkCanonical: z.string().optional()
342
- });
343
- const ledgerVerifyResponseSchema = z.object({
344
- key: z.string(),
345
- apiKey: ledgerApiKeySummarySchema,
346
- accountId: z.string(),
347
- network: z.string(),
348
- networkCanonical: z.string().optional()
349
- });
350
- const protocolsResponseSchema = z.object({
351
- protocols: z.array(z.string())
352
- });
353
- const detectProtocolResponseSchema = z.object({
354
- protocol: z.string().nullable()
355
- });
356
- const registrySearchByNamespaceSchema = z.object({
357
- hits: z.array(searchHitSchema),
358
- total: z.number(),
359
- page: z.number().optional(),
360
- limit: z.number().optional()
361
- });
362
- const capabilityFilterValueSchema = z.union([z.string(), z.number()]);
363
- const vectorSearchFilterSchema = z.object({
364
- capabilities: z.array(capabilityFilterValueSchema).optional(),
365
- type: z.enum(["ai-agents", "mcp-servers"]).optional(),
366
- registry: z.string().optional(),
367
- protocols: z.array(z.string()).optional(),
368
- adapter: z.array(z.string()).optional()
369
- }).strict();
370
- z.object({
371
- query: z.string(),
372
- filter: vectorSearchFilterSchema.optional(),
373
- limit: z.number().int().min(1).max(100).optional(),
374
- offset: z.number().int().min(0).optional()
375
- }).strict();
376
- const vectorSearchHitSchema = z.object({
377
- agent: searchHitSchema,
378
- score: z.number().optional(),
379
- highlights: z.record(z.array(z.string())).optional()
380
- });
381
- const vectorSearchResponseSchema = z.object({
382
- hits: z.array(vectorSearchHitSchema),
383
- total: z.number(),
384
- took: z.number(),
385
- totalAvailable: z.number().optional(),
386
- visible: z.number().optional(),
387
- limited: z.boolean().optional(),
388
- credits_used: z.number().optional()
389
- });
390
- const vectorStatusSchema = z.object({
391
- enabled: z.boolean(),
392
- healthy: z.boolean(),
393
- mode: z.enum(["disabled", "initializing", "healthy", "degraded", "error"]),
394
- lastUpdated: z.string(),
395
- details: z.record(z.any()).optional(),
396
- lastError: z.object({
397
- message: z.string(),
398
- stack: z.string().optional(),
399
- timestamp: z.string().optional()
400
- }).optional()
401
- });
402
- const searchStatusResponseSchema = z.object({
403
- storageMode: z.string(),
404
- vectorStatus: vectorStatusSchema
405
- });
406
- const websocketStatsResponseSchema = z.object({
407
- clients: z.number(),
408
- stats: z.object({
409
- totalClients: z.number().optional(),
410
- clientsByRegistry: z.record(z.number()).optional(),
411
- clientsByEventType: z.record(z.number()).optional()
412
- }).passthrough()
413
- });
414
- const durationStatsSchema = z.object({
415
- p50: z.number(),
416
- p90: z.number(),
417
- p95: z.number(),
418
- p99: z.number()
419
- });
420
- const metricsSummaryResponseSchema = z.object({
421
- http: z.object({
422
- requestsTotal: z.number(),
423
- activeConnections: z.number(),
424
- requestDuration: durationStatsSchema
425
- }),
426
- search: z.object({
427
- queriesTotal: z.number(),
428
- queryDuration: durationStatsSchema
429
- }),
430
- indexing: z.object({ agentsTotal: z.number(), crawlErrors: z.number() }),
431
- registration: z.object({
432
- total: z.number(),
433
- failures: z.number(),
434
- duration: durationStatsSchema
435
- }),
436
- cache: z.object({
437
- hits: z.number(),
438
- misses: z.number(),
439
- hitRate: z.number()
440
- }),
441
- websocket: z.object({ connections: z.number() })
442
- });
443
- const uaidValidationResponseSchema = z.object({
444
- uaid: z.string(),
445
- valid: z.boolean(),
446
- formats: z.array(z.string())
447
- });
448
- const adapterConnectionSchema = z.object({
449
- id: z.string(),
450
- agentId: z.string(),
451
- protocol: z.string(),
452
- endpoint: z.string(),
453
- status: z.enum(["connected", "disconnected", "error"]),
454
- metadata: z.record(jsonPrimitiveSchema).optional(),
455
- createdAt: z.string()
456
- });
457
- const uaidConnectionStatusSchema = z.object({
458
- connected: z.boolean(),
459
- connection: adapterConnectionSchema.optional(),
460
- adapter: z.string().optional(),
461
- agentId: z.string().optional()
462
- });
463
- const dashboardStatsResponseSchema = z.object({
464
- operatorId: z.string().optional(),
465
- adapters: z.array(
466
- z.object({
467
- name: z.string(),
468
- version: z.string(),
469
- status: z.string(),
470
- agentCount: z.number(),
471
- lastDiscovery: z.string(),
472
- registryType: z.string(),
473
- health: z.string()
474
- })
475
- ).optional(),
476
- totalAgents: z.number().optional(),
477
- elasticsearchDocumentCount: z.number().optional(),
478
- agentsByAdapter: z.record(z.number()).optional(),
479
- agentsByRegistry: z.record(z.number()).optional(),
480
- systemInfo: z.object({
481
- uptime: z.number().optional(),
482
- version: z.string().optional(),
483
- network: z.string().optional()
484
- }).optional()
485
- });
486
- const registrationAgentSchema = z.object({
487
- id: z.string(),
488
- name: z.string(),
489
- type: z.string(),
490
- endpoint: z.string().optional(),
491
- capabilities: z.array(capabilityValueSchema),
492
- registry: z.string().optional(),
493
- protocol: z.string().optional(),
494
- profile: agentProfileSchema.optional(),
495
- nativeId: z.string().optional(),
496
- metadata: z.record(jsonValueSchema).optional()
497
- });
498
- const registrationProfileInfoSchema = z.object({
499
- tId: z.string().nullable(),
500
- sizeBytes: z.number().optional()
501
- });
502
- const profileRegistrySchema = z.object({
503
- topicId: z.string().optional(),
504
- sequenceNumber: z.number().optional(),
505
- profileReference: z.string().optional(),
506
- profileTopicId: z.string().optional()
507
- }).passthrough().nullable().optional();
508
- const additionalRegistryResultSchema = z.object({
509
- registry: z.string(),
510
- status: z.enum([
511
- "created",
512
- "duplicate",
513
- "skipped",
514
- "error",
515
- "updated",
516
- "pending"
517
- ]),
518
- agentId: z.string().nullable().optional(),
519
- agentUri: z.string().nullable().optional(),
520
- error: z.string().optional(),
521
- metadata: z.record(jsonValueSchema).optional(),
522
- registryKey: z.string().optional(),
523
- networkId: z.string().optional(),
524
- networkName: z.string().optional(),
525
- chainId: z.number().optional(),
526
- estimatedCredits: z.number().nullable().optional(),
527
- gasEstimateCredits: z.number().nullable().optional(),
528
- gasEstimateUsd: z.number().nullable().optional(),
529
- gasPriceGwei: z.number().nullable().optional(),
530
- gasLimit: z.number().nullable().optional(),
531
- creditMode: z.enum(["fixed", "gas"]).nullable().optional(),
532
- minCredits: z.number().nullable().optional(),
533
- consumedCredits: z.number().nullable().optional(),
534
- cost: z.object({
535
- credits: z.number(),
536
- usd: z.number(),
537
- eth: z.number(),
538
- gasUsedWei: z.string(),
539
- effectiveGasPriceWei: z.string().nullable().optional(),
540
- transactions: z.array(
541
- z.object({
542
- hash: z.string(),
543
- gasUsedWei: z.string(),
544
- effectiveGasPriceWei: z.string().nullable().optional(),
545
- costWei: z.string()
546
- })
547
- ).optional()
548
- }).optional()
549
- });
550
- const registrationCreditsSchema = z.object({
551
- base: z.number(),
552
- additional: z.number(),
553
- total: z.number()
554
- });
555
- const hcs10RegistrySchema = z.object({
556
- status: z.string(),
557
- uaid: z.string().optional(),
558
- transactionId: z.string().optional(),
559
- consensusTimestamp: z.string().optional(),
560
- registryTopicId: z.string().optional(),
561
- topicSequenceNumber: z.number().optional(),
562
- payloadHash: z.string().optional(),
563
- profileReference: z.string().optional(),
564
- tId: z.string().optional(),
565
- profileSizeBytes: z.number().optional(),
566
- error: z.string().optional()
567
- }).passthrough();
568
- const additionalRegistryNetworkSchema = z.object({
569
- key: z.string(),
570
- registryId: z.string().optional(),
571
- networkId: z.string().optional(),
572
- name: z.string().optional(),
573
- chainId: z.number().optional(),
574
- label: z.string().optional(),
575
- estimatedCredits: z.number().nullable().optional(),
576
- baseCredits: z.number().nullable().optional(),
577
- gasPortionCredits: z.number().nullable().optional(),
578
- gasPortionUsd: z.number().nullable().optional(),
579
- gasEstimateCredits: z.number().nullable().optional(),
580
- gasEstimateUsd: z.number().nullable().optional(),
581
- gasPriceGwei: z.number().nullable().optional(),
582
- gasLimit: z.number().nullable().optional(),
583
- minCredits: z.number().nullable().optional(),
584
- creditMode: z.string().nullable().optional()
585
- }).passthrough();
586
- const additionalRegistryDescriptorSchema = z.object({
587
- id: z.string(),
588
- label: z.string(),
589
- networks: z.array(additionalRegistryNetworkSchema)
590
- });
591
- const additionalRegistryCatalogResponseSchema = z.object({
592
- registries: z.array(additionalRegistryDescriptorSchema)
593
- });
594
- const registerAgentSuccessResponse = z.object({
595
- success: z.literal(true),
596
- status: z.enum(["created", "duplicate", "updated"]).optional(),
597
- uaid: z.string(),
598
- agentId: z.string(),
599
- message: z.string().optional(),
600
- registry: z.string().optional(),
601
- attemptId: z.string().nullable().optional(),
602
- agent: registrationAgentSchema,
603
- openConvAI: z.object({
604
- compatible: z.boolean(),
605
- hcs11Profile: agentProfileSchema.optional(),
606
- bridgeEndpoint: z.string().optional()
607
- }).optional(),
608
- profile: registrationProfileInfoSchema.optional(),
609
- profileRegistry: profileRegistrySchema.nullable().optional(),
610
- hcs10Registry: hcs10RegistrySchema.nullable().optional(),
611
- credits: registrationCreditsSchema.optional(),
612
- additionalRegistries: z.array(additionalRegistryResultSchema).optional(),
613
- additionalRegistryCredits: z.array(additionalRegistryResultSchema).optional(),
614
- additionalRegistryCostPerRegistry: z.number().optional()
615
- });
616
- const registerAgentPendingResponse = z.object({
617
- success: z.literal(true),
618
- status: z.literal("pending"),
619
- message: z.string(),
620
- uaid: z.string(),
621
- agentId: z.string(),
622
- registry: z.string().optional(),
623
- attemptId: z.string().nullable(),
624
- agent: registrationAgentSchema,
625
- openConvAI: z.object({
626
- compatible: z.boolean(),
627
- hcs11Profile: agentProfileSchema.optional(),
628
- bridgeEndpoint: z.string().optional()
629
- }).optional(),
630
- profile: registrationProfileInfoSchema.optional(),
631
- profileRegistry: profileRegistrySchema.nullable().optional(),
632
- hcs10Registry: hcs10RegistrySchema.nullable().optional(),
633
- credits: registrationCreditsSchema,
634
- additionalRegistries: z.array(additionalRegistryResultSchema),
635
- additionalRegistryCredits: z.array(additionalRegistryResultSchema).optional(),
636
- additionalRegistryCostPerRegistry: z.number().optional()
637
- });
638
- const registerAgentPartialResponse = z.object({
639
- success: z.literal(false),
640
- status: z.literal("partial"),
641
- message: z.string(),
642
- uaid: z.string(),
643
- agentId: z.string(),
644
- registry: z.string().optional(),
645
- attemptId: z.string().nullable().optional(),
646
- agent: registrationAgentSchema,
647
- openConvAI: z.object({
648
- compatible: z.boolean(),
649
- hcs11Profile: agentProfileSchema.optional(),
650
- bridgeEndpoint: z.string().optional()
651
- }).optional(),
652
- profile: registrationProfileInfoSchema.optional(),
653
- profileRegistry: profileRegistrySchema.nullable().optional(),
654
- hcs10Registry: hcs10RegistrySchema.nullable().optional(),
655
- credits: registrationCreditsSchema.optional(),
656
- additionalRegistries: z.array(additionalRegistryResultSchema).optional(),
657
- additionalRegistryCredits: z.array(additionalRegistryResultSchema).optional(),
658
- additionalRegistryCostPerRegistry: z.number().optional(),
659
- errors: z.array(
660
- z.object({
661
- registry: z.string(),
662
- registryKey: z.string().nullable().optional(),
663
- error: z.string()
664
- })
665
- ).min(1)
666
- });
667
- const registerAgentResponseSchema = z.union([
668
- registerAgentSuccessResponse,
669
- registerAgentPendingResponse,
670
- registerAgentPartialResponse
671
- ]);
672
- const registrationProgressAdditionalEntry = z.object({
673
- registryId: z.string(),
674
- registryKey: z.string(),
675
- networkId: z.string().optional(),
676
- networkName: z.string().optional(),
677
- chainId: z.number().optional(),
678
- label: z.string().optional(),
679
- status: z.enum(["pending", "in_progress", "completed", "failed"]),
680
- error: z.string().optional(),
681
- credits: z.number().nullable().optional(),
682
- agentId: z.string().nullable().optional(),
683
- agentUri: z.string().nullable().optional(),
684
- metadata: z.record(jsonValueSchema).optional(),
685
- lastUpdated: z.string()
686
- });
687
- const registrationProgressRecord = z.object({
688
- attemptId: z.string(),
689
- mode: z.enum(["register", "update"]),
690
- status: z.enum(["pending", "partial", "completed", "failed"]),
691
- uaid: z.string().optional(),
692
- agentId: z.string().optional(),
693
- registryNamespace: z.string(),
694
- accountId: z.string().optional(),
695
- startedAt: z.string(),
696
- completedAt: z.string().optional(),
697
- primary: z.object({
698
- status: z.enum(["pending", "completed", "failed"]),
699
- finishedAt: z.string().optional(),
700
- error: z.string().optional()
701
- }),
702
- additionalRegistries: z.record(
703
- z.string(),
704
- registrationProgressAdditionalEntry
705
- ),
706
- errors: z.array(z.string()).optional()
707
- });
708
- const registrationProgressResponseSchema = z.object({
709
- progress: registrationProgressRecord
710
- });
711
- const registrationQuoteResponseSchema = z.object({
712
- accountId: z.string().nullable().optional(),
713
- registry: z.string().optional(),
714
- protocol: z.string().optional(),
715
- requiredCredits: z.number(),
716
- availableCredits: z.number().nullable().optional(),
717
- shortfallCredits: z.number().nullable().optional(),
718
- creditsPerHbar: z.number().nullable().optional(),
719
- estimatedHbar: z.number().nullable().optional()
720
- });
721
- const creditPurchaseResponseSchema = z.object({
722
- success: z.boolean().optional(),
723
- purchaser: z.string(),
724
- credits: z.number(),
725
- hbarAmount: z.number(),
726
- transactionId: z.string(),
727
- consensusTimestamp: z.string().nullable().optional()
728
- });
729
- const x402SettlementSchema = z.object({
730
- success: z.boolean().optional(),
731
- transaction: z.string().optional(),
732
- network: z.string().optional(),
733
- payer: z.string().optional(),
734
- errorReason: z.string().optional()
735
- }).strict();
736
- const x402CreditPurchaseResponseSchema = z.object({
737
- success: z.boolean(),
738
- accountId: z.string(),
739
- creditedCredits: z.number(),
740
- usdAmount: z.number(),
741
- balance: z.number(),
742
- payment: z.object({
743
- payer: z.string().optional(),
744
- requirement: z.record(jsonValueSchema).optional(),
745
- settlement: x402SettlementSchema.optional()
746
- }).optional()
747
- });
748
- const x402MinimumsResponseSchema = z.object({
749
- minimums: z.record(
750
- z.object({
751
- network: z.string().optional(),
752
- gasLimit: z.number().optional(),
753
- gasPriceWei: z.string().optional(),
754
- gasUsd: z.number().optional(),
755
- minUsd: z.number().optional(),
756
- ethUsd: z.number().optional(),
757
- fetchedAt: z.string().optional(),
758
- source: z.string().optional()
759
- })
760
- ).optional(),
761
- creditUnitUsd: z.number().optional()
762
- });
763
- const adaptersResponseSchema = z.object({
764
- adapters: z.array(z.string())
765
- });
766
- const adapterRegistryCategorySchema = z.object({
767
- id: z.number().int(),
768
- network: z.string(),
769
- type: z.string(),
770
- slug: z.string(),
771
- name: z.string(),
772
- description: z.string().nullable().optional(),
773
- topicId: z.string(),
774
- versionTopicId: z.string(),
775
- registryTransactionId: z.string().nullable().optional(),
776
- versionTransactionId: z.string().nullable().optional(),
777
- metadataPointer: z.string().nullable().optional(),
778
- metadataSequence: z.number().int().nullable().optional(),
779
- createdAt: z.string(),
780
- updatedAt: z.string(),
781
- metadata: jsonValueSchema.optional().nullable()
782
- });
783
- const adapterRegistryCategoriesResponseSchema = z.object({
784
- categories: z.array(adapterRegistryCategorySchema)
785
- });
786
- const adapterRegistryAdapterSchema = z.object({
787
- id: z.union([z.string(), z.number()]).optional(),
788
- network: z.string().optional(),
789
- categoryId: z.union([z.string(), z.number()]).nullable().optional(),
790
- operation: z.string().optional(),
791
- adapterId: z.string(),
792
- adapterName: z.string(),
793
- entity: z.string(),
794
- manifestPointer: z.string().nullable().optional(),
795
- manifestSequence: z.number().int().nullable().optional(),
796
- packageRegistry: z.string().nullable().optional(),
797
- packageName: z.string().nullable().optional(),
798
- packageVersion: z.string().nullable().optional(),
799
- packageIntegrity: z.string().nullable().optional(),
800
- stateModel: z.string().nullable().optional(),
801
- config: jsonValueSchema.nullable().optional(),
802
- signature: z.string().nullable().optional(),
803
- manifest: jsonValueSchema.nullable().optional(),
804
- keywords: z.array(z.string()).optional(),
805
- searchText: z.string().nullable().optional(),
806
- creditAccountId: z.string().nullable().optional(),
807
- registeredByUserId: z.string().nullable().optional(),
808
- registeredByEmail: z.string().nullable().optional(),
809
- totalCostHbar: z.number().nullable().optional(),
810
- totalCostCredits: z.number().nullable().optional(),
811
- consensusTimestamp: z.string().nullable().optional(),
812
- sequenceNumber: z.number().int().nullable().optional(),
813
- payerAccountId: z.string().nullable().optional(),
814
- mirrorNodePayload: jsonValueSchema.nullable().optional(),
815
- versionTopicId: z.string().nullable().optional(),
816
- declarationTopicId: z.string().nullable().optional(),
817
- categoryEntrySequence: z.number().int().nullable().optional(),
818
- categoryEntryTransactionId: z.string().nullable().optional(),
819
- versionPointerSequence: z.number().int().nullable().optional(),
820
- versionPointerTransactionId: z.string().nullable().optional(),
821
- transactionId: z.string().nullable().optional(),
822
- createdAt: z.string().optional(),
823
- category: adapterRegistryCategorySchema.optional()
824
- }).passthrough();
825
- const adapterRegistryAdaptersResponseSchema = z.object({
826
- network: z.string(),
827
- adapters: z.array(adapterRegistryAdapterSchema)
828
- });
829
- const adapterRegistryCreateCategoryResponseSchema = z.object({
830
- category: adapterRegistryCategorySchema
831
- });
832
- z.object({
833
- adapter: z.record(jsonValueSchema),
834
- declaration: adapterDeclarationSchema,
835
- transactionId: z.string().optional().nullable(),
836
- category: adapterRegistryCategorySchema
837
- });
838
- const adapterRegistrySubmitAdapterAcceptedResponseSchema = z.object({
839
- submissionId: z.string(),
840
- status: z.string().optional(),
841
- network: z.string().optional(),
842
- message: z.string().optional()
843
- }).passthrough();
844
- const adapterRegistrySubmissionStatusResponseSchema = z.object({
845
- submission: z.object({
846
- id: z.string(),
847
- network: z.string(),
848
- status: z.enum(["pending", "running", "completed", "failed"]),
849
- adapterId: z.string(),
850
- categorySlug: z.string().nullable().optional(),
851
- creditAccountId: z.string().nullable().optional(),
852
- registeredByUserId: z.string().nullable().optional(),
853
- registeredByEmail: z.string().nullable().optional(),
854
- requestPayload: jsonValueSchema.optional(),
855
- resultPayload: jsonValueSchema.nullable().optional(),
856
- error: z.string().nullable().optional(),
857
- createdAt: z.string().optional(),
858
- updatedAt: z.string().optional(),
859
- startedAt: z.string().nullable().optional(),
860
- completedAt: z.string().nullable().optional()
861
- }).passthrough()
862
- });
863
- const adapterChatProfileSchema = z.object({
864
- supportsChat: z.boolean(),
865
- delivery: z.string().optional(),
866
- transport: z.string().optional(),
867
- streaming: z.boolean().optional(),
868
- requiresAuth: z.array(z.string()).optional(),
869
- notes: z.string().optional()
870
- });
871
- const adapterCapabilitiesSchema = z.object({
872
- discovery: z.boolean(),
873
- routing: z.boolean(),
874
- communication: z.boolean(),
875
- translation: z.boolean(),
876
- protocols: z.array(z.string())
877
- });
878
- const adapterDescriptorSchema = z.object({
879
- id: z.string(),
880
- name: z.string(),
881
- version: z.string(),
882
- author: z.string(),
883
- description: z.string(),
884
- supportedProtocols: z.array(z.string()),
885
- registryType: z.enum(["web2", "web3", "hybrid"]),
886
- chatProfile: adapterChatProfileSchema.optional(),
887
- capabilities: adapterCapabilitiesSchema,
888
- enabled: z.boolean(),
889
- priority: z.number(),
890
- status: z.enum(["running", "stopped"])
891
- });
892
- const adapterDetailsResponseSchema = z.object({
893
- adapters: z.array(adapterDescriptorSchema)
894
- });
895
- const metadataFacetOptionSchema = z.object({
896
- value: z.union([z.string(), z.number(), z.boolean()]),
897
- label: z.string()
898
- });
899
- const searchFacetSchema = z.object({
900
- key: z.string(),
901
- label: z.string(),
902
- description: z.string().optional(),
903
- type: z.enum(["string", "boolean", "number"]),
904
- adapters: z.array(z.string()).optional(),
905
- options: z.array(metadataFacetOptionSchema).optional()
906
- });
907
- const searchFacetsResponseSchema = z.object({
908
- facets: z.array(searchFacetSchema)
909
- });
1
+ import { proto } from "@hashgraph/proto";
2
+ import { Long, Hbar, HbarUnit, ContractId, AccountId, FileId } from "@hashgraph/sdk";
3
+ import { Buffer } from "buffer";
4
+ import { hasTransactionType, parseKey } from "./standards-sdk.es151.js";
5
+ class SCSParser {
6
+ /**
7
+ * Parse Smart Contract Service transaction using unified dual-branch approach
8
+ * This handles both regular transactions and signed transaction variants
9
+ */
10
+ static parseSCSTransaction(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 {
42
+ type: "UNKNOWN",
43
+ humanReadableType: "Unknown Contract Transaction"
44
+ };
45
+ }
46
+ }
47
+ /**
48
+ * Parse contract transaction from protobuf TransactionBody
49
+ * Handles all contract operations from decoded protobuf data
50
+ */
51
+ static parseFromProtobufTxBody(txBody) {
52
+ if (txBody.contractCall) {
53
+ const contractCall = this.parseContractCall(txBody.contractCall);
54
+ if (contractCall) {
55
+ return {
56
+ type: "CONTRACTCALL",
57
+ humanReadableType: "Contract Call",
58
+ contractCall
59
+ };
60
+ }
61
+ }
62
+ if (txBody.contractCreateInstance) {
63
+ const contractCreate = this.parseContractCreate(
64
+ txBody.contractCreateInstance
65
+ );
66
+ if (contractCreate) {
67
+ return {
68
+ type: "CONTRACTCREATE",
69
+ humanReadableType: "Contract Create",
70
+ contractCreate
71
+ };
72
+ }
73
+ }
74
+ if (txBody.contractUpdateInstance) {
75
+ const contractUpdate = this.parseContractUpdate(
76
+ txBody.contractUpdateInstance
77
+ );
78
+ if (contractUpdate) {
79
+ return {
80
+ type: "CONTRACTUPDATE",
81
+ humanReadableType: "Contract Update",
82
+ contractUpdate
83
+ };
84
+ }
85
+ }
86
+ if (txBody.contractDeleteInstance) {
87
+ const contractDelete = this.parseContractDelete(
88
+ txBody.contractDeleteInstance
89
+ );
90
+ if (contractDelete) {
91
+ return {
92
+ type: "CONTRACTDELETE",
93
+ humanReadableType: "Contract Delete",
94
+ contractDelete
95
+ };
96
+ }
97
+ }
98
+ if (txBody.ethereumTransaction) {
99
+ const ethereumCall = this.parseEthereumTransaction(
100
+ txBody.ethereumTransaction
101
+ );
102
+ if (ethereumCall) {
103
+ return {
104
+ type: "ETHEREUMTRANSACTION",
105
+ humanReadableType: "Ethereum Transaction",
106
+ ethereumTransaction: ethereumCall
107
+ };
108
+ }
109
+ }
110
+ return {};
111
+ }
112
+ /**
113
+ * Extract contract data from Transaction internal fields
114
+ * This handles cases where data is stored in Transaction object internals
115
+ */
116
+ static parseFromTransactionInternals(transaction) {
117
+ try {
118
+ const tx = transaction;
119
+ if (tx._contractId && tx._gas) {
120
+ const contractCall = {
121
+ contractId: tx._contractId.toString(),
122
+ gas: typeof tx._gas === "number" ? tx._gas : Long.fromValue(tx._gas).toNumber(),
123
+ amount: tx._amount ? parseFloat(tx._amount.toString()) : 0
124
+ };
125
+ if (tx._functionParameters) {
126
+ const funcParams = Buffer.from(tx._functionParameters).toString(
127
+ "hex"
128
+ );
129
+ contractCall.functionParameters = funcParams;
130
+ contractCall.functionName = this.extractFunctionName(funcParams);
131
+ }
132
+ return {
133
+ type: "CONTRACTCALL",
134
+ humanReadableType: "Contract Call",
135
+ contractCall
136
+ };
137
+ }
138
+ if (hasTransactionType(transaction, "contractCreateInstance")) {
139
+ const contractCreate = {
140
+ gas: tx._gas.toString(),
141
+ initialBalance: tx._initialBalance?.toString() || "0"
142
+ };
143
+ if (tx._fileId) {
144
+ contractCreate.initcodeSource = "fileID";
145
+ contractCreate.initcode = tx._fileId.toString();
146
+ } else if (tx._bytecode) {
147
+ contractCreate.initcodeSource = "bytes";
148
+ contractCreate.initcode = Buffer.from(tx._bytecode).toString("hex");
149
+ }
150
+ if (tx._constructorParameters) {
151
+ contractCreate.constructorParameters = Buffer.from(
152
+ tx._constructorParameters
153
+ ).toString("hex");
154
+ }
155
+ if (tx._memo) contractCreate.memo = tx._memo;
156
+ if (tx._adminKey) contractCreate.adminKey = parseKey(tx._adminKey);
157
+ if (tx._maxAutomaticTokenAssociations !== void 0) {
158
+ contractCreate.maxAutomaticTokenAssociations = tx._maxAutomaticTokenAssociations;
159
+ }
160
+ if (tx._stakedAccountId) {
161
+ contractCreate.stakedAccountId = tx._stakedAccountId.toString();
162
+ } else if (tx._stakedNodeId !== null && tx._stakedNodeId !== void 0) {
163
+ contractCreate.stakedNodeId = Long.fromValue(
164
+ tx._stakedNodeId
165
+ ).toString();
166
+ }
167
+ if (tx._declineReward !== void 0)
168
+ contractCreate.declineReward = tx._declineReward;
169
+ if (tx._autoRenewPeriod)
170
+ contractCreate.autoRenewPeriod = tx._autoRenewPeriod.toString();
171
+ return {
172
+ type: "CONTRACTCREATE",
173
+ humanReadableType: "Contract Create",
174
+ contractCreate
175
+ };
176
+ }
177
+ if (hasTransactionType(transaction, "contractUpdateInstance")) {
178
+ const contractUpdate = {
179
+ contractIdToUpdate: tx._contractId.toString()
180
+ };
181
+ if (tx._memo) contractUpdate.memo = tx._memo;
182
+ if (tx._adminKey) contractUpdate.adminKey = parseKey(tx._adminKey);
183
+ if (tx._maxAutomaticTokenAssociations !== void 0) {
184
+ contractUpdate.maxAutomaticTokenAssociations = tx._maxAutomaticTokenAssociations;
185
+ }
186
+ if (tx._stakedAccountId) {
187
+ contractUpdate.stakedAccountId = tx._stakedAccountId.toString();
188
+ } else if (tx._stakedNodeId !== null && tx._stakedNodeId !== void 0) {
189
+ contractUpdate.stakedNodeId = Long.fromValue(
190
+ tx._stakedNodeId
191
+ ).toString();
192
+ }
193
+ if (tx._declineReward !== void 0)
194
+ contractUpdate.declineReward = tx._declineReward;
195
+ if (tx._autoRenewPeriod)
196
+ contractUpdate.autoRenewPeriod = tx._autoRenewPeriod.toString();
197
+ return {
198
+ type: "CONTRACTUPDATE",
199
+ humanReadableType: "Contract Update",
200
+ contractUpdate
201
+ };
202
+ }
203
+ if (hasTransactionType(transaction, "contractDeleteInstance")) {
204
+ const contractDelete = {
205
+ contractIdToDelete: tx._contractId.toString()
206
+ };
207
+ if (tx._transferAccountId) {
208
+ contractDelete.transferAccountId = tx._transferAccountId.toString();
209
+ } else if (tx._transferContractId) {
210
+ contractDelete.transferContractId = tx._transferContractId.toString();
211
+ }
212
+ return {
213
+ type: "CONTRACTDELETE",
214
+ humanReadableType: "Contract Delete",
215
+ contractDelete
216
+ };
217
+ }
218
+ return {};
219
+ } catch (error) {
220
+ return {};
221
+ }
222
+ }
223
+ /**
224
+ * Enhanced function name extraction from contract call parameters
225
+ * Attempts to decode function selector and map to known function names
226
+ */
227
+ static extractFunctionName(functionParameters) {
228
+ if (functionParameters.length < 8) return "unknown";
229
+ const selector = functionParameters.substring(0, 8);
230
+ const commonSelectors = {
231
+ a9059cbb: "transfer",
232
+ "095ea7b3": "approve",
233
+ "23b872dd": "transferFrom",
234
+ "70a08231": "balanceOf",
235
+ dd62ed3e: "allowance",
236
+ "18160ddd": "totalSupply",
237
+ "06fdde03": "name",
238
+ "95d89b41": "symbol",
239
+ "313ce567": "decimals",
240
+ "42842e0e": "safeTransferFrom",
241
+ b88d4fde: "safeTransferFrom",
242
+ e985e9c5: "isApprovedForAll",
243
+ a22cb465: "setApprovalForAll",
244
+ "6352211e": "ownerOf",
245
+ c87b56dd: "tokenURI",
246
+ "01ffc9a7": "supportsInterface",
247
+ "40c10f19": "mint",
248
+ "42966c68": "burn",
249
+ f2fde38b: "transferOwnership",
250
+ "715018a6": "renounceOwnership",
251
+ "8da5cb5b": "owner"
252
+ };
253
+ return commonSelectors[selector] || selector;
254
+ }
255
+ /**
256
+ * Parse Ethereum Transaction (was completely missing from original parser)
257
+ */
258
+ static parseEthereumTransaction(body) {
259
+ if (!body) return void 0;
260
+ const data = {
261
+ contractId: "EVM",
262
+ gas: body.maxGasAllowance ? Long.fromValue(body.maxGasAllowance).toNumber() : 0,
263
+ amount: 0
264
+ };
265
+ if (body.ethereumData && body.ethereumData.length > 0) {
266
+ const ethData = Buffer.from(body.ethereumData).toString("hex");
267
+ data.functionParameters = ethData;
268
+ if (ethData.length >= 8) {
269
+ data.functionName = this.extractFunctionName(ethData);
270
+ }
271
+ }
272
+ return data;
273
+ }
274
+ static parseContractCall(body) {
275
+ if (!body) return void 0;
276
+ const hbarAmount = Hbar.fromTinybars(Long.fromValue(body.amount ?? 0));
277
+ const data = {
278
+ contractId: new ContractId(
279
+ body.contractID.shardNum ?? 0,
280
+ body.contractID.realmNum ?? 0,
281
+ body.contractID.contractNum ?? 0
282
+ ).toString(),
283
+ gas: Long.fromValue(body.gas ?? 0).toNumber(),
284
+ amount: parseFloat(hbarAmount.toString(HbarUnit.Hbar))
285
+ };
286
+ if (body.functionParameters) {
287
+ data.functionParameters = Buffer.from(body.functionParameters).toString(
288
+ "hex"
289
+ );
290
+ if (data.functionParameters.length >= 8) {
291
+ data.functionName = this.extractFunctionName(data.functionParameters);
292
+ }
293
+ }
294
+ return data;
295
+ }
296
+ static parseContractCreate(body) {
297
+ if (!body) return void 0;
298
+ const data = {};
299
+ if (body.initialBalance) {
300
+ data.initialBalance = Hbar.fromTinybars(
301
+ Long.fromValue(body.initialBalance)
302
+ ).toString(HbarUnit.Hbar);
303
+ }
304
+ if (body.gas) {
305
+ data.gas = Long.fromValue(body.gas).toString();
306
+ }
307
+ if (body.adminKey) {
308
+ data.adminKey = parseKey(body.adminKey);
309
+ }
310
+ if (body.constructorParameters) {
311
+ data.constructorParameters = Buffer.from(
312
+ body.constructorParameters
313
+ ).toString("hex");
314
+ }
315
+ if (body.memo) {
316
+ data.memo = body.memo;
317
+ }
318
+ if (body.autoRenewPeriod?.seconds) {
319
+ data.autoRenewPeriod = Long.fromValue(
320
+ body.autoRenewPeriod.seconds
321
+ ).toString();
322
+ }
323
+ if (body.stakedAccountId) {
324
+ data.stakedAccountId = new AccountId(
325
+ body.stakedAccountId.shardNum ?? 0,
326
+ body.stakedAccountId.realmNum ?? 0,
327
+ body.stakedAccountId.accountNum ?? 0
328
+ ).toString();
329
+ } else if (body.stakedNodeId !== null && body.stakedNodeId !== void 0) {
330
+ data.stakedNodeId = Long.fromValue(body.stakedNodeId).toString();
331
+ }
332
+ if (body.declineReward !== void 0) {
333
+ data.declineReward = body.declineReward;
334
+ }
335
+ if (body.maxAutomaticTokenAssociations !== void 0) {
336
+ data.maxAutomaticTokenAssociations = body.maxAutomaticTokenAssociations;
337
+ }
338
+ if (body.fileID) {
339
+ data.initcodeSource = "fileID";
340
+ data.initcode = new FileId(
341
+ body.fileID.shardNum ?? 0,
342
+ body.fileID.realmNum ?? 0,
343
+ body.fileID.fileNum ?? 0
344
+ ).toString();
345
+ } else if (body.initcode && body.initcode.length > 0) {
346
+ data.initcodeSource = "bytes";
347
+ data.initcode = Buffer.from(body.initcode).toString("hex");
348
+ }
349
+ return data;
350
+ }
351
+ static parseContractUpdate(body) {
352
+ if (!body) return void 0;
353
+ const data = {};
354
+ if (body.contractID) {
355
+ data.contractIdToUpdate = new ContractId(
356
+ body.contractID.shardNum ?? 0,
357
+ body.contractID.realmNum ?? 0,
358
+ body.contractID.contractNum ?? 0
359
+ ).toString();
360
+ }
361
+ if (body.adminKey) {
362
+ data.adminKey = parseKey(body.adminKey);
363
+ }
364
+ if (body.expirationTime?.seconds) {
365
+ data.expirationTime = `${Long.fromValue(
366
+ body.expirationTime.seconds
367
+ ).toString()}.${body.expirationTime.nanos}`;
368
+ }
369
+ if (body.autoRenewPeriod?.seconds) {
370
+ data.autoRenewPeriod = Long.fromValue(
371
+ body.autoRenewPeriod.seconds
372
+ ).toString();
373
+ }
374
+ if (body.memo) {
375
+ const memoUnion = body.memo;
376
+ if (memoUnion && typeof memoUnion === "object" && Object.prototype.hasOwnProperty.call(memoUnion, "value")) {
377
+ const value = memoUnion.value;
378
+ if (value === null || value === void 0) {
379
+ data.memo = void 0;
380
+ } else {
381
+ data.memo = String(value);
382
+ }
383
+ } else if (typeof memoUnion === "string") {
384
+ data.memo = memoUnion;
385
+ } else {
386
+ data.memo = void 0;
387
+ }
388
+ } else {
389
+ data.memo = void 0;
390
+ }
391
+ if (body.stakedAccountId) {
392
+ data.stakedAccountId = new AccountId(
393
+ body.stakedAccountId.shardNum ?? 0,
394
+ body.stakedAccountId.realmNum ?? 0,
395
+ body.stakedAccountId.accountNum ?? 0
396
+ ).toString();
397
+ data.stakedNodeId = void 0;
398
+ } else if (body.stakedNodeId !== null && body.stakedNodeId !== void 0 && Long.fromValue(body.stakedNodeId).notEquals(-1)) {
399
+ data.stakedNodeId = Long.fromValue(body.stakedNodeId).toString();
400
+ data.stakedAccountId = void 0;
401
+ } else {
402
+ data.stakedNodeId = void 0;
403
+ data.stakedAccountId = void 0;
404
+ }
405
+ if (body.declineReward?.value !== void 0) {
406
+ data.declineReward = body.declineReward.value;
407
+ }
408
+ if (body.maxAutomaticTokenAssociations?.value !== void 0) {
409
+ data.maxAutomaticTokenAssociations = body.maxAutomaticTokenAssociations.value;
410
+ }
411
+ if (body.autoRenewAccountId) {
412
+ data.autoRenewAccountId = new AccountId(
413
+ body.autoRenewAccountId.shardNum ?? 0,
414
+ body.autoRenewAccountId.realmNum ?? 0,
415
+ body.autoRenewAccountId.accountNum ?? 0
416
+ ).toString();
417
+ }
418
+ return data;
419
+ }
420
+ static parseContractDelete(body) {
421
+ if (!body) return void 0;
422
+ const data = {};
423
+ if (body.contractID) {
424
+ data.contractIdToDelete = new ContractId(
425
+ body.contractID.shardNum ?? 0,
426
+ body.contractID.realmNum ?? 0,
427
+ body.contractID.contractNum ?? 0
428
+ ).toString();
429
+ }
430
+ if (body.transferAccountID) {
431
+ data.transferAccountId = new AccountId(
432
+ body.transferAccountID.shardNum ?? 0,
433
+ body.transferAccountID.realmNum ?? 0,
434
+ body.transferAccountID.accountNum ?? 0
435
+ ).toString();
436
+ } else if (body.transferContractID) {
437
+ data.transferContractId = new ContractId(
438
+ body.transferContractID.shardNum ?? 0,
439
+ body.transferContractID.realmNum ?? 0,
440
+ body.transferContractID.contractNum ?? 0
441
+ ).toString();
442
+ }
443
+ return data;
444
+ }
445
+ /**
446
+ * Parse SCS (Smart Contract Service) transaction from Transaction object
447
+ * This is the unified entry point that delegates to the comprehensive parsing logic
448
+ */
449
+ static parseFromTransactionObject(transaction) {
450
+ return this.parseSCSTransaction(transaction);
451
+ }
452
+ }
910
453
  export {
911
- AIAgentCapability,
912
- AIAgentType,
913
- adapterChatProfileSchema,
914
- adapterDescriptorSchema,
915
- adapterDetailsResponseSchema,
916
- adapterRegistryAdapterSchema,
917
- adapterRegistryAdaptersResponseSchema,
918
- adapterRegistryCategoriesResponseSchema,
919
- adapterRegistryCategorySchema,
920
- adapterRegistryCreateCategoryResponseSchema,
921
- adapterRegistrySubmissionStatusResponseSchema,
922
- adapterRegistrySubmitAdapterAcceptedResponseSchema,
923
- adaptersResponseSchema,
924
- additionalRegistryCatalogResponseSchema,
925
- agentFeedbackEligibilityResponseSchema,
926
- agentFeedbackEntriesIndexResponseSchema,
927
- agentFeedbackIndexResponseSchema,
928
- agentFeedbackResponseSchema,
929
- agentFeedbackSubmissionResponseSchema,
930
- chatHistoryCompactionResponseSchema,
931
- chatHistorySnapshotResponseSchema,
932
- createSessionResponseSchema,
933
- creditPurchaseResponseSchema,
934
- dashboardStatsResponseSchema,
935
- detectProtocolResponseSchema,
936
- encryptionHandshakeResponseSchema,
937
- ledgerChallengeResponseSchema,
938
- ledgerVerifyResponseSchema,
939
- metricsSummaryResponseSchema,
940
- popularResponseSchema,
941
- protocolsResponseSchema,
942
- registerAgentResponseSchema,
943
- registerEncryptionKeyResponseSchema,
944
- registrationProgressResponseSchema,
945
- registrationQuoteResponseSchema,
946
- registriesResponseSchema,
947
- registrySearchByNamespaceSchema,
948
- resolveResponseSchema,
949
- searchFacetsResponseSchema,
950
- searchResponseSchema,
951
- searchStatusResponseSchema,
952
- sendMessageResponseSchema,
953
- sessionEncryptionStatusResponseSchema,
954
- statsResponseSchema,
955
- uaidConnectionStatusSchema,
956
- uaidValidationResponseSchema,
957
- vectorSearchResponseSchema,
958
- websocketStatsResponseSchema,
959
- x402CreditPurchaseResponseSchema,
960
- x402MinimumsResponseSchema
454
+ SCSParser
961
455
  };
962
456
  //# sourceMappingURL=standards-sdk.es149.js.map