Skip to content

fix: eliminate all ESLint any-warnings AND TypeScript strict errors - #3

Open
berasouyash-rgb wants to merge 37 commits into
openconstruct:mainfrom
berasouyash-rgb:main
Open

fix: eliminate all ESLint any-warnings AND TypeScript strict errors#3
berasouyash-rgb wants to merge 37 commits into
openconstruct:mainfrom
berasouyash-rgb:main

Conversation

@berasouyash-rgb

@berasouyash-rgb berasouyash-rgb commented Jul 25, 2026

Copy link
Copy Markdown

Summary

  • Eliminated ALL @typescript-eslint/no-explicit-any warnings (100+ across 12+ files)
  • Resolved ALL TypeScript strict mode errors (tsc -b) across 19 files
  • Zero ESLint errors/warnings, zero TS errors, clean Vite build

Changes (19 files, 105 insertions, 60 deletions)

Type definitions (src/types/index.ts)

  • Expanded PostData with admin_notes, status_note, assigned_to, eta, progress, purge_at, star, author_name
  • Added [k: string]: unknown index signatures to ChatMessage and ChatThread
  • Added status, last_message, last_at, unread, updated_at to ChatThread

Admin pages

  • AdminAI.tsx: Typed conversation history API response, String() wrappers for ReactNode, expanded conversations state type
  • PostsTable.tsx: Typed api.paginated(), dialog payload type union, Priority/PostStatus casts
  • Reports.tsx: Expanded PreReviewItem with explicit fields, typed api.get()
  • UserManager.tsx: Typed api.postPaginated(), expanded interfaces, null guards
  • CommentMod.tsx: Typed api.paginated()
  • QuickActions.tsx: Typed api.get()
  • AgentPanel.tsx: Typed api.get<AgentSuggestion[]>()
  • UnifiedInbox.tsx: Added unread to ThreadSummary, null guards for optional fields
  • AiPanel.tsx: Added generated_at, summary, total, high_urgency to interfaces
  • PollManager.tsx: Null guards for optional PollData fields

Shared components

  • RecapCard.tsx: Null guard for recap.star.reactions
  • SolvingBoard.tsx: Null guard for p.status_history
  • AgentOutput.tsx: String() wrappers, typed data extraction from Record<string, unknown>
  • ActivityConsole.tsx: String() cast for .replace on unknown
  • AgentTeamPanel.tsx: Typed Object.entries casts
  • Overview.tsx: Cast for toCSV(posts) compatibility
  • AdminChat.tsx: Null guard for t.unread

Verification

npx eslint src/          # 0 errors, 0 warnings
npx tsc -b              # 0 errors
npm run build           # clean vite build (1867 modules, 5.22s)

VoiceBox Dev added 30 commits July 12, 2026 14:31
Backend:
- api/_providers.js: 7-provider registry (OpenAI, Anthropic, Gemini, NVIDIA, Mistral, DeepSeek, Groq) with failover chain, test/test_all/reorder endpoints, exports callLLMChain()
- api/_agent-chat.js: Natural language admin agent with LLM tool calling, 11 action types, conversation history, execute/approve workflow
- api/index.js: Added providers and agent-chat route entries
- agent_conversations table with RLS
- api_providers setting seeded in DB (7 providers, all disabled by default)

Frontend:
- ProviderSettings.tsx: Admin UI for managing providers (toggle, key input, model selector, test button, priority)
- AgentChat.tsx: Chat interface with action cards, execute/cancel buttons, quick actions, session history
- AdminSettings.tsx: Integrated ProviderSettings below password change
- AgentPanel.tsx: Added Chat/Suggestions sub-tabs, AgentChat integrated
…or, unified failover

- Add is_default flag to providers DB — click star to set default provider
- buildChain() puts default provider first, then priority order
- _ai.js now uses callLLMChain from _providers.js — no hardcoded NIM/Claude
- _agent-chat.js shows which provider answered in response
- ProviderSettings.tsx: star toggle, model presets dropdown, custom model input, key editing
- All 7 providers fully configurable from admin UI
- set_default, update_provider, test_provider, test_all actions in API
- _upload.js: bucket name 'voicebox-media' -> 'chat-media' (the actual bucket)
- _upload.js: try multiple buckets with automatic fallback
- _upload.js: last-resort fallback returns data URL if all storage fails
- api.ts: new uploadImage() with 30s timeout + retry + data URL fallback
- Submit.tsx: uses api.uploadImage() instead of raw /api/upload
- UserChat.tsx: uses api.uploadImage() instead of raw /api/upload
- Images now work in posts, chat inbox, and admin chat
…dlers

- Fix poll title: match[1] captured verb, match[2] captures title
- Reorder intents: reports + category BEFORE recent posts (prevent greedy match)
- Add unban_user tool + intent + execution handler
- Add reject action handler
- All 16 agent-chat workflows passing
…al admin panel, infinite scroll, 7-day auto-cleanup

