@agenticmail/enterprise 0.5.325 → 0.5.327

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 (457) hide show
  1. package/dist/{agent-heartbeat-77N4OOQL.js → agent-heartbeat-ZFKA6GMI.js} +2 -2
  2. package/dist/{agent-tools-BNSTIK4P.js → agent-tools-R6RSBDJQ.js} +25 -25
  3. package/dist/{agenticmail-EDO5XOTP.js → agenticmail-QMWQNUY2.js} +1 -1
  4. package/dist/{browser-tool-JF3LNRGX.js → browser-tool-4KWE37RL.js} +4 -4
  5. package/dist/{chunk-JEGYVXYC.js → chunk-CQV7GGHT.js} +1 -1
  6. package/dist/{chunk-VBTHTPZ6.js → chunk-DWHJYAV6.js} +27 -27
  7. package/dist/{chunk-HKCKMCPY.js → chunk-G4YSECQ4.js} +2 -2
  8. package/dist/{chunk-7HBGXW7Z.js → chunk-GNABVGDZ.js} +31 -32
  9. package/dist/{chunk-DMD24UFZ.js → chunk-HTT6LUPP.js} +19 -19
  10. package/dist/{chunk-3FMK32KQ.js → chunk-LHQP7QRX.js} +9 -9
  11. package/dist/{chunk-6C5PKREN.js → chunk-NOAQG5CY.js} +1 -1
  12. package/dist/{chunk-4EKXYIJF.js → chunk-PAHT4ABL.js} +4 -4
  13. package/dist/{chunk-JNMDD7JY.js → chunk-RHO7WRVJ.js} +5 -5
  14. package/dist/{chunk-BQM7MBPS.js → chunk-WYDVMFGJ.js} +5 -5
  15. package/dist/{chunk-TPLVQFXM.js → chunk-X2YL6KSY.js} +13 -13
  16. package/dist/{cli-agent-ZIIFI77N.js → cli-agent-2NBPF3GN.js} +11 -11
  17. package/dist/{cli-recover-XEZ2SKPU.js → cli-recover-TTOR7CJR.js} +2 -2
  18. package/dist/{cli-serve-BDGOOOKQ.js → cli-serve-5VFU4GR4.js} +3 -3
  19. package/dist/{cli-verify-CZIITRED.js → cli-verify-WICBVLAM.js} +2 -2
  20. package/dist/cli.js +5 -5
  21. package/dist/{connection-manager-KAWEUWUR.js → connection-manager-Y7CCQK4X.js} +1 -1
  22. package/dist/dashboard/pages/cluster.js +1 -1
  23. package/dist/{deployer-3YK4RPUL.js → deployer-7NG7LCJW.js} +1 -1
  24. package/dist/{factory-JFWXTAWK.js → factory-4V2W4BSV.js} +1 -1
  25. package/dist/index.js +9 -9
  26. package/dist/{integrations-TF4EBCJ7.js → integrations-V2WXFDIV.js} +13 -13
  27. package/dist/{local-6MLIZDKO.js → local-OXFH4V7E.js} +2 -2
  28. package/dist/{meeting-voice-intelligence-CJLR52YV.js → meeting-voice-intelligence-RZZCAD6G.js} +2 -2
  29. package/dist/{meetings-FJ453ENF.js → meetings-SQNTB6GD.js} +1 -1
  30. package/dist/{microsoft-2IIHDLJB.js → microsoft-2PDVV6HX.js} +3 -3
  31. package/dist/{postgres-WGUVC2S7.js → postgres-USXBPTHX.js} +2 -2
  32. package/dist/{pw-ai-IBEF6HBF.js → pw-ai-NK5GKBDG.js} +1 -1
  33. package/dist/{routes-XYR2RNEC.js → routes-T3CDAQTD.js} +4 -4
  34. package/dist/{runtime-6BULDBR3.js → runtime-X4BTVICL.js} +1 -1
  35. package/dist/{server-7NT4LMSQ.js → server-WQ6LLYGB.js} +5 -5
  36. package/dist/{setup-2JBXMUDS.js → setup-6DRKSOMH.js} +2 -2
  37. package/dist/{skills-FR7I5V7H.js → skills-EL4RTJKK.js} +1 -1
  38. package/logs/cloudflared-error.log +12 -0
  39. package/logs/enterprise-out.log +2 -0
  40. package/package.json +1 -1
  41. package/src/admin/routes.ts +1 -1
  42. package/src/agent-tools/tool-resolver.ts +1 -1
  43. package/src/agent-tools/tools/agenticmail.ts +2 -2
  44. package/src/agent-tools/tools/browser.ts +1 -1
  45. package/src/agent-tools/tools/enterprise-code-sandbox.ts +1 -1
  46. package/src/agent-tools/tools/enterprise-diff.ts +1 -1
  47. package/src/agent-tools/tools/enterprise-http.ts +1 -3
  48. package/src/agent-tools/tools/enterprise-security-scan.ts +1 -1
  49. package/src/agent-tools/tools/google/forms.ts +2 -2
  50. package/src/agent-tools/tools/google/gmail.ts +1 -1
  51. package/src/agent-tools/tools/google/maps.ts +2 -2
  52. package/src/agent-tools/tools/google/meeting-voice.ts +1 -1
  53. package/src/agent-tools/tools/google/meetings.ts +1 -1
  54. package/src/agent-tools/tools/google/slides.ts +2 -2
  55. package/src/agent-tools/tools/grep.ts +1 -1
  56. package/src/agent-tools/tools/knowledge-search.ts +1 -1
  57. package/src/agent-tools/tools/local/coding.ts +5 -5
  58. package/src/agent-tools/tools/microsoft/excel-vba.ts +1 -1
  59. package/src/agent-tools/tools/microsoft/excel.ts +1 -1
  60. package/src/agent-tools/tools/microsoft/powerpoint.ts +1 -1
  61. package/src/agent-tools/tools/visual-memory/index.ts +11 -11
  62. package/src/agent-tools/tools/visual-memory/similarity.ts +2 -2
  63. package/src/agent-tools/tools/visual-memory/storage.ts +1 -1
  64. package/src/agenticmail/providers/imap.ts +2 -2
  65. package/src/browser/enterprise-compat.ts +1 -1
  66. package/src/cli-agent.ts +3 -3
  67. package/src/cli-serve.ts +1 -1
  68. package/src/dashboard/pages/cluster.js +1 -1
  69. package/src/database-access/connection-manager.ts +6 -6
  70. package/src/database-access/routes.ts +0 -1
  71. package/src/db/dynamodb.ts +1 -1
  72. package/src/db/postgres.ts +2 -2
  73. package/src/deploy/fly.ts +4 -4
  74. package/src/deploy/managed.ts +0 -1
  75. package/src/engine/agent-config.ts +1 -1
  76. package/src/engine/agent-heartbeat.ts +1 -1
  77. package/src/engine/agent-hierarchy.ts +1 -1
  78. package/src/engine/agent-memory.ts +1 -1
  79. package/src/engine/agent-routes.ts +2 -2
  80. package/src/engine/chat-poller.ts +1 -1
  81. package/src/engine/community-registry.ts +2 -2
  82. package/src/engine/db-adapter.ts +0 -1
  83. package/src/engine/deployer.ts +8 -8
  84. package/src/engine/email-poller.ts +1 -1
  85. package/src/engine/knowledge-contribution.ts +1 -1
  86. package/src/engine/knowledge-import/import-manager.ts +2 -3
  87. package/src/engine/knowledge-import/processors/extract-github.ts +1 -1
  88. package/src/engine/knowledge-import/processors/extract-sharepoint.ts +1 -1
  89. package/src/engine/knowledge-import/processors/validate.ts +1 -1
  90. package/src/engine/lifecycle.ts +1 -1
  91. package/src/engine/meeting-monitor.ts +2 -2
  92. package/src/engine/meeting-voice-intelligence.ts +3 -3
  93. package/src/engine/messaging-poller.ts +2 -2
  94. package/src/engine/org-integration-routes.ts +2 -2
  95. package/src/engine/org-integrations.ts +1 -1
  96. package/src/engine/routes.ts +2 -2
  97. package/src/engine/skills.ts +1 -1
  98. package/src/engine/tool-catalog.ts +1 -1
  99. package/src/engine/vault-routes.ts +1 -1
  100. package/src/engine/vault.ts +1 -1
  101. package/src/mcp/adapters/adp.adapter.ts +1 -1
  102. package/src/mcp/adapters/auth0.adapter.ts +1 -1
  103. package/src/mcp/adapters/clickup.adapter.ts +1 -1
  104. package/src/mcp/adapters/close.adapter.ts +1 -1
  105. package/src/mcp/adapters/firebase.adapter.ts +1 -1
  106. package/src/mcp/adapters/google-ads.adapter.ts +1 -1
  107. package/src/mcp/adapters/kubernetes.adapter.ts +1 -1
  108. package/src/mcp/adapters/mixpanel.adapter.ts +1 -1
  109. package/src/mcp/adapters/recurly.adapter.ts +1 -1
  110. package/src/mcp/adapters/sap.adapter.ts +2 -2
  111. package/src/mcp/adapters/shortcut.adapter.ts +1 -1
  112. package/src/mcp/adapters/snowflake.adapter.ts +1 -1
  113. package/src/mcp/adapters/stripe.adapter.ts +1 -1
  114. package/src/mcp/adapters/supabase.adapter.ts +1 -1
  115. package/src/mcp/adapters/zuora.adapter.ts +1 -1
  116. package/src/middleware/request-limits.ts +1 -1
  117. package/src/runtime/agent-loop.ts +3 -3
  118. package/src/runtime/compaction.ts +2 -2
  119. package/src/runtime/followup.ts +1 -1
  120. package/src/runtime/hooks.ts +3 -3
  121. package/src/runtime/index.ts +5 -6
  122. package/src/runtime/llm-client.ts +1 -1
  123. package/src/runtime/subagent.ts +0 -1
  124. package/src/runtime/types.ts +2 -0
  125. package/src/security/brute-force.ts +1 -1
  126. package/src/security/csp.ts +1 -1
  127. package/src/security/index.ts +3 -3
  128. package/src/security/input-sanitizer.ts +1 -1
  129. package/src/security/threat-logger.ts +2 -2
  130. package/src/server.ts +2 -2
  131. package/src/setup/database.ts +1 -1
  132. package/src/setup/index.ts +1 -2
  133. package/src/setup/provision.ts +1 -1
  134. package/dist/_seed-data-FQR5PY2W.js +0 -4554
  135. package/dist/agent-heartbeat-3FWNHZFX.js +0 -510
  136. package/dist/agent-heartbeat-4RWHZR7H.js +0 -510
  137. package/dist/agent-heartbeat-6ZGB5ILY.js +0 -510
  138. package/dist/agent-heartbeat-BBINFNL4.js +0 -510
  139. package/dist/agent-heartbeat-BIVHLKFM.js +0 -510
  140. package/dist/agent-heartbeat-HGVIAHS5.js +0 -510
  141. package/dist/agent-heartbeat-HRKVFK2T.js +0 -510
  142. package/dist/agent-heartbeat-JC5GWVXD.js +0 -510
  143. package/dist/agent-heartbeat-K6A4HMHB.js +0 -510
  144. package/dist/agent-heartbeat-LCDXWFVB.js +0 -510
  145. package/dist/agent-heartbeat-P7HZCZAQ.js +0 -510
  146. package/dist/agent-heartbeat-PUIRSNIO.js +0 -510
  147. package/dist/agent-heartbeat-SN5ILQ6Y.js +0 -510
  148. package/dist/agent-heartbeat-TW5YTDYC.js +0 -510
  149. package/dist/agent-heartbeat-UF2RKKS2.js +0 -510
  150. package/dist/agent-heartbeat-YCSWP54H.js +0 -510
  151. package/dist/agent-heartbeat-Z2QQXROL.js +0 -510
  152. package/dist/agent-tools-3W7XLUYA.js +0 -13949
  153. package/dist/agent-tools-54VZGT6L.js +0 -9
  154. package/dist/agent-tools-AYYDPO27.js +0 -13949
  155. package/dist/agent-tools-F2X47FKF.js +0 -13949
  156. package/dist/agent-tools-O6W3QAZL.js +0 -13949
  157. package/dist/agent-tools-OAWVZBMW.js +0 -9
  158. package/dist/agent-tools-QCCU74PN.js +0 -13949
  159. package/dist/agent-tools-QGE26U6R.js +0 -9
  160. package/dist/chunk-2LHUARN6.js +0 -4929
  161. package/dist/chunk-2WVCNCYC.js +0 -5087
  162. package/dist/chunk-3FM6YQUK.js +0 -5087
  163. package/dist/chunk-46GOWZT4.js +0 -5087
  164. package/dist/chunk-4DBWU3P5.js +0 -4929
  165. package/dist/chunk-5KYJAUZV.js +0 -1519
  166. package/dist/chunk-6ZMLNEHB.js +0 -1519
  167. package/dist/chunk-7UCKD25B.js +0 -551
  168. package/dist/chunk-BDCFOP7O.js +0 -537
  169. package/dist/chunk-BPZQT5N5.js +0 -25652
  170. package/dist/chunk-C52OQNNY.js +0 -5087
  171. package/dist/chunk-C7HGQF4Y.js +0 -25652
  172. package/dist/chunk-CAHNZGGK.js +0 -25656
  173. package/dist/chunk-CK7R6UHE.js +0 -4945
  174. package/dist/chunk-CQYLRIQ3.js +0 -25938
  175. package/dist/chunk-D36RPWB7.js +0 -25652
  176. package/dist/chunk-DJK2UPFH.js +0 -4891
  177. package/dist/chunk-DM7FTF7W.js +0 -4929
  178. package/dist/chunk-DXZGPUAF.js +0 -5087
  179. package/dist/chunk-F46WB5IL.js +0 -5087
  180. package/dist/chunk-F5QG5SQH.js +0 -5087
  181. package/dist/chunk-GYB2WHMN.js +0 -5101
  182. package/dist/chunk-H7GP733U.js +0 -5087
  183. package/dist/chunk-HHBXWB5U.js +0 -25640
  184. package/dist/chunk-HS5YWSGM.js +0 -3206
  185. package/dist/chunk-IMXS4N6W.js +0 -1519
  186. package/dist/chunk-JTV5LA47.js +0 -1519
  187. package/dist/chunk-KN3T3CTD.js +0 -4929
  188. package/dist/chunk-KV6G7NZX.js +0 -1519
  189. package/dist/chunk-M6ZIC5H3.js +0 -1370
  190. package/dist/chunk-MU5MEBIK.js +0 -1519
  191. package/dist/chunk-NLT5MC7X.js +0 -465
  192. package/dist/chunk-NVLYIM4J.js +0 -4945
  193. package/dist/chunk-NZY2BIZH.js +0 -4891
  194. package/dist/chunk-O42L6G67.js +0 -1519
  195. package/dist/chunk-OCNERGGM.js +0 -4891
  196. package/dist/chunk-OJSNHONE.js +0 -1519
  197. package/dist/chunk-OWTLNV4Q.js +0 -25623
  198. package/dist/chunk-PCNYEP6T.js +0 -4891
  199. package/dist/chunk-PI4AQ4Z6.js +0 -25652
  200. package/dist/chunk-PN3EGTCA.js +0 -194
  201. package/dist/chunk-PWWV2U5P.js +0 -195
  202. package/dist/chunk-Q37UKNRC.js +0 -1519
  203. package/dist/chunk-QXTC6J7H.js +0 -5087
  204. package/dist/chunk-RF2LGX3E.js +0 -1519
  205. package/dist/chunk-RH7KPWRQ.js +0 -465
  206. package/dist/chunk-RKERL5LZ.js +0 -4925
  207. package/dist/chunk-RVBK2IOX.js +0 -25652
  208. package/dist/chunk-SAKODCZ5.js +0 -4891
  209. package/dist/chunk-SALGFC5L.js +0 -4945
  210. package/dist/chunk-STGWZ2MS.js +0 -1519
  211. package/dist/chunk-SVSLIQYN.js +0 -1519
  212. package/dist/chunk-UY3ZVQDP.js +0 -25652
  213. package/dist/chunk-V6OSD62M.js +0 -5087
  214. package/dist/chunk-VP6YAHX4.js +0 -1519
  215. package/dist/chunk-WD72IOF2.js +0 -5101
  216. package/dist/chunk-WDYJOEAI.js +0 -5087
  217. package/dist/chunk-WEAFQNOS.js +0 -195
  218. package/dist/chunk-XKUSAZGP.js +0 -5087
  219. package/dist/chunk-YCWOCIPH.js +0 -5101
  220. package/dist/chunk-ZGE3XAXY.js +0 -1519
  221. package/dist/chunk-ZGFDTW4H.js +0 -1519
  222. package/dist/cli-agent-33GWIF2D.js +0 -2300
  223. package/dist/cli-agent-4XK6LVQQ.js +0 -2357
  224. package/dist/cli-agent-64EOV3ST.js +0 -2300
  225. package/dist/cli-agent-67WP6KKO.js +0 -2300
  226. package/dist/cli-agent-7RW5Y7C4.js +0 -2294
  227. package/dist/cli-agent-7TB2BWS6.js +0 -2370
  228. package/dist/cli-agent-AKXFFST2.js +0 -2370
  229. package/dist/cli-agent-C3YSECO4.js +0 -2344
  230. package/dist/cli-agent-DZTKLITB.js +0 -2357
  231. package/dist/cli-agent-FNMDJN7T.js +0 -2357
  232. package/dist/cli-agent-FOF7PFEP.js +0 -2357
  233. package/dist/cli-agent-FXZ6DJKP.js +0 -2357
  234. package/dist/cli-agent-H74M2ZYN.js +0 -2357
  235. package/dist/cli-agent-HG4Y657I.js +0 -2300
  236. package/dist/cli-agent-HORWVPHB.js +0 -2370
  237. package/dist/cli-agent-HSZT6SKF.js +0 -2423
  238. package/dist/cli-agent-ION2W5JF.js +0 -2441
  239. package/dist/cli-agent-JLUQ4ZU6.js +0 -2424
  240. package/dist/cli-agent-KBPWY3CB.js +0 -2302
  241. package/dist/cli-agent-MVCDH4HV.js +0 -2370
  242. package/dist/cli-agent-NZXOEPJ2.js +0 -2357
  243. package/dist/cli-agent-OO6H57UQ.js +0 -2300
  244. package/dist/cli-agent-PADN3QRC.js +0 -2357
  245. package/dist/cli-agent-QAYEX3BE.js +0 -2441
  246. package/dist/cli-agent-QT64DT5J.js +0 -2370
  247. package/dist/cli-agent-TCTRKCHN.js +0 -2300
  248. package/dist/cli-agent-TFL2M6UK.js +0 -2424
  249. package/dist/cli-agent-TSOJG7EX.js +0 -2357
  250. package/dist/cli-agent-UIKXATTD.js +0 -2357
  251. package/dist/cli-agent-UJN6FYTO.js +0 -2370
  252. package/dist/cli-agent-USMKX7WN.js +0 -2473
  253. package/dist/cli-agent-VIQAYVY4.js +0 -2357
  254. package/dist/cli-agent-WNWFVOFM.js +0 -2370
  255. package/dist/cli-agent-XBQX67VJ.js +0 -2423
  256. package/dist/cli-agent-ZLSC6FF4.js +0 -2357
  257. package/dist/cli-agent-ZSHUPBBN.js +0 -2357
  258. package/dist/cli-recover-T32NABFA.js +0 -487
  259. package/dist/cli-serve-2IL5DTEY.js +0 -153
  260. package/dist/cli-serve-3NGBX5ER.js +0 -140
  261. package/dist/cli-serve-47N5UKKW.js +0 -153
  262. package/dist/cli-serve-4RS4UDHC.js +0 -140
  263. package/dist/cli-serve-4XGZFUV2.js +0 -140
  264. package/dist/cli-serve-53FVANQK.js +0 -260
  265. package/dist/cli-serve-57225XWV.js +0 -140
  266. package/dist/cli-serve-63BDPSOP.js +0 -140
  267. package/dist/cli-serve-657NRUOX.js +0 -140
  268. package/dist/cli-serve-6ER7QMLR.js +0 -140
  269. package/dist/cli-serve-6OT3UEAN.js +0 -140
  270. package/dist/cli-serve-7JQ4FVUQ.js +0 -260
  271. package/dist/cli-serve-7L6EY5UH.js +0 -153
  272. package/dist/cli-serve-BFNIW2LF.js +0 -153
  273. package/dist/cli-serve-C7MN6U5Q.js +0 -153
  274. package/dist/cli-serve-CQFI3LMK.js +0 -140
  275. package/dist/cli-serve-CR3OY3IM.js +0 -153
  276. package/dist/cli-serve-DAJFRWQ7.js +0 -153
  277. package/dist/cli-serve-DTQLN5UI.js +0 -140
  278. package/dist/cli-serve-EQS2SGT3.js +0 -140
  279. package/dist/cli-serve-FW6FHFW4.js +0 -153
  280. package/dist/cli-serve-GEEOQS77.js +0 -153
  281. package/dist/cli-serve-H562I3ZK.js +0 -153
  282. package/dist/cli-serve-HDQZF4C4.js +0 -153
  283. package/dist/cli-serve-KBJNXWYJ.js +0 -140
  284. package/dist/cli-serve-LICAOMEB.js +0 -140
  285. package/dist/cli-serve-LLGYLWFS.js +0 -153
  286. package/dist/cli-serve-LMZKQ5GX.js +0 -140
  287. package/dist/cli-serve-LNTT73P2.js +0 -140
  288. package/dist/cli-serve-MLR4KAE2.js +0 -260
  289. package/dist/cli-serve-MQKBUZ7X.js +0 -140
  290. package/dist/cli-serve-N3OISDNB.js +0 -153
  291. package/dist/cli-serve-NBFT7B42.js +0 -140
  292. package/dist/cli-serve-RTWO3AWY.js +0 -140
  293. package/dist/cli-serve-SIHTSW5P.js +0 -140
  294. package/dist/cli-serve-SP6TEURE.js +0 -140
  295. package/dist/cli-serve-TDKZA6I5.js +0 -140
  296. package/dist/cli-serve-TF5ZVVXF.js +0 -140
  297. package/dist/cli-serve-TIZ27EVR.js +0 -153
  298. package/dist/cli-serve-TUNI2RCN.js +0 -153
  299. package/dist/cli-serve-WCU66CHX.js +0 -140
  300. package/dist/cli-serve-WNOZMAWD.js +0 -153
  301. package/dist/cli-serve-YCCKRRUY.js +0 -140
  302. package/dist/cli-serve-ZD5V7I6G.js +0 -140
  303. package/dist/cli-validate-6XDDLVVQ.js +0 -150
  304. package/dist/cli-verify-I4WGRQNT.js +0 -149
  305. package/dist/connection-manager-4ZA4XAFA.js +0 -9
  306. package/dist/db-adapter-IK2EDK2N.js +0 -7
  307. package/dist/db-adapter-IRHOUMVC.js +0 -7
  308. package/dist/dependency-manager-G6D2XXNY.js +0 -11
  309. package/dist/dependency-manager-OCUKF72T.js +0 -543
  310. package/dist/dependency-manager-YULUXN34.js +0 -511
  311. package/dist/factory-MQASIPEB.js +0 -11
  312. package/dist/google-W5AYGNUJ.js +0 -33
  313. package/dist/integrations-VWANOHQ4.js +0 -43830
  314. package/dist/local-O2FN57UN.js +0 -1128
  315. package/dist/local-S7SDOQHN.js +0 -1128
  316. package/dist/microsoft-HPLA5ZL5.js +0 -2414
  317. package/dist/microsoft-UFLZBEAC.js +0 -1619
  318. package/dist/microsoft-VREAZ7M2.js +0 -3955
  319. package/dist/microsoft-YUT6EIGP.js +0 -3400
  320. package/dist/postgres-BOTHOPDW.js +0 -875
  321. package/dist/routes-3MMLQTB6.js +0 -90
  322. package/dist/routes-4ZUIJ4HE.js +0 -90
  323. package/dist/routes-5MXHKKH4.js +0 -90
  324. package/dist/routes-64NJFK3B.js +0 -90
  325. package/dist/routes-6AKQ2LBV.js +0 -90
  326. package/dist/routes-CRRBUDO4.js +0 -90
  327. package/dist/routes-D7SMYOLT.js +0 -90
  328. package/dist/routes-DIAF3MC3.js +0 -90
  329. package/dist/routes-IGR6PZCA.js +0 -92
  330. package/dist/routes-KMUNU6CY.js +0 -90
  331. package/dist/routes-LRRLXIZR.js +0 -90
  332. package/dist/routes-N647AJYG.js +0 -90
  333. package/dist/routes-SSSELAAR.js +0 -90
  334. package/dist/routes-STERVGKJ.js +0 -90
  335. package/dist/routes-TZMPYLHJ.js +0 -90
  336. package/dist/routes-XNK2MAVO.js +0 -90
  337. package/dist/routes-ZEZZACZP.js +0 -90
  338. package/dist/runtime-4UVCTFNQ.js +0 -45
  339. package/dist/runtime-5EQN4GFM.js +0 -45
  340. package/dist/runtime-5LP7PUD4.js +0 -45
  341. package/dist/runtime-6YEENDN3.js +0 -45
  342. package/dist/runtime-7LQFRG3B.js +0 -45
  343. package/dist/runtime-AMXJU2MB.js +0 -45
  344. package/dist/runtime-D6WSE7FG.js +0 -45
  345. package/dist/runtime-EAWOE6JZ.js +0 -45
  346. package/dist/runtime-EYVN7NFJ.js +0 -45
  347. package/dist/runtime-F6RPWQVW.js +0 -45
  348. package/dist/runtime-FYMJURFC.js +0 -45
  349. package/dist/runtime-GGF4P55M.js +0 -45
  350. package/dist/runtime-H3SAMWWF.js +0 -45
  351. package/dist/runtime-H7T4I7I7.js +0 -45
  352. package/dist/runtime-HTIM7GZR.js +0 -45
  353. package/dist/runtime-JRNBL4O4.js +0 -45
  354. package/dist/runtime-K4C7NQLW.js +0 -45
  355. package/dist/runtime-MWWZCPC2.js +0 -45
  356. package/dist/runtime-N7CM2DYA.js +0 -45
  357. package/dist/runtime-OM2NIBMI.js +0 -45
  358. package/dist/runtime-OVGSOTAH.js +0 -45
  359. package/dist/runtime-QQ6LAY4U.js +0 -45
  360. package/dist/runtime-QWPVD7CY.js +0 -45
  361. package/dist/runtime-SX3B5MG3.js +0 -45
  362. package/dist/runtime-YLIIPTE4.js +0 -45
  363. package/dist/runtime-YU6P22CG.js +0 -45
  364. package/dist/runtime-ZOC337DD.js +0 -45
  365. package/dist/server-3AVWBRIF.js +0 -28
  366. package/dist/server-5BKJI5OW.js +0 -28
  367. package/dist/server-6NDO2S52.js +0 -28
  368. package/dist/server-7TD3M2BW.js +0 -28
  369. package/dist/server-AMCSXINC.js +0 -28
  370. package/dist/server-B3VJ6MSA.js +0 -28
  371. package/dist/server-BEJ6RAGL.js +0 -28
  372. package/dist/server-BFPYDHBG.js +0 -28
  373. package/dist/server-BKEWXGVX.js +0 -28
  374. package/dist/server-BMEJZGFG.js +0 -28
  375. package/dist/server-CU6LVQS4.js +0 -28
  376. package/dist/server-DFR7FI3Q.js +0 -28
  377. package/dist/server-DFYGH2CV.js +0 -28
  378. package/dist/server-DURRN3GJ.js +0 -28
  379. package/dist/server-EELWOC3X.js +0 -28
  380. package/dist/server-EN5E2OWQ.js +0 -28
  381. package/dist/server-EXZC3OJO.js +0 -28
  382. package/dist/server-GW2HYJYI.js +0 -28
  383. package/dist/server-J25NCRWJ.js +0 -28
  384. package/dist/server-JDGNOTFV.js +0 -28
  385. package/dist/server-KA6U3YNP.js +0 -28
  386. package/dist/server-L52A2ME4.js +0 -28
  387. package/dist/server-NE5HD5DJ.js +0 -28
  388. package/dist/server-NLQAXPOG.js +0 -28
  389. package/dist/server-NQOT7W77.js +0 -28
  390. package/dist/server-OHHAA34U.js +0 -28
  391. package/dist/server-PWE5PQTR.js +0 -28
  392. package/dist/server-Q2Q32H2B.js +0 -28
  393. package/dist/server-Q77ME7TL.js +0 -28
  394. package/dist/server-QDKO6OVO.js +0 -28
  395. package/dist/server-RR6QJIXM.js +0 -28
  396. package/dist/server-T3R6BO6A.js +0 -28
  397. package/dist/server-TRIBAHDV.js +0 -28
  398. package/dist/server-TXV3ZVVR.js +0 -28
  399. package/dist/server-VHSFJP3I.js +0 -28
  400. package/dist/server-VOJF2XGU.js +0 -28
  401. package/dist/server-W76YHPEC.js +0 -28
  402. package/dist/server-WLLH4WST.js +0 -28
  403. package/dist/server-WTUJ2O3F.js +0 -28
  404. package/dist/server-X4CJTHHF.js +0 -28
  405. package/dist/server-XK3ILCJC.js +0 -28
  406. package/dist/server-ZRD3NDJE.js +0 -28
  407. package/dist/setup-2JYXGTW6.js +0 -20
  408. package/dist/setup-3XOSZEW5.js +0 -20
  409. package/dist/setup-44VBAO4J.js +0 -20
  410. package/dist/setup-4OA7QNJW.js +0 -20
  411. package/dist/setup-4ONNQBWB.js +0 -20
  412. package/dist/setup-4OSBXSCL.js +0 -20
  413. package/dist/setup-4QFGRBLZ.js +0 -20
  414. package/dist/setup-52US54Z4.js +0 -20
  415. package/dist/setup-5CY3CKKT.js +0 -20
  416. package/dist/setup-5YRQUOW2.js +0 -20
  417. package/dist/setup-6766SGAR.js +0 -20
  418. package/dist/setup-6NUSB4XO.js +0 -20
  419. package/dist/setup-7FZJEOD4.js +0 -20
  420. package/dist/setup-7LYYXBUL.js +0 -20
  421. package/dist/setup-ADSKKBGV.js +0 -20
  422. package/dist/setup-AMV2WKVH.js +0 -20
  423. package/dist/setup-AYY24DKM.js +0 -20
  424. package/dist/setup-B34N4HPU.js +0 -20
  425. package/dist/setup-CEF4QY4L.js +0 -20
  426. package/dist/setup-E2YLC2EY.js +0 -20
  427. package/dist/setup-ER6NXTY5.js +0 -20
  428. package/dist/setup-FIOAQJ6C.js +0 -20
  429. package/dist/setup-G76S7X44.js +0 -20
  430. package/dist/setup-H2AGCBW5.js +0 -20
  431. package/dist/setup-H4JZUHH5.js +0 -20
  432. package/dist/setup-ICOZRKCX.js +0 -20
  433. package/dist/setup-JFTJH7UF.js +0 -20
  434. package/dist/setup-JJHOT2ZU.js +0 -20
  435. package/dist/setup-KEAM2BCL.js +0 -20
  436. package/dist/setup-LW4MLU2N.js +0 -20
  437. package/dist/setup-NHAZABW4.js +0 -20
  438. package/dist/setup-PRFNI6YW.js +0 -20
  439. package/dist/setup-RAHBMYHE.js +0 -20
  440. package/dist/setup-T6KYFR7O.js +0 -20
  441. package/dist/setup-TGM6L362.js +0 -20
  442. package/dist/setup-TNANAH7C.js +0 -20
  443. package/dist/setup-TXPR5UQX.js +0 -20
  444. package/dist/setup-UJSNSCLM.js +0 -20
  445. package/dist/setup-XCJMELVU.js +0 -20
  446. package/dist/setup-XIYEIFVK.js +0 -20
  447. package/dist/setup-XP2VGBEU.js +0 -20
  448. package/dist/setup-Z4PZSHBI.js +0 -20
  449. package/dist/skills-HCVBA6PK.js +0 -16
  450. package/dist/skills-HFSW74KZ.js +0 -16
  451. package/dist/system-prompts-6OUTAMH6.js +0 -41
  452. package/dist/task-queue-YP2I54IA.js +0 -9
  453. package/dist/transport-encryption-F2NQYACT.js +0 -25
  454. package/god_is_great.html +0 -35
  455. package/seed-data.mjs +0 -455
  456. package/src/agent-tools/tools/integrations/_seed-data.json +0 -4548
  457. package/src/agent-tools/tools/integrations/_seed-data.ts +0 -4563
