@holon-run/agentinbox 1.7.0 → 1.7.2
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.
|
@@ -235,6 +235,7 @@ const SOURCE_SCHEMAS = {
|
|
|
235
235
|
{ name: "account", type: "string", required: false, description: "Account alias; defaults to the auth profile username." },
|
|
236
236
|
{ name: "mailbox", type: "string", required: false, description: "Mailbox to watch; defaults to INBOX." },
|
|
237
237
|
{ name: "pollIntervalSecs", type: "number", required: false, description: "Provider poll interval in seconds (min 15, default 60)." },
|
|
238
|
+
{ name: "initialFetchLimit", type: "number", required: false, description: "First-look backfill depth: 0 = new mail only, max 100, default 25." },
|
|
238
239
|
{ name: "smtpEndpoint", type: "string", required: false, description: "Default smtp:// endpoint for outbound reply/send delivery." },
|
|
239
240
|
{ name: "fromAddress", type: "string", required: false, description: "Default outbound From address for delivery." },
|
|
240
241
|
{ name: "addressAllowlist", type: "string[]", required: false, description: "Optional from/to address allowlist applied before inbox routing." },
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EmailDeliveryAdapter = exports.RpcEmailUxcClient = exports.GRAPH_MESSAGES_ENDPOINT = exports.GMAIL_MESSAGES_ENDPOINT = exports.EMAIL_EVENT_VERSION = exports.EMAIL_EVENT_TYPE = exports.EMAIL_MAILBOX_DEFAULT_POLL_INTERVAL_SECS = exports.EMAIL_DEFAULT_MAILBOX = void 0;
|
|
3
|
+
exports.EmailDeliveryAdapter = exports.RpcEmailUxcClient = exports.GRAPH_MESSAGES_ENDPOINT = exports.GMAIL_MESSAGES_ENDPOINT = exports.EMAIL_EVENT_VERSION = exports.EMAIL_EVENT_TYPE = exports.EMAIL_MAILBOX_MAX_INITIAL_FETCH_LIMIT = exports.EMAIL_MAILBOX_DEFAULT_INITIAL_FETCH_LIMIT = exports.EMAIL_MAILBOX_DEFAULT_POLL_INTERVAL_SECS = exports.EMAIL_DEFAULT_MAILBOX = void 0;
|
|
4
4
|
exports.parseEmailMailboxSourceConfig = parseEmailMailboxSourceConfig;
|
|
5
5
|
exports.buildEmailMailboxSourceSpec = buildEmailMailboxSourceSpec;
|
|
6
6
|
exports.normalizeEmailMailboxEvent = normalizeEmailMailboxEvent;
|
|
@@ -9,6 +9,8 @@ exports.invokeEmailDeliveryOperation = invokeEmailDeliveryOperation;
|
|
|
9
9
|
const uxc_daemon_client_1 = require("@holon-run/uxc-daemon-client");
|
|
10
10
|
exports.EMAIL_DEFAULT_MAILBOX = "INBOX";
|
|
11
11
|
exports.EMAIL_MAILBOX_DEFAULT_POLL_INTERVAL_SECS = 60;
|
|
12
|
+
exports.EMAIL_MAILBOX_DEFAULT_INITIAL_FETCH_LIMIT = 25;
|
|
13
|
+
exports.EMAIL_MAILBOX_MAX_INITIAL_FETCH_LIMIT = 100;
|
|
12
14
|
exports.EMAIL_EVENT_TYPE = "email_event";
|
|
13
15
|
exports.EMAIL_EVENT_VERSION = "v1";
|
|
14
16
|
exports.GMAIL_MESSAGES_ENDPOINT = "https://gmail.googleapis.com/gmail/v1/users/me/messages";
|
|
@@ -67,6 +69,18 @@ function parseEmailMailboxSourceConfig(source) {
|
|
|
67
69
|
}
|
|
68
70
|
pollIntervalSecs = parsed;
|
|
69
71
|
}
|
|
72
|
+
const initialFetchLimitRaw = config.initialFetchLimit ?? config.initial_fetch_limit;
|
|
73
|
+
let initialFetchLimit = exports.EMAIL_MAILBOX_DEFAULT_INITIAL_FETCH_LIMIT;
|
|
74
|
+
if (initialFetchLimitRaw !== undefined && initialFetchLimitRaw !== null) {
|
|
75
|
+
const parsed = numberFromUnknown(initialFetchLimitRaw);
|
|
76
|
+
if (parsed === undefined ||
|
|
77
|
+
!Number.isInteger(parsed) ||
|
|
78
|
+
parsed < 0 ||
|
|
79
|
+
parsed > exports.EMAIL_MAILBOX_MAX_INITIAL_FETCH_LIMIT) {
|
|
80
|
+
throw new Error(`email_mailbox config.initialFetchLimit must be an integer between 0 and ${exports.EMAIL_MAILBOX_MAX_INITIAL_FETCH_LIMIT} (0 = new mail only); got ${String(initialFetchLimitRaw)}`);
|
|
81
|
+
}
|
|
82
|
+
initialFetchLimit = parsed;
|
|
83
|
+
}
|
|
70
84
|
const smtpEndpoint = asString(config.smtpEndpoint);
|
|
71
85
|
if (smtpEndpoint && !/^smtp:\/\/./i.test(smtpEndpoint)) {
|
|
72
86
|
throw new Error(`email_mailbox config.smtpEndpoint must use smtp:// (uxc SMTP surface); got ${smtpEndpoint}`);
|
|
@@ -91,6 +105,7 @@ function parseEmailMailboxSourceConfig(source) {
|
|
|
91
105
|
account: account?.trim() || undefined,
|
|
92
106
|
mailbox,
|
|
93
107
|
pollIntervalSecs,
|
|
108
|
+
initialFetchLimit,
|
|
94
109
|
...(smtpEndpoint ? { smtpEndpoint } : {}),
|
|
95
110
|
...(fromAddress ? { fromAddress } : {}),
|
|
96
111
|
...(addressAllowlist && addressAllowlist.length > 0 ? { addressAllowlist } : {}),
|
|
@@ -106,13 +121,27 @@ function buildEmailMailboxSourceSpec(config) {
|
|
|
106
121
|
endpoint: config.endpoint,
|
|
107
122
|
mode: "stream",
|
|
108
123
|
transport_hint: "email_imap_idle",
|
|
109
|
-
args
|
|
124
|
+
args: {
|
|
125
|
+
...args,
|
|
126
|
+
initial_fetch_limit: config.initialFetchLimit,
|
|
127
|
+
},
|
|
110
128
|
options: {
|
|
111
129
|
auth: config.uxcAuth,
|
|
112
130
|
artifact_compaction: false,
|
|
113
131
|
},
|
|
114
132
|
};
|
|
115
133
|
}
|
|
134
|
+
// See EmailPollSubscriptionConfig: the extra field is tolerated by older
|
|
135
|
+
// daemons (serde ignores unknown poll_config fields).
|
|
136
|
+
const pollConfig = {
|
|
137
|
+
interval_secs: config.pollIntervalSecs,
|
|
138
|
+
initial_items_limit: config.initialFetchLimit,
|
|
139
|
+
extract_items_pointer: "/items",
|
|
140
|
+
checkpoint_strategy: {
|
|
141
|
+
type: "item_key",
|
|
142
|
+
item_key_pointer: "/message/uid",
|
|
143
|
+
},
|
|
144
|
+
};
|
|
116
145
|
return {
|
|
117
146
|
endpoint: config.endpoint,
|
|
118
147
|
mode: "poll",
|
|
@@ -121,14 +150,7 @@ function buildEmailMailboxSourceSpec(config) {
|
|
|
121
150
|
provider: config.provider,
|
|
122
151
|
...args,
|
|
123
152
|
},
|
|
124
|
-
poll_config:
|
|
125
|
-
interval_secs: config.pollIntervalSecs,
|
|
126
|
-
extract_items_pointer: "/items",
|
|
127
|
-
checkpoint_strategy: {
|
|
128
|
-
type: "item_key",
|
|
129
|
-
item_key_pointer: "/message/uid",
|
|
130
|
-
},
|
|
131
|
-
},
|
|
153
|
+
poll_config: pollConfig,
|
|
132
154
|
options: {
|
|
133
155
|
auth: config.uxcAuth,
|
|
134
156
|
artifact_compaction: false,
|
|
@@ -618,6 +618,7 @@ const TELEGRAM_BOT_MODULE = {
|
|
|
618
618
|
},
|
|
619
619
|
options: {
|
|
620
620
|
auth: config.uxcAuth,
|
|
621
|
+
schema_url: telegram_1.TELEGRAM_BOT_SCHEMA_URL,
|
|
621
622
|
artifact_compaction: false,
|
|
622
623
|
},
|
|
623
624
|
};
|
|
@@ -659,6 +660,7 @@ const EMAIL_MAILBOX_MODULE = {
|
|
|
659
660
|
{ name: "account", type: "string", required: false, description: "Account alias; defaults to the auth profile username." },
|
|
660
661
|
{ name: "mailbox", type: "string", required: false, description: "Mailbox to watch; defaults to INBOX." },
|
|
661
662
|
{ name: "pollIntervalSecs", type: "number", required: false, description: "Provider poll interval in seconds (min 15, default 60)." },
|
|
663
|
+
{ name: "initialFetchLimit", type: "number", required: false, description: "First-look backfill depth: 0 = new mail only, max 100, default 25." },
|
|
662
664
|
{ name: "smtpEndpoint", type: "string", required: false, description: "Default smtp:// endpoint for outbound delivery." },
|
|
663
665
|
{ name: "fromAddress", type: "string", required: false, description: "Default outbound From address." },
|
|
664
666
|
{ name: "addressAllowlist", type: "string[]", required: false, description: "Optional from/to address allowlist." },
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TelegramDeliveryAdapter = exports.TelegramBotApiClient = exports.TELEGRAM_BOT_API_ENDPOINT = void 0;
|
|
3
|
+
exports.TelegramDeliveryAdapter = exports.TelegramBotApiClient = exports.TELEGRAM_BOT_SCHEMA_URL = exports.TELEGRAM_BOT_API_ENDPOINT = void 0;
|
|
4
4
|
exports.telegramDeliveryOperationsForHandle = telegramDeliveryOperationsForHandle;
|
|
5
5
|
exports.invokeTelegramDeliveryOperation = invokeTelegramDeliveryOperation;
|
|
6
6
|
exports.normalizeTelegramBotUpdate = normalizeTelegramBotUpdate;
|
|
7
7
|
exports.parseTelegramSourceConfig = parseTelegramSourceConfig;
|
|
8
8
|
exports.TELEGRAM_BOT_API_ENDPOINT = "https://api.telegram.org";
|
|
9
|
+
exports.TELEGRAM_BOT_SCHEMA_URL = "https://raw.githubusercontent.com/holon-run/uxc/main/skills/telegram-openapi-skill/references/telegram-bot.openapi.json";
|
|
9
10
|
class TelegramBotApiClient {
|
|
10
11
|
client;
|
|
11
12
|
constructor(client = { fetch: (url, init) => fetch(url, init) }) {
|