Commit Graph
100 Commits
Author SHA1 Message Date
Dave 8f095a3ec9 Renamed worktree diff story 2026-02-19 19:03:59 +00:00
DaveandClaude Opus 4.6 6d57b06636 Accept story 34: Per-Project Agent Configuration and Role Definitions
Replace single [agent] config with multi-agent [[agent]] roster system.
Each agent has name, role, model, allowed_tools, max_turns, max_budget_usd,
and system_prompt fields that map to Claude CLI flags at spawn time.

- AgentConfig expanded with structured fields, validated at startup (panics
  on duplicate names, empty names, non-positive budgets/turns)
- Backwards-compatible: legacy [agent] format auto-wraps with deprecation warning
- AgentPool uses composite "story_id:agent_name" keys for concurrent agents
- agent_name added to AgentEvent variants, AgentInfo, start/stop/subscribe APIs
- GET /agents/config returns roster, POST /agents/config/reload hot-reloads
- POST /agents/start accepts optional agent_name, /agents/stop requires it
- SSE route updated to /agents/:story_id/:agent_name/stream
- Frontend: roster badges, agent selector dropdown, composite-key state
- Project root initialized to cwd at startup so config endpoints work immediately

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 18:46:14 +00:00
Dave f9fc2472fd Splitting up the editor and diff stories 2026-02-19 18:22:19 +00:00
Dave 8c2dc9b6a0 Finishing agent merge 2026-02-19 18:05:21 +00:00
DaveandClaude Opus 4.6 c94b3d4450 Accept story 36: Enforce Front Matter on All Story Files
Add POST /workflow/stories/create endpoint that auto-assigns story
numbers, generates correct front matter, and writes to upcoming/.
Add slugify_name and next_story_number helpers with full test coverage.
Add frontend createStory API method and types.
Update README to recommend creation API for agents.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 18:02:48 +00:00
DaveandClaude Opus 4.6 5e5cdd9b2f Accept story 30: Worktree-based agent orchestration
Add git worktree isolation for concurrent story agents. Each agent now
runs in its own worktree with setup/teardown commands driven by
.story_kit/project.toml config. Agents stream output via SSE and support
start/stop lifecycle with Pending/Running/Completed/Failed statuses.

Backend: config.rs (TOML parsing), worktree.rs (git worktree lifecycle),
refactored agents.rs (broadcast streaming), agents_sse.rs (SSE endpoint).
Frontend: AgentPanel.tsx with Run/Stop buttons and streaming output log.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 17:58:53 +00:00
DaveandClaude Opus 4.6 7e56648954 Use STORYKIT_PORT for both backend and frontend, add .story_kit_port to ignore files
Single env var STORYKIT_PORT configures backend port, frontend proxy target,
frontend dev server port (port + 2172), and WebSocket host. Added .story_kit_port
to .gitignore and .ignore to prevent git tracking and cargo watch restart loops.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 17:29:50 +00:00
Dave f7902c3569 Merge story-32: Multi-Instance Worktree Support
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

# Conflicts:
#	.story_kit/stories/archived/32_multi_instance_worktree_support.md
#	.story_kit/stories/current/30_worktree_agent_orchestration.md
#	.story_kit/stories/current/32_multi_instance_worktree_support.md
#	.story_kit/stories/current/36_enforce_story_front_matter.md
#	.story_kit/stories/upcoming/29_directory_based_workflow_coordination.md
#	.story_kit/stories/upcoming/32_worktree_agent_orchestration.md
#	.story_kit/stories/upcoming/33_worktree_diff_and_editor_integration.md
#	.story_kit/stories/upcoming/34_agent_configuration_and_roles.md
#	.story_kit/stories/upcoming/35_agent_security_and_sandboxing.md
2026-02-19 17:17:21 +00:00
DaveandClaude Opus 4.6 e54209eb5a Story 32: Multi-Instance Worktree Support
Add configurable port via STORYKIT_PORT env var (default 3001). Server
prints machine-readable STORYKIT_PORT=<port> on startup and writes
.story_kit_port file for discovery. Frontend proxy and WebSocket read
VITE_STORYKIT_PORT env var instead of hardcoding port 3001.

