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

Function undoLimitFromError

apps/kimi-code/src/tui/commands/undo.ts:372–389  ·  view source on GitHub ↗
(
  error: unknown,
)

Source from the content-addressed store, hash-verified

370}
371
372function undoLimitFromError(
373 error: unknown,
374): (UndoAvailability & { readonly requestedCount: number }) | undefined {
375 if (!isKimiError(error)) return undefined;
376 const details = error.details;
377 if (details?.['reason'] !== 'undo_limit') return undefined;
378 const requestedCount = details['requestedCount'];
379 const maxCount = details['undoableCount'];
380 const stoppedAtCompaction = details['stoppedAtCompaction'];
381 if (
382 typeof requestedCount !== 'number' ||
383 typeof maxCount !== 'number' ||
384 typeof stoppedAtCompaction !== 'boolean'
385 ) {
386 return undefined;
387 }
388 return { requestedCount, maxCount, stoppedAtCompaction };
389}
390
391function isUndoAnchorEntry(entry: TranscriptEntry): boolean {
392 return (

Callers 1

undoByCountFunction · 0.85

Calls 1

isKimiErrorFunction · 0.85

Tested by

no test coverage detected