Update trail watch for trail-wide events · Entire
Update trail watch for trail-wide events
4c6ebc1→main·
dipree·3w ago·2 files·+9 added/-9 removed
Sessions
8259670f86bdView transcript
[?
Update Trail Watch for Trail-Wide EventsPi·GPT-5.5·1 step](/content/gh/entireio/cli/session/019eff4c-71d5-731e-9f39-b7c2a8b81706#timeline-8259670f86bd/index.html)
Changes
2
cmd/entire/cli
Mtrail_watch_cmd.go+8/-8
Mtrail_watch_cmd_test.go+1/-1
17 unmodified lines
18
19
20
21
21
22
23
24
22 unmodified lines
47
48
49
50
51
52
53
50
51
52
53
54
55
56
57
58
58
59
60
61
62
62
63
64
65
154 unmodified lines
220
221
222
223
223
224
225
226
17 unmodified lines
"github.com/spf13/cobra"
//
// SSE control events for the agent-native finding stream. Domain events
// SSE control events for the trail-wide event stream. Domain events
// (for example "session.started" or "comment.created") are emitted as their
// code_review_events.event_type values.
const (
22 unmodified lines
cmd := &cobra.Command{
Use: "watch [<number>]",
Short: "Tail a trail's finding events live",
Long: `Subscribe to the trail-scoped agent-native finding SSE stream and
print events as they arrive. Reconnects automatically when the server caps the
connection (~50s) and on transient network errors.
Short: "Tail a trail's events live",
Long: `Subscribe to the trail-wide SSE stream and print events as they arrive.
Reconnects automatically when the server caps the connection (~50s) and on
transient network errors.
If <number> is omitted, the trail for the current branch is used.
This command resolves the trail's id internally and streams
GET /api/v1/trails/<id>/reviews/events with Accept: text/event-stream.
GET /api/v1/trails/<id>/events with Accept: text/event-stream.
Events emitted by the server:
ready initial frame, includes trail and cursor
<event_type> finding domain event (sessions, findings, suggested changes, ...)
<event_type> trail domain event (reviews, findings, runners, monitors, ...)
reconnect server cap reached; re-establishing
forbidden access was revoked; stream ends
error server-side error; treated as reconnect`,
154 unmodified lines
}
func reviewEventsPath(trailID string) string {
return "/api/v1/trails/" + url.PathEscape(trailID) + "/reviews/events"
return "/api/v1/trails/" + url.PathEscape(trailID) + "/events"
}
type streamCloseReason int
Mcmd/entire/cli/trail_watch_cmd.go+8/-8
39 unmodified lines
40
41
42
43
43
44
45
46
39 unmodified lines
func TestReviewEventsPath(t *testing.T) {
got := reviewEventsPath("trail id/with slash")
want := "/api/v1/trails/trail%20id%2Fwith%20slash/reviews/events"
want := "/api/v1/trails/trail%20id%2Fwith%20slash/events"
if got != want {
t.Fatalf("reviewEventsPath = %q, want %q", got, want)
}
}`