Repository navigation
feat: read an agent's turn from its hook, its spinner or quiet output - #124
Merged
Merged
Conversation
… or quiet output A turn was read only from the window title spinner, so a program that draws no spinner (Cursor Agent) never told its parent that its turn ended. Each run now has one turn source. Claude gets a per-thread settings file that calls `kg thread turn start|end` from its UserPromptSubmit, Stop and StopFailure hooks. Other programs keep the spinner. A known agent with neither gets a quiet turn that opens on submit and ends after 15 seconds without output change. Hook runs also end after 120 seconds of silence, because Claude does not fire Stop when Esc is pressed. The turn rules are a pure state machine (thread/turn_state.rs) with table tests. The watch loop and the hook op feed it. Size ceiling raised by 316 lines for the state machine, the hook op and its tests.
…rm turn hook A hook turn could close on its first tick because the title's plain clock outlived the turn before it. The state machine now owns all turn timing, and a plain title closes a hook turn only after a spinner was seen in that turn. A submit now opens a quiet turn only when visible text changes within 3 seconds, so an empty Enter opens nothing. A quiet turn ends when the visible text stops changing, not when the terminal redraws. The Claude hook runs kg directly with arguments instead of a shell string. kg thread turn sends to a running app and never starts one or fails.
# Conflicts: # docs/decisions.md
clippy flagged the hook helper for taking an unused owned Op and returning a Result that is always Ok. It now borrows the op and returns nothing; the caller still exits 0.
The first redraw after a line was counted as output even when the visible text had not changed, so an Enter that only repainted opened a quiet turn.
# Conflicts: # .config/size-budget.txt # docs/behaviour.md # docs/decisions.md
# Conflicts: # .config/size-budget.txt # crates/domain/src/lib.rs # crates/domain/src/op/check.rs # docs/decisions.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Branch feat/cursor-turn-signal.
Reviewed by a fresh reviewer, fixed, and re-checked (SHIP). Gate: fmt, clippy -D warnings, workspace tests, scripts.