7 new tests (4 backend, 3 frontend) all passing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 17:14:33 +00:00
DaveandClaude Opus 4.6 12542f10a8 Move story 32 to current and rename to multi-instance worktree support
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 16:58:33 +00:00
DaveandClaude Opus 4.6 79d6868a82 Move story 36 to current: Enforce Front Matter on All Story Files
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 16:56:14 +00:00
DaveandClaude Opus 4.6 03852effde Remove duplicate story 34 security file (renumbered to 35)
The security/sandboxing story was renumbered from 34 to 35 but the
old 34_agent_security_and_sandboxing.md was never deleted. Story 34
is now Per-Project Agent Configuration and Role Definitions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 16:51:13 +00:00
DaveandClaude Opus 4.6 af71c16e1d Backfill YAML front matter on all story files
Add name and test_plan front matter to 31 story files that were
missing it. Upcoming stories get test_plan: pending, current and
archived get test_plan: approved.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 16:50:04 +00:00
DaveandClaude Opus 4.6 59bb4bff90 Renumber agent security and sandboxing story from 34 to 35
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 16:45:45 +00:00
DaveandClaude Opus 4.6 775e6630ce Move story 30 to current: Worktree-Based Agent Orchestration
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 16:43:45 +00:00
DaveandClaude Opus 4.6 baee84dfa5 Move story 32 to current and rename to multi-instance worktree support
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 16:39:14 +00:00
DaveandClaude Opus 4.6 b4f2eacea6 Accept story 28: Show Remaining Test TODOs in the UI
All acceptance criteria verified. Always show story name/id in TODO
panel regardless of story count. Archive story.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 16:04:05 +00:00
DaveandClaude Opus 4.6 62905a6373 Add story 36: Enforce front matter on all story files
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 16:01:05 +00:00
DaveandClaude Opus 4.6 bf0fb5bcf6 Add story 35: Agent security and sandboxing, add bypassPermissions to agent spawns
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 15:56:05 +00:00
Dave 3807f0e625 Merge story-31: View Upcoming Stories
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

# Conflicts:
#	frontend/src/api/workflow.ts
#	frontend/src/components/Chat.test.tsx
#	frontend/src/components/Chat.tsx
#	server/src/http/workflow.rs
2026-02-19 15:54:02 +00:00
DaveandClaude Opus 4.6 939387104b Story 31: View Upcoming Stories
Add GET /workflow/upcoming endpoint that reads .story_kit/stories/upcoming/
and returns story IDs with names parsed from frontmatter. Add UpcomingPanel
component wired into Chat view with loading, error, empty, and list states.

12 new tests (3 backend, 9 frontend) all passing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 15:51:12 +00:00
DaveandClaude Opus 4.6 5f5c09461b Add story 34: per-project agent configuration and role definitions
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 15:49:07 +00:00
Dave f942a00b96 Merge branch 'feature/story-28-ui-show-test-todos' 2026-02-19 15:36:04 +00:00
DaveandClaude Opus 4.6 2c3003d721 Story 28: Show remaining test TODOs in the UI
Add TodoPanel that displays unchecked acceptance criteria from current
story files. Backend parses `- [ ]` lines from markdown, frontend
shows them in a panel with refresh. Includes 4 Rust unit tests,
3 Vitest tests, 3 Playwright E2E tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 15:33:45 +00:00
Dave 50c905d868 Merge spike/claude-code-integration: PTY-based Claude Code with multi-agent support
Spike proved: spawning claude -p in a PTY from Rust gets Max subscription
billing. Multi-agent concurrency confirmed with session resumption.
Includes AgentPool REST API, claude-code provider, and spike documentation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

