@agentuity/core 1.0.24 → 1.0.25
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.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/services/email.d.ts +48 -2
- package/dist/services/email.d.ts.map +1 -1
- package/dist/services/email.js +39 -0
- package/dist/services/email.js.map +1 -1
- package/dist/services/index.d.ts +2 -0
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +1 -0
- package/dist/services/index.js.map +1 -1
- package/dist/services/task.d.ts +146 -1
- package/dist/services/task.d.ts.map +1 -1
- package/dist/services/task.js +602 -1
- package/dist/services/task.js.map +1 -1
- package/dist/services/webhook.d.ts +101 -0
- package/dist/services/webhook.d.ts.map +1 -0
- package/dist/services/webhook.js +337 -0
- package/dist/services/webhook.js.map +1 -0
- package/package.json +2 -2
- package/src/index.ts +29 -0
- package/src/services/email.ts +95 -18
- package/src/services/index.ts +18 -0
- package/src/services/task.ts +941 -2
- package/src/services/webhook.ts +519 -0
package/src/services/email.ts
CHANGED
|
@@ -39,7 +39,7 @@ export interface EmailInbound {
|
|
|
39
39
|
html?: string;
|
|
40
40
|
received_at?: string;
|
|
41
41
|
headers?: Record<string, unknown>;
|
|
42
|
-
attachments?:
|
|
42
|
+
attachments?: EmailStoredAttachment[];
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
/**
|
|
@@ -56,7 +56,7 @@ export interface EmailOutbound {
|
|
|
56
56
|
error?: string;
|
|
57
57
|
created_at?: string;
|
|
58
58
|
headers?: Record<string, unknown>;
|
|
59
|
-
attachments?:
|
|
59
|
+
attachments?: EmailStoredAttachment[];
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
/**
|
|
@@ -79,6 +79,25 @@ export interface EmailAttachment {
|
|
|
79
79
|
contentType?: string;
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
+
/**
|
|
83
|
+
* A stored email attachment with S3 location metadata.
|
|
84
|
+
* Returned by inbound/outbound email queries — different from EmailAttachment used for sending.
|
|
85
|
+
*/
|
|
86
|
+
export interface EmailStoredAttachment {
|
|
87
|
+
/** The original filename */
|
|
88
|
+
filename: string;
|
|
89
|
+
/** The MIME content type */
|
|
90
|
+
content_type?: string;
|
|
91
|
+
/** File size in bytes */
|
|
92
|
+
size: number;
|
|
93
|
+
/** The S3 bucket name where the attachment is stored */
|
|
94
|
+
bucket: string;
|
|
95
|
+
/** The S3 object key */
|
|
96
|
+
key: string;
|
|
97
|
+
/** Optional pre-signed download URL */
|
|
98
|
+
url?: string;
|
|
99
|
+
}
|
|
100
|
+
|
|
82
101
|
/**
|
|
83
102
|
* Parameters for sending an email
|
|
84
103
|
*/
|
|
@@ -112,6 +131,11 @@ export interface EmailSendParams {
|
|
|
112
131
|
* File attachments
|
|
113
132
|
*/
|
|
114
133
|
attachments?: EmailAttachment[];
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Custom email headers (e.g., In-Reply-To, References for threading)
|
|
137
|
+
*/
|
|
138
|
+
headers?: Record<string, string>;
|
|
115
139
|
}
|
|
116
140
|
|
|
117
141
|
/**
|
|
@@ -278,6 +302,18 @@ export interface EmailService {
|
|
|
278
302
|
*/
|
|
279
303
|
getInbound(id: string): Promise<EmailInbound | null>;
|
|
280
304
|
|
|
305
|
+
/**
|
|
306
|
+
* Delete an inbound email by ID
|
|
307
|
+
*
|
|
308
|
+
* @param id - the inbound email ID
|
|
309
|
+
*
|
|
310
|
+
* @example
|
|
311
|
+
* ```typescript
|
|
312
|
+
* await email.deleteInbound('inb_abc123');
|
|
313
|
+
* ```
|
|
314
|
+
*/
|
|
315
|
+
deleteInbound(id: string): Promise<void>;
|
|
316
|
+
|
|
281
317
|
/**
|
|
282
318
|
* List outbound emails
|
|
283
319
|
*
|
|
@@ -309,6 +345,18 @@ export interface EmailService {
|
|
|
309
345
|
* ```
|
|
310
346
|
*/
|
|
311
347
|
getOutbound(id: string): Promise<EmailOutbound | null>;
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Delete an outbound email by ID
|
|
351
|
+
*
|
|
352
|
+
* @param id - the outbound email ID
|
|
353
|
+
*
|
|
354
|
+
* @example
|
|
355
|
+
* ```typescript
|
|
356
|
+
* await email.deleteOutbound('out_abc123');
|
|
357
|
+
* ```
|
|
358
|
+
*/
|
|
359
|
+
deleteOutbound(id: string): Promise<void>;
|
|
312
360
|
}
|
|
313
361
|
|
|
314
362
|
/**
|
|
@@ -384,10 +432,7 @@ export class EmailStorageService implements EmailService {
|
|
|
384
432
|
}
|
|
385
433
|
|
|
386
434
|
async getAddress(id: string): Promise<EmailAddress | null> {
|
|
387
|
-
const url = buildUrl(
|
|
388
|
-
this.#baseUrl,
|
|
389
|
-
`/email/2025-03-17/addresses/${encodeURIComponent(id)}`
|
|
390
|
-
);
|
|
435
|
+
const url = buildUrl(this.#baseUrl, `/email/2025-03-17/addresses/${encodeURIComponent(id)}`);
|
|
391
436
|
const signal = AbortSignal.timeout(30_000);
|
|
392
437
|
const res = await this.#adapter.invoke<unknown>(url, {
|
|
393
438
|
method: 'GET',
|
|
@@ -409,10 +454,7 @@ export class EmailStorageService implements EmailService {
|
|
|
409
454
|
}
|
|
410
455
|
|
|
411
456
|
async deleteAddress(id: string): Promise<void> {
|
|
412
|
-
const url = buildUrl(
|
|
413
|
-
this.#baseUrl,
|
|
414
|
-
`/email/2025-03-17/addresses/${encodeURIComponent(id)}`
|
|
415
|
-
);
|
|
457
|
+
const url = buildUrl(this.#baseUrl, `/email/2025-03-17/addresses/${encodeURIComponent(id)}`);
|
|
416
458
|
const signal = AbortSignal.timeout(30_000);
|
|
417
459
|
const res = await this.#adapter.invoke<unknown>(url, {
|
|
418
460
|
method: 'DELETE',
|
|
@@ -531,6 +573,9 @@ export class EmailStorageService implements EmailService {
|
|
|
531
573
|
...(a.contentType && { content_type: a.contentType }),
|
|
532
574
|
}));
|
|
533
575
|
}
|
|
576
|
+
if (params.headers && Object.keys(params.headers).length > 0) {
|
|
577
|
+
body.headers = params.headers;
|
|
578
|
+
}
|
|
534
579
|
|
|
535
580
|
const res = await this.#adapter.invoke<unknown>(url, {
|
|
536
581
|
method: 'POST',
|
|
@@ -583,10 +628,7 @@ export class EmailStorageService implements EmailService {
|
|
|
583
628
|
}
|
|
584
629
|
|
|
585
630
|
async getInbound(id: string): Promise<EmailInbound | null> {
|
|
586
|
-
const url = buildUrl(
|
|
587
|
-
this.#baseUrl,
|
|
588
|
-
`/email/2025-03-17/inbound/${encodeURIComponent(id)}`
|
|
589
|
-
);
|
|
631
|
+
const url = buildUrl(this.#baseUrl, `/email/2025-03-17/inbound/${encodeURIComponent(id)}`);
|
|
590
632
|
const signal = AbortSignal.timeout(30_000);
|
|
591
633
|
const res = await this.#adapter.invoke<unknown>(url, {
|
|
592
634
|
method: 'GET',
|
|
@@ -607,6 +649,25 @@ export class EmailStorageService implements EmailService {
|
|
|
607
649
|
throw await toServiceException('GET', url, res.response);
|
|
608
650
|
}
|
|
609
651
|
|
|
652
|
+
async deleteInbound(id: string): Promise<void> {
|
|
653
|
+
const url = buildUrl(this.#baseUrl, `/email/2025-03-17/inbound/${encodeURIComponent(id)}`);
|
|
654
|
+
const signal = AbortSignal.timeout(30_000);
|
|
655
|
+
const res = await this.#adapter.invoke<unknown>(url, {
|
|
656
|
+
method: 'DELETE',
|
|
657
|
+
signal,
|
|
658
|
+
telemetry: {
|
|
659
|
+
name: 'agentuity.email.deleteInbound',
|
|
660
|
+
attributes: {
|
|
661
|
+
id,
|
|
662
|
+
},
|
|
663
|
+
},
|
|
664
|
+
});
|
|
665
|
+
if (res.ok || res.response.status === 404) {
|
|
666
|
+
return;
|
|
667
|
+
}
|
|
668
|
+
throw await toServiceException('DELETE', url, res.response);
|
|
669
|
+
}
|
|
670
|
+
|
|
610
671
|
async listOutbound(addressId?: string): Promise<EmailOutbound[]> {
|
|
611
672
|
const queryParams = new URLSearchParams();
|
|
612
673
|
if (addressId) {
|
|
@@ -639,10 +700,7 @@ export class EmailStorageService implements EmailService {
|
|
|
639
700
|
}
|
|
640
701
|
|
|
641
702
|
async getOutbound(id: string): Promise<EmailOutbound | null> {
|
|
642
|
-
const url = buildUrl(
|
|
643
|
-
this.#baseUrl,
|
|
644
|
-
`/email/2025-03-17/outbound/${encodeURIComponent(id)}`
|
|
645
|
-
);
|
|
703
|
+
const url = buildUrl(this.#baseUrl, `/email/2025-03-17/outbound/${encodeURIComponent(id)}`);
|
|
646
704
|
const signal = AbortSignal.timeout(30_000);
|
|
647
705
|
const res = await this.#adapter.invoke<unknown>(url, {
|
|
648
706
|
method: 'GET',
|
|
@@ -662,4 +720,23 @@ export class EmailStorageService implements EmailService {
|
|
|
662
720
|
}
|
|
663
721
|
throw await toServiceException('GET', url, res.response);
|
|
664
722
|
}
|
|
723
|
+
|
|
724
|
+
async deleteOutbound(id: string): Promise<void> {
|
|
725
|
+
const url = buildUrl(this.#baseUrl, `/email/2025-03-17/outbound/${encodeURIComponent(id)}`);
|
|
726
|
+
const signal = AbortSignal.timeout(30_000);
|
|
727
|
+
const res = await this.#adapter.invoke<unknown>(url, {
|
|
728
|
+
method: 'DELETE',
|
|
729
|
+
signal,
|
|
730
|
+
telemetry: {
|
|
731
|
+
name: 'agentuity.email.deleteOutbound',
|
|
732
|
+
attributes: {
|
|
733
|
+
id,
|
|
734
|
+
},
|
|
735
|
+
},
|
|
736
|
+
});
|
|
737
|
+
if (res.ok || res.response.status === 404) {
|
|
738
|
+
return;
|
|
739
|
+
}
|
|
740
|
+
throw await toServiceException('DELETE', url, res.response);
|
|
741
|
+
}
|
|
665
742
|
}
|
package/src/services/index.ts
CHANGED
|
@@ -9,5 +9,23 @@ export * from './session.ts';
|
|
|
9
9
|
export * from './stream.ts';
|
|
10
10
|
export * from './task.ts';
|
|
11
11
|
export * from './vector.ts';
|
|
12
|
+
export { WebhookService } from './webhook.ts';
|
|
13
|
+
export type {
|
|
14
|
+
Webhook,
|
|
15
|
+
WebhookDestination,
|
|
16
|
+
WebhookReceipt,
|
|
17
|
+
WebhookDelivery,
|
|
18
|
+
CreateWebhookParams,
|
|
19
|
+
UpdateWebhookParams,
|
|
20
|
+
CreateWebhookDestinationParams,
|
|
21
|
+
WebhookListResult,
|
|
22
|
+
WebhookGetResult,
|
|
23
|
+
WebhookCreateResult,
|
|
24
|
+
UpdateWebhookResult,
|
|
25
|
+
CreateDestinationResult,
|
|
26
|
+
ListDestinationsResult,
|
|
27
|
+
WebhookReceiptListResult,
|
|
28
|
+
WebhookDeliveryListResult,
|
|
29
|
+
} from './webhook.ts';
|
|
12
30
|
export * from './email.ts';
|
|
13
31
|
export { buildUrl, toServiceException, toPayload, fromResponse } from './_util.ts';
|