@voidly/agent-sdk 1.7.0 → 1.8.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
@@ -115,6 +115,7 @@ declare class VoidlyAgent {
115
115
  threadId?: string;
116
116
  replyTo?: string;
117
117
  ttl?: number;
118
+ messageType?: string;
118
119
  }): Promise<SendResult>;
119
120
  /**
120
121
  * Receive and decrypt messages. Decryption happens locally.
@@ -664,6 +665,45 @@ declare class VoidlyAgent {
664
665
  routed: boolean;
665
666
  destination: string;
666
667
  }>;
668
+ /** Send heartbeat — signals agent is alive, updates last_seen */
669
+ ping(): Promise<{
670
+ pong: boolean;
671
+ did: string;
672
+ status: string;
673
+ uptime: {
674
+ days: number;
675
+ hours: number;
676
+ };
677
+ }>;
678
+ /** Check if another agent is online (public) */
679
+ checkOnline(did: string): Promise<{
680
+ did: string;
681
+ online_status: 'online' | 'idle' | 'offline';
682
+ last_seen: string;
683
+ minutes_since_seen: number | null;
684
+ }>;
685
+ /** Pin another agent's public keys (Trust On First Use). Returns warning if keys changed since last pin. */
686
+ pinKeys(did: string): Promise<{
687
+ pinned: boolean;
688
+ key_changed: boolean;
689
+ status: string;
690
+ warning?: string;
691
+ }>;
692
+ /** List all pinned keys */
693
+ listPinnedKeys(options?: {
694
+ status?: string;
695
+ }): Promise<{
696
+ pins: any[];
697
+ total: number;
698
+ }>;
699
+ /** Verify an agent's keys against your pinned copy. Detects key changes (potential MitM). */
700
+ verifyKeys(did: string): Promise<{
701
+ did: string;
702
+ pinned: boolean;
703
+ verified?: boolean;
704
+ status: string;
705
+ warning?: string;
706
+ }>;
667
707
  }
668
708
 
669
709
  export { type AgentIdentity, type AgentProfile, type DecryptedMessage, type SendResult, VoidlyAgent, type VoidlyAgentConfig };
package/dist/index.d.ts CHANGED
@@ -115,6 +115,7 @@ declare class VoidlyAgent {
115
115
  threadId?: string;
116
116
  replyTo?: string;
117
117
  ttl?: number;
118
+ messageType?: string;
118
119
  }): Promise<SendResult>;
119
120
  /**
120
121
  * Receive and decrypt messages. Decryption happens locally.
@@ -664,6 +665,45 @@ declare class VoidlyAgent {
664
665
  routed: boolean;
665
666
  destination: string;
666
667
  }>;
668
+ /** Send heartbeat — signals agent is alive, updates last_seen */
669
+ ping(): Promise<{
670
+ pong: boolean;
671
+ did: string;
672
+ status: string;
673
+ uptime: {
674
+ days: number;
675
+ hours: number;
676
+ };
677
+ }>;
678
+ /** Check if another agent is online (public) */
679
+ checkOnline(did: string): Promise<{
680
+ did: string;
681
+ online_status: 'online' | 'idle' | 'offline';
682
+ last_seen: string;
683
+ minutes_since_seen: number | null;
684
+ }>;
685
+ /** Pin another agent's public keys (Trust On First Use). Returns warning if keys changed since last pin. */
686
+ pinKeys(did: string): Promise<{
687
+ pinned: boolean;
688
+ key_changed: boolean;
689
+ status: string;
690
+ warning?: string;
691
+ }>;
692
+ /** List all pinned keys */
693
+ listPinnedKeys(options?: {
694
+ status?: string;
695
+ }): Promise<{
696
+ pins: any[];
697
+ total: number;
698
+ }>;
699
+ /** Verify an agent's keys against your pinned copy. Detects key changes (potential MitM). */
700
+ verifyKeys(did: string): Promise<{
701
+ did: string;
702
+ pinned: boolean;
703
+ verified?: boolean;
704
+ status: string;
705
+ warning?: string;
706
+ }>;
667
707
  }
668
708
 
669
709
  export { type AgentIdentity, type AgentProfile, type DecryptedMessage, type SendResult, VoidlyAgent, type VoidlyAgentConfig };
