subagentNoteEffort = " at effort "
)
+// The statuses of the end of a run, in the work event of its report.
+const (
+ subagentFinished = "finished"
+ subagentStopped = "stopped"
+ subagentFailed = "failed"
+)
+
// errSubagentClosed tells that the runs of the subagents ended with the loop.
var errSubagentClosed = errors.New("the daemon stops, so no subagent starts")
layout *ViewLayout
client ChainClient
state func() string
- report func(text string, stopped bool)
+ report func(name, text, status string)
note func(text string) error
notify func(Event)
var replies []string
stopped := false
+ status := subagentFinished
for more := true; more; {
reply, err := r.chain(ctx, run)
reply = "stopped"
case err != nil:
reply = "failed: " + err.Error()
+ status = subagentFailed
}
more = err == nil && ctx.Err() == nil && len(run.pending) > 0
return
}
- r.report(subagentReport(run.subagent.name, replies), stopped)
+ if stopped {
+ status = subagentStopped
+ }
+
+ r.report(run.subagent.name, subagentReport(run.subagent.name, replies), status)
}
// chain runs one request chain of run and returns its final answer.