@oneshot-agent/sdk 0.16.1 → 0.17.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/README.md +17 -0
- package/dist/errors.d.ts +31 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +68 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +24 -1048
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +189 -190
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +1015 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +7 -0
- package/dist/types.js.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -305,6 +305,23 @@ await agent.email({
|
|
|
305
305
|
});
|
|
306
306
|
```
|
|
307
307
|
|
|
308
|
+
### Custom Sender (name, mailbox, domain)
|
|
309
|
+
|
|
310
|
+
```typescript
|
|
311
|
+
// Renders as: From: Jane Doe <jane@acme.com>
|
|
312
|
+
await agent.email({
|
|
313
|
+
to: 'user@example.com',
|
|
314
|
+
subject: 'Hello',
|
|
315
|
+
body: 'Sent from a custom sender.',
|
|
316
|
+
from_name: 'Jane Doe', // display name (optional)
|
|
317
|
+
from_mailbox: 'jane', // local-part, defaults to "agent"
|
|
318
|
+
from_domain: 'acme.com' // defaults to "oneshotagent.com"
|
|
319
|
+
});
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
`from_domain` must be a domain you've provisioned through OneShot. Defaults
|
|
323
|
+
produce `agent@oneshotagent.com`.
|
|
324
|
+
|
|
308
325
|
### People Search & Enrichment
|
|
309
326
|
|
|
310
327
|
```typescript
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export declare class OneShotError extends Error {
|
|
2
|
+
constructor(message: string);
|
|
3
|
+
}
|
|
4
|
+
export declare class ToolError extends OneShotError {
|
|
5
|
+
readonly statusCode: number;
|
|
6
|
+
readonly responseBody: string;
|
|
7
|
+
constructor(message: string, statusCode: number, responseBody: string);
|
|
8
|
+
}
|
|
9
|
+
export declare class JobError extends OneShotError {
|
|
10
|
+
readonly jobId: string;
|
|
11
|
+
readonly jobError: string;
|
|
12
|
+
constructor(message: string, jobId: string, jobError: string);
|
|
13
|
+
}
|
|
14
|
+
export declare class JobTimeoutError extends OneShotError {
|
|
15
|
+
readonly jobId: string;
|
|
16
|
+
readonly elapsedMs: number;
|
|
17
|
+
constructor(jobId: string, elapsedMs: number);
|
|
18
|
+
}
|
|
19
|
+
export declare class ValidationError extends OneShotError {
|
|
20
|
+
readonly field: string;
|
|
21
|
+
constructor(message: string, field: string);
|
|
22
|
+
}
|
|
23
|
+
export declare class ContentBlockedError extends OneShotError {
|
|
24
|
+
readonly categories: string[];
|
|
25
|
+
constructor(message: string, categories: string[]);
|
|
26
|
+
}
|
|
27
|
+
export declare class EmergencyNumberError extends OneShotError {
|
|
28
|
+
readonly blockedNumber: string;
|
|
29
|
+
constructor(message: string, blockedNumber: string);
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAMA,qBAAa,YAAa,SAAQ,KAAK;gBACzB,OAAO,EAAE,MAAM;CAK5B;AAED,qBAAa,SAAU,SAAQ,YAAY;aAGvB,UAAU,EAAE,MAAM;aAClB,YAAY,EAAE,MAAM;gBAFpC,OAAO,EAAE,MAAM,EACC,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM;CAKvC;AAED,qBAAa,QAAS,SAAQ,YAAY;aAGtB,KAAK,EAAE,MAAM;aACb,QAAQ,EAAE,MAAM;gBAFhC,OAAO,EAAE,MAAM,EACC,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM;CAKnC;AAED,qBAAa,eAAgB,SAAQ,YAAY;aAE7B,KAAK,EAAE,MAAM;aACb,SAAS,EAAE,MAAM;gBADjB,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM;CAKpC;AAED,qBAAa,eAAgB,SAAQ,YAAY;aACF,KAAK,EAAE,MAAM;gBAA9C,OAAO,EAAE,MAAM,EAAkB,KAAK,EAAE,MAAM;CAI3D;AAED,qBAAa,mBAAoB,SAAQ,YAAY;aAGjC,UAAU,EAAE,MAAM,EAAE;gBADpC,OAAO,EAAE,MAAM,EACC,UAAU,EAAE,MAAM,EAAE;CAKvC;AAED,qBAAa,oBAAqB,SAAQ,YAAY;aAGlC,aAAa,EAAE,MAAM;gBADrC,OAAO,EAAE,MAAM,EACC,aAAa,EAAE,MAAM;CAKxC"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Custom error hierarchy. Every SDK-thrown error is a subclass of OneShotError
|
|
3
|
+
// so consumers can `catch (err instanceof OneShotError)` once and inspect
|
|
4
|
+
// `err.name` for the specific type. Each subclass carries the structured fields
|
|
5
|
+
// that drove the throw (statusCode/responseBody, jobId, field, categories, …)
|
|
6
|
+
// so error handlers don't need to re-parse strings.
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.EmergencyNumberError = exports.ContentBlockedError = exports.ValidationError = exports.JobTimeoutError = exports.JobError = exports.ToolError = exports.OneShotError = void 0;
|
|
9
|
+
class OneShotError extends Error {
|
|
10
|
+
constructor(message) {
|
|
11
|
+
super(message);
|
|
12
|
+
this.name = 'OneShotError';
|
|
13
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.OneShotError = OneShotError;
|
|
17
|
+
class ToolError extends OneShotError {
|
|
18
|
+
constructor(message, statusCode, responseBody) {
|
|
19
|
+
super(message);
|
|
20
|
+
this.statusCode = statusCode;
|
|
21
|
+
this.responseBody = responseBody;
|
|
22
|
+
this.name = 'ToolError';
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.ToolError = ToolError;
|
|
26
|
+
class JobError extends OneShotError {
|
|
27
|
+
constructor(message, jobId, jobError) {
|
|
28
|
+
super(message);
|
|
29
|
+
this.jobId = jobId;
|
|
30
|
+
this.jobError = jobError;
|
|
31
|
+
this.name = 'JobError';
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.JobError = JobError;
|
|
35
|
+
class JobTimeoutError extends OneShotError {
|
|
36
|
+
constructor(jobId, elapsedMs) {
|
|
37
|
+
super(`Job ${jobId} timed out after ${elapsedMs / 1000}s`);
|
|
38
|
+
this.jobId = jobId;
|
|
39
|
+
this.elapsedMs = elapsedMs;
|
|
40
|
+
this.name = 'JobTimeoutError';
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.JobTimeoutError = JobTimeoutError;
|
|
44
|
+
class ValidationError extends OneShotError {
|
|
45
|
+
constructor(message, field) {
|
|
46
|
+
super(message);
|
|
47
|
+
this.field = field;
|
|
48
|
+
this.name = 'ValidationError';
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports.ValidationError = ValidationError;
|
|
52
|
+
class ContentBlockedError extends OneShotError {
|
|
53
|
+
constructor(message, categories) {
|
|
54
|
+
super(message);
|
|
55
|
+
this.categories = categories;
|
|
56
|
+
this.name = 'ContentBlockedError';
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.ContentBlockedError = ContentBlockedError;
|
|
60
|
+
class EmergencyNumberError extends OneShotError {
|
|
61
|
+
constructor(message, blockedNumber) {
|
|
62
|
+
super(message);
|
|
63
|
+
this.blockedNumber = blockedNumber;
|
|
64
|
+
this.name = 'EmergencyNumberError';
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
exports.EmergencyNumberError = EmergencyNumberError;
|
|
68
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":";AAAA,+E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