package/dist/index.js CHANGED
@@ -2455,6 +2455,7 @@ var VoidlyAgent = class _VoidlyAgent {
2455
2455
  envelope: envelopeData,
2456
2456
  // Pass signed envelope so receiver can verify
2457
2457
  content_type: options.contentType || "text/plain",
2458
+ message_type: options.messageType || "text",
2458
2459
  thread_id: options.threadId,
2459
2460
  reply_to: options.replyTo,
2460
2461
  ttl: options.ttl
@@ -3481,6 +3482,52 @@ var VoidlyAgent = class _VoidlyAgent {
3481
3482
  if (!res.ok) throw new Error(`Route failed: ${res.status} ${await res.text()}`);
3482
3483
  return res.json();
3483
3484
  }
3485
+ // ── Heartbeat ──────────────────────────────────────────────────────────────
3486
+ /** Send heartbeat — signals agent is alive, updates last_seen */
3487
+ async ping() {
3488
+ const res = await fetch(`${this.baseUrl}/v1/agent/ping`, {
3489
+ method: "POST",
3490
+ headers: { "X-Agent-Key": this.apiKey }
3491
+ });
3492
+ if (!res.ok) throw new Error(`Ping failed: ${res.status}`);
3493
+ return res.json();
3494
+ }
3495
+ /** Check if another agent is online (public) */
3496
+ async checkOnline(did) {
3497
+ const res = await fetch(`${this.baseUrl}/v1/agent/ping/${encodeURIComponent(did)}`);
3498
+ if (!res.ok) throw new Error(`Ping check failed: ${res.status}`);
3499
+ return res.json();
3500
+ }
3501
+ // ── Key Pinning (TOFU) ────────────────────────────────────────────────────
3502
+ /** Pin another agent's public keys (Trust On First Use). Returns warning if keys changed since last pin. */
3503
+ async pinKeys(did) {
3504
+ const res = await fetch(`${this.baseUrl}/v1/agent/keys/pin`, {
3505
+ method: "POST",
3506
+ headers: { "Content-Type": "application/json", "X-Agent-Key": this.apiKey },
3507
+ body: JSON.stringify({ did })
3508
+ });
3509
+ if (!res.ok) throw new Error(`Key pin failed: ${res.status}`);
3510
+ return res.json();
3511
+ }
3512
+ /** List all pinned keys */
3513
+ async listPinnedKeys(options) {
3514
+ const params = new URLSearchParams();
3515
+ if (options?.status) params.set("status", options.status);
3516
+ const qs = params.toString() ? `?${params.toString()}` : "";
3517
+ const res = await fetch(`${this.baseUrl}/v1/agent/keys/pins${qs}`, {
3518
+ headers: { "X-Agent-Key": this.apiKey }
3519
+ });
3520
+ if (!res.ok) throw new Error(`List pins failed: ${res.status}`);
3521
+ return res.json();
3522
+ }
3523
+ /** Verify an agent's keys against your pinned copy. Detects key changes (potential MitM). */
3524
+ async verifyKeys(did) {
3525
+ const res = await fetch(`${this.baseUrl}/v1/agent/keys/verify/${encodeURIComponent(did)}`, {
3526
+ headers: { "X-Agent-Key": this.apiKey }
3527
+ });
3528
+ if (!res.ok) throw new Error(`Key verify failed: ${res.status}`);
3529
+ return res.json();
3530
+ }
3484
3531
  };
3485
3532
  // Annotate the CommonJS export names for ESM import in node:
3486
3533
  0 && (module.exports = {
package/dist/index.mjs CHANGED
@@ -2445,6 +2445,7 @@ var VoidlyAgent = class _VoidlyAgent {
2445
2445
  envelope: envelopeData,
2446
2446
  // Pass signed envelope so receiver can verify
2447
2447
  content_type: options.contentType || "text/plain",
2448
+ message_type: options.messageType || "text",
2448
2449
  thread_id: options.threadId,
2449
2450
  reply_to: options.replyTo,
2450
2451
  ttl: options.ttl
@@ -3471,6 +3472,52 @@ var VoidlyAgent = class _VoidlyAgent {
3471
3472
  if (!res.ok) throw new Error(`Route failed: ${res.status} ${await res.text()}`);
3472
3473
  return res.json();
3473
3474
  }
3475
+ // ── Heartbeat ──────────────────────────────────────────────────────────────
3476
+ /** Send heartbeat — signals agent is alive, updates last_seen */
3477
+ async ping() {
3478
+ const res = await fetch(`${this.baseUrl}/v1/agent/ping`, {
3479
+ method: "POST",
3480
+ headers: { "X-Agent-Key": this.apiKey }
3481
+ });
3482
+ if (!res.ok) throw new Error(`Ping failed: ${res.status}`);
3483
+ return res.json();
3484
+ }
3485
+ /** Check if another agent is online (public) */
3486
+ async checkOnline(did) {
3487
+ const res = await fetch(`${this.baseUrl}/v1/agent/ping/${encodeURIComponent(did)}`);
3488
+ if (!res.ok) throw new Error(`Ping check failed: ${res.status}`);
3489
+ return res.json();
3490
+ }
3491
+ // ── Key Pinning (TOFU) ────────────────────────────────────────────────────
3492
+ /** Pin another agent's public keys (Trust On First Use). Returns warning if keys changed since last pin. */
3493
+ async pinKeys(did) {
3494
+ const res = await fetch(`${this.baseUrl}/v1/agent/keys/pin`, {
3495
+ method: "POST",
3496
+ headers: { "Content-Type": "application/json", "X-Agent-Key": this.apiKey },
3497
+ body: JSON.stringify({ did })
3498
+ });
3499
+ if (!res.ok) throw new Error(`Key pin failed: ${res.status}`);
3500
+ return res.json();
3501
+ }
3502
+ /** List all pinned keys */
3503
+ async listPinnedKeys(options) {
3504
+ const params = new URLSearchParams();
3505
+ if (options?.status) params.set("status", options.status);
3506
+ const qs = params.toString() ? `?${params.toString()}` : "";
3507
+ const res = await fetch(`${this.baseUrl}/v1/agent/keys/pins${qs}`, {
3508
+ headers: { "X-Agent-Key": this.apiKey }
3509
+ });
3510
+ if (!res.ok) throw new Error(`List pins failed: ${res.status}`);
3511
+ return res.json();
3512
+ }
3513
+ /** Verify an agent's keys against your pinned copy. Detects key changes (potential MitM). */
3514
+ async verifyKeys(did) {
3515
+ const res = await fetch(`${this.baseUrl}/v1/agent/keys/verify/${encodeURIComponent(did)}`, {
3516
+ headers: { "X-Agent-Key": this.apiKey }
3517
+ });
3518
+ if (!res.ok) throw new Error(`Key verify failed: ${res.status}`);
3519
+ return res.json();
3520
+ }
3474
3521
  };
3475
3522
  var export_decodeBase64 = import_tweetnacl_util.decodeBase64;
3476
3523
  var export_decodeUTF8 = import_tweetnacl_util.decodeUTF8;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voidly/agent-sdk",
3
- "version": "1.7.0",
3
+ "version": "1.8.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",