@@ -1,510 +0,0 @@
1
- import "./chunk-KFQGP6VL.js";
2
-
3
- // src/engine/agent-heartbeat.ts
4
- var DEFAULT_SETTINGS = {
5
- enabled: true,
6
- baseIntervalMs: 5 * 6e4,
7
- // 5 minutes
8
- maxIntervalMs: 30 * 6e4,
9
- // 30 minutes
10
- dampingFactor: 0.5,
11
- maxBatchSize: 5,
12
- quietHoursStart: 23,
13
- quietHoursEnd: 8
14
- };
15
- function createUnreadEmailCheck() {
16
- return {
17
- id: "unread_emails",
18
- name: "Unread Emails",
19
- intervalMs: 10 * 6e4,
20
- // 10 minutes
21
- priority: "high",
22
- requiresClockIn: false,
23
- // emails can be urgent outside hours
24
- consecutiveNoOps: 0,
25
- enabled: true,
26
- check: async (ctx) => {
27
- try {
28
- const rows = await ctx.db.query(
29
- `SELECT COUNT(*) as cnt FROM agent_memory
30
- WHERE agent_id = $1
31
- AND category = 'processed_email'
32
- AND created_at > NOW() - INTERVAL '4 hours'`,
33
- [ctx.agentId]
34
- );
35
- const processedRecently = parseInt(rows?.[0]?.cnt || "0");
36
- const lastProcessed = await ctx.db.query(
37
- `SELECT MAX(created_at) as last_at FROM agent_memory
38
- WHERE agent_id = $1 AND category = 'processed_email'`,
39
- [ctx.agentId]
40
- );
41
- const lastAt = lastProcessed?.[0]?.last_at;
42
- if (ctx.isWorkHours && processedRecently === 0 && ctx.hour >= 10) {
43
- return {
44
- needsAction: true,
45
- summary: "No emails processed in the last 4 hours during work hours. Check inbox.",
46
- priority: "medium",
47
- data: { lastProcessedAt: lastAt }
48
- };
49
- }
50
- return { needsAction: false, priority: "low" };
51
- } catch {
52
- return { needsAction: false, priority: "low" };
53
- }
54
- }
55
- };
56
- }
57
- function createUpcomingEventsCheck() {
58
- return {
59
- id: "upcoming_events",
60
- name: "Upcoming Calendar Events",
61
- intervalMs: 15 * 6e4,
62
- // 15 minutes
63
- priority: "high",
64
- requiresClockIn: false,
65
- consecutiveNoOps: 0,
66
- enabled: true,
67
- check: async (ctx) => {
68
- try {
69
- const twoHoursFromNow = new Date(ctx.now.getTime() + 2 * 60 * 60 * 1e3).toISOString();
70
- const rows = await ctx.db.query(
71
- `SELECT content FROM agent_memory
72
- WHERE agent_id = $1
73
- AND category = 'context'
74
- AND content LIKE '%meeting%'
75
- AND created_at > NOW() - INTERVAL '24 hours'
76
- ORDER BY created_at DESC LIMIT 5`,
77
- [ctx.agentId]
78
- );
79
- const upcomingMeetings = (rows || []).filter((r) => {
80
- const content = r.content || "";
81
- return content.includes("meeting") || content.includes("event");
82
- });
83
- if (upcomingMeetings.length > 0) {
84
- return {
85
- needsAction: true,
86
- summary: `${upcomingMeetings.length} potential upcoming event(s). Agent should check Google Calendar.`,
87
- priority: "high",
88
- data: { count: upcomingMeetings.length }
89
- };
90
- }
91
- return { needsAction: false, priority: "low" };
92
- } catch {
93
- return { needsAction: false, priority: "low" };
94
- }
95
- }
96
- };
97
- }
98
- function createStaleSessionsCheck() {
99
- return {
100
- id: "stale_sessions",
101
- name: "Stale Sessions",
102
- intervalMs: 30 * 6e4,
103
- // 30 minutes
104
- priority: "medium",
105
- requiresClockIn: true,
106
- consecutiveNoOps: 0,
107
- enabled: true,
108
- check: async (ctx) => {
109
- try {
110
- const rows = await ctx.db.query(
111
- `SELECT COUNT(*) as cnt FROM agent_sessions
112
- WHERE agent_id = $1
113
- AND status = 'active'
114
- AND updated_at < NOW() - INTERVAL '2 hours'`,
115
- [ctx.agentId]
116
- );
117
- const staleCount = parseInt(rows?.[0]?.cnt || "0");
118
- if (staleCount > 0) {
119
- return {
120
- needsAction: true,
121
- summary: `${staleCount} stale session(s) detected (active > 2 hours with no updates). May need cleanup.`,
122
- priority: "medium",
123
- data: { staleCount }
124
- };
125
- }
126
- return { needsAction: false, priority: "low" };
127
- } catch {
128
- return { needsAction: false, priority: "low" };
129
- }
130
- }
131
- };
132
- }
133
- function createMemoryHealthCheck() {
134
- return {
135
- id: "memory_health",
136
- name: "Memory Health",
137
- intervalMs: 60 * 6e4,
138
- // 1 hour
139
- priority: "low",
140
- requiresClockIn: true,
141
- consecutiveNoOps: 0,
142
- enabled: true,
143
- check: async (ctx) => {
144
- try {
145
- const rows = await ctx.db.query(
146
- `SELECT COUNT(*) as cnt FROM agent_memory
147
- WHERE agent_id = $1 AND created_at > NOW() - INTERVAL '24 hours'`,
148
- [ctx.agentId]
149
- );
150
- const recentCount = parseInt(rows?.[0]?.cnt || "0");
151
- if (recentCount > 200) {
152
- return {
153
- needsAction: true,
154
- summary: `Memory flood detected: ${recentCount} memories in 24h (threshold: 200). Consider pruning.`,
155
- priority: "medium",
156
- data: { recentCount }
157
- };
158
- }
159
- return { needsAction: false, priority: "low" };
160
- } catch {
161
- return { needsAction: false, priority: "low" };
162
- }
163
- }
164
- };
165
- }
166
- function createUnansweredChatCheck() {
167
- return {
168
- id: "unanswered_chat",
169
- name: "Unanswered Chat Messages",
170
- intervalMs: 5 * 6e4,
171
- // 5 minutes
172
- priority: "high",
173
- requiresClockIn: false,
174
- consecutiveNoOps: 0,
175
- enabled: true,
176
- check: async (ctx) => {
177
- try {
178
- const rows = await ctx.db.query(
179
- `SELECT COUNT(*) as cnt FROM agent_sessions
180
- WHERE agent_id = $1
181
- AND status = 'failed'
182
- AND metadata::text LIKE '%chat%'
183
- AND created_at > NOW() - INTERVAL '1 hour'`,
184
- [ctx.agentId]
185
- );
186
- const failedChats = parseInt(rows?.[0]?.cnt || "0");
187
- if (failedChats > 0) {
188
- return {
189
- needsAction: true,
190
- summary: `${failedChats} failed chat session(s) in the last hour. Messages may be unanswered.`,
191
- priority: "urgent",
192
- data: { failedChats }
193
- };
194
- }
195
- return { needsAction: false, priority: "low" };
196
- } catch {
197
- return { needsAction: false, priority: "low" };
198
- }
199
- }
200
- };
201
- }
202
- function createTaskDeadlineCheck() {
203
- return {
204
- id: "task_deadlines",
205
- name: "Task Deadlines",
206
- intervalMs: 60 * 6e4,
207
- // 1 hour
208
- priority: "medium",
209
- requiresClockIn: true,
210
- consecutiveNoOps: 0,
211
- enabled: true,
212
- check: async (ctx) => {
213
- try {
214
- const rows = await ctx.db.query(
215
- `SELECT COUNT(*) as cnt FROM agent_memory
216
- WHERE agent_id = $1
217
- AND category = 'context'
218
- AND importance = 'high'
219
- AND content LIKE '%deadline%'
220
- AND created_at > NOW() - INTERVAL '48 hours'`,
221
- [ctx.agentId]
222
- );
223
- const urgentTasks = parseInt(rows?.[0]?.cnt || "0");
224
- if (urgentTasks > 0) {
225
- return {
226
- needsAction: true,
227
- summary: `${urgentTasks} task(s) with approaching deadlines. Agent should review and prioritize.`,
228
- priority: "high",
229
- data: { urgentTasks }
230
- };
231
- }
232
- return { needsAction: false, priority: "low" };
233
- } catch {
234
- return { needsAction: false, priority: "low" };
235
- }
236
- }
237
- };
238
- }
239
- function createErrorRateCheck() {
240
- return {
241
- id: "error_rate",
242
- name: "Error Rate Monitor",
243
- intervalMs: 15 * 6e4,
244
- // 15 minutes
245
- priority: "high",
246
- requiresClockIn: false,
247
- // errors can happen anytime
248
- consecutiveNoOps: 0,
249
- enabled: true,
250
- check: async (ctx) => {
251
- try {
252
- const totalRows = await ctx.db.query(
253
- `SELECT COUNT(*) as cnt FROM agent_sessions
254
- WHERE agent_id = $1 AND created_at > NOW() - INTERVAL '1 hour'`,
255
- [ctx.agentId]
256
- );
257
- const failedRows = await ctx.db.query(
258
- `SELECT COUNT(*) as cnt FROM agent_sessions
259
- WHERE agent_id = $1 AND status = 'failed' AND created_at > NOW() - INTERVAL '1 hour'`,
260
- [ctx.agentId]
261
- );
262
- const total = parseInt(totalRows?.[0]?.cnt || "0");
263
- const failed = parseInt(failedRows?.[0]?.cnt || "0");
264
- if (total >= 3 && failed / total > 0.5) {
265
- return {
266
- needsAction: true,
267
- summary: `High error rate: ${failed}/${total} sessions failed in the last hour (${Math.round(failed / total * 100)}%). Possible infrastructure issue.`,
268
- priority: "urgent",
269
- data: { total, failed, rate: failed / total }
270
- };
271
- }
272
- return { needsAction: false, priority: "low" };
273
- } catch {
274
- return { needsAction: false, priority: "low" };
275
- }
276
- }
277
- };
278
- }
279
- var AgentHeartbeatManager = class {
280
- config;
281
- settings;
282
- checks = /* @__PURE__ */ new Map();
283
- tickTimer = null;
284
- globalConsecutiveNoOps = 0;
285
- lastActionTimestamp = 0;
286
- stats = {
287
- totalTicks: 0,
288
- totalChecksRun: 0,
289
- totalActionsTriggered: 0,
290
- totalTokensSaved: 0,
291
- // estimated tokens NOT spent due to no-op ticks
292
- startedAt: Date.now()
293
- };
294
- constructor(config, settings) {
295
- this.config = config;
296
- this.settings = { ...DEFAULT_SETTINGS, ...settings };
297
- this.registerCheck(createUnreadEmailCheck());
298
- this.registerCheck(createUpcomingEventsCheck());
299
- this.registerCheck(createStaleSessionsCheck());
300
- this.registerCheck(createMemoryHealthCheck());
301
- this.registerCheck(createUnansweredChatCheck());
302
- this.registerCheck(createTaskDeadlineCheck());
303
- this.registerCheck(createErrorRateCheck());
304
- if (config.enabledChecks) {
305
- for (const [id, enabled] of Object.entries(config.enabledChecks)) {
306
- const check = this.checks.get(id);
307
- if (check) check.enabled = enabled;
308
- }
309
- }
310
- }
311
- registerCheck(check) {
312
- this.checks.set(check.id, check);
313
- }
314
- async start() {
315
- if (!this.settings.enabled) {
316
- console.log("[heartbeat] Disabled, skipping");
317
- return;
318
- }
319
- console.log(`[heartbeat] Starting with ${this.checks.size} checks, base interval ${this.settings.baseIntervalMs / 1e3}s`);
320
- setTimeout(() => this.tick(), 6e4);
321
- this.scheduleNextTick();
322
- }
323
- stop() {
324
- if (this.tickTimer) {
325
- clearTimeout(this.tickTimer);
326
- this.tickTimer = null;
327
- }
328
- console.log(`[heartbeat] Stopped. Stats: ${this.stats.totalTicks} ticks, ${this.stats.totalChecksRun} checks, ${this.stats.totalActionsTriggered} actions, ~${this.stats.totalTokensSaved} tokens saved`);
329
- }
330
- getStats() {
331
- return {
332
- ...this.stats,
333
- uptimeMs: Date.now() - this.stats.startedAt,
334
- currentIntervalMs: this.calculateInterval(),
335
- globalConsecutiveNoOps: this.globalConsecutiveNoOps,
336
- checks: Array.from(this.checks.values()).map((c) => ({
337
- id: c.id,
338
- name: c.name,
339
- enabled: c.enabled,
340
- lastRunAt: c.lastRunAt,
341
- lastActionAt: c.lastActionAt,
342
- consecutiveNoOps: c.consecutiveNoOps
343
- }))
344
- };
345
- }
346
- // ─── Core Tick Logic ────────────────────────────────
347
- async tick() {
348
- this.stats.totalTicks++;
349
- const now = /* @__PURE__ */ new Date();
350
- const tz = this.config.timezone || "UTC";
351
- const localTime = new Date(now.toLocaleString("en-US", { timeZone: tz }));
352
- const hour = localTime.getHours();
353
- const minute = localTime.getMinutes();
354
- const dayOfWeek = localTime.getDay();
355
- const isWorkHours = this.isWithinWorkHours(hour, minute, dayOfWeek);
356
- const isQuietHours = this.isQuietHours(hour);
357
- const isClockedIn = this.config.isClockedIn();
358
- const ctx = {
359
- agentId: this.config.agentId,
360
- orgId: this.config.orgId,
361
- agentName: this.config.agentName,
362
- role: this.config.role,
363
- managerEmail: this.config.managerEmail,
364
- timezone: tz,
365
- db: this.config.db,
366
- now,
367
- localTime,
368
- hour,
369
- minute,
370
- dayOfWeek,
371
- isWorkHours,
372
- isClockedIn
373
- };
374
- const actionableItems = [];
375
- for (const check of this.checks.values()) {
376
- if (!check.enabled) continue;
377
- if (check.requiresClockIn && !isClockedIn) continue;
378
- if (isQuietHours && check.priority !== "high") continue;
379
- const adaptiveInterval = Math.min(
380
- check.intervalMs * (1 + this.settings.dampingFactor * check.consecutiveNoOps),
381
- this.settings.maxIntervalMs
382
- );
383
- const timeSinceLastRun = now.getTime() - (check.lastRunAt || 0);
384
- if (timeSinceLastRun < adaptiveInterval) continue;
385
- this.stats.totalChecksRun++;
386
- check.lastRunAt = now.getTime();
387
- try {
388
- const result = await check.check(ctx);
389
- if (result.needsAction) {
390
- actionableItems.push({ check, result });
391
- check.consecutiveNoOps = 0;
392
- check.lastActionAt = now.getTime();
393
- } else {
394
- check.consecutiveNoOps++;
395
- this.stats.totalTokensSaved += 500;
396
- }
397
- } catch (err) {
398
- console.warn(`[heartbeat] Check ${check.id} error: ${err.message}`);
399
- check.consecutiveNoOps++;
400
- }
401
- }
402
- if (actionableItems.length > 0) {
403
- this.globalConsecutiveNoOps = 0;
404
- this.lastActionTimestamp = now.getTime();
405
- this.stats.totalActionsTriggered++;
406
- const priorityOrder = { urgent: 0, high: 1, medium: 2, low: 3 };
407
- actionableItems.sort((a, b) => priorityOrder[a.result.priority] - priorityOrder[b.result.priority]);
408
- const batch = actionableItems.slice(0, this.settings.maxBatchSize);
409
- await this.dispatchBatch(batch, ctx);
410
- } else {
411
- this.globalConsecutiveNoOps++;
412
- }
413
- this.scheduleNextTick();
414
- }
415
- /**
416
- * Calculate next tick interval using damped oscillator model:
417
- * interval = base * (1 + damping * consecutiveNoOps)
418
- *
419
- * With fibonacci-like acceleration:
420
- * After 0 no-ops: 5min (base)
421
- * After 1 no-op: 7.5min
422
- * After 2 no-ops: 10min
423
- * After 4 no-ops: 15min
424
- * After 8 no-ops: 25min
425
- * After 10 no-ops: 30min (max)
426
- *
427
- * Resets to base immediately when action is detected.
428
- */
429
- calculateInterval() {
430
- const base = this.settings.baseIntervalMs;
431
- const max = this.settings.maxIntervalMs;
432
- const damping = this.settings.dampingFactor;
433
- const noOps = this.globalConsecutiveNoOps;
434
- return Math.min(base * (1 + damping * noOps), max);
435
- }
436
- scheduleNextTick() {
437
- if (this.tickTimer) clearTimeout(this.tickTimer);
438
- const interval = this.calculateInterval();
439
- this.tickTimer = setTimeout(() => this.tick(), interval);
440
- this.tickTimer.unref();
441
- }
442
- isWithinWorkHours(hour, minute, dayOfWeek) {
443
- const schedule = this.config.schedule;
444
- if (!schedule) return true;
445
- const isWorkday = schedule.days.includes(dayOfWeek);
446
- const timeStr = `${String(hour).padStart(2, "0")}:${String(minute).padStart(2, "0")}`;
447
- const isWithinHours = timeStr >= schedule.start && timeStr < schedule.end;
448
- return isWorkday && isWithinHours;
449
- }
450
- isQuietHours(hour) {
451
- const start = this.settings.quietHoursStart;
452
- const end = this.settings.quietHoursEnd;
453
- if (start === void 0 || end === void 0) return false;
454
- if (start > end) {
455
- return hour >= start || hour < end;
456
- }
457
- return hour >= start && hour < end;
458
- }
459
- /**
460
- * Dispatch a batch of actionable items to the agent via one LLM session.
461
- * This is the ONLY place tokens are spent.
462
- */
463
- async dispatchBatch(items, ctx) {
464
- if (!this.config.runtime) {
465
- console.warn("[heartbeat] No runtime \u2014 cannot dispatch actions");
466
- return;
467
- }
468
- try {
469
- const { guardrails } = await import("./routes-5MXHKKH4.js");
470
- const status = await guardrails.getStatus(ctx.agentId);
471
- if (status.paused || status.offDuty) {
472
- console.log(`[heartbeat] Skipping action dispatch \u2014 agent is ${status.offDuty ? "off duty" : "paused"}`);
473
- return;
474
- }
475
- } catch {
476
- }
477
- const summaries = items.map(
478
- (item, i) => `${i + 1}. [${item.result.priority.toUpperCase()}] ${item.check.name}: ${item.result.summary}`
479
- ).join("\n");
480
- const prompt = `HEARTBEAT ALERT \u2014 The following ${items.length} item(s) need your attention:
481
-
482
- ${summaries}
483
-
484
- For each item, take the appropriate action:
485
- - For unread emails: Check your inbox with gmail_search and respond to any urgent ones.
486
- - For upcoming events: Check google_calendar_list for the next 2 hours and prepare.
487
- - For stale sessions: Review and close any stuck sessions.
488
- - For unanswered chats: Check Google Chat and respond.
489
- - For error rate issues: Investigate recent failures and notify your manager if critical.
490
- - For task deadlines: Review google_tasks_list and prioritize.
491
- - For memory health: Consider pruning old or low-importance memories.
492
-
493
- Be efficient \u2014 handle what you can and note what needs human intervention.
494
- If something needs your manager's attention, email ${ctx.managerEmail || "your manager"}.`;
495
- const systemPrompt = `You are ${ctx.agentName}, a ${ctx.role}. This is an automated heartbeat check \u2014 items flagged as needing attention. Handle them efficiently. Don't create unnecessary work \u2014 only act on what's genuinely important.`;
496
- try {
497
- const session = await this.config.runtime.spawnSession({
498
- agentId: ctx.agentId,
499
- message: prompt,
500
- systemPrompt
501
- });
502
- console.log(`[heartbeat] \u2705 Action session ${session.id} dispatched (${items.length} items: ${items.map((i) => i.check.id).join(", ")})`);
503
- } catch (err) {
504
- console.error(`[heartbeat] Failed to dispatch action: ${err.message}`);
505
- }
506
- }
507
- };
508
- export {
509
- AgentHeartbeatManager
510
- };