()
| 307 | defer e.mu.Unlock() |
| 308 | return e.slots[tcID] |
| 309 | } |
| 310 | |
| 311 | func (e *StreamingToolExecutor) GetSlotInfo(toolUseID string) SlotInfo { |
| 312 | return e.GetSlot(toolUseID) |
| 313 | } |
| 314 | |
| 315 | func (e *StreamingToolExecutor) Cancelled() bool { |
| 316 | select { |
| 317 | case <-e.cancelCtx.Done(): |
| 318 | return true |
| 319 | default: |
| 320 | return false |
| 321 | } |
| 322 | } |
| 323 | |
| 324 | func (e *StreamingToolExecutor) maybeDrain() { |
| 325 | var toLaunch []string |
| 326 | e.mu.Lock() |
| 327 | if e.Cancelled() { |
| 328 | e.mu.Unlock() |
| 329 | return |
| 330 | } |
| 331 | for _, tid := range e.toolOrder { |
| 332 | slot := e.slots[tid] |
| 333 | if slot != nil && slot.State == ToolStateQueued && e.isSafeLocked(slot.TC) && e.canStartImmediatelyLocked(slot.TC, false) { |
| 334 | toLaunch = append(toLaunch, tid) |
| 335 | } |
| 336 | } |
| 337 | for _, tid := range e.toolOrder { |
| 338 | slot := e.slots[tid] |
| 339 | if slot == nil || slot.State != ToolStateQueued || e.isSafeLocked(slot.TC) || !slot.PermissionGranted { |
no test coverage detected