MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / applyUndo

Function applyUndo

packages/agent-core/src/services/message/transcript.ts:218–233  ·  view source on GitHub ↗
(count: number)

Source from the content-addressed store, hash-verified

216 };
217
218 const applyUndo = (count: number): void => {
219 if (count <= 0) return;
220 let removedUserCount = 0;
221 for (let i = transcript.length - 1; i >= clearFloor; i--) {
222 const message = transcript[i]!.message;
223 if (message.origin?.kind === 'injection') continue;
224 if (message.origin?.kind === 'compaction_summary') break;
225 transcript.splice(i, 1);
226 foldedLength = Math.max(0, foldedLength - 1);
227 if (isRealUserInput(message)) {
228 removedUserCount++;
229 if (removedUserCount >= count) break;
230 }
231 }
232 resetOpenState();
233 };
234
235 for (const record of records) {
236 switch (record.type) {

Callers 1

reduceWireRecordsFunction · 0.85

Calls 2

isRealUserInputFunction · 0.90
resetOpenStateFunction · 0.85

Tested by

no test coverage detected