# Conflicts:
#	.ignore
2026-02-19 15:30:56 +00:00
DaveandClaude Opus 4.6 f17cd63d2f Revert spike ports to 3001/5173, add stories 32 and 33
Reverts port changes made during the spike back to default (3001/5173).
Adds two new stories for multi-worktree support: dynamic port management
(story 32) and worktree diff inspection with editor integration (story 33).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 15:30:23 +00:00
DaveandClaude Opus 4.6 68a19c393e Spike: PTY-based Claude Code integration with multi-agent concurrency
Proves that spawning `claude -p` in a pseudo-terminal from Rust gets Max
subscription billing (apiKeySource: "none", rateLimitType: "five_hour")
instead of per-token API charges. Concurrent agents run in parallel PTY
sessions with session resumption via --resume for multi-turn conversations.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 15:25:22 +00:00
DaveandClaude Opus 4.6 644644d5b3 Update story 28 to read TODOs from story file instead of tests/todo/
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 15:08:20 +00:00
DaveandClaude Opus 4.6 8973d22afc Renumber upcoming stories and add .ignore updates
Drop story 28, renumber 30-33 to 28-31, add story 31 (View Upcoming
Stories), and extend .ignore for .claude/ and .story_kit/ directories.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 15:07:06 +00:00
Dave 9864e0a9e6 Finished a few more stories 2026-02-19 14:53:44 +00:00
DaveandClaude Opus 4.6 959755cd6e Fix post-merge: pass None for coverage arg in to_review_story tests
Story 27 added a coverage parameter to to_review_story(). Story 29's
tests called the old 2-arg signature. Pass None to fix compilation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 14:47:19 +00:00
DaveandClaude Opus 4.6 fd152cb5b7 Merge story-29: Backfill tests for maximum coverage
Adds 57 Rust tests and 60 frontend tests across 4 batches:
- Batch 1: store, search, workflow
- Batch 2: fs, shell, http/workflow
- Batch 3: usePathCompletion, api/client, api/workflow
- Batch 4: App, GatePanel, ReviewPanel

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 14:46:42 +00:00
DaveandClaude Opus 4.6 8f684a6ca4 Story 27: Coverage tracking (full-stack)
Add end-to-end coverage tracking: backend collects vitest coverage,
records metrics with threshold/baseline tracking, and blocks acceptance
on regression. Frontend displays coverage in gate/review panels with
a "Collect Coverage" button. Includes 20 Rust tests, 17 Vitest tests,
and 14 Playwright E2E tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 14:45:57 +00:00
DaveandClaude Opus 4.6 f56d9e04e0 WIP: Batch 4 — App, GatePanel, ReviewPanel frontend tests
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 14:05:57 +00:00
DaveandClaude Opus 4.6 b6e55a513f WIP: Batch 3 — backfill frontend tests
- usePathCompletion: 16 tests (isFuzzyMatch, getCurrentPartial, hook behavior)
- api/client.ts: 9 tests (fetch mocks for all major endpoints, error handling)
- api/workflow.ts: 6 tests (record, acceptance, review queue, ensure)

Frontend tests: 13 → 44

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 13:55:59 +00:00
DaveandClaude Opus 4.6 de6334720a WIP: Batch 2 — backfill tests for fs, shell, and http/workflow
- io/fs.rs: 20 tests (path resolution, project open/close/get, known projects,
  model prefs, file read/write, list dir, validate path, scaffold)
- io/shell.rs: 4 new tests (allowlist, command execution, stdout capture, exit codes)
- http/workflow.rs: 8 tests (parse_test_status, to_test_case, to_review_story)

