Let task agents read and type into the task's terminal
This commit is contained in:
@@ -19,6 +19,7 @@ import (
|
||||
"g.fc.run/misc/byre/internal/clients"
|
||||
"g.fc.run/misc/byre/internal/git"
|
||||
"g.fc.run/misc/byre/internal/store"
|
||||
"g.fc.run/misc/byre/internal/terminal"
|
||||
"g.fc.run/misc/byre/internal/todo"
|
||||
"g.fc.run/misc/byre/internal/workflow"
|
||||
)
|
||||
@@ -28,7 +29,7 @@ type Server struct {
|
||||
agents *agents.Manager
|
||||
hub *hub
|
||||
clients *clients.Registry
|
||||
terminals *terminals
|
||||
terminals *terminal.Terminals
|
||||
startedAt time.Time
|
||||
|
||||
usersMu sync.Mutex
|
||||
@@ -45,7 +46,7 @@ func New(dataDir string, portFirst int) (*Server, error) {
|
||||
|
||||
s := &Server{
|
||||
hub: newHub(),
|
||||
terminals: newTerminals(),
|
||||
terminals: terminal.New(),
|
||||
startedAt: time.Now().UTC(),
|
||||
users: map[string]string{},
|
||||
}
|
||||
@@ -68,7 +69,7 @@ func New(dataDir string, portFirst int) (*Server, error) {
|
||||
}
|
||||
}
|
||||
|
||||
s.agents = agents.New(s.store, filepath.Join(dataDir, "worktrees"), filepath.Join(dataDir, "leads"), filepath.Join(dataDir, "hands"), filepath.Join(dataDir, "codex"), s.status, s.createProject, s.clients)
|
||||
s.agents = agents.New(s.store, filepath.Join(dataDir, "worktrees"), filepath.Join(dataDir, "leads"), filepath.Join(dataDir, "hands"), filepath.Join(dataDir, "codex"), s.status, s.createProject, s.clients, s.terminals)
|
||||
err = s.agents.Recover(context.Background())
|
||||
if err != nil {
|
||||
s.store.Close()
|
||||
@@ -86,14 +87,14 @@ func (s *Server) publish(events []api.Event) {
|
||||
s.agents.Observe(events)
|
||||
for _, ev := range events {
|
||||
if (ev.Kind == "task.merged" || ev.Kind == "task.discarded") && ev.TaskId != nil {
|
||||
s.terminals.close(*ev.TaskId)
|
||||
s.terminals.Close(*ev.TaskId)
|
||||
go s.agents.Unexpose(context.Background(), *ev.TaskId)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Server) Close() error {
|
||||
s.terminals.closeAll()
|
||||
s.terminals.CloseAll()
|
||||
s.agents.Close()
|
||||
return s.store.Close()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user