@ghostspeak/sdk 2.0.6 → 2.0.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 (117) hide show
  1. package/README.md +152 -30
  2. package/dist/GhostSpeakClient-CWmGaM9Q.d.ts +1007 -0
  3. package/dist/StakingModule-C5rzuOWb.d.ts +2526 -0
  4. package/dist/{agent-M74TCRON.js → agent-5YLZ7DAC.js} +4 -4
  5. package/dist/{agent-M74TCRON.js.map → agent-5YLZ7DAC.js.map} +1 -1
  6. package/dist/batch-operations-45CQFEID.js +4 -0
  7. package/dist/batch-operations-45CQFEID.js.map +1 -0
  8. package/dist/browser.d.ts +45 -554
  9. package/dist/browser.js +15 -842
  10. package/dist/browser.js.map +1 -1
  11. package/dist/chunk-AL3HQN73.js +754 -0
  12. package/dist/chunk-AL3HQN73.js.map +1 -0
  13. package/dist/chunk-BF3IQ35I.js +284 -0
  14. package/dist/chunk-BF3IQ35I.js.map +1 -0
  15. package/dist/chunk-BQDGRTVP.js +168 -0
  16. package/dist/chunk-BQDGRTVP.js.map +1 -0
  17. package/dist/chunk-C5CDA3WX.js +7314 -0
  18. package/dist/chunk-C5CDA3WX.js.map +1 -0
  19. package/dist/chunk-E3FD2CNY.js +1869 -0
  20. package/dist/chunk-E3FD2CNY.js.map +1 -0
  21. package/dist/{chunk-F3DZMBUA.js → chunk-G7S6B6WB.js} +327 -493
  22. package/dist/chunk-G7S6B6WB.js.map +1 -0
  23. package/dist/chunk-IHVDQ4YI.js +4231 -0
  24. package/dist/chunk-IHVDQ4YI.js.map +1 -0
  25. package/dist/chunk-JV2SWONF.js +98 -0
  26. package/dist/chunk-JV2SWONF.js.map +1 -0
  27. package/dist/chunk-KB6CKIUK.js +231 -0
  28. package/dist/chunk-KB6CKIUK.js.map +1 -0
  29. package/dist/chunk-S74EH3KD.js +7890 -0
  30. package/dist/chunk-S74EH3KD.js.map +1 -0
  31. package/dist/chunk-SFTSZ3LC.js +156 -0
  32. package/dist/chunk-SFTSZ3LC.js.map +1 -0
  33. package/dist/chunk-SKMJJ3Q6.js +125 -0
  34. package/dist/chunk-SKMJJ3Q6.js.map +1 -0
  35. package/dist/chunk-SZGFSCNU.js +3682 -0
  36. package/dist/chunk-SZGFSCNU.js.map +1 -0
  37. package/dist/chunk-TTB4OS2D.js +69 -0
  38. package/dist/chunk-TTB4OS2D.js.map +1 -0
  39. package/dist/chunk-UP2VWCW5.js +33 -0
  40. package/dist/{chunk-NSBPE2FW.js.map → chunk-UP2VWCW5.js.map} +1 -1
  41. package/dist/{chunk-UJUGGLMT.js → chunk-VQZQCHUT.js} +5 -5
  42. package/dist/{chunk-UJUGGLMT.js.map → chunk-VQZQCHUT.js.map} +1 -1
  43. package/dist/client.d.ts +5 -4
  44. package/dist/client.js +11 -10
  45. package/dist/createAgentAuthorization-ULG47ZJI.js +5 -0
  46. package/dist/createAgentAuthorization-ULG47ZJI.js.map +1 -0
  47. package/dist/credentials.js +1 -1
  48. package/dist/crypto.js +2 -2
  49. package/dist/errors.js +1 -1
  50. package/dist/feature-flags-B1g0DCPe.d.ts +1181 -0
  51. package/dist/generated-EG5USUFG.js +9 -0
  52. package/dist/{generated-VNLHMR6Y.js.map → generated-EG5USUFG.js.map} +1 -1
  53. package/dist/{ghostspeak_wasm-SB2RPJ3D.js → ghostspeak_wasm-F227HOSM.js} +3 -3
  54. package/dist/{ghostspeak_wasm-SB2RPJ3D.js.map → ghostspeak_wasm-F227HOSM.js.map} +1 -1
  55. package/dist/index.d.ts +1209 -1506
  56. package/dist/index.js +600 -3532
  57. package/dist/index.js.map +1 -1
  58. package/dist/metafile-esm.json +1 -1
  59. package/dist/minimal/core-minimal.d.ts +2383 -1264
  60. package/dist/minimal/core-minimal.js +9 -9
  61. package/dist/minimal/core-minimal.js.map +1 -1
  62. package/dist/nacl-fast-W5BJ3KZ2.js +2229 -0
  63. package/dist/nacl-fast-W5BJ3KZ2.js.map +1 -0
  64. package/dist/pda-4KP7CURF.js +4 -0
  65. package/dist/pda-4KP7CURF.js.map +1 -0
  66. package/dist/pda-Ce7VYg4T.d.ts +25 -0
  67. package/dist/reputation-types-Yebf0Rm_.d.ts +1071 -0
  68. package/dist/revokeAuthorization-OK7E7OK3.js +5 -0
  69. package/dist/revokeAuthorization-OK7E7OK3.js.map +1 -0
  70. package/dist/signature-verification-DGxR4aYQ.d.ts +448 -0
  71. package/dist/types.js +1 -1
  72. package/dist/updateReputationWithAuth-Y4ONEVSP.js +5 -0
  73. package/dist/updateReputationWithAuth-Y4ONEVSP.js.map +1 -0
  74. package/dist/utils.d.ts +69 -203
  75. package/dist/utils.js +15 -153
  76. package/dist/utils.js.map +1 -1
  77. package/package.json +24 -31
  78. package/dist/.tsbuildinfo +0 -1
  79. package/dist/GhostSpeakClient-D_66Uzsf.d.ts +0 -707
  80. package/dist/GovernanceModule-DQYYys-H.d.ts +0 -1766
  81. package/dist/chunk-APCKGD23.js +0 -1328
  82. package/dist/chunk-APCKGD23.js.map +0 -1
  83. package/dist/chunk-ASQXX4IT.js +0 -572
  84. package/dist/chunk-ASQXX4IT.js.map +0 -1
  85. package/dist/chunk-COGZFWOT.js +0 -19657
  86. package/dist/chunk-COGZFWOT.js.map +0 -1
  87. package/dist/chunk-F3DZMBUA.js.map +0 -1
  88. package/dist/chunk-GMHIUK2R.js +0 -7526
  89. package/dist/chunk-GMHIUK2R.js.map +0 -1
  90. package/dist/chunk-IAWBZYPE.js +0 -356
  91. package/dist/chunk-IAWBZYPE.js.map +0 -1
  92. package/dist/chunk-NSBPE2FW.js +0 -15
  93. package/dist/chunk-OWYHJG6H.js +0 -13311
  94. package/dist/chunk-OWYHJG6H.js.map +0 -1
  95. package/dist/chunk-RDDPOFR5.js +0 -3
  96. package/dist/chunk-RDDPOFR5.js.map +0 -1
  97. package/dist/chunk-RERCHKZP.js +0 -35
  98. package/dist/chunk-RERCHKZP.js.map +0 -1
  99. package/dist/chunk-TVVGXYCI.js +0 -2887
  100. package/dist/chunk-TVVGXYCI.js.map +0 -1
  101. package/dist/chunk-ZGP5552B.js +0 -377
  102. package/dist/chunk-ZGP5552B.js.map +0 -1
  103. package/dist/chunk-ZWOYNHVK.js +0 -196
  104. package/dist/chunk-ZWOYNHVK.js.map +0 -1
  105. package/dist/dist/.tsbuildinfo +0 -1
  106. package/dist/elgamal-VZLWB3XK.js +0 -5
  107. package/dist/elgamal-VZLWB3XK.js.map +0 -1
  108. package/dist/feature-flags-V722ZuXO.d.ts +0 -3512
  109. package/dist/generated-VNLHMR6Y.js +0 -5
  110. package/dist/ipfs-types-BOt9ZNg4.d.ts +0 -592
  111. package/dist/multisigConfig-BzEhy6jy.d.ts +0 -58
  112. package/dist/pda-B_nS8SbD.d.ts +0 -114
  113. package/dist/pda-S4BFJVGE.js +0 -4
  114. package/dist/pda-S4BFJVGE.js.map +0 -1
  115. package/dist/system-addresses-BFNLEbFx.d.ts +0 -857
  116. package/dist/token-2022-rpc-RALH4RK7.js +0 -593
  117. package/dist/token-2022-rpc-RALH4RK7.js.map +0 -1
