Skip to content

feat: emit OSC 9 progress for herdr agent status detection - #4

Closed
alecuba16 wants to merge 1 commit into
masterfrom
herdr_detectable
Closed

alecuba16 wants to merge 1 commit into
masterfrom
herdr_detectable

Conversation

@alecuba16

@alecuba16 alecuba16 commented Jul 24, 2026 •

Copy link
Copy Markdown
Owner

Closes 1jehuang#5

Summary

jcode now emits structured OSC 9 progress sequences on every TUI redraw when the agent status changes, enabling terminal multiplexers like herdr to detect working/idle/blocked state without fragile screen-scraping.

Changes

  • tui_lifecycle_runtime.rs: Added agent_osc_state() (testable) and emit_agent_status_osc() that writes the OSC 9 sequence with dedup via last_osc_state. Suppressed in replay and title-off modes.
  • run_shell.rs: Calls emit_agent_status_osc() after every draw_full (covers local + remote run loops).
  • local.rs: Calls emit_agent_status_osc() on finish_turn (idle transition).
  • jcode-tui-permissions/src/lib.rs: Emits jcode:blocked on entry and jcode:idle on exit of the standalone permissions viewer.
  • app.rs / tui_lifecycle.rs: Added last_osc_state field to App struct.
  • 6 unit tests: idle/working state, dedup, state transitions, replay suppression, title-off suppression.

Payload format

OSC 9 ;jcode:working BEL / OSC 9 ;jcode:idle BEL / OSC 9 ;jcode:blocked BEL

Testing

  • Selfdev build: exit 0
  • 6/6 new OSC unit tests pass
  • Full jcode-tui suite: 1930 passed, 17 pre-existing failures (all unrelated to OSC)

Companion PRs

jcode now emits OSC 9 progress sequences ('jcode:working' / 'jcode:idle' /
'jcode:blocked') on TUI redraw when processing status transitions, so
terminal multiplexers like herdr can detect agent state via structured
side-channel instead of fragile screen-scraping.

Changes:
- Add emit_agent_status_osc() with dedup via last_osc_state field
- Call it after every full redraw in draw_full (covers local and remote)
- Call it on turn finish (idle transition) in local.rs
- Only writes OSC when state changes (no per-frame flooding)
- Permissions viewer emits 'jcode:blocked' on entry, 'jcode:idle' on exit
- Add analysis document explaining the detection improvement strategy
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.

Stuck at "prompt is too long"

1 participant