Coverage: 28.6% → 48.1%

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 13:52:19 +00:00
DaveandClaude Opus 4.6 76e7c68b66 WIP: Batch 1 — backfill tests for store, search, and workflow
- store.rs: 8 tests (roundtrip, persistence, corrupt/empty file handling)
- io/search.rs: 5 tests (matching, nested dirs, gitignore, empty results)
- workflow.rs: 7 new tests (acceptance logic, summarize, can_start, record, refresh)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 13:49:33 +00:00
Dave 8f0bc971bf Ensuring we keep the current storykit stories folder 2026-02-19 12:59:02 +00:00
Dave b333814fcc Added fronted test instructions 2026-02-19 12:58:40 +00:00
Dave e47c8814e6 Removing unneeded tsconfig 2026-02-19 12:58:29 +00:00
DaveandClaude Opus 4.6 013b28d77f Story 26: Establish TDD workflow and quality gates
Add workflow engine with acceptance gates, test recording, and review
queue. Frontend displays gate status (blocked/ready), test summaries,
failing badges, and warnings. Proceed action is disabled when gates
are not met. Includes 13 unit tests (Vitest) and 9 E2E tests
(Playwright) covering all five acceptance criteria.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 12:54:04 +00:00
Dave 3a98669c4c Ignore Playwright test results 2026-02-17 17:11:39 +00:00
Dave d0a1da2176 Update Story Kit workflow docs and move story 26 2026-02-17 14:12:45 +00:00
Dave 5854ff5593 Consolidate upcoming TDD stories 2026-02-17 13:42:59 +00:00
Dave 37ef7abb2f Deleted orphan file 2026-02-17 13:39:46 +00:00
Dave 3302b62839 Rename workflow to story-driven test workflow 2026-02-17 13:38:31 +00:00
Dave 3079ea194f Add story for UI test TODO visibility 2026-02-17 13:35:27 +00:00
Dave 4c887d93b5 Refocus workflow on TDD and reorganize stories 2026-02-17 13:34:32 +00:00
Dave 1f4f10930f Archived story 25 2026-02-16 20:34:21 +00:00
Dave f1e5ac72e0 Project creation is workign 2026-02-16 20:34:03 +00:00
Dave 3be9088794 Split into components 2026-02-16 19:59:45 +00:00
Dave 1adbadb6eb ibid 2026-02-16 19:53:43 +00:00
Dave e6638a6517 Clean up previous project display 2026-02-16 19:53:31 +00:00
Dave 8ed40dd444 Fixed up project picker a bit 2026-02-16 19:48:39 +00:00
Dave 45bce740b6 Text-completion picker to select a project 2026-02-16 19:44:29 +00:00
Dave ffab287d16 Put in a recent project picker 2026-02-16 18:57:39 +00:00
Dave 539cbba409 Ignoring the store.json 2026-02-16 17:18:03 +00:00
Dave 2bb987d629 Happier startup message 2026-02-16 17:10:23 +00:00
Dave 37be55242d Auto-build the fronted into the release binary on cargo build --release 2026-02-16 17:05:09 +00:00
Dave dae772e619 Added some API doc comments 2026-02-16 16:55:59 +00:00
Dave feb05dc8d0 Refactored and documented the HTTP API 2026-02-16 16:50:50 +00:00
Dave f76376b203 More smoothing, as they say 2026-02-16 16:35:25 +00:00
Dave 5923165fcf Refactoring the structure a bit 2026-02-16 16:24:21 +00:00
Dave a2188e2c7f Smoothing out some tauri conversion leftovers 2026-02-16 16:02:30 +00:00
Dave b1706aaa3b Caonverting to workspace 2026-02-16 15:54:16 +00:00
Dave caf293a8c4 Renamed .living_spec in a few more places 2026-02-16 15:45:44 +00:00
Dave 3865883998 Renamed living spec to Story Kit 2026-02-16 15:44:20 +00:00
Dave 0876c53e17 moved from tauri to a server with embedded UI 2026-02-13 12:31:36 +00:00
Dave d4203cfaab Updating README 2026-02-06 16:28:50 +00:00
Dave 0465609295 Upating README for living spec 2026-02-06 16:28:40 +00:00
Dave f6b86ea5a6 Testing more paths in search 2026-01-27 16:07:00 +00:00
Dave 1f11eaedab ibid 2026-01-27 15:28:09 +00:00
Dave c24f44bf51 wip tests for chat.rs 2026-01-27 15:01:47 +00:00
Dave 97b0ce1b58 Wrote some tests. 2026-01-27 14:45:28 +00:00
Dave 8b14aa1f6f Fixing warnings and moving LLM providers into a module 2026-01-27 13:30:46 +00:00
Dave 1f1f5f6dac Updated dependencies, fixed some clippy warnings 2026-01-26 18:15:29 +00:00
Dave c2da7f9f18 Fix Story 12: Claude API key storage now working
- Fixed silent API key save failure by switching from keyring to Tauri store
- Removed keyring dependency (didn't work in macOS dev mode for unsigned apps)
- Implemented reliable cross-platform storage using tauri-plugin-store
- Added pendingMessageRef to preserve user message during API key dialog flow
- Refactored sendMessage to accept optional message parameter for retry
- Removed all debug logging and test code
- Removed unused entitlements.plist and macOS config
- API key now persists correctly between sessions
- Auto-retry after saving key works properly

Story 12 complete and archived.
2025-12-27 20:08:24 +00:00
Dave 2976c854d0 Fix model selection resetting issue
The useEffect was re-running every time model changed, causing
Claude model selection to reset back to Ollama models. Fixed by:
- Removing model from useEffect dependency array
- Only run model fetch on component mount
- Check if saved model exists before loading it
- Don't reset model if it's not in Ollama list (allows Claude)
2025-12-27 19:50:47 +00:00
Dave e3f4f92c54 Frontend: Add Claude integration UI
- Add Claude models to dropdown with optgroup sections
- Update context window calculation for Claude (200k tokens)
- Add API key dialog modal for first-time Claude use
- Check for API key existence before sending Claude requests
- Auto-detect provider from model name (claude-*)
- Update sendMessage to handle Claude provider
- Store and retrieve API key via backend commands
- Add visual separation between Anthropic and Ollama models
2025-12-27 19:43:00 +00:00
Dave 1529ca77e7 Backend: Add Anthropic/Claude provider integration
- Add anthropic.rs module with streaming support
- Convert between internal and Anthropic tool/message formats
- Add keyring dependency for secure API key storage
- Add API key management commands (get_exists, set)
- Auto-detect provider from model name (claude-* prefix)
- Support SSE streaming from Anthropic API
- Handle tool calling with Anthropic's format
- Add cancellation support for Anthropic streams
2025-12-27 19:41:20 +00:00
Dave e71dcd8226 Story 12: Update story and specs for Claude integration
Story Updates:
- Unified model dropdown with section headers (Anthropic, Ollama)
- Auto-detect provider from model name (claude-* prefix)
- API key prompt on first Claude model use
- Secure storage in OS keychain via keyring crate
- 200k token context window for Claude models

Spec Updates (AI_INTEGRATION.md):
- Document Anthropic provider implementation
- Anthropic API protocol (SSE streaming, tool format)
- Tool format conversion between internal and Anthropic formats
- API key storage in OS keychain
- Unified dropdown UI flow

Spec Updates (STACK.md):
- Add keyring crate for secure API key storage
- Add eventsource-stream for Anthropic SSE streaming
- Document automatic provider detection
- Update API key management approach
2025-12-27 19:37:01 +00:00
Dave ca7efc2888 Archive Story 23 to stories/archive/ 2025-12-27 19:30:32 +00:00
Dave bdb82bcf49 Story 23: Alphabetize LLM dropdown list
User Story:
As a user, I want the LLM model dropdown to be alphabetically sorted
so I can quickly find the model I'm looking for.

Implementation:
- Added alphabetical sorting with case-insensitive comparison
- Used localeCompare() for proper string comparison
- Sort happens immediately after fetching models from backend
- Currently selected model remains selected after sorting

Technical Details:
- Sort logic: models.sort((a, b) => a.toLowerCase().localeCompare(b.toLowerCase()))
- Frontend-only change, no backend modifications needed
- Sorting preserves model selection state

Acceptance Criteria Met:
 Models sorted alphabetically (case-insensitive)
 Selected model remains selected after sorting
 Works for all models from Ollama
 Updates correctly when models change

Files Changed:
- src/components/Chat.tsx: Added sorting logic to model fetch
- .living_spec/stories/23_alphabetize_llm_dropdown.md: Marked complete
2025-12-27 19:30:17 +00:00
Dave f963c2e17e Archive Story 22 to stories/archive/ 2025-12-27 19:21:48 +00:00
Dave 57826dc5ee Story 22: Implement smart auto-scroll that respects user scrolling
User Story:
As a user, I want to be able to scroll up to review previous messages
while the AI is streaming or adding new content, without being
constantly dragged back to the bottom.

Implementation:
- Replaced position-based threshold detection with user-intent tracking
- Detects when user scrolls UP and disables auto-scroll completely
- Auto-scroll only re-enables when user manually returns to bottom (<5px)
- Uses refs to track scroll position and direction for smooth operation
- Works seamlessly during rapid token streaming and tool execution

Technical Details:
- lastScrollTopRef: Tracks previous scroll position to detect direction
- userScrolledUpRef: Flag set when upward scrolling is detected
- Direct scrollTop manipulation for instant, non-fighting scroll behavior
- Threshold of 5px from absolute bottom to re-enable auto-scroll

Spec Updates:
- Added comprehensive Smart Auto-Scroll section to UI_UX.md
- Documented the problem, solution, requirements, and implementation
- Includes code examples and edge case handling

Acceptance Criteria Met:
 Auto-scroll disabled when scrolling up
 Auto-scroll resumes when returning to bottom
 Works normally when already at bottom
 Smooth detection without flickering
 Works during streaming and tool execution

Files Changed:
- src/components/Chat.tsx: Implemented user-intent tracking
- .living_spec/specs/functional/UI_UX.md: Added Smart Auto-Scroll spec
- .living_spec/stories/22_smart_autoscroll.md: Marked complete
2025-12-27 19:21:34 +00:00
Dave 1baf3fa728 Clean up duplicate Story 18 files (already archived) 2025-12-27 18:51:11 +00:00
Dave 50e2c2cd70 Remove Story 16 placeholder (work completed in previous commit) 2025-12-27 18:50:05 +00:00
Dave 02d3c05f34 UI: Move submit/stop button outside input field
- Restructure input area to use flexbox layout
- Button now sits beside input instead of overlapping
- Prevents text from being obscured on longer prompts
- Input takes full available width with proper spacing
2025-12-27 18:47:48 +00:00
Dave 71ce87d836 Story 15: Implement New Session cancellation
- Call cancel_chat before clearing session state
- Prevents tools from executing silently in background
- Prevents streaming from leaking into new session
- Uses same cancellation infrastructure as Story 13
- Clean session start with no side effects

Closes Story 15
2025-12-27 18:39:28 +00:00
Dave e1fb0e3d19 Story 13: Implement Stop button with backend cancellation
- Add tokio watch channel for cancellation signaling
- Implement cancel_chat command
- Add cancellation checks in streaming loop and before tool execution
- Stop button (■) replaces Send button (↑) during generation
- Preserve partial streaming content when cancelled
- Clean UX: no error messages on cancellation
- Backend properly stops streaming and prevents tool execution

Closes Story 13
2025-12-27 18:32:15 +00:00
Dave 846967ee99 Fix race condition: ignore streaming events from old sessions
- Added sessionIdRef to track current session
- When clearing session, generate new session ID
- Event listeners check if sessionId matches before updating state
- Prevents old streaming responses from appearing in new sessions
- All quality checks passing
2025-12-27 17:37:25 +00:00
Dave 68f35d4591 Fix New Session bug: use async Tauri dialog instead of window.confirm
- Tauri overrides window.confirm to return Promise, not boolean
- Changed clearSession to async function using Tauri's ask() dialog
- Now properly waits for user confirmation before clearing state
- Removed debug logging
- All quality checks passing
2025-12-27 17:33:03 +00:00
Dave 418fa86f7d Add debug logging to clearSession to diagnose Cancel button bug 2025-12-27 17:30:03 +00:00
Dave bd8d838457 Story 17: Display Context Window Usage with emoji indicator
- Added real-time context window usage indicator in header
- Format: emoji + percentage (🟢 52%)
- Color-coded emoji: 🟢 <75%, 🟡 <90%, 🔴 >=90%
- Hover tooltip shows full details: 'Context: 4,300 / 8,192 tokens (52%)'
- Token estimation: 1 token ≈ 4 characters
- Model-aware context windows: llama3 (8K), qwen2.5 (32K), deepseek (16K)
- Includes system prompts, messages, tool calls, and streaming content
- Updates in real-time as conversation progresses
- All quality checks passing (TypeScript, Biome, Clippy, builds)

Tested and verified:
- Shows accurate percentage of context usage
- Emoji changes color at appropriate thresholds
- Different models show correct context window sizes
- Can exceed 100% when over limit (shows red)
- Tooltip provides exact token counts
2025-12-27 17:26:21 +00:00
Dave 9965c78221 Remove duplicate/empty Story 15 (New Session was completed as Story 20) 2025-12-27 17:10:25 +00:00
Dave 88e2a9c0bc Add Story 22: Smart auto-scroll that respects user scrolling 2025-12-27 17:09:32 +00:00
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