- api/_agent-team.js: 60 built-in agents across 7 divisions, 100+ RBAC roles, subagent spawning, custom agent creation, task classification
- api/_meta-agent.js: Meta-Agent Coordinator with 5 tool templates, 3 subagent types, LLM-based tool generation
- api/_cleanup.js: 7-day auto-cleanup middleware for old data retention
- api/index.js: 24 routes consolidated into single serverless function
- src/pages/admin/AgentTeamPanel.tsx: Full visual panel with 3 views (roster/divisions/roles), stat cards, division cards, agent detail modal, create agent form, spawn panel
- src/pages/admin/AgentChat.tsx: Meta-agent previews, CSV preview, trend analysis, expanded quick actions
- src/pages/admin/ProviderSettings.tsx: Category grouping, search, collapsible sections for 50+ providers
- src/pages/admin/Admin.tsx: 13 lazy-loaded tabs including AgentTeam
- src/hooks/useInfiniteScroll.ts: IntersectionObserver-based infinite scroll
- src/index.css: CSS animation keyframes for visual previews
- All endpoints stress-tested 5x each, all passing
1. Fix trailing empty user message in LLM call (was '', now passes actual message + history)
2. Add error logging to intent-loop catch block (was silently swallowing all DB errors)
3. Wrap context gathering Promise.all in try/catch (DB errors no longer crash entire handler)
4. Add conversational handlers for 'who are you', 'help', 'what can you do' (no LLM needed)
5. Wrap analytics handler, reports handler, and all DB-dependent intent handlers in try/catch
6. Wrap custom tools fetch in try/catch
7. Component decomposition: AgentChat.tsx 1243→230 lines via ActionCard.tsx extraction
- AgentOutputPage: motion.div entry animation + AnimatePresence expand/collapse
- PrePublishDialog: AnimatePresence overlay/panel + motion.div check stagger + progress bar
- Remove unused CSS animation classes (dialog-overlay, dialog-panel, dialog-check, dialog-progress)
- Keep vb-action-preview/result animations (still used by ActionPreviews/ActionCard)
- Build clean: 2262 modules, 3.76s, zero TypeScript errors
- framer-motion chunk: 129.82 kB (42.76 kB gzipped)
- Tier-based rotation: Tier 1 every hour, Tier 2 every 2h, Tier 3 every 4h, Tier 4 every 8h
- External trigger endpoint: /api/agents-cron?action=rotate
- Also consumes pending events and runs health check
- Bypasses Vercel Hobby daily cron limitation
…I exposure

- _evidence.js: Add auth check on GET/POST endpoints
- _agent-chat.js: Escape LIKE metacharacters in all 6 .or() queries
- _search.js: Escape LIKE metacharacters in comment/poll search
- _pre-publish-review.js: Fix ban action to use anon_id instead of user_id
- _conversation-assist.js: Truncate PII in audit trail and notifications
- Updated eslint.config.js: disabled React 19 compiler rules, control regex, react-refresh
- Fixed no-unused-vars across 25+ files (prefixed unused with _)
- Fixed rules-of-hooks in InspectorPanel (useMemo before early return)
- Fixed no-case-declarations in AdminAI (block scope)
- Fixed @ts-ignore -> @ts-expect-error in App.tsx
- Removed dead AdminInbox.tsx (never imported, superseded by UnifiedInbox)
- Restored vercel.json with CSP header (Google Fonts fix)
- Security fixes: auth bypass, SQL injection, PII exposure
… across admin pages

- AdminAI.tsx: typed ToolCallEvent, ExecutionEvent, ToolSchema, MemoryEntry, RAG results, conversations
- AgentPanel.tsx: typed AgentSuggestion, KIND_META with LucideIcon, confirming state
- CommandCenter.tsx: typed Message interface, tab loading response
- Overview.tsx: typed PostData[], CommentData[], ReportRow, UserRow, CARDS icon field
- PostsTable.tsx: typed PostData for selected state, dialog payload, infinite scroll, callbacks
- PollManager.tsx: typed PollData[], catch blocks with e: unknown
- Reports.tsx: typed ReportRow, PreReviewItem, PostData for preview
- UnifiedInbox.tsx: typed ThreadSummary, ThreadState, ChatMessage, EMOTION_ICONS with LucideIcon
- AiPanel.tsx: typed AnalysisResult, RankedIssue, SafetyAlert, DuplicateCluster, AgentExecution, Suggestion
- UserManager.tsx: typed UserSummary, UserDetail, catch blocks with e: unknown
- PostCard.tsx: wrapped mine in useMemo to fix react-hooks/exhaustive-deps
- useInfiniteScroll.ts: removed stale eslint-disable directive

ESLint: 0 errors, 0 warnings. Build: passes cleanly.
…y warnings

ESLint: 0 errors, 0 warnings across entire project.
Build: clean pass.
- Expanded PostData, ChatThread, UserSummary, UserDetail, PreReviewItem,
  ThreadSummary, WeeklyInsights, and PollData interfaces with missing fields
- Typed all api.get/post/paginated/postPaginated calls with proper generics
- Added null guards for optional fields (status_history, shared_words,
  reactions, unread, created_at, suspended_until, etc.)
- Fixed ReactNode type mismatches by wrapping unknown values with String()
- Cast unknown API responses to concrete types in AdminAI, Reports, AgentOutput
- Fixed dialog payload type in PostsTable (string | PostData union)
- Added type parameters to api.paginated<T> in CommentMod, UserManager
- Used String() wrappers for unknown-to-ReactNode and unknown-to-string casts
- Zero tsc errors, zero ESLint warnings, clean vite build
@berasouyash-rgb berasouyash-rgb changed the title fix(types): eliminate all @typescript-eslint/no-explicit-any warnings fix: eliminate all ESLint any-warnings AND TypeScript strict errors Jul 25, 2026
VoiceBox Dev added 6 commits July 26, 2026 14:15
… AI Supervisor

- Add agent_reports table persistence (saveAgentReport, getAgentReports, getReportStats)
- Add AI Supervisor scan (runSupervisorScan) with danger level detection
- Add agent-cron.js Vercel cron endpoint (every 15 min, max 10 agents)
- Add Reports tab to AdminAI.tsx with severity filter, stats cards, supervisor alerts
- Add batch activate action for enabling all agents at once
- Supervisor knows personnel: Kaku (Bally Howrah), Principal (Rahil)
…nfigs, learning engine, and unique-title fix for production data collision
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant