support milestone and thrash rotation signals

This commit is contained in:
kami
2026-07-26 20:36:17 +04:00
parent b4d9621d89
commit 4364dff9c2
3 changed files with 22 additions and 2 deletions
+12
View File
@@ -19,6 +19,9 @@ type Adapter interface {
type TurnBoundary interface {
AtTurnBoundary(context.Context, Session) (bool, error)
}
type RotationSignal interface {
RotationSignal(context.Context, Session) (string, error)
}
type CLIAdapter struct {
Client *Client
Harness string
@@ -58,6 +61,15 @@ func (a CLIAdapter) AtTurnBoundary(ctx context.Context, s Session) (bool, error)
}
return !IsBusy(r.Status), nil
}
func (a CLIAdapter) RotationSignal(ctx context.Context, s Session) (string, error) {
var r struct {
Reason string `json:"reason"`
}
if err := a.Client.Call(ctx, "pane.rotation_signal", s, &r); err != nil {
return "", err
}
return r.Reason, nil
}
func (a CLIAdapter) Occupancy(s Session) (float64, error) {
if a.Usage == nil {
return 0, fmt.Errorf("adapter: usage reader required")