Let task agents use client Macs directly: bash, copy and hands

This commit is contained in:
Ian Gulliver
2026-10-17 23:45:31 -07:00
parent 8d9ba10849
commit 9b79ade073
25 changed files with 1382 additions and 952 deletions
+5 -8
View File
@@ -16,6 +16,7 @@ import (
"g.fc.run/misc/byre/internal/agents"
"g.fc.run/misc/byre/internal/api"
"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/todo"
@@ -26,6 +27,7 @@ type Server struct {
store *store.Store
agents *agents.Manager
hub *hub
clients *clients.Registry
terminals *terminals
startedAt time.Time
@@ -43,6 +45,7 @@ func New(dataDir string, portFirst int) (*Server, error) {
s := &Server{
hub: newHub(),
clients: clients.New(),
terminals: newTerminals(),
startedAt: time.Now().UTC(),
users: map[string]string{},
@@ -65,7 +68,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, "codex"), s.status, s.createProject)
s.agents = agents.New(s.store, filepath.Join(dataDir, "worktrees"), filepath.Join(dataDir, "leads"), filepath.Join(dataDir, "codex"), s.status, s.createProject, s.clients)
err = s.agents.Recover(context.Background())
if err != nil {
s.store.Close()
@@ -81,7 +84,6 @@ func (s *Server) publish(events []api.Event) {
s.hub.publish(ev)
}
s.agents.Observe(events)
s.removeClosedBundles(events)
for _, ev := range events {
if (ev.Kind == "task.merged" || ev.Kind == "task.discarded") && ev.TaskId != nil {
s.terminals.close(*ev.TaskId)
@@ -134,7 +136,7 @@ func (s *Server) identify(next http.Handler) http.Handler {
return
}
if (r.Method != http.MethodGet && !automaticRequests[r.Pattern]) || humanGets[r.Pattern] {
if r.Method != http.MethodGet && !automaticRequests[r.Pattern] {
s.acted(login, r)
}
@@ -155,11 +157,6 @@ func (s *Server) clientsChanged() {
var automaticRequests = map[string]bool{
"PUT /api/me/pane-focus": true,
"PUT /api/tasks/{taskId}/summary-read": true,
"POST /api/inbox/{itemId}/runs": true,
}
var humanGets = map[string]bool{
"GET /api/inbox/{itemId}/bundle": true,
}
func (s *Server) ensureUser(ctx context.Context, login, name string) error {