- dashboard/: Vite 5 + React 18 + TypeScript strict SPA
- Auth: sessionStorage credentials, TokenManager validation, AuthProvider context
- Pages: Login, Agents (search + filter), AgentDetail (suspend/reactivate),
Credentials (generate/rotate/revoke, new secret shown once),
AuditLog (filters + pagination), Health (PG + Redis status, 30s refresh)
- Components: Button, Badge, ConfirmDialog, AppShell, RequireAuth
- All destructive actions gated by ConfirmDialog
- Zero dangerouslySetInnerHTML; sessionStorage only (OWASP compliant)
- src/routes/health.ts: unauthenticated GET /health — PG + Redis connectivity
- src/app.ts: health route + dashboard/dist/ served at /dashboard with SPA fallback
- 6 new health route tests; 308/308 unit tests passing
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
19 lines
542 B
TypeScript
19 lines
542 B
TypeScript
import { AgentIdPClient } from '@sentryagent/idp-sdk';
|
|
import { loadCredentials } from './auth';
|
|
|
|
/**
|
|
* Returns an AgentIdPClient configured with credentials from sessionStorage.
|
|
* Throws if not authenticated (caller must ensure login first).
|
|
*/
|
|
export function getClient(): AgentIdPClient {
|
|
const creds = loadCredentials();
|
|
if (!creds) {
|
|
throw new Error('Not authenticated. Please log in.');
|
|
}
|
|
return new AgentIdPClient({
|
|
baseUrl: creds.baseUrl,
|
|
clientId: creds.clientId,
|
|
clientSecret: creds.clientSecret,
|
|
});
|
|
}
|