Add MonitorAlbumStream bidirectional streaming RPC with automatic and manual interaction modes

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/claude-agent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
Alexander
2026-05-11 10:26:37 +02:00
parent f5e2f764b5
commit 24f355c5ae
4 changed files with 2187 additions and 0 deletions
+25
View File
@@ -7,6 +7,8 @@ import (
"github.com/riverqueue/river"
"github.com/rs/zerolog/log"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
pb "homelab.lan/music-agregator/gen/music_agregator/v1"
"homelab.lan/music-agregator/internal/config"
@@ -46,6 +48,29 @@ func (s *MusicAgregatorServer) MonitorAlbum(ctx context.Context, req *pb.Monitor
return s.service.MonitorAlbum(ctx, req)
}
func (s *MusicAgregatorServer) MonitorAlbumStream(stream pb.MusicAgregatorService_MonitorAlbumStreamServer) error {
msg, err := stream.Recv()
if err != nil {
return err
}
startReq := msg.GetStart()
if startReq == nil {
return status.Error(codes.InvalidArgument, "first message must be StartMonitorRequest")
}
ctx, cancel := context.WithCancel(stream.Context())
defer cancel()
workflow := newMonitorWorkflow(stream, startReq, s.service, cancel)
if startReq.Mode == pb.InteractionMode_INTERACTION_MODE_MANUAL {
go workflow.receiveDecisions(ctx)
}
return workflow.run(ctx)
}
func (s *MusicAgregatorServer) AnalyzeAlbumRelease(ctx context.Context, req *pb.AnalyzeAlbumReleaseRequest) (*pb.AnalyzeAlbumReleaseResponse, error) {
return s.service.AnalyzeAlbumRelease(ctx, req)
}