]> git.giacomolli.uk - onechat/blobdiff - subagent_run.go
Separate multiline Go statements
[onechat] / subagent_run.go
index 8084c390a7012d5213019f1f784ec3214ce08bbe..3df12ce74483725ed8d97883f938cd99bff175fc 100644 (file)
@@ -78,6 +78,25 @@ type SubagentRuns struct {
        workers sync.WaitGroup
 }
 
        workers sync.WaitGroup
 }
 
+// SubagentRun is one run of a subagent: the view that its requests get, its
+// effort, the end of its context, the messages of Tell that wait for a request,
+// whether Stop ended it, and the time it started. The mutex of SubagentRuns
+// protects the messages and the stop.
+type SubagentRun struct {
+       subagent *Subagent
+       view     []string
+       effort   string
+       cancel   context.CancelFunc
+       pending  []Message
+       stopped  bool
+       started  time.Time
+}
+
+// SubagentWorkFile is the content of work.json.
+type SubagentWorkFile struct {
+       Running []string `json:"running"`
+}
+
 // Spawn starts one subagent for each task and returns their names at once. It
 // waits until the view has no pending summary, and gives the view to each
 // subagent. A nil effort is the effort of the agent.
 // Spawn starts one subagent for each task and returns their names at once. It
 // waits until the view has no pending summary, and gives the view to each
 // subagent. A nil effort is the effort of the agent.
@@ -424,8 +443,9 @@ func (r *SubagentRuns) workPath() string {
 }
 
 // run runs the chains of run and reports and logs its end with the length of
 }
 
 // run runs the chains of run and reports and logs its end with the length of
-// the run, unless Close ended it. A chain follows while messages wait after the final answer of the chain before
-// it, and no chain failed. A chain that Stop ends gives the reply "stopped".
+// the run, unless Close ended it. A chain follows while messages wait after the
+// final answer of the chain before it, and no chain failed. A chain that Stop
+// ends gives the reply "stopped".
 func (r *SubagentRuns) run(ctx context.Context, run *SubagentRun) {
        defer r.workers.Done()
        defer run.cancel()
 func (r *SubagentRuns) run(ctx context.Context, run *SubagentRun) {
        defer r.workers.Done()
        defer run.cancel()
@@ -515,11 +535,13 @@ func (r *SubagentRuns) chain(ctx context.Context, run *SubagentRun) (string, err
        input = append(input, modelUserMessage(r.state()), modelUserMessage(log))
        chain := &Chain{
                client: r.client,
        input = append(input, modelUserMessage(r.state()), modelUserMessage(log))
        chain := &Chain{
                client: r.client,
+               images: r.agent.Images(),
                tools: &Toolbox{
                        log:       run.subagent,
                        chat:      r.memory,
                        subagents: r.subagents,
                        workdir:   run.subagent.WorkDir(),
                tools: &Toolbox{
                        log:       run.subagent,
                        chat:      r.memory,
                        subagents: r.subagents,
                        workdir:   run.subagent.WorkDir(),
+                       images:    r.agent.Images(),
                },
                request: ModelRequest{
                        Model:        r.agent.config.Model,
                },
                request: ModelRequest{
                        Model:        r.agent.config.Model,
@@ -548,25 +570,6 @@ func (r *SubagentRuns) take(run *SubagentRun) []Message {
        return messages
 }
 
        return messages
 }
 
-// SubagentRun is one run of a subagent: the view that its requests get, its
-// effort, the end of its context, the messages of Tell that wait for a request,
-// whether Stop ended it, and the time it started. The mutex of SubagentRuns protects the messages
-// and the stop.
-type SubagentRun struct {
-       subagent *Subagent
-       view     []string
-       effort   string
-       cancel   context.CancelFunc
-       pending  []Message
-       stopped  bool
-       started  time.Time
-}
-
-// SubagentWorkFile is the content of work.json.
-type SubagentWorkFile struct {
-       Running []string `json:"running"`
-}
-
 // subagentReport returns the report of the subagent name with its replies: the
 // name in brackets, a new line, the replies, and the zoom that gives its whole
 // chat.
 // subagentReport returns the report of the subagent name with its replies: the
 // name in brackets, a new line, the replies, and the zoom that gives its whole
 // chat.