mirror of
https://dev.azure.com/globalhealthx/EMR/_git/helix-engage
synced 2026-04-11 18:28:15 +00:00
feat: dynamic SIP from agentConfig, logout cleanup, heartbeat
- SIP provider reads credentials from agentConfig (login response) - Auth logout calls sidecar to unlock Redis + Ozonetel logout - AppShell heartbeat every 5 min for CC agents - Login stores agentConfig in localStorage Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import type { ReactNode } from 'react';
|
||||
import { useEffect, type ReactNode } from 'react';
|
||||
import { useLocation } from 'react-router';
|
||||
import { Sidebar } from './sidebar';
|
||||
import { SipProvider } from '@/providers/sip-provider';
|
||||
@@ -13,6 +13,25 @@ export const AppShell = ({ children }: AppShellProps) => {
|
||||
const { pathname } = useLocation();
|
||||
const { isCCAgent } = useAuth();
|
||||
|
||||
// Heartbeat: keep agent session alive in Redis (CC agents only)
|
||||
useEffect(() => {
|
||||
if (!isCCAgent) return;
|
||||
|
||||
const beat = () => {
|
||||
const token = localStorage.getItem('helix_access_token');
|
||||
if (token) {
|
||||
const apiUrl = import.meta.env.VITE_API_URL ?? 'http://localhost:4100';
|
||||
fetch(`${apiUrl}/auth/heartbeat`, {
|
||||
method: 'POST',
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
}).catch(() => {});
|
||||
}
|
||||
};
|
||||
|
||||
const interval = setInterval(beat, 5 * 60 * 1000);
|
||||
return () => clearInterval(interval);
|
||||
}, [isCCAgent]);
|
||||
|
||||
return (
|
||||
<SipProvider>
|
||||
<div className="flex h-screen bg-primary">
|
||||
|
||||
Reference in New Issue
Block a user