@hashgraphonline/standards-sdk 0.1.141-canary.5 → 0.1.141-canary.7

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 (48) hide show
  1. package/dist/es/standards-sdk.es101.js +1 -1
  2. package/dist/es/standards-sdk.es103.js +1 -1
  3. package/dist/es/standards-sdk.es109.js +1 -1
  4. package/dist/es/standards-sdk.es12.js +1 -1
  5. package/dist/es/standards-sdk.es124.js +1 -1
  6. package/dist/es/standards-sdk.es125.js +1 -1
  7. package/dist/es/standards-sdk.es127.js +1 -1
  8. package/dist/es/standards-sdk.es13.js +1 -1
  9. package/dist/es/standards-sdk.es135.js +12 -12269
  10. package/dist/es/standards-sdk.es135.js.map +1 -1
  11. package/dist/es/standards-sdk.es136.js +138 -760
  12. package/dist/es/standards-sdk.es136.js.map +1 -1
  13. package/dist/es/standards-sdk.es137.js +37 -133
  14. package/dist/es/standards-sdk.es137.js.map +1 -1
  15. package/dist/es/standards-sdk.es138.js +760 -42
  16. package/dist/es/standards-sdk.es138.js.map +1 -1
  17. package/dist/es/standards-sdk.es139.js +12269 -12
  18. package/dist/es/standards-sdk.es139.js.map +1 -1
  19. package/dist/es/standards-sdk.es17.js +1 -1
  20. package/dist/es/standards-sdk.es19.js +4 -4
  21. package/dist/es/standards-sdk.es20.js +2 -2
  22. package/dist/es/standards-sdk.es23.js +1 -1
  23. package/dist/es/standards-sdk.es28.js +3 -3
  24. package/dist/es/standards-sdk.es31.js +1 -1
  25. package/dist/es/standards-sdk.es32.js +1 -1
  26. package/dist/es/standards-sdk.es36.js +2 -2
  27. package/dist/es/standards-sdk.es37.js +3 -3
  28. package/dist/es/standards-sdk.es38.js +1 -1
  29. package/dist/es/standards-sdk.es5.js +1 -1
  30. package/dist/es/standards-sdk.es54.js +1 -1
  31. package/dist/es/standards-sdk.es61.js +2 -2
  32. package/dist/es/standards-sdk.es65.js +1 -1
  33. package/dist/es/standards-sdk.es66.js +2 -2
  34. package/dist/es/standards-sdk.es69.js +2 -2
  35. package/dist/es/standards-sdk.es70.js +1 -1
  36. package/dist/es/standards-sdk.es72.js +1 -1
  37. package/dist/es/standards-sdk.es77.js +1 -1
  38. package/dist/es/standards-sdk.es78.js +1 -1
  39. package/dist/es/standards-sdk.es79.js +1 -1
  40. package/dist/es/standards-sdk.es8.js +1 -1
  41. package/dist/es/standards-sdk.es82.js +1 -1
  42. package/dist/es/standards-sdk.es84.js +1 -1
  43. package/dist/es/standards-sdk.es87.js +1 -1
  44. package/dist/es/standards-sdk.es91.js +1 -1
  45. package/dist/es/standards-sdk.es92.js +1 -1
  46. package/dist/es/standards-sdk.es97.js +1 -1
  47. package/dist/es/standards-sdk.es99.js +1 -1
  48. package/package.json +1 -1
