### Install LaReview via Homebrew on Linux Source: https://github.com/puemos/lareview/blob/main/README.md Install LaReview using Homebrew on Linux by tapping the repository and then installing the formula. ```bash brew install puemos/tap/lareview ``` -------------------------------- ### Start LaReview App Source: https://github.com/puemos/lareview/blob/main/README.md Launches the LaReview application from the terminal. Assumes the repository is linked. ```bash lareview # From terminal with repo linked ``` -------------------------------- ### Install Linux Dependencies Source: https://github.com/puemos/lareview/blob/main/README.md Installs necessary development libraries for Linux (Debian/Ubuntu). ```bash sudo apt-get update sudo apt-get install -y libxkbcommon-dev libxkbcommon-x11-dev ``` -------------------------------- ### Run LaReview Development Server Source: https://github.com/puemos/lareview/blob/main/GEMINI.md Starts the full application, including the backend and frontend development servers. Alternatively, the frontend can be run separately. ```bash cargo tauri dev ``` ```bash cd frontend && pnpm dev ``` -------------------------------- ### Install LaReview via Homebrew Source: https://github.com/puemos/lareview/blob/main/landing/index.html Installs LaReview using the puemos/tap repository on Homebrew. ```bash brew install --cask puemos/tap/lareview ``` -------------------------------- ### Install WSLU for Windows Integration Source: https://github.com/puemos/lareview/blob/main/README.md Install the wslu package in WSL for improved integration with Windows, such as opening URLs in your default Windows browser. This is optional but recommended. ```bash # Ubuntu/Debian sudo apt install wslu ``` -------------------------------- ### Install LaReview via Homebrew on macOS Source: https://github.com/puemos/lareview/blob/main/README.md Install LaReview using Homebrew on macOS. This involves tapping the repository first, then installing the cask. ```bash # First, tap the repository brew tap puemos/tap # Then install brew install --cask lareview ``` -------------------------------- ### Develop UI with Tauri Source: https://github.com/puemos/lareview/blob/main/CONTRIBUTING.md Launches the LaReview desktop application with hot-reloading enabled for rapid UI development. Requires Tauri setup. ```bash cargo tauri dev ``` -------------------------------- ### Install LaReview Dependencies on Linux Source: https://github.com/puemos/lareview/blob/main/README.md Install the necessary system dependencies for LaReview on Debian/Ubuntu-based Linux distributions. These include WebKitGTK, AppIndicator, and SVG rendering libraries. ```bash # Debian/Ubuntu sudo apt-get update sudo apt-get install -y \ libwebkit2gtk-4.1-0 \ libappindicator3-1 \ librsvg2-2 \ libxdo3 ``` -------------------------------- ### Streaming Concatenation Example Source: https://github.com/puemos/lareview/blob/main/docs/DATA_STREAMING_DEEP_DIVE.md Illustrates the benefit of concatenating message chunks to reduce re-renders. This approach improves UI performance by batching updates. ```text Without concatenation: [H][e][l][l][o] → 5 re-renders With concatenation: [Hello] → 1 re-render ``` -------------------------------- ### SessionStart JSON Configuration Source: https://github.com/puemos/lareview/blob/main/docs/ACP_DEEP_DIVE.md Defines the initial configuration for an agent session, including the agent's ID and its system prompt. ```json { "sessionStart": { "agentId": "claude", "systemPrompt": "You are LaReview, a code review assistant..." } } ``` -------------------------------- ### Launch Review from Terminal Source: https://github.com/puemos/lareview/blob/main/landing/index.html Initiate a review directly from your command line. Supports loading PRs or piping git diff output. You can also specify the AI agent to use. ```bash $ lareview $ lareview pr owner/repo#123 $ git diff | lareview $ lareview --agent claude ``` -------------------------------- ### Run the LaReview App Source: https://github.com/puemos/lareview/blob/main/docs/DEVELOPMENT.md Execute the main application using Cargo. Ensure the Rust toolchain is set up. ```bash cargo run ``` -------------------------------- ### Build LaReview Application Source: https://github.com/puemos/lareview/blob/main/GEMINI.md Commands to build the Rust backend, the frontend assets, and the final production release of the application. ```bash cargo build ``` ```bash cd frontend && pnpm build ``` ```bash cargo tauri build ``` -------------------------------- ### Build macOS App Source: https://github.com/puemos/lareview/blob/main/README.md Builds a local macOS application bundle for development purposes. ```bash scripts/build_macos_app.sh ``` -------------------------------- ### Review GitHub/GitLab PR via CLI Source: https://github.com/puemos/lareview/blob/main/README.md Initiates a review for a GitHub or GitLab pull request using the command-line interface. ```bash lareview pr owner/repo#123 ``` -------------------------------- ### Testing Workflow for Committing Source: https://github.com/puemos/lareview/blob/main/GEMINI.md A consolidated workflow for quick validation before committing code. It includes backend formatting, linting, and testing, followed by frontend linting, testing, and building. ```bash # Quick validation before committing cargo fmt && cargo clippy --all-targets --all-features -- -D warnings && cargo test # Frontend validation cd frontend && pnpm lint && pnpm test && pnpm build ``` -------------------------------- ### ACP Session Lifecycle Overview Source: https://github.com/puemos/lareview/blob/main/docs/ACP_DEEP_DIVE.md Visual representation of the ACP session lifecycle, from initialization to cleanup. ```text ┌─────────────────────────────────────────────────────────────────────────────┐ │ Session Lifecycle │ ├─────────────────────────────────────────────────────────────────────────────┤ │ │ │ 1. INITIALIZE │ │ ├─ Create LaReviewClient │ │ ├─ Build agent command (with prompts, tools, capabilities) │ │ └─ Spawn agent process via stdio │ │ │ │ 2. CONNECT │ │ ├─ Send `SessionStart` message │ │ ├─ Agent responds with `SessionInfo` │ │ └─ Session is now ready for tool calls │ │ │ │ 3. RUN (Main Loop) │ │ ├─ Agent sends `SessionUpdate` messages: │ │ │ ├─ AgentMessageChunk (streaming text) │ │ │ ├─ AgentThoughtChunk (reasoning process) │ │ │ ├─ ToolCall (agent wants to use a tool) │ │ │ ├─ ToolCallUpdate (tool execution result) │ │ │ └─ Plan (structured task list) │ │ │ │ │ └─ Client processes each update and emits ProgressEvent │ │ │ │ 4. TOOL CALLS (MCP Server) │ │ ├─ Agent calls `return_task`, `finalize_review`, etc. │ │ ├─ MCP server receives call via stdio JSON-RPC │ │ ├─ Server validates and executes the tool │ │ ├─ Server sends result back to agent │ │ └─ ProgressEvent emitted to frontend │ │ │ │ 5. FINALIZE │ │ ├─ Agent calls `finalize_review` tool │ │ ├─ MCP server persists all tasks/feedback │ │ ├─ Agent sends `CompletionStatus` │ │ └─ Client emits Finalized event │ │ │ │ 6. CLEANUP │ │ ├─ Send `SessionEnd` message │ │ ├─ Close stdio pipes │ │ └─ Terminate agent process │ │ │ └─────────────────────────────────────────────────────────────────────────────┘ ``` -------------------------------- ### Backend and Frontend Validation Commands Source: https://github.com/puemos/lareview/blob/main/GEMINI.md Run these commands to ensure code quality and pass tests before committing or releasing. The backend checks formatting, linting, and tests, while the frontend checks linting, tests, and builds. ```bash cargo fmt && cargo clippy --all-targets --all-features -- -D warnings && cargo test ``` ```bash cd frontend && pnpm lint && pnpm test && pnpm build ``` -------------------------------- ### Check for Dependency Issues Source: https://github.com/puemos/lareview/blob/main/CONTRIBUTING.md Scans project dependencies for known security advisories and license compliance issues. Recommended to run early. ```bash cargo deny check ``` -------------------------------- ### Make LaReview Executable and Move to Path on Linux Source: https://github.com/puemos/lareview/blob/main/README.md Make the extracted LaReview binary executable and move it to a system-wide location like /usr/local/bin for easy access from the terminal. ```bash chmod +x ./lareview sudo mv ./lareview /usr/local/bin/lareview ``` -------------------------------- ### Run LaReview from Source Source: https://github.com/puemos/lareview/blob/main/README.md Compiles and runs the LaReview application directly from the source code. ```bash cargo run # From source ``` -------------------------------- ### Run Unit Tests Source: https://github.com/puemos/lareview/blob/main/CONTRIBUTING.md Executes all unit tests defined within the project. This is a crucial step to ensure code correctness. ```bash cargo test ``` -------------------------------- ### Implement Lightbox Functionality Source: https://github.com/puemos/lareview/blob/main/landing/index.html JavaScript code to create an image lightbox that opens and closes with transitions and keyboard support. It handles click triggers and escape key presses. ```javascript const lightbox = document.getElementById('lightbox'); const lightboxImg = document.getElementById('lightbox-img'); const closeBtn = document.getElementById('lightbox-close'); // Select all elements with the 'lightbox-trigger' class // This ensures distinct handling and future-proofing const triggers = document.querySelectorAll('.lightbox-trigger'); function openLightbox(src) { lightboxImg.src = src; lightbox.classList.remove('hidden'); // Small delay to allow display:block to apply before opacity transition setTimeout(() => { lightbox.classList.remove('opacity-0'); lightboxImg.classList.remove('scale-95'); lightboxImg.classList.add('scale-100'); }, 10); document.body.style.overflow = 'hidden'; } function closeLightbox() { lightbox.classList.add('opacity-0'); lightboxImg.classList.remove('scale-100'); lightboxImg.classList.add('scale-95'); setTimeout(() => { lightbox.classList.add('hidden'); lightboxImg.src = ''; }, 300); document.body.style.overflow = ''; } triggers.forEach(trigger => { trigger.addEventListener('click', (e) => { e.preventDefault(); // Prevent any default link behavior if applicable openLightbox(e.currentTarget.src); }); }); closeBtn.addEventListener('click', closeLightbox); lightbox.addEventListener('click', (e) => { if (e.target !== lightboxImg) { closeLightbox(); } }); document.addEventListener('keydown', (e) => { if (e.key === 'Escape' && !lightbox.classList.contains('hidden')) { closeLightbox(); } }); ``` -------------------------------- ### Format Code with Rustfmt Source: https://github.com/puemos/lareview/blob/main/CONTRIBUTING.md Checks if the code is formatted according to Rustfmt standards. This command should be run before pushing changes. ```bash cargo fmt -- --check ``` -------------------------------- ### Lint Code with Clippy Source: https://github.com/puemos/lareview/blob/main/CONTRIBUTING.md Runs Clippy to check for common Rust code errors and style issues. All warnings should be addressed, especially in CI. ```bash cargo clippy --all-targets --all-features -- -D warnings ``` -------------------------------- ### Format Code with Rustfmt Source: https://github.com/puemos/lareview/blob/main/docs/DEVELOPMENT.md Apply standard code formatting to the project using Cargo's built-in fmt command. This ensures code consistency across the project. ```bash cargo fmt ``` -------------------------------- ### Find React Component Usage Source: https://github.com/puemos/lareview/blob/main/GEMINI.md Search for instances where a specific React component is being used in the frontend code. ```bash # Find React component usage rg " ``` -------------------------------- ### Set Maximum Visible Items for Virtualization Source: https://github.com/puemos/lareview/blob/main/docs/DATA_STREAMING_DEEP_DIVE.md Limits the number of items rendered at a time to optimize performance, even with thousands of messages. ```typescript const MAX_VISIBLE_ITEMS = 50; ``` -------------------------------- ### Code Quality Checks Source: https://github.com/puemos/lareview/blob/main/GEMINI.md Commands for maintaining code quality, including formatting checks, linting, and running tests for both Rust and the frontend. ```bash cargo fmt -- --check ``` ```bash cargo clippy --all-targets --all-features -- -D warnings ``` ```bash cargo test ``` ```bash cd frontend && pnpm lint ``` ```bash cd frontend && pnpm test ``` -------------------------------- ### Find Tauri Commands Source: https://github.com/puemos/lareview/blob/main/GEMINI.md Use this command to locate all functions marked as Tauri commands within the Rust source files. ```bash # Find all Tauri commands rg "#\[tauri::command\]" src/ ``` -------------------------------- ### Extract LaReview Archive on Linux Source: https://github.com/puemos/lareview/blob/main/README.md Extract the LaReview Linux binary from its downloaded archive file. ```bash tar -xzvf lareview-linux.tar.gz ``` -------------------------------- ### Run LaReview with Error Logging Source: https://github.com/puemos/lareview/blob/main/README.md Executes the LaReview application with only error messages logged. ```bash RUST_LOG=error cargo run ``` -------------------------------- ### Rust Struct for Agent Configuration Source: https://github.com/puemos/lareview/blob/main/docs/ACP_DEEP_DIVE.md Defines the structure for an agent candidate, including its ID, name, executable path, arguments, and environment variables. Used in `src/infra/acp/agent_discovery.rs`. ```rust pub struct AgentCandidate { pub id: String, pub name: String, pub path: PathBuf, pub args: Vec, pub env: HashMap, } ``` -------------------------------- ### Bash Command for Enabling ACP Debug Logging Source: https://github.com/puemos/lareview/blob/main/docs/ACP_DEEP_DIVE.md Activates detailed debug logs for the ACP component when running the Tauri development server. Useful for backend debugging. ```bash RUST_LOG=acp=debug cargo tauri dev ``` -------------------------------- ### Timeline Component for Virtualized Message Rendering Source: https://github.com/puemos/lareview/blob/main/docs/DATA_STREAMING_DEEP_DIVE.md Renders a list of messages with virtualization to improve performance. It filters out certain message types and uses scroll handling to manage visible items. Use this for displaying potentially long lists of dynamic messages. ```typescript const MAX_VISIBLE_ITEMS = 50; const OVERSCAN_COUNT = 5; export const Timeline: React.FC = ({ messages }) => { const scrollRef = useRef(null); const [visibleStartIndex, setVisibleStartIndex] = useState(0); const [isAtBottom, setIsAtBottom] = useState(true); // Filter out system/debug messages const visibleMessages = messages.filter(m => !['system', 'log', 'debug', 'task_started', 'task_added'].includes(m.type) ); const totalItems = visibleMessages.length; const visibleEndIndex = Math.min(visibleStartIndex + MAX_VISIBLE_ITEMS, totalItems); const visible = visibleMessages.slice(visibleStartIndex, visibleEndIndex); // Auto-scroll to bottom when new messages arrive useEffect(() => { if (isAtBottom && scrollRef.current) { scrollRef.current.scrollTop = scrollRef.current.scrollHeight; } }, [messages.length, isAtBottom]); // Handle scroll for virtualization const handleScroll = useCallback((e: React.UIEvent) => { const element = e.currentTarget; const atBottom = Math.abs( element.scrollHeight - element.scrollTop - element.clientHeight ) < 50; setIsAtBottom(atBottom); const scrollPosition = element.scrollTop; const estimatedItemHeight = 60; const newStartIndex = Math.floor(scrollPosition / estimatedItemHeight); setVisibleStartIndex(Math.max(0, newStartIndex - OVERSCAN_COUNT)); }, []); return (
{visible.map((msg, index) => { const actualIndex = visibleStartIndex + index; return ; })}
); }; function renderMessage(msg: ProgressMessage) { switch (msg.type) { case 'agent_message': return ; case 'agent_thought': return ; case 'tool_call': return ; case 'agent_plan': return ; case 'error': return ; case 'completed': return ; default: return null; } } ``` -------------------------------- ### ToolCall JSON Configuration Source: https://github.com/puemos/lareview/blob/main/docs/ACP_DEEP_DIVE.md Specifies a tool call within a session update, including the tool's ID, title, status, and raw input details. ```json { "sessionUpdate": "tool_call", "toolCallId": "tc-001", "title": "return_task", "kind": "other", "status": "in_progress", "rawInput": { "id": "T1", "title": "Fix memory leak in connection pool", "description": "...", "hunkIds": ["src/main.rs#H1"] } } ``` -------------------------------- ### Review Unified Diff Source: https://github.com/puemos/lareview/blob/main/README.md Applies a unified diff to the codebase for review purposes. This is a common format for patch files. ```diff diff --git a/src/lib.rs b/src/lib.rs index 123..456 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,3 +1,8 @@ +pub fn example() { + // ... +} ``` -------------------------------- ### Log All Progress Events in Browser DevTools Source: https://github.com/puemos/lareview/blob/main/docs/DATA_STREAMING_DEEP_DIVE.md Logs all incoming progress events and their payloads to the browser's developer console for frontend debugging. This is useful for inspecting event data received by the frontend. ```javascript // All progress events are logged console.log('[Progress]', payload.event, payload); ``` -------------------------------- ### Find TODO and FIXME Comments Source: https://github.com/puemos/lareview/blob/main/GEMINI.md Locate all TODO or FIXME comments within Rust and TypeScript files to track outstanding tasks or issues. ```bash # Find all TODO/FIXME comments rg "TODO|FIXME" --type rust --type ts ``` -------------------------------- ### Add LaReview to PATH on macOS Source: https://github.com/puemos/lareview/blob/main/README.md Add the LaReview application's executable to your system's PATH environment variable on macOS to enable terminal usage. This is typically done by appending to the .zshrc file. ```bash echo 'export PATH="$PATH:/Applications/LaReview.app/Contents/MacOS"' >> ~/.zshrc ``` -------------------------------- ### Frontend Receives Progress via Tauri Channel Source: https://github.com/puemos/lareview/blob/main/docs/DATA_STREAMING_DEEP_DIVE.md The frontend in TypeScript sets up a `Channel` to receive `ProgressEventPayload` from the backend. It uses a `switch` statement to handle different event types like `ServerUpdate`, `Log`, `TaskStarted`, `TaskCompleted`, and `Completed`. ```typescript const onProgress = new Channel(); onProgress.onmessage = (payload: ProgressEventPayload) => { switch (payload.event) { case "ServerUpdate": handleServerUpdate(payload.data as SessionUpdate); break; case "Log": addProgressMessage("log", payload.data as string); break; case "TaskStarted": addProgressMessage("task_started", (payload.data as { title: string }).title); break; case "TaskCompleted": addProgressMessage("task_added", "Task completed"); break; case "Completed": addProgressMessage("completed", "Review generation complete!"); break; } }; const handleGenerate = async () => { await invoke('generate_review', { diffText: diffInput, agentId: selectedAgent.id, onProgress, }); }; ``` -------------------------------- ### Pipe Git Diffs to LaReview Source: https://github.com/puemos/lareview/blob/main/landing/index.html Processes git diff output directly through LaReview for review. ```bash git diff | lareview ``` -------------------------------- ### Rust Client Processes SessionUpdate Source: https://github.com/puemos/lareview/blob/main/docs/DATA_STREAMING_DEEP_DIVE.md The LaReviewClient in Rust receives `SessionNotification` and processes `AgentMessageChunk` updates. It appends streamed content and forwards updates via a progress channel. ```rust async fn session_notification(&self, notification: SessionNotification) { match ¬ification.update { SessionUpdate::AgentMessageChunk(chunk) => { // Extract message ID from meta let (text, _) = self.append_streamed_content( &self.messages, &self.last_message_id, chunk.content.meta.as_ref(), &chunk.content.text, ); // Forward to UI via progress channel if let Some(tx) = &self.progress { tx.send(ProgressEvent::Update(Box::new( SessionUpdate::AgentMessageChunk(chunk.clone()) )))?; } } // ... handle other update types } } ``` -------------------------------- ### Agent Emits SessionUpdate JSON Source: https://github.com/puemos/lareview/blob/main/docs/DATA_STREAMING_DEEP_DIVE.md The agent sends JSON messages over stdio to indicate session updates. These messages are typically chunks of text content. ```json { "sessionUpdate": "agent_message_chunk", "content": { "type": "text", "text": "I'll analyze", "_meta": { "messageId": "msg-001" } } } ``` ```json { "sessionUpdate": "agent_message_chunk", "content": { "type": "text", "text": " this diff and", "_meta": { "messageId": "msg-001" } } } ``` ```json { "sessionUpdate": "agent_message_chunk", "content": { "type": "text", "text": " create a plan.", "_meta": { "messageId": "msg-001" } } } ``` -------------------------------- ### Run LaReview with ACP Agent Debug Logging Source: https://github.com/puemos/lareview/blob/main/README.md Executes the LaReview application with debug logging specifically for the ACP agent. ```bash RUST_LOG=acp=debug cargo run ``` -------------------------------- ### ProgressBuffer Class for Message Handling Source: https://github.com/puemos/lareview/blob/main/docs/DATA_STREAMING_DEEP_DIVE.md Manages incoming message chunks, concatenates streaming text for specific message types, and schedules buffer flushes to optimize rendering. Use this to accumulate and process streaming data efficiently. ```typescript interface ProgressMessage { type: 'agent_message' | 'agent_thought' | 'tool_call' | 'agent_plan' | 'error' | 'completed' | 'log' | 'task_started' | 'task_added'; message: string; data?: any; timestamp: number; } class ProgressBuffer { private messages: ProgressMessage[] = []; private pendingText: Map = new Map(); private flushTimer: ReturnType | null = null; private readonly flushIntervalMs = 30; constructor(onFlush: (messages: ProgressMessage[]) => void) { this.onFlush = onFlush; } // Concatenate streaming chunks for same message type appendMessage(type: string, message: string, _data?: any): void { if (type === 'agent_message' || type === 'agent_thought') { const existing = this.pendingText.get(type); if (existing !== undefined) { this.pendingText.set(type, existing + message); return; // Accumulate, don't flush yet } } this.flushPending(); this.pendingText.set(type, message); this.scheduleFlush(); } private scheduleFlush(): void { if (this.flushTimer) return; this.flushTimer = setTimeout(() => this.flush(), this.flushIntervalMs); } private flush(): void { this.flushTimer = null; this.onFlush([...this.messages]); } handleServerUpdate(update: SessionUpdate): void { if (isAgentMessageChunk(update)) { const text = update.content?.text || ''; this.appendMessage('agent_message', text, update); } else if (isAgentThoughtChunk(update)) { const text = update.content?.text || ''; this.appendMessage('agent_thought', text, update); } else if (isToolCall(update)) { this.appendMessage('tool_call', update.title, update); } else if (isPlan(update)) { this.appendMessage('agent_plan', 'Plan updated', update); } } } ``` -------------------------------- ### Tauri Command Forwards Progress Events Source: https://github.com/puemos/lareview/blob/main/docs/DATA_STREAMING_DEEP_DIVE.md The `generate_review` Tauri command in Rust spawns a task to forward `ProgressEvent`s received from an ACP worker to the frontend via a Tauri channel. It transforms `SessionUpdate::Plan` into a frontend-specific format. ```rust #[tauri::command] pub async fn generate_review( state: State<'_, AppState>, diff_text: String, agent_id: String, on_progress: Channel, ) -> Result { let (mcp_tx, mut mcp_rx) = mpsc::unbounded_channel::(); // Spawn async forwarder let on_progress_clone = on_progress.clone(); tauri::async_runtime::spawn(async move { while let Some(event) = mcp_rx.recv().await { let payload = match event { ProgressEvent::LocalLog(msg) => { ProgressEventPayload::Log(msg) } ProgressEvent::Update(update) => { if let SessionUpdate::Plan(plan) = *update { // Transform Plan for frontend let entries = plan.entries.iter().map(|e| { FrontendPlanEntry { content: e.content.clone(), priority: e.priority.clone(), status: e.status.clone(), } }).collect(); ProgressEventPayload::Plan(FrontendPlan { entries }) } else { ProgressEventPayload::ServerUpdate(*update) } } ProgressEvent::TaskStarted(id, title) => { ProgressEventPayload::TaskStarted { task_id: id, title } } ProgressEvent::TaskAdded(id) => { ProgressEventPayload::TaskCompleted { task_id: id } } ProgressEvent::Finalized => { ProgressEventPayload::Completed { task_count: 0 } } }; let _ = on_progress_clone.send(payload); } }); // Call ACP worker with mcp_tx generate_tasks_with_acp(GenerateTasksInput { progress_tx: Some(mcp_tx), // ... }) } ``` -------------------------------- ### LaReviewClient Structure Source: https://github.com/puemos/lareview/blob/main/docs/ACP_DEEP_DIVE.md The core ACP client in LaReview, responsible for managing messages, thoughts, tasks, and streaming progress events from AI agents. ```rust pub(super) struct LaReviewClient { pub(super) messages: Arc>>, pub(super) thoughts: Arc>>, pub(super) tasks: Arc>>, pub(super) progress: Option>, // ... tracking fields for streaming } ``` -------------------------------- ### Rust Function for Appending Streamed Content Source: https://github.com/puemos/lareview/blob/main/docs/ACP_DEEP_DIVE.md Appends streamed text content to a store, managing message IDs to correctly group chunks into complete messages. This function is used in `client.rs`. ```rust fn append_streamed_content( &self, store: &Arc>>, last_id: &Arc>>, meta: Option<&Meta>, text: &str, ) -> (String, bool) { let chunk_id = Self::extract_chunk_id(meta); let mut id_guard = last_id.lock().unwrap(); let mut store_guard = store.lock().unwrap(); // New chunk ID → start new message if let Some(ref incoming) = chunk_id { if id_guard.as_deref() != Some(incoming.as_str()) { store_guard.push(String::new()); *id_guard = Some(incoming.clone()); } } // Append text to last message if let Some(last) = store_guard.last_mut() { last.push_str(text); } (store_guard.last().cloned().unwrap_or_default(), is_new) } ``` -------------------------------- ### SessionUpdate JSON Configuration (AgentMessageChunk) Source: https://github.com/puemos/lareview/blob/main/docs/ACP_DEEP_DIVE.md Represents an update to an ongoing session, specifically for agent message chunks, including content type and text. ```json { "sessionUpdate": "agent_message_chunk", "content": { "type": "text", "text": "I'll analyze this diff and create a review plan.", "_meta": { "messageId": "msg-001" } } } ``` -------------------------------- ### Filter System Messages Before Rendering Source: https://github.com/puemos/lareview/blob/main/docs/DATA_STREAMING_DEEP_DIVE.md Filters out system-related message types to only display relevant user messages. Ensure the 'messages' array is available in the scope. ```typescript const visibleMessages = messages.filter(m => !['system', 'log', 'debug', 'task_started', 'task_added'].includes(m.type) ); ```