From 0d996cf7590e3e52f424859c7d6f0e68640f119e Mon Sep 17 00:00:00 2001 From: soryu Date: Sun, 17 May 2026 21:23:20 +0100 Subject: chore: remove LLM module + all dependent surfaces (#135) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Wholesale removal of the LLM integration layer. ~14,200 LOC deleted across backend and frontend. All chat-driven UIs go with it. ## Backend - Delete `src/llm/` (7,400 LOC): claude/groq clients, contract_tools, contract_evaluator, discuss_tools, mesh_tools, phase_guidance, task_output, templates, markdown round-trip, tools, transcript_analyzer. - Delete handlers wholly dependent on LLM: - `chat.rs` (file-level LLM chat at /files/{id}/chat) - `mesh_chat.rs` (mesh & task LLM chat + history) - `templates.rs` (/contract-types listing) - Strip LLM uses from `mesh_daemon.rs`: - `compute_action_directive` (used phase_guidance::check_deliverables_met to nudge supervisors with "all tasks done" messages). The auto-PR path below still fires when all tasks finish, so no behaviour lost. - `crate::llm::markdown_to_body` → inline 1-line replacement that wraps markdown content in a single BodyElement::Markdown. The editor re-parses on display, so round-trip is preserved. - Drop routes: /files/{id}/chat, /mesh/chat, /mesh/chat/history, /mesh/tasks/{id}/chat, /contract-types. - Drop the matching openapi registrations. ## Frontend - Delete components that were LLM-only: - `mesh/UnifiedMeshChatInput.tsx` - `listen/DiscussContractModal.tsx` - `listen/TranscriptAnalysisPanel.tsx` - `listen/ContractPickerModal.tsx` - `files/CliInput.tsx` - Delete the entire /listen page (its primary value-add was voice → LLM analysis → contract creation; without LLM the page is just a transcript display with no obvious user purpose). - Delete `hooks/useMeshChatHistory.ts` and `lib/listenApi.ts` (transcript-analysis API client to the already-Phase-5-removed listen handlers). - Strip api.ts of LLM exports: LlmModel, ChatMessage/Request/Response, UserQuestion/Answer, chatWithFile, MeshChat* types & functions, getMeshChatHistory, clearMeshChatHistory, chatWithMeshContext, ContractTypeTemplate, listContractTypes, chatWithContract, getContractChatHistory, clearContractChatHistory, discussContract, PhaseDefinition, DeliverableDefinition. - mesh.tsx: drop UnifiedMeshChatInput render + the chatContext memo + handleTaskUpdatedFromCli (only consumer was the input). - files.tsx: drop CliInput render + handleGenerateFromElement + handleBodyUpdate + handleClearFocus + suggestedPrompt state (all CliInput-only). - NavStrip: drop the /listen link. - main.tsx: drop the /listen route. ## Net diff: 37 files changed, 58 insertions, 14,281 deletions. Co-authored-by: Claude Opus 4.7 (1M context) --- makima/frontend/src/hooks/useMeshChatHistory.ts | 133 ------------------------ 1 file changed, 133 deletions(-) delete mode 100644 makima/frontend/src/hooks/useMeshChatHistory.ts (limited to 'makima/frontend/src/hooks/useMeshChatHistory.ts') diff --git a/makima/frontend/src/hooks/useMeshChatHistory.ts b/makima/frontend/src/hooks/useMeshChatHistory.ts deleted file mode 100644 index 82c576d..0000000 --- a/makima/frontend/src/hooks/useMeshChatHistory.ts +++ /dev/null @@ -1,133 +0,0 @@ -import { useState, useCallback, useEffect } from "react"; -import { - getMeshChatHistory, - clearMeshChatHistory, - chatWithMeshContext, - type MeshChatMessageRecord, - type MeshChatContext, - type MeshChatResponse, - type LlmModel, -} from "../lib/api"; - -export interface MeshChatState { - conversationId: string | null; - messages: MeshChatMessageRecord[]; - loading: boolean; - error: string | null; - sending: boolean; -} - -export function useMeshChatHistory() { - const [state, setState] = useState({ - conversationId: null, - messages: [], - loading: true, - error: null, - sending: false, - }); - - const fetchHistory = useCallback(async () => { - setState((prev) => ({ ...prev, loading: true, error: null })); - try { - const response = await getMeshChatHistory(); - setState((prev) => ({ - ...prev, - conversationId: response.conversationId, - messages: response.messages, - loading: false, - })); - } catch (e) { - setState((prev) => ({ - ...prev, - error: e instanceof Error ? e.message : "Failed to fetch chat history", - loading: false, - })); - } - }, []); - - const clearHistory = useCallback(async (): Promise => { - setState((prev) => ({ ...prev, loading: true, error: null })); - try { - const response = await clearMeshChatHistory(); - setState({ - conversationId: response.conversationId, - messages: [], - loading: false, - error: null, - sending: false, - }); - return true; - } catch (e) { - setState((prev) => ({ - ...prev, - error: e instanceof Error ? e.message : "Failed to clear chat history", - loading: false, - })); - return false; - } - }, []); - - const sendMessage = useCallback( - async ( - message: string, - context: MeshChatContext, - model?: LlmModel - ): Promise => { - setState((prev) => ({ ...prev, sending: true, error: null })); - - // Optimistically add user message (will be refetched after response) - const tempUserMessage: MeshChatMessageRecord = { - id: `temp-${Date.now()}`, - conversationId: state.conversationId || "", - role: "user", - content: message, - contextType: context.type, - contextTaskId: context.taskId || null, - toolCalls: null, - pendingQuestions: null, - createdAt: new Date().toISOString(), - }; - - setState((prev) => ({ - ...prev, - messages: [...prev.messages, tempUserMessage], - })); - - try { - const response = await chatWithMeshContext(message, context, model); - - // Refetch to get the actual saved messages (with proper IDs) - await fetchHistory(); - - setState((prev) => ({ ...prev, sending: false })); - return response; - } catch (e) { - // Remove optimistic message on error - setState((prev) => ({ - ...prev, - messages: prev.messages.filter((m) => m.id !== tempUserMessage.id), - error: e instanceof Error ? e.message : "Failed to send message", - sending: false, - })); - return null; - } - }, - [state.conversationId, fetchHistory] - ); - - // Initial fetch on mount - useEffect(() => { - fetchHistory(); - }, [fetchHistory]); - - return { - conversationId: state.conversationId, - messages: state.messages, - loading: state.loading, - error: state.error, - sending: state.sending, - fetchHistory, - clearHistory, - sendMessage, - }; -} -- cgit v1.2.3