Skip to content

feat(tui): /rename, /cost, /continue <name>, ask_user picker, runtime…#397

Merged
lsdefine merged 1 commit into
lsdefine:mainfrom
shenhao-stu:feat/tuiapp-v2-rename-cost
May 16, 2026
Merged

feat(tui): /rename, /cost, /continue <name>, ask_user picker, runtime…#397
lsdefine merged 1 commit into
lsdefine:mainfrom
shenhao-stu:feat/tuiapp-v2-rename-cost

Conversation

@shenhao-stu

@shenhao-stu shenhao-stu commented May 16, 2026

Copy link
Copy Markdown
Contributor

Adds to frontends/tuiapp_v2.py:

  • /rename : rename current session; collision-checked across in-memory sessions and the persistent registry. Topbar and sidebar refresh in place.
  • /continue : resume by stored name in addition to the existing index form (/continue 1). The picker (/continue with no arg) labels each entry with its stored name when available.
  • /cost [all]: per-session token usage (input / output / cache_create / cache_read), elapsed time, request count, and context-window %-left. The "all" form lists every tracked thread, including ended sessions.
  • ask_user picker upgrades: free-text escape hatch on every list, Esc-back navigation, single/multi-select switch from a [多选]/[multi] question hint, candidate sanitizer that handles JSON-envelope debris.
  • Runtime tip footer (└ Tip: ...) that rotates short usage hints.
  • Topbar status chip showing the active model + idle/busy state.
  • Cross-platform launcher hardening: auto-install of rich/textual on first run, and a hint when running under git-bash/mintty.

New modules:

  • frontends/session_names.py: JSON sidecar at temp/model_responses/ session_names.json keyed by log-file basename; touched only by /rename and /continue . continue_cmd is not modified.
  • frontends/cost_tracker.py: per-thread TokenStats, captured via monkey-patches on llmcore._record_usage and llmcore.print (Anthropic SSE's final output count only arrives via the latter). Idempotent install().

No core files touched.

… tips

Adds to frontends/tuiapp_v2.py:
- /rename <name>: rename current session; collision-checked across in-memory
  sessions and the persistent registry. Topbar and sidebar refresh in place.
- /continue <name>: resume by stored name in addition to the existing index
  form (/continue 1). The picker (/continue with no arg) labels each entry
  with its stored name when available.
- /cost [all]: per-session token usage (input / output / cache_create /
  cache_read), elapsed time, request count, and context-window %-left. The
  "all" form lists every tracked thread, including ended sessions.
- ask_user picker upgrades: free-text escape hatch on every list, Esc-back
  navigation, single/multi-select switch from a [多选]/[multi] question hint,
  candidate sanitizer that handles JSON-envelope debris.
- Runtime tip footer (`└ Tip: ...`) that rotates short usage hints.
- Topbar status chip showing the active model + idle/busy state.
- Cross-platform launcher hardening: auto-install of rich/textual on first
  run, and a hint when running under git-bash/mintty.

New modules:
- frontends/session_names.py: JSON sidecar at temp/model_responses/
  session_names.json keyed by log-file basename; touched only by /rename and
  /continue <name>. continue_cmd is not modified.
- frontends/cost_tracker.py: per-thread TokenStats, captured via
  monkey-patches on llmcore._record_usage and llmcore.print (Anthropic SSE's
  final output count only arrives via the latter). Idempotent install().

No core files touched.
@lsdefine
lsdefine merged commit 2566bb8 into lsdefine:main May 16, 2026
RocketLi pushed a commit to RocketLi/GenericAgent that referenced this pull request May 18, 2026
…ine#397)

feat(tui): /rename, /cost, /continue <name>, ask_user picker, runtime…
lsdefine added a commit that referenced this pull request Jul 23, 2026
feat(tui): /rename, /cost, /continue <name>, ask_user picker, runtime…
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