@ghostspeak/sdk 2.0.7 → 2.0.8
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.
- package/README.md +145 -2
- package/dist/{GhostSpeakClient-CWmGaM9Q.d.ts → GhostSpeakClient-bnXwUPHI.d.ts} +10 -6
- package/dist/{StakingModule-C5rzuOWb.d.ts → StakingModule-DunDShLq.d.ts} +263 -343
- package/dist/{agent-5YLZ7DAC.js → agent-S42FIMR7.js} +3 -3
- package/dist/{agent-5YLZ7DAC.js.map → agent-S42FIMR7.js.map} +1 -1
- package/dist/browser-CI5_6Gzk.d.ts +234 -0
- package/dist/browser.d.ts +3 -64
- package/dist/browser.js +9 -9
- package/dist/{chunk-SFTSZ3LC.js → chunk-46QWY3MG.js} +3 -3
- package/dist/{chunk-SFTSZ3LC.js.map → chunk-46QWY3MG.js.map} +1 -1
- package/dist/{chunk-G7S6B6WB.js → chunk-5QBSC4T4.js} +7 -7
- package/dist/{chunk-G7S6B6WB.js.map → chunk-5QBSC4T4.js.map} +1 -1
- package/dist/{chunk-IHVDQ4YI.js → chunk-5QZVFUXB.js} +201 -256
- package/dist/chunk-5QZVFUXB.js.map +1 -0
- package/dist/{chunk-E3FD2CNY.js → chunk-6XCCMJ6M.js} +19 -23
- package/dist/chunk-6XCCMJ6M.js.map +1 -0
- package/dist/{chunk-JV2SWONF.js → chunk-A7ALCVUI.js} +3 -3
- package/dist/{chunk-JV2SWONF.js.map → chunk-A7ALCVUI.js.map} +1 -1
- package/dist/{chunk-AL3HQN73.js → chunk-AWMGX3OX.js} +172 -112
- package/dist/chunk-AWMGX3OX.js.map +1 -0
- package/dist/{chunk-S74EH3KD.js → chunk-IQM5RASO.js} +637 -25
- package/dist/chunk-IQM5RASO.js.map +1 -0
- package/dist/{chunk-SZGFSCNU.js → chunk-JYXSOXCP.js} +467 -299
- package/dist/chunk-JYXSOXCP.js.map +1 -0
- package/dist/{chunk-C5CDA3WX.js → chunk-OXA7MECJ.js} +476 -3
- package/dist/chunk-OXA7MECJ.js.map +1 -0
- package/dist/{chunk-KB6CKIUK.js → chunk-QLRWUHN2.js} +3 -3
- package/dist/{chunk-KB6CKIUK.js.map → chunk-QLRWUHN2.js.map} +1 -1
- package/dist/client.d.ts +2 -3
- package/dist/client.js +9 -9
- package/dist/{createAgentAuthorization-ULG47ZJI.js → createAgentAuthorization-KGZNXZBT.js} +4 -4
- package/dist/{createAgentAuthorization-ULG47ZJI.js.map → createAgentAuthorization-KGZNXZBT.js.map} +1 -1
- package/dist/generated-QJREJQ2C.js +9 -0
- package/dist/{generated-EG5USUFG.js.map → generated-QJREJQ2C.js.map} +1 -1
- package/dist/index.d.ts +209 -231
- package/dist/index.js +231 -521
- package/dist/index.js.map +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/minimal/core-minimal.d.ts +266 -184
- package/dist/minimal/core-minimal.js +6 -6
- package/dist/minimal/core-minimal.js.map +1 -1
- package/dist/{revokeAuthorization-OK7E7OK3.js → revokeAuthorization-2ZRO6GUZ.js} +4 -4
- package/dist/{revokeAuthorization-OK7E7OK3.js.map → revokeAuthorization-2ZRO6GUZ.js.map} +1 -1
- package/dist/{updateReputationWithAuth-Y4ONEVSP.js → updateReputationWithAuth-PCEUOCFV.js} +4 -4
- package/dist/{updateReputationWithAuth-Y4ONEVSP.js.map → updateReputationWithAuth-PCEUOCFV.js.map} +1 -1
- package/dist/utils.js +9 -9
- package/package.json +4 -4
- package/dist/chunk-AL3HQN73.js.map +0 -1
- package/dist/chunk-C5CDA3WX.js.map +0 -1
- package/dist/chunk-E3FD2CNY.js.map +0 -1
- package/dist/chunk-IHVDQ4YI.js.map +0 -1
- package/dist/chunk-S74EH3KD.js.map +0 -1
- package/dist/chunk-SZGFSCNU.js.map +0 -1
- package/dist/generated-EG5USUFG.js +0 -9
package/README.md
CHANGED
|
@@ -374,7 +374,150 @@ console.log(`Remaining uses: ${status.remainingUses}/${authorization.indexLimit}
|
|
|
374
374
|
|
|
375
375
|
**See:** [Authorization Storage Guide](./docs/AUTHORIZATION_STORAGE.md) for complete documentation.
|
|
376
376
|
|
|
377
|
-
### **9.
|
|
377
|
+
### **9. External ID Resolution (REST API)** 🆕
|
|
378
|
+
|
|
379
|
+
Resolve cross-platform identities to Ghost addresses using the GhostSpeak Public API. Faster than on-chain lookups for read operations.
|
|
380
|
+
|
|
381
|
+
```typescript
|
|
382
|
+
import { ExternalIdResolver } from '@ghostspeak/sdk'
|
|
383
|
+
|
|
384
|
+
// Initialize resolver for devnet
|
|
385
|
+
const resolver = new ExternalIdResolver({
|
|
386
|
+
cluster: 'devnet' // Uses https://api-devnet.ghostspeak.ai
|
|
387
|
+
})
|
|
388
|
+
|
|
389
|
+
// Production mainnet
|
|
390
|
+
const mainnetResolver = new ExternalIdResolver({
|
|
391
|
+
cluster: 'mainnet-beta' // Uses https://api.ghostspeak.ai
|
|
392
|
+
})
|
|
393
|
+
|
|
394
|
+
// Custom API URL
|
|
395
|
+
const customResolver = new ExternalIdResolver({
|
|
396
|
+
apiUrl: 'https://custom-api.example.com'
|
|
397
|
+
})
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
#### **Resolve External IDs to Ghost Addresses**
|
|
401
|
+
|
|
402
|
+
```typescript
|
|
403
|
+
// Quick resolve - returns Ghost address
|
|
404
|
+
const ghostAddress = await resolver.resolve('payai', 'agent-123')
|
|
405
|
+
console.log(`Ghost Address: ${ghostAddress}`)
|
|
406
|
+
|
|
407
|
+
// Full lookup - returns mapping + Ghost data
|
|
408
|
+
const result = await resolver.lookup('payai', 'agent-123')
|
|
409
|
+
console.log(`Platform: ${result.mapping.platform}`)
|
|
410
|
+
console.log(`External ID: ${result.mapping.externalId}`)
|
|
411
|
+
console.log(`Ghost Address: ${result.mapping.ghostAddress}`)
|
|
412
|
+
console.log(`Verified: ${result.mapping.verified}`)
|
|
413
|
+
|
|
414
|
+
if (result.ghost) {
|
|
415
|
+
console.log(`Name: ${result.ghost.name}`)
|
|
416
|
+
console.log(`Ghost Score: ${result.ghost.ghostScore}`)
|
|
417
|
+
console.log(`Status: ${result.ghost.status}`)
|
|
418
|
+
}
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
#### **Fetch Ghost Data via API**
|
|
422
|
+
|
|
423
|
+
```typescript
|
|
424
|
+
// Get full Ghost profile (faster than on-chain query)
|
|
425
|
+
const ghost = await resolver.getGhost(ghostAddress)
|
|
426
|
+
console.log(`Agent: ${ghost.name}`)
|
|
427
|
+
console.log(`Owner: ${ghost.owner}`)
|
|
428
|
+
console.log(`Reputation: ${ghost.reputationScore}`)
|
|
429
|
+
console.log(`External IDs:`, ghost.externalIdentifiers)
|
|
430
|
+
|
|
431
|
+
// Get Ghost Score breakdown
|
|
432
|
+
const score = await resolver.getGhostScore(ghostAddress)
|
|
433
|
+
console.log(`Score: ${score.score}/${score.maxScore}`)
|
|
434
|
+
score.components.forEach(c => {
|
|
435
|
+
console.log(`- ${c.source}: ${c.score} (weight: ${c.weight})`)
|
|
436
|
+
})
|
|
437
|
+
|
|
438
|
+
// Get detailed reputation data
|
|
439
|
+
const reputation = await resolver.getGhostReputation(ghostAddress)
|
|
440
|
+
console.log('Reputation breakdown:', reputation)
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
#### **Batch Operations**
|
|
444
|
+
|
|
445
|
+
```typescript
|
|
446
|
+
// Resolve multiple external IDs in parallel
|
|
447
|
+
const identifiers = [
|
|
448
|
+
{ platform: 'payai', externalId: 'agent-1' },
|
|
449
|
+
{ platform: 'elizaos', externalId: 'eliza-bot' },
|
|
450
|
+
{ platform: 'github', externalId: 'ai-assistant-007' }
|
|
451
|
+
]
|
|
452
|
+
|
|
453
|
+
const addresses = await resolver.resolveBatch(identifiers)
|
|
454
|
+
addresses.forEach((addr, i) => {
|
|
455
|
+
if (addr) {
|
|
456
|
+
console.log(`${identifiers[i].platform}:${identifiers[i].externalId} → ${addr}`)
|
|
457
|
+
} else {
|
|
458
|
+
console.log(`${identifiers[i].platform}:${identifiers[i].externalId} → Not found`)
|
|
459
|
+
}
|
|
460
|
+
})
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
#### **Check Existence & List External IDs**
|
|
464
|
+
|
|
465
|
+
```typescript
|
|
466
|
+
// Check if external ID exists
|
|
467
|
+
const exists = await resolver.exists('payai', 'agent-123')
|
|
468
|
+
console.log(`Exists: ${exists}`)
|
|
469
|
+
|
|
470
|
+
// Get all external IDs for a Ghost
|
|
471
|
+
const externalIds = await resolver.getExternalIds(ghostAddress)
|
|
472
|
+
externalIds.forEach(id => {
|
|
473
|
+
console.log(`${id.platform}:${id.externalId} (verified: ${id.verified})`)
|
|
474
|
+
})
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
#### **API Health Check**
|
|
478
|
+
|
|
479
|
+
```typescript
|
|
480
|
+
// Check API availability and network status
|
|
481
|
+
const health = await resolver.checkHealth()
|
|
482
|
+
console.log(`Status: ${health.status}`)
|
|
483
|
+
console.log(`Network: ${health.network}`)
|
|
484
|
+
console.log(`RPC Connected: ${health.rpc.connected}`)
|
|
485
|
+
console.log(`RPC Latency: ${health.rpc.latency}ms`)
|
|
486
|
+
```
|
|
487
|
+
|
|
488
|
+
#### **Error Handling**
|
|
489
|
+
|
|
490
|
+
```typescript
|
|
491
|
+
import {
|
|
492
|
+
ExternalIdNotFoundError,
|
|
493
|
+
GhostNotFoundError,
|
|
494
|
+
GhostSpeakError
|
|
495
|
+
} from '@ghostspeak/sdk'
|
|
496
|
+
|
|
497
|
+
try {
|
|
498
|
+
const address = await resolver.resolve('payai', 'non-existent')
|
|
499
|
+
} catch (error) {
|
|
500
|
+
if (error instanceof ExternalIdNotFoundError) {
|
|
501
|
+
console.error(`No Ghost found for ${error.platform}:${error.externalId}`)
|
|
502
|
+
} else if (error instanceof GhostNotFoundError) {
|
|
503
|
+
console.error(`Ghost not found: ${error.message}`)
|
|
504
|
+
} else if (error instanceof GhostSpeakError) {
|
|
505
|
+
console.error(`API Error [${error.code}]: ${error.message}`)
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
```
|
|
509
|
+
|
|
510
|
+
#### **Supported Platforms**
|
|
511
|
+
|
|
512
|
+
- `payai` - PayAI Network agents
|
|
513
|
+
- `elizaos` - ElizaOS framework agents
|
|
514
|
+
- `github` - GitHub-verified agents
|
|
515
|
+
- `twitter` - Twitter/X-verified agents
|
|
516
|
+
- Custom platforms (defined by facilitators)
|
|
517
|
+
|
|
518
|
+
**Performance:** API lookups are **10-50x faster** than on-chain queries, ideal for real-time integrations.
|
|
519
|
+
|
|
520
|
+
### **10. Analytics & Monitoring**
|
|
378
521
|
```typescript
|
|
379
522
|
// Collect real-time analytics
|
|
380
523
|
const analytics = await client.analytics.collectAllMetrics()
|
|
@@ -390,7 +533,7 @@ const report = await client.analytics.generateReport({
|
|
|
390
533
|
const exportData = await client.analytics.exportForDashboard('grafana')
|
|
391
534
|
```
|
|
392
535
|
|
|
393
|
-
### **
|
|
536
|
+
### **11. Privacy Features (Production)**
|
|
394
537
|
|
|
395
538
|
> 🔒 **Privacy**: Client-side ElGamal encryption is the standard for confidential transfers in GhostSpeak. It provides robust privacy verification via the x402 payment layer.
|
|
396
539
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TransactionSigner } from '@solana/kit';
|
|
2
2
|
import { G as GovernanceProposal, V as VoteChoice } from './reputation-types-Yebf0Rm_.js';
|
|
3
3
|
import { Address } from '@solana/addresses';
|
|
4
|
-
import { W as W3CVerifiableCredential, B as BaseModule, G as GhostSpeakConfig, A as AgentModule, a as
|
|
4
|
+
import { W as W3CVerifiableCredential, B as BaseModule, G as GhostSpeakConfig, A as AgentModule, a as GhostModule, b as GovernanceModule, M as MultisigModule, R as ReputationModule, D as DidModule, S as StakingModule } from './StakingModule-DunDShLq.js';
|
|
5
5
|
import { CrossmintClientOptions } from './credentials.js';
|
|
6
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
7
|
|
|
@@ -748,6 +748,14 @@ declare class GhostSpeakClient {
|
|
|
748
748
|
* Direct access to Agent Module for read operations
|
|
749
749
|
*/
|
|
750
750
|
get agents(): AgentModule;
|
|
751
|
+
/**
|
|
752
|
+
* Direct access to Ghost Module for claiming external agents
|
|
753
|
+
*
|
|
754
|
+
* Ghosts are external AI agents (type 10) that exist on x402 facilitators.
|
|
755
|
+
* They can be claimed using Solana Attestation Service (SAS)
|
|
756
|
+
* for trustless ownership verification.
|
|
757
|
+
*/
|
|
758
|
+
get ghosts(): GhostModule;
|
|
751
759
|
/**
|
|
752
760
|
* Direct access to Governance Module for read operations
|
|
753
761
|
*/
|
|
@@ -760,10 +768,6 @@ declare class GhostSpeakClient {
|
|
|
760
768
|
* Agent operations
|
|
761
769
|
*/
|
|
762
770
|
agent(): AgentBuilder;
|
|
763
|
-
/**
|
|
764
|
-
* PayAI operations (x402 payments)
|
|
765
|
-
*/
|
|
766
|
-
payai(): PayAIClient;
|
|
767
771
|
/**
|
|
768
772
|
* Reputation operations
|
|
769
773
|
*/
|
|
@@ -778,7 +782,7 @@ declare class GhostSpeakClient {
|
|
|
778
782
|
/**
|
|
779
783
|
* Multi-Source Reputation Aggregator (Pillar 3: External Sources)
|
|
780
784
|
*
|
|
781
|
-
* Aggregate reputation data from multiple sources (
|
|
785
|
+
* Aggregate reputation data from multiple sources (x402, GitHub, custom webhooks)
|
|
782
786
|
* with weighted scoring and conflict detection.
|
|
783
787
|
*/
|
|
784
788
|
reputationAggregator(): any;
|