Files
javis_bot/src/jarvis/tools/builtin/browse_and_play.spec.md
javis-bot 140fc56f18
Some checks failed
Release / semantic-release (push) Successful in 22s
tests / Unit tests (Linux, Python 3.11) (push) Failing after 5m16s
Release / build-linux (push) Failing after 7m10s
Release / build-windows (push) Has been cancelled
Release / build-macos (arm64, macos-latest) (push) Has been cancelled
Release / build-macos (x64, macos-15-intel) (push) Has been cancelled
Release / release-main (push) Has been cancelled
Release / release-develop (push) Has been cancelled
feat: play the Nth YouTube result in browseAndPlay via an index arg
agents/llm.md promises "play the Nth video from the top", but browseAndPlay
only ever clicked the first result. Add an optional 1-based index argument
(default 1, backward-compatible) threaded to the Node helper, which now clicks
the Nth a#video-title and clamps to the number of results returned so asking
beyond the list plays the last available video instead of failing.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-23 15:33:45 +09:00

1.7 KiB

browseAndPlay Tool Spec

Plays a YouTube video on the shared screen so it appears on the Go-Live broadcast. Used when the user asks the assistant to play / watch a song, music video, or clip.

Behaviour

  • Public schema is a required query string (what to play) plus an optional index integer (1-based position in the search results, counted from the top of the list). index defaults to 1 (first result), so existing callers and "play X" requests are unchanged; "play the 3rd video" / "play the second one" map to index=3 / index=2.
  • Mode-gated: only acts when STREAM_BROWSER is true (cfg.stream_browser). In voice-only mode (false) there is no screen to show, so it returns a short message and does nothing.
  • Drives the on-screen Chrome by subprocessing the Node CDP helper bot/scripts/stream-test/browse-search.mjs <query> youtube <index>, which searches YouTube and plays the chosen result on display :1. The broadcast captures that display, so the playback is what viewers see.
    • The helper clicks the index-th a#video-title in the results list. The index is clamped to the number of results actually returned, so asking for a position beyond the list plays the last available result rather than failing.
  • Returns success with the played video's title (and the resolved index), or a failure message if the helper/Chrome is unavailable. It does NOT make an LLM call.

Principles

  • The Node layer owns Chrome/CDP; the Python tool only shells out to it, so the brain stays free of a browser dependency.
  • Fail-open and explicit: any error returns a plain failure message rather than raising into the reply loop.