[PR #275] [CLOSED] feat: add dynamic window titles based on user messages #9569

Closed
opened 2026-02-16 18:13:47 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/anomalyco/opencode/pull/275
Author: @aryasaatvik
Created: 6/20/2025
Status: Closed

Base: devHead: feat/dynamic-window-title


📝 Commits (4)

  • 5f95fc5 feat: enhance window title management in app
  • 9ccd1fc feat: add session title generation API
  • 9cb1ee4 feat: add PostSessionGenerateTitle API and response handling
  • 1b5d653 feat: implement window title generation in app

📊 Changes

8 files changed (+591 additions, -12 deletions)

View changed files

📝 packages/opencode/src/server/server.ts (+30 -0)
📝 packages/opencode/src/session/index.ts (+58 -0)
packages/opencode/src/session/prompt/title-window.txt (+1 -0)
📝 packages/opencode/src/session/system.ts (+5 -0)
📝 packages/tui/internal/app/app.go (+25 -0)
📝 packages/tui/internal/tui/tui.go (+54 -1)
📝 packages/tui/pkg/client/gen/openapi.json (+109 -5)
📝 packages/tui/pkg/client/generated-client.go (+309 -6)

📄 Description

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)

https://github.com/user-attachments/assets/32d3f521-70db-42f4-b129-71dab67be3fe


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/anomalyco/opencode/pull/275 **Author:** [@aryasaatvik](https://github.com/aryasaatvik) **Created:** 6/20/2025 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `feat/dynamic-window-title` --- ### 📝 Commits (4) - [`5f95fc5`](https://github.com/anomalyco/opencode/commit/5f95fc5b15ae72b2e90cf36dad94a550fa93dece) feat: enhance window title management in app - [`9ccd1fc`](https://github.com/anomalyco/opencode/commit/9ccd1fc466211b9d31e37aa197120d8ce01fad92) feat: add session title generation API - [`9cb1ee4`](https://github.com/anomalyco/opencode/commit/9cb1ee4a206b3c5e05a0c845bc67868d5f4b4081) feat: add PostSessionGenerateTitle API and response handling - [`1b5d653`](https://github.com/anomalyco/opencode/commit/1b5d653982b4ac7a442e7915ef4443ff13525a7f) feat: implement window title generation in app ### 📊 Changes **8 files changed** (+591 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `packages/opencode/src/server/server.ts` (+30 -0) 📝 `packages/opencode/src/session/index.ts` (+58 -0) ➕ `packages/opencode/src/session/prompt/title-window.txt` (+1 -0) 📝 `packages/opencode/src/session/system.ts` (+5 -0) 📝 `packages/tui/internal/app/app.go` (+25 -0) 📝 `packages/tui/internal/tui/tui.go` (+54 -1) 📝 `packages/tui/pkg/client/gen/openapi.json` (+109 -5) 📝 `packages/tui/pkg/client/generated-client.go` (+309 -6) </details> ### 📄 Description ## 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 - [x] Test window title updates when submitting messages - [x] Verify title reverts to "opencode" when AI completes - [x] Test title reset on session interrupt (Ctrl+C) - [x] Verify title resets when switching sessions - [x] Test fallback to truncated message if API fails - [x] Ensure title generation works with different providers (Anthropic, OpenAI) https://github.com/user-attachments/assets/32d3f521-70db-42f4-b129-71dab67be3fe --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-16 18:13:47 -05:00
yindo closed this issue 2026-02-16 18:13:47 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#9569