Add a pause that holds an agent after its current step

This commit is contained in:
Ian Gulliver
2026-10-22 21:55:42 -07:00
parent 73519bf4dd
commit 293c21ca8c
25 changed files with 1014 additions and 472 deletions
+5 -5
View File
@@ -18,15 +18,14 @@ import (
"time"
"g.fc.run/ai/byre/internal/agentinput"
"g.fc.run/ai/byre/internal/hookcmd"
"g.fc.run/ai/byre/internal/mcp"
"g.fc.run/ai/byre/internal/procgroup"
)
type HookFunc func(ctx context.Context, input json.RawMessage) (map[string]any, error)
type HookMatcher struct {
Matcher string
Func HookFunc
Func hookcmd.Func
}
type Options struct {
@@ -207,7 +206,7 @@ type Session struct {
inflightMu sync.Mutex
inflight map[string]context.CancelFunc
hooks map[string]HookFunc
hooks map[string]hookcmd.Func
servers map[string]*mcp.Server
idMu sync.Mutex
@@ -237,7 +236,7 @@ func Start(ctx context.Context, opts Options) (*Session, error) {
done: make(chan struct{}),
pending: map[string]chan controlResult{},
inflight: map[string]context.CancelFunc{},
hooks: map[string]HookFunc{},
hooks: map[string]hookcmd.Func{},
servers: map[string]*mcp.Server{},
id: initialID(opts),
onBadLine: opts.OnBadLine,
@@ -386,6 +385,7 @@ func (s *Session) hookConfig(hooks map[string][]HookMatcher) map[string]any {
list = append(list, map[string]any{
"matcher": m.Matcher,
"hookCallbackIds": []string{id},
"timeout": hookcmd.Timeout,
})
}
cfg[event] = list