FileRW: Loeschen ueber den Dateiverlauf umkehrbar, ohne Freigabe; Ordner und Unaufhebbares bleiben beim Menschen (#195)
Der Dateiverlauf (#719) haelt die Vorfassung jeder geloeschten Datei - ein eigener Papierkorb waere doppelt. delete einer Datei, die der Verlauf aufhebt, laeuft ohne Freigabe; Ordner nur mit recursive:true (delete_folder, Freigabe); zu grosse Dateien oder Verlauf aus (delete_unkept, Freigabe); die Wurzel nie. Neue Aktionen deleted und restore mit voller Pfad-/Endungspruefung. IAgentTool.StagingAktion bekommt eine Ueberladung mit Kontext. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
2a225129e9
commit
5de60c3b21
@@ -107,6 +107,24 @@ public sealed class FileHistory
|
||||
public bool Covers(string fullPath)
|
||||
=> !IsInside(Path.GetFullPath(fullPath), Path.Combine(_agentsDirectory, FolderName));
|
||||
|
||||
/// <summary>
|
||||
/// #195: Whether a delete of this file can be undone — the history is on, covers the file
|
||||
/// and keeps content of its size. Only then is deleting it no irreversible act.
|
||||
/// </summary>
|
||||
public bool CanKeep(string fullPath)
|
||||
{
|
||||
fullPath = Path.GetFullPath(fullPath);
|
||||
return Enabled && Covers(fullPath) && File.Exists(fullPath)
|
||||
&& new FileInfo(fullPath).Length <= (long)_settings().MaxObjectMegabytes * 1024 * 1024;
|
||||
}
|
||||
|
||||
/// <summary>#195: Whether the content of a version is still kept.</summary>
|
||||
public bool CanKeepContent(string? hash)
|
||||
=> !string.IsNullOrWhiteSpace(hash) && hash.Length == 64 && hash.All(Uri.IsHexDigit) && File.Exists(ObjectPath(hash.ToLowerInvariant()));
|
||||
|
||||
/// <summary>#195: How long a deleted file's content stays restorable.</summary>
|
||||
public int RetentionDays => Math.Max(1, _settings().RetentionDays);
|
||||
|
||||
// ─── Recording ───
|
||||
|
||||
/// <summary>Keeps the version the file has now, before a tool changes it.</summary>
|
||||
|
||||
Reference in New Issue
Block a user