Skip to content

agent: run a command on assistant state changes - #24

Merged
yawaflua merged 1 commit into
yawaflua:stagefrom
ryysel:pr/state-cmd
Nov 3, 2026
Merged

yawaflua merged 1 commit into
yawaflua:stagefrom
ryysel:pr/state-cmd

Conversation

@ryysel

@ryysel ryysel commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

On some speakers the LED ring or the display is owned by another process: on a VK Capsula Mini the vendor tweaker draws the ring and already knows about AirPlay, but it cannot see what the assistant is doing, so the ring stays dark while the assistant listens, thinks or speaks.

This adds an opt-in -state_command / MARUSYA_STATE_COMMAND: the agent runs the command on every assistant state change and appends the state as its last argument — idle, listening, thinking, speaking, error, disconnected, announcing. The other process draws it however it likes; the agent keeps no opinion about the ring.

Details:

  • Show returns at once and runs the command in the background, so a slow command cannot delay audio;
  • repeated states are skipped;
  • runs are serialised, so listening -> thinking cannot arrive reversed;
  • one run is bounded by 3 s;
  • arguments are split like -wake_command (no shell);
  • off by default, so nothing changes without the flag.

On our Capsula the command is a three-line script that maps states to capsule-ipc AP2 3|4|5 and restores the AirPlay indication on idle, so ring indication for the assistant no longer depends on a local patch.

Tests: internal/indicator/statecmd with a fake runner (argument passed, repeats skipped, empty command, Show does not block), go vet, go test -race ./internal/indicator/..., marusya-agent builds.

@yawaflua
yawaflua merged commit 72015c2 into yawaflua:stage Nov 3, 2026
7 checks passed
@yawaflua yawaflua mentioned this pull request Nov 10, 2026
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