MCPcopy Create free account
hub / github.com/astercloud/aster / monitorProgress

Method monitorProgress

pkg/agent/subagent.go:576–596  ·  view source on GitHub ↗

monitorProgress 监控子 Agent 进度

(ctx context.Context, handle *SubAgentHandle, eventCh <-chan types.AgentEventEnvelope)

Source from the content-addressed store, hash-verified

574
575// monitorProgress 监控子 Agent 进度
576func (m *SubAgentManager) monitorProgress(ctx context.Context, handle *SubAgentHandle, eventCh <-chan types.AgentEventEnvelope) {
577 for {
578 select {
579 case <-ctx.Done():
580 return
581 case env, ok := <-eventCh:
582 if !ok {
583 return
584 }
585 // 转换事件为进度事件
586 progressEvent := m.convertToProgressEvent(handle, env)
587 if progressEvent != nil {
588 select {
589 case handle.ProgressChan <- progressEvent:
590 default:
591 // 通道满了,跳过
592 }
593 }
594 }
595 }
596}
597
598// forwardProgress 转发进度事件
599func (m *SubAgentManager) forwardProgress(ctx context.Context, handle *SubAgentHandle, eventCh <-chan types.AgentEventEnvelope, progressChan chan<- *types.SubAgentProgressEvent) {

Callers 1

ExecuteMethod · 0.95

Calls 1

Tested by

no test coverage detected