Assessing mediation with Cox models (in R) I conducted a simple survival analysis of the association between intervention A and outcome Y, where fu_y indicates the time-to-outcome (from the intervention).
coxph(Surv(tt_Y, Y) ~ A)

A collaborator suggested that M might be a mediator. I have data regarding the potential mediator and the time-to-mediator.
I followed the steps in here.
coxph(Surv(tt_Y, Y) ~ A)     # Step 1: Total Effect
coxph(Surv(tt_M, M) ~ A)     # Step 2: The effect of the IV onto the mediator
coxph(Surv(tt_Y, Y) ~ A + M) # Step 3: The effect of the mediator on the dependent variable

How can I calculate ACME (average causal mediation effect), ADE (average direct effect), and Proportion Mediated?
The mediate package does not seem to work with Cox models.
Let's assume for clarity that Y is death (binary with a date of the outcome), M is diabetes type 2 (binary with a date of the diagnosis) and A is a dietary intervention (binary with a date of intervention). M could potentially occur before A but these cases were excluded from the study. M cannot occur after Y. Y can occur without M.
 A: Before you start, see (a) whether A is significant in your second model as a predictor of M and (b) whether M is significant in something like your third model. As M is time varying, your third model isn't quite right. M should be included in the third model as a time-varying covariate, with survival modeled via the counting-process Surv(startTime, stopTime, event) outcome format.
If results of either of tests (a) or (b) is insignificant, there probably isn't much point in exploring mediation further.
If both are significant, suggesting potential mediation, this is outside my expertise. I provide some thoughts and links for getting started, pending a more informed answer.
Lange et al describe "A Simple Unified Approach for Estimating Natural Direct and Indirect Effects" for mediation analysis that can be applied to Cox and Aalen survival models. It's based on counterfactual modeling, described briefly by those authors:

... we will describe direct and indirect effects in terms of so-called nested counterfactuals, $Y_{a*,M_a}$, denoting the outcome that would have been observed if A were set to a* and M were set to the value it would have taken if A were set to a. In particular, we will compare $Y_{a,M_a}$ with $Y_{a*,M_a}$ to obtain a measure of the natural direct effect of changing the exposure from a to a*... Likewise, we will compare $Y_{a*,M_a}$ with $Y_{a*,M_a*}$ to obtain a measure of the natural indirect effect. The word “natural” refers to the fact that we let the mediator take the value it would take naturally when the exposure is set to a.

If you are doing counterfactual modeling, study for example "Causal Inference" by Hernán and Robins.
Here's the approach proposed by Lange et al. in outline, starting from the original data set:

(1) model ... the exposure [A] conditional on confounders
(2) model ... the mediator [M] conditional on exposure and baseline variables

Then "construct a new data set by repeating each observation in the original data set twice and including an additional variable A* capturing the 2 possible values of the exposure relative to the indirect path [via M]":

(3) Construct a new data set by repeating each observation in the original data set twice and including an additional variable A*, which is equal to the original exposure for the first replication and equal to the opposite of the actual exposure for the second replication. In addition, add an identification variable to indicate which data rows originate from the same subject.

Weight the extended data set to adjust the outcome-exposure relationship for covariates and to correct for the fact that the observed mediator value may differ from the counterfactual value expected from the value of A*:

(4) Compute [inverse-probability] weights by applying the fitted models from steps 1 and 2 to the new data set.

The paper describes some steps that might need to be taken to ensure stability of the weighting scheme. Finally,

(5) Fit a suitable model to the outcome including only A and A* (and perhaps their interaction) as covariates and weighted by the weights from the previous step.

The coefficients from the last model allow for the estimation of natural direct and indirect effects, as outlined in the first quote. Examples in SAS and R that show how to estimate confidence intervals are in supplementary material. Rochon et al. apply that approach to survival data.
Be warned: the reliability of such analysis can depend heavily on the quality of the probability models in steps (1) and (2), their application to step (4), and the outcome model (5). If those models are mis-specified, then I understand that the "causal" estimates can be wrong.
Also, I'm not clear how to take into account the time-varying nature of M in your case. For example, mediators investigated by Rochon et al. were types of therapy chosen at time = 0 for each patient, therapy choices that were thought to mediate the effect of another characteristic of the hospitals in the study.
As an alternate approach, Pratchke et al. argue for discrete-time survival modeling with Structural Equation Models.
