Let me define $B_t=A_t=e^{rt}$ $-$ to avoid confusing it with the geometric average $1/t\int S_u\text{d}u$. Your portfolio value is:
$$ V_t =\psi_tB_t+\phi_tS_t $$
To be self-financing we need to enforce one of the following equivalent conditions:
$$\begin{align}
& \text{[1]} \quad \text{d}V_t =\psi_t\text{d}B_t+\phi_t\text{d}S_t
\\[3pt]
& \text{[2]} \quad B_t\text{d}\psi_t+\text{d}\psi_t\text{d}B_t+S_t\text{d}\phi_t+\text{d}\phi_t\text{d}S_t=0
\end{align}$$
You haven't specified any dynamics for the asset $S_t$ but we will assume that the cross-term $\text{d}t\text{d}S_t$ is equal to $0$ which is true for all common models such as Black-Scholes or Heston. We will also assume the process $\psi_t$ is a diffusion:
$$\text{d}\psi_t=a_{\psi}(t,S_t)\text{d}t+b_{\psi}(t,S_t)\text{d}W_t$$
Case 1: $\phi_t=\int_0^t S_u\text{d}u$
Let us first compute the differential of $\phi_t$. Note $\phi_t=\phi(t)$ is a function of time $t$ thus:
$$\begin{align}
\text{d}\phi_t=\text{d}\left(\int_0^tS_u\text{d}u\right)=S_t\text{d}t
\end{align}$$
Hence:
$$\begin{align}
B_t\text{d}\psi_t+\text{d}\psi_t\text{d}B_t+S_t\text{d}\phi_t+\text{d}\phi_t\text{d}S_t & = B_t\text{d}\psi_t+\text{d}\psi_t\text{d}B_t+S_t^2\text{d}t+S_t\text{d}S_t\text{d}t
\\[3pt]
& = B_t\text{d}\psi_t+rB_t\text{d}\psi_t\text{d}t+S_t^2\text{d}t
\end{align}$$
Because the process $\psi_t$ is a diffusion, the cross-term $\text{d}\psi_t\text{d}t$ should also be null, hence:
$$\begin{align}
B_t\text{d}\psi_t+rB_t\text{d}\psi_t\text{d}t+S_t^2\text{d}t & = B_t\text{d}\psi_t+S_t^2\text{d}t
\end{align}$$
Therefore:
$$ \psi_t=\psi_0-\int_0^te^{-ru}S^2_u\text{d}u$$
Case 2: $\phi_t=S_t$
$$\begin{align}
B_t\text{d}\psi_t+\text{d}\psi_t\text{d}B_t+S_t\text{d}\phi_t+\text{d}\phi_t\text{d}S_t & = B_t\text{d}\psi_t+\underbrace{\text{d}\psi_t\text{d}B_t}_{0}+S_t\text{d}S_t+(\text{d}S_t)^2
\\[3pt]
& = B_t\text{d}\psi_t+S_t\text{d}S_t+(\text{d}S_t)^2
\end{align}$$
Therefore:
$$ \psi_t=\psi_0-\int_0^te^{-ru}S_u\text{d}S_u-\int_0^te^{-ru}(\text{d}S_u)^2$$
If we assume $S_t$ follows a diffusion of the form:
$$ \text{d}S_t = a_S(t,S_t)\text{d}t+b_S(t,S_t)\text{d}W_t$$
Then:
$$ \psi_t=\psi_0-\int_0^te^{-ru}\left(S_ua_S(u,S_u)+b^2_S(u,S_u)\right)\text{d}u-\int_0^te^{-ru}S_ub_S(u,S_u)\text{d}W_u$$