Add a pause that holds an agent after its current step
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user