agentmail 0.5.30 → 0.5.32
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/cjs/BaseClient.js +2 -2
- package/dist/cjs/api/resources/agent/client/Client.d.ts +32 -2
- package/dist/cjs/api/resources/agent/client/Client.js +97 -2
- package/dist/cjs/api/resources/agent/types/AgentAttachHumanRequest.d.ts +7 -0
- package/dist/cjs/api/resources/agent/types/AgentAttachHumanRequest.js +3 -0
- package/dist/cjs/api/resources/agent/types/AgentAttachHumanResponse.d.ts +9 -0
- package/dist/cjs/api/resources/agent/types/AgentAttachHumanResponse.js +3 -0
- package/dist/cjs/api/resources/agent/types/AgentSignupRequest.d.ts +5 -2
- package/dist/cjs/api/resources/agent/types/index.d.ts +2 -0
- package/dist/cjs/api/resources/agent/types/index.js +2 -0
- package/dist/cjs/api/resources/apiKeys/types/ApiKeyPermissions.d.ts +2 -0
- package/dist/cjs/api/resources/apiKeys/types/CreateApiKeyResponse.d.ts +1 -0
- package/dist/cjs/api/resources/apiKeys/types/CreateBearerApiKeyRequest.d.ts +8 -0
- package/dist/cjs/serialization/resources/agent/types/AgentAttachHumanRequest.d.ts +9 -0
- package/dist/cjs/serialization/resources/agent/types/AgentAttachHumanRequest.js +41 -0
- package/dist/cjs/serialization/resources/agent/types/AgentAttachHumanResponse.d.ts +10 -0
- package/dist/cjs/serialization/resources/agent/types/AgentAttachHumanResponse.js +42 -0
- package/dist/cjs/serialization/resources/agent/types/AgentSignupRequest.d.ts +1 -1
- package/dist/cjs/serialization/resources/agent/types/AgentSignupRequest.js +1 -1
- package/dist/cjs/serialization/resources/agent/types/index.d.ts +2 -0
- package/dist/cjs/serialization/resources/agent/types/index.js +2 -0
- package/dist/cjs/serialization/resources/apiKeys/types/ApiKeyPermissions.d.ts +1 -0
- package/dist/cjs/serialization/resources/apiKeys/types/ApiKeyPermissions.js +1 -0
- package/dist/cjs/serialization/resources/apiKeys/types/CreateApiKeyResponse.d.ts +2 -0
- package/dist/cjs/serialization/resources/apiKeys/types/CreateApiKeyResponse.js +2 -0
- package/dist/cjs/serialization/resources/apiKeys/types/CreateBearerApiKeyRequest.d.ts +2 -0
- package/dist/cjs/serialization/resources/apiKeys/types/CreateBearerApiKeyRequest.js +6 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/api/resources/agent/client/Client.d.mts +32 -2
- package/dist/esm/api/resources/agent/client/Client.mjs +97 -2
- package/dist/esm/api/resources/agent/types/AgentAttachHumanRequest.d.mts +7 -0
- package/dist/esm/api/resources/agent/types/AgentAttachHumanRequest.mjs +2 -0
- package/dist/esm/api/resources/agent/types/AgentAttachHumanResponse.d.mts +9 -0
- package/dist/esm/api/resources/agent/types/AgentAttachHumanResponse.mjs +2 -0
- package/dist/esm/api/resources/agent/types/AgentSignupRequest.d.mts +5 -2
- package/dist/esm/api/resources/agent/types/index.d.mts +2 -0
- package/dist/esm/api/resources/agent/types/index.mjs +2 -0
- package/dist/esm/api/resources/apiKeys/types/ApiKeyPermissions.d.mts +2 -0
- package/dist/esm/api/resources/apiKeys/types/CreateApiKeyResponse.d.mts +1 -0
- package/dist/esm/api/resources/apiKeys/types/CreateBearerApiKeyRequest.d.mts +8 -0
- package/dist/esm/serialization/resources/agent/types/AgentAttachHumanRequest.d.mts +9 -0
- package/dist/esm/serialization/resources/agent/types/AgentAttachHumanRequest.mjs +5 -0
- package/dist/esm/serialization/resources/agent/types/AgentAttachHumanResponse.d.mts +10 -0
- package/dist/esm/serialization/resources/agent/types/AgentAttachHumanResponse.mjs +6 -0
- package/dist/esm/serialization/resources/agent/types/AgentSignupRequest.d.mts +1 -1
- package/dist/esm/serialization/resources/agent/types/AgentSignupRequest.mjs +1 -1
- package/dist/esm/serialization/resources/agent/types/index.d.mts +2 -0
- package/dist/esm/serialization/resources/agent/types/index.mjs +2 -0
- package/dist/esm/serialization/resources/apiKeys/types/ApiKeyPermissions.d.mts +1 -0
- package/dist/esm/serialization/resources/apiKeys/types/ApiKeyPermissions.mjs +1 -0
- package/dist/esm/serialization/resources/apiKeys/types/CreateApiKeyResponse.d.mts +2 -0
- package/dist/esm/serialization/resources/apiKeys/types/CreateApiKeyResponse.mjs +2 -0
- package/dist/esm/serialization/resources/apiKeys/types/CreateBearerApiKeyRequest.d.mts +2 -0
- package/dist/esm/serialization/resources/apiKeys/types/CreateBearerApiKeyRequest.mjs +6 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/dist/llms.txt +7 -2
- package/package.json +2 -2
- package/reference.md +81 -2
- package/dist/llms-full.txt +0 -0
package/dist/cjs/BaseClient.js
CHANGED
|
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
|
|
|
43
43
|
const headers = (0, headers_js_1.mergeHeaders)({
|
|
44
44
|
"X-Fern-Language": "JavaScript",
|
|
45
45
|
"X-Fern-SDK-Name": "agentmail",
|
|
46
|
-
"X-Fern-SDK-Version": "0.5.
|
|
47
|
-
"User-Agent": "agentmail/0.5.
|
|
46
|
+
"X-Fern-SDK-Version": "0.5.32",
|
|
47
|
+
"User-Agent": "agentmail/0.5.32",
|
|
48
48
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
49
49
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
50
50
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
|
@@ -15,6 +15,8 @@ export declare class AgentClient {
|
|
|
15
15
|
*
|
|
16
16
|
* A 6-digit OTP is sent to the human's email for verification.
|
|
17
17
|
*
|
|
18
|
+
* `human_email` is optional. Without it, the inbox can receive email but cannot send to anyone until a human is attached with the attach human endpoint. There is also no way to recover the API key, so store it durably. Calling sign-up again without `human_email` creates a new organization, which needs a different `username`: the original username stays with the lost organization's inbox.
|
|
19
|
+
*
|
|
18
20
|
* This endpoint is idempotent. Calling it again with the same `human_email` will rotate the API key and resend the OTP if expired.
|
|
19
21
|
*
|
|
20
22
|
* The returned API key has limited permissions until the organization is verified via the verify endpoint.
|
|
@@ -31,18 +33,46 @@ export declare class AgentClient {
|
|
|
31
33
|
*
|
|
32
34
|
* @example
|
|
33
35
|
* await client.agent.signUp({
|
|
34
|
-
* humanEmail: "human_email",
|
|
35
36
|
* username: "username"
|
|
36
37
|
* })
|
|
37
38
|
*/
|
|
38
39
|
signUp(request: AgentMail.AgentSignupRequest, requestOptions?: AgentClient.RequestOptions): core.HttpResponsePromise<AgentMail.AgentSignupResponse>;
|
|
39
40
|
private __signUp;
|
|
41
|
+
/**
|
|
42
|
+
* Attach a human to an unverified agent organization. A 6-digit OTP is sent to the human's email, which you then submit to the verify endpoint.
|
|
43
|
+
*
|
|
44
|
+
* Use it after signing up without a `human_email`. Once the human is attached, the organization can send email to that human only, and verification lifts the remaining restrictions. For up to 5 minutes after attaching, sends to the human can still be rejected with a `429` daily send limit error while the API key's cached limits catch up. Wait and retry.
|
|
45
|
+
*
|
|
46
|
+
* Calling it again with the same `human_email` does not rotate the API key. It resends the OTP if it was never delivered, or issues a new one if it expired. While the current OTP is still valid, calling it again keeps that OTP and its attempt count. If all 10 attempts are used up, wait until the OTP expires, 24 hours after it was issued, then call it again for a new one.
|
|
47
|
+
*
|
|
48
|
+
* Calling it with a different `human_email` replaces the attached human and sends the new human an OTP. An organization can replace its human at most 2 times.
|
|
49
|
+
*
|
|
50
|
+
* Only available until the organization is verified.
|
|
51
|
+
*
|
|
52
|
+
* **CLI:**
|
|
53
|
+
* ```bash
|
|
54
|
+
* agentmail agent attach-human --human-email user@example.com
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* @param {AgentMail.AgentAttachHumanRequest} request
|
|
58
|
+
* @param {AgentClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
59
|
+
*
|
|
60
|
+
* @throws {@link AgentMail.ValidationError}
|
|
61
|
+
* @throws {@link AgentMail.ConflictError}
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* await client.agent.attachHuman({
|
|
65
|
+
* humanEmail: "human_email"
|
|
66
|
+
* })
|
|
67
|
+
*/
|
|
68
|
+
attachHuman(request: AgentMail.AgentAttachHumanRequest, requestOptions?: AgentClient.RequestOptions): core.HttpResponsePromise<AgentMail.AgentAttachHumanResponse>;
|
|
69
|
+
private __attachHuman;
|
|
40
70
|
/**
|
|
41
71
|
* Verify an agent organization using the 6-digit OTP sent to the human's email during sign-up.
|
|
42
72
|
*
|
|
43
73
|
* On success, the organization is upgraded from `agent_unverified` to `agent_verified`, the send allowlist is removed, and free plan entitlements are applied.
|
|
44
74
|
*
|
|
45
|
-
* The OTP expires after 24 hours and allows a maximum of 10 attempts. If you run into any difficulties receiving the OTP code, you can also create an account on [console.agentmail.to](https://console.agentmail.to) using the human email address you provided to verify your account.
|
|
75
|
+
* The OTP expires after 24 hours and allows a maximum of 10 attempts. If the OTP expired, call the attach human endpoint with the same `human_email` to get a new one without rotating the API key. Once all 10 attempts are used, even the correct OTP is rejected, and attach human keeps returning the same OTP until it expires, so wait for it to expire before asking for a new one. An organization that signed up without a `human_email` has no OTP until a human is attached. If you run into any difficulties receiving the OTP code, you can also create an account on [console.agentmail.to](https://console.agentmail.to) using the human email address you provided to verify your account.
|
|
46
76
|
*
|
|
47
77
|
* **CLI:**
|
|
48
78
|
* ```bash
|
|
@@ -61,6 +61,8 @@ class AgentClient {
|
|
|
61
61
|
*
|
|
62
62
|
* A 6-digit OTP is sent to the human's email for verification.
|
|
63
63
|
*
|
|
64
|
+
* `human_email` is optional. Without it, the inbox can receive email but cannot send to anyone until a human is attached with the attach human endpoint. There is also no way to recover the API key, so store it durably. Calling sign-up again without `human_email` creates a new organization, which needs a different `username`: the original username stays with the lost organization's inbox.
|
|
65
|
+
*
|
|
64
66
|
* This endpoint is idempotent. Calling it again with the same `human_email` will rotate the API key and resend the OTP if expired.
|
|
65
67
|
*
|
|
66
68
|
* The returned API key has limited permissions until the organization is verified via the verify endpoint.
|
|
@@ -77,7 +79,6 @@ class AgentClient {
|
|
|
77
79
|
*
|
|
78
80
|
* @example
|
|
79
81
|
* await client.agent.signUp({
|
|
80
|
-
* humanEmail: "human_email",
|
|
81
82
|
* username: "username"
|
|
82
83
|
* })
|
|
83
84
|
*/
|
|
@@ -139,12 +140,106 @@ class AgentClient {
|
|
|
139
140
|
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v0/agent/sign-up");
|
|
140
141
|
});
|
|
141
142
|
}
|
|
143
|
+
/**
|
|
144
|
+
* Attach a human to an unverified agent organization. A 6-digit OTP is sent to the human's email, which you then submit to the verify endpoint.
|
|
145
|
+
*
|
|
146
|
+
* Use it after signing up without a `human_email`. Once the human is attached, the organization can send email to that human only, and verification lifts the remaining restrictions. For up to 5 minutes after attaching, sends to the human can still be rejected with a `429` daily send limit error while the API key's cached limits catch up. Wait and retry.
|
|
147
|
+
*
|
|
148
|
+
* Calling it again with the same `human_email` does not rotate the API key. It resends the OTP if it was never delivered, or issues a new one if it expired. While the current OTP is still valid, calling it again keeps that OTP and its attempt count. If all 10 attempts are used up, wait until the OTP expires, 24 hours after it was issued, then call it again for a new one.
|
|
149
|
+
*
|
|
150
|
+
* Calling it with a different `human_email` replaces the attached human and sends the new human an OTP. An organization can replace its human at most 2 times.
|
|
151
|
+
*
|
|
152
|
+
* Only available until the organization is verified.
|
|
153
|
+
*
|
|
154
|
+
* **CLI:**
|
|
155
|
+
* ```bash
|
|
156
|
+
* agentmail agent attach-human --human-email user@example.com
|
|
157
|
+
* ```
|
|
158
|
+
*
|
|
159
|
+
* @param {AgentMail.AgentAttachHumanRequest} request
|
|
160
|
+
* @param {AgentClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
161
|
+
*
|
|
162
|
+
* @throws {@link AgentMail.ValidationError}
|
|
163
|
+
* @throws {@link AgentMail.ConflictError}
|
|
164
|
+
*
|
|
165
|
+
* @example
|
|
166
|
+
* await client.agent.attachHuman({
|
|
167
|
+
* humanEmail: "human_email"
|
|
168
|
+
* })
|
|
169
|
+
*/
|
|
170
|
+
attachHuman(request, requestOptions) {
|
|
171
|
+
return core.HttpResponsePromise.fromPromise(this.__attachHuman(request, requestOptions));
|
|
172
|
+
}
|
|
173
|
+
__attachHuman(request, requestOptions) {
|
|
174
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
175
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
176
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
177
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
178
|
+
const _response = yield core.fetcher({
|
|
179
|
+
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Prod)
|
|
180
|
+
.http, "/v0/agent/human"),
|
|
181
|
+
method: "POST",
|
|
182
|
+
headers: _headers,
|
|
183
|
+
contentType: "application/json",
|
|
184
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
185
|
+
requestType: "json",
|
|
186
|
+
body: serializers.AgentAttachHumanRequest.jsonOrThrow(request, {
|
|
187
|
+
unrecognizedObjectKeys: "strip",
|
|
188
|
+
omitUndefined: true,
|
|
189
|
+
}),
|
|
190
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
191
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
192
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
193
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
194
|
+
logging: this._options.logging,
|
|
195
|
+
});
|
|
196
|
+
if (_response.ok) {
|
|
197
|
+
return {
|
|
198
|
+
data: serializers.AgentAttachHumanResponse.parseOrThrow(_response.body, {
|
|
199
|
+
unrecognizedObjectKeys: "passthrough",
|
|
200
|
+
allowUnrecognizedUnionMembers: true,
|
|
201
|
+
allowUnrecognizedEnumValues: true,
|
|
202
|
+
skipValidation: true,
|
|
203
|
+
breadcrumbsPrefix: ["response"],
|
|
204
|
+
}),
|
|
205
|
+
rawResponse: _response.rawResponse,
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
if (_response.error.reason === "status-code") {
|
|
209
|
+
switch (_response.error.statusCode) {
|
|
210
|
+
case 400:
|
|
211
|
+
throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
|
|
212
|
+
unrecognizedObjectKeys: "passthrough",
|
|
213
|
+
allowUnrecognizedUnionMembers: true,
|
|
214
|
+
allowUnrecognizedEnumValues: true,
|
|
215
|
+
skipValidation: true,
|
|
216
|
+
breadcrumbsPrefix: ["response"],
|
|
217
|
+
}), _response.rawResponse);
|
|
218
|
+
case 409:
|
|
219
|
+
throw new AgentMail.ConflictError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
220
|
+
unrecognizedObjectKeys: "passthrough",
|
|
221
|
+
allowUnrecognizedUnionMembers: true,
|
|
222
|
+
allowUnrecognizedEnumValues: true,
|
|
223
|
+
skipValidation: true,
|
|
224
|
+
breadcrumbsPrefix: ["response"],
|
|
225
|
+
}), _response.rawResponse);
|
|
226
|
+
default:
|
|
227
|
+
throw new errors.AgentMailError({
|
|
228
|
+
statusCode: _response.error.statusCode,
|
|
229
|
+
body: _response.error.body,
|
|
230
|
+
rawResponse: _response.rawResponse,
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v0/agent/human");
|
|
235
|
+
});
|
|
236
|
+
}
|
|
142
237
|
/**
|
|
143
238
|
* Verify an agent organization using the 6-digit OTP sent to the human's email during sign-up.
|
|
144
239
|
*
|
|
145
240
|
* On success, the organization is upgraded from `agent_unverified` to `agent_verified`, the send allowlist is removed, and free plan entitlements are applied.
|
|
146
241
|
*
|
|
147
|
-
* The OTP expires after 24 hours and allows a maximum of 10 attempts. If you run into any difficulties receiving the OTP code, you can also create an account on [console.agentmail.to](https://console.agentmail.to) using the human email address you provided to verify your account.
|
|
242
|
+
* The OTP expires after 24 hours and allows a maximum of 10 attempts. If the OTP expired, call the attach human endpoint with the same `human_email` to get a new one without rotating the API key. Once all 10 attempts are used, even the correct OTP is rejected, and attach human keeps returning the same OTP until it expires, so wait for it to expire before asking for a new one. An organization that signed up without a `human_email` has no OTP until a human is attached. If you run into any difficulties receiving the OTP code, you can also create an account on [console.agentmail.to](https://console.agentmail.to) using the human email address you provided to verify your account.
|
|
148
243
|
*
|
|
149
244
|
* **CLI:**
|
|
150
245
|
* ```bash
|
|
@@ -2,8 +2,11 @@
|
|
|
2
2
|
* Request body to sign up an agent.
|
|
3
3
|
*/
|
|
4
4
|
export interface AgentSignupRequest {
|
|
5
|
-
/**
|
|
6
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Email address of the human who owns the agent. A 6-digit OTP will be sent to this address.
|
|
7
|
+
* Omit it to get a receive-only inbox: it can receive email but cannot send until a human is attached with the attach human endpoint.
|
|
8
|
+
*/
|
|
9
|
+
humanEmail?: string;
|
|
7
10
|
/** Username for the auto-created inbox (e.g. "my-agent" creates my-agent@agentmail.to). */
|
|
8
11
|
username: string;
|
|
9
12
|
/**
|
|
@@ -14,6 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./AgentAttachHumanRequest.js"), exports);
|
|
18
|
+
__exportStar(require("./AgentAttachHumanResponse.js"), exports);
|
|
17
19
|
__exportStar(require("./AgentSignupRequest.js"), exports);
|
|
18
20
|
__exportStar(require("./AgentSignupResponse.js"), exports);
|
|
19
21
|
__exportStar(require("./AgentVerifyRequest.js"), exports);
|
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
import type * as AgentMail from "../../../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* `expires_at` must be in the future and is immutable once the key exists.
|
|
4
|
+
* Omitted, the new key inherits the authenticating key's expiry, and never
|
|
5
|
+
* expires only when that key never does. A key cannot create one that
|
|
6
|
+
* outlives it: an `expires_at` later than the authenticating key's own
|
|
7
|
+
* returns `403`.
|
|
8
|
+
*/
|
|
2
9
|
export interface CreateBearerApiKeyRequest extends AgentMail.ApiKeyMutableFields {
|
|
10
|
+
expiresAt?: AgentMail.ExpiresAt;
|
|
3
11
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type * as AgentMail from "../../../../api/index.js";
|
|
2
|
+
import * as core from "../../../../core/index.js";
|
|
3
|
+
import type * as serializers from "../../../index.js";
|
|
4
|
+
export declare const AgentAttachHumanRequest: core.serialization.ObjectSchema<serializers.AgentAttachHumanRequest.Raw, AgentMail.AgentAttachHumanRequest>;
|
|
5
|
+
export declare namespace AgentAttachHumanRequest {
|
|
6
|
+
interface Raw {
|
|
7
|
+
human_email: string;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.AgentAttachHumanRequest = void 0;
|
|
38
|
+
const core = __importStar(require("../../../../core/index.js"));
|
|
39
|
+
exports.AgentAttachHumanRequest = core.serialization.object({
|
|
40
|
+
humanEmail: core.serialization.property("human_email", core.serialization.string()),
|
|
41
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type * as AgentMail from "../../../../api/index.js";
|
|
2
|
+
import * as core from "../../../../core/index.js";
|
|
3
|
+
import type * as serializers from "../../../index.js";
|
|
4
|
+
export declare const AgentAttachHumanResponse: core.serialization.ObjectSchema<serializers.AgentAttachHumanResponse.Raw, AgentMail.AgentAttachHumanResponse>;
|
|
5
|
+
export declare namespace AgentAttachHumanResponse {
|
|
6
|
+
interface Raw {
|
|
7
|
+
human_email: string;
|
|
8
|
+
instructions: string;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.AgentAttachHumanResponse = void 0;
|
|
38
|
+
const core = __importStar(require("../../../../core/index.js"));
|
|
39
|
+
exports.AgentAttachHumanResponse = core.serialization.object({
|
|
40
|
+
humanEmail: core.serialization.property("human_email", core.serialization.string()),
|
|
41
|
+
instructions: core.serialization.string(),
|
|
42
|
+
});
|
|
@@ -4,7 +4,7 @@ import type * as serializers from "../../../index.js";
|
|
|
4
4
|
export declare const AgentSignupRequest: core.serialization.ObjectSchema<serializers.AgentSignupRequest.Raw, AgentMail.AgentSignupRequest>;
|
|
5
5
|
export declare namespace AgentSignupRequest {
|
|
6
6
|
interface Raw {
|
|
7
|
-
human_email
|
|
7
|
+
human_email?: string | null;
|
|
8
8
|
username: string;
|
|
9
9
|
source?: string | null;
|
|
10
10
|
referrer?: string | null;
|
|
@@ -37,7 +37,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
37
37
|
exports.AgentSignupRequest = void 0;
|
|
38
38
|
const core = __importStar(require("../../../../core/index.js"));
|
|
39
39
|
exports.AgentSignupRequest = core.serialization.object({
|
|
40
|
-
humanEmail: core.serialization.property("human_email", core.serialization.string()),
|
|
40
|
+
humanEmail: core.serialization.property("human_email", core.serialization.string().optional()),
|
|
41
41
|
username: core.serialization.string(),
|
|
42
42
|
source: core.serialization.string().optional(),
|
|
43
43
|
referrer: core.serialization.string().optional(),
|
|
@@ -14,6 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./AgentAttachHumanRequest.js"), exports);
|
|
18
|
+
__exportStar(require("./AgentAttachHumanResponse.js"), exports);
|
|
17
19
|
__exportStar(require("./AgentSignupRequest.js"), exports);
|
|
18
20
|
__exportStar(require("./AgentSignupResponse.js"), exports);
|
|
19
21
|
__exportStar(require("./AgentVerifyRequest.js"), exports);
|
|
@@ -75,5 +75,6 @@ exports.ApiKeyPermissions = core.serialization.object({
|
|
|
75
75
|
accountUpdate: core.serialization.property("account_update", core.serialization.boolean().optional()),
|
|
76
76
|
podRead: core.serialization.property("pod_read", core.serialization.boolean().optional()),
|
|
77
77
|
podCreate: core.serialization.property("pod_create", core.serialization.boolean().optional()),
|
|
78
|
+
podUpdate: core.serialization.property("pod_update", core.serialization.boolean().optional()),
|
|
78
79
|
podDelete: core.serialization.property("pod_delete", core.serialization.boolean().optional()),
|
|
79
80
|
});
|
|
@@ -4,6 +4,7 @@ import type * as serializers from "../../../index.js";
|
|
|
4
4
|
import { ApiKeyId } from "./ApiKeyId.js";
|
|
5
5
|
import { ApiKeyPermissions } from "./ApiKeyPermissions.js";
|
|
6
6
|
import { CreatedAt } from "./CreatedAt.js";
|
|
7
|
+
import { ExpiresAt } from "./ExpiresAt.js";
|
|
7
8
|
import { InboxScopeId } from "./InboxScopeId.js";
|
|
8
9
|
import { Name } from "./Name.js";
|
|
9
10
|
import { PodScopeId } from "./PodScopeId.js";
|
|
@@ -19,5 +20,6 @@ export declare namespace CreateApiKeyResponse {
|
|
|
19
20
|
inbox_id?: InboxScopeId.Raw | null;
|
|
20
21
|
permissions?: ApiKeyPermissions.Raw | null;
|
|
21
22
|
created_at: CreatedAt.Raw;
|
|
23
|
+
expires_at?: ExpiresAt.Raw | null;
|
|
22
24
|
}
|
|
23
25
|
}
|
|
@@ -39,6 +39,7 @@ const core = __importStar(require("../../../../core/index.js"));
|
|
|
39
39
|
const ApiKeyId_js_1 = require("./ApiKeyId.js");
|
|
40
40
|
const ApiKeyPermissions_js_1 = require("./ApiKeyPermissions.js");
|
|
41
41
|
const CreatedAt_js_1 = require("./CreatedAt.js");
|
|
42
|
+
const ExpiresAt_js_1 = require("./ExpiresAt.js");
|
|
42
43
|
const InboxScopeId_js_1 = require("./InboxScopeId.js");
|
|
43
44
|
const Name_js_1 = require("./Name.js");
|
|
44
45
|
const PodScopeId_js_1 = require("./PodScopeId.js");
|
|
@@ -52,4 +53,5 @@ exports.CreateApiKeyResponse = core.serialization.object({
|
|
|
52
53
|
inboxId: core.serialization.property("inbox_id", InboxScopeId_js_1.InboxScopeId.optional()),
|
|
53
54
|
permissions: ApiKeyPermissions_js_1.ApiKeyPermissions.optional(),
|
|
54
55
|
createdAt: core.serialization.property("created_at", CreatedAt_js_1.CreatedAt),
|
|
56
|
+
expiresAt: core.serialization.property("expires_at", ExpiresAt_js_1.ExpiresAt.optional()),
|
|
55
57
|
});
|
|
@@ -2,8 +2,10 @@ import type * as AgentMail from "../../../../api/index.js";
|
|
|
2
2
|
import * as core from "../../../../core/index.js";
|
|
3
3
|
import type * as serializers from "../../../index.js";
|
|
4
4
|
import { ApiKeyMutableFields } from "./ApiKeyMutableFields.js";
|
|
5
|
+
import { ExpiresAt } from "./ExpiresAt.js";
|
|
5
6
|
export declare const CreateBearerApiKeyRequest: core.serialization.ObjectSchema<serializers.CreateBearerApiKeyRequest.Raw, AgentMail.CreateBearerApiKeyRequest>;
|
|
6
7
|
export declare namespace CreateBearerApiKeyRequest {
|
|
7
8
|
interface Raw extends ApiKeyMutableFields.Raw {
|
|
9
|
+
expires_at?: ExpiresAt.Raw | null;
|
|
8
10
|
}
|
|
9
11
|
}
|
|
@@ -37,4 +37,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
37
37
|
exports.CreateBearerApiKeyRequest = void 0;
|
|
38
38
|
const core = __importStar(require("../../../../core/index.js"));
|
|
39
39
|
const ApiKeyMutableFields_js_1 = require("./ApiKeyMutableFields.js");
|
|
40
|
-
|
|
40
|
+
const ExpiresAt_js_1 = require("./ExpiresAt.js");
|
|
41
|
+
exports.CreateBearerApiKeyRequest = core.serialization
|
|
42
|
+
.object({
|
|
43
|
+
expiresAt: core.serialization.property("expires_at", ExpiresAt_js_1.ExpiresAt.optional()),
|
|
44
|
+
})
|
|
45
|
+
.extend(ApiKeyMutableFields_js_1.ApiKeyMutableFields);
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.5.
|
|
1
|
+
export declare const SDK_VERSION = "0.5.32";
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/BaseClient.mjs
CHANGED
|
@@ -6,8 +6,8 @@ export function normalizeClientOptions(options) {
|
|
|
6
6
|
const headers = mergeHeaders({
|
|
7
7
|
"X-Fern-Language": "JavaScript",
|
|
8
8
|
"X-Fern-SDK-Name": "agentmail",
|
|
9
|
-
"X-Fern-SDK-Version": "0.5.
|
|
10
|
-
"User-Agent": "agentmail/0.5.
|
|
9
|
+
"X-Fern-SDK-Version": "0.5.32",
|
|
10
|
+
"User-Agent": "agentmail/0.5.32",
|
|
11
11
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
12
12
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
13
13
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
|
@@ -15,6 +15,8 @@ export declare class AgentClient {
|
|
|
15
15
|
*
|
|
16
16
|
* A 6-digit OTP is sent to the human's email for verification.
|
|
17
17
|
*
|
|
18
|
+
* `human_email` is optional. Without it, the inbox can receive email but cannot send to anyone until a human is attached with the attach human endpoint. There is also no way to recover the API key, so store it durably. Calling sign-up again without `human_email` creates a new organization, which needs a different `username`: the original username stays with the lost organization's inbox.
|
|
19
|
+
*
|
|
18
20
|
* This endpoint is idempotent. Calling it again with the same `human_email` will rotate the API key and resend the OTP if expired.
|
|
19
21
|
*
|
|
20
22
|
* The returned API key has limited permissions until the organization is verified via the verify endpoint.
|
|
@@ -31,18 +33,46 @@ export declare class AgentClient {
|
|
|
31
33
|
*
|
|
32
34
|
* @example
|
|
33
35
|
* await client.agent.signUp({
|
|
34
|
-
* humanEmail: "human_email",
|
|
35
36
|
* username: "username"
|
|
36
37
|
* })
|
|
37
38
|
*/
|
|
38
39
|
signUp(request: AgentMail.AgentSignupRequest, requestOptions?: AgentClient.RequestOptions): core.HttpResponsePromise<AgentMail.AgentSignupResponse>;
|
|
39
40
|
private __signUp;
|
|
41
|
+
/**
|
|
42
|
+
* Attach a human to an unverified agent organization. A 6-digit OTP is sent to the human's email, which you then submit to the verify endpoint.
|
|
43
|
+
*
|
|
44
|
+
* Use it after signing up without a `human_email`. Once the human is attached, the organization can send email to that human only, and verification lifts the remaining restrictions. For up to 5 minutes after attaching, sends to the human can still be rejected with a `429` daily send limit error while the API key's cached limits catch up. Wait and retry.
|
|
45
|
+
*
|
|
46
|
+
* Calling it again with the same `human_email` does not rotate the API key. It resends the OTP if it was never delivered, or issues a new one if it expired. While the current OTP is still valid, calling it again keeps that OTP and its attempt count. If all 10 attempts are used up, wait until the OTP expires, 24 hours after it was issued, then call it again for a new one.
|
|
47
|
+
*
|
|
48
|
+
* Calling it with a different `human_email` replaces the attached human and sends the new human an OTP. An organization can replace its human at most 2 times.
|
|
49
|
+
*
|
|
50
|
+
* Only available until the organization is verified.
|
|
51
|
+
*
|
|
52
|
+
* **CLI:**
|
|
53
|
+
* ```bash
|
|
54
|
+
* agentmail agent attach-human --human-email user@example.com
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* @param {AgentMail.AgentAttachHumanRequest} request
|
|
58
|
+
* @param {AgentClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
59
|
+
*
|
|
60
|
+
* @throws {@link AgentMail.ValidationError}
|
|
61
|
+
* @throws {@link AgentMail.ConflictError}
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* await client.agent.attachHuman({
|
|
65
|
+
* humanEmail: "human_email"
|
|
66
|
+
* })
|
|
67
|
+
*/
|
|
68
|
+
attachHuman(request: AgentMail.AgentAttachHumanRequest, requestOptions?: AgentClient.RequestOptions): core.HttpResponsePromise<AgentMail.AgentAttachHumanResponse>;
|
|
69
|
+
private __attachHuman;
|
|
40
70
|
/**
|
|
41
71
|
* Verify an agent organization using the 6-digit OTP sent to the human's email during sign-up.
|
|
42
72
|
*
|
|
43
73
|
* On success, the organization is upgraded from `agent_unverified` to `agent_verified`, the send allowlist is removed, and free plan entitlements are applied.
|
|
44
74
|
*
|
|
45
|
-
* The OTP expires after 24 hours and allows a maximum of 10 attempts. If you run into any difficulties receiving the OTP code, you can also create an account on [console.agentmail.to](https://console.agentmail.to) using the human email address you provided to verify your account.
|
|
75
|
+
* The OTP expires after 24 hours and allows a maximum of 10 attempts. If the OTP expired, call the attach human endpoint with the same `human_email` to get a new one without rotating the API key. Once all 10 attempts are used, even the correct OTP is rejected, and attach human keeps returning the same OTP until it expires, so wait for it to expire before asking for a new one. An organization that signed up without a `human_email` has no OTP until a human is attached. If you run into any difficulties receiving the OTP code, you can also create an account on [console.agentmail.to](https://console.agentmail.to) using the human email address you provided to verify your account.
|
|
46
76
|
*
|
|
47
77
|
* **CLI:**
|
|
48
78
|
* ```bash
|
|
@@ -25,6 +25,8 @@ export class AgentClient {
|
|
|
25
25
|
*
|
|
26
26
|
* A 6-digit OTP is sent to the human's email for verification.
|
|
27
27
|
*
|
|
28
|
+
* `human_email` is optional. Without it, the inbox can receive email but cannot send to anyone until a human is attached with the attach human endpoint. There is also no way to recover the API key, so store it durably. Calling sign-up again without `human_email` creates a new organization, which needs a different `username`: the original username stays with the lost organization's inbox.
|
|
29
|
+
*
|
|
28
30
|
* This endpoint is idempotent. Calling it again with the same `human_email` will rotate the API key and resend the OTP if expired.
|
|
29
31
|
*
|
|
30
32
|
* The returned API key has limited permissions until the organization is verified via the verify endpoint.
|
|
@@ -41,7 +43,6 @@ export class AgentClient {
|
|
|
41
43
|
*
|
|
42
44
|
* @example
|
|
43
45
|
* await client.agent.signUp({
|
|
44
|
-
* humanEmail: "human_email",
|
|
45
46
|
* username: "username"
|
|
46
47
|
* })
|
|
47
48
|
*/
|
|
@@ -103,12 +104,106 @@ export class AgentClient {
|
|
|
103
104
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v0/agent/sign-up");
|
|
104
105
|
});
|
|
105
106
|
}
|
|
107
|
+
/**
|
|
108
|
+
* Attach a human to an unverified agent organization. A 6-digit OTP is sent to the human's email, which you then submit to the verify endpoint.
|
|
109
|
+
*
|
|
110
|
+
* Use it after signing up without a `human_email`. Once the human is attached, the organization can send email to that human only, and verification lifts the remaining restrictions. For up to 5 minutes after attaching, sends to the human can still be rejected with a `429` daily send limit error while the API key's cached limits catch up. Wait and retry.
|
|
111
|
+
*
|
|
112
|
+
* Calling it again with the same `human_email` does not rotate the API key. It resends the OTP if it was never delivered, or issues a new one if it expired. While the current OTP is still valid, calling it again keeps that OTP and its attempt count. If all 10 attempts are used up, wait until the OTP expires, 24 hours after it was issued, then call it again for a new one.
|
|
113
|
+
*
|
|
114
|
+
* Calling it with a different `human_email` replaces the attached human and sends the new human an OTP. An organization can replace its human at most 2 times.
|
|
115
|
+
*
|
|
116
|
+
* Only available until the organization is verified.
|
|
117
|
+
*
|
|
118
|
+
* **CLI:**
|
|
119
|
+
* ```bash
|
|
120
|
+
* agentmail agent attach-human --human-email user@example.com
|
|
121
|
+
* ```
|
|
122
|
+
*
|
|
123
|
+
* @param {AgentMail.AgentAttachHumanRequest} request
|
|
124
|
+
* @param {AgentClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
125
|
+
*
|
|
126
|
+
* @throws {@link AgentMail.ValidationError}
|
|
127
|
+
* @throws {@link AgentMail.ConflictError}
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* await client.agent.attachHuman({
|
|
131
|
+
* humanEmail: "human_email"
|
|
132
|
+
* })
|
|
133
|
+
*/
|
|
134
|
+
attachHuman(request, requestOptions) {
|
|
135
|
+
return core.HttpResponsePromise.fromPromise(this.__attachHuman(request, requestOptions));
|
|
136
|
+
}
|
|
137
|
+
__attachHuman(request, requestOptions) {
|
|
138
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
139
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
140
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
141
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
142
|
+
const _response = yield core.fetcher({
|
|
143
|
+
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Prod)
|
|
144
|
+
.http, "/v0/agent/human"),
|
|
145
|
+
method: "POST",
|
|
146
|
+
headers: _headers,
|
|
147
|
+
contentType: "application/json",
|
|
148
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
149
|
+
requestType: "json",
|
|
150
|
+
body: serializers.AgentAttachHumanRequest.jsonOrThrow(request, {
|
|
151
|
+
unrecognizedObjectKeys: "strip",
|
|
152
|
+
omitUndefined: true,
|
|
153
|
+
}),
|
|
154
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
155
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
156
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
157
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
158
|
+
logging: this._options.logging,
|
|
159
|
+
});
|
|
160
|
+
if (_response.ok) {
|
|
161
|
+
return {
|
|
162
|
+
data: serializers.AgentAttachHumanResponse.parseOrThrow(_response.body, {
|
|
163
|
+
unrecognizedObjectKeys: "passthrough",
|
|
164
|
+
allowUnrecognizedUnionMembers: true,
|
|
165
|
+
allowUnrecognizedEnumValues: true,
|
|
166
|
+
skipValidation: true,
|
|
167
|
+
breadcrumbsPrefix: ["response"],
|
|
168
|
+
}),
|
|
169
|
+
rawResponse: _response.rawResponse,
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
if (_response.error.reason === "status-code") {
|
|
173
|
+
switch (_response.error.statusCode) {
|
|
174
|
+
case 400:
|
|
175
|
+
throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
|
|
176
|
+
unrecognizedObjectKeys: "passthrough",
|
|
177
|
+
allowUnrecognizedUnionMembers: true,
|
|
178
|
+
allowUnrecognizedEnumValues: true,
|
|
179
|
+
skipValidation: true,
|
|
180
|
+
breadcrumbsPrefix: ["response"],
|
|
181
|
+
}), _response.rawResponse);
|
|
182
|
+
case 409:
|
|
183
|
+
throw new AgentMail.ConflictError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
184
|
+
unrecognizedObjectKeys: "passthrough",
|
|
185
|
+
allowUnrecognizedUnionMembers: true,
|
|
186
|
+
allowUnrecognizedEnumValues: true,
|
|
187
|
+
skipValidation: true,
|
|
188
|
+
breadcrumbsPrefix: ["response"],
|
|
189
|
+
}), _response.rawResponse);
|
|
190
|
+
default:
|
|
191
|
+
throw new errors.AgentMailError({
|
|
192
|
+
statusCode: _response.error.statusCode,
|
|
193
|
+
body: _response.error.body,
|
|
194
|
+
rawResponse: _response.rawResponse,
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v0/agent/human");
|
|
199
|
+
});
|
|
200
|
+
}
|
|
106
201
|
/**
|
|
107
202
|
* Verify an agent organization using the 6-digit OTP sent to the human's email during sign-up.
|
|
108
203
|
*
|
|
109
204
|
* On success, the organization is upgraded from `agent_unverified` to `agent_verified`, the send allowlist is removed, and free plan entitlements are applied.
|
|
110
205
|
*
|
|
111
|
-
* The OTP expires after 24 hours and allows a maximum of 10 attempts. If you run into any difficulties receiving the OTP code, you can also create an account on [console.agentmail.to](https://console.agentmail.to) using the human email address you provided to verify your account.
|
|
206
|
+
* The OTP expires after 24 hours and allows a maximum of 10 attempts. If the OTP expired, call the attach human endpoint with the same `human_email` to get a new one without rotating the API key. Once all 10 attempts are used, even the correct OTP is rejected, and attach human keeps returning the same OTP until it expires, so wait for it to expire before asking for a new one. An organization that signed up without a `human_email` has no OTP until a human is attached. If you run into any difficulties receiving the OTP code, you can also create an account on [console.agentmail.to](https://console.agentmail.to) using the human email address you provided to verify your account.
|
|
112
207
|
*
|
|
113
208
|
* **CLI:**
|
|
114
209
|
* ```bash
|
|
@@ -2,8 +2,11 @@
|
|
|
2
2
|
* Request body to sign up an agent.
|
|
3
3
|
*/
|
|
4
4
|
export interface AgentSignupRequest {
|
|
5
|
-
/**
|
|
6
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Email address of the human who owns the agent. A 6-digit OTP will be sent to this address.
|
|
7
|
+
* Omit it to get a receive-only inbox: it can receive email but cannot send until a human is attached with the attach human endpoint.
|
|
8
|
+
*/
|
|
9
|
+
humanEmail?: string;
|
|
7
10
|
/** Username for the auto-created inbox (e.g. "my-agent" creates my-agent@agentmail.to). */
|
|
8
11
|
username: string;
|
|
9
12
|
/**
|
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
import type * as AgentMail from "../../../index.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* `expires_at` must be in the future and is immutable once the key exists.
|
|
4
|
+
* Omitted, the new key inherits the authenticating key's expiry, and never
|
|
5
|
+
* expires only when that key never does. A key cannot create one that
|
|
6
|
+
* outlives it: an `expires_at` later than the authenticating key's own
|
|
7
|
+
* returns `403`.
|
|
8
|
+
*/
|
|
2
9
|
export interface CreateBearerApiKeyRequest extends AgentMail.ApiKeyMutableFields {
|
|
10
|
+
expiresAt?: AgentMail.ExpiresAt;
|
|
3
11
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type * as AgentMail from "../../../../api/index.mjs";
|
|
2
|
+
import * as core from "../../../../core/index.mjs";
|
|
3
|
+
import type * as serializers from "../../../index.mjs";
|
|
4
|
+
export declare const AgentAttachHumanRequest: core.serialization.ObjectSchema<serializers.AgentAttachHumanRequest.Raw, AgentMail.AgentAttachHumanRequest>;
|
|
5
|
+
export declare namespace AgentAttachHumanRequest {
|
|
6
|
+
interface Raw {
|
|
7
|
+
human_email: string;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
import * as core from "../../../../core/index.mjs";
|
|
3
|
+
export const AgentAttachHumanRequest = core.serialization.object({
|
|
4
|
+
humanEmail: core.serialization.property("human_email", core.serialization.string()),
|
|
5
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type * as AgentMail from "../../../../api/index.mjs";
|
|
2
|
+
import * as core from "../../../../core/index.mjs";
|
|
3
|
+
import type * as serializers from "../../../index.mjs";
|
|
4
|
+
export declare const AgentAttachHumanResponse: core.serialization.ObjectSchema<serializers.AgentAttachHumanResponse.Raw, AgentMail.AgentAttachHumanResponse>;
|
|
5
|
+
export declare namespace AgentAttachHumanResponse {
|
|
6
|
+
interface Raw {
|
|
7
|
+
human_email: string;
|
|
8
|
+
instructions: string;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
import * as core from "../../../../core/index.mjs";
|
|
3
|
+
export const AgentAttachHumanResponse = core.serialization.object({
|
|
4
|
+
humanEmail: core.serialization.property("human_email", core.serialization.string()),
|
|
5
|
+
instructions: core.serialization.string(),
|
|
6
|
+
});
|
|
@@ -4,7 +4,7 @@ import type * as serializers from "../../../index.mjs";
|
|
|
4
4
|
export declare const AgentSignupRequest: core.serialization.ObjectSchema<serializers.AgentSignupRequest.Raw, AgentMail.AgentSignupRequest>;
|
|
5
5
|
export declare namespace AgentSignupRequest {
|
|
6
6
|
interface Raw {
|
|
7
|
-
human_email
|
|
7
|
+
human_email?: string | null;
|
|
8
8
|
username: string;
|
|
9
9
|
source?: string | null;
|
|
10
10
|
referrer?: string | null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
import * as core from "../../../../core/index.mjs";
|
|
3
3
|
export const AgentSignupRequest = core.serialization.object({
|
|
4
|
-
humanEmail: core.serialization.property("human_email", core.serialization.string()),
|
|
4
|
+
humanEmail: core.serialization.property("human_email", core.serialization.string().optional()),
|
|
5
5
|
username: core.serialization.string(),
|
|
6
6
|
source: core.serialization.string().optional(),
|
|
7
7
|
referrer: core.serialization.string().optional(),
|
|
@@ -39,5 +39,6 @@ export const ApiKeyPermissions = core.serialization.object({
|
|
|
39
39
|
accountUpdate: core.serialization.property("account_update", core.serialization.boolean().optional()),
|
|
40
40
|
podRead: core.serialization.property("pod_read", core.serialization.boolean().optional()),
|
|
41
41
|
podCreate: core.serialization.property("pod_create", core.serialization.boolean().optional()),
|
|
42
|
+
podUpdate: core.serialization.property("pod_update", core.serialization.boolean().optional()),
|
|
42
43
|
podDelete: core.serialization.property("pod_delete", core.serialization.boolean().optional()),
|
|
43
44
|
});
|
|
@@ -4,6 +4,7 @@ import type * as serializers from "../../../index.mjs";
|
|
|
4
4
|
import { ApiKeyId } from "./ApiKeyId.mjs";
|
|
5
5
|
import { ApiKeyPermissions } from "./ApiKeyPermissions.mjs";
|
|
6
6
|
import { CreatedAt } from "./CreatedAt.mjs";
|
|
7
|
+
import { ExpiresAt } from "./ExpiresAt.mjs";
|
|
7
8
|
import { InboxScopeId } from "./InboxScopeId.mjs";
|
|
8
9
|
import { Name } from "./Name.mjs";
|
|
9
10
|
import { PodScopeId } from "./PodScopeId.mjs";
|
|
@@ -19,5 +20,6 @@ export declare namespace CreateApiKeyResponse {
|
|
|
19
20
|
inbox_id?: InboxScopeId.Raw | null;
|
|
20
21
|
permissions?: ApiKeyPermissions.Raw | null;
|
|
21
22
|
created_at: CreatedAt.Raw;
|
|
23
|
+
expires_at?: ExpiresAt.Raw | null;
|
|
22
24
|
}
|
|
23
25
|
}
|
|
@@ -3,6 +3,7 @@ import * as core from "../../../../core/index.mjs";
|
|
|
3
3
|
import { ApiKeyId } from "./ApiKeyId.mjs";
|
|
4
4
|
import { ApiKeyPermissions } from "./ApiKeyPermissions.mjs";
|
|
5
5
|
import { CreatedAt } from "./CreatedAt.mjs";
|
|
6
|
+
import { ExpiresAt } from "./ExpiresAt.mjs";
|
|
6
7
|
import { InboxScopeId } from "./InboxScopeId.mjs";
|
|
7
8
|
import { Name } from "./Name.mjs";
|
|
8
9
|
import { PodScopeId } from "./PodScopeId.mjs";
|
|
@@ -16,4 +17,5 @@ export const CreateApiKeyResponse = core.serialization.object({
|
|
|
16
17
|
inboxId: core.serialization.property("inbox_id", InboxScopeId.optional()),
|
|
17
18
|
permissions: ApiKeyPermissions.optional(),
|
|
18
19
|
createdAt: core.serialization.property("created_at", CreatedAt),
|
|
20
|
+
expiresAt: core.serialization.property("expires_at", ExpiresAt.optional()),
|
|
19
21
|
});
|
|
@@ -2,8 +2,10 @@ import type * as AgentMail from "../../../../api/index.mjs";
|
|
|
2
2
|
import * as core from "../../../../core/index.mjs";
|
|
3
3
|
import type * as serializers from "../../../index.mjs";
|
|
4
4
|
import { ApiKeyMutableFields } from "./ApiKeyMutableFields.mjs";
|
|
5
|
+
import { ExpiresAt } from "./ExpiresAt.mjs";
|
|
5
6
|
export declare const CreateBearerApiKeyRequest: core.serialization.ObjectSchema<serializers.CreateBearerApiKeyRequest.Raw, AgentMail.CreateBearerApiKeyRequest>;
|
|
6
7
|
export declare namespace CreateBearerApiKeyRequest {
|
|
7
8
|
interface Raw extends ApiKeyMutableFields.Raw {
|
|
9
|
+
expires_at?: ExpiresAt.Raw | null;
|
|
8
10
|
}
|
|
9
11
|
}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
// This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
import * as core from "../../../../core/index.mjs";
|
|
3
3
|
import { ApiKeyMutableFields } from "./ApiKeyMutableFields.mjs";
|
|
4
|
-
|
|
4
|
+
import { ExpiresAt } from "./ExpiresAt.mjs";
|
|
5
|
+
export const CreateBearerApiKeyRequest = core.serialization
|
|
6
|
+
.object({
|
|
7
|
+
expiresAt: core.serialization.property("expires_at", ExpiresAt.optional()),
|
|
8
|
+
})
|
|
9
|
+
.extend(ApiKeyMutableFields);
|
package/dist/esm/version.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.5.
|
|
1
|
+
export declare const SDK_VERSION = "0.5.32";
|
package/dist/esm/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "0.5.
|
|
1
|
+
export const SDK_VERSION = "0.5.32";
|
package/dist/llms.txt
CHANGED
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
- [OpenClaw](https://docs.agentmail.to/integrations/openclaw.md): Install AgentMail as an official OpenClaw plugin with one command. Your agent gets its own inbox plus an allowlisted email channel it can be reached at.
|
|
32
32
|
- [Grok Bot](https://docs.agentmail.to/integrations/grokbot.md): AgentMail's Grok Bot, Grok Build, and Grok API integration
|
|
33
33
|
- [Replit](https://docs.agentmail.to/integrations/replit.md): AgentMail's Replit integration
|
|
34
|
-
- [Vercel](https://docs.agentmail.to/integrations/vercel.md): Provision AgentMail from the Vercel Marketplace and authenticate your Vercel functions with
|
|
34
|
+
- [Vercel](https://docs.agentmail.to/integrations/vercel.md): Provision AgentMail from the Vercel Marketplace and authenticate your Vercel functions with the provisioned API key
|
|
35
35
|
- [x402](https://docs.agentmail.to/integrations/x402.md): AgentMail's x402 integration for HTTP-native payments
|
|
36
36
|
- [MPP](https://docs.agentmail.to/integrations/mpp.md): AgentMail's MPP integration for machine-to-machine payments via Stripe
|
|
37
37
|
- [Integrate LiveKit Agents](https://docs.agentmail.to/integrate-livekit-agents.md): A step-by-step guide to integrate with the LiveKit Agents SDK.
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
- [AgentID Sign-In](https://docs.agentmail.to/agentid-sign-in.md): Connect an inbox to a provider, authorize a pending AgentID sign-in, and manage sign-in keys with the AgentMail API and CLI.
|
|
40
40
|
- [AgentID Public-Key Authentication](https://docs.agentmail.to/agentid-public-key-authentication.md): Register a public P-256 key, choose its scope and permissions, and manage it through the current AgentMail API Keys endpoints.
|
|
41
41
|
- [Guide: Sending & Receiving Email](https://docs.agentmail.to/sending-receiving-email.md): A step-by-step guide to the practical workflow of sending initial emails and handling replies to have a full conversation.
|
|
42
|
+
- [Reply & Attachment Extraction](https://docs.agentmail.to/reply-extraction.md): AgentMail strips quoted history and boilerplate from every message into extracted_text and extracted_html, and extracts plain text from PDF, Word, Excel, and text attachments. No Talon or reply-parsing library required.
|
|
42
43
|
- [IMAP & SMTP](https://docs.agentmail.to/imap-smtp.md): Configure IMAP and SMTP to access your AgentMail inboxes using email clients or programmatic access.
|
|
43
44
|
- [Guide: Multi-Tenancy](https://docs.agentmail.to/multi-tenancy.md): How to use pods, scoped API keys, and webhook filtering to build multi-tenant email on AgentMail.
|
|
44
45
|
- [Using Custom Domains](https://docs.agentmail.to/custom-domains.md): A step-by-step guide to configuring your custom domain with AgentMail for enhanced branding and trust.
|
|
@@ -59,10 +60,10 @@
|
|
|
59
60
|
- [Live AgentMail Examples](https://docs.agentmail.to/documentation/examples/live-agent-mail-examples.md)
|
|
60
61
|
- [Frequently Asked Questions (FAQ)](https://docs.agentmail.to/faq.md): Find answers to common questions about AgentMail, from core concepts to best practices and security.
|
|
61
62
|
- [Error Reference](https://docs.agentmail.to/errors.md): Every AgentMail API error code, what it means, and how to fix it.
|
|
62
|
-
- [Email Reply Extraction with Talon](https://docs.agentmail.to/talon-reply-extraction.md): Learn how to use Talon to extract new content from email replies, removing quoted text with 93.8% accuracy.
|
|
63
63
|
- [Join the AgentMail Community](https://docs.agentmail.to/community.md): Connect with the AgentMail team and developers, share what you're building, and get support.
|
|
64
64
|
- [Support](https://docs.agentmail.to/support.md): Get help with AgentMail through our support channels.
|
|
65
65
|
- [Understanding Email Authentication (SPF, DKIM, DMARC)](https://docs.agentmail.to/email-protocols.md): Learn why we ask for DNS records and what SPF, DKIM, and DMARC are.
|
|
66
|
+
- [24-hour Message Expiry](https://docs.agentmail.to/message-expiry.md): Optional 24-hour message access expiry for your organization. Contact us about early access.
|
|
66
67
|
- [SOC 2 Compliance](https://docs.agentmail.to/documentation/resources/security-privacy/soc-2-compliance.md): AgentMail's completed 2025 SOC 2 Type II audit and 2026 annual audit underway with A-LIGN.
|
|
67
68
|
- [Spam & Virus Detection](https://docs.agentmail.to/spam-virus-detection.md): How AgentMail automatically scans incoming emails for spam and viruses.
|
|
68
69
|
- [API Welcome](https://docs.agentmail.to/api-reference.md): Quick overview of the AgentMail SDK
|
|
@@ -98,6 +99,7 @@
|
|
|
98
99
|
## API Docs
|
|
99
100
|
|
|
100
101
|
- API Reference > Agent [Sign Up](https://docs.agentmail.to/api-reference/agent/sign-up.md)
|
|
102
|
+
- API Reference > Agent [Attach Human](https://docs.agentmail.to/api-reference/agent/attach-human.md)
|
|
101
103
|
- API Reference > Agent [Verify](https://docs.agentmail.to/api-reference/agent/verify.md)
|
|
102
104
|
- API Reference > Inboxes [List Inboxes](https://docs.agentmail.to/api-reference/inboxes/list.md)
|
|
103
105
|
- API Reference > Inboxes [Search Inboxes](https://docs.agentmail.to/api-reference/inboxes/search.md)
|
|
@@ -145,6 +147,7 @@
|
|
|
145
147
|
- API Reference > Inboxes > Lists [Delete List Entry](https://docs.agentmail.to/api-reference/inboxes/lists/delete.md)
|
|
146
148
|
- API Reference > Inboxes > Metrics [Query Events](https://docs.agentmail.to/api-reference/inboxes/metrics/query-events.md)
|
|
147
149
|
- API Reference > Inboxes > Metrics [Query Usage](https://docs.agentmail.to/api-reference/inboxes/metrics/query-usage.md)
|
|
150
|
+
- API Reference > Inboxes > Metrics [Query Rates](https://docs.agentmail.to/api-reference/inboxes/metrics/query-rates.md)
|
|
148
151
|
- API Reference > Inboxes > Events [List Inbox Events](https://docs.agentmail.to/api-reference/inboxes/events/list.md)
|
|
149
152
|
- API Reference > Inboxes > API Keys [List API Keys](https://docs.agentmail.to/api-reference/inboxes/api-keys/list.md)
|
|
150
153
|
- API Reference > Inboxes > API Keys [Create API Key](https://docs.agentmail.to/api-reference/inboxes/api-keys/create.md)
|
|
@@ -191,6 +194,7 @@
|
|
|
191
194
|
- API Reference > Lists [Delete List Entry](https://docs.agentmail.to/api-reference/lists/delete.md)
|
|
192
195
|
- API Reference > Metrics [Query Events](https://docs.agentmail.to/api-reference/metrics/query-events.md)
|
|
193
196
|
- API Reference > Metrics [Query Usage](https://docs.agentmail.to/api-reference/metrics/query-usage.md)
|
|
197
|
+
- API Reference > Metrics [Query Rates](https://docs.agentmail.to/api-reference/metrics/query-rates.md)
|
|
194
198
|
- API Reference > API Keys [List API Keys](https://docs.agentmail.to/api-reference/api-keys/list.md)
|
|
195
199
|
- API Reference > API Keys [Get API Key](https://docs.agentmail.to/api-reference/api-keys/get.md)
|
|
196
200
|
- API Reference > API Keys [Create API Key](https://docs.agentmail.to/api-reference/api-keys/create.md)
|
|
@@ -243,6 +247,7 @@
|
|
|
243
247
|
- API Reference > Pods > Lists [Delete List Entry](https://docs.agentmail.to/api-reference/pods/lists/delete.md)
|
|
244
248
|
- API Reference > Pods > Metrics [Query Events](https://docs.agentmail.to/api-reference/pods/metrics/query-events.md)
|
|
245
249
|
- API Reference > Pods > Metrics [Query Usage](https://docs.agentmail.to/api-reference/pods/metrics/query-usage.md)
|
|
250
|
+
- API Reference > Pods > Metrics [Query Rates](https://docs.agentmail.to/api-reference/pods/metrics/query-rates.md)
|
|
246
251
|
- API Reference > Pods > API Keys [List API Keys](https://docs.agentmail.to/api-reference/pods/api-keys/list.md)
|
|
247
252
|
- API Reference > Pods > API Keys [Create API Key](https://docs.agentmail.to/api-reference/pods/api-keys/create.md)
|
|
248
253
|
- API Reference > Pods > API Keys [Update API Key](https://docs.agentmail.to/api-reference/pods/api-keys/update.md)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentmail",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.32",
|
|
4
4
|
"private": false,
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -412,7 +412,7 @@
|
|
|
412
412
|
"lint:fix": "biome lint --fix --unsafe --skip-parse-errors --no-errors-on-unmatched --max-diagnostics=none",
|
|
413
413
|
"check": "biome check --skip-parse-errors --no-errors-on-unmatched --max-diagnostics=none",
|
|
414
414
|
"check:fix": "biome check --fix --unsafe --skip-parse-errors --no-errors-on-unmatched --max-diagnostics=none",
|
|
415
|
-
"build": "npm run build:cjs && npm run build:esm && node -e \"const https=require('https'),fs=require('fs');const download=(f)=>new Promise((res,rej)=>https.get('https://docs.agentmail.to/'+f,r=>r.pipe(fs.createWriteStream('dist/'+f)).on('finish',res).on('error',rej)));Promise.all(['llms.txt'
|
|
415
|
+
"build": "npm run build:cjs && npm run build:esm && node -e \"const https=require('https'),fs=require('fs');const download=(f)=>new Promise((res,rej)=>https.get('https://docs.agentmail.to/'+f,r=>r.statusCode===200?r.pipe(fs.createWriteStream('dist/'+f)).on('finish',res).on('error',rej):rej(new Error(f+': HTTP '+r.statusCode))).on('error',rej));Promise.all(['llms.txt'].map(download)).catch(e=>{console.error(e);process.exit(1)});\"",
|
|
416
416
|
"build:cjs": "tsc --project ./tsconfig.cjs.json",
|
|
417
417
|
"build:esm": "tsc --project ./tsconfig.esm.json && node scripts/rename-to-esm-files.js dist/esm",
|
|
418
418
|
"test": "vitest",
|
package/reference.md
CHANGED
|
@@ -1464,6 +1464,8 @@ Create a new agent organization with an inbox and API key. This endpoint is for
|
|
|
1464
1464
|
|
|
1465
1465
|
A 6-digit OTP is sent to the human's email for verification.
|
|
1466
1466
|
|
|
1467
|
+
`human_email` is optional. Without it, the inbox can receive email but cannot send to anyone until a human is attached with the attach human endpoint. There is also no way to recover the API key, so store it durably. Calling sign-up again without `human_email` creates a new organization, which needs a different `username`: the original username stays with the lost organization's inbox.
|
|
1468
|
+
|
|
1467
1469
|
This endpoint is idempotent. Calling it again with the same `human_email` will rotate the API key and resend the OTP if expired.
|
|
1468
1470
|
|
|
1469
1471
|
The returned API key has limited permissions until the organization is verified via the verify endpoint.
|
|
@@ -1487,7 +1489,6 @@ agentmail agent sign-up --human-email user@example.com --username my-agent
|
|
|
1487
1489
|
|
|
1488
1490
|
```typescript
|
|
1489
1491
|
await client.agent.signUp({
|
|
1490
|
-
humanEmail: "human_email",
|
|
1491
1492
|
username: "username"
|
|
1492
1493
|
});
|
|
1493
1494
|
|
|
@@ -1521,6 +1522,84 @@ await client.agent.signUp({
|
|
|
1521
1522
|
</dl>
|
|
1522
1523
|
|
|
1523
1524
|
|
|
1525
|
+
</dd>
|
|
1526
|
+
</dl>
|
|
1527
|
+
</details>
|
|
1528
|
+
|
|
1529
|
+
<details><summary><code>client.agent.<a href="/src/api/resources/agent/client/Client.ts">attachHuman</a>({ ...params }) -> AgentMail.AgentAttachHumanResponse</code></summary>
|
|
1530
|
+
<dl>
|
|
1531
|
+
<dd>
|
|
1532
|
+
|
|
1533
|
+
#### 📝 Description
|
|
1534
|
+
|
|
1535
|
+
<dl>
|
|
1536
|
+
<dd>
|
|
1537
|
+
|
|
1538
|
+
<dl>
|
|
1539
|
+
<dd>
|
|
1540
|
+
|
|
1541
|
+
Attach a human to an unverified agent organization. A 6-digit OTP is sent to the human's email, which you then submit to the verify endpoint.
|
|
1542
|
+
|
|
1543
|
+
Use it after signing up without a `human_email`. Once the human is attached, the organization can send email to that human only, and verification lifts the remaining restrictions. For up to 5 minutes after attaching, sends to the human can still be rejected with a `429` daily send limit error while the API key's cached limits catch up. Wait and retry.
|
|
1544
|
+
|
|
1545
|
+
Calling it again with the same `human_email` does not rotate the API key. It resends the OTP if it was never delivered, or issues a new one if it expired. While the current OTP is still valid, calling it again keeps that OTP and its attempt count. If all 10 attempts are used up, wait until the OTP expires, 24 hours after it was issued, then call it again for a new one.
|
|
1546
|
+
|
|
1547
|
+
Calling it with a different `human_email` replaces the attached human and sends the new human an OTP. An organization can replace its human at most 2 times.
|
|
1548
|
+
|
|
1549
|
+
Only available until the organization is verified.
|
|
1550
|
+
|
|
1551
|
+
**CLI:**
|
|
1552
|
+
```bash
|
|
1553
|
+
agentmail agent attach-human --human-email user@example.com
|
|
1554
|
+
```
|
|
1555
|
+
</dd>
|
|
1556
|
+
</dl>
|
|
1557
|
+
</dd>
|
|
1558
|
+
</dl>
|
|
1559
|
+
|
|
1560
|
+
#### 🔌 Usage
|
|
1561
|
+
|
|
1562
|
+
<dl>
|
|
1563
|
+
<dd>
|
|
1564
|
+
|
|
1565
|
+
<dl>
|
|
1566
|
+
<dd>
|
|
1567
|
+
|
|
1568
|
+
```typescript
|
|
1569
|
+
await client.agent.attachHuman({
|
|
1570
|
+
humanEmail: "human_email"
|
|
1571
|
+
});
|
|
1572
|
+
|
|
1573
|
+
```
|
|
1574
|
+
</dd>
|
|
1575
|
+
</dl>
|
|
1576
|
+
</dd>
|
|
1577
|
+
</dl>
|
|
1578
|
+
|
|
1579
|
+
#### ⚙️ Parameters
|
|
1580
|
+
|
|
1581
|
+
<dl>
|
|
1582
|
+
<dd>
|
|
1583
|
+
|
|
1584
|
+
<dl>
|
|
1585
|
+
<dd>
|
|
1586
|
+
|
|
1587
|
+
**request:** `AgentMail.AgentAttachHumanRequest`
|
|
1588
|
+
|
|
1589
|
+
</dd>
|
|
1590
|
+
</dl>
|
|
1591
|
+
|
|
1592
|
+
<dl>
|
|
1593
|
+
<dd>
|
|
1594
|
+
|
|
1595
|
+
**requestOptions:** `AgentClient.RequestOptions`
|
|
1596
|
+
|
|
1597
|
+
</dd>
|
|
1598
|
+
</dl>
|
|
1599
|
+
</dd>
|
|
1600
|
+
</dl>
|
|
1601
|
+
|
|
1602
|
+
|
|
1524
1603
|
</dd>
|
|
1525
1604
|
</dl>
|
|
1526
1605
|
</details>
|
|
@@ -1541,7 +1620,7 @@ Verify an agent organization using the 6-digit OTP sent to the human's email dur
|
|
|
1541
1620
|
|
|
1542
1621
|
On success, the organization is upgraded from `agent_unverified` to `agent_verified`, the send allowlist is removed, and free plan entitlements are applied.
|
|
1543
1622
|
|
|
1544
|
-
The OTP expires after 24 hours and allows a maximum of 10 attempts. If you run into any difficulties receiving the OTP code, you can also create an account on [console.agentmail.to](https://console.agentmail.to) using the human email address you provided to verify your account.
|
|
1623
|
+
The OTP expires after 24 hours and allows a maximum of 10 attempts. If the OTP expired, call the attach human endpoint with the same `human_email` to get a new one without rotating the API key. Once all 10 attempts are used, even the correct OTP is rejected, and attach human keeps returning the same OTP until it expires, so wait for it to expire before asking for a new one. An organization that signed up without a `human_email` has no OTP until a human is attached. If you run into any difficulties receiving the OTP code, you can also create an account on [console.agentmail.to](https://console.agentmail.to) using the human email address you provided to verify your account.
|
|
1545
1624
|
|
|
1546
1625
|
**CLI:**
|
|
1547
1626
|
```bash
|
package/dist/llms-full.txt
DELETED
|
File without changes
|