@agenticmail/enterprise 0.5.207 → 0.5.208
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/dist/agent-heartbeat-2D43IBNA.js +510 -0
- package/dist/agent-heartbeat-AYOPPYNS.js +510 -0
- package/dist/agent-heartbeat-BLFZHGVH.js +510 -0
- package/dist/agent-heartbeat-FITCBARW.js +510 -0
- package/dist/chunk-2DJEQCRU.js +4457 -0
- package/dist/chunk-6PIWF5AC.js +1224 -0
- package/dist/chunk-APRK35OM.js +3685 -0
- package/dist/chunk-BTT3P4XP.js +3685 -0
- package/dist/chunk-D7SBTNBI.js +1224 -0
- package/dist/chunk-FEEHLIWF.js +1224 -0
- package/dist/chunk-JBLDCQSK.js +4457 -0
- package/dist/chunk-L72IFQCJ.js +1224 -0
- package/dist/chunk-LIHFQM2M.js +3685 -0
- package/dist/chunk-QVKIYQ5F.js +4494 -0
- package/dist/chunk-RTW7WNXZ.js +3685 -0
- package/dist/chunk-VBLS4HXF.js +4494 -0
- package/dist/chunk-W5MVEM4M.js +3685 -0
- package/dist/chunk-WZ4F4SYK.js +292 -0
- package/dist/chunk-ZJZ5N4SD.js +4494 -0
- package/dist/chunk-ZKSOJILT.js +1224 -0
- package/dist/cli-agent-ILMIH4Z4.js +1602 -0
- package/dist/cli-agent-MRGC2WFN.js +1602 -0
- package/dist/cli-agent-ND6P7N2G.js +1719 -0
- package/dist/cli-agent-OTZ6INTM.js +1602 -0
- package/dist/cli-agent-OXSEQWTQ.js +1602 -0
- package/dist/cli-serve-3M2FUSYX.js +114 -0
- package/dist/cli-serve-A4DRJBGH.js +114 -0
- package/dist/cli-serve-ASW2VFVZ.js +114 -0
- package/dist/cli-serve-MJSIZKOG.js +114 -0
- package/dist/cli-serve-V7JBBESA.js +114 -0
- package/dist/cli.js +3 -3
- package/dist/index.js +3 -3
- package/dist/routes-AAXSMKBT.js +13032 -0
- package/dist/routes-EZVM3AQW.js +13281 -0
- package/dist/routes-I7Z57PKK.js +13283 -0
- package/dist/routes-RGYOWZA6.js +13282 -0
- package/dist/runtime-CMOHWZTC.js +45 -0
- package/dist/runtime-DIE72WMW.js +45 -0
- package/dist/runtime-DVDGBQKF.js +45 -0
- package/dist/runtime-HWQ5ZXD3.js +45 -0
- package/dist/runtime-LRKG2KTN.js +45 -0
- package/dist/server-6L3RFC42.js +15 -0
- package/dist/server-7P67XIXT.js +15 -0
- package/dist/server-AB6BBV2H.js +15 -0
- package/dist/server-D2ZZ44LL.js +15 -0
- package/dist/server-UC23ZQIO.js +15 -0
- package/dist/setup-6UB3FST3.js +20 -0
- package/dist/setup-BW5BWSG2.js +20 -0
- package/dist/setup-KXN6MGWO.js +20 -0
- package/dist/setup-SZK7GYJE.js +20 -0
- package/dist/setup-X6CIHPCV.js +20 -0
- package/package.json +1 -1
- package/src/cli-agent.ts +43 -0
- package/src/engine/agent-routes.ts +32 -2
- package/src/engine/messaging-poller.ts +17 -1
- package/src/engine/routes.ts +2 -1
- package/src/runtime/gateway.ts +0 -45
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AgentRuntime,
|
|
3
|
+
EmailChannel,
|
|
4
|
+
FollowUpScheduler,
|
|
5
|
+
SessionManager,
|
|
6
|
+
SubAgentManager,
|
|
7
|
+
ToolRegistry,
|
|
8
|
+
callLLM,
|
|
9
|
+
createAgentRuntime,
|
|
10
|
+
createNoopHooks,
|
|
11
|
+
createRuntimeHooks,
|
|
12
|
+
estimateMessageTokens,
|
|
13
|
+
estimateTokens,
|
|
14
|
+
executeTool,
|
|
15
|
+
runAgentLoop,
|
|
16
|
+
toolsToDefinitions
|
|
17
|
+
} from "./chunk-QVKIYQ5F.js";
|
|
18
|
+
import {
|
|
19
|
+
PROVIDER_REGISTRY,
|
|
20
|
+
listAllProviders,
|
|
21
|
+
resolveApiKeyForProvider,
|
|
22
|
+
resolveProvider
|
|
23
|
+
} from "./chunk-UF3ZJMJO.js";
|
|
24
|
+
import "./chunk-KFQGP6VL.js";
|
|
25
|
+
export {
|
|
26
|
+
AgentRuntime,
|
|
27
|
+
EmailChannel,
|
|
28
|
+
FollowUpScheduler,
|
|
29
|
+
PROVIDER_REGISTRY,
|
|
30
|
+
SessionManager,
|
|
31
|
+
SubAgentManager,
|
|
32
|
+
ToolRegistry,
|
|
33
|
+
callLLM,
|
|
34
|
+
createAgentRuntime,
|
|
35
|
+
createNoopHooks,
|
|
36
|
+
createRuntimeHooks,
|
|
37
|
+
estimateMessageTokens,
|
|
38
|
+
estimateTokens,
|
|
39
|
+
executeTool,
|
|
40
|
+
listAllProviders,
|
|
41
|
+
resolveApiKeyForProvider,
|
|
42
|
+
resolveProvider,
|
|
43
|
+
runAgentLoop,
|
|
44
|
+
toolsToDefinitions
|
|
45
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AgentRuntime,
|
|
3
|
+
EmailChannel,
|
|
4
|
+
FollowUpScheduler,
|
|
5
|
+
SessionManager,
|
|
6
|
+
SubAgentManager,
|
|
7
|
+
ToolRegistry,
|
|
8
|
+
callLLM,
|
|
9
|
+
createAgentRuntime,
|
|
10
|
+
createNoopHooks,
|
|
11
|
+
createRuntimeHooks,
|
|
12
|
+
estimateMessageTokens,
|
|
13
|
+
estimateTokens,
|
|
14
|
+
executeTool,
|
|
15
|
+
runAgentLoop,
|
|
16
|
+
toolsToDefinitions
|
|
17
|
+
} from "./chunk-JBLDCQSK.js";
|
|
18
|
+
import {
|
|
19
|
+
PROVIDER_REGISTRY,
|
|
20
|
+
listAllProviders,
|
|
21
|
+
resolveApiKeyForProvider,
|
|
22
|
+
resolveProvider
|
|
23
|
+
} from "./chunk-UF3ZJMJO.js";
|
|
24
|
+
import "./chunk-KFQGP6VL.js";
|
|
25
|
+
export {
|
|
26
|
+
AgentRuntime,
|
|
27
|
+
EmailChannel,
|
|
28
|
+
FollowUpScheduler,
|
|
29
|
+
PROVIDER_REGISTRY,
|
|
30
|
+
SessionManager,
|
|
31
|
+
SubAgentManager,
|
|
32
|
+
ToolRegistry,
|
|
33
|
+
callLLM,
|
|
34
|
+
createAgentRuntime,
|
|
35
|
+
createNoopHooks,
|
|
36
|
+
createRuntimeHooks,
|
|
37
|
+
estimateMessageTokens,
|
|
38
|
+
estimateTokens,
|
|
39
|
+
executeTool,
|
|
40
|
+
listAllProviders,
|
|
41
|
+
resolveApiKeyForProvider,
|
|
42
|
+
resolveProvider,
|
|
43
|
+
runAgentLoop,
|
|
44
|
+
toolsToDefinitions
|
|
45
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AgentRuntime,
|
|
3
|
+
EmailChannel,
|
|
4
|
+
FollowUpScheduler,
|
|
5
|
+
SessionManager,
|
|
6
|
+
SubAgentManager,
|
|
7
|
+
ToolRegistry,
|
|
8
|
+
callLLM,
|
|
9
|
+
createAgentRuntime,
|
|
10
|
+
createNoopHooks,
|
|
11
|
+
createRuntimeHooks,
|
|
12
|
+
estimateMessageTokens,
|
|
13
|
+
estimateTokens,
|
|
14
|
+
executeTool,
|
|
15
|
+
runAgentLoop,
|
|
16
|
+
toolsToDefinitions
|
|
17
|
+
} from "./chunk-2DJEQCRU.js";
|
|
18
|
+
import {
|
|
19
|
+
PROVIDER_REGISTRY,
|
|
20
|
+
listAllProviders,
|
|
21
|
+
resolveApiKeyForProvider,
|
|
22
|
+
resolveProvider
|
|
23
|
+
} from "./chunk-UF3ZJMJO.js";
|
|
24
|
+
import "./chunk-KFQGP6VL.js";
|
|
25
|
+
export {
|
|
26
|
+
AgentRuntime,
|
|
27
|
+
EmailChannel,
|
|
28
|
+
FollowUpScheduler,
|
|
29
|
+
PROVIDER_REGISTRY,
|
|
30
|
+
SessionManager,
|
|
31
|
+
SubAgentManager,
|
|
32
|
+
ToolRegistry,
|
|
33
|
+
callLLM,
|
|
34
|
+
createAgentRuntime,
|
|
35
|
+
createNoopHooks,
|
|
36
|
+
createRuntimeHooks,
|
|
37
|
+
estimateMessageTokens,
|
|
38
|
+
estimateTokens,
|
|
39
|
+
executeTool,
|
|
40
|
+
listAllProviders,
|
|
41
|
+
resolveApiKeyForProvider,
|
|
42
|
+
resolveProvider,
|
|
43
|
+
runAgentLoop,
|
|
44
|
+
toolsToDefinitions
|
|
45
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AgentRuntime,
|
|
3
|
+
EmailChannel,
|
|
4
|
+
FollowUpScheduler,
|
|
5
|
+
SessionManager,
|
|
6
|
+
SubAgentManager,
|
|
7
|
+
ToolRegistry,
|
|
8
|
+
callLLM,
|
|
9
|
+
createAgentRuntime,
|
|
10
|
+
createNoopHooks,
|
|
11
|
+
createRuntimeHooks,
|
|
12
|
+
estimateMessageTokens,
|
|
13
|
+
estimateTokens,
|
|
14
|
+
executeTool,
|
|
15
|
+
runAgentLoop,
|
|
16
|
+
toolsToDefinitions
|
|
17
|
+
} from "./chunk-VBLS4HXF.js";
|
|
18
|
+
import {
|
|
19
|
+
PROVIDER_REGISTRY,
|
|
20
|
+
listAllProviders,
|
|
21
|
+
resolveApiKeyForProvider,
|
|
22
|
+
resolveProvider
|
|
23
|
+
} from "./chunk-UF3ZJMJO.js";
|
|
24
|
+
import "./chunk-KFQGP6VL.js";
|
|
25
|
+
export {
|
|
26
|
+
AgentRuntime,
|
|
27
|
+
EmailChannel,
|
|
28
|
+
FollowUpScheduler,
|
|
29
|
+
PROVIDER_REGISTRY,
|
|
30
|
+
SessionManager,
|
|
31
|
+
SubAgentManager,
|
|
32
|
+
ToolRegistry,
|
|
33
|
+
callLLM,
|
|
34
|
+
createAgentRuntime,
|
|
35
|
+
createNoopHooks,
|
|
36
|
+
createRuntimeHooks,
|
|
37
|
+
estimateMessageTokens,
|
|
38
|
+
estimateTokens,
|
|
39
|
+
executeTool,
|
|
40
|
+
listAllProviders,
|
|
41
|
+
resolveApiKeyForProvider,
|
|
42
|
+
resolveProvider,
|
|
43
|
+
runAgentLoop,
|
|
44
|
+
toolsToDefinitions
|
|
45
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AgentRuntime,
|
|
3
|
+
EmailChannel,
|
|
4
|
+
FollowUpScheduler,
|
|
5
|
+
SessionManager,
|
|
6
|
+
SubAgentManager,
|
|
7
|
+
ToolRegistry,
|
|
8
|
+
callLLM,
|
|
9
|
+
createAgentRuntime,
|
|
10
|
+
createNoopHooks,
|
|
11
|
+
createRuntimeHooks,
|
|
12
|
+
estimateMessageTokens,
|
|
13
|
+
estimateTokens,
|
|
14
|
+
executeTool,
|
|
15
|
+
runAgentLoop,
|
|
16
|
+
toolsToDefinitions
|
|
17
|
+
} from "./chunk-ZJZ5N4SD.js";
|
|
18
|
+
import {
|
|
19
|
+
PROVIDER_REGISTRY,
|
|
20
|
+
listAllProviders,
|
|
21
|
+
resolveApiKeyForProvider,
|
|
22
|
+
resolveProvider
|
|
23
|
+
} from "./chunk-UF3ZJMJO.js";
|
|
24
|
+
import "./chunk-KFQGP6VL.js";
|
|
25
|
+
export {
|
|
26
|
+
AgentRuntime,
|
|
27
|
+
EmailChannel,
|
|
28
|
+
FollowUpScheduler,
|
|
29
|
+
PROVIDER_REGISTRY,
|
|
30
|
+
SessionManager,
|
|
31
|
+
SubAgentManager,
|
|
32
|
+
ToolRegistry,
|
|
33
|
+
callLLM,
|
|
34
|
+
createAgentRuntime,
|
|
35
|
+
createNoopHooks,
|
|
36
|
+
createRuntimeHooks,
|
|
37
|
+
estimateMessageTokens,
|
|
38
|
+
estimateTokens,
|
|
39
|
+
executeTool,
|
|
40
|
+
listAllProviders,
|
|
41
|
+
resolveApiKeyForProvider,
|
|
42
|
+
resolveProvider,
|
|
43
|
+
runAgentLoop,
|
|
44
|
+
toolsToDefinitions
|
|
45
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createServer
|
|
3
|
+
} from "./chunk-LIHFQM2M.js";
|
|
4
|
+
import "./chunk-OF4MUWWS.js";
|
|
5
|
+
import "./chunk-UF3ZJMJO.js";
|
|
6
|
+
import "./chunk-3OC6RH7W.js";
|
|
7
|
+
import "./chunk-2DDKGTD6.js";
|
|
8
|
+
import "./chunk-YVK6F5OD.js";
|
|
9
|
+
import "./chunk-MKRNEM5A.js";
|
|
10
|
+
import "./chunk-DRXMYYKN.js";
|
|
11
|
+
import "./chunk-6WSX7QXF.js";
|
|
12
|
+
import "./chunk-KFQGP6VL.js";
|
|
13
|
+
export {
|
|
14
|
+
createServer
|
|
15
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createServer
|
|
3
|
+
} from "./chunk-APRK35OM.js";
|
|
4
|
+
import "./chunk-OF4MUWWS.js";
|
|
5
|
+
import "./chunk-UF3ZJMJO.js";
|
|
6
|
+
import "./chunk-3OC6RH7W.js";
|
|
7
|
+
import "./chunk-2DDKGTD6.js";
|
|
8
|
+
import "./chunk-YVK6F5OD.js";
|
|
9
|
+
import "./chunk-MKRNEM5A.js";
|
|
10
|
+
import "./chunk-DRXMYYKN.js";
|
|
11
|
+
import "./chunk-6WSX7QXF.js";
|
|
12
|
+
import "./chunk-KFQGP6VL.js";
|
|
13
|
+
export {
|
|
14
|
+
createServer
|
|
15
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createServer
|
|
3
|
+
} from "./chunk-W5MVEM4M.js";
|
|
4
|
+
import "./chunk-OF4MUWWS.js";
|
|
5
|
+
import "./chunk-UF3ZJMJO.js";
|
|
6
|
+
import "./chunk-3OC6RH7W.js";
|
|
7
|
+
import "./chunk-2DDKGTD6.js";
|
|
8
|
+
import "./chunk-YVK6F5OD.js";
|
|
9
|
+
import "./chunk-MKRNEM5A.js";
|
|
10
|
+
import "./chunk-DRXMYYKN.js";
|
|
11
|
+
import "./chunk-6WSX7QXF.js";
|
|
12
|
+
import "./chunk-KFQGP6VL.js";
|
|
13
|
+
export {
|
|
14
|
+
createServer
|
|
15
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createServer
|
|
3
|
+
} from "./chunk-BTT3P4XP.js";
|
|
4
|
+
import "./chunk-OF4MUWWS.js";
|
|
5
|
+
import "./chunk-UF3ZJMJO.js";
|
|
6
|
+
import "./chunk-3OC6RH7W.js";
|
|
7
|
+
import "./chunk-2DDKGTD6.js";
|
|
8
|
+
import "./chunk-YVK6F5OD.js";
|
|
9
|
+
import "./chunk-MKRNEM5A.js";
|
|
10
|
+
import "./chunk-DRXMYYKN.js";
|
|
11
|
+
import "./chunk-6WSX7QXF.js";
|
|
12
|
+
import "./chunk-KFQGP6VL.js";
|
|
13
|
+
export {
|
|
14
|
+
createServer
|
|
15
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createServer
|
|
3
|
+
} from "./chunk-RTW7WNXZ.js";
|
|
4
|
+
import "./chunk-OF4MUWWS.js";
|
|
5
|
+
import "./chunk-UF3ZJMJO.js";
|
|
6
|
+
import "./chunk-3OC6RH7W.js";
|
|
7
|
+
import "./chunk-2DDKGTD6.js";
|
|
8
|
+
import "./chunk-YVK6F5OD.js";
|
|
9
|
+
import "./chunk-MKRNEM5A.js";
|
|
10
|
+
import "./chunk-DRXMYYKN.js";
|
|
11
|
+
import "./chunk-6WSX7QXF.js";
|
|
12
|
+
import "./chunk-KFQGP6VL.js";
|
|
13
|
+
export {
|
|
14
|
+
createServer
|
|
15
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
promptCompanyInfo,
|
|
3
|
+
promptDatabase,
|
|
4
|
+
promptDeployment,
|
|
5
|
+
promptDomain,
|
|
6
|
+
promptRegistration,
|
|
7
|
+
provision,
|
|
8
|
+
runSetupWizard
|
|
9
|
+
} from "./chunk-L72IFQCJ.js";
|
|
10
|
+
import "./chunk-VQQ4SYYQ.js";
|
|
11
|
+
import "./chunk-KFQGP6VL.js";
|
|
12
|
+
export {
|
|
13
|
+
promptCompanyInfo,
|
|
14
|
+
promptDatabase,
|
|
15
|
+
promptDeployment,
|
|
16
|
+
promptDomain,
|
|
17
|
+
promptRegistration,
|
|
18
|
+
provision,
|
|
19
|
+
runSetupWizard
|
|
20
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
promptCompanyInfo,
|
|
3
|
+
promptDatabase,
|
|
4
|
+
promptDeployment,
|
|
5
|
+
promptDomain,
|
|
6
|
+
promptRegistration,
|
|
7
|
+
provision,
|
|
8
|
+
runSetupWizard
|
|
9
|
+
} from "./chunk-6PIWF5AC.js";
|
|
10
|
+
import "./chunk-VQQ4SYYQ.js";
|
|
11
|
+
import "./chunk-KFQGP6VL.js";
|
|
12
|
+
export {
|
|
13
|
+
promptCompanyInfo,
|
|
14
|
+
promptDatabase,
|
|
15
|
+
promptDeployment,
|
|
16
|
+
promptDomain,
|
|
17
|
+
promptRegistration,
|
|
18
|
+
provision,
|
|
19
|
+
runSetupWizard
|
|
20
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
promptCompanyInfo,
|
|
3
|
+
promptDatabase,
|
|
4
|
+
promptDeployment,
|
|
5
|
+
promptDomain,
|
|
6
|
+
promptRegistration,
|
|
7
|
+
provision,
|
|
8
|
+
runSetupWizard
|
|
9
|
+
} from "./chunk-D7SBTNBI.js";
|
|
10
|
+
import "./chunk-VQQ4SYYQ.js";
|
|
11
|
+
import "./chunk-KFQGP6VL.js";
|
|
12
|
+
export {
|
|
13
|
+
promptCompanyInfo,
|
|
14
|
+
promptDatabase,
|
|
15
|
+
promptDeployment,
|
|
16
|
+
promptDomain,
|
|
17
|
+
promptRegistration,
|
|
18
|
+
provision,
|
|
19
|
+
runSetupWizard
|
|
20
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
promptCompanyInfo,
|
|
3
|
+
promptDatabase,
|
|
4
|
+
promptDeployment,
|
|
5
|
+
promptDomain,
|
|
6
|
+
promptRegistration,
|
|
7
|
+
provision,
|
|
8
|
+
runSetupWizard
|
|
9
|
+
} from "./chunk-ZKSOJILT.js";
|
|
10
|
+
import "./chunk-VQQ4SYYQ.js";
|
|
11
|
+
import "./chunk-KFQGP6VL.js";
|
|
12
|
+
export {
|
|
13
|
+
promptCompanyInfo,
|
|
14
|
+
promptDatabase,
|
|
15
|
+
promptDeployment,
|
|
16
|
+
promptDomain,
|
|
17
|
+
promptRegistration,
|
|
18
|
+
provision,
|
|
19
|
+
runSetupWizard
|
|
20
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
promptCompanyInfo,
|
|
3
|
+
promptDatabase,
|
|
4
|
+
promptDeployment,
|
|
5
|
+
promptDomain,
|
|
6
|
+
promptRegistration,
|
|
7
|
+
provision,
|
|
8
|
+
runSetupWizard
|
|
9
|
+
} from "./chunk-FEEHLIWF.js";
|
|
10
|
+
import "./chunk-VQQ4SYYQ.js";
|
|
11
|
+
import "./chunk-KFQGP6VL.js";
|
|
12
|
+
export {
|
|
13
|
+
promptCompanyInfo,
|
|
14
|
+
promptDatabase,
|
|
15
|
+
promptDeployment,
|
|
16
|
+
promptDomain,
|
|
17
|
+
promptRegistration,
|
|
18
|
+
provision,
|
|
19
|
+
runSetupWizard
|
|
20
|
+
};
|
package/package.json
CHANGED
package/src/cli-agent.ts
CHANGED
|
@@ -21,6 +21,9 @@
|
|
|
21
21
|
import { Hono } from 'hono';
|
|
22
22
|
import { serve } from '@hono/node-server';
|
|
23
23
|
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
24
|
+
import { TaskQueueManager } from './engine/task-queue.js';
|
|
25
|
+
import { beforeSpawn } from './engine/task-queue-before-spawn.js';
|
|
26
|
+
import { afterSpawn, markInProgress } from './engine/task-queue-after-spawn.js';
|
|
24
27
|
|
|
25
28
|
// ════════════════════════════════════════════════════════════
|
|
26
29
|
// SYSTEM DEPENDENCY AUTO-INSTALLER
|
|
@@ -567,6 +570,10 @@ export async function runAgent(_args: string[]) {
|
|
|
567
570
|
await runtime.start();
|
|
568
571
|
const runtimeApp = runtime.getApp();
|
|
569
572
|
|
|
573
|
+
// ─── Task Pipeline ──────────────────────────────────────
|
|
574
|
+
const taskQueue = new TaskQueueManager();
|
|
575
|
+
try { (taskQueue as any).db = engineDb; await taskQueue.init(); } catch (e: any) { console.warn(`[task-pipeline] Init: ${e.message}`); }
|
|
576
|
+
|
|
570
577
|
// ─── Real-Time Status Reporting ─────────────────────────
|
|
571
578
|
// Report status to the enterprise server (separate process)
|
|
572
579
|
const ENTERPRISE_URL = process.env.ENTERPRISE_URL || 'http://localhost:3100';
|
|
@@ -879,6 +886,22 @@ export async function runAgent(_args: string[]) {
|
|
|
879
886
|
}
|
|
880
887
|
}
|
|
881
888
|
|
|
889
|
+
// Record task in pipeline BEFORE spawning
|
|
890
|
+
let taskId: string | undefined;
|
|
891
|
+
try {
|
|
892
|
+
const agentDisplayName = agent.display_name || agent.name || 'Agent';
|
|
893
|
+
taskId = await beforeSpawn(taskQueue, {
|
|
894
|
+
orgId: agent.org_id || '',
|
|
895
|
+
agentId: agentId,
|
|
896
|
+
agentName: agentDisplayName,
|
|
897
|
+
createdBy: ctx.senderEmail || ctx.senderName || 'external',
|
|
898
|
+
createdByName: ctx.senderName || ctx.senderEmail || 'User',
|
|
899
|
+
task: ctx.messageText,
|
|
900
|
+
model: config.model || process.env.AGENTICMAIL_MODEL,
|
|
901
|
+
sessionId: undefined,
|
|
902
|
+
});
|
|
903
|
+
} catch (e: any) { /* non-fatal */ }
|
|
904
|
+
|
|
882
905
|
const session = await runtime.spawnSession({
|
|
883
906
|
agentId: agentId,
|
|
884
907
|
message: ctx.messageText,
|
|
@@ -886,6 +909,11 @@ export async function runAgent(_args: string[]) {
|
|
|
886
909
|
...(sessionContext ? { sessionContext } : {}),
|
|
887
910
|
});
|
|
888
911
|
|
|
912
|
+
// Mark task as in progress
|
|
913
|
+
if (taskId) {
|
|
914
|
+
markInProgress(taskQueue, taskId, { sessionId: session.id }).catch(() => {});
|
|
915
|
+
}
|
|
916
|
+
|
|
889
917
|
// Register in session router
|
|
890
918
|
sessionRouter.register({
|
|
891
919
|
sessionId: session.id,
|
|
@@ -900,6 +928,21 @@ export async function runAgent(_args: string[]) {
|
|
|
900
928
|
runtime.onSessionComplete(session.id, async (result: any) => {
|
|
901
929
|
sessionRouter?.unregister(agentId, session.id);
|
|
902
930
|
|
|
931
|
+
// Record task completion in pipeline
|
|
932
|
+
if (taskId) {
|
|
933
|
+
const usage = result?.usage || {};
|
|
934
|
+
afterSpawn(taskQueue, {
|
|
935
|
+
taskId,
|
|
936
|
+
status: result?.error ? 'failed' : 'completed',
|
|
937
|
+
error: result?.error?.message || result?.error,
|
|
938
|
+
modelUsed: result?.model || config.model,
|
|
939
|
+
tokensUsed: (usage.inputTokens || 0) + (usage.outputTokens || 0),
|
|
940
|
+
costUsd: usage.cost || 0,
|
|
941
|
+
sessionId: session.id,
|
|
942
|
+
result: { messageCount: (result?.messages || []).length },
|
|
943
|
+
}).catch(() => {});
|
|
944
|
+
}
|
|
945
|
+
|
|
903
946
|
// Check if agent sent a reply via the appropriate tool
|
|
904
947
|
const messages = result?.messages || [];
|
|
905
948
|
const sendToolNames = isMessagingSource
|
|
@@ -56,16 +56,46 @@ export function createAgentRoutes(opts: {
|
|
|
56
56
|
router.patch('/agents/:id/config', async (c) => {
|
|
57
57
|
const { updates, updatedBy } = await c.req.json();
|
|
58
58
|
try {
|
|
59
|
+
const agentId = c.req.param('id');
|
|
59
60
|
const actor = c.req.header('X-User-Id') || updatedBy;
|
|
60
|
-
|
|
61
|
+
|
|
62
|
+
// Capture old deployment config for change detection
|
|
63
|
+
const oldAgent = lifecycle.getAgent(agentId);
|
|
64
|
+
const oldDep = oldAgent?.config?.deployment;
|
|
65
|
+
|
|
66
|
+
const agent = await lifecycle.updateConfig(agentId, updates, actor);
|
|
67
|
+
|
|
61
68
|
// Sync name/email to admin agents table
|
|
62
69
|
const adminDb = getAdminDb();
|
|
63
70
|
if (adminDb && (updates.name || updates.email)) {
|
|
64
71
|
const sync: any = {};
|
|
65
72
|
if (updates.name) sync.name = updates.name;
|
|
66
73
|
if (updates.email) sync.email = updates.email;
|
|
67
|
-
adminDb.updateAgent(
|
|
74
|
+
adminDb.updateAgent(agentId, sync).catch(() => {});
|
|
68
75
|
}
|
|
76
|
+
|
|
77
|
+
// Auto-restart agent if deployment config changed (port, host, target)
|
|
78
|
+
if (updates.deployment) {
|
|
79
|
+
const newDep = agent.config?.deployment;
|
|
80
|
+
const portChanged = oldDep?.port !== newDep?.port;
|
|
81
|
+
const hostChanged = oldDep?.host !== newDep?.host;
|
|
82
|
+
const targetChanged = oldDep?.target !== newDep?.target;
|
|
83
|
+
if (portChanged || hostChanged || targetChanged) {
|
|
84
|
+
console.log(`[agent-routes] Deployment config changed for ${agent.name || agentId} (port: ${oldDep?.port}→${newDep?.port}, host: ${oldDep?.host}→${newDep?.host}). Triggering agent restart...`);
|
|
85
|
+
// Try PM2 restart for locally deployed agents
|
|
86
|
+
try {
|
|
87
|
+
const { exec } = await import('node:child_process');
|
|
88
|
+
const pm2Name = (agent.name || '').toLowerCase().replace(/\s+/g, '-') + '-agent';
|
|
89
|
+
exec(`pm2 restart ${pm2Name} --update-env 2>/dev/null || pm2 restart ${agentId} --update-env 2>/dev/null`, (err) => {
|
|
90
|
+
if (err) console.warn(`[agent-routes] PM2 restart for ${pm2Name} failed (may not be PM2-managed): ${err.message}`);
|
|
91
|
+
else console.log(`[agent-routes] PM2 restart triggered for ${pm2Name}`);
|
|
92
|
+
});
|
|
93
|
+
} catch (e: any) {
|
|
94
|
+
console.warn(`[agent-routes] Agent restart failed: ${e.message}`);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
69
99
|
return c.json({ agent });
|
|
70
100
|
} catch (e: any) {
|
|
71
101
|
return c.json({ error: e.message }, 400);
|
|
@@ -49,6 +49,20 @@ export class MessagingPoller {
|
|
|
49
49
|
this.config = config;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
/** Resolve fresh agent endpoint from lifecycle (picks up port/host changes) */
|
|
53
|
+
private resolveEndpoint(agentId: string, fallback: AgentEndpoint): AgentEndpoint {
|
|
54
|
+
try {
|
|
55
|
+
var managed = this.config.lifecycle.getAgent(agentId);
|
|
56
|
+
if (managed) {
|
|
57
|
+
var dep = managed.config?.deployment;
|
|
58
|
+
var port = dep?.port || dep?.config?.local?.port || fallback.port;
|
|
59
|
+
var host = dep?.host || dep?.config?.local?.host || fallback.host;
|
|
60
|
+
return { ...fallback, port, host };
|
|
61
|
+
}
|
|
62
|
+
} catch {}
|
|
63
|
+
return fallback;
|
|
64
|
+
}
|
|
65
|
+
|
|
52
66
|
async start() {
|
|
53
67
|
if (this.running) return;
|
|
54
68
|
this.running = true;
|
|
@@ -437,7 +451,9 @@ export class MessagingPoller {
|
|
|
437
451
|
}).catch(() => {});
|
|
438
452
|
}
|
|
439
453
|
try {
|
|
440
|
-
var
|
|
454
|
+
var resolved = this.resolveEndpoint(agent.id, agent);
|
|
455
|
+
console.log(`[messaging] Dispatching to ${agent.displayName} at ${resolved.host}:${resolved.port}`);
|
|
456
|
+
var resp = await fetch(`http://${resolved.host}:${resolved.port}/api/runtime/chat`, {
|
|
441
457
|
method: 'POST',
|
|
442
458
|
headers: { 'Content-Type': 'application/json' },
|
|
443
459
|
body: JSON.stringify({
|
package/src/engine/routes.ts
CHANGED
|
@@ -684,10 +684,11 @@ let _messagingPoller: MessagingPoller | null = null;
|
|
|
684
684
|
|
|
685
685
|
async function startMessagingPoller(engineDb: any): Promise<void> {
|
|
686
686
|
const allAgents = lifecycle.getAllAgents();
|
|
687
|
-
const agents = allAgents.filter(a => a.state === 'running' || (a as any).status === 'active').map(a => {
|
|
687
|
+
const agents = allAgents.filter(a => a.state === 'running' || a.state === 'draft' || a.state === 'stopped' || (a as any).status === 'active').map(a => {
|
|
688
688
|
const dep = a.config?.deployment;
|
|
689
689
|
const port = dep?.port || dep?.config?.local?.port || 3100;
|
|
690
690
|
const host = dep?.host || dep?.config?.local?.host || 'localhost';
|
|
691
|
+
// Debug removed — dynamic resolution in messaging-poller.resolveEndpoint()
|
|
691
692
|
return {
|
|
692
693
|
id: a.id, name: a.name || '', displayName: (a.config as any)?.displayName || a.name || a.id,
|
|
693
694
|
status: 'active' as const, port, host,
|
package/src/runtime/gateway.ts
CHANGED
|
@@ -245,51 +245,6 @@ export function createRuntimeGateway(config: GatewayConfig): Hono {
|
|
|
245
245
|
|
|
246
246
|
// ─── Inbound Email Hook ──────────────────────────
|
|
247
247
|
|
|
248
|
-
// ─── Chat dispatch (from enterprise messaging/chat pollers) ──
|
|
249
|
-
app.post('/chat', async function(c) {
|
|
250
|
-
try {
|
|
251
|
-
var body = await c.req.json();
|
|
252
|
-
// Find or create a session for this chat context
|
|
253
|
-
var source = body.source || body.spaceName || 'unknown';
|
|
254
|
-
var spaceId = body.spaceId || body.chatId || 'default';
|
|
255
|
-
var sessionTag = source + ':' + spaceId;
|
|
256
|
-
|
|
257
|
-
// Look for existing session with this tag
|
|
258
|
-
var sessions = await runtime.listSessions();
|
|
259
|
-
var existing = sessions.find(function(s: any) { return s.tag === sessionTag && s.status === 'active'; });
|
|
260
|
-
var session: any;
|
|
261
|
-
|
|
262
|
-
if (existing) {
|
|
263
|
-
session = existing;
|
|
264
|
-
} else {
|
|
265
|
-
// Create new session
|
|
266
|
-
session = await runtime.createSession({
|
|
267
|
-
tag: sessionTag,
|
|
268
|
-
metadata: { source: source, spaceId: spaceId, senderName: body.senderName, isDM: body.isDM },
|
|
269
|
-
});
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
// Send message to the session
|
|
273
|
-
await runtime.sendMessage(session.id, body.messageText || body.message || '', {
|
|
274
|
-
senderName: body.senderName,
|
|
275
|
-
senderEmail: body.senderEmail,
|
|
276
|
-
source: source,
|
|
277
|
-
isDM: body.isDM,
|
|
278
|
-
isManager: body.isManager,
|
|
279
|
-
priority: body.priority,
|
|
280
|
-
messageId: body.messageId,
|
|
281
|
-
isCustomer: body.isCustomer,
|
|
282
|
-
customerSystemPrompt: body.customerSystemPrompt,
|
|
283
|
-
restrictTools: body.restrictTools,
|
|
284
|
-
});
|
|
285
|
-
|
|
286
|
-
return c.json({ ok: true, sessionId: session.id });
|
|
287
|
-
} catch (err: any) {
|
|
288
|
-
console.error('[runtime] /chat error:', err.message);
|
|
289
|
-
return c.json({ error: err.message }, 500);
|
|
290
|
-
}
|
|
291
|
-
});
|
|
292
|
-
|
|
293
248
|
app.post('/hooks/inbound', async function(c) {
|
|
294
249
|
try {
|
|
295
250
|
var body = await c.req.json();
|