Skip to content

feat(spotify): gateway slash-command handlers for common playback actions - #186

Closed
salch-cred wants to merge 4 commits into
NousResearch:mainfrom
salch-cred:feat/spotify-gateway-commands
Closed

salch-cred wants to merge 4 commits into
NousResearch:mainfrom
salch-cred:feat/spotify-gateway-commands

Conversation

@salch-cred

Copy link
Copy Markdown
Contributor

feat(spotify): gateway slash-command handlers for common playback actions

Summary

Issue #18 asks for gateway slash commands so common actions do not need a full agent turn. This lands the plugin half: spotify/gateway_commands.py with play(query), pause(), skip(), nowplaying() and queue(query), each returning one terse line (the issue's table), plus 13 tests.

Behaviour

  • Handlers call the existing spotify_* tools, so playback, device resolution and Premium restrictions behave exactly as the model path does. /play without a query resumes; with one, the top search hit plays (no pickers, per the non-goals).
  • Failures become one line: Premium required, no active device ("open Spotify somewhere"), not configured ("run hermes spotify login"), otherwise the tool message.
  • Output shape follows the issue: ? Blackbird ? The Beatles ? 0:42 / 9:22 ? Kitchen Sonos, Skipped ? next: ?, Queued: ?.
  • Version bump 2.1.0 ? 2.2.0 and a README section.

Draft, pending core

Dispatch (/play ? handler) and visibility gating live in core: the issue's gateway_availability_fn extension plus a dispatch block in gateway/run.py. Availability must be two-factor (toolset enabled AND login stored). Until that lands the handlers are callable directly and exercised by tests.

Tests

tests/test_spotify_gateway_commands.py: 13 passed (resume, search-and-play, no match, pause, skip naming the next track, nowplaying with/without device/track, queue add/usage, four error mappings). ruff clean.

Refs #18.

salch-cred and others added 4 commits October 24, 2026 07:11
…ions

Five terse gateway commands without a full agent turn: /play [query], /pause, /skip, /nowplaying (alias /np), /queue <query>. The handlers call the same tools the model does and format one line, so state handling and Premium/device restrictions behave identically.

Handlers and formatting only; dispatch lives in core and is a follow-up, and availability gating needs core's gateway_availability_fn hook (toolset enabled AND a stored login). Search picks the top result; no interactive pickers.
…not configured'

spotify/.coverage was a 53 KB coverage database committed by accident; it is
removed and ignored. SpotifyClient() raises SpotifyAuthRequiredError outside
the tool's error boundary, so every handler raised instead of returning the
'Spotify not configured' line the issue asks for.
So the handler tests stay green once the active-device guard (NousResearch#142) or the
default device (NousResearch#145) makes playback calls list devices first.
@teknium1 teknium1 added the needs-decision Awaiting an owner policy or product decision label Nov 19, 2026
teknium1 added a commit that referenced this pull request Nov 20, 2026
Reworks #186's handlers into a single command registered through the
documented plugin API (ctx.register_command), so it works in the CLI and every
messaging gateway now instead of waiting on a core dispatch change:

  /spotify play [query] | pause | skip | np | queue <track>

One /spotify name keeps clear of core's own /pause and /queue (register_command
skips a name that clashes with a built-in). np is now playing. An unknown or
missing subcommand prints the usage line. Sync handler: core runs it on the
gateway pool, not the event loop.

Version 2.2.0 (plugin.yaml now matches pyproject).

Fixes #18
@teknium1

Copy link
Copy Markdown
Contributor

Thank you @salch-cred! This landed on main through #451, reworked into one /spotify play|pause|skip|np|queue command so it no longer clashes with core's /pause and /queue, with your authorship kept; tip b4ad60b. To get it now: hermes plugins install NousResearch/hermes-official-plugins#<plugin> --force; hermes plugins update follows once the catalog pin moves (in progress).

@teknium1 teknium1 closed this Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-decision Awaiting an owner policy or product decision

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants