@hashgraphonline/standards-sdk 0.1.146-chore-jsr-improvements.canary.62a5b19.93 → 0.1.146-chore-jsr-improvements.canary.e84ef1f.95

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 (45) 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.es11.js +1 -1
  5. package/dist/es/standards-sdk.es12.js +1 -1
  6. package/dist/es/standards-sdk.es124.js +1 -1
  7. package/dist/es/standards-sdk.es125.js +1 -1
  8. package/dist/es/standards-sdk.es127.js +1 -1
  9. package/dist/es/standards-sdk.es139.js +138 -933
  10. package/dist/es/standards-sdk.es139.js.map +1 -1
  11. package/dist/es/standards-sdk.es140.js +34 -12281
  12. package/dist/es/standards-sdk.es140.js.map +1 -1
  13. package/dist/es/standards-sdk.es141.js +933 -138
  14. package/dist/es/standards-sdk.es141.js.map +1 -1
  15. package/dist/es/standards-sdk.es142.js +12280 -33
  16. package/dist/es/standards-sdk.es142.js.map +1 -1
  17. package/dist/es/standards-sdk.es16.js +1 -1
  18. package/dist/es/standards-sdk.es18.js +4 -4
  19. package/dist/es/standards-sdk.es19.js +2 -2
  20. package/dist/es/standards-sdk.es22.js +1 -1
  21. package/dist/es/standards-sdk.es27.js +3 -3
  22. package/dist/es/standards-sdk.es30.js +1 -1
  23. package/dist/es/standards-sdk.es31.js +1 -1
  24. package/dist/es/standards-sdk.es35.js +2 -2
  25. package/dist/es/standards-sdk.es36.js +3 -3
  26. package/dist/es/standards-sdk.es37.js +1 -1
  27. package/dist/es/standards-sdk.es4.js +1 -1
  28. package/dist/es/standards-sdk.es53.js +1 -1
  29. package/dist/es/standards-sdk.es60.js +2 -2
  30. package/dist/es/standards-sdk.es65.js +1 -1
  31. package/dist/es/standards-sdk.es68.js +2 -2
  32. package/dist/es/standards-sdk.es69.js +1 -1
  33. package/dist/es/standards-sdk.es7.js +1 -1
  34. package/dist/es/standards-sdk.es71.js +1 -1
  35. package/dist/es/standards-sdk.es76.js +1 -1
  36. package/dist/es/standards-sdk.es77.js +1 -1
  37. package/dist/es/standards-sdk.es78.js +1 -1
  38. package/dist/es/standards-sdk.es81.js +1 -1
  39. package/dist/es/standards-sdk.es83.js +1 -1
  40. package/dist/es/standards-sdk.es87.js +1 -1
  41. package/dist/es/standards-sdk.es91.js +1 -1
  42. package/dist/es/standards-sdk.es92.js +1 -1
  43. package/dist/es/standards-sdk.es97.js +1 -1
  44. package/dist/es/standards-sdk.es99.js +1 -1
  45. package/package.json +1 -1
@@ -1,936 +1,141 @@
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
- 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
- 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
- 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
- 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
- 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
- z.object({
307
- sessionId: z.string(),
308
- encryption: sessionEncryptionSummarySchema.nullable()
309
- });
310
- z.object({
311
- sessionId: z.string(),
312
- handshake: encryptionHandshakeRecordSchema
313
- });
314
- 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
- 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
- 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
- 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
- z.object({
458
- connected: z.boolean(),
459
- connection: adapterConnectionSchema.optional(),
460
- adapter: z.string().optional(),
461
- agentId: z.string().optional()
462
- });
463
- 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
- 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
- z.object({
709
- progress: registrationProgressRecord
710
- });
711
- 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
- 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
- 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
- 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
- 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
- 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
- z.object({
826
- network: z.string(),
827
- adapters: z.array(adapterRegistryAdapterSchema)
828
- });
829
- 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
- z.object({
839
- submissionId: z.string(),
840
- status: z.string().optional(),
841
- network: z.string().optional(),
842
- message: z.string().optional()
843
- }).passthrough();
844
- 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
- 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 { 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
+ }
910
137
  export {
911
- AIAgentCapability,
912
- AIAgentType,
913
- adapterChatProfileSchema,
914
- adapterDescriptorSchema,
915
- adapterRegistryAdapterSchema,
916
- adapterRegistryCategorySchema,
917
- additionalRegistryCatalogResponseSchema,
918
- agentFeedbackEligibilityResponseSchema,
919
- agentFeedbackEntriesIndexResponseSchema,
920
- agentFeedbackIndexResponseSchema,
921
- agentFeedbackResponseSchema,
922
- agentFeedbackSubmissionResponseSchema,
923
- detectProtocolResponseSchema,
924
- metricsSummaryResponseSchema,
925
- popularResponseSchema,
926
- protocolsResponseSchema,
927
- registriesResponseSchema,
928
- registrySearchByNamespaceSchema,
929
- searchFacetsResponseSchema,
930
- searchResponseSchema,
931
- searchStatusResponseSchema,
932
- statsResponseSchema,
933
- vectorSearchResponseSchema,
934
- websocketStatsResponseSchema
138
+ NodeOperatorResolver,
139
+ createNodeOperatorContext
935
140
  };
936
141
  //# sourceMappingURL=standards-sdk.es139.js.map