@holon-run/agentinbox 1.8.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.
|
@@ -237,6 +237,8 @@ const SOURCE_SCHEMAS = {
|
|
|
237
237
|
{ name: "mailbox", type: "string", required: false, description: "Mailbox to watch; defaults to INBOX." },
|
|
238
238
|
{ name: "pollIntervalSecs", type: "number", required: false, description: "Provider poll interval in seconds (min 15, default 60)." },
|
|
239
239
|
{ name: "initialFetchLimit", type: "number", required: false, description: "First-look backfill depth: 0 = new mail only, max 100, default 25." },
|
|
240
|
+
{ name: "method", type: "string", required: false, description: "Provider poll HTTP method: get (default) or post; ignored for imap." },
|
|
241
|
+
{ name: "requestBody", type: "object", required: false, description: "JSON request body for provider polling; requires method=post and is ignored for imap." },
|
|
240
242
|
{ name: "smtpEndpoint", type: "string", required: false, description: "Default smtp:// endpoint for outbound reply/send delivery." },
|
|
241
243
|
{ name: "fromAddress", type: "string", required: false, description: "Default outbound From address for delivery." },
|
|
242
244
|
{ name: "addressAllowlist", type: "string[]", required: false, description: "Optional from/to address allowlist applied before inbox routing." },
|
|
@@ -104,6 +104,25 @@ function parseEmailMailboxSourceConfig(source) {
|
|
|
104
104
|
}
|
|
105
105
|
const addressAllowlist = asStringArray(config.addressAllowlist ?? config.addressAllowList);
|
|
106
106
|
const attachmentPolicy = parseEmailAttachmentPolicy(config.attachmentPolicy ?? config.attachment_policy);
|
|
107
|
+
const methodRaw = config.method;
|
|
108
|
+
let method = "get";
|
|
109
|
+
if (methodRaw !== undefined && methodRaw !== null) {
|
|
110
|
+
if (typeof methodRaw !== "string" || !["get", "post"].includes(methodRaw.trim().toLowerCase())) {
|
|
111
|
+
throw new Error(`email_mailbox config.method must be get or post; got ${String(methodRaw)}`);
|
|
112
|
+
}
|
|
113
|
+
method = methodRaw.trim().toLowerCase();
|
|
114
|
+
}
|
|
115
|
+
const requestBodyRaw = config.requestBody;
|
|
116
|
+
let requestBody;
|
|
117
|
+
if (requestBodyRaw !== undefined && requestBodyRaw !== null) {
|
|
118
|
+
if (typeof requestBodyRaw !== "object" || Array.isArray(requestBodyRaw)) {
|
|
119
|
+
throw new Error("email_mailbox config.requestBody must be a JSON object when provided");
|
|
120
|
+
}
|
|
121
|
+
if (method !== "post") {
|
|
122
|
+
throw new Error("email_mailbox config.requestBody requires config.method=post");
|
|
123
|
+
}
|
|
124
|
+
requestBody = requestBodyRaw;
|
|
125
|
+
}
|
|
107
126
|
return {
|
|
108
127
|
provider: provider,
|
|
109
128
|
endpoint,
|
|
@@ -112,6 +131,8 @@ function parseEmailMailboxSourceConfig(source) {
|
|
|
112
131
|
mailbox,
|
|
113
132
|
pollIntervalSecs,
|
|
114
133
|
initialFetchLimit,
|
|
134
|
+
method,
|
|
135
|
+
...(requestBody ? { requestBody } : {}),
|
|
115
136
|
...(smtpEndpoint ? { smtpEndpoint } : {}),
|
|
116
137
|
...(fromAddress ? { fromAddress } : {}),
|
|
117
138
|
...(addressAllowlist && addressAllowlist.length > 0 ? { addressAllowlist } : {}),
|
|
@@ -171,7 +192,9 @@ function buildEmailMailboxSourceSpec(config) {
|
|
|
171
192
|
transport_hint: "email_provider_poll",
|
|
172
193
|
args: {
|
|
173
194
|
provider: config.provider,
|
|
195
|
+
method: config.method,
|
|
174
196
|
...args,
|
|
197
|
+
...(config.requestBody ? { body: config.requestBody } : {}),
|
|
175
198
|
},
|
|
176
199
|
poll_config: pollConfig,
|
|
177
200
|
options: {
|