Skip to content

Conversation

@aryasaatvik
Copy link
Contributor

@aryasaatvik aryasaatvik commented Jun 20, 2025

Summary

  • Adds dynamic window title generation that shows the user's message in the terminal title bar while AI is processing
  • Implements AI-powered title generation using fast models (Haiku for Anthropic, GPT-4o-mini for OpenAI)
  • Window title reverts to "opencode" when AI finishes processing or when session is interrupted

Implementation Details

  • Added /session_generate_title endpoint in TypeScript server
  • Created title-window.txt prompt file for concise title generation
  • Integrated window title updates in Go TUI client
  • Title generation happens asynchronously without blocking message submission
  • Handles edge cases like session interruption, session switching, and model selection

Test Plan

  • Test window title updates when submitting messages
  • Verify title reverts to "opencode" when AI completes
  • Test title reset on session interrupt (Ctrl+C)
  • Verify title resets when switching sessions
  • Test fallback to truncated message if API fails
  • Ensure title generation works with different providers (Anthropic, OpenAI)
CleanShot.2025-06-21.at.01.54.50.mp4

- Implement formatWindowTitle function to set dynamic window titles based on submitted messages
- Update window title on message send and reset when processing is complete
- Maintain lastSubmittedMessage and wasProcessing state for accurate title updates
- Implement /session_generate_title endpoint to generate concise titles for messages
- Add generateTitle function in Session namespace to handle title generation logic
- Introduce windowTitle function in SystemPrompt to retrieve the title prompt from a new file
- Introduce PostSessionGenerateTitleJSONBody for request parameters
- Implement PostSessionGenerateTitle and PostSessionGenerateTitleWithBody methods in the client
- Add response parsing for PostSessionGenerateTitleResponse
- Update OpenAPI spec to include /session_generate_title endpoint with request and response schemas
- Add WindowTitleMsg type for window title updates
- Introduce GenerateWindowTitle method to handle title generation logic
- Update app model to asynchronously set window title based on generated titles
@aryasaatvik aryasaatvik force-pushed the feat/dynamic-window-title branch from 2779ffd to 1b5d653 Compare June 20, 2025 20:05
@thdxr
Copy link
Contributor

thdxr commented Jun 20, 2025

this is very cool

i want to clean up our system for doing conditional stuff per provider so let me play with that first before i merge this

@aryasaatvik
Copy link
Contributor Author

this is very cool

i want to clean up our system for doing conditional stuff per provider so let me play with that first before i merge this

thank you! for smaller tasks like generating verbs and window title i think it would be better to store 2 models (lightweight and main) in the config. i will finish #279 tomorrow

aryasaatvik added a commit to AryaLabsHQ/opencoder that referenced this pull request Jun 27, 2025
## Summary
This PR implements dual model support (main + turbo) for cost-optimized
operations and adds model sorting functionality.

### Key Changes

#### Dual Model Support
- Added `turbo_model` and `turbo_cost_threshold` config options
- New dual-pane model selector (Tab to switch panes)
- Visual indicators: ⚡ (turbo), 🧠 (reasoning), 🔧 (tools)
- Smart turbo model selection with fallback logic
- Fixed Anthropic auth showing incorrect turbo status

#### Model Sorting
- Added `release_date` and `last_updated` fields to model schema
- Press 'S' to cycle through sort modes: Name, Last Updated, Release
Date
- Stable multi-level sorting with consistent ordering
- Helps discover newest models and track updates

### Impact
Enables cost optimization for PRs anomalyco#269 (status verbs) and anomalyco#275 (window
titles) to use configured turbo models instead of hardcoded ones.

### Demo



https://github.com/user-attachments/assets/d076e840-d790-4e23-8cf7-a179282d1f0b
aryasaatvik added a commit to AryaLabsHQ/opencoder that referenced this pull request Jun 27, 2025
## Summary
This PR implements dual model support (main + turbo) for cost-optimized
operations and adds model sorting functionality.

### Key Changes

#### Dual Model Support
- Added `turbo_model` and `turbo_cost_threshold` config options
- New dual-pane model selector (Tab to switch panes)
- Visual indicators: ⚡ (turbo), 🧠 (reasoning), 🔧 (tools)
- Smart turbo model selection with fallback logic
- Fixed Anthropic auth showing incorrect turbo status

#### Model Sorting
- Added `release_date` and `last_updated` fields to model schema
- Press 'S' to cycle through sort modes: Name, Last Updated, Release
Date
- Stable multi-level sorting with consistent ordering
- Helps discover newest models and track updates

### Impact
Enables cost optimization for PRs anomalyco#269 (status verbs) and anomalyco#275 (window
titles) to use configured turbo models instead of hardcoded ones.

### Demo



https://github.com/user-attachments/assets/d076e840-d790-4e23-8cf7-a179282d1f0b
aryasaatvik added a commit to AryaLabsHQ/opencoder that referenced this pull request Jun 27, 2025
## Summary
This PR implements dual model support (main + turbo) for cost-optimized
operations and adds model sorting functionality.

### Key Changes

#### Dual Model Support
- Added `turbo_model` and `turbo_cost_threshold` config options
- New dual-pane model selector (Tab to switch panes)
- Visual indicators: ⚡ (turbo), 🧠 (reasoning), 🔧 (tools)
- Smart turbo model selection with fallback logic
- Fixed Anthropic auth showing incorrect turbo status

#### Model Sorting
- Added `release_date` and `last_updated` fields to model schema
- Press 'S' to cycle through sort modes: Name, Last Updated, Release
Date
- Stable multi-level sorting with consistent ordering
- Helps discover newest models and track updates

### Impact
Enables cost optimization for PRs anomalyco#269 (status verbs) and anomalyco#275 (window
titles) to use configured turbo models instead of hardcoded ones.

### Demo



https://github.com/user-attachments/assets/d076e840-d790-4e23-8cf7-a179282d1f0b
@thdxr thdxr self-assigned this Jul 2, 2025
@github-actions github-actions bot force-pushed the dev branch 3 times, most recently from f1dc981 to 3e15a39 Compare November 22, 2025 18:07
@github-actions github-actions bot force-pushed the dev branch 3 times, most recently from f8ee907 to 6a9856d Compare November 27, 2025 01:29
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.

2 participants