Attach a refs/notes/byre note to each squash merge and push it
This commit is contained in:
@@ -866,6 +866,40 @@ func (s *Store) TaskEventsTail(ctx context.Context, taskID string, limit int) ([
|
||||
return scanEvents(rows)
|
||||
}
|
||||
|
||||
type Handoff struct {
|
||||
SessionID string
|
||||
At time.Time
|
||||
Text string
|
||||
}
|
||||
|
||||
func (s *Store) TaskHandoffs(ctx context.Context, taskID string) ([]Handoff, error) {
|
||||
rows, err := s.db.QueryContext(ctx, `
|
||||
SELECT agent_session_id, created_at, coalesce(json_extract(payload, '$.result'), '') FROM events
|
||||
WHERE task_id = ? AND kind = 'turn.ended' AND json_extract(payload, '$.handoff') = 1
|
||||
ORDER BY seq
|
||||
`, taskID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
|
||||
handoffs := []Handoff{}
|
||||
for rows.Next() {
|
||||
h := Handoff{}
|
||||
at := ""
|
||||
err = rows.Scan(&h.SessionID, &at, &h.Text)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
h.At, err = parseTime(at)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
handoffs = append(handoffs, h)
|
||||
}
|
||||
return handoffs, rows.Err()
|
||||
}
|
||||
|
||||
func (s *Store) LeadEvents(ctx context.Context, owner string, after int64, limit int) ([]api.Event, error) {
|
||||
rows, err := s.db.QueryContext(ctx, `
|
||||
SELECT `+eventColumns+`
|
||||
|
||||
Reference in New Issue
Block a user