monitorProgress 监控子 Agent 进度
(ctx context.Context, handle *SubAgentHandle, eventCh <-chan types.AgentEventEnvelope)
| 574 | |
| 575 | // monitorProgress 监控子 Agent 进度 |
| 576 | func (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 转发进度事件 |
| 599 | func (m *SubAgentManager) forwardProgress(ctx context.Context, handle *SubAgentHandle, eventCh <-chan types.AgentEventEnvelope, progressChan chan<- *types.SubAgentProgressEvent) { |
no test coverage detected