@@ -1,763 +1,141 @@
1
- import { z } from "zod";
2
- var AIAgentType = /* @__PURE__ */ ((AIAgentType2) => {
3
- AIAgentType2[AIAgentType2["MANUAL"] = 0] = "MANUAL";
4
- AIAgentType2[AIAgentType2["AUTONOMOUS"] = 1] = "AUTONOMOUS";
5
- return AIAgentType2;
6
- })(AIAgentType || {});
7
- var AIAgentCapability = /* @__PURE__ */ ((AIAgentCapability2) => {
8
- AIAgentCapability2[AIAgentCapability2["TEXT_GENERATION"] = 0] = "TEXT_GENERATION";
9
- AIAgentCapability2[AIAgentCapability2["IMAGE_GENERATION"] = 1] = "IMAGE_GENERATION";
10
- AIAgentCapability2[AIAgentCapability2["AUDIO_GENERATION"] = 2] = "AUDIO_GENERATION";
11
- AIAgentCapability2[AIAgentCapability2["VIDEO_GENERATION"] = 3] = "VIDEO_GENERATION";
12
- AIAgentCapability2[AIAgentCapability2["CODE_GENERATION"] = 4] = "CODE_GENERATION";
13
- AIAgentCapability2[AIAgentCapability2["LANGUAGE_TRANSLATION"] = 5] = "LANGUAGE_TRANSLATION";
14
- AIAgentCapability2[AIAgentCapability2["SUMMARIZATION_EXTRACTION"] = 6] = "SUMMARIZATION_EXTRACTION";
15
- AIAgentCapability2[AIAgentCapability2["KNOWLEDGE_RETRIEVAL"] = 7] = "KNOWLEDGE_RETRIEVAL";
16
- AIAgentCapability2[AIAgentCapability2["DATA_INTEGRATION"] = 8] = "DATA_INTEGRATION";
17
- AIAgentCapability2[AIAgentCapability2["MARKET_INTELLIGENCE"] = 9] = "MARKET_INTELLIGENCE";
18
- AIAgentCapability2[AIAgentCapability2["TRANSACTION_ANALYTICS"] = 10] = "TRANSACTION_ANALYTICS";
19
- AIAgentCapability2[AIAgentCapability2["SMART_CONTRACT_AUDIT"] = 11] = "SMART_CONTRACT_AUDIT";
20
- AIAgentCapability2[AIAgentCapability2["GOVERNANCE_FACILITATION"] = 12] = "GOVERNANCE_FACILITATION";
21
- AIAgentCapability2[AIAgentCapability2["SECURITY_MONITORING"] = 13] = "SECURITY_MONITORING";
22
- AIAgentCapability2[AIAgentCapability2["COMPLIANCE_ANALYSIS"] = 14] = "COMPLIANCE_ANALYSIS";
23
- AIAgentCapability2[AIAgentCapability2["FRAUD_DETECTION"] = 15] = "FRAUD_DETECTION";
24
- AIAgentCapability2[AIAgentCapability2["MULTI_AGENT_COORDINATION"] = 16] = "MULTI_AGENT_COORDINATION";
25
- AIAgentCapability2[AIAgentCapability2["API_INTEGRATION"] = 17] = "API_INTEGRATION";
26
- AIAgentCapability2[AIAgentCapability2["WORKFLOW_AUTOMATION"] = 18] = "WORKFLOW_AUTOMATION";
27
- return AIAgentCapability2;
28
- })(AIAgentCapability || {});
29
- const capabilitySchema = z.nativeEnum(AIAgentCapability);
30
- const capabilityValueSchema = z.union([capabilitySchema, z.string()]);
31
- const jsonPrimitiveSchema = z.union([
32
- z.string(),
33
- z.number(),
34
- z.boolean(),
35
- z.null()
36
- ]);
37
- const jsonValueSchema = z.lazy(
38
- () => z.union([
39
- jsonPrimitiveSchema,
40
- z.array(jsonValueSchema),
41
- z.record(jsonValueSchema)
42
- ])
43
- );
44
- const agentProfileSchema = z.object({
45
- version: z.string(),
46
- type: z.number(),
47
- display_name: z.string(),
48
- alias: z.string().optional(),
49
- bio: z.string().optional(),
50
- socials: z.array(jsonValueSchema).optional(),
51
- aiAgent: z.object({
52
- type: z.nativeEnum(AIAgentType),
53
- creator: z.string().optional(),
54
- model: z.string().optional(),
55
- capabilities: z.array(capabilitySchema).optional()
56
- }).optional(),
57
- uaid: z.string().optional()
58
- }).catchall(jsonValueSchema);
59
- const cipherEnvelopeRecipientSchema = z.object({
60
- uaid: z.string().optional(),
61
- ledgerAccountId: z.string().optional(),
62
- userId: z.string().optional(),
63
- email: z.string().optional(),
64
- encryptedShare: z.string()
65
- });
66
- const cipherEnvelopeSchema = z.object({
67
- algorithm: z.string(),
68
- ciphertext: z.string(),
69
- nonce: z.string(),
70
- associatedData: z.string().optional(),
71
- keyLocator: z.object({
72
- sessionId: z.string().optional(),
73
- revision: z.number().optional()
74
- }).optional(),
75
- recipients: z.array(cipherEnvelopeRecipientSchema)
76
- });
77
- const peerSummarySchema = z.object({
78
- keyType: z.string(),
79
- publicKey: z.string(),
80
- uaid: z.string().optional(),
81
- ledgerAccountId: z.string().optional(),
82
- userId: z.string().optional(),
83
- email: z.string().optional()
84
- });
85
- const handshakeParticipantSchema = z.object({
86
- role: z.enum(["requester", "responder"]),
87
- uaid: z.string().optional(),
88
- userId: z.string().optional(),
89
- ledgerAccountId: z.string().optional(),
90
- keyType: z.string(),
91
- longTermPublicKey: z.string().optional(),
92
- ephemeralPublicKey: z.string(),
93
- signature: z.string().optional(),
94
- metadata: z.record(jsonValueSchema).optional(),
95
- submittedAt: z.string()
96
- });
97
- const encryptionHandshakeRecordSchema = z.object({
98
- sessionId: z.string(),
99
- algorithm: z.string(),
100
- createdAt: z.string(),
101
- expiresAt: z.number(),
102
- status: z.enum(["pending", "complete"]),
103
- requester: handshakeParticipantSchema.optional(),
104
- responder: handshakeParticipantSchema.optional()
105
- });
106
- const sessionEncryptionSummarySchema = z.object({
107
- enabled: z.boolean(),
108
- algorithm: z.string(),
109
- requireCiphertext: z.boolean(),
110
- requester: peerSummarySchema.nullable().optional(),
111
- responder: peerSummarySchema.nullable().optional(),
112
- handshake: encryptionHandshakeRecordSchema.nullable().optional()
113
- });
114
- const chatHistoryEntrySchema = z.object({
115
- messageId: z.string(),
116
- role: z.enum(["user", "agent"]),
117
- content: z.string(),
118
- timestamp: z.string(),
119
- cipherEnvelope: cipherEnvelopeSchema.optional(),
120
- metadata: z.record(jsonValueSchema).optional()
121
- });
122
- const metadataFacetSchema = z.record(z.array(jsonValueSchema)).optional();
123
- const searchHitSchema = z.object({
124
- id: z.string(),
125
- uaid: z.string(),
126
- registry: z.string(),
127
- name: z.string(),
128
- description: z.string().optional(),
129
- capabilities: z.array(capabilityValueSchema),
130
- endpoints: z.union([z.record(jsonValueSchema), z.array(z.string())]).optional(),
131
- metadata: z.record(jsonValueSchema).optional(),
132
- metadataFacet: metadataFacetSchema,
133
- profile: agentProfileSchema.optional(),
134
- protocols: z.array(z.string()).optional(),
135
- adapter: z.string().optional(),
136
- originalId: z.string().optional(),
137
- communicationSupported: z.boolean().optional(),
138
- routingSupported: z.boolean().optional(),
139
- available: z.boolean().optional(),
140
- availabilityStatus: z.string().optional(),
141
- availabilityCheckedAt: z.string().optional(),
142
- availabilitySource: z.string().optional(),
143
- availabilityLatencyMs: z.number().optional(),
144
- availabilityScore: z.number().optional(),
145
- capabilityLabels: z.array(z.string()).optional(),
146
- capabilityTokens: z.array(z.string()).optional(),
147
- image: z.string().optional(),
148
- createdAt: z.string().optional(),
149
- updatedAt: z.string().optional(),
150
- lastSeen: z.string().optional(),
151
- lastIndexed: z.string().optional()
152
- }).passthrough();
153
- const searchResponseSchema = z.object({
154
- hits: z.array(searchHitSchema),
155
- total: z.number(),
156
- page: z.number(),
157
- limit: z.number()
158
- });
159
- const statsResponseSchema = z.object({
160
- totalAgents: z.number(),
161
- registries: z.record(z.number()),
162
- capabilities: z.record(z.number()),
163
- lastUpdate: z.string(),
164
- status: z.string()
165
- });
166
- const registriesResponseSchema = z.object({
167
- registries: z.array(z.string())
168
- });
169
- const popularResponseSchema = z.object({
170
- searches: z.array(z.string())
171
- });
172
- const resolveResponseSchema = z.object({
173
- agent: searchHitSchema
174
- });
175
- const createSessionResponseSchema = z.object({
176
- sessionId: z.string(),
177
- uaid: z.string().nullable().optional(),
178
- agent: z.object({
179
- name: z.string(),
180
- description: z.string().optional(),
181
- capabilities: z.record(jsonValueSchema).nullable().optional(),
182
- skills: z.array(z.string()).optional()
183
- }),
184
- history: z.array(chatHistoryEntrySchema),
185
- historyTtlSeconds: z.number().nullable().optional(),
186
- encryption: sessionEncryptionSummarySchema.nullable().optional()
187
- });
188
- const sendMessageResponseSchema = z.object({
189
- sessionId: z.string(),
190
- uaid: z.string().nullable().optional(),
191
- message: z.string(),
192
- timestamp: z.string(),
193
- rawResponse: jsonValueSchema.optional(),
194
- content: z.string().optional(),
195
- history: z.array(chatHistoryEntrySchema).optional(),
196
- historyTtlSeconds: z.number().nullable().optional(),
197
- encrypted: z.boolean().optional()
198
- });
199
- const chatHistorySnapshotResponseSchema = z.object({
200
- sessionId: z.string(),
201
- history: z.array(chatHistoryEntrySchema),
202
- historyTtlSeconds: z.number()
203
- });
204
- z.object({
205
- preserveEntries: z.number().int().min(0).optional()
206
- }).strict();
207
- const chatHistoryCompactionResponseSchema = z.object({
208
- sessionId: z.string(),
209
- history: z.array(chatHistoryEntrySchema),
210
- summaryEntry: chatHistoryEntrySchema,
211
- preservedEntries: z.array(chatHistoryEntrySchema),
212
- historyTtlSeconds: z.number(),
213
- creditsDebited: z.number(),
214
- metadata: z.record(jsonValueSchema).optional()
215
- });
216
- const sessionEncryptionStatusResponseSchema = z.object({
217
- sessionId: z.string(),
218
- encryption: sessionEncryptionSummarySchema.nullable()
219
- });
220
- const encryptionHandshakeResponseSchema = z.object({
221
- sessionId: z.string(),
222
- handshake: encryptionHandshakeRecordSchema
223
- });
224
- const registerEncryptionKeyResponseSchema = z.object({
225
- id: z.string(),
226
- keyType: z.string(),
227
- publicKey: z.string(),
228
- uaid: z.string().nullable(),
229
- ledgerAccountId: z.string().nullable(),
230
- ledgerNetwork: z.string().nullable().optional(),
231
- userId: z.string().nullable().optional(),
232
- email: z.string().nullable().optional(),
233
- createdAt: z.string(),
234
- updatedAt: z.string()
235
- });
236
- const ledgerChallengeResponseSchema = z.object({
237
- challengeId: z.string(),
238
- message: z.string(),
239
- expiresAt: z.string()
240
- });
241
- const ledgerApiKeySummarySchema = z.object({
242
- id: z.string(),
243
- label: z.string().optional(),
244
- prefix: z.string(),
245
- lastFour: z.string(),
246
- createdAt: z.string(),
247
- lastUsedAt: z.string().nullable().optional(),
248
- ownerType: z.literal("ledger"),
249
- ledgerAccountId: z.string().optional(),
250
- ledgerNetwork: z.string().optional(),
251
- ledgerNetworkCanonical: z.string().optional()
252
- });
253
- const ledgerVerifyResponseSchema = z.object({
254
- key: z.string(),
255
- apiKey: ledgerApiKeySummarySchema,
256
- accountId: z.string(),
257
- network: z.string(),
258
- networkCanonical: z.string().optional()
259
- });
260
- const protocolsResponseSchema = z.object({
261
- protocols: z.array(z.string())
262
- });
263
- const detectProtocolResponseSchema = z.object({
264
- protocol: z.string().nullable()
265
- });
266
- const registrySearchByNamespaceSchema = z.object({
267
- hits: z.array(searchHitSchema),
268
- total: z.number(),
269
- page: z.number().optional(),
270
- limit: z.number().optional()
271
- });
272
- const capabilityFilterValueSchema = z.union([z.string(), z.number()]);
273
- const vectorSearchFilterSchema = z.object({
274
- capabilities: z.array(capabilityFilterValueSchema).optional(),
275
- type: z.enum(["ai-agents", "mcp-servers"]).optional(),
276
- registry: z.string().optional(),
277
- protocols: z.array(z.string()).optional(),
278
- adapter: z.array(z.string()).optional()
279
- }).strict();
280
- z.object({
281
- query: z.string(),
282
- filter: vectorSearchFilterSchema.optional(),
283
- limit: z.number().int().min(1).max(100).optional(),
284
- offset: z.number().int().min(0).optional()
285
- }).strict();
286
- const vectorSearchHitSchema = z.object({
287
- agent: searchHitSchema,
288
- score: z.number().optional(),
289
- highlights: z.record(z.array(z.string())).optional()
290
- });
291
- const vectorSearchResponseSchema = z.object({
292
- hits: z.array(vectorSearchHitSchema),
293
- total: z.number(),
294
- took: z.number(),
295
- totalAvailable: z.number().optional(),
296
- visible: z.number().optional(),
297
- limited: z.boolean().optional(),
298
- credits_used: z.number().optional()
299
- });
300
- const vectorStatusSchema = z.object({
301
- enabled: z.boolean(),
302
- healthy: z.boolean(),
303
- mode: z.enum(["disabled", "initializing", "healthy", "degraded", "error"]),
304
- lastUpdated: z.string(),
305
- details: z.record(z.any()).optional(),
306
- lastError: z.object({
307
- message: z.string(),
308
- stack: z.string().optional(),
309
- timestamp: z.string().optional()
310
- }).optional()
311
- });
312
- const searchStatusResponseSchema = z.object({
313
- storageMode: z.string(),
314
- vectorStatus: vectorStatusSchema
315
- });
316
- const websocketStatsResponseSchema = z.object({
317
- clients: z.number(),
318
- stats: z.object({
319
- totalClients: z.number().optional(),
320
- clientsByRegistry: z.record(z.number()).optional(),
321
- clientsByEventType: z.record(z.number()).optional()
322
- }).passthrough()
323
- });
324
- const durationStatsSchema = z.object({
325
- p50: z.number(),
326
- p90: z.number(),
327
- p95: z.number(),
328
- p99: z.number()
329
- });
330
- const metricsSummaryResponseSchema = z.object({
331
- http: z.object({
332
- requestsTotal: z.number(),
333
- activeConnections: z.number(),
334
- requestDuration: durationStatsSchema
335
- }),
336
- search: z.object({
337
- queriesTotal: z.number(),
338
- queryDuration: durationStatsSchema
339
- }),
340
- indexing: z.object({ agentsTotal: z.number(), crawlErrors: z.number() }),
341
- registration: z.object({
342
- total: z.number(),
343
- failures: z.number(),
344
- duration: durationStatsSchema
345
- }),
346
- cache: z.object({
347
- hits: z.number(),
348
- misses: z.number(),
349
- hitRate: z.number()
350
- }),
351
- websocket: z.object({ connections: z.number() })
352
- });
353
- const uaidValidationResponseSchema = z.object({
354
- uaid: z.string(),
355
- valid: z.boolean(),
356
- formats: z.array(z.string())
357
- });
358
- const adapterConnectionSchema = z.object({
359
- id: z.string(),
360
- agentId: z.string(),
361
- protocol: z.string(),
362
- endpoint: z.string(),
363
- status: z.enum(["connected", "disconnected", "error"]),
364
- metadata: z.record(jsonPrimitiveSchema).optional(),
365
- createdAt: z.string()
366
- });
367
- const uaidConnectionStatusSchema = z.object({
368
- connected: z.boolean(),
369
- connection: adapterConnectionSchema.optional(),
370
- adapter: z.string().optional(),
371
- agentId: z.string().optional()
372
- });
373
- const dashboardStatsResponseSchema = z.object({
374
- operatorId: z.string().optional(),
375
- adapters: z.array(
376
- z.object({
377
- name: z.string(),
378
- version: z.string(),
379
- status: z.string(),
380
- agentCount: z.number(),
381
- lastDiscovery: z.string(),
382
- registryType: z.string(),
383
- health: z.string()
384
- })
385
- ).optional(),
386
- totalAgents: z.number().optional(),
387
- elasticsearchDocumentCount: z.number().optional(),
388
- agentsByAdapter: z.record(z.number()).optional(),
389
- agentsByRegistry: z.record(z.number()).optional(),
390
- systemInfo: z.object({
391
- uptime: z.number().optional(),
392
- version: z.string().optional(),
393
- network: z.string().optional()
394
- }).optional()
395
- });
396
- const registrationAgentSchema = z.object({
397
- id: z.string(),
398
- name: z.string(),
399
- type: z.string(),
400
- endpoint: z.string().optional(),
401
- capabilities: z.array(capabilityValueSchema),
402
- registry: z.string().optional(),
403
- protocol: z.string().optional(),
404
- profile: agentProfileSchema.optional(),
405
- nativeId: z.string().optional(),
406
- metadata: z.record(jsonValueSchema).optional()
407
- });
408
- const registrationProfileInfoSchema = z.object({
409
- tId: z.string().nullable(),
410
- sizeBytes: z.number().optional()
411
- });
412
- const profileRegistrySchema = z.object({
413
- topicId: z.string().optional(),
414
- sequenceNumber: z.number().optional(),
415
- profileReference: z.string().optional(),
416
- profileTopicId: z.string().optional()
417
- }).passthrough().nullable().optional();
418
- const additionalRegistryResultSchema = z.object({
419
- registry: z.string(),
420
- status: z.enum([
421
- "created",
422
- "duplicate",
423
- "skipped",
424
- "error",
425
- "updated",
426
- "pending"
427
- ]),
428
- agentId: z.string().nullable().optional(),
429
- agentUri: z.string().nullable().optional(),
430
- error: z.string().optional(),
431
- metadata: z.record(jsonValueSchema).optional(),
432
- registryKey: z.string().optional(),
433
- networkId: z.string().optional(),
434
- networkName: z.string().optional(),
435
- chainId: z.number().optional(),
436
- estimatedCredits: z.number().nullable().optional(),
437
- gasEstimateCredits: z.number().nullable().optional(),
438
- gasEstimateUsd: z.number().nullable().optional(),
439
- gasPriceGwei: z.number().nullable().optional(),
440
- gasLimit: z.number().nullable().optional(),
441
- creditMode: z.enum(["fixed", "gas"]).nullable().optional(),
442
- minCredits: z.number().nullable().optional(),
443
- consumedCredits: z.number().nullable().optional(),
444
- cost: z.object({
445
- credits: z.number(),
446
- usd: z.number(),
447
- eth: z.number(),
448
- gasUsedWei: z.string(),
449
- effectiveGasPriceWei: z.string().nullable().optional(),
450
- transactions: z.array(
451
- z.object({
452
- hash: z.string(),
453
- gasUsedWei: z.string(),
454
- effectiveGasPriceWei: z.string().nullable().optional(),
455
- costWei: z.string()
456
- })
457
- ).optional()
458
- }).optional()
459
- });
460
- const registrationCreditsSchema = z.object({
461
- base: z.number(),
462
- additional: z.number(),
463
- total: z.number()
464
- });
465
- const hcs10RegistrySchema = z.object({
466
- status: z.string(),
467
- uaid: z.string().optional(),
468
- transactionId: z.string().optional(),
469
- consensusTimestamp: z.string().optional(),
470
- registryTopicId: z.string().optional(),
471
- topicSequenceNumber: z.number().optional(),
472
- payloadHash: z.string().optional(),
473
- profileReference: z.string().optional(),
474
- tId: z.string().optional(),
475
- profileSizeBytes: z.number().optional(),
476
- error: z.string().optional()
477
- }).passthrough();
478
- const additionalRegistryNetworkSchema = z.object({
479
- key: z.string(),
480
- registryId: z.string().optional(),
481
- networkId: z.string().optional(),
482
- name: z.string().optional(),
483
- chainId: z.number().optional(),
484
- label: z.string().optional(),
485
- estimatedCredits: z.number().nullable().optional(),
486
- baseCredits: z.number().nullable().optional(),
487
- gasPortionCredits: z.number().nullable().optional(),
488
- gasPortionUsd: z.number().nullable().optional(),
489
- gasEstimateCredits: z.number().nullable().optional(),
490
- gasEstimateUsd: z.number().nullable().optional(),
491
- gasPriceGwei: z.number().nullable().optional(),
492
- gasLimit: z.number().nullable().optional(),
493
- minCredits: z.number().nullable().optional(),
494
- creditMode: z.string().nullable().optional()
495
- }).passthrough();
496
- const additionalRegistryDescriptorSchema = z.object({
497
- id: z.string(),
498
- label: z.string(),
499
- networks: z.array(additionalRegistryNetworkSchema)
500
- });
501
- const additionalRegistryCatalogResponseSchema = z.object({
502
- registries: z.array(additionalRegistryDescriptorSchema)
503
- });
504
- const registerAgentSuccessResponse = z.object({
505
- success: z.literal(true),
506
- status: z.enum(["created", "duplicate", "updated"]).optional(),
507
- uaid: z.string(),
508
- agentId: z.string(),
509
- message: z.string().optional(),
510
- registry: z.string().optional(),
511
- attemptId: z.string().nullable().optional(),
512
- agent: registrationAgentSchema,
513
- openConvAI: z.object({
514
- compatible: z.boolean(),
515
- hcs11Profile: agentProfileSchema.optional(),
516
- bridgeEndpoint: z.string().optional()
517
- }).optional(),
518
- profile: registrationProfileInfoSchema.optional(),
519
- profileRegistry: profileRegistrySchema.nullable().optional(),
520
- hcs10Registry: hcs10RegistrySchema.nullable().optional(),
521
- credits: registrationCreditsSchema.optional(),
522
- additionalRegistries: z.array(additionalRegistryResultSchema).optional(),
523
- additionalRegistryCredits: z.array(additionalRegistryResultSchema).optional(),
524
- additionalRegistryCostPerRegistry: z.number().optional()
525
- });
526
- const registerAgentPendingResponse = z.object({
527
- success: z.literal(true),
528
- status: z.literal("pending"),
529
- message: z.string(),
530
- uaid: z.string(),
531
- agentId: z.string(),
532
- registry: z.string().optional(),
533
- attemptId: z.string().nullable(),
534
- agent: registrationAgentSchema,
535
- openConvAI: z.object({
536
- compatible: z.boolean(),
537
- hcs11Profile: agentProfileSchema.optional(),
538
- bridgeEndpoint: z.string().optional()
539
- }).optional(),
540
- profile: registrationProfileInfoSchema.optional(),
541
- profileRegistry: profileRegistrySchema.nullable().optional(),
542
- hcs10Registry: hcs10RegistrySchema.nullable().optional(),
543
- credits: registrationCreditsSchema,
544
- additionalRegistries: z.array(additionalRegistryResultSchema),
545
- additionalRegistryCredits: z.array(additionalRegistryResultSchema).optional(),
546
- additionalRegistryCostPerRegistry: z.number().optional()
547
- });
548
- const registerAgentPartialResponse = z.object({
549
- success: z.literal(false),
550
- status: z.literal("partial"),
551
- message: z.string(),
552
- uaid: z.string(),
553
- agentId: z.string(),
554
- registry: z.string().optional(),
555
- attemptId: z.string().nullable().optional(),
556
- agent: registrationAgentSchema,
557
- openConvAI: z.object({
558
- compatible: z.boolean(),
559
- hcs11Profile: agentProfileSchema.optional(),
560
- bridgeEndpoint: z.string().optional()
561
- }).optional(),
562
- profile: registrationProfileInfoSchema.optional(),
563
- profileRegistry: profileRegistrySchema.nullable().optional(),
564
- hcs10Registry: hcs10RegistrySchema.nullable().optional(),
565
- credits: registrationCreditsSchema.optional(),
566
- additionalRegistries: z.array(additionalRegistryResultSchema).optional(),
567
- additionalRegistryCredits: z.array(additionalRegistryResultSchema).optional(),
568
- additionalRegistryCostPerRegistry: z.number().optional(),
569
- errors: z.array(
570
- z.object({
571
- registry: z.string(),
572
- registryKey: z.string().nullable().optional(),
573
- error: z.string()
574
- })
575
- ).min(1)
576
- });
577
- const registerAgentResponseSchema = z.union([
578
- registerAgentSuccessResponse,
579
- registerAgentPendingResponse,
580
- registerAgentPartialResponse
581
- ]);
582
- const registrationProgressAdditionalEntry = z.object({
583
- registryId: z.string(),
584
- registryKey: z.string(),
585
- networkId: z.string().optional(),
586
- networkName: z.string().optional(),
587
- chainId: z.number().optional(),
588
- label: z.string().optional(),
589
- status: z.enum(["pending", "in_progress", "completed", "failed"]),
590
- error: z.string().optional(),
591
- credits: z.number().nullable().optional(),
592
- agentId: z.string().nullable().optional(),
593
- agentUri: z.string().nullable().optional(),
594
- metadata: z.record(jsonValueSchema).optional(),
595
- lastUpdated: z.string()
596
- });
597
- const registrationProgressRecord = z.object({
598
- attemptId: z.string(),
599
- mode: z.enum(["register", "update"]),
600
- status: z.enum(["pending", "partial", "completed", "failed"]),
601
- uaid: z.string().optional(),
602
- agentId: z.string().optional(),
603
- registryNamespace: z.string(),
604
- accountId: z.string().optional(),
605
- startedAt: z.string(),
606
- completedAt: z.string().optional(),
607
- primary: z.object({
608
- status: z.enum(["pending", "completed", "failed"]),
609
- finishedAt: z.string().optional(),
610
- error: z.string().optional()
611
- }),
612
- additionalRegistries: z.record(
613
- z.string(),
614
- registrationProgressAdditionalEntry
615
- ),
616
- errors: z.array(z.string()).optional()
617
- });
618
- const registrationProgressResponseSchema = z.object({
619
- progress: registrationProgressRecord
620
- });
621
- const registrationQuoteResponseSchema = z.object({
622
- accountId: z.string().nullable().optional(),
623
- registry: z.string().optional(),
624
- protocol: z.string().optional(),
625
- requiredCredits: z.number(),
626
- availableCredits: z.number().nullable().optional(),
627
- shortfallCredits: z.number().nullable().optional(),
628
- creditsPerHbar: z.number().nullable().optional(),
629
- estimatedHbar: z.number().nullable().optional()
630
- });
631
- const creditPurchaseResponseSchema = z.object({
632
- success: z.boolean().optional(),
633
- purchaser: z.string(),
634
- credits: z.number(),
635
- hbarAmount: z.number(),
636
- transactionId: z.string(),
637
- consensusTimestamp: z.string().nullable().optional()
638
- });
639
- const x402SettlementSchema = z.object({
640
- success: z.boolean().optional(),
641
- transaction: z.string().optional(),
642
- network: z.string().optional(),
643
- payer: z.string().optional(),
644
- errorReason: z.string().optional()
645
- }).strict();
646
- const x402CreditPurchaseResponseSchema = z.object({
647
- success: z.boolean(),
648
- accountId: z.string(),
649
- creditedCredits: z.number(),
650
- usdAmount: z.number(),
651
- balance: z.number(),
652
- payment: z.object({
653
- payer: z.string().optional(),
654
- requirement: z.record(jsonValueSchema).optional(),
655
- settlement: x402SettlementSchema.optional()
656
- }).optional()
657
- });
658
- const x402MinimumsResponseSchema = z.object({
659
- minimums: z.record(
660
- z.object({
661
- network: z.string().optional(),
662
- gasLimit: z.number().optional(),
663
- gasPriceWei: z.string().optional(),
664
- gasUsd: z.number().optional(),
665
- minUsd: z.number().optional(),
666
- ethUsd: z.number().optional(),
667
- fetchedAt: z.string().optional(),
668
- source: z.string().optional()
669
- })
670
- ).optional(),
671
- creditUnitUsd: z.number().optional()
672
- });
673
- const adaptersResponseSchema = z.object({
674
- adapters: z.array(z.string())
675
- });
676
- const adapterChatProfileSchema = z.object({
677
- supportsChat: z.boolean(),
678
- delivery: z.string().optional(),
679
- transport: z.string().optional(),
680
- streaming: z.boolean().optional(),
681
- requiresAuth: z.array(z.string()).optional(),
682
- notes: z.string().optional()
683
- });
684
- const adapterCapabilitiesSchema = z.object({
685
- discovery: z.boolean(),
686
- routing: z.boolean(),
687
- communication: z.boolean(),
688
- translation: z.boolean(),
689
- protocols: z.array(z.string())
690
- });
691
- const adapterDescriptorSchema = z.object({
692
- id: z.string(),
693
- name: z.string(),
694
- version: z.string(),
695
- author: z.string(),
696
- description: z.string(),
697
- supportedProtocols: z.array(z.string()),
698
- registryType: z.enum(["web2", "web3", "hybrid"]),
699
- chatProfile: adapterChatProfileSchema.optional(),
700
- capabilities: adapterCapabilitiesSchema,
701
- enabled: z.boolean(),
702
- priority: z.number(),
703
- status: z.enum(["running", "stopped"])
704
- });
705
- const adapterDetailsResponseSchema = z.object({
706
- adapters: z.array(adapterDescriptorSchema)
707
- });
708
- const metadataFacetOptionSchema = z.object({
709
- value: z.union([z.string(), z.number(), z.boolean()]),
710
- label: z.string()
711
- });
712
- const searchFacetSchema = z.object({
713
- key: z.string(),
714
- label: z.string(),
715
- description: z.string().optional(),
716
- type: z.enum(["string", "boolean", "number"]),
717
- adapters: z.array(z.string()).optional(),
718
- options: z.array(metadataFacetOptionSchema).optional()
719
- });
720
- const searchFacetsResponseSchema = z.object({
721
- facets: z.array(searchFacetSchema)
722
- });
1
+ import { AccountId, Client, PrivateKey } from "@hashgraph/sdk";
2
+ import { detectKeyTypeFromString } from "./standards-sdk.es113.js";
3
+ class NodeOperatorResolver {
4
+ constructor(params) {
5
+ this.mirror = params.mirrorNode;
6
+ this.logger = params.logger;
7
+ }
8
+ /**
9
+ * Best-guess parsing for an operator key without network calls.
10
+ * - If PrivateKey: returns immediately with provided or fallback type.
11
+ * - If string with explicitType: parse directly.
12
+ * - If string without type: detect format; fallback to ECDSA.
13
+ */
14
+ bestGuessOperatorKey(operatorKeyInput, explicitType) {
15
+ if (typeof operatorKeyInput !== "string") {
16
+ return { keyType: explicitType || "ecdsa", privateKey: operatorKeyInput };
17
+ }
18
+ if (explicitType) {
19
+ const pk = explicitType === "ed25519" ? PrivateKey.fromStringED25519(operatorKeyInput) : PrivateKey.fromStringECDSA(operatorKeyInput);
20
+ return { keyType: explicitType, privateKey: pk };
21
+ }
22
+ try {
23
+ const detected = detectKeyTypeFromString(operatorKeyInput);
24
+ return {
25
+ keyType: detected.detectedType,
26
+ privateKey: detected.privateKey
27
+ };
28
+ } catch {
29
+ return {
30
+ keyType: "ecdsa",
31
+ privateKey: PrivateKey.fromStringECDSA(operatorKeyInput)
32
+ };
33
+ }
34
+ }
35
+ /**
36
+ * Resolve an operator key using Mirror Node for key type when possible.
37
+ * - If PrivateKey: return immediately.
38
+ * - If explicitType: parse directly.
39
+ * - Else: query Mirror Node; fallback to local detection.
40
+ */
41
+ async resolveOperatorKey(operatorId, operatorKeyInput, explicitType) {
42
+ if (typeof operatorKeyInput !== "string") {
43
+ return { keyType: explicitType || "ecdsa", privateKey: operatorKeyInput };
44
+ }
45
+ if (explicitType) {
46
+ const pk = explicitType === "ed25519" ? PrivateKey.fromStringED25519(operatorKeyInput) : PrivateKey.fromStringECDSA(operatorKeyInput);
47
+ return { keyType: explicitType, privateKey: pk };
48
+ }
49
+ const account = typeof operatorId === "string" ? operatorId : operatorId.toString();
50
+ try {
51
+ const info = await this.mirror.requestAccount(account);
52
+ const t = info?.key?._type || "";
53
+ const keyType = t.includes("ED25519") ? "ed25519" : "ecdsa";
54
+ const privateKey = keyType === "ed25519" ? PrivateKey.fromStringED25519(operatorKeyInput) : PrivateKey.fromStringECDSA(operatorKeyInput);
55
+ return { keyType, privateKey };
56
+ } catch {
57
+ this.logger.warn(
58
+ "Mirror node key detection failed; using local detection or default ECDSA"
59
+ );
60
+ return this.bestGuessOperatorKey(operatorKeyInput);
61
+ }
62
+ }
63
+ /**
64
+ * Resolve a supply key for the given token using Mirror Node token supply_key._type when possible.
65
+ */
66
+ async resolveSupplyKey(tokenId, keyInput, fallbackType, explicitType) {
67
+ try {
68
+ const info = await this.mirror.getTokenInfo(tokenId);
69
+ const t = info?.supply_key?._type || "";
70
+ if (typeof keyInput !== "string") {
71
+ return keyInput;
72
+ }
73
+ if (explicitType) {
74
+ return explicitType === "ed25519" ? PrivateKey.fromStringED25519(keyInput) : PrivateKey.fromStringECDSA(keyInput);
75
+ }
76
+ if (t.includes("ED25519")) {
77
+ return PrivateKey.fromStringED25519(keyInput);
78
+ }
79
+ if (t.includes("ECDSA")) {
80
+ return PrivateKey.fromStringECDSA(keyInput);
81
+ }
82
+ return fallbackType === "ed25519" ? PrivateKey.fromStringED25519(keyInput) : PrivateKey.fromStringECDSA(keyInput);
83
+ } catch {
84
+ if (typeof keyInput !== "string") {
85
+ return keyInput;
86
+ }
87
+ if (explicitType) {
88
+ return explicitType === "ed25519" ? PrivateKey.fromStringED25519(keyInput) : PrivateKey.fromStringECDSA(keyInput);
89
+ }
90
+ return fallbackType === "ed25519" ? PrivateKey.fromStringED25519(keyInput) : PrivateKey.fromStringECDSA(keyInput);
91
+ }
92
+ }
93
+ }
94
+ function createNodeOperatorContext(params) {
95
+ const operatorId = typeof params.operatorId === "string" ? AccountId.fromString(params.operatorId) : params.operatorId;
96
+ const client = params.client ? params.client : params.network === "mainnet" ? Client.forMainnet() : Client.forTestnet();
97
+ const resolver = new NodeOperatorResolver({
98
+ mirrorNode: params.mirrorNode,
99
+ logger: params.logger
100
+ });
101
+ let currentKeyType;
102
+ let currentPrivateKey;
103
+ const guess = resolver.bestGuessOperatorKey(
104
+ params.operatorKey,
105
+ params.keyType
106
+ );
107
+ currentKeyType = guess.keyType;
108
+ currentPrivateKey = guess.privateKey;
109
+ client.setOperator(operatorId.toString(), currentPrivateKey);
110
+ const initPromise = (async () => {
111
+ try {
112
+ const resolved = await resolver.resolveOperatorKey(
113
+ operatorId,
114
+ params.operatorKey,
115
+ params.keyType
116
+ );
117
+ currentKeyType = resolved.keyType;
118
+ currentPrivateKey = resolved.privateKey;
119
+ client.setOperator(operatorId.toString(), currentPrivateKey);
120
+ } catch {
121
+ }
122
+ })();
123
+ return {
124
+ client,
125
+ operatorId,
126
+ get operatorKey() {
127
+ return currentPrivateKey;
128
+ },
129
+ get keyType() {
130
+ return currentKeyType;
131
+ },
132
+ ensureInitialized: async () => {
133
+ await initPromise;
134
+ }
135
+ };
136
+ }
723
137
  export {
724
- AIAgentCapability,
725
- AIAgentType,
726
- adapterChatProfileSchema,
727
- adapterDescriptorSchema,
728
- adapterDetailsResponseSchema,
729
- adaptersResponseSchema,
730
- additionalRegistryCatalogResponseSchema,
731
- chatHistoryCompactionResponseSchema,
732
- chatHistorySnapshotResponseSchema,
733
- createSessionResponseSchema,
734
- creditPurchaseResponseSchema,
735
- dashboardStatsResponseSchema,
736
- detectProtocolResponseSchema,
737
- encryptionHandshakeResponseSchema,
738
- ledgerChallengeResponseSchema,
739
- ledgerVerifyResponseSchema,
740
- metricsSummaryResponseSchema,
741
- popularResponseSchema,
742
- protocolsResponseSchema,
743
- registerAgentResponseSchema,
744
- registerEncryptionKeyResponseSchema,
745
- registrationProgressResponseSchema,
746
- registrationQuoteResponseSchema,
747
- registriesResponseSchema,
748
- registrySearchByNamespaceSchema,
749
- resolveResponseSchema,
750
- searchFacetsResponseSchema,
751
- searchResponseSchema,
752
- searchStatusResponseSchema,
753
- sendMessageResponseSchema,
754
- sessionEncryptionStatusResponseSchema,
755
- statsResponseSchema,
756
- uaidConnectionStatusSchema,
757
- uaidValidationResponseSchema,
758
- vectorSearchResponseSchema,
759
- websocketStatsResponseSchema,
760
- x402CreditPurchaseResponseSchema,
761
- x402MinimumsResponseSchema
138
+ NodeOperatorResolver,
139
+ createNodeOperatorContext
762
140
  };
763
141
  //# sourceMappingURL=standards-sdk.es136.js.map