@agenticmail/enterprise 0.5.312 → 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.
Files changed (208) hide show
  1. package/README.md +682 -544
  2. package/dist/agent-autonomy-PSXQ4MNP.js +766 -0
  3. package/dist/agent-heartbeat-6H3YAQ32.js +510 -0
  4. package/dist/agent-heartbeat-7WS3XILF.js +510 -0
  5. package/dist/agent-heartbeat-BFGKYUUK.js +510 -0
  6. package/dist/agent-heartbeat-SSV65YTX.js +510 -0
  7. package/dist/agent-heartbeat-T5IIHVF4.js +510 -0
  8. package/dist/agent-heartbeat-X3C6FIU2.js +510 -0
  9. package/dist/agent-tools-BW6CLQQ7.js +13897 -0
  10. package/dist/agent-tools-KEA7QEWF.js +13897 -0
  11. package/dist/agent-tools-NU7V3S5N.js +13899 -0
  12. package/dist/agent-tools-WINDYRQ2.js +13897 -0
  13. package/dist/chunk-3ELH5CU6.js +4910 -0
  14. package/dist/chunk-4QYRS3MS.js +1519 -0
  15. package/dist/chunk-52REEVDW.js +1519 -0
  16. package/dist/chunk-5RZJ76YI.js +4977 -0
  17. package/dist/chunk-6L7FQI5Q.js +4909 -0
  18. package/dist/chunk-763OMGFI.js +1519 -0
  19. package/dist/chunk-7ILSXGY6.js +1519 -0
  20. package/dist/chunk-7UCKD25B.js +551 -0
  21. package/dist/chunk-A6MSR7DL.js +4977 -0
  22. package/dist/chunk-ASD2YB6O.js +1519 -0
  23. package/dist/chunk-AZOIHLLX.js +4977 -0
  24. package/dist/chunk-BDCFOP7O.js +537 -0
  25. package/dist/chunk-BSVWPG6I.js +106 -0
  26. package/dist/chunk-C46DNDZB.js +1519 -0
  27. package/dist/chunk-CFVTK4FQ.js +4977 -0
  28. package/dist/chunk-CHJAOKCJ.js +4921 -0
  29. package/dist/chunk-CYEWTXYH.js +4977 -0
  30. package/dist/chunk-D3KFSWLK.js +48 -0
  31. package/dist/chunk-DUVGNAIY.js +4977 -0
  32. package/dist/chunk-DX4XEFVE.js +25229 -0
  33. package/dist/chunk-EX6FQSEV.js +167 -0
  34. package/dist/chunk-F5VZ5EUH.js +1519 -0
  35. package/dist/chunk-FVUDSPOD.js +4977 -0
  36. package/dist/chunk-G6FTZKJX.js +4977 -0
  37. package/dist/chunk-GFEAZN6Y.js +1519 -0
  38. package/dist/chunk-HKV4FQFW.js +1519 -0
  39. package/dist/chunk-ICCPULDT.js +25217 -0
  40. package/dist/chunk-IYEM627Q.js +25216 -0
  41. package/dist/chunk-JHRJ4QJ6.js +1519 -0
  42. package/dist/chunk-K2DAUYHV.js +4977 -0
  43. package/dist/chunk-KDQDSZZQ.js +4973 -0
  44. package/dist/chunk-LDUD6AZY.js +1519 -0
  45. package/dist/chunk-LES5TJ5L.js +4909 -0
  46. package/dist/chunk-MJGGW6MC.js +106 -0
  47. package/dist/chunk-MQKIWAHQ.js +106 -0
  48. package/dist/chunk-NGA7BBPF.js +48 -0
  49. package/dist/chunk-OE3TI4IQ.js +1519 -0
  50. package/dist/chunk-OHSBIYDR.js +4977 -0
  51. package/dist/chunk-OZEYDEPB.js +1519 -0
  52. package/dist/chunk-P4PODSQH.js +1519 -0
  53. package/dist/chunk-P7UOSFIE.js +636 -0
  54. package/dist/chunk-PFN6DODU.js +4921 -0
  55. package/dist/chunk-PKDVM4IY.js +4917 -0
  56. package/dist/chunk-Q5KG3G7U.js +25115 -0
  57. package/dist/chunk-QMVNW4FJ.js +25229 -0
  58. package/dist/chunk-QZ5UPRBE.js +4977 -0
  59. package/dist/chunk-SPP23N42.js +4977 -0
  60. package/dist/chunk-SRGHNFOY.js +4921 -0
  61. package/dist/chunk-TPLVQFXM.js +2594 -0
  62. package/dist/chunk-U3XYF4QP.js +4977 -0
  63. package/dist/chunk-VRRJH2DY.js +4921 -0
  64. package/dist/chunk-WY42BS3F.js +1519 -0
  65. package/dist/chunk-XAA4VHHZ.js +1519 -0
  66. package/dist/chunk-Z5Y5KTPC.js +4977 -0
  67. package/dist/chunk-ZA4QRACH.js +4977 -0
  68. package/dist/chunk-ZHLGSTXF.js +4909 -0
  69. package/dist/cli-agent-26BUULHZ.js +2169 -0
  70. package/dist/cli-agent-2FLJWXOC.js +2169 -0
  71. package/dist/cli-agent-4NNQFLO6.js +2255 -0
  72. package/dist/cli-agent-5WV3EEPW.js +2252 -0
  73. package/dist/cli-agent-65JUT6DU.js +2193 -0
  74. package/dist/cli-agent-6HLL7A5K.js +2255 -0
  75. package/dist/cli-agent-CZ26QWUZ.js +2210 -0
  76. package/dist/cli-agent-HPVSWDNQ.js +2255 -0
  77. package/dist/cli-agent-K4SBVG5X.js +2210 -0
  78. package/dist/cli-agent-K5D424X2.js +2252 -0
  79. package/dist/cli-agent-U4OL5FGK.js +2210 -0
  80. package/dist/cli-agent-WUMPOIKQ.js +2169 -0
  81. package/dist/cli-agent-WWRGGJ2F.js +2255 -0
  82. package/dist/cli-agent-ZDBBTVGU.js +2193 -0
  83. package/dist/cli-agent-ZIZ5JP4O.js +2252 -0
  84. package/dist/cli-recover-I4KNR2OI.js +487 -0
  85. package/dist/cli-recover-IQTUKWR2.js +487 -0
  86. package/dist/cli-recover-OYJHELOR.js +487 -0
  87. package/dist/cli-recover-PVQC7UXB.js +487 -0
  88. package/dist/cli-recover-T32NABFA.js +487 -0
  89. package/dist/cli-serve-FTQJ3RUK.js +143 -0
  90. package/dist/cli-serve-G4PUCASH.js +143 -0
  91. package/dist/cli-serve-HBZYUUQ3.js +143 -0
  92. package/dist/cli-serve-L3NUROMO.js +143 -0
  93. package/dist/cli-serve-LAA5WIZK.js +143 -0
  94. package/dist/cli-serve-LV4TUSJD.js +143 -0
  95. package/dist/cli-serve-MFCTVA2L.js +140 -0
  96. package/dist/cli-serve-QCRUFI5B.js +143 -0
  97. package/dist/cli-serve-S7OGQN4P.js +143 -0
  98. package/dist/cli-serve-SI4BQRXT.js +140 -0
  99. package/dist/cli-serve-UNB7EHN4.js +143 -0
  100. package/dist/cli-serve-UV3GVDRD.js +143 -0
  101. package/dist/cli-serve-V5QICXR5.js +143 -0
  102. package/dist/cli-serve-VG6Z6GIB.js +143 -0
  103. package/dist/cli-serve-XSYHPGZI.js +143 -0
  104. package/dist/cli-serve-Y534FCRV.js +140 -0
  105. package/dist/cli-verify-CZIITRED.js +149 -0
  106. package/dist/cli-verify-N73GOKEF.js +149 -0
  107. package/dist/cli-verify-QEEBZOUZ.js +149 -0
  108. package/dist/cli-verify-RC5HI6DU.js +149 -0
  109. package/dist/cli-verify-VKBNIEAX.js +149 -0
  110. package/dist/cli.js +5 -5
  111. package/dist/dashboard/app.js +8 -2
  112. package/dist/dashboard/components/org-switcher.js +5 -1
  113. package/dist/dashboard/org-switcher.js +156 -0
  114. package/dist/dashboard/pages/login.js +160 -4
  115. package/dist/dashboard/pages/task-pipeline.js +1 -1
  116. package/dist/factory-3IWXVE37.js +9 -0
  117. package/dist/factory-5M6PTMLC.js +11 -0
  118. package/dist/factory-CSSHN7GE.js +11 -0
  119. package/dist/factory-JFWXTAWK.js +11 -0
  120. package/dist/factory-TBGUYM5X.js +9 -0
  121. package/dist/google-W5AYGNUJ.js +33 -0
  122. package/dist/index.js +6 -6
  123. package/dist/meetings-FJ453ENF.js +12 -0
  124. package/dist/postgres-BCHZWRU3.js +832 -0
  125. package/dist/postgres-BI4QVRM6.js +825 -0
  126. package/dist/postgres-BOTHOPDW.js +875 -0
  127. package/dist/postgres-JBUKR3TA.js +873 -0
  128. package/dist/postgres-Z7QYSU6K.js +861 -0
  129. package/dist/routes-7QYAQTWA.js +90 -0
  130. package/dist/routes-JCBVZU54.js +90 -0
  131. package/dist/routes-KEDEJFRE.js +90 -0
  132. package/dist/routes-WI64ADVH.js +90 -0
  133. package/dist/routes-X36OSCID.js +90 -0
  134. package/dist/runtime-75XR6KEW.js +45 -0
  135. package/dist/runtime-BNM7ZNNL.js +45 -0
  136. package/dist/runtime-ES6WCJ7D.js +45 -0
  137. package/dist/runtime-KYJTML2B.js +45 -0
  138. package/dist/runtime-LO67ZHQA.js +45 -0
  139. package/dist/runtime-VIXKKVSZ.js +45 -0
  140. package/dist/runtime-WHWJPCGK.js +45 -0
  141. package/dist/runtime-Z2Q6GUHH.js +45 -0
  142. package/dist/runtime-ZZ6CALSB.js +45 -0
  143. package/dist/server-27A4WEJC.js +28 -0
  144. package/dist/server-2CBXP4WS.js +28 -0
  145. package/dist/server-4JQAB5R4.js +28 -0
  146. package/dist/server-6BOM5U64.js +28 -0
  147. package/dist/server-FLJKNPRD.js +28 -0
  148. package/dist/server-HMIHIQ2N.js +28 -0
  149. package/dist/server-KIXXLR2D.js +28 -0
  150. package/dist/server-KSEIZTXF.js +28 -0
  151. package/dist/server-MPVW7DKZ.js +28 -0
  152. package/dist/server-PRTVRQ2D.js +28 -0
  153. package/dist/server-SYIG6HAX.js +28 -0
  154. package/dist/server-U32KDIXC.js +28 -0
  155. package/dist/server-WFN6CA4T.js +28 -0
  156. package/dist/server-XQUE3FGT.js +28 -0
  157. package/dist/server-XWT2UORK.js +28 -0
  158. package/dist/server-Y3BGNN5Q.js +28 -0
  159. package/dist/setup-352L2TPS.js +20 -0
  160. package/dist/setup-4MM645XK.js +20 -0
  161. package/dist/setup-5JPWW6IP.js +20 -0
  162. package/dist/setup-CUN6LVUV.js +20 -0
  163. package/dist/setup-D3YHPWPY.js +20 -0
  164. package/dist/setup-D4A5I6UM.js +20 -0
  165. package/dist/setup-DOPLXTB3.js +20 -0
  166. package/dist/setup-E3NSIM6B.js +20 -0
  167. package/dist/setup-E3V2D7NL.js +20 -0
  168. package/dist/setup-FSYPGI2C.js +20 -0
  169. package/dist/setup-G3RPKRG3.js +20 -0
  170. package/dist/setup-KJ77HNWK.js +20 -0
  171. package/dist/setup-LPSOY5V5.js +20 -0
  172. package/dist/setup-N3ODDSQE.js +20 -0
  173. package/dist/setup-NLDM3M2P.js +20 -0
  174. package/dist/setup-SWJMNDWF.js +20 -0
  175. package/dist/system-prompts-6OUTAMH6.js +41 -0
  176. package/dist/task-queue-YP2I54IA.js +9 -0
  177. package/dist/telegram-QRNGRT5M.js +17 -0
  178. package/dist/whatsapp-VYVINCGV.js +31 -0
  179. package/god_is_great.html +35 -0
  180. package/package.json +1 -1
  181. package/src/agent-tools/index.ts +4 -1
  182. package/src/agent-tools/tool-resolver.ts +15 -4
  183. package/src/agent-tools/tools/browser.ts +2 -2
  184. package/src/agent-tools/tools/local/dependency-manager.ts +286 -0
  185. package/src/agent-tools/tools/local/index.ts +3 -0
  186. package/src/agent-tools/tools/messaging/telegram.ts +29 -0
  187. package/src/agent-tools/tools/messaging/whatsapp.ts +59 -4
  188. package/src/auth/routes.ts +1 -1
  189. package/src/cli-agent.ts +47 -6
  190. package/src/cli-serve.ts +2 -5
  191. package/src/dashboard/app.js +8 -2
  192. package/src/dashboard/components/org-switcher.js +5 -1
  193. package/src/dashboard/pages/login.js +160 -4
  194. package/src/dashboard/pages/task-pipeline.js +1 -1
  195. package/src/db/adapter.ts +2 -0
  196. package/src/db/factory.ts +78 -0
  197. package/src/db/postgres.ts +57 -12
  198. package/src/engine/agent-autonomy.ts +1 -1
  199. package/src/engine/agent-heartbeat.ts +1 -1
  200. package/src/engine/messaging-poller.ts +146 -11
  201. package/src/engine/oauth-connect-routes.ts +23 -3
  202. package/src/engine/routes.ts +1 -1
  203. package/src/engine/task-poller.ts +54 -3
  204. package/src/engine/task-queue.ts +30 -0
  205. package/src/runtime/index.ts +2 -1
  206. package/src/runtime/types.ts +2 -0
  207. package/src/server.ts +13 -1
  208. 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
+ };