@voidly/agent-sdk 1.7.0 → 1.8.1
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 +42 -0
- package/dist/index.d.ts +42 -0
- package/dist/index.js +49 -0
- package/dist/index.mjs +49 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -32,6 +32,7 @@ interface DecryptedMessage {
|
|
|
32
32
|
to: string;
|
|
33
33
|
content: string;
|
|
34
34
|
contentType: string;
|
|
35
|
+
messageType: string;
|
|
35
36
|
threadId: string | null;
|
|
36
37
|
replyTo: string | null;
|
|
37
38
|
signatureValid: boolean;
|
|
@@ -115,6 +116,7 @@ declare class VoidlyAgent {
|
|
|
115
116
|
threadId?: string;
|
|
116
117
|
replyTo?: string;
|
|
117
118
|
ttl?: number;
|
|
119
|
+
messageType?: string;
|
|
118
120
|
}): Promise<SendResult>;
|
|
119
121
|
/**
|
|
120
122
|
* Receive and decrypt messages. Decryption happens locally.
|
|
@@ -126,6 +128,7 @@ declare class VoidlyAgent {
|
|
|
126
128
|
from?: string;
|
|
127
129
|
threadId?: string;
|
|
128
130
|
contentType?: string;
|
|
131
|
+
messageType?: string;
|
|
129
132
|
unreadOnly?: boolean;
|
|
130
133
|
}): Promise<DecryptedMessage[]>;
|
|
131
134
|
/**
|
|
@@ -664,6 +667,45 @@ declare class VoidlyAgent {
|
|
|
664
667
|
routed: boolean;
|
|
665
668
|
destination: string;
|
|
666
669
|
}>;
|
|
670
|
+
/** Send heartbeat — signals agent is alive, updates last_seen */
|
|
671
|
+
ping(): Promise<{
|
|
672
|
+
pong: boolean;
|
|
673
|
+
did: string;
|
|
674
|
+
status: string;
|
|
675
|
+
uptime: {
|
|
676
|
+
days: number;
|
|
677
|
+
hours: number;
|
|
678
|
+
};
|
|
679
|
+
}>;
|
|
680
|
+
/** Check if another agent is online (public) */
|
|
681
|
+
checkOnline(did: string): Promise<{
|
|
682
|
+
did: string;
|
|
683
|
+
online_status: 'online' | 'idle' | 'offline';
|
|
684
|
+
last_seen: string;
|
|
685
|
+
minutes_since_seen: number | null;
|
|
686
|
+
}>;
|
|
687
|
+
/** Pin another agent's public keys (Trust On First Use). Returns warning if keys changed since last pin. */
|
|
688
|
+
pinKeys(did: string): Promise<{
|
|
689
|
+
pinned: boolean;
|
|
690
|
+
key_changed: boolean;
|
|
691
|
+
status: string;
|
|
692
|
+
warning?: string;
|
|
693
|
+
}>;
|
|
694
|
+
/** List all pinned keys */
|
|
695
|
+
listPinnedKeys(options?: {
|
|
696
|
+
status?: string;
|
|
697
|
+
}): Promise<{
|
|
698
|
+
pins: any[];
|
|
699
|
+
total: number;
|
|
700
|
+
}>;
|
|
701
|
+
/** Verify an agent's keys against your pinned copy. Detects key changes (potential MitM). */
|
|
702
|
+
verifyKeys(did: string): Promise<{
|
|
703
|
+
did: string;
|
|
704
|
+
pinned: boolean;
|
|
705
|
+
verified?: boolean;
|
|
706
|
+
status: string;
|
|
707
|
+
warning?: string;
|
|
708
|
+
}>;
|
|
667
709
|
}
|
|
668
710
|
|
|
669
711
|
export { type AgentIdentity, type AgentProfile, type DecryptedMessage, type SendResult, VoidlyAgent, type VoidlyAgentConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ interface DecryptedMessage {
|
|
|
32
32
|
to: string;
|
|
33
33
|
content: string;
|
|
34
34
|
contentType: string;
|
|
35
|
+
messageType: string;
|
|
35
36
|
threadId: string | null;
|
|
36
37
|
replyTo: string | null;
|
|
37
38
|
signatureValid: boolean;
|
|
@@ -115,6 +116,7 @@ declare class VoidlyAgent {
|
|
|
115
116
|
threadId?: string;
|
|
116
117
|
replyTo?: string;
|
|
117
118
|
ttl?: number;
|
|
119
|
+
messageType?: string;
|
|
118
120
|
}): Promise<SendResult>;
|
|
119
121
|
/**
|
|
120
122
|
* Receive and decrypt messages. Decryption happens locally.
|
|
@@ -126,6 +128,7 @@ declare class VoidlyAgent {
|
|
|
126
128
|
from?: string;
|
|
127
129
|
threadId?: string;
|
|
128
130
|
contentType?: string;
|
|
131
|
+
messageType?: string;
|
|
129
132
|
unreadOnly?: boolean;
|
|
130
133
|
}): Promise<DecryptedMessage[]>;
|
|
131
134
|
/**
|
|
@@ -664,6 +667,45 @@ declare class VoidlyAgent {
|
|
|
664
667
|
routed: boolean;
|
|
665
668
|
destination: string;
|
|
666
669
|
}>;
|
|
670
|
+
/** Send heartbeat — signals agent is alive, updates last_seen */
|
|
671
|
+
ping(): Promise<{
|
|
672
|
+
pong: boolean;
|
|
673
|
+
did: string;
|
|
674
|
+
status: string;
|
|
675
|
+
uptime: {
|
|
676
|
+
days: number;
|
|
677
|
+
hours: number;
|
|
678
|
+
};
|
|
679
|
+
}>;
|
|
680
|
+
/** Check if another agent is online (public) */
|
|
681
|
+
checkOnline(did: string): Promise<{
|
|
682
|
+
did: string;
|
|
683
|
+
online_status: 'online' | 'idle' | 'offline';
|
|
684
|
+
last_seen: string;
|
|
685
|
+
minutes_since_seen: number | null;
|
|
686
|
+
}>;
|
|
687
|
+
/** Pin another agent's public keys (Trust On First Use). Returns warning if keys changed since last pin. */
|
|
688
|
+
pinKeys(did: string): Promise<{
|
|
689
|
+
pinned: boolean;
|
|
690
|
+
key_changed: boolean;
|
|
691
|
+
status: string;
|
|
692
|
+
warning?: string;
|
|
693
|
+
}>;
|
|
694
|
+
/** List all pinned keys */
|
|
695
|
+
listPinnedKeys(options?: {
|
|
696
|
+
status?: string;
|
|
697
|
+
}): Promise<{
|
|
698
|
+
pins: any[];
|
|
699
|
+
total: number;
|
|
700
|
+
}>;
|
|
701
|
+
/** Verify an agent's keys against your pinned copy. Detects key changes (potential MitM). */
|
|
702
|
+
verifyKeys(did: string): Promise<{
|
|
703
|
+
did: string;
|
|
704
|
+
pinned: boolean;
|
|
705
|
+
verified?: boolean;
|
|
706
|
+
status: string;
|
|
707
|
+
warning?: string;
|
|
708
|
+
}>;
|
|
667
709
|
}
|
|
668
710
|
|
|
669
711
|
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
|
|
@@ -2477,6 +2478,7 @@ var VoidlyAgent = class _VoidlyAgent {
|
|
|
2477
2478
|
if (options.from) params.set("from", options.from);
|
|
2478
2479
|
if (options.threadId) params.set("thread_id", options.threadId);
|
|
2479
2480
|
if (options.contentType) params.set("content_type", options.contentType);
|
|
2481
|
+
if (options.messageType) params.set("message_type", options.messageType);
|
|
2480
2482
|
if (options.unreadOnly) params.set("unread", "true");
|
|
2481
2483
|
const res = await fetch(`${this.baseUrl}/v1/agent/receive/raw?${params}`, {
|
|
2482
2484
|
headers: { "X-Agent-Key": this.apiKey }
|
|
@@ -2519,6 +2521,7 @@ var VoidlyAgent = class _VoidlyAgent {
|
|
|
2519
2521
|
to: msg.to,
|
|
2520
2522
|
content: (0, import_tweetnacl_util.encodeUTF8)(plaintext),
|
|
2521
2523
|
contentType: msg.content_type,
|
|
2524
|
+
messageType: msg.message_type || "text",
|
|
2522
2525
|
threadId: msg.thread_id,
|
|
2523
2526
|
replyTo: msg.reply_to,
|
|
2524
2527
|
signatureValid,
|
|
@@ -3481,6 +3484,52 @@ var VoidlyAgent = class _VoidlyAgent {
|
|
|
3481
3484
|
if (!res.ok) throw new Error(`Route failed: ${res.status} ${await res.text()}`);
|
|
3482
3485
|
return res.json();
|
|
3483
3486
|
}
|
|
3487
|
+
// ── Heartbeat ──────────────────────────────────────────────────────────────
|
|
3488
|
+
/** Send heartbeat — signals agent is alive, updates last_seen */
|
|
3489
|
+
async ping() {
|
|
3490
|
+
const res = await fetch(`${this.baseUrl}/v1/agent/ping`, {
|
|
3491
|
+
method: "POST",
|
|
3492
|
+
headers: { "X-Agent-Key": this.apiKey }
|
|
3493
|
+
});
|
|
3494
|
+
if (!res.ok) throw new Error(`Ping failed: ${res.status}`);
|
|
3495
|
+
return res.json();
|
|
3496
|
+
}
|
|
3497
|
+
/** Check if another agent is online (public) */
|
|
3498
|
+
async checkOnline(did) {
|
|
3499
|
+
const res = await fetch(`${this.baseUrl}/v1/agent/ping/${encodeURIComponent(did)}`);
|
|
3500
|
+
if (!res.ok) throw new Error(`Ping check failed: ${res.status}`);
|
|
3501
|
+
return res.json();
|
|
3502
|
+
}
|
|
3503
|
+
// ── Key Pinning (TOFU) ────────────────────────────────────────────────────
|
|
3504
|
+
/** Pin another agent's public keys (Trust On First Use). Returns warning if keys changed since last pin. */
|
|
3505
|
+
async pinKeys(did) {
|
|
3506
|
+
const res = await fetch(`${this.baseUrl}/v1/agent/keys/pin`, {
|
|
3507
|
+
method: "POST",
|
|
3508
|
+
headers: { "Content-Type": "application/json", "X-Agent-Key": this.apiKey },
|
|
3509
|
+
body: JSON.stringify({ did })
|
|
3510
|
+
});
|
|
3511
|
+
if (!res.ok) throw new Error(`Key pin failed: ${res.status}`);
|
|
3512
|
+
return res.json();
|
|
3513
|
+
}
|
|
3514
|
+
/** List all pinned keys */
|
|
3515
|
+
async listPinnedKeys(options) {
|
|
3516
|
+
const params = new URLSearchParams();
|
|
3517
|
+
if (options?.status) params.set("status", options.status);
|
|
3518
|
+
const qs = params.toString() ? `?${params.toString()}` : "";
|
|
3519
|
+
const res = await fetch(`${this.baseUrl}/v1/agent/keys/pins${qs}`, {
|
|
3520
|
+
headers: { "X-Agent-Key": this.apiKey }
|
|
3521
|
+
});
|
|
3522
|
+
if (!res.ok) throw new Error(`List pins failed: ${res.status}`);
|
|
3523
|
+
return res.json();
|
|
3524
|
+
}
|
|
3525
|
+
/** Verify an agent's keys against your pinned copy. Detects key changes (potential MitM). */
|
|
3526
|
+
async verifyKeys(did) {
|
|
3527
|
+
const res = await fetch(`${this.baseUrl}/v1/agent/keys/verify/${encodeURIComponent(did)}`, {
|
|
3528
|
+
headers: { "X-Agent-Key": this.apiKey }
|
|
3529
|
+
});
|
|
3530
|
+
if (!res.ok) throw new Error(`Key verify failed: ${res.status}`);
|
|
3531
|
+
return res.json();
|
|
3532
|
+
}
|
|
3484
3533
|
};
|
|
3485
3534
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3486
3535
|
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
|
|
@@ -2467,6 +2468,7 @@ var VoidlyAgent = class _VoidlyAgent {
|
|
|
2467
2468
|
if (options.from) params.set("from", options.from);
|
|
2468
2469
|
if (options.threadId) params.set("thread_id", options.threadId);
|
|
2469
2470
|
if (options.contentType) params.set("content_type", options.contentType);
|
|
2471
|
+
if (options.messageType) params.set("message_type", options.messageType);
|
|
2470
2472
|
if (options.unreadOnly) params.set("unread", "true");
|
|
2471
2473
|
const res = await fetch(`${this.baseUrl}/v1/agent/receive/raw?${params}`, {
|
|
2472
2474
|
headers: { "X-Agent-Key": this.apiKey }
|
|
@@ -2509,6 +2511,7 @@ var VoidlyAgent = class _VoidlyAgent {
|
|
|
2509
2511
|
to: msg.to,
|
|
2510
2512
|
content: (0, import_tweetnacl_util.encodeUTF8)(plaintext),
|
|
2511
2513
|
contentType: msg.content_type,
|
|
2514
|
+
messageType: msg.message_type || "text",
|
|
2512
2515
|
threadId: msg.thread_id,
|
|
2513
2516
|
replyTo: msg.reply_to,
|
|
2514
2517
|
signatureValid,
|
|
@@ -3471,6 +3474,52 @@ var VoidlyAgent = class _VoidlyAgent {
|
|
|
3471
3474
|
if (!res.ok) throw new Error(`Route failed: ${res.status} ${await res.text()}`);
|
|
3472
3475
|
return res.json();
|
|
3473
3476
|
}
|
|
3477
|
+
// ── Heartbeat ──────────────────────────────────────────────────────────────
|
|
3478
|
+
/** Send heartbeat — signals agent is alive, updates last_seen */
|
|
3479
|
+
async ping() {
|
|
3480
|
+
const res = await fetch(`${this.baseUrl}/v1/agent/ping`, {
|
|
3481
|
+
method: "POST",
|
|
3482
|
+
headers: { "X-Agent-Key": this.apiKey }
|
|
3483
|
+
});
|
|
3484
|
+
if (!res.ok) throw new Error(`Ping failed: ${res.status}`);
|
|
3485
|
+
return res.json();
|
|
3486
|
+
}
|
|
3487
|
+
/** Check if another agent is online (public) */
|
|
3488
|
+
async checkOnline(did) {
|
|
3489
|
+
const res = await fetch(`${this.baseUrl}/v1/agent/ping/${encodeURIComponent(did)}`);
|
|
3490
|
+
if (!res.ok) throw new Error(`Ping check failed: ${res.status}`);
|
|
3491
|
+
return res.json();
|
|
3492
|
+
}
|
|
3493
|
+
// ── Key Pinning (TOFU) ────────────────────────────────────────────────────
|
|
3494
|
+
/** Pin another agent's public keys (Trust On First Use). Returns warning if keys changed since last pin. */
|
|
3495
|
+
async pinKeys(did) {
|
|
3496
|
+
const res = await fetch(`${this.baseUrl}/v1/agent/keys/pin`, {
|
|
3497
|
+
method: "POST",
|
|
3498
|
+
headers: { "Content-Type": "application/json", "X-Agent-Key": this.apiKey },
|
|
3499
|
+
body: JSON.stringify({ did })
|
|
3500
|
+
});
|
|
3501
|
+
if (!res.ok) throw new Error(`Key pin failed: ${res.status}`);
|
|
3502
|
+
return res.json();
|
|
3503
|
+
}
|
|
3504
|
+
/** List all pinned keys */
|
|
3505
|
+
async listPinnedKeys(options) {
|
|
3506
|
+
const params = new URLSearchParams();
|
|
3507
|
+
if (options?.status) params.set("status", options.status);
|
|
3508
|
+
const qs = params.toString() ? `?${params.toString()}` : "";
|
|
3509
|
+
const res = await fetch(`${this.baseUrl}/v1/agent/keys/pins${qs}`, {
|
|
3510
|
+
headers: { "X-Agent-Key": this.apiKey }
|
|
3511
|
+
});
|
|
3512
|
+
if (!res.ok) throw new Error(`List pins failed: ${res.status}`);
|
|
3513
|
+
return res.json();
|
|
3514
|
+
}
|
|
3515
|
+
/** Verify an agent's keys against your pinned copy. Detects key changes (potential MitM). */
|
|
3516
|
+
async verifyKeys(did) {
|
|
3517
|
+
const res = await fetch(`${this.baseUrl}/v1/agent/keys/verify/${encodeURIComponent(did)}`, {
|
|
3518
|
+
headers: { "X-Agent-Key": this.apiKey }
|
|
3519
|
+
});
|
|
3520
|
+
if (!res.ok) throw new Error(`Key verify failed: ${res.status}`);
|
|
3521
|
+
return res.json();
|
|
3522
|
+
}
|
|
3474
3523
|
};
|
|
3475
3524
|
var export_decodeBase64 = import_tweetnacl_util.decodeBase64;
|
|
3476
3525
|
var export_decodeUTF8 = import_tweetnacl_util.decodeUTF8;
|