(
runtime: PiRuntime,
options: { toolCallId?: string | undefined; toolName?: string | undefined } = {},
)
| 112 | } |
| 113 | |
| 114 | export function clearRuntimeToolProgress( |
| 115 | runtime: PiRuntime, |
| 116 | options: { toolCallId?: string | undefined; toolName?: string | undefined } = {}, |
| 117 | ) { |
| 118 | const progress = liveToolProgressByRuntime.get(runtime) |
| 119 | if (!progress) { |
| 120 | return |
| 121 | } |
| 122 | |
| 123 | if (options.toolCallId) { |
| 124 | progress.delete(options.toolCallId) |
| 125 | } else if (options.toolName) { |
| 126 | for (const [toolCallId, entry] of progress) { |
| 127 | if (entry.toolName === options.toolName) { |
| 128 | progress.delete(toolCallId) |
| 129 | break |
| 130 | } |
| 131 | } |
| 132 | } else { |
| 133 | progress.clear() |
| 134 | } |
| 135 | |
| 136 | if (progress.size === 0) { |
| 137 | liveToolProgressByRuntime.delete(runtime) |
| 138 | } |
| 139 | } |
| 140 | |
| 141 | function buildLiveThreadData(runtime: PiRuntime) { |
| 142 | const sessionPath = runtime.session.sessionFile |
no test coverage detected