Add a pause that holds an agent after its current step
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
|
||||
"g.fc.run/ai/byre/internal/api"
|
||||
"g.fc.run/ai/byre/internal/codex"
|
||||
"g.fc.run/ai/byre/internal/hookcmd"
|
||||
)
|
||||
|
||||
var codexToolItems = map[string]bool{
|
||||
@@ -181,15 +182,20 @@ func (m *Manager) codexItemCompleted(ctx context.Context, l *live, s *codex.Sess
|
||||
if l.reviewID != "" {
|
||||
return nil
|
||||
}
|
||||
m.steerMidTurn(ctx, l, s)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Manager) steerMidTurn(ctx context.Context, l *live, s *codex.Session) {
|
||||
mt := m.deliverMidTurn(ctx, l)
|
||||
if mt.text == "" {
|
||||
return nil
|
||||
return
|
||||
}
|
||||
reply, err := s.Steer(mt.text)
|
||||
if err != nil {
|
||||
slog.Error("steer mid-turn delivery", "session", l.id, "err", err)
|
||||
m.restoreMidTurn(ctx, l, mt)
|
||||
return nil
|
||||
return
|
||||
}
|
||||
go func() {
|
||||
ctx := context.Background()
|
||||
@@ -199,7 +205,15 @@ func (m *Manager) codexItemCompleted(ctx context.Context, l *live, s *codex.Sess
|
||||
m.restoreMidTurn(ctx, l, mt)
|
||||
}
|
||||
}()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Manager) codexAfterTool(l *live) hookcmd.Func {
|
||||
return func(ctx context.Context, input json.RawMessage) (map[string]any, error) {
|
||||
if m.holdWhilePaused(ctx, l) && ctx.Err() == nil {
|
||||
m.steerMidTurn(context.WithoutCancel(ctx), l, l.sess.(codexProcess).s)
|
||||
}
|
||||
return map[string]any{}, nil
|
||||
}
|
||||
}
|
||||
|
||||
func imageAlt(prompt string) string {
|
||||
|
||||
Reference in New Issue
Block a user