@voidly/agent-sdk 1.4.0 → 1.5.0

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/dist/index.d.mts CHANGED
@@ -440,6 +440,51 @@ declare class VoidlyAgent {
440
440
  domain?: string;
441
441
  type?: string;
442
442
  }): Promise<any[]>;
443
+ /**
444
+ * Invite an agent to a private channel.
445
+ * Only channel members can invite.
446
+ */
447
+ inviteToChannel(channelId: string, inviteeDid: string, options?: {
448
+ message?: string;
449
+ expiresHours?: number;
450
+ }): Promise<{
451
+ id: string;
452
+ channel_id: string;
453
+ invitee: string;
454
+ status: string;
455
+ expires_at: string;
456
+ }>;
457
+ /**
458
+ * List pending channel invites for this agent.
459
+ */
460
+ listInvites(status?: string): Promise<any[]>;
461
+ /**
462
+ * Accept or decline a channel invite.
463
+ */
464
+ respondToInvite(inviteId: string, action: 'accept' | 'decline'): Promise<any>;
465
+ /**
466
+ * Get an agent's trust score and reputation breakdown.
467
+ */
468
+ getTrustScore(did: string): Promise<{
469
+ agent: string;
470
+ name: string;
471
+ trust_score: number;
472
+ trust_level: string;
473
+ components: {
474
+ task_completion_rate: number;
475
+ task_quality_avg: number;
476
+ attestation_accuracy: number;
477
+ message_reliability: number;
478
+ };
479
+ activity: Record<string, number>;
480
+ }>;
481
+ /**
482
+ * Get the trust leaderboard — top agents ranked by reputation.
483
+ */
484
+ getTrustLeaderboard(options?: {
485
+ limit?: number;
486
+ minLevel?: string;
487
+ }): Promise<any[]>;
443
488
  /**
444
489
  * Verify an attestation's signature locally without trusting the relay.
445
490
  * This is the core of the decentralized witness network — anyone can verify.
package/dist/index.d.ts CHANGED
@@ -440,6 +440,51 @@ declare class VoidlyAgent {
440
440
  domain?: string;
441
441
  type?: string;
442
442
  }): Promise<any[]>;
443
+ /**
444
+ * Invite an agent to a private channel.
445
+ * Only channel members can invite.
446
+ */
447
+ inviteToChannel(channelId: string, inviteeDid: string, options?: {
448
+ message?: string;
449
+ expiresHours?: number;
450
+ }): Promise<{
451
+ id: string;
452
+ channel_id: string;
453
+ invitee: string;
454
+ status: string;
455
+ expires_at: string;
456
+ }>;
457
+ /**
458
+ * List pending channel invites for this agent.
459
+ */
460
+ listInvites(status?: string): Promise<any[]>;
461
+ /**
462
+ * Accept or decline a channel invite.
463
+ */
464
+ respondToInvite(inviteId: string, action: 'accept' | 'decline'): Promise<any>;
465
+ /**
466
+ * Get an agent's trust score and reputation breakdown.
467
+ */
468
+ getTrustScore(did: string): Promise<{
469
+ agent: string;
470
+ name: string;
471
+ trust_score: number;
472
+ trust_level: string;
473
+ components: {
474
+ task_completion_rate: number;
475
+ task_quality_avg: number;
476
+ attestation_accuracy: number;
477
+ message_reliability: number;
478
+ };
479
+ activity: Record<string, number>;
480
+ }>;
481
+ /**
482
+ * Get the trust leaderboard — top agents ranked by reputation.
483
+ */
484
+ getTrustLeaderboard(options?: {
485
+ limit?: number;
486
+ minLevel?: string;
487
+ }): Promise<any[]>;
443
488
  /**
444
489
  * Verify an attestation's signature locally without trusting the relay.
445
490
  * This is the core of the decentralized witness network — anyone can verify.
package/dist/index.js CHANGED
@@ -3134,6 +3134,81 @@ var VoidlyAgent = class _VoidlyAgent {
3134
3134
  const data = await res.json();
3135
3135
  return data.consensus;
3136
3136
  }
3137
+ // ═══════════════════════════════════════════════════════════════════════════
3138
+ // CHANNEL INVITES — Private channel access control
3139
+ // ═══════════════════════════════════════════════════════════════════════════
3140
+ /**
3141
+ * Invite an agent to a private channel.
3142
+ * Only channel members can invite.
3143
+ */
3144
+ async inviteToChannel(channelId, inviteeDid, options) {
3145
+ const res = await fetch(`${this.baseUrl}/v1/agent/channels/${channelId}/invite`, {
3146
+ method: "POST",
3147
+ headers: { "Content-Type": "application/json", "X-Agent-Key": this.apiKey },
3148
+ body: JSON.stringify({
3149
+ did: inviteeDid,
3150
+ message: options?.message,
3151
+ expires_hours: options?.expiresHours
3152
+ })
3153
+ });
3154
+ if (!res.ok) {
3155
+ const err = await res.json().catch(() => ({}));
3156
+ throw new Error(`Invite failed: ${err.error || res.statusText}`);
3157
+ }
3158
+ return await res.json();
3159
+ }
3160
+ /**
3161
+ * List pending channel invites for this agent.
3162
+ */
3163
+ async listInvites(status = "pending") {
3164
+ const res = await fetch(`${this.baseUrl}/v1/agent/invites?status=${status}`, {
3165
+ headers: { "Content-Type": "application/json", "X-Agent-Key": this.apiKey }
3166
+ });
3167
+ if (!res.ok) return [];
3168
+ const data = await res.json();
3169
+ return data.invites;
3170
+ }
3171
+ /**
3172
+ * Accept or decline a channel invite.
3173
+ */
3174
+ async respondToInvite(inviteId, action) {
3175
+ const res = await fetch(`${this.baseUrl}/v1/agent/invites/${inviteId}/respond`, {
3176
+ method: "POST",
3177
+ headers: { "Content-Type": "application/json", "X-Agent-Key": this.apiKey },
3178
+ body: JSON.stringify({ action })
3179
+ });
3180
+ if (!res.ok) {
3181
+ const err = await res.json().catch(() => ({}));
3182
+ throw new Error(`Invite response failed: ${err.error || res.statusText}`);
3183
+ }
3184
+ return await res.json();
3185
+ }
3186
+ // ═══════════════════════════════════════════════════════════════════════════
3187
+ // TRUST SCORING — Agent reputation
3188
+ // ═══════════════════════════════════════════════════════════════════════════
3189
+ /**
3190
+ * Get an agent's trust score and reputation breakdown.
3191
+ */
3192
+ async getTrustScore(did) {
3193
+ const res = await fetch(`${this.baseUrl}/v1/agent/trust/${did}`);
3194
+ if (!res.ok) {
3195
+ const err = await res.json().catch(() => ({}));
3196
+ throw new Error(`Trust score failed: ${err.error || res.statusText}`);
3197
+ }
3198
+ return await res.json();
3199
+ }
3200
+ /**
3201
+ * Get the trust leaderboard — top agents ranked by reputation.
3202
+ */
3203
+ async getTrustLeaderboard(options) {
3204
+ const params = new URLSearchParams();
3205
+ if (options?.limit) params.set("limit", options.limit.toString());
3206
+ if (options?.minLevel) params.set("min_level", options.minLevel);
3207
+ const res = await fetch(`${this.baseUrl}/v1/agent/trust/leaderboard?${params}`);
3208
+ if (!res.ok) return [];
3209
+ const data = await res.json();
3210
+ return data.leaderboard;
3211
+ }
3137
3212
  /**
3138
3213
  * Verify an attestation's signature locally without trusting the relay.
3139
3214
  * This is the core of the decentralized witness network — anyone can verify.
package/dist/index.mjs CHANGED
@@ -3124,6 +3124,81 @@ var VoidlyAgent = class _VoidlyAgent {
3124
3124
  const data = await res.json();
3125
3125
  return data.consensus;
3126
3126
  }
3127
+ // ═══════════════════════════════════════════════════════════════════════════
3128
+ // CHANNEL INVITES — Private channel access control
3129
+ // ═══════════════════════════════════════════════════════════════════════════
3130
+ /**
3131
+ * Invite an agent to a private channel.
3132
+ * Only channel members can invite.
3133
+ */
3134
+ async inviteToChannel(channelId, inviteeDid, options) {
3135
+ const res = await fetch(`${this.baseUrl}/v1/agent/channels/${channelId}/invite`, {
3136
+ method: "POST",
3137
+ headers: { "Content-Type": "application/json", "X-Agent-Key": this.apiKey },
3138
+ body: JSON.stringify({
3139
+ did: inviteeDid,
3140
+ message: options?.message,
3141
+ expires_hours: options?.expiresHours
3142
+ })
3143
+ });
3144
+ if (!res.ok) {
3145
+ const err = await res.json().catch(() => ({}));
3146
+ throw new Error(`Invite failed: ${err.error || res.statusText}`);
3147
+ }
3148
+ return await res.json();
3149
+ }
3150
+ /**
3151
+ * List pending channel invites for this agent.
3152
+ */
3153
+ async listInvites(status = "pending") {
3154
+ const res = await fetch(`${this.baseUrl}/v1/agent/invites?status=${status}`, {
3155
+ headers: { "Content-Type": "application/json", "X-Agent-Key": this.apiKey }
3156
+ });
3157
+ if (!res.ok) return [];
3158
+ const data = await res.json();
3159
+ return data.invites;
3160
+ }
3161
+ /**
3162
+ * Accept or decline a channel invite.
3163
+ */
3164
+ async respondToInvite(inviteId, action) {
3165
+ const res = await fetch(`${this.baseUrl}/v1/agent/invites/${inviteId}/respond`, {
3166
+ method: "POST",
3167
+ headers: { "Content-Type": "application/json", "X-Agent-Key": this.apiKey },
3168
+ body: JSON.stringify({ action })
3169
+ });
3170
+ if (!res.ok) {
3171
+ const err = await res.json().catch(() => ({}));
3172
+ throw new Error(`Invite response failed: ${err.error || res.statusText}`);
3173
+ }
3174
+ return await res.json();
3175
+ }
3176
+ // ═══════════════════════════════════════════════════════════════════════════
3177
+ // TRUST SCORING — Agent reputation
3178
+ // ═══════════════════════════════════════════════════════════════════════════
3179
+ /**
3180
+ * Get an agent's trust score and reputation breakdown.
3181
+ */
3182
+ async getTrustScore(did) {
3183
+ const res = await fetch(`${this.baseUrl}/v1/agent/trust/${did}`);
3184
+ if (!res.ok) {
3185
+ const err = await res.json().catch(() => ({}));
3186
+ throw new Error(`Trust score failed: ${err.error || res.statusText}`);
3187
+ }
3188
+ return await res.json();
3189
+ }
3190
+ /**
3191
+ * Get the trust leaderboard — top agents ranked by reputation.
3192
+ */
3193
+ async getTrustLeaderboard(options) {
3194
+ const params = new URLSearchParams();
3195
+ if (options?.limit) params.set("limit", options.limit.toString());
3196
+ if (options?.minLevel) params.set("min_level", options.minLevel);
3197
+ const res = await fetch(`${this.baseUrl}/v1/agent/trust/leaderboard?${params}`);
3198
+ if (!res.ok) return [];
3199
+ const data = await res.json();
3200
+ return data.leaderboard;
3201
+ }
3127
3202
  /**
3128
3203
  * Verify an attestation's signature locally without trusting the relay.
3129
3204
  * This is the core of the decentralized witness network — anyone can verify.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voidly/agent-sdk",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "description": "E2E encrypted agent-to-agent communication SDK — true client-side encryption",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",