@@ -0,0 +1,1007 @@
1
+ import { TransactionSigner } from '@solana/kit';
2
+ import { G as GovernanceProposal, V as VoteChoice } from './reputation-types-Yebf0Rm_.js';
3
+ import { Address } from '@solana/addresses';
4
+ import { W as W3CVerifiableCredential, B as BaseModule, G as GhostSpeakConfig, A as AgentModule, a as GovernanceModule, M as MultisigModule, P as PayAIClient, R as ReputationModule, D as DidModule, S as StakingModule } from './StakingModule-C5rzuOWb.js';
5
+ import { CrossmintClientOptions } from './credentials.js';
6
+ import { C as CreateAuthorizationParams, S as SigningKeypair, R as ReputationAuthorization, O as OnChainStorageConfig, A as AuthorizationStatus, k as AuthorizationWithStatus, l as AuthorizationFilter } from './signature-verification-DGxR4aYQ.js';
7
+
8
+ /**
9
+ * Privacy mode for reputation display
10
+ *
11
+ * Determines how much reputation information is publicly visible.
12
+ */
13
+ declare enum PrivacyMode {
14
+ /** Full disclosure - all reputation data is public */
15
+ Public = "Public",
16
+ /** Show only reputation tier (Bronze/Silver/Gold/Platinum) */
17
+ TierOnly = "TierOnly",
18
+ /** Show score range bucket (e.g., 750-850) */
19
+ RangeOnly = "RangeOnly",
20
+ /** Custom selective disclosure */
21
+ Custom = "Custom",
22
+ /** Fully confidential - ZK proofs required */
23
+ Confidential = "Confidential"
24
+ }
25
+ /**
26
+ * Visibility level for individual metrics
27
+ */
28
+ declare enum VisibilityLevel {
29
+ /** Visible to everyone */
30
+ Public = "Public",
31
+ /** Visible only to authorized viewers */
32
+ Private = "Private",
33
+ /** Visible only with ZK proof */
34
+ ZKProof = "ZKProof"
35
+ }
36
+ /**
37
+ * Reputation tier levels (for tier-only privacy mode)
38
+ */
39
+ declare enum ReputationTier {
40
+ None = "None",
41
+ Bronze = "Bronze",
42
+ Silver = "Silver",
43
+ Gold = "Gold",
44
+ Platinum = "Platinum"
45
+ }
46
+ /**
47
+ * Score range buckets (for range-only privacy mode)
48
+ */
49
+ declare enum ScoreRange {
50
+ VeryLow = "VeryLow",// 0-2000
51
+ Low = "Low",// 2000-5000
52
+ Medium = "Medium",// 5000-7500
53
+ High = "High",// 7500-9000
54
+ VeryHigh = "VeryHigh"
55
+ }
56
+ /**
57
+ * Selective disclosure settings for individual metrics
58
+ */
59
+ interface MetricVisibility {
60
+ /** Show exact Ghost Score */
61
+ showScore: VisibilityLevel;
62
+ /** Show total jobs completed */
63
+ showJobsCompleted: VisibilityLevel;
64
+ /** Show success rate percentage */
65
+ showSuccessRate: VisibilityLevel;
66
+ /** Show average response time */
67
+ showResponseTime: VisibilityLevel;
68
+ /** Show dispute statistics */
69
+ showDisputes: VisibilityLevel;
70
+ /** Show earnings/payment data */
71
+ showEarnings: VisibilityLevel;
72
+ /** Show client ratings */
73
+ showRatings: VisibilityLevel;
74
+ /** Show badges earned */
75
+ showBadges: VisibilityLevel;
76
+ }
77
+ /**
78
+ * Privacy settings for an agent's reputation
79
+ */
80
+ interface PrivacySettings {
81
+ /** Agent public key */
82
+ agent: Address;
83
+ /** Current privacy mode */
84
+ mode: PrivacyMode;
85
+ /** Metric-specific visibility settings */
86
+ metricVisibility: MetricVisibility;
87
+ /** List of addresses with viewing permission */
88
+ authorizedViewers: Address[];
89
+ /** Auto-grant access to clients who pay */
90
+ autoGrantClients: boolean;
91
+ /** Last updated timestamp */
92
+ updatedAt: number;
93
+ }
94
+ /**
95
+ * Privacy preset configurations
96
+ */
97
+ interface PrivacyPreset {
98
+ /** Preset name */
99
+ name: string;
100
+ /** Privacy mode */
101
+ mode: PrivacyMode;
102
+ /** Metric visibility settings */
103
+ metricVisibility: MetricVisibility;
104
+ /** Auto-grant to clients */
105
+ autoGrantClients: boolean;
106
+ }
107
+ /**
108
+ * Built-in privacy presets
109
+ */
110
+ declare const PrivacyPresets: Record<string, PrivacyPreset>;
111
+ /**
112
+ * Visible reputation data (filtered by privacy settings)
113
+ *
114
+ * This is the client-side type returned when fetching reputation
115
+ * with privacy filters applied.
116
+ */
117
+ interface VisibleReputation {
118
+ /** Agent public key */
119
+ agent: Address;
120
+ /** Privacy mode applied */
121
+ privacyMode: PrivacyMode;
122
+ /** Exact score (only if visible) */
123
+ exactScore?: number;
124
+ /** Reputation tier (always visible in TierOnly mode) */
125
+ tier?: ReputationTier;
126
+ /** Score range (visible in RangeOnly mode) */
127
+ scoreRange?: ScoreRange;
128
+ /** Total jobs completed (if visible) */
129
+ totalJobsCompleted?: number;
130
+ /** Success rate percentage (if visible) */
131
+ successRate?: number;
132
+ /** Average response time in ms (if visible) */
133
+ avgResponseTime?: number;
134
+ /** Dispute statistics (if visible) */
135
+ disputes?: {
136
+ total: number;
137
+ resolved: number;
138
+ };
139
+ /** Total earnings (if visible) */
140
+ totalEarnings?: number;
141
+ /** Average rating (if visible) */
142
+ avgRating?: number;
143
+ /** Badges earned (if visible) */
144
+ badges?: string[];
145
+ /** Whether viewer has full access */
146
+ hasFullAccess: boolean;
147
+ }
148
+ /**
149
+ * Parameters for initializing privacy settings
150
+ */
151
+ interface InitializePrivacyParams {
152
+ /** Agent address to enable privacy for */
153
+ agentAddress: Address;
154
+ /** Initial privacy mode */
155
+ mode?: PrivacyMode;
156
+ /** Metric visibility settings */
157
+ metricVisibility?: MetricVisibility;
158
+ }
159
+ /**
160
+ * Parameters for updating privacy mode
161
+ */
162
+ interface UpdatePrivacyModeParams {
163
+ /** Agent address */
164
+ agentAddress: Address;
165
+ /** New privacy mode */
166
+ mode: PrivacyMode;
167
+ }
168
+ /**
169
+ * Parameters for setting metric visibility
170
+ */
171
+ interface SetMetricVisibilityParams {
172
+ /** Agent address */
173
+ agentAddress: Address;
174
+ /** Metric visibility settings */
175
+ metricVisibility: MetricVisibility;
176
+ }
177
+ /**
178
+ * Parameters for granting viewer access
179
+ */
180
+ interface GrantAccessParams {
181
+ /** Agent address */
182
+ agentAddress: Address;
183
+ /** Viewer address to grant access */
184
+ viewer: Address;
185
+ }
186
+ /**
187
+ * Parameters for revoking viewer access
188
+ */
189
+ interface RevokeAccessParams {
190
+ /** Agent address */
191
+ agentAddress: Address;
192
+ /** Viewer address to revoke access */
193
+ viewer: Address;
194
+ }
195
+ /**
196
+ * Parameters for applying a privacy preset
197
+ */
198
+ interface ApplyPresetParams {
199
+ /** Agent address */
200
+ agentAddress: Address;
201
+ /** Preset to apply */
202
+ preset: PrivacyPreset;
203
+ }
204
+ /**
205
+ * Privacy constants
206
+ */
207
+ declare const PRIVACY_CONSTANTS: {
208
+ /** Score range thresholds */
209
+ SCORE_RANGES: {
210
+ VERY_LOW: {
211
+ min: number;
212
+ max: number;
213
+ };
214
+ LOW: {
215
+ min: number;
216
+ max: number;
217
+ };
218
+ MEDIUM: {
219
+ min: number;
220
+ max: number;
221
+ };
222
+ HIGH: {
223
+ min: number;
224
+ max: number;
225
+ };
226
+ VERY_HIGH: {
227
+ min: number;
228
+ max: number;
229
+ };
230
+ };
231
+ /** Tier thresholds */
232
+ TIER_THRESHOLDS: {
233
+ BRONZE: number;
234
+ SILVER: number;
235
+ GOLD: number;
236
+ PLATINUM: number;
237
+ };
238
+ /** Maximum authorized viewers */
239
+ MAX_AUTHORIZED_VIEWERS: number;
240
+ };
241
+
242
+ /**
243
+ * Unified Credential Service
244
+ *
245
+ * Bridges GhostSpeak's native Solana credentials with Crossmint's EVM-based VCs.
246
+ */
247
+
248
+ interface UnifiedCredentialConfig {
249
+ programId?: Address;
250
+ crossmint?: CrossmintClientOptions;
251
+ crossmintTemplates?: {
252
+ agentIdentity?: string;
253
+ reputation?: string;
254
+ jobCompletion?: string;
255
+ };
256
+ }
257
+ interface IssuedCredentialResult {
258
+ solanaCredential: {
259
+ credentialId: string;
260
+ };
261
+ w3cCredential: W3CVerifiableCredential;
262
+ crossmintSync?: {
263
+ status: 'pending' | 'synced' | 'failed';
264
+ credentialId?: string;
265
+ chain?: string;
266
+ error?: string;
267
+ };
268
+ }
269
+ declare class UnifiedCredentialService {
270
+ private config;
271
+ private credentialModule;
272
+ private crossmintClient?;
273
+ constructor(config: UnifiedCredentialConfig);
274
+ /**
275
+ * Issue an Agent Identity credential.
276
+ * Note: logic simplified for SDK usage (mocking the on-chain part for now as per original implementation)
277
+ */
278
+ issueAgentIdentityCredential(params: {
279
+ agentId: string;
280
+ owner: string;
281
+ name: string;
282
+ capabilities: string[];
283
+ serviceEndpoint: string;
284
+ frameworkOrigin: string;
285
+ x402Enabled: boolean;
286
+ registeredAt: number;
287
+ verifiedAt: number;
288
+ recipientEmail?: string;
289
+ syncToCrossmint?: boolean;
290
+ signature: Uint8Array;
291
+ }): Promise<IssuedCredentialResult>;
292
+ }
293
+
294
+ /**
295
+ * Privacy module for managing reputation privacy settings
296
+ */
297
+ declare class PrivacyModule extends BaseModule {
298
+ constructor(config: GhostSpeakConfig);
299
+ /**
300
+ * Initialize privacy settings for an agent
301
+ *
302
+ * Sets up privacy controls for an agent's reputation data.
303
+ * By default, starts in Public mode with all metrics visible.
304
+ *
305
+ * @param signer - Transaction signer (must be agent owner)
306
+ * @param params - Initialization parameters
307
+ * @returns Transaction signature
308
+ *
309
+ * @example
310
+ * ```typescript
311
+ * const signature = await privacyModule.initializePrivacy(signer, {
312
+ * agentAddress: agentPda,
313
+ * mode: PrivacyMode.TierOnly,
314
+ * metricVisibility: {
315
+ * showScore: VisibilityLevel.Private,
316
+ * showJobsCompleted: VisibilityLevel.Public,
317
+ * // ... other metrics
318
+ * }
319
+ * })
320
+ * ```
321
+ */
322
+ initializePrivacy(signer: TransactionSigner, params: InitializePrivacyParams): Promise<string>;
323
+ /**
324
+ * Update privacy mode for an agent
325
+ *
326
+ * Changes how reputation data is displayed publicly.
327
+ *
328
+ * @param signer - Transaction signer (must be agent owner)
329
+ * @param params - Update parameters
330
+ * @returns Transaction signature
331
+ *
332
+ * @example
333
+ * ```typescript
334
+ * // Switch to tier-only mode
335
+ * await privacyModule.updatePrivacyMode(signer, {
336
+ * agentAddress: agentPda,
337
+ * mode: PrivacyMode.TierOnly
338
+ * })
339
+ * ```
340
+ */
341
+ updatePrivacyMode(signer: TransactionSigner, params: UpdatePrivacyModeParams): Promise<string>;
342
+ /**
343
+ * Set metric visibility settings
344
+ *
345
+ * Configure selective disclosure for individual metrics.
346
+ * Only works in Custom privacy mode.
347
+ *
348
+ * @param signer - Transaction signer (must be agent owner)
349
+ * @param params - Metric visibility parameters
350
+ * @returns Transaction signature
351
+ *
352
+ * @example
353
+ * ```typescript
354
+ * await privacyModule.setMetricVisibility(signer, {
355
+ * agentAddress: agentPda,
356
+ * metricVisibility: {
357
+ * showScore: VisibilityLevel.Private,
358
+ * showJobsCompleted: VisibilityLevel.Public,
359
+ * showSuccessRate: VisibilityLevel.Public,
360
+ * showResponseTime: VisibilityLevel.Public,
361
+ * showDisputes: VisibilityLevel.Private,
362
+ * showEarnings: VisibilityLevel.Private,
363
+ * showRatings: VisibilityLevel.Public,
364
+ * showBadges: VisibilityLevel.Public
365
+ * }
366
+ * })
367
+ * ```
368
+ */
369
+ setMetricVisibility(signer: TransactionSigner, params: SetMetricVisibilityParams): Promise<string>;
370
+ /**
371
+ * Grant viewer access to private reputation data
372
+ *
373
+ * Adds an address to the authorized viewers list, giving them
374
+ * full access to all private metrics.
375
+ *
376
+ * @param signer - Transaction signer (must be agent owner)
377
+ * @param params - Grant access parameters
378
+ * @returns Transaction signature
379
+ *
380
+ * @example
381
+ * ```typescript
382
+ * // Grant access to a client
383
+ * await privacyModule.grantAccess(signer, {
384
+ * agentAddress: agentPda,
385
+ * viewer: clientAddress
386
+ * })
387
+ * ```
388
+ */
389
+ grantAccess(signer: TransactionSigner, params: GrantAccessParams): Promise<string>;
390
+ /**
391
+ * Revoke viewer access to private reputation data
392
+ *
393
+ * Removes an address from the authorized viewers list.
394
+ *
395
+ * @param signer - Transaction signer (must be agent owner)
396
+ * @param params - Revoke access parameters
397
+ * @returns Transaction signature
398
+ *
399
+ * @example
400
+ * ```typescript
401
+ * // Revoke access from a viewer
402
+ * await privacyModule.revokeAccess(signer, {
403
+ * agentAddress: agentPda,
404
+ * viewer: viewerAddress
405
+ * })
406
+ * ```
407
+ */
408
+ revokeAccess(signer: TransactionSigner, params: RevokeAccessParams): Promise<string>;
409
+ /**
410
+ * Apply a privacy preset
411
+ *
412
+ * Quickly configure privacy settings using a predefined preset
413
+ * (Conservative, Balanced, or Open).
414
+ *
415
+ * @param signer - Transaction signer (must be agent owner)
416
+ * @param params - Preset parameters
417
+ * @returns Transaction signature
418
+ *
419
+ * @example
420
+ * ```typescript
421
+ * // Apply balanced preset
422
+ * await privacyModule.applyPreset(signer, {
423
+ * agentAddress: agentPda,
424
+ * preset: PrivacyPresets.BALANCED
425
+ * })
426
+ * ```
427
+ */
428
+ applyPreset(signer: TransactionSigner, params: ApplyPresetParams): Promise<string>;
429
+ /**
430
+ * Get privacy settings for an agent
431
+ *
432
+ * Fetches the current privacy configuration.
433
+ *
434
+ * @param agentAddress - Agent address
435
+ * @returns Privacy settings or null if not initialized
436
+ *
437
+ * @example
438
+ * ```typescript
439
+ * const settings = await privacyModule.getPrivacySettings(agentPda)
440
+ * if (settings) {
441
+ * console.log('Privacy mode:', settings.mode)
442
+ * console.log('Authorized viewers:', settings.authorizedViewers.length)
443
+ * }
444
+ * ```
445
+ */
446
+ getPrivacySettings(agentAddress: Address): Promise<PrivacySettings | null>;
447
+ /**
448
+ * Get visible reputation data (privacy-filtered)
449
+ *
450
+ * Fetches reputation data and applies privacy filters based on
451
+ * the viewer's access level.
452
+ *
453
+ * @param agentAddress - Agent address
454
+ * @param viewerAddress - Viewer address (for access check)
455
+ * @returns Privacy-filtered reputation data
456
+ *
457
+ * @example
458
+ * ```typescript
459
+ * // Get visible reputation for a specific viewer
460
+ * const visibleRep = await privacyModule.getVisibleReputation(
461
+ * agentPda,
462
+ * viewerAddress
463
+ * )
464
+ *
465
+ * console.log('Tier:', visibleRep.tier)
466
+ * console.log('Exact score:', visibleRep.exactScore) // Only if visible
467
+ * console.log('Has full access:', visibleRep.hasFullAccess)
468
+ * ```
469
+ */
470
+ getVisibleReputation(agentAddress: Address, viewerAddress: Address): Promise<VisibleReputation>;
471
+ /**
472
+ * Validate privacy settings before applying
473
+ *
474
+ * @param settings - Privacy settings to validate
475
+ * @returns Validation result
476
+ */
477
+ validateSettings(settings: PrivacySettings): {
478
+ valid: boolean;
479
+ errors: string[];
480
+ };
481
+ /**
482
+ * Get available privacy presets
483
+ *
484
+ * @returns Record of available presets
485
+ */
486
+ getAvailablePresets(): Record<string, PrivacyPreset>;
487
+ /**
488
+ * Get default metric visibility for a privacy mode
489
+ *
490
+ * @param mode - Privacy mode
491
+ * @returns Default metric visibility
492
+ */
493
+ getDefaultVisibility(mode: PrivacyMode): MetricVisibility;
494
+ /**
495
+ * Calculate reputation tier from score
496
+ *
497
+ * @param score - Reputation score
498
+ * @returns Reputation tier
499
+ */
500
+ getTier(score: number): ReputationTier;
501
+ /**
502
+ * Calculate score range from score
503
+ *
504
+ * @param score - Reputation score
505
+ * @returns Score range
506
+ */
507
+ getRange(score: number): ScoreRange;
508
+ private derivePrivacyPda;
509
+ }
510
+
511
+ /**
512
+ * Authorization Module - Agent Pre-Authorization System
513
+ *
514
+ * GhostSpeak's trustless system for agents to pre-authorize facilitators
515
+ * (e.g., PayAI) to update their reputation with built-in security limits.
516
+ *
517
+ * @module AuthorizationModule
518
+ */
519
+
520
+ /**
521
+ * Authorization Module
522
+ *
523
+ * Manages agent pre-authorizations for reputation updates.
524
+ */
525
+ declare class AuthorizationModule extends BaseModule {
526
+ constructor(config: GhostSpeakConfig);
527
+ /**
528
+ * Create a signed authorization for a facilitator
529
+ *
530
+ * @param params - Authorization parameters
531
+ * @param agentKeypair - Agent's keypair for signing
532
+ * @returns Signed authorization
533
+ *
534
+ * @example
535
+ * ```typescript
536
+ * const authorization = await client.authorization.createAuthorization({
537
+ * authorizedSource: payAIFacilitatorAddress,
538
+ * indexLimit: 1000, // Allow 1000 reputation updates
539
+ * expiresIn: 30 * 24 * 60 * 60, // 30 days
540
+ * network: 'devnet',
541
+ * }, agentKeypair)
542
+ * ```
543
+ */
544
+ createAuthorization(params: CreateAuthorizationParams, agentKeypair: SigningKeypair): Promise<ReputationAuthorization>;
545
+ /**
546
+ * Store authorization on-chain (optional, ~0.002 SOL fee)
547
+ *
548
+ * Creates a PDA account storing the authorization for on-chain verification.
549
+ * This provides an immutable audit trail but costs rent (~0.002 SOL).
550
+ *
551
+ * **Cost vs Benefit:**
552
+ * - Off-chain (default): Free, but requires sharing signed authorization
553
+ * - On-chain: ~0.002 SOL, provides transparent audit trail
554
+ *
555
+ * **When to use on-chain storage:**
556
+ * - High-value authorizations where transparency is critical
557
+ * - Compliance/audit requirements
558
+ * - Public agent reputation systems
559
+ *
560
+ * @param authorization - Authorization to store
561
+ * @param agentSigner - Agent's signer (or facilitator if they pay fee)
562
+ * @param config - Optional storage configuration
563
+ * @returns Transaction signature
564
+ *
565
+ * @example
566
+ * ```typescript
567
+ * // Default: Agent pays ~0.002 SOL
568
+ * const sig = await client.authorization.storeAuthorizationOnChain(auth, agentSigner)
569
+ *
570
+ * // Custom fee structure
571
+ * const sig = await client.authorization.storeAuthorizationOnChain(auth, agentSigner, {
572
+ * storageFee: 1500000n, // 0.0015 SOL
573
+ * feePayedByAgent: false // Facilitator pays
574
+ * })
575
+ * ```
576
+ */
577
+ storeAuthorizationOnChain(authorization: ReputationAuthorization, agentSigner: TransactionSigner, config?: Partial<OnChainStorageConfig>): Promise<string>;
578
+ /**
579
+ * Verify authorization signature
580
+ *
581
+ * @param authorization - Authorization to verify
582
+ * @returns True if signature is valid
583
+ *
584
+ * @example
585
+ * ```typescript
586
+ * const isValid = await client.authorization.verifySignature(authorization)
587
+ * if (!isValid) {
588
+ * throw new Error('Invalid authorization signature')
589
+ * }
590
+ * ```
591
+ */
592
+ verifySignature(authorization: ReputationAuthorization): Promise<boolean>;
593
+ /**
594
+ * Check authorization status (without on-chain call)
595
+ *
596
+ * @param authorization - Authorization to check
597
+ * @param currentIndex - Current usage count (optional, defaults to authorization.currentIndex)
598
+ * @returns Authorization status
599
+ */
600
+ getAuthorizationStatus(authorization: ReputationAuthorization, currentIndex?: number): {
601
+ status: AuthorizationStatus;
602
+ isValid: boolean;
603
+ remainingUses: number;
604
+ reason?: string;
605
+ };
606
+ /**
607
+ * Fetch authorization from on-chain PDA
608
+ *
609
+ * @param agentAddress - Agent's address
610
+ * @param authorizedSource - Authorized source address
611
+ * @param nonce - Optional nonce (must match creation)
612
+ * @returns Authorization with current on-chain status
613
+ */
614
+ fetchAuthorization(agentAddress: Address, authorizedSource: Address, nonce?: string): Promise<AuthorizationWithStatus | null>;
615
+ /**
616
+ * Update reputation using authorization
617
+ *
618
+ * Called by facilitators (e.g., PayAI) to update agent reputation
619
+ * using a pre-signed authorization.
620
+ *
621
+ * @param authorization - Authorization to use
622
+ * @param reputationChange - Reputation change to apply
623
+ * @param transactionSignature - Transaction signature for audit trail
624
+ * @param usageRecord - PDA for usage record (audit trail)
625
+ * @param metadata - Optional metadata
626
+ * @param facilitatorSigner - Facilitator's signer
627
+ * @returns Transaction signature
628
+ */
629
+ updateReputationWithAuth(authorization: ReputationAuthorization, reputationChange: number, transactionSignature: string, usageRecord: Address, metadata: Record<string, unknown> | undefined, facilitatorSigner: TransactionSigner): Promise<string>;
630
+ /**
631
+ * Revoke authorization
632
+ *
633
+ * Agent can revoke an authorization before it expires or is exhausted.
634
+ *
635
+ * @param agentAddress - Agent's address
636
+ * @param authorization - Authorization account PDA
637
+ * @param nonce - Optional nonce (must match creation)
638
+ * @param agentSigner - Agent's signer
639
+ * @returns Transaction signature
640
+ */
641
+ revokeAuthorization(agentAddress: Address, authorization: Address, nonce: string | undefined, agentSigner: TransactionSigner): Promise<string>;
642
+ /**
643
+ * List authorizations for an agent (filtering)
644
+ *
645
+ * @param filter - Filter criteria
646
+ * @returns List of authorizations
647
+ */
648
+ listAuthorizations(filter: AuthorizationFilter): Promise<AuthorizationWithStatus[]>;
649
+ /**
650
+ * Serialize authorization for storage/transmission
651
+ *
652
+ * @param authorization - Authorization to serialize
653
+ * @returns JSON-safe object
654
+ */
655
+ serializeAuthorization(authorization: ReputationAuthorization): Record<string, unknown>;
656
+ /**
657
+ * Deserialize authorization from storage/transmission
658
+ *
659
+ * @param data - Serialized authorization data
660
+ * @returns Authorization object
661
+ */
662
+ deserializeAuthorization(data: Record<string, unknown>): ReputationAuthorization;
663
+ /**
664
+ * Get authorization ID (deterministic hash)
665
+ *
666
+ * @param authorization - Authorization to hash
667
+ * @returns Base58-encoded hash
668
+ */
669
+ getAuthorizationId(authorization: ReputationAuthorization): Promise<string>;
670
+ /**
671
+ * Helper: Create authorization for PayAI facilitator
672
+ *
673
+ * Convenience method with sensible defaults for PayAI integration.
674
+ *
675
+ * @param payAIFacilitatorAddress - PayAI facilitator address
676
+ * @param agentKeypair - Agent's keypair
677
+ * @param options - Optional overrides
678
+ * @returns Signed authorization
679
+ *
680
+ * @example
681
+ * ```typescript
682
+ * const auth = await client.authorization.createPayAIAuthorization(
683
+ * 'PayAI...FacilitatorAddress',
684
+ * agentKeypair,
685
+ * { indexLimit: 5000 } // Optional overrides
686
+ * )
687
+ * ```
688
+ */
689
+ createPayAIAuthorization(payAIFacilitatorAddress: Address, agentKeypair: SigningKeypair, options?: Partial<CreateAuthorizationParams>): Promise<ReputationAuthorization>;
690
+ /**
691
+ * Calculate storage fee based on authorization duration and custom fees
692
+ *
693
+ * @param authorization - Authorization to calculate fee for
694
+ * @param config - Storage configuration
695
+ * @returns Fee in lamports
696
+ *
697
+ * @example
698
+ * ```typescript
699
+ * // Default fee: 0.002 SOL
700
+ * const fee = module.calculateStorageFee(auth)
701
+ *
702
+ * // Custom fee for 30-day authorizations: 0.001 SOL
703
+ * const fee = module.calculateStorageFee(auth, {
704
+ * customFees: { 2592000: 1000000n } // 30 days = 0.001 SOL
705
+ * })
706
+ * ```
707
+ */
708
+ private calculateStorageFee;
709
+ /**
710
+ * Estimate on-chain storage cost for an authorization
711
+ *
712
+ * @param params - Authorization parameters
713
+ * @param config - Optional storage configuration
714
+ * @returns Estimated cost in SOL
715
+ *
716
+ * @example
717
+ * ```typescript
718
+ * const costInSOL = await client.authorization.estimateStorageCost({
719
+ * authorizedSource: facilitatorAddress,
720
+ * expiresIn: 30 * 24 * 60 * 60 // 30 days
721
+ * })
722
+ * console.log(`On-chain storage will cost ${costInSOL} SOL`)
723
+ * ```
724
+ */
725
+ estimateStorageCost(params: CreateAuthorizationParams, config?: Partial<OnChainStorageConfig>): Promise<number>;
726
+ }
727
+
728
+ /**
729
+ * Main GhostSpeak client with fluent API design
730
+ *
731
+ * Example usage:
732
+ * ```typescript
733
+ * const ghostspeak = new GhostSpeak()
734
+ *
735
+ * // Create an agent
736
+ * const agent = await ghostspeak
737
+ * .agent()
738
+ * .create({ name: "My Agent", capabilities: ["coding"] })
739
+ * .compressed()
740
+ * .execute()
741
+ *
742
+ * ```
743
+ */
744
+ declare class GhostSpeakClient {
745
+ private config;
746
+ constructor(config?: Partial<GhostSpeakConfig>);
747
+ /**
748
+ * Direct access to Agent Module for read operations
749
+ */
750
+ get agents(): AgentModule;
751
+ /**
752
+ * Direct access to Governance Module for read operations
753
+ */
754
+ get governanceModule(): GovernanceModule;
755
+ /**
756
+ * Direct access to Multisig Module for read operations
757
+ */
758
+ get multisigModule(): MultisigModule;
759
+ /**
760
+ * Agent operations
761
+ */
762
+ agent(): AgentBuilder;
763
+ /**
764
+ * PayAI operations (x402 payments)
765
+ */
766
+ payai(): PayAIClient;
767
+ /**
768
+ * Reputation operations
769
+ */
770
+ reputation(): ReputationModule;
771
+ /**
772
+ * Reputation Tag Engine (Pillar 2: Granular Tags)
773
+ *
774
+ * Automatic tag assignment and management based on agent metrics.
775
+ * Features confidence scoring, evidence tracking, and tag decay.
776
+ */
777
+ tagEngine(): any;
778
+ /**
779
+ * Multi-Source Reputation Aggregator (Pillar 3: External Sources)
780
+ *
781
+ * Aggregate reputation data from multiple sources (PayAI, GitHub, custom webhooks)
782
+ * with weighted scoring and conflict detection.
783
+ */
784
+ reputationAggregator(): any;
785
+ /**
786
+ * Privacy operations
787
+ */
788
+ privacy(): PrivacyModule;
789
+ /**
790
+ * Governance operations
791
+ */
792
+ governance(): GovernanceBuilder;
793
+ /**
794
+ * Multisig operations
795
+ */
796
+ multisig(): MultisigBuilder;
797
+ /**
798
+ * Unified Credential operations (Solana + Crossmint)
799
+ */
800
+ credentials(): UnifiedCredentialService;
801
+ /**
802
+ * DID operations (Decentralized Identifiers)
803
+ */
804
+ did(): DidModule;
805
+ /**
806
+ * Direct access to Authorization Module for read operations
807
+ */
808
+ get authorization(): AuthorizationModule;
809
+ /**
810
+ * Direct access to Staking Module for read operations
811
+ */
812
+ get staking(): StakingModule;
813
+ /**
814
+ * Enable development mode features
815
+ */
816
+ enableDevMode(): this;
817
+ /**
818
+ * Configure network
819
+ */
820
+ useNetwork(cluster: 'mainnet-beta' | 'devnet' | 'testnet' | 'localnet'): this;
821
+ /**
822
+ * Configure custom RPC
823
+ */
824
+ useRpc(endpoint: string, wsEndpoint?: string): this;
825
+ /**
826
+ * Get default RPC endpoint for cluster
827
+ */
828
+ private getDefaultRpcEndpoint;
829
+ }
830
+ /**
831
+ * Agent builder for fluent API
832
+ */
833
+ declare class AgentBuilder {
834
+ private module;
835
+ private params;
836
+ constructor(config: GhostSpeakConfig);
837
+ create(params: {
838
+ name: string;
839
+ description?: string;
840
+ capabilities: string[];
841
+ }): this;
842
+ withDescription(description: string): this;
843
+ withType(agentType: number): this;
844
+ withIPFS(): this;
845
+ compressed(): this;
846
+ debug(): this;
847
+ withSigner(signer: TransactionSigner): this;
848
+ private validateParams;
849
+ getCost(): Promise<bigint>;
850
+ simulate(): Promise<unknown>;
851
+ explain(): Promise<string>;
852
+ execute(): Promise<{
853
+ address: Address;
854
+ signature: string;
855
+ }>;
856
+ private deriveAgentAddress;
857
+ }
858
+ /**
859
+ * Channel builder parameters interface
860
+ */
861
+ /**
862
+ * Marketplace builder for fluent API
863
+ */
864
+ /**
865
+ * Governance builder for fluent API
866
+ */
867
+ declare class GovernanceBuilder {
868
+ private module;
869
+ private params;
870
+ constructor(config: GhostSpeakConfig);
871
+ /**
872
+ * Create a governance proposal
873
+ */
874
+ proposal(): ProposalBuilder;
875
+ /**
876
+ * Get governance queries
877
+ */
878
+ query(): GovernanceQuery;
879
+ debug(): this;
880
+ withSigner(signer: TransactionSigner): this;
881
+ }
882
+ /**
883
+ * Governance builder parameters interface
884
+ */
885
+ interface GovernanceBuilderParams {
886
+ signer?: TransactionSigner;
887
+ }
888
+ /**
889
+ * Proposal builder for fluent API
890
+ */
891
+ declare class ProposalBuilder {
892
+ private module;
893
+ private builderParams;
894
+ private params;
895
+ constructor(module: GovernanceModule, builderParams: GovernanceBuilderParams);
896
+ create(params: {
897
+ title: string;
898
+ description: string;
899
+ }): this;
900
+ type(proposalType: 'parameter_change' | 'upgrade' | 'treasury'): this;
901
+ votingDuration(hours: number): this;
902
+ executionDelay(hours: number): this;
903
+ private validateParams;
904
+ execute(): Promise<{
905
+ address: Address;
906
+ signature: string;
907
+ }>;
908
+ withSigner(signer: TransactionSigner): this;
909
+ }
910
+ /**
911
+ * Governance query helper
912
+ */
913
+ declare class GovernanceQuery {
914
+ private module;
915
+ constructor(module: GovernanceModule);
916
+ activeProposals(): Promise<{
917
+ address: Address;
918
+ data: GovernanceProposal;
919
+ }[]>;
920
+ proposalsByProposer(proposer: Address): Promise<{
921
+ address: Address;
922
+ data: GovernanceProposal;
923
+ }[]>;
924
+ proposalsByStatus(status: 'draft' | 'voting' | 'succeeded' | 'defeated' | 'executed'): Promise<{
925
+ address: Address;
926
+ data: GovernanceProposal;
927
+ }[]>;
928
+ }
929
+ /**
930
+ * Multisig builder for fluent API
931
+ */
932
+ declare class MultisigBuilder {
933
+ private module;
934
+ private params;
935
+ constructor(config: GhostSpeakConfig);
936
+ create(): CreateMultisigBuilder;
937
+ proposal(): MultisigProposalBuilder;
938
+ approve(): MultisigApproveBuilder;
939
+ executeProposal(): MultisigExecuteBuilder;
940
+ withSigner(signer: TransactionSigner): this;
941
+ debug(): this;
942
+ }
943
+ interface MultisigBuilderParams {
944
+ signer?: TransactionSigner;
945
+ }
946
+ declare class CreateMultisigBuilder {
947
+ private module;
948
+ private builderParams;
949
+ private params;
950
+ constructor(module: MultisigModule, builderParams: MultisigBuilderParams);
951
+ withId(id: bigint): this;
952
+ threshold(t: number): this;
953
+ signers(s: Address[]): this;
954
+ execute(): Promise<{
955
+ signature: string;
956
+ }>;
957
+ withSigner(signer: TransactionSigner): this;
958
+ }
959
+ declare class MultisigProposalBuilder {
960
+ private module;
961
+ private builderParams;
962
+ private params;
963
+ constructor(module: MultisigModule, builderParams: MultisigBuilderParams);
964
+ forMultisig(address: Address): this;
965
+ title(t: string): this;
966
+ description(d: string): this;
967
+ execute(): Promise<{
968
+ signature: string;
969
+ }>;
970
+ withSigner(signer: TransactionSigner): this;
971
+ }
972
+ declare class MultisigApproveBuilder {
973
+ private module;
974
+ private builderParams;
975
+ private params;
976
+ constructor(module: MultisigModule, builderParams: MultisigBuilderParams);
977
+ proposal(address: Address): this;
978
+ vote(choice: VoteChoice): this;
979
+ reason(text: string): this;
980
+ tokenAccount(account: Address): this;
981
+ execute(): Promise<{
982
+ signature: string;
983
+ }>;
984
+ withSigner(signer: TransactionSigner): this;
985
+ }
986
+ declare class MultisigExecuteBuilder {
987
+ private module;
988
+ private builderParams;
989
+ private params;
990
+ constructor(module: MultisigModule, builderParams: MultisigBuilderParams);
991
+ proposal(address: Address): this;
992
+ target(programId: Address): this;
993
+ execute(): Promise<{
994
+ signature: string;
995
+ }>;
996
+ withSigner(signer: TransactionSigner): this;
997
+ }
998
+ /**
999
+ * Convert SOL to lamports
1000
+ */
1001
+ declare function sol(amount: number): bigint;
1002
+ /**
1003
+ * Convert lamports to SOL
1004
+ */
1005
+ declare function lamportsToSol(lamports: bigint): number;
1006
+
1007
+ export { AuthorizationModule as A, GhostSpeakClient as G, type InitializePrivacyParams as I, type MetricVisibility as M, PrivacyMode as P, ReputationTier as R, ScoreRange as S, type UpdatePrivacyModeParams as U, type VisibleReputation as V, type PrivacySettings as a, PrivacyModule as b, VisibilityLevel as c, PrivacyPresets as d, PRIVACY_CONSTANTS as e, type PrivacyPreset as f, type SetMetricVisibilityParams as g, type GrantAccessParams as h, type RevokeAccessParams as i, type ApplyPresetParams as j, UnifiedCredentialService as k, lamportsToSol as l, type UnifiedCredentialConfig as m, type IssuedCredentialResult as n, sol as s };