@agenticmail/enterprise 0.5.612 → 0.5.614
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/CHANGELOG.md +50 -0
- package/dist/{agent-heartbeat-PHLWJ3HO.js → agent-heartbeat-HFDBZWMO.js} +1 -1
- package/dist/{agent-tools-KRMDJOCK.js → agent-tools-5LLIXV6A.js} +17 -6
- package/dist/{chunk-NMMTMHTA.js → chunk-GC77MDKW.js} +37 -31
- package/dist/{chunk-BUKTZ35L.js → chunk-H3JXMBTG.js} +3 -6
- package/dist/{chunk-I2T4HESC.js → chunk-IXAWHXMY.js} +16 -16
- package/dist/{chunk-5EMB2S53.js → chunk-MVD2DMAY.js} +2 -2
- package/dist/{chunk-TBBVEXBH.js → chunk-QVZIW5HI.js} +14 -0
- package/dist/{chunk-REAJCMQE.js → chunk-T26AVIAQ.js} +3 -6
- package/dist/chunk-UETRFOSR.js +80 -0
- package/dist/{chunk-KQ5EU4IA.js → chunk-VWIDJRD4.js} +49 -32
- package/dist/{cli-agent-V7K6HZAG.js → cli-agent-DOLO7OCU.js} +67 -23
- package/dist/{cli-serve-T3W5RDO4.js → cli-serve-4NLB4RK2.js} +2 -2
- package/dist/cli.js +3 -3
- package/dist/{deployer-BKBISKKF.js → deployer-M4YHMATN.js} +2 -1
- package/dist/index.js +12 -11
- package/dist/meetings-SPK24WE7.js +1 -1
- package/dist/{routes-VX5CXX4J.js → routes-5PUCWC4N.js} +4 -3
- package/dist/{runtime-RMLNHLAT.js → runtime-GML2LXIN.js} +2 -1
- package/dist/{server-64K32C5T.js → server-R5SICPBI.js} +5 -4
- package/dist/{setup-7AQLYQBS.js → setup-SLLV37YT.js} +1 -1
- package/dist/{telegram-NG7PNNIN.js → telegram-W765VRI5.js} +1 -1
- package/dist/{whatsapp-RAQUV6ZL.js → whatsapp-TBOB7TDL.js} +1 -1
- package/dist/workspace-P5FCSG2D.js +19 -0
- package/package.json +1 -1
- /package/dist/{chunk-CC4BHZHO.js → chunk-GAOEALTJ.js} +0 -0
- /package/dist/{integrations-4JDIOHQU.js → integrations-UWDEQ7Z4.js} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,56 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to AgenticMail Enterprise are documented here.
|
|
4
4
|
|
|
5
|
+
## [0.5.614] - 2026-05-25
|
|
6
|
+
|
|
7
|
+
### Fixed — Telegram/WhatsApp "typing…" now stays on for the whole turn
|
|
8
|
+
|
|
9
|
+
The agent sent the chat-action ONCE on inbound, so "typing…" showed for ~5s
|
|
10
|
+
(Telegram's window) then vanished while the agent was still working — unlike
|
|
11
|
+
the open-source bridge, which refreshes it. Added a self-refreshing typing
|
|
12
|
+
indicator in the chat handler: pings every 4s and stops when the session turn
|
|
13
|
+
completes (and on error / a 15-min safety cap). Keyed per-chat so follow-up
|
|
14
|
+
messages don't stack multiple loops. Applies to both Telegram (`sendChatAction`)
|
|
15
|
+
and WhatsApp (`composing` presence).
|
|
16
|
+
|
|
17
|
+
## [0.5.613] - 2026-05-25
|
|
18
|
+
|
|
19
|
+
### Fixed — Agents now always use a PERMANENT workspace, never /tmp
|
|
20
|
+
|
|
21
|
+
Agents were saving files (e.g. email templates) under `/tmp/agents/<id>/media`,
|
|
22
|
+
which the OS wipes on reboot — work silently lost. Now every agent has one
|
|
23
|
+
canonical, permanent, cross-platform (mac/linux/windows) workspace and never
|
|
24
|
+
falls back to /tmp.
|
|
25
|
+
|
|
26
|
+
- New `src/agent-tools/workspace.ts`: `getAgentWorkspaceDir()` /
|
|
27
|
+
`ensureAgentWorkspace()` / `getAgentSubdir()`. Canonical path
|
|
28
|
+
`~/.agenticmail/workspaces/<agentId>/` (override via
|
|
29
|
+
`AGENTICMAIL_WORKSPACE_DIR`), built with `os.homedir()` + `path.join()` so it
|
|
30
|
+
works on every platform.
|
|
31
|
+
- Neat, predictable layout created on init: `media/ files/ templates/ exports/
|
|
32
|
+
projects/ data/ tmp/` (+ a `WORKSPACE.md` describing it).
|
|
33
|
+
- Removed every `/tmp/agents/...` and `os.tmpdir()` fallback in the
|
|
34
|
+
file/media paths: WhatsApp + Telegram inbound media, the messaging-poller,
|
|
35
|
+
the calendar joined-meetings state file, and WhatsApp auth/session creds
|
|
36
|
+
(now per-agent under `<workspace>/whatsapp`, was a shared dir).
|
|
37
|
+
- `createAllTools` now derives + provisions the workspace from `agentId` when a
|
|
38
|
+
caller didn't pass one, so no code path can land in /tmp. Path-sandbox allowed
|
|
39
|
+
dirs are now cross-platform (`os.tmpdir()` + `os.homedir()` instead of
|
|
40
|
+
hardcoded `/tmp`, `/var/tmp`, `/root`).
|
|
41
|
+
- On agent creation the workspace is provisioned and its location is written to
|
|
42
|
+
the agent's long-term memory; the path + layout are documented in the system
|
|
43
|
+
prompt and in generated `AGENTS.md` so the agent never forgets where to work.
|
|
44
|
+
|
|
45
|
+
## [0.5.612] - 2026-05-25
|
|
46
|
+
|
|
47
|
+
### Fixed — Packaging: stop shipping `logs/` in the npm tarball
|
|
48
|
+
|
|
49
|
+
`0.5.611` accidentally bundled the working `logs/` directory (cloudflared
|
|
50
|
+
+ agent process logs) into the published package — these contained local
|
|
51
|
+
`/Users/...` paths (no credentials). Added `logs/`, `*.log`, and
|
|
52
|
+
`test-*.mjs` to `.npmignore`. `0.5.611` is deprecated; use `0.5.612`.
|
|
53
|
+
This release is otherwise identical to `0.5.611`.
|
|
54
|
+
|
|
5
55
|
## [0.5.611] - 2026-05-20
|
|
6
56
|
|
|
7
57
|
### Fixed — Agents no longer "wake up dumb" after context compaction
|
|
@@ -515,7 +515,7 @@ var AgentHeartbeatManager = class {
|
|
|
515
515
|
return;
|
|
516
516
|
}
|
|
517
517
|
try {
|
|
518
|
-
const { guardrails } = await import("./routes-
|
|
518
|
+
const { guardrails } = await import("./routes-5PUCWC4N.js");
|
|
519
519
|
const status = await guardrails.getStatus(ctx.agentId);
|
|
520
520
|
if (status.paused || status.offDuty) {
|
|
521
521
|
console.log(`[heartbeat] Skipping action dispatch \u2014 agent is ${status.offDuty ? "off duty" : "paused"}`);
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
createBrowserTool,
|
|
3
3
|
createMeetingTools,
|
|
4
4
|
createMeetingVoiceTools
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-GAOEALTJ.js";
|
|
6
6
|
import {
|
|
7
7
|
detectCapabilities,
|
|
8
8
|
getCapabilitySummary,
|
|
@@ -12,11 +12,11 @@ import {
|
|
|
12
12
|
import {
|
|
13
13
|
createTelegramTools,
|
|
14
14
|
init_telegram
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-T26AVIAQ.js";
|
|
16
16
|
import {
|
|
17
17
|
createWhatsAppTools,
|
|
18
18
|
init_whatsapp
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-H3JXMBTG.js";
|
|
20
20
|
import {
|
|
21
21
|
MemorySearchIndex,
|
|
22
22
|
init_text_search
|
|
@@ -14581,7 +14581,16 @@ function createVisualMemoryTools(options) {
|
|
|
14581
14581
|
// src/agent-tools/index.ts
|
|
14582
14582
|
init_environment();
|
|
14583
14583
|
async function createAllTools(options) {
|
|
14584
|
-
|
|
14584
|
+
if (options && options.agentId && !options.workspaceDir) {
|
|
14585
|
+
try {
|
|
14586
|
+
var { getAgentWorkspaceDir, ensureAgentWorkspace } = await import("./workspace-P5FCSG2D.js");
|
|
14587
|
+
options.workspaceDir = getAgentWorkspaceDir(options.agentId);
|
|
14588
|
+
ensureAgentWorkspace(options.agentId);
|
|
14589
|
+
} catch {
|
|
14590
|
+
}
|
|
14591
|
+
}
|
|
14592
|
+
var _os = await import("os");
|
|
14593
|
+
var defaultAllowedDirs = [_os.tmpdir(), _os.homedir()].filter(Boolean);
|
|
14585
14594
|
var configuredDirs = options?.security?.pathSandbox?.allowedDirs || [];
|
|
14586
14595
|
var pathSandbox = options?.workspaceDir && options?.security?.pathSandbox?.enabled !== false ? createPathSandbox(options.workspaceDir, {
|
|
14587
14596
|
allowedDirs: [...defaultAllowedDirs, ...configuredDirs],
|
|
@@ -14795,7 +14804,7 @@ async function createAllTools(options) {
|
|
|
14795
14804
|
var integrationTools = [];
|
|
14796
14805
|
if (options?.vault) {
|
|
14797
14806
|
try {
|
|
14798
|
-
var { createAllIntegrationTools } = await import("./integrations-
|
|
14807
|
+
var { createAllIntegrationTools } = await import("./integrations-UWDEQ7Z4.js");
|
|
14799
14808
|
integrationTools = await createAllIntegrationTools({
|
|
14800
14809
|
vault: options.vault,
|
|
14801
14810
|
orgId: options?.orgId,
|
|
@@ -14855,7 +14864,8 @@ async function createAllTools(options) {
|
|
|
14855
14864
|
}
|
|
14856
14865
|
} catch {
|
|
14857
14866
|
}
|
|
14858
|
-
const
|
|
14867
|
+
const _wsRoot = options?.agentId ? (await import("./workspace-P5FCSG2D.js")).getAgentWorkspaceDir(options.agentId) : options?.workspaceDir || process.cwd();
|
|
14868
|
+
const dataDir = (await import("path")).join(_wsRoot, "whatsapp");
|
|
14859
14869
|
const _rec = _outboundRecorder;
|
|
14860
14870
|
messagingTools = messagingTools.concat(createWhatsAppTools({
|
|
14861
14871
|
agentId: options?.agentId || "",
|
|
@@ -14866,6 +14876,7 @@ async function createAllTools(options) {
|
|
|
14866
14876
|
if (telegramConfig.botToken) {
|
|
14867
14877
|
messagingTools = messagingTools.concat(createTelegramTools({
|
|
14868
14878
|
botToken: telegramConfig.botToken,
|
|
14879
|
+
agentId: options?.agentId || "",
|
|
14869
14880
|
onOutbound: _rec ? (chatId, text) => _rec("telegram", chatId, text) : void 0
|
|
14870
14881
|
}));
|
|
14871
14882
|
}
|
|
@@ -7,6 +7,12 @@ import {
|
|
|
7
7
|
buildPolymarketPrompt,
|
|
8
8
|
buildRemotonPrompt
|
|
9
9
|
} from "./chunk-BBM4POWP.js";
|
|
10
|
+
import {
|
|
11
|
+
WORKSPACE_SUBDIRS,
|
|
12
|
+
ensureAgentWorkspace,
|
|
13
|
+
getAgentWorkspaceDir,
|
|
14
|
+
init_workspace
|
|
15
|
+
} from "./chunk-UETRFOSR.js";
|
|
10
16
|
|
|
11
17
|
// src/runtime/index.ts
|
|
12
18
|
import { nanoid as nanoid3 } from "nanoid";
|
|
@@ -436,7 +442,7 @@ function createRuntimeHooks(deps) {
|
|
|
436
442
|
var injectedMessages = [...messages];
|
|
437
443
|
if (deps.knowledgeBaseEnabled !== false) {
|
|
438
444
|
try {
|
|
439
|
-
var { knowledgeBase } = await import("./routes-
|
|
445
|
+
var { knowledgeBase } = await import("./routes-5PUCWC4N.js");
|
|
440
446
|
var kbs = await knowledgeBase.listForAgent(agentId);
|
|
441
447
|
if (kbs.length > 0) {
|
|
442
448
|
var contextParts = [];
|
|
@@ -469,7 +475,7 @@ ${contextParts.join("\n\n")}`;
|
|
|
469
475
|
}
|
|
470
476
|
if (deps.memoryEnabled !== false) {
|
|
471
477
|
try {
|
|
472
|
-
var { memoryManager } = await import("./routes-
|
|
478
|
+
var { memoryManager } = await import("./routes-5PUCWC4N.js");
|
|
473
479
|
var memories = await memoryManager.queryMemories({
|
|
474
480
|
agentId,
|
|
475
481
|
limit: 10,
|
|
@@ -490,7 +496,7 @@ ${memories.map(function(m) {
|
|
|
490
496
|
}
|
|
491
497
|
if (deps.policyEnabled !== false) {
|
|
492
498
|
try {
|
|
493
|
-
var { policyEngine } = await import("./routes-
|
|
499
|
+
var { policyEngine } = await import("./routes-5PUCWC4N.js");
|
|
494
500
|
var policies = await policyEngine.getAgentPolicies(agentId, deps.orgId);
|
|
495
501
|
if (policies.length > 0) {
|
|
496
502
|
var policyText = policies.map(function(p) {
|
|
@@ -515,7 +521,7 @@ ${policyText}`;
|
|
|
515
521
|
// ─── Budget Check ──────────────────────────────
|
|
516
522
|
async checkBudget(agentId, _orgId, _estimatedTokens) {
|
|
517
523
|
try {
|
|
518
|
-
var { lifecycle } = await import("./routes-
|
|
524
|
+
var { lifecycle } = await import("./routes-5PUCWC4N.js");
|
|
519
525
|
var now = Date.now();
|
|
520
526
|
var cacheKey = `budget_sync_${agentId}`;
|
|
521
527
|
var lastSync = globalThis[cacheKey] || 0;
|
|
@@ -608,7 +614,7 @@ ${policyText}`;
|
|
|
608
614
|
// ─── Record LLM Usage ──────────────────────────
|
|
609
615
|
async recordLLMUsage(agentId, orgId, usage) {
|
|
610
616
|
try {
|
|
611
|
-
var { lifecycle } = await import("./routes-
|
|
617
|
+
var { lifecycle } = await import("./routes-5PUCWC4N.js");
|
|
612
618
|
console.log(`[hooks] recordLLMUsage: agent=${agentId}, input=${usage.inputTokens}, output=${usage.outputTokens}`);
|
|
613
619
|
await lifecycle.recordLLMUsage(agentId, {
|
|
614
620
|
inputTokens: usage.inputTokens,
|
|
@@ -619,7 +625,7 @@ ${policyText}`;
|
|
|
619
625
|
console.log(`[hooks] recordLLMUsage error: ${recordErr.message}`);
|
|
620
626
|
}
|
|
621
627
|
try {
|
|
622
|
-
var { activity } = await import("./routes-
|
|
628
|
+
var { activity } = await import("./routes-5PUCWC4N.js");
|
|
623
629
|
await activity.record({
|
|
624
630
|
agentId,
|
|
625
631
|
orgId,
|
|
@@ -667,7 +673,7 @@ ${policyText}`;
|
|
|
667
673
|
var cacheKey = `${ctx.agentId}:${ctx.toolName}`;
|
|
668
674
|
var cached = getCachedPermission(cacheKey);
|
|
669
675
|
if (cached) return cached;
|
|
670
|
-
var { permissionEngine } = await import("./routes-
|
|
676
|
+
var { permissionEngine } = await import("./routes-5PUCWC4N.js");
|
|
671
677
|
var permResult = await permissionEngine.checkPermission(ctx.agentId, ctx.toolName);
|
|
672
678
|
var result = {
|
|
673
679
|
allowed: permResult.allowed,
|
|
@@ -676,7 +682,7 @@ ${policyText}`;
|
|
|
676
682
|
};
|
|
677
683
|
if (result.allowed && deps.guardrailsEnabled !== false) {
|
|
678
684
|
try {
|
|
679
|
-
var { guardrails } = await import("./routes-
|
|
685
|
+
var { guardrails } = await import("./routes-5PUCWC4N.js");
|
|
680
686
|
var status = await guardrails.getStatus(ctx.agentId);
|
|
681
687
|
if (status.paused || status.offDuty) {
|
|
682
688
|
result.allowed = false;
|
|
@@ -688,7 +694,7 @@ ${policyText}`;
|
|
|
688
694
|
}
|
|
689
695
|
if (result.allowed && deps.dlpEnabled !== false && ctx.parameters) {
|
|
690
696
|
try {
|
|
691
|
-
var { dlp } = await import("./routes-
|
|
697
|
+
var { dlp } = await import("./routes-5PUCWC4N.js");
|
|
692
698
|
var dlpResult = await dlp.scanParameters({
|
|
693
699
|
orgId: ctx.orgId,
|
|
694
700
|
agentId: ctx.agentId,
|
|
@@ -708,7 +714,7 @@ ${policyText}`;
|
|
|
708
714
|
}
|
|
709
715
|
if (result.requiresApproval && result.allowed) {
|
|
710
716
|
try {
|
|
711
|
-
var { approvals } = await import("./routes-
|
|
717
|
+
var { approvals } = await import("./routes-5PUCWC4N.js");
|
|
712
718
|
var approval = await approvals.createAndWait({
|
|
713
719
|
agentId: ctx.agentId,
|
|
714
720
|
orgId: ctx.orgId,
|
|
@@ -738,7 +744,7 @@ ${policyText}`;
|
|
|
738
744
|
// ─── After Tool Call ────────────────────────────
|
|
739
745
|
async afterToolCall(ctx, result) {
|
|
740
746
|
try {
|
|
741
|
-
var { activity } = await import("./routes-
|
|
747
|
+
var { activity } = await import("./routes-5PUCWC4N.js");
|
|
742
748
|
await activity.record({
|
|
743
749
|
agentId: ctx.agentId,
|
|
744
750
|
orgId: ctx.orgId,
|
|
@@ -755,7 +761,7 @@ ${policyText}`;
|
|
|
755
761
|
} catch {
|
|
756
762
|
}
|
|
757
763
|
try {
|
|
758
|
-
var { lifecycle } = await import("./routes-
|
|
764
|
+
var { lifecycle } = await import("./routes-5PUCWC4N.js");
|
|
759
765
|
await lifecycle.recordToolCall(ctx.agentId, {
|
|
760
766
|
toolId: ctx.toolName,
|
|
761
767
|
tokensUsed: 0,
|
|
@@ -767,7 +773,7 @@ ${policyText}`;
|
|
|
767
773
|
}
|
|
768
774
|
if (result.success && EXTERNAL_TOOLS.has(ctx.toolName)) {
|
|
769
775
|
try {
|
|
770
|
-
var { journal } = await import("./routes-
|
|
776
|
+
var { journal } = await import("./routes-5PUCWC4N.js");
|
|
771
777
|
await journal.record({
|
|
772
778
|
orgId: ctx.orgId,
|
|
773
779
|
agentId: ctx.agentId,
|
|
@@ -782,7 +788,7 @@ ${policyText}`;
|
|
|
782
788
|
}
|
|
783
789
|
if (result.success && COMMUNICATION_TOOLS.has(ctx.toolName)) {
|
|
784
790
|
try {
|
|
785
|
-
var { commBus } = await import("./routes-
|
|
791
|
+
var { commBus } = await import("./routes-5PUCWC4N.js");
|
|
786
792
|
await commBus.observeMessage({
|
|
787
793
|
orgId: ctx.orgId,
|
|
788
794
|
agentId: ctx.agentId,
|
|
@@ -796,7 +802,7 @@ ${policyText}`;
|
|
|
796
802
|
// ─── Session Lifecycle ──────────────────────────
|
|
797
803
|
async onSessionStart(sessionId, agentId, orgId) {
|
|
798
804
|
try {
|
|
799
|
-
var { activity } = await import("./routes-
|
|
805
|
+
var { activity } = await import("./routes-5PUCWC4N.js");
|
|
800
806
|
await activity.record({
|
|
801
807
|
agentId,
|
|
802
808
|
orgId,
|
|
@@ -809,7 +815,7 @@ ${policyText}`;
|
|
|
809
815
|
},
|
|
810
816
|
async onSessionEnd(sessionId, agentId, orgId) {
|
|
811
817
|
try {
|
|
812
|
-
var { activity } = await import("./routes-
|
|
818
|
+
var { activity } = await import("./routes-5PUCWC4N.js");
|
|
813
819
|
await activity.record({
|
|
814
820
|
agentId,
|
|
815
821
|
orgId,
|
|
@@ -824,7 +830,7 @@ ${policyText}`;
|
|
|
824
830
|
async onCompactionStart(sessionId, agentId, tokenCount, contextWindowSize) {
|
|
825
831
|
var pct = contextWindowSize > 0 ? Math.round(tokenCount / contextWindowSize * 100) : 0;
|
|
826
832
|
try {
|
|
827
|
-
var { activity } = await import("./routes-
|
|
833
|
+
var { activity } = await import("./routes-5PUCWC4N.js");
|
|
828
834
|
await activity.record({
|
|
829
835
|
agentId,
|
|
830
836
|
orgId: deps.orgId,
|
|
@@ -851,7 +857,7 @@ ${policyText}`;
|
|
|
851
857
|
// ─── Context Compaction ─────────────────────────
|
|
852
858
|
async onContextCompaction(sessionId, agentId, summary) {
|
|
853
859
|
try {
|
|
854
|
-
var { activity: activityTracker } = await import("./routes-
|
|
860
|
+
var { activity: activityTracker } = await import("./routes-5PUCWC4N.js");
|
|
855
861
|
await activityTracker.record({
|
|
856
862
|
agentId,
|
|
857
863
|
orgId: deps.orgId,
|
|
@@ -862,7 +868,7 @@ ${policyText}`;
|
|
|
862
868
|
} catch {
|
|
863
869
|
}
|
|
864
870
|
try {
|
|
865
|
-
var { memoryManager } = await import("./routes-
|
|
871
|
+
var { memoryManager } = await import("./routes-5PUCWC4N.js");
|
|
866
872
|
await memoryManager.createMemory({
|
|
867
873
|
agentId,
|
|
868
874
|
orgId: deps.orgId,
|
|
@@ -2956,7 +2962,7 @@ async function runAgentLoop(config, initialMessages, hooks, options) {
|
|
|
2956
2962
|
console.log(`[agent-loop] \u2705 Tool ${toolCall.name} succeeded (${content.length} chars): ${content.slice(0, 300)}`);
|
|
2957
2963
|
}
|
|
2958
2964
|
try {
|
|
2959
|
-
const { activity } = await import("./routes-
|
|
2965
|
+
const { activity } = await import("./routes-5PUCWC4N.js");
|
|
2960
2966
|
activity.recordToolCallCompact({
|
|
2961
2967
|
agentId: config.agentId,
|
|
2962
2968
|
orgId: config.orgId,
|
|
@@ -4270,7 +4276,7 @@ function createRequestToolsTool(allTools, activeSets, _context, agentSkills) {
|
|
|
4270
4276
|
};
|
|
4271
4277
|
}
|
|
4272
4278
|
async function createToolsForContext(options, context, opts) {
|
|
4273
|
-
const { createAllTools } = await import("./agent-tools-
|
|
4279
|
+
const { createAllTools } = await import("./agent-tools-5LLIXV6A.js");
|
|
4274
4280
|
if (context === "full") {
|
|
4275
4281
|
return createAllTools(options);
|
|
4276
4282
|
}
|
|
@@ -4881,9 +4887,7 @@ var FollowUpScheduler = class {
|
|
|
4881
4887
|
};
|
|
4882
4888
|
|
|
4883
4889
|
// src/runtime/index.ts
|
|
4884
|
-
|
|
4885
|
-
import { join } from "path";
|
|
4886
|
-
import { mkdirSync } from "fs";
|
|
4890
|
+
init_workspace();
|
|
4887
4891
|
var _remotionPrompt = buildRemotonPrompt();
|
|
4888
4892
|
var DEFAULT_MODEL = {
|
|
4889
4893
|
provider: "anthropic",
|
|
@@ -4934,9 +4938,9 @@ var AgentRuntime = class {
|
|
|
4934
4938
|
/** Build tool options for a given agent, including OAuth email config if available */
|
|
4935
4939
|
buildToolOptions(agentId, sessionId) {
|
|
4936
4940
|
const self = this;
|
|
4937
|
-
const agentWorkspace =
|
|
4941
|
+
const agentWorkspace = getAgentWorkspaceDir(agentId);
|
|
4938
4942
|
try {
|
|
4939
|
-
|
|
4943
|
+
ensureAgentWorkspace(agentId);
|
|
4940
4944
|
} catch {
|
|
4941
4945
|
}
|
|
4942
4946
|
const base = {
|
|
@@ -5781,7 +5785,7 @@ function createAgentRuntime(config) {
|
|
|
5781
5785
|
return new AgentRuntime(config);
|
|
5782
5786
|
}
|
|
5783
5787
|
function buildDefaultSystemPrompt(agentId, memoryContext, hierarchyContext, agentIdentity, dbConnections, agentConfig) {
|
|
5784
|
-
const wsDir =
|
|
5788
|
+
const wsDir = getAgentWorkspaceDir(agentId);
|
|
5785
5789
|
var base = `You are an AI agent managed by AgenticMail Enterprise (agent: ${agentId}).
|
|
5786
5790
|
|
|
5787
5791
|
You have access to a comprehensive set of tools for completing tasks. Use them effectively.
|
|
@@ -5796,10 +5800,12 @@ Guidelines:
|
|
|
5796
5800
|
- For long tasks, work systematically and report progress
|
|
5797
5801
|
|
|
5798
5802
|
## Your Workspace
|
|
5799
|
-
Your
|
|
5800
|
-
ALWAYS save files, deliverables, rendered videos, images, and outputs here \u2014 NEVER in /tmp.
|
|
5801
|
-
/tmp files are cleaned up by the OS and
|
|
5802
|
-
|
|
5803
|
+
Your permanent workspace directory is: ${wsDir}
|
|
5804
|
+
ALWAYS save files, deliverables, rendered videos, images, templates, and outputs here \u2014 NEVER in /tmp.
|
|
5805
|
+
/tmp files are cleaned up by the OS and WILL be lost. Your workspace persists across sessions, restarts, and reboots.
|
|
5806
|
+
Keep it neat \u2014 it already has these subfolders (use them, create more as needed):
|
|
5807
|
+
${Object.entries(WORKSPACE_SUBDIRS).map(([n, d]) => ` - ${n}/ \u2014 ${d}`).join("\n")}
|
|
5808
|
+
Examples: email/HTML templates \u2192 templates/ ; attachments & images \u2192 media/ ; finished deliverables \u2192 exports/ ; scratch \u2192 tmp/ (inside your workspace, NOT the OS /tmp).
|
|
5803
5809
|
- ACTIVELY USE YOUR MEMORY: After corrections, lessons, or insights, call memory_reflect to record them
|
|
5804
5810
|
- Before complex tasks, call memory_context to recall relevant knowledge
|
|
5805
5811
|
- Your memory persists across conversations \u2014 it's how you grow as an expert
|
|
@@ -137,12 +137,9 @@ async function getOrCreateConnection(config) {
|
|
|
137
137
|
var buffer = await downloadMediaMessage(msg, "buffer", {});
|
|
138
138
|
if (buffer && buffer.length > 0) {
|
|
139
139
|
var { join: join2 } = await import("path");
|
|
140
|
-
var {
|
|
141
|
-
var
|
|
142
|
-
|
|
143
|
-
mkdirSync(mediaDir, { recursive: true });
|
|
144
|
-
} catch {
|
|
145
|
-
}
|
|
140
|
+
var { writeFileSync } = await import("fs");
|
|
141
|
+
var { getAgentSubdir } = await import("./workspace-P5FCSG2D.js");
|
|
142
|
+
var mediaDir = getAgentSubdir(config.agentId, "media");
|
|
146
143
|
mediaType = msg.message?.imageMessage ? "photo" : msg.message?.videoMessage ? "video" : msg.message?.audioMessage ? "audio" : msg.message?.documentMessage ? "document" : msg.message?.stickerMessage ? "sticker" : "file";
|
|
147
144
|
var ext = mediaType === "photo" ? "jpg" : mediaType === "video" ? "mp4" : mediaType === "audio" ? "ogg" : mediaType === "sticker" ? "webp" : mediaMessage.fileName?.split(".").pop() || "bin";
|
|
148
145
|
var localName = mediaMessage.fileName || `${mediaType}-${Date.now()}.${ext}`;
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
init_config_bus,
|
|
12
12
|
init_routes,
|
|
13
13
|
routes_exports
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-VWIDJRD4.js";
|
|
15
15
|
import {
|
|
16
16
|
init_transport_encryption,
|
|
17
17
|
transportEncryptionMiddleware
|
|
@@ -1658,7 +1658,7 @@ function createAdminRoutes(db) {
|
|
|
1658
1658
|
});
|
|
1659
1659
|
api.get("/whatsapp/qr/:agentId", requireRole("admin"), async (c) => {
|
|
1660
1660
|
try {
|
|
1661
|
-
var { getWhatsAppQR, isWhatsAppConnected } = await import("./whatsapp-
|
|
1661
|
+
var { getWhatsAppQR, isWhatsAppConnected } = await import("./whatsapp-TBOB7TDL.js");
|
|
1662
1662
|
var agentId = c.req.param("agentId");
|
|
1663
1663
|
if (isWhatsAppConnected(agentId)) {
|
|
1664
1664
|
return c.json({ status: "connected" });
|
|
@@ -7746,7 +7746,7 @@ function createServer(config) {
|
|
|
7746
7746
|
let engineInitialized = false;
|
|
7747
7747
|
api.all("/engine/*", async (c, _next) => {
|
|
7748
7748
|
try {
|
|
7749
|
-
const { engineRoutes, setEngineDb } = await import("./routes-
|
|
7749
|
+
const { engineRoutes, setEngineDb } = await import("./routes-5PUCWC4N.js");
|
|
7750
7750
|
const { EngineDatabase } = await import("./db-adapter-ARPQPQ6K.js");
|
|
7751
7751
|
if (!engineInitialized) {
|
|
7752
7752
|
engineInitialized = true;
|
|
@@ -7776,13 +7776,13 @@ function createServer(config) {
|
|
|
7776
7776
|
engineInitialized = true;
|
|
7777
7777
|
if (config.runtime?.enabled) {
|
|
7778
7778
|
try {
|
|
7779
|
-
const { createAgentRuntime } = await import("./runtime-
|
|
7780
|
-
const { mountRuntimeApp, setRuntime } = await import("./routes-
|
|
7779
|
+
const { createAgentRuntime } = await import("./runtime-GML2LXIN.js");
|
|
7780
|
+
const { mountRuntimeApp, setRuntime } = await import("./routes-5PUCWC4N.js");
|
|
7781
7781
|
let getEmailConfig;
|
|
7782
7782
|
let onTokenRefresh;
|
|
7783
7783
|
let agentMemoryMgr;
|
|
7784
7784
|
try {
|
|
7785
|
-
const { lifecycle: lc, memoryManager: mm } = await import("./routes-
|
|
7785
|
+
const { lifecycle: lc, memoryManager: mm } = await import("./routes-5PUCWC4N.js");
|
|
7786
7786
|
agentMemoryMgr = mm;
|
|
7787
7787
|
if (lc) {
|
|
7788
7788
|
getEmailConfig = (agentId) => {
|
|
@@ -7821,7 +7821,7 @@ function createServer(config) {
|
|
|
7821
7821
|
}
|
|
7822
7822
|
} catch {
|
|
7823
7823
|
}
|
|
7824
|
-
const { vault: vaultRef, permissionEngine: permRef, databaseManager: dbMgr } = await import("./routes-
|
|
7824
|
+
const { vault: vaultRef, permissionEngine: permRef, databaseManager: dbMgr } = await import("./routes-5PUCWC4N.js");
|
|
7825
7825
|
const runtime = createAgentRuntime({
|
|
7826
7826
|
engineDb,
|
|
7827
7827
|
adminDb: config.db,
|
|
@@ -8071,7 +8071,7 @@ function createServer(config) {
|
|
|
8071
8071
|
}
|
|
8072
8072
|
}
|
|
8073
8073
|
try {
|
|
8074
|
-
const routesMod = await import("./routes-
|
|
8074
|
+
const routesMod = await import("./routes-5PUCWC4N.js");
|
|
8075
8075
|
const kbEngine = routesMod.knowledgeBase;
|
|
8076
8076
|
kbEngine?.setApiKeys?.(decryptedKeys);
|
|
8077
8077
|
if (Object.keys(decryptedKeys).length > 0) {
|
|
@@ -8089,7 +8089,7 @@ function createServer(config) {
|
|
|
8089
8089
|
});
|
|
8090
8090
|
(async () => {
|
|
8091
8091
|
try {
|
|
8092
|
-
const { engineRoutes, setEngineDb } = await import("./routes-
|
|
8092
|
+
const { engineRoutes, setEngineDb } = await import("./routes-5PUCWC4N.js");
|
|
8093
8093
|
const { EngineDatabase } = await import("./db-adapter-ARPQPQ6K.js");
|
|
8094
8094
|
if (!engineInitialized) {
|
|
8095
8095
|
engineInitialized = true;
|
|
@@ -8113,13 +8113,13 @@ function createServer(config) {
|
|
|
8113
8113
|
await setEngineDb(engineDb, config.db);
|
|
8114
8114
|
if (config.runtime?.enabled) {
|
|
8115
8115
|
try {
|
|
8116
|
-
const { createAgentRuntime } = await import("./runtime-
|
|
8117
|
-
const { mountRuntimeApp, setRuntime } = await import("./routes-
|
|
8116
|
+
const { createAgentRuntime } = await import("./runtime-GML2LXIN.js");
|
|
8117
|
+
const { mountRuntimeApp, setRuntime } = await import("./routes-5PUCWC4N.js");
|
|
8118
8118
|
let getEmailConfig;
|
|
8119
8119
|
let onTokenRefresh;
|
|
8120
8120
|
let agentMemoryMgr;
|
|
8121
8121
|
try {
|
|
8122
|
-
const { lifecycle: lc, memoryManager: mm } = await import("./routes-
|
|
8122
|
+
const { lifecycle: lc, memoryManager: mm } = await import("./routes-5PUCWC4N.js");
|
|
8123
8123
|
agentMemoryMgr = mm;
|
|
8124
8124
|
if (lc) {
|
|
8125
8125
|
getEmailConfig = (agentId) => {
|
|
@@ -8158,7 +8158,7 @@ function createServer(config) {
|
|
|
8158
8158
|
}
|
|
8159
8159
|
} catch {
|
|
8160
8160
|
}
|
|
8161
|
-
const { vault: vaultRef2, permissionEngine: permRef2, databaseManager: dbMgr2 } = await import("./routes-
|
|
8161
|
+
const { vault: vaultRef2, permissionEngine: permRef2, databaseManager: dbMgr2 } = await import("./routes-5PUCWC4N.js");
|
|
8162
8162
|
const runtime = createAgentRuntime({
|
|
8163
8163
|
engineDb,
|
|
8164
8164
|
adminDb: config.db,
|
|
@@ -8170,7 +8170,7 @@ function createServer(config) {
|
|
|
8170
8170
|
agentMemoryManager: agentMemoryMgr,
|
|
8171
8171
|
vault: vaultRef2,
|
|
8172
8172
|
permissionEngine: permRef2,
|
|
8173
|
-
hierarchyManager: (await import("./routes-
|
|
8173
|
+
hierarchyManager: (await import("./routes-5PUCWC4N.js")).hierarchyManager ?? void 0,
|
|
8174
8174
|
databaseManager: dbMgr2
|
|
8175
8175
|
});
|
|
8176
8176
|
await runtime.start();
|
|
@@ -8184,7 +8184,7 @@ function createServer(config) {
|
|
|
8184
8184
|
}
|
|
8185
8185
|
console.log("[engine] Eagerly initialized");
|
|
8186
8186
|
try {
|
|
8187
|
-
const { lifecycle: lcRef } = await import("./routes-
|
|
8187
|
+
const { lifecycle: lcRef } = await import("./routes-5PUCWC4N.js");
|
|
8188
8188
|
if (lcRef) {
|
|
8189
8189
|
const agents = Array.from(lcRef.agents?.values?.() || []);
|
|
8190
8190
|
const hasLocalPm2 = agents.some((a) => {
|
|
@@ -8193,7 +8193,7 @@ function createServer(config) {
|
|
|
8193
8193
|
return target === "local" && (!pm || pm === "pm2");
|
|
8194
8194
|
});
|
|
8195
8195
|
if (hasLocalPm2) {
|
|
8196
|
-
const { ensurePm2 } = await import("./deployer-
|
|
8196
|
+
const { ensurePm2 } = await import("./deployer-M4YHMATN.js");
|
|
8197
8197
|
const pm2 = await ensurePm2();
|
|
8198
8198
|
if (pm2.installed) {
|
|
8199
8199
|
console.log(`[startup] PM2 v${pm2.version} available for local deployments`);
|
|
@@ -1234,7 +1234,7 @@ async function deploy(config, db, jwtSecret, vaultKey, spinner, chalk) {
|
|
|
1234
1234
|
const { deployTarget, company, database, domain, tunnel, cloud } = config;
|
|
1235
1235
|
if (deployTarget === "cloudflare-tunnel" && tunnel) {
|
|
1236
1236
|
spinner.start(`Starting local server on port ${tunnel.port}...`);
|
|
1237
|
-
const { createServer: createServer2 } = await import("./server-
|
|
1237
|
+
const { createServer: createServer2 } = await import("./server-R5SICPBI.js");
|
|
1238
1238
|
const server2 = createServer2({ port: tunnel.port, db, jwtSecret });
|
|
1239
1239
|
const handle2 = await server2.start();
|
|
1240
1240
|
spinner.succeed("Server running");
|
|
@@ -1601,7 +1601,7 @@ async function deploy(config, db, jwtSecret, vaultKey, spinner, chalk) {
|
|
|
1601
1601
|
return {};
|
|
1602
1602
|
}
|
|
1603
1603
|
spinner.start("Starting local server...");
|
|
1604
|
-
const { createServer } = await import("./server-
|
|
1604
|
+
const { createServer } = await import("./server-R5SICPBI.js");
|
|
1605
1605
|
const server = createServer({ port: 3e3, db, jwtSecret });
|
|
1606
1606
|
const handle = await server.start();
|
|
1607
1607
|
spinner.succeed("Server running");
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import {
|
|
2
|
+
WORKSPACE_SUBDIRS,
|
|
3
|
+
init_workspace
|
|
4
|
+
} from "./chunk-UETRFOSR.js";
|
|
1
5
|
import {
|
|
2
6
|
__esm
|
|
3
7
|
} from "./chunk-KFQGP6VL.js";
|
|
@@ -7,6 +11,7 @@ var AgentConfigGenerator;
|
|
|
7
11
|
var init_agent_config = __esm({
|
|
8
12
|
"src/engine/agent-config.ts"() {
|
|
9
13
|
"use strict";
|
|
14
|
+
init_workspace();
|
|
10
15
|
AgentConfigGenerator = class _AgentConfigGenerator {
|
|
11
16
|
/**
|
|
12
17
|
* Generate the complete workspace files for an agent
|
|
@@ -329,6 +334,15 @@ _Configure this from the admin dashboard._
|
|
|
329
334
|
- Daily notes: memory/YYYY-MM-DD.md
|
|
330
335
|
- Long-term: MEMORY.md
|
|
331
336
|
|
|
337
|
+
## Files & Workspace
|
|
338
|
+
You have ONE permanent workspace folder. ALWAYS work from it \u2014 NEVER write to /tmp
|
|
339
|
+
(OS temp files get wiped and are lost). It persists across sessions and reboots.
|
|
340
|
+
Location: \`~/.agenticmail/workspaces/<your-agent-id>/\` (also injected into your
|
|
341
|
+
system prompt at runtime, and saved in your memory). Keep it neat:
|
|
342
|
+
${Object.entries(WORKSPACE_SUBDIRS).map(([n, d]) => `- \`${n}/\` \u2014 ${d}`).join("\n")}
|
|
343
|
+
Email/HTML templates \u2192 \`templates/\` \xB7 attachments & images \u2192 \`media/\` \xB7 finished
|
|
344
|
+
deliverables \u2192 \`exports/\` \xB7 scratch \u2192 \`tmp/\` (inside your workspace, not the OS /tmp).
|
|
345
|
+
|
|
332
346
|
## Safety
|
|
333
347
|
- Don't exfiltrate private data
|
|
334
348
|
- Don't run destructive commands without asking
|
|
@@ -107,12 +107,9 @@ function createTelegramTools(config) {
|
|
|
107
107
|
var resp = await fetch(downloadUrl);
|
|
108
108
|
if (!resp.ok) throw new Error(`Download failed: ${resp.status}`);
|
|
109
109
|
var { join } = await import("path");
|
|
110
|
-
var {
|
|
111
|
-
var
|
|
112
|
-
|
|
113
|
-
mkdirSync(mediaDir, { recursive: true });
|
|
114
|
-
} catch {
|
|
115
|
-
}
|
|
110
|
+
var { writeFileSync } = await import("fs");
|
|
111
|
+
var { getAgentSubdir } = await import("./workspace-P5FCSG2D.js");
|
|
112
|
+
var mediaDir = getAgentSubdir(config.agentId || "default", "media");
|
|
116
113
|
var ext = fileData.file_path.split(".").pop() || "bin";
|
|
117
114
|
var localName = input.fileName || `telegram-${Date.now()}.${ext}`;
|
|
118
115
|
var localPath = join(mediaDir, localName);
|