learning_ai_clock/web/src/lib/kill-switch.ts
saravanakumardb1 f3e14e28dd feat(ecosystem): Phase 0 — kill-switch, feedback, accessibility, feature flags, telemetry events
Phase 0 of the Agentic AI Roadmap: ecosystem gap fixes.

- Add @bytelyst/kill-switch-client integration (web/src/lib/kill-switch.ts)
- Wire kill switch check into providers.tsx on app init
- Add @bytelyst/feedback-client integration (web/src/lib/feedback.ts)
- Add @bytelyst/accessibility to web dependencies
- Add 7 agentic feature flags to backend (all default false)
- Define 16 telemetry event constants (backend + web)
- Add AGENTIC_AI_ROADMAP.md with full Phase 0-E plan + audit findings

All 182 backend tests pass. All 394 web tests pass.
No breaking changes to existing functionality.
2026-03-31 23:26:37 -07:00

32 lines
954 B
TypeScript

/**
* Kill switch client — thin wrapper over @bytelyst/kill-switch-client.
*
* Checks platform-service on app init. If killed, disables timer creation
* and shows maintenance banner. Fail-open on any error (app stays usable).
*
* Privacy: sends productId + platform only. No PII.
*/
import { createKillSwitchClient } from '@bytelyst/kill-switch-client';
import { PRODUCT_ID, getBaseUrl } from './auth-api';
const killSwitchClient = createKillSwitchClient({
baseUrl: `${getBaseUrl()}/api`,
productId: PRODUCT_ID,
platform: 'web',
});
/**
* Check if the app is disabled via kill switch.
* Returns true if the app should be disabled.
* Fail-open: returns false on any error so the app stays usable.
*/
export async function checkKillSwitch(): Promise<boolean> {
const result = await killSwitchClient.check().catch(() => {
return { disabled: false, message: null };
});
return result.disabled;
}
export { killSwitchClient };