MCPcopy
hub / github.com/garrytan/gstack / getStatus

Function getStatus

browse/src/security.ts:640–662  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

638// ─── Status reporting (for shield icon via /health) ──────────
639
640export function getStatus(): StatusDetail {
641 const state = readSessionState();
642 const layers = state?.classifierStatus ?? {
643 testsavant: 'off',
644 transcript: 'off',
645 };
646 const canary = state?.canary ? 'ok' : 'off';
647
648 let status: SecurityStatus;
649 if (layers.testsavant === 'ok' && layers.transcript === 'ok' && canary === 'ok') {
650 status = 'protected';
651 } else if (layers.testsavant === 'off' && canary === 'off') {
652 status = 'inactive';
653 } else {
654 status = 'degraded';
655 }
656
657 return {
658 status,
659 layers: { ...layers, canary: canary as 'ok' | 'off' },
660 lastUpdated: state?.lastUpdated ?? new Date().toISOString(),
661 };
662}
663
664/**
665 * Extract url domain for logging. Never logs path or query string.

Callers 1

security.test.tsFile · 0.90

Calls 1

readSessionStateFunction · 0.85

Tested by

no test coverage detected