Parent
#39 — PRD: AI Radio — Host-driven Channel experience with chat timeline
What to build
Implement the Programme Manager — the coordinator that connects Channel selection, the Host Service, and the Player into a live radio loop.
Interface:
loadChannel(channel: Channel) → Promise<void>
handleIntervention(intervention: Intervention) → Promise<void>
onSegmentEnd(segmentId: string) → void // called by Player
Behaviour:
loadChannel(channel):
- Call
queryCandidateSet(channel.style) to get the CandidateSet
- Call
Host.generateProgramme(channel.style, candidates) to get the first Programme
- Call
Player.loadProgramme(programme) — playback starts
onSegmentEnd(segmentId):
- When the Programme is 2 Segments from exhaustion, trigger a background
generateProgramme call for the next Programme (pre-generation)
- When the last Segment ends, swap in the pre-generated Programme via
Player.loadProgramme
- This ensures continuous playback with no gap between Programmes
handleIntervention(intervention):
- Store the Intervention
- Call
Host.generateProgramme(channel.style, candidates, intervention)
- When the current TrackSegment ends (not mid-Segment), swap in the new Programme
The Programme Manager holds the active Channel and current CandidateSet in memory. On loadChannel, it resets state.
Write tests against injected Host and Player stubs: verify that the Host is called at the right moment (near-exhaustion trigger), and that the Player receives the correct Programme after an Intervention.
Acceptance criteria
Blocked by
Parent
#39 — PRD: AI Radio — Host-driven Channel experience with chat timeline
What to build
Implement the Programme Manager — the coordinator that connects Channel selection, the Host Service, and the Player into a live radio loop.
Interface:
Behaviour:
loadChannel(channel):queryCandidateSet(channel.style)to get the CandidateSetHost.generateProgramme(channel.style, candidates)to get the first ProgrammePlayer.loadProgramme(programme)— playback startsonSegmentEnd(segmentId):generateProgrammecall for the next Programme (pre-generation)Player.loadProgrammehandleIntervention(intervention):Host.generateProgramme(channel.style, candidates, intervention)The Programme Manager holds the active Channel and current CandidateSet in memory. On
loadChannel, it resets state.Write tests against injected Host and Player stubs: verify that the Host is called at the right moment (near-exhaustion trigger), and that the Player receives the correct Programme after an Intervention.
Acceptance criteria
Blocked by