emitAgentAndTeamInfo sends the AgentInfo and TeamInfo events that drive the sidebar's agent/model/thinking display. It returns false when sending was aborted (e.g. the context was cancelled). Shared by EmitStartupInfo and EmitAgentInfo so both render identical model labels.
(ctx context.Context, a *agent.Agent, send func(Event) bool)
| 1430 | // aborted (e.g. the context was cancelled). Shared by EmitStartupInfo and |
| 1431 | // EmitAgentInfo so both render identical model labels. |
| 1432 | func (r *LocalRuntime) emitAgentAndTeamInfo(ctx context.Context, a *agent.Agent, send func(Event) bool) bool { |
| 1433 | modelID := r.getEffectiveModelID(ctx, a) |
| 1434 | modelLabel := modelID.String() |
| 1435 | contextLimit := r.contextLimitForAgentModel(ctx, a, modelID) |
| 1436 | if a.HasHarness() { |
| 1437 | modelLabel = agentModelLabel(ctx, a) |
| 1438 | contextLimit = 0 |
| 1439 | } |
| 1440 | if !send(AgentInfo(a.Name(), modelLabel, a.Description(), a.WelcomeMessage(), contextLimit)) { |
| 1441 | return false |
| 1442 | } |
| 1443 | return send(TeamInfo(r.agentDetailsFromTeam(ctx), r.currentAgentName())) |
| 1444 | } |
| 1445 | |
| 1446 | func (r *LocalRuntime) contextLimitForAgentModel(ctx context.Context, a *agent.Agent, modelID modelsdev.ID) int64 { |
| 1447 | if a == nil || modelID.IsZero() { |
no test coverage detected