Commit Graph

14 Commits

Author SHA1 Message Date
Dave
fdefdd7204 Add biome-ignore for intentional useEffect dependencies 2025-12-27 17:08:29 +00:00
Dave
9a61b03c09 Fix auto-scroll bug: add messages and streamingContent as dependencies to useEffect 2025-12-27 17:04:06 +00:00
Dave
b3dd5f5670 Story 20: New Session button to clear chat history
- Added 'New Session' button in header with confirmation dialog
- Clears frontend messages, streaming content, and loading state
- Button has subtle styling with hover effects
- Preserves project path, model selection, and tool settings
- Backend context automatically cleared (no server-side history)
- Fixed build errors by removing unused tokio watch channel
- All quality checks passing (TypeScript, Biome, Clippy, builds)

Tested and verified:
- Button appears in header near model controls
- Confirmation dialog prevents accidental clearing
- Messages clear immediately after confirmation
- Input remains ready for new conversation
- Settings preserved across session clears
2025-12-27 17:01:55 +00:00
Dave
64d1b788be Story 18: Token-by-token streaming responses
- Backend: Added OllamaProvider::chat_stream() with newline-delimited JSON parsing
- Backend: Emit chat:token events for each token received from Ollama
- Backend: Added futures dependency and stream feature for reqwest
- Frontend: Added streamingContent state and chat:token event listener
- Frontend: Real-time token display with auto-scroll
- Frontend: Markdown and syntax highlighting support for streaming content
- Fixed all TypeScript errors (tsc --noEmit)
- Fixed all Biome warnings and errors
- Fixed all Clippy warnings
- Added comprehensive code quality documentation
- Added tsc --noEmit to verification checklist

Tested and verified:
- Tokens stream in real-time
- Auto-scroll works during streaming
- Tool calls interrupt streaming correctly
- Multi-turn conversations work
- Smooth performance with no lag
2025-12-27 16:50:18 +00:00
Dave
bb700ce870 feat: Backend cancellation support for interrupting model responses
Merged from feature/interrupt-on-type branch.

Backend cancellation infrastructure:
- Added tokio watch channel to SessionState for cancellation signaling
- Implemented cancel_chat command
- Modified chat command to use tokio::select! for racing requests vs cancellation
- When cancelled, HTTP request to Ollama is dropped and returns early
- Added tokio dependency with sync feature

Story updates:
- Story 13: Updated to use Stop button pattern (industry standard)
- Story 18: Created placeholder for streaming responses
- Stories 15-17: Placeholders for future features

Frontend changes:
- Removed auto-interrupt on typing behavior (too confusing)
- Backend infrastructure ready for Stop button implementation

Note: Story 13 UI (Stop button) not yet implemented - backend ready
2025-12-27 15:36:58 +00:00
Dave
909e8f1a2a feat: Story 14 - Auto-focus chat input on startup
Implemented Story 14: Auto-focus Chat Input
- Added inputRef using useRef<HTMLInputElement>
- Added useEffect to focus input on component mount
- Input now automatically receives focus when chat loads
- Cursor is visible and blinking immediately
- Users can start typing without clicking into the field

Updated Specs
- Added Input Focus Management section to UI_UX.md
- Specified auto-focus behavior and requirements
- Provided implementation example
2025-12-25 15:43:29 +00:00
Dave
0ff1a4b167 feat: Story 11 - Left-align text and add syntax highlighting
Implemented Story 11: Text Alignment and Syntax Highlighting
- Removed center-alignment from chat container (text-align: center)
- Added left-alignment to markdown body and code blocks
- Integrated react-syntax-highlighter with react-markdown
- Added syntax highlighting for code blocks using oneDark theme
- Supports JavaScript, TypeScript, Rust, Python, JSON, Markdown, Shell, and more
- Inline code maintains simple styling without full highlighting
- All code blocks are now left-aligned for better readability

Fixed: Agent over-aggressive file writing behavior
- Refined system prompt to distinguish between:
  * 'show/example/how does' → respond with code in chat
  * 'create/add/implement/fix' → use write_file tool
- Removed aggressive AGENT DIRECTIVE prefix from user messages
- Softened reminder message to reflect nuanced behavior
- Agent can now both teach (show examples) and implement (write files)

Updated Specs
- Added Text Alignment and Readability section to UI_UX.md
- Added Syntax Highlighting section with implementation details
- Updated SDSW workflow: acceptance criteria marked complete only after user acceptance

Dependencies
- Added react-syntax-highlighter and @types/react-syntax-highlighter
2025-12-25 15:39:22 +00:00
Dave
990441dfc1 feat: Story 8 - Collapsible tool outputs + autonomous coding improvements
Implemented Story 8: Collapsible Tool Outputs
- Tool outputs now render in <details>/<summary> elements, collapsed by default
- Summary shows tool name with key argument (e.g., ▶ read_file(src/main.rs))
- Added arrow rotation animation and scrollable content (max 300px)
- Enhanced tool_calls display to show arguments inline
- Added CSS styling for dark theme consistency

Fixed: LLM autonomous coding behavior
- Strengthened system prompt with explicit examples and directives
- Implemented triple-reinforcement system (primary prompt + reminder + message prefixes)
- Improved tool descriptions to be more explicit and action-oriented
- Increased MAX_TURNS from 10 to 30 for complex agentic workflows
- Added debug logging for Ollama requests/responses
- Result: GPT-OSS (gpt-oss:20b) now successfully uses write_file autonomously

Documentation improvements
- Created MODEL_SELECTION.md guide with recommendations
- Updated PERSONA.md spec to emphasize autonomous agent behavior
- Updated UI_UX.md spec with collapsible tool output requirements
- Updated SDSW workflow: LLM archives stories and performs squash merge

Cleanup
- Removed unused ToolTester.tsx component
2025-12-25 15:18:12 +00:00
Dave
d3fa8d940b feat: persist model selection 2025-12-25 13:21:55 +00:00
Dave
c3ff2bdebd feat: ui polish (sticky header, dark mode, flat inputs) 2025-12-25 12:58:37 +00:00
Dave
e560bd1323 feat: event-driven ui updates 2025-12-25 12:39:20 +00:00
Dave
6572f45422 feat: auto-detect ollama models 2025-12-25 12:21:58 +00:00
Dave
b241c47fd9 fix: make llm provider async and add tool toggle 2025-12-24 17:32:46 +00:00
Dave
d9cd16601b feat: agent brain (ollama) and chat ui 2025-12-24 17:17:35 +00:00