X-Git-Url: http://git.giacomolli.uk/onechat/blobdiff_plain/6e3e9c5c10f3d35bae7e9846334974a09418aef7..ddd0a50f7b801112376d7fb27bfd05d2fc26c2fd:/subagent.go?ds=inline diff --git a/subagent.go b/subagent.go index 0248751..596c038 100644 --- a/subagent.go +++ b/subagent.go @@ -115,6 +115,7 @@ func (s *Subagents) Get(ctx context.Context, name string) (*Subagent, error) { subagent = &Subagent{ name: name, + dir: root, log: log, syncer: syncer, } @@ -137,10 +138,12 @@ func (s *Subagents) Close() error { 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 @@ -185,6 +188,12 @@ func (a *Subagent) Show() (string, error) { 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()