Skip to content

Commit 74e762c

Browse files
committed
cleanup
1 parent f611573 commit 74e762c

File tree

1 file changed

+0
-6
lines changed

1 file changed

+0
-6
lines changed

lib/messages/prune.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,14 +142,12 @@ export const insertPruneToolContext = (
142142
}
143143

144144
if (isReasoningModel) {
145-
// Reasoning models: inject as user message
146145
const lastUserMessage = getLastUserMessage(messages)
147146
if (!lastUserMessage) {
148147
return
149148
}
150149
messages.push(createSyntheticUserMessage(lastUserMessage, prunableToolsContent))
151150
} else {
152-
// Non-reasoning models: inject as assistant message
153151
const lastAssistantMessage = getLastAssistantMessage(messages)
154152
if (!lastAssistantMessage) {
155153
return
@@ -181,7 +179,6 @@ const pruneToolOutputs = (state: SessionState, logger: Logger, messages: WithPar
181179
if (!state.prune.toolIds.includes(part.callID)) {
182180
continue
183181
}
184-
// Skip write and edit tools - their inputs are pruned instead
185182
if (part.tool === "write" || part.tool === "edit") {
186183
continue
187184
}
@@ -201,16 +198,13 @@ const pruneToolInputs = (state: SessionState, logger: Logger, messages: WithPart
201198
if (!state.prune.toolIds.includes(part.callID)) {
202199
continue
203200
}
204-
// Only prune inputs for write and edit tools
205201
if (part.tool !== "write" && part.tool !== "edit") {
206202
continue
207203
}
208-
// Don't prune yet if tool is still pending or running
209204
if (part.state.status === "pending" || part.state.status === "running") {
210205
continue
211206
}
212207

213-
// Write tool has content field, edit tool has oldString/newString fields
214208
if (part.tool === "write" && part.state.input?.content !== undefined) {
215209
part.state.input.content = PRUNED_TOOL_INPUT_REPLACEMENT
216210
}

0 commit comments

Comments
 (0)