(state: SessionState, logger: Logger, messages: WithParts[])
| 126 | } |
| 127 | |
| 128 | const pruneToolErrors = (state: SessionState, logger: Logger, messages: WithParts[]): void => { |
| 129 | for (const msg of messages) { |
| 130 | if (isMessageCompacted(state, msg)) { |
| 131 | continue |
| 132 | } |
| 133 | |
| 134 | const parts = Array.isArray(msg.parts) ? msg.parts : [] |
| 135 | for (const part of parts) { |
| 136 | if (part.type !== "tool") { |
| 137 | continue |
| 138 | } |
| 139 | if (!state.prune.tools.has(part.callID)) { |
| 140 | continue |
| 141 | } |
| 142 | if (part.state.status !== "error") { |
| 143 | continue |
| 144 | } |
| 145 | |
| 146 | // Prune all string inputs for errored tools |
| 147 | const input = part.state.input |
| 148 | if (input && typeof input === "object") { |
| 149 | for (const key of Object.keys(input)) { |
| 150 | if (typeof input[key] === "string") { |
| 151 | input[key] = PRUNED_TOOL_ERROR_INPUT_REPLACEMENT |
| 152 | } |
| 153 | } |
| 154 | } |
| 155 | } |
| 156 | } |
| 157 | } |
| 158 | |
| 159 | const filterCompressedRanges = ( |
| 160 | state: SessionState, |
no test coverage detected