@agenticmail/enterprise 0.5.311 → 0.5.313
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 +682 -544
- package/dist/agent-autonomy-PSXQ4MNP.js +766 -0
- package/dist/agent-heartbeat-6H3YAQ32.js +510 -0
- package/dist/agent-heartbeat-7WS3XILF.js +510 -0
- package/dist/agent-heartbeat-BFGKYUUK.js +510 -0
- package/dist/agent-heartbeat-SSV65YTX.js +510 -0
- package/dist/agent-heartbeat-T5IIHVF4.js +510 -0
- package/dist/agent-heartbeat-X3C6FIU2.js +510 -0
- package/dist/agent-tools-BW6CLQQ7.js +13897 -0
- package/dist/agent-tools-KEA7QEWF.js +13897 -0
- package/dist/agent-tools-NU7V3S5N.js +13899 -0
- package/dist/agent-tools-WINDYRQ2.js +13897 -0
- package/dist/chunk-3ELH5CU6.js +4910 -0
- package/dist/chunk-4QYRS3MS.js +1519 -0
- package/dist/chunk-52REEVDW.js +1519 -0
- package/dist/chunk-5RZJ76YI.js +4977 -0
- package/dist/chunk-6L7FQI5Q.js +4909 -0
- package/dist/chunk-763OMGFI.js +1519 -0
- package/dist/chunk-7ILSXGY6.js +1519 -0
- package/dist/chunk-7UCKD25B.js +551 -0
- package/dist/chunk-A6MSR7DL.js +4977 -0
- package/dist/chunk-ASD2YB6O.js +1519 -0
- package/dist/chunk-AZOIHLLX.js +4977 -0
- package/dist/chunk-BDCFOP7O.js +537 -0
- package/dist/chunk-BSVWPG6I.js +106 -0
- package/dist/chunk-C46DNDZB.js +1519 -0
- package/dist/chunk-CFVTK4FQ.js +4977 -0
- package/dist/chunk-CHJAOKCJ.js +4921 -0
- package/dist/chunk-CYEWTXYH.js +4977 -0
- package/dist/chunk-D3KFSWLK.js +48 -0
- package/dist/chunk-DUVGNAIY.js +4977 -0
- package/dist/chunk-DX4XEFVE.js +25229 -0
- package/dist/chunk-EX6FQSEV.js +167 -0
- package/dist/chunk-F5VZ5EUH.js +1519 -0
- package/dist/chunk-FVUDSPOD.js +4977 -0
- package/dist/chunk-G6FTZKJX.js +4977 -0
- package/dist/chunk-GFEAZN6Y.js +1519 -0
- package/dist/chunk-HKV4FQFW.js +1519 -0
- package/dist/chunk-ICCPULDT.js +25217 -0
- package/dist/chunk-IYEM627Q.js +25216 -0
- package/dist/chunk-JHRJ4QJ6.js +1519 -0
- package/dist/chunk-K2DAUYHV.js +4977 -0
- package/dist/chunk-KDQDSZZQ.js +4973 -0
- package/dist/chunk-LDUD6AZY.js +1519 -0
- package/dist/chunk-LES5TJ5L.js +4909 -0
- package/dist/chunk-MJGGW6MC.js +106 -0
- package/dist/chunk-MQKIWAHQ.js +106 -0
- package/dist/chunk-NGA7BBPF.js +48 -0
- package/dist/chunk-OE3TI4IQ.js +1519 -0
- package/dist/chunk-OHSBIYDR.js +4977 -0
- package/dist/chunk-OPOBUYJT.js +1519 -0
- package/dist/chunk-OZEYDEPB.js +1519 -0
- package/dist/chunk-P4PODSQH.js +1519 -0
- package/dist/chunk-P7UOSFIE.js +636 -0
- package/dist/chunk-PFN6DODU.js +4921 -0
- package/dist/chunk-PKDVM4IY.js +4917 -0
- package/dist/chunk-Q5KG3G7U.js +25115 -0
- package/dist/chunk-QMVNW4FJ.js +25229 -0
- package/dist/chunk-QZ5UPRBE.js +4977 -0
- package/dist/chunk-SPP23N42.js +4977 -0
- package/dist/chunk-SRGHNFOY.js +4921 -0
- package/dist/chunk-TPLVQFXM.js +2594 -0
- package/dist/chunk-U3XYF4QP.js +4977 -0
- package/dist/chunk-VRRJH2DY.js +4921 -0
- package/dist/chunk-WY42BS3F.js +1519 -0
- package/dist/chunk-XAA4VHHZ.js +1519 -0
- package/dist/chunk-Y2KIY4BA.js +4969 -0
- package/dist/chunk-Z5Y5KTPC.js +4977 -0
- package/dist/chunk-ZA4QRACH.js +4977 -0
- package/dist/chunk-ZHLGSTXF.js +4909 -0
- package/dist/cli-agent-26BUULHZ.js +2169 -0
- package/dist/cli-agent-2FLJWXOC.js +2169 -0
- package/dist/cli-agent-4NNQFLO6.js +2255 -0
- package/dist/cli-agent-5WV3EEPW.js +2252 -0
- package/dist/cli-agent-65JUT6DU.js +2193 -0
- package/dist/cli-agent-6HLL7A5K.js +2255 -0
- package/dist/cli-agent-CZ26QWUZ.js +2210 -0
- package/dist/cli-agent-HPVSWDNQ.js +2255 -0
- package/dist/cli-agent-K4SBVG5X.js +2210 -0
- package/dist/cli-agent-K5D424X2.js +2252 -0
- package/dist/cli-agent-U4OL5FGK.js +2210 -0
- package/dist/cli-agent-WUMPOIKQ.js +2169 -0
- package/dist/cli-agent-WWRGGJ2F.js +2255 -0
- package/dist/cli-agent-ZDBBTVGU.js +2193 -0
- package/dist/cli-agent-ZIZ5JP4O.js +2252 -0
- package/dist/cli-recover-I4KNR2OI.js +487 -0
- package/dist/cli-recover-IQTUKWR2.js +487 -0
- package/dist/cli-recover-OYJHELOR.js +487 -0
- package/dist/cli-recover-PVQC7UXB.js +487 -0
- package/dist/cli-recover-T32NABFA.js +487 -0
- package/dist/cli-serve-FE4CMMSN.js +143 -0
- package/dist/cli-serve-FTQJ3RUK.js +143 -0
- package/dist/cli-serve-G4PUCASH.js +143 -0
- package/dist/cli-serve-HBZYUUQ3.js +143 -0
- package/dist/cli-serve-L3NUROMO.js +143 -0
- package/dist/cli-serve-LAA5WIZK.js +143 -0
- package/dist/cli-serve-LV4TUSJD.js +143 -0
- package/dist/cli-serve-MFCTVA2L.js +140 -0
- package/dist/cli-serve-QCRUFI5B.js +143 -0
- package/dist/cli-serve-S7OGQN4P.js +143 -0
- package/dist/cli-serve-SI4BQRXT.js +140 -0
- package/dist/cli-serve-UNB7EHN4.js +143 -0
- package/dist/cli-serve-UV3GVDRD.js +143 -0
- package/dist/cli-serve-V5QICXR5.js +143 -0
- package/dist/cli-serve-VG6Z6GIB.js +143 -0
- package/dist/cli-serve-XSYHPGZI.js +143 -0
- package/dist/cli-serve-Y534FCRV.js +140 -0
- package/dist/cli-verify-CZIITRED.js +149 -0
- package/dist/cli-verify-N73GOKEF.js +149 -0
- package/dist/cli-verify-QEEBZOUZ.js +149 -0
- package/dist/cli-verify-RC5HI6DU.js +149 -0
- package/dist/cli-verify-VKBNIEAX.js +149 -0
- package/dist/cli.js +5 -5
- package/dist/dashboard/app.js +16 -3
- package/dist/dashboard/components/org-switcher.js +5 -1
- package/dist/dashboard/org-switcher.js +156 -0
- package/dist/dashboard/pages/login.js +160 -4
- package/dist/dashboard/pages/task-pipeline.js +1 -1
- package/dist/factory-3IWXVE37.js +9 -0
- package/dist/factory-5M6PTMLC.js +11 -0
- package/dist/factory-CSSHN7GE.js +11 -0
- package/dist/factory-JFWXTAWK.js +11 -0
- package/dist/factory-TBGUYM5X.js +9 -0
- package/dist/google-W5AYGNUJ.js +33 -0
- package/dist/index.js +6 -6
- package/dist/meetings-FJ453ENF.js +12 -0
- package/dist/postgres-BCHZWRU3.js +832 -0
- package/dist/postgres-BI4QVRM6.js +825 -0
- package/dist/postgres-BOTHOPDW.js +875 -0
- package/dist/postgres-JBUKR3TA.js +873 -0
- package/dist/postgres-Z7QYSU6K.js +861 -0
- package/dist/routes-7QYAQTWA.js +90 -0
- package/dist/routes-JCBVZU54.js +90 -0
- package/dist/routes-KEDEJFRE.js +90 -0
- package/dist/routes-WI64ADVH.js +90 -0
- package/dist/routes-X36OSCID.js +90 -0
- package/dist/runtime-75XR6KEW.js +45 -0
- package/dist/runtime-BNM7ZNNL.js +45 -0
- package/dist/runtime-ES6WCJ7D.js +45 -0
- package/dist/runtime-KYJTML2B.js +45 -0
- package/dist/runtime-LO67ZHQA.js +45 -0
- package/dist/runtime-VIXKKVSZ.js +45 -0
- package/dist/runtime-WHWJPCGK.js +45 -0
- package/dist/runtime-Z2Q6GUHH.js +45 -0
- package/dist/runtime-ZZ6CALSB.js +45 -0
- package/dist/server-27A4WEJC.js +28 -0
- package/dist/server-2CBXP4WS.js +28 -0
- package/dist/server-4JQAB5R4.js +28 -0
- package/dist/server-6BOM5U64.js +28 -0
- package/dist/server-CA2I3LJY.js +28 -0
- package/dist/server-FLJKNPRD.js +28 -0
- package/dist/server-HMIHIQ2N.js +28 -0
- package/dist/server-KIXXLR2D.js +28 -0
- package/dist/server-KSEIZTXF.js +28 -0
- package/dist/server-MPVW7DKZ.js +28 -0
- package/dist/server-PRTVRQ2D.js +28 -0
- package/dist/server-SYIG6HAX.js +28 -0
- package/dist/server-U32KDIXC.js +28 -0
- package/dist/server-WFN6CA4T.js +28 -0
- package/dist/server-XQUE3FGT.js +28 -0
- package/dist/server-XWT2UORK.js +28 -0
- package/dist/server-Y3BGNN5Q.js +28 -0
- package/dist/setup-352L2TPS.js +20 -0
- package/dist/setup-4MM645XK.js +20 -0
- package/dist/setup-5JPWW6IP.js +20 -0
- package/dist/setup-CUN6LVUV.js +20 -0
- package/dist/setup-D3YHPWPY.js +20 -0
- package/dist/setup-D4A5I6UM.js +20 -0
- package/dist/setup-DOPLXTB3.js +20 -0
- package/dist/setup-E3NSIM6B.js +20 -0
- package/dist/setup-E3V2D7NL.js +20 -0
- package/dist/setup-FSYPGI2C.js +20 -0
- package/dist/setup-G3RPKRG3.js +20 -0
- package/dist/setup-KJ77HNWK.js +20 -0
- package/dist/setup-LPSOY5V5.js +20 -0
- package/dist/setup-N3ODDSQE.js +20 -0
- package/dist/setup-NLDM3M2P.js +20 -0
- package/dist/setup-PT6WGOYB.js +20 -0
- package/dist/setup-SWJMNDWF.js +20 -0
- package/dist/system-prompts-6OUTAMH6.js +41 -0
- package/dist/task-queue-YP2I54IA.js +9 -0
- package/dist/telegram-QRNGRT5M.js +17 -0
- package/dist/whatsapp-VYVINCGV.js +31 -0
- package/god_is_great.html +35 -0
- package/package.json +1 -1
- package/src/admin/routes.ts +24 -4
- package/src/agent-tools/index.ts +4 -1
- package/src/agent-tools/tool-resolver.ts +15 -4
- package/src/agent-tools/tools/browser.ts +2 -2
- package/src/agent-tools/tools/local/dependency-manager.ts +286 -0
- package/src/agent-tools/tools/local/index.ts +3 -0
- package/src/agent-tools/tools/messaging/telegram.ts +29 -0
- package/src/agent-tools/tools/messaging/whatsapp.ts +59 -4
- package/src/auth/routes.ts +15 -12
- package/src/cli-agent.ts +47 -6
- package/src/cli-serve.ts +2 -5
- package/src/dashboard/app.js +16 -3
- package/src/dashboard/components/org-switcher.js +5 -1
- package/src/dashboard/pages/login.js +160 -4
- package/src/dashboard/pages/task-pipeline.js +1 -1
- package/src/db/adapter.ts +2 -0
- package/src/db/factory.ts +78 -0
- package/src/db/postgres.ts +57 -12
- package/src/engine/agent-autonomy.ts +1 -1
- package/src/engine/agent-heartbeat.ts +1 -1
- package/src/engine/messaging-poller.ts +146 -11
- package/src/engine/oauth-connect-routes.ts +23 -3
- package/src/engine/routes.ts +1 -1
- package/src/engine/task-poller.ts +54 -3
- package/src/engine/task-queue.ts +30 -0
- package/src/runtime/index.ts +2 -1
- package/src/runtime/types.ts +2 -0
- package/src/server.ts +43 -1
- package/src/system-prompts/triage.ts +1 -1
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__esm
|
|
3
|
+
} from "./chunk-KFQGP6VL.js";
|
|
4
|
+
|
|
5
|
+
// src/agent-tools/tools/messaging/telegram.ts
|
|
6
|
+
async function tgApi(token, method, body) {
|
|
7
|
+
var timeoutMs = method === "getUpdates" && body?.timeout ? (body.timeout + 15) * 1e3 : 3e4;
|
|
8
|
+
var opts = { method: "POST", headers: { "Content-Type": "application/json" }, signal: AbortSignal.timeout(timeoutMs) };
|
|
9
|
+
if (body) opts.body = JSON.stringify(body);
|
|
10
|
+
var r = await fetch(`https://api.telegram.org/bot${token}/${method}`, opts);
|
|
11
|
+
var json = await r.json();
|
|
12
|
+
if (!json.ok) throw new Error(json.description || "Telegram API error");
|
|
13
|
+
return json.result;
|
|
14
|
+
}
|
|
15
|
+
async function tgUpload(token, method, chatId, fieldName, filePath, extra) {
|
|
16
|
+
var { readFile } = await import("fs/promises");
|
|
17
|
+
var { basename } = await import("path");
|
|
18
|
+
var buf = await readFile(filePath);
|
|
19
|
+
var form = new FormData();
|
|
20
|
+
form.append("chat_id", String(chatId));
|
|
21
|
+
form.append(fieldName, new Blob([buf]), basename(filePath));
|
|
22
|
+
if (extra) for (var [k, v] of Object.entries(extra)) form.append(k, v);
|
|
23
|
+
var r = await fetch(`https://api.telegram.org/bot${token}/${method}`, { method: "POST", body: form, signal: AbortSignal.timeout(6e4) });
|
|
24
|
+
var json = await r.json();
|
|
25
|
+
if (!json.ok) throw new Error(json.description || "Upload failed");
|
|
26
|
+
return json.result;
|
|
27
|
+
}
|
|
28
|
+
function createTelegramTools(config) {
|
|
29
|
+
var { botToken, onOutbound } = config;
|
|
30
|
+
return [
|
|
31
|
+
{
|
|
32
|
+
name: "telegram_send",
|
|
33
|
+
description: "Send/reply a Telegram message to a chat.",
|
|
34
|
+
input_schema: {
|
|
35
|
+
type: "object",
|
|
36
|
+
properties: {
|
|
37
|
+
chatId: { type: "string" },
|
|
38
|
+
text: { type: "string" },
|
|
39
|
+
replyTo: { type: "number" }
|
|
40
|
+
},
|
|
41
|
+
required: ["chatId", "text"]
|
|
42
|
+
},
|
|
43
|
+
execute: async (_id, input) => {
|
|
44
|
+
var r = await tgApi(botToken, "sendMessage", {
|
|
45
|
+
chat_id: input.chatId,
|
|
46
|
+
text: input.text,
|
|
47
|
+
parse_mode: "HTML",
|
|
48
|
+
...input.replyTo ? { reply_parameters: { message_id: input.replyTo } } : {}
|
|
49
|
+
});
|
|
50
|
+
if (onOutbound) try {
|
|
51
|
+
onOutbound(input.chatId, input.text);
|
|
52
|
+
} catch {
|
|
53
|
+
}
|
|
54
|
+
return { ok: true, messageId: r.message_id };
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: "telegram_send_media",
|
|
59
|
+
description: "Send image, video, or document from local file.",
|
|
60
|
+
input_schema: {
|
|
61
|
+
type: "object",
|
|
62
|
+
properties: {
|
|
63
|
+
chatId: { type: "string" },
|
|
64
|
+
filePath: { type: "string" },
|
|
65
|
+
caption: { type: "string" },
|
|
66
|
+
type: { type: "string", description: "photo|video|document (auto-detected)" }
|
|
67
|
+
},
|
|
68
|
+
required: ["chatId", "filePath"]
|
|
69
|
+
},
|
|
70
|
+
execute: async (_id, input) => {
|
|
71
|
+
var ext = input.filePath.split(".").pop()?.toLowerCase() || "";
|
|
72
|
+
var type = input.type || (["mp4", "mov", "webm"].includes(ext) ? "video" : ["jpg", "jpeg", "png", "gif", "webp"].includes(ext) ? "photo" : "document");
|
|
73
|
+
var method = type === "photo" ? "sendPhoto" : type === "video" ? "sendVideo" : "sendDocument";
|
|
74
|
+
var field = type === "photo" ? "photo" : type === "video" ? "video" : "document";
|
|
75
|
+
var r = await tgUpload(botToken, method, input.chatId, field, input.filePath, input.caption ? { caption: input.caption } : void 0);
|
|
76
|
+
return { ok: true, type, messageId: r.message_id };
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
name: "telegram_get_me",
|
|
81
|
+
description: "Get bot info.",
|
|
82
|
+
input_schema: { type: "object", properties: {}, required: [] },
|
|
83
|
+
execute: async (_id) => tgApi(botToken, "getMe")
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
name: "telegram_download_file",
|
|
87
|
+
description: "Download a file from Telegram by file_id (from media messages). Returns the local path.",
|
|
88
|
+
input_schema: {
|
|
89
|
+
type: "object",
|
|
90
|
+
properties: {
|
|
91
|
+
fileId: { type: "string", description: "Telegram file_id from the message" },
|
|
92
|
+
fileName: { type: "string", description: "Optional output filename" }
|
|
93
|
+
},
|
|
94
|
+
required: ["fileId"]
|
|
95
|
+
},
|
|
96
|
+
execute: async (_id, input) => {
|
|
97
|
+
var fileData = await tgApi(botToken, "getFile", { file_id: input.fileId });
|
|
98
|
+
if (!fileData.file_path) return { error: "No file_path returned" };
|
|
99
|
+
var downloadUrl = `https://api.telegram.org/file/bot${botToken}/${fileData.file_path}`;
|
|
100
|
+
var resp = await fetch(downloadUrl);
|
|
101
|
+
if (!resp.ok) throw new Error(`Download failed: ${resp.status}`);
|
|
102
|
+
var { join } = await import("path");
|
|
103
|
+
var { mkdirSync, writeFileSync } = await import("fs");
|
|
104
|
+
var mediaDir = join("/tmp/agents/media");
|
|
105
|
+
try {
|
|
106
|
+
mkdirSync(mediaDir, { recursive: true });
|
|
107
|
+
} catch {
|
|
108
|
+
}
|
|
109
|
+
var ext = fileData.file_path.split(".").pop() || "bin";
|
|
110
|
+
var localName = input.fileName || `telegram-${Date.now()}.${ext}`;
|
|
111
|
+
var localPath = join(mediaDir, localName);
|
|
112
|
+
var buffer = Buffer.from(await resp.arrayBuffer());
|
|
113
|
+
writeFileSync(localPath, buffer);
|
|
114
|
+
return { ok: true, localPath, size: buffer.length, originalPath: fileData.file_path };
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
name: "telegram_get_chat",
|
|
119
|
+
description: "Get chat/group details.",
|
|
120
|
+
input_schema: {
|
|
121
|
+
type: "object",
|
|
122
|
+
properties: { chatId: { type: "string" } },
|
|
123
|
+
required: ["chatId"]
|
|
124
|
+
},
|
|
125
|
+
execute: async (_id, input) => tgApi(botToken, "getChat", { chat_id: input.chatId })
|
|
126
|
+
}
|
|
127
|
+
];
|
|
128
|
+
}
|
|
129
|
+
async function setTelegramWebhook(botToken, webhookUrl, secret) {
|
|
130
|
+
return tgApi(botToken, "setWebhook", {
|
|
131
|
+
url: webhookUrl,
|
|
132
|
+
secret_token: secret,
|
|
133
|
+
allowed_updates: ["message", "callback_query"],
|
|
134
|
+
drop_pending_updates: false
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
async function deleteTelegramWebhook(botToken) {
|
|
138
|
+
return tgApi(botToken, "deleteWebhook", {});
|
|
139
|
+
}
|
|
140
|
+
async function getTelegramWebhookInfo(botToken) {
|
|
141
|
+
return tgApi(botToken, "getWebhookInfo");
|
|
142
|
+
}
|
|
143
|
+
async function pollTelegramUpdates(botToken, offset, timeoutSec = 25) {
|
|
144
|
+
var updates = await tgApi(botToken, "getUpdates", {
|
|
145
|
+
offset,
|
|
146
|
+
timeout: timeoutSec,
|
|
147
|
+
allowed_updates: ["message"]
|
|
148
|
+
});
|
|
149
|
+
var nextOffset = offset;
|
|
150
|
+
for (var u of updates) {
|
|
151
|
+
if (u.update_id >= nextOffset) nextOffset = u.update_id + 1;
|
|
152
|
+
}
|
|
153
|
+
return { updates, nextOffset };
|
|
154
|
+
}
|
|
155
|
+
var init_telegram = __esm({
|
|
156
|
+
"src/agent-tools/tools/messaging/telegram.ts"() {
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
export {
|
|
161
|
+
createTelegramTools,
|
|
162
|
+
setTelegramWebhook,
|
|
163
|
+
deleteTelegramWebhook,
|
|
164
|
+
getTelegramWebhookInfo,
|
|
165
|
+
pollTelegramUpdates,
|
|
166
|
+
init_telegram
|
|
167
|
+
};
|