MCPcopy Index your code
hub / github.com/docker/docker-agent / emitAgentAndTeamInfo

Method emitAgentAndTeamInfo

pkg/runtime/runtime.go:1432–1444  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

1430// aborted (e.g. the context was cancelled). Shared by EmitStartupInfo and
1431// EmitAgentInfo so both render identical model labels.
1432func (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
1446func (r *LocalRuntime) contextLimitForAgentModel(ctx context.Context, a *agent.Agent, modelID modelsdev.ID) int64 {
1447 if a == nil || modelID.IsZero() {

Callers 2

EmitAgentInfoMethod · 0.95
EmitStartupInfoMethod · 0.95

Calls 12

getEffectiveModelIDMethod · 0.95
agentDetailsFromTeamMethod · 0.95
currentAgentNameMethod · 0.95
agentModelLabelFunction · 0.85
TeamInfoFunction · 0.85
HasHarnessMethod · 0.80
AgentInfoFunction · 0.70
NameMethod · 0.65
StringMethod · 0.45
DescriptionMethod · 0.45
WelcomeMessageMethod · 0.45

Tested by

no test coverage detected