learning_ai_clock/backend/src/lib/telemetry-events.ts
saravanakumardb1 9897d2cd09 docs(todos): standardize all TODOs with running numbers and delegatable instructions
Replace ad-hoc AGENTIC-N comments with standardized TODO-NNN format across
the entire codebase. Each TODO has:
  - Running number (TODO-001 through TODO-011)
  - Priority level (high/medium/low)
  - Phase reference (0, A.1, A.4, B, cleanup)
  - Clear step-by-step instructions an AI agent can follow

TODO index:
  TODO-001: Kill switch maintenance banner (providers.tsx)
  TODO-002: Feedback button in settings page
  TODO-003: Accessibility focus trap for modals
  TODO-004: Clone routine template instead of mutating in-place
  TODO-005: Wire real LLM enrichment for context messages
  TODO-006: Centralize backend URL configuration
  TODO-007: MCP tool integration tests (common-plat)
  TODO-008: Wire trackEvent() calls into routes + components
  TODO-009: Unit tests for AI context generation
  TODO-010: Import PRODUCT_ID from product-config (5 route files)
  TODO-011: Wire error boundary to telemetry

Added consolidated TODO Index table at top of AGENTIC_AI_ROADMAP.md
for agent scanning. 219 backend tests pass, no code changes.
2026-04-01 01:05:25 -07:00

47 lines
2.9 KiB
TypeScript

/**
* Telemetry event name constants for all agentic AI features.
*
* Centralised here so backend routes and web components can reference
* a single source of truth for event names (Phase 0.5).
*
* TODO-008: Wire trackEvent() calls into backend routes
* Priority: medium | Phase: B
* These constants are defined but not yet imported anywhere. Wire them in:
* - agent-actions/routes.ts: AGENT_INBOX_ACTION_APPROVED on approve,
* AGENT_INBOX_ACTION_REJECTED on reject, AGENT_INBOX_BATCH_APPROVED on batch
* - server.ts context-message route: AI_CONTEXT_ENRICHED when source='llm',
* AI_CONTEXT_FALLBACK_USED when source='keyword' or 'generic'
* - Use: import { bufferEvent } from './telemetry.js' then bufferEvent(EVENT_NAME, { ...metadata })
*/
// ── MCP ───────────────────────────────────────────────────────
export const MCP_TOOL_EXECUTED = 'mcp.tool_executed';
export const MCP_TOOL_FAILED = 'mcp.tool_failed';
// ── Day Planner ───────────────────────────────────────────────
export const PLANNER_DAY_PLANNED = 'planner.day_planned';
export const PLANNER_PLAN_APPLIED = 'planner.plan_applied';
export const PLANNER_PLAN_REJECTED = 'planner.plan_rejected';
// ── Agent Inbox ───────────────────────────────────────────────
export const AGENT_INBOX_ACTION_APPROVED = 'agent_inbox.action_approved';
export const AGENT_INBOX_ACTION_REJECTED = 'agent_inbox.action_rejected';
export const AGENT_INBOX_BATCH_APPROVED = 'agent_inbox.batch_approved';
// ── Tempo Mode ────────────────────────────────────────────────
export const TEMPO_DRIFT_DETECTED = 'tempo.drift_detected';
export const TEMPO_ADJUSTMENT_APPLIED = 'tempo.adjustment_applied';
// ── Routine Suggestions ───────────────────────────────────────
export const ROUTINE_SUGGEST_SHOWN = 'routine_suggest.shown';
export const ROUTINE_SUGGEST_ACCEPTED = 'routine_suggest.accepted';
export const ROUTINE_SUGGEST_DISMISSED = 'routine_suggest.dismissed';
// ── AI Context Messages ───────────────────────────────────────
export const AI_CONTEXT_ENRICHED = 'ai_context.enriched';
export const AI_CONTEXT_FALLBACK_USED = 'ai_context.fallback_used';
// ── Webhooks ──────────────────────────────────────────────────
export const WEBHOOK_DISPATCHED = 'webhook.dispatched';
export const WEBHOOK_FAILED = 'webhook.failed';