subagent = &Subagent{
name: name,
+ dir: root,
log: log,
syncer: syncer,
}
return err
}
-// Subagent is one subagent and its log. Its mutex protects the log, because
-// the run of the subagent writes it while the agent reads it with zoom.
+// Subagent is one subagent, its directory, and its log. Its mutex protects the
+// log, because the run of the subagent writes it while the agent reads it with
+// zoom.
type Subagent struct {
name string
+ dir string
mutex sync.Mutex
log *Log
syncer *Syncer
return strings.Join(lines, "\n\n"), nil
}
+// WorkDir returns the directory where the tools of the subagent run: work in
+// its directory.
+func (a *Subagent) WorkDir() string {
+ return filepath.Join(a.dir, "work")
+}
+
// close makes the writes durable and closes the log.
func (a *Subagent) close() error {
a.